ImageVis3D-3.1.0/0000755000175000017500000000000012320517543013262 5ustar mathieumathieuImageVis3D-3.1.0/.gitignore0000644000175000017500000000032612320517543015253 0ustar mathieumathieuMakefile Default.geo Default.wsp Build .gitignore *.gcno debugLog.txt ImageVis3D.pro.user *.vcxproj.user *.sdf *.suo *.opensdf ImageVis3D/UI/AutoGen *.o *.swp BatchRenderer/BatchRenderer *.dmg *.zip *.tar.gz /ipch ImageVis3D-3.1.0/doc/0000755000175000017500000000000012320517543014027 5ustar mathieumathieuImageVis3D-3.1.0/doc/uvfconvert.10000644000175000017500000000455412320517543016322 0ustar mathieumathieu.TH uvfconvert "1" "May 3, 2010" "SCI" "User Commands" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME uvfconvert \- convert files to UVF. .SH SYNOPSIS .B uvfconvert .RI \-i .RI \fIfile\fP [ options ] \-o \fIoutput\fP .SH DESCRIPTION \fBuvfconvert\fP is a command line tool to convert data into UVF, the native format for the desktop volume rendering program \fBimagevis3d\fP. Unlike ImageVis3D, the tool can be run on headless nodes with no GPUs installed, and utilizes very little memory even for extremely large data. .SH OPTIONS The command line options of \fBuvfconvert\fP are: .TP .B \-i \fIfilename\fP, \-\-input \fIfilename\fP The input data set to convert. Must be in one of ImageVis3D's supported file formats (see the "Getting Data Into ImageVis3D" manual). For merging multiple data sets, this option is accepted multiple times. .TP .B \-d \fIpath\fP, \-\-directory \fIpath\fP Input data to convert, if stored as a stack in a directory. Sets of images or DICOMs commonly come in this format. One of \-i or \-d is required. .TP .B \-s \fIfloating point number\fP, \-\-scale \fIfloating point number\fP Optional. When merging multiple data sets, this scaling factor will be applied to all values in the second file. Defaults to 0.0. .TP .B \-b \fIfloating point number\fP, \-\-bias \fIfloating point number\fP Optional. When merging multiple data sets, this bias factor will be applied to all values in the second file. Defaults to 0.0. .TP .B \-o \fIfilename\fP, \-\-output \fIfilename\fP Required. The filename which will be generated. .TP .B \-\-version Optional. Display a version number and then exit. .TP .B \-\-, \-\-ignore-rest Optional. Any arguments following these flags will be ignored by the program. .TP .SH AUTHOR ImageVis3D and all associated software was written at the SCI Institute, with support from the NIH NCRR and DoE VACET programs. Our primary source of funding comes from demonstrating that our software enables research. Please contact us if you find ImageVis3D beneficial. ImageVis3D-3.1.0/doc/import.adoc0000644000175000017500000015006012320517543016173 0ustar mathieumathieu// a2x: --dblatex-opts "-P latex.output.revhistory=0" Getting Data into ImageVis3D ============================ The ImageVis3D Team Introduction ------------ One of the most common inquiries we get is, "What is the best way to get my data into ImageVis3D?" The answer is invariably specific to your particular case. There are a number of ways you can get ImageVis3D to render your data, with a varying range of associated complexities. This document attempts to answer some of the most common questions. Briefly, there a couple ways ImageVis3D can load data out of the box: by loading up a UVF, ImageVis' native image format, or by converting data into UVF. However, ImageVis3D is meant to visualize massive datasets; theoretically up to exabytes of data. In practice, even for data as small as a terabyte, the conversion process is going to be too time consuming for reasonable day-to-day use. For data at this scale, there are two options: write out your data as UVF in the first place, or implement a reader which sits parallel to UVF within ImageVis3D's IO subsystem. Both impose restrictions on the structure of your data, and will require someone with C++ programming experience to make it happen. However, the payoff is large: ImageVis3D will be able to open your formats `natively', without the costly conversion step, and you will no longer have to deal with the same data replicated across your toolchain's native file format and UVF. .Use our code! [NOTE] ==================================================================== ImageVis3D's design is component-based. In this document, we will use "the IO subsystem" and "ImageVis3D" interchangeably, but we are usually referring to the IO library which we have written specifically for use with ImageVis3D. Despite the name, the library is independent of ImageVis3D, and we explicitly encourage those who are capable to use it separately, in their own applications! More information is available by asking on the mailing lists. ==================================================================== Broadly, both schemes accept data on regular (though potentially anisotropic) grids. The converted formats are what we will refer to as 'single-block', meaning that the entire dataset lives in one large array, regardless of how large the dataset is. By comparison, ImageVis3D's variant of UVF is inherently 'multi-block', meaning that large data are "chunked", such that multiple "chunks" are required to recreate the entire volume. Single-block data is inherently simpler and has more support from existing tools. Multi-block data is more complex, but -- even ignoring ImageVis3D for a moment and speaking from a purely algorithmic standpoint -- there is simply no way to scale single-block data access to provide efficient visualization and analysis for large data. Grid Types ---------- Data can be defined on a wide variety of grid types. ImageVis3D can handle "regular" gridded data as well as geometry, though at present all geometry data must be associated with some kind of volume data. Gridded data is similar to an image file: it is defined as a series of voxels, with an implicit ordering and distance between each voxel. That is, if we call a pixel `x` and define a pixel `x+1` to be the pixel to the right of `x`, then we know that the distance between `x` and `x+1` is equal to the distance between `x+1` and `x+2`. Regular data is an extension of this property to 3D: all data are layed out on an even grid. .Example Regular Gridded Data (`.` represents a grid location) ........................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................................ However, do note that ImageVis3D supports so-called *anisotropic* data. That is, the difference in space between `x` and `x+1` need not be equal to the difference between `y` and `y+1`. More succinctly, the spacing information can vary per-dimension, but not within a dimension. ImageVis3D can also associate geometry with a volume. This geometry must be in the form of a triangle mesh or a set of lines. Note that some formats have more complicated meshes, which are triangulated on the fly during load to meet this requirement. If your data do not exemplify regular grid data or geometry, ImageVis3D will not be able to handle it natively. For now, your best bet to be able to import such data into ImageVis3D is to resample it onto a regular grid. The http://www.visitusers.org/[VisIt] software package might be able to do this resampling for you; a sample Python script which uses VisIt to do this is given later in this document (see the section on the "BOV" file format). Existing File Formats --------------------- ImageVis3D might already support converting the formats you care about into its native UVF container format. You might also consider rewriting data in one of these formats to better support ImageVis3D. If your data are inherently single-block, this will be your quickest path to loading and visualizing your data. Volume Data ~~~~~~~~~~~ For 3D gridded volume data, ImageVis3D supports: - *DICOM stacks* (`.dcm` extension, normally): A set of DICOM files which form a volume. Use the "Load Dataset from Directory" feature to load these datasets. - *Image stacks* (`.png`, `.tif`, `.bmp`, `.jpeg`/`.jpg`, `.qif` extensions): sets of 2D images which form a volume when rendered together. As with DICOM stacks, use the "Load Dataset from Directory" feature to load these datasets. - *QVis* (`.dat` extension): QVis header and accompanying raw data - *NRRD* (`.nrrd` and `.nhdr` extensions): NRRD files, as output by the link:http://teem.sf.net/[Teem] library and associated tools. - *Stack* (`.stk` extension): Metamorph "stack" files; a special case of TIFFs, output by the Metamorph software package. - *TIFF* (`.tiff`, `.tif` extensions): A TIFF stack; these differ from an image stack in that the entire volume is stored in a single file. - *VFF* (`.vff` extension): Visualization File Format - *Brick of Values* (`.bov` extension): A raw 3D array and associated header; a common method to export data from the link:http://www.visitusers.org/[VisIt] software package. - *REK* (`.rek` extension): Fraunhofer Raw format. - *Inveon* (`.hdr` extension, with accompanying `.img`): files from Inveon scanner. - *Analyze* (`.hdr` extension, with accompanying `.img`): Analyze 7.5 files. - *Amira* (`.am` extension): so-called "AmiraMesh" files, which, despite the name, consist of gridded 3D volume data. - *Raw* data, optionally compressed DICOM Stacks ^^^^^^^^^^^^ DICOMs are notoriously difficult to parse, work with, and have poor access times. Do not use DICOM if you are not already. We will not document the format here, but if you are dead-set on this format, you can find the entire ~3000 page specification on link:http://medical.nema.org/[the official DICOM web site]. Image Stacks ^^^^^^^^^^^^ ImageVis3D supports loading sets of images in the common formats. Specifications for each image type are beyond the scope of this document. If you are designing a new visualization pipeline, we would discourage reliance on image stacks due to slow access times. For many if not all image types, image data is downsampled to 8bits before it is handed to ImageVis3D's IO subsystem. This is fixable, but at present has yet to be a pressing concern. Please let us know if this is a significant hurdle for your data. QVis ^^^^ QVis is a simple 'header + data' file format. The file which the user selects via the ImageVis3D UI, which must have the extension `.dat`, is comprised of a series of ASCII key-value pairs. One of these pairs, with the `ObjectFileName` key, gives the name of a file which contains raw data. QVis is currently the only mechanism by which one can load color data into ImageVis3D. Other file formats are capable of storing color data, but code must be added to the converter to inform higher levels of ImageVis3D to handle the data correctly. QVis would be a good format to standardize around if you were designing a pipeline to work with single-block, raw data. An example `.dat` file is: ....................................... ObjectFileName: body.raw16 TaggedFileName: --- Resolution: 512 512 1884 SliceThickness: 1 1 1 Format: USHORT NbrTags: 0 ObjectType: TEXTURE_VOLUME_OBJECT ObjectModel: RGBA GridType: EQUIDISTANT ....................................... This describes a `512x512x1884` dataset, stored as 16-bit unsigned integers (`USHORT` s). As such, one would expect the data file, `body.raw16`, to be 987,758,592 bytes (`512 x 512 x 1884`, times 2 bytes per element because the data are 16-bit). Despite the `ObjectModel`, this is not color data, because the `Format` implies there is only a single element per grid location. The user might have specified color data by dictating the format was `USHORT4` data, indicating there are 4 unsigned short values per grid location. This volume is isotropic ("1 1 1" `SliceThickness`, `EQUIDISTANT` grid type). If you would like to write your own QVis data exporters, we recommend: - Always put the `ObjectFileName` as the first key available in the header. - Include the `TaggedFileName`, `NbrTags`, `ObjectType`, `ObjectModel`, and `GridType` keys, even though ImageVis3D will ignore them (just copy the values used above, if nothing else). You never know when some other piece of software will require those fields. - Stick to `CHAR`/`BYTE`, `UCHAR`, `SHORT`, `USHORT`, `UCHAR4` (color data), and `FLOAT` for your `Format` s. Other types are not currently implemented! Patches are welcome. Nearly Raw Raster Data (NRRD) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ NRRD is a single-block format comprised of a header with accompanying data. The NRRD file format is described extensively link:http://teem.sourceforge.net/nrrd/format.html[on its web site]. ImageVis3D's implementation suffers from some quirks because it eschews the use of the more general Teem library. We would welcome contributions which would allow ImageVis3D to understand more of NRRD's fields. At the very least, please provide bug reports if you find fields which are not understood by ImageVis3D. NRRDs can be "attached" or "detached", the former meaning that metadata and data appear concatenated in a single file, and the latter meaning that the metadata information contains a specific tag which details a second file comprising the data. In the "detached" form, the file extension is normally ".nhdr" instead of ".nrrd". Metamorph "Stack" Files ^^^^^^^^^^^^^^^^^^^^^^^ Metamorph "Stack" files are a special case of TIFF. ImageVis3D can read them by forcing the underlying `libtiff` library to read TIFF headers which it does not natively understand. This is a compatibility format; it exists solely to ease migration from past and present Metamorph users. If you have a choice, do not use this format. TIFF Volumes ^^^^^^^^^^^^ While the majority of TIFFs contain just a single image inside them, a little known feature of the format is that it stores each image in what it calls a `Directory'. Most TIFFs you would find on the web or in similar places consist of a single Directory, but some scientific software can generate these multi-directory TIFFs. TIFF volumes suffer from poor access time, because each image slice is stored separately instead of as a continuous volume. Further, the bundled converter for TIFF volumes is among the worst in ImageVis3D: ImageVis3D assumes that an input volume is a contiguous chunk of data. As such, the converter must read each slice and append it into a single volume, requiring significantly increased temporary disk storage, as well as a costly additional conversion step. It is not recommended you utilize TIFF volumes if given the choice, but the format may be convenient for interoperation with other software. If you do go this route, we recommend utilizing the `libtiff` library, which has link:http://www.libtiff.org/libtiff.html[excellent documentation]. VFF ^^^ This format was written for a specific collaborator. It is a `header + data' format, very similar to an attached NRRD. Little other information is available at this time. Brick of Values (BOV) ^^^^^^^^^^^^^^^^^^^^^ This is a compatibility format, meant to allow importing data from the VisIt software package. It is a header + data format, very similar in concept to a detached NRRD. In some cases, a BOV may be split into multiple files, using a special `%` notation for the filenames within the header. This variation is not supported by ImageVis3D. To ensure you will only have a single data file, make sure you have a "single block" dataset in VisIt. You can obtain one by applying a non-distributed "Resample" operation on the data. Here is a VisIt-python script which converts a dataset in the `/path/to/dataset.silo` file into a 512^3 volume which ImageVis3D could import: [python] source~~~~ include::helium.py[] source~~~~ After modifying the `db = ...` line, invoke the script with: `/path/to/visit -cli -nowin -s script.py`. Fraunhofer Raw Volumes ^^^^^^^^^^^^^^^^^^^^^^ This is a simple binary format which directly supports a collaborator's work. Not much else is known at this time, but you could ask for more information on the link:https://lists.sci.utah.edu/sympa/subscribe/tuvok-developers[tuvok-developers] mailing list. Inveon ^^^^^^ The Inveon format is a header + data format, similar in concept to a detached NRRD. In ImageVis3D, users select a `.hdr` file, which is assumed to correspond to a `.img` file: the "header" file must be named exactly the same as the `.img` file, except with the `.hdr` *appended* (so that the file appears to have multiple extensions). The format typically stores CT data. Header files consist of lines of metadata with parameters appearing after keys. Currently, ImageVis3D only recognizes version "001.910" of these files, due to a lack of other data to test with. The format is simple and efficient, but verbose and ill-documented, with unknown support in other tools; therefore it is recommended that other formats be used in your visualization solutions, if you have the choice. Analyze ^^^^^^^ The Analyze file format was developed at the Mayo Clinic as part of a software package of the same name. Do note that there are multiple versions of this format; ImageVis3D supports the 7.5 variant. Data sets in this format consist of small `.hdr` files which describe the data, and then put raw data in `.img` files. Amira ^^^^^ Amira is a visualization package developed by "Visage Imaging". The program can export so-called "AmiraMesh" files, which are ASCII files which consist of a small header and a raw listing of the data. Amira can also export ".grd" ("grid") files, which ImageVis3D does not currently support. If this is a limiting factor for you, please let us know! Adding support for this variation shouldn't be too difficult. "AmiraMesh" would be a poor choice to standardize around for your data visualization and analysis needs, because it does not support anisotropy and data access is extremely slow. Raw Data ^^^^^^^^ If ImageVis3D cannot identify your data type, it will assume the data are raw and open up a conversion dialog to specify the data parameters. This converter expects that data will be 3 dimensional. Data must be layed out, as the name implies, in a 'raw' manner; if there is metadata stored between data values, this converter will not function correctly. It can, however, skip over some bytes at the beginning of a data file, to accomodate typical "header + value" formats. The data must vary in X slowest, and Z quickest. If this is not the case for your data, you should swap X and Z dimensions that you input. Note that 'X slow, Z fast' corresponds to what many think of as the "C" way to write data, whereas 'Z fast, X slow' corresponds to what many people consider "Fortran arrays". The raw conversion dialog is not available when ImageVis3D is run in batch mode, as is the case when scripting commands are being executed. The source repository includes a command line tool to batch convert a set of datasets. Geometry Data ~~~~~~~~~~~~~ Geometry also supports loading meshes and rendering them concurrently with volumes. - *OBJ* (`.obj` extension): geometry definition popularized by Wavefront software packages. - *PLY* (`.ply` extension): the file format used for the http://graphics.stanford.edu/projects/mich/[Digital Michelangelo] project. - *MedAlyVis* (`.trk`, `.tri` extensions): collaborator-specific format. - *IV3D Mobile* (`.g3d`, `.g3dx` extensions): format used to render geometry in ImageVis3D Mobile. OBJ ^^^ The http://en.wikipedia.org/wiki/Obj[obj file format] is a fairly simple ascii-based file format which is incredibly popular. This is a good format to choose for interoperation with other tools, but is not efficient and thus not a good choice for large data. ImageVis3D can only render geometry which consists of triangular faces. OBJ files can, however, store meshes with an arbitrary number of vertices per face. ImageVis3D will triangulate such data during conversion. PLY ^^^ PLY is the format used for a variety of models from the Stanford model repository. These are typically scans of objects which have been obtained via a high resolution laser scanner. The models have become very popular in visualization and computer graphics research, as a test bed for algorithms. MedAlyVis ^^^^^^^^^ This software does not appear to be generally available, but has a relatively simple format. The format might be a good choice if you do not have an existing format and need to import some simple triangle meshes into ImageVis3D. .MedAlyVis Geometry File Format [options="header"] |============================================================================= | Field | Type | Byte Offset | Width | number of vertices | 32-bit unsigned integer | 0 | 4 | number of triangles | 32-bit unsigned integer | 4 | 4 | vertex | float | 8 | 12/element | triangle indices | 3x 32-bit unsigned integer | 8 + sizeof(vertex data) | 12/element |============================================================================= Do note that data are assumed to be written out in the same endianness of the machine which is reading the data. IV3D Mobile ^^^^^^^^^^^ ImageVis3D mobile is the mobile counterpart to ImageVis3D. Adding a Volume Data Converter ------------------------------ :leveloffset: 1 include::add-converter.adoc[] :leveloffset: 0 Adding a Geometry Converter --------------------------- The conversion interface for geometric data is very similar to that of volume data. 1. Create a new class, derived from `AbstrGeoConverter`. 2. Register your class with the IO subsystem. 3. Override the `ConvertToMesh` function to read a file and create an in-memory mesh. Geometry Converter Skeleton ~~~~~~~~~~~~~~~~~~~~~~~~~~~ You'll need both a header file (`.h`) and an implementation file (`.cpp`) for your format. They should define a class, derived from `AbstrGeoConverter`, which implements the `ConvertToMesh` method. Here's an example header file: [c++] source~~~~~ #include "AbstrGeoConverter.h" namespace tuvok { class YourConverter : public AbstrGeoConverter { public: YourConverter(); virtual Mesh* ConvertToMesh(const std::string& strFilename); }; } source~~~~ For now, just sketch out the implementation file by returning `NULL` in the mesh loading routine: [c++] source~~~~ #include "YourConverter.h" YourConverter::YourConverter() {} Mesh* YourConverter::ConvertToMesh(const std::string& fn) { return NULL; } source~~~~ Building Your Geometry Converter ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Just like when implementing your volume data converter, you'll need to add your source files to the project files so that they will be built as part of ImageVis. Open up `Tuvok/Tuvok.pro` in a text editor and add your converter to both the '`HEADERS`' and '`SOURCES`' variables: ............................ HEADERS += \ ... IO/AbstrGeoConverter.h \ IO/YourFileHere.h \ IO/PLYGeoConverter.h \ ... SOURCES += \ ... IO/AbstrGeoConverter.cpp \ IO/YourFileHere.cpp \ IO/PLYGeoConverter.cpp \ ... ............................ On Windows, the visual studio project files are separate from the qmake profile files. Please be sure to add your new files into the `.pro` file anyway, however; otherwise your additions will not be available on Linux or Apple platforms. Register Your Geometry Converter with the IO Subsystem ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To inform ImageVis3D that your converter exists, you need to register it with the IO subsystem. Open up `IOManager.cpp` and add a `#include` line for your converter's header file. Then, in the `IOManager` constructor, add a line which creates an instance of your converter and adds it to the list of available geometry converters: [c++] source~~~~ m_vpGeoConverters.push_back(new YourConverter()); source~~~~ Register Your File Extensions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The constructor for your geometry converter should modify two internal class variables: `m_vConverterDesc` and `m_vSupportedExt`. The former should be set to a short human-readable string that describes the format. This must be a single line and should generally be a short phrase of a few words or less -- for example, "Wavefront Object File". The second variable is a vector which holds the valid file extensions for the format, using only capital letters and without the trailing ".". [c++] source~~~~ YourConverter::YourConverter() { m_vConverterDesc = "My File Format"; m_vSupportedExt.push_back("YOUR"); m_vSupportedExt.push_back("YUR"); } source~~~~~ Implement `ConvertToMesh` ~~~~~~~~~~~~~~~~~~~~~~~~~ This is where all the work is done. You should allocate a `tuvok::Mesh` on the heap, fill in all the information you can, and return it from this method. Implementing a Reader Parallel to UVF ------------------------------------- If your data format meets certain criteria, it is possible for you to write a reader which sits parallel to UVF. This will allow ImageVis3D to read your data natively, without any conversion process. For extremely large data, a conversion process is infeasible. NOTE: Only volume data is currently supported via this interface; geometry data must be loaded via the conversion interface. The criteria your format must meet are: - You must meet the 'standard' requirements for ImageVis3D data: namely, your data must be defined on a regular, though potentially anisotropic, grid. - Your data must be 'bricked'; a large volume is composed of a set of small volumes. - You have at least two levels of resolution for your data; in general, more levels will be better, within reason. - The coarsest resolution of your data consists of a single 'brick'. - You can load the coarsest resolution of your data in 3- or 4-hundred milliseconds. Further, this is the most complicated of methods to get your data into ImageVis3D. Someone in your lab must be capable of writing C++ code. Writing Your Reader ~~~~~~~~~~~~~~~~~~~ The basic steps involved in writing your own reader are: 1. Create a new class derived from `FileBackedDataset`. 2. Register your format with the IO subsystem. 3. Implement `CanRead` and `Create` methods, to allow the IO system to identify your dataset type. 4. Implement methods to query data and metadata from your dataset. Reader Skeleton ^^^^^^^^^^^^^^^ You'll need to create a header file (`.h`) and an implementation file (`.cpp`) for your new format. They should define a new class which includes a large set of methods. 1. Copy `Dataset.h` to `.h` 2. Modify `YourFormat.h`: * Add the header `FileBackedDataset.h`, remove other headers. * Derive the class from `FileBackedDataset`. * Make all of the pure virtual methods simply virtual. * Add `CanRead` and `Create` methods with the same signatures as from `FileBackedDataset`. Next, stub out an implementation file. At this stage, we highly recommend you do not attempt to implement your reader, but instead just add the minimal return statements required for compilation. For instance, implement the `GetLODLevelCount` method like so: [c++] source~~~~ virtual UINT64 GetLODLevelCount() const { return 0; } source~~~~ etc. Building Your Reader ^^^^^^^^^^^^^^^^^^^^ You will need to add your new reader to the build. The files which are part of the IO subsystem are currently listed in the 'Tuvok/Tuvok.pro'. You'll find `HEADERS` and `SOURCES` variables in that file, which list all of the files involved in the build. You must add you reader to both variables. ............................................................................ HEADERS += \ ... IO/AbstrConverter.h \ IO/BOVConverter.h \ IO/*YourReaderHere.h* \ IO/BrickedDataset.h \ ... SOURCES += \ ... IO/AbstrConverter.cpp \ IO/BOVConverter.cpp \ IO/*YourReaderHere.cpp* \ IO/BrickedDataset.cpp \ ... ............................................................................ IMPORTANT: On Windows, `qmake` is unfortunately no longer used. You must add your files to the Visual Studio project file in the normal way on this platform. Make sure to add your files to the `.pro` file anyway, though -- it will be required for the Linux and Mac builds. You can now compile ImageVis3D and test that your new class includes all the right methods. Register Your Data Format ^^^^^^^^^^^^^^^^^^^^^^^^^ For ImageVis3D to attempt using your format, it must know how to identify your files. Two steps are required here: you must implement the `CanRead` and `Create` methods, and you must register your format with the `IOManager`. `CanRead` and `Create` ++++++++++++++++++++++ `CanRead` is straightforward; it must return `true` when the file is in your format. Normally you would do this by verifying the magic bytes at the beginning of the file. `Create` is a simple "virtual constructor"; you just need to instantiate an object of your class. The constructor of your class, or the `Create` method itself, is allowed to throw any exception derived from `DSOpenFailed` (see `TuvokIOError.h`) to indicate any errors encountered while actually opening the file. IMPORTANT: Do *not* report errors in the `CanRead` method! Save error detection for `Create`. `uvfDataset.cpp` provides a good example of how these methods might be implemented. Note that `UVFDataset` does its error detection in `Open`, which is automatically called from the constructor. Registration with the IO Subsystem ++++++++++++++++++++++++++++++++++ This just requires a small addition to the `IOManager`. Open up `IOManager.cpp` and find the constructor. There is already a line to register UVF with the IO manager: [c++] source~~~~ m_dsFactory->AddReader(std::shared_ptr(new UVFDataset())); source~~~~ Add a similar line for your reader. You will also need to add a `#include` line slightly above the constructor. Test! +++++ At this point, ImageVis3D should be able to both identify and at least attempt to read your data. It will return garbage values for just about every inquiry, but now would be a good time to test the registration. Selecting one of your files from the ImageVis3D UI should attempt to open it, and promptly report some sort of error -- probably complaining about the lack of data in the file. The exact error is unimportant. The important thing is that ImageVis3D does not prompt you for a UVF file name after selecting your file. This indicates that ImageVis3D knows about your format and recognizes that it does not require conversion. Implement `Dataset` Methods ^^^^^^^^^^^^^^^^^^^^^^^^^^^ There are too many dataset methods to exhaustively outline implementations for each one of them. We outline them by categories here. For specific details, see the doxygen comments, and/or follow the implementation in `uvfDataset.cpp`. NOTE: Never cache any *data* in your reader implementation. Tuvok, ImageVis3D's renderer, implements caching of bricks at a level slightly higher than your dataset. You will defeat its memory management routines by wasting memory in your dataset, which may lead to excessive swapping. Caching metadata, or other small information about data, is fine. If you feel you must store a large amount of information, you should tie into the memory management system to "register" your memory. Histograms ++++++++++ ImageVis3D requires 1D and 2D histograms to use as the backdrop of the transfer function editors. UVF stores these histograms in the file. The `GetHistograms` method initializes the `m_pHistXD` variables. This occurs when the UVF is first opened. The alternative would be to generate these on the fly and cache the results. We highly discourage such an ad hoc histogram calculation: for one, users will have to pay for it every time they open your file. Secondly, the calculations can take significant time, and that time is taken between when the user selects the file and when they see a window opening on their screen. Your format will look very slow if it does a long calculation at this point. Do note that the calculation of a 2D histogram is an *extremely* expensive operation. ImageVis3D only calculates the 2D histogram for the coarsest level of detail, _even though we have a preprocess to generate these data_! You are welcome to implement an exact solution, but be careful about how much work you do at open time. Brick Inquiries +++++++++++++++ `GetBrick...` functions query data and metadata about a brick. Of course, the most important of these is the `GetBrick` method itself, which loads the data for a brick. This method takes a `BrickKey` and is expected to fill the `std::vector` argument with the data for that brick. The `BrickKey` is under your control: when you open your file, you should make a series of `AddBrick` calls, each with a unique `BrickKey`. ImageVis3D will then use those `BrickKey` s to request data from your Dataset implementation. You can "encode" whatever information you need into that key; as an example, `UVFDataset` encodes the spatial position of a brick in the "brick index" portion of the key. The `IndexToVector` method then decodes the "brick index" back into the 3D index. Data Type and Size ++++++++++++++++++ There are a variety of methods, such as `GetBitWidth` and `GetIsSigned`, which are used to identify features of the dataset. These provide important information on how the data received out of `GetBrick` is interpreted. `Extensions` ++++++++++++ You must implement a method named `Extensions` which takes no arguments and returns a list of strings. ImageVis3D will use this information to generate the formats utilized in the "Open" window. See `uvfDataset.cpp` for an example implementation. *Optional*: `Verify` ++++++++++++++++++++ `Verify` is how you would implement an "expensive" check for your file format. UVF calculates a checksum by reading the entire file, and compares it to a precalculated checksum in the file. Keep in mind that the user can disable this check through the ImageVis3D UI. *Optional*: Rescale Factors +++++++++++++++++++++++++++ These are normally handled by your parent classes. However, there is one method, `SaveRescaleFactors` that you may reimplement. If the user changes the rescale factors in the UI and then selects "Save To File", ImageVis3D will call this method. You should re-open your file in read-write, and add some metadata about the spacings in the X, Y, and Z axes. *Optional*: First/Last Bricks +++++++++++++++++++++++++++++ `Dataset` contains two methods, `BrickIsFirstInDimension` and `BrickIsLastInDimension`, which inform the renderer whether or not they are the "leftmost" or "rightmost" brick. `BrickedDataset` does provide a default implementation for these methods, so ImageVis3D will work even if you do not override them. However, `BrickedDataset` has very limited knowledge of your dataset; it requires `O(n)` time in the number of bricks to answer this. Some formats can answer this in constant time. If you can do so, it is highly recommended you implement these methods; it will significantly speed up ImageVis3D's "frame planning" algorithms. *Optional*: Acceleration Queries ++++++++++++++++++++++++++++++++ These consist of the `ContainsData` methods. These are meant to key into any acceleration structures you might store in a file, and allow ImageVis3D to reject bricks without rendering them. This can significantly increase performance when available. They are given a brick key and some kind of information on what ImageVis3D is looking for. There are three methods, one for each of the primary render modes. As an example, the two-argument version of `ContainsData` is used when rendering isosurfaces. If the user selects an isosurface of 42, and you know that a given brick only has values from 96 to 428, then there is no reason to render that brick, and so `ContainsData` would return false. Do not scan your data to identify the results of these methods. The GPU will do that much quicker than you could ever dream of doing here. However, if you have precomputed this information, implement these methods to significantly increase performance. *Optional*: `Export` ++++++++++++++++++++ ImageVis3D can also be used as a converter from one file format to another. The `Export` method helps in doing this. If you implement this method, you should serialize your data to the file name given in the argument, in a completely "raw" (unbricked) form. If you do not care about this functionality, just ignore this method. The default implementation already indicates that the export operation has failed. *Optional*: `Name` ++++++++++++++++++ While not strictly required, you should implement a `Name` method. This simply returns a user-centric name which describes your data format. The string should be short; you just want to differentiate this from other formats. As an example, ImageVis3D's native format returns the string, "Universal Volume Format". Converting Your Output Format to ImageVis3D's UVF ------------------------------------------------- UVF is more of a container format than a full file format. The primary author of this document considers it more of a filesystem than a file format. This is because UVF is very general, relying on the applications which implement it for some of the semantic value of the data. As an example, with existing code it would be easy to write a 9-dimensional, 6-channel tensor dataset into a UVF file. ImageVis3D will have absolutely no idea how to render that data, but it is perfectly valid as a UVF file. UVF does, however, provide a means to query the kind of data stored in the file. If ImageVis3D encountered such a dataset, it would simply ignore that data. This is the recommended way to handle UVF files: pull out the portions your application understands, and ignore the rest. This naturally only works if the format itself supports multiple independent 'portions'. UVF supports this natively, and in fact ImageVis3D itself makes use of a few different 'portions', or, in UVF parlance, 'blocks'. Each block is almost like a file in-and-of itself; it contains a small header detailing specifics of that block, followed by whatever payload is relevant. A global header presides over the entire UVF file, giving very general information and helping to index the various blocks which exist in the file. An academic paper about UVF link:http://www.sci.utah.edu/scipubs/search.html?schTerm=Unified+Volume+Format&year=2010&schGroup=&entrytype=[was published] while the format was still in its infancy. The format has changed slightly since then, but not in concept, and the changes have actually been surprisingly minor. As such, it still provides a relevant overview of UVF's format, features, and design goals. Unified Volume Format Reference ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In brief, UVF files start with a common header. After the header follows a series of blocks, each with specialized data contained within them. All blocks contain a block header, and share a common subset of header information, which appears before block-specific header information. Master Header ^^^^^^^^^^^^^ The first bytes within a UVF comprise the 'Master Header': a global header for the file which describes globally relevant parameters. In order, these components are: - The raw, constant bytes: `0x55 0x56 0x46 0x2d 0x44 0x41 0x54 0x41`. These are UVF's "magic" bytes; many files may begin with these bytes, but a UVF file will never begin with anything different. Note that these bytes, if interpreted as ASCII characters, spell out the string "UVF-DATA". - A single byte which details whether the file stores data in little or big endian. Zero values imply little endianness; non-zero values imply big endian data. This effects all subsequent data in the file, from the next values in this header, to data stored within UVF's blocks. - An unsigned, 64-bit integer which gives the version of the UVF file. ImageVis3D wrote out version 2 UVF files since 1.0 was released in May 2009. However, starting in August 2010 ImageVis3D has begun writing out version 3 UVF files, and will do so in a release starting with version 2.0. ImageVis3D does not support version 0 or 1 UVF files, and any differences between those and version 2 will not be documented here. - An unsigned, 64-bit integer which details how the file checksum was calculated, according to the following table. .Integer Representation of Checksum Calculation Method [width="70%", frame="all", cols="1,10", options="header"] |==================================================================== |Value | Meaning of the 64-bit value | 0 | No checksum exists | 1 | The checksum was calculated via a simple crc32 algorithm | 2 | The popular MD5 algorithm was used to calculate the checksum | 3 | An unknown method was used to calculate the checksum | * | Undefined. Reserved. |==================================================================== - An unsigned, 64-bit integer containing `n_checksum_bytes`, the number of bytes in the checksum. IMPORTANT: The number of bytes in the checksum *always* appears, even if the type of checksum is 'none' (i.e. `0`, as per above)! Of course, this field will be set to 0 if that is the case. - `n_checksum_bytes` of data which comprise the file's checksum. - An unsigned, 64-bit integer giving the number of bytes to seek _from the position after reading this element_ (i.e., use `SEEK_CUR`). For example, if you are using the C streams interface, code to read this element and seek to the first block might look like this: [c++] source~~~~ uint64_t seek; fread(&seek, sizeof(uint64_t), 1, fp); if(needed) { /* as per the endianness byte, above */ seek = bswap_64(seek); } fseek(fp, seek, SEEK_CUR); /* fread now will read the first byte of the first real block */ source~~~~ - Any number (including 0) of undefined bytes. Future UVF versions may add meaning to the bytes starting here and up to the first data block, so _portable UVF readers must seek over these bytes_! Data Blocks ^^^^^^^^^^^ There are relatively few data blocks currently defined. They are: 1D histograms, 2D histograms, Key-value pairs, maximum and minimum data values, raster data, and geometry data. All data blocks start with a common header. The data in this header, in order, is: - An unsigned, 64-bit integer detailing the size of ... - ... a series of bytes forming an ASCII string which describes the block's type. This element is intended for display in, for example, a UI that lets one view and manipulate UVF blocks, *not* for doing string comparisons to figure out what kind of data are in the block. * Do note that the "size" integer does *not* include the terminating null byte! - The semantic type of a block, which details the specific data block present. .Semantic Block Types [width="50%", frame="all", cols="1,10", options="header"] |==================================================================== |Value | Meaning of the 64-bit value | 0 | Empty. This should not occur in production. | 1 | Regular, N-dimensional gridded data ("Raster data"). | 2 | An N-dimensional representation for a transfer function | 3 | Preview image, meant to give an idea what is in the file | 4 | Key value pairs: strings used to provide extraneous metadata | 5 | 1D Histogram | 6 | 2D Histogram | 7 | Maximum and minimum data values (acceleration structure) | 8 | Geometry | * | Undefined. Reserved. |==================================================================== - The type of compression used for the block. .Block Compression Type [width="50%", frame="all", cols="1,10", options="header"] |==================================================================== |Value | Meaning of the 64-bit value | 0 | None; the block is not compressed | * | Undefined. Reserved. |==================================================================== - An unsigned, 64-bit integer offset to the next block. This is relative to the _beginning_ of the current block. A value of `0` indicates that this is the final data block in the UVF. 1D Histogram Data Block +++++++++++++++++++++++ This data block essentially contains just an array of values which form a histogram for a scalar dataset. - First 64 bits: unsigned integer which gives the `histogram_size` - `histogram_size` 64-bit elements following that: the histogram. Indices into the array detail the data value; values in the array give the number of times that data value occurs. Thus, if `arr[8] == 19`, then the value `8` occurs in the dataset `19` times. The association between histograms and datasets is purely implicit. If a UVF contains two dataset blocks and one 1D histogram block, it is technically ambiguous as to which dataset the histogram was computed from. In ImageVis3D's UVF, mappings are 1:1; the situation listed here would be an error. 2D Histogram Data Block +++++++++++++++++++++++ Stores a 2D histogram for a given dataset. Essentially, this stores a contiguous array of 1D histograms. The histogram is assumed to be "square": the second dimension does not vary from its initial value. ImageVis3D assumes that the second dimension is gradient magnitude. - First 32-bits: IEEE-754 representation of the max gradient magnitude. - Following 64 bits: unsigned integer count, `elems_X`. - Following 64 bits: unsigned integer count, `elems_Y`. - Final `elems_X` x `elems_Y` x 64 bits: the histogram, with X as the slowest moving dimension. Key Value Pairs Block +++++++++++++++++++++ Stores a set of simple string-based key-value pairs. This is typically used to store metadata about the dataset which are not relevant to visualization. - First 64-bits: unsigned integer `n_elements`. - `n_elements` of: * 64-bit unsigned integer giving a `key_length` * `key_length` bytes storing an ASCII "key" string. * 64-bit unsigned integer giving a `value_length` * `value_length` bytes storing an ASCII "value" string. Raster Data Block +++++++++++++++++ This is where ImageVis3D stores the data it renders. It is intended to store N-dimensional, regularly gridded data. - First 64-bits: unsigned integer `n_dimensions` - Only if `n_dimensions` is non-zero: * `n_dimensions` 64-bit semantic block identifiers * `n_dimensions+1` x `n_dimensions+1` IEEE-854 64-bit FP values storing a default transformation. * `n_dimensions` 64-bit unsigned integers giving the size of the domain, slowest dimension first. * `n_dimensions` 64-bit unsigned integers giving the size used for bricks, slowest dimension first. * `n_dimensions` 64-bit unsigned integers giving the overlap among bricks * `n_dimensions` 64-bit unsigned integers giving the factor by which successive domains are downsampled. * `n_dimensions` 64-bit unsigned integers ??? - `n_dimensions` 64-bit unsigned integers giving the number of LODs for each dimension of the data. - a 64-bit unsigned integer, `n_elements` - `n_elements` 64-bit unsigned integers giving the element size, `el_size`. - This repeats `n_elements` times; let `i` equal the iteration number: * `el_size[i]` 64-bit unsigned semantic identifiers * `el_size[i]` 64-bit unsigned bit sizes: number of bits per element. * `el_size[i]` 64-bit unsigned mantissas ... _(Sadly, this part of the documentation is not complete. In the meantime, see the source for more information.)_ Geometry Block ++++++++++++++ This block stores a collection of indexed triangles. It exists only in version 3 UVF files and up; it is an error to write a geometry block into a UVF with a version number of 2 or lower. Geometry data are 3-dimensional. The format for the block is quite simple. First, a header gives size information for arrays (all sizes are in bytes): .Geometry Block Header [cols="1,6,1,2", options="header"] |============================================================================= | Byte offset | Field | Field Width | Field Type | 0 | number of vertices | 8 | unsigned integer | 8 | number of normals | 8 | unsigned integer | 16 | number of texture coordinates | 8 | unsigned integer | 24 | number of color values | 8 | unsigned integer | 32 | number of vertex indices | 8 | unsigned integer | 40 | number of normal indices | 8 | unsigned integer | 48 | number of tex coord indices | 8 | unsigned integer | 64 | number of color indices | 8 | unsigned integer | 72 | default color, "R" channel | 4 | IEEE-754 float | 76 | default color, "G" channel | 4 | IEEE-754 float | 80 | default color, "B" channel | 4 | IEEE-754 float | 84 | default color, "A" channel | 4 | IEEE-754 float | 88 | length of a string | 8 | unsigned integer | 96 | description of the data | variable | character | 96+str len | vertices per polygon | 8 | unsigned integer |============================================================================= Afterwards comes the `vertices`, `normals`, `texture coordinates`, and `color` data, all as IEEE-754 floating point arrays, and in that order. They are sized as given in the header. Note that the sizes give the number of elements in the array, not the number of elements. Since a vertex consists of 3 elements, for example, if there are 3 vertex indices that means there is only a single triangle in the geometry block. Finally come the indices into the data. These come in the same order (vertex indices, then normal indices, then texture coordinate indices, followed by color indices), and again are sized as given in the header. However, index data is always stored as 32-bit unsigned integers. Contribute Back --------------- While not strictly related to the main purpose of this document, we would like to take this opportunity to encourage you to make any changes you make to ImageVis3D's source code available. ImageVis3D is an open source project. You can download the source, modify it to your heart's content, and redistribute it however you would like. The licensing is incredibly liberal; you could even recompile it as-is and sell it as a commercial product. It is not *required* that you make your source available. It is not *required* that you participate in future development. However, it is in everyone's best interest that you do so. Benefits of Contribution ~~~~~~~~~~~~~~~~~~~~~~~~ The benefits to the ImageVis3D project are somewhat obvious. If you write some code to allow ImageVis3D to read a new type of data, anyone else can then pick up the program and use it to visualize that kind of data. This enables ImageVis3D to be used in more domains, increasing the project's user base, which significantly helps us pursue funding for development of ImageVis3D features and maintenance. However, contributing your code actually helps *you* as well: - The lead developers will verify that your format is still readable with each new release of ImageVis3D - Internal APIs within ImageVis3D change from time to time; if your source is part of ImageVis3D, we will update your code to adhere to the new interface. * It is safe to assume that, if your code is not part of the ImageVis3D tree, it will eventually stop compiling and require manual edits. * New features added to ImageVis3D will automatically apply to your format/code. - Your code will receive more testing than you could perform on your own. What We Ask From Contributors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We ask that you don't just throw a bunch of files at us and expect we do the work of merging in changes or fixing blatant issues. We ask that you submit: - Well-formatted, complete patches * `svn diff` (or even `git diff`) formats are preferred, as opposed to files * Patches should be against the current source in version control, not against the previous release. * If plausible, split multiple changes into multiple patches * Each change should compile and work if applied in order (i.e. do not have one patch break the build and the next one fix it -- just use one patch). * Should compile using MSVC and recent gcc's. ** We understand that you might not have both these compilers available. Please just do the best you can. * Use MESSAGE, WARNING, and T_ERROR to give information on what the code is doing. * Try to break lines at 80 characters * Remove whitespace at the end of each line - Rights to distribute your code under the MIT license * Do note that permission to do this might have to come not just from yourself, but from your organization and/or funding organization as well. Do *not* _assume_ you have the right to distribute code you have written! * More general rights are fine too; you might release the code into the public domain, for example. - For support of new file formats: * At least one dataset which can be read by the new code * An image of the dataset, preferably rendered in some other software, though an ImageVis3D image is acceptable. We will use this to verify that the code actually works. The dataset request is a *requirement*, not an option. No exceptions! If we cannot test your code, it *will* break at some point. Even if your file format is common, do not assume we will go scouring the web for sample data -- that is your responsibility. Logistics ~~~~~~~~~ You should send your patches to the link:https://lists.sci.utah.edu/sympa/subscribe/tuvok-developers[tuvok-developers] mailing list. If you have very small sample data (i.e. measured in kilobytes), you can send that along through the list as well. If your sample data are large, you may: - Upload them via FTP to `ftp.sci.utah.edu`; anonymous uploads are allowed in the `upload` directory. - Use the `Report an Issue` dialog and attach the dataset and sample image to the bug report. Be sure to include your email and at least a brief message mentioning the thread you've started on tuvok-developers. In both cases, please send a ping to link:https://lists.sci.utah.edu/sympa/subscribe/tuvok-developers[tuvok-developers] and let us know you've uploaded data. You'll need to send a mail there anyway, to include the patches. Privacy +++++++ Please note any restrictions on the data at submission time. We are used to receiving data which we are not allowed to use in our publications, or that we are not allowed to demo, etc. If this restriction is time-limited (i.e. "do not demo this until I've published a paper about !"), please note that as well. Do note that any data which is uploaded to SCI via FTP, or uploaded via ImageVis3D's "Report an Issue" feature, is readable by any member of the SCI Institute. The ImageVis3D developers will gladly copy it to our workstations and then delete it from the public FTP as quickly as possible, but there will always be a window where data are available to the internal network. Furthermore, the SCI Institute is an Institute within a University. Security policies are somewhat liberal; there is not a notion of a "secure network" versus an "open network", as is common at some national labs. We will make reasonable efforts to ensure your data remain as private as you would like, but do recognize that no computer network is ever completely secure, and SCI is no different. As such, please do not send us extremely sensitive data. ImageVis3D-3.1.0/doc/add-converter.adoc0000644000175000017500000003531612320517543017424 0ustar mathieumathieuIntroduction ------------ ImageVis3D supports some file formats "out of the box". In many cases, the easiest route to getting your data into ImageVis3D is to write it out in a format the program can read natively. However, this might not always be a viable option. This section describes the work involved in enabling ImageVis3D to convert a new file format into UVF. Writing a converter is a good choice if you have pre-existing, single-block data which is not readable by any of the converters which ship with ImageVis3D. ImageVis3D Conversion Steps --------------------------- ImageVis3D's IO scheme is based around a multi-stage paradigm. In the first stage, converters identify relevant metadata and modify the data into a raw input stream. Subsequent stages perform tasks such as endian conversion, computing derived metadata, and generating the hierarchy of bricks needed for interactive rendering. Writing Your Converter ---------------------- The basic steps involved in writing your own converter are: 1. Create a new class derived from `RAWConverter` 2. Register your format's file extension with the IO subsystem. 3. Modify a conversion routine to create metadata and (potentially) rewrite it as a raw data stream. Converter Skeleton ~~~~~~~~~~~~~~~~~~ You'll need to create both a header file (`.h`) and an implementation file (`.cpp`) for your new format. They should define a new class, derived from `RAWConverter`, which implements the methods `ConvertToRAW`, `ConvertToNative`, and `CanExportData`. Here is an example header file: [c++] source~~~~ #include "RAWConverter.h" class YourConverter : public RAWConverter { public: YourConverter(); virtual ~YourConverter() {} virtual bool ConvertToRAW(const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, UINT64& iHeaderSkip, UINT64& iComponentSize, UINT64& iComponentCount, bool& bConvertEndianness, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, UVFTables::ElementSemanticTable& eType, std::string& strIntermediateFile, bool& bDeleteIntermediateFile); virtual bool ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, UINT64 iHeaderSkip, UINT64 iComponentSize, UINT64 iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize, FLOATVECTOR3 vVolumeAspect, bool bNoUserInteraction, const bool bQuantizeTo8Bit); virtual bool CanExportData() const { return false; } }; source~~~~ Now define a skeleton of an implementation in a corresponding `.cpp` file: [c++] source~~~~ #include "YourConverter.h" YourConverter::YourConverter() {} bool YourConverter::ConvertToRAW(...) { return false; } bool YourConverter::ConvertToNative(...) { return false; } source~~~~ (I've omitted the arguments here; they should be identical to those in the aforementioned header file.) Congratulations! You've got a minimal converter which can be plugged in to ImageVis3D. Let's get it part of ImageVis3D before we start trying to read any data. Building Your Reader ~~~~~~~~~~~~~~~~~~~~ ImageVis3D stores the list of files that are part of the program in a few places. The files which are part of the IO subsystem are currently listed in `Tuvok/Tuvok.pro`. In that file, you'll find two variables, `HEADERS' and `SOURCES', which identify which files to build. You'll need to add your converter to the list specified in both variables. ............................................................................ HEADERS += \ ... IO/AbstrConverter.h \ IO/BOVConverter.h \ IO/YourFileHere.h \ IO/BrickedDataset.h \ ... SOURCES += \ ... IO/AbstrConverter.cpp \ IO/BOVConverter.cpp \ IO/YourFileHere.cpp \ IO/BrickedDataset.cpp \ ... ............................................................................ Once you've done that, rerun `qmake' from the root directory, and `make' to rebuild -- your converter should now be part of ImageVis3D! CAUTION: On Windows, the solution/project files have diverged from the settings given in the qmake project file. You will need to add your files to the Visual Studio project file in the normal way. Register Your Converter with the IO Subsystem ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To inform ImageVis3D that your converter exists, you need to register it with the IO subsystem. Open up `IOManager.cpp` and add a `#include` for your converter's header file. Then, in the `IOManager` constructor, add a line which creates an instance of your converter: [c++] source~~~~ m_vpConverters.push_back(new YourConverter()); source~~~~ Register Your File Extensions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The constructor for your new converter should modify two internal class variables: `m_vConverterDesc` and `m_vSupportedExt`. The former should be set to a short human-readable string that describes the file format. This must be a single line and should generally be a short phrase of a few words or less. The second, `m_vSupportedExt`, should be populated with any extensions which are common for your file format. NOTE: You may leave `m_vSupportedExt` empty if you reimplement the `CanRead` method, described later in this document. See `BOVConverter.cpp` for an example. A good test at this point would be to add: [c++] source~~~~ MESSAGE("constructor!"); source~~~~ to your constructor, and: [c++] source~~~~ MESSAGE("convert!"); source~~~~ to your `ConvertToRAW` function. Run ImageVis3D and enable the "Message" channel in the Debug Window (under "Help") tell it to load your data file. The conversion will fail, but in the debug log you should see both of those messages (among many others). TIP: You can use the `WARNING` and `T_ERROR` macros to report warnings and errors, respectively, in your converter. Modify Raw Conversion Routine ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This is where all of the work happens. The purpose of this routine is to take an input data file, fill in the appropriate metadata as given by the arguments, and create a `strIntermediateFile` raw file with implicit structure. Let's start with the arguments to the method: - `strSourceFilename` - The filename where your data lives. This is the file that the user selected via the ImageVis3D UI. - `strTempDir` - if you need to create any temporary files, you should prepend this directory string to each of the filenames. - `bNoUserInteraction` - if `true`, any ambiguities should be treated as fatal errors. Otherwise, you may query the user for more information (say, via a `QMessageBox`). NOTE: Qt UI elements may not be used in the Tuvok IO subsystem. If you want to perform a graphical query when `bNoUserInteraction` is `false`, you must put the code into the "imagevis3d" repository. Since converters are registered dynamically, this will work fine; see the `DialogConverter` code. - `iHeaderSkip` - Many formats are "sectioned", in that an initial header is given which describes the data, and a raw chunk of data follows the header. Write the byte offset of the start of such data into this header; write `0` if there is no header or this field makes no sense for your data format. - `iComponentSize` - write the number of bits per component into this argument. Note this is *bits*: so-called "short" data should write `16` into this field. - `iComponentCount` - write the number of components in the dataset into this variable. This will almost always be `1`, because volume rendering really only makes sense for scalar fields. ImageVis3D also currently supports "color data", or RGBA data, in which case you would write `4` into this variable. Any other setting is likely to fail later on in processing. - `bConvertEndianness` - set this to true if the endianness of the data differs from the endianness of the current platform. You can use the static `EndianConvert::IsBigEndian()` method to determine the endianness of the currently-running ImageVis3D. - `bSigned` - set to true if the data are signed. - `bIsFloat` - set to true if the data are floating point. This only makes sense in combination with certain values for `iComponentSize`. - `vVolumeSize` - the dimensions of the dataset, in X (index 0), Y (1), and Z (2) - `vVolumeAspect` - default aspect ratio of these data, indexed just like `vVolumeSize`. Normally, set this to `(1,1,1)`. - `strTitle` - any special string which identifies or describes the dataset. Perhaps the name of the variable stored in this field. - `eType` - See UVF's source for more detail, but generally just set this to `UVFTables::ES_UNDEFINED`. - `strIntermediateFile` - if you need to create a new file, set this to the new file name. Otherwise, copy `strSourceFilename` into here. - `bDeleteIntermediateFile` - if you need to create a new file, you should set this to `true` to make sure ImageVis3D deletes the file when it no longer needs it. Otherwise, make sure it is `false`, or ImageVis3D will try to delete the input file! The format of `strIntermediateFile` should simply be raw data which varies slowly in X and quickly in Z. These data should be written in "raw" format: do not use C++'s formatted IO routines if you need to generate these data. If all goes well, you should return `true` from this method. *Optional*: Reimplement the `CanRead` Predicate ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Since there are many converters available, at various times the IO subsystem needs to know *which* format within the candidate set is the appropriate one to use. It does this via the `virtual` `CanRead` method. [c++] source~~~~ virtual bool CanRead(const std::string& filename, const std::vector bytes) const; source~~~~ The default implementation of this method is based purely on file extensions. The extension[s] used for your format are the ones you added to the `m_vSupportedExt` vector in your constructor. For most formats, this implementation will be perfectly fine. However, some converters need to know a bit more. You might, for example, be working with a file format that relies on *prefixes* for file names instead of *postfixes* (i.e. "extensions"). You can override the `CanRead` method to implement a predicate more specific to your file format. This method should return `true` if you are reasonably sure that your `ConvertToRAW` method will succeed for the given file, and `false` otherwise. The method takes two arguments. The first is the name of the file that the IO subsystem is trying to find a converter for; for ImageVis3D, this will be the file selected by the user in the GUI. If the user has selected multiple files (for example, while attempting to convert a time-dependent dataset), this will be the first file in the sequence. The second argument is an array which contains a few bytes from the beginning of the file (again, the first file if multiple files have been selected). IMPORTANT: Although the method is given the full file name and could easily open and scan the file to see if it is valid, please do *not* do this in your converter. If every converter operated in this fashion, identifying the appropriate converter would be extremely slow. The `bytes` array argument should be sufficient to identify the file; if you need more data to do so definitively, please contact the lead developers via the mailing lists and ask them to increase the number of bytes given to the method. You can use the `filename` parameter to key into any sort of custom file naming procedure that your file format has. Many formats also implement some concept of `magic` bytes: the first few bytes of the files given in this format might always be statically set to a specific value. As examples, the first 4 bytes of every NRRD file spell out "NRRD"; the QVis file format is based on a series of key-value pairs, and it is common for the first key to be "ObjectFileName". `CanRead` implementations for these formats could key into such conventions to verify that the file is what it says it is. NOTE: You do not need to go all-out to detect errors at this stage. For example, you should not attempt to identify if the file is corrupted in the `CanRead` method. This method is meant to quickly whittle down the list of available converters, and as such should do relatively little work, and certainly no dataset-sized work. The correct place to detect file corruption would be in the `ConvertToRAW` method. *Optional*: Implement Native Conversion ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Many converters in the IO subsystem implement the `ConvertToNative` method. This allows one to use ImageVis3D to convert data from one file format to another. To do this, implement the method and modify it to return `true`. Make sure to also modify the `CanExportData` method to return `true`. Examples -------- You can read ImageVis3D's existing code for converting data to get hints about how your converter should work. - `REKConverter.cpp` - This is the smallest of ImageVis3D's converters. The EZRT file format that it reads is an example of a "header plus raw data" format; as such, the converter reads in some metadata, and then sets up the `iHeaderSkip` variable to the location where the data starts. No new output file is necessary. - `QVISConverter.cpp` - This is purely a "header" file format: the user is expected to select a file which has a simple ASCII header. One of the fields in this header gives the name of a raw filename which stores the data. The converter finds that field and sets `strIntermediateFile` to be the raw filename. Since the raw file is actually *part* of the input dataset, the converter deliberately sets `bDeleteIntermediateFile` to `false`. - `TiffVolumeConverter.cpp` - A little-known feature of TIFF is that it supports so-called "directories", which provide a mechanism to store multiple images in a single file. If these images align, then a single TIFF file forms a volume instead of just an image. This converter provides an example of using an external library to read the data, and then rewriting that data as a raw binary file that the rest of ImageVis3D's IO routines can handle. ImageVis3D-3.1.0/doc/helium.py0000644000175000017500000000073012320517543015664 0ustar mathieumathieudb = "/path/to/dataset.silo" OpenDatabase(db) AddPlot("Pseudocolor", "helium") AddOperator("Resample") ra = ResampleAttributes() ra.samplesX = 512 ra.samplesY = 512 ra.samplesZ = 512 ra.distributedResample = False SetOperatorOptions(ra) DrawPlots() dbAtts = ExportDBAttributes() dbAtts.db_type = "BOV" dbAtts.filename = "singlehelium" dbAtts.variables = ("helium") ExportDatabase(dbAtts) RemoveAllOperators() DeleteAllPlots() CloseDatabase(db) import sys sys.exit(0) ImageVis3D-3.1.0/doc/expressions.adoc0000644000175000017500000001657012320517543017252 0ustar mathieumathieu// a2x: --dblatex-opts "-P latex.output.revhistory=0" ImageVis3D Expression Language ============================== == Introduction While the visualization of single-channel data in many cases suffices to identify and understand some features in data, many acquisition and simulation processes inherently generate multi-channel data, and the simultaneous visualization of these channels may be the only way to extract the needed information. Loading up each channel side-by-side may be one way to effect this, however it is sometimes necessary to visualize multiple fields in a single viewport. Unfortunately the volume visualization techniques which ImageVis3D implements---volume rendering and isosurfacing---are specified in terms of a single channel. One can extend these concepts into multiple channels by making some simple choices, however this extension is always specific to the goals of a particular research pipeline and the data available. For example, while your task might be to simply see one channel mapped to green and another mapped to red, another research group might want to only see areas where both channels exceed a combined threshold. ImageVis3D does not (yet) provide a way to dynamically configure these kinds of mappings. However, what it does supply is a language by which you can specify the combination of multiple data volumes into a single scalar volume. You can then visualize that volume in the standard way---by using ImageVis3D's transfer function editors, for example. This document describes how to use that expression language. == Requirements Before we get into the details, it is important to note a few restrictions of the system as it exists in ImageVis3D right now. === Registration The most important restriction is that these data must be _registered_, or rather that they exist in the same space. This is generally true if the channels arise from unique measurements of the same underlying data. This restriction is imposed because ImageVis3D assumes the data live in the same space: the top-left of the first channel is the same physical location as the top-left of the fifth channel, for example. If your data are not already registered, you will need to perform a registration _a priori_. Unfortunately information and tools on this process are not provided here. === Limited View The second major restriction is that the combination of many data sets can only merge data from the corresponding voxels of other data sets; it cannot examine neighboring voxels, for example. This means it is impossible to, for example, implement a Gaussian smoothing pass of the data while it is processed. If you need such functionality, we currently recommend you perform such a pass over the data before it is input into ImageVis3D. == Using It . *Convert data to UVF*. Presumably you are already familiar with this process, as you're already using ImageVis3D! If not, please see the user manual at http://www.imagevis3d.org[ImageVis3D.org] . *Open the expression dialog in ImageVis3D*. You can find this under the +File+ menu. . *Add Data Sets*. Use the button on the right to add any number of data sets. . *Select +Use a Custom Expression+* near the top. Then enter the expression you want in the box. Note the entries of the +v+ olume array are ordered as they are in the list below. === Valid Expressions The expression language is meant to mimic those from modern programming languages. The simplest way to figure it out is to just type in anything that you might put in on the right hand side of an `equals' sign in your favorite program language. To be more exact, the language supports: * The standard binary operators (<, >, +, -, /, *). * The unary operator -. * The conditional `if-else' operator (`expression ? expression : expression') * Compound expression operators (&&, ||). * `volume' tatements which reference the input data (+v+). The most important component are `v` olume statements. The language provides an implicit array, `v`, which are the volumes you provide as input. The indices correspond to the order you defined in the GUI, starting at 0, and are denoted using the bracket operator `[]`. Thus, `v[0]` corresponds to the first volume you defined. Most operators behave as they do in a programming language. The binary operators need a subexpression on either side, and the simplest expression is just a constant value. So, for example, `5 < 2` is a valid expression, but since `2` is a subexpression, this can utilize any of the above rules. Thus, `5 < (2 * v[0])` is also a valid expression. Compound operators exist to link subexpressions together. The subexpression `(v[0] < 64) || (v[0] > 192)` is true when the datum in question is less than 64 *or* above 192. The subexpression `(v[0] < 64) && (v[0] > 192)` is true when the datum is less than 64 *and* above 192. Of course, in the latter case, this is never true and therefore the expression is always false. The unary operator `-` negates the value immediately to its right. The conditional 'if-else' operator is perhaps the most interesting. This expression is composed of 3 sub-expressions: `expr1 ? expr2 : expr3`. The system evaluates `expr1`, and if it is true, the value of the overall expression is `expr2`. If `expr1` is false, then the value of the overall expression is `expr3`. The language computes the indicated expression for every voxel of the input data independently in an unspecified order. === Command Line Interface Expressions are also available from the command line via the +uvfconvert+ program. Basic operation of this program is to, for example, batch-convert a data set into UVF format: `uvfconvert -i /path/to/data.nhdr -o /path/to/converted.uvf` However, one can also give the program the +-e+ option to indicate that it should compute an expression instead. In this case the input data should be in UVF format already. So, for example, to convert two data sets and compute a new expression between them: uvfconvert -i /path/to/data.nhdr -o /path/to/data.uvf uvfconvert -i /path/to/weights.nhdr -o /path/to/weights.uvf uvfconvert -i /path/to/weights.uvf -i /path/to/data.uvf -e "v[0] * v[1]" -o /path/to/weighted-data.uvf == Examples Here are some examples of expressions which might be useful for you: * add two volumes together: `v[0] + v[1]`. There is an implicitly defined array `v` which references the volumes which are provided. The array indexing begins at 0 and proceeds up to the number of volumes given: this corresponds either to the list of volumes provided in the UI, or the files given by subsequent `-i` options in the command line interface. * Creating a segmentation based on thresholding: `v[0] < 42 ? 1 : 0`. This compares each data value to the number 42; if the voxel is less than 42, then we set the mask. Otherwise, we clear it. * combining a segmentation with volume data: `v[0] ? v[1] : 0`. This checks `v[0]` for "truth", which implicitly means "is not 0." Thus, this expression checks the value of the first volume; if it is nonzero, then the resultant datum is the corresponding value from the *second* volume. If it *is* 0, then we also set it to 0 in the output volume. Therefore, this expression is equivalent to the expression: `v[0] ? v[1] : v[0]`. //* visualizing multiple features/signals together // * with signal interference // * separating out signals //. good idea to have both data in the same source width; maybe // interpolate data first to make sure this is true ImageVis3D-3.1.0/doc/imagevis3d.10000644000175000017500000000314412320517543016146 0ustar mathieumathieu.TH IMAGEVIS3D "1" "May 19, 2009" "SCI" "User Commands" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME imagevis3d \- desktop out of core volume rendering application. .SH SYNOPSIS .B imagevis3d .RI [ options ] " files" ... .SH DESCRIPTION \fBimagevis3d\fP is a volume rendering application designed to handle extremely large data. By bricking a dataset (splitting it into constant-sized chunks) and only requiring one chunk to be resident in main memory, ImageVis3D's memory usage remains constant across dataset sizes. .PP ImageVis3D uses Tuvok to render and composite the bricks. Tuvok relies heavily on GLSL to provide accelerated volume rendering. As such, a somewhat recent video card is required. In practice, this effectively means that Linux systems currently require a nvidia card with nvidia's drivers. .SH OPTIONS The command line options of \fBimagevis3d\fP are: .TP .B \-script \fIfilename\fP Runs the script file given in \fIfilename\fP. .TP .B \-log [\fIfilename\fP, \fI\-\fP] Logs debug information \fIfilename\fP, or stdout (\fI\-\fP) .TP .B \-loglevel [\fI0\fP, \fI1\fP, \fI2\fP] Changes the verbosity of the log. .SH AUTHOR imagevis3d was written by the SCI Institute, with support from the NIH NCRR and DOE VACET programs. ImageVis3D-3.1.0/ImageVis3D/0000755000175000017500000000000012320517543015155 5ustar mathieumathieuImageVis3D-3.1.0/ImageVis3D/main.cpp0000644000175000017500000001466012320517543016614 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : main.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : September 2008 // //! Copyright (C) 2008 SCI Institute #include "../Tuvok/StdTuvokDefines.h" #include "../Tuvok/IO/Tuvok_QtPlugins.h" #include #include #include #include #include #include #include #include "../Tuvok/Controller/Controller.h" #include "../Tuvok/Basics/SysTools.h" #include "../Tuvok/DebugOut/TextfileOut.h" #include "../Tuvok/DebugOut/ConsoleOut.h" #if defined(_WIN32) && defined(USE_DIRECTX) #include "../Tuvok/Basics/DynamicDX.h" #endif /* #ifdef _WIN32 #if defined(DEBUG) || defined(_DEBUG) #define _CRTDBG_MAP_ALLOC #include #include #ifndef DBG_NEW #define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ ) #define new DBG_NEW #endif #endif #endif */ // Include the following line for the Visual Leak detection tool // #include using namespace tuvok; int main(int argc, char* argv[]) { #if defined(_WIN32) && defined(USE_DIRECTX) DynamicDX::InitializeDX(); #endif /* // Enable run-time memory check for debug builds on windows #ifdef _WIN32 // CRT's memory leak detection on windows #if defined(DEBUG) || defined(_DEBUG) _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_DEBUG ); #endif #endif */ // get command line paramers SysTools::CmdLineParams parameters(argc, argv); // start a logfile debug out if requested std::string strLogFileName; bool bUseLogFile = parameters.GetValue("LOG",strLogFileName); int iLogLevel = 0; std::string strScriptFile = ""; parameters.GetValue("LOGLEVEL",iLogLevel); parameters.GetValue("SCRIPT",strScriptFile); // create the QT window QApplication app( argc, argv ); // if using a logfile inject that file-logger into the debug out chain if (bUseLogFile) { AbstrDebugOut *dbgOut; if(strLogFileName == "-") { dbgOut = new ConsoleOut(); } else { dbgOut = new TextfileOut(strLogFileName); } dbgOut->SetShowErrors(true); dbgOut->SetShowWarnings(iLogLevel > 0); dbgOut->SetShowMessages(iLogLevel > 1); { std::ostringstream loglevel; loglevel << "Loglevel: " << iLogLevel; dbgOut->printf(loglevel.str().c_str()); } Controller::Instance().AddDebugOut(dbgOut); } MainWindow mainWindow(Controller::Instance(), strScriptFile!="", 0, Qt::Window); if (strScriptFile != "") { bool bScriptResult = mainWindow.RunLuaScript(strScriptFile); if (!mainWindow.StayOpen()) { mainWindow.close(); return (bScriptResult) ? 0 : 1; } } #ifdef DETECTED_OS_LINUX // else: only do this check in interactive mode. else { if(!QFile::exists("./ImageVis3D")) { MESSAGE("Working directory wrong! Applying hack."); // grab a copy of the full path w/ "ImageVis3D" lopped off the end. QDir d = QDir(argv[0]); std::string s; s.insert(0, d.absolutePath().toStdString()); size_t iv3d = s.rfind("ImageVis3D"); if(iv3d != std::string::npos) { std::string dir; dir.insert(0, s.c_str(), iv3d); MESSAGE("cd'ing to dir: %s", dir.c_str()); if(!QDir::setCurrent(QString(dir.c_str()))) { WARNING("Could not set sane working directory!"); const char* msg = "ImageVis3D's \"working directory\" is not the same as the " "directory it was started from, and I could not fix it. " "If you've used a tarball " "installation of ImageVis3D, this is going to make it " "almost impossible for us to find our shaders, which means " "you won't be able to open a data set!\n\n" "This almost assuredly happened because you opened ImageVis3D " "by double-clicking it in KDE's file browser. As outlined in " "KDE bug 131010, KDE does not properly set working directories.\n\n" "The only way we could presumably fix this is to provide " "distribution-specific binaries for all varieties of Linux out " "there. Of course, given our limited resources this is " "impossible. You can help us by commenting on the KDE bug about " "how unreasonable this behavior is and how difficult it is for a " "small development house to conform to this behavior.\n\n" "The URL is: https://bugs.kde.org/show_bug.cgi?id=131010."; QString err = QString(msg); QClipboard *c = QApplication::clipboard(); if(c->text().isEmpty()) { c->setText("https://bugs.kde.org/show_bug.cgi?id=131010"); err += QString(" Since your clipboard was empty anyway, I have " "copied that URL into your clipboard's text."); } QMessageBox::warning(&mainWindow, "Invalid working directory", err); } } } } #endif mainWindow.StartTimer(); int iResult = app.exec(); #if defined(_WIN32) && defined(USE_DIRECTX) DynamicDX::CleanupDX(); #endif return iResult; } ImageVis3D-3.1.0/ImageVis3D/Doxyfile0000644000175000017500000015142712320517543016675 0ustar mathieumathieu# This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file that # follow. The default is UTF-8 which is also the encoding used for all text before # the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into # libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of # possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = "Image Vis 3D" # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = doxygen # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, # Italian, Japanese, Japanese-en (Japanese with English messages), Korean, # Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, # Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the DETAILS_AT_TOP tag is set to YES then Doxygen # will output the detailed description near the top, like JavaDoc. # If set to NO, the detailed description appears after the member # documentation. DETAILS_AT_TOP = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 2 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for Java. # For instance, namespaces will be presented as packages, qualified scopes # will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to # include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will # be extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the # base name of the file that contains the anonymous namespace. By # default anonymous namespace are hidden. EXTRACT_ANON_NSPACES = YES # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from the # version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = NO # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = Renderer Build DebugOut UI IO Controller Basics 3rdParty # This tag can be used to specify the character encoding of the # source files that doxygen parses. Internally doxygen uses the UTF-8 # encoding, which is also the default input encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible # encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py FILE_PATTERNS = # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the output. # The symbol name can be a fully qualified name, a word, or if the wildcard * is used, # a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH # then you must also enable this option. If you don't then doxygen will produce # a warning and turn it on anyway SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES (the default) # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES (the default) # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. Otherwise they will link to the documentstion. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compressed HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # If the GENERATE_TREEVIEW tag is set to YES, a side panel will be # generated containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = NO # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = NO # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to # produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to # specify the directory where the mscgen tool resides. If left empty the tool is assumed to # be found in the default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES # then doxygen will generate a call dependency graph for every global # function or class method. Note that enabling this option will # significantly increase the time of a run. So in most cases it will # be better to enable call graphs for selected functions only using the # \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to # YES then doxygen will generate a caller dependency graph for every # global function or class method. Note that enabling this option will # significantly increase the time of a run. So in most cases it will # be better to enable caller graphs for selected functions only using # the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the number # of direct children of the root node in a graph is already larger than # MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 6 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, which results in a white background. # Warning: Depending on the platform used, enabling this option may lead to # badly anti-aliased labels on the edges of a graph (i.e. they become hard to # read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO ImageVis3D-3.1.0/ImageVis3D/IO/0000755000175000017500000000000012320517543015464 5ustar mathieumathieuImageVis3D-3.1.0/ImageVis3D/IO/DialogConverter.h0000644000175000017500000000437412320517543020734 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DialogConverter.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date December 2008 */ #pragma once #ifndef DIALOGCONVERTER_H #define DIALOGCONVERTER_H #include "../Tuvok/IO/RAWConverter.h" #include class DialogConverter : public RAWConverter { public: DialogConverter(QWidget* parent); virtual ~DialogConverter() {} virtual bool ConvertToRAW(const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile); protected: QWidget* m_parent; }; #endif // DIALOGCONVERTER_H ImageVis3D-3.1.0/ImageVis3D/IO/DialogConverter.cpp0000644000175000017500000001255312320517543021265 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DialogConverter.cpp \author Jens Krueger SCI Institute University of Utah \date December 2008 */ #include "DialogConverter.h" #include "../UI/RAWDialog.h" #include "../Tuvok/Controller/MasterController.h" #include "../Tuvok/Basics/SysTools.h" #include "../Tuvok/Basics/LargeRAWFile.h" #include using namespace std; DialogConverter::DialogConverter(QWidget* parent) : m_parent(parent) { } bool DialogConverter::ConvertToRAW(const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile) { if (bNoUserInteraction) return false; if (QMessageBox::No == QMessageBox::question(NULL, "RAW Data Loader", "The file was not recognized by ImageVis3D's built-in readers and cannot be converted automatically. Do you want to specify the data set parameters manually?", QMessageBox::Yes, QMessageBox::No)) { return false; } LargeRAWFile f(strSourceFilename); f.Open(false); uint64_t iSize = f.GetCurrentSize(); f.Close(); #ifdef DETECTED_OS_APPLE // Why we need to specify null for the parent on Mac OS X: // the PleaseWaitDialog instances in ImageVis3D_FileHandling.cpp in the // LoadDataset function. // // Mac OS X is presumably waiting for the first modal dialog // (PleaseWaitDialog) to finish before opening up the next modal dialog // (RAWDialog). Since the user cannot interact with PleaseWaitDialog, we // are stuck in a modal state with no where to go. // // Specifying NULL circumvents this issue by making the dialog a // "top-level widget" with no parent. RAWDialog rawDialog(strSourceFilename, iSize, NULL); #else RAWDialog rawDialog(strSourceFilename, iSize, m_parent); #endif if (rawDialog.exec() == QDialog::Accepted) { if (rawDialog.ComputeExpectedSize() > iSize) return false; strTitle = "Raw data"; iComponentCount = 1; vVolumeSize = rawDialog.GetSize(); vVolumeAspect = rawDialog.GetAspectRatio(); unsigned int encID = rawDialog.GetEncoding(); iHeaderSkip = rawDialog.GetHeaderSize(); bConvertEndianess = encID != 1 && rawDialog.IsBigEndian() != EndianConvert::IsBigEndian(); iComponentSize = rawDialog.GetBitWidth() * 8; bSigned = rawDialog.IsSigned(); bIsFloat = rawDialog.IsFloat(); MESSAGE("setting component size to: %llu", iComponentSize); if (encID == 0) { strIntermediateFile = strSourceFilename; bDeleteIntermediateFile = false; return true; } else if (encID == 1) { string strBinaryFile = strTempDir+SysTools::GetFilename(strSourceFilename)+".binary"; bool bResult = ParseTXTDataset(strSourceFilename, strBinaryFile, iHeaderSkip, iComponentSize, iComponentCount, bSigned, bIsFloat, vVolumeSize); strIntermediateFile = strBinaryFile; bDeleteIntermediateFile = true; iHeaderSkip = 0; bConvertEndianess = false; return bResult; } else if (encID == 2) { string strUncompressedFile = strTempDir+SysTools::GetFilename(strSourceFilename)+".uncompressed"; bool bResult = ExtractGZIPDataset(strSourceFilename, strUncompressedFile, iHeaderSkip); strIntermediateFile = strUncompressedFile; bDeleteIntermediateFile = true; iHeaderSkip = 0; return bResult; } else { string strUncompressedFile = strTempDir+SysTools::GetFilename(strSourceFilename)+".uncompressed"; bool bResult = ExtractBZIP2Dataset(strSourceFilename, strUncompressedFile, iHeaderSkip); strIntermediateFile = strUncompressedFile; bDeleteIntermediateFile = true; iHeaderSkip = 0; return bResult; } } return false; } ImageVis3D-3.1.0/ImageVis3D/StdDefines.h0000644000175000017500000000575312320517543017370 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file StdDefines.h \author Jens Krueger SCI Institute University of Utah \date October 2008 */ #pragma once #ifndef STDIMAGEVISDEFINES_H #define STDIMAGEVISDEFINES_H #include "../Tuvok/StdTuvokDefines.h" #define IV3D_MAJOR 3 #define IV3D_MINOR 1 #define IV3D_PATCH 0 #define IV3D_VERSION "3.1.0" #define IV3D_VERSION_TYPE "Release Build" #define MANUAL_NAME "ImageVis3D.pdf" #define HELP_URL "http://www.sci.utah.edu/images/docs/imagevis3d.pdf" #define TUTORIAL_URL "http://www.imagevis3d.org/" #define DEMO_DATA_URL "http://www.sci.utah.edu/download/IV3DData.html" #define DEBUG_DUMP_SERVER "ftp://ftp.sci.utah.edu" #define DEBUG_DUMP_PATH "upload/ImageVis3D/" #define UPDATE_VERSION_PATH "http://www.sci.utah.edu/devbuilds/imagevis3d/" #define UPDATE_NIGHTLY_PATH "http://www.sci.utah.edu/devbuilds/imagevis3d/" #define UPDATE_STABLE_PATH "http://www.sci.utah.edu/download/imagevis3d.html" #define SCI_ORGANIZATION_DOMAIN "http://software.sci.utah.edu/" #ifdef DETECTED_OS_WINDOWS #define UPDATE_FILE "ImageVis3D-Windows-Latest.zip" #define UPDATE_VERSION_FILE "Windows_Latest_Version.txt" #endif #ifdef DETECTED_OS_APPLE #define UPDATE_FILE "ImageVis3D-OSX-10.5-Latest.zip" #define UPDATE_VERSION_FILE "OSX_Latest_Version.txt" #endif #ifdef DETECTED_OS_LINUX #define UPDATE_FILE "ImageVis3D-Linux-Latest.zip" #define UPDATE_VERSION_FILE "Linux_Latest_Version.txt" #endif // make sure they have a definition, so code that uses the defines always // compiles... even if that definition doesn't exactly make sense. #ifndef UPDATE_FILE # define UPDATE_FILE "ImageVis3D-Unsupported-Latest.zip" #endif #ifndef UPDATE_VERSION_FILE # define UPDATE_VERSION_FILE "Unsupported-Latest-Version.txt" #endif #endif // STDIMAGEVISDEFINES_H ImageVis3D-3.1.0/ImageVis3D/ImageVis3D.vcxproj0000644000175000017500000037310212320517543020473 0ustar mathieumathieu Debug (with DirectX) Win32 Debug (with DirectX) x64 Debug Win32 Debug x64 Release (with DirectX) Win32 Release (with DirectX) x64 Release Win32 Release x64 {85742DE8-68C9-4140-A6A7-412CF789DECA} test Win32Proj Application Unicode true Application Unicode Application Unicode true Application Unicode Application Unicode true Application Unicode Application Unicode true Application Unicode <_ProjectFileVersion>10.0.40219.1 ..\Build\$(Platform)\$(Configuration)\ ..\Build\$(Platform)\$(Configuration)\objects\ false ..\Build\$(Platform)\$(Configuration)\ ..\Build\$(Platform)\$(Configuration)\objects\ false ..\Build\$(Platform)\$(Configuration)\ ..\Build\$(Platform)\$(Configuration)\objects\ false ..\Build\$(Platform)\$(Configuration)\ ..\Build\$(Platform)\$(Configuration)\objects\ false ..\Build\$(Platform)\$(Configuration)\ ..\Build\$(Platform)\$(Configuration)\objects\ false ..\Build\$(Platform)\$(Configuration)\ ..\Build\$(Platform)\$(Configuration)\objects\ false ..\Build\$(Platform)\$(Configuration)\ ..\Build\$(Platform)\$(Configuration)\objects\ false ..\Build\$(Platform)\$(Configuration)\ ..\Build\$(Platform)\$(Configuration)\objects\ false AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset $(ProjectName)-32 $(ProjectName)-32 $(ProjectName)-32 $(ProjectName)-32 $(ProjectName)-64 $(ProjectName)-64 $(ProjectName)-64 $(ProjectName)-64 $(DXSDK_DIR)lib\x64;$(LibraryPath) $(DXSDK_DIR)lib\x64;$(LibraryPath) $(DXSDK_DIR)lib\x86;$(LibraryPath) $(DXSDK_DIR)lib\x86;$(LibraryPath) $(DXSDK_DIR)include;$(IncludePath) $(DXSDK_DIR)include;$(IncludePath) $(DXSDK_DIR)include;$(IncludePath) $(DXSDK_DIR)include;$(IncludePath) xcopy "$(ProjectDir)..\Tuvok\Shaders\*.glsl" "$(TargetDir)Shaders\*.*" /r /y /q Disabled .;../Tuvok/3rdParty/GLEW;../Tuvok/Basics/3rdParty/boost;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/3rdParty/zlib;../Tuvok;../Tuvok/Basics;../Tuvok/IO/exception;../Tuvok/IO/expressions;../Tuvok/IO;$(QTDIR32)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 EditAndContinue 4127;4512;%(DisableSpecificWarnings) Tuvok.lib;opengl32.lib;glu32.lib;gdi32.lib;user32.lib;shlwapi.lib;qtmaind.lib;QtOpenGLd.lib;QtGuid.lib;QtCored.lib;QTNetworkd.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)-32.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR32)\lib;$(QTDIR32)\plugins\imageformats;%(AdditionalLibraryDirectories) true Windows MachineX86 $(IntDir)$(TargetName)$(TargetExt).intermediate.manifest xcopy "$(ProjectDir)..\Tuvok\Shaders\*.glsl" "$(TargetDir)Shaders\*.*" /r /y /q X64 Disabled .;../Tuvok/3rdParty/GLEW;../Tuvok/Basics/3rdParty/boost;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/3rdParty/zlib;../Tuvok;../Tuvok/Basics;../Tuvok/IO/exception;../Tuvok/IO/expressions;../Tuvok/IO;$(QTDIR64)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) Tuvok.lib;opengl32.lib;glu32.lib;gdi32.lib;user32.lib;shlwapi.lib;qtmaind.lib;QtOpenGLd.lib;QtGuid.lib;QtCored.lib;QTNetworkd.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)-64.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR64)\lib;$(QTDIR64)\plugins\imageformats;%(AdditionalLibraryDirectories) true Windows MachineX64 $(IntDir)$(TargetName)$(TargetExt).intermediate.manifest xcopy "$(ProjectDir)..\Tuvok\Shaders\*.glsl" "$(TargetDir)Shaders\*.*" /r /y /q /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) MaxSpeed true .;../Tuvok/3rdParty/GLEW;../Tuvok/Basics/3rdParty/boost;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/3rdParty/zlib;../Tuvok;../Tuvok/Basics;../Tuvok/IO/exception;../Tuvok/IO/expressions;../Tuvok/IO;$(QTDIR32)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) Tuvok.lib;opengl32.lib;glu32.lib;gdi32.lib;user32.lib;shlwapi.lib;qtmain.lib;QtGui.lib;QtCore.lib;QtOpenGL.lib;QtNetwork.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)-32.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR32)\lib;$(QTDIR32)\plugins\imageformats;%(AdditionalLibraryDirectories) true Windows true true MachineX86 $(IntDir)$(TargetName)$(TargetExt).intermediate.manifest xcopy "$(ProjectDir)..\Tuvok\Shaders\*.glsl" "$(TargetDir)Shaders\*.*" /r /y /q X64 /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) MaxSpeed true .;../Tuvok/3rdParty/GLEW;../Tuvok/Basics/3rdParty/boost;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/3rdParty/zlib;../Tuvok;../Tuvok/Basics;../Tuvok/IO/exception;../Tuvok/IO/expressions;../Tuvok/IO;$(QTDIR64)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) Tuvok.lib;opengl32.lib;glu32.lib;gdi32.lib;user32.lib;shlwapi.lib;qtmain.lib;QtGui.lib;QtCore.lib;QtOpenGL.lib;QtNetwork.lib;%(AdditionalDependencies) LinkVerboseLib $(OutDir)$(ProjectName)-64.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR64)\lib;$(QTDIR64)\plugins\imageformats;%(AdditionalLibraryDirectories) true Windows true true false true MachineX64 false $(IntDir)$(TargetName)$(TargetExt).intermediate.manifest xcopy "$(ProjectDir)..\Tuvok\Shaders\*.glsl" "$(TargetDir)Shaders\*.*" /r /y /q Disabled .;../Tuvok/3rdParty/GLEW;../Tuvok/Basics/3rdParty/boost;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/3rdParty/zlib;../Tuvok;../Tuvok/Basics;../Tuvok/IO/exception;../Tuvok/IO/expressions;../Tuvok/IO;$(QTDIR32)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;USE_DIRECTX;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 EditAndContinue 4127;4512;%(DisableSpecificWarnings) Tuvok.lib;opengl32.lib;glu32.lib;gdi32.lib;user32.lib;shlwapi.lib;qtmaind.lib;QtOpenGLd.lib;QtGuid.lib;QtCored.lib;QTNetworkd.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)-32.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR32)\lib;$(QTDIR32)\plugins\imageformats;%(AdditionalLibraryDirectories) %(DelayLoadDLLs) true Windows MachineX86 xcopy "$(ProjectDir)..\Tuvok\Shaders\*.glsl" "$(TargetDir)Shaders\*.*" /r /y /q X64 Disabled .;../Tuvok/3rdParty/GLEW;../Tuvok/Basics/3rdParty/boost;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/3rdParty/zlib;../Tuvok;../Tuvok/Basics;../Tuvok/IO/exception;../Tuvok/IO/expressions;../Tuvok/IO;$(QTDIR64)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;USE_DIRECTX;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) Tuvok.lib;opengl32.lib;glu32.lib;gdi32.lib;user32.lib;shlwapi.lib;qtmaind.lib;QtOpenGLd.lib;QtGuid.lib;QtCored.lib;QTNetworkd.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)-64.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR64)\lib;$(QTDIR64)\plugins\imageformats;%(AdditionalLibraryDirectories) %(DelayLoadDLLs) true Windows MachineX64 $(IntDir)$(TargetName)$(TargetExt).intermediate.manifest xcopy "$(ProjectDir)..\Tuvok\Shaders\*.glsl" "$(TargetDir)Shaders\*.*" /r /y /q /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) MaxSpeed true .;../Tuvok/3rdParty/GLEW;../Tuvok/Basics/3rdParty/boost;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/3rdParty/zlib;../Tuvok;../Tuvok/Basics;../Tuvok/IO/exception;../Tuvok/IO/expressions;../Tuvok/IO;$(QTDIR32)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;USE_DIRECTX;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) Tuvok.lib;opengl32.lib;glu32.lib;gdi32.lib;user32.lib;shlwapi.lib;qtmain.lib;QtGui.lib;QtCore.lib;QtOpenGL.lib;QtNetwork.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)-32.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR32)\lib;$(QTDIR32)\plugins\imageformats;%(AdditionalLibraryDirectories) %(DelayLoadDLLs) true Windows true true MachineX86 $(IntDir)$(TargetName)$(TargetExt).intermediate.manifest xcopy "$(ProjectDir)..\Tuvok\Shaders\*.glsl" "$(TargetDir)Shaders\*.*" /r /y /q X64 /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) MaxSpeed true .;../Tuvok/3rdParty/GLEW;../Tuvok/Basics/3rdParty/boost;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/3rdParty/zlib;../Tuvok;../Tuvok/Basics;../Tuvok/IO/exception;../Tuvok/IO/expressions;../Tuvok/IO;$(QTDIR64)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;USE_DIRECTX;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) Tuvok.lib;opengl32.lib;glu32.lib;gdi32.lib;user32.lib;shlwapi.lib;qtmain.lib;QtGui.lib;QtCore.lib;QtOpenGL.lib;QtNetwork.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)-64.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR64)\lib;$(QTDIR64)\plugins\imageformats;%(AdditionalLibraryDirectories) %(DelayLoadDLLs) true Windows true true MachineX64 $(IntDir)$(TargetName)$(TargetExt).intermediate.manifest Document true true true true true true true true true true true true Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" Performing moc on %(Filename).h %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" Performing moc on %(Filename).h %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" Performing moc on %(Filename).h Performing moc on %(Filename).h %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" Performing moc on %(Filename).h Performing moc on %(Filename).h Performing moc on %(Filename).h Performing moc on %(Filename).h %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" Performing moc on %(Filename).h Performing moc on %(Filename).h Performing moc on %(Filename).h Performing moc on %(Filename).h Performing moc on %(Filename).h Performing moc on %(Filename).h Performing moc on %(Filename).h Performing moc on %(Filename).h %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" -D USE_DIRECTX=1 -D _WIN32=1 %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" -D USE_DIRECTX=1 -D _WIN32=1 %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" -D USE_DIRECTX=1 -D _WIN32=1 %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" -D USE_DIRECTX=1 -D _WIN32=1 %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Performing moc on %(Filename).h $(QTDIR32)\bin\moc.exe "%(FullPath)" -o "%(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp" %(RootDir)%(Directory)AutoGen\moc_%(Filename).cpp;%(Outputs) Designer {d474a1e1-2ed3-42e6-826c-372430e549b9} false ImageVis3D-3.1.0/ImageVis3D/ImageVis3D.qrc0000644000175000017500000000054312320517543017561 0ustar mathieumathieu Resources/imagevis3dmini.png Resources/imagevis3d.png Resources/icon_16.png Resources/icon_32.png Resources/icon_64.png Resources/icon_Update.png Resources/bug.png ImageVis3D-3.1.0/ImageVis3D/ImageVis3D.vcxproj.filters0000644000175000017500000004326612320517543022147 0ustar mathieumathieu {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav {8f94eb19-dcee-45a7-a1d8-0eae1f25672b} {dad2f76f-4255-45e1-9089-2a7b0ac6ba9d} {1d1ce7f0-f3c3-4e12-ab57-aab45ca0ebf5} ui {b57c6e09-96fe-49c4-8277-a9633d5f3310} {eab16954-ec5d-4b4b-93ee-84015cea22dd} {b5f7cf1a-9713-476a-bacc-6225500522dc} {2b209271-eac4-41a4-8447-cee6e77d51b4} Resource Files Resource Files Resource Files Resource Files Resource Files Resource Files Resource Files Resource Files Resource Files Resource Files Resource Files Resource Files Resource Files Resource Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files\MainWindow UI\Implemented Files\MainWindow UI\Implemented Files\MainWindow UI\Implemented Files\MainWindow UI\Implemented Files\MainWindow UI\Implemented Files\MainWindow UI\Implemented Files\MainWindow UI\Implemented Files\MainWindow UI\Implemented Files\MainWindow UI\Implemented Files\MainWindow UI\Implemented Files\MainWindow UI\Implemented Files\MainWindow UI\Implemented Files\MainWindow DebugOut DebugOut IO UI\Implemented Files UI\Automatically Generated Files UI\Implemented Files UI\Implemented Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Automatically Generated Files UI\Implemented Files UI\Implemented Files DebugOut DebugOut IO UI\Implemented Files UI\UI Files UI\UI Files UI\UI Files UI\UI Files UI\UI Files UI\UI Files UI\UI Files UI\UI Files UI\UI Files UI\UI Files UI\UI Files UI\UI Files UI\UI Files UI\UI Files UI\UI Files UI\UI Files Resource Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files UI\Implemented Files\MainWindow UI\Implemented Files UI\Implemented Files ImageVis3D-3.1.0/ImageVis3D/DebugOut/0000755000175000017500000000000012320517543016673 5ustar mathieumathieuImageVis3D-3.1.0/ImageVis3D/DebugOut/QTOut.h0000644000175000017500000000355212320517543020065 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file QTOut.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date August 2008 */ #pragma once #ifndef QTOut_H #define QTOut_H #include "../../Tuvok/DebugOut/AbstrDebugOut.h" #include class QTOut : public AbstrDebugOut { public: QTOut(QListWidget *listWidget); virtual ~QTOut(); virtual void printf(enum DebugChannel, const char* source, const char* msg); virtual void printf(const char *s) const; private: QListWidget *m_listWidget; void _printf(const char* format, ...) const; }; #endif // QTOut_H ImageVis3D-3.1.0/ImageVis3D/DebugOut/QTLabelOut.h0000644000175000017500000000366512320517543021032 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file QTLabelOut.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date August 2008 */ #pragma once #ifndef QTLABELOUT_H #define QTLABELOUT_H #include "../../Tuvok/DebugOut/AbstrDebugOut.h" #include #include class QTLabelOut : public AbstrDebugOut { public: QTLabelOut(QLabel *label, QDialog *parent); virtual ~QTLabelOut(); virtual void printf(enum DebugChannel, const char* source, const char* msg); virtual void printf(const char *s) const; private: QLabel *m_label; QDialog *m_parent; void _printf(const char* format, ...) const; }; #endif // QTLABELOUT_H ImageVis3D-3.1.0/ImageVis3D/DebugOut/QTLabelOut.cpp0000644000175000017500000000432712320517543021361 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file QTLabelOut.cpp \author Jens Krueger SCI Institute University of Utah \version 1.0 \date September 2008 */ #include "QTLabelOut.h" #include #include #include #include #include #ifdef WIN32 #include // undef stupid windows defines to max and min #ifdef max #undef max #endif #ifdef min #undef min #endif #endif QTLabelOut::QTLabelOut(QLabel *label, QDialog *parent) : m_label(label), m_parent(parent) { } QTLabelOut::~QTLabelOut() { } void QTLabelOut::printf(enum DebugChannel, const char*, const char* buff) { if(!m_label) return; std::ostringstream text; text << buff; m_label->setText(text.str().c_str()); m_label->update(); QCoreApplication::processEvents(); } void QTLabelOut::printf(const char *s) const { if(!m_label) return; m_label->setText(s); m_label->update(); QCoreApplication::processEvents(); } ImageVis3D-3.1.0/ImageVis3D/DebugOut/QTOut.cpp0000644000175000017500000000456312320517543020423 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file QTOut.cpp \author Jens Krueger SCI Institute University of Utah \version 1.0 \date September 2008 */ #include "QTOut.h" #include #include #include using namespace std; #ifdef WIN32 #include // undef stupid windows defines to max and min #ifdef max #undef max #endif #ifdef min #undef min #endif #endif QTOut::QTOut(QListWidget *listWidget) : m_listWidget(listWidget) { Message("QTOut::QTOut","Starting up QTListviewDebug out"); } QTOut::~QTOut() { Message("QTOut::~QTOut","Shutting down QTListviewDebug out"); } void QTOut::printf(enum DebugChannel channel, const char* source, const char* buff) { std::ostringstream msg; msg << ChannelToString(channel) << " (" << source << "): " << buff; m_listWidget->addItem(msg.str().c_str()); if(static_cast(channel) < m_bRecordLists.size() && m_bRecordLists[channel]) { m_strLists[channel].push_back(msg.str()); } } void QTOut::printf(const char *s) const { m_listWidget->addItem(s); // Can't record on a channel.. we don't know what channel this is! } ImageVis3D-3.1.0/ImageVis3D/UI/0000755000175000017500000000000012320517543015472 5ustar mathieumathieuImageVis3D-3.1.0/ImageVis3D/UI/BugRepDlg.cpp0000644000175000017500000001111312320517543020006 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : BugRepDlg.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #include "BugRepDlg.h" #include "../Tuvok/Basics/SysTools.h" #include #include using namespace std; BugRepDlg::BugRepDlg(QWidget* parent, Qt::WindowFlags flags, const string& strSubmitFile) : QDialog(parent, flags) { setupUi(this); label_Icon->setPixmap(QPixmap::fromImage(QImage(":/Resources/bug.png"))); if (strSubmitFile != "") { listWidget_files->addItem(strSubmitFile.c_str()); } setSizeGripEnabled(true); } BugRepDlg::~BugRepDlg(void) { } void BugRepDlg::RemoveFile() { int iCurrent = listWidget_files->currentRow(); if (iCurrent >= 0) { listWidget_files->takeItem(iCurrent); } if (listWidget_files->count() > 0) { listWidget_files->setCurrentRow(min(iCurrent,int(listWidget_files->count()-1))); } pushButton_remove->setEnabled(listWidget_files->count() > 0); } void BugRepDlg::AddFiles() { QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString selectedFilter; QSettings settings; QString strLastDir = settings.value("Folders/BugReportFilename", ".").toString(); QStringList fileNames = QFileDialog::getOpenFileNames(this,"Select File", strLastDir, "All Files (*.*)",&selectedFilter, options); if (!fileNames.isEmpty()) { settings.setValue("Folders/BugReportFilename", QFileInfo(fileNames[0]).absoluteDir().path()); for (int i = 0;iaddItem(fileNames[i]); } listWidget_files->setCurrentRow(listWidget_files->count()-1); pushButton_remove->setEnabled(true); } } string BugRepDlg::GetDescription() const { return string(textEdit_desc->toPlainText().toAscii()); } bool BugRepDlg::SubmitSysinfo() const { return checkBox_IncludeSysinfo->isChecked(); } bool BugRepDlg::SubmitLog() const { return checkBox_IncludeLog->isChecked(); } string BugRepDlg::GetUsername() const { return string(lineEdit_name->text().toAscii()); } string BugRepDlg::GetUserMail() const { return string(lineEdit_email->text().toAscii()); } vector BugRepDlg::GetDataFilenames() const { vector v; for (int i = 0;icount();i++) { v.push_back(string(listWidget_files->item(i)->text().toAscii())); } return v; } void BugRepDlg::SetSubmitSysinfo(bool bSubmitSysinfo) { checkBox_IncludeSysinfo->setChecked(bSubmitSysinfo); } void BugRepDlg::SetSubmitLog(bool bSubmitLog) { checkBox_IncludeLog->setChecked(bSubmitLog); } void BugRepDlg::SetUsername(string strName) { lineEdit_name->setText(strName.c_str()); } void BugRepDlg::SetUserMail(string strMail) { lineEdit_email->setText(strMail.c_str()); } /// @return false if the data to submit are invalid. bool BugRepDlg::Validate(std::string &err) const { // pretty simple for now: just don't allow empty descriptions. if(this->GetDescription().empty()) { err = "No description given. Bug reports without descriptions are not " "useful for developers. Please at least give a sentence mentioning " "what went wrong, and include what you were doing with the program " "when you discovered this erroneous behavior."; return false; } return true; } ImageVis3D-3.1.0/ImageVis3D/UI/ScaleAndBiasDlg.cpp0000644000175000017500000002441112320517543021100 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : ScaleAndBiasDlg.cpp //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #include "ScaleAndBiasDlg.h" #include "../Tuvok/Renderer/RenderMesh.h" #include using namespace std; ScaleAndBiasDlg::ScaleAndBiasDlg(shared_ptr mesh, size_t index, const FLOATVECTOR3& vmin, const FLOATVECTOR3& vmax, QWidget* parent /* = 0 */, Qt::WindowFlags flags /* = 0 */) : QDialog(parent, flags), m_index(index), m_pMesh(mesh), m_min(mesh->GetMin()), m_max(mesh->GetMax()), m_minVolume(vmin), m_maxVolume(vmax) { setupUi(this, mesh->Name()); } ScaleAndBiasDlg::~ScaleAndBiasDlg(void) { } void ScaleAndBiasDlg::ScaleIsotropic() { FLOATVECTOR3 s = (m_max-m_min); FLOATVECTOR3 scaleVec = 1.0f/s; float scale = scaleVec.minVal(); FLOATVECTOR3 c = ((m_max+m_min)/2.0f)*scale; FLOATVECTOR3 biasVec = -c; doubleSpinBox_Sx->setValue(scale); doubleSpinBox_Sy->setValue(scale); doubleSpinBox_Sz->setValue(scale); doubleSpinBox_Bx->setValue(biasVec.x); doubleSpinBox_By->setValue(biasVec.y); doubleSpinBox_Bz->setValue(biasVec.z); ValuesChanged(); } void ScaleAndBiasDlg::ScaleUnisotropic() { FLOATVECTOR3 s = (m_max-m_min); FLOATVECTOR3 scaleVec = 1.0f/s; FLOATVECTOR3 c = ((m_max+m_min)/2.0f)*scaleVec; FLOATVECTOR3 biasVec = -c; doubleSpinBox_Sx->setValue(scaleVec.x); doubleSpinBox_Sy->setValue(scaleVec.y); doubleSpinBox_Sz->setValue(scaleVec.z); doubleSpinBox_Bx->setValue(biasVec.x); doubleSpinBox_By->setValue(biasVec.y); doubleSpinBox_Bz->setValue(biasVec.z); ValuesChanged(); } void ScaleAndBiasDlg::ScaleIsotropicVol() { FLOATVECTOR3 s = (m_max-m_min)/(m_maxVolume-m_minVolume); FLOATVECTOR3 scaleVec = 1.0f/s; float scale = scaleVec.minVal(); FLOATVECTOR3 c = ((m_max+m_min)/2.0f)*scale; FLOATVECTOR3 biasVec = -c; doubleSpinBox_Sx->setValue(scale); doubleSpinBox_Sy->setValue(scale); doubleSpinBox_Sz->setValue(scale); doubleSpinBox_Bx->setValue(biasVec.x); doubleSpinBox_By->setValue(biasVec.y); doubleSpinBox_Bz->setValue(biasVec.z); ValuesChanged(); } void ScaleAndBiasDlg::ScaleUnisotropicVol() { FLOATVECTOR3 s = (m_max-m_min)/(m_maxVolume-m_minVolume); FLOATVECTOR3 scaleVec = 1.0f/s; FLOATVECTOR3 c = ((m_max+m_min)/2.0f)*scaleVec; FLOATVECTOR3 biasVec = -c; doubleSpinBox_Sx->setValue(scaleVec.x); doubleSpinBox_Sy->setValue(scaleVec.y); doubleSpinBox_Sz->setValue(scaleVec.z); doubleSpinBox_Bx->setValue(biasVec.x); doubleSpinBox_By->setValue(biasVec.y); doubleSpinBox_Bz->setValue(biasVec.z); ValuesChanged(); } void ScaleAndBiasDlg::ValuesChanged() { scaleVec = FLOATVECTOR3(doubleSpinBox_Sx->value(), doubleSpinBox_Sy->value(), doubleSpinBox_Sz->value()); biasVec = FLOATVECTOR3(doubleSpinBox_Bx->value(), doubleSpinBox_By->value(), doubleSpinBox_Bz->value()); UpdatePostSize(); } void ScaleAndBiasDlg::UpdatePreSize() { FLOATVECTOR3 c = (m_max+m_min)/2.0f; FLOATVECTOR3 s = m_max-m_min; // pre scale size QString text = tr("Before scale and bias: " "Size: [%1, %2, %3] " "Center: [%4, %5, %6]").arg(s.x,0,'f',3).arg(s.y,0,'f',3).arg(s.z,0,'f',3) .arg(c.x,0,'f',3).arg(c.y,0,'f',3).arg(c.z,0,'f',3); label_currentDim->setText(text); } void ScaleAndBiasDlg::UpdatePostSize() { FLOATVECTOR3 c = (m_max+m_min)/2.0f; FLOATVECTOR3 s = (m_max-m_min); c = c*scaleVec + biasVec; s = s*scaleVec; QString text = tr("After scale and bias: " "Size: [%1, %2, %3] " "Center: [%4, %5, %6]").arg(s.x,0,'f',3).arg(s.y,0,'f',3).arg(s.z,0,'f',3) .arg(c.x,0,'f',3).arg(c.y,0,'f',3).arg(c.z,0,'f',3); label_targetDim->setText(text); } void ScaleAndBiasDlg::setupUi(QDialog *ScaleAndBiasDlg, const std::string& strDesc) { Ui_ScaleAndBiasDlg::setupUi(ScaleAndBiasDlg); ToggleExpertView(); UpdatePreSize(); label_meshDesc->setText(strDesc.c_str()); ValuesChanged(); } void ScaleAndBiasDlg::ApplyExpertMatrix() { QStringList list; list.append(lineEdit_m11->text()); list.append(lineEdit_m21->text()); list.append(lineEdit_m31->text()); list.append(lineEdit_m41->text()); list.append(lineEdit_m12->text()); list.append(lineEdit_m22->text()); list.append(lineEdit_m32->text()); list.append(lineEdit_m42->text()); list.append(lineEdit_m13->text()); list.append(lineEdit_m23->text()); list.append(lineEdit_m33->text()); list.append(lineEdit_m43->text()); list.append(lineEdit_m14->text()); list.append(lineEdit_m24->text()); list.append(lineEdit_m34->text()); list.append(lineEdit_m44->text()); QSettings settings; settings.setValue("Transformation/MeshExpertMatrix", list); emit ApplyMatrixTransform(this); m_min = m_pMesh->GetMin(); m_max = m_pMesh->GetMax(); UpdatePreSize(); UpdatePostSize(); } void ScaleAndBiasDlg::CopyScaleAndBias() { FLOATMATRIX4 bias; FLOATMATRIX4 scale; bias.Translation(biasVec); scale.Scaling(scaleVec); SetExpertTransform(scale*bias); } void ScaleAndBiasDlg::ToggleExpertView() { groupBox_Expert->setVisible(checkBoxShowExpert->isChecked()); pushButton_apply->setVisible(!checkBoxShowExpert->isChecked()); retranslateUi(this); repaint(); resize(QSize(0,0)); } FLOATMATRIX4 ScaleAndBiasDlg::GetExpertTransform() { FLOATMATRIX4 m; m.m11 =float(atof(lineEdit_m11->text().toAscii())); m.m21 =float(atof(lineEdit_m21->text().toAscii())); m.m31 =float(atof(lineEdit_m31->text().toAscii())); m.m41 =float(atof(lineEdit_m41->text().toAscii())); m.m12 =float(atof(lineEdit_m12->text().toAscii())); m.m22 =float(atof(lineEdit_m22->text().toAscii())); m.m32 =float(atof(lineEdit_m32->text().toAscii())); m.m42 =float(atof(lineEdit_m42->text().toAscii())); m.m13 =float(atof(lineEdit_m13->text().toAscii())); m.m23 =float(atof(lineEdit_m23->text().toAscii())); m.m33 =float(atof(lineEdit_m33->text().toAscii())); m.m43 =float(atof(lineEdit_m43->text().toAscii())); m.m14 =float(atof(lineEdit_m14->text().toAscii())); m.m24 =float(atof(lineEdit_m24->text().toAscii())); m.m34 =float(atof(lineEdit_m34->text().toAscii())); m.m44 =float(atof(lineEdit_m44->text().toAscii())); return m; } void ScaleAndBiasDlg::RestoreLast() { QSettings settings; QStringList entries = settings.value("Transformation/MeshExpertMatrix").toStringList(); if (entries.count() == 16) { lineEdit_m11->setText(tr("%1").arg(entries[0],0,'f')); lineEdit_m21->setText(tr("%1").arg(entries[1],0,'f')); lineEdit_m31->setText(tr("%1").arg(entries[2],0,'f')); lineEdit_m41->setText(tr("%1").arg(entries[3],0,'f')); lineEdit_m12->setText(tr("%1").arg(entries[4],0,'f')); lineEdit_m22->setText(tr("%1").arg(entries[5],0,'f')); lineEdit_m32->setText(tr("%1").arg(entries[6],0,'f')); lineEdit_m42->setText(tr("%1").arg(entries[7],0,'f')); lineEdit_m13->setText(tr("%1").arg(entries[8],0,'f')); lineEdit_m23->setText(tr("%1").arg(entries[9],0,'f')); lineEdit_m33->setText(tr("%1").arg(entries[10],0,'f')); lineEdit_m43->setText(tr("%1").arg(entries[11],0,'f')); lineEdit_m14->setText(tr("%1").arg(entries[12],0,'f')); lineEdit_m24->setText(tr("%1").arg(entries[13],0,'f')); lineEdit_m34->setText(tr("%1").arg(entries[14],0,'f')); lineEdit_m44->setText(tr("%1").arg(entries[15],0,'f')); } } void ScaleAndBiasDlg::InvertMatrix() { FLOATMATRIX4 m = GetExpertTransform(); SetExpertTransform(m.inverse()); } void ScaleAndBiasDlg::SetExpertTransform(const FLOATMATRIX4& m) { lineEdit_m11->setText(tr("%1").arg(m.m11,0,'f')); lineEdit_m21->setText(tr("%1").arg(m.m21,0,'f')); lineEdit_m31->setText(tr("%1").arg(m.m31,0,'f')); lineEdit_m41->setText(tr("%1").arg(m.m41,0,'f')); lineEdit_m12->setText(tr("%1").arg(m.m12,0,'f')); lineEdit_m22->setText(tr("%1").arg(m.m22,0,'f')); lineEdit_m32->setText(tr("%1").arg(m.m32,0,'f')); lineEdit_m42->setText(tr("%1").arg(m.m42,0,'f')); lineEdit_m13->setText(tr("%1").arg(m.m13,0,'f')); lineEdit_m23->setText(tr("%1").arg(m.m23,0,'f')); lineEdit_m33->setText(tr("%1").arg(m.m33,0,'f')); lineEdit_m43->setText(tr("%1").arg(m.m43,0,'f')); lineEdit_m14->setText(tr("%1").arg(m.m14,0,'f')); lineEdit_m24->setText(tr("%1").arg(m.m24,0,'f')); lineEdit_m34->setText(tr("%1").arg(m.m34,0,'f')); lineEdit_m44->setText(tr("%1").arg(m.m44,0,'f')); } void ScaleAndBiasDlg::Restore() { emit RestoreTransform(this); m_min = m_pMesh->GetMin(); m_max = m_pMesh->GetMax(); UpdatePreSize(); UpdatePostSize(); } void ScaleAndBiasDlg::Save() { emit SaveTransform(this); } void ScaleAndBiasDlg::Apply() { emit ApplyTransform(this); m_min = m_pMesh->GetMin(); m_max = m_pMesh->GetMax(); UpdatePreSize(); UpdatePostSize(); } ImageVis3D-3.1.0/ImageVis3D/UI/Welcome.cpp0000644000175000017500000000600112320517543017566 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : Welcome.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #include "Welcome.h" WelcomeDialog::WelcomeDialog(QWidget* parent, Qt::WindowFlags flags /* = 0 */) : QDialog(parent, flags) { setupUi(this); label_logo->setPixmap(QPixmap::fromImage(QImage(":/Resources/imagevis3dmini.png"))); } WelcomeDialog::~WelcomeDialog(void) { } void WelcomeDialog::CheckUpdates() { emit CheckUpdatesClicked(); } void WelcomeDialog::OnlineVideoTut() { emit OnlineVideoTutClicked(); } void WelcomeDialog::OnlineHelp() { emit OnlineHelpClicked(); } void WelcomeDialog::GetExampleData() { emit GetExampleDataClicked(); } void WelcomeDialog::OpenManual() { emit OpenManualClicked(); } void WelcomeDialog::OpenFromFile() { accept(); emit OpenFromFileClicked(); } void WelcomeDialog::OpenFromDir() { accept(); emit OpenFromDirClicked(); } void WelcomeDialog::OpenMRU() { MRUButton* button = (MRUButton*)qobject_cast(sender()); accept(); emit OpenFromFileClicked(button->strFilename); } void WelcomeDialog::ClearMRUItems() { for (size_t i = 0;iremoveWidget(m_vMRUItems[i]); disconnect(m_vMRUItems[i], SIGNAL(clicked()), this, SLOT(OpenMRU())); delete m_vMRUItems[i]; } m_vMRUItems.clear(); } void WelcomeDialog::AddMRUItem(std::string strDesc, std::string strFilename) { MRUButton* b = new MRUButton(groupBox_OpenFile); b->setText(strDesc.c_str()); b->setMinimumHeight(23); // to make buttons work on the MAC b->strFilename = strFilename; connect(b, SIGNAL(clicked()), this, SLOT(OpenMRU())); verticalLayout_OpenFile->addWidget(b); m_vMRUItems.push_back(b); } ImageVis3D-3.1.0/ImageVis3D/UI/MetadataDlg.h0000644000175000017500000000353012320517543020013 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : MetadataDlg.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #ifndef METADATADLG_H #define METADATADLG_H #include "AutoGen/ui_Metadata.h" class MetadataDlg : public QDialog, protected Ui_MetadataDlg { Q_OBJECT public: MetadataDlg(QWidget* parent, Qt::WindowFlags flags = Qt::Tool); virtual ~MetadataDlg(); void SetFilename(const QString& strFilename); void SetMetadata(const std::vector>& metadata); }; #endif // METADATADLG_H ImageVis3D-3.1.0/ImageVis3D/UI/BugRepDlg.h0000644000175000017500000000452712320517543017466 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : BugRepDlg.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #ifndef BUGREPDLG_H #define BUGREPDLG_H #include "AutoGen/ui_BugRepDlg.h" #include #include #include class BugRepDlg : public QDialog, protected Ui_BugRepDlg { Q_OBJECT public: BugRepDlg(QWidget* parent, Qt::WindowFlags flags = Qt::Tool, const std::string& strSubmitFile=""); virtual ~BugRepDlg(); std::string GetDescription() const; bool SubmitSysinfo() const; bool SubmitLog() const; std::string GetUsername() const; std::string GetUserMail() const; std::vector GetDataFilenames() const; void SetSubmitSysinfo(bool bSubmitSysinfo); void SetSubmitLog(bool bSubmitLog); void SetUsername(std::string strName); void SetUserMail(std::string strMail); /// @return false if the data to submit are invalid. bool Validate(std::string &err) const; protected slots: void AddFiles(); void RemoveFile(); }; #endif // BUGREPDLG_H ImageVis3D-3.1.0/ImageVis3D/UI/Q1DTransferFunction.h0000644000175000017500000001030312320517543021440 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : Q1DTransferFunction.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : July 2008 // //! Copyright (C) 2008 SCI Institute #pragma once #ifndef Q1DTRANSFERFUNCTION #define Q1DTRANSFERFUNCTION #include "QTransferFunction.h" #include "../Tuvok/IO/TransferFunction1D.h" class Q1DTransferFunction : public QTransferFunction { Q_OBJECT public: enum paintMode { PAINT_NONE=0, PAINT_RED=1, PAINT_GREEN=2, PAINT_BLUE=4, PAINT_ALPHA=8, PAINT_UNDEF=16 }; Q1DTransferFunction(MasterController& masterController, QWidget *parent=0); virtual ~Q1DTransferFunction(void); void SetData(std::shared_ptr vHistogram, unsigned int iMaxValue, LuaClassInstance Trans); const LuaClassInstance GetTrans() {return m_trans;} void SetPaintMode(paintMode iPaintMode) { if (iPaintMode < PAINT_UNDEF) m_iPaintMode = iPaintMode; } virtual void ApplyFunction(); bool LoadFromFile(const std::string&); public slots: bool QLoadFromFile(const QString& strFilename); bool SaveToFile(const QString& strFilename); bool AddFromFile(const QString& strFilename); bool SubtractFromFile(const QString& strFilename); protected: virtual void paintEvent(QPaintEvent *event); virtual void mouseMoveEvent(QMouseEvent *event); virtual void mousePressEvent(QMouseEvent *event); virtual void mouseReleaseEvent(QMouseEvent *event); virtual void changeEvent(QEvent * event); private: NormalizedHistogram1D m_vHistogram; LuaClassInstance m_trans; unsigned int m_iPaintMode; // cached image of the backdrop unsigned int m_iCachedHeight; unsigned int m_iCachedWidth; QPixmap* m_pBackdropCache; QImage* m_pPreviewBack; QImage* m_pPreviewColor; // borders, may be changed in the constructor unsigned int m_iLeftBorder; unsigned int m_iBottomBorder; unsigned int m_iTopPreviewHeight; unsigned int m_iTopPreviewDist; // automatically computed borders (computed by DrawCoordinateSystem) unsigned int m_iRightBorder; unsigned int m_iTopBorder; // colors, may be changed in the setcolor QColor m_colorHistogram; QColor m_colorBack; QColor m_colorBorder; QColor m_colorScale; QColor m_colorLargeScale; QColor m_colorRedLine; QColor m_colorGreenLine; QColor m_colorBlueLine; QColor m_colorAlphaLine; void SetColor(bool bIsEnabled); // scale apearance, defaults can be changed in the constructor unsigned int m_iMarkersX; unsigned int m_iMarkersY; unsigned int m_iBigMarkerSpacingX; unsigned int m_iBigMarkerSpacingY; unsigned int m_iMarkerLength; unsigned int m_iBigMarkerLength; // mouse motion handling int m_iLastIndex; float m_fLastValue; bool m_bMouseLeft; bool m_bMouseRight; // drawing routines void DrawCoordinateSystem(QPainter& painter); void DrawHistogram(QPainter& painter); void DrawFunctionPlots(QPainter& painter); void PreparePreviewData(); void RedrawPreviewBarBack(); }; #endif // Q1DTRANSFERFUNCTION ImageVis3D-3.1.0/ImageVis3D/UI/ImageVis3D_Help.cpp0000644000175000017500000005641612320517543021055 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : ImageVis3D_Help.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #include "../Tuvok/Basics/StdDefines.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "../Tuvok/Renderer/GPUMemMan/GPUMemMan.h" #include "ImageVis3D.h" #ifdef DETECTED_OS_WINDOWS # include # include # include # define unlink _unlink #else # include #endif #include "URLDlg.h" #include "AboutDlg.h" #include "BugRepDlg.h" #include "FTPDialog.h" #include "../Tuvok/Basics/SysTools.h" #include "../Tuvok/Basics/SystemInfo.h" #include "../Tuvok/Basics/Appendix.h" #include "../Tuvok/Controller/Controller.h" using namespace std; void MainWindow::ShowAbout() { QString qstrTitle; QString qstrText(""); #ifdef _DEBUG qstrTitle = tr("ImageVis3D %1 %2 DEBUG VERSION!").arg(IV3D_VERSION).arg(IV3D_VERSION_TYPE); qstrText = tr("Warning: this is a DEBUG build! This version is for " "testing only. Some functions may run with dramatically " "reduced performance. Please download a release build for " "general use.\n\n"); #else qstrTitle = tr("ImageVis3D %1").arg(IV3D_VERSION); #endif qstrText += tr("This is the award winning ImageVis3D volume rendering system %1 %2, using the Tuvok render engine " "%3 %4 %5. Copyright 2008-2014 by the Scientific Computing " "and Imaging (SCI) Institute, and the High Performance " "Computing Group at the University of Duisburg-Essen, Germany.\n\n" "Hilbert Curve implementation copyright 1998, Rice University." "LZ4 - Fast LZ compression algorithm copyright 2011-2012, Yann Collet.") .arg(IV3D_VERSION) .arg(IV3D_VERSION_TYPE) .arg(TUVOK_VERSION) .arg(TUVOK_VERSION_TYPE) .arg(TUVOK_DETAILS); AboutDlg d(qstrTitle,qstrText, this); connect(&d, SIGNAL(CheckUpdatesClicked()), this, SLOT(CheckForUpdates())); connect(&d, SIGNAL(OnlineVideoTutClicked()), this, SLOT(OnlineVideoTut())); connect(&d, SIGNAL(OnlineHelpClicked()), this, SLOT(OnlineHelp())); connect(&d, SIGNAL(ReportABugClicked()), this, SLOT(ReportABug())); d.exec(); disconnect(&d, SIGNAL(CheckUpdatesClicked()), this, SLOT(CheckForUpdates())); disconnect(&d, SIGNAL(OnlineVideoTutClicked()), this, SLOT(OnlineVideoTut())); disconnect(&d, SIGNAL(OnlineHelpClicked()), this, SLOT(OnlineHelp())); disconnect(&d, SIGNAL(ReportABugClicked()), this, SLOT(ReportABug())); } void MainWindow::QuietCheckForUpdates() { m_bStartupCheck = true; // This should really be done in a background thread... CheckForUpdatesInternal(); } void MainWindow::CheckForUpdates() { m_bStartupCheck = false; CheckForUpdatesInternal(); } void MainWindow::CheckForUpdatesInternal() { #ifndef PACKAGE_MANAGER // cleanup updatefile, this codepath is taken for instance when the windows firewall blocked an http request if (m_pUpdateFile && m_pUpdateFile->isOpen()) { m_pUpdateFile->close(); DeleteUpdateFile(); // is seems like m_pHttp gets stuck if the firewall blocked it the first time so lets create a new one disconnect(m_pHttp, SIGNAL(requestFinished(int, bool)), this, SLOT(httpRequestFinished(int, bool))); disconnect(m_pHttp, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)), this, SLOT(readResponseHeader(const QHttpResponseHeader &))); delete m_pHttp; m_pHttp = new QHttp(this); connect(m_pHttp, SIGNAL(requestFinished(int, bool)), this, SLOT(httpRequestFinished(int, bool))); connect(m_pHttp, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)), this, SLOT(readResponseHeader(const QHttpResponseHeader &))); } if (!m_pHttp) return; QString strCompleteFile = tr("%1%2").arg(UPDATE_VERSION_PATH).arg(UPDATE_VERSION_FILE); QUrl url(strCompleteFile); QHttp::ConnectionMode mode = url.scheme().toLower() == "https" ? QHttp::ConnectionModeHttps : QHttp::ConnectionModeHttp; m_pHttp->setHost(url.host(), mode, url.port() == -1 ? 0 : url.port()); if (!url.userName().isEmpty()) m_pHttp->setUser(url.userName(), url.password()); QString strUpdateFile = tr("%1/ImageVis3D_UpdateCheck_Temp").arg(QDir::tempPath()); m_pUpdateFile = new QTemporaryFile(strUpdateFile); // Ignore return value; not much we can do if it fails. (void) unlink(strUpdateFile.toStdString().c_str()); QByteArray remotePath = QUrl::toPercentEncoding(url.path(), "!$&'()*+,;=:@/"); if (remotePath.isEmpty()) remotePath = "/"; m_iHttpGetId = m_pHttp->get(remotePath, m_pUpdateFile); #endif } void MainWindow::httpRequestFinished(int requestId, bool error) { if (requestId != m_iHttpGetId || !m_pUpdateFile) return; if (m_pUpdateFile && m_pUpdateFile->isOpen()) { m_pUpdateFile->close(); } if (!m_bScriptMode) { if (error) { if (!m_bStartupCheck) ShowInformationDialog( tr("Update Check"),tr("Download failed: %1.").arg(m_pHttp->errorString())); } else { struct VersionNumber iv3d; struct VersionNumber tuvok; #ifdef IV3D_SVN_VERSION size_t iv3d_svn = IV3D_SVN_VERSION; #else size_t iv3d_svn = 0; #endif #ifdef TUVOK_SVN_VERSION size_t tuvok_svn = TUVOK_SVN_VERSION; #else size_t tuvok_svn = 0; #endif if (GetVersionsFromUpdateFile(string(m_pUpdateFile->fileName().toAscii()), iv3d, tuvok)) { const struct VersionNumber local_iv3d = { IV3D_MAJOR, IV3D_MINOR, IV3D_PATCH, iv3d_svn }; const struct VersionNumber local_tuvok = { TUVOK_MAJOR, TUVOK_MINOR, TUVOK_PATCH, tuvok_svn }; // First check the release version numbers. if(iv3d > local_iv3d || tuvok > local_tuvok) { QString qstrMessage = tr("A newer ImageVis3D was found " "(version %1, %2 Tuvok). " "You SHOULD download the newer version at"). arg(std::string(iv3d).c_str()). arg(std::string(tuvok).c_str()); URLDlg u(tr("Update Check"), qstrMessage, UPDATE_STABLE_PATH, this); u.exec(); } else if(iv3d == local_iv3d && tuvok == local_tuvok) { // Then check svn revisions, if the user cares for devbuilds. #if defined(IV3D_SVN_VERSION) && defined(TUVOK_SVN_VERSION) if(m_bCheckForDevBuilds && (local_iv3d.svn < iv3d.svn || local_tuvok.svn < tuvok.svn)) { QString qstrMessage = tr("A new SVN devbuild (%1-%2) of " "ImageVis3D was found. You MAY " "want to download the newer version at"). arg(std::string(iv3d).c_str()). arg(std::string(tuvok).c_str()); QString qstrURL = tr("%1%2").arg(UPDATE_NIGHTLY_PATH).arg(UPDATE_FILE); URLDlg u(tr("Update Check"), qstrMessage, qstrURL, this); u.exec(); } else // if() continued after #endif! #endif if (!m_bStartupCheck) { ShowInformationDialog(tr("Update Check"), tr("This is the most current version " "of ImageVis3D and Tuvok!")); } } } else { T_ERROR("Could not parse versions file."); } } } } void MainWindow::DeleteUpdateFile() { if (m_pUpdateFile) { m_pUpdateFile->remove(); delete m_pUpdateFile; m_pUpdateFile = NULL; } } void MainWindow::readResponseHeader(const QHttpResponseHeader &responseHeader) { switch (responseHeader.statusCode()) { case 200: // Ok case 301: // Moved Permanently case 302: // Found case 303: // See Other case 307: // Temporary Redirect // these are not error conditions break; default: if (!m_bStartupCheck) ShowInformationDialog( tr("Update Check"), tr("Download failed: %1.") .arg(responseHeader.reasonPhrase())); m_pHttp->abort(); } } MainWindow::VersionNumber::operator std::string() const { std::ostringstream oss; oss << this->major << "." << this->minor << "." << this->patch; return oss.str(); } bool MainWindow::VersionNumber::operator==(const VersionNumber &vn) const { return this->major == vn.major && this->minor == vn.minor && this->patch == vn.patch; } bool MainWindow::VersionNumber::operator>(const VersionNumber &vn) const { return this->major > vn.major || (this->major == vn.major && this->minor > vn.minor) || (this->major == vn.major && this->minor == vn.minor && this->patch > vn.patch); } bool MainWindow::GetVersionsFromUpdateFile(const std::string& strFilename, struct VersionNumber& iv3d, struct VersionNumber& tuvok) { string line =""; ifstream updateFile(strFilename.c_str(),ios::binary); #define CHECK_EOF() \ do { \ if(updateFile.eof()) { updateFile.close(); return false; } \ } while(0) if(!updateFile.is_open()) { DeleteUpdateFile(); return false; } CHECK_EOF(); char skip; // use to skip the "." characters in version strings. // IV3D version. getline(updateFile, line); { std::istringstream iss(line); iss >> iv3d.major >> skip >> iv3d.minor >> skip >> iv3d.patch; MESSAGE("read iv3d vnumber: %u.%u.%u", static_cast(iv3d.major), static_cast(iv3d.minor), static_cast(iv3d.patch)); } CHECK_EOF(); // IV3D svn revision. getline(updateFile, line); { std::istringstream iss(line); iss >> iv3d.svn; } CHECK_EOF(); // Tuvok version getline(updateFile, line); { std::istringstream iss(line); iss >> tuvok.major >> skip >> tuvok.minor >> skip >> tuvok.patch; MESSAGE("read tuvok vnumber: %u.%u.%u", static_cast(tuvok.major), static_cast(tuvok.minor), static_cast(tuvok.patch)); } CHECK_EOF(); // Tuvok svn revision getline(updateFile, line); { std::istringstream iss(line); iss >> tuvok.svn; } updateFile.close(); DeleteUpdateFile(); return true; } void MainWindow::UploadLogToServer() { QFile* pFTPTempFile =new QFile("SubmittedDebugOutput.txt"); if (!pFTPTempFile->open(QIODevice::WriteOnly | QIODevice::Text)) { ShowInformationDialog("Log creation failed", "Could not create a log file to submit."); return; } QTextStream outstream(pFTPTempFile); for (int i = 0;icount();i++) outstream << listWidget_DebugOut->item(i)->text() << "\n"; pFTPTempFile->close(); string strSourceName = string(pFTPTempFile->fileName().toAscii()); delete pFTPTempFile; QString qstrID = GenUniqueName("DebugOut","txt").c_str(); FtpTransfer(strSourceName, string(qstrID.toAscii())); } std::string MainWindow::GenUniqueName(const std::string& strPrefix, const std::string& strExt) { return string(tr("%1_%2_%3.%4").arg(strPrefix.c_str()).arg(QTime::currentTime().toString()).arg(QDate::currentDate().toString()).arg(strExt.c_str()).toAscii()); } bool MainWindow::FtpTransfer(string strSource, string strDest, bool bDeleteSource) { if (!m_bFTPFinished) return false; m_bFTPFinished = true; m_strFTPTempFile = strSource; if (m_pFTPDialog) { disconnect(m_pFTPDialog, 0,0,0); delete m_pFTPDialog; } m_bFTPDeleteSource = bDeleteSource; string strFullDest = string(DEBUG_DUMP_PATH) + strDest; m_pFTPDialog = new FTPDialog(strSource, DEBUG_DUMP_SERVER ,strFullDest, this); connect(m_pFTPDialog, SIGNAL(TransferFailure()), this, SLOT(FtpFail())); connect(m_pFTPDialog, SIGNAL(TransferSuccess()), this, SLOT(FtpSuccess())); m_pFTPDialog->Start(); return true; } void MainWindow::FtpFail() { if (SysTools::FileExists(m_strFTPTempFile) && m_bFTPDeleteSource) remove(m_strFTPTempFile.c_str()); ShowInformationDialog("Transfer failed", "Transfer failed"); m_bFTPFinished = true; } void MainWindow::FtpSuccess() { if (SysTools::FileExists(m_strFTPTempFile) && m_bFTPDeleteSource) remove(m_strFTPTempFile.c_str()); ShowInformationDialog("Transfer successfull", "Transfer successfull"); m_bFTPFinished = true; } void MainWindow::OnlineHelp() { QDesktopServices::openUrl(QString(HELP_URL)); } bool readable(const std::string& f) { return QFile(QString(f.c_str())).permissions() & QFile::ReadUser; } void MainWindow::OpenManual() { #ifdef DETECTED_OS_WINDOWS ShellExecuteA(NULL, "open", MANUAL_NAME, NULL,NULL,SW_SHOWDEFAULT); #elif defined(DETECTED_OS_APPLE) string manualOpenCall = "open " + SysTools::GetFromResourceOnMac(MANUAL_NAME); system(manualOpenCall.c_str()); #else // This path assumes at least "POSIX", and the /proc FS is linux-specific. // Technically things should still work even if /proc doesn't exist. /// Find out where our binary lives. The manual is placed in the same /// directory in the case of the binary tarballs we provide. std::vector paths; paths.reserve(4); char linkbuf[1024]; memset(linkbuf, 0, 1024); if(readlink("/proc/self/exe", linkbuf, 1024) == -1) { T_ERROR("Error reading /proc/self/exe; ignoring binary directory while " "searching for manual."); } else { paths.push_back(QFileInfo(linkbuf).absolutePath().toStdString() + MANUAL_NAME); } paths.push_back(std::string("/usr/share/doc/imagevis3d/") + MANUAL_NAME); paths.push_back(std::string("/usr/local/share/doc/imagevis3d/") + MANUAL_NAME); paths.push_back(MANUAL_NAME); std::vector::const_iterator found = find_if(paths.begin(), paths.end(), readable); if(found == paths.end()) { T_ERROR("Could not find manual..."); QMessageBox::critical(this, "Manual Not Found", "Could not find the local manual. This is probably " "a packaging/distribution error -- please use the " "'Report an Issue' feature and mention how you " "obtained this ImageVis3D binary. Thanks!\n\n" "As a workaround, use the 'Open Online Help' " "option to download the latest version of the " "manual."); return; } MESSAGE("Manual found at: %s", found->c_str()); // Now, figure out how to load the PDF. QUrl uri; { std::ostringstream u; u << *found; QString pth = QFileInfo(u.str().c_str()).absoluteFilePath(); uri.setUrl(pth); MESSAGE("uri: %s", pth.toStdString().c_str()); } if(!QDesktopServices::openUrl(uri)) { MESSAGE("Manual open failed, relying on manual method."); typedef std::array progvec; progvec viewers = {{ "evince", "xpdf", "acroread" }}; // Now iterate through each of those programs until one of them // successfully launches. for(progvec::const_iterator prog = viewers.begin(); prog != viewers.end(); ++prog) { char manual[1024]; snprintf(manual, 1024, "%s %s", prog->c_str(), found->c_str()); if(system(manual) != -1) { break; } } } #endif } void MainWindow::OnlineVideoTut() { QDesktopServices::openUrl(QString(TUTORIAL_URL)); } void MainWindow::GetExampleData() { QDesktopServices::openUrl(QString(DEMO_DATA_URL)); } void MainWindow::CloseWelcome() { if (m_pWelcomeDialog->ShowAtStartup() != m_bShowWelcomeScreen) { QSettings settings; settings.setValue("UI/ShowWelcomeScreen", m_pWelcomeDialog->ShowAtStartup()); } } void MainWindow::ReportABug() { ReportABug(""); } void MainWindow::ReportABug(const string& strFile) { BugRepDlg b(this, Qt::Tool, strFile); QSettings settings; settings.beginGroup("BugReport"); b.SetSubmitSysinfo(settings.value("SubmitSysinfo", true).toBool()); b.SetSubmitLog(settings.value("SubmitLog", true).toBool()); b.SetUsername(string(settings.value("Username", "").toString().toAscii())); b.SetUserMail(string(settings.value("UserMail", "").toString().toAscii())); while(b.exec() != QDialog::Rejected) { { std::string err; if(!b.Validate(err)) { err = "An error occurred while validating the bug report.\n\n" + err; QMessageBox::critical(this, "Validation Error", err.c_str()); continue; } } settings.setValue("SubmitSysinfo", b.SubmitSysinfo()); settings.setValue("SubmitLog", b.SubmitLog()); settings.setValue("Username", b.GetUsername().c_str()); settings.setValue("UserMail", b.GetUserMail().c_str()); // first create the report textfile ofstream reportFile("bugreport.txt"); if (!reportFile.is_open()) { ShowWarningDialog("Warning", "Unable to create bugreport.txt, aborting."); return; } string strDate(QDate::currentDate().toString().toAscii()); string strTime(QTime::currentTime().toString().toAscii()); reportFile << "Issue Report " << strDate << " " << strTime << endl << endl << endl; reportFile << "Tuvok Version:" << TUVOK_VERSION << " " << TUVOK_VERSION_TYPE << " " << TUVOK_DETAILS; #ifdef TUVOK_SVN_VERSION reportFile << " SVN Version:" << int(TUVOK_SVN_VERSION); #endif reportFile << std::endl << "ImageVis3D Version:" << IV3D_VERSION << " " << IV3D_VERSION_TYPE; #ifdef IV3D_SVN_VERSION reportFile << " SVN Version:" << int(IV3D_SVN_VERSION); #endif reportFile << endl << "QT Version:" << QT_VERSION_STR << endl; reportFile << "This is a "<< m_MasterController.MemMan()->GetBitWidthMem() << "bit build." << endl; if (b.GetUsername() != "") reportFile << "User:" << b.GetUsername() << endl; if (b.GetUserMail() != "") reportFile << "Email:" << b.GetUserMail() << endl; reportFile << endl << endl << "Description:" << endl << b.GetDescription() << endl; if (b.SubmitSysinfo() ) { reportFile << endl << endl << "Memory info:" << endl; const uint64_t mb = 1024*1024; reportFile << "CPU Memory: Total " << m_MasterController.MemMan()->GetCPUMem()/mb << " MB, Usable " << m_MasterController.SysInfo()->GetMaxUsableCPUMem()/mb << " MB" << endl; reportFile << " Used: " << m_MasterController.MemMan()->GetAllocatedCPUMem()/mb << " MB (" << m_MasterController.MemMan()->GetAllocatedCPUMem() << " Bytes)" << endl; if (m_MasterController.MemMan()->GetAllocatedCPUMem() < m_MasterController.MemMan()->GetCPUMem()) { reportFile << " Available: " << (m_MasterController.MemMan()->GetCPUMem() - m_MasterController.MemMan()->GetAllocatedCPUMem())/mb << "MB" << endl; } reportFile << "GPU Memory: Total " << m_MasterController.MemMan()->GetGPUMem()/mb << " MB, Usable " << m_MasterController.SysInfo()->GetMaxUsableGPUMem()/mb << " MB" << endl; reportFile << " Used: " << m_MasterController.MemMan()->GetAllocatedGPUMem()/mb << " MB (" << m_MasterController.MemMan()->GetAllocatedGPUMem() << " Bytes)" << endl; if (m_MasterController.MemMan()->GetAllocatedGPUMem() < m_MasterController.MemMan()->GetGPUMem()) { reportFile << " Available: " << (m_MasterController.MemMan()->GetGPUMem() - m_MasterController.MemMan()->GetAllocatedGPUMem())/mb <<" MB" << endl; } reportFile << endl << endl << "GPU info:" << endl; #if defined(_WIN32) && defined(USE_DIRECTX) if (DynamicDX::IsInitialized()) reportFile << "Direct3DX10 Version " << DynamicDX::GetD3DX10Version() << endl; else reportFile << "DirectX 10 not initialzed" << endl; #endif if (RenderWindow::GetVendorString() == "") { reportFile << "No GL-info discovered yet" << endl; } else { reportFile << RenderWindow::GetVendorString().c_str() << endl; reportFile << "Maximum 3D texture size " << RenderWindow::GetMax3DTexDims() << endl; reportFile << "Supported GL extensions:" << endl; reportFile << RenderWindowGL::GetExtString() << endl; } } if (b.SubmitLog()) { reportFile << endl << endl << "Debug Log:" << endl; for (int i = 0;icount();i++) { string line(listWidget_DebugOut->item(i)->text().toAscii()); reportFile << " " << line << endl; } } reportFile.close(); // combine everything into a single file vector vFiles = b.GetDataFilenames(); vFiles.push_back("bugreport.txt"); Appendix a("report.apx", vFiles); remove("bugreport.txt"); if (!a.IsOK()) { ShowWarningDialog("Warning", "Unable to create report file report.apx," " aborting."); return; } // compress that single file /// \todo Tom add compressor here QString qstrID = tr("ErrorReport_%1_%2.apx").arg(QTime::currentTime().toString()).arg(QDate::currentDate().toString()); if (!FtpTransfer("report.apx", string(qstrID.toAscii()), true)) { remove("report.apx"); ShowWarningDialog("Warning", "Another FTP transfer is still in progress, aborting."); return; } return; } } ImageVis3D-3.1.0/ImageVis3D/UI/RenderWindowGL.cpp0000644000175000017500000004005112320517543021030 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : RenderWindowGL.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #include "../Tuvok/StdTuvokDefines.h" #include #include #include <3rdParty/GLEW/GL/glew.h> #if defined(__GNUC__) && defined(DETECTED_OS_LINUX) # pragma GCC visibility push(default) #endif #include #include #if defined(__GNUC__) && defined(DETECTED_OS_LINUX) # pragma GCC visibility pop #endif #include "RenderWindowGL.h" #include "ImageVis3D.h" #include "../Tuvok/Controller/Controller.h" #include "../Tuvok/Renderer/GL/GLFrameCapture.h" #include "../Tuvok/Renderer/GL/GLInclude.h" #include "../Tuvok/Renderer/GL/GLRenderer.h" #include "../Tuvok/Renderer/ContextIdentification.h" #include "../Tuvok/LuaScripting/LuaScripting.h" #include "../Tuvok/LuaScripting/TuvokSpecific/LuaTuvokTypes.h" using namespace std; using namespace tuvok; std::string RenderWindowGL::ms_glExtString = ""; RenderWindowGL::RenderWindowGL(MasterController& masterController, MasterController::EVolumeRendererType eType, const QString& dataset, unsigned int iCounter, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder, QGLWidget* glShareWidget, const QGLFormat& fmt, QWidget* parent, Qt::WindowFlags flags) : QGLWidget(fmt, parent, glShareWidget, flags), RenderWindow(masterController, eType, dataset, iCounter, parent) { if(!SetNewRenderer(bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder)) return; setObjectName("RenderWindowGL"); // this is used by WidgetToRenderWin() to detect the type setWindowTitle(m_strID); setFocusPolicy(Qt::StrongFocus); setMouseTracking(true); setAttribute(Qt::WA_DeleteOnClose, true); Initialize(); //finish initializing. } bool RenderWindowGL::SetNewRenderer(bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder) { shared_ptr ss = m_MasterController.LuaScript(); m_LuaAbstrRenderer = ss->cexecRet( "tuvok.renderer.new", m_eRendererType, bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder, false); m_Renderer = m_LuaAbstrRenderer.getRawPointer(ss); string rn = m_LuaAbstrRenderer.fqName(); // so far we are not rendering anything previous to this renderer // so we can disable the depth-buffer to offscreen copy operations ss->cexec(rn + ".setConsiderPrevDepthBuffer", false); /// @todo Check to see whether undo/redo breaks because of this lua call. /// Might need to disable provenance for the call. if (!ss->cexecRet(rn + ".loadDataset", m_strDataset.toStdString())) { m_bRenderSubsysOK = false; return false; } m_bRenderSubsysOK = true; return true; } RenderWindowGL::~RenderWindowGL() { // needed for the cleanup call in the parent destructor to work properly makeCurrent(); // ignore mouse/keyboard events while we're killing ourself. GetQtWidget()->setEnabled(false); m_MainWindow->closeMDISubWindowWithWidget(this); } static bool contains(const char* haystack, const char* needle) { assert(needle); for(const char* h = haystack; *h; ++h) { const char* n; for(n = needle; *h && *n; ++n) { if(tolower(*h) != tolower(*n)) { break; } ++h; } // did we run off the end of needle? then we just found it. if(*n == '\0') { return true; } } // if we got here... nope, it's not there. return false; } // Identify which renderer we should use based on OpenGL parameters. static MasterController::EVolumeRendererType choose_renderer() { const GLubyte *version=glGetString(GL_VERSION); GLint iMaxVolumeDims; glGetIntegerv(GL_MAX_TEXTURE_SIZE, &iMaxVolumeDims); // Use the grid leaper if we can.. But only on windows. #ifdef DETECTED_OS_WINDOWS const bool OpenGLILS_EXT = glewGetExtension("GL_EXT_shader_image_load_store"); const bool OpenGLILS_ARB = glewGetExtension("GL_ARB_shader_image_load_store"); const bool OpenGL42 = atof((const char*)version) >= 4.2; const bool nvidia = contains(reinterpret_cast(version), "nvidia"); if((OpenGL42 || OpenGLILS_EXT || OpenGLILS_ARB) && iMaxVolumeDims >= 1024 && nvidia) { return MasterController::OPENGL_GRIDLEAPER; } #endif // give them the 2D SBVR if they can't support 3D textures. // .... and also if they have an intel card. All intel cards report they // support 3D textures, but that path is really broken. const bool OpenGL3DT = glewGetExtension("GL_EXT_texture3D"); if(contains(reinterpret_cast(version), "intel") || !OpenGL3DT) { return MasterController::OPENGL_2DSBVR; } return MasterController::OPENGL_SBVR; } static std::string renderer_name(MasterController::EVolumeRendererType ren) { switch(ren) { case MasterController::OPENGL_2DSBVR: return "OGL 2D SBVR"; case MasterController::OPENGL_SBVR: return "OGL 3D SBVR"; case MasterController::OPENGL_RAYCASTER: return "OGL Raycaster"; case MasterController::OPENGL_GRIDLEAPER: return "OGL GridLeaper"; case MasterController::DIRECTX_2DSBVR: return "DX 2D SBVR"; case MasterController::DIRECTX_SBVR: return "DX 3D SBVR"; case MasterController::DIRECTX_RAYCASTER: return "DX Raycaster"; case MasterController::DIRECTX_GRIDLEAPER: return "DX GridLeaper"; case MasterController::OPENGL_CHOOSE: return "OGL System's Choice"; case MasterController::RENDERER_LAST: return "Invalid!"; } return "Invalid"; } void RenderWindowGL::InitializeRenderer() { // something has already gone wrong if (!m_bRenderSubsysOK) return; shared_ptr ss = m_MasterController.LuaScript(); string rn = m_LuaAbstrRenderer.fqName(); static bool bFirstTime = true; static bool bRenderSubSysOKFirstTime = true; m_bRenderSubsysOK = bRenderSubSysOKFirstTime; if (bFirstTime) { int err = glewInit(); if (err != GLEW_OK) { T_ERROR("Error initializing GLEW: %s", glewGetErrorString(err)); m_bRenderSubsysOK = false; return; } else { const GLubyte *vendor=glGetString(GL_VENDOR); const GLubyte *renderer=glGetString(GL_RENDERER); const GLubyte *version=glGetString(GL_VERSION); stringstream s; s << vendor << " " << renderer << " with OpenGL version " << version; ms_gpuVendorString = s.str(); MESSAGE("Starting up GL! Running on a %s", ms_gpuVendorString.c_str()); const bool bOpenGLSO12 = atof((const char*)version) >= 1.2; const bool bOpenGLSO20 = atof((const char*)version) >= 2.0; const bool bOpenGLSO = glewGetExtension("GL_ARB_shader_objects"); const bool bOpenGLSL = glewGetExtension("GL_ARB_shading_language_100"); const bool bOpenGL3DT = glewGetExtension("GL_EXT_texture3D"); const bool bOpenGLFBO = glewGetExtension("GL_EXT_framebuffer_object"); // for the new renderer const bool bOpenGL42 = atof((const char*)version) >= 4.2; const bool bOpenGLILS_EXT = glewGetExtension("GL_EXT_shader_image_load_store"); const bool bOpenGLILS_ARB = glewGetExtension("GL_ARB_shader_image_load_store"); ms_bImageLoadStoreInDriver = bOpenGL42 || bOpenGLILS_EXT || bOpenGLILS_ARB; const bool bOpenGLCD_ARB = glewGetExtension("GL_ARB_conservative_depth"); ms_bConservativeDepthInDriver = bOpenGL42 || bOpenGLCD_ARB; GLint iMaxVolumeDims; if (bOpenGLSO12 || bOpenGL3DT) { glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE_EXT, &iMaxVolumeDims); ms_b3DTexInDriver = true; } else { glGetIntegerv(GL_MAX_TEXTURE_SIZE, &iMaxVolumeDims); ms_b3DTexInDriver = false; } ms_iMaxVolumeDims = iMaxVolumeDims; char *extensions = NULL; extensions = (char*)glGetString(GL_EXTENSIONS); if (extensions != NULL) ms_glExtString = extensions; // replace the renderer if they wanted us to figure it out for them. if(m_eRendererType == MasterController::OPENGL_CHOOSE) { m_eRendererType = choose_renderer(); MESSAGE("Chose '%s' renderer!", renderer_name(m_eRendererType).c_str()); Cleanup(); // delete old renderer SetNewRenderer(true, false, false); Initialize(); rn = m_LuaAbstrRenderer.fqName(); } if (!bOpenGLSO12 && !bOpenGL3DT) { // according to spec 3D textures // are part of the OpenGl 1.2 core // we may have to change this if we // realize that too many drivers // are reporting a GL version greater // equal to 1.2 but do not support // 3D textures if (m_eRendererType == MasterController::OPENGL_2DSBVR) { // hardware does not support 3D textures but the user already // selected the 2D stack based volume renderer MESSAGE("OpenGL 3D textures not supported (GL_EXT_texture3D). " "This is not an issue as the rendertype is set to " "a 2D stack based renderer."); } else { // hardware does not support 3D textures but the user // selected a renderer that requires 3D textures // so we write out a warning and switch to the 2D texture // stack based renderer WARNING("OpenGL 3D textures not supported, switching to " "2D texture stack based renderer. To avoid this " "warning and to improve startup times please " "switch to 2D slicing mode in the preferences."); bool bUseOnlyPowerOfTwo = ss->cexecRet(rn + ".getUseOnlyPowerOfTwo"); bool bDownSampleTo8Bits = ss->cexecRet(rn + ".getDownSampleTo8Bits"); bool bDisableBorder = ss->cexecRet(rn + ".getDisableBorder"); // delete old renderer Cleanup(); // create new renderer that uses only 2D slices m_eRendererType = MasterController::OPENGL_2DSBVR; SetNewRenderer(bUseOnlyPowerOfTwo,bDownSampleTo8Bits,bDisableBorder); Initialize(); rn = m_LuaAbstrRenderer.fqName(); } } if (bOpenGLFBO && (bOpenGLSO20 || bOpenGLSL)) { // A small but still significant subset of cards report that they // support 3D textures, as long as they are 0^3 or smaller. Yeah. // All such cards (that we've seen) work fine. It's a common use // case, so we'll skip the warning for now. -- tjf, Nov 18 2009 if (ms_iMaxVolumeDims > 0 && ms_iMaxVolumeDims < ss->cexecRet("tuvok.io.getMaxBrickSize")) { std::ostringstream warn; warn << "Maximum supported texture size (" << ms_iMaxVolumeDims << ") " << "is smaller than the current setting (" << ss->cexecRet("tuvok.io.getMaxBrickSize") << "). " << "Adjusting settings!"; WARNING("%s", warn.str().c_str()); ss->cexec("tuvok.io.setMaxBrickSize", ms_iMaxVolumeDims, ss->cexecRet("tuvok.io.getBuilderBrickSize")); } else { MESSAGE("Maximum supported texture size: %u " "(required by IO subsystem: %llu)", ms_iMaxVolumeDims, ss->cexecRet("tuvok.io.getMaxBrickSize")); } if (ms_bImageLoadStoreInDriver) { MESSAGE("Image Load/Store supported by driver."); } else { MESSAGE("Image Load/Store not supported by driver, " "octree raycaster disabed."); } m_bRenderSubsysOK = true; } else { T_ERROR("Insufficient OpenGL support:"); if (!bOpenGLSO) { T_ERROR("OpenGL shader objects not supported " "(GL_ARB_shader_objects)"); } if (!bOpenGLSL) { T_ERROR("OpenGL shading language version 1.0 not supported" " (GL_ARB_shading_language_100)"); } if (!bOpenGLFBO) { T_ERROR("OpenGL framebuffer objects not supported " "(GL_EXT_framebuffer_object)"); } m_bRenderSubsysOK = false; } } } if (m_bRenderSubsysOK) { if (!m_LuaAbstrRenderer.isValid(ss)) m_bRenderSubsysOK = false; else { #ifdef DETECTED_OS_LINUX ss->cexec(rn + ".addShaderPath", "/usr/share/imagevis3d/shaders"); #endif // Lua scripting will handle the shared_ptr appropriately. The // initialize lua function has been marked as provenance exempt, and as // such, a shared_ptr reference is not maintained inside of the // provenance system. m_bRenderSubsysOK = ss->cexecRet(rn + ".initialize", GLContextID::Current(0)); } } if (!m_bRenderSubsysOK) { if (m_LuaAbstrRenderer.isValid(ss)) { ss->cexec(rn + ".cleanup"); } m_MasterController.ReleaseVolumeRenderer(m_LuaAbstrRenderer); m_LuaAbstrRenderer.invalidate(); } if (bFirstTime) { bRenderSubSysOKFirstTime = m_bRenderSubsysOK; bFirstTime = false; } } void RenderWindowGL::ForceRepaint() { repaint(); } void RenderWindowGL::SwapBuffers() { swapBuffers(); } void RenderWindowGL::SetBlendPrecision(AbstrRenderer::EBlendPrecision eBlendPrecisionMode) { makeCurrent(); RenderWindow::SetBlendPrecision(eBlendPrecisionMode); } void RenderWindowGL::ToggleFullscreen() { /// \todo find out how to do this in QT, if fixed remember to remove the setVisible(false) in ImageVis3D } void RenderWindowGL::PaintOverlays() { if (GetViewMode() != VM_SINGLE) RenderSeparatingLines(); } void RenderWindowGL::RenderSeparatingLines() { RendererSyncStateManager(); RendererFixedFunctionality(); glDisable(GL_BLEND); glDisable(GL_DEPTH_TEST); glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_3D); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrtho(0, 1, 1, 0, 0, 1); // Note we reverse top and bottom to match the QT canvas glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glLineWidth(regionSplitterWidth); if (GetViewMode() == VM_TWOBYTWO) { glBegin(GL_LINES); glColor4f(1.0f,1.0f,1.0f,1.0f); glVertex3f(m_vWinFraction.x,-1,0); glVertex3f(m_vWinFraction.x,1,0); glVertex3f(-1,m_vWinFraction.y,0); glVertex3f(1,m_vWinFraction.y,0); glEnd(); } glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); RendererSyncStateManager(); } ImageVis3D-3.1.0/ImageVis3D/UI/ScaleAndBiasDlg.h0000644000175000017500000000611112320517543020542 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : ScaleAndBiasDlg.h //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #ifndef SCALEANDBIASDLG_H #define SCALEANDBIASDLG_H #include #include "UI/AutoGen/ui_ScaleAndBiasDlg.h" #include #include "../Tuvok/Basics/Vectors.h" namespace tuvok { class RenderMesh; }; class ScaleAndBiasDlg : public QDialog, protected Ui_ScaleAndBiasDlg { Q_OBJECT public: ScaleAndBiasDlg(std::shared_ptr mesh, size_t index, const FLOATVECTOR3& vmin, const FLOATVECTOR3& vmax, QWidget* parent = 0 , Qt::WindowFlags flags = 0); virtual ~ScaleAndBiasDlg(); FLOATVECTOR3 scaleVec; FLOATVECTOR3 biasVec; FLOATMATRIX4 GetExpertTransform(); void SetExpertTransform(const FLOATMATRIX4& m); size_t m_index; std::shared_ptr m_pMesh; protected slots: void ScaleIsotropic(); void ScaleUnisotropic(); void ScaleIsotropicVol(); void ScaleUnisotropicVol(); void ValuesChanged(); void ApplyExpertMatrix(); void CopyScaleAndBias(); void ToggleExpertView(); void InvertMatrix(); void RestoreLast(); void Restore(); void Save(); void Apply(); signals: void SaveTransform(ScaleAndBiasDlg*); void RestoreTransform(ScaleAndBiasDlg*); void ApplyTransform(ScaleAndBiasDlg*); void ApplyMatrixTransform(ScaleAndBiasDlg*); private: FLOATVECTOR3 m_min; FLOATVECTOR3 m_max; FLOATVECTOR3 m_minVolume; FLOATVECTOR3 m_maxVolume; void UpdatePreSize(); void UpdatePostSize(); void setupUi(QDialog *ScaleAndBiasDlg, const std::string& strDesc); }; #endif // SCALEANDBIASDLG_H ImageVis3D-3.1.0/ImageVis3D/UI/MDIRenderWin.cpp0000644000175000017500000000473612320517543020437 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief Subclasses QMdiSubWindow so that we have more complete control over the destruction of a render window. Necessary so that undo functions properly when the window is destroyed. */ #include "../Tuvok/StdTuvokDefines.h" #include #include #include #include "GL/glew.h" #if defined(__GNUC__) && defined(DETECTED_OS_LINUX) # pragma GCC visibility push(default) #endif #include #if defined(__GNUC__) && defined(DETECTED_OS_LINUX) # pragma GCC visibility pop #endif #include "MDIRenderWin.h" #include "RenderWindow.h" using namespace tuvok; MDIRenderWin::MDIRenderWin(MasterController& masterController, RenderWindow* renderWin, QWidget *parent, Qt::WindowFlags flags) : QMdiSubWindow(parent, flags) , mMasterController(masterController) , mRenderWindow(renderWin) { setWidget(renderWin->GetQtWidget()); } MDIRenderWin::~MDIRenderWin() { } void MDIRenderWin::closeEvent(QCloseEvent* event) { QMdiSubWindow::closeEvent(event); // Kill off our child widget (in this case, the render window that was // given to us). mMasterController.LuaScript()->cexec("deleteClass", mRenderWindow->GetLuaInstance()); } ImageVis3D-3.1.0/ImageVis3D/UI/MergeDlg.h0000644000175000017500000000667312320517543017345 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : MergeDlg.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : February 2009 // //! Copyright (C) 2009 SCI Institute #ifndef MERGEDLG_H #define MERGEDLG_H #include "AutoGen/ui_MergeDlg.h" #include #include #include #include "../Tuvok/Basics/Vectors.h" class MainWindow; class DataSetListElem { public: DataSetListElem(std::string strFilename) : m_strFilename(strFilename), m_strDisplayName(strFilename), /// \TODO: maybe come up with something "nicer" for display m_bAnalyzed(false), m_fScale(1.0), m_fBias(0.0), m_vDomainSize(0,0,0), m_vAspect(0,0,0), m_iComponentSize(0), m_iValueType(-1) { } std::string m_strFilename; std::string m_strDisplayName; bool m_bAnalyzed; double m_fScale; double m_fBias; UINT64VECTOR3 m_vDomainSize; FLOATVECTOR3 m_vAspect; uint64_t m_iComponentSize; int m_iValueType; std::pair m_fRange; std::pair m_iRange; std::pair m_uiRange; }; class MergeDlg : public QDialog, protected Ui_MergeDlg { Q_OBJECT public: MergeDlg(MainWindow* parent, Qt::WindowFlags flags = Qt::Tool); virtual ~MergeDlg(); std::vector m_vDataSetList; bool UseMax() const { return radioButton_max->isChecked(); } bool UseCustomExpr() const { return grpCustomExpressionMode->isChecked(); } std::string GetCustomExpr() const { return txtExpression->text().toStdString(); } protected slots: void AnalyzeCurrentDataset(); void ChangedActiveDataset(); void AddDataset(); void RemoveDataset(); void ExecuteMerge(); void CancelMerge(); void ChangedScale(double fScale); void ChangedBias(double fBias); void ToggleDefaultMergeSet(bool bChecked); void ToggleCustomMergeSet(bool bChecked); private: MainWindow* m_pMainWindow; void UpadeListView(); void setupUi(); void IsDatasetSelected(bool bIsDatasetsSelected); void UpdateValueFields(); }; #endif // MERGEDLG_H ImageVis3D-3.1.0/ImageVis3D/UI/DatasetServerDialog.h0000644000175000017500000000523212320517543021541 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : DatasetServerDialog.h //! Author : Jens Krueger //! DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : March 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #pragma once #ifndef DATASETSERVERDIALOG_H #define DATASETSERVERDIALOG_H #include QT_BEGIN_NAMESPACE class QLineEdit; class QLabel; class QPushButton; class QTcpServer; class QListWidget; class QToolButton; QT_END_NAMESPACE #include #include #include class DatasetServerDialog : public QDialog { Q_OBJECT public: DatasetServerDialog(std::string strTempDir, QWidget *parent = 0); ~DatasetServerDialog(); private slots: void toggleServers(); void addDataset(); void removeDataset(); void select1DTFile(); void selectVolFile(); private: QListWidget* datasetList; QLabel *statusLabel; QPushButton *startButton; QPushButton *quitButton; QLabel *labelPort; QLabel *labelVolFile; QLabel *label1DTFile; QLineEdit *editPort; QLineEdit *editVolFile; QLineEdit *edit1DTFile; QPushButton *addButton; QPushButton *removeButton; QToolButton *pickVolFile; QToolButton *pick1DTFile; std::vector< DatasetTFPair > aDatasets; std::string m_strTempDir; bool m_bRunning; DatasetServer server; void updateListWidgetAndButtons(); void startServers(); void stopServers(); }; #endif //DATASETSERVERDIALOG_H ImageVis3D-3.1.0/ImageVis3D/UI/SettingsDlg.cpp0000644000175000017500000007321212320517543020432 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : SettingsDlg.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : October 2008 // //! Copyright (C) 2008 SCI Institute #include "../Tuvok/StdTuvokDefines.h" #include "../Tuvok/Basics/MathTools.h" #include "SettingsDlg.h" #include #include #include "../Tuvok/Basics/SysTools.h" #include "../Tuvok/Basics/SystemInfo.h" #include #include using namespace std; SettingsDlg::SettingsDlg(bool bWarnAPIChange, MasterController& MasterController, QWidget* parent /* = 0 */, Qt::WindowFlags flags /* = 0 */) : QDialog(parent, flags), m_MasterController(MasterController), m_bInit(true), m_InitialGPUMemMax(0), m_bWarnAPIChange(bWarnAPIChange), m_bBasic(false) { setupUi(this); } SettingsDlg::~SettingsDlg(void) { } void SettingsDlg::setupUi(QDialog *SettingsDlg) { Ui_SettingsDlg::setupUi(SettingsDlg); frame_ignoreMax->setVisible(false); uint64_t iMaxCPUMemSize = m_MasterController.SysInfo()->GetCPUMemSize(); uint64_t iMaxGPUMemSize = m_MasterController.SysInfo()->GetGPUMemSize(); unsigned int iProcCount = m_MasterController.SysInfo()->GetNumberOfCPUs(); unsigned int iBitWidth = m_MasterController.SysInfo()->GetProgramBitWidth(); label_Warning32Bit->setVisible(iBitWidth == 32); // init stats labels QString desc; if (m_MasterController.SysInfo()->IsCPUSizeComputed()) desc = tr("CPU Mem: %1 MB (%2 bytes)").arg(iMaxCPUMemSize/(1024*1024)).arg(iMaxCPUMemSize); else desc = tr("CPU Mem: unchecked"); label_CPUMem->setText(desc); if (m_MasterController.SysInfo()->IsGPUSizeComputed()) desc = tr("GPU Mem: %1 MB (%2 bytes)").arg(iMaxGPUMemSize/(1024*1024)).arg(iMaxGPUMemSize); else desc = tr("GPU Mem: unchecked"); label_GPUMem->setText(desc); if (m_MasterController.SysInfo()->IsNumberOfCPUsComputed()) desc = tr("Processors %1").arg(iProcCount); else desc = tr("Processors: unchecked"); label_NumProc->setText(desc); desc = tr("Running in %1 bit mode").arg(iBitWidth); label_NumBits->setText(desc); unsigned int iMaxCPUMB=static_cast(iMaxCPUMemSize/(1024*1024)); unsigned int iMaxGPUMB=static_cast(iMaxGPUMemSize/(1024*1024)); MaxToSliders(iMaxCPUMB, iMaxGPUMB); // init mem sliders horizontalSlider_GPUMem->setMinimum(32); horizontalSlider_CPUMem->setMinimum(512); ToggleExperimentalFeatures(); } void SettingsDlg::MaxToSliders(unsigned int iMaxCPUMB, unsigned int iMaxGPUMB) { horizontalSlider_CPUMem->setMaximum(iMaxCPUMB); if (!m_MasterController.SysInfo()->IsCPUSizeComputed()) { horizontalSlider_CPUMem->setValue(1024); // choose one gig as default in core size if the max size is not-computed the default } else { horizontalSlider_CPUMem->setValue(int(iMaxCPUMB*0.8f)); } // on a 32bit system allow only a maximum of 2 gig to be adressed if (m_MasterController.SysInfo()->GetProgramBitWidth() == 32) horizontalSlider_CPUMem->setMaximum(min(horizontalSlider_CPUMem->maximum(), 2048)); horizontalSlider_GPUMem->setMaximum(iMaxGPUMB); m_InitialGPUMemMax = iMaxGPUMB; if (!m_MasterController.SysInfo()->IsGPUSizeComputed()) { horizontalSlider_GPUMem->setValue(512); // choose 512 meg as default in core size if the max size is not-computed the default } else { horizontalSlider_GPUMem->setValue(int(iMaxGPUMB*0.8f)); } } bool SettingsDlg::OverrideMaxMem() const { return checkBox_OverrideMax->isChecked(); } unsigned int SettingsDlg::GetMaxGPUMem() const { return checkBox_OverrideMax->isChecked() ? spinBox_GPUMax->value() : 0; } unsigned int SettingsDlg::GetMaxCPUMem() const { return checkBox_OverrideMax->isChecked() ? spinBox_CPUMax->value() : 0; } uint64_t SettingsDlg::GetGPUMem() const { return uint64_t(horizontalSlider_GPUMem->value())*1024*1024; } uint64_t SettingsDlg::GetCPUMem() const { return uint64_t(horizontalSlider_CPUMem->value())*1024*1024; } std::string SettingsDlg::GetTempDir() const { return std::string(lineEdit_TempDir->text().toAscii()); } bool SettingsDlg::GetQuickopen() const { return checkBoxQuickload->checkState() == Qt::Checked; } unsigned int SettingsDlg::GetMinFramerate() const { return (unsigned int)(horizontalSlider_MinFramerate->value()); } bool SettingsDlg::GetUseAllMeans() const { return checkBox_useAllMeans->checkState() == Qt::Checked; } unsigned int SettingsDlg::GetLODDelay() const { return (unsigned int)(horizontalSlider_LODDelay->value()); } unsigned int SettingsDlg::GetActiveTS() const { return (unsigned int)(horizontalSlider_ActTS->value()); } unsigned int SettingsDlg::GetInactiveTS() const { return (unsigned int)(horizontalSlider_InactTS->value()); } bool SettingsDlg::GetShowVersionInTitle() const { return checkBox_ShowVersionInTitle->isChecked(); } bool SettingsDlg::GetAutoSaveGEO() const { return checkBox_SaveGEOOnExit->isChecked(); } bool SettingsDlg::GetAutoSaveWSP() const { return checkBox_SaveWSPOnExit->isChecked(); } bool SettingsDlg::GetAutoLockClonedWindow() const { return checkBox_AutoLockClonedWindow->isChecked(); } bool SettingsDlg::GetAbsoluteViewLocks() const { return checkBox_AbsoluteViewLocks->isChecked(); } bool SettingsDlg::GetCheckForUpdatesOnStartUp() const { return checkBox_CheckForUpdatesOnStartUp->isChecked(); } bool SettingsDlg::GetCheckForDevBuilds() const { return checkBox_CheckForDevBuilds->isChecked(); } bool SettingsDlg::GetShowWelcomeScreen() const { return checkBox_ShowWelcomeScreen->isChecked(); } bool SettingsDlg::GetInvertWheel() const { return checkBox_InvWheel->isChecked(); } bool SettingsDlg::GetI3MFeatures() const { return checkBox_I3MFeatures->isChecked(); } bool SettingsDlg::GetExperimentalFeatures() const { return checkBox_ExperimentalFeatures->isChecked(); } FLOATVECTOR3 SettingsDlg::GetBackgroundColor1() const { return FLOATVECTOR3(m_cBackColor1.red()/255.0f, m_cBackColor1.green()/255.0f, m_cBackColor1.blue()/255.0f); } FLOATVECTOR3 SettingsDlg::GetBackgroundColor2() const { return FLOATVECTOR3(m_cBackColor2.red()/255.0f, m_cBackColor2.green()/255.0f, m_cBackColor2.blue()/255.0f); } FLOATVECTOR4 SettingsDlg::GetTextColor() const { return FLOATVECTOR4(m_cTextColor.red()/255.0f, m_cTextColor.green()/255.0f, m_cTextColor.blue()/255.0f, m_cTextColor.alpha()/255.0f); } unsigned int SettingsDlg::GetBlendPrecisionMode() const { if (radioButton_Prec32Bit->isChecked()) return 2; else if (radioButton_Prec16Bit->isChecked()) return 1; else return 0; } void SettingsDlg::SelectTextColor() { QColor color = QColorDialog::getColor(m_cTextColor, this); if (color.isValid()) { m_cTextColor = color; QString strStyle = tr("QPushButton { background: rgb(%1, %2, %3); color: rgb(%4, %5, %6) }").arg(m_cTextColor.red()) .arg(m_cTextColor.green()) .arg(m_cTextColor.blue()) .arg(255-m_cTextColor.red()) .arg(255-m_cTextColor.green()) .arg(255-m_cTextColor.blue()); pushButtonSelText->setStyleSheet( strStyle ); } } void SettingsDlg::SetTextOpacity(int iOpacity) { m_cTextColor.setAlpha(iOpacity); } void SettingsDlg::SelectBackColor1() { QColor color = QColorDialog::getColor(m_cBackColor1, this); if (color.isValid()) { m_cBackColor1 = color; QString strStyle = tr("QPushButton { background: rgb(%1, %2, %3); color: rgb(%4, %5, %6) }").arg(m_cBackColor1.red()) .arg(m_cBackColor1.green()) .arg(m_cBackColor1.blue()) .arg(255-m_cBackColor1.red()) .arg(255-m_cBackColor1.green()) .arg(255-m_cBackColor1.blue()); pushButtonSelBack1->setStyleSheet( strStyle ); } } void SettingsDlg::SelectBackColor2() { QColor color = QColorDialog::getColor(m_cBackColor2, this); if (color.isValid()) { m_cBackColor2 = color; QString strStyle = tr("QPushButton { background: rgb(%1, %2, %3); color: rgb(%4, %5, %6) }").arg(m_cBackColor2.red()) .arg(m_cBackColor2.green()) .arg(m_cBackColor2.blue()) .arg(255-m_cBackColor2.red()) .arg(255-m_cBackColor2.green()) .arg(255-m_cBackColor2.blue()); pushButtonSelBack2->setStyleSheet( strStyle ); } } // make sure the user cannot select more GPU than CPU mem void SettingsDlg::SetMaxMemCheck() { if (checkBox_OverrideMax->isChecked()) return; if (horizontalSlider_GPUMem->value() > horizontalSlider_CPUMem->value()) { horizontalSlider_GPUMem->setValue(horizontalSlider_CPUMem->value()); } horizontalSlider_GPUMem->setMaximum(min(horizontalSlider_CPUMem->value(),m_InitialGPUMemMax) ); } void SettingsDlg::LODDelayChanged() { QString text= tr("%1 ms").arg(horizontalSlider_LODDelay->value()); label_LODDelayDisplay->setText(text); } void SettingsDlg::MinFramerateChanged() { if (horizontalSlider_MinFramerate->value() > 0) { QString text= tr("%1 fps").arg(horizontalSlider_MinFramerate->value()); label_MinFrameRateDisplay->setText(text); } else { label_MinFrameRateDisplay->setText(tr("< 1 fps")); } } void SettingsDlg::ActTSChanged() { QString text= tr("%1 ms").arg(horizontalSlider_ActTS->value()); label_ActTSDisplay->setText(text); } void SettingsDlg::InactTSChanged() { QString text= tr("%1 ms").arg(horizontalSlider_InactTS->value()); label_InactTSDisplay->setText(text); } void SettingsDlg::SetLogoLabel() { if (m_strLogoFilename.isEmpty()) { label_LogoFile->setText("No logo selected"); } else { if (SysTools::FileExists(string(m_strLogoFilename.toAscii())) ) { label_LogoFile->setText(m_strLogoFilename); } else { label_LogoFile->setText(m_strLogoFilename + " [File not found]"); } } } void SettingsDlg::Data2Form(bool bIsDirectX10Capable, uint64_t iMaxCPU, uint64_t iMaxGPU, bool bIgnoreMax, unsigned int iUserMaxCPUMB, unsigned int iUserMaxGPUMB, const std::string& tempDir, bool bQuickopen, unsigned int iMinFramerate, bool bRenderLowResIntermediateResults, unsigned int iLODDelay, unsigned int iActiveTS, unsigned int iInactiveTS, bool bWriteLogFile, bool bShowCrashDialog, const std::string& strLogFileName, uint32_t iLogLevel, bool bShowVersionInTitle, bool bAutoSaveGEO, bool bAutoSaveWSP, bool bAutoLockClonedWindow, bool bAbsoluteViewLocks, bool bCheckForUpdatesOnStartUp, bool bCheckForDevBuilds, bool bShowWelcomeScreen, bool bInvWheel, bool bI3MFeatures, unsigned int iVolRenType, unsigned int iBlendPrecision, bool bPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder, const FLOATVECTOR3& vBackColor1, const FLOATVECTOR3& vBackColor2, const FLOATVECTOR4& vTextColor, const QString& strLogo, int iLogoPos, unsigned int iMaxBrickSize, unsigned int iBuilderBrickSize, unsigned int iMaxMaxBrickSize, bool bMedianFilter, bool bClampToEdge, uint32_t iCompression, uint32_t iCompressionLevel, bool expFeatures, uint32_t iLayout) { m_bInit = true; checkBox_OverrideMax->setChecked(bIgnoreMax); if (bIgnoreMax) { spinBox_CPUMax->setValue(iUserMaxCPUMB); spinBox_GPUMax->setValue(iUserMaxGPUMB); } else { spinBox_CPUMax->setValue(horizontalSlider_CPUMem->maximum()); spinBox_GPUMax->setValue(horizontalSlider_GPUMem->maximum()); } horizontalSlider_CPUMem->setValue(iMaxCPU / (1024*1024)); horizontalSlider_GPUMem->setValue(iMaxGPU / (1024*1024)); lineEdit_TempDir->setText(tempDir.c_str()); horizontalSlider_BSMax->setMaximum(iMaxMaxBrickSize); horizontalSlider_BSMax->setValue(iMaxBrickSize); MaxBSChanged(iMaxBrickSize); horizontalSlider_BSBuilder->setMaximum(iMaxMaxBrickSize); horizontalSlider_BSBuilder->setValue(iBuilderBrickSize); BuilderBSChanged(iBuilderBrickSize); radioButton_Mean->setChecked(!bMedianFilter); radioButton_Median->setChecked(bMedianFilter); radioButton_Border0->setChecked(!bClampToEdge); radioButton_BorderClamp->setChecked(bClampToEdge); radioButton_noCompression->setChecked(false); radioButton_zlibCompression->setChecked(false); radioButton_lzmaCompression->setChecked(false); radioButton_lz4Compression->setChecked(false); radioButton_bzlibCompression->setChecked(false); radioButton_lzhamCompression->setChecked(false); switch (iCompression) { default : radioButton_noCompression->setChecked(true); break; case 1 : radioButton_zlibCompression->setChecked(true); break; case 2 : radioButton_lzmaCompression->setChecked(true); break; case 3 : radioButton_lz4Compression->setChecked(true); break; case 4 : radioButton_bzlibCompression->setChecked(true); break; case 5 : radioButton_lzhamCompression->setChecked(true); break; } CompressionLevelChanged(iCompressionLevel); CompressionChanged(); radioButton_scanlineLayout->setChecked(false); radioButton_mortonLayout->setChecked(false); radioButton_hilbertLayout->setChecked(false); radioButton_randomLayout->setChecked(false); switch (iLayout) { default : radioButton_scanlineLayout->setChecked(true); break; case 1 : radioButton_mortonLayout->setChecked(true); break; case 2 : radioButton_hilbertLayout->setChecked(true); break; case 3 : radioButton_randomLayout->setChecked(true); break; } checkBoxQuickload->setChecked(bQuickopen); horizontalSlider_MinFramerate->setValue(iMinFramerate); checkBox_useAllMeans->setChecked(bRenderLowResIntermediateResults); horizontalSlider_LODDelay->setValue(iLODDelay); horizontalSlider_ActTS->setValue(iActiveTS); horizontalSlider_InactTS->setValue(iInactiveTS); checkBox_WriteLogfile->setChecked(bWriteLogFile); checkBox_ShowCrashDialog->setChecked(bShowCrashDialog); lineEdit_filename->setText(strLogFileName.c_str()); horizontalSlider_loglevel->setValue(iLogLevel); checkBox_ShowVersionInTitle->setChecked(bShowVersionInTitle); checkBox_SaveGEOOnExit->setChecked(bAutoSaveGEO); checkBox_SaveWSPOnExit->setChecked(bAutoSaveWSP); checkBox_AutoLockClonedWindow->setChecked(bAutoLockClonedWindow); checkBox_AbsoluteViewLocks->setChecked(bAbsoluteViewLocks); checkBox_CheckForUpdatesOnStartUp->setChecked(bCheckForUpdatesOnStartUp); checkBox_CheckForDevBuilds->setChecked(bCheckForDevBuilds); checkBox_ShowWelcomeScreen->setChecked(bShowWelcomeScreen); checkBox_InvWheel->setChecked(bInvWheel); checkBox_I3MFeatures->setChecked(bI3MFeatures); checkBox_ExperimentalFeatures->setChecked(expFeatures); m_cBackColor1 = QColor(int(vBackColor1.x*255), int(vBackColor1.y*255), int(vBackColor1.z*255)); m_cBackColor2 = QColor(int(vBackColor2.x*255), int(vBackColor2.y*255), int(vBackColor2.z*255)); m_cTextColor = QColor(int(vTextColor.x*255), int(vTextColor.y*255), int(vTextColor.z*255), int(vTextColor.w*255)); switch (iBlendPrecision) { case 2 : radioButton_Prec32Bit->setChecked(true); break; case 1 : radioButton_Prec16Bit->setChecked(true); break; default : radioButton_Prec8Bit->setChecked(true); break; } radioButton_APIDX->setEnabled(bIsDirectX10Capable); // adjust rendermode to GL if no DX support is present but set if (!bIsDirectX10Capable) { if (iVolRenType == 2) iVolRenType = 0; else if (iVolRenType == 3) iVolRenType = 1; else if (iVolRenType == 5) iVolRenType = 4; } switch (iVolRenType) { case 0 : radioButton_APIGL->setChecked(true); radioButton_SBVR->setChecked(true); break; case 1 : radioButton_APIGL->setChecked(true); radioButton_Raycast->setChecked(true); break; case 2 : radioButton_APIDX->setChecked(true); radioButton_SBVR->setChecked(true); break; case 3 : radioButton_APIDX->setChecked(true); radioButton_Raycast->setChecked(true); break; case 4 : radioButton_APIGL->setChecked(true); radioButton_SBVR2D->setChecked(true); break; case 5 : radioButton_APIDX->setChecked(true); radioButton_SBVR2D->setChecked(true); break; case 6 : radioButton_APIGL->setChecked(true); radioButton_TRaycast->setChecked(true); break; default : radioButton_APIDX->setChecked(true); radioButton_TRaycast->setChecked(true); break; } switch (iLogoPos) { case 0 : radioButton_logoTL->setChecked(true); break; case 1 : radioButton_logoTR->setChecked(true); break; case 2 : radioButton_logoBL->setChecked(true); break; default : radioButton_logoBR->setChecked(true); break; } m_strLogoFilename = strLogo.toAscii(); SetLogoLabel(); checkBox_PowerOfTwo->setChecked(bPowerOfTwo); checkBox_DisableBorder->setChecked(bDisableBorder); checkBox_DownSampleTo8Bits->setChecked(bDownSampleTo8Bits); QString strStyle = tr("QPushButton { background: rgb(%1, %2, %3); color: rgb(%4, %5, %6) }").arg(m_cBackColor1.red()) .arg(m_cBackColor1.green()) .arg(m_cBackColor1.blue()) .arg(255-m_cBackColor1.red()) .arg(255-m_cBackColor1.green()) .arg(255-m_cBackColor1.blue()); pushButtonSelBack1->setStyleSheet( strStyle ); strStyle = tr("QPushButton { background: rgb(%1, %2, %3); color: rgb(%4, %5, %6) }").arg(m_cBackColor2.red()) .arg(m_cBackColor2.green()) .arg(m_cBackColor2.blue()) .arg(255-m_cBackColor2.red()) .arg(255-m_cBackColor2.green()) .arg(255-m_cBackColor2.blue()); pushButtonSelBack2->setStyleSheet( strStyle ); strStyle = tr("QPushButton { background: rgb(%1, %2, %3); color: rgb(%4, %5, %6) }").arg(m_cTextColor.red()) .arg(m_cTextColor.green()) .arg(m_cTextColor.blue()) .arg(255-m_cTextColor.red()) .arg(255-m_cTextColor.green()) .arg(255-m_cTextColor.blue()); pushButtonSelText->setStyleSheet( strStyle ); m_bInit = false; } bool SettingsDlg::GetWriteLogFile() const { return checkBox_WriteLogfile->isChecked(); } bool SettingsDlg::GetShowCrashDialog() const { return checkBox_ShowCrashDialog->isChecked(); } const string SettingsDlg::GetLogFileName() const { return string(lineEdit_filename->text().toAscii()); } uint32_t SettingsDlg::GetLogLevel() const { return horizontalSlider_loglevel->value(); } void SettingsDlg::WarnAPIMethodChange() { if (m_bWarnAPIChange && !m_bInit) { QMessageBox::warning(this, "Warning", "A change to the render API, the rendermode, or the compatibility settings only affects new render windows."); m_bWarnAPIChange = false; } } bool SettingsDlg::GetMedianFilter() const { return radioButton_Median->isChecked(); } bool SettingsDlg::GetClampToEdge() const { return radioButton_BorderClamp->isChecked(); } uint32_t SettingsDlg::GetCompression() const { if (radioButton_noCompression->isChecked()) { return 0; } else if (radioButton_zlibCompression->isChecked()) { return 1; } else if (radioButton_lzmaCompression->isChecked()) { return 2; } else if (radioButton_lz4Compression->isChecked()) { return 3; } else if (radioButton_bzlibCompression->isChecked()) { return 4; } else if (radioButton_lzhamCompression->isChecked()) { return 5; } else { return 1; // default value } } uint32_t SettingsDlg::GetLayout() const { if (radioButton_scanlineLayout->isChecked()) { return 0; } else if (radioButton_mortonLayout->isChecked()) { return 1; } else if (radioButton_hilbertLayout->isChecked()) { return 2; } else if (radioButton_randomLayout->isChecked()) { return 3; } else { return 0; // default value } } bool SettingsDlg::GetUseBasicSettings() const { return m_bBasic; } unsigned int SettingsDlg::GetVolrenType() const { if (radioButton_APIGL->isChecked()) { if (radioButton_SBVR->isChecked()) return 0; if (radioButton_SBVR2D->isChecked()) return 4; if (radioButton_TRaycast->isChecked()) return 6; else return 1; } else { if (radioButton_SBVR->isChecked()) return 2; if (radioButton_SBVR2D->isChecked()) return 6; else return 3; } } bool SettingsDlg::GetUseOnlyPowerOfTwo() const { return checkBox_PowerOfTwo->isChecked(); } bool SettingsDlg::GetDownSampleTo8Bits() const { return checkBox_DownSampleTo8Bits->isChecked(); } bool SettingsDlg::GetDisableBorder() const { return checkBox_DisableBorder->isChecked(); } QString SettingsDlg::GetLogoFilename() const { return m_strLogoFilename; } int SettingsDlg::GetLogoPos() const { if (radioButton_logoTL->isChecked()) return 0; if (radioButton_logoTR->isChecked()) return 1; if (radioButton_logoBL->isChecked()) return 2; return 3; } void SettingsDlg::MaxBSChanged(int iValue) { QString str = tr("%1^3").arg(MathTools::Pow2(uint32_t(iValue))); if (iValue < horizontalSlider_BSBuilder->value()) { horizontalSlider_BSBuilder->setValue(iValue); BuilderBSChanged(iValue); } label_BSMaxUnit->setText(str); } void SettingsDlg::BuilderBSChanged(int iValue) { QString str = tr("%1^3").arg(MathTools::Pow2(uint32_t(iValue))); if (horizontalSlider_BSMax->value() < iValue) { horizontalSlider_BSMax->setValue(iValue); MaxBSChanged(iValue); } label_BSBuilderUnit->setText(str); } unsigned int SettingsDlg::GetMaxBrickSize() const { return horizontalSlider_BSMax->value(); } unsigned int SettingsDlg::GetBuilderBrickSize() const { return horizontalSlider_BSBuilder->value(); } void SettingsDlg::CompressionLevelChanged(int iValue) { QString str; switch (iValue) { case 1: str = tr("Fastest"); break; case 2: str = tr("Very Fast"); break; case 3: str = tr("Fast"); break; case 4: str = tr("Quite Fast"); break; case 5: str = tr("Normal"); break; case 6: str = tr("Quite Strong"); break; case 7: str = tr("Strong"); break; case 8: str = tr("Very Strong"); break; case 9: str = tr("Strongest"); break; case 10: str = tr("Ultra"); break; } str.append(tr(" (%1)").arg(uint32_t(iValue))); if (horizontalSlider_CompressionLevel->value() != iValue) horizontalSlider_CompressionLevel->setValue(iValue); label_CompressionLevelUnit->setText(str); } void SettingsDlg::CompressionChanged() { frame_CompressionLevel->setEnabled(!radioButton_noCompression->isChecked()); } uint32_t SettingsDlg::GetCompressionLevel() const { return horizontalSlider_CompressionLevel->value(); } void SettingsDlg::PickLogFile() { QSettings settings; QString strLastDir = settings.value("Folders/LogFile", ".").toString(); QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString selectedFilter; QString fileName = QFileDialog::getSaveFileName(this, "Select Logfile", strLastDir, "All Files (*.*)",&selectedFilter, options); if (!fileName.isEmpty()) { QDir qdir(QDir::current()); QString strRelFilename = qdir.relativeFilePath(fileName); if (!strRelFilename.contains("..")) fileName = strRelFilename; settings.setValue("Folders/LogFile", QFileInfo(fileName).absoluteDir().path()); lineEdit_filename->setText(fileName); } } void SettingsDlg::SelectLogo() { QSettings settings; QString strLastDir = settings.value("Folders/LogoLoad", ".").toString(); QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString selectedFilter; QString fileName = QFileDialog::getOpenFileName(this, "Select Logo", strLastDir, "All Files (*.*)",&selectedFilter, options); if (!fileName.isEmpty()) { QDir qdir(QDir::current()); QString strRelFilename = qdir.relativeFilePath(fileName); if (!strRelFilename.contains("..")) fileName = strRelFilename; settings.setValue("Folders/LogoLoad", QFileInfo(fileName).absoluteDir().path()); m_strLogoFilename = fileName; } SetLogoLabel(); } void SettingsDlg::RemoveLogo() { m_strLogoFilename = ""; SetLogoLabel(); } void SettingsDlg::SelectTempDir() { QString directoryName = QFileDialog::getExistingDirectory(this, "Select directory for temporary files",lineEdit_TempDir->text()); if (!directoryName.isEmpty()) { if (directoryName[directoryName.size()-1] != '/' && directoryName[directoryName.size()-1] != '\\') directoryName = directoryName+'/'; lineEdit_TempDir->setText(directoryName); } } void SettingsDlg::MemMaxChanged() { if (checkBox_OverrideMax->isChecked()) { horizontalSlider_CPUMem->setMaximum(spinBox_CPUMax->value()); horizontalSlider_GPUMem->setMaximum(spinBox_GPUMax->value()); } } void SettingsDlg::OverrideMaxToggled(bool bOverride) { if (bOverride) { horizontalSlider_CPUMem->setMaximum(spinBox_CPUMax->value()); horizontalSlider_GPUMem->setMaximum(spinBox_GPUMax->value()); } else { uint64_t iMaxCPUMemSize = m_MasterController.SysInfo()->GetCPUMemSize(); uint64_t iMaxGPUMemSize = m_MasterController.SysInfo()->GetGPUMemSize(); MaxToSliders(iMaxCPUMemSize/(1024*1024), iMaxGPUMemSize/(1024*1024)); } } void SettingsDlg::ToggleExperimentalFeatures() { #if defined(_WIN32) && defined(USE_DIRECTX) if(GetExperimentalFeatures()) { groupBox_7->setVisible(true); } else { groupBox_7->setVisible(false); radioButton_APIGL->setChecked(true); } #else groupBox_7->setVisible(false); radioButton_APIGL->setChecked(true); #endif if(GetExperimentalFeatures()) { radioButton_TRaycast->setVisible(true); groupBox_Filter->setVisible(true); } else { radioButton_TRaycast->setVisible(false); groupBox_Filter->setVisible(false); if (radioButton_TRaycast->isChecked()) radioButton_Raycast->setChecked(true); } } void SettingsDlg::SwitchToBasic() { m_bBasic = true; this->reject(); } ImageVis3D-3.1.0/ImageVis3D/UI/DatasetServerDialog.cpp0000644000175000017500000002340712320517543022100 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : DatasetServerDialog.cpp //! Author : Jens Krueger //! DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : March 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #include #include #if defined(__GNUC__) && defined(DETECTED_OS_LINUX) # pragma GCC visibility push(default) #endif #include #include #if defined(__GNUC__) && defined(DETECTED_OS_LINUX) # pragma GCC visibility pop #endif #include "DatasetServerDialog.h" #include "../Tuvok/Basics/SysTools.h" using namespace std; DatasetServerDialog::DatasetServerDialog(std::string strTempDir, QWidget *parent) : QDialog(parent), m_strTempDir(strTempDir), m_bRunning(false), server(strTempDir) { QSettings settings; settings.beginGroup("DatasetServer"); aDatasets.resize( settings.value("DatasetCount", 0).toUInt() ); datasetList = new QListWidget(this); for (size_t b = 0;b< aDatasets.size();b++) { QString volume = tr("Volume%1").arg(b); QString transferfunction = tr("TransferFunction%1").arg(b); std::string strFilename(settings.value(volume, "").toString().toAscii()); std::string strTFFilename(settings.value(transferfunction, "").toString().toAscii()); aDatasets[b] = DatasetTFPair(strFilename, strTFFilename); } labelPort = new QLabel(this); labelPort->setText("TCP/IP Port"); labelVolFile = new QLabel(this); labelVolFile->setText("Dataset"); label1DTFile = new QLabel(this); label1DTFile->setText("Transfer Function"); editPort = new QLineEdit(this); editPort->setText(settings.value("StartPort",22).toString()); editVolFile = new QLineEdit(this); editVolFile->setReadOnly(true); editVolFile->setText(""); edit1DTFile = new QLineEdit(this); edit1DTFile->setReadOnly(true); edit1DTFile->setText(""); pickVolFile = new QToolButton(this); pickVolFile->setText("..."); pick1DTFile = new QToolButton(this); pick1DTFile->setText("..."); connect(pickVolFile, SIGNAL(clicked()), this, SLOT(selectVolFile())); connect(pick1DTFile, SIGNAL(clicked()), this, SLOT(select1DTFile())); addButton = new QPushButton(tr("Add To List"),this); removeButton = new QPushButton(tr("Remove From List"),this); connect(addButton, SIGNAL(clicked()), this, SLOT(addDataset())); connect(removeButton, SIGNAL(clicked()), this, SLOT(removeDataset())); statusLabel = new QLabel("",this); startButton = new QPushButton(tr("Start"),this); startButton->setAutoDefault(true); quitButton = new QPushButton(tr("Close"),this); quitButton->setAutoDefault(false); connect(quitButton, SIGNAL(clicked()), this, SLOT(close())); connect(startButton, SIGNAL(clicked()), this, SLOT(toggleServers())); QHBoxLayout *layoutPort = new QHBoxLayout(); layoutPort->setMargin(0); layoutPort->addWidget(labelPort); layoutPort->addWidget(editPort); QHBoxLayout *layoutI3MFile = new QHBoxLayout(); layoutI3MFile->setMargin(0); layoutI3MFile->addWidget(labelVolFile); layoutI3MFile->addWidget(editVolFile); layoutI3MFile->addWidget(pickVolFile); QHBoxLayout *layoutAddRemove = new QHBoxLayout(); layoutAddRemove->setMargin(0); layoutAddRemove->addWidget(addButton); layoutAddRemove->addWidget(removeButton); QHBoxLayout *layout1DTFile = new QHBoxLayout(); layout1DTFile->setMargin(0); layout1DTFile->addWidget(label1DTFile); layout1DTFile->addWidget(edit1DTFile); layout1DTFile->addWidget(pick1DTFile); QHBoxLayout *buttonLayout = new QHBoxLayout(); buttonLayout->addStretch(1); buttonLayout->addWidget(startButton); buttonLayout->addWidget(quitButton); buttonLayout->addStretch(1); QVBoxLayout *mainLayout = new QVBoxLayout(); mainLayout->addLayout(layoutI3MFile); mainLayout->addLayout(layout1DTFile); mainLayout->addLayout(layoutAddRemove); mainLayout->addWidget(datasetList); mainLayout->addLayout(layoutPort); mainLayout->addWidget(statusLabel); mainLayout->addLayout(buttonLayout); setLayout(mainLayout); setWindowTitle(tr("ImageVis3D Mobile Dataset Server")); settings.endGroup(); updateListWidgetAndButtons(); } DatasetServerDialog::~DatasetServerDialog() { QSettings settings; settings.beginGroup("DatasetServer"); settings.setValue("StartPort", editPort->text().toInt()); settings.setValue("DatasetCount", static_cast(aDatasets.size())); for (size_t b = 0;b< aDatasets.size();b++) { QString volume = tr("Volume%1").arg(b); QString transferfunction = tr("TransferFunction%1").arg(b); settings.setValue(volume, aDatasets[b].dataset.c_str()); settings.setValue(transferfunction, aDatasets[b].transferfunction.c_str()); } settings.endGroup(); } void DatasetServerDialog::startServers() { // no servers ... nothing todo if(aDatasets.empty()) { return; } int port = editPort->text().toInt(); QString errorMsg = server.startServers(aDatasets, port); if (errorMsg != "") { QMessageBox::critical(this, this->windowTitle(),errorMsg); return; } if (aDatasets.size() > 1) statusLabel->setText(tr("Sharing %1 datasets on port %2.\n" "Run the iPhone App now.") .arg(aDatasets.size()).arg(port) ); else statusLabel->setText(tr("Sharing %1 dataset on port %2.\n" "Run the iPhone App now.") .arg(aDatasets.size()).arg(port) ); startButton->setText(tr("Stop")); m_bRunning = true; } void DatasetServerDialog::stopServers() { if (!m_bRunning) return; server.stopServers(); startButton->setText(tr("Restart")); statusLabel->setText(tr("")); m_bRunning = false; } void DatasetServerDialog::toggleServers() { if (m_bRunning) { stopServers(); } else { startServers(); } } void DatasetServerDialog::addDataset() { if (editVolFile->text() == "") return; std::string strFilename(editVolFile->text().toAscii()); std::string strTFFilename(edit1DTFile->text().toAscii()); aDatasets.push_back(DatasetTFPair(strFilename, strTFFilename)); updateListWidgetAndButtons(); stopServers(); } void DatasetServerDialog::removeDataset() { int index = datasetList->currentRow(); if (index >= 0 && index < int(aDatasets.size())) aDatasets.erase(aDatasets.begin()+index); updateListWidgetAndButtons(); stopServers(); } void DatasetServerDialog::updateListWidgetAndButtons() { int index = datasetList->currentRow(); datasetList->clear(); QString qstr; for (size_t i = 0;iaddItem(qstr); } if(!aDatasets.empty()) { datasetList->setCurrentRow(std::min(index, int(aDatasets.size()-1))); removeButton->setEnabled(true); startButton->setEnabled(true); } else { removeButton->setEnabled(false); startButton->setEnabled(false); } } void DatasetServerDialog::select1DTFile() { QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString selectedFilter; QSettings settings; QString strLastDir = settings.value("Folders/Server1DTFilename", ".").toString(); QString fileName = QFileDialog::getOpenFileName(this, "Select 1D Transfer function", strLastDir, "1D Transfer Functions (*.1dt)", &selectedFilter, options); if (!fileName.isEmpty()) { // add png as the default filetype if the user forgot to enter one if (SysTools::GetExt(fileName.toStdString()) == "") fileName = fileName + ".png"; settings.setValue("Folders/Server1DTFilename", QFileInfo(fileName).absoluteDir().path()); edit1DTFile->setText(fileName); } } void DatasetServerDialog::selectVolFile() { QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString selectedFilter; QSettings settings; QString strLastDir = settings.value("Folders/ServerVolFilename", ".").toString(); QString fileName = QFileDialog::getOpenFileName(this, "Select Volume", strLastDir, "All Files (*.*)", &selectedFilter, options); if (!fileName.isEmpty()) { // add png as the default filetype if the user forgot to enter one if (SysTools::GetExt(fileName.toStdString()) == "") fileName = fileName + ".png"; settings.setValue("Folders/ServerVolFilename", QFileInfo(fileName).absoluteDir().path()); editVolFile->setText(fileName); } } ImageVis3D-3.1.0/ImageVis3D/UI/URLDlg.h0000644000175000017500000000353212320517543016737 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : URLDlg.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #ifndef URLDLG_H #define URLDLG_H #include "AutoGen/ui_URLDlg.h" #include #include #include class URLDlg : public QDialog, protected Ui_URLDlg { Q_OBJECT public: URLDlg(QString title, QString desc, QString url, QWidget* parent, Qt::WindowFlags flags = Qt::Tool); virtual ~URLDlg(); protected slots: virtual void Download(); private: QString m_strURL; }; #endif // URLDLG_H ImageVis3D-3.1.0/ImageVis3D/UI/BrowseData.cpp0000644000175000017500000000623512320517543020237 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : BrowseData.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : September 2008 // //! Copyright (C) 2008 SCI Institute #include "BrowseData.h" #include #include "AutoGen/ui_SettingsDlg.h" #include "../Tuvok/LuaScripting/LuaScripting.h" using namespace std; BrowseData::BrowseData(MasterController& masterController, QDialog* pleaseWaitDialog, QString strDir, QWidget* parent, Qt::WindowFlags flags) : QDialog(parent, flags), m_MasterController(masterController), m_bDataFound(false), m_strDir(strDir), m_iSelected(0) { setupUi(this); m_bDataFound = FillTable(pleaseWaitDialog); } BrowseData::~BrowseData() { this->m_dirInfo.clear(); } void BrowseData::showEvent ( QShowEvent * ) { } void BrowseData::accept() { // find out which dataset is selected for (size_t i = 0;i < m_vRadioButtons.size();i++) { if (m_vRadioButtons[i]->isChecked()) { m_iSelected = i; break; } } QDialog::accept(); } void BrowseData::SetBrightness(int iScale) { for (size_t i = 0;i < m_vRadioButtons.size();i++) m_vRadioButtons[i]->SetBrightness(float(iScale)); } bool BrowseData::FillTable(QDialog* pleaseWaitDialog) { shared_ptr ss(m_MasterController.LuaScript()); m_dirInfo = ss->cexecRet>>( "tuvok.io.scanDirectory", m_strDir.toStdString()); m_vRadioButtons.clear(); for (size_t iStackID = 0;iStackID < m_dirInfo.size();iStackID++) { QDataRadioButton *pStackElement; pStackElement = new QDataRadioButton(m_dirInfo[iStackID],frame); pStackElement->setMinimumSize(QSize(0, 80)); pStackElement->setChecked(iStackID==0); pStackElement->setIconSize(QSize(80, 80)); verticalLayout_DICOM->addWidget(pStackElement); m_vRadioButtons.push_back(pStackElement); } if (pleaseWaitDialog != NULL) pleaseWaitDialog->close(); return !m_dirInfo.empty(); } ImageVis3D-3.1.0/ImageVis3D/UI/DebugScriptWindow.h0000644000175000017500000000536312320517543021255 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief Combination of the debug window and a new scripting window. */ #ifndef DEBUGSCRIPTWINDOW_H_ #define DEBUGSCRIPTWINDOW_H_ #include #include "../Tuvok/Controller/MasterController.h" #include "../Tuvok/LuaScripting/LuaMemberReg.h" class QVBoxLayout; class QTabWidget; class QPushButton; class QComboBox; class QTextEdit; class QLineEdit; class QListWidget; class DebugScriptWindow: public QDockWidget { Q_OBJECT public: DebugScriptWindow(tuvok::MasterController& controller, QWidget* parent); virtual ~DebugScriptWindow(); protected slots: void execClicked(); void oneLineEditOnReturnPressed(); void oneLineEditOnEdited(const QString&); void exampComboIndexChanged(int index); void fixFont(); protected: bool eventFilter(QObject *obj, QEvent *event); private: void setupUI(); void hookLuaFunctions(); void execLua(const std::string& cmd); // Lua registered function hooks. void hook_logInfo(std::string info); void hook_logWarning(std::string warn); void hook_logError(std::string error); QVBoxLayout* mMainLayout; QComboBox* mScriptExamplesBox; QPushButton* mExecButton; QListWidget* mListWidget; QTextEdit* mScriptTextEdit; QLineEdit* mScriptOneLineEdit; std::vector mSavedInput; int mSavedInputPos; tuvok::MasterController& mController; tuvok::LuaMemberReg mMemReg; std::shared_ptr mLua; bool mInFixFont; }; #endif /* DEBUGSCRIPTWINDOW_H_ */ ImageVis3D-3.1.0/ImageVis3D/UI/SettingsDlg.h0000644000175000017500000001564312320517543020103 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : SettingsDlg.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : July 2008 // //! Copyright (C) 2008 SCI Institute #ifndef SETTINGSDLG_H #define SETTINGSDLG_H #include "../Tuvok/Basics/Vectors.h" #include "../Tuvok/Controller/MasterController.h" #include "UI/AutoGen/ui_SettingsDlg.h" using namespace tuvok; class SettingsDlg : public QDialog, protected Ui_SettingsDlg { Q_OBJECT public: SettingsDlg(bool bWarnAPIChange, MasterController& masterController, QWidget* parent = 0, Qt::WindowFlags flags = 0); virtual ~SettingsDlg(); uint64_t GetGPUMem() const; uint64_t GetCPUMem() const; bool OverrideMaxMem() const; unsigned int GetMaxGPUMem() const; unsigned int GetMaxCPUMem() const; std::string GetTempDir() const; bool GetQuickopen() const; unsigned int GetMinFramerate() const; bool GetUseAllMeans() const; unsigned int GetLODDelay() const; unsigned int GetActiveTS() const; unsigned int GetInactiveTS() const; bool GetWriteLogFile() const; bool GetShowCrashDialog() const; const std::string GetLogFileName() const; uint32_t GetLogLevel() const; bool GetShowVersionInTitle() const; bool GetAutoSaveGEO() const; bool GetAutoSaveWSP() const; bool GetAutoLockClonedWindow() const; bool GetAbsoluteViewLocks() const; bool GetCheckForUpdatesOnStartUp() const; bool GetCheckForDevBuilds() const; bool GetShowWelcomeScreen() const; bool GetInvertWheel() const; bool GetI3MFeatures() const; bool GetExperimentalFeatures() const; unsigned int GetVolrenType() const; FLOATVECTOR3 GetBackgroundColor1() const; FLOATVECTOR3 GetBackgroundColor2() const; FLOATVECTOR4 GetTextColor() const; unsigned int GetBlendPrecisionMode() const; bool GetUseOnlyPowerOfTwo() const; bool GetDownSampleTo8Bits() const; bool GetDisableBorder() const; bool GetNoRCClipplanes() const; QString GetLogoFilename() const; int GetLogoPos() const; unsigned int GetMaxBrickSize() const; unsigned int GetBuilderBrickSize() const; bool GetMedianFilter() const; bool GetClampToEdge() const; uint32_t GetCompression() const; uint32_t GetCompressionLevel() const; uint32_t GetLayout() const; bool GetUseBasicSettings() const; void Data2Form(bool bIsDirectX10Capable, uint64_t iMaxCPU, uint64_t iMaxGPU, bool bIgnoreMax, unsigned int iUserMaxCPUMB, unsigned int iUserMaxGPUMB, const std::string& tempDir, bool bQuickopen, unsigned int iMinFramerate, bool bRenderLowResIntermediateResults, unsigned int iLODDelay, unsigned int iActiveTS, unsigned int iInactiveTS, bool bWriteLogFile, bool bShowCrashDialog, const std::string& strLogFileName, uint32_t iLogLevel, bool bShowVersionInTitle, bool bAutoSaveGEO, bool bAutoSaveWSP, bool bAutoLockClonedWindow, bool bAbsoluteViewLocks, bool bCheckForUpdatesOnStartUp, bool bCheckForDevBuilds, bool bShowWelcomeScreen, bool bInvWheel, bool bI3MFeatures, unsigned int iVolRenType, unsigned int iBlendPrecision, bool bPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder, const FLOATVECTOR3& vBackColor1, const FLOATVECTOR3& vBackColor2, const FLOATVECTOR4& vTextColor, const QString& strLogo, int iLogoPos, unsigned int iMaxBrickSize, unsigned int iBuilderBrickSize, unsigned int iMaxMaxBrickSize, bool bMedianFilter, bool bClampToEdge, uint32_t iCompression, uint32_t iCompressionLevel, bool expFeatures, uint32_t iLayout); protected slots: void MemMaxChanged(); void OverrideMaxToggled(bool bOverride); void SelectTextColor(); void SetTextOpacity(int iOpacity); void SelectBackColor1(); void SelectBackColor2(); void SetMaxMemCheck(); void LODDelayChanged(); void MinFramerateChanged(); void ActTSChanged(); void InactTSChanged(); void WarnAPIMethodChange(); void SelectLogo(); void RemoveLogo(); void PickLogFile(); void SelectTempDir(); void MaxBSChanged(int iValue); void BuilderBSChanged(int iValue); void ToggleExperimentalFeatures(); void SwitchToBasic(); void CompressionLevelChanged(int iValue); void CompressionChanged(); private: MasterController& m_MasterController; QColor m_cBackColor1; QColor m_cBackColor2; QColor m_cTextColor; QString m_strLogoFilename; bool m_bInit; int m_InitialGPUMemMax; bool m_bWarnAPIChange; bool m_bBasic; void setupUi(QDialog *SettingsDlg); void SetLogoLabel(); void MaxToSliders(unsigned int iMaxCPUMB, unsigned int iMaxGPUMB); }; #endif // SETTINGSDLG_H ImageVis3D-3.1.0/ImageVis3D/UI/ImageVis3D_WindowHandling.cpp0000644000175000017500000015660412320517543023101 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : ImageVis3D_WindowHandling.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : July 2008 // //! Copyright (C) 2008 SCI Institute #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "../Tuvok/Controller/Controller.h" #include "../Tuvok/Basics/SysTools.h" #include "../Tuvok/LuaScripting/LuaScripting.h" #include "../Tuvok/LuaScripting/TuvokSpecific/LuaTuvokTypes.h" #include "ImageVis3D.h" #include "MDIRenderWin.h" #include "BrowseData.h" #include "RenderWindowGL.h" #include "RenderWindowDX.h" #include "../Tuvok/Renderer/RenderMesh.h" #include "ScaleAndBiasDlg.h" #include "PleaseWait.h" using namespace std; void MainWindow::dragEnterEvent(QDragEnterEvent* ev) { ev->acceptProposedAction(); } void MainWindow::dropEvent(QDropEvent* ev) { if (!ev->mimeData()->hasUrls()) return; string filename; QList urllist = ev->mimeData()->urls(); for(int i=0; i < urllist.size(); ++i) { std::string fn = string(urllist[i].path().toAscii()); #ifdef DETECTED_OS_WINDOWS if (!fn.empty() && fn[0] == '/') fn = fn.substr(1); #endif if(SysTools::FileExists(fn)) { filename = fn; } else { WARNING("Ignoring drop of %s: file does not exist.", fn.c_str()); } } if(filename == "") { // we didn't find a valid filename ev->ignore(); return; } MESSAGE("Got file '%s' from drop event.", filename.c_str()); if(SysTools::GetExt(filename) == "1dt") { this->Transfer1DLoad(filename); } else { this->LoadDataset(filename); } ev->accept(); } // ****************************************** // Window Geometry // ****************************************** bool MainWindow::LoadGeometry() { QSettings settings; QString strLastDir = settings.value("Folders/LoadGeometry", ".").toString(); QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString selectedFilter; QString fileName = QFileDialog::getOpenFileName(this, "Load Geometry", strLastDir, "Geometry Files (*.geo)",&selectedFilter, options); if (!fileName.isEmpty()) { settings.setValue("Folders/LoadGeometry", QFileInfo(fileName).absoluteDir().path()); return LoadGeometry(fileName); } else return false; } bool MainWindow::SaveGeometry() { QSettings settings; QString strLastDir = settings.value("Folders/SaveGeometry", ".").toString(); QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString selectedFilter; QString fileName = QFileDialog::getSaveFileName(this, "Save Current Geometry", strLastDir, "Geometry Files (*.geo)",&selectedFilter, options); if (!fileName.isEmpty()) { fileName = SysTools::CheckExt(string(fileName.toAscii()), "geo").c_str(); settings.setValue("Folders/SaveGeometry", QFileInfo(fileName).absoluteDir().path()); return SaveGeometry(fileName); } return false; } bool MainWindow::LoadDefaultGeometry() { QSettings settings; if (settings.contains("Geometry/MainWinGeometry")) return restoreGeometry( settings.value("Geometry/MainWinGeometry").toByteArray() ); else return false; } void MainWindow::SaveDefaultGeometry() { QSettings settings; settings.setValue("Geometry/MainWinGeometry", saveGeometry() ); } bool MainWindow::LoadGeometry(QString strFilename, bool bSilentFail, bool bRetryResource) { QSettings settings( strFilename, QSettings::IniFormat ); settings.beginGroup("Geometry"); bool bOK = restoreGeometry( settings.value("MainWinGeometry").toByteArray() ); settings.endGroup(); if (!bOK && bRetryResource) { string stdString(strFilename.toAscii()); if (LoadGeometry(SysTools::GetFromResourceOnMac(stdString).c_str(), true, false)) { return true; } } if (!bSilentFail && !bOK) { QString msg = tr("Error reading geometry file %1").arg(strFilename); ShowWarningDialog( tr("Error"), msg); return false; } return bOK; } bool MainWindow::SaveGeometry(QString strFilename) { QSettings settings( strFilename, QSettings::IniFormat ); if (!settings.isWritable()) { QString msg = tr("Error saving geometry file %1").arg(strFilename); ShowWarningDialog( tr("Error"), msg); return false; } settings.beginGroup("Geometry"); settings.setValue("MainWinGeometry", this->saveGeometry() ); settings.endGroup(); return true; } // ****************************************** // UI // ****************************************** void MainWindow::SetTitle() { QString qstrTitle; if (m_bShowVersionInTitle) qstrTitle = tr("ImageVis3D Version: %1 %2 [Tuvok %3 %4 %5]").arg(IV3D_VERSION).arg(IV3D_VERSION_TYPE).arg(TUVOK_VERSION).arg(TUVOK_VERSION_TYPE).arg(TUVOK_DETAILS); else qstrTitle = tr("ImageVis3D"); setWindowTitle(qstrTitle); } void MainWindow::SetHistogramScale1D(int v) { m_1DTransferFunction->SetHistogramScale(v); if (!m_pActiveRenderWin) return; m_pActiveRenderWin->SetCurrent1DHistScale(float(v)/verticalSlider_1DTransHistScale->maximum()); } void MainWindow::SetHistogramScale2D(int v) { m_2DTransferFunction->SetHistogramScale(v); if (!m_pActiveRenderWin) return; m_pActiveRenderWin->SetCurrent2DHistScale(float(v)/verticalSlider_2DTransHistScale->maximum()); } void MainWindow::setupUi(QMainWindow *MainWindow) { Ui_MainWindow::setupUi(MainWindow); this->addDockWidget(Qt::BottomDockWidgetArea, m_pDebugScriptWindow); m_pDebugScriptWindow->setObjectName(QString::fromUtf8("DebugScriptWindow")); SetTitle(); m_1DTransferFunction = new Q1DTransferFunction(m_MasterController, frame_1DTrans); verticalLayout_1DTrans->addWidget(m_1DTransferFunction); Populate1DTFLibList(); m_2DTransferFunction = new Q2DTransferFunction(m_MasterController, frame_2DTrans); verticalLayout_2DTrans->addWidget(m_2DTransferFunction); m_pQLightPreview = new QLightPreview(frame_lightPreview); horizontalLayout_lightPreview->addWidget(m_pQLightPreview); connect(m_pQLightPreview, SIGNAL(lightMoved()), this, SLOT(LightMoved())); connect(verticalSlider_1DTransHistScale, SIGNAL(valueChanged(int)), this, SLOT(SetHistogramScale1D(int))); connect(verticalSlider_2DTransHistScale, SIGNAL(valueChanged(int)), this, SLOT(SetHistogramScale2D(int))); // These values need to be different than the initial values set via Qt's // `designer'. It ensures that setValue generates a `change' event, which in // turn makes sure the initial rendering of the TF histograms match what the // value on the slider is. verticalSlider_2DTransHistScale->setValue(1500); verticalSlider_1DTransHistScale->setValue(500); connect(m_2DTransferFunction, SIGNAL(SwatchChange()), this, SLOT(Transfer2DSwatchesChanged())); connect(m_2DTransferFunction, SIGNAL(SwatchTypeChange(int)), this, SLOT(Transfer2DSwatcheTypeChanged(int))); connect(listWidget_Swatches, SIGNAL(currentRowChanged(int)), m_2DTransferFunction, SLOT(Transfer2DSetActiveSwatch(int))); connect(listWidget_Swatches, SIGNAL(currentRowChanged(int)), this, SLOT(Transfer2DUpdateSwatchButtons())); connect(listWidget_Gradient, SIGNAL(currentRowChanged(int)), this, SLOT(Transfer2DUpdateGradientButtons())); connect(pushButton_AddPoly, SIGNAL(clicked()), m_2DTransferFunction, SLOT(Transfer2DAddSwatch())); connect(pushButton_AddCircle,SIGNAL(clicked()), m_2DTransferFunction, SLOT(Transfer2DAddCircleSwatch())); connect(pushButton_NewTriangle,SIGNAL(clicked()), m_2DTransferFunction, SLOT(Transfer2DAddPseudoTrisSwatch())); connect(pushButton_NewRectangle,SIGNAL(clicked()), m_2DTransferFunction, SLOT(Transfer2DAddRectangleSwatch())); connect(pushButton_DelPoly_SimpleUI, SIGNAL(clicked()), m_2DTransferFunction, SLOT(Transfer2DDeleteSwatch())); connect(pushButton_DelPoly, SIGNAL(clicked()), m_2DTransferFunction, SLOT(Transfer2DDeleteSwatch())); connect(pushButton_UpPoly, SIGNAL(clicked()), m_2DTransferFunction, SLOT(Transfer2DUpSwatch())); connect(pushButton_DownPoly, SIGNAL(clicked()), m_2DTransferFunction, SLOT(Transfer2DDownSwatch())); for (unsigned int i = 0; i < ms_iMaxRecentFiles; ++i) { m_recentFileActs[i] = new QAction(this); m_recentFileActs[i]->setVisible(false); connect(m_recentFileActs[i], SIGNAL(triggered()), this, SLOT(OpenRecentFile())); menuLast_Used_Projects->addAction(m_recentFileActs[i]); m_recentWSFileActs[i] = new QAction(this); m_recentWSFileActs[i]->setVisible(false); connect(m_recentWSFileActs[i], SIGNAL(triggered()), this, SLOT(OpenRecentWSFile())); menuMost_Recently_Used_Workspaces->addAction(m_recentWSFileActs[i]); } setWindowIcon(QIcon(QPixmap::fromImage(QImage(":/Resources/icon_16.png")))); // this widget is used to share the contexts amongst the render windows QGLFormat fmt; fmt.setAlpha(true); fmt.setRgba(true); m_glShareWidget = new QGLWidget(fmt,this); this->horizontalLayout_10->addWidget(m_glShareWidget); DisableAllTrans(); m_pDebugOut = new QTOut(listWidget_DebugOut); m_MasterController.AddDebugOut(m_pDebugOut); GetDebugViewMask(); frame_Expand2DWidgets->hide(); frame_Simple2DTransControls->hide(); UpdateLockView(); QSettings settings; QString fileName = settings.value("Files/CaptureFilename", lineEditCaptureFile->text()).toString(); lineEditCaptureFile->setText(fileName); checkBox_PreserveTransparency->setChecked(settings.value("PreserveTransparency", true).toBool()); #ifndef PACKAGE_MANAGER // Don't bother if the system has a package manager... they should get their // updates through that. m_pHttp = new QHttp(this); connect(m_pHttp, SIGNAL(requestFinished(int, bool)), this, SLOT(httpRequestFinished(int, bool))); connect(m_pHttp, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)), this, SLOT(readResponseHeader(const QHttpResponseHeader &))); #endif pushButton_NewTriangle->setStyleSheet( "QPushButton { background: rgb(0, 150, 0); color: rgb(255, 255, 255) }" ); pushButton_NewRectangle->setStyleSheet( "QPushButton { background: rgb(0, 150, 0); color: rgb(255, 255, 255) }" ); pushButton_DelPoly_SimpleUI->setStyleSheet( "QPushButton { background: rgb(150, 0, 0); color: rgb(255, 255, 255) }" ); #ifdef DETECTED_OS_APPLE // hide edit menu as the preference item (the only item in edit right now) is magically moved on OS X to the program menu menu_File->addAction(actionSettings); menu_Edit->removeAction(actionSettings); delete menu_Edit; #else // hide progress labels on systems that support text on top of the actual progressbars frame_24->setVisible(false); frame_23->setVisible(false); #endif // DIRTY HACKS BEGIN /// \todo remove this once we figured out how to do fullscreen actionGo_Fullscreen->setVisible(false); // DIRTY HACKS END ResetTimestepUI(); } // ****************************************** // Workspace // ****************************************** void MainWindow::SetupWorkspaceMenu() { /// \todo Implement the functionality of the other workspaces // menu_Workspace->addAction(dockWidget_Tools->toggleViewAction()); // menu_Workspace->addAction(dockWidget_Filters->toggleViewAction()); // menu_Workspace->addSeparator(); radioButton_ToolsLock->setVisible(false); radioButton_FiltersLock->setVisible(false); menu_Workspace->addAction(dockWidget_RenderOptions->toggleViewAction()); dockWidget_RenderOptions->toggleViewAction()->setShortcut(tr("Ctrl+Alt+1")); menu_Workspace->addAction(dockWidget_ProgressView->toggleViewAction()); dockWidget_ProgressView->toggleViewAction()->setShortcut(tr("Ctrl+Alt+2")); menu_Workspace->addSeparator(); menu_Workspace->addAction(dockWidget_1DTrans->toggleViewAction()); dockWidget_1DTrans->toggleViewAction()->setShortcut(tr("Ctrl+Alt+3")); menu_Workspace->addAction(dockWidget_2DTrans->toggleViewAction()); dockWidget_2DTrans->toggleViewAction()->setShortcut(tr("Ctrl+Alt+4")); menu_Workspace->addAction(dockWidget_IsoSurface->toggleViewAction()); dockWidget_IsoSurface->toggleViewAction()->setShortcut(tr("Ctrl+Alt+5")); if(m_MasterController.ExperimentalFeatures()) { menu_Workspace->addAction(dockWidget_Time->toggleViewAction()); dockWidget_Time->toggleViewAction()->setShortcut(tr("Ctrl-Alt-t")); } /// @todo FIXME need a shortcut for timestep dockWidget //dockWidget_IsoSurface->toggleViewAction()->setShortcut(tr("Ctrl+Alt+5")); menu_Workspace->addSeparator(); menu_Workspace->addAction(dockWidget_LockOptions->toggleViewAction()); dockWidget_LockOptions->toggleViewAction()->setShortcut(tr("Ctrl+Alt+6")); menu_Workspace->addAction(dockWidget_Recorder->toggleViewAction()); dockWidget_Recorder->toggleViewAction()->setShortcut(tr("Ctrl+Alt+7")); menu_Workspace->addAction(dockWidget_Stereo->toggleViewAction()); dockWidget_Stereo->toggleViewAction()->setShortcut(tr("Ctrl+Alt+8")); menu_Workspace->addAction(dockWidget_Information->toggleViewAction()); dockWidget_Information->toggleViewAction()->setShortcut(tr("Ctrl+Alt+9")); menu_Workspace->addAction(dockWidget_Lighting->toggleViewAction()); dockWidget_Lighting->toggleViewAction()->setShortcut(tr("Ctrl+Alt+0")); menu_Help->addAction(dockWidget_Debug->toggleViewAction()); dockWidget_Debug->toggleViewAction()->setShortcut(tr("Ctrl+Alt+D")); menu_Help->addAction(m_pDebugScriptWindow->toggleViewAction()); } void MainWindow::ClearWSMRUList() { QSettings settings; QStringList files; files.clear(); settings.setValue("Menu/WS_MRU", files); UpdateMRUActions(); } void MainWindow::AddFileToWSMRUList(const QString &fileName) { if (m_bScriptMode || fileName == "") return; QSettings settings; QStringList files = settings.value("Menu/WS_MRU").toStringList(); files.removeAll(fileName); files.prepend(fileName); while ((unsigned int)(files.size()) > ms_iMaxRecentFiles) files.removeLast(); settings.setValue("Menu/WS_MRU", files); UpdateWSMRUActions(); } void MainWindow::UpdateWSMRUActions() { QSettings settings; QStringList files = settings.value("Menu/WS_MRU").toStringList(); int numRecentFiles = qMin(files.size(), (int)ms_iMaxRecentFiles); for (int i = 0; i < numRecentFiles; ++i) { QString text = tr("&%1 %2").arg(i + 1).arg(QFileInfo(files[i]).fileName()); m_recentWSFileActs[i]->setText(text); m_recentWSFileActs[i]->setData(files[i]); m_recentWSFileActs[i]->setVisible(true); QString shortcut = tr("Ctrl+Shift+%1").arg(i + 1); m_recentWSFileActs[i]->setShortcut(QKeySequence(shortcut)); } for (unsigned int j = numRecentFiles; j < ms_iMaxRecentFiles; ++j) m_recentWSFileActs[j]->setVisible(false); } void MainWindow::InitDockWidget(QDockWidget * v) const { v->setVisible(false); v->setFloating(true); v->resize(v->minimumSize()); #ifdef DETECTED_OS_APPLE // Ahh, Qt, how I love thee; let me count the ways... // // Dock widgets have no frames. Yet Qt 4.6.0 does position based on // the window size with a frame. Further, Qt 4.6.0 defaults to (0,0) // for window positions which aren't otherwise set. // // In effect, this means that the default position for our dock // widgets is so high up in the screen that the top few pixels of the // widget are actually *under* the Mac default menubar. This means // the dock widgets are immobile, because you can't click anywhere to // drag them. Maybe Apple will someday make a mighty mighty Mouse, // whose special power is to click under menubars... // // To make things extra-special, this only seems to happen when // Qt is compiled against Carbon. Moving windows a tad inward // isn't necessarily bad, though, so we don't bother checking for // Cocoa. Eventually, we'll be doing Cocoa-only binaries, and should // probably remove this code so that it doesn't make anybody else // vomit. if(v->pos().y() < 25) { v->move(std::max(v->pos().x(), 5), 25); } #endif } void MainWindow::InitAllWorkspaces() { InitDockWidget(dockWidget_Lighting); InitDockWidget(dockWidget_Information); InitDockWidget(dockWidget_Recorder); InitDockWidget(dockWidget_LockOptions); InitDockWidget(dockWidget_RenderOptions); InitDockWidget(dockWidget_ProgressView); InitDockWidget(dockWidget_1DTrans); InitDockWidget(dockWidget_2DTrans); InitDockWidget(dockWidget_IsoSurface); InitDockWidget(dockWidget_Time); InitDockWidget(dockWidget_Debug); InitDockWidget(dockWidget_Stereo); InitDockWidget(m_pDebugScriptWindow); } bool MainWindow::LoadWorkspace() { QSettings settings; QString strLastDir = settings.value("Folders/LoadWorkspace", ".").toString(); QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString selectedFilter; QString fileName = QFileDialog::getOpenFileName(this, "Load Workspace", strLastDir, "Workspace Files (*.wsp)",&selectedFilter, options); if (!fileName.isEmpty()) { settings.setValue("Folders/LoadWorkspace", QFileInfo(fileName).absoluteDir().path()); return LoadWorkspace(fileName); } else return false; } bool MainWindow::SaveWorkspace() { QSettings settings; QString strLastDir = settings.value("Folders/SaveWorkspace", ".").toString(); QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString selectedFilter; QString fileName = QFileDialog::getSaveFileName(this, "Save Current Workspace", strLastDir, "Workspace Files (*.wsp)",&selectedFilter, options); if (!fileName.isEmpty()) { fileName = SysTools::CheckExt(string(fileName.toAscii()), "wsp").c_str(); settings.setValue("Folders/SaveWorkspace", QFileInfo(fileName).absoluteDir().path()); return SaveWorkspace(fileName); } else return false; } bool MainWindow::LoadDefaultWorkspace() { QSettings settings; if (settings.contains("Geometry/DockGeometry")) return restoreState( settings.value("Geometry/DockGeometry").toByteArray() ); else return false; } void MainWindow::SaveDefaultWorkspace() { QSettings settings; settings.setValue("Geometry/DockGeometry", this->saveState() ); } bool MainWindow::LoadWorkspace(QString strFilename, bool bSilentFail, bool bRetryResource) { QSettings settings( strFilename, QSettings::IniFormat ); settings.beginGroup("Geometry"); bool bOK = restoreState( settings.value("DockGeometry").toByteArray() ); settings.endGroup(); if (!bOK && bRetryResource) { string stdString(strFilename.toAscii()); if (LoadWorkspace(SysTools::GetFromResourceOnMac(stdString).c_str(), true, false)) { m_strCurrentWorkspaceFilename = SysTools::GetFromResourceOnMac(stdString).c_str(); return true; } } if (!bSilentFail && !bOK) { QString msg = tr("Error reading workspace file %1").arg(strFilename); ShowWarningDialog( tr("Error"), msg); return false; } m_strCurrentWorkspaceFilename = strFilename; if (bOK) AddFileToWSMRUList(strFilename); return bOK; } bool MainWindow::SaveWorkspace(QString strFilename) { QSettings settings( strFilename, QSettings::IniFormat ); if (!settings.isWritable()) { QString msg = tr("Error saving workspace file %1").arg(strFilename); ShowWarningDialog( tr("Error"), msg); return false; } settings.beginGroup("Geometry"); settings.setValue("DockGeometry", this->saveState() ); settings.endGroup(); return true; } bool MainWindow::ApplyWorkspace() { if (!m_strCurrentWorkspaceFilename.isEmpty()) return LoadWorkspace(m_strCurrentWorkspaceFilename); else return false; } // ****************************************** // Render Windows // ****************************************** void MainWindow::PlaceCurrentView(int iPosX, int iPosY) { shared_ptr ss(m_MasterController.LuaScript()); if (ActiveSubWindow()) { ActiveSubWindow()->move(iPosX, iPosY); } else { if (mdiArea->activeSubWindow()) { mdiArea->activeSubWindow()->move(iPosX, iPosY); } } } void MainWindow::ResizeCurrentView(int iSizeX, int iSizeY) { shared_ptr ss(m_MasterController.LuaScript()); if (ActiveSubWindow()) { UINTVECTOR2 renderSize = m_pActiveRenderWin->GetRendererSize(); UINTVECTOR2 windowSize(ActiveSubWindow()->size().width(), ActiveSubWindow()->size().height()); UINTVECTOR2 winDecoSize = windowSize-renderSize; ActiveSubWindow()->resize(iSizeX+winDecoSize.x, iSizeY+winDecoSize.y); } else { if (mdiArea->activeSubWindow()) { UINTVECTOR2 renderSize = WidgetToRenderWin(mdiArea->activeSubWindow()->widget())->GetRendererSize(); UINTVECTOR2 windowSize(mdiArea->activeSubWindow()->size().width(), mdiArea->activeSubWindow()->size().height()); UINTVECTOR2 winDecoSize = windowSize-renderSize; mdiArea->activeSubWindow()->resize(iSizeX+winDecoSize.x, iSizeY+winDecoSize.y); } } } void MainWindow::CloseCurrentView() { if (ActiveSubWindow()) ActiveSubWindow()->close(); else if (mdiArea->activeSubWindow()) mdiArea->activeSubWindow()->close(); } void MainWindow::CloneCurrentView() { if (!m_pActiveRenderWin) return; RenderWindow *renderWin = CreateNewRenderWindow(m_pActiveRenderWin->GetDatasetName()); if(renderWin == NULL) { return; } renderWin->CloneViewState(m_pActiveRenderWin); renderWin->CloneRendermode(m_pActiveRenderWin); if (m_bAutoLockClonedWindow) for (size_t i = 0;iactiveSubWindow(); // as "show" toggles the active renderwin we need to remeber it renderWin->GetQtWidget()->show(); RenderWindowActive(renderWin); mdiArea->activeSubWindow()->resize(pActiveWin->size().width(), pActiveWin->size().height()); SetTagVolume(); CheckForMeshCapabilities(true); } bool MainWindow::CheckRenderwindowFitness(RenderWindow *renderWin, bool bIfNotOkShowMessageAndCloseWindow) { if (renderWin) { bool bIsOK = renderWin->IsRenderSubsysOK(); m_MasterController.DebugOut()->Message("MainWindow::CheckRenderwindowFitness","Renderwindow healthy."); if (bIfNotOkShowMessageAndCloseWindow && !bIsOK) { m_MasterController.DebugOut()->Error("MainWindow::CheckRenderwindowFitness","Unable to initialize the render window, see previous error messages for details."); // find window in mdi area for (int i = 0;isubWindowList().size();i++) { QWidget* w = mdiArea->subWindowList().at(i)->widget(); RenderWindow* subwindow = WidgetToRenderWin(w); if (subwindow == renderWin) { mdiArea->setActiveSubWindow(mdiArea->subWindowList().at(i)); mdiArea->closeActiveSubWindow(); break; } } ShowCriticalDialog( "Error during render window initialization.", "The system was unable to open a render window, please check the error log for details (Menu -> \"Help\" -> \"Debug Window\")."); } return bIsOK; } return false; } void MainWindow::LuaPlaceActiveWindow(const UINTVECTOR2& position) { PlaceCurrentView(position.x, position.y); } void MainWindow::LuaResizeActiveWindow(const UINTVECTOR2& newSize) { ResizeCurrentView(newSize.x, newSize.y); } RenderWindow* MainWindow::LuaCreateNewWindow(std::string dataset) { std::vector fileList; fileList.push_back(dataset); return LuaLoadDatasetInternal(fileList, std::string(""), false); } RenderWindow* MainWindow::CreateNewRenderWindow(QString dataset) { static unsigned int iCounter = 0; RenderWindow *renderWin; #if defined(_WIN32) && defined(USE_DIRECTX) if (m_eVolumeRendererType == MasterController::DIRECTX_SBVR || m_eVolumeRendererType == MasterController::DIRECTX_RAYCASTER || m_eVolumeRendererType == MasterController::DIRECTX_2DSBVR || m_eVolumeRendererType == MasterController::DIRECTX_GRIDLEAPER) { renderWin = new RenderWindowDX(m_MasterController, m_eVolumeRendererType, dataset, iCounter++, m_bPowerOfTwo, m_bDownSampleTo8Bits, m_bDisableBorder, this, 0); } else { QGLFormat fmt; fmt.setRgba(true); fmt.setAlpha(true); renderWin = new RenderWindowGL(m_MasterController, m_eVolumeRendererType, dataset, iCounter++, m_bPowerOfTwo, m_bDownSampleTo8Bits, m_bDisableBorder, m_glShareWidget, fmt, this, 0); } #else if (m_eVolumeRendererType == MasterController::DIRECTX_SBVR || m_eVolumeRendererType == MasterController::DIRECTX_RAYCASTER || m_eVolumeRendererType == MasterController::DIRECTX_2DSBVR || m_eVolumeRendererType == MasterController::DIRECTX_GRIDLEAPER) { ShowInformationDialog( "No DirectX Support", "The system was unable to open a DirectX 10 render window, falling back to OpenGL. Please check your settings."); m_MasterController.DebugOut()->Message("MainWindow::CreateNewRenderWindow","The system was unable to open a DirectX 10 render window, falling back to OpenGL. Please check your settings."); if (m_eVolumeRendererType == MasterController::DIRECTX_SBVR) m_eVolumeRendererType = MasterController::OPENGL_SBVR; else if (m_eVolumeRendererType == MasterController::DIRECTX_RAYCASTER) m_eVolumeRendererType = MasterController::OPENGL_RAYCASTER; else if (m_eVolumeRendererType == MasterController::DIRECTX_2DSBVR) m_eVolumeRendererType = MasterController::OPENGL_2DSBVR; else m_eVolumeRendererType = MasterController::OPENGL_GRIDLEAPER; } // if they're using the basic configuration, choose a renderer for them. // We can't just choose this here because we need to query some OGL // parameters to figure this out. if(m_bAdvancedSettings == false) { m_eVolumeRendererType = MasterController::OPENGL_CHOOSE; } QGLFormat fmt; fmt.setAlpha(true); fmt.setRgba(true); renderWin = new RenderWindowGL(m_MasterController, m_eVolumeRendererType, dataset, iCounter++, m_bPowerOfTwo, m_bDownSampleTo8Bits, m_bDisableBorder, m_glShareWidget, fmt, this, 0); #endif if (m_pActiveRenderWin != renderWin && !renderWin->IsRenderSubsysOK()) { delete renderWin; T_ERROR("Could not initialize render window!"); return NULL; } connect(renderWin->GetQtWidget(), SIGNAL(WindowActive(RenderWindow*)), this, SLOT(RenderWindowActive(RenderWindow*))); connect(renderWin->GetQtWidget(), SIGNAL(WindowClosing(RenderWindow*)), this, SLOT(RenderWindowClosing(RenderWindow*))); connect(renderWin->GetQtWidget(), SIGNAL(RenderWindowViewChanged(int)), this, SLOT(RenderWindowViewChanged(int))); connect(renderWin->GetQtWidget(), SIGNAL(StereoDisabled()), this, SLOT(StereoDisabled())); mdiArea->addSubWindow(new MDIRenderWin(m_MasterController, renderWin)); renderWin->InitializeContext(); if (m_pActiveRenderWin != renderWin && !renderWin->IsRenderSubsysOK()) { delete renderWin; T_ERROR("Could not initialize render window context!"); return NULL; } m_pLastLoadedRenderWin = renderWin; ApplySettings(renderWin); QCoreApplication::processEvents(); return renderWin; } void MainWindow::RenderWindowActive(RenderWindow* sender) { // to make sure we are only calling this code if the renderwindow changes, // and not just if the same window gets reactivated, keep track of the // last active window if(m_pActiveRenderWin == sender) { return; } m_pActiveRenderWin = sender; m_MasterController.DebugOut()-> Message("MainWindow::RenderWindowActive", "ACK that %s is now active", sender->GetDatasetName().toStdString().c_str()); if (!CheckRenderwindowFitness(m_pActiveRenderWin)) { QMdiSubWindow* w = ActiveSubWindow(); if (w) w->close(); return; } MESSAGE("Getting 1D Transfer Function."); shared_ptr ss = m_MasterController.LuaScript(); LuaClassInstance ds = sender->GetRendererDataset(); std::pair range = ss->cexecRet>(ds.fqName() + ".getRange"); shared_ptr hist1D = ss->cexecRet>( ds.fqName() + ".get1DHistogram"); LuaClassInstance tf1d = sender->GetRendererTransferFunction1D(); m_1DTransferFunction->SetData(hist1D, static_cast(range.second-range.first), tf1d); m_1DTransferFunction->update(); MESSAGE("Getting 2D Transfer Function."); shared_ptr hist2D = ss->cexecRet>( ds.fqName() + ".get2DHistogram"); LuaClassInstance tf2d = sender->GetRendererTransferFunction2D(); m_2DTransferFunction->SetData(hist2D, tf2d); m_2DTransferFunction->update(); MESSAGE("Getting other Renderwindow parameters."); AbstrRenderer::ERenderMode e = m_pActiveRenderWin->GetRenderMode(); switch (e) { case AbstrRenderer::RM_1DTRANS : Use1DTrans(); break; case AbstrRenderer::RM_2DTRANS : Use2DTrans(); break; case AbstrRenderer::RM_ISOSURFACE : UseIso(); break; default : m_MasterController.DebugOut()-> Error("MainWindow::RenderWindowActive", "unknown rendermode from %s", sender->GetDatasetName().toStdString().c_str()); break; } EnableStereoWidgets(); checkBox_Stereo->setChecked(sender->GetRendererStereoEnabled()); horizontalSlider_EyeDistance->setValue(int(sender->GetRendererStereoEyeDist()*100)); horizontalSlider_FocalLength->setValue(int(sender->GetRendererStereoFocalLength()*10)); checkBox_EyeSwap->setChecked(sender->GetRendererStereoEyeSwap()); switch (sender->GetRendererStereoMode()) { case AbstrRenderer::SM_RB : radioButton_RBStereo->setChecked(true); break; case AbstrRenderer::SM_SCANLINE : radioButton_ScanlineStereo->setChecked(true); break; case AbstrRenderer::SM_SBS : radioButton_SideBySide->setChecked(true); break; default : radioButton_AlterFrame->setChecked(true); break; } checkBox_Lighting->setChecked(sender->GetUseLighting()); SetSampleRateSlider(int(sender->GetRendererSampleRateModifier()*100)); SetFoVSlider(int(sender->GetRendererFoV())); int iRange = int(m_pActiveRenderWin->GetDynamicRange().second); SetIsoValueSlider(int(sender->GetRendererIsoValue()), iRange); DOUBLEVECTOR3 vfRescaleFactors = sender->GetRendererRescaleFactors(); doubleSpinBox_RescaleX->setValue(vfRescaleFactors.x); doubleSpinBox_RescaleY->setValue(vfRescaleFactors.y); doubleSpinBox_RescaleZ->setValue(vfRescaleFactors.z); SetToggleGlobalBBoxLabel(sender->GetRendererGlobalBBox()); SetToggleLocalBBoxLabel(sender->GetRendererLocalBBox()); SetToggleClipEnabledLabel(sender->GetRendererClipPlaneEnabled()); SetToggleClipShownLabel(sender->GetRendererClipPlaneShown()); SetToggleClipLockedLabel(sender->GetRendererClipPlaneLocked()); ClearProgressViewAndInfo(); ToggleClearViewControls(iRange); UpdateLockView(); UpdateExplorerView(true); // groupBox_ClipPlane->setVisible(sender->GetRendererCanDoClipPlane()); lineEdit_DatasetName->setText(QFileInfo(m_pActiveRenderWin-> GetDatasetName()).fileName()); UINT64VECTOR3 vSize = ss->cexecRet( ds.fqName() + ".getDomainSize", size_t(0), size_t(0)); uint64_t iBitWidth = ss->cexecRet(ds.fqName() + ".getBitWidth"); pair pRange = ss->cexecRet>( ds.fqName() + ".getRange"); uint64_t numDSTimesteps = ss->cexecRet(ds.fqName() + ".getNumberOfTimesteps"); uint64_t lodLevelCount = ss->cexecRet(ds.fqName() + ".getLODLevelCount"); QString strSize = tr("%1 x %2 x %3 (%4bit)").arg(vSize.x). arg(vSize.y). arg(vSize.z). arg(iBitWidth); if (pRange.first<=pRange.second) { strSize = strSize + tr(" Min=%1 Max=%2").arg(uint64_t(pRange.first)). arg(uint64_t(pRange.second)); } // -1: slider is 0 based, but label is not. SetTimestepSlider(static_cast(sender->GetRendererTimestep()), numDSTimesteps-1); UpdateTimestepLabel(static_cast(sender->GetRendererTimestep()), numDSTimesteps); lineEdit_MaxSize->setText(strSize); uint64_t iLevelCount = lodLevelCount; QString strLevelCount = tr("%1").arg(iLevelCount); lineEdit_MaxLODLevels->setText(strLevelCount); horizontalSlider_maxLODLimit->setMaximum(iLevelCount-1); horizontalSlider_minLODLimit->setMaximum(iLevelCount-1); UINTVECTOR2 iLODLimits = sender->GetRendererLODLimits(); horizontalSlider_minLODLimit->setValue(iLODLimits.x); horizontalSlider_maxLODLimit->setValue(iLODLimits.y); UpdateMinMaxLODLimitLabel(); UpdateColorWidget(); UpdateTFScaleSliders(); UpdateInterpolant(); } void MainWindow::ToggleMesh() { if (!m_pActiveRenderWin) return; int iCurrent = listWidget_DatasetComponents->currentRow(); if (iCurrent < 1 || iCurrent >= listWidget_DatasetComponents->count()) return; shared_ptr mesh = m_pActiveRenderWin->GetRendererMeshes()[iCurrent-1]; mesh->SetActive(checkBox_ComponenEnable->isChecked()); m_pActiveRenderWin->RendererSchedule3DWindowRedraws(); ToggleClearViewControls(); } void MainWindow::SetMeshDefOpacity() { if (!m_pActiveRenderWin) return; int iCurrent = listWidget_DatasetComponents->currentRow(); if (iCurrent < 1 || iCurrent >= listWidget_DatasetComponents->count()) return; shared_ptr mesh = m_pActiveRenderWin->GetRendererMeshes()[iCurrent-1]; FLOATVECTOR4 meshcolor = mesh->GetDefaultColor(); float fSlideVal = horizontalSlider_MeshDefOpacity->value()/100.0f; if (fSlideVal != meshcolor.w) { meshcolor.w = fSlideVal; mesh->SetDefaultColor(meshcolor); m_pActiveRenderWin->RendererSchedule3DWindowRedraws(); } } void MainWindow::SetMeshScaleAndBias() { if (!m_pActiveRenderWin) return; int iCurrent = listWidget_DatasetComponents->currentRow(); if (iCurrent < 1 || iCurrent >= listWidget_DatasetComponents->count()) return; shared_ptr mesh = m_pActiveRenderWin->GetRendererMeshes()[iCurrent-1]; FLOATVECTOR3 vCenter, vExtend; vCenter = m_pActiveRenderWin->GetRendererVolumeAABBCenter(); vExtend = m_pActiveRenderWin->GetRendererVolumeAABBExtents(); ScaleAndBiasDlg sbd(mesh,iCurrent-1, vCenter-0.5f*vExtend, vCenter+0.5f*vExtend, this); connect(&sbd, SIGNAL(SaveTransform(ScaleAndBiasDlg*)), this, SLOT(SaveMeshTransform(ScaleAndBiasDlg*))); connect(&sbd, SIGNAL(RestoreTransform(ScaleAndBiasDlg*)), this, SLOT(RestoreMeshTransform(ScaleAndBiasDlg*))); connect(&sbd, SIGNAL(ApplyTransform(ScaleAndBiasDlg*)), this, SLOT(ApplMeshTransform(ScaleAndBiasDlg*))); connect(&sbd, SIGNAL(ApplyMatrixTransform(ScaleAndBiasDlg*)), this, SLOT(ApplyMatrixMeshTransform(ScaleAndBiasDlg*))); sbd.exec(); disconnect(&sbd, SIGNAL(SaveTransform(ScaleAndBiasDlg*)), this, SLOT(SaveMeshTransform(ScaleAndBiasDlg*))); disconnect(&sbd, SIGNAL(RestoreTransform(ScaleAndBiasDlg*)), this, SLOT(RestoreMeshTransform(ScaleAndBiasDlg*))); disconnect(&sbd, SIGNAL(ApplyTransform(ScaleAndBiasDlg*)), this, SLOT(ApplMeshTransform(ScaleAndBiasDlg*))); disconnect(&sbd, SIGNAL(ApplyMatrixTransform(ScaleAndBiasDlg*)), this, SLOT(ApplyMatrixMeshTransform(ScaleAndBiasDlg*))); } void MainWindow::ApplMeshTransform(ScaleAndBiasDlg* sender) { if (!m_pActiveRenderWin || !sender) return; sender->m_pMesh->ScaleAndBias(sender->scaleVec, sender->biasVec); m_pActiveRenderWin->RendererSchedule3DWindowRedraws(); } void MainWindow::ApplyMatrixMeshTransform(ScaleAndBiasDlg* sender) { if (!m_pActiveRenderWin || !sender) return; sender->m_pMesh->Transform(sender->GetExpertTransform()); m_pActiveRenderWin->RendererSchedule3DWindowRedraws(); } void MainWindow::RestoreMeshTransform(ScaleAndBiasDlg* sender) { if (!m_pActiveRenderWin || !sender) return; shared_ptr ss = m_MasterController.LuaScript(); LuaClassInstance ds = m_pActiveRenderWin->GetRendererDataset(); vector> meshes = ss->cexecRet>>( ds.fqName() + ".getMeshes"); const shared_ptr m = meshes[sender->m_index]; m_pActiveRenderWin->RendererReloadMesh(sender->m_index, m); m_pActiveRenderWin->RendererSchedule3DWindowRedraws(); } void MainWindow::SaveMeshTransform(ScaleAndBiasDlg* sender) { if (!m_pActiveRenderWin || !sender) return; shared_ptr ss = m_MasterController.LuaScript(); LuaClassInstance ds = m_pActiveRenderWin->GetRendererDataset(); if (ss->cexecRet( ds.fqName() + ".getDSType") != LuaDatasetProxy::UVF) return; PleaseWaitDialog pleaseWait(this); pleaseWait.SetText("Saving transformation to UVF file..."); pleaseWait.AttachLabel(&m_MasterController); const FLOATMATRIX4& m = m_pActiveRenderWin->GetRendererMeshes()[sender->m_index]->GetTransformFromOriginal(); m_pActiveRenderWin->SetDatasetIsInvalid(true); if (!ss->cexecRet(ds.fqName() + ".geomTransformToFile", static_cast(sender->m_index), m)) { pleaseWait.close(); ShowCriticalDialog("Transform Save Failed.", "Could not save geometry transform to the UVF file, " "maybe the file is write protected? For details please " "check the debug log ('Help | Debug Window')."); } else { m_pActiveRenderWin->GetRendererMeshes()[sender->m_index]->DeleteTransformFromOriginal(); pleaseWait.close(); } m_pActiveRenderWin->SetDatasetIsInvalid(false); } void MainWindow::SetMeshDefColor() { if (!m_pActiveRenderWin) return; int iCurrent = listWidget_DatasetComponents->currentRow(); if (iCurrent < 1 || iCurrent >= listWidget_DatasetComponents->count()) return; shared_ptr mesh = m_pActiveRenderWin->GetRendererMeshes()[iCurrent-1]; FLOATVECTOR4 meshcolor = mesh->GetDefaultColor(); const int old_color[3] = { static_cast(meshcolor.x * 255.f), static_cast(meshcolor.y * 255.f), static_cast(meshcolor.z * 255.f) }; QColor prevColor(old_color[0], old_color[1], old_color[2]); QColor color = QColorDialog::getColor(prevColor, this); if (color.isValid()) { meshcolor.x = color.red()/255.0f; meshcolor.y = color.green()/255.0f; meshcolor.z = color.blue()/255.0f; mesh->SetDefaultColor(meshcolor); m_pActiveRenderWin->RendererSchedule3DWindowRedraws(); } } void MainWindow::UpdateExplorerView(bool bRepopulateListBox) { if (!m_pActiveRenderWin) return; if (bRepopulateListBox) { listWidget_DatasetComponents->clear(); shared_ptr ss(m_MasterController.LuaScript()); LuaClassInstance ds = m_pActiveRenderWin->GetRendererDataset(); QString voldesc = tr("Volume (%1)").arg( ss->cexecRet(ds.fqName() + ".name")); listWidget_DatasetComponents->addItem(voldesc); size_t meshListSize = m_pActiveRenderWin->GetRendererMeshes().size(); for (size_t i = 0; i mesh = m_pActiveRenderWin->GetRendererMeshes()[i]; QString meshdesc = tr("%1 (%2)").arg(mesh->GetMeshType() == Mesh::MT_TRIANGLES ? "Triangle Mesh" : "Lines").arg(mesh->Name().c_str()); listWidget_DatasetComponents->addItem(meshdesc); } listWidget_DatasetComponents->setCurrentRow(0); ToggleClearViewControls(); } int iCurrent = listWidget_DatasetComponents->currentRow(); if (iCurrent < 0 || iCurrent >= listWidget_DatasetComponents->count()) { stackedWidget_componentInfo->setVisible(false); checkBox_ComponenEnable->setVisible(false); return; } stackedWidget_componentInfo->setVisible(true); checkBox_ComponenEnable->setVisible(true); if (iCurrent == 0) { page_Volume->setVisible(true); page_Geometry->setVisible(false); stackedWidget_componentInfo->setCurrentIndex(0); } else { page_Volume->setVisible(false); page_Geometry->setVisible(true); stackedWidget_componentInfo->setCurrentIndex(1); shared_ptr mesh = m_pActiveRenderWin->GetRendererMeshes()[iCurrent-1]; size_t iVerticesPerPoly = mesh->GetVerticesPerPoly(); checkBox_ComponenEnable->setChecked(mesh->GetActive()); size_t polycount = mesh->GetVertexIndices().size()/iVerticesPerPoly; size_t vertexcount = mesh->GetVertices().size(); size_t normalcount = mesh->GetNormals().size(); size_t texccordcount = mesh->GetTexCoords().size(); size_t colorcount = mesh->GetColors().size(); QString strPolycount = tr("%1").arg(polycount); lineEdit_MeshPolyCount->setText(strPolycount); QString strVertexcount = tr("%1").arg(vertexcount); lineEdit_VertexCount->setText(strVertexcount); QString strNormalcount = tr("%1").arg(normalcount); lineEdit_NormalCount->setText(strNormalcount); QString strTexccordcount = tr("%1").arg(texccordcount); lineEdit_TexCoordCount->setText(strTexccordcount); QString strColorcount = (colorcount != 0) ? tr("%1").arg(colorcount) : "using default color"; lineEdit_ColorCount->setText(strColorcount); horizontalSlider_MeshDefOpacity->setVisible(mesh->GetMeshType() == Mesh::MT_TRIANGLES); label_MeshOpacity->setVisible(mesh->GetMeshType() == Mesh::MT_TRIANGLES); horizontalSlider_MeshDefOpacity->setValue(int(mesh->GetDefaultColor().w*100)); frame_meshDefColor->setVisible(colorcount == 0); } } void MainWindow::UpdateMinMaxLODLimitLabel() { if (horizontalSlider_minLODLimit->value() == 1) label_minLODLimit->setText(tr("Limit Minimum Quality by skipping the lowest level")); else label_minLODLimit->setText(tr("Limit Minimum Quality by skipping the lowest %1 levels").arg(horizontalSlider_minLODLimit->value())); if (horizontalSlider_maxLODLimit->value() == 1) label_maxLODLimit->setText(tr("Limit Maximum Quality by not rendering the highest level")); else label_maxLODLimit->setText(tr("Limit Maximum Quality by not rendering the highest %1 levels").arg(horizontalSlider_maxLODLimit->value())); } void MainWindow::ToggleClearViewControls() { if (!m_pActiveRenderWin) return; if (m_pActiveRenderWin->SupportsClearView()) { checkBox_ClearView->setVisible(true); frame_ClearView->setVisible(true); checkBox_ClearView->setChecked(m_pActiveRenderWin->GetClearViewEnabled()); label_CVDisableReason->setVisible(false); } else { checkBox_ClearView->setChecked(false); checkBox_ClearView->setVisible(false); frame_ClearView->setVisible(false); QString reason = tr("ClearView is disabled because %1").arg( m_pActiveRenderWin->GetRendererClearViewDisabledReason().c_str()); label_CVDisableReason->setText(reason); label_CVDisableReason->setVisible(true); label_CVDisableReason->setWordWrap(true); m_pActiveRenderWin->RendererSchedule3DWindowRedraws(); } } void MainWindow::ToggleClearViewControls(int iRange) { ToggleClearViewControls(); SetFocusIsoValueSlider( int(m_pActiveRenderWin->GetRendererClearViewIsoValue()), iRange); SetFocusSizeValueSlider( 99-int(m_pActiveRenderWin->GetRendererClearViewSize()*9.9f)); SetContextScaleValueSlider( int(m_pActiveRenderWin->GetRendererClearViewContextScale()*10.0f)); SetBorderSizeValueSlider( int(99-m_pActiveRenderWin->GetRendererClearViewBorderScale())); } void MainWindow::SetStayOpen(bool bStayOpenAfterScriptEnd) { m_bStayOpenAfterScriptEnd = bStayOpenAfterScriptEnd; } void MainWindow::SetRescaleFactors() { if (!m_pActiveRenderWin) return; DOUBLEVECTOR3 vfRescaleFactors; vfRescaleFactors.x = std::max(0.001f,doubleSpinBox_RescaleX->value()); vfRescaleFactors.y = std::max(0.001f,doubleSpinBox_RescaleY->value()); vfRescaleFactors.z = std::max(0.001f,doubleSpinBox_RescaleZ->value()); m_pActiveRenderWin->SetRendererRescaleFactors(vfRescaleFactors); } void MainWindow::StereoDisabled() { checkBox_Stereo->setChecked(false); } void MainWindow::RenderWindowViewChanged(int iMode) { groupBox_MovieCapture->setEnabled(iMode == 0); } void MainWindow::EnableStereoWidgets() { frame_Stereo->setEnabled(true); horizontalSlider_EyeDistance->setEnabled(true); horizontalSlider_FocalLength->setEnabled(true); frame_StereoMode->setEnabled(true); } void MainWindow::DisableStereoWidgets() { frame_Stereo->setEnabled(false); horizontalSlider_EyeDistance->setEnabled(false); horizontalSlider_FocalLength->setEnabled(false); frame_StereoMode->setEnabled(false); } void MainWindow::RenderWindowClosing(RenderWindow* sender) { sender->GetQtWidget()->setEnabled(false); m_MasterController.DebugOut()-> Message("MainWindow::RenderWindowClosing", "ACK that %s is now closing", sender->GetDatasetName().toStdString().c_str()); RemoveAllLocks(sender); disconnect(sender->GetQtWidget()); m_1DTransferFunction->SetData(NULL, 10, LuaClassInstance()); m_1DTransferFunction->update(); m_2DTransferFunction->SetData(NULL, LuaClassInstance()); m_2DTransferFunction->update(); DisableAllTrans(); DisableStereoWidgets(); ClearProgressViewAndInfo(); UpdateColorWidget(); UpdateLockView(); ResetTimestepUI(); m_pActiveRenderWin = NULL; } void MainWindow::ToggleRenderWindowView2x2() { if (m_pActiveRenderWin) m_pActiveRenderWin->ToggleRenderWindowView2x2(); } void MainWindow::ToggleRenderWindowViewSingle() { if (m_pActiveRenderWin) m_pActiveRenderWin->ToggleRenderWindowViewSingle(); } void MainWindow::CheckForRedraw() { m_pRedrawTimer->stop(); for (int i = 0;isubWindowList().size();i++) { QWidget* w = mdiArea->subWindowList().at(i)->widget(); RenderWindow* r = WidgetToRenderWin(w); // It can happen that our window was created, yet GL initialization failed // so it never got into a valid state. Then a Qt event can pop up before // the `invalid window' detection code gets reached, and in that event // we'll end up checking for redraw. // In short: this method can end up being called even if we don't have a // render window. if(r && r->IsRenderSubsysOK()) { r->CheckForRedraw(); } } m_pRedrawTimer->start(IV3D_TIMER_INTERVAL); } // ****************************************** // Menus // ****************************************** void MainWindow::OpenRecentFile(){ QAction *action = qobject_cast(sender()); if(action == NULL) { T_ERROR("no sender?"); return; } if (SysTools::FileExists(string(action->data().toString().toAscii()))) { if (!LoadDataset(QStringList(action->data().toString()))) { if (m_bIgnoreLoadDatasetFailure == false) { ShowCriticalDialog("Render window initialization failed.", "Could not open a render window! This normally " "means ImageVis3D does not support your GPU. Please" " check the debug log ('Help | Debug Window') for " "errors, and/or use 'Help | Report an Issue' to " "notify the ImageVis3D developers."); } m_bIgnoreLoadDatasetFailure = false; } } else { QString strText = tr("File %1 not found.").arg(action->data().toString()); m_MasterController.DebugOut()->Error("MainWindow::OpenRecentFile", strText.toStdString().c_str()); strText = strText + " Do you want to remove the file from the MRU list?"; if (QMessageBox::Yes == QMessageBox::question(this, "Load Error", strText, QMessageBox::Yes, QMessageBox::No)) { int iIndex = -1; for (int i = 0; i < int(ms_iMaxRecentFiles); ++i) { if (m_recentFileActs[i] == action) { iIndex = i; break; } } if (iIndex > -1) { QSettings settings; QStringList files = settings.value("Menu/MRU").toStringList(); files.removeAt(iIndex); settings.setValue("Menu/MRU", files); UpdateMRUActions(); } } return; } } void MainWindow::OpenRecentWSFile(){ QAction *action = qobject_cast(sender()); if(action == NULL) { T_ERROR("no sender?"); return; } if (SysTools::FileExists(string(action->data().toString().toAscii()))) { LoadWorkspace(action->data().toString()); } } void MainWindow::UpdateMenus() { bool bHasMdiChild = mdiArea->subWindowList().size() > 0; actionExport_Dataset->setEnabled(bHasMdiChild); actionExport_Image_Stack->setEnabled(bHasMdiChild); actionTransfer_to_ImageVis3D_Mobile_Device->setEnabled(bHasMdiChild); actionAdd_Geometry_to_Data_Set->setEnabled(bHasMdiChild); actionGo_Fullscreen->setEnabled(bHasMdiChild); actionCascade->setEnabled(bHasMdiChild); actionTile->setEnabled(bHasMdiChild); actionNext->setEnabled(bHasMdiChild); actionPrevious->setEnabled(bHasMdiChild); action2_x_2_View->setEnabled(bHasMdiChild); actionSinge_View->setEnabled(bHasMdiChild); actionCloneCurrentView->setEnabled(bHasMdiChild); actionBox->setEnabled(bHasMdiChild); actionPoly_Line->setEnabled(bHasMdiChild); actionSelect_All->setEnabled(bHasMdiChild); actionDelete_Selection->setEnabled(bHasMdiChild); actionInvert_Selection->setEnabled(bHasMdiChild); actionStastistcs->setEnabled(bHasMdiChild); actionUndo->setEnabled(bHasMdiChild); actionRedo->setEnabled(bHasMdiChild); /// \todo implement all of the features we are hiding here actionBox->setVisible(false); actionPoly_Line->setVisible(false); actionSelect_All->setVisible(false); actionDelete_Selection->setVisible(false); actionInvert_Selection->setVisible(false); actionStastistcs->setVisible(false); actionUndo->setVisible(false); actionRedo->setVisible(false); } // ****************************************** // Recent Files // ****************************************** void MainWindow::ClearMRUList() { QSettings settings; QStringList files; files.clear(); settings.setValue("Menu/MRU", files); UpdateMRUActions(); } void MainWindow::AddFileToMRUList(const QString &fileName) { if (m_bScriptMode || fileName == "") return; QSettings settings; QStringList files = settings.value("Menu/MRU").toStringList(); files.removeAll(fileName); files.prepend(fileName); while ((unsigned int)(files.size()) > ms_iMaxRecentFiles) files.removeLast(); settings.setValue("Menu/MRU", files); UpdateMRUActions(); } void MainWindow::UpdateMRUActions() { QSettings settings; QStringList files = settings.value("Menu/MRU").toStringList(); int numRecentFiles = qMin(files.size(), (int)ms_iMaxRecentFiles); for (int i = 0; i < numRecentFiles; ++i) { QString text = tr("&%1 %2").arg(i + 1).arg(QFileInfo(files[i]).fileName()); m_recentFileActs[i]->setText(text); m_recentFileActs[i]->setData(files[i]); m_recentFileActs[i]->setVisible(true); QString shortcut = tr("Ctrl+%1").arg(i + 1); m_recentFileActs[i]->setShortcut(QKeySequence(shortcut)); } for (unsigned int j = numRecentFiles; j < ms_iMaxRecentFiles; ++j) m_recentFileActs[j]->setVisible(false); } void MainWindow::Collapse2DWidgets() { frame_2DTransEditWrapper->hide(); frame_Expand2DWidgets->show(); } void MainWindow::Expand2DWidgets() { frame_2DTransEditWrapper->show(); frame_Expand2DWidgets->hide(); } void MainWindow::Show1DTrans() { dockWidget_1DTrans->setVisible(true); } void MainWindow::Show2DTrans() { dockWidget_2DTrans->setVisible(true); } void MainWindow::ShowIsoEdit() { dockWidget_IsoSurface->setVisible(true); } void MainWindow::ShowCriticalDialog(QString strTitle, QString strMessage) { if (!m_bScriptMode) QMessageBox::critical(this, strTitle, strMessage); else { string s = string(strTitle.toAscii()) + ": " + string(strMessage.toAscii()); T_ERROR(s.c_str()); } } void MainWindow::ShowInformationDialog(QString strTitle, QString strMessage) { if (!m_bScriptMode) QMessageBox::information(this, strTitle, strMessage); else { string s = string(strTitle.toAscii()) + ": " + string(strMessage.toAscii()); MESSAGE(s.c_str()); } } void MainWindow::ShowWarningDialog(QString strTitle, QString strMessage) { if (!m_bScriptMode) QMessageBox::warning(this, strTitle, strMessage); else { string s = string(strTitle.toAscii()) + ": " + string(strMessage.toAscii()); WARNING(s.c_str()); } } void MainWindow::ShowWelcomeScreen() { /* // This code should center the window in its parent, but for now we just let QT decide where to put the window QSize qSize = this->size(); QPoint qPos = this->pos(); QSize qWelcomeSize = m_pWelcomeDialog->size(); QSize qTmp = (qSize - qWelcomeSize) / 2.0f; QPoint qNewWelcomePos(qTmp.width(), qTmp.height()); m_pWelcomeDialog->move(qPos+qNewWelcomePos ); */ m_pWelcomeDialog->SetShowAtStartup(m_bShowWelcomeScreen); m_pWelcomeDialog->ClearMRUItems(); QSettings settings; QStringList files = settings.value("Menu/MRU").toStringList(); int numRecentFiles = qMin(files.size(), (int)ms_iMaxRecentFiles); for (int i = 0; i < numRecentFiles; ++i) { QString text = tr("%1").arg(QFileInfo(files[i]).fileName()); m_pWelcomeDialog->AddMRUItem(string(text.toAscii()), string(files[i].toAscii())); } m_pWelcomeDialog->setWindowIcon(windowIcon()); m_pWelcomeDialog->show(); } void MainWindow::DisplayMetadata() { if (m_pActiveRenderWin) { shared_ptr ss(m_MasterController.LuaScript()); LuaClassInstance ds = m_pActiveRenderWin->GetRendererDataset(); const vector>& metadata = ss->cexecRet>>(ds.fqName() + ".getMetadata"); if(!metadata.empty()) { m_pMetadataDialog->setWindowIcon(windowIcon()); m_pMetadataDialog->SetMetadata(metadata); m_pMetadataDialog->SetFilename(lineEdit_DatasetName->text()); m_pMetadataDialog->show(); } else { QMessageBox::information(this, "Metadata viewer", "This file does not contain metadata!"); } } } ImageVis3D-3.1.0/ImageVis3D/UI/BasicSettingsDlg.cpp0000644000175000017500000001265512320517543021400 0ustar mathieumathieu#include "../Tuvok/StdTuvokDefines.h" #include #include #include #include #include #include #include #include #include "BasicSettingsDlg.h" using namespace tuvok; BasicSettingsDlg::BasicSettingsDlg(MasterController& mcontroller, enum PerformanceLevel defaultLevel, QWidget* parent /* = 0 */, Qt::WindowFlags flags /* = 0 */) : QDialog(parent, flags), ctlr(mcontroller), lDesc(NULL), slPerf(NULL), useAdvanced(false) { setupUI(this, defaultLevel); } BasicSettingsDlg::~BasicSettingsDlg(void) { } void BasicSettingsDlg::setupUI(QDialog *dlg, enum PerformanceLevel lvl) { // Erase old layout/info. qDeleteAll(dlg->children()); dlg->setWindowTitle("ImageVis3D Settings"); dlg->setObjectName(QString::fromUtf8("BasicSettingsDlg")); dlg->setWindowModality(Qt::ApplicationModal); dlg->resize(300, 150); dlg->setContextMenuPolicy(Qt::DefaultContextMenu); dlg->setSizeGripEnabled(true); dlg->setModal(true); QVBoxLayout* vlayout = new QVBoxLayout(this); vlayout->setObjectName(QString::fromUtf8("vlayout")); // perf / slider / and a description of the current setting QHBoxLayout* hPerf = new QHBoxLayout(); QLabel* lPerf = new QLabel("Performance:"); this->slPerf = new QSlider(); this->slPerf->setOrientation(Qt::Horizontal); this->slPerf->setMinimum(MAX_RESPONSIVENESS); this->slPerf->setMaximum(MAX_PERFORMANCE); this->slPerf->setMinimumSize(QSize(75, 20)); this->slPerf->setTickPosition(QSlider::TicksBelow); this->slPerf->setTickInterval(1); this->slPerf->setValue(int(lvl)); this->lDesc = new QLabel("Favor more responsive behavior."); QSizePolicy lblPol(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding); lblPol.setHorizontalStretch(1); lblPol.setVerticalStretch(1); this->lDesc->setSizePolicy(lblPol); this->lDesc->setAlignment(Qt::AlignJustify | Qt::AlignVCenter); this->lDesc->setWordWrap(true); hPerf->addWidget(lPerf); hPerf->addWidget(this->slPerf); hPerf->addWidget(this->lDesc); // buttons: we put them in a layout so we can add an 'advanced' one. QHBoxLayout* hbuttons = new QHBoxLayout(); QDialogButtonBox* bbox = new QDialogButtonBox(); QPushButton* btnAdvanced = new QPushButton("Advanced"); bbox->setOrientation(Qt::Horizontal); bbox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok); hbuttons->addWidget(btnAdvanced); hbuttons->addWidget(bbox); vlayout->addLayout(hPerf); vlayout->addLayout(hbuttons); this->setLayout(vlayout); connect(slPerf, SIGNAL(valueChanged(int)), dlg, SLOT(PerfLevelChanged(int))); connect(bbox, SIGNAL(accepted()), dlg, SLOT(accept())); connect(bbox, SIGNAL(rejected()), dlg, SLOT(reject())); connect(btnAdvanced, SIGNAL(clicked()), dlg, SLOT(AdvancedFeatures())); this->PerfLevelChanged(int(lvl)); } enum PerformanceLevel BasicSettingsDlg::GetPerformanceLevel() const { return static_cast(this->slPerf->value()); } bool BasicSettingsDlg::GetUseAdvancedSettings() const { return useAdvanced; } void BasicSettingsDlg::PerfLevelChanged(int level) { std::ostringstream help; help << level << ": "; PerformanceLevel pflvl = static_cast(level); switch(pflvl) { case MAX_RESPONSIVENESS: help << "Favor fast response time and display more intermediate results." " This makes ImageVis3D feel more 'lightweight', but it will " "take more time to reach the highest resolution version."; break; case MIDDLE_1: help << "Provide an even balance between response time and performance."; break; case MAX_PERFORMANCE: help << "Favor maximum performance over intermediate results. This " "minimizes the time ImageVis3D takes to reach the final, " "maximum-resolution rendering, but ImageVis3D may feel more " "sluggish while e.g. changing the transfer function."; break; } this->lDesc->setText(help.str().c_str()); } void BasicSettingsDlg::AdvancedFeatures() { this->useAdvanced = true; this->reject(); } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/ImageVis3D/UI/RenderWindowGL.h0000644000175000017500000001276412320517543020507 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : RenderWindowGL.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #pragma once #ifndef RENDERWINDOWGL_H #define RENDERWINDOWGL_H #include "../Tuvok/Controller/MasterController.h" #include "../Tuvok/Basics/ArcBall.h" #include #include #include "RenderWindow.h" #include #include "../Tuvok/LuaScripting/LuaScripting.h" #include "../Tuvok/LuaScripting/LuaClassRegistration.h" class MainWindow; class RenderWindowGL : public QGLWidget, public RenderWindow { Q_OBJECT public: RenderWindowGL(tuvok::MasterController& masterController, tuvok::MasterController::EVolumeRendererType eType, const QString& dataset, unsigned int iCounter, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder, QGLWidget* glShareWidget, const QGLFormat& fmt, QWidget* parent, Qt::WindowFlags flags); virtual ~RenderWindowGL(); static const std::string& GetExtString() {return ms_glExtString;} virtual void SetBlendPrecision( tuvok::AbstrRenderer::EBlendPrecision eBlendPrecisionMode); virtual void UpdateWindow() {updateGL();} virtual void InitializeContext() { glInit(); } protected: virtual void ToggleFullscreen(); virtual void PaintOverlays(); virtual void RenderSeparatingLines(); virtual void SwapBuffers(); private: virtual void InitializeRenderer(); bool SetNewRenderer(bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder); static std::string ms_glExtString; // **************** Qt widget connector calls protected: virtual void ForceRepaint(); virtual QWidget* GetQtWidget() {return this;} virtual void EmitStereoDisabled() {emit StereoDisabled();} virtual void EmitRenderWindowViewChanged(int iViewID) { emit RenderWindowViewChanged(iViewID); } virtual void EmitWindowActive() {emit WindowActive(this);} virtual void EmitWindowInActive() {emit WindowInActive(this);} virtual void EmitWindowClosing() {emit WindowClosing(this);} // **************** Qt callbacks public: QSize minimumSizeHint() const {return QSize(m_vMinSize.x, m_vMinSize.y);} QSize sizeHint() const {return QSize(m_vDefaultSize.x, m_vDefaultSize.y);} public slots: virtual void ToggleRenderWindowView2x2() { RenderWindow::ToggleRenderWindowView2x2(); } virtual void ToggleRenderWindowViewSingle() { RenderWindow::ToggleRenderWindowViewSingle(); } virtual void SetTimeSlices(unsigned int iActive, unsigned int iInactive) { RenderWindow::SetTimeSlices(iActive, iInactive); } signals: void StereoDisabled(); void RenderWindowViewChanged(int iViewID); void WindowActive(RenderWindow* sender); void WindowInActive(RenderWindow* sender); void WindowClosing(RenderWindow* sender); protected: virtual void initializeGL() {InitializeRenderer();} virtual void paintGL() {PaintRenderer();} virtual void resizeGL(int width, int height) {ResizeRenderer(width, height);} virtual void mousePressEvent(QMouseEvent *event) {QGLWidget::mousePressEvent(event); MousePressEvent(event);} virtual void mouseReleaseEvent(QMouseEvent *event) {QGLWidget::mouseReleaseEvent(event); MouseReleaseEvent(event);} virtual void mouseMoveEvent(QMouseEvent *event) {QGLWidget::mouseMoveEvent(event); MouseMoveEvent(event);} virtual void wheelEvent(QWheelEvent *event) {QGLWidget::wheelEvent(event); WheelEvent(event);} virtual void closeEvent(QCloseEvent *event) {QGLWidget::closeEvent(event); CloseEvent(event);} virtual void focusInEvent(QFocusEvent * event) {QGLWidget::focusInEvent(event); FocusInEvent(event);} virtual void focusOutEvent ( QFocusEvent * event ) {QGLWidget::focusOutEvent(event); FocusOutEvent(event);} virtual void keyPressEvent ( QKeyEvent * event ) {QGLWidget::keyPressEvent(event); KeyPressEvent(event);} // **************** End Qt callbacks }; #endif // RENDERWINDOWGL_H ImageVis3D-3.1.0/ImageVis3D/UI/LODDlg.h0000644000175000017500000000366712320517543016724 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : LODDlg.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #ifndef LODDLG_H #define LODDLG_H #include "AutoGen/ui_LODDlg.h" #include #include class LODDlg : public QDialog, protected Ui_LODDlg { Q_OBJECT public: LODDlg(QString title, int iMinLOD, int iMaxLOD, const std::vector< QString >& vvLODs, QWidget* parent, Qt::WindowFlags flags = Qt::Tool); virtual ~LODDlg(); int GetLOD() {return verticalSlider_LOD->value();} private slots: void ChangeLOD(int iLOD); private: const std::vector< QString > m_vvLODs; }; #endif // LODDLG_H ImageVis3D-3.1.0/ImageVis3D/UI/LODDlg.cpp0000644000175000017500000000423412320517543017246 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : LODDlg.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #include "LODDlg.h" LODDlg::LODDlg(QString title, int iMinLOD, int iMaxLOD, const std::vector< QString >& vvLODs, QWidget* parent, Qt::WindowFlags flags) : QDialog(parent, flags), m_vvLODs(vvLODs) { setupUi(this); label_Title->setText(title); verticalSlider_LOD->setMinimum(iMinLOD); verticalSlider_LOD->setMaximum(iMaxLOD); verticalSlider_LOD->setValue(iMinLOD); ChangeLOD(iMinLOD); label_lowres->setText(tr("%1 %2").arg(label_lowres->text()).arg(m_vvLODs[m_vvLODs.size()-1])); label_highres->setText(tr("%1 %2").arg(label_highres->text()).arg(m_vvLODs[0])); } LODDlg::~LODDlg(void) { } void LODDlg::ChangeLOD(int iLOD) { label_selectRes->setText(tr("Selected Resolution %1").arg(m_vvLODs[iLOD-verticalSlider_LOD->minimum()])); } ImageVis3D-3.1.0/ImageVis3D/UI/ImageVis3D_Stereo.cpp0000644000175000017500000000675412320517543021426 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : ImageVis3D_Progress.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : November 2008 // //! Copyright (C) 2008 SCI Institute #include "ImageVis3D.h" #include using namespace std; using namespace tuvok; void MainWindow::ToggleStereoRendering() { if (m_pActiveRenderWin) { if (m_pActiveRenderWin->GetViewMode() != RenderWindow::VM_SINGLE || !m_pActiveRenderWin->IsRegion3D(m_pActiveRenderWin->GetActiveRenderRegions()[0])) { QString strText = "Stereo rendering is only available in single view 3D mode. Do you want to change to that view now?"; if (QMessageBox::Yes == QMessageBox::question(this, "3D Stereo", strText, QMessageBox::Yes, QMessageBox::No)) { if (!m_pActiveRenderWin->SetRenderWindowView3D()) { QMessageBox::information(this, "3D Stereo", "Unable to switch to 3D view, aborting stereo."); checkBox_Stereo->setChecked(false); return; } } else { checkBox_Stereo->setChecked(false); return; } } m_pActiveRenderWin->SetRendererStereoEnabled(checkBox_Stereo->isChecked()); } else { checkBox_Stereo->setChecked(false); } } void MainWindow::SetStereoEyeDistance() { if (m_pActiveRenderWin == NULL) return; m_pActiveRenderWin->SetRendererStereoEyeDist(float(horizontalSlider_EyeDistance->value())/100.0); } void MainWindow::SetStereoFocalLength() { if (m_pActiveRenderWin == NULL) return; m_pActiveRenderWin->SetRendererStereoFocalLength(float(horizontalSlider_FocalLength->value())/10.0); } void MainWindow::ToggleStereoMode() { if (m_pActiveRenderWin == NULL) return; if (radioButton_RBStereo->isChecked()) m_pActiveRenderWin->SetRendererStereoMode(AbstrRenderer::SM_RB); else if (radioButton_ScanlineStereo->isChecked()) m_pActiveRenderWin->SetRendererStereoMode(AbstrRenderer::SM_SCANLINE); else if (radioButton_SideBySide->isChecked()) m_pActiveRenderWin->SetRendererStereoMode(AbstrRenderer::SM_SBS); else m_pActiveRenderWin->SetRendererStereoMode(AbstrRenderer::SM_AF); } void MainWindow::ToggleStereoEyeSwap() { if (m_pActiveRenderWin == NULL) return; m_pActiveRenderWin->SetRendererStereoEyeSwap(checkBox_EyeSwap->isChecked()); } ImageVis3D-3.1.0/ImageVis3D/UI/AboutDlg.cpp0000644000175000017500000000404612320517543017703 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : AboutDlg.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : January 2009 // //! Copyright (C) 2009 SCI Institute #include "AboutDlg.h" AboutDlg::AboutDlg(QString title, QString desc, QWidget* parent, Qt::WindowFlags flags) : QDialog(parent, flags) { setupUi(this); label_logo->setPixmap(QPixmap::fromImage(QImage(":/Resources/imagevis3d.png"))); setWindowTitle(title); label_AboutText->setText(desc); } AboutDlg::~AboutDlg(void) { } void AboutDlg::CheckUpdates() { accept(); emit CheckUpdatesClicked(); } void AboutDlg::OnlineVideoTut() { accept(); emit OnlineVideoTutClicked(); } void AboutDlg::OnlineHelp() { accept(); emit OnlineHelpClicked(); } void AboutDlg::ReportABug() { accept(); emit ReportABugClicked(); } ImageVis3D-3.1.0/ImageVis3D/UI/ImageVis3D_DebugWindow.cpp0000644000175000017500000002124512320517543022373 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : ImageVis3D_DebugWindow.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : September 2008 // //! Copyright (C) 2008 SCI Institute #include #include "../Tuvok/Basics/SystemInfo.h" #include "../Tuvok/Basics/SysTools.h" #include "../Tuvok/Renderer/GPUMemMan/GPUMemMan.h" #include "../Tuvok/IO/IOManager.h" // Needed for tConverterFormat. #include "ImageVis3D.h" #include using namespace std; void MainWindow::ShowVersions() { std::ostringstream versions; versions << "Tuvok Version: " << TUVOK_VERSION << " " << TUVOK_VERSION_TYPE << " " << TUVOK_DETAILS << "\n" #ifdef TUVOK_SVN_VERSION << "SVN Version: " << int(TUVOK_SVN_VERSION) << "\n " #endif << "ImageVis3D Version: " << IV3D_VERSION " " << IV3D_VERSION_TYPE << " " #ifdef IV3D_SVN_VERSION << "\nSVN Version: " << int(IV3D_SVN_VERSION) << "\n " #endif << "Qt Version: " << QT_VERSION_STR; m_MasterController.DebugOut()->printf(versions.str().c_str()); } void MainWindow::ShowGPUInfo(bool bWithExtensions) { #if defined(_WIN32) && defined(USE_DIRECTX) if (DynamicDX::IsInitialized()) { std::ostringstream d3dver; d3dver << "Direct3DX10 Version " << DynamicDX::GetD3DX10Version(); m_MasterController.DebugOut()->printf(d3dver.str().c_str()); } else m_MasterController.DebugOut()->printf("DirectX 10 not initialzed"); #endif if (RenderWindow::GetVendorString() == "") { m_MasterController.DebugOut()->printf("For the GL specs please open a GL renderwindow first!"); } else { AbstrDebugOut *dbg = m_MasterController.DebugOut(); dbg->printf(RenderWindow::GetVendorString().c_str()); { std::ostringstream tex_size; tex_size << "Maximum Volume size " << int(RenderWindow::GetMax3DTexDims()) << ((RenderWindow::Get3DTexInDriver()) ? " via 3D textures" : " via 2D texture stacks"); dbg->printf(tex_size.str().c_str()); } if (RenderWindow::GetImageLoadStoreInDriver()) { m_MasterController.DebugOut()->printf("Image Load/Store supported"); } else { m_MasterController.DebugOut()->printf("Image Load/Store NOT supported"); } if (RenderWindow::GetConservativeDepthInDriver()) { m_MasterController.DebugOut()->printf("Conservative Depth Optimization supported"); } else { m_MasterController.DebugOut()->printf("Conservative Depth Optimization NOT supported"); } if (!bWithExtensions) return; if (RenderWindowGL::GetExtString() != "") { m_MasterController.DebugOut()->printf("Supported GL extensions:"); vector< string > vExtensions = SysTools::Tokenize(RenderWindowGL::GetExtString()); std::ostringstream ext; for (size_t i = 0;iprintf(ext.str().c_str()); } } } void MainWindow::ListSupportedImages() { shared_ptr ss(m_MasterController.LuaScript()); m_MasterController.DebugOut()->printf("Supported image formats are:"); ss->cexec("print", "Supported image formats are:"); QList listImageFormats = QImageReader::supportedImageFormats(); for (int i = 0;iprintf(strImageFormat.c_str()); ss->cexec("print", strImageFormat); } } void MainWindow::ListSupportedVolumes() { shared_ptr ss(m_MasterController.LuaScript()); m_MasterController.DebugOut()->printf("Supported Volume formats are:"); ss->cexec("print", "Supported volume formats are:"); std::vector conv = ss->cexecRet>("tuvok.io.getFormatList"); for (size_t i=0; i < conv.size(); i++) { string strVolumeFormats = " " + std::get<0>(conv[i]) + " " + std::get<1>(conv[i]); if (!std::get<2>(conv[i])) strVolumeFormats += " (Readonly)"; if (!std::get<3>(conv[i])) strVolumeFormats += " (Writeonly)"; m_MasterController.DebugOut()->printf(strVolumeFormats.c_str()); ss->cexec("print", strVolumeFormats); } } void MainWindow::ListSupportedGeometry() { shared_ptr ss(m_MasterController.LuaScript()); m_MasterController.DebugOut()->printf("Supported Geometry formats are:"); ss->cexec("print", "Supported geometry formats are:"); std::vector conv = ss->cexecRet>("tuvok.io.getGeoFormatList"); for (size_t i=0; i < conv.size(); i++) { string strGeoFormats = " " + std::get<0>(conv[i]) + " " + std::get<1>(conv[i]); if (!std::get<2>(conv[i])) strGeoFormats += " (Readonly)"; if (!std::get<3>(conv[i])) strGeoFormats += " (Writeonly)"; m_MasterController.DebugOut()->printf(strGeoFormats.c_str()); ss->cexec("print", strGeoFormats); } } void MainWindow::ShowSysInfo() { std::ostringstream sysinfo; const GPUMemMan *mm = m_MasterController.MemMan(); const size_t one_megabyte = 1024*1024; uint64_t cpu_mem = mm->GetCPUMem(); uint64_t max_cpu_mem = m_MasterController.SysInfo()->GetMaxUsableCPUMem(); sysinfo << "This is a " << m_MasterController.MemMan()->GetBitWidthMem() << "bit build\n" << "CPU Memory: Total " << cpu_mem / one_megabyte << " MB, " << "Usable " << max_cpu_mem << "MB\n" << " Used: " << mm->GetAllocatedCPUMem()/one_megabyte << " MB " << "(" << mm->GetAllocatedCPUMem() << " bytes)\n"; if (m_MasterController.MemMan()->GetAllocatedCPUMem() < m_MasterController.MemMan()->GetCPUMem()) { sysinfo << " Available: " << (mm->GetCPUMem() - mm->GetAllocatedCPUMem())/one_megabyte << "\n"; } sysinfo << "GPU Memory: Total " << mm->GetGPUMem()/one_megabyte << " MB, " << "Usable " << m_MasterController.SysInfo()->GetMaxUsableGPUMem()/one_megabyte << " Used: " << mm->GetAllocatedGPUMem()/one_megabyte << " MB (" << mm->GetAllocatedGPUMem() << " Bytes)"; if (m_MasterController.MemMan()->GetAllocatedGPUMem() < m_MasterController.MemMan()->GetGPUMem()) { sysinfo << " Available: " << (mm->GetGPUMem() - mm->GetAllocatedGPUMem())/one_megabyte << "\n"; } m_MasterController.DebugOut()->printf(sysinfo.str().c_str()); } void MainWindow::ClearDebugWin() { listWidget_DebugOut->clear(); } void MainWindow::SetDebugViewMask() { m_MasterController.DebugOut()->SetOutput(checkBox_ShowDebugErrors->isChecked(), checkBox_ShowDebugWarnings->isChecked(), checkBox_ShowDebugMessages->isChecked(), checkBox_ShowDebugOther->isChecked()); } void MainWindow::GetDebugViewMask() { bool bShowErrors; bool bShowWarnings; bool bShowMessages; bool bShowOther; m_MasterController.DebugOut()->GetOutput(bShowErrors, bShowWarnings, bShowMessages, bShowOther); checkBox_ShowDebugErrors->setChecked(bShowErrors); checkBox_ShowDebugWarnings->setChecked(bShowWarnings); checkBox_ShowDebugMessages->setChecked(bShowMessages); checkBox_ShowDebugOther->setChecked(bShowOther); } ImageVis3D-3.1.0/ImageVis3D/UI/FTPDialog.cpp0000644000175000017500000001123612320517543017752 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : FTPDialog.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : December 2008 // //! Copyright (C) 2008 SCI Institute #include "FTPDialog.h" #include #include #include #include "../Tuvok/Basics/SysTools.h" #include "../Tuvok/Controller/Controller.h" using namespace std; FTPDialog::FTPDialog(const string& strSource, const string& strTargetServer, const string& strTargetPath, QWidget* parent /* = 0 */, Qt::WindowFlags flags /* = 0 */) : QDialog(parent, flags), m_strSource(strSource), m_strTargetServer(strTargetServer), m_strTargetPath(strTargetPath), m_pFtp(NULL) { setupUi(this); } FTPDialog::~FTPDialog(void) { Disconnect(); } void FTPDialog::Start() { show(); m_pFtp = new QFtp(this); connect(m_pFtp, SIGNAL(commandFinished(int, bool)), this, SLOT(ftpCommandFinished(int, bool))); connect(m_pFtp, SIGNAL(dataTransferProgress(qint64, qint64)), this, SLOT(updateDataTransferProgress(qint64, qint64))); connect(m_pFtp, SIGNAL(done(bool)), this, SLOT(finished(bool))); label_TransferDesc->setText(tr("Connecting to %1...").arg(m_strTargetServer.c_str())); QUrl url(m_strTargetServer.c_str()); if (!url.isValid() || url.scheme().toLower() != QLatin1String("ftp")) { m_pFtp->connectToHost(m_strTargetServer.c_str(), 21); m_pFtp->login(); } else { m_pFtp->connectToHost(url.host(), url.port(21)); if (!url.userName().isEmpty()) { m_pFtp->login(QUrl::fromPercentEncoding(url.userName().toLatin1()), url.password()); } else { m_pFtp->login(); } if (!url.path().isEmpty()) { m_pFtp->cd(url.path()); } } m_pFile = new QFile(m_strSource.c_str()); if (!m_pFile->open(QIODevice::ReadOnly)) { T_ERROR("Could not read '%s' file.", m_strSource.c_str()); delete m_pFile; m_pFile = NULL; emit TransferFailure(); close(); return; } MESSAGE("putting '%s' to '%s'", m_strSource.c_str(), m_strTargetPath.c_str()); m_pFtp->put(m_pFile, m_strTargetPath.c_str()); } void FTPDialog::ftpCommandFinished(int cmdId, bool error) { if (cmdId == QFtp::ConnectToHost) { if (error) { T_ERROR("Error connecting to host: %s", m_pFtp->errorString().toStdString().c_str()); m_pFile->close(); delete m_pFile; m_pFile = NULL; emit TransferFailure(); close(); return; } label_TransferDesc->setText(tr("Uploading %1...").arg(SysTools::GetFilename(m_strSource).c_str())); return; } } void FTPDialog::updateDataTransferProgress(qint64 readBytes, qint64 totalBytes) { progressBar->setMaximum(totalBytes); progressBar->setValue(readBytes); } void FTPDialog::Disconnect() { if (m_pFtp) { m_pFtp->abort(); m_pFtp->deleteLater(); m_pFtp = NULL; } } void FTPDialog::AbortTransfer() { m_pFile->close(); delete m_pFile; m_pFile = NULL; Disconnect(); emit TransferFailure(); close(); } void FTPDialog::finished(bool error) { if (error) { T_ERROR("Error putting data on the remote host."); m_pFile->close(); delete m_pFile; m_pFile = NULL; emit TransferFailure(); close(); return; } else { MESSAGE("File transfer complete."); m_pFile->close(); delete m_pFile; m_pFile = NULL; emit TransferSuccess(); close(); return; } } ImageVis3D-3.1.0/ImageVis3D/UI/BasicSettingsDlg.h0000644000175000017500000001021412320517543021032 0ustar mathieumathieu#ifndef IV3D_BASIC_SETTINGS_DLG_H #define IV3D_BASIC_SETTINGS_DLG_H #include #include "Basics/Vectors.h" class QLabel; class QSlider; namespace tuvok { class MasterController; } enum PerformanceLevel { MAX_RESPONSIVENESS=0, MIDDLE_1, MAX_PERFORMANCE, }; class BasicSettingsDlg : public QDialog { Q_OBJECT public: BasicSettingsDlg(tuvok::MasterController& masterController, enum PerformanceLevel defaultLevel = MAX_RESPONSIVENESS, QWidget* parent = 0, Qt::WindowFlags flags = 0); virtual ~BasicSettingsDlg(); enum PerformanceLevel GetPerformanceLevel() const; bool GetUseAdvancedSettings() const; void Data2Form(bool bIsDirectX10Capable, uint64_t iMaxCPU, uint64_t iMaxGPU, bool bIgnoreMax, unsigned int iUserMaxCPUMB, unsigned int iUserMaxGPUMB, const std::string& tempDir, bool bQuickopen, unsigned int iMinFramerate, bool bRenderLowResIntermediateResults, unsigned int iLODDelay, unsigned int iActiveTS, unsigned int iInactiveTS, bool bWriteLogFile, bool bShowCrashDialog, const std::string& strLogFileName, uint32_t iLogLevel, bool bShowVersionInTitle, bool bAutoSaveGEO, bool bAutoSaveWSP, bool bAutoLockClonedWindow, bool bAbsoluteViewLocks, bool bCheckForUpdatesOnStartUp, bool bCheckForDevBuilds, bool bShowWelcomeScreen, bool bInvWheel, bool bI3MFeatures, unsigned int iVolRenType, unsigned int iBlendPrecision, bool bPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder, const FLOATVECTOR3& vBackColor1, const FLOATVECTOR3& vBackColor2, const FLOATVECTOR4& vTextColor, const QString& strLogo, int iLogoPos, unsigned int iMaxBrickSize, unsigned int iBuilderBrickSize, unsigned int iMaxMaxBrickSize, bool bMedianFilter, bool bClampToEdge, uint32_t iCompression, bool expFeatures, bool advFeatures); protected slots: void PerfLevelChanged(int level); void AdvancedFeatures(); private: tuvok::MasterController& ctlr; QLabel* lDesc; // so we can change it in handlers. QSlider* slPerf; bool useAdvanced; void setupUI(QDialog *BasicSettingsDlg, enum PerformanceLevel); }; #endif /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/ImageVis3D/UI/ImageVis3D.h0000644000175000017500000005075312320517543017550 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : ImageVis3D.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : September 2008 // //! Copyright (C) 2008 SCI Institute #pragma once #ifndef IMAGEVIS3D_H #define IMAGEVIS3D_H #include #include #include class ExtendedPlane; class TextfileOut; #include "AutoGen/ui_ImageVis3D.h" #include "RenderWindowGL.h" #if defined(_WIN32) && defined(USE_DIRECTX) #include "RenderWindowDX.h" #endif #include "QLightPreview.h" #include "Q1DTransferFunction.h" #include "Q2DTransferFunction.h" #include "DebugOut/QTOut.h" #include #include #include #include "DebugScriptWindow.h" #include "../Tuvok/LuaScripting/LuaScripting.h" #include "../Tuvok/LuaScripting/LuaClassRegistration.h" #include "../Tuvok/LuaScripting/LuaMemberReg.h" class QDragEnterEvent; class QDropEvent; class QHttp; class QHttpResponseHeader; class QFile; class QTimer; class FTPDialog; class PleaseWaitDialog; class ScaleAndBiasDlg; static const int IV3D_TIMER_INTERVAL = 20; // in milliseconds class MainWindow : public QMainWindow, protected Ui_MainWindow { Q_OBJECT public: MainWindow(MasterController& masterController, bool bScriptMode = false, // suppress dialog boxes QWidget* parent = 0, Qt::WindowFlags flags = 0); virtual ~MainWindow(); QTOut* GetDebugOut() {return m_pDebugOut;} bool StayOpen() const {return m_bStayOpenAfterScriptEnd;} /// Starts the internal timer, used for checking if we should continue /// rendering. void StartTimer(); const std::string& GetTempDir() {return m_strTempDir;} // Lua function binding /// Member function constructor for RenderWindowGL. RenderWindow* LuaCreateNewWindow(std::string dataset); void LuaResizeActiveWindow(const UINTVECTOR2& newSize); void LuaPlaceActiveWindow(const UINTVECTOR2& position); void closeMDISubWindowWithWidget(QWidget* widget); // Lua callback functions (called from Lua when actions are undone/redone). void LuaCallbackToggleClipPlane(bool bClip); // directly loads the TFqn; used for Lua scripting. void LoadTransferFunction1D(const std::string& tf); void LoadTransferFunction2D(const std::string& tf); bool RunLuaScript(const std::string& strFilename); public slots: void SetRenderProgressAnUpdateInfo(unsigned int iLODCount, unsigned int iCurrentCount, unsigned int iBrickCount, unsigned int iWorkingBrick, unsigned int iMinLODIndex, RenderWindow* pRenderWin); protected slots: void dragEnterEvent(QDragEnterEvent*); void dropEvent(QDropEvent*); void TransferToI3M(); void FtpFail(); void FtpSuccess(); void SetCaptureFilename(); void CaptureFrame(); void CaptureSequence(); void CaptureRotation(); void LoadDataset(); void LoadDataset(std::string strFilename); void LoadDirectory(); void AddGeometry(); void ExportGeometry(); void RemoveGeometry(); void CloseCurrentView(); void ResizeCurrentView(int iSizeX, int iSizeY); void PlaceCurrentView(int iPosX, int iPosY); void CloneCurrentView(); void CheckForUpdates(); void OnlineHelp(); void OpenManual(); void OnlineVideoTut(); void GetExampleData(); void CloseWelcome(); void ReportABug(); void ToggleRenderWindowView2x2(); void ToggleRenderWindowViewSingle(); void Use1DTrans(); void Use2DTrans(); void UseIso(); void DisableAllTrans(); void Invert1DTransComp(); void Transfer1DSetColors(); void Transfer1DSetGroups(); void Transfer1DLoad(); bool Transfer1DLoad(std::string strFilename); void Transfer1DSave(); void Transfer1DCopyTo2DTrans(); void Populate1DTFLibList(); void Transfer1DAddToLib(); void Transfer1DSetFromLib(); void Transfer1DAddFromLib(); void Transfer1DSubFromLib(); void Transfer1DConfigureLib(); void Transfer2DAddGradient(); void Transfer2DDeleteGradient(); void Transfer2DChooseGradientColor(); void Transfer2DChooseGradientOpacity(); void Transfer2DChooseGradientColorSimpleUI(); void Transfer2DChooseGradientOpacitySimpleUI(); void Transfer2DToggleGradientType(); void Transfer2DLoad(); bool Transfer2DLoad(std::string strFilename); void Transfer2DSave(); void Transfer2DToggleTFMode(); void SetUpdateMode(); void SetTagVolume(); void ApplyUpdate(); void Transfer2DSwatchesChanged(); void Transfer2DSwatcheTypeChanged(int i); void Transfer2DUpdateSwatchButtons(); void Transfer2DUpdateGradientType(); void Transfer2DUpdateGradientBox(); void Transfer2DUpdateGradientButtons(); void SetHistogramScale1D(int v); void SetHistogramScale2D(int v); bool LoadWorkspace(); bool SaveWorkspace(); bool ApplyWorkspace(); bool LoadGeometry(); bool SaveGeometry(); void OpenRecentFile(); void OpenRecentWSFile(); void ClearMRUList(); void ClearWSMRUList(); void UpdateMenus(); void ExportDataset(); void MergeDatasets(); bool ExportDataset(uint32_t iLODLevel, std::string targetFileName); void ExportIsosurface(); bool ExportIsosurface(uint32_t iLODLevel, std::string targetFileName); void ExportImageStack(); bool ExportImageStack(uint32_t iLODLevel, std::string targetFileName, bool bAllDirs); void RenderWindowActive(RenderWindow* sender); void RenderWindowClosing(RenderWindow* sender); void StereoDisabled(); void RenderWindowViewChanged(int iMode); void EnableStereoWidgets(); void DisableStereoWidgets(); void ShowVersions(); void ShowGPUInfo(bool bWithExtensions); void ShowSysInfo(); void ListSupportedImages(); void ListSupportedVolumes(); void ListSupportedGeometry(); void ClearDebugWin(); void SetDebugViewMask(); void CheckForRedraw(); bool ShowAdvancedSettings(bool bInitializeOnly); bool ShowBasicSettings(bool initOnly); bool ShowSettings(bool initOnly=false); void SetLighting(bool bLighting); void ToggleLighting(); void Collapse2DWidgets(); void Expand2DWidgets(); void SetSampleRate(int iValue); void SetFoV(int iValue); void SetFoVSlider(int iValue); void SetIsoValue(float fValue); void SetIsoValue(int iValue); void SetClearViewIsoValue(float fValue); void ToggleGlobalBBox(bool bRenderBBox); void ToggleLocalBBox(bool bRenderBBox); void ToggleClipPlane(bool); void ClipToggleLock(bool); void ClipToggleShow(bool); void CropData(); void SetTimestep(int); void SetTimestepSlider(int iValue, int iMaxValue); void UpdateTimestepLabel(int iValue, int iMaxValue); void ResetTimestepUI(); void SetStayOpen(bool bStayOpenAfterScriptEnd); void SetRescaleFactors(); virtual void closeEvent(QCloseEvent *event); // update void httpRequestFinished(int requestId, bool error); void readResponseHeader(const QHttpResponseHeader &responseHeader); void UploadLogToServer(); void ShowAbout(); void ChooseIsoColor(); void ToggleFullscreen(); void ToggleClearView(); void SetFocusIsoValue(int iValue); void ChooseFocusColor(); void SetFocusSize(int iValue); void SetContextScale(int iValue); void SetBorderSize(int iValue); void UpdateLockView(); void LockModalityChange(); void ChangeLocks(); void ToggleStereoRendering(); void ToggleStereoMode(); void ToggleStereoEyeSwap(); void SetStereoEyeDistance(); void SetStereoFocalLength(); void Show1DTrans(); void Show2DTrans(); void ShowIsoEdit(); void PreserveTransparencyChanged(); void ShowWelcomeScreen(); void DisplayMetadata(); void SaveDefaultWorkspace(); void SaveDefaultGeometry(); void SaveAspectRatioToUVF(); void MinLODLimitChanged(); void MaxLODLimitChanged(); void PickLightColor(); void ChangeLightColors(); void LightMoved(); void UpdateExplorerView() {UpdateExplorerView(false);} void ToggleMesh(); void SetMeshDefColor(); void SetMeshDefOpacity(); void SetMeshScaleAndBias(); void SaveMeshTransform(ScaleAndBiasDlg* sender); void RestoreMeshTransform(ScaleAndBiasDlg* sender); void ApplMeshTransform(ScaleAndBiasDlg* sender); void ApplyMatrixMeshTransform(ScaleAndBiasDlg* sender); private : QTimer* m_pRedrawTimer; MasterController& m_MasterController; QString m_strCurrentWorkspaceFilename; Q1DTransferFunction* m_1DTransferFunction; Q2DTransferFunction* m_2DTransferFunction; QLightPreview* m_pQLightPreview; QGLWidget* m_glShareWidget; QTOut* m_pDebugOut; static const unsigned int ms_iMaxRecentFiles = 5; QAction* m_recentFileActs[ms_iMaxRecentFiles]; QAction* m_recentWSFileActs[ms_iMaxRecentFiles]; FLOATVECTOR3 m_vBackgroundColors[2]; FLOATVECTOR4 m_vTextColor; std::string m_strTempDir; bool m_bShowVersionInTitle; bool m_bQuickopen; unsigned int m_iMinFramerate; unsigned int m_iLODDelay; bool m_bRenderLowResIntermediateResults; unsigned int m_iActiveTS; unsigned int m_iInactiveTS; bool m_bWriteLogFile; QString m_strLogFileName; unsigned int m_iLogLevel; WelcomeDialog* m_pWelcomeDialog; MetadataDlg* m_pMetadataDialog; DebugScriptWindow* m_pDebugScriptWindow; unsigned int m_iBlendPrecisionMode; bool m_bPowerOfTwo; bool m_bDownSampleTo8Bits; bool m_bDisableBorder; bool m_bI3MFeatures; bool m_bAdvancedSettings; bool m_bAutoSaveGEO; bool m_bAutoSaveWSP; MasterController::EVolumeRendererType m_eVolumeRendererType; bool m_bUpdatingLockView; QString m_strLogoFilename; int m_iLogoPos; bool m_bAutoLockClonedWindow; bool m_bAbsoluteViewLocks; bool m_bCheckForUpdatesOnStartUp; bool m_bCheckForDevBuilds; bool m_bShowWelcomeScreen; bool m_bInvWheel; bool m_bStayOpenAfterScriptEnd; void AddGeometry(std::string filename); RenderWindow* WidgetToRenderWin(QWidget* w); RenderWindow* CreateNewRenderWindow(QString dataset); bool CheckRenderwindowFitness(RenderWindow *renderWin, bool bIfNotOkShowMessageAndCloseWindow=true); void SetupWorkspaceMenu(); bool LoadWorkspace(QString strFilename, bool bSilentFail = false, bool bRetryResource = true); bool SaveWorkspace(QString strFilename); bool LoadGeometry(QString strFilename, bool bSilentFail = false, bool bRetryResource = true); bool SaveGeometry(QString strFilename); bool LoadDefaultWorkspace(); bool LoadDefaultGeometry(); void SetTitle(); void setupUi(QMainWindow *MainWindow); void UpdateWSMRUActions(); void AddFileToWSMRUList(const QString &fileName); void UpdateMRUActions(); void AddFileToMRUList(const QString &fileName); void GetDebugViewMask(); bool LoadDataset(const std::vector< std::string >& strParams); bool LoadDataset(QStringList fileName, QString targetFileName="", bool bNoUserInteraction=false); bool LoadDatasetInternal(QStringList files, QString targetFilename, bool bNoUserInteraction); RenderWindow* LuaLoadDatasetInternal(std::vector filename, std::string targetFileName, bool bNoUserInteraction); bool RebrickDataset(QString filename, QString targetFilename, bool bNoUserInteraction); QString GetConvFilename(const QString& sourceName = ""); void InitDockWidget(QDockWidget * v) const; void InitAllWorkspaces(); void CheckSettings(); void ApplySettings(); void ApplySettings(RenderWindow* renderWin); void SaveSettings( uint64_t CPUMem, uint64_t maxCPU, uint64_t GPUMem, uint64_t maxGPU, bool ignoreMax, const std::string& tempDir, bool checksum, unsigned framerate, bool lowResSubframes, unsigned LODDelay, unsigned activeTS, unsigned inactiveTS, bool writeLog, bool showCrashDialog, const std::string& logFile, uint32_t logLevel, bool showVersion, bool autoSaveGeo, bool autoSaveWSP, bool autoLockCloned, bool absoluteLocks, bool checkForUpdates, bool checkForDevBuilds, bool showWelcome, bool invertWheel, bool i3mFeatures, unsigned volRenType, unsigned blendPrecision, bool powerTwo, bool downsampleTo8, bool disableBorder, const FLOATVECTOR3& backColor1, const FLOATVECTOR3& backColor2, const FLOATVECTOR4& textColor, const QString& logo, int logoPosition, unsigned maxBrickSize, unsigned builderBrickSize, bool medianFilter, bool clampToEdge, uint32_t compression, uint32_t compressionLevel, bool experimentalFeatures, bool advancedSettings, uint32_t layout ); void SetSampleRateSlider(int iValue); void UpdateSampleRateLabel(int iValue); void UpdateFoVLabel(int iValue); void SetIsoValueSlider(int iValue, int iMaxValue); void UpdateIsoValLabel(int iValue, int iMaxValue); void SetToggleGlobalBBoxLabel(bool bRenderBBox); void SetToggleLocalBBoxLabel(bool bRenderBBox); void SetToggleClipEnabledLabel(bool); void SetToggleClipShownLabel(bool); void SetToggleClipLockedLabel(bool); void ClearProgressViewAndInfo(); void ToggleClearViewControls(); void ToggleClearViewControls(int iRange); void SetFocusIsoValueSlider(int iValue, int iMaxValue); void UpdateFocusIsoValLabel(int iValue, int iMaxValue); void SetFocusSizeValueSlider(int iValue); void SetContextScaleValueSlider(int iValue); void SetBorderSizeValueSlider(int iValue); void CompareFiles(const std::string& strFile1, const std::string& strFile2) const; void RemoveAllLocks(RenderWindow* sender); void RemoveAllLocks(RenderWindow* sender, size_t iLockType); bool SetLock(size_t iLockType, RenderWindow* winA, RenderWindow* winB); bool IsLockedWith(size_t iLockType, RenderWindow* winA, RenderWindow* winB); bool CaptureFrame(const std::string& strTargetName); bool CaptureSequence(const std::string& strTargetName, std::string* strRealFilename=NULL); void RotateCurrentViewX(double angle); void RotateCurrentViewY(double angle); void RotateCurrentViewZ(double angle); void TranslateCurrentView(double x, double y, double z); void ResetRenderingParameters(); void ShowInformationDialog(QString strTitle, QString strMessage); void ShowWarningDialog(QString strTitle, QString strMessage); void ShowCriticalDialog(QString strTitle, QString strMessage); void SetAndCheckRunningFlag(); void RemoveRunningFlag(); void ReportABug(const std::string& strFile); void ToggleLogFile(); void UpdatePolyTypeLabel(int iCurrent); void UpdateMinMaxLODLimitLabel(); void UpdateExplorerView(bool bRepopulateListBox); void UpdateTFScaleSliders(); void UpdateInterpolant(); void UpdateColorWidget(); void LuaSetIsoValueFloat(float fValue); void LuaSetIsoValueInteger(int iValue); void LuaMoveProgramWindow(const INTVECTOR2& pos); void LuaResizeProgramWindow(const UINTVECTOR2& size); void RegisterLuaClasses(); std::string ConvertTF(const std::string& strSource1DTFilename, const std::string& strTargetDir, const std::string& strTargetFullFilename, PleaseWaitDialog& pleaseWait); std::string ConvertDataToI3M(LuaClassInstance currentDataset, const std::string& strTargetDir, PleaseWaitDialog& pleaseWait, bool bOverrideExisting); bool ExportGeometry(size_t i, std::string strFilename); TextfileOut* m_pTextout; RenderWindow* ActiveRenderWin(); QMdiSubWindow* ActiveSubWindow(); RenderWindow* m_pActiveRenderWin; RenderWindow* m_pLastLoadedRenderWin; ///< Use with caution -- could have ///< been destroyed. Used to return ///< render window. // update struct VersionNumber { size_t major; size_t minor; size_t patch; size_t svn; ///< revision /// Compares only version #'s, ignores svn revision. ///@{ bool operator ==(const struct VersionNumber &) const; bool operator > (const struct VersionNumber &) const; ///@} /// Converts major/minor/patch into a string. operator std::string() const; }; QHttp* m_pHttp; QFile* m_pUpdateFile; int m_iHttpGetId; bool m_bStartupCheck; bool m_bScriptMode; void CheckForUpdatesInternal(); void QuietCheckForUpdates(); bool GetVersionsFromUpdateFile(const std::string& strFilename, struct VersionNumber& iv3d, struct VersionNumber& tuvok); void DeleteUpdateFile(); bool CheckForMeshCapabilities(bool bNoUserInteraction, QStringList files=QStringList("")); // ftp FTPDialog* m_pFTPDialog; std::string m_strFTPTempFile; bool m_bFTPDeleteSource; bool m_bFTPFinished; bool FtpTransfer(std::string strSource, std::string strDest, bool bDeleteSource = true); std::string GenUniqueName(const std::string& strPrefix, const std::string& strExt="txt"); bool Pack(const std::vector< std::string >& strParams); void SetStereoMode(unsigned int iMode); void SetStereoFocalLength(float fLength); void SetStereoEyeDistance(float fEyeDist); bool m_bClipDisplay; bool m_bClipLocked; bool m_bIgnoreLoadDatasetFailure; tuvok::LuaMemberReg m_MemReg; friend class MergeDlg; }; #endif // IMAGEVIS3D_H ImageVis3D-3.1.0/ImageVis3D/UI/RAWDialog.cpp0000644000175000017500000001147112320517543017753 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : RAWDialog.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : December 2008 // //! Copyright (C) 2008 SCI Institute #include #include "RAWDialog.h" #include "Controller/Controller.h" using namespace std; RAWDialog::RAWDialog(const string& strFilename, uint64_t iFileSize, QWidget* parent /* = 0 */, Qt::WindowFlags flags /* = 0 */) : QDialog(parent, flags), m_strFilename(strFilename), m_iFileSize(iFileSize) { setupUi(this); } RAWDialog::~RAWDialog(void) { } void RAWDialog::setupUi(QDialog *RAWDialog) { Ui_RAWDialog::setupUi(RAWDialog); QString text = tr("Filename: %1").arg(QFileInfo(m_strFilename.c_str()).fileName()); label_srcFilename->setText(text); CheckValues(); ToggleEndianessDialog(); } void RAWDialog::CheckValues() { if (!radioButton_RAW->isChecked()) { label_Information->setText("Can only validate settings in RAW mode."); pushButton_GuessHeader->setEnabled(false); return; } uint64_t iExpectedSize = ComputeExpectedSize(); MESSAGE("expected size: %llu, actual size: %llu", iExpectedSize, m_iFileSize); if (iExpectedSize < m_iFileSize) { label_Information->setText("Settings may work (file is larger then your settings dictate)."); pushButton_GuessHeader->setEnabled(true); } else if (iExpectedSize > m_iFileSize) { label_Information->setText("Settings can not work (file is smaller then your settings dictate)."); pushButton_GuessHeader->setEnabled(false); } else { label_Information->setText("Settings seem to be ok (file has the right size)."); pushButton_GuessHeader->setEnabled(false); } } void RAWDialog::ToggleEndianessDialog() { groupBox_Endianess->setEnabled(!radioButton_Text->isChecked()); } void RAWDialog::GuessHeaderSize() { uint64_t iExpectedSize = ComputeExpectedSize(); if (m_iFileSize >= iExpectedSize) spinBox_HeaderSkip->setValue(m_iFileSize - iExpectedSize); } uint64_t RAWDialog::ComputeExpectedSize() const { return (uint64_t(spinBox_SizeX->value()) * uint64_t(spinBox_SizeY->value()) * uint64_t(spinBox_SizeZ->value()) * this->GetBitWidth()) + uint64_t(spinBox_HeaderSkip->value()); } UINT64VECTOR3 RAWDialog::GetSize() const { return UINT64VECTOR3(uint64_t(spinBox_SizeX->value()) , uint64_t(spinBox_SizeY->value()) , uint64_t(spinBox_SizeZ->value())); } FLOATVECTOR3 RAWDialog::GetAspectRatio() const { return FLOATVECTOR3(float(doubleSpinBox_AspX->value()) , float(doubleSpinBox_AspY->value()) , float(doubleSpinBox_AspZ->value())); } unsigned int RAWDialog::GetBitWidth() const { if(radioButton_8bit->isChecked()) { return 1; } else if(radioButton_16bit->isChecked()) { return 2; } else if(radioButton_32BitInt->isChecked() || radioButton_32BitFloat->isChecked()) { return 4; } else if(radioButton_64BitFloat->isChecked()) { return 8; } return std::numeric_limits::max(); } unsigned int RAWDialog::GetEncoding() const { unsigned int iID = 0; if (radioButton_Text->isChecked()) iID = 1; else if (radioButton_GZIP->isChecked()) iID = 2; else if (radioButton_BZIP2->isChecked()) iID = 3; return iID; } unsigned int RAWDialog::GetHeaderSize() const { return (unsigned int)(spinBox_HeaderSkip->value()); } bool RAWDialog::IsBigEndian() const { return radioButton_BigEnd->isChecked(); } bool RAWDialog::IsSigned() const { return radioButton_Signed->isChecked(); } bool RAWDialog::IsFloat() const { return radioButton_32BitFloat->isChecked() || radioButton_64BitFloat->isChecked(); } ImageVis3D-3.1.0/ImageVis3D/UI/RenderWindow.h0000644000175000017500000005361012320517543020257 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : RenderWindow.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : July 2008 // //! Copyright (C) 2008 SCI Institute #pragma once #ifndef RENDERWINDOW_H #define RENDERWINDOW_H #include "StdDefines.h" #include #include #include #include #include "../Tuvok/Basics/ArcBall.h" #include "../Tuvok/Basics/Plane.h" #include "../Tuvok/Controller/MasterController.h" #include "../Tuvok/Renderer/AbstrRenderer.h" #include "../Tuvok/LuaScripting/LuaScripting.h" #include "../Tuvok/LuaScripting/LuaClassRegistration.h" #include "../Tuvok/LuaScripting/LuaMemberReg.h" class MainWindow; class RenderWindow { public: RenderWindow(tuvok::MasterController& masterController, tuvok::MasterController::EVolumeRendererType eType, const QString& dataset, unsigned int iCounter, QWidget* parent, const UINTVECTOR2& vMinSize = UINTVECTOR2(50, 50), const UINTVECTOR2& vDefaultSize= UINTVECTOR2(512, 512)); virtual ~RenderWindow(); QString GetDatasetName() const {return m_strDataset;} QString GetWindowID() const {return m_strID;} QSize minimumSizeHint() const; QSize sizeHint() const; bool IsRendererValid(); void CheckForRedraw(); void SetRendermode(tuvok::AbstrRenderer::ERenderMode eRenderMode, bool bPropagate=true); tuvok::AbstrRenderer::ERenderMode GetRenderMode() const; void SetColors(FLOATVECTOR3 vTopColor, FLOATVECTOR3 vBotColor, FLOATVECTOR4 vTextColor); void SetLightColors(const FLOATVECTOR4& ambient, const FLOATVECTOR4& diffuse, const FLOATVECTOR4& specular, const FLOATVECTOR3& lightDir); FLOATVECTOR4 GetAmbient(); FLOATVECTOR4 GetDiffuse(); FLOATVECTOR4 GetSpecular(); FLOATVECTOR3 GetLightDir(); void SetInterpolant(tuvok::Interpolant interp); tuvok::Interpolant GetInterpolant(); virtual void SetBlendPrecision(tuvok::AbstrRenderer::EBlendPrecision eBlendPrecisionMode); void SetPerfMeasures(unsigned int iMinFramerate, bool bRenderLowResIntermediateResults, float fScreenResDecFactor, float fSampleDecFactor, unsigned int iLODDelay, unsigned int iActiveTS, unsigned int iInactiveTS); bool CaptureFrame(const std::string& strFilename, bool bPreserveTransparency); // just copies whatever's in the buffer w/o caring if it's done. bool CaptureSubframe(const std::string& strFilename); bool CaptureSequenceFrame(const std::string& strFilename, bool bPreserveTransparency, std::string* strRealFilename=NULL); bool CaptureMIPFrame(const std::string& strFilename, float fAngle, bool bOrtho, bool bFinalFrame, bool bUseLOD, bool bPreserveTransparency, std::string* strRealFilename=NULL); void ToggleHQCaptureMode(); void EnableHQCaptureMode(bool enable); void Translate(const FLOATMATRIX4& mTranslation, tuvok::LuaClassInstance region=tuvok::LuaClassInstance()); void Rotate(const FLOATMATRIX4& mRotation, tuvok::LuaClassInstance region=tuvok::LuaClassInstance()); void SetCaptureRotationAngle(float fAngle); bool IsRenderSubsysOK() const {return m_bRenderSubsysOK;} static const size_t ms_iLockCount = 4; std::vector m_vpLocks[ms_iLockCount]; void SetLogoParams(QString strLogoFilename, int iLogoPos); void SetTranslationDelta(tuvok::LuaClassInstance region, const FLOATVECTOR3& trans, bool bPropagate); void SetRotationDelta(tuvok::LuaClassInstance region, const FLOATMATRIX4& rotDelta, bool bPropagate); void SetClipPlane(tuvok::LuaClassInstance region, const ExtendedPlane &p); void SetClipTranslationDelta(tuvok::LuaClassInstance region, const FLOATVECTOR3& trans, bool, bool); void ClipDelta(float d); void SetClipRotationDelta(tuvok::LuaClassInstance region, const FLOATMATRIX4& rotDelta, bool, bool); void SetPlaneAtClick(const ExtendedPlane& plane, bool propagate=true); void CloneViewState(RenderWindow* other); void FinalizeRotation(tuvok::LuaClassInstance region, bool bPropagate); void FinalizeTranslation(tuvok::LuaClassInstance region, bool bPropagate); void CloneRendermode(RenderWindow* other); void SetAbsoluteViewLock(bool bAbsoluteViewLock); void SetInvMouseWheel(const bool bInvWheel) {m_bInvWheel = bInvWheel;} bool GetInvMouseWheel() const {return m_bInvWheel;} void SetCurrent1DHistScale(const float value); void SetCurrent2DHistScale(const float value); float GetCurrent1DHistScale() const; float GetCurrent2DHistScale() const; void SetUseLighting(bool bLighting, bool bPropagate=true); bool GetUseLighting() const; void SetSampleRateModifier(float fSampleRateModifier, bool bPropagate=true); void SetFoV(float fFoV, bool bPropagate=true); void SetIsoValue(float fIsoVal, bool bPropagate=true); void SetIsoValueRelative(float isoval, bool propagate); void SetCVIsoValue(float fIsoVal, bool bPropagate=true); void SetCVSize(float fSize, bool bPropagate=true); void SetCVContextScale(float fScale, bool bPropagate=true); void SetCVBorderScale(float fScale, bool bPropagate=true); void SetGlobalBBox(bool bRenderBBox, bool bPropagate=true); void SetLocalBBox(bool bRenderBBox, bool bPropagate=true); void SetClipPlaneEnabled(bool, bool bPropagate = true); void SetClipPlaneDisplayed(bool, bool bPropagate = true); void SetClipPlaneRelativeLock(bool, bool bPropagate = true); void SetIsosurfaceColor(const FLOATVECTOR3& vIsoColor, bool bPropagate=true); void SetCVColor(const FLOATVECTOR3& vIsoColor, bool bPropagate=true); void SetCV(bool bDoClearView, bool bPropagate=true); void SetCVFocusPos(tuvok::LuaClassInstance region, const INTVECTOR2& vMousePos, bool bPropagate=true); void SetTimestep(size_t, bool=true); /// @return the range of the currently loaded dataset std::pair GetDynamicRange() const; FLOATVECTOR3 GetIsosurfaceColor() const; FLOATVECTOR3 GetCVColor() const; static const std::string& GetVendorString() {return ms_gpuVendorString;} static uint32_t GetMax3DTexDims() {return ms_iMaxVolumeDims;} static bool Get3DTexInDriver() {return ms_b3DTexInDriver;} static bool GetImageLoadStoreInDriver() { return ms_bImageLoadStoreInDriver; } static bool GetConservativeDepthInDriver() { return ms_bConservativeDepthInDriver; } virtual QWidget* GetQtWidget() = 0; virtual void ToggleFullscreen() = 0; virtual void UpdateWindow() = 0; /// Ensures context has been created, without performing a render. virtual void InitializeContext() = 0; tuvok::LuaClassInstance GetLuaInstance() const; tuvok::LuaClassInstance GetRegionUnderCursor(INTVECTOR2 vPos) const; enum EViewMode { VM_SINGLE = 0, /**< a single large image */ VM_TWOBYTWO, /**< four small images */ VM_INVALID }; EViewMode GetViewMode() const {return m_eViewMode;} enum RegionSplitter { REGION_SPLITTER_HORIZONTAL_2x2, REGION_SPLITTER_VERTICAL_2x2, REGION_SPLITTER_BOTH_2x2, REGION_SPLITTER_NONE }; RegionSplitter GetRegionSplitter(INTVECTOR2 pos) const; tuvok::LuaClassInstance GetFirst3DRegion(); const std::vector GetActiveRenderRegions() const; void SetActiveRenderRegions(std::vector) const; void ResetRenderingParameters(); static void RegisterLuaFunctions( tuvok::LuaClassRegistration& reg, RenderWindow* me, tuvok::LuaScripting* ss); // Helper functions for accessing components in the region/abstract // renderer. uint64_t GetSliceDepth(tuvok::LuaClassInstance renderRegion) const; void SetSliceDepth(tuvok::LuaClassInstance renderRegion, uint64_t newDepth); bool IsRegion2D(tuvok::LuaClassInstance region) const; bool IsRegion3D(tuvok::LuaClassInstance region) const; bool DoesRegionContainPoint(tuvok::LuaClassInstance region, UINTVECTOR2 pos) const; tuvok::RenderRegion::EWindowMode GetRegionWindowMode( tuvok::LuaClassInstance) const; UINTVECTOR2 GetRegionMinCoord(tuvok::LuaClassInstance region) const; UINTVECTOR2 GetRegionMaxCoord(tuvok::LuaClassInstance region) const; void SetRegionMinCoord(tuvok::LuaClassInstance region,UINTVECTOR2 minCoord); void SetRegionMaxCoord(tuvok::LuaClassInstance region,UINTVECTOR2 maxCoord); bool Get2DFlipModeX(tuvok::LuaClassInstance region) const; bool Get2DFlipModeY(tuvok::LuaClassInstance region) const; void Set2DFlipMode(tuvok::LuaClassInstance region, bool flipX, bool flipY); bool GetUseMIP(tuvok::LuaClassInstance region); void SetUseMIP(tuvok::LuaClassInstance region, bool useMip); FLOATMATRIX4 GetRotation(tuvok::LuaClassInstance region); FLOATMATRIX4 GetTranslation(tuvok::LuaClassInstance region); tuvok::AbstrRenderer::ERendererTarget GetRendererTarget(); bool GetClearViewEnabled(); std::string GetRendererClearViewDisabledReason(); float GetRendererClearViewIsoValue(); float GetRendererClearViewSize(); float GetRendererClearViewContextScale(); float GetRendererClearViewBorderScale(); tuvok::LuaClassInstance GetRendererDataset() const; tuvok::LuaClassInstance GetRendererTransferFunction1D() const; tuvok::LuaClassInstance GetRendererTransferFunction2D() const; void SetTimeSlice(uint32_t); void ScheduleCompleteRedraw(); bool RendererCheckForRedraw(); FLOATVECTOR3 GetBackgroundColor(int i); void SetBackgroundColors(FLOATVECTOR3 vTopColor, FLOATVECTOR3 vBotColor); void SetLODLimits(const UINTVECTOR2& vLODLimits); uint64_t GetCurrentSubFrameCount(); uint32_t GetWorkingSubFrame(); uint32_t GetCurrentBrickCount(); uint32_t GetWorkingBrick(); uint64_t GetMinLODIndex(); void SetDatasetIsInvalid(bool datasetIsInvalid); void RemoveMeshData(size_t index); void SetRendererTarget(tuvok::AbstrRenderer::ERendererTarget targ); bool SupportsClearView(); bool SupportsMeshes(); void ScanForNewMeshes(); std::vector > GetRendererMeshes(); void ClearRendererMeshes(); UINTVECTOR2 GetRendererSize() const; bool GetRendererStereoEnabled() const; float GetRendererStereoEyeDist() const; float GetRendererStereoFocalLength() const; bool GetRendererStereoEyeSwap() const; tuvok::AbstrRenderer::EStereoMode GetRendererStereoMode() const; float GetRendererSampleRateModifier() const; float GetRendererFoV() const; float GetRendererIsoValue() const; DOUBLEVECTOR3 GetRendererRescaleFactors() const; void SetRendererRescaleFactors(DOUBLEVECTOR3 scale); bool GetRendererGlobalBBox() const; bool GetRendererLocalBBox() const; bool GetRendererClipPlaneEnabled() const; bool GetRendererClipPlaneLocked() const; bool GetRendererClipPlaneShown() const; size_t GetRendererTimestep() const; UINTVECTOR2 GetRendererLODLimits() const; void RendererSchedule3DWindowRedraws(); void RendererReloadMesh(size_t index, const std::shared_ptr m); FLOATVECTOR3 GetRendererVolumeAABBExtents(); FLOATVECTOR3 GetRendererVolumeAABBCenter(); ExtendedPlane GetRendererClipPlane(); bool RendererCropDataset(const std::string& strTempDir, bool bKeepOldData); void SetRendererStereoEnabled(bool stereo); void SetRendererStereoEyeDist(float fStereoEyeDist); void SetRendererStereoFocalLength(float fStereoFocalLength); void SetRendererStereoEyeSwap(bool eyeSwap); void SetRendererStereoMode(tuvok::AbstrRenderer::EStereoMode mode); void RendererInitStereoFrame(); void RendererToggleStereoFrame(); void RendererSyncStateManager(); void RendererFixedFunctionality(); public: // public slots: virtual void ToggleRenderWindowView2x2(); virtual void ToggleRenderWindowViewSingle(); virtual bool SetRenderWindowView3D(); virtual void SetTimeSlices(unsigned int iActive, unsigned int iInactive) {m_iTimeSliceMSecsActive = iActive; m_iTimeSliceMSecsInActive = iInactive;} protected: QMutex m_strMultiRenderGuard; QString m_strDataset; QString m_strID; tuvok::AbstrRenderer* m_Renderer; tuvok::MasterController& m_MasterController; bool m_bRenderSubsysOK; RegionSplitter selectedRegionSplitter; UINTVECTOR2 m_vWinDim; UINTVECTOR2 m_vMinSize; UINTVECTOR2 m_vDefaultSize; EViewMode m_eViewMode; FLOATVECTOR2 m_vWinFraction; static const int regionSplitterWidth = 6; tuvok::LuaClassInstance activeRegion; // The region that should have focus tuvok::LuaClassInstance m_LuaThisClass; tuvok::LuaClassInstance m_LuaAbstrRenderer; MainWindow* m_MainWindow; tuvok::LuaMemberReg m_MemReg; // If later on more than 4 regions are desired this can either be // increased or something fancier than an array can be used. static const int MAX_RENDER_REGIONS = 4; static const int NUM_WINDOW_MODES = 4; tuvok::LuaClassInstance luaRenderRegions[MAX_RENDER_REGIONS] [NUM_WINDOW_MODES]; int selected2x2Regions[4]; //index into renderRegions static std::string ms_gpuVendorString; static uint32_t ms_iMaxVolumeDims; static bool ms_b3DTexInDriver; static bool ms_bImageLoadStoreInDriver; static bool ms_bConservativeDepthInDriver; struct RegionData { ArcBall arcBall; ArcBall clipArcBall; FLOATMATRIX4 clipRotation[2]; FLOATMATRIX4 toClipSpace; // Can be relative to object space or world // space depending on whether or not the // clipping plane is locked. }; RegionData regionDatas[MAX_RENDER_REGIONS][NUM_WINDOW_MODES]; /// The integer in this map is the global unique ID of the RenderRegion's /// LuaClassInstance. typedef std::unordered_map RegionDataMap; RegionDataMap regionDataMap; RegionData* GetRegionData(tuvok::LuaClassInstance) const; void SetupArcBall(); void ResizeRenderer(int width, int height); void PaintRenderer(); virtual void PaintOverlays() = 0; virtual void RenderSeparatingLines() = 0; virtual void InitializeRenderer() = 0; // Qt widget connector calls virtual void ForceRepaint() = 0; virtual void EmitStereoDisabled() = 0; virtual void EmitRenderWindowViewChanged(int iViewID) = 0; virtual void EmitWindowActive() = 0; virtual void EmitWindowInActive() = 0; virtual void EmitWindowClosing() = 0; void MousePressEvent(QMouseEvent *event); void MouseReleaseEvent(QMouseEvent *event); void MouseMoveEvent(QMouseEvent *event); void WheelEvent(QWheelEvent *event); void CloseEvent(QCloseEvent *event); void FocusInEvent(QFocusEvent * event); void FocusOutEvent ( QFocusEvent * event ); void KeyPressEvent ( QKeyEvent * event ); void Cleanup(); void Initialize(); virtual void SwapBuffers() {} void UpdateCursor(tuvok::LuaClassInstance region, INTVECTOR2 pos, bool translate); void BaseSetLuaDefaults(); /// @param[in,out] newRenderRegions with coordinates updated to reflect the /// new view mode. /// @param[in] eViewMode The new ViewMode to use. virtual void SetViewMode(const std::vector &newRenderRegions, EViewMode eViewMode); void SetWindowFraction2x2(FLOATVECTOR2 f); FLOATVECTOR2 WindowFraction2x2() const { return m_vWinFraction; } void UpdateWindowFraction(); tuvok::LuaClassInstance GetCorrespondingRenderRegion( const RenderWindow* otherRW, tuvok::LuaClassInstance myRR) const; tuvok::MasterController::EVolumeRendererType m_eRendererType; private: /// Called when the mouse is moved, but in a mode where the clip plane /// should be manipulated instead of the dataset. /// @param pos new position of the mouse cursor /// @param rotate if this should rotate the clip plane /// @param translate if this should translate the clip plane /// @param region The active RenderRegion the mouse/user is operating in. bool MouseMoveClip(INTVECTOR2 pos, bool rotate, bool translate, tuvok::LuaClassInstance region); /// Called for a mouse update when in the 3D view mode. /// @param pos new position of the mouse cursor /// @param clearview if this action should affect clearview /// @param rotate should this action rotate the data /// @param translate should this action translate the data /// @param region The active RenderRegion the mouse/user is operating in. bool MouseMove3D(INTVECTOR2 pos, bool clearview, bool rotate, bool translate, tuvok::LuaClassInstance region); void MoveViewerWithMouse(const FLOATVECTOR3& vDirection); void MoveViewer(const FLOATVECTOR3& vDirection); void RotateViewerWithMouse(const INTVECTOR2& viMouseDelta); void RotateViewer(const FLOATVECTOR3& vfAnglesInDegree); void SetFirstPersonMode(bool); bool GetFirstPersonMode(); void SetRotation(tuvok::LuaClassInstance region, FLOATMATRIX4 newRotation); void SetTranslation(tuvok::LuaClassInstance region, FLOATMATRIX4 accumulatedTranslation); void SetProvTransformAndClip(tuvok::LuaClassInstance region, FLOATMATRIX4 transform); void SetProvRotationAndClip(tuvok::LuaClassInstance region, FLOATMATRIX4 r); void SetProvTransAndClip(tuvok::LuaClassInstance region, FLOATMATRIX4 t); void LuaSetTransform(FLOATMATRIX4 m); void LuaSetRotation(FLOATMATRIX3 m); void LuaSetTranslation(VECTOR3 m); void LuaSetTranslationAs4x4(FLOATMATRIX4 m); void LuaSetRotationAs4x4(FLOATMATRIX4 m); void LuaResizeWindow(const UINTVECTOR2& newSize); void LuaSetLighting(bool enabled); void LuaLoad1DTFqn(const std::string&); void LuaLoad2DTFqn(const std::string&); // resets the clipping plane and multiplies it by the given matrix void LuaSetClipPlane(const FLOATMATRIX4& m); /// Returns the Lua Renderer. This is used instead of inheriting the methods /// from the renderer, because, for the most part, the user won't care about /// the methods in the renderer(). tuvok::LuaClassInstance GetLuaAbstrRenderer() const; // Lua Callback functions. void LuaCallbackEnableClipPlane(bool enable); void updateClipPlaneTransform(tuvok::LuaClassInstance region); FLOATMATRIX4 computeClipToVolToWorldTransform( tuvok::LuaClassInstance region); FLOATMATRIX4 getHomogeneousVolToWorldTrafo(tuvok::LuaClassInstance region); private: unsigned int m_iTimeSliceMSecsActive; unsigned int m_iTimeSliceMSecsInActive; float m_1DHistScale; float m_2DHistScale; INTVECTOR2 initialLeftClickPos; INTVECTOR2 initialClickPos; INTVECTOR2 m_viMousePos; FLOATMATRIX4 m_mCaptureStartRotation; bool m_bAbsoluteViewLock; bool m_bInvWheel; bool m_bFirstPersonMode; float m_fFirstPersonSpeed; tuvok::AbstrRenderer::ERendererTarget m_RTModeBeforeCapture; FLOATMATRIX4 m_mAccumulatedClipTranslation; ExtendedPlane m_ClipPlane; ExtendedPlane m_PlaneAtClick; ///< temp storage to maintain the clip /// plane state when the user /// left-clicked. /// We implicitly lock the clip plane to the dataset when it is disabled. /// This saves the value at disabling time, so we can restore it when the /// clip plane is re-enabled. bool m_SavedClipLocked; }; #endif // RENDERWINDOW_H ImageVis3D-3.1.0/ImageVis3D/UI/QLightPreview.cpp0000644000175000017500000001566612320517543020746 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : QLightPreview.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : November 2009 // //! Copyright (C) 2009 SCI Institute #include #include "QLightPreview.h" #include #include #include "../Tuvok/Controller/Controller.h" #include "../Tuvok/Basics/MathTools.h" using namespace std; QLightPreview::QLightPreview(QWidget *parent) : QWidget(parent), m_cAmbient(1.0f,1.0f,1.0f,0.1f), m_cDiffuse(1.0f,1.0f,1.0f,1.0f), m_cSpecular(1.0f,1.0f,1.0f,1.0f), m_vLightDir(0.0f,0.0f,-1.0f), m_iCachedHeight(0), m_iCachedWidth(0), m_pCachedImage(NULL), m_bBackdropCacheUptodate(false), m_bMousePressed(false) { } QLightPreview::~QLightPreview(void) { // delete the backdrop cache pixmap delete m_pCachedImage; } void QLightPreview::DrawSphere(QImage* sphereImage) { // can be choosen arbitrarily FLOATVECTOR3 fLightDir = m_vLightDir; fLightDir.normalize(); FLOATVECTOR3 fViewDir(0,0,-1); int w = width(); int h = height(); for (int y = 0;y 1 ) { sphereImage->setPixel(int(x),int(y),qRgb(0,0,0)); } else { FLOATVECTOR3 vNormal(fDistToCenterX, fDistToCenterY, sqrt((1-fDistToCenterYQ)-fDistToCenterXQ)); // compute diffuse and clamp to zero FLOATVECTOR3 diffuseColor = (fLightDir ^ vNormal) * m_cDiffuse.xyz() * m_cDiffuse.w; diffuseColor.x = fabs(diffuseColor.x); diffuseColor.y = fabs(diffuseColor.y); diffuseColor.z = fabs(diffuseColor.z); FLOATVECTOR3 reflection = fViewDir-(2.0f*vNormal*(vNormal^fViewDir)); // compute specular and clamp to zero FLOATVECTOR3 specularColor = pow((reflection ^ -fLightDir),9.0f) * m_cSpecular.xyz() * m_cSpecular.w; specularColor.x = (specularColor.x < 0) ? 0: specularColor.x; specularColor.y = (specularColor.y < 0) ? 0: specularColor.y; specularColor.z = (specularColor.z < 0) ? 0: specularColor.z; // add colors and clamp to 1 FLOATVECTOR3 color = diffuseColor + specularColor + m_cAmbient.xyz() * m_cAmbient.w; color.x = (color.x > 1) ? 1: color.x; color.y = (color.y > 1) ? 1: color.y; color.z = (color.z > 1) ? 1: color.z; sphereImage->setPixel(int(x),int(y), qRgb(int(color.x*255), int(color.y*255), int(color.z*255))); } } } } void QLightPreview::paintEvent(QPaintEvent *event) { // call superclass method QWidget::paintEvent(event); // as drawing the histogram can become quite expensive we'll cache it in an image and only redraw if needed if (!m_bBackdropCacheUptodate || (unsigned int)height() != m_iCachedHeight || (unsigned int)width() != m_iCachedWidth) { // delete the old pixmap an create a new one if the size has changed if (m_pCachedImage == NULL || (unsigned int)height() != m_iCachedHeight || (unsigned int)width() != m_iCachedWidth) { delete m_pCachedImage; m_pCachedImage = new QImage(width(),height(),QImage::Format_ARGB32); } // store the new image size m_iCachedHeight = height(); m_iCachedWidth = width(); // draw the backdrop into the image DrawSphere(m_pCachedImage); // update change detection states m_bBackdropCacheUptodate = true; } // now draw everything rest into this widget QPainter painter(this); // the image captured above (or cached from a previous call) painter.drawImage(0,0,*m_pCachedImage); } void QLightPreview::SetData(const FLOATVECTOR4& ambient, const FLOATVECTOR4& diffuse, const FLOATVECTOR4& specular, const FLOATVECTOR3& lightDir) { m_cAmbient = ambient; m_cDiffuse = diffuse; m_cSpecular = specular; m_vLightDir = lightDir; m_bBackdropCacheUptodate = false; update(); } FLOATVECTOR4 QLightPreview::GetAmbient() const { return m_cAmbient; } FLOATVECTOR4 QLightPreview::GetDiffuse() const { return m_cDiffuse; } FLOATVECTOR4 QLightPreview::GetSpecular()const { return m_cSpecular; } FLOATVECTOR3 QLightPreview::GetLightDir()const { return m_vLightDir; } void QLightPreview::mouseMoveEvent(QMouseEvent *event) { // call superclass method QWidget::mouseMoveEvent(event); if (!m_bMousePressed) return; int x = event->x(); int y = event->y(); int w = width(); int h = height(); float normX = float((w-x)*2) / float(w); float fDistToCenterX = (normX - 1.0f); float fDistToCenterXQ = fDistToCenterX*fDistToCenterX; float normY = float(y*2) / float(h); float fDistToCenterY = (normY - 1.0f); float fDistToCenterYQ = fDistToCenterY*fDistToCenterY; if ( fDistToCenterXQ + fDistToCenterYQ > 1 ) return; m_vLightDir = FLOATVECTOR3(fDistToCenterX, fDistToCenterY, -sqrt((1-fDistToCenterYQ)-fDistToCenterXQ)); m_vLightDir.normalize(); // redraw this widget m_bBackdropCacheUptodate = false; update(); emit lightMoved(); } void QLightPreview::mousePressEvent(QMouseEvent *event) { // call superclass method QWidget::mousePressEvent(event); if (event->button() == Qt::LeftButton) m_bMousePressed = true; } void QLightPreview::mouseReleaseEvent(QMouseEvent *event) { // call superclass method QWidget::mouseReleaseEvent(event); if (event->button() == Qt::LeftButton) m_bMousePressed = false; } ImageVis3D-3.1.0/ImageVis3D/UI/ImageVis3D_1DTransferFunction.cpp0000644000175000017500000002536712320517543023645 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : ImageVis3D_1DTransferFunction.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : July 2008 // //! Copyright (C) 2008 SCI Institute #include "ImageVis3D.h" #include "BrowseData.h" #include #include #include #include #include #include #include "PleaseWait.h" #include #include #include #include "../Tuvok/Basics/SysTools.h" #include "../Tuvok/IO/FileBackedDataset.h" #include "../Tuvok/LuaScripting/TuvokSpecific/LuaTransferFun1DProxy.h" using namespace std; // ****************************************** // 1D Transfer Function Dock // ****************************************** void MainWindow::Invert1DTransComp() { checkBox_Red->setChecked(!checkBox_Red->isChecked()); checkBox_Green->setChecked(!checkBox_Green->isChecked()); checkBox_Blue->setChecked(!checkBox_Blue->isChecked()); checkBox_Alpha->setChecked(!checkBox_Alpha->isChecked()); Transfer1DSetColors(); } void MainWindow::Transfer1DSetColors() { radioButton_User->setChecked(true); unsigned int iPaintMode = Q1DTransferFunction::PAINT_NONE; if (!checkBox_Red->isChecked() && !checkBox_Green->isChecked() && !checkBox_Blue->isChecked() && !checkBox_Alpha->isChecked() ) { // everything disable -> not a good idea groupBox_6->setStyleSheet("background-color: red"); } else { groupBox_6->setStyleSheet(""); if (checkBox_Red->isChecked() ) iPaintMode |= Q1DTransferFunction::PAINT_RED; if (checkBox_Green->isChecked() ) iPaintMode |= Q1DTransferFunction::PAINT_GREEN; if (checkBox_Blue->isChecked() ) iPaintMode |= Q1DTransferFunction::PAINT_BLUE; if (checkBox_Alpha->isChecked() ) iPaintMode |= Q1DTransferFunction::PAINT_ALPHA; } m_1DTransferFunction-> SetPaintMode( (Q1DTransferFunction::paintMode ) iPaintMode); } void MainWindow::Transfer1DSetGroups() { // Determine current CB state unsigned int iRadioState = 0; if (radioButton_User->isChecked()) iRadioState = 0; else if (radioButton_Luminance->isChecked()) iRadioState = 1; else //if (radioButton_Intensity->isChecked()) iRadioState = 2; // If in user mode do nothing if (iRadioState == 0) return; // apply iRadioState checkBox_Red->setChecked(true); checkBox_Green->setChecked(true); checkBox_Blue->setChecked(true); checkBox_Alpha->setChecked(iRadioState==2); Transfer1DSetColors(); } void MainWindow::SetUpdateMode() { if( radioButton_UpdateContinuous->isChecked() ) { m_1DTransferFunction->SetExecutionMode( QTransferFunction::CONTINUOUS ); m_2DTransferFunction->SetExecutionMode( QTransferFunction::CONTINUOUS ); } else if( radioButton_UpdateOnRelease->isChecked() ) { m_1DTransferFunction->SetExecutionMode( QTransferFunction::ONRELEASE ); m_2DTransferFunction->SetExecutionMode( QTransferFunction::ONRELEASE ); } else if( radioButton_UpdateManual->isChecked() ) { m_1DTransferFunction->SetExecutionMode( QTransferFunction::MANUAL ); m_2DTransferFunction->SetExecutionMode( QTransferFunction::MANUAL ); } else { m_1DTransferFunction->SetExecutionMode( QTransferFunction::UNKNOWN ); m_2DTransferFunction->SetExecutionMode( QTransferFunction::UNKNOWN ); } pushButton_ApplyUpdate->setEnabled(radioButton_UpdateManual->isChecked()); } void MainWindow::ApplyUpdate() { if (radioButton_1DTrans->isChecked()) m_1DTransferFunction->ApplyFunction(); if (radioButton_2DTrans->isChecked()) m_2DTransferFunction->ApplyFunction(); } bool MainWindow::Transfer1DLoad(string strFilename) { return (m_1DTransferFunction) ? m_1DTransferFunction->LoadFromFile(strFilename.c_str()) : false; } void MainWindow::Transfer1DLoad() { QSettings settings; QString strLastDir=""; shared_ptr ss = m_MasterController.LuaScript(); // First try to grab the directory from the currently-opened file. if(m_pActiveRenderWin) { LuaClassInstance ds = m_pActiveRenderWin->GetRendererDataset(); strLastDir = QString(SysTools::GetPath( ss->cexecRet(ds.fqName() + ".fullpath")).c_str()); } // if that didn't work, fall back on our previously saved path. if(strLastDir == "" || !SysTools::FileExists(strLastDir.toStdString())) { strLastDir = settings.value("Folders/Transfer1DLoad", ".").toString(); } QString selectedFilter; QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString fileName = QFileDialog::getOpenFileName(this, "Load 1D Transfer function", strLastDir, "1D Transfer function File (*.1dt)",&selectedFilter, options); if (!fileName.isEmpty()) { settings.setValue("Folders/Transfer1DLoad", QFileInfo(fileName).absoluteDir().path()); m_1DTransferFunction->QLoadFromFile(fileName); } } void MainWindow::LoadTransferFunction1D(const std::string& tf) { m_1DTransferFunction->LoadFromFile(tf); } void MainWindow::Transfer1DSave() { QSettings settings; QString strLastDir=""; std::string defaultFilename; shared_ptr ss = m_MasterController.LuaScript(); // First try to grab the directory from the currently-opened file... if(m_pActiveRenderWin) { LuaClassInstance ds = m_pActiveRenderWin->GetRendererDataset(); string dsFullpath = ss->cexecRet(ds.fqName() + ".fullpath"); strLastDir = QString(SysTools::GetPath(dsFullpath).c_str()); defaultFilename = SysTools::ChangeExt(dsFullpath, "1dt"); } if(strLastDir == "" || !SysTools::FileExists(strLastDir.toStdString()+".")) { // ...if that didn't work, fall back on our previously saved path. strLastDir = settings.value("Folders/Transfer1DSave", ".").toString(); } else { // if the path exitst propose the default name as save default strLastDir = QString(defaultFilename.c_str()); } QString selectedFilter; QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString fileName = QFileDialog::getSaveFileName(this, "Save 1D Transfer function", strLastDir, "1D Transfer function File (*.1dt)",&selectedFilter, options); if (!fileName.isEmpty()) { fileName = SysTools::CheckExt(string(fileName.toAscii()), "1dt").c_str(); settings.setValue("Folders/Transfer1DSave", QFileInfo(fileName).absoluteDir().path()); m_1DTransferFunction->SaveToFile(fileName); } } void MainWindow::Transfer1DCopyTo2DTrans() { m_2DTransferFunction->Set1DTrans(m_1DTransferFunction->GetTrans()); } void MainWindow::Populate1DTFLibList() { comboBox_1DTFLib->clear(); string strHomeDir = "."; if (!SysTools::GetHomeDirectory(strHomeDir)) { m_MasterController.DebugOut()->Warning("MainWindow::Populate1DTFLibList", "Unable to determine user's home directory!"); } QSettings settings; QString strLibDir = settings.value("Folders/Transfer1DLib", strHomeDir.c_str()).toString(); settings.setValue("Folders/Transfer1DLib", strLibDir); vector files = SysTools::GetDirContents(string(strLibDir.toAscii()), "*", "1dt"); for (size_t i = 0;iinsertItem(0,SysTools::RemoveExt(SysTools::GetFilename(files[i])).c_str(),files[i].c_str()); } void MainWindow::Transfer1DAddToLib() { QSettings settings; QString strLibDir = settings.value("Folders/Transfer1DLib", ".").toString(); QString selectedFilter; QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString fileName = QFileDialog::getSaveFileName(this, "Save 1D Transfer function", strLibDir, "1D Transfer function File (*.1dt)",&selectedFilter, options); if (!fileName.isEmpty()) { fileName = SysTools::CheckExt(string(fileName.toAscii()), "1dt").c_str(); settings.setValue("Folders/Transfer1DSave", QFileInfo(fileName).absoluteDir().path()); m_1DTransferFunction->SaveToFile(fileName); Populate1DTFLibList(); } } void MainWindow::Transfer1DSetFromLib() { if (comboBox_1DTFLib->currentIndex() >= 0 && comboBox_1DTFLib->currentIndex() < comboBox_1DTFLib->count()) { QFile file(comboBox_1DTFLib->itemData(comboBox_1DTFLib->currentIndex()).toString()); if (file.exists()) m_1DTransferFunction->QLoadFromFile(file.fileName()); } } void MainWindow::Transfer1DAddFromLib() { if (comboBox_1DTFLib->currentIndex() >= 0 && comboBox_1DTFLib->currentIndex() < comboBox_1DTFLib->count()) { QFile file(comboBox_1DTFLib->itemData(comboBox_1DTFLib->currentIndex()).toString()); if (file.exists()) m_1DTransferFunction->AddFromFile(file.fileName()); } } void MainWindow::Transfer1DSubFromLib() { if (comboBox_1DTFLib->currentIndex() >= 0 && comboBox_1DTFLib->currentIndex() < comboBox_1DTFLib->count()) { QFile file(comboBox_1DTFLib->itemData(comboBox_1DTFLib->currentIndex()).toString()); if (file.exists()) m_1DTransferFunction->SubtractFromFile(file.fileName()); } } void MainWindow::Transfer1DConfigureLib() { QSettings settings; QString strLibDir = settings.value("Folders/Transfer1DLib", ".").toString(); QString strNewLibDir = QFileDialog::getExistingDirectory(this, "Select transfer function library",strLibDir); if (!strNewLibDir.isEmpty()) { if (strNewLibDir[strNewLibDir.size()-1] != '/' && strNewLibDir[strNewLibDir.size()-1] != '\\') strNewLibDir = strNewLibDir+'/'; if (strNewLibDir != strLibDir) { settings.setValue("Folders/Transfer1DLib", strNewLibDir); Populate1DTFLibList(); } } } ImageVis3D-3.1.0/ImageVis3D/UI/AboutDlg.h0000644000175000017500000000404712320517543017351 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : AboutDlg.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #ifndef ABOUTDLG_H #define ABOUTDLG_H #include "AutoGen/ui_About.h" #include #include #include class AboutDlg : public QDialog, protected Ui_About { Q_OBJECT public: AboutDlg(QString title, QString desc, QWidget* parent, Qt::WindowFlags flags = Qt::Tool); virtual ~AboutDlg(); protected slots: virtual void CheckUpdates(); virtual void OnlineVideoTut(); virtual void OnlineHelp(); virtual void ReportABug(); signals: void CheckUpdatesClicked(); void OnlineVideoTutClicked(); void OnlineHelpClicked(); void ReportABugClicked(); }; #endif // ABOUTDLG_H ImageVis3D-3.1.0/ImageVis3D/UI/CrashDetDlg.h0000644000175000017500000000360612320517543017774 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : CrashDetDlg.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #ifndef CRASHDETDLG_H #define CRASHDETDLG_H #include "AutoGen/ui_CrashDetDlg.h" #include #include #include class CrashDetDlg : public QDialog, protected Ui_CrashDetDlg { Q_OBJECT public: CrashDetDlg(QString title, QString desc, bool bDontShowAgain, QWidget* parent, Qt::WindowFlags flags = Qt::Tool); virtual ~CrashDetDlg(); bool GetDontShowAgain() {return checkBox_DontShowAgain->isChecked();} }; #endif // CRASHDETDLG_H ImageVis3D-3.1.0/ImageVis3D/UI/ImageVis3D_Progress.cpp0000644000175000017500000001214612320517543021761 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : ImageVis3D_Progress.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : November 2008 // //! Copyright (C) 2008 SCI Institute #include "ImageVis3D.h" #include "../Tuvok/Basics/SysTools.h" #include "LuaScripting/TuvokSpecific/LuaTuvokTypes.h" using namespace std; void MainWindow::ClearProgressViewAndInfo() { label_ProgressDesc->setVisible(true); groupBox_RenderProgress->setVisible(false); lineEdit_DatasetName->setText(""); listWidget_DatasetComponents->clear(); stackedWidget_componentInfo->setVisible(false); checkBox_ComponenEnable->setVisible(false); } void MainWindow::SetRenderProgressAnUpdateInfo(unsigned int iLODCount, unsigned int iCurrentCount, unsigned int iBrickCount, unsigned int iWorkingBrick, unsigned int iMinLODIndex, RenderWindow* pRenderWin) { if (dockWidget_ProgressView->isVisible()) { if (label_ProgressDesc->isVisible()) { label_ProgressDesc->setVisible(false); } if (!groupBox_RenderProgress->isVisible()) { groupBox_RenderProgress->setVisible(true); } // iCurrentCount may be higher than LODCount due the forcing higher LODs // with the slider. To avoid strange reading such as "LOD 4/1" we increase // iLODCount iLODCount = max(iCurrentCount,iLODCount); QString msg = tr("LOD %1/%2").arg(iCurrentCount).arg(iLODCount); /// @todo ? why is this platform dependent code. #ifdef DETECTED_OS_APPLE label_LODProgress->setText(msg); label_LODProgress->update(); #else msg = msg + " (%p%)"; progressBar_Frame->setFormat(msg); #endif progressBar_Frame->setValue((unsigned int)((float(iCurrentCount) - 1.0f + float(iWorkingBrick)/float(iBrickCount)) * 100.0f / float(iLODCount))); progressBar_Frame->update(); msg = tr("Brick %1/%2 of LOD %3").arg(iWorkingBrick).arg(iBrickCount). arg(iCurrentCount); /// @todo ? why is this platform dependent code. #ifdef DETECTED_OS_APPLE label_BrickProgress->setText(msg); label_BrickProgress->update(); #else msg = msg + " (%p%)"; progressBar_Level->setFormat(msg); #endif progressBar_Level->setValue(static_cast(iWorkingBrick * 100.0f / iBrickCount)); progressBar_Level->update(); } shared_ptr ss = m_MasterController.LuaScript(); if (pRenderWin && pRenderWin->IsRenderSubsysOK()) { LuaClassInstance ds = pRenderWin->GetRendererDataset(); UINT64VECTOR3 vSize = ss->cexecRet(ds.fqName() + ".getDomainSize", static_cast(iMinLODIndex), (size_t)0); QString strSize = tr("%1 x %2 x %3").arg(vSize.x).arg(vSize.y).arg(vSize.z); if (strSize != lineEdit_SizeForView->text()) { lineEdit_SizeForView->setText(strSize); lineEdit_SizeForView->update(); } uint64_t levelCount = ss->cexecRet(ds.fqName() + ".getLODLevelCount"); QString strLODLevel = tr("%1").arg(levelCount - iMinLODIndex); if (strLODLevel != lineEdit_LODLevelForCurrentView->text()) { lineEdit_LODLevelForCurrentView->setText(strLODLevel); lineEdit_LODLevelForCurrentView->update(); } } } void MainWindow::MinLODLimitChanged() { if (m_pActiveRenderWin) { m_pActiveRenderWin->SetLODLimits(UINTVECTOR2(horizontalSlider_minLODLimit->value(), horizontalSlider_maxLODLimit->value())); UpdateMinMaxLODLimitLabel(); } } void MainWindow::MaxLODLimitChanged() { MinLODLimitChanged(); // that call updates both parameters } ImageVis3D-3.1.0/ImageVis3D/UI/RenderWindowDX.h0000644000175000017500000001163512320517543020514 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : RenderWindowDX.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #if defined(_WIN32) && defined(USE_DIRECTX) #pragma once #ifndef RENDERWINDOWDX_H #define RENDERWINDOWDX_H #include "../Tuvok/Controller/MasterController.h" #include "../Tuvok/Basics/DynamicDX.h" #include "../Tuvok/Basics/ArcBall.h" #include #include #include "RenderWindow.h" using namespace tuvok; class MainWindow; class RenderWindowDX : public QWidget, public RenderWindow { Q_OBJECT public: RenderWindowDX(MasterController& masterController, MasterController::EVolumeRendererType eType, const QString& dataset, unsigned int iCounter, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder, QWidget* parent, Qt::WindowFlags flags); virtual ~RenderWindowDX(); virtual void UpdateWindow() {update();} /// Should initialize w/o render; hard to implement here? virtual void InitializeContext() { update(); } protected: virtual void ToggleFullscreen(); virtual void PaintOverlays(); virtual void RenderSeparatingLines(); private: virtual void InitializeRenderer(); protected slots: virtual void resizeEvent ( QResizeEvent * event ); // **************** Qt widget connector calls protected: virtual void ForceRepaint(); virtual QWidget* GetQtWidget() {return this;} virtual void EmitStereoDisabled() {emit StereoDisabled();} virtual void EmitRenderWindowViewChanged(int iViewID) {emit RenderWindowViewChanged(iViewID);} virtual void EmitWindowActive() {emit WindowActive(this);} virtual void EmitWindowInActive() {emit WindowInActive(this);} virtual void EmitWindowClosing() {emit WindowClosing(this);} // **************** Qt callbacks public: QSize minimumSizeHint() const {return QSize(m_vMinSize.x, m_vMinSize.y);} QSize sizeHint() const {return QSize(m_vDefaultSize.x, m_vDefaultSize.y);} public slots: virtual void ToggleRenderWindowView2x2() {RenderWindow::ToggleRenderWindowView2x2();} virtual void ToggleRenderWindowViewSingle() {RenderWindow::ToggleRenderWindowViewSingle();} virtual void SetTimeSlices(unsigned int iActive, unsigned int iInactive) {RenderWindow::SetTimeSlices(iActive, iInactive);} signals: void StereoDisabled(); void RenderWindowViewChanged(int iViewID); void WindowActive(RenderWindow* sender); void WindowInActive(RenderWindow* sender); void WindowClosing(RenderWindow* sender); protected: virtual void mousePressEvent(QMouseEvent *event) {QWidget::mousePressEvent(event); MousePressEvent(event);} virtual void mouseReleaseEvent(QMouseEvent *event) {QWidget::mouseReleaseEvent(event); MouseReleaseEvent(event);} virtual void mouseMoveEvent(QMouseEvent *event) {QWidget::mouseMoveEvent(event); MouseMoveEvent(event);} virtual void wheelEvent(QWheelEvent *event) {QWidget::wheelEvent(event); WheelEvent(event);} virtual void closeEvent(QCloseEvent *event) {QWidget::closeEvent(event); CloseEvent(event);} virtual void focusInEvent(QFocusEvent * event) {QWidget::focusInEvent(event); FocusInEvent(event);} virtual void focusOutEvent ( QFocusEvent * event ) {QWidget::focusOutEvent(event); FocusOutEvent(event);} virtual void keyPressEvent ( QKeyEvent * event ) {QWidget::keyPressEvent(event); KeyPressEvent(event);} // **************** End Qt callbacks }; #endif // RENDERWINDOWDX_H #endif // _WIN32 && USE_DIRECTX ImageVis3D-3.1.0/ImageVis3D/UI/QDataRadioButton.h0000644000175000017500000000446512320517543021021 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : QDataRadioButton.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : September 2008 // //! Copyright (C) 2008 SCI Institute #pragma once #ifndef QDATARADIOBUTTON_H #define QDATARADIOBUTTON_H #include "StdDefines.h" #include #include #include <../Tuvok/IO/DirectoryParser.h> class QDataRadioButton : public QRadioButton { public: QDataRadioButton(std::shared_ptr stack, QWidget* parent=0); QDataRadioButton(std::shared_ptr stack, const QString &text, QWidget *parent=0); virtual ~QDataRadioButton() {} void SetBrightness(float fScale); protected: unsigned int m_iCurrentImage; std::shared_ptr m_stackInfo; float m_fScale; virtual void leaveEvent ( QEvent * event ); virtual void mouseMoveEvent(QMouseEvent *event); void SetupInfo(); void SetStackImage(unsigned int i, bool bForceUpdate = false); }; #endif // QDATARADIOBUTTON_H ImageVis3D-3.1.0/ImageVis3D/UI/ImageVis3D.cpp0000644000175000017500000010525712320517543020103 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : ImageVis3D.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : July 2008 // //! Copyright (C) 2008 SCI Institute #include "StdDefines.h" #include #include #include #include #include #include #include #include #include #include #include #include #include "../Tuvok/Basics/SystemInfo.h" #include "../Tuvok/Basics/SysTools.h" #include "../Tuvok/Basics/MathTools.h" #include "../IO/DialogConverter.h" #include "../Tuvok/LuaScripting/TuvokSpecific/LuaTuvokTypes.h" #include "BrowseData.h" #include "CrashDetDlg.h" #include "FTPDialog.h" #include "ImageVis3D.h" #include "PleaseWait.h" using namespace std; MainWindow::MainWindow(MasterController& masterController, bool bScriptMode, /* = false */ QWidget* parent /* = 0 */, Qt::WindowFlags flags /* = 0 */) : QMainWindow(parent, flags), m_pRedrawTimer(NULL), m_MasterController(masterController), m_strCurrentWorkspaceFilename(""), m_strTempDir("."), // changed in the constructor m_bShowVersionInTitle(true), m_bQuickopen(true), m_iMinFramerate(10), m_iLODDelay(1000), m_bRenderLowResIntermediateResults(false), m_iActiveTS(500), m_iInactiveTS(100), m_bWriteLogFile(false), m_strLogFileName("debugLog.txt"), m_iLogLevel(2), m_pWelcomeDialog(new WelcomeDialog(this, Qt::Tool)), m_pMetadataDialog(new MetadataDlg(this, Qt::Tool)), m_pDebugScriptWindow(new DebugScriptWindow(masterController, this)), m_iBlendPrecisionMode(0), m_bPowerOfTwo(true), m_bDownSampleTo8Bits(false), m_bDisableBorder(false), m_bI3MFeatures(false), m_bAdvancedSettings(false), m_bAutoSaveGEO(true), m_bAutoSaveWSP(true), m_eVolumeRendererType(MasterController::OPENGL_SBVR), m_bUpdatingLockView(false), m_strLogoFilename(""), m_iLogoPos(3), m_bAutoLockClonedWindow(false), m_bAbsoluteViewLocks(true), m_bCheckForUpdatesOnStartUp(false), m_bCheckForDevBuilds(false), m_bShowWelcomeScreen(true), m_bInvWheel(true), m_bStayOpenAfterScriptEnd(false), m_pTextout(NULL), m_pActiveRenderWin(NULL), m_pLastLoadedRenderWin(NULL), m_pHttp(NULL), m_pUpdateFile(NULL), m_iHttpGetId(-1), m_bStartupCheck(false), m_bScriptMode(bScriptMode), m_pFTPDialog(NULL), m_strFTPTempFile(""), m_bFTPDeleteSource(true), m_bFTPFinished(true), m_bClipDisplay(true), m_bClipLocked(false), m_bIgnoreLoadDatasetFailure(false), m_MemReg(m_MasterController.LuaScript()) { RegisterLuaClasses(); QCoreApplication::setOrganizationName("Scientific Computing and Imaging Institute, University of Utah"); QCoreApplication::setOrganizationDomain(SCI_ORGANIZATION_DOMAIN); QCoreApplication::setApplicationName("ImageVis3D"); QString qstrVersion = tr("%1").arg(IV3D_VERSION); QCoreApplication::setApplicationVersion(qstrVersion); QString path = QApplication::applicationDirPath(); masterController.SysInfo()->SetProgramPath(string(path.toAscii())); setupUi(this); SysTools::GetTempDirectory(m_strTempDir); ApplySettings(); SetupWorkspaceMenu(); if (!LoadDefaultGeometry()) SaveDefaultGeometry(); if (!LoadDefaultWorkspace()) { InitAllWorkspaces(); SaveDefaultWorkspace(); } this->show(); SetAndCheckRunningFlag(); shared_ptr ss(m_MasterController.LuaScript()); ss->cexec("tuvok.io.registerFinalConverter", dynamic_pointer_cast(shared_ptr( new DialogConverter(this)))); UpdateMRUActions(); UpdateWSMRUActions(); UpdateMenus(); CheckSettings(); ClearProgressViewAndInfo(); UpdateColorWidget(); connect(m_pWelcomeDialog, SIGNAL(CheckUpdatesClicked()), this, SLOT(CheckForUpdates())); connect(m_pWelcomeDialog, SIGNAL(OnlineVideoTutClicked()), this, SLOT(OnlineVideoTut())); connect(m_pWelcomeDialog, SIGNAL(GetExampleDataClicked()), this, SLOT(GetExampleData())); connect(m_pWelcomeDialog, SIGNAL(OnlineHelpClicked()), this, SLOT(OnlineHelp())); connect(m_pWelcomeDialog, SIGNAL(OpenManualClicked()), this, SLOT(OpenManual())); connect(m_pWelcomeDialog, SIGNAL(OpenFromFileClicked()), this, SLOT(LoadDataset())); connect(m_pWelcomeDialog, SIGNAL(OpenFromFileClicked(std::string)), this, SLOT(LoadDataset(std::string))); connect(m_pWelcomeDialog, SIGNAL(OpenFromDirClicked()), this, SLOT(LoadDirectory())); connect(m_pWelcomeDialog, SIGNAL(accepted()), this, SLOT(CloseWelcome())); if (!m_bScriptMode && m_bCheckForUpdatesOnStartUp) QuietCheckForUpdates(); if (!m_bScriptMode && m_bShowWelcomeScreen) ShowWelcomeScreen(); checkBox_ClipShow->setEnabled(false); checkBox_ClipLockObject->setEnabled(false); toolButton_CropData->setEnabled(false); DisableStereoWidgets(); m_pRedrawTimer = new QTimer(this); m_pRedrawTimer->setInterval(IV3D_TIMER_INTERVAL); setAcceptDrops(true); } namespace { template void Delete(T *t) { delete t; } } MainWindow::~MainWindow() { if (m_pDebugOut == m_MasterController.DebugOut()) { m_MasterController.RemoveDebugOut(m_pDebugOut); } // cleanup updatefile, this code path is taken for instance when the // windows firewall blocked an http request if (m_pUpdateFile && m_pUpdateFile->isOpen()) { m_pUpdateFile->close(); m_pUpdateFile->remove(); delete m_pUpdateFile; m_pUpdateFile = NULL; } delete m_pHttp; m_pRedrawTimer->stop(); delete m_pRedrawTimer; RemoveRunningFlag(); delete m_pMetadataDialog; delete m_pWelcomeDialog; delete m_pFTPDialog; delete m_1DTransferFunction; delete m_2DTransferFunction; disconnect(m_pQLightPreview, SIGNAL(lightMoved()), this, SLOT(LightMoved())); delete m_pQLightPreview; std::for_each(m_recentFileActs, m_recentFileActs+ms_iMaxRecentFiles, Delete); std::for_each(m_recentWSFileActs, m_recentWSFileActs+ms_iMaxRecentFiles, Delete); } /// initializes the timer. void MainWindow::StartTimer() { connect(m_pRedrawTimer, SIGNAL(timeout()), this, SLOT(CheckForRedraw())); m_pRedrawTimer->start(IV3D_TIMER_INTERVAL); } void MainWindow::SetAndCheckRunningFlag() { QSettings settings; uint32_t iInstanceCounter = settings.value("InstanceCounter", 0).toUInt(); uint32_t iSaneCounter = settings.value("SaneCounter", 0).toUInt(); settings.beginGroup("Performance"); bool bWriteLogFile = settings.value("WriteLogFile", m_bWriteLogFile).toBool(); bool bShowCrashDialog = settings.value("ShowCrashDialog", true).toBool(); QString strLogFileName = settings.value("LogFileName", m_strLogFileName).toString(); settings.endGroup(); if (iInstanceCounter) { if (bShowCrashDialog) { settings.setValue("SaneCounter", 0); CrashDetDlg* d = NULL; if (bWriteLogFile && SysTools::FileExists(string(strLogFileName.toAscii()))) { d = new CrashDetDlg("Crash recovery", "Either ImageVis3D crashed or it is currently running in a second process. If it crashed do you want to submit the logfile?", false, this); if (d->exec() == QDialog::Accepted) { ReportABug(string(strLogFileName.toAscii())); remove(strLogFileName.toAscii()); } } else { if (!bWriteLogFile) { d = new CrashDetDlg("Crash recovery", "Either ImageVis3D crashed or it is currently running in a second process. If it crashed do you want to enable debugging?", false, this); if (d->exec() == QDialog::Accepted) { settings.setValue("Performance/WriteLogFile", true); settings.setValue("Performance/LogLevel", 2); } else { // if debugging was not enabled assume that has been opened multiple times settings.setValue("SaneCounter", (unsigned int)iSaneCounter); } } } iInstanceCounter = 0; if (d) { settings.setValue("Performance/ShowCrashDialog", !d->GetDontShowAgain()); delete d; } } } else { if (bShowCrashDialog && bWriteLogFile && iSaneCounter > 10) { CrashDetDlg* d = new CrashDetDlg("Crash recovery", "ImageVis3D did not crash the last 10 times it was used. Do you want to disable debug logging now?", false, this); if (d->exec() == QDialog::Accepted) { settings.setValue("Performance/WriteLogFile", false); } settings.setValue("Performance/ShowCrashDialog", !d->GetDontShowAgain()); delete d; } } settings.setValue("InstanceCounter", (unsigned int)iInstanceCounter+1); } void MainWindow::RemoveRunningFlag() { QSettings settings; // uint32_t iInstanceCounter = settings.value("InstanceCounter", 1).toUInt(); settings.setValue("InstanceCounter", 0); uint32_t iSaneCounter = settings.value("SaneCounter", 0).toUInt(); settings.setValue("SaneCounter", (unsigned int)iSaneCounter+1); } // ****************************************** // Filter Function Dock // ****************************************** // ****************************************** // Render Mode // ****************************************** void MainWindow::Use1DTrans() { if (!m_pActiveRenderWin) return; label_2DIndicator->setVisible(false); label_2DIndicator_SimpleUI->setVisible(false); label_IsoDIndicator->setVisible(false); checkBox_Use2DTrans->setChecked(false); checkBox_Use2DTrans->setVisible(true); checkBox_Use2DTrans_SimpleUI->setChecked(false); checkBox_Use2DTrans_SimpleUI->setVisible(true); checkBox_UseIso->setChecked(false); checkBox_UseIso->setVisible(true); checkBox_Use1DTrans->setChecked(true); checkBox_Use1DTrans->setVisible(false); radioButton_1DTrans->setChecked(true); label_1DIndicator->setVisible(true); checkBox_Lighting->setEnabled(true); toolButton_ExpIsoToMesh->setEnabled(false); m_1DTransferFunction->setEnabled(true); m_2DTransferFunction->setEnabled(false); if (m_pActiveRenderWin) m_pActiveRenderWin->SetRendermode(AbstrRenderer::RM_1DTRANS); } void MainWindow::Use2DTrans() { if (!m_pActiveRenderWin) return; frame_Simple2DTransControls->setEnabled(true); label_1DIndicator->setVisible(false); label_IsoDIndicator->setVisible(false); checkBox_Use1DTrans->setChecked(false); checkBox_Use1DTrans->setVisible(true); checkBox_UseIso->setChecked(false); checkBox_UseIso->setVisible(true); checkBox_Use2DTrans_SimpleUI->setChecked(true); checkBox_Use2DTrans_SimpleUI->setVisible(false); checkBox_Use2DTrans->setChecked(true); checkBox_Use2DTrans->setVisible(false); radioButton_2DTrans->setChecked(true); label_2DIndicator->setVisible(true); label_2DIndicator_SimpleUI->setVisible(true); label_2DIndicator->setText("2D Transfer Function Enabled"); checkBox_Lighting->setEnabled(true); toolButton_ExpIsoToMesh->setEnabled(false); m_1DTransferFunction->setEnabled(false); m_2DTransferFunction->setEnabled(true); frame_top_simpleUI->setEnabled(true); frame_center_simpleUI->setEnabled(true); frame_bottomL_simpleUI->setEnabled(true); frame_2DTransEdit->setEnabled(true); int iCurrent = m_2DTransferFunction->GetActiveSwatchIndex(); if (iCurrent < 0 && m_2DTransferFunction->GetSwatchCount() > 0) { m_2DTransferFunction->Transfer2DSetActiveSwatch(0); Transfer2DSwatchesChanged(); } if (m_pActiveRenderWin) m_pActiveRenderWin->SetRendermode(AbstrRenderer::RM_2DTRANS); } void MainWindow::UseIso() { if (!m_pActiveRenderWin) return; label_1DIndicator->setVisible(false); label_2DIndicator->setVisible(false); label_2DIndicator->setText(""); label_2DIndicator_SimpleUI->setVisible(false); checkBox_Use2DTrans->setChecked(false); checkBox_Use2DTrans->setVisible(true); checkBox_Use2DTrans_SimpleUI->setChecked(false); checkBox_Use2DTrans_SimpleUI->setVisible(true); checkBox_Use1DTrans->setChecked(false); checkBox_Use1DTrans->setVisible(true); checkBox_UseIso->setChecked(true); checkBox_UseIso->setVisible(false); radioButton_Iso->setChecked(true); label_IsoDIndicator->setVisible(true); checkBox_Lighting->setEnabled(false); toolButton_ExpIsoToMesh->setEnabled(true); m_1DTransferFunction->setEnabled(false); m_2DTransferFunction->setEnabled(false); if (m_pActiveRenderWin) m_pActiveRenderWin->SetRendermode(AbstrRenderer::RM_ISOSURFACE); } void MainWindow::DisableAllTrans() { label_1DIndicator->setVisible(false); label_2DIndicator->setVisible(false); label_2DIndicator->setText(""); label_2DIndicator_SimpleUI->setVisible(false); label_IsoDIndicator->setVisible(false); checkBox_Use2DTrans_SimpleUI->setChecked(false); checkBox_Use2DTrans_SimpleUI->setVisible(false); checkBox_Use2DTrans->setChecked(false); checkBox_Use2DTrans->setVisible(false); checkBox_UseIso->setChecked(false); checkBox_UseIso->setVisible(false); checkBox_Use1DTrans->setChecked(false); checkBox_Use1DTrans->setVisible(false); m_1DTransferFunction->setEnabled(false); m_2DTransferFunction->setEnabled(false); frame_top_simpleUI->setEnabled(false); frame_center_simpleUI->setEnabled(false); frame_bottomL_simpleUI->setEnabled(false); frame_2DTransEdit->setEnabled(false); listWidget_Swatches->clear(); } void MainWindow::SetLighting(bool bLighting) { if (m_pActiveRenderWin != NULL) m_pActiveRenderWin->SetUseLighting(bLighting); } void MainWindow::ToggleLighting() { if (m_pActiveRenderWin != NULL) { m_pActiveRenderWin->SetUseLighting(!m_pActiveRenderWin->GetUseLighting()); } } void MainWindow::SetSampleRate(int iValue) { if (m_pActiveRenderWin != NULL) m_pActiveRenderWin->SetSampleRateModifier(iValue/100.0f); UpdateSampleRateLabel(iValue); } void MainWindow::UpdateSampleRateLabel(int iValue) { QString desc; desc = tr("Sampling Rate (%1%):").arg(iValue); label_SamplingRate->setText(desc); } void MainWindow::SetSampleRateSlider(int iValue) { horizontalSlider_Sampling->setValue(iValue); UpdateSampleRateLabel(iValue); } void MainWindow::SetFoV(int iValue) { if (m_pActiveRenderWin != NULL) m_pActiveRenderWin->SetFoV(iValue); UpdateFoVLabel(iValue); } void MainWindow::SetFoVSlider(int iValue) { horizontalSlider_FoV->setValue(iValue); UpdateFoVLabel(iValue); } void MainWindow::UpdateFoVLabel(int iValue) { QString desc; desc = tr("Field of View (%1):").arg(iValue); label_FoV->setText(desc); } // Script command to update isovalue. void MainWindow::SetIsoValue(float fValue) { if (m_pActiveRenderWin != NULL) { int iMaxSize = int(m_pActiveRenderWin->GetDynamicRange().second); fValue = MathTools::Clamp(fValue, 0.0f, 1.0f); m_pActiveRenderWin->SetIsoValue(fValue * iMaxSize); UpdateIsoValLabel(int(fValue * iMaxSize), iMaxSize); } } // UI command to update isovalue. void MainWindow::SetIsoValue(int iValue) { if (m_pActiveRenderWin != NULL) { m_pActiveRenderWin->SetIsoValue(float(iValue)); int iMaxSize = int(m_pActiveRenderWin->GetDynamicRange().second); UpdateIsoValLabel(iValue, iMaxSize); } } // Script command to update focus isovalue void MainWindow::SetClearViewIsoValue(float fValue) { if (m_pActiveRenderWin != NULL) { int iMaxSize = int(m_pActiveRenderWin->GetDynamicRange().second); fValue = MathTools::Clamp(fValue, 0.0f, 1.0f); m_pActiveRenderWin->SetCVIsoValue(fValue * iMaxSize); UpdateIsoValLabel(int(fValue*iMaxSize), iMaxSize); } } void MainWindow::SetIsoValueSlider(int iValue, int iMaxValue) { horizontalSlider_Isovalue->setMaximum(iMaxValue); horizontalSlider_Isovalue->setValue(iValue); } void MainWindow::UpdateIsoValLabel(int iValue, int iMaxValue) { QString desc; desc = tr("%1/%2").arg(iValue).arg(iMaxValue); label_IsoValue->setText(desc); } void MainWindow::SetFocusIsoValue(int iValue) { int iMaxSize = int(m_pActiveRenderWin->GetDynamicRange().second); if (m_pActiveRenderWin != NULL) { m_pActiveRenderWin->SetCVIsoValue(float(iValue)); } UpdateFocusIsoValLabel(iValue, iMaxSize); } void MainWindow::SetFocusIsoValueSlider(int iValue, int iMaxValue) { horizontalSlider_CVFocusIsoValue->setMaximum(iMaxValue); horizontalSlider_CVFocusIsoValue->setValue(iValue); } void MainWindow::SetFocusSizeValueSlider(int iValue){ horizontalSlider_CVFocusSize->setValue(iValue); } void MainWindow::SetContextScaleValueSlider(int iValue){ horizontalSlider_CVContextScale->setValue(iValue); } void MainWindow::SetBorderSizeValueSlider(int iValue) { horizontalSlider_CVBorder->setValue(iValue); } void MainWindow::SetFocusSize(int iValue) { if (m_pActiveRenderWin != NULL) m_pActiveRenderWin->SetCVSize(float(99-iValue)/9.9f); } void MainWindow::SetContextScale(int iValue) { if (m_pActiveRenderWin != NULL) m_pActiveRenderWin->SetCVContextScale(float(iValue)/10.0f); } void MainWindow::SetBorderSize(int iValue) { if (m_pActiveRenderWin != NULL) m_pActiveRenderWin->SetCVBorderScale(float(99-iValue)); } void MainWindow::UpdateFocusIsoValLabel(int iValue, int iMaxValue) { QString desc; desc = tr("%1/%2").arg(iValue).arg(iMaxValue); label_CVFocusIsoValue->setText(desc); } void MainWindow::SetToggleGlobalBBoxLabel(bool bRenderBBox) { this->checkBox_GBBox->setChecked(bRenderBBox); } void MainWindow::SetToggleLocalBBoxLabel(bool bRenderBBox) { this->checkBox_LBBox->setChecked(bRenderBBox); } void MainWindow::ToggleGlobalBBox(bool bRenderBBox) { if (m_pActiveRenderWin != NULL) m_pActiveRenderWin->SetGlobalBBox(bRenderBBox); } void MainWindow::SetToggleClipEnabledLabel(bool b) { this->checkBox_ClipPlane->setChecked(b); } void MainWindow::SetToggleClipShownLabel(bool b) { this->checkBox_ClipShow->setChecked(b); } void MainWindow::SetToggleClipLockedLabel(bool b) { this->checkBox_ClipLockObject->setChecked(b); } void MainWindow::ToggleLocalBBox(bool bRenderBBox) { if (m_pActiveRenderWin != NULL) m_pActiveRenderWin->SetLocalBBox(bRenderBBox); } void MainWindow::ToggleClipPlane(bool bClip) { RenderWindow *rw = m_pActiveRenderWin; if(rw == NULL) { return; } rw->SetClipPlaneEnabled(bClip); LuaCallbackToggleClipPlane(bClip); } void MainWindow::LuaCallbackToggleClipPlane(bool bClip) { // Check the 'enable' box, but make sure we don't send any sort of event. checkBox_ClipPlane->blockSignals(true); checkBox_ClipPlane->setChecked(bClip); checkBox_ClipPlane->blockSignals(false); checkBox_ClipShow->setEnabled(bClip); checkBox_ClipLockObject->setEnabled(bClip); toolButton_CropData->setEnabled(bClip); } void MainWindow::ClipToggleShow(bool bShow) { RenderWindow *rw = m_pActiveRenderWin; if(rw == NULL) { return; } rw->SetClipPlaneDisplayed(bShow); m_bClipDisplay = bShow; } void MainWindow::ClipToggleLock(bool bLock) { RenderWindow *rw = m_pActiveRenderWin; if(rw == NULL) { return; } rw->SetClipPlaneRelativeLock(bLock); m_bClipLocked = bLock; } void MainWindow::SetTimestep(int t) { RenderWindow *rw = m_pActiveRenderWin; if(rw == NULL) { return; } rw->SetTimestep(static_cast(t)); LuaClassInstance ds = m_pActiveRenderWin->GetRendererDataset(); int iMaxVal = static_cast( m_MasterController.LuaScript()->cexecRet(ds.fqName() + ".getNumberOfTimesteps")); UpdateTimestepLabel(int(t), iMaxVal); } void MainWindow::SetTimestepSlider(int iValue, int iMaxValue) { hSlider_Timestep->setMaximum(iMaxValue); hSlider_Timestep->setValue(iValue); hSlider_Timestep->setEnabled(iMaxValue != 1); } void MainWindow::UpdateTimestepLabel(int iValue, int iMaxValue) { if(iMaxValue == 1) { QString desc; desc = tr("One"); label_Timestep->setText(desc); } else { QString desc; desc = tr("%1/%2").arg(iValue+1).arg(iMaxValue); label_Timestep->setText(desc); } } void MainWindow::ResetTimestepUI() { SetTimestepSlider(0,1); UpdateTimestepLabel(0,1); } void MainWindow::closeEvent(QCloseEvent *event) { if (m_bAutoSaveGEO) SaveDefaultGeometry(); if (m_bAutoSaveWSP) SaveDefaultWorkspace(); m_MasterController.RemoveDebugOut(m_pDebugOut); m_pDebugOut = NULL; event->accept(); } void MainWindow::ChooseIsoColor() { if (m_pActiveRenderWin) { FLOATVECTOR3 vIsoColor = m_pActiveRenderWin->GetIsosurfaceColor(); QColor color = QColorDialog::getColor(qRgba(int(vIsoColor.x*255), int(vIsoColor.y*255), int(vIsoColor.z*255), 255), this); if (color.isValid()) { vIsoColor = FLOATVECTOR3(color.red() / 255.0f, color.green() / 255.0f, color.blue() / 255.0f); m_pActiveRenderWin->SetIsosurfaceColor(vIsoColor); } } } void MainWindow::ChooseFocusColor() { if (m_pActiveRenderWin) { FLOATVECTOR3 vIsoColor = m_pActiveRenderWin->GetCVColor(); QColor color = QColorDialog::getColor(qRgba(int(vIsoColor.x*255), int(vIsoColor.y*255), int(vIsoColor.z*255), 255), this); if (color.isValid()) { vIsoColor = FLOATVECTOR3(color.red() / 255.0f, color.green() / 255.0f, color.blue() / 255.0f); m_pActiveRenderWin->SetCVColor(vIsoColor); } } } void MainWindow::ToggleClearView() { if (m_pActiveRenderWin) { m_pActiveRenderWin->SetCV(checkBox_ClearView->isChecked()); frame_ClearView->setEnabled(checkBox_ClearView->isChecked()); } } // ****************************************** // Dataset interaction // ****************************************** void MainWindow::RotateCurrentViewX(double angle) { if (m_pActiveRenderWin) { FLOATMATRIX4 matRot; matRot.RotationX(3.141592653589793238462643383*angle/180.0); m_pActiveRenderWin->Rotate(matRot); } } void MainWindow::RotateCurrentViewY(double angle) { if (m_pActiveRenderWin) { FLOATMATRIX4 matRot; matRot.RotationY(3.141592653589793238462643383*angle/180.0); m_pActiveRenderWin->Rotate(matRot); } } void MainWindow::RotateCurrentViewZ(double angle) { if (m_pActiveRenderWin) { FLOATMATRIX4 matRot; matRot.RotationZ(3.141592653589793238462643383*angle/180.0); m_pActiveRenderWin->Rotate(matRot); } } void MainWindow::TranslateCurrentView(double x, double y, double z) { if (m_pActiveRenderWin) { FLOATMATRIX4 matTrans; matTrans.Translation(x,y,z); m_pActiveRenderWin->Translate(matTrans); } } void MainWindow::ToggleFullscreen() { if (m_pActiveRenderWin) m_pActiveRenderWin->ToggleFullscreen(); } QMdiSubWindow* MainWindow::ActiveSubWindow() { for (int i = 0;isubWindowList().size();i++) { QWidget* w = mdiArea->subWindowList().at(i)->widget(); RenderWindow* subwindow = WidgetToRenderWin(w); if (subwindow == m_pActiveRenderWin) return mdiArea->subWindowList().at(i); } return NULL; } RenderWindow* MainWindow::ActiveRenderWin() { if (mdiArea->activeSubWindow()) return WidgetToRenderWin(mdiArea->activeSubWindow()->widget()); else return NULL; } RenderWindow* MainWindow::WidgetToRenderWin(QWidget* w) { // Given Widget might actually be NULL, in the case that window (GL) // initialization failed, but Qt got asked to process an interaction event // (e.g. a mouse move) before the `close' event. MainWindow::CheckForRedraw // has the same issue; see the comment there for more info. if (w == NULL) { return NULL; } if (w->objectName() == "RenderWindowGL") { RenderWindowGL* r = static_cast(w); return static_cast(r); } #if defined(_WIN32) && defined(USE_DIRECTX) if (w->objectName() == "RenderWindowDX") { RenderWindowDX* r = static_cast(w); return static_cast(r); } #endif return NULL; } void MainWindow::PickLightColor() { if (!m_pActiveRenderWin) return; FLOATVECTOR4 cAmbient = m_pQLightPreview->GetAmbient(); FLOATVECTOR4 cDiffuse = m_pQLightPreview->GetDiffuse(); FLOATVECTOR4 cSpecular = m_pQLightPreview->GetSpecular(); FLOATVECTOR3 vLightDir = m_pQLightPreview->GetLightDir(); QPushButton* source = qobject_cast(sender()); FLOATVECTOR4 prevColorVec; if (source == pushButton_ambientColor) prevColorVec = cAmbient; else if (source == pushButton_diffuseColor) prevColorVec = cDiffuse; else if (source == pushButton_specularColor) prevColorVec = cSpecular; else return; // these should probably be a size_t or even unsigned char, but Qt's APIs // take an int. const int rgb[3] = { static_cast(prevColorVec[0] * 255), static_cast(prevColorVec[1] * 255), static_cast(prevColorVec[2] * 255) }; QColor prevColor(rgb[0], rgb[1], rgb[2]); QColor color = QColorDialog::getColor(prevColor, this); if (color.isValid()) { prevColorVec[0] = color.red()/255.0f; prevColorVec[1] = color.green()/255.0f; prevColorVec[2] = color.blue()/255.0f; if (source == pushButton_ambientColor) cAmbient = prevColorVec; else if (source == pushButton_diffuseColor) cDiffuse = prevColorVec; else if (source == pushButton_specularColor) cSpecular = prevColorVec; else return; m_pQLightPreview->SetData(cAmbient,cDiffuse,cSpecular,vLightDir); m_pActiveRenderWin->SetLightColors(cAmbient, cDiffuse, cSpecular, vLightDir); } } void MainWindow::LightMoved() { if (!m_pActiveRenderWin) return; FLOATVECTOR4 cAmbient = m_pQLightPreview->GetAmbient(); FLOATVECTOR4 cDiffuse = m_pQLightPreview->GetDiffuse(); FLOATVECTOR4 cSpecular = m_pQLightPreview->GetSpecular(); FLOATVECTOR3 vLightDir = m_pQLightPreview->GetLightDir(); m_pActiveRenderWin->SetLightColors(cAmbient, cDiffuse, cSpecular, vLightDir); } void MainWindow::ChangeLightColors() { if (!m_pActiveRenderWin) return; FLOATVECTOR4 cAmbient = m_pQLightPreview->GetAmbient(); FLOATVECTOR4 cDiffuse = m_pQLightPreview->GetDiffuse(); FLOATVECTOR4 cSpecular = m_pQLightPreview->GetSpecular(); FLOATVECTOR3 vLightDir = m_pQLightPreview->GetLightDir(); cAmbient[3] = horizontalSlider_ambientIntensity->value()/100.0f; cDiffuse[3] = horizontalSlider_diffuseIntensity->value()/100.0f; cSpecular[3] = horizontalSlider_specularIntensity->value()/100.0f; m_pQLightPreview->SetData(cAmbient,cDiffuse,cSpecular,vLightDir); m_pActiveRenderWin->SetLightColors(cAmbient, cDiffuse, cSpecular, vLightDir); } void MainWindow::SetTagVolume() { if (!m_pActiveRenderWin) return; if (checkBox_TagVolume->isChecked()) m_pActiveRenderWin->SetInterpolant(tuvok::NearestNeighbor); else m_pActiveRenderWin->SetInterpolant(tuvok::Linear); } void MainWindow::UpdateInterpolant() { if (!m_pActiveRenderWin) return; checkBox_TagVolume->setChecked( m_pActiveRenderWin->GetInterpolant() == tuvok::NearestNeighbor); } void MainWindow::UpdateTFScaleSliders() { if (!m_pActiveRenderWin) return; verticalSlider_1DTransHistScale->setValue(int(m_pActiveRenderWin->GetCurrent1DHistScale()*verticalSlider_1DTransHistScale->maximum())); verticalSlider_2DTransHistScale->setValue(int(m_pActiveRenderWin->GetCurrent2DHistScale()*verticalSlider_2DTransHistScale->maximum())); } void MainWindow::UpdateColorWidget() { FLOATVECTOR4 cAmbient(1,1,1,0.1f); FLOATVECTOR4 cDiffuse(1,1,1,1.0f); FLOATVECTOR4 cSpecular(1,1,1,1); FLOATVECTOR3 vLightDir(0,0,-1); if (m_pActiveRenderWin && m_pActiveRenderWin->IsRendererValid()) { cAmbient = m_pActiveRenderWin->GetAmbient(); cDiffuse = m_pActiveRenderWin->GetDiffuse(); cSpecular = m_pActiveRenderWin->GetSpecular(); vLightDir = m_pActiveRenderWin->GetLightDir(); } m_pQLightPreview->SetData(cAmbient,cDiffuse,cSpecular,vLightDir); // these should probably be a size_t or even unsigned char, but Qt's APIs // take an int. const int intensity[3] = { static_cast(cAmbient[3] * 100), static_cast(cDiffuse[3] * 100), static_cast(cSpecular[3] * 100) }; horizontalSlider_ambientIntensity->setValue(intensity[0]); horizontalSlider_diffuseIntensity->setValue(intensity[1]); horizontalSlider_specularIntensity->setValue(intensity[2]); } void MainWindow::ResetRenderingParameters() { if (!m_pActiveRenderWin) return; m_pActiveRenderWin->ResetRenderingParameters(); } static void CallQTProcessEvents() { QApplication::processEvents(); } void MainWindow::LuaSetIsoValueFloat(float fValue) { SetIsoValue(fValue); } void MainWindow::LuaSetIsoValueInteger(int iValue) { SetIsoValue(iValue); } void MainWindow::LuaMoveProgramWindow(const INTVECTOR2& pos) { move(pos.x, pos.y); } void MainWindow::LuaResizeProgramWindow(const UINTVECTOR2& size) { resize(size.x, size.y); } void MainWindow::RegisterLuaClasses() { shared_ptr ss(m_MasterController.LuaScript()); string prefix = "iv3d."; ss->registerClass( this, &MainWindow::LuaCreateNewWindow, prefix + "renderer", "Constructs a new render window", LuaClassRegCallback::Type( &RenderWindow::RegisterLuaFunctions)); ss->registerClass( this, &MainWindow::LuaLoadDatasetInternal, prefix + "rendererWithParams", "Open a render window the additional parameters and a list of files.", LuaClassRegCallback::Type( &RenderWindow::RegisterLuaFunctions)); // And some lua functions... // We need to expose QApplication::processEvents() because we are running // in the GUI thread... This is useful for scripts that take a long time to // run and need the UI to update. ss->registerFunction( &CallQTProcessEvents, prefix + "processUI", "Calls QT's QApplication::processEvents(). If you have a long running " "script and want the UI to update while the script is running, you will " "need to call this periodically. This is necessary because Tuvok runs on " "the GUI's thread instead of on its own thread.", false); m_MemReg.registerFunction( this, &MainWindow::LuaMoveProgramWindow, prefix + "move", "Moves the main window to position (x, y).", true); m_MemReg.registerFunction( this, &MainWindow::LuaResizeProgramWindow, prefix + "resize", "Resizes the main window to size (w, h).", true); m_MemReg.registerFunction(this, &MainWindow::LuaPlaceActiveWindow, prefix + "placeActiveWindow", "Moves the active window to specific coordinates.", true); m_MemReg.registerFunction(this, &MainWindow::LuaResizeActiveWindow, prefix + "resizeActiveWindow", "Resizes the active window.", true); m_MemReg.registerFunction(this, &MainWindow::ListSupportedImages, prefix + "listSupportedImages", "Lists supported images.", false); m_MemReg.registerFunction(this, &MainWindow::ListSupportedVolumes, prefix + "listSupportedVolumes", "Lists supported volumes.", false); m_MemReg.registerFunction(this, &MainWindow::ListSupportedGeometry, prefix + "listSupportedGeometry", "Lists supported geometry.", false); m_MemReg.registerFunction(this, &MainWindow::SetStayOpen, prefix + "setStayOpen", "Stay open after script ended " "passed in via command line.", false); m_MemReg.registerFunction(this, &MainWindow::Use1DTrans, prefix + "use1DTFMode", "Enable 1D transfer function mode.", false); m_MemReg.registerFunction(this, &MainWindow::Use2DTrans, prefix + "use2DTFMode", "Enable 2D transfer function mode.", false); m_MemReg.registerFunction(this, &MainWindow::UseIso, prefix + "useIsoMode", "Enable iso-surface rendering mode.", false); m_MemReg.registerFunction(this, &MainWindow::LuaSetIsoValueFloat, prefix + "setIsoValueFloat", "Set threshold value for iso-surface rendering in the range [0.0, 1.0].", false); m_MemReg.registerFunction(this, &MainWindow::LuaSetIsoValueInteger, prefix + "setIsoValueInteger", "Set threshold value for iso-surface rendering as integer.", false); std::shared_ptr reg = m_MasterController.LuaScript(); } void MainWindow::closeMDISubWindowWithWidget(QWidget* widget) { QMdiSubWindow* foundWindow = NULL; QList list = mdiArea->subWindowList(); for (QList::iterator it = list.begin(); it != list.end(); ++it) { if ((*it)->widget() == widget) { foundWindow = *it; break; } } if (foundWindow) { mdiArea->removeSubWindow(foundWindow); } } static std::string readfile(const std::string& filename) { std::ifstream ifs(filename.c_str(), std::ios::in); ifs >> noskipws; return std::string( (std::istream_iterator(ifs)), (std::istream_iterator()) ); } bool MainWindow::RunLuaScript(const std::string& strFilename) { shared_ptr ss = m_MasterController.LuaScript(); ss->setExpectedExceptionFlag(true); try { ss->exec(readfile(strFilename)); } catch(const tuvok::LuaError& e) { T_ERROR("Lua error executing script: %s", e.what()); return false; } catch(const std::exception& e) { T_ERROR("Error executing script: %s", e.what()); return false; } catch(...) { T_ERROR("Unknown error executing script!"); return false; } ss->setExpectedExceptionFlag(false); return true; } ImageVis3D-3.1.0/ImageVis3D/UI/RenderWindowDX.cpp0000644000175000017500000001150012320517543021036 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : RenderWindowDX.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #include "../Tuvok/StdTuvokDefines.h" #if defined(_WIN32) && defined(USE_DIRECTX) #include #include /// @todo FIXME -- remove (obviously)! /// We need this first because GPUMemMan depends on OpenGL /// but shouldn't, and GLEW will blow up if we don't include /// GLEW before GL includes. #include "3rdParty/GLEW/GL/glew.h" #include "RenderWindowDX.h" #include "ImageVis3D.h" #include "../Tuvok/Renderer/DX/DXRenderer.h" #include using namespace std; RenderWindowDX::RenderWindowDX(MasterController& masterController, MasterController::EVolumeRendererType eType, const QString& dataset, unsigned int iCounter, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder, QWidget* parent, Qt::WindowFlags flags) : QWidget(parent, flags), RenderWindow(masterController, eType, dataset, iCounter, parent) { setBaseSize( sizeHint() ); shared_ptr ss = m_MasterController.LuaScript(); m_LuaAbstrRenderer = ss->cexecRet( "tuvok.renderer.new", eType, bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder, false, false); m_Renderer = m_LuaAbstrRenderer.getRawPointer(ss); string rn = m_LuaAbstrRenderer.fqName(); // so far we are not rendering anything previous to this renderer // so we can disable the depth-buffer to offscreen copy operations ss->cexec(rn + ".setConsiderPrevDepthBuffer", false); if (m_LuaAbstrRenderer.isValid(ss)) { // hand over the handle of the window we are sitting in not the widget // inside the window // setWinID is a function that has been specifically registered by // DXRenderer. HWND type is handled as a special case (see DXRenderer.h). ss->cexec(rn + ".setWinID", parent->winId()); if (!ss->cexecRet(rn + ".loadDataset", m_strDataset.toStdString())) { InitializeRenderer(); Initialize(); setObjectName("RenderWindowDX"); // this is used by WidgetToRenderWin() to detect the type setWindowTitle(m_strID); setFocusPolicy(Qt::StrongFocus); setMouseTracking(true); m_bRenderSubsysOK = true; return; } } m_bRenderSubsysOK = false; } RenderWindowDX::~RenderWindowDX() { // ignore mouse/keyboard events while we're killing ourself. GetQtWidget()->setEnabled(false); } void RenderWindowDX::PaintOverlays() { } void RenderWindowDX::RenderSeparatingLines() { } void RenderWindowDX::InitializeRenderer() { shared_ptr ss = m_MasterController.LuaScript(); string rn = m_LuaAbstrRenderer.fqName(); if (!m_LuaAbstrRenderer.isValid(ss)) { m_bRenderSubsysOK = false; } else { m_bRenderSubsysOK = ss->cexecRet(rn + ".initializeDirectX"); } if (!m_bRenderSubsysOK) { if (m_LuaAbstrRenderer.isValid(ss)) { ss->cexec(rn + ".cleanup"); } m_MasterController.ReleaseVolumeRenderer(m_LuaAbstrRenderer); m_LuaAbstrRenderer.invalidate(); } } void RenderWindowDX::ForceRepaint() { repaint(); } void RenderWindowDX::ToggleFullscreen() { // TODO } void RenderWindowDX::resizeEvent ( QResizeEvent * event ) { ResizeRenderer(event->size().width(), event->size().height()); } #endif // _WIN32 && USE_DIRECTX ImageVis3D-3.1.0/ImageVis3D/UI/QDataRadioButton.cpp0000644000175000017500000001256012320517543021347 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : QDataRadioButton.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : September 2008 // //! Copyright (C) 2008 SCI Institute #include "QDataRadioButton.h" #include #include "../Tuvok/IO/TuvokJPEG.h" #include "../Tuvok/IO/DICOM/DICOMParser.h" #include "../Tuvok/IO/3rdParty/jpeglib/jconfig.h" QDataRadioButton::QDataRadioButton(std::shared_ptr stack, QWidget *parent) : QRadioButton(parent), m_iCurrentImage((unsigned int)(-1)), m_stackInfo(stack), m_fScale(1.0f) { SetupInfo(); } QDataRadioButton::QDataRadioButton(std::shared_ptr stack, const QString &text, QWidget *parent) : QRadioButton(text, parent), m_iCurrentImage((unsigned int)(-1)), m_stackInfo(stack), m_fScale(1.0f) { SetupInfo(); } void QDataRadioButton::leaveEvent(QEvent * event) { QRadioButton::leaveEvent(event); SetStackImage(int(m_stackInfo->m_Elements.size()/2)); } void QDataRadioButton::mouseMoveEvent(QMouseEvent *event){ QRadioButton::mouseMoveEvent(event); unsigned int i; i = (unsigned int)(float(event->x()) / float(width()) * m_stackInfo->m_Elements.size()); SetStackImage(i); } void QDataRadioButton::SetBrightness(float fScale) { m_fScale = fScale; SetStackImage(m_iCurrentImage, true); } #ifdef DETECTED_OS_WINDOWS #pragma warning(disable:4996) #endif void QDataRadioButton::SetStackImage(unsigned int i, bool bForceUpdate) { if (!bForceUpdate && m_iCurrentImage == i) return; m_iCurrentImage = i; QIcon icon; std::vector vData; if (m_stackInfo->m_bIsJPEGEncoded) { tuvok::JPEG jpg(m_stackInfo->m_Elements[i]->m_strFileName, dynamic_cast (m_stackInfo->m_Elements[i])->GetOffsetToData()); const char *jpg_data = jpg.data(); // JPEG library automagically downsamples the data. m_stackInfo->m_iAllocated = BITS_IN_JSAMPLE; vData.resize(jpg.size()); std::copy(jpg_data, jpg_data + jpg.size(), &vData[0]); } else { m_stackInfo->m_Elements[i]->GetData(vData); } QImage image(m_stackInfo->m_ivSize.x, m_stackInfo->m_ivSize.y, QImage::Format_RGB32); if (m_stackInfo->m_iComponentCount == 1) { switch (m_stackInfo->m_iAllocated) { case 8 :{ unsigned int i = 0; unsigned char* pCharData = reinterpret_cast (&vData[0]); for (int y = 0;y (&vData[0]); for (int y = 0;ym_iStored))) ); image.setPixel(x,y, qRgb(value,value,value)); i++; } } break; default : break; /// \todo handle other bitwith data } } else { /// \todo handle color data } icon.addPixmap(QPixmap::fromImage(image), QIcon::Normal, QIcon::Off); setIcon(icon); update(); } #ifdef DETECTED_OS_WINDOWS #pragma warning(default:4996) #endif void QDataRadioButton::SetupInfo() { setMouseTracking(true); size_t iElemCount = m_stackInfo->m_Elements.size(); QString desc = tr(" %1 \n Size: %2 x %3 x %4\n") .arg(m_stackInfo->m_strDesc.c_str()) .arg(m_stackInfo->m_ivSize.x) .arg(m_stackInfo->m_ivSize.y) .arg(m_stackInfo->m_ivSize.z*iElemCount); setText(desc); SetStackImage(uint32_t(iElemCount/2)); } ImageVis3D-3.1.0/ImageVis3D/UI/ImageVis3D_FileHandling.cpp0000644000175000017500000013713512320517543022507 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : ImageVis3D_FileHandling.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : September 2008 // //! Copyright (C) 2008 SCI Institute #include #include #include #include #include "ImageVis3D.h" #include "BrowseData.h" #include #include #include #include #include "Basics/Mesh.h" #include "Basics/SysTools.h" #include "Controller/Controller.h" #include "IO/TuvokIOError.h" #include "IO/uvfDataset.h" #include "DebugOut/QTLabelOut.h" #include "LODDlg.h" #include "MergeDlg.h" #include "PleaseWait.h" #include "LuaScripting/TuvokSpecific/LuaDatasetProxy.h" #include "LuaScripting/TuvokSpecific/LuaTuvokTypes.h" #include "LuaScripting/TuvokSpecific/LuaTransferFun1DProxy.h" using namespace std; using namespace tuvok; // ****************************************** // Dataset // ****************************************** void MainWindow::LoadDataset() { QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString selectedFilter; QSettings settings; QString strLastDir = settings.value("Folders/LoadDataset", ".").toString(); shared_ptr ss(m_MasterController.LuaScript()); QString dialogString = ss->cexecRet("tuvok.io.getLoadDialogString").c_str(); QStringList files; if(m_MasterController.ExperimentalFeatures()) { files = QFileDialog::getOpenFileNames( this, "Load Datasets", strLastDir, dialogString, &selectedFilter, options ); } else { QString fileName = QFileDialog::getOpenFileName(this, "Load Dataset", strLastDir, dialogString, &selectedFilter, options); if (!fileName.isEmpty()) { files.append(fileName); } } if (!files.isEmpty()) { settings.setValue("Folders/LoadDataset", QFileInfo(files[0]).absoluteDir().path()); const char* rwe ="Could not open a render window! This normally " "means ImageVis3D does not support your GPU. Please" " check the debug log ('Help | Debug Window') for " "errors, and/or use 'Help | Report an Issue' to " "notify the ImageVis3D developers."; try { if(!LoadDataset(files)) { if(m_bIgnoreLoadDatasetFailure == false) { ShowCriticalDialog("Render window initialization failed.", rwe); } m_bIgnoreLoadDatasetFailure = false; } } catch(const std::exception& e) { if(e.what() != NULL) { if (strlen(e.what()) > 0) ShowCriticalDialog("Could not load data set!", e.what()); else ShowCriticalDialog("Could not load data set!", "Operation has been canceled."); } else { ShowCriticalDialog("Render window initialization failed.", rwe); } } } } void MainWindow::ExportGeometry() { QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString selectedFilter; QSettings settings; QString strLastDir = settings.value("Folders/ExportMesh", ".").toString(); shared_ptr ss(m_MasterController.LuaScript()); QString fileName = QFileDialog::getSaveFileName(this, "Export Current Mesh to File", strLastDir, ss->cexecRet("tuvok.io.getGeoExportDialogString").c_str(), &selectedFilter, options); if (!fileName.isEmpty()) { settings.setValue("Folders/ExportMesh", QFileInfo(fileName).absoluteDir().path()); string targetFileName = string(fileName.toAscii()); // still a valid filename ext ? if (ss->cexecRet("tuvok.io.hasConverterForExt", SysTools::ToLowerCase(SysTools::GetExt( string(fileName.toAscii()))), true, false) == false) { ShowCriticalDialog("Extension Error", "Unable to determine the file type " "from the file extension."); return; } int iCurrent = listWidget_DatasetComponents->currentRow(); if (iCurrent < 1 || iCurrent >= listWidget_DatasetComponents->count()) { T_ERROR("No Mesh selected."); return; } if (!ExportGeometry(iCurrent-1,targetFileName)) { ShowCriticalDialog("Export Error", "Unable to export the mesh " "to the selected file. " "For details please check the debug log " "('Help | Debug Window')."); return; } } } bool MainWindow::ExportGeometry(size_t i, std::string strFilename) { if (!m_pActiveRenderWin) return false; LuaClassInstance ds = m_pActiveRenderWin->GetRendererDataset(); shared_ptr ss(m_MasterController.LuaScript()); if (!ds.isValid(ss) || (ss->cexecRet(ds.fqName() + ".getDSType") != LuaDatasetProxy::UVF) ) return false; PleaseWaitDialog pleaseWait(this); pleaseWait.SetText("Exporting Mesh..."); pleaseWait.AttachLabel(&m_MasterController); std::vector> meshes = ss->cexecRet>>(ds.fqName() + "getMeshes"); return ss->cexecRet("tuvok.io.exportMesh", meshes[i], strFilename); } void MainWindow::RemoveGeometry() { if (!m_pActiveRenderWin) return; LuaClassInstance ds = m_pActiveRenderWin->GetRendererDataset(); shared_ptr ss(m_MasterController.LuaScript()); if (!ds.isValid(ss) || (ss->cexecRet(ds.fqName() + ".getDSType") != LuaDatasetProxy::UVF) ) return; PleaseWaitDialog pleaseWait(this); pleaseWait.SetText("Removing Mesh from UVF file..."); pleaseWait.AttachLabel(&m_MasterController); int iCurrent = listWidget_DatasetComponents->currentRow(); if (iCurrent < 1 || iCurrent >= listWidget_DatasetComponents->count()) { T_ERROR("No Mesh selected."); return; } m_pActiveRenderWin->SetDatasetIsInvalid(true); if (!ss->cexecRet(ds.fqName() + ".removeMesh", size_t(iCurrent-1))) { pleaseWait.close(); ShowCriticalDialog("Mesh Removal Failed.", "Could not remove mesh from the UVF file, " "maybe the file is write protected? For details please " "check the debug log ('Help | Debug Window')."); } else { m_pActiveRenderWin->RemoveMeshData(size_t(iCurrent-1)); UpdateExplorerView(true); pleaseWait.close(); } m_pActiveRenderWin->SetDatasetIsInvalid(false); } void MainWindow::AddGeometry(std::string filename) { if (!m_pActiveRenderWin) return; if(!m_pActiveRenderWin->SupportsMeshes()) { if(QMessageBox::Yes == QMessageBox::question(NULL, "Mesh feature not supported in this renderer", "You can add a mesh to this dataset but you will " "not be able to see it until you switch to a renderer " "that supports this feature e.g. the 3D slice " "based volume renderer. Do you want to switch to " "the 3D slice based volume renderer now?", QMessageBox::Yes, QMessageBox::No)) { QString dataset = m_pActiveRenderWin->GetDatasetName(); CloseCurrentView(); MasterController::EVolumeRendererType currentType = m_eVolumeRendererType; m_eVolumeRendererType = MasterController::OPENGL_SBVR; LoadDataset(std::string(dataset.toAscii())); m_eVolumeRendererType = currentType; } } shared_ptr ss = m_MasterController.LuaScript(); LuaClassInstance ds = m_pActiveRenderWin->GetRendererDataset(); LuaDatasetProxy::DatasetType type = ss->cexecRet(ds.fqName() + ".getDSType"); if (type != LuaDatasetProxy::UVF) { ShowCriticalDialog("Mesh Import Failed.", "Mesh Integration only supported for UVF datasets."); return; } PleaseWaitDialog pleaseWait(this); pleaseWait.SetText("Loading mesh, please wait ..."); pleaseWait.AttachLabel(&m_MasterController); std::shared_ptr m; try { m = ss->cexecRet>("tuvok.io.loadMesh", filename); } catch (const tuvok::io::DSOpenFailed& err) { WARNING("Conversion failed! %s", err.what()); } if (!m) { ShowCriticalDialog("Mesh Import Failed.", "Could not load mesh file. For details please " "check the debug log ('Help | Debug Window')."); return; } // make sure we have at least normals if (m->GetNormalIndices().empty()) { pleaseWait.SetText("Computing normals, please wait ..."); m->RecomputeNormals(); } pleaseWait.SetText("Integrating Mesh into volume file, please wait ..."); m_pActiveRenderWin->SetDatasetIsInvalid(true); shared_ptr constMeshPtr = m; if (!ss->cexecRet(ds.fqName() + ".appendMesh", constMeshPtr)) { pleaseWait.close(); ShowCriticalDialog("Mesh Import Failed.", "Could not integrate the mesh into this UVF file. " "For details please check the debug log " "('Help | Debug Window')."); } else { pleaseWait.SetText("Creating render resources, please wait ..."); m_pActiveRenderWin->ScanForNewMeshes(); pleaseWait.close(); UpdateExplorerView(true); } m_pActiveRenderWin->SetDatasetIsInvalid(false); } void MainWindow::AddGeometry() { QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QSettings settings; QString selFilter; shared_ptr ss(m_MasterController.LuaScript()); QString dialogString = ss->cexecRet("tuvok.io.getLoadGeoDialogString").c_str(); QString strLastDir = settings.value("Folders/AddTriGeo", ".").toString(); QString geoFile = QFileDialog::getOpenFileName(this, "Select Geometry File", strLastDir, dialogString, &selFilter, options); if(geoFile.isEmpty()) { return; } settings.setValue("Folders/AddTriGeo", QFileInfo(geoFile).absoluteDir().path()); AddGeometry(string(geoFile.toAscii())); } void MainWindow::LoadDataset(std::string strFilename) { try { if(!LoadDataset(QStringList(strFilename.c_str())) != 0) { if(m_bIgnoreLoadDatasetFailure == false) { ShowCriticalDialog("Render window initialization failed.", "Could not open a render window! This normally " "means ImageVis3D does not support your GPU. Please" " check the debug log ('Help | Debug Window') for " "errors, and/or use 'Help | Report an Issue' to " "notify the ImageVis3D developers." ); } m_bIgnoreLoadDatasetFailure = false; } } catch(const tuvok::io::DSParseFailed& ds) { std::ostringstream err; err << "Could not parse '" << ds.File() << "': " << ds.what() << "\n" << "This typically means the file has been corrupted."; ShowCriticalDialog("Could not parse file", err.str().c_str()); } catch(const tuvok::io::DSVerificationFailed& ds) { std::ostringstream err; err << "The checksum for '" << ds.File() << "' is invalid: " << ds.what() << "\nThe file has been corrupted."; ShowCriticalDialog("Checksum failed", err.str().c_str()); } catch(const tuvok::io::DSOpenFailed& ds) { std::ostringstream err; err << "Could not open '" << ds.File() << "': " << ds.what(); ShowCriticalDialog("Could not open file", err.str().c_str()); } } QString MainWindow::GetConvFilename(const QString& sourceName) { QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString selectedFilter; QSettings settings; QString strLastDir = settings.value("Folders/GetConvFilename", ".").toString(); QString suggestedFileName = SysTools::ChangeExt( SysTools::GetFilename(string(sourceName.toAscii())), "uvf" ).c_str(); strLastDir = tr("%1/%2").arg(strLastDir).arg(suggestedFileName); QString targetFilename = QFileDialog::getSaveFileName(this, "Select filename for converted data", strLastDir, "Universal Volume Format (*.uvf)", &selectedFilter, options); if (!targetFilename.isEmpty()) { targetFilename = SysTools::CheckExt(string(targetFilename.toAscii()), "uvf").c_str(); settings.setValue("Folders/GetConvFilename", QFileInfo(targetFilename).absoluteDir().path()); } return targetFilename; } bool MainWindow::LoadDataset(const std::vector< std::string >& strParams) { if (strParams.size() < 1 || strParams.size() > 2) { return false; } string inFile = strParams[0], convFile; if (strParams.size() == 1) { convFile = SysTools::ChangeExt(inFile, "uvf"); } else { convFile = strParams[1]; } return LoadDataset(QStringList(inFile.c_str()), convFile.c_str(), false); } bool MainWindow::CheckForMeshCapabilities(bool bNoUserInteraction, QStringList files) { if (bNoUserInteraction) { if (m_pActiveRenderWin && !m_pActiveRenderWin->SupportsMeshes() && m_pActiveRenderWin->GetRendererMeshes().size() > 0) { WARNING("This dataset contains mesh data but the current " "renderer does not supports rendering meshes. Mesh " "rendering is disabled until you switch to a renderer " "that supports this feature e.g. the 3D slice " "based volume renderer."); m_pActiveRenderWin->ClearRendererMeshes(); UpdateExplorerView(true); } } else { if (m_pActiveRenderWin && !m_pActiveRenderWin->SupportsMeshes() && m_pActiveRenderWin->GetRendererMeshes().size() > 0) { m_pRedrawTimer->stop(); if(QMessageBox::Yes == QMessageBox::question(NULL, "Mesh feature not supported in this renderer", "This dataset contains mesh data but the current " "renderer does not support rendering meshes. Mesh " "rendering is disabled until you switch to a renderer " "that supports this feature e.g. the 3D slice " "based volume renderer. Do you want to switch to " "the 3D slice based volume renderer now?", QMessageBox::Yes, QMessageBox::No)) { CloseCurrentView(); MasterController::EVolumeRendererType currentType = m_eVolumeRendererType; m_eVolumeRendererType = MasterController::OPENGL_SBVR; LoadDataset(files); m_eVolumeRendererType = currentType; m_pRedrawTimer->start(IV3D_TIMER_INTERVAL); return true; } else { m_pActiveRenderWin->ClearRendererMeshes(); UpdateExplorerView(true); } m_pRedrawTimer->start(IV3D_TIMER_INTERVAL); } } return false; } bool MainWindow::LoadDataset(QStringList files, QString targetFilename, bool bNoUserInteraction) { std::vector stdFiles; for (QStringList::iterator it = files.begin(); it != files.end(); ++it) { string datasetName = it->toStdString(); stdFiles.push_back(datasetName); } string stdTargetFilename = targetFilename.toStdString(); LuaClassInstance inst = m_MasterController.LuaScript()->cexecRet( "iv3d.rendererWithParams.new", stdFiles, stdTargetFilename, bNoUserInteraction); return !inst.isDefaultInstance(); } RenderWindow* MainWindow::LuaLoadDatasetInternal(vector stdFiles, string stdTargetFilename, bool bNoUserInteraction) { QStringList files; for (vector::iterator it = stdFiles.begin(); it != stdFiles.end(); ++it) { files.push_back(QString::fromStdString(*it)); } QString targetFilename = QString::fromStdString(stdTargetFilename); bool retVal = LoadDatasetInternal(files, targetFilename, bNoUserInteraction); if (retVal == true) { return m_pLastLoadedRenderWin; } else { m_MasterController.LuaScript()->vPrint("False returned from load dataset " "internal."); return NULL; } } bool MainWindow::LoadDatasetInternal(QStringList files, QString targetFilename, bool bNoUserInteraction) { if(files.empty()) { T_ERROR("No files!"); return false; } PleaseWaitDialog pleaseWait(this); pleaseWait.SetText("Loading dataset, please wait ..."); pleaseWait.AttachLabel(&m_MasterController); // First check to make sure the list of files we've been given makes sense. for(QStringList::const_iterator fn = files.begin(); fn != files.end(); ++fn) { if(fn->isEmpty()) { T_ERROR("Empty filelist"); return false; } if(!SysTools::FileExists(std::string(fn->toAscii()))) { QString strText = tr("File %1 not found.").arg(*fn); T_ERROR("%s", strText.toStdString().c_str()); if(!bNoUserInteraction) { ShowCriticalDialog( "Load Error", strText); } return false; } } // now determine if we've been given a UVF, and can just open it and be done, // or if we need to convert the files. // If we were given multiple files, we don't need to do any work; we *know* // that needs to be converted. shared_ptr ss(m_MasterController.LuaScript()); bool needs_conversion = true; if(files.size() == 1) { // check to see if we need to convert this file to a supported format. if(!ss->cexecRet("tuvok.io.needsConversion",files[0].toStdString())) { needs_conversion = false; // It might also be the case that the checksum is bad && we need to // report an error, but we don't bother with the checksum if they've // asked us not to in the preferences. if(!m_bQuickopen && false == ss->cexecRet("tuvok.io.verify", files[0].toStdString())) { QString strText = tr("File %1 appears to be a broken UVF file: " "the header looks ok, " "but the checksum does not match.").arg(files[0]); T_ERROR("%s", strText.toStdString().c_str()); if (!bNoUserInteraction) { ShowCriticalDialog("Load Error", strText); } return false; } } } QString filename = files[0]; if(needs_conversion) { if (!bNoUserInteraction && targetFilename.isEmpty()) { targetFilename = GetConvFilename(files[0]); } if (targetFilename.isEmpty()) { T_ERROR("User interaction disabled but no targetFilename given"); return false; } std::list stdfiles; for(QStringList::const_iterator fn = files.begin(); fn != files.end(); ++fn) { stdfiles.push_back(std::string(fn->toAscii())); } PleaseWaitDialog pleaseWait(this); pleaseWait.SetText("Converting, please wait ..."); pleaseWait.AttachLabel(&m_MasterController); try { ss->cexec("tuvok.io.convertDataset", stdfiles, std::string(targetFilename.toAscii()), m_strTempDir, bNoUserInteraction, false); filename = targetFilename; } catch(const tuvok::io::IOException& e) { // create a (hopefully) useful error message std::ostringstream error; error << "Unable to convert "; std::copy(stdfiles.begin(), stdfiles.end(), std::ostream_iterator(error, ", ")); error << " into " << std::string(targetFilename.toAscii()) << ": " << e.what(); T_ERROR("%s", error.str().c_str()); if(!bNoUserInteraction) { ShowCriticalDialog("Conversion Error", QString(error.str().c_str())); } // now close that dialog and bail. pleaseWait.close(); return false; } pleaseWait.close(); } RenderWindow *renderWin = NULL; try { renderWin = CreateNewRenderWindow(filename); if(renderWin == NULL) { T_ERROR("Renderwindow creation failed. Bailing..."); return false; } renderWin->GetQtWidget()->show(); // calls RenderWindowActive automatically UpdateMenus(); AddFileToMRUList(filename); } catch(tuvok::io::DSBricksOversized&) { WARNING("Bricks are too large. Querying the user to see if we should " "rebrick the dataset."); if(renderWin) { delete renderWin; renderWin = NULL; } if(bNoUserInteraction) { T_ERROR("Dataset needs rebricking but ImageVis3D is not running interactively."); return false; } if(QMessageBox::Yes == QMessageBox::question(NULL, "Rebricking required", "The bricking scheme in this dataset is not compatible with " "your current brick size settings. Do you want to convert this " "dataset so that it can be loaded? Note that this operation can " "take as long as originally converting the data took!", QMessageBox::Yes, QMessageBox::No)) { // m_bIgnoreLoadDatasetFailure is an ugly hack, but I can't see any other // *good* options. // // An alternative to m_bIgnoreLoadDatasetFailure is to throw a custom // exception which would include bNoUserInteraction's value, and catch // the exception in MainWindow::LoadDataset(std::string strFilename). // (and MainWindow::LoadDataset(), and MainWindow::OpenRecentFile). // We would perform the rebricking upon catching the exception. // This method seemed equally hacky so I opted for the smallest code // footprint and inserted this boolean flag. // // Also, we can use the flag when the user specifies 'no' on the dialog. // It doesn't make much sense to tell the user that we failed to // load the RenderWindow because they told us to not load it =P. // // The problem: if we reach here, we were in the process of creating // a series of Lua classes to support a render window. Since we are no // longer creating a viable render window (renderWin was deleted, and // RebrickDataset is creating a new render window), lua needs to be // notified and clean up any supporting classes. // // The only way to notify Lua is to do 1 of 2 things: // 1) Return false from this function (behaving as if the requested // dataset failed to load -- which it did). // 2) Or throw an exception and let lua capture and rethrow it. // // I opted for #1. RebrickDataset(filename, targetFilename, bNoUserInteraction); m_bIgnoreLoadDatasetFailure = true; return false; } else { m_bIgnoreLoadDatasetFailure = true; return false; } } if (renderWin) RenderWindowActive(renderWin); if (CheckForMeshCapabilities(bNoUserInteraction, files)) return true; if(renderWin) { LuaClassInstance ds = renderWin->GetRendererDataset(); shared_ptr ss = m_MasterController.LuaScript(); UINT64VECTOR3 dom_sz = ss->cexecRet(ds.fqName() + ".getDomainSize", size_t(0), size_t(0)); // Disable lighting for 2D datasets (images). if(dom_sz[2] == 1) { checkBox_Lighting->setChecked(false); checkBox_Lighting->setEnabled(false); SetLighting(false); } } return true; } bool MainWindow::RebrickDataset(QString filename, QString targetFilename, bool bNoUserInteraction) { QSettings settings; QString strLastDir = settings.value("Folders/GetConvFilename", ".").toString(); shared_ptr ss(m_MasterController.LuaScript()); QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString selectedFilter; QString rebrickedFilename; do { rebrickedFilename = QFileDialog::getSaveFileName(this, "Select filename for converted data", strLastDir, "Universal Volume Format (*.uvf)", &selectedFilter, options); if (!rebrickedFilename.isEmpty()) { rebrickedFilename = SysTools::CheckExt( std::string(rebrickedFilename.toAscii()), "uvf" ).c_str(); if (rebrickedFilename == filename) { ShowCriticalDialog("Input Error", "Rebricking can not be performed in place, " "please select another file."); } else { settings.setValue("Folders/GetConvFilename", QFileInfo(rebrickedFilename).absoluteDir().path()); PleaseWaitDialog pleaseWait(this); pleaseWait.SetText("Rebricking, please wait ..."); pleaseWait.AttachLabel(&m_MasterController); if(!ss->cexecRet("tuvok.io.rebrickDataset", string(filename.toAscii()), string(rebrickedFilename.toAscii()), m_strTempDir)) { ShowCriticalDialog("Error during rebricking.", "The system was unable to rebrick the data set, " "please check the error log for details (Menu -> " "\"Help\" -> \"Debug Window\")."); return false; } else { pleaseWait.hide(); } } } else { return false; } } while (rebrickedFilename == filename); return LoadDataset(QStringList(rebrickedFilename), targetFilename, bNoUserInteraction); } void MainWindow::LoadDirectory() { QSettings settings; QString strLastDir = settings.value("Folders/LoadDirectory", ".").toString(); QString directoryName = QFileDialog::getExistingDirectory(this, "Load Dataset from Directory", strLastDir); if (!directoryName.isEmpty()) { settings.setValue("Folders/LoadDirectory", directoryName); PleaseWaitDialog pleaseWait(this); pleaseWait.SetText("Scanning directory for files, please wait ..."); pleaseWait.AttachLabel(&m_MasterController); BrowseData browseDataDialog(m_MasterController, (QDialog*)&pleaseWait, directoryName, this); if (browseDataDialog.DataFound()) { if (browseDataDialog.exec() == QDialog::Accepted) { QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString selectedFilter; QString targetFilename = GetConvFilename(directoryName); if (targetFilename.isEmpty()) return; pleaseWait.SetText("Converting, please wait ..."); // label was detached when the dialog was closed by BrowseData pleaseWait.AttachLabel(&m_MasterController); shared_ptr ss(m_MasterController.LuaScript()); if (!ss->cexecRet("tuvok.io.convertDatasetWithStack", browseDataDialog.GetStackInfo(), targetFilename.toStdString(), m_strTempDir, false)) { QString strText = tr("Unable to convert file stack from directory " "%1 into %2.").arg(directoryName).arg(targetFilename); ShowCriticalDialog("Conversion Error", strText); T_ERROR("%s", strText.toStdString().c_str()); } pleaseWait.DetachLabel(); RenderWindow *renderWin = CreateNewRenderWindow(targetFilename); if(NULL == renderWin || !renderWin->IsRenderSubsysOK()) { ShowCriticalDialog("Renderer Error", "Unable to open the converted data set, " "please check the error log for details " "(Menu -> \"Help\" -> \"Debug Window\")."); T_ERROR("Unable to open dataset, please check previous error msgs."); delete renderWin; return; } renderWin->GetQtWidget()->show(); RenderWindowActive(renderWin); AddFileToMRUList(targetFilename); } } else { QString msg = tr("Error no valid files in directory %1 found.").arg(directoryName); ShowInformationDialog( tr("Problem"), msg); } } } bool MainWindow::ExportDataset(uint32_t iLODLevel, std::string targetFileName) { if (!m_pActiveRenderWin) { WARNING("No active render window"); return false; } PleaseWaitDialog pleaseWait(this); pleaseWait.SetText("Exporting, please wait ..."); pleaseWait.AttachLabel(&m_MasterController); shared_ptr ss = m_MasterController.LuaScript(); bool bResult = ss->cexecRet("tuvok.io.exportDataset", m_pActiveRenderWin->GetRendererDataset(), static_cast(iLODLevel), targetFileName, m_strTempDir); pleaseWait.close(); return bResult; } void MainWindow::ExportDataset() { if (!m_pActiveRenderWin) return; QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString selectedFilter; QSettings settings; QString strLastDir = settings.value("Folders/ExportDataset", ".").toString(); shared_ptr ss(m_MasterController.LuaScript()); QString dialogString = ss->cexecRet("tuvok.io.getExportDialogString").c_str(); std::string ext; QString fileName; do { fileName = QFileDialog::getSaveFileName(this, "Export Current Dataset", strLastDir, dialogString, &selectedFilter, options); if(fileName.isEmpty()) { // not an error -- the user might get here if they wanted to cancel the // export. break; } // get it out of a QString && figure out what file type we're dealing with. std::string filter = std::string(selectedFilter.toAscii()); size_t start = filter.find_last_of("*.")+1; size_t end = filter.find_last_of(")"); ext = filter.substr(start, end-start); SysTools::TrimStr(ext); if(ext == "") { QMessageBox noformat; noformat.setText("No file extension: unknown export format"); noformat.setIcon(QMessageBox::Critical); noformat.exec(); } } while(ext == ""); if (!fileName.isEmpty()) { settings.setValue("Folders/ExportDataset", QFileInfo(fileName).absoluteDir().path()); string strCompletefileName = SysTools::CheckExt(string(fileName.toAscii()), ext); shared_ptr ss = m_MasterController.LuaScript(); LuaClassInstance ds = m_pActiveRenderWin->GetRendererDataset(); int iMaxLODLevel = static_cast( ss->cexecRet(ds.fqName() + ".getLODLevelCount")) - 1; int iLODLevel = 0; if (iMaxLODLevel > 0) { int iMinLODLevel = 0; vector vDesc; for (int i = iMinLODLevel;i<=iMaxLODLevel;i++) { UINTVECTOR3 vLODSize = UINTVECTOR3(ss->cexecRet( ds.fqName() + ".getDomainSize", size_t(i), size_t(0))); QString qstrDesc = tr("%1 x %2 x %3").arg(vLODSize.x).arg(vLODSize.y).arg(vLODSize.z); vDesc.push_back(qstrDesc); } LODDlg lodDlg("Which LOD Level do you want to export?", iMinLODLevel, iMaxLODLevel, vDesc, this); if (lodDlg.exec() != QDialog::Accepted) return; else iLODLevel = lodDlg.GetLOD(); } PleaseWaitDialog pleaseWait(this); pleaseWait.SetText("Exporting, please wait ..."); pleaseWait.AttachLabel(&m_MasterController); if (!ExportDataset(iLODLevel, strCompletefileName)) { ShowCriticalDialog( "Error during dataset export.", "The system was unable to export the current data set, please check the error log for details (Menu -> \"Help\" -> \"Debug Window\")."); } else { pleaseWait.hide(); QString msg = tr("The dataset has been exported as %1.").arg(strCompletefileName.c_str()); ShowInformationDialog( tr("Export successful"), msg); } } } bool MainWindow::ExportIsosurface(uint32_t iLODLevel, string targetFileName) { if (!m_pActiveRenderWin) { m_MasterController.DebugOut()->Warning("MainWindow::ExportIso", "No active renderwin"); return false; } PleaseWaitDialog pleaseWait(this); pleaseWait.SetText("Exporting mesh, please wait ..."); pleaseWait.AttachLabel(&m_MasterController); int iValue = horizontalSlider_Isovalue->value(); FLOATVECTOR4 color(m_pActiveRenderWin->GetIsosurfaceColor(),1.0f); shared_ptr ss = m_MasterController.LuaScript(); bool bResult = ss->cexecRet("tuvok.io.extractIsosurface", m_pActiveRenderWin->GetRendererDataset(), static_cast(iLODLevel), static_cast(iValue), color, targetFileName, m_strTempDir); pleaseWait.close(); return bResult; } void MainWindow::ExportImageStack() { QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString selectedFilter; QSettings settings; QString strLastDir = settings.value("Folders/ExportImageStack", ".").toString(); shared_ptr ss(m_MasterController.LuaScript()); string filterStr = ss->cexecRet("tuvok.io.getImageExportDialogString").c_str(); QString fileName = QFileDialog::getSaveFileName(this, "Export Current Dataset to a Set of Images", strLastDir,filterStr.c_str(),&selectedFilter, options); if (!fileName.isEmpty()) { settings.setValue("Folders/ExportImageStack", QFileInfo(fileName).absoluteDir().path()); string targetFileName = string(fileName.toAscii()); string selectedFilterStr = string(selectedFilter.toAscii()); std::string filterExt = ss->cexecRet("tuvok.io.imageExportDialogFilterToExt", selectedFilterStr); if (SysTools::GetExt(targetFileName).empty()) { if (filterExt.empty()) { ShowCriticalDialog( "Error during image stack export.", "Unable to determine file type from filename."); return; } else { targetFileName += std::string(".") + filterExt; } } shared_ptr ss = m_MasterController.LuaScript(); LuaClassInstance ds = m_pActiveRenderWin->GetRendererDataset(); int iMaxLODLevel = static_cast( ss->cexecRet(ds.fqName() + ".getLODLevelCount") ) - 1; int iLODLevel = 0; if (iMaxLODLevel > 0) { int iMinLODLevel = 0; vector vDesc; for (int i = iMinLODLevel;i<=iMaxLODLevel;i++) { UINTVECTOR3 vLODSize = UINTVECTOR3( ss->cexecRet( ds.fqName() + ".getDomainSize", size_t(i), size_t(0)) ); QString qstrDesc = tr("%1 x %2 x %3").arg(vLODSize.x).arg(vLODSize.y).arg(vLODSize.z); vDesc.push_back(qstrDesc); } LODDlg lodDlg("For which LOD Level do you want to export the image stack?", iMinLODLevel, iMaxLODLevel, vDesc, this); if (lodDlg.exec() != QDialog::Accepted) return; else iLODLevel = lodDlg.GetLOD(); } bool bAllDirs = QMessageBox::Yes == QMessageBox::question(this, "Texture Stack Exporter", "Do you want to export three stacks along all three directions? Otherwise only one stack along the z-axis is created.", QMessageBox::Yes, QMessageBox::No); if(!ExportImageStack(uint32_t(iLODLevel), targetFileName, bAllDirs)) { ShowCriticalDialog( "Error during image stack export.", "The system was unable to export the current data set, please check the error log for details (Menu -> \"Help\" -> \"Debug Window\")."); return; } } } bool MainWindow::ExportImageStack(uint32_t iLODLevel, std::string targetFileName, bool bAllDirs) { if (!m_pActiveRenderWin) { m_MasterController.DebugOut()->Warning("MainWindow::ExportImageStack", "No active renderwin"); return false; } PleaseWaitDialog pleaseWait(this); pleaseWait.SetText("Exporting image stack, please wait ..."); pleaseWait.AttachLabel(&m_MasterController); FLOATVECTOR4 color(m_pActiveRenderWin->GetIsosurfaceColor(),1.0f); shared_ptr ss = m_MasterController.LuaScript(); LuaClassInstance tf = m_1DTransferFunction->GetTrans(); bool bResult = ss->cexecRet("tuvok.io.extractImageStack", m_pActiveRenderWin->GetRendererDataset(), tf, static_cast(iLODLevel), targetFileName, m_strTempDir, bAllDirs); pleaseWait.close(); return bResult; } void MainWindow::ExportIsosurface() { QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString selectedFilter; QSettings settings; QString strLastDir = settings.value("Folders/ExportIso", ".").toString(); shared_ptr ss(m_MasterController.LuaScript()); QString fileName = QFileDialog::getSaveFileName(this, "Export Current Isosurface to Mesh", strLastDir, ss->cexecRet("tuvok.io.getGeoExportDialogString").c_str(), &selectedFilter, options); if (!fileName.isEmpty()) { settings.setValue("Folders/ExportIso", QFileInfo(fileName).absoluteDir().path()); string targetFileName = string(fileName.toAscii()); // still a valid filename ext ? if (!ss->cexecRet("tuvok.io.hasGeoConverterForExt", SysTools::ToLowerCase(SysTools::GetExt( string(fileName.toAscii()))), true,false)) { ShowCriticalDialog("Extension Error", "Unable to determine the file type " "from the file extension."); return; } LuaClassInstance ds = m_pActiveRenderWin->GetRendererDataset(); int iMaxLODLevel = int(ss->cexecRet(ds.fqName() + ".getLODLevelCount"))-1; int iLODLevel = 0; if (iMaxLODLevel > 0) { int iMinLODLevel = 0; vector vDesc; for (int i = iMinLODLevel;i<=iMaxLODLevel;i++) { UINTVECTOR3 vLODSize = UINTVECTOR3( ss->cexecRet(ds.fqName() + ".getDomainSize", static_cast(i), static_cast(0))); QString qstrDesc = tr("%1 x %2 x %3").arg(vLODSize.x).arg(vLODSize.y).arg(vLODSize.z); vDesc.push_back(qstrDesc); } LODDlg lodDlg("For which LOD Level do you want to compute the mesh?", iMinLODLevel, iMaxLODLevel, vDesc, this); if (lodDlg.exec() != QDialog::Accepted) return; else iLODLevel = lodDlg.GetLOD(); } if(!ExportIsosurface(uint32_t(iLODLevel), targetFileName)) { ShowCriticalDialog( "Error during mesh export.", "The system was unable to export the current data set, please check the error log for details (Menu -> \"Help\" -> \"Debug Window\")."); return; } // if the choosen format supports import then ask the users if they want to re-import the mesh bool hasConverter = ss->cexecRet("tuvok.io.hasGeoConverterForExt", SysTools::GetExt(targetFileName), false,true); if (hasConverter) { if(QMessageBox::Yes == QMessageBox::question(this, "Add Mesh to Project", "Do you want to load the surface a part of this project?", QMessageBox::Yes, QMessageBox::No)) { AddGeometry(targetFileName); } } } } void MainWindow::CompareFiles(const std::string& strFile1, const std::string& strFile2) const { string strMessage = ""; if (LargeRAWFile::Compare(strFile1, strFile2, &strMessage)) { m_MasterController.DebugOut()->Message("MainWindow::CompareFiles", "Files are identical!"); } else { m_MasterController.DebugOut()->Warning("MainWindow::CompareFiles", "%s (Comparing %s %s)", strMessage.c_str(), strFile1.c_str(), strFile2.c_str()); } } void MainWindow::MergeDatasets() { MergeDlg m(this); if (m.exec() == QDialog::Accepted) { vector strFilenames; vector vScales; vector vBiases; for (size_t i = 0;im_strFilename); vScales.push_back(m.m_vDataSetList[i]->m_fScale); vBiases.push_back(m.m_vDataSetList[i]->m_fBias); } QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString selectedFilter; QSettings settings; QString strLastDir = settings.value("Folders/MergedOutput", ".").toString(); shared_ptr ss(m_MasterController.LuaScript()); QString dialogString = tr("%1%2") .arg(ss->cexecRet("tuvok.io.getExportDialogString").c_str()) .arg("Universal Volume Format (*.uvf);;"); QString fileName = QFileDialog::getSaveFileName(this, "Merged Dataset", strLastDir, dialogString,&selectedFilter, options); if (!fileName.isEmpty()) { settings.setValue("Folders/MergedOutput", QFileInfo(fileName).absoluteDir().path()); std::string stdFile = std::string(fileName.toAscii()); if(SysTools::GetExt(stdFile) == "") { WARNING("no extension; assuming UVF."); stdFile = stdFile + ".uvf"; // fix fileName too: used later if the user tries to load the data. fileName = QString(stdFile.c_str()); } PleaseWaitDialog pleaseWait(this); pleaseWait.SetText("Merging ..."); pleaseWait.AttachLabel(&m_MasterController); if (m.UseCustomExpr()) { try { ss->cexec("tuvok.io.evaluateExpression", m.GetCustomExpr().c_str(), strFilenames, stdFile); } catch (tuvok::Exception& e) { std::string errMsg = "Unable to merge the selected data sets, make " "sure that the size and type of the data sets " "are the same. Also, check your expression."; if (strlen(e.what()) > 0) { errMsg += " Error: "; errMsg += e.what(); } ShowCriticalDialog("Data Set Expression Merge Error", errMsg.c_str()); return; } } else { if(!ss->cexecRet("tuvok.io.mergeDatasets", strFilenames, vScales, vBiases, stdFile, m_strTempDir, m.UseMax())) { ShowCriticalDialog("Data set Merge Error", "Unable to merge the selected data sets, make " "sure that the size and type of the data sets " "are the same."); return; } } pleaseWait.close(); } if (!m_bScriptMode) { if (QMessageBox::No == QMessageBox::question(NULL, "Dataset Merger", "Do you want to load the merged data set now?", QMessageBox::Yes, QMessageBox::No)) { return; } QString targetFilename = tr("%1%2").arg(fileName).arg(".uvf"); LoadDataset(QStringList(fileName), targetFilename); } } } void MainWindow::SaveAspectRatioToUVF() { if (m_pActiveRenderWin) { m_pActiveRenderWin->SetDatasetIsInvalid(true); PleaseWaitDialog pleaseWait(this); pleaseWait.SetText("Writing rescale factors to file..."); pleaseWait.AttachLabel(&m_MasterController); shared_ptr ss(m_MasterController.LuaScript()); LuaClassInstance ds = m_pActiveRenderWin->GetRendererDataset(); try { if (!ss->cexecRet(ds.fqName() + ".saveRescaleFactors")) { if (!m_bScriptMode) { QMessageBox::warning(this, "File Error", "Unable to save rescale factors to file.", QMessageBox::Ok); } } } catch (std::exception& e) { std::string errMsg = "Unable to save scale factors to UVF file."; if (strlen(e.what()) > 0) { errMsg += " Error: "; errMsg += e.what(); } QMessageBox::warning(this, "Scale Factor Save Error", errMsg.c_str(), QMessageBox::Ok); } DOUBLEVECTOR3 vfRescaleFactors = ss->cexecRet(ds.fqName() + ".getRescaleFactors"); doubleSpinBox_RescaleX->setValue(vfRescaleFactors.x); doubleSpinBox_RescaleY->setValue(vfRescaleFactors.y); doubleSpinBox_RescaleZ->setValue(vfRescaleFactors.z); pleaseWait.close(); m_pActiveRenderWin->SetDatasetIsInvalid(false); } } void MainWindow::CropData() { if (m_pActiveRenderWin) { // todo fix this by copying the meshes from the old dataset to the new one if (!m_pActiveRenderWin->GetRendererMeshes().empty()) { QMessageBox::warning(this, "File Error", "Cropping datasets that contain meshes is not supported at the moment.", QMessageBox::Ok); return; } bool bKeepOldData = (QMessageBox::Yes == QMessageBox::question(NULL, "Create Backup?", "Do you want to create a backup of the current dataset before cropping?", QMessageBox::Yes, QMessageBox::No)); m_pActiveRenderWin->SetDatasetIsInvalid(true); PleaseWaitDialog pleaseWait(this); pleaseWait.SetText("Cropping dataset"); pleaseWait.AttachLabel(&m_MasterController); LuaClassInstance first3DRegion = m_pActiveRenderWin->GetFirst3DRegion(); ExtendedPlane p = m_pActiveRenderWin->GetRendererClipPlane(); FLOATMATRIX4 trans = m_pActiveRenderWin->GetRotation(first3DRegion) * m_pActiveRenderWin->GetTranslation(first3DRegion); // get rid of the viewing transformation in the plane p.Transform(trans.inverse(),false); if (!m_pActiveRenderWin->RendererCropDataset(m_strTempDir,bKeepOldData)) { if (!m_bScriptMode) { QMessageBox::warning(this, "File Error", "Unable to crop dataset, is the file write protected?", QMessageBox::Ok); } } else { ToggleClipPlane(false); } m_pActiveRenderWin->SetDatasetIsInvalid(false); RenderWindow* current = m_pActiveRenderWin; m_pActiveRenderWin = NULL; // set m_pActiveRenderWin to NULL so RenderWindowActive thinks it has changed RenderWindowActive(current); pleaseWait.close(); } } ImageVis3D-3.1.0/ImageVis3D/UI/PleaseWait.h0000644000175000017500000000500512320517543017701 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : PleaseWait.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : July 2008 // //! Copyright (C) 2008 SCI Institute #ifndef PLEASEWAIT_H #define PLEASEWAIT_H #include "AutoGen/ui_PleaseWait.h" #include "DebugOut/QTLabelOut.h" #include "../Tuvok/Controller/MasterController.h" using namespace tuvok; class QPushButton; class PleaseWaitDialog : public QDialog, protected Ui_PleaseWaitDialog { Q_OBJECT public: PleaseWaitDialog(QWidget* parent, Qt::WindowFlags flags = Qt::Tool, bool bHasCancelButton= false); virtual ~PleaseWaitDialog(); QTLabelOut* AttachLabel(MasterController* pMasterController); void DetachLabel(); void SetText(QString text) { label->setText(text); if(this->isHidden()) { this->show(); } } QLabel* GetStatusLabel() const {return label_Status;} void closeEvent(QCloseEvent *event); bool Canceled() const { return m_bCanceled; } private slots: void CancelClicked(); signals: void CancelSignal(); protected: MasterController* m_pMasterController; QTLabelOut* m_pLabelOut; QPushButton* m_ButtonCancel; bool m_bCanceled; }; #endif // PLEASEWAIT_H ImageVis3D-3.1.0/ImageVis3D/UI/ImageVis3D_Settings.cpp0000644000175000017500000007042012320517543021754 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : ImageVis3D_Settings.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : September 2008 // //! Copyright (C) 2008 SCI Institute #include #include #include #include #include #include "../Tuvok/Renderer/GPUMemMan/GPUMemMan.h" #include "../Tuvok/DebugOut/TextfileOut.h" #include "../Tuvok/Controller/Controller.h" #include "ImageVis3D.h" #include "../Tuvok/Basics/MathTools.h" #include "../Tuvok/Basics/SystemInfo.h" #include "../Tuvok/Basics/SysTools.h" #include "SettingsDlg.h" #include "BasicSettingsDlg.h" using namespace std; void MainWindow::CheckSettings() { QSettings settings; // if memory isn't set this must be the first time we run this app if (UINT64_INVALID == settings.value("Memory/MaxGPUMem", static_cast(UINT64_INVALID)).toULongLong()) { ShowSettings(!m_bScriptMode && QMessageBox::No == QMessageBox::question(this, "Initial Setup", "As this is the first " "time you've started ImageVis3D on this system, " "ImageVis3D has been configured with the default " "parameters. You may want to verify this inital " "configuration. In particular, the memory usage " "settings need to be configured according to the " "hardware configuration of the machine. Do you want " "to check the settings now?", QMessageBox::Yes, QMessageBox::No)); } ApplySettings(); // Apply startup settings E2DTransferFunctionMode tfMode = (E2DTransferFunctionMode)(settings.value("UI/2DTFMode", int(TFM_BASIC)).toInt()); if (tfMode != m_2DTransferFunction->Get2DTFMode()) { Transfer2DToggleTFMode(); } } void MainWindow::SaveSettings( uint64_t CPUMem, uint64_t maxCPU, uint64_t GPUMem, uint64_t maxGPU, bool ignoreMax, const std::string& tempDir, bool checksum, unsigned framerate, bool lowResSubframes, unsigned LODDelay, unsigned activeTS, unsigned inactiveTS, bool writeLog, bool showCrashDialog, const std::string& logFile, uint32_t logLevel, bool showVersion, bool autoSaveGeo, bool autoSaveWSP, bool autoLockCloned, bool absoluteLocks, bool checkForUpdates, bool checkForDevBuilds, bool showWelcome, bool invertWheel, bool i3mFeatures, unsigned volRenType, unsigned blendPrecision, bool powerTwo, bool downsampleTo8, bool disableBorder, const FLOATVECTOR3& backColor1, const FLOATVECTOR3& backColor2, const FLOATVECTOR4& textColor, const QString& logo, int logoPosition, unsigned maxBrickSize, unsigned builderBrickSize, bool medianFilter, bool clampToEdge, uint32_t compression, uint32_t compressionLevel, bool experimentalFeatures, bool advancedSettings, uint32_t layout ) { QSettings settings; settings.beginGroup("Memory"); { settings.setValue("MaxGPUMem", static_cast(GPUMem)); settings.setValue("MaxCPUMem", static_cast(CPUMem)); settings.setValue("OverrideDetectedMaxima", ignoreMax); settings.setValue("OverriddenCPUMax", static_cast(maxCPU)); settings.setValue("OverriddenGPUMax", static_cast(maxGPU)); settings.setValue("TempDir", QString(tempDir.c_str())); settings.setValue("MaxBricksize", maxBrickSize); settings.setValue("BuilderBrickSize", builderBrickSize); settings.setValue("UseMedian", medianFilter); settings.setValue("ClampToEdge", clampToEdge); settings.setValue("Compression", compression); settings.setValue("CompressionLevel", compressionLevel); settings.setValue("Layout", layout); } settings.endGroup(); settings.beginGroup("Performance"); { settings.setValue("Quickopen", checksum); settings.setValue("MinFrameRate", framerate); settings.setValue("UseAllMeans", lowResSubframes); settings.setValue("LODDelay", LODDelay); settings.setValue("ActiveTS", activeTS); settings.setValue("InactiveTS", inactiveTS); settings.setValue("WriteLogFile", writeLog); settings.setValue("ShowCrashDialog", showCrashDialog); settings.setValue("LogFileName", QString(logFile.c_str())); settings.setValue("LogLevel", logLevel); } settings.endGroup(); settings.beginGroup("UI"); { settings.setValue("VersionInTitle", showVersion); settings.setValue("AutoSaveGEO", autoSaveGeo); settings.setValue("AutoSaveWSP", autoSaveWSP); settings.setValue("AutoLockClonedWindow", autoLockCloned); settings.setValue("AbsoluteViewLocks", absoluteLocks); settings.setValue("CheckForUpdatesOnStartUp", checkForUpdates); settings.setValue("CheckForDevBuilds", checkForDevBuilds); settings.setValue("ShowWelcomeScreen", showWelcome); settings.setValue("InvertMouseWheel", invertWheel); settings.setValue("I3MFeatures", i3mFeatures); settings.setValue("ExperimentalFeatures", experimentalFeatures); } settings.endGroup(); settings.beginGroup("Renderer"); { settings.setValue("RendererType", volRenType); settings.setValue("BlendPrecisionMode", blendPrecision); settings.setValue("PowerOfTwo", powerTwo); settings.setValue("DownSampleTo8Bits", downsampleTo8); settings.setValue("DisableBorder", disableBorder); settings.setValue("Background1R", backColor1.x); settings.setValue("Background1G", backColor1.y); settings.setValue("Background1B", backColor1.z); settings.setValue("Background2R", backColor2.x); settings.setValue("Background2G", backColor2.y); settings.setValue("Background2B", backColor2.z); settings.setValue("TextR", textColor.x); settings.setValue("TextG", textColor.y); settings.setValue("TextB", textColor.z); settings.setValue("TextA", textColor.w); settings.setValue("LogoFilename", logo); settings.setValue("LogoPosition", logoPosition); } settings.endGroup(); ApplySettings(); settings.setValue("AdvancedSettings", advancedSettings); } bool MainWindow::ShowAdvancedSettings(bool bInitializeOnly) { QSettings settings; SettingsDlg settingsDlg(m_pActiveRenderWin != NULL, m_MasterController, this); shared_ptr ss(m_MasterController.LuaScript()); settings.beginGroup("Memory"); uint64_t iMaxGPUmb = settings.value("MaxGPUMem", static_cast(UINT64_INVALID) ).toULongLong(); uint64_t iMaxCPUmb = std::min(settings.value("MaxCPUMem", static_cast(UINT64_INVALID)).toULongLong(), m_MasterController.SysInfo()->GetCPUMemSize() ); // All GPU and CPU memory settings are in megabytes. Hack to resolve 64-bit // QSettings serialization issues on Mac OS X. // QVariant was being set correctly, but when serialized through QSettings, // QVariant would lose its type ulonglong (5) destroying the 4 higher order // bytes in the process. uint64_t iMaxGPU = iMaxGPUmb * 1000000; uint64_t iMaxCPU = iMaxCPUmb * 1000000; bool bOverrideDetMax = settings.value("OverrideDetectedMaxima", false).toBool(); unsigned int iOverMaxCPU = settings.value("OverriddenCPUMax", 0).toUInt(); unsigned int iOverMaxGPU = settings.value("OverriddenGPUMax", 0).toUInt(); string strTempDir(settings.value("TempDir", m_strTempDir.c_str()).toString().toAscii()); unsigned int iMaxBrickSize = settings.value( "MaxBricksize", static_cast(MathTools::Log2( ss->cexecRet("tuvok.io.getMaxBrickSize")))).toUInt(); unsigned int iMaxMaxBrickSize = settings.value("MaxMaxBricksize", 14).toUInt(); // since OpenGL specs are only available if we've already opened a // window, this value may be invalid (0) if (RenderWindow::GetMax3DTexDims()) { iMaxMaxBrickSize = MathTools::Log2(RenderWindow::GetMax3DTexDims()); settings.setValue("MaxMaxBricksize", iMaxMaxBrickSize); } unsigned int iBuilderBrickSize = settings.value("BuilderBrickSize", static_cast(7)).toUInt(); bool bUseMedian = settings.value("UseMedian", false).toBool(); bool bClampToEdge = settings.value("ClampToEdge", false).toBool(); uint32_t iCompression = settings.value("Compression", 1).toUInt(); uint32_t iCompressionLevel = settings.value("CompressionLevel", 1).toUInt(); uint32_t iLayout = settings.value("Layout", 0).toUInt(); settings.endGroup(); settings.beginGroup("Performance"); bool bQuickopen = settings.value("Quickopen", m_bQuickopen).toBool(); unsigned int iMinFramerate = settings.value("MinFrameRate", m_iMinFramerate).toUInt(); unsigned int iLODDelay = settings.value("LODDelay", m_iLODDelay).toUInt(); bool bRenderLowResIntermediateResults = settings.value("UseAllMeans", m_bRenderLowResIntermediateResults).toBool(); unsigned int iActiveTS = settings.value("ActiveTS", m_iActiveTS).toUInt(); unsigned int iInactiveTS = settings.value("InactiveTS", m_iInactiveTS).toUInt(); bool bWriteLogFile = settings.value("WriteLogFile", m_bWriteLogFile).toBool(); bool bShowCrashDialog = settings.value("ShowCrashDialog", true).toBool(); QString strLogFileName = settings.value("LogFileName", m_strLogFileName).toString(); unsigned int iLogLevel = settings.value("LogLevel", m_iLogLevel).toUInt(); settings.endGroup(); settings.beginGroup("UI"); bool bShowVersionInTitle = settings.value("VersionInTitle", m_bShowVersionInTitle).toBool(); bool bAutoSaveGEO = settings.value("AutoSaveGEO", m_bAutoSaveGEO).toBool(); bool bAutoSaveWSP = settings.value("AutoSaveWSP", m_bAutoSaveWSP).toBool(); bool bAutoLockClonedWindow = settings.value("AutoLockClonedWindow", m_bAutoLockClonedWindow).toBool(); bool bAbsoluteViewLocks = settings.value("AbsoluteViewLocks", m_bAbsoluteViewLocks).toBool(); bool bCheckForUpdatesOnStartUp = settings.value("CheckForUpdatesOnStartUp", m_bCheckForUpdatesOnStartUp).toBool(); bool bCheckForDevBuilds = settings.value("CheckForDevBuilds", m_bCheckForDevBuilds).toBool(); bool bShowWelcomeScreen = settings.value("ShowWelcomeScreen", m_bShowWelcomeScreen).toBool(); bool bInvWheel = settings.value("InvertMouseWheel", m_bInvWheel).toBool(); bool bI3MFeatures = settings.value("I3MFeatures", m_bI3MFeatures).toBool(); bool expFeatures = settings.value( "ExperimentalFeatures", m_MasterController.ExperimentalFeatures() ).toBool(); settings.endGroup(); settings.beginGroup("Renderer"); unsigned int iVolRenType = settings.value("RendererType", (unsigned int)m_eVolumeRendererType).toUInt(); unsigned int iBlendPrecisionMode = settings.value("BlendPrecisionMode", 0).toUInt(); bool bPowerOfTwo = settings.value("PowerOfTwo", m_bPowerOfTwo).toBool(); bool bDownSampleTo8Bits = settings.value("DownSampleTo8Bits", m_bDownSampleTo8Bits).toBool(); bool bDisableBorder = settings.value("DisableBorder", m_bDisableBorder).toBool(); FLOATVECTOR3 vBackColor1(settings.value("Background1R", 0.0).toDouble(), settings.value("Background1G", 0.0).toDouble(), settings.value("Background1B", 0.0).toDouble()); FLOATVECTOR3 vBackColor2(settings.value("Background2R", 0.0).toDouble(), settings.value("Background2G", 0.0).toDouble(), settings.value("Background2B", 0.0).toDouble()); FLOATVECTOR4 vTextColor(settings.value("TextR", 1.0).toDouble(), settings.value("TextG", 1.0).toDouble(), settings.value("TextB", 1.0).toDouble(), settings.value("TextA", 1.0).toDouble()); QString strLogoFilename = settings.value("LogoFilename", m_strLogoFilename).toString(); int iLogoPos = settings.value("LogoPosition", m_iLogoPos).toInt(); settings.endGroup(); bool bIsDirectX10Capable = m_MasterController.SysInfo()->IsDirectX10Capable(); // hand data to form settingsDlg.Data2Form(bIsDirectX10Capable, iMaxCPU, iMaxGPU, bOverrideDetMax, iOverMaxCPU, iOverMaxGPU, strTempDir, bQuickopen, iMinFramerate, bRenderLowResIntermediateResults, iLODDelay, iActiveTS, iInactiveTS, bWriteLogFile, bShowCrashDialog, string(strLogFileName.toAscii()), iLogLevel, bShowVersionInTitle, bAutoSaveGEO, bAutoSaveWSP, bAutoLockClonedWindow, bAbsoluteViewLocks, bCheckForUpdatesOnStartUp, bCheckForDevBuilds, bShowWelcomeScreen, bInvWheel, bI3MFeatures, iVolRenType, iBlendPrecisionMode, bPowerOfTwo, bDownSampleTo8Bits, bDisableBorder, vBackColor1, vBackColor2, vTextColor, strLogoFilename, iLogoPos, iMaxBrickSize, iBuilderBrickSize, iMaxMaxBrickSize, bUseMedian, bClampToEdge, iCompression, iCompressionLevel, expFeatures, iLayout ); if (bInitializeOnly || settingsDlg.exec() == QDialog::Accepted) { this->SaveSettings( // We add 500000 to round the value to the nearest megabyte. // If this is not done, it appears that we lose 1 MB when // reopening the preferences dialog after making modifications // to the memory allocations ((settingsDlg.GetCPUMem() + 500000) / 1000000), settingsDlg.GetMaxCPUMem(), ((settingsDlg.GetGPUMem() + 500000) / 1000000), settingsDlg.GetMaxGPUMem(), settingsDlg.OverrideMaxMem(), settingsDlg.GetTempDir(), settingsDlg.GetQuickopen(), settingsDlg.GetMinFramerate(), settingsDlg.GetUseAllMeans(), settingsDlg.GetLODDelay(), settingsDlg.GetActiveTS(), settingsDlg.GetInactiveTS(), settingsDlg.GetWriteLogFile(), settingsDlg.GetShowCrashDialog(), settingsDlg.GetLogFileName(), (uint32_t)settingsDlg.GetLogLevel(), settingsDlg.GetShowVersionInTitle(), settingsDlg.GetAutoSaveGEO(), settingsDlg.GetAutoSaveWSP(), settingsDlg.GetAutoLockClonedWindow(), settingsDlg.GetAbsoluteViewLocks(), settingsDlg.GetCheckForUpdatesOnStartUp(), settingsDlg.GetCheckForDevBuilds(), settingsDlg.GetShowWelcomeScreen(), settingsDlg.GetInvertWheel(), settingsDlg.GetI3MFeatures(), settingsDlg.GetVolrenType(), settingsDlg.GetBlendPrecisionMode(), settingsDlg.GetUseOnlyPowerOfTwo(), settingsDlg.GetDownSampleTo8Bits(), settingsDlg.GetDisableBorder(), settingsDlg.GetBackgroundColor1(), settingsDlg.GetBackgroundColor2(), settingsDlg.GetTextColor(), settingsDlg.GetLogoFilename(), settingsDlg.GetLogoPos(), settingsDlg.GetMaxBrickSize(), settingsDlg.GetBuilderBrickSize(), settingsDlg.GetMedianFilter(), settingsDlg.GetClampToEdge(), settingsDlg.GetCompression(), settingsDlg.GetCompressionLevel(), settingsDlg.GetExperimentalFeatures(), true, settingsDlg.GetLayout() ); return true; } else { if(settingsDlg.GetUseBasicSettings()) { // then use the advanced setting instead. m_bAdvancedSettings = false; settings.setValue("AdvancedSettings", false); return ShowBasicSettings(bInitializeOnly); } return false; } } #ifdef DETECTED_OS_WINDOWS double log2(double x) { return log(float(x)) / log(2.f); } #endif bool MainWindow::ShowBasicSettings(bool initOnly ) { QSettings set; PerformanceLevel lvl = static_cast( set.value("BasicSettingsLevel", 0).toInt() ); BasicSettingsDlg bsd(m_MasterController, lvl, this); // to detect "i want to go to advanced mode", the dialog is actually // rejected---we only have two options to work with---and then a boolean must // be queried. int result = bsd.exec(); if(result == QDialog::Rejected && bsd.GetUseAdvancedSettings()) { // then use the advanced setting instead. m_bAdvancedSettings = true; set.setValue("AdvancedSettings", true); return ShowAdvancedSettings(initOnly); } if(result == QDialog::Accepted) { // ... apply settings. MESSAGE("Applying performance level %u", static_cast(bsd.GetPerformanceLevel())); set.setValue("BasicSettingsLevel", int(bsd.GetPerformanceLevel())); const SystemInfo& sinfo = *(m_MasterController.SysInfo()); uint64_t cpumem = sinfo.GetCPUMemSize() / (1024*1024); uint64_t gpumem = sinfo.GetGPUMemSize() / (1024*1024); std::string tempDir; if(!SysTools::GetTempDirectory(tempDir)) { SysTools::GetHomeDirectory(tempDir); } const bool showCrashDlg = true; // always true for 'basic' settings mode. const bool i3mfeatures = false; // always for 'basic' settings mode. const FLOATVECTOR3 black(0,0,0); const FLOATVECTOR3 darkblue(0,0,0.2f); const FLOATVECTOR3 white(1,1,1); switch(bsd.GetPerformanceLevel()) { case MAX_RESPONSIVENESS: this->SaveSettings(static_cast(ceil(cpumem * 0.75)), cpumem, static_cast(ceil(gpumem * 0.40)), gpumem, false, tempDir, false, 60, true, 1500, 150, 70, false, showCrashDlg, tempDir+"imagevis3d.log", 1, true, true, true, true, false, true, false, true, true, i3mfeatures, MasterController::OPENGL_2DSBVR, 0, true, false, false, black, darkblue, white, "", 0, unsigned(log2(256)), unsigned(log2(128)), true, false, 1, 1, false, false, 0); // TODO: If some other compressor or level or layout proofs to be faster // , use the fastest here! break; case MIDDLE_1: this->SaveSettings(static_cast(ceil(cpumem * 0.77)), cpumem, static_cast(ceil(gpumem * 0.60)), gpumem, false, tempDir, false, 30, true, 1500, 200, 80, false, showCrashDlg, tempDir+"imagevis3d.log", 1, true, true, true, true, false, true, false, true, true, i3mfeatures, MasterController::OPENGL_SBVR, 2, true, false, false, black, darkblue, white, "", 0, unsigned(log2(256)), unsigned(log2(128)), true, false, 1, 1, false, false, 0); // TODO: If some other compressor or level or layout proofs to be faster // , use the fastest here! break; case MAX_PERFORMANCE: this->SaveSettings(static_cast(ceil(cpumem * 0.9)), cpumem, static_cast(ceil(gpumem * 0.75)), gpumem, false, tempDir, false, 10, false, 1000, 500, 100, false, showCrashDlg, tempDir+"imagevis3d.log", 0, true, true, true, true, false, true, false, true, true, i3mfeatures, MasterController::OPENGL_SBVR, 2, true, false, false, black, darkblue, white, "", 0, unsigned(log2(256)), unsigned(log2(128)), true, false, 1, 1, false, false, 0); // TODO: If some other compressor or level or layout proofs to be faster // , use the fastest here! break; } } return true; } bool MainWindow::ShowSettings(bool initOnly) { if(m_bAdvancedSettings) { return ShowAdvancedSettings(initOnly); } else { return ShowBasicSettings(initOnly); } } void MainWindow::ApplySettings() { QSettings settings; shared_ptr ss(m_MasterController.LuaScript()); // Read settings m_bAdvancedSettings = settings.value("AdvancedSettings", m_bAdvancedSettings).toBool(); settings.beginGroup("Performance"); m_bQuickopen = settings.value("Quickopen", m_bQuickopen).toBool(); m_iMinFramerate = settings.value("MinFrameRate", m_iMinFramerate).toUInt(); m_iLODDelay = settings.value("LODDelay", m_iLODDelay).toUInt(); m_bRenderLowResIntermediateResults = settings.value("UseAllMeans", m_bRenderLowResIntermediateResults).toBool(); m_iActiveTS = settings.value("ActiveTS", m_iActiveTS).toUInt(); m_iInactiveTS = settings.value("InactiveTS", m_iInactiveTS).toUInt(); m_bWriteLogFile = settings.value("WriteLogFile", m_bWriteLogFile).toBool(); m_strLogFileName = settings.value("LogFileName", m_strLogFileName).toString(); m_iLogLevel = settings.value("LogLevel", m_iLogLevel).toUInt(); settings.endGroup(); settings.beginGroup("UI"); m_bShowVersionInTitle = settings.value("VersionInTitle", m_bShowVersionInTitle).toBool(); SetTitle(); m_bAutoSaveGEO = settings.value("AutoSaveGEO", m_bAutoSaveGEO).toBool(); m_bAutoSaveWSP = settings.value("AutoSaveWSP", m_bAutoSaveWSP).toBool(); m_bAutoLockClonedWindow = settings.value("AutoLockClonedWindow", m_bAutoLockClonedWindow).toBool(); m_bAbsoluteViewLocks = settings.value("AbsoluteViewLocks", m_bAbsoluteViewLocks).toBool(); m_bCheckForUpdatesOnStartUp = settings.value("CheckForUpdatesOnStartUp", m_bCheckForUpdatesOnStartUp).toBool(); m_bCheckForDevBuilds = settings.value("CheckForDevBuilds", m_bCheckForDevBuilds).toBool(); m_bShowWelcomeScreen = settings.value("ShowWelcomeScreen", m_bShowWelcomeScreen).toBool(); m_bInvWheel = settings.value("InvertMouseWheel", m_bInvWheel).toBool(); m_bI3MFeatures = settings.value("I3MFeatures", m_bI3MFeatures).toBool(); bool experimental = settings.value("ExperimentalFeatures", m_MasterController.ExperimentalFeatures()).toBool(); m_MasterController.ExperimentalFeatures(experimental); settings.endGroup(); actionTransfer_to_ImageVis3D_Mobile_Device->setVisible(m_bI3MFeatures); settings.beginGroup("Renderer"); m_eVolumeRendererType = (MasterController::EVolumeRendererType)settings.value("RendererType", (unsigned int)m_eVolumeRendererType).toUInt(); m_iBlendPrecisionMode = settings.value("BlendPrecisionMode", m_iBlendPrecisionMode).toUInt(); m_bPowerOfTwo = settings.value("PowerOfTwo", m_bPowerOfTwo).toBool(); m_bDownSampleTo8Bits = settings.value("DownSampleTo8Bits", m_bDownSampleTo8Bits).toBool(); m_bDisableBorder = settings.value("DisableBorder", m_bDisableBorder).toBool(); m_vBackgroundColors[0] = FLOATVECTOR3( settings.value("Background1R", 0.0).toDouble(), settings.value("Background1G", 0.0).toDouble(), settings.value("Background1B", 0.0).toDouble() ); m_vBackgroundColors[1] = FLOATVECTOR3( settings.value("Background2R", 0.0).toDouble(), settings.value("Background2G", 0.0).toDouble(), settings.value("Background2B", 0.0).toDouble() ); m_vTextColor = FLOATVECTOR4( settings.value("TextR", 1.0).toDouble(), settings.value("TextG", 1.0).toDouble(), settings.value("TextB", 1.0).toDouble(), settings.value("TextA", 1.0).toDouble() ); m_strLogoFilename = settings.value("LogoFilename", m_strLogoFilename).toString(); m_iLogoPos = settings.value("LogoPosition", m_iLogoPos).toInt(); settings.endGroup(); settings.beginGroup("Memory"); uint64_t iMaxCPUmb = std::min(settings.value("MaxCPUMem", static_cast(UINT64_INVALID)).toULongLong(), m_MasterController.SysInfo()->GetCPUMemSize()); uint64_t iMaxGPUmb = settings.value("MaxGPUMem", static_cast(UINT64_INVALID)).toULongLong(); m_strTempDir = std::string(settings.value("TempDir", m_strTempDir.c_str()).toString().toAscii()); uint64_t iMaxCPU = iMaxCPUmb * 1000000; // IEEE MB standard uint64_t iMaxGPU = iMaxGPUmb * 1000000; uint64_t iMaxBrickSizeLog = MathTools::Log2(ss->cexecRet("tuvok.io.getMaxBrickSize")); uint64_t iMaxBrickSize = MathTools::Pow2((uint64_t)settings.value("MaxBricksize", static_cast(iMaxBrickSizeLog)).toUInt()); iMaxBrickSizeLog = MathTools::Log2(iMaxBrickSize); uint64_t iBuilderBrickSize = MathTools::Pow2((uint64_t)settings.value("BuilderBrickSize", 7).toUInt()); bool bUseMedian = settings.value("UseMedian", false).toBool(); bool bClampToEdge = settings.value("ClampToEdge", false).toBool(); uint32_t iCompression = settings.value("Compression", 1).toUInt(); uint32_t iCompressionLevel = settings.value("CompressionLevel", 1).toUInt(); uint32_t iLayout = settings.value("Layout", 0).toUInt(); settings.endGroup(); // sanity check: make sure a RGBA float brick would fit into the specified memory uint64_t _iMaxBrickSizeLog = iMaxBrickSizeLog; while (iMaxBrickSizeLog > 1 && iMaxBrickSize*iMaxBrickSize*iMaxBrickSize*4*sizeof(float) > iMaxCPU) { iMaxBrickSizeLog--; iMaxBrickSize = MathTools::Pow2(iMaxBrickSizeLog); } if (_iMaxBrickSizeLog != iMaxBrickSizeLog) { WARNING("Reducing max bricksize from %i to %i because CPU memory limit would not allow bricks to be loaded", int(MathTools::Pow2(_iMaxBrickSizeLog)), int(MathTools::Pow2(iMaxBrickSizeLog))); } if (!ss->cexecRet("tuvok.io.setMaxBrickSize", iMaxBrickSize, iBuilderBrickSize)) { WARNING("Invalid MaxBrickSize read from configuration, ignoring value. Please check the configuration in the settings dialog."); } ss->cexec("tuvok.io.setUseMedianFilter", bUseMedian); ss->cexec("tuvok.io.setClampToEdge", bClampToEdge); ss->cexec("tuvok.io.setUVFCompression", iCompression); ss->cexec("tuvok.io.setUVFCompressionLevel", iCompressionLevel); ss->cexec("tuvok.io.setUVFLayout", iLayout); // Apply window settings for (int i = 0;isubWindowList().size();i++) { QWidget* w = mdiArea->subWindowList().at(i)->widget(); ApplySettings(WidgetToRenderWin(w)); } // Apply global settings m_MasterController.SysInfo()->SetMaxUsableCPUMem(iMaxCPU); m_MasterController.SysInfo()->SetMaxUsableGPUMem(iMaxGPU); m_MasterController.MemMan()->MemSizesChanged(); ToggleLogFile(); // as the "avoid compositing" setting may enable/disable the ability to do clearview // we must doublecheck the state of the controls if (m_pActiveRenderWin) ToggleClearViewControls(int(m_pActiveRenderWin->GetDynamicRange().second)); } void MainWindow::ApplySettings(RenderWindow* renderWin) { QSettings settings; if (!renderWin || !renderWin->IsRendererValid()) return; renderWin->SetColors(m_vBackgroundColors[0], m_vBackgroundColors[1], m_vTextColor); renderWin->SetBlendPrecision(AbstrRenderer::EBlendPrecision(m_iBlendPrecisionMode)); renderWin->SetPerfMeasures(m_iMinFramerate, m_bRenderLowResIntermediateResults, 2.0f, 2.0f, m_iLODDelay/m_pRedrawTimer->interval(), m_iActiveTS, m_iInactiveTS); renderWin->SetLogoParams(m_strLogoFilename, m_iLogoPos); renderWin->SetAbsoluteViewLock(m_bAbsoluteViewLocks); renderWin->SetInvMouseWheel(m_bInvWheel); } void MainWindow::ToggleLogFile() { if ( m_pTextout && string(m_strLogFileName.toAscii()) != m_pTextout->GetFileName()) { Controller::Instance().RemoveDebugOut(m_pTextout); m_pTextout = NULL; } if (m_bWriteLogFile) { bool bNewOut = !m_pTextout; if (!m_pTextout) m_pTextout = new TextfileOut(string(m_strLogFileName.toAscii())); m_pTextout->SetShowErrors(true); m_pTextout->SetShowWarnings(m_iLogLevel > 0); m_pTextout->SetShowMessages(m_iLogLevel > 1); if (bNewOut) Controller::Instance().AddDebugOut(m_pTextout); } } ImageVis3D-3.1.0/ImageVis3D/UI/ImageVis3D_Capturing.cpp0000644000175000017500000003652612320517543022121 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : ImageVis3D_Capturing.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : September 2008 // //! Copyright (C) 2008 SCI Institute #include #include #include #include #include #include "ImageVis3D.h" #include "../Tuvok/Basics/SysTools.h" #include "../Tuvok/Controller/Controller.h" #include "PleaseWait.h" #include "MIPRotDialog.h" using namespace std; using namespace tuvok; void MainWindow::CaptureFrame() { if (m_pActiveRenderWin) { if (!CaptureFrame(lineEditCaptureFile->text().toStdString())) { QString msg = tr("Error writing image file %1").arg(lineEditCaptureFile->text()); ShowWarningDialog( tr("Error"), msg); T_ERROR("%s", msg.toAscii().data()); } } } void MainWindow::CaptureSequence() { if (m_pActiveRenderWin) { string strSequenceName; if (!CaptureSequence(lineEditCaptureFile->text().toStdString(), &strSequenceName)){ QString msg = tr("Error writing image file %1").arg(strSequenceName.c_str()); ShowWarningDialog( tr("Error"), msg); T_ERROR("%s", msg.toAscii().data()); } } } bool MainWindow::CaptureFrame(const std::string& strTargetName) { if (m_pActiveRenderWin) { const bool checked = checkBox_PreserveTransparency->isChecked(); return m_pActiveRenderWin->CaptureFrame(strTargetName, checked); } else { WARNING("No render window is open!"); return false; } } bool MainWindow::CaptureSequence(const std::string& strTargetName, std::string* strRealFilename) { if (m_pActiveRenderWin) { const bool checked = checkBox_PreserveTransparency->isChecked(); return m_pActiveRenderWin->CaptureSequenceFrame(strTargetName, checked, strRealFilename); } else { WARNING("No render window is open!"); return false; } } void MainWindow::CaptureRotation() { if (m_pActiveRenderWin) { assert(m_pActiveRenderWin->GetActiveRenderRegions().size() == 1); const LuaClassInstance renderRegion = m_pActiveRenderWin->GetActiveRenderRegions()[0]; QSettings settings; int iNumImages = settings.value("Renderer/ImagesPerRotation", 360).toInt(); bool bOrthoView = settings.value("Renderer/RotationUseOrtho", true).toBool(); bool bStereo = settings.value("Renderer/RotationUseStereo", false).toBool(); bool bUseLOD = settings.value("Renderer/RotationUseLOD", true).toBool(); int iEyeDist = settings.value("Renderer/RotationEyeDist", 3).toInt(); bool ok; if (m_pActiveRenderWin->IsRegion2D(renderRegion) && m_pActiveRenderWin->GetUseMIP(renderRegion)) { MIPRotDialog mipRotDialog(iNumImages, bOrthoView, bStereo, bUseLOD, iEyeDist, this); if (mipRotDialog.exec() == QDialog::Accepted) { ok = true; iNumImages = mipRotDialog.GetNumImages(); bOrthoView = mipRotDialog.GetUseOrtho(); bStereo = mipRotDialog.GetUseStereo(); bUseLOD = mipRotDialog.GetUseLOD(); iEyeDist = mipRotDialog.GetEyeDist(); settings.setValue("Renderer/RotationUseOrtho", bOrthoView); settings.setValue("Renderer/RotationUseStereo", bStereo); settings.setValue("Renderer/RotationUseLOD", bUseLOD); settings.setValue("Renderer/RotationEyeDist", iEyeDist); } else { ok = false; } } else { iNumImages = QInputDialog::getInteger(this, tr("How many images to you want to compute?"), tr("How many images to you want to compute:"), iNumImages, 1, 3600, 1, &ok ); } if (!ok) return; settings.setValue("Renderer/ImagesPerRotation", iNumImages); m_pActiveRenderWin->ToggleHQCaptureMode(); PleaseWaitDialog pleaseWait(this, Qt::Tool, true); QTLabelOut* labelOut = pleaseWait.AttachLabel(&m_MasterController); if (m_pActiveRenderWin->IsRegion3D(renderRegion)) { pleaseWait.SetText("Capturing a full 360 rotation, please wait ..."); int i = 0; float fAngle = 0.0f; // Kill the timer, and flush the existing event queue. This ensures any // timers that have fired get processed, and we've got nothing scheduled // other than the capture. m_pRedrawTimer->stop(); QCoreApplication::processEvents(); while (i < iNumImages && !pleaseWait.Canceled()) { labelOut->SetOutput(true, true, true, false); std::ostringstream progress; progress << "Processing Image " << i+1 << " of " << iNumImages; if (i==0) { progress << " (the first image may be slower due to caching)"; } progress << "\n" << static_cast(100.0f*i/iNumImages) << "% completed."; MESSAGE("%s", progress.str().c_str()); labelOut->SetOutput(false, false, false, false); fAngle = float(i)/float(iNumImages) * 360.0f; m_pActiveRenderWin->SetCaptureRotationAngle(fAngle); m_pActiveRenderWin->SetRendererTarget(AbstrRenderer::RT_CAPTURE); while(m_pActiveRenderWin->RendererCheckForRedraw() && !pleaseWait.Canceled()) { unsigned sframes = m_pActiveRenderWin->GetCurrentSubFrameCount(); unsigned sframe = m_pActiveRenderWin->GetWorkingSubFrame(); unsigned bricks = m_pActiveRenderWin->GetCurrentBrickCount(); unsigned brick = m_pActiveRenderWin->GetWorkingBrick(); unsigned lod = m_pActiveRenderWin->GetMinLODIndex(); SetRenderProgressAnUpdateInfo(sframes, sframe, bricks, brick, lod, m_pActiveRenderWin); QCoreApplication::processEvents(); m_pActiveRenderWin->UpdateWindow(); } if(!pleaseWait.Canceled()) { string strSequenceName; if (!m_pActiveRenderWin->CaptureSequenceFrame( lineEditCaptureFile->text().toStdString(), checkBox_PreserveTransparency->isChecked(), &strSequenceName)) { QString msg = tr("Error writing image file %1"). arg(strSequenceName.c_str()); ShowWarningDialog(tr("Error"), msg); T_ERROR("%s", msg.toAscii().data()); break; } i++; // Make sure what we've just rendered gets blitted to the RW; user // should visually see the progress of the rotation. m_pActiveRenderWin->UpdateWindow(); } } } else { if (m_pActiveRenderWin->GetUseMIP(renderRegion)) { bool bReUse = true; int iReUseOffset = 0; string strImageFilename = lineEditCaptureFile->text().toStdString(); vector vstrLeftEyeImageVector(iNumImages); vector vstrRightEyeImageVector(iNumImages); if (bStereo) { double fDegreePerImage = 360.0/iNumImages; iReUseOffset = int(iEyeDist/fDegreePerImage); bReUse = (iReUseOffset == iEyeDist/fDegreePerImage); if (bReUse) strImageFilename = SysTools::AppendFilename(strImageFilename,"_LR"); else strImageFilename = SysTools::AppendFilename(strImageFilename,"_L"); } pleaseWait.SetText("Capturing a full 360 MIP rotation," "please wait ..."); float fAngle = 0.0f; for (int i = 0;iSetOutput(true, true, true, false); if (bStereo) { std::ostringstream progress; progress << "Phase 1 of 3: " << static_cast(100.0f*i/iNumImages) << "% completed." << "\nProcessing Image " << i+1 << " of " << iNumImages; if(i==0) { progress << " (the first image may be slower due to caching)"; } MESSAGE("%s", progress.str().c_str()); } else { std::ostringstream progress; progress << static_cast(100.0f*i/iNumImages) << "% completed" << "\nProcessing Image " << i+1 << iNumImages; if(i==0) { progress << " (the first image may be slower due to caching)"; } MESSAGE("%s", progress.str().c_str()); } labelOut->SetOutput(false, false, false, false); fAngle = float(i)/float(iNumImages) * 360.0f; string strSequenceName; if (!m_pActiveRenderWin->CaptureMIPFrame( strImageFilename, fAngle, bOrthoView, i==(iNumImages-1), bUseLOD, checkBox_PreserveTransparency->isChecked(), &strSequenceName)) { QString msg = tr("Error writing image file %1."). arg(strSequenceName.c_str()); ShowWarningDialog( tr("Error"), msg); T_ERROR("%s", msg.toAscii().data()); break; } if (bStereo) { vstrLeftEyeImageVector[i] = strSequenceName; if (bReUse) { vstrRightEyeImageVector[(i+iReUseOffset)%iNumImages] = strSequenceName; } else { fAngle -= 3.0f; string strImageFilenameRight = SysTools::AppendFilename(lineEditCaptureFile->text(). toStdString(),"_R"); if (!m_pActiveRenderWin->CaptureMIPFrame( strImageFilenameRight, fAngle, bOrthoView, i==(iNumImages-1), bUseLOD, checkBox_PreserveTransparency->isChecked(), &strSequenceName)) { QString msg = tr("Error writing image file %1."). arg(strImageFilenameRight.c_str()); ShowWarningDialog( tr("Error"), msg); T_ERROR("%s", msg.toAscii().data()); break; } vstrRightEyeImageVector[i] = strSequenceName; } } } if (!pleaseWait.Canceled() && m_pActiveRenderWin->GetUseMIP(renderRegion) && bStereo) { labelOut->SetOutput(true, true, true, false); for (size_t i = 0;itext().toStdString() ); MESSAGE("Phase 2 of 3: %u%% completed\nCreating stereo image " "%s from %s and %s\nProcessing Image %u of %i", static_cast(100.0f*i/iNumImages), SysTools::GetFilename(strTarget).c_str(), SysTools::GetFilename(strSourceL).c_str(), SysTools::GetFilename(strSourceR).c_str(), static_cast(i+1), iNumImages); QImage imageLeft(strSourceL.c_str()); QImage imageRight(strSourceR.c_str()); for (int y = 0;y(qRed(pixelLeft) * 0.3f + qGreen(pixelLeft) * 0.59f + qBlue(pixelLeft) * 0.11f); int iGrayRight = static_cast(qRed(pixelRight) * 0.3f + qGreen(pixelRight) * 0.59f + qBlue(pixelRight) * 0.11f); QRgb pixelStereo = qRgba(iGrayLeft, iGrayRight/2, iGrayRight, 255); imageRight.setPixel(x,y,pixelStereo); } } imageRight.save(strTarget.c_str()); } for (size_t i = 0;i(100.0f*i/iNumImages), static_cast(i+1), iNumImages); remove(vstrRightEyeImageVector[i].c_str()); if (SysTools::FileExists(vstrLeftEyeImageVector[i])) { remove(vstrLeftEyeImageVector[i].c_str()); } } } } else { pleaseWait.SetText("Slicing through the dataset, please wait ..."); /// \todo TODO slice capturing QString msg = tr("Slice capturing is not implemented yet. Aborting."); ShowWarningDialog( tr("Error"), msg); } } m_pActiveRenderWin->ToggleHQCaptureMode(); m_pRedrawTimer->start(IV3D_TIMER_INTERVAL); pleaseWait.close(); pleaseWait.DetachLabel(); m_pActiveRenderWin->ScheduleCompleteRedraw(); // to make sure front and backbuffer are valid } } void MainWindow::SetCaptureFilename() { QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString selectedFilter; QSettings settings; QString strLastDir = settings.value("Folders/CaptureFilename", ".").toString(); QString fileName = QFileDialog::getSaveFileName(this, "Select Image File", strLastDir, "All Files (*.*)", &selectedFilter, options); if (!fileName.isEmpty()) { // add png as the default filetype if the user forgot to enter one if (SysTools::GetExt(fileName.toStdString()) == "") fileName = fileName + ".png"; settings.setValue("Folders/CaptureFilename", QFileInfo(fileName).absoluteDir().path()); settings.setValue("Files/CaptureFilename", fileName); lineEditCaptureFile->setText(fileName); } } void MainWindow::PreserveTransparencyChanged() { QSettings settings; settings.setValue("PreserveTransparency", checkBox_PreserveTransparency->isChecked()); } ImageVis3D-3.1.0/ImageVis3D/UI/Q2DTransferFunction.cpp0000644000175000017500000017557712320517543022025 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : Q2DTransferFunction.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : July 2008 // //! Copyright (C) 2008 SCI Institute #include #include #include "Q2DTransferFunction.h" #include #include "../Tuvok/Controller/Controller.h" #include "../Tuvok/Renderer/GPUMemMan/GPUMemMan.h" #include "../Tuvok/LuaScripting/TuvokSpecific/LuaTuvokTypes.h" #include "../Tuvok/LuaScripting/TuvokSpecific/LuaTransferFun1DProxy.h" #include "../Tuvok/LuaScripting/TuvokSpecific/LuaTransferFun2DProxy.h" #ifdef max #undef max #endif #ifdef min #undef min #endif using namespace std; Q2DTransferFunction::Q2DTransferFunction(MasterController& masterController, QWidget *parent) : QTransferFunction(masterController, parent), m_iPaintmode(Q2DT_PAINT_NONE), m_iActiveSwatchIndex(-1), m_eTransferFunctionMode(TFM_EXPERT), m_iCachedHeight(0), m_iCachedWidth(0), m_pBackdropCache(NULL), m_pHistImage(NULL), // border size, may be changed arbitrarily m_iSwatchBorderSize(3), // mouse motion m_iPointSelIndex(-1), m_iGradSelIndex(-1), m_vMousePressPos(0,0), m_bDragging(false), m_bDraggingAll(false), m_eDragMode(DRM_NONE), m_vZoomWindow(0.0f,0.0f,1.0f,1.0f), m_eSimpleDragMode(SDM_NONE), m_iSimpleDragModeSubindex(0) { SetColor(isEnabled()); setFocusPolicy(Qt::StrongFocus); } Q2DTransferFunction::~Q2DTransferFunction(void) { // delete the cache pixmap and image delete m_pBackdropCache; delete m_pHistImage; } QSize Q2DTransferFunction::minimumSizeHint() const { return QSize(50, 50); } QSize Q2DTransferFunction::sizeHint() const { return QSize(400, 400); } void Q2DTransferFunction::SetData(shared_ptr vHistogram, LuaClassInstance tf2d) { m_trans = tf2d; shared_ptr ss(m_MasterController.LuaScript()); if (m_trans.isValid(ss) == false) { return; } // resize the histogram vector m_vHistogram.Resize(vHistogram->GetSize()); // if the histogram is empty we are done if (m_vHistogram.GetSize().area() == 0) return; // rescale the histogram to the [0..1] range // first find min and max ... unsigned int iMax = vHistogram->GetLinear(0); unsigned int iMin = iMax; for (size_t i = 0;iGetLinear(i); if (iVal > iMax) iMax = iVal; if (iVal < iMin) iMin = iVal; } // ... than rescale float fDiff = float(iMax)-float(iMin); for (size_t i = 0;iGetLinear(i)) - float(iMin)) / fDiff); // Upload the new TF to the GPU. ss->cexec("tuvok.gpu.changed2DTrans", LuaClassInstance(), m_trans); // force the draw routine to recompute the backdrop cache m_bHistogramChanged = true; emit SwatchChange(); } void Q2DTransferFunction::GenerateHistogramImage() { if (m_trans.isValid(m_MasterController.LuaScript()) == false) return; // convert the histogram into an image // define the bitmap ... if (!m_pHistImage || static_cast(m_pHistImage->height()) != m_vHistogram.GetSize().x || static_cast(m_pHistImage->width()) != m_vHistogram.GetSize().y) { delete m_pHistImage; m_pHistImage = new QImage(QSize(int(m_vHistogram.GetSize().x), int(m_vHistogram.GetSize().y)), QImage::Format_RGB32); } for (size_t y = 0;y(1.0f, pow(m_vHistogram.Get(x,y),1.0f/(1+(m_fHistfScale-1)/100.0f))); m_pHistImage->setPixel(int(x), int(m_vHistogram.GetSize().y-(y+1)), qRgb(int(m_colorBack.red() * (1.0f-value) + m_colorHistogram.red() * value), int(m_colorBack.green()* (1.0f-value) + m_colorHistogram.green()* value), int(m_colorBack.blue() * (1.0f-value) + m_colorHistogram.blue() * value))); } m_bBackdropCacheUptodate = false; m_bHistogramChanged = false; } void Q2DTransferFunction::DrawHistogram(QPainter& painter) { if (m_trans.isValid(m_MasterController.LuaScript()) == false) return; if (m_bHistogramChanged) GenerateHistogramImage(); // ... draw it QRectF target(0, 0, painter.viewport().width(), painter.viewport().height()); QRectF source(m_vZoomWindow.x * m_vHistogram.GetSize().x, m_vZoomWindow.y * m_vHistogram.GetSize().y, m_vZoomWindow.z * m_vHistogram.GetSize().x, m_vZoomWindow.w * m_vHistogram.GetSize().y); painter.drawImage( target, *m_pHistImage, source ); } INTVECTOR2 Q2DTransferFunction::Normalized2Offscreen(FLOATVECTOR2 vfCoord) const { return INTVECTOR2(int(-m_vZoomWindow.x/m_vZoomWindow.z * m_iCachedWidth +vfCoord.x/m_vZoomWindow.z*m_iCachedWidth), int(-m_vZoomWindow.y/m_vZoomWindow.w * m_iCachedHeight+vfCoord.y/m_vZoomWindow.w*m_iCachedHeight)); } INTVECTOR2 Q2DTransferFunction::Normalized2Screen(FLOATVECTOR2 vfCoord) const { return INTVECTOR2(int(-m_vZoomWindow.x/m_vZoomWindow.z * width() +vfCoord.x/m_vZoomWindow.z*width()), int(-m_vZoomWindow.y/m_vZoomWindow.w * height()+vfCoord.y/m_vZoomWindow.w*height())); } FLOATVECTOR2 Q2DTransferFunction::Screen2Normalized(INTVECTOR2 vCoord) const { return FLOATVECTOR2(float(vCoord.x)*m_vZoomWindow.z/width()+m_vZoomWindow.x, float(vCoord.y)*m_vZoomWindow.w/height()+m_vZoomWindow.y); } SimpleSwatchInfo Q2DTransferFunction::ClassifySwatch(TFPolygon& polygon) const { // check the most basic properties first (four vertices, linear gradient, and exactly 3 gradient stops) if (polygon.pPoints.size() == 4 && !polygon.bRadial && polygon.pGradientStops.size() == 3) { // check if the top and bottom edge are parallel to the x-axis if (fabs(polygon.pPoints[1].y - polygon.pPoints[2].y) < 0.01 && fabs(polygon.pPoints[0].y - polygon.pPoints[3].y) < 0.01) { // snap points if they are close but really the same polygon.pPoints[1].y = polygon.pPoints[2].y; polygon.pPoints[0].y = polygon.pPoints[3].y; // check if the left and right edge are parallel to the y-axis -> rectangle if (fabs(polygon.pPoints[0].x - polygon.pPoints[1].x) < 0.01 && fabs(polygon.pPoints[2].x - polygon.pPoints[3].x) < 0.01 ) { // snap points if they are close but really the same polygon.pPoints[0].x = polygon.pPoints[1].x; polygon.pPoints[2].x = polygon.pPoints[3].x; return SimpleSwatchInfo(PT_RECTANGLE,FLOATVECTOR2(0,0),"Rectangle");; } else { // check if the left and right edge are intersecting "near" the x-axis double x1 = polygon.pPoints[0].x, y1 = polygon.pPoints[0].y; double x2 = polygon.pPoints[1].x, y2 = polygon.pPoints[1].y; double x3 = polygon.pPoints[2].x, y3 = polygon.pPoints[2].y; double x4 = polygon.pPoints[3].x, y4 = polygon.pPoints[3].y; double u = ((x4-x3)*(y1-y3)-(y4-y3)*(x1-x3))/((y4-y3)*(x2-x1)-(x4-x3)*(y2-y1)); double h = y1 + u *(y2-y1); if (fabs(h-1.0f) < 0.01) { // when an "other primitive" snaps to a triangle, the edges may be in the wrong order if (polygon.pPoints[1].y > polygon.pPoints[0].y) { std::swap(polygon.pPoints[0],polygon.pPoints[1]); std::swap(polygon.pPoints[2],polygon.pPoints[3]); } return SimpleSwatchInfo(PT_PSEUDOTRIS,FLOATVECTOR2(x1 + u *(x2-x1),1.0),"Triangle"); } else { return SimpleSwatchInfo(PT_OTHER,FLOATVECTOR2(0,0),"Polygon (wrong distance to lower bound)"); } } } } string otherDesc = "Polygon ("; if (polygon.pPoints.size() != 4) otherDesc += "not a quadrilateral, "; else { if (fabs(polygon.pPoints[1].y - polygon.pPoints[2].y) > 0.01 || fabs(polygon.pPoints[0].y - polygon.pPoints[3].y) > 0.01) otherDesc += "not x-axis aligned, "; if (fabs(polygon.pPoints[0].x - polygon.pPoints[1].x) > 0.01 || fabs(polygon.pPoints[2].x - polygon.pPoints[3].x) > 0.01) otherDesc += "not y-axis aligned, "; } if (polygon.bRadial) otherDesc += "radial gradient, "; if (polygon.pGradientStops.size() != 3) otherDesc += "custom gradient, "; otherDesc = otherDesc.substr(0,otherDesc.size()-2) + ")"; return SimpleSwatchInfo(PT_OTHER,FLOATVECTOR2(0,0),otherDesc); } void Q2DTransferFunction::DrawPolygonWithCool3DishBorder(QPainter& painter, std::vector& pointList, QPen& borderPen, QPen& borderPenHighlight) { painter.setPen(borderPen); painter.setBrush(Qt::NoBrush); painter.drawPolygon(&pointList[0], int(pointList.size())); painter.setPen(borderPenHighlight); painter.drawPolygon(&pointList[0], int(pointList.size())); } void Q2DTransferFunction::DrawPolyVertex(QPainter& painter, QPoint& p, bool bBorderVertex) { DrawPolyVertex(painter, INTVECTOR2(p.x(), p.y()),bBorderVertex); } void Q2DTransferFunction::DrawPolyVertex(QPainter& painter, const INTVECTOR2& p, bool bBorderVertex) { if (bBorderVertex) painter.drawEllipse(p.x-m_iSwatchBorderSize, p.y-m_iSwatchBorderSize, m_iSwatchBorderSize*2, m_iSwatchBorderSize*2); else painter.drawEllipse(p.x, p.y, m_iSwatchBorderSize*2, m_iSwatchBorderSize*2); } void Q2DTransferFunction::DrawSwatcheDecoration(QPainter& painter) { if (m_trans.isValid(m_MasterController.LuaScript()) == false) return; // if we start in simple mode we need to build the swatch type list in the first draw call if (m_vSimpleSwatchInfo.size() != GetSwatchCount()) UpdateSwatchTypes(); painter.setRenderHint(painter.Antialiasing, true); // painter.translate(+0.5, +0.5); /// \todo check if we need this QPen borderPen(m_colorSwatchBorder, m_iSwatchBorderSize, Qt::SolidLine); QPen borderPenHighlight(m_colorSwatchBorderHighlight, m_iSwatchBorderSize/2, Qt::SolidLine); QPen borderPenHighlightCenter(m_colorSwatchBorderHighlightCenter, 1, Qt::SolidLine); QPen inactiveBorderPen(m_colorSwatchBorderInactive, m_iSwatchBorderSize, Qt::SolidLine); QPen inactiveBorderHighlight(m_colorSwatchBorderInactiveHighlight, m_iSwatchBorderSize/2, Qt::SolidLine); QPen noBorderPen(Qt::NoPen); QPen circlePen(m_colorSwatchBorderCircle, m_iSwatchBorderSize, Qt::SolidLine); QPen circlePenHighlight(m_colorSwatchBorderCircleHighlight, m_iSwatchBorderSize/2, Qt::SolidLine); QPen gradCircePen(m_colorSwatchGradCircle, m_iSwatchBorderSize/2, Qt::SolidLine); QPen circlePenSel(m_colorSwatchBorderCircleSel, m_iSwatchBorderSize, Qt::SolidLine); QPen gradCircePenSel(m_colorSwatchGradCircleSel, m_iSwatchBorderSize/2, Qt::SolidLine); QBrush solidBrush = QBrush(m_colorSwatchBorderCircle, Qt::SolidPattern); // Obtain swatch vector from Lua. shared_ptr> swatches = GetSwatches(); // render swatches for (size_t i = 0;i pointList(currentSwatch.pPoints.size()); for (size_t j = 0;j> swatches = GetSwatches(); // render swatches for (size_t i = 0;i pointList(currentSwatch.pPoints.size()); for (size_t j = 0;jsetColorAt(currentSwatch.pGradientStops[j].first, QColor(int(currentSwatch.pGradientStops[j].second[0]*255), int(currentSwatch.pGradientStops[j].second[1]*255), int(currentSwatch.pGradientStops[j].second[2]*255), int(currentSwatch.pGradientStops[j].second[3]*255))); } painter.setBrush(*pGradientBrush); painter.drawPolygon(&pointList[0], int(currentSwatch.pPoints.size())); delete pGradientBrush; painter.setBrush(Qt::NoBrush); } } void Q2DTransferFunction::SetDragMode(bool bShiftPressed, bool bCtrlPressed) { if (bShiftPressed) if(bCtrlPressed) m_eDragMode = DRM_ROTATE; else m_eDragMode = DRM_MOVE; else if(bCtrlPressed) m_eDragMode = DRM_SCALE; else m_eDragMode = DRM_NONE; } void Q2DTransferFunction::keyReleaseEvent(QKeyEvent *event) { SetDragMode( event->modifiers() & Qt::ShiftModifier, event->modifiers() & Qt::ControlModifier); DragInit(m_vMousePressPos, m_mouseButton); } void Q2DTransferFunction::keyPressEvent(QKeyEvent *event) { SetDragMode( event->modifiers() & Qt::ShiftModifier, event->modifiers() & Qt::ControlModifier); DragInit(m_vMousePressPos, m_mouseButton); } void Q2DTransferFunction::DragInit(INTVECTOR2 vMousePressPos, Qt::MouseButton mouseButton) { m_vMousePressPos = vMousePressPos; m_mouseButton = mouseButton; shared_ptr ss = m_MasterController.LuaScript(); if (m_eTransferFunctionMode == TFM_EXPERT) { shared_ptr> swatches = GetSwatches(); if (m_iActiveSwatchIndex >= 0 && m_iActiveSwatchIndex::max(); for (size_t j = 0;j fDist) { fMinDist = fDist; m_iPointSelIndex = int(j); m_iGradSelIndex = -1; } } // find closest gradient coord for (size_t j = 0;j<2;j++) { float fDist = sqrt( float(vfP.x-currentSwatch.pGradientCoords[j].x)*float(vfP.x-currentSwatch.pGradientCoords[j].x) + float(vfP.y-currentSwatch.pGradientCoords[j].y)*float(vfP.y-currentSwatch.pGradientCoords[j].y) ); if (fMinDist > fDist) { fMinDist = fDist; m_iPointSelIndex = -1; m_iGradSelIndex = int(j); } } } // right mouse removes / adds points if (mouseButton == Qt::RightButton) { FLOATVECTOR2 vfP = Screen2Normalized(m_vMousePressPos); // find closest edge and compute the point on that edge float fMinDist = std::numeric_limits::max(); FLOATVECTOR2 vfInserCoord; int iInsertIndex = -1; for (size_t j = 0;j 3) { INTVECTOR2 vPixelDist = Normalized2Offscreen(vfP)-Normalized2Offscreen(A); if ( sqrt( float(vPixelDist.x*vPixelDist.x+vPixelDist.y*vPixelDist.y)) <= m_iSwatchBorderSize*3) { ss->cexec(m_trans.fqName() + ".swatchErasePoint", static_cast(m_iActiveSwatchIndex), static_cast(j)); iInsertIndex = -1; emit SwatchChange(); break; } } FLOATVECTOR2 C = vfP - A; // Vector from a to Point float d = (B - A).length(); // Length of the line segment FLOATVECTOR2 V = (B - A)/d; // Unit Vector from A to B float t = V^C; // Intersection point Distance from A float fDist; if (t >= 0 && t <= d) fDist = (vfP-(A + V*t)).length(); else fDist = std::numeric_limits::max(); if (fDist < fMinDist) { fMinDist = fDist; vfInserCoord = vfP; iInsertIndex = int(j+1); } } if (iInsertIndex >= 0) { ss->cexec(m_trans.fqName() + ".swatchInsertPoint", static_cast(m_iActiveSwatchIndex), static_cast(iInsertIndex), vfInserCoord); emit SwatchChange(); } } update(); } } else { m_eSimpleDragMode = SDM_NONE; if (mouseButton != Qt::LeftButton) return; int iPrevIndex = m_iActiveSwatchIndex; FLOATVECTOR2 vfP = Screen2Normalized(m_vMousePressPos); m_iActiveSwatchIndex = PickVertex(vfP, m_iSimpleDragModeSubindex); if (m_iActiveSwatchIndex != -1) { m_eSimpleDragMode = SDM_VERTEX; m_bDragging = true; } else { m_iActiveSwatchIndex = PickGradient(vfP); if (m_iActiveSwatchIndex != -1) { m_eSimpleDragMode = SDM_GRAD_CENTER; m_bDragging = true; } else { m_iActiveSwatchIndex = PickEdge(vfP, m_iSimpleDragModeSubindex); if (m_iActiveSwatchIndex != -1) { m_eSimpleDragMode = SDM_EDGE; m_bDragging = true; } else { m_iActiveSwatchIndex = PickSwatch(vfP); if (m_iActiveSwatchIndex != -1) { m_eSimpleDragMode = SDM_POLY; m_bDragging = true; } else { if (iPrevIndex != m_iActiveSwatchIndex) SwatchChange(); return; } } } } emit SwatchChange(); update(); } } bool Q2DTransferFunction::PointInPolygon(const FLOATVECTOR2& point, const TFPolygon& poly) const { size_t i,j=poly.pPoints.size()-1 ; bool oddHits=false; for (i=0; i=point.y) || (poly.pPoints[j].y=point.y)) { if (poly.pPoints[i].x+(point.y-poly.pPoints[i].y)/ (poly.pPoints[j].y-poly.pPoints[i].y)* (poly.pPoints[j].x-poly.pPoints[i].x)> swatches = GetSwatches(); for (vector::const_iterator it = swatches->begin(); it != swatches->end(); ++it) { const TFPolygon& currentSwatch = *it; for (size_t j = 0;j= 0 && t <= d) fDist = (pixelPickPos-(A + V*t)).length(); else fDist = std::numeric_limits::max(); if (fDist <= max(m_iSwatchBorderSize,4.0f)) { // give the user at least four pixel to pick iEdgeIndex = int(j); return static_cast(std::distance(swatches->begin(), it)); } } } return -1; } int Q2DTransferFunction::PickGradient(const FLOATVECTOR2& pickPos) const { shared_ptr> swatches = GetSwatches(); for (vector::const_iterator it = swatches->begin(); it != swatches->end(); ++it) { const TFPolygon& currentSwatch = *it; // only consider 3 stop gradients if (currentSwatch.pGradientStops.size() != 3) continue; FLOATVECTOR2 A = currentSwatch.pGradientCoords[0]*(1-currentSwatch.pGradientStops[1].first)+ currentSwatch.pGradientCoords[1]*currentSwatch.pGradientStops[1].first; INTVECTOR2 vPixelDist = Normalized2Screen(pickPos)-Normalized2Screen(A); if ( sqrt( float(vPixelDist.x*vPixelDist.x+vPixelDist.y*vPixelDist.y)) <= m_iSwatchBorderSize*3) { return static_cast(std::distance(swatches->begin(), it)); } } return -1; } int Q2DTransferFunction::PickVertex(const FLOATVECTOR2& pickPos, int& iVertexIndex) const { shared_ptr> swatches = GetSwatches(); for (vector::const_iterator it = swatches->begin(); it != swatches->end(); ++it) { const TFPolygon& currentSwatch = *it; for (vector::const_iterator itPnt = currentSwatch.pPoints.begin(); itPnt != currentSwatch.pPoints.end(); ++itPnt) { FLOATVECTOR2 A = *itPnt; INTVECTOR2 vPixelDist = Normalized2Screen(pickPos)-Normalized2Screen(A); if ( sqrt( float(vPixelDist.x*vPixelDist.x+vPixelDist.y*vPixelDist.y)) <= m_iSwatchBorderSize*3) { iVertexIndex = static_cast( std::distance(currentSwatch.pPoints.begin(), itPnt)); return static_cast(std::distance(swatches->begin(), it)); } } } return -1; } int Q2DTransferFunction::PickSwatch(const FLOATVECTOR2& pickPos) const { shared_ptr> swatches = GetSwatches(); for (vector::const_iterator it = swatches->begin(); it != swatches->end(); ++it) { const TFPolygon& currentSwatch = *it; if (PointInPolygon(pickPos, currentSwatch)) { return static_cast(std::distance(swatches->begin(), it)); } } return -1; } void Q2DTransferFunction::mousePressEvent(QMouseEvent *event) { if (m_trans.isValid(m_MasterController.LuaScript()) == false) return; // call superclass method QWidget::mousePressEvent(event); // middle mouse button drags entire view if (event->button() == Qt::MidButton) { m_vMousePressPos = INTVECTOR2(event->x(), event->y()); m_eDragMode = DRM_MOVE_ZOOM; return; } SetDragMode( event->modifiers() & Qt::ShiftModifier, event->modifiers() & Qt::ControlModifier); INTVECTOR2 vMousePressPos = INTVECTOR2(event->x(), event->y()); DragInit(vMousePressPos, event->button()); } void Q2DTransferFunction::wheelEvent(QWheelEvent *event) { float fZoom = 1.0f-event->delta()/5000.0f; FLOATVECTOR2 vNewSize(std::min(1.0f,m_vZoomWindow.z*fZoom), std::min(1.0f,m_vZoomWindow.w*fZoom)); m_vZoomWindow.x += (m_vZoomWindow.z-vNewSize.x)/2.0f; m_vZoomWindow.y += (m_vZoomWindow.w-vNewSize.y)/2.0f; m_vZoomWindow.z = vNewSize.x; m_vZoomWindow.w = vNewSize.y; if (m_vZoomWindow.x + m_vZoomWindow.z > 1.0f) m_vZoomWindow.x = 1.0f-m_vZoomWindow.z; if (m_vZoomWindow.y + m_vZoomWindow.w > 1.0f) m_vZoomWindow.y = 1.0f-m_vZoomWindow.w; if (m_vZoomWindow.x < 0) m_vZoomWindow.x = 0; if (m_vZoomWindow.y < 0) m_vZoomWindow.y = 0; m_bBackdropCacheUptodate = false; repaint(); } void Q2DTransferFunction::mouseReleaseEvent(QMouseEvent *event) { if (m_trans.isValid(m_MasterController.LuaScript()) == false) return; // call superclass method QWidget::mouseReleaseEvent(event); m_bDragging = false; m_bDraggingAll = false; m_iPointSelIndex = -1; m_iGradSelIndex = -1; m_eDragMode = DRM_NONE; m_mouseButton = Qt::NoButton; update(); // send message to update the GLtexture if(m_eExecutionMode == ONRELEASE) { ApplyFunction(); } } void Q2DTransferFunction::ApplyFunction() { // send message to update the GLtexture shared_ptr ss = m_MasterController.LuaScript(); ss->cexec("tuvok.gpu.changed2DTrans", LuaClassInstance(), m_trans); } FLOATVECTOR2 Q2DTransferFunction::Rotate(FLOATVECTOR2 point, float angle, FLOATVECTOR2 center, FLOATVECTOR2 rescale) { FLOATVECTOR2 temp, newpoint; temp = (point - center)*rescale; newpoint.x= temp.x*cos(angle)-temp.y*sin(angle); newpoint.y= temp.x*sin(angle)+temp.y*cos(angle); return (newpoint/rescale)+center; } void Q2DTransferFunction::RecomputeLowerPseudoTrisPoints(TFPolygon& currentSwatch, const FLOATVECTOR2& vHandePos) { FLOATVECTOR2 A = currentSwatch.pPoints[1]; FLOATVECTOR2 B = currentSwatch.pPoints[2]; currentSwatch.pPoints[0].x = vHandePos.x+(A.x - vHandePos.x) * (currentSwatch.pPoints[0].y- vHandePos.y)/(A.y - vHandePos.y); currentSwatch.pPoints[3].x = vHandePos.x+(B.x - vHandePos.x) * (currentSwatch.pPoints[3].y- vHandePos.y)/(B.y - vHandePos.y); } void Q2DTransferFunction::mouseMoveEvent(QMouseEvent *event) { shared_ptr ss = m_MasterController.LuaScript(); if (m_trans.isValid(ss) == false) return; // call superclass method QWidget::mouseMoveEvent(event); if (m_eDragMode == DRM_MOVE_ZOOM) { INTVECTOR2 vMouseCurrentPos(event->x(), event->y()); FLOATVECTOR2 vfPressPos = Screen2Normalized(m_vMousePressPos); FLOATVECTOR2 vfCurrentPos = Screen2Normalized(vMouseCurrentPos); FLOATVECTOR2 vfDelta = vfPressPos-vfCurrentPos; FLOATVECTOR2 vfWinShift; if (vfDelta.x < 0) vfWinShift.x = std::max(vfDelta.x, -m_vZoomWindow.x); else vfWinShift.x = std::min(vfDelta.x, 1.0f-(m_vZoomWindow.x+m_vZoomWindow.z)); if (vfDelta.y < 0) vfWinShift.y = std::max(vfDelta.y, -m_vZoomWindow.y); else vfWinShift.y = std::min(vfDelta.y, 1.0f-(m_vZoomWindow.y+m_vZoomWindow.w)); m_vZoomWindow.x += vfWinShift.x; m_vZoomWindow.y += vfWinShift.y; m_bBackdropCacheUptodate = false; m_vMousePressPos = vMouseCurrentPos; update(); return; } if (m_bDragging) { INTVECTOR2 vMouseCurrentPos(event->x(), event->y()); FLOATVECTOR2 vfPressPos = Screen2Normalized(m_vMousePressPos); FLOATVECTOR2 vfCurrentPos = Screen2Normalized(vMouseCurrentPos); FLOATVECTOR2 vfDelta = vfCurrentPos-vfPressPos; if (m_eTransferFunctionMode == TFM_EXPERT) { // current swatch will be used as a staging area for the Lua scripting // system. When we are done modifying the current swatch, we will call // swatchUpdate. This will allow us to record the update for provenance // purposes. shared_ptr> swatches = GetSwatches(); TFPolygon currentSwatch = (*swatches)[m_iActiveSwatchIndex]; if (m_bDraggingAll) { switch (m_eDragMode) { case DRM_MOVE : { for (unsigned int i= 0;i= 0) { currentSwatch.pPoints[m_iPointSelIndex] += vfDelta; } else { currentSwatch.pGradientCoords[m_iGradSelIndex] += vfDelta; } } ss->cexec(m_trans.fqName() + ".swatchUpdate", static_cast(m_iActiveSwatchIndex), currentSwatch); } else { if (m_iActiveSwatchIndex < 0) return; shared_ptr> swatches = GetSwatches(); TFPolygon currentSwatch = (*swatches)[m_iActiveSwatchIndex]; switch (m_eSimpleDragMode) { case SDM_NONE: T_ERROR("No drag mode configured!"); break; case SDM_GRAD_CENTER : { float prevCenterPosX = (currentSwatch.pGradientCoords[0]*(1-currentSwatch.pGradientStops[1].first)+ currentSwatch.pGradientCoords[1]*currentSwatch.pGradientStops[1].first).x; currentSwatch.pGradientStops[1].first = (currentSwatch.pGradientCoords[0].x-(prevCenterPosX+vfDelta.x))/ (currentSwatch.pGradientCoords[0].x-currentSwatch.pGradientCoords[1].x); currentSwatch.pGradientStops[1].first = max(currentSwatch.pGradientStops[0].first, currentSwatch.pGradientStops[1].first); currentSwatch.pGradientStops[1].first = min(currentSwatch.pGradientStops[2].first-0.000001f, currentSwatch.pGradientStops[1].first); } break; case SDM_POLY : { if (m_vSimpleSwatchInfo[m_iActiveSwatchIndex].m_eType == PT_PSEUDOTRIS) vfDelta.y = 0.0; for (unsigned int i= 0;i 0.95f) { currentSwatch.pPoints[0].y = 0.95f; currentSwatch.pPoints[3].y = 0.95f; } // user dragged the top line under the botom line -> swap lines if (currentSwatch.pPoints[1].y > currentSwatch.pPoints[0].y) { std::swap(currentSwatch.pPoints[0],currentSwatch.pPoints[1]); std::swap(currentSwatch.pPoints[2],currentSwatch.pPoints[3]); } RecomputeLowerPseudoTrisPoints(currentSwatch, m_vSimpleSwatchInfo[m_iActiveSwatchIndex].m_vHandlePos); ComputeGradientForPseudoTris(currentSwatch, currentSwatch.pGradientStops[1].second); } } break; case SDM_VERTEX : { if (m_vSimpleSwatchInfo[m_iActiveSwatchIndex].m_eType == PT_OTHER) { currentSwatch.pPoints[m_iSimpleDragModeSubindex] += vfDelta; UpdateSwatchType(m_iActiveSwatchIndex); } else if (m_vSimpleSwatchInfo[m_iActiveSwatchIndex].m_eType == PT_RECTANGLE) { currentSwatch.pPoints[m_iSimpleDragModeSubindex] += vfDelta; switch (m_iSimpleDragModeSubindex) { case 0 : currentSwatch.pPoints[1].x = currentSwatch.pPoints[0].x; currentSwatch.pPoints[3].y = currentSwatch.pPoints[0].y; break; case 1 : currentSwatch.pPoints[0].x = currentSwatch.pPoints[1].x; currentSwatch.pPoints[2].y = currentSwatch.pPoints[1].y; break; case 2 : currentSwatch.pPoints[3].x = currentSwatch.pPoints[2].x; currentSwatch.pPoints[1].y = currentSwatch.pPoints[2].y; break; case 3 : currentSwatch.pPoints[2].x = currentSwatch.pPoints[3].x; currentSwatch.pPoints[0].y = currentSwatch.pPoints[3].y; break; } currentSwatch.pGradientCoords[0] = FLOATVECTOR2(currentSwatch.pPoints[1].x, (currentSwatch.pPoints[0].y+currentSwatch.pPoints[1].y)/2.0f); currentSwatch.pGradientCoords[1] = FLOATVECTOR2(currentSwatch.pPoints[2].x, (currentSwatch.pPoints[2].y+currentSwatch.pPoints[3].y)/2.0f); } else { // must be PT_PSEUDOTRIS if (m_iSimpleDragModeSubindex == 1 || m_iSimpleDragModeSubindex == 2){ currentSwatch.pPoints[m_iSimpleDragModeSubindex] += vfDelta; switch (m_iSimpleDragModeSubindex) { case 1 : currentSwatch.pPoints[2].y = currentSwatch.pPoints[1].y; break; case 2 : currentSwatch.pPoints[1].y = currentSwatch.pPoints[2].y; break; } // user dragged the top line under the botom line -> swap lines if (currentSwatch.pPoints[1].y > currentSwatch.pPoints[0].y) { std::swap(currentSwatch.pPoints[0],currentSwatch.pPoints[1]); std::swap(currentSwatch.pPoints[2],currentSwatch.pPoints[3]); } RecomputeLowerPseudoTrisPoints(currentSwatch, m_vSimpleSwatchInfo[m_iActiveSwatchIndex].m_vHandlePos); ComputeGradientForPseudoTris(currentSwatch, currentSwatch.pGradientStops[1].second); } } } break; } ss->cexec(m_trans.fqName() + ".swatchUpdate", static_cast(m_iActiveSwatchIndex), currentSwatch); } m_vMousePressPos = vMouseCurrentPos; update(); // send message to update the GLtexture if( m_eExecutionMode == CONTINUOUS ) ApplyFunction(); } } void Q2DTransferFunction::SetColor(bool bIsEnabled) { if (bIsEnabled) { m_colorHistogram = QColor(255,255,255); m_colorBack = QColor(Qt::black); m_colorSwatchBorder = QColor(180, 0, 0); m_colorSwatchBorderHighlight = QColor(255, 190, 190); m_colorSwatchBorderHighlightCenter = QColor(255, 255, 255); m_colorSwatchBorderInactive = QColor(50, 50, 50); m_colorSwatchBorderInactiveHighlight = QColor(120, 120, 120); m_colorSwatchBorderCircle = QColor(200, 200, 0); m_colorSwatchBorderCircleHighlight = QColor(255, 255, 0); m_colorSwatchGradCircle = QColor(0, 255, 0); m_colorSwatchGradCircleSel = QColor(255, 255, 255); m_colorSwatchBorderCircleSel = QColor(255, 255, 255); } else { m_colorHistogram = QColor(55,55,55); m_colorBack = QColor(Qt::black); m_colorSwatchBorder = QColor(100, 50, 50); m_colorSwatchBorderHighlight = QColor(150, 70, 70); m_colorSwatchBorderHighlightCenter = QColor(100, 100, 100); m_colorSwatchBorderInactive = QColor(50, 50, 50); m_colorSwatchBorderInactiveHighlight = QColor(70, 70, 70); m_colorSwatchBorderCircle = QColor(100, 100, 50); m_colorSwatchBorderCircleHighlight = QColor(200, 200, 60); m_colorSwatchGradCircle = QColor(50, 100, 50); m_colorSwatchGradCircleSel = m_colorSwatchGradCircle; m_colorSwatchBorderCircleSel = m_colorSwatchBorderCircle; } m_bHistogramChanged = true; } void Q2DTransferFunction::resizeEvent ( QResizeEvent * event ) { QTransferFunction::resizeEvent(event); m_bBackdropCacheUptodate = false; } void Q2DTransferFunction::changeEvent(QEvent * event) { // call superclass method QWidget::changeEvent(event); if (event->type() == QEvent::EnabledChange) { SetColor(isEnabled()); m_bBackdropCacheUptodate = false; update(); } } void Q2DTransferFunction::ClearToBlack(QPainter& painter) { painter.setPen(Qt::NoPen); painter.setBrush(m_colorBack); QRect backRect(0,0,painter.viewport().width(),painter.viewport().height()); painter.drawRect(backRect);} void Q2DTransferFunction::Draw1DTrans(QPainter& painter) { QRectF imageRect(0, 0, painter.viewport().width(), painter.viewport().height()); // This hack exists because IO has a dependency on QT. shared_ptr ss = m_MasterController.LuaScript(); LuaTransferFun2DProxy* prox = m_trans.getRawPointer(ss); TransferFunction2D* hackTF2D = prox->get2DTransferFunction(); if (hackTF2D == NULL) return; QRectF source(m_vZoomWindow.x * hackTF2D->Get1DTransImage().width(), m_vZoomWindow.y * hackTF2D->Get1DTransImage().height(), m_vZoomWindow.z * hackTF2D->Get1DTransImage().width(), m_vZoomWindow.w * hackTF2D->Get1DTransImage().height()); painter.drawImage(imageRect,hackTF2D->Get1DTransImage(), source); } void Q2DTransferFunction::ComputeCachedImageSize(uint32_t &w , uint32_t &h) const { // find an image size that has the same aspect ratio as the histogram // but is no smaller than the widget shared_ptr ss(m_MasterController.LuaScript()); VECTOR2 rendererSize = ss->cexecRet>( m_trans.fqName() + ".getRenderSize"); w = uint32_t(width()); float fRatio = float(rendererSize.x) / float(rendererSize.y); h = static_cast(w / fRatio); if (h > uint32_t(height())) { h = uint32_t(height()); w = static_cast(h * fRatio); } } void Q2DTransferFunction::paintEvent(QPaintEvent *event) { // call superclass method QWidget::paintEvent(event); if (m_trans.isValid(m_MasterController.LuaScript()) == false) { QPainter painter(this); ClearToBlack(painter); return; } uint32_t w,h; ComputeCachedImageSize(w,h); // as drawing the histogram can become quite expensive we'll cache it in an image and only redraw if needed if (m_bHistogramChanged || !m_bBackdropCacheUptodate || h != m_iCachedHeight || w != m_iCachedWidth) { delete m_pBackdropCache; m_pBackdropCache = new QPixmap(w,h); // attach a painter to the pixmap QPainter image_painter(m_pBackdropCache); // draw the backdrop into the image DrawHistogram(image_painter); Draw1DTrans(image_painter); // update change detection states m_bBackdropCacheUptodate = true; m_iCachedHeight = h; m_iCachedWidth = w; } // now draw everything rest into this widget QPainter painter; QPixmap tmp(w, h); painter.begin(&tmp); //painter.eraseRect(0,0,w,h); // the image captured before (or cached from a previous call) painter.drawImage(0,0,m_pBackdropCache->toImage()); // and the swatches DrawSwatches(painter); painter.end(); painter.begin(this); QRectF source(0.0, 0.0, w, h); QRectF target(0.0, 0.0, width(), height()); painter.drawImage(target, tmp.toImage(), source); DrawSwatcheDecoration(painter); painter.end(); } bool Q2DTransferFunction::LoadFromFile(const QString& strFilename) { // hand the load call over to the TransferFunction1D class shared_ptr ss = m_MasterController.LuaScript(); VECTOR2 transSize = ss->cexecRet>(m_trans.fqName() + ".getSize"); if (ss->cexecRet(m_trans.fqName() + ".loadWithSize", strFilename.toStdString(), transSize)) { m_iActiveSwatchIndex = 0; m_bBackdropCacheUptodate = false; update(); ss->cexec("tuvok.gpu.changed2DTrans", LuaClassInstance(), m_trans); emit SwatchChange(); return true; } else return false; } bool Q2DTransferFunction::SaveToFile(const QString& strFilename) { // hand the save call over to the TransferFunction1D class shared_ptr ss = m_MasterController.LuaScript(); return ss->cexecRet(m_trans.fqName() + ".save", strFilename.toStdString()); } void Q2DTransferFunction::Set1DTrans(LuaClassInstance inst) { shared_ptr ss = m_MasterController.LuaScript(); ss->cexec(m_trans.fqName() + ".update1DTrans", inst); ss->cexec("tuvok.gpu.changed2DTrans", LuaClassInstance(), m_trans); m_bBackdropCacheUptodate = false; update(); } void Q2DTransferFunction::Transfer2DSetActiveSwatch(const int iActiveSwatch) { shared_ptr ss(m_MasterController.LuaScript()); if (iActiveSwatch == -1 && m_trans.isValid(ss) && ss->cexecRet(m_trans.fqName() + ".swatchGetCount") > 0) return; m_iActiveSwatchIndex = iActiveSwatch; update(); } void Q2DTransferFunction::Transfer2DAddCircleSwatch() { TFPolygon newSwatch; shared_ptr ss(m_MasterController.LuaScript()); FLOATVECTOR2 vPoint(m_vZoomWindow.x + 0.8f*m_vZoomWindow.z, m_vZoomWindow.y + 0.8f*m_vZoomWindow.w); FLOATVECTOR2 vCenter(m_vZoomWindow.x + 0.5f*m_vZoomWindow.z, m_vZoomWindow.y + 0.5f*m_vZoomWindow.w); unsigned int iNumberOfSegments = 20; for (unsigned int i = 0;icexec(m_trans.fqName() + ".swatchPushBack", newSwatch); m_iActiveSwatchIndex = static_cast( ss->cexecRet(m_trans.fqName() + ".swatchGetCount")-1); ss->cexec("tuvok.gpu.changed2DTrans", LuaClassInstance(), m_trans); emit SwatchChange(); } void Q2DTransferFunction::Transfer2DAddSwatch() { TFPolygon newSwatch; newSwatch.pPoints.push_back(FLOATVECTOR2(m_vZoomWindow.x + 0.3f*m_vZoomWindow.z, m_vZoomWindow.y + 0.3f*m_vZoomWindow.w)); newSwatch.pPoints.push_back(FLOATVECTOR2(m_vZoomWindow.x + 0.3f*m_vZoomWindow.z, m_vZoomWindow.y + 0.7f*m_vZoomWindow.w)); newSwatch.pPoints.push_back(FLOATVECTOR2(m_vZoomWindow.x + 0.7f*m_vZoomWindow.z, m_vZoomWindow.y + 0.7f*m_vZoomWindow.w)); newSwatch.pPoints.push_back(FLOATVECTOR2(m_vZoomWindow.x + 0.7f*m_vZoomWindow.z, m_vZoomWindow.y + 0.3f*m_vZoomWindow.w)); newSwatch.pGradientCoords[0] = FLOATVECTOR2(m_vZoomWindow.x + 0.3f*m_vZoomWindow.z, m_vZoomWindow.y + 0.5f*m_vZoomWindow.w); newSwatch.pGradientCoords[1] = FLOATVECTOR2(m_vZoomWindow.x + 0.7f*m_vZoomWindow.z, m_vZoomWindow.y + 0.5f*m_vZoomWindow.w); GradientStop g1(0.0f,FLOATVECTOR4(0.0f,0.0f,0.0f,0.0f)), g2(0.5f,FLOATVECTOR4(1.0f,1.0f,1.0f,1.0f)), g3(1.0f,FLOATVECTOR4(0.0f,0.0f,0.0f,0.0f)); newSwatch.pGradientStops.push_back(g1); newSwatch.pGradientStops.push_back(g2); newSwatch.pGradientStops.push_back(g3); shared_ptr ss(m_MasterController.LuaScript()); ss->cexec(m_trans.fqName() + ".swatchPushBack", newSwatch); m_iActiveSwatchIndex = static_cast( ss->cexecRet(m_trans.fqName() + ".swatchGetCount")-1); ss->cexec("tuvok.gpu.changed2DTrans", LuaClassInstance(), m_trans); emit SwatchChange(); } void Q2DTransferFunction::Transfer2DAddRectangleSwatch() { TFPolygon newSwatch; newSwatch.pPoints.push_back(FLOATVECTOR2(m_vZoomWindow.x + 0.3f*m_vZoomWindow.z, m_vZoomWindow.y + 0.3f*m_vZoomWindow.w)); newSwatch.pPoints.push_back(FLOATVECTOR2(m_vZoomWindow.x + 0.3f*m_vZoomWindow.z, m_vZoomWindow.y + 0.7f*m_vZoomWindow.w)); newSwatch.pPoints.push_back(FLOATVECTOR2(m_vZoomWindow.x + 0.7f*m_vZoomWindow.z, m_vZoomWindow.y + 0.7f*m_vZoomWindow.w)); newSwatch.pPoints.push_back(FLOATVECTOR2(m_vZoomWindow.x + 0.7f*m_vZoomWindow.z, m_vZoomWindow.y + 0.3f*m_vZoomWindow.w)); newSwatch.pGradientCoords[0] = (newSwatch.pPoints[0]+newSwatch.pPoints[1])/2.0f; newSwatch.pGradientCoords[1] = (newSwatch.pPoints[2]+newSwatch.pPoints[3])/2.0f; GradientStop g1(0.0f, FLOATVECTOR4(0.0f,0.0f,0.0f,0.0f)), g2(0.5f, FLOATVECTOR4(rand()/float(RAND_MAX), rand()/float(RAND_MAX), rand()/float(RAND_MAX), 1.0f)), g3(1.0f, FLOATVECTOR4(0.0f,0.0f,0.0f,0.0f)); newSwatch.pGradientStops.push_back(g1); newSwatch.pGradientStops.push_back(g2); newSwatch.pGradientStops.push_back(g3); shared_ptr ss = m_MasterController.LuaScript(); ss->cexec(m_trans.fqName() + ".swatchPushBack", newSwatch); UpdateSwatchTypes(); m_iActiveSwatchIndex = static_cast( ss->cexecRet(m_trans.fqName() + ".swatchGetCount")-1); ss->cexec("tuvok.gpu.changed2DTrans", LuaClassInstance(), m_trans); emit SwatchChange(); } void Q2DTransferFunction::ComputeGradientForPseudoTris(TFPolygon& swatch, const FLOATVECTOR4& color) { GradientStop g1(0.0f,FLOATVECTOR4(0.0f,0.0f,0.0f,0.0f)), g2(0.5f,color), g3(1.0f,FLOATVECTOR4(0.0f,0.0f,0.0f,0.0f)); swatch.pGradientStops.clear(); swatch.pGradientStops.push_back(g1); swatch.pGradientStops.push_back(g2); swatch.pGradientStops.push_back(g3); FLOATVECTOR2 persCorrection(m_iCachedWidth,m_iCachedHeight); persCorrection /= persCorrection.maxVal(); FLOATVECTOR2 vTop = (swatch.pPoints[1]+swatch.pPoints[2])*persCorrection/2.0f; FLOATVECTOR2 vBottom = (swatch.pPoints[3]+swatch.pPoints[0])*persCorrection/2.0f; FLOATVECTOR2 vDirection = (vBottom-vTop); FLOATVECTOR2 vPerpendicular(vDirection.y,-vDirection.x); vPerpendicular.normalize(); vPerpendicular *= (swatch.pPoints[1]-swatch.pPoints[2]).length()/2.0f; swatch.pGradientCoords[0] = (vTop-vPerpendicular)/persCorrection; swatch.pGradientCoords[1] = (vTop+vPerpendicular)/persCorrection; } void Q2DTransferFunction::Transfer2DAddPseudoTrisSwatch() { TFPolygon newSwatch; FLOATVECTOR2 p1 = FLOATVECTOR2(m_vZoomWindow.x + 0.3f*m_vZoomWindow.z, m_vZoomWindow.y + 0.3f*m_vZoomWindow.w); FLOATVECTOR2 p2 = FLOATVECTOR2(m_vZoomWindow.x + 0.7f*m_vZoomWindow.z, m_vZoomWindow.y + 0.3f*m_vZoomWindow.w); FLOATVECTOR2 handlePoint = FLOATVECTOR2((p2.x+p1.x)/2.0f,1.0f); FLOATVECTOR2 p0 = (p1+handlePoint)/2.0f; FLOATVECTOR2 p3 = (p2+handlePoint)/2.0f; newSwatch.pPoints.push_back(p0); newSwatch.pPoints.push_back(p1); newSwatch.pPoints.push_back(p2); newSwatch.pPoints.push_back(p3); ComputeGradientForPseudoTris(newSwatch, FLOATVECTOR4(rand()/float(RAND_MAX),rand()/float(RAND_MAX),rand()/float(RAND_MAX),1)); shared_ptr ss = m_MasterController.LuaScript(); ss->cexec(m_trans.fqName() + ".swatchPushBack", newSwatch); UpdateSwatchTypes(); m_iActiveSwatchIndex = static_cast( ss->cexecRet(m_trans.fqName() + ".swatchGetCount")-1); ss->cexec("tuvok.gpu.changed2DTrans", LuaClassInstance(), m_trans); emit SwatchChange(); } void Q2DTransferFunction::Transfer2DDeleteSwatch(){ if (m_iActiveSwatchIndex != -1) { shared_ptr ss(m_MasterController.LuaScript()); ss->cexec(m_trans.fqName() + ".swatchErase", static_cast(m_iActiveSwatchIndex)); int lastSwatchIndex = static_cast( ss->cexecRet(m_trans.fqName() + ".swatchGetCount")-1); m_iActiveSwatchIndex = min(m_iActiveSwatchIndex, lastSwatchIndex); ss->cexec("tuvok.gpu.changed2DTrans", LuaClassInstance(), m_trans); emit SwatchChange(); } } void Q2DTransferFunction::Transfer2DUpSwatch(){ if (m_iActiveSwatchIndex > 0) { shared_ptr ss(m_MasterController.LuaScript()); shared_ptr> swatches = GetSwatches(); TFPolygon tmp = (*swatches)[m_iActiveSwatchIndex-1]; ss->cexec(m_trans.fqName() + ".swatchUpdate", static_cast(m_iActiveSwatchIndex-1), (*swatches)[m_iActiveSwatchIndex]); ss->cexec(m_trans.fqName() + ".swatchUpdate", static_cast(m_iActiveSwatchIndex), tmp); m_iActiveSwatchIndex--; ss->cexec("tuvok.gpu.changed2DTrans", LuaClassInstance(), m_trans); emit SwatchChange(); } } void Q2DTransferFunction::Transfer2DDownSwatch(){ shared_ptr ss(m_MasterController.LuaScript()); int lastSwatchIndex = static_cast( ss->cexecRet(m_trans.fqName() + ".swatchGetCount")-1); if (m_iActiveSwatchIndex >= 0 && m_iActiveSwatchIndex < lastSwatchIndex) { shared_ptr> swatches = GetSwatches(); TFPolygon tmp = (*swatches)[m_iActiveSwatchIndex+1]; ss->cexec(m_trans.fqName() + ".swatchUpdate", static_cast(m_iActiveSwatchIndex+1), (*swatches)[m_iActiveSwatchIndex]); ss->cexec(m_trans.fqName() + ".swatchUpdate", static_cast(m_iActiveSwatchIndex), tmp); m_iActiveSwatchIndex++; ss->cexec("tuvok.gpu.changed2DTrans", LuaClassInstance(), m_trans); emit SwatchChange(); } } void Q2DTransferFunction::SetActiveGradientType(bool bRadial) { shared_ptr ss(m_MasterController.LuaScript()); size_t swatchCount = ss->cexecRet(m_trans.fqName() + ".swatchGetCount"); if (static_cast(m_iActiveSwatchIndex) < swatchCount) { if (ss->cexecRet(m_trans.fqName() + ".swatchIsRadial", static_cast(m_iActiveSwatchIndex)) != bRadial) { ss->cexec(m_trans.fqName() + ".swatchSetRadial", bRadial); ss->cexec("tuvok.gpu.changed2DTrans", LuaClassInstance(), m_trans); update(); } } } void Q2DTransferFunction::AddGradient(GradientStop stop) { shared_ptr ss(m_MasterController.LuaScript()); shared_ptr> swatches = GetSwatches(); const TFPolygon& currentSwatch = (*swatches)[m_iActiveSwatchIndex]; for (auto i = currentSwatch.pGradientStops.begin(); i < currentSwatch.pGradientStops.end(); ++i) { if (i->first > stop.first) { // Do not proceed iteration after making this Lua call. If the // pGradientStops vector resized itself, our iterator is invalid. ss->cexec(m_trans.fqName() + ".swatchInsertGradient", static_cast(m_iActiveSwatchIndex), static_cast( std::distance(currentSwatch.pGradientStops.begin(), i)), stop); // We have modified the transfer function, make sure to display the // results... ss->cexec("tuvok.gpu.changed2DTrans", LuaClassInstance(), m_trans); update(); return; } } ss->cexec(m_trans.fqName() + ".swatchPushBackGradient", static_cast(m_iActiveSwatchIndex), stop); ss->cexec("tuvok.gpu.changed2DTrans", LuaClassInstance(), m_trans); update(); } void Q2DTransferFunction::DeleteGradient(unsigned int i) { shared_ptr ss(m_MasterController.LuaScript()); ss->cexec(m_trans.fqName() + ".swatchEraseGradient", static_cast(m_iActiveSwatchIndex), static_cast(i)); ss->cexec("tuvok.gpu.changed2DTrans", LuaClassInstance(), m_trans); update(); } void Q2DTransferFunction::SetGradient(unsigned int i, GradientStop stop) { shared_ptr ss = m_MasterController.LuaScript(); ss->cexec(m_trans.fqName() + ".swatchUpdateGradient", static_cast(m_iActiveSwatchIndex), static_cast(i), stop); ss->cexec("tuvok.gpu.changed2DTrans", LuaClassInstance(), m_trans); update(); } void Q2DTransferFunction::UpdateSwatchType(size_t i) { shared_ptr ss = m_MasterController.LuaScript(); std::string desc = m_vSimpleSwatchInfo[i].m_strDesc; shared_ptr> swatches = GetSwatches(); TFPolygon tmp = (*swatches)[i]; m_vSimpleSwatchInfo[i] = ClassifySwatch(tmp); // Tmp might have been mutated by ClassifySwatch, so we need to inform // TransferFunction2D that it happened. ss->cexec(m_trans.fqName() + ".swatchUpdate", i, tmp); if (desc != m_vSimpleSwatchInfo[i].m_strDesc) emit SwatchTypeChange(int(i)); } void Q2DTransferFunction::UpdateSwatchTypes() { if (m_trans.isValid(m_MasterController.LuaScript()) == false) return; shared_ptr ss = m_MasterController.LuaScript(); size_t swatchCount = ss->cexecRet(m_trans.fqName() + ".swatchGetCount"); m_vSimpleSwatchInfo.clear(); m_vSimpleSwatchInfo.resize(swatchCount); for (size_t i = 0;i m_iActiveSwatchIndex) { return m_vSimpleSwatchInfo[m_iActiveSwatchIndex].m_strDesc; } else { return ""; } } size_t Q2DTransferFunction::GetSwatchCount() { shared_ptr ss = m_MasterController.LuaScript(); if (m_trans.isValid(ss)) { return ss->cexecRet(m_trans.fqName() + ".swatchGetCount"); } else { return 0; } } size_t Q2DTransferFunction::GetSwatchSize(unsigned int i) { shared_ptr ss = m_MasterController.LuaScript(); if (m_trans.isValid(ss)) { return ss->cexecRet(m_trans.fqName() + ".swatchGetNumPoints", static_cast(i)); } else { return 0; } } bool Q2DTransferFunction::GetActiveGradientType() { shared_ptr ss = m_MasterController.LuaScript(); if ( !m_trans.isValid(ss) || static_cast(m_iActiveSwatchIndex) >= GetSwatchCount()) { return false; } return ss->cexecRet(m_trans.fqName() + ".swatchIsRadial", static_cast(m_iActiveSwatchIndex)); } size_t Q2DTransferFunction::GetGradientCount() { shared_ptr ss = m_MasterController.LuaScript(); if ( !m_trans.isValid(ss) || static_cast(m_iActiveSwatchIndex) >= GetSwatchCount()) { return 0; } return ss->cexecRet(m_trans.fqName() + ".swatchGetGradientCount", static_cast(m_iActiveSwatchIndex)); } GradientStop Q2DTransferFunction::GetGradient(unsigned int i) { shared_ptr ss = m_MasterController.LuaScript(); if ( !m_trans.isValid(ss) || static_cast(m_iActiveSwatchIndex) >= GetSwatchCount()) { // need to return something invalid. return GradientStop(0.0f, FLOATVECTOR4(0,0,0,0)); } return ss->cexecRet(m_trans.fqName() + ".swatchGetGradient", static_cast(m_iActiveSwatchIndex), static_cast(i)); } shared_ptr> Q2DTransferFunction::GetSwatches() const { shared_ptr ss = m_MasterController.LuaScript(); shared_ptr> swatches = ss->cexecRet>>(m_trans.fqName() + ".swatchGet"); return swatches; } ImageVis3D-3.1.0/ImageVis3D/UI/RAWDialog.h0000644000175000017500000000452412320517543017421 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : RAWDialog.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : December 2008 // //! Copyright (C) 2008 SCI Institute #ifndef RAWDIALOG_H #define RAWDIALOG_H #include "UI/AutoGen/ui_RAWDialog.h" #include #include #include "../Tuvok/Basics/Vectors.h" class RAWDialog : public QDialog, protected Ui_RAWDialog { Q_OBJECT public: RAWDialog(const std::string& strFilename, uint64_t iFileSize, QWidget* parent = 0, Qt::WindowFlags flags = 0); virtual ~RAWDialog(); UINT64VECTOR3 GetSize() const; FLOATVECTOR3 GetAspectRatio() const; unsigned int GetBitWidth() const; unsigned int GetEncoding() const; unsigned int GetHeaderSize() const; bool IsBigEndian() const; bool IsSigned() const; bool IsFloat() const; uint64_t ComputeExpectedSize() const; protected slots: void CheckValues(); void ToggleEndianessDialog(); void GuessHeaderSize(); private: std::string m_strFilename; uint64_t m_iFileSize; void setupUi(QDialog *RAWDialog); }; #endif // RAWDIALOG_H ImageVis3D-3.1.0/ImageVis3D/UI/Q1DTransferFunction.cpp0000644000175000017500000005331012320517543022000 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : Q1DTransferFunction.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : July 2008 // //! Copyright (C) 2008 SCI Institute #include #include "Q1DTransferFunction.h" #include #include #include "../Tuvok/Controller/Controller.h" #include "../Tuvok/Basics/MathTools.h" #include "../Tuvok/Renderer/GPUMemMan/GPUMemMan.h" #include "../Tuvok/LuaScripting/TuvokSpecific/LuaTransferFun1DProxy.h" using namespace std; Q1DTransferFunction::Q1DTransferFunction(MasterController& masterController, QWidget *parent) : QTransferFunction(masterController, parent), m_iPaintMode(PAINT_RED | PAINT_GREEN | PAINT_BLUE | PAINT_ALPHA), m_iCachedHeight(0), m_iCachedWidth(0), m_pBackdropCache(NULL), m_pPreviewBack(NULL), m_pPreviewColor(NULL), // borders, may be changed arbitrarily m_iLeftBorder(20), m_iBottomBorder(20), m_iTopPreviewHeight(30), m_iTopPreviewDist(10), // automatically computed borders m_iRightBorder(0), m_iTopBorder(0), // scale apearance, may be changed arbitrarily (except for the marker length wich should be less or equal to both m_iLeftBorder and m_iBottomBorder) m_iMarkersX(50), m_iMarkersY(20), m_iBigMarkerSpacingX(10), m_iBigMarkerSpacingY(5), m_iMarkerLength(5), m_iBigMarkerLength(m_iMarkerLength*3), // mouse motion m_iLastIndex(-1), m_fLastValue(0), m_bMouseLeft(false), m_bMouseRight(false) { SetColor(isEnabled()); } Q1DTransferFunction::~Q1DTransferFunction(void) { // delete the backdrop cache pixmap delete m_pBackdropCache; delete m_pPreviewBack; delete m_pPreviewColor; } void Q1DTransferFunction::PreparePreviewData() { delete m_pPreviewColor; m_pPreviewColor = new QImage(int(m_vHistogram.GetSize()),1, QImage::Format_ARGB32); m_bBackdropCacheUptodate = false; } void Q1DTransferFunction::SetData(shared_ptr vHistogram, unsigned int iMaxValue, LuaClassInstance trans) { shared_ptr ss = m_MasterController.LuaScript(); // There has got to be a better way of checking if a shared_ptr is valid... // We can't use nullptr yet because of our octagon ci machine. if (trans.isValid(ss) == false || vHistogram == 0) return; m_trans = trans; m_iMarkersX = std::max(1,iMaxValue); while (m_iMarkersX > 100) m_iMarkersX /= 10; // resize internal histogram, we only consider histogram values to the maximum entry that is non-zero m_vHistogram.Resize(vHistogram->GetFilledSize()); // resize the preview bar and force the draw routine to recompute the backdrop cache PreparePreviewData(); // if the histogram is empty we are done if (m_vHistogram.GetSize() == 0) return; // rescale the histogram to the [0..1] range // first find min and max ... unsigned int iMax = vHistogram->GetLinear(0); unsigned int iMin = iMax; for (size_t i = 0;iGetLinear(i); if (iVal > iMax) iMax = iVal; if (iVal < iMin) iMin = iVal; } // ... than rescale float fDiff = float(iMax)-float(iMin); for (size_t i = 0;iGetLinear(i)) - float(iMin)) / fDiff); } void Q1DTransferFunction::DrawCoordinateSystem(QPainter& painter) { unsigned int iReducedLeftBorder = m_iLeftBorder - 2; // adjust left and bottom border so that the marker count can be met unsigned int iReducedRightBorder = (width()-(iReducedLeftBorder+2)) %m_iMarkersX; m_iTopBorder = (height()-(m_iBottomBorder+2+m_iTopPreviewHeight+m_iTopPreviewDist)) %m_iMarkersY + m_iTopPreviewHeight+m_iTopPreviewDist; // compute the actual marker spaceing unsigned int iMarkerSpacingX = (width()-(iReducedLeftBorder+2))/m_iMarkersX; unsigned int iMarkerSpacingY = (height()-(m_iBottomBorder+2+m_iTopBorder))/m_iMarkersY; // draw background painter.setBrush(m_colorBack); QRect backRect(0,0,width(),height()); painter.drawRect(backRect); // draw grid borders QPen borderPen(m_colorBorder, 1, Qt::SolidLine); painter.setPen(borderPen); QRect borderRect(iReducedLeftBorder, m_iTopBorder, width()-(iReducedLeftBorder+2+iReducedRightBorder), height()-(m_iTopBorder+m_iBottomBorder+2)); painter.drawRect(borderRect); // draw Y axis markers QPen penScale(m_colorScale, 1, Qt::SolidLine); QPen penLargeScale(m_colorLargeScale, 1, Qt::SolidLine); for (unsigned int i = 0;i pointList; pointList.push_back(QPointF(m_iLeftBorder+1, iGridHeight-m_iBottomBorder)); if (iGridWidth < m_vHistogram.GetSize()) { float fHistStep = m_vHistogram.GetSize()/float(iGridWidth); size_t iHistStep = size_t(ceil(fHistStep)); for (size_t i = 0;i(1.0f, pow(singleValue,1.0f/(1+(m_fHistfScale-1)/100.0f))); pointList.push_back(QPointF(m_iLeftBorder+1+i, m_iTopBorder+iGridHeight-value*iGridHeight)); } } else { for (size_t i = 0;i(1.0f, pow(m_vHistogram.Get(i),1.0f/(1+(m_fHistfScale-1)/100.0f))); pointList.push_back(QPointF(m_iLeftBorder+1+float(iGridWidth)*i/(m_vHistogram.GetSize()-1), m_iTopBorder+iGridHeight-value*iGridHeight)); } } pointList.push_back(QPointF(m_iLeftBorder+iGridWidth, m_iTopBorder+iGridHeight)); pointList.push_back(QPointF(m_iLeftBorder+1, m_iTopBorder+iGridHeight)); // ... draw it painter.setPen(Qt::NoPen); painter.setBrush(m_colorHistogram); painter.drawPolygon(&pointList[0], int(pointList.size())); } void Q1DTransferFunction::DrawFunctionPlots(QPainter& painter) { if (m_trans.isValid(m_MasterController.LuaScript()) == false) return; // compute some grid dimensions unsigned int iGridWidth = width()-(m_iLeftBorder+m_iRightBorder)-3; unsigned int iGridHeight = height()-(m_iBottomBorder+m_iTopBorder)-2; // draw the tranfer function as one larger polyline std::vector pointList(m_vHistogram.GetSize()); QPen penCurve(m_colorBorder, 2, Qt::CustomDashLine); QVector dashes; qreal space = 4; dashes << 1 << space; penCurve.setDashPattern(dashes); // Retrieve color data from Lua script class. std::shared_ptr ss = m_MasterController.LuaScript(); shared_ptr> cdata = ss->cexecRet > >( m_trans.fqName() + ".getColorData"); // for every component for (unsigned int j=0; j < 4; j++) { // select the color switch (j) { case 0 : penCurve.setColor(m_colorRedLine); penCurve.setDashOffset(0.0); break; case 1 : penCurve.setColor(m_colorGreenLine); penCurve.setDashOffset(1.0); break; case 2 : penCurve.setColor(m_colorBlueLine); penCurve.setDashOffset(2.0); break; default : penCurve.setColor(m_colorAlphaLine); penCurve.setDashOffset(3.0); break; } // Make sure our tfqn is as wide as our histogram, since we'll be accessing // every element in the histogram. assert(cdata->size() >= m_vHistogram.GetSize()); // define the polyline for (size_t i=0; i < pointList.size(); i++) { pointList[i] = QPointF( m_iLeftBorder + 1 + float(iGridWidth) * i / (pointList.size() - 1), m_iTopBorder + iGridHeight - std::max(0.0f,std::min((*cdata)[i][j],1.0f)) * iGridHeight ); } // draw the polyline painter.setPen(penCurve); painter.drawPolyline(&pointList[0], int(pointList.size())); } // draw preview bar for (unsigned int x = 0;xsetPixel(x,0,qRgba(int(r*255),int(g*255),int(b*255),int(a*255))); } QRect prevRect(m_iLeftBorder+1, m_iTopBorder - (m_iTopPreviewHeight + m_iTopPreviewDist), width() - (m_iLeftBorder + 3 + m_iRightBorder), m_iTopPreviewHeight); painter.drawImage(prevRect,*m_pPreviewBack); painter.drawImage(prevRect,*m_pPreviewColor); } void Q1DTransferFunction::mousePressEvent(QMouseEvent *event) { if (m_trans.isValid(m_MasterController.LuaScript()) == false) return; // call superclass method QWidget::mousePressEvent(event); // clear the "last position" index m_iLastIndex = -1; if (event->button() == Qt::LeftButton) m_bMouseLeft = true; if (event->button() == Qt::RightButton) m_bMouseRight = true; } void Q1DTransferFunction::mouseReleaseEvent(QMouseEvent *event) { if (m_trans.isValid(m_MasterController.LuaScript()) == false) return; // call superclass method QWidget::mouseReleaseEvent(event); // clear the "last position" index m_iLastIndex = -1; if (event->button() == Qt::LeftButton) m_bMouseLeft = false; if (event->button() == Qt::RightButton) m_bMouseRight = false; // send message to update the GLtexture if(m_eExecutionMode == ONRELEASE) { ApplyFunction(); } } void Q1DTransferFunction::mouseMoveEvent(QMouseEvent *event) { if (m_trans.isValid(m_MasterController.LuaScript()) == false) return; // call superclass method QWidget::mouseMoveEvent(event); // exit if nothing is to be painted if (m_iPaintMode == PAINT_NONE) return; // compute some grid dimensions unsigned int iGridWidth = width()-(m_iLeftBorder+m_iRightBorder)-3; unsigned int iGridHeight = height()-(m_iBottomBorder+m_iTopBorder)-2; unsigned int iVectorSize = uint32_t(m_vHistogram.GetSize()); // compute position in color array int iCurrentIndex = int(0.5f+(float(event->x())-float(m_iLeftBorder)-1.0f)*float(iVectorSize-1)/float(iGridWidth)); iCurrentIndex = std::min(iVectorSize-1, std::max(0,iCurrentIndex)); // compute actual color value float fValue = (float(m_iTopBorder)+float(iGridHeight)-float(event->y()))/float(iGridHeight); fValue = std::min(1.0f, std::max(0.0f,fValue)); // Retrieve color data from Lua script class. std::shared_ptr ss = m_MasterController.LuaScript(); shared_ptr > cdata = ss->cexecRet > >( m_trans.fqName() + ".getColorData"); if (m_bMouseLeft) { // find out the range to change if (m_iLastIndex == -1) { m_iLastIndex = iCurrentIndex; m_fLastValue = fValue; } int iIndexMin, iIndexMax; float fValueMin, fValueInc; if (m_iLastIndex < iCurrentIndex) { iIndexMin = m_iLastIndex; iIndexMax = iCurrentIndex; fValueMin = m_fLastValue; fValueInc = -(fValue-m_fLastValue)/(m_iLastIndex-iCurrentIndex); } else { iIndexMin = iCurrentIndex; iIndexMax = m_iLastIndex; fValueMin = fValue; fValueInc = -(fValue-m_fLastValue)/(m_iLastIndex-iCurrentIndex); } m_iLastIndex = iCurrentIndex; m_fLastValue = fValue; // update transfer function if (m_iPaintMode & PAINT_RED) { float _fValueMin = fValueMin; for (int iIndex = iIndexMin;iIndex<=iIndexMax;++iIndex) { (*cdata)[iIndex][0] = _fValueMin; _fValueMin += fValueInc; } } if (m_iPaintMode & PAINT_GREEN) { float _fValueMin = fValueMin; for (int iIndex = iIndexMin;iIndex<=iIndexMax;++iIndex) { (*cdata)[iIndex][1] = _fValueMin; _fValueMin += fValueInc; } } if (m_iPaintMode & PAINT_BLUE) { float _fValueMin = fValueMin; for (int iIndex = iIndexMin;iIndex<=iIndexMax;++iIndex) { (*cdata)[iIndex][2] = _fValueMin; _fValueMin += fValueInc; } } if (m_iPaintMode & PAINT_ALPHA) { float _fValueMin = fValueMin; for (int iIndex = iIndexMin;iIndex<=iIndexMax;++iIndex) { (*cdata)[iIndex][3] = _fValueMin; _fValueMin += fValueInc; } } // redraw this widget update(); // send message to update the GLtexture if( m_eExecutionMode == CONTINUOUS ) ApplyFunction(); } else { if (m_bMouseRight) { bool bShiftPressed = ( event->modifiers() & Qt::ShiftModifier); // set "step" function size_t cdataSize = cdata->size(); if (m_iPaintMode & PAINT_RED) ss->cexec(m_trans.fqName() + ".setStdFunction", float(iCurrentIndex)/float(cdataSize), fValue, 0, bShiftPressed); if (m_iPaintMode & PAINT_GREEN) ss->cexec(m_trans.fqName() + ".setStdFunction", float(iCurrentIndex)/float(cdataSize), fValue, 1, bShiftPressed); if (m_iPaintMode & PAINT_BLUE) ss->cexec(m_trans.fqName() + ".setStdFunction", float(iCurrentIndex)/float(cdataSize), fValue, 2, bShiftPressed); if (m_iPaintMode & PAINT_ALPHA) ss->cexec(m_trans.fqName() + ".setStdFunction", float(iCurrentIndex)/float(cdataSize), fValue, 3, bShiftPressed); // redraw this widget update(); // send message to update the GLtexture if( m_eExecutionMode == CONTINUOUS ) ApplyFunction(); } } } void Q1DTransferFunction::ApplyFunction() { // send message to update the GLtexture shared_ptr ss = m_MasterController.LuaScript(); ss->cexec("tuvok.gpu.changed1DTrans", LuaClassInstance(), m_trans); } void Q1DTransferFunction::SetColor(bool bIsEnabled) { if (bIsEnabled) { m_colorHistogram = QColor(50,50,50); m_colorBack = QColor(Qt::black); m_colorBorder = QColor(100, 100, 255); m_colorScale = QColor(100, 100, 255); m_colorLargeScale = QColor(180, 180, 180); m_colorRedLine = QColor(255, 0, 0); m_colorGreenLine = QColor(0, 255, 0); m_colorBlueLine = QColor(0, 0, 255); m_colorAlphaLine = QColor(Qt::white); } else { m_colorHistogram = QColor(50,50,50); m_colorBack = QColor(Qt::black); m_colorBorder = QColor(100, 100, 100); m_colorScale = QColor(100, 100, 100); m_colorLargeScale = QColor(180, 180, 180); m_colorRedLine = QColor(100, 40, 40); m_colorGreenLine = QColor(40, 100, 40); m_colorBlueLine = QColor(40, 40, 100); m_colorAlphaLine = QColor(100,100,100); } } void Q1DTransferFunction::changeEvent(QEvent * event) { // call superclass method QWidget::changeEvent(event); if (event->type() == QEvent::EnabledChange) { SetColor(isEnabled()); m_bBackdropCacheUptodate = false; update(); } } void Q1DTransferFunction::RedrawPreviewBarBack() { int w = MathTools::MakeMultiple(width()-(m_iLeftBorder+3+m_iRightBorder), 8); int h = MathTools::MakeMultiple(m_iTopPreviewHeight, 8); delete m_pPreviewBack; m_pPreviewBack = new QImage(w,h,QImage::Format_RGB32); unsigned int iCheckerboard[2] = {qRgb(128,128,128), qRgb(0,0,0)}; int iCurrent = 0; for (int y = 0;ysetPixel(x,y,iCheckerboard[iCurrent]); } iCurrent = (y != 0 && y%8 == 0) ? 1-iLastCurrent : iLastCurrent; } } void Q1DTransferFunction::paintEvent(QPaintEvent *event) { // call superclass method QWidget::paintEvent(event); if (m_trans.isValid(m_MasterController.LuaScript()) == false) { QPainter painter(this); DrawCoordinateSystem(painter); return; } // as drawing the histogram can become quite expensive we'll cache it in an image and only redraw if needed if (!m_bBackdropCacheUptodate || (unsigned int)height() != m_iCachedHeight || (unsigned int)width() != m_iCachedWidth) { RedrawPreviewBarBack(); // delete the old pixmap an create a new one if the size has changed if ((unsigned int)height() != m_iCachedHeight || (unsigned int)width() != m_iCachedWidth) { delete m_pBackdropCache; m_pBackdropCache = new QPixmap(width(),height()); } // attach a painter to the pixmap QPainter image_painter(m_pBackdropCache); // draw the backdrop into the image DrawCoordinateSystem(image_painter); DrawHistogram(image_painter); // update change detection states m_bBackdropCacheUptodate = true; m_iCachedHeight = height(); m_iCachedWidth = width(); } // now draw everything rest into this widget QPainter painter(this); // the image captured before (or cached from a previous call) painter.drawImage(0,0,m_pBackdropCache->toImage()); // and the function plots DrawFunctionPlots(painter); } bool Q1DTransferFunction::QLoadFromFile(const QString& strFilename) { return this->LoadFromFile(strFilename.toStdString()); } bool Q1DTransferFunction::LoadFromFile(const std::string& strFilename) { // hand the load call over to the TransferFunction1D class size_t iSize = 0; shared_ptr ss = m_MasterController.LuaScript(); if (m_trans.isValid(m_MasterController.LuaScript())) { iSize = ss->cexecRet(m_trans.fqName() + ".getSize"); } if (ss->cexecRet(m_trans.fqName() + ".loadFromFileWithSize", strFilename, iSize)) { PreparePreviewData(); update(); ApplyFunction(); return true; } else return false; } bool Q1DTransferFunction::AddFromFile(const QString& strFilename) { size_t iSize = 0; shared_ptr ss = m_MasterController.LuaScript(); if (m_trans.isValid(ss)) { iSize = ss->cexecRet(m_trans.fqName() + ".getSize"); } else return false; // Retrieve color data from Lua script class. shared_ptr > cdata = ss->cexecRet > >( m_trans.fqName() + ".getColorData"); TransferFunction1D other(iSize); if( other.Load(strFilename.toStdString(), iSize) ) { for (size_t i = 0;i ss = m_MasterController.LuaScript(); if (m_trans.isValid(ss)) { iSize = ss->cexecRet(m_trans.fqName() + ".getSize"); } else return false; // Retrieve color data from Lua script class. shared_ptr > cdata = ss->cexecRet > >( m_trans.fqName() + ".getColorData"); TransferFunction1D other(iSize); if( other.Load(strFilename.toStdString(), iSize) ) { for (size_t i = 0;i ss = m_MasterController.LuaScript(); return ss->cexecRet(m_trans.fqName() + ".save", strFilename.toStdString()); } ImageVis3D-3.1.0/ImageVis3D/UI/MIPRotDialog.h0000644000175000017500000000433212320517543020077 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : MIPRotDialog.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : December 2008 // //! Copyright (C) 2008 SCI Institute #ifndef MIPROTDIALOG_H #define MIPROTDIALOG_H #include #include "UI/AutoGen/ui_MIPRotDialog.h" class MIPRotDialog : public QDialog, protected Ui_MIPRotDialog { Q_OBJECT public: MIPRotDialog(uint32_t iImages, bool bOrthoView, bool bStereo, bool bUseLOD, uint32_t iEyeDist, QWidget* parent = 0, Qt::WindowFlags flags = 0); virtual ~MIPRotDialog(); uint32_t GetNumImages() const; bool GetUseOrtho() const; bool GetUseStereo() const; bool GetUseLOD() const; uint32_t GetEyeDist() const; protected slots: void UpdateDegreeLabel(); void UpdateStereoCheckbox(); void UpdateEyeDistLabel(); private: void setupUi(QDialog *MIPRotDialog, uint32_t iImages, bool bOrthoView, bool bStereo, bool bUseLOD, uint32_t iEyeDist); }; #endif // MIPROTDIALOG_H ImageVis3D-3.1.0/ImageVis3D/UI/RenderWindow.cpp0000644000175000017500000030451012320517543020610 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : RenderWindow.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : July 2008 // //! Copyright (C) 2008 SCI Institute #include "../Tuvok/StdTuvokDefines.h" #include #include #include #include "GL/glew.h" #if defined(__GNUC__) && defined(DETECTED_OS_LINUX) # pragma GCC visibility push(default) #endif #include #include #if defined(__GNUC__) && defined(DETECTED_OS_LINUX) # pragma GCC visibility pop #endif #include "RenderWindow.h" #include "ImageVis3D.h" #include "../Tuvok/Basics/MathTools.h" #include "../Tuvok/Basics/SysTools.h" #include "../Tuvok/Controller/Controller.h" #include "../Tuvok/Renderer/GL/GLFrameCapture.h" #include "../Tuvok/Renderer/GL/GLFBOTex.h" #include "../Tuvok/Renderer/GL/GLRenderer.h" #include "../Tuvok/Renderer/GL/GLTargetBinder.h" #include "../Tuvok/LuaScripting/LuaScripting.h" #include "../Tuvok/LuaScripting/TuvokSpecific/LuaTuvokTypes.h" using namespace std; using namespace tuvok; std::string RenderWindow::ms_gpuVendorString = ""; uint32_t RenderWindow::ms_iMaxVolumeDims = 0; bool RenderWindow::ms_b3DTexInDriver = false; bool RenderWindow::ms_bImageLoadStoreInDriver = false; bool RenderWindow::ms_bConservativeDepthInDriver = false; static const float s_fFirstPersonSpeed = 0.001f; RenderWindow::RenderWindow(MasterController& masterController, MasterController::EVolumeRendererType eType, const QString& dataset, unsigned int iCounter, QWidget* parent, const UINTVECTOR2& vMinSize, const UINTVECTOR2& vDefaultSize) : m_strDataset(dataset), m_strID(""), m_Renderer(NULL), m_MasterController(masterController), m_bRenderSubsysOK(true), // be optimistic :-) selectedRegionSplitter(REGION_SPLITTER_NONE), m_vWinDim(0,0), m_vMinSize(vMinSize), m_vDefaultSize(vDefaultSize), m_eViewMode(VM_SINGLE), m_vWinFraction(0.5, 0.5), activeRegion(LuaClassInstance::DEFAULT_INSTANCE_ID), m_MainWindow((MainWindow*)parent), m_MemReg(masterController.LuaScript()), m_eRendererType(eType), m_iTimeSliceMSecsActive(500), m_iTimeSliceMSecsInActive(100), m_1DHistScale(0.25f), m_2DHistScale(0.75f), initialLeftClickPos(0,0), initialClickPos(0,0), m_viMousePos(0,0), m_bAbsoluteViewLock(true), m_bInvWheel(false), m_bFirstPersonMode(false), m_fFirstPersonSpeed(s_fFirstPersonSpeed), m_RTModeBeforeCapture(AbstrRenderer::RT_INVALID_MODE), m_SavedClipLocked(true) { m_strID = "[%1] %2"; m_strID = m_strID.arg(iCounter).arg(dataset); } RenderWindow::~RenderWindow() { Cleanup(); // We notify the LuaScripting system because there are instances where this // class is destroyed and deleteClass was not called upon it. m_MasterController.LuaScript()->notifyOfDeletion(m_LuaThisClass); } void RenderWindow::ToggleHQCaptureMode() { /// @todo call explicitly through the command system to enable provenance. /// It is not entirely clear that this should be the only function /// called however. if (GetRendererTarget() == AbstrRenderer::RT_CAPTURE) { EnableHQCaptureMode(false); } else { EnableHQCaptureMode(true); } } void RenderWindow::EnableHQCaptureMode(bool enable) { shared_ptr ss = m_MasterController.LuaScript(); string abstrRenName = GetLuaAbstrRenderer().fqName(); if (GetRendererTarget() == AbstrRenderer::RT_CAPTURE) { // restore rotation from before the capture process if (enable == false) { /// @fixme Shouldn't this be GetFirst3DRegion? SetRotation(GetActiveRenderRegions()[0], m_mCaptureStartRotation); SetRendererTarget(m_RTModeBeforeCapture); } } else { // remember rotation from before the capture process if (enable == true) { m_RTModeBeforeCapture = ss->cexecRet( abstrRenName + ".getRendererTarget"); m_mCaptureStartRotation = GetRotation(GetActiveRenderRegions()[0]); SetRendererTarget(AbstrRenderer::RT_CAPTURE); } } } void RenderWindow::SetRendererTarget(AbstrRenderer::ERendererTarget targ) { shared_ptr ss = m_MasterController.LuaScript(); string abstrRenName = GetLuaAbstrRenderer().fqName(); ss->cexec(abstrRenName + ".setRendererTarget", targ); } FLOATMATRIX4 RenderWindow::GetRotation(LuaClassInstance region) { shared_ptr ss = m_MasterController.LuaScript(); string rn = region.fqName(); FLOATMATRIX4 regionRot = ss->cexecRet(rn + ".getRotation4x4"); return regionRot; } FLOATMATRIX4 RenderWindow::GetTranslation(LuaClassInstance region) { shared_ptr ss = m_MasterController.LuaScript(); string rn = region.fqName(); FLOATMATRIX4 regionTrans = ss->cexecRet(rn + ".getTranslation4x4"); return regionTrans; } void RenderWindow::Translate(const FLOATMATRIX4& translation, LuaClassInstance region) { if(region.isValid(m_MasterController.LuaScript()) == false) { region = GetFirst3DRegion(); } if(region.isValid(m_MasterController.LuaScript())) { /// @todo 4x4 matrix mult -> vector addition. FLOATMATRIX4 regionTrans = GetTranslation(region); SetTranslation(region, translation * regionTrans); } } void RenderWindow::Rotate(const FLOATMATRIX4& rotation, LuaClassInstance region) { if(region.isValid(m_MasterController.LuaScript()) == false) { region = GetFirst3DRegion(); } if(region.isValid(m_MasterController.LuaScript())) { FLOATMATRIX4 regionRot = GetRotation(region); SetRotation(region, rotation * regionRot); } } void RenderWindow::SetCaptureRotationAngle(float fAngle) { FLOATMATRIX4 matRot; matRot.RotationY(3.141592653589793238462643383*double(fAngle)/180.0); matRot = m_mCaptureStartRotation * matRot; /// @fixme Is the lack of provenance on this next call correct? SetRotation(GetActiveRenderRegions()[0], matRot); PaintRenderer(); } RenderWindow::RegionData* RenderWindow::GetRegionData(LuaClassInstance renderRegion) const { RegionDataMap::const_iterator iter = regionDataMap.find( renderRegion.getGlobalInstID()); if (iter == regionDataMap.end()) { // This should never happen if the renderRegion belongs to *this. assert(false); return NULL; } return iter->second; } uint64_t RenderWindow::GetSliceDepth(LuaClassInstance renderRegion) const { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet(renderRegion.fqName() + ".getSliceDepth"); } void RenderWindow::SetSliceDepth(LuaClassInstance renderRegion, uint64_t newDepth) { shared_ptr ss = m_MasterController.LuaScript(); ss->cexec(renderRegion.fqName() + ".setSliceDepth", newDepth); } bool RenderWindow::IsRegion2D(LuaClassInstance region) const { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet(region.fqName() + ".is2D"); } bool RenderWindow::IsRegion3D(LuaClassInstance region) const { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet(region.fqName() + ".is3D"); } bool RenderWindow::DoesRegionContainPoint(LuaClassInstance region, UINTVECTOR2 pos) const { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet(region.fqName() + ".containsPoint", pos); } RenderRegion::EWindowMode RenderWindow::GetRegionWindowMode( tuvok::LuaClassInstance region) const { /// @todo Remove raw pointer and replace with script call. shared_ptr ss(m_MasterController.LuaScript()); RenderRegion* regPtr = region.getRawPointer(ss); return regPtr->windowMode; } bool RenderWindow::Get2DFlipModeX(LuaClassInstance region) const { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet(region.fqName() + ".get2DFlipModeX"); } bool RenderWindow::Get2DFlipModeY(LuaClassInstance region) const { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet(region.fqName() + ".get2DFlipModeY"); } void RenderWindow::Set2DFlipMode(LuaClassInstance region, bool flipX, bool flipY) { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexec(region.fqName() + ".set2DFlipMode", flipX, flipY); } bool RenderWindow::GetUseMIP(LuaClassInstance region) { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet(region.fqName() + ".getUseMIP"); } void RenderWindow::SetUseMIP(LuaClassInstance region, bool useMip) { shared_ptr ss(m_MasterController.LuaScript()); ss->cexec(region.fqName() + ".setUseMIP", useMip); } UINTVECTOR2 RenderWindow::GetRegionMinCoord(LuaClassInstance region) const { /// @todo Remove raw pointer and replace with script call. shared_ptr ss(m_MasterController.LuaScript()); RenderRegion* regPtr = region.getRawPointer(ss); return regPtr->minCoord; } UINTVECTOR2 RenderWindow::GetRegionMaxCoord(LuaClassInstance region) const { /// @todo Remove raw pointer and replace with script call. shared_ptr ss(m_MasterController.LuaScript()); RenderRegion* regPtr = region.getRawPointer(ss); return regPtr->maxCoord; } void RenderWindow::SetRegionMinCoord(LuaClassInstance region, UINTVECTOR2 minCoord) { /// @todo Remove raw pointer and replace with script call. shared_ptr ss(m_MasterController.LuaScript()); RenderRegion* regPtr = region.getRawPointer(ss); regPtr->minCoord = minCoord; } void RenderWindow::SetRegionMaxCoord(LuaClassInstance region, UINTVECTOR2 maxCoord) { /// @todo Remove raw pointer and replace with script call. shared_ptr ss(m_MasterController.LuaScript()); RenderRegion* regPtr = region.getRawPointer(ss); regPtr->maxCoord = maxCoord; } tuvok::AbstrRenderer::ERendererTarget RenderWindow::GetRendererTarget() { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet( m_LuaAbstrRenderer.fqName() + ".getRendererTarget"); } bool RenderWindow::GetClearViewEnabled() { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet( m_LuaAbstrRenderer.fqName() + ".getClearViewEnabled"); } string RenderWindow::GetRendererClearViewDisabledReason() { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet( m_LuaAbstrRenderer.fqName() + ".getClearViewDisabledReason"); } float RenderWindow::GetRendererClearViewIsoValue() { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet( m_LuaAbstrRenderer.fqName() + ".getCVIsoValue"); } float RenderWindow::GetRendererClearViewSize() { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet( m_LuaAbstrRenderer.fqName() + ".getCVSize"); } float RenderWindow::GetRendererClearViewContextScale() { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet( m_LuaAbstrRenderer.fqName() + ".getCVContextScale"); } float RenderWindow::GetRendererClearViewBorderScale() { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet( m_LuaAbstrRenderer.fqName() + ".getCVBorderScale"); } LuaClassInstance RenderWindow::GetRendererDataset() const { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet(m_LuaAbstrRenderer.fqName() + ".getDataset"); } LuaClassInstance RenderWindow::GetRendererTransferFunction1D() const { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet(m_LuaAbstrRenderer.fqName() + ".get1DTrans"); } LuaClassInstance RenderWindow::GetRendererTransferFunction2D() const { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet(m_LuaAbstrRenderer.fqName() + ".get2DTrans"); } void RenderWindow::SetTimeSlice(uint32_t timeSlice) { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexec(m_LuaAbstrRenderer.fqName() + ".setTimeSlice", timeSlice); } void RenderWindow::ScheduleCompleteRedraw() { shared_ptr ss(m_MasterController.LuaScript()); ss->cexec(m_LuaAbstrRenderer.fqName() + ".scheduleCompleteRedraw"); } bool RenderWindow::RendererCheckForRedraw() { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet(m_LuaAbstrRenderer.fqName() + ".checkForRedraw"); } FLOATVECTOR3 RenderWindow::GetBackgroundColor(int i) { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet(m_LuaAbstrRenderer.fqName() + ".getBackgroundColor", i); } void RenderWindow::SetBackgroundColors(FLOATVECTOR3 vTopColor, FLOATVECTOR3 vBotColor) { shared_ptr ss(m_MasterController.LuaScript()); ss->cexec(m_LuaAbstrRenderer.fqName() + ".setBGColors", vTopColor, vBotColor); } void RenderWindow::SetLightColors(const FLOATVECTOR4& ambient, const FLOATVECTOR4& diffuse, const FLOATVECTOR4& specular, const FLOATVECTOR3& lightDir) { shared_ptr ss(m_MasterController.LuaScript()); ss->cexec(m_LuaAbstrRenderer.fqName() + ".setLightColors", ambient, diffuse, specular, lightDir); } FLOATVECTOR4 RenderWindow::GetAmbient() { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet(m_LuaAbstrRenderer.fqName()+".getAmbient"); } FLOATVECTOR4 RenderWindow::GetDiffuse() { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet(m_LuaAbstrRenderer.fqName()+".getDiffuse"); } FLOATVECTOR4 RenderWindow::GetSpecular() { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet(m_LuaAbstrRenderer.fqName()+".getSpecular"); } FLOATVECTOR3 RenderWindow::GetLightDir() { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet(m_LuaAbstrRenderer.fqName()+".getLightDir"); } void RenderWindow::SetInterpolant(Interpolant interp) { shared_ptr ss(m_MasterController.LuaScript()); ss->cexec(m_LuaAbstrRenderer.fqName() + ".setInterpolant", interp); } Interpolant RenderWindow::GetInterpolant() { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet(m_LuaAbstrRenderer.fqName() + ".getInterpolant"); } void RenderWindow::SetLODLimits(const UINTVECTOR2& vLODLimits) { shared_ptr ss(m_MasterController.LuaScript()); ss->cexec(m_LuaAbstrRenderer.fqName() + ".setLODLimits", vLODLimits); } uint64_t RenderWindow::GetCurrentSubFrameCount() { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return static_cast(ss->cexecRet( rn + ".getCurrentSubFrameCount")); } uint32_t RenderWindow::GetWorkingSubFrame() { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return static_cast(ss->cexecRet( rn + ".getWorkingSubFrame")); } uint32_t RenderWindow::GetCurrentBrickCount() { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return static_cast(ss->cexecRet( rn + ".getCurrentBrickCount")); } uint32_t RenderWindow::GetWorkingBrick() { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return static_cast(ss->cexecRet( rn + ".getWorkingBrick")); } uint64_t RenderWindow::GetMinLODIndex() { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return static_cast(ss->cexecRet( rn + ".getMinLODIndex")); } void RenderWindow::SetDatasetIsInvalid(bool datasetIsInvalid) { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setDatasetIsInvalid", datasetIsInvalid); } void RenderWindow::RemoveMeshData(size_t index) { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".removeMeshData", index); } bool RenderWindow::IsRendererValid() { return m_bRenderSubsysOK && m_LuaAbstrRenderer.isValid( m_MasterController.LuaScript()); } bool RenderWindow::SupportsClearView() { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".supportsClearView"); } bool RenderWindow::SupportsMeshes() { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".supportsMeshes"); } void RenderWindow::ScanForNewMeshes() { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".scanForNewMeshes"); } vector > RenderWindow::GetRendererMeshes() { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet > >(rn + ".getMeshes"); } void RenderWindow::ClearRendererMeshes() { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".clearMeshes"); } UINTVECTOR2 RenderWindow::GetRendererSize() const { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".getSize"); } bool RenderWindow::GetRendererStereoEnabled() const { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".getStereoEnabled"); } float RenderWindow::GetRendererStereoEyeDist() const { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".getStereoEyeDist"); } float RenderWindow::GetRendererStereoFocalLength() const { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".getStereoFocalLength"); } bool RenderWindow::GetRendererStereoEyeSwap() const { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".getStereoEyeSwap"); } AbstrRenderer::EStereoMode RenderWindow::GetRendererStereoMode() const { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".getStereoMode"); } float RenderWindow::GetRendererSampleRateModifier() const { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".getSampleRateModifier"); } float RenderWindow::GetRendererFoV() const { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".getFoV"); } float RenderWindow::GetRendererIsoValue() const { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".getIsoValue"); } DOUBLEVECTOR3 RenderWindow::GetRendererRescaleFactors() const { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".getRescaleFactors"); } void RenderWindow::SetRendererRescaleFactors(DOUBLEVECTOR3 scale) { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setRescaleFactors", scale); } bool RenderWindow::GetRendererGlobalBBox() const { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".getGlobalBBox"); } bool RenderWindow::GetRendererLocalBBox() const { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".getLocalBBox"); } bool RenderWindow::GetRendererClipPlaneEnabled() const { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".isClipPlaneEnabled"); } bool RenderWindow::GetRendererClipPlaneLocked() const { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".isClipPlaneLocked"); } bool RenderWindow::GetRendererClipPlaneShown() const { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".isClipPlaneShown"); } size_t RenderWindow::GetRendererTimestep() const { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".getTimestep"); } UINTVECTOR2 RenderWindow::GetRendererLODLimits() const { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".getLODLimits"); } void RenderWindow::RendererSchedule3DWindowRedraws() { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".schedule3DWindowRedraws"); } void RenderWindow::RendererReloadMesh(size_t index, const shared_ptr m) { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".reloadMesh", index, m); } FLOATVECTOR3 RenderWindow::GetRendererVolumeAABBExtents() { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".getVolumeAABBCenter"); } FLOATVECTOR3 RenderWindow::GetRendererVolumeAABBCenter() { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".getVolumeAABBExtents"); } ExtendedPlane RenderWindow::GetRendererClipPlane() { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".getClipPlane"); } bool RenderWindow::RendererCropDataset(const std::string& strTempDir, bool bKeepOldData) { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".cropDataset", strTempDir, bKeepOldData); } void RenderWindow::SetRendererStereoEnabled(bool stereo) { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setStereoEnabled", stereo); } void RenderWindow::SetRendererStereoEyeDist(float fStereoEyeDist) { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setStereoEyeDist", fStereoEyeDist); } void RenderWindow::SetRendererStereoFocalLength(float fStereoFocalLength) { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setStereoFocalLength", fStereoFocalLength); } void RenderWindow::SetRendererStereoEyeSwap(bool eyeSwap) { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setStereoEyeSwap", eyeSwap); } void RenderWindow::SetRendererStereoMode(AbstrRenderer::EStereoMode mode) { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setStereoMode", mode); } void RenderWindow::RendererInitStereoFrame() { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".initStereoFrame"); } void RenderWindow::RendererToggleStereoFrame() { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".toggleStereoFrame"); } void RenderWindow::RendererSyncStateManager() { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".syncStateManager"); } void RenderWindow::RendererFixedFunctionality() { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".fixedFunctionality"); } RenderWindow::RegionSplitter RenderWindow::GetRegionSplitter(INTVECTOR2 pos) const { switch (m_eViewMode) { case VM_SINGLE : return REGION_SPLITTER_NONE; case VM_TWOBYTWO : { const int halfWidth = regionSplitterWidth/2; const INTVECTOR2 splitPoint(m_vWinFraction * FLOATVECTOR2(m_vWinDim)); const bool isVertical = abs(pos.x - splitPoint.x) <= halfWidth; const bool isHorizontal = abs(pos.y - splitPoint.y) <= halfWidth; if (isVertical && isHorizontal) return REGION_SPLITTER_BOTH_2x2; if (isVertical) return REGION_SPLITTER_VERTICAL_2x2; if (isHorizontal) return REGION_SPLITTER_HORIZONTAL_2x2; return REGION_SPLITTER_NONE; } break; default : return REGION_SPLITTER_NONE; } } void RenderWindow::MousePressEvent(QMouseEvent *event) { shared_ptr ss = m_MasterController.LuaScript(); activeRegion = GetRegionUnderCursor(m_viMousePos); if (activeRegion.isValid(m_MasterController.LuaScript())) { // mouse is over the 3D window if (IsRegion3D(activeRegion) ) { SetPlaneAtClick(m_ClipPlane); if (event->button() == Qt::RightButton) { initialClickPos = INTVECTOR2(event->pos().x(), event->pos().y()); } if (event->button() == Qt::LeftButton) { if (m_bFirstPersonMode) QApplication::setOverrideCursor( QCursor(Qt::BlankCursor) ); initialLeftClickPos = INTVECTOR2(event->pos().x(), event->pos().y()); RegionData *regionData = GetRegionData(activeRegion); regionData->clipArcBall.Click(UINTVECTOR2(event->pos().x(), event->pos().y())); if ( !(event->modifiers() & Qt::ControlModifier) ) { regionData->arcBall.Click(UINTVECTOR2(event->pos().x(), event->pos().y())); } } } } else { // Probably clicked on a region separator. selectedRegionSplitter = GetRegionSplitter(m_viMousePos); if (selectedRegionSplitter != REGION_SPLITTER_NONE) { initialClickPos = INTVECTOR2(event->pos().x(), event->pos().y()); } } } void RenderWindow::MouseReleaseEvent(QMouseEvent *event) { if (event->button() == Qt::LeftButton) { if (activeRegion.isValid(m_MasterController.LuaScript())) FinalizeRotation(activeRegion, true); } else if (event->button() == Qt::RightButton) { if (activeRegion.isValid(m_MasterController.LuaScript())) FinalizeTranslation(activeRegion, true); } QApplication::restoreOverrideCursor(); selectedRegionSplitter = REGION_SPLITTER_NONE; LuaClassInstance region = GetRegionUnderCursor(m_viMousePos); UpdateCursor(region, m_viMousePos, false); } // Qt callback; just interprets the event and passes it on to the appropriate // ImageVis3D handler. void RenderWindow::MouseMoveEvent(QMouseEvent *event) { shared_ptr ss = m_MasterController.LuaScript(); m_viMousePos = INTVECTOR2(event->pos().x(), event->pos().y()); LuaClassInstance region = GetRegionUnderCursor(m_viMousePos); bool clip = event->modifiers() & Qt::ControlModifier; bool clearview = event->modifiers() & Qt::ShiftModifier; bool rotate = event->buttons() & Qt::LeftButton; bool translate = event->buttons() & Qt::RightButton; if (selectedRegionSplitter != REGION_SPLITTER_NONE) { region = LuaClassInstance(); } UpdateCursor(region, m_viMousePos, translate); // mouse is over the 3D window if (region.isValid(m_MasterController.LuaScript()) && IsRegion3D(region)) { if (m_bFirstPersonMode) { if (event->buttons() & Qt::LeftButton) { RotateViewerWithMouse(m_viMousePos-initialLeftClickPos); QPoint globalPos = GetQtWidget()->mapToGlobal( GetQtWidget()->geometry().center()) ; QCursor::setPos ( globalPos.x(), globalPos.y() ); initialLeftClickPos = INTVECTOR2(GetQtWidget()->geometry().center().x(), GetQtWidget()->geometry().center().y()); } UpdateWindow(); } else { bool bPerformUpdate = false; if(clip) { bPerformUpdate = MouseMoveClip(m_viMousePos, rotate, translate, region); } else { bPerformUpdate = MouseMove3D(m_viMousePos, clearview, rotate, translate, region); } if (bPerformUpdate) UpdateWindow(); } } else if ( (selectedRegionSplitter != REGION_SPLITTER_NONE) && (event->buttons() & (Qt::LeftButton|Qt::RightButton)) ) { FLOATVECTOR2 frac = FLOATVECTOR2(m_viMousePos) / FLOATVECTOR2(m_vWinDim); FLOATVECTOR2 winFraction = WindowFraction2x2(); if (selectedRegionSplitter == REGION_SPLITTER_HORIZONTAL_2x2 || selectedRegionSplitter == REGION_SPLITTER_BOTH_2x2) { winFraction.y = frac.y; } if (selectedRegionSplitter == REGION_SPLITTER_VERTICAL_2x2 || selectedRegionSplitter == REGION_SPLITTER_BOTH_2x2) { winFraction.x = frac.x; } SetWindowFraction2x2(winFraction); SetupArcBall(); } } // A mouse movement which should only affect the clip plane. bool RenderWindow::MouseMoveClip(INTVECTOR2 pos, bool rotate, bool translate, LuaClassInstance region) { bool bUpdate = false; if (rotate) { UINTVECTOR2 upos(static_cast(pos.x), static_cast(pos.y)); RegionData *regionData = GetRegionData(region); SetClipRotationDelta(region, regionData->clipArcBall.Drag(upos).ComputeRotation(), true, true); regionData->clipArcBall.Click(UINTVECTOR2(pos.x, pos.y)); bUpdate = true; } if (translate) { INTVECTOR2 viPosDelta = m_viMousePos - initialClickPos; initialClickPos = m_viMousePos; SetClipTranslationDelta(region, FLOATVECTOR3(float(viPosDelta.x*2) / m_vWinDim.x, float(viPosDelta.y*2) / m_vWinDim.y, 0), true, true); bUpdate = true; } return bUpdate; } // Move the mouse by the given amount. Flags tell which rendering parameters // should be affected by the mouse movement. bool RenderWindow::MouseMove3D(INTVECTOR2 pos, bool clearview, bool rotate, bool translate, LuaClassInstance region) { bool bPerformUpdate = false; if (GetRenderMode() == AbstrRenderer::RM_ISOSURFACE && GetClearViewEnabled() && clearview) { SetCVFocusPos(region, m_viMousePos); } if (rotate) { UINTVECTOR2 unsigned_pos(pos.x, pos.y); RegionData *regionData = GetRegionData(region); SetRotationDelta(region, regionData->arcBall.Drag(unsigned_pos).ComputeRotation(), true); regionData->arcBall.Click(UINTVECTOR2(pos.x, pos.y)); bPerformUpdate = true; } if (translate) { INTVECTOR2 viPosDelta = m_viMousePos - initialClickPos; initialClickPos = m_viMousePos; SetTranslationDelta(region, FLOATVECTOR3(float(viPosDelta.x*2) / m_vWinDim.x, float(viPosDelta.y*2) / m_vWinDim.y,0), true); bPerformUpdate = true; } return bPerformUpdate; } void RenderWindow::WheelEvent(QWheelEvent *event) { if (m_bFirstPersonMode) { float wheel = event->delta()/100000.0f; m_fFirstPersonSpeed = std::max(0.0f,m_fFirstPersonSpeed+wheel); } else { LuaClassInstance renderRegion = GetRegionUnderCursor(m_viMousePos); if (renderRegion.isValid(m_MasterController.LuaScript()) == false) return; // mouse is over the 3D window if (IsRegion3D(renderRegion)) { float fZoom = ((m_bInvWheel) ? -1 : 1) * event->delta()/1000.0f; MESSAGE("mousewheel click, delta/zoom: %d/%f", event->delta(), fZoom); // User can hold control to modify only the clip plane. Note however that // if the plane is locked to the volume, we'll end up translating the plane // regardless of whether or not control is held. if(event->modifiers() & Qt::ControlModifier) { SetClipTranslationDelta(renderRegion, FLOATVECTOR3(fZoom/10.f, fZoom/10.f, 0.f), true, true); } else { SetTranslationDelta(renderRegion, FLOATVECTOR3(0,0,fZoom), true); } } else if (IsRegion2D(renderRegion)) { int iZoom = event->delta() > 0 ? 1 : event->delta() < 0 ? -1 : 0; int iNewSliceDepth = std::max(0, static_cast(GetSliceDepth(renderRegion))+iZoom); size_t sliceDimension = size_t(GetRegionWindowMode(renderRegion)); shared_ptr ss = m_MasterController.LuaScript(); LuaClassInstance dataset = GetRendererDataset(); UINT64VECTOR3 domainSize = ss->cexecRet( dataset.fqName() + ".getDomainSize", (size_t)0, (size_t)0); iNewSliceDepth = std::min(iNewSliceDepth, domainSize[sliceDimension]-1); SetSliceDepth(renderRegion, uint64_t(iNewSliceDepth)); } UpdateWindow(); } } LuaClassInstance RenderWindow::GetRegionUnderCursor(INTVECTOR2 vPos) const { if (vPos.x < 0 || vPos.y < 0) return LuaClassInstance(); shared_ptr ss = m_MasterController.LuaScript(); vPos.y = m_vWinDim.y - vPos.y; for (size_t i=0; i < GetActiveRenderRegions().size(); ++i) { if (DoesRegionContainPoint(GetActiveRenderRegions()[i], UINTVECTOR2(vPos))) return GetActiveRenderRegions()[i]; } return LuaClassInstance(); } void RenderWindow::UpdateCursor(LuaClassInstance region, INTVECTOR2 pos, bool translate) { if (region.isValid(m_MasterController.LuaScript()) == false) { // We are likely dealing with a splitter if (selectedRegionSplitter == REGION_SPLITTER_NONE) { // else cursor already set. RegionSplitter hoveredRegionSplitter = GetRegionSplitter(pos); switch (hoveredRegionSplitter) { case REGION_SPLITTER_HORIZONTAL_2x2: GetQtWidget()->setCursor(Qt::SplitVCursor); break; case REGION_SPLITTER_VERTICAL_2x2: GetQtWidget()->setCursor(Qt::SplitHCursor); break; case REGION_SPLITTER_BOTH_2x2: GetQtWidget()->setCursor(Qt::SizeAllCursor); break; default: ; //Do nothing. }; } } else { /// @todo Convert to a script call. if (translate && IsRegion3D(region)) GetQtWidget()->setCursor(Qt::ClosedHandCursor); else GetQtWidget()->unsetCursor(); } } void RenderWindow::RotateViewerWithMouse(const INTVECTOR2& viMouseDelta) { const int screen = QApplication::desktop()->screenNumber(m_MainWindow); const QRect availableRect(QApplication::desktop()->availableGeometry(screen)); const FLOATVECTOR2 vfMouseDelta(viMouseDelta.x/float(availableRect.width()), viMouseDelta.y/float(availableRect.height())); RotateViewer(FLOATVECTOR3(-vfMouseDelta.x*450.f, -vfMouseDelta.y*450.f, 0.f)); } void RenderWindow::RotateViewer(const FLOATVECTOR3& vfAngles) { shared_ptr ss = m_MasterController.LuaScript(); string an = GetLuaAbstrRenderer().fqName(); FLOATVECTOR3 viewDir = ss->cexecRet(an + ".getViewDir"); FLOATVECTOR3 upVec = ss->cexecRet(an + ".getUpDir"); FLOATVECTOR3 left = upVec % viewDir; FLOATMATRIX4 matRotationX, matRotationY, matRotationZ; matRotationX.RotationAxis(upVec.normalized(), (vfAngles.x * M_PI) / 180.0); matRotationY.RotationAxis(left.normalized(), (vfAngles.y * M_PI) / 180.0); matRotationZ.RotationAxis(viewDir.normalized(), (vfAngles.z * M_PI) / 180.0); viewDir = matRotationX * viewDir * matRotationY; upVec = matRotationZ * upVec * matRotationY; ss->cexec(an + ".setViewDir", viewDir); ss->cexec(an + ".setUpDir", upVec); UpdateWindow(); } void RenderWindow::MoveViewerWithMouse(const FLOATVECTOR3& vDirection) { MoveViewer(vDirection*m_fFirstPersonSpeed); } void RenderWindow::MoveViewer(const FLOATVECTOR3& vDirection) { shared_ptr ss = m_MasterController.LuaScript(); string an = GetLuaAbstrRenderer().fqName(); const FLOATVECTOR3 up = ss->cexecRet(an + ".getUpDir"); const FLOATVECTOR3 view = ss->cexecRet(an + ".getViewDir"); const FLOATVECTOR3 left = up % view; FLOATVECTOR3 oldPos = ss->cexecRet(an + ".getViewPos"); oldPos = oldPos + vDirection.x * left + vDirection.y * up + vDirection.z * view; ss->cexec(an + ".setViewPos", oldPos); UpdateWindow(); } void RenderWindow::SetFirstPersonMode(bool bFirstPersonMode) { m_bFirstPersonMode = bFirstPersonMode; } bool RenderWindow::GetFirstPersonMode() { return m_bFirstPersonMode; } void RenderWindow::KeyPressEvent ( QKeyEvent * event ) { shared_ptr ss = m_MasterController.LuaScript(); string rn = m_LuaAbstrRenderer.fqName(); LuaClassInstance selectedRegion = GetRegionUnderCursor(m_viMousePos); /// @todo Add keyboard shortcuts dialog. switch (event->key()) { case Qt::Key_D : ss->cexec(rn + ".cycleDebugViews"); break; case Qt::Key_F : m_bFirstPersonMode = !m_bFirstPersonMode; break; case Qt::Key_C : ss->cexec(rn + ".setCoordinateArrowsEnabled", !ss->cexecRet(rn + ".getCoordinateArrowsEnabled")); break; case Qt::Key_T : ss->cexec(rn + ".transfer3DRotationToMIP"); break; case Qt::Key_P : if (selectedRegion.isValid(ss)) { ss->cexec(rn + ".set2DPlanesIn3DView", !ss->cexecRet(rn + ".get2DPlanesIn3DView"), selectedRegion); } break; case Qt::Key_R : ResetRenderingParameters(); break; case Qt::Key_Space : { if (selectedRegion.isValid(ss) == false) break; EViewMode newViewMode = EViewMode((int(GetViewMode()) + 1) % int(VM_INVALID)); vector newRenderRegions; if (newViewMode == VM_SINGLE) { newRenderRegions.push_back(selectedRegion); } else { if (ss->cexecRet(rn + ".getStereoEnabled")) { ss->cexec(rn + ".setStereoEnabled", false); EmitStereoDisabled(); } if (newViewMode == VM_TWOBYTWO) { for (size_t i=0; i < 4; ++i) newRenderRegions.push_back(luaRenderRegions[i][selected2x2Regions[i]]); } } SetViewMode(newRenderRegions, newViewMode); } break; case Qt::Key_X : if ( selectedRegion.isValid(ss) && IsRegion2D(selectedRegion)) { bool flipX = Get2DFlipModeX(selectedRegion); flipX = !flipX; Set2DFlipMode(selectedRegion, flipX, Get2DFlipModeY(selectedRegion)); } break; case Qt::Key_Y : if( selectedRegion.isValid(ss) && IsRegion2D(selectedRegion)) { bool flipY = Get2DFlipModeY(selectedRegion); flipY = !flipY; Set2DFlipMode(selectedRegion, Get2DFlipModeX(selectedRegion), flipY); } break; case Qt::Key_M : if( selectedRegion.isValid(ss) && IsRegion2D(selectedRegion)) { bool useMIP = !GetUseMIP(selectedRegion); SetUseMIP(selectedRegion, useMIP); } break; case Qt::Key_A : { if (selectedRegion.isValid(ss)) { RegionData *regionData = GetRegionData(selectedRegion); regionData->arcBall.SetUseTranslation( !regionData->arcBall.GetUseTranslation()); } } break; case Qt::Key_Left : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { MoveViewerWithMouse(FLOATVECTOR3(1,0,0)); } break; case Qt::Key_Up : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { MoveViewerWithMouse(FLOATVECTOR3(0,0,1)); } break; case Qt::Key_Right : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { MoveViewerWithMouse(FLOATVECTOR3(-1,0,0)); } break; case Qt::Key_Down : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { MoveViewerWithMouse(FLOATVECTOR3(0,0,-1)); } break; case Qt::Key_Home : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { MoveViewerWithMouse(FLOATVECTOR3(0,1,0)); } break; case Qt::Key_End : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { MoveViewerWithMouse(FLOATVECTOR3(0,-1,0)); } break; case Qt::Key_7 : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { RotateViewer(FLOATVECTOR3(0,0,-1)); // roll left } break; case Qt::Key_9 : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { RotateViewer(FLOATVECTOR3(0,0,1)); // roll right } break; case Qt::Key_4 : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { RotateViewer(FLOATVECTOR3(1,0,0)); // pitch left } break; case Qt::Key_6 : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { RotateViewer(FLOATVECTOR3(-1,0,0)); // pitch right } break; case Qt::Key_8 : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { RotateViewer(FLOATVECTOR3(0,1,0)); // yaw up } break; case Qt::Key_5 : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { RotateViewer(FLOATVECTOR3(0,-1,0)); // yaw down } break; case Qt::Key_0 : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { try { ss->exec("key0Pressed()"); } catch (const tuvok::LuaError&) {} } break; case Qt::Key_1 : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { try { ss->exec("key1Pressed()"); } catch (const tuvok::LuaError&) {} } break; case Qt::Key_2 : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { try { ss->exec("key2Pressed()"); } catch (const tuvok::LuaError&) {} } break; case Qt::Key_3 : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { try { ss->exec("key3Pressed()"); } catch (const tuvok::LuaError&) {} } break; case Qt::Key_Slash : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { try { ss->exec("keySlashPressed()"); } catch (const tuvok::LuaError&) {} } break; case Qt::Key_Asterisk : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { try { ss->exec("keyAsteriskPressed()"); } catch (const tuvok::LuaError&) {} } break; case Qt::Key_Minus : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { try { ss->exec("keyMinusPressed()"); } catch (const tuvok::LuaError&) {} } break; case Qt::Key_Plus : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { try { ss->exec("keyPlusPressed()"); } catch (const tuvok::LuaError&) {} } break; case Qt::Key_Comma : case Qt::Key_Period : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { try { ss->exec("keyCommaOrPeriodPressed()"); } catch (const tuvok::LuaError&) {} } break; case Qt::Key_Enter : if (m_bFirstPersonMode && selectedRegion.isValid(ss) && IsRegion3D(selectedRegion)) { try { ss->exec("keyEnterPressed()"); } catch (const tuvok::LuaError&) {} } break; case Qt::Key_PageDown : case Qt::Key_PageUp : if ( selectedRegion.isValid(ss) && IsRegion2D(selectedRegion)) { const size_t sliceDimension = static_cast( GetRegionWindowMode(selectedRegion)); const int currSlice = static_cast(GetSliceDepth(selectedRegion)); LuaClassInstance dataset = GetRendererDataset(); UINT64VECTOR3 domainSize = ss->cexecRet( dataset.fqName() + ".getDomainSize", (size_t)0, (size_t)0); const int numSlices = domainSize[sliceDimension]-1; int sliceChange = numSlices / 10; if (event->key() == Qt::Key_PageDown) sliceChange = -sliceChange; int newSliceDepth = MathTools::Clamp(currSlice + sliceChange, 0, numSlices); SetSliceDepth(selectedRegion, uint64_t(newSliceDepth)); } else if ( selectedRegion.isValid(m_MasterController.LuaScript()) && IsRegion3D(selectedRegion)) { const float zoom = (event->key() == Qt::Key_PageDown) ? 0.01f : -0.01f; SetTranslationDelta(selectedRegion, FLOATVECTOR3(0, 0, zoom), true); } break; } } void RenderWindow::CloseEvent(QCloseEvent* close) { this->GetQtWidget()->setEnabled(false); this->GetQtWidget()->lower(); EmitWindowClosing(); close->accept(); } void RenderWindow::FocusInEvent ( QFocusEvent * event ) { if (m_LuaAbstrRenderer.isValid(m_MasterController.LuaScript())) SetTimeSlice(m_iTimeSliceMSecsActive); if (event->gotFocus()) EmitWindowActive(); } void RenderWindow::FocusOutEvent ( QFocusEvent * event ) { if (m_LuaAbstrRenderer.isValid(m_MasterController.LuaScript())) SetTimeSlice(m_iTimeSliceMSecsInActive); if (!event->gotFocus()) EmitWindowInActive(); } void RenderWindow::SetupArcBall() { for (size_t i=0; i < GetActiveRenderRegions().size(); ++i) { LuaClassInstance region = GetActiveRenderRegions()[i]; RegionData* regionData = GetRegionData(region); const UINTVECTOR2 regMin = GetRegionMinCoord(region); const UINTVECTOR2 regMax = GetRegionMaxCoord(region); const UINTVECTOR2 offset(regMin.x, m_vWinDim.y - regMax.y); const UINTVECTOR2 size = regMax - regMin; regionData->arcBall.SetWindowOffset(offset.x, offset.y); regionData->clipArcBall.SetWindowOffset(offset.x, offset.y); regionData->arcBall.SetWindowSize(size.x, size.y); regionData->clipArcBall.SetWindowSize(size.x, size.y); } } void RenderWindow::SetWindowFraction2x2(FLOATVECTOR2 f) { f.x = MathTools::Clamp(f.x, 0.0, 1.0); f.y = MathTools::Clamp(f.y, 0.0, 1.0); m_vWinFraction = f; ScheduleCompleteRedraw(); UpdateWindowFraction(); } void RenderWindow::UpdateWindowFraction() { if (GetActiveRenderRegions().size() != 4) { return; // something is wrong, should be 4... } const int halfWidth = regionSplitterWidth/2; int verticalSplit = static_cast(m_vWinDim.x*m_vWinFraction.x); int horizontalSplit = static_cast(m_vWinDim.y*(1-m_vWinFraction.y)); // Make sure none of the regions are out of bounds. This can happen // since we add/subtract the divider width. if (verticalSplit - halfWidth < 0) verticalSplit = halfWidth; if (verticalSplit + halfWidth > static_cast(m_vWinDim.x)) verticalSplit = m_vWinDim.x - halfWidth; if (horizontalSplit - halfWidth < 0) horizontalSplit = halfWidth; if (horizontalSplit + halfWidth > static_cast(m_vWinDim.y)) horizontalSplit = m_vWinDim.y - halfWidth; const std::vector activeRenderRegions = GetActiveRenderRegions(); SetRegionMinCoord(activeRenderRegions[0], UINTVECTOR2(0, horizontalSplit+halfWidth)); SetRegionMaxCoord(activeRenderRegions[0], UINTVECTOR2(verticalSplit-halfWidth, m_vWinDim.y)); SetRegionMinCoord(activeRenderRegions[1], UINTVECTOR2(verticalSplit+halfWidth, horizontalSplit+halfWidth)); SetRegionMaxCoord(activeRenderRegions[1], UINTVECTOR2(m_vWinDim.x, m_vWinDim.y)); SetRegionMinCoord(activeRenderRegions[2], UINTVECTOR2(0,0)); SetRegionMaxCoord(activeRenderRegions[2], UINTVECTOR2(verticalSplit-halfWidth, horizontalSplit-halfWidth)); SetRegionMinCoord(activeRenderRegions[3], UINTVECTOR2(verticalSplit+halfWidth, 0)); SetRegionMaxCoord(activeRenderRegions[3], UINTVECTOR2(m_vWinDim.x, horizontalSplit-halfWidth)); } LuaClassInstance RenderWindow::GetFirst3DRegion() { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet(GetLuaAbstrRenderer().fqName() + ".getFirst3DRenderRegion"); } const std::vector RenderWindow::GetActiveRenderRegions() const { return m_MasterController.LuaScript()-> cexecRet >(m_LuaAbstrRenderer.fqName() + ".getRenderRegions"); } void RenderWindow::SetActiveRenderRegions(std::vector regions) const { shared_ptr ss(m_MasterController.LuaScript()); ss->cexec(GetLuaAbstrRenderer().fqName() + ".setRenderRegions", regions); } void RenderWindow::ToggleRenderWindowView2x2() { std::vector newRenderRegions; if (GetActiveRenderRegions().size() == 4) newRenderRegions = GetActiveRenderRegions(); else { //Just use the default 4 regions. for (size_t i=0; i < 4; ++i) newRenderRegions.push_back(luaRenderRegions[i][selected2x2Regions[i]]); } SetViewMode(newRenderRegions, VM_TWOBYTWO); } bool RenderWindow::SetRenderWindowView3D() { std::vector newRenderRegions; for (int i=0; i < MAX_RENDER_REGIONS; ++i) { for (int j=0; j < NUM_WINDOW_MODES; ++j) { if (IsRegion3D(luaRenderRegions[i][j])) { newRenderRegions.push_back(luaRenderRegions[i][j]); SetViewMode(newRenderRegions, RenderWindow::VM_SINGLE); return true; } } } return false; } void RenderWindow::ToggleRenderWindowViewSingle() { std::vector newRenderRegions; if (!GetActiveRenderRegions().empty()) newRenderRegions.push_back(GetActiveRenderRegions()[0]); else newRenderRegions.push_back(luaRenderRegions[0][selected2x2Regions[0]]); SetViewMode(newRenderRegions, VM_SINGLE); } void RenderWindow::SetViewMode(const std::vector &newRenderRegions, EViewMode eViewMode) { m_eViewMode = eViewMode; if (eViewMode == VM_SINGLE) { if (newRenderRegions.size() != 1) { T_ERROR("VM_SINGLE view mode expected only a single RenderRegion, not %d.", newRenderRegions.size()); } SetActiveRenderRegions(newRenderRegions); shared_ptr ss(m_MasterController.LuaScript()); LuaClassInstance firstRenRegion = GetActiveRenderRegions()[0]; RenderRegion* regPtr = firstRenRegion.getRawPointer(ss); /// @fixme Is the following code correct? At the top of RenderRegion.h it /// says: // NOTE: client code should never directly modify a RenderRegion. Instead, // modifications should be done through the tuvok API so that tuvok is aware // of these changes. regPtr->minCoord = UINTVECTOR2(0,0); regPtr->maxCoord = m_vWinDim; } else if (eViewMode == VM_TWOBYTWO) { if (newRenderRegions.size() != 4) { T_ERROR("VM_TWOBYTWO view mode expected 4 RenderRegions, not %d.", newRenderRegions.size()); } SetActiveRenderRegions(newRenderRegions); UpdateWindowFraction(); } SetupArcBall(); ScheduleCompleteRedraw(); UpdateWindow(); EmitRenderWindowViewChanged(int(GetViewMode())); } void RenderWindow::Initialize() { // Note that we create the RenderRegions here and not directly in the constructor // because we first need the dataset to be loaded so that we can setup the // initial slice index. // NOTE: Since this function is called from our derived class' constructor // we can generate lua instances and have them associated with the call // to the constructor (ensures we do not have to hit undo multiple times // in order to undo the creation of the render window). shared_ptr ss = m_MasterController.LuaScript(); for (int i=0; i < MAX_RENDER_REGIONS; ++i) { luaRenderRegions[i][0] = ss->cexecRet( "tuvok.renderRegion3D.new", GetLuaAbstrRenderer()); int mode = static_cast(RenderRegion::WM_SAGITTAL); LuaClassInstance dataset = GetRendererDataset(); UINT64VECTOR3 domainSize = ss->cexecRet( dataset.fqName() + ".getDomainSize", (size_t)0, (size_t)0); uint64_t sliceIndex = domainSize[mode]/2; luaRenderRegions[i][1] = ss->cexecRet( "tuvok.renderRegion2D.new", mode, sliceIndex, GetLuaAbstrRenderer()); mode = static_cast(RenderRegion::WM_AXIAL); sliceIndex = domainSize[mode]/2; luaRenderRegions[i][2] = ss->cexecRet( "tuvok.renderRegion2D.new", mode, sliceIndex, GetLuaAbstrRenderer()); mode = static_cast(RenderRegion::WM_CORONAL); sliceIndex = domainSize[mode]/2; luaRenderRegions[i][3] = ss->cexecRet( "tuvok.renderRegion2D.new", mode, sliceIndex, GetLuaAbstrRenderer()); } for (int i=0; i < 4; ++i) selected2x2Regions[i] = i; std::vector initialRenderRegions; initialRenderRegions.push_back(luaRenderRegions[0][0]); ss->cexec(GetLuaAbstrRenderer().fqName() + ".setRenderRegions", initialRenderRegions); // initialize region data map now that we have all the render regions for (int i=0; i < MAX_RENDER_REGIONS; ++i) for (int j=0; j < NUM_WINDOW_MODES; ++j) regionDataMap.insert(std::make_pair( luaRenderRegions[i][j].getGlobalInstID(), ®ionDatas[i][j])); SetupArcBall(); } void RenderWindow::Cleanup() { shared_ptr ss(m_MasterController.LuaScript()); if (m_LuaAbstrRenderer.isValid(ss) == false) return; ss->cexec(m_LuaAbstrRenderer.fqName() + ".cleanup"); m_MasterController.ReleaseVolumeRenderer(m_LuaAbstrRenderer); m_LuaAbstrRenderer.invalidate(); for (int i=0; i < MAX_RENDER_REGIONS; ++i) for (int j=0; j < NUM_WINDOW_MODES; ++j) ss->cexec("deleteClass", luaRenderRegions[i][j]); } void RenderWindow::CheckForRedraw() { shared_ptr ss(m_MasterController.LuaScript()); if (m_LuaAbstrRenderer.isValid(ss) && RendererCheckForRedraw()) { UpdateWindow(); } } AbstrRenderer::ERenderMode RenderWindow::GetRenderMode() const { shared_ptr ss(m_MasterController.LuaScript()); return ss->cexecRet(m_LuaAbstrRenderer.fqName() + ".getRenderMode"); } void RenderWindow::SetBlendPrecision( AbstrRenderer::EBlendPrecision eBlendPrecisionMode) { m_MasterController.LuaScript()->cexec( GetLuaAbstrRenderer().fqName() + ".setBlendPrecision", eBlendPrecisionMode); } void RenderWindow::SetPerfMeasures(unsigned int iMinFramerate, bool bRenderLowResIntermediateResults, float fScreenResDecFactor, float fSampleDecFactor, unsigned int iLODDelay, unsigned int iActiveTS, unsigned int iInactiveTS) { m_iTimeSliceMSecsActive = iActiveTS; m_iTimeSliceMSecsInActive = iInactiveTS; m_MasterController.LuaScript()->cexec(m_LuaAbstrRenderer.fqName() + ".setPerfMeasures", iMinFramerate, bRenderLowResIntermediateResults, fScreenResDecFactor, fSampleDecFactor, iLODDelay); } bool RenderWindow::CaptureFrame(const std::string& strFilename, bool bPreserveTransparency) { shared_ptr ss(m_MasterController.LuaScript()); ss->setTempProvDisable(true); GLFrameCapture f; AbstrRenderer::ERendererTarget mode = GetRendererTarget(); FLOATVECTOR3 color[2] = {GetBackgroundColor(0), GetBackgroundColor(1)}; FLOATVECTOR3 black[2] = {FLOATVECTOR3(0,0,0), FLOATVECTOR3(0,0,0)}; if (bPreserveTransparency) SetBackgroundColors(black[0],black[1]); SetRendererTarget(AbstrRenderer::RT_CAPTURE); while(RendererCheckForRedraw()) { QCoreApplication::processEvents(); PaintRenderer(); } // as the window is double buffered call repaint twice ForceRepaint(); ForceRepaint(); bool rv = f.CaptureSingleFrame(strFilename, bPreserveTransparency); SetRendererTarget(mode); if (bPreserveTransparency) SetBackgroundColors(color[0],color[1]); ss->setTempProvDisable(false); return rv; } bool RenderWindow::CaptureSubframe(const std::string& strFilename) { shared_ptr ss(m_MasterController.LuaScript()); ss->setTempProvDisable(true); bool bPreserveTransparency = false; GLFrameCapture f; bool rv = f.CaptureSingleFrame(strFilename, bPreserveTransparency); ss->setTempProvDisable(false); return rv; } bool RenderWindow::CaptureMIPFrame(const std::string& strFilename, float fAngle, bool bOrtho, bool bFinalFrame, bool bUseLOD, bool bPreserveTransparency, std::string* strRealFilename) { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->setTempProvDisable(true); GLFrameCapture f; ss->cexec(rn + ".setMIPRotationAngle", fAngle); bool bSystemOrtho = ss->cexecRet(rn + ".getOrthoViewEnabled"); if (bSystemOrtho != bOrtho) ss->cexec(rn + ".setOrthoViewEnabled", bOrtho); ss->cexec(rn + ".setMIPLODEnabled", bUseLOD); if (bFinalFrame) { // restore state ss->cexec(rn + ".setMIPRotationAngle", 0.0f); if (bSystemOrtho != bOrtho) ss->cexec(rn + ".setOrthoViewEnabled", bSystemOrtho); } // as the window is double buffered call repaint twice ForceRepaint(); ForceRepaint(); std::string strSequenceName = SysTools::FindNextSequenceName(strFilename); if (strRealFilename) (*strRealFilename) = strSequenceName; ss->setTempProvDisable(false); return f.CaptureSingleFrame(strSequenceName, bPreserveTransparency); } bool RenderWindow::CaptureSequenceFrame(const std::string& strFilename, bool bPreserveTransparency, std::string* strRealFilename) { std::string strSequenceName = SysTools::FindNextSequenceName(strFilename); if (strRealFilename) (*strRealFilename) = strSequenceName; return CaptureFrame(strSequenceName, bPreserveTransparency); } void RenderWindow::SetTranslation(LuaClassInstance renderRegion, FLOATMATRIX4 accumulatedTranslation) { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->setTempProvDisable(true); ss->cexec(renderRegion.fqName()+".setTranslation4x4",accumulatedTranslation); ss->setTempProvDisable(false); RegionData *regionData = GetRegionData(renderRegion); regionData->arcBall.SetTranslation(accumulatedTranslation); updateClipPlaneTransform(renderRegion); } void RenderWindow::SetTranslationDelta(LuaClassInstance renderRegion, const FLOATVECTOR3& trans, bool bPropagate) { FLOATMATRIX4 newTranslation = GetTranslation(renderRegion); newTranslation.m41 += trans.x; newTranslation.m42 -= trans.y; newTranslation.m43 += trans.z; shared_ptr ss(m_MasterController.LuaScript()); ss->setTempProvDisable(true); ss->cexec(renderRegion.fqName() + ".setTranslation4x4", newTranslation); ss->setTempProvDisable(false); RegionData *regionData = GetRegionData(renderRegion); regionData->arcBall.SetTranslation(newTranslation); updateClipPlaneTransform(renderRegion); if (bPropagate){ for (size_t i = 0;iSetTranslation(otherRegion, newTranslation); else m_vpLocks[0][i]->SetTranslationDelta(otherRegion, trans, false); } } } void RenderWindow::FinalizeRotation(LuaClassInstance region, bool bPropagate) { // Reset the clip matrix we'll apply; the state is already stored/applied in // the ExtendedPlane instance. // setRotationAs4x4 // We group the functions inside of SetProvRotationAndClip together so that // one undo command will undo them all. shared_ptr ss(m_MasterController.LuaScript()); ss->beginCommandGroup(); SetProvRotationAndClip(region, GetRotation(region)); ss->endCommandGroup(); if (bPropagate) { for (size_t i = 0;iFinalizeRotation(otherRegion, false); } } } void RenderWindow::FinalizeTranslation(LuaClassInstance region, bool bPropagate) { // Call our registered Lua function so that undo of both the clipping plane // and the rotation occur in one step. shared_ptr ss(m_MasterController.LuaScript()); ss->beginCommandGroup(); SetProvTransAndClip(region, GetTranslation(region)); ss->endCommandGroup(); if (bPropagate) { for (size_t i = 0;iFinalizeTranslation(otherRegion, false); } } } void RenderWindow::SetRotation(LuaClassInstance region, FLOATMATRIX4 newRotation) { shared_ptr ss = m_MasterController.LuaScript(); string rn = m_LuaAbstrRenderer.fqName(); // Temporarily disable provenance. We don't want to record every single // rotation command, only the final rotation command. /// @todo should wrap in try catch so that setTempProvDisable always gets /// called. ss->setTempProvDisable(true); ss->cexec(region.fqName() + ".setRotation4x4", newRotation); ss->setTempProvDisable(false); updateClipPlaneTransform(region); } void RenderWindow::SetRotationDelta(LuaClassInstance region, const FLOATMATRIX4& rotDelta, bool bPropagate) { const FLOATMATRIX4 newRotation = GetRotation(region) * rotDelta; string rn = m_LuaAbstrRenderer.fqName(); shared_ptr ss = m_MasterController.LuaScript(); ss->setTempProvDisable(true); ss->cexec(region.fqName() + ".setRotation4x4", newRotation); ss->setTempProvDisable(false); updateClipPlaneTransform(region); if (bPropagate){ for (size_t i = 0;iSetRotation(otherRegion, newRotation); else m_vpLocks[0][i]->SetRotationDelta(otherRegion, rotDelta, false); } } } void RenderWindow::updateClipPlaneTransform(LuaClassInstance region) { shared_ptr ss = m_MasterController.LuaScript(); string renName = m_LuaAbstrRenderer.fqName(); // Test whether the clipping plane is locked. If it is, then utilize the // model->world transform of the volume. Otherwise, just utilize the clip // to world matrix. /// @todo Handle inverted plane normal. A simple inverted boolean will /// suffice. if(ss->cexecRet(renName + ".isClipPlaneLocked")) { // (clip space ->) object space -> world space FLOATMATRIX4 r = computeClipToVolToWorldTransform(region); ExtendedPlane plane; plane.Transform(r, false); SetClipPlane(region, plane); } else { RegionData* regionData = GetRegionData(region); FLOATMATRIX4 cs = regionData->toClipSpace.inverse(); ExtendedPlane plane; plane.Transform(cs, false); SetClipPlane(region, plane); } } FLOATMATRIX4 RenderWindow::getHomogeneousVolToWorldTrafo(LuaClassInstance region) { FLOATMATRIX4 vr = GetRotation(region); FLOATMATRIX4 vt = GetTranslation(region); // Create homogeneous volume->world matrix. FLOATMATRIX4 vx(vr); vx.m41 = vt.m41; vx.m42 = vt.m42; vx.m43 = vt.m43; return vx; } FLOATMATRIX4 RenderWindow::computeClipToVolToWorldTransform(LuaClassInstance region) { RegionData* regionData = GetRegionData(region); // Create homogeneous volume->world matrix. FLOATMATRIX4 vx = getHomogeneousVolToWorldTrafo(region); /// @todo We need a homogenous matrix inversion. The inversion below is /// overkill. FLOATMATRIX4 ics = regionData->toClipSpace.inverse(); // (clip space ->) object space -> world space return ics * vx; } void RenderWindow::SetPlaneAtClick(const ExtendedPlane& plane, bool propagate) { m_PlaneAtClick = plane; if (propagate) { for (size_t i = 0;iSetPlaneAtClick(m_vpLocks[0][i]->m_ClipPlane, false); } } } void RenderWindow::SetClipPlane(LuaClassInstance region, const ExtendedPlane &p) { shared_ptr ss(m_MasterController.LuaScript()); m_ClipPlane = p; ss->setTempProvDisable(true); ss->cexec(region.fqName() + ".setClipPlane", m_ClipPlane); ss->setTempProvDisable(false); } // Applies the given rotation matrix to the clip plane. // Basically, we're going to translate the plane back to the origin, do the // rotation, and then push the plane back out to where it should be. This // avoids any sort of issues w.r.t. rotating about the wrong point. void RenderWindow::SetClipRotationDelta(LuaClassInstance renderRegion, const FLOATMATRIX4& rotDelta, bool bPropagate, bool bSecondary) { RegionData* regionData = GetRegionData(renderRegion); // Transform the rotation into clipping space preserving transformation // order: (R3^-1*R2^-1*R1^-1)^-1 = R1 * R2 * R3. This inversion is performed // in computeClipToVolToWorldTransform to leave clipping space and enter // object space. regionData->toClipSpace = rotDelta.inverse() * regionData->toClipSpace; updateClipPlaneTransform(renderRegion); if (bPropagate) { for(std::vector::const_iterator iter = m_vpLocks[0].begin(); iter != m_vpLocks[0].end(); ++iter) { LuaClassInstance otherRegion = GetCorrespondingRenderRegion( *iter,renderRegion); if (m_bAbsoluteViewLock) { (*iter)->SetClipPlane(otherRegion, m_ClipPlane); } else { (*iter)->SetClipRotationDelta(otherRegion, rotDelta, false, bSecondary); } } } } // Translates the clip plane by the given vector, projected along the clip // plane's normal. void RenderWindow::SetClipTranslationDelta(LuaClassInstance renderRegion, const FLOATVECTOR3 &trans, bool bPropagate, bool bSecondary) { RegionData* regionData = GetRegionData(renderRegion); FLOATMATRIX4 translation; FLOATMATRIX4 worldToClip = computeClipToVolToWorldTransform(renderRegion).inverse(); // Get the scalar projection of the user's translation along the clip plane's // normal. We want to perform this scalar projection in world space. float sproj = trans ^ m_ClipPlane.Plane().xyz(); // The actual translation is along the clip's normal, weighted by the user's // translation. Done in clipping space. PLANE clipSpacePlane = m_ClipPlane.Plane(); clipSpacePlane.transform(worldToClip); // Remember, transformations against // planes are of the form (M^-1)^T. // We can't just transform // m_ClipPlane.Plane().xyz() by // worldToClip. FLOATVECTOR3 clipSpaceNormal = - clipSpacePlane.xyz(); // NOTE: We could just extract the negative 3rd column from the // regionData->toClipSpace matrix. // But this would make us dependent on the choice of the initial normal // in extended plane (see ms_Plane in ExtendededPlane) FLOATVECTOR3 tr = sproj * clipSpaceNormal; translation.Translation(tr); regionData->toClipSpace = regionData->toClipSpace * translation; updateClipPlaneTransform(renderRegion); if (bPropagate) { for(std::vector::iterator iter = m_vpLocks[0].begin(); iter != m_vpLocks[0].end(); ++iter) { LuaClassInstance otherRegion = GetCorrespondingRenderRegion(*iter, renderRegion); if (m_bAbsoluteViewLock) { (*iter)->SetClipPlane(otherRegion, m_ClipPlane); } else { (*iter)->SetClipTranslationDelta(otherRegion, trans, bPropagate, bSecondary); } } } } LuaClassInstance RenderWindow::GetCorrespondingRenderRegion(const RenderWindow* otherRW, LuaClassInstance myRR) const { for (int i=0; i < MAX_RENDER_REGIONS; ++i) for (int j=0; j < NUM_WINDOW_MODES; ++j) if (luaRenderRegions[i][j].getGlobalInstID() == myRR.getGlobalInstID()) return otherRW->luaRenderRegions[i][j]; // This should always succeed since myRR must be in this->renderRegions. assert(false); return LuaClassInstance(); } void RenderWindow::CloneViewState(RenderWindow* other) { m_mAccumulatedClipTranslation = other->m_mAccumulatedClipTranslation; shared_ptr ss = m_MasterController.LuaScript(); for (int i=0; i < MAX_RENDER_REGIONS; ++i) for (int j=0; j < NUM_WINDOW_MODES; ++j) { const LuaClassInstance otherRegion = other->luaRenderRegions[i][j]; const RegionData *otherData = other->GetRegionData(otherRegion); RegionData *data = GetRegionData(luaRenderRegions[i][j]); *data = *otherData; ss->cexec(luaRenderRegions[i][j].fqName() + ".setRotation4x4", other->GetRotation(otherRegion)); ss->cexec(luaRenderRegions[i][j].fqName() + ".setTranslation4x4", other->GetTranslation(otherRegion)); } } void RenderWindow::CloneRendermode(RenderWindow* other) { SetRendermode(other->GetRenderMode()); shared_ptr ss(m_MasterController.LuaScript()); ss->cexec(m_LuaAbstrRenderer.fqName() + ".cloneRenderMode", other->m_LuaAbstrRenderer); } void RenderWindow::SetRendermode(AbstrRenderer::ERenderMode eRenderMode, bool bPropagate) { shared_ptr ss(m_MasterController.LuaScript()); ss->cexec(m_LuaAbstrRenderer.fqName() + ".setRenderMode", eRenderMode); if (bPropagate){ for (size_t i = 0;iSetRendermode(eRenderMode, false); } } } void RenderWindow::SetColors(FLOATVECTOR3 vTopColor, FLOATVECTOR3 vBotColor, FLOATVECTOR4 vTextColor) { shared_ptr ss = m_MasterController.LuaScript(); string abstrRenName = GetLuaAbstrRenderer().fqName(); /// @todo Composite these two calls into one lua function to ensure they occur /// on the same undo/redo call. ss->cexec(abstrRenName + ".setBGColors", vTopColor, vBotColor); ss->cexec(abstrRenName + ".setTextColor", vTextColor); } void RenderWindow::SetUseLighting(bool bLighting, bool bPropagate) { /// @todo Have callback that will toggle the 'lighting' checkbox. shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setLightingEnabled", bLighting); if (bPropagate){ for (size_t i = 0;iSetUseLighting(bLighting, false); } } } bool RenderWindow::GetUseLighting() const { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".getLightingEnabled"); } void RenderWindow::SetSampleRateModifier(float fSampleRateModifier, bool bPropagate) { /// @todo Prov: We need a set 'final' sample rate modifier. Otherwise, sample /// rate modifier calls stack up in the undo/redo stacks. /// @todo Update sample rate slider from hook. shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setSampleRateModifier", fSampleRateModifier); if (bPropagate){ for (size_t i = 0;iSetSampleRateModifier(fSampleRateModifier, false); } } } void RenderWindow::SetFoV(float fFoV, bool bPropagate) { /// @todo Update FoV slider from hook. shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setFoV", fFoV); if (bPropagate){ for (size_t i = 0;iSetFoV(fFoV, false); } } } void RenderWindow::SetIsoValue(float fIsoVal, bool bPropagate) { /// @todo Provenance: Need final iso value instead of continuous change. /// @todo Update isovalue slider from hook. shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setIsoValue", fIsoVal); if(bPropagate) { LuaClassInstance dataset = GetRendererDataset(); pair range = ss->cexecRet >( dataset.fqName() + ".getRange"); // we might not have a valid range (old UVFs, color data). In that case, // use the bit width. if(range.second <= range.first) { range.first = 0.0; double width = static_cast(ss->cexecRet( dataset.fqName() + ".getBitWidth")); range.second = std::pow(2.0, width); } float isoval = MathTools::lerp(fIsoVal, range.first,range.second, 0.0f,1.0f ); for(size_t i=0; i < m_vpLocks[1].size(); ++i) { m_vpLocks[1][i]->SetIsoValueRelative(isoval, false); } } } void RenderWindow::SetIsoValueRelative(float isoval, bool propagate) { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setIsoValueRelative", isoval); if(propagate) { for(size_t i=0; i < m_vpLocks[1].size(); ++i) { m_vpLocks[1][i]->SetIsoValueRelative(isoval, false); } } } void RenderWindow::SetCVIsoValue(float fIsoVal, bool bPropagate) { // CV = clear view /// @todo Provenance: Need final iso value instead of continuous change. /// @todo Update cv isovalue slider from hook. shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setCVIsoValue", fIsoVal); if (bPropagate) { for (size_t i = 0;iSetCVIsoValue(fIsoVal, false); } } } void RenderWindow::SetCVSize(float fSize, bool bPropagate) { /// @todo Provenance: Need final size value instead of continuous change. /// @todo Update slider from hook. shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setCVSize", fSize); if (bPropagate){ for (size_t i = 0;iSetCVSize(fSize, false); } } } void RenderWindow::SetCVContextScale(float fScale, bool bPropagate) { /// @todo Provenance: Need final scale value instead of continuous change. /// @todo Update slider from hook. shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setCVContextScale", fScale); if (bPropagate){ for (size_t i = 0;iSetCVContextScale(fScale, false); } } } void RenderWindow::SetCVBorderScale(float fScale, bool bPropagate) { /// @todo Provenance: Need final scale value instead of continuous change. /// @todo Update slider from hook. shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setCVBorderScale", fScale); if (bPropagate){ for (size_t i = 0;iSetCVBorderScale(fScale, false); } } } void RenderWindow::SetGlobalBBox(bool bRenderBBox, bool bPropagate) { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setGlobalBBox", bRenderBBox); if (bPropagate){ for (size_t i = 0;iSetGlobalBBox(bRenderBBox, false); } } } void RenderWindow::SetLocalBBox(bool bRenderBBox, bool bPropagate) { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setLocalBBox", bRenderBBox); if (bPropagate){ for (size_t i = 0;iSetLocalBBox(bRenderBBox, false); } } } void RenderWindow::SetClipPlaneEnabled(bool enable, bool bPropagate) { shared_ptr ss(m_MasterController.LuaScript()); ss->beginCommandGroup(); if(enable) { ss->cexec(GetFirst3DRegion().fqName() + ".enableClipPlane", true); // Restore the locking setting which was active when the clip plane was // disabled. SetClipPlaneRelativeLock(m_SavedClipLocked, bPropagate); } else { // Disable the clip plane, and then implicitly lock it to the volume. This // means that the clip plane will appear to `follow' the volume while it is // disabled, which is a bit unintuitive in some sense. // However, it might occur that interactions that happen while the clip // plane is disabled could cause it to clip the entire volume when // re-enabled, which is *very* confusing. By keeping it locked while // disabled, this is prevented, so it's the lesser of the two evils. m_SavedClipLocked = ss->cexecRet(GetLuaAbstrRenderer().fqName() + ".isClipPlaneLocked"); ss->cexec(GetFirst3DRegion().fqName() + ".enableClipPlane", false); SetClipPlaneRelativeLock(true, bPropagate); } if(bPropagate) { for(std::vector::iterator locks = m_vpLocks[1].begin(); locks != m_vpLocks[1].end(); ++locks) { (*locks)->SetClipPlaneEnabled(enable, false); } } ss->endCommandGroup(); } void RenderWindow::LuaCallbackEnableClipPlane(bool enable) { // This function is called from Lua every time enableClipPlane is called. // We should be the active render window and we should change the checkbox // state. m_MainWindow->LuaCallbackToggleClipPlane(enable); } void RenderWindow::SetClipPlaneDisplayed(bool bDisp, bool bPropagate) { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".showClipPlane", bDisp, GetFirst3DRegion()); if(bPropagate) { for(std::vector::iterator locks = m_vpLocks[1].begin(); locks != m_vpLocks[1].end(); ++locks) { (*locks)->SetClipPlaneDisplayed(bDisp, false); } } } void RenderWindow::SetClipPlaneRelativeLock(bool bLock, bool bPropagate) { shared_ptr ss(m_MasterController.LuaScript()); // NOTE: Assuming first 3D render region. LuaClassInstance region = GetFirst3DRegion(); RegionData* regionData = GetRegionData(GetFirst3DRegion()); // Update clip plane. bool currentlyLocked = ss->cexecRet(GetLuaAbstrRenderer().fqName() + ".isClipPlaneLocked"); if (currentlyLocked == true && bLock == false) { // (clip space ->) object space -> world space // Make clip plane relative to the world. FLOATMATRIX4 r = computeClipToVolToWorldTransform(region); regionData->toClipSpace = r.inverse(); } else if (currentlyLocked == false && bLock == true) { // Obtain a new clipping space transform relative to the world space // transformation of the render region's volume. FLOATMATRIX4 vx = getHomogeneousVolToWorldTrafo(region); // Make clip plane relative to the object: O * C^-1 (clip plane was // relative to the world prior). FLOATMATRIX4 newClipSpace = vx * regionData->toClipSpace; regionData->toClipSpace = newClipSpace; } ss->cexec(GetLuaAbstrRenderer().fqName() + ".setClipPlaneLocked", bLock); // This should have NO effect on the current xform of the clipping plane. // Here as a visual debugging aid. updateClipPlaneTransform(region); if(bPropagate) { for(std::vector::iterator locks = m_vpLocks[1].begin(); locks != m_vpLocks[1].end(); ++locks) { (*locks)->SetClipPlaneRelativeLock(bLock, false); } } } void RenderWindow::SetIsosurfaceColor(const FLOATVECTOR3& vIsoColor, bool bPropagate) { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setIsosurfaceColor", vIsoColor); if (bPropagate){ for (size_t i = 0;iSetIsosurfaceColor(vIsoColor, false); } } } void RenderWindow::SetCVColor(const FLOATVECTOR3& vIsoColor, bool bPropagate) { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setCVColor", vIsoColor); if (bPropagate){ for (size_t i = 0;iSetCVColor(vIsoColor, false); } } } void RenderWindow::SetCV(bool bDoClearView, bool bPropagate) { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setClearViewEnabled", bDoClearView); if (bPropagate){ for (size_t i = 0;iSetCV(bDoClearView, false); } } } void RenderWindow::SetCVFocusPos(LuaClassInstance region, const INTVECTOR2& viMousePos, bool bPropagate) { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setCVFocusPos", region, viMousePos); if (bPropagate) { for (size_t i = 0;iSetCVFocusPos(region, viMousePos, false); } } } void RenderWindow::SetTimestep(size_t t, bool propagate) { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); ss->cexec(rn + ".setTimestep", t); if(propagate) { for (size_t i = 0;iSetTimestep(t, false); } } } void RenderWindow::SetLogoParams(QString strLogoFilename, int iLogoPos) { m_MasterController.LuaScript()->cexec( GetLuaAbstrRenderer().fqName() + ".setLogoParams", std::string(strLogoFilename.toAscii()), iLogoPos); } void RenderWindow::SetAbsoluteViewLock(bool bAbsoluteViewLock) { m_bAbsoluteViewLock = bAbsoluteViewLock; } pair RenderWindow::GetDynamicRange() const { shared_ptr ss(m_MasterController.LuaScript()); LuaClassInstance dataset = GetRendererDataset(); pair range = ss->cexecRet >( dataset.fqName() + ".getRange"); // Old UVFs lack a maxmin data block, && will say the min > the max. if (range.first > range.second) { LuaClassInstance tf1d = GetRendererTransferFunction1D(); return make_pair(0, double(ss->cexecRet(tf1d.fqName() + ".getSize"))); } else { return range; } } FLOATVECTOR3 RenderWindow::GetIsosurfaceColor() const { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".getIsosurfaceColor"); } FLOATVECTOR3 RenderWindow::GetCVColor() const { shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); return ss->cexecRet(rn + ".getCVColor"); } void RenderWindow::ResizeRenderer(int width, int height) { m_vWinDim = UINTVECTOR2((unsigned int)width, (unsigned int)height); /// @fixme Create a setMaxCoord function for the region. shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); LuaClassInstance firstRenRegion = GetActiveRenderRegions()[0]; RenderRegion* regPtr = firstRenRegion.getRawPointer(ss); if (m_LuaAbstrRenderer.isValid(ss) && m_bRenderSubsysOK) { switch (GetViewMode()) { case VM_SINGLE : regPtr->maxCoord = m_vWinDim; break; case VM_TWOBYTWO : UpdateWindowFraction(); break; default: break; //nothing to do... }; ss->cexec(rn + ".resize", UINTVECTOR2(width, height)); SetupArcBall(); std::ostringstream wsize; wsize << m_vWinDim[0] << " " << m_vWinDim[1] << std::ends; } } void RenderWindow::PaintRenderer() { if (!m_strMultiRenderGuard.tryLock()) { MESSAGE("Rejecting dublicate Paint call"); return; } shared_ptr ss(m_MasterController.LuaScript()); string rn = m_LuaAbstrRenderer.fqName(); if (m_LuaAbstrRenderer.isValid(ss) && m_bRenderSubsysOK) { if (!ss->cexecRet(rn + ".paint")) { static bool bBugUseronlyOnce = true; if (bBugUseronlyOnce) { if (m_eRendererType == MasterController::OPENGL_2DSBVR) { QMessageBox::critical(NULL, "Render error", "The render subsystem is unable to draw the volume" "This normally means ImageVis3D does not support " "your GPU. Please check the debug log " "('Help | Debug Window') for " "errors, and/or use 'Help | Report an Issue' to " "notify the ImageVis3D developers."); } else { QMessageBox::critical(NULL, "Render error", "The render subsystem is unable to draw the volume" "This normally means that your driver is " "reporting invalid information about your GPU." "Try switching the renderer into 2D slicing " "mode in the Preferences/Settings."); } bBugUseronlyOnce = false; } T_ERROR("AbstrRenderer::Paint() call failed."); } if (GetQtWidget()->isActiveWindow()) { unsigned int iLevelCount = GetCurrentSubFrameCount(); unsigned int iWorkingLevelCount = GetWorkingSubFrame(); unsigned int iBrickCount = GetCurrentBrickCount(); unsigned int iWorkingBrick = GetWorkingBrick(); unsigned int iMinLODIndex = GetMinLODIndex(); m_MainWindow->SetRenderProgressAnUpdateInfo(iLevelCount, iWorkingLevelCount, iBrickCount, iWorkingBrick, iMinLODIndex, this); } } PaintOverlays(); m_strMultiRenderGuard.unlock(); } void RenderWindow::ResetRenderingParameters() { FLOATMATRIX4 mIdentity; m_mAccumulatedClipTranslation = mIdentity; shared_ptr ss = m_MasterController.LuaScript(); for (int i=0; i < MAX_RENDER_REGIONS; ++i) { for (int j=0; j < NUM_WINDOW_MODES; ++j) { LuaClassInstance region = luaRenderRegions[i][j]; GetRegionData(region)->toClipSpace = mIdentity; ss->cexec(region.fqName() + ".setRotation4x4", mIdentity); ss->cexec(region.fqName() + ".setTranslation4x4", mIdentity); SetClipPlane(region, ExtendedPlane()); } } SetWindowFraction2x2(FLOATVECTOR2(0.5f, 0.5f)); string an = GetLuaAbstrRenderer().fqName(); ss->cexec(an + ".resetUpDir"); ss->cexec(an + ".resetViewDir"); ss->cexec(an + ".resetViewPos"); ss->cexec(an + ".transfer3DRotationToMIP"); m_fFirstPersonSpeed = s_fFirstPersonSpeed; } void RenderWindow::SetCurrent1DHistScale(const float value) { m_1DHistScale = value; } void RenderWindow::SetCurrent2DHistScale(const float value) { m_2DHistScale = value; } float RenderWindow::GetCurrent1DHistScale() const { return m_1DHistScale; } float RenderWindow::GetCurrent2DHistScale() const { return m_2DHistScale; } LuaClassInstance RenderWindow::GetLuaAbstrRenderer() const { return m_LuaAbstrRenderer; } LuaClassInstance RenderWindow::GetLuaInstance() const { return m_LuaThisClass; } void RenderWindow::SetProvTransformAndClip(tuvok::LuaClassInstance region, FLOATMATRIX4 m){ // Extract the translational component from the matrix. FLOATMATRIX4 t4; t4.m41 = m.m41; t4.m42 = m.m42; t4.m43 = m.m43; FLOATMATRIX4 r4; r4.m11 = m.m11; r4.m12 = m.m12; r4.m13 = m.m13; r4.m21 = m.m21; r4.m22 = m.m22; r4.m23 = m.m23; r4.m31 = m.m31; r4.m32 = m.m32; r4.m33 = m.m33; shared_ptr ss = m_MasterController.LuaScript(); ss->cexec(region.fqName() + ".setRotation4x4", r4); ss->cexec(region.fqName() + ".setTranslation4x4", t4); ss->cexec(region.fqName() + ".setClipPlane", m_ClipPlane); } void RenderWindow::SetProvRotationAndClip(tuvok::LuaClassInstance region, FLOATMATRIX4 r) { shared_ptr ss = m_MasterController.LuaScript(); ss->cexec(region.fqName() + ".setRotation4x4", r); ss->cexec(region.fqName() + ".setClipPlane", m_ClipPlane); } void RenderWindow::SetProvTransAndClip(tuvok::LuaClassInstance region, FLOATMATRIX4 t) { shared_ptr ss = m_MasterController.LuaScript(); ss->cexec(region.fqName() + ".setTranslation4x4", t); ss->cexec(region.fqName() + ".setClipPlane", m_ClipPlane); } void RenderWindow::LuaSetTransform(FLOATMATRIX4 m) { SetProvTransformAndClip(GetFirst3DRegion(), m); } void RenderWindow::LuaSetRotation(FLOATMATRIX3 m) { FLOATMATRIX4 r4; r4.m11 = m.m11; r4.m12 = m.m12; r4.m13 = m.m13; r4.m21 = m.m21; r4.m22 = m.m22; r4.m23 = m.m23; r4.m31 = m.m31; r4.m32 = m.m32; r4.m33 = m.m33; SetProvRotationAndClip(GetFirst3DRegion(), r4); } void RenderWindow::LuaSetTranslation(VECTOR3 v) { FLOATMATRIX4 t4; t4.m41 = v.x; t4.m42 = v.y; t4.m43 = v.z; SetProvTransAndClip(GetFirst3DRegion(), t4); } void RenderWindow::LuaSetTranslationAs4x4(FLOATMATRIX4 m) { SetProvTransAndClip(GetFirst3DRegion(), m); } void RenderWindow::LuaSetRotationAs4x4(FLOATMATRIX4 m) { SetProvRotationAndClip(GetFirst3DRegion(), m); } void RenderWindow::LuaResizeWindow(const UINTVECTOR2& newSize) { UINTVECTOR2 renderSize = GetRendererSize(); UINTVECTOR2 windowSize(GetQtWidget()->size().width(), GetQtWidget()->size().height()); UINTVECTOR2 winDecoSize = windowSize-renderSize; QMdiSubWindow* w = dynamic_cast(GetQtWidget()->parent()); if(w) { w->resize(newSize.x+winDecoSize.x, newSize.y+winDecoSize.y); } } void RenderWindow::LuaSetLighting(bool enabled) { this->SetUseLighting(enabled); } void RenderWindow::LuaLoad1DTFqn(const std::string& tf) { this->m_MainWindow->LoadTransferFunction1D(tf); } void RenderWindow::LuaLoad2DTFqn(const std::string& tf) { this->m_MainWindow->LoadTransferFunction2D(tf); } void RenderWindow::LuaSetClipPlane(const FLOATMATRIX4& m) { LuaClassInstance rgn = this->GetFirst3DRegion(); ExtendedPlane p; p.Transform(m, false); SetClipPlane(rgn, p); } void RenderWindow::RegisterLuaFunctions( LuaClassRegistration& reg, RenderWindow* me, LuaScripting* ss) { ss->vPrint("Registering render window functions."); me->m_LuaThisClass = reg.getLuaInstance(); string id; LuaClassInstance ar = me->GetLuaAbstrRenderer(); // Hooks for updating the UI when events in Tuvok occur. me->m_MemReg.strictHook(me, &RenderWindow::LuaCallbackEnableClipPlane, me->GetFirst3DRegion().fqName() + ".enableClipPlane"); // Inherit functions from the Abstract Renderer. reg.inherit(ar, "getDataset"); reg.inherit(ar, "setBGColors"); reg.inherit(ar, "setTextColor"); reg.inherit(ar, "setBlendPrecision"); reg.inherit(ar, "setLogoParams"); reg.inherit(ar, "setRendererTarget"); // Register our own functions. id = reg.function(&RenderWindow::GetLuaAbstrRenderer, "getRawRenderer", "Returns the Tuvok abstract renderer instance.", false); ss->addReturnInfo(id, "Lua class instance of Tuvok's abstract renderer." "Generally, you should use the methods exposed by the render window " "instead of resorting to raw access to the renderer."); id = reg.function(&RenderWindow::SetPerfMeasures, "setPerformanceMeasures", "Sets various performance measures. See info for a detailed" " description of the parameters.", true); ss->addParamInfo(id, 0, "minFramerate", "Minimum framerate."); ss->addParamInfo(id, 1, "lowResRender", "If true, render low res intermediate" "results."); ss->addParamInfo(id, 2, "screenResDecFactor", ""); // screen res decrease? ss->addParamInfo(id, 3, "sampleDecFactor", ""); // sample rate decrease? ss->addParamInfo(id, 4, "LODDelay", "LOD Delay."); ss->addParamInfo(id, 5, "activeTS", ""); ss->addParamInfo(id, 6, "inactiveTS", ""); id = reg.function(&RenderWindow::CaptureFrame, "screenCapture", "Screenshot of the current volume.", false); ss->addParamInfo(id, 0, "filename", "Filename of the screen cap."); ss->addParamInfo(id, 1, "preserveTransparency", "True if you want to preserve" " transparency in the screen cap."); id = reg.function(&RenderWindow::LuaSetTransform, "setTransform", "Sets the 4x4 matrix transformation for the first 3D " "render region.", true); id = reg.function(&RenderWindow::LuaSetRotation, "setRotation", "Sets 3x3 rotation matrix for the first 3D " "render region.", true); id = reg.function(&RenderWindow::LuaSetTranslation, "setTranslation", "Sets translation for the first 3D " "render region.", true); id = reg.function(&RenderWindow::LuaSetRotationAs4x4, "setRotationAs4x4", "Sets 3x3 rotation matrix for the first 3D " "render region.", true); id = reg.function(&RenderWindow::LuaSetTranslationAs4x4,"setTranslationAs4x4", "Sets translation for the first 3D " "render region.", true); id = reg.function(&RenderWindow::LuaResizeWindow,"resize", "Resize this render window.", true); id = reg.function(&RenderWindow::LuaSetLighting, "lighting", "turn lighting on and off", true); id = reg.function(&RenderWindow::LuaLoad1DTFqn, "tfqn1d", "load a new (1D) transfer function", true); id = reg.function(&RenderWindow::LuaLoad2DTFqn, "tfqn2d", "load a new (2D) transfer function", true); reg.function(&RenderWindow::UpdateWindow, "paint", "forces paint", false); reg.function(&RenderWindow::RotateViewer, "rotateViewer", "Rotates the viewer in x and y viewing direction", true); reg.function(&RenderWindow::MoveViewer, "moveViewer", "Moves the viewer in the viewing coordinate frame", true); reg.function(&RenderWindow::SetFirstPersonMode, "setFirstPersonMode", "Enables/disables the first person mode", true); reg.function(&RenderWindow::GetFirstPersonMode, "getFirstPersonMode", "Returns true if the first person mode is enabled", true); reg.function(&RenderWindow::LuaSetClipPlane, "setClipPlane", "resets the clipping plane to the given 4x4 transform", true); id = reg.function(&RenderWindow::CaptureSubframe, "captureSubframe", "captures whatever's in the buffer now", true); ss->addParamInfo(id, 0, "filename", "Filename to save it in"); id = reg.function(&RenderWindow::ClipDelta, "clipDelta", "moves the clip plane in the direction of its normal", true); ss->addParamInfo(id, 0, "floating-point", "amount to move the plane [0--1]"); } void RenderWindow::ClipDelta(float d) { if(d < -1.0 || d > 1.0) { WARNING("large clip plane movement.. scripting bug? Proceeding anyway."); } LuaClassInstance rr3d = this->GetFirst3DRegion(); SetClipTranslationDelta(rr3d, FLOATVECTOR3(d,d,0), false, false); } ImageVis3D-3.1.0/ImageVis3D/UI/UI/0000755000175000017500000000000012320517543016007 5ustar mathieumathieuImageVis3D-3.1.0/ImageVis3D/UI/UI/FTPDialog.ui0000644000175000017500000000563712320517543020132 0ustar mathieumathieu FTPDialog Qt::WindowModal 0 0 400 131 FTP Transfer true Current Transfer TextLabel 24 QFrame::NoFrame QFrame::Raised 0 0 Qt::Horizontal 40 20 Abort Qt::Vertical 20 40 pushButton clicked() FTPDialog AbortTransfer() 355 98 271 88 AbortTransfer() ImageVis3D-3.1.0/ImageVis3D/UI/UI/PleaseWait.ui0000644000175000017500000000365412320517543020414 0ustar mathieumathieu PleaseWaitDialog Qt::WindowModal true 0 0 593 151 0 0 500 150 Qt::NoContextMenu Please wait .... false true 12 75 true Please wait .. Qt::AlignCenter true false Qt::AlignCenter true ImageVis3D-3.1.0/ImageVis3D/UI/UI/LODDlg.ui0000644000175000017500000001230012320517543017407 0ustar mathieumathieu LODDlg Qt::WindowModal 0 0 296 300 LOD Level true 12 75 true TextLabel true QFrame::NoFrame QFrame::Plain 0 0 Qt::Vertical QFrame::NoFrame QFrame::Plain 0 0 Lowest Resolution Qt::Vertical 20 40 12 75 true Selected Resolution Qt::AlignCenter Qt::Vertical 20 40 Highest Resolution Qt::Horizontal QDialogButtonBox::Cancel|QDialogButtonBox::Ok buttonBox accepted() LODDlg accept() 257 290 157 274 buttonBox rejected() LODDlg reject() 286 290 286 274 verticalSlider_LOD valueChanged(int) LODDlg ChangeLOD(int) 23 138 285 27 ChangeLOD(int) ImageVis3D-3.1.0/ImageVis3D/UI/UI/About.ui0000644000175000017500000002016712320517543017426 0ustar mathieumathieu About Qt::WindowModal 0 0 1142 894 0 0 About ImageVis3D false true 0 0 0 0 16777215 16777215 30 ImageVis3D Logo false Qt::AlignCenter About TextLabel true QFrame::NoFrame QFrame::Plain 0 0 Need Help? 0 0 23 Goto Online Help false 0 23 Check for new Version false 0 23 Goto Online Video Tutorials false Report an Issue QFrame::NoFrame QFrame::Plain 0 0 Qt::Horizontal 40 20 0 23 Close false true pushButton_CheckForNewVersion clicked() About CheckUpdates() 437 369 635 387 pushButton_OnlineVideoTutorials clicked() About OnlineVideoTut() 437 294 635 192 pushButton_GotoOnlineHelp clicked() About OnlineHelp() 437 265 634 68 pushButton_OK clicked() About accept() 447 441 465 475 pushButton_BugRep clicked() About ReportABug() 167 390 5 406 CheckUpdates() OnlineHelp() OnlineVideoTut() ReportABug() CheckUpdatesClicked() OnlineHelpClicked() OnlineVideoTutClicked() ReportABugClicked() ImageVis3D-3.1.0/ImageVis3D/UI/UI/MergeDlg.ui0000644000175000017500000003310612320517543020037 0ustar mathieumathieu MergeDlg Qt::WindowModal 0 0 557 633 Merge Files true Merge Modes Use a Default Mode true Store only the maximum of all data sets true Add all data sets together Use a Custom Expression true false Expression: QFrame::NoFrame QFrame::Raised 0 0 QFrame::NoFrame QFrame::Raised 0 QFrame::NoFrame QFrame::Raised 0 0 Add Data Set Remove Data Set Qt::Vertical 20 40 Auto-Analyze true QFrame::NoFrame QFrame::Raised 0 0 Information Click Analyze to get information about the data set Analyze Bias and Scale Bias -100000.000000000000000 100000.000000000000000 Scale -100000.000000000000000 100000.000000000000000 Qt::Horizontal 40 20 QFrame::NoFrame QFrame::Raised 0 0 Qt::Horizontal 40 20 Save Cancel grpDefaultExpressionModes radioButton_max radioButton_add grpCustomExpressionMode txtExpression listWidget_datasets pushButton_addData pushButton_removeData checkBox_AutoAnalyze pushButton_Analyze doubleSpinBox_bias doubleSpinBox_scale pushButton_save pushButton_cancel pushButton_Analyze clicked() MergeDlg AnalyzeCurrentDataset() 135 490 7 148 listWidget_datasets currentRowChanged(int) MergeDlg ChangedActiveDataset() 153 383 4 231 pushButton_addData clicked() MergeDlg AddDataset() 541 300 6 75 pushButton_removeData clicked() MergeDlg RemoveDataset() 541 334 3 188 pushButton_save clicked() MergeDlg ExecuteMerge() 461 620 2 302 pushButton_cancel clicked(bool) MergeDlg CancelMerge() 544 620 4 275 doubleSpinBox_scale valueChanged(double) MergeDlg ChangedScale(double) 320 556 396 240 doubleSpinBox_bias valueChanged(double) MergeDlg ChangedBias(double) 127 556 400 275 grpDefaultExpressionModes clicked(bool) MergeDlg ToggleDefaultMergeSet(bool) 278 56 278 316 grpCustomExpressionMode clicked(bool) MergeDlg ToggleCustomMergeSet(bool) 278 132 278 316 AnalyzeCurrentDataset() ChangedActiveDataset() AddDataset() RemoveDataset() ExecuteMerge() CancelMerge() ChangedScale(double) ChangedBias(double) ToggleDefaultMergeSet(bool) ToggleCustomMergeSet(bool) ImageVis3D-3.1.0/ImageVis3D/UI/UI/ScaleAndBiasDlg.ui0000644000175000017500000010156312320517543021254 0ustar mathieumathieu ScaleAndBiasDlg Qt::WindowModal 0 0 457 631 Qt::DefaultContextMenu Mesh Transform true true 0 0 10 75 true Mesh Description Qt::AlignCenter Info Before scale and bias: Size: [1, 1, 1] Center: [0, 0, 0] After scale and bias: Size: [1, 1, 1] Center: [0, 0, 0] Scale 8 -999999999.000000000000000 999999999.000000000000000 1.000000000000000 0 0 x 8 -999999999.000000000000000 999999999.000000000000000 1.000000000000000 0 0 y 8 -999999999.000000000000000 999999999.000000000000000 1.000000000000000 0 0 z Bias 8 -999999999.000000000000000 999999999.000000000000000 0.000000000000000 0 0 x 8 -999999999.000000000000000 999999999.000000000000000 0.000000000000000 0 0 y 8 -999999999.000000000000000 999999999.000000000000000 0.000000000000000 0 0 z Fit To ... QFrame::NoFrame QFrame::Raised 0 0 Unit Cube (Isotropic) Unit Cube (Unisotropic) QFrame::NoFrame QFrame::Raised 0 0 Volume (Isotropic) Volume (Unisotropic) 0 0 In Isotropic fitting all dimensions are scaled down by the same factor such that the largest one fits exacly into the given domain. This preserves the preserve aspect ratio of the geometry but in some of the dimensions it can beome smaler then the domain. In unisotropic scaling all dimension are scaled separately, hence, the geometry will have the exact same size of the domain but may change it's aspect ratio. Qt::AlignJustify|Qt::AlignVCenter true Expert Options 0 0 50 0 QFrame::NoFrame QFrame::Raised 0 0 0 0 20 0 0 0 0 20 0 0 0 0 20 0 0 0 0 20 0 1 0 0 20 0 1 0 0 20 0 0 0 0 20 0 0 0 0 20 0 0 0 0 20 0 0 0 0 20 0 0 0 0 20 0 0 0 0 20 0 1 0 0 20 0 0 0 0 20 0 0 0 0 20 0 0 0 0 20 0 1 Qt::Horizontal 40 20 QFrame::NoFrame QFrame::Raised 0 0 Apply Matrix to Geometry Initialize Matrix from Scale and Bias above Qt::Vertical 20 40 Restore Last Matrix Invert Matrix QFrame::NoFrame QFrame::Raised 0 0 Save To File Restore From File Apply QFrame::NoFrame QFrame::Raised 0 Show expert options Qt::Horizontal 40 20 Close pushButton_ScalToFit1 clicked() ScaleAndBiasDlg ScaleIsotropic() 84 265 4 137 pushButton_ScalToFit2 clicked() ScaleAndBiasDlg ScaleUnisotropic() 419 265 2 164 doubleSpinBox_Sx valueChanged(QString) ScaleAndBiasDlg ValuesChanged() 108 132 444 3 doubleSpinBox_Sy valueChanged(double) ScaleAndBiasDlg ValuesChanged() 242 132 456 27 doubleSpinBox_Sz valueChanged(double) ScaleAndBiasDlg ValuesChanged() 392 130 456 50 doubleSpinBox_Bx valueChanged(double) ScaleAndBiasDlg ValuesChanged() 92 190 456 77 doubleSpinBox_By valueChanged(double) ScaleAndBiasDlg ValuesChanged() 253 190 456 105 doubleSpinBox_Bz valueChanged(double) ScaleAndBiasDlg ValuesChanged() 426 203 456 133 pushButton_ApplyExpertMatrix clicked() ScaleAndBiasDlg ApplyExpertMatrix() 292 413 215 378 pushButton_CopyFromAbove clicked() ScaleAndBiasDlg CopyScaleAndBias() 347 445 305 377 checkBoxShowExpert clicked() ScaleAndBiasDlg ToggleExpertView() 58 608 3 400 pushButtonInvert clicked() ScaleAndBiasDlg InvertMatrix() 265 550 383 378 pushButtonRestoreLast clicked() ScaleAndBiasDlg RestoreLast() 264 511 61 377 pushButton_ScaleToFit3 clicked() ScaleAndBiasDlg ScaleIsotropicVol() 195 280 6 280 pushButton_ScaleToFit4 clicked() ScaleAndBiasDlg ScaleUnisotropicVol() 339 282 452 292 pushButton_Save clicked() ScaleAndBiasDlg Save() 150 572 7 312 pushButton_Restore clicked() ScaleAndBiasDlg Restore() 299 585 5 442 pushButton_apply clicked() ScaleAndBiasDlg Apply() 362 582 3 592 pushButton_close clicked() ScaleAndBiasDlg close() 414 608 454 538 ScaleIsotropic() ScaleUnisotropic() ValuesChanged() ApplyExpertMatrix() CopyScaleAndBias() ToggleExpertView() InvertMatrix() RestoreLast() ScaleIsotropicVol() ScaleUnisotropicVol() Save() Restore() Apply() ImageVis3D-3.1.0/ImageVis3D/UI/UI/RAWDialog.ui0000644000175000017500000005234312320517543020126 0ustar mathieumathieu RAWDialog Qt::WindowModal 0 0 733 490 Qt::DefaultContextMenu Load Unknown Dataset true true 0 0 10 75 true Filename: xxxxx.raw Qt::AlignCenter Domain Size 1000000000 256 0 0 x 1000000000 256 0 0 x 1000000000 256 Aspect Ratio 8 999999999.000000000000000 1.000000000000000 0 0 x 8 999999999.000000000000000 1.000000000000000 0 0 x 8 999999999.000000000000000 1.000000000000000 QFrame::StyledPanel QFrame::Raised 2 0 Quantization 8bit (char) 16bit (short) true 32bit (int) 32 bit (float) 64 bit (double) Sign Unsigned true Signed QFrame::StyledPanel QFrame::Raised 2 0 Encoding RAW true Text GZIP BZIP2 Endianess Little true Big Header Skip Skip 100 0 1000000000 Bytes The guessed size of the header is the size of the file minus the size of the data as specified above. This feature only works if the encoding is raw and if the filesize is larger than the size of the data specified. Guess Header Size Qt::Horizontal 40 20 10 75 true Value Validation Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter Qt::Horizontal QDialogButtonBox::Cancel|QDialogButtonBox::Ok buttonBox accepted() RAWDialog accept() 302 480 157 274 buttonBox rejected() RAWDialog reject() 355 480 286 274 spinBox_SizeX valueChanged(QString) RAWDialog CheckValues() 71 66 148 323 spinBox_SizeY valueChanged(int) RAWDialog CheckValues() 339 73 75 349 spinBox_SizeZ valueChanged(int) RAWDialog CheckValues() 509 73 396 27 radioButton_8bit clicked() RAWDialog CheckValues() 83 219 8 148 radioButton_16bit clicked() RAWDialog CheckValues() 181 219 3 189 radioButton_32BitFloat clicked() RAWDialog CheckValues() 346 219 435 201 radioButton_RAW clicked() RAWDialog CheckValues() 91 291 435 235 radioButton_Text clicked() RAWDialog CheckValues() 184 291 434 277 radioButton_GZIP clicked() RAWDialog CheckValues() 270 291 439 308 radioButton_BZIP2 clicked() RAWDialog CheckValues() 355 291 435 264 spinBox_HeaderSkip valueChanged(int) RAWDialog CheckValues() 143 364 237 325 radioButton_RAW clicked() RAWDialog ToggleEndianessDialog() 66 291 201 353 pushButton_GuessHeader clicked() RAWDialog GuessHeaderSize() 279 365 440 358 radioButton_32BitInt clicked() RAWDialog CheckValues() 257 219 521 150 radioButton_32BitFloat clicked(bool) groupBox_Sign setDisabled(bool) 346 219 722 236 radioButton_32BitInt clicked(bool) groupBox_Sign setEnabled(bool) 257 219 722 236 radioButton_16bit clicked(bool) groupBox_Sign setEnabled(bool) 181 219 722 236 radioButton_32BitFloat clicked(bool) radioButton_Signed setChecked(bool) 346 219 712 219 radioButton_8bit clicked(bool) groupBox_Sign setEnabled(bool) 83 219 722 236 radioButton_64BitFloat clicked() RAWDialog CheckValues() 386 210 1 379 radioButton_64BitFloat clicked(bool) radioButton_Signed setChecked(bool) 407 210 693 213 CheckValues() ToggleEndianessDialog() GuessHeaderSize() ImageVis3D-3.1.0/ImageVis3D/UI/UI/SettingsDlg.ui0000644000175000017500000021166112320517543020604 0ustar mathieumathieu SettingsDlg Qt::ApplicationModal 0 0 669 550 Qt::DefaultContextMenu ImageVis3D Settings (Advanced) true true 0 Memory Memory Usage QFrame::NoFrame QFrame::Raised 0 0 0 0 GPU Memory CPU Memory Qt::Horizontal Qt::Horizontal MB Qt::RightToLeft 64 Qt::RightToLeft 1024 MB QFrame::NoFrame QFrame::Raised 0 0 Override Maxima true QFrame::NoFrame QFrame::Raised 0 0 GPU 1 999999 MB CPU 1 999999 MB Qt::Horizontal 40 20 1 0 75 true This is a 32bit executable so even if you have more than 2GB installed you can only access up to 2GB. Qt::AlignCenter true Statistics TextLabel TextLabel TextLabel TextLabel Directories true Temporary files ... Qt::Vertical 20 40 UVF File Parameters Bricksize QFrame::NoFrame QFrame::Plain 0 0 45 0 Maximum 7 14 8 Qt::Horizontal 40 0 256^3 Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter QFrame::NoFrame QFrame::Plain 0 0 45 0 Builder 3 14 5 Qt::Horizontal 40 0 16^3 Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter Filter Median true Mean Qt::Horizontal 40 20 Border Zero true Last Value Qt::Horizontal 40 20 Compression QFrame::StyledPanel QFrame::Raised 0 None Zlib true LZMA LZ4 Bzlib LZHAM Qt::Horizontal 290 20 QFrame::StyledPanel QFrame::Raised 0 45 0 Level 1 10 1 Qt::Horizontal 80 0 Fastest (1) Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter Layout Scanline true Morton Hilbert Random Qt::Horizontal 40 20 Qt::Vertical 20 40 Performance File Handling Open files without verfication Rendering QFrame::StyledPanel QFrame::Raised 0 0 0 120 0 Minimal Framerate 0 100 10 Qt::Horizontal 0 0 40 0 10 fps Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter Also reduce screen resolution and sampling rate if needed true QFrame::StyledPanel QFrame::Raised 0 0 0 120 0 LOD Delay 100 10000 1000 Qt::Horizontal 0 0 40 0 1000 ms Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter QFrame::StyledPanel QFrame::Raised 0 0 0 120 0 Active Timeslice 5000 10 500 Qt::Horizontal 0 0 40 0 500 ms Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter QFrame::StyledPanel QFrame::Raised 0 0 0 120 0 Inactive Timeslice 5000 10 500 Qt::Horizontal 0 0 40 0 100 ms Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter Debugging QFrame::NoFrame QFrame::Raised 0 0 Write Logfile Show Dialog on Crash QFrame::NoFrame QFrame::Raised 0 0 Filename debuglog.txt true ... QFrame::NoFrame QFrame::Raised 0 0 Loglevel 2 Qt::Horizontal Qt::Vertical 20 40 User Interface Workspace Save workspace on exit Save window on exit Lock Cloned Window Absolute view locks Show version in title Welcome screen at startup Invert MouseWheel ImageVis3D Mobile features Enable features which the developers are still testing to see if they are good ideas, intuitive, etc. Experimental Features Network Automatic update check Include Devbuilds Qt::Vertical 20 40 Renderer QFrame::StyledPanel QFrame::Raised 3 0 Render Method Slicing true 2D Slicing Raycasting Grid Leaper Render API OpenGL true true DirectX true Blend Precision 8 Bit true 16 Bit 32 Bit Compatibility Use only power of 2 textures Use only 8Bit volume textures Disable Border Color Background Select Top Color Text Select Color Select Bottom Color 0 0 255 Qt::Horizontal Logo No Logo Selected QFrame::StyledPanel QFrame::Raised 0 Select File None Top Left false Bottom Left Top Right Bottom Right true Switch back to the basic settings dialog. Basic Settings 1 0 Qt::Horizontal QDialogButtonBox::Cancel|QDialogButtonBox::Ok buttonBox accepted() SettingsDlg accept() 547 539 157 274 buttonBox rejected() SettingsDlg reject() 597 539 286 274 horizontalSlider_GPUMem valueChanged(int) label_GPUMem_Displ setNum(int) 397 81 616 81 horizontalSlider_CPUMem valueChanged(int) label_CPUMem_Displ setNum(int) 586 106 616 106 pushButtonSelBack1 clicked() SettingsDlg SelectBackColor1() 333 345 319 0 pushButtonSelBack2 clicked() SettingsDlg SelectBackColor2() 538 345 337 8 pushButtonSelText clicked() SettingsDlg SelectTextColor() 333 374 278 4 horizontalSliderTextOpacity valueChanged(int) SettingsDlg SetTextOpacity(int) 538 372 337 36 horizontalSlider_CPUMem valueChanged(int) SettingsDlg SetMaxMemCheck() 586 106 337 124 horizontalSlider_LODDelay valueChanged(int) SettingsDlg LODDelayChanged() 256 188 119 333 horizontalSlider_MinFramerate valueChanged(int) SettingsDlg MinFramerateChanged() 256 138 209 338 horizontalSlider_ActTS valueChanged(int) SettingsDlg ActTSChanged() 256 215 160 338 horizontalSlider_InactTS valueChanged(int) SettingsDlg InactTSChanged() 256 242 11 335 radioButton_TRaycast clicked() SettingsDlg WarnAPIMethodChange() 322 94 20 20 radioButton_Raycast clicked() SettingsDlg WarnAPIMethodChange() 238 94 35 378 radioButton_SBVR clicked() SettingsDlg WarnAPIMethodChange() 82 94 3 390 radioButton_APIGL clicked() SettingsDlg WarnAPIMethodChange() 445 94 92 374 radioButton_APIDX clicked(bool) SettingsDlg WarnAPIMethodChange() 593 94 337 375 checkBox_PowerOfTwo toggled(bool) SettingsDlg WarnAPIMethodChange() 127 254 159 435 pushButtonNoLogo clicked() SettingsDlg RemoveLogo() 119 485 26 439 pushButtonSelLogo clicked() SettingsDlg SelectLogo() 119 456 351 431 checkBox_DownSampleTo8Bits clicked() SettingsDlg WarnAPIMethodChange() 127 279 349 180 checkBox_DisableBorder clicked() SettingsDlg WarnAPIMethodChange() 436 254 354 227 toolButton clicked() SettingsDlg PickLogFile() 636 324 1 453 toolButton_FindTempDir clicked() SettingsDlg SelectTempDir() 636 318 358 265 radioButton_SBVR2D clicked() SettingsDlg WarnAPIMethodChange() 156 94 5 98 checkBox_OverrideMax toggled(bool) frame_ignoreMax setVisible(bool) 121 130 473 132 spinBox_GPUMax valueChanged(int) SettingsDlg MemMaxChanged() 222 132 490 197 spinBox_CPUMax valueChanged(int) SettingsDlg MemMaxChanged() 331 132 490 247 checkBox_OverrideMax toggled(bool) SettingsDlg OverrideMaxToggled(bool) 113 130 487 169 checkBox_ExperimentalFeatures toggled(bool) SettingsDlg ToggleExperimentalFeatures() 127 171 7 193 horizontalSlider_BSMax sliderMoved(int) SettingsDlg MaxBSChanged(int) 423 81 425 0 horizontalSlider_BSBuilder sliderMoved(int) SettingsDlg BuilderBSChanged(int) 298 106 516 16 btnBasic clicked() SettingsDlg SwitchToBasic() 65 528 334 275 horizontalSlider_CompressionLevel sliderMoved(int) SettingsDlg CompressionLevelChanged(int) 319 302 334 274 radioButton_noCompression toggled(bool) SettingsDlg CompressionChanged() 54 274 334 274 SelectBackColor1() SelectBackColor2() SelectTextColor() SetTextOpacity(int) SetMaxMemCheck() LODDelayChanged() MinFramerateChanged() ActTSChanged() InactTSChanged() WarnAPIMethodChange() RemoveLogo() SelectLogo() PickLogFile() SelectTempDir() MaxBSChanged(int) BuilderBSChanged(int) MemMaxChanged() OverrideMaxToggled(bool) ToggleExperimentalFeatures() SwitchToBasic() CompressionLevelChanged(int) CompressionChanged() ImageVis3D-3.1.0/ImageVis3D/UI/UI/CrashDetDlg.ui0000644000175000017500000000506012320517543020473 0ustar mathieumathieu CrashDetDlg Qt::WindowModal 0 0 523 159 Crash Recovery true true Either ImageVis3D crashed or it is currently running in a second process. If it crashed do you want to submit the logfile? Qt::AlignJustify|Qt::AlignVCenter true Qt::Vertical 20 1 Do not show this dialog again (can be changed in the preferences) Qt::Horizontal QDialogButtonBox::No|QDialogButtonBox::Yes buttonBox accepted() CrashDetDlg accept() 248 254 157 274 buttonBox rejected() CrashDetDlg reject() 316 260 286 274 ImageVis3D-3.1.0/ImageVis3D/UI/UI/ImageVis3D.ui0000644000175000017500000067057512320517543020265 0ustar mathieumathieu MainWindow 0 0 1621 2148 0 0 false ImageVis3D Qt::ToolButtonIconOnly true QMainWindow::AllowNestedDocks|QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks|QMainWindow::VerticalTabs 0 0 1621 25 &File Most Recently Used true &View Workspace Most Recently Used Workspaces &Help true Edit 209 214 Recorder 1 6 9 0 0 0 0 16777215 16777215 Filename false 0 QFrame::NoFrame QFrame::Plain 0 5 0 0 23 To change the filename, filetype and location of the captured images, please press the "..." button to the left of this fied. To change the filename, filetype and location of the captured images, please press the "..." button to the left of this fied. capture.png true Click on this button to change the filename, filetype and location of the captured images. Click on this button to change the filename, filetype and location of the captured images. Click on this button to change the filename, filetype and location of the captured images. ... Preserve Transparency true QFrame::NoFrame QFrame::Plain 0 5 0 0 23 Capture a single image with the filename specified above. Capture a single image with the filename specified above. Single 0 23 To capture multiple images press this button. This will create a new with the filename specified above appending an increasing number. To capture multiple images press this button. This will create a new with the filename specified above appending an increasing number. Sequence 0 0 Full Rotation 6 9 0 23 Automatically record a 360 degree rotation of the current view. Automatically record a 360 degree rotation of the current view. Capture Qt::Vertical 20 40 475 465 Dataset Explorer 2 6 9 QFrame::NoFrame QFrame::Raised 0 0 Name of the dataset true 110 23 Display Global Metdata QFrame::NoFrame QFrame::Raised 0 0 Separate Components in the Dataset Qt::Horizontal 40 20 Add Mesh 0 0 0 0 QFrame::Box QFrame::Sunken 1 0 0 9 9 9 16777215 16777215 LOD Level for current view 16777215 16777215 Maximum size for current view 16777215 16777215 Maximum size of dataset true 16777215 16777215 Overall LOD Levels true true true Qt::Vertical 20 40 0 0 9 Polygons true Vertices true Texture Coordinates Colors true true Normals true 0 25 Enabled true 0 23 Edit Transformation 0 18 QFrame::NoFrame QFrame::Plain 0 0 0 0 0 23 Set Default Color Opacity: 100 100 Qt::Horizontal 0 0 0 25 QFrame::NoFrame QFrame::Raised 0 0 0 0 0 23 Export Mesh 0 0 0 23 Remove Mesh 0 0 314 283 Lighting 1 0 0 QFrame::StyledPanel QFrame::Raised 0 0 0 QFrame::NoFrame QFrame::Plain 0 0 150 150 150 150 QFrame::NoFrame QFrame::Plain 0 Qt::Vertical 0 0 QFrame::NoFrame QFrame::Plain 0 QFrame::NoFrame QFrame::Plain 0 0 Intensity Qt::Horizontal 0 23 Ambient Color QFrame::NoFrame QFrame::Plain 0 0 Intensity Qt::Horizontal 0 23 Diffuse Color QFrame::NoFrame QFrame::Plain 0 0 Intensity Qt::Horizontal 0 23 Highlight Color Qt::Vertical 0 0 0 0 QFrame::NoFrame QFrame::Plain 0 0 Compute per-voxel lighting Enable Lighting 1D Transfer Function Editor 8 0 0 QFrame::NoFrame QFrame::Plain 0 0 0 0 6 true 146 18 Use 1D Transfer Function true QFrame::NoFrame QFrame::Plain 0 0 Color Components 5 8 0 18 Red true 0 18 Green true 0 18 Blue true 0 18 Alpha true 0 23 Invert Groups 5 8 0 18 User false 0 18 Luminance false 0 18 Intensity true 0 23 Copy to 2D Transfer Function 0 0 75 true 1D Transfer Function Enabled Qt::Vertical 20 40 0 0 200 20 QFrame::NoFrame QFrame::Plain 0 0 0 0 0 QFrame::StyledPanel QFrame::Raised 0 25 Load 0 25 Save Qt::Horizontal 40 20 0 25 Save To Library 0 25 0 25 = 0 25 + 0 25 - 0 25 Select Transfer Function Libary Location Select Transfer Function Libary Location ... 20 0 20 16777215 2000 100 Qt::Vertical 0 0 1135 517 QDockWidget::AllDockWidgetFeatures 2D Transfer Function Editor 8 0 0 QFrame::NoFrame QFrame::Raised 0 0 0 0 QFrame::NoFrame QFrame::Raised 3 3 3 0 6 0 0 QFrame::NoFrame QFrame::Plain 0 0 0 0 0 18 Use 2D Transfer Function false 0 18 75 true Qt::Horizontal 40 20 Collapse the polygon selcetion part of the 2D transfer function. Collapse the polygon selcetion part of the 2D transfer function. Collapse the polygon selcetion part of the 2D transfer function. < 0 0 Polygons false 0 0 QFrame::NoFrame QFrame::Plain 0 0 0 0 0 100 0 QFrame::NoFrame QFrame::Raised 0 0 0 0 150 16777215 Select the current polygon here. Select the current polygon here. 0 0 QFrame::StyledPanel QFrame::Raised 0 0 0 0 23 Add a new quad to the 2D transfer function. Add a new quad to the 2D transfer function. Add Quad 0 0 0 23 Add a new circle to the 2D transfer function. Add a new circle to the 2D transfer function. Add Circle false 0 0 0 23 Delete the currrent polygonfrom the 2D transfer function. Delete the currrent polygonfrom the 2D transfer function. Delete false 0 0 0 23 Move the current polygon up in the the blending order. Move the current polygon up in the the blending order. Up false 0 0 0 23 Move the current polygon down in the the blending order. Move the current polygon down in the the blending order. Down Qt::Vertical 20 40 0 0 QFrame::NoFrame QFrame::Raised 0 0 0 0 QFrame::NoFrame QFrame::Raised 0 0 false 0 0 16777215 20 Gradient Qt::Horizontal 40 20 Linear true Radial 0 1 16777215 60 QFrame::NoFrame QFrame::Raised 0 0 0 0 150 16777215 0 0 16777215 16777215 QFrame::NoFrame QFrame::Raised 0 0 0 0 0 23 Add false 0 0 0 23 Delete Qt::Vertical 20 40 false 0 0 QFrame::NoFrame QFrame::Raised 0 0 0 23 Choose Color 0 0 0 23 Opacity: horizontalSlider_Opacity 0 0 100 80 Qt::Horizontal 0 0 QFrame::NoFrame QFrame::Raised 0 0 0 0 0 23 Load 0 0 0 23 Save 0 0 0 23 Basic Mode true 0 0 QFrame::NoFrame QFrame::Plain 0 0 3 3 0 0 Expand the polygon selcetion part of the 2D transfer function. Expand the polygon selcetion part of the 2D transfer function. Expand the polygon selcetion part of the 2D transfer function. > Qt::Vertical 0 350 0 0 QFrame::NoFrame QFrame::Raised 0 0 0 0 2D histogram. The X axis represents your data; Y axis represents the magnitude of the gradient in your data; the opacity represents how often that combination appears in your data. QFrame::NoFrame QFrame::Raised 0 9 0 0 0 QFrame::NoFrame QFrame::Raised 0 0 0 0 QFrame::NoFrame QFrame::Raised 0 0 120 23 New "Triangle" 120 23 New Rectangle 120 23 Delete Qt::Horizontal 40 20 0 0 QFrame::NoFrame QFrame::Raised 0 0 100 23 Choose Color Opacity horizontalSlider_Opacity_SimpleUI 100 80 Qt::Horizontal Qt::Horizontal 40 20 0 0 QFrame::NoFrame QFrame::Raised 0 0 QFrame::NoFrame QFrame::Raised 0 0 0 23 Load 0 23 Save 0 23 Expert Mode 75 true 2D Transfer Function Enabled Use 2D Transfer Function Qt::Horizontal 40 20 0 0 20 0 20 16777215 2000 500 Qt::Vertical 436 503 Rendering Options 2 Rescale 9 0 0 4 0.001000000000000 0.100000000000000 1.000000000000000 0 0 4 0.001000000000000 0.100000000000000 1.000000000000000 0 0 4 0.001000000000000 0.100000000000000 1.000000000000000 Save To File Render Mode 3 9 QFrame::NoFrame QFrame::Raised 0 3 0 QFrame::NoFrame QFrame::Plain 0 3 0 0 18 Use 1D transfer functions [1] Use 1D transfer functions [1] 1D Transfer Function 1 true 0 18 Use 2D transfer functions [2] Use 2D transfer functions [2] 2D Transfer Function 2 0 18 Use Isosurfacing [3] Use Isosurfacing [3] Isosurface Rendering 3 QFrame::NoFrame QFrame::Plain 0 2 0 Show 1D transfer function editor. Show 1D transfer function editor. Show 1D transfer function editor. ... Show 2D transfer function editor. Show 2D transfer function editor. Show 2D transfer function editor. ... Show isosurface editor. Show isosurface editor. Show isosurface editor. ... Qt::Horizontal 40 20 Execution 3 8 All changes to the transfer functions are continously committed to the volume. All changes to the transfer functions are continously committed to the volume. Continuous true Changes to the transfer function affect the volume only on mouse release. Select this option if the continous mode is too slow in your machine. Changes to the transfer function affect the volume only on mouse release. Select this option if the continous mode is to slow in your machine. On Release Only upon pressing the "Apply" button below are changes committed to the volume. Select this option of even in "On Release" mode the update is to slow in your machine. Only upon pressing the "Apply" button below are changes committed to the volume. Select this option of even in "On Release" mode the update is to slow in your machine. Manual false 0 23 Apply changes to the transfer function. Only enabled in Manual mode. Apply changes to the transfer function. Only enabled in Manual mode. Apply Render Settings 6 QFrame::NoFrame QFrame::Plain 0 0 Tag Volume QFrame::NoFrame QFrame::Plain 0 0 Display per-brick bounding boxes. Local Bounding Box Display the bounding box of the dataset Global Bounding Box QFrame::NoFrame QFrame::Plain 0 Sampling Rate (100%): Sampling rate. Lower for increased performance. Raise to generate high-quality images. 1 400 100 Qt::Horizontal Field of View (50°): Field of View. Specify the angle/field of view of the virtual camera. 1 179 50 Qt::Horizontal Clip Plane 6 Enables a clip plane Clips the data along a mouse-controlled plane. Hold control to change clip plane settings. Enable Display a widget detailing the location and orientation of the clip plane Show Rotate the clip plane when rotating the dataset. Lock to Object true false Crop Data Qt::Vertical 20 40 Locking Options 1 75 false true false false true TextLabel true Modality 6 9 View Transformation true Render Mode Tools Filters true QAbstractItemView::MultiSelection Isosurface Settings 2 QFrame::StyledPanel QFrame::Raised 0 0 18 Switch to the isosurface rendering mode. Use Isosurface Rendering 75 true Isosurface Enabled Qt::Horizontal 40 20 0 23 Export as Mesh false QFrame::NoFrame QFrame::Raised 0 0 3 0 3 QFrame::NoFrame QFrame::Plain 0 0 0 19 Qt::Horizontal 0 19 0/255 0 0 Choose Color QFrame::NoFrame QFrame::Raised 0 0 0 19 ClearView 75 true false QFrame::NoFrame QFrame::Plain 0 0 0 19 Focus Isovalue QFrame::NoFrame QFrame::Plain 0 0 0 19 Qt::Horizontal 0 19 0/255 0 0 Choose Focus Color Focus Size 0 19 Radius of the ClearView lens Qt::Horizontal Context Scale 0 19 Controls the amount of information retained in the context isosurface Qt::Horizontal Border 0 19 Qt::Horizontal Qt::Vertical 20 40 481 197 false Debug Window 1 QFrame::NoFrame QFrame::Raised 0 0 0 Errors true 0 0 Warnings true 0 0 Messages true 0 0 Other true 0 23 0 23 Click here to clear the output window. Click here to clear the output window. Click here to clear the output window. Clear Qt::Horizontal 40 20 Progress Viewer 1 2 This panel shows the progress of rendering operations for the active window. Currently nothing of that kind is active so you only see this text. Qt::PlainText false Qt::AlignJustify|Qt::AlignVCenter true false false 6 6 QFrame::NoFrame QFrame::Raised 0 0 Qt::Horizontal 40 20 LOD Progress Qt::AlignCenter Qt::Horizontal 0 0 24 Qt::AlignCenter QFrame::NoFrame QFrame::Raised 0 Qt::Horizontal 0 0 Brick Progress Qt::AlignCenter Qt::Horizontal 0 0 24 Qt::AlignCenter %p% QFrame::NoFrame QFrame::Plain Limit Maximum Quality by not rendering the highest 0 levels true Qt::Horizontal QFrame::NoFrame QFrame::Plain 0 Limit Minimum Quality by skipping the lowest 0 levels true Qt::Horizontal Qt::Vertical 0 0 false Stereo 2 2 QFrame::StyledPanel QFrame::Raised 0 Toggle the anaglyph stereo rendering. This option is only avaliable in single window 3D view. Toggle the anaglyph stereo rendering. This option is only avaliable in single window 3D view. Enable Stereo Rendering Swap Left/Right Eye Select the distance between your virtual eyes in stereo mode. Higher values increase the depth effect but are more likely to cause headaches after a while. Select the distance between your virtual eyes in stereo mode. Higher values increase the depth effect but are more likely to cause headaches after a while. Eye Distance Select the distance between your virtual eyes in stereo mode. Higher values increase the depth effect but are more likely to cause headaches after a while. Select the distance between your virtual eyes in stereo mode. Higher values increase the depth effect but are more likely to cause headaches after a while. 1 20 20 Qt::Horizontal Use the focal length to specify where your monitor is in the virtual 3D world. Larger values wil bring the volume in front of the screen, while smaller values while make it apear behind. While the first effect usualy looks more spectacular it is also more likely to cause headaches after a while. Use the focal length to specify where your monitor is in the virtual 3D world. Larger values wil bring the volume in front of the screen, while smaller values while make it apear behind. While the first effect usualy looks more spectacular it is also more likely to cause headaches after a while. Focal Length Use the focal length to specify where your monitor is in the virtual 3D world. Larger values wil bring the volume in front of the screen, while smaller values while make it apear behind. While the first effect usualy looks more spectacular it is also more likely to cause headaches after a while. Use the focal length to specify where your monitor is in the virtual 3D world. Larger values wil bring the volume in front of the screen, while smaller values while make it apear behind. While the first effect usualy looks more spectacular it is also more likely to cause headaches after a while. 1 50 50 Qt::Horizontal QFrame::StyledPanel QFrame::Raised 0 Red/Blue Anaglyph true Scan Line Side by Side Alternating Frame Qt::Vertical 20 40 Timestep Selector 1 Qt::Horizontal 0/0 Load Dataset from File Ctrl+O false Export Dataset Ctrl+E Quit Ctrl+Q 2 x 2 View Ctrl+V, Ctrl+2 Single View Ctrl+V, Ctrl+1 Box Select Poly Line Select Select All Delete Selection Invert Selection Stastistcs on Selection Undo Redo Go Fullscreen Ctrl+Shift+F About Ctrl+A Open Online Help Ctrl+H Clear List Clone View Ctrl+C Cascade Ctrl+Shift+C Tile Ctrl+Shift+T Next View Ctrl+Shift+N Previous View Ctrl+Shift+P Load Workspace Ctrl+Alt+L Save Workspace Ctrl+Alt+S Reset Workspace Ctrl+Alt+R Load Dataset from Directory Ctrl+D Load Window Geometry Ctrl+Shift+L Save Window Geometry Ctrl+Shift+S Settings Ctrl+S Check for Updates Ctrl+U Open Online Video Tutorials Ctrl+T Welcome Screen Ctrl+Alt+W Report an Issue Ctrl+I true Clip Plane Enable a clip plane to slice through the dataset Enables a clip plane Save Default Workspace Save Default Ctrl+Shift+D Merge Datasets Ctrl+M Open Local Manual Ctrl+M Clear List false Transfer to ImageVis3D Mobile Device Ctrl+Shift+E true false Add Geometry to this Data Set false Export Image Stack pushButton_7 checkBox_Red checkBox_Green checkBox_Blue checkBox_Alpha radioButton_User radioButton_Luminance radioButton_Intensity horizontalSlider_Opacity actionQuit triggered() MainWindow close() -1 -1 480 415 action2_x_2_View triggered() MainWindow ToggleRenderWindowView2x2() -1 -1 480 415 actionSinge_View triggered() MainWindow ToggleRenderWindowViewSingle() -1 -1 480 415 actionLoadDataset triggered() MainWindow LoadDataset() -1 -1 564 492 actionCloneCurrentView triggered() MainWindow CloneCurrentView() -1 -1 564 492 actionCascade triggered() mdiArea cascadeSubWindows() -1 -1 972 661 actionTile triggered() mdiArea tileSubWindows() -1 -1 972 661 actionNext triggered() mdiArea activateNextSubWindow() -1 -1 972 661 actionPrevious triggered() mdiArea activatePreviousSubWindow() -1 -1 972 661 actionLoad_Workspace triggered() MainWindow LoadWorkspace() -1 -1 595 525 actionSave_Workspace triggered() MainWindow SaveWorkspace() -1 -1 595 525 actionReset_Workspace triggered() MainWindow ApplyWorkspace() -1 -1 595 525 actionLoad_Window_Geometry triggered() MainWindow LoadGeometry() -1 -1 595 580 actionSave_Window_Geometry triggered() MainWindow SaveGeometry() -1 -1 595 580 checkBox_Use1DTrans clicked() MainWindow Use1DTrans() 154 1425 601 532 checkBox_Use2DTrans clicked() MainWindow Use2DTrans() 641 1410 601 532 actionLoad_Dataset_from_Directory triggered() MainWindow LoadDirectory() -1 -1 601 524 actionClear_List triggered() MainWindow ClearMRUList() -1 -1 601 524 mdiArea subWindowActivated(QMdiSubWindow*) MainWindow UpdateMenus() 972 415 601 524 actionExport_Dataset triggered() MainWindow ExportDataset() -1 -1 601 524 pushButton_Load1DTrans clicked() MainWindow Transfer1DLoad() 217 1639 601 524 pushButton_Save1DTrans clicked() MainWindow Transfer1DSave() 252 1639 601 524 pushButton_Load2DTrans clicked() MainWindow Transfer2DLoad() 572 1859 601 524 pushButton_Save2DTrans clicked() MainWindow Transfer2DSave() 653 1859 601 524 checkBox_UseIso clicked() MainWindow UseIso() 1304 889 601 602 radioButton_1DTrans clicked() MainWindow Use1DTrans() 1292 566 601 602 radioButton_2DTrans clicked() MainWindow Use2DTrans() 1292 601 601 602 radioButton_Iso clicked() MainWindow UseIso() 1292 636 601 602 checkBox_Red clicked() MainWindow Transfer1DSetColors() 163 1471 601 729 checkBox_Green clicked() MainWindow Transfer1DSetColors() 163 1494 601 729 checkBox_Blue clicked() MainWindow Transfer1DSetColors() 163 1517 601 729 checkBox_Alpha clicked() MainWindow Transfer1DSetColors() 163 1540 601 729 radioButton_Intensity clicked() MainWindow Transfer1DSetGroups() 163 1641 601 729 radioButton_Luminance clicked() MainWindow Transfer1DSetGroups() 163 1618 601 729 pushButton_ClearDebug clicked() MainWindow ClearDebugWin() 357 807 601 803 checkBox_ShowDebugErrors clicked() MainWindow SetDebugViewMask() 69 807 601 803 checkBox_ShowDebugMessages clicked() MainWindow SetDebugViewMask() 219 807 601 803 checkBox_ShowDebugWarnings clicked() MainWindow SetDebugViewMask() 143 807 601 803 checkBox_ShowDebugOther clicked() MainWindow SetDebugViewMask() 276 807 601 803 pushButton_CopyTo2D clicked() MainWindow Transfer1DCopyTo2DTrans() 154 1679 601 813 checkBox_Use1DTrans toggled(bool) frame_1DTransEdit setEnabled(bool) 154 1425 154 1642 pushButton_AddStop clicked() MainWindow Transfer2DAddGradient() 728 1770 601 926 pushButton_DelStop clicked() MainWindow Transfer2DDeleteGradient() 728 1799 601 926 checkBox_Use2DTrans clicked() MainWindow Transfer2DUpdateGradientBox() 641 1410 601 926 pushButton_ColorChooser clicked() MainWindow Transfer2DChooseGradientColor() 572 1836 601 926 horizontalSlider_Opacity actionTriggered(int) MainWindow Transfer2DChooseGradientOpacity() 728 1834 601 926 horizontalSlider_FoV valueChanged(int) MainWindow SetFoV(int) 1297 896 1142 902 pushButton_ApplyUpdate clicked() MainWindow ApplyUpdate() 1592 639 687 1014 radioButton_UpdateContinuous clicked() MainWindow SetUpdateMode() 1592 573 685 1058 radioButton_UpdateOnRelease clicked() MainWindow SetUpdateMode() 1592 593 683 1096 radioButton_UpdateManual clicked() MainWindow SetUpdateMode() 1592 613 680 1136 radioButton_User clicked() MainWindow Transfer1DSetGroups() 163 1595 415 1262 actionSettings triggered() MainWindow ShowSettings() -1 -1 601 982 checkBox_Lighting clicked(bool) MainWindow SetLighting(bool) 366 270 390 1320 checkBox_Use2DTrans toggled(bool) frame_2DTransEdit setEnabled(bool) 641 1410 734 1822 horizontalSlider_Sampling valueChanged(int) MainWindow SetSampleRate(int) 1585 739 389 1381 horizontalSlider_Isovalue valueChanged(int) MainWindow SetIsoValue(int) 1577 915 390 1184 checkBox_UseIso toggled(bool) frame_IsosurfaceEdit setEnabled(bool) 1304 889 1611 1130 checkBox_GBBox toggled(bool) MainWindow ToggleGlobalBBox(bool) 1594 686 990 1448 checkBox_LBBox toggled(bool) MainWindow ToggleLocalBBox(bool) 1354 692 989 1361 pushButton_5 clicked() MainWindow CaptureFrame() 185 140 998 82 pushButton_6 clicked() MainWindow CaptureSequence() 365 140 999 133 pushButton_7 clicked() MainWindow CaptureRotation() 356 193 997 202 doubleSpinBox_RescaleX valueChanged(double) MainWindow SetRescaleFactors() 1264 495 1008 593 doubleSpinBox_RescaleY valueChanged(double) MainWindow SetRescaleFactors() 1386 495 1005 556 doubleSpinBox_RescaleZ valueChanged(double) MainWindow SetRescaleFactors() 1525 495 1007 522 actionAbout triggered() MainWindow ShowAbout() -1 -1 601 873 checkBox_ClearView toggled(bool) MainWindow ToggleClearView() 1611 963 1000 1051 horizontalSlider_CVFocusIsoValue valueChanged(int) MainWindow SetFocusIsoValue(int) 1577 1007 1000 1107 horizontalSlider_CVFocusSize valueChanged(int) MainWindow SetFocusSize(int) 1611 1076 1003 1201 horizontalSlider_CVContextScale valueChanged(int) MainWindow SetContextScale(int) 1611 1120 1004 1241 horizontalSlider_CVBorder valueChanged(int) MainWindow SetBorderSize(int) 1611 1164 1000 1277 radioButton_ViewLock clicked() MainWindow LockModalityChange() 171 561 384 909 radioButton_RenderModeLock clicked() MainWindow LockModalityChange() 356 584 386 952 radioButton_FiltersLock clicked() MainWindow LockModalityChange() 335 630 386 1047 radioButton_ToolsLock clicked() MainWindow LockModalityChange() 356 607 382 997 listWidget_Lock itemSelectionChanged() MainWindow ChangeLocks() 105 719 385 1142 checkBox_Stereo clicked() MainWindow ToggleStereoRendering() 1354 1234 388 1471 horizontalSlider_EyeDistance valueChanged(int) MainWindow SetStereoEyeDistance() 1618 1273 386 1524 horizontalSlider_FocalLength valueChanged(int) MainWindow SetStereoFocalLength() 1618 1317 383 1562 actionCheck_for_Updates triggered() MainWindow CheckForUpdates() -1 -1 601 1013 toolButton_selectCaptureFilename clicked() MainWindow SetCaptureFilename() 411 86 958 105 toolButton_Open1DTrans clicked() MainWindow Show1DTrans() 1373 573 959 690 toolButton_Open2DTrans clicked() MainWindow Show2DTrans() 1373 607 957 738 toolButton_OpenIso clicked() MainWindow ShowIsoEdit() 1373 641 958 791 toolButton_Collapse2D clicked() MainWindow Collapse2DWidgets() 734 1410 671 1582 toolButton clicked() MainWindow Expand2DWidgets() 764 1410 896 1563 toolButton_SelColorIso1 clicked() MainWindow ChooseIsoColor() 1611 940 959 966 toolButton_SelColorIso2 clicked() MainWindow ChooseFocusColor() 1611 1032 956 1075 checkBox_PreserveTransparency clicked() MainWindow PreserveTransparencyChanged() 365 111 953 159 actionGo_Fullscreen triggered() MainWindow ToggleFullscreen() -1 -1 646 965 actionOpen_Online_Help triggered() MainWindow OnlineHelp() -1 -1 646 965 actionOpen_Online_Video_Tutorials triggered() MainWindow OnlineVideoTut() -1 -1 646 965 actionWelcome_Screen triggered() MainWindow ShowWelcomeScreen() -1 -1 646 965 actionReport_an_Issue triggered() MainWindow ReportABug() -1 -1 646 965 actionSave_DefaultWorkspace triggered() MainWindow SaveDefaultWorkspace() -1 -1 520 1074 actionSave_DefaultGeometry triggered() MainWindow SaveDefaultGeometry() -1 -1 520 1074 checkBox_ClipPlane toggled(bool) MainWindow ToggleClipPlane(bool) 1292 801 520 1078 actionMerge_Data_Sets triggered() MainWindow MergeDatasets() -1 -1 520 1078 checkBox_ClipShow clicked(bool) MainWindow ClipToggleShow(bool) 1433 801 717 949 checkBox_ClipLockObject clicked(bool) MainWindow ClipToggleLock(bool) 1594 795 715 1032 radioButton_linGrad clicked() MainWindow Transfer2DToggleGradientType() 670 1739 535 1863 radioButton_radGrad clicked() MainWindow Transfer2DToggleGradientType() 728 1739 535 1863 actionOpen_Local_Manual triggered() MainWindow OpenManual() -1 -1 582 1160 pushButton_ToggleBasic clicked() MainWindow Transfer2DToggleTFMode() 734 1859 603 1774 actionClear_WS_MRU_List triggered() MainWindow ClearWSMRUList() -1 -1 582 1160 pushButton_9 clicked() MainWindow Transfer2DLoad() 845 1865 588 1807 pushButton_2 clicked() MainWindow Transfer2DSave() 926 1865 731 1807 pushButton_ExpertMode clicked() MainWindow Transfer2DToggleTFMode() 1007 1865 774 1785 pushButton_ColorChooser_SimpleUI clicked() MainWindow Transfer2DChooseGradientColorSimpleUI() 870 1836 880 1815 horizontalSlider_Opacity_SimpleUI valueChanged(int) MainWindow Transfer2DChooseGradientOpacitySimpleUI() 1249 1834 779 1773 checkBox_Use2DTrans_SimpleUI clicked() MainWindow Use2DTrans() 1327 1862 1015 1863 actionTransfer_to_ImageVis3D_Mobile_Device triggered() MainWindow TransferToI3M() -1 -1 726 1198 pushButton_ShowMetadata clicked() MainWindow DisplayMetadata() 1611 100 1063 439 toolButton_SaveAspectRatio clicked() MainWindow SaveAspectRatioToUVF() 1601 494 1023 756 horizontalSlider_minLODLimit valueChanged(int) MainWindow MinLODLimitChanged() 373 1228 1027 1863 horizontalSlider_maxLODLimit valueChanged(int) MainWindow MaxLODLimitChanged() 373 1166 1024 1831 horizontalSlider_ambientIntensity valueChanged(int) MainWindow ChangeLightColors() 356 305 470 650 horizontalSlider_diffuseIntensity valueChanged(int) MainWindow ChangeLightColors() 356 359 470 711 horizontalSlider_specularIntensity valueChanged(int) MainWindow ChangeLightColors() 356 413 468 769 pushButton_ambientColor clicked() MainWindow PickLightColor() 356 334 468 681 pushButton_diffuseColor clicked() MainWindow PickLightColor() 356 388 468 742 pushButton_specularColor clicked() MainWindow PickLightColor() 356 442 468 797 pushButton_11 clicked() MainWindow Transfer1DAddToLib() 293 1639 0 1863 toolButton_1DTF_LibSet clicked() MainWindow Transfer1DSetFromLib() 355 1639 0 1863 toolButton_1DTF_LibAdd clicked() MainWindow Transfer1DAddFromLib() 382 1639 0 1863 toolButton_1DTF_LibSub clicked() MainWindow Transfer1DSubFromLib() 405 1639 0 1863 toolButton_LibLocation clicked() MainWindow Transfer1DConfigureLib() 436 1639 0 1845 checkBox_Use1DTrans toggled(bool) frame_LoadSave1DTF setEnabled(bool) 90 1425 446 1612 hSlider_Timestep valueChanged(int) MainWindow SetTimestep(int) 390 1343 774 122 checkBox_EyeSwap clicked() MainWindow ToggleStereoEyeSwap() 1617 1228 384 1800 radioButton_RBStereo toggled(bool) MainWindow ToggleStereoMode() 1284 1347 383 1863 radioButton_ScanlineStereo toggled(bool) MainWindow ToggleStereoMode() 1442 1347 384 1863 radioButton_SideBySide toggled(bool) MainWindow ToggleStereoMode() 1442 1347 384 1863 actionAdd_Geometry_to_Data_Set triggered() MainWindow AddGeometry() -1 -1 810 1295 listWidget_DatasetComponents currentRowChanged(int) MainWindow UpdateExplorerView() 1268 174 1190 182 checkBox_ComponenEnable clicked() MainWindow ToggleMesh() 1264 237 1197 65 toolButton_MeshDefColor clicked() MainWindow SetMeshDefColor() 1345 388 1198 278 horizontalSlider_MeshDefOpacity valueChanged(int) MainWindow SetMeshDefOpacity() 1601 400 1200 248 toolButton_ScaleAndBias clicked() MainWindow SetMeshScaleAndBias() 1247 400 1193 338 toolButton_AddMesh clicked() MainWindow AddGeometry() 1566 115 1198 126 toolButton_RemoveMesh clicked() MainWindow RemoveGeometry() 1519 232 1198 160 toolButton_ExportMesh clicked() MainWindow ExportGeometry() 1374 226 1199 229 toolButton_ExpIsoToMesh clicked() MainWindow ExportIsosurface() 1548 886 1142 845 actionExport_Image_Stack triggered() MainWindow ExportImageStack() -1 -1 810 950 checkBox_TagVolume toggled(bool) MainWindow SetTagVolume() 1244 688 1195 512 pushButton_invert1DTransComp clicked() MainWindow Invert1DTransComp() 20 20 20 20 toolButton_CropData clicked() MainWindow CropData() 1553 817 1192 784 HideVisualizationWindows() LoadDataset() ToggleRenderWindowView2x2() ToggleRenderWindowViewSingle() CloneCurrentView() LoadWorkspace() SaveWorkspace() ApplyWorkspace() LoadDirectory() LoadGeometry() SaveGeometry() Use1DTrans() Use2DTrans() ClearMRUList() UpdateMenus() ExportDataset() UseIso() ClearDebugWin() SetDebugViewMask() Transfer1DSetColors() Transfer1DSetGroups() SetUpdateMode() ApplyUpdate() Transfer1DSave() Transfer1DLoad() Transfer1DCopyTo2DTrans() Transfer2DAddGradient() Transfer2DDeleteGradient() Transfer2DChooseGradientColor() Transfer2DChooseGradientOpacity() SetFoV() Transfer2DUpdateGradientBox() Transfer2DSave() Transfer2DLoad() FilterImage() ShowSettings() SetLighting(bool) Collapse2DWidgets() Expand2DWidgets() SetSampleRate(int) SetIsoValue(int) ToggleClipPlane(bool) ToggleGlobalBBox(bool) ToggleLocalBBox(bool) CaptureFrame() CaptureSequence() SetCaptureFilename() CaptureRotation() SetRescaleFactors() ShowAbout() ChooseIsoColor() ToggleClearView() SetFocusIsoValue(int) ChooseFocusColor() SetFocusSize(int) SetContextScale(int) SetBorderSize(int) LockModalityChange() ChangeLocks() ToggleStereoRendering() SetStereoEyeDistance() SetStereoFocalLength() Show1DTrans() Show2DTrans() ShowIsoEdit() CheckForUpdates() PreserveTransparencyChanged() UploadLogToServer() ToggleFullscreen() OnlineHelp() OnlineVideoTut() ShowWelcomeScreen() ReportABug() ExportGeometry() SaveDefaultWorkspace() SaveDefaultGeometry() MergeDatasets() ClipToggleShow(bool) ClipToggleLock(bool) Transfer2DToggleGradientType() OpenManual() Transfer2DToggleTFMode() ClearWSMRUList() Transfer2DChooseGradientOpacitySimpleUI() Transfer2DChooseGradientColorSimpleUI() TransferToI3M() DisplayMetadata() SaveAspectRatioToUVF() MinLODLimitChanged() MaxLODLimitChanged() ChangeLightColors() PickLightColor() Transfer1DAddToLib() Transfer1DSetFromLib() Transfer1DAddFromLib() Transfer1DSubFromLib() Transfer1DConfigureLib() SetTimestep(int) ToggleStereoEyeSwap() ToggleStereoMode() AddGeometry() UpdateExplorerView() ToggleMesh() SetMeshDefColor() SetMeshDefOpacity() SetMeshScaleAndBias() RemoveGeometry() ExportIsosurface() ExportImageStack() SetTagVolume() CropData() Invert1DTransComp() ImageVis3D-3.1.0/ImageVis3D/UI/UI/Welcome.ui0000644000175000017500000002553412320517543017752 0ustar mathieumathieu Welcome Qt::WindowModal 0 0 582 587 0 0 Welcome To ImageVis3D false true 0 150 16777215 150 30 Welcome To ImageVis3D Qt::AlignCenter QFrame::NoFrame QFrame::Plain 0 0 Open a File 0 23 Open Data Set from File false 0 23 Open Data Set from a Directory false Qt::Vertical 20 180 Get Help Open Local Manual 0 23 Goto Online Help false 0 23 Goto Online Video Tutorials false Download Example Data Sets Qt::Vertical 20 40 0 23 Check for new Version false QFrame::NoFrame QFrame::Plain 0 0 Do not show this welcome screen at startup (can also be changed in the preferences) Qt::Horizontal 40 20 0 23 Close false true pushButton_CheckForNewVersion clicked() Welcome CheckUpdates() 502 418 581 400 pushButton_OnlineVideoTutorials clicked() Welcome OnlineVideoTut() 562 271 581 205 pushButton_GotoOnlineHelp clicked() Welcome OnlineHelp() 562 242 581 81 pushButton_OpenFromDirectoy clicked() Welcome OpenFromDir() 251 240 581 236 pushButton_OpenFromFile clicked() Welcome OpenFromFile() 246 211 379 442 pushButton_Close clicked() Welcome accept() 572 467 465 475 pushButton_manual clicked() Welcome OpenManual() 495 206 586 156 pushButton_ExampleData clicked() Welcome GetExampleData() 417 289 581 342 CheckUpdatesClicked() OnlineHelpClicked() OnlineVideoTutClicked() OpenFromFileClicked() OpenFromDirClicked() GetExampleDataClicked() CheckUpdates() OnlineHelp() OnlineVideoTut() OpenFromFile() OpenFromDir() OpenManual() GetExampleData() ImageVis3D-3.1.0/ImageVis3D/UI/UI/BugRepDlg.ui0000644000175000017500000002655712320517543020200 0ustar mathieumathieu BugRepDlg Qt::ApplicationModal 0 0 820 847 Issue Report Dialog true 20 The First "Computer Bug" Moth found trapped between points at Relay # 70, Panel F, of the Mark II Aiken Relay Calculator while it was being tested at Harvard University, 9 September 1945. The operators affixed the moth to the computer log, with the entry: "First actual case of bug being found". They put out the word that they had "debugged" the machine, thus introducing the term "debugging a computer program". In 1988, the log, with the moth still taped by the entry, was in the Naval Surface Warfare Center Computer Museum at Dahlgren, Virginia. Icon Qt::AlignCenter Basic Information <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><span style=" font-weight:600;">Please describe your issue with ImageVis3D here.</span> The more specific you are the better. <span style=" font-style:italic;">Optimally, you should give a list of steps to reproduce your problem.</span></p></body></html> true Additional Information QFrame::NoFrame QFrame::Plain 0 0 Submit System Information Submit Debug Log Submit data files QFrame::NoFrame QFrame::Raised 0 0 QFrame::NoFrame QFrame::Plain 0 0 Add Files false Remove File Qt::Vertical 20 40 Personal Information <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; font-weight:600;">Sending Personal information is entirely optional</span><span style=" font-size:8pt;">. However, we encourage you to submit you name and email to allow our bugtracking team to contact you when the issue is resolved, or obtain further information regarding this issue.</span></p></body></html> true QFrame::NoFrame QFrame::Raised 0 0 Your Name Your Email QFrame::NoFrame QFrame::Plain 0 Qt::Horizontal 328 20 Send Report Cancel pushButton_Abort clicked() BugRepDlg reject() 801 828 526 496 pushButton_Send clicked() BugRepDlg accept() 718 828 528 451 pushButton_Add clicked() BugRepDlg AddFiles() 765 450 578 699 pushButton_remove clicked() BugRepDlg RemoveFile() 740 485 814 706 AddFiles() RemoveFile() ImageVis3D-3.1.0/ImageVis3D/UI/UI/MIPRotDialog.ui0000644000175000017500000001725412320517543020611 0ustar mathieumathieu MIPRotDialog Qt::WindowModal 0 0 314 262 MIP Rotation true Recording Number of images per rotation QFrame::NoFrame QFrame::Plain 0 3 0 36 7200 360 (1° per image) Renderer QFrame::StyledPanel QFrame::Raised 3 0 Orthographic Projection true Perspective Projection Stereo QFrame::NoFrame QFrame::Plain 0 0 Stereo Eye Disparity 1 20 3 Qt::Horizontal 3 ° Disable LOD Qt::Vertical 20 40 Qt::Horizontal QDialogButtonBox::Cancel|QDialogButtonBox::Ok buttonBox accepted() MIPRotDialog accept() 257 205 157 274 buttonBox rejected() MIPRotDialog reject() 300 228 286 274 spinBox_Images valueChanged(int) MIPRotDialog UpdateDegreeLabel() 111 62 287 90 checkBox_Stereo clicked() MIPRotDialog UpdateStereoCheckbox() 52 151 62 175 horizontalSlider_EyeDist valueChanged(int) MIPRotDialog UpdateEyeDistLabel() 194 146 265 5 UpdateDegreeLabel() UpdateStereoCheckbox() UpdateEyeDistLabel() ImageVis3D-3.1.0/ImageVis3D/UI/UI/BrowseData.ui0000644000175000017500000000664512320517543020414 0ustar mathieumathieu BrowseData Qt::WindowModal 0 0 526 369 425 0 Dataset Browser true QFrame::NoFrame true 0 0 400 351 QFrame::Box QFrame::Raised 1 Qt::Vertical Qt::Vertical QDialogButtonBox::Cancel|QDialogButtonBox::Open false buttonBox accepted() BrowseData accept() 516 263 157 274 buttonBox rejected() BrowseData reject() 516 269 286 274 verticalSlider_Brightness valueChanged(int) BrowseData SetBrightness(int) 424 329 297 2 SetBrightness(int) ImageVis3D-3.1.0/ImageVis3D/UI/UI/Metadata.ui0000644000175000017500000000664212320517543020076 0ustar mathieumathieu MetadataDlg Qt::WindowModal 0 0 582 477 0 0 Metdata Viewer false true 12 75 true Metadata QFrame::NoFrame QFrame::Plain 0 0 Qt::Horizontal 40 20 0 23 Close false true pushButton_Close clicked() MetadataDlg accept() 572 467 465 475 CheckUpdatesClicked() OnlineHelpClicked() OnlineVideoTutClicked() OpenFromFileClicked() OpenFromDirClicked() GetExampleDataClicked() CheckUpdates() OnlineHelp() OnlineVideoTut() OpenFromFile() OpenFromDir() OpenManual() GetExampleData() ImageVis3D-3.1.0/ImageVis3D/UI/UI/URLDlg.ui0000644000175000017500000001111612320517543017437 0ustar mathieumathieu URLDlg Qt::ApplicationModal 0 0 600 200 URLDialog true QFrame::NoFrame QFrame::Raised 0 0 0 0 TextLabel 0 0 QFrame::NoFrame QFrame::Plain 0 0 75 true TextLabel true TextLabel Download Qt::Vertical 20 40 Qt::Horizontal QDialogButtonBox::Ok buttonBox accepted() URLDlg accept() 257 146 157 274 buttonBox rejected() URLDlg reject() 325 146 286 274 pushButton_GotoURL clicked() URLDlg Download() 186 80 6 116 Download() ImageVis3D-3.1.0/ImageVis3D/UI/BrowseData.h0000644000175000017500000000514012320517543017676 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : BrowseData.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : September 2008 // //! Copyright (C) 2008 SCI Institute #pragma once #ifndef BROWSEDATA_H #define BROWSEDATA_H #include #include "AutoGen/ui_BrowseData.h" #include "../Tuvok/Controller/MasterController.h" #include "QDataRadioButton.h" using namespace tuvok; class BrowseData : public QDialog, protected Ui_BrowseData { Q_OBJECT public: BrowseData(MasterController& pMasterController, QDialog* pleaseWaitDialog, QString strDir, QWidget* parent = 0, Qt::WindowFlags flags = 0); virtual ~BrowseData(); bool DataFound() {return m_bDataFound;} std::shared_ptr GetStackInfo() { return m_dirInfo[m_iSelected]; } protected slots: virtual void accept(); virtual void SetBrightness(int iScale); private: MasterController& m_MasterController; bool m_bDataFound; QString m_strDir; std::vector m_vRadioButtons; std::vector> m_dirInfo; size_t m_iSelected; bool FillTable(QDialog* pleaseWaitDialog); virtual void showEvent (QShowEvent* event); }; #endif // BROWSEDATA_H ImageVis3D-3.1.0/ImageVis3D/UI/FTPDialog.h0000644000175000017500000000456512320517543017426 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : FTPDialog.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : December 2008 // //! Copyright (C) 2008 SCI Institute #ifndef FTPDIALOG_H #define FTPDIALOG_H #include "UI/AutoGen/ui_FTPDialog.h" #include #include #include "../Tuvok/Basics/Vectors.h" class QFtp; class QUrlInfo; class QFile; class FTPDialog : public QDialog, protected Ui_FTPDialog { Q_OBJECT public: FTPDialog(const std::string& strSource, const std::string& strTargetServer, const std::string& strTargetPath, QWidget* parent = 0, Qt::WindowFlags flags = 0); virtual ~FTPDialog(); void Start(); protected slots: void ftpCommandFinished(int commandId, bool error); void updateDataTransferProgress(qint64 readBytes, qint64 totalBytes); void AbortTransfer(); void finished(bool); signals: void TransferFailure(); void TransferSuccess(); private: std::string m_strSource; std::string m_strTargetServer; std::string m_strTargetPath; QFtp* m_pFtp; QFile* m_pFile; void Disconnect(); }; #endif // FTPDIALOG_H ImageVis3D-3.1.0/ImageVis3D/UI/MIPRotDialog.cpp0000644000175000017500000000703212320517543020432 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : MIPRotDialog.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : December 2008 // //! Copyright (C) 2008 SCI Institute #include "MIPRotDialog.h" #include using namespace std; MIPRotDialog::MIPRotDialog(uint32_t iImages, bool bOrthoView, bool bStereo, bool bUseLOD, uint32_t iEyeDist, QWidget* parent /* = 0 */, Qt::WindowFlags flags /* = 0 */) : QDialog(parent, flags) { setupUi(this, iImages, bOrthoView, bStereo, bUseLOD, iEyeDist); } MIPRotDialog::~MIPRotDialog(void) { } void MIPRotDialog::setupUi(QDialog *MIPRotDialog, uint32_t iImages, bool bOrthoView, bool bStereo, bool bUseLOD, uint32_t iEyeDist) { Ui_MIPRotDialog::setupUi(MIPRotDialog); spinBox_Images->setValue(iImages); if (bOrthoView) radioButton_Ortho->setChecked(true); else radioButton_Persp->setChecked(true); checkBox_Stereo->setChecked(bStereo); checkBox_NoLOD->setChecked(!bUseLOD); horizontalSlider_EyeDist->setValue(iEyeDist); UpdateDegreeLabel(); } void MIPRotDialog::UpdateDegreeLabel() { float fDegreePerImage = 360.0f/spinBox_Images->value(); QString qstr = tr("(%1 per image)").arg(fDegreePerImage); label_Degree->setText(qstr); UpdateStereoCheckbox(); } void MIPRotDialog::UpdateStereoCheckbox() { double fDegreePerImage = 360.0/spinBox_Images->value(); int iEyeDist = horizontalSlider_EyeDist->value(); int iReuseDist = int(iEyeDist/fDegreePerImage); bool bAreImagesReusable = (iReuseDist == iEyeDist/fDegreePerImage); if (checkBox_Stereo->isChecked() && !bAreImagesReusable) { checkBox_Stereo->setText("Stereo (performance warning)"); } else { checkBox_Stereo->setText("Stereo"); } } void MIPRotDialog::UpdateEyeDistLabel() { QString qstr = tr("(%1)").arg(horizontalSlider_EyeDist->value()); label_EyeDist->setText(qstr); UpdateStereoCheckbox(); } uint32_t MIPRotDialog::GetNumImages() const { return uint32_t(spinBox_Images->value()); } bool MIPRotDialog::GetUseOrtho() const { return radioButton_Ortho->isChecked(); } bool MIPRotDialog::GetUseStereo() const { return checkBox_Stereo->isChecked(); } bool MIPRotDialog::GetUseLOD() const { return !checkBox_NoLOD->isChecked(); } uint32_t MIPRotDialog::GetEyeDist() const { return uint32_t(horizontalSlider_EyeDist->value()); } ImageVis3D-3.1.0/ImageVis3D/UI/CrashDetDlg.cpp0000644000175000017500000000337412320517543020331 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : CrashDetDlg.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #include "CrashDetDlg.h" CrashDetDlg::CrashDetDlg(QString title, QString desc, bool bDontShowAgain, QWidget* parent, Qt::WindowFlags flags) : QDialog(parent, flags) { setupUi(this); checkBox_DontShowAgain->setChecked(bDontShowAgain); setWindowTitle(title); label_desc->setText(desc); } CrashDetDlg::~CrashDetDlg(void) { } ImageVis3D-3.1.0/ImageVis3D/UI/Q2DTransferFunction.h0000644000175000017500000001744612320517543021460 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : Q2DTransferFunction.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : July 2008 // //! Copyright (C) 2008 SCI Institute #pragma once #ifndef Q2DTRANSFERFUNCTION #define Q2DTRANSFERFUNCTION #include "QTransferFunction.h" #include "../Tuvok/IO/TransferFunction2D.h" #include #define Q2DT_PAINT_NONE 0 #define Q2DT_PAINT_RED 1 #define Q2DT_PAINT_GREEN 2 #define Q2DT_PAINT_BLUE 4 #define Q2DT_PAINT_ALPHA 8 #define Q2DT_PAINT_UNDEF 16 enum EDragMode { DRM_MOVE, DRM_ROTATE, DRM_SCALE, DRM_MOVE_ZOOM, DRM_NONE }; enum E2DTransferFunctionMode { TFM_EXPERT = 0, TFM_BASIC, TFM_INVALID }; enum E2DSimpleModePolyType { PT_PSEUDOTRIS = 0, PT_RECTANGLE, PT_OTHER }; enum EQ2DSimpleEDragMode { SDM_POLY, SDM_EDGE, SDM_VERTEX, SDM_GRAD_CENTER, SDM_NONE }; class SimpleSwatchInfo { public: SimpleSwatchInfo(const E2DSimpleModePolyType& eType=PT_OTHER, const FLOATVECTOR2& vHandlePos=FLOATVECTOR2(0,0), const std::string& desc="" ) : m_eType(eType), m_vHandlePos(vHandlePos), m_strDesc(desc) {} E2DSimpleModePolyType m_eType; FLOATVECTOR2 m_vHandlePos; std::string m_strDesc; }; class Q2DTransferFunction : public QTransferFunction { Q_OBJECT public: Q2DTransferFunction(MasterController& masterController, QWidget *parent=0); virtual ~Q2DTransferFunction(void); void SetData(std::shared_ptr vHistogram, LuaClassInstance trans); void SetPaintmode(unsigned int iPaintmode) { if (iPaintmode < Q2DT_PAINT_UNDEF) m_iPaintmode = iPaintmode;}; void Set1DTrans(LuaClassInstance p1DTrans); QSize minimumSizeHint() const; QSize sizeHint() const; int GetActiveSwatchIndex() { return m_iActiveSwatchIndex; } size_t GetSwatchCount(); size_t GetSwatchSize(unsigned int i); bool GetActiveGradientType(); void SetActiveGradientType(bool bRadial); size_t GetGradientCount(); GradientStop GetGradient(unsigned int i); void AddGradient(GradientStop stop); void DeleteGradient(unsigned int i); void SetGradient(unsigned int i, GradientStop stop); virtual void ApplyFunction(); void Toggle2DTFMode(); void Set2DTFMode(E2DTransferFunctionMode TransferFunctionMode); E2DTransferFunctionMode Get2DTFMode() const { return m_eTransferFunctionMode;} std::string GetSwatchDesciption() const; public slots: void Transfer2DSetActiveSwatch(const int iActiveSwatch); void Transfer2DAddSwatch(); void Transfer2DAddCircleSwatch(); void Transfer2DAddRectangleSwatch(); void Transfer2DAddPseudoTrisSwatch(); void Transfer2DDeleteSwatch(); void Transfer2DUpSwatch(); void Transfer2DDownSwatch(); bool LoadFromFile(const QString& strFilename); bool SaveToFile(const QString& strFilename); signals: void SwatchChange(); void SwatchTypeChange(int i); protected: virtual void paintEvent(QPaintEvent *event); virtual void mouseMoveEvent(QMouseEvent *event); virtual void mousePressEvent(QMouseEvent *event); virtual void mouseReleaseEvent(QMouseEvent *event); virtual void wheelEvent(QWheelEvent *event); virtual void changeEvent(QEvent * event); virtual void resizeEvent( QResizeEvent * event ); virtual void keyPressEvent( QKeyEvent * event ); virtual void keyReleaseEvent( QKeyEvent * event ); private: // states NormalizedHistogram2D m_vHistogram; LuaClassInstance m_trans; unsigned int m_iPaintmode; int m_iActiveSwatchIndex; E2DTransferFunctionMode m_eTransferFunctionMode; // cached image of the backdrop unsigned int m_iCachedHeight; unsigned int m_iCachedWidth; QPixmap* m_pBackdropCache; // cached image of the histogram QImage* m_pHistImage; // border size, may be changed in the constructor unsigned int m_iSwatchBorderSize; // colors, may be changed in the setcolor routine QColor m_colorHistogram; QColor m_colorBack; QColor m_colorSwatchBorder; QColor m_colorSwatchBorderHighlight; QColor m_colorSwatchBorderHighlightCenter; QColor m_colorSwatchBorderInactive; QColor m_colorSwatchBorderInactiveHighlight; QColor m_colorSwatchBorderCircle; QColor m_colorSwatchBorderCircleHighlight; QColor m_colorSwatchGradCircle; QColor m_colorSwatchBorderCircleSel; QColor m_colorSwatchGradCircleSel; void SetColor(bool bIsEnabled); // mouse motion handling int m_iPointSelIndex; int m_iGradSelIndex; INTVECTOR2 m_vMousePressPos; bool m_bDragging; bool m_bDraggingAll; EDragMode m_eDragMode; FLOATVECTOR4 m_vZoomWindow; Qt::MouseButton m_mouseButton; // drawing routines void ClearToBlack(QPainter& painter); void DrawHistogram(QPainter& painter); void DrawSwatches(QPainter& painter); void DrawSwatcheDecoration(QPainter& painter); void Draw1DTrans(QPainter& painter); void GenerateHistogramImage(); void ComputeCachedImageSize(uint32_t &w , uint32_t &h) const; // helper INTVECTOR2 Normalized2Offscreen(FLOATVECTOR2 vfCoord) const; INTVECTOR2 Normalized2Screen(FLOATVECTOR2 vfCoord) const; FLOATVECTOR2 Screen2Normalized(INTVECTOR2 vCoord) const; FLOATVECTOR2 Rotate(FLOATVECTOR2 point, float angle, FLOATVECTOR2 center, FLOATVECTOR2 rescale); void SetDragMode(bool bShiftPressed, bool bCtrlPressed); void DragInit(INTVECTOR2 vMousePressPos, Qt::MouseButton mouseButton); void DrawPolygonWithCool3DishBorder(QPainter& painter, std::vector& pointList, QPen& borderPen, QPen& borderPenHighlight); // Lua helper functions std::shared_ptr > GetSwatches() const; // For simple mode SimpleSwatchInfo ClassifySwatch(TFPolygon& polygon) const; void ComputeGradientForPseudoTris(TFPolygon& swatch, const FLOATVECTOR4& color); void RecomputeLowerPseudoTrisPoints(TFPolygon& currentSwatch, const FLOATVECTOR2& vHandePos); bool PointInPolygon(const FLOATVECTOR2& point, const TFPolygon& poly) const; std::vector m_vSimpleSwatchInfo; EQ2DSimpleEDragMode m_eSimpleDragMode; int m_iSimpleDragModeSubindex; void UpdateSwatchType(size_t i); void UpdateSwatchTypes(); int PickSwatch(const FLOATVECTOR2& pickPos) const; int PickEdge(const FLOATVECTOR2& pickPos, int& iEdgeIndex) const; int PickVertex(const FLOATVECTOR2& pickPos, int& iVertexIndex) const; int PickGradient(const FLOATVECTOR2& pickPos) const; void DrawPolyVertex(QPainter& painter, QPoint& p, bool bBorderVertex=true); void DrawPolyVertex(QPainter& painter, const INTVECTOR2& p, bool bBorderVertex=true); }; #endif // Q2DTRANSFERFUNCTION ImageVis3D-3.1.0/ImageVis3D/UI/QTransferFunction.cpp0000644000175000017500000000350312320517543021612 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : QTransferFunction.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : July 2008 // //! Copyright (C) 2008 SCI Institute #include "../Tuvok/StdTuvokDefines.h" #include "QTransferFunction.h" using namespace std; QTransferFunction::QTransferFunction(MasterController& masterController, QWidget *parent) : QWidget(parent), m_MasterController(masterController), m_eExecutionMode(CONTINUOUS), m_fHistfScale(1.0f), m_bBackdropCacheUptodate(false), m_bHistogramChanged(false) { } ImageVis3D-3.1.0/ImageVis3D/UI/QLightPreview.h0000644000175000017500000000511212320517543020374 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : QLightPreview.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : November 2009 // //! Copyright (C) 2009 SCI Institute #pragma once #ifndef QLIGHTPREVIEW_H #define QLIGHTPREVIEW_H #include #include "../Tuvok/Basics/Vectors.h" class QLightPreview : public QWidget { Q_OBJECT public: QLightPreview(QWidget *parent=0); virtual ~QLightPreview(void); void SetData(const FLOATVECTOR4& ambient, const FLOATVECTOR4& diffuse, const FLOATVECTOR4& specular, const FLOATVECTOR3& lightDir); FLOATVECTOR4 GetAmbient() const; FLOATVECTOR4 GetDiffuse() const; FLOATVECTOR4 GetSpecular()const; FLOATVECTOR3 GetLightDir()const; signals: void lightMoved(); protected: virtual void paintEvent(QPaintEvent *event); virtual void mouseMoveEvent(QMouseEvent *event); virtual void mousePressEvent(QMouseEvent *event); virtual void mouseReleaseEvent(QMouseEvent *event); private: FLOATVECTOR4 m_cAmbient; FLOATVECTOR4 m_cDiffuse; FLOATVECTOR4 m_cSpecular; FLOATVECTOR3 m_vLightDir; unsigned int m_iCachedHeight; unsigned int m_iCachedWidth; QImage* m_pCachedImage; bool m_bBackdropCacheUptodate; bool m_bMousePressed; void DrawSphere(QImage* sphereImage); }; #endif // QLIGHTPREVIEW_H ImageVis3D-3.1.0/ImageVis3D/UI/QTransferFunction.h0000644000175000017500000000501212320517543021254 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : QTransferFunction.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : July 2008 // //! Copyright (C) 2008 SCI Institute #pragma once #ifndef QTRANSFERFUNCTION_H #define QTRANSFERFUNCTION_H #include #include "../Tuvok/Controller/MasterController.h" using namespace tuvok; class QTransferFunction : public QWidget { Q_OBJECT public: enum executionMode { UNKNOWN=0, CONTINUOUS=1, ONRELEASE=2, MANUAL=4 }; public: QTransferFunction(MasterController& masterController, QWidget *parent=0); virtual void SetExecutionMode(executionMode iExecutionMode) { m_eExecutionMode = iExecutionMode; } public slots: virtual void SetHistogramScale(int iScale) { SetHistogramScale(float(iScale)); } virtual void SetHistogramScale(float fScale) { m_fHistfScale = fScale; m_bBackdropCacheUptodate = false; m_bHistogramChanged = true; update(); } float GetHistogramScale() { return m_fHistfScale; } virtual void ApplyFunction() = 0; protected: MasterController& m_MasterController; executionMode m_eExecutionMode; float m_fHistfScale; bool m_bBackdropCacheUptodate; bool m_bHistogramChanged; }; #endif // QTRANSFERFUNCTION_H ImageVis3D-3.1.0/ImageVis3D/UI/ImageVis3D_Locking.cpp0000644000175000017500000001472512320517543021550 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : ImageVis3D_Locking.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : November 2008 // //! Copyright (C) 2008 SCI Institute #include "ImageVis3D.h" #include "../Tuvok/Basics/SysTools.h" #include using namespace std; void MainWindow::UpdateLockView() { m_bUpdatingLockView = true; listWidget_Lock->clear(); if (m_pActiveRenderWin == NULL) { label_LockWinowID->setVisible(false); return; } QString text = "Lock window " + m_pActiveRenderWin->GetWindowID(); label_LockWinowID->setText(text); label_LockWinowID->setVisible(true); // find correct lock mode size_t iLockType = 0; if (radioButton_RenderModeLock->isChecked()) iLockType = 1; else if (radioButton_ToolsLock->isChecked()) iLockType = 2; else if (radioButton_FiltersLock->isChecked()) iLockType = 3; for (int i = 0;isubWindowList().size();i++) { QWidget* w = mdiArea->subWindowList().at(i)->widget(); RenderWindow* renderWin = WidgetToRenderWin(w); if (renderWin != NULL && renderWin != m_pActiveRenderWin) { listWidget_Lock->addItem(renderWin->GetWindowID()); // check if lock for this item is allready set for (size_t j = 0;jm_vpLocks[iLockType].size();j++) { if (renderWin == m_pActiveRenderWin->m_vpLocks[iLockType][j]) { listWidget_Lock->item(listWidget_Lock->count()-1)->setSelected(true); } } } } m_bUpdatingLockView = false; } void MainWindow::LockModalityChange() { UpdateLockView(); } void MainWindow::ChangeLocks() { if (m_bUpdatingLockView) return; bool bAddedTransitiveLocks = false; // find correct lock mode size_t iLockType = 0; if (radioButton_RenderModeLock->isChecked()) iLockType = 1; else if (radioButton_ToolsLock->isChecked()) iLockType = 2; else if (radioButton_FiltersLock->isChecked()) iLockType = 3; size_t iLocksInList = 0; for (int i = 0;icount();i++) if (listWidget_Lock->item(i)->isSelected()) iLocksInList++; size_t iLocksInVector = m_pActiveRenderWin->m_vpLocks[iLockType].size(); // otherwise update the locklists RemoveAllLocks(m_pActiveRenderWin, iLockType); // if we removed one lock we have to remove all locks, as they would be restored via transitivity otherwise if (iLocksInList < iLocksInVector) { UpdateLockView(); return; } for (int i = 0;icount();i++) { if (listWidget_Lock->item(i)->isSelected()) { // get corresponding renderwindow RenderWindow* otherWin = NULL; for (int j = 0;jsubWindowList().size();j++) { QWidget* w = mdiArea->subWindowList().at(j)->widget(); RenderWindow* renderWin = WidgetToRenderWin(w); if (QString(renderWin->GetWindowID()) == listWidget_Lock->item(i)->text() ) { otherWin = renderWin; break; } } if (otherWin != NULL) bAddedTransitiveLocks = SetLock(iLockType, m_pActiveRenderWin, otherWin); } } if (bAddedTransitiveLocks) UpdateLockView(); } bool MainWindow::SetLock(size_t iLockType, RenderWindow* winA, RenderWindow* winB) { bool bAddedTransitiveLocks = false; winA->m_vpLocks[iLockType].push_back(winB); winB->m_vpLocks[iLockType].push_back(winA); // resolve transitive locks by adding all the other locks of the other window to this one for (size_t j = 0;jm_vpLocks[iLockType].size();j++) { if (!IsLockedWith(iLockType, winB->m_vpLocks[iLockType][j], winA)) { winA->m_vpLocks[iLockType].push_back(winB->m_vpLocks[iLockType][j]); winB->m_vpLocks[iLockType][j]->m_vpLocks[iLockType].push_back(winA); bAddedTransitiveLocks = true; } } // check if the lock subgraph is clique for (size_t j = 0;jm_vpLocks[iLockType].size();j++) { for (size_t k = j;km_vpLocks[iLockType].size();k++) { if (!IsLockedWith(iLockType, winA->m_vpLocks[iLockType][j], winA->m_vpLocks[iLockType][k])) { winA->m_vpLocks[iLockType][j]->m_vpLocks[iLockType].push_back(winA->m_vpLocks[iLockType][k]); winA->m_vpLocks[iLockType][k]->m_vpLocks[iLockType].push_back(winA->m_vpLocks[iLockType][j]); bAddedTransitiveLocks = true; } } } return bAddedTransitiveLocks; } bool MainWindow::IsLockedWith(size_t iLockType, RenderWindow* winA, RenderWindow* winB) { if (winA == winB) return true; for (size_t i = 0;im_vpLocks[iLockType].size();i++) { if (winA->m_vpLocks[iLockType][i] == winB) return true; } return false; } void MainWindow::RemoveAllLocks(RenderWindow* sender) { for (size_t i = 0;isubWindowList().size();j++) { QWidget* w = mdiArea->subWindowList().at(j)->widget(); RenderWindow* otherWin = WidgetToRenderWin(w); if (otherWin == sender || otherWin == NULL) continue; for (size_t k = 0;km_vpLocks[iLockType].size();) { if (otherWin->m_vpLocks[iLockType][k] == sender) { otherWin->m_vpLocks[iLockType].erase(otherWin->m_vpLocks[iLockType].begin()+k); } else k++; } } sender->m_vpLocks[iLockType].clear(); } ImageVis3D-3.1.0/ImageVis3D/UI/PleaseWait.cpp0000644000175000017500000000556712320517543020251 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : PleaseWait.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : July 2008 // //! Copyright (C) 2008 SCI Institute #include "PleaseWait.h" #include PleaseWaitDialog::PleaseWaitDialog(QWidget* parent, Qt::WindowFlags flags, bool bHasCancelButton) : QDialog(parent, flags), m_pMasterController(NULL), m_pLabelOut(NULL), m_ButtonCancel(NULL), m_bCanceled(false) { setupUi(this); if (bHasCancelButton) { m_ButtonCancel = new QPushButton(this); m_ButtonCancel->setText(QString::fromUtf8("Cancel")); verticalLayout->addWidget(m_ButtonCancel); QObject::connect(m_ButtonCancel, SIGNAL(clicked()), this, SLOT(CancelClicked())); } } PleaseWaitDialog::~PleaseWaitDialog(void) { DetachLabel(); delete m_ButtonCancel; } void PleaseWaitDialog::CancelClicked() { m_ButtonCancel->setText(QString::fromUtf8("Cancelling ...")); m_ButtonCancel->setEnabled(false); m_ButtonCancel->update(); m_bCanceled = true; emit Canceled(); } QTLabelOut* PleaseWaitDialog::AttachLabel(MasterController* pMasterController) { if (m_pLabelOut) return m_pLabelOut; m_pMasterController = pMasterController; m_pLabelOut = new QTLabelOut(label_Status, this); m_pLabelOut->SetOutput(true, true, true, false); m_pMasterController->AddDebugOut(m_pLabelOut); return m_pLabelOut; } void PleaseWaitDialog::DetachLabel() { if(m_pMasterController) { m_pMasterController->RemoveDebugOut(m_pLabelOut); } m_pLabelOut = NULL; } void PleaseWaitDialog::closeEvent(QCloseEvent *) { DetachLabel(); } ImageVis3D-3.1.0/ImageVis3D/UI/Welcome.h0000644000175000017500000000577612320517543017255 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : Welcome.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #ifndef WELCOME_H #define WELCOME_H #include "AutoGen/ui_Welcome.h" #include #include #include class MRUButton : public QPushButton { public: explicit MRUButton(QWidget *parent=0) : QPushButton(parent) {} explicit MRUButton(const QString &text, QWidget *parent=0) : QPushButton(text, parent) {} MRUButton(const QIcon& icon, const QString &text, QWidget *parent=0) : QPushButton(icon, text, parent) {} virtual ~MRUButton() {} std::string strFilename; }; class WelcomeDialog : public QDialog, protected Ui_Welcome { Q_OBJECT public: WelcomeDialog(QWidget* parent, Qt::WindowFlags flags = Qt::Tool); virtual ~WelcomeDialog(); void ClearMRUItems(); void AddMRUItem(std::string strDesc, std::string strFilename); void SetShowAtStartup(bool bShow) {checkBox_ShowAtStartup->setChecked(!bShow);} bool ShowAtStartup() const {return !checkBox_ShowAtStartup->isChecked();} protected slots: virtual void CheckUpdates(); virtual void OnlineVideoTut(); virtual void OnlineHelp(); virtual void OpenFromFile(); virtual void OpenFromDir(); virtual void OpenMRU(); virtual void OpenManual(); virtual void GetExampleData(); signals: void CheckUpdatesClicked(); void OnlineVideoTutClicked(); void OnlineHelpClicked(); void OpenManualClicked(); void GetExampleDataClicked(); void OpenFromFileClicked(); void OpenFromFileClicked(std::string filename); void OpenFromDirClicked(); void OpenMRU(int iID); private: std::vector m_vMRUItems; }; #endif // WELCOME_H ImageVis3D-3.1.0/ImageVis3D/UI/DebugScriptWindow.cpp0000644000175000017500000004515212320517543021610 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief Combination of the debug window and a new scripting window. */ #include #include #include #include #include #include #include #include #include #include #include #include "DebugScriptWindow.h" //----------------------------------------------------------------------------- DebugScriptWindow::DebugScriptWindow(tuvok::MasterController& controller, QWidget* parent) : QDockWidget("Scripting Window", parent) , mSavedInputPos(0) , mController(controller) , mMemReg(controller.LuaScript()) , mLua(controller.LuaScript()) , mInFixFont(false) { setupUI(); hookLuaFunctions(); mSavedInput.reserve(50); // Install an event filter for our line edit mScriptOneLineEdit->installEventFilter(this); } //----------------------------------------------------------------------------- DebugScriptWindow::~DebugScriptWindow() { } //----------------------------------------------------------------------------- void DebugScriptWindow::setupUI() { // Testing setting up the UI programatically, as opposed to using QTCreator // and its generated XML. QWidget* dockWidgetContents = new QWidget(); dockWidgetContents->setObjectName(QString::fromUtf8("DebugWindowContents")); this->setWidget(dockWidgetContents); mMainLayout = new QVBoxLayout(dockWidgetContents); mMainLayout->setSpacing(6); mMainLayout->setContentsMargins(9, 9, 9, 9); mMainLayout->setObjectName(QString::fromUtf8("verticalLayout")); // Script debug implementation. { QWidget* scriptTabContents = new QWidget(); mMainLayout->addWidget(scriptTabContents); QHBoxLayout* scriptLayout = new QHBoxLayout(scriptTabContents); scriptTabContents->setLayout(scriptLayout); // Output / one line interaction { QWidget* outputContents = new QWidget(); scriptLayout->addWidget(outputContents); QVBoxLayout* outputLayout = new QVBoxLayout(); outputContents->setLayout(outputLayout); mListWidget = new QListWidget(); outputLayout->addWidget(mListWidget); // Lower line edit and label. { QWidget* cont = new QWidget(); cont->setMinimumHeight(0); outputLayout->addWidget(cont); QHBoxLayout* hboxLayout = new QHBoxLayout(); cont->setLayout(hboxLayout); QLabel* lbl = new QLabel(); lbl->setText(QString::fromUtf8("Command: ")); lbl->setMinimumSize(QSize(0, 0)); hboxLayout->addWidget(lbl); mScriptOneLineEdit = new QLineEdit(); hboxLayout->addWidget(mScriptOneLineEdit); QObject::connect(mScriptOneLineEdit, SIGNAL(returnPressed()), this, SLOT(oneLineEditOnReturnPressed())); QObject::connect(mScriptOneLineEdit, SIGNAL(textEdited(const QString&)), this, SLOT(oneLineEditOnEdited(const QString&))); } } // Script interaction. { QWidget* editContents = new QWidget(); scriptLayout->addWidget(editContents); QVBoxLayout* editLayout = new QVBoxLayout(); editContents->setLayout(editLayout); mScriptTextEdit = new QTextEdit(); QFont font("Monospace"); font.setStyleHint(QFont::TypeWriter); mScriptTextEdit->setCurrentFont(font); editLayout->addWidget(mScriptTextEdit); // Combo box combined with execute button. { QWidget* comboExecContents = new QWidget(); comboExecContents->setMinimumHeight(0); editLayout->addWidget(comboExecContents); QHBoxLayout* comboExecLayout = new QHBoxLayout(); comboExecContents->setLayout(comboExecLayout); QLabel* lbl = new QLabel(); lbl->setText(QString::fromUtf8("Examples: ")); comboExecLayout->addWidget(lbl); mScriptExamplesBox = new QComboBox(); comboExecLayout->addWidget(mScriptExamplesBox); QString emptyExample = QString::fromUtf8(" "); mScriptExamplesBox->addItem(QString::fromUtf8(" "), QVariant(emptyExample)); QString regressionTesting = QString::fromUtf8( "-- Please modify the variables below to point to valid paths.\n" "local homeDir = os.getenv('HOME')\n" "regress_scriptDir = homeDir .. '/sci/imagevis3d/Tuvok/LuaScripting" "/Regression/iv3d'\n" "regress_c60Dir = homeDir .. '/sci/datasets/c60.uvf'\n" "regress_outputDir = homeDir .. '/sci/datasets/output'\n" "luaVerboseMode(true)\n\n" "-- Todo: Switch to LuaFileSystem -- cross platform\n" "for fname in dir(regress_scriptDir) do\n" " if fname ~= '.' and fname ~= '..' then\n" " -- Ignore vim swap files\n" " ext = fname:match('.(%a*)$'):lower()\n" " if ext ~= 'swp' then\n" " print('Running \\'' .. fname .. '\\'')\n" " dofile(regress_scriptDir .. '/' .. fname)\n" " end\n" " end\n" "end\n\n" "luaVerboseMode(false)\n"); mScriptExamplesBox->addItem(QString::fromUtf8("Regression Testing"), QVariant(regressionTesting)); QString autoScreenCap = QString::fromUtf8( "-- This script will only run on a Posix compliant OS.\n" "-- Opens the dataset given by 'filename' and begins taking screen captures.\n" "-- You can manually transform the dataset while the script is running.\n" "-- Expect horrible things to happen if you close the render window while\n" "-- the script is running.\n" "local homeDir = os.getenv('HOME')\n" "local filename = homeDir .. '/sci/datasets/c60.uvf'\n" "local outputDir = homeDir .. '/sci/datasets/output/images'\n" "local numScreenCaps = 128\n\n" "print('Animate and capture script')\n" "print('Results will be output to: ' .. outputDir)\n" "os.execute('mkdir -p ' .. outputDir)\n\n" "-- data = Render window to animate.\n" "-- numFrames = Number of frames to capture during the animation.\n" "function doAnim (data, numFrames)\n" " local datasetPath = data.getDataset().fullpath()\n" " local baseName = os.capture('basename ' .. datasetPath .. ' .uvf', false)\n" " print('Using basename: ' .. baseName)\n" " t = 0.0\n" " dt = 2.0 * math.pi / numFrames\n" " for i=1,numFrames do\n" " t = t + dt\n" " print('Capturing screen ' .. i)\n" " data.screenCapture(outputDir .. '/' .. baseName .. '_' .. i .. '.png', false)\n" " -- Dirty hack to get the UI to update.\n" " iv3d.processUI()\n" " end\n" "end\n\n" "print('Loading data')\n" "data = iv3d.renderer.new(filename)\n" "print('Performing screen captures')\n" "data.setRendererTarget(1)\n" "doAnim(data, numScreenCaps)\n" "data.setRendererTarget(0)\n"); mScriptExamplesBox->addItem(QString::fromUtf8("Auto Screen Cap"), QVariant(autoScreenCap)); QString exampleMath = QString::fromUtf8( "print('-- Binary Operators --')\n" "print(5 + 79)\n" "print('Basic binary operators: ' .. (3 * 5 - 2) / 5 + 1 )\n" "print('Exponentiation: ' .. 3 ^ 5)\n" "a = 17; b = 5;\n" "print('Modulo: ' .. a % b)\n" "print('-- Relational Operators --')\n" "print('Is it equal?: ' .. tostring(a%b == a-math.floor(a/b)*b))\n" "print('a less than b?: ' .. tostring(a < b))\n" "print('a greater than b?: ' .. tostring(a > b))\n"); mScriptExamplesBox->addItem(QString::fromUtf8("Basic Math"), QVariant(exampleMath)); QString exampleLightOnAll = QString::fromUtf8( "for i in ...;\n" "...\n" "...\n" "...\n" ".."); mScriptExamplesBox->addItem(QString::fromUtf8("Turn On All Lighting"), QVariant(exampleLightOnAll)); QString rotate360AndScreenCap = QString::fromUtf8( "for i in ...;\n" "...\n" "...\n" "...\n" ".."); mScriptExamplesBox->addItem(QString::fromUtf8("Rotate 360 and Screen " "Cap"), QVariant(rotate360AndScreenCap)); QObject::connect(mScriptExamplesBox, SIGNAL(currentIndexChanged(int)), this, SLOT(exampComboIndexChanged(int))); QSpacerItem* spacer = new QSpacerItem(40, 10, QSizePolicy::Expanding, QSizePolicy::Preferred); comboExecLayout->addSpacerItem(spacer); mExecButton = new QPushButton(); mExecButton->setMinimumSize(QSize(0, 23)); // Required, if not, button // is shifted downwards beyond its layout control. mExecButton->setText(QString::fromUtf8("Execute Script")); comboExecLayout->addWidget(mExecButton); QObject::connect(mExecButton, SIGNAL(clicked()), this, SLOT(execClicked())); } } } connect(mScriptTextEdit, SIGNAL(textChanged()), this, SLOT(fixFont())); } //----------------------------------------------------------------------------- std::string getLongestPrefix( const std::vector& strs) { std::vector::const_iterator vsi = strs.begin(); int maxCharactersCommon = static_cast(vsi->length()); std::string compareString = *vsi ; for (vsi = strs.begin() + 1; vsi != strs.end(); ++vsi) { // Avoid mismatch iterating passed the end of the second iterator. // Complexity for size should be constant (std::distance(begin(), end()). if (compareString.size() <= vsi->size()) { std::pair p = std::mismatch(compareString.begin(), compareString.end(), vsi->begin()); if ((p.first - compareString.begin()) < maxCharactersCommon) maxCharactersCommon = p.first - compareString.begin(); } else { std::pair p = std::mismatch(vsi->begin(), vsi->end(), compareString.begin()); if ((p.first - vsi->begin()) < maxCharactersCommon) maxCharactersCommon = p.first - vsi->begin(); } } return compareString.substr(0, (size_t)maxCharactersCommon); } //----------------------------------------------------------------------------- bool DebugScriptWindow::eventFilter(QObject *obj, QEvent *event) { if (obj == mScriptOneLineEdit) { if (event->type() == QEvent::KeyPress) { QKeyEvent* keyEvent = static_cast(event); if (keyEvent->key() == Qt::Key_Up) { if(mSavedInput.empty()) return false; /// @todo Implement scrolling through prior command history. //mController.LuaScript()->exec("print('key up')"); mScriptOneLineEdit->setText( QString::fromStdString(mSavedInput[mSavedInputPos])); if (mSavedInputPos > 0) --mSavedInputPos; return true; } else if (keyEvent->key() == Qt::Key_Down) { if(mSavedInput.empty()) return false; //mController.LuaScript()->exec("print('key down')"); if (mSavedInputPos < (int)mSavedInput.size() - 1) { ++mSavedInputPos; mScriptOneLineEdit->setText( QString::fromStdString(mSavedInput[mSavedInputPos])); } else { mScriptOneLineEdit->setText(QString::fromUtf8("")); } return true; } else if (keyEvent->key() == Qt::Key_Tab) { // Attempt to complete the current command. QString qs = mScriptOneLineEdit->text(); std::vector completions = mController.LuaScript()->completeCommand(qs.toStdString()); if (completions.size() == 1) { // Just replace what the user was typing. std::string cmdPath = mController.LuaScript()->getCmdPath(qs.toStdString()); if (cmdPath.size() > 0) cmdPath += "."; std::string fullCmdPrefix = cmdPath + completions[0]; mScriptOneLineEdit->setText(QString::fromStdString(fullCmdPrefix)); } else if (completions.size() > 1) { // Attempt to find a comman prefix, and replace the user's text // with that. std::string prefix = getLongestPrefix(completions); std::string cmdPath = mController.LuaScript()->getCmdPath(qs.toStdString()); if (cmdPath.size() > 0) cmdPath += "."; std::string fullCmdPrefix = cmdPath + prefix; mScriptOneLineEdit->setText(QString::fromStdString(fullCmdPrefix)); mController.LuaScript()->exec("print('')"); mController.LuaScript()->exec("print('Completions:')"); for (std::vector::iterator it = completions.begin(); it != completions.end(); ++it) { std::string out = "print('"; out += *it; out += "')"; mController.LuaScript()->exec(out); } } else { mController.LuaScript()->exec(""); mController.LuaScript()->exec("print('No valid completions.')"); } return true; } } return false; } return QDockWidget::eventFilter(obj, event); } //----------------------------------------------------------------------------- void DebugScriptWindow::execClicked() { QString qs = mScriptTextEdit->document()->toPlainText(); execLua(qs.toStdString()); QFont font("Monospace"); font.setStyleHint(QFont::TypeWriter); mScriptTextEdit->setCurrentFont(font); } //----------------------------------------------------------------------------- void DebugScriptWindow::oneLineEditOnReturnPressed() { QString qs = mScriptOneLineEdit->text(); // Test to see if the user typed help. If they did, rename it to: // helpAllFunctions(). // help(...) has replaced the info function. if (qs.compare("help", Qt::CaseInsensitive) == 0) execLua("helpAllFunctions()"); else execLua(qs.toStdString()); mSavedInput.push_back(qs.toStdString()); mSavedInputPos = static_cast(mSavedInput.size()) - 1; mScriptOneLineEdit->setText(QString::fromUtf8("")); } //----------------------------------------------------------------------------- void DebugScriptWindow::oneLineEditOnEdited(const QString&) { // Reset the stack pointer mSavedInputPos = static_cast(mSavedInput.size()) - 1; } //----------------------------------------------------------------------------- void DebugScriptWindow::execLua(const std::string& cmd) { mLua->setExpectedExceptionFlag(true); try { mLua->exec(cmd); } catch (tuvok::LuaError& e) { std::string error = "Lua Error: "; error += e.what(); hook_logError(error); } catch (std::exception& e) { std::string error = "Standard Exception: "; error += e.what(); hook_logError(error); } catch (...) { hook_logError("Unknown exception occurred."); } mLua->setExpectedExceptionFlag(false); } //----------------------------------------------------------------------------- void DebugScriptWindow::exampComboIndexChanged(int index) { QVariant text = mScriptExamplesBox->itemData(index); QFont font("Monospace"); font.setStyleHint(QFont::TypeWriter); mScriptTextEdit->setCurrentFont(font); mScriptTextEdit->setText(text.toString()); } void DebugScriptWindow::fixFont() { if (!mInFixFont) { mInFixFont = true; QFont font("Monospace"); font.setStyleHint(QFont::TypeWriter); mScriptTextEdit->setCurrentFont(font); mInFixFont = false; } } //----------------------------------------------------------------------------- void DebugScriptWindow::hookLuaFunctions() { mMemReg.strictHook(this, &DebugScriptWindow::hook_logInfo, "print"); mMemReg.strictHook(this, &DebugScriptWindow::hook_logInfo, "log.info"); mMemReg.strictHook(this, &DebugScriptWindow::hook_logWarning, "log.warn"); mMemReg.strictHook(this, &DebugScriptWindow::hook_logError, "log.error"); } //----------------------------------------------------------------------------- void DebugScriptWindow::hook_logInfo(std::string info) { mListWidget->addItem(QString::fromStdString(info)); mListWidget->scrollToBottom(); } //----------------------------------------------------------------------------- void DebugScriptWindow::hook_logWarning(std::string warn) { QListWidgetItem* item = new QListWidgetItem(QString::fromStdString(warn)); item->setBackground(QBrush(QColor(246, 234, 190))); mListWidget->addItem(item); mListWidget->scrollToBottom(); } //----------------------------------------------------------------------------- void DebugScriptWindow::hook_logError(std::string error) { /// TODO: Insert a list widget item that is colored (background). QListWidgetItem* item = new QListWidgetItem(QString::fromStdString(error)); item->setBackground(QBrush(QColor(238, 209, 212))); mListWidget->addItem(item); mListWidget->scrollToBottom(); } ImageVis3D-3.1.0/ImageVis3D/UI/ImageVis3D_I3M.cpp0000644000175000017500000001750112320517543020545 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : ImageVis3D_I3M.cpp //! Author : Jens Krueger //! DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2009 // //! Copyright (C) 2009 DFKI, MMCI, SCI Institute #include "ImageVis3D.h" #include "../Tuvok/Basics/SysTools.h" #include "../Tuvok/Controller/Controller.h" #include "../Tuvok/LuaScripting/TuvokSpecific/LuaTuvokTypes.h" #include "../Tuvok/LuaScripting/TuvokSpecific/LuaDatasetProxy.h" #include #include #include #include "PleaseWait.h" using namespace tuvok; using namespace std; string MainWindow::ConvertTF(const string& strSource1DTFilename, const string& strTargetDir, const string& strTargetFullFilename, PleaseWaitDialog& pleaseWait) { pleaseWait.SetText("Converting transfer function, please wait ..."); string filenameOnly = SysTools::ChangeExt( SysTools::GetFilename(strTargetFullFilename),"i3m.1dt" ); string strTarget1DTFilename = strTargetDir+"/"+filenameOnly; MESSAGE("Converting transferfunction to %s",strTarget1DTFilename.c_str()); TransferFunction1D tfIn(strSource1DTFilename); if (tfIn.GetSize() > 256) { // resample 1D tf to 8bit tfIn.Resample(256); } else { // if it is 8bit already simply fill it to 256 entries tfIn.FillOrTruncate(256); } if (!tfIn.Save(strTarget1DTFilename)) return ""; MESSAGE("Saved 8bit transferfunction to %s",strTarget1DTFilename.c_str()); return strTarget1DTFilename; } string MainWindow::ConvertDataToI3M(LuaClassInstance currentDataset, const string& strTargetDir, PleaseWaitDialog& pleaseWait, bool bOverrideExisting) { shared_ptr ss = m_MasterController.LuaScript(); if (ss->cexecRet( currentDataset.fqName() + ".getDSType") != LuaDatasetProxy::UVF) { T_ERROR("MainWindow::ConvertDataToI3M can only accept UVF datasets."); return ""; } string dsFilename = ss->cexecRet(currentDataset.fqName() + ".fullpath"); pleaseWait.SetText("Converting:" + QString(dsFilename.c_str())); // UVF to I3M // first, find the smalest LOD with every dimension // larger or equal to 128 (if possible) int iLODLevel = static_cast( ss->cexecRet(currentDataset.fqName() + ".getLODLevelCount")) - 1; for (;iLODLevel>0;iLODLevel--) { UINTVECTOR3 vLODSize = UINTVECTOR3(ss->cexecRet( currentDataset.fqName() + ".getDomainSize", static_cast(iLODLevel), size_t(0))); if (vLODSize.x >= 128 && vLODSize.y >= 128 && vLODSize.z >= 128) break; } string filenameOnly = SysTools::GetFilename(dsFilename); string strTargetFilename = strTargetDir+"/"+ SysTools::ChangeExt(filenameOnly,"i3m"); if (!bOverrideExisting && SysTools::FileExists(strTargetFilename)) { strTargetFilename = SysTools::FindNextSequenceName( strTargetFilename ); } if (!ss->cexecRet("tuvok.io.exportDataset", currentDataset, static_cast(iLODLevel), strTargetFilename, m_strTempDir)) { return ""; } return strTargetFilename; } void MainWindow::TransferToI3M() { if (!m_pActiveRenderWin) return; shared_ptr ss(m_MasterController.LuaScript()); LuaClassInstance ds = m_pActiveRenderWin->GetRendererDataset(); if (ss->cexecRet( ds.fqName() + ".getDSType") == LuaDatasetProxy::UVF) { QSettings settings; QString strLastDir = settings.value("Folders/I3DMServer", ".").toString(); QString directoryName = QFileDialog::getExistingDirectory(this, "Select Dataset Server folder.", strLastDir); if (directoryName.isEmpty()) return; string strTargetDir = string(directoryName.toAscii().data()); settings.setValue("Folders/I3MServer", directoryName); PleaseWaitDialog pleaseWait(this); pleaseWait.SetText("Preparing data ..."); pleaseWait.AttachLabel(&m_MasterController); string targetFile = ConvertDataToI3M(ds,strTargetDir, pleaseWait, true); if (targetFile == "") { QMessageBox errorMessage; errorMessage.setText("Unable to convert the dataset " "into the given directory."); errorMessage.setIcon(QMessageBox::Critical); errorMessage.exec(); T_ERROR("Unable to convert the dataset " "into the given directory."); } string strTemp1DTFilename = m_strTempDir + "i3mexport.1dt"; m_1DTransferFunction->SaveToFile(QString(strTemp1DTFilename.c_str())); targetFile = ConvertTF(strTemp1DTFilename, strTargetDir, ss->cexecRet(ds.fqName() + ".fullpath"), pleaseWait); remove(strTemp1DTFilename.c_str()); if (targetFile == "") { QMessageBox errorMessage; errorMessage.setText("Unable to convert the transferfunction " "into the given directory."); errorMessage.setIcon(QMessageBox::Critical); errorMessage.exec(); T_ERROR("Unable to convert the transferfunction " "into the given directory."); } ; const std::vector> meshes = ss->cexecRet>>( ds.fqName() + ".getMeshes"); string filenameOnly = SysTools::RemoveExt(SysTools::GetFilename( ss->cexecRet(ds.fqName() + ".fullpath"))); for (size_t i = 0;i 1) sstream << strTargetDir << "/" << filenameOnly << "_" << i+1 << ".g3d"; else sstream << strTargetDir << "/" << filenameOnly << ".g3d"; ss->cexec("tuvok.io.exportMesh", meshes[i], sstream.str()); } } else { QMessageBox errorMessage; errorMessage.setText("ImageVis3D Mobile Device Transfer only supported for UVF datasets."); errorMessage.setIcon(QMessageBox::Critical); errorMessage.exec(); T_ERROR("ImageVis3D Mobile Device Transfer only supported for UVF datasets."); } } ImageVis3D-3.1.0/ImageVis3D/UI/URLDlg.cpp0000644000175000017500000000377312320517543017301 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : URLDlg.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #include #include #include "URLDlg.h" #ifdef DETECTED_OS_WINDOWS #include #endif URLDlg::URLDlg(QString title, QString desc, QString url, QWidget* parent, Qt::WindowFlags flags) : QDialog(parent, flags), m_strURL(url) { setupUi(this); setWindowTitle(title); QPixmap p = QPixmap::fromImage(QImage(":/Resources/icon_Update.png")); label_updateIcon->setPixmap(p); label_desc->setText(desc); label_url->setText(url); } URLDlg::~URLDlg(void) { } void URLDlg::Download() { accept(); QDesktopServices::openUrl(m_strURL); } ImageVis3D-3.1.0/ImageVis3D/UI/MergeDlg.cpp0000644000175000017500000002717212320517543017675 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : MergeDlg.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : February 2009 // //! Copyright (C) 2009 SCI Institute #include "MergeDlg.h" #include "ImageVis3D.h" #include "PleaseWait.h" #include #include #include "../Tuvok/Basics/SysTools.h" #include "../Tuvok/IO/AbstrConverter.h" #include "../Tuvok/LuaScripting/LuaScripting.h" #include "../Tuvok/LuaScripting/TuvokSpecific/LuaIOManagerProxy.h" #include "../Tuvok/LuaScripting/TuvokSpecific/LuaTuvokTypes.h" using namespace std; MergeDlg::MergeDlg(MainWindow* parent, Qt::WindowFlags flags /* = 0 */) : QDialog((QWidget*)parent, flags), m_pMainWindow(parent) { setupUi(); } MergeDlg::~MergeDlg(void) { for (size_t i = 0;icurrentRow(); if (iCurrent >= 0) { PleaseWaitDialog pleaseWait(this); pleaseWait.SetText("Analyzing dataset ..."); pleaseWait.AttachLabel(&m_pMainWindow->m_MasterController); shared_ptr ss(m_pMainWindow->m_MasterController.LuaScript()); string filename = m_vDataSetList[iCurrent]->m_strFilename; tuple analyzeRes = ss->cexecRet>( "tuvok.io.analyzeDataset", filename, m_pMainWindow->GetTempDir()); if (true == std::get<0>(analyzeRes)) { RangeInfo info = std::get<1>(analyzeRes); m_vDataSetList[iCurrent]->m_vAspect = info.m_vAspect; m_vDataSetList[iCurrent]->m_vDomainSize = info.m_vDomainSize; m_vDataSetList[iCurrent]->m_iComponentSize = info.m_iComponentSize; m_vDataSetList[iCurrent]->m_bAnalyzed = true; m_vDataSetList[iCurrent]->m_iValueType = info.m_iValueType; m_vDataSetList[iCurrent]->m_fRange = info.m_fRange; m_vDataSetList[iCurrent]->m_iRange = info.m_iRange; m_vDataSetList[iCurrent]->m_uiRange = info.m_uiRange; } else { m_pMainWindow->ShowWarningDialog("Analysis Error", "Unable to Analyze the dataset"); m_vDataSetList[iCurrent]->m_bAnalyzed = false; } pleaseWait.close(); UpdateValueFields(); } } void MergeDlg::setupUi() { Ui_MergeDlg::setupUi(this); IsDatasetSelected(false); pushButton_save->setEnabled(!m_vDataSetList.empty()); UpdateValueFields(); } void MergeDlg::IsDatasetSelected(bool bIsDatasetsSelected) { pushButton_removeData->setEnabled(bIsDatasetsSelected); groupBox_Info->setVisible(bIsDatasetsSelected); groupBox_SB->setVisible(bIsDatasetsSelected); } void MergeDlg::ChangedActiveDataset() { int iCurrent = listWidget_datasets->currentRow(); UpdateValueFields(); if (iCurrent < 0) { IsDatasetSelected(false); return; } IsDatasetSelected(true); } void MergeDlg::ToggleDefaultMergeSet(bool bChecked) { // The code below swaps the checked states of the group boxes like they are radio buttons. if (bChecked == true && grpCustomExpressionMode->isChecked() == true) { grpCustomExpressionMode->setChecked(false); } else if (bChecked == false && grpCustomExpressionMode->isChecked() == false) { grpDefaultExpressionModes->setChecked(true); } } void MergeDlg::ToggleCustomMergeSet(bool bChecked) { // The code below swaps the checked states of the group boxes like they are radio buttons. if (bChecked == true && grpDefaultExpressionModes->isChecked() == true) { grpDefaultExpressionModes->setChecked(false); } else if (bChecked == false && grpDefaultExpressionModes->isChecked() == false) { grpCustomExpressionMode->setChecked(true); } } void MergeDlg::AddDataset() { QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString selectedFilter; QSettings settings; QString strLastDir = settings.value("Folders/MergeInput", ".").toString(); shared_ptr ss(m_pMainWindow->m_MasterController.LuaScript()); QString dialogString = ss->cexecRet("tuvok.io.getLoadDialogString").c_str(); QString fileName = QFileDialog::getOpenFileName(this, "Add Dataset", strLastDir, dialogString,&selectedFilter, options); if (!fileName.isEmpty()) { settings.setValue("Folders/MergeInput", QFileInfo(fileName).absoluteDir().path()); DataSetListElem* l = new DataSetListElem(string(fileName.toAscii())); m_vDataSetList.push_back(l); UpadeListView(); listWidget_datasets->setCurrentRow(int(m_vDataSetList.size()-1)); if (checkBox_AutoAnalyze->isChecked()) AnalyzeCurrentDataset(); pushButton_save->setEnabled(true); } } void MergeDlg::RemoveDataset() { int iCurrent = listWidget_datasets->currentRow(); if (iCurrent < 0) return; m_vDataSetList.erase(m_vDataSetList.begin()+iCurrent); UpadeListView(); pushButton_save->setEnabled(!m_vDataSetList.empty()); } void MergeDlg::ExecuteMerge() { accept(); } void MergeDlg::CancelMerge() { reject(); } void MergeDlg::UpadeListView() { int iCurrent = listWidget_datasets->currentRow(); listWidget_datasets->clear(); for (size_t i = 0;im_strDisplayName.c_str(); listWidget_datasets->addItem ( strDesc ); } if (!m_vDataSetList.empty() && iCurrent >= 0) { listWidget_datasets->setCurrentRow(std::min(iCurrent, int(m_vDataSetList.size())-1)); } IsDatasetSelected(listWidget_datasets->currentRow() >= 0); } void MergeDlg::UpdateValueFields() { int iCurrent = listWidget_datasets->currentRow(); if (iCurrent <0) return; if (m_vDataSetList[iCurrent]->m_bAnalyzed) { QString strDesc; switch (m_vDataSetList[iCurrent]->m_iValueType) { case 0 : strDesc = tr("%1 x %2 x %3 (%4 x %5 x %6) %7bit floating point data in the range %8 to %9") .arg(m_vDataSetList[iCurrent]->m_vDomainSize.x) .arg(m_vDataSetList[iCurrent]->m_vDomainSize.y) .arg(m_vDataSetList[iCurrent]->m_vDomainSize.z) .arg(m_vDataSetList[iCurrent]->m_vAspect.x) .arg(m_vDataSetList[iCurrent]->m_vAspect.y) .arg(m_vDataSetList[iCurrent]->m_vAspect.z) .arg(m_vDataSetList[iCurrent]->m_iComponentSize) .arg(m_vDataSetList[iCurrent]->m_fRange.first) .arg(m_vDataSetList[iCurrent]->m_fRange.second); break; case 1 : strDesc = tr("%1 x %2 x %3 (%4 x %5 x %6) %7bit integer data in the range %8 to %9") .arg(m_vDataSetList[iCurrent]->m_vDomainSize.x) .arg(m_vDataSetList[iCurrent]->m_vDomainSize.y) .arg(m_vDataSetList[iCurrent]->m_vDomainSize.z) .arg(m_vDataSetList[iCurrent]->m_vAspect.x) .arg(m_vDataSetList[iCurrent]->m_vAspect.y) .arg(m_vDataSetList[iCurrent]->m_vAspect.z) .arg(m_vDataSetList[iCurrent]->m_iComponentSize) .arg(m_vDataSetList[iCurrent]->m_iRange.first) .arg(m_vDataSetList[iCurrent]->m_iRange.second); break; case 2 : strDesc = tr("%1 x %2 x %3 (%4 x %5 x %6) %7bit integer data in the range %8 to %9") .arg(m_vDataSetList[iCurrent]->m_vDomainSize.x) .arg(m_vDataSetList[iCurrent]->m_vDomainSize.y) .arg(m_vDataSetList[iCurrent]->m_vDomainSize.z) .arg(m_vDataSetList[iCurrent]->m_vAspect.x) .arg(m_vDataSetList[iCurrent]->m_vAspect.y) .arg(m_vDataSetList[iCurrent]->m_vAspect.z) .arg(m_vDataSetList[iCurrent]->m_iComponentSize) .arg(m_vDataSetList[iCurrent]->m_uiRange.first) .arg(m_vDataSetList[iCurrent]->m_uiRange.second); break; default : strDesc = "The dataset description is invalid."; break; } label_Info->setText(strDesc); } else { label_Info->setText("Click Analyze to get information about the data set"); } doubleSpinBox_bias->setValue(m_vDataSetList[iCurrent]->m_fBias); doubleSpinBox_scale->setValue(m_vDataSetList[iCurrent]->m_fScale); } void MergeDlg::ChangedScale(double fScale) { int iCurrent = listWidget_datasets->currentRow(); if (iCurrent <0) return; m_vDataSetList[iCurrent]->m_fScale = fScale; } void MergeDlg::ChangedBias(double fBias) { int iCurrent = listWidget_datasets->currentRow(); if (iCurrent <0) return; m_vDataSetList[iCurrent]->m_fBias = fBias; } ImageVis3D-3.1.0/ImageVis3D/UI/ImageVis3D_2DTransferFunction.cpp0000644000175000017500000003135412320517543023637 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : ImageVis3D_2DTransferFunction.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : July 2008 // //! Copyright (C) 2008 SCI Institute #include "ImageVis3D.h" #include "BrowseData.h" #include #include #include #include #include #include #include "PleaseWait.h" #include #include #include #include "../Tuvok/Basics/SysTools.h" #include "../Tuvok/IO/FileBackedDataset.h" using namespace std; // ****************************************** // 2D Transfer Function Dock // ****************************************** void MainWindow::Transfer2DSwatchesChanged() { listWidget_Swatches->clear(); for (size_t i = 0;iGetSwatchCount();i++) { size_t iSize = m_2DTransferFunction->GetSwatchSize(uint32_t(i)); QString msg; switch (iSize) { case 3 : msg = "Triangle"; break; case 4 : msg = "Quadrilateral"; break; case 5 : msg = "Pentagon"; break; case 6 : msg = "Hexagon"; break; case 7 : msg = "Heptagon"; break; case 8 : msg = "Octagon"; break; case 9 : msg = "Nonagon"; break; case 10 : msg = "Decagon"; break; case 11 : msg = "Hendecagon"; break; case 12 : msg = "Dodecagon"; break; case 13 : msg = "Triskaidecagon"; break; case 14 : msg = "Tetrakaidecagon"; break; case 15 : msg = "Pendedecagon"; break; case 16 : msg = "Hexdecagon"; break; case 17 : msg = "Heptdecagon"; break; case 18 : msg = "Octdecagon"; break; case 19 : msg = "Enneadecagon"; break; case 20 : msg = "Icosagon"; break; // at this point I am getting bored ... default : msg = tr("%1 - gon").arg(iSize); break; } listWidget_Swatches->addItem( msg ); } int iCurrent = m_2DTransferFunction->GetActiveSwatchIndex(); listWidget_Swatches->setCurrentRow(iCurrent); Transfer2DUpdateSwatchButtons(); UpdatePolyTypeLabel(iCurrent); } void MainWindow::Transfer2DSwatcheTypeChanged(int iIndex) { int iCurrent = m_2DTransferFunction->GetActiveSwatchIndex(); if (iIndex == iCurrent) UpdatePolyTypeLabel(iCurrent); } void MainWindow::Transfer2DUpdateGradientType() { bool b = m_2DTransferFunction->GetActiveGradientType(); if (b) radioButton_radGrad->setChecked(true); else radioButton_linGrad->setChecked(true); } void MainWindow::Transfer2DToggleGradientType() { m_2DTransferFunction->SetActiveGradientType(radioButton_radGrad->isChecked()); } void MainWindow::Transfer2DUpdateSwatchButtons() { int iCurrent = m_2DTransferFunction->GetActiveSwatchIndex(); pushButton_DelPoly->setEnabled(iCurrent >= 0); pushButton_UpPoly->setEnabled(iCurrent > 0); pushButton_DownPoly-> setEnabled(iCurrent < int(m_2DTransferFunction->GetSwatchCount())-1); Transfer2DUpdateGradientBox(); } void MainWindow::Transfer2DUpdateGradientBox() { int iCurrent = listWidget_Gradient->currentRow(); listWidget_Gradient->clear(); if (m_2DTransferFunction->GetActiveSwatchIndex() > -1) { for (size_t i = 0;iGetGradientCount();i++) { GradientStop s = m_2DTransferFunction->GetGradient(uint32_t(i)); QString msg = tr("Stop at %1").arg(s.first); listWidget_Gradient->addItem( msg ); } listWidget_Gradient-> setCurrentRow(min(iCurrent, int(m_2DTransferFunction->GetGradientCount()))); } Transfer2DUpdateGradientButtons(); Transfer2DUpdateGradientType(); } void MainWindow::Transfer2DUpdateGradientButtons() { pushButton_AddStop->setEnabled(m_2DTransferFunction->GetActiveSwatchIndex() != -1); int iCurrent; if ( m_2DTransferFunction->Get2DTFMode() == TFM_EXPERT) iCurrent = listWidget_Gradient->currentRow(); else iCurrent = min(1,int(m_2DTransferFunction->GetGradientCount())-1); pushButton_DelStop->setEnabled(iCurrent >= 0); frame_ChooseColor->setEnabled(iCurrent >= 0); if (iCurrent >= 0 && m_2DTransferFunction->GetSwatchCount() > 0) { GradientStop s = m_2DTransferFunction->GetGradient(iCurrent); QString strStyle = tr("QPushButton { background: rgb(%1, %2, %3); color: rgb(%4, %5, %6) }").arg(int(s.second[0]*255)).arg(int(s.second[1]*255)).arg(int(s.second[2]*255)).arg(int((1-s.second[0])*255)).arg(int((1-s.second[1])*255)).arg(int((1-s.second[2])*255)); if ( m_2DTransferFunction->Get2DTFMode() == TFM_EXPERT) { pushButton_ColorChooser->setStyleSheet( strStyle ); horizontalSlider_Opacity->setValue(int(s.second[3]*100)); } else { pushButton_ColorChooser_SimpleUI->setStyleSheet( strStyle ); horizontalSlider_Opacity_SimpleUI->setValue(int(s.second[3]*100)); } } else { if ( m_2DTransferFunction->Get2DTFMode() == TFM_EXPERT) { pushButton_ColorChooser->setStyleSheet( "" ); horizontalSlider_Opacity->setValue(0); } else { pushButton_ColorChooser_SimpleUI->setStyleSheet( "" ); horizontalSlider_Opacity_SimpleUI->setValue(0); } } } void MainWindow::Transfer2DAddGradient() { bool ok; float f = float(QInputDialog::getDouble(this, tr("Select Gradient Stop"), tr("Stop at:"), 0.5, 0, 1, 3, &ok)); if (!ok) return; GradientStop s(f, FLOATVECTOR4(1,1,1,1)); m_2DTransferFunction->AddGradient(s); Transfer2DUpdateGradientBox(); } void MainWindow::Transfer2DChooseGradientColor() { GradientStop s = m_2DTransferFunction->GetGradient(listWidget_Gradient->currentRow()); const int old_color[3] = { static_cast(s.second[0] * 255.f), static_cast(s.second[1] * 255.f), static_cast(s.second[2] * 255.f) }; QColor prevColor(old_color[0], old_color[1], old_color[2]); QColor color = QColorDialog::getColor(prevColor, this); if (color.isValid()) { s.second[0] = color.red()/255.0f; s.second[1] = color.green()/255.0f; s.second[2] = color.blue()/255.0f; m_2DTransferFunction->SetGradient(listWidget_Gradient->currentRow(),s); Transfer2DUpdateGradientButtons(); } } void MainWindow::Transfer2DChooseGradientOpacity() { GradientStop s = m_2DTransferFunction->GetGradient(listWidget_Gradient->currentRow()); s.second[3] = horizontalSlider_Opacity->value()/100.0f; m_2DTransferFunction->SetGradient(listWidget_Gradient->currentRow(),s); } void MainWindow::Transfer2DChooseGradientColorSimpleUI() { if (m_2DTransferFunction->GetActiveSwatchIndex() == -1) return; int iIndex = min(1,int(m_2DTransferFunction->GetGradientCount())-1); if (iIndex < 0) return; GradientStop s = m_2DTransferFunction->GetGradient(iIndex); const int old_color[3] = { static_cast(s.second[0] * 255.f), static_cast(s.second[1] * 255.f), static_cast(s.second[2] * 255.f) }; QColor prevColor(old_color[0], old_color[1], old_color[2]); QColor color = QColorDialog::getColor(prevColor, this); if (color.isValid()) { s.second[0] = color.red()/255.0f; s.second[1] = color.green()/255.0f; s.second[2] = color.blue()/255.0f; m_2DTransferFunction->SetGradient(iIndex,s); Transfer2DUpdateGradientButtons(); } } void MainWindow::Transfer2DChooseGradientOpacitySimpleUI() { if (m_2DTransferFunction->GetActiveSwatchIndex() == -1) return; int iIndex = min(1,int(m_2DTransferFunction->GetGradientCount())-1); if (iIndex < 0) return; GradientStop s = m_2DTransferFunction->GetGradient(iIndex); s.second[3] = horizontalSlider_Opacity_SimpleUI->value()/100.0f; m_2DTransferFunction->SetGradient(iIndex,s); } void MainWindow::Transfer2DDeleteGradient() { m_2DTransferFunction->DeleteGradient(listWidget_Gradient->currentRow()); Transfer2DUpdateGradientBox(); } bool MainWindow::Transfer2DLoad(string strFilename) { return (m_2DTransferFunction) ? m_2DTransferFunction->LoadFromFile(strFilename.c_str()) : false; } void MainWindow::Transfer2DLoad() { QSettings settings; QString strLastDir; shared_ptr ss = m_MasterController.LuaScript(); // First try to grab the directory from the currently-opened file. if(m_pActiveRenderWin) { LuaClassInstance ds = m_pActiveRenderWin->GetRendererDataset(); strLastDir = QString(SysTools::GetPath( ss->cexecRet(ds.fqName() + ".fullpath")).c_str()); } // if that didn't work, fall back on our previously saved path. if(strLastDir == "" || !SysTools::FileExists(strLastDir.toStdString())) { strLastDir = settings.value("Folders/Transfer2DLoad", ".").toString(); } QString selectedFilter; QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString fileName = QFileDialog::getOpenFileName(this, "Load 2D Transfer function", strLastDir, "2D Transfer function File (*.2dt)",&selectedFilter, options); if (!fileName.isEmpty()) { settings.setValue("Folders/Transfer2DLoad", QFileInfo(fileName).absoluteDir().path()); m_2DTransferFunction->LoadFromFile(fileName); } } void MainWindow::LoadTransferFunction2D(const std::string& tf) { m_2DTransferFunction->LoadFromFile(QString(tf.c_str())); } void MainWindow::Transfer2DSave() { QSettings settings; QString strLastDir=""; std::string defaultFilename; shared_ptr ss = m_MasterController.LuaScript(); // First try to grab the directory from the currently-opened file. if(m_pActiveRenderWin) { LuaClassInstance ds = m_pActiveRenderWin->GetRendererDataset(); string dsFullpath = ss->cexecRet(ds.fqName() + ".fullpath"); strLastDir = QString(SysTools::GetPath(dsFullpath).c_str()); defaultFilename = SysTools::ChangeExt(dsFullpath, "2dt"); } // if that didn't work, fall back on our previously saved path. if(strLastDir == "" || !SysTools::FileExists(strLastDir.toStdString()+".")) { // ...if that didn't work, fall back on our previously saved path. strLastDir = settings.value("Folders/Transfer2DSave", ".").toString(); } else { // if the path exitst propose the default name as save default strLastDir = QString(defaultFilename.c_str()); } QString selectedFilter; QFileDialog::Options options; #ifdef DETECTED_OS_APPLE options |= QFileDialog::DontUseNativeDialog; #endif QString fileName = QFileDialog::getSaveFileName(this, "Save 2D Transfer function", strLastDir, "2D Transfer function File (*.2dt)",&selectedFilter, options); if (!fileName.isEmpty()) { fileName = SysTools::CheckExt(string(fileName.toAscii()), "2dt").c_str(); settings.setValue("Folders/Transfer2DSave", QFileInfo(fileName).absoluteDir().path()); m_2DTransferFunction->SaveToFile(fileName); } } void MainWindow::Transfer2DToggleTFMode() { m_2DTransferFunction->Toggle2DTFMode(); E2DTransferFunctionMode tfMode = m_2DTransferFunction->Get2DTFMode(); if ( tfMode == TFM_EXPERT ) { listWidget_Gradient->setCurrentRow(min(1,int(m_2DTransferFunction->GetGradientCount())-1)); frame_Simple2DTransControls->setVisible(false); frame_Expert2DTransControls->setVisible(true); } else { frame_Simple2DTransControls->setVisible(true); frame_Expert2DTransControls->setVisible(false); UpdatePolyTypeLabel(m_2DTransferFunction->GetActiveSwatchIndex()); } Transfer2DUpdateGradientButtons(); QSettings settings; settings.setValue("UI/2DTFMode", int(tfMode)); } void MainWindow::UpdatePolyTypeLabel(int iCurrent) { if (iCurrent >= 0) pushButton_DelPoly_SimpleUI->setText(tr("Delete current %1").arg(m_2DTransferFunction->GetSwatchDesciption().c_str())); else pushButton_DelPoly_SimpleUI->setText("Delete"); } ImageVis3D-3.1.0/ImageVis3D/UI/MetadataDlg.cpp0000644000175000017500000000403612320517543020350 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : MetadataDlg.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #include "MetadataDlg.h" MetadataDlg::MetadataDlg(QWidget* parent, Qt::WindowFlags flags /* = 0 */) : QDialog(parent, flags) { setupUi(this); } MetadataDlg::~MetadataDlg(void) { } void MetadataDlg::SetFilename(const QString& strFilename) { TextLabel_Metadata->setText("Metadata for " + strFilename); } void MetadataDlg::SetMetadata(const std::vector>& metadata) { listWidget_metadata->clear(); for (size_t i = 0;iaddItem(s); } } ImageVis3D-3.1.0/ImageVis3D/UI/MDIRenderWin.h0000644000175000017500000000422612320517543020076 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief Subclasses QMdiSubWindow so that we have more complete control over the destruction of a render window. Necessary so that undo functions properly when the window is destroyed. */ #ifndef MDIRENDERWIN_H_ #define MDIRENDERWIN_H_ #include #include #include "../Tuvok/Controller/MasterController.h" #include "../Tuvok/LuaScripting/LuaScripting.h" #include "../Tuvok/LuaScripting/LuaClassRegistration.h" class RenderWindow; class MDIRenderWin : public QMdiSubWindow { public: MDIRenderWin(tuvok::MasterController& masterController, RenderWindow* renderWin, QWidget *parent = 0, Qt::WindowFlags flags = 0); virtual ~MDIRenderWin(); protected: /// Used to explicitly kill off our child render window. void closeEvent(QCloseEvent *closeEvent); private: tuvok::MasterController& mMasterController; RenderWindow* mRenderWindow; }; #endif /* MDIRENDERWIN_H_ */ ImageVis3D-3.1.0/ImageVis3D/ImageVis3D.pro0000644000175000017500000001404612320517543017577 0ustar mathieumathieuTEMPLATE = app win32:TEMPLATE = vcapp CONFIG += exceptions largefile qt rtti static stl uic warn_on macx:DEFINES += QT_MAC_USE_COCOA=1 TARGET = ../Build/ImageVis3D RCC_DIR = ../Build/rcc OBJECTS_DIR = ../Build/objects UI_DIR = UI/AutoGen MOC_DIR = UI/AutoGen incpath = . ../Tuvok/Basics ../Tuvok/Controller ../Tuvok/DebugOut incpath += ../Tuvok/IO ../Tuvok/IO/exception ../Tuvok/Renderer incpath += ../Tuvok incpath += DebugOut UI UI/AutoGen incpath += ../Tuvok/IO/3rdParty/boost ../Tuvok/3rdParty/GLEW DEPENDPATH += $$incpath INCLUDEPATH += $$incpath #INCLUDEPATH += . ../Tuvok/IO/3rdParty/boost ../Tuvok/3rdParty/GLEW ../Tuvok QT += opengl network QMAKE_LIBDIR += ../Tuvok/Build ../Tuvok/IO/expressions LIBS = -lTuvok -ltuvokexpr unix:LIBS += -lz win32:LIBS += shlwapi.lib macx:QMAKE_CXXFLAGS += -stdlib=libc++ -mmacosx-version-min=10.7 macx:QMAKE_CFLAGS += -mmacosx-version-min=10.7 macx:LIBS += -stdlib=libc++ -framework CoreFoundation -mmacosx-version-min=10.7 QMAKE_CXXFLAGS_WARN_ON += -Wno-unknown-pragmas !macx:unix:QMAKE_LFLAGS += -fopenmp # Try to link to GLU statically, sometimes the shared lib isn't there. gludirs = /usr/lib /usr/lib/x86_64-linux-gnu found = false for(d, gludirs) { if(exists($${d}/libGLU.a) && static) { LIBS += $${d}/libGLU.a found = true } } if(!found) { unix:!macx:LIBS += -lGLU } # Find the location of QtGui's prl file, and include it here so we can look at # the QMAKE_PRL_CONFIG variable. TEMP = $$[QT_INSTALL_LIBS] libQtGui.prl PRL = $$[QT_INSTALL_LIBS] QtGui.framework/QtGui.prl TEMP = $$join(TEMP, "/") PRL = $$join(PRL, "/") exists($$TEMP) { include($$TEMP) } exists($$PRL) { include($$PRL) } ### Should we link Qt statically or as a shared lib? # If the PRL config contains the `shared' configuration, then the installed # Qt is shared. In that case, disable the image plugins. contains(QMAKE_PRL_CONFIG, shared) { QTPLUGIN -= qgif qjpeg qtiff } else { QTPLUGIN += qgif qjpeg qtiff } RESOURCES = ImageVis3D.qrc RC_FILE = Resources/ImageVis3D.rc QMAKE_INFO_PLIST = ../IV3D.plist ICON = Resources/ImageVis3D.icns unix:QMAKE_CXXFLAGS += -std=c++0x unix:QMAKE_CXXFLAGS += -fno-strict-aliasing unix:QMAKE_CFLAGS += -fno-strict-aliasing # Find the location of QtGui's prl file, and include it here so we can look at # the QMAKE_PRL_CONFIG variable. TEMP = $$[QT_INSTALL_LIBS] libQtGui.prl PRL = $$[QT_INSTALL_LIBS] QtGui.framework/QtGui.prl TEMP = $$join(TEMP, "/") PRL = $$join(PRL, "/") exists($$TEMP) { include($$TEMP) } exists($$PRL) { include($$PRL) } ### Should we link Qt statically or as a shared lib? # If the PRL config contains the `shared' configuration, then the installed # Qt is shared. In that case, disable the image plugins. contains(QMAKE_PRL_CONFIG, shared) { message("Shared build, ensuring there will be image plugins linked in.") QTPLUGIN -= qgif qjpeg qtiff } else { message("Static build, forcing image plugins to get loaded.") QTPLUGIN += qgif qjpeg qtiff } # Input HEADERS += StdDefines.h \ UI/SettingsDlg.h \ UI/BasicSettingsDlg.h \ UI/BrowseData.h \ UI/ImageVis3D.h \ UI/PleaseWait.h \ UI/FTPDialog.h \ UI/QTransferFunction.h \ UI/Q1DTransferFunction.h \ UI/Q2DTransferFunction.h \ UI/QDataRadioButton.h \ UI/QLightPreview.h \ UI/RenderWindow.h \ UI/RenderWindowGL.h \ UI/RAWDialog.h \ UI/MIPRotDialog.h \ UI/Welcome.h \ UI/MetadataDlg.h \ UI/AboutDlg.h \ UI/URLDlg.h \ UI/BugRepDlg.h \ UI/LODDlg.h \ UI/MDIRenderWin.h \ UI/MergeDlg.h \ UI/CrashDetDlg.h \ UI/ScaleAndBiasDlg.h \ DebugOut/QTOut.h \ DebugOut/QTLabelOut.h \ IO/DialogConverter.h \ UI/DebugScriptWindow.h FORMS += UI/UI/BrowseData.ui \ UI/UI/ImageVis3D.ui \ UI/UI/PleaseWait.ui \ UI/UI/SettingsDlg.ui \ UI/UI/RAWDialog.ui \ UI/UI/FTPDialog.ui \ UI/UI/Welcome.ui \ UI/UI/Metadata.ui \ UI/UI/CrashDetDlg.ui \ UI/UI/About.ui \ UI/UI/URLDlg.ui \ UI/UI/LODDlg.ui \ UI/UI/BugRepDlg.ui \ UI/UI/MIPRotDialog.ui \ UI/UI/ScaleAndBiasDlg.ui \ UI/UI/MergeDlg.ui SOURCES += UI/BrowseData.cpp \ UI/ImageVis3D.cpp \ UI/ImageVis3D_Capturing.cpp \ UI/ImageVis3D_Progress.cpp \ UI/ImageVis3D_1DTransferFunction.cpp \ UI/ImageVis3D_2DTransferFunction.cpp \ UI/ImageVis3D_FileHandling.cpp \ UI/ImageVis3D_WindowHandling.cpp \ UI/ImageVis3D_DebugWindow.cpp \ UI/ImageVis3D_Settings.cpp \ UI/ImageVis3D_Locking.cpp \ UI/ImageVis3D_Stereo.cpp \ UI/ImageVis3D_Help.cpp \ UI/ImageVis3D_I3M.cpp \ UI/PleaseWait.cpp \ UI/Welcome.cpp \ UI/MDIRenderWin.cpp \ UI/MetadataDlg.cpp \ UI/AboutDlg.cpp \ UI/URLDlg.cpp \ UI/FTPDialog.cpp \ UI/BugRepDlg.cpp \ UI/LODDlg.cpp \ UI/QTransferFunction.cpp \ UI/Q1DTransferFunction.cpp \ UI/Q2DTransferFunction.cpp \ UI/QDataRadioButton.cpp \ UI/QLightPreview.cpp \ UI/RenderWindowGL.cpp \ UI/RenderWindow.cpp \ UI/BasicSettingsDlg.cpp \ UI/SettingsDlg.cpp \ UI/RAWDialog.cpp \ UI/MIPRotDialog.cpp \ UI/MergeDlg.cpp \ UI/CrashDetDlg.cpp \ UI/ScaleAndBiasDlg.cpp \ DebugOut/QTOut.cpp \ DebugOut/QTLabelOut.cpp \ IO/DialogConverter.cpp \ main.cpp \ UI/DebugScriptWindow.cpp win32 { HEADERS += UI/RenderWindowDX.h SOURCES += UI/RenderWindowDX.cpp } ImageVis3D-3.1.0/ImageVis3D/Resources/0000755000175000017500000000000012320517543017127 5ustar mathieumathieuImageVis3D-3.1.0/ImageVis3D/Resources/ImageVis3D.icns0000644000175000017500000132061512320517543021710 0ustar mathieumathieuicnsis32"Ê<o|fv2<^_dlI{_bbUghgjzeffqcdd`.a av7^_[)uxz\zɢ|r@ EðŲl 5a/qK[a*L`NչpovfS?DRe#'+6H3/(.0QOW;1797br>I5445c{qK(//0]1*@ +4;&B&>G( ")@@,!,AI<., .:>858?CA<% -1457797 ((".88.!8;<8 9:;CS&./2Rf!" $ !$"     ""#' %(($"$(*)% *,+) )) s8mk#Ǎ=r nG•9X< |. Ez >ail32 E)"tV z N# Ӏހ'MƬЀπ y⭡Հgx١ЀXua`ҹۀcra:Xqcz b`Yށ ]QŨ֧ [Uণހ Y[nրVaу+ԣV{iԂ [A€]ʁcoeU >ڹ}F5^Z50+>uwSCIEFnėl\yȚmNEGXf]bwI޹ġȼ( )̭|€ ȳȲU=¶u! -\O &J[`aZF 9 mUl0~\[]YqY_h}LWmټDA@Qtɲ5y| ~:)9EU}yb2;rwv[9&3=Qr@jewVʀ俀&8n:} т 򦮯Tw D&ob5JS)+Ff 3KrWn{|hD 7eSUzx YiPw#aj|Z Di[rn lLl!# wVnDm@ TgU2@w!8n# 3H#Ia3$2  !+r +}C+&!)B; 12%"$+Y' r:.3:?F<A@<:9U e?16;<>@;1 %D@>@W pLK./24689.6:8CKc 5EB0,,..34 "5<@9#..++*))*,*.53)  !$#$&))$  :;: ;;:; <=* :=;;;:;;<:"98;;:9:;<(bG8:;;;:9898:>%ŢZ:;977878=44|B9;;:688586569:73 [N=:;;88. 687( /;:;:6 h4w3b; 9k ẑ 8;;;5z D%IX8;;;2y41Y/:;;2y Ef!!.;;/,)mgD }%;;*$px 2#;;(ww )r%;;-t D9%;;2v <%:8rw6^' ;, fU* 93&l3<1 6/'    * 4+"%"$ 62($"$'+& )($"#(4 51-++**,-*#/++,.30./,++,-%),,--(,..-, ...--'"+,)*-(  &')(  l8mkX6)s  (? 'g]2Uo|~uHaAf]4 =P ]b"gj,WҘe, 8ಃU$ $MΫc:'MͿxV9 it32ND߂<,‚eʁA'P@؂? 2@W2 ArI,2213#9G2nQ,}4_d _ZQM%ga{cozyzzX]g!2{s|mǂx\fz3/uVj;aWh3\Cɂя3[@1Zρ&L5wہɁ&  3dXQ #_mV3!jYE 0U܂ u3!kYH 5sZÁ}͂% v3"jYTƁ \cɁw{czy3!j\c ajʁw{gϜ3!ja"ρdvyk3!jasaցduzȷwo" 3!jaaցdv{́itcQHʄ&3!j_΁aցd q~ayf}3`׃3!jW&aցd Ns܁]}zбq3!jTMg*΁`ցdMԇaǃ3!jTP[Ё`ՁcSχfǀ3!jUO]Ӂ_Ձb^Ɓȇj}l3!jUOcՁ_ՁaeɁo{uˁ3!jUPg^Ձa}k؁|nsyq3!jUK^ׂ߂hieyg3!jY Yʼn`ƈ_^]ƈ6# re/ƈ]~`yхPca_x҅I(ye9Kgyػbkյ5bvͮvMVoʹiǷfwίxPA^t{jZSUZ]\XU\jy{n`d5e}zi]Z[[XX[i|eXUVXdyԾvdfu~m`\]_]\`oIY|rigjmonmt6hvnljhmuˮtqqu~ɨ~{spopt}:M8[kïɿƽ*:tTqȾꗤ΀GÿXN`}DYހހ<ϻthda[WWat Ѿ}sqomnq}jq!İ΂ Ѐ#Ļwqʿ)ƀ̽4½kVހҾނ+ ƶ܁.ϽD*ֽۀ0 vҸ7϶ѵ8ȰV+մ8ɬfؽѱЮ/ άԴ׿.ľ; ׿;նƼs .׶<Դǹ Zִӳ1ɷ~ԲKϬ˵ӱΫ̿Âā.̲AҮҶˀˀʀ+Ͱ` ѬӀ "y#-Ыفׁ"5ۃ܁ۀڀ πIڃ݄܀ Ճ ƕMقۇ ڀׂ ̕L׀ׂوڃـ ͕ NԄՂ׈ځنہÕ Pօԃև؈ڂ P҆҃ԇֈ؂RЅЃ҇ԉՃ J΄΂ЈщӃCϸЄ́ΈւЈ҃4ѭ˃ˁ͇̀ՂψЃm!ѭ΀рɃȃˈˉ΃QЭȃɌɈ̓3ЬǃƎȈ˂rЫŃĎƇɃEϪÃŽŇǃ΀"ѭćƃ]Ӵ˿Ϳ‡ă(zɽ˽„AˣȻʻ߀ֈ~ѱƹȹĂѻڇ9ĞŸȸ܀˹ކ@Юöƶ݁ĸƇކ߃߀ ƞѻĴ݀ڽބ߄ބ- kз² Էޅ܆݄ Ϊǰγׇ܅݄G ȣҲ؁Ʊۆ܂ܱ +ŠہټۅچۄK ŢӳـԳڅنڂڱ 'ɪ ˫؀ˬل؆كHw̷ցĨـ©؅׆؂ؚ Ʊӂ־ֳم׆؁&Q҂Ի̺׃ՅցèсҀԻՆցդфЁӻփՅց%GɁτЄӾԄӆԁQtʀωåӄ҆Ӂ~͌ɬӃцҁҚȍθуІрѪ!ɍŪуφЀз$ˍ;Ђ·ϸ$#Ɏõ΂͇ζ##Łʍǝσ͈Ɋʄ̟˃̈ Ădžɇˮʁˇw\ǂȋȂʅʾN1ÃnjǯȀɄʝ# kŎɀȅȾb/Āŋ ɹʀDŽʋ#Hāą DZƃɡ@ SϧȀłǣL EÅǾă@'jÇ Ʀj'/h…ÀŸr6 =myN  3Qeyq[C'߂<,‚eʁA'P@؂? 2@W2 ArI,2213#9G2nQ,}4_d _ZQM%ga{cozyzzX]g!2{s|mǂx\fz3/uVj;aWh3\Cɂя3[@1Zρ&L3YӁ~oɁ&  3dXQ #tCwnW>3!jYE .p<jâmg u3!kYH %^m?bZ}m v3"jYTƁ AjlE_VyEZy3!j\c DnlJ`THfϜ3!jaȁFqkV6XzKj3!jasǴFqkC.KcNm 3!jaǴFqkD0=݁кRQqE9 Hʄ&3!j_΁ǴFqk ſ=1=ǁ܁GTuGX[$`׃3!jW&F́Fqk 4v93?AXy_ɱq3!jTMgƁÉEpkJ5AD\}i3!jTP=ǁD́DnkJ8CG`f3!jUO=ɁĆBli'K8DmKdeM3!jUO@ɁB́@ji3H6C^qSncR3!jUPBցAˁ@kc@F4COa\zbOف3!jUK@͂ւI12BKԅYgM3!jY 8>$2BLSsA6# re;]>S…#1BMSyDYDž I(ye9A>Iүq>A[ϩ5>JQ{ټK%2AKu~X~ҾKT[Ƣe8. 7ENPH?512576427?GURPI?E5>NWUMC;9<&)4AJLJE>96:?GTeìdRQYbicYLCAACAACN35IQY[ULB=<=?@@?CJS.r?Q`b]SJEF7$-6AGHEB??@DKTavɵxhfmv{vnaVPNQWcu(,WZ`fhc]TOMNPRSSU[`ڇ8<@Ugong_YYR#%)08?DFEBADIOWam}˼|qjfefjs}gijnrrpkgcbbdeffhjl߅:^1CYmx|yspor8!(,17;?BCBBEJR\ep{jG[utuvwxwurpoopqrrstsm<-7I^q}V'+.38;BEGKNT[`fq m{zzyyxxwxzzxw.uodWKC><<;;>EP]my+"%(,/269<@DHKOSW[[JBFJNRWW D kuutssrruua> ;pqqpnid`\[Z[]^bjokV<   #&*.169<@EIMQQjS :srqppopu^,3qnnmkhggeegjngN+ !%),/47;?DGLMY doonnmrg5Znkjkjjnrd: #'*.16:>BFKKK+mmlklnK :XaY #(,0/to,^`! LQ#[N^qopva "',*bB^H RXV"[-7mghjlo "'&O)P]*SRR!Vssu")y,tutzPTyxyz{|};COH qqt$!u,#urxKZ}wxyz{|+9OG ooq#!s+(wpu@^yuvwxyzy,NG mmo" q*0tns7 dvstuvwxp !MF llm" p)7rlp+ksqqrstuv_KE kkl! o)AojknrpqrstuttuGEIiij!m(Ilij#qnmmnopqrt/7Mggh k(Rjgi` 0plmnopqrp$K.eef i'YhehUAojklmnop[H?cceg&]ecgJNlhhijklmn==Ibbce&acbg<Xjgihhijkl(H6aabd%!fa`d+cfeefghijkZDFFgdb$-e^agcdefghifG8E8 5C #b$Ra^_`abcd$(?A; J\JVXW[+]\]^_`abbaR?>B6 VWY%#\VY)^Z[\]_^`a``",=>@8 3XTVO 2YTVN ?]XXYZ[\]_\U <==@:PTRRV?>VRV=MXVVWXYZ[Y)(;<<>>' ETQV1+XQU+WUVWWXYZXE8;< >7 FSOPT):TSSQ0XTUVWXWY;:;:;<>:?:9EPPMMNMOP$:A!CTRRSRSTUVVUVU208:9:9?NOMLKLKMO#PQRSTSTRI 689897AJIKL%)RMNOPQRSQW9789FIJM,@OLMNOPQRQQ)'7787A@CB.5FCDEFGEJ 03249=? @B@5$ CBBCDEFFEDI 01238<>=>@B@=;<9*C@ABCDDCBE +1121138;<=  =>?@ABB@B@$2001027:;#?<=>?@=C3/0269( 8;<==<=>=>/.1456790489::98?* &.-.--.1212343456( 867876=5(- ,-./01221/23 2353  35665:9&-,.014."52332286",+./0012*/127/ $*,-.0/./30"  ()+,-./+" #()*,*%    ߂<,‚eʁA'P@؂? 2@W2 ArI,2213#9G2nQ,}4_d _ZQM%ga{cozyzzX]g!2{s|mǂx\fz3/uVj;aWh3\Cɂя3[@1Zρ&L/*ǁ=*Ɂ&  3dXQ #K}@%с33!jYE ,Í3!jUKÂ˂# FM_r$3!jY Ab{6# re <(?j)I(ye99oͤ[3ɝ YҴ87p>iİx" ZҹG &$('") !  -;GlfH5/-*%! !$%#! ^%%#!5JlrWE=:6.(%!!'$%'*+)'#! !!"##$&(͇ !!(++($"!+ByeVLG@7/-*&$"$'*/. , ./0/-+*))**+,-҅L#+01/-+*+  Rwk`VME;542/.-,-.0257$&11223210121[&&.2443224qpnic[SKB:9876545679:;54541,% "*046558) HVTTPLFA<;::9::;0065676541,&!"'-2589::9;7)@><;:;5$7761,.4765542.)%#! !!"#&).4661*&!!( =:;405 77- 5431.,*) **,/0/%  <;5457-644321013/#3=;4/472,54345/)>;456% 7471=;0(46363455!<:; 46- 535.8;:;%336(5336'1<::;6*36)425 *<:; 34/45#*-*"<:;%34-/ 5-/8668.;9:;4$4(1536745 ;99:;-5 25 633446 9:; 25 122563649:;&25 122563519:;114 01106235-:89:;8$14 011.2336! *;89:9898876678899;)14 0//* ,,--/4#&953320//./ 00122345689:;-03 -,, ( ())**-!0--,+, --../012357: /03 **)  %&$''((*,**)()* +,-./0135  001)!()%%$ #&%%&(*'&' (())*+,./1# 00/..,++*)(%"## "$% '%$%&&')*+,.%0-,*)(('&&$#"# "$#$&$#$%%&&'()+$-,*)(''&"$##$ "$#$%$%&'()" ,+)('&%%$%! $##$ "$#$%$%'(!+*)&%%$ $#$ "$#$&$%%& **(&%$$##$ %$ "$#$&$%)*& %$##$! !% "$#$&$%)*' &&%$%# '#%$&'%)*& !$&$&"' $&'% ()& $$%  & %$&'%&)&$$%  & %$&&% #*' %%&  ' '%'&%%&*' %%&  ''%& &%&#*' %%&  ''%&#&%&*' %%&  ''%& &%&()  %%&  ''%& &%&#+ &&'  ('&'$(&'&+ &&'  ("'&' (&'*% &&'  ($'&('&'%+ &&'  ( &( '&' +!'&'  ()'(&'(")+))  (*'(  ('('$+#()'(&)'(' )+* ('( )'('*) +$(')"('(*+'!)! '((* )()!**,% ''(*''(() *()**,& )'($)'(%*())(#(**,(&(''))'*$)()(*+,!(')+') *()&* ,' #*(***)) +)( *+,*$$))()""*)(*+**)()* )!&*)()+)(' *()*#+)+*)+ +*+)+$ ,*) #+)*)'+*$&+*)*+" ,*&&+*,+ "-+(%+*,+#  ,+'%+*+-,*()'-+%!+*+),+!+*,-+,*,+,),+,* $,+-*-+,$+,+,.'),+,* !,+,-" -+,- %,.-+-,.%$,.).,-%!,-.'+,! $,-,-&  "+,%  &,-)# "! t8mk@E.lW@ f l. k,1e4' N3 L1M|XA% gC$ eBj犕mP. 8sV/:ai# a_UQ'if# xP᛿IJtU1.cl'  y  s[٢rT  Nm([a͞g~  62O:Ngj1 bΑWŒm}ޑQ4  唼|xΝnL+ ة`7 Ùġƚm@ 렿ŞƗsE" 뛺ƙۖsD" ꘷ȑ|tȍi? ꗷȏvkÑΛvY4 ꗷȌxېaF( ꗷNJ󩁽T9 ꗷěɔX:  ꗷîϛhF' ꗷò|X2 ꗷĴi= ꗷĶsD" ꗷķvF# ꗷĶwG# ꗷƤܜwF" ÜrC ڬסʓm< >gy|wcassdkj83Upyndgq|sbRP`p}n^SYh|:$I[ ",340+((-12.' &,21+%!#W4 ( gJ4^% =e* Bc`+ A1Z( ~;Q"3g1zCU$g17x?nM[( i1u:'E9OCW%]_* cf/ dm3dq6ds8fs8mr7ep5]m4Iٝk21Кg0 ŗc, \( U#g孆L9ר}BƠr8f/ fⲎX%)ΪI s;jⵖb- 'ʭO v=DҴa- 򾩂L YԷl7򾭈T$ YҸp; 콭V& Iȷp< ܻS% 3￴j7_ȸ|J *ֻ\.9㾳m<O쿷{J!  *gùW+4zŻa4=ʻj< DɼoB  #IƼsG"  &LûuJ% 'L⿻sJ%&Js־oF%%FnɽiB"  !@fܿa;  8\ɾzW4 /OrҾmJ+%@aֿ|\VmlT<'  %7LauƿuaK6$  -=O`psbP=-  +8FTamx|reXI:-!  #,4=GQYagkmopponmid]ULB8.%  !&+/244555431-(# ic08C jP ftypjp2 jp2 Ojp2hihdrcolr"cdefjp2cOQ2R \ PXX`XX`XX`XXXPPXdKakadu-v5.2.1 C ֟dUxE4iHSMB}01ʇ&*tXnD:<|Nn)06)O!ĝ%|g \;"-dsI\t Q`=<^CmT*Qq`C!W\E~҅q\KIҠw*5oJV ܋?!`u&%@R35Gj]ePM; Y4IJ%]0ߺ} -O(L~y.+G_щA vI *#Ɠ p8LRǺi~Տq ߗs$ [ScX@($^FU \pTj>d ZQNHEGD8@ޕ hvO\\{k[H^z^Z$CsЍ?(cU>ˁ.|Uu7z1Z>Vsj3[Qg(ݥkGpIB:y~pqs ZNQE 6$И@ݦdM׭  Hb0H!H+V\:2ۨP& &ѥqZZe6؈:YNt`$F8ŲCE-hsa.R6|U@;aͥ5_䷏Ź+$)u_$DX(8>-0w,!,V44_@j?ݪZb7Z($_S/ 8Q2=tľ;%t dZ{e,sWb%wzG(O AԳ.vlXڎYuZ (~H2 bes{ 끏.r(qNз` n5:z[}yL=;-w};'2u: g?TYLNr?Y;9l?`TNjghEZ(G.C$xE7ֿ(Tص:C4U|V')kncz/UǠu3, 9!|w< jRQ; q_iڼQ"­!gP4HՠQۅqu5U>I?,gKJA߶ϱ:K=qƅT43:l_uHS?SXZ%׃ I{>0Х{}^ٝ=e=lKy0"*|,q{Q8C4[]\ݫ}UbC.#M}P\=I_})oܱ8\ GES(_N/!emSCCxOu|)v<Ÿ:mOyd/L@Vٌ(NP4ɕ] ~t ~Pxjo >jsKKBzuwQ3R vu{xV7agcGq6eɋ(|k0{-DcW&7ԵT:equbċ|;}/t WhF">?lnL>v"el0K5wIb.ufh$ͮL s\"ȴY:O ?swS"d ?u' +>&y-RV&9ͩKl jwG|6%$!{޶~c) 9'Z5E=R9dI7Jpw:j_\;]Tqe=$'f:\ҟ9?1/PT"5^#22;mpӸ^%!|}(AILPHq>+~e}? g ̚FhmF+F:.unF$ 4G|9`@]!?֬/tSFV8mT 5{!8-j?QpFyDGrDD#wɴ[A( T]9 X{R >L!p{sLp7Br+4 _ PyEAN2*@oFshPm4M? SlD]VPmKPR~ٹQ?-{ Enάk? ׋CZ.j@@р2*;sJL̽0(hA*[ 6KFkp}Ezp -ټLBPtFŮZ} 74S ^EdWC>Sֈo{o\ ,sm@„L=]I#6wWuK~z d46p%^ewM ߶!KHv_YpwU;ˏt=:(9bxc9:H+@*$:G;NŹ12jM"QM0C;ow\V<(\agkpGh^;pN/hxX6yٶ$|IE\NrA-3MFKYSL* @Pm$rtƇq%GEd=/.XBi&H#PكٖY|xT8|~@")UyJ7B10rc$ ?a>10@}mN$ܒEYA=@k}e6eJPFc^ռL;`-&#Ez7 /rC2<ݠvz50I]L =-È̃snoU> GkSQj \~~M;f #xUّŖ \†uwK䭬 &/!ӯFӰk@WEsAl[DC@_N|5Jw5`ҿ!"X4ҘLt;the=RnO a~ gO q0#0OI6r@7Iɗ0%<+M(7o-erNl b(1k(nyg}G~ƵJ3ӆ? )9A^~vyo8MzP2Q1İaFwb}}P7*vNY6yDkj(c y_šqAVe7Y%`F"M6ۘjY|^Y qVÇ^^ "Pu~ aюu;r  0x-Z k℧_-δՙpg֐rʯ`3\&)s.nJs=x=0-`Y$?vhS' >>bMQ.ģg8O@( >"p&G? +YA+=̮b>xtMD v9q}5~xH8;Z.vt^'jqU< Ԥ I%mșm*]]h1Ho/${ű\ϏrUi Nk<Зk!?̚W xD;D# VyG xF2!jߞ~vjQ)$O2!֒~X/Qsú~{nX{W]%h)+جQkތ ?v;o@l%4QI10l?<(r]gK ys2;Q jcw:ƃ`AWi 67C0@,;YI bϊƹ?pbC=UpNPlg"Q}4O3}-ƣK&KXQ=SҹתL7?m̙H/jT\A*{kQh|&J2c%MEG_-\=_nBP2aMD!N7&IAI @VSf47m[ HśZ[*A6I6ѫ :"Nkhe&u$Xl~`;6oGN&nw} fd/hʴ)mQT!Gd>mky>BwB8u;@0t.XJR)٤Zba3z]oU;`<FttT}ə @xKw̾I=ڊH# wxO7,0{TUx^\kUeW( R?>PtY E=9q)/g 3o ?f(䦎uE6/|1(+5 /10gz %Fc5oiRy?-'rŲҋŃ4 Tr>xy j 2L;]IDǰ N;~sFG$eyOj2f}m&“u _gE%tD K'*xC5*{l2tjG17m܏rmB߫W-[MLh;NJ/+Иy|!ݸiS,pl78#be %iשoQ:EWff4::ʓ[l߁/1(̲^:?_Qh"CZ,JH[F<8s:07Zʊh&HDi%j#+$$j[RSj:F'Iy*GּY:+0:i]UiSi *a y9qoGk/; >Ċ-B?nQ0hV5&M~IB]f*;剀=1+v_9nxJ"Pk*&ڕd͡<-n>F.?b0=ٓr;B\2]~_J|r߇ɕpX`nC4c-Ndlob́HfFsüY)[ oܶmyR嵿Pޥ3ih{M 11cCR$zU "vkՕFZ*:lmNS+g)hUW욐/2m߀Ӑ >5Mw>(vbLF yRwbxo!=O3ąE G-Oks)&{ݺD@IT(.w. _# (V}4XM_!tbMY3Xՙ|hSJU:NӑRr|Ҥ7Q\݂:/ǶHD,J 2 r,dBH FYPpi3'^1PxYЃ+jE4Q^|/Riq?mn:xC[:΋ґ[!(FiEPrt|Onc3kpȿz6!Bz X)2g:,.h6/_Ih')Zޔw|d1^b#3Ky"$-^o?K'缍I\+E?<%y*sʍ2u#!Tԡu6ӡpٻȼo%p(YxcW/ bG-_ՠق.AuCXM[aG0`y29FkԮ=P,%j4]K[sYK$DDMBE'drY=G7vgW?5]=lk)ބ_Uu?C5>FsV0;ɒmVp>fNBOx_WrU~Qn#(יWڔu^r$ L-pyr :s"T[l֩44Q5B o>K; $a@_6dܜm$I$`h"IAȩvPm$I$~Z}m{Uiɭ'%ilA>ϊN۝6Ϛk} ۈӟ+ 餟R@;qy4RDh7OH+,KK!wM• o( w=Zқ"S8Ѽd&3W=SGmuRzL|B nxyTQIC?t5EyCܜQ.ӵ*0Iˋvn7t7tQ&h^23sUM\u3i"\0ɹ-GZ SUmtU5q kPqUJ~ex y؁ nƮ[zkpnM}IUY]զ fW&&W"2qH'kʛ]C<1` Ye#ݸPpY8b@drBoP#_ )4LzF`WQ#=lʁQ]{"{>i?Ec(m0p8,bW, ֠~7(P_NK /P#։1wbe:X [Ka Jx(3e?Vwk?([fb願4K9})VqA .vbPڋA/A"+K pEvclA[t+75Ho':JZq~d %gITklP5Z̫u-1=LTwL|E&&+9.P}R^o$6aχs*ugq'6g}H#d?x/ `s]I!Wf0J f+Ӷc3q|T\a5V hW}=KʖgQMj\N1Lט^`y.FJh΁̞,^v6 _z_"-+P!B3(.3OjPhzM(vrk8@{&P֖ҍY8<db/ $ݵ[$#E\+Oͧ-$1Zƥ?Y$"+ޞ"vF¥&Qd"[>Vp|x*k%I:'bq!\p+˘~lhfֲRž3FE }~[y]qEp 50*+g ŵ7۪1z6N]BDĪĘD: -gdh|Mr=+T0ڱu)sxǶQp3bq"̄Wã R|;)?/mP/FfGo7ޚPڭyӊBC{M$\XN>2T^ evuD kyu!z! AEsǞ E^%qhӿw'dC4L279L՚R u8.g. 'Q5@eXw+#H-sߵ&_,yzw?鬆57 g3|Y!n1=k Rz纀5HaY]ݜI]n[;&qbI }Z xa |P/uY"fQ'|_4P;*4łgLIXM1y)Pӹ lSL),h*=OHS|- JŽ3!%ZI7,0iRcg;!lXԬ7 x k2\R֍C ]1O3B vz ZZ2H+Rx$ Ci_R{hs'wLc:qhaW'7]}OeY0m뇣KkI|Qo^8-GX ?s3$PnLM͏ǣFc,c=Ab4X8c8<@ԭĖ(uKc3 ҒB ᤯Tk\&k7m;rē:3xb ғB8ź*eSf>Z%;o~oQ8 b/br#{IȹEOsϋ.3}q*]xu=`T3qPcH1(8b?; +<ħ y{?՛M`m O=tUCgjI<훠T헟B#ҪF=:nue꜅S[2&#/Ww ﵎H }p5(6Z51ΡOOuoq9E+p6h mh=aH_]ggv WY((hgҡ13ŕ`3Kᵑ6*oҽomjNYTo3 (ӳ촘Y2>}K΀6<9Zs{w6<̢XNږ~KRhԦ~ȾjqȚ[XD?15;&7;$АPG8E[8|KT{/ʈg'+PVRS^-Y̚xNՈNO %,G)0}𝇿!]`jW08U j{{ hĦ0 TfԬ+})kz;F;WOcΟK(k ^7& Wû=oݧfqE@W4ǐoe[sK.,c3.fAl. 8׊õ܉lwT`+t{ .? :+_.(8FH,du^>Yoz< ^9nb ΄4ߴC"cY2T5F ^w4QwkjԤ–YX)Ŋq='ʙg< ήhLH9Y{O̊`zG]s#c6neHgX[;]7_&$VKb\4j>B0/yިLD|ٺ_)avt th BSWg%ܒT{j1vP$(ҖJE$\)t_nپr-'A}}9eG.QCgH42C) mo|%[ɒd4v]GHpq|&:0A-fpQ~OWåSxVJwrH wrq)L?%Pri,t+%J"$%XS;ފiHi]KLIBvM>[5'(g'TWvQ_bHr Yͩ8H (c;Hѿw!B;,}6 J C[u7i؆K,f`奓>L?5^3j km#R7giѲ˛MCC]C\ܶߢ)KkSE!(ܹPZDgJI*n`W~Z03RPs͖A*#C C4N "LfYUTc`zۜQOS?s£tLb~mu< _ vQĩ}@*E(Z[-V9hA$1č@|R~ǒ #ϲ!cCE*SN*4Ӆ/;ԶO sp WwAE߬ A+&S('B}a,FNp: ),ڞ z5"П9.%=:˃܉\J< q36T1gDH0,tD">Jрw?mA'e{K]JYcTQkm0YEl-h@ܰ yo'LWA^V"[yF|bȂvtg 0Ru6iJ ]"YnC'qc @*UpnG=s8(+orUV2;Ԡ&OW=%|Jy4~۸ȯ7FHV}9g]^YY,6J`?n v"YR7lEᠼEyzqaiEɗybư"iڒYH$/&*4 h_޿X6F=^Fs1{a*(0k#AG {]ǚ4[gstWoZBNmk[7V=)796 pfޱ3zjY^b^h Ff.QW7U} BVH&lHR ա~MB=1s4ܻh v~ukXi+gmjc=JJ,8qq%^E#Ǯe%ؠI> A3Sji[N?!> ȃebv⫐۰(\4SPd$8UI+sIG!D$(%@n8-*ݰ,%]x_g8!4}ؙ^lQÔp28 (<5jL\Aʹ8.GRe3Jq*^OV'.5D]I.> 8BȒ& TVl+=tG^Ť!e?\D(2u4EYhr !b͙I/0SuV-p7!xiFKzx+aaȳ <[s#El Ă3a_+P_= x .JpuyR| $4+L~R#zmW1MoS;j)3.WYWɃѯZ\Ù?Rex<,x.LIFHO_OgݤϣZ^ 9S*;|+Tr|2('w-O0˩MK>0,dw \'o |c"xCzULI/ oX ؟ FqZ#ܕ@) =&A7B/E+!8T|Q,_ zтdSВaz{Vv%gnݭ N8D.:MN ) mfv?p ]GO_'SB9)x]gڤ"WwƙPhרF^b.r qOȁ/Л`2qJ(FoA#2ů]$=.I3Tr/b|gk'؜7("f1H^U=<4 k:y7ui K{\c )bX9З{eL9Ax*ҖX{eyʋ⺰(,9F}M2_vxIknTo-:UdGWi*3Ύ9z~NK_WzX y=UR42.r^YX3DԬi\&0v:ոs'S cFHuz}x}MEƆ eoM 6&71bE1'h@Q0O n v ϶/bkš 33ꄝ19Nd@ngl <3a`5{F m CK&˃|i4jSbUGe]oQYYsiG՞$1c 0I/ݪgۆ'RUdqwh SEb@{BQݿv؀$JfS%̷w'3FTB+W헟R1Agy(yN`QQO)M52T;m~ֽIl!ۧK%5RzЋ? Qj`SpM)[@$̀Npgsnu",J)&8qN㙡^Y[Xqԗpo &T,Y͙pvT2'uڶ ? v ǭL7ޕhNh>wC9>^u=zw=XW^qD=M& *G7N* w@(Ah1b: y68RpDOߞ\t=_)9%xƞ,qVX3v-oKD@a W& +y}Jr0W1#+kR'cN5ye*ds?A2WEr+{KXFIFБnLFV=*e@v,.%Ս :Jq 4]“>L=<5#75|±g^I@k12zCz7ȍ2 ,Ma?d@MY( ˩p,$k,۰͑ Z6RK%啛G6ԥ|?2vIi1[c\x7 k1%)Ξ:zw#Kp*2A`<(Yt}}?I*h|= ]Lq#-rHM2t0zWMIWISӽ/f<Ş|Z*R i."Pq|,L`bqg!ƾLv5xbS9|t##Hϳ ~15IP~]t$D VKM(7b=eΥK pvgMqPRW/> e z+A Fb9J5߼ Nfw4;o) 'bk=F];,nqJ[vFUps"f+B:w* :Ώ Y5 &YS5U4tjd;PCd[ kZSFUk-o#M^o!?QHhEYxR>T JlSm#3& Fbu5P8=5g䛩AtYP{gBchMՌ9{c;iIt8m3Mɰƪ\oZfi sO$/c2,HGŧCx7IZ,6$_IDgOlC~˜mٞpE`4e "FA.Lq GN vknWzZD.Jy7B9=`J-$S'0rP^.꾶PeEA)+,„?UP:v ܎iħ>]jCOH‰CRMej7^⛘|*5unad9tG-hI6 FI*Bm;eO=8y"FZ| a,/ޅJկe;@ 8| 1 gGU-e\iwͭ,i/m(MƼD"ϒN\$_t˳˵@TvxTODq8?0_-(A=SXr;qm-ʃkX 67r&O娋')A' xZ0Z¶kP݅Ck]Đ*h0vz J m01N.ڹP; [(}8+rwc'IXy 9f LR\%N >)8 ʞi(zq;L=lq@ג/| $9xxaY\}i'K@Z )h^=1g':e@nF)kÞ,̫0z!yFhu@geo3dΫzUq7_]RQ&7gU~]i !wz]`x7!=P.Dh ]['ո8gD@Ku3٨'\j4GU2Ca:͕Ibg uB_Aq*hZ!4JW 88:aw:.?ph_Fp;K3)Ke &v@=qqڣj`他o2X:?h˓p<RÙխ%/'Dͨ<: ptLJGx0>ZeT9%.ψ HcxԋmxD6nL|[7xÚ"ewf,`s;':!j&G"K5g:յ6TyYJ|BJPb͏]P>VDzۺNԟMX $EKA}CƬM ۿ#T^d80+[9FEpdG062]]73r}GP\h)MfdQA'NVYVЩ-Gk(xK Z3(460h_Ȑ0n"e77r TQSA-խ.KXm(:YK:뮄C&]x~#vC!3°r*O42tv}ete }3rϖx[zUߞ\!wIwװ׽0OzXIwFV梐 8#H2 ѥSJCnuy?_u> %r{7%+h:dI/o)}Fo5 aG ;*Vgč/oL6&4YRy(5$2j|(ȳD~޿~&ʇzI@W]BkZS8ZL(VzkB@o]b< X3 ˻{;#+'߫P1_]eV));@'!$ 7jFU /ꋔ]%o|t/2RWpT; CؾZ|:ϡH#:Z YG̶GNWvNNG0&fsd^D~Uq*I>}Y mnT_N3Lň>TѻZv^IS֞(5@/A`-rQմFLnQݕJ/Ҟ{LsGyXǓ~JVVuS:w=I7 ҍ4/ˆ4 S.[!#,e6 LlۻntWReyШ ΰ^TI %KFv:zj08E4oCVuӳ'&:rMOf~J4ƅK bHҗh߀=ʅ+d3 I;utM؞ڽN+Zp71Y/*܎N݈&y^6_Y ˴edQIF'0KK4Z~N+dԳzzT 8Ơ?鼌E ԥivo2[R=ۇ/]^6I:Nfy.LJ덱9A+JKI& (0'@F9Msss]8k,#sV y8mR˿-{Ug.7F@q&C`qYl3Vn0·H P.1Hf`rT %S`mxɉ:`4^ 05s=4Sj. ìu̴c* $D<ϳ$u8ч=Tֲ/ e c>(8j'Ӵ8Uwx$zc bkG ;ӶG_: Ff;daݎ}1ᩐ1ruK{β-ܢ/aFmY9^{0!7{Bi"W"\Z1[ibZK+WQafSq"\Bhb1PCq`C*M07|<ϝ^9Ёwk~mGAh"H6AsA>N9:qc,qz֥KB6'WC(j@kg>>4>8'D_dPUP;G6 g8^ sy_ڐ!$}]CX$ HklGkk'#U#WHuE, [-?u #ʷe_hR"WF82h !{ddys&処?y,T tkϿD㐸knR/c\ucƞdX_B8cͿ&?-H O0K/~C9zXSBzJ׈em$hm'^FN#F6."`n?2sf&K-E$aCĤĐ+¶Zo wja5ȫyDgw£80rkMG|%Iɼɼ1k(A[ o6*|rlIN>awX:)-վcͽ 7 "C8Ora]T1m$:H >3(ҿcvb2T0 ,!F͐B4~jֲ篘^B^v'F)wx; U鮶G:z~S}BR̩H9:w!1,}4!*!qnqw‹ɤ'EhY8*Zɸp+%顢V2}1:'xF_?Ljx#@ rtd7HF~ }F+!F6@S5LyL{>"NP?r Xn ΄a0U~C4ϞL[T~qUS@ n Aқ~J׽p/ &َ֟ 'PdJ{(1Ca6mD X=I'a ovgC^,[2GV ݚ$~ I6QANvɁmjڟ q әoa!Z,Gp &vzi!ꛚZv:]Nn&z&72w,Ȁ$,p4FşTyj*V9bs%G{I3 =mc%r"'@X< ,*YI}aw{^?b&lE3g̷7bƲ"rɷMOy\ck{iVDdG'!Dւ{@sBZ%fS#˸3)v+65AX2|(=tMVj6pc3{5*&w.xt "A[:v, SYRmlz1|  Ni g';9}g${0ix;m`t9x9%OܨeB$ :Q!}3`$aGʮLztDȡ f-{QEged2a/6M/ȏC^fCИ6>*<ĝc~W(ÈT ߤ6 *eK9f\* k/PD\ƤgZZJc5UBKTj}ApOϽRO2775OK< lXE*lDZKdtKm8 Rqꋢ[ΙPںz*֏MS{$uϵ[2jFp(wpZ%ex;V {/;dpt M<8wTT;D$g 9a<eb o5 N3BL?1 r6ȼ/땱ᶺTIE7D>U+(INxNu=d.Q[:cW61HWi~Ym/&[F90°kmkRp Ծ_fKrX)Ljoux>چ("${okUo_a^ʯ{R>4f<pD 0أ/l\QGmr5% u`c~$ u(ݲL!?QnwNOv ()}26Bى@-"NW6+U{Ul^mnrsf/y$2&8Jݓ,SRDzNܤCj/D{؆ZTbfi˒ R&.V<,_y0IU"\vOeC⪁짞p}pΓr"Ө;Y8Zv*ׄ]ߔc=]q;!.7\&z& #07O$s-8_:Xoli%rٸZ*$FUվI?q%=֬%34(<W,8< Uɓ乃{7Vh IUd+iֵU8|{ ǣy%Z$X^f.O*9};(px ř'ԟW$AovNJ QIfOuEFߧT:(HW-vMkEZ] R߰kD h}lbץwyٓ ٔ_]6g˄8 ve,W@|g ΝvJ]8.-E9ݰ}#* VWq4~EGbFݤl6:R'@qT_ 3&Ro*2~9t5] J 4JXpa! 0MIyLjwm׷ĝ bL58Q.q9ܦ77+O{f_إ?=LLsiGHHZXS_.ʞ=}uL}7az{]I,\/8ײXD Y6xc 7Ԥ^urWBr e4?9%|ѴQ#mrCQŀuaSr{Pz0dZDˉ@Aٳ\vṯ^P ]2{,if4-&A?}S~>G&ʱZS#FUNX͔ebK196#2 [ 7lY:Xzv`\(r^'?PחnZ.VFmUv$\}Y71f*NumM"8(Ejr3Cא!ͥ(Iɼs:g3gkh@D5g6L'b;r eӕhWф i{knu65 Lt7<ƒq}lMyRpDVic1Z۷Pɴ@Bδ(RNcaG%^[jͤP|`ѫ!BM_7#* c7\^*H_kt)iwݳZ4ˬeX ")>8{VU2$(`f9dj>3Z.#YT;=(DȡQS/5 &HQ$yAԱl_ pQڎ x A7cW *=KtUxA82J. vuo} '[s1QrN Ԫ!`)d opP{YU{]g?G&60,ڔq5 @Qeo~ZtQFر8o<> něظBHMGDL (ĩN %Í"܀aϕ[ϰaF,m&9Qnux_b bjl̊y4g |DI)ּ 1V Y'M;xcŶ#ne syDYղêīl󌑨gD6Aqg&@!ňwU7ViO~lIX`"eHIg? 5BPL&{EGi/8P9";rr^!^Vd_Z ]IhrR{gUϡ-DV?K3U!O|=7*nD>Q;(y$4ߝrv,6ZY>]sB2~ `4$I^ialb#$' }V`\OςU{Z|_[ȆUZg@ʰFN$}չ>^}yZ]H0WUGs)LKjdn<;J,tKI@ &ZCeɚ8Pc>5Uc'sn[d(H@GXk!i#?mmmm`+ʴЉd2۵ YP4 Q6i +M** _|I$I$I$I$I$l ?Tǐ F ,k-JXez1M[?2)nA#sOv>_l z$]AoTFb[f5Jz+?Y=X~a꾯C,}~0gi1&BK Qe|@$$yFSk 'ґRx2ԃd6 uo0)?ܤٚ]g4 @\Tޥ%|;]&r`[|DzO(n4_,@V@1ֵ֙j^OR~ْ_\X|Xdve WMy.6ᡭiήQ {MbA$|͍tWAFj2LpT.*V? rd"DL)z'GX''_Ҁ@&X`v4K Xw6.NA`{.ˆB{QA @"#c"{ lYl#vgԙruLaD7%]g6An&WRDk/_ZQ%x3p}!w0P #Sqx A3F'luɉZ9 p5!zZ`lIA23NZ1zLp+3=%G#C&#(#ϧ#)`56&c >E?U9ױXœH{cmoJ8O<=-fhF Y/|w)YP>)X(仩8-\3\FH q#K" ].v]4//ַI:ApRߦ%$[]f|~uC JE//x&H0 `ԜH-E+S6^ԏ9 WtX_QZtĔ 6AxȆuMRrzm ((?}G:T:Jd{41w⊧ecn|r G&[duZL256п!S> ?˹ J֞rx{¹5 = ˻yfwL"[+ o3Z&W̚Hc9|i#d< KL }ԸR7ҥ VFA!7s R&Fn‚}`"n{ 9{g5"CV?Іr{dGV>rHw!~: ڜxF5{E5 FuWqFq3sw6..Wh Y^=BJ ! 0*H4`>{0&E(0BpM6zVeᚆ~Y9LRIXOkO-E!  /xhVK2ñUڧQ<9ܴv!Z|+o_B֊"-P"c*j5o9yqJf- Z2 ҋ9:Mx7&GA~"!d L'LA V (223EřjPqcv|~Q\wQykվv:#Oxz8ZgF7_snXeg+Tx?=H!|%Wt}Lv4p\صZX5gd_VAm tIZ_@6G\;I;rۖ:fȅ4nVYRȕFl*. d|Ӑa2RD`@a@1m 0n5 OQN#7xծu.~ MtQK来H46CkB=@*"'}UXƯ(ģ_˴pU >S*1F>мخ,]'%IB6H \c4)X3){[˄.K?'{@~n@aqxROZa.%[K?b3#]v ^DnV\A^ 4VWzie:ԺzMPSJml"HLž@&žcuB_tfU&L>:`>:ӆ{)ٷud("^̾d /:Mwl'$9[t) Uҵ2FUMABP3doMUq+8 )_B\?߁[:nG3fN9E=Di}ܒ.j*j{k-ϛ91$OPCBxC-Hb ҉C1m{)|;eܧf.9IS~Z6#g~[K 1{mɡ0,:ۍj0iM~$ڜ-̺Z_dpϓjYizŨMxu8YFr .2iEן|?vDZ1VS +VS#ːE:q=1ja٩h]nlyI OfMHO"`G}muv$кR!RYrFXfzlA)5Qɢ0*qs{L)+Qc#V(/ܴ|qƛU498 vhcu{\PCQZ;ɔf(F+)fQFoL ]f } mi&CN$ohUZlkܝG]Ej{PK2D $@L3bV$u lAݕXԩ>OZֽ7!w ɫ{%CmXFi.ƔCu]=*,n9s'p^粵<4Gҳ/c2 Wzqgl'L\g\4*WqgŬe2yUZtŏNMrǟC\5]*?4gWPA6ah0%hhW͚?bl~,w GBjn⯆*3_ZO>)ƃk?Mf(TŸ=ܮ'a%0udos*,&Z5#[K1V3s䲟; >}*Tq c`%MnE ;؁&Qe - S*ĎioŹ-^%5Xhہ>VkwfWL&?TF*1@M1NFmKB> !6Ns_\?0MPlݤbYK;>T{2rgΧG0PJs",XvCđG? L+S7mUgwDW*F#mZٌway:k2>#Az7G[ڡkeƄ2TFi[^tKlcMtD+X OO-9:Pq.DTƬpqݵϝ~zVH"Ψ}&%)}b.gZ8~X씊c}I=&.m[mp޽3q[hƆx.Pkrx\y'/gN\gž67xJ28hhl40 'bO$'6Dqus;I=&E.fbj%nAZ\boTkۙJ\6_RI G}w' nvӆxl(Y2]d^:h{.9V Q᭥ix⇁9 చYur?mUxrUK=!mdzTX!s,^7n8ҥFm(>{C[IB6Q`4c[>$}/Yߵ:Ѫ^~AƕՖg)yug\7N;"ʨaN+Toh1P@7:y/^̇HJ;u[GƮ Tѥ*Cu-9KEAz65Q'*ƁjI{<@ kS9Kd4l1m;p8oJյP-@Ȟ0Z).aL)R^{fYD=4(Kf&_ իnfoB $r;= D"1L 8́MQN5g<ѱ>=.煹<1|+MR<(@1b+nʤT臧p.wce>XIY+df9P"N=O٭t#9p6B98FV%r,j#}2Y{RrLJ(#%+..&/þ̄} pa:ª^-Dtz,o! <;CO'C49իF%tLq ڼCGW(y5MvV6XxBFCz-I'ea~ĥ9Gol o?Pm !Yi?*M: rR@?|f0256 v}0S\J.V?6{e/Ξg-Iжq+G2.z+(ewkCf>/˜}=0&LΆX=$9޿P)HuY}5OY̗9ZdP}\O^ ^D4lJ"'ńgeCyU2(|'K*Ro¿%mض5eѺ$T`7jCiݠjIW8RDMx0/*EP{nwWGZ(U:9hսjed7'Z:xg77F!B6LMj){</\' 7h<[70+ȜfHFAϒ>WY߯ZuvRZnϹn\6;+J [&*0+X9#beϟHZAuhr;O|(&80?@)9nn[pU&ryZp`\ߥ$?XC}$PC_o VE,-Q9+yQNrJxGzPSom$&{EWl@ gm惴746 U4cz vۻb0+A`fxSYm~;\ۃkQa[P@K{ s0@ _9Z"2|CNQVuGxG W;>v MϨ?G)E@mrӛg~րhZZ?`;ޔ^AKaT(1@[ 3ߪ3% sNkM+|;̓ DFy>Js<87"3(AB4S6]Ï9 ͼv"f-FԢ C^QrTܛCBJ8-fVeaDjM:[yWg\3@m%BA2mPy`f~wPҞXPg1Λ`ZEF fݙOUi6 \5SSCZ?8AG5/$I%Ivl>r:@}qN5 9aV`?)ƳB3w>뚺ֽqc4$ Y+Fz)PLгV5|8 q\bXrͤk  R1[) Etdm>^V <0MIY J M9 2V1:s@o*aURIe.,yd}sQO*Q^ERa8EO1Y?-}'d̾JU>*v;\-vt+)-8`ki 2LL)'*~-Mi/CƱBHF$҄Z/RѨO NL0i+aXo c6MCh/612mFbHU$8t8@ʈ-#g^-Z^Vf",<\؟/{6SA|ѣFQ ѩAdWXHsV}L_ާNU$=0+2a$Y~<"~NХVi!NV9q|{Ra"$lXc9/Yn9`|ȍ\6:j$v_ 2z6gHg $W}F?"D^APXRTi9UՋ8 k-htdZ^D}:Jj$v3YSLX3chG/[^. /,۬'U/? 'T?l;~*"N #_.K~Y7-%mqVV*>fZIfXhfK(cYoK؁. {68=2ӖȊj˷1}\9yA,Ccpj "ω}9$F.Tga5 n$'X{)2wqK$C~^Od Т':DTDX;8\'[[-M.H(95"BPщ8q@XsKg wǕg\/d}q1}xGqi?9D>zeӔw6WEoL6%10;o2[054pZb'Mܫ{ڏ>pg,wdm?Y"gΟR<9m|`c JRv`6ds 3i F^f)Eήd@Pj DxK^]%!?2+N^x)i}D\%Ht]̤^_vᦖjr%cr`Sq~=Mb^3b8/VY L}ҷ-W劒C]ȷYըUWxG=9be#0;q-4k䣼$wD>T\ ]=6Z?KbX:{>hޫ\#<8"VUJ׏9r· yjs?DŽ@ǣǁu3S' ZM6׹!jKZ뾃}/[me '.Fyrn/:p5<: lg졃.cL>8Z~£vuߖ'dP:Mѳ>w:q7,~AxlVjjMV| %f;}( ƭu\\x0aIHI/s%juȬG[.6+vx,>X(e5|+mfuLW"߮<Zh?xX2+oVV)ms1_zˆ䏞]ׇ ]'X'8xvc9$X+CgRh@bZ*Uӎ ˰[5\9HZ\oXE0l?j4"9 \„ TS?8{).OЮdW irCl' j/Q0/]ڞmg<<$Ti>Nes *k(NXoH}.ħÔ:|wnBԇV gq9{+zDꚭ$Ƥ391OX0UʸP'v|LZ-VRMY*XI:%Scdy^4[I,ME4ϛ&Xg[O|WF *hWm '1اgIB]Z6\rPKnطbyhNG0ΘGwUDb͓x[fVM£h\WCAvsabHXAYT苊/z00aIZ(B)J~#c~aN>{X\(?i3UA2y Ni<$@kMX_Ӊ?d/Nhl/[z-%%%ޝM2?[ `DyߵƯ/8䇛tEE 9N wXg%iT^c:. ܜJJϰsi2Wõ ΋I!U mZc$r+Ir7 ^^$SZ}KB&^KC (e㿏Q+/s\ łiIwۡ/О!"2* ^+p dܟ^v\a |RKKTt%t|,~)8s]4X)\w8[ عlii7d {J!JõĨNטmNsȐmՊ.~<{Hr!&[vg`ȉ=JÅ0ԔLXQ(G5ecfT|kdw"af w&U`cĊ*hi"̜zXF?|0ܗ  zvE1 HY%.wKi ܚ k sa~jE![ɧ1/5˩`Uf֥n ԢTepeCm>Rl1g>gqDRM846hhBZ<7O} kUE %?!@NU'%/ګmMэ󛄅/tAoY /׳Ψ=r۔_Z+Ä^Cd ܳVCQ}Qo9 OF3}UKj-8{m֬kt@B= |85HeJB2^BiFB9큑78!+ueB^N, #*bH vDL]Ѻ,!A;GrK:hR_JTam 9_#5zՏ !9*i}7we\zo, F[* LQ1wC{N򠱃HsDЪՓ'aR#X+r"wCZ#=H9)25{k Ch0eڱJ 𷄃 _?Rg4R)79&N4r؞ y%E *54DZ17^+P /Z[%S c5Իe/Of|%ͷ}Cͼ\S+4˽rѨk_ QiZudl!UM_a-[(0, w@0lO ;.Q,/ le;=dtYLK"#JMc DCu,O+}J\2o_~ҷ;s^,tfW%"ډhc&K=oC<߻Hͬ&͟|Mok9,.֭;q5v`ץϴxT&vm.mMLR]NnQĬ7+ @ZCopX@Wïv{ "T P\qPzRg8:5@TpbnJƈ5 0<:ö?Xx u&EX|US;]/ȴVG&Ώ#ei^ T- BVMk+w2vw0-n_r2l`K.{<@s%ci-rzuJ5vT5ex,FK14wĦFW$C8@:e {fYT&cXs',n JMYvd}n&3# tR3`OE) oM9OC:`5 ~>nUuAC>SaIp0uol85e=Z鏋M-RU>)`$ڼH^=M?^!";}vvm׼%M^fi44~~=y*N؏eE05qVwOޣң*̈́ͫY#|h-}P!E_WB>G{OXG 32QՇw& l5/ìBjRMhkB!8 wH10N_<6 M)kmF,, !Aƾɤ~-""ip-"E)w2")n`M@xQ:ݶ`Eh)مdg[3=gxJbpgTe(Z2=|1J= ZJFzPqE 3Mn'fS0er4u~ G?&]M uS%?!}2f =YT kM1~`HKy  2OQuw#gNo^u_USy+ Qʴ!V+b}/EҺ}n1+AC_[ᾀRx$j{Kaob1]3&a`˙c"}|$|Y Wűdw CP3.g^YѥT埈IqŷI[k`~X=`cqk%AC2wdr!&#UM}R,#"s_R܊ |7@Zs2Aq1қvsrP+ Rq-_/[E'‰3QT+{\QorQ >C!>:"OS9 B+zM`47|*{?6QB ǹcˬp -l.%(<$'֑R ݏ߇D-^iOI: P'w]7jI

͈/nn):ٔ~T@[>MCJdM3eh3YvАӈNU'3fCܹli&({P(q8XK%=?X|*@ '9hc)r.p)`*b MNK2u-~l&8dilsξa2CKD ;,Og{>Hޅup!s:b4AX#{g1p3lS4y6a0t~\cN,]yL6\65nItvg` A&`6P:G86-m6l \nկyxъAZό dB"N"ԶAeH\7_7ʕ73u& *b4. >S!88u-0.d6GZm2ЇDnIZ+o0fF͒BDi5V $]Ɂ@.Cd_r=G?623T•\۲M\!Rf#+{uh-GħiO[g9s޳]8@_[RlXIw<a4!ۧq-e[,4GQl[0V/ 5Q CE5K|xdxkY^_;.^`þlƥYhܷ["BP@mr]:X[mM&A.Ji4:7>^b_ HJAIw9pR3NG~kā}NyEkA.]| ;aӦWj./FP;,:BRynW- +`6mkMeH{O$ƅ/ pZac^a}ht'(%* & dՐ̕^T~عqq?`5kǢ'\H@w?YSlb(i2b\/a 'u 1{SMm IƿRk^yr/K[~Ա0F 5]ėgֹxGs.)pdB#^- W;['rq>l?-*$tH_~CnwW ˰YlT2dT]{~T^dzLv¼p鲢.\!ܝןfvPVfT4;&^΃.le~CRk!ow>yΣ|螃NM <&`W7t<}:f,A=F ~vx ^ -irB˺iQ>^Wu )ft þF&vcl(Qk 3JzqOzwE<ؗގy@j'1Э# `&(( K6:RYw/I<4sU 2b}eRgѸYTBe5KqIzu/m_@FOɽc[`(bydGZj*ղS*`vi~Z{Z(UA_OlCШ$`($p4YR yWB9 H* _l*cWA,rGJ_Rkj.[d~ \bQA?^.Zy 춻XF/DNpXygP>Q8SZ68dTD8!~F(Hjguj>ir#0C%Ω)4}q=.JǬ. Vj\?;fnmS[?8Yӌ_y=Ucu1U力aVMN6zt\hɽ4%%&G QB1MS@D\/#fi &ޙ UܼhP2v%C?Oy˘w};`T8rwZɝxt0^nĐGBo$Ӈ0UV.p+Zjgp+,x(X/6ڽ7uFzfsV[; 4++ON9[Ƒ6K~+]:8Whw7m؏tV* pUf/C{m(q>܄.I`elʃh()[^Bz':hLC=@ZWykr; d]7FrN_WZnF<1;Jsy$;bLj7e:.Xu?Uۖ ۲2uBta!Ky7^l:-{Z3k@Ƽ T~(C(tMQIԿG~_9YBΜu IJQ-i~_+Qfl49{lI/cҠ2K\Xk2)H1N~gQС2~l7(*^ױ^@7.Xުvqk^!}jE\_oWc3`3s;#dbZs(?n~_LQW$QjyV{nlqO#o?TBm~Vˇc^t@?ৰS>C (tZdghOش3!XCWoJDL7 `[}<*>4'J@tHix"QQ(Η7vЛ:|Ѯ^^ xշ;u]4󺞕s^#gbEWNZ~vqlHAd#80aЧ 8++^3W%KS"sp) M!-i0{.<&԰?\(L*lddjp" zVf6r h\e b 5z8J7j{IDf~/jo:MjYWѓġ6vF8B1@rnEԳZH1'x;e}|r?YuE!`A.8#!c>4wmW(CxoOg9SAFX!O:Z*6ݯ1?03qQBԱA8kH>q| arYpJ-ՂCM-mLi"(׎<d 6Z\4_nS#2D1Rq7|N YNt*M*NjғNShzku052 _*Sa}zYn za¤;{8mϏ0MP"O6DGd9Ďz{C^To?EHfX>S5.6A9n ܘDuL̽,]%}v;_ńZb>¢ŅMMz9s޻PO$;=uO߆!0zb~E3L;ɜivH>HwӮqq7kJ n"?d4e.A;$t^ޒh OR`c;xצğ`"Um~> VUfxXM3oHSܟp:K??Uj#D耺ϸ)ŁAzSQ֧qDYV0Soɤ0ziJM;bALcÁs:7No\qu[n?KC|*$(d| ̀)DSlt#'U w,bY_LR OBEU2>pA>&) |xh{T0\ E+p ytnj a}L6Sg{AQ~X*fwi @sw.bO ޝ{ĘRU{[)5+ y-p\8P":֦’x!* 87Y;<fz1rQsݐ 󫗳q҇n7D E<'&[B3ympr?Nvn ̱PxѡĚnF䋥D]^tp;V0t7))h>7Fӳ6Iyl-(ܑއma|ZLyV̘u(Pw#ȡf 21,׻?i)͛{5׹U3 _{6=9* R`s{o\[rv㢞%Tvx2rX:K-[ Hy2åDoUBtKG[ l؀,[]m` ow!Ikl-if8O0}}J\lҵ m˗Ƚl;eSo 5Ej+t7uh\9ReDg nPzvM.灧-~;A"q9)j&N~$Zu%?edMxZ߆a M .s\R{|a,R;|g3~o.WH`_eڴ-#%JJ>fqv@[6"[c}#?ZDf~d')uͿul&EUF>3Wi ,\j-\U8i'ѪSM@ bWZ8ejxaXQ)i7F;]Jyj+w7(haǼ+3SYPx-`VhElcI͂]5>8LrQ]_ݣ~4"VjcXrY m-Y-d%5ݭC~*b#T Ľ<2dBģؓt,#;BgiGo8x\Zoy;&y[yl>1q2VQ|pل1W{|l_6Gs zxAJ܌ɑ@46)sM\TIE}Hhi;v,{i)IOvSrcq\]ץ W :_~kL'؟[ϴb$!yUOG|BUo4KV{V$ғ;TG.yJm›M-׼b?Yc2on`Xt֓F+=Ȗc9``#cRp Uk]Jz?؆!Db_!\5ˍP[.7}"ޜٷyh37Pp5M/{6H`|Ix6)`y¦s8c R0zzaʞ{%-tq@pԿ 0A'!^=0"8TM>,eO0 c<$y.'8!(o毦d'/ v)V}#Kη]>J6ٔƔ7#!C*)lK_nhfO lk7Ln$+$A$N=zҴz%0.r-@ͷ@`oj*{4QY&#hL804 *"%Aϲʭqe׳:Ѫt@P,#ۼBs dq&GhzIL|:Y +IkfhG2!/rSV5Nt^^ӈ"*F$}S[Q},{>͏"#2tgC )V%giHb 7![>Y2m5[ŋVz#3!}j)~F_7o,,D̩? 41*d<5/C07@د'W$rxt&Է-%"Q K5&7SDñ-d509qKkrX!44χIWMqk:Sh_KhZ-5E=[hLsO#L_S OH"dO]{[|l_jWO1lhȁ^nTӽ<V'ꨣ0NtMLC(Qϡyf X'_}7][[ ϙo5ytnTް-WTނCqth!quݗlf ɾ #M).}뀏e:A)xjo{`̨jf ݿ"*?Zel.[0ӾQ)R!\8ܸYpHG>m\ӿȩݭn{SfAk(ݿ|8xZ_{COLmŴmV&L<( C]mLė*})g}(R*i2 5 3ڎvSr>MvABGJCnREѩs^q8ƽi3{SDNL5dH}%e"󅞃 OUIz'Q݌C^R 6 _T-9VڐB]{^h0\lpz=l:`(& EP%~k_X,,R;8XV)3 ]YMSn:rc%s m(m7gce-dEqMvk1jna +p(i.&L4LcMغ\SkF@x&[gfsMNCKDG`|<.ɢ1<)Q25͛P n'z}Sr1/V|׮2\stR.beWᔴ>^U1R6[ĥd@Aɢ:I 2Yi 5cfuj:9/=; Oy^7xoO&ǮIa҂כ4ImXE`uC_JĦtLH=b1"ohm|u.r20le V~uO+0&i#?!kR,<\Z_;)m>Qu1@ ͝b$iJ N*7J=HvZ#!g2juߊs8q>m=,>¤]ݢUU{Qg_[~M&rVSLT6;3uvWy`sM5ԼUT9C7ȸz]Kz.| 0ƫHN:|6~)0W1CJ~iruڻǢ·xcT> eB }9oѷg;޵h8ِ4t3-"9O"buxo|Sa*&tmϊG{4)&㲌E=t[ֽTuHw[ Q12(* v5RYlx:0$zm/] PT^G3Ql(e,@͌6Fz\HQ\"ʏ>8ml 6W0M]Fv6{ S<5)^*ߖ NaZ"j -z3m5Zr{Q vwn A0h(߀Źm d=E[d)Xn 92ɣB\Kr68 3-$E>f9-ڧ-ǿN ag,T֝yUNc8q h366 `vy'8J)";$4șY гpi0;!(QZ7 }?8\Xu&6A8R-/IipQCuzT|&[ Y^9#`&'t~B$XjQ6ErRp-IDH\"r03%<9RZϖYxg P,Q@pXXJJs ?}S?T= @. L|n6sAՓ@  (t?:FFJiu:.Sb28s3f l!Gq=U XKڎ0veݏ'>d!Bc0錩g-RgCk@NX#9"ϛ:qT[e6ͧ!@$X2&B S,b}ef83^>B9&"[yc7Wiq_aZTPjVahp-z]R\g-]72\[*GOwUg%K;>Q[K{a}rn .򣯭XZIc^G;`'EMqQW_Hhn}#t+"݊Gs:؏^okF@b@m\ˆvl@sI|\Ra yu'3?N߯*bP-9ڸ>nAJ F$n|LXz縛J,0V81SF.晾L,y 9̟6sdOQUYo%NiLSGZ,_|o0uc`U &19;uCgXݜXjMv!Me ®cb4zܴ2bq~/1~KS6fڧ~lqtj':`AP'/S,=jYFn8gw43k-(ʿtl!gq'8xP!CL@g-Dv/Խ5b/Ups 0Eo!WW&8@6-k22iՀ/ڼ5¯^]%~/}B@}Swbu3a Vqr5!wz֚Wf]}Dۜ='LIgC)cU2d}h>ߢǑjU5#a!v8jNUn&0-ګFA9@9|}2XG|boX 'i<'C}6\fᕤ(ĸ%&IrE BBwUx=}EȹJDDjePnoTP׺\I1 Sʞ^n2![o%vbM7 p)>2LHAsYO7C'-\0!ܬ$SzҲYQbj5?20D]lC.o5M=$e|SZ ,]i#f2SuJ7\rGnUeп Xv:J.y8{^L=%xHBD҈ى3A+xp?' yP%ʍebEٮa40u &M3Ыw?\=&phʎuX.,CK =YEڲ]ok(Q7x;R{pX"]OP #Ny}ڦR|33 Ÿ~[tᢉ,0 e1S8d&{\(渴ߴϫ{-OCSA" G0p ԫ@]Da=5 VD;vV6 ~<ŨJ֫ gɑm`~dJ<.}to"5;bi5˙T_5NT| )Ť$zR~E~K{\x+mQmeBq$'`pn-`S[O8|V tpƂF͠t$~QwZSn^15Uˮ<+2V3Pk+^]}5~ ͌&{\S%!Y8K! OܒHz3V_FzJF >ߴ;-)^)J B k}:3{Buʎ,3`xgKA˘[LW.rHʩ^Kj=&4Xö'QtܶM-['#w:hP؞!&D"t^/8'2Tn;(<ה"K/;³dcȉqR50f"Z|)uk xkc|13MN:1:MVv+vXW`~٘B50Xb}H |֌t/a{M?Y4.UxNrz89څa֭.Yot\gj r普T0#'+XҜmAT&`. ^'KEUlcltHZbHHYx`ZRtN=L\H N֛0/~ wF6-+02DJ75{8Gv#7?M-H(rŗ L¯_]"ExMP|}ߓd:EY-<5F(\ț˷SN"VzIo{Df@Ce,+ppi~׵عwkF&, IoN3ŧ7(AO^14{tΦjm;'~=|(m38쵐Ԩ# xkxfP gcuIJp+fʽU"+_\sž ]*ɹ O2^"iϽp/,J 3/*?vhV")-A#ȳ'XtzK H<鵩Tхg(Tu*GԠNqKxU̢jXI X'e 6NсL,(g`UI(W[&]LϛA $ (g[Y*e8XilzsW!~wM]TobuKi.fic'"Jy%?bM| ? .sG+濼Y,iДK[\?xm ؛WX$+*.BOIQ9z 4E'NxMDҾQTK 0ح j% Oֻ5*[tdMMJWxpq?ix#?prF V5hrTv_$='E]ʆ(̀yDV`3{O%tp1䩎Ž[:~^2tydhTX; $! ;9<[#;QlO{|e{22~'gVH̟ur3 6Oz湆-m3RֈUɰࡄ\Z℺W6}/^_VܤmZ@ x[fO_[cfAmr1Nm>:.Jk LR_Yzi`eU E-^ aȠ*,r \e_gVhq#6bf39z$Ph8}(hkr1p)f(}a~3}A潋I-J6-RG`&ʋ@(F#7=\Z,D9hwY#_ٌu:^eSwP"dUsz۩df.U,::2_s ۝6@~U|R=_ etrHI8xh|?7 J ΰ9e=<<+ܓ꒑y g|)g-BAh Y#nS%]}%:EKq[pC&SF2t)e htIv*Ӯnu# p[> (خnnL}#1 *+iʒrͅi؂9nae4>Ƞ})ޑ+\shO'Hf7su˹cØ{?yVu?G_[(ģDxypp9kK2y>uT:-fgKS)S]&-*O!<%w&.r#*D-yk`䧸`IT_i~W nCM$jF>`ȗDjE;!kJ}Ơ V3@F`Du 99?cNh=b˨-/!p 2Õxw;u/HGa.@L\ZrV-, w]b*ͮ>'k. Bo`Μغ[%8i&G*"ݎ7PVΒ.zʙJ= Q R?Ӂ)H*\arp|$ 6w@,U ~:w>bo:A7N˿D~ԥ2޹b-E{wH4a5|)044YJMb\MXk:2f `EI+9R̩d)?Oڹ_Y~H05CZ]KG1QVR &)W1+H[E}~ESԣ0Tz|CRi90Ab4Sbӕg580=Urm :OjX@рlɠ|̭09ua 0G2g;-j4C'UW Y8u𥡭zNEt⒁:bN@ڟo+->*E ]@ PsGy4f( yw)B)]ᲾIdkpdコ1c3i7KYf /L!'0ϕ*Ő&8UZC}Z`PbS3Zj nJf^\\ uf?%ُ٩[GkI_ZK1$"Np{Bc9K$yv]Hu^ FaIݛƒu?ny%GPoJvYV5* -Av<9yS !+)T5~n;O_eWxgbV(js5~oQ8{i?pf~ g]}VlߊCFi׮NL9"slTg1w$o%[`v oـ o!)'&Ӑôl9ưj Z (ǿ>0t#nf\l̉4YY(t .HA"v7)" :\?HF/WH۩˹poݸ6S*sVzo%:[ldxKr)Zu q T冥Q%*ߘoĆ@|<_6pU>##q)M/>[Zx$غMjMѝȼ=cB+2FyFqKv} v~pm,45MJ4|ǰf%(ӼdjvQh|Nd{U%~ߨA>c.[vAmhL+j%>4)TgUپM|BtDNIr0L N =6銅e9H&bQ;/`!Z|dբf. T o R3]O6tp.;I؁NЪwwS NS*R N70#7rL͈ܮwVJ/m0a@wD܂Ee}0y@`豓4")An='V*w=} Ԙjeݬl Vۿ7*zqV%짼t/WF0~Xl,'!=K@E>BHh[ ڢk⮫3!%2Ȥmrx(KnP8NN-_Q 01Uys$xt dS f(1i Fm瑍Bfx:r6 .dշ\MΔuZ\d$yF]q`Kl4n12j^דl1-tp": _H8cB^{.Nrn:Pq$2DnXdwtTc}Мz$̝<;OGz&V8~44>O)c$uUP,\k3?|!QgҰ`C& hQ^+W<()k/}}ٺ I>vUBu&k W@y1)EpDkcZ &^M?nE6}O]M]{Ąk'~%| O8z4 |FxU= @?&>DT,iaz;Q+le1#vFOqpoR66͝\DF4iXɕQXfn}1KzMf+orƍ5Og:wH:~i@#KKO|~{F%+ļ*tnwwpn`Cpՠܝ9ר>i[jD\ї4Q /^2].33BS@v7>B#/8FY~.VVf) &"gb%xa'~LŠf+> ْ#˨*I6dԟ]$rzignaYupݨa)y󜆷FK_mݚN). qf7T[lY<RNKfCN?r\k$OO&0 A64ZUipcp7  J%&dO\Lʴ,*BayZʕ5y)GemGkq[{< ҹͭ[p^5_UfnBA;@C|$UHC ;De\ r0s&xO0}k+EO(ke~iW{#- ]RƭR{_YE'1m*z ?T/}TbAԺɗ(nV{m0Ur'Fcտ|5'g^M "g.+5%mu{_jP1HuN\i\pcTV?'XTu A`p9Ef,DM#%]?7%.Y6<.R|,39vFO92#"CLJeI7vA j> 'zeaTL-}f%Df4Jo߀< Nu&bQ'E?/D{8%ѹdLBZtm2 GACv1q}]_W}A΢*?W#KLC6U[ e"bÁU} gn6@{ _2$@o6ؕXb,Idp򧪑֖](pᏁS>V3ݢ"z9WʩK5v;nFbOX\,yZnI{E,_&Mf?Oc&Q9oW )scb|]X5!cϙTGi'2~,H\WFᾍd{c0WpTUc.(J5(IkZV{xآɎJ x!|L͎ z-dUIk](ˉb<܂]eto`֫֌d3 < /d&?i>怘L?ũn~e=8Η{Md|5C8&g(Ko'94.EvXb{%Dg 1>d89<= Bi}Iz8gjrȊLXgTuݐ*B]7aLb9fX8oaG+jkշO*nb"%#~a:pԀ>Ƶ!|0Z?Xn«TWug\,H{xEnm.!ҷ^_ M)}zOtd='c%2m2/+hqICPJjΑ ;Y1}Ny.6"z_Mܢe Xn|*dKe9&L'o144[imu-'$5·q؄Yp vNA+|ҙ6~Q%^x{ۮkLCp G)@kT"Vzy8/Jz׾ f@FD€C:B12Eٌu2>n=#e~} << FuL)㵪J١x>=*u@¯>`kz^3vB2y8C`\q#>"rF*4^sI-Զ@<~{czEH 2Γ0Lz6Ju"/ĢxS!3mxwaƕۙZxaJ6*]Q_T+zؾ)P\XG= %On9#/:͎T]DG ]4 6/>E^];KQ%34hyQnGulo D5zBjE7ʑ! Bw+͘mCX2߅`;1߯ E30+7`1AFkI,i2znY<~s<['D<^z1Ec#ZmJXc`!CK Z2[,5Ksz(F1zwCZ k>Fk9axc+e=,i&[#nhv2(bOؿ4p]IYɻQ;Kg]ޮć +EPnC;ujh?(t3xNI%z0nCf(4GN\,D s0 T: TЍsP]ۿCMߩڮ 37 $XDcgyp7.A*4L[]d*`I`C'!~_-QX̔@D5~|"t`Kca_UN;w}DҨ]JkBl ~%&+>!L LCPKUϦQqJvtg_a\@ 4dR<JCZ/G}]K*√Ƥ<ƲdZO"ňg#SN"#ƕ#So.P>* .Q6ﹻv x[b|8FmQ8땁3|L01~.X\WVUlMߓ6 ̄b1t~b̳X[&h CEyIȞBFAGfU9J`>?,B J7ExW_'l2VY~dwAU\x68xrȰKM ]@]v~%, @MH̖m̶5^U=4.pD62_L+?IRCZiTFFV)F _+(\NbE? .NkQN"lOC=8KLSR@<r7Q'}`VlX=S!aϼ8 A/(^>u~2w)!ǥINmBiaf>XN7 ϰo~ H{.ZE`ȚҸ>ݸ>Ge:pB~Ubߍu5-`%:C@<":b°*{wgI_+й4PkCatn>cF))1kx&䘍^Ok퉹PP\7߯YDm}SL V{ Dwkh ]Vy}'T:)B;;vxez`#F{&P e##?vdY!B?hN>)gMQ5N/Le>m5a%s[γ3J:=㣄L "K)I{omtuSᵔl;`r,[C GKwl_^!NASG:d1$g 0jЭx:W}Qxhp#Eѻ%H ɖVeQ5tf 0Ղi)kV*nnoiunxuI[^%n=e6vd^KƮQR~.6J pÿ}_Z]U;i(EJ%Uåz{$,kګ2L(7IyZ{*Wт]T.?4*DHWUȱhp^.Oi/FEH+19o @䂈#⵮mza\]5WHm° }Bm/J;Q&a Əe$ú%oFxq\sA0bclɈ]Cz&Ap~Hgfb!qߴddRTf3 h #fJ˗SaHBǼ %Us-2iblB7 -á y4@C57fWtd'o[q=i+dpBOw-8JPIu%(cSOBNǓep]/iHj=%"׬6a! Әqs΀>ޜ,.s|fB音#pQ/-! g4ג>.@ɖAx?Nw*Mo{NrfɾA"L#C= |㜎, ߕ~я0 |e%E@^#|*JtȦ,;OsGmۚ{3"q7CD[-},Yld=.sz(q@$').KnF3Ŕ*! C52`\R[}E/dؔGgs52bEG:pQ3á v^=! ᘄxHVL\0Ĺ}CHR4lျ!Ke(L-B4r[!ysRzARi$~3c6Uly.(s~N–LЃsYl|b%2U[#XJt`={’r*{'#݉rsp>qU8P^ԷiUcƲ^=LWT?EU#z 7i>PLGM>tpF1~I(ˎGyb wӉPϫʐ:" @. |W<ЙnBypNג/k`q;$3kʠ%MEkDb$(vX>??[(,֘je{BSkm2ӊ>M\]bX7 ֨%15>R&8_^:LaPJ 9HnA> 舾9?j~xh|7^},M%h>< SuNI0X#uj-(K]ͭ\LFA}jq|Aq(=']+e'$OgQπ+0x6~yi Ns(G3oiݘ-=؆Uv;jbׇ.kܮ_GIP^J@J,5,m3]Q\y|G hp> "ƢRe{ZD댓D3|pu=A)D|;ϭ+V8T'?Irll*%VO aj 5knq-g+jN 홪Gx0Q-z"R>Q *W0#kIh-==O XóG}fĄ}wMU3:tAHi~^Z wנN޾zf7m]6dd8[UiO!OIq=.H{J ֎SX 0[HrgP!DU:^f5`R{vV#(4ia ܭD8P5Wm4g/[6O3bOf|֪bqͥyTyj ݒB jRdqwc?>; o $r" OaDX`9ܷye`Ϯy[:'Q[4X:|IiSeKm@9ov0;4MX@~T3^4 d5qQiݷ/L q 85;b85*M8q֖ 'p 冑.3i!5p*a qhyUߜ[Sk+iOϋbӦ|l?P`2qN|j Xgq<%*7'S9%3Fq8f,@[wcj&|/-`oy@w)ih#Q̶p1*So=RZuݽyy'Ғ ,P[~|/ Cv"жht,ԸZEx?p2)p Zj"7q#%c6uri0 vu<!) Byl?tr3֕)"8M8f<0/%his*TQ3-s3G|Lܠl7fgws3N\L;cxW)lk:2w*`'JBٸ:κvbgaJԃдmim~=+(7PBR8GVVl/>u>i$ƺZ=/7G'nȡ 1ɍd h;iؕF}O[e:vL:\NQ):?jծ!06(m{AL$}ĦѰ̱1[ߚ X LzZmo{*8*k9Sq r?v'M:=_|X*Ҹ83iCZ3's"sYg$E[!!z27/2˞3ֲGPM3&`kV&c%,_Y#|N&k׼CN C FMf/M6KNQZ9(g =JY|HGX<-74aءp<9h Cebg }~Or zLR(4E8"5n%VFaKaK3y`pk LUɮTv?Z;J, wTS96"/^߇1p&ݰձ; a$<Ygb,mRe@i4^8!1 k:cKUV˴(,FJ$ C@V7 Ł[aX~S  ey[YD `WHOkZu8 oH&EeF-TS΂9L%\')x9C+e=j< 0kZHM/UNvVK4l K8o3uLym WiʷNI'xop_= .뒪w.^]VP"=/Ȑi@ 7F̜ú_!XconK44RVIg&kAP62|ήf͠ΰlbk+]"Jo*]ǍqnL7}}7 s$\\p Ex|:vYBmIf.XR>i H8@4[2XqJJH*# 8PsD_o# ZDZaDkK!6Bp3Emp`ecaN$~]ԝohΗD05&e"p,CI-1~@{I-t?zY@#|vrMϐV!jAb%xGNVTs\ud=4[[adQIӏgDҹZQqK8 6cȈ4%]\#j2$R;МiH9j=ڥZ6컇:lꀃ $8`V[|^qRW`Q- a=Q]YĊpDJbiÍfvnV4=̍V~ Ew7;u5=g ;f4G46`+crNRa6ų!+e\! 0d5P}8==䄞r-.n= xPE _㘹 A5qyb¹UlĠ[;}*hM>)ڍw}=n ƘYϤsP| *…ɭ/+l7XTH/;8,>Z1$nqFcQ]C~+Nf"p5:kH8VYE2HL1 wZ:}SjO !\h"_Ba_پJ| bo*{ЎwKO~>>H:DE`,4nש!!@qDqd ulHr3ɱfE򔑛;i)L [mM\Y$6):p1 Se0$x:k-leaA$cx8{ba| ^{O'ÜQ`fNTu`ZT @b@wC $(h Uk'A\ v\ɼMOA_{ xx%cxt"%yrEqd+-F ~!9=c-%=6ωav۳єBoѻ~yHP.iM?J{v B*HD84Y-}/rGÅ D otf3",<'7.~,]q5!/+L_KddY5j}+h#'I\LR3,+c,%(!k CBGe}'*pa~/ ]-(ug4$+VM?P# YD g |Or+M[7rO0HRE(cҹ*9u}^}ٓ; @Er_8_Drue1ıX)NkN!OV5Rc[KF2T$P8AJ3qO"[RQgrnw_oW˨K";r OGD[3$ׅV/˞Lar61Tӎj>_&d"[C/)M%3ve%q~G2.&k -.I*3[(7E?hܥIk} kJ y.4a^K۪4p#pIa(F]7e0plA.3tp^ U+8@y=Uft>ivj)NK.$fh[?MUP_uY{L=D xd$TrFhYRpfaO@sx$ +9k]7a Oe 6$C=$ee;`ݷSrQ-C =+9o>mKyzyfCwW~ܬ2!ўGh61OcJ=^cAϾZ,tZVIҼ"'LRBD5MVIRyum< d7ߏF{kUwěT]ɉBtkT(cS MQ$`٠,CwHr/ mOȪLOAicm=9-F̔Fxi+^`t^'L׺D$.5h`Meÿaa)!̡-1f,Zڨoeko9IU+p훊/`f^L?ɍ6mgIhs`?8t4Z#/Z(~54@N(ST1u\j6"s wF$RWN X%r~l0> b3{RQ$p>)~ypJ!y4[гy#m@b"[@6a*xJgR"pG#z3u;s=3]!ˇ.p eᅵ%^*H@I,=m"ÐhM%B0 Tƿ5CSkII*E*LVDZa' P%YȡPd"AjMF'n}hD0e[$ey/A&`xC#]VT"g@OcGm~4J1"Hw؈YFeQK'wxM%ZOfCaG2n1T@ &?Idl֓ xJNd!( b. $϶(mz K _h/L9>Ɔ#cn{wNZwutE.lRJ"d^Z ޤ|zg5cGs^,PczBC PUƷ-T,EOHh^SA|0aMIT#ȧ؝rAylT-6|U^S&}c-eA^ 4Ij AL(*L68rsz._?KZ:0lOSZ1;.;Z-ҳV҃~jX4 [N">pFM{)qd$\0[.'+]/|(uFN)Z[- djֺ&%"Q>5 NDUmCK $Rp~%PWb)jcZ ʉ撓:_ Yx}:msH4CzdbGdxHcX&&_|#e#QX_4$s/r!osExXr>-gk x |lku;HX4B8{l|T+hlԡ%xɆ\X宫t/Z˨o{\쩟5nm_xAyTb 9;ۂ%ٜVZ]Bp(r(D? JlF嵹*qdؑIbCDs>!#V“'P4x_44rR>vgn9o=O^Ǩ0%q=A?`NeiA 8܁b]G(o)g:k=\Ea%Tga}k$ciɒc_7tu$d8&89Cb;ܠY[ M1k׾&!ּ0;ǟw>4tehNrie)Y]\ɶ !?=&ɋX۟$90f:[ ;%  ifLkM;l4cT1s 9#lp%܅̍z3ocwۜ7\Hyߨ4 j?\@b` RU2Bk~*d TĂpLYq*߉jM^~k81]E=|Wn7,%49mv>>oCgrԂBS x\٘G ;@6G^LLx[4%>b!bE_YB|Q@ȪKhZhbDC?Znݷׄ,Q h Q̀$xl9Hxd4&@agMC H8/n|/>*͛%b~Txje3J/^E,oa=4QZˀ&huuM^o>v*厎37s'z13ՇWӜiAѫ'"ָ"uZŎ Tךxܾ$E8'Yd$!cOo8ac+[%Z]KsԂ.hdEI7A!4 G+r7_~ru,ۓi~22vK^g  hrSdX ꯁYblG(4'rH)Vk7&+Y7` e}|"| Ě KR!׷P:ZT:<螼W¯6ALzb&zJ,^F<*Thzti g@bq()niotd~`Ul\rx!&ً(zV=o8p 'y c,j< #&O]kb7𕖡_{pZkE ؿ%mҺ{8fURs2%®Taa?kK*m!v>+ycA+`BtrD6ޞ E(XKl7hDN;AB}3%c`^bɪ~y*LԢV[aK"\Xll &>]!* ]fs"~N޿1%1 l%=GV8yai&쁈πaFCce.vb+yyr9e񠩶g|}\P9D̨Z4B LAnR_*(=t4ijۦ+k&3/v ߤU52̢b7ء`*CN/*}GraX|GߤWkӨW_ YWJvW3 4߳YǖژQA$I=>T }Ek͊.^ HIAn>氙D?l26D gҬB1cSX u2dif4g {m` 2RjM*ۧ:]ةrWfg $U?Ylns8Ê ],ӄQ&V,ʁTZf]z8%"3:;3@i,"ݭNo$NL1W\S3DY9wŸr" Ou D`aF@=_I=^(t=d6bN. Ah^7hgY*'s3FP&UO J|MrfPHB!оķK 9sm}ÅηLFzKV&P)6#+^,3g< YZ9GJ=rg+BMȖԛIqYMkäZI u_+Q/xbޡ2EY{;)MoC&da;-'Ӝ6h1>5'a+j6BАwv4ڧPHhן"l`fJAbvYטρLcWJ`@_~Q(7p3q%0ϵo%{54!~t18*ѷuEĢ@_u1A{eK^rMܑcܫnv:,nOX.2_d~QGRX9/r¥%^XqP,ټ6&?q@`/&@rE6b9_-#>n"W^L'i@ReC@XғrL,MI*~Ӈ!VB #u$r@rTERMDI8V 6O9~ƞ#A_w͍Zŧ~3.>de;Iw(ɑsn6v&*(G D7>a =(i}!5r5[2Aֽؐ?jQ\0UUұA-U~9-qzzz͕'*ēpg :xV; ìJ$?g> +W/o|qʗ)̐mh4_5 T.ӈwܿ?P.QC4$, Yb;nHCJy&J25,ƾD $h̶:)Va!! 0 Zp\yN 7F7dT <=ėf׈m.6!ƥW]}o¶ l(Qdgߢ9YUic09 jP ftypjp2 jp2 Ojp2hihdrcolr"cdefjp2cOQ2R \ PXX`XX`XX`XXXPPXdKakadu-v5.2.1  ֟v,fHFna(l3}YCrӖ$Fu|Q>x-~I}Gzr:s5)Yb&g3d/ e,N;2on6jl,6a۾_u4ϼ_xXlDcXXML17[瑪#ԏ /*'~'݂4rR ^"hw`twZ xJȚpNZ)V@4F]U? *5*۝#z"q_: ӆQ 6E1.F'4|kGpz뛐KR!9^Ngd:L?f F \#H ƃaMw!+U(s7-Y2qL# =ŹcډsO ʬTN4$-wa5&~s D9 ؘK)[(_1|lf'G<'b[67X_`2$qV{_ k1+0X8I0ۥe4u-o}Z&ts8TVCy H o:Hl؛ (U3E:clW}s(J\K߮L}@Nsx|lkz¦ ֟v+/",ѝ颾=c_d&^,\iJNs:ubulk0'X ?bVfffk=(:'a3Nk%ZN2!rmlr<}`Vj]&fe2ڂ}6xfwN0'Y˝A ٟak, 4x ,qE,t6ax_;R4ua9 e6if ~<'vZ+^X{ўUw:n%7Wѣ+\@IMovɡOX!7ըl"z*K$3eQfR>hA+w0S`O>ПsB,ͽ~6.?-GFPV; 8a)VA6yy6`1~Bo"+xC!zv LII7/3ڨyRPļuM~)L qJ5[Sºw#22,&JdBa0ZR=Ys3А?#Ge*Ǻ~"qO"󛛟cɿ.~--ZZrhìS~SXqw:;DGRqlM^m{NuL8^h5CiyCzIobfJ=dv<+0zk'5Aaj K8;WW~S1b{amQvcY 2P]I- @{um]~#wZo~C :T E 5 #&:ezf++pvH(NН> YEǼC^/S~7EqCooz jR#ni*?7'uFjwzqDUʶʛ$ŗ#ATq;Ic@ସ9o6PQ~D{҄`'Ȝ TкfSl=@~EQ=-@ .9T !yM |nP!ocKš;B@Ty9Skp}%IOhܔ>y3n$n!WY^>A234՛!L69ph!G l<qwOu/C!&V qվ"BQ͡ˏ6YŃ>OжG QPgBN ɺz>)LmQ50 8 |b^c|"5uSSxAIOzC8n9o,o?* v:Z 03ke9I4PVGp$U_ʊ&l7yfSnR'J_2Lw8 .Oo'|RN-h1dDe"[p7TX_GR>j%tA2}#Hri>ޚm帤J`aq{9F3| #~Q^mpE MhLR<?;5^8vV٨7q(XNBaٽQ=(HYBH$=+713:0iÐ>m:ېIͩVC"MfӲ\^0H㭅j%յha;Cl Cy>̀kTEïx;vv\cz"19H0SueJlDij90 :bF7jɴH~}ztb"!N'3-)7u딓Uxh.磉8nƍ:8\/bL9_?j9ĖY ;Vt'2h4cc5(F)- 'Lib~N#r0n.=IShhC@ "A)z3RB`#OY>gpwSK9;9Qi'&2 u Π}vOZ.6*USJ-SrT;P:o7z_,x4I)%dIM\MS9O~$ [K~ @g4xJ)^"4dwv11/w:o (K Kc7멚6=rxj-j u]&_>C . 2UE/{r:x6>T cD}2R_tX4lnH. JurAyp? n` wx^ӧPሢ`'zTA$@ s굠4p")2f5t 0g(B*m\hHc+ݝyqEֳ,T'xk]Lߏ}#]2T6'uieьP縗Wa098LNeZˡGi!()Oο#icx5\MH8 0qm;S.hpi OnrPiʵ7ޝQ\!0}%rUnK-p!4mdq +ו!E:eHz-@$gMĶ -_@E2Ł9\tc BKjlW2"b1QPeb&PL6lՉ['@1TA+ w4z3˪a6gJVIx!?HR=?#:R.yZ)B -f* P Ry($Fc'_uC2IU=ƭ+֣Gg3ԛi ?&:&3h*΁=~/vͼ|X؋]SvaջD+J.iMd;_~J `r|ƐKf$EN3)EkRI >Alp$klE^s~Q"ŚŎNbI]BE<K2%Ir{49HtkQߙ'Aϝdڴ>c;tJĺr0];[L',^%1JnxZQj'\<.7~ W@{?AU$WxBTf9;,F$>ΘHiʼnhS+fZ]G!@U2 _$#r/>6ByH^D|CD'|%ː3RrSs$xժA]N/)(e\ߗhRg(o4FvsF,::@v(i!hc_@ԣi7!0c/ Z*$\"<Ӊ f ֤|_˓:\="T.YO$#؜_x?L [ yt*2aŁ 4-5.*3tt8"hF0<('^?UwiT Զ?ژtJnTutv85K+P+ nNcmU^񲎕N)jx7Du=4[IMJ \g{lZI5:vN;8̔Ah=׼M2HXؗztoElZ,ӜboKMyA 3 6vPڝwhJT0.̓DS~j E"\e(9cT_'a <4lt>ޙau>ׄ˽i} 3t~%^U1%9s'd.oC ;dw%fXl:*4/rH1Wji"ç4J&+(u- : ػxttv+wFC5N^Rq`8Ht~?b}0EDRן$ٺE\ %#J"tY_~fAmUr~d5 ͹(K&ߛ|#!{\`c~Exu6!M_HO>fZ82:v?<2X`T9gQߺ<>*QĽkxaUޗbESjlREVxϗ(dƗBi UeG*bvr~*r0…PݻU&[\n#[z zx%\FvJ} p 4c1un?RfzY+DN}H[KC.Х/ׯeъ۳WVL~ *W˦Llk762]E_!3]`b57rA G/ܷ-8,.@QD?܉a,oƒфyuD6Ukdt$x#xwX!rBMa &Oz+}.Yi6㘾S!7`W[p߀/a}=&sFuG q8ga{} ħSTK^o>#J,F *Bx>K%rÁuv[R}閾QJOKmН2vt !FzH-*n0u˚%B&>&ϭ:WS}k54`d\͘Fi ׅJ4 +#-%N~zLe$5LE)34{#ku^PԿGbKY|ʾ vjx齚>fءD5:{TB, g:wu' 'k8A0Ӣz: 9Ii Д9%TuSҢBـXF&z-M SEkɿjޏ~.m< aSF In|#srJ`Df@z `ܹ QR"kTAa,hlIQ=ZKPUS;.5b8Z,sPYh\yCg6wMʊ} 2Pt(YFZýEOå3QoLl43m4RiGJ/oF&pR-ى8+Ư|DS_ |8z[8[@$spAcJ}usfgۭP& e՟j8qu 5w-@I$W,YyB ,eӈi OI Vȃ UVņJmo<( dD3*f*kx"`g*&B}ȎbLd ߔ15+=| 9 bnLE8ff8oZ^p[?َ2P ah Q0p9dK ks΃Ĩ."/qF6 +e,~Bc|T!4'c]`"kej{N9vd9Rt!=yn=g1]v?JwL )"(_TDbBu;)I .d=%y(^<顈-:-HB82hJ}eNfd 1E=dT%ba4驇րiJ Y蛖r'3B]|ܨԍ.-ʳ1ϲKiQɢ|RG+.O'.ྠX.z®$qA܀!c5IaAȅ59a湨+ZtHbǵDgSL:}#P"^;]cw{[t41<. J(gT@!D* /,I7lS-iLmN-2S~fÁUي@s&ͬ6yT(uoN:mTG:cl8;|zn5ÓPE7=N*;uo!t)&e`KXu[H6Zl$_[ZILy~h!WMͣ{zA2|!?j` {@V0H9^tշ3 Dmn% h]oUx>zuGnH8ũ#r;LSVzl ڴ6PdfZ蹥0o-g؅͈jmwC" s2 *Ӎ!<&-.]1e$!쎣_IIYC۳D՛AL:҅9;mqMm4W\(/Yu-0uSÁq<@0ng7<_j' N=M02'^_]cgv?@4@b3rO8UFE3Zt">.j D -)bj bړɴ ]rnsK?߼~(גB~G)3@\uVK"h@`^^4)j?{K8=_r[OQֆzޔlUeS_G`;KzCk6%󃈣ߗ]l?h6q^n4z`T^R_2g]K[hm nsIN58\׶"ҎZYyWp>*yjp6i:߁G=]OUG)8An+=%46'ȗC84.F}_A^ZǓT oλu{t,%-F/g6dERB@,0"J3b~)!<Y>׹ȳ`\g^Ⱦ)=Xݯ_{x-8ֻ$XdIFN WdX׭L2Ƈ2{4!uGW.MY_wn\!8Dhe"qqb-NV߼c2CKD[4xla.k;=5/3S7O  . ]bL UtCnE9g<\7s%a]G|/ /!7JeUi xAh<+ŗ;LBZ$_ꃸ&R]}1ӅP"ro|(8_C$v3kiAZk(mCn wHq51PםmiSԍ?NDՅ#Nͽ|xq!@^P&Z6$OC5Ϊ =a(<\7jzT7U=Y7YȒ=e3&™@uYB 2kr9^),rn}-EZ/(/w[S& !sH-揣cg2Do"kpMHNm4>Yt?ʳ YXM7G+o.NCywq{ >k0Q := To)xiSWFy RwtM^v4m4R8xPD{,9%_!Xү#+Y cU{]2zZ@px&B/ (S7^xXgAM@tD?!4nJUe`]5$wD!m^͗{} `eHKQZM~pRvf/GoG0.,r<\Z=#R_RO^ [ @7I)H%1dW&7sݴo:lkL;k@14 şK=xbE:z8F ;ԻI)~od6GS&3y9{Ӌd{->917Ajx9%Mmbܷ)YF1֠&+]*2 +9/|q;JCn4l^;WICȻFI4(^4v%%8A/ƒ*H4Lsuנ,ni=Sm9_0$lq^PkLn+٤<83!;y]۩Xh  <ڇбI$1G\+Z<5DTyu?_Լu`"X}xQY*Wa"7w>J-0qu)pGQ>ͷHGt~_uJa%U 7rD Md#11o )(p%9ZE9՚9eO~*8w|Zx{HK+Rm!q̜J|T}gߙKf $^Wg"hVEv ~lv V+jPp$4T 3擈+jM8/y59:N?n%g3~#aJ*.oRP͓(z6>CEIVoFִ{ 7(Xprõ \ "_&JI94I h_ZD:fy.٪p0a1n,C2))XVMe%1@(^Sk'Yv9̧%/>/"Mg-kSSigC$2.k42ɼät"5_A۹PLg]__ InVe]U-Ew7j@ } WZvx~h:tXfB eYbv\$v}X3| kG0PeƅGw[feW`)>W8/{e L(w/Gn!E8ؿ.;0n㋑VUBQx^WfQ٥Lnew쳦!3/  ^rI3KK I~K"8{&L=*JemԏVпVE%{ mF,V|k0s&u|P7[5b)MSw>f7^rs ' M~wЪ>`[n'@ZK޶?ye>]cҾY`; a#^m~؟Ԅ=NDV`ab!k,J'GsC8SBJ(D Є'. 9 !ܸTXE|: J_=1&OD)6K,6̾RRȀ9[8pH uB8kC?:i@lToarSη֨)E4 s_ۍaUzj -@w<,GY9lY,38uR2&EڝgMqn3^0@VF O5%B`݋/"a(5ܠcqŤyI!TG)YrcnͲh @,o!sE]YM*MHڸ,*D{#;xtq(S7zpQ)ɶ}FUEIH'KھAΙ=ļUl~ED`N7u~-S6:J(HC wUAcPlԾ/ /H|OPt4+LQk{To<]p iEz>S;K$k V!g7DK9fωl"6\]$ ;ecx⧤:RՏ'lO2 Qnn֕GNT_9wn-E{'൒AvbD2%r`y}y3юrg?~%Q?6)%fΫ_O;O^P'|`?A~KߘtbJZzqĠ"=wv>= $jw:Ϸ(2n(d `{jdN> :uY]=li®(KIK#%¦Ohp b~Q7.*/.B5KXR@k#Fq pgyWRt ghfA;&kyvBOvFJ&ٗ冠GX%mnF)vW;;kh(ll] ,\'2).f'CM 9 1u\&HVsR]e%&C?MrEc֕Jf?XH7R& Բ Y2+7Y jU(S5p;P 2 jA_vC19ݜ>c_u,{LӀs=ڻ>$ Ľa"!,'"hJd"DKKf APivLBz[}P\>z5i:s<ln:+9}JZ1y|/Ecשef?r{l$ ȦCe{N057YVIx2,-НҼNqBeb9Y:ls:/SMsXXÜELp(sB?qIXsҿaw i9X;#~,>:'wRo%Sv?O ,sgʲQY[OCsp7zZ9ؤm"d]/RT1k:b.~H'Oҟqhp\le7T& P"r,ohGNw,*A#l;{ubĸ1ˬ,r!w_NdlB{ggJ /00"ZL<*q9n3OCSR5\j/`.ÚLN9-%=jgXǣ5*}p4Lۉ0. S()acf &ZuvMDo=ZhxjORpKd.A6c>2ӟ'ዮȢўGFD*ǪXEۋH#v񤍤遇{<_Z>tq`6nI:Et-r䌦WY@Yl3c[eKdj~Ĺ]iєFY<IJV9pZeɔ%ؠϻǓ\ y\$ZҏK R{On}IstH ~ԕ 6KdF# mt&n/J$P);L .# Vi"d9&<fo6eTC}~2RzM%B1V-S UJ$[ͷά\ƧLq[0ms-W<LջoQ֠*]mFPKQK[eXOݭt !r]`q/D)5jJ1JAo WZoDZ@(-Z~M+@-,P-ru*rr$!(J GJ窖8(|?1%v\:;T{:E/1@wk& wxMU%7k9>sވ3g@EOP}K2#>~&sd_jT8(IO5M"6)M IɊ!A$t77F7(mn2lY˰99Aa} ~@~jy#3tRHiDκF'wT+;{C'KZ}5'¼ǹ|~)$Fjf:);5MgPFAm{+}v%Oؚ<~coe#YxŞIS %OX2& '{\ې́?DKs &@{6$O?⽉6LvaYX=)LunQC.a^Exc. z"޾.gm'LHY~pnjT́4w-"V#eB&Lq`6œSk{zGw- m_ npN NLP. bXIF'z!FdўJEIDdhb̓|Ӽ3`#Dxw%P 3v@zီnay EϘٹS:恀!mAt{jN?\"+MGjj% _k=!)sw)͇և5xD5_}h|8D$)\E% S}ĐqO"¦X$N#)ͣcsSճI]ߛedE)tcK!J 1xDi-x:e ,n ᚝H8tC?4ga'Kj1V%(W&; qSuOL spvާ.Βu.').P5r~ O8K6XȀB _xO+WyAQRN\5s5r !=?@g.pZ: ot BwFN 7jZd/ 6KSr&.3ER 0f!EyfM 45ùłrtq-` y_qci%%O04eHc&A;]L'HN~f[&})le {}Ym\ DzoY3Ro2K.| ?۟BM.,~rlU3ym6 $ "D :u|#uvr!<+|ԛS0?(+e0;8ln ^sxθbF;7a?]|KiGw]_ vHxTd*I6trߟu{\(W%Eu'+=Iz "[J 8}ttm>DMQ]sZmDG "b\CLJ}02}P@B@ q1FvmyWW"yBplIԶ^HN~&wg*D|TYSȱ+U`uѭXCњ+<$M|=Od= p¯?ns9ڮ ԭ(ҭG)dB_zo?DJ ?#>O(␍L& ,ܚؔDnRa[':}?v"\Dx9whKն("O>pB2J{$ṙwPr1:]s BS/'9xPѐIbt ڶyjAICS/2(귢k p(! F[eAPw(`B! )~Cع<^C*rֽ3H?|pr{>l@S<mK5wЧ1Kc_W"ކPK}yt7 ӿ5@n'w5QXrbzI?mʷWw}QK 륩炐xreZr+_<^ x, NIMJq*4/w`|bzux(5Y xQ6Puа61^8sutǃRTO{\ߪinE1asIX(:/U)t=ae"6:꾦9J7U3g#Ķ0;HUUg{ſa,Q:;L:H C]_ 8g:*hW] @|>e=1$LhBV?_9`{&+<P ]roELIXPe˩txݩ!Ga>Ҝ-|)]}Pj^qd-'<GWNtrmdQ) >SSgcRlo9Ղ™ItgQD7`M:2'k]">O63"++!}^yr9\h8+Y2gApmm8`>o\X% I׾u-N .[H| 6ixfٿCG?N[wjź5ݹ;a񗆷ΕX@hg&ӫR#[JfcoM@->&yTX]1Y" Dv=h@[ε-}FYS_z}Ǎ8* VjB%Z2qFC|Vt anV\W>=I)0ԉ#ƺuAmW MOk;bUJG '"BdN@9+]lRJD9փY91Om0*$sPki@||I1 m6Q7yֺه>F1\}ECMgDϠCj "Kc~mrh`4@$-)5VI<%^CNl@eA[A`'k蓞Yƶ $gڱSe^eCt~5 a\4feV'@kHΈU 6{y$З)F(G8]_WvPZ #Mِi P846P.qEBKnhS3=9Z%`,s4:kW"k/p.}m= ;c.?y¯R) ,QIxbYND̢UR?gZFܩO"/("9ZaTC`C8Kjc)q2<ƾ$HTr/%GJbu*ңmÇ8wҸMs{+#Jn>"0.p+#Zc>~/SSF]E6ib| BM1L[e !JB]x\2Sޒ6<\ , ~sQqbE5ŚFPb%*9,BC=>I#Ob"7_P=|~GZi\0_FO5 Tjpx0l"yG-2o~R3昫'K*\"N|q7<8ON&d" 5A%M7"ń)V\:e-H+3bc']&o/>p^FIԚ0>XcU.$L 2ԇnUY<nUj;jĻJ˞ik6]r{6Y8+!'# ^$~u,`f(VrNc0&4G=XqG+塏!SWw_ۆFQvbeaR3e[$nz0́ۇ%SB!#$E*kL^7afG*v@ }oP/C{f=xKJβ8Ҩ[к珏>fCYqUHٗPs$O\(=Ic,/1b2e Ge3<^| pCTmϩ0᧒U3.:ԳjeVHB/|W>J10!YJL@H";z0,7ט4HO4_p7XQ]E[7f]Ͷwð!7IX,4Mb)xP,r, `̪B*dK`*e,&F XO_0' Y9-*a,i>RuLџZo 7`o/h+yBI+; xFڳSmq7B 2n2IZ,vP4Hq 7tMUpö2(HQ^эKN)gʱ&œLV v>I'UnŸXtl'4N,Amp {\a`RAm?5n`W@ũ'2CPu6S4PA }`I..0ny7?A3rMGjSW;C-9`Iv HE*ڱK ԥV%,':IzI!)Ef*qg`;mm)׷V'ޕVk'r!a[)q5d?s5~ڳ/>|D7j}ms2>f#s?DV`AFG;g~?d'UflJ)_çWZNB1.?H|SL0ku'^ OۑWFc~:uw-e[T0%Qݏ!ֺ7ﯡF?5Zuw`b_i—t0^kpŠ-/ @pɥ%Yא>~3]Sue=@2#splPF/N[0[kf/ZZB!YU<ղILx6j/j-vtsmϘ}Ƶd, "6<'ںDߜ-zŬYZbI9{?\Ei)2'`I`[\ʱ(ю| X26j@(sc\Juw9YvX?4{tר 2>&7J2~Е9z1][i.) =.ʝ+- cTNGx hiI\Qv@P(J)8yoz^aaW:{kt~:'DbΖPxof?+{z}xI׆jr~Zo٪O9w#?dnl:fVs ]-9WG-߯p72(oO8:p$FRff>3- 2Ϻ&v jV ̻y}麀0׃;g[fpRvN~ ]ـ|gxm$cbr j3Jog)4/BmRkG ~Ȭs?r̫::yNRk 8)g{X,nql<_*?WӜS3t#s.#JOGcO&mwŒNisuFUTڌ.ByϛIE ҸR.ȄIxU͓rʚ/Ve e D}Pm%IoJ; j@f(),cwt(x^)ݤؖ= b ʙv quՃ\x'BloKK*Yܐ:?oΦ&v~L@ "h9+fS j 铗uHj2bYc{f!&5hsߡ1BG^MRcb8`O:%PuɩKMO~(K37AG<)E3wrev `4"\rQ_Mmy=0ƨ>dz7՟U<'َՂĎSucd)2C^\Y/kO-O rjU^D$YmA!" EE%)'jQ#ڝ=p0<ަͬ" ezsG7hy@ZPQ#pyմ[b۫y|PQ,=ʼn b-x۸[L{aՠ;2_G.Cvb Wz w@>T-55 \aiK.4:*ku&b֣kcB_?̢^ԃYu8h!)1^WG("" Eb ;8Ed}M dh==~Qj 6*~YZxS_镞ܸ^Dd;XMʵ45nސ;Sġ~;'Zoޯ]Q zpUaVZNHg1˂h|5_\*lG5YQ )- rGh ̍\٫UbZ"]#+DP_lqFd[´fדLmgSvzgB2z^l侓/QGG@w9:̮BKЕԎcbNe1yQ?|o1>JhPf9nMk#}lPe7kXn.N|SL<qlYHk{í$ö_IJ9b۽j%'!7{QJ]/A'Vb`kG-+(&qle$Sb'je\."aZRD:: 8}.dk0V>PHLvKyK&2h^e(|s^76+B"w8idumT;=1Qnc_!+z.O(q@\WX*^2H b\Th;u^@v6%;QNknd'4$e.oJ5̰Q@'hm%A0z-_"a޵̓F\ˋB~+لU~S0нv4K^^mTh\xBz24^fgE*BCoRyu|pra|;^?]^uN`J}8;d,=טzbr`{ p6{H"nb4Zs'h:/8X 2mcv~Yh#8YhҝSDu&fL)GfWG6q:9qצ# O d|0ƮNC`E5fS`.PsB*iSN @`{Vc!K`$ x>P3lZ)MWejY۾0|F,ap:̤6PU w5x!*hyFqӜ,AZ^ϊMΚ&6`5RP?sRfq/w F ьN-F/p"%Fz#/~YaZWS_\^w~i񒰆!D9Uh6ZsXDд%r9y+;W }r,f@rʍwՀk#u?|^ p.o>џLErڷxKW$] M[[-d2*7Ɵlob uCJHД֡Q-;~LQjIs#]a~Jq G/Yjmi6s١ V5s z/L͕^o!a9@?z@N?(gv8(us'11H1?w!SnoỆ = q:ѐ![ +n(O/g{s;hZJ'&bT&VT_{Eh -|M-̪3C2\AEl'5Ur|(C222X]Us~٩;/5A:0EDV|P9g<ȊL*䰢h3+a2+R79ʧhE± 9K kbO]3$YC}?2{Pܡ y%u 1O 3\ABxuk:-nO R|@~E%?f=ka+݄ETǩ=hOfQFjVI&{#rx]6(f{6'~&&|%11>G.#2uT fFrɭO|Ӎo`K #2?xu6 wnef(v*aR[!DaMM<A+;"SBra3x;-du͊vn`Ytev4Drnhb]9l|'ShFIopxK:KJ,'c Z\Λr"SWRX~8r'xn7?KC](\&E9wdjj:vP dhF tUyD!q)2}&i(Ka D MY}\A6q}DJ c?RA/XĄG$e8+!XlR1h&=A0_!`|~ag9YvU, f4,Uv@ .la6e -RAfW&mBoؑ.]{RMpESqZZYNVj=i6aLx*\cg:hX6XWrǜ]$'דՓ6܍ *4(RA3EwIPBS@V Ov^];XKTpJ\U[6^ pToV-S |2j&wFnI$I$I$I$I$F%}3؟/XZ@M'%"B_:i]o}M*/0@?B}\3?I?]t>h0E`yEVdṲ#0 bP$1}6W=?s=r?^?}A=h˩C!7i6;/D\)L}+Y' N{Jg6͍_iW8i2黆_{bv:[MFvzڟbr`rѱ+)-aqys};M\S<i˦Z舷qtI~Ϲ݀tN[KK=&$$JDLlX$=AflGB"(5<%)w.?5?@ - $7%4K>3뫄&J-^=!nUQLjӔ5'q9U 1 `JU[ARxcĔB>Lj=oޗʔ3JST&Ւ*Ck0/'ˇs!j5QtJfMV~4/Q{:R T<*s_]:RkDzzqX܋`4evjcyxWLHUX Zxϳ2F2^ #.t"!Zs} }p#T 7c\Cn[m}d -mAH՟E>l#gn&/sydn_#fIF-\DPwUOxX,}U]t}؂:4h?x1o՝^MźM&,#l.p(:%*X ./v+||9Ѥ~xWrGʝd ˓%omc_0I.!׀(}Z^ŮK* ch|a:!`jv[66z=/'(fd-\"<,@tz5?!MdgLa,+ᄌM?tjr!;-Ogf9Cw#DrCGik2媷6֧H6n'0WԈ$*F2όG/E'A  @ʬ8%?:|y㗣怴/ F[n~װbFb3K2NrHTpo O/Q|/R>-sFj̧zHCrPx]}'oH(DxdF tTc|hf2.@H.WiGp+hhH va  yO \~6#LUm5Im3Bn x~o |vT뀸.Juȸ \+5@xUL%^Nз#Zk1~P' gK[SJeak(&Єr5aM C6\}C̢ܭA!d?0 [ƽ㫗8k̀Wѵrf}nK]Nb_bT k??\ !IKLrb#,bg, CM3M p\GՉʟĎrN!GR-#1;x2lwi_acj5{T*쪄JƂ'Xr _)\ 2">nc /Z?L,{Y.<] d_es cż-fxf:b% +suQYC|IHzjgA{ԭz9@|5>+ېc9aL1XUvaL!\Q{Cضъ``l"Њ=;ËO§7$eP%.AyǛReZ23O9-j-࡟+s|_Ј2.!v Ѯ2HP$ MI{" HppxX ɄN!X)`{@؏PJ /b榧/61V= f%/DA{O(qD 59cJ P ̔lڐ~AgЙdR>ZhqMrOk7dk먎<˫>V!C3^S8];7йqk,.w65Vbc鈽Or=1@Yp9EJPŇ#i+8 W$Gz{L"q۞yALqJj$x,PQbyR_W*7o6٦Eqf&^ӕ%+ubw5P$.5w~Bcnsݴc >5GW3T&%Ж^؜v| !Aᚗ<"]e xp{s#6P'\̹i4쯑CoJFHǹ`ʚl1|.A u=/׾,%}&"KsLʤg  ) {뗊 f+fOFA tpϮ=Ę:L2fu V3;䌢lDL \W5+?>/'h+kL]QTI):K\3C8(7.dr\-ǭC@{Hd$̕oK(fmud=FigAa#u[ l|;Y pKIɦB%)"~m;II0K7{mN^ےM0qː]y]fG rI}9C޿r2D!|y)qe]TEty7lq.#It50F8Mm>Q8SlQ6 84O壟H*PK`P\뭧Z 4S3EA\(d(tkV,sׄYŃI-Y2EPX%"ȿ-X.eDkάZh Ae~|&"GeYzž985+s937ʶG(DRp$@$O%&h5b+;O&-h 8) By3MWstt{+O7'bn,ui[ v0KGЃ%'tpQf܍aUoL0ؑ@+ }w/K\uM Q&a>7@{.qD];LA4/GO#=9>?An_}fxGl<!rH?Ңݝ82W@1~!b ;G]K9J(MY95E|e% TJH UG\ ?ZS;jbK1&H.SrkreTVS6 sax uWպ=F`v:4&uMAGt{S%UٷDV؜UVmmѹs9 /=c<@QGoJV$.k\<:-/%[ḳEFޕ.ί4, .Ms`]!N `7r0vh3=VhB 4fV8#s6qΙy8(OH M ˄C[HSi0Yާ0E;g ].KFr_Tغ{1O<3]=x'Ԃ|Ùd`@HYtb!9BU#е?FXçkz!kѦu#R4TU1,z5*]ХY4b8#1*Hc 1^^iՈ}+Kin8%YH]dV3l՝1&Z=1-d Ig"v"-Doe;7E;; 6N|GOpu^&r]` \]c_ PFsCoc x/bڹKW %\#ﺌ*0f]#2C ʄŕb9l^9010foA .- GPT">)zL+?t5M.bƠ'8ZU|fYEۉ9'fi6J[r`\Giz: نJ+f m4c8/g_ﮀFՋ{Ⱥ`Ĕ:_0'FU[n"0UE촉Nbgb/ H͸"g&v}ɗ8^޺ lNsxR$Hg_deFMsB4Soe8햬wɅuk:;@"N'$fP! { q o,4b3[7ȇpm.OR74 beSǼ-DH-q өJ"M}d߼`im̦?W-nVXOzx$qA"Jc,> ?kn .2<NR,ȑ!JW4zsFv n-C}ic_RhxIڝWcUc8'yxOTn*G(wJ"(P(3ܤC 5^KOu[6*1?Qqo& v0Gؙ ;ռI|$8:smsܬmOcÑw$$P26&P#چe]xϖ T#/-[_! _Jz(8;ЊG#3W 0Z\!($'+Vgl" h?O30p~sNY9!OdY}owHXT]1^Oql_/O*xb4IzwϫʜbQe*_9.kiWg*JeT,toҋ]k؄Yr 5+󎝛h/:6mXSG2/=[ķx}tEmb2D{L u#A rT;4=iȱ󃂦e6U3Pl?SV\DXTݗVvn"zm*XBd! 9gнmnʊ8X5)0^i #ǃAc?,B b\]I%75Ocz? mf#"39f^GۛFXXrs*`WB9n /I!zrke^$Z qïc#9̃AE ~q vCk1bFDȧ}M4 s`tQ"M-djz8_W.pC?h2}Em$$$B .yxEsC8!Ka\-q Dhv E6] `Ţ+FMMNeu%hY)χ20?,YW-t&ʿN&e5>VcEsEsrs (HfnyNLQObkG쳝r4P래$1aި EA>Ahu/ Gy}~q$weZ%%՝ bۃs'M-Q po%GI>k"& Ş88k-+T2",1׸19Vxa"}aYD84&"tY3"鴒4#`T0UͰ- vgv#ƇօtFq<zCQVH8^tb^5.7R)`I\dzT4`dD?]"f(50u Lf lvt^nibf W,Z;GIr$%B ̣FzpN]OC:@YHdܹ?2Sag-+:%k e}V_^/"+\Z6UhG}B:Du<' ҒvA!t _,Hw'\,oqʓeGZ75+fYFOGh&2yHPOP). L!h\^'4*(ovMaXN=AGV9Ϭ_SiE7UrƓE OF'˗#bO=jTJo#C-jj^ lNE2:YUn%D5DvV/`F|m EŮR6#m~ >gqh)+}]j(!P<q[EA~\G!J.RD,|KX[o3k9NNolW.a F΃*ǝ>45Ռkzon:VvGk~V=Sٖʓ @'BJW˕МW sHJ^<$|xd 2Rz_Had6×Y8o] Z[@xj=- pK⹤`A7S(>LO=1.tTYXX8;CgBG4vS[U`Z*6%A}}bS@TG+0Z\#OF[ܞU<"5&fƦǤn@\ͭ\d,6')+*+9%#[W Kx5]* &ȠwW|6UKj#0ʞ&RxT}Xi'9FL>7XCk7auI6coxyn{LkVM܌-~Q" НA5l9 zY Qώd͠u6j{Zy:͗,Fnžl9$JhA%xoG54(OϠ)#cV-@:3T PD{tB&cH2#p*đ#WϏ%(s;mZѝ?Y=2Xִ!/9A@ nch$&,JgKC@m@tOlB¸A|3Hg\{ )JR)JR)JQ#H\NR q*'ICMQ[透AQ 51@JUrC Q% @sK=3f-c,р ʕEx{*oX}aS@c4a#}>FcFpdKhXt"gìD [@뗉pSXZ+!F"9FGa:q'y*> 1N+M5ҕ ',dS$xX?)~böμD_8T=|(jhI s 9_WY'[|FQB%곈F9,7_˰b%߷ U,STk,o[b9ryLkܝX8b{EC[b%>-F?stm\CQwn:ӷWx;L+˕ f GywM2^瓱@03E<^_PCd7AsY"04\S T wܗ%O) /pkdaI iҮ`g JiJmX{# wi94sQAi`ӐJ-#P՘KTKJ6YH0֔q˸s73q yH1c˜۱tX 5M{r@Sf|0G@?Xce(zJ?lN,W+ڒtr6LS?&+SqzDhQ֧?"71rHiC6 m .;K@괾)]_n'`{mu4VB4We+<'i(kE ldL]@ڣs?3 0w oj;I!+-O-DYI+ve.(-\] CYj{K&TƬTt8qR>P^^ vk!hEMVQ/0>;=CY 0j7 /n:_PI/O@Kdet+&y+pj+X$Zh̟+gzqлLrew.~ߐ/!p8ؠ#B1\YBV=-0_1NCA E=P ~BT<8/;0=N7JHZ,G2]fW s\acfǴP=d_2! *|`;J$w'q$-jT">Oِ!J"$-]Z9W^^tNa\G˪ƮN&9Fh)qYξ غ!#EFg}\|g>'(^~8t!^>q ,Jym w.pOT )VcN5 }|'ظ+r7+Wc /ӛR4.mܨ8y`0hL \/ߎ\l(?<3JZ 9=hg%T}kM,f$ir"NFTeFN}H6*@d-23M=z~x Y%oȟt{hcfOƝ8 wew9J C3}0R]xH@yUñSvYk!{tL- O+kbiM~C{np"l@op5*8e4j$աxq=}ikuoLb, xP޸)@Ϊ24aN gbڅ"T_ $e 7Ī/TTp*n~,4X^,^1D;@&fO0\o )@jg5q]b?T_g&!(-cX`̏z漢Ͽk'3c%&.D-wy-ݼJk ke L{oGø߄x\h؂=zFs-p녟jxn),#Ca@dY匬!!@Z:Z*8M {;}TP{᳈%2`fBLp2iz^bL$>;rm3ا]Nmę5@@1  " ~6,UeQ)j^8.ϼ& neSQ23n1~=X!?3j#RvLJkWB*d!%SPX | <*4 !by7#!6/U_^_RO}3 J0W(.'Y J0ޛQ1Wa欏:#=ty+iL'~̕e"_c|*>ei&Y='t_ GBrfDD;Oj@&R\C-ytI~d1"\cѐȦbL޳S\MVwo4XlU+VMrbm.ǂI=E>Ffo:6Ne `@CT"?/M a੺4xV 2WJ!:J,v`hNVI9rڔ|: Qk2QztlkAsfi2PMLNo#)OPxfv}Qk7 C,}bJA.%W%_Hl?rP-mM91L=>cCco"(m[tb /ي*Yt'p73̹{o~_vQo 5Ǵ3tr)8U<@fzR7n9[ A$ or:vӼ*:2ZROt m(ҡ1 = A?}r f<dN}{LtYU3LtV}QvA/"O LhP/Tg>~-dVQ*B..$<_?>:M<;O4U}Wt Nni/PM2,MΉQۏm\k&4av$5F;.3x,BF(dgoxQ blMsޥ|BâWSkPӰ x0%|۞oxx7DpAO* C3~Ra#Z|= YevR['0`ClV˩~&GѢ_·fh7%3iNPmiQiFǂ1qO辎΃R)Ɇd2LVpޥ.>1xR5g_ׇ_֐z RaQzpD=A0aMK~fJEG[d`d;šjt_eY}: @º81m7;ӅW\pLRMNv S%ISy\Y"Em "cC`vfsSBM?K3wý,2άvJg}݆$0>W_Jv xuI1]sUѯ.,v\LNtuX'|&H0A:\Mr桸E#0tEk7 Kx0Z>5Gr<"W2PY~+TYX'!{PZaIP8G I& BJvлEqLHJS_ԧZf0_-E*-ҭ]ҞD~NffT,)*?9'+2Q5ˎ#Ărp݈Fjż% _J7.`]58(OQkI=uiȥ/OH6uƃ0,O&۬{4NABuo Q,T41ؠ֣ΠL0♻o{`6!,8{M sJr?X"plSvVF"8(Y@knk>/*IyGPXIm %&͸)JVvos>wA+v>NyÍ_kKg#ߩEmI]22ҚgC:uL?/YbotnJ6N'O3O15 cgl [eui" : *Gp1^pby \JzҬ"B%n¸(S$ׁ?*fa +gVOksIB/WMftDvWN__uQ0nۜ;S RQ Bkq sĺ4Ȕ&h)y$MEvc!Ƒ{RkQ.Bf]Prb)Dž(3 z0>g7(t>6b8n\s 첟[I)AδfM6v(LYu8d҉RXE4/:{f%sÀc $ܻilBA +R rjpjHtzh6zbtS 3IC_Dѕ:L#ݭOF2CyGU;`!-&tQpk ¢u7JQ`!Zj5Th%fFp_L3 9|CHi֟wܪ.%I8pdа}2@ԏvBYOAM_l-)9+볧hW^TD2WY"Y`б`Yc"pzb' Y? 1goltP-9YD4;N j-ߨdA{~ku]ӌj1mh`צЋ~Py$i c.YyK_WhlB}T1▭;6 NԛwG NCY=KOVMP8ç$M.B?}Wlyntʾw[t_Hn\"cSVoK&VO@iܫqe51 j/[|T<1c* 26UӍҗP6dɶ- ~iϪd8Yew: Ɔ: [uvȁ !.FB|'5 HdD c[MKE0iWD}1vi=lwnq?N*= IvRd7/;ukudsg3ayDi~ n;دCÜh|UWKy'ty.#?Na`QK16oyǣ`C"@kqlJ-lR>S.!IomҰVVPeEd8=z, 2!S~ 4NFۛ4%: nŌ]nm$qYWա7 $eA^xӅgEzW1 QH¤@ {G-P`m|NLPD,@~_ASTf(A.1H>cZ:-ZYSqO/vP\G"!-vQgsg?JPNfA [#2rR" 2{=t<2EBؚ,}LXwъ+L:sq!M7Q(=KG(eoH-@Ml;nҞoXi!gjsH|ޖ2FPi8Ar$Ef-6 ϙX>z;E+}t޸q$V.qΚL]Oi e ctg)*`YkL#(VP5l{P-Fq7kUB@&/V<j4[Y~B¬΁ϣ$BjA,➈˰ΜOgl#W{ P | [xpKVx؝$~7݋ %!z_X% ܔDiNjJ?GhPU (ـ )[;h;;%:f&~ɬ;T؊"9Tſ@SҝI , D؃2%s4V[sqLgZgȞᇫIBGJER.;'8,w2neCy_TH0R4feio Jvk5yH=sD<; \ajXFfcjNaD)>79֟x !MFh$48-GX*eH/ddR򜞍:>a\C5Ǣ}tPWt\* {b N[u =]60fwkhf9ik"bAQЫ8`7@m(c;Y 0C6mYܟ|`DO˼ÝWŗ'9I K5e{@_S Y>.8~HjASv}2d/eWZ@Dx3a]X?8'f3쏁j^7YFo9Jk[-I1nM*٠IA)F jG:+ TX's!+.cr.4FٌOPvP "29/|W!ϥQGm ʙGܽl l-v߰ )C *wQ MlXh9(`1',P-+N1թmFHN L0ښ0sl,o~<|Eh4 nIAF[(F+p~ݍ]Y9?*?, 7\3VBᎼj /,iS@^!Y.3OWR) LC_e) |_ />n~L]!-#8e㷿hz]H^o_+{MXR]3d$USeOp^PIEB&궺`kApBҀ3$d7#g4%^2HtKJmcV^g{М&今.|BdgS7d5Oxs1 S줱JP thВӓ9qUH;N+`׾jvyt{[5M!=پph+ީ,ϋ}u]@3ђ{j5gy 4)'M(4#.d5,(wzZjݳQ]و9Mst)yhiH VUcuyO`WsA`-1)(ro % Vv&zA<&nUZ{g:d2s߀r/yl%VƝy( ȎQlvw]׼gp 5;sÊ3;4^ "!,9T`*vA^~~b&7Gy 93Sx5iX ڼEHu\(?)5eBmhA2=C1YOY . UjO} QGPwȼY沿V./3}6/Qr# ZJ\dUԶ5ʀl$G|%n["ŧ[ÉCHQJ.e%~/ W~=yq6ax6se†5(;=AyoEo,;2Z1O*oUj ;Px jUql׏aLj"_ ef+IQ3d?@D<&,욚 Lωm?`ٖ1G֛m}V!4!單 ,2gHL,Be-1 Uz ߈զ/c僰W}Pώ4RVΤ܏gq&[ġ9dru| 󫊽8V~t ’T_y~:;Q)DW*fAPEo.$se`p/L(~6V,N"Q2ˬ^tǪ}kmDpoLJ?!޺wb1^Lm/>`GakV907~ 8'qzj7vxlE,0׊x$^S@u6qH#"\8ͱSua<Hަڎ7)~ mY#ŬRr݅\ F @KGӸ6G/FQ/~U8V* hޏrBɊNA;iӾhE'QÞw@YH)IPGB%iGIwp?8o-븠q|870ogige MaHP搊|>s)lʁ&pH;MzP j|x0|GݽLU+?-H i'֊2V'+HZhX j%QO v҆m* c,$EInJMo}Ea$Q}_%DđGS~Z= 9Yd|U1‹jCDbjpgP_M}eЍޠ1_q4TO3HI:E6 V̯[O>}udvdY\RVd@s.v4A7O0,/̞HjZ Ef.j=b'KC1$gD:-x8:?3*f5Jpt|F24Zk8?*ծ$o'}(>I?h$Z,Wv#Ai00FM~ͳgP{;sǷ ³=liSB:yF[[9EDsgОցUKaE/;3*|_s9ޛJguv[hG<-0}‹[dp+̷',y+mO+xKtup|1\(PQ ٞȔ8{ x?Dh$ti$C4*#>2X\sxyd}^=9BMw*4]mWZrvJg.(Oq0 ._m=gL_fOy|乷/Td`HeA!隺"M;`Fx8L1k+`y;M>i9]3b0(WD\Eטubs_ð$Ik r Ӓq|#Y)Jǔ a滿D) ðU 6Wkt"p@P$>uE3u症j}= pW Je;|j`]Oz&UG\6 z-@'j&t>k`0qt6ej t[Eyԡ(叛yҴ>O!y`יP`Hx3QF>ȍ4Pg`rg::uګ kE4l9Y }3{Nq XF&J)W{#BfgJ>JJtf2`qZgk  #3::v@Tʄ؛ƕeMvCs!n{C1`rQ^m:*3 Cm vdi_7ֵv?ȕ-) rk]CQ}X8(B[ꊯ3t3I5ӕ>.NxR z{o6r[1i06…IHx6жj ;`Po;`#zg&I]9]cw8Ao=Ծ6 !JuZz+Z(:(f;ϝ ,T:r YܨY&LU $\_r&67 =,Py dϩHehP<ʀ b 4}+## 䑚!A9'SN@lwD*i"sP%bxH=8jš-!2I$-a"%!?6 Kd digUu}cg|Q9gi|yOHp<˷<™x[LvIC. m+aBR-F2N2սBws" o\~<5CspL+wmqr]X3S!>5}MF!UJfoe8D@?qf9 _?KGG %oL-66`~`9,.hYM&Zj8|{{"9-΃i)Et<3dKҶ^%p>ē"G$,kfYV:mRtזWCt奕o{j>{mвwBUhq-9r/qy|{Z(?_L6R"NoV2$cT(zBVu偃„f `|3䷫wKIA~ƒjm$gfbw[sq,< S]|֫HcS?)6pG,9=xMYom Fܰquf UŋjBPBL>G6(MCb'y$1[%-ęz?,xį)f-w Tæ'&>XꐉyX,y\gapցN0c%Xv1^e>g=rz{Oب #'bIC˿7|k=O*30L-Sff3_p_}$|kHi~UWf#~H>Tz4)dK*?]1o;@DU`ͣwGP\9eA'G̝#{BW=ϩ&XsL#MSO@gP ,y3P5mXk,̓#q'"H+ds؃fɒ-l{ƍ M+i=RA@yа7Q!ΌcySAE4oHP_%*R=_ԇ`NO 3% ;!9ĉe:vv{)sXmSW_~l+NgUQ-?²k>S OS=T@B9ѯ43L2MKc9]Oh7( ₛ0M(ikk Ƞ>Z$IiCCI`~kx ]wvClk|{O7^}pPL*O$nx HX3xɬrq=9^LZ,P'nm{^Z%b6SmiqI|,x*)zTaX%buPF;ZJTErca$I}̨M΁џ }RUZ $)EIsP;bC9|,C$f1/cJ\5|7:SkSUQwŴbo11?F5Nq ħly5@G ,WGAYKM- k(c_B+#yMЊr΢IX9qxhs42&;A蒡iȔf̴\OРjGt2ȷp2l9PpZo;=s9JOfܝ͖4P?z+KgH%jᥚEZUm VIr]U Ⴔ~ф 3& &5nS_Y,BHJ&!]qtN{hJHg$GO\ 2e0D{eNEu/Ў?[V͢*[(V'-PS Bps#L>@R!)Y: /8H&31mAeիSgl4ad5 R.[Unz:qtL^ЂzE z[bnCKrX魛LII8 ֤Ӗ8"WCmyp$F P /~tlVR/77aShJ~͉\ iZ?b:{VcBٚ82խ1LFlv˼2{|7.=2;{3LXYO9%$ {y5T +T7 G [-S@+>+nj. ucGpT3u/x@sʩ"&4洞ٚ^ޕ#ɱI{A:0aۥ@B6QT^jt\pݪ#N93=SDJgE21|͗ ʡrh8mQV@r4>X qJ *e|s{-. 9Pu HٞD4~x\Blgd4BDZ{4棰t8{ʪAUX:zT"-jcXeخm$ܖ)Bf=vǂf!Pt2nIScuRɴs%&/&YyD"Y &T*5hF@pWn]/oq!5.^jÜ{Uc-;ؓ7#}c0kٝЁ>#a-tX3QaGݔi6F3O{Q _X1Ԝ0&!B}O?@@ɳb5ËULĪ!MǓ $#j^݅-Кz/Y|ǩTzm몎 ST:`SLvK x- T0zv$xAh9;),u3ᬼňѮ+f8qo6~ku=sJ_Z$v7 @/)o[4xv7Nͯb4!uzC"ĜK%R f/ۧhc+ m#bW1 +'TxnB_WR$8=u83b|Q/R1ZaCgYLk- mjڡW)^_ gzq^n)L+}_4jDQpk?Uug^FJ>g3#C>I\y:H_X Y^Gxf^f|jWOi-=?BUI+%^'_Ʌ:!j|\6nh<ɭBZfZeFfq5't/ W_5+?k3<@܀9E:P]Qzl6A7EfwJEJv%O;-.FN+t)/q*(}MӆfuM3.l.DpwNYVFܿb+VK$neN =}rۭ }XR!Bn7>{ #\ʣg`/HXØ)B F Yl]D//7`i˾4]nfyyIXә7vE$CVU@o8)J +2v?d #(MJd~-y%)˗[`:l3ǔd!M\.5&Ug8o%]nQ9mdptΕH)h2rW|¶vM.k$?k^oFY@TkP.VWje>Uurw$図*dS`J^fǷ Bϯ4\#dׇ7Jx5 *޼3OnEcrD#$ó p(VrK>on&ĄmDQp1 n+zcR>}Ac)QSpy5A[)Q];̧, Lm L2n"f:JQO++sWgHdg,7O{'gA# X-@gW$BW-.[xVyM̯x3=Qc8]z\&xrbUzzTː5k~6l)FVxxꭢE]NCzm"|3&rr@II}l;YO):]y _.Ȟ@(7C(}N`6S `l> A>i3+#I`τ*O z/`%R#r$ cs=X,h!!dw1$Uv`~܉^Wjxޱ oR gXqxju.{&"-'dխlg5{֡OpO~#̡*uPDԘ^/Iұ5H\mXn{L=mMu 751̌Jw~Ə+FKCbs %= }bU(cʜW?4~Y\)wTBKZʒ ]gt5p@X!\C䘦˖\-JRv4z8K.Lҍ<޵Da6`E1gin~@\ֹqM_ C #b?~HEGyz"r/ܵٴa :Ǔx(DDW~5jNa[ŐX'dIR u2CPnL$[<)Ψ,Ja΄Ī) g9>j9d%W%ټ PP:O&/^?&CZ쥢O4'W,Sw8~C}:) sR[%H;,>s]@r>MƘ q$xDcLlVD"jQ])U0'TD +MQUQf50Z/1Hy4;$ 8k3Ǿs1`#iʴҾ(;`3Jw 6דDvx4}|jK[<@cjx7 -}VFGXHdC}已.+B5ouF"|B;'h  D#vgcŵhJN>H`w . 䲸C2X;m M; O>X2RmF%&3"'99a7'ȔόaOOob&ٞkŦSVWz檣KnDΕнC!4{Ձ?\$M}y.5A`Q\4@n 3s6[Z74 0솲F_YtfUNۭG ':(sX5Y/X"#$JK8yyRqt(k6L>ExXbazPnlUQ2qhQK ~&ӹ1Y1L I--F WGXhz'p NgdnB̊O:p^rEؑR9? Gf(kur4 WyF{W+6(mEД6ݮf*nGoClϏ3">NX\[7(V 9ߎ;P)S(5.vZSUiPYD۪p(!:EBhzf9ui}Uw -&-\*m>R_*f.d8=Y&n|HF|c;e>;RP (D΅8BBz3UvMȂ'^ִX5HYac_}5l-=LՍL=%m_!R먭1Y}\n"FM:`]hԂb7u#;>"ׅ5{GnI*2 ``BmXJ]VF'M\25_?eo9ӦA\df(l耽Ӣgb {yV_\/\޸A䫦q>WdBr"W&x:'y/<a`-{Ej ֍TJ>M"G F27 bozExQ"`ȅw,T&+` i;9+Mx]YwEya:E2!i"0ƴ *|=Ra+_nYEP"(7/澫*EP[j@YOwkHKߧ EwNP.k1(o>yu) $a`kGہ=r޸RXD12wasd水> h&ث q> ^^|5CzRш\A3t(R,=9߿L2b#O\G+r$qN@:ۧc]SCϟ*J,ۯ7H([]W6lqy#jJXQ%އ1HXEqڼZއMx‹z|ҌIJMR3XjdWw 1U]r#3B8(S 4_ o1>`+\Mҩ(Kӛ"%y!-=(!Dwcp-G?JvP;%6d2ze8^<9_5,)z@LV%WtSTV "ӀlR/-.qЊ#}OX.,Yf7{x mlه ZeȝYka^ǻˤ5!7Y\k1ZuRfu;(S'ԹĺڈH-y`m*vuBҩ˺C]55fÇ$[f@(37?._i"-Q#DGBdq~izWq 30 [-je7gv/\f^:nE;hU1mղe syn a¥}FMJ,AB˟W* oMٙ^U5􎿻aы뙔iG85~}\މۤbZV=nF~ZU3U8opln/+6P]X|I4pgaUX,C.wD35H4"5Sr,WYfp~C͕_+qBD։ jW͌1y \csbY*+U\`1A@"old8X$ěF<[*oHBgZSStag?-̄@t^W'OoV C'A"ZZ+ )Yp{hЗZГa Ԕ> g/ ǧ[SgGGy UPg1 \~Y, )7zǦeHߕo^4 Y9}m%筦GI&[QO@!{>[n~,𵸃+3{0|Q',Ny-[_Tڷh;"SQL6_nQ=Z`Ǽs/hnjŒV7}4nol '$ ^]{_f>v DM(aKP/;#/iRU <9o]+.:#ݖe4߬n%+Io8-eLβ@45PlwXVzbntɐI3֩4meU '83$LK/_KT$Qj>ƨ#C>QdDsGavxmp` 0tnc|O kQ`ήKh19k7Iխ[<yڡ"A=]ΌT_Kwu'B^~ ^Eec;WO>O:;M XO\.=&ЦI\-LsqG Q)|LO=>oH a@ v_HC܉x;q? +zwᄽY.5R$d(Vd :; >#/jqb˼z ojup+g"a[86߳ 5X%>8t _>]ZںcmWL>g4):+ }|rDz%.fY,YI_q]09Vxcj9|˴֙Yld=}i̝Xu#a@{ͳHPmi<!?T6w]S\Vvt<IMn~&6'a-W3 ;YLx./C2,'=,ީ(eZ@p|11=3uĬ[5oVuja';@@zgK"@{H8vgp%6m{![xnH;,Ʈ53\Au)58}yM벢fX =620wGM,Ô 22x'4hNi7ӎF}Wk#K$Xi1s݅cZ=Hܶr}Πhb]E >)K(]nŕ 8cP9Z{pam$R6. XV59̮j.hx2 ֘"=s<6ZZV@PЂSI3I2JjmlO1V)'U) ݴ=:|^]>4 4&l<& 3c&nWb\\Xy׿̛!`qYh-@y&׸)3Z3KndkcL\݅ PE7e,NJ ` nPfuюő.'uQc@o}Mr+`8F O6t8ZghݒUh5).d /Y@טߵ-B;1oU']`s6eo/< 5)'dA]:TYLHW#C0|LKҁQ^ij+BT@e's|mU&ؠyInCOՖ9(E%wt0Mv<`5kyз _^NuUI[_b='QgzGdɔ ㄸ̺/d!;3wO~Z*zxR eR[vDzPy( 3.Rzsdlb|{ߣ-wyB:NMhLTcy2[4ט^h[,= ]CѩUNl1̙ a}CRk]=ĵIv?*ǖAm E4mTd LU(,J5|0 [-!3o UDr_$ck,@oXШ0AW9j"1Mnd;4ZRv6~h*BYuf"y xLl+;:@,<q% X?1g*~[ x.;dBh:'bes90'hӦSp*]Q~D#6'Gkl6@jDK'S 9m6yY⢵{ OTpvЬ^4z+CvM9k V<3ʜ5bBDĺʑOyN?;?@(~4!2۹\(X00xgnv )#9dy@RJף}?Ug ^,JTS`  D zh?HM\ۂzZ'Zs t [tJ]YU b.Nr߬^ᇣgMW֏(6Ч;#0sr0Xڐoޯbf ȗh;<`H.qL?X~SNO3Y Ն:*Z+ ~)W#epEQq!^q(`w,wtUޑM;+9&=kL dA(C|6G2Bt&V<4uPeV/ 4',f 4iƗݞŀ0N4D3vyDnP=Ŋc9dHAP?r;?ghSlW31{8Va~=KSWaJ#ٲO /6%JߥmDF9HKC^^O5T/BOb 8}ۉ1`Hym"θ9 H;5P a.LR%8/fis -.>bn͒ ҲNwl/;"3-95+ڏ]ouŅ]tt-3p!"%4nqbm]2B73T84mp#dJ {K^xFŖh bWް3@U/` kR:!¸=g1)8 z(@S@cT !ف,V[tY, 'o#{@0-_:mx@&f͐| aBsJJ BgDAn_W]D&/GCt'jVL?Rx-JXJy̳JH&Bk>_4cBR}S:%i(^"U'V/u 3mR@.7ĞS( -ٟĚft*oAΒ4570geVn~k`ؤ`۽C!U^PAl!-rߠ<#R+d SM( *Zt&u(^e E3^Ų  |EJ 9w̹ ۼgHStҊL9eҍ% `;欜ӳj1:+%fLjwCLG Z1#Αy 0lZXlV9L =P\^H$|1О-). nK5:N)]5֫2N~%NAIҵPDz(,6E(q0ȼkZ X$UZNg=-vKy&f1V)9lcLH%nvM>r[)T/|ĈlA*үGrdX#;BYĹxGk #~eY8KD0χ_jѨ'igOR>TD'3(@$ΖL~i\N&V1PEh(,@Xj%*~r#@/~aڵ?s>bǛ:?1Phe os,[2G ^`E_1{ +PfonlI.]H;W\n{cR&hJ[,O$$CQLzV_]063,o.;›<3D2aU9SЌqVd`RZ`]3}pb(}YCr) G; {3#4uB(ɘAxʠI߇'L&F Do^K1()iJ>p};+Pu ehq0JJ1v~//`=tu >&>]P]#X2&iwX͹Qpy4,9 LgiAaKWMd0J $DR,Y2oiCd=z XR|.y褿j.%T 痪r2(W7s&( ]yz(f_RN[b,^=mt,fҁ /Ȍy)'jgJ\vn-7:wh7@u b=T.xAM%OBX%caw&ZyXv.U\, }C V|2ȅz&a@\qXxp0.y!O'(HzP<` ~ꮑ&lzo\̳װ!1tzE&D xpSU;ə~)BmvXsB6G75-s|(Ŀ{0,JQR=Ht J[l<*~`rm?,hBNŷ)2ηǃ8-KXy,70%I?\q433" VMki8xSH#EU,ץXtZ*Lu咚k>qD'ks(Wk4xuYLȿpko3ma_`nsS¼E7Ll9uϦvby/>'gdP0_') ,Q|Q}<'QVQUy{~M* pe}#r}s%: ~"%IG2Rphِefџ^qHʍ H)oob(q^lAX.UUUUUUUUUUG暙0tBaOu?ⴠSEJd!{$PS,:8h8<]6{in, }> "duӹ a{R\eik\)O#-kD.֒a-bs.PG[h[aG5(;>̠ vz {qr%֯~Єq4Wg~5+|*)d_!o~r E9"8ִHQOQn0c9뷤Bݧ&lKy .3]|;0u0d;h*tJt: îQZYآ_J0Dl1'CwxΔ ҧ1'!jxzXp9U/D:5533rOlg~L qڟUwDEkՍOؾr8@4Y‡IJtQp f"?KVHP>>_stzNAa[uyƚeP|"+[b S} )|mt9NX{:]m mޤWX.J•[ԛٰQYRg1Aer\=Ss([܁Ңn~&VSw6p=N3Ni4*gaA? *7aWVڙS7uΖR9riLBZ1$ 9؊s4$ w@Ы6h2m:A&dpK]CaGS4AѶs>mUNWO& rTQM``m:3wg0V.9i?PZ)O PL+uvx}ti ;8EM,xi 5C#\]ɔKnO_qJB?:sK2V9> G晒䰰:߾g}t.~09,:29<|[Ou/mlq* 볓bdo ţ6a#wyZ|pq-jRӵyxv[S/LLb;&\Vy{%DgAh3Eb<ʘtܟp L{3ѧ9؇fG +)Ȑߧ{|qRՎ>9?͢P>zO&O8R-<ˢ}ݽ X\ӦH|. k}4pG8U܈"-ԩF>[3.k兀y)3o|wFť@FE֞j|kezS F9$4+HH./Am,Pex0:w0^LI:sq?Y"q=7k~~mc=VyxK}=#LAPA7W۞ETFi&[ؠE"XJSjL rVkh>jKxoO^HHY͡x A=n|_#~c5$8NxLI[ a"cvuo_)IWY :j&As~ fͦ=wWR6f,V%/q~ENzP 9̩HYdv/ῸDT;bvRzEffH3_s.,#Gsp}cEdZOe1}{O%;R8 HG[\Hg5K:KS_|dg_: z}2L \ ݥ ՛wOʳ ( 8(Qmo=jsnY?E OE"-_I"~@(/ȣEyrȶ*3*$Puá(ړ(f)l0,C2Jfgz'EE ^',cyt&&. h@\AU~ ?uy %ZJ ExxWvpQ0uIk逐Uʛ,LfїA|% -gEPq!0:&+#'H۸,>BgRAKO9񬜶`#CpP}O.ĕx[\=i>g(oG`x`Rӷ}Eኵ*S$]7X3URdM;yM2ڷ5aHU9F@wMp5INfY @#̴(̷_أSX\`W:PBlwow<Åaw;!m|Bׁ閟zpKc'Rn|Ñ#m"Mݾ1 +@y.Z!!| ]n>S;)Yf]*t*^B !]2bFQKDAcQ˅!edis$F~:e6`ƻ+PX'0|@^,Z~n"a2'c JoecBeyzureԂ.#'0َ}8.,2Z'ɴS' ٦ Vd' eΖXm ȓC.]M0 ᠴ&кp%Ŭan\X|\ fDX֢-R&|8I|-EʎLo>(3W oW㊣y8jkvZ>d eFV?oir;/ZM#؈4K$LY>H㲾~^/ wk@"-!;mLl(|M_ջ q 7 a>rGLW'*Yݴnh{VI[Lu+1np1b @c.o# d"nO s7R_8S!͟tmy\~g$YÓߎE\Ceؐ\]VKq].ƼWe7sKB}gt#Z_C>rj?^_JEB d<10%Y?+7ôChTH9##F_v b$yLfP:ְ; ED}j${&ONI zl\d߸fy \jGD f7Kͳ\JN$t[TаY>c "X]%1P(G ZhG1g}elgHm椡56f_t$DK,C)V1 T؜9vk/jk6⮅*w%@䦤E3fUS'w*e 'W3H JmYCY<)؀oҋ:J?ڪ:Aű>~Ȩ&9\QY0N:dcdc3{Ƞԓ(Z&GesRX]=G*uؐKqyܵesp]=_(ڏlm@rY'@dȈCX_6hL"wD_I] SZ SC`*-=4B_SHO)P7=dHGy~F1Hu *, j*RIe3gﮧaTȒ>a+'Oި5 vVIqK_xD:F8gV͇M$Z Di.nSb<(\{xiW%K[UzxUqW_1=b縳q?`h$\ڤ tLb0 <-Ӯ 3OKubdڴ‹JeLVInn>3/׾h;aDJg@Th 6 -inMH gg(;+z~Q{>X6Kr 3`q5&toN6I>iZ %Jh/@% e4{)bWkNz^?#\Wmvl쏫TtC3ĜFfX׽gDH5?FkճIxY{(ƗMʦS:d00/;-Xշ?UIZlׁfZU{Ӱ{`ˉ_^U:x=S(.FTN?ذGrFrqeߓ5V 9dIl;Sx/t䦜7"iak,kԔ\npg~'P{nha_R~s'GR[<.<0 /m] L=vHBi=tݪp?)r'Ļ~5x%Ёc`!A]#-mzߺįb!e{RPyL Nwҁ@iOыzރP_i,,gC 5maR\oeU)HiR^1+OJKvt+n*b\Wɛ[yg?4 GSzL\ב޺)-7Wh8a?PSgv|SJ1FQx(EG9qVZ$xcָX'+?#(9Ʈ6ؖ{nB)CÇp~x̶I vBSsV@aT *Xw4m7B47<>\zBMEdb }#K Vdg*MTdj^-!m3 F)s\CRR3é.Ng6A?RxH&K03NوST/W1!hzXz ߚ} 8dj"BWU3'*ߑ߳݋>^LÐN/H^r}Uܱ`р! g'Br"l6+l."@tDI9!h1]Zͫ'18gzUʈ0~PicsCLCqGv!* <\TᝃmRYn74Ogh5!\5^>(ܛ+rj7ipH crI pG$UvGLu:C .w{xRgp;\w")/7AzPcعڨT^m Ke $+L 4~ h~ N(̲#o22 C>s^UۑC*.[IHPZx4)lIpVBh)έFM)D.8P=1䧙pZ%F:Vxռf(lWks8AJDFb=~ >`F}U,[64Dh ZYsx #H\*xE*ڈRZ]p#Dq U~Dw 08ـB?Xy !BC'BL$}v=.UECɼқ&tֲ.O UЮtDIV3s2Eg))-,EbTF+58O,(Aڪ\̜-[[RmmJDh7Lµ c-Z0qIrun<QYD>ilĎ\Nz ⤍7CN'A{A` 08yZZ^Kz3C/}j􌔩Cj&"+9glʇ{ui$^0ȉer28;*.1="uBV󛡽XhSC0.܅NqB\MShc",GstKRe68^,"^P]L?]@jٕ  Wq *~!EnAM#GwJjHvUxBh̩SAZ϶/sTc@Xr%SC̈ 7 GxdF1-0lcsm,p Ȉ0<.Kp5V!.hg6i= 7i\e!I=,땘]eEmZ`a0]m5ۀKrQz980e|}|'Yr0 MFmYCC҄,eqW AJn.fMuSW>K˶*KJ$7=u&#SUg{\0*Um1tӲ`njvVQTwlQF.w";޵@|/> y;ߗL.eM O=G0P S{2;(\XA>prNSM[2MJaT]9ŚrrJ $Z OVH6Zq=7E=KiB "`=1#A@؄?䘮ؤ}d끢wJ$RV̀az;1(fzR{+!ڦtŞ@ƇvVtװ/~'N*nM@^Ͼ+Q 'R4XB:U(#ܹ[:Xq $EB 3E,x&DzǵqLЈU^%~hsOڟPKh:hT~}^]ϓSg 屪97IcȪns3 3C!*){oj/eDn|;lQvmjO8@b124M@O$moig-&lnRo%-s-fwnz4r^ \IJP1YDc'Oc,t鶸<5 `Q}[GyҡoI <"hAE#5%A=Tتoa*l=1OtP+WTP=Po|,;NjrS&eNL,Pt.eQ0Ӹ{DhOt" aB8G{dgW&%ya2Uč/Iހ.zCEJ!Ms|5_/" Xӥ|4],=υޜ1Ǣr=pv?H랉vĆ ɀVY\{Hg\ژ_`ħ7i*2)`6[{˪tS 0 ۙ@"Cr-m5^?&VOUdލDi֡%#.ӟʹSӒЏ.&n|ߗ'$.=V+`f R}+J͔Ljg__G{7"l%I+]vm/dW \@2ƣY rpF+ ?FV2e/иd,cqؓq D2Sl1pFI [ʼk*Iir41$Mwa85jì?J'P)%ͺx. ߻eŻOHN xYIT:=Dū[[!D۫)3h!J[Y!a`))3Ƚ]8eGPlxgzmi

',Kb˶ R7bTTv B犝q;su/Zw7FU/]ph"gY1OR SҮ&`=Ǣf'V]t,`;K2u`sTq/6B@Š>܈ڠ: b_r,ACk3 |ƴPm%4V)mRgʎ`2\@wMS_ux2v p^9khjrKmN6|Nؔe\Mb^b 0v#( 2r#uT1N;ҹL|2]G춓}g 6(v$Me?'(dR8.kYAw ?fζ@`/>;ynUGɿZ tx@bΧ哥<F7SP(xLk2`\W%&5w[&GSHe"`ܹ 42~uq!_jnU/}TFitQixR pSP(Eld'@@b!/I V|7|7|3 72X}3K*JDIu@4'[߯?#=c'8GAԱT٥7-I][Kium.մVZ1'r#y(A^pE8\gC ,{Gҽ'׮ri @7up [u|7P@f@m>N!c)M$CҨ },YCڀ{pv<+iOsVZRrjaPN _.z9&0e5sCcVT(e+^vId.9G\l̔Я\qH1>X2-XBa򗔼00yeÿ%˜$T>[UmJ[ @T% ?In*2'/@!)Ym4ZSgF=K[T: _]+@ZIg!& -öh=dy^i{T*c 6k6:o6G/y)$I$I$I$I$I咿;7qI>~IےI$I$I$I$I$IBI/*?p*A[U$*){B#2 Umh(ICi,8EmmmmlHDrUޡC,e Ds ͷ$I$I$I$I$I$I!SolXcYlퟰ)ϴ}Q!ԴK uZj'B"-4;9"Ҕt]J1g6N j\ Aē/S_PӲY!`R,1:5ywb=b%<)3 w57ƞ=i#c=c=k}ZC+A\oGa߷{_W{_WzEKol|C6o' }^2so3{{?O۳z3lR8eZO L_qmMqׂZsY[@p5_r e7J*鿹Su3ϰѶB :Ymw.J[<$_OZ(<^d8 J$z4 :/#Y6JdA_m lj,Qvpq|2O:0 Nþc- a}aOPB{6@ɍ/k06}#%FQ*JE2Me&e)@lbeHԦFV@E e"CF,6Y3;̳hzc$oF\Q_^^>d)PjMX X { uTd #Lgm${w::k x˰㢵"އ8Kۂ^:N\B9sэa)dVi Ʃ\2M*ñl<=,PˌuA>Tt[eUUcadUpE?5["a%9`J1b|a|h;Zt_HWM!J Ę?X?m=h +]ɁjZdJ={PsZ6}kpr){ w }G&Jh:FbjK]OucK1T'EV")qMe\T J WsH+ 8~06[L;y_X^QW8Rsp,s(Brs\m |_|Sys' 8T7EOϞD[.`T&fhv6p`Zj2]Hqk-]8ڢX})CR00L:7X^ֹS4 =o#I:-6Kf$,ZYk tĀB 'X?8W_>'>JJ^؆|Hʞ/ )?"*lLK ;'nymU?Qc6qJ~9EKOBsAȥ)=h5xϒl\~+fO򖒟 OOAͺK&I޷z2l1=a܈ԑ}ypW/87%UCoX\ C}":.3!f3sO~*rzzhYH8 {)`t?y^9WsjzqTI;tiFܘ1=6{wνaSᐯ |?Ϯ'^/Bm r|22돰dCrlwG*v>un.R[JUZJn|@gA9,6iK*u0-"&QO#s:2|mڻaIAOsDط]Ȧ WdX N$yݗ2 mK= O pQͿBB(lw&#/DFu>~.)ߣj"rDOK2HjHOx1k]I1l)~I3{j9@u+F}\l `,ss Om:/[,QDh538G7}•&w& {R!84hvHcQ LPEQvF? J*R<[LEѥbhfbnBE!0d 9)BwԈ>킔HAzFb] mɌ*.]dKOð5>읭0$=1 N ]_uE*5WcylSz \`mM6z'PfcgⴔH9sa+V 4jN(; PطV>$m톘1`x/-=WgۅP.a ^4&G'V',PDt߀kW`4N pp++* #(\̚1vt&S#|JZmaYֳ٣\K ULE|=~K(e<{u +}C|;@3EQ_w + SA֗ō4%Kњ"L? *aEYǖJvfUm^JUrF %KW6E)JXN /YS\ۯ<1A{re]fA>Msqj;uج3[}v {P& *Gw=dR`ꆾ{`+:l4&|J-@MA=c4:9" c9r -m4c_q;񨟢K}Z֝F64:hgݽU) k*%ٔ C% tȈYGq"*.-29^!$^l:[[>KxT[rlڂnd*QL`P 1Y-8 8}h+CĔlX C?56?;uֺ./6̗a;j8ɨeR? ٨λfX>B޲݃ &u[f$l%=#WY Vemپkk_gN'C)s=/yјLS`xyE}kYغJ9MyW*:|f*@ c% URHP5e[Gd`WY`d3eR5=%#u7xߙx:ϽAyAIɔԗdkD 'I}귫v(a3²!h;x%:2dvH-A"En5wWSb-0*mM|h64$32eYwħ٤eOveJF^[WscϯGSn(YV&/ys:=o%ҥNG;E˄8NQS2 ؍S[ZvdE`fc ,|7{B%qq.̥(#RVJIzp []M' +">#;RbRW'3'^])2E{f2(H}quqR+& \%iǰ%ADeY%P.f@`]DZ q7:~9_S{ 20yMPf[xߊr-48*^]59 c,H"^ 2~=Bn PhB{~FO9;I<2l6&탁xΟHhYqKyc.Aـ3F:o$]s4F_R½FyؔտIvp3=*yȄ~GN -:97. _*gčD:B)f|;vBk6ߪ9%!z1o[Bԣ,D3#vy(Ie4׃Jm.+kWk'Sǀe7q>ьshp;uGDa K9V(Fo]#o})Tnsf-RcB>\Eԅk1 'VDAl\Q 0bT9~k#@uy'F6ہs\?SܨgY삔[me}ܤ[Ւp&tE8yA:Gnh Q&BNtrTE|W}\qNג{cLb #aXIbyAyFۊ*nPC;cAIVa5Is`iӘd5ciw)=mw{p85䰧5EM= a @G3ntvJ7[w _PwƆuMug ⃼< 'Ia^(~i.ࡏjYG|mF& nJcI];,T}a6@Oх E4r@O\~6V)ʈ4hQ94;'e|j5̦pfCEK-)$17[wfk%y-k&FZQ0Pfsg.<lxw6)@R[e#*LkyZJmu. sf|56"ص]q,:bo#Kfׄ"Az=[.e"@(.!w2:2,|O;Ƀd<}t!.+AӰ{߫€uEJu #63??^#H dwKe>qI"HJs qd3pw^G2]o Mv@&#,J`H-k?]Dέ+8?O- 1rebR40K7n4=qTpûN@3$|.l {*H1K6j\b09xyh'o( fY_)3f*Vbtpt4Vn"jt~xZvMZ_㄰Y-hKI 1_#?՗A^OuZDeEYId z/z tar3AEr<[& 13='Sv3s%)E|,^2Hx; ?un )#s #ceY𻲽'ηy*ȃE 4tp/n/vKUCo%5CfR3_psF(d=2b]Xy_ҡpp5@Z͢VY&V7 f}/ӹR/4iFО(-CKj]e6~ۦk];S D$H@FZ;qA6Ml.iO~ѾEUe>k?aA<.$C`%"RS_^"mW# '6*YwENtF>)Ed.ifj#1kg14؉YNW]όMXtZ=Ny >n'+r/ך➾CvSCwL*gr>:a kn򧹅^4peg˕*\vuaR$J(d:bhp f򨙁lY牬i\pSȽ^n~Ǣblk7. J:PtE҃Ɩ +lCkxh"Lq|;7qvYbU.!εEchJފ"<ʼ;?Q2v?0`|ked0JƲι @.NHZkdT:T[:Lew#ISJUu\òQ/~iBY|&̋BU {z#EByM1B܇nu %h^͆N͑+MtOpk-gi WqbN#ufb9%\\[`԰%s];qN"2HQG9 Iq,C$[iǸuj1=B7&pR rqF+LU2*"悆=#vyI~}pFgiq2_ "/;^O)=uJUo$Μ)+WJA\0GfryQ&ZhܼCat7䇸-zW %~6.k@2ݐK)=J0p0j-W_A_zmr+ { ),aN*hZn'SB/XkF)7Asd?\(] 0G=~BpԈЯzew9}դʜ$d??Й >a3.qIKr:Rt7 W<5Tz DV3Ʀxg*MKgWY(Öbj z ^Hë)QZLu(U +ʺyYay}\ut2'~0/*)@@X)Jo&s~5$mAJ ggX?yVwylUO;[Ry 4'/au-"bBQV:t6Uipr"8h0n@bKN?-L= 7$vsF\ Lz:= y{@øǴaDI8 8el"GK F{f뻺2zF_"eXDI _nޣ;zI*q.YNtd'zs( 6! >f 5H98pK@"Nґ&H R0.N1b"ƒk\op7/:]$qnVp4pnxgIF+؀ g: (cxsd9arȍh s(&6;uN`E+ KibG1}wR/ių7# > %TЍ:v7T1QJ-e "8FO9I'X`ʟ9 JjSz ~# ],ŧZ]+%eS ׌k WI/pt @!е\%r>l8_km_$pvGPpF?{# >HW Em?U8Ӝ{tQ=-(A:t4mh}^c !XG?ɷ3j/2ALH~lӌÏHK@wr9%Dv#_ϛ;_M᧹4D:LR@Y*rKEmL6k_Փ~vΒ4xa8T[m 0:s7H;#ۈT)P g6oд[.-,l|h^hq4&=Fv^L"R{+5)Vjo_Py=n)å 퓲IK>h$h\ЦF(j3v8z->г#}"s:iGc}YURV)c Yv:]Z]IܘT~)o,H|Y||zDV'mkݢ >S,cu+ 4;$O)Ī{3LĀ2>qmSZZe## o7yY:EɩQw%lâ?aptyA$/cڔ8{SYοy7:J0lz:3V~:YrpiPl),JY~Yv+v6 #x!4cu[ W)Mvk%bIxF, Ûj1"A5Y?FϏ!.JZV ^,d2:(ݍA]Z9fx$j?vHc9S#K mRba :7ظE_FFD] &* <& m#yi.:5F2t'_YubJz՞}u(vwƒuVS"̈́9bFhb.\ٯx\Q`w96#QݜO]L% :賢DZ/aN:oU~  s> 3CV*- Q yu̒*Xy)-2g0LbLh&g;jqB5NJm﶑)O!S}Óp6Y ǤP;عLy|dmx_dŰ5Q$˯!ql_"6=?r(+<8 lPZ tkɤd^I$}.ڌWvPoo=WvD֨K╬ZlT7?=3$ƪ$J1<j]R8-R'oW%GX `}g S:T)pCqcupw` k8&+^CflrY[1N,fD)+;lS5*şi?&AV51i5^DyjP&9w5#>[S/IXlKͅkј+lW$\  > ..J¹qI񧄀Z?AjJ^2ʼǼ0VkObb_弄] FT ~n_A_lā9&*ݴ}fd;g]b~.fCa9t蚑ͫG o}~^vp˟RLpoNX&*KN ֤N}cd̫ !WXPI.yā<+#EÙC`ǟxLW^ wdC/78J(- oԂ DG Yjy "Q{jSչN42I+rfrN y߳sFJs~ jep};nnЗqŀwp\;~\i@'yz+:ZzQm[Б!*պ,?A*VU9"83+$H8qj}k࿠ hE8sJ嵖 W cBP+ b=PLK"V2ۃ|PGX2wC:y ʔKq,`mR{-tI ThTq-u|uLZSQ"Jt,4fQ˱o{5wK+J1dSZ\nAw+\m $ND2ifnpbF>5b?]geR4(EY[5|Cݪ{܌ၚ_ }:&[{--&(~~iU`O#-cuNtfUKigܠ0`SMNqf5Ŭd+qC:-[|3}J@!~(vJRHHʹ'+QMZRFALM+u¥j/alt32o._k=O[m}1&P3f`9s"=;YWpUh4m;}! Ylj^+nlIdNtڣ=# OILcNǎ/p5jQv91+&u2n7i24W,7UI;}UeL6 0'VNo26w;,z(ˊǨɌm?`\hޠkUNБ( A#p7S;H&fM9Gon,̶2dD1B~ܰ!-3ʘخ4y:hVm tzɮRV~2IELjW!{S /P]a -}mBc ١R;ȵGxV`rK_Ԝ1Py*QM>*IֲثnsfQ'j}hC4ږ 2$Lx T&VbHͅ,J0=T xcW{U+`2`LBb. jk23>BRAS b:!;{;3]-"&>gjۃY| Q\ZTt-íUK{Z/2'n" Lћߺst*a&yw}q|璊yҚx edKzGpUsjUXMUGRstKRnH!JD lY0BK/ l3dC/^F |pWI;5ln:ݘV^'U&sǩzi03K8-fY?˩?PޠR@:)/}t 7Yv ;K'uG8a`ÒYoz[ThL4;fS'q˳ 3#xhf#u1NOɺ63){ʉXhMR~o<GCЗ['HD[dߺ}{6z{^bM;Ԧ(4IsornI S elHCN !ٙȖpI) Cr\@-D(I[ Bp'V8ytBQΊhLb8F`SGJ j M(ʶ»߇X#Ny4mR.b""d^ы`DFW$ԟkj^!mS2f2e CJDôbE-M.$ sjL ! Y;9OܦO7Ԇ>ZPoq{0B׬- 2&cy [f5  ]A2UB TQ!]@)O&cetoro{ 7攧 =RjUJ.ps H7H|zI\N鋦3uU?N6i!K _nE͔꛳ e\ M&chM@&1~Oyu6\2c f~N0[dl;ҰWRM鮏:M Q~57BNSp do܇D|.s`Vr$NʢjyUyUOTj.#0+w#ΝpjA7N]tY>WyI}:Lߨyp)1~QES7YqD1˨V ,mF1$2Ft#gGmlRW9g:fu 05PtcjL @#Ce<{y3gi@I{y#Wɜy+E<}En f (k:Dnp,恦a6;ao)6`:s}RZ2lNҍKhycK0rl>9PVl2KV9#r#U]"f*Bo#@5Nt+nfXspRmychuݵnKi ȉ1֎t<V|$EJNPEUgo;ˠ(؅{.>Tib,0e !:"wbt?Ze? 0y,/NNgML2BB {8?7җ֌LHlDV9SɤT5Mʍ<3@ t? 7#:VaڌN?YWܨ!x%ϒ5kBLdѷ-.yd0'Qk/d I:jx~vf]:cU_^R],΢$LQ}iu3"$Qxr2-1w[᠇&PdNdK|eV14,2|ZHM!)@&hОQ[3di`_7ZJg9Ώj4>Y^&lNZ;*zd~I.IGC49]FΠX{z_zaD\s遝\Wzr[i<n޵Y N/C[c4 ( |:O* QjL}hSF$% J/n_겎Rw d$^} d R|JЊ3*dSĩU\rv+FK'Ý3 H7NڲCRan 2Ǚ#Z_Hi)Yǩp`2n {_fQw33wf}0ģݎrDTBWa{ @6/ K3JMzb6P<'KA¡e4hҋ0f9p4qGS[]` ^pAM>v4;"G;sCz"٨OSCN^rӣCд휵#΀G>ކ 3vn8"l*L ꕄ:K`,ZbN_;,2bKP,ԓy2s!tTJo۴ C"N:xֈRTOS`V^_ZyGxa/˱KJ ~pҐ~W 0(8Doo7BۙjևD}Ÿ XoZZF~.@^|̟eWf})b=vtVM WS(1SI HuunT{s'F%M8#"RS! b+L^o;iz&-R`>+7 9N+cL5;T[/SerQOmaZ)-h9B;p 1 q( yKp~*Bi;uxٍx 5\!0HT UHTU/ +?pڋgle6bwرgg g*l )#QUHE$aQ½\9/@;#j+GA\9$ IϭGB̋Iɑ8Ecigp b | >ND;I%Oj8s$|}+;{%еu F*JmxI0t<.{q͌*-V!Kyb.fT5 ߖx_Ɉ΢!H^?=ǪS.TcS<\oТ8:Zp_Ck&b^0/HF Rƙ#o ?G7=qf裎^*8?HW['D;X;ҷeݟw?ra[C,yOdrFIH#:"jH&mjBN3K o% `xȣ! osZkzW V|cvt!s ͠c`yI@_BFN??DIi5-@(j(g<&s$cG@[^;70_t-]kOa;76n 6󂸳iRʋ2' ' #.pb Kx TٓF1F)/Zy*wyQBr %qp-%rVCƪEW2h}Cq[Ky\txS׋30exVJ(3$}5W MM.l}>@w,sdt͵=HFՊ&Ay| kf;,ywv 0?:s}ܧ:iY/+ hHàD;h^w%}M.9Q lS`}o;M,LP/VO($=UQf=A9{Cdo+M5Şf^]J0YrJ{`Dhd袬E)-P4CK99p]dhƈ~}P2 Na?yzF-Gf#VB=K- M Dcc_,ZX+L}9Ag~m]thodbVPx;G%3hת] 6ˀ_XukY'}k|IJ MT=v ,vp8+1>p #$HVk?iBr8&[)VR|++-ehzq'!I"~ Ly˟^_4biNwDe쁷_ O eCYaǺ60$( ؃ f)fVQK`0'vy^pޜ=P'!; *\{ JW 2Skmik+aqۥmkA,U^؃Rq5-..ЦՔ8zefka:饵fm^Fh/Op\g9lNP¼UQg10s<![,So]Sß8ez1ˋ>z:ݼ/k4oE|YwXҫFk!PYv4+qaj`5ΐ'b38#D myUе kW]i.@`qfK405=' Ftϼ(tFtNa༟Zl^>$g1yx˂ 9&zwtI [8|暫O}vdw+e DžLuyIh0UtkvԀF后/!ŸˍtJ:o>:}gd2~BE]Rx9@`W@(gkF;$[M6Rj<,OWV%*eClX3^sq\ սz8,oy]uP+~+@5Cp+;9[!Q~ï#a x4/cT`癎ګp{93Q*yGm,<{h/r;pܶri}qV>~BȻIpI!1􈐦yCyzL@l "ژlYT^SN^(0(ZvC,\ǁU8jbm*<)v"`SU鈏q/鉣??sʚ\"4=gش1NF88Z)TpVټq+8шQVFlވEя&ާ!m:v3)w=΅xj!YjN`,ۅLd. "܄38oޮiyHaĢS҉-hJsN&DJ1by]p)4BV*O}'.\|X0]3&}H}WLԮIWy󅎇Y℧.&wk䃚^6oY˪3h[Zs6/>Ax(wP^/ <HM&FfoBqFEg %y;5AHF)D7["M6lY8?~g . bL0r>|-oC-(ca䥶}U9Auy9/pr1O;-0JfA&M䄎Ũ1# xJV l3f0nޤe8LDFX.V@:5B ) "0& E;mC=גOGiqk ;pa4"5v ?G8tD1l=7ewg3.}،#D[d&lLoFX5m<+R=+Zx.{ %\\񽲔J9 d*q8١ʱlSΰFƽWePpM'i)<'yb1|18oFzfs¥!]3F{^G16͛لXKд*|-2aMrΗoӸgz;@lfzGq .og.v jJ}"~8d =+8J"eH9n% {q^:}();VARdCYO0Ra#}|*ڦ6p7ez uQ9v,TqQT.R34{ U{f)(8}]E0?T-`?QjO|.v月Zv~`? v2g|_2RF>܇B%$Igp"ISBkGeP|2  (W9)I{mILBy3CYQu V[Yis ]H'D|Tp4v5L{d?ƋcG}N_] b~hSx Go?/RTgى$F^^uER~_9theŖw!nI+7:͘|&_%{ p!MDz=)1B1Ap܆kX9i }HO3e]NԤJjEtqp}qi:!̶ T[SuS 8RnL34O; ؇jg㕨QV_1O1u1-aDD޹K0ӍN$!U`y#n_ Og݂GX̏Fg-}S9 0oy8KOoN5wZ-zT;w;݀3CrKxlCEh -glCzS]JF'" }۾ןos9$OXeW2lblK) A0%Dt ~ItwOCӧ(=0XkS Ng |'*=\6S/9.ẃr^L>a}e1sC1)["6p,K_S8?7٤iuet*isfr4z4f<(:n'"rzyPvE5}O E.ܘd|MSʿ #oprrrI_e 9N`Q q2n8 ͏vS`Q23uJFѼ˳0G C?G̋"D8,RSLԛSgjzoJTYqXeЀOMXcjgfŖTGr F+@wjeY_V$&( 25Ȫjav!5) f[^ D庆>n%ÚT RPݧo?E7. w`ٴNkns =X[TpP}Yk=yU+Y*@ͻDV[H8!0Hdbv>d|'j:\J9ɅoGpҊhJBPz1Ea렭Lxn!5:ppe4{C];2RU3EaiT>@K59#Q/S|yQ,uKܺМD@voVhCx+x vkM N(M'n2x3azY$?G7B^Ŧy|B$oos1`li>Or¨^&_ x4K2-D t63 o`EqУ1RuiS >!6ΜKVs-~C )@r'9[mi{>^ Ff ;^@H:p<2v1yX4#2b@H)z4.&&&f>-pC]hȽ|6Nb6g-ߐb!5-x;,]-Pz4Fq_+xR^’Y J<=DfM~&I_Kזdrd~Y(>MeQv\ƵgwyjV.ZHja ZV(Rh 7ƆV-tcЎۇ7aY w UEo(KwO/ƫ`(.GP1lEG6Ѝ}:1 LɃj#+qRC ^9ii.u}0=cF\xD-`>#f^ ,kSELmcMxHLe?tTjCtʺ.xf WBNxOLg"8 ! ^V+OGT5b͂8YneLl(]!aWU3DCDžQ`FN=/?š 0ۆz_VXOJ:kCڡ#I߬7TCyr 2^fctyIk}'u^{r5y&8eEwA&G9 [7S@| FF{NnX.$M`0ͬReC/]?v86玑ԒPűt0FfH;ɮzAl`”0p;:T5 绉LߑEċ)B!{Џ|e Xא^p5'àEJ\ 73^ˣ+qZHHvU`\ZUaM5<| A6e\H^Jtë U⫺t2%0׶f=th@8F_8,u8tKP8_INaS/|d\qbNfd+˝2 @`<2Y5 q5toXWD8v!wћ\NGMgE0K)бX3V{6b|).$j1l,yA|fm0emMI(bϸ2В7}4Ɵ\Q';8TT1%uo~CД=)vUawb{}V^R|ށ.[bO)#&}+bR6fz~5Xrr׬4CЙ埿Mg,u#u*>0\ xp|-lĕTa*%Z +z/RnQ-jCO7;W@P%=aHu?oz4kSAp44se*YN6_%MAbE`H%ʼS(f4Q ok<%:vdn;oJXůvs:Axqn wvUV YskPq -8ʡF&ݹ|/SnбB| jЅN]oVݭHzy[4Z6NuML+p95@6}B'ߟ5a/Y8ūL|ffaA/2kg2|;caKa6c Yͮdjւmio@T*_TAx#Hg|i&MRڽ?޸]d=t;?J.UAݼuD#hPDI 'NI怬I}@ Jg2& stOy&LQ[ X\?%*P_b PBY"6޾֖'(LHd@InM9,,X}b& w}Ĥc:èCyW1U-laY!:c͇;G.Wp.z(e]g_" TVUW|A}%w~$ʮ% ETya7O!kǴsSk^#c1pR;74@V}D\j> sC v [[ u8Divh^LܿC&`^݌s=tTuYm:F$I;sG #H{6 > s0Θ4.Q00ۥ@Ӵǩnv_D(=O*@`z[, yF(`ܺ_~-es`j<%@j̀=PDF,`æz> ۰$kKɺ=!|m~0 ]oe|>N bqW+~hxmȓT"9e# DQVW0Ej&M7C~ t5,By*8bm2<4%e&*eࣁ:n*6Qf[A2w =,YԦ]8'p xϏ0hFڢe#i[h_ƙMoB`/K=P{ 2|/<k𧪈+iޑ >16$#r|e!ß7׶* %$s*Mpv،to kݯq@-/隶)aڡ&:J5sϯ lE5եK/QtU8 Y gHBѯ\&Ua [ׁ.魆q_Za7yB a&Em;j[n97eg̰RCxN!Š?D8z\k;k ?hG~O/ rk 7!Iz5D1.l3/âه|'@DŽbpI̝- =g7HU wT.;u4a2Cd(mOEQrfz% [75E8)K7 ?XƊLҞǟM8Q~8iaNu; =5XR4X,+fmL6I@}F{R+ns \1L:hK0XĒG^{ (A gi}GCvA9rȘg;j݆vpat9jKZxzb" {X—.oƯKKBAB͖L_VL7b6DQ顾L95*P BGtD^us8Ayז2̈~ 8m(j+tUyюiluD/&_ˁ"CY 2$5op +5 Ҥbڜtm67Ȣ^\z1Ѯ.l)7 Ix-dt_וּ5pLH&KᴸՖ\qܘ[@cZ }8ˍϋpAJY|x2HϹ0ҍ!7)ȎzXx3ix=obJ+ lpOл߮\lQH?[HMF;|C#@V OTe3N'6 V'*9Ss徝~2At a}sAc?#"OeB@Pzo&0 [fUI<ը2diS`w9`P"`HBDpv߹4؀y((\D)'߇{i SoO'9 o0dʳ/.p^K(K~, )yK¾>$ŰOdK7k\'ܡ2iL1;+.ve ܂fp0uW60 xqْL@R\B}Ԯ$D z@~4=+icZQڂԄT[ zFO5&9[%$a,M3y/ӿd{WUT8ZL\!f3Qb_jt\-~-A6vTYWCD\[ɄD &ݓlpX!Je<"Qvޏ n Cݬ[LIdnF ZUi.G#<*H ]౳A&| SsNkG\*7lBw l4ТJ\%x@%wH&Ť+铖F{BFn"d4=݊*t߲9OItI` ㆙N6,Jc;NzSQXSJU"#a -j&63i?7Uf6BB_Xc"зWQ|ؑ9R HFP97&Ūx0c0W2C Ev03!uft'%X0l9'z?Cs%ΣB4]@o2#?g|Onrd 52}D25e\YK|?$n~wf5SE4;e=*7D4"X#+fQfOԬԋ~m_Oe7m_@*~0gp[ST 0FJZ%$P҇)񣝢9&4੉fX5ɤ&9By8j5E;=`X%)ѻ`O3rJ`>Kbu~F-2#6ӌu \ު\57)YG!{ bM Ҟ\"2´D{eA!6Sv|"6dG02k,<̳۫u j #ru]GA$22w=fBO} ÔwVRJh1Etb)ns3M;\.Z'1sra3mf=Ք:[_+w !%l"#m_ߘ*c!=EQ\ A$ 4-kyq=SF5 H|Mػ-v=}!GCz*..:·BGZ%.nu 4hzܾ~g_iNS\lAI*= $;Rm T9StٚKtsnڥb1dfY)f 7ΛAq ^f63:y48CC=!T?wڤEL%}4+D/jTyl)m^«BeQ^ghy_nZA*Ɔ$ԵFI pmgPůj$Xnf|̳z'5z[zF:L4슑 8j]^MvƆx_ fF8߀#?XQυw0h.iiWN>7 Ίke[//\If2 'k^C%U/=aR?+Q(~Zdͤ;l^y:>6ֻ$;7?z8,s 7?|@OLsۼQ'K?\_U2qe=8'XG)Q7bo' e,owL!| !J:EM|54ߦ/8]g╜b0EMϱpZ]hkv0Win$1ehgD3蹙RYuQ=_T:ߺ(5SSԎrڒT,Ђ! N*t_UF+0gB[uM4 -7[pw9dV1i:wiq i<L,9!"#RARu =$@~NkU@ *(Sξ@[ |{܂ȏIIB^\B{sԽ/ H+IF`ZkSh5Ӏv R5w-'6c Z~S$Etg۳c~Ţ!Hd jhc_8\Tiy@eaD_P{kd pC9RgD%]P]p'LhUE w渐pK>lEASW|yٍ<`4r jlP/$N=,ÙMQuֺ, Zi,:xre`zj&ZH?POa 9W!ǩ\DlB<5bqgBA j`J@I#Lv>O"î1̢"} 3q닸Pr|8se)#f#7-ǀk74L;VRa7쨁M*$#{SJQ7澠.Jsb#a& ~@|3O d03g$bXo (:Z\ y+, )}'~b]6 D*͡z!GrzNAq?ň2zLm=T-O {,WB2Έs5SµkVoYh|B!A*?iZMjoCl:2Zb+48Fϧ0,$SwF,lx Š ~voaCT#y ;Y.`!ŷ2^(#8":xV;hx FO#USZ&C$|[ݏ!wP'D:Tߥ)moM3^{=1n]/-S*=DݫT Ɓ w@y\{>17-ţ*$'j;ޟ>HI%A[WuFAĐt dlhL0$9"H\f628SYLȽs~ϳ~*?%#\U_qJ;( fչNTR&dTrŪ?߲@zqy/%`੷l!e>%Ͼrxc-^$2?[<пL8xz| o\\ 6KWlAe`#g 5 lph[9xh|H^O.k)_cnԠs]"(^?rz wn3瓀n8Cl 7}ΩHO't&:RJ Fh_Bm}ݟ2w$V[T4RA*#f#!gq'bX߳HWD~ lF;/Ķ{k^;9Tcj=6.`?Ns^a~xn,}0 sEC A֣2eUc yjMu`*MNdZq&dكsP.CE[冮\)MV+â`G "<3-ڷZǩԸ18}(M!؄?m ".b 2R II^;X@bA:?K4vuʱs81ZNb)d_ 2fTQXV_|;SukFZQ`DZ:qs© Q`4U)t0 %ۉ|@Cmt%͝!K纨T]v'LPɌw7eQ9v偻D 6 `/cLhJB߇[3iXu }wHAh!]U;lk$~e rJ%Tt(.iӉGKp[*Y|;=1\X_W=0RpyOIt>KlH4[RF{[\=oLꄻaXÇ_r5 x/wa%%,7c8j*I ;NFA¥CDiH[чڞ^V2.~;#?ϜClI^MQnXзh;pt8QH gv ):A_K .,TZ#+m^ˏĖ|ʠtyS ޔS{{HcVyy tTk;̰w+ITQZ;5 8 PE)U!:S247hOώdȍh8 %%;;~I)&.XL}6w/|[$-S&|CvO^A$E %HǗap KY; =?NŠ:f(^e^mZsGʟ|VVb0觝"zSRu^uj6"y`ZwE%(7Kkƀ`. Ph0Hz6,wu iPP\6%c->ZT8znIsBxL2ш ЪAƵMT M[ldĘEz#"Z'LY9|ަ-K4WAr 8=M.9}If2ZEN깩>}D`tg"DR(?9CR5H0O aư8ЅCQvg+`&XޤW!Oug#W )9Lu@;{Ԕr}y>XqLә{25=-) [IZtt0>gfޢ#b|JW)\^rs=]L]؉= HQi+=>fl1j*W5dऌ\\*+IXM֞铰Rdh9ujFNCfˬ8.j*8z(3R98I ""Eo;gE<};UCXպ1}=Ko{2!F+FL:B+9jyuxX7"Ε)lMg `zi;2xfMNy2lGOIvbnI* x.%-Q.mdV&rG<vLkn9{/:n fZ^^l_tyݶ5 NHq![;)G઴%UDOSi3h]YMt` GWx2Usd qLBarH}D,wkE [1@%mL0O6KQA܃@q⻂NC djE ]ٶYizȏռ섇]*SqM [m2DF͠Az<)uZ!OA!4OvtKwp Է,h>>R:yo}]o]KieqwsshGڑ7~~;HvtIv>Qk Hyo:э0dAɤcNo6p"ך WI앢;nE8,Qli!CBSĕc fx}xChRzc(W(}h齱v=t]zY61 ?$#6Eg&y^@cZ;wV|6-JzFXǽDΤ}>d,S4Q M`kd9F[YF8v_bpSPH>"0@"AN[#xb~ӘJLVỳңh#Qed9.rZ^ӾVi%[xckm,fF-J@̩.GkI9@kMFP @SRp*GRNҍn²l氪 !5e?D:!>sm^"U7cC?0dS;^5D!}T;`#bk{“=V=⮋2쳴6jWP1װix+6iԡ6cyfHK8+OS:^PJ.46}e,KfF1ܶ>*.iCG_sDD=F]Q40(H #O'v!r6>.A9oJ8F*'u/#EYwr)#U~ۙ+{y)Կs.8x;,ojWwM'y{HW X«l(q/H{Rl4W茇[aS qCAFs^R7@u=27yx{bbP)"U'=t(TNA]-Dq8@8Ǝ"sKMLo>ӯYWE6b#F52czcJK@(5ߚ notUzL21#B,"; c0>YP찻7.WV; Ά7=P\˓{DQ;BJ3PDBe!Q'aldu&mH뚙 u Ԡ&CEDN}vI 4t3ݕ|K[l5`MҼl$b!h;*MX; EdrHSS7gGvĥ>G^yHJޡH \A.uIr4ubuC%l)jQEQʜ8I55¶tp$o4fh~JM :P|oWm<^R;KC^s1 <4e!<Ӹe%U3ybЭ,)'G3L8.HkO`Pɗ+POğ2F5 gt>0 砈hϩ;]='_f__&G~?v t@{M6,_ysPatK;;hݳeL(ҍ'HyŸka?Pg΀^MRqrB]D8!< ؂8桸˵ٓE9QrU_3'ZBɔ9lX N-Ջ{eX[;l n mQ`>5GLgog^ٵV2p}Zy{?t ̐{?6BM);Qx^qTo7Z*ͫ"f_`paxIr{8ьBITS¤I)P1KȻ{mt>꟏i m`3)#JxCa&-r.琙i-!s `fϭ-*-yL8hAQc"> l\.M% 4)PxQ0'lQqfӪ_kPZ1a@TguKN#:89+@ ($ S>N`vw 2s x?qDZ5\iBM5ɩk_Z%ˣVPK]:JkS]G+kҊ _`|!AՇxڢJ@[uߩHCyDv)k#l"bm)ҏP7d\\W#E*(@#ns>za!Z}ȸ0jB+lFAM]@-Ju2kGdS,:ܴ_|gWz-f>QY]gO(ƂBտZ'ļޏhQƝpGRsq%}>q~?c,DuELޓOQ-sN_m*aA9yk up2aʅ-o3a6\#^ o.%4:_+`P*'Y۟Z`BH0Q,Js A_)̎l J=gn }z >$?>+`gHm\Uևz ([ߨfl6O+=dl\?^0UܾY!{ yUcN}559mAlK% dOrV{XJzam"Fnm#i5,ˠ :,$g->7c8{ ߅ ia8rFnk'$)ͼَ\ %$K_߂0(kH3Xb ^;us]ķ "E,q~7芔X esYuAKbؐH8Gl[:O_M6 Q٥P" .Hdtԕ3݂ vs1Iv;voO7zm1Z+p19*n_*;Y\9\UG3ŨN`뢙 2lzB17m%j(Lsקݺܰz ־G|LV(b2CMskyjV Xf;ݗӌ8 8dMk_j|FȊΗ/Lp45Ylc}?hLV#dkPo S׆ڴF9mi"8QU0Y;\nYxV)Mn@]3 y(,n+4E 鷫| (Ew)Ѥls_bbGɼ2Nj+0+ݛgM;d1.m c:2Wonٍbر ܜ=' ɅNV{#;hn>V} 69rrgg<}20@(2hOPd>[nN ~>;yOPU3H/T>(o},u[JoY no7@$&F' H`KI@Py`(:B謾dP5nӱ^I[,Y \sTY(+:p=Y"R>\GrtnEvRNmDwO}k"" i@ui칀B?c:>9+b@ _0ZSr4-ǁ'!__xJh!Jb6o+%Nq)un9)3NgzO86fcȀ$u[Μ`. nJ+9d^cUlHZLЀ7zrأ+*`LF\dyjDv}ڶ̜[SoKf\ kMVj*8tt,0kyhpvFi{>+ @Z3vCV?D`Ad7oBP$TjCM%8hQȌUwM0V7`9Ы _ E>Xi7+(Csg!߉Ve?܏/D9Ϯ(pwTUU0(ˌ~B)Dlp ],p}ccaϷ$) LM {R-\A qySu o>}ҴsR~m\Ne@5^1#QQ]f,}XƬz , f qRQ3/2 h> $[voD[`zӂ%C\ދ_ө#ʟdϼL4ms0aA2$41om*zBQ5 O$@(f1`^9ةkxkRmw@|?ܣCOzok<,%+ٓ.POo cRchU:ĬT $AN];kv"JvoKQL"#AT{䬩p,j3/˭SWGt+3{c`^Q4Z 'VNEb:KXwrV*{q9D5erv"?Z\(ćdh=lkdYz3!k%X\[__Z@Ah`>Z{S[9d`m1NavICj QOR}<;,3Vy!q+Iv?CViH?>k"1K5Jpܙ<; ^}eiG@ge7wڀّ"rWSg(C|hmAO fa_`Q+m(c]۠;C̣+g֦zVCʯ,EFD7Z\݅yՌ.¯?-sdD 1S>9L"0#@˾U.l:1/SG#_ $7ek~=dJrkW"8#"5 Z]Hܧ"2 'Ɩ|#у@"Xl3kEj/xӵ:E]\lsz"@0"5I^!}[ ;oJ^ZK6R+w:~;˞a.jCUڮE͚ &DM+#ǦR .xQ<)"P q CyuU{V6sk{YMn!||]q)硝|&q>My'3%5jk)x( 6E_ ]-ƞ;D.tOW ʄes)43H!c4[!F~S@6H3P#@ӛAgN.[yN{{l(8ή˻뗣@\4iMT$В1)!8x-($ X[0H u/LBҋUpkNef.i`5 ='?;x>@q- f9 SL, *3 (_[TA8ъ"( sx9V!쫈!QE1E3`uչ\#`w>LpDMoV"8Va> e"m[~:SŨP^&?+IxCE40j>SW-8&X &_OL{ZCFϞh"htnۗu]d.3/.T;]trvmZ?1és0FeY`#ؘˏ..3[ag;ldЃ!@`~)W^L5^ @BD/-Rbϳ0$߰wm'09Hg[=88 rvz^ZS#<([$—!zU&5 L-a~2dH(WpZm[s7Va?Rbq,cgӭ;b"%juLQrx2xA9]XGXVPAz%D_ ?Ï9i!2'.WNW f;KG9Q76|!-Γ aM8Cආ61XRsvgk˙tIl4X?2 Tɀu' S SEHcw\Ek#vإ}__8XdY({OՌ}s^ҕ1$ZKK8]YOcfuNݕeua6 u 0A`z0TA#dwO-n?=c:UP(2z֥1]NĥkϜ؛kjb [ƍ֙ Uw v"FM±Is#~_S,3 w CJF5!$c^;V۫qB 3N`̜)}*O2C¡9kƋ£ʇm S^RI.PNLH ̗G3gjFJ&4XVT(SU %fOK\OքǀUj|RevV;reOЙ Z{`SRM/d2}_-D|%V?%{ﵵËpU|ִ0ZSCwO87UnGgn1kϼ(8-m)'7̞P])} kSGJK/^')!-g󓟻;~U !y|-_>-@"ct9%p0z$)M d6~{*ЊDj7L8s< CZ8$TO'dK,o.h|)M+Wb[] nVJh-*A|EV,t|2P{JEl>{*./rQ#цvT3{*!$"0c XSU+vzE~;a?$ya"@6N0GWμ/ kOҾN.bQ RxqqM4LŊxfx8fXԄ&_ zCZû w?M'⸣,,”̦'?K & g ̇gGK_W,,vå|TK=Y|ʑI3]P^p|FgĶ62ZCK'FeA#J/V/31${Uc@B@P6 @MB>ƽ0{Lr .*0h 㓍/@拳g?.J۰j8Bii+]w!E%,^n\eճ&0FqKv4f}e xꅭ%b%(aNݸ9,f:d@+kZ}g])*3OZ(rقG]#aMgO-ǢKA9\8EyV3ޙo aZv{`5Eτ#q[@#^o!@!+ē4L" )t]DϠ箆=%;ye@h7&j'Mb"U̮s#y jSJIėQ-r˘#e$9Ex>EFFʋ9cQ%zMU&a1 ,l.R6eAsjz]nsb/|+;a6L/*b#yؔ[ÔE2EI=gXSh3m- rY@PhawP*{YHdm',G9LGTEq|K\<+d%9 {SECs/GǗYGh7٫4,iWj{ W𩳆y_Xxz5Gʨ~3." M1Ra[i•PApؗQb8 +޲B(-XRĨcZ-eY1~NDX](*Y'6n}S"cnDqO=mJeb}\xcY}$+"ɧIN2W\h'XD_L 0%g&)&HmzYbk9ܰ͜򴩭lF Cnho lӒ}E; ۳-%ܵa+pR+w`MzAկ6WM|Ӭl2NRaP|[TGgVm"諂h:8I!Cvy8x4Sʷ%X`@ 𞴖zM"7YZqS8g]u8:SWMՙ8aEڋ˼zQ]$=2-1DɉuqVT-wtћ!G7Z>ө@gѱۃc4RVAajH+]K0a!j;!%qHP PgdcVy@eL!BiK: =^]3z9Lb%)w̼:EϜC!뭋E?#{)O-@ [f)ʊcNGe|X{E9 "G(vT*dDva_)zS Qgyyf=2 =͉lK[ wynNjbQTћs]aGZ9-瀴<,;o s_"607D R (%[ӓCN 3T&=[\ܙ8ßf*y¯iLQƐymv?gqݰ3-r" =+?Y\-Ժ+d4,Ӗ50*yE89e [5lv0L>v,MuOLfX_ l{ǛO\sFwx3t_$nĹT]N2by*W:!8gHv%u7J:mξw &MG^~EUa޾k* |#,w԰ijβ?^{BIAU%s5F$7n_drH1 OUuF28F$NJ9R Gi00oՔHUV{ghk<9oai~PAkRZm`YD`lԓFx ? 3C'3ݩ0 Ʒ~iٙ&R#2INl( #>֨R#! C@o7k W 旫PJ1b:mYq<6AIqڠ|0MK"00R}<Ȼ^9 Rꗥ>1&*%>9 % iHcd.Z9sTF*pC {mvs wcM <7d g~1D4ZV0#~5| Zvzأz42<+oYpe>i8,\M ⾍՛Vc|-jON+UtPFt|LKx3D3M̚.sIcN +i7ިs.Mr47CF\: nMR:8r=BUTDCwסE􏕡6+kc:6bd5Rۀ1??0=t@&pI2dx߶<{A2ӱVpaW%m U "gF:fNg 5Us>g/*8n&dqb>y@W^Gx |Ʃc-v/3g#B%gCUh{Fgž4;pbE4Ex)no}?%`C/帼%g`D'uSGnL55@s+3+VlЙ]DŽWwQvn74%&򅘞,(/m]z6(AVL2ޜ!]9+\%W-~WNRi\oC3pM^sti'X{;?"Wa玦w^+?햴y5&;M'!7VcH. E.Ԁ3 QqXin=@ g00H|=F$HͲRI?(m%n`8M`x1zD]1s{\F Ņ&^0[E:͹0kx?AJ\S6 RqZX(*D! asI%cА LVftEUJ=? Hx%L꜊`F6HN?T79Ҍu܉jxњJ !CD&":^2]E ŧNi.@=9D&d4r`4.wLk޴#bBf9;|U%B{9 ):Qt)`\A4!:1 QB #Ǻ|=JZWٸgKHqA+n׶ )T}l6Cw*֮]r|w_Mt?|]<܊,Tk:RpT+^+w580MڮT9v>vQ8qH[%ۃ%iR @.ʾȥ܁rC zوZ`eH]D.%r4FH@0Ry)m34ru#ybloa]ICga7OB-=BlkX f)+t0*2:j Xg-T\8ߜGgS[+dyT4YBK Mm{_-^XW O'QU{)WGnۘd!#49&;!{+?Q`qmj:QvĠD~,CtwC߫ve2Cӗyh),-7v$[><`aЪ̭vB]eOT抳]뫚$<Kܘ^^I?g*fPπ55_V6E[晇M.~SkXWd]R z9bJ!ǿBT _Gh%a`+hEe<Cvkq׃d"Q>O LQ~PEyx8wSL:УBj"OF*‚{0BU I R,Y%f$4srkMsT 7"a3g T>ulѺ+4^jki +ngbj4Qy4s{-`vp[ߏ:h 0wA{G!蔔OMί@Wb~o鬚c%5'(Q:>.QJ>[<_KNE?%^< ]TV3; =YY#79¾$Հv"]AhU޺ oY1FMu91'3Cݘ{3M0dxԥ1nS-{F+w7<`63Ȧ-ݛs'75/ߖy*KsKi}c X{,΅y;UGΝnq+u Gb4ZMhwM~[MkNaҺعG-@q*%{ng0`Y]^/c!dk2ߨqoF!`7Ë䧀dgwjۉ=)ݐ'5OPA @U1+~” E>g+Kн4^i|[ΉQ fE5>D|) b=q9mtZ2]H;߮ Ԟ>= 2i b|]C.[pw6Q7ˎtG h+%zQ?{v0g0Fm4 ~1{/a%>~QWvGtRۂEq127Y9]m"L`Uu{J6-,zD&b]* F%)גnaJ#7w1w M\Azo-6S]eģg,eRZセ  @]?o %179+^sr|ȭa߄vBrW=] \Ӹ)pxUCx$7O@,nti:4 kSa]ַ [Ia{ʩQ0EȟҴ{`XyN7US4t%i J%E{aV]DoYWKwPUAQ8D=4~zL>_l&ô PТ`$O6 ;,阋4!%+}ƷѪ)}/'],ۂa H %Ek;O4 npWDr2Pj~Xt Ef5fĆKgHq4ߺQ|Ih .*Em>^'A+47BQaF%R Lk?aR'I5Yyw/\guB3Mm@Sa '¹A7-xUTd,%ljB{%>/]7xL\Rvweo\=\)G%3ww)Ţ ׎4c]f{o/(1yA0uIզwp9L١бਁK?1&DMw녌ƐZ/@[ 4ݓ>=ns|9Ĵ{ѫ6d:2m/g׬\:cǹn3v HAc*ߍE_.)MM{$2|q:dWF竨{RmɋnʊO55ygN]˱Y'25zwg Q3_wp̓XB9Oaes2a MY{|qAv_Ck ϡA@w6!%K?6[a 2 /!C `P<葞\dzG}xgW++>ZdF_cre0U zԶU[?O?$ PYg u Uc˭@RrL>j"]p^g:; 2J#(CpR4H__):ca"3 x4M4ȗUkCVjvs2؋s&~4N(0!+`=pCcOf}o.ox(xqӖژؘH)xk%N|-Ђq=q*A#(|4-3/tD,KW7'Pt &!g׌唸ZčbSh4|GBPRF"Lc'Η\pez4 9lN~0Jِ1Q)1W<}!'*#d bK$:=%pϧ>9If 'C %pfDjNC{^l뾖KPbG\!k%X+qSf |Z٧g*lSxr^FF25G|j_AD|R7Y[X02WU{eO4$Ql%,2CspAsxWfX}BQp߼+­G*opq83ȌuBVM zhJ5ΉM]LB\{G Foa^=JC_x0N׬1$-J-n/jc6ڶK 9`晈ƌX$-2B$h?WG K_#T78x#MEL\)TpL ۭ揿턣d_ Ha F^eAcq!_-2 W9- gD¦\f+$np|SL?q0e ,>>*RxbH!0P"O64uKS/tsWZ.FGPͣh-ʞvl5{p"(\t)(+GݛԫY@rqvB͋թ _JجGC{{qH ?YLԃ?(5s%:36@S ĶJ"Ȫic" bYY̿Rr7@ԑ>NA =qKMk".\FB#L%IDaN al]KG;^UVMTpL'r0t?" +E8JA,zo!, D`9!7/@ %b +rȏ]Go&sؠ`w7L2;wMoQPkz0yrG —:Єh3>[dIE I>iI6xEqG=%>70+(y:D =[ث~b[Wu T_W~/Җ_?7,|>D6/{}r?%>J[>u{8oO??R>M'q7ɼxoGC>}}^S8W~'Y~N|>OiԵN׫`!{g\#DV{idL-iq\/o< `{yD@B'{V!" 76!L#XVEHPcE-=$ZMa- ?|p!|{R'<ٌ=3(M͙w/Υy6`$75ћMCj)U/(ZM(H^1֏_=UT|= +)UZ: d#kD({’:,^x*l|&U )Zzx$H"^})&A㘾K0پ/1{ Ƅ_lG>dANĖwL֜"짯,bW%GـݱKA4}{N cH m=IX,9 kxT l>ݖ'-+@s<a7Tf-{9R2m"U'TܚI ZO^ ^Jnm1ҒL(? uQ^EU.'wH)-+Ye-g]:Z nb^)Fa|}4vT)ɣºWOJ37z'Y6VP*$6!b [0bZu]g,3Ayud$~ goCc{ڶR;$cHG2r%ka[N:0w5", $_%oi3!#GDVIEGU[A}~{jt5%\ig/qϋ;|N #2$[ rtLMu?u4~ցIRӲ|?؊0c[d4ucXl1mO_fE&F`hwW^Xv%V@xXلpe>/F"z;OHB$0gPP}~p5!!,5~va_!d0GSǠ]\kJk-]YIN4ܞ/{|0-mN]GP!TP j\ l,JDlXzXAcoR,ϩF^FT + HX%IqR4 㪹!.U!1 %hꔻTysԷQ[yPߋKcYSHT߬YH5žuesf^Ih ~=Ka@OSa5}#BgS yp廃ef=x<г^Jkm̀q .o(blQ"9%ݟ=~{(|\H<1,u22k`E ΍)ptX M^Z,ulՠbFg9v΄nqDV/J3乭1(+; |u<%s=+`yb Fw`#OIJ7pi2gCeLSUd@gD^uIT ('K/`]T#P]C;q$5Ezٲj 6D/יKk|(qrJ|T~m)@JZyR tWa!Q'Z}U&&YڊҼt/ϴh"ǜodw;>2ގ!_ɓo!@OpWl椊HPUB7)1*m4گ^{z 9M O'J 朙xxC/{:d<kE}1J!ML/Nmxk#-`XG;&O~7ƣ<^UYL܁U =fq⣑Suggqɑw3ĥ[RZaܡpL-]a|)o}̙i.^/WN&e},tD] 3 F@^řRT^M zz? ؓxx;0x O%PTYp#Я<^j=}obۛ ؚ~o{x"=:gZ 9TE&.$fbiV1[y!r׽DULs" rw;W1Jk93wSS%T6% ZoJAz[}[)ՏL=>v )U}a^ts`g]Vyg\EM,E/~1})T#T nt/!S-׎  MOOL(t>oڴ vC4o}6m%ItQ-+3R5A_SuX*f,=a?gĘ؛!uewVO38qJ7]YiBQO Wr$SiT|˨ӚH w`7Ę\iBӏ`ڔe?0::҄: KϹ xܤœaeΙT^ADWdAKga∷nie05zT뎂(;6~|U :`{eiPVo۫Es<@Q= &5\vqǞFMb|*샹lty3S 9U4O#ToRlXtlN@xB%a(&y)5U gv~)t2DG ШH.vUU&d<8z{sDT̨W:Nļ_pE%KV g!ʋ? oSG~zos*^?!.7N PR\-Qɤ'bb-آ9!:_O9E^O,\uzzrœǺ4:LKҩp_+A EE޺U]VT_;Cwrr@쁢cղCp;CBdE+4WD-;#FɸATj\$S3Ř`{VRk.n2%{my!ʪPŸ"SJ*ZwȋJfl5Ri|!*ZQ^E8yn˟Ʌr!Z[A/k3);;.XsTLY0iu \. Ha8Ғ곣2DfkvwSCdW:8>J^ jD0|alF5#ZL;eaGw 6pkbg٪]0 Jw?όr ?ʦ4@l{Üh2 j jzn~ړ-y qfO9Rn"X[:7|j1 aGGVyR5s@0BKFxsWUNtGon^r;h%e!P1{1Q:qr=Xj5J 64(XA}&bEQx7aҦskaQ/8~H:9)AaڠHm!&o%#|c4,Fp̮]* o\y>u*>|`py$&ǤFփyu< I-Hr!ۼbwX+)*EKڗ2[Q\ݷYrS{JSFpn)DX;[A|&o<*ǂlQIO\}UO"}35JPVE^#Ro_yFJ=l5 &D,(!!XLbE/vԒFAe^JӘ~Hv|=fQ}1CPOu}S\Rs 2]=  ujBcx:H&^ʙ89xgnû ;ծ iN^4}5 ܥOAFETs(iWϔ9|'J*כb>3| neK;m9a mQ9ᔖGQ^fhmO'`Dz٥maR o%$,wJ9/6˹x)ZR_ 2 '-OZXׄ&3ׄ}q;*ygoOFR0?.I]4tԹ!@KC~kK=W3D'(!9jɖ\Q/_/8qW|`J3Q|F(+,>0ZE@s"]P]M̶LnbKofY KZ_uOpQV W XQcݘМ5ŋJV +tAgv#8p1U N1P!H"n$Bknj.sl3VxI9 ;<]ԹUK u:;^ypO&-*NM۴X6|.RBҗѮ}xuWM2xG_(,B)`Q% se)B_.~y XJ8_n˃&u&,왧_JVɻTR05Ȓwq J*V$ȗ2o"ibh5~\'I\r䃳N{3Y9nM]o%p'?^ FJK o%?+owS 9@9Yw] cϝ5wiݐ dƨŸy AESSUn@m9;qjC'yZ9@4}7űR)UCq[+yA-쥊xg+~)e0%ڱY)Lꮜ"b;n"Q VT#4b|bKIi!I+dUĂ zඡTFC-M=AZw4<Wep!!^3 z8K1?\-}#N ͹2 1Fi9Z}#ފvO ̳MhJ7hg=srEKI4 4j%^k?)e@1J Hvel jkQMH#&վ"X ;Rv,*k_U"$5`lJ$<ݱ=|}l> }񴯺F$.RS<X_@Ώ }I߲Np04~y n9/:ܪc^,lF=={ a2[o~l!`0S€6!А"A8NQ~9=+S.︰kُۘ~>c7Y,4INE@\ēqvϑx nH$RG{zVG -f\OLzW~&n 4b괠g 5Fd>sYqSQc` t鑣1E +kChwW=d -ڷbhkٌA ^{d*K_7ϲ@u-̩ ~c}O|TžȒ1w ZA(g\ Ak_hOW!tTT/b<> vhͤ#8Yտ(M%KrWYfPAx(_e=+M?4%k}n@Cő1%=d:o}W'BC;^j; Y|տ5SgR FA B&Q]gzS,R:bW4]|]XBpYA fZƲ-OyGRU {d<:C 쏽8"Td&Ey})UBR}H*⟑'$manRLIybհd1YШo"qS,qzhiree"J$S5YV0ӈWztqa^]40Hc櫟gG`#퉜 VKiowKY p-n`22oK[\HC٢% ^Jc~(KS3g><(?s/wv=Ű;S+L%)~'՝R[]=gqفɧ: g qrԥr)CUbBG™Tzy ~HGKŝ=q3`mBo4< 7e`ړ2l5aU(Cp>h/˗$k8LLVEx1nrS r!]c]Wqj$+g0[o#NiEQUA16g@=Ep\' فluIssQn+{K9%HDZXW|-a#b !HNif5|nITLjPkQOOda_h2"emkQ{g?NUfԲۚzT?`9B2{F;'[OG70{9` 9AҀ!/ߑ5՛2оOwdUn,Bx`;N)9FATXQM$7ݧnl'iVR|GQ"B'שYl'Z v]oU[kY\ȬihIɩɌ$ 3տ{!7s.?j=wˑi7X{sOom4u;bSA0Ys(t~.À/)Q{5Fn`Iojq,/<`04}Г+jAGNj:Ƈɳ(/zj]vH**ah <ۘCy#JP'0oȵ>z%~!}*hMn~R5KRZ~Y 28_jB 暋όp/!|坾^4_}&i̽5tIuйg 4fn;!#/ሌI+vҀij>&4ZrAf:APm-fS O]]}:" J.7gvL0nfnїkᜧJm!]4IWOחPL Ow 9~.-qO1pgL/\d8l\3EL*dc 9fVjh1|c 6"\Hgo巙̱w[Sd?hYql8bLY)=/ȩ%J@/q۩:WʅMOʜ >-MU-"JRPW* +L*ktٷi g${}fDzI;^+bN.? 3@PEá! gɯb&=őZ {N_-cCgc z?D؋`EP_% %e %kތ&G䒣{tZWLJl E.IIl=^-%/FDHfc=CVI̠mei߳W[ b{{+U?sח vȭ xN?T2F?ͭ]%V~,RըZQbĦDž,3zŚmU) TҘ/fH!NFtuY_7svͰ\WhFzrӼ.-dMߟFak}:N(nk|~aЈeNC9ke:x!4qD#bFFr \VUB9h#->3{h>`D7AkC5[Rk󧉳 %irW29I|pO%ݪsvva/ꢅ8l2n!/KDVvᯚrz֖\ ZnEfyX,}X)E+c‘uHtvLL1Lj5[vsm<;鷘R?حJƐ.MƠfqy}{R#khת8[ -45"뷻Kv?݈{؁85w9mF@>oЁ.JU_e5'5mw=qB |ދtdcfA{3wR:)#Mqp58|q{ u×;!ҠAMzVNn] QƲtlKYr#cYM-JsݒjC2EMF#EaBݤ)L.GZA?RdgG nӀ~8m;Jۘ-m1KN!ֽ&:N9 \ | `aMKëD ]3$!iX`"@ih j?hou:<vJKcQ3hu C;V | B< |oo[$Loj'/މWXz Y)-H׭"wZ.&* XFbS&*EF4eR!ؽjئyVJ0<"m#!1%ul"P,ET^%a?͗}1|7de͚~[5.3TӚ'l_M -y1ěܿba%!^&1QDE7 'ȖuaR{]zY>y%|1/"`&?h{aLumFN"#&j*AKQZ)ęm%ܣ,M]2<-n 9%!.&Ez 79~iȳFp?^BU1Ct*׏?ΫI8,(1H/c/4=?ʿpD8ii,I3 (Z';g9i#DLCљ-3D27*qcu x/MZ{@.v"<(;5F_g{4fk{QCEfCbPZJYX4`P. W~>N 81C7٦y:wj`^2Fիɫ^q]-QjrV魥vƤA[9[C&܂Ĵe8k4Zpfaй1Fgv+x{Ȼ1Vpm#]xuGIx^Od c7.T2Nykra~WpR+-O)($ćH*qnX-u^B48d@z~y(̎fOt&bWY[ue 2U]Zۂ.nV23.2ӏ{aaVH'}oލ&qm}Kslbv~/.*z,[!&ei;/Z N+Jϰ9sR(U@B>>h} x_r !`1wҘyޒr40Ph4t$ٛ18.ջ3-ILP҂+~U sBLQm1qpZ@-nGBΥGE[1{ĮRy֡Pv>p?V!g&gl= ]fӭ1N>|^ erJ6AZrL GS?;827A)q`i.ÿKY9iʩ)~r2Zj =5uQ(Fɔ,9eE?4fSF{JGǑhL){b:>NsSyَ. öUͦ5?@p5%By/ Ta%㑬}=u9Qwdx*,&]\kTYRh3ڭG[d0,[GR-9[ꌌ\ה])N߳u]vXI/ O~ qB7&,D#U4C}!w/yEwW:v__? qT+F^L `0YH^,WQoKacA)7㮥05D:hW5~?[GRޗBq}ʪK3"3 Gz϶p2ZV͹3uiIݼ17r- >YYp^Te3[8R e 6IqP҆D9&[m{E5IR AK{y8p|jo7ȷ~} ' o">#// =ܒO(rD %\{azͫ:Zcy* eh D{5.6\a:u0ۼq`RA7WY6oM<aZtFEͦvRaفn]X6]7GTxVC 9q/;k|O[c6Sٲ/sw K5tʞpsxNXο V..۠=ϴcBN1e㴗v?켽Eec۹|Dl/^F\w &GE"Cbvٸ3[}=7 E}H}&@xx;"O+ (>d iSs!/qs h"j8[ `?1(Vܟilut`o $7((0$ĽژtoK`!d`Bw:$k\>F\t-\JQH61$. JH [lĹ JN\mKC6V+vX)^J5za>Eܖز0bކ&9hԾ`)ns k?@':7R=HfC!0v[F!Wx̍Elo?WoI%1F5$CL7&xm0ۣ塺o0D dz=OA&~bZ>$ٺ`-;<@ Ǻ'$~5 3d]-\r=v-+M ,p& pwWtmٌ*Bsœ< !DC?N}{wYkRPo.UGgװ>t^>!zO!r5F'H! ~0d-em-姰la^y6"A%f +LYg>a&%Vְ\ 2Ve?{&'D;/3nS$>cz X_2T*MgH6,%ڃ_7meVe=9x6#eY`c!٠*HHQ܉&d<`I=&׋^=Jg:t}F@= #yu+˔yU' dM([ jr \|:X*fUˊSb8$}ln5ۈtWv!(ܩ4#:hNW&)a A ]ZgX"'G8Fȓ(^ %Ճ+bP k&F@-LP4JR_+@xt uGYq]*f3-6 HE?K#t~s'v>lx`;`ܞ-@wEvHm+vXkGөF;;emӏ'k{n@*QaՏ}øJ'AةV|?;F`(Q0*LE C00O a ؗͧ'9od>+hYb}\4c+ThVuH\d^w@9 4&4W\ǍzMB 1cBE\G Iߨ}s 5 Hqw 0CS*q'ON1ihY%4D6Y0%H[$7 =-cxixH&Aɗ[2Eq-DPF+COAX0] uSTG'J_D8OYRH( $_0?hI%D*x+浬 pQi>:wfhx8KγT1'Q:rtX׹.mJybtD QR*]d"QrXѧS4z5C"fTu ^03{o~vO:̳Qh]gWdϨ4_.1ʑ}/GTMx+wђ` Z)~sl= Vm:VjlCgOX\k6`B5d\ަ%zpg|4 HHR\na/S6X#wz4τDQ AU +{}֟5/}a*J wEh0DFvRxm']_0B ċ/+݋̑m`ia>vUֻ`q,׮:=E1ѓBk[#%@=gD؅]6n8G^]~&pTۼp#NQ̚ʕU[6B.u[f2'uVġFO2mg~] o!yӰ 4ٸ@)=IݒD8i-4rͿ0RY Δ 4¬NoK#;z hfƹmePJOѻg48mƘ+ЉQej2w{XhM4Z %oDbLuS:*TP6vi1%2#f mF.VӪu0"[9 &>XqD,u|4mfʈga7$Wa_xuրdS #|2[yUlw+>~~FVQxs::P* ھ퇫zyCC}iM#W4Rnf _ m]fxm{*ZDZ ?=ph=r&H3ثy~mg#CgH ʲ9\i߶/?sv]DYMm_S0A<tmt f Ҝ A6>$BTf@WBRR@@$~x$-րsZԋ67A{W"n28٫H-KOJ#@F0qp a ;-g9*3:SSZi-t[q̡dB,ikviM%{0A] aLc9+侚 T Yz xgU|4-h'<|˖*N[Tڐ |OyAQ9a奄HY1y: d0%o=]4^JNG;XF\ڔ;smJ!49a{o\LyW)AL|H2,Nc!t/4A̲?P9O0g$f3ņ5'MlW_QﴷEAavkq;߹LH)d2F7E,p_ y}_w, >xnC8j8U w {0g]p8߹ՆQJ,iNRܴ+9#YSuiynj[! !'h,XcCt{fɂA1<)5a:ͮ[л{H ]㫦cM=ǻy rӇoIo\Nj3j!%ֱU7VC.w'#!=ho 9$|Em6=ߙwڡ˖l/HqOl;+l\l#nܕ,̨X(~oQG{ʝiP΀G/~08\8gB-]m]6Pkݨq^hR$>ڭ]aj[:frn{TotH Q;蚷fӇO u\p\r$qc0Qd6Ctj=f@ !'L3 K+ٲG d_yAuS|. +:7fM2VHر싸㒠]F 7܏C̫*Y/j trpUnjѪ8Rn_=N2ÁGm6TtF}Rp_MEoӺ){]d(tӨjQ%n0P̦oJڜ<F f[ e=@V`2?`#{0/{ђ(ha $^@TJ >t9p8 GRGU,&M(e0S~-<"@0L|'I85C2( *[HA-M[P3' aq8rsMѤqi5;64܀,jާ.sښ_bʒCBs@3Z>n)i\#[| y*Fn(SV|zY3n_X.DygB 8NB0QJ  'ثv8ABɲBvPC<䕸DSQwkȎ/}!%x>Gqݥ2ĬR"+)|Qlҁi1H0 iC^m@Q떕8#N[uUH@`=cY,'j"0N3NFZ4,(Ԛۥ7 q2E[pi' Wz>a!ɚmdj5IMOvY&2v er93afվeOyvƵX՚L&T] BsC `Qy1L@f4Q`ͪVxR 0R}-F@I5|yD\R}]PPo0m 4df0 Ϧ\4 BݸِsizD<\++I޽ ?'Htu (@ͫ:UvLjf&c +nayV Hg{Y.#[.G;(]@($^߁:q1YGfYZޔ&|X!shhl׆H="c mINt"0\tmk o뢂c8C+QNJێ9˲4sk̑q?#@/%"`M^p8k0>Cdwv먮27c*Sl +`6Ub0L]vA>I%͹q'yhb6[KlDܐɕܥӥ^~%<4)$H>.a`~o+-S@(zԋTݙ䉠̀BiβHKX/d_+ iŗOp1</uЌњ"RqO̒s%RUn&>[CV@"P{M<:"?IJ(d1n\s;qm=s|50vB.JBhꎶw.Zy-ewuY|\.|VuV\mWL'r-ӔxInѨFF^ #FuT+B#TB oNHov H30|N a+]ۀ. _7.bc8Suo 0^ 5vn ǂdCkYeZR ʽQx /ʜ1+1 2hrO՞5` b!~. Ii#b:6>n*;5>"WG=H^4ĖUab0г=9W2r{s^3FӭEyL1 &^ؘ}{\ݽ Z'WsF<$ݐ"fitwFYnAu6dTڛo++|R -S=џ7&eQV>.TF;MmC !:.dɡWՏ8vZ-=KeH&3͵i>,L )C9edqSz۳X `آxjjU/DTnK©Nw9,r϶?ie?$$Y[әd,Mb :w9riXh ƞ3d}XXBg__-Q1!痿0e55!-_@ Le)Bee y-hBDqΩk1XMԳYZKI`=& Xn-Z:.%>yvUg”!y`GXfvq0kfS,n`>7n;Pޝ! m3Θ "9{BZBUZTE=s~H8 Yëăfnu;έ1Q>1#5-w8?к0kR1cǴD~9֦xqOEJdǼiXإVG!j[aKJ^ R񌋴-fZ .?+ &W 9sFTTh*:<,Z.6vf(%o&zsqX#gTj0=#X+ .1@&l'O_%:L{tlwDA?;\!m`2N| F xDu}p`TSoD@xN5VϜv-&lj7\ AG͝bH 4t@]z4"?ji(b{KF&? ۬g+ s XVQF8}w"4ar8LExb 0%>9B8 KXVR첥3}] Az%Fi-rxMپ5y͝yy5q`}!rNiMz\߰\Di?Bm<,0&@,k3+cvV gφV'B$ K1c+3`P6SSu6ai}+s[i,HR_iG=nKI5 WQf C67˧NnTOt^{K?GIԕ0+=vNX"N#g֖eY%da(txKˣ5‘Dѣ9n񵵛ZM]<زV$A$۲v-Vk z>5mlDEj iȀZ ;&#RX3g /ڋGγ$z Nȫ$U&$C0nyR8U>C[~ Z M+b٪sHq/x)!u )Aݘ+&@!g[Dw'}:Pć"SyWqLRonS]]X6eRYr9*ǩ]JaU 3:9 QKhomkЗ:FQPC*Yy߅TZZ,/5Eٸ \+O kz۠޴KH0?ZDX!-k:/ 5/*Bzs ;i3Yd.p%JJXt  "6cDs@ͣB:.6 s!2%ǒ.?$E}JKQ/ N6]>+$_;x2Y;4t.b]|)a]QY$^+zbNswM9< je GُҺxlXVSh LtF s2X?+cn7 VV- _3,u<ݭ뫩;86IfW\=Į~KHHvG=^`M  ~~+HRPX $Qe%/J$.U ̋x[a4TlڌerjVRosl7L&FT@5f:Fk&vod YgjVp?q.k袱O2O?|OSߥε&y]bYv8'ЂG1@hgZRYXeVQ~ѕ>3h0/Zґ0(p1:}F%!sc_F;C٭_KW䪏.'_~g4F:;X&>.蔡1blRj7[z)g&o(nYB#=e }(|v<7Ս>x>RMA2%Y=VRQOV iEs浠R* ߂܃LW)Ysva%KiT=$hO# 0knC|*,7Dt#7iY-H(1rkȝ٣E|v{'0$v~9TE0j^unÑ?⽟^rVxc5i_t(- z m5MjJs]cYǔg{?\c*`#0N+FKzr[K"7:K D3dkNs*BOT@O+ {6R6 'j]:ӡYL AtK]z[(*H`lk}<"X^R+qeaNCMYceC\X!j'BQa B>X02#Ԯ ޝlVLb8b߲r %wYiI=ג xbBVY"+渿<$ U(ŸSZVsNYL!m7_nv ĝl1*6u|zINMV791wN50hRTV=/T A3&\)xqI c X |2p!eZ"vgdRпa8 38qdD?W"wIlx<;+aЕwf)Rt9IեF\px(.Ch.k<ĵ{t & ѩcC$'Y3IІseۭ橎$ =*جBaHBdbj>DbhARanb"\4bkm$sCx.`N̹p鵹e4Uu6\w7.\gP3 q0OuRƶn8a3ss&c`_x>,:]-䪠m Lcd+rJ6 hoJXݣV 7Rv8;r#QZգqv%iXTUfi$?u3 יg<귨ZaYWx/-;nD$.~2ګlH#Q6d̰/7#0 L vB(fJdԫ6TEP W;.F= $hc|$~TQ߸.$hQ ؜oغq oҪkfU_ptlOۀ*աe'R%م!vZ>RtVugahkfV~U((\$'#dZ>WG()ҽ[j; ~%`O# F9->BבuѴ=ʇTҙ}=|ۜ@mgr't[Ŵ%?J{hE+UX:Fg2=kB2 |'j&mΗor;'qפa׉&Q 56JO> |khn!ðrByN}׈0ɇ)0 eZO{Q<  D1W/Ag[qE8Yci,_94 [$~Ct([U i ҋo"9,2{I?:z-] [+rȼt]-Z. $/48hD!_ _J5hl {e,*RB90E\T}tZ,Jxۭ%A3X^ݭJ NXͅ{/Eԣm$'iYy{`ll' 9,H }ɜrQ0QFA"4GkoּV* N[K&Y/jٜFG5^hXmchw`Cw"809`$L-z$πSvw^bC.sRFkp-u(ߠ͙f,SO;u=urp؀sۼw)a @ˢ w5V qg{Z'I˳xO1,;EPR%^Iæ! t6 wI0/=oJƟӁrCkv}ߴ/ +Vq3q{4֮cF]Eqt__X2[$4(Ub>t_7MϸIx_7I^%1}g- 5ֺ@+U΃հ?hwwF6kz6(xKٓ028'ռM V= R0j &k{!$F2MD sgQVss&@Z)Z= MɊԒ'Zg><痝Cf->^()u}=;D~;2{v"E1[oB\oP$"&†ek& +۹N!8ZY@q̦W! S`%杧\wV\]P@bhQ_`d9 9HZ44W LQO)a/Х6o@iP@^.ɡieY'eaoO-:hkZq>LUv_:"=Fl5nϿxE<ɊwTBw) j`JJbT$Fr7)' ѣ`\&+܋+̧.s"A ypLu~#6ue~5i+xaIFB18hrѨ:!8 SA#\!jg ~Lj=(n-:.FK PZG E.XZUFȰn`Kuj MގCqQNq$NoI# l,o.N&/@7XU'!;-¡&aB܇@{JN \ rNeeg)󳤸maqOHh_`r8i@-g]k6d?ic&2klV $ف A-B\Z;y;X<z^7ѹ qfpq0 w09VXq8;pt0ҍ_xJ}Quc,kIZq6FN/r_5}ŗs޵{[W@69q뮰 1j@.՝f;ɻJ.#hRrs ݼ[r27;KPG='4H[E1pPà"Ů@cqRS \SoI(3:iY߷* A3=lC}>Vta_׹EH^ocKS }hdaԶ W2a(~=2S?ծ!VVOsn.?6c a;KC'6u5׳1ތL끾?\^$<F [STvwg0;2?1!)K3X19t5&.1ȶd{X8)N=1vԠ0ˮw- zBJ.(&)bjKvuM|Ҵֆ*Ȩb8Bu l7S)gGP{{^{Em#37[F:6VmuJ|v5jJP}Lufƀ5E)G5PjA*wޛ rcQ:\_@.P1yRtQ:YиV9뜴 QHrwVhO, ZOA'1'Z~밦sh "3KxFЮ^W4ZllalZϼ:E(75xq߁ۄw >ebaz%{Y;9"q8\T\\D vמ --B 9I@]N~\׼V JjS6™$''~MT-dWm<_\ oT j}J0 wllטφvV7{.0TCPh)1H.V{r>rR"FaY^ws!ő,Ͳ(,/ʚ(hՈ5M|"M L˛yO*0kyȅFETMxΥ4qK/ 07JRP;7S)K<ֈ/:ɁRu' c]H4n0T*՜/Bk*! f]sv`y.<+c;-jaji>,(bP H[!iq7JZIxW(3z-%~EA'.,-"['jAl~wXn'RDN&Ձxf{|a_sP LrD s7 ~~KYMM}g>=}Qi'ߦ=zV uNA b6\ZqNY!Gkodd;D<%V {oR~dyx|Q/ЮYZ6xsE]iHӶ;s2T'tO~A6ny~3*2ux,i@G)>õh&cCu c e jbnZ@p/i{%2K>|gjjxo=iTVM2'40%> (6`)(AGOy O!v2=] ՜HHYrpvN`HW;P3rT!V^-@=Gzih۪$p>8jHh$ H۽U9?b02DT^ᣗ>*˕k/wq Fܼkia\XڍUQz3`z8(]Fw ^U**A^C.a}яC~We|*v#Hz.XkQRIԭ Fų{j*CE2}ff5GGS@g.O5lS+ o;z5 Z<]ٶٰQ!< rON5<̓檂8,](i٬[Kx#8u:[Ec<*1%&]Vk0l3'*tW뜴dT;DxF^*'BКn՟!C YvwN\lQi >B̑T{Addе79EBΧV/EEYe ~N~wxbDX`k-3:Ze)SxiDŰw6#Ezĥ>}]D䴗M'9Bt23`%?ϹWt=]\#$Щ!=q̷udoؒ( 1b,O8Dm.)UlR(UOXVGkՆv/>ɘN.w֒:vbm3yI̒('Φ翏Fš\1lIϹfUKe'2 p @˘[KBL5B ݛ&~8!2(N<.;(BaYsV=]fԊKL+3g]aD(g,l EW7d"Uyjk]!j_vm!@amBEZq {=L;d#g> ".lz5T0f)[4Ək\\#q}T^XP.޿/t$Kpӽ_DaW`У7֘O&\TWOx {zQM=Vt,HZT#kXX(,|>1WCDϙX$P4s E6!`ϫ&먜EωNO%-إ4]9s:k*>X2Oޣ(J@/Z孒jCI/L!<- p<%[<႒ ꧓~uԌHÝҼ)Wkl*ƍX.G!'=ٝΊ7tF=r&h:` b_v;5)^>|)vZ⼪omz8澫u5 ϲ޵|7Sގ}WrTKHav&<1#:7K0ur8Mǒ9_c"U0[ .d*_vWTiD%t񸞢dYxj' d|ψGU/Z^z'*kwRhhʖ2fzZy ;uT4R%esX] 4,]Ikދz Zpy//K9mqɠ.}s\=s^fJi}t~=f礬]$c F> kt_[o[B@8EG$: !UXKQuzkeW\#ӒH]2hh ՟S@x!V2xkC7Ʉicu>:{)…LUR8aW:wE;< Uv鄑:b}0FyeoWSpq3MͩvAB4[mYRKO6 *s0M\gEZ7鄎;l(VI~`O4.䚡  Fhe" uai&^ymye*tyBI5̷\Sn4wz)(y<*qD9߰i26L|c$V+0} -E0n*2 l顄6J}bB7okMHKF+|e"D*lsla.2-d<h]/wǡPrr*[?<;g5qԹ,: 9; 9ݚkm>h)B7qrjg?W44>wg{شznqc?t=[97ɈQb,cEGdTwn`KIpi1[kpCkJÉgEl3d_;܈>6zsA\1m0 cz`MJ+gϦ`GEҌ%7 96 n)rRJ@Wم*ho]  ~( Ww\Ȍ}-a<KYQxG!roSmm4 s]UVF6*[i%j,16֩VvʺoA\@TwH1=Kh}䟃@#0*0`|D>!⸬i7iЊs( 쀅F.AH|l$T2qpLNhU0+:Zf:,ۚI> +%S^rVeݏM ]eդ1h6'h<l+IYq|۟Sf#!_{5>#Ë3Zt6)};=^^./ >hɕ3ެv~`oBb8EE>M{ #Zb;.7Ó᳢Jqj:SRMS9i)/эJywfdH&þ4QKNJ&H^ Qpmbώ fY%2B(}ŀ:X {˨Ҳ(Y{}C.huK0|WCOI^cX;d/PMǂ/cdazvHg{WM F["a|GZc@eo 8>tCW#2O&.;y܎)Vl;;`82ޙkilb[OXX)S"4T7KHr̝: X$zzx0uPy2}GI^: _ov$&նȟ5͢WUg1G1O PȘgb'@v`}sev_"OBx] zcԨ$\o;Kcj ̸'_y~p'e<6$c0r>gh3Ta^W3E˛nKِ4w vN crMlV۱Psu1>ukvoϳi+*fJao.?LF١cpnOa:GpnQV/2I\!`z]M^y<ƛ 6϶O9я0GS7%; uNI]d:uJ(huhpHXT[T$'=p\ &b3y5or28j=/[m*EVhZtyh42͑wtCrO hfeiƫkx^̝M*e&$ "F'̑xigCpLF|&@36#KJz /BT0i0Rΰ%6"lK6>u"'%"y/v 5%EsUʵ0 QϠg.%P;8ǭRgS}ylGSoX{twA t׈*0j`#on'd WHprUl{s2ŮrȚ,w1Qro(Qs=g̕K+6W;پLґm_J# g|$ ]!k>56Pu"{&7LiurMiSGo fga)T|Sg,SW4dOиM_ R4&wlz1&~.cQ .[w:فJ~XaP&Q+]ynSJbG$ѷ.j=./~'vn{Ȳ%j7_c[Xl!4?<]&qミ$ffa" ˢNn6 H} h=|pOhJapWD TH<n^p_cF L>̴MASN`//,rE6AǪ]*'rS8tZq+='A{Z3gqZ?^u #}flؒW̆.>j5gxCiDg/3r!1ύ(*7 dHl2PS5 M)’oL{)HJԤʭCF@b"kMߕ5)!v^Rh|X?[Q̤e- ,x5NƞPi(DRp {rP1ҫܙ&;xHn-TG쐜 |,6݇jѲ;)` aȗ]Uf2vʌ3VK-Pگh4 pO$mۘalw0ܖoA`X,,S=)?}!w PuR[G1*KB5[CUx-1ILJ\RD]FrMY:)񬠉25B7Rۉif^N?'tD)̮.󋺋`тTWE*K1.1;O@P;4!*Q7=c[+S{Ndz/|zԝ I _!!.%$v-޲;y3$m -h1F9byCjƓ$?y.C"g58P.WGmxXy$!ȕ> @e)`>A>8溲rQ.L$6o t꽸kj"LS{8yӀຝ#c*Ȋٱ$/Dbj Ybvը4䝖PyЪCz(2<av! y+)0ql!Aj2gZF7vzl![`plCا&ߖ-3iIJsbbRcl= $voUSb+#(40L#'Ӽdwc?$?96 u9:i?mi"6ۅ9vc/,˰ҷΠqw jW- F9닍)ƱMmiO}v]L)(ak% "ϫ$P)Hʦ"zKR!!A;)W׉ɛf^ UUQWi*MyȦFvt**U1S44b= !0Bx>K=pdpuEY'dfA#z1[Tl[fR7!U=N+8?7^DnF@,2\)yt؟t}8;ڟjRtIWa]]G1s_{/[a}^Ut&߫۬|=3UU}^WꝿW)ho971>;t`yM?!~o\Ojp憳GB8Ҏ6tIpmyBN~F@Rg~yv/i^XP!o53& *9`:4[p*0 )ڝVN A e#qTdEz6q 7>(1|᪘ظ%*$ɴg #}h(A bq^+mk I*Z) El;)rl폘@;U䪠' E3GI|b\1:04! Iq*rFk١.Eiۍ=!0* #%Ӂ$,O?KG~㡈heE1^ifN,UPY0ޅ}(ZUf !gsORXA=5`nS_0Lް.z) _ o +|B`7O*y/K5jM *4-2嵫\ ,ĄeT ֖sT9Ih'wYPuS3OD8ߛ XܟmQ!(ybo(P=ֆ 追[\:^O=k:V砨ʝkT"ίdsҏWYDohcc;U ,qq7xQZQ0ц[FzF("y w1|џ:dWI#B?"16㛜|N@+ RWޤ's3Klf<坢PRה>IXse l[4L;Z7 q_ј»`luyA#$ptX'gm ǭv";K)̘迁l؟QD8Z5O;jƆ-P9k4YO!r7"+~t V} ,+dMF\^4Cs8¶g{k_շ*ĔdP=ibIqX2YT[.`O59]+Bë5, RAQ3" h~ۆ֫]ͨ/ tUIWϏZ6&yXMfv;- ?3̜#$,0Cke@qAm(C01!?%r7n ̟/Zc#s3Fhvv.ȯHp0ľɝTe###LY5@1䑘3d}+Zwf+'iɰa ~%Dy֦.]K)2OrXɪl&oT"UQ54=W^{b|Rl*;o_{tޗUB'Xf0DfZv `tY-Nx#U)6hRoVAQ~L5cu}Ɉ3 D:$,o!e(0Ѩ ϪDss׀ iB`pt';b+eM8`631-C1N:<ŞD8O3gš:c<~Ts?Ksp[qN(.O`Y{h+ŞiFF8fUY/7Cz2.u`Ўvx,+ ƅЛ=,ZrjrccS@a[(pIiLM~+9T&Mz )؂Zvi3Z D j>?C,'\ܜ2ݨOa+K Y.lo᤼rf|iK.a r1YGG#}|\[vLt ~E>q2Lj|Θ,e~>Ѣ09FU/7?W'ƅ߃?7_-iiͧ)t&C]u-@Y#0UW9S`IN+ra!v"ѧޫi UtGAmjy/=E?u QSE^NǬZ\&-aVM؃NH'ԭ<gE^J%Z[0c3b;ϘyrgbԾ2c%vҮqe;zIӸ[;}@ bqJDK =Lc$hYxvk ,uLC,SU; e\F4b1)n_P G[فaMdIjFѱ>.MF:Vk@]jD8#!<ۍF53]f&d% 9mW#]X2wcdo+uUD޼cW.!tV&/9o7苼ȽL)#IdIW禪񸦇s#*&M 2h_ Msx ΖAÖٜ#hl94gFz PiBԈSSE91PwEF]WʦWrh>)m1]ꁀnQi;)VkhE.G$8@EC+skSZ-~AP=VKS.=nE}i*bh!ѳP GWYcUgm}{Do7"O 4#(`/_`b> D߫#ϳf"x[Bsq- 7Pgf/Yf't_Cַ%&vsϪ[~piC;3E g:~k֍.%Z/;x)裚ꕗ~dV ̖XؐOAQW4) ucEBZ+gW|(-rqs+dO rLNS*uq! 1V)K)]-ofv: RL10R__;'dzZ&.G"D]Ҹ^3ռ{dƸ0=ti0i^Bly?*aِK/Jik5k7Z( n"YS:R0#]t}mA~mdAf HsXT,iǻDB`$eg)Q%:_t/LBC@;2h,GU5FܜJy ꊃy]dv}0%Vm=תɷ TBIx؃d'VcڸCR29!cI"+o *P]֡;C_ H}7o]V]U.܉qhhG%o K̩qpvT;.V=>DZc2DwTɕ>_kGӓ^r!bK,<\:q N x*(ԛߓfLxTRavU9Oݻ(Hm`1g-*;\~0\/Y9W(VXFQhXxF*a$c]{T `a^O'&Vͻg4p/bI'a'b#) $$2r^6wA*sl8[d2 ujH&](ʮO`doNpپA] YgtE0hlJgKO.{D4?' e&o`"n9ih¨~ES߹-} 89& GHqk"ͱۂPP2W#ZnoS%iµ @]S1>5f%bXGͬ{l*ECĬ}x~q&%}7A°(<N6z&3&bOO.B7W~J\n[!M6î*qfh2vŴHO?9gYpQ\JRE;w;+K}.MgDwr %1˯q>޸*9YSNb7XmχiE]W?mKY/!AeueA$L{mp+\w XF X!zyRCK(8e%/yȶ_BvKnzr# RB\ %6CgX8mY3xnCβx# 4ahYz0"PbVQ[vVKo.F lJu.}N v+(rTVީCܖf.e d9 eޏ~^y5 8iD {̇iC32B<}oR)F98k^,#$9Ajp%N,ƔY{ҹs3x&߄%ݯ!W͌>U" YTA!kt3f2r\D*HEL3x)J{i.q>ۢ3r`]9+W2o}|RV0kޢ4q>nv0m|$ "27:lR?&ҧ'<73Ⱦd_E Wfʍ*v'&0a j\E%>u/P9p\[+DMv?;rNuF*_c8{.,Y|ipcPP=eŔXN]xq6cg(!6Kf}ftqwwP+J,nd)[%vek=: QcbsS<[ }t5F^"Gg%0M%ϡ&vR1~肳yg0|fTO¹8\!w+CfNxq.6|DE;kxr" fY$2۬b~gh:ڍYA6$;B*wW2QSbAU8gՍb-C$2puO0km)<#Rl%~bE ޙa }zWۈ%txDm JX~[' 7%'U ^e!KPnSiwI-/.98w%h9_k Վ䠐17[Սfk ) BxĩZr& nMOI tܡꏭỜe(Qt;(J <<lK̣z6ṖJI7=k2n׹n8F eE#]m;EI|t"|Kf`+>P62oDK m,d3V+^էX뼋UCI_x'/Xw:b~Y&9 DHz[y]m%?hɏ°t)s?_UւJ9Dٴxތϟ#S9 +!nnF?1dO"ni~jCu*La77v|'*'Zjckb{Tׅ{TU{ŸĪtzv?XQ塅ЬRDqȘTRWycۍ hIEcjn^<\-Kvؓe^;z +C9N*ƬK'4zsDd'-3-ŵTjWᣊj2Ko@KY35a T6AV%Z^,iM7-'+ kV22 ]aBwXz Ҷ 6zŜl=$ҟ>.rKQjiWF?&T#,M]]ORE'<:ZA@G^r3$W,@7.M+-WASp,o#|ȓ1^ӗ M"fLCq;;{1Xn\D!?nزGG}5hGddli&'M[*=j]!n+zpun'~^-oF¥D-l ):3%(c DuI] R;o@RYE9P(ěܽIk$@ zSoCdsnu9<94 {Ϫj'a-r |_OQn`.G"CV; Cqc&98ADs7$^NKw{B[=yQm=iy>ߍ*eFFXsBx@:dK27/0_'4qJMEf mMr#Gy?g-\$ͦf<$9))V35k7W5=gz"'BY &.Mމ=KYkӬ&ۆi m}r>yH+rnVT3%[mVk:o`s`PTpۛi0s g ѡ˗zcn-c`A5^&Ps =\XiԺxqyz/PSV966BxYg4`q]6W+cSs"/ltԑDr"._'8*2_vҒ^y<6OS-Q[ĉ[w-w?vL0=Yv$3‘L=cT}!"Ube;$&͵55T`2J?N]2q^(#$zݙN R9n> `vNx`41=bJ]n|Ppfqqil}ĕIM2Dur"KO ZŦE3rԘsk:.X1qqJ⾋L zPaz?H*9 zqv44<6,gfS_hOz$Y '@wZP*@ņ >ι,ӲP7+MQ0>cg$_DHԭ!PM֒Sv-] #9$"\ XN#3|y:HVb##'mK>3>n)?:C+k$/+\9n=ܼK"YG72)ppk; ڵuz?%L4V0VFpD48x0+puX w6Eo#ճE]$:ҫ7B,::T%6߅E\SJ^txm~tn&L"KR`:o2 AWퟍ6IԋbNx3MEZ^t )Oݵ)gȿ?ۖDYGp((_x7 ѭ:kk[-?G\/sP5A*@YV κV:=~#&aW+AK; vqZLߟcR%H]ܰdp!|z[ S'ֲԤĔR.8,g}=AMYC>7&8riGG/ MiW(CwEHcJ}lӉ!N8 \őD.CE.Eo72vsM~m8E& ĒUr:M >ХG6s-^a9p_8;m8_4.{jj X"[;Xw!5ʗ79DKw(#x f䁿'_f hËMՊA^7I@FӤѠjTZ]_thB>jF|'ػg54Sc`7hjLf0XGL=ә8c/5cAzPşqgB_>E.M#.G0@ݶV+Kk(K-1VYl>(Og/+֢tmQaU*"J$'A  /G!=c2BJ`F)bM33aZshq͠s<~PȆ/tǪ'9 "cE?Ccݽ 5:Ѻ%{Xi-'rgk嚬cEӴ=6lFqJ|/%NU_;E&'K\809&G f )g>V&bnsZR-1` wf"kn XR}eQS i_{AGY ~+ō1_e<@̉s~^rL&թOdVGԟgLrU9C> 7vS"wl08V+j E0Zd㓧 ?C31*τc TO&t%F@3zhI9kqHT bttZsS$K*DYę˥f'p~tM9jm[սtC`9AXhsNg)//߇Y>'^A[Zi}5? X;:ʫЈ8/#tSϥ{q<8]R+Xw:gGvԑ`ٖ7~ c `Y@GJ6")6+}S[JcUt]dp:de튟DV(dm3t((鬊0~1!1KtDko+:"zVV(݊DS5 )҆5̭ *rJ Rry<$ꀅ$$ae_/ ֦'b/Msz^T6c ;'*eM(|Y)}֦Զo>ZIw01@ b|GVj0JTpZ|s8.ؼZKеjip.mr/Cj[\ ӧs,P=d#FJ衔,ZtgJ !02}\z])Z'G ͬ G70X )0ЧB;j8ˆ%鞟Nogoks[ >Ub qi쩁r%Ѻ5Xi[Y|G:C4ؿ &DrӖǩFLaCGlwf paJz&^* DGOO(g}wV+MT/v%be6 d 恪^YfAI T3'$NDgD0o@Qz8#1[Bo4-%%{JBե[(5M/:޸О$;G*˅;0]k֕ 7(;qh mrA}]\*Bo*Q1̀UB'y ~nB8!,{֯j;.TGi[,6d8@@RbDrB-$Tnc_&-7뇦y9ѧDIn,!gWtЧc>4ë=FfREOzugBV`ɃHM/楣iuFB@^==(vr>O1C {-E24=SQynI0ũ n8nD=|I8΋ .3ʵO춨g.Y.$9CO`~JeTnO=_x=ٟw2VZde]-LrHGĈ Ni,A}嶾<?c1H&go%kC`j֫2:_>.b>(Ce|N )2-.f)Bh# p?j0QVkwc'饏zY1br8WBg፫#OA:ξ2Yw%w~V i|P~RQd3Gn#qH1%| hrxp;}CYsF nC[Ϲy?pci4),0͍΂YkZ.j"ciyb%ۜ#Vbs%sJ{j:׈oU:rZS-V9*0gpAπ2¢_&kA!%Cn忒NȄ-vťgڱšHg'YX>_a靘Ԋ]~M dA5x.N;e-܅L8:o46V1qk;xCӕDi$l',{/v& QtFHߙrv"Yld*ǰwda}@i"txAG{e_/g;aj mp=^PZ-TF]`nݫQ([/(ͭr+٘VQ3BX|(ș5x.׵R~ro]. Y+xWM<}_IXg0^q4ҬQ]qzP^ֲ_u Ad2_X>'"u* K̗Aɟb{h1*P.mzi'~*%Y{=w>ؤ;l"D8Ѹ>:v9 c//՜HĞd7V{j#2h:(l0Snl>+ѹH?o8y#ǩ ׾+-6Q Ke)ɷaZhNlcI}b(k4Gk+l؛C,yNxخɪjf b*Q_(J yH %sAFd3g,wW1K2_Mo pl||8 \#k:.~u1p/*[ͮ`/@_ Y|Tr}iwA_OYVa `嫠h:˓MgQc3y[bօ \&"$@W.NN6rQd^kvn֞{RYŸW`jfs2"HȞmWnlNSpB:n_w*;d)RekśD $[LE:Ѯi;t%uqrҴK3 F[熀9(d`FS<*j79e(0 S?p*$(i -75ļ/'4JYj"4vZIl+kr]%T 0N\0E:r3ҥ0D0>C~_:>1BZnn ڣ`sX|ܯBfS5c,8HJy.0jCYZۉ"]-Y $SՉ]RwhIƌB3.D+Vs q'd31D 6*Z$jaoW5F6QGAJ3ϋEO0P7 'Z.SQ ۊ]~?=j{˨k=BKw:5G>osgxq>Pj.ˊ6fJ̧ A->̔w[JAT1A\ZZtC(b4GXUk8 xrZ9oa}3WTF>ȦWzzLAʥ{ųpt^H!]>rvlxbΡ>6oE6cũ+Vu_v6W\JLLLxL.>Ѽ, fRcGjTzrJʍYlæ+)(|*Y@,/ P1;qh /Fi"L[D=#8d:|79F`lJܽLf5 )u\`N'$ BbB3H{<(㘉b.dl RNe>poI3"eyzm*v)n2 B4Wg̍|[O91֓9m. P: 5WɃ3g^Y5/t}J`58vs<Ra>2z;[Tl&&U%u@<gX P .06\0ЛƱlS()&I5#k +3w9>pcM'j`R 7$6mTYtܵY8uQ.[7|~Q1;.s硤Z:]^h3&#{>B<_,2nn% [_{eUQORx^>ͺbx"zsDc6{`gsҸ]“-+9{ܢ˔vć|!?|[gmhAȹ pZLq},&(Dڍ4_ 18d3,|0黠yP[Jg]@ʧ$T)Q; gx3no.Yk"I7%Q0|ƒRNZ+M48wwj幧JCBP&P>MveLe{!Ahqoc퓯 SǺ}582;\O2U]B^@K7 5*lҘ8z=/]|?pEev\ ad͉R? D=,DJYVHF={|tZD|sZnыbJ0 a;-"łXlFao" Z!)~0Kd6VfSΰR1Ȫro tYvV܁Fϗg".ϏٰMKui:#+ϑ1=]!kBUOe9QT}Mt CZ6Gvqof}}klZóboT>PFr("7+ژFէE).c3⹠u&˦܍;p&sņ%wדR &T# ^"͎oGO!>5{gVvC4َRtg! qJõ(֟`_9¢L]x(yˤˋ6XҗhA g#rRjҶ~Fu hc4"|;c4dȯ:lB4}.:ӲāKctFr{/ڞsƤĎ\A+NZ\aY_qC)>,cHX!=QeKeu6m\?3`;jЩ~Pq{Xv9?ռEe}yX^4A5BD|ۇou嚃!<4~LNS"H4lz1ÝZ0o:hN3s 8ߛ!7gr^zg1GIt,<$:3񶙧`ȗ$iatz:|Gv(g%M0oYƉKFzTc1{'{k)S*41+m7{NM8SEP~dO 6?6f( GG@w'It*'5;;cDMth^>\*$`F\@oF0eXfVVDb7|\: +܄`ۈgN?+Kk3Ri&lEA|z%W:vA0R\K:X3(5=:,krXah?HA l5;†hd>(6I89Mٯ-N yL$b#b- qJ' µ.tj1X)#p4@C6 KQ`.j^%HYT1 6P)+רQ4V|ƴ+>Kdi^w3#vjIƭDg {BE[X-ɹMzX)-LI7}fjW9{Z&Ϗ'xhG䅨qM*y(*@&̉j H`qgbn\E{ sO_"q2TXP8'TҸ> V<&Y#u\&)w3l||pYd$D ɠe**# a `;F .DqpN=Q #Tdι=1"G`!(I!oĔ_%f ayjqubp)8?6]ڭ{2_e3ʮgK =t}x;VKt[I"5 MZj#g7P H8duE|qNG?U]Fv R-R ԑ hYH[鷧jT `BE yxeݣ6a߇+*ͮq0-Ԧܑ>wR0٘E‹^ڰnp.mŁ jnK֋4Ώ[Ur^YS!Inl6`둳iȰF~߫iF؍J9D;VcQ'A)"9vsC{ gn3 Ux9Qe`xght2{3t{+$%9(Cga2X{U_` pKV}VT 0/I>pXF$|{E٢gv8Jt .ҘuX~0 =<x\"ַɪqFXbRY: H{IV:!}\/m܂>, "K̶4 ~.ĄN\-,uߴ%O4BԪSsl&褨3/lz% "'p*)`+ۆ=u=RvڮBJȋWmvn[J,̽^)*0Fr.ƺ q#4JSS meE.fM(fMh$S6K/XУ7/".Ȕ =!Kc[cU,Ln/\7JmD+5 Q.-P6O8L4E!+jt' {éi?~h4vUӏW1 t8whf^vR`lc)!J>\ g:s" ςs2/ e aBD 8S.vFJNvC]{e-UcJ)}o=OGS e#4+#_2qzp KLJLI4؝bT#s?Jl  #D'Ns@$zv9] pGnvrrdذUҎJ'ˍ){#1&VК^tVF7tjF(&F[v[2#;-T6&3{#YU##h-< ]zfk~$V} :o ʠ܈cSaSEÃwJ#@ٙshƜ#?AFC|2[ͤ񆁋N{e0\-7ϲDk|Cus^MޯJnG{'(f4Z$]GTD7pP 6KA=cňwMw.!;sk%$FOץO0 )cVN$He Ng~N3ML_EÄq)0`?|~Ա  asbk.8Eq_#jǼ@R'lxp9Q披H+i?0(ML9IY f-߼ڴƣHۑM>:qyh"He;m@&Iw4l)굿qFUk38 |$CZkf!GY RzD09hK7 !ޛ:8ҧx,R ~kDo)"2P]* qOMuq(&h5.#kK;aLYr R6ACtH> BҢXX-l a !A%2P]l@0ff@&SUlb/镌L*GTLFtZB/~c#̐q"t'/ ř[ZP$t!<9,VXH>;)E*gNTeX9o8(F0ۃ 'o'iq | ĎGTkmtk~= 1V'd6d):1J`XB.0|1E.%8DZBoi~ؑ.LzZ{ËVcʫu( PӼ1ppׅf|r;5Q?bI9$蹻 } 40>D!ulMJ Ů' D8-jp N = a>30M5օWFL͠8 F3ǷXw~s>pT^(٣aebP S\ k[Jw[ZOl$1濮L!feC6c9ߕN_C ߺ@ 8 $1'x0D){@A,+C wFc(l9Kڿ &Czؙ۫<7xM>Z?rVޑYSg΄U= hH%L8ӯ5cyKYn3#Q9ƞSG Vdh;rRKN,=[S(|yl%j9(O*\^pFLHVp]^o&"Z`3TSAp*,^+2U|@(uw@!;?[!ySqֈhmȫ|EߋgY4e ҧPa+53;#Lj/(qU ?-Ć)UBxмmBk ɞsV,/  L댍~ZD%+M/USB}@`呂KG;鉣CF$UjRZflr\cLx2etC>}4i$}xSfTB3nZW_h QfgT_gA{(y0'"шŷ07g(arSր  ׸{xFfDĤcq?L΍%! Z*$'צ8A"tIAxIfxt@9kke//.x'JQ pivcpH\5`~#@rq'x& >K[4Xf,KCBT$F }s| iFI' XH}˒y-VcRܴp[!rb0'C"Rĸ%6GJes,gdH-n[;.gp!^+tA#% H0*JƔ˶E7H];kr%-B\oLEq T! CjV*ra suPlcF= &ȃ^~pӊpCՍ-G$cSޯ*(+BRdIH( h[pr6 JA˟]#2ʁ HaBɸ[ƤZo>@^{Nӱ-"K-g6{+և-5KglcMI R~h!  Ռegˉ&Yo Oɼ <-nsȄ5V,tt2v՟jݘm[1kW5L*wb F~iNLط1qm[c-8xi{\}&eg")*70Hه::49G f/q+t*v4k?,r· {N9P (I%{j652@͟Ɏ$Y0~E; m`~T@.Ư+\4Yq?8$#wŚwƞB;ȳ+! 63ka;bˉ?]- W qEx̛]9F*!Mt';ﺝ5/Ģ6G {  eT*e#-wϜȋvTag1sfyG im- 8[ I#]{FI+R~w jg55wb7L緰* eP0,sØYuxLs/3:%9-v~oF-p9C'x @"- (CCQ|HK{D>hvbO4F#t PԎyIE, {.59]rP:`/0L䤨5c } \ǡ~atٍ##\ƓDt bT&vX4_[G<X GǸ&.ߕ9լ'\ `Ôv4O P`–`AL)QpȄghTh)P>C"T_#fj@>DFg>ܚkռD@[GŘ+Bqbx8O,9`U3@,:# T{񓇲/ꗫ"| )+M`09##NK]K1[GEvcy2](U&#F%̽|rybL=`Dk0Pj|f.FxSUv'KA&,IUT&_(q"Qrvn3jc[9čL|ko^w Ρ%Ȟ$?Xs\nlm)m4tJlpSӗwr2r=}"+=w/ 2T<Lm]Gؤ8 BT!B&p+ U\U_ F0J$o̻uʉf,;|y4Z.><-gR,T٧TDgY7F.S AMy2uQCkFJkvZ?Mh>{Q,e}⊆UQJ`zn5%7? go&&S$>3A1}7[vpnGfl+={ѫ/)U70iSg'-42UDH**=e;*ε h Ҿ;7K;\[)ŔvMWWܢZ MI ]Gr{k΁mȪK(<^m_Rwzm.>`elcվB{F/'7rilc9nnrwσeʥHxZcm<*v%/m/dP 2%ۃHy^G.rTiOD ?v]l&vufǹu z@?](2BpR 8 U^>H6t|6%9 ,}Y%S/r~5}?r .eW- 1lb%f~ ǖM}$|o*Ku9ꫣ/P `@񶤨WaIFF&ɿpzBIM,{E[u1 b_s^u!_4/ c((:S1fR_V^ǵe×ӖOŹyos&0A^i$sأeᔲSy$E ?s޾SL!f+Λg f_#|{M(0>gܬSBuJce3<Ω#/r,5x0@9ͫ|>:NOEWZ V7peq, =z*f*zqm^s((` |#8IZNƍiP\.[pVT@j` }LV @&ُa?u_ :s*/z$m^?iP}["XP5$"aŋJJ$KoaGj D7\S^;} q IF I-ǯMgֻNi#?DC83 W}~kPAr(Y| /,讞"*gXƲKcH 95ԛ} %Ù>Exlڼ4R0l=ۊP &'[mib3arz[C{{oP)-a&k&8 Ղ";lZl6fQ&&S UuCiMuD%s'ѷl5}N%^H> "e&z J x'#y0Q>M?IFɲlt[L7nryxbK7;SiPpu3=Dz۞ ;xc yZ!3(K* rMK7 iQu>]&\rbnjcZbE7}r[5bw͸? 8~o07&-?>_oa#%KW! hahܐ4<~o/S(7ĜQ{RFrЬq'r@zƂggJ₆2qpBBDo<\`EGmY포I+VuBɤgT \ Ѝ>9 9M/ B +Tr‚.KC ,w=_$>Uܿ׏٬l)ts8%UZ=5c- y2tݦyz *qPcknbEΚK -^ Y]/ ^P&&,&DGS!RD$/&[I\Xz]Tx򟇹\NWBK|!+u6xÛZ>@rsSUf;S\+Е\iƪȸGOi,^לHVÏ&օdJd<'הo/2`~-uNFM*$#Fp 6_n5*3PK8PDJU"ͤPJ 76.uGpce2sW?\htҵehkG|V.#Y)EfItRٞfO0rNeQ?S֭Zϱ3blNw'XBMsޖ!2o>UG+? d*f,NZ7TXG CŅek8oLpΔN:23lh(A_F }mF@Z#-n.}:Ix)̆р19a?{ߕ!Uvu?~~d~h4n32N,I;TLENoa~RUWOEԮ P~GL"h=Tlbj§P06/MK/Ul!Gx}SE([(4-3dDKJ9WDpT3RuUdE'?Y}!Z W:zLT>H?%,Uov;p7[`[tm05C`]| S4쵞JO=ߧ@P  JO#7T3uah`mW칇ed!ү $;&ʇSJtx( aӴ96Ttʁc;:Ϸ_B5'Ϯ_m~@_u&c'$x/AzȠ`=OMɚ)z5u=3Ԭh45'1yX^WNJ`[L$bߍ̋Ĭ8%.ڿa+yE~ڌ.fA*YACWî}t%2O:>r?1dQJHǵrhĤ :UunGjW;r8N"Bて~ﮮNla z5 e:/5lqu04G/ F]TpH-w2>BLLiQXs7uX;LxD2Z (cF/ѳumW''<]-'/bc=+IX[RmԑO~6&Î~ܧ7*pDVD?f@:Bz 5o ^z"QqIZ=ytu. BL)umm:1hj04\qqԵO3.E1EBgjl1yH96gispd!)\ ^RԞit:F?|?4*<;U![G+د\ȡ0Q>eM^ϩa)#6(f~0 $J~jvY $`}35nzC̃ 98I0 mcŠׯh?nmСK mD5o}B@f@-a" @w!م #b%}> ~j^rP t]{u!i`)#gyՐLUợ_cZcI,~$S[8P,',Ei;`3?ةiMRnew. +"MTVy^+CfLHAu>')V:CdeR?մfhE)%RljhjÈc!ib%:z0nz5d-)^E6[NHW{$ Ay]kS:\hN+6Ibh-訓ە4jD쇑=,KpABݽ2!{$f]-fQ>}R #ek^ҏq/?ZwP ,^r:}3se71^Ef.%ȾM&;߲t-W|i4xj>LkWg(&1WQf6RLz X[ !tf^IS3{.UL?ౌda(B&L>,YEC|A&{;Gk%M 7PllbTg)sz{Q~UXM{u 6fTrB02>M KqM$O+ql]R%o!"lMp  BU-%ϋqm {ԊmE]>jfHԳŢwTRج ##7`5K yrYm{NV7i6(,&L$L2b6=Du-ιɁ|&_W?JD%W?)gѫ:Θ(h|hig.r4lkxd $" a!(Ng0G+/2*z\be"sZӹ3Zㆵ"b5!Z7Bdh\ԯ EJk4@1]/ps qX +3gHU3pt" UlpBYɜt=HDWue'Xٓ@{ c'J=R0#纽Ps/W>?ʂdSj RE 0(Fl5FBՖh 5ӰѠ]!sW`\Q !-C?M>8Qrҧ_TbrӬ "BM%f:r-Kp{H wtg:*(,m1;:d?"&W%v-&&~/hgJ2Akܗ{ى{{D$"masI-zfHO<%1 &/9*wG+K=}[r'wh&^'`I8F" ɽPwk\bs= ;M>r"+<W>zߵJ5m)-tXFWIk#)-\P% fq88B<#vMHAe~(؇.FcCeI8f=ӽ?rBڂB5KJꌓXR>oN&FҡG1~ tMwF&'u1_ 銡; 'Tܮ2 ;]\kPsE#"ٿiQϝHtP-ٲvژSNNxtq.;;bWٙnHdc:G/3m0Nu,\ԡ* qمP emoROz_xF|X 7}@iaxȫԡW2T Y|_J `ci95m|xNu}qS %fPhEn2|k'A&`BN)C1E?Pa)uBx})%nxo'+ynWR| bHu 0AwZ$\fp N(["dԅL쿱-z*dC-'(->@"웳O !bh%h9" iOEdۃ3Vlv|z7Q] veLl|~Ew6L//jb]M3x-ז|.N-k'xg 4AzZ` @?P{%邊ӭQX+d~ Id%quckFNmSЇ?&hqNoϣߕCy۵fP.cCQ$Ho}(txKH[XdžOuBvHzƀ:#XA.eܐEPS-tWmSօΎlQ箤3QǶ/Iܖ&ُ0MnnUe%uϧ^w;9{4k2ynT\]AV{;28؝"HoT񑬊IxEҲ6 ~--6i[SrpP/T$9$݂̀i_RGPΪ%v1oH7T}[T̏eM7(s6*ŃN!HB>s2#% 7qA#@ mmV+! č]weEY ђJL_!#h Rqc?0gcnrԔS7<Պs/ qw8({:9Hw,g5_l#4H<%ѧ!K} SK&@l?{%/U:ɮ4f."Sk/Z棓ܝ'f#bd ~E)Py_ARy/@!0P'0g¯jsNނV+.1%8'G@t`pm,Z6m;UP@I^%CY. K6aËb+uqr_"t8֕a& @UJ5R+mpR[@EC}*FM6[[ t;\iCYi}llP4aθbJ}L;-؝7:+ICO\,3 WϏꄗ o_-@!pe dIHȊbUFgR qw7≗|M ݠfU=DRڤKQ>GDuX d/LGf)w=TAyMz2EO팶5vox^%dzEM;~}OxL*1 sE 9Ҟx^7ߙ:j+]mXO)a Kw$Pҥg2elR'= B@&C8Xe[V*1BC1@ťxlWu}blNe-.?GV?CmUGj I3X']_d~0I^wl"V1 ߻_" !\h76VڐW ys"tJf/o)oX.óy9]GάI` I!Yo'4/Sq։VnjC\Wg-XG@Mk{$R672A5K~6HVw!w'Y +Zu[<=|zGU; wiۍ`EZ'vIye.>op5Ҥ `!.4F'z"҄6p?2!"@[qu ^tI3wrrz#@NIPaCJ)#w20+nAf>nsvEdsB,M{zu臓C!:S3Ec[^ÿRXW *]t^N)M-1^KzV>X׬a(}HxP^A0qpg2x:b*t XPa>6(¿ƱN`RIdL1CݑHwRӶbMBmF &Bn&ʟYU.n,vk(syXIUbs96觿ZjQxSc{5.p *Eq.הB"zREOVBKSβ9@"bD]:$`ٍ[+g^,8%jno3 ?شjtE_JUorJ6j4R 3yU JUr5CxHVq*8ixd{K}f ;zvK3Pvfpi\dȶ}%*Xv 7؅H'.RPm T-ul?[WreG@&ӯΕ:a7p\^t>sJ/H-zq?2{oZHȐ{MJz 6O]uxNnoሷA ?YF+U"刕FqB[P@{;c|u:>}%!@jb :DB0DGcgSZ%8JIvm>?3sH*M@VE{vA;*hЛT1~ڸ>G % % ۨDn;ۏ@uL*2Tpןf}b .M7~9]fM!5Kظ1IFLmB.`\$fi5P< In\FVϥ9%~KA=^})ƹ[֭}f3g2v4-Uwљ.G=kR $CF@F  2C -2iœ% 3rxceFyB'C#g$fffԥk\xȽ:Խ67O%p_#,3b Y-4@e997.{Ywwtg=\oz[2;j) ČxU,O+HR=61xN~=pz놯YMXT֚7BB _s2JOl{AJIwNn9F.eWvUfui)?m3jKk{ASWimlp^@^&ӭ|h; )L  :fSAFf$ P21Q -`s)qMzl᯦]cքp]ހoP}YuZ .OSsF:fj/A]Yo$  Z@d^6D@6%ݒ}V4IHW7Gfz[p z@z{4ex\p' =od~.m*hx[T=FۛRw[lH/nRbF7 PX55[xbVxGxIRSSe7Ocס?>S<Zr+0ݫMSGO#AA4b0CͲH߫) ڗ٦ *jlE>:βc${*Z6ىK`J5$6W,w.㹡b=1y(zk|XHLW%v7O8 _p(ΧG4$>{)Tu|nMbKtcYv=i+Ayۖ# Ip֦ ~1ߎ=yu&J] Xc PVQ 7an˽ylgwW\eX}ZWUs$`t_Em`Mcbx |QQ(I.۾8p_) v| 騺>4LI=dI[kR~BE?!dJMG0pnW3ec^%"v`oU*22\B[{ .eSa;nD9B<<b787fK## ^<*\1xml/Q5sD܄|n <~r:gɖp`H:s$m-{|k6־s{ hJ->!_צ k"sH >D"eٶu>FZҽDo:8BcvaG(\=9rQ3PwJJ;Bh\.Fy? i=cL[ɃqiD SF.?yFe+W,G1`}c6MkWCnZ=0ߌ&XvS9pso0djfg"*.+=ՆOr|`B+Hs9d;Fɮ=O|Z-X? `Uhɣ/e<' COcPЉ"޷ 鹳741w?n4^QV$K ̃X;s=HRg^;U5'ۓ?b͹)9IW¸e`Rl0bVFK0X=P67#_qPHhәExa߈ 1@%״(ϨcaHUdSwF$٤ B{ՀV%qN{x1))`3 _i{*2xF><>v(8o\!~Oi02uU x_y;ljR<7h1h*5"C9'>C^މmq\!cÁi`/9;䭯#|U뾣l8ݷ4PCNi`^n9 x`2 d7}JvEwZmim:M' `-[lgl|qPͥ1!4aA@e>hTP4D4V\(z@ Cj&.. :%vɵ9K{{X\G[uδd_sB*$+e֨PMzw8s $dm,{g/xj$h["D]沥\H=9-SB O|t=1~(sIBtlމ/4Xߚm J<0K>$EXp 3|D:& 98 9#5O~j`x[}(o'bC~ƴ- WȿMrR@o:k'qss'?.5o?%[nvTGLm80Pw[PΥSF1LJԩ'XaaN5h&%b9GIVo6#:-K⮫G2SSRXWtxq ۺ"\~G ~&N)tѻ LzYTkj8Ź9E#18B#"RuY B2e9緼y~WSr6D^ Nmܘ:ϱZrUTe*KpS@P9l؅7 'jU'C#/;zukLqPKO 4XgXԹA/_"E HFɸ[m8=Odo?U4vUA0;R7`\B`gW:VRׄc0  (;LamB֙Ni9Ja{)0S&4 ՔY =@VBb@}3T: # 6N*`pY6^1k .ۈs&nJaiJu'*jUlA<(e.m%V~b1Z@V^ǵ-@$BHP|u=o=zp&]gja l#1ثG06jHyQ{Cnpo<v甦drU鄟ݬyu qF{TyNp/AT۔v+ 5ܵ(`fbFONEϒ/R.̖}"mub ʄ%SʧG4BLqH}E*GMbI"=Q-EDd&-wmIzj .Jg'R E ?},@uTe0c;=$nܦu)9IkNvs¿WxrcHO%p4#|Ӆ'Մ6b|Swg? mV#'Ef SB$RG|,'ՏVL% z@m-{ ((qӾgacL"Zz4 TM݈ZZVgAB"! ФOp'ʽۧR7pɃ%$Z`qZ/d-#2Ĕѿx|x"5􇬀BR6mfQgLZj% |k3pJzo!)4p %CZ3$F.nu+t]=gҦ | ,1lQH Tx}xE V`\|_P^%Y符-FAW|;ٵl5a%~Iߴ䞷RmW9[JEfeNb x V$J2W n;ӊ<Ì,Q;lfC%rmlHX̦Do&Їj9^{&'|\ 5.<_@ ֞WYm>Nr3^yb!p#wa2) ɱ%W x)>?ivAL?I}= XѦ ՔLpjL8@Yyj+0 h\\2ğ\>wS;Z=U9[WƎ邈fkG|2PʖH2`_ #pchͨ2h1:-V;!*\H`6!d<$&/7&]\&$㞋7m^7M5F|$\ŊIul>Nʳp,} ⧺wdRETuIx$Xp9;s{hnyH;Vt&>ڹZGTV:ZcwL#;\4.i]##r,dfj=dV *F%/ $y6FGhK[:6c6mF~C_Y鯢4|Z6e\s utZcHFݺߝ% Y`!M;ylOe]wcOƦōШّf,Zqc3iKh Xݦ LGea{.\c*}[!*Ru{&0ֆGL{-0Ѭ*#x Âc'IYN2t%xm{"KJGDKwe8:&L1@qjQfؕNMu"-7>hPW])$IcS"=KH%xKaԵs^y8>9l[{ij;xOo%Y$w }ӞRy8}Tլí&AL}+9{qԝ(*Rn6k92Z\}_~Ӫ;N`-Tw^@ٵð$ )&oIGVeߥW#e4oUiȀ&ηfl9N#j+ iNrmܓ7H"K}- WTWwZҠC2 ?t !3`7s o(zc°T3?T9 m`xzKΈ37E[8,ذ$KR5h%V0[ݫg"€[Dyb"_]*+Ch_"f=O@s&:YVYI)c}LkC]uQ*}maBm$ǧ6k^nG,εU0a K*wgG;:Œm4⃆D65P,UfbKeuˈTo'?6@ΕqcSc`7u1P?R9jb‹)7.ѧ i6J\vk3l(;ql:0Ƣf? >1pNBQ.*7bCYb2R+V +i9%Иqt=!#/":% N>rebN}ש;Mψ'㬿k6:O_5\W_LjH8}Ul q `unjGA-ԠϞM_+U:Kc#j0OCΪݰ2l ܷ F&Ā\o'8j̊ Cޕ ^3Nϟ.;*_p YGn+t|RBV'l6BoO^wOO.6GR'\دWxA]&F>iK18bFWq߀*/QX0GVSnTp^%*e:725@bI=6&(A`:Cv0;'~1{q[nCJ,0p~j*39Wi{nKܨB0 y~ZP<ްvJߎ&>Fی^KYtb zмٲ ٴ_ԉ#;njn@`s=r>0K|AxFuY*B`XR4Ffp%[ /G#Ҧ#=  C9K,-TCLɇ`p䛚@:z}Mfz3LK*uw_fP@A?$[U+gSP)K/`YʸK^ Vx#N|eۋ@)u32U8 Xq- [u_-MȊ8Mbe7?C,ʆ2Ty=$Jף6/*/v l{5eԲw)i(iie֑qdxSfe^\qupp{DЊ&Q"vl˷^Jyy` aF8L-(1/?枒V37N()\6>Jj(2;f%t(65B Iac)wMfU0`nWU%kP]C5[lLR< wT~8GXeRSPTB)ZgHkvSGc9{XuzvB\-!2WH8ɿ|afN]v7az "D0Db4'RM= .tcqm4拀2N;@;9rg$X.Ux ?Bln%Qꋗas~ JPm=oSَayJsC_*7Og>DY]x޽[XIe&_b1{n[֧J֧GWOqߴWօ~ßk}Nԟ%_Q#G" BT=*'0tLM l3-Y_q.$SԴN?AtִД/=R2X Q Ь)@/l?  $!PC.8Fĝ{B5ǡ{3rF HF4_Sjal{?{+dkF'ү`O)6WmKb`b%0Y m;TX'oƢZ;ܹ[Q4ou ܉⚞+q1za}Q(7zѣB9<o,Wr]#X|u"frAX )6cVv'!ϯl,$1-VGm+_{m! shDT$^puP L+3]qʓz l;j/ܐn3?駖awPCb1NM% c AU ח bY/ 0y^$3sF`> //!ES~Rw#1McQQ`0o p8H5/r6`WH@Z( L≮ꓢQ@ $%fok̸ꓢQ@ $%b!`/3 7?`̸~"Vܮ'" xq7g%G1.!I&D VyAC,O7Оv;<^}9hZAAAxfiˤ>t(zB=2in<@  GQ'!ؽCc9r<'4;8 &Wg&%YʚDB\"K^ui!w$ OqFruP0Z U2Ӧ Ax*_і )5 Ӧ Ax*_і )5 ӦAy3mg0rT6ăxYmꎃOap@)=&"ASAwj{GW ڗA06 [ sO^&l\6T*m\z9QV\ЅY|'{c(HPO^c"1XJi:P_h5\.z xy>+m9kPMX q#ȗO)f{ H3Q5 B.@ $pd!s#~<<+"x M0B\t8K@zB@F&S`cbP-`'{[! eDh;VEX0fK9-0IWfH  0Q){`##xFW<+*x<$9E[-qWW.(I+6aa@.y24x6_-"bbϫp@t~,/;m%h^ uf@Wp~<5j>{-]cK'Xto(hw?G%fIq^D$.Tʳ?D*A, `6B$BB dr`)B(Ͱ*`/@4Qhp.U=pa( Aa!ڈbX#!H$ ɈQ"K5H1RT UH=r9\F;2G1Q= C7F dt1r=6Ыhڏ>C03l0.B8, c˱" VcϱwE 6wB aAHXLXNH $4 7 Q'"K&b21XH,#/{C7$C2'ITFnR#,4H#dk9, +ȅ3![ b@qS(RjJ4e2AURݨT5ZBRQ4u9̓IKhhitݕNWGw Ljg(gwLӋT071oUX**| J&*/Tު UUT^S}FU3S ԖUPSSg;goT?~YYLOCQ_ cx,!k u5&|v*=9C3J3WRf?qtN (~))4L1e\kXHQG6EYAJ'\'GgSSݧ M=:.kDwn^Loy}/TmG X $ <5qo</QC]@Caaᄑ.ȽJtq]zۯ6iܟ4)Y3sCQ? 0k߬~OCOg#/c/Wװwa>>r><72Y_7ȷOo_C#dz%gA[z|!?:eAAA!h쐭!ΑiP~aa~ 'W?pX15wCsDDDޛg1O9-J5*>.j<74?.fYXXIlK9.*6nl {/]py.,:@LN8A*%w% yg"/6шC\*NH*Mz쑼5y$3,幄'L Lݛ:v m2=:1qB!Mggfvˬen/kY- BTZ(*geWf͉9+̳ې7ᒶKW-X潬j9(xoʿܔĹdff-[n ڴ VE/(ۻCɾUUMfeI?m]Nmq#׹=TR+Gw- 6 U#pDy  :v{vg/jBFS[b[O>zG499?rCd&ˮ/~јѡ򗓿m|x31^VwwO| (hSЧc3- cHRMz%u0`:o_F"IDATxyuuƜs59NW%Y-w4墌!L RPE%PU<$`!! qpC#b.lcȒ\fusQ̵gd3<ݮ5\kw} 7+b\q1~ur}b1X0j,q`70(d&ݦ _&| d&7IMb)rɷg\z[ߺիGm'k/>aFݻavWtĽYKhD7?M69bi04TPȁNoq'@8jvGݤc1sx, Dw )Qr,3%p(`N,m0K++T6Kte?ҾG`Q*bjY9z6Qp~G&Nn0lOhɀ M`{wM^Wy37XfY`5(.cs'>p>Gprp{t!QbT|~B?W]#C=p=6/AB@E5HDb ƈkX!tԟ#4u~EG8@ bhtn>[]Y Kt,6Kk\\ҞtKG\sz.b:6<,N6{&}1.Ÿځ; @Ke6v2qlo(cQSAmbPFyZOpu\{^=ʕ)y> הW_khq Xv\c''O7{11-@}"""~e+KAq\J 5r %KA3gĕ ]吀%rVd@?BZJЭ+<yXxH&ÉEHn>'0³lن5d92&nc`j@ٶq1Wj yQ˘M紳Yr4 .:sn1Ox3R+.POgԳ 1(MJ n;(%d[3:LV1h&h:j Jd0U %bQH"1%]J0gr0sPVu\ u%IWs:9;tƖq&YW*H1%'0Փ}5:܁Yuōb\q1~=2X55h`Ǟ|IM1&)Bd+F۝\lT\ O؂jg|:-C}GLn1B@Q|H) e` kx?ExvRHcQr0)Xf Q.eHX/O]L,Oy\ dedRF̽,=n\0V`ξBhlX.tY>J5T-J5" KրʫUUk T {ٓd7  Xk(^L]O:FMOغ#|eS1Z'llp}!0;>dzO@P)4_ָ0? `TA xcYp`Ga]F7! ցrv-Ħ؁BHjf #%E_S}hm5XV{5+s`b{*""]n9PJs_LoB{?\q1.DVCe=&A%=4u׮^3~z qRpڽ[`. &Xr}x. -N"c, ^E)&uy10`ŘJuln5^|[nՃ!^'$Z^)Q[X;FmĖHAcœchO%a5 V`Y ~{ݚKǬɺ/g( 2u K/ >ӜY3"D>-c,&\֕_1=rZf#>d31Bl=-śG)ksn|ЛxC #P+9< Dxxd+p)3K&ټm hVTB{nW+4W tzT#֖Dc@5C4^2J wciM:mЈ9  ,|~#@,ebVwR%)|5Y!At>qe= |prNaxw1>O r1.Ÿ!eEEʴ3<;m6bdž͸F+\jfQo #H}Ly0ڜ`x9` +M|DVSdW *'F"f(0# ,{7X1ECtA&(0I"⁓s5+t#fky K4E%S (%eHdd?C(]2cTq\"_G1i?x:ۺ6΁K8PxP 5TUCI۴ܯjNS67g'tKpH״LN&TG= ͩPvA]3O4K{+Jhw2FlhVƂpu,A3!1#Sg4NcCzuDJ4U$" 1^((1LzjC?BZ`د}~]Ǟ"x  xW+ ӯ8YscR5 ߺSy9x7b\|D:a=n[KC l-OI;㲫Ir:ezc$<xAJ|ʼn$pJ(sL! ޣ֢F!q92Qg]KVDߢ ,e\h[ F#-*e#LOt R"! 1HZt^A%KR159 8GZ5׏0+'Z0 gQ ~|=kxgs߽^q1.Ÿb\q1~^c߀;>gxCk|1.ŸWXaHuMEQ0 ;1wg\{q;Ǘy>z$ @'4<$k^ڞΩ-j*]8VgX! ĒÑD S=/._EQu$JP'D=ĖuhU²рj`9@,Nl40<>~F=WK1IC` =)1k q)Fڡ#L@Sa0D{ ƿtǟ+2 n+1`2$6` &L!L@L1N (G*`WS-kڌ>.p)YT1&F]Ed{ݘ!?ʤ XIZcMٴb,6 5&`h<H")FaҒDc!!z[F%pxhWEm7Ѓ>E7 ڑT4a 4λa&1Dǚ@$$"],m w>_[Gh]sv 0|1.ŸFOg [m^$ir3f?1cx=jAJb6m[PfIc0d{#./qҥK0PUf2`( a1Gsݻ)0SOG]:ݿc1q%Q@Vh(0BtGX;ODh*l\d? Yp`8`<=rq)t^K6oMƒDڮ%z !ۤ:Y04M@!|ԾN)Sfd!tS46H,'13}CNNJ`QA%S"nQ["0G)v!7kSmlʆLj"1!\+,ԋ+ !lim[ލ~ rgsЖhJ(g-H}l!;3 80&W`^a,8_bRcޙݳAp{h~++u!1Pbt''q%6A |Lvmjt:6I;FO/Mԯ&@8\o* `w0UBKčI9i LVMQێ.`YIft+yjbhZlИ<e8|9ǃGh',*hFA NpO\JWX,2z m :Y~|9ih0QUOvpylA"[9 };DQ&tAKdԬe'r%j%U&|T3#Lq<1l0Α9K<#FY&!$z!'3 X2o!xllڥq} VĥE@+g >  ơb&W*!:=-VC iB}򬏢T}6+qbQ&ξK$2p.,&"ٞ:(`-rQ*'ӈ`w3fH,B+awH}BW~XnJifb9\l >xX3>pv-\FƂX'hbqo &n7K#h$t)6D$'AZN hf#D7fCbhndaz7ffGI5ĔcˈF NI IҹJ54+!UƉyzzk'矋`#oi>W.Ÿb\_Z#c^m '3.yhr:L#>DLؑ҅щT۞ Zy ؑ[,3<c /Q>fAd [lDa eX#!īhsa8O7< pߒ9gt-PXGFzFܸɴid[J2QѦnԣ-.]Dg̦3uS0'mgyQHTApJPCNs )#1ZKT͉>x6D5aD'P5V:D6d!y?#g-AbE{B cu eHn`=x<4/+I(SH$T hI r3'ܫSs4l۟7-psƗ^v?4e/_st,(x'߇NLW(ZpS?fs~p2|i6L/T훮IA,KB1& r6:J;˫|e[ &Yp@娮ͳCQ.'/ ʢC>(r*)Ponr2s4o_0>RUXGM}%"ͷdX1d)$E.Q4&#cOȤ hʯR7ңLO>W[۾Yi鄘RHO @Ġ+P'HQk3zĢbf)|3+Ⱥ3EqE6, υ_+]5[\}JUcgWs MA,FLp(F:,fU:"-M]i!PPwڜ~+7:BX-pv W$cD3РIҠ1,  iOpMph;9X 4"Y4 MMSZ(OΙvy$azaV!+0z 48^"<~/ r1.%ag?ZȊ*\@E9J\2CD0;D z%kc-j|bB@G1C@lfRv5t'}R._eӼ}q~Ղ|J2N)J.V뻞߃.gia'?=F OxVl[Z~iPȽ I˖ʭXsK&q?s ,\eed.G9U$l3QMkg4@C Ě$Vs| 3oS髏OQ9W}`vJwM^˴`:ܠ9G='MK ;{;HVB G##BlGc5=3M-Ǎ`K"tk.tIJMkqa-(iDhl'ޢ٬ׄ妤yB+u]Ps ܦy = b3:NW(lbD -c]l,Czu1+ +I- DVl0A| m-tU+ |,Zc~|7^Mox98b65l K^9c.tʳ\nY c@ [O]qd˕52y6` xFl,W.ݮ90KF܇S˟vܾt]fJy'a]*+AôdCHV@PZ¨ f{Rc'K4IMAv2Uptnv/Cj ڌܟ@Щ06#Tmr3t6',.>"Fp>"&s\3obeksMѐumZ+键5deAUF ڦVD)Pc-1\؁o yh5L` #V[{ HҌ`пOl6* rɱ(l. PӾؾ"!隀uk}xgו<,zv ĥk+av^z)Xz,]^Xxם&e|/,M"a1VҀ-#F̀hD#3J5b,MXN'3Ŭ Ìe4Sr,bh$h#cfF3D 6CCsL.h6@lP@ *C7aC$#.5Lj;"bP"'@@b%ᙞӇô*öގ3 YZJd:7_goc4 r1.Vq1ҍdޮ;Ǖ":$B$n'aO_6:5ÎWՖHVi(WL{]T60)c#Kh3OP3>T)zN!v)6\ZU[2%ƈ [ 4/1 m}G s$I` -MlLhD%HVXWZ&@tѭɊR%gp֜1.& |rqӖdሓ ' X*xlϖ@C7\ >b#4 7 2llо'Gp՟U^x%r0,nq孖®8#ؒ]^y]V: ؍a,}+$ $nfdҢMz!8GBZWIp:F@}XZh3¼3ʲDSybm2LR7r,st'4-U*IcF L o&`Ma@jZs5&^k!ԤͶDG}5C"Ja $NpHab L_ČbZOi,u3Ƃ}5\T@DV.SraE?֬ѻnatM #]K #0eoAZ+uj @Ϊ\,U==&(Y>d 2 `1>UOteEx ]1 soIkOWe+Ѯ"t3+&&cB7Ak&L@LAԁ.:#M}V1bA=$QG"TDCk`UI6ͱ?s61>ZSkk&d+4/Y~ 9\E]Auwi5B| 72!u]'hu]w!;Ĉ͏Ss9#^ص,[nƞeL$4|G ({Z ^u6܉G*>6;w7{}иT QRdqyxOBWEDIݘq֤e[j+KYSX(g'(F5%eB;ח0Yɬ-qŀ.M;·z_1],)tM<%;YiS4&_ *~؜Qc@ryrPS?|/ȀcɌu@5 XHrzFxIKH%6dZ U:*uGGiaB= Ƿ"wgƒǎK߷lxӏycOIdJm؂tv9Bh ƀd's4s̡%vIS`Q:I27yK3b2 m(Ì@<s{t1UB8gȭms.юywppkM{f'fS{WU1tEb%JLۖJ6.D0&GCC\i,Ɇv qGDW1OxX#sJjV8On 9.] zzd{{Z Y a*e *82IB*CKtH2jaԲ3+梚v[(ߑLMy 1v2whWa%P3vv@׶*5÷=-wkH4&2!!cɆD nDyM,& mEXW-BW 3 Oz "E$4l $#UU5 $W-R?k5LʹA9Θ=S \ 4WvzPS?BV+]rID g$t2E+h4UpXݸL1`wcɬf-F8QňEuAפj4N=he 3GZ(Nk,'+ƌ'a7iۏ.~I.FpZNߋLKIU=GYg K/1Y-!9-=vJA Katnss훞0SzURY*ĸ0s̎y6ah` ʜ){&/UfĦvn|I@ka߇@˝'AO2L1 #s1mQ2buv>˪d 6wܾJDb^}"Lȝ'{Y{}mN'dT!!1w9>8MFMt%i02WxfKxrײJzDFx܁݂bGzrV[s8)X+tȃ{Єz3Vj/<)/5KOs*P 4S;ʤ6QuZbE#8!Z,ecA E 4ws)mL,> @IU+w4eRuq6ʜl|2ѩ?P42xi7(1SF;'HNA$YT19\"!M9&fLl>TLgs'\zP{pgELd)'u{Vj0+_k,ݧ"PQМrpx{uLѕ_YfD26jVo\8aqlTRf dFYވ.ԓ9v~S;2 lji[NN5?4fun>3ۺd쫄lA/"tZbb&RZct]v#xT;B})7ū',qI7C#.GpoِMX }ODP*&2\zge 뻋!E4j‡Sw;> +_m>+Kl\}KÜ"04J5sHO>0UA4>*gލ+dmʼyĵV4NGI8C-7<$; l|Ew9{"hKZ>4ve%w~>O&Õynzv9ƹvӹYW16߮HU7JGK;g}']Mʤ,޾r#E|io/(X1&Wo~ g~+ 5v>L(w'mEBsr'ze{ZߡT>1F= ،q=u!2* 1!*`Voz^\L].Lߜ9,D@R"O5IYZ"^3 -E zKE2QTWǺE#'XMKKtޭf5\~,FAsT!CĹy:\˜wB!lzδڝnS޸v-|T.l3er UOo|c8M&G#~qkh=EZ5$f3CUh}Sܝ;G-j9 PۂZ-3 &% 0qQ:p K]`|j2]14T ) ty8<6Й}O``lu9>V0gM9Lg|*g4-[Zڎ*]b4m!;l3;hyD#6Dqߔd\&8¹[Z/E=E, JuLhM20BA$ yn΂?v]+Hbybj 6_\Al$vh}fF 9.js]&E=c:`M69J%ajrIϥ,w8V۔hаV.ڥnu^/sV1pZ@smRӽ0g\"a&61os|>WQỎ9./(&!uݹ&_b>t` ɜ!&tSd0D}6$ CIIP#0nHH!nHlO1vt%+F+]qStI; &Rf *[RL}߫:CG`R.RD6{{2XGuNOK N_#/}B./]W ?KU;"8b:?&lo ᙽ:?bwX YF &@(@S*u ]פrWpwu٩{͒n:2k*}l]< veQ\w]{&&_ ,]Or2Zj(xtGj/^ckmZ+Wxj[" >DQRokUT}%?iwTE6Ql~m\.\w.xڠht|TM f%65B~B[AAJ|LB[.pv|6r;vz;ϥ* pkϿ(kl&5TGѩWcbd2SƌWn*v(%#69=J1uJaK~,*v7 ˱q8cMB&,ǩG {RPZ2@uF!pu(<16I|#{ܝ:.l"&.[ Hk} #lH&50. Zfi[f5"B i:(mPYnn!K`y"!Ċ]I4K2 Nb(y\jy-I`q{M{^B՟UťI: OpEzs/,fA]5t+nP~o| MSy YiH|8ĸP2 YAk\r*BFqu_욫몀XQPdܭ^A !&M`(dDC3@}?i+s0Ktuw'qPU3bBɂ ;,7V8o#=nk\O!OTbA) ]%94DŽ!&K@E ihP_ll~ Sl¼AʽԐωu ??N=yBD#K\~:DR/Հ2B#A%CD#9Q[̿GIޣlɿld6L{pr=ldw 47/~~Wsu~{[Z8?fR 0'ͻ?~7^:}O=_?Ϲ]oz| %3}~Vn&LH|2v<.3b^pKet|w%6S$DIZͰ*F,3!tHb#o&~|C[/gAqxEgy֫\  w]%0k /K bYC+& {,J6A4l6QT1Nbc9PxX4*hX-a#d]3:Zu 4-["8˒8`lƃT'6'`(xqbZY,[Nj߀.Q+ L!2({w&m֦gNheZ2*j{1JZ'#ppU!ˉ?ȑ.YgzzYFe/Jj 쀴| u]'eǚfBzFKe<.U:g )։eMu2diiX]09H#0YCq3ҧ>_jnX&a\N/H7M& B(`N˱y+[]3%ՕvQ[#}NS<53%!S|Q7D_aTNJ̞5-R#Yrə.L1ϝ;.U4L HQ-@Iak_kMH36ɜ< t 12M ?O }GsT}yv[Wy[_f4 v $H[QXN=˜"xk e/$m K uA4ced'Tخ㹮`O:QBwz!]˩qg.Bhl|:퓒6uy)$'HjPfS8d`cQY2%ۑRƆ"ЎЈ:qhpɃwM|sJo[I3c8'_dWoy8vWG^8{,1}'oٌQݜ2֌Xpd`ʂk C916  F )8%A˭ ZL5d(N>xcXiP7r;,g gW ҩđ}dol LlO_=})WvW|G?|WO~_3??ɟ³O\?N>EH%>Wg S(gPm)z^W\鎘W(/_i+2CuԎێ(Z Uƌbtm_9H`Tgjs<{n'y,ZOJUYZSo*ӻ<1~[k5^#pFZ80%E{-HNd4O{&2ܦܹf͔ S6.xx <1o$YXX:1 )!|HLyIut#]yT.29maU~^غo؏_w=K8 ηhWVjss!5; Z1VtVS)uq!fEV0UBfa $l1Zj/Ѥʖ'H_ 1CqKl-cXTt1YGCtɓAhج"XzȋW_ qG ]4dֲ[fCa /И%O:l%5n9~h qDKwf-b!njTeeX!2h" 'G/3eRܘ2 edI9=BhA x2S-~9C_+/ΔOgDX'.e am[\5KqpH&Qv4& >Uc>,6 9RuӀ  G&P77&ɲ=%P;x@!0Z3bX3Y2b]گ˺˜ΧN`;LP+hm5ظ 6+*RU$$J=hhZ+hNj/U~XYgw:6ӓbP;DRz{ Oj旫gtՌ^|N*( 2!45wOhCKwX7+e_Cy MU,3F &^kS=NX˚@}UK`ɧ{2% NxL'%jkD[V1IaYU}e7~+/ݺ˧^zɬbgs̛-yo_L\?_-4=O|^ۺ:G?s//gʯ/>W/o|;_QYR=S g<'c?6o0Qb -|K}c^u]8\Iti9v/ލ}O'x`_FfCu?U.UvFC6sؐǚAhѓ0rg˲a:)nG14&(TKO#rzެށjһeU ZZ6 ߸̕2Tlw3pUdT=t154PYH!S;8lɄm|V)bt[&+ߞ:-w>ɻ7mxe.@^)oGg8 .+1@VHh!E -ulXlL936mb 6lJf&M@ٵyR4:ukkVdPdrPbaU,i}忕VHx5%5j' TP6v=u5U(2e6w}XUꬓC} 0Mŷx$~ AwD;h^n&>?+MV@c|5+ *7K7nܻT S/ V+\݂Uϩb8=fmq>恎=]tL-+N_c=D;V֑]X޷ /M鲧0< b>E;PM$B I j-{`}r4t}/Eu6-cw(!݆pjNiVzS33;LpHqJp[?EB88u qLvki~|?ǯrD?2[ػÓ';Þ{+{Tb4ư Ė"*cؒd#<"> M4TCFnpϠ>IAkVrs9JGyՖW8|hZjSnHHh>=-~3m&qhbb豣\s-WxƆ,xPJ$%54%2UPb0 ˀ!7[ݾamw{Mڕs]uW/o7O^o^$G} Sd[ZOx̹ j^Ѷ-Ctm(Ldw0`c51`>oy@C`D9s2Ļg%hIIOI#B,7Js^ |G+|$\1JoyqqBl U 1PG0!Gu;FF΂ff J/nȘǂL<:Dsv..Йƃm [ΓeYn3 %sc<2v]Ru"uրu]H#t˕B -(ťq% m{]=4pbh:1CU0<ȐuIL/7u.Xt,2 Gb8:f)_ pz%hh` \3D"-Jέ;wy}4g}7p2?3yˬ]sOsϿ^~|?x~?;Rfk[ƅ+V~|%=빗^~뎓koS]EUw_f>㈁DRO+?gf]m=580# u;8 `UR!ޤjdžx6`gpx +~'?gn{6;"~lNz =AfÕ1n;o#~g_q܄<2v7ZNh; m-K3ưY115[1qƎXX&%ZfR.]:]U0KwF|yF]{ۇ3}1z ̔KzĞpo8X8C,ʠ|^14-xl8äNL=Wr˖}C*N#ʂDŊ 7Du>Nߦol\}/|Q MW/x>)콋fzW 04$QΚf!\y c-YhiPi5Gfkgl:NiH6Vdó󦆅$Jzͅ}BӤ߱_㜭fˮ`fwXqU!e36愭:aˀIg2ݶƇȃp0L]p[=$?eczEK0zPAs풖i~h3 D:GNAѸHDBhX=g~`4* `ӘWY1d8Ȑ"tAJA-3ھmJ_!6 YacRTV:Z]/ 3TDa{H6Dp!D;wŕF qnBԫ.5+h){;v OAZVAzcsݪN A=J Z(əTb JM"S} {>|7Gc_ 7}W7? g  ޹OӮy_8:/?S? mK||Vnۿאgi~?_/xU/no++_||6馇0;{/|l[߸_}o6MPCUlk &߇{Ν]+ JS aso_]>#MtQyg1z>[o_;Q>Z_g/_Jfl! lS搷2yk*u`6 -O?M89#ҾgIF%PU H4uz-! Sc:=Lz\5w^wkƍ>fŏm~?|1ݿ]e? k m>S>MW y'5ܛ6M+9rmYM.}Se43 ֶ89BYډ5ZIgax8ڇ2k˰..u 'ڵb\NŘ1֎al)bwj8n:iLK12<Ǯ(Xţ萓C&[΃{Cf}td4r Ẅ́rh{9coTWmٍAmxVޖaHzC,M0bSS+/ qۏq4,|6\0YFC/0MYӦ]fxø+zgncb|H3#y{ӆѴa'Si=A) l"2FFE %H `(ƅeAL+\'g2)eqɓh6;y탸gEMg&CCW[ߦ1PHA⪾?HDg1AͰY*%k4&򈊄]~qP>#V׫U^aWs焮 YSHbT_?/,=˻o8Tܓ Zv!J@$ 069 [D V+mN3sœꮮޕ}u5=U'~;?`S3r1 + 4Z_?yB([~Mxe;~=_;?;> bvZt~nsm卻%kG:^AD|_N):T.w4`@ߧzD w8GQϧpHVDG^3r+x8t4;}:zX[^gi_JԆ_W\V.umey8M O[tZ˅׍Wgc(6p ( h9ͯ!Ld嘾O<ξiKlFHӔxwL%5ݠ9ZC&B9qAC* PЉUAE,g'M9X!tED՘&71u)_{e;uhЎ#EDD&0xehKSmؿ cf& þ,J:X[ ̙!. wd4v9Ƨ9-?-YXKqĚN MjK/i Pt3,p93]2A;K$ep!\ﷲe7hAAn ,CH!YIŕe5 %pdA;o0yD" .oA>Tp[ lPʔdCXֈy,1tNQi?`2#lxSCItX̰@0o=ނbXp|xls ӟ߀\~MWso}D$%BBу,8+(3vEkaga4HZZţt($芎!e;h&uqb}Nn:bl&x;H-ʦ;Q$W_՛;?юQ R6z?{msG% =zNo+g^g=?OWa9"G }-|+wz뭴Z-N( ,p,hTlUlz xr%"Q5  }pk>ɻ+[]C?/x̵8}&犃z O}}6&ߤcZ[K/nΞ5Gv:'H?,]V0(Z(|^/:L$sQ\sHDG16iAuE˽rL5uX!T*E42z44V-*f*Z'֞W%) d k9f SV9`}}ƣHSȅ㘃(E8O,}Ȍkx(hLZX*"``s&}n9 VS{ к!qzy.'G. ': 6EBhи9Rב21iDԚVHG aJ` pBm b'؅R%wELjw,"0Pca1ytekݓ۳Jb3?ώE̽q6݁zJUÉGѪ]!5>Uq&e4~_"]"g9g(Xotp\*U0-vKB1!ϳ_%[/Gko׫LM1 b71!󻀐lO8F>hHUh8kqL(qpsB2-d5Gx܋τA+}rLxCFT8 mpRVәx"$)WAv_$I"pj5n8u~8^U]~ߵ @|fΓ8JEdcӍ0w$u\~oa_:~|3Y ʉ3׽q?뫟y3Ϲ(/LR>$1\s͍LMMqws9|gyt}XCB!ׁ9)_#]"f*RI_ A`{ Յ p<@c%erLgO2sKD&IrgmpYÇCa8>(K.' 5 0 M)S ř~I*'MB8U6 _jڡhcۧsب|] lISE M(TBJ3#=ZԒv5 )PA((+l̀ 6ECKf K 70 O{%bP9De?Jh@x-I B }Oˈb75V ԽlxOii(" b/RԽcO%m@zt-A!8r=aM ˘D.ȭ Je]ΣgqX˝k&&$/TzO;$a /iD!{ktF=uLnɽGOЉe!~M-i 2^ * 1SFw9I0b[qBq=Vb!cNDA.k8 gh8p u%\:FOEM<y|xTpUmSqT\LL. mKmǦ@,vQx'w Lum]d;uTiS/p8 (^n<]݉)&bjθH}\2>!qcOcbP0Q*%!q"2+VW 0.]~ŁuLT5N%6L!Wޚ;hczT@Ȍ}Fd躌"R\é:N'X/ap]1>CyYjErl]bb%1qhJ5 [H!XQ*uU3XO "m8TQa%kx_0S9YNjb`0A "yuOe@$Z#Sl 55+Ht}'#_>聽y?x쟵|_g;nOܴ w}_q,piMi^lXO{-v}<垇oN~c-L~G{zԧ(X\pž={HӔn˃B X> W_G\LX aXG=4˘`@BGS<+o/ZZ`An@E|ѕ-΋%S{a|Ab9zh4\~y(+&mX < N@[!!W4`Ш~,-IByFȨ5D'%ôD WVe2t thW33h4 R,-4.|yQ89jC)8 w=TXSpq(GZ-(y,..Z1c MXM30fL԰- ir)B> EH`o!"%=fT9bȕVf.YLxэif͐Ec,%Wy'I~kF/I9Eֱ(j.v\7}PccK0S::A *ܲ܊{9 |ŸxT98B!7pN5H@{1q&t' 4LZ:;&Aq$֜K$RHx ghSӞ/Ɋ! m6LQ  &)t{Jp0pЌ$\-0\_QZXڃ$udd8vLji΃%B Xb[C^4 |-σͪ8= B uUTYs͆t"'@3V](7r\ w]hxojWug)8U%oO*SSu[!z >^dC>YxDS層b{|> `5p2|P1^DD~pA!%^fj"{[JΙ;0ʦ,&`WAu~&dqiƸtH"L}܆xoLzm7H+7 DlI8Up<`s,zBO4(3q))T{3>6"6 d-:PH2%:?@s&A@TgrDUQ8WS"iY ۉV=9!wdi-@KRN5B*#E 2@ pϘ` b FUuCWؗt *HC?½a^{-}.{|&DX3P$ кpw%rAͱBIJ<}vz7}^ʁbS £ 4 (:+ OeE nVQ `G@Cp, ,(t^bc-} S^5GQJj}S/ZoK)Xw'& v35()>9%0$[~zcDчhovk̲[EyY^66a}݂ޥE%`ZgEκ)J;GY 7f]0" fA ւW1#u&ye֦M$7/X\h 8 [z8#*ma\>rOEm9:NF Κ-ZX}x\I+ǓXN˄>~Y8=h)mg8aT}蘹G3%]I*b8J93ҳVjKX##6\ƭ8 ^do_ZlhI-%l8lE VKіˎԘiZZ! $ky|HSBxu]W@a`uq>(`$.ckzpND~zg;&^;[ 4s=!a N,aupNU}MFƇ(]*`L U[AI򢮥BɚfM|q\?&v*]IdzV[}P8{,k>iSz}fap`-c&X:t{vīp[S{c̕=fE v,Էk9RܘC8k21c֤d|H~jH%-Q"&l~H,F9s`(J׳b=˙&5bJ2lVU?Xr !)fMntgr_7M@+f!jРY^1ϐmYRSlL{# \ hajD/cWf :DQl auh㝢KQD և*ksbcC^B$υb*D,c A:Lhq_.2=T” tAm)/' B{WMr;P1&Efl`\hX<YnmtH%`{ `xZA tC"d"IQ("7ܜ^OAD-w]anqNl2[O|6fk!0t}n*&Sl~+:LP& q@w_oۇ.t^09>1QdɷY k6mv Ѧ'g2༬(hMKI w粠(;x"Fg7ǹ=h!,אUFG-bM|Rx^i7]+^+Zpd *eص$J!E-{H82 !VPn-)Ϸѻ6A!5{a2XYIG>yo7oyWu/~=P(LGo0/G/f;npp?nbk֡by~Wټg W=i}shM~xSx뾎gtj}=_C׼5(뮷\uLnhXR#ᱥ~5/9y}823 9(JhC.sNi`7LW!Ӕ<{.nnoyHנ@Roq~ڡ_?R=*$ŵ "Zxl3L.ބ3-A!i_ݹ9h Tp816: dOW,30S\'?fS`]gymvԏwH`GWDiI^sKS|!}1 |/=muK.pv2YYfUQ]+ Z #|gek^nIM]ߢK&8#7|}@c4H~A "6@#zEm$aUZܠޜr#Y:"aV C39$ssDᕌM(9:8\@Ei!=;9̃'N="O;KY*YPZk3}สӴTEs)4ig=EwWxP܌P[O)DQ((fhg\H^D$Bv /HA `7ǃb0Shbw<ܴ&{QCH@i>oK?ՅM7)/*;Q%uH͢q\ 2R ?\wx}|14>Q昜Xd[vUsqNbxǤ X 0< h21Et'.1i!# !*2**oyYv#)Oqh\v ڕ:BXt]@m<,1,(l!\YaxI)[qK.2rfD( "%8\pΩT~ځW_/ޟOS~;^T)~3ʋ{w}Y^oh9w+:/i$Q<"wQk||W=Codդ( ֹW=[/~7o{'1լ=YQ78'|ҧg-n\+MQ`tuLTHվ+֞ftMTMWD1+ՍQ'D9r 8J۬6 gw9>e uNXIզ'P4b޽SLMLNhjʣ<+do!gFҞ\F0ah}*SrdZ N,"2,Bk|qcM"Cyhp8q(w8)}Twee_d/}gojH/Qċ(Dw_MN)&EĂ3 & ݜvzd+t9Fh/[xB(TReHVDte:В \ŀDWVAyfr&havhONՄbR1J6u+i,$LAc iжk.R XYqbwMCڂx(UCGma 6NE k @ǹ]e ǎW3Dǂ)*{fpzT|k{XFZ-2ҏ4/Qx4 1 N~|;@OövYBrT6QuLA3)`$uvU\b.{'EqP᪤vDԌ&pY9[; | /zS8wqSqw}_'h߷mM݂so_qɎ9sayWY_uo ,#t[҃.z}wxWNN[z7ݧ?76nʗ2}+\{op ˾333C#2DQ:Tc2GzNN, ]r  =YZpx&fW@`t9"fq'W`7JN~)xpP$ I &ѬY8Xض-*Ii=_@)J_u|,B p/gIŠQC $x$ S 1H6CMS`93iԑYPyD=PƲ Ը>X#QTUm+B+ Ӕ <7 ܘu.=JO@l>M] fMJB¡*28 w[ P5aykn*C!lS/,y<3Р.v2Z8f#C7/ȉi&Mj+p'G&"*F 3h)89.pR}SM,Km\^{<8CG2u85=ރEW8Ǟu#1MfXw  54W YbiH-I6aZۀfva@74 -TG*eLX/Ѣ"Kr3ϑx![acN! 'MDWF z ][5`dR&J|7JP"bfb)ߡNtkj' Y1AR0(Aq8T +>%* 8&f/koCڶOqB"z/Z_Eh{cDǞ ;ZRnBk|}TGOP&)xjN6)ޜSM1WF_ⒽA޹m*8EA@h"#L< 7R1S放nXmɓrxx uK_*<@X woR9OyOgzﯾ03}ӼrjH!ei~M̷% |'>G3E}Ϸ+󯷽ؙOjK.433=pCY݂uOOQ.[S] *ݞ'3;F-!RP&a8CD*}~Cћ9\Ac(`EXf`+OގY)n Оf.d@8fT̏Q]0 [5KXtpc=Ķ$ 2li<^$ h _,Q~ikmڮmSj ra Zx}8w??4FiY] .CE0hm(JM5۲ڿ#jWLCLyU`%”LSg>ϑR3#-SԅGcAxT$1BJdz{B?VJI7/řP/Cўc6?C! ҒYOtHHZbvޞV#KpiΌ˙RS*\ם">b](DWBY˾b@3癙?tl֓IjJR|zÒ82Q)dnFh,U<5H\2M.<& 铢e?J?xkyH5ShNbPH"2%RQa +᫕0WQ dWu U0c䦋mvwK< n/T<^|q}8<GZ[yYOT ݤo-i)j7]+ٻc'7?f>{σ޷ZK:W9}~6W==c PjwyaY|WVgmY]s~⻿$XOɻ]y<ʁwSG'k_2Z332ڊ~P5.O˴ aF_; Q87pRx#KxJ06ԅoooW49;z"Fw`T<.SwS,Ky% [[6VQiFѨ>,9Qr:bֺ` ϕRr<|ljñpl:XHEbh;4TD+P;1=e;x(W# 0J9bmv'*M #\u.U/Su\AS%,o-IƔ9ZtRMD)E\kԔ`v>s)zgSlDx sʳGAG)gkz%b jD2ZO3,4C{J@MӨ Ie˾9s;fؠ)e? Kj*&Оs]C/#w++^sx9W@ՈJFHQRRZb%$R8'm`vSb"A IJ>ڋS YCt73mI{UΉinz l`~SҸCML>v t#ԟ|N߫@xvM~Nq]a< (Ggz$F6j!TKN_M}]&m=VHbIHNl-tIԘ:BayQUB4I7J%y*ʍKAA}b59-E/#(L3EDY1Y6jdNOsEh.;ۊ"L%TRl!kiEUi&.%uk  G B&x)N! =KJ|iauHeQv{wz?Y~_x7 Қ(ٻ0=|!z^;Û>wԯr#'G_c~f?yˡ=?Sx︅% 8z#u([t;|;Cq>n:^#b O{a?#~ӹObHVw{< ӕ|onb52@gH2`p>[m:*~ <%`R˙['tnBa=Tu24jE`&srP3 Z =Bb6s쉡V=B:ESjݖv`TO ggDhanq8ׇs00"EK>SZ:|Sc$րLكn7>`яF-ȕk$urCF>d6F`gE`}l.; ֖X¥S>e01<βԺU->E6A`X(CA` q %Pl[H0g:n5;PkkAE'oN5Pb=P~8NGEV!ͫSzĔ+s[q`sCbəZ 7 /aZDd࡭" )Y#K'SJ JKȽ \5=yGXQ3MWpǓ=#O&' t49` i ny)uyHI / \ =AEQ Jw6,/<˞ɩS1X񊧔HE7OP 9@-T}3ܬ-HRo5%1̈Ao@! *Z6>гm2ItrMqQ/w2ءkwA%+"},#b7xۯXJ,ʒj#tB& 'gcEsRUKNPj&)E-t g[1LjF{;Ą`{'0ana+9o7`j'9nDvbyOK+/*Ays)ZhC\('޻mۍ\ 5B翵8Cs~Z{&tuB{PQD}A=&AE5|&ńߎ-aqQ* i)V<,k2q]](vvdL{}2vpBATimKU;IhzQ-T/$`E ɸI  0!duq,Cg7E,C`%,\ۆa&9?I^㻾\{%ÿ_ֲ̅민~R7oxW? |E54j~4?m ?wڿ'NSWO|Ư}pxc>~M =.Ԏշ0*dCkK#q!OB:)oP T(zn0{)$SE+K]mP2pQ A<*`gTQ4$2|^+OBIPk {P_هrՊV!>*Na[z3-V+VӅsPkޫ=:kwAH?zKjNEHHS)CsRRn82eo#'фgDlj+ (h}4 AG1ҊJbCCA? hlm# 9ȇa6p%/zϙLs~n~x-ypmwN͓C"<>iS JJdy"t &h_Za} ˺sUwgF#Lx-ԗ>+ |G Wd9؊PĘi$^=8ف){}8crr: M)VsTH!X"CsҜ244>4ikLi|QqRd2GF sy~Ckܶ[-UM)#n_^ %E+Jb)qGEDĴ 8HjƱ˒M7i2۬Yʼnr8hL"xCXXNtw ;nN@q1!OIS:#k#j{(_ù@ 6(0ie%P8f>&SWz7%4-+qA-Έ:TRw5{ǙN@ŲsAKl21=L&t%JĥU1#T=5VЏK5%uj{Ә! Dc@$e@q .q<,W6t;Fm SJFMxfR;z djvur,bkVqqcSrs(ӅRD푥T(:xPTJN @J*| ns^z<E2CW)pd,leP o(/p W oٻ~sSDZqp?9Ǫ;|=x募nC9r`/!'FĝG~NKx׾?u/>syC_>!!?{?}'8w3<ҏs뵗mLqƧqƧpY }(ѹS>dW=1aXEe>A?(s~ge-t++nYMkz>k?Gg8:UyhFA 0\e#@0P{\S{`~̅мjR耍!0jb @QZ7 p!PNz7 # 4;C8߁x1%B;C/K$"P92nAv"lxKno=Gd`6ҹk#ap q ʆǶB{:'<>j9eyk φbyu)|V,ͱ>\x{8g_eD/x >N9CtۜXxH)B2~hwZAMI`\Bm6%X9%DXύS9{ ul/CNTΣDΆ%譅a A V G,!xEn=Wl3'p es-NuK:/$eRc(c 'r=A]ڑ.Ff/ %Ễ9#]#4!P(-(MtJjqt5p҈[e7Ͱ^j nmi '=A#55EqFAffEA~8YYMR)Sp զ# B"M&s/dx}3-wvON dXXTXxL) "T-.޻J@,?  q fdzˉicbUtV4Oi DqW*701 04}#E3(lUW6w%m ު1&Ƌ|h2R()iI+ִ7?CҪ1Dй#L@)TF. A^:| T1aⴹeZtJx:i7j6VhICT.![XhC[T+7Ac ֎c(\& T\ͭ}*4^D v_eKW.v 2AǙ5 bU:r8[E_/x΅C^3>nNH N?dXZ]瞇ބr[G>V;,N#YބNI-nhs;ϼ_7Qwoy.?zv^_wKF-;_|?I^EI?w>ƣ' 7_ fvp:r}GbW0\>yN|_80FL]Z2/D[@~ ]04U99I}W9nrUVw!ByAh`XÉeH0_ W Jیꑾ!(V#[ۋ;0\D!P##/VT4>|gg:ՔrˈDi'sIQRRxK,<C)<\X}:4:vqzYm߸=ZuNM 0zp ;A|3K^ 9$(S8\28c+ރ5!K䈺ô|L(XWQ`pzCayF[jpe'xt1yh=sdbiO ' 34?.]&.?WvV`=Db'4h5^j5ZHd:5ƫyۻsA]t Dq%5J(oݘFך\[T,؉mb`.ȲÐ"U(^ m퉂NtǁaZ[<'v 0/**Vpz%,Mr`*b/p^WۯF6P6'*xξ!GFVxBJ$b+2R}wcNi m7maBs(y;fvM܍8v ng;> P RRIF:B3/65KTO3mtFRijCKh fx úBJ7[S؞MRGF VאhVHcih|z<ϙa8p>5 RA=FLq=ۖ .E.e#EHGwUʢEH]!F/")pZ))D%BE(#tk2$:z lS*bPq"#/"b ov_z=TX:;suڦx3y61za{ۓyc>Z;$?ιU'~~/=UO~ocfe}t|^ Zއ}_M_}sT8pWqpD#*Jj}8UTj _K7Vsu鐍3'B@ =)`d圙B$l>Y@^`AW,{נ{Cc&dnٳ%iGCPȏ;AWM SdZAi28 \p |B(H kb"܈%!,O<x\-H@=fzu+#H3riItW2uK9.m]Y_`Z2.LOj ?|;-aONhS{t}r)^T>l" - Akk^6<GpG`,NV %(- Ac2Lu` yuZҏY.ii(<Ԕp-BvZ 绖 _M:z gM-}-$QEQXX5h:i"mTk\dЇ?^gB2-KCUSZ4^dĦr'm G& rhi D$W/ε-(>w zsyBK}8˹\pa#5Ʌ,a>sŴ`Q脛a}@'4e:h pi  {gx՗%1%Y;Kg}38/ݚv[|SDr{azSFxѫw("]yCwЛC<:߄` /1* %YeyYl4.b/@]?lj!͡6mDw+ `FհB"^k2w)@Q 1Vy !L;n. ]!c ].Bt T8ªin02r Y^ Ύmı`w6\6^LZG&j6سgӍ)t#6jiJnD( RKL/E:H"L!&F`CTMx4ibLLۻWM';z…F[ cȴfǐf(U ǖ=@V eJGcI<. 6o^Fxp.$(ϨRWUF/Ά)JKr?2w%jHpUJzea(?B4j ڿ)~L5MYN>oyy ɡ}MOq՗'|?eym7ԯ^DUB.~m7+u^k.;yI'~}lﯿR~_Hkn/|<ȁ9}ѳXZ됏7O-BVTi!K~ݡ|eO_0{$O ,D\u|^}7@CPyNCV@15&NO.fbXCp~Yw}AAe/k|(JV10hf(fe.L@X T-%P#<.tSa2e>Zj78/M;J D,An]h0=Y뎦#p5XWHޢdD΅;U҃:`H`u;;[fbZ@wwԪɍF(2Bhc\Cz`%{ gzkAKAi|[K%3aZROH}[bEZEpH : ڣaL;Bcm%ӳ-Ja>%,}e6zi l~Ay <2|\%@[@CE<3n@-Pd4hEOAޫr'R5WH!D3=\iY2HjL+n8j{|8i1f) $wHJ[b=$]g(Ӕ[eI 4A|d %'5\D&Jyld1K8)՗'%D'qKNu5v0DD>7x 3aa*Q( Dsk>vsg@ [[kz0ܩۼSẓx|"4w6v&;}5ͫ1Vx38Yh^W$D& $HGa\|5:63HJ~䄵YNAЍr4զٞaa^wrEc|tH-|"܈r׋ۤer1q;~fsٰ%yU @.+IyO_;~&j(҃ FRd%z 2z ݴ 4%N*dP 4mLYC22,T 'Yzr$H!IāiLI@Q08EyGo0dc ľUqǖQ\ gǻƕI 5{snT-Lcel%voRJPQ UжX $)0U^Fak`?f 1ZѬwA=r`"Sױjx7s`Opn+f7wfso29{#\Zg.Vj?xo[ :~Z/=[|\XYKj5pe\KǞi?dfNMbh@⫛OiC'jx-+\~YBgPp)O. ._qrO҄'맡7~Qn%K|H+~p?5\Q׹pa;4DGa"-Hj3c uO56 UU1 D**'\1Ee!W k%pZ-fnNKWet{/- *yfbHCy"E$T(ثFPZʵBRG{nozd;J8QFY~7ܳ<~Ѓ`Fy޳>zCH-JUWx-EAVzr/yEMilX9чEw>5:'_+Yˠ{Ø~I?uXh^3qY_\&h"ӡ3Ȧ`zC{%[T5!-KS>:66cM-,ȝC A4hC`f<8 dI"h9H4 X$'XӈcWJ@ ujz8. ;Z}9)iFV9`t8Z6V$\|1v.IUܰ@Œ1VXuH4x@(no]y/z[Z׬0 S| ޟ@tեz5'o_$ˋ]{ե7.M:ֳz?7-o};oǾ4j گw]?_<.="1xʓ-?}?xu!~˿e\֊I?<2K! CS8IA%h5ބFSCqUԡT[䃌Ɛ zi30P8$L[)3dt+8ՃTKO`<ꗗ46gH sUW"< .<.\A(] ɂ`0m:j&$[s,Rb]yӟu^ f ʑfhc5)%VDuic/ ˌ1n¯/ҧ?zd;C+gg*WH:aH Д5,t0*7ssā鐦[!co3*idFQAex^xggiZ ZF:CzġZ±‘O/ UӕHҶ%tuLa >nQ=/hW0-Nmu \"l}S|7ws.YG#v]7?__XE=J+y͜N¥Wyg5E()E}4 DiL氙EE(NIEL֭Hdz6,Х6$\Ss1C}fr"4q&RְEp /Odh-C˰GeY" )VN6tT;uECvWP_EMoƭM 7WS9ܘEŻ2ͼx*{D%>KG%M"K=kP*ְ`g҅˖8l65 5je'ʸݱsnm.^˂.iLm^N#M|1^N8Wt[x6EULE\5å\ yAKӍP%u7M/5l lrd޻@vǖ0u1N%`9v~D;Jhi7KK00>7d =ݦ\ޠ$WҔD ;h w"]pB#N$Uvo+V&$WB':QHF"+uR5(2MP(oBTz.W Ġ ™*קsÔ!Ł;g?~_:~bM-7?o9oy~~~SNo^r_5oooU9oK~ t)eGyŋ˛^jZl3/ށ-YeϿ{??5Rvq|쳟/y޿(Nȶ&jJUAt\XS+|!%$JHV:?oCИ Zukd|'W}3x?W='¡{O!a(1:+S|z_NJ!!PxtTw DSJz|Y"h qx~aK"#1`Æq 8;.1Ig;JS:'9jJ0c2BiM+R>#v<"+x?KuLDM8]!rr}bxs=t sϜ0c8zkFjZ] C$}ᰝQ< Mi75Ka(uY/eiP`&S1\ј||;%+V`8g@8B,Ͱ>4b!(! EI~+Ȇi- )[(}=Y *SM::MҌ&lw{bkv$E>e>POV ޗ7h!U^ZSi|x uabHX&4&7Q|dG Yvh^GpH B8t!q6QmιKx,! !vv@s\(.'f3Jd~N7tE>ExB5/Jm-EގM`&pn *_)4%q vvH)PhM-ݠ,5ZJe $)pXʀ :4Dj  gg ")%%FtƐHBN:n(?MlÝC:uTva|a,+eEQ\-ʊmːM8 !BjNVLCc4Uz:ta* L(/~ 1}\sQԛ<g?L3?3oxm4u.#~x ?]k?gz/~0BQsWh Q iiU; +CPXXS>8kb\1A TH/Un#  HP=e;YMUvZ @@!8 σDޖpAApgjGZzҲNeplpѣ {+קZ-L(a*){|WNQ퐵ruϦl>~ðv\ZIDt vP \S[ ۯуH k D#2F cbK +q9I9h$˒z0 Hz2CkK+w }ntRQ(XG8 sQB/M)L %۾e|Hݐ}Q2.C\9Mb,S|pg!ž]D֣@ ADJ%}G#UfbOt:2hetJ3N@1U,C绂4ԣӑw\SuېlؒF1" Vm#b/QHJQӂ"Б)K 6KM%\6\ǰ+\-wk;刉); fdlUꏼ/Dg)9#}{A+o"ZOTYڱVJ bw)Gۼ8.tEǚ>•.BTɅCKB#mR}Yֶ&28pUk{QL_tS$>۸h;Kvwbl6ѡ(R"ZSey76&ڃp92Bex=a߉0 y?ֹvs2c烙hXNAYy4ʂ?ɓ{Q0X7ja aUpKt J <O{C[/ 5N 1z#MO!#BF5gI7gfI{aiC3 .ttGl͗p4T7zBXi9n&BȩU}û%  n[Rn!G9 pDVE5Mz@\ɻO|){-__RGR >qwC;ˣ[^ZƮxy/+/OxmEIYU^m~o߿:07?(KyMأ'pԙL O*Rwz_^y]=*@?>dm$NE_}* Ԟ=3!48d[^\x߻̉ CNs$uA S0&+{YW/p<8 3UE>PRpkB4%Qr /-=|e)Rn'2<}咒D0UEV>+Ӓ&4#AaȧR7>Q (8*#<%ZL;C ݑ9 B ;X!LX- 9i_}(OZlMⵠ1Q{p:OpRJ)L1 PLO[(dӄjrFh~h!7A@ A Iv#ul} b(4E RuqTDU$9 ԕ-ins8F#K<JW8PG-1.߃Y[' Nd4RME[ϩ]RThhU"JD"CRPul7݈R2}z=^x9@ NFX34s2GʜX uz.]?薯Y92y4bw)V$U: t)#A<׋>#-bͳP謟B *愐*"O. 1P^#N ƫsP:xyu7`2 ~g#O>{G>4M _iyv ȇywy;fcmدɔ'y'~E]O' vۢ:| }~|W9觞Is拊Wo-_TMʁkv]/unQ!vcMD[ f\\AL~q߫ssy-n̠ 49dj : OK5.n9.HED~4[~K|0(4'Bu:*NTx i|dVU1bn_9sn O݈aS*t=swp~~Wx{#M'5#2ԑ 6pE+ִm0vm"lñ. (8w% ȾC־6czx?(n ؕ)hyn1< ]J'2V|[wp* s<#15eoey8H=dR(1h$nkt}b>" +-y]=n!ǂ#==@Cp]X:w#r2;B.PFʥ 1;(`l@p@M0,}twJΘ98ǣPĈ`'s1-z9Jb>{e:D,}K?')~I|Q+8{j>|Cg?#۸>?k;|Ξ_W~7[{/gNn5OW`'zyK:, iH'4S 5 efU 7B=y*.|M>.lwp6cϱ~mG.lO8uڲf#RG&9˼ Q.׷"7i""5xv'bp)͢arQ-I&g8agOX,R OI3p)r!&BTŔ}FeYT)M!F~v #X+C1%@f jow:*'0]@ =ڎҶmH 1vS&@l"\(yƹd{zc <-YI0H &70Ƨstuϵ#ە/oRfΞ.7l?(Wc+dYA=Qb@G#0wm\`O|cWxU.u8֥fMy6+~11^'7ĦfuX)A2 N T3674%*dlm[n앨S6*(+*uF$geuD"W 6?游F$5՚Wa>J{!#I6!{:&bG'p2KCqL:)9ˀBs|y|!Ҩ$f9:,)cCŷU$~ꊊA"I\:'h#M)5d~9(!]>A8&thFHvR!%ڒ]$].ְ@BKjV;pT hE C?J"z6Gٌ *dhl0|5S=݋/eԄ"< Upn"bmI0MR*6c5lTvWubg T(X,rl "=jBWZS(lH!(Y*|f>K$\b7ڧkRQw\܈F "Up̙SfwŖ9N7j ,7=2pxєe# b<ގPAId+&]g\zJ'3@L4ڢu"Ƥ1(cthy:CL "AɁ>NWm6ĀrAk^/xٟ=g?s~ß2 |k_7kz_{>m:|}G%_w~䟳}K!O(_{S|wk;S)bh_t/:zzgY$#}+hn,hJ蟅j#!;4kCƐOvKW=lj[?/e^(9~qخSb`aLxQ T>boVqixjaR`$‰2NcTɵw]ak&-'\{8sZ :#DW ѫuJu+Sӛ-y2Kf5 [;E {DMPBC|^ZsWٻyEH p&g o2U0*KLt5(/dτ PWZi#e]aA:' NvYQ'^$U=gV}& 9mMj7^YZ16r(:ZDh9AC,2F+=㊱K)pk19vrtǥ٘]RGi_C%Q;di1 "wf|^x()IÊ h#<a!TFk+ MCӹi2EO&dG9F+.*pSNn2 0k4;&=7蕞nldwq4|=#OTT<8EњHTTDnqG(VTIGݚ .'Q#HP [T nbfj !/8Fw> ["f&"^J AnwqdMAAYe<ݛT=MDlP\ UQLi?G*%=GO (#N+7*Bego Ank 0!'QnHL|K/Yg?8z+Iu6^*~vMk?O⋾ʈ?Wyc }O_;/\ɿS^_K DŰȘtvw#vnx֋jR4@$v+԰`wWɒcdNlG]E=Gxr֕Ԁ>J4CDcrJ[_ὗoj_+Ƴ9zBo3ϭ嬯sFu lFv+Haa}Ο춮szaq\ɏU|?mҘW rZ"j1<^(!N)JcXbKIl:yBG`lpNV®k%UM{ӭ~InOB9DpӠ@='g,;gF;Cq] {>#382P8}21E.Ol}ص^}MSTkE m3X tXEJhdB "6uXr%3dVVٻ"DAG Jœ^iuX]ckVڏyZSjRKH7e\4+W;׸>3\l"rH\|$:EEATBHCq=n_u<8+S6MDv`-uA yOQ2L XQaV b֧ =c>ve_CQZbfay>NȤBٚ}`z]pί~M cRmD .$%*% >a#LFG%x oH]B7!@kvL U?vA , r"z>N;٢UJQާP@zQeh]vT:PWDթAnJTyBv )Jc!1Mtt_G4Qp@nE>!' ?QA=62C\U׈D iAN|!nߍf>zx@CK݁e@XdC7yfKSM[/.b$>UȤI7]݋i1tY̥}tFD*-!"IoxDsVw PzЍTt>(s="\ΊwTyNj>co<BQ41_ET(a%)'D) D;[kQ]]`ZQ$Mf(݁A?S"Hnvtaڣ|2=/4 ۟zʟ:5I];G }.]ΏO/lΠ?|>2ိc Adz]?OxۿOK'7zG| ;sbΝʗυ3[bsy__j/P:ф뜍$BoTdڂ 1(J6W s! `IvKn{fe<X޶P5I."XB6sMba#A2RE̫19W( YqdlkVNpbeZceع8Lq-ͯ+w'ĵe f\dsג0{ha"V{_ෟEE ); s ps/xY*͹q <\فyBpK0\t"&1䲱 lٚQYc83(z{݂omrG0XKVhbL4\ 2lrJd9YTղ>lkk'_" ̝, ~ΜIZ{n,_$(;u|QJ+DR#r 6jz6W\c4 BQ`wKS@EеgZiYYipb}RtJUI UYpmkgqc).j֐2<]=zQW^HM=SSĖ8zLF: 1ӫ89.]|p2`8ᴮ)$$0 Ƽp4 )W*NgwKd@r>B[ P*K6ۮN"IɓAI*DqǏ#p~qٿ<# ^7fj'%{fή6XClpHjN*&7iPsA,BCmi0v@ Hm5dP&3j_,Gt 95( U) h,  FH.(mGjQb$u?L}CQq'չLG󻣮\**. u~P xX 1UKo ,e?/C!nN=09p)$R>`SLW>[E.>zߧZn9Mf#=jm mKp5>zĴhvM@3u )vb%&oQ4~c*.t%=ߒ*[ӢlWiT+ݹUrHIMJbpZu!J'1ѮA1 SC"6w_oyilү >;|ϛ~S1?˽w\;R53|71>~O obgor翞O<4?o~g_9ؿz~IV൯u|)Μv?t_m4{N);YoMK:ZE~JbND$dU)wѨ1B Iݙg;CMOGV X&ק9Ln>HߘpJq"/AgsXƢ@tJfABfήhNټ[&VA.=jPR=_ =5|65>LM8 )MKZ%4jIhDN4C(g nXZf"xL AbyӴסGQxkD3|jÊ^E<nS4u{V1:"VLcB)EiZu͏ŞGS`[ڳhS B)6ʌFd>ȢZ0'%E U,LUXؚN9urH;1;GSb& V{+s]u'S<Ԕ1 xVELV)JcY N1#ېѲhk}ؙvf(2 6LVj#+}/SBYzbVRm5^aւp  o(JCP6CE#xZyo ^gT+ *f;k@{JD"_`<]$sF `cL70A(%)H[C1nV𨃔>7z=HovMCWORΞ=P 1<~'=DUۈZ4Wf&%I:Q$hiAQ]fUl}RqC(PDDiDy1>C.A^3nƄ6=T B~2_:GƖDq1P!:*MUItaT2j0yPX$ TQ,84KϠuzhAF`#G|c\됣>P7&H9IA<:+PR3w﹓噋Y /_yu9x%Wol?}y4-\Gr>  ݴ"tA'OoഠM4!-:}kDY oB$$܃ }1&ý,=7`0 (Tml+5lbY=Z۟2rȨKu,S}N6OS*!#̀߄+ch%LwqO0ܘ^#Wa'7[a{q!d"AUww!Hд`E$ p& 1f5Uıgg֡fEie=LSkQByذ͆% Tw d$V ɲj`92J:B0h ]/{(]PÚ=gW)O߿/֬(#}&A5 +-*oXa_G`+ZE$ZIaQ a`ԧ4Uh5Vi6R5%B\%]:RpV ..E&4~-ږ6zjɔBdrUiV@~χOd[ZǶ-h[8K٬TM 87X>pM'rZ[P:Lj9msac]q=p߽"KŠ+ry[3]4VQiEF[>(XM0ӈXL=VicA 3Z,0mLNR<~q:Z*&ђIgM&0h7A 1ôb EWD[hWGyǹ9#TP/+WFEEQ6b׵]w"l҉ቖDك5"զT-\|W~I{gn?/'_?n?`{uk8gW׿{efG?4?oU=_? Wx;Z_<77vv?9_x:W|w| _e_nDcB~}q;[w !싒/Qjq{sK Vϧ,]&ȢM ƦqBk!20|gloߦz$UMiZCIJ7T-*pzZcTpԾInk{i0\?A3~+2<1 }rGo'=Yyf'wr`z6bjVi$pAٓ:AYfU Bp5pʦ@G堝@֞ Vn4U3BƈSTjKv,BC=Za sWS%J;ѓ![2i]N.WZ%~3E1Gqw ) dE5xXݷN>>~=?d{dEO/(.vN"8&Q'LB!V(sP -JuI˱Il@ǘZ}';4و%NV OS)W 8Dѝ]H%ў$槒JSFbz)ԡ5Yy5Fga Нmx>@NeG $|@^RPf(ڣAe nPd`!oH[BĈPmlo٦eڎ>>Ҹ͑soͭ 2QdZ"DeSD^O:"[nM?%Gpֵ|Qʒ#;Rm,[Ba|Tz-U2"QmK5MR s ||R8>Z>.^^eKt Z*MvuS.mTI2y9ȒӠ)isR"6ɚUDc1CF|4/M Hg&d9y ΎR{IUMVCBu͍]>&,#"!Oޫyw0/pާA"| =R7!._qe-> >6VwFN%yEG)=ʥm˩ ~CWh 2a0uST}C#i4CN^BR)Ŵ8;W4" ^|7|oAI9Cӵyס6sLfBi\1E gHѴ-DQ i6 Y .஍]._mي=7Q8*ԼMak+@xT}V_`RHloӍK<[ ;-T>8}γqBX *FJs 6 lbco |K>,b*o[^̰^{iBS '.SWspi'pqV>z],>![?ERXd[QO](٤bhrw躘`h:DY6,|ǔ;2Yd1Oԯ4ikLb3i_I(]E WgZamˉyOCr}l(lIn '+ 5e מgshY_/SLaӾDZZJ`8,/(kQSW*RS3ϥNwHTd(rC1ʨ3Ѫa (lD˘.0ƐIH)襡GN?rW~b̽qT]kN8R e湻\/WⅹeC9VxrclᎻaTFVք|( m1أ*^t. aЃj8a5{aE7f JJ q>,J eT ,kf.L%˩f{z @]u7ZJR(ԨX'h4Ub=s0yH1LW/:IPVBmkK~ ;-z^>ËP/_h:=KVR7k;S"tLdMR%@̓$ 'M*bO!7{ (ШXL/DۏfP%axT݉-@Kp.SR}j<۩0HtJuN b}C՘DV0e+.RDS;b$D^6F9O̳NݭE/?k#jxa$zz1>ͱ,>7P1IާvQ`LʐMkyf{Bu9+|`OCSTx Jp̵h\Nkb{A 7Xԑr-zk(K?UP Fuքu#F,Zk>d >RzF%d/j'Z>к@r.\A]yqdAaa>oq.PHFTTlb5:A5p"%:`?&}KQZ2VD(L32Oh^?w~c6Dc51lQCJWƱ-DNYB{w12fEKl[ A-"Bi4&/Quf ո_0 qKOE^z^x-}|hu 1ޱ=!8F;(M19d#C1XP'q6XWą+0m-eG}ʒEb yE>3( sBbOn8&O2f,2[ʗHo v3[t@;$DmB3)&*rƘGm="e-:Hh*Ѯܼ2*bҺ'@^x{VB4^`-3~$<΍{ 5vi(<5,(ѬADh #Bx:*\TXÑew:\ %S hڊQrT | 󗸼ee&5Mpzhq.=` X/b'Ōf>wwcXk;mW@DAae ,, 'ڽ_eQUt0ݙdm A·.~Niʠ vf 1+'3$F\dm8H .~ޣ*ߌ+t%dC"q YGBMC|rrk໴pEN d( " sͅ>ߺ\8))v<mFxp~#qo@) {)(!#8}')?[x&HB7P9Ӊ#AŀctXt.( pPklDwKi6 пUA8r1Pu+ΑbgF \&vr`5~C4<R$KNWJ=4YG1y픃"/ڍ aJJM.ze'- )O"J Y ZlN>N֟ď 񁶗q6QB$xG7'3B?VIRXL A G՞VBn0ԎPؤ9=ޘt~d̡#%zKb vkU͑n!GEwM7LZAKcȵJ͸ |};?T 9Z>ǻv-[ #Zh̑s߀!_jq Yc@t6$&Û?]=blaİ Zzc&3z2 YN0# ѱ&x@\XnF(Nw:&kJ 1#"i]zf [1ޡM _Ybhm1$vQй^2DDT}PJΐrxe!o:/}3?›->t?o۾kxOx7}_ًye #Oˁ|>ӯK?ӯ'?5|iA}z>O?xa`Ќ]ĉňsu41R8e3UI*J(W߹^<||7cc>MW"Ng$8k$}ZN4 8&ln XMq,=lQSjjA!S"આ8|qmdoZ3 A &mMSUJ\fbŧʴ ,Zt¬*UkTX-5ͯ|8o |pQsPNǹٙJ'ʒ O[4]5;|#L+zZfCy4!Ӛ%X$Az,KBhhk ".E.PErĪB`12 40S &s0^ȕO4(-E$70sתW߳m,9@Ӵ }x+!g#<ÔSA83y(Nh')P8E1*X)s< V +S)z~Na5$T`542XS -&>{y?Q-ZƳ1sE9O( *K $T|K~a-/Xܚrݕ::,Mi҅ *kt3|>DstLmS"ʤF@&8:lIOʓA7 Zr݋ -F<h'lH1LBhR(DLf)5Pp}̬AמRҮ]ը hzWǸAгdBƈ51hK D T-2G6cH`1gA[oH\ț#oFל6ߺJxDFp;-n?'/N>ɧRG[!dӔ}@ HXwǜG em:lK-"tCo(" c4uTU3~,m|H1)20GKmAE!5h@hքu? 霨>H4kPl`ʤ1%B@ΐ(UB\ʺ ݵ tRC|yYf79{W/{?ٛL^Z[x3\g}ًoo柿7}7o};yt3/s~bl|&$@9wm8/?u9FZQf^(5B준$RgrFyFf=}8j9f/>)W ԑi+8}=xYrpʂ,έKXkLQIʧ\kxxbp\3!.j*0J64kUdJa\;V/>x0+.p|v +l?VoNsg~w?k\F3y2N".DZ-‰ X[:zɒJJ⾊N(5ŢbV9Ѡ7i6}THܽKݠ Rhǟ4:mv:jO_;04y.Wm5Vscw1v(QEnۢM .ԕLǐG/N>q q9*p#ZTdAֻٌuFH\^ \.aYXp'׹<<53aW邰Yj*Oӂo#Ũбf7w sF122ԕOc𿀭⸆oWPq39Oc$ūĖoRmVf tfSoE6G_2KyG*G( "f XΝXky4LCJhʰR,|hH;4{+aI۹n\]F%y͙A&V‚ݪɧ.rgST^0L$Šft~**LOM9olG8پp۽Q_–h-; g(8wNHl.;#l SOGWD>,}ǭ٣ G`ˎρ;tS4$Y+BpK@xbkdŏI[ Zb(fY WA1f\6|%Iꫴ`l ^{j\#h4)W@D-: 3'Lcv+bn+%5o@J9iv\c1QЭǴލ ׿qd6q3C0{'70ZM.bLdjйqI-i"(NB咲B/yDěL7 ْ+A.QQPlP;ٷC'WMGMuy9><{2{!jT_k+#^SwqFNQֿ'f*/Jӊ;V{22+j E2n`LWC.ILWB,nrl Z1*M4yDU$#a}PecDgc)I\TsN.(2 T"^؉?A0", m(X]]@ra ^٢ Ť E# g6klONӊY.&RjŬ5L'3=Of6. Cʲ7 ܳs- d=$LkG9}k=rqIްÝQDy"^D]I:%:r ` LakՄœ< gct Mbl;91(d-fW2T™a^XH2 J5R͓A(1Ei!,⻞{ SL[CM7bALC|bj{bscN  OD9TO_;J(>t|n~⾆bG3 ?gFUqhNKD&y/$!!xD|#1{>$롔FOAI LуUbGƻ*tPEXIݑE+=h@R`* 1%{ȤƔvs;9BOqu !yf-= @!+%f`-n,'V31 X'ߞ{w:.2t;A:, $f+:Ӥ@j,0F.\l{*M ;dY5&FXm$BGsziz!fJQ,M '\ƭt/^u Y99$˼:hBjLt;g9s!.M'9ƠRD/ѝuTOܹJԖmdUږ:lGX/:*:d=ɠȉ! ):!EV.[=h`Nm7'JADLg)#$"oG Bok} [|Boyb#N``jG}T-dV0Zqr4@W F6U!2"2!4~$bK&!@));b~wjuà׃^(n?3B$D/D]Y8=O[3)a Hlz؃fxBR)/B*b(SU&Γ &w,ͷiR1v߃|ŗ=cnx l0*v'7 >6lTr:KL@Gk*FG0H$TDLsI]X@#GKVB-7vvJ] `hbh㟂;P->IhA!3`VAnz0vȚ1֑an[FX* cBIzhҍh.0,K*5F4gd7 ̀2x^t*Dހt^eo-]JUsh Y1tFRdBD)\e0#՜E0-=^`t_!Xq{PjOࣿ$.ܑ g AGgN+L Wn\g`ME'VpvS$d?&I+fu&z[~*RT(LA3w Աec#_ڒ_acP5,,oؘEຯA;C+`W2J.W]ܱ|náQZrTC [bESDm 2lJ%U юe8=T$.'1!"22:emJAhq=e& 5u,yĖc.D,ѝ@!< JX&\w/ o&kj*A,W0W("amـ(k[飲 B-F̉M'NЬ0"sKȓnN%ӀHZzĀlRc-hT}cܭҞ'5,m2X-7NotB*1'ӆXCpFwyXyDzwOmZv E'M0MN-+C&{;Tu_$( ̚Vb>q?'fa1&UCc1ܼ?G82q<1oC±S!]6d~r 1G(ioNh:^N?÷븯k}b'ݼ0ϿqYi&, &nqv4b()j:t1CⶳhCˢmhS VVWҊ2pa^ywKep Zy )š{쑫9=Ȭq.=1\ ,לSdznNu+pnۋAߒ 4tI*-yb`x瓧y-g#+E YqDy|{|'3xMh@Uu6M>ߍM:m}7FN`#ƔN,/ 4yk7X5 hBU*ݔ&!y_'O񺃫`6&A 5JB5@Ա7NLKa&N<[1i6aeaF3BcR5BLc`]GEƥQfIb K_edP M4-jb'lsBZَRw0t:,K\Pbw:=FȦT5c'4Ly02 i -&5h<*S9vbr|K_9?j"n>ἅ6e|RRi4IBpLC8xn!y*MNuW=$tKntNX: ¤!*CH u׉HcӱI̓^Ԍq\QP~Nq&RKw^Ff(LۮE$L"d "dȱP:!⣴RW>UYެK;MOHBY",PP{T >W"ydUh=ō)~GGUlBS^F b5Z5((w nq ~G%1{9QWnlVpk+h z+RCUC12 l$&C 41,iBD(@|i`81,&FS&xMq!M[v#]}sCa3-뇲8^<38P}02'5 EɌ'wjbgR7%?EK$ˈ{<^@pgVi7D #5z+]ص]Ӹ|%>ЫpDX&d*BM:brZ-`ܠg] {2[T]K-S?8~q~g~M_bQO]ҥKl8 sy>*3L跐"7<'%tiUM6[lmE*VksN 2za}3z7ch(:MEcrҬuP55>:V6GF+ój Ymz%E4Dpfn(`NL1my:p?o8+jmb_H X(OmtTsH% Ht$dOS$S!ܰ?Qh-:$+]Z%׌Z`LF1 1g6lM6~iIk(O!F<= mSEFWMCaiՎZзp[u ZS͠g)akֲplGXTshŚL+.#7gHJX7-usYk b ' hT8 1O5XY^OQ aО\+`ux{VG\^v!T`"zt7L@`StW2X\hۆAGOj{ca,g^;sg63ܩ(RRD"6 r(2D 70UXrBdNb;QfDr8w^k=_^;HGR$pp}:Y~^}ǔ؞P/C.0v<"ĉ_Ƕogȋ7# s?' k|X[QQ^)eSMDdS1kv`LAiz7 %MyJ C bi+jyXy5GPG,^>l$I,2#,E0+f^he(ڊxQ,Iri,S0\hHb,mp]K>l4 Ӎ3Lb Yl)#MBѢa}-{̘49X\FE0= 7$g#0 -q4s32SS*zꇸ)Z˔|7 mT考wW~m⸅~II0v#>q8\ yĨP7•oU޿!ߦ0YOBʰ+P"D浣ʅɷ΍9#>h=2$,7C]# nj.,(N&ֈ_"ijyᴀ#p2Hy-Y,`k@PT#$v2 M=.f`u%`ՐA| !J12%H?/-?'_g??ɛOė'_L"3~K߶Z$xa${sZilmֹgQu'Ŝy0k*ʓek`h ȽGjW?w=Sp1e\t~X:(Ep@jm NCj=r} v޲<:].q" ̃q8U]VgcslxtC߰|\ p_>ý5`Qku $,}R Uy8 ePǷ >x5[m\$Ɉ6ci9(2$㊌vI؜o[y V}T;lˌ,*\lT15垇*FBʨ^,+.Wz"P3toSč=s[XK76)M Yp#ݥn,M0NߏV9(NpG`9rZpՓ&LUR)\ۧ{ɱ lraLƑ#ݨ8O`()G JF& 1HziLãG<]K ?q Ų<ԕec6lbĈA]l>>5]EV7{ ͈wXߝ ?Nٖ-1-ƑzoGg,Ã#l]!ΑΟkV->&Oz50բ[tд ח~=? ~i?{cÐ\1ѭN㆘teK1i`Z=nՁXzW:b~Ѐ3 d^7:zNj=^qԃxws$Mс-9Ǟ~ YЭvTE%cb)[?I"w&BĘɮn$a~a;=Q,P%7ddN[~U霞w9a 4m"t@VB/_߰=}x@~&/_yO/yǼ{S?%1/<<%̿Ͼ+??k~'5Kw؏ƫpx{6GV1se6O>Cwyʐ+cyWX" Mk#xyϰ+<_ Gtʩ; ]^-#/d\AWTB4f=)WtHm[ݘN$ q]}NwC3G ss=˭a6tKH"ޚ{|uG_r\xv)~{{U7堅n02jL3&~ yBƎ8}fa$*sՉg+ Q4z>5ӋQ Cg&ppĥm5B{o}j#p)v2kP`6l:suʚq.So'[ڸ:`aA[#)SD gӭ]J'p`>99[BĎ+GmŘF+U:#h[%B)m= -U^rAUb >[!RGı+bvGϷA Ͷy 7Jm~Q^;^i ,ʔ)f6FPp󳎷qkG~ο>xbo#cb4{%󓟃*%dЉdi1k\d\Ka-ϫG 6XSaL)\J+2 8 qÇ@Fp*i`$!WUnod$%zl#⍎EF[kk*MažDve{B vl-wS\)2#b uxW+jYjcُ*5ۢߴDͶŢ]o^dEhVŹa-M In; jr0֐klے (Feyd㑤gf < ່GLIH]=i`.qc S &-jP-x158dKr d oXLյ3oqRڱp#aٶ|&xNNy['?kzGo, '{,}Dk'@r>e!X_iW|D#W.MD1/Pwc+̢&rrrcJq+sWIn;RagՔcm A"=6iq[~u{ gȝU"VG1+2YStrs!f vpJpȸW@Ҥr+׵8I @0_x@DaSi8{n>.Z~6!ҿmsoۏo'~ur\|対Fh?9?rtI][86[V1!B뚦K=a3FV='Ϟr36l4gH, BOj>~ꔯ,{X9,[;ܯ OLpyqID]Q(Jκbg8'nİ $wqgY砮Y]^M?Pt0I>dcYr_*pW~ϽEp-qTNWm8_ WkMt܋Pgʸ -=$GqZALtżࢣ`)cm TEީS.{p:(d3J#gWk޸{~B tYRYu(v[2slL7j T[ 57Q)/F! eD,0Xb)*YzhɷN&?΀F6U8f-y>}>@8]QYĽYGKqzfl t:-bl:cس9f̧ǻӖr]w XEX%Q%USχO>H|'|_MАƎq䇜OȂ+n=&bL3m<^ߦ7ݖxȎj?Iӿ˘xŊi0~-0e5V0ky `qS4)*5&EL0FQ6Oyׯ;e"!Xu(lʞG!&6MǴsguq`jk~F4vYx`ZאsÌ#CI /K-&G,Mͣe3)cJ3!%R8 À/\꿫v{@EE!-[*)Z~:F z(Fs6puYCSQjء'Twc"3M\mS.w!_J6EsoeWX+s B @0aw?yW-$Y["4&7fY22x@2^ Qחs)66%rD A~CMŦ:^ y0c\MK8""gzKױiur[c+GVA(@>FĂup-b=vDe&;nE|f8l*˲&/|a>a:2x%#fqS!cd% ~$?6o@ ;O_=i⪰|p'&ܷ_AKxs2jL&R Ld Y섶 Af{P" S&8wbf @$,߄7A^5[Ѣ#Ʌb-)g'poY8jY6X24ib giFӡLĥA z0dQDRق\yY4 OO8ƛb74mBCjYoXEN8I iaHLH 3dqƐs&6Ea>1489'yR{ze6I߷kL n*(¸TaLpw`ՏY>bi%sWx)| !CiKLك{Wɺ|PacΐCxBB'cL[8Wya&+ C(6ҀV MdYLyMp3?/vo+EK*z1l1n Z$Fgir&le^48C"%Q7fn1u ht{wap7wNE?)x׾(ڨ?:pR`ԅvB:TĐ \E 2i0@ʅj{|z8=bE+8xkģއI g+=mо#lv.G<.FӶq0cخm{JQ+w05gӅvYeI)A qXkS#\\^^^M4[m&\pQ_q0Sr1zj>}yU;\N&zS&,]bP K3CNe6jhSbث.Eb(p6hj>*۩dC):]w yw2Ln'W+r. c{G5vw-1 X2ԆYmy'y,,s!|wwٿ.=yL=7.g:1L0`6 `X6B]7xw}eG897ԷE;7hB530Zd6@ kO}~o{o#nղK>"˟\}SJӶdvd+ݒwsT(nPnB mP!6O~S:0qM&[5d_cmB&=vbe9PPc_ h(05/,zr8Zw5To,BP,Yv́1%6-]g $$"{VFXXؕ@,Ǭ~L6z(Bm~+sX[+JSHGI q"[Lj.&EZbKW y1SY(0ܟS%g'ɚR/E^Hb%-*E7Pb'Hh%  )4m^cU>Ǻ+-D_98>{bŎPK\2$RL_&Jvxo,ؘMLLk|wKJ#R d@0ؔorB^mB+L ry<$*2Y% ReL(xc ^`Όzq@ng4B B@Fû,ꩩL-_b%PvBS 0_eH)3|[)"S{ތRylL>6$B׺vkZZ3+dzO"_Ar54+{JeRNpw.2nٰd;ĘGMCY'lpưui ]bXe%1GpT$}kX ; QɘuX;졶Ր%0Ҁ^1m0̽e _?M|yb̽#+V5|//#Cgi,wI-;83ڬD1,| H .`GQM4&wq*//arŞ6X"y_ݟ2t[6Ϲ< BCM iאo7 iT`jO4 e<ǖ$NԘ-=dqX[pdn @p*V(n ږ&M7ɍߗ1pn Ŭ_U| g3 zf&rpX`ɘ^Q0 cV]se!"•5GDw@^i@ SJsWdkU "2aI7ulFn~7 2$1Q_Zr/Zƣa70;е z^j^5Cݞtضc'xBRAFJ”#k赮z aܰX}kClݲF6QFUF\Ci>G;>elo>y̔'3/bu@uݸ)j d$)7X$f&81)%^VF^6o1/g," /rSބFM b,UTǑvdXi9~\nDBh!k>+!hRdĤG{VlKH䶙늸c)* ؅IGύD2 `SJFGri+9BV 3r\ԭݍS*-~?Dw.ӭȧ蒇U2m/t^^;/ e=wo1k)yXX]UdB8L!#@'S*ᵓ=v\27Ԩn4Qrz18aS6NEbh`D1-5pQNs7MC&g>vWW\mQ3m)9Sб=?!.K#XbY/dU^d˭M^XmI"t[Z*`B1NYQVD5Ҟ`u0ǒqC"U2}َ S9Vi6XRv0#l~`= K䃆8 "4s]Y]aD,aͩiJ&R/^W⊢t]83HڳۄO(UKƳGֻ. i()m#e񽔔pg_N;?v+8^d\72^%KFr`TYx͗*bSR Sh^~X~홽1—/mNUσ\Pa>]lu{r }0aN(9Y?TV{%~ o1f xHW \`aI^Kr%T&xIlȥ7{1UV!3uRˢ͹\{fNC=`} #7d.c% n-ӑT*7;c~/~qϪ8.Hr*Ga3񡰬uqM\)UͼcŐ=$X~iRz ೯2x-N4% 8f>s4q`. \@7 c.ĔzQPpόPn9qOnp3B:FsjIk+phupH }r5 |枣9,B˙dJc,g/ wP ɵUO@ ~$>7AbUr[CNB8& (D} q7d;"lR+8 yiۃ-Qq.TSρw;sxtqt)qzqAΙ/{JuH(Ϥb4=JVD XFvmCz$KX(qڷ$Q C. F+jG?4| {Ce2}q6 ݾЍlW0kpVUfch C7;f9~H7fr)SѱMYXLZsr:b#aQ5l>nO /2;ݴa-ha*+{5"$U0 -&ۓKRrKeDJIV?D1`ȺI:uHƸ~FsPrx/ca% ≸1%0FwRpƵ8p!88dXpp.ԧX-Cֻ8v7qk͜> q9i dVOfr~фWS)f&36]`v|W/1U;.=Y,FNα*U~B_sjji=%pۑ(`v _YKa;JB3G f J?%$ stAuy57r{SHM@Lfmd?CKQ E"E8J\iz#d-(h$M/9̷p畢ub2:\NIuCv/m+djT>&2*jhzYr(X? |-Y3] }$w)S`=( vSRk\q ֺ 4g'% Z愱*e__SR i-[!J"!ــHa5f.'&kdžDp^?f460 5)fYf4uͺ=D3k dd=S~\002l#݀PuVbp;aKZg.j4r >AJBm ȕ֒ӈsy.^x0INiߜ3X1<C+z1$Aʐ.nRt[Pacbq+yFMAN&;[OfPa3S8;`!<_0:C#ft;Z/\:K c2+Ӎ.]hK@': 9^1YC5M*;7\"k!yMSzF~}ͅ$]c8qPӈa6ӭ 'ϖVجd*EmXg&w[g̉_T"YȰ Q8`BBB7>sHpWUܻ{w9}}E-P yׁUw.8tZxXK]7RAќA rADxit#/$T hC K L#S&$'&l۩XɄGF6Csa ,g֙نypYd'&.Zݝa6#n!`8{pxC}-;o~1gWG_U"/=NIt15mf4˩mBSZ0.U8< R8۬yDƷsRzHxVh` ~WP=e9)py~)8CA$Syƽq?tI8]eg2SEr9%JІtyPuC <1 1)PdOX1:\f5>>Bk=lv0zʂmr5sP[X-٦L}_qo άABbuld ڄH"JNI L Z{A fZU^% $9y95"m>RO[MK>`&.b֭n d3 !a0uLfG -B%1>w3$w5"na9MWxT !ț2`+z7p~3CMǮ* hvR^|m <Gh 2la0 5OΎ9/p_0o&/Jp|#oڎtұ&Ҥ| {]p8 sB+T!x xoi=4%17` NJ8k/Q~8M-q*ĵpc%Ob*k6TT#5kኻi&ĢhNe@vt59v_k+l5ű`4<09i}o3}K⨆sa3 +,z4&;u( 6hƳrzu3o,l<|Vco{чO1o7x'*֍,A<hǤ}"QFRb ö 9fUrf+8 Ry/7p|'ՆXŢUzR2lv)#Fo2AH uB wsمz pZ jpH$Gb/BU#93ҩiQJ(M߉W;Kd:08.H?_ywƞ-*{؏d:>h56W+> Xٲ"@Y9ơP(e`5Zhz*F=EׂʵJ! cToE%M7(u>i)6rPk6t*)CeP ؅Ӯ+J98O[!7e;3_haC4R NwXT`V s!{EVЭ G [L=ǎ&3v)KP *0޲tA t3L>鳧dn[H8ZJ\n' ~;g $hhg\yg8h)ۼE\0i 1ao5>z'))ة 4,~Js )̋<,G"q镹5SSĀ$4ةbN\`fP-q%19w̛@L <{d/H("RvdL/ yO(Ʊ[9>:?əA:?9!&0Ы|;O]%SH%2Q$DX5C"ɍ166LCvb)ZWpS#nļCd|[i7)Yc ʬ\0NnhNZԘAoR9ҝ*d8kZi\ ڠ>"k 6DYLNp.(xo2]dP-*qU#a09R\K15E2Ds:C36Z9R8d4OR B`]o"[S[.fE[8IXF:}GN! ]a-H_j@F ~jO5lcMNNmkfs4Mý%j0Q=_8'Sn FA;ǔ1v;b챫}rˆ$! o[b+Yq&e2ZWbMcn֔pHvڳ46&d*5!#N 8lF̘Αwk.8)5JkFvG?䷍䔖]SAe55$׊|13K"h *L[clG?al\>}??8wނ~]d5:2 1Qۊ;xbz2d &Lҩ)Х0a;lvRդ2N,0D0Ơƚcev,(0/!gPl/lXhYvDz?f S<^7-9fub,i0+(:5/fp-4u'0 {D J{r͌VJ ƒCwտۏ O.n|,@2I'XuَX88fpn˒NSNQ'/Sj3S&Tl\+dK(?&:rĕtS $y_c(AnpZaFlyc#O =!u5}F:2zC#[UޅzGӶXϞwaW1g5YCp^2qŽ;  ®#9FaL#br,0yq.$("fj 6XX4))8I2Z#)PRQ3|ԧ+lZ}r*0ܛ#f4f3h>vf)=E-0YRg.l9bRRBbN%F)OUOTԈ,LVk @MzӠD}Ow+60*[C0-z#_$KCGuYn"CՂ GX=[Rަ:[1aņ B6,B8V V;0K\#E0.F&08n"d;퉊=3Zݺ;qS#w}]^$;Dΐ +h^W"V).QqDM޳@,S^I:p7@F)m d yTWMWc F;i@~ۈ5>p!fBn>̃5 ic敹_ MCH W=pSAqFD.G(z}Xa xAr% +~[Ct0qpPw.,+[sçV|0dή2D mbju&L6N2hictl Ci)0}.A cWح`!9<9IV'Glaؓǖ$A‚7wXs6Tܚz>)3W?j0"XDEy" FC^ۦXyt{n|E{2m AV&8*qz~ͩ Q,PyKm'1YD"rjZR<#upudc %~Q{cI2wkt7h.خ4s$DqPMl{|&xΈQ/6IׅV *JJí4}.LO7eL=m0pJrI qX, ޮo_^(\mBZfp|ζڳp4/ӵ/362 !L~_p^NHV3*%C7}ֲ޻gi1+OGowT43ٹ;[@|sG\I/M]o-Ӷc*bb=u<Q1` XpNw*cLR7-M6&J>X9v¤7 (7śn  7ǚPX̩ }tIQ%|sbu)uʹMP †F@d,;9bym19ka*gCRYٌ!/膑#Wcai<.S1jM?qd< % `DJ+QG=o+DU*,i2 mJ֦%VbT^HW8946*Ť)3օT65@[4 &r6'6-O )aZJ рA R{<(N1$>ĩ,GL H Ƶ0Feʄ9f4d.)J0e@HY< pШ,)1ӷ0=U)i:4I^S#<ɾGK:TJpH$_Gˎ]`CmD$(gk$ڏ$;;敡j (F}1VX4 n^vjyO.=) ܒnzoӦTvJU-eP/FuDop~)ȼRv yfqDr uI"&Yb҈R IC{11èdN2eDer~DŽ/}qG'giO_afXrtEOh YT5RYKȘNmMaDk3 c-yk%ˑqy[_?xt`dtb wHgہY(7h,Vh,4])HUUSH,*P9v&Pp(*@,@J3egp4آ-3l |(zɄ~l4 Ar5D.:Ƃ4BQtHכh a|eҕ 8P )m- o3|vj^ RLf") &ĢxfTp{AH.k)aVy6H^$DF1AR2 ,gO6g}{}>q1tĽN[Z5`lŎvd 6 gBj>l qX?馳m[=@,<2(G#3Fy1Y1U4-.Ʀw}vibgf Zں5v7ǜ- Xǁz$.ݩ\CFpS+uXZc4M47zƂkq>eK hY4mcJPq6BTIA4ة!!)b E"Q"f=1Eϳ5?է)K#H`S-)r)SK><}0PgsrfCd,S*S:{IE i'@q{xR\ %j3(P 3Xl I<$ x? HG92,3+P .M WTe1cP^2F40/`6߀#.s q$gkBQ+zU-fk Bp=bjQaNCڐ'Um^׋e\ҕ~֋iCuF 2B0)a1ځ&t"*_9 dJMBq /~TK?zNr3 +.6x&Xb6EK\3Z,S S|P,y7s>GwsK5s|FRlWPö6 ց#/ΠmRLWIWdӈaV`CRY$Cs" $@.ج6#̘}V&u,%[hjLZQERxB\!e3UƸvH䇿9!ezS e!S;(ױA׻#xY,0 RM6[6L)6– ed;FC4JN'h~ߒu:QTRۣ[Y 7쓰P\wy!R# j YXhOnOv#Û_N.-roQƄ=$hK$3ꔈ"QG'Z 1 峡) bn Dé!Lhh}qA\`<g:K#y {EئWo^T ۮ#O/| ]&WZUܟ wsfмg<;xű]_x|!ndua!uSQ_pNEVXonxr6SK _+G6'2Oi5펯+*&y-xx~zw8Wi}M ݮʩ] Xhg={lΘ!gY-EO|6& QoccXgcj`XWal݇B͘0,}q͂aƕ4afGSEVU#PMrLo-^zEΨLӼ'c f015@´Fۦv4ɚʹq3L"m"(t(cynRnEN;edN7I:]T܀!AXBW !CL1e>n(;m@#uP ' &'Z[Sx.ωx8Ǽ5zB:vYx`Ό΄4Rg+Bk)#~]6t;%c˞,7L=Ɯ xq ȂZ1_Yd,|I,G~?wK7/k?2[m2~MWOXd#~\."d3atuAɛZXYyLlNڇ60naD{Vt#^k{_O?{ypV^EҴMk }W3c1tS KRF" 1f5OS8'Ě0wYéī/g+Xò94NTn{03;1x/DHMca_$O Fe^D;E]du1fc= 8>m5j ,L<'ȃ̛o8f(_xjcβͅmum[9J͚1A۰lq5֞m$CƲՔ/P! ׍tWw*O#MLEQ@k*$WfN~*Fu棏`x$ Ն؍=SꀓIEDQYjup0{Kk|SKvÖO-DžO4ְߏ8#o fAxzy|&vt3a{֖{sK I?BXW/C?;Wt[u,2kyLY oxǓ ׸ 7Ftf_Et94ھ`%=nZB] jZR),F{e5sx`sQY錆 PM%0Ig~.>|P\` Tsv}a?fxp50NsJ4[c,[:uiĔ!3]\ޮ8nkűg<}n1ñ:{U Łaiv;.$ȺI01&\0ةQ1OaNRg j6%AhI=(cjn8; qA+ ꃓJZs we2.#3%P"튴]:L(ιh@dc yUEQ DF!jfX-Pj4XnL#XoA";%U{\Lx1\D[Dr8R4p3/'}Ls>Z5x2q<De@TIyJhHk[VQ7VIʼn#wº[ _(QCٜZ;j&q iqDH8n6,6T0 Ufws~$SpIV"uєxP CB,ZH8)AW;ߒK# ߂ ^0)qV$lJSۉqe\ Y$ Y*gڀ/'__-Vn?x?GϼQ8:XS<?GM=W~k\&_o=7ۏ#>Z{/x_֞˝`s?pz9p6|}gAJIMD#5 \Xg+:eONeCiA-,j Bd|3}m'D_e[&~PB q|tUX²_h>|>:;N]&Ĥ/ vV$1/&;l) ={GN”>ºSyԁ[Õ)ᓰOyBtam8ymļӯ&7Ep2_WlF%8gSGMd38<϶b cԖʫL$;|!|ϧ,5mai,qHL)n䒨/#Gؤ PP5,,f=qTEA'zp`~8ኳRu4 4йmh'*%'Xa Q[259g*yp,)<-scĐ"Xp`<0`mVif|K"eGM>8Q7%c[}6<~-9nOϝY<'3famw=cr|o$ U5Ty%l;y3^o| O1o7 I2 hsk`joi|MMr0 {b^{buiX< T!_jR%!?hre]&csa07g5-5@5k 7^#sTrxwFg=뫁}^Fo>l86nb# RJbL[|p%SJ&$`nE(q"gF 9bZ1{y{l./CϺqz2 J!T\'3IOv$ixNԇ4QFcx$hȍfHɓ,,kNBBqw3%`iZؘt#%;Ҟ[.̏S\bZRXJ|dk(Ω_ i~%2Zq&WLjQ`7'caQFFX[[)6(qX=~<%c2=A8H6Q='`%LY"j )9':Ljj c~|~a/5~J]C h"F\)䒱rIk2b [sͳTBB&\mKRЍ fhPG4t[m"lc" D3 ), =ɓ㞾a oTT$uꜼ;y~O9jE c4%؊,{ǞIfo%Ꚑ2w6a \|^\q8i9G;^mƍ.Zɚ6 шHd yIޮU녎U焉%0\OxKjz)Y3y zr %3lCs Xgm+D%b??|cKj@~{i.??ݗGw]_|{o?|ߟ3?y? 6 o k?Kpw{=97NyWܛ9ZKw6kpIa쩌gF,\k'\l:"\pu #ˬϡL"%,T'Z G'u[km2@wka9$v$s1X$k{32բW! QKeJ(WF,NH!ANĂI]F}OM az4; pLZxi8<4kamL7zrj". WQ{ϹX,xrWYU9ԝu"ߖ-ۡaʖC%4KrҩV=,=c٬8\WgwnRu=Go}=8[@Mb yBΘ0RYıco:e: cfHb٠X aݏ6 魫`wsL^^ DgZf?F1 <<3Y8YX !fÀ5Y;a#soٛ4L L g ;srEmlY]hڱp|jtڎ6y9no/C^flg90O !ˬOjH5lٜ7;!ٚ{ÊE۰ZcA!Zqm峎Ersj܁w=ͧ9`>ٳ;3 o"?>9?E;/݆/%kq5Ja$k}AmUhDoTnUDv`Ǭ3c1n!y<.fBA׭X&9 ,A0vPxX8jU$ [IAĨ+T^dKM` ŢbWeZ9@U ^yʑ'-6J!%W-#I k&kNsd NS̍W97#=6}Nj/\+hș V5$ly}^'M`xtƸ \Rai*6CRK[.$|:'6RKWW9 NE&EL&19&vD[J' , k$)mf_ة'璂5C#\&旟Ǿ}|E&^|IWj^ܐ?'ԏ}^|Y[~|_,w|?{ȟG>;~&ǛFn /o]pmr֙u&w9G1b -SCU2$*Sd^(DŞL ˼͜p)l__`k^w;Eau{twx|~RR_OtjSBI:>oa5 1(%Y5|,w,T:;oɌѴ8kU2m&F9ӏPq,pN}8UznۦeXT[hJ*$w^ٶQzXu grWa:~ I%xOk c 3 =#(2L}EH0=8!P[ǐ3}. IgWyLN2dRopQV`Rstui>BPWB T7'0ٙR_87 fa&_XAq*O=PCsikMBߗE&#P?*&&9ZD]w@`n/2k,ޙO/:u+_>˛w^ ЦA/W&030qjg0#x" ? 9wJ8g^{gsT1R3ku4G|)` >JI`\d3 WbK`ez1@ʆ z8'bMO(B=%euH8cN?pAj[|dj_Cp[ؔ:/NQOF,Uo1"#C4ӂ41s~7MUEm-o< IlSݙY>WWx ]g}s;p#V9b#czC$O$8oi†%߫aY#/q^ 9uL5F!DH8 }G6q9Q"Y:l/3w%>ȱxtXk|roy#;q6+ ]gP,J\tp"Yԅ ujt 13ٙ;.co߆+3^? <\g. 1LY }YaA6m5D,!k^Aan0i~'+`DziU"7ꁻ{LAY9\.D)nf%P2$3{Q֝ᆃzj'<{nẇ~?0nS̪Z N`1pa1H9ņ^'O ,Kfk Z! & sԼZ8}p2k96 ns`j-UM"UNQwD$BRje@p"xk5U;)h6$B c[aLƞeࢇWa!tµyUg_(?ztdek&MLZ |]3q'%Y[S Q@n+ȭ ?*BMvᘵ<#>gGl5L&Svo O5x geѵlplgͷc,>pp,rg\s\SvQIf\qJ1O3䔩6aؤBl*i"/ 7GQӦdiU-;K,6-x>a' >`'SdI/XMmBw]IΡCR)NY"k py!M:Ϣے!DưAdnfW*qA04hQ]G3: d#b}29'JI~/>)5\M$'Sk&nq59͆_¦#WPEd^װ;ө-1H]CQDf ZHCAͺ$=p)o2 A5کa/3^RYMW;`F vf&;^0K4U" Az -.08|jlC2+\\jfI ((*8Ť&lǹ$vqY7nN"V0tĜa@8T>bs_1?nx渴ˀ$Xլ Nc6xɦ&}4!128s^|)ڦ%e%YM:iBJt]q|;2E~0[>%g3<{;;X? A-LSbn *"\Iyɘ6*fK $$cLRsnG+4MtCbDa:4 YO4&a ]KӊMA_xof$mswB#ݪ|3_H_ecKhq~|sh'n:0fRqKf6VN}2N-T(4g {a^$@gةhxgIL ' 8[8~7w23i`0¤oNp2 B–T3i-McPY!!%2}%hq k΃ag*vg0 *qN^$!+冶R-:rİ0"11k.Ք_0m*˨xh \ tO1j[)7>Uk`4Ƥ( `Z1js0)i<}Ͱ®s^'KQH㈌aI'3d83GA裰P14l%~"P{CNU7tBVWQ7;!0TU$ I1gjn@/[be7555;nlUQU59a1qҍ$QMF*ȎGx^w f*`rɇ}h ̕6q#LtRȯP[1\dz7yh#G{sg o~aJE[ %\`P{nLwfkw0X\ XO͸߉vhgpMx4bii>eseeJgdI  *Hll: v_էnpgi:)*OOz?zr9ŪߠPfn'ccGcwGy›||͏:3ģ8F% bH9z5Z[FʱLGg! lƤhH2Q=0F~a`1rX`X:Yc̤8(B!u$Zb$.%5ڑ+s͞ʶ!9VgwMTdH=x%w7, &sEMw ٧0ә SֆYߐ/0rf8'Fp ןCBL[c=`/=ɫ\ˊpjs mfwf6~Ssf)ƫ&;&5eTViP8*S\.R՗T+ i+=[ڼ[GUq.X[6ZVO<LzƦt_,s(͒l |E3b6RB"FqS6 GbN0CD4ҳ;8pfb#(ڤ3Bx mYfyx˕}b<)1;dVݘ[*gJۼaa<* ]Z9c]ĎȖTYnTM=T @bUm; ~75⊩V2EѿAyBƭ;^Um\Oښìq俆Yg:HÝӯo^)8͹qbLY2YňVV MAͶUlAz T2-8#A#8+'dpw7Fn`D;Un8ڊD&}ovu` {;/d5wҤa2H ,e(zU'BVI\~4 ˥z$d}. 311o[sfrtCWY~U{}uj4g:tuM lR&Jf,{o`R3PWl6h*8R75)x%J݌s|[5cL;­cT`R%)2!Ōc3 L~!b-8aܰB1f0*C];r_: հE^%h[^ m` ڥHUZu=zy7BbձJRd iׅ1\+G ny9Z grk! y퍞WCn Y""$P# #/Sipm/G-o\ s߸wg}biioڷ_q bw&rmǁ{93E=U랻k>VVc\I[Nio[R΂k`%&T<bs{TuC΂Ĉsj9y#hmKnckFdQyhYܶL U幞{zdcM*E |ͺ9Hqc!Gr!tb099Y&29܄Dkl.bV! a 8) `.q`:jcZädN̷T,6r@gndjVS(N6Zw\׏9]n(Foe$=l2lN\C ܛcKdyr8GN7>:}xBͶ))Yb)@ad%SesINsFWuUQ5M`@nwfu@'LQ8b0 Cؓ"l1:$ 琪@1놋 fF͒8RǤC/e>\L饑Jx cel=y!NX͸ *J(a.JɌv96=k _!1%A"VAS( G(fF6ۦ5cK_5ۍWq_gas8QlFCl>b3 SG[鈹u* AoD)m˕s Ub3aEA^p!<8xt #O 7Böar\MSOl0Քq8hC񟘂RX&P{kPhZ]{ڭej-荰a0+a0#xx .Y;D$C d%롧ĜVts_iQhV_E: ITJR2T.Zn颟(WUfL,Gv`&+Pϊ0Pnٟ|&J,#{Mx6<8*ZL)eBLT@IGZ FNSo P6w1_J8YO*~| IHLW-),6 5`I)&F1Pմ^opCN-Vrd)imr %1NrS159̦39׮]穧oҴ u]s>uP U]SUUZnE;i5#~ L |F5wq( Ty~E_f|@Usʳ67.vY9EbGJ#"N`TTI .nI$[kb4܃:LʨB .Cn#1?##1Ed)3LH>#!8Bب*4o~S-T(HU6'd}=W/&K:6c9RǐVHlS46,xȻOd "Z= gA#ROB(7T/[anmxf1GDze4M8P7vι?cwodR75>̬arMS9vj9z_Xrg` G;dt[BsU#s*OpMHUS@*4Ax0p29!jupU0gKv bɮ%يhjRB&'`^= DN~C9;`:ZbI#3TTPW E6vRg~dXSL6zG4wDkIf!yT0Pm ˆ'2ǘ뵖ӥ G&\7ִTC \lrOY\b˿^gyUvRfIܕbxI<|m{o8>Y!iPfE=MNTVO!aw=4}g&:hj+ SYRw`j`vCnF̍]?0L|<&yE׳60&fra_X,r1o:_VmAE(AEh)V?dˍ֭XuԣY!e) 4!wIUŝ!CW׾ >X\ <;Z&}3X;elaqyecJ6ҶÕ\3rӳ[Ͽv.M\AĶe_,ؕyڮKq>`*ct,܆Y}_YcQ Xq1Lۥn'rgfTU5Tbm!` 8O_g{\$Kx\!)Sl5 & [8uw4%&^q$!$0`+O%0{$wLE՟H 3wiԼFsr lZR}?l/RI-D,eXr.ҩ`[ DYt[ai}'ѭ'dxb%kq1\MZmɤ1a[k1l&$&H$%A2d H9b%RnCTI,#O]cv1P!(H +o2cN6 YWB\ B"&ZGPfLbScpDrT# cC mLk7 ,P+':aBF*pܫ&^7v5V*ܶI)ٌHEe~f8WFu(|G;cwW ~͟o\??Ǿm@><O&| ?_KڂKW- xٝy՝]B+=uP޷ ;0VBm ީ>A #Y.GgXR֩tfxz" |;;LrLE*ث_gÄ}qD[|Y6ad0qH/دjMGS%âK '96#{P.عe#Q1(v dì0qúw h$dL̆YUVT8q߫ z* 6tuتf5"E/esUgFC.V ή`v&fˣzU6$s}wa:w?K^+ˎ٫Dj01⛚Q,@֬ƑySi:+40IeFcu6;&NWuխPmr~f1c v4D 4]PtS$Ĥ}ÁwX4ƒuc٦cؙL\, ;{;X5+NV*w\_>䁗x f>ٚTg\ꎣ1iTˁB6v>}cߙìnf臚}5?y7p10iɄH0KBt6G)ӯypw}yM"ɗF'4F-<6[[t憪gئʵkO}s8D'hH$ۆWO%JF$ 6`&KۘƎ) ťC7c5G =L`rk᭙{:@UslXYcTc`"N+dFv${# %Z)^xRa,ހ2Ѵ L(֐J "儸d?C=5X +=f!V$MC&F_[IN@ IEJ5;ЩtMyrm=7;uW} qi;D XZI6Wy8b@u{Mìnv*HΉJ2ռۭt}"H &;"`ˆ15Y:ȣ"WMEwǨUlT7np̨L@$6aaխ!*g=KĤ֔>SU&wHH>dv!iYI`hɁ 9.IunG{o^H"Z|ƃB8k1)6`cITE#Vm݆iwzܥIଥJI1$k ZvqɂX[NAcx?A]Cm8V%U"NSBV1U0 ~Y2.ի_DQ~oO_1_U|ߟo_hq/s}†O@S^;7vθ{qVVcZ6Es#j:_ IFxKM |s` o`3~^SyWӫNkx <7bAc/MFl Lk9fXJD 1T{Z잇D`43$ΐo}#\40J 9Nhk8B+XeC X;zlsRI~Jbp! ScxǍg8[-sw_ށaoPT$Acwa+\?]8['^N .9͉MJ1QYKlLf\t#mSIС7:<r⻭ӉϰT<\n@&D;vnfs88XINUmR:m~5HJưjHr-1²#:6cdW4uM2,Xy^^&nD~UnF&$%VN[G+pjͫ8}ŵ=]O LCm:S^)`2gQ pDN{Xu]~woѿ,<439p3]%Rg9IZ,g~%V}1'ظVy?2#z4m12[sRy!');vwz~[V)&Jʒy=7pzq+o4Ų u[J:UTR6B3>&VC2*L1@+wz=[ٷzVIx1-i}R)qט#N:PKYVsH%N")TAB25LPb֭OF!J3IDblVc.I."#PYIJԌQo^jGE?h*0OWd$Sb1a@|Uмt2ϱ4*S\nlNwl_r5)XvMLq+iˊ+uI>/I)jR 4GbǬ cmIXV7j-"4S6"LWI1s0g\%bHS-:u+tёCGT)M!GJ;lj lm5,O9+x1Gt9N,BI x/ل<`8+9 q9@vv^n$pS<,G+&.'LZF34. ~ ׽ɉ09RJޓ3&rH,n 3Ht5c6硱nd6XͰѭw1X[<%H8sГ~Iay[o>d@[[mk0N4& I8[ qDLHm[u#?}<"Wp0+ۀ|)[6[IWj~~e񕚘-|Ǿ+~_v,? &~\6!/` \c/wd؁L]Ow`71WMLcΗҪcasN[Fq]B= +w_m=ȵ]%=}Mb. d܅GGβ7XoH4Fxz^ caZ.L*Tp ʵLM#!Q W3;^&p'bs!~iq[yvGm'UQaٳ kaVYv1F*^*Ն (`ax[Hf>)h}ְ|I7v|Wv@TZQП a<-wWx x)-JgaRb=}ko,si1Z/q>p8{n~+J>ozLC7Ͼkܳ,MsdXxo2suލ|n? 7/؝Zyfb Bq2`_֪9:Wv(θ)<$ʯJ[dx"SՅ .jGhej5lqM84PMˬɴb:iȣ8zq<8~ 7i0guܵ}2 dgr5|'!&$8ah S d9& ) 2}9Վ|C+7e'L]MI] FU^Və+}ϣ9~s<ѭ4|p*d)sii|bZ/z 8mˍWͦQk5Ul0F r*ʙGj#VFdl亁4"Iק>z!X\X$)gŘWR^ȣØe!KD#īNIɉEv"MFKXO'$bTvd-LrHۥ.6s'_ d(L`#DJ\oRץwĔ^cu]ؖlmzX[ ÇT7`ܮ{KDV%Z/ި$B*SXh ^ G ]9$HTCDD*Zrdts$W!v>S$=!^d6i9_m'^g6i{*k0'.p";뛚xAʺ'?ULk\Y06H dD”Gu(ᜡ8*c X$GLbCBQg O*S^n<8s<ވ&ryuX"dc#:U8#)Np:bX+/\CZK_mzHƤ\(DI˖$Z-88Ey"CN"1F;a\;黁oةj+?|fgPYjE5ohdV"NLن ?ɣtN)^5hvVoCdoaZaW# %tH$*|4r*[RzG_ٯxF}CzL_|⭚'OJ?rSu_7 5.r'& .f͵)'>o\*߲+Na Le#@BîjQ{,UǬX8@i+5w-pO3} d`x&$Zsj:jb!˞owPFKw3WV I@Mud *h$VY%QOv#uU }?ЧL4*)#1bc49[wyY7૚Um8ߌwA~m!6`Q;p$Wst4r_SG{b%,`%'O+Y2b&2FlOOuVPոX9DjZ穬06KNS]NrwG -sNk<"Tʯ4kR9ִMΜ}~vweﴸOY0V 1F 1qauAYA#q2ͥU@N-R^O)ViRL$UuULv cq yP-4BX`l a9æt#Nz\ rd`Z *  A[tC.-l,m m:䔬1:LHbtbm u dķH%Q$1ɁqqJY#Wyj~ky=,J/q%4ߵ*5™${P!ot"3LZzo5֔@64{\iV 9g nWyWP5]i3a@+g NI] dZ| 9]E6S$r1֓ B.zk 9%LL_b4O_&hפ}~RycؼJ[|0ܖm |eJJ@n59.38똈UyUkĦÆ"fý[l+2B[՘, Iz;hɺc"{r?Dz!Ia"4N?U6^|Y>]}'?b?%_WrnĽw=7|8|o }saGg B$7z2(ptY$}x6Za6ԍC/|V8>5?&:'bV&DZRKzʛ+&s6=0IT &K1LhdwpfЮ2i1`*ӏZWUoHƸDaG0>bR\gKGBʽШj|׭-$G*hjOXݳG4TeW] '.E{8cx@%x۞2}ku\砵Tz%}&QŚ !~0j}v p@puØ2xlFERBY w ?{[o:>_}W率Q{̍*X\uh OyVYDk,E\Ҏ.gg`y_ 41AMIX5Ȭ[z:zxNc9vs̸ĥTA_[m)Ek,ekٛϘf;s>pU3ph4#U8EBJ#o~ĸ`, ad }4N _bD"0dyS2Nx/[:Yg8*ɒ&#&c`&M֬*pi5I.# &w1k ct,INp"&@B\ɦyhmz%qhx{"cu!MI3Mr-BDa\Wt(TbF{tre&d |R8Mor4-%% RbN 7íW .u(;'3B^-XrkSKTsl0(@ɕڳ8nxuf:c޼dz/>ônvsJT*MAh+1y@5!lX|,Ԙ^!oڜhb S2#%t4gS_BòOP, UyĹ 9<d)@{ M bITl0)xTvz:1#9`%i`6z^zeN=s%0R0$`1Г)ׯQ_\b8I8 #m@F6'$vhc/ldO͜:{d^Jn6c";py;]Fb/ !I[5Jy3No"nJNï|5}˗4O6?|ļ6+}|}+"ǿ;u[ɸpg)A/% 3萩rIDp37{GT{?q* cL#AUsn,y*gib‡9'  W:}9Li}C2,FmVJ0JimhL 1:a/aS5DK+֛@ó{3N..X4CUh'jf5"U֜-zl] V7S> rmg^/YƞzW߁&r Xo8`OsʡY37ߑ &y#9Qfx2C3:V1Qy#QʠFTbkJcI!y&]K٨cgWCsk#2D;j@Ҁ[M9Gk')Xb31ij2תi]Q{:f:E0Bry]Ɂ1 0R9 gyЏ:UsE}-ϼ΍45Y&UC *0M֣+ۖCao's}: 8n>Wx^79~>L7S^5q`3zλ56,ySh;<|~;6H)ȥ (pf)ڶiU68gS­@Fb:oeE)Y_rtt1 ]F!ahuCK^{bccJʄ74 ! ҫ.;r H~z$uظ҉r}HNkl@FMY@Z8)Qv*$'ŅsgQs()%IV6cJ"Zri [lo!QY b JSSBpns5&/` JC.X[<6 -sc !LR)nweZn`8ŧ^F&&_jk2*i R`/fR ٶdb WI꾮Xvlsg[׬uH ږkBPJUp>bC "5Ar D._EF0t[G/|ʦHBpg+\γFSuXdz/0Ƒ9]xp>$1'f=\srfXv߷tTRe` U>][Gaޫ绰3׬<ǯ0&ؔBtBZ _DW1bOMV?ҦЁȣMϭJ AU&%fA$ AC܌2"zzt|!|x8+fV BbƁ1a:ۊs_P&JKʃ`f>T;Yk1tB2] Dv1 l"QkkNLnI9AZs\1|{?uܽ}W'% k[|<{{eb \JV0:d6cΝ{<<9e8XpX2^Nq$@# xyn߽)ǧW+0m=i XzbDM:4,e3`A)8H)>=,2~Z+ im@SUԮ»Z5fkp 7zk9$Vt-RVBX1TIt m,t+,8lDAe0cvXKV#[Gv,j&.= &`Z4n bY`9nSŁK3BU0J %[)] z8Hb. I 4^>;0 te=:GQ )n*Tb+Ii[L RA-m [F/ "aad:5]3,7?[} a=\!oǤqsGbuĒ4{ Ff "8ɸ.%ˈw _jq@xRSk<>$qip!bGlL"cJFK"hD h+;bu'g<|toڝ[/srv_ELGxg?b/20ZǑu c9&3H#AdzdRTor!Kno6f6/K[G䣇sluƤ7S w,-bH])u/'JE0Z_B׎h@4o_jл?_óUƭ;?z|'87} ί&l\=͏#~߃ WɟݿEF[ҰڨAuE/0fH4.T^ W&p}4+*U̺+&[4r"KF!jgy~e21Y-W=Fers:cLx4_dhT $5cάm$Oj];ME.>FR(5WxB*Bʆ}z9OvP,zn6Bc'k7)%zۀ%Cu 5x檾 /߃sCUqF%SaUJU]U:grc`ٌ'^KބZ]iŀ\U1AMn1NsS 5>kƦȵN*^XTƪo,y"}TZ3Tg3zǧOt?[2k|x&#]_Vfivz(X2&FnN؝yb`Z_|"ƽd>IR",8 Αpij)}7ɳ="O d|b,AyYVlqY,W|݇ghjXmz# =)4k LZa& pW+vLÉP̰$ BZROƜ]7/#d%II7g8=BO4[)X^hI*[W3N’cg!. ǜC~~O3?gq ޼u[)7>%RG'ǜ\WH̙QR@e鲐sye)[U=x8lZA\`7w;!/Hf15n5*Jm0C<Э0qU䤃8v[>^k-mW~ۀտ~iF|Cٿ[x?g8o|~'Пtu|CտCGǿϗﭾ%ӿ2֑O^͌3W\'~?;kxrj{w=og^cjJCɎ5Ej=ם7@c{:grpy1&5H{/ vV)±D{gMMr1jW9 ʳ)N4p0g2]1Uy}ʻ]ixwqNmz6z1`*#*%f!%<v&SUku;O!ROJUKNT@Ӷ82={6cx*|x5;t 1X&_k\d.ٮJf07k yV.c̖[l&2.ی } d!5)E cH")&,7ArHۢ<8#C y\)lr֡= 6IS8 xS@OM%KֈQAd-/aU8dkÒ}+ H#\lM%=.~M]U=:eab,zYwJv]`+IְzR~m#!x/ct*[cb#m &vXMbľZs\ uU rtd12:5mWd6?ʦK?G?/wG|~'ȯ[{>'og_x_?2IG/-^''<8o9ztg_ 'tBSeZ+^4$N "D7 VN| SPS{PmI@PמԏH⽥F J :,W늻'sxW'\ Cx=Ym!ajPsP:c}sZ*H%1=!K6gowjEzdXu5Z1\Аu1%R6 8[Cjw`]2A0jc\=} @yyni]Iz\N٩=c0̤g8D)2w4F":0m[&-V ^D@<w}`7qAvY3 y3p-^TZ3Lxba(AX)rz ؘH m3mjJuN2Q`!F55L|5xV3nzj%QǼ5J1h+bIg<hٟYXV^wKv`ytr( ,՚1'69N]SM[rˉddR"IQS .ʠmd YJ!aPOͧ f\vfH\i6 0 K` Cq72U#kΰ i5 Aθy4!?Ĭ QaU.I[v)l $8^r-7!n^$hv"K5)&WXDf^5&CY=xI 8m|D2b\tj'p 'xp*>BT VARcNv=!*a >!):$d  + a- c^[k7221GMC7X2DãGl!Uld1#MXAFV6Q]I&]$>Wr РVZ < yr b[⃀W5ؘ9j WƈE4ƨF't(qjNcEV#Bo4\QIE4w<{=PW502Y)cikr2~d-cRR0b*#%uE:D(kzl\} >9G:!ulI)`i`i1QAHDQmKX-y)B7(śz'K/ziPWl~ƭۼs|;)G&V&iV\gnPK\е4XD _N%6uUeP*93^!FB}Ǟн:М(^gI^f_7Sg7n!~!r#r}dY~O7f8]H1,\v{e .7esL>-E$i&(]7x:Vxg<w|=xjA;L#/n F''{g[~HNBB7Ml0X9LBC.UBt y3r:z^n8-"v^?d^pň b`xL}@Uv htmJZ&"ŵ/J%i含OiT DI!5y`g:uCJcǢFJ+Vړk_aཋm*-\o3;N9 W~.J8TDŽs1֪p\3C3x3JO.5'5ַ<^dwb8)8D0dV0 [N/|-F$B]*D΅ÌKV cZ^KɷHP:ϨVDykFmB-`s*ivojkHVRHc+g_0/[bfi΄  <KMr1J/EmTNtiI%-o;8bHlx^6NϡMeh8Gl#й6XZaX7ژtD@3seP-.(lz-;Iw5.-v]'Xu:aDW4ҜfT-P6U8B|M"*N2EգC̈wH1*g׏P2-3SWKx6B[ܭIf5Y.o6]ೃߛfȌ}^Xo[e"%g榗>, OkH~~e>pĻ.a]z'~4ɦC}:zth]D>rH0Ğ6jV'_߃7/gklϿk M00<˅5gWW`\<,DfwcύO j6F610cNҊΕ{[`J- ExqetW7 ~|V7+rp2EqZ:sJ9 !QcV[oLTDz,ƒn]/Qu&eb{~ H>~ǯ' o H*ZA+_ B4) BQ#ƈH7!A!| uO:WWK,=*).В[NH..-nEZ§JpXԫfȞ&"+n~!{}K<@y ^_|.&%t R "/:ֵ{~y&+T9Mt5)IB(m"D݆ 6jC>ѕHHkÀޱqDny I+`JIBr0zJxB1Z7h{B>{zCk>q|炤PN cKFˣaZ9ˮJg`cχ0͘`:T]RC5/;DO W6\B` ˑu0tfǝg\$s`&mȥpޅ7 TRϽˆPo@ eB )e2 тjH~m&5Ʌкtn9aPwʠ΃ +`MD5X2DBv>-շVj7r$ɩO%`8! M-fH2\J1Ez{=b!2qÈԒoTB\n7IR}r &dwSD} Wyn#M HΠwY Iߑ6[Fg'lF:}xu#Vk9>Y+N~Ŀʚ7ӟ7ӿ/v^ӏOSſW~oz_Xų ˊ_:~/o]f _Oo\!H/#76,MК E޻lqO Qu1=[ԬٽܟQ%k]Ό !/D3B?puƴ,g!`5UTyuUB#.FG+)p1++wwgpx`^b ebwK:J99q(1ryq͡޹h쉦@6FѼ ŭ5L[J7<5!{bmoSx2,CFp3F9[9LtwV#)F1pZ1<ٌyٞm>{O7Iݎqe|`t81>O<-#%S]ųRV$VWuuPZsNog$҅76*~Lo c츮 /+V}zvJ2S ֛D!Ee9cw3YJ C̵l-0āYxWD~ӧ-@Tv*#v&r"" i9m$Z3s,Ux)<~|:NiVrhHVa>!L\{f9CSxO3gk`XpmbpH+5w4Nn:J5yʴ*Yz Lʈ \Xՙ{V@ *j+/LWjTB mBN`TZҵ< >6%esݗ^d9)%t9E.o[qv[]|Rmy:,$BHrt:xB% 4%FKcƣ!} ^0z@CV/&5E,5NP' I@衉!ݝx'aբÈǻv+?^~t|rh2]n-H|R_W\|cayp"*.OXovN3lеxbp;@B(7 ch者C8?+>m~ bع&W, bH9sx􄠙{!uj|8ihYL)>$v%TÂQ6RkYYB=P-S<V FLGTکJIaY[]I|Y JoLW{ !j-FN$(a>RȚtA$]3k@~6|3ɡw\|i"Ko7?/|_q='ҏ7>zϾԡa(21]rᤰ/fXqfhԃO< j 9 lr&sLDUb$'2V/8Vja?-q́} ӅGlsb-cwR!&}auшG V7 Ǝ[#s5CD8cc9,E؎=Ն5W=f 濿yc9pMRh5ՀqD,իYtӋ`"+_'l s o^z턚̘*ת,E.­!u Q=%xAMm)WW o<[0e$r3RK#jᖖ#~HL0/.w_Z1 R}b ϡX@Z} Wtf9bRˑy,:X)Ѝ.w{jұCM/que<QҠs1uT%t$fUo$3uZN_|vuK>jj R"ia602̱||ȏ?|zwFRxm)4PZccPU45E[qmd@JRX.Q !!PQ a>!C,Nw'_'zW^7kYEft(%g]GXlm4 aXwHԈZXEu)gZUj5o 5NV}܆Jxj A))@S,Oʒ:Q ,m z璴y t@H2A|&.ڟL'Rnju3 2?upv/P^ޒ;c|>jy]?>A_>BPЈY3ԙB ^$6Wτ)BZ!z׀騞E[ČHyhb߮!L(s@= /(s.3&ʒ ;$Y~%*=qry4#q~αfUD}8IZKѤ~(RS$vnZ<;Č䂚6SH+JE{̼a%6zh |0u\qf[l8-(3ڠoskf^`,&i2:zoCTN ч>o1"76c1F!P)aE8VwV=+%K0$4nMzJ򕯿^5?ϯ~Tk;^yqW{=CvחΌqy(S TBx}y*q kcd|׼uYNM~YPU 3|6r> ׶0$rKmmb^w_ջU|~wlPߩѩrS̼,,7U23rË#&5Vx61xp oOǣؒ$CBuMЙR%wau ԡl-%= x+. !$<9[#5זi˹&UrCߋ@1c5*ͬD7l@K3E_q}μ̇ل fI[q7̨VDX"B՚(1{$IWҘ5 SB&JY wXk@RX hҪJG,f9BOkæ7򺴭nՌ.uga{4lY߹ih͍-R3r8(O|#kk3~VC V NHs#XT Z)gJx>'PVIK¬ Rs! .;dN\rFCjV, D'Z_G=.,HC]<%hXSePY-{B2> $'Vx̝I"DU(~|)/Sn׽YNj<ϦHbXUWa|Ě$01ge.P9 99 \g͉MZe#ÊQ%PSD jе#E3227ޢPc V֣?еt+_bݖPrnjՆYm]cQ"%ۗ+__n Ng;7C7x6rp/oL.!b>;P}dp }*%neN(j+ ~f MEqu4ttfhٵGZ`uS \͑7 z{U/jV%@ UE< O}ɶK{K&(%H}O.x{F=s@) ^yE:D[<Ӡ.ml-FCZzKeFfϼF:vngwEF}ivxIM~j|Z ]cC[y"5kwVka{.3h -׽[$5H&=>ISWԉKvӌ̃{"R= )atϡ +bGDԊ>$KdzW?Mwv?c.nƮ˂-ZfN^5 uyw.7oADޚQܥ?OrElJ(>6d"&}+ w(H̋Urzt:T;%);d| ;oy )^JD$#tH{1XޮB6n n4?'b6@Rp)mm&I['[3?֞_ۗ(! |(̗o Gt [kފK u6B}%O37g+kKL1KKuc9z*󡧖='؝Չ8Ʋdr=qs յ`sdOF!P?\]_#jeI ZaݯW2zIExv\8K A;ج)MF'M5 uP&cp?ɪw/Ԯ6=S:O1 V_/ۥja?lse!G)w&ͅ;؈KB~5z;)-%J7#U}QYqdp=V8![>ȫ+vǖk^vRv=!fj4DO##]&kqί>5p͑ExyqCW8}pM O~p J1jhi9)4HMF׍K!"Q39' DT,mѷc%+.8 Mh@X}!37DސMn* I?C?B!01. 7R*0f7ԃo 1K$gשY 2||7駉o{/ SGB|f2/[D X׌!կ=R޻z_] X0<\K/unߎz!=`ݣU y!- @X4q鱲ä'=Q 璮[~UCnˉ > ŷ0qtftb"yDN#'Pڹtj7̈]#iA<-P3.ڜ ndKh]AOdmFT}(o|[ a V47k AAN͇uuX5_M-ODڶFAKBAP} )['IɿDOh{]EB  ̦ .I% b~}h 6;_!1;@CC`.]qtN2ŏB}{\%V ZѺ( )by!D*@&j6 2鶞VϒNҀ|/>E+37}~ٞc?/gx'7W|';cLO|>-0e/>0'Ttm]p>o)yf1gcOq'Muw5Я6o2\|G.Q4p"ZcO9MB9CV]BAfĶBg>8 g[yf6YU=_2'Pg].d3뼆 kHCº~Ϫ=7i(?y18FvSfcjXB$l 딘jJ`Qe Byf\Lj+.%VCOU~b;$1 ь!nK={zB,j$, ~us$OS?TG3_O@ʢqM,fgu!2k`Me_'ZHLYw(9F¸"mlErg{Nιw"ƒ_ԅ _%ܹجlO]-BG*&5/?ʾ&xރm?D.nF33p>t>Wv|p9U⌟fi RQo|6 Ʃ*X,E,{Sagŵ *dWtM-#4C"K6BdQ3 CO)r9HUGsҦdH/B P:CA!7knnngqHF&Q *"sHԜ4(0>< rlSN# :|Y=&foܖAS*4İ$~D|>24V^B\vԱ-4ڱnC$z6Llx#U?[ד޽f~FBp I  H96C"si~JA{М>ߵ>IVދ#ƙyWrE#Ez?^޷/К&%eG^";mXh#ww*a膠k?˟q @PdĢAt򉃬.W?~oUOY l'SBYTb-p8ס*E4FWXh4EPI~bJb.Sa랛t` %mP.XwgNiڭru{BWRGAtRX- ]ޡy; HLՃ\S,3+_Iz>aûe ~1/3E{ʷ}=v?z[Ohg*wB7d" U]|`}Yr+0Os8.f<;WW;jAΓKԌuYe$]^l9< CqrOKWO+ '5a ٚ#`WKUYp?5{<~jZ^\Чe:a]U0G68G8vnBGDqU˶(icOg.|+5UoBЖei:Xw 1$aJRYrFb`Vk BΙ9vK8gJߑDKX-m7| .AkOI]zע4  %̷Gw^8#L7TXxSSz%px<ܧyvY)!p{NZ<mj4N C> s1.]nw~ƽ}s5ۻw7u4\?ݳр,8ܹ2d_ݑp8@% !MNP*ⴸ(ݮp!{D>|䛾{)Rي7siؠj|0\~no~7&J$@")|%5=fb.aM(D4$$;`$FG Ch*=1(ef"H"aR}*m RT)D=shx`HRkՆ7a"S@ B'8tsZqQUn.߇KУ1չB9A0~]%[tUAb4Dkҫ6yb 4 U"8S\SDo2 -91mbڶP8E'&f2j&, zU"$Fr00XJeIlD5ׅKkG!CĺcIs2%f)?$L_g 'JhĤIfoF3k7)_Y0Q'0m 2PHJ35Y٧@ o_5׍^ 5$ҌK@"鞒eŔ& 44l!*>շO)s = q̧!+f 78}ۀMgÈU5[;k7SkFgB#g黁X*iY$𻢞R3QGՇ6 f.tPkO2p,0yf}: * }G:%Wap,p 3s:F3o6㸃ˣw#ل9ڮȲ.rq\(9sq8rF0q<, sIsa:aۍqaa3y&{@R?c:A#Š0kSp7 ! :@xGzZ)7{*g}k#[njb/=Ȕz!4Z֗L7G}NM70aQj1ˎպmH*t}[C?BTyu] c"H;7o\2!vhK&VPЅZC)];W}w_`|an֬b"^:Cr6@^_=WW)!f_)aE*E퍋k“gY‡??Mkq):E^yp/w|ix, t|ÑzGn}Mc:FRrm)ESoĵӞKcamZ'qC>+D,mFwg@Hj>}udR'/o -(ѱ<*O*7l"~ZCj2KLKe'$ِ'j¤- 3ѳH!*2)™cd@KrƏwm򊝈ni§S#bX fE[YK F_Ool /ҕ;} MP֭}{W$- iS+V)A"#ĎR+)F('ÓVL>dX4/H(}"b\b e#7D]zYL Syb86.g'ύyR h`ηn !xAs3$~2i4-@sHbFR AYK!lYm~2eYau et|)QH^!.%12C3b'<|F]!4 0T{58"PxN+oOiqXŃn%/d4kM:|Rt0OK" [ m!ZMmtm!ZJő_i@* ֍.4?&$n]x[]Z1+ĘZPf Wq;ou1\ bH.U*b.O[Koz7ߋ-WG0iFQg᪍u$ZNmlzi_ˉNaۮ0@Qc>$ Z8LlYM291d/={}H7Y 횸BGƾ#7Թ&9F؁tUj x/b/ftX[OJ9LB^8Mb`2;GÆ\ 99$;Uo]>c 4.~BoW%x'K!,嶈RM1XaiDdu;EX=ًԆ^7K:BS^b1q̑o6Bf>PVhhe.VRnR^Fŋa/1TFPҚZ@G ɾ*J Y!:6i3AZaevv\cY/gf= X8b7 U_Q%٧MćOxCՌn73,e"˽o- 3WB>%ZPBRBTbrCt\r$gH'~N,1R|ZWPji^l~dOo&nX8]܋#7T<*XԴeP*<'٭O E+yc$GG{UeF555ag$ KѨo}5 FV)bw uk,X\Zes{4#qJG,][Nm)]Kmtr+U 唖nm!&J&b&Z4nÚyJ$0nzHk鶠[4Rv:BbvyhHM(q.qv]ik ,`q/ZaP"=H'L.k uV_a Nչ JvMK#B {@V}W ޷~Mu|앏Rg-9WO~g1~GOs,95![WLÊt\g^}ćw q{ve`*FztÓ2脹t B(1BzC%^|,ɷ!N(dk,h+ #u̘=.l1.1њYG6ݞKHn^ֺp-;QY"S\x#*_WTkoK. d:6R.U0YE! f)o.Яbiu\'sʒ[rXҚ"Z'׉f|wHPb<dU 25>:%`S-\N3d _ij%`t+K `3z.L_V 1K{OBHYSpHY`{HoJA8̞VLM:H꽰0/g3F5]eA?G?7#^|9FdӥHH2E9u$k2PUʜ<,C(P 2)Se=WMeɇ[g^gWGJ(/V|hH|l˅wpAg/̣7 ノrf]9́5\8*]lwj-,/%""I%hH'X@ALNz R+sR&JCR&xJ"BԃFrJp1TT9)+4ȃ1A٪_QZ=P.0EuZaMB/ӴZi/V eRh|J7WZtzP#XZ +(5A {,FVD1*Ԍ$i$>JH*<VD9A7)S{ma͋V X74cry}>AAˋ7'L?$LOBx(ŵubƺ8OԐQ\&do"4[_#rYN*捇o3T*Ք>&>*䚱jDSbob-m',׷-oFN^)x D(;G oQZ,Xu[\]RI$oP47oC K-T >9Q$.$&;s|~5~~_xK~ȥt8w"Z}U33o.o>: ;Oc1(v0ՔCt),~h# t=^o@V-x0dA%DsUfKgkʽ!woxFԱ:ɹ k`< 82 H3qa"߇o}WW<" CG I%DZxlÓǏy[Yэo_=X{Jj7ww^OSABcߟVGCt?1vN)e1&;7߉lƑYJc0՘Uz}*%kuIvu%W]hqoVF5<"l<Ჸg!סgolZ}< L>u%SrYq,@aBq6cfldQv̽!i%4͆#!.=]~-JZ¬|KƏq02XpO Gx*zsiyȩ9y1g0,L1ӎj%]}aBP_ !AH!Q.DTC#haw8ωVh[0F #nAClXꊅ:yJqF<e2z9/An|] )k,J ʺݴO Hn2Ґ>c|_k_%6>ԟA~?͛o?Iu -??Os?~g&7wk.[0˅g|_u럾 kώ?y(Սq,r(qJN?9R(M2 ,{h:zǵ7eVEB;zjL5cGi3(%W޽~ Cb*\3<w5YA? JH^i޼efsv..y|^l R*yWYC:WJϓ=<_x+C慔8Ӆm/λKRe{k>x?SCǹOYu}2&~ $WrbNJ:Mw*yfY?)`ڜM?yI3X&!tБSAU褘{⭖>7+]QGeq幁Ȁ5% ׈),v f%8mfCĽ#ܔ lG.Sh8ՆaE7BsA6d֔zt*śjwE4t17})o-NsT+dҷ!]/4ÀMjHT.VaIzΣӱ,aTGME>mĈr upiXlޟvػ䅧fH[hK(7^{ L5 ]ma>!H}Toz QJ)qr)ڼJ'A@'NP@i^&^\ڧ +3`t[z[D@9UQL*CL&!9%̤aOxhK uBi4 ֲF9@Hm BF21sTT7zW(}Nv!"Z=DDgԦvV~v~ࡃHBoJ򒣗unRrEN-REZ_ty׸c #vu__w~ǯf{=~ݿ{??WU"5/ _xK|/5q_ǯ_o_/$o_ |/؁h%Hta{]X1Z9?%~o'x|,.e>ޫEvuol2o)1E(ňo?Vg.FJ$yFJO7h@1eyVR섊oFe!zM.\Niaru7"ٔvzL8t@inz^R6 ^45XmL[89goHbt߄?Wؑ؈wV]bwG]M"Rb,Ѱ 9V;$6yu֓Tc&_u. 2UVA-F{RXEH(xvDΗp-nzꄯQ`L諯j.r3B8cL%:?bL''$pNa R&/Haͷ*Ùzޘ2)SyvÓw wMYήSK*ѳkA᠅{=Ǚ>w kk0avÜ03!"E=`ڌ;fL`B*>o$dp bl싊ݢ!*u4]JR +hRu/,S Z+Uisr,[h Nf<:Sbp $!esS~*j֚t"X1Gr™ZtV A6$rwQu< [v.qZ u|eod&1,BT `v#SҀEC/M4D&[U/B8$VlS`-Gm"1WD*e/ەnKn o ;.%H *RkV7Gqqt,Nν,D"kPNB?o vۘKz bT7ո ȻW'#SWx]^خw7,'H D +pd^yjMiWx ͖ս 'pjrWп\K_u~Q/j8RH?#IyS C*zf916oIߡz6ҊMtXm(SD==*; tI)FVcS-cnݹO6APT jR}? }.DGz!@cRkU7e1芛%t)Mb| &X20psgc< {Y`;DPæ ]V\\;Y. zkWϪ܉WVPrHG̘۾؟O ~0'ڕz`>pȺH1B-D'8WHa6aDh}G x61auq:NC JzyJ" Jc},}nWoV?G5]Buy pBOg6BIkwiZ{@d n.MV|KjùZ Շ}VՏwL|6 +bG#! [{B}3Ssh-Q[ߥKm.`D&eAzS~oHgǷ#=hm{r%CtϋA>@hLPo鯉??o>~G~&o|_..~ oO\bJ1cD=sϿq3|c|}Tak8áK=8 &5o@v(M٘PiCQp0%:YP?7ja;:&$ε{VnuT'=S͂.}cwϽ&~v4ʠfּt.C"B4%nEE|^#LX8*l*uG脫㫧={mCcrqRm}.BdJ=Ǒ0rc.hq,&RG-T*5&|i¬NjQma=,&E _sU=L E.pW ?j[da1z"}7~ Wִ$jHrEMC(RYyYUD+Y)7W,“hՍ!]7MH ;W agV@y-'RBԦؗwx}>8:(;n5V+82ǾObӧއc!xOg%Db#MPJurChw rfB?5=qDӺ%Cttŏ)uTK"EfI"q!3' # ^!ko8=:~jE_" Mt&9X_3G͊Хr[q"IvkVP& -Ub>9.ϰigTOG4"a^ЉG~:Kjv NH3]cٷT՝cz`n4L8DjAUk{a DQoلuRz4BbH/RwYIY`-.rE61R['ŭ}?:ݠ1.#MA$ *%=gsۺtXACBê5}>2P;n7VЭo=5qѱ¦e[Xq܂9k}ހO{2||oK?+/;Eoe~/e3_3—߁m&-B4B]Kf#{B ?ӗ_-|'GWSv02lhLHױF6j;nO 3Czų eOgș.:H+Z|$2>Fsgbfkܜ֪EӅkxaۂ'³kլ=eqB,n>psD4s"~Q%_8ؽӳ'R+BXf] 6OHgc~S|Bj؀-`` s _&/^N@;rjNRXaHeР9/ #>XunvVNiGʪ+PՍx-Ŕ]"`GO<7՚M;2 QSu㽹lWa4MY`#B`KQܦz|oF:MpK2әVjt-EƘ+w"]>a9WrqGՐ-Oe#'37Wkf|/|A ;|\<ɗ-GOrɼ#R⥕qyؤQ ۑ?gV.AjMޮMmRƧ":$ECX}ԓCBo9,v U[cbуBr-.U A`Vu#tkK#.Z`@ؼHVHѽ)a>,oM]"D@b4#@@du`PC-R>z#YEng-u&qnM^mNZ~zotT΀@&]Qv$=쑥 A BMFS)[Xć $lj0˼z=8iE; B7Hfp3iXQ3S+!D9]ۺŀJh걼8eiޏt u#4.F`,­u5cRÖ^xġ Rgj6ښS5_K B3ۚHdsYآ Q+O[ m峙Fu ^|$y?)'fI׌,Q,pZs*dLQ0ӑҌ- D'{!2tRD9k+HOqXqy\$re!9L*#40OtO>˰{<`|K|c+*/8" ֯qR9>ѡq7&ʽTvXNdYK(s#@y͊ ,W =26)7h3n#L 2 \)d8 7_ǿ[9w˿\\^~پ޼T=c_ V+ Rg7똵r]{t{3=;\ \W~ Ą!,;\2: 昽H3## +Pqɒ /ý <|nfmPUk1|ݰ"zwt*τǏW>ve.p݃Q=@i#>=' }ma]gX  a4C_dv=ώښTJU%-:3v{']4ռ#J?N]}߆Fݸb)'/(poՓc짙Nd5Vcd+<]g<s FyRv+l}<}r\BQo,ղ-_AA)Q,$:RIM!*! le:V =d78;וR2;-+)%lvr\ȥb:Δ 7dŔ㳧h& ]U ͖-3 IGOݭ)(eu&mxEj.XEl r#Y"sJN;H[t!,-36> ~šZ5}rJ=}QJ-֦GK.rk֪7OO\i 4q2 uo0}9w:d%]lT |M8OF߮MN ΫNNX/ܬL%q]NOKZn0mFH-)/ir-jDșEkMMK]>h~ǚFp;t\S'= Չaľw`|lR$Ϧqat3o v$ _ bzcN&s5|s=(ͷ &'D $I%'|\bg%T)Vv.:Na5.wwPÃݛwlPxk* uj\vkʬ[˭`=UDmbwJo>DB5c 1x̨gf˦。"9+S]6{ H V[pL {6wIL@ K{Q+0{AG+o9$QC!ĞX7n*M6c⡐j R둜6_ cBWnoL=`1Y#ePDmCހl6k~o{:?OY}{ǿ_[~7*ˡԺ`%K"Ы1D΁c |if}Kym'*l&Ƙ\2Ӣ]X2{vkx!=x.TxFG̞~NzZ}G\lHg Mјra@(YYrTe7*|ρMΩMppRF}:ٵ|s.`*pΖn_mc5~R|\6MRȐ`rzS)~xMJ O5 L ۘfbʒR xJr%:/V]&:ٖ*ѵn"~\pxj \(G3rNWQ@aƢJͣ6uN䌱l:vReAnv$kԌԠ lb5ޜdk5!-dcka}Z ]ekg5 t@ʙi7e:I9kVMI8 JQo DF"4@ٍB^ӄvJ,^Z5okz1J<7Nȫ5nKV0nݘ0Nhت[/nn.+;I)\k[%*߲,7y I5-=(Ҵ񏻝zwk+ o׽o ;ȿ/7TX˫8zA?;R sru/Ő98wL̆&X~)YŰX^d~NTNFMV'pÍ)ڨ#mL " uxDN:j]C1s4Y]Z!0-{J5ֆej001-LEx,P3M \-B\svї=gX~Im1I²O,DEh\'ZwY'ffMln=Fc `STMnר)͕hJ8C='cO`K;K&%3=Q97#Ru|j6V*)[ focөթujJw@JGэQrFXXH>T{%>ټ%glXp`  H"X,"b+`9[Fh"ISe/*1ɪ[U"T"6(Lݦe~#mU4Hjfx10\6N10Fe,%6䚟ٞ Y5qRq#6{J$k)k΄U1uV[[VInFA7oM"ZCl:YfqSM0?~OE},}~ x5?'cNlRbT_>6$Xu3alhRd#Kp5O¤ Lg=ydʤkc^SRܹsCgb )Xt`KC7 QQ%@v3 M]dEZj0 9mI+p#}p!Ӓt3+^Bn8QyR`G(-]|REAȶnkNz;؜ާM7?wy?l|Q;Wi!>s%M_?<g|r(yN(Uzi ZüL.ɺM5iFN 1wr}B:}5f-t-p}vuu xp:oYQ/TD؝\` cx(}i5X])\kIMB7UtZ!,`v`0,F3sV DeV+.Å) dBDRG._`6xc&n(=(fW ttCjX}onC*I+dvg3HT ,{դD AGJT.h:AV5p\ʠԏf f&E'{=j$ ˦1]r&uHbEZ",Fm\.K!8C0I2;q?Kړ+G2,۹#L&}>:N8? žXdz vy#fMuXKQ<;.rNǣ`}"$Ѭ"77 kt+MQhq1[C&OĖ%SrMj!W36I F b<'*$ܦh&H+^QrƄ4Fp78WEW]v0ۆ<koLr&I&!G‘S"C5mJudh^IVBI[Re]sS.حCGI|GdL50oц#{B*޸cf͋Al&ہ^L*=˗D0ka{lIXId\s/:( Lpkm.Q(Q*s~YlNDN?@DF^URق5j^0٫;TyF &Щov"X]$h.s(6.IIӰmpDA8_#Ŵ-dpS ) Zr`Gx(6U168nJ8i6/`*Kun!efLBVúlN+v#RHĉ6vX%ZlLRlu3d--%s߰5"tƬk)i$uNmmq˅Kin0V ruNބlHR? q^`Q42FKI~P!)H?RX y\9C#6o8g%6XrD} 9" vT2vۅ.n@(gEM?by*ݔ`R$_n4~8\ү~W_{[oēt<O;׿'>q\z7moG{oy3|g )'Wvn#)!kBIQfdYLZ,rү*VMZƕn=j:Vj8 ]pY< '0;w@5Q ^k9a:ۺHCQrS+IԵBm@ }V/ᑰ`%&j灙A71S&XK҉[DZ >8+}Vf`ԧa7V#vxZkSm8{̆-JjkpܼQjLF\5,=5-8˘f( ̃!GIM}S5 fOAkI(pP Li󦦦t? -LﱊYfX tJ8O/Z F55\]$KMC"90W`Ho|fp`)u^+yjÜjez REIdHAⰲ&WkG"O&KθF0抢M0&@/,&+1,ZE\KJL] a5U氵Jp謥Q)d}l^kh%Nj['4޲3\ia՛q'ڠYu|QI%e9zӴ|8؄N۳aN8!q)ZY]g,+Yq^z+40v;ˤsuBЋ3U#xnč/ήu:>^s_[JÍn[v FI&cSwyͽО`x˪08l5?;k1p( <[މyk![k(}J\J4&/b  9)+L؆lj(cOڜ;9#Y'LiVfD;54v>(9\3Nye" LbgD (c"I`Jmia7>-yuOZ0(פT΅"5X8LqfO(8 & iӧHʉ$5 \CkȦc(jyvU&Y/ )flRꭵ8EN o)*a,xd\uÕ&ȨF$QWHB-:ɒM樏cr|!cSDugZOʐg9 ⦈=Ap BS7yyZ~yӨ-ktJ j7#z>3১79 v+S?­\s+|'|şᖋ_&>)yU{_EMu~ _W~oyO?#=aE)),0Np޵dA/>iڥmD'shI_ C6hn3:O1ZNIO1…m- Bɛ`U͝CfS8\i{r>C&((*ٶ:׎]ӄn)R 5 j4@j8wNi^Pawb8ߙsymn=&pΌɬ#YGLwnBW`nhdr)SMUZצM=Ju7]FDm Z ml c,bdȚcrlXL5&iYTfLả]E+[, :on 7Q)*De۳ 5X D2B:JV8?[X La_] ZJ-"B1qbŠ$:ٞ$s-*Xù݀΍81iMkYj8t?}y/72qA9fk9W@Ćζ6\QuoiOU‹y<&W)0 u=k^YTJɵTQ GiyWa,⧵wz#XV7 ضQo cz2)qMqvRa#^Ee{JVlkA(9RT?lC#;QfedڑƁzE,#)-I9C8okq)̑fJi: 3XNUl6lբMrx:<`1&&f_*Z m<53S{{4݌`-!lm3?w Ln +K5b5ܫ:}\ẙP.ଣu0=a)[ `ô %ܔATcn_%#Zie127OW ׋)uS*VPf\SsfLe]/촦jta= z.)S5&O5CglO'c`ճLJ"YD2"Ci䭥`ImЦ;LΜ%q+[Oq*;O(U$W`#bJv11bĥI3]}DRi1F7(68;CV[lv8覬@t,"`ImK f-g> hh.]ow#mw9N8DF"d #ˆ0 z깒++hn$ʈ (LktD /b 34ߣB4FomC"X9}$Ön(&4uX\ɧ,M_*` MMM~ǝO|7~~wO/o/;5?Ϧk[^7ɟ/ r|_ %^7;|3?Ϟ|!7~ɟKwėY^cdHx d a;O}ł m;AJ!$xɺ<[tbs5W.lou8^v+\؂Gpkm #F S~,V!&SV'5z:{-5U6 Μ*LTޞbFͤnGz˟N,pD8Rb2*-YzpG rbO( ^rg-(NSA%eqJ\Gi&Pܬ @Ae:nCڌxl"cR{)`1(^[g`7 v`N9R؀?;UoagwJ8Ξ;"I܏IKLs.bETR+l"J"*Ks}5i+BF3 c1E d!1c)Km&@qz]2ب[Acq8*!xkVķ8JoMW ɵhv6/(c@| h@[[;-_UC|ݳSoxOrpxbԻ_M ~ɟ}.?<7?SOa&ރ_|7| \ʝw<"/{+G|W9_omA@Z^ ꈣgm !Xp s<<:qۖ2lu-I),Ud6s^=V}JέH=xoG0pf `pkL٨}-ƑvC<889IZvM+yXGǍM~M^*c3e/V C5C? ˔DCR⠏0.hp4&#R-hՂ|sT-4)QQa3 +HY+]%[caVE Wy^.,maے*JȨ7!0rp|lGDNۧXRgǘ}6z 3۝6Rf$Q^ Cq5e{[My(GԴ3 >'Bժra,If .UX'TH" bd,lۑs?|^ٴqйDJ': `Zar,ܾ=,V-U0ӯ,Km^yr S[dn7G,}"oXE4lN+TɿRgMCW1̢72R"|fm57͔1JIBXM 5a|5ãxo#)jI +ڠfZ'{E`~],2 ]M^^g2"LUnr-%ݎQW1T Tun8Ivœq"?x.m{9qo& h)DeJGLxC5Vi&W(El8 9슜jog'4 WG a43Ukĵ6 ʹkp^TxqT ąCSL^h3P9 v1MM' Kbt-4 m:rŲNj`:6i#b,9LkJ@& )lcMx*N*0b37ٮ%ۭSeS(psg?;Pj^Hkj;YTTHche:'A73L LmR,ƈ^YH{o^7?|1?C~g.^7|͗3??\({/E/}񎎎_|'}<9g~aΟ?ǝw<yrO}'Є/?ysY| =;8<<7yիwa"Yºʊhv\.6$հDxَrpΦ }OFNâBy`GJnR4.poZ;:H:0 G22DaXńcY5{!7GբpXM|m;eMaVK8NRLyN/Hffj榟T3za4kϦf3%.g3Cm@* HVl{ lƵâ!"յh{z(zy܂/ƫ S)!g5_^ŋ֭[Vy>5XICO5d2 &qK ŪǶfHyn%X84t kˡYpIT7pfRpfG ၃sA+<:pȂz˵hض&wzYX:sdjruJ 47Fݐld Sl:bEbҭE $ k;m.D\ y= 3R^k= N]~&AzLpPhkUoYr5HAC] 5MA둒kYnA-R} 9S I%kzx R}݀dͨad0_5iМ;MMm"h;|={RKb :WP (ț@NwL6G\H%cR)`[\EtbE!9LYhh0TRDY`3& XMI R!ň !k b:1`C u{0㠾a5N7cJ%Hj:(1U19Ogk{|'~4!G#)43ׯ^%8ONKWȍ}^LaKRB*CzCڴ0$0='5^1J*3"F dʠ`gɵRInv10%'{ z`깛M+z ZLoˏE_Ut3'p_?{_G/y9?Gᜥ7~WWg0Nu$ Xg5gVc  ;sa7vZƲgFMtM2 C'zO%\=rz5YǬ'/; ) *q4jRZrj1u$Ș  `F0F~pU4.Q)9p)'&$rC>.(͔vqeV7Q+m]u 7DX*nݐ*d+0YomQLGLC;a6ϥ$DFz&41عcujnD5Ya]iuU RJx7 XEJ!0p+=ߋ>6]Bg ,5,'xZ$ns|xȤk=un͵*f":pPYTT7ziPnvHQ:\ԏE)! YMexnR5tps7)1WvM&tOV5 )è~+y{e'w7 9;t?B}aA|?W/🾊_|gܟy_%_ o|x]xs~OkzE>>?xK7Lxw-_5s}|ܧ~&o-g9\~/gF~o_XR"&L%q Krsq<~:aZ1L&fѨ)XkpMZP8ʲ[OUp"_}d{a8>gym>50l({zS7ei=`(k[,sn>Ijsz:w ZM.AXbC1B(iP 椏:aoDS׏DT :8c-\xVp,n6VގM0a l'lgc:^c7Xwjfv ˓cƾzǸZ;svwY3,WNb3$pYD" 'rxh Ze.$ mE!RkƢUT"b2H7` Ii2c6)Ⱥ?9CySh&W)u ^`fcXgB`5M[zҔ>=yw oٚ9,op4ؙ!C5l&vò=o9+9Y dqqT2 ti`'B@k|C|5pVSλ-sHrS PJ1A7%2բYF 2bl1Nm@Z*i]WFe&@@cL^zAH)sJJ5+DMnA_;{Mvd6jX1s\q=PT2lHO^Cj# ~Ž6 aiݙ+nzA5|ANQ4s!' %(c>f-F7EC; fHwFQGQS%!FQt+Jb~Yo}/اL̀ vV)IӤZkkWkLʚvuLIu3uF3rԭT qDRnqm9/4['06% Dܬ[-S9ͣ5[Qӥ11M3ꇲy- qd7rhLIزJDcZJ XQ/"tlk1~J%RlMQm\ ҐTrSbq)duHK?KU WƣeQ)S ۴T?f"ཝ9ag/!|7| [9Y+^gc+|>~ _;3:Y?a8v 3 Ⱥg20l"~LEh]<ƪP8%:F mDD0}'ExWaw{pcbbYG/!sHf=&5*ZhI2Bq\_Go(ְsӖsd-7֖媰q7'̃PV%dѩR80=S1kwzNH5ɓzLE*ݶĕ^xa5'=iah&6G(5 IfB}N_Su=}M e!{nB6_o?Cx}pRIB7TÑyH)2@-Y2㌡5w_P [Lgx0DCpھF7Wkmq"\yD%X g'•J$05-2PbnkJG,+Cd %#pZ$N~18]e4c;_HS]݀Jɢ"CQ)vnO }Eͽ%9f{,&eݴDXa's;sok0Mƈ.Y뜒'T9(T))FERX#ж40 ;c=W=AMk750QxS8H5g5^KnB+,W i;a1.vpTh#آi('>׼2:gN, &pEhBjQ+xR`,{U"c93e$rP ^pŲv#>xo*uۄv'>[/NOg?x׼qg,+.]I)?|~%G1odL\j*B̰}Oð]oƝ\,dB ;آ5XR&eaqedj5)/20@a,4T838^'p[cigTyjXki"8 XLkϵX1&ݶi a栁Ne^C9Ue&S!A3qU}1,Ɓ1Ngx򎃜`3Sk9![J.acꋆ1Tl/܏sۙ9ÃoՍq9!O;3p $(c ")_6a]) m1EfR4_kARzLj+Ƕr'*rު{f+;2IrDv>yDn1Yr#ck[Oҙx NYݣhdS ^Gjqq hX3S8 HeL6J2 64̲`Z/7iNHD"i>sƖ4z<(ثXqdo(랒NHL6.eD xaB*;t>.Y%ͮ2yI4Szu J݈6|%.jhS=G[a("(6~͙@ يŎd0s%b8KjtsԝMBA* m|KM7 v1؜7izlgówe) V=֗h6W0 m7CSfvwwݚnL5XQb1QDhBWkq$!\;4Fڮe eQ7<%"u؋a*`>i/ 4&S v' s#Ř"m1cAVK9G> ^F&MmZd-"bxk:,m .h:%ӵkL|"8 Sk4q<I&m|R̊0p= v]`7PaM`{8#NeB!>̻YmrSd~\2xÒTy ueמ87AUn $ I*yVP)uݖCtFWHV$7'JZDx 5\YaZF,(FѻyQu-RֵGh( DhAAo&+GLV4^ iE~AߺjF!YB4ӮX)T@U6zpol6?~Xh^o讫D|ICJs^֮0^p&ՍTEmX'A s̘cqƐ%TV][Q*& <8.)F j#FeTis8G4FfB-4ö ;L('X'ʅ21xVrH@Z =āOhP*yGaARYydLo.3X1۝ӆ͙2]7L^Dwv\Iܚ͌v!7`ґJ)Fl"aeT+ő@[$7%=2 lNCu1Vï1WPfb/oﰑhnV5WL*r:˕XRhJ˅)HIl͙LgmCE4#^NO !2$awo m@**S,&9k`;d^7ʂ-ZFqRT-lI%D6y}Y]Fa*S6^,,|izGm,GS$m\) ,cw|1N/iۖ?y7O8^?s?3_IwGr*׮`wgoOʼuի\qַw}?=~GxoGZxs~lb#?qQ}moc?#I)񒗽#oX,4Kٌ9/~+qcٟI۵WkAڶ҅ 3Nxַ~'7O$xʓ~gݗp ~os|<f+j6 4)=9Ip[ ΍Cb5)8p,ÑO-MlCôUIz$. c8%2 dXLbV')U$Qjl7qdE*s8Ѡ^﫯"kP[*Y*?&$pjlXFSŝpub͓j/loq /-Zb|tֲ!lBV &J6ݖȯRTWCb1D&*@WORV't]jqۂEIQ"7 i{9<9b,QQYWzhvMԀ[mHYa{[s9a?k䏏pFj4Gbxgu7ZLh|6c3.vaFp–\Y,[p~I3/2nہs˛.,e8{EJcq] 'L' Y*Eum#aNk<@pn{;$j}o$l{7I BO̍թӉ :m3=\nirEMJ15"E"I!`H>ceęcSd,E 8`H ji&`iCͶfo釚pD,r)V3bN:JbWМ3r} TsI:j\:5hCNR$Ca)W؀ebq:T*PF}ra \|!fžU3\MWvb5̊%-K)H^Y!nasVӐ)mVv1B)^xl۪ Z .鄘YqDaq8PJħ׫16i,xe!dHIHF}NI8|lD%GY]f\S)X0v1yO)m# x |7C4NMyX7!3鱩M(iJXg7MX= #mSܜ⚊֮1;9 ܤ[pb Reض>F`6)3fXi^'Ugj:Rj>S. ֜ ;hK`70x7' TV뇇-oe\* Ijb>f-6Ub%ۍHURG*TT2QN@3N7 zEБf:4$' LcW>0ctz$A~ms1li^,bЂHޏg~g?˿ˏr{҅ | 0 ^җyqnⵯqE߸/bտx&ɟe\ #և f6aǴ){pR`Ns%x8Z\[F "Eq\3g8հ"Sb[3uȩ1q#>tSОcyHǯ&QݽW)GC2J.ĐBGKvR!nRs#F u[~ c%t*A[B--EG\Not]Sʝx+ XJa2 L>Ɩm'Bbt?"žq6%Lf`0h^)#f&䄑 %!~fX &R,jME)AlU-9KrG3Z tGF&-x-m JQBXlQ9z0]U`k~:mfy-LLq zX[q5rdYpQ:_QƑ d^bj)=x+Q ~wȣy3gx[_o=ďO{/1ptOyʓGs}/gZOWYF1|rg~|G>>_c| -͑ux;r}㦞qـoY+Y F͸DZ WCKF.+;yd&! z4=Q"K,,G ,5,o`)*U^ն8 |4B;`XnuerL;kt"xǼQ3Yc2-ˍ!cqEr+˞ s\뉁Wyt ga>ИĴI]`zCVˁeLf;:hem2Ka9osѕWQͲn\=$ոQlIyPO1ku7eivCEA(D*!8hr݄jnMJ.# m>V.1Pqv 8I]v\㙖IXIJ2h(xIB gTfAi62.a}oχC!]N<{PQ7XIhZ'֩E-KjP$cu-Ƶ6&%FqUS^67 Ny*ɢN]S ERxwiV2ĝ SƭE[Q5DRa"]JIJZ5 Fkˌ1)0Lx>9&zMRs|r*&VbYc!Q% D ,W+J(B|"uxW]$M|ͦ4R6ɀΈfxkh LgSqQ n">+O흙g{t'B|~]ߟ~/ßϹp<咋]̯=7ďX˿ƛ)wq1M>棘M'o◾7`~=Crp__?}ɿs>럽c#I,GaF&g'mu:I?iK4SzރjfPS`:S?*i2 jDp8ƣqZ0n+lT3@0Z@ A~b-' +ÍpnP^ $@o(I8ހ¥9&>e ,2l+L[mBgl9F MIWR #^g&.3㕒.LW-!15\(.1 Ig)ֲ ࢣpfgqui[Z,,G!¹p9x=5 g8g &sk˲wV_ѯ#> _vs/'7.<+Oqd-{Pk6k1|`fPx9KPN).U-FMJ 5N PeUli-t6U2`%|4N7F;XcVzΎ%udT]Tev+(STn= -#HOdkP2&U=SNTmRݫ4l8Q c\O8&5ԭ`#48=EYV ,OFZR®'ctŒƳ~74?ElD|| 51 `HJʣ.xQN6Xo7 gF 9c6ةǕܗ D 3RHPǎkJ* bh kRn~Wlщx=h\oQ6eTqqSh>CZ5Έ~Nnd #q xHҫ"r@q*d[?[})S#&(nn$M7MvZuÅn|P! -ynJٌIbw]׋uݞ̚I2JC !qa(r6"E9+Tz7!I&֚Uz_{[ܓy^5kz]~[>' bvTא䀻<27!j"9.COj02r*P;U͹s{#ń'%']OpJ!bBBS9%v|RXɗB Ԑ.!mpIՓ"*Ӛpf/4!@ (_È絅bJC]I4Xvf2 " py.DpqP\g :SهZDzr6X; ^qe/|߿ Mxx;uv3DzLkq9z.\h49ǭ۷}pt:%ķ _xg{mv_S_!Ǻ3&`{{?~y7o1xǿ~ z\~k׮3My+^9,c=b{NO||?#?%7|͞~Yַ~=~a ɔsZc,1H(Y=¯ZbRY2\-u]3Un:?ރ Ű`R-հUj(V{V,LKp T#¬HLZ$%$42 Z/Z$[8iaڨgY躥 'ǟL,7{\QzO,-VEO)Ld:fXtYRH̔iMrMr28K%j4BAN )9NW+ш0.ZadiVKh \Ua@P [j K~J޲I :Fa*g^䮫>Amg{RMF!z]q,๥jzp 甞_qi랲qe9<4q;<{ w~# %#w/7+O5 іp~xvBLMԟ"p|\1Em~ ;RR ;,ȆDtԓ;\YgD5媆.Ö9FɅR4 8: $ .(n޺[߳NS?99䔯_G/s?u|/۾"/xA>5Bv||6=w}XcOxΟ|şH>}x7> ?=QMm$t qLRnZL$cJ><_"I8\4Ep$Vmo nx(z(;H['8YiSsRi%JpB HݫܠmmrwQlH#1Hq+ꙕIR@a ð,iJNʶEaELe_ר^ߣ>>dbY8\e#!X cY^'.>>:)/ww>vdg].؉4@iOF(i$fjGlB F ;^eb6A7dmX! [*4ãH*Ii@0)SO"hpUlGzF^S퉺ɒônFHt;U6Zk')&ӣe%f(ЂaR7D7I0m"Aat@Y&UrПj OZ7Œmn{m:LSFD|\u,%`ĐfcRH׃+h3HSm`vB|%MA`rou $u* 4!B5& #np!ѷ}߳WX7fy>!B݄xJEMp%kYJ'1HޘiI`XB2٨1tvo `{6Qr CK$(& H%>d_W1Ŏ is;eF7H:W`*$l9 F =y6A_Ϗ|rrrHN=̹}&bڵ|O}t:@Dښ1/6;x5St]ǽC/ _'bo#_{{xӛJJ7||UG^B.^8h4"j͛</B^y{%ybT{1K?4L<'L``b-.J-|.@jSje~g@`[%[0恜d준$M {!Z#v A7Ў &Dǘ.&qi2aV>UL6&Es(8\ fB2+DZ@1 8X41qznwF]V`%gN5H?%9] @;@j"IՍU;fh; 8C̦;T\gH[Y 5)!RB٘.PS社]Y@f ԋ2)^S5(el3Q85pԪF ^ve>5*/ 4;DAQHRL ] nxV)<|wⱫ+9 Aڞ(C1`&PMl}-4H;#0DVW>r%I !2^ n gM׬}bjv xLkL:3TmtN6M 1Rĥb8@('++Qm[3*W5c{}l4 /xA^җObg}ODNO<<3 Fu=w7p!~M]_>~'n`/w5zg|A9g9>9ajH =>(SM}>0~{y|>?~O{z|iNNNcZÛVw#|h!)CslBC/[RH yecb0L tH}`j-gS':7=*mGPJvH7 e5~VB7MJl6Z!LM {=]J1NԗP[yU0<*âN N+X07*ro׏7 rnVq4]h驜aRB5 fT t$ eݫaE8pOԐAgӆB @l:0PO)Ѧ(+x?֦q0 6 Ы6 '412+cP6 5 =9F# MU9˨Ё杨dLC De+%GzE:d)l aek*`Rb@>%K̀kѢʼncrB@{npSOѻOTSW!eiBO5X(] ܸ*SU!W(5 1M(>n{pDgGrGlM:d fwgk60UtcUW)%EsuSD( tfo6dFJvwwxE7|}.'ic h:uIy* i$yOJ&еu1bT\c2F_8@>|}7JCM6)v&|DR)f,*iaĈ]DL&UDߪ>hJCOyq-rń+g0QFBuI1" z{PiC`Uؾr8mBBBD?(9Ҡ|U8_>°!H9iHrUҖb`b(VT2ɀIA *J;9Ƽ=SXzɘ2`yL!_,"^ b nOyϣ/҇@c޸J2FA {,$ _a1M!KL8(F+OC@U5j &$D A7B^` l\ɀ ~ #񛾕_{׻~~秼_x74m~w/+Q?Ǽ|Mu|۷#>s>mо|ȏ$ϝ۾7Ow7Q?r2~k0y?#]_O|ů {oϽ?Y9گO~'~O?blb9clUb@h%^p~Fgq2X:u5bH'<1Mnb%S#hNu72RZ~(O^PB0 ia* J920a!Ge_{&+`8md +TeD/ݩc`H#-vŪaoE}4g-(:$B 8# brpB-'8È">Q)t}/r0Jڠ7mtTvc-TN!0FUs+e8sZᓧ F5$ VNmAXy|KC- cMT,&Se4P,@a w4q^-)&X-O^7,nvI-]H`HECmhĭCr'%'mx O:h}]3$-,nZ$/7%/`2.5n `B$i&*sn UbR x$5{<8$1`rb5.%x _w_\銻*gޢukr\)bmQCq" HݠWĶP$_2R=)4R?f$ȯCRP?Iuհl)j FAgkRY.7LC.,Ю8HXtks#4"2~ y}j6!8ζW(Nh·,N%>lhcMTVT,"PF .ʠy1&L4&}SW%MӰj{BHH WH =$ 緶UW,NNXǨQ$YnV6Dt":*k *TgorB{}^. Waac8t;JIB1S@@JM K_*{>\>YNM>/uh맭w/ec uE,Ja6B"'zt,rBHO! 6b}$Y$\fObL(%Xb3xS )x1GeJR` I\īDD ɡyә 6Dx&x*;K<䂭YIF SD#4  q# =]ScfJ:}0`b åm|pk nP =ǬٷXf/lX%G6x>Mo~-|[xTOy5_W74=w*_^~c?G|b~OoyXO?kb og\+<OGe>s ||=?G^7?}\M=~y_gaNONs-w~7Yogf>w?hB.͘^J!Q5`8jS f[$s}HEq9t),*)r8ufUUHQ!o?|c6RXΛi+(F53f2-UU;J'y-70oaJpv\9Ռ&81ٽp3N]:J'<:-WFC:/=5bZ3¹ wG6cT4w4C$c=wof _{mMPs~֎e;B)-2IH=nъ#g 0^i8G>''ӆpȧ!|(O1Uή밗u f@Bt7"^:GԀѴ[F^Qi+!5 bpvucJ;,Xk1(Jl6KxrߥKFpbKFp̪VL2V("RFX] "&j @:pQmbTO/!,a͆+R@}&]tY6;ŔmEsrsg+WN\:mx 55% ^#/AJ2IܭǮn`^[!bBH@%/pu!ZIpq)PhKǴ2¸ Rq)X'ӒYᘘV]3EW%"B8(i_R\fβ=*.u\9:w=MϵFefj(la- $J1)`B +Lg E*eDpTMa V }G6M@<4$;ŏ.#[J2%I,&qȍBr)"h[c݌!2܎3_oh<$Ț(ja(wu;.± =s0(FT3ubP42'gD(*?%@Hbx[ҕ툀#$wSŎ"BxW⋂ RU G*n^cԴ)DiڻfDS\H!=YZ؀:R C!j-7Yބ[:}|"x j4z_]$Ss V-nG|*۾/?˿O>4˾7q\p}⎠7* Cwui>>/ܹ}zO|%??̓+^27-{Soo}?z?U{^q߽#ӁCL`kkP2°E`AOl׆R𜝁hjB{Z}&R *{J{Xi^N`,"S0芴C&cURhV3?p)7OD]qwE2Ƭۥd?H"{mh\NQnCG=iSP }°u _'H#4l f N%!ZaRrH9_Е ތjaR';H6CV2 &đ,Uj {\}R?S ;Y4D\pt9þl vKƨu 9+Oe1gx-?Gt2wQH-ZbG^剾)S.ㆹ$#IPر 4‰G'w8#8gS\80'+ۣ|ֱXa用)D=G|dˏr&6p2FF!fH*7yk(F4t%-Jͱ{XUZe+m( hDVEFz #bdS})1GrPLK*-qt2xUErSo,OgQ.DZdz M)`L%YDVKX 8BNVoUT(j9F`ªؠhT㛖4 t!HDz͏Bv4}O_XΟmNچk&ú!Fv) Z ڌr%ف 3 a@lA,jMi)eMby+a-@#M)b1#m5`OI鋝?܌hnA֛賡ܨí=K,4?R!uAZ#nyHJ_Jۏ֤&>sTVf4F8R`H9-cM0,`2LrB& b$$'kI"!nJbۣzRVJA!k%F%4/ڈ :C$@V[SB宑c`bļb ?z L3BQgccxRCLتt R l Pl1_|?\ʷ;_Ow~7mOy5?uftΏOOt|g|Mc?Sǝ _GwI:"ޱ'D7&a"F1+LX-[a^s D)á)SP8|gk5/XMd8^$v5 Ҝa{H,{ŰN(җcIVqj֮vm[BgGbnjag.L Gp蔐t+3."? YAk6h kD63>CɊ' ?8ՂNWNMRUYS@#m62hJ >U d!(0VX):QtiH41?g>o>̳.RSW3V9HAl=m# -C y>1+ e5:c!UKagsv+Τ_RD9=µM0A؞$ O cXup%yRyIx8 ϛSENJy6֨7oǞWeFyry&ctQh5>NZ^lf,_zI/"$G26bb:R'ZJٲ|I{}3Xd x[} Fӑcj`5Q60"j-#_d}z66aALohanLhOϯ_@{;WzN:P Kxk;=`Aq[e3M=:NQp`\4zӒGfhmZƓ<(*LUǞخ瘳6 *if@7Ev"+{lHAtKU1PW7(]ɸ4%:<%zHM0 0gP=5>Ϲ 8m[>NNNxM:bDYY10I 1oEŎn`c1֎WB0SƎňZ$vRY$ƛz;Fz FXM0-&Vj㰖CI"2%8qj@,NJdG8 4[w!sI![v}m+y &t74o3޼$DzRh f]~ŷ A a}buT_J=Dbr΄J>:A_62VDbt`HXu3f| j{ Ja6AitYMZ5[7-t m ([%>m(aAN9REdsfQYX빾'~k~ޏO?WUC>;[w`doo7l@^I_`Z-M;I/H]| \L=1 1_o}i^%9 ;G=UCusLZtFmVC`w"lͅIZ%l& oPy H5KU4]9=1aS d%U>)\ۨFftЯt\:G6َz=δw<-汧"}I]i[İp9S\RwbRR߃G*yati}Ċ<D)!bw=u 5b352Uԣ  DBĕw9Ɉ }[tJprʣO|1)>yvMUF3&㚢*c˹ > }R8" [S| U慱q_Qw2T]tӀD&4t`IVʛ o?#-ITDz<(%4aq`+˜rt>OSn8LD;v,ShX5%i7Zȹ}xfm%, ,< HݶƠVY$X"BՓ$mHoY1(OBQ:OwJG8`-J yS7tDJr37YeH b(XܐeG7P81c|1H@Lڰ̧JSDeLD9x(Vc9la4w7f\!4B2oC}$ń !ɯi'O x9zM;vf,Mj~-ruP`6fֲe\=3p~o ѡRڪ)[-nFsKh9v/k@ZǘSPې#N4svWI'vRg_?BbA56l=@*L"5 ;;i>څ}ˆe )21kmPcg-gaUO&kB U_zi{s8x' 85v>̪ h FTZ%>K!Q/9&f=bkR(D}VQd2T n{{Kd,>&@k!.lG|Kg'dAaDe$bHf͞=iV4%HچX5QA3VJşLk|6ZY@ʤ%o!Ƙ3"+͟T VcST=5E]}bJ Y>ydV>7j=1.MBޜ$)wQ%Gg?m??F"500=anzJت+ ;iVNw ݀ ~A[>"%m<,YLhGkTHPj+0{&G~AUXCVDNN3U,-Yl=!K\ʡ 1KSiQX[% Œ:tLÖq5SLRkAjx 󤞉:;f1"$ַF'Pq  QyCU(2P,󷎌fYf!jZ-U92@m錣&SƨcJBW'aZ9Ih -ʽZrr d4.ቭe~j=h%uD[s7;aul-o&򑎗$*d"Ta 4W"WX}Fwm1qp}8,"7^_ś{b2x- "yLLT@Ymbu&3Y )7kPʌW]jeCגM`Ki^M۶ CaĬܥln3*ww f1C=~Q gڎ=$7na@i !hѐ"bFMp0D9 a.,fU ?jIDO43)f|hc6K&RxI,-p_kh읇ԭ6l^8 8K:!Dw&H0N3<@&iFtD$1F21C4 A&&Iќ!1K#*v:%a2!YKx /@ﰱftæ5BIj˾фwm| XL&ܓ79o ^ >o}iÄhkn+8yXEJ-&17WO>pGsnrmp@vci"-ޥMZ,{:5GXm &j8/ 5>0關p~xu2EBn>g/WhXoz8 B{/34} ªetc׽0wW;ی+&PokC6$ n LDEAeq&]of|U ,\7+VMe !EBy ,MFd4DCSdr2USzRtw/:?e8pҩ% Vg#! efM92iJCY UoX4kb(>C x󑢯X-=1-@4-(eI(:ib9px`9o9l[8 wU]y6@-`DAHZF5G6آCHj"gE~% B)V ƍuk,eUL6¨ښ0L+߫2 bw=\}dc=3m7ֱBOIy&"AFb]@RP b&z0XJE F2kX\3CkVtUrU_/|HG+9{ɞ"r\Z$z HI6 ~Ra 1/%ԗgc I5لS5'&&mxkuͪ~WV4, BQ{/sz_}ߌ3C&pNs-!t8Ixkz$PX3ONbA״^m`&B:&@IjVIEhHĕ(2Wb30drJ@J?'hsa l :#.ɘ_-@%tY ݄ŝL6M" 9gL ]Jp Y&Bu%;x,W-菵i }4i#%%Tg20qr76l9ɢФ $$Șȗ#~=,'UQma5ۛLAaZ3, Rocڨn7ŷwp $|S:l7@[ *܈Z4^7:bLϰNOJ#CPl2A+34`;qEr1)p7^E( 1<ҶnWttѰL:l .CPHH+5 x6~ʕ$ߚϿ!~'x'}"/5??W}+Ϛ7v]?$񯒍ͭzw9aZǩ~x}{5m\,Xu 1St0!5Ua ;- bwZ݁}N޲_^ Ihc~XS2tܸ(8EboP*/t(6}>ة{(> zÃ[1ȞYڷ6myz%yL8gn沃dcޅlTiԨGƕ@ gw[蠨rPkq&R% VHmQɒ^9+1ϴ.YZF.K:[MӨ^I*UŲ]%ma\f_a@)jW3aԆ\fMƄ~"OmOg|Dxc(O* ϖxcySuW :crUSܶ5=3Ճ`JkVGMϵ~ڵ8RwOy}~=Oqz/8ل <2i/6tndq>eW[ /c{A&tX,7ub:A3՚rennc6S SaHXkF2kf5}F&&SʉۇOOB*B98<[, r9=)V J[㳼!0-WXW^խH^%h8~,7|x,4Gg$"҆7D'É{9p>a-2ZtC*sNIoCC,zRu?MA 3ZY~,FM`b*kzKKYjY2$`ֹk]W$ؤ A(8UY2kom_*`^'DcE7LюjM×/smO7J)ҷ=%nN 岁؛d8p I|AL JLL)$M2BPڐ-[ 1E-D)"gXbW0 HR?B2knHҐ=1#TE~&dښMG7əq^7n|H9fm:(痬E,Wd2+Y=@ƛk DZĥ7E5|PhaC"vvc:-;{;lPTb(#l! a^'{$YoRD8g1X ڐ)otkp>yD}z.IުAlĊ%䡄M:$S$ *EDLn4|Xi>u! HX-*~=*3@CŜ|;;wd? g `Mcx[sss;Yt]۷Ii K {x]qrr\4=O<Ǩ$# s.1]0/h6U 6} HDЉ2_ԧZmOv 쁻)r6-']`d }dgmYy#Qѷz;ӣ׬bRnfIE¦p!g:潁 ]Mu=3a/V]N /)DhZVCV,]XJ cL&̚9>c*эJ#iR[؟8]j잀f"傭,+8$X6!M*m@P©bKt }jG2Xkyzik\p|h 3? z?̓ j 7xx<<(Dy1NѶ~ ]ys§Jk$4FeF'-8%T$L򚊝E9uo3j#BX Sa݈dNJ- lN*GU:G5;[li*u?_v#rm;(9>cg63* oݤ:C%*)eX\Mޢo| ZXĪ4xʪdTWLbɨ(Y ib 9Njs}dUo'!y!g؍(&xcRkzhABTS3yy͂Ez)_ ʵķHR ͆8"U(~u! rRÂ6a:jT9=d kW2HI .u$A7uI}"HS%a T nW)nkH` ,+I/2K¢Ѝ`FY r(sH1]$S9?7oY>ćFlͦ>^bj] O_8=C?f`aj:2lKdls#\;x*rnfXJ+\F#Nq6`gLx!߾nEN1go:MWML6±}aKԭHAhxF nU9-a}/тZl=Ƅl j&7S:3G5g 6mCUaՓ:qd3HK.^i{f3 ,bUÊnYN;OBURx͒[`yk4A E\!X(f(`1D(lbRT@]5][]ZhS(F7nQ*Nt V5aɄ8-ܽ_@5UX͖:=arLW<| oMCח<}hp*x={ ~5] a;idFG|VdLGN:s p w}|5yg:$3>dDs>S%NC0,:<鱽'O]ZBH4CG\c+}˪[ >QUU!! Io!{[IN'!\ pdA d̰:4׃PY"}?ЅH*ueNjaQcLy* [N't5pۈoWJ_!ySrg@Cڬ෷H匸HOBi0".V}6&mBjFؤS'E& p{LQjTJ#4lE~`iDN/!gf,Yk)rׯ]cqzɪ&o}?cb 'V(H&%_PYdoCRӐ2I)*1ЫI ڒ`+ĖFrR%Aʇa` փf!b2Z'6<ɖy 8Abbemu9Zo(<z5"nK¼Aə&N/})'KoT9_ -/Lnԓ'٠Y!~{:M "ӶPM9S`&\=b(sga@@MxFnbHy NOkyDP7L-B4sr_Ҧah觱 9 5! 6iO:eu3O.mmkJi[mrL:˿K9|Q!0=>&=y??{(?֟ڵ|ǿ,o|"??7}}y=^j5S,2,HN%z޻1`\8kGmqbXv`:U"5{ YZ<j Zi)ܾ0B9@ ʻ}rk#Lׂ蜁ÃWC(=q &LZĨ~}Z.FU A }L.j`ĜnZ=~^ӊ)5۾O0B \Df_~HdOq:VfIɯ/FVJV7p#A5a.%ao #o;VmCjX6l[!i=)<Vɏh̘"D)_QJljj_x7%5К!hɾ #J$^97o7|AFԐ T)iN`U)tIUO*X?J&W D1lږdF@\&Y&hU;CΓ^\0:yW"qH6[4:h6wLa[EfpV/ j&vICH0 8cU}ނiQ]$ÐX.qN]ITwM "k4OLI∦h-M"qєiՍtbVSz|&خUuY6,C!ХrI`ݒH ][Kخ B/YП$7R]^v.qvީgJblOWj%p&YSy {'NV;M+^DMD,sslGJ+wpuMHDq6tjg1]D(ۄdP0(? c2!Bҩi#[ǹ4E!50݂SG97ߓ6x6f)JRR?W2A=J2K.<[{C>@`Jl idޑVw); *o51}9~> X#51Б~L&?? ", Q~籿]/+OgOGk>S^-y{L'c[oAķʕ8@`u /zNDp#m2t h9*"7\ w`<tC[1LȤD;hRiZE/ni mFm]4 CѰXbB8qa`ҦbV Z.ׂp"VѺ?kX$aVB`P*ge_ha=d_vc9ԭ?AֵJF%M7 >SB 7BrII%p~N 0|(*}J4h5 "WqҤڨ,ؤ\GVE6hcEp"V(PZDa"!:ZQ홵ĉf'\Y9N>tzW4.ѝ2#7# kRˆPXc1WM(pׅ\C9C7tӐFњ4/ !y&Q[ _i?C> .꥙ăC|V+Zh[5G*۾WR|DQ CKMhTUX[h"lYF2xw>5zVObB\np8޵O@Ȍ7Ra!$xVN&XKYb|2KrܥL Q͛7XWi3@,!Hzm|KٱhM|OжeVZjA_MOĤ$nD7EDS6N)b+Ij JDLٚ !{k/F€MISލY2E R$Y"y}WbnмMkO-,R8򲝆\>}[hhW㾭z{l>{1^\9ht1xRUa!-ĎH΀LUv͒5I7b"~|nd$O'RPxwlɐ8!O3B4pwih"7a{:0q'E!uAF;s蔄F)F!LuqOs}Z{=͛[g+)m~򗽔=|o>_=bz~ K~}?R>ʫ?8n{}$efY)6?q\_Y`2!R3?N<`*xRtSN`u SP.CO#dI4؉2֧S{{˚PƵprj1;5T4T| H8I b>$˖y8[&#+Lana0ChŎs`Ӥpcn)UK,:/e3ؚS2OrΓz?79P3Oɟ>|L1$7 [4>qIcKo*6ӑ#8)ÒW(. 6aʬB2 !#90$,-6vı[Oy2ChǎgቅIvK槼Qn!]5ӻak`dB.'@~Qlx)ꈌsc&#5G S}>J^&#qe2t1~Bj Cq Ra!&l|D}AD9fG&F;X[cBbĄDTY\ 8߁T<т3̬j`u=c}tT!ƯӉ%ot]_U~qZ&dܸ7=͆ݳ-a !7 Vx2 !JSP-UILYTX,dl$-fM,Y G4 MRf!20Ra ̽MNMu;uwlA$=L$S0_)GZOLӋ =f|J`G5iI1x]%m<0$W#ƗIe锤c2Ψ\4g[Sfr "lO됗/y9ͺH~be^̦>i7"op~1ųeO[aFI$ZMT62$0+q=VmTRl?h]K_$rVmnZ?t'Z7%.*2(?x$oԔon>x}=ݢ9r#} { RHV[Ɵ}O-.|yϾyy, KC_׼K_q/Bo3] y[ƭۚ=?soy1;^ǿ↓y!?soOOyo$5 R/nrտ?#n\GC\]Q32p●5Z v QiD%īI/G/ќ{ ڛq]O,-aEDMŢ$D%lEsB~bBy^S?}MZK̰R*M KRLGBf?sI͊\vD G{wN^c q\|LL ~ق2& HUңe2 2+b*!BXV~`)r:=a9aCv RI<'ˆkRa$ӊ>:3!i\MYK["" %&5/HWnG~t; Y7Nyܷxݧ| o¿>>>kx|jD5sYD,&Sz8ͺ h+ź!&L!qc5XL:UZ k|sFtӑaimZoDɽJBr6GJz o@vi DV3]?|7fazD(Jk*XE &X=VQ֙~G?g ,  [.>8UU~_*>UOJ_Џlx>''?s7rG{._4 oco.CH?9smG}Eiǵ+-e{Y$J-}SֆMHHtf@Qr@E}phBu'pqoq׸[!eF;MH T^k`d! Rz&D("euz9r_2{Hٔ]?;eFg-b"c=h_t>x.*$#BTIS.r-%py"5jCC>n3[[RX}RP계FQ#{P*ȴptVCi ۧ,c EvwfY~ r\zW^婟}G@q C ñ\KEMs*O]>tͮ>IZ>\c3G=<=/`.V A81s'_-4#6@i777lR0Mn;:$5*吘N 8if)Yv~C'w{)M5{|(KBw>d>#b&Ko*&cyBRŠDcKˈFMko+(2xLADԱkThć_GzÏLks!-T(ދN(W,ە7&]SȦ<h~"ruؘ"XQmɴ,;t,tu ) 1CnZN',22S`b J()1Vr"E$:e*juW0 M0葊ST´(vX-Ј'U1d9X35(2h+I엨+R` t8qK!NQJwQa,ܝp1ObS.sݾcc/<2;{87RAE:8StZKZXB)I 9ЌgRTh옧s"8M2N)4 6)h!Z®fIE=OybȌ d]OPtNq{(΂%QEKɤ%)40ҹ]$ueVQF?[ӧyo}WqE}۽+ >~c9E0׼k-ELI8=p4?ٷwo羣Gyk^þ!\k)9vvm}d2~? cO_p4NĬfg #'{]e\^di:`vh_cqoc;;SaԆ4cO_COC4ŬHU,]I6"`.=K(dJ`9fyEaJZJFJm3I@D6*[.bm>B,){+^APZ(RZH~Uy:W UZEI4BY%4 BQD1*' Pp8eA"n(I^JMa.W{څՂrh舮#*qBɹD#]nV1NEdPsW,Jm%Jg -6$h02#8ѣLS2)aCfZc)wƌÎc''1Y)0=1)iw'ֻIDtz\H9zR!nʷRwQ/%JEX!vLg !fT%J{$msYjD^[;숛I1s!'jM5tB3YEO[&:4$h3YKI )s#y>SQB%EqEjkbh=JI:CZ} T=)$~{[ ]f*RcUڼq*,4@wIBvH+ =W^Oz7u.%Onwmz||Βz-G_fn/} _ѿ1O*g ]ݒraB/爘^LSpUiP@UQHc$ ƄbлM!HA1Z Cfh":yt#G,zцd$[5o3 wEdw~x߽ E~g^)oxGݿ0ٳ$VA;X^Z{_}n.sc!x#|Ct{=ќs~/[MW lĂPʊIqopFg98*XVXցB%nۂ{7h TS!p{6;.f{JI0DE6G8vN 2Жn")fF!&g˼BIn+e~bc8p.RD9rWvY5E)+Nv"IHZu+J@-dV6VMwd!2ȈyK >jѮ@HyUbժt*K /^/,r_B_bۼZ)/e0e4)ihk( Tb|A ʪCҭB+yОMoWGmshe{+qz 65ܷwlwNxL8pʅk;Ζ u,nx<93w[Lh<[ˊkkt%hTX2r5)|HlrBYgݕj+vU'Ey|v9Bi=HM+Pb6, dU՚Z\۰i,iM"kvCַPeQV(VΎ73C[Z wl:&D۽|:eJƂah}9U-1G8 J +.HP٬Qa8c|4 v2ŎF3&S̴8nt))%t ŭ,< ?\i#"w[FM 0-I1`}R|t!~_YBGQy%ꂘP@DJcZ:]@ep4ns83 !!H|3IM]Oc:Z228u&01ҐU!KT<>9cMk\p)ҢpJkZmpw*nmߐlIz`K1($\Blt#N*Y RImrpfIRtJ (y_t=/x?Ʌ b o"|GѵlͳX ޷B~rX1Or٫>;u(CT.lo=!ng 3:8s$n16C22fCmYSXj[ӌFkQF@K]sB])$la3pIFaR!˹ ?R| SN=?|3~xc>zpTdqqqwJj}طoZ3 ?o,,,̯{:/_s_=w# /z'>!ӭ# ^O's?g~z}łTxf'tX׌Npfkjd@'Kġ2j4LJlhnhQa%[Ô/%5R)H't6l#X8 Sm5s.]*5&:g Peyrz"`% K;2Zqa4 W "4H5",Y0?/1[ن<igT-,Ԯ}T66Ufg(:~V-4o)A֒4I_k Ue/t8ppA;_ՁwaUZlLBePd6 5YGJYTV3(+!F ]2R k4K bc)%o5'߸7~\X."N*NѬ9q?LMV99mwVՒ\P:iʞAb1N9NNuZ`5iܩ/X<!ύ*6֡*q>{nlsC,!'ݤN=Vap 0c.Z sd;"wE+<_\3##Q.}vP&]si+ DW $ҖY|rLֆVah<KKZj ydO}{AY+PJcC2>8 &QnOsDv(MB 6eQj[ww%A:y8ezX6K&G$FK -E@*7ycĄ@~$^'1(=H̋* R; $?EGX*#Ba (3{ Z\{)9v&ImȘՌv~>6}8}2ؓWSap פr q27bԨ髊Q jnr0ˬ۵V*p (w lܼ!i|l8 3x 3jHԸsvh䅂| D®ŰJ@ˑ{9󿟟}OO2~L>+$~ϕW\>!^W{sӗ<{(>Ʉ`QӗrN:o+yk^`.λbqqxqW'| Ѷ׼u+~?rӿWďKy_ً< <s-faJ3ZMPISj:E+ mɴF`q-*ve}G165{Op.Or}w!qr󬢻ٿg՜8z 6= s.q|'pMQ+K']I#qcNAk٥]f\Clv50VBRUE3t%ˣNP䀩b CyQe{{֐uL&5P (ؠ1fVƔɳj —!>Ix#%9>X =̿+HFU%sT쯲#F[ ڵ N9qM[R$,Ny/L.NXi>x|13iwB_}W_˧_IB( zУl)Lt0gG,˄J=옝ibJY>(;) |́0I-Ja3XMR C,Yb=^d\i#V"*6nO]o^?gɓ'yw?9<19,~3[y}c,{+.璋/, w90G=|ӳɻ> dz??Op=.=8[D)59FccT1Q{RJ{C?>n>x{3[x̣s'~<.!JkV+YXXw7?}'O}+ThH 32BOqtcGVs Y.YRpre Nn찳=K,a*򍤃W2[8[.Ѵ*尅{lA: uaEN߾xBiRVN1Kfhh,\ܤ)r\]`A$:Ўm @Q,+DuV\T<J;C1B26wG86^ff=,8 i5-8$٘y:PQ6JE/I{)LBfueB$v8{Rą6Q10BEJzwp 4% UZRh1f m+)vPX\JD]CиİP ݓp5w_,4|w~;}>wwt: jGE):{mqǝ~ǝݳ/ /w>ΐ%ĒrL/"x?qn^|8+v:Ό{2ۥu`XtfA7-FbyQ[=Kҁ"t#hc6oS#Y8a8+9~qSO]Bo nlrjff)*b:7UK*ͧ,T 1b,Up~˻ ash_z6%q|㱵$L~)kas8~B9bfuУB):梆SĆBs\ Ke~ڋmFR!U=EDWD!& eijWPxM]c” h6Z˨0j֝A1pt='4'=cd"hU'p$4UtOm-Sbj4C /\x}'Pk3`&Ej6zds穙բNf>J&1Hx5[#Jg:6dKXݾ\"3_H($)e3DAEx ps[XI<))FHIS'qjLR0JDbq~ ;gs]f8PF. ѓ\+E)E'R,@:0Ģ -LQY1(VIPZ|HBF"ᚚbZ1]Io z{pgpx{D ?33Nd"C6Ih'4cI4E&xZu0DDh |]ƒɝn$7 <ؼRᢄɔ4m]NŘ:%"j2A))ԘТW$]J2O4S>`G7ěOm|r3+/@{f]"GE1|㳞Ssuxም!w'N?뮻﷍OPV%yx߿|Cbuuxg˟$n ΨHJq. K8=j8Gc86اF_89A.){hE`U 9o +dXN=HIJA9 0>&|FHh^:Wu&(D鮧u&F.Da_[hp[ y 霿͌IY3顐+֠Pʲ=ʪYjdTSLI[ط@ml.+yz )``KQ!X N-ekE3hzbAUt)vSMv;TrqgN57DFb+S^qv_]NL MG`J9SP줂Ih9Rx7YVH8Mܸ)(B2J)cYR0 (Đ0;{ {鶌j7M3 ?pn,#t 2>b4etIys$L* !Ƞ)dhem4&R"$!ȉ#R.1*&T,;{,PZ`c&Ɛ ;_EHLf1?2S`׷۔ </ ѓ19HZޓ/9Ae^x(95ߋ9I0k L #|L[=li$O-J0PLA&mZnP'hPAhqB%:94ZFQZ%9K)L)p11jZFajwƲE۴;댶v.0鴑c%8M%%C1D4;P”i\P ԋV"V3|e-nE?mP$*4`)zH5N[݈ c+y[ኽSȷx1]'~SG?#Sso߹y旼W %R\3AYgyS .O/4x i^|%!H0FcpxC.296߳ȣIB)>YS|n2 DH.4Bu`Ѓ-GO,nE PGy1 K:k@٬|T Rw*ɛ[8jĖxj1f46ilW1%LchWtt2-[cga8[T}bÉaM[B)K*2,qDN'6V&rR`x%d}^/s[m1kpBQ;^*kň.PHՌb@ f8F$]X["^>sgN7Pg"@JAKMԼ IIJ>fvڢ1A˕eR>ʔ*urO8w<;׳"[(B}>徣ɽ)S2G۔(]ڱLrnpXh1?؜lG;9q={ bCLd96PfE7!-^ {:ƒ 0> 5|f@njdicLVt@`AǣUAL}l8*B,GW6EWZ[1(S)ФEPp8ZL!hfkk61D%p4 ( "*l~ZIGS2qc%]e`PRJ**ϼy֛Lt!&[ v>99"nm6haN '谁 5d'd/li};InI@3 .}^EqY|y*wGIƔ qMmі:Ӱ(mhHe0K&[vAtиChϞIH)ST$J3ϙ4?t`{;yի^T}~7^?]~EQoz?/#Gx߿}vίj~/[otZ?<~W_3T!%emq)۟}թ*绾-^7|^/(mt8pbZT lpqf8:־+q'E%P3JEzɳ4ɈCKҹFc6L-mF Gkbh 1d`*|)E댉K$j(p}Q殉by)+CqӰѰp:aR961z#VNAqD;9qQμEx 6gYf7Xw6ڕY#%6Ia)Ӛ|:fHђ+5aHZ SAۂ^ZB"L1L*ጤӀ:G&4(*ESRJܟfCr.d1K٧X8BD/V&Ζ-)L $G b3ⴤȦjm@0P !.?(x,VpTnxZ4WtP~Rv43R k>*}kXx|tn=8v`w2 Qcz!&4Tbl$ZhMetX0X.55PuI.]Yk\Q@]ԞW\ݚzBhc>[A|s;y[EC||Wp٥W&kj!w=#T;,=I]L,!6 Z- F/pb:&v45#.i4o҄xبYۘP#KtPOa8ؙ-E r8!Ƀi`Cn^G%ċUk Jl酋";Oh,aeV*qS-%djasӲ4dD51tD'>H.f6Bk1_N҉blǘqvrMT;6Һȅ װ``Jt;-SЬ!5$ll.:R?4JI4ƶVbb/*N&2r-ZL:' ;1щX xkC+EHREalt=1{wQC.Xu7npʭC9} :>bXǰkɨ5JktD{eePFDC(orA%i7Ԝ:ӊT!wWC63z4&%̂*H7f: iJJt(߅ 1"g Tela8՘M^Mh)}O`d@tgv*$%A=}N6Xg!yven-d.wPL/w8puSn`\r)}p:,LEk3JrSE,*+a~mPF ٢f1Z_ƻ~BR6ҠEީHEŎ3N!4?kLXE ~6SN 4%wmd"UTRL%c`i ׆#)ѣGąHQ>ЀY`ϘPG(K@+!NBD5ED@iHF!*bÐ뗷ySW<`@| V.տ4UIk۟)Ǹ}w|d}ٳ~Wx_v(7u{ӡ_2St-߿w=|s'~x[F4<1*{!Ʉ?P%[%N.倎vCT;"Zj-]E ͤ5Gc%[cEEu L`i8r(uhw2#Vv~Fqω$f{ÍLaLilvFsf5y:'&|p^Xm+Om|HB"B^RXI,TuSiTijsuNX5͉Q\NO!`6Q[(Ub(U; J ڼ iӐ2t lZ5FB"8=B&5@3VBa4t$èQLƆTWXrr+xG:GNȉ8/h QchaPa&ƭlHԁck1nX,=g5&Ch"uïp(ўvC ՍX0݄\ h(} ZF;M2=bxP* A)Hҟg\$ֵ^vRvdYH^%Eƹ VIƆQ][Ea*91|3RrR u" sDE&?B;!?BPɢ-1z瑆w9u>){}X 8s"j}=!nePg!gLЬ:Tf-q-"d8iRc)bl%8ƄcJgQ@DYuNNF= :ki@M 4NU|eG䈦CNL+<v|")O.]Ei-NaH4Rδy|^?¸%)OPiFcRÏǟ+43pOA>u kֻ\\^8cBnD +FVhACYv(.?N* k,$JD X0ja5qbs\i~7S`#Q cҮev~oWy7}#_ ן6z>E_g0kUZ,yw cL=zC[^^=hog׾͡C:O \so6ǎ`4ѣR$ Oٽu{ 4a! 55\zaͱWlY4 7t k1qd8d0ږnIo ,m0f\ TF&[`MI&!$2nWJ4Fg` cX^P,M@FJ&,B*WR׽ލ)qS^e1z˚FrSS5Pr`ksQ4GDWb$?{/pQM.=u`:RMR5C( e FU25&iz+˸mQdI^1i gZ89>mUmF)ta4Q]bmgp-XT4; -װ&rr{9qGXq`zF#F2&(U4rtT$ @~J?IcY@*n.ˣF S̈́$hIKMIHVc`_CLfKjdU"b$hF)>[Z );=KRC9AkR6dMGyy]y_5"dʝxq 4ے[T$C;]")IeNwe}xnC}4\pXN2#^'נwi|SIA:>JX.za2q $G{wV&1vF:w ڬWv~8RjP9}4+["dilsM@ 4U4(J:h*mpɡEUB74)Dƣh7BZ''7DRKJSbDUlA:Kjf>"T"%%F[9tp4G| QR˛fC쥠g߈O&9(bu?}ᷟXъEn~UrWd߾aFTwHizwt*OD (t }x)I= ;HeD3?R[4-;Q5|Mc~i-;Ԭ\APܺ9r/{+yk믿.R676?=ࡃ<'~)oyxz?o^5F~;NK.?OX[_?S}~W9-[hGvf%-BA`%idӡ}wܵɣVg`Ehv,T h 8چ;vwK/=ra$𮕯b&>,vCw^&YW6҄-⑟fCTtKў5uh(Fnf-(ٷܣ)AX c/~'F|&۳`;SC6$JĠI} ' EBqbtiHqr99jΡ݊)hE0(:N!bfUUN^OYXlJөb lez<N"`=*qMG(} 67|yg⮡GǠ|&W2:.{YD+9nYu&7t*9Ƴ՞|bPRc} ʿ>HI SΧr6C WYBa@eQ%`-&HhUbdJֱ=qEE<9JUQ.Vx $.,{HBݐ'M9ӳn|RɉF)xLJb)i?W=G^|-pQ|pq~y\xty{ˌGc^N [߼o/ Uz5qǧOO໾y׻Pёf\%Ğ>ŰgL9pQ3Lۖ#چӶÙ!nBiF!D(S\⍰ ӁX)Vai"= {ucn%nÆ$`"8`=3)sBj[niV+R-N No1pVlft/M6]E1QBM6:vGї(S済 %k)Zqv$z[7жk`Bn>oN@B'Zo,=+ىo|' &WPtO#$vaW|V_ǵxzB1G*X%#mlmLqVIu87ĢI(I&يiSFl9;rSi~ -҄&iL%!r ɄOW{ _՟TsY=O*y^qq2 9xhY/.rN8q_Kwߩӧ?3ԯ~طw//_n~'_t?@ av.ר5{.cNcβ11FLۖ+%G4m3ضVڽ.$T%M}\s00A,VF% N%Nmv#6E!uFALDB-$I˥L'j%:w M`rYkTOְsG֕6-jJ4AcƷL$Ӈu!(iae%!ZDU[[t-ZIZѤtzB5mpBĒ1A5,v`(Ý-" m cL>*T*0h02L5nA |*&cNQ*X-LpUc>5~2,5JuO3Zg";aơiĪY체o?w?ɖWt.}T\ 7d̢uHiFJ.ϴCՂIr?E"^R<C<(9l6z%QP9y>ytwi;眇UBI LRu? ́1$ Q+LO*[J6Dhp8DHbhE*jEК0"'"JA,,IŢ1钔L5H^$3 RnE2] GRh;sJP2S4ۙՅd^fݰ r3%*yJ '͢Z^.fseV+w-NBPh A< d( M!X-(zCX]^fqqC_b,/|d6ήSM)qvs44sI#&O$ 4fP?d`Kݹ(T{IKנz}wo,59+!ZO4ML>zˢ9W%W P&֫:<:D*/?հЁV}BV3g|6V5w}ՅtO؁zޫT?%*MBC Ʊ3=7%)"#1y,- V,,] Q> "j?IMLJ{JBNR[͆srAz W_2^?ίKW_}_/I_9y|?cҗ˝w%io+|~Gn_՗~T0']iOMG+^R'W:]t!?S/榛n~@r?u B)Fde˝B;됦 ɡ()+-[1=CK|*XfȶKbc@ޠЊR)M՞aq!PD_BmrJ Q8N uj3g8<*薆 QM#:BG͓IN#i[:놞m=3XPN3ΓƸ͑L@k4?}nWLR=E`aU+ud<"dd:_BMT*gi]c0T8^RB Rskr<|IC:lNB[WEyGE;Ui1c#iD8 zPE%jRӉ!R Mbhc`<"bÒj!p߲ҷ=y#cv(]hsbnD5$ Q=$] H̖"v>PHLLNDݯ(ќ 'JЬA@.>o&]Ȣk/s*ELxŹD\W^ldVVaπ%Gdd:se=*Awa"ţ"C oe{q5tIL{h"1"t-L;dri=F$]fH3b)Kyg7*)&c}@ Xע{Ke #]Ln}0}q:w̉<22y95|dD5t k2cEW$ l;ĉДcC\]f=,/-QsUWwDÕbKwt 3bDiu4AjI! DHo:Exuff-N/Vze+C׭Q$ '#I%NBfQ.IμW:vxJRlQ8}槿B {$>c>>`3Jm9JU!{##ghk).@`AICd(%5Su%SкD]԰MNH.*L0JM?t'-e<[9|䦛O_𶷿'Oҩ*~7_r豏N =?Bs1!D!ow5W׿=ztNXXC>i֋xW}%Wx@ߒZX4 ˸pҪH^ |; c ŭgqxF$F2m k1rpq;׶Ж[XZ='6C SۖKSSPȴ`ECBL";*Yx= 0FB]SLbы}Gl4l1TӎmaO( F9cV̵S$ɨQe\eHXop$zKDZuL.Fα{c/kFx%FG kabPIx62lUzhl5Seb-.Zq6 Gv8[,sR;EV!zzʡf_aֳ-Cu{ w6%89:_MJ-@cS+玒9~N,# $#e6ڒ>"F7),NV3Ӝ&+wӺdW0;/SȚm F(84U Igp2LR($!_E-!r)--b)ETtAL<'F2S$#d .U"*jSyhd;2#n P>.=H򨐧 Qu펍PPqD_v *-739J̕f>LKĠ,?XK?}Zt& q'\9DN>xF6E)@՗Wj;'YIDmPʢQ$JY (m*Q:bQ/=jǒښR H=05+TTJ;m-˹eDU8$L2%ZTX܊Պ""}5cH"E7Q+{/ŐeE]7תu-u3_xC'<>| こ9O¥ N!t߾'%M =ek(b"L$4QS%QMZ4 v]^Zr+߆c}z9g`Ihu :d5`ͧB5>HZ~_‰'y?|7?\k\2k666-, ZQ?qozӛW?I9y$'> of~_ȇ)([a+.\}͆ =eF1j[aHg`K'6IAsaS)'7dbgn85u:O#kU?O=&4T`ݖLm 4^ZSt+:eEYbKT0%zGht)wY\zpL3N& Aڤ%<%7=9& iGy¹`%+'Lh ' HRЗߝ/OE4*5"gr,Vԙ8K)JȩZl)ku1hC1Čkg7f3 `RH"mv_~Jt!1[+SxR+-4EeTh!)K R (g6Ztf~ T RVDz@Ahqw> k |a]`5Sp#bШQSRX.|ֲ;)S2"bL֑W vD#W@[g+Y')tRDQɡ۱|BÙRIAD-U|`T,/AURM)!:%Ohb2pvqEu]K|㳾i9v\uՕٳ'~ko{]%\RL۬`RL!0mq 'aӐq81КrmɈueC@Mٳ*.>oS>xrIjKr{H Q\ ,AGG%O$6Mn) iDB7H 8S&"wA&DK :^: Rm3+E;f8LhFhv61LXnyzh@'DLiBu \ĦA7YN EQLl* bw;tcbOYrm/1<g=CgڂiV&waKYBEߝdgiV,3JZ@QL< ud$CONNM 3odV3ف7_;;DX?VIZI ʨUY4.?TQb8sp3AL}Ң'joɂ@D yęfJUIR.dW!i#GX #FV݌PJ@ چ>39$g"(cB!&8˶剓HΤmPg'tD?@†=>[2646c;9O{Z~S1M@yPN_qq-=;KbՒ#u=3,j+VW1H&[N]BupX.lXؘ8' s\L8Q;Ssߕ'ebg۲8~_W{C)KB`X~~go|u{y;h4浯$[6ˮb$nH ~X'=RYѨv&)k2U~Cb֌&qx dquXj\ !G\.Rmi%sb1qT^Ā;spyCٖ-by.deKپPn0-_?x^?Y03}'tcMjao:"̑dY,[aƁa!lIP`u0u3_smЎr|+FXщ~ڑd }U w^f<\=:Z+\2EZV=O%39tECf7yfΥ̪Bá&E#Ud21w‭;.+ӯ8a%uQe3u[p=6$ݺ/ͦPK!Q<~3.^N$BNL3殺ɻr'C\S^{J{_%N׆/PK*I,9Am#PڝlFuG-JOO֛fM}ztdN3IYg^cL謳C]\Gv TijB;i`M 3:`\yB/qurUm󺴧Ň˫~0Gp\[D Z<jFly#iKKU"`C}4|mBN̏4[;}0,Ic NLgz$cG\U劓"{0RZ*\4f!2NǪ L:r2_TP'PFWx\J<>=k\X}F4"Ŏ>/ic& h5A')HdҴ}ge>>/ho2ճx#;USBGV߾]!хAhۄϗ Ł@H02(5i:[dyoqٗ~dϡ0qYwt:--[<9_]?+~WO}k^w{+?cO2/Gy^w3/{K6EUU|~!?{šx'o~W~ŗ>>s7|m?g_Wy꫾kM&ڨͤp#\56#SH#\hH(-Y'5ZV@(!1ªS.L`wI΍x{E0m%!ÕEb9!հL ZHipSfWt y$5wBX_fu󬂙ݱqTUXhKwS 6Q^y2>8DòưU{KdR9rh}Eb̈vOv>R~fXX2YVIC 9' 7Z˓t2e=˕׆~H*5k>YD'D%ۍpքmC)rjQ+± A]rm\$Oë˂:k[{ o(jR$Xep^Ói-7)! xblؐ1ݯ sԝ)&+sskWFƸk@)& H7/I)T@OkځF{=&-j?JXMc&'H .PG=Yі^rQ7HD 7_fŭu&OFG܌򄱕ʤadF󮃶CŤPu7נҗĴTӾH*=,i3f2q ,8dmsA,s&)ݲOWLpc5Xۺ)4 eTͯHEsG7>ՇK HNhe:I [t `2YCJ?@uL>H- @f%SM`|_^sO|s 7 r0O&J 9Kl ~|G(*#@mșBӓ# z -@P %YֿF20 v Ȉ R=dfpttD>w[?Bv%/ox ;;<#-o^l~#{ïN_㶅.T@HTC1G Z .Jϖk4kkܯww&Tw5^1OS^z'Q*U.n֖c̤7$1r<)L%—8fۊ*,a"pt] WO,DFʑvN3WWʇj*fٱ _c3^x<=8Nfධ懐;vf[ƶf̣xE5؎ρQ0V]u QIƀTg^vqrX<8'" eZUL+Ku掻w9B.'һFF$g7ٍ z)qjșYNLU{] udmπY,=)U◮tΏTh{-zuYznjV[ ` ) |+\Y-GĠX ˆp x'Q7B 6k-(gƌ"rk ]|4HO&S` ~ 20M^,GPϨيDjcJ+|@;v/u@d fFtt2㺹 "fDb@qc 'qÉ]@FCt$YkVŁ2y¼適5oR̲Sr0Z6R> \z:GꮐîJp`qfB|zr:/ǒlHabmSl~\tO1j-8Ϲvtfeh[bLT3r,׉#HF$}Mv >T⭫rƖ+$tT齰s?;x;=ƭrq z-/CcCstbR*. DONxu۰Wb{F%&:"Lg%H&=#v=RӐW݆a>>>'''H rSXc@:$F^OgG>_GKQє}P9F$>&#b#~v!G$&`a '$&J/J.iQW'_E> o?'}'g̟G͏[U_sϋ5Yيoe/})~{Lr*F쇁o+^rv^r}|'2m'|« ?gv:V7Q+uXD"0WҐziǞ3'Y Bb[]ܽՠT߮m/V8w~:?"fd {Q'wvM=x gZàtA!iv8j,#WKCAP)4ӌL%6e':3{#UthW8aXO{ƗyӃЉ8^z9T2) 5owzTbJV9B#ԍluBV޳sq.m췼k_9>4 3/*DTXgv&lٻWtH^q.PJ"yƖ [U.<#CzRS hV\Z-}:O%yko p|Ȫw\e5O]Z'5#\kQ"mkKrN̯<d7V%u[ w R@ 2׀)1 auh^@.fn |ʆX,T/ҸPS%_鈶/T~LOdRB̐ *iUabx h%.l&V'82߇=?sNE )$dh͓ە 4&ˠN1\] [2Ԩx+Xͩz 7bojFÙgF\; G,_ QD%#pRY`i_WyU$Dُ1qy(̴2_}cQ@!Ш2|`:wB"ф[E۱}cd疏 p "kps',,4H^bG/ _+??|W|%~wϾoė}?ķ}wOĝw?e<#y{W|}__Z~_Moe@ bFɰR:yąMm#$k[SFSOT3yWYPZ0S#W5]\\(2ٍ LM`tBB-8]2cރ v \~ǂ8fVyiQOP^??fG\I@*FGঠc#e4Ώ`:ϞNܞrq22z]);6']q_C;owkLwba6 L48(Zý.k02,|ܿ5Kn\%_XqcOi&뀗ˬ  UXPvG'59*.;>!2əKG\<_sm䁝1G^8=E-/˅<63h_Um5] TPa(^<*x&RswSĵyZܯ! 6Ct 5mֱI4b#&D+HX769aڌȣ5˶gu%hcW\(6j4 zpq&!gAs!>v׷@zv? ӵlM9e@ܙ? )'jf8 5"%"0u-r4] h{ZY lJz|wOW]ՄY A R6X._Myr[[5'Cc䌋G\59+z i볉q6!uk_7YFK??6ſ~?4ur/xK_?99𜷕R/s_O| ˧~ʧ_~I2+') pq@fb!G=V"8;;d ^ʫJ|Q4wa'ul|v` c`Yq<ؙt>ȄOr>9Q5W+`+WNG̜2 1m,kh 2 m.n x/@b5=Ȣrys8|¬vrG) &݇uB*UYe-B vIMT-m$Kݪaym㸴;+Y a x:'MF\>+g},(,VH=>E8Mwn3vr{S71$H+fdvv?uM#bQ?au/\ǏCwdCd?=5/9)g|גC G<)j d hL7H=cZr"jtc>Xh8;2->K k#M{Ǧ Dy>L"RWTA5! )Ş:yU U^ E:V]cX׃QFdp6iL{KypRmR0 g @lّ3.0@SJmPA(ʀ_*gY8^3nhMT lz-BX\9IǺ;~F}T}m/Xk> 7EuuQvZT{$yIGr' >2N>Xv=+<)%eGۮ/[bTj^"ux81L0))l1j? c2ѺܓRG'j6/jgr:OwI8 xBZ7T/5ފ?ZXs:0m3?.6d<0y:(y@rh #@0./nbEne>+:k2? DQmA .̊ml7~ HgJ!hHbc`÷|i!VKuƎ|Yggo"Ly bk,[]4v{u]]deb1°% %-n C8\飊&6ï~~9׿CL\t׽{888䋾 y7}7_o/Yokٯxۿ[b}ĦN+{JiǠyf :{{FVǺ:)ʤ/XϮN+0< #g["O1TS\[fHYV}K5CR|M5"Z%`JoM?">~MHIaی㩅@4YЗ_Ć)s&6l,Ip>d0%c?45RiVF(ވ%881q|; 7n?e_%|ٗ~ kw?3?^"IysM?=7FoM}w7gO?~闟r{!>3~=A?c;@|P z{*g=էR^W4ېČXj*+-fQS؃T:eC$9&4ŧj,'' ~H d΍<{[w\X\[F\;瞗P/ZQo9G\KWaC貃yo>X߀ǟٛa眵6 ;zhc綆{|ś?tR2/%'!L=)@ J bQxmP oP=PG:varnsŭ̋.غ2lUNȰ*&ʱJ$]tMZO Ai՞+$)5F d~ ^L?F2)CE afxs:6wC?ae'Ş~Htf ,XD"Tώ^X [я//'i$ù, .gx@&L T{0[63. {9&sSk揯?V}H/ڃ-Tu0t0rl՚#ʅޙ|M>!BJ.ⳁP ?RSi78 뷟{[J~g6O w.w.?xgouם|ŗ.]b2pwc?;/b~o|})y'l⧟G/ɯ9ن3sې^)/8!Zr|IƻLEWXF+9əNVV]ϥ=ځNecC@4ly`&@}=2$e-,8uNTɖ6g߬:;L4j27 cܰא]4LvW;T؊|fDUH l(C^R*rqFBe 1*9*)%##DVg('zW "GhwUFX A8$DӬ=A@ꑙZem 2&yOw9LUz#9]XAtv-"iK0)o _Cj kχ"VjɩE $Ơ|cwn|E-ʩ~97ED[d0/0|`WC"ˉ@y!+ 83g qvK"B37 _/B囿'_z7\.7_OD^sםw2Lx衇xG999%/} f3~G \8ǽ?9g~oHw7}//4Ռ>p hkZ&R(0‹@m;!%1 .|ClօV`{dÖsj$¥ܐrT#,3\?n♌EVv,{c.fj'uõctۙQinùNa6 XTf|q0e+.jmI}u!836zvU|XrExۯ1AϜl0TBlޞxJ9t+ؿWa6{x! ״89=JAd -*G㞰! 3r#rTŖ#T4:Qkfou̝GfSTa \:<'ɴ'zd4wC)HQ Ĵ rTKqEqgSl6!~ipd*5/xȭlsO![x(:LԱT&dW>~oPY֮+%Z18Vn'` !"%kDF63Ź0A*~<]v=a'rۛ s<>7>'h\ƻ.w|w??c4g.MSss]wiկ… |1=?c?_ӱ:G#uNTh^,C9aMn :#x vCb?øj8"RËck߆'!lPGP ޼Z }eBJp3i[JQ|B̏OXL/EXif'"#8n.``Yu5v@T^6?=fKwwaUnA&r=`df"+ 79hl&9=s ]*. e^9^:4s ^+4A?NLQrEO"[gƺdFՔC@SD҂-dWdF+4G|Uׄy})GqZ>s$ kۧ {{3 L xp H&z04moM,=e>N1u?3,(֬"oP4.80AZ*>s2 L6|z1CXȧ?⵰@=}Wy|wChe.ܙ,-4秀Ix@R [{ 1i%Ĩki}'x9{?|:>3?OO3>o-rzTd0rv-nM K1V_GꊷK_#{\J0tl~U6Ƥ0ʠ]G Cba,^F:Z A9hl8%!@@Bgqj}v2*ęY:#\=Ɏr>7bhWF7:3Ѿ-[nyѥ1 `Pr DynCGĀ&Dj=Zs|qQS2 6NCd7JaZbdK}ť 7,%ž*U ?!:t JRB\HTvv@gS^miލE#`R w߇3E竊a\iȳ]R7=]t+WKK@VY@(JRG"T)uŬ[hZL&9s;c7Ѩ60`j49+vg]ՊɊv_rO3\ lbjbc}iZjKc$]+S*R(]%Ƞn" 3yt5EKoQ.X&=9>HJmZWtW"@յܶى}W !]CVr(ʊ Hꀺ=R|M+6boq׷ |8U%sDX+:*YqPpoufF3wL2Gg { $Q1x=ZE̤ȹ O쑗#z[ bȵaVTS 5g-RrjWϷя z=?fJHnH&ٝ ]t#I`NY(Ddl zN{[Ĵ&p6&fMwD_Z$כu؇&ėv?]~mF\5->`M!dkɖLȂGtK)m-fKcTuο H~O>$?ȧ}]w}}]~RW&-;yyЇ?c>ƕW_R Ò!EƮag]i]L2os\tQ*)M){\̜ FfEpߕ3-mwJlKSqLΦ[O-HR6@2%HMфɒɬM987UXvpa,A嶴R̉kZv֍4 =Qӏ[ <+R`va *+rYx, Ai )lˈaXf#%q&6}2z%\&Ť: ǍX)4>FR(^t:2'\{|jEKnB-`ʲ7h 5dm0S,UW2۞ $O>$o}^x0+?,R2JZRjo6-cě6B̦8칈#Ĝ#ci}++m<'4"f,6;ZM:oǺ] i63_ nʼn%9I 曘+4*}b>k59 LVݒפeݸ>cmº2/E4l{3u2qJ5Goxf:4Љ̰0ۇ-R[e؝8¨x2=ibۦg gN]܋K$2N( n1}oД$@&a_Y TqREIѺ$5\e xR2jHBqCLRď&_Ud z4V[\U9[0tAV2%TuYeuut8h&mC d2Rs;^rb2,'|Is1u9*#bF`5drH9O|9EejVMҏ)4Hβ#j>PK<|umfcIXgIߔu^+29Ez輝~nS5wZI*&J ,o(1} n29KH4%| =D2.獟ktP5[Tb5pW#g}{yheK쇥_D;Od xF1̆3oEmuUQgvgn8."hpA}\l .$5pq|1Ek >O `teO9ZG;&eX f+Kέ\1Hyxڇ EVGE0N(P|QNKP[ 8e VxEFv70L`O\[w2 S̫6+Z`1[ߝ-Yf ʪ#|pa2D"yV^Ӛv+#c$\ {S0Ռb=W{b 8nUޗ ji sVt2'>Xp9UƩv&H]ֆ1΄ۯ3Sg ?g_Mtd59b>'cbR/#ٓ$w3%-5ɳTיl2cO\:?&ɮ"E"s=Xmp5U1$YLHe1gdUdטI'\JFԃq 'ұ4"ZflfK_)^ʦ;dM xQCį 7A#eȮϽ5k‰"٢5-pM+*5zvQ1S%L6 n~DLJJC}aAH ny 'Ri*d4Afc3n k  tV$b,]UF譍Y79o8oP\c,=1f2=R }m,g$ȼDMM/mTWHzK $x!Y^;LzABOt Qq@cт\BJ$)1ÐxE}S3U}>qg'O&JݾM 0S?;D\pjF_KTĬ 7d\GS")";$uH\wAw(òT˖ku&O,0~c\wOwLj&CIэ]I(DH'O "!M"XH:Isv񧄰 o0 O,*q4dnLV~acXni^˱܋v$, Jri=LBAf]L>8!$hE&SA`'[N'po/OK3RaEJpc"3}(Hjv}=6z33EIlF k8FGvg1@ 5c]=WU vi)bh>FK ̗Ʈ R7[mIT dAF[a5,O} l!O\8jd#-[ʨR[ FN|Ǟ0d!/h =KT 7#`zxnZQh ) H *wȕ3(*=WrogytO>CǪj b=V/=MN!*ZyVϕ;,pC,Rxc%6XjIn(t-xd#+[0"D9.Ax;"ZڮUQ9!"G?ըףMQ |yMiȤZ֎+\%Cǐ91zSG&,؃Nə'A3yP|Sؑ`LgD[9KlұR03XeVԒͽfK#*Z4_åp Gp0&Xk~--#5<4K~TWɄ~kq)Z3:`{>n\v ߑ rIN^i3+2'x̖*fpѱs[…-/(7@n\DLݓ8$P2q0O->=ݷCb8"pgBI1.Kl! -2AN2pqѪ:L={!e\{/ɜ"Tc͍+,xmqvZ3v>jLf{:}e[|agrƀt|~/eΈyLfIZyKobr /@{' pjvU hr6@vІǕruf~eo*8:,= E&\v褆8UN5cMp@>nt"p۽?aFvGDl+/$)$uqIv#h'?Fn%֭:QE6D-[D,+ĵoe8hfFR&HF%fPE:@^ )l"26瑴"=6pZlH־npj&v%L}KkO}y(+PyGtR<2WO0L)櫭UqsK,SD)eK^*OӺ^ĢwU>$ʀ@RuJꊷ!W-Jͳⰶx;jh(04r>-Yـ0U#mSv{jؔ28eT7,đ2:[rI 7R-v ]l+rR|hgqhd0DܢEs"ynЛMo?/:B3Ϭ1ԓֵs}mX+]Mm#ࣔi5h!r5m$(Ńyrjk0t!'&'2qYq2<lKeVq+<|Mi-w`gFg ^>OD^Ю/Ji#I.:kZ|r?}uUn`g,gLٙ[OeE‹Ρ;-n>8cp"럳$&Kߘ))!M hdmt8@;+a;z4\@Hlz/KC(iġju͑ PW^v'Mb-(9:py$BU8潽'7^^2r2!N _;fjLQs̈!v꽗RU# &cj>AWUغtpar~KXv\JmL\# *&].fϝ['+Z&񒙧췑ki$ <5<)]˾6V[ KC]yREjjp1Vs|:(LHĢ\R'f%3,4iNd..itJj ʸaW7Q,f!GUdBʺ)m/Q} .֟mR-e d?ɔjevQJFxF;mBMzMޣ"HT 콁H1TremnEM1u1LCh+둜IR)>U|پ J#ɊG<{+ QM @ {m@([|COxxM-Rܳ|}1ل#x 䲂x`i-*o,HJu|3@ĝݺ+$6_ϲ!d2#[˵0GB0?nD'2 Yɱ0!MÆєL[4az˒>sɯTT*Ǭ TVJs9zF_ÑG%zek_%#n270,4c\(%i~URslTZL̴e%X.gSr:G>Gp\qm&:QBVl+|anlP_yb⤟S+G-z,,8nyj i2tpRgc1:ѶK121s]JKXW;28uC=Wbk-ƴ ҩ22>dou߉SpmFΌj#Ts6_ZEƌ,ZXN'ݟػLtbFa@,;$O3Kz&.;I&ۈ[q.z.jЏyɊ/vh+GgǓ10!)ǽั8N^UȔ1-9ZɐmCUT}.Wf#.fKmr27c̎;_Pi3C1\`؟ :\òMLnly&?o$['Mm&>HN6/B)D\W pg6c(d[m)BLz%+4d6uS6$vҊzmHJ3?qBq6݃on/r&QX6d1U$=^$W:.;|q~ZbM_03 䒆%4"xI8!&2:>\׏ZLfs7jmGbDE-ϠbW ԖwfR5.2#OL6P@*!'tځ5N9ަHֶWsx\=&GreޒY2H$[wjyd^٤wV߉O6Fmɋ%W5\oOp<#/рy:[w `r+= Y-Yp6Ŧ-ױf]5r%"VYO;(֖,) [hpb?緝ʰN36X i/]Kq9 Vlk* xKHs)|Zѯ;>Ni\_,{+E_+K\(׈ &99Wvνt{= t%ITsxە@5 ,I(YHa582)頶}M?D ͅP۲)쮬sn\eF4dI),iTh"rWsɨ7 >*4lBQCXtv,zĢT&KRL]raPa 7xST\Ѝ!|x<(R,J#&d{_p$]%lޒ 5+UqX5)Wl56?yjX=1cn^qϥfXj\`sqVIwyG8Jʓө2rB/ z󾥁ɪ('f{4!.@L>7@J!"#GbuiԔU:> Ao@]TduX:mJt !vC6Q2yn;uH^@Jd 4&# beȹr1*} %CђL^]g[mR9AsxĊD*+4!K\✐1YR sN95Aʤ41vG"͆6V޼hpi"i$[e&Lyl(hg^g 7 {͋sbςK-Ć5_DZ) EpyjOt-!<2pqM]z'c \p<4Uae*O ):;RxUh{!;tْ圳`׷du՚h5T!wY֚Yw 0p lzJS@Qmo姖MB%4Grfd >l~8,;b H5zPM-6k¹#u\7mUδU=Qp/O t*kfLs\fZ%®QO: ;Eta_~pyŪXr5;)oOQׁQeQ!3rٙƞmXБ2Ͷ,G0)McRU$bѭc~`ޜ`TCWcmvӖsJ*2!ٽ,5ʼyod= M/L[kVסݾ=q=3&ji~"22d]B]ǗGDjkJ?Ws$8BIW҂QTp|lj N{\hUF8+"K"TJgĨ :<Ԗvϫ~#וE1Mޖo6ə+O d$5㴪M}YR!ցT _x4[ }fB?Cȳܾ>k 9ɭngm 9 ̈ ̊۷(qCę:5M)-OcC8hTTzJ^ (C)M5N`ɹՋ4xE/fkd0H]* ;+gUyvO-H$4+m0_ty"@jgzJU "OVfsw+u[Ib; ipxf5sԾʨ TdfN8Y?Gr\9Iޡ1#ST[pn3k2cH ´I5DDv`+g75FA3(f:a}EkҹmntW9o ҐX2[7WK9 @GEI98gmU]шХLpG-z9I$+)Q +k A⬰UVXU*fBp$[!%јڒ<'ţDL:%ӃM,Vr8>Oc|դ2 76;A'3|Ә~\WD稪 +IRyUG@ U]Țq^cFjFo'%:@*~ +.X[Imք^tZ̈yn"B.@yHUg?3VXSScwy^oȳ9e36p,;r 0T-Y3^6#EDz10RgiFu7ės̏ZEkM]=~HZY>җOe)Oʜ%Q <x6coyǔjϔ/]Ikb]egw[_ELcm:ʧ~ι妐& - pl(36D:(#*_ A $$~﹧)XO$~< svߟZtj67Y>*_.r9DJdJ Oy3d/箻2˞z]$,ARR>KҲ#?tbkӺ{!t3(x̯m8QvC{ :/Urf!wW< mh'Ќ1%!95=rˎ@" >Sʳuᔥx)LA.N]2OXjYXcPNBi1D:Ʃ%e{ӈTd'' ^-6d.ULձ[-n]Ʉ<~2/jDȰX NhTOVQY|IGD!LWC8*8c(BRgf)Y81O.xdM;Br4WB(*H|"EA " "")qLa `U^ Y8aDN(I*i%>Ϙ*]TJ9pbd%>wU,"בVx#UXQNcT;dH)DU y/3KFf9*Ѹ k R3X+F FyVҵK,B(Sl v#Eއ(D%X zTC Q)1^ryD#^o2Nogw%Nc3Ou߫x~dOl)XU^Uy XD *q~ BZiDЭ8VU+r/E]5E%-M%Vxtǚe7=K?! !ELB;HkUlpLl}l6)PKBx5a@OP5t}Z=p|*t44֏w!mCX#RZTŁeT"sjqJOi >J2%f1$ #A]z2GKt(k< C>o. [[pnH5~^$|K̃:/ QU L@0.ck=E r, &R 'aj4L*X̡? QK!vxCNDU1WE֪iLB•THԕWXþ0F>ӏJKBC񒑤C^#CuDjBDseIYu籹]䆑~VrbQqiihZJR:O*"2N؛FF,;\ѨOٯcwqj!YʅI0@Bxl\û78G@K0ac UE$"' "@ÏるBs)(i(BCV#/+ +5\4l6_/D՛a*RW5v- /:@TcɰINYYðLKKʴPW_b[Nz30ðwū$lB}W5]h)* DIBgz`Ħm۸ WY8~8A{Ç1Bh U /cLU0K!d"UiD"#VIIk"/,V Yٚ8)r1 AH3yT҉O+M>n ,:rzaGT"Qe"|BZb% G*(A0rJOD` ]&gAwnjwEҠ‹2$)I=ȪR }g` t{AVA[JQ^|]b\TYĥ K/ի 73 ӑ/:Xe09%(B(V!G? 0:j=+"M@.8 Tl3D٪dQ,_Ƈõ`'Ecۧ1|xA;U,j)k=G+5Q)kmNQJAa9+2USy8p2/ ,TQ㣤W0y3"Ѡ H`\yG()GE5S` 4΅(ڦCAF$b>#_6^8_ٕN#"dU&ܾ*P'"danU3j"4U;;WuTRʯ QQJ;-P2 iWE`*ٕ!%[(h7?g\xv&;7g[|8WT B02 )\v12nQ O)4Lj7F O])$bq8h1UK)c Z/\zOb/ rekO OࡨFFm֕x!]gip eObdTvqyB=6QHr!!QHU32B(sD@ezH\yJUnRxDJc*AM%ᶱBNհ#z WZЭ !bH&FUvL~5+'9+?H ~n93|V㔪ł/\HǩX&#˜{VWMc]rur,Hcuo]Z۴٪8* Wj O}Syի^ѣx^m`E-F|ذ@TqƖ!.7m(WnQXүcK8G$I dkAvIb)&0- Wd(X0P#0)ГgP&'dQ>>Jz! w A#_a<+^F"3|fc<5爫ɯ ˮkK60 zQi(`g1m}4n A߆&@0Ԏe* 8"lbCGiC!T#\Y2ՉṜ̆(3\U2˱eH: މ^O*`TA^I*Xx,tGv-Rd D2Q#ʂq}Ѳd`ƔSm!6$yDJ#uybnAǸ{8zPc%W!S!"-ey Mq Z#@7b'A(AGiB9b1(#J5r b4ʱy^mBe H֣p!,+Cx%*iEJd_yia:o%xY+Rx+pC@S+DůTl[90ظ"M?4_4 L/DXZ CU)eR4HcMդYol6شiA:f4pB5Mgi [w"/ *dW5lTy+)F:J bK&M/,$-Ȧ?b)EGz#m%\7\8Z4g9C\n&שNn%[nlG[g;Vɐ*Wkuz02Rasr91vV&_!kh[c8^5@dlt+z>VIWfC UoGd HXaL1ܷN.\ 4:oE޳#xc˂T'+KKQ5S |U83eijDTA%t:a}t&" ٷox+8|0x;&/f8ra:[oK/aiig'{Wp 0ٴi۶mf .;sEj4wyu]tسgwy?7^h!(L6`REЕW/IzH&E'BPF =3-.1 ID$meMz.5h'A %ݮgn),`LA .AKOԊCC^J{mSPJ/["w' N;0t(: xP(|hu6Wؓ&ec{`9F122'CIć_ T D&BF#%NóuƮ=[=^jz,ZrhЌ9S4['9(?=lLV3k7'3$[ʃ]}]cÉkuo+n!V=w~hq.xFZ)[RN<ߓʪ0Wːșؐ&t][c/Js_/Zx$T9juw(Y8v''|w=q 7^{^k& Uz%%\2O~ռ-okLY"mTlLn.{l$DYcQF8+-EA)VxFFC{NcF;G?3 ߓ;t"4!.ֺ3 QwN8½N[qL2Bb< st]aƻ\+c=z XRX&BJaВ"k@;UdA=Wt{dHP̖C# ;N<;7op] ;ssn5E-XRGnOR1(7t$ݻLvX>M@X4L_{ "W5)YO^Wc5FlEw̓]FlBzc#@r.Fm.t|y$) + QL|xU!0̘LU(KI F( 9y^Bѷ}׿Gؼy3sssLnzMWɯD؄xW@E%0IC\:Su Z͊+<,-ֳ/ڴ g1*aQ`ZRy=Z+L 6/c=cnA#O h8JOۈliH{sZc0J#pxl dS=aKf!S5HyQ-} e1(<<>kވ~`p7RMMi;˶3}n+C7"e%#]t fi[LЬ(H&CGG [ .2XSHM50$̈́zkɰU C, ͑AE4I.GL'*IYKk)qLSstD ~֊8t] Ͱx,>Ud9&tuނ)"xUI&]l%W*fݒGY'dH /7aZhЕxp^U# t 0d5(3窪c$&Mfj(s0Q\D>wB^j„hi.!J8@ :0J(AzBRcy0d!/0B3N@͟c-4(E#ҔAa6]5 -Gp✀@/9z-F+\KrT>n!2U@V, , \t墴Ƕ6 @oJftҗq*l[o/GuroRVyr $n [qf 5BvצMս!O::ƉQvXVb,+qW+ za ^Cv(Ǻ͝m5x8cO#z4L뮉 JxNZanA h6F` `*D^W<+=qݻvM$hb yÇ,r {9yw}Cs.ڳKvofKp V‘T9,\m9UeV Hut|DG`T</Le:" V"ɻ#1`{hZxl݂-1{/ 1"i\&Yp[`D"fqTp|3 5K>تHˡqK.ۛusְhCdg=bXqĒVaZ*`mfC@ E F¤H]"}59"Ikds]֒lj25. Q&ÕU6rzG@.GV ѡURceTHTh̹*UZkj+Gh< aGiTCivU)NV Wqs4E`ltR"J'8):7]ݹ@ۻrk!* J_PQ5 )*0`A:("(D* `i09Yn^uD?+CGYaiSat84SXjGMKRDJa!7TJDU9<ҏ]@;>=[ D$ɫJi RKtf XUTi ^X`)&'G fH(|8AK(nf_y7( :eX{ZW~s-8Ȏz Iۡ\w#vlCx3cD]y#  ^'< |?7\6mıcǸ{Ї>,ncLH/iٵkW\qO}Sx+^M7Ļn/< ~hڧ?,')d4*p:9 rQ^z!~1KAO$\r8=~D$sУ[l;ŌrDUB*J.nk\_VVZ)I &9a #q]`1yry*Ii,Qx[й<TXM7pS%`,~#=C"UoNX˵,rxɍ\k[a5*L\4U@lϸ]va,:0$k UpX46n5+Hi$Wb=<I;*ChYpR,W"DQᓸ~E~[ Uc\|?-_{yNY}ʞ={ ȑ#Mo|x{ރVHmc,RJshy򓿓g<]!1x3BW A yV^.ټ Àj$ki<(Xy(Fbq,Y0w(:|Qp4 xHVeF"Z#V6;1D5B =Jyr,2W] 8Nc͓r9\"Zȝ%wfe0~'Jࣘ~z[q@=')m[}9PS`/shS2v HysΎ}!ͩ}~B ܂HbwqYK: ^*|4HGiC2&aR/B;<҇P+cG'gSbߝ fD+}_՜yz=xhvcZ^`S+{VIX'ZޯDC W'yTN$6b98۟WMOX4W!1rU !TJʹVbj*P nqjTP~&Ql׃vW8e8J[Jc.0"32Ҭ^a0 ,3:9л17x#/{˸{y-21? 6z׻I=׾86~?D$\wu؏wr|suq2;;Ν; k_*]tOywկ~׼9|0;4 /仿y׻ޅ$Ih4VLeYBUGx+G2v[3vMQJӉDRĊ-QX: `VyBQ!%5y90(c#O"*>wAnH;Px@ 9| tycyI2̹kwp1p~ p0Y-8H֣قCd'$ӈDžZM!08%kL;,dGz}2G[` 0Lw`Ǯ1!Md d4%e؏F\.ak'C[h{K")Xn@$Kx _w{gG,ZôòRdƑnSJŨ(,$mwZm}V-|G7m ICyW(e*F:FDꉢƴ҈NIHqU(b` Z߾fp8P۾*_K;d T8C\xU}X ڵZ( zDZaQ|i+B7¦˲9\^>\seށ¢^ND8\2UmJyŻ<1V$ &W= #8lљ㌊輡#4*'#HMH )^8]o&4ai0Kw!Gg Ee;yչO _#16(d0;cɉ rBk=Һ>$XSBJ"GQe..]F([BQPnsU@E/o}. "DץI3{Vy:v"Y'-'UO ts'|~98+"6Ԅf4ײ''ޑU[;_ A,*uB}!f~j7@T"=[>Vru*cC]sN[TY qKIg`|8o,Vn|V}lh`D=a@.2.^C^XX൯}-Vzx;q >19Brp/--1/xx3vj5~~c mo{p8d0?||ۿooO{e~~-[я~tx?GnVDDJiV(su.vmPת|j>+h 8a})'O00rij5fEʂ)AyCEՉO"UO9"j0̱gdXPA; r%@LPULS1K-I-,'H#Š#5NX3DΓD $ĞPz&l3EElp8Թ s٣%xaC"vv$y /5(3[)5vBq#8[8+Q([ i\* -B`'!@V@'S-pcgi~ YQ\nO&kj6?\M)XU9 `l!_'֍q7b9ȊT>،!ݯ$cGB2%Vir]q?U>t8~|E3?3k88x W_}uUMf+Zu1qIm)ǎ03R<ą'"l:j5JW0tDE E (:g8˒͵̖D2RƠDRJ"lԕX(8`1% B,Kju{pmMɁܲD1 e٥#"$Pe;Q^I(6; vK-K>)Iѧ4PKb[.l+q&PDƔcjse&;4t9r o=2Re*oٽ˂Hؽ%gx7 O`9HǶF;n)yڠ^lki%QWEȽ'Wo ~CC rpzUf\]ڏ0[HIH%qheҢUxZ.H?<'h) L5|芐,2}Jgh64jC.{MOwI 0C&̯RbUPA&+ip9Ž^qIIp l|L CL  ̉Pwbw^B )'+45H)Q;G0h)LIF L,%2Hu&H018!AV2 I CSzZcJ˥kxY*ϝq{4h6$J8k5j$fHYc9Cff:!\8F*JRF%)y=iZY@Y(3-˜H8"bJˉl@:OTI`x$REPD4yѰ"~ LߘXGWd#f~?pCـӁ Y$Wg D&qV&6`>*?Xֵ>)k, s%Uٯ\x2x#o+!򫓱9g{ q*1L\kUx]}!G$:)kp @ nIX= o;??_z:73335[n9#3F8ȭƑycN @'kks=|?/{n=ztqk.><(RJ:'4ι Ș"MS,//O\qS&Zkt::jRh4bjjnsvMכ|4%5-[߿|B! 9q5e6MQP˜87a^"KCb,P A`9A)HjPkOI,TagH/aG)pƠ$IiE{OY ZΑ,Ov;NGC$dB{ L%4VDҒ* 1j^2NiiYht!^rt|i% +ZJ%5:uEam4Sf  FYhM# :4`QҞ1tP_tR<vR"6MRmK]|PԱ:.$yQ/ݽe#hj!M9Ι/ t{L+#;rć$*+Lk I"HHi"%%C֒>Fd=NeSRQc-Kd%U_bFeN q D 2'&3TIxTcWzI}B"=U6Ckd3;{({ދYڷH7G!I&FD 5RFe^KDa,#x5(eIŠ̈%%6PЃS!*gmUPW$H Ê{!ydaF|Wzt$Dk( H|%X;?) !Ւjgp1o;rVT ǩ) g\NY>ZYj6dӻ:)X5&DW_N>kX\5U\IN%2,Sk.|'p(|iVP* |jV 2Un 2oͥnm}'sN>O=WUH)<Ϲ馛Ї>s>9~n~O|b-_wVrK!PJIj+DJ-OOR%^{-y{Ȳ 5?s?h4>//Pww![??eVxӟΏ}}\tE:y_ _BmFY,,,//9z([oxx_̳,~~e/{yvyk^ñcǾ,!pl*tR#EL v^@iK|G% F@N`(FxCs9A81oC^,9qD7ˑ>*K'ȭ'P{x1K꺆p^7AjAM*FPzAyeβ"S=Bm's1CqC(fi|na9>(GL,͛$Ss=CzF%y0 JG$ li zЁ' 5-C6,t0ȩkSÇgEߢO0-[C#E@iшAb!CIi 7ʠM/a [q,ȥOA-LzU!6Ғ$iUh N+$è(R2DΒ~ˢ,)dU@Rv7v ,lz;D]\,㒙UpA#\YbBB x+@PiA\z*\7Ԧx r,G_B5ʂ3jK9#KG !KI!Q(05;. ţę%7 KN3 LK=P"rp k󹻎)ܔh51i#"R1D$[X$R!ꂋ?'Qss<"Qe֑)=3z Jb]Y@.H^JC1fqXL} F #Ro?7{b<-zZ4N?.?$ة@ǩNrxp֒_p˺F _> a| ZeDF&42A|F37 e W:u *zz 㬀ȄcG0cCݷrwW\veoe߾}/'2;y_Ϝ/b}k^ÕW^s$?O{?ϯگ??M'cjj7_Yq 7p饗N͛77|3\y|ӟ4{:\)E!I;;=o{(˒NTV|Vjx3::?-o WM,^HR Z1 hxAa<yE&դωU"{G)Rzd,IQB) =QVPzN/YrXi2riJ"+A"C"Ia (tT8O8|υ:vr14PZOyaјPk,:JA8C #!J LMsQy&Ҳ\Z5"IپC\ϟzKn@=G/q3Ȁ"~e 4'a\+.޲K|a&tkEӕlo\f{J0N1zˆHA:$dCQ(;QA!0M:h^jwR%i%:JtXG٤nbcn8P 8WȰ'L8e%xpB!a,B0a ^D]*}Fse?p@,Q0{V^@DLt Q&q~eQ0n8rؗUX0 OXQEHc>B@&BA]lgaiAc^.\P^>A+#"\:"cR1^ -1H|6b9?7މ\D<T(iЦD Q-,f0 d>Y)ѹd)!b$oRd?8`dTik DL`!rjǤaI,,в I)\H Vm'eHܪ<҃S!? 4UĽdG ,ܣltۍ6hǑ{`"[ٲ #gz< s5K.Z'8ys| 0Y-8UKaJ-|= ME4S07gcvOe6Fcu^0&D7C^#ʨP  qhaN~CD oKxы^u]7n0A9x{;{\s5|_G)>%.??ˎ;Wʛ&/lx`v:0[ꪫ >~DQ޽!}0Z>?LMM1y衇jp _}k٭,,,e_'TO8㟍1c(Ok<'LЕW^ɗex7H Z{5jP1S*'< iU{yxd H[D)svPJh6kuPHFL1$T!m[8$qNN09a.%V rÈZF9P/ =Qc#y00t,1 DC^ $,=Nz# kh[CM00aDIQ,$ 7*)}wj|2:AQfcV!K eCQR%kD _Y=RT %Z>N@ F0.4^(܏Rƫ4xD+R 0,v$X't%hoP6G:UnPmIXULTC3bW{WA掚+9mr@Mm&Qq:X\`5Jq-Abң8j*&Ý׏sN2Δ8))b5"C ksv.;caa/e !VR{*jIq2W#x('b#LI!]bi򀏣 Q8k!C۹8!Q%r1*ez $.7+D( R]tD *M.Ϭ/\Vy OK.\IIؚg,sOlĂlP6`=xޏ̇_7kbCc9PgEo\6zO2Ǻ#X  V=ZqS>6b=NM"AnTW8ŏN Al]8Q+uG~G뮻뮻WWO|t5x$I+ټylٲ|,,,<"zyYqLYk$[yF__od۶m,--q=Pր7;v .Os=|wY=/qp^~x_͛&瞵ө*x\s 'No}8ÂVqBjTdV4 %mB ogS_ OQ~wHĔdAWIT$h iO7ıc;96w܆b1Yuo M6L*z>4U㼥QgsR0i K ddN¶8fiԒ &9G1qa4Vgg!zO\ ieI18vԚt3aSԽgԥ\4(֜ޅ FB@&N=@cptNC>40eQ#NXrLX$tc-uIҘJ#Y.3L\ FJpa`?)d4k aG58w_D_!Ac.@4R4zNo8V.?ANc@HEqJ3 W2ТBmrbg" jll7w"=~Xd, :#+~Er#{X|NI!wG+ baxJpp`Bn6k%ɷ; 88Ԋ3Ff_zi[>HՀc2x=z3ź"X_~y `BDLJ ]Rug=LSmD_%撈Gn".W0UH|X6~a  ys쬚7 Cg> #07N<o{Lܩ4/qO~NӔnż)Oy ykN_W;9v >w=9[$ ox? [ ^nf$ģ.]3)%5KNkAM83 &h `i,u1ֳ5AGZ)h{fwqʉ!H q sѕVc!5kA b h-T}m-1ң +dWCN0y YE$H`2lnwpB0ը,K.pM4dӈAyu*MU cHk2`ͦixFRc4DV8X: X%IsMSC> l'_4<Ђ^>NGY8f+ɥB lA3YŠ̱IjD.ˠ'䊐ͦSvԮ|9w%֋;p Bg0A뒕IA) Ѣeա65Es|0`ia"{\`sk^ShjT ")/b)p9{|AF57P ,ZQP(_ 'dxy UH+"y/j*6 IqTcFDD6cs( RI]Ir董읚aw'g2|1di-kv2c^ O ё"BJ;xt8[5xTL2]\5BJG "%ZBX=D(YE!̡4ሲ^kMjHa# V0 hSqk\s]M'#)p|4"hƌ,q}SX)B!!KTInhƛDGlpq:Ԛ? ?ߐ $0rG5n%Wn+ĆT5 eUZIVE(*:3_<Kǻ:8JUyʟW:L|pYߍ'v>V2Il'2ѩ TkgYO}n߾5םfzf˖-vm@}[ߊ1믿n$IBw׿%^׮x8xg?ټYnZW_g?Yԧl6Y^^&Ihy׻׾5nF)ŧ>)/yǏjTލ",HBCPf(3@8\(;BaHr6҆D.02«_" (|"G`v*HôF^ ! rYBqH%.JF'fvv:tFXNSqI\q-/&zJ^CAǩ^GĔFXdd+pչa?!qbmzZ%WB;< NbuQx[ֈ>#aW]3?ٲuDpc(#|6F6[0 r3Ua(i/JW8:0a6a- Zktm%ڽ k0RJRUĉy򑏰~.2^׮a['13J YXw^nM'?In&>O277Ǟ={] N!*"٦--툪S[R02(<#˝4e,‘r$#Ȭ+T!^Z~ɠa9tŤ54[rA0ʩŚo )ZH{CSKJ-IExxҒ-iLG rYrb8bwA<RP0աW)IJ34~<'裲:;غsz+xOZ&ml~nd& _v&۾okܞv ~`ʯdQjc n ST8S)4%0>\rՆYyFք= q*գh>u^ \DjvJs a,]xQɌud~~zu ÇQJq]w~[n|~|_Z+_J~~-[1sG믿???n˞YzZ|طo_9pOb]~Wub8x+_78yx\yܹ[nEW???1~17im^iӦ=7|sۋ@\XtXFL%0 bڔ5a KC ғ2X,^ZVEG .g0< 1(KWRhIU{vg>>\G^|Oh{ue, >v1| Nj]Bl b84伩G/[)kfQX Q! }OlL???co9\!Z @)#3S\w%5[ V5]5] ?J 99CU<类Do$ؒZ[C3If.nGF+j3fqۖC_:aaBNwj3}fd rzXmD+攓{<lB'Qg}koEȨ/9%-L,+d#:)Tz>r 7=۲/]v_=sssɟIO S*A$ԓ%xe6O.Ij, Qr4QCK]D :[sjǞm3?wO|i#N0魌b0|И&8;ƟIyݵ# "fVGHP6Ͼ+{?<OϼQ^= b=w1NTLǩ~l|I?w }i٭pز"a1Nu9^k T?Kޗ?赽%2 ƲIx(o{3,r8̢bTusY}j՝K/Lzͅ _|0(~ XS *Ξ87bր-[C6:)aPxv3}=_F}.͑ߪRw$sݻwp/u{/}K74?XZh <6\:qjsńFfȌDC&=FP,KEZ`J 8qbCHb6ʹ6ӠVL8Jh)M5I{6%͐!#X d⒄ż*ѤlnI3"aP $VlihƂueժhA6e/ʅbS-D2<5 -;18KIy[6Ӑ@V ˟buz$s>'? >|,W{y[^ӷ {bX E%[w_M0L?_/-~|?OΪxPL NH D.wg5X}ȕPٜs>1^L>Lw`箐so](iԡY#K l?<^,ƿZ{9登h(H4f|UDhP|h!5(j(h|租 5aUNɳSva/q.6]{U=qs-p7`O;{EO}˿%⫾r `P "FPkp.`̓>~U0s93`BQbރ;Ekݼ6ʔ\]TtkxMz~{،1RZw_7M{>깟+IeV+aUW;CjMdyu:lCs ߛ>^rYh8v0DYDYl%R3QG0yX O ~w%!M/mo{yk_;1;nySu]#P^WI~w;cJ5׼sKK=;Uz͝wy|1+++ c˿;3;'怿˿i$?&~_HVJg}oePeKWkpD7e(s|D`p-\eڧ ֙ldCupBAwjpc@ƃ "l,z/jX1&186<9025]֫;K>T? P{`@KY[TgpU?2,ȌO~~//q~WTgΜ /r_+|͓7UGw3̉aE|~!??ȗ}ٗQr7G/\wu/"~y[ooG}un6:@UKKx_OZm6i"`}|;{^^Weg?,ŋO6+G~!miĒRfC!2E{3om )bC C$>TH c=6tU4VRRqxĥ,9y:66(mKn\k] .3DHDY5ʪLFHy%z%4pe䈍ڕ6<ÕFsk}hPg=*zz>&/ȀT&!lzTKkso_|_W1rmµ/ ?Y|_q7o~l!Dh!UՕM'%Nk_~7_u}~!_J+D-hF>K|Ҁp*UzۭI lP̊Q iux-z.kG=ONBC)Vmxv2I4Ed PnG'ߛ?Iχi8sЪMdeV|;2%?g"+F'RhQa=]|>/[_>leh>   4R53p\WxW8/{{{??桇bcc('IBbmms?[o>\;XG}__?'>n`""<9sCQGg<=3@h>(?$,CDvt]y\2v|M{ʲ䓟Ig<||r[(XclL[rbIfy\l; M !܄$4 rfDe;.mC,@(CFJn*.4gBD%(Œ{O!2c@GԪդkpJZc- $  bcV1)ftb .A 9V%B"It ͑TʲLă')yN6y1q~^~Ñ>_f6§qebW|+'qνCe܁+/9'x~U?`5l_P1۟">I ݪ,mY@wkkk&4"S'a0?*29מ ۾ /_I&S /tg6o贩z~{eߑ] R:`}Uh=q]"}3 .lYgXywb\ȴ9r fypKCf@}7;Jz{zּ̍{X9P4A4[h1!C*TG͵_ @sWw{x3 ^^`"jvt_5OZ7 o}[ G~~'>OOwzm$x(}k=ic_uwO6CV%J16F "ki2" =]:m\ *םhpXOBi\ˌ@)aÓ!j#hڌeSbW$1-,4D)PZ4' -lb/o#@cC5b%Q+&a)eQǣd9b>VZͶ.u7iGtƅ/qX)TxSOsOCZi77,nxcmm==^J7UG>rWzM)S9PHas$*ޗ:}7 N*C҉6̌*s2 AnmxLJ@c/D-: Pd DLu Lؐt }j&[un\8[pB,8 NЇDʻd >XJwTqЗ:e=v rro].0RZG<~@ލ4Tẹp o}+|;yw^"nN:E ,{>}g}j4|'~'_E677';Ns뭷we/;vLy R${o}+"§?'b*]u+*/:#U]\P8M;W8Ă4<ts-dVKՈ) OÇuI%iF(J= Ԩ%h7"$8b4KpIt 662uk-VZ0CNܴD"(1"[-% \c[[lG дc{0Pm 4p\Y.t`p^"m) 6Auړn[o|%'n ަD9OI}˼*!Vϫ^rOt 3UY`&[Vr| NūO||Rcs{ Y$hҁKYqjXY3Ox30UmX[v4?!Lσ vQH3=] @vĐp!Q^3xp=ZYؐUuF᪾?~wrDO0V2j:uF7 OD8<["@G x|tl*lāl$A~eI-Q_ 1x~ xo9sӧOJxlnn˗>I UN[뾎//1yGG;կ~5Ν;___wulnn @^>#Z jUbV}+^^%q;\ Yr~ᣈN*$IA- N[#IJbi@Xa3%w`38SR4S kp~{00f"IՓ93&GXF 6Xu q1d[=vĖciD(it蕎r4䆦 Q7R,+8[δlv{$y/js)έ7. z QP-{'w9?IF/ٓr;_|S!؂2D /s-W?pSuy⸱ɂzy?3|̕eE r>kx̛+OdbI$nXJαׄ0 5P`C&Tªa|1#ZkgF tAKC;BPt` v:g/|pbd[ZġKu{'NozӛX]]nCԧv]1v=$Ɍ!?|w|r 7|3.]w~w&v|W|D,K~'˗/Ł7yC ,I< lWZ}l bAXu'cNLGtKeemMjg!R$]~FyF#pR2rƒF %!a ' \*r:&QNCXz2WJe>ɽyc OM+2ht>zS+MbKhjEYcf/#[*)=rGYR?yWøJ,y)kyRn_B뿍I| 'ͧj|œv[8{ $Ea%,oRmc񶉳+ầ,.Lí(4o]^/ ^>)yw!85|憙4$A^2{Z.gY9郮gĆ(6 7zZU.0;հ8+>OL AveYՖE+Ɍ }jO3eXs'MLr5^_UJU?2n"jtJsLf؈qƾ!3 /: |޹C tA$;]+bXp9*/<qHMozg Y׿Gy{wW?e/̙3ʯ :<3@|w~c0m|]w^2~ww3Nwo|g~mo{'hܴ(:16n#q˔Aݢv CvI7dS)9.I~mUO?>ɧXN6pgW!΂UK$\V)ԇR  '4N;a0,pW*E .3G^B1[O=@mZ[9bXk4rlJ^8p*`z6#>} agNE;Dkkq1XM" \D+U]"q^ɪD|oWx&-m=]}1o榧,3A<ImתPjL\IR+3?>e_9 NcH4C&@k1e5 r/rrEV9&G5iƅ20! Ҭד8HPUsė.z2.woyvhįR5&⡇~v;s`0>'>J^GG>p?89ww9JdD"$j 1,Ykq|=ID+M[lFl2+ғ:<]Nԩ11uLCD%YB8xAA@G״ .lGCL@F0bǙ̠8>e^YCY\>׽[ruYBF6!j#q X'm)ImФؒj-(ɳ8MBB W2ODmoKp\i@w_G+P!%`_!g"(<\d,q`W I*y|Tre){s. G@xrSu9w\%ff !_pˉ6pQOl O|&'N`P|dPd,79楋 8SrYQk8 t G=[uOuZb ~e9Ǣno |wPCU[K^WҞ|9A51ߤ~7~s df|Z 0Dw}%Lh% 7y]Bmy>3$mlu{6)34s?cJL"k` Gk,e[_ë |"'wsN2RhmJK*QOG|${**q E W&_ޮ|/Q'=`oNt9qC_p^(i 0ϧ9t?5'N[G͌2^+ xVgѽNq_;|¡y |}VG^_h>?yuǬ9&,1g |(Ѳzgc"8V;_e@.O4ad`l$*`ᴿ@,бfU&03FF9%$Q\-b 놜KY+GTLCh7 LbXѻ͍+n: J/)06BBkeG]? ._X!DAkY˃8Uݼ.sut'hG*HW宻+W3v 1\O>C 1XhǀG KX``m艫/ՄC$Ƥǟ8Pfss>r~N%4Ȣ낺EMS/ƀ,lِEŝ8TZ&a?TPWkqohAɁuw2XT+]͗dyvXˮvao{ Hm/ 0NЌոldPQRɉL̖`ɕtB"hjq~>/5Ҳ@ 4A) o<|r8( 6icմm-glXU$$$#+ tZ)"mA .tcik)tʧ++= ~G#KXJblCH J"w=8+]:IBkİ "g=*鬤8J3G!EiW r2F4pH/EJDž$RωXSD;*^ɋ}]iB{ĘF`bc_eDD|k&˫"CHo=NՍ" sH>MrJk"k"eL] VwS/ӌdž,gs_c0ykޒBɠBY.j:^Z'q&/{|Vv/%58WZ1# *xsf&ݫsaexL#p0[,%JZ?w 3)6Ąd!]+{y7b e |)xg*3}{)]-*ɪOY~xݝ㫸*RPINL.`{5`;eZ6u*F M2q^ԙMuIJY׎2 G7=0ZI_ W'lDCV:j5փ/Ӵb = FVt4<'a|[# \HlIls'#k bX5h0@  h Mpmk q9)YQp†'QpDX:iW2􎓭)>Ѡ֤шehc^vuJ-i+xS,g=HP XW81lP몲3-C߇(yG9<.Z%mi j4&* D%Lӌz+K !din&RB^1_eu,5dP){`1ʸu9)GDbl=|[vn>y4܋ZQ/ay߇Wq|$V 6]A2 8T 1;xPU܂Ҕc`%E(=9"@Lt_F'  ex:Xx|1plƎY%38/tN7_άר.lJ7Q\d+pӓ!v`̘"vlֵ!=>'e)*C+LS&L Mt x}(K7 kK`3 Ho,|:C6,4{~'-jZD3DIPC8c9WBhJ+6:%=)L,Z)ʹu6/n"ֶЈKL9.H@,DpŠBjB嬠4D)Ңyj#"3qn'T;FMPw%I(`t՟f2: 4EǮx\nz`mskk\FVۻKU#K*CU $,2 1,Гa R0cR s챏 ^xT,1V+'S?敬tA d7P"0NDqXH=NM?>)5ٱ%|-}O6vzO}${㤘TZ#9Axb6U*״ ., ^ !$T4ʯdb \]äh¶qr)=|_f)iv1@ÆrF\.2"=. $ppb#[}=OHbXa}6yXTQtⲒXiX|$- bUN',ri8{rTM$0#3m-<] *Z.ТD$b{)M䰤2(qgΝh20xZuJrǥr˪w@b,q0 9F-OedņCll([VrJk1vignR8T@JD+fi" 7".H>Oϻ^ˡ\y|}8 ,ZR8P 2U_Vll0o8 mjZPyFB>~L1yHhw ؘ!.hNL*ЎQ*dv>^J.v!PϠ?q6ýT"l@\mnrdڀV>"/xecknCNCI4㗉- q=N a7BK NR`͘Ur1% w?0l^a)#FF ˬ@(%1 1۽ L2`BJZqh%.xhň.gJ A}e9lSQẋVK9xL1WF9b(op?>q9}r\#wW#cCmuN%,kj 2*bT-i,VRX9+Yw8,nESq4@GURXoٽ| v*[_e0'L!E/.1٥q}!xZRM:|S9F*{}"Iy.vX;NnUn1Q4ךrΘSUfҧMYɱ7LHdKdU߮˸*?gg%!yM;!;Fυ"__ W..^E' Qܦ,r| ;6mN) D"C,cj:h~Μ 90*`@!%i ݀Jb˺for<QEV)%Q5< *my7Ĥ) k%f|@7ξЪ*,mCB66Y&-|ZVOݴ0LR\M}f i ئBaP8c0J p" ?d=K X9Q Se `ᕤKPShRJ!+b!tDi(tЗ-= bJd⒵8رN XdUL:3RrO1%2fϓgonV/r9wQ")33ygE=~`?3~`c~3uh^wI}^&~Xfʺ&]\ ˢ5e\{q*J":p)˰aa{\uTW*,)[nR0)"8iKQxG2JWpM丩9$i^B:U>$9#f;JV8@b-tZ  $ ֎š'Z5+]!E&M iu:dzYJuKeH=&1Midm̔($N 'r* _r7"O<+pBJ6hh#&=pր/1 w/&|,*+-p .v٣vXZ6݇ՄBՕϔ^nNկ|# ,f~,I7<̤|yǷD`\I?6Y[['ϸi)[PWA1zA(E.)||3?3?W1X,aȤT΀%8cϴN˪XjR1݂އ0*Wrj|3m9Ts4cN_h-2_Uh_H>4vA{56W%R.UcV56םc"2 aX-h”noXg ܹU&*d0zP)aY(˫ Тd}}겔[q0QD`c2\!iV,8y8 y>0Q0lAצp?V6zZ"Se .qQ$?J!h<85DbF$) FzxXN1P8C5Xq`=lSQᑭ>r/A[>6`eX>,)n2%VYj ˒~bhd7Ѫ_ouWeR2.Zpm*9$FA o),1=$lV`U (o=/|sov"Zʫ!Z ˒1 7x?*̕U ~ &x]&wVjaI%Y~XȴGck:(ꌊ߫6FY BdnN2d &&׸:q qEA2WeoLILL@KW(%7-:N;fp FÒ&#l@A|f4X+չp+xzlʼn2d̺灅9N`dVY2ʴnu.ױT4s,B#mQ@O1S҉~uYNћBf]h+stk~S:RBELi1L\= k]€ۆ ނo(^-5<1CX@cSIh'Pjv DWc8 -LI+y.GGʕ[^HppSi-GB^rX]-֐ G494r- LPs :MK'/=}W2TVr|kҶEFxgZDb0Ʉ9\LDj%2 .-Cs>A^zNjxO7pDIШKVQgiD&%v:/U)'\}K/yx߇7=u~k[Xvb<-u5so{.q)'Lƞabf5`?<*LtiUCjuG1ӖDvqΒ|nxD 6UX,EKP]Tj>"eQقD w @Cn~J&*Zs#t>睹9=f4qۘ$:jFy(/NWcQDn(! 0 9 ʂ tR7$)HV@)Rjl&cs"I;enĸ Wk{NeD L@CoXJF h%z sR;8jp+tD#鬮p"$̈́sZYz4RzS⹶`|fT"@ڍ 6L9x=8IŐ, o%."TbYM퉹[*Zo;9ymM(zQyh T&Lڛn%/ А,c3qr,nI:xFz@50li]cQzOB=8ecs@([VofP?6FV(Y8QqTȽg?ciCi79)]+ +Q:4g`k Q)i/(I zx`@d|ad[ru:_y7]}α.ؾ'd&U=6zbGRsӝǵ Z>&e A|CuV2sr^RC#ƪ)0rc'J2<+5}|/+2UB0\].G jR)bSL$ ۢHVqì4 ۔D"p@b#(Rk ҄ZP%aBwLki*"k!\V9=.mƕ`ۄ6rVWF%eʣ9*`v!*? 0XQFlB6DmF 5S+Fqއlf|[v V[T~4b=MA+4.IjΔ 'cA dWcZ%87Wwn}Or]>VTt'I Z%^]J/Br x,u)Jׇt)?qsnƐ%/sG}y85C?1 `LWo=!c;_[_n$5PualFw!2/2VWZ Du&^`d,A3ېO39 At7ۡ/1؀Ka 7jsq>ϒ΃U/P ^_3̜>'N&4fgw19P5)PzzK%uȤjz2 W߃% *fDdMpk8}V0M P~l]XΓB3l`'r&Ph 6K %}tkLUE(*|hM$,kkӃF [yR7k#\1b52\=ruw5:+Fxz4,%9z,KBT)3\u/+]d(&1c$E` : >Z^NԒ!vI x2eszn X+ɣY1Ϧ >CGDP+7x#]oo,\f*,6HL嬏9kˋ_zOxѝwDt]=_ s~ȼT*Q%bkmSH Dt=H__n:~m?xw>5_\O}gj&LMT𥪫`QSOq&d*dĮGb43>! .^̔>Nt6#y:!~CJvyyyN͋ԛw0 ńh= Ѥ2mzVT`pec/hk&:"Uүˑ11)Qepļy{iWnC[a=3Ih@1ʰ1$'qahVҸylaeEo)5δg.?qz]`zNL7$&֑@R^Le9ۥP"Dxu|7"`=z.ġaՀXK rG+Il) o,¥B9 ')eF; 񤑰Q*#D<+VD{EN# qU /0 5 xxBFhUyp[jY5*hY5'VVT^Y_]Ͽ~.qthx]-╥&I5Dz&WqNqƇ`p { voxʵa<[sW3?VMIjN-dû/~|w o~|jtZ*fȳ_s#y~bˈv_<&M+ _p,"u `⾏ߎNs>uqcTΌLյ: 4{9KY{\]2.L̄j3ɥ'q/:lC3Cاray9Zk`j !m(s{%]-"3lgAq}7 چǻ` IJl񢔮>Lj.',R)!PZVSbW +[VD dV  pEB0pt %aJBiEUMՀ )ҀxM̮bI >ISLP.gv0[@aYA9?~b.(ble8LT 5e40ZlcߖcBuٸ{#+6Tj{GM]wYz@LY|ڮCE]0k_? ~ ׾[9~gAf3ޗ0[kQG. } uCGJeԟK}݄4.EXP҄x̼S9wK{cV&۫5=Zth)N{d"2sC,ސPP}ׁFonjh7v51jbx#/U9JԤsf ֠2mNdžfI'2M&~C >ɅM 3.RP:%B oY6\؂8)iDEDCH*`aQaF(b8y9!Jab NHq8(mDX(lǔyY19tTN +)Pi^k%Q3%Q KYjH`|Pe(eY ,6eL?WGr%m!H I7,A(u~+VU-Ţ}}@  Bv"YU*ǝd?fes,rݱ?x xr,LBO[uRrL~OKUZϾ;y~+?_j]44w[WjL7o\]#{/gd|bg)RGZz9jQsA|9r.@~~{sQScޟqἰl k[VBZwj^Hl @. ?L&A66逖t/n=lB1ulؐDib]$ȧ߀N%c}܀ofJ#`y F`wTVL8ò$Wr"Ez若)4y l9e4pu"<8Jb)1 AIo4$BZ8%/JzÌX`[+XixzNuZ^6x9\6 J;_޹6դai "krr-xrǯNJ0#28i!$ko~5O #Z*tEqǚ N%0b?ƯH'dZ?ɾd-VW:Ka@zbcfhGBd1Yy|TS43~7=[Kammo|o!6Ƙ8gkXL1ѭ&gE'kQ8߲K`DgS^Ȟ}եO#ə'U i 0 M a68b^ݝOR≨3`rw&L 9q?>ʀ\]vWP`L"MPpn7:Z-e: :qD_ĭzƄ8h]<8xG&ׅ`˜QIx2x' pl\5`P& jG9; ?#K_'xέwo;^1 " X6;r^h޷M+_ zjf˦&兌BNO B>>N-s~z΄P\΢J75{ xsag|35GTg7)VS׮Y~".x#$x[}bIo`JԻ)ZW\e@.FI53)=iy=^R6#HО0ʼd5 ar:v͠`gB4 @RRVa \<<|eMUJWX8R\y'A(f+h'|YRxYXΆ&JKR(KeP17$P j`ydTdʜ IcڂHpr!Yd.x Yb[K![l_wzJ} %0.Ș w>V7~ ?_TbL-Clzz|"Nu?* ; w4o }zJE=i0@:8{>9{2 v$&#0Yԧ b-</}Ϲݧ,>Y?G뿡ja$tL\d_a4J ױюLJt&兌\8 3<}K֕{?:M:MgwoD5/sw9j>s>{ O\…! exNB鼙IoDUo@ \aOk+֕AR Lť Wn$\!g`.`f eU9+FrLp{[AZqU ("tm6imr!A0&8xs%+(b5c0IB6JM:qFRAWeN[&\ȇ$Ќ E>d¥A/Xq+0=ނ3J+m?B>:k@H#Z^s0O.#ekQw~e ؑ?~ v?Վ X\3GL]Y G!GBlz!TJKs<GǪʳ,u﹇iՐ܂_-}*T#'ar DRϝ|wC;\z_Zފ)0mR$?r dlxzsVIޓY /?åRуr?e0r\c|b&u{zVU݇8.؋ط;4?ɑ9/?Ek1`E\XEyqB鄹*rvEi:f}-hލl 2y^WՔ(gAɠb0ڒq;AT@Q|7ܰvO]nue%|g`EXв^ʮ~X (M< l50c80(g[  zKQVdN 5*eiٰmBhe= 4; ǭL506 ruycC29Jް$`r}~nnD6޶k 0"ԦHdksQF)0ύxA_q~~'};23 _a lqYÕcd9~gt}$54Jr}nIIft˱4M&vc?A>3ɬ c>Ƕ5Dֵ}^}"Ҏ;63Mze?pr؅AƩaŬ |+[!,b4GEQ|E-^r:'O@+PEu( 󐮷H`P7E0B]頩YA8IBG2Nu, cx`"V˂#;C?B7i6Rq*,b;#˨,sO-Vb4cⲠfc8d[=*g"d,oW[/ƯվwXj5k+/ g,[jUjATt* -0iViq9.2еT^g>eY8 x;9uծ=\<1v;P ƣ{™L dZ]ɍta\cZDjCL_)u}իϼ\sܱ{@+DMšK=~vJB*0q>&F~;R~Uh!<ȣ +_|kc+ɟ9"d)QaX/߹_e>h=g]y{:eIN=%<|!xi댳`nv1#TAػD& +fX Sq9ƻZјC?MZ}@`]]''[/2NJ6'r jc-.lmS\+8QH)ln>RԠZ@+0#`&0k`}sGhU^=rw35t{TdPsc1 ߻Z%|e6d7Fdg\ݣ}׾,?XB_PZIDEG:nv{@bh&c`mwpxOƸ8"Jo}Os=O<#7+9I>p8qػe->DQ:a*we|<\^9k,Yp~.ۿ Q?%;E#~W{"%ji5,LjnМʨP?OG4Ncܧ1W}@.np5@Ţ+c} ԉ19ҌÀϣ e@  >+L!FI+^HBwi '<'+loJf5#B앢tXk%~8dxZ+BFe,[iD|Hf6Mx BU-!Xм,z90yT6E*v*| oG?iwC0 ǬLL\C9K)]ԪWy0+%eAEh87lҬ ^AnVf̼9s5#ӫ#rq(5sSrƀ0MH?#*%Zq>ӝOs$A eVgad|I$69фf iaQJF6A03,`؅r[=ec KtKy<`PúζH6+$q̣~P%^{ZIJ#I( 8 +&yȭ)wەZ8щþB6'Ϝd Bj qG8W8*y4L\ȉBZ; b2 ,5JkN#(::ܨ;;أd'z즤tryߘDz7 |FtV er7=5Z6F=.C32ѐu)O8v)r 7>cW({36"^=b-"&Hb6FBSvvЀRыvugb Q &A1-0V绍0 nIOɿ#]]"0 fċ,x bH;4eG6[Oz0^kGkl9M$@%XRW[toX%ReCS?rS(4G1jcHaBS5?>9:Աc~.}D'-e@i߃90"yb?\(]qGGNͬ:"#c5jl W K^Q~jXzKɜrX)޽^ً-J<3(U-S01W$Q.tˁCg>kW8}:ITBH=y© zW(bFp!PjeчF.`@P;[2爽D<(+1p*QQ2pKhhXW@Jll[!W21$My&yMrDRIH,@8aE{R2E!fց JQ| izXбۿ#EBaf9 XxC׺+3OJUGQ X+s{ZU,Sa|\v#DwsC WRØm~+UpyckACiٷ @̏G{&u&(ne.5ۿ_wr>d;HI"W"tT{n'Y9Ѵvt3Z;;e)ȫa-q9ni^ X]WQ0,28p~GKb"1)$Q03BtCGtl$9[;N2E3!KocHY )H(2Z@'D.U%̈́GFWRň=^+)½7)VVڸFyY5MѰ*O GL!%SA;M0 I"Ic[%(";X2 3R"D4xX4.F`cp&TY,|L1!x:čP_Δ`66OT͎5NƂ Vji{?Aշ1A%۹rYBd솼ڮ%YZͼym6|-ѥ6Y~&$bگ \u6e~"^Wg,)Ge &&Gtwz}O6(r=q\]l,ip)XmC [[@ܲjzd$z!(iiz>+7`jAbc"d#r#ޑ ؀ʶ(zr+QȈvVizišwrID(P(f3F| =z H^ N Qe-+XJ?`!. ePD$B90H ∴ayy`S8eOBhD +x `u6I( nc(JC;'ݥdL~v3ƃ "fW sf/`cܟ"1]+\9~,5 :r1ec" }u/ l&B#t4:P ^ •9Zk[?A& @Y%*>+fgPc n뻼=Eq̔5eGe: H5 xe'>~Ma@w'݃ ً  UBviB$?ӫ\Hɔޢ<*tf+AG|9T(^y/`3s- IЊ mK+r#Ţե+P1_z9r Uh\ k@lU+^0lȤǬ @K`&~u:ʺ_+ A,evuZ2gGaϥN}b<@$xc0Vx w4"΁䎭 Ƣp|. ?qLZ9K5Nz}DA"p_-K|cMca#%X^5Uv Ogy޽.Yzo&`~6mc;.Ibt̃z춟fgó [r=GXݗGGhy~ejTohn\stV,W`<#HD  .å^u[FCU悧E4|+8{FJ(vD#(h-Kg5+l:Sa`bs}IFҘ&ZRmhB$ kquS* D#\bA+&RriJRf"JH!e ܐ)3+ 4[E(̪r&zht@f\R8( (B#0 /1Ȁ6[jT,PX:KzЏ1`mu HN;{@v!=6Xn+s~D{QVUb!TU O7/Ʋ,I H 1]|U&.M|xbD8~>|2PƁ{`l9.<) . h {@,d;ssqh1_0CQeGG2)1,kQvX_K^w>_g܂/EIN AMlÄ*x?is8 6 ep`АO=~F0)TM18WRϢ HE0G~׬a%ሑs=夅(gbaåWJd- $(mGF+YΠe@LN/p%iD^zr:IB9-հ5Pf2NDBV7S`4lU 8_ȒF(C3":ei:A鬀kChi 8DRcdr`)߃;K'c`ML*e"Y /O_54论kfa*k{Pa f( 1ձc<A l U>?vӏ>| "U(ӡ ؊ sh\]16Vb L e9ޢ*\|OYD=+V(J,g=ũg\)ӊ :۲9w/8djfK-RmKLI`@mhF%6dh FE[(RpKjELJdMɪ(r7x3W97E{L7_d=3Pz {y5!%Pf&8*9jek8dB~& S'،!ά(c!9]â\cfdP3Tܺsm]`T`r!%Nz@iHHR7Ox,Q\i7 MCO*Ӎ=9yF.X>QhxZk>Hh!Bش/\ڱy) u IOG4#j 4Hmi&ɗL\f} _uJLViuz,l$am^j lZ5*i~e9x? 'թ=p(&Yu*0X33`{c) g* _ȅ g|{A)l%FHޅ饩shCy׾a>*h\vf a pU,bȝBx䅪ҩZ(٠;c1|p͡4 &1*%2ZG0è{ ( "DR'{O )lm"y,ܰr :Isk Opޝ jΝ/isƀ%Wt6K (D yQ01d+MY1a6>3nY?lV-'u4Yd'͖h/ 2kFPap ۅdZaĹkL+Ty}n=0òbDi]sm0`*BUBt\\Cd2vA Tagq5`$f{q^@Fa2JJ<n\->!,R`c {ؾbaEÿwм,rg@N}s̀1 dY˿ڙ˔j|W_J&7a _4`j>L{yFdK@+ =Si嘳\t簻Et01%j4 &]3@ibi:k4[˷L ;wl<3kqc +7$"hg3zΨ`¶;M70 i=)5d gwC)7w8 幇ɟM㼬Ǚ(;Qwֹݹ#yy%z[砤Hc*WHj9Woke@ptI9k Nc`j%88,}͌9[ \ 1ጣF8򁣦aH`*Ca`q)rŀ1ccxU{WH@lF!–DDߨ2[c02 nLp8ENcWQMLbW(G[~.|[ӿ^z&a 7nÍp}$9 h;Pxf8Rw:?oUL*$i Yu> <}]BAߦ?#7?\>w|M@u3[f8X[5rznx!y%}|/-b@i"፷v׼&sLuxrLv;`'`rY lSCr/}~5iqݻqkœkHW &ewwVxM<90<6˦u鱾ۃmZXg=,Z%+ '˟gk@Ypյ0Ş'OxιȆ/kzs}Zs;~KZ+j"~Ff;(U(Q s2X-<;r tg42c2ѡ@q G^900<ύyNf放n ꊉ ;pğx qzȓ.zwMߓܰ6ud1{{jY`-yܧw~'?clom{r jl>t˿D𿺸%H59jsD,Ҩ~x;7'iw8f`vwMdwf<>LJ;_91t.?'Αf?_e`\Ҵ1|)̔q]olRoj(W,l`_ƭTMT ‹0 6ԳgWʃDP&4jM.50_ٸ+;f)ಗ_x5ɛ ̧x?[ӳ'g$)HwEM&p;d;ᑏ6 !w'l)v,581<Y! Y!hZTwi`K-X11(JI BBO5I9@5ct0Ͽ+JN%g', Ox% qbByq\d`2U'sy4rG.Pg^z߮=. 8>5SL)xnWYif=6-vl~U@.{Dfb6O߷{,++qŀ\-> ._x{ @t$SeXF5$GCoh^'KUG]#G>]6h>|wx>DrVyY,&le]+x2]zۿ.p,<)߮>=b@;l,kЍ9Ψ܉F|Q^zY濝X%j#άitJ7IPWyMܪZw11`PAb1{dZIFۇ?]0SskAT+! &f^7 d(%POb6>8FP c#P-zn KpDSn$(+xdPE|p2ᭃ)f ʭܐD E\#Yã*(UYɀN >476ħVE<?L]0JkF&> A*Sq^ 1#9Ĵ2#}s0+|!(_ۿ˹o]+[E_+476q \;Uh6@m&CL&&6@-mϸwR$8>߄ܼ/ޅ;0y\m?ӓɦwG?3blS#a[<MUUA&i@Y =_h4XKYoW^~Yg:^8Nl'_ !3˞x1 4hL?Ϳqr$ϠscjY[/Q0cB8v\L 7pw0F9Qa%00ߡ,aV++BʠT!0/KpƐ[B9n!vn)8J A9fUv^ݺAa-A(FF5ՁقIB rgs}w{W!/ q#T| YdH ZࣟO~,VqMb pQBaḁ$L.C(#y4((9bm+냞 elzyK.&I;s/r!vi<_yJ³ٟ _}y߾ 3 _xG|ӓ(tJ*75<kk-1|߀W~ /ïڹY۵e?$8I_yi׊MבE#IC4ɰZMKe¬]K7ΔM 2ay0B;Oy:eg}h܎ѼKCI!rNY̦'d)7^nc>\}/񙿸痈Vj%M W6pDRKY=G(#5cL+o8^4찤vb3)Udaăրd7p=ɟr>(c$4 XG ǯ.8] ،a5P{Od C +Zi| 9t,ysCnV䃂GiP9#˭ALBo0,0` 77|sTszLIOW|:a<*(9'\Ҵ눁Nu1:fSp*Sgu.Z@m~~#(?S?l~Y:"i^y,UyW%T\v|M\W!nK,34|߯䉆\ pA\nA: ZӘCgjGSB!U/+fExTՈ`g0Vt$1'CCe58[(8 Q^d 5-TnjpTׄbAU1& .J !`EUْ)}oXxeh\k{G2z<3L{ӥvDmEŃd/ʯ&zg>}__v4>CE!URSdwۺurB|{;*[{K[|'{inex_?gYk]:fFy9_p{'ݒq;]Fύ=7"4] ^@oJQrws|ghqcaSG1.b..z*[ުfWߪEl.d@2 _Z2"L?sxHI5IJdz_kܻrӟ)?goi%Qfut;[^&gˆRͪxct4\c\8GJ 4Y]8 4v䬠F0[KW 'ُӤV!_s^r!g0xs#Otq%)#~')|wv&X_{ٌ/gfBUFmPLʌYy?_-~~|}3,??믿}\5y8|[۱ l61}gޯܕu3`),o?۷ݻbXbLڿg3,ق'+?s]+""&JU NV9`PnJkxcګlny v1 -Pxt7JF:cp_Ud_.H\hF͞{r/!O+e:GY}VrˈȕkSKdS`6Z*_ˋ|bK&xOnA9d3yMєc+G=C.0uw|^y<rr}X괤6UpxC-AݼѣGшg ÷p޾O N=o6AsQ;a M ¡ST|;wq`#[&^@]A1{U9 FpSuaR+cUWj~Q Gu`^%7.y-d w61s}|vgǂ1{ED3| ~9ҥ+:ی[j ɇb)FfP +~w>яlmM˛^{u):|/b)u51P*fWr#a% ,b%T |5%3Oq]>Oo(ǽ|3'$'穯/8,G ]pFch@] 3۾ܽ}ekr6!̓Ԅ"4 ?!읃FL>&b Ejwhh|񉏿ݻwt~/o _?_|dqP$N7q=%+06b3LP R_:l}!g9{"KS}~w_G_yOeB≿k}yJ9yqO|3zɕK^ofK465a'Zo!Prx6,L]CsλÂ\ʅQ ] 9!xT0~M?>v XHbQuٔ ׆Z,|ֵܛcr5L >1T)sC̆e}(HPCh"gZd8瞇@4J;s&z Ilش3kO]C(z<>n)27=[*y8 TyCh-=Q|TYJzPY{tsV|ktE׺)9|pK9O)i0+{8J|-r{?ɟ(dq^n wgò&4uV!cd#OQ)|__RCD0= y+KIJ M: CnR.jy}]=F ԂG{r5=e#ڱgp< 3]^&c]\0g7(YFI|y%WjȲppG hۅ*YFh*G/J :üQ԰¾i@ad,0yYTt%'\w!EQ`VWx;, 00/NdB,ZƢXIP\lN+V`d]r~]6&p.|0yl{$t&p3 U4upt[GmMLK 5Yt Ď'κPau=n{g >,F[$QaB Uc[g_Wv{w|k[Jg~9 MiE5 ím@U\ӱBv=VZck,9Y+v5"dT#;;ua6CEʷ)$ƬGߥ0RkKu$a#K)BEp Z=Fg1(_WTncVi| t̘ lޯ 9"O?kh$ɰT۬o6E&Y?xݟ-Pڭ^UXEC ˇ6Z `R|*AƯ~ é<{żh;>$Wm}x_z0Ozݦɶcl|ʬұY<609z/tVIs7fPvlڀ& Zv 4ِyGŽ5j" ƓUKl(ahۓ{eͱ7F3cae8 #QO2p2agQFh2 'Gbb z EjJ aG$||eQuwۂ .>chb8O})֫Ќy]HN^7|i֢ffA2``@Zwxh]S!Цhf g"wڍ7*+#0" Q~?LX R=% K1&JvĮ#IMTЫ5HF &pbXSN zF-s+# @< cn7CZs,AmgMUJ h[FoR,I@Aѓ穬nhvf $7|Hlh[ V$ל7eyw >ltG@`x}xU$'guQS NO6 ]\ O֜Y7\vo+  W3 e^Uv,\70-&PeQ87Xqkd8<8f.p4yij`ϐ[[~1 p0eq xpMCns0ʇ'0 3=d&0l)D(T9*xށy sA\MJiADW8=xsk.g)8+$ #o /C<Ӳa e nP"ΉBcypleC`b:}1dbIҸ&^=3` $u=KcJ09k';;ODT$:H'( _8ic -0Uby]Vfrk})ڍSɪ\mG~H۷E>lY[wnf z9=qf&hJ~?O[N6%I" bJ.ZAG\,&cZz dCvV]+F{W}"QotyxtP|HD.6#&O6Z&& E{;-bNw-m$N$YnDHeDٚJ6I`pbCD>dC$/#D)VزY) r _bU]W -Ϫ%<;ѵ 5fȾrE s[ }/aGw W˳Ysb9 oY/L  GP.4G|h8d:1318q8f`2CK̘KFP~2;!p;0j^ql-K疙Z kCyCVů@`P O0"s͊C_#F8,.͜Qtz#  1zE%p83(}!:n`@++@:Vm+\ ǕPgWAZRWyRZm}?oGGY/g+`I.*}tYM`E()ܓWA$kوÈW'=3@l4кOBd*Lƶв6/?|W6o[ 1b" .yx U;7t+xWفvo -e[Q20 0!{E1=vW::"Scbu{6~ YdPضE |[ 8Ogm &JZd&؉ն.yQ>luxk%}BK M)?rwZqo.?SN-|w_)nzQdslQhh~gm^%v|-5m);!PW' m2Z Ɛk} L2g‘UEYȍaے㒱(f(d5#, ǮPqAa< kȌ,*2*c S9oh҅omᏏeBL2Ɛel[6js yAe~a{a]J4"5x!Jղ ||[#߅!& MIdQN33Cy,znuE#Qc lNC3"̋,iOK t-<.ެW.lꨅZaYK~rhLT `6|#рF@&@ih\3ލ`DxϪr)T 4 wǏ@*z-lIƍe۹rCnpo S/ X 5 49fBĘJeArKm A]v tf{ؕn5e%7C60 9sc#2 DIͼ{iI Pc&c/b$jwJc`b%|3Og+tq܄uH6LGj'bJZ_&ѱM:K~itq@w'1Gm:A m^:W$D$isrR+? iGLd􆬻 e7I6χH芗Š=DǠh)k +`zo=PQ&e⬆ 5R)avg? 2q=xrUnYF8pPQ~eaa& qn1A8^4LllUc T~|# vo)֠)7@֦Kup[COnԱ mw{y%vbF{]w11i;hcAZjS%mg7T6dn$Cty1=&,]LC&?@059 ELCMUd|`3X90YrTpOn}?̗O[Ipzd Al u:PeIx%0`BHkW'jMZF$]uХsL -fHB!"~HIDpiJ1V<7Фc {WTg-DڜYN8ʬWL-361-K&pKi'zRǭ_O|K|w)V>]O7ac$zr7/ˈ?>681r?mԳk,~h͔JX]~銴YO>ec/mbZuD[܄ HBÌa` Uq/|:eG j$7 R5q{^66ظeY:tpL Jqcp\k A0J soV CkRRyK (pp2P>x M'2E ^P못,zl{XԘje,Go$ͺvHEt Ms#KΠk=_n8t$69 lU&{|N߿g>ݴ_ʹL Rc T1Pk#V*]V~"ul_ES G0;J"0f"B@HLh]ФGʧ̐^+c3J H]hiٴ<fiĦ9Dt"sqדĴǤXV Eװh2cG' > fGz\;*K` & IV*;bGB9kL3Ҵe?N 8`-(瓅,NXǾEG+ues˵byLw?u?FW\K|zfכhjtk䌍^r)^3+Éz%dX+SIzA+r<<: 4𜅉\T>`=̽c'0?q()K19{,W0T>Fw^lPq]sC*'nӈeRd帪` 3 1)Scn!@+8+yf4`TFF9 z̈́Tjr7F[@3zpEз(4q|ؖb;Aa1Pyb>@p(hk,(  X D10V JCDK4Livo]2T.pa}o-M۫kT:YDf[ĘUVbe/ڙ.aIDuRX$'~tRZu1vY6סelImh.Äh |}⠓ +&16."dK@a}b=u!0`=G;peWANhˮKX`;J༏߀g(i1!̦lg-L q$'ɰFROݴcT#{:PBrEcfBZ+ 'QkI-FִWhؼsE"=EI 4]0u/|ΛδR^Y2 YDDgE̕hQ I_RB$Xt~\un3ᝯ>ծ;gePXw/ ,4Pdcb&-v,ُg~\ 6^Kw_s~k~E]K$א}j W˹z%£rwPL2+Pyi 3MM`%\f C`JLi baKԞbD` TLJ([*2[AEn<̎gkJ<;(X4EfRBYH#Xl#f<p{&QRH0foS^AWS@W:W5 d BwanAZͥ0t2N/Ag㖚yӁǢ1/w<"GG'4+D|WzdwQg%J:[eK c|U ` ̆N&JkLP;ښD_EkKcLd;46L^`gKB8A$\ZgZ &1(H-'Z/,] KT R Yo 0قW2m'b1TF[p%ȯV1dmZ *Gއ)`f0+=1E>w(Xc͢b`3!*xj^LFxÃCJ7[6k嘯Wq,j&l0_ *[;PWi6j̈$(VtJnhVrmg/i&ٲP򡛙%z4vn א/|~oZHnXҍ̤оuJjs#\ɱ :Egpe~~_]ED|qF;Pmf?T{큤NΧR`;&VG;fl=^M D{]s~VSɜf,y%FNO8]1~Եn`YkP C\R@Ibe, "%=hJj}h _ߠWg>~3ܿ%rb*VC9 ڔOAЦKKݾ5X/MCctG Wzi?5HZYAQd\;F ʼJ=(FHDF$J^ϕ7My29>q˸LL6f;+O*?/O HʴviLef*/ ryo~̇vxw r^PΏe-5ܫkFnJJe;sO͘Af E@->8&V*5D ?bVU=##dJ&"f`W/xQ F<v#۟DU+jw {km4%r N `kڠMY,7o<<`hRk948F`fJ}/Zn bQSN`@Cjx܅uM餰J,j. @2-Š㒦ر.Įk>ui.srjb .]{& !uA%gZ.ҫo.B]Xv]kJEC:c@y 0͖)'{-4RV$X+DVazߒdV!52کx D{:( h`LDU/Ǐ䁟o!c@C3uyeira BוL.7۷kS SU[qb@@dO}dl޼ұn BDZ ZmvK$Dw";%}K{ݍس,NI'U|j.kqkn퐏j 8FIK6dÌd p ğ}?OXV\i; W~oŤ do'=^Osd$EVt \- =ǩpO(CpVSAfدu$b2x* ;? >,Jʎy-k8r.v<{@x 2J [adQ0A@]ǰ1ıy;pFťh[V=)dagWJ l#̼T*dj6p \=3Рe jy"<5#rLjS)f?zf.A~GP$I9n˶j/91`TObeB&%]tIJ[xkKA#L.&;wd3K*ѵbKƣ rP5(X^lHk̖fyXqE3a4L@U/G'&A)υPuMNYb1 p,?QA:E5,%K,){Ƭa3`@H|LIJb՞t%#YS1} &绥I}jkJ|dMi'k_ϑ>ॵկǦDz.J9-lK׎a;>:qI,e#6)5px1Ý&3ԳwO h^4|~A,Jz+upoo,g,QEyn:(s,ioo8<&Y>`^V*L!QƢ\02B,ضBa,FQӚL\,ˑ̒_{ \/?]-pc POa ÅgGՒghxau FZv&<%oNkX56 R!hC9Z$X HH:=]5PoTh?׾4;ҵj8g=_Yf@{[Edz4?X>:<V2Dr*kM6ipv1XMA$@PAuҞmפKAoyMAzT{g,far|3&.mkO7Ơ%CDŽmjm.U%OECVFn ҝ3'ω%#9Eb8`Bw^M&DWy GBɾxD 76S|)dCkr7Q3hSiJ;G붱ugr64iQX/oA2 圸t qŀ\- &7e4<,CSA<,bBLPZ2`0uP!p3uGY=^Qb:O6Cx2rQۻ|>{ 9N< q͂Af8ʬTA)C ֠౫x'߁?Ͽ ar !+O`r;f0݋nASp0 f,`Ҕ+&&G|CF Pc+ATl`w9bN-GΰDŽʂuQzerX /;YɁt:^{F)E{%W-1#^൛'ܟhtIHFڮ}~GtГfRD֫O^*k_11ۘ6"$'Kp5" .[e,f{mehBȁ4&қVsy ׷Iv($o[ځs<YL auV+3"aXurҔQ\rjd5̇aE'gHTĶd 湒`H; /Os'd{lR0*N=~@r+kݲ[&-@z׃h|]t{ ּ繢*Gopp>͆ىT Y8D0ęiCfU8aFo bm\zzjZ.p9Fpb()3 _+;ΑJWm2TLiZQ@8*v]Phb0 ,[w|ui!a¯̱ň,)d!MYϸ=pAIriCb8a3hav!?}C2Fg jPL>FAɂ2/3 AjQ#.ھFYᢦ b8+G3fNYXCWN7¾7̴8+I`rԁA,I,HtU ~Kh_;'o ڛd~(+h-G *kcRg\Crꁩ2İu]\*,JW{5c-*W{'.]I<'bS-ehH7磕"u>'6x/R%NUH;"+tL-%TtHO !fv$f*-3Vo-|[VG{i50 = b_ZE1v0]9vEC|oDLɣ0vΧ͐7F bj}7HM,UL/?||'nj㧛88y;ܻ=ֱc@L7D3Zr3܂b<55[EC\Cgx1 đI#!a&#f@0W IFceݠ9-<2(O*GXv3Mk`znP+p>ʷ17G9GFX%T|dn=;w@) lhBT߇@ Z)(kk|uqHE{"XUviӰ𞙫y[!Cڌch\i >iAx^҄Qq;|w:&+voDgAv|-dmd'FYx|`oiްғȴOIi-]e;PlmrDp! i tnS+rt* ~%gXI b֏ؔ%51%SA{ᅒH*]i/.g~f=duk?~)%O {h`z L`4oY(2a#MV$!>SCӪ'zg,-˴}/ ˢ7XΞdGlWXDVِ~!h5`:"\/Ţ=}nxd>..;ˣ?p>=W`za?seęV0Wi9 .skx^!ȥp^?=IBC]Kr+52/%zAO n(ZW2IYn{AN`D)?oIKdJcDOB^γLg<*رˏJOlw%@YW]=laS's 䀲Y#BNv/H n9lRRv;Lh &k S)@/Xkl3"/ 81$lcma$ڜ6)PQCT@hdI+ SN;cŇ\ؗ9 n7_' i=̫( Dj2Vͺ<.l~tv]A`D +w<ܴ: ieYxkb"1f=0(+RQւX \NҶ?mMsX S֫`k q~1[r 1/"雪q)?g}{ȹx>K2Dv|s'1)-V[~))>!X9ZO> C\1 Wσ4DgF'9Dz,!Iʄ(}ɯ IPF:`>{f}>DZr;т?usL. DU ջ$9y;}D/|2MwcfZ}c wg^xws?p g;#6IsY2E^`35AQ!dlmiMUAjڋ:~VYj(,*{a uٹ}Z18D53FjjOf_/YvN°J ({.] ?}6gǠɚAA+3Y,[ bb ׅa;`rF#+X ?pSVL" Pfjخ* +B&M++XᲜlA]j B TxAŤ!0̄QaYS> ic24%M'v@WvBYHד,yee,z]HˊHbpoo:ęz+Z:^c\~'%fɑ3نj;RjX!6EKk0"C}Npk,|٧Xa;st IoRQ.,_~ɚ=q :\/NHhB^׷$sP=Y nq~ ~ZBAģ\15yV6[!kՔJ/iH>6P6l>O'@ g,T2QPw/ REo)bz!r1gMa2s"eFO(^|Q:e^uֻfUzu@f 4~`UYv12q:AYaʠ<g +NA}S7(k>{˾7|hd6dcnEpst(0v'n^g";Cm888<[(([6}  r(e2UzP2Ւ&I]5iSgvw {:>7P;Thy?$1x]B.,JN-jxt霪T*ڼZ_MWt}1*'V[׾T_CXve[>҂8TLp9|llwQ5`XYCH6EB,-e%4kJWJ_%J:{7E"tSkwv1)d}G&ɱFjMjvgz!Y)-R.>{*%'ҿ;*)Cے"uL.7":eN׷*KS6I!3DC;l7Yc6k*(iƬv Y2'b-~=g2Ul/Fy!}f{kl]'Frot&@y #ثW~ڹYcr@O) Y!u,cep4L0ڼvTW yW,Hl930@pxr _{E@n$ayvF9r{^!Q6ޜgU0|4gƗtW;px eT7hnxWfZex.YQ0jI0,y(f4n/MF4aygs,04b8ZJHd4#kpQ5"S/{.&z>!ej~ƀp퉭iؐ7^aIxehw]unB^I;n5 9nZ@=XcPl%$b8&$@]ႬuON-NY#l]ʎ*>1[ɖ+i DM.g<31`,=lJ6E i]MW1e HM?_$H,2;!F j-xwʟ{~-wq\Md·;ޛhj`(x}/=?>VVAH D4u:+r|s'f fG9GU1>B}; A.q:0F҈kGh0xc|Ca,Z1@2Á+0e8n >p R1,8.&6ǞxT|K(^幟z?o&<nZKa BflG9_Ι:ӚqsyGsc4X̀ǥ㆝swϳ<3a| ֵ>d Ovw;}:󯗞Z1O1etLz0{кz4˶ WQ&Yvf5?rl-aZҔ{\S>!6`!ofz5,XQh!bͼQĜC`;Snw*oy|h G3#A28rj(w,b9W%!3QnɋzQ# [泚GuW! xX9q)!i:j󵠺)=i^m~¼c=m 'IK@;G5{_Ɛ:wL/ހ|{[ @zY];]{1[U{;f5i²>{#eoЫS_0E`M ?\ُRvkZ1A>SUaƷ<#=s;k(}XʿLrriF /e0YL._%2~Bhz+i}'iyid*!wi]4Ujz̤Jle+ hde ;CuʟE/$"J>H Xwٹ1W3ݝ'?yqۓXs8 >qjn ѺJ_:z@&c2bhyS9ͼzbrXXBh0v@Ps%޻82t8hlN&ʬ+lی<pdby6ʙJ) \2a{<`6hcVsDM?ͫsû߉vb/{<7_yu7`vQ^! s[aaa-q#XeMh; Mn3n$T-"k \S|bwX7S$ ɢc+OO0E1֐! C|yb-[Y`d`` 3 $gZvwy{(/j aV>c2.o.{oěɑx~kYx~;8/dޣ=nL Ti\PZ4 dF%c w?>aYsS b`[yrx%D6KB`228 k~Ļa#'91&xT@p5 ZUmak2黔UXǺ2+/U_~շCUNi=wiHw7mI2 S68Ө1&hJPg6& 8פَewNWl6C-ka$WI~Xۚ 齎~H|B;Ujk:V}=ȣ ~Mǚ.CE5k9چ @;<߭k1bnY3WUݾѳxG]Β^:2D&0WYgY2|8cl<$U.xSeLrkÅMV n]C1F^.6IT,=O!Ӌ|0ܱhkK|jQù|ڸ!RzFHKL?|HϘ#e?V~mϟx:f2G\+Wr\-Wr|.s,9::ѣG|k_ߦ_"R_R"`2E{tם'Uݒxvԍ'f-fs~s%q~s`Gg˶8)2`2 ;dRlHYgIF3!w$NnzvQuoߪ<|?Ȧ_U]yuM(Ʈ;6K[A H[H3ƤLQ;|8~͟B*^/ϟߏ%K஻u]Xd ~?ϟkepʊ li|F^٫g> ݎkT\ИJ(E@ k ET]yw`~a!B1Az`s(@tW55}#BEbBBQqa<gbx#L$@= ]yމx6Et\B$# I} 2 y GQq%cw\ Fq\G@£~.~BOዋ`j¢r: !(TTL*$'CT>ռD//' qnd^@ (ExCGbj :q BiĞF=C77ӈZG 5 ,W_PjI>6SMGUQX5S*jຮcjr SSдUf*]fU1]kb.;`(JПfju݈3L$-\f4Zm<X.)L>uPb|TڔfٴbffǁP; eS2|{pd^Q@JB,,^̍!kf܈QX2aPBt(J2eCSU^/3nY]-iXLn#H]馻ʹjdy1ɲ` } L`|lcF؉Ih[bѫsKc0a^d lˏI#`s#ɇ'!6V]F3%/6e<'ck(4ad]$YLSt3$0^#M@kj&Ix=^E"EC&PĝSt]5q c|9kx (> ĸ_/ǿ/o/ cb(]/Fqχ:@\'"Q%+$)Ą!EPDMՋm"O R -DN]S)k8fFbBI&"DB‘FJ@oMHuHb-{ɘ#BE! 2ë£Hp{TNu33-bx*N)ybB ƺܰKA8N>4f ;!i"Zs&ݡnvQ+@HD}bTgIẊ7r%c[( " F;ª Y1Vl$]`nWV!$ȃBk<7O򴒔 ~h$2Juh|("xT(B`HI`Z&).L)0hbx(&&QR:z)&tccPJT|S8]5h?@!xUC3:rdS B0Ⓣ VTLBWWpGF.aBB\0.j%aq.N[ }tXc[G(5 h qI7Рj W5 c29Oa/3F!)nդ)>i(YQ8f">Ln+nGۢCaR`&B1 A0%ԆS#L70*^H2,P kNɴf]b pa@b!H|@ [Y$S3rH3fHfy &>(5hP[d1]7z ,NlؖbƦB( *;(3ukf1P@:& #yM̌ ](?u]P!kB6]HMM̽ѥTQL>g(%jݩQ9h&Q2z nz X?՗:48Ra(\{fh4|P"fVʅ JT(4!ĵh8tmZ)Y'(*):$PH(ƨLz1,^0SĨJ PˉBz ~QhbT1>h Q䪆q݋ WSnǩ d1tFBj&4 SX-IY䅇 F()Gg LcGBDbW㘘C&27-GJfKbՌld"ȝMILXdzRf_ &^/ N Mnj\,=bZu(”g :(A4^CQISbv+r0S0$'Jb:4B @*OKFOUܦLOd'%ĬӡZ2BRŔVW(]pm(ZK{IZdZzJ|5$+tbuZcj[.-FRM2S -arBTH]a,vuC, OM?TY<0ÅE$} b4|1jJyx " i a0eE(`IXd$,D5@)03Bjм A!Q1OU("‚B\K8?-|@E^P<S (ѡ/FK`2fN]5W)|+ JF!X(q/4\M,JT,PR\NGquj *!{=yOLⶂ+8?:Gq\!19bd $ck@n5<\( T)OYzMGba]O(4CW9^[B 2nA0U&SKk.,х;pi:B%43.ð6]\7`%]RK2p;u7JLRaPl $9NTYGy\@=jVpւOQpEUȿ05fL*o마'36"vé1$ 7iґt/y8r)$La@c*q 1x1Q,z+Е# |(D^x S5,P)5҅XUpmHLLBK@5A|OI19'68.^2R@̃Wbȇ!*  BBqhHLiIL`LK@5(B+I;,)qLLb2kPU'#qm"/X#l$<##*d9C6ua*uRTuζe1u-RkoKM-5DTBӍjL̴U&H@4Xp!tm[K|0wRLk_kp6R/MiΟsN3Sp&?MKJWXd1MR]KgTT!/uեvInff%t HpGBkB@:"lzh%P׍t'2k|bv'A@mD;e(Q*F)xRUb,«O6|QTzS< mn,< )={ar$-t@Y^- ;}  ,QThEQ``׃)cI(LbSkSՠ4V/!HP/.LK|(*6ܖ(˘ E-4m b*1cP/b, cTQ1O/ՠ LL]G@UT|2z/.OcAAϛ }]2&O`8Q΅H\sGt1m*RFSbH(Xi` H I/ 1j,tӅ&iferKur戈3c ֈ@LB HXIEKARnVL1AV[oKSMfω-X:625$zR] R0昻ұd_(|q>@WDsʊPZi~7 ,x-߇/gl_Zv=>4?X,55_F0P؆-@ށȕd%t)_Ґч.|ѰGՒZ(z{0,5o~a"2`R9ԉO1qECgxc"A1VUcBʊ7}ad q@#@U }C-Ĕ6Ř:&pajëVK__06~ pqb0#j^q c]q,P4_DVtO.0>X,^vegS6{{3]۞tibI\oZ+_ fBEkzGDD5Q*A,6ӧ&Ԧ ibc(=38+\]:iDOI(^1^Yt[zIb‚>G ]pu2DETo }:6=fA/]qn6$vf5D9euPҰ|f2]O@dYuȦUBTmB$`)`5ST(w~z &>bΘ.Is+ K __ c ;|Ff:$ || ?x43#ᄨɀsA1S.O;6{Ba|@0+[|ADK۰k;V FgIʊ:i/mC_NO6 ;R2VXϸ1> Ϗ\bĢy}2Z_*?@3#=6M ]C # y[P8"C ͭe75=ma_EE :IO469;ƪ?}Јh#C xSՓh8kIM a'U P1iq|Oo|۷m_C(t֝سg/)4?ש]\`ww-k'ɯ,V4Z@@|ߥ=݋q_ٯxr5tJu`ص`Ɗ;ba?UВxP̛Yl>Oݝs3](jvAfj+ (YmăU9WX];`f|d.D"7VF0@Wϻ86JC+ھ }\ # &5 ΂:Oؾ:O>V#ySh =*t[Ee}b IκGMՃh}iGih>G2t=֗poXu:O>o?A0@KFQ.}kB'( D ߇X,خ?)SJxLUF} mb.774PaTVTwͱx5UrKm:9֗^DW]P`_4(- bbl$j'O]0O-\?y`dbj_< GQSQcRF<h DE(%hw@A$2 B0>˗/!AIԺCC_@w]&y#]0OV[R3o]nFz-*3+ 7h]Znʵ-qڋf"ax A2䱞p|"_X=>"( n7-E3yb0 l XZ A/b1c- #(6TÖ5RZχHt8 QTo!(hgFFl>0|.sWB5}H2ƒyb%I^ 'jE/'")25h%%%‡%*%e2|$-,N#YOIOV$RK.%5֝|.":'D(H)x'@xD1;&aވ3A\ // PS:YDђ߿/饑> ]2 N۫`}zm'ݲ-5>PnA1w1+K4?<ɯ2ݷ]=ϣiS)}o}ItMƧPP- 4>"(_ǵAە!TE1>` ʊ Y,&)Ϗ_ɯm9|t=# }uP w\>gfP OF_ AR }e'P1d ~F~쏆޻T?_Wp'-lm4?5d(W/;A !S @ǚ2\k|w^>3w=A?៟ V;|m6V+[׶Z-_ Zj;F.}-Oq1~k7X0;pϲ1AQNςt'o_d}ߥaiڛsD%xعs䃹Y ɴLX-j̷<z]=A4m~ ]=·d)zE槬D:Bok \#ʄqLВ2aм)~QQ&3F4DHhV 4o~ oq}^boD3}zME9r,fq%1i0O݇quA-T?*7ڳ,X XHsaaߌ4?JcEw'D@Q(Sd"N@z` ^j}/~;ؚ Sih%=4Ǻ/cWG% A۞װ/jG3%v7?`03-Pk*DRKg1kyQb8[;ʊP"zKpg{#@$Ee}ϲo˴ZV]>}+~?*+677>֖PkQk6mܾ|l6?:V-/`(|%KggjTFkɹ2<ỳ{OQ4?ʊ/)FW{奸W-/m}ge{hE͗b˳_EB E_(] "FKq;o۴zJiJΩY)UX4wUdfB xB,uqNI8Sڤdld:LMPLUZd2{dN뽁jYԑɬ]N9V48rSh0YGǂP[c֟i5ABSIʳ}4_]]IZ^7 A Py| דխ5AkS>ޅ*>S/SGc N;pű`mGS_;=WAHj-BA>ؾ늨^y#f`M {nhh7|Y*,Ҳe{߫e FW߉'+Yēؾ>H}PWOC]ZTD3-Y?3\7(SRf"z Pwd/˦hmjLس-e ~Qӌ b-re Z s5`@,RZch]d,##'+I&ͰejqVP\TtP}$&vɎccA$]kDQ0N ޻|mZCKfN4dfg]X6@ Wn_}J{kz|ܧxg1&tFX,d:n2$(Fe}]5UbMj.B^{GFCc\."(<"a,3O webǶ>}kZ_f IS8꼨:}`?53բ-}>>)_ocQ/ ˅(IHޥ Jo"]W 'L^SkW; PNPZo5om4ۼPZە7k%ݣ`Ve9a'&yI"r)X,ݥbha(|֖KS;F{(\5L|' Rb8w)0VZag{u|ؗk[u_~ kP OJG2Uƶh `Dm1MVh-roT5')2i-)tVJ,,N2%-'$YC 3DJaac A7J (A8tjs=K1*PrC-t:;1Zʜ,fIKf.KU$!BQUfG&_~1rL&%"?ոt]**=…-|)af6\\)۱Q[=VJ *_Wp\{^ߏXlm} bDM @0։H{[WJC+P] '7H aW@۫b*@}P2Y@I?KԶH$ BB͌¼9 ÝEYGB`_VM};dt u5h!Kd@7L1~*em7H,}!-R#n_qJja_^L^klMz &30*PDYQ8/Dh^T=!9^ ,Wɳ1# <[6:\Uu׃;sB?C?D3Mzve%|Ā1MQ]3w1+їi87PYug 4Z\y|2i~%5+Ck@sh{hmy \5dW$JC+>&Btg}-la$r]wA,uB 9`jYOq`z{?,F;ŨX= ߒcB`_ \,all̥Cx QmO*s͸Yٺ~8>cB`$mDӮmP(~6?iJ\3~oih}yg"٭Xm.PYd;^AC`v\ mfȰ"<'q1.zџƚr#6㔹6^s.v<'kͽ-4>&m,,sK-vUc:JiM|h{h}9#m`h_#c}ezM)q&Z4?e*tTUoiJlB)#4HS"C,aZ0+Kl󰧺e:u$GJ<)urײ,k^M⩁I` Q` w>._&PfAd̢fMYs dct̟{w㷖(fE-%wܖv7^N*2O`H']@>V'\%3no/FQSf\8 ]=e!>c8[Y {LAB|U?֔F 77hMኑ /џ ] OcW]ebZ{-oFEr+ "Ldl"aly4=,O>W7E\؄,-N{u>SMhmyt9z/Fbt} o-#|ܓ3|툊|YpHt}',ֆ`8=>V,i$gKj߷z^^zC$:~gs6ڕfB$G ֧qA' >Єڤ̾5wܶY bgf^a3x)OEu"56LF &PD<XҐg$ƪBؽ(/ - y^{ݕ( H!|lJBWih.EPf%P5D|)mʵWj@l+SgLbX} Ͻ|2͔'wl>Iל4/QQYY΅t$h}h$6?Ϛ4N2 u3ihmy).t3ݕY[yjf;A0ԨPèqeڗ"2$w1n_f):fI25Kl/B녗hus#!U\CGŲ/|>H.7TPAܣݏ`,h.S'kzx$AFe:% L{~/茄T=`)gH"40͡iZ?g q` ?`֌z|Θ9'#Ex[@zH"ɶ6']з˂Po&m3DBRȏH\&rx?a%NئrW+1t"+uf֌:pw60S"t[=A:f}=β^4+C n8*X RAQ~(FxȄu$ {K3|8"JƓD"'Հ m#B>r [gD\㋤;lJ'Q u]$gd%4{S%'I@k^]͊Rk|+(v/4TDN6aeuk!Hm_X\t6 Y"%6U~UE󰈨s[!!^6P Lz(NӉDH;Y=HBmqVέ! HhR@"va7$&Hq3t>.aԅ0 Md !HpMsӧg'w*%*Y ޤBNi[yH>D.&Cq KDw bA˴BUR ͲtWs<^n)Dxc B(1b4 Ů|i^!h<(*PsOr3,H>vJlrpiC1jz݊ [tl7n$ %R#!!"#ILiMu:HRAug!8I6!M,!ݨ&MR !a;drICnj.AIg)MH8v(ybDD@)Iv*&c(RTTEX1 mI(6ƼUCphǑQ_\çzf!f!.ʞHHHH|VȬARAɊ,Ɉsg遑{= u 72iLB!AB )BD,sȳ[.Wb1AY1$x P(Q{76ue1PA 2Lc@o9w O~,u,E͟ k+4(nղ\u|ݕ9c.[:DȘEDH 'k.z=(,^tC1Y>TgSWT"9fPfeMb ?!:O!DBBBBbAӥ+(;Y;E Wkkr,Sk0B "Ƌd%nSgY\pJAlR%a:'871sxWMBR/|e4w33?/ǧӱ ttb&Y/%%17$+i=MR&Zl/7qJv$!@|&DtrNkii5)Ngm T s"`)fRI!qbE @3 d-'-$ƽ%ݯuĹI/ܦãw qǃ;Tw{3Σ67/I|ӱ \Jh39$[#Cz#RW,(c$i +9&!.ؐQ="m~͇ŢdHB BAx!C!X*˚˚MLZ.w`Qp;x1OӟMNٜ F:tEb}$IgJ >! GzAr#ܭfu>NYo; $ªbOq955}:tSx n ʓ$.HHHHHܐp ')%Sɜ\CkϜFBIjAsbs!J­!f!gqkV/C9~P_֖>455nBS_8"G;p5Ukq>}hnp>&FZKJC%~2f-[ӎ׬="(׉~x M,mJ7&\QBBB];lS*tARX>>kq0>2Kډݯ篛`DzRT?>0wsFNҍIC}-719Z_*wD$$ !DMgJ#L$p!p1!D$(Qa+&0~$ɈB7>#ǼI:g!f' ͍q+KPzzPԎ؋\ FRlyf>5Ukylx}G3xT1>^نZ 󡲼[bu>nhš#DP瑴c70hyͬ%N(CMP v=X,AtbI@ҍI{T?\ljmi !!!3p",n#ň խ<)12<$I31IZMD:AQNfѡX*[/1׸.1 ~b)[07(;"aS Mc]WP,Cey܇)l3=Ŗ~=`'XI+=x}~"$yD-ۘefIGXc;ݘ֪PY^iOBBB 7yY+>x HZ$"w&]_qgT3Z[TŪP%ZuA{.\gHtWq#^J@"Gp>T_v_l/2-nHte32XMb Z\;a} w-vtcܸ XgZ;cc!!!n!ďHJϰ""3%H]PW``)h;`C]-b>x͆ZtӬH֚/B,6Ww%7*!;qQ"Tbq:k7nWbUY^;8f@16բȬ.Y Ϣq#~ýj-/ݘƠJ2&HN 2g1 r]]_C!AE$zw#|T{}'>ه臧x:qG=#+ӺY0[*jֺfcڽj"~TYܨv=HtO\{gZW6m(][V{`(|}C {`Ȗg`{yt{4Tbf@ NFhmy.`Aa$pMIBHQ>HzӺx2p SS *te+f>*[45nrG,Č +HHHW n\"`A Lbփ粒lrlnO uճN>fcL$$$$lLq%Rk9_7m ȭ2^p1c"DBBBB3!1ɀ>l4!$3!o xuH"!!!!q!_7 !!!!1똵 P mG$zx+K\+0t˦g"˲Fu2Ssw#śenfrb֎QgiJ?)1x6: ,E$z+KR֩۵JC%,_m5#kk8Dg5f5UkyJ9vl<^=ӭ۾3;()#aע7wC,Ct2lunu;OsOY6vUYimʃY"}0vJN~g>ډسw-/55nš2T?tcgFuUaC}-1s#śen_ycB\7(PqՌMhmيOk)[Y^;v ,šw, 6w9agLz:_Zq<kVtylHbg\1r9ɠluM } T-g c4Tu"=1"X׏؈ Z ә뒆W|:,Ni%$zmV\^bƷl _0Y~۫;708ź-M,yZXO/^gSG;ܸPھ)VlJG\ފ0 Uuij܄臧7Y;k"| >H^k-5QJNt5*۫slvfZKS6fO֎MG;QY^} p>o_ qr{0e',f[Ŷ/4ZאM\*GPr5>mmي֖~xk)ҭ/q]wmDC}mY˭z8tgkNl8~n}fec}q|ﲃ+[OG;P_?omjYn룵9`055gN逹_^ӕ୫Z#A(|x[p`qFM":l={c˻,rZNg_=|mϳ>ه臧,i>˵Z[f}Lw}`gӳ~/76u>G܋ng۾ '27OuBgeey?',ttZYűm8ճ3۳qSs>:NBB]6_9|prg]-bH\>g]eyT9Z bDÖ뗆VT,JC%)gY`)NE0P"FҶmlgI1bqtbMCMO@"|< -[]Y^cH^݉Cw=kG$2M|Z&PW˱TEsFiB$2SχZD`*\۫;Ը zzS|gQY^(]Y ;ؘ{y?47M?bP< PmDC5 w=[P 3\`*i,/C[Qp|wރHdm~Y ͫ5cu8mjQYQU[W:4ZWASY嫌1 @su=ADqL*Wj6ץZWb˳_͸uC3y%8u,+qb8|wcW_Y^uf_*%-~6;]ub"9/;0e|32)/Cը~p(/3ևI@`m\󴡮6>[fY7j?* 1v-֖g9mvZLq@16?[>⎂[{N$)ϬܸѲij/ya=άOԘϸcM\,UDl;}KC+ A)"oJϳ{՝i g=8x77yt׬_Ư͍K<+ٙs74T9}1eY`q2ONScS1GIq#b.[4զ_`MEg,L0bP/ggDCuD畭s߇Zkmy(JC+N#DQSG;ǹkƆşgGIMO@=4gxB%Z{z fAbJ7p֢t5ؽ@ dB6-k*ʸz0*B{J M?:ޱN]S}#3D`icױ^Gv.2z66jZAX,ACK%*XID)鳖 fP `]6]X@17V_u`g2ɷѯ|3{ :]4>,o-8$`7Qo<+jr{w9͛,leMyH,ǖgWګ254MќsXWvZ>Fp/&tZ.}0Ӟ aC]-u{2ơ#Y_+o֔Y!C|myJWŶŞ65Fey"aDӒlq=WYvMmfme.k֯{NgN{~b:)o8tp{7NtE6hmyG;}}|ehm:c2sy1gO< 2,*"cU?Tн) &߇(]Yzsi47nd^MF]=8u,֘$P,~N 9F)(64>>%۽ؽvP;( `OaC]-ޯɧfL; E+,}/sh޼)L@Χ/kڭGLV bo:rl!_WBwsr& KSc71.o}q+Z_܊WwGwetcmEs{{*z4{erPSm~D|dD1>ocuUk5̇Y:Y~/=f6ج3۳/Ӟv?k{#c.ך>-՞)YCΦzz6w}>>i)iQ|ri;>\?3F^Ϙbq_qY'*r]>̔68Gg \ )_iFLlung,"Zr)gAzfU[qĒj(|&Y H`P_ktHSrat}AűLIfw7թY>mDC]iiq7q"&j6elEUb6X,n $X}ᔠ/ .HcvIf-Y;Nd+;aR`@iI5uN{* [D'XfQ}1ǶWwZDXO/WPdd25PIV2tp" ~EgSMWOSQ&GPYtU8fVsƌ˱U}Q潺zzʲ|ao< uܬ.qb. 77nD ߜg]Us[yP[,77Q\Fnv#pPSHGrA>)v6cipKޡwSo4FHuo={O;ӑ<->,Htju7" :q o߱+١w(e릹q#>ڑnsOZ@16ig=ٜU9[WO/1o^dٺX'!g;T8~N4b(f5\=C7su:"^'R/YbY5#tʛ8Ս|%cJ,g w#R}t4%y5oĉ sS2I&xLq0<D McsF#k;mZo7pef 8|p$XZ;vtedblT0IlZ?4ge1%48\t7zNo6YrNkq5Odl}/ b˳p>߃{Vlyv[Z72Fh ;yڳw?"ݏ^Oqʊ2if3gl0=͜ |}8}gGNԗQ[]e;i8'~%j^dwu$3Axg{dHttcI~{wk}ϺXl߱?`ﱸ6fč qʿ׻ f{j-Z[ZjH`20LgObhmjGڲ~Rt:7[!B jYHⳍ)z$P R|=oKM7~96q+9K}["7H ĴD%V3O2thjZȰ%$n UPJkX(S![8$ sF@9Ds8Uvtһ( d̆ڗݬ3շ]MZ45nBSYnKQw_SBBBBBBBBi,vn-e]Ҟ }-\v>ztg)Z[\| 7Z9|pӭK5|!5>_ I@FLumX3_vʰg65f-)%~WBBBBBBB' 5Uk>هs~xkCP_?gU >S: A˵T+UlMBʲei|akEJP*JHdV ufaBa8bنZXg3'P) bGg֖$9ab6wYZ[եG;S?~ks28Oc-֖NK̶~'cޜL}|׷-A@b>{Ը JeXS^~ m{ihWaOD?H< *WTmj܄,_U( pu{>~嫰m<ݿ}YEw=ؽ^ݙ1^U]ckMZ2si6@۫;UmmeĶg3'n`wIqmn܈[ij>~MpG}__73$s^G,?g_q#te JWXOۓXQ֞``)"aF;"a4"#Fey"aD糲EMZNVީxB%X@C32'AC]-uA$:Ht8ŭl(|*kQ[ӋQyY[C33g\YQH>סHʚɥ;-!!!!!!!1J~j~A $ X~G\鮻j~i_7>>7oX.eJ{ )>/mپ5)n O!)m^45nB۫;cOcC#F&vb˳۲NuΖgq}C8%LgNݏ^OhA*PpټO!|}'rH ܇臧7p?p{:|p_NI"aly\\a˻i=I;Brlo Ydu0~/@a2VM8?1eP*ZlyvcS[9_2q"\ů[1B$ze3c]$yH"qXO%\ynLBBBBBBBBb!]$$$$$$$$$$$f 8"HBBBBBBBBBBb $ HHHHHHHHHHHHH"!!!!!!!!!!! $ HHHHHHHHHHHH"!!!!!!!!!!!! $ HHHHHHHHHHHH"!!!!!!!!!!Y'FG.QEw,65Ju"%! !Pʑ E̓D dHHHHHHHHHHHH"!!!!!!!!!!!! $ HHHHHHHHHHHH"!!!!!!!!!!q  H3Q5 B.@ $pd!s#~<<+"x M0B\t8K@zB@F&S`cbP-`'{[! eDh;VEX0fK9-0IWfH  0Q){`##xFW<+*x<$9E[-qWW.(I+6aa@.y24x6_-"bbϫp@t~,/;m%h^ uf@Wp~<5j>{-]cK'Xto(hw?G%fIq^D$.Tʳ?D*A, `6B$BB dr`)B(Ͱ*`/@4Qhp.U=pa( Aa!ڈbX#!H$ ɈQ"K5H1RT UH=r9\F;2G1Q= C7F dt1r=6Ыhڏ>C03l0.B8, c˱" VcϱwE 6wB aAHXLXNH $4 7 Q'"K&b21XH,#/{C7$C2'ITFnR#,4H#dk9, +ȅ3![ b@qS(RjJ4e2AURݨT5ZBRQ4u9̓IKhhitݕNWGw Ljg(gwLӋT071oUX**| J&*/Tު UUT^S}FU3S ԖUPSSg;goT?~YYLOCQ_ cx,!k u5&|v*=9C3J3WRf?qtN (~))4L1e\kXHQG6EYAJ'\'GgSSݧ M=:.kDwn^Loy}/TmG X $ <5qo</QC]@Caaᄑ.ȽJtq]zۯ6iܟ4)Y3sCQ? 0k߬~OCOg#/c/Wװwa>>r><72Y_7ȷOo_C#dz%gA[z|!?:eAAA!h쐭!ΑiP~aa~ 'W?pX15wCsDDDޛg1O9-J5*>.j<74?.fYXXIlK9.*6nl {/]py.,:@LN8A*%w% yg"/6шC\*NH*Mz쑼5y$3,幄'L Lݛ:v m2=:1qB!Mggfvˬen/kY- BTZ(*geWf͉9+̳ې7ᒶKW-X潬j9(xoʿܔĹdff-[n ڴ VE/(ۻCɾUUMfeI?m]Nmq#׹=TR+Gw- 6 U#pDy  :v{vg/jBFS[b[O>zG499?rCd&ˮ/~јѡ򗓿m|x31^VwwO| (hSЧc3- cHRMz%u0`:o_F%IDATxy\U?[{uuޓN'NB6 $aG0ˌ( :#08, !dYꥺݩt ygwy| :;D6Nノlx|BmigNRqt[ncxp8`UߦjXqʺu~$ҿPQ R)wq$VeU;Qqi%䋟F/{z`7[v۶Cg20)Eׇtt|ױ?~;Hx] (;mtG}l6X[*r N?nf77lp/\.wq6}PN*\"uU<c[u]Ygttt޽{o d2ݛ9xp7ݝl:!9p0m4%֯=kދ;'V&׭C9"dG&;;('DfDnus}hh(ғf#GS;chJ&JC9xFX}x54_z1zzztKiu~ᎎoΜM34Uyhn􏵛6sbזR0xx^_SSSbŊ|kii9sE9u/_~Ť@0OU nEk֬60B()'f]H),[~ڮ^=s@^{Hquuuk/T8SO(JX͛GBtڵodɒz)ᄏM'E]TvXϘ87R@ZQ{9[omXrwww m7o;믻&=aFݝR`v.x&`ęҡ}&|Vz{ vs̙Qei;/w!$0Ȍϸ7o|Ia HEQz;S,߫뮻naW^yeTR~K@,nW]~+Ͼ9)Mcu틀7BCT,KmjRգى1A:hYLV }>Ln%R?BY~cǟ'K)_ ? ;;;;5k\+|sι>B)%UUsCcҶoomW(X߰*>_y^s~'_9o>گ:::On?r`4MNquw~}``rw_Pl[f6hBG?v*P) :;gwg2? zvY涮'om7pl6WD*k.;sk?_|q`ժUS"pMM{?Ӳs 7|!EMM#=={,_h׮֜rʡ٦¶OF=DE{y#?~{8XT8]:F/9!9 ,VU :qxŹ`syMhā-& 49kkFPG/ys-@) 1"~gNZ4`55Vvs3f<&Qn7oFGq@F3?[B r[ws<d$0A vƱ6ǟ`x<~c(w;lcy> _cin7D>}[>~eY =pn+7\jhhײq}88ur8Q朘S*;C[$q;. QLf~G I$:dt lf{Zw kiXWbss?O_qOΝ;;+0vc)%m"D"n3'u!LJyeeg,.ɇBxA]O b:yèa: ÎTX~>4mZ"'fu)J8ٷϏ=hoߑzQULOii?rxϡb_idLƶ]>|vuI8a+AgN̷=|>mcx.)eYۋ]GyN0hvE񺺺'ӟ\fR"tkUtti}4c-6oYP'Ѱ5?7_tccX,s.0d2#rIt=G>?xv#Ótx\+а ?rfe7(x/ʹǀ*؝Qxuw8]^WF/~rͻ~{߽vb՜]\.->1_ ]/l$Cd)/FClbNQt=oyN\'w(BB!u9|OQw]Xt\qix}XGE "(Ms|7}{ѿT\5*\,[w jAvtc}HddtZZr)bx<jFrvF"'98X8gyk׮^)v)}Rʛ.ԃs鷤 ?^a^c = {, {o,;.=.]p;K&gYX[`:*=9ʣPY|-r)%I94o ?OUYzc1fEkOF؊hjZFF43oJhqA˗/ag}b,rC@$?pWj k+q[9}9ܛ#R@APVD\$jCV쨶c@֢d&# ˲6(,xŏ;sioL~*a2h{n'ZZZkG>bO~$XcGZVrǃO?@~v~992+攐 (FTWcE(ze*C?QQ8ރLuB{/-?mcEZm,)}&w3ع),x`9(-bΜl ##ݸn,ˢ{[c=Z ܹs:}ѤMqc;~ efr֏e{U4ꢿeE{4u-CFPp+c#T7p 5ddDxfDp:"P. ?"ԏWGJC;>swyBЊq___S^g~4KT~\).K̜e+Ȋr0GAIa2iOx xUg/Ң"ƠR*]&in^F:=D29L]bzz6\?˪v`cq|+?=@ol:mAmƣ0?.7I%F^{εy8M#t eHlnV I}p)_8#qY8r5P (J$Gz^۲)E/75FcAC,|>L?E]G+LbMbݻЖ-( n;/6t`T/ww?foe6 ,}TUع7<|1vFtH H;5= FA/F5=wUh|mۺ~-[mBE& |(T hn^AkR*+g124,(ʦY.UU?5r@SMW^uau'n;\qCT*,hGn /LEu@OݑLI'#q x"No)fkrL|w&cm"qF;fd̨:}MYYd2H ٌezURW_l~m.w\sfM=w͛7뺞lbw}{GGIlfp #oi[nc[IJnF$udzd<8(|N[_+c#!@XV) L̑i`{e4aH4MO8܈e R^""lC2YBuu% &C|iή뿙\[{ 7^#l0 YҡfNȪ-X\d,X` V y;awCT`II:PHLqX<5dۆ]׍mp ʈ@*xļF,`fYi'sR H<|nEɹ2I<^<J\.mn"(MM=D1˩(!M`Ĕ~}xfΌjj.eۻk׋/vNN&AOݵaa~4BmQ<e/Ɂ9'ptץJ|jCc/ԏ bXաBp<dkQ-aèx$X|P,Ye5vx]XJh)sQUUZv&F,#))P&c?о}lPUgK.qWr߼džHBa`,LCWQ iGEq:غ)Y|@6q7a)\rj pxTUt1,D"E:>045y童@rXj!5-=)fz@@% }aA&m])^CnrMGy*7gX'05\*Je`CfW1dA(ũU` ]\Rlls;߱n >aFJ^1;ј6-6-J|=3d2:{N; tyf!|9&rm; DYw pdP20Ө$-F*[cymb@˥`8m#Xy0iq̉+(؆CL)N-AA!x\_dO#ecࢬ,IY= wKK!ݠ &Γ~g2!DiQ1 +CoAm:@_woh<& xKUA++1 9z7jTېcJy컘GW$ < )d>6Zku1F\Ε]N՜G^H%ɤ>~,!nEboܑ,h*MI,YH|VU,0} t)HM΃mc1(Z3##/H RA(eeF;TzhhY6/ 3gfKʱ|^,QLRl(*d*1^*^öQQ< tȈ@J B($)-eEE깡eOd2uC{m+z/.A]*]Gtt%̉RgY`ʩ%R,M`=VzbIHԉN`1 䔁A.'p R[Z RI0(xpeE4zs&|QӴγ_riC PƥNL$RPT,9YY TLjm1۞0(JAjKJ B 4MC Zڗ_㡡=mfdc]׷he0PyCEVq g a_אm1[,Ji;j ))f屟lO %%  %V1nb_} 5w4 eVR)Ӵ{ TJ rFHΌP߬U wlt#=qTVEHIEs](R SWKmC@VZ*㑸\ "DE)AU"m5TUՙUU;;vw(#aU-NqYE@-r\dĈD.iۖZ`4ʞ=sg|m̏Ψ-JW{?je~FwZ)N&0SQq0s XLɊ>-|[W+-݂BE Q`YUW1 3gֶ7c1;Xɼwv罦)4eV>u+mRQ.]T}ʲuI~=KΞR]g麩ژ~ڳZW-w{ ua$3UvAύwS1}CqHl oqGA.h.,>}֜`c6yznW 4G\(JE)EQQeM媣PI9-Hi.0Z[/|-pz {,={/R.1͖#Ѩ骨𧇇5,0:00m۪ /m_hdٲ%O8 YΕ=sտ~׻n۝w "pǓW^ſwBPi (xK<jKڇA@ARJYMG9t=+fEGGsw\߽7eh%_B4-1󲰜iJjՀ9E:撔'(^USՇ1w&-qțo:~}E !4, j[FB@:# RVր(ycHunww ט;wDZBHD(=a>UUg,Ա.n=يR#qMa/AO>ԩlO i9iQÅJo}zy%`$UEYHBE|XVB34N6b:'K_UQt]DzlTjjZ0H! §UW}NK^ںe2GΞ2 _MFn E!a,C`d%Rf/Ija?DžP aPµH˹yzC˞}W(w8@YV˄M̲Dblv`Қq0b6]KzTVO8MG长T`i+a~`Nq/2K/x9۴QiTW"m`C}ޕ1)(ˣA\B<yW䨆}B '7%=hFYY#.F۶, EQ4 )mEOeiܹ;TU};+46sWQsf-uؖ q/暶M^~LE +O_O ﴲ+.-+uL RfL*$Sz%qd(EudώDŲoRxt#X][uWs>YWe Ę a!C1U۶|O#mk{bo{`; @˥eOΜT.6%ZUơ|67OtlItRxAqbiPx;-\ͫԴjU!4@XRewe}{SN>'ILS3Ð.@2IENDB`ImageVis3D-3.1.0/ImageVis3D/Resources/bug.png0000644000175000017500000045107312320517543020424 0ustar mathieumathieuPNG  IHDRH6 pHYs+ IDATxKmvZc̹{p"q$1%"RJ)ALJ 5 @%xDH)(sk9Qs}gr\biOkZo}R$$) Oye $H"fv^)g!IRHD8>f&)"J)mrY׵2HffYja)ղ(-N;_~{R|$A@RZW>?ڶI;M01Fk@"2SIao ̡e).^J!mZVI۶vN$RlsޯHw4zimb "hCF~9-/ 9d{="wD& hbRV뾵־r=/UbkI\b^)9L3a}^6=7)S[{$Z#FfI}]]#bbf 1Za`Yqlm1/z|1pw%9D%3S"˧`Y˓IF;`Iɸfl{ty|rG&eU0ȐZחӲޝJƘKr<8$"_w3/co۲, zf*f9$y-VQ]O>{)#I&׺16VPo>n_sB23pHReY̬>F{l9]1Ƨojߑ@)/Ruߟ__޿[d,DDR[EhnK(Z޿Ne1L?KOy{.?aQBB 0s1@$2is|nL^HH rn1Ic ᫛*>1P&8c x=[)B8XK1I0w2IF$O\Z6o oZYY^y*N?3 O)xڷt:_Hl(qП+έ>3ꖤ_CfJId2ZkYBInHE#!T*a뺲k1AK BnD`B@se )BnF でAVp{/c*鄬Vz-4M$Qk%! 1@ R \k\{Dc 0AI)"RN8HeH P{wHnא(Hi˲1C@F(Gt[-a l~A;U}"Qdi!4D1 fŭHR@#jNR!aRضEkdY#:( r-,*)FF)t}&*% DB#1HHNPF8Rk=WSYfNqpf,== !rnVKQ5,n\}ep]W7uU OH`,K-tcNΘp@*RF*f6a.q* $)5s8FB]Oph=,ZC e)>}XJ<>̊y3TDtw;mM&"%wNx4+12=)" ^k-9@+%of6-3bz~.1'V)]bn6hpi,G F"gM(hi@]1Yt1fV"#zq%3GK30`@@i2QO(ƥ8Z<^B7Zcb27tb~,kAʡ01$M\6+mǺn澀t ]fEDT GDP'Ə BR9|IVϬF1#F߫ GN΄B6a/*b-BRj-n0>W[V1ʈ o"Н'X}*&c 355}?qJZtS'z e\,f%l\ݪ="} ˁ=LƩ*ءa$KY3+)Q8ꕛ-kf@AQ4yɄ"3c$QPcT/FdL"29.e4-XV)ez?ٛX9=k/ "{f0*C}+DU;2sJ(g5sA)ZB1nj)FjDDy)%=,tP1RFDDIsZᔀZ#̣cA'(nD2#5Ea+R/M|X"B֚5{@Mc 6=YYRPDdkJB#s5EѕfKwgfԲH2}dV\Duw23C[V>7Ǟ޶L,YfJd"i̞)2 ;Nese+eq+1ַFt@ӝ|[ZV뾵xIfGK~Ih!iINO܄<4 N,'3!YXk@fF90̬X[f$zKLQu3O)ԡ I8 ffi΂m#{ޗe9R,Gq:SB8MmN ^8%neqwS)229Òv8әMvjccX)֑{-RꆰGF4^(*9aHģB8o9%p73 e dx]{}.:,}AZ->! 쾅;%"t(sVhFF`KP|%4>qN1zR 9k&hД.+0DNy:PrnN} #$ C|P$fZR#a#tL/5Bi^R/!PCV=P: EnVrc[ۧ+s(2Ǭ5ϔ;H4}ۃzsQ3 NBR^'ŭJ2g V2G2]0M/IBT60,E Rr1sdu=Ͻ뀃E@j#2D$ 31ŒY [&u!)rdL=# n%"2. JZ>Nc4 +6})~ww3 d5Harl\cfSxm1F8z#=2ѩʜ1cooyHӗ')p̘AuԢh;?BH:F#]1:RJFU:ڐYenq>3,1b2MD@*$X`ɤQ2#;-fu01e|.o}#[4?\Ln؄43="$6CVj-V!C&9G󦶽 Ʒ^6kZ=#:䠁^J)ch1"SP әl9|2adYړ{Ĝ8 bNz1F;˥;9B"ӼXz-sWmYٯ<3s(eL3iOHg4epWN6=zcEad(Qk]ד3[%3RfD% 02]RkmJ7M.Dr>v$W'1m[JC}3ڲ,R*#گg.:"J9í,i7,p#ޭ\ϙىrtsoZbw1W˶m5v2JoUɛx24{`Ly53<(_aM'yșy3)1ZZʛ$c ͬ|᷒j 7IF6oEq-01"cm̴5mޣ68ϸuA3SLI&h(\uP\/{5?Im8'm2ld'E;wӚwݥ,֚?kY{,xyr(]P׾͊˺5ǨZٴ-|ٴ6mI}N7"b][^xN+mt.KR V߼HKwQm,t}ue{6aYrJZGҬԽ6^>}c)BnzYFȗ5{!z˾Kp'ueBef6W&Sj2@I{1vz^^e)^ VzzzC(?wZ֟ Zmjw7!^H{F,i;-bRe)FTS.?~23iڷ Z5FdSdVF@-K~cS]_^^NݾwkeopwђiiEˋ_>c:dJ/wry~y9N˲lV{_׵Gtʀ>:@-ާhN7O -yK{fpesxx4 _WsV HUYSkmt:պn5+<^|޶a 4(e9 ecH%H uRt;dRz}z}}}~ >'7Nw. ֞(ʵv:%|\@zRN'Ҷ-} 雩C{׏0kGSRi/!][k4ضmBGP8P!鋶mEt%4Z֓-'_$^B]IWVArYNi]PЈZDd&4CCa(aZjY aVBe )fwlȀʌ4uYo1ǹҌP)L17F2OV23^@u=$ȜIAUV#BAf Fd4OTp;RGOYkr<<<~\~~G6?oo~\x;3[t c(2s62i-A,߰>MF?%d=3IHacN hش\Ӳ>~gc[^W c:cpGH}S]Il k-s> C9wֵ bŽ5V+]^^^T}?丙Zu}zzpp}0bbE(DiZD+9[8u~;-"i 5Z@WI>mђbk,.Tef>k:e.T3joiRӧ{Wdry׏ݽgZ}k$\WҡO/훧_s|v.:=Ž|z^EIܫe6 ^/rt%6O>- x===Ge1#חlm۶k2{M_ޝ[e=Ǘ$+¼SRPRnByz }ifXkYy\z1l@}@TèVa/1"08Fsw?-pPN53zɜS124#RRew֠[9VG^Y9 ZqeYU%Dg4w##)/iFdRALZ`GvOwO~'+7/?.TҮwB.=Kݮc9tq,뺿g0)ZksYNbult>Vq/P*#79 ek&ّɾeYRJuJ&,nb*a.xX*2#5/g;q)cm3.Z" ̡ʔs ˜q>=¦ IDAT0@D]u=֯} y\^"!Z}$1$"/L1y->rܷͮ9ٙ=:I|rIFҍf6'Ԍloyz6iʵ7jhA$I͘%RjfZ+ Pk=773gm#0Ffֺ;cWIE _,$k*K;QwhYޟv~:/쥆w>{Y>=]脗{2r^ryi{|ω<#Tg/K)K)Re,BrG벜<n m̴^ZIjp%,RUS' yubݬh1jRςU $>e;ߥFa+tK$ݩ Y{q1H%7d"H &G6s.nrqm르RQGu)c3DzkmpҼpmoż12`401. D=ZJ[o{o׽WRBIz~~%O__'ݿ[#Hz)lV}93~^d$b>F,%*Q@B0 hZ,🅪:0ϬAzӓclxif:'eC CI+8r0kBG(Y3 GP4G03e +F!;8gđ۶x;k/ϗ'/^E8&}aYzZlW41Snս` 9U%GۀʔGL|{.yr6""Eu K޺hS&>{k '>G0猔Ho-ģ0}[_uJ*y7zqItzp,"r VH@L!R,+4?Fb}t9TbNwpA1>ЛT]Ya И31FJ=݌br?~Oћoߌ坛r|qUۃʈ*Fzj^R9۵=>~Ap_ XOk'"e?eW_U\'ngg٩v1FD'm9|/JY?hN(g9B b_~x||w_(縲CR^ꚙzeDYV+5j4YY5LCZowuײd=4+4JU fr҈HX5cġ́qm>+G&t%RBrP .ۈ ̖Bw@I99][>$Гtl0d0W%14F1dI^i#fZk5B2N0XQce*2WڷslqL[t[blFrFrcO7Jo촑rq!fS Wn9JR)Z}D#0^ZkOOu;uwc.חT%^ه~LéG/uJn)2@N^-+jBKVuCҕ~<Ά,oݏ˯y}xaYʻǻȽ<޽4].{-ײ,H523R~^OgcN3zv; 1FJ)rJ"2$ )1uR28|N2"3.VJ][^zŻugZ\6:_V}$+Kqww.pB8.Vޔ`q*jMS.^^^N)Xz<= 1iQp7Li0n~pݿw~~gREW?//o__я~jT$`n/e]_^. pEΧϾrE[Cr  mT̤[9r&}o_/?\_?=W7ۿ?OoƯg-r3Ӧ0uF&v%FPH֚ղ,1$} yٜL2bPƠhR@I z<[ڋ;m^u=Y)=޺/}?Ϟ^RtZ?<HMƥڭg&>1yN+p3,w NkfDK#A#CjyJ(w,P余s!ڶmh,KH{˲e:sֲ8`)nfzf%68.͊"?y zK8>mo 8)f7(R99\mvHZ+GB{%e̐Ei}8J@ 5,v 򚔥,,_^u_?]W)|y}^^­faUz^ڝ}< r_}ނ>ⵐ-7 ,;Z{8ߔcUVeFU$4FaL1@1 8lQ&Y !f2-%f( PTB%@Cͥr|9{Xks_V9߇2{{\a"*,CZKޥ@d-MSZkՕCM6y9xK|Wq9(V5 :t6pmwO]}6-ƾ\\b3Mץ\/.\'۪ 9@9+'8*'4cB Z,4D tE3v}e yҗUUHb~ "06IoeJ9Y 5c說9Ek/@4B(b"*:ܣE&& ]@T8d"dASE{?[_/9]7>S>ĘBN?xR LE#@ݿ.yKfF4 wEYK4&AE2`ւZfFʀ` QĊM|eAM8ʅ^vk}4;xĉOUMu]ǣ F)/0p)v!$'10Q?g2XK9gJrkKYbDɬ@n *E)d{.1>Z(<_JE@]o"p}seWޯDx GO1]gE^_ |V !\$ aDXE20'kb/*ұwr"* !B ƙJq"]bКx<.*/R C]7tg弛_φ.Ca 9V챑hȔԓCfp87,uG6޺8`}XN{7TM/0!# dh$yR9I$.fn<6UVUmZ64,z˥̩4n׽fij4th7=k9Ȁ X3_t|ٍ?kyc hpRE`0xʯ%f$X ̒r@a@,j jf4Fs A3%Eo 1 TQDբ20sE朳v)g +ƀ0J'"s)2gP$iZ"[%Yp, U%1ӿb=GUYh)X_VpD-s7@*ғC=TD%JVf b2péB Ͳt"t=& J8tUqAnm2e -oooZU-BYDD-WZĚ a"¨%)DǫpDCQ`0b4nVm~Ͻ{{t(Qrc}Jـ)b4#z˲Fsf\xJ+T(\YPMYG1rI1ne\ݭAYUDEm'G]=s37Ǯ`A)tGygo?G]W^%cY'X1s:X.\Y)&ֲ[*Dhɮ L YL_ \XːT5tIY3c֯Ί91挈35ֶ1RfIMh5C4h B91+BRc 339oZjׯ"ljHD(  ( lK Ycɚroog21|6PQ%K*}фYb k!kDT*l `Ȫs:S@pu| M%FA" 'Qe ֈuflmtlR 6!( l 1mnlРcWtSc׶~P3(5m93eU1DESbXR2]S ΙS[ j]ʲf,h-TeXjYî,GeY\.jWBJ؄-<7ޒn<`zr睯8}ͳżZ;B5;/zz0 XL|9X.["mkp0ԄPLj UO7=Pa46Zc4MHHvDd hQ 'JU T!tbR2H1F@HKީj1&fD@2cr~: [(0 -! ʢ!\ѰRUсc;Bʜ  Rę2J ZkC !t2DfiX$V;d9<ؾAi%ĘS91c= @z;M| 꽁Q(ȢBj~-4LT#1E?7\99KW k-B!pU!¤AYBbk$`UΌ6'm `A=ur=G{}=|mʕKEUB-7MS׳rPt$ɀs^CdqH\pRjC7Tt~:xཏ^.X!Σ19d.-d\U#˿[?|7k=!-??3?yo9{tT6GPfo]srν{g5>Y@p CΒfvc[Λ| n梉![!.666zɽ흓'O"jJ"!I\ZWFVBjp0 Ǵ͕eccCXLGZZ2 l@O*4BeaNbWvQ%3 :2O?C?}hm2|Y|ԉn;W__7p|>GfP \L!Mb,I:cyg2;K_jZo֖rJY|6rKzXMTtpYsٰbsb o\QKtf̪Sw]MeYMKUY1t:A+ ɓ, d`[IXo&ZRc +gvwS'OmP!̬˦k[e-}ۂzL'J_|1ݽzx<*g"ffDD:#i `LX-"pΣw1qhC.,Lr޹Ӳ1gO(J2 F\I$s7 /Xo-[.kE"F*Y Pz&JȡQIzWr mc ʢJʂU(Sf^m+@x`(v T帾ziuy{H*׶k#gvP 0k|1#m㲬p >TBB4UQR*FBa]VwgŲMFCȡ``6)Єn4شߟ9g7FkyK* 4p<6@*b2]trhS˲>3P8 1Hwfz:_jxȗ.]yg[ǎ;>Olm~S}oM9m.}U.-djd} IDATbl5{#ɊX+{݄B+`A^lnnn[zŸ %sbBMXnnn~r[}zSХ`sPbNmgۿȗ6(N k|ؿҿr̢ G+eYz푫X)>!$@F/_\ɉI -h qz#\( 8rK1嬖 FR4Z"8i`şDQН O8(HDEQ)ߔdžngc;{O?k^jPaw1G}w}fw}d2;򖷾Mo*K_m`c/TٲsWɓ'UܥsOt Ww'n8ͩYcix7uw9MEr]i\]knr!DŽ ؅zs+Pb-&F[$Yc9/K6^D4Eg0r :]Lz/_nX~6u3JJrL5mX4dݙ6ˀJ84m\J ;mrhTrֶdp->"kg&}J8]WE3,b ˲ޤ6{)YV ]#.'BޯQYvp1rqpj1kzsk}?mr+J]GFȀh,j]צT%c0ضMJׁD=C(Hd/r§9$YcWҡ^ٺ{Wt۰ys\.3³,rs=6ɧ_ֹj纮9#wEQ9[41t)*`^ɩb,usTfE s.գ O.A# ! œY(>O:71rw;کSg8kJYUDT%W\1rY֣$X{+㋷U5J\"5Uvїy&GX *@{s8[>'n>{V1sQ8}Yh/=R3"b3:w>x9,,eYM'{{ZuU[kgo5a 4P%FbEŨ`ힽ,sֶs?coNBJ/p8;D;(r?_W;;;ј:S),Z *U.k뺧~;<<goԩSԢ;cRh-jC,B;T:Jen$^n|Aƶ+E8ݲlUDu$e"}Y9 (6MYlN5]c%,$x8"t]ӯcʩ% w1am*@YDzc5*Kenk7%,˦iy8&Қ9wYY9,uS 'B$JJ슺,kָ{Ідnmn<6zLv.nr#9Yi庮s Cnd9c,K$K-8n,YWgT΀ Lu!` , Ӝ#pL^-a6ڝ̩ݛU:+ yA*_%YOe8P[tC@B|~E 6 L cv<<dsb ,.]}c$.`QY|$ZI/=]_8aVlUcfN]]ލ1̃A]m {__V?ΙDYmp="&#BoBic]9 "e)%$sRgRq ""!%{DnڇW21>?1v}mK_ʹsַ6;N>{oox]wܵ_ŽxpX/f]]U*IȬ%% ]r0ĶU+{0>Qo}I2 "8BII-( 4U>=rSY>$Yfͪ|=ype=VEU].5g ;K%*,Y@ԑA5`1ZR"msLW$[.Mz=+cL(2#dPbY3sŰ&I"UayxduŢmmȐ9fi4{yFFsncuM݃pe]"^r.zqO%5ɍť+ĕ/Ђ5E]em""` "!6)GD降8 #aC5"  L*P{ɀx=)wYP<fIue ȡhژ(̚]dޗ޺Kt~9)/[2#cnn0lZheļlŲ9؝oiO5.ժd֮ =xNŦ=Uz XOC^p̙`L׶?u1 뛛WtXgرc+Y%H=f{N:5 AY ZAgY9ڮpwTTlVs 9鶢!$a͚5"upT֥/*lEY4G٧Bs&X$p*Pu0P ḮpT$D-BmѶmEEuVuΥ,LDUQ@ mq5D.jr$C D$ )cRL9v]rtYl>\ b w]mP+Z qNF f{U1#sB|郦 Qߔ[kp49hc}Ї>M{߿9{ 򵋋%r~1*U5HޤG/w_?}K)q^qz>mѩ1FDE_ŋ]Du!DDz@:%_\z Kﶦ?oZA h&;_^BlqwX"ͻZs׾eBcF$)QNAV`}޾}[ C䙷\..cNek,t:Y _!Gd|Q:s={3Ν:}ZFQi|%SU5$/Azr9 @Ĝ3R?JUȢmQV*ʙyۑ/F0W2`M'59]X`lrИ5]uU vCH TV˜Se\#SUEQTmHd+ j.h*˒&8c`([ WX"KUMf!J;ΜA/i/DbXA-݅+ZO$)gtf:Unne_[;ŧ|VUlژ(B,g\f̄ !2PP 9MLJ0P[(IMkc ,ҥ̫֗6*5 [jN Xig,sݢT]H]2Օbl-.E+‰']t.^{ǟ?sY*aY4+Eլ(h}QXB܇ ʚsIJ,cȳ٢Ɑg?w=[׃h\6~郗/_oy?yh4:8<@2z痆>ZA"E뺮?lVֻᲨW"TI3=W%bާQ G_*?ѻeLf9oFٟ].ljhu9L gYRcWtmc9txD0h8߽Se]܆7EM>?6{܅cL= V W.<vm#m,CЊ3"z_v]odWCZT[,`I8cgasS"SeQ[vwҗ~Y Eb?p1qmeYm'I[KhpF![iRB>F(ggG1zKz[x_cc1̖[.@YU4Ia]1hd]L9)MhA.ZWMΙ뺜ƃmZ4z6]'B E`WP֑+Sn1#bv;_7k4Kg狽`e0f ȒgEUbBە׮pmۤK!E%dBI6tF8ǔ3ԧw k:cA̬Yb@ga7;!w:+e 10H`Cl4^;nbbMŢY(yw.^h>;83:q"QcTczJ9gdr(!9gk>u˞f5S [[oxzytMG|?WӮ aL)+CDk N3sU DaC0MXk|8B]16mn;f󽔺[ZSy`VUACDrfD4d2=u] FHMWkׇ/_>}^nm۾֗7. Cʿ{m~ᑇOl;<L&kwqGQ |ƸrUr9'}Xu̩ne^Au`"H%"t]d0<?p8&@B~n֓'Ogxïzo37c&pmQ oLs!&1vX&3H/,]E+^t2s,˔s#泗|=/xιbQX'3){C=#0MilMǏG u!$Bжa0E0 5dM"4mkC|@%ZjZ\s,a] L!Gp Wv9uo}o~;vb1&md}.7 3O?_~?!rg??8TՑ/|6K4l^ςv^2L+[ Khʩ5܋V2bQVd@_F$F"@ҜcϢ0E9eo#_rmLdˡˬ`1r>ZIY@EADɚ~1s.}kUqDJt8҇s(.+efܣ$ QL2k譝clEcrycFCN.0Y+5bס0 ,}%]%svS\(\InxX5D R!tE hK..DUU¢*AMd}bmCv$ sBD #9FkA=Zvڮ'@SN$"TRE;0qL7 |nX-K՜%efQ!Qd 9kFV|3s;i9y׽^]T2u_jmMR}AJQU92sNtm-{96D}< ^O[OSO|_LW~=1жm?Q31bLZWޜsQ}/R!cPHff8"p)d2OsoxÛN?Yb6]Ѱ+J9{0{uO{3@3t3$(Ȩ CoITDCLD%q8 jL45& =Uut=în^s9j5> IDAT{BOJ %NӴK0FCyrbP& I"uE| :Ilc4RJh9j|΃M=nMltIpux73 $C;nkx%C$!" Oz(3 ƥ@ZI"Jt 8:kg>sm^y/zыVMLg]{}__׿wd\t׭_?jLv`y!KNJb\A"".DThφ"V{ $<'IiJAM]ׄN޻ȮUY79H)Bk#DQ q>"FV6P'&K"[WK!jm!T-rbf0"0@|.12D Ec>2@6U bWhZ1(RY&N cVNhC$ Y,FH [#D$P %T1{t6qfƠ.,!D!b'M258B1BD$T*bmN@#B6>D\q-hl3-;A*:,JNGw;+V(%S"ȶnWs aC:w=jvq'C2wJ>k #!6.xfBDLJj~N!V<|Ϟ}ʩGuTzGN;m[_GǺ]˻[ǏڇRQkc?dM6!}{VMFTn,˼1)Bx;vxǟ0PF/-fz2jR aUc~k[y[A4T{Kb*b% _җj%kJc>*XFe4Ren\olzӚٸ7 w)lܴ?wse] ?kyy;0̄MӴ0'+4\sd^_&B쐙Q<3Yg>~>͈#z<ٴ9rT)KhmjaQw|jszNU)ڔuUuIZ}BZj+mYm={H- s߾}wwIx1BpD`zt'^pmdK_o~_͇׭^$0?*%;[puB \ >0#Ey8(fB! Hd U&a:A+B<=yA)%`y8" 8;u@(k癜D 98& ]4Ҩ, ?Qi^[}^ɿaf(kȔY 輧K$ R$"aBJ}e\UGmD4̫ @w-9Hlu:WUΓ2:QIbCMwTDo9Di1B UU5mѲ,;Y}>Neh$PC!Ԓ"U֕^ $)yEQUb`(B.@ EJ'$$PFPnjA1#IF!1F6ѩJ:h$xZC:NY#mHX!AJj֩LBp.8U9V0RDIZ}:9yΑGy 7\uU^﷿^Ue85o惗e/| /v%011!|J~w^}Gu³~ ˋfUH,"M `ONٳ'FY59UU0~n/MgA;_(Y633onZ4ѝ^ԥD* Ird&BFicLmکJDnRZK샔RkZ}ǝw5e1Wo (]uG4)K/}ӏ{׻~A M㤔Jp (TJ  8&Rx`@|_<\s[x^?ZlTzeWu-H+-T6x,jZ$0*k\c+# u]MOJ˙-GEk^)kۺф"J!s(P*HedM lq#d^Z;wvWw''RJ ȳgB =u!Fq, Vm0JVpsO;|ǎe]Y~ǎ۶u?|oM;wywQQ8vrva}Oӫ*;751G-F뮻^q@YVڨ_sO9sum|}y/w!E0o.8n b߾}I7m\???_RJk|M$2m9qΑp&:FZZ[ཷApuば6{ggVpgsE>j -[9]zo?wrb m65@V 貱 z86nZs9g{{ڍɟn{./vD谮k)e"*-L,QܛDP`gd`@tFe]&Q/| mGDJ_ZoH)s{̂SkNRJ" QXGQ;l"($*aΒo|G!6Rwz4*bZk} Mx p/a'Kn0*}UUUy$NNRI3"_uy^E]UMYUԵ%̸pBH<9g$90ZGUSֺؐni.It.JD]E v4 P<[WVJê(@!AHw,sH q Z3a߹^jZ_66! Ș_򒗌 _q"b5g뮻n]o|~w6odJvӬǵZwWk_.+1MZ\Xb۶#lYsw[k'&&&_~~3~/,,h>;}ەKKK~;>wn>@lw[099$9XH%,B$֒RVsMUeQU~_{ǝd_Ҫ*z΃?.~w;5zqaHnHou{Y8'!0rXKI$1;.@K15y;~?gGu6BHιc~i4b9>QUU3W1inZ!6{{H÷.>(?(m1cccI8<,Kc 2ysnAjzza{w/zhd9b͛7gY6lK>rMG y''(cJ^yħ\OmN D[hu43N;CHgbhCem=;:H:n A -ZLd,Qȁdb*瘞9DJ_orɺ2X)s-G`6X`q k}"\)Ѣv&ĤIٵI%77$˲Zmڴ3oM5k6 R=سN> _Uoyk/{_GmRecs[~p÷w˃ûw/[~}*-cn<Ћ/~Ĥ<1>599'o{ޅr])G}CJ2 H :?dY XjU4M +"@{u"]^^f,+8@#g?k+[rP7% s8?rءGdiuSuRtbZ{e+bB!F%Bl{fnir [1I/18=~ fjՒgqwJI~{|isQFMk6@ٔ1~ %(Iǧ:zU>Zk=laJ1 WL053zI·<"ε)@pl]&.+%0Ԯzn>T ׮ц8\5nrrk|9[u]V$RʪƘi\0EcP&+{-LXeA>B$IcIcDMA+jMQYWYgnbw ,blF`TXG)j5HJt H:Ƥx)FC&z*JVj;Rr}Lb$3ZRSHTyd4¨eǺƹQ-Dfڰ" 1*u)4MTMl<ב%+%D&&" Ec"Y&;6M:?? Cָ"!@1p:J  ;v<1!(^|bm] D޳oy~!F 1p (."Gl9D!V"Zkp0ѫ^q/݊ԥ2 Anٱ裏Wk_磎:N;?{83f~[//}3{=>3H)QH61"9z}7rM]P9sӍ7V)dUU9}w/ң3,1 !.RDf".Tu0FBHhH3KI2/´}_']~ g %QEeя~ԝEPsD A׎arĶѰJbvBz'du$fy"Y4."K֭뒃Jj)ZBV qA$ZDT`c$",jC&&uy`W",|5 *f+۰ `nʊhzh%*:t$y5ѺQ( vt}{1Sz~vw7VU|Y8(EܳL0}C7&FKJJd׾VCj%DX4CnjT"@!M^PNY5JJY, )SR#4޺޾e`FP4~TڼrR6i K>LeY*eycMC&i"_r-C u JiEDBBD dY(uI.1r҉xvDcJq,/,hPLlz^V99Rk`Al ! ݉C6K 7Mw衇OߡuO*,eK׭[;o~y99>~K_n*K:ylEP 1 DcZ9XYkJ(! ,B%i#}7I' ԉ)zo$`dNHi)ؤ "#fUU#D*V 1jfnJ$ BJ 'g6ĺqexkTb<:-Ru;XJLei t1iU251a=#0uѺSYY[ jzؚau1X&k[\^& } 1,g%@@RRde ILS A ؘeH b8 %G  qevlmȇ-$ @ #7֕m["" z([΋<1U3ZjHT5P(lZq00rd*kˌ-)]-}s𮮃G l[+IO;ogltN\"U'2D𑆣*sI tVf1*e}PJ)%1C H?PZ$l$IUK.o~rݳGf 1MSs? ӫ4y9j~7\Oz}ݷkϞnw÷xIk֬3$MczwxWw]~`0(Mo}뉧4̚oloW#wg[l}[z_6=9v '~;vrj_{jlb:,De]Qt} J(BU0ݮԛU5|xzcUcǎ|(,K^]~哓RRH^ I(H ɁHDF&B-C!IB,,I7oݾUaUȬ`||\1ʇi;׮> m9r`Ȍ1Df=xZVJ~wI&1֧~ږӟ'<:;ݾ4s`{ƙ[7|mr۷?c} y]u]2xkZWK-N$T4M92Dˆ$#2G1XkE166VA>j'MQ;$"+JH"I 9!k}ZHR﮶?=?O۴ `fcL!ι,fǧE]59ͺ5.SO?O:_YMӴ4Ibч(@3 jMNg~a߭uL2/I/16EQ$%Y6`0RZWuWjBU`[r>f3k}qQz43* R~ݷ IňRexY'9m=i|D{1fݷwd BZigYinn#tWyws{)Dk~|z=cnز"o_^}yc=vʳOEo{އvē\(D\z$u1zX0t΋U$d*_PN޴kCz (S5g|ꫳ,+(&''4ZgfflmJkO.!CP<&"b (82I!0m6>;?~3aZ:V3?eo~K_⪵kvڵnopM7 o{y1T(ڭ8N8^Koiaoݴq?SUC}gy:Z^‹^z} ;-7(Ǧg֬ML9ǀ1REZfR@c $cSy>P(BQI2PRjD&될Q6\(A$mZ"kk]ຽ{[Τɖu[6r҉.GV-k-1AB R} JR%P0:Eʻvc@Rl9RycJ;>Y(F[!QZ(c]X+!H)*Q1jR"E@!"๕a,1ں&7(G[bpR1[7?Skp$;'#.ݴn"o('ps "xH.AtDL0/bbjUZ,E^;I8!X@(CtHQk Pƨ M6I%V2FA$@ FAD@@TB^uuCU/F-+ u"Ft{㚮 (zٴ56JF$}PjuH)MLD%5k݉͏KkVMNAu# 욺}Aj%Az=S [[f5W%@ª^(n7+˜}f_WnIInD!MMvmۍ1C5@$ޤIYU1ʳu?gT}syQ(}MLR22)U-0R006e]8$cPl}Xp"1c @mLdB /~7Z..\$[HP'־KN>9l'!lz<inwT.9_.Fi֟X==>6iH'f&fߵSAټO}o~z?C 2H%@ L*1ZĀGI*؇!H+*VH[#:D(I3#HDs DobjP `BD Br`}3pD@9_\+%GJI- 6 R*r2tcIV ꕗ$z|y= y$FhT5!~ C @@f_7ES9c#B4H%̊H  Q6#Ǖ3@昚b9x"!R<{!KY)ITA $TJQI]tQ4FY/'3F"FeRtL⪂T7՟^5ǐI~GhKp0lw|5R 8jAH0$$02 m5V1 Ⱦh ׈ݻLg49ށNj8 ۠!" (C5EAToBq1: (B.gB!%G^F' NMSA(C$dAh+R(zPT vK"^+kV|8LO-͍ϤL: BtDdUV,B$ V$e D4(1F%!jfZK‰ zѨ9禦&;1>EDFU oׯd`Y10͌w B@8!MLS !u@,@A"PM |PT"#1ۏ/ޯ t5 EDz["16#RrӢ]k&)f8NϬ>!9ef I@qOA9*A|ܭE"xIr!ιи","RbRJ!öi;O$5s͖фxX6Ř8uᱤP!+5Q} )d8甊"iɞq5Ivsos^+AMWͬcBIA18{|ڕn~+6Uk/E?i5 u?~T)\L9kVv1IAiB{ib*" 9m{H$}g?c??كeQ]-b43W+fsnAP` 9%G\[+#1,U Sfn # !Ygo}o} 83Y߼Fd)ԌC׾y?+s}wͤHy|7^ O>\nyIo7}/a\,{w>y뭷?xw0,̿3?W> Xq0CH7m(;F XJe1@_,믥Tqn9۶vݫꪒ홙2cdOUе!+^DpQ]O`Sz LSƱDs)0fY۸F&UDh-< 4"\(U[Rz2" _cg)x%e`=Fa25Md&Y@KJ@u@) 1ގ X!aZHVɕb2w968R "TJClUwHYJ%-;bSDOfzr;08#\LPYk qr5#2BuEIA27(յΑ9OrFD@KS)Bw+,3;d0AQ+*$urȢ" ;!(ŹrT`hנhu{߆&df>1fĔq`a9kPr)%QnصCDŦn]ߝuK/ݺv6pahXDҶ="#3j*Rr)%%"5p6xI;Ӣ|N@l5 Wo\޽{y8pyvc4)ժa 3;+4 D@hZr@ޣ8xԾu)ae{|puɃNk-Ӎ7@SuiȻaLZӰågiT'* Mk{=}x C7s`YJFhZ4Ez@S%j ޫj('pMs))&z4[J.ݎf}sf {͢S")BLE=jLLJQd*9OPznBUjяkݟ}ծ ]81)QU'\;9( cז|޴W'˃8}CH|hJ@xٟϽˢw7^{c)[6/g~]^^z6O<0dMS<<='?o6m.%<)J.|BCa4M-(`?$"Tg"3s뫫&q 1^*RJ4&Cmv;1FPe$\n\]s3^%3 9T J{"nDi @2u-*jU=`*k٣3nz]2D88M#CVi Uw]fF}OI9IVU8\,:MygjrD3K)nW\bL1FC&iU~cD3Tv㘦xXQ0#"(3D3Z=Vg%r9Hqαֺ//6W0D~vѷ9Zֻ1UI׎EHtLf,HY`= E$.M_lH3dr|ߢc\,b*dB  Tԃ_mǤ`R aI*Oa)mS(EHW>TeK6H 5iq LJ`ޛyi{˯*9]͗!e87/Y}7R`fLuX#Tε|rκ\ppyyy[m)#|ݗ_~yXܹsJI!)Ej)f\q,Es gخ9697w!z.4;7o߾/H؊ IDAT~~奙sw]Ӥ8h#ppzo}o+g]FK)I|E UV Ssqv1qJUrN|Z4#;"RPa9k@bӮ$q0O!Bɚ @̜#yDr.S(:iؚY߄1d[٤ͻ4LU 4+1hr=q[ft]u]#"Y~뫮ota?a+7~9jv /xCm'!8/"1vt-3pWf׷ͼ0L#UKI96bT+Mvnǃ<8/SRES_? +Eg\K0 =~@3UW?Odjr=@DM@mhCY "&¥$!v0]/s̎3SJ(xqn$SlBh}1gv%gηmsu\sm"R {m]L*"1\fcƇRrn5R.%p^;2){gIcE3Ɉ4N[$Cfz ݰݎELqPQ3.v1lޡ3R^ s8ߒ5g]gvq2 (d(1c Ts6O|dѷML΃Gcl]Ί]n6r1R\r,*Έ9mDVib=!RՁcnŬ6CG|v90dJtL䲨RVEҐ qJR oϯ6m?o1(椕Lwny[ ƑDuL&: c| O@R2SL06II*;F3%&R%YS60 Wf:EVL%4MprNlma"r6;&t]3w*-&BHfbZdY[)MYK9RcGHiA,4i4lvs={zmC`Zdvf84LMl1u)T@s;h@zqSn(@#=Wgo n݆,ǨR9"Z Z&)TK:C4EB94ѶR8Nh6@e=bB&۟^|buN{r1U@RuT9Og~f5-ZVO\RV QG& ,z4T0 |V<6`КQ H.=`.4ràdQ5k 4M\mqTLmYhPeRƊbbV?ĬM7ͻBBp~j@c4X+ ͌>|0)4-Xd˫|7탳F5Ʒ7b`"_[4~ܤ{xMmN .އ5J/FXAPD ]Ly&2"ucmδwTf}hΜVZJ K[4n!l@plEyӻta79Onlw{vhuZr Ξ2j97 "ٻV"Jy1.z4sm2cuvݯ}k?O}䍏f_^+u f19C,jXgf fC\R|P(jpQm-g}n>񏟟](nnݸ<=yx;[ʽ<圳h6 Dr09*/ C2!f9M%8爐i5W5T) ƈNQT,gPE4E ):8[SqL){ڶ=VCjU&3+"PDLV!hMKyv@ň}`dh`j!b"gQoU?_t=H)W3l#GT{2PE5Zp!d84y57'{tI1]^}r:q4Mӌ12"*q/( xƘA%gMYKA)hRQ4RE!4s#ST̵%؞7}Fi{VIwƞ l/'kx01QC5۷X셈^_K3yV63b4ɦYڀ$\DDl٠#rbgD "1R0E@r%@u\r@u]WrdV P`r͗E[-T+9&R:QsͫI0 :s7lC`0REdD6#9ͺ8!(i 1r̀X~13W#6OT"'R4s;s {%V>M(8 dFEch1mXIS9!{lf%&0U E)*#lь[RY五5q>5  >}џ8Z-#ge"pfO45aDEC3&9J5bj-@h50YE2aID>qz{> |狑^P-jff* \eWY5fRub V$gfB32sN#1# 6hj&Yd2&8,e2:*˘'1) 133""bb &YHocC۫!t=F!eXG"0KU<)iY 9YJ%g%"v1ςm?c6kb1mbh=KL@40҃aq0_v&IDmZfv7~Q7[^??ݍYl֕41YIF18]]Wq01:ql+QL 4*ͷzW-" ) 1A)EEJ*ƘJ)t ì Mvm6bN%QKKd1eEd1ŲhN""]ۊXZQrAr*y6t^4%UMMLclR6vELD{ׇ{uy޽o"y.jk+QEl?hjFr&5DC)Zr:}>Q ΕV˙ ð-g#gy! 9b)HD1g{?9V@KNm{?ʧ>GzZȿÿk7}K\cϗO;eىhιmf#r4>Vrh1Y$!'Y-R9)! UP5$UU-9K}`xll҂HS -9Nj5!캶-u[A@ yo fhPnf5uĈV)Uhhdh&2 REDL H!hs ҋ/zjy>׫ lXGI^~ifD\˩*֬huIloTDZ8u\qqI@1mȈ8q&SALS,Y'BqE@vе}yv!~a{1[S2 m 1f>[M!<Ɣs>ϊfDxwJy MNdFG ӘU?Id" !4M1i%Z۴RylƜ1u(~BÈ]ouwoMv Μ_[/fvBgmy[ "]qpol/VYHfzGٰVF8JD]Ҵ+;R)*3;W{$SJ1d{Md\ӶX}Ptmc\ 撊1DDf_Jv󶟳 Ƽ:<w`yv`yOyͼ@ 82R=_ʟxWl}k8c<]fR,,V s}_!{/ 93+b1mp32S(΅NOVǧ'ggyJp E 1!"w!B07o(g -eJ)Vc]\\}?|ogO_JR20޺sﶓkGYdm@3/l sXGST~EdR" 9f ߼l:hledĔԅ0n{SNQS*΅l@fV1%} P!(/L@TKHh - g$fE$Xep\){ "(E]NSSf6(@쐘|* 1FC0 xOD 2;&bV/ޞWb! XUmA%?C:BG/ܞŶ~hGFkW00"EK3445S"g$R]I!x0܄9gZmgZ ݄gRRӔX9!RՀI3ViJ9߶mJN)&R[4MC䜛f}{v;\թu)e;NMALеs؆&8Gg1)9K1G Y2Ѫ[j}hg= {Gi>kF3-kk=wzf~8wn=9wE_s'n]KyXv8I,RR9CW98MƘ@cjSA# r.SDi10Xl<"҄Ʒ`B`9 VpXjNq a4^NQs5mRpR8ܿl]~~'͛׿{x]Jyj*Fdr9vP u ]Ζ!j.ʌYB<<|f:dr߸xQ~ڵvLH6e4T40"?gcَo:>>Un&+ 떓`2vG'|3w> y~z m7[<:"Ls ~k_?,L  k L ,]N"!s躮T5Ƹ:8ɓ')'GH 3h`5M|GO?ӷyHfyrhA!#`ͪIm(*shq=J)%.):T 2Eh=1S1U 5`D"U2{ETLN=d1KF23k_Z_6c+r*\3E XWy#d=K sf&vY| D T⿤xOIEt ɂHX*mX$r6w}-qz@J9L,fX fUV !1@e@8 4NV'WsQyZ1M??.":$29 3yW*MXZL:@f}==s?t??cG߾޿~J)" IDATs?9y޴[_?9=?vĘ ߾}ƍ}K?]0BTS),Q.ifMh9Hʌô;</-aDBǾ2~^|p ]di3 PJE :U2}*IJߐcȪ"@AĦip;T:(B9"8! S1|0֓wLh{ɏm}H{e ZzQ"Sb(8_ jis$4RUDM , wӘ!M(ŵMW$3caUG^3)|:wx0nU% kCоir<s0숐 54ۖX˳qAsĠ~۱(3cׄjFMq;s T,χtя|w i~C/:V}.nΚFJyӗ^[=9?=8y?8Z-Oo̻Eoa;$b\&$5Zfyv4ő#q m7b> *:if5val%NiĔ뺣NNNDl}ybXWǶZ,9yZBp{iiU&~o8S w;9dB&@&B 2mi+JvekwU X("6jZU" @&dȁoޛNiEO+~!wΉs}޽3.˵E3GR"1'}:q1fskǷOdLC&k)&"+\kh"LSt]stHJ1FϩC,2) nkКZ%"I!f")E!BDeCp_R$s$Qچ(B4W;$2Y`HkLn$"kGjRD|P0s"l9OAPPOAqJEFQZN1# (r=?~ke&o+׮6πF ܵ1pgfjPE7T8QJ~ "c(+ cLY%v]!J>ByVpl] kM0Vgƈ$@ł{Kd4Y'eꪛ-X#fo!2VY &wl15yGIO&`T<>b1`: 6Fic E_ig^Ǯn!33aVXmyRBaɍpe6X2ڬ[IJRIɬC:vlØa׹YR:Z뺩Ͱ(At&( F|z+^W'nz/{((ںn,ko|_rʻR" }9vOO5ߙn+>%H*1$AQWփ)3烒ޝ[&f 5_3/XL޻VkE9 ˛v[ιM1de 8Hb0Wd5BUPd  BD]cBp;;;FgE1 =GI$HkІ ?R7a~$^-RE*&d9K*EA=i))R=; 5j#R )D( [nFcH!T= ڶFE}|kDDy,h B^7@3ci}zSpm_,v@ؿ$9cT"""w"OW'5+F^TH=y4 %#&Q FgJ=^I֜ ^B+등E]n &NOW%%-(жm!P$\=hӴ.:-t/%N"Dkf< Zv\nOzd1sٝU]mL轏b k[\n/`Vk460nFV"v]$JsQ`hWkE-P!|4B|eZkJ9˛bξ>ƣQ[mƺb^5M`8Y)P`-"O!mF[db6+u <15nɰpɗ`즛Brw>̧7xd8Dڠ$CgK΅km-!{z$kn B$#*P:Zm&m ;僚$pJ1|w|bؙ&~gޯCOZ,r4J XT4٫iC'OV>//?|os1f09tOh DX aenģN_uygոֵ^2Z|:l]oY/7bV54LP##eh\$%k)6u"F›흝_o+Ǵ~>҃#=PK1ζ/_FL@!b0:qf1/]xkdgyT]ZEf-S}hCL*:+eYBI1)B SLҥWW@!p@IIbu_{o< *P!1Ќ҉cDE~ݛ;BG d%D0DWj(8DE{L1D--Gܯy[=rƷHu0e_߷"{9`|?ڽ !Y={@U^UD)%s.b9%& 9R!dG"RBФCH?{~¼Ƿ ٞ^NBnt^Xh릮mqw6fAQ c)tEBڙnt^?4.G602ϣE6Tal9u]WU=[,PXGRgD(">}eb$I2p\'@mUݶUEQ[m H\4)v)11Ҝ ƨ4b<G+F(SBTt҄<<iH*e,Ƕ۫õ8wvMZ ]R- DAN*w6 i;HLh(Id%Bצ@0yFZ y-YQGW&+ceY5h3!Av ZeDR92yV d1A_;O7&VydXv`T7ݼn|꺶* $0I:c 9`8^h۶USGacm_vA@#觺ةȢ"d"RS uiYWHCla1_6K;Zd؂rptgZ3vh"H !RgrF㩳u7uUf2twWUwتV^v/l>z`u2t"j{g>^YOEP6&y9,7f)`-Ej-,D컔RR#b3^9r6Pas YibdtYkaƴ!VUglQfE6(dVĄLZ1p3ݴy'$)%A ]ƘViR Z袀0$:Z(C*K9b>>|rmzooo>}z0e1w}+{q˿ӭ͇~+_6}ݯ^s?sٌkMYr`P鎀ci:b.yeIzh()=ۻӔbTÐ$̫CO5X,x2p]qr1\wu_} A[Uh}VuJ2BU\;xO^_?9.dY,w?}fC8l9*"/^$҈d2'Hy:u"ϳ{gV-Q ˴A|b!R k`0/8uV2^mO8󲗼BkD޵Y”@k-wwwC]wW_=Z;Z+Xe޵o_ <KJZY"D1*O#whzeq{1bk!mɵ&E XYR훤Z>~|K7 N)(J!Wwh0BN[[;`?G.{Ӟ~'wo躎]Uղ(MRi֓d4 s5?~W֙)c-SYN{hUgϞL&O=cg\Su^Bt]ozW/~;= ՕRjY؅"ԀԺ2F;Ienr=s0W /^wu'C/}._t]Ȳ,8llv]S"^x흋.<|ᇚCh8y/'mSgE՗/ٍ?ȉ>#c wyyflj+D̲0 ;?6j{"~fEJRP"}-};XYҞR8p*lB $ j; 6A'!EW*հG[3DK޿~krp@ρ ODʷ[ +1Y,`} ,y o9YS_"o/Y iQ3ӂ=:h*)s^1FR$ (5RFhu" EDe&< JчĀh8Y]]r9K̳J&a#`L 0 c4NZ@o+&s{c" t];rkm*:djﺶ4Zf I=yc 9N.u dQJ%Gx(bhjN\V׻xi{i4V1MVa |H*WE6 2x =z7o!ƮظȢ*NAf)\ȚNga8*t &23Ƙ,BV-j|G/o^\[Msr\2p|6Yb[WБcMLK q͖B% -H Cسl(5Б).9bB[;Ljp]A t)I&RUU)3sN[;4F)DwwDDi@6 c~s׋_CK\߫ cerd˗nl.]nzy|>}e/??wO}J 3Sv7]}+gۻScLq4>Co9thgA \#yX?qȱy葇(8&Lwg&doyw~Ϳ+ IDATg</{y۶:ؒy'+ZcgâjY~0, mQ3gO~wq+_[|rآTZ+1Fm8Y[_r:thmkήMo}=29җ"] f6^>v]O3|ޫ|Ӛ $&4!Ɖ,/?֧BEwH 1oϜoC$&"!%qp6rDBD,̈@J$@@@{ "^RRw{Ap;e2!A,}!+A ۺ{)1=+:h23K"@" $ }cWgW?fye(}::;"LX_2'fҊ"${(r" ?E!$`;TJФ8#H4 Cc h!Cn4[e24-c6F+Tz1 dm !6[ikA($ZQf=Ej1Bhee:h4*S13Hu.͗uYBY ,ƮMnqT*[&bPT{[9Lw7/_;7khMSs)EilDBq>EREK _LHvzMfvYsFFlUG tRstwzIf@0SJV'#k+k+K%1FxᱭzN[\,w],M]$f^堩jEdX.F&u LsPkReQx1Cp@ ȹG3du7_ݹ"()'ҳ졇:q#˪mkks>zDBIز, !"!$1ƺN9~.g?w`ȣxu5^7޺5ۙ({Bm,7'O)O=pއqdz^d$N{Hw!BCG֏@KБ#J|6_Շnn'iڮEu|k/mϲP)HʢQ͍ACzN0pZQlݚR )&Eڀ$,jX;s&b~d wAITF@ (WZA * ~OyE[G}o6]y_R²7%wfowpW{u+ĘR$|_"(B*I %MhDED+B<e1FVJQI0H/({d!,h""a̲z{Akw/t޽qiɭIHPU h0NQ4MZ)}R |WʐfgwP8-(x -K 1SʲP(2J#\t>ȫM7|0(1Z2 :8y5Ku>DnYbPpX6M]7+ -ZL}9 򕿸(CH5r<!JZ\tdu{3bUQd)YU6̖O'+=bՅ#+G= ^=+<1αvhے*:/_EcV ˢil>gfc &G6{Njv$R~v6Y_c'.z [͋20tw2Wg%xb0TTL9{*:j`2\gɲ:x4&b[je4^.!DI)X_]|% 83\wEn [8>"I.٬@kmL}n)agJ> c8qx}oxítsu7^s !_nuuGꫯ sx/}emm̙3o ϟ<{7sO8 G]yౝt1_Θ#||Ȇۦ{o7ʯp?#$˃6vZ97||X̴Qu]ͳl'/ݵa>_W^ws;vsH( !Hi0G}iJɯ/f2>?S'N\~mO;7 gݱc'0rkxG3?~GwA? F(z^;thsch1W.]z7mw>?|^rmG7|ɷ>E+cW]]5 TUUdoE{53U1P)@ԙefC1f( 0v7Be6s!%$عÁt|"jk yWazdcxeu]HQݙ)1F$Jp7>fvŃ@EH+Sl77ٞ(Bgg1s zAD8sX[X$E12d63":3jBh;Xb n׎YB 8.$ LjXCYVi^XĻ%iRƢFM0B ΓN)EGDkK=9ֈRUב("Au< 0EŐY F40Kn4Fe)f8 Ǟ1]A>DH yS9Ɣ" "шdN_uv:߶69uu^ǏϹ ~ssG\}|Uvz'\Y߈>qwˢk]9ԋR"LqhR~8:('bF(/9-$轭HA2G682y4!p4(Ѳ^ !jEc*ϴɐR2V+gOEī]访r0 ֚dY&+qBBQdZhfƱCyΝz´7ӟE _ unuuկުF3_z?xl9w\{<^}~7tGkڳ Jr|SBYEA.xD|/_mӧO{}s'^w?5|>=&رcAq…>n{Xzep rƱ)6IhesM2صG.>o7.c[gr3΃oZDRz>%Jw11:ruw^ K>˲v2ۓza4I8 ~\.Sb N>x`Uo?VV٦ih5ZDRgshEb #KhۗF}eZAvZ.S8皮(Rɤ~$zlρGWhOۯ0 Vq.dM)DY@V Sb_uoǵ^AJ_)HkJf&%GW-w4F3baNuM־kZk{0$VDekMw # V gɼ EbBۺ"i9!#b"F*!q}h E8H 1j )RG V1Tj]QtG$64!D/CR]]tMMaeI6hr]CԋU5׬ 6b#OMpBakt,"Th'\uC>8 l,ڎrEnw(ΥU,. ۶vQKe$O)fJ4Ja8HRDB f/Ë8kq8PDg@!G],#NB=fDD\.jR8iB=&\.a b@ R`3kHi@(h 2O#!@YnNw}~K6eJ>[1HF8&>Jy2$D#13Y/N9c~O~̓hf) B+,r){Ouu! 7x1sS“ǻlo ꗽO!̪A91VV&/|GqӴU| >yw|NqZkάRjee Z_xywwuS|ǎw/ ?3?㎝ݙ + )O?yxs ߔ[]W;gO* ֦:> (E`ĹևN$eeQWrws,^w|[D/3)61,˝mR$ɄDSC $ LB`EĚZYk꺎1(#G3!E*m)}P#"2OF{^}n'i$33BQRx_YT#^9z*$oTl {T 3̓΍@jw%ba0Vi0u"Y{ Ae%E\H SҤQkZ1+1hܚ$r?w$O'1FBmnaHRi,zHJ!ط@T8-(VGDY!Aĺ^VML!cbRtї #%RppQҦ:RdV:EeRL 6MtN  4&!ጴZ""8DX;<05Wlqj΋@ #8$U5bbA;Vm`/G%EWzիG~hue;7 ʼڈH^?zn2$N"A)s[I)ն-rZ͵igvvQ۶˥:sM7\>~͙3(1367/o?l0Nu]>."ͲyY/Y1/up{'6;Z! ˢ&HPVp8v0(#XTagǝ몪9yk_DD΅䜳ڌFsog=XV˕{ ˲[n骫m]Y++17>}A1u'<ӟ<9rkZRa2+.x@&#)%aJAYmueox?j{%+sf]{;Uz1F"bj)CLDDgYVmBXPD{!LJ2,SyfFǮBHsڳ蛥=/mKٛHavNDdf-_wLp$J+[hÀa ؀a?Ѝ‚SM {gz23"9⋓U]P\23"##.ڡޚU,4f(8sbLOQHSfꨎ  U*1d U}ckJn ={drwy79LCRcOv*C ;20Iں _}'Rgyhw-!e2 k(K(i{M`CVDR'7Ek3!%BI8 #$1dL.oOj820zt[1 I<& Ci*S8]]'?/}?/L/^x'O##}ٳgMx,eP0H"k޽:ϟr$0CcYkYi|~gv6I+"g\ifH|{{mjv3V,v!|l5\}B`rkի @Բ,}fn:o,Ͳ,Ē`Aֺ@ˋ/BiO.z}?Y_Xgn u^V?޾n[)?w^xb8hm+ B$ڐsJ "!f{daHmaK=In6izYD[_u1ٸime&oR&aA(B-v̵ۚ6Ly|8Vdrd$̔PjsPD$ι$6S5skfњY[ HCz7r7ey>rO~}o oh+M1FKE3 adRp+Km iJ̕xϞ/?߽~.}9%Z>oolZx3Mږ@3#UfFwjf0 Td_6{wݭ9޻t|S'6 V x fP%' IDATf,HNB(:Hã>SFfNLaLr=ϱ;FA~E9P2B]=WrոWՊi{_f!r$AsΙ3Dg!!3!պS $`JY1 BNપnf"j i{40#$@>ɟsVRJ2 B4DD>-),0%Peܝfr,Caĥ2!"Ӏ i[()v$F9aN^ VCHH)̮iLj-5m7cEM jZRR8j1]VܓŻwO?yR/,72؝Zree: zv1GJ[2y_yY;``ruuED2BDY#je^Ds ɺ*B'rՂڴ>MQ[ES psGLC>.)3[q}}us$`DtaHL(lR<@\j"_|fyo_g;F⸟wݺ֔ӺΦM2faq`7uh d^xlBM =%p8WU7&q;O|9ñ+Zn3Nks3݌CWyfNB<]E0`=%,a=q`nN8ɰ*Lf//?+%l6'Va./ؚ.<9 n%!\oo={gim·cʘ/[{leWL2K1%*AA4HNڌDA!YI W1&Y  f)Ek`ΒXSr$0뺲n,zFkjӘidLD.1Ze"$g$v@ZE+HYdT}W=04VvoK* n-+|q~hyҚI[MELgٍ# P3m'z}w{W!rX_}` {mfsicCA`Vն ]S0&İږen2fM[QĘrNSWkeeYxBf.7-Y8eH̴6F U5_Q( (ZնTJ)[ Ֆl()ś!i޴'EsƱ.WFxwpsw;< YDVQ#6ixv[Z]w:niHf6dU벎C t731LeGhkabu][imTmj-8aPHF8xa.8:wIȞLe$o矵:^ky] bo2upGNxRoM4{=PCp'a:F0xvHBS?z9<)# #BwGtH$ܣ0:HbD5u{c63+@ιDX01Kw-W&c{\<| #L  wH:"Anzߖ[F _[(E3fbHI{ʌLGz܍X X50It܌\P/~8̳j\(rZ i/aZ-3##^Uǜ=\M31#כwOS(u]Rj˲>{<"uݎDǛf"f]El6n-'ץ LDmޖi$dls+m!m,MZ$l[on-iBk/1Mdg GAX yab//l儯q_o_|^8$?rx[mAҔҋ׷_ʹwwxs"bHIbty]8 8 HUe~~>^^jp}ӧz{#!fp4K4v9.! ۼn=.4)+ `0޾l6t>&"aK9BIxb֮41\u^q3&,TIպ A)9'O#q]"z9 BrQke#i[i׶f3ee/:4 2Y}k 2Z" Er&pXDI,i]JGl|i:J#̛˚RJBfm ׶daYf Ff!BӰ-\kJO˫P@9Dn47mmff"y="^*$鬪"HDy7>~?O^y͏ kD'HBD0 4\__7u3T.v̼ s%e)) 1ym+2mG6 X/+8!ih0RJ$E-9!w B5c&sbpoaAH20sf.0a%Mc \Ou8:["Na¸,kJiw7SY@ZCey=YBt."0u-@ yXqYV¾zT 0ED BB߾=+JZjEGaI!yA=m6`Zn&/ެ0.10{\ Ie/wClG~lRТb^>}v˛،,CansDt~s(ß|~ӏ8kM~):n 774?}R6\xPDhf.`>i=RAyY-?9Zk^4pwd 48HG)4< 8^eZri30pa-7͘8Gc1n]-J)%5ZPPD8÷,9zzh|׌hMrdd! %2 3*AJ=? B`ֺV-&ID`=Fm);(Y!:18CG !#Zr\ZJapu3@b c@񸙦^uo!{DI+ šd$"usSx˟'_~zr ̄kQ!(eج+׻<|ztU S",%pSU Ĕ+ bžDcK#VJD`X/Xtc DHtߋDĞc;ܗ"}DFH߼Qw<d:Nw @@_7H0039Xofzx&!IC,Z taRCne,"ID)ը66d0HF,d$L̪֚d AB27kD]IL[K=iCUS8Z@!77q dh A="!CIQ8QRo@֚Y QuK+XeRo)P@!3 YhZBXݫfgD&BBDbD5Za`0uXC-K[?m{7{h !B'( `wnR8:s(RU ѝǝ4i?"vu 0fv"RkeAbusFD3{{wꐣt`Ul8 ;R^9 1T}[NQH_ [51}TܻtG?),$u}xw/Տ`SUBOs)2y`j| !Oǿ=hWϟKp.}l= MCpB DdHy. "&D9u]nZ= +3Ff,Xצf.VZ;Kʉ25 A쓙E0HÁ Sff@ID T d"@i{6 y= db~sw@w@qЀSw29<&vvqav(Km "_\<g?z}d0ɏ>Y>w޼;~{<|;/>xn{000*P<}9ح[ oVV>@b7wYp_za s3d.?w!R%q!'d=w~o~H\J޼=qUMԔ ҘDtPfikM {kT}Je}H D}A, Lhڗq3]mZ(_-ng'5>JfDNiJ*B̈́|8tC8dOG"2W\ifNZw2__y=wG u ؐ8!"Sds0k}~{3r?}Lk[&R3+缮7?+Dzo-#??DD∰i%&R0w`| GDτ;jÝV?[>#jpnt)+pWG~f'pr!}@w(   O<`LA' A4kޘ>Z˲&`q]oL}L#BeC(I(Y @Г$ff֧ ĈkӶ6Ue"&@//Z)tơqCRƐI2bW׆@63XdJÆ֕d"r`?RaWGQD(oGz\Kȇz/oǻv(cy^|?[\>/~_Z=.tN<`d C^g'?w -+!ֆ;^ݬ SGPk@ʼ<ƺxŻG_|}t}w{sASO^>^~>0xGk- 3Sm9afᬍuαۦ!o1xdD^0!09ZQ^kF@qKZjY1L8Uk1Jp4ٵ7oyӮP( =#q@Ex*}Nӿ"'wԦڧJXF4n %N4!z$mDDZR2ޞ[}`D5CD<"U!0A=7SȘ0T~z3 =09d0E"~zWhY9ziB rhz #¼noo~/)lD܋<+"Ȝs>N{3s'h9XN#OlJ_nH?p@aGz<.A?ZNfm|ʑN=,eYYtDVyxc} ^_2{SW ^1>Ezڃ[D3'"QVP!V(w@ XYPqBhn`0ն`mZ i%WզЬ+ʀ#ٸ!g_Tݙ>$.u}S91ʲb8#:@bFc@Ĉ#1ҪՆOz 1fՐ|Ji0Օ* I%1zIo qқkyr}nK?}?G_~'?>v߹<;{dQ6c [2|vt{m9>4'y}Kv}x U AKp!WSHئA[ʙ۷W7o|qZ7Ȕ~\Y;8<ۗK! yZWuU@BIȸ߷c 2iڂNE= ăf),d)?z c&ic)s@Mx#NCްNE3D!rWm}<"8LWzǚr@1κr!yHGs'BاN}>F4c`{X`-OI!Cߏ@=`CM_]"?<˩3-_SOH~c:Ct@V دdDF)Fc.3 $NFpbi9Ȍ9Y>gow|&0>y$;f]M@UC w{VoǺ^-g18L[ᴫj[<Ҽ\=}"O턧7^z !AfWo߼zo& {u$NUȔT""dZKR L܉g*@pH4G tRarWtTc_ 0$Lffм-o7p߇~0@HZ 0Kb€pX8r꽓Z2<ID] \ ­~ " 85f <1!?8ʌ'DI(aaGpw71Pzo#CL h{S IDAT1=뺚Y&$9K'u$]ĕ"3j `aJ)ǹ!8V*lfFUUT_i*~LRD.kpv``qw?}ZnpZrk3|HQ"7zsoD$S<*P'o"sr{?d5tz#2Dy +B@tjD k&ԥn_r6$Baz/ 0IN$^ZmM'wM"Ә`zo1 D幬YZ9ѩ6r7kĴ9aT=7.v""S9}4)U&!KmMOřy^njԥ8 QvXrCneNA۳??~ O??/?󫶧i 0T- * _y[8նLZ뛫Zd##[+ƴݰpI>ēh$W@HLݗU8M>1J=cBe̚jm ě%GndIĒZK  (HI浮Msn> n1`$!GoQK%/Լ-ëWnǿwI󴝎~Sբ818Rg;gY!C棫EhZp~rg[ߌ߽o~G=?]l1ea|ޓ0f}OonXXM}35oCNY ^DN୬2G>.s FV}7on>muQy^aLy~۾x 6fYֹ^ڗ]ir}p\J%y` `4vڼ)Yd,iV*ps"rkԵsY!!u0׵Rqr*uADV[-֬F8 2pk-4Y8'aB$e& V83  9 ]^ ;=#bupgbM7:4"L֙y1 #n-7L Dj1恈Zf&ԩdf֔ 5>U sf$ܯ'ڦ5}Öe)%ZKNC58p H99 SwNcJd J\J#JkyXɥjkaΣZU$dX{&I,MUU3sxQU]ifذe?` `HLS]=YUf`q,hj+vzxø{noۻg/? =#`p>gdfk;SS)̓)1K҄`$N3L1g,,4#k fz:e=j49+{};1l touҨ$9 }xLJE[mmI)1v| d0 -VH{s:ߡ|ADf}d aL}v[J16dCݢyHRB]PUì ~KT+uo@9 ^= nIhX]C'$"@!H"ꆈC[+2EQ !όZ XZw\xN.CJIrέ5!dID[ɥ BD G3כ^x%6Nޅ~l3s^6c|.]ݫ[֦q@@47=D v ,<`ᮙ {-" z!"U{>~@iS`"4񞈂3 Ii⹕tJǹ$q̤87ڀ y?fv([3O}X泶n=:?p8|GK)EӁsoV7(777euW;sλi7Gfr&4&a@UkUMÑbvz7WbU}QsW3WSN,&n۰"vwܩ`! ˇeSJ _xᅳ M.:'1 %IӸω[p'¾t ܚQda5ex!0P@X\ S8 GQ2JJpoqkEVkFH˲0n7]w} \zDS+%@pAw[GlDW ^:uDԏ~]csV eD .~ u~l[*7"ngn~au7\Y:2FH'?絸>LT R[/}ݧxߖisWmV۫qr=l$O(:Hd "rJ)1s S0@ pp 1I aכ}i\_nz$aXNifA@$Y`gGL("%NҘ"6y\g !cdֵbf_;sCxDiuY@y&DfME|>3s"7k޼y,(E )2h(:òXy\K;֕+'mAstt|<g|@m8Dt,_/yo~W/ϟt-f9'9?y| z9TjHD>|cu~|˗L\,Z001$$"Z.+%9 C_ ҐR{ HZ[+ZV{$EC%-.c9 7ݧ_|lúk- a̓ZEWm@a8ʲn|>~=<ܽ94A$Ap'J%%oktWz#%@崘RKLXqDQQSI9 cRázz 8=rJa= QHrZ  DmeҗyBΓ ACjU[JR@t\Ǎ]VDO(n]DHL`b[!q "23 x 4M%q ܀D^9zA̔][S0fSݜGyv[郟V)mi#Ȫ ۿشZa0lfD:!;^bO{WG/'|A~T;PlWąX>~̊|:"ߥ>ۚ@ =hBwJ DX `p!)3!p)H$,DXݠrz@ )r"B3C_1s Iufk@bO,)۴ 䪭zs bsBbڋPJú!8°,jIDqD0j(SkKޜs4 Q.;&"a)D`]F)$2 am*Ai||`ًaHZ/߼}߽}(V~Ր/>퇜Smj#"??Υ(~{r|.}}}@Z[jsZB4@j-e5"J,)<4,-‰#f]\u-kc*oLh0Ar?pwwk/,C|D✊bXXa?3AiH:?sc$ ,Y0 C #5bF#~uυNG[k ,q^hD0Bk@H#'IW k((' kB޶;s @uH(%`N9BQ@Gpo:zw$rA]nid b 'G?\b` '^kiݭJIBZk [Sl."#"Ex@Piɺ k8##b\[sy?sk hf +cDob m.f@h'3c7Hn$yt:=D23A`r,Ns=ΏښO; 䩱` g\0IYv'Gtps0fPʀ շߎހo9 [Y󬵄|z{mY{ǰ:Wb'7R&i.v@oVup rފV"SJ3 $ ֦a1 RTV~f?84f]$cP7%4PXb<,)Lx =3Zֆ˻iM7c/ ( 0<9R|sx13rnFdJBw_|^W/~':Ïn޾9WZ]) " ~Jw#x{~-2!!Vt<-M֊@7S~~#Zm #KJR5LLNZ3IrpB#LkmD{DU煴bn1'q)<~ QUa?zj9?z1ˏW_ߖy~m]3gtl:[efq؆w[W=NǷi6YsvXDD8'Hĕ'C"-FDǥ>5`0soI|MKkM̒NVµZ;ZpSx8ԪJ`!Nf`4J9<hQU`Y[up# Ϝ(l\j. >#sf!QiT!EQxYW`'!4j-'"@W!s0 U pD@"J< 2 FJ9s. ѓ^#:>mK4Bι(u]WI,)QM63k ȟ(RG¥V8R'C{GjJ+4\M~\ۭ#?1]G_|]smG,I3> `^]H޳n {asw@ dQ8!2SQx8$V1QvCĊ<$L07T% f ҅:'f R3F@ VM0b\Ԛ8X#V X^p@B&>Ŭqb G]j `HH@Q;DD00DD\QPbdr4#VQ+&F #PtZ an~9/ ~q %3"쎽Dt;vjOSs"$^Ljf=u'#7"ΉhfZͿI-`خϛM̏6EJ9iۈ7@w^aL]zU8t^_pf5HE&ma]iH (% .7dni J<2cmeVE$̵yKCʡQxl9qd1s  S)n>-BXJs<%ٍݫǸE)kYqIīE(qbdb3UZ*=6dqy.~%!o4DR)SN,9{8e.y 0BYHv0Lri8/ "M-]~h&j9Pc)|Z>]?/?7]"[N5n'd^:T}uld8`umRPTt ݴ0VrbnZ 2vwnC>Q1zJ)g"L4C:8>vCLԢ>:hݸeН]miDa)1<=;ܽNU5ԃN 0["g-jfB; IYj2 T+D鰛L$QkPJݸwvUӻ[ IDATfI1AP&Z; "'( {pCkmɉD#p΂Ԛ]m[quV|f$ du_L})||8H[4a_wã+pYd F]SRJCf͜ڢˆLbq^Ӽ"4#Fg㓆Qa bpPf[P%X 2{ q‹;IDP Nq4"KNh_AcC'Z!wf/#)IA"!H6wM0xxy!91Qo70]"5S`ꮍ"Y6˛Fpt]? ^+ˈo4A2ic6yP YxbaEȈ."x1q W?D"{MDDD#€nֈbY#K>E1ѓ_Rk{:f4iw.E}nZ9KU%O98h,z:.ZsZ|bO`)"kJi0qm5uQ@$x,mEr7ZE?Z3<(J^u~<.a?xsO)Z3\U-esx|Sy~_s.T=N?ӾpCnmcvZ~/^߿9=.&h0ZԇǟDkذL)ݚ[;>(>N9i+D1ӹ!Zs^70f_,H>R1eaX׵J4emw/?|zI//n'Ͼ} ̀e-%eMCDeylAaUT<~K=ogBL;gV |g'𵆄ܶ̽[gD("ꈷ.ْ$,E.Čm]iτ: 1'iD ; '=KXDĪ~7$^k@J2'`sdfy? hZ\NnDsVz9Q9" ̚zp,Hԋ6`rbj#~ cp- MI"ƾ3qͰb[*fq^ s:yN̷je@vwlMj0sVkE,:5mՐ |&,(ޜy{ y$~Ot].|B̥aڻ;ƉjeY0 MP{ z@FĪ~Y8E1蓳jkt$ #2nm7o5aSƹ7r&b)w>Wo>;oFf[N^>SB\x?__׿yOϞ`G[0%I=\#5Cps ZWv-5ɵ)bAP km0wBD4 CT-Q,3۳K-PA7gA֖4dwm%|+ӺZ) o}uKgڌռ16@D7[kZO@M8'Woei(HM7Aff z­o/CmD@,֚+f"# B 0u0 do>k1p.d@͓)fR!ySD#SUeN]z&"m>OsDLӔRr /=O3 ^ˎgcGAc&,'ʹ+ݣTE?ŋފtwpcA 0>N !8 !Z){:2zE])Z+ZU-C / KMÑdE |DeYJYsJjHуԧiڼokT5e̬j WoNfBN*?Yټ,!ZDcllT$)-̢sZ1=g# 1zօaPEĘZ!Va+oϏ"l`BLD2y PT-JuaCTVC`4 0pU6̛kW=p֊$̬ (wVwcc)(j)%h]n@W}kKN9碭&iBff9V;ju=k}8w/?в"s/v#_'spޗ}[1_|v'/ʹMnGĠ?`WoLJɇ桝}bɔ59vn&'0}$]NIVP5$i2rRA ꮘ!@ Zea `"+HcV0@aVnY5$ !2;'a2aPݨV-5`F`~SΏoկ>1F -/X.]mוzm|&EK fֵV~D_Š/ffݻG7\&%סuj*KJHa?BnLD$, F zXkWKm)-\'30zD8xXs8& D$D"kp ,QڍY!#@()jk;HۀBj#A nǒB!Ufr1 .c'`R,q 7fv-whsƀۧPMKNMǗϞG."I mL) ݭƺtqHfgwaS98pv0ƺ.9;Wui݁O$1#\DY, 2 #Y@b sь|G_[O]s@Gpx%?û!!K)OvR?;9B`]4M9 ^P[]01`(Es`Ykm|*QjPRkcNAK%- BӨ湇ZDDt6}7]%e2u6$PsuđLBu5k0EL(BRN@e}mgݳD5m[Gg_~vs+c3KaL.M?0}r㣟K"zYKVpϭ I(Q S08HbAJH]Oœ$R,XSJi? xQZG 4:58:3YI$'*vSD[0$=Lk&@SܬAH0O}8c[GΠw3 ohR rgi}6\ *"9Gu& z6 WXf9]Nۑ"4zecz%00|BPE@FdF SfF"ɽ[3a:9 DH,"sL ԺaqȮepDb0%00g .6r.@ Кz9+dD{i^MݻJXB $LIhZ)%Lyrȸ RYw*RagJid%ʀHP0adA-D JAZk 0 %NCTQ[DADHPrOR b~BB(A=oBT =HU7DDXu}$B4cMldfgsje s֖dM)8d ߏ2Q/D Cig̫u)ֵ4Ӿ1ײ$k:7@( wG`tkM5j&F !$%b HD0M A b2(g~7u}|O~;~y.TVLvvM0-Υ zV:o)% ힰ] _7bO(f$}]ݡv<7XV;W9gs2F`!i@xYY9kb^5=@=%Q%W^Cpy]N%o~ 8Llᄌ(hK .۠BU9SJ9o"8lKrIPkEĠ""(̥,f{_z"9S7wL]uvnn`#fAp@mu5wioEn;!;-0a L 10  q &f!&`nƌěG dJ̨fOhZuB(ѓ  (@0"[CGV70Z5a'J2x?"zaVdR ODmuo5"ۖ ZD!ܭ$Gv"G&bmP ׳2NbfAL ?@`JƵCԣ4e 9NWbf]$Zm"\LY~o. ^a\"ހ1i|zkY֛Ga073sEA[ixWbVR (F Lh|ErQ C"9IJf*H.,9gf"Z3msR5 }aDJzff&bp"fNYeUM!h"JmNZ57J$RZkK~9}uav0X <{vVvCa^~9CdQ wb$uJ̉SJXk-Ƽ֟X[C%%RNT)Hu]m-nnn\0L1kakkA *eZ, ڪykl͊7Gp*LٻH]gbwDdVUwsH"GDyGcx6࿤7=<1F,Q$!OwWUfD+2Ɂm@PU'*r^{}@8N"f6a^pӠ0 ^>雇>0, y;X8IeOx{~32^pD9iZ >-RȔZ4Mv=)iFoADUU9!-O7%SzF8qZp3. +f>~ps1IgsG33$Fs7L,\ AX)ML=Y6wCDI(2 c@3! !݌\5\UY%g7:A Vk;c[q~DJ8Ԙ2@1aE`'c!ܢm)7`ц:acb! SNU8,㧃|ĨCDI*ݽBL(tT%Wa6KFv+?anqo6O_:29=}^6%&2bDF/ո8R aDTZ #|kPb)AnڴͧѶK:M0J) nanĉyp5T3n%Jtn6Kn%i*LPk߯ : m[o'TZ_^^_uHx\ mNOD`A_ֵGgf, XH46/s^퀬p.RXj)SEF< 0fC&AB@vEb>PZN"5DP.,@",qo^JqAez[k稒T0dbi\4}Zi"$33 KQ Qs#^.43[=P˾??v}:D2G`s晻3cw[>yU2-38A\4 qgnݎP $U8"?.H*R{ eJ"xmd' xODlLFɑO58aB9Pt  `d,AwCa)wUU ^JH>r=&o&$43mk-doV9C01.Ԋ by۸':D<]1ZP"- Md=DUU(60@F7XF "\#< E!RE,D)'RK덥$U2qy}}M.x")(xӼժ_3S'tyAtܐ.O!|xBrw/#V'4" $ tw "hS7eן?},UNs>tf.]6L[۶E!}gZHacB>vՑٳafj 1)1Zk۾vl\p] ]jA>ϕ.l涶ufj1<9R^v]52ui:-'wxy2|. \Pz^>[ڛi:F4zzsBpJ{_4#{eD}Xp9NU0JLm_Kkf§7:̇{|szt'>/!"j}yV :XWd2]_~v߶?<Ʒl>~sRtbbLQ#rBZv_/v%dē (~ IDAT`DL𘧉 ھjeHMb3@m5[<Ϻ'$$u}|x"YK-R$3-pk]zHy".mt2^OòFSd2׮!4@`@y`jnf"~:/OHhj!#-H=Bu1A8=h3EBfR3.L$Tj!&dր6r, @u0@&"8Tͭ⡜ndylU;ǭס;^F{'?#F(rL@`TjVQBr@bF0Bڶ±LS77Su:=mw`>쬄"vsh\ G 9;'3)ifyU#4n> ERp(liFG#u+ä,a1xR*1H.RqH(tzXxuZ뮻{>"=\!\Na$y1,wH买:133QIglf>}LyN)ûheUk꼵>ԛ7o-"ID<晄GH$@MEd%)#PGIJ6fYT L3&PÛ59sI" IZz"M 02!2'۴VI\ Q+rF{p1;#p!&p'@b$fD]V gTdf ؿDz42-/{c,1g s{z&kl'@B `c b`r~Dy"0|.*50gr*΀~d,˴ ehB! цkf88 2U"TsKiqT\I֯k4Mو@ TôJ"B$Ҋ;׸E WU/eBa$runc  @pwPn;xT!M 3Mq`ܥ"rw#!G9"!ȹ\Z #1A$:) 𰷭Zh)SJMSc (L̄ZO$DRڲ,lr S0hCa6F׽3#_ oOE A0"}ƺ{}[݉%n.kg~w0EݙQD մB 8iPz\\NtrNnnk b|) Ux@#S8bV.##y$+ 3kHe`   arC3]8n;aR-I 趽 '4R)r/ޕ% w@&PCy@9u&"XE8fHY F0@$ՁDD HH:4#8`>(2$ەDEj̀DxH2ϥ챻{-3I}hLytUUf,ӄ,L@n̄AH (@omJ*lkC XĭuZC k8lMv<Vpa,ϯZ [kF%3ԣ&яSa)\lu>O%&pb4ݠ^k 1`("mw~+o%"$u}db)%{>Lt*)xwDTd֗:i7??7??ݑLdOub-Rxdnt+t>+< 9%\2o|w|m;RMD7-*Bwf.Mv~s:KHgn'pd_#(0ٹ("CG9"7Z{i%e%wFLo5۝{C Jy8`}pz>/rQ 3bi9!DT*X׋5=/ "6| @^1'@>1"q:0H޼}yػ:V41UDuHT< JuD@"* OA"S=/S]h:1qi2vsRfԈcf"<bT#UP޷xޮX+ à Ԕ;koAȊhm0Z}}©D*b[Je޷ݴW)|Ruطqnmۗe!B(Eډ$k-]{@f.jW~]?WBk\M{o\LGG(7pw$̟pU_0/$vO;nHR 1:D{#"f;(- "0<1Q͉l"Iiww i~F>EY6JSBg:F;HtEAJD)I@2ZD EmȨajumA`:P1 !`g7?I\m ;n6"CE覈G/PYSX(aXȾbdrcGm\9?'=4E5xqD?g(ln_#V'm7@C>1Ug!!{4kiwr`˔a 1yߌ~^/tS5op*͆h3ېZ>>}xFi)$\X0F)a4H;D fR^/Ej^| \ǐB3ۮQR4jmO27xC[]E.@\dZeY9Dw*:KyS2xnZAah7wpG!@qp2]w ݁}݆@4-uuz"e%0!T A)HaWhfJOOe!1x/{2=_ ᩵1 `5xiK/ߖg݆"i!bۺZ&׸\^Wb@u") (,u}~nm_/H8ZォuNs9к߿"[n$"'d~kGDZaJ0}oc4)$rc\"HT|wUMM0yawH3܍ ܎s}N1OsCJ{"jI9'I2I)%k:;RTʄѻ:dŽf}Z@3p# -ACqic)0$4ퟟu!N9xD1i*~%OU)Q|;"RNm2nc|]Ck{̏F dwB` pGu*:\[x #P{~V,5##P-$&އ1̍$ 0>)n(=3ӁI8IBp֚5#"C )":k#$@6G?, f.2[jX"P`ZgOGv뾶}7.{Q8ܙAODR9ܻ6ov` 83˺iY>ΧO~;?x{r0Χn:nF EQwM/өyw~{7<|^7+a)@8N[c""yRc܇w)F)p.p5J)fcxiT=7L %8PSInt 0vA-ģTw 7\BpcE" 0B7q1K."D7͞9[ ,ͺ;16l pb@֛.nDN@`D3#b@ˆaḦClJ&(V@A)Ĝ.RrK1#D{)};A l/ ' (0bL$m_l&"@D 0 8nv;Aq6^ ?3M7kr@u >;><ڻPus7;3U^/UE|:^^?/_zi¡ Jګ55-3L̪Y%ƈ$$@Hi{\mQzGDfhc% @1e`i\"#8B7# Fޠ'd.",\N'#a<])ue.iX4܍ VmDLE er 0O\@F`QBT~uy`F0H?#v&m_|VTdRU2AeYyՇ=<ΥL?yzǕ݈y"}t~_޾[NI- )iY_+Wom]a6 ܟu&?Ol?bZh"anҼUw=#p07U})pR 0τ[AD䃾q}7i*8=k;Z+@/&CC)lؾӜLAL@wCp&T݇rpP-n<\sc7Ruf #h8􂵖fjUuPWq\BtbDpgph3H$cY]ݝM"LiCdEk64 <\X2?=(('nAf)- AWÀmCMCM=x!FFrn%ؙ)t!4.9?q~*whۘ/"<ZHL5.|]ˌ/Syt"ޙy9*u Z) ].ק' .:PCDtof>MSs!~~-#wRU<>Bӹu@fF'6F w`zX .\.O7˼2vWZ=@t:هoED"Oebqa)H鋧 Ntaj:ͼmo_>fdzїûw|{xz˿?_=>}DW@e9{s0z,_?~}K}|/˯??0i`>}oVK0uZÀH(T`a+AZ/1iF@c |z)"w@eǏ#PuDP5BY+"#baQ*[7wRQMCI Lu]L̥#!͛T5suWI& 2 !yǎDB !>vco@ZkUL!~kօ|^k{R DKԉ,Ň6DdC-06  ƴCU50)eݻ(SaF&h>Bu|:/GB> q΄l pB%cm,OHu'y>ZhspA!}b*2'ĕ%=Jap#;Db$e^ 73^Ӵj۶{֠`xh@V{ r㍿(gO]*GMs3)? 23 <瀺d1\l. 3;;i񷧠`9 TL>^_ݺ˯NUbh{߷2Vн ]6(?T*>d߻Y'RfVy&֚m|ǏO{?A+'8aUF1z}aiYN$(Tw5[  rqe}' XWޓ ,(ڶmt'~iR><: Eº2}nC3ioC# -嬸]:PLH-}`L21`̲LS\އ :J}U{c\e]x.?g|WR"&F$ul7OchP$4?F-CykOO^W|OD!dZ˱Fj۾P*B,@Y!=5Y3|^PS%#n6ɦf vf>" !!"O+fVAdck-uY}i0mF#<AF&n.ߧuL1vOeFHbL۾_[k n#0`!&?K a(vgL<0B'ph\Uǚ3_Mчoi9M0h㾿 ZG*[F0HmÛh^#̴3~ $*tk22ՅJy~~ާo gC#Dէä@{iA_.c H!ĺRcpRJպ)2Ia0Nr~8=?o.0 OE8د-~o.]|JEc~d s{ղnr*UĆmiWо" 7 /[v~5_<={pIJNNMuPoco7f7?xyxe.Son]/{/il?/2(Y/VʴHc碐 "U3)2y9O~~!-ևCdrr90i1ϵV>t[ BI,}/TOD\ 318-(9&ie$"e.$e0p+"BCCj#DJ4\ +pT'L.ǐ"2I?A᭍@&$#T! =/q<!F|H}!TGxt3f9m up$ H$9I(b>0¦ KappmR'CaA)\ʽ\UV\y\Yc3ڤ,w_aF$yDSx$y'gfxk?s{pzo!3~p)+tN#]A !WN,oM_A2! ^ n9 0tr"\ 3O*4M@UR0DI|%21Ѓ@gM xZeƛ'A6ndBOxz߼I-ԷTOc]@XWVJ0{kabB6xz,"tr< E> B<ϳ*TIM_+Wlc+D /WeS% aw5Ʋ[>{ 9÷HKSz0 @ (raAl "H#( ''#HȐ>X4"KEr83LwWwUݺsk|V7%Y Rh {O{^Xm.v|P]'/&tATxflT9Bh1URDa͖""@ B$CTq ߝ&*e~~z74MhNY1+IKqZnZ)=]ݹ-oc4ݹJIu*QAȃe\DU u(~M2 j 1SSG`")9( 3ʘ.1P˛2ꔼ!$ DTWVU5MB6^ ";e˳#9D"dYRjZuȼ4[!jfVi_qMG 08l֩iG. S29HXȐbkK@ifPk64F ²oMKN%Qb@!wjt}~4ݍGof]];54yHC;M: n6!<׎BlӸ(6Д<k2\4Amcۨf3MJzYr\xt\.8rRsWRJvw aRU@!zuq{O/+=w$;;]H7kCg//9>:O,ټh~q2ReUR_[@BM~wvqb^l׋]?>أe*5OPwQcUM) <0h9iVjllRʥdN)TJ)ۘvifqL㪣)2oǩ2 Ԛ(FnHBDdo;@TrI$"K1( 44 M#JRc'AFM4MDЀOŊ0 [5"B`4k޹=tu@ x8;BiIB`Frp7(n)2VjwJi2mR)@ĆTՆfdPLEY9(:Ȏu]H*a ͆ u0;"T/-C7ʂ!1$ ,&@Z`7Ń?&נߕB8JQrUu`g?Hե9uW/M񁿂0#1 6hCL|AZCj ]S4F+@$W/_%W^UJ3Hؐj)jjn%er0d1_}Xbq?5!&FN@da C+QUTiN%FP̈́jHz>vض8h}?Yp'vh`s*e\@'qCc2h28dMĀZrJTTJVB)@Ü,S TR 3P&UV a,sIEMhb`UHI2lUAj;c /n) i@(HB@$q.[si]ű!1@S)eqҦ]!]S.$ (~96e1RKA!o6}d>:XSOz5Lxy^7a#x|-=:o|-o|WW뺮.KӥU˶sef.igmM {woo~?/{2 NWȔ(GK3&guUlcE}̹Dd) um3ۺPfF! *Uq X=Ik:[ټؔsΌVb(T5q a-<;cLCsF&}_Rr2I1mtZTKJ88 ,GiZ):^3#ÐRITvRO+dQl̡ -l锝1;Csw}<T4%U%"Rj$v Xu&2S \JTo^_ Z!⮹Z 8#9rba  ȝvHjн-=P|O``#0" 9"ؑڠ4wP̦/LCQL !UB0^\kubSmﻦ ma65mD*/xrp~У<~ [ΚrK1֕rqhd`Q A\YcyljR{n8;) pB'bh.ܵicJ#2[43BVӜ(k)0=B#BvRUF^LaKC`0& 8N 8}LYj-2Ncv *UѼJ1 S.\)u j !r0m(;f-vӔͬ J{t3(yחR4 J+ƹvY.GZ]Mb*ns;L@٬}5%kNpˎtZFڑ(HcjIC`HMcsڱtvx[q,lJϑ5l3n9r;cDMs*/|vwvZ,t/Ji;rdF$T5V"aVH,Bm*MPMŠ(lbq "gggfD @FLRr`t+D 1{hfSL]۾b B*y8xx;)YNNX͋\#0l6+"ҝPmR8dmkitj;8Ґv5b>'/GM|6u1)IhEͲ4%6 Mݹ{w]jzPuD/Df]Gj#M8M1rqd~PN`*5ƘP` i QUh4 \.7nݻ;k>t^a| j{ַu=_ ^'o?>|r2ʨn~>%i?2!U- :kǽ8$ZQ,y|zӿ˿zC7&lkf.%my Z@|8P6-yY@PG4u]ۘ%gm7~qomZ#GBN Lj. *'ׁP٪ժ2RVu3t4!M;zwǑYFv$q9 lۮ };5-iF-mB5f4tf,)fs׮]??_ilbm̬J5"b@w7oݦX,m0!|xlE-6Ё ݻgl⪊d!b4QD.+E,H/r{Dcaj:3KS+@ARC*PZF$j̪{݃E}W-3}(5#"sZJĈWנ"z5:^w6 ?=?723=;v:|+_}ff mǶmΝ&QlV:A3gwA@6% IVjP=ݹ} h)؈HS_ضekJR"֮] 2OLJFx\_2"zӄ"i\_{uB#Ϧ$0_ޛPS0MSJcMygf*0lW覢Rˣfŭ q}ǻl3.y&z1ra8D,jC/=J/nNnc\0 ۵E&iJ: cu\Ԋ*I1,MXqƹs+3 dAD%< ,J/ka=/| `]f;~h>^ykk|G7Z䔞sM^ē&OEs )J@"Q]MJ63ۦXAv"nZ@ \TV`V%lL]4f7lGm9LJvEsSbQ޽{˿w}juY•B. (abSM9aUL :0;HE5t`$s}mL.D6R]pRHMз0X1㘟y؏vЇ~P$K_˃EԶM06Q6]S[Ց^N5̹:! ]Y,͋n>g_{olRU7M3]l*GJ]+zή2N8X<ׯ6[o۶:tq lUr[,!"!2j4T܃~꓅;THVc!I+|w:R,+he4|%lDH\٬ ͛'ٶf6ٸ|H|tmo8ɹ.f=}߸q|CO<Ȼ2fbH`nJ@ n(+H4T[A~yÏ{ڨ״Nhu'xw4df; xo28$p_Sg]4$+#`e2鳦at=cܦ lIar%D$냃./vМ\3<Mfr26-a{\s׶DL)%i "M"JIýa4i,\XÓ4Mtm; b MR sfj60*#Q8ضd/4&(6M#n7ife_L IDATqC w K{ C>Moz/}sC 7?\ ȏ_쒉JEnR&0'[! K53u?Wd D{OfD1HX*nvIP\)v4YG}oozf%"mۦ)HDPY@P?&Ԫy,ݑ}WA]ݼn>?w/nuwKUS A<ܕ ̝(`J!Mh ]]ঁH Pgk@5]z5EYE>{ÀZ$V:/ݮ*?"htfX+W MA?vMz#j`t@4 | ks_XV}S>۷7rffXwnQw?'''~~vx`L}F7 bq;NQE@]>ٯ~wE1MnEͪÕOTQ"0q$:sO%;!saAxT&kk4_??~|<}4kfJئX&ܐ9vqBpPi%gF!|ՠcH BĶ*͛zѬDRWTsmoJ9oۇnL)Mavhr#ԴiS1rZ Khf9籨׮G@ywȫR4ۄ Ɛ$ +v3pŝ{L 1o8O|cO~w]~Vz:uP8 @|0U KU7"A73G &}>[~>s4#Z[cv:7A3۷ե3f"2Ve?!=n&"39+y%# :j])`ڧ;枖df1"2C.S6FB?͗^zj_PK"(Xp$½XU֞ ִW<pGWw<%p5FfW;Y`9'şcz4MB$"; ۴6wt`wfV7*v" $BQXrͽ6 B`s_uã%3u,18Ye f!U$Dw .Ot+bS`%}s4>7v +yW!} jUR#Q-шZ*Rмf[hz? B+H}ۙY''}m9ZBUb}SO}juq~a%1ƸL.(y$.x/~ϼ Gk׮7VU59:ԽLw^SQ :)rS22(rB %c(ܝz/~׺8Pˎ,vrBD`uGB7d*40BVu<1 y$f%o ux|׻o6V`C3Rj}Uq\/_;i򑄈f6P///ntt(wE3fO,bN94 uߝ ywTBI*a:"`*ԫTաǨn wյkҖ=0Ν;1?ک"@X"xfIcDz!1Id7$c.fbz ;X5LJ(Ȁn?g>__z_hڐkCF8i+y ЅQZ ~ӿ朼Z8clb7|3|j[!*d[O}~ q=. H@`%ҋԳi\/?_^گw~17o>އ~v=l6!4b7%\J2ڸFrI=Y`@ǬNH;&y;?[]rX,K_zݻ!9g5p'2 BZ)q(f,3P3ɳR15!z@·o?~9S$͔r= m, :d,01>'.H@3?XwjOOb#À3Q5iI0\1$ !6Ӹ0uyÛ8L㋯k^7-gyt|'?}\{3,b~gB.lF{5ퟏs۾ R(|DT/nP 3:9: ^n%vWgg> i.AFAo,k"vr˔"RlאtFU^@P]0DBRjո]e0" 0# ` uC Qpۙx*YM<.//iWp*nl*Eա Qcv[=I+׵>GVC~WxN:eg@"*~Z*H!*!j{Ï|#ow=9qqqݎ7n]dfJ7:c?R9-$Dd&-ɉ@ lWUڥWAj?O?3)ig=}SȶE)9939V@ T *#x |^3^U''6h6iVÓGzu{eRp3w5OfZ}宻_;x嗄X(f`J641i_wrb>m|of-#<淼)(䜁w=Iz1$Vl%Ϫԉꔏ0HZKJRvGuK*6Bm~3;١dMa:/ZS6=::pD 7Y: :F<<:0Z4P2ZE撳nbmLy$0 cp#pL՝$jĻd-BXi[e0ISTŗk{41tr1Ұe"w#)R,#4^q5Yrwۍ;bnCp^P@hBTd( $,v3n99#)̎ͪQD YW'enU ɻ &vw ՏoiBI(!O X-QPDUwqg@$$!*V#,wjw誀U;Q&j~^*fȦλmwWc*i`T+oۧ`QkW^n֫ˬZ7 zf/|s_=Df@ x&ߍwl BܹwwM?_$~W͇m?W; S0 !z@\!<8ZF&H![qR*/ժSmUЩM޹sgFcD(\}U/L$%NӤRBHF"J1S2F Ĺd_$-IUAhbjj}SV~LP4$٬ZT )\ g: +S&B`Iʫu"b,#:H ''7N&M{SÇ=yPl^m=$Ծo{͇y_O$l>+sO v!P%YI;wnvWMӈZatMuEPz6Ln4Cʡ"rZ Ӥ@℠JDH$)6ftp"4s+$k۶޷^4tA@+ "x&"SJu"W"EG$]YJ- B 4rV*S`2Drtda"h}Q Ӣ(NH uD\0kmw۩N RYe,x1=[KuNDA p) A{!Uƴ省jYUl+ Z5o S&"fbg=޺u+DD%yݓO;{prD`A(kB(q;itjZDbL\l͓O>~:ܗ}t:}Oir΄ND2c\J@QL1m,Y_=tc9w bu|>;x5߸q /~-g.]^^4Mf}R.0[łAijq<:q>?iG"2zpp#.V W[!0Rp)HV˾dldzv,)O#֫''c%tAWpicJ1ٔ6blh14Mǔr !6@ج&^\ncplBN:$f& X<\> 3CyQ|!bNÀ1F)cr3I16K<5ӟx駞~ry>^\% rflEn4"b6Դ(KȆfn)9P43 1bd+nA k"nz1"ذ^碱Uv],%XƔysvz ΂$*!b~۪qBʮT n*4ș" U_扑)9$-h>䫽4K&T9b 1_jl,-R1f{890PmگOO_;^tvvCyG^~qzeuӞHcRIDJZVV]R" $tҨN)3O=g2f|'LsVҮ#X$Q$Bzms_xرmdt}w9?77Y5> q'0*W\__lyO81hCZH%Zb Xi){3;u޽oӽ}WmecqR eendQ8\X>?0XoF mHҿ^sꕳgϕZoZJedhRK$/0BAX)Ƙ@I,vT3Vd6nZZkX&\0J1e ր:ľDF"iiϜ>}x O^gQ?ԛuSEpJ~Zbjuww7[-X4ME)TJe*BQRԊ0hZeO41֚,RPf9hFa<FtmM w `` ֈ*؇ޕD#g[uI۶팰dADZ1 cР mR Z|Aj@ R m I*cQ0ʀARL[K@C#Uj]' UcB, !lIb4ON>yê-@ 9SfZBY_Z{^ LKJ+IeQic962k e,ٞ8jDκ?qz٥WrRg8Ŋ #$7I(M-˲,fQ$a#-K)$8fԶ\((hq F um=d;!D8ǘ=1>fY ,*D6Q˶-`ep 4L6 7PBJ).# !a&g7uMM;8 hU pYFidhXXBA֌e6Ri9A\j.S՚`2Z3<9 LUa)c0Rd % !$"bXRVlw~OWNT,u7K88?aӦ}i8vw6Ѡ#\q# KBSŅ_y_~^z;6Μ9;ΜsӘB \gggA4mbaqe n_ `wG'R5kRdʊs)\ \MƠ_PNFœ\[dqOp˂ Q}G(Fa0F dM9t4\Kl$x0p27_ziך׷|llb" P.UDZ:fFR+JXʹa,:كR\)JFVT*aQ""&Za[.HJ,-u.5k֎O6RjNVT i#0&ĮS,Xָ/(I(MS&c4@křfDqTc`P+T~93SQ# !Xi-"JQ2Cf)n"3 F\ 1m8"! 8k7(Ȏh,R SAecYBj4<(K09v [vl{ L\2(K5⏗QH)Vr@XuG* G}tTi62fc.fIsqEBpitVI)S7u8m.:wʳ>9WJ<-|93У+s.Xzݮ^ywf͙Qym!va @0Fc"fy+rjL&ς,(# c~E͞;gQniͶ61m嚍X(k?O{?5mm]q'Iyd;4s{u=# ̞37N?reG8ڌP@ (PE[،)iFI%1FplG݊D^#!ȀRzWFڮ͓Z-¬KJi[{9iQe˱Si&sF1J,JBi4fDh\Bl߾4<zuãZ=bBP(͛/x†3gN>S)522iwiի׸Nn(b !Rj֘d099wtʜ67H ~k2216${{ѳfmk !〫ݻ׷t۶I0jFP|3$KO?#?ޮn-RaX.ask? οwlٲ.暍 N7qh h` B`1V&>ϰ1dL-Hm(jT$9#g~Tr0( )w {{GP/<8|o}eaZAV;n۶za]=ܶ}KOw'Al"a5#4haL@6FHDjaw@m ,XzWנ&VJS0ƶmyv-llgn1cZNF16}r¥J{5&#$]FjІ"H) àZ dBE@#TJ}߱zRzڵAB#. Dh+T(ϙ]TObF#BT !2!Jֺ\,wbbBJn4I$IJe9 ƺ`A .fwWwRV2dK%ez?!A3eZۓb]m#miFS^mUq-ǵleS ( Ȳ^ry CLpuueaAI%slDZ\v]۶eQDZ|߳mu]\׳mDzlvl6DiP؆6A%CPFkPZ T(R?((8N8 è &s$< 8[1Fr)KqW$IjzڨZˌ&S A;wjEQZn]fh4[-T*xv8ZN>?_6P"X`A__3 Fc@)h5? 0|ip`hTw=JwJZ/|Km.;kjk?s)y8Bcl'0A]*#VX.%U'::;ε(c`!Š2:JbhQ˱(ts4Af>SD'#ܤRL)S)8FT&)/~ S7妽[Rj9\FypxgCgMm_3Ck̨p 2a?] iwrVRP(9ua{߻{?b,<❽Vuk ,LR4SlLYv\e` L}2̘1X.|sW}Y&F1#fF~_o_F>_$x)U{}s)!8m@ie+@#9˱M%Xr0Ǣv!_"h>_rg?_l}aF0 ʽgc۵W4ۅ]wԚJljHcY[=O?;B+4--dZЈbf`, J(.0iF"5Fs%R1A YTػӗ]v'.V]]=Yc#_(Me2"l?83OQJ&M?dž[AG{Ӧ :;;=#lJ 1aRär02OjH"Rᡑ۹dUߜBgW'\\0mg_|n);뼳 O͞17q1mB3"x61^ (%2 !crbTi/-۞xmϲ]R0`SIr9 hΞʶ'7mm̛p%# 8 >ޙOf\m 8K]^p!8O8ORyR`mh|l0\B83?Fe?ւBP&/LLWc1EXcP 6(` sB!@06یJRfHP:peęYKEv%TPJ2zk1PS?0Tje,2r- sW}uwut}{={uk}/E(< (I)m6rQq9?g !TRhٲR|_uYBV,EA-r={ժUs뮍;wϜu֙հB&IԎn}ZA3mhmFJ,R H)iFwwoT_o|!l&~Λ7o}[<6,ƈXw?k^~еg:W^}dr(y?:M8fwtt|K_Jm۶8 ?gƌLj66^]0x=kN+afI)mo\paoZsF]qh@C!%x}q{s*o|.I>J҈RP('DZhq(0ƤXk )56RK,Dp1_QGQtp_8jݞ$|U-iI)$[/{>WO+Jm<͛;:׮\!qm̒>TZEٶS^xC{vl_? "!dImlb+̞='/;ƀEmB)D肱VQ*@ք5mj(&dIeIj~îϴ,+ShdPji (JAp|> ìFJr8=/PBRĒDX % U% 99BOR@C@ 2< ׌ .8"6Zes.#SwjYV;n,(\ۉpZz+Eց M۲r];VGd|g]y R1P3q?}W.lB=foy͏8?7xG?y󏨏me$AihƌR.yUusVJ?.V{-;gllql\(O|ʯ~0{~~7}]JIA3ri0$ `e6BI1XzRé}?]Rl::z.iG.ַun;rɲGF {``PagqƑ}7ݽ+?+<88629Cǜxl{WgTl4Bh3'l <=8s!DԊ-r]7cιy|+]y qoщW~{;lݺs]/ eHj-ۮ%'\Ζ*=gV4]ѲT*Eq*sXI*0GasT$#D(cZ-b˶cێ iAfu]>dY_.Jx:g\/zٶ/_3;kl1e\:hDqhBBU;7˯  vlCH4(18e4M1F #۶-6> IDATK#"Zre˖\iӦ])#)}葷zo޻uǞDiI wӧ͙;3KKӔ2h{y`_Ƈ'>/:ӬWł9^}߲|Iy\3L$`EMj.ttvwI,o`[=cyƴ3{ {nQ.[w'e|z_5to5wqlB$goƻ˟o_bƻ>sP߿sݿeWWWFO?c[˥%KL}O=G;Nb؀Q*齜K,XkclۓRt2\._lB!:;۵1i*2̈́ 5ZDkmiО:SgJi͛3WJh6R^m<:6J1q]71"(l,Ì?DFf d;R_ryY1]q 9<7nl4j/J2˲IRn1V((ib\.wǮY&eY~/O=}7{K.)j1w!Č3.Jn汇ZuI2HSL(sjզ8Ӧw}n/y3<82!~1w}SO>wꩧ_K<[n+>}URR"dӧϘ1chhlN!J)OBHI-QNb$I:HU+/g~]=㄰E1cGq#IB@~BX̃Qf[cBP"XJi%0a*C(c m@h۳gƻz/[1^k+L ys,\iS {񷻶?=^o!?(C%CMA\ ҾcO=̾}`y\T8Nt* )`#"Zhjaf(Lz<Ji944*SnQa{cz/`ph/W^}U}#Q,2Vh1FvՔZyWJXz7'm;7nܸX ;4bt.|жmb!S0PFJs% Vo+V -A?Kw{Q1}֢E(h7^{])\.w3W?CvbN>_lkk{gkAmV,x͝OiM}sݷyD=?>{ծꗿ<3z\k۷\bE{gܹs1"ogpA ^{{_~U<2UNodZ&ʶ&8A:EMR16{| 1Z>+'G!(`QF+xmWkz'skŤh jE|޵āV8z###mBAk9J0˥ #m,ÀQF.Y(F#C1`dM5MNc|0b4 FAH Qrmt 7>4Űm31)Rʱ9DIOeԆOb̮GFF9ƴ8ŸQhk:9n'dAH#2ڀT,˲)h[d?yz}|lD)i3fvX/Fkq8|' [c-9j5O/[hE-]˶(NԱ=u+R[BH kU1>6Q+"3QF 5]jk h(0Rr%Vh˱FP|N=}o۝wy捌 'I|}{t< v>YҷTl9o +m^K^|f~ÅӦ|ZJg'P61 - \L>% R9!DA<,JRu}4 ͛7ͦRjhhenOG[f~S rfoloȪN4 ʹS$,l]K.oԣfp܆?qz+WRJ^~}O>t\ohq<.5#$%76JIFՂ#;0MF'} :12lmWD=s-KC=hp)g͞K>qW[ɏmǶZ0`dddKFFr#.ȇ/裏]tE)zw}68o?v-9;6K\ YU0IwYߑ6 H&R*Ej2زTSΔl<`rܲuUJj1%Բ BI:v:~ΩjǦy1k|TV;zVO~k_y3.ꪫ?,=vБSOwʞ6C`越'> o'>O-v,:LxbQ{駜|}3v;\o>pcHK |.BH"*9\Z|/N]_W+ל|kf=Iyyv/l?L9W>vDpz[,>in1x<\]="{rwW7{h4G.--1 /PЅ)F 6Tf=p4Ї {p8ܷg=vx6cqw|߸G;c3<{y;gg=7iO{?׾ ;=n:ܻ09Y9|H'e Ah];wƛ]YYyӟ~uo:JWvw~~11J-qbNh`S#:9Aie蜏&Q{n[jR:i9KUuS\?Oܱԧ]ڝ],Ke %"BwwSk @ ֺ&FR 'H9ž}1`@@Z|7Ս Z+T333b语ipa2[zmmcGI)y33\m" ph"jEBLEyPxkH\S@NŸ4C`U5Ihc#&EM]fV+Q#p1y9ffh4*"A$$ S:N=ƈ7nnn.5{nՔ {[lyyys._k 4MesdUUjE D "$DBcQ s5fV[@H! *Ф c m/p10fVWW{YфXG´j?tZjQDHY "5!rPMӌEWue(0"3ιQnxb4!ӭ"b 9C p2ڶUJ+Ruv.-O0Fo֙*A_g@o^o.BpFU 9"8e a ѳ BJx(֓I='= ;?DgJ:Gv:qasMC LWV?xC竆$FQ#Vcwު߯kϞ#!*2HҸ2BJLT ssNg#O&Ź,\KEG|#:O7W^cvQ~W__6 rSY) Zt\g9=+ol,\[91s3^D,&뮻=;wMp????ӏqY.w:bK\ڢ&u.vLƶi, ({.l|h/%=YetgfwS(H+++KKK>2??{W_qu]c8+x\ofRMC?\O♏zh4ikkcǏڵk}D7|+_&w37}c}~||.egСC1lC9l: =5MMWU TY Sv.疈lOyS; Q_'W *]S-.,*/_nj4_jxc^7yzѠj\3st護?kʘ޻1v{{sA:tdc O⛹ZJ BfItEVkgZX*#j4PڹcnҸqx,)eiṞck,"יͲG1 F-y*&uZE۝FF):A`fMLoJ+$P"Ck'|}k@[c3A?/eFFT #Kr~qz?[vgmmmv7&k{fFcl9 DNQd4u`k:k ;f@b*uS sV G1~8#\s9raM @ (  "4QJD1Fc)Fi$u|NPs h; @( :8nvUWUmj4lsl#\q,J)FY_W>: >2EIA4`E(e0-RnU٘ZQTkM\̀*!d1Vi[UQxTUņ $r ?F #-BDB^ME%F?evA4y'BZj8l.r;ܰϙ6~RW׬Qm4*2={y1Dhc`ݶR7y& >T@Y{@ Eh| \ACxnWeߘڷ^{?SWg礓GeuUy/ f8ذn[1=}{OmeWwY|/̪l2,@|g6:.FC[Ee`Eu]SY7rS /ܛU`cDɴz}v4{/3^ac+3E;8D= }Z IDAT}(lkuu 2>TUMov/Yʆљg1ׯ}=㙗ڳ?C˿/y.ٳt?g)d_~;gɤ]L&]E3cM>brm"36GmDveBijK+513ygTdB-k ˜E:! [o׼5 ;~MsN8oܽkBZX_߸敯"eY3jGo,+2S? 33ݧ<)(!2DP "jm ( P)cMD1&nIL%(8U'$͂+e|Ӹ|,1UE-2?XGՕ:iϾ!a;R?{v &IjL"Zy:kv{UՌ'>h8&eYZSMng9yn?n޳}21Jt.r5 cuS=vp<ʕ (q["r!P*Ȥ s:x A,X!hO9[ޒ{nwsW^aY"IBIX}SUZFQt>!"y@FSdYVU{߸Ҁl*r[̸?#- gptL{v~v9RDJ6&\|3[ZyMDA$*&)N$ b旅>EѶ*xXՊ"""3V֎KfQb(D^_'ݺ)FG+-vJAiJ ̴!M1Zk ,)hmCt\UUUDEDM#4hT5K4u:6^gbS5jROkD$JRb}-M٠cͻ`}fv1¨'V++Djaa!X=jzx9E+@ZuZ9&j?yᄋ2chHQ䶫[y14NL$1PQ._s ~w^\€ĮEtp%.x.]]!X.B /22 (re|Ud ˭,WdydߔU1ӆF+fá6H+̸?dڅ{rXq}~Kf[>#.וҲc~ˮLM۹}i PCIFIDqiYq`ʼi&LȴքhLF`N]'pfNL  P=+ ju:ym6~p<Oyڥz_le/?uۯ_K P߻.'ǣڝ>Gv'/@/z5=[_V_ҊLU56Hcm!ŅHe2҆C,(c[ݵnD  1bڨLA"3m4T*!o}鋻FctETW1{3>sDdg-krʸkm^0*dT`R 1YD( +څ1ƅWfU˲D$z"@}}Y@P/ KHdۭ| i%7yo̬sltDfYѝ"Aԍ(X6uwM|MYOηjcAb ܱ;ty !TQ"#f qm+*%44F h&5ij'M{3iIvLBL WDVPc홞)q! PhGuSFa42ĩ|(ыC qRO1HH!DnjG lnP+IzP)sw'>uozzk9⛺d 1:WoLWz0ܸwsh*773۞)sns_{hd6&(sy͔a4^jZMmfv~{ˇ[=Z;OַW#*J$$TFє& ̚kFSTHQxяAY" 1բBv?x2㵵5 536 &jCJXo@ȑ1# Rk:'1Xk<%"⽯X*E  %iX@!i"؉0Eg{@H!0B^jF $Q2CL@jmQćH̩"@[ƓI4M_Mof5MܽȎ[6"rZTHƒD$Ӊɤ@.oӪ~qFL] A%r5J!)bBJoL!,̌ [gbu}eqpځ3HWWHIY)D}@d5R@ev"A,R&)EBCftftƤʁK i"2F!Df qJRF$)7bVp!4+ԓ2SZ,ꏆE,D H)nk:7%WP ȈLI!D, P@!ElOiI!$j5A@($l$5Q2d<68e,%Y -tB) IdK,$8IGN E | 10 (LpH zkom+BA&J̜OΫ~Gb/$ ֍ځ7[Gw;-chךpBHsAxn&~+_җlo{l]{Ͼ;a2.kC i#rP!Fmܿ zv}sTd4!4r$N%PEd( HPD((BfFH|!BJ!/;v!VUE%(J&DR}HLVHA!@.hT_}y8Np,˕NkmIie4 D"ABPa1""EFev.̃sAEaД[:˂-pNmtӛx6aRSH$E(|'T'A.R $%8HI@޺ikfYǘ<p-c(͚zz 3TP[mmmݟJ 9}R԰4■&1F@I(b`pt>g}M7rǝ?xի_v?t}zO__qŕ8%pI%/羴}suǏ.ݧ=izؤ馛>yq]w߿qaGLL+a=;۹{Rogg/x5=ޠlFGGIgTJ H@̘G9rts3vUhnx^޹i|o~G]Mw`)A5b@*F WO? T2Lը%HU5Ef Q""@9mC`i^^XBD@FLUU*"En3 i#A7w.!^رeDy _ǜ9(:ΉHMy?}5"("0sZffbҪ8 HT:p,}U4~(2g"M*`UR1JNG MvT%!} &2dXU:BTQ!E6̈́Z D7dls!)(m R'@yi[~& u#D,S|bkwh;NOλ|+GW7VQ+EuJsdZ)BD+ 3VP)DccےK@~z2hRUBjE yE<%,9 0FTIkӼ"s`H*N0<ϷS`֤UYbHYk-[֜cV} Q84%2Ų,֒[E-!ꩀ9J) H" #R9$a1BQpmO\v/=9ovǖ|V99كejPoL ID[bmW{zx6%# `j?kkW>yDs.x׻}ߴ̧z3;~x3>{]e_c>Y?z|.zܿwpWÍ_.\|5/h(N;x{wnn1g?juc?on'j?p'擟 G>qOg277~|%8;;[וJ0wI)Gwmu~Z?_~u>07MPtc)"B@̵up_pι f u]B, R(<(4Xq$uQ|RI_[_)1"|h V"(-51L2t#ᩧblƣhծ!@c@Y D$)F1ZәZ()c1yslH:3u3&xc`iiW;\)R|`O' 8? HB́h"bh*(RmnZ2[p}]ײii""6GE/REi @¤DaJ$kP8ɭ1eJ#RpT@ɸvMժN{K_z7g:ڵ <66Ϣ|BCBe>Y741T܄I"TD)p!:R i:Zkb;"ҙTvd,&`H`J4&۴f16ϵU4u],IXHH <ff`1 6Ǔv΅zuZ(aQ${A)EHSNnZk#壇ӢB4[K BAyl 3osE8 |/{mY`[47o7?//>;o)~k]B }/[n#GuY5ۈsa4ގ]Q=WnLrlu2x\].-HnL!g.D}\ss {Y\?rHQ kM*kA Q#jBF !Yk Ja@2"* vvUZDHdcdP6ֶZ<ϵ:3Q|ekkkyafu]9Wx-FXc,{ӆQct!vˇn;}ū^wkBm;JgT"X\\l &)HʄAB}hD$$=`! S) E$3"Û,!cB6]怄k1JL9 mڂf7 58BL-B<:6֧[6jzSD!n4`0O?߿&sn<Y!M`<ϳl:^%)fOi=  ͖|Fk=dD)L)J/ADB+(e,; JabiOk Q[UU4p2'Id/L;3EN̒nwDT7Y##lٷow}ιv14暀s>Xsw!" Y,P[ˀ(D@Jj&P 9~ycDcLCo>R͇1fkM< S-Gz֎Mmc]D= ҄s`$ k_zQ/8Br~_rБqO}~7|/?Nú)몚W #_{U~^A߼=\r; |y{v;x<~Yyx3/ˏ|uc=Pe &52zViҶכ1*vƘ_}S~\٦P$Dcp2m ݹIU6έxI]E 1eW_Y߳onbYbKIaLJ!i"1p" *BbJ=HD(%HJQ]vcǎn[M?ilzGNi7o( ʦ 3yYRMG?$o-ƚʕ@"ADBta'(&.L[yl_?/C׾-O:I9i| y"ܴz4aaaGhOF"J&!" 0"(4 XI*I.@  D m2Dt1  &<1Y"djְU} @ZKѤ,9˲c~ӷM!"b,B*D&I2/ldD᭓/xfnjE9sKȷCv~hRUUfTэѧBU#P9 r IDATRʇi)DRK4F+@X F%I F37Sv]kzeҨC̀(HQ8fFBa4>3VYUEp> p{פ*V)dL\7R (X" S@Odr4+~_uaMI|iW$z{M,,,hn @ 59 "" s$VZ6kz|>M]d2;;;ם;?h7l>?>_,ܠf7'{3.}UW^qcu|kW2cwZo8㌗]_xKZ]w\oy׼y!5ӛPM @ҙB.027љֆq˷^]rɓ?HAΓNC*c2{EAn/fBԃAZ;n_{훯'n00`$Pd|tK 1ه`*,i(.D%B5 swiww~K){թ4@iRDZP%CyCjƬynl=2*II*˲("אַ Dp5(7V)Àè?:v'c%Tfo~K;v>O<|Ў;>pa~aVDu]FP8u*,ܹ3dEEZVYS;UZ5)M^ט"i HQu}_} }o;ӻTÏoKyk"bUtPb0DBlOOά[{}?;{o ȍ7ᛷ|sfl8|>O+k~;sg֯ݻowcMNٯ8c}ŧ|Yٹi_ؗo>#O ߺenn÷Y|/~RnW]uk/|޽ :ES/߽'ǟpBYzm '89>5l|f׎\^;ۻ?Ӻݮ2(Xv 1AQ7?3 y}Ρ6EkY~v3<mzX7/<CVfys![|yyEg՜9owv.&S];oʻw5\c ^X('!8}m?뮪q!oڸynnn|b,)Xk)1!|!%pD"ɫ Ĵy)*Q` h!Ud/OkFh7)mJC9TZN5)2H<5 cދ0\FAHSFX߯sv5 V 1B+2DvFFNSDDPHY0@Q!;[-UcJc||ﭛٸq#"lذjW1HIkuկE"T*d|j ;} c 4! HA"J=E˴hmBH>d)gitF)%5DB*eղJ;ΦM]31OY5iΝ XKDA1) DDZ7N22km%= HT D@P8(,"u][PV!)J3TJ$ic0P*m8r@2tjU#_ie$tummc(]1f~ǟxɳ^9U#7\~7~=c-/yY5u cTܿG_zezf֨x۫ʺZ7c:C’247;?jډ'#PrgE.z8 Vsz7m=;w<꘣/~ͫ_gʿZW]t7߾wݧؽ?;v4ZUTK+tUUZ.+.ʲ\Ow}ڹ{w|;BV)~Mo~K͛ q󖗝 =ta۞wVu7?ɏ'7l>y^ۿ=>zzGyyxžU@pNa9 c:ɉ?w]яÏ"eOQ+ؽ{jo>O_t?vu|ɷ㏀0+/}7xxjae_۹a׼%g>oǎ9N֭[f/2Ƿ~ݙf^ػw7];S^!F"QB3hk]^"(L( D!ReE mt!E1ms1F >ZN.NDۅGNaNkf` ZIwAOp"~/9澋Ht^Yhupu5s2,JPEv-Rh!!2^q12RCA(wRHKD Ԉ'(wys_tq2j0@@ICD*kHk T4C9PsF*"FȳB`юDQ4Ԁ 26Q5sk-w(0#28B*Щejiiܞ=ݻ, Db #UYvp1$>d H$Eڨ$G2e!(@cQ̋SxIɌC>?JwS{C28H[f Ӌ/'F@yf Ҳa>Gx\nz՚ .Z9 G~s:^o}{wܹiӖwџc_VQ1CU9_D"~>E''Z{*;U9++ݽc%uٯ_"e M]tE!Dnq_?ܝf/;?wٿ'RmC/~+ԏ>Ě׼ҕ^?Y[Q^Nyo|/ٰ~rWܬ_'w~OCfMQzoO/qo?㏿ ox~e?gv]zxg>cL7qgnrC=>wE-//7v=C'I|yQGt?_3O@,*I@ndDd, qbb‵?z7|>u޸aAk׮'⥥|o: ~_)z׮i;V.B t 7|M[6Qw|kݲeUW|v=77We_#z-7x>15[}?+byqRq3;?t]u[n[XX|X JȞC.Ϛ` >fP$2 #0WBA !&|02")LXaVDc!D>e(@;(4֐F("<GE R/$H+I6JPa( *?6>#*ıZ+m",2#8e_A HP1@P+WFjhN\Dӯ-[lܸqnnZn:~.j5C5RbCD#X=w:+ƘX`)O CFBFFcA!ZlS~=GW@Fi~eelZQkԉP)Aࣶ"֭}_|_?<#y؊\%9cH[d@IfE8f$0Di xH $H-W vzzTOÐ0}Nń tPYMִYkE$ ^D'4F7",3E[k8Pt_mYwVsm5j*3#?ӌVg4Fu㦥ݳoyl<+:џn?W<l5 t6z+Z"+];w'Uߍ 5 efY#-a)**9H!ARR?/ Dl6ULe\-=gu|m277Wݻ[Sװ*욙{=Йx WM,؇zʋ>ts(P𸓎>yaG/웿W\v?ij~|s- foo>{_/ʪ?33sUw|=Ďv[h?8I܁ke0! 9P1pj]u;?̯y2^?^s_uwzf ~EK8wiyzD<0=}>w ȧGx䦯|'cǎnaϞ=Ї^}~x'?f?VUv;'_>x715~_sk.N٫fX]^Afk<+8ȉbl ,"*a %  ‘h0%困l2ZLx`fQP@P1D1rāHZNXyH$!$ʳU$iԾp֦h\q?_zk'''2fVQFH5J2ewJHiL1im$HtpJιDna4^a4,K (^@"r+_U# (PD 9$`CU6r+wlo?a[ FPۿMLϬ>OO̐}{gZgA`rVS`D0h@Va,^Q[VOOKqck''"e|58b*.hllʺU*-:cٽLNN{70l;۶ƲFo?}>Na3#!Cց7/𷟳헝B|ٙ/羟69眓eO<g}˲y .+,;3x={}vד_o~ʯGVUڵkxW< YwxoGqQtww쑕>lKʞ X̂ja1^wW>S[n]^(2"o|Y==C7x)%O^\쌷6w;D8l7_ /z5׼替ry*gz=׻Kg-˹bl|R_q9sܧ>}ñǝx; ;=9A)I=uqzz={2[uJ#hEd:C!IgJ, *bzJTHIs$0D& B5E&F' >!TD(%D 1^ D#%JiLTFVH@9&00HjqF`Z/6HX fHZ˲Y4nr4+sWzI>AiJz?qWS3SeY}KIDATRf~~.$bARUbC$R0Cd%TTJ?Q |3텈0@A9^G3tG}c7w~ZV+G  љ(_w{Yg~YkNk2icpǙ3j+(sĶ!J؃R*M^D9WE`UJ9\!,%HybI);bȐ5↤$ {_%G!R_It j,8VxCk3x'ҳ e妋y[ْ=2r R\EgtTXAULV+C_ !,(F[X KM&Db6p@1!F?\-j8o1]󜣓cU_T3l]Y/;[l9dv7;1}gYnG87n[92rWm]駉3˲7^^ݞ;h햷_u/{mj:=8m414J"ANX…soRn=ظaS`7053wv?EQ4[M6o|k޿r=O9s=Nyŗ>׾G~ĞO>v%۹sDz@ygeY67ҫ~Ӈ}lvk|JXCWu\XXUW֮W:+\V5uCb@"PG!9%w(gDY@E#2Zѣ(s {!g4',EHACy3(LD钃eYj,wVUU免7-S?3:F޼;M~[egWd9{Y[mu2,KJD\ Q~gGw\?{sgvLLL,-.{͢_Ya7˕K,  s 0HDM2m?e{)hXcT^_f+Kݢ(~#=vݽ_l-,,4 +kWYmyɪb*zӃS (sY{WB1je'CO4Dd|dfe&_rHKLBR}J8D*ˠ"@(ăJ@.-dHzdM#iz"֤U-lsх= d~H$HR`YZ,Vs_:T=՚ݷ;pyv5ӗ_|yOEQBtfDEZDH:VƘP,!Q_A_&"`ͥ9cDEƚEX, .,,fYfd z| V !i~9R+f(NۀeHX:˲$ Fȋ,mݞO?CkV>8QD(i-2''[BK&## Aei0KEnFn6q? DaMZ1 (^,/JABY 1F휫*˲v]1F2*TjKP0p.(sHgYAާ b""B I$_A0d[ l2` ~$0@kJ1ˉ AF5( J:S"&,HHvaLZkHQ+_E05Dg?G>H#ddE }300[p=@oVUW]RH nt6'.Wqwqף<[imhX%"j"jXu])@a%P`,?%'WDD1aAaAA ccPC)N(@@)RD$B !8E b!N5Hn3T-HgA?e LI+Lz#BmlHØD:P2"ҀY"@`AdHiRX1Xm"JN3쀃8f C$y*F&Buݢ(f&!8% @J،#`+=SB~])ͦ:. !UJLVفhjrRiU2ky?!>Y#=E'I)D1(ҺJ# Xk6+JD8# Ak"灕.~_Dt!J]BE]((j@ tbV[\1`I[Y 1`Q)&yih4rkC9D4 VF F0(t]Hkb>Tۢ>bd"b{#+RmG#*ҀjHqRz( "FB =DS*&"i"0 ?%ƲzrIENDB`ImageVis3D-3.1.0/ImageVis3D/Resources/ImageVis3D.rc0000644000175000017500000000010012320517543021337 0ustar mathieumathieuIDI_ICON1 ICON DISCARDABLE "ImageVis3D.ico"ImageVis3D-3.1.0/ImageVis3D/Resources/icon_256.png0000644000175000017500000026767312320517543021206 0ustar mathieumathieuPNG  IHDR\rf pHYs   OiCCPPhotoshop ICC profilexڝSgTS=BKKoR RB&*! J!QEEȠQ, !{kּ> H3Q5 B.@ $pd!s#~<<+"x M0B\t8K@zB@F&S`cbP-`'{[! eDh;VEX0fK9-0IWfH  0Q){`##xFW<+*x<$9E[-qWW.(I+6aa@.y24x6_-"bbϫp@t~,/;m%h^ uf@Wp~<5j>{-]cK'Xto(hw?G%fIq^D$.Tʳ?D*A, `6B$BB dr`)B(Ͱ*`/@4Qhp.U=pa( Aa!ڈbX#!H$ ɈQ"K5H1RT UH=r9\F;2G1Q= C7F dt1r=6Ыhڏ>C03l0.B8, c˱" VcϱwE 6wB aAHXLXNH $4 7 Q'"K&b21XH,#/{C7$C2'ITFnR#,4H#dk9, +ȅ3![ b@qS(RjJ4e2AURݨT5ZBRQ4u9̓IKhhitݕNWGw Ljg(gwLӋT071oUX**| J&*/Tު UUT^S}FU3S ԖUPSSg;goT?~YYLOCQ_ cx,!k u5&|v*=9C3J3WRf?qtN (~))4L1e\kXHQG6EYAJ'\'GgSSݧ M=:.kDwn^Loy}/TmG X $ <5qo</QC]@Caaᄑ.ȽJtq]zۯ6iܟ4)Y3sCQ? 0k߬~OCOg#/c/Wװwa>>r><72Y_7ȷOo_C#dz%gA[z|!?:eAAA!h쐭!ΑiP~aa~ 'W?pX15wCsDDDޛg1O9-J5*>.j<74?.fYXXIlK9.*6nl {/]py.,:@LN8A*%w% yg"/6шC\*NH*Mz쑼5y$3,幄'L Lݛ:v m2=:1qB!Mggfvˬen/kY- BTZ(*geWf͉9+̳ې7ᒶKW-X潬j9(xoʿܔĹdff-[n ڴ VE/(ۻCɾUUMfeI?m]Nmq#׹=TR+Gw- 6 U#pDy  :v{vg/jBFS[b[O>zG499?rCd&ˮ/~јѡ򗓿m|x31^VwwO| (hSЧc3- cHRMz%u0`:o_FdIDATxwi߇}K'ު[ ;Y$Z/L ڀ 6l%lC2 ðE!Lbwٝع+ܓ wvMψ 5cu > =O=4<'{bO='{bO='{bO='{bO='{bO='{bO='eQ}_=2?'}Sxǝn|{bOG'?&~ 'yx>{< O=O:;qo?{?| }v OjsdwKͦEve 6jp=3S<_ʕ6!++ߤ9?hտJ+ͯ?ߙ1ؚ6%Vi1[ذ)l78}gr62Ovei;;1Hʳϟc-FeLU5Qۈ`-8Bfwջo}bXzIr#%:h <WcG[ذ/4 p"[<@B-P.~t{OLbkQ ,rw D#g {R؁zQ!!UX ,iy;Ķ]|c.B~iJ 4*px4fuMr h``2xzFSl6y*HBB(lm==PhQI-$IBGbL9OUb,fTp #)BA_%=>18<H^8}XxmGޅuRw3\R}._ w ?]p'v4F&=D9RHt8 :B5ڈ*s\1Gx(j"Gb ,Ͱxh̥e_q-+2c's|\8=-Ùї;Z^Z19B_el7bbG3Qx%atzO鏠wq{X39RP |rqc%V I讬31T"{G *P@ Jb1^\ 8d8HR[u,T x){VjJH9AG~=+Y6ُy\ <mz,Mi C|9h/B+O)X][ y -^ W9iZTS&H)@͡=TrL;<8E0]_quRE!MH#)xxN3ADDuT8S"#ߛ xs-_ BH $A@KA="T"BPy(TQU9YRû DV$|~iSt{S6;ly̯0RȆ+_7I5PBPzX%49f<ȹ6bnյ2ѩZ6 xp_G7c٘ptZa AQ89줒g6άoo]Ikq!ƴ <8\^/z^ /ƒG'o `cI^ቘŶlO*Z+fǏ6`Gr]O `+0L[{bzxhT<}aƽa;7( 2n"_x[8 Xh*AJ(2""ffly(rcLUt~^N@˂nN+w%Cdұ?R% Jc"L5)4QT730*+:Oܤ}zFOK7pÂ{4|ə"[S Bnݓ9$ӄF`vVjQR I`: RȆõ(cN8ʸ^x2:&l֭A_Bu ukۉo*eɢ-RAB-(bi6"qzZY^cNvv̝qY:eD-~>o0-?ucKhhTu's_Ϛ~J;Y%=Qҗ4^8s/#2Q#BbCqz'p4nwCHB{\Y8/'圦/lfr벭6-S٠ny7yNr_θq7OA iJM:+Xn3F U2F0C1 ʈR OȀ ڒTҲ}3S-ӽ̽IJ3)Ⱥ?W1*n`{Q%ژ Z(AʊF#b'/h$%["㓧%Ee35w\8s[Ϟ!Y꣍brgrF;d%v1HȪ%/=E2t C ~܂@P%R+=A6zh<>t%yw(NHwԠ}Oo];ϿQ@|&Jlυ|,EU ˆuJ,kͨh6θim .J<ypzķ% r yб !3rZ.E28)i`gEK^Lp^>;S2#>u>Om߻ʵ㔤ABᘾXk6^6 sNe;Ce "S|/hsroG|mag%2[tDAUP9Ih,%I"G|R**-*V3:L ͱ A¦qQ0".3b{h@$0B@UQK9naIz@e-VtƎtp>a'VVpB2$$;2ʿh:*Ȭ!ЪWP3 Yy#9S_]!*MG`JȰH3B#B%. qvYe- lsvNډwN@1[qx"':]G_`G2t]U>Kg "}Wg8V¿4wZ &#LO{V7^̘/tU!)LA!0AW=Bz{#;瞷W|}n2|9{-[qyhlBύ)%7eZ ϒWUAd@#hiI <Ld*# /8?|+$] Cwx =#RDY19ɕ3ުcyiyȓs^@sf.ͩ1[р4-47g5x @J-5&_ UzEdI@h.+YjPq̣.YjyIe%>A #%Գa&'(`t> C Ȁ6\c؄*E:8!qKK"Dxm7qF8>un7= }J;p|a|'O~W/KW7orco4I 8qp+EY vw_Y&Up?X^Sn7jW8h6SbDIR).cqIʶ#ҸEޢ:l5ɟz@ym@ {<7o\ւ@t0= 9Bd+rtPm,C6Җahu{b:VÝw>d1!H>8cZ?X IpTDMÿ';|w\xeKkZ}&D‹Sw_ᷦfOs6g~ډ3%8z@t`!V ^@rM.$U'`p@I2lYW^ſ_ߞ L1Aa dʃG}5~k_# CPh-(UIHH.T=Z̎CWuq#%Ai6 TPu4<WczF;[rP\kp=E}O]c/vrzKr洠apKqqOus&#g>Qܽo' g,,WvTyDr<1S ,Ry5B X_ˈq3 ;s񌞪8 D[=A bRYr)؝9fxdOzᘳqHc6i\>Ex W`r5*m-h$[@zC"xo nbFH-v(ms1" ET Fwkf0 AV'Cſ#x'Gf@celt31R :Zq8| Eqy} _Kҫ;s$@м 6tߺNuͧ?>`[н =SA HZ;+:= :}{WFWӐ[ BTĜZr3ӒVKEF7sZ}JSy_O@#%G>³sQ}K=~nÔߨ^<%6BA7sPF=a!M<٬ҵ$3dбM8wŲ9REYtʦFC q2E618BaIbY6C`eidh i0-nXjY?*-$mMb *GU=U)OWޜ5ix;/gD(_584N)jT{`&=D!vj!$sCqj+Lx UM.?jH ZeH .#>u1.M`K_%x Yya,a %@;vD(޾;6"tl97K **Ջ_kPrB9PObY _VǬ I6 uWNpEE+z<,w\k=aIcلnr Ev9kz\iU|HYcPes  G=QDɰh<3q{ *vdB< Dݪ}̬2ˊK݂嵚q{h3I' TJwмDnr $M!xkZKx[⬥zHJ)QQ"Ebe'KN69`2dtMcA;D&pDTm($O-x>랏L o k$W@--ؕ :6^k3/ʾ" Ϳ ^dkC"rOC.!m@Y:I!\0`f3GSR*#}1 a(ry~:?VLS KmO &:i܃;=*`o}EӃo%V-J 𞽡 xMʖ'`<g4ciz6PTx)1=C>V0-+|P6 @ыpX:PzA G$o9o9Xsy\]WpZt 65CbmU4ڟ̙|_pzhNҒ#6_{eGs>W.s%7sg(N=# &pOi5^?TvhB Uhl\hZ&l#tp0! a{u e#( U$$&-HEB_Y]s)2ֈ[e>LG{^#oż=,gK#yZK!:UعPJ0 5qD1o%ܚ$Z|k(؏6(yY7N+Oq瀯.m¹cE>±ՉHK c_GpZD+"mh,;< @PuOltԲիGcK[Cͷ_KΒ٧gƷvE8 5k2cg yοkmRWA-EHTI{CVXMRoxeϳ3D//eC0_a8_wnZGAԅFB~ITKyIgXst=#*x}y_S?N3;(1/qg8[+?˩ %zF N:RG7,ABxj8x/GԜ5w` ؘ0/sŒ=|ķ5}6s9ſozgu?ѵJ{#z3Z;nă`?xgzzꥒx#zۡ\pvQ_@:nE^ ` O Vk ~;rV3f<*?y͂< ԅ7/H58%AIRiLz.S[obM!g{!5yXλ<9_(&` As -XT\Xar(ƂbA?","4Qw{);q8.C塩 A<.|[!ofkixej< ';f = &L`J#)Q=*Ea-S)P XQV/фM3UŝZRy"} /AOyrpyTO\n3>Q3y]N ɺƹUk(U{%$HЏ$7;NW!-qkQx˸Qds55>c 䀘u/ZCV_X%P}HH, 1'~>L=bz/_1@NC*;˝:|VЊJ.1V uK_/ f^zZJ#))Y`'c҉0%xi?ŘpO6xk:|l*UXkym,1^Qz_7Su XBW jv!(Oj07 =߾t"w`܅ú{8h 5kUE{_q^*agW%#KXa9t"dX-͛>K:Sh 2q$!_1J$]/Ȓ%'豍jL`)2|q{n%]72BxϒMVegfo|<SR?S~tkRT w6WI=(ZhpfK[n :U1JpSZl=58,{\Oqҹ?3bTϐ\H*@П`c$(NB ǖxC,0h`KpK0 @/+gyv S9,Ux>:¦0JA g9Ӫ'TmAFɐ{g? YTrn3W_-ݼ˥_Zc|뻞^(驂X|gٯ<נvគzitg0½`xn $ nmx0'\YVW) 8N!79p;wÑd+[I\m͗,M Nk\p-?#8&SE9 ݕf+"/QЍ%k)cɺ1=īLLAϟQ\T<-#2-eh&+nʋ?9Sѐf^i9'>>t:Hݤ< D1Yr<9j٤cqo-)-P\<ƽXˁ\o !"NyJQ{px59K6KI^x#m 6ظ7 qdd TDNO@ 0AcOKց Ao]i7% sL悃tӅv!`IvOܗ vU\xkV7ِG=|#F_[ߤ)32< wp gZ8pRr{ȼ:F@`:^=w 3JlSb[6J:Vqf0 ߇#+qRҕ,[|{gJXN-t?cؾL*K=OʪӴĉז`!pP)$&8JPV(GX)lՂiE%>4t ǟ=kyg۠mTǜ7dnS>#9Usg匛R8d%g>9}VD! \*0YL&ڴ.[[]z.Ffmiu2&cp>F7[7g\S:8![K98xdω~b@A{H'ǚuZX-\i Qzd]|!zt8A=$tn $>:N"I{sKGu 0 ʰLguH*<3tW -AB/hKȼ@KXi:db4ln[?M9-90 Ga{Y/\ɩ7G:Cf.RZL!D)$)P*@R!aMSO2R[w褪G ՆU%S_a9x 0R6ü–HeSz:gax~qOfǼ-7אhvJHxJl- TD5hAwZN+1tJ$D]Y0:U8{RBQд ѥ䂅CL:4_}{J['c>4hEk"1y Ywwƨ3Cs%/]G3ք'Sʩf":J-8 d!I4Z%n9{ܫ<^,!]0Eqm0#fuRڛFsO .CzQwQМh=pJ&Hak!PF e pA^;R5Yc>A*| Bu5uAJtLL3(;/Ap.G/կަX1N1-O/*f\h*҈zJjcw䕡)_EK& ~@qiA:*IT J o WB Yiw'59D#hK؟X#/ D&TiZ*̓ 㜝Ȝ`sCye|&UTMЀ=*gPd[cB!Ҁפ\VP)A $BJd2ZU8t!YJ%/%FJ=Sq(XٴwY-o{gtk`HIci 2qc@ztMm8[~0H_չWQM#[q[\A,__Ɲ)ENAtDԉ|BAgGB*UxK`cӃ0vZ GZ*r}; =䕎5g/oJx x}AZ˰& ׆7qܝY2OLhkPޱ7samV=;t_c?ʵ7vYkOx|򳬞Y_:n 7*OG{w̭%jx.\l~K,xHejYdjrRa<~Λpe >+ۿ}LдRLbs"g.)&7_A3\UULz21*wxh-q4)ȝXAZ| :!KҒ`WՌx0KYU)UiFsKi<~Z+n)Knw<e|T 84_o*XR*rE@c"o[%AQKǧ6dݕn3Q#UBM~Ȫvwg=Οlp wit IpwBϯzL'rD./CPmW}>4%ą ߏJNQ\ )6% A~$j\nHUZި !ў-]>zTw) !8:O$0Tg($K!#D [̙)VPE䥀!S38+;oo{?ty+G8uko q\Y҂YQo4xz0&+<dzp\Sڍ)/ $&9+)N_}X@K'PqƱW\p̃QJ Ȅ~xoRpl#'x8&F h ƥG8Q^344 b`V3s>Q*ƵÈg퐿w(=(%V"h.I%H^> |xX+YpN` { A6Td&Hf5.EWG3@Tz޿Og # ʏx#z(k7xv~ NX@Sb,~G _xo! -n!(}9:>MZ+%kơɜ$AlvxT_'h.H3ڞ`3bzو%{2-afXF"!~V-RjF,'ucS|%}[ _eȯPh/A;tQ"Ug˳J{JG!ǵ(Yk!&=CZDJ$0tW%{n3+c͈ H/d MC'>00PC)vƩ'LJ4mɤtB`Tqs4†TΑ4WSf^ιjro`'-n%oHNoxа0ct~<cWw]e|GVst#ɍw+lҞYC 1%u Lj;xK" hQ8_BܣvCZBT#ji4 lyY2&,ivgbO-c *yEQ7 #,@gjUERە).c h5bq,ec "8wT(1l*H$ )Rzhj;`G%M2%2sBhd1"Ap2wH3A9›%h!9fnBRZ(M@@AS!1BHI7 $,",cVfLꑌXpb6c'U8c9j>@hVYiqZLq7ۗޘkOy W%ysz`ze 'Z0N0* ,qX vWc!Ɔ3WZr^l6};ȹZ$Ú3 x\)"IbA38:x2z[ˬpF e/3DA$d&sg6 nﶙ"(M}[Yx*=>׻ueZ+ys&$Ox-h*1O :ZgolL4B8R d&U֋;##SCJV#𹠜 V .s86t Z;h1G]ϑ_ wFрXr`o[~)YTĕsx34#ޟ'zżnc]x&?xfQa ;"@3/QhH%H)Z֒qƒ%Q^bӣL!G*Ynw8hoI|:a0;=^`>Sk{rd VuuJPTQ7y8|?=ĶADMr_JL@#fXARPU7QlOr'td9h4>,V P|S,_s9d;5 "#z-mݣTaeFSG: & AerN#bccXm &JZDZ$^p6'nC:;F+ cyNt,(c12'Z0KaV 9o >dBPB0BBe43:} Ág%~@ܤۂwG9Y #rr,4ZR{VNH3OytnH[[OVz`b8>0Td<Ӭg䅥(5e1w916yV+TsxDMnsϬ! Hs()ʑzOiW<@Cb;;%/Xvwߣ( }㼄L7N9y:KK\~i䋴,uo 1;BM@/"iG ʞDy %/0@ZfnA-.,Ƒ]Ot~3--R)0&d hzO;X)"jp82r.[}8֘Ǥ1wwFht>xq.4u8:cTujsAzҊ cDrX8V#C"ZKN'T̏%3H8m%ts[s dLC2]p$cAԪĕ$F,u'8 Aԅnࠂ~kF:`h9{d!!18 #htXtBiɵ=XrצҤn얼ܭX9,5qF$1{:+fcpi8ƖS1?uELsn{=tv #mP蚛@ɚ't#q\(TY }_˯'RVENvuz턨Jy+%iI "D3A7:[`'jFJQْiG *(9WH{U,Ĺš*$ JzVLaթJ aY{F[ÔwǬ3@?@ 9w՝w7yѐ NE e,4AFctCFc `ZY@I$,gM#4"<鼢0#a0+ $zfަl!pB0uPJI;"TQ6Aɽ<BL&Y]QN}>`v_f6;"@! x`박Zi`IBP $!JtmA(`-)&,즲C)S(}5Wb|ZqzIrouK#H/7􊌭E$f9]G =9jEQсgwޫ;\bŕ8f<`2O0xURBI'?P <)0yOh*S*}sHоgKđ҂=cOKQӳR_\^ߗL S!Jr F4czccl^(JNJ,i˔R3:T Ɩ$D G >ik(;M-1AezqxE( i)6 Kg`ha:l4ƶ՘8`=j ϑ\ yɤPL؃(lպ4[KP5R3yY^oe)۷>8ya~ w^ vE_t5-^xzϊtpnąo!=/-osX)J;:so8b9Ӂ:%5D*9Xnzw}F6O~ dC2N-L3G&:"ebHu(Qd2' L+xӞM'OeMQ% =?OS$Q34hOYJ/H9GҎ?.BI:MFjWx%eO=]Ƣ'юf +UCs;~b,r pôBłsˎe,E:q$I:mz6VS6x"px80 eR"LB"Xs=m._JM94 澯a/ dء#̭ p< keν;88:O,IEn*v)VŋjB QGB.F~Bd}3sƷ ó;B*COz fCO7"ohଟsݨR0w,k{s}h%CBA_i`gdKbZwgv<[ o#OiIRc{<(򌧫Q9kJG! ^J ^WЉa{ϓx6.@^=PBG)/len["LbAHX.C*^1b0|8(#rhK9s P >І~0iGB8h4hwJOY>wUG+D(^ffSo Mj|F[gKG2=l-?sb<зɓfi2cW:KQ)N*Ij[>IgVTm}֚VL6)z[>R$Mcr'G\N#')# BͻwHBqVҨ3)a:#u]'x?dXr%O=DK8J4g&/|w >G(=RZg >~GyEG}v[06*Afa.+N*rxzS*=rXc)X#b:]c*iqA9KdmZW0|&pcc}=ưbxE3Ւd-ot^2)IGd:\d]lO*F Ќjb<K eDZFтULH*qe9G֞ Og_zfQιKsjKce}$ :Q!ḷ}pH)KyFuTg7i5rdt~d"Km[r4`%sB"PRz}Z6gΝN٠m`*1Y^N[B *CEζlfހ[;>7 qja&0S⫝̸ j6C ]-[ɘCz\i)3ㄠFڀ^PcF!0.vgsu-eMatL=NI 8㘎 ׆u{LھڊScG!'!1UF {̲ 5kвuN)ꃔjt \ CU9-ϧT:T%XP0xDA)=FU'|; %Mz~z丸+t(lYhQwdeADGb !(`!Bp MKq{8G C [\j9{޺N*^\ϬqT2 jDd3d;%>SS_e7sī>+L2kt-ڽM Q8谮&="|}$u˸js.^)x0P㜇2'69J $9wIypClp\Et"|4#"D9@ᅨOPNi V +nQVRG'd`W,ba`FCjk ֤U_ݳ"Xٌ9tc,FɌkVyd..FBW2Kn sӹ'C8%#TsB["5f),eT|!@ˊVyA i9AS˞o"&ZT9)8zQH:Cn룸TT@D>t*  K lT$$/ a2\\d8,*DUq+\N2VXQK4 # rg?fy'{Z߰1y̡ffJڒږ`4 =\Oum _؀/v%X,dwQbXʬ8I7-G4݃Tm m/pp{ 780H#BեLȿY Gʵ .2Ԁ γR%/2aQޒN<8,*M l(\q6Qcl0A( cBR %̫4{Yqf;Ū]ns %O?C_]~au^p堁$H 3 jK_Q*G°I_dC,<əAYQS8bp"eY]k7TsÏ&۹gƘaQn(P)e?Ot\͏[nSbfj;kn> l׹~ifɝJFn߹ͷMn߹ >Bwl gQiZ6.&&I%} >EBGf Jk$QOD $c5׈ƴf -tQѨtAiH#uT(&  aE]vo `g/1v:_%a@ {_1*DJX ;_5~Gx|hHU&!HU䐏 Mf8jN)Om"mRhi.L #0o:U˵`yn9=OYޅi4,ڌ^%偲wGH؜/~;'/šcб<>rujZ]GG$BQCa'ʼV5P-B2`"\B W "q}jjjE+61Ҩ' O GWg/>;G^1\lGłc/Y!NW?a]Ĩ;b`⺖jqB}[k=%Ʉ/d6vZn8z~1??[T$Ǫő*$aFI>Iqt I~K^I >zi@U)y:RJHo - &M(FD7%# 1Es?pȯ~9_޽[7g.SJg2X(U ]#^`E: ea!@Vd,_ih:ՙgayPUf“gҦ"e,p}֪eE9&b[^)33+2E=Í{p_Ssُ >?za:/6 z"dySd-ScK=k!WTܹ ׇ|8bRӬ KFD: Qez:c8j塚2ɒɊe_{µiFn;l\K= }cTc.i.ѧGL lWx=ן`tw?^B1|S:&f4OΦG矰m:&1Ũ9>\=KO1`L%eOJ:r2rQbf)so`GhL8O']SuzoPC 4{@{ȉ> *#~h$#zјg*Vfa%uCkIzGô$F#YduLs[xgYy}4Aj Q(<]P95&ELelet+,N떚F+p |xp}L?asUK>*#6͏9C 1GD8^VF '5?_.c0S5ՂyS>ж[:рqF T KV  ^t-6#XdhzDMQTWUBYFg ol/*1_oіo5˥[7[~fJ$@(Gqd[3 ڏ ІUVaU #Xo{vAϕ$O<* xZ]/m;.W¼R,˵0*NSv2E2\SΞ S~ٴ9ߜjV=cẔSS 󌳴/E; KZ(dfA[[uo\z( ưuUɌaRD"b-rWpS9e 2ö"_-W2vCZ:`oBT…"hXuٖG-& gh uíR(a8kYCJo#S44bLڬi늶iBC+]!2TV#8 [-qmgo|\DS..^bQ TO4шqADL>_@18^yMRGlDt35ra cua毾z-߾NJY v4H(g,(UN t0zJDFRr 0-|&Z>mM`,Iin"R 0FwKȝAѳڃCVXVêWJCN-NC 0ɲ՝ ]xP^-a_oBr#ӹQw]{e5BaC.ݲs#6^ Ug5]:uU5p9H{r Fb`14]Ǟ1?;m*(c \ /I,Rڠd+v+َ 5aYn4bROaV4vc.>Bf$?P`#%ԉ(q.et.' 29vK bxN@g!4Yڑ7-lgr^Q!)ʉ%PaCiBaQ0FixƵɐ). ^.]t dM7!HхGjyL#ϯ[gh Z$Kn>k_1Ԏ0Qnr gȥCpXmA5`!5_8p9OZ-.^C& $=GCS}!!b0FEFN~0KZJ:~(&oUK lGXxxA6Ld!߂(((KtKfʰtLvk6[fγm=eW*6Д3Lg Yκ(gc gwTz[q2'FϠSnp KѦ"V+4 T*B:UFִن[q`,bui `b >rBSptBSua5=@' s*( 8cqQzz6v䬱,Slt<ڍƳ]v:HZwkՖY2u)cGVG/a9ڳQy]jh?8t\n$KWIjUZP[)1K6&K ("]%D"ѷxiCe!xM¢ċcEgOßtT:ك [įlb ~u>/h?^k1ҁ1;|& jƥ )lgBiw1+ɱ|d˟ڀˆS/sظt:i(xY'Vd txvg30+[eV/sRoGwJ{*(kO]DL"QFWl&aiFY^ `gq+jPW EBzY6X(QXت2Pbi:Dl6J! iQX)Y=F0,R7E 0F5M52-hB taD9h͐Ç|8y`4mnY rPa$Et96߼7jgݐ|c1br 6BLX,5 j\N4TKF0%^ !&b9"HPfZ h&>'B ř Y64AmD $'!bBnHGN`y~/h b|;bnAP}z,&&C% E̟ oz)4+&L-_eaP$\;F)6OZ2IE9R-hݦbQ#O3d GK˅pg dQ ;L$ᴦl+r2 7-+ *[VsauMq- . vLʠU5Dٶi3r`ږeHB#Є~- 7-ck FbЯ A6(0`7i+4#ew)$>PׂoB$ W2.yM"-.|Wŵΐ̥%Dݱf2fo)S qSbSruyϞg/[2~z"ҜG룆__R~j[#В$dQ#>/jJ;&b2 `CG4 :g2R) m/xy7GC>zc>2KV=#B2Isجd"wƁv3Z7khs0_oy|h"\n=<<*ܽ+_+Ck;..!k`vM&.‹y`ꖃ"!Zl\"E.ddSd*(i),i BHYf:1N#u6wstj9_(ێίYx"Mc7J ix8Gۅ]ڐ)洆+6MK-Y>HzwbS6ܸulg( TBn-Ufil^h Z>[+ޙ2sc.'K1uHqJ;3M-k21ƤtWZ;Ԁҷ 1m2">F\H] P\J L¸i3ZlD )0bmbjGU5lnilt{jh[ &II~/ ĈDU1>]>572~~phͰ,4MӾ0F9tm&Q"@'ȉnH0>f!ȬƬdo(ƖЭu^ A^ AP HuFܵLr%tk߀_A{u83Dp02zĢ'b4ن@C77 ֱ~%yxuY1:.L֊[6ܸG{c>ӍĥJ |ioL97$(j /O,g2.e lYd o?GFYWyZ1T%PǴYpMtk!i!HΣ(}ŎhdhTa%h:Xqd&V, 'g0Z ǍB蘄D!:²6Lh]U̬Z*傇1bc3mvx|ϹV.<~~^*gBRpa Gl^AV_?Qd4jc{ 9&zj䉷 ".CGQt!cb9B0X1#Y1~| \E(JҬ> #&Q0>i]H{-vq?ϾP1]6]400&:#G1нXCX"1r?U>}1IBբGg S2õjݐ"+#/iL|n[:rp#ԫ-]s8p+lB pQ܂*2("ޓaQ*,Գ`C)=DhP4ڴD!R2j"f!rryE`}DO qm6]#y:"uPhэa6Tlz .Bu1:1hCRq+"y "\4gxrLE`uӏ%^<sEn+lSgڌ_,y"{G/AQJ TΡeAcVRD(5`]"t1qɠ(8!B{24V7pSX4mLy|x6A &՟#MpGR11\b;H $ *Ok-REɈYsd!Ɉ$/!FUMbI|} txxT`e -M6Ik$eIM `-C[=ni[&`Rh෉71c)B`]EHր]^ڂˊ)|Z{8_wӞ ~Jzk/rpZEi"%r`gHp 1z 7mQt ş+_.+K2QeREEϮ<[0SmZ0Y9&m4*:(]T\PW Q3dV8kBZcIV?yۥ[(4pSxe$c63lڎ Pu赲؅sބ 6&[Mvf/pPfjf2I:e0m[c1J0]Zn1J\4UfI7JG":/ lmR˴ЙZCljkZ'pypӓݲߺ)Wf3;p,3pa M=LJ'<(O_15 &گŪQF$Jl#j~TAC 4z C5C b#H$bK皆#.(˜bκL!4=6J;Ho8 _2RlNED"0?Tخoszk=Tk|ʾpyN"xtSE3Pju5W^ie"kxpy:TL[2l՚L`e\;cxw&L`@+͚I1`8|r%w:#Y) 7Py8hh<(`&0om7D8P..`߀fϐz= S2;꒶h}yC>](n@UV? _" |AblcȒ$F0<|}o?H5qDW{r1Ve..|OFo'LJ4kRi3aegLIԨ2( ,2pܡڷm`uX΅`,=a)}j+||UNuԍr8o|ذVpK˖a/pP];8SGx|XnX(rdCO7TFSrXbI}? Z``! &5D& FL@nK] fCb: qlr4t2#M WZ:SO?R` 0_nG#B"*whw%j$lr?JǔD=\Y Tt[bbK֔ˆ]# La`)awE]=MchZ)&FFl66UM0+s&Y[T,v\a2p<7@gʎ1l 0_B=M)&ʑh7oistx*ӴI&anT9i<&Z(ÝHd )+AE:lL2r}"Ֆ)n]G˓8=8P0ȈStfC{Q>rٽI6 ta^|S6ԞOǘ1=* O\V65ysPĦ5HDÈI@%1MbNTg#`rȦP^t tph=lR\@  bWڽoqѪ1bU\u<{z@#V#khd3B'/9Yy9Y(mP0vpUyJ1"aӱybn>~r6,6I#tVXhKSgtPࡃc05x  SX&"LHF6u$CƛBT Py0+LɳIbƂהշR[;[m=ܽ<7dy_l74;5t+>;Qr$&⟈A} QP!b1~ N NBW Q/JdD4jsL^>aC[vg:&B f|ȣ&Qޘ^}Xb~h[mDIs.QKl'?ӭ܄.=jL "i`tFt_! l/^22ـQ8;.ٶɪc0N&~rl  PrC 'GDV8\*߸$[0 PN9Pq^pp4Ye!ui:NC" o.Ő_΁3Qr 4Kxu2+)qx_ '[pIٌ۠`3wư 'SETD@0c78ޝ16DXp, \,E[ChjM~mRʝrzG->J#vV1a?Gі,q.@k/~`C_r1nWV(<])}Nnsrch*M%>ߦ 0!aG2<\(Gkȭ&~kSC xc x]ë͆I!4mऍ\.[ۊqb|#3̓`oL{C/N.|sV';:eBjk?(ɍUc 1US5b/2~Ztݯ$Bm"܈k薨uHhl9^|1&K' j[q2(-a9Oՠ5͊-) .]4)XwC1uί**oa%) z樊 &y`qns8iHP/ B]gA*1v;SuI|ZQBI BW2Ȅ:B4\y2(Vtx{ِk!}v-Up\PrPS%@_ل7t]64mJiP-P61R^ܜR_\6m ~ݑPDxy ke"H Eg{ ]d N_<%n:a5d~/ǿw&XV#-o;[aAn`edw۷[Cהg~vUZx>h\7m_ V4~?}ԗB̲DY#~i8){ H#ž~l}x&pGN,q0* 3rm9>#kN9[u8Uͽوio;j)R;M\dp/}2%Q {v5U햗Kf0 oM3>> 4M699 :nRu3a2CUh'Mo#1"]ːʸ*B(oiJe'G ZMλZ8(`eu&S/\l`r3cے`Q A 5Hn^6Wklj1툛lQe 'z=~)c Q3CccĀkL6WuYڟ"Ѥ7hH+9vܾ uMe壏>歛yG;:m0NY]5C} Es %hg3M &FbHu^2d2{?DO2X>$1=QMO#t| Ylu&A6珏@aa&?+@SHL.tGF2_,:qṣ9FrLr!Jgp(Ny 2^^^S-Ux͡06@h1̱JVxv2xXym1[ƎrpK0.a80앉`BlɌ] [p"xFNYAK#w d-W}mdP$ jP%W;_Ů<;d!y1YҌYGk t{//T'Zy2ՖKcq,خE\K2 ocDVߚj[M䓗cl29[ QNɍy:X]^p~u%?L16|LXug/\cvdғ|47v z*_ /P⦾Nv2L@$=ғE$$E+19 ֑IR҇=+Ȭa,_?KyA\x>ňo%*t^S2\h ۨ#4u/YB0-_ǖiг'<]\ȩ`7ZP е` :‰oxqVV|pn7MUX`.S0bpoGɐN,Դێ)2^0}IϭÁ*X(B %x`217߳ʻ#/"^-Yp Q3m"cZɻ_ l> =޻ 8<:cOO["}Wۢ}wPyd8v䙏)n]lpa'951 v4MA^^ % Ds &tTFYtLmퟵMc}Ŝ۸p]qt|R,| eﱃq)-Js+ԙ!%|717Ւ2*"YRy#=m?)6̾aGQU;ӴݲV?J&0XG^4~K@Y̤ϡ k|GJM#˵ ܜFbd!ͼ lQXG˜i,0Ǟ[_[jϹ[՘3vWϘ̮?rx6.|eeD^y5^=yMgkΧ(6=^yWJWI"qk!3B&!x6r08gf0MEtMc$Ƙ(!MPHetwAPﳾGGVU&]>>"~{t!"ñ['O!m"k{C#ـMy6H^uiHt`L,V]ul?ɸnte)wE篹#OcV!,rȧ =i30؃n#t۝`h=ы-6&] [g",ldBpBwϫ)7vܢݜv|+$"+ldFc`k M!S^շCM(Fz[1_g/*ptنY$c X6 Dڰ;Qb+|i70,,<;e|:O !lz|M%.Ka 41u ޥKL^Qd+fVMJM`E eHK4J` _z>_PvJ01dXKۥ(g 2;2gw7͜别O~%ͻވ:'n'6G/y;<y5mΒeI& = } WiZ}|z"Z3>;.MǺkigtQaQyϪ}IO04zFE~Fқ}ha@N}!;2%a>%12r]ԣ'* |cMnC={E!U+щ5 =ՆzaXRdLg#?~L°4|m!Cf\Ŋ)񟿚2a!P6 M׿]DON\NsjWHw%W$Q( ۪JAYAZDGҶIPBRS~Gȋ0ǩB _˺3ч_?;{ lQH=H×\uh>AgU NYۑ|el'[aʳ5Oe & _]&L,(`͐ȔRM$Mې࠱pwuE !̕W eFi")F]T hcJ1W)~e#"kYglCшu4D?ɀVp [3##p~jP9_n9#޿hwGB- +l335z!"=\.̘h\zdIA|D] Y0hCތ7n ŐvW9^@̇`Τ$aai?'KC9тLНgs ao|gpvg.6&L]C툼>+rq}:K#bx/.?ԛs^D`6Gh~g}|7u]YKn ,Z՜>|PAGZ4l]rij |y_ȴ-5046xoc~ޤWE1[YVPUʤܚT. ߇p gKe05d~U58X~VYYR8rr°:~ussO]IWaM#EzfFL65Dcq\KɊt %o?G[ېZ(gu>V# bM/o'b1=~F[bDbԳE q9aP^a6#I7Ώӟ Z6WWm場U L9o^rW唯ܹ 9 \b^42 FSQ=:KnG/ѝyO Q"+kS6`|SKzqγO>! !:~!*uDPSh䨝 ^ 6 -?wtId3 x-dY2>2EBD?J)麞޳S(YbyIaJ )xЛ{ܹo~7^r/࿓eFD=Q gfM:d!V-9;#EmEn;vG.p}}a ][>V]T)$L 6S: lQH1ICDĐ.')}uĸHOL^KIO>sCSxL c #4觿 Ͽw;pr 6ij'bQ%OŚHMPqڠRcǰHğo}W~ ^<Ƌ O^KP#nȖ d 48QSMfT[f%'2ճW*s,: u\(,4!6H:5uJƖe'=Jy p0_DQ =P0TzaPI?oMQN"]%kqOŹ֑%^ qsVK +tޣZM=4g_xmUTIN %2M2/3dBb;"KK0~Wm ?I`#.)Ԥ Kui2::I̦7A,5YiI퀺!]1,z}t4083?"[_"#wôE]/ C?d|kq=mr?O'$G!`<[fhܽ}"t|`o0iA|rtg@lנ piFMAqЉݽ6TN.T"q(Whavl|F&R5Ve8-bd9;ds]5HG$/ o߁!X^/Wg rkA$lGj`0A㵀(\Pxpzeyz99TWB9\TD22e`wێM9Hb錇"m/qG ?h%6݌F!`b\QNHbVSAC37%PWU Jf 2WiW'h ,j`})WD,I[ސM{#LR3KcHiLGc1cYй"M  t 4 oݦWi`!?U@9d{+3>WX-Sf>Ie*Y25;E`[+nNo{͙0bxU ;E#Ƚce_Ωi\YF{Oұ"c=oɐU9Y$eFE .`Y9`2u:06p ȟY>}mؒGTmF'=aq&Һw?Y6|fb`-mKIwϷ[)>8KtMǗ`D+&$X1X(9Cg s}'.b5 8) buB{EA< =]6"v2\bHnNWy8F ӠX.Ss?+4%&E!e#7S‡I2ҐxQg~98:RT2K9Gz'rfհ^u̻^=ţssk"&Ie~9fZ +&MIp ۧnAH @,1 h3IRg)D1E !vL*D3B)j LАE &sH;Tcgذ")`1 # fR RhD?1[9m1(6Ajp5pR4&G'LnVlUӱ3**vTPfK6a@en"I=[0 k+{`e G-uBR> h-Hacn9_nQ!h,Q>4WpLޚ ejqy4w3;ȭ@+[aJp\HM5Fmn퀣y=׏6L >gDfp7XNնgD#¸(9 z&`:c_pXָBvcd,hALD25 @Az? pWF3ܼGlIRK;,I4y#NYMSَ QS2!#YZ0b1uV,Fl$ Ux9]|4-Xt=C)bGyvHQMrA)̢&)9y^#.S<쏳z"Mbtܺ=z2R-:LRx.T( "(݌9{@ s0e4EX'n_w5Lnܸr/yӞ >yijS}m5F6|N=e9f"۲a-"Tu昋|q9ڏ#p1H5Gf9{,&!WIQ_B#%6lJ/;2 z II)r-ǔII!l =T@&JX ԣơb0~glw[On Ѕ<v1qk#Kp$]B^%d+E|e|1[Ab+H`܄$ J5 #CJQ=eWL5]O{<'AocjF1\#C4y131|u3&5x6Rpf+\9w=%BܵHɔbbĔ6$T1܀*֢D P7m)a2XCb!eK!Pݤ k( ]Ys0Z'ӎTҫasmy|!(41[WiG֍*bYJkI03_& lмHIH#Î$/܄8D RlgH.t F{\ԗf  !hywF5U n[ÍRh-G೷p\mlе D .pA;8o-?zi2u5?7h6~b@ﬡpʪ7Sl0NL~ud5CZ$7T d*]Ah1aIT!2aRQk[T5Rv#PmOIttwˮն cbR *>&w/HM r(eR[eN3bcd:#5GĢ$}*Y1dCta ϷPR7+RI$!o,??]s3\p1QDFb8xͻ^Xij%|c~?܂{q% JX-+p8qtGFqEFhCb2m]"X>x% Ua4c3J)=#QTJl<#n 9O`>8O+jgpfe|v`r ?eQa%0Q UjȫjD#L29B$ҔHVH'80~e^S58_0T,))B{,4;VHH@1y] vAuRjk\>+f#8nMՀ".@Ś+ #[Q"!Hؗɭ2lUw7h_cmTLp mwPBH}r'`%,I1>*jG0G59Fq{F/޸:+KJq԰I mn{WW+˾(GL߽ _ g~ol3>s+DxȆQb>hƓ"}*nps"|PZLQ.%]$Aٶ9U K8ļrFWgK)c8e(%xr$t"L$𕑣(߾x*5 1bh›gكw}47X|]GZ/blB*kbWfz`罰DCb˼g - d(I#6 TUuc [$_Q(pbrllq dk5u#WV2JQe(}*b( Pf:%ǜI$RX@wNt%1.3V,E5H&09$F^Iu8Ƭl|6U>`PFU۔B[؟L_K8 RB2͢'*qGF}P`w;u 7G|gGZOkV]8.^Ϣo#%&t#g 3rh(OAypK7C\9w+bX[bG77wϟjnghQ;4,d-ޅGX9yְD&?p7^㭿ez4μ2v 9ygbX[&p cy8't}DJ=62[7 F6MF'O>s6~Dz֑bĩzAG8@٪qgc3[p6stp 붡n I.v3r;5H=#kb\m6~1>BEh0}K49DSȹu$$7BݔdGYe{0'hp-5k?0^[kSNa.yZ~51&<|i~OjgF4cRqjD[LfTX|#>TzQN-z-E@АD# L]F} TN) \% bYX(&yw$_?%\o2&Rcl` T٢6x&V@ZxxO܂tҡ uܱ76p[R'e(ς, W1jp;e 1NX8WPZA#\Iyv5ᆫ{&w u`c8JQ[*{7]zniA10ЮzcpVOy4xh'#>:< ܢW.1ې_m0c#Jɜ /^{&qǢn6#%6y&#} fd^r8/i ֶ`?u _zk +4F. ْrmnߺ݇C̨G/x3B"vnL,f%EQQVS}ss VX^9ּ82QN~KHa;(9B4s )n@&#HTZRº#W0g%/l-i.bKC}Kzf5o?'0y%"oy+qvMHmA J,Eڨ<;Q~~pbPs?\%jwJkE"uP"~>\B]S.6$sT)m`Fn}aSp_NO WđREW< ׂN"}фD7Nږ"&PYN*}?9w&ɓpB%eaGBCQY,ͧSfUrSBSBd0iL5 9y?St#@zb1!5SoKcc&ܹ PV-+ٙ89 J Q jekRfnq|5,9yx:}w?"D9kbݏ>`[RĄdǎY rcz6־N391Z$ƟaS^#'옿~s/>r86l A(ܬ&5f?~XM̝EcW6[x]1Ȥ2UPxg>ݿ6 ۏhm,GPׂҢL51aZ$RBQ(RuFw9ذ#,Dk@+>a5͟}!`I}ejG#MK^+1{eL+\!=iȼ|!b|j3Cg2=wȠ@&t 7&) P'Oj+ z?zMq9{0@@`gGteǾ*sUڞpPx9 RG҂GMd(Lt傫k꺦k+Dfk nGB sT JK#zH4"c(CZUڶqwkIA!`~* ?{Vа?_z+&Ɩ Uiy%EX'%Nj2~a^G޻{4C[Ei,l3a!1MkIuY_^Rp\3h]yGtY]YA=Ͽ͍y͇˳S*]ox|Bsi aO{w1kCK-G5>xҳ>MA]92*c+X>QxKo2ygy/\mk )q\^%n7xf,%?H~6Qӱx`Ó 0%fy5'bPZ !P+u,Yw-RD秼$JY ۢp筏I=enSs`&CYDY2s.ߣC# N;\ ̽, vLYX֓lӴ;/::S.F4}(-kh>$TJRtV)Zm S4;LRF?h vj$`bbT:lUq]vŪU5 i!FY{Uفi&$#M HLJKur0lQ9;$[F I+$0CyG <߱I467ڞ'.Dq"r=SH u Rdd`&@ID܂]{|#w3 m/4^q&p:lqEsoT|y '}|B,ql[0 EZÓy7IAǗ< $Zw?AmB2DN! oPgsk )t\_^rm*P W+z}PQ@eu-2h'EˀF$A'!ΡYy͚wI1^3cS%o_H0nZn߼\s`;ҌuACA2h\Ѿ@]GoK/(FQJ>F:Uq ivZV|l%ZuxHdX`jd㉳n6. [bG b%} AS -Qp#B* G{5+'[KL't)Z֡J(]JeAeQtFP,FEɢ\|*k8 Mp,S"z^-)8y@sou&rȰw7w4g0S[[XT9F2ZD~}?D[xE۾Q5C5Hye@Lvy/R׉RfORb۲<9ef-ק\/V<_kJe*{ c{4C`|fؑ:Ct5HfTtJ0t v0 16DKK2/|شu;R9%R]gӓt.H!@ds8 Q[] j-C=L;LTJ8|pM=eWMDŽrp&p3M]oѽ8D)6S\4kH*Lʊ 1Eu֎ -cl]n[nN fZc r)s [ ]|prSʢD8ސ~3}?ZQy_)pT'ް̎fвer[a%n&qslH}? rtLi=rΜ8.eRv%fr}4 Y[ヌ/@&&b!1͖?j2I7u6O=٭!zbԬSE >(m>2Di9D,>34hHPrtBhcHْh BY0&cG׼[Drdixsy1"Qb5kځ/oz6>jU}K70(L; wGĠaÚW)}G Zi:7y դȴtG5!1),a$mD6^/`e ubH,"],߆/)k`)#tfXwwlާsVTPtGiort8坓~d;IQ1#r{WI(qmJhgiR紥آ8d>6k? 9G;QV5cF1tBUx啖f\!<$sMqXcpȡ)ۄU)6:H>e WX5h8\]l Ƃo9}EŇ$͡os>l,*LpDSdeXQ^"aRG][RĘ#y!D¦VGmArlVS’f5j n#nwi+*DD+ķT͎[Qi-@ESI\B9Ǫt%k|CF}'@rˠaUDF(+|1]V". ]q|_x`w''}E2F@ǭ9#d-J6ec!˿Lw>U 3bhiGwkqE4£g0IQ d5c2@l&bjXJ#T&d[hX!c =-c!5Z X6[<(`5d[YӐj\_>yr.gW?y֫\a:EW9k4AΐX~CKm^DL &̐PMCfb6fEO"nKx`'%'@58X4J-4b nر_6`T}i%Be{Usקw [1t b^Tў'1(8 WƆν:{l͚mHW>¶WZok囏:L`>B8 SgpA8VQPx?Y(fBs @\hr V‡Zr~ǀa̶C76g}h| g'XX6l簋j~zȀ#u_eWXjf-NKθ1gKgl 2!-b6J{X´p฀׫Ih:ŵoxRL|noIE@@uRoz'֭F-{Y k`R=<v^agA %%pmⶳ<,';%*{V8(-Z#3TH%U֐G(|Z|[o"0)Te%$ed!Lq7]2y2'G*AUR`,Y-7Vk~G{ O$I5$'B%6 &3eT.gBf$tIE<ga:ʁӽݶt =T oDv ~p.bQC0Frɗ^TFH)coRaH lYbg#CJ:"#CZ9_ͧwPW!6yxj{`4pcsv"y+m026$6AIMlnTN`RQbˬfce`RnfHčf$Y:U(jEyzZ1DlnG)( =}kM jzx6 :fޔ9p|rų B..l{EܝcAY lsd@ EΩ>K4u鏰UE @TX!/c3Y4IBLA:Wf,-7&| sm|K?}z{Ivf&QM%;$Rڦ1!]֫&;vK| folA4Ϲח.sgPTPZt\B#P mu j0ѣ&u0QOJ1 ??;|Hlf j=ίKlU7Ԛ\ Ba [+RlS(ق:Ha`JϾzmv>uY,L1v[,#^ͨ1Yn,)өa>ur}OAM›-u8j;î0$UxLo.zp4=j8vǬGB%p:fjl:CV>)IN_5;"b}=' WVJ߮Yj5v;9*u=Q]Je ]/S7Q1)!*Ԛ5{|+J"ь(qC5:<؟r!7& mه؂2my#Y ݑ4}`B0sS@%h&{F(L/ބ*6[*>g!E*HN fMGJ&.ᶧm1Z<Rs<=C: 7e-ôƤpba9ǯքEb".VA 1hwEkBTb q55L\U2<ج,9bCMͩ6?rbÓK͖V1[˫EͭqE,׼rb>;K]LC"F&*fós\W$mܙZk56FnLX"ee.waUf");<,Kw- sKO*6pR{-Cx[kжj&!hb/DKk{b0$km D#9r+v&z)`\#IAcR`RJZca j Jp%/sɾ$(%MAQMDJv LI$۳uX2Hٜ1t+X]@9*o].T#f;(ZgCW qE]``F q@50MEIٮiçN @<!u" L{ZI^EYa]p4ɯ? UmY A(DЪr?hokQ鷎ba.:nN9_/٩r$ݽ_mx\*1|˾xs߳wPt[*%m`ฒ$D 1qXY^ߟbd.pd/ͺׂ-\h )fĬL)p)(ӊͫv o~3Ј-3'WcTE6}uTy0#M02ߌFH3\^\o|7Kr<V:q$ tbqedI`0A" עw$i1'cLIjNA$Hߡm˓JCL=v}I-&٠$&.5e^:`:F[tO+lhkېW(7/5Uj Zp%c+_} @2T]57NJ;ӦDYR=ϟ[y%l;8q>MdsNWpxl耽RuT1i[Rg, T+ 1iyt!ۆ6z%mp#8Yg~1lBLYeS!L*u4<[;BY.3>z4w3&glbPS"Ĕ_TM7@닜$ vNfh\tZL瀔jŚ.v=s8Gێжز@c".֘F4ăg’*)H"[9@h.swEHecsyX{P9L(/N ({Eb]eKhewޘ=Bmǂỿxc D FCn5M뫘5QRO\s/y:.zye&B,F5 *M187=e9g7Ld iUZey$x ϕkE/ZR"$1 -h2Tjq!q ]<LJy^KLFر蕽j̃QEߵ!Fq@k@%tstEF"^a~H/#du&1X1`1Fr­qE:MY_fr0!U!C_+!ŞPP&C71Xcˌ ;P%1MH 贠BpQB9uz+W׼}wgnDO>k = vgD{>⟞N9?ZKTtǭ(6CBFU1.Ƽجsy]P|l6*%In1? Ynë/4alabaQ g^2:v;ܙ E86'--S3!u4c BZwaexF%8}dmϤ&FN#i}Wwp@s4\:AׁY1g>S-#Ȟ tY *sp{wY> /B>a:ϞMvj H[Y9H_]тA C-ȣJARb4f WA{`/WwR&成s|}ˊd<< $,[snG9+ f,o XK:cD> )FXo+{ q)U G{җ )gpŰ.n,PX+.'tGb&BĮ@.Uv=Ŧ7buM3/,nͭK:K#Be>TW`5ξw_%x1}D٭&(&^zC R=eQ1̳/hرIXm12h0Aj6$|s'&0-0!b'_$IcLI \|ͣ@9ktrnsD^.esULl:8&8b=;jGo/H< )$>E3٬$~EϼZ)>I~ X 3x獃||?h7NFl5%J/MRrd1ERuHC4hk7";l09Yeݜn3.5''"!:,FN#Rx;~TZNt,-RZ/̦#J1l Jݭ{|d=D{ 쮁gςݧ?m{C}Ϸ}¥t!$nZD6{&9tsBOvB=:Jm$GHz܋H|y-*4|㛬r#,CUEA 1ŠpoiI76G1 =dCM=ػn/(N;44gZo*(4t@S%1$ QIjÂ/ռrXYoH g'9G wmÏvk[wjC Xcv[F'S@VSa\aY7kw{c(w @>΄,Şڰ )jگp{u (|qȶ q\ LptlCDRVe(ᬀT L,:x,IxŚͥRwU3sZY\#XM\@Uuh3#{%clA136ɭcf[!(45#DLp0'3d}m4E!OւzomoMv ֤3Gp3ptbGs:B0~M 2r IDBc `zƒCKcώwhN}1 Қ2e &0?-j&Gnt$g*4v]gz#e(XG! 26Kpppt/Յpuq`"u!HO1QzT&pb]tM1}k8+Q25jSһ J7&mVXwp*TpWj#Xrb:fVE5' ?qv}}~^$}_W)SkT,6uh겍ؠ#vEXK/fRAFԥanNٛ׌lÿWJPi}]n>t,~iZ5Niؼ{_^W\THQ"B0,Bڬ /֘rD0FP;a(fPk1qUvpV!}zS. N "6 WNp<`aD-{XJ+ +U3pNҞ%=b^ɤG*kQ>J v++}BA3{1'nc (qN0Pc7 UF-؁FC9YI(:$hG(ar)Hܬ(M6.!K"!d~_ק+o)7+B2aumؿ)<)_ypͿskcSnZ%3⏞®y}|zO-'*,roÿY#mBU#377q;x ?`mW;Wp%L0C>a' fXS>wP}Ք֭)Stm&.| HbWA95EpI5 `H SV1{Nŗgpx|lP( { pŚ2a6 ʾq%PQ>&*fl"cx<>FGO)V~hvp Yv, Bso,BBo'%fpESJ QO K!G5Tk=DJ'85@K.$||*6uz$|tL1}G.:Z1g^ȓ7cwT&@_'*}r.wǣȿ+W|g]~C!k>B1 Os([Cd DR0SUAAϟUum.;Wj \Pƕr +J<DhSvǹYtG*^ !1RQhfPSUy,;řJۡͭmՆ'ސەWX>mO`U1q6|jK>vԪG?1 X Yb~#ˊ}#1n7\/Qv< *Є7kiq _/nE f7Z)΂-'>.!*FpX qXS'^8zDrXE.7 mTLRڦaea0v9?Pdh'Ov I|EqO'fx }^n09~ئ/̯aϴ;j"CΡ#aOuy/ay; t^zpF9w4e n3{5gF育gN*Z6Du`4a=BBI^VNQ^{-_40+uiBR6U炑wMsx~mXaj;c"$6A\ò[ˊ=޿| ˌ5W>RO~xXms@ȋL3QP M6áMXEMt5͠?X\<гrjr7F!%^40&;%]ҽ7$(Qn\/pI>ᐿxOe0 )"U=mz ܡϠ*TMnc=WiU+l"T)/o|PX>f.)كm-pyo>1V1x`>1!(γ1A? H _c)6FNCZYDU&C^64nK?h\YN+H)=F7aSz&|xcʒURf6y^(4}J#jRb42rR娈UYS6Zxo>L;dPDm';k'# ۧIxAc"ف`B n8vL$PgLRG4}?SedF rJALlflQt>~v%,s*~JG_v,Ȫ9"IJY2z@Շ`[m">*p>e2>)*6e=g>%aah`/y`Yb0 { eYo-+1 H^Gއѳ y"̣r#NوW$g=n?Y,^ i2`6FrVb$qYBh^SdЎRG4I=IM܉@4/O͛La9.[ƲuRR꾁k?U0 -\{e[.kﷆB %wm\{VbPUgX44WPԳZY# ΍Lёr ;4vWyaE(Jm:Dž+<n"5wM?Sr x ܣ徟E Z軜' 5FQVcIe@t =o-ԓm߲s;[6QyNB ɳC?jy1 0%օ"1 1a\8 sKL 7~Rvִ$o`鯑Wd-o 4~o=g^cd׿0+,>|mMGh8V>k!"'Is+QJp Q6޳T"sDcX:$#K'Ja3((w,+f#89;waoWg5gܠAWOȥ*.e޲ S`N֏7/A//nf[ vS@>>]_nJ?r:n2TDJB-⬅̇>Rl? jLDZ1X}OP~#7 l PTشSqGQ C#횴6~=L>" Z\R~, VͮX< ?|Eb#3aF(4:B1ʇ6jʈ;Tcx muNڣNEᦃ{.&ΣNZ S 8$9Fj&f\`l#+$M,P z+X$ЇJm~'jH5T <[5"YJk"f-# ?ȠvMBbdߗ:$v3! ѢoДcc/C]ch ٦EqJc> u%rc?Ws{$;2nő (.>7AqF̤"kڥJyd2JOb `rmؠQhI3E__6yn̄_+_ E@&40=BLl|F茡2YzO`)ϯ`獲ХJYy\3+ 65UH!pDwb`w)6eeW3ma (L*'^؄YrEJ=[P$~QKB?gJ00ڑ u4 dEbՁ]" ~3'iE?~NqHZg]++k~&GIfӁ_c,`OlRc G7c9|"eXˇ1H1ـ,AƊidazuw$&G]'_|ɿCO)|%r.CeR@Q|ye}^O̝}a` QiŨYEibb\W$D!$PDfa`vfٷ^oUuu>gaz=瞮g|G0un#R{ 4/*g7㍘IA76L,Xrf˰ZcKWQ6+eҲELzHK[($SBE{zɣC'ԥP٣e4R s=Ŗ*[Y˚#7í ~1[`;NU#AI am !ԧ$b!O-'] ٻ8'`qqTw[XcXY]e'\P>c`Z,XՂ@)0_(idžzPbF֢$Z,_RܰvdQ@-m])*,Xu|{:dJŮN (O3g8&[0a5Ǘ[ͳBgK)+#<GyYnRAT+2XJo5s@ib_hFH+8ornzc\2$vO3c-=j5pXC]K7^,6zmY=[sOR"BT=?Jg΍7ސ!~dkyq*62:s}{1|3$ wtV[ '\duIW+dRw)UYύ 2OY/bXݧ~`Sĭh0zF)N4lJ$B dՍ:gZDDg^T$#+[ / U"1&mztPKFك Ճ>$. ΐvdTW.uTґPIBy1=k[H;ՄH)`jrʝp^8&@ɷ4j@#Aw5ᱪ*(J4HqO0ib%Emb(Rp1Ch]kIAٳD[%!m_.KZH .|Gkv|+}C SPߴ`%J8mK[4P%T/>4680_Q/yذz VHI!PEzkCW%d, U%>V*Qֻl޿#kN\3mmRyp[;",3yjtOmֺ 7l3eOGQhH*M@;"VsԞ)F J↩CWxlwu&dcgtTzltjzbc tl1OW-f,FZi;]T4TؓX_oe Ck] M2?EYzƶ)~/n%>x xq<kߧn1 f'hׂ(ӌBJ,=ڑf+8Q<޳l5i1ҧe}Q\YVlDG7nBX$̖\ i FDze칚JQ. 6bM\\wѕtq/}ndXZۂ}#ۡE+s(@Z65b3dvzp1̌k`{/ ?S{ݱV=}LyuD BzOLҨqH/JzDa6+,5_'TzX,[bc 4@؎PcuB}l>J?_-ctk&1 C3RUDصMu+]DO'lXdVGE.?#x SGwF4x1{& @crI*ZQLfBJ%4J>vDذN$j8^VS,Ӟd3Y^i12(ŒQ4#4xZ0L @X Uσyg!9 O=2eq pD X"b%G>cgIX|_' .V#xvIsϏo<.?zha{N>}ҍ*Yz]P@'$[aXGR.WV+TcZ[t=Vpst[S59P 6i xepghF$eP&gy%!jDX'EN؁RAM+#6BvZOvG2L;pW0,MCp%.mD'LC[|Pz-:1-(KcJ( mu!({1)^i;&~v `ye^GRyJ2Q%Q驱XzV0œX[\Yn,M43*r(Y9eϋlG[x8K눆Kͥ25q5fea K,uKҢ N#T*t&S_Z2;;d_`GZm ө&&&&h4Tu&' 8YZ< $x!ñV늉LcG 5UJ)\zN^lJ{c&kyKxKo+Np,.ӧ#WsO#?pD-Jkk?{vdZ MpY|c*.p+̽ ?͐O-G{adYff ؾo/J$q";dDo')IK?UW)O/& > xn+T5nV*&oz>WȱQo7y^C}}[Z:̵xO?H 41̽u+#M@^ko!(S]_,O 6˾"'3CԔs  ^755űcG[yw/|^rI|Vx &T+Hbnj%?&_wؿa^)ƒ&',ovp|8D_S2ԥOgVWsCm/zAS_G(t͓{S1L_2yx˵6{UI}BVB!Ԑ(ߕG2N<kn~!]MG><O|7˜j=o|=MW)_<HmL}vY<7O;+ߺCw(z%u ? umw27tXG}*??7;6p֮`(re^/~/ďOh)5eQRnT%$ѱ(.k7֢ 1g 0A$<9^WTYg|SF;bx+B+VuUj0[AP$U`VM v D, ?W @.(K>n{Rȃ~zAj\ԁW_x>_?fnŽ[O)JDQ̙g -Jf#G'(vNGw^uLoF*]r"h#6m117ڹE¯m`Fnkݖ'm;c-ZȠ{.}m,—@x_1H%LqȚӟZAT]֢?]e5+A ~5 8dq=[_Bc 8"5(4 O:s> S>kʞn-Y)cw-Wĩ҉O!V&Y"˼S@gOw:J~WZ : e' 0|)DC-S0|7?r]hooq̙Nf^2~_b~+]v1 ъ#Ǐc g'~'F~S#k8Kf_AƁgNJ>GS .,}[of*an6 ݟUkik25am燶3T(ʸ^kW7qe(TQHP_p( Ph5ך~8-FLt%&c\tm\:?q:(3!cOgo> q&jU֨bcT1]UǞ?w|N{][ m`iUxXxc`=l69{,Q#)iυu9p`t|w c,.-NY#=^,a˝ww yGCRE ,9sncʧGs()AEV1c:FPJc'e b;.ڍ-?-ޘZX[1DZ#=(7guIg7&6K `zjJBEcq%@oCQJ&HVWG0dFzJdVbF,YC)MAkƝTSA:Rv#=K-';tZ,%?4=H➠Qf/RJٌp/RMhVlQ#F`(MMY$HNS+cY|H>ϩ'Zbc񮧶1t@iK%ceXKlwk$3<GL̰Lq 2vgop RThLL8!^Kj2Yqʥ1"ŗ*Ҕl*I@P;Qůa( @eʉse +9G^)4ؖ24vbBl7u"}g ,2<e:`D_K|BO1/idͤtt_)Ce-PB`GD,|{aorzlrvLO@cbٙzzqz=4@ c}7N!F=j~ІPxx#g-OTWtT"Y<~:KJaŷ@۷yʴ?}0ϳ_#s[3cbP=-j9c|yJ Klb^J*X3nm ˺Bdݭr {R X\\jL6z6VQ&%[n}7?Oudž15IG/|3`^B4ͿX">Et5ÚnU1i%La,Wos\[|:*s)HrHb Ȼ빈|2Tls] Hg<3 8;6)) qLh62byԎKRzx+klnPbA݃K/;̛x7zmYж> Eq Z}Vwab{_zjE;YM672*) j_^Z}w]k^B)%W\~9??µ\y _x(1U.AJ &SyMJչox-fsKYFJ pm]^*W(㛡TMߊVh!I 1rV?=dMHg`\4/ ?@K1Haaz&G-|w38+*wt3.R2=[(Z__gyeP9rn/,T(kkk Gy?1Pï?_|xwe}Ɠ==Wv[n>"k>$&)_37 4eXK\CunQ;fK{Dh'qlzf{cײU6b)04엕&f[I5@!ї9phSZl= SF#BH׾W~#GE1RPL :j%\w(8i A(-VW =~8Q\\.Ds}|;so}7=ne|Ёx;?@k(_lC6k&.MȒOUBol2G-XT-\pE@T<-VD0Œ1w&y#`7 Fb춻>υ؃`gtJF1bFH_' ??w~wo\YpMCEqOٳRvw|"!6 ?:82giif3 wl V7~;or饗^(۾tsWx6/6gKVJGTf&6;A ܈Pmb@@g1/7}A4'mbO'YOd e( ]/G(d"I`t_u׍8w !9/QϞ;Gs 1Ejrݵ?A]1(h6Ok|W᱾%q+ B[&U,"сģ q7F㬷IrbmkqdvxE+8@b '0``TkFZmU $uc ܭk Ux!@P JY>^c Vv'.{kM @@XLEB?N hړH횑T -Qlv p/eu),va_7Uo(aFeggVfL&ȣ\v~;`sߋ{Gz2?نzO790BEϟ!9&^Q4JTUuxߙy< t@ D6the2q~oؔcE)C.$xViYtdwCE)Km~W_^CT 2fa|y{ wZA7Lm5`ЮM@a˞}^.`dn@*D0PJt݅Vbvffl?&;R!i#)Y>nR4 J)8՘d[ۉOӦSf{:J47raI*# )rG)Pq& 8͗#4L{ vy;:Z3+J1`YpS?ngzic8<Ժa #-q[^fcc3ogD0^8]k"5)jjfk>joM\SmFe:>>'`*(rw%kg]\o,@P^ Jڌ;[Ad`}H- rTw&:M  y? +8=:ش1#3JkM7z蕕6r z)hc#=^xBPPul ] 8M_Q=XQA%_`Du5#3 %F( m,҈~f2P=uA>Iwb6_vys%Eo; v*cD,8  EgE)Pr٣y$pיZ: +aqqc(R+++npH vt6JrҌ`͈ﰒ^/]m+b'[;Ҁȋ_t *V  kMeWB*QU2IAޭ q1^@6;:4Fa jc)  @mD64O50X9ww>{ `e | #ޗNj0Q@4dw ar1 _㋏?΋_@:}յ5Lgo{+Moȑ#;N*+>u_<򗖖 pGp7fg <4 Sz={Ǐ CZ]]Slg#^P6]`ZdαLl[z}P2~/%j"% g!͹"(ʖ $r܊LsÜ5|<"=S +t9sf,O߯Ǐabr|} Z'.q^wչRКyI=2rJD"wp V[uuȁY{2x@se:f%P-R\ChWm10ŽzjKݖvS!$ʅcZY,}Ƙ)sx}GEʸ{]wtqBB;n:qi Nf\?I+R1_NqF㡇o8"ʉ,wbjgl2~#N6nB +1vg>{ڗCiW]CU#?1爲& gϝqgϝܧT*!qdz׆UJ[G㬯3-/|OYl-E3 Ä &Hd7rc Id?/CGˏkCQ---|Gͮ!Xɕ{=\V['αM2}*Z_bDcШD % .i jڌʱ1yS?+ݬɶ1y}: s7z9 CߔRw/..Nommt:嵵u]wCz7ǏE/;>yg"Ȓ ԽN˯8t q\?a-Ks0v_Ufgl@:/~̚#<_ & ~jSO=?A9%Ԯ>gΞl}<}7\`@ڌbkt)+7Bg8IZh ǝL^Ѩ;d]k:6[ `2@ur[pa֚i_ᦛfd(p9?C=SXu gbNTnMa{ŁR DJ!}ZX1& 5;2scɬGa ~{:Re{{;wd!GU ٱ 7pY]mf5S8Z[5&S8Og{ `>)foD&kR|2܎_x!C?V[>{W(c7E$xJRg3rYdjҦZ*BF_Kkq XZ0/H헷,Kӥn;h}!s70_pmc F<# ~9LN6sc:Z;wnO bfccOCPsŸ/~HElvvg'LqIX!h*Wj 6%˿im6of:ܵR\_)×.)f<*݂ J[ 5˝q8@k߆p;z vS12+YI?wY P2Rj.@X&XnOJB"p#p,,,}Efcc3^גgOBzɴ (^'Ȅ_kCB&]"IDEzQJ5X2ZÊLmZ^>H]~NL&vQn,!bfH=#|~2/˓-ESs SefD;+=cWrn"$G_O+6H:tDKnp 'pGVI/4U&"7+{}T9ȅRYd}hɹs:{;yFHHjYi*}jȧobԕ!S"B#1?؜xבScⲹucߏ^vA3,4.@|c)5*\1#kebb!)SJeqe4#NJѭަ[MkgoTЅ(s[R2&=>|i|9zvE}U\@֩&s  eH_y-E>KWx_X˛=t)'1}&[.B R "0Q $V&vk+~!wok^Ƀ>"y'@%Y4I=a.a{Sp}!AL]h;qa~ ;)1ԅH" K}Ή*6k,^c$*8K3'f"& e*~ lvwa",7Rk㨳"xU7Y?XZi!Xl'~47{^QBe׸?Rɣܨ1`h\;r'=Z{ wrEO@C ?_db̬iPm'.]{xlwVb~thmБAxX;9rt8T\jo/.su_rم-NJ?΅U?wz,1dg-نfYByO4ljOOF7 vµKf%3 {e.MZmՃ ]7cв,wo҉L~S뿯 | 5`"e뿿.yǶfyM%-`{m .k6NTK,\׎4e6{r-\/')ʝB.yG*Kǃ?͙V Y?En_% ȧݬ9tr }ߛj%C11'%v<:AІZz~Zqyo8D#tCgv40h%{G>+g?W"$.Uؤk,Q {-BƆ K ^*6)YdT-:XAB]KjSltՎDL;)C?̾XC^q} /&4VBcnD*Q }rrIK֨QWi547;Xkm3 fRy8n؇'bRpC / !Ok_4+Chd3 FL\7:UzWğ)A!=V;=Cǡ# "&y( iڢ#V)=*2S5&&4&X!32l$RXPV0 )oöox&;Ojv?PW<kEZZ ;Ln7T6tL񕁿R ;|dbp&ɾ$`l(7< ˫;E+P1YPkT>1BשmCyBSSS}/SL `}kY\曦*\GTY0n~FKk66m9&9M+ '<͠Ǒw;\oyZ;:h8p_Tτ{뿯W(Cֵ7V;z+WiZ0 5lRj,`~nF&ۮ@FJcF<гZ?Cx'MW[ܷ]gǎ/+էHKq7ⅵחKHoZ0@/%1DNRfc6ј@+Cn@OOovgCh62p)#GZ^}Za¦:2 r%{|GfHS/)ӲRg9H_O%Ч̨Є%)e8rpMĴ'`τ: 2A2t gnG!gBEW4q;c2s@NOO'lRW*"c9rdƱ7 úѬ˜rpYpq3a~ hsXΩ'{!Kf[6fOg5dR0buz@g{ya_}<ZkRaHۥjl6̶-i6t:nNvRCݦQb*JQ9#9ԛo $=ߣl%%s\OJ%*j SSSLOOg$FzNR!g@<+C-+-K^e@N=tXh9O d/c01b`ŎubNȋ<[l67JRI,f{婛)`O~N d nxWa5h!+!@4hk]\ R/<>g!I(R _y> 9xP4eRB8i :5u`Ŋm<_ImGwhl܃Xg1:2ٹA$_p%<*|)UjɅa^oux-[^]'E(Gb'RFtw/+cE)-rN]~3TZd:ZoŠjdXXөlh4t2Ykx'b`쩳x.%:Ga(T:*PKCPS#szv.z$G,G0uUX"ϏQ /ZQf=˼粸\a "]h˫8鵖c*C<<ڃ)K+jF qjY]?) VSχN ?(ߌiͩpv65v 4FbT:*FwXkaDQFcHűr E 9ܑ20$]-lxG7+/px~=#7=1g~D~p=/Vh5(ۖ¢* x ٢ڣq>Khd| z{{#'p|HXu,PgG`1EQ뵊I3rё{QEAZs|:n8(z+&:htjR ]UaRsp&1?T IEU 6sPD<3P^^uP!_pp3!@{ y/mxwV 0 +U0r+,>H8D$P8aMOw)K&Erhe$zQkjnyRFYv(T]) x`:jbYAX,~Zkgk#x]S2Jݰ*aKtS$Mlch Wi8F|VkUj\qK"Ptz K_= @Sf^r&j&v@e >b!C93C6CF` R^xgf~vb(&&mǺ96 &аguB1,W2h1o‘_HMH鼂[0 m"PUi :l0?Pu($gΉܫqŜ~=h]?qt j_s&϶yFͿ*[ g[8Ed>վlPЏ@  {bllle6yѢwUG Wִ+bW(ks'wkS IλT=_bI[>0 &W B/Da||_6F )i;[a4MsEU{<}T}sjQ׽]@9+Y EC&ޓ@EmG5ߑ1($ F.a8[bD)]e+jy<iƈgB'hu_@);'Lj ݖsE1;[Df.M q=`)A@cƑ.h*>ӅVLLe|MzWƵq4CQW+ڨ0uR3Nc?X# g,|xނc=pJf]FmZՄgnUX@Hxtd̓^W{H'hlG4^l&,}P%VhϦv_j-Sb.X#rgAˁLrF0Ik;μhV {?XL _o@| #x26WCbPb#r=7*áQ6%H* ;Ihr^j~U "Ul$s(?d< ˕zs{5occ JW%uE8%<8EրB@PCqqBTDULfHrt[1w^ 8ANOB84U)k ATy6D{ʡSyӺt0)+m5Z:)N\TOQ٦ezS\EpЍ0n& 9րtjVziJ@{*%SwXD U: 2H+!*U Ooe>5peo3v L" LG_B=FdT09W0 8h@g"P{Лj®JjcSUFÂA9bł)@9QG[p(S(cKc|קPϾ;AԼzj7V7-Aέ$x%}D{7zwZYއ>/ ǟC ԥ@aؗv?3I\BȠ՜~)lf4G[0Rv1FspJ IƆ(LTGW`Qf#8ҐL1|kahU@4d4LR5,F>Ǜ6uC1PB.f6PPTzhmકYf"s`tftD=ъ,KU)sP.KY-1-ql7ihq|W5Vb߸Ap,CoZ^gͼ8# Rf1-Čf40#4o'pf}Kv{mB m0Nbc_}u9NhX (N?z:w;W x٥pUi܉1t|fmɦ8vnE[Oݝ- ٗ ;L,8xt=6x\BF 0~f @0&%2YR2jCZX1 1ԪI x̏dD4Ͻ>TchnæS{ԧ x윚w괍/y|{o_8~0߾b ejFQ*Mm⏾of5!c ; p&5 ƁLu91aIZi]|2K&XVBʎ 1R7S$HHH(# D3 C:'1>I(b$p81_D`bͽ(M ML1!ib}G8 t"(0jb|^Pt0'FW Ը:Ds4:W8?O[;`TMca7Ta-6 I2˼_m͈8^& F 92yۇ ] l@ C=/=U8j +036z,ߵoA'K4@N}QY%jˊxu<1]S1ú!\uw!<\a8q4~ 5?*MBpn:[A+b]' s(TڕJdYdZ 0i 0#^:&fgKdw: ^*PbG_|)zŚ@xL6' v1 9L fjӁ+<{3s6fgu9A VׯB>njK *SC'r[1J3=܎7IQl؂53Z@,Ύv[b49/igFWN#idECA&rgvVrG-YD_cikZFBd#sr$>omi[THxUxRW91f^Q1obԥ#*6Qoh^2 5]̋[uR31uPg]ww${Ѓp?y\@ P3~sfaM1v|l38=&Ø>ckO'={' w7fzY\q 9hH-HZ>iv#%B ˚輜jD/ӑcJӼ;?gbt&N߆/^u|l} syd|y획k3E% ԉelAjjK"&c 9Y@:\+S#,K\$)JgM۞Bul⢹Y(1|"L+o42T+W&M*԰cS.Ff d4$c/ \l7=377)YbL)kF[$DIbH6d-U)%Ž-觝N!CqeWc1FVg`>/墋'TI抷[8<{!Mcf`c-;IF WMƩGA(dG#0@9݋V-?K>k|,N=qfA=U @9;CD Z0&s* 1Bg. ˟mp+!ӌF? m5B8(v[6`\-`^Ybfp~@Zsv0'Liy+߸waV (S_72pU jks6)ܡbD~Huc):}TQ~fZd!Y\zIdrr|Oz@v}C<[ҎO I/Ƞ7kO'76!҇fjKEg2Cvns2A9)rdI] #Ah|bEwDOE\:bZ sݘ P3!TMvukI~Wm#t ίRYaIJqYiclq1ژShnCOX؀SVuXc@Hce{'mfbIK{هLx1UJ7( ~<&@eypH?mD#fmJ%wK9JQ<\swv'cx\fA Ȱ<`QT0/K{e2& GORF m9^8ԋ9E=f8Ń1SeL ,lDO=_^NJ1 @Zd9ڜQ8  lDjMqqˇ)~Mˏ3A;xt VkdƫG5`+s_)Y>8;|bPS>LPknԿ$ieP%O!q~cRAt1ԭwVKoHxlWEb#8lwt"~x,| (W劮J/^,n "[*_q1kk`߄>bVBjh VPPX ;˸?)9U,F eY' VlQF@Ox~َQ N]q\Is 4t3$"SMhf?V9vϗ|/#5|8T&'J/+):cfqզY2 Ξ h^+ (Ҵ<|Z шG!ZfwqlJ PHӮABaVjI`i9C  M)yyףL5E.83.DzU}[r8E?/_ *ӿ\,\f Pt`v8z3OJ>ͳ .l\!S&2lX՛B:N<ȭX~mk[`UHcy>_y*Wp!61)Fw`jbqjki"򞟚a;SlA*oZl,xd@Àp#ԝ0OOxV)r#Js~QAEtQV9z/!!TQK0IxA/DdC;Ai@#*+>l+E#Tszд`XG XΦt-D.`BX0iDi[]4=gq8è7]!fq]lđ'c~'ueNb$DoPŘ@:Z#fg:HULM!7!l)F'R]+N`ip82h0Q HoHrpx֐bOV \ђ!*H&0g[&CWId U]laT\wJVdF<̺\<X\pib_D)]^ F 7HuoIs~"F^}g4FP)Se|E7mC>zȞG86UĵWX4hFXEB'g# f HF&J'hZQ`,/@XD@ʇrWgQciʁRj ɻ țTcsC;NҸMAZ:8ک%Kb@u"hwAC$9 pℋi㦏֨_gsկYcڞ$EPF?Vʙ.^@8O8v(h#FAFwݑ09sRS1N:pg-ȇ!ˏ<#חpۍ*xJo^R”Ѹh PbcK6WXVJ Wa-8eئgpM3v{NtQ<CO W6x)!,d=L7"AˑL^0::NM4^fq Sc6hioKg9dYg̐5>U3Bw;z̳!QTS՝[9b;ayj{*5GHSPu#I W|dwXڣV+'i]+ޅ|g3ׄHQU; xɎ+PG;WA<)=~ߨ+\z.=#u٣Z-7>-f"ޅN@6~j9`>>N)Rİf0rHeTJu+9轕T"IQPLQѺyHtq9YխAIp~358{kv=6o%fw5Q6g[2ҧWbP3/:!hbda,ۤ*f lO{L0Z~A)(,cg]@3ԹF bTʸ~j~N´L0mH6!6+a\ ~;u9rYh#(,GR"k֎T,]~W i†n_i ziNfDވЋq8HR9 v4 PI~y"yLEWLjb!(0 -e\z5#~|r\<?sW⮡ʼLaEo;>>, ##VA/DT XA^`ñڷQ؏LQθlD xB5\sjZk^lݚְPAh/rqRcV_C4jBva۫Iy=joFڠUp`"sVx2Ju6O= `aVL.rhF^a1y,`$&UGD+ iX軫ƾ :s5 -st9j`+ ;﷭èVp/'qX7RWF TX\&W8N0{"ӏ]$92D?|,Bm1uF-/s(r`b  ^)Uʸ4!e ^Т!!i2!Fw:|0E‘!t‡)=c~\Ck֮Y&lظ #xg琛Fѹ*Ww=Ag_y@4hG/'Y$ ?W S;UrsR%ϩ3ց,/{Q_؇|"j`-;9Rc$u13F5Co1 k4|FPid7r**fI壼V(Rs+)ϏbB'IK^EGm:e#x_^˨nF/B:BG+^Fx~1޹?k(bsi,:v%%x`,ŕ2b2*DŴj=\t~cxyjyj*Hp-Bg"n#;K?fh?:t^3vTM RWDž=EuOT}%cVs#0DBm&Ax "t\Y栉sUr#߸O4i2_!~ fVqf[Pњi!Gp촁b$>7*WQ?<8Ya&t HtR )064x 0$ 4`)P4C`/hd5dK&z@,&Un'йV$j?~߈602FXǝ+TVK(1蹹O~g櫌>lmoӾ8"*r4`tYa`PJkZb/&PTLR>\"~t5(MQ2?> 0#_¢e繫R/.Vތ"4]rn ].x?YId)2*[O,](i(Vc voq%BCmmY^ `]e\Ex)Q;n v15%f%v!U+9K|2/^B77mďxt!=( bTǑγoPIDCE> ;Q|#xKG'&}ylݬa #< $!eěan(NA&Cv>,@F~zDE(ib+FA|#QSS)5\Nxů#Sip.,HאD7ǀZH.QfsZF*8 R`"Aơ ZM!0tW 4Խ}HlְHЇDC9՟{ Ƈ=t·\b'`)f P$o*hJR#M5QgU6ަ&F[*<G?= c xa;B4|+ }I]}СMM=V%,1 S{ӹY9bђ#ΆH^Ğ_wCd=i 2e%Bq㶒4ϚEh}w8JT%ӹU5Œ[?B*6thjgW>**iyJ4z )~N@`dbtB([>UphFM}#""ۙ,& '}_+7v"N@\FsWoG1Il24v6oWLj"zΆ; &+1,րeM*g|x(r:yTftXqNnЬ$}׵E Q ( bpNsUngKXex Pqq\b(j%w6H,T cnd:9 08F֩ьg~Ol`}Bm'#6;w_HVti!̐F *sňV*Zq]yfog3R#ԮY;"X^E}5#0 !@S C(bb n't9{ؿ{g҅SOhH7)ät-|F ۯcoѥdV<" fuBO= 4L "| ]`>t4k` :>*;!䢛 ґ (G6Q64 #)g;JQʓ0KU̓i J*Cq(jdLѩRi^ ql\OeJ/t~P haCB`1*E,sntq6  Hz-Q#sY e-q 3Dv]ó"b)!͢hE8^s5Sxʼn8SqwrK] Jj7.@- *j$q5JaJZ dMn*wEH3U2CKkR%tC?DkpWCL;ȇ.0XU=]}XBOKȪXr*cz*n@;~_22)^iU] -P6"j4[1a67?3v'p/l ׯqӋ}g(JyS1_ +ŀ%%SsXBǶ.HSQ>+pŒAJ3PX'׆"iܸīzZPV%h(49Otp(Tؑ< C-,0SiaF \ttk ׃ZtԵqz4L>h$ɩ xD298\/DXDDǚ ȢQ9`(]|"N:YAt,Y49mꢕ|u}vCr総ӥ`ƭr8DvEIC#GB{  O|>? _{AH1d¤݇?]!:.gB)2)PaঝX_IVwޮCtP+,BX &$Z:Hu&,mfnmW6B} v=30w_ĮcYZbo/N)dz3b=yj4~J_R1MÙ-bA#@kke&75έ"ꃾ,e+3ZL}mLGG\%ha}}bR]?0zDC]tu.a2grĶ\ґ8hTFbDA~=(xFuF Ys* (HަN2:-QoA ~je00D$?>7?/ %5A6@=yNh!a=w4VR匎],?v4>TYF#O7n0qfcY̆Fⷴl1QW,ӈh6gH/~a`23ܐ4#@Tp옍="IǕ]y>J5UkZ#Us|tso+L%qǿ JG7MHE9("RП7hka~wW˱W߸~@D5䜰L3Gc}k (Fz ΡphFlص,x۵Q\ˏh!\01a]\HjnEoJ'0:00#Ȼ'軩Mw1ҳf'8(_;J ^%[L`q2U5o#Qg_rBʺ(Qz%>nT$кY"IAL`&GzlaV,eM+x1̑"i:skk;x[gF$X߹)yK{4$,jLʌ#<قX 6c,@gPx* ٓ"S~OxvhS‘syQ~ Hp)VSϱFOLpZ+YNVZcw6ƘAPko8+z&3p2ᏴHM5AR&|d%a?ا㎶o [t{^#V*``tB_s#fG~e{v goƏw052樊ud}_g QV -'e|Uj5>(r"3Gʙ$EF-l-Q>;17Z#^6r&s=_0:?`7}eĄ2JX hr ʌle15JH`?b9bNXWŦQEX|n3i즁}&/G`WF2 Va[a4}جLSN"=nBM%6A]׽Oh :hs"ڇY  ?7+Taf4,4G`it!Q%Fb*7e:)Sh:ejzFOLPn9mly[u%,n1 Gr:fi/VڝAJJ*(N ~gW ܅]pgdtIMox7#)MDh:~|~ryϪ/SzjM۠kbg= eՁ@;irt]uq:‰CbJ䣗g*N]o܋w6"CaʼnC{}1SlFj͸LH? >fdil4~gxfm-)$kF޸]oނ?msn( e6;Dn5v/ (^AD)jȡDf_F>c| F̏}_<)SZx˭tD^K<x96@ڕ_5E#2BA+RRNvVoҏݴ,DN =?iUn10Rƫj Dkc @px"l oލLoFGzm g B V9ڤcN"a>!PLj}EZ%' NpDNjOҒ' l\ǡ$OރɎ<2Al7l{cw$E).f JZMf'vhYrЉ^l 4+>͞% J$@u/9=7V ]NS\#tHvKsO5ߐZxV?P Ŗ^PyO@Sz\fx0<MO%ҺўAdBD# ܜZjdh~ rbr D ⯞y # 4֍gj1I3>px|G>f p߾߼o pVfp =[ZH<@P}?_GHXj6uDO"{qj_Çh( n->f?#zw&fP0Dp}~N2mN x+&xEpq‰ l$C%{Fxa`bTsUrҗBB 2ˑ]rN蔫&7<mP5+ǀᆳ3a -!fz3z i,1*TZd گijRQ]4`E4 91 V/+Xh!5_ s?Uueo,oqeP^o_61`4M2eJb+10HQijf" )m8`j [,M";'xV&>7\-pŦS1CGEE+)LR(.Pd6Ʉ } ]U-xLs4B% 4oH 1^/AngWqg)j62W,EL[Hb 4݁3籽txR!'> J:[܆B ?x$tx悉5A~}v\ǟ/Y,3ĿonݬsIdOD6q% ;j, *- TgWHͩ 3#@G@* ]@m L=93JjlZaܓH!͢(IROBjY)#cZNmA5 Vo MՆD)z8FSabbDN>I| KcJ~?u.@: "Iϋm\gwi|"M&vtv(T H$GaE% 9΢iY?l_Afx>t1[L/jv1nHwb,-}Ԇ\v7+ϽiXf !fA- կ-ע8B^!;J&n veN/S:.ggK';Fmw "'TcI&H4L@NE%qA->HzMw5o_<+3#xozWi!qMFM9$HlePq1oZ U]ef1ǗSq8Ǯlb1x 0x}ׯ0\Y(g)qs|(SWtA"RXUd榡 `G7.iD Ġk]-D0ߣ%R[?0DX6Nt4{݁cX/V#I!Յܬ6XXZ}ilg0@'pEp*V/}k˿}hY.{eJ_?v֕@ĤSNNd*wG%\1"}}x-Ws:|g=:j:NZ0 !5Yu簼N[D?m.ŒTBΟaZο3Q߭B0Ql^{ˏe@(;v!c.o %LDDy\i~Ε9k+ 㯐D7"8_W&y4adbؼT]W[eݷoi̺y(2&CC 9g%FL&a+ITg.\f˛YA@YƇn _ũ%͡fT "{px'VEg&9ep9"ÄT"@_$x]$xlzJs!4a,x}/kD[PazRqjƟϵeJr[.2XE.&v)v,M?R&廆ׄ)܂ʬ 3r)3ƠFɩc@ P8?dLHݸ{~_ppr iHC8h*33[0h{0U2Co_m]%MqLE=݅sX!*d m⬅4֍S jA4Ar٣̒uzk?`Y; C OFJ%hNi[й7{ IƯD^_CӓR"B"=Hgag7]xG4[Vaj ݅Q"HhXۗte **lտ|{E#RvL|M6gNNz╷ <ݷ[aw.,Nq6zC3(wkF/!/p^kD)WU_0S}x3 N7Uhv|+`?r:W*̴u8C=\LcK,ajaQ>B#hdW'um3p2 J2)C I0%Iecg=1Uäm)Z#QXpII*t \] |5BtΛ8Q7 5N@|uSp-ZvKGwZAvا|No|F RQ ]Jljql(m5V4DA둬rPb֏g0#|t(cXs┃+wTmhɑI/5]@Uc}/r\Kmfnwpv^'y8J `ՋTxpm^?g&~mՍ Ԉxc].:+u}/νK 'pZ!Q?!nr49 t |d@K!iuMrJbEAT;6AC x?R^hGڊ)HZh/ + zұugwab(ɒEz drav/IR4m֫e|3*Ȩu``%MB&[N쓇&+34JB  cJ0 lC4!vФ9k`(~n7y(`B ˭&FZOIEUh@;qfQ֘_ &pr^6+{q Lj1 *vƣD]\Ը5R]ڸečswH5:N1X"74J E5|r4XOD\]`aQ΋Nwxh?7jŲ_CT#=YK?j /Tu.B=!vs6G[jCޙpbN0H0TNFn[EeoO VK:Ȇfe5Q&r5MabH~N&ú#w"I $.pyiVN"\k/#%k1pQYtO0a5 a:I솿Y̠Jrj*ę%^T8{wbldDadLC++XU "9QIRe?L^pW!?֘Zhk 2c[}3)֔|LCNmkhu%%'#:_0evx_ bL F=gy| *2N 3ӸJ2TYKCXv.:+$D(]Km\lN'IiBPVxt0^ $hXrAUxXo"ѓrW;Ebth16̥%5vA: f]DmG? $y Tͤ1򋓸NªA+0>һ/WW#-=  $aT=vߥe{t|G?Y}iWe K[FEynI"y3A+8vfv.?T)Pt\ u,! M5 ¤s7DRs簶 /_DFkD&^<&#w0ZR]9~<=xޝna]Ap;wv8$'”tٹHY6c& pvV.zc!yFSoe6IwF#4?3jI9Ml  MRl>T#xO˹ʉ6,I Z,3rdGٹ@&$R=%1{j0?>{i5|KhKSr07(Z+4 x(y}\Ck%UgK -Od1:c[BR4Uo:X(x㪇%Vg jh!"2:+m:}Me߉*;ۛҺ("h+Q-]D5CJUW7`09)Ṋ+oQ`&ь߅Ln7~Og7{,,5pCKI5fd0Hۋ0+pl߂DO"[OSPoiUdV#m-  ``.&$ﭘLGi5Qߟ^שvB"д4ɾPDԔ_Doqb:r_j鸈6:Cy;صu?zHe&ӷx~dӭOܝS/ 7dEy7 B  =~ձ!G!p~|k_2N,CF``nVi.@x}SO5ԆWͭ*4w˃c$_wa ?d?ӒYeD!fJ[W$BtRZABj'dH޹ݒ5viD'޸-4Hާŗ%j݄j aFDi.̕YiTlUesxƈ3Z.¹h"V<S_@]U{SFQN""-ECJ{)k[D&4Ha'_έ{0ޖlzC) n*'i^֞LcmOx[1l[*\G}ق0LbsW;GnhxE .UG'R={]BN qsr+KCF,3 %ʼQ"+f6!Us POv n@5,1Co(J>x̲%>OT3O:|術>YN SM ,Y**T&~ w/Qӊ,T"!yI_yK,SɐJQm\n,m*+Gf@v5$ Pd0|i8@ZZ){x}𴡴#  ^{Qx8 rٯ-;/7qzoÉ̻yoNᥫO!ҮuǺ@HIÇɑ ݅6^Dɷm3KטQmEWeymRXGtfgḦ́ *u;M]FzEjϿh.d*?'dR`>SLmJJ 1r/6݅K{?vmUdcL1ڄ%IyO>} nrg:ܿ]UUZk N(!,3{Jg=|d7h'N4S 1*$֘^[\;:sDԷ$@g[γG;w l%<펒"587fVZS]z , I~3pq,*DA Z|[ (GF4]L*7tI|䰋:ŗ-f;"tQvuTh1Bs\bPғ#)2PϜGly3"&3MlG4d<^^/]sWڢiPblS/?U_Z(gѮI@[G>Q\FCHd,7_@s'G -s:gp %,_WE2]˼H 3(YλxQRj*l"F"&|{pw ٓ" #"uشJ5<«8} fMU#{:-B%W,xxJ× =AGq.?Cٛl-IN)oq~[:)r9y_𧮾j*Lnۼ b%+ǿkGis=3Vo63|71stx8¨#Vj:jE <0xlDAj^R(ox/V:ձ3@1@zR&3zt_و#5p]S2J',xH}p-5"gѷ^wT#mAmaюd4,(z'Per3%<)N/ CL&TѢiH<~xGI }pDZ. ²`;2S1=WS%]n(WʙW =OX~gzlBMǯ|e/.|h"{Bs3ҶiW)!Q {@&?{ p"{Eo l`-:[4DggTY+@-.Ҙ?Q\5,xL^`0CN>B}D=/ګKA2V B4!j2ا^ě<0lU"v ;5OWI%qmc 59•S!~""3&STv[t~)Km0âl$g宧`U^'&wLkvmOcx,ޔNnC8.3}IA|yW 8s1$ #K4Ct8'ЖX\gn ~՛k?$Ͱl2Ç(G>sf@r:^}u\x2Vmg[u6+-bnq))4Y|Q8)ו )| { h9m\kCĀk.G2 c^CRd8JI,9'щ&U321sȿg6DvM6s[/,c;0X I-R<QE槿~aBwf^s1Iϻj3"q^p!F@ [ Vx%r4]񰛁%--|dQ/ڐD {Ɓ0azÀML2X-F 'u{~`>rR!ʩW`|3Lg/h^?Nh|CZ!-|C%9| 2%p:蛣ʔ! {D=2~IS/AV6V=\nLѣE"7(סjjؑ@j} ;#W <:Tݽ g VFLt dmtr*Gzny!b5je USJQmޓ q>FTwCE_o: M63N>sbvn'0ƀl3*[tDz$?` / g30r1dߕiBz 6?C#ThM:lwb/ͅĐȿhR+,)gZ4y-Ĥ:{}Y9 ~AmAʂCQb4ƣAs6.5Z~:̑72#)h0|ctBF*Z:I;O 4,3>YGVicb Mƌ;>d&UnB)ٖ k _^lWg:.R _5Jco;O8_<{0"Hn _!ɰxsҰxyrB.T-H~EE>[ T\ Jùskw^/0t^$477ivi#0F.4Ax3yfV~t[=05ˀTb 9{K,ɦ#vS^r:527󊆵K.Fz5|0bfF(D+7,kDR.WJ/ҡCzؒ b4 &BIԂ6rDq d+IXZPtJ7 6ھ#0 iBNKy4jmHCW4c H"GcZСo֑&CˈE*kuSCu\B.~]A8-(LcKi,t7LVSgj j_IHC HT[&Ү:jkԪhD6}aP3DB_ڐ #@40y(wO]ŹXsIv(Y%I7ϩc{s>OgExSKvE!H A"``fdFCOnVsu&>6 fP|xn1ڽ_p _ᓇs4'Fyt3+G8"iDACW/ۇɏCo|Ca*:aX2[ W \SJmy_gY"mߑrACM>r,1YPI6%5LIg_BpCN7gh 2KtCgZ㫰Z%xe91L\^9LWF&c\RT+@?2߭9eyd͗"m`Q'a^%4lZ]E䗯]tȹ ; GrD =~AMϽroqkVdde/e@cZ2S1"X/:J@,ݡ }P)@tzP%09>|-)}jt. ˫^ d*T!r޶UVXְe"X7c4~ 'p#:iH0BB|jKQΏdmLDF\'&Rh! Ai 5k?K$w4<)W2 Gk l8*SH \K 6Ƅb39j2:zGɣ4ټ7X\& (yױ֮ 6 3KnRHH}}OTq[71t[n e7 Y>E-iǔ#eD,Q{z0b5q4U8èTz5)WLï&#9:'TVW=y^2~͖=&pI-Et$=ȵt&CV]zLUyfJjAf1KijƀliSK3"CrGaL".H-?8 N@T&SLXo_>u/ Ƙƛ;@oA& ziCɉnu`Š lqr(/2cUV6jșeK\A.Zhm0lp-WB[3"1v!Cϖ% 1GX2D-mTƍ1z*2 d^,QS t  v?8Bz^#,bF`$6Z4`-$jtzn3#/W6[N%"m.q,YfKnil8 fb</(@ i1;r!_R!=`-։TPm hI $܈ƈԓn?堲j) dZ mL_IsCfB Psߔ_g0ʛIqdXэf=Y/#zaѯ\+䳸 KO 7枻,aJǾ|DžȮ6x M£T,앢U~]w]<[5$)Fʀ\kK O(=eBe3c5 _q\dؗI9hH`ڨR-ڦah+<9wVYBSh9=爦>͛Ih]v@Z|֜i.#-u@Lv\*m:7 cbФA/9åW=IJlKo\eQ6R#4"őrkM! Z4B{2QcۙNxM[DuGN"2.M`kM@Nmx=թ6z8XW wJ&%\ }rqeHK挣{̸+QHm:kzHǮ2GSR^rKE`hF5+˟'T1\RC`e=E4=TNd~Lz1dlvGzt%ݘ}eD-Elǖdr׶5&wO)@vI^6 =ɓG理6Z-dk`{+F_LOFpЎf;^ykn `᷋X\jLґսɼA Y,ֱ7nbbc` Vc/Vg\i`;/d]k'tfI&{xy8Kt NX6lvqt4Zج3Xٸ^MɿDw̚P<9O̧3)ٹ$29(c9ш (eM~εk03xA:luk1S*UMĮ{$ m` v qzC#' ^cVH U:큤UfZ"Z35IW:XwVR];;~_Yx^!<4_}PQi8ah$Uk2ە%%a 0obAvFD 7vh"R1l l_矲){ O:i[:|ۉxwVRYeIX"_V*Γ1=Aa{8o@ji<5"{(׍cWV 4r^,AWtOHԁt._d榳2O9Ko;V=5(VƇUmN Q #+diYY}.-f6@i#Fhm3"h^+m ?lÏ񁹬lS&5؂n4siXkswyh#*.(zsi ElTU4S9;f#,c\ `<LGG /q] R)YڗW5 T'mɱ&\G[P8r.>zn=c젫13U,/q*Π  ;Xs< +Śs_$M 7#'@4Bjj8Lȑ]`ˈ̔RVu&9;ƀ$_P6✦3q ) ,"̆ꌤT!7 JSV"٦x~`0pS]B63ku!=أ麪 <~ml܆&V"s3|oG EriT.@.~?k\]S(l W;Ǭ60N~LO3 '8ѣAo/|[Vř"(aT$L??F@22wmG虸13uzPi]4^֚2Cn Ml% |af箪{4 sN%Rz '< N(:HCjC &- :' ̢ӫRvNL &MFj̟w@T{/10)+>6s YI7Ud-U))Fu>HiB mN2|#Ãi$w^:!9>K)`&"f |6hPd$:5.iӱɇI "BD4D<"_<W(Ui%8ZRkʅZUfGSNg5:r̢mUk Έfi2KМaɔο (oGMzrkvdU=HvNyTy$Տpeld󤳢155YfjL*6S Z-W Wі:׿ 7`" ?eV's4jt9nO bh\{xصuBD)+AƆawk \(J^FfQ&4"ei`/U.L-LOoTYD _L]ngƞdqKμM4U }"3%R2׋%l=^{jNԐH|m}G,͆\XXRVrkdz7$:Fr>s%L\`ꚮb6-Hx21%]"Όe2 (evL]I7\/>ˊЊl+DuȚ+\f3&qDʌ2"(1c6'4cRw1ʗe YZR'7l}ucbfWAjy5 ,d3̷ s(\U"8bG8Kkzup~"{3Iy6:Kpv F lþs9u03==9%-٦(M(]lKtˀhE#_3=9{v,@?\5ozggø݊]]gԫ{|={Z'-6+>*ų%?Fv*PxRh[[E{׍Pm1@m :6vn*РBRw1IO,E?JFʐz HƆ^Y]9=:BLm75Dۿ[8y sE&:|_1 l'a0;ǒ~ddPM:8Ct`EQ๤Nsg."xtH~QMn2UZMGˁ(qgx #c-;| lLѿۘ%xItS^\?CYI{HuH{=V9Hpa)m .;n Fc46ȵ&"H;6dXg tJظ.le~?A^&7KǢA,oЩlHT2oc_ó=!_PM,cP|uS$ݠ׍=15C<6W-/juZ.@% LvPi5Xa)S4I<=|mYgZ}r0tg#=>:-"ˇ3Nݮ{upۋuRk՛N$#;{?[6sFb^en~5Vb0#UsG]FY $#"O"QLMGM I_$F[951TD R ĞvFkLPkmj6 / ?_?J#52/ԱыN?DFNxP2;3gpA^|C^Z >0EQ& qA#um 8MOk:49fʖ/#l*ZCm<=F}U qh2縹\74>hikxoC,I+z/ N IѨW6+7E/q[9| mŐ!aMH*VsD4ņLTc_fMFٓN9=E?ڱq7OhNtuoKvÏ#m'z1yj`^:0 =ڔ.z?ly%ƭ~Bp"AthvqxJYёU FV9b{o¿-1N44&ۨ膨Hw_EB!OT@Uw,#o&^˽'iZ {{[r {M:riY͌q'-Ȇ %!R/B;}4% 6|y:#<9uh6T$mLG(#G'CSY}}ߏwK$3Z;rc 8iὂ8<0~MɸyO#F1fhL=_8A>x|9/][V98dz X~kM?9 _i)NM B;u!_ZpOb&”M.KU V1߰/™Í29}}rMH]ܹ yH#=vq1y `( J]c~(eTInG:3tHgh <|Ā9(59ħNӘgxEgt"`]} FJ^L57P-[L[ iJ;}}HƣH:mh6[te~a[õM#AWTN.>Dcw.1H<'"vq|ӓ _4"@qy{k*FҥZO']$٢<$7 bK$pRFC.!ɤupE1ć7=4tQGD'nX/YF\6nHPrF"@AN.-i{4"g=:0AT.^ =N?Cע3T:G`a>&#-O$}2躍kKJXT$TWfJp;C4dﭴ^")wL MKمqeHh }? eYѢ9?;f&oo-=.G:'O}d Z#)x"qyz F8O 8f_EQU{Q-z˝KvNԭאTjt-z\10bVŸ{ @KP }k=Ce:Ю._Q`IW-::?7>i{mv̟/WIİƷ!5 8)@(#!t +il |"Rr:xeO*Rq%Ďr2 ;s?;+D$Aûޒ+ZF|>#J{x?r`7CzAH_n^q;/BaKS-L R3~SiQi=j|Dq܊uZox^Ak?/-4Z·00ζw8u6b"t,պؤsȌJ~"7uU8pp-7D'8נ^!̸}~8Lj>Df7T!=i[/r-fe Jp?D`Fv-$V~@P[$GJ]OjqR}*0c 'XgY:8A@O>rgKJ|o^a$w[ZQ'WMQ&2\٫jmz@h* ޔIJ7 sgJm<мDZ 3!TmAހOw/ C4"*"_'/9 MVIpz $Ip4J[8DMSg Cv18hհ?ek4lpIiPwM ruO?ChKI,PBYFC:at,zPq0E> HeSq2`NבH GMal:aTAkhXۀ-\* ~Edy_*זQ@j䖄p b8]# {7:%TM!f>eƕxp~iWχ׸G*PUmj%} ݤ|uP̩? t )(W& >DF$=ηM LgOK9 9 p:#h;جt^rt@QRaPɦK'>yI˨)0"m2>qX( TTp]DthHR nhht u AI1,.O6N蔯8X鵱T=+Ox:^G>֏`A\Eiʟm"/At gNy8P)l\e _fOgHphidA 0~D(e "Kڱş$,HgEC/:Ko"0z rMxRD%p5>a8)T.-|t Qipxwhn<ף%V_fK|LĵaSwk܀8C؟kc*GcԝcatOt 71e>#iExmҊ9\HcRؒ Pc 2iߨeq܈rӊ$~܅X]7tt(ti~5IN[o;6t! AttL,3N4.LJLDaz3"9yL ZSig¢Hܮ >ͪIFt' <eX`FX]-wQԑv]s0[l, ;R {Y\.]#{d+]:K )7.=a/Cu1b9J<Ҩ&Rmn{xp@8OltLE;DOr2<RJA?鶊V,l-Gi.|MngGQ_撋GXoQ0CI+b@+a`}M.]'f ңlՎaqߦsz>F8,*ˠMA)G]?*4&ijFCOۻb\pp:HKƥJ>IiCԲ7x 7^&Bm/q}0Zj0B'sXА(^A^qL=T6kDCM)&z$ԦH k-@?|V_Fٮ)qώL{c[-Id(q qJ}':?"N!;O?_>jI0S' za/F՛F0SbFA `EF-~ qNEKr,]5:溪60&'s 8BHny҉\KsRwla}xp#mƤ/$"Aws2™ꀅ}~SsoXĤb!-iIw&C9}A:DS}(q-/,-|µ]G%Z>rdDbO~c|f Vs=,nȰ}iyXD3gȎ?: /z;pE9(D"hYkjiɌKE2z$\x@0gHɑaLkDQr6Q+=Y6h>GKhW AjCA)ZP'zkhaWC B%tFo m8/WIHDɥ>Iꒁou> -uL8XT.އx$d*?vW~'xFF=qOe M:XT6J}n"҆Iڊ5BAY'EgO2*B1M,7pl4_e}F`1Hk#!vuW@gsUm4=L<8a(shK /*ms^LnHEMҋ65:S&GI_c'}O} 9` !JRMx!{a<F?ȃ f⌤mg*8u  psߑrd虻L2k^ĭ60801laSgYD$m)s{1{8(;"QkDFl< MJ>vbĨ@pQ~' R!\-<6)jrkaY# T6vJ$>FwSn=G P?/Vkt|o uG~za?bj_Y`~1ύ'__k`h]{=W0NqgqowV`q ϝJwqޚcD% y$kj?^=z%/X%z": KZwkM'} 2ŢvITo/W=JLhLINC8063'ة-6읛7Iv5XP%/75ndE]TՒ+Ң+AHPܻ"9;U[>qtѐIMg7F @%R&ztF]*m7bw?4)'D%R鵧4W r[G]&fdcCe8$N?}#v H<5#,ql$~z2B%%uE,'Nvb*rCZ'JyoE\|+w2!`IUJ,f//m$K thU?FX {m ȉ^zNj_ߕBqܡSXG+_@([_)VL(޻5KOX݉0G0_-ykeI0H)hАǰ4(fOoO<Mz1Hϡ SEt[O0nQe*#@"@!WOC@.H#_}>bAxE^kEfcFo8-7ttYJB{Ꜭ ė_EPf1~TA^((i4Ql(*pfPݵ7n"|Ū*!QFkit}FLsG՟˷"|yq'"94_:2L ϶q_@zAH <:*4>}lG,ʸn(ǟǰK{ :z%IzrHH֊4'IbB9.vXy"L/.F) ]I3 B(H׶c4[|k\|+H]*%dx瑨ֱ9J7'o1oAqc }i~k/[FaJɾɡnZ]g !HlPgF~> 2er,!"C&ý7(AQnqMB4 mt61o u+Cqb"y375ձ(&a0u#]^; QcܼDU̽z.sq$|h#އ*l^&G(𵿲Jr]JF]&=1]NV*gLC}0hF< yۄs׫:GJc,|CH%hͮ왲[QnUcQjhcIyz3!(;] )8Ѭ@%Ϗ`5_ qfS2 It RA F #*5ɌGI-rN `a(^JEJȥ8;aܻ[OJ,w[ىB%f\5 L7j_&cLGs3Gua 8t^MDGeM?2]-z`@k ҒUCJ$ 7O>}C042e͍z-;!?r±L7k/UB |a4-QU< *dEtQ.͵r3) זmܹACF8% ܫrGQ! (!L$\(w M#Be5fԞP_~h6Ztlp?tC|\ᐅ4ouq "@:^# Kp0f ǵAqd^戽\ i/n +t~CTXIٛsՄT_:eOmf6(GlP~w:x>gwWhwz '}'k '0Q>t5:JUn'(//LjQO4^h=ܽEMLK)&E;B8x@]e;osvgxHHyHdwo}8q&r 6 2e!6UN} }/#`u+t0q`'>w{m[)Uo?ZՌS>67׾HG(^ĢHgeڈnz9|FkwN㬺@gFJ\/I+3ut$/@J3oWn"Mr߂ߗ|?9GOPQD=nD ?BE4YȟqN>dF~? O5z{W;L嶦hnm `ur Q(.7.$%`ԃ1@ y{x& qK>1e,ݿ%*88-K;٣y _xz cPժ A 1.h8,Uz>-t)6;F1povL# lw} =B@hψߤ'sġm+.y(AQ]54Ϫ}¢hﳱCDF9IxD$u/xAc(!; =<< X7\ܽ̍٦G#),/űĦFf$ПHb:/<}uIyQ~.*yl/9os?n@r0=|V.m AM%zu1ĺ8.sozkO Ku[MBQD>őlFG~5^rR{a4dAX[ȏkEZp„t#ZJ [ 7X.*Et +L- q} \^iy!)-R*MD|x> ;xNI%'e84(j&?kxye{o>z!,:||uF|BZ 16E'nŪMzp?pHE܂uR-?nk (-+JYŏkf7jEgH(F1ΦiHIX$d0>B}ɴcF^%8Eqy.f;wUuI:-dd%m%4%\i! "Q %C-J(;`/!6i`K3lUWv,=A$X%!/=ɁZˀNh%¾U4xR F˟in_uNeCk|=㇩q-#`uefd%M !7",ک& 5r #\XsAR Q_$<ȓx@DT:>_@#% d1:qKoW^n==v)L:׊0isD1#\sE)8y̍L Um`u;4R."9kA/ ުa_܇Gw-Ei,e@0?3na1 .Z.=N=O$0]BF[u?J4u0‘ b:^|-ݝ4QdMFJ0FE;,=Ot8#]))@<a|jZDaڦ)PX :G[jc9֒ ~smנ#Q-Rǖ c\x~h/!_s5 rq5lrQԉ4^FG!& u臁":"\4PTٹHNCP~uϖHZȭW/.WD|Li,$Q銚此jч.$-BQRGұ rQÀF&*2#O^=?qhV":ۤOȡI=}fX#B@TչG~_.r\,mapƵ =llwpd"9!:3!\}7t0s6z~ps| ";W yhQr6"!QCn6Pafya0=7h[;Kzۏ}Ctpß:6owppFa|ÃJbXZUC\b[N#Q\G&/QN-yR[\R80@ _2O*|D#r#mUW$ECpu"_HmQԕ!{𭿇`NN7LccE+A4(/H^:W8)O$:rS$(tn~^8]HGEպq?jDQ$_NsVh˝vy긤Is`r G$&B <FԷ>* hnA>hHkˈZD /K3_љS8 )kV F B{_@hD1qdI~h#(p ]B/>GNaˣѬicFNP2ayIWGɫeIz3zrsY|#|(wBn.l b6DyX:dZo?_tֻ<ƭ7p}\ِ˃FN?5`Zeb5-F\aK\ $B8|燵:Ȍx.bS]_⭷dO3nݕ@/[D r02 @ȥhG's&WP4ꘒ^iIWG車Dzzex΃gc*)qJP=F@Oġn¿sC^'@r|GsT0 Ѩ\m $tgI^إVpKTzA{`N?m=zMALD cj,~UTAcGiкMw,)o9'gX]QN?do7%4Ο|ԕ{;nZ۟`QFśzvQ'X]Ҁ12e(]0>!C(]>^KwwK yFLVAn6~p9:3d @$fq{ꊛhoq ]:*H4ز@z 7nI+qχc'? I9*owuLqm$jY`&nR8%;+C7$V=ج4PXybUvl\k}.}S+$eDv mZc pInzʞECr_G]daGze<ށک8Cpmh'ψ]GE6d\>tmH'#`:}:oPs.}J+hU 0¡6EJ-Ec* Bu\ K"ezеAr2-.KY_үܳ?L~?Xٯ7v^?@*@ahl8+eqCC'-n+5EI "R'D?W%bhl"N@u^Rٴ^Koqvnȃ_;Ҡ;Պѧ#'[EA<ցRZYtiЭpmfR<"Z~j2Қ8¿ %DIL kfO_%FPzE\ϰxyQ <\wO>."WYMA`Mƚs5o#N0JUi8uC pu?^K ##Ln348eh#uPf8Zu'Xa8# _,qdjfcX8O%7SkT:ߢplϠC{ M h5o ( @a%;DJ%=B#{o~??5 q]T{CT"} yy"*=4uj(fsx\UQ!lE>FI<R ^ q_>sX=V8DLtd3-7gUUo<wCkl4gÙiHIQWbz uy6gq3a] w}"cLdpb6ݦ hh!$6SFf> i[DGC}"Dzu 8FdPu7/+bWL#Tp|NZ?y„sp1I U+ x1~EGDZiet '):p"]DڻSEY!T*[-l̳yHQҊyCB z6SD{c"! {RPGĊcdl}D+⣎@ي1+(Jչ%#tTTǠ@`8Q*#"#ӎ("WC$b&Ly^&KTTn'pe̯@WfDߠ9|{PjuMtF;4^zӋ.I%F_=M)gZN |1޼X4!.Mc7\yJnel^B4p dv|tяUkv(\BX)Hz?KidN{ĨS7n^indJBi?iHj[yBH (`F{q~%)X#!ϥdWOJ, /:$lIE#-CW ȮaEգ"jO`X~(Mri7MS=H+\ }Ϙ\m9-P^%xMRF9Ae,,1"-JwwpϏ5Q^:ex`T/wi HfCl*=u 'i#ܝOz?+ =+zhcڮo6ybDܣ Bu,%oDtʹ8ZH"DBj] UkBoAM룚>ޑc >CKO JhL ͆6O}qr|ޡvG'`q+gh{yS׶TZI\*?ݹ},-Lt}1_;s\MepSiLVkuT~:ЋD!Ihu*D}"NrsVbԟh #Om\&9e3FՒXуD@ o*Sج >!*cA%hXuE[%BJu3D KR*W;/e$F6%i)עj;S}?EWr\3hƴ}*~kJ_FO@+*"3Op57h8tv1;:ŒxRQ\-tLEq jL!qS>!==\#`ni+KoF @<"VtE6zLG%0$Jzt9tFF)g!ѫ">K0],sok趎chfTZ-ɠu<JE~fX4 eln1Sbc>5`삃rtBDEQiaj,{,LmUQGBfHx'?(Aqjl` i @A BԐ7vQv lqj$~xh <) ; ID߻!ʼ>5BEv婕61snFSNt:C1=U>fw7GS M;Jnx>x47׊WS(m9|ނ85qX3qמʵ ӴŻ\ybjҗ#OԪf#i՜{%-]jS&iY9ѼUyj*/R0T Z#|UUɘvsfufQ r {\u^>#:4FxOњ UZ/~`~BT`] X1P+aeKB}QPKGL=*.ϫhǥBf 0LaYA/`#Jk:/dmnAO J'!?w~ó:D3Ds\1E]FlUҀ12 1=C lOͯ#QӱJXD6 ZxM9GWZ-VbP-vp?uo,WERQi$7y#BJo7*!vML# ]_-5(78`hV#}?Q{7#: Ng2<(i+9.xP3L/V{8P KbJ+֠,'>u$Z̽M"*j}^A݂1+.Jzn(HȧLW0#@GmPzJKcHT&PP2y" ",Y~Ŕ,׳g %{ը%xV>û NvST*;?5VV"i™/B+7{œ ظߺa:\C)Z׫ckZ)p(#4w{}1vBL=Ds?o\~~4R\t*&R|pBO|y Pߦ#iY* _\޳w_ `B}GK<[/GxEnb.E/r(jњϭN&-*~-SCj{ {WVmB1 b^9i1Ȇ:]4-RAc\ Hnd=*&cC IȄ5XV(A@=QBW_nXfDYxT>tHv]ң+RuI*1)8IP-@a#Y=yo%s/@+?{EbY$T3}^/g%"<w8nhV7*<֨pMҚc 6b&nny ;D*KEwT ~M'>D6|V10eQMM[?V )jQ¿za5r%H(hDjkx_ч֨1XUqe=cu>>-|b/ %￀03wpŊ"v()ZahRl'D'=7D *ذMzƋÔܫXc~6n K>Sv?p)"o*461 iAJ J 5q^@VW$ ̉hJab[E^5(e,MNi@TݮVѦkPk,5(|ÛgYf*_5QH3JM[śP{PI] 6XYL J;qٴhF{_>(Z bYJi#&[!z;@4럍JHqM$g/Ӗ|?wP9/btÒD4)Z,dm63sX**[?7k4NзȔRxld)h# @t"، #w?0ɟE.@@a5~ƙU 4 ;[KKA%@31 D9{l중m:d sFE~S~%}Piy ԯ"ի[(CeP,"P#=kB8[=[yok#n@N᠎ԣߧ М< Kи76A\i例zhbƑ?p:[ Elu"6IG߷7MZTw6Fl`{ XY]}݋_kW'?k5⋠5% i"Î]#MȮ>kS8yn'$FV6֕K/!,Tn OZP[{*nSyt+JNy҄Sexɨ`Ù3tQ܁qYd"8gjF]  @飠t֢ OYIDAT1qԔcyNSjՄgՂ!r f<,736bnߡFL,~ݨ?4^5Y>ZÈd2擞;.C`'OSEm*{? "(#2\- SAOjn&f*ǝr'Z+p'^uN5qV O0wZo! Nt|T/%ͳ3ݩjN'ȗp:2fq]}w~6._ZaAZDiZޙbW@$JtY;7?-q:J8n`c{f۔ݓD+B;9o Axs~&w4ҽ>R:Go.@vpT1Wԇ|ޱ^Rrf0G UJL-ߤ!'ܭBbv lϿV$2^p@ 6}0qЄ** `SXiK%wcmaxG{;'ēO=okBw_}\$Hk+:#jB 5IΟB~ls뉷EUZw@d0*c~DHm>G #j[v,@U&c0ݯaNYfWVfKVq(f{ Z;1cǀC)2YKsEZxz=*wѯY+q.Q)4R6#Q>zZDo]nkIKНKLtјgUDM|G%ճ(,v=6?V/jT鯌2V5lj/=oӇ`a&DBKx( t2jp6ޅ<1FCMo}60õ(uuM] {N.>x奂͠ۿz#J~_gC!`QznE$ 1`-G"VXd3$vnmagoXy7vV"hU Ȏȕъ` ҳt9W1,*d_9$x QSTӄr .Ï>٩:m\y^y /9"50 }ujLᵆdd{`4AC 2Rj2$LV*0xˎڥ3H_8t?s%lk$2YMqZA*VD_MVS@GKU\!;e"]b)QkY vnP nC4)a冊oA-ӥYLk=kE-aLjrx) "\ORtNGa4ąQ O|*]FQ<~=u缠"BޗI RkDH{>-xSnDOCݠGa!hMoJP w*,VӄG8x)}(1n= >֖28yf ɥ9oa{qS|FjuHQ s~ wa%ES\@j#OVC%BQY.ҭ!fh.Ď_' fb ޚ.@%# R#iYZ;TbLC쥻'͡Np4iDNs5x +8۸`"y, 23x*8]0]Le_!EM=Oɇqןߑ]h4wȝ d]!d}Qpv?&{ꢢ Qii x➯Qsx>v־(X&*=W3[بVQVD(m `NR! {nLP8E<^B8rhRbNmz .eE*ockڷTTD= H|N9<2_6#6<٤}^mxnŒUVVmYRH@g B)QJȊ?F럧\`Xz^^ư~Z}^fp4EIaU|M3wSH8"DQahYV9 0G4d 4fK$W?qRd&ZOP量IVנbT_ R#yan2F%9xo*8Wz êM{d4F,f:ċDQ /4K!YC*q.Hxߐ_8i@*Mrz՚>KBscU?~bh56ez}0k6^͏岘9 Mi,q0@M t)CQuw% VVW]|A9EjGΟ+gL9ץ-|Z\b"ģ}R9 qd(11Oc*b]ܸk=*) n5:q {/^?CEx}S..NӧO7uQ XQ~ɼNC(}藑򴐆2L[y"~XSp%4Vu;P:]j"*hg24ѢAkHy64j;ڳ =t笁g԰~j8 p?4[*[pͪ)  j'1: ^lpDᏨ xP1iF67.MVE@Aezn,z ;#j J}W\DW R]*ڲa} LB";sI5( \wՒPOTQ\KzA?s?S5ksCĵ_Zӂufe0Nܥ[:r\`24/lHb*?a P{aUH ֈc.Ts$ᨮH+!ArO'(}u|.cȷ-ZrqG37;ƍ {>Fa5?ƷGna$cA N]R)WΫnU2(yt:T(zZ"v MpO6讼FU"eYiǜFm;?+SH/FE ɓHdv6~)+5}pukBDFeI&c#HwYlD3M9Vưf3 0ߗJ7*:D,2m:NXנ)#3ʀ=R9?j3x Xf i'HP'QصFk:+DP9mJ/fT a7CިTTj},4jr}S]*?eʺuyo49O"zFz*a&CB5-N,Q 1I(lnW&)6ά,`ֶp '$5#gv4ӯߢ4jtlpU4a*gŕPz(mSg!ǭs (Bdcd=C>셩!}_  g!xf.bcZHv+hWfXkQ,-g'xiF4V|,40gqݛFze/5&P;FW~7vw9"Q$*Oo|n>я/W!kL*'8re#5 g7i| uG)_RP6WH}DnI !"8!&,&f F4Jə(۪(5P Pᤃkw59<5T(3 5j~l{qK*fWL Cc Z+. _ldښU.mIWLG6p07rSXKmœD!wݏغuǵ1[FUQNiR  > 6/# K=C%5,+q:l[}~hMf[$cN 7 G?]F.\/gX7BWX3\_eT*X_|~"6 ~q^lt)ϿCe^a=o㏮ll*nW,&`P=E-P6E 5X#U5荣6/yDBZ+#XP?zn/f#DZqTBMXH%mKt D%Oe%RTmf]O#63&Y*}6QVlP#"ٷ JVS1vTf6~n%rM@\vbKV vf:b5Z|\ޟf Os˜]"[ >DvPŧ~@h# '3-|(IW ^P]45(~)>6v2vyjU{tHw@~7D+\6?o6|"@&>­~sz?Ky-h$x"ep&HmNF0?JotSI*QCi4ȫzH@a%\w`׾+VtgP8)x_mG\?[գߍt|uRyB +n-j1! nR}cM[퐾FRh5 E5?(q2L-RF(RH tixFv5{2/#YLԣ+&ٽHhm(>O%l2RD<#D=YdVPfs.Rd.3*0hNtMxaH9:j:~ 7ru B4YIuF=K{W# ;nFC?$ʈLS3=Be:PpT9 p> hLS0DyDf w:qA`iĻ [B M VGN 5PnJzȯX%`O2K?YZ ~l23r!*r;DLj qfVFтE6jjR&@Tj1֐4U /)M!zR;˰$PZ{x/?+.ģ(cGH>Sk ';ŚEbRwlDZ/3ZR)DI7:\᡹MNY&p ՆJW`Vst2j1UDI?R+&-PILfyd5.Q[T*ӄB'ægnJtVa IQu*ZnCk]hPng*Ž3y\*t;v z*G]P'Bil oW#x~bf mr/~_ ZȄG᣿ M"V4bD X|CE#QZTh4FT8c?Me@{(LXR )ҝ;v "wL$R&}Fg8 1K/S Q>KŰYbNڄG .ž '8 q &~.T(MEQO6_tw4X}4T@i0^F{w+aGJ 5(PwԌ;TƳGnէ46 _n'z̹enC24/c\Xi=d$Sӗ6B+وMZNEQBl4T>J!fy#@njջj#7A'[I;lЦ WY;N-Xc8:AcD( 7R-R@ܼ>wJ}4VaϐQwqJaWPs @(RR5ќXBH 9F#.^̔Ѥ{ߊrf+ UlA?Wш{Ir ,uOՉdoE?Hn+-Gԧ?NPND6s?cQmq5nn,4T#+=HNS:(\j4l_z9@R}->vuhozW_]y[!4=Z/5F>ZcֈBN2yc12Hn Qi)@톆TqKCƼf\BqDŽ&pkH̬U83Ɲ=[%t^j}֚Pͽ|¬SJ X[%T_JIU.Z-tYa|TUEB|H|ac E/Xc x+ܳU*"P X TZ}wѯWGC_Ꮙ4dҞ!a}4 f"TXH6 1)¨M y$k99a`.3@.1@>c`"*RLl}u#<3ilwRt x_yzQ*5>S|2_q81g2 qR),1M#h`jǑ~9@3v&f*8z w#J5$ jNJ;xTwE)9.@̪ qwO|֐HZ+<]|pY~DCAn!a0n} (B@{&Jյ,>ڠ5σS9N#:K8#v|:_~جtѹ)&|ҨȮT;F5 Us>ĥ\"k107b9ٍ4; 3xaP,ǤP@Vwvx קt+hvu 6-n;C˟V:lzww!Ь*?A7qxp~-}΢}golMJLD&31\~q,M#Óe"+xZCeu*RZH*$㿐o*@\!yik\1^mلX!2ۆD#n >]EBjVc wD +akgQOh~ P92< [UYoB)xC BhhNJYMKxq_笔}<ᱻRxt'fKW+'$*)(8SyR)`=IQO(ER! / }@ `)Ho~?E.#[X)wʅ89J[os#aM=NiM.ŋ0b&_bУuVBŵeE;8Lq`QcF9U&]́,?)̙F7H?nMTxGCnqP@qnwqAל9~-Zsn4xLD\}#^= )TPU vZm5 mvƍȳ&=n*ގ~oG? * 6$\B#iqϦވ/2bLn`'[z"w8xF#4~K&} s#_o*?X`du1C87_HDxԿЙl]A=?[[UBRuo "^MFS"<їڝzĿnͅ=WjH_x"){Y׷MTS3yΕgNWxJ<[4|Sp%JPUJ`6=x2F9MQ>g{1ri>k0bיg-/G#:+ꏜC[ᓯb>ZT2^%H5쫰 e"ϨjdXDeˮ`k4^j׹ahz(REٷL8eU$ޢQp.V*vdudv!Zy--\;U˪Z,Ѐ!n0}(hw`I=*Y:MYvA/) ycTr H#T~؈*StAOr&ޝOa_+OmKknXπIKpxWy_{جKi si 0+;LAD sLDYd०˯<ķGfbAsz@^ f/rk^lKh @ iBfBS}27omPÇf8a>_S{wywl3t25K0A ~K5:Wkw5p5%i^g! D 9}kpͬG|n㚇kxe7].'mT<Й8`07Pg솀_\Glt+/M)@ǭUBi?f'A:ii!! e dy}7.5GG T}#7io#Kh$&Rdrai~S ǨT&LDkwV@Ccy꿅>`,v[EN%Hm yxe~?|1J}/,nK3V]ߏHi |9t$5TQyyST=.!sb-1Cԥ@$"S.:5)xauCʳk})D-8l?\uo,J7)~Rᑲ4[HS|" J(<ڂO(~;3><5z90ث{u7C@Bp֐JFmqR@+j9Np3.`-D6R͹`E.`vá+LQgU0Il-B kTQ@'V$7W.8hks%4-N&=+f ?XM,.#nEb4<9ZC}:,׳I- '}׹G0^wn6čjӰ@%e(ԏ$6(~ݸ!MGu6'FiڻJUۦ/) ގk謇87@ڲ R: GR^ŭuuW5j<ЇIBleݦ12;m0[N5,"7oqnCͪT<0µ[QB%`%m9,/BTSv;ǽ+U|CMW=EXy!~Z- <  WUT[7?S3+ "|?AK,b2B{2miףp U^E(Z}4J?p1cduusZەԞ|&3JnfMU!ZD v@*E(Z-{Z>p;LId]*'z Է!l @_L7>#ˆjtM)vAn@#0iYy8TJ# *+ui@Gj}z([<~1 {~ˢ  0zzTb^KF!M$ro>CRYDFgFIU- NEn AQigf5 5M),uWo .<sӗllv_+)~t&ɽIZ.Nc:9!+\ks_cfggm1JT]eZAA"#WWiJ4-M?F`Оx=L2p$YAZ83Ⱦ{{.G;m`ZDYht닥g{ F"[)F*ct )+NF;VH'OQ$6W}{x }T o+K~HT^AINgJD~s%j{O>~]xml_#ߎHn֔Uc*5:~׿ e\!u+yzX[;R/}dsjމ>ff$ۄ'ÀX9"E9+K-yHoZ),nXoƁYۻ uqgߗUYTp\sτHRy/C7i4mk"HhGwflB\a^{-PLuQ~72qhӈ'D~TJq=h*:*]{ԝf h]cRiqU򯢪]FtJ?Hq-$޻^ 3zj'iapE_O~.Nk[t_QJDZr_pңʈ\vw:?s_'U=;t*6& ;몘(؉ XHXҰlN3g3;ߧ} H4-?fzN|nyjPkRHҘA"jHud.HVJkqFDRڤ&!UR*PQZL̫0 =PPSiLJle$LFNm'@2PZz>!K Z33Wosjkzs$J+7ݛZ}U`WHJd!z/ď:m2G|Bc"u Ɂ$kiP4ZqA^2ZhdI"FwMΓЙC93d)Um%u 2ijfE|`4$k5D_ByPlN)"r8d^qp+-ݢtCdg&za5Phح_ 2% "BRV3h1(/)K~.:cΐ2OKB y$ 9r4P)"He$k6cmmw.66"SYSǺ*ף=@SO/*gWEN/T44G9sZ$ڛSF:]E>p nL7U짐@yi_5.aVw8URnjEf!dǧDDՙJ5/ˇ(lx:g\ ѵmϣgM)/h܋ Nbf}hW|4*Ւͭic@`oE_h?"s_{ jK~&5%n Y1 QDϥ 6lU8֮~&!Y;3\&HVZ2=X/YʿܧIu%I @, d ZAmBZwXo6㌁O: W \v ~h&kQL%HX!L'caJ?ܑ~&@X&Zȼ+H-%z/,2H&kNP`'_ɠ+6{Ut-ø: 2׉-7pT,87cAӏܬH+y7鐰: mvJ[It2< TeĬ4p rDMfa"ADB+nMk  Mo3WrPVt"VB_buwPбO,%P;P'5 s~ nT|!{Xu+ YXAhPW',Z1GPYإqs{pnI prMO E[^SOv:H SU9=O$㩁+؀T~'ō:҈dq˱yN^-x}>WIŀ *s?xȖ WNx>\V)[71E@S] ob6. hw1%GʠCnC[EJR"yKޗ@ѵhia[uG~k7b jCVmr^06 ,ԫۣwOQh'BDs &]گH/ELYث93,H}$*G9f@uki_&ޙ|r߿/V uqdkVm=xY&.HAԵ ؊ǏR$GVZC.Ncg)6Z;wѝRRimMKA;h@e1+\3dEK:FS;Og D7X@HJ.Lei, D4jHjY2!9px+7ݟd.|mV?x|^%K~+1,QFp rv @s3qsr5} k^zU@) $Z Ƌt&Aj@@xS$ 53挓 H핖Rʅp y2  @ oׄ_ #9?jnƉYf7T`Hx>ZUl{r օ\F7*‹% M+k!A^5ï&Q]D|Dot>F&+[ò)NOE:7yKe nED #Dp2,^DFP53#hׁ.+?9)-%Qv~JIP2!IƢJ~; fo!JwǺI,{j0~Lpv Xj[Rs)#QPeġ\.z@NnrTuZhNNIl$X '>jTSຉ5{;D!Kx$E|Y\Ł'ECȱD~h(+H*;y#9 *jټ\6i @'zI WK4 g r^~pCeI5W"Pil3quf7QTp/Kg?qwgR2 h1x tRV ZЕ P\QQ+p7Zn G)q:&pz,*:9qA MDI)N Fa&b}8haL=*M R. -Z$P9|UW8V-4_Q}$4*7 ̅?ޗ5U%覿ēPEjI-:FAQ.<BD`;mGI]qIߋ|D1dW"W=Xڕ)hlj~ZVZ@P=h FRmI'+j&%Ri I/k]any ȵ0$mL ~H}~YF]5fvϖyP?  3!Izv.>fnmdzeE3Jn$dDmDeif}U,F'l)܊;$sov񅤓$&E$n Uj4q6;I8pHH8ק,ѻNF.LpEhRb3gH۝wL(5>E,tfز9L|R| :Mo $}lJ5 I,'a}llSltULU~/A+\tBF,1δZ pj&Et"Q+׀`(B޸ET昼"8[~n\+`Nb@@Ri%M~_=(Hɪc6ŵkrjpJҏ0uf5h_C!@& _ fX%[?ɞOT0_|.KwcYћvw]i\ȣ" l&WY+KHwyY~(6#( Cܑ=ӝ/Iƻ.GD-'Q|$+멣SH4XO'Κn#PHUghnm-*`U7."M0؍DYԾ(i- ;6`~kf$~L3yhJQrD 9ˊS*E7Oƈ_kak؄ bpqw$6ɖ ~DE^\~+w&U0c88 hkA>G>p>q^I=Go{e*h/%+E1 2(pMUɩR06VLS90K$S}:!( @aW-m_eg?j;O8>^k~52ДDaGl)!d8hXc[Xèt:ʞIyϦơ,t4=-"`{Q"H#"CtP'٫^ٹEDh#ܦ0R"a{fTΟmQ c:@:/Fc^Q'_R#AGD `W.BDrKӰ! -'^*yhTaZR!.W j%{euXBPfI3VjYC2n쓢 [yIbƤZdUTB bWJ/*l"[QR{ɤ0i}MJrB@(cUªMc9LtVtIYˢ_F ͏Hkc9+ݵ%g(>45:h`0R[[kKKKB0kyEJ91NXtfN&;PO7[VQj-Di,տ<$ WqFBaΓT21mFAeHRyD Jz{pъCnDb.3qQ&Q-ʎ?%* p0r3td7:dn$J*J0Jw~ rNd7RR f<sbn H i{=D N׬uC16nH6pxnWX mU!ʉ{qp"$D7[Ք^6,R-@9Ǫt iI`툐@I(q&oU& +=G$܇8 D&K*nmhV?JD5b(kyOE}/@uEw~Q0wy≙xWԺJ5C¬I6‚_3'ԇ%_n|s,Շ`j T=lVQX*+&^^^"d9xtt%M h BBZu;* '3[#h|.J$UE­+-K5(lM)/Vv ` 6δ@h6ss5OJ>Xf¯_wa5p/DyWCGpi.x˥үd8)˅$MPlQ4hUGH}0DSM(ފN6KLlE QVH +z Q$ _ED d?޳\`~j19ԛVm+WA/=PYqn[KƸiG n?L?QRUca?R4[U&OPP_M<0afU~xI`{·ş#>4kJ.=e0jŪ/q/>aS f5 H# uC"eS`yBG$cmƁOKS&"YQ=;+Q '*-.$x=@9f7Qڀ-e(ꃺO-}?^ߛLM~T пz0@e6c= ,)%ͥH- I l"/,>Օ%vCLQ/1ƒӦ@x`hF<.QΜCW=vp+D}`Yrp 5g;\IJ:+Ip]x74k2 C!PK.KQJi~]aFHׂ,[ZBZUvs8Ơ1]t\X)牚2v6oŢj76[ģV {&} nVY 9a4~l< XWar>ZMYNκh7'$zIA_xBhqOd'1zqn$!l B(;+=i ~QZdZ 3ª A:~- ~_e/F¯b7Mj&T ={uTqV}?!7 nO9WV7nC `c 6+1u,X, yW0mDҲ.{/h* ɴEFF=H}K=TR U /49HY+HiFI|3ԐMԈ<l;.V|""+V+=6 ʍBG~ѹi?D`(aj01 7&, <"9lXN$+ ޗJ 89."|4߯r- "r=מl\~٥ sms.|z ws9 _+>D+#pJ8DϮ>_$XO`" TyQ <1wINou)@K;*.HN!t6p ~"v`R35Q{UYM_cΘvɰ_U)4>' /b1<{7_m>₉iހ|>ߗV|/x<0MnK W}=ZӅs2o0"SZQPJFE-\;%z3@J8l'JD$o;L&^zTUlVd殭כ8{AE)'1ۛGjWI|&d՘#JqZ68V AZaIJC4J 7%9=_^=b$/`۸q.Sm-^:3>_y׍05blٱSLddѿ$U,Wrrf. Gicl&z .RȆe4bTFh}Uyc&eq IiUu(,qݤ{ׄ_^/3!MM=GU_tE4eui7rEdEd (Wlk,4YcV5_zCLGnN{=%u .d\xjX_# lT~^扠2QZ8N&;n0)-DEq͓$M27ZOH\m;>R+z%SBh۩WlSc#*RslL)q&zUn-tA vWz`MNb17Ԗ"LXu?WFF:no=Ft]UUUbڴiU+#{lwŗ\r\))XCO< ȧ}.݇T.!|jV0]QD `Jrҽg*@v$lB>oژJ {nq[ /ze$VXv7< BA,.NNhC0v:ӳP- ~؇P S;Fuy3UeGd8e%"XCrQ@5*(j蕪~ qw}POd[ OG#G'.nV%5AVhG 뿤D^>nǟ.;hQEu;DMa>2N9)m9\V`ۆMزj5T(:LuN/Cu8&f-j7 @-%sϛܓ@v]peF(H+28!=05nL72d2Њ_YG{\m.4 944B K-+m[{98StFV-E4Az<8tً~ _} K8+3}1N:DTPP!Cc֭"־ o5@֭ }>?{V.& 0ȼ?:\1 i#~@/@JI$55v~i.ÝS'gϞG}/~< dzE\>pJ\7~kDZx_åOr )w>v=z`=w㲋.8mÖmxq`VsK࡮f7-Iz=^fV{5Q@Ty3|xr\hsyWb86}Jjaw_5Jc_)B uR'w IADh'E+ˊ685obɒE8䓏ao<_~]~s]︟(9V< S'tM}n q _qEWg!3WVVQ~ mCMíl8b)Ïpw.Ҙl .u)WkV*2yݘghסޚ281_G5Sǯoa mmG_8PsN~ۗ]](UҴ/Fop6(ZUڤD#<(YCӳfE)X y85~lg9ZD1@?70 j((N7vBq CpT`:So,&u̓l[-/=m[g mg3Q"t:Rtؿu^ Hp`Xǂmeƛ4⦛o'7ǹL{txgh{qpg`-6 >܇;'_`3L6dK *j[2xf'a%ػaOZѮd킒(]"*f$Qpf8ΰEWcQ Ԃ*/@^B-d91&A7o{}׾kI7pNx0_uI `m[,6\ U֕!I0[c~.݇LJxT8={!e"0 |\=Yn.  66 {8TpC s漙ȣ4cIxi9mSo9}/W 7z;n>`.<4[[-]:at+pk T2l/+F;j{6E}NNB:rOʷB|tyEu:!)ˉ0'';k,hFx*Ի =$<#$Uȃ` *r  05InAc$4Bf;+GKè?ou3>cؼ~=f?0Ri2[¢mmK3f2W?O>zg2=&N}'b˄C;݈9e8f!o3סB\6`۳ oZ]_tkh<we~8o_,Z6q˚s[n3gnI@ +W`|~?e+,ڷ3=o̘Ӂ7/GΣ6~r5^|1>m8fώ#QYR;n8.f̹o7k8b٧V`L<'=SنQWW'u}(fպ˱ѣ{w,_8!XA=tpQg0r0qa?aE@ࠝ7ބ[a矡}vx}>N`8~㽷0wZr]Q%v) i.ZfVԢhC>LdZUsFݏe2&SM ÍAiAv`oPCDz$2ރ2OTh>7Ơ lRd8D='Am@IfTwHѴjk?Y[#݁ 3p )}N1ZÆ߯00pi~4}xW Y|~/2L@QQط/_a 7Xp:vhun}>_<}-[4pZpS8hȊؿJD=<13Ҝ|nG$-CaRoM5A87 eR4\մ6!-;'wJ%}_iK(^yb;w=h&Z8yCe%Ӕ4HPr6+B.CMR%HI~S%>@NG!0j>w?;W23y3~ixNiO=o8ǯ`-׈SvnلgnKǐ)x眆 +݀xpS6fÇLj#֛o$K. ?dfe_EὛlW ZbGM6aUCPVZH*,Y9@fc8V)wC>}@ݣ ' ~\c(>PCKD(7 $+*ׯ-lԠBa}%.ŘGyƨְwuaY)k:xL1Q7rk3!<$/ %ܓbq1*E1hgZʉZ5IVDT4؉P%áUn Un=tχ@11@ nr\.֮^L_?0ǐO/&8p#LDG஧}'nFT}K{1-fy\4h8FHm >ԉRC^"%NLgy _g8nJ`XT\? Lpë>Ll޼Eo3|ӟ޽` &{`%R3ʑH00̜gaO* $ kKа CHK2~b/7Klj{o3aoDf! EP muFD~4RD#Z[1w'@ [: i@9*M:@V<1Ղ(M퐯rœźV(DS~[d'rz8xܜx'e =7\Kc3? `?*NJq;l7ƀA#0އ 0 9L, `ƪ1# |G1 ~9XLDmo͞{X:L[HXt1ڷkg8ǟ~CGCǎXg6 #g쉁4YA"0""^R3$W6|jI7\&̃CxĂRəuU.=7US*yVa'f"jCP#:@D;a[t2IJnLk~UQ"i}!W#cfpW> "úvtƛXxQB#݁4_2!!xp\F08&y­+/0q:<{5w`8S m߼M 2cM cǏS3>lذbe6ê X 8hkPQYE/ A4̙6neI̙3}]p1oVƸ@͆4yJA*Qں$ф$\~`xF_hJzrƱ g"x{f&8`N/hDG 2?Q0$1cEmM 6&\=D}K2xX|%>xnBo,jZs6­Iڹ uHyn%$GZM:=@3o4/R d$H\#~ ObBȁDR3XP@_ j5~ZV>s ̆KaqB$MO;.^L%&_7:z+˅GSG0 tTV'7OMYNEK_Z܌_HqNznvv-0n(r./p r^7 p =N< EE5w4î@2N baM$Dg틏>,ۈaxW AWk6+.6mA`1F^}E'<@ .UNOh ꖆsSӐArФtU\ŇE (OR^l&X9 \S\AOu_A RM 1~u9*[dIk@=yE., @;ݨK?~`ǁMS /0 jh&!&`n`m ǭ!rX"j@]p͘0HI1^͛6c"C6pIFb/׫4`SQ%eB6'@v/H0n^ :O?FZ[Cp3>\<8tc?؄îWc@q1nFAۍ$ݷ747~m1r/B0Ο%saƉb rPK޸\XPKIhDدžfe|9.xʃѴhgT͹oG4{oƥoNK-Io V"Zok~Wg]y0d8H<18lz} 3ƱpEd;sJ f6>ziƤV!U *89z/-V}/3 <*Vo˂tKk"*e=jy ͎oDÜb!#RUidb Qa{Hۼ?jw}{'G SD #fao,Q#hx^>().7_ȑc׶  6F51*"n~"~8K{ bz-z<P3 1J],'f {UCÏ?E`ԨxgE=mLȣ0e]xͷ`Xcǡk$'~kVLXˀKBڵ 3ZE_8tHo]t V=\Yz1C[~K-jIk)Vd2`׼0C1B#!B*Ph"aKT_ @VY`ȺI*7߫8?dxf+6hBxs-|5h  p[㏍6b,8=)Z}'NO0\1* t^K 8"oahnxx` zY# >+&`:8V,6- wEepSxgpg4p 6Dz<كZ޽JXAInm} )~%͊` ( I䢝V#J?F !-|.]= |8RDG/##w*uu^s2`u?kݧ_]͎31׌kƌj=o[n-WƍA?Gz8alx C=3EB{pcK=(Y؄wS孄p3)97! lC*C+=\Xa0J+tEy8b+2?*"%p߉H>#S܋@ $x%!ݫ~ 9 xl16fo֮N\.뚱10rBA8lq\WĨ1",ч4p}LpfE`,QYzVU՘v"F4{Ы 0jXQ㑇AII)_7O<(BG^'1_Jt|= UW ָ=M_= "B{M;܄HXw#` ţ`!8K~b H̡ V.; ܅Eb27yn>> @U4_b oAa>;݋[^ =Sp4(0ډs}~@a~*70+h*@j4z"Lb:tF?MHJchZ?Z{-;dH>φ@NOf*dт(;bʾeďˋ?aڞѸ˖M3zԈf?7 ³*9%gF`ÆM35~Kl,ws_I O7HVx.#fg[11gZ_$0"{w59ٽsaolލh bv.(CpQK{4bfw1:Topx1Ӻ#W:BXRTog1}Lp,.7\%@S|fOY.{t]ٶ*+>a1G2h${ݹr_X,(ޚ6|Q z~ 7 |"# Oвr"_g497#ubaآ={pک8#znXoqc>e˖Dc $PYkFAx8gË/]i5^[o]0hy=XBz;OC| ~pxD.Ns҅k{0i֙Ihu!XpЃu%Q` Zn5۫h4NfBi9ptFqו\#CVS MW&z%H7'-=K_}lㆠ +s߹}_g${S [.V`"~q*;EͿX8~ b^c܀cvls zҽ`waΝ 8}۶pmp'ozN;}rT/~*S6<W}R5<_۷c;E='㷲[tTY$ 0r^,|*uսf]Ja;#3!nJ䜞 [>t2 JބǏ[2L;87隸V#>!eH'/SbAg,8 j48a71n^zyfz+H;dD~p M ]|>oo^̌fxėƊXcm(hh"(.)3Nfppgxz=cqbOO<wv3 1 EE%~7Mqi71>3q't$zhgˢ rʵOem-B02I.mj- l+k5U߇[ gZ4" m(]^njzd si0܏d 1C rȒCVۏ}lc|L `޽F())IE+JM)%vSqja]>' > ?xLzXII=bZ*R F[B6 +[7rpd8qKl^jvQΝ;" lZn$VXߎ/vq7+V}k_" p6SR9*np17݄TҰ$Tyj5%A0Ԃ3~~=l0)4#f+#77acA<ljrG_r>fwMB';N=aHPLco# EBOV^*- \l jw$ION<:}f4Tsqh*&K O@qQ'TyqZ2rqy B V_ IjuUJiB5~HUu{}^`퓦 6ٵc8; vk|~(&mbJҫ"8FvH$$rY"p!jQʾfx)a1 uw9ȩ:4nŕ 6uzbȁT<Ÿ\%#}FTdoC3 i"yZTd*SϹlSKFK}rauYDm('ޙ{8x]*"24ֺHeGk276G |pD)U0N,&nq0*\8ؒZ%UVWC16dlbtm-Z+;'ϓYV18Db"]1nDzt` R73]h$E#aUC1+l4t Htl?J6,"GwڽЎKf„$-[%瞅__)#rpb"S捉.Mt}'dڍpZӇ/5A1Ja!Dzi"wb~s-YRUί!~uGUɶRG>4{:t]@ݕ5sV{1[DtJŵ1zP&j~r'g[κ.o2 ,Nv!l)J< N9T3辄6s1Q |S$ 9*G0˩lf3rRRanuE²Sr`)pC) q8!e?CaH瞜 {])PX1>JJ딆iq2oauY&061:#m, e&rtd"aɂ1!GiB5:*( i¯t r@.<;9GwB`Xb˱+z ]&*FěQU0)H*s~<>)˴¦2 ˊPZZ-hīٹTW^L$N6ԢtG%493x;%ɂb7+.I-Jm~-*T5?MqPΉ9pf;07ydW{r-W+Ssg; +͕rתׯuss5?3pm\$vF%b ^78.~x'l˽U: Ng]Nh21Rz t=:#5XڱuL\hiEOEغ_{"Ut\v; d_DP$DF!>ADQD%(Ѡ" \l.^2;ߪSdw|Pէj4۔sz H&U.N!H~t ׹P>*cKT]F: _]O 8ĉ@V 9h+V˗W X߇?_Z N=| 0SGQ|0Eg^,jU*"ojq Ǝ0M'ӷhHu]ͷy-):=&fc)$_B}&R׿G}:4&!'s=L^e[>rtku6w*ngm**4Q;!'qg֨$yD34ӊ0}rdڀ uN$q5|>q@3NE~*%N|ס{ݪ?s$2hd0A%  /t9t<&j8] aк rļO :l6C"uZ; T_.<҆bOnԯ4An*+4TL(~֦ORo,;ߢw@Vt{(?/e[|x$\yx'dlRى #@&t ܸf+zpt؟G*镖m70Cŗ? Uy߉@j/?^:<T8p0ҴWǹӁW,s q O"onM;zcn0Y=LVR}WtMFy$E5ճyYhaO~1nl4*~;)d"/cAyJ]OIAP' \ (f@VXq#]D.>Da[Rּno U XȸL4<ǟrchL~0BS<}DJ|a0(*Ӿcq@ t%vZWH@MvzwUXExA]NWikXKXB3j%DYr.nRvYlw mcAAH#0 0g?vz.V;7vHxe8dT3@.'\JɌ؄>ߠJ\ŴM V}LK3^X^Z,0BNZ #OAFsԋв f:_,ӋKMӛ\v gl~k4c(>Bޏ/MKp}(ppJM@Ef>TժH n:#B ?Ix|B]j+^ #1C#!Ck >v7G($o:MYS րK Զ~yoUd0f'tÔΥRƎu)?O' vO __^npAPo`4x0~fi_)YH$v-7jRJ*:m ; }#)ܱ 8-:^GUIͨdzy Eo!kJt[zF<*ur6P H"!b vyBa*Lx0N14GM۩5fG]uvߞR{$V@l!k0LӇi +Ivc/8 aG$qY1L& AD1GyX }(vXk{z~Aw}c*NɔΗƥzKs0\dqgƲdѮ9.˜\{lh|yWK0>x ML0w_J8%_OӓvZ䔀2SY#B  A%b۩l)f頌gg.ǎ* ZY+QK.d1fx.j¶`._|6xcK~+OcBd*79? 7`p=A:eGfN1DnaB)%\ZX.,Uhu}$!՜:0UeŔ< cU.=Q/RB?(WTF~ _5`p=!1;9$ٚ)N9$jwhir !]v G瘪.jWb$vۡ?]F?u#dw}rLfKNyc$0 9S >2e340ՇoMUwԳ5P1`Dz>v,M(uԯ28l:lJ/7#+`?!we(hX4`O,B*AKm4L|3L$_[5Bʃm'&V7˔M%ia _+sNZ 2Lc̟;?!G2C z@dFcDp+#Sl;phx~\p EVdR‚fsӦ :]iQErFg44>Vׯx2U{>iI&'L&Z#*@) }to;JIgj-R kYJu?uܫ4pl#C_ \4gŴnJx*EsL3Yf`vCo;fEm]U_VSǵrV.FSb*'+~ (ˆl謄U* =QufwjuJDZZl2ͲlD(|WnF 54T-aTi'QS 2JaCg&tTr|B@Ɍ܊"ߟ)ϡ29B FT P է 2 ucLSc‹G,߇'|jl&0lsAПW*+jg˻,!?<ּ @ke`@Iߎ#6/;W%҅^J>PL#+aB'uu (gzSnTj!\э!5_)A6wKh!(D_D]UPDmSU|=gjQ%!xG  \Pˆ*TԀ:R)$@'Q L (J!p A37%FD󓾎J )("~%wt==Fx$ T@n!<#H4 QtձMm,tTrU)6;|_ᚐ85v{$$ *s@fh:Ŷi=20x ?7J `þޗ~icS@}uF%@-X DZ{6k;ip!["w@tmBzI='4&&)>KhU    @͗$ U3@ 5۠g(PM8 K3m }mCl  H`B3W{2B-5)uQ.?dutsto$ -w\TD MUU7``0:@@X*|GꄏQmo70{D@&0PI@%>y!5N}D1K{AyFPa``0܈Ǩ-|Jk>#W| %# 1 c00?luIENDB`(  !&+/244555431-(#  #,4=GQYagkmopponmid]ULB8.%  +8FTamx|reXI:-!  -=O`psbP=-  %7Lau$ @_s!$$$ $ $ $ # ~iP 1uaK6$  )>Vm!K{# ($,(-)-)-)-)-)-)-)-)-)-*-*-*-*-*-*-*-,*+%'#\ )lT<'  (?Zs <w$"+(,),),),),),),),),),),),),),+,,,,,,,,,,,,,,,,,,,,,-,.,/'-&B pV<%":Ws 4z&&,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,,,-,-,-,-,-,.,.,.,.,.-0,/,.,.,.,/-3(2'y 1pS7 1OmW#%,,,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,.,/,/,/,/,/,/,/,0,0-1.2'*+/,1,1,1,1,1,1,2,7$3MiI- %@af&(,-,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.,0,0,0,0,0,0,0,0,1.4).".5,2,2,2,2,3,3,2,2-8'9$[|\<!/Or\'*,-,-,-,-,-,-,-,-,-,-,-,,,-,.,/,0,1,2,2,1,/,2,3,3,3,3,3,2,3.5-3  +3-5,5,5,5,5,6,6,5,5,5.:'< NmJ+ 8\C$),.,-,-,-,-,.,.,.,-,-,.+1+2+1+2+3+4+4+4+4+4+4+3+4+4+4+4+4+4,5-6"( -8+6+6+6+6+7,7,7,7,8,7,6-=#: ,zW4  !@f"+/,.,.,.,.,.,.,.,.,.,.,1+4+5+5+5+5+5+5+5+5+5+6+6+6+6+6+6+6,7.9'0)4,8+8+8+8+8,9,9,9,9,:,:,9,8+@1ra; %FnI&-,/,/,/,/,/,/,/,/,/,/,2+5+7+7+7+7+7+7+7+7+7+7+7+7+7+7+7+7+7-:*6!-<+9+:+:+:,:,;,;,;,;,<,<,<,:,>&B ,iB" &Js"v+0,0,0,0,0,0,0,0,0,0,2+6+9+9+9+9+9+9+9+9+9+9+9+9+9+9+9+9+9+9,9( )8,;+<+<+<,<,<,=,=,<,=,>,>,>,=,<+D+]oF%'L *+2+0+0+1+1+1+0+0+0+2+7*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:,;#-?+<+=+=+=+=+>+>+>+>+?+?+?+?+@+=,C:sJ% &L 2$/+1+1+2+2+2+2+1+1+3*8*;*<*<*<*<*<*<*<*<*<*<*<*<*<*<*<*<*<*<+=+=+=  )=,>+?+?+?+?+?+@+@+@+A+A+A+A+B+B+@+B$E uJ%  #I ?'3+1+2+2+2+2+2+2+3*8*<*>*=*=*=*>*>*>*>*>*>*>*>*>*>*>*>+@-B,@*=(;)<'9*-C+@+A+A+A+A+B+B+B+B+C+C+C+C+D+D+C+B'I!sG"  D A'3+3+3+3+3+3+2+4*9*=*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*@,B+@#5$     ,C+B+B+C+C+C+C+D+D+D+D+E+E+E+E+F+F+E+D)L -oB =E(5+3+4+4+4+4+3*8*>*A*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@,C+B. "5-F+C+D+D+D+D+E+E+E+E+F+F+F+F+G+G+G+G+E)M .j<4Ez(7+4+5+5+5+5+4*9)B)C)B)B)B)B)B)B)B)B)B)B)B)B)B)B*C+F"7 ,I*E*E*F*F*F*F*G*G*G*G*H*H*H*H*I*I*I*J*H(L a4 * 3g&6+5+5+5+5+5+5+7)B)D)D)D)D)D)D)D)D)D)D)D)D)D)D)D*F)D&'@+H*G*H*H*H*H*I*I*I*I*J*J*J*J*K*K*K*K*L*I&M W+O#6+6+6+7+7+7+7+6)A)G)F)F)F)F)F)F)F)F)F)F)F)F)F)F+I$= -,L*H*I*J*J*J*J*K*K*K*K*L*L*L*L*M*M*M*M*M)J#M{J! 9 4+7+7+8+8+8+8+7*<)H)H)H)H)H)H)H)H)H)H)H)H)H)H)H+L3 +L*K*K*L*L*L*L*L*M*M*M*N*N*N*N*O*O*O*O*P*O*MEm< *+}*9*7*8*8*8*8*8*9(F(I(I(I(I(I(I(I(I(I(I(I(I(I)J*M,#@+O)L)M)M)M)M)M)N)N)N)O)O)O)O)P)P)P)P)Q)R)Q)Q1`\.Q_(9*8*9*8*8*8*9*7)A(J(J(J(J(J(J(J(J(J(J(J(J(I(K)L%)+R)M)N)O)O)O)O)P)P)P)P)Q)Q)Q)Q)R)R)R)S)S)S(Q(X /|J 3#:*8*:*:*:*9*:*9+?*N*O)M(L(K(L(L(L(L(L(L(L(K)M*O# )P)P)P)P)Q)Q)Q)Q)R)R)R)R)S)S)S)T)T)T)S)T)T)T)R#Nj7 2*;*:*;*:*;+<,>*:$?:9$E)P)P(M(M(N(N(N(N(M(O)P$:"A!"C*T)R)R)S)S)S)R)S)S)S)S)T)T)T)U)V)V)U)V)V)V)V(U:uS% LI(;*;*<*<*<,>'7 #F*S(O(P(P(P(P(P*T):*T*S)S)Q 0+X)T)T)T)T)T)T)T)U)U)U)V)V)V)V)W)W)W)X)X)X)X)W(Z 0p< !9*;*<*<+>,>' !E(T'Q'Q'Q'Q)V1++X'Q'Q'Q)U+ *W(U(U(U(V(V(V(V(V(W(W(X(X(X(X(Y(Y(Y(Y(Z(Z(Z(Z)X!KV& &oY)=*=*=,@(:&P(T'R'R)V?>)V'R'R'R*V=$M)X(V(V(W(W(W(W(X(X(X(Y(Y(Y(Y(Z(Z(Z(Z([([([([)[(Y2Xp;%:*=*>,@&8 3)X'T(V$O 2)Y'T'T'T(V%N ?*](X(X(Y(Z(Z(Z(Z(Z(Z(Z([([([([(\(\(\(](](])])_(\%ZT$  *|Y*?*>,B%6 'V'W(Y%#*\'V'V(V(V)Y )*^(Z([([([([([([(\(](](](](](](_(_(_(^(`(`)`)a)`)`)Zl7%8*?+A'; !J)\!J 'V'X'W(W(W*[+ )](\(\(\(](](](](^(^(^(_(_(_(_(`(`(`(`(a(a)a)b)b)a#VL!oD(?*A)A :+d0$R(\'Y'Y'Y)^>"R(a'^'^'^'_'_'_'_'`'`'`'a'a'a'a'b'b(b(b(c(c(c(d(d(d,Va- %1)C+E$,*d# I(^'['['[(] KD)d'`'`'`'a'a'a'a'b'b'a'c'c'c'b'c'c(c(d(d(d(d(d(e(c Rv=M'(>+E#8 5C #(b$<)a'\'\'\(]&Z 3)f'a'a'a'b'b'b'b'c'c'c'd'd'd'd'e(d(d(e(f(f(f(g(g(g'd !9O ")j)D+FF)g)d  (b$-*e'^'^'^'^(a  (g'c'c'c'd'd'd'd'e'e'e'e'f'f'f'g(g(g(g(h(h(h(i(i(i'fPb-  &7+H!6'a&a'b  (d%!)f'a'`'`'`(d+&c'f'e'e'f'f'f'f'g'g'g'g'h'h'h'h(i(i(i(i(j(j(j(k(k(k#^ s;m)(B+I &b&b'c  (e& &a&c&b&b&b(g< X'j&g&g&g&g&g&g&g&i&h&h'i'j'j'j'k'k'k'k'l'l'l'l'l'l'l "GI#,f*H%? &c&c'e  (g&$]'e&c&c&c(gJN'l&h&h&i&i&i&i&i&j&j&j'k'k'k'k'l'l'l'l'm'm'm'n'n'n'nEX%'6+K. &e&e'f (i'"Y'h&e&e&e'h UA(o&j&j&j&k&k&k&k&l&l'l'm'm'm'm'n'n'n'n'n'o'o'o'p'p'p!`f/ X)@+M &g&g'h (k(R'j&g&g&g'i$` 0(p&l&l&l&m&m&m&m&n&n'n'n'o'o'o'o'p'p'p'q'q'q'q'r'r'r&p 4r8# 9)G)I  %i%i&j ! 'm(I'l%i%i%i%i&j #&q%n%m%m%n%o&o&o&o&o&o&p&q&q&q&q&q&q&q&r&r&r&r&t&t&t&t8n}B&+g*K'E %k%k&l ! 'o)A'o%j%k%k%k&n &r%p%p%p%p%q&q&q&q&q&q&q&r&s&s&s&s&t&t&t&u&t&t&u&u&u&uOL(6*M'F %l%l&m " 'p)7'r%l%l%l%l&p+#k&s%q%q%r&r&r&r&r&s&s&s&t&t&t&t&u&u&u&u&v&v&v&v&v&v&v dU# 6);*N'G %m%m&o " 'q*0't%n%n%n%n&s7 d&v%s%s%s&t&t&t&t&u&u&u&u&v&v&v&w&w&w&w&x&x&x&x&x&x&x$r \( !%)B*O'G %o%o&q # !'s+ ('w%p%p%p%p'u@^&y%u%u&u&v&v&v&v&w&w&w&w&x&x&x&y&y&y&y&z&z&z&z&z&z&z&y "Bc, ')1)G)O&H $q$q%t $ !&u, #%u$r$r$r$r&xKZ&}%w%w%w%x%x%x%x%y%y%y%y%z%z%z%z%{%{%{%|%|%|%|%|%|%|%|5cg0 (*I)J)O&I  >$s$s%u " )&y, %t$u$t$t$t&zPT'%y%x%y%z%z%z%z%{%{%{%{%|%|%|%|%}%}%}%}%}%}%}%}%}%}%}Ek2*,])K*N&I  (M!h$t&y$t&z"k 8'~, $t$w$u$u$u&zYQ'%z%z%z%{%{%{%{%|%|%|%|%}%}%}%~%~%~%~%%%%%%%%Qm4*-e)J*L'G= g&{&{%x$w%y#t` 'Q'-#r%y$w$w$w&|[G'%|%|%|%}%}%}%}%~%~%~%~%%%%%%%%%%%%%%%Zp5)9m)G*I&G? h%{$y#w#w$y!q ( !q%~ -"s${#y#y#y$~_G&$~$~$~$$$$$$$$$$$$$$$$$$$$$$%er7(Gf*D*E(S&s%s$s$u#v#w${ oH%$} ."u$}#{#{#{$hI&$$$$$$$$$$$$$$$$$$$$$$$$$%hs8(Od+A*A)W&i%l%p$s$u$w$z o @$}#|$~ ."w$~#|#|#|$jC&$$$$$$$$$$$$$$$$$$$$$$$%%&ks8*Gd,@+?)X(c'g&k%n%q$t%x!m 1 p$#}#}$ /"y$#~#~#~$k<%$$$$$$$$$$$$$$$$$$$$$%%%'(#yq6-=d-;,?*V)[(a'f'i&l&o&t"j `$#~#$ 0"{$###$l  ?%$$$$$$$$$$$$$$$$$$$%%%&'()$m3/@c0=-B,N*T)Y(^(b'f&i&m$kB,f#"# 1"|$###$l I&$$$##########$$$$$%%&&'()+&f/ /B]0B0B/E.M.T,Z+]+b*e)h)k)s(u%l-"~## 2"{$$$~$}% j U'%%%%$$$$$$$$%%%%&&''')*+,.'_* /DC0E0C1D);!5111+68G(e)m%fN%$ 1#w&~%|%{&z(^  U*'''&&&&&&&&&&'''(())*+,./1&}W%/G90G0F3J *\*`)f %{&/$t'{'x(x(v*{Z  W,**))))((((()))***+,-./0135$sO1J'1J0I3L -P,V,[ c(|- (s)t)s*s*r-u!T  d0--,,,++++++,,,--../012357:^E1M1L1K4O 0F/I/NF*x+ ,o,l-i-g/d4g#C  &i953320//...///00122345689:;T{u:1O1Oн1N4R 0G1F1F3.o'2`2]2\3[3]6e!@ *s;89:98988777667778899;;;;;;A\i11QК1P4U 0J1I1J%0`#!6`2[3]3_3a5g9 !-{:89999:::;;;;;;;;;;;;;;;;;9 *[( 2Sn2S5X 1L2L2M5Q(6c3_3`3b3c5j2 +199999:::;;;;;;;;;;;;;;;;;;4 M2V72V5[ 1O2O2O 5S06f3a3c3d3f6k* 449999::::;;;;;;;;;;;;;;;;;;,x?2X2Y5]* 2S2R2R!5V <6h3d3f4g4h6m  "" ?9999::::;;;;;;;;;;;;;;;;;;;"fg12\2[չ4^(H 1R5X3V"6[-77m4g4h4j4l5o  "'&O;99::::;;;;;;;;;;;;;;;;;;;;?ZU$3]z3^4`! -L/Q #5[-N/^8q6o6p8v.a "',*b;9::::;;;;;;;;;;;;;;;;;;;;6C3`33`4b/W $4\5^#> :*X-a*Y #(,0/"t<::::;;;;;;;;;;;;;;;;;;;;;,g13c3c3b6f)N&4_2\5a ;  $(,156*<:::;;;;;;;;;;;;;;;;;;;;;;X}Q"3eۉ3f3d6i(N '5c3_3`6e'I  !%)-158D1<::;;;;;;;;;;;;;;;;;;;;;;8 ,~;4g14h4g4g6k-X '5e3b3c3c5h.Z! "&*.16:;R8;:;;;;;;;;;;;;;;;;;;;;;;;,Z( 4j4k4j4i4h6l3e,,6j3e3f3f4f5j5i!C #'+.37;?@e<:;;;;;;;;;;;;;;;;;;;;;;;;NoA4nc4m4m4l4k5l6n%K <7n4h4h4h4i4i4j7p1d9  !%),048<AEE{=;;;;;;;;;;;;;;;;;;;;;;;;4 `+ 4p5q4o4o4n4n4m7r2g5,Z5n4k4k4k3j3k3j3j4n5r/d: #'*.16:>BFKK)>;;;;;;;;;;;;;;;;;;;;;;;;$lB5s5s5r5q5p5p4o5p7u-^,36q4n4n3m2k1h0g0g0e0e0g1j3n/g#N+ !%),/47;?DGLMY3=;;;;;;;;;;;;;;;;;;;;;;;7 'e* 5v5v5u5u5t5s5s5r5r7u7u-a>  ;5p5q5q4p3n1i.d,`*\)[)Z)[*]*^,b/j0o/k%V<    #&*.169<@EIMQQ j<;;;;;;;;;;;;;;;;;;;;;;;;(u=5y5y5w5w5v5v5u5u5u5u7w7y6u1k,`.c4q7x6t5s5u4r2n.f)\%S#M!J I!J!K"M#P&V)_.k4x661v*g&]!TM!Y(j /#&),/37;>BFJNRWW=:::;;;;;;;;;;;;;;;;;;;;7 -^% 6z6{6{6z6z5y5y5x5x5w5w5w5w6x7z6z5x5w5w5w5w4u1o,d&W!KC}>sqE}"P']-m2y589::9;7+"%(,/269<@DHKOSW[[)@>>><;:;;;;;;;;;;;;;;;;;&r44yg5|5{5y5z5z5z5z5y5y5x4v4v4v5w5w5w5x5x5y4v1o,e%V H?t9h7d5a2[1W1W6aAt"R*d0u4666558)r!#'+.158;>BEGKNT[`fqHVTTPLFA<;;;::99999::;;;5J  +1t1u1t2u2v3w3x3w2u1r0p0o0o0p1q1r1r1s2t1s[m&ICu$W%Z'`*f+h)c']#T!O M!N!P"R#S#S$U&[(`!<[@k!U(g+o+n(g$_"Y!YR#%)08?DFEBADIOWam+}ByeVLG@7/-*|&q$j"f"e"f$j's*}/1*=[3Upyndgq|sbRP`p}n^SYh|gy|wcassdk 9aEtN PH{?j5Z1S2U5Z7]6\4X2U7\?jGy&U$R(P{'In"?`)Ed>eN}!W UMzCi;]9Z<[ &[XX[i)4AJLJE>|9e6X:U?V-GX;TdGeylfHdv5Rd/Qf-Yu*b%i!cY~LmC`A\A]C_A]A\C`No>Yj8 ޒ̨Ξٝ***hhhƫȦΡ՞æΟ]]]ɢӟGQ]>gIyo[q>bAk3[>bJvQY{8KvMV%o2AK7up~>Xii~x"Kf Tw[ZGex8P1Fm< KKK444%<ɥ;]<]~>`(SyP#c1BM?SajyD_)Yx rC GGG111rrr2228Y>`$_2BLAS^bs{A]wF" GGG111nnniii@^#Ih 1i2BKFYeMgy_r$MgwG# GGG111nnnpppBgA^@aBkBc}@k$F|4C OLan9\sGzY>byOqvF# GGG111nnnooou@cB_@a?jHi} 3e%H6C^[q(So1nC?c{RusD" GGG111nnnpppx=]C_BbAlGi~'^%K8D4mnKj"d9?e}Opi= GGG111nnnsss=[D`DcAnGkzS%J8CUGf `8?f#|X2 GGG111nnnqqq %6ȽE`EdBpGkzM'J5AuDa\7}BihF' GGG111qqq>>>FaFdBqGk~4N`v9s3?A]X}5y6_zےŭX:  GGG111zzzGaFdBqGk=q1~=GaTy4uGfX}!`6MT9 GGG111|||&&&xGaFdBqGk&Dv0{=.RiQt2qEcB^ oooEEEaF( GGG111|||vkGaFdBqGk%Cu.zKDcwNo1m -000vY4 GGG111||||t$-FdBqGk3Vv6y*XvazKk0j222i? GGG111wwwʿʹѭզDaAnGlzJj9`wT{U|a~Hg/fѺƶɵ԰۩sD" GGG000sss...lllA\?jGlEc8_wV{}jLyEc.^&&&sE" GGG... uuu,,,^^^+==awHm?Z9b}Z]};m "0").m@ GGG... xxx///[[[h#%,,,+,+,+,,,-,,,/,0.2.3".3,1,5!.He7"Qt#',.,-,-,/+1+2+4+4+4,5.8$,+6,7+7,6,:2 %K'$*/,/,/,1+5+8+8+8+8+8,:)5!->+;,<,<,:)>%SX"'!,+1+0+3+7*<*=*<*<+>-@+>*<$ +>,@+@+@+A+?,C4t]"##0+3+3*9*?*A*@*@*@,D'=# +-G+D+E+F+F+F+F9Y"3+5+5*<)F)E)E)E)E+I0 ,J*H*I*J*K*K*K)J+ 0)T)U).-\; *W(U(V(V(X(X(X(Y(V ME 2\,B##KA;*]#J%S)[(Z([(\(\(](](^)^,Mk" (<): %)^(YB)c'_'`'`'a'b(b(c(a R=!9%; 4.(_*d'*)h'c'd'd'e'f(f(g(g'e 8Z(6E"W- %])i= (j&h&g&h'i'j'k'l'l'lBr(=F V/"[)mK&k&l&l&m'n'n'o'o'p'qZ|&>I Z2 [(rT #k&q&q&q&r&r&s&t&t&u$p$*F%EH _2['w^ e&w&u&v&w&w&x&x&y&y&y'/n$H +!i[:X'| fa&~%y%z%{%{%|%}%~%~%~'7&H@ k&~LRU&!o ^'%~%%%%%%%%'B|*N(s%x#x @"wX%!v \&$$$$$$$$%+:|-I+_*l(t; T$[%!xa&$$$$$$%')-Al0D,*.$\HkY($q  l)&&&&'(*,0.II1I1(FG Q0q*\)v40///013690P 1O "2*=. )J6d,R 1;::;;;;;;; #/0/"  )H "8-H" .X9p+W06::;;;;;;;7m/om*$/g VQo %oV X UJTl10c># C9;;;;;;;;;.U|||#M_wwww""Y\ (.U<;;;;;;;;;$j7|lllk"o33eo!+5:n>;;;;;;;;8 '8t 6?y}#H,\ k &/8BI'>;;;;;;;;+= 5U@y/i7{-c!H!H!H;qH-j)d#XS"+4=EM^6=::;;;;;9-}(1:BKZlpjV@:;;;;)z/ @@@;>l/sfp278<i4AISm ?tI9;;;4 .LHY[!.va,t38:: VFQYo cc?:;;8Oqqڟ?|)vbtZ~(i%dMzEl V-|7<4WY]b|Q_@9;;:#g===(6C vUUU3q9XUt09>Z`__k|9]D9:;;:&rl^FFFcX08;<xX^__^\i989;;;8%muC .;hB9;;<9bZ__Z>;;;;4!cN rrr&SSS.XI1kX:e:;;;;;;;( j!>;82ҏ!a/ޜ ;9O89:;;;;;>8751`:S +000)Bj^1 rv6 N000d)0- !.0$ (0( !..! #..##/+~)(/0+E|Xbk$@zz@bb"IvvOHqJ(]```/ +ZnFv#0qV4~jjj["0 1XXXWv#0qVeV"1eee+>v#0qVҥVg4===Cv#0qV٠~~~bbbV>m;;;IRRRLν@v#1rXzzzG杝gggV3sov#>wd+BU> 888v#kTy)+mƯLkGjyv#sssdIxxx:EEE?MMMVv#> HHHxj0(v#bX'ȭk$' v#ǩMէNjB FڋէN$ zzv#Xz ?< ? 0 (0` 6h =l  {X #|X.  4@zx$#)'+*+*+++-,/)+%(',&U W) -L ()+,+.+/+1+2+2-5"( +5+5)4!/Ay4  ['-+0+2*6*8*9+9+9(5#+=+<+<*<0 Li(0*3*9*<)>*>)>#4% ';+B*B*B+C4 L  \p)3*7)@)C)C)C(B& 0*G*H*I*I)H9 5 __(7*9(A(I(I(I&C (J)N)N)O)P)P>z* %($7&5" 8(P#F 0 #G(S(S(U(U(U'T%JW,s#5  #K(@&QA(Y'Y'Z'['['[ K. 8"4  / 0(\',(c&`&`&b'b'c&_/`X%O"$4& "'b? 'h&e&e&g'h'i'iL }, 4@( %cP&j%j%k&l&m&n&o"a* #76D+ #g ]#k%r%r%s%s%t%u%t 7%,-$? GE. !i!g h%x%w%x%y%z%{%{ :&3=%C8]X > j"qg%$}$~$$$$ :(>>*I(o%u/5` o!z h$####$% ";+=:-D"FNL  "^ p#xp&$$%%'* &=-E)/G  /4A &d)f ({/,,-.15 *>  6,I& /$ 0Z.X 4:::::::*=N__< .k qv(sukl +V(R 28::::::6 %5MMMݿ㷷~(d鴷FGrr`|  ' G;::::::0 (`kkkI\\\L iv**,t "0:h=:::::9\ +QQQonGoj~"Hzm}80*(3@M#<:::::3.CgJJJ1113p*a1pJqj|.r60} 8/:EX sMZF;:::"g &^^^LؕnnnXp(cH59*CFSp/y[<::02Ֆwwwxgjn7at7h*s59yQXi gqF::3?Zd ???www;1110eeeBIPP/StN66q\^g!^\@::6Mnn aF Wlll&5:3t`^^\99::3=WH 888 ì,Wy???j{{{888{" Pzx=::;4f\_/;:8(w:S<6MMM<<<___ַPPP)9%8o::::;;:.vz<95 ^QMFFF+eivvvV :8F8{9,,,,,){'skLm-#5S__X3xxxp¿߿㿿}}}H      E'''2 I^J O_<"UX4 +VV,5U\E.B\CZZZCgggC0V_[?۵LLL4ݿpVVVCߐi...:ſ߀U```Wǿߨ@@@fffװBBB'###9sssō}}}G???\࿿㘘111c"!eee8wsssP r>>>GJJJ|@@@<Is[[[S!eee8wsssP r>>>Gjjj󏏏@@@ꝝSį!!!Z!eee8xrrrQ t>>>GHHHpxxx@@@lll/___r;;;???999 q!eee8gggd ===[Unnn8AAADDD>wwwxLj___!eee8===\\\555iii,,,Tuuu~qqqXXX???}}}WWWc֒;;;!eee81ɴ)))Vf K...V!eee8űJJJ= 2zzz|ٷ-#UUU` !eee8sk5pZSSS*@B).gxP gZ4pI ]j0 iii-wwwU ? ?0( @ ' MLktvvp] . xV9  $ MNw#$'%($(%('**)+!(b )c: 8f&4+.+++++*,),),*,,)**.-5)4/ /U$FW"',5.E.B-0,,,,,.,..3.4 ".5-<-@(;+ge, eg2u.L/K,.,/,2+4+6,8-9%.)6,:,8-C-K+j j, $n]61e-?+1+6*;*<,>-@*;#1 %/D+@+>,@.W4 b"$f=72r(:$."3$:'?+F&< )A(@$<":#9(U5P !$;4}+C"+&l!\)y%B"; mNEGX12%f"]$b+w$Y0Z4 4f6/a'3} F 5$^2 Z5 0+>u w!S CI EF+n*s ]:3&8ln#] 33co%LWmZ:;;;3v ;:999:::;<qY_h}(bG8:;;0c;::::;;<:~\[]Y"98;;;2c3l܆;;;;;;<=* mU l:=;;+ks 1X);;;;;;;;B0D.8X;;;;;;;;,,6,.?(0  1 -af~xQ\7 ,2+++,,,-1'*!$-6*:"3 :n/ 6>'U.R-?+1+3+6+8*7'4,;,?,OF /*)f0h)<&3(:*@&9'#*A(='?+] Yk"*|y2v(>)'t 7$> kUXt 5-(p/~%\ 2P )\H1{/QCKHO~9Ce%}))@AuBFd34Y] ;EJTtFPs)6[(a!Z )8Z 'a2z+5t!!mjj6Fl!TO f$0!/d"I"u77xyNX!5@5##{RRlW/+>;@2  .FFnnFpg0+>;@2E2l bb;Aqn/+>:@5)[6m :=4Vxp1+>:@6'%2 }t8Plk+7+>:@7$!"((r7:+>3e6})Z 'Sg{{qv6@[;/%I0c773^kwO@L17B*Zze?;$k 6/86~2r+c2o5z6{3z.q)h-,=W.J;:;0 (A3L9777777:3DNv\>::9TS 7:88999;#Tb dS:;$l 3|6999::;[]a+?::$l 2iL9:::;<)oq;;2>nC4w/74t::;<304oޔ6;l&/C.=:?:?:?;@;?7?,, AAAAAAAAAAAAAAAAAAAAAAAA(   ,)q&%+)+*')m &% +/,1+4+5+7+7+9*9&~]*%.(:(>$8"5$8(?*C)A%<3s h"u)x"@"@,z!\,z#A'I<.|,rNS"m&^B&_> G*^':d*a@+a4v; B.h/c/d0d];n,\4e4f5fc${"qN/X7g9h7gb!r>jK}3i(_.b0b$QOWB`*Lt'^+_6dHl@\״?D!R"eJkv.o/v2R(s d9999:;CS`'Xx3N444:8:;;;;;<:7ڨ;;#9;;;;:;=AAAAAAAAAAAAAAAAImageVis3D-3.1.0/ImageVis3D/Resources/imagevis3dmini.png0000644000175000017500000035515412320517543022562 0ustar mathieumathieuPNG  IHDR]}4 pHYs   OiCCPPhotoshop ICC profilexڝSgTS=BKKoR RB&*! J!QEEȠQ, !{kּ> H3Q5 B.@ $pd!s#~<<+"x M0B\t8K@zB@F&S`cbP-`'{[! eDh;VEX0fK9-0IWfH  0Q){`##xFW<+*x<$9E[-qWW.(I+6aa@.y24x6_-"bbϫp@t~,/;m%h^ uf@Wp~<5j>{-]cK'Xto(hw?G%fIq^D$.Tʳ?D*A, `6B$BB dr`)B(Ͱ*`/@4Qhp.U=pa( Aa!ڈbX#!H$ ɈQ"K5H1RT UH=r9\F;2G1Q= C7F dt1r=6Ыhڏ>C03l0.B8, c˱" VcϱwE 6wB aAHXLXNH $4 7 Q'"K&b21XH,#/{C7$C2'ITFnR#,4H#dk9, +ȅ3![ b@qS(RjJ4e2AURݨT5ZBRQ4u9̓IKhhitݕNWGw Ljg(gwLӋT071oUX**| J&*/Tު UUT^S}FU3S ԖUPSSg;goT?~YYLOCQ_ cx,!k u5&|v*=9C3J3WRf?qtN (~))4L1e\kXHQG6EYAJ'\'GgSSݧ M=:.kDwn^Loy}/TmG X $ <5qo</QC]@Caaᄑ.ȽJtq]zۯ6iܟ4)Y3sCQ? 0k߬~OCOg#/c/Wװwa>>r><72Y_7ȷOo_C#dz%gA[z|!?:eAAA!h쐭!ΑiP~aa~ 'W?pX15wCsDDDޛg1O9-J5*>.j<74?.fYXXIlK9.*6nl {/]py.,:@LN8A*%w% yg"/6шC\*NH*Mz쑼5y$3,幄'L Lݛ:v m2=:1qB!Mggfvˬen/kY- BTZ(*geWf͉9+̳ې7ᒶKW-X潬j9(xoʿܔĹdff-[n ڴ VE/(ۻCɾUUMfeI?m]Nmq#׹=TR+Gw- 6 U#pDy  :v{vg/jBFS[b[O>zG499?rCd&ˮ/~јѡ򗓿m|x31^VwwO| (hSЧc3- cHRMz%u0`:o_FϗIDATxwdY[kP>O瞞&IiP4 @$,.ƀ/m0$LBBH(ΌFɱ }biwթH2M+0F8gq}p.C4uBmboc\ޖBdYI V{8'dq( | ׄtZR&Wj; >@J@ ~ + 't$9G& e8Vf O AA!a ?(Q.W<*ZгfOkMsSkLVU1,F5 z1QR>H ħVcRx!IR$BT~K*_]Yۯ^8g#|eʷ]D"P.EŦno)kAGyf:aU@ [&i|t$֨U5L-WXvr`WYZ&KLr~δh ۠q5n/qe'X/9޻O+ )^5`RD /IEg0 J%|? .oJG(a ߅(gK()>ΛB*W`h Z< ϯw2 3G=RGބA^)B/[ ϠSk1$V(l"p1 ̠=`*H6%]{qMei^ڀp\PBc%4e 2,Bk#Hx\O NO.q pƭ}r7 Q4z5հ#4RVnY}R@62`k\^6QM@ԨW)wۀ pPNhځTORBkֆjFD!` '8ā8 :dڃk<WY8BfIU@j4J Y35^{sIğf/&zZA"ּ~~WX[A099DɧfVB4V`Kvs \ Zt2>A`Xk`) R|^cg|^!6)F$(I4ռE%xdE(l$}_f/j2-rm,[.ں52WplxSE#qD7oZyr zgHqTQaPzt%p*x'<iB,'¤q\̀=>O ҾEz8Q1"NlPflY83a\FUӐBc9}Hzwу4|X* 2[djJRa޽LLNgkB(˪HVoOHc@iK6BT% .nS>Zk˨Rh6>@$yu2Ȟ±/IпKңkdk}x.IOrY$qbĂ886@a*eQ:+ 8=C'c@g"gVThsa]93%(>DW0m0ZBac2TMVIcwy@Yup)q.A˔9]V4MlqKuZFiξiJr]¦mq e&+sh@lB (,5+^#}RMhw5o \LVW Y'2" n ]H8͙9l lgI"j*Zr.u3mOͧw Jy ;iq<6Ԓ1T9hsئ_ $QFaZ0lbRX!5*TgPY4⇿ < һF\0F&J:oS֟5|e&K;3ñ)6Xi?7qNKQFv3gw!anNk͙ӎ;?USsjm`"-\Du1vL9:Dak@4Ь,\X xxs6k2ģG2NY Bf|"H ]s=|;`>A*B796\'='pA9b]0>0S# `sI ފyO\U[|39`v~g1.AbE,C)lMqDUӈsK`Q )%ƶ@i.Mlgf"F6]0y"D;)g8p:h)zmPf>\B|<"|P7e*Ŕu"H(p@T<@`S(\Yc =b /RBW/[;ݗ|t%\щ(O)H5_ d6%Ei lGF+crvUy,;Ýjh}r.p #=QnʡTRW0f(;ܸb=svt\A"$h8ǺW^$n|(5llpsf5EP.'OqrcVtv7>uO2xr-񒹘B_qg2 <0[?cg+ʣ`PRy& 8oŷk}8O&|詀O*+T Y6 3K &ԃUkMS2p._ *u2> MPsde޸ʡWL"$UޣHMv;yjIr5. tgX=H<k[b:$̊E8o2jL5`tBg,)#!: pn99UaDh,M4Wx-VB88s3r'gdݹm#t7&B(ePRF\TD Jh5iL@"$= E:(" Ag z^ƶITm]1 V]nfڍF"b$XDFCcDF f>޻i&5"d@s]2 3u7GVڟ]u;^/[_sSdUr)CK,+!:J3 RTHB3 -I5}Zpn(|_v9! YػO{+0aMX6-W-ӡ&g:0"B"cyUy<$ut2YZe3s/p3 pr#]5ГlנӪI.!K~Ҝ;1 g($Y`cpYxO8K#J:ـfL\PP|> AhIJ#:&]Eax78yԛ!?1z:'6W1K 0uo8TBj[5K =x( hM3| 5KD>#Z#c@.<ɐ؜ʠp-RHc`'2>\ %%8=Ej~ B -t!/y6C?)ÝNZ/r.r./UJ1ܯ)~l36=RP,\m0ŊTs)2zIdVc0̨ع=YL eͣt^2_܎|LT8p1c Ji\iUkw?;A09U< nf}K'5 :h1&*c-]WhQ:*nu靉q A>9(O*fjezzb bcj*^r]sW+ʋ9EEB0 Rdv`BKWydgbnzV={ FEl\0NXolGfxnr7c|Lfz[ӘK񇴾tqR۝E`x@ju\lאG(Q6YFM2 H1~xc G˻xd=< veȭ6@)B"H)Ci?֫Cؾg|NleڃDoJ6|% TvPnq.2.r}t5:vY\Fm%n.ٻ-WrCG4Nnj_5ܿlx|ͣ+\@ʗ]mf7nH J{;AN 2Qz^TnDbld0ɲͺ (W\Z=z@w.Uit=L4`0UhDXFc k-1ê>k*_Y$JHh>1;2?#R-Кf'< E50dg54:Y;lڪ"(ۊGro׽ Oޫp+p:Ec_!]8]%> L)z UT˔]&\ j\ L:N{RuwXy`Jw٥.Gig3 7RcEC]ցYF5Qcw:q'۵e{!3&Vrk#PfCkrc*cP.1&r@"Yu,ȬوA(njx~[\\8\q( {,ϾZ—1}7|}HEՂ=!ŕσ-?${œSi=0iLY=dClBS|p|KXf>X֓ITLJGx]H\)HB . v]xp53qli!3P! yGm?M~8KI-e'4S!1Ź4pRh\RDsPyRr+!k픞 T p}3j*e =v\ZJ"͜gQ6O%V*]ŜxY'.Xzqn՟}'Z?#8xU e_W2|Yo6x( $Yo3S8Sʟ$=R p>#.[ ̐yb 1vj ظ^,7W. m:XD%Y {>ʯQҶ:{qW6bM׊cme*#OB':aL` P(BƐDIqMm!=pEbnE"+,(p.Fg[X۬D G,Ϋae:7l%)_| ;,=pa\n# ƒo|V+f?2h1%܉e̳\+Ss5ue ]}:klsoq_W(55 rpQz#cCTcMa!c[5vhOKόkbD*<亞MDP:4g Bx^߫`mDw6#ll14{:A |f27%:[T,[^TUp Nrz`}XK _Z?_W\N;j?AM#)l=eyp1a_9h29R%8&A*נAz-::}jҚsn~3práɏU='֖RcζI](e\?$I@nO@v0WX!=EL#7GV: n_ζpA['/a/˓'4H *+я7q:vl>dR pL==d @eFsD T*.F<ě;1}aJ=oe= MYy?UTmIV/K8SCgѨR/\g6{|Iwz5d|M)+3yv;{,{j *a3_rSʷޔӆI1zMy эF#Әb04 P ֹ& * V>tS -b9GiJfyfu( {*kp__qmj0}ИSlF֙GW؃)GLg=\V G})OY\1Ӏj8]F [IDYg3"g³Zc>݄̂q!m qfxcuW?uimyı446-pޛYn= o* 7ti,=vQKmzR9t۟%_`))K2]8C?Y""Ѣ+檖O΅<Q/=4Lt}¹ 8lmW4Xڊm+ZL\HW5X$KArV5Po (aS:8\AG @(!.:j(0EFR ^Sc }Oq%x-t/ctCIv)%k%2{捭{M>ܝ]kg|<%)xfmeΔ@Wp*yj7gNOT`cxdYm-A1o:vM&ȵg>kڌml%?># :2b[E*b;"..4A^i- T m\?# w.#Qgg0oaV`4>~YZ12#pǡ<=>28x; ;k1V65,TkhW P/A y-Ģ+y\-z  [`+OLtcsu-/{ _5wɯX_s]D{0_R`^#yg'Zg*ZGf ,-_PΥ,}tّ(ǾJb^YvT{~3E᫟ՠ<xgJoqẆ?4˝\U-}'o+<&p(j왼<҅vޚf&<:\0}CAOt^2 dz;f9tPq%Ofv dZ>‰=eEo3V="q5?|&:^y'ɯ~[4![JinVp>]SBSyjAs-k*Cb5Q䘟{ϖx.@}HBiQ$P8ؔF|݄5TpOs*UCQ-yLW)rTbw>K*UEbPYкMϓsbLb$; ]t4OC4d|2 J JU(/WTܛv^lb5E@\rrbLL؈r9ٱp'A8S=MC1pT:ݔ)R߼c]J6\V&!JE)LQG'9DVZ(PVy֣2U:\3cלS RI:p@y sGsJ,FQ},5q SKt^'# RxDOmQ9sUGQJqWn/A$ݿ%AqM/|>{MqY/}gyp`^[o?1-?N^Uo'}?iUmWv ݙYnT9T J%c3(I%TKJW&XV@cBmTYyj[Zn ]G`05RaIQ <%ILlShk_WϿb y쉘Ck^RSwmB=⦃=NW$C_lPizL-ܔEVf%gjSl}Fm*fmB?(k`Ln-t2D}~ 4q &tjRĖsy<[cvJSkH `)Ӕ많o&3t3fYgݶX:jAVgfG"d?xapgX*$WE`*J8z̰Fʔkh@tJ sxel]F"|E?!6Wjn5 |zEGs1Оwo'~>[.rKl7: j Glvq'/ɳmvM75>O5{b(r`?|?B?pš|}5Ͽ~^uo=8׿l4뿖W%/kGZ>?Sz ~~cWW~'x ? oSw6ņ;),SUw8Kl H^fYL=4Y؃*b8Nml(ŝ^tB'ִ=M}P-av)0[QV<#ۊTH h囏X>Ta9&&{p _b;%FW|΋K<փ_p={hL4B<+6d/= k湎|?v~<^[y;oo.ٔ(櫕c='fIIrͶmM6m=\*/?OW' 0S \< 4iw*ԸVا,QË^kd;HˠB*aȡCiVDS5lmg"\l)\/en6f|;_+&L$Amřq,0 zGg=L\]؞BVٻtu3(ng0KL%("$4NWaU"b q(pq!8voW^I'H8d-Jnj3 R Jj9[MmJϕ>`$C)祁ə"Ґ^cq)WWEJ8瑟yٹˈ~5_s?0@<}jt'Y+/us ̱!%pjWc]2xy)grMOJZ1)nZ I0 x֚?}ۙ5WM_\*֥Fv@VEDxF/v <}wga͝ۿ[?/ o{nVYYdTಌ91!å$3IqY7G}˅a~$¬)XO,,lj@#̪!u lq.Mw D|Y$rZs=i'({}YY' yx ޸_+I(Y:վ!TRmsB.tiu] (OPOvA",[JPj]݊pϊ*>̅ZmY#,Z)fvoo֐o#T-4$%n%L>&ML͔.QjvM>'K7[6Iz0ë_ퟪMqwl6 >GL)$YTJzcba]"(G,V/"qԦ3MI] ]6{?:Y~9HHxoe)BkD#NAT 1%Ć񬃤. ڌ22W>{}!IpWGv]J; 7X'{2sQ4pgĶI]t Ca E]%I3Q7}x{O^ 1frsx^џeR;2J' N9KY>O?K}#0$",qӳŧf'o&_o?O_2;3$?kU⯿~9c \|en}FV}aR -w Mm \_ gnr|+0YR\s<&KO$<28VA h_a^&1-A/ ,| M-dyԙha6fHzHJSM)WYJDlNZQED S`(p͎?ӫS͌:hSKGRhܩe W|amXŸ]O$tًm.5~({Fu*5lFvrޫlyk} T./xK]C,b3ĩQ~/Y[[>Jrw|7Ư]s+ov~ N {'#w10x@YKq, ɳ }`rԏNj-XJ>Tb&<!"|:JYHp`DxYOq6e+q6oT?B;`YwKs_?Ƥ_9]D2nW_IM?׶pCv܏ _1W`q6`43X 1xA+o(*2`3[J{U>k*&ubv%J[~戳4:.8#aoI FW4Ћ 8\ =ek &&1ɘ\H*ə7:Lgƥh [񙐈󁈚urQ s;N!˔EWFQ-LkǸewLi .YEOFmP8RCf PW5ɺ#@2CߠCLHl#D$B8 KH.c!@+#(YٍVh&~[ ohzA)ј1 #%n?D. &7V:_K..ΟejC)QQl/Mwi?2w?.LW}YPmߕڶT FoI|kp>EKO~,'?s&<2X"#{)PyHKaLAEe??i|w}'_E~W;QFE2yYٌZXox;eMRK]_ZyKy?c࿾ $ E(A 4&bE6綶24'7O{#b -Sp1Whā/>Zd0.7L̈pzJ ?2 V:]gTKڽ6 OqU_Ãgֹy[#\σkXihCRQ>+AzOI*Ӕ qbkg:hn>4fϹCr4`0]}&0hRƁcx`Ad5Ɔ^]XoQ:@N&p$LjK$!RK-9YR,uw~b9TbHㆰG7=`=ɒ>0S35¡3Alj 5]}36#b>8fD<)C?-JmfRemY q0MES$|xrPhC$@E\S~eD+\8]6pD JDTPLc$2L" `*U`n F݇o>~6 PY V0 h իTxc=ؐus JFrZVZ[MM MDd67iC xbqug94HşjPVObCcL:p2 p:DL&m.<<`\I+8?3x|7_On$RcKSyw\ `^.tfKt2^#>aK B/vU~u"hWՈwnW07a(/ܑ {"WbX Y_}?D?~G͈KIpb [uP?x K&A!aeKM׼}1S'/1D" FTC D =ZD)L艡)ʃ.ԧdC0#V+4=dP69s|Uz!Z](1P(д)%`)hN-= MZqD g |rmPvfiӥgߴ`p*Mqd6%UQ 2Z=+^!o>* o%U$/D xZ8DW AW&>+:QXÜ%D] nۣC#A2GV=D6y3P!d$6c Kg5ul0 ('`T4fKӨ؃_GR?E4EHa]^/x6fz4>AP`ۡJ;6c!| Y~zi ׍qQ^;u,\JG'eeCr)KRϣcy<z3P.v*9NEM[Kye|̩L!UmFTI[P?r|Ѓj˛wH&+\&H\ݍ.v;J&E/^EL/_*@WA5@MTvt=P;Cw:;TZo~,F 0xcjSgd,,@ۡ ú,-2&u~+}x._']pan-|3Mw_Wqx˛3MD{~g,&Q>^;?G_M˽=.Ax%18cҥUNnt Ԍ.q>i&SUƴ"^SI(ix@+e>zWw%ḻՂVR|*ЄfıA[ O7F9JX@t|,PPۭfFAr (Z6+Bhe0́"0YM98+LBd-+}Ma)h&b "ԱLx!'˛B{ڐdp#&:QFPv)G>unCntMT+PFzaq TѡF\E竜/<`nqRÊmpw#fbv 3nA>kA VGzfvy,V(1 emhw1 HөQR ,WF@y=tvѸ>tAy;3E B{RЩO5'V ?hXG. *?_.a QxP' 3ԓ F'g wC&o-o~W9kk|뛿C|K|wja/Z?]+HAQ g %' C RjPҳ`2Q+NuOX͔gXcmYO>ɾ ]UL:Sxw0=^N$ϺWLi=6#̹.^ABXbks 1r7CmnU8G^|n-H2I++vWQ _[J0WRSZ t?iQB?JS8H e6E$K8۷p$[>B\ ٓXz02J->dj1V9I-4!<&<<نAW3j% NR0@Y]6KQƺs#V@&ju(sĠ3KLZƧO8{yStm‹ xʵǮێaN6d۠?+ܦt<c_R)d-Y>OXBL$&Pj 乌, PPee~+םN]Tf ^j, h^N$r_8<#U>TiNqvI+`I oAD~(pLͽl/9KKf-.iw2.g]woNrr~v ,yo>?|'9ǽ=|p}шqdY??-9y4o~y-E?o>V+/1Os77>qZ2J0 ټе:גݪlW'1^xŔp"|3[ִ YV}A1U!O~Ox~O X݂V6T #6 1XV)ABA_A_݆0oKzbVo@CZb9 z[2Cb،<џ+&*}ܤ+4*{`*+n!󱫛$DyifȩEfJW 7Oʘ¸4pȞuk'=cr{,aA?BTP(/Ayh6!;!.ùp7}!#G= Afo@[ 0:Ԭ@LcZgK4ˇA)ݚfH{gi?AzS )czzwyiNvr`öxcgcsQo%׆)7/cC4C_v X[A2-׏cR0E'%HAC'R1%.u \M[ˠ˰yd$Rg~\Bϥ,q`*JeĞZG۠K/!yN+P; &@g .[oB\ELL o@e;b;?_޵C:/E㠣۵=sڶF,GϿfGogaQy߽{]8mLOq=ؑü>ij[-Q_ۅ+[Zkٻgk'y_/O09tcW^{wLKҔ,r4#IR$Ŧ1I%1n唂$X*G.Stb@I !H3z!J CUFծe*욃X Ea[17PRiwi&4Mg0&ݘ![߮B iҒY-vυLfb~Ksr >tV ̐8fX؁D9HRa`=h.Ŕaׄ+T aeQ61W^]%\>im|%~/ "h`58r,l : l" QՃn#C_<2Sf,/9B#Vi\Re-rTi![Mt:+MMCv*ra~Hj6Wڤƹgᓟ=N,j:=UOn5YKP::PVUX$n^pǏ_}ПZN|m@Y¢Fe<,XlL^2a/`^ܧYRlSX:)m܃I66.GyE }lT :x4†&H\{CG [!|.LRF0bVF$`SclS8( uƧhB)`BNOI)I^CZkR(p]Bx9t2Q+u 5@U 3W^F0_f wi~}w8C0=l5pβle^wq㳯?0DwCz^} k(sIiqSF:ӊ8n IL+ 2P|?R(9d VBU;JR Փk{{_l=8W}GMF)C+I;*$⧄O}J-1[1y`šks`f֑B? Bz[o[f :݄@+X5@`((?Ld&tSz*0]읳=j'OdR!rp $\ AWbE`qPb(iMR/ !6hmXO4+y}(|t[vW&Əv>s &JD~ʦ/\L= +8*>G떻O;\3c\=W:i/J\L ^7{=RV?"ePFrUyfm FOew1ARĔkqgGCUJ|e32+d$xEz56˝ϵB%r d \^"(눧8oGxiD6SvkV Z1J ;©x>c1%@Mf3ɳH_'0e"eLO5yٮ kR (4zɀƀ4v݄x#;Y~s4>TQ+IeU)c˹V [q F8u eDm}q~ _J0kgYQ:].EȢr^)/=d!wwV8$\EH8 i?3b&(^FfOp9^஻?ˉOy>ws|hn#_73D=+_R~WoYZw~9_;^j(`̲!BlsaرV 38ȬŹ\|\Fllb62:!5[NA9g=~E\>S҃sg嵷|EB)U픕 DŽ8N,si%n':a+V0*"|C"BYV70?k=BU*C; c!=˓˖NK/^ 9:M"{8j S\|l81?f .L|!lsц:r>U&=Ee8FWoχ U0q1E/:$ ,˳=O F@߮OP%lX]pY 1q_ڷܴ{r5`10qZt8 VO*8duʯ)BZ+G^|=F硶Z~ҦYޮ8 )4<Ō=躘D,Vfl|Q1n%*K&JPB+gHU}nIR.\GЌ5di5$,&fUX韢R2'w1] +/,[[rvW@mL 3CF@4noB(ZOoɅ6#'@Z[1{_Gm? f тQG8 Uj *Љ ֡=ZTѥK d<̄w/#mMEl'Q#YpC@ƽilu5^<(Tjl!un~;<&&yw|ws=b:l^x_w w!?3JګOc_y/, s_Z/zB+-Ԅb3RW&Pkryje8mA9 ǹ\jeZlq6bXRŎ[dIbtaiR}*%ߣf8s'7s?ߜH"ߦxb+ ]zyvh$M(/u1U9tbb1Xg$eTTrhhǬxzK= O}gI[ DDsgW(,Ɔ*#O%haa(:*X_(R3P_^J[R{>J4{x1"H>XV_(˱Skv߰{bēptfvr:7i.θiwf/ɮO\H@ 8M&HE A&x p4֛Y?,?/{8?SC]^+{8`( qM⹔9|{wj5ژ<_&k*ģmc"I񜣟ZDX4<'&ĢTC<3 \`"JM SؽS[]ր$d227gQV`#xb _uC<ugYysvJc'f!Q x.78U.VAAxB‹ HR RD [uHGiY4MVQ VHD~W˷dpB<B-bBք0bcqM(!\F5?Wsdpg^x_:% m+ؑ8&ߑ Si$F`K%&gIXtq#x_Bկ@fQi"X刑գ\}\"jU|z^eE&x+&i ɡXZJ{}{K+ol.>V>9s5?V|?/ua?We8,?/xoz˿Ώ}pMG/|7x7<:,'/ϧ>jVyVF:|$(uΎREG{Б*Ϛmn+)tp,Wnx($Om(zO:{1BiVs|ǹ|NZA3MP-L#coM1¤|M(a@bXnCEt L4^YxdQXcO)!Jc4ReMm]Ry YSR#a^$VNje!\SȧQ5~\RM1t𱙥i&k2}IWD%`ӳl#7LP s,mY: K:Q.iʢ=z[ gN|60KՊxK@lƳ4lz0ObrvG;]Gz|zRqRLIZ=!kk=L:U!Wd>+Xnt /EY!p+#媱]2<ϣtiL3yZJA }]*O2D)*K!NGa#eZ.S.ܮ"sO8U*3 qyh1>-d,1F[+c Ts=dA'$Q`&Z-TN0?Ooag$]{BUu'ͻ,j[%^l _D1IX`l@c[ $H,VڝݕV'3'vSݧ|kN]]]]ubtYhPʠBZіĕ"Tăجi !(Mb$V+\Si<&S7X\ ChkmLuz4`MN2\N]8#,ݓ"k4t3JT!cDU 9oUW *ӵRzmi61:YSBnH/,r ̣Jˤ_gQ 090ÈiD1HѼfA(l?Flcy૜}s4>ډ^!yy%%ʯ\ӄ`'s45VW&/9~`0$+ T ;w?R|ٙ;^vj~~?q8ɸzgDKv ߌXmtlM0A8[ݟ8 du\o~31*[A+A\^ls֧#l}"DFX/1I\8Ҁ) 9d1jM{2r _^ek[5lr ?^i' i?BDc<^#@#tNfvM|ߢ*s1v//ܮ ہ4ض## ^%GArXMA@<4F HN7Cug`Jw90ɰ& k1rt%o|pN7KS뻴8ovQ@}8%e13e[^~C-([=+7T(E>wBI\aJ Q!?[* ΅JTd GH,/BM)nN^xw[^Xv8"Ĉ'0Ta) )iY̡iFRr⩌_nyѷ3G`_&; -rsD^e0<.%VquG!hCwr|p%̷gXfdiJ-<}:[P $FYGC`ׁׂAO9\g;p$s^G6yⰡW lD"- 48a*<@/$!=Om ٴPD ZFR`ięadPH8:BII+X˄Όb;~\PWϨ\@m8l ZUM;Ҵs:~Hj`i)m԰7(KY.xΚ4F+\` 'VRH"IJ*+ 2gqtO4$ǻ.GیH8RnsV+f:Eb=p~s~!DaYyg|+jJ<"l(tͦcReWq2vM:BFx%9|Q8% #ybLjaHw#x1nx;X%2\QqgYN34[xN814a`:R夢6:C]La6tɊr49vYXDܵ j̒!c'Y-Q Hڂ"G8и2ND`mR8 [P2,.QUG##[77 v$~k/.kM+Sj"?*G@lLy1%G&rAvj6DȒgZ .U~@Dn= aj?EuV{3E2#l>ě좀k)Ss S69.+ rjog JNQbʡn% ]ws|_/ڻfy^;8r8G[n%w~= ~7.%G>Rpz.רq Wr`^?k\rû~pNj-7=kC{?!P":/&l2O%VaPNæ$IG$Q4B0ʸc DRFtɲO1)b!TJv%Z7|8a #AUሥ"R 1ˁWj|-a41:AWe],"t)-ceAN+]N΍d Q .\`$m 0/$&e@6Rнӡ^KcqJac EA.亍1Zۑ)ARDz*P+ #ѡBJ4 Q$Y1a *@DLk+evn3D*zbs8z$HԸN'H#)IPJpW2Cـ*"5@`*+(ddas}ҿMݾ(:nsykP#9˝ӽ8/#&XDa=jGYȡ(NJ baxWY,^>.3*c(oކnW'eqѣ]ύ/ytٖ_5ppg"0 eSi[8h^[_ ~p~^;i? [o.6C /~ϻ~7_Ms?וaox˸n>{xwpۭ7˿n(x+>wKMr`>nFgw&Jk~xLNz=(~3 "~P*0sޕfeSrR1*ѐ;xI%cp>|bXؔ`P4tI* pg_.xgnN|~Wد5MH #ό4+U6C6L'0k9Ϩ !ԕ:0"n9 a;DW0t.Q;fDJ[EPM>ylsGGԒy=u/#OڳflINxLp s o^Z W"N#w?y ZD2|-h!ʑ mI\fӋu[SZm,TR+3+ԮV<+ZZȅRH?*q.TIc )ly}pz!cc弸(:7k)i5Dn+i ɻf:k{9N>_͙~sϽ~7Ylv/GLXs[ OX#<k %R4R lwք Ugwptv8DriS-Irjˍ%qd`S.$ Ejӊ-LJ#^7R=7^Rg'3FbFɠщ,J62 X֓$a#2|aS<R=TU]FR%Ɇ|B(W#]1&:KT=JtYGpIis5/|ˊEЈRH%G"*+`Gk%m09Nt`NX\tV`u Q“z F5*qzT5:?^^t˩4$ Fƞ$(_@C2ifw$R-a^6"fO ;p9exQ ҇^RC8+J0 ¦}#Yd4Q)X8|!N2A&VR-1xA᛭@4\)թ ( <\cC"xGaRx報߼Wt(B6h[ ^P1ÑG&*a: BF dX Al%\jlUa3KnG.Ϡ1y"qG)* \QG!ލB]8n0 ֎-pc䅋ୟ Kd&G2$_O1YÚKn1θ{T"x9=AA .2z93Įp _Aid3{ T%w|E*h xZ&2ؘO3 n6k \${ΖR=k.…ISIMHӕuVOuqg =8s U-CO{E1SIFVxZa5 r*C paTo_^+u@(TL|d?~K`ǿW?5W2Gn~Ev}c_٨?rc,ۯU<ϙ "Ra-v2j,}$ZlύrMV \6+#='7(iٗ˹HB'weXϥv5nKݙADQkl3fu&zo#@X=qzEʊM/P(>*VM5պࡇB~>q'9a~_sz(0x$g̻@KJ e冟s衇AHemEކ-*Aփ{? s%&3\ ʿ)#vvKmB!<ş 7C,ou~| _/اx 3:uf$YZg2'ΜykYw$YC9MB1s|N*G %O&d~c:RZ1ʱl8,|+w(HVl iXO$=yMx{/zu֠؀RFP)iCEw(-u_Gًf"&uO3rut-f3v6ܶ33\n }/X=ySQYZ!9=,$ݤo0@{˜X!Ӈ3!^ptCd Sρ_:.S/nK퓇$ 3.C_?_$ym't%ze/ϐni7̟fn@ףd#'$nP0:u=lj&qawe- PT٥}_bkWS;',L u~\D1W'!=FJ#e>B=oNbdfR ^w!Z <[ԖI5(-#tlყ?^H򅜧 b:޲{5O Ȓ:A  BQ8#ӬܺF#G#h-v]8Q ;BF{RCVXd+ #V0`ff!I‡Ěp. )8qz+Ś`,r ByCd "F.^DQwե'2T7CE^K(3SG_>X^ h4%/2;.K>O1]yQ{yPsOB+3}>{?]LJszOn2s0"U&E "QA5zΒoS$ۅ@(>^S=r{@;%尨X F^ɉ\5Pt\?'>B܄/C|͂gtMkBqSvbڍ,?h`8Q bWHmv)Y3FZ emRZGH(-8W-?>Z HIvJZb'j`ezM1сI7Skݳ%}i^zα&ZG%5N{Μ$@q+f-Z!]W0b 6 7,A bN[jJ0zD{)DJ9)g;k1#`&1 2h1;=5Hr,g鍄44V)24` $I5b#7"xKC ftDSڵpnfP@ C40PIs:U0v\%'B02$rRWjX m1?a P6ߩ/?]}]FK"8]p밃g7}(eu8XAg9ၯDB |+$Uwprճ H7tz}1$&FRR "Ba7 _+$E8PuN]BYTCXc1Y-$b%9ZO0vsd|D dSsȮ&t#-ʣ J*5h`~< PjtrA`ؤ+yjVfR<+}!7 H>t*}Ȇظq8[ M)=0C{UwTXa$6!Z57[>+XF&+UHPn.Cn(}R^[|TM!m G2o@/ΥK HV._|ECy<c/OLa6Ӿie%@Fg|pbs lx< @U`u8&L W%x ffV5‘vm-p~|KDה5gK$oo.YR-k\m6). pmƶ- !Ž_K]dIǏ[ɜGhef[,H:*JUP h Z˔2krEg03lmKYjBDpF*M)7/XrUk7samׂv h9VNq+<OSF1Z-#y" +97\$X)vjOCGԀph T*ȱl(Vk W8Z³)c:C=X$*jQ` 1'NӇ6o {uT Ơ14#T K(D`J"0#}t"$Rhml9[]P@АG5|ģp"^R#|w3mᅆƄ8 W\ ACVLA4.+3`cnvϱn!r ϑTKbe"*; )NmjԴ8|$/}[nk'V9Ɨ2Ϝ%1(8=ŇJͧbk ,)%^)T[S1>jRh"n M67ȨpnvF²3 $0n]8p8ju)j|㈿e(HJƶ@UGjE'0 a8\W;?'W'얝Z{ )P%J&;櫘)2c}Hײ4pvoJw H뫖bnܣ8t†TiR`zk7;ul;&W~<;˭-巃Lz )1Y2]JɈΗB220GxR!(/d8P+J-8~nu`lcðydPA[?yQ^8C^{<p$oSb# @Q 稑 ٚ 6*RW542g0³9F9L`-ʆ*gG)m7r@{wt3G14͠WB^L@3̡<8Wݒ4͐bgB{bX3Ui0WOՂV͑ 6(Z_@BR6ꚴ(H$Tg>SFgG- k{☼gXlx@!<DZsMFguNJHO/]A9ex+~סv!I0uYQ#RJpQ aCxU>O_]V7. F o$gդV8{9gNg%&A-5_z ;VOv9Ɲf)#`6psqO99ه9R k&|W,PXM4^bjJ5Z` W5%X@,36 xحi姄n/:cx''?lFlݦ3/#&H_˃>hM};W~GY/E/ʯs=Ҝoy/կzEIq{$9q$yo;w|yoyYV.׷~כB76lܘs~FG::_`f !&%-r\ 77-yO`bφ,u` T39 N=`& 4-4!4fSu`W4o -MFVYF^ЪHmNH3q^,^MORP)6SudEHtX ę&@Z%p%MF&Ijď=Ϡ5G#cf {E-~ : uORlN_Ԩ9逫TG! 6P0Lg=aF>9d~x|#<3WO.RHRc,=vC{7()Y]]ȉ(˱EBJҕ}HH4"O/q" S$ކdkCXja^Z,އ{=ҏAF[k'%tq[&;FڜB'A%<.Zy/?Nl4;_طDGNp_C"kdVS8lEnFB_t̙MS+NYe%@`H%hG\o&fA['>|쳏̳9㭯{5jR=}bъ|| L,usn<Ȟ;JMM>zG}2<(\smtg8}fe;Vi},_/%+3y_snkvn{.#r'3sN~(yTAPs,=-֞Xe>xF(J89iOc)ch^=i `Oʤte)!{e*amc<@ ((b4IrZuB`˟ ?W'_tVL%X30ąG&v#cR4UE`t\ GB(Qu=G~ݻ7G_Xozmo}}S!YAs3_7z꯿(vͼ5ׇ7?!hZgfmW0g>ϩgJcЇ=4ٱb>KJB .BoR2t_9An%gAzCw9|тw96R(Dz@`⚭Qx"%{eY3kf13Z^ȾuٱN?,jVz(rQEZ$E gaW0[F^e`T4Af }메2 A"iPyƐX7w87T`^D̐YOp$pKI/s8o:b"G97xS%[DlسS5 FSY66y lt|X\z/=M.-~Up:B b˝G'i6jL y9{O.<2lH*fB R^s 7`gfÇ>@UDd 8Y. !79Q^) L9W Qk*p"IB k-p&ݴ=%3(Y&ljX# .j9!OJD L+pUFU݅TX9LǏR٥1Β]|M}e_;/߿yχo7&u޲p-/{/s~__fu,*p, w23;syze~N˂ngܿר'?x:dr5c.ԣrk=󬬮?l|?;^ uYe|s?yKvXě"NR27ӦZ\oN:M}{yE~_L@]V{o}#څȋpG? ݯO9mUJ8}yA7!v>k7;nٍԒ_] snr'W.n]lq5}.ء q"݇WQ&rJ,hkDE ndK7Vy/]Y34[Q+bHNlZ|^~xq-dɴߗ0Euyٔwz?yQbX~ z37N_ ^p7?s>r,d8+ǎ?w镬C_{?GͳwܥTH.%w"OIGK.Lke8/m;lw?fZ^F;Ͻ&}px+)2]K<֛uMozKx׿?~nFt5ѾݻB<ޅKͩSN9f,hn|5k55ewOn򻛚gl^Z\Jۉb.W~gSyRgf\B7ےP;D%Xfk^=v2z/0JZ}`\+҂$_@J񵍐b-֖lZ5U97Rfes^±os~^W]-x˛{{w!;w7}|?[`1(<Monۿ2⬝|ﱾ>rK$1JGZJbrjRTBG)`/ƏO B Wa P*#f(+v&Og2d4*0t PR7`.ȣۀc VyF oW\CS RX]Tk0rV`>VR^w C1c\F$+]Hp )I5,t$"l"%uƒS`$TP&(YJE NȤYZ`z6ׇGZ8+(20 U4Tq܅(Y"11dg}'.F{0s&DRr5N{# ]Nf| MΎrq2~oHRCWuzΆ9)6}*1SxtSU!݄ޡDIcZ/ p _~N|%$osMHgWCqXhƂu"ܽ JRTcfbm * %fDtaPIj%>'3/|ԓ!QC{ 2 .fg0( .3A|8cF7=SIgm 6]~-& ?ٗ$b^W1(\ŏ?60w,? ls{WJI ?5s1\ӵ{~|s%ȑ#ee~|ܱ̀şzsSa?h9;Y3AX|/{xq]k}_`]Ԕ5j B)U}cMq]a|1 fuamX : Sk=@sy1bŦwl$YArM뼦0m wffZSZLwyLW|~y+4A|^]!G{Ƃ:!=p)b @ExJi OlT0Dx,+FdJ3E_Y3xkw"c43 'yaH)R]!+2雘O>z\P#F#lpj v]7c!H܅&7Uh4'*OJ1soRKĊA{:ސZGV00:# "Ju|Jt!=ܕRAKZKo4`QegBE5jF,U$3"v )|kuOr5s P/$! qTô戮{swg~+#n'Nk= S#XZlO$YZVp+:mU^zl#]'U2!MG UG%HBjRqR  r s!Nk` E 0q<gE58X;ѸjJc*NUb#˖ZNBjT|ii3aO|??O_itȜˈBpX1p Q(LqQřQJԹw?o{iPJ_1{a))ϿM_Z{^;^W~Hk~{6tN&*g=|cǏF1wk8>D]HU%ljEH1@,# * 8<5RDٴE)BD(c'7~fqE!"ժd?,,?'O0`GĆaВoL+kNP%|謇8 M ojr|u‹#kJ4P912OK,Dj 0A;DU3 LE dfp`@A/u bfAd_^b#5Rj-]AUP Im8I,^iL{Ua9Nň"Ek%!@U^;s(mQZR 2APxgϡ7Q:B]r^ϑ#ǸkGjiϴ/\svQcj=4'>9/>.| u|4K0N-G|;/%k{/byeox$3=ٷ2nasc^@y(0"L@ӷÇ_v|7<>~7ɯa>ҁ?_ȱNF.ߠKP'K=g' g 转"8xEΕb:B\Qt7Nu4"0|,ؖ_@5]e}1Dl:n+'T#%wAnQe|5\չqmd)Ji,87nOo%7_'{} s:H+9dm ;[CxL>Dzﱶ䍵YBT(%'Cmk̈ u<)\Е8B>ˈ Hȭ㊆'zi)hep a%((˱aI|=bTdaccS' O,!" $coo";Z-56;M9 y(lɨl˫j *T$/5mRi򠄧^lӪ [Q\zhe$6$o!'b0q,\;^hQiT_i.lp&wnJٌ8\' #Ij%<%TkTNB@ЅEXj5&2 S5PUj@DYi! Du t'NDX[rcY{2/XI>̱iunRcd50[<^7q,N7p;n'q3Kbo_ (УTo#խ`>3(&̰PF؜jh#jM|}؁,CDmTu=6 \0#D1Ni"Ԍ8;;k17ƄߧÒq8C4)4KE:$9uwS583r\OF\/κrzV2Z'lU$f-]s&8Ӄ߆gfɱϭ飕߽n~_ ^ ٝ/f={r5-y%_v|˫)Y=0v {.B}ʇ18+g\Y董ڻ~}ۡTNBjWuITyJ#!FxC޺y'[A># ̗ h=]g0t959ZnXt\=/9hsDppܺs Ah8{ǡ3kF❥~QP777G`mm(XX躬v2K\_z!VVV?_wϸl% gg$Vl*= +l )jIj5QQҟǦm}mg(SJ3fg2 H9u!'ÃsPu  2lpWƅ0b{42RU8]֕l4_=]Gi05ȼx^o-نX`z3Mrm[_oz=I^-Wm@oz=?3?ϯ7?Pon4 wpe(Nع T<[!P+g RA.Ʃ|3m\Y3<ZKbyٱBn[c| #Lc=:8-5h*XeĦt)"A ;Bz|ס#$նgOdB ±+F^㳂AE VOWD\!J"8)^!{<~W_fyO Gv8R4r' /pg?~1;dP V <> xUTn q/'rlo= +[8]|d/5JCaCȊntE L7 #"[F Ht8x)^`U n3"%q.@t(>HCR5B\U/ ?eٛeb03|ƛyY$\p\p3̒#l)9[$L^<udy_.ya8ufWs|efw.ka%% [Z)jrᬹ$ <}zV ^ԉp)僮]{)E 9;zt"gWT r`bq,2bG PӀk;FǎH9S8η]1+^E9AGE3QoJS d{ꅢ*sx 40/W2@~&OzOK&!eh|LkbL ֔?9[|p9g9b =Mk^Jn&?=+;=O`sn|8o>Y;/χ-zm79ϰBJdn!S9ƘMƊAkC895])H)Хm ,TH;f=6P&o8 EAQH6Rű6NA#Q_yRD ÕsPZYRg`cEHWuMAe!4l X (+`Dy. z!Cn.?` jQ1%ZO] рps-Z U황@g<Ī#W悠I :/Jz>!s\w1RUR!k5`/,Rh rtu6Š!19ivW!u)f=K${?ÒQ# 8:^WAVCr22+(=!oATvBDTPq5nSoIj **F)PD^y#s^\ ̱@:O#cA+V4M=VHScZnDޛ+U U\%'t`5Eךz+̧An (`0r,aY\4`'W/t`/;Tz^bE 8:Їy]`a|Eٹ09ed-w/6O_:̗ݶ2@39:I' nY<},M&orͱ\1-XDžwED=zOXJATuG%qU*ޓW-V%Rgqy::IQbrǖiE;C gSϡxj,EQ0ƭ-]Ɔbs-,& /,+ 7_Xlnp+ 6,}ˮypw pP^M?Ͻ(=P&A[/#G}?->;,q䶃#wOO |079/[~_Kzx]èLKɇ1!SHD1(3JWjT}9 <'f,+&P'n2r;UfDKIzN3,Fp:H89` % ")Jʿ(vW8UYjTCP< D2ܺ˓hG:҅GZct z)AnǠX%)tSiD8 2D:,5Iay[$v1OVlf9n5]M[79YƑQoϳCF${6Oo#cE/I8hFJU5՘U|jseC͑'pJH@0`H'gj$: 2J ckJ (r8 *"o0?ŢӪୡ{EN<e JRM9?KB$ib-AzNB/I}M刨"EFҹ·ard6i ^];-5HfCc2 0CHp)qg!x֗Zj Nep(!CptM]T] @XS`ܥA)pemF⤇ߚc [˺x3$E+]t9|u{CwRqK.o^3;Ӧ^](p%sA/qO\*pM|qĞ!U@fё@k$ն ZdEFsFzux)M+XBlMg /8HiaOQ{2T 9wf9 \z\JCs SO/)d5joѢxXl/NE zKƂ ZLL<˝8Ol? BU8'DՍ/'??0}+y3 '^Z &B'n5^;ѣlnnrۭpQ~(G\bˠxɝ/f0XY-^jZ*BnUGrL9e"ѳe zj/0jbC)yASy;K rH"bˠ ۄc'ވ" 1ڞ( ',7T+! +@engKvB {1ief܄/ MyZ3$s`ekg!h0ƒyJ6ԁr$kCnP'2vAIc['&?ݒrI[Xq3xm pm@ش1얩mʙxSZgi>S]wUYkւdg"Xº=ɳ {ѼsBCqf˒-'di'0aU5q,悛, =cxYX}^XU:])x M_x)%F$QA/C=09++d!ht%&d6^[` Q :(<   ȓfi  Hjno!壨f|(Tk1SĭC&˩*cjrzR/&n`i =I"p^8ǒD +>0ŒӒŞbZ 0J*YLB11;841ۗ)pϬ!r#s8%i GWk12G!=LjiBbwz-w$H𒴭[#<-N4 wI CT &s\CP)h&]I&%r^R>ԡaq\Ze_>#dQ@9p J_eX%|9Ra wD&D (@:9NH|) `cK'!ң"7KTki|$s'e`>R[7#?6l">m*Xc>givrOƋ:MU % 2CCFհ0]*Ra! HWKTeUNGT i(KI%mgp]&,;RUڿr G5g.?S`ti7 $JKp 'yI[c=S\љ°vbnvZ#N1y/ ? ++{;\Ey"R $nOqAfq%gV~p ax0L=9kM?smk|,ōci1"Uh|Ʋ˄er}f96 ,Rd4̲6)lvg?,?>Dž<m_kwlle$#02̽'!B _jn1oWnͥt)L+/aPQ*H \9?fC3@s@9B;D*ax7U.E)ϙvx\,# %Ҍm_0Շ8 nya?`*@ɘDUNNX2jζS "JAc Ҧe}2S5'%,#1lZGAci91Y'jFېKEJs[SV:#BU :He ̀oJܺ¦nq:[suAGYT7|A%$󳬷[$'[4"uXQA/s}7;wVˏٞ4?.}J*{"]x?'%z(2M*BC8*SxyUcY:JM] Y8E\`)\mȽ*->a2Ce {[#YkX$д -\$ K&$S+'%Z4Nrz/!YnAN]8=Q#):R gCE3aIf!x%1J_/^j8x-7s>d~$9䫾mǍkۗI5[$pKyeϋc~nQWVVtmo/"O]4|jj{[_ʯpe^8"t:U% 9V*a9^apT_3=:;^wrT0B".Po<ƅZ7q5<D?]fGbE#Y.H۷A&̗l|+,fp`aLlW~:b%QHUwx[y[ތs? /ruvfgf喛xwc=4[WG S=Wr1u‹cbXM40꩒Fur C(w/*d.KD3,3ζ`:.3h6= /`i1qbscGahn;z@ 4LC*UIY& A7 RJf&4bz~nrB V2c-iqDӷ]XHbHҖa>ȳLO&,,YX1y Vexmdr, I{NXG_exߜjrfTw]_ot/\Mtk5C-.1j)Y()(R7 EuGɌD+ΆE?QheAב`k?%Gj{<_ 5xGJp1aPaC5q#ty?r15¼;l?wxaȜE9rYY^>,-,_.~ G?=%)]c2*$JLH`B,t5db)' $ѱn %K>W#P*WT]η2_\d"CȨ h.D>;43Ǐ3sO?pkny.łn"4ō`xd ȳL?g]ͧie0$ g]f<WlADÓu-"IC׬2ѵw=S0x"ګ bj2sz*RHfU2?U#j7:D)>^3|c%+h/yIjy_*C9rF /0+E@= r8F92$2Z"M2=YL诠^Dued@I',_EV\ut7_z Hd 6^x}X"C7uj#z=*dy'<DBEAB<}X0)e8#Ȣ4m1`W $Nאy,6N0h^tȍA\|]Oy^{OxéOEx_,~?w}֗&^w˩k`Vx .^o#~'N?SLMN?SX<(GZt/| {'PQ>穾z~ILH z_7=Y#~t F^ ]E&u|l+DR "po{@5v<8} #{#W)4k> uu!K׾<#P!% E/V>Xȟwy'?3?)a Cp)D(K@&;n$90T䐩,CXt~?|)#«0e&kx4sRb zpc2k'1 -_IN[yXUI ԫ݂-Lg 17Fx/1E _qVQԣbsͰ~=6E E+[Rz $2AP<&!Kd\J/]i`/Lq yz/ j5d#xJ "#*F, ր'Ϟx?]FQB7%+|AQF.!ʥËtcv-qlZ!t-k-Ri QDp.%(H"t8Z41UI4gyq)VH\]P#+\z 5N8둮a r]Pajt9zC.:/?G&׏$I'+˔tkA{:hs{ 74H˺c^x w2)G}Y3>aaarϽиFЅW C\G$H(=~g~?]LN=(⻿;̷~ݢdʽzO{@5yt5ǫjN c$]0^ a Aw$Ήo3nqrP5AA cdw~,%1q\nύm/CJ(e_0i 1&aȱC1[%1-j= U\nxSBb9V 2.!\ܕ ] 15tPHQQ! Ȉ2F[)kf.W*^3t{"ph)ePX"SzJTbV*hzRI)W"1UQ;/\e$: =l^`'YE RI`]AyoV `ڀBP\gx{xD벥'4^\G\[n/yێۯ: ^J `Dg>:p]?,_sg_6ܝG>ּ&3^~rPgϝ=9#/χ>G~mWy߼~yoq뭷7 DZnB!< bp٦l 5 X9K!$<%}o+ &H~_c=؊[d=ׂ%>?|}ؓe~ȈN/ ǐU3X_Ȳ1fc;GYr3__mo}3z~y3plAb<#|ٗn!.!8q8_7pEf馛9_#TH3F4 UaHc,'K2!P% h2[!#L)y'@sKfxcY;lKh[__"ȵg_T'n)IUh '*U,/" NkYOwQ$58 C`qRWؐ@/ᦏ/n л)TL#Jif 8H3szmwh!HRd5p=-{@# o#>ر'af:u7 k"vY.m& "Qä PW>I}-ucԒ9""h$3T(E9n>}٨ʢל[Yϐ)0xi f'ԪkUY4wfe-ʦx5$WeXU F@\Tgɠh0b}I~^*Ʃd(<^(|< <4BRa DO$ڸa! Vyc]ޔ+Q^0px_u_{W_,;{G\Ymr4Y&W=._^l]u19h߃縸5C7pg};GʍIfgY5)މQ0(k7GkAp7=!A ' C~v5q~v(/F̓g{qkH7 CCvW?kr[ZL{`c5^nu%A."1H+|lmmym,,.zkU*njp1EnAGO|G*|ˤiN.r ,;Q_:0Al[jkJ^OJ(B^:Qt#5[^0(Qi=)>Ê'^!0[lZC$T0i Q5-"Sq2aAwz JGZӬP%"K:±4Q_|75b{^=ɟ}cf^#j9g *qo"=Rӿ ZADj,EvJ tܠQp)^v'ggv>8slov pP9O=nB*E_ DJ)ȭ"v תzġia>9Èl]luI;'o$ڽ^!mhiP|6$ZH"I0;]+ᅲ4 8u|Z>=HW MhE뢬#wE/L]q53"ŀ*RV% J٧>{!tSu0cT!tv`كϜEF UE9tEDUa+g"JNcA.GA>yx2=u]t(Z^Yn_NyG=<ˎܮ( BH>q9nNfaeFd7kA7WS(*S$ &sfUZO> V )BR"*(6q>d]9.x*no_ /Fd9>v4x,]w! b`pNO#nkrtsE"Hbpc޻@HE=E ^q_gdVιgD AZ X뮓= S`<+pEհHDTUqjH(TY$ƫ郳 qT/edX`^Hՠi笹  g̡w?pqKRp`raL~4VwWmWo_[{!txlo0^k>K<ԓ>}HR ɚt3GC$!P6ʯ󌊢H0PE3׊k8 a"9dFUkM|Ĉ eJ<.Jd(hRs-t.aD {J22r`Z "+Ev>,>P~4+,Th!W*v3 Tu|#>@Us<{еa.5h%[PXGQa)Rġ[M(|<첔(#Jei{e|#m AK%;-e(q`X>}[k0A|Dv0#ؒM? Y$gQFV\7fˠm_ /Z^>f.k y5{uƑ:~؂ mU-MFP&ls9~?p)|^tx]8{&M(2=D(Ap۪٩ :Z␅5Z#K[iY/rP "\9J-&,q5LqBp9W)LpαCǘlH}z^w /r vwwy_G>~jy}* VI")7e˨IK,)wh'%%6T=Y6 t_Bxz );'Oڃm#g6ozTM13LH2t΁ DSP= eQPB¡"QyxMYUw2;3M#+wy3kgype G9GPX,VȏtTJ%w+>_ŕ/~yC/2.vsZн.#rxһ߅_za,^X+bT=R{hi-'f&F%FVD`rɺ,Rt1>FB`LNuyo|ب(.Mkw8BPh*!_2<\y葠+P f{Ja1YFEؚSx_ʆκ#TّHV>.!|Fc̘u1]/.pg;y> p9L q(7Z^le9 @ aW%L'@a? +Q6| p!Qo6ЕIlt*_Bf¶--ae?W6KQ;UelY >p5v8QQ"+»۶RD`c,;Yi0oblh`@ֵo,^G'L0 JӶʋ=Oɋ̌CYNRCp4Ҁʿ[|y;MKLHGO(AxJ6.T*ȸt ^z %z iNMR1cme]PpŹ*RUVIS9n82{ j URQ6b֨W N8T;7MnQrxagn_ ylY`v|e~ϑ.P%̀0;#ijONO0rDxdc񮃪hy2[ɋgϳ=\9G^os_k-q׼ey/n嵯y5z ԧK3nz[/` (Tc{{zZPUHTeM.E8),LA5 dȺlgqx邡Ybpls UU J%Hص+N Y*LDf/_,N+ڙC$Nx^\5RI"0UغYN-E=د fZ2 z1“3݆45c ekDZnClPtn&y&fcL  :MUc-.^,T$Ӊ䬥1 Wvy0j v*d  ~.̅u(|`σe}E2L^0Mv]z 1{C'xk8(.xyLysӁ #[X|4ť\ pAU9p~#Xjȸ}X8]"Ƒ3;SObjQn+=Dže.oR8xqEuJsL(RLz%C_[IDhoP2Hq-BO[_ʡRP#0 <@`[4)A߿*k]_;f$)ekQďܳqǝw* SOP T_UZM>ʨN "y/@/ҥKt:$ԃ7P|~en7;3MW#As=:Alm:f${+Uo`/{ -}`a㠋DScp2j`:| 9b4 ~zFˏ^8q] AvNR Wl)F  n"k5.8&zMeBJ١TX9&&'Br%"ՉDu2:WVLq{p~ Vh]Emo VH5XJJL`y=f}UvEQ[Fe܅GInL!IQ,_0'b\e '@e+Dd(Y#m3b& VW. ^ z5z4#Ca|s9;_GJ+d(^)wFٱkZG8)uyxwu7fg .қ@1Vcvض%ĻR=|~x]o>hPH <6_ǿGT*KQߟ={{?#'~g_ze;+N^ x Gȋ/_UGўiƙvS1fi^:ff!JtXbgn..=s :숸#@R U.ƂNd1qqY<6a^GWX^͒1- qΖFrұEa{\)Mq.v/{?vVx6.W|;pΡdfo&WVֲz<ǟNjIe~WGA1<MC<kh#^Pp <]7ue D`d܅c7p2?\(r"dI24zA#u`+. 19l3í*of馌-Mz77^NQ%2m7㦅kܲ$mhOIfi5MlrLלUL2)6.xcf&='2 P 85+a^$yM P{R"ۭp\2%R|**#bz:aqZ&X6N'ɭ%X9Vivמ#UyyaAyC2/6Gqsho@o'L6zФ ^ȰҴk,hamO5ۙ ygȽ!ܰ\ (5&q *RVyif(  X+%,_wрMؼFM %Dd~B$>#AUf2 S-X77ٸpg~?߿^k_{~3|wcc2e?zʁ|uu`Tއ3j1|~9tAsϿS{F=L1ј31~,F)9.WZܥ _ǿ‰08?ˍ)U3A)n]C=G}og=W ȪF?]x8߃ 21ƶ~|ASn#耠qOpjDu)A\TpwE9α=S|0{1ǃ=Bg,.,_5H%G}gLN^>}fū_J71դʿ{~&ּx{>O`k,cT/DIa7Q0+5(T)J"̏ɜ[@s:g$q_dh^G8cvƛcS*GKU%'o9(L"V09%HdfAUlqUXr&b c[b+8M.0_ @)AEz"͋_|F1FMWx}8<=+Yc8fM)\c?sIk _\oпbMsLk+994CE ^Z Ҋ* *n_oSHBԾ&^1:<41r1})Exg馳ta7uF m+e0\J=48Z,St6agf {g?S[ދxps˥"H᫳w-kE:5Lyt5fvAѠet]PcN`E`8Y ̢28ogm|onm+M E fwyʥ5Rə­a lҨ&A.-'1O;˕u8WPx\^}x˛!sj);ǥ޿=ރUә+Tȃ&~za+7/S.k-v'|я~4(GnY]DE#6n,V8~cXekt:Ї赯affn3ư˧|ԧ?}(W;)9Y7n 3L-϶9KCPsT<8qRU(;oGFo?5Eqr}|쿿.xv=;a]~ٛ1~@'r'emFW6xgX^^{_VMy'U?177]?qliŘbm{h6H)1s]wrÍ7p 79wu'c\(~+9Ir .daLUVs<\UyQK9+ФXEja.RW:BDGL.Issdi1-M9BBN<5Mu2>_d.&RyHwo& ;}T[uQ0Y|EҘJ *(?\}w!H;NUW.W3ڏ(Ri?#56lDxyyn+^.7nR(AH"iCo}3j'z(Ҝ?jFZ|EڭvYXg{{];^#;^sbmOj950K)JLQe9wH:=;+!({HZ "KV CS.aZ(W`UD:ɱV*= ZvNHYKA-㙙 *\I:Fc϶YNgq::LOH,Mz"H 7JQK%[,2|YaETH{; $ShE6*N6B .s֦%rATIRؽ < !_R}ÿ Mipq!"Öz@Ee3AB ܰ8]w-ɛcӳy.3NE QSD`: J(P+$R e/%^i oF*%mQ#06p-Dp.†w^}(b.רFZ`؉U\4 =.ޛc!h Hq#qG+& )Mܥ3WtTP !ATDzl㘩iFmf'8n6C!%EH ĮCcK!#Mُx+pK`B>4)1J`\ҳZlmSDvl5\L$c+7}=f)pf(!eeXȰX~4)U*rDʤ!Jam\\ŧPB! qlS8pU+8 p",< &g'7?B 9k5nd9p{̙3W8bb?[ѥΗmwxgC SNO{t]67K#{0Ffjj?n;?3ZIJ\k_C p1x (' B"Bøbh +=s~X1Q{<y( EJJ8W Qɖ%R:6S9(` ӑe-Z*B빔*` kے'tUk DT$(r"@-= i\m)NZ7^F2=61i`t3Ty**P [Z "|<*Lgzqˤ~ ]tBNK(r =;&0)U+ xqblA)13u$UNWްrvL,!*Ս?. U*Io d<94gFIGޓ6Wyscu4|A_6Yl2sCzXc,eU!ZVʋ &C9Lw | ȴjc\M8dz̳| 9f.@'0BZ#DFd)Z|uA:Fq$qĽ/o7qJϞ=˙^{7cJa%﹁ 3cwj17>`dA͏(C3`3gs4 Ϟe F{NC|ED5d4CM-0TGD [ SSz?Y]CVNQkr,b)xI/8ڏ4+ޡG?E@JSA}ryByW~))W?ät~ۭiǖȟ~S3VWWygxO<[fΜ9SZ!oV|)}١28 ,H P[ҏ %%+$H9|3Rd.d~UApZRi"Ť-i%C29L u"fJ(/Y/@7ꙟI_yX%w4myZ&  '/Xn,64iIkp\nGFq|ZsR%xw7N,K`{CKo3ַO/{ڮ urbBϹFWhY+ NӢC1AvDn l1\}BfB*JٌЇ'"ҊzabLlylJ Q0s^ O%"U]Z 5y%D©Sd."zXHQFġYSvs>GDeT0āwer#UitN-pRԏ' \!}^7*s(QtK鰾r^ :|ynCl,qy[VFm3 s 8.M_~ *TciҴO"E IgQ;+8e.J9QxygR/w72Ix;w+?saw&\+WiJʱ(BTnĠwUF Hׂ"mNg!JF'JoP24ZRH0 1."x8;P;}2mˑ>hfUk?.rYNTTTwk&9v T1D'{uGva>qg|I0x89šG$݌WU+%KX<9h._$36gi\=Gs1;}lRKHcˣ$:\ $GY`GBuW.^yi|qIqb*Ԣk#|Hi/cEaKYǟxħ~~_8)ޒ=fgfxϢV|S58H>N%_8OѠ'5_S'1?B52h1Qȱ(t98 (٫Ha8<\ DTal)BʘR>r>8Hh)*o0Effo(EɈ,)bk9#$Y='' nMn[r YB恴BY*\iz.v P&twzԌ'\ £Cc>"߆Ss +ZâfSb) ~sRdHqݜ^ү$ƤΜL ^W!!JHoDlG:DI{4 2VTELG(dT L\.-D{aCעօ6FmL B&XݧU|jfE } jL2/y-)3SQI;<}vѠH}9/*lX˙,cjx(B,,HN_%ZED6ؽB"ZDi x1N .΅TvBiQ3[`wI%s(5 j +_ %czJ9֤6vhrfHA6Y-}S՘@O &Z CZW+c9TЕljJy0B2 W!FT"nh%:\B[s&x:BUbk(.6"4y +/xksb FD3A>B4 )Hw(% c`lr]|)>k!ŗG3 vz\(Het!H n_8w0"i0 QWEľ! \IIygF9U4o^bf~N:)`ւ*37Nclܝ!Tj1˕g7nGHsXQ kfa—"+YZD\tCI0# e7ϵbcb]}<hTKfJG̖OFPb%ܫ[1b/5kWp9wPw ELs;+vJ{Q|8|hXHKZVu<2Zѩ=S+Š2-Q0\aZcpca~Z /l+dư4{#߰dNR >sSXυ-KTS389J^c%AVr7MY*`u] Rz]szzDMv?v{bsNVVu5jʕ#v}O >=ߍwu nw}666Y^^b}}yc=shă}-ǎ(?x= A3A,٫n) 않c3<WUJ)h#bQ%|#%ΡdF0M3&.Vu2Id a9/2-=e.|`k )۰]?.!>rm6p\&e67e859D 6EԀ,;^aDPbX_ޱrvBxbh!+<~f Z=c0͸ZbqXdCiJG0aSOWSqgP+  zFGG#ZR)jAlOѮB{Ǿ|j+! ."՘:XBSB4mP&}D>.Up1n#UDU;(W\L(SOTG1fdj$)cgPXxeA{ETPR4.R,6輠USέe!3^AV)KZ)aEKz$*TBkRyKkаK]iʔq)i{ P[y-PcTLd܃lZ! Q;Z=EH˴jUII YesmrsF4mm1:+M"6XCi1*@;Gѥ̦Mwm_!dFhAТEnLN b7 ÄqR;Pn4M̖w2i̇|/ộG8[YU[/﫦[ҽ.F3ޛxc4MUe /4?9__{:wQrl;a/(ȁU#Xbd""p."Ƙ%Y_r[yWsz D8W{~HJWV/q lFr^,UTlb1>'Ӽ(tvDf,>x?Ϳ?c=O<gΜak{ *F1[;vϞ_7nw̳}YﹹZS3 1+kH[3SlO d_Ƥ1Ld%x+ _sȸ@H&Ic֎05wdOh}7G_7(vfE4ŒASi8UtNwNK"b&7D9ٛkCDZ\n Kg`sCs.o.l[Sn <~g.YC@U51_h2cgLDgmč>!ČR);Xt(5 ʤ@ MR:D6;IH$F)Jb1m` Z@$h&Q{gI) ~QڴI-5E'iF@JN!H-21yF0Ki:`l\#:ECMr. @IpSBˤs9}tW) l]SBܺI6BH(:ԧޒ83Ht@jȹ9?̢L'ݣlL+ Y;w$l :D Ek5Lf o@An4˝eVW(ROKɈAr4:(\x$anۇFńCkq X&\fdDLSQǠ$1&ͽOXVʀs_M,55ji6[Kꠟ­U|/߿~ͺ?{jns 8gkɣݹ=4B=ۑTo՚ R={fFIPl-6FSݵ*y0:}V 2G ɤ=pD,Ӄ<fa.0EfM5m09F"!W8rrgCBHױ1iD,L 5m`xߒF1MQ׾iwdT$?1a<&4ۚ/j!d1BuZIExq Q6KXP&Dj8z69t&Ob\eM;RC&$ј̐g9':sCkt[yx uE%Zfxl-!+1LouD)&L0a|GTT֢[9+ұ(At::UbKF|8pJ^{Odۣ^\^/) ^"7X/R̈[$_Ջ@Crs™SU>o3> jA;]H^0/Y@gmRmBǗ*X"Yk98x sۿNU[_kv1H={Dr.AUWY4cL,ʼ秊M Rթc>@g]1\r<~O $B{}Ǫc48H(1g3[c~f)Pt-*2>`7qE>Dp0&׶yHM5CZk !\T,MJ)40GUCDoX7Y7YZ,qf9aG֘L>ave FDqִb2U,0\>~644ՠY~It9ATx_cb~F$@HU0rA e{(|nqXb.Y=# "a@.8-,iT eZpuRaLLgDkq"kE34vJN`Ϗ^XqЭ%|n ĚԞ `4ɠ(]"Rчd G)b;O𪷡l^#!#}[ ս n6,$^jAΜDꎚa_@ٌ0܁ϡ(!k6b}v5R'8[]Z_&gֻ,V5"K˼o_:h! hb Cn)UBLi^DګTG0HljGg*c H6N׏j [P'ye=z$̄Ae@q]K4%W/M,_REo}n ǖF֯[D/5Vv.yq]Gqvɸ. 8}֢mmN>2򑋣lʥ*ׁb^*'};\|Zd,obqt t 5X豸W7TzBk6ՀEgx.3CÉMw>r>#7U+GW{S@_Ҵ)^Dtc֚yx'Ή(?"嫏{3 *r(O~sljJBL.gۻ=Y\û(a[%_t:SJB')N行ZLήuULcY\QXd~ -؞D5W3mRn@Z-1llq&;2-s,vQI xn2`Z ?H!edD .lQ=*L5EQEpN`3y8TP- $b=G0~d ZeuiRT>56L$EU'1 2ɴƊ69Vu (E3}PCpc-2WP䘢*2b*״c4X-豠KGq)RPDB奨 }䜼(7/mss8_crE7D//*^@nJq}!:~#۴:hg6pC렡3 bf w+VunA@Q[8'D7>BJ$tR"Ӧ$BG%J79O*_sH>]L/jcc|1㠄(iC1qfd_0UAe9:+1kT`YRri`45(e#w`2\O'Yݒ obŢ #!fu^9 VPk6'5P"(alܹS,FzoZs8hZsy۱#]Yʰ̓е .N3N(GH1Ba( T@CA\n;H_؅\:(3FQ~ StØ/.0I¡+ZtJKvNb_b$xV 6)oP)ØF^|RhC21SD7 CYEQd0VShF8K7(=YY E)e+-2TQ#sl%bNy+MѶ1JZ"s(4Hwr92 >1*k P~/Ӵ ojжYti#vy΃Ҵ!t`lbmRm*C!7bL;Jj:>OIPA94\,,-`B `[?y^*_J:瘴kO}L%o" 6݈0!6&7`52*vf*&.N>IWi%V|?aWP!Gm@'N#AUn 1VeM9!l$:E;ab?!!L񭣩*W)(C,F+@n7Ua;rH#VbZx˛9w2}s F#L Ŵk5m4Bj-t E;hs 3wi"R'.!ɈlmͫdF,PD #mc(f"1,itx Vda\jwдT tP0mT*Rj ) Q)ڍY%PC9 =9>HSъT$=1%d,´ɱX$ji2a7Ĉ;Cw|ƘToǠ1AȋJM$ ȋ-kXMQ X\guns`cYڏaP4Hʗ:5-Z 5(kQ^nc*Vk{/x%TF}hkJO+j"h E{!{ܣmucݍn3>Ŧ_Hr_$mb~td\ǗFM's/yKd/nln5%}S'j/s;sTo<5ju0!6VI~ '5/_i]@p~J!@YVKl/IU ؇`kCKƻ咻5q-=j^eLR^P\T斢7LdpS{.LVwtQn4j1 #St+27"++Jm6=ʨS]tN!TN4LHQhnD"OIJiXT=Ip0"2Cf z ˜8rOr^۾\3 GaT]'P=b38 78G5cܫ?/v웿;6F7~q%>׽|} яW}Wh[|@<@!{L-m̾ l(4Y͛y&㫩igF+e{WUA8\La!0JCۡespeְ͸TKͬyP,f]nřaZE.9x% :->YNX&<ʊz>GScK¤qt;p7.]OkSrW}v -f2")"#&#䭴``JIt&-Qg ԋ$|S1SaL-bc 56z0GNgxUbo"!]@1Ӧm9\_&(C=ݥ}IݸFXqSm]h:B&S+(FcETn]\%EfU'?M5Y֥VdB6NDmQ@n!,U砊$Dl(Uch]0yڛS& %D5Ĵ+w="_ $KVC=3nopjR$2.ڻU- xTI9gzʕeyexgBHY"lwfGdioeaJz m~uipP؆^^ ;ၷC]z/FKӊљhѦ E }Vo3}+olia $ăQh#(R 5J9WY=D5)5xF|`؟_J) 6nC-lǟؽO>Xt+Fgנ:&/\*4 @u* yNdmm.Z)FW\'`gwmWv֯JΟ?[󎷿}-oۿO}ӧOֈ.5?r’zgbJ 9i 0fH8|?POWf`ĝM$bv7udH*.aWkH,u:1PSSiAы+UD榋2B5IӨh)w0hvv0u^DŜn!Դ4\ɤ\VظEF;]E^Z0&S>K Z95e O~ c"  J<&x=9F#|&|rL*u~M-J'ڸ)Ujr("f %CrBhQ4q|E@U;XjyV9YDb@׮npu&E|oQB,: ꧘0E BnUpxlb#b$QI)p .BЪ1P,/_Su{-on"A!@ ,ghÕ4ܧ"kҊrR1}Y3lWnHcW/~:Æӎ{|A^r-[RF\>L>5 "d4FyV p]ww}yͫγ6ǎ|;É3<ȏM̽^yC ?w}wȣq5~W?m/~w?xeY(x[nj;TQ"6kކ=pƅ0~gMJ.T *bŴ hX5BUæŦ/T%g K9v-6  e婝!kȊ_"E8Y!PVWp??r2 :jH\5ѳ}Y1dXnlUtKMgbV͋ؠX2S":sٚCړ/j=,JVs}3dz(dD ":0dv8YU ܷzNng)HTuEv}"KRs,-,fJ, xS\_RdKK(uV!>|g#\ #RE$`& رsUGL!0r6[X".cZƤRMZk6Jv;UXD⴦P((tM£q8!! $5g.=!'N,g(AcE a}%uQ'5:eZRfHI:֨14\/A2N}D<}nd9!V$Nި:#bf'5ϡ_ίdBIK>խ# xII_ ./Ac$v +r"k2&H6Q n:D\Ah?V-m@};K\,)M1Flq?L&/KPF*Q !P5ykyn-5yQK&5!_lQE5Z:%]oDޜE,ZQ@EKɽמ($+NY{}z:ҘS':[~gǵ=<#?Cy֚~S(X-";̝wx8w/~._p4w1P 5Ѣ 1abtxb]'F#?Ep pgg(]䄢Mm4#/|ɵLє륰9 츌=X|Մ 'kT)ׯn2 y<v1yі*vG v9m6 ˙;#<ۯB(DR6$GD j̸j 51)_ WRS!:xlH&^ڈ"0{|rSPi%+>!6Ep)[U l ѭ=i#Me:NpW^G&VJaYA&,1skj4-Uaqt"@EP# lpjY5dɇ`]GXb;")jTSaI}lO**pLAghv΅g  cDų5ʱ=/F`M2&ӭ1`$,;CJyl+''U3#: ]쌆C)ťst:&dn.w SDVQ@5nM6#px!y!蜧ÔX19%n\mi洢:6e8&4AQWe,`ArtUPh6Bʼn04YWGiiX,)1.t5,p#rcGS!xLu{Rt@+t)JN6dީ4h2YtQ}?FejCt{@jt3'3O:N"T&UB:MeAb!LH?{V &LBE*BD7 kT GPXڦݠ,xX@NVM)kUA5XISr5i TqD#o㏤sӚzu8ăE) M*!GZOŇ[qs`|yi9>$br޶S}DN+;<1yn泞‹hi)u_| ̓o{Dp^k_o7>Wy+Gs? |ƿ}_w/[SO>m W]G)&,?S'z~z^:th^ǟxk3~!C@YUL$y!D=`g44XƄ*: h&vfh1$+Hz<ˉM+X PQTbZFBrꈢ&g42b930aPGf}Y#-ǡ6~7JS kUI8YʺZpc.*QH,mMV؈])ڠPB7^d][{[G'SٮKThi-uzB=o!YZ%2܂l^dkLm< T}J-}RČ2e"1FAUgS^տiN1 u+ HM,y*Nqn& v&Stj&WrSj(jBYs3B" &:O|L1/]Qw%II2ӥ.zX"-+2LdX^#{\m?B@m%[Sa+L?BP`:mf*h: O.X[ʈ*0Q6EDIh(S;TI8ᖈJ~)kLFu>j)S[MyH"ulmQM&LQ^ * UXhg%cwω_LcLڋ(H Ҥ\0w#7é;`gjl)M1XIp߾p ~ۼk⛖i~X𩻬uCD2! EQpaSnn0VۈٯNݫrg~j)S~muxY|=VU4`gg}? o ~dz(M?R#Fcgєį=ɋ XfU`SD)xB͡50b9v1/U~XF)5^s>i)rqo8}~׾ɴMo|=}y;ԷG~O%E=[&*ew'+|c|+o9;}y| <,//s=vA`ee]~~,?[V 4>Oرce羸Y 1Sͼ%;z 7o֤XjhQɗi[Ͳ)"QX LwS.kK-",Ca}ȕO*ZzUXlNq#"prkVlAXv9#Ωk*T"V"g2'&Ax`őe<.pVdS3ͩ˒ccѮMLw>DlIMJq>B8>K]U)M& `$Uwm-1Y"Db nĪDGrfD?Ng2mA!@Pnb^ݢsghȡcDlvzуwV;]hG ׯ!6*:uGdK8L,TIHhZE+V; ɉ 3%j4v!S]~|7}~FO =B~1bdVcf:py_^>Fx>>O㏳Ʒo>uF* lKws|{{K+:}O}<-5U]˿k|3!Wfk{Ǐ1xdD]Whx?&sv'zZxBpm䳞s5kwp8ň݊;LWs^!LkV 9$.& /oՆָNȢpu".915FقcgV1wFPDܿBQyb]㍇hz\8.bC .r7+Oo1TܨaBvD_s.G3 .{72/]͊G>z}j18Rn:=_,3yc N#^4;!ӲL.I-b0OmRFIp JIH %6;(+^3Qy[Wv6Kps`F&Cu8st;Qj52ʄ'߽>¨ɭ"Kp⌑?@`iӔ1 o{Ws?K#x'v:=<{nn+&>#vhG}O|yN~/667tg#21*,Z͛|xE]:u7o"gϞZ˅K%>,[[;pZ3gCJΝkRYPSNC|R ҳ3%pA1SAXVTvN;"cC˰kk8a#*RGFBn;N GW76,rlFOG)-5h29kWxx:N7wܝd_h' 6 LBbZ^J}JJÆ <2#n˪ݶ;oh}$ĔRA 7!M%?ʯ:(`ss3c]Dyi/EGQShڜysי;)ロkopwQ׎7op;|u]>;vyɧ"xǃ{U_@eedO|{1~iΟn0JZ鹱>u0bb,j#qa, :Awwl,*LE8a嘢[ 7 c R(dw N)8+ϬbaHl1ȴ9-)Y%P#SLrszXi DYa5'u S RZq)a#9xd5kC[EVMdT,ȳ #ܾ^> h_Ǝ]k+oL~„HP*D HL%m6QYRQ Y;sZg\;}NM4 D(!jhw}/D^c α!Ub S57)g+%܍F;nuZH 1=t"28BCEAKr։[x[:*wL]vdKY!+R*Mlm!VMzΈ\kP3@1!ɜ@n*]nmHh( oTb882\]2RaP 'I| ǓJ ! E2Bf"h7Sɖ!:מFyOm2[hk֐]VWWXY] ܞ @]{";aJ>I{ >*Dl[tUF+B)%R2U#7|1[mX\PBʬt-VW0C=JU.TIΗʇ_Q1 [^e<4h‘,ڜr/Q}rBnFx@)9[W<4츤 u/%0cLX[$x  ig0 >Gݯock_My9666(S,=r)^;vʲ5U(Œ'yqi"ԧ>͛|=O|7}[˵]FuvE0R.AEhA!HH((epb$茠6A0 >!bk2F* }S骦f@'۹\3^{H[+^M=JqZVdsfhÒ5tM.f $2A $r\jn:ǖ_VhK"H4KVծMEo{G}ǹWq;Y^^B)h4ʕ\8.ݫt5,t(f,//? |ןg~g7nTr<( z.LgIʩ] (zY3qˣ>L硘4-[7aP m&.pu{V*dJ1E I#PnB0k# -,t#t4b[579`*xnQv{ŪB!zN5A +V9n٧ ٽp)v^`scx;ۥYrw1M }`Eĉ"O;jjѓ1RH! F b#<B.?2ĘMg I)Z2XKm$Cj|Ps%ԍlKnN:A2Adm ɵ† *&^@ +yHAƹxDㄎ6`:iд2D C kh-!=AZ+)%)*T1YB44]'STuYx9q8M#i8a}A{%Ot)N@ (iVnF BaTҢ("S*U~+oEb:X?ňǺ1:Fh Z5"} UMx5t7Iӯ!_UB}#tF ׭U_m"\wr:3 mh+M[k:~ QbHD!DA# O`q7dhr|Aͅs\•+q?zbL^st%B;7S>$bqnll=4[#^r [?~sE'?)“ܸ~=gZ.񧾝{_Rg?d2+_|?rMsaP~"6(2')Gd#!#s j`EX< nt[`qK% (K(@;KKNU: Jsy3ibY\Y3QF;b;AXi -8a!kpx#R^*"ȴ&|{([} +\^B eWSQdu,K9}݌̨$z=⛾9 2 T+:O4'o) HcM+uZYZxUc4-]٠CšLM-*Gac$D$O\6xU `bE/zs<%kĴyAD1㄀PX _CZmhl;QiHޅ,OJ=V 92xX-C J\2!2CTuT=U5A Rp|<@[Yi[1MwFE-'b 5BoX":P"i)ںRIZZk6VZHڧdJ1o߳PBE!CĨd7Z8vN3nl3l ګĥ#]"tJb/Sk)(MRaTS0miAĚ%$f7)tiI"[b:U\WΕѰsk~N|xvg'?#c TRjnVns`I_Oa)Rj5йUNмj]v3'~77P(>OCիW._A/'L&~E|ӟJR}}?/Xvww1}"O_?Cۥ'?gq!B 2MpcA{?3cj_EQ#*d:ՌЪa5SY<v%E@oIح9$Ѕ6l_e!FԁQ Hinؚ|ƤŮv:Jc$UNe#TjZ4EOz839!kuR5ap%Vx 5՚841o3-(|:٭F]T!IzeΠko{iF*^Fo'*fiǻYsulLl6*U˗.+hqM-09f2I?{v찳OXfuVы"8iO&+66ݰ\]eڄ:.^[X Bme-dˊl!T[@j-- bkBY ,[udajnKvLU(2v]rҐYbdVV@SLb 2 6Y|x4eJZAa+겦4|@h mё lН:@P-|zɫT&eY uzt`&<4C- HZT5Eʲ!(]"2g!T2gJ02 2F4YHY( ZSeQi(Bㅔ]4LFlFd5";J^I^SU&P E9m1Z#6 D1x&K(MQd !FT~LX19b{g񴢖8ԫw_`k۷]&Q4TC}|DVS$L~bt'6AYjL3!SE+ ?BDS*^ຝ?KWD}Bl4ϋy5KU[CSs[ 4U=;%N:e1 C\Cb2*c}{>,g3\glBQ7Uއs񪈍JEKPAx׭8_iyQ%%):ꀚ*lH>ldmPp-L`Ad)NQ0 Ă5(@jޞ2*,M\ VlljbNl !4IyM#ZEB(\2R{G+L`"'D !vN#b;%P6aYJuL+-Us3T2lp\0(m<")SdVQ0*!!4j"d9kZ~(tq`,W@@t;8 RMMWtj%yQd:Բ,U<5.E9"S!M7ht2'+7Y +4FNclc$VlT;7(IV(G$Lw~ܣBw4Zp[F„ڥ"i#YP1FfnL"TbU38MfWrKh7z[/WxA ۉ\^kI^Ur6"io.m4Bd03hO,(}Jb/%pĦ%T%1e THSIs>,ohjwS>b^@{#j_;`ܔsq&)[VͦXgT2uMdy+WT^Un5jvz^Jh}.es=YmhmƠMА&2NAkIS1[+kMEL'@^8e/bֶm>`\ڴyH$E9;H">8C^{rJp]VMcc֖vWհIٜ|eFtjZrX|>%nIHeD9y^"M-9 .ƘSbėH % Vwoڡ[A:VHoD""߬l2y8c@)ob.|ʘ>fNoV0UeYyDC8}g.Q#|+ ̣ NJQ! {:o~.VL˃4GP[u_aE/0*힄PLzު0LSd~i9 | . }8sO_y}KgOpHRTUX[%О3ҌL\XSk m!si,OL./yo@ARENH԰Hu9HjdUmITspk8\߳{S_舔[k\6f~V#3ϓL0c:k]XPym/~nyBnێ]۾n.wYlmC]v9"'W\Fӛ7sNwvݮun]k2{mE3mOS&H۴[3S³x-u+6Fu{rz ru?vrm/U'W8[ .st9G$q|rB![5ݵ+Bx# .*f4pp*ˎ9.-V$9o0l,nY0@DK\?ǭZ|NVU;{p UpoQ!cM>,֏/pcp`x q~6X({,*x4xrs?=+<֪;mc#kcgc.VZ.lyt% Vj緻Z'T_`]7oI\@{[y C\-Xx2e:(+Y9W7gn'6+ĭ.+RsXZ?G{~]ET9wsb.M0"dgg3xU ,8݇ g0Ϥ <'G;M8) AhDƃJ'p<qc^KP*r%%wZ'ZI) 2'j$~ Rܷ.af?759 $5dJٕ#55(S3E&a|۟@Nc4T}/;G"dmt6 {߁# rG7Nûv:| 4%txMXibH6͘UF#{]7X˔u#5ReWp;-wuL 'd?_KQ!U&H;_+YS_ՙ#7{lLْ*OċC]C3"T ur=! >{+.;O[Fb(&I=Tf֓zk,Უ=h$xFUMG|3fӇfW Zp';Say&1&E\1"Zx LCaTL~$8&Uy qg8EPF#'VC.zz8z+95cv]+2WK (*V9w5c2_py jz{=|[5Õ0z؄k{5Sb'uWVhm2My{Gܛ#]5퐞ij%y$.eG" ]G5yD&}?.;U{Sz|Nhh4l ϟS-/ {_74Møj|ʇ9~Oɒ.up zo) 9qw5? 9!68JeKyGQM]ՄzB3:w?}J7z٫rx X># $JӞR|@ &d w啝j"Vf͹BDQpm3·9hytElDUWv;A?˪ڊWwMF1$l F9/~Sye]W+E#l*j ~Yd ,rRb\6B+]EDlAP*yY-2خ'vvi1E\V1*wAOG!1CqB䵒:ϞsV DF8v_u0qH1 h5q78{9ʙ:ILp"yeLl!a^+)k@\,3+&LazG^ bPb/Wʳ.P9 7;W>"/Qs!pkm#ewCYu쭕"a#L|NfT#NHcXG㊃>+7h>~,iD* <}C^R^8_X"uKtsQhz\ŻlsdnWw֒Bd?ErD4u\wԏ1?'&nٸL(Rk] X#"imu\ =ͭM4E#9R2iŧ'.ĞW^(Ui sPň/!ЩTlՄdƕV 5^l$J 55N+0}f*LKXn- e:UQ*afXy1T%o5^m~Wu(u=A7%GmQE˄@HI~Y<jK迣 Od=kk=ŬfBVП / ͇/j{;zB]51„ض k)x5,稴HQSd{dw\UQvS9d:N<9 W\^]o>^zkWsH( 8YWKrErsG@0|MFIg0k<[k+ -3;!;=Z~L,v2e˚Qs%o.BA͊@ȎMhk- q'Bs*q7B&ހJJK/QHm.Yo-}ٲC$ӮK;mHfq͵xF`Z1Ll@f\)O?(g BU+w*T8đ,px̻U,G|tYDXT\ | Og&lp 2zRF8Dל|Տ7g1s~\R,!}Xc+TXDt-v"}Bl ?Lj_/={łgͪ!HS8%+yPFc1(jΐ{Gc4e\Mn@Cꢼ +L70K6E%H6XYX̓WW;ǫr;BӄZF+[IΥjtn&JJTefCG@&R!ޣ39Xp8$\I}C$en#x u"4Ue9SQZR*3K &RcźFZ(˯|*}ЄwJU9 C=ûz"45|kj+ծe553ᵲǶ `6xn^tm T)Mᮠ(fe&Z!N2bs~^ j.N%+n-\hCmi,R[CMws"/Sﱙq{_Z`tCӍob7haE$"< z$SWUv2x'TVYv$ }|PWVu$G}'V'?KG3$Cg#8<PE{U`+WϿ YT.$'6&׾ ҵFoWH*fΑ4%9n'+r%$v<^{I%њYZCJ #Ug-ǁ8pUN->JphœWtYe%0ުiSoM NOZ2#^V+e!#G.p :$uhl)0)({M5-9%hBL)ϕ*.?{SČ+B{|i-zE &ԕg"gg\v$ݏ/>^{J3np9@1nϦYQIj9fst1˜ȹCSe?&; nkuAh`[7 oQK+5r]mŇiIENDB`ImageVis3D-3.1.0/ImageVis3D/Resources/icon_512.png0000644000175000017500000104172512320517543021166 0ustar mathieumathieuPNG  IHDRx pHYs   OiCCPPhotoshop ICC profilexڝSgTS=BKKoR RB&*! J!QEEȠQ, !{kּ> H3Q5 B.@ $pd!s#~<<+"x M0B\t8K@zB@F&S`cbP-`'{[! eDh;VEX0fK9-0IWfH  0Q){`##xFW<+*x<$9E[-qWW.(I+6aa@.y24x6_-"bbϫp@t~,/;m%h^ uf@Wp~<5j>{-]cK'Xto(hw?G%fIq^D$.Tʳ?D*A, `6B$BB dr`)B(Ͱ*`/@4Qhp.U=pa( Aa!ڈbX#!H$ ɈQ"K5H1RT UH=r9\F;2G1Q= C7F dt1r=6Ыhڏ>C03l0.B8, c˱" VcϱwE 6wB aAHXLXNH $4 7 Q'"K&b21XH,#/{C7$C2'ITFnR#,4H#dk9, +ȅ3![ b@qS(RjJ4e2AURݨT5ZBRQ4u9̓IKhhitݕNWGw Ljg(gwLӋT071oUX**| J&*/Tު UUT^S}FU3S ԖUPSSg;goT?~YYLOCQ_ cx,!k u5&|v*=9C3J3WRf?qtN (~))4L1e\kXHQG6EYAJ'\'GgSSݧ M=:.kDwn^Loy}/TmG X $ <5qo</QC]@Caaᄑ.ȽJtq]zۯ6iܟ4)Y3sCQ? 0k߬~OCOg#/c/Wװwa>>r><72Y_7ȷOo_C#dz%gA[z|!?:eAAA!h쐭!ΑiP~aa~ 'W?pX15wCsDDDޛg1O9-J5*>.j<74?.fYXXIlK9.*6nl {/]py.,:@LN8A*%w% yg"/6шC\*NH*Mz쑼5y$3,幄'L Lݛ:v m2=:1qB!Mggfvˬen/kY- BTZ(*geWf͉9+̳ې7ᒶKW-X潬j9(xoʿܔĹdff-[n ڴ VE/(ۻCɾUUMfeI?m]Nmq#׹=TR+Gw- 6 U#pDy  :v{vg/jBFS[b[O>zG499?rCd&ˮ/~јѡ򗓿m|x31^VwwO| (hSЧc3- cHRMz%u0`:o_F9IDATxi[=kM1|s֭=4I4e0$ K,Ya@$aL[ à ? 6E6&졚=UWuUwmت,-jH< 1L ;;b *;o?筷0տcTӦ~7|s#5-,֢OEH@I@0OFcl`^[mC4[|Se?&cm^]ӹR>'0.6 ȉ(99J$rh|ޅ?>1;`a:v6aTQk!Q7!?L/cʠs+kcټC]k:.fSO lV-}=?z"0* f9l*#\vaֶ Pq j&X`caC//Q_cvwof%M_ptw,?u}frBS;^ԞbJ;H C,;2~[A\\M wp.kc"MXGT[֛ܾ8~f“}Gct! 5Q֔1hD5QXU::D^Ǐc!7@XWq87Dq24[ҡ!b`r$NRYR% ^nk_870K^J=f~;"#A?NBPbƏ[qM5"@x9xsr3.3n6%ڌ&D&yF9lZFF(m8,HDyXPe +w66 \-`[ܦ*63nEǁ l;s SS:n׻E} -cCܝ!]x~I}?b>W1@+험/HcTV 0 Yow+_u{l8.nn gEcՓk2!sEd1ĕl{U6b$:x^;QZ!a(h cSDdX T!` ZqB._B2@nD"xGL=2K}AD3E[ko|Ft}xr  }h=]1j$7i ̦d>d2}HvQ1o N~ %Z+{=1R5*BCB`bC|hD miCP|G]/K~v'TrTõ2}4qa^Pyqmp{{){ZsHI)9b f1pB˞ N9o'v8v47w ޝ6޳W'~J=]c0 ]`61ȿsߦ,2Eɲ۷=8E)9;+Y DGx)&toG$PɉkbG#t}/1ȹgLr aX-\.ZW;&P>f>\Ѩ(ox^LOI>AǝYK9_!s\F4Thl0}uWkCsLs" p ^_]W[U ʢ`"w<ϱYkQ2!GcMQ{P X4%ڜbԓInqƤFB)GEāPeEL~7, (o!gE{`uj; YƸ%ڂHDc AC@ $?F9IX*AS7[W}j.h(%=_Dnp}0==A]J}KlH8= + !f&pz$rTUA/e\GAל] `6%m/-FS)`gA=qXfU肘 ]}9=h0<(2-Iyj;٣E7n=ܿF!"|`0m[f}OQo3C <loO_޽ 1kj."J=>VX".!6 Lavm6kް\NTɳQUЄHbcgYFQT` 0(˂gs1q-Lf5hWejfsh7);3]ĨeIEA%ﰳ:lL 6Lې@e" OV- &n@fD?GLͷР#R`'RjRSzuEP">#VОv2 Uc˒gX:4ɑt`-:*${ՙe!Rl -x״X98e&8uEu!kh%k뎕u2m~ɟAG&y#77z"pۓlFЮIX*"q1CE^WAV`]X:>GD6 (GJa ܐW>y KϗU wXr̢园#|Oxv=®,"~={ֱܿ*A;1O,P]tLbY:6>ZsT 9M"CR9ksUY=S9棧+xl%;qJU qDse5WzR|xClAt#F\\Lzwi'-ʫ֔fNYguE5W+0ݗ>2n+(A~_cvqDuZ@L%@GS;5W^U_9'ᥑrlh Ns]'tThqgL9d9}Z|@QMCC=R߯cK_møc  I ĶF9U@VF%S#xȤdgH<uS:hx]N~rF' ooe!2,Q'>y(g*"~ʬk>H=4k{vL"2=OǢv)3ⲇT;vŀqU:G+Ϩ}ʣ~-~=cv^r?oxǷ, f4/u̍Fbc #9іHh6\4=7|!=&۸\֤~K#&s*=ċ 27-WagvƤ'8dp 4Ypuӵ]Wr˱ f?*ۤgnKs vA=.ǔ#] ֮XLUD5Scp A~߁.T 5^-%*.׎e0ь]Z?Y,r=RTG] .}NHYHjB#c{q±C'D\m|fD1h pY۽KSЯ)@h-쯏UdTII$E3e**<*w-O(:牌0Y cnNxm;3Lb`h|LJ2'[:, ANh0'Xhl'<td̟SR ba* ul㭁ီnpO1nq>19=aQS/AhU18LPCCTzРaA` Lr+S HreYt+|8{  )7+_,H\hcJFVuj%dAOoĬf _:lM:Vxê {oяr]XwD]JmR> w)4mSn(lbP N1[AKVke.KbyV[֗e}!Sa*7 <bR}]L$ڱ*A%ZBk瑥̧ s0h^`(1qĘ/%k-][y[F{S1P w yETՈ2b6-B].$-JA~c$op0}9C?C^g,Q**>+p|iTG.ܐ j DOs+.- oܳy3ZDIs>lNN7=9>;9d{yj0ʇW,N\K3/Zfw0%="fǰyF,DGһ? j 탷x0/׻/)7@gU{2YZ]|EKYx0}CojqR7456Azj]:Y,E;`Mfv+EPV9i=ZTc+xhH)k^9DC*fTbVc <鹴?:,G"6!][ΰYތ+w-koNO*a3$Rkl5L95  u13RɂEI0Fxcϲo YmE9# ې=j !g!F<-fFhQ[J'9f]Rsh$U Xm:4)o=4ω鴾&mm$UT1uC GmEGIwsfHՖ;a1[NxTp $;5s>Qf01Ybtk9cp>1]s^ e1kWޡJBW1'f]Ş׸9 bAb' c1˺$Wb&&^6yP8݇5ISrvTFTlySeOzO(=6,0}b 5/ڗNYX +o>nY4+`?9A2gcL:Kpݦ5üAJo(7"zU[}fNmOcFC25ǟ2ue3"<-<%fR`b .Eƹ'Ո6h|[MrHcH]aFزP G}LtI(1S oZ*+2%b2KzE(Qxܟ^1}rk$1uR>j]uU}پT3/cPPa4ٴ}%o_eb[_rY"+@WSPFjr 8LJ:Cc3|CB7Į@\]I?B})2f933<)e1:sG-QѓoWp>gMaeg/I*d۷0bjP09Pa1rZ e+ ,C0t87*S26tOh̦+#Ţc>\ P.F"wO ?&¬11y+4D6l0* `ZKk)2* U;8VeWc] MYE ]M5WV5',MwN{GK5* $ΰ񤟎xI}哯Tf 77d7jzOC .  `=iLHAaRkC[T~^]%lw"曾Exy:IrsX+U\h $H|3hJc l9/a]C1F:LG;}p X4zfmrlVA7ܠ˹!ݖQ->_o9 hN>@r ҩLNL)#5H4&wLSwصv5(Pի:^$ͩGTVdzrc \5–CrQeFE>Mofy+u3sUK{T!b*$\>js$0I<| ,cF5Sю Gkst1!8Ls€f׈3<8b@ƐJY $;x3s?<O>/mpy_9G45,餆 ưUYaETbw%UC9;<>x~h%ùUI5WT)؛{j J7.C@ȱu=$TyG@B*tK%nƵ +󥤬lX%P_ӝ^z-u[u7ߗ nnp%Gԇ9nCԂM ԒgM:ޭ$,іk+O]˳?Ɯ5Uncr AeU+ ޴3>r9SɩUC%,&U}w([wMF4D0*D =[?Ծ<~5[O"4¯~GD1EBfR/yGbӏH5YFX= y5ir:u8xkV[ Υ^e. I\ 9 1At֪ 3%5 CFVJ`H N]f:jY G-.!B[kdcގze1-rn$㩮D\Yd7T(4m!s%RaY$$Gsdif45k|vIcA6Hc=:ŀj)cOvOxȵ#jAMbGʹn i_+>j1!^-Zɼa$ X&-l̗I C+ UɭK.*H=$+JBQߣikyC!5Q;|Q3gb!̣a 'ŤDiBNYu"<㈁̦|[cΠwa#>G!Bv6M< $* *H;W@r͊k,U 3nDuX~3$6IZWS3)8rF \֐uW|fAK{!Mf"9z%gߜC ZV`ʁ[%~kXi+_ 60y!d9WNoR@f T݌*L 9##X8 g,CYvkRr.%*B"X:1 %tUZ,hAIkxo1@t!0<{ '||oޣitXk!F\tTP`T*dMPT@<1"rFj7`jaGjtNd[fDCk,eؠtbLNg2d;帪DK)3kL]s 6Z "[EKW.-I#'hǖ%رh3𓏔 B+3KTAcBXlVGߪYQg/duKa& 9̸onp#u Nu9^nhk(+Gc5Б~ezy5䂏YgA(;t cpUZS$Ba>=}#<^IKSԾ 1=ńu} + n^ŇюZJ* ńG;g`"(MCe0;:Cdk뀿ΌohQ[!hEN1 C-UϼqAukjh05bڡؾhN3Sj0N$F0%vyYp9#ߠYIV 'Te.3Z|{' uh3 9=7-[zn{vaidh"QR߲OtNrr8Q (+l@l&,b xB,׋lDO翺>>ij_*|W)RObVηa 5`đv#y+WO: , ~Hf *-c'3hk">2'ck0 %dh14p1"DnG 3F<1kkk8Zy`]Ո7rT&vԦ$7AƬM:rˢ |Ԁ#:xTY͟ӟ?&yاEQu/$cBV@1bhCw9gor: r"!#JhLZ5^ EԢ^X!'TH]cxc+g +H$k{5hQ]qO| I*-9:BUr]qTq󎸨x~c~5xL:ά FYqPθBՏqf-;p;YujKd 2T+4!<  YXBtm 0PHqvq7S7!jK77uNlL_z-D>UeǏl0-{֎<&J![cs;඀g <',̞Zb3f63哳gg%gk{]CGoQ S'}0[4iOeP'h{c[fƎ?5ԓI'443ĤsW0d,L0d8ehPI $ص=|Og Sk59~{RPb@mT[ 1nwʭ8ae-27,柇TZa{8"Ӧ&hpO8%2I4[t.Kuc@mHh/Zɲc|oB()݀_ywƐ%wi@rx3t veYnuC}CWMњfD %Aakɂa+ˈGc6˙Ec Bi;|.g)uzC z1zɩQ0ƒk@b 4vCĬd8&#pj's"j #'d1nY29[Gvs3ȞtLxX(,%JEܳ.gM̓"*#x3̣赴&927A8n!<O4_1" a^wH ]C`!?J\5Z-*O)c/3$3PD>yp:[~UB֬e7զ U'UT(rzސ^cJ+_|qv=$ր6@,v6ap?!$~m//!zzv昘fC;U4U!83a 651v1jFO0qĝ UQ%DE7ׂ ~b9o=?b?Ϟ5}hIvﳰ>Gls#Qv5_})#_~r+HTTCyT":G'WUhQy xFᖐW`3}\xrXCmxDWP*|?w l!Uɼ1]&E.# t3~lrghQYmb[#lr4 ԷB [zrB jQMh[6|V~DhפޛdN0|ʗ|5iQ9!Btķ[ͱ2 Y!ШRPw 5NNT d!,+D`E輥,V-iN18l-Z3`j+%b5IZ0sub33欉o;Y=g)OO{GF Ơ*̳i%!9@D_1b=κHϻE88!8a۾Jmm'<#f4i<^v CIYB$6!:pFK$ l*\J+WYLx3珼޲U,p ο?wBB$( է?r l;aaܡM]Ge*;g6SG%Yz**)o={םjo^. {S !~ *zd=vnV߯drPg=ŷ` aߩe\z\m]:OTKɢ^whe WuM(%}P:@;L0Lm'X?G;v! W-w"Bj]w['JoqƜ-놶Y7xxw=$0b8;~K{ܳ _Me؍ff~tMZlb!Pø`Q2xz>:vm#7E|^[u,6816O b4Km,X!txܵG pq /N﵎ͷ9īH6sAj*؊S 5PfM$Mts5N(-D PIn>s$8(i: NM-g'ӳg4MگC0 cxʃ5m4'f̋Sqp(/vxxddVh²Jz@ 6gk jv] .bx]W[e9oU & 5iѐW'R3pאܭ<.|`3K} q!NiE *ڤKb F CQf^.‹IE>{+|W1[~A_R=4`?=!.4tcÙ(k,fw !yE C,M+tDg Cj R]Jjo~zzP 7ZE\pn3>"WzA.{KBdX$v-PRΡ}zɖOy{[&wh  Cھa90B0ݰ_hzг:F4lSHA!k#a?UF*Xa?GlfNSp{B)f򻭧f}|ֳW<捣t{TXٷ 36{w87"'Q-U!S jQKN@DSf}rm!`Lljh[څj8{@ypz;?;4'c`z+}{<Oxfo 5bMBl"n)0k=OOfL ä L[O[3d,:ۆWz@-p*X Kg 6/(1d|́NjS۴6y3ؾE}nryE1e(e z*T6|6Gʃ7;a8L0oU Y[[W]Cu өΥ1bN r|tZOezQSveF9<烒C)):rby> wGwpc06'}.ELmX;<* u['7*BR.\HĨ|-zDuw{q\;2F"CdrB9aŻyͭ`Ȋ te:Qe(R摲LQije68vjI! }~Oxf+])ZcGX`K-*3Ѐ;ZW !K`t#FkҨ,FW_A78xW/P*aBW'@ {0u-Y׿I*acu"~- hQ `!gJ Sp=D JzC yYj=A4 0]ƣO"1~_c=O>c ؾe#~-br Agٌ{;p7?لoNyE40{ wHE@Mc9^q _B.یmY3U ] {s1oYv)q-L;KmY3B[х uK#6W L)V 4DDVt EJ/UDQ2: g㺣n[z:Q˵!{yjk-qYk4dUqq%H|v/kö ]HexmmY,t֦'eڷǨ ܿ>G..Oa΂M4 hHt0p硐o}뫜 Ox&<e%"A0Ự8x: n2RS%HQЂls<2Hg$pIrBAΣGc>z||4W4M $c>@Q턻qʢ8@$2snp+@c)0F4k =fxZ Lո))eh+:r2k"D,yI9E "cw,0$2 .VKRV[lrpkvM}h|ѣܾm q=9Y:sȲP+ƘD!@eYTކޅ;w=ȩɯ_Ɇ!%xelj)[ttёey0i? `bH# P5 |׈=[F-^[~|w^ɅyF1c3A3ֆ@[ۏf܁xePZA`f@'p~ R)x,|pWƐ?,✽[/w't8)9E-y%87&1r/v;O2*~PW9 8xë%fyE;±* _ k} ߤWm4;Iޔ 69,,>eK&f7qVI qX #7ĵgMkHhrE[2eB#EwC׺3 ۧ× Q?X,?&3 r!Hݵ||x6 E0TaKiIpawOzRQ³%t3jbY$t2-蚟`S 34!s=->l)f'*եoG0X1qo a)n=CjfvbX`}E7ͶIwrkdՙO?_nt2{oBcPc ;C5~b_kαow tޫǺ},/;RVV㺶!Y/}}a!H dxOPjY7wyEO$i"H?d [ 0𝣖vQs^ 'q/O3c{ݿ,`qnp S3z5~d0V<}(QZi'`.,i*a!, hm BU!ƤI#0{dJ3hD2ӋA 9F>O*1Q+H>Dh4:ޯh(vw'l*­'y){[ʰ% 9g[Twd'ɲ$O/s0$2 NN gp1]4pq1쐶i>s(ښP\GE ~rBN *gtv-elO*wc`>4iUϲ~ޓ众%Kxo0* ,K HmyYa &0(dy#Mj6A1[??u{7f[FL(Kf_&KSuW j+) C8Jy!"t}qAǏ)ބ7|L|moopY*? AZ=.: oaq%8iZLbbρ@4x[,Ǫ Ys܀ʂȄa-jG\ R*JK x) (ΡbSlr^V*Ww=tA]B!{G;ߞs!w?OϾN{  y 9d`\Aզ!# (>&[]oƻ' __*CAF C,t֜fBGmȶX yNmfKPs`~ U5VƣQ2e &(8W'QYٕP"*̗AC]sE #M#L38)hmAJnƤˎv ]FEݟWWP9KiaAmj{Kqt7 tr eĮc>gOx(NC; X;kBJڨ5Zvwr^@{̹'ȽrtQ,b b) Jtb5 Oc@gܐ9}o%EȰKޜ ^1!-F_ Tc ѧ=r)8v)wv 퐦$涀ί!Klp3o"+Z +H-{=-W鞢~YE9h u_Dri7SeeѢK\M5GyʠkK+O ɥľ# U'`&^+JB/I1淓r/K>Oc4EKp:ڀ,se TBSTe2znlʛwf| "W?ԇ099;cЎSۏ "0NG{f =d&GWU[@QE Ο=aw{#~Gx+frhĊ5#L{?gaw2'_UɁyзau%#>ӳWPB9n [S7rJ|.73c1/2kvOPL5la ~F! J<{yWm6el~Uk`m fdLv08,R Ct (enz޾.(.mMlq"ԓ4K㕸ck+9Q@hqjrŽ&#)yarǙ< 2G$,drash17Oyp˲Qf ` XUG8 3 [R6%]ef9Ce_ IPBo=7wt{Y$rY yĀf!IIbVT ڝ s,RnĆY%v:м"80kPMNźF}< wQH4X4K|ߗ>y)%7{ Ȑ^Sr;УD:"K찎:_לa9ڷ3k`Y7bK$|6~m~5MUTohco0J.::p)ݡr){_jv=d(If8PMOc*8&(L0mK B8+!/f0SL:PɁyzTgA.~^OUAm*}vW/0EDPL.1T,9=YaowYrm{cLP$}Ջ-1W%|e! q DI+~I/6p|Y۟|f] ϛ~}4V$ʽT#v#v#Z~7at7!IB!D/4mVŌKr2\cfX?Y%{̡}cbk`_Aw<64QȊwv<q4M$Zk O\{4<)ZKJe(UU*V`hh uL-UPalOآKxm{̈́& u6beh'gc&2 ʀ{[[[lSB{j3>;# &PZfJk 4t~Z /<2-ofy'`PXwrƊ;G 3@v\"!ZBxZ0ITkd@tcDS;1kOAIG^A zՙLDm \w{cN׮&Ghx,Ӿ['W!ZW+s+*r!Rnhɋ7 v-@3km~7A< VĐJh)@#-jqa:L]W#Iuy|w@NLs0|(ŴÚtPgw `( tUDnC}-(i3O`e&-de?V:&IkEzn[Tl +vAWG'-akݹ-Y(M K*[ 9;}W8<| ^:RiR2INr0k},9ep0^K}V(RQu.& ? tu˓3_"ӍjqlَsrMV}ӿɹ(O/09yմe јKMI@Źޝt&gOK:SYϒD(=gfXߐc$JŻL᧛9~[vEXsTSfs@P [ao3|mi@yĀ)F,@<9竓ﲏa2w;\2)!ڢq빧 {p0Rkf+a{³N)$x|N?EKd\DˬjJ>}O|0|G=}r[RYqIObhLS?Q +˽6fH%'&vn[+ǭC7e7 ^:lqߗC(Ёx$. LhQQ!4^2ϰ%#X5z~[& kl +<^ +:Vx PT3C2ҬӮ}_X v0јʞ1Ov; Hpb3b{2r oUJP.¡݀_SzbWL `Ы >b' T}FҤi.{M~gr l{ef9m` VR;o~ XzFp@d1\D/lm%taY_f /z}Y_/>w,e 5C al[:cfMw?/4_N8u>M} ()0ej Ğx)}ېxq8[`!{XNsb/#IcمLכs eZ9 `3GE1fy>ߞ+ da @,\"Eu |'Xr(Y~O,5;tȁDِ7Js͑!w>9pk똽x$d5?ԯ`μ,(-Ӊ;FA{GikmN`o=D5|`O'\, ^x)ksQ(KRcGLt$d+Bl 6$ubc{9mD;ˉ#߼m$sS_ E1m ɇGSITUdD1#16?YbYA z=[+}VIrC{*n(ďb8 $Zg:IQn(Szw@T'[?!wB@qp;v *0p5&Y^)8=d_0CcO9<ξ9ӂ>I0lA{n0~-v_9wd/*c|YW! ,VOkV8 rW =I]c8ŽovmD >0D̯jKueVW<ջN}:Aj)}8UK26Ǡ<왖 y~Ou||Ʒ.޾Ol&#059'iq64 |!t  > w$xx6,VˠN/!zxץ}-, 搝?rz/f>`Z&u`r2 H: i3w[pbҪHvHQ^mA2Zs4Υ3Cwvv cFyȯ?=3&"ra*ju# o[;'#aA2CeUsxhB ۔څv>K[,Ռ 54|wRS;5Ms rc ՜eI5 % yM'`ljgKU*A$CїZqTJ5 E]GHXtJ 37H^QFXWEdt-C3jӨ٘V}R&Of`2)tvZd $uth 7 5©8  . ay@ f?5{cy6[d7&HY%a~0 z2`2i ,{`wX]]]CVVeeUw1M=:u@'wZˈYs4rctK #?{(n*L$Ó EkYec]Fc9!{7Θ5°e|c+\BAF:lG.K[IANOoxVɍֈȳ, ]peŪK4)UNiV=BCȻ+헝.OOsE2UExSb "AO4U%HSUW]?_f eB L1޷d#Q?^g)|Upec A ~W. ~"O2S<3 @4;kt.db&*X)'3? 1CEK D0ha%ʟ@v^9xn"l LJa?N&@q*E|{K9l Ԡmo"A܇ aA(ʇ<[%48JpFSHJ"+Ke}&S(ژ`4cw?G6Tx ) \B{_y, nقc=8>Wr4;h?+|߼NΆmw3 kؒVhnDX0!PZÒHBQ'`zY Nk- Q#'O =n'mB 1]| 'XAۯ|o z+,MLp͟iwnFc6DŽPLFa"HG#.EI@{șv}FVNxYOk|9xcu:džݸ u8d%GXύ焝Ɋ"ka ބ;0{wnnY9bM m2x_8Z㸻Ӓ- 1~-n PMLgDxȭ{lPya5;uEݴ6kfst&3ŧ nC(l% H6 )~*piLO\n;PZFL#QڻI&"C&1<A$cCbCgVbKwoHgCR 66HKW8"!p*W ]嵠WH /65+W/?f%c,s"էv<:v L.\-rx0bs|`Nzw) (j+{vw_nC1ÞTzrߥŸeizfcC*Ek|M?p MeGdA4"rлȞc5ƹ?w*8'-;jxdp2?QW)[i+o`a:>J 2s,kϬ>/ ~nlaCP<c1>~5J-03}#xgX/ \{êFl;pMB \9dĠdSO f.f`tQ% xH49Bd O:@ز  bԑ[Gd 5F22]Gpgv=>;pܙβҜ,c^症?fd'Jp9y*cRVW24 2kFQ~|X ;Pش%_S0pwd?6 m"ic1$dSy4(MczMٌ"14'P)1yYʔW'|:2+}DTP8W؟5&Zh$ݛ/R:D /0y荆ޏX${X3èϨW}PLٴBB &E޹\_*r(aTB?2/\\XJ9^xS{E'|:)_w-'߯y-— 6SB#X/;noyٌ{Vs;m W轾\{6<}F5܆`.Od Ñ&PW)P Xv<7](nY(j)01]ťs*a-H!P*9)QE֕ \tVsD¢OG^mk8[TD}-(Fò_~U!ѴO;o0?<ƚgzvaL_ԣ{+w) + _Q!ƀ 5ezbX~ B 4|%$[]M rCCNkI&r e{d |"p\F.=3&]-!j OABڻF[W&+e{Y݌/.Q~=;xyP ܺ^^48_C %_|11?jtARԩ,ϖlByξuBuF-# 2-[p zQ3 cM;ށ!'Et+qj2oR_GhϩPъu_ʣ%y'J_S~{;a\c"ryK &eJufy]09ŐwY\6ɻo3[3l #FGPŘ!11L*I'-*Q:r{16gjI 5gU3s~X/g_lb_.3{s2]28<ʥ.H M#QSѳ^1AsXa-chDX|ץ?W+M_ V0W bBh M g8DEt{H$> sI:riSV6?X6{B ×ki#0V&iGh`^xw^x 0o~^A6z̃9%vi$b40΄KS2:C,_hQdHL "Q;|;3[>D<9k` wCR! #2x~؄F( .C#Cb0[WAT/IL܆lf :$h=ؤ*!._W;FœXrBҵG|^RaaVR7^,Y8YKWEvsP]GU9o;nXpKa5TmCnU*Ĕc+ʠ9iQUCH)$> )If`p2HYpExz͔XjiixU u9Ò4]d*:9KXϚY6#eM)'A{D=˩HIfpm"3橯0~/ԼeWQ7IdW 1$iS1[ZU\L ,VK~7=B0?;1m` /u/.%+3B&vgL5z^)yh M:HbšR $tKܔdi5}*6ɖVZ觤;Dɧhe)5pa6)3T!t-mS3s9 | s*T'V4WM }Jc>CM,Ze趒sbXCl?FOW^#d nE}Uۻ)G7#>Wrgjnk7a10]dYp?׾Շ<|`q&70ңf|JYcШRy'\fclU20n h"tQ_ m+2;}w७Hnd>Ufk"j"D+01QLBPs wҍZ0w6=^$HVT Y|\6IVy:/2 "'{GkMAvƁ:*' KCЉ53;>јbxX Vؿ |)-SʇO7@%p4OY5/ ) 8 U% % A> a`<^rr&Ki JO\a.&)V浧f)U?1¨&.p -t |N.MӰ0SJP%Xڠjyw$.+n銗YA/^4-N9lZϗnEI)a*ɩ !Y@ 3TUyF(бvCUNpiیňXڊ_|piBCsOcDE6QT6MKb1;mBۊnab|,{eI7Tp.pH^ qDeB`@R_$QS3M4y, dj}+/H}C. YYrsBa\6g|r! ׇh6W*1'^.a';|DN1!m7*}L]Uoͯ|yN<n^$;PИجy/' A {w2J<9iyr  iZM: $; KSDXf(46=Pe[PYr>ۛ@p&١2펋ğ(2 hm He,pEyBGc&m8;K@mqGÏ TuSh=2qpAGS'/_!4{8AH&#IKAU w^:FL0`dYӆҰ ׾H t?S>|~~o%7"4"bY?q'VKP;:XPy THT%;!~LV j0K$\Q3 Y8_Nz~$ ͳۮ_xݳCzbMOSB̀0:1#%1tx+ H2UFh{2*QSa)0R"n SL!2~c|} RpݹKK&uV!: *i:|O#Dҭ ɼFlY>zv+HN"(=?se|vvMCi2b]k\a m.`&Dȭ­ twOOo<2양*֓P V5yO^:Yݺ,-meti1B'p$jCQ3c26 > |c&*7VDZeʑITveekM s'JiZG` x~ {K*8]Y .10 "X,=e"Vjw9u,jX6uNJgMс@SGJjCn%DfS> 3Ӊ 3F-PYqYdh"YSF4@[sK߾G??ysju+œ{nM?ĿzZaGʗdsK~L [fQx0Umrva%!6z :>*DmhP;\޾O2 C.Kغ|?b`- 1&_ %>,q &bciJ` /Ih-d%d%j,ZDr$ɐl$ i>®}BwϚ.Z-  ]*| !/q.YcJjI8{/Ï0#YjD򔈂};k[FÔM}ۑ &eZtWt BDC!ЉE"KOv sЂ-&SZNVaкK\E&' u\"&NP:XXpS|y@4!&~ W0r ÆtiSHψـh Ɵ!a_?q$}*3NSpx`|y}ǎ֐"<i? /XS/ӓ.}1h@(H,څg@\%P\$ũ)[#juC.LY盧{Z{V>@L~QWbquSM QwH$Bh]CgG\ R8{9)AX*16>xgӱO2ih6s~o.xP(0D )ӰŪ%Mnm(5HUlM?wJq]W< ]Ka"G n5|5#KfRU,1 v@6.GK#Zm$D"b X%0ګ·~ܯZXUƼYt-ZO*yjASBv-*&TI?!hj HBh' y1.gwؗ%hjxX dr&B^=JN4bS_i=%RbJ[& dta4M@Ei1CB}Awq}$0=I-PqmA=Co vڜrab?Tdxɺc7xF?)募C%b(Ma#h"!Bq~=1F:2$U9< Iz10F)[txtIo"$}faߤަI{?YuB넕CPG\osij&ws;$Y[,+6&& #|7P [) y"-n< %aXDhsS =P)B~NU|9zDIN:m~Ļ?,ݦUH$g@Q]Ze6SG{|̨L!A) W\.yN$E=^;,y3dA5' #K6($PQ ێ:%GKX(2A'FWyz ~8%` hif҂QZX#0nƐDyq&.Rsn010ܹ/ S%df=gM LW1-vA1!t+K[ [$cJ'#lat :в&taJky؂7:4;;34w%rK -b8;9"HH~ Ζ~\&VF_"w1a30z#AM{d 5\LO>1d+Y2A[Ht㒳ƦTئo'j/Dӄ)h9dؠnPBIڗق`$IBƜ-`$`4Hٺju/!.Ȧ6!lE iҠĈ!l ]y[d~s UZ|! A=Fvބ$dr6!'h><ɯ*^z-s OWp>gPX .iNh0Y8t6 ٺ,g[sJpjpR@[fșWj[㔃l`z$Sx7nnqa3.rFz^xuۼ{c"naTqw֕bF=gk$l yyL{>DG(QF Jpd4Tƈi#mhc 2cbJ x lV[[YJtARP@Vb6!_=<&dx\=#M57gbTk1Cפ*_T_ %^j +dwW'zy"W0&OE\>"kw߄i U59O~-^1d+o g [BVU2*IX1:11 > U؏M x謡^(eE2 4juvLCf\hz{E )58;{P#K ͘ZCf-˖-ý uȘdDu(^vM#vEEİ\vZ+0.QceFL ZEC.F9؞pVodiI^3˦n+:Al\cjl:9%2:v9<]0 [cZ5ΦC>s:'=85x)¦"<_4*<ذuYNYti.asf͵A䴁:/dy[0)0dyt-u5eYYu)eF#ekP?A!~]A-<ult!Km˵iNq<(.`YIσg4iUTEYe bdlӾ\!H@` P=.WX^d B Mm{=Y~  ]zP 5Ѐ-- ~6=b 8DEv}ǨS:*?b/dtMQ;BJĈvtu5IE'J03#m{@iE&TAP<)na7 teA 3L6 !ôSW躆aItau9knCmWd$_^p}vl.w5 b&rHZt2$ $6mcH  D+ɪ;M'i]΅]mM㱅4֍aq EDUkn46SMDZs110 dB bs.bGy It'I a04 #&UFf?}ʵ{x}ȟypz 7}w<(ΐcR9 mAP{~ g`rU hհ )flOl!"3iF &z(6MëlzI5SBa(N+TQTj#b(S^q[)3ab ][ĎW |1o14Iݲ);pgUV!Ld]05F{P8 y̌x\g,hhzd8[O]7 F?c): q6`ُb =}goqܙ0kOk֡*Mzr<=_RgT`ڔ7F@7kJ2sBF@\qB.Da]Eܼ撸J7SBA t^L.;0F޳WI;0aP+Fb_ߧ~~pVݢ>sip0mLEC,)p`Dq-O܆,6i{鍡gGcf"z -R"9<=1MD5dXr rEөpV)R*J"rE) JK㒺!Gom^}]:aS󕝎x#86+q狼P*o7Jd[: \?|K]> `X y<Y.BB]{4`t4Q=B{8DSi*jKr1 0p8eƬ&[ql67Z!B:Aպi5Ide\Zx_k57+&xUܫdѫǘ,ƁIE*# &CL>)\r/P E lPAluBy5dKHMo,d<~u.O`}9LJ5d۟HI n ;x tmb"ń@6[bf]b`BB6K>LzQg•F11~w#{pm6`2A53_#yI)E| .AMV<,jVL&/:p}ѽ(#1?X֖Qd8P8Yj!iCZg^$_e"z`ZZ 1UWzz -+x4w`vֆ MIY7 x%#fF]2\ ٚu$Hb@!РT12i}1BVBzY6O̴$ǻČ]퀶˙/*G4Uq1. Өqmp|&" 0 PZ!L#tȞd9]xJvwKUfRf CĎ [+ϕX~lvꔳMESaf J$i`W M!W H(HBf1&qבZ.djЦ!τdkUUd826zxيRV[G!/PL,6 6Ƞ0n:5vxibk 9֠Y Zs-_cYxE0O޳)%C!Fkj|"iˎY>ijL&2U`*`>Mu$Ve r󑺁R7ј\U<aaz*+<5vh~ a;=vsd8fF1M#p09o Ҋ#. MCkft{lݣ%è'n(k R(8FhCMqbrkѦ•_~z%thݥ?Kr/ǵd0_fkk?Ȩ ?>jhc+'<<:K^SK F19_՗(3 T(LyG<%WOEfȢIꭑC}J{pJĤ` U)MzE5~wm7#M2r՚yp uGv "4A= oߺl!o=6Ǥo <3kF2ĊEc*7aol~H0ubu*и.9EӡnRH+45 MKYŀހM cܹ^K#t֋FX!B&0]{MK^aW5ҮW ѮvmG^3xG ɪby^dҺLh=ܶ]Ζ3p4#B۱X7Iɴ¸ UE&866flfp3etiZϰP(QLP#LGB5^fw?yWn 9qɉڱSZLO?Z]8m_?[n܆ܳi[vSv n*1lvDiFB>mَ'<G5}d);&~ϔAes]笪!moe42ņ};d##5<ۏ[L0FPIj_P?tz$ȍ:q2kM{yx]?Py $>adpt @"Q}I:2D<*tch]_dbbK 1wlzrYu,Oh"-lm(* DpQ [7~=Ďm)bl]}&{;xQhR 1ģV 05׊%G93m˲솾gKk*iKJ vE.S*& 6"Vљ2q1d1¬xqˍ}s7]8W=q ?yc :~qŞmpB^~t2-6l,f}ʹijLQY/є'>F{J+%\za|8xߢ{8m,C̷<%9h' ŝb}>:@cbyWߢ֦@&UWLFS.)O8!lZ+&sàВ-Cv Z@ 1S#}B$mc:BL1΄УIDtvJYB6 i1MoiIbK(f~9Y"tHG Q6!5jVV1`:*X.a QҪ) _+dsf@#E=xyw8mdw0oAwQٛ dހ{7R7z ,ےEy%//yQKn yQB5o9G/0[vn6qcZ/6(Up`?$b L+NTut>TMdZPӳL˴ܿs'.3;𔰎tEJ݁q[%_{oVm4˱x2T蚚;{oZ]68kiyF.jn|2jEge`:ֵRTs8A8 x dW 0՘\lZHhQHzlv'<+!BjB֥]8tnDB j\}C:^l_A5`IB-BtER+KTI~X]M)b&+ŗE2 "~:葏`65Y rZ V05uj4"`]"P0'7/sx$09rxO rlf{mC%gEն̂R:Ǫٹ~,{0Xaq~/.O?tNӎ/W%9߸ ;5(R B2 RRRzOn ߱#]b$0rQc:  MBHD|^-S5OH6>]/Hr}b98=vܽqZNCMn[,YpռF*LYl!߂ٕBgso9;yw> ^d++2XLjr1&50P k)T1pO`ª[=ʍX' %Rh-*2 ٬,[,6kѐhjyFBm 6>eǼAl.nz<7:{O9|pܰdF1QɈ l"HL])k:I0y JI hTYFǔ\ߚpKU7t=޷Fl6]ڳv $ 6߆9т/_b7J^?q)ơYNgTڱ3l"gDĈ؜RzQñ/h-㘂|-V^8!"ic gX5GAېv]`4*i4տGNc6Hf¥{茮w8Y"[l"L\s5[՚fZfpKfvIWҎ:Ff/}el˷>V/^s3 S lb2CtȠg\Żs[;N/AWvE3j-RrJaNG3,88yv{Gd9Vm`X$]r3y*aLpx\"'O} p}6M_*?oMnSBm{Ad#ՏgXe=x?Ecz^5%ILl}@O/~7Kl> |MF)5~] vE`3 JN"d< >Z?n_C:HD :8qF̰O)`Xb2]JkNaߞ@q !y/H)i4C!?^|Vp vkDSb5nYn{".4v)P)Х|x u1gK $@$M@cL&;=8G;L&Qdww*u;  pswv77GF~?|;D7@,@%ƣ}qIMJ\*|#m%sVaŢbzjB"UTr1زL+|Oa|])A/X rkk-Bs2ؙ̕1hUkK42.r .y +z'<^):ewBZ8byY^d&Ho#<=:YAS礪X7 ˮee]cCR+4DX|ig9"pc,g`= nAgtـ6v7~X[&֎eVl(mVSpw;r ԯ{B=i!:pyWNrz9>lf C_{1W+1߃h(Rh-Qh"}HRIh(,}E'm ~EG-C"ŀhKXM֧,a|H 1! R58* H1]U1hGuxY 0I:tH,u9CďGD (fNh?̢N*Zr!7JSCӌ Yд.+s ~FtšQLQň}ySyxv޳PV,I?2b}hsBva"3`=,G lI&V1} 백#F+ 2|7sy|:0ԡbm={&00^fUU]or]vrGV H)F|cYWShXQ# ¦%2!.hsp 6sӎSMG 7Fc!$SI$@Ws|A0)3u}@ۆ7 5P!]2yR de?LdPQ'<<ΊVر¶I|YHR DT%L!V+b-QfFYu%` H.X%/D+ַd$ʛޏiza?`ɛO,7JaI=mqAo UL,UGOS3~S(bҷ*0݌ 3C$}ǃىtނg-U æa\uu LkLl1>:' ֈ>>O,@p(0~ bI3#]MFTi] vE7")GRQUq`r @l߬dk/qqq|2ߋ |б|6'"kҡ-.e_c?!.fC(& U$`5R4W= $Dz [ϑ]- Mc2 $5bR1&fȠ.IC(Klׁ1=?-QE7 mKsmS slݑ$H#"CAmq^,Cd[[ "n Nza$.˶qwMf /hF[U̟ôy~Jp \9"F ,R"gqx0O OGna~y3{XR 7B=NW'Mo{{ 6kp`.М6R%x0_HvЭl#dbU!+ #›c') >?Úf^(E#1!]',7ʺN <c !D&4B 4{sqDeQXtlER MEӀ, Ԋ(gG-ZRq۰l.=6Q r\Tf5`P {,ZO]UE1!mMaY%.@DAǖ0MJzm ҁk{rp)bdI̻H4D-Xu`0c;8ۆM5V("6me;{Lt*?ْL~77"rF"@͓X*Ilh&F whDICs* U( )2;ݿ@q+aq ;<{壇-w/~?x|\GH։C|К]@73~Uf2"qTNW[Spf~5}ρ p5yF\Fgy0<~_|Ea23?mQZx v|ZRPGHɶfaSRc$~'a1ǧKT<9'P}%A낪 'o{tAG} N:SꋛVSxO- !CKUh\/HRLHr>IVN"ƚT;g1Y-#Y*Y-\AE'b$M%Aoo9JN]0a$=&j#:o*P*~H‚\p@8$4[FJ؏rFA2.;@^6h9oavvFY 3JgjpWAsv1jW_ݯ)݈+]dj>%寿~Ţ䨱lqڀwM1g|y0rr}y~~PL+a@mB$i6bwV͜-2(?dq{Ўh!Xm`{aÈ+A 4ǙyHB+O*=s]?cDPV8 ATjWn`\yR$ӊ((YU9X]- Z24uS_v*dמ0&;\e~roVwϖ;+pY8BbCh57CCU2*B=3PyCa7ZQ (UILuFQhQdHi-psP~0qc신Gӏ[5]ۑPy>Va+hw^c~B'!BQMR0۳N )8g;(PCr3mXf[3x{_L_]f:䫘o_W[ԥI"yK[DFck2 @pH 9K9hb_BY;f2å#!L"ƀMꀹFCB:{ %s-xj"kuxuH-8*Aʿz&dZqPcРA.\4AY5qZ)崦t,Rm"aHW[V&P,ZƂʌ' j]ĭ9⾧*i1w&+"P^p2RdEah~c#DP mK/楔yNAL-kܡҎ:Q)񠍼HcAIpPJ#Ð2z[x8K~r-3ܣ ]R3Vm]Cy#0NeR씣mb ,4&ea~̴skߣ<}ؔJlzXT»׆ o@# G·ނql;O{ugs!{wW ]^ffs6lĘJgKK-uvǪ{!+5lE*6,CJ[=:A_?e|`L80,^8"1xh1 Q^lA=/w[w3EH9q;qG3z!&42=7SV7;,opk}ރ[XºR >pa)5HċWOx~ *37B86iZ [ټM\F ]y캯$JM6E=N :"8H(k)̡f`#jp'I6)g\=xO=n`  ~[ȝN lD<*,+HT`mye6n6BY{…Co"1s-sˢWȝrxMa3(0"Qymb1a+mUp2D16n8[K{[_ó-% !`}^+/x󑹯7 oQkcO.p޳XPGy}1;2sb 6~G: EHU9L4>B*a}/- p:}s`2SAn[h4v/_+;%=r˩_*~x>d|{S3('gj(uuEp5!9҂˄9Q¢Ou:#2OG 2sQ7^n:4xÉcNqBoe.&ڎnA 4X%wzR=X3}S<6lv[2v՚4781z)co9opjhګXqŗN J "f`ovT)Ƣ `KK-E(:- uS-ݳ+cf4+\!.QR)ז7*7xPWƎ~GtWS3O&48U#;-MU+ Ep*hl2b/YBdzaWŇ@`ķm9bqzr]PqH 䪌iaQ54}uq; p"tN "E.p~r?;q b7Kp9VpwyXa+ֽ}&!'@8.аl?|f:؏BO>[_{fnkKklA7Sތ o62l-Bq{wSxqJ|)TDoѶ{]Lq đH/SWP0㨸y<(J%G*# VnRX}|zkD}m與_cF;]_n9{NK펺QHDhZf;i 1zc 1`QjӢ⑙u|闊O7 E4jKN+Ϗ7[c5zwM %hUD8!~m |:[ez8x#߻|EHRN]ӱwl.o-z: .:Osf?Ѓ'v6fZqP]6n)l C0QݬN\ :=NώY)te*MzRɼPyX ~iaȈQ[ 3^d4vkV:ܜՊ"J_$KX&)żaA$&̬T&VJmx^Pl"+G]RI'Nq+h7p~o QS;__o FHZY64*W7?M<gF4 8N)OP2^vu*u9X_#Kz}~IړLI$)SpΉ٬&eˈ/_?sVc_9T*8uP"eg"6WN ><5.9S&z3vTx*)E 2x%SCD],8}_f+7l6t!r6[VϞFv8uOb}0&+j)*9ZmL-2<̊{Xð5sj쐦E'dvZՎÃ%ҲFJ2a7+J{KrCF4:jtG3D+Uj(V 4E(@Juak:j`ׯ)6Em8Ԕ n`_>'WLEKJ%uMTa@ 08#s:_ҪcG884ˠ~&mxN[6 w;{˥cUx| ]ֽB)ZHP$2"-.j*9*0]Ҩ|#|/M@zY2KBZ VBXMԴa:\^*GKISYmT*:ν_,fQb 8nT`ⴘqGDn9O"I*8M*uxEe>o8 me R(GA@JBɼq γYag>N)i)#s *P'\[18 LTVnŬpm*Ԕ n錾&npSP8(tN0EjZUM#`D*=E~#p`T\(6D~1NJ+'&t!ƫ825xfrľ$┲h&B`EJpcrv7wvWs/6r3*7xtC{xÿ^sib3X/}t[qM.-ݮE֪p7$0-0Sp] w!J>%PWY'G,#w0rU+.#jK)Ţ x1ӟ`啅Ь+88ęb?~tSh;uv,(A9sm*\~( RX:d% j%ohUzW>DƉYP8d#lv E8®&4 hC.Wu}Ϩʲ ?M؎F8wkmR8wA3O)CؓZ+*!a^ С$ v[h^;˞v$5%M޾.)Wt}k`oǫȑ  O޷e=9&'8fN8^z˟(ϮGNVrt%L+*vv㜬 oJO 1peپ/ܮa ig/~EˣE_TF,}EF:Z< [BpZ|78[;o:uB&(ZKEU9{&a  c&hucvK;Pzv9D*0)Di܂%w΋r=GPkO[_\m_}޹"f7jFWU_h@tѯc*w)4]GOpiNx6 w{b6c%JA[.JSeN}uHa6wH}2ZY1qƬU'd:0@:Cb,c3M^f1jt故X8S"C6]N6FiCmI޳ZarE̜ sO=_ÿ{ϸQe*~Q^ r<waǏ3'\iHCSxk07j~9?1N!4s)#'vՆ~ Gy1I{ ţٳ"W8B58TxCOWXWp2?̈́?vp)qBͯKVCbµ`N_hyk!ܒ.9^ql)91#"`>l#Ƙ-Ȝ"ic^LOU#S@Uc[u106%Xtg'k!ċu+<89B!{GBi,9x %V+;Yeh R"搨"/fB,܍\ٞ^}(~58 -Vx- }i` pSA;tNiEo\+%oq^xLA;.՚Eq:#Jp;?2ṭғEۘpV U*7o</ N%pTR8Ychމˤluh@7jПRJ"El63gk3L_ RNj{2$VOS$ίmhis\j ۔2A(; B:FUhv>'eݛ_w#[r()gbd(:Zѯd Zt}*i"PMgk6} H S PߠipQw߉[-u.dFv=e<72+5U"9xlz8RT`ftfҽ-'$%[dAMkQiX(mKnQɡ͆$/Ө: 8k\j QH&R&HQ[I7R :jO]HDq)Z(vѰ\vܖ6c|@.杏?_}% s{c~'?w<{) ʐ+4N>bG/U s+EWcjw,p*)̔CӬxzLj֞EJPxϟdN'_/Y#A;;Ǖo{?#w0 at?zo ݉ޓ8o6,+By Wad/6rW `qoi?b,JqSG\uZ9'-[|8YG̛@0%e _:tjCEg8)00bOH%wȫ7tG)½INhb0N99WvFA"Tq %Uw}*xGۚQ7uފ(5nhbCo -nRqAJ}/ќFjER+>jNQ٣歯נ\GjJz^՟K.qy8J FK,:ءN(Ղ^STq80R1!)ʁ"MWDP [Aïv輥T+YtC=a}x O?{M_yDoqC~_q[ObTqU3^YyGaIPtȅNi 8OIjRjj aBBp/F;$(F#t3c7nzȌ0N<L*2 yx\:4j*n`;*}"^٧=$*Jㄶ&\51nP.pm-{O:2l3/'?K+vy uvDY =ײ0G$@rY0J(0OVXH#,p4saJ9t6pxܖe:cv-DZ akrw넡XR=X=+9x;+?>{17wfaO(,k ǰܬ '":>q7RlR62F;TWMv}pF7|WwsoY38h}à _IQ)c!򛑶oDk&{G'J4L`ϘZH5\f^l7x)N71}opX`bq"83~>@(}} zl|C!_$0x1P[=]*v{^\]ljz']!0q@\29 {6,ӁmAA x8*Ro.ڃheDB$Do1S* f*j̛jEuTUd4ЏJi#*ZLܣ1&a7"c43f{a 7ZMQ1`PbIj5 ?z Zp%S' dZ9@kFsy=~CCJ+Jw:r6pF_2ðc^ 1&O52pyx37G?ɝBIn|f7Y~e ;\* V4-uP$h +,G3eq jN\o'NS+Lwqo\&2m/CE|d&f~j+JV )0Ǵ31P\eSUW(.l~7Nvr۳Ov.y90JJ|;˱(;>lٞm_Ty*}8vۓ])w5f6Zh.8; Aج: M?g@=my Ghp,W;XZ>%~p!fK`PF h:xo8  V1FfmG<VSQPw 94 >P6LG? <WLN?EO;iNV9Z͉q(!KKT/ܤ˱&űY^IujfЄD-9.a͆Wn|/0T-{BjV c"8 r8Pj%9SWt2R4-h5XܠN.P*W$\ڒù kТOD(Á8)ZѲ9F{(z4S S@8>#6)BxB! հRv-Xpq*m9x3ObP**U$6Hx]V4K\F~GBw$QۓWÀ\g6oXvbw I7D3ZN \)=>+̾gp[Ļw^o`ymՈ}[s? 4\;ڨfJaNֱFZHޱ2hΏ^ Cpih)2Pk&HTiD_)#SW╙S'o0 \[N9;2&ddCS&x(yN`Qr̗yJ*S v 2w)st'5lWI 'Qݎ%>~~r43OQn=@V*2,̼T={ٍXAaR M5˝S%ޔ`ZZU M;j8WpScyf~#ynL+yLQHCF?yJݰ 2;[*|+-Q/o_(x C l:r~5h [ʝSDod+M7F{/*w?hogS)'WF??"#͚gyM7?ݽޜ<0cֵ4wж-1Xǧg3\fWOjMrJM[ =OaA҄sVk?urO^ \!x.h*xQR43-wQqZ& ! /@#'}%pPHj490 fی%'B3f %\<xqخ{xdQ^p&LFl{Uw.-#Z&D9;m?y3Wv4CUezGTnÚ&?^={kQQ T6ef%|Ng䄸o-Ag?믄~5 r7vъ߱,ۆc>zF|! btZF% ޱX6 cCa *z&_Co3h`ϰwbӇM/vhqij2mR7xIB,W>{Ry㤅v~3<?s|U/GA m˳ Cf2W:.*7 ]䝣 ~d& f0a|xI)Pw C@ѕ??#_fRw xzmUfy^t+¸ƍuq؛ࣉƨӔ} 񎮳)pγX,;eqtL3CN4w-wfߠWѪRmQOqP,8omf$x[VgyrFq3 q>2-孱1ۡjbB@BK``1a3~qqx`>sssYװYV^\ꊦ }?W_DGZne0=p1ѡZ:1ɤ Fp> $opRT #El9Z va mZy4E\-iɻ;P6sP#h1Ԥ?E9b-d-T$?W[[9d d]HŋL{_&ڞME6KۯrvTQm?ff@r!0ͤ2َ{nl>38='_³kKOV/ ?[7<ԴTn;h.`O2sg9/ -; ӎh)X̅0sB\6&FI#yT>>Sp3)-5wp?js yYY_(m%E,&Do:v::<rj`Li(*YoWc+n\z8sF^^\ ]-lW;?ZfIԾ§/zxa뇘 Qb/|p;o߾2myY<ÒPɵr{PvbOGXW>O46@ 7 qFoW3M:B>@f٪j|SzO)C,}2$.Uyk6] (*Jf<nYv OjhţRzynG\x4 "D&rrsЄhk秠7@?QTg|cL#z L5+-ZFhHlЉC3}< lo%ZMKidɃKj>7b-˸LhW?飦_;oBPCV\Hp3JI*oށt,iچ8:;aѴT8Zy8*9Ҥ ٞ*9--Uw8l,Xv=oR*$G ܉HC8p27 ɕq72@qwTOA}KB[K8sD¯vPNzS*C* \(J݄Ɋ,"QX [ ٚO^rIlgZt"-mXza[>$>{U8.*O~ c?(*'re7LWCO sGRѩrt/V8utJG4>Rv}&zO΅PՋ̷޷Z 6@EkH{ BV~!3Vf\nvSnd@8z`ӆ L׷ 5,sw` '}5Osږ.F}bHI[ep]Aq~uBuo4j'Jn{f'ST0+B.:!c-5m:+ bfZ/,H T) L6q]~دnW9%;=_'|c~Oix6'|e8f10 Jk@ ~cDsv{qlͩ2((_ʥ*9o/O{r4'){ P0{S8~ۓj͎ WowSzu .؞A_ QU9^qqqn@Yb$Qyp|Σ8}t޸99Ml ,Oy̙]Ra$ȞfҰ#:>l[֣=~ݞ.{~2&p;(i-#u*xf_hL.mv?U>!l'b#P2 ƒE(A3X-x6V0YR8=ʴ}=ll-"%{g;|+~zpC" cN CU#-E8fJ-taڲZ5D~lkYajCu7pJIhIZX,E"q+Jl]G!zᐅs,bO+>Z/w3cb7 լa[(c哗PϯnS9MxEJg1?\ZgBY"P\oT67knnc&g!/]yW!"VZtLq}uTh`om<e5W^<푴 8_?15u34M~L<:;c\0y;<B SkCN/ ?y >Vm*v9 %,}ۿW3Nr MCJсO}e#B,O8;?w5֕By%}?lw\j)dBZ2AQ{m9ȜZlK"(&3:'DԚkIG7<_`;N}u=ʐ>MU=XNN(Ϭs^ P} _ۋ+ p3#B >$60k_#̗38.p4s3<_̢dU[V[~d+OzuVj }Z+[&˝^ rs .*s5dlt-ݖ],K0Wz\Opf'^V ԻUKɅUb0f%M; r-( %*_ Zk-, f6ʏno'z|!QqЊS%L^GB?&$8];ꁠ>.hc7:hE{@&40% ^IyçW|ڿ =&Eޛenw\Ϭf7c:NOϙ, $@JD!DM Ѝ{JxfAV#FtS HSTZwǐ3GK>[nӂpD5O%O&q@w ,05nqG]AhAU TRYOͅJ%NgiE٪ xMBZzOb@1b;?#BIj#ܻߣ]ypbGMBy4CK.v{n&8y$ ~o&+dʇA2A}&cLJ|"zkZsӪ%ɩXpZ vAakGZ&;j}vr4u֊Vb+ϖ R\1lQGoO^O G1GL((pzoL#5Qqqsaƒo=l>TxUN%MѠşdB괏uww6p8VS4aT9[5OSDςm2XưPF8Ͷ嬻_L:#V쪺i$xU\|jL ;5S8:70t, diϟTs¸He"HFƹ@3ޙzw)y`1N/~fFe 1Wlb/69EaQuv վ X2.R )gRث0f]6gkeHȿ߀MlvN Ze?w8tPLQq<2M 1zrm6: =^0-k w578pԽ< ,]-;!Pc '.! -yM4&J{tkBA$Q}CIM̎y0hɉz OuQ֐(~j2N c O`ڤ!E "5S)@0[P|YjZBtH%c"o!{&⽯D\xk_3`Z7ٯu0Re<NjUؔog/yX8BC7[Q/ټe 64Mc6$~;10~ [~4&.~¤ hږy4EƊU NϾy2p08`V7inhDpoϯ 8ہzJ'_W; (Ga)Gg 'B{uA]%%ӳ ڇ6%}oRy^ǑN1|PmM=4{C" ~$1VуX@вf2v>Ύ`)9C]+˻O§J*](J<OR!4$M{O=S:OT@Wg !3,,yxqY'![R*&!Op)C`C~u(v#8v RM&D{ւk8;]2G9KOm8;.+:W1˟"3~^Z\q pr,cSJhfG41e`Hw&C8?f xˍ/pqδ<-{ZÁ>Ļ[./p7}ޘTbݿ7f>88<͵*q^'' Yo**ֽS1C.8kxlP\#13p\3^g\ 3EY4* O|6ADP+}1GpQ^hS^BRمJ6?YzZPզhp "6FPȮE}2C)15Y7)UmIxdV}SNJk:hZ S᥇ݭف\K>\{KJsLPFbM4jT ćhON9i;݌GTa޶ G'+|?j@W;Qu0~Wp]ӝ0\{K~O||ڲ:ک[lv9uMOW~]cIp <=3J/f&Q&jV=6Ӫ^4uLa (j1Aw.p,{D AU%~ E8Ěkŷs}b-aSr"2Lkꬰw^}Q W1n@&ZlP>CnkqI7l7O9=XaĄ^@^ör 6}ᯟ'τ[\#̘2YG?&97:hѨKI#kL;dL}xshz(PIc6 jf'M6} iTegɢuZhũ)JeT\וU+3=vCb4MAy5e.7?|R xGGq^y)?B1<ͨaiIS {57 j .m:L T47 (E U Z,^!gC+$UƪuBQ+&n_wS$+q _+T\U70h7cLWP{=^/"uV0n54j&wƉv;aZ3/qZM%2z{dkj0j9 j tɳ%`ۏ8>_:N. w{r!S¬V+i7#쪳XS-m`>׹p]cu<6`,f [}/9\Pͅ˛:lzGcêvWoI ܑՄ}y!`6vUOZxl}*m]ztY9Y i0̀.bh$0zf*C?Lk/: ! z2l+ַ[ϯ9}'p@$l_)7_C7ű}aϞϞ9n9&Є`b,Jf̂t1lZ^ n/Fc69'Z'gqf)3WbY`Ulz3y/vPmE>+>0l"ZlSH -˻[VV]!\b==߾c 'f},ž)'+~e P6.)ܪOdMa>x2<|Bhg#8jaQo9*'=g9;xX[vO* egbv/#zwq/".vnrw "$} FckQJ%1#0rf2xj"ZKզa*&78@U,v@ @tQ9O&ھ&aUA~<{vboJa=MK#g'Kw~_9|YbH5p+8R"OA<^0M" $p \X *woiXSe/8kPsmh9]A2 ZL+ bhB\:`#3Wx6lJBEb:q4αMflu˴Yu9el(,(:Ύvpӯٔ=p.`v 4dEW8w:9|63ᯟ)?~m( ]bBtm%!,  rsədvBc i a&rA 2l]cڙ iS.#LәMTm֖C*Љ!%"2 QSqiŲŇH?rt9s/w?7{t\0Bk;yu#TPMQh. IoH>@+=x:1>XݑTB v; 8qp֘H5?<}‹gd {v hH!''猰&abW/nw6zW2Ld΃V˥(զSbÖL=' ќנU\e Jԁu!ZͰU%DlJ0mU5oDV %ec8ZiT)XM@Ldoqq_W,MĞo {o3;OSeU"Y$8)-  +$5Ѐ$A[dbfUbU>ƽ>]|ˎG"pxcmoxE?6b:7CWt^:yiai|.KԤU%8ٞ)ua9{v70[ݨ-S&B͖<(b Kx!Tx\xoquvn..Nx ՂgGʥ{a{w`[hM_ W4,bakC"\ueg:ˎg~~->~E)L~ dLެO*d{Co n=>o^YT{OOq}G{>Ƈ|]J!ݎ6~"Tq5#lF鹉U6G H{#memH^Z!4Rk n{Rq!Fł0sۿ·"]xqGz.u;<[Gm\w~pN/6( ;υ!_k|R*73yz389u,:4KUg?;C+њ0-z<3_: #υsw"\ eN(3n;%+{VNcL9aN<7Ax\:.zHٖDz )\(' dV5':r383jne2box|{}''S|E|X p1ddů|?|FQL¦Z,PLykv7;TS6z'☵nAΙTxљ#0^q,^ЖA7pqh6"&4 L j1W:.J(Ak͞l1]@h1:^q2B:'(uCS *ަ.X/^2\-1b *.^iRmO7Al? T}}nsY{ 3ù>F@B50T+:!Z^yJ~O nY,~q<} ."UXnGsP|?{Vݒ7;O8.kp7y8YEia<C+f8΋ >>hks( >T*.@Ypϛwe.$f5UA T: AM?+xN3.Ѿ&9!֑֊zG( 7sa pJ$$U^;xѫ⺁E.Nʻh@(%NOaq%gfc9 F%y]yOÓf_;¨ʮ&]G>%79qBݜ C/ "AԊ9o#5;b\[fW#/VuSN#iG= Մ(3BM \-s)h۪ !r(},\FsukF1cڙwԪ\o){g W{^^ܯ3~9!5s+vЃ'2R+x v)w/wJ_%\to_g(=t}^߸"'G5,(lqqrԂ#n Ta;oT9Q{18];Acce5_ū\q8dovU(΁)S#a[`l l#S #퐯C]ǫ#7KyJq,u莐4o.f4,dUj1cEK%.wqOUBզ Ri!= {-A%P2Wh8# TZ1F|1Gf@&c쥾#"k5V7ҷksVx.ËϬOwPDg)9+@kAyq!}I`)mGQiʰݳ8]j5<8&rqb,$:NHMX Z׻ݮos_?btXqn˯2iЦX'"zU^`.maPT1ɷBR\#쓍;sK«m$샣WТzԒѩrA#ȣ^xy򛏠I*gCLJEV#5j0`˕vI9rz& lF6JEQ9hi"ebJ?7+CE;6 D|r 6Mφ<>Ey_ngL~!\Sº_pN=vz=ͨ/i+R0ʜ08|RHr%W/α}Uv)|`~kWzQxNǧj5gQx7Y f;?5@nc/J&̜ ;sQ SWT3cQq)cNs%{llyZWϤ1f,DXxaXY5 Rq< |α! n" rRphV_9O,}ϳG=g(˳O[~7)o/%wAICgEǔ~6:yoYN&}s|)8îxƒw:,\'?)(`"n?t#/斛=wm'h7Çf*R] TUMP'jEJ>wޣ]>t"5S >Q15hM0<&%l^p yͿok)˭7کkkZM8?`X~_JU:XSȿ64H5thXT"P m2`IAvRfwOc:9%tj'ج"_`lkV fKRBrpXtxXF]Ge;(&ryˎ3S- S|v O.Ygw7k뷷]ng:lR]?uً>񼸋\oB+b*l#! g8 p_Z=󃕔 cvk$V1nqȹ$r`#Npwyu`|6HawB%Mޗ&x ◕tVyƖڊZZgENN38ϳ> 7=/smB ?pt9s#3o fǦwيN9mHm!KxSR D~S>5\0l9z*Aavݜ->jJ<>xVB A^`W!:%(ob%,9EYR+kaIM1׍-IK# \Lq9%к>KxQ`h8Ǥ0NZEXRX蘸Qgkʯ\V y_GtXnc7Ył+nwo_bWK^FKd#4'괡]n~ßɯyv.|y7󟭿OJhfjV2@Dom^?ee>³gy޻}o\o6ܬnlw\ޑŚRpr@Z.D&آ菷yhQE-}⟇ ;Sp=#SUàCk%WD\M6M:jؽtl (zL*n0b啨4]w@ƣkjSV584O۸_ "ڬ=ىQFWв41|=G^7 MPǀbS6:iNz;=ߘ TėQSc)=NW H5;L Z-ӆb%A4y=PLp`M:s*2K׹Mf?/oSn?M$:4Aq}E!^:\Yi=4[KUsv[w6Mt 1ZUTVL@k#sKr"Ps.M!sr'\x^ܚuhӳN}P%|N?W~ UyEDr.*hp/Nl\9ϪtNq%S|xґT~wǯ ϋ{tI8 Ss`הs_cҊx;[~-bz4vQ n{i2I 6iȎ5+<ݎ<2q@&&WuO "ۇA/Z=4˱A%-臎S)?2c`T5<0f+ mN|5ť,6&P0U=隴}4xJ.W@76TA ,xc~aNd hZ}IÌHUd  m LcyC}bl{ <5D$,l]A%h i*Od3AZ}Y^ywt'KNOL̰XMyD PEػ,*25׸ F>+%_ƺMZ'V{ۡ<*me}"Zy'H*{,dzÉJγ)# vs .ӑS^ԱGC\a7[q+7 ripa5iYK >Ҵ-("??Cq}a,c~ ӣlE1fK:لh⢳"e[a fH;Xe'++xWNjE2ZW`V=UXDrY'gKNW|)0`>d|"h^8 WŰke"c<\3:gxNp< S:ZN {wfo cNLr.w<=?f_{pHF]LXse?Ⱥd#}(nmzqgRv[ J2ҚY٦ "$K̏ ʯ{ l Q+Zk@SW]݉3 XpM?Q4ЩPJ!.O)J-:Aͱ |-FI G1~xX w α(j"TxT2gɊ7'I,)ΩΨxwxQ˄S HԸԹS W4BF{)Z$%]PB b`uqn@u69p6ͩnl,.j9{>cҽ}CGW8XcB<2؏~F\p m 鿂z@,u(DBU{M|MQlT-XR-Qkj1!޼kbq<|sޱ})%R%WFԟ׻K_5&_73#-xoi2':Ô,ϠJGKRgeso~;۟!Ay,mcWhrwVK,Z4%:".MdYQBEű\~Z )aݳ * &v˥ s{Âqgv(CpH On]8G\Ծޅ\WA:"[aN)3/t%|NJQ re2>r#ehՊ<7=P 9,֪L`Vq=ʜXV<  U2e.F#٘_ۀp,Lܮ+?n&XU斾V+tѱD~ECaJeLBs,%!I̳վg@-F[ ~GEn^P*ſYx /0(⒢Ί`/^«wt57;8p&4s(mbqɮ;l_=]/%wl lxû ++́3U*-QmꎊLpr|`BZ}.x/8okj6,Zl\Z f<=]VgY#n$E`Qi:D5#){!kyL30ĜUi. ;A\@jي2QաGwij7GC[oiϐ4m`&:ۨDk\sWBiz *-/)G fugm%.K[:|@ 8\|@C{,naaxf`|uFK]xDcqWaln i37T^$+ sm\PXO6'[tpUD3*#^=!E/n ˅d=C<#JIR`OG-U׻/̗O{w?.g+G<;.x@8=E bJIm0K@}dd\P]ΤRUee(H(Ww·&Yץc+4>5zg4;]p=:]w[9[(Tj.JMܜ3]͈g뽅(MQ(pD lqh\xPCK ;ZYڟZYvc Aȹa٫0`%[frkCjS9~JIafZpy߲%RvɢȉbI86#eqwI'_v?xxyvYo긫‹nm;='nNGwq!!A3jmkp V[/vPuJ-N xƜ\ 4SBtާRuzHr؝|}k[u):$R,BaoN?~-7ߒ2-; _Yq]s /2ν8׫>3J;%RwV+9s4] D vqߔƎ_ Tfi"V 'Bujxcol t1R|jF\ޜ yN H-h90mI~ 'O/.ϡ9C-t} GCm Q?d"E&J Jj|RqU FR?UЈFKa)6Ǫ 53ļX\%L~ƕJ"۟Y&_!.|oy;Ger7wv*ɃPcKS +k8`t9#4[43cGNg88zpKNx9-pu>>2O^HZ& x<8NRf*ʜmKw.Qʖbm  ,A"HnQ9l`q5VD9Q徯W lyFa3,; @ e 9%&RF !jS?r{BoڊV2]~6i)!ݘ=@&w2+QVr1a*x1VzTբcI$ƒYJGJdJ ѣ"Ŋ//%w=_<$JIs-hаo]$P0f+>e ;^, \.<>\ _pɻ12mW )p䝷9HݭT#5u@fesz~/ߎ lWUJĊ5WghW1#hL)AuƅUU# dլRv{wkͿCێ~ϫ~32UȆ܁2(!C9caf+PZ~E9]޾A4K5Mq<ͫBHc.PDpVTim6.`Ov%SkZM9ۗii$ߨm#lZt!S6;xsBSxסR4 w T.]0dNqtcj~1cq<1gCkiz 1.t7cZH,<^M ~E@L qeHtu0_>ՁkW㟬/_f&푦ڟBe!ֱ$棝b}Y_Mkɥ0(\}@%K} >r/g~Zghj2p-b'4gBbTiCeR+͵ %2\~GkB7bG*[Apew@Nm{DH{{F;ik h_&j5@M\lBDKӁ]U)˨%"$Wf4HN:sƗGGLK5#NUr5.9-?їçoo}v;r}_b~k]d*X"o@j|_ܸZx`.E9[>|qlgbmt} ¸3 aWU64ʂ[rV<=q<FޠRWVZ֖e/=gݷJ7Jhj6f#rp-$ZMxuU$q.RJ9献'j{VZ7%{9p)|Z` 2ւD=԰2nFP5h+dJCvV6Ao 83AmP[ 8`Jv ).lLp֦& %V>ңgl 5Y`V$H6siJ=5(p.hXp+ 2NfDGE#Lo KsZdŏ/MxiP1$R^'/MjOB_Z(:;J7@lXAIi  U:Ss" .f'_\[z_|(|7s>(Q <L: )s|Zm+yqLn;R4t`=YWt@*qwm94nv]qm8K0х4:e(I2sNy4xxjo}gON8Ywh$q"!*%l#\3O;62!nH *5;}uN}7xw{ëhyyy^ZVĚP{V o8SlKŔRD$k{Tu<~xzt8B$8כDux'cVpY QSCnfc;ߣu%8\ƨȹBJlh ]\IzHoMnӊ,LAkEuav8T"X@ 2!eo߇[ ҃f?+#?EǸ9MZ',Oy&,.2)_pnX0|PF oȩ1<׉ U ]gp)E"D$.BFԛkBl-(MK\. mL!`JiSQn4>يCmρJjڴHm,9+p#yiߊRMq`9)T|׶}8nkG|xK^)O~vÇ.yr$ slό TU""]jsˋ.q"t76ۮVggsEȜ,{ \P-MKyf=%^ܿH A SU‰1lZ=|XQ|lJFGo-{JX ۖ.2\,wppE_(̶*0-E*d,=(5Z[aRV&ѳRԉPjfTo񣵲RуoHI_ 9HyflQԺbG5xx.6$bW}uXAq`{c?Mt>.Dyd1G4p*G=4P+죧,KEϳWdqb߸bxH;|V'|l}70N36xY0#(v]G|Xfc[w=/7=Jwͅ)p-&> {wΐr?y3Ҙhb6@ڪ[QQczkmBquMe;ol)EqкsyEځ.m'j\ 状ImSDH<.XxM8(N L=YYdJ_XTkcuhŊb7-rw[Or!Xw E{o%WW-Yk𨃰GwpniZP)qF̪{ Ԋ) +3M%񞂖li#,ރJ;@D,4E4ơ4&Ws@pZbb DuJ4Gwa=_oSʇǾ6̤mb)T^^S׻qWwoՋ|о0eHblcoS:go(ʢ4Uk$,O,h>ħ[DrfǦTwE;QB-*sW9m>^En aVdcm0KI8Ӯng D99:nx̡5|'\uUq]G'<#Ufyl@{ eX|ri &*guERSC.\|M>CsZ0 c"rU Bhy6C0TJԺg]n4r8t 7lÒfNpVQƳĥħkZYD`TdﻠY44,YZEL=Φah`KW 5')=Ru[ TmlڂއE0&U00RP';WyO.PӄSv 3շ- Z׾&b37"R95)_6?iY^KBjguQjS kR&|}TXRCњ2#~x+(żΛGts=YaXejm_tK~g\ɭ851 =7]6@ A+~ܒ]@7TU4U}!bqN p?GpلUUxdo׸ȇ{vSv5_-:xv9^XOOof Lq -\'cg%*g^A-Jt?U LsD!.Ȼix;W> nv?%sqie䄓SOT̓F;d3#n>qyeܩX*YKUbh7?z_+f )sv89DI rf8ꛯX(VHG8de,BdU6,Um*GVޑ42jUa"yf;)7%3 XJ#=7Ua7)tʤ8'fL|C}`9ʘ6SCV UL㼩k܂ JqrVSkB!04߹.;KsNI<ʈ[?"/MgPFA:QؔXhze^")/[? 1У y$}ِN7 h1 V\ l:p]LEN ;JԮ笨f- ~2ɡ3qOOLꚿwMj7eF!SL3G 8uVSQ9DGT(Z^EXQjf5c5;%P]=ӧܺ/?CWz-ٙU;*ՄJiVeqߪajhԄxTna*9NNXvMb$YWSrGXv {MNXEzIsnh.38ʔ#~2渉K9o*t1Ѕi$5dhfR E=fU]N9u{Vm{ޫ9Hr/pdףEJ_, t:ȥJW9XZ#dR 1 G\xoQ_(Nf<(ld#.VxzF!B ,=vJM3#ߍia׬[dY)@AgfG} Be rbW2u,?>?ǗERfŭAސ >oc1#-kacDŽV9DrAW:b.o h"~VrNpDwWt`_Zm*d(HHHqڌ^&6)Rf,b|dQj>:['^3lRHVŏ[GCWj8A;ј54#̧_R332,hSK=5NǮfKbzpvpjV69O.Z4G9D|+,q%h #ԈvlW,,7#+;<$ MXqvBbMnOBhfr!xfKZ9SGT+TaRSʿ0i4nY-x};[>Wk,y7C%u6jU&4|<T̯NM;vH.kEUR \ opQ‰y#g"kSo & t#ț + *;W#߾|sS|q8d㪤=SYD,b_=Vu\h #ʼn>X(nh#pڊmd5o06W4:9;Kb˙X+s)ɥ"! -(?Jv(-6yQ%[fNXTaGRƿo\ p.-׬3g%wUX&ڍ *[,zez|4hN.xÇ`?q|g;si==7{~Cd4 9lD&kк?xqqgGyW,vw3ϟB(Wfŋ?YjL-ڛg>su|GXtF|'Z !6Zs>_Q]i"bBBU;%"uan+d4YB#cS@ jV{b=ʼnȤ=xg9ಣz{w]33K vBr}4~?SYmΜb@wf"BBZۄI/Gd]7AjJfg?oKc!ׇ-VdGK[#J7ٜ._@P9c\qWw|;ӿŻzoE^RM3lEe1 2Xh鹑BB4]L|KeyK)j[] S228O&G<0eqqC z\ۗ3ɉp}}[Vé!fX,8hNmΣ \Ejָ!5% 1Ѣݦ(MU {LUbKQmFz5ͬJҡlJ&0A^Xz>}2Jl_ɳZsi!O3aў2C͕]a'~!45w3a1@Rl,g]0݅8rkTX8O2 0H 9XvQ0xOG{V ]yg'̇BGdN \ œ-r:sje,(cJNGUv;:yEA {3ϟ{Ʈ1kHg&^W,j.H}T s1_|6v*=u-Cr܇CquB!;o)6 u4*gcs}(:Ԯ cSWl-)".oyPKd;F[ hM;s, ?X̀ѣ34AVoQM bTfVZl2޴'TkJ}:*.wQP@s[Oʢ ʗ#?+AgYkͰa+.lԽib =t(coًMrȅ&8蔥if̙ ,B8:B:ޮPBg8Xx5f3yyxj{7L0O^loo}]̥Xg%'}SW 8La)$D[w[U~Nly?>kW~MMNMr ^9a~GSb qw)g[hjrvȰ͔BT SU+,τsW~x>*U>*c\ϐ f3\+D!WC.FٸszW Fjو2¼;0a}ML<>x' pq8?_ '΂j,oTYTT+ߺpy{lj72a#3?gKdژ+g(ڣFq>Bg=HCxM z\:/ZȿoεĢZst }9wTD/| ZkM!lt<_ _~^7}a$~:s['e? =pS8[GXWqiI> &k4z>eEGb6 $ˡw 1i N,K#{ц[ p!Fܰ@IՄyqfeֻЄowP -iLQ<} nwN&ٻwlnn!|#4q#C1(ʡ]s2uBGM;BL+㥍+TX-ߒ3i&LEjJ)o͞/_1Ss%qCT'Ӝy/&%f^:μ]!ϙEOwºD.},M$ 6 j7}oBc$v6y=&kjq ]}|h3:ф^b#^qH6=r!/j,2aa~/hZyB2Iw  =鰎&tp J mcĶCo,-SkKs޿Fÿ"=k[BݙQkS+$d0sS] *Zw}]x F+ثD|Go)ڌ"3P yM/Sˑ+ p1D=ہ)[BG'$'|]1.7V?ul=S2#EZ%V*E_VrBgv 50a~ ㇚Lyf5/N?GZ ( Â^Y ܒM,fPnK#Ξ.ᛏv[x7A>`񰵚M !EiDs91Q*&.CuڧBPe#x 7ɒ)Tp^ᐘsŗJpBrlrf}u ޱ 77dIuaMP` "@>n@),,rjZ)aۜpw;\q')VCq۠8<%9ިncت7ր Ws!|IlD8,&:: >;ST1 snbv(cVVW[HJ>9[' t27 &Sft/OxJML{BgDy">W1fw ylbhm*^ n׌.}•w<:*G)xrQ|9q܃eLP=ԄOSŠ]yPKł=OsZ5;R)Co9U{be~KEKFO.eײU }.>`#N+-9 iPpuji76]1>4mIV3A5=߇pϨG y>|5M ]~VBRv=|b".mG64[1QSY$ .sxq?:oW,&jsX8赒j6BiBsJRR[{XKiZ%5wR5 ]c'hEdS ?۪fۂxj{  RwT-d9KSj#{;ZAZB ;LQk׽ LdvsoX=Yjo~|stl( -f:0y T.K>O.v2.pT$<[Gֻ󴁒.Cd0xOL(͝F#:h΄"-^SgԼMӹIgeFTxjkIɑr$v}K'zqH@zG:⭸*3k }#RK%3dmDD qΤngDm.ۯ͓YE-\JԜl:hYyBj1p v;Bs r WZpZ c^Dq]>8÷ZIm"^ҟ>(W+GE9Ns<"9TpdTFI8U*{ r}tSĿbEwX_i,04mp\0n`Tg=Wܴe%F* ^XFˈd"te 7}/J8[xIWp鹊IGyHj\Q]}u!Dr4j2s!j(89m9 \3_~ƻxaW ~_;l9L3[-|J nS G:>( /g?XSӝE6Dd~6?RۄBQ֝9e9ym E}= 뛨v`gSPǶ- s) S NľHzLWow}iڸkDšA"6fԙ%<{ v=r)upL ss<+)Wr^bOe_m`Pmj }S[ {$m:C"܍w,@#iH.nht0o^c.> shPvRP&P_. EO<%K8=1+ʉ󜉣4ԯ"2~EBv1U.bݖ5}x:?Ǒ.SSK%{eܦͤ8/h -'Ǣ&/c ~ O~Uϛ=»wx\rrTPɆI R.Xu/2"0Wc._;S>[Oˇt~ԯ$ f;$@4| b,Uip[|CG%Ü-W$h;  A+6REN24-KPF861I >gYt<8WRIՓD)eh5',hcc4-l.}kwf#UZ8`/ ۑ3HXEp5%VgCMA%7RBjIN7}U@{;ÕĥłC=(&wR|M_=@%!Ybb3Բ-24*,Oψ i8+VV(Sf-&Ec(p݂Ӝ1uF=DP)GC:>#y,lT/Zg= 3\H>o/o#~n>1fZK;X3-- dM_a E)ddIO>;}q9/ޱ}d@mԩ:;֚cy~dvZb]i 뫆yC1Gp(&Js:1CS.L Ri Kwƶc<<\ALј3[4'q \p}Gxa,-Σ.l;./x}L4޳p1+S(RQsexT דre|L'0chŇ;~??> -co~'lU|iŽO\uk ~'Gy;e6ZiΙOܣ5qV#SՄ KYuľK❧m'<g g(ל͖LSr"i"{JԨs6 eyf 7pu z{ϴ3Lz$4Oؔ:ƻͻ4/pǔ%#Mɶ#Y\E֐:϶3XUBqqNDP s DQ% c 0)qA!:4؊,:˄tvrxG|Q|"׸qD BS\aZ9"5'r1l˅40g oHi]P#zRU =Wp0h[50 AXE44?L@K[D#Jn{ٰ~;e2x,R/uA ,쬨3}ɟh%}̮ಐ!:VL*\9nGv?s!z'}Tw:nOƄxRFy{7Υ*4qk%9tt@rmjY8a%ȋ` #5_jn̺،om^3sv>pLgPfŢ_cpǰZ3'oym'em4 j2򓍾-ۮj_q쳳 J]ڍ֓3xrQ4e9ЋE>p0qt r /T9 M0įxs8/yt1(OVl嚻tR 1*gF}dd3.8R踟3IM9Sb5rel{!ЉJ));b лēB 1>svnћ7Pډa܍B.yaw@h+ump`{I)RHB_wiAVuݯu5^>Zik$i?gqoa֘T6⡗A_A8QeL\u\gߓM`_ ~W2M7o9"q&EǷvmИ8 vHxNA#إ,ݝPk5MSd-u=񁐕ND6E~'\G%x%א4M\4ˮc7'3e3]|rC"FwZ9)1LG[Ե̜ jv,csQNZDnf2Š\,›y2ˡK8Ka3f_E%2cb:$Ϭws;D#gʛ<7gwp+5zf{7u*j&(T>updּ\(NmG[؎TKDCWYRWZgW;gi:|Sr  pޑsy(:!SsG8%6&gtCCk[\pM%0Y)Y,wLm@.|C; n?0~ q9pS6ꍯӀ_S<Û ^uM]OS!^<>gi>+wpI'q18 oM4Z]MW݊YӁO`GJUQ;$җJ7 Qq%*>[;'qmrq5kv/Yl Wv̥sz9:+o"bd/v|%)u@ֵ8EYz8z9=SY ]ˎ[<$ H8uڼ]v*A765?.OS8o"oB˫(t"tXxaJx'+NBU/'n8kN7'ʐʵ].bd eBbJW3,ELl2`L]1ӈyoc2r\ gξk0em I8ގ6%#h=D`&svwd1!xWud )sp }IWx>k) S!1qNYy{|?S>ί?Ow7%f=YVV8rv!w{rsg1'sC.|wPq{+}kPMrܻ@55~Z)A}ʉf19>ْ}5v:Ưa3rh]S,wHQL :AH)'4S\0kU} ,o 3VXniJ_ .@dmI%d s W}6.vnxh6?4)0SO#z(J#Je0pwӗ\=|ͧL#ᕝ$1zϠd_2VAR&RQ' .GOhZC'c'H7RD *ҞUAZ!'Ơs@W"׸A#X`n(h¥rd=x <k:xk2T %(yqݟtYdܘ-DM,l}>r<%;&\ݿ$$m)0O9.Dkٲ=D.֎qQx=zPҠ V xCdk,VC4 樬"L)4:Gl҆4gԓU9fۅ?[#wcW39b-~7.GccŨTfl M'pHP-Vusl3vGq5osn u/7}>TG?,OQASQ,CGF"M4L#i,Pe+3Ύe$g"&hʪc|l؇1%. mL[қ9iDD}xී S[!LE)s2aJqYh́oN!NQi),H2Qa{4 ?K~zw*R%zGzUFqm8fgb,_%%ak)Zt(ysk],셚*Μ )1;Rv,z{(Aު@Wtub<#9mj1˥Լzf!oguԋ_xhn.5vsJmcڭvI EpH݇$P'g6D .q}/7 KܜYW]q>[!Ċ"4q27zc=Jl\=4- dlu. KJw^U"hX&l rMy˚pަ*x2]WCS;%L2:lcḨ-r9MuߙJ=5~6PUe}d5oᬅqG& y-ױ E؏fbRۻi4>d  @ujgT3 91%\S@1 <0BtAۆmK[lT3VXg$?Xupl<i~'L1Պ5h. ޳\5D¹ZtO<д< $dWQ؏ o/t)q};-UGKf8og8Bc' ,Ĉ9@av Q^sTM]r zi8OFPyPfsxVqz:V.8^83er\ow-w?ZkOZ[vLGJ{bU( ^¾4nt9Mg)|+{Q_O(}u -56BL.GU͹shMVxGy/ж'VO.KGL4%r;'}дp{VcV⼩LV[M( %ٺCr8|lwevv]Z]?كgM}UN6a {H;0na .\]yAy}(ɺ=BgFZ2^̙«{CKiexEs^sթ &ep9d֝^0j"z?@ s,hT ,{TuLsRTu8{'KXC4TF L!Ȣm?9̙imʅ}1^#jbeX*mƉFXTYXy%Hpv)Ѿs 93%affc!׷6h{NcoGo Ge\:kec3픋\Y_s<,yYa:.`fO"9^p1YM品v+lcSG|s~1~kߌK_|#aLe-`j4e&'=yO=YSޢL+jxD[|c$pݻP -%[2aȳ᰻E[)"xd;j}LiKӷ= H{lV,ķ"Ӹ,g?vO<}@wPSC5"84,L(Hہ mE޲OL:)>Fa8Džƴ7X"R4&TG'Qj,U?ݐ_ԬBIxT:p t[y ծZKWhqJ^9#Lʑ{H;rjy&.pF 礰Dh:xK4@X*`T 2ӵBAsns&eNa#ˮ!8G,7QE6%~&_5cImj5p(3}⨂AY<9*~^O)z57;_6QcRu֋\e ㎹]rI=Tfh4[luTeUw`@1eͶЊrpuagO W_,X?9G-g^߭ ?ûw O6>~mk޾5ķdfh>C~nb:lBL#mMvlu &ձQ*Sx_T}$?ƳfPOE#~Iwxip~tFrZQhT\ ARkH;YA!gkt`_Ƒ6B8+% \$U(NŃwV¡ 41!뫇t785ߢҢnD&C劘F$gKj}nsn 0;+J2S\GvNr/qT9,(㝷V"VɄYk)X=}F`iy?3VTVa\ /  j+(ՉD ^YBHV28>:n|$B2߬+oKZpEy 4J1Tq UZ;rz :hn4ރZ'k8{UvvX F+ l:C6Ct6G< ¹W.:6Baљϥ UWca+f8[dF1B脾s/w Ґݑ"^INu G'-|CQ-_}!<) . CZpO쾺營^Ʉ8Fuz8a-ʄM=U'4*?ےwX?C>/4y'oIqrTKXv:[ǚ*hӀf|InhHp"5@㔆L-OSǾdR Y#&.\l+v`r{ާM8l`~`UnXJL8e *)X/pbktJB 7vl͓.Xe; XrCH/y 6J#3?9"̏/t`lT[ h]{X Zq%CUKHLd"2LQ5K7!Adg+X'E )]tB{,@ ś1HkGip[aE.wh9`SB-c#4<9 iƑ[t,2ea]d]*]9>}S +afo #̟C>m92g$vo6o/„VK_bt% +3ByϾ"~$'?;8ceoS2Rj~9٤4v葐< RލùN觗-TJ ~5B뽥M r`8ln2b,)$rsN)Lgb;MKfa_H>˶%\=8ƜX|!+3ޡ3I6N(q>+I,qj}s#>AyReZt7Pg6]*ǰ}D] aEKM/Qkh]6+}3{*4Zp!Mh1 $".g<8k+vR;L7#o^LSuxEʌȪ,-MB(!y+4Q\oTEMk R(P&@ ! ]8+aAKJsJ0X tlƿ<\Pɇ[ႇ3zVfS9BəvIYX}01a`PDsm}y }g6%y#&~ pUhJ>%u[SQ,zQ;aΊ m\]m+2o_Y߾rBuuah,CB!13ُlw[Ty &TK|)s~'9Lk*VRwVk$=qĺ R! ) k-,{O}kdA |G[^.8_Dh΋U||v|/ O/WTR ˠ<v䗯#?ׅ&;qz&g@]ť=)jW2:["=cyZTd~-aӟq4\VB~$`Hys8s2&e;δ08ew8:BS]B܉X½d慎uMf 7Ae[SF vN8CV~+z/,/SxcUtD+7[HMǿ(P]CEʒCG]f.8Zvc:N9Xj[8Z#TId[Ioi23j나N[F:T".zCǗI✅*i]zLJ)K "*> :&G98F9ϴ`Qh <$ iJ4mK 8 ,¢: 9Ι\v,uO,x{Wȓ[V= ,CgJ@GcWg(̺λᎠȃ h!| |形WiƴjR1j >$8K_|dA9M=Pmcv× 󈤣u<'9`sv5eGphcS0]C墡 G>qCI"J,EQ7P\l\'ОՁ {XU}ci5.l@NPheTm YUoqSrj(VMɓR rr{5Xc{FZ)k|:a6OM$9~Z."Fs8d\j. hDqyB%s&:nɴ'7#%[+|ɩKmY{B;Rhp]CxŕHY]R"{*>Yy5;~ @qyF8ğo[A䙂T D m/xɞkqБsja%NZsr4!R}@d_*eE#y1ǑC}̡q\a pvNn$ňSYHlQI= KxzgedAe?`wckK] ʹs&/>vig³ w#={F7OV6bܑs!ysϷv!Ht4ꥯ9By8_9]%7W&NY#@Ύ&YºL}m+l͉TQփ+H#Y732H3a=`/l0Z|ųe˛ >4}K*PR$#cGAGaȎ9xuي5"[Ogn3<;S~D_?"g|Ij"%y^MV.'sf:~!«ᕿDZuU)^j{]H{E= L  '~(7@@.7Կ\1s4R64qCDڎUΖ=EϢxzǙz3{(Y Ta J 9c}}o-{t%c1Zg cWXYkѤZ}J8Ҷ4銣TqeSo(2CAsefbr*xwl'd:XRsx8pgH:Z!"mv,F!<>[jƋGL-;ki|4S*@!끜<|#$%G Q>YH酎6y?}߳z\%K)=%pZS)0+fJ=*irD78Lf+8g"F H<T&fCT~hВK? 2#ڣE҃ʚQri@%!8>cbqsĔU+K8͜8o[ K1sEU cblmGp6zX 0>n²_q=`!™(%,o VO ֱ_x^ib3l۝rN;ғִHΖW G#}|C+F =*mL ]ay~uœ ՚/ψ)>+da&[)GrU\n$7 } X¼-1Jĕ5%΄|N!񋚦uUOpVhWU|+9w8 ?OHWf#* {n[٩(j65Q{tWp7lM\T-() À_>~zcpo\p7@\DKPvQ {)t(>X4rIɞɔifJpc|*8f31G\ph%Tp%ȴ]r^-h YApbbV"*&RV; 8_\@CoNZ@S[ muરգuYOj/'I K/sVLFJw5t(+.*rc֏6"EB@|`N͜r^2? ljI͚jLry ~.7[dC[肭] ۪(2 oxqJt@ˮda7[vbݘRj+,?\V{AV+?5c SÍ?%Y(oXT)wђrV!ř %l]?psB!jǕّw=ee5{ڤ•8Vm`31Y 7uzj9a;@h X\,I뭰gS%\ 4P<ǜpѐeOd_Kp ?J-T"X.fܐpQf_70<]snX-ȫEJ3?R_wʗSDF˻W^Y'z R.U *&ܼ<JSLix$8 a9JV]˷=+|lڀWxrBDp/MӠӎ6 gSCfZ]1;|41PzўAh_i|ArBd% 9y-1OێwU 8M>+JidI>Vj]. ,5Ax fNJ+_A}cb]Kv/q+[ 8PS%jVs=yDÒF }۲տ[ eFZJ1M6f1)J"EMKDZ*,gCpl)w=C8/ PuU9 9GtyL:o>Ȝk,LՒh&/KJr;-" (bR#~4,HڡЪ +IO,s<&~6qdwRfTĭffa5C?(~e}ux)mvGc4wHJ IkR iz#@ua%[VfYunw* h6*oǵҝe3{}i Ϻ"8bhpluKCX f ngR) ]1w=wagk % W2%8l"0NN0"%ּuEF,iz͖Q &55BMjw1/˜MgxH8"I>cP}0=y$ņ$\ 0Ly8 \.|~Ey < O_]fv aa"1G]dw||b}fwƺ _|,qy Y,"MWq{WԻ_3 ɕP 9u,[E1+NR(t~ow7xKJvj~o>E黆 n.V:gwRjGVdKq0[kS=N#M&/]+ܾ̒Z`hyB60%\%1\'JqУsU~䛟n~{_*k@Q Xd'!:a1Kwq]*4hr3QA"4J! 2x2x y޿ϹxR4=2Рd (1@|ħ=* d_P<5#u£E+n%'HX1QiI$.)G$)nƽ8#e6E(T3({`qs#xOurgi/27u(x|΄p=Xٳ&⁼Wǎe'Dn3iL^;.W8w9^(J$\EmYve/O~wS81=}T6!mw Bu 9B }͍e*(3>$BQ\)<*B=T<Yv4 &wc_="jQU/Kqy"K}!Г m:G :iF9U黖'F1}G5 W|;2 s_~xdιF^JDu\1V:Mf ŵd 44Zdq^}kj M(߀]LiWdM/Q%j1B`gDYH꺺Ft/m @_sHڲK^@;!:+JG靣oZF()9xe(9 ~J9n<]ZGIhRp?)(pZn gbłXX'.pYMZV8 +~gbNh}p#DUZw 0g2o7=Yz"8R{.sOLOF1PɌ֭-oZxaMCѸBUR$,>CZ6S YiEqL^N*L9#H !hWjlq_{+>d7 Te ?-~#^ʼ#FaaWC4͌{o?5k{̥op̀|v~:2_8̂h`)`o?< _A3qr*\WShMGjLY/ro+tl/_Z8;B?ol @DŮ Kk0N7,D HhM0LScŻ:eqώ{.^_, SnMrw'Evuimlɢ}m3 dz`Xac| o#/xS&HpB8ܔI/tN<\y9Eo{y^7 9ڶ~DER \T4gW2 Q|)dōUВRBO)3.-ڸ\HF& ,RcڣTߵ"˷VvZyny y WiN|\fzi|>)X~{JM Ac6p3E ǔ)uM{څ2KX?Qj ߟuopi! 9G 1O#!e:Sa)K1ۚr¸90pX PyBx!ɍYrm9_ǯ6tMi3,<bZ&}Ϭ"U֙:B*=\5$tZXE 6Иsᬅ0 yy5pɋmk9'̍PW}-L$Yȳr;AWG=~Œ}Ꮞ|%nf7YqyP<]>]E7cҞ/뉻ՙ_i=z-p(r%;S=/?=?naN\>fKt͝{T ]VeKzH%m~uPb"\s-~ucBʤX*w5ЩѼN(|`Z2 m<^<w?zzI(#<HzO_$G/UVІ0, \. (o޲.;k 6ntW fbGFLE){{oۮi(nC`P,j1 !T)ON;soٱ\.qqy׾}'gtΣp̅=p;=yjo>%Dc-3I͉4A[e9vhIRxwXʢsd̕ڴmqK¥ 5*)SD,瑒D[žbpD| O5!N,f JU"6<'8ˆxW>f3cf>5ˎsQn70,Эͪ<:9Z84߼s $&uoSEȣ¾ԊVtj*fX( +oLGjIAbhC\W,9hW|P9c17Ĺx6{0g Hm318HG |vūyױV=%NGns$!G w`3/Pn_;F9Oybqx_~332LGl] HW?#D]kcbomB Y'ѩqn|uͳTEnE<=]:XbX.W\>E0`_0t-1eq~߳x38:;-%ITX|p"RhR/7mO-.= bԋiLSh$oOLϮzT`FsD)v@1c+ Z䡧t-ڞ@d6xO#%jL BPvIbS4kԊt=Naw|x삡4]$ sL]% ~G< 2cƊ7GDzH$z ⫖,*(idw:‹Nxz%=UgS_9CP \NӜDª v{؎ N6Q09aEwOOo3.9TEp<$r()X"Q)t} ߐ|(t٦{wU׼RMlYL,&%]e?Tlv)~*Ɩʟ б5Es̫ב4p=Ҍ[?}~քQz\IμX?7\Jhs>>]{ߢt7ӥ_c)#*W~bq 됰‰'xG6 }еՂO<[QmZ+DPn@*BVшlfo= q"bl1 ;TMوz%)3಍vhaw%$ ߂گ˿ٶIJwɥ5xW7zrRFS5$GN xxOqȦغT!м<-Go&I!'W|\qu= Nl}gN9)2>еW5?ya1r8Dsb*8,;g|h#9+%A̙j"Bnp=EJ=uЙ9CJÅ_2}@}G sA Y1yaq(ez:C;m2Ep[^߾䓧#c̄93۬7#WB} tEYķ^Lއ}M pWe: >|Ǧ?nc["^9f)E˺FV?p1*(dbPm61k8LBjj3~hv' ](^%2{=o`qp)]*yUhCW+UWl;qEcz B2]9VYnX }ees)Bp#k$!쥐U)R;QɼX7*Ρ)񴡰Ϣu]ns^=1. .}_X4)á3_t|뽎|mo3OۑOֲyo?+l?r _8f30-gЃ.)w[6o'3$Uu-E= 7#nz0 }PBe΋3DX XӅvd8dV$kxKʸ(11,6fJ6ưÙDF mKLŘt6.O@YƗ"TPnI &#ӫif>N>?`C;e*[A!%m(w7o`p`9T|F4WB[D şG3M""X{K{QP'Kh r:kf85`s傫m!!*x*1Tsf>xq|puś/m6:@.N3;P6 ]pdñ?XcPԴQbSG8t65@GxoѰHf(y`#d3 r6uqNsu.=ChtI OW\9,9rLJ%hs"2M4$;b6},X_&yP{Cݠ{Xl+vHD[x tQ0t'.ƭgSo3O§ޜDakl;J|vA Un&WWPR3{rXڈi;eH=K6͠Śoc&e3|jBcMpvԡ{P|gJJ ]йD)qsArL;bZ酐8T/S1hS9ӽ=:!Y E)3=g\ȫp}ECDF\xzeHN=8Ϫ |+ʷ>}--/?'m|j?+⋟}&zrdY.r'o=?()Y4,ҷA|[;ԩF KRz?ہlus80±-,3>i%Ҹgg|.ߺĺ'gScR8ei@Pv%\hkH>o<^2_Vўkz$T0%4mCB$sdݽK܈ZRF^lww)|#g3 ,U1xBpu6]QKN,gqBr&@[UCOpU3}G0 /iϱY@ZdWYJr5nI%IYc=rj"2qUtD%>E4BSwcH>܉wt[ + S_lXL[(I"mW+扏v lIϫ Rd O/Xkh[,~{!N>8!'広d} % 00鎣3g3;UG9jʮ5*> qnz47jVZ#U]q3wؚMfj6ApsZ!Bp65e%.ƒ ''Qlεx {YWBҀ?>bu{7Gφ l*w4<{l%whTMξ쬠PbO" Ae*{Vso/_\<_~9O;y`Y&x㕇oTǟO4<kS[fO>R>t ^y"zw;y~FeԊ[ ͤaH.y޾Kt6\l tk^)ApVvK Rd3ZGSSѴ ˿mc48W>!!p[RM)譨rA9Td-łg-CΆwuVUi8ޡb֞UVYEB`"1e[Ƒ'H xl"_W%%yh=aeSOWY"!ǒH=G -6;דofF{H"UcB̡"Nԧ#وBLDvuӧ{L[~={Hn9_<sݠ CĪ {%Fܠjl}OW1%LJ-+^3:c6Twn<<(P >8/a4uT `Y`}^q4qn(}YISY4&P\yeZ5#Uӝ&dRP_̋a$)[^db92&a"CFfBҁ]^Yg%:AƄfr[8eeLΩTKR|lX )9ZuVSrS`6|{~瑳<DZe+}7,i1vt'!OՄyFm|jO> <Ƒw/z[[Y0HThhQFӼ ~AO}c^;\*(%TDža-OiQIQ;'8 ꬸrYwRcx9QѼfunXƢIpvH笄o~:8=///81H)Mh/;48bLekc|W-dBl/p }TScL^>b[t7i«laGz0{kԛhH#߄Gĝ8-\Qz]b -/op5L[WƄ7Љ?~?4&FlƲ >m%R.=U.BQLCoЋ-ں"J-& U.94xK4ifۏt/ij nqzD3Fvy2(Vf)b#5du@^8R5'Gl`F4'UuEMoС7 w=0Kc֢M4inC+F2l~V%g0qU}m-/|xg hg]&:_QSFٳb野VYK@[|M&F#]U]ѸoFUgWjqWAΗ <|{ vM?o+|] >Ͼ@* hquje$^hJ$YJU&-1YQr[%u6]u)&U)&Cbi  W_%G JHL4.d8omL޾PGA'!&y]?yQXPr54OGueج⣱?o9kxGncE +F/3~=?be"MFMܹ32J,`q^ٯ'7unJA0bFC[%9ͼB[},W',5]dr*cbe]ySՈLʢǏv8UJX Gh ]Q2R wY*,4纋늯y{?k7xΟs^ҙU0AӞyb#;xצּ{pkҸt˓_^|bzb&:<+Ypℷ†uj/\ W'BruvE$TfB@%n^8'5K}eOX[ E & [ LwѴNUT̽0U- #MHS#8Kn׻Yf6cŧdTqd ϹRײ%ܛea]bH6m̃Yf\j싈K`X{SbS ~HgZc6hQo.y79Ą`r~w|tqoO3. wSd,U:A-LGO_ Q 0l2K\&XA-OmMڔqƇ}";f ȍaN'UE3k5!j&ءyuj띲sϘA5wU 9(sT ,Y!fE8B_/1NXum>}zGK;UP9g2>^]70_Vtu7U <ঌVBp-JH9e ML#:Ve%oQ8IYwi*dͺEt T tY1gƛy9| 7 mB9iLuB/_\#=Yel_5An<,:NL{8Bp9w[״Y*Mogg7e-_~O~fS^;:BbCbbVDR_q->BcՇe$1"3 iv{Dg[,qxzG_ooX'{Q ]\`~(D60;(<ˋZլi=6".7ɶSwwi5Z/!S7^N Sy| G+65&sK.׬oxyAa %jD% RXRUNI$1 Rk9Pvp=ٽ"qǸIζk."E4c4ű2da]wLL!.Vox]{k[]`LP/pVy WP+9p;Gd`s 6DF躞| .vi`O'.;ƀN)'rw( =tYZ"RBBđ+!Vl/pPjkY҄ʴÄN{ƪ!HP%hȱLNq2dAtB\}U-y=C{_?8k+Ln :9q࢏|Tf^oKyV+t7݌,X7Q&G`/>6\IF6ʝhfB~2)LYGX#U9›,'t zAJaPJʺݽ_Jܖ ccnIghdNTeT@dd_C;"K2>hE bR;̓`!d)އvϠ~H|KAhpբwP{pvb]WAȬBƫ1蝘+4rL8-l|E,@ZMJ_ԁ*kϾ_pu̜%x-6:=>}_}NʓYdgM|+BU mmŇ#/IAO_ sF)H[Al]tl{C bw4KFuCd]%gSqbD}Cun샏y-tzôݐq#Lps&v.)Hbi-9rU|UB\P~X< 9$x쿢>hU(nʝդg\uT?WtqȅOL'_xמ/:/%%{ka4+C~% #aSaR$!;Kӫ]]߳X̧wLSfH,( d͌1q\2m{6 7WlֻcV,\r$ʔ 9c8^& vfJH0bKV {k ʓ7了8lVړ}@dA"f%؄n4NMt0!W+?w|F8?fh D?'UD2)op2.ǻo_qU[--͢r2 )h]&]gohfbow۹X׮9G"ܥ!~wΓ|lvm+ k̖b;\ؘ!%EogAJs̏!AЍJ2ZLXmtЖE;#F,mzAAiDYgCTN5}'eXTCi*,N&2!hOcLao[`l:3 ^o`)iGzqjAUQ3YMP'6\ƚ3-_m{>%z?gqa+|qxĪ|OpD,|y}w||r5O?x'%ԇkcS4{/f_҅(,-Lߖyhg&?7^,ѷ߁X2M`mEQ87e#PTUŗ~m0kH"~o)Z|VO!b/J"lK]nVZ].FEHc`]9%uTjqEW3rJ[{r9b_@,hֻK(W*|1A#= iV]݈Tߓz2Zwi_MW)@1='-@Z,⼹>"LpJXo̮oYFMK=eA{^]ig\]zv=M{MdIL͙soŒwfVt,qg04qg{Nh~BGr#)E#*䩷Y $M4ɕMA旺UQ>HjS$>8c/1>q\ZG iKZ?J3U''خ/?<KWVTDb`-Vg4Zׁi hN19 ZQ/lR n_?k {3ST''牋=^ѯ#A;u.gylؗy(c0F+c/Jb =׿D5c9MW-*$M%V[$Ɠo»biooP^h8.IJ7te!1xH9|cch&BHvYbѓT%N)yzUF~@3mw˛s8jfYNf y.|98;K1?- -4@Wc>5)Z ྀr±σMZ]U~#PaV;gRL N=W[xuy4ɾN(2Ґ},  z^E $V"6 B[hLEvBȑ7koo:sFGj)SQHf0QH*yCGR6c "6*\3NLq5l㜫Pf-|5/<߭w0[{+$g_ez%.#c3|G|=O#TW?='d*}9whJ'"8@8Y63ؓ Eh{%i*0{48)rEe`iB6W9d1]ØsLD=]J))YQqDN82o2ebc 8{zPL ]`r( ul\뱻hcNGQOxsT)e>HY(ͮA'h"+W#vX=vࠌơ; IqH&2@p/ Bl.%Ռj)MCϔ2˗Fr~jscbG.xi1od"ib W5E5 AQXzW>IMMk=+9} 9 fNn@wHV(5hH`q57^YVF@d,J{ 8b&Buٌy\,Z9'k:Zl~Dա7̷ke*ɜ~Wbˆ92Mio꯹g1cbn9yg*n^[+6POz]SX%GʤS6m+X:H&[5hgکx7!ܐ V9nחizm+(pxmE-ʸ‰ ja݀{x\X-ߨ@A*AӪI9}s5xu8zhz jZ[H;ئ2LYȃ9SA;haauP򌫽0ʮKQ-iAbGLGo"bM&Ud;YzcƮ'$LČddCb" 7ux_3s%IGRYYϭVKT4Z!D:_+7C-W=@DُWZxɋY.g|~:~\͓jϢr\tuqCtaL+qbW#/v@t̸:<ʼWV+-4_[^_aM>kD׷2eJů[_N`)*ݘ{ k8=W<}ܰ&$cIA'}WLA֌?~w9e?K=NGB4Y-6JA klA\Qt?K:=.!RoE4GI`x8Kg /ؿK|Awĥ_YYfFa[Q&NxˎF{tuLigM* xqalH:Ye˘{kw>(s}>5{U|8o7̏OYKu2gc6AI nC'*8Z|cȥabM,HH#EDU i>1 &te]9%\N?~KCЮ eiKRzaܵ#̠qQ Q\@}_![/5)nZ /aZ^%(+Bb eG63)Wrк7Ndcө{K+v/%ӫ&%j)qPB-[}88:1kTG0LRNL.8 FdĝYZ+}1ݞY3iO4S{D2qHhWMUYb蘦Ѱ ǠIWrQ܋9PL$a]1.K<ڎUd]ЈcS/ߖDz~ 7p~nӕ'ī cnKvb5J { u%7Ц^:P#9B7\I`s=~ņ!xM784n,TrB֜70f=n0P M'T'˟/-gWL{vݚeOf{7s˫%g< 6Mj愇a"_vTf;&:9wχg\Mu#cWkB1\yq(o6K ՗T0KS'5LBY,,uT"ݩcI U4)C SxrYh ly[_&0}tX`@9"l9xyHa:Xc_ ؀d?2PkE޷:pR_/jZ=43G=szN٫Pe әF7UAo))ha>%f(8U%v{pUGmŪʴcqF0--X2 bS"M@:`znU |,d#1`,iif7`3d*Xm HumY4  \ߐ%4FH&gQ_9\#۵XSyƄo[Dj1ЍYxFb^$FY58 7eF(.dWݒ"'{r%%e/[.wd qA$@V{pkDKyw9]{T]vwX(UѺFzCR8w\P,b[N'*1X@4LY 93Ղlv{t['RL9tS4)9+z/;|Ji%  _an;Uc/z'ڪķ+ݚB ȶ9/qN?x_"#ܓ|=.b"\p.x_ X _Ƭ:Mh}M.xCkisC(8DK5-lAwmg;z~8%b6-/K0%R>@6FFHIΑ] 5o0='L%'?^SMcuUUƱXRa)0nqBK{.Mj\Si '4s}o-f'+Rۢ906N#D'<@b}W\wMNWS.>;1Gk68iqўw6;gPU;lHE{vn?#A8NGvx?Ɨ|H2ֻu(Y2{N!P>|*91av=Lu\C?MCO='ŜnaMbnym:;;s|(dkK_X\xu3S#o|m4LjɃ-:KL*u_G#-JU lpBځPFCH"_nC^; Xzؑ89ƕ`/qJU#y \5Ue:K5H4N4Z:a!"iR*/IHt$n8X (-"-E>}kNk4G%{b)p*z5Ô%*߯X/B撍AƥY4#"J3! ^3Y`urD{۱v2O8 =qHZ3I' ^}Z_Lɑ<q5U_{WnI+ܘIxy~ŗkN,n^b sptÄ*#KfD^\_i5@}Z nnF ^&U7sq{onU;Gqtx1gCz."Ijdqpln^2$,TxyOzix|<\ŋw~ ]G*jr%vsD%ϕR%o]A%KN ~mvvA0()%3:lшE0#..l94Ƶn[E7\9CM&Էx( P:XcE-A`ڙGx.?&=oFT& %O?W֥ΞzejP+oY!!I;Ҙ]׌8_QzBX(*MxYԁe|6gy$gi=`dȥ(-dSiN<VGrsDj2aQN[Y%|6.Իn ETHz9狲׷)h6JB|~suT8CYJqO4LV2ɾiVM* %KY䢔%ܩɅyN3q_Y#nϬ,eSd )Y83G+p8V5~e3_ߕo$߭oR–+ҁg{yqCy{\ HRhqs2z֬ɓ2MG]]8+hwkwH0_7O>߃ mlP͑.HsR]i@?*Ip?N[)A`,S\7)]gāf9m]TTޕ$?8f1o/iN YH:^>gutD?% y- Jc6[N$Βcg%KHB7%BG$ƦN) oC5c3}'\Lp4۟"_*8z؝Fa﬩2!9Z^73Lrŭ !W*$'L$n٫ ơlnno{FS5t,Z \9L(=Rw- b*ĪUfHsjxvSwFe r#GhL;_:7ന(9a3g/zyYcS8: n]RuOw=L^ɘW0fLqȓm7=Kg~uks(SD^@(b1v'޸NdX\Kuo+ `'.4\o^!:V6鷶oVQ ֯UC u[twŇ0ڥZ`rHNxqK6;hPA)SPv6{'i:7m.rk@ 1AA~9@nn'}ObABߍŦ8*!I}j-(0N=co\Y}"a /i u3Te3@oղˋ_ҁ{`,<-0\8a,| g|no/` r0٘)-<уsY=Snb6^_wltf]lT~9 Dqz"j":-&R1 o3_1?'9JTC͆v͏MzvƐ)nZrH6uhpcF4G+)>gk?!¢Ujji`XaaW;ۏFj6B|WC+ukUxU.iFJqE7ʫ}!kVKZ3s3.9Άj?\=rwe8gg[iNaˇ/zٱ-+> m;OO{mv2 NEw|Do;p&הhkX 2ߴ*N-N.PwL2Vv=M8St%wgw %d-xZ)L  D0̐`1ܑV&g?,;Bl ~ #AD}Zq*4ӾRK(){X 8?>1<|.#psx&F739\~iEB* P,*!eYw 9^թhgߔpT㖠 iT'Ct!<>=<|)o{43oa|)exuu ;ƘHHVsr8uI9_Xa'|L1{0yD I/I#?~cOb܅ $O݈N]0p=_Wr(%5 @ *VT->X-B&[J^/JF ÈNVGL)K߮d"@9]E`zi]UJ*^A ϛ%d.!&ObH՘;:"N SIVNGX0_NZἰ' s55~/nzߖ'\ʮD w jۨGs9`RGUtVI{SJp}rn;ؖt_i11DfFw2s('+gWjQ~k͕ T.$*J?N\pz&ZS! VZ9O3))Cm;1=uհq^x*ε̜ 4s̃)3fIZe_ U˃~b:qãU5_._<|yzTr-Sc"X3fgT tFqWv.|RG\.[sI8ubb-Щfk1C8oV>!h$ $Wu,E&c2e+szJ.[!L] E.:] g+=P'v6)y?|=Z[|M/J1eD>//_2{Fh%4] TjmmKq,ޢ[ 0 6ʞ8W> bN9KfM1|>%9PN|,[D+G cpM`'25Ze!Lfe aalԒ!WJܲbO_2Upٛ@kM0 4ѕVlRm>' R&NA|Kmo?[v jxavPᛚX.fLrDP qU:_V*}NظOg_r<E+r[@ kn'az]]tyqʲ5WOy,,+Эcr~@5(˕r\CQZ>3+A**W:a_9+ˡj<%frI%a?f->˗p*. Ub\]*.g^؈rLdY%4ELЛv%B@)Oc5 |N.y&;?曏fH|+>S>}DZĕX %k/lX`q.טQX.ݷYȜ/̀pe",QSڄ2)` щ[=>G3 X*__ LyPkh)ޕ"5[fr2M8T&I1q:\~ٟLB) :6!buOܖL!}'q h1M4@+ 2ri"chw;@տUФhL 2%v 4WؕF@fB$t:i,lA$h U.Ǜpf8*I YK,xytي$zf-WizuT 577=9r,_gH*)[+Rׄ/>Y*-P: ='/;)\ fK3mGGޱ2, 9z9nqwx+jTɚ'v-'xga@9[; cbIlSXSǥ0\(XZ\>"CH]#'uC9\ωdf ys oz٬ͣl9>_ [rDs"ol2ed@4Fa2 ˮ :|E]W06yEOmfUF'7R[CSZB\\P R;s;Lmau\P?@uI[}\bQ7HFǰ";GN+N G]8Yi 7Bp}Z{& \LnU0Saad^]b)G~ٶ 9 GS?ϼUmxG~WW`;g%:`CS;]A B,|-d;w9UT5H@p2eŀ}LӚjݡ9΁pQ&bS5aSdmW-wq߮B"`$MD[|̋ҹlh^0˒)TIuU5)i2DR-fFҀk/ak縤iIsJq1fTk<4uu*yAzoTm*,;[I{WC5" 8g"i_yKʙ02yEi}ϟ d2cPQYÃnP 9r)|\3_G#؛(!LkgQ sH5Y\B|IkU[ ]O g' gvg ͇ )&XW8ZӇW(gVK<K Z/n*Fa*^y`ڙǜ(tA=Wh03ppI~$w}?&z.*-#8(hyD?8i3>dūȋ[ǔ X؋K O?4j W0G&A&pYdɁͱ0sah{s6^{wJ%FB_ ^Wps@VkuE7Nq"*H R0Kf+kG8zzr<4!)s'<~ߌ}_ b <9V ŰEhQ] +Nh߅>(T@W:kp87~Y*&xY k a9awk";t"bВ28#M ]G٦^pIK*[qHAM23'GAN(YcQ]dN޷%Q jӂ_cf1;ԓCb_Z'[DP?GnෟK#1#)#$!"Ʉk,P9+'R" N~ =t}q%d<`;jH8T'5n":DWJ9+2#qR5яY.}Նo.0MɐegWq<ٜyݐfS0Lf, 3 [ϙqq&v_r*iH"X$^),*B1=[ݨ-Bs;_iC;BH⸚<}E4~%ŽUe=% 4-u*Ӵ!3θ>/wuZBjsYqMP&g#P<=7Jwx.^Eˆ0Pp>Tdim,>Uu++Hɜb7,ͻa!bjq?C h"f<͒gC@ImZ+5]]p 7RG-H ՑܡFi UNG;+: E2 !ЈBHiCJ2VUаKK\wƻ"GME[Qm[xg&5ѝ49?5F=z;9\Q,H#Q^{/.iق0]ΐБ7#K } O[FUY;*fwXӕs.9z8m/yypBnا.DE) Z+dbcf~¼{HMrTi=.yv9cXa).b)´М"YK˝N&9AS8bތy~_ <4 JEk9f^蚿*=18cf_[l(21P2RL[dșAu!SMk0V7^f*?c#530o+l' -'<1WՂQ'ѱܳԆϗܾ&b&P%!'.Yf{~s^vk< ^y qMs\g}0S!`aL߰FlfvK+P_ IY Ww7[EL v B3s6Sjhݎ癇 Mv_Ns!F:9ḙs1rFQ%.0Yrwhh>U'vⵘ5;=k¡9ŞKQ t^.B2;y!@.аw*pWFQOqKPj?-},  2s2/h!z9吹# {aֺQYLO)pKsJy!7gkjq*/+!``%L?La׫6βUD...Nq3S(xL,Q$St+ަ![*_Ѹ#5pl"A!e:R3M<ڲ&Td2#Psd)(&q$I@65?G,O$qiʾxe;4%$ên|HA2- m4RI}ѫ8}F:ω95Cڳώ<ָ\3#? b,^AB>vݎڻH)9p]>@ᰊ 4"6&MCAԵx7'JKs1̏9Z|5ۯ 90IrqK:vE3ω9eau4 4ĜyzU"_@O'WpcmL%<9]h1qvh~ALG" fL HTeB?3esLlkovmRV۞f^ў6MH;?y'l֎;`>դ!7U!_}0.*y㹹ue/dv=1Xl "|\3zG:icv`slo4KV] S_`Gi2{.4݋ٗznayDT ۯx=s es7n I\. $-J鎪e>ȢbOj]B(#.vD#fB2#քnfr(o_!S3k$<@0{]R0J0Δ" mNj.&xyrNdGsiBS& (* &s| /q:1a:\1T?0[bNX,vmEL ZG>yݗ1uTz`L wF U-Z MQ*fPaBoaT@t-AjIC0_!>4u \nޱ5ְoIٱ0Ɓ)g:fD:q2s/Fg"sh{icjgGؑ*a ZUp@ 3yO3W|51i;pW4#$%nRBe^sN̲2ôJ3x &fH;ji'_]LrԬ8[k=F *q+uU. m9sBUHE\9h!1BU;B# w\9U-oC❟~_BZ js$7#.*6vпqq =;rr"LquCU:&ũۜ 2x5V—&EOu[]Mv5`?Qc"-q$;[WU҈$SkVU 1Q9@ \Ӧ0/zxܕIZBd/??kDPc0|2f{*&`%e(&_~HYI:KPiS`,zɽ  @3$Nd?G43D5Q'|e2]O? lK[kmV*T  ,e-7CO#<Lc;#'VHI(QE!*T{lOw{||{ ($X73{y%9NƉmw[GJbJDbWC+bY5Q\KȮ!Ĭ3B‘X o~=cMyi<`QTv Z kt}돠|5x3LHS\ܢHF.NQnb <1P\sNR3] ~qG4Quw{J)֟5MOX\հV7@Q[aM12C)ZHZb标ίw\٬&f?px_hgX&z1e˯2+InfqM%^56#.+RQ=mBT G:K ܼ퍝&O߃/_we|w {=MZIB¢Q2A9u@jbHsv ${%MP8\:7mN8 {3홳mqʎɁGh uҫ OfLBWKu~ɍἡ],9h gh~V6m)ZON5l'pz @5 =8{ED~5Oڀs-HJFw8IChHj(Co8@ }qsQb1"J] dJTv05W' Q+o tJE Om`0,qy§zhUq#/#WY B YktYoٌ3S ^ I3RY :DCW3NsC)RH~0e7q`5GP1kUŎ%d|<%Tӊ=Y"s/{ w lŊJ;0kŵ2U_1+}d66>y\";Ç䝉2|]r|- fk:_rbrL*xi[M%nZ =T{B3_ [uѮ1E&SNێÃC[r=p\ּ(sG'Gp{؝ч39W6a'Y3i{ϮUΎsz8)]IefK jiyI88g9Ͻ90< f9SU!բW5ezp|0.)w9|o#q $ Rq9fҴ*DHH W֞-(d4gձmAPOAK q>Una ]H :u-ȳ *vEt7ߚ M |E ;8œ$ }.F7&f-8iPEZ]\-m`&wje!7 Y 6ctxn9 uq '!kYN+ ?P%~zbb[MD$Qh#`gN Ĕ'\0Cg$gg_8G9@)SJ̷9ρBj']Km Sʫ?mPߑrb[d5G0Gǵ8Ȉ!nVT`uܫ֣;c1UBMb[Uo{oc!QP-.B,=EoBZtiQ5c)|x`P)λzyc@@ s"VqvjB+rB)S1BY8a8vΐ$-{Nwp|WpT>*+^pbYC~q#&z^%?BHqϪ89^23W Y»Ox:ZDz-Ƭxwy.cPrݽ󒳁\b,/0k.?Ag/CmR+:BşZM[SRPśP^ڽ ~ 7ñ>}e_EG{ Mm2 /(/fVy,q}4 (W1q͈6-aʂJ,fx#'ޱw|>''7>S ʒ-d Xyr`iG|lwFHjUQ_F_} =HXC[o7gTA(,:[6~d˔\vs[lw\Eߑ*W J6UK#l;pG!(*UTm\|ocV8kjAӈ7✇4ێ JHƂL-7U}Bڝ'h{za><تw>PN#6qS"A>ԽwU"5bYMl~M75 E }u3бCs[wCn$R&';Ehq=9G4NĒE Ĕ)fS-eޓs]Dt5! >y5i?Q[YMȔQcXRCA M-pJzĈkY q^;^m=H1" OIv'.b%0hhH)eiQ07z{qf+jdȡCz 5YK ڳA=]] Rɕ9թ)cvph+x94ǿMCf CO3'I!=~I@Z,߮|9R^qy 2n8!H0*[x4-m"qGmmÖ*HC30S}7 +ryֳc3Oع' 53nqL"l\aQRx kny|=x;ֽ5|ۭ}LK6quYX EkiM})9nf_<x>c2uYjB셛T8Q{OjL$86#l&Ae"LvpNh}jm%\Nw3hä̂B\s ʒȴŅu1_ѢEU>7zܮoq@=~@vҮHyQfQpFu+ΡR4kI8f,  {a(0_@W_K&; v? J.g7pB-oW|%G|Qu-*ٰ,޻X*VO̿g).EbVo>2ݐ} Kv\jH9G$G)hIp^!J8'8WZʧ4W)6mjYh p.Xql5̀ }]-W: 8P! HyOvB{Ҷ(xXdϣ q P˶&|].׬p`{xū_ T*d3j:, 7E=:ĩD\+RR6ĉRPZ,ikE\l9#8jq!Xܬ(|Λ *pJ1r!.; 48)Pb?G5ZN9|@#65o1+hs)"Gs{=WsFCcADžyjAo{7Y͕^Y)fv2;I:QQEr5FnVo&.;zP[ ,RJoc3{e׶ÚXPeӖ/< C{?]];XapYF=xq`qjA*E!fAD g/*w񁗻WW42{֋{:"(] 'Z83 \ ) w*B!4H1hs+X-*ȔڢFc/^obo8dwJh2S`cMy;D@ JxWAWQE 5$W[Z0`j퐼-^L|X*P%P-4"AQfYP\HG 4vJ*Qkm G[E=ֆ+f/Uu+k_rŪ& Wω:݈v9 j%X/jivԜzګg)DV3uoEyK,޾.JRRhvv!fŧjǽuqti& &ʾEޱ{:|ţk 5+XV"AMG~g{CγBt\'e87o6{gaT0EH,}6a|}m,C*ݦ:yM\^*=s88QfXPWErGNf#@x 0ן;%#;BfoOÁZ HΓLŔkR3c.9b>-sz2#Y ^ )8Bn14='͎'>ƙ1k8*LíL.ABW/bcãOCCrƭvwi(L;w~~xbզEP PF-5~Es7uO0˔#3Kb6;ۏy*Z[ ^x)vB )@*) CDJ)iDhӹd: H 0 ykB6iWMWHV}.wx&KsAo(ృOxytU_}F:\ڠ:['5N:/ufl-Mn֯(u_ԞuIO7m狳IJ5f񔊍vTs%ݕw;\N/J1|_Zf1#[@qиBCa':RzcSBRYpp_.|o^??ϺZ$odJVgb|(ח2Hk@}:|oMbEkp\@+b-76TP/Gn= nN $J׃8r}M^,}_k%VxC*$y{AGTd6.-`D8r/k9v"xǁ I_O;WNp)~ #l695M|7qV OnΦQj\Ga7:,&v-q4rDm2I:޳VxD `٘,WDO}W._%4 P퀳uV6]+[8Z<:`9S#aAK$\mJ{YNe`ӖC:nn"5 R *CӰI{yd77K|?O`\I]u3Vz$u CڶxKeOͳ ז1p9fi =l.fU*Jhbvfr4+SYkҝ 5'ݹZl`]5y<5Zka&3Evպ$-dgHoۺ girS LNgD pj;b[й+fu+O?Y+¥RK16'KrD2p񾳯HFsrh_THCRF|UjRc~MuělƓ6kK h<2q%,zN_x!t7;2̴.'8REĆ{xrTPHInNz^%ry3]&riR.`sk$?-_4h |*q(NN"qݬɋGt?9 Ku5S)H۠'˗I?v`_/G b8nӍx%n&5h AبndJ>x9b}sC?(c%Jggprln z ZǞ/y|r ԧ1 #.uZKUa[Jqi_8LW=/-Op 1ՌkkPrWr Ϸ\fF</oOo_w9\22%K\\cZ .<WrgBpzPi$hKqZ Aw"sA]g1!mȍfD  ZϯqC,H[g*/XYW*.!F[S^jIq@xSkNj3h80mMW5=TXE!bn"R c2HaA/>Jnչ ^n^YHٮp0&n9\-)4Vyre-jXV]kV'pcidmNLYv //SK7(Ry޺W"0\\\L=M2٫7f:7< wq\3YS(ldd$8(vظGΊJj\ 9C5[\h}E)fX5īH킠CuOib,PsޑE =.^Vv6Ȉ4ޔܲ+@nC8_f㻋#fBt:(;#Hb;'T }Hn->x-8)4r#nmxw{u@R#oG{d/⦇G-N]Ĩ-D[fo}w*/F丢UR^ əHݲwkjZ.wBW|+~s[{ q~vEU4Ѝ26{x5s>Y#O +$SEo✧Ls;R`Ť0T§%:{=2nh&ov&&&&`'8<#IMXR ߵ^ ;hdXL,˿~= hV,Ʀt-H)yS$fcawi|a1(aMVxz d Z耒1qxmǫf_j-њØg;MѴ(qK70 oF9n#/ /{VtapWr?98AȜ,)߇89 Zs1+2@wdxG؄`9ٚ-+L{˫yR!⛙vy m m̅`뺟xq꼒7-P8R!\M&,v2oi3J.HnNMÚoy'vDb͎+Vҗo< W< W|}_I,[~ppLE(ZfY4^dhRLWSFoӊ抶N,Vu=/U/RIP1#yb!Ϭ7fGDp?׸(oȚ#p92KϠv^p-gc2F:Z}aCv !z=2DpgW{]8=liӈ &Zsy<#Rp^MlJj{-=9Jx_ Qw'tmSH3!¼2І%1ѦsDu1aѪwE0*Izw1 eoaR9x_}_8zk!msW(O/T'e+{O?Vm++vWGo}o_x>k@խcS-~GK'BҖ,+'_~S6Bx&AY~BK)hRQ?ٚ  VD.[tA$PŠҟ\p?bS';7,i5υw5Sф4U?JXAbKt f+yp(v_xx p KZ!P) ްb/chCPf歕vQrVRY p<};3d.%et du ]k4> ̐Kx%Wr_8_Fm41u%$|E!,5WeǫATl JBs+RsR2#:#`/A!kb/'h( #/_͇k^_l:wu7[3ʇ/Enm/){Jc?<3= 7m:[dkzfJt[P߁dܼ!]x[-U * Th-B.OC|wD(5D\K.#%!P9:y_ZeJ,s=<+qDsIAY BD9ф=:'=c:Hxsϳ›7=.ϖsɲ˰*1Qhhhi|gQШҊ"$kL 1G=1% ]22Ic~Ndlb&;hrO ^=sKpNl:*108 U$Io>wLהRmaR1A!g9(S՜y"$6MVxlb=7a,\ hڞI؏7p-zUvN@VCf WW )&Bs942\qOw/z|cn Vl4]`!"]0ߎKEzR]rv)Uxc=dIg.jj1n7].hqWzAښ`k:ޟP-׿C>g8!YMaЖgoքPW]o"C V.oō`baHč4<i ݒYְR0Jbu0/XfE4(4'L8NWŰX [- r tBCaX C[{p`It1?iw~-yx@xp1f /n) "tm`giǓ'tj{bKUa?+o_~?ʼښ`1LECW̙Xbѯb,%n7cT\h 4^II%!<\9 מ>Jkq*Enĭ?Tf|$Se.ߍ`%x4z4msɬM~zv!\Sn;G)_נχ@y6X29ARs2) !{噐 3F"}M3%u6 >[p:Hq-;@hl209hH9D#I!yS*Q:=*ZP /7?#wܟ&NdEϮ(|t.XJy)! nvt׎.}z71.+՗>Xė!Vu8=_E ߾OuFAm{wbT*. ӷ-9 t+BXJ9r)#p?,Vʹ3QpH,h.4[Ge[/9Dёc2oT.>X?8a <3֯>/r=>9  weqRh? i7pg@=ŮN—N)3,ed~-|)uc*3}ޱl)6Hxe9͙/w4? e"4r2L$ЫԠl'f |2p1&),aJYs_lߓc8Kiw]uӂ"[w(?a?P[UBC@ ;F!%GB B{ⴵK])ug4BL/q;;mnŊĺvqi^LWw/Ѷ1~8)IEYA)Dƺdu5 *7Ѹp MdѭJ<]"iTpwRz`u b(^pmvqXv:MU7omQ#y}\ΈeӲ\x/Mc[of)Zw 984 ^ U5)%o7ׅyܑtG|p^nbCy~[A?sr/?5>󝣹-T,#j%L[5%=Zڥ_'y+FSw~k駼S{ -JLѐE3wqtȿx>|xf1 vqLb8R>9 V`?]-x9x> i? _'pi4ȸ!~^{Hxp)O-8O4+O̱^f%sw+9\yZU%Baxw0- 8tR1E$Μz0I(KJf 3^9˿7qzǯAΌ^mvtyHPu|2 gB^XruV.\Tč^xp(v"lc|meO4DTmhDQ osS`ڶ6eW 9ۋdг:xYb܌_z'HqhȴFOy1ZlSf; O_  28xv9QBCl5, ͑1HZXBR!jz˒*"/Lo|CZ~zxo~KbkO֚<;=9ANt8?ۯ}_AtmJHܛ?/_Ղҷw^f ʈ P hqhYQÑG|OV;~/VX ));QOaRViq%Gn<qRNnjmCoŒy9Pb913gGmk,ZfZ:'y>Zا3nq,)WϾOEX`]R蔘5\paŲqRV?s3*[LQuǿUŤ⾺ĊH^]5I?FEb Rxغ5Jz칅^5α3_y>|yطʌ5%*^.϶sip^Aȏ_|懿Fw߀6.ۺ8 ڠyB?tfA4]`y<@i dF!\8DmPmq:&fSAe$AJ;z -Ͼ'%6,oߢiCEx48X(j8N]n!PnwM6$=s&&xV)#̨ EˈSj\"K %bGxEt^l7/.08̻fM PJI_?櫏& U$ CE0]R:X. 4zyy2cƜA9gBײH3nr&4RXE9*4O>N<y89ox슈r&DH;gy`)Ө2M$zQ.B v`GcfaV(ޱPp`\\c aXyk 8rlzrg}qq0%?[~-gBP_>)7%qvxi!̃06;/68X6̎v'U֯Kv&jrw28oxsON8`9 ,#xx.q.*4~HicǧTclktmIhĶkhWѤukL78cSQKDdF`:lrMڡYɂ* fZ1g^cz uT -PPa@j|21 jz/wBh0HoUX*9u0\|1uP4i`rom'!4zƔ8|pD9^2Ljr}}vx xgþy[5>J/~3EʋKw?˭NBug Ѓڠ/.duW|~Ƿ O7E<ǂ%FZ&io1¿1_GVbs\m-Z)ÀP =4}*B39g|zkTHʱ4H_]n!0̜-e mbt%,;G\ʫkXϲ$V.wy4AX$E.^+1O#LAٯ}_:L[._ϙnReWtδ3Gezd;RXh2ˣç=vIr4"zABf ʧ QSEFg끜(>FeIÓ//~p11|~M_:[Z4pawax2oVϳKea?yN sDhy)$|˃%ã&\hTMƣ6%q4bvhhit?^2 1&LNk p iŲ布s˞bIq3;+x Zw(WDLYٽ ;aLJA`eķR[ݠxB#lZb]kv`?kݬb1f>>w@\zY[(s_ !+r<8Qxo~M䫟|Ͽ>gL8P˵k>zLe七wHɴƑi8 oZ^MaNB-lȄE 3fM4mo i[ O@369y4:wإI:VXuъîA8h{`4Dq7V9]iKً"R,7%cs+5RmCݢ5c(nLxlAUT &dܢbݙ}-A4m)}Q|T]wJ}8 4]=ij~'k\2.RfΎ$B7fR|"@v6[݆6(724-k͖nxq2{q ;O<_Ǿ1VGV~ߛϼퟴHWo}Xd$#K1r?p2/􏎩|׹Ti[awJ<`Z Utk\KwhA|m™UG|d/>!wQ 1[NK1_x>3g11؆2l3, 4,˼Ys"=Ji<%F1ϖ5  a񽋉Ӆ5O V1)qR Nsx_qf]ֳL;e|IR|VRrx?zܒwk`<)O_n@W2:h0%!ۄP1Of- gSƇ7Cx: X2s hΖ=4QdxMҫ D$kGxi #Wݒeah8\-8:XKZsu">\؎þC76s +v RNJ5{O@JƧDnکRH(R"g`۝]bLC%敪v7@q}8%g xkJ7er3;}z$]|JЂ ״8?{bX$T,!]H-vA7oqDȅeӲX-i>f&nxv&\Lk͂2 lj -0%Bɔ 3(QsjCȉ2W/:Brv~Fе-gr-onx4Q?yk}xwO}gkzSByuX'w*tYM"AqF[%fr%~YwZt2|g!l{~_?衍ڡO~6!>-;gb>*Sh6y˘i=q}4R O*ˌN7&_B`ONXgTxWD&p4x>˔wI`@=JgϾȔ7W@:Xˤa1*J N4d' U>}PhFG:\gnnvlђxEw5u[rX\.b~@-FzsJ$^@HU`PQ1` >eF=% KBנSĥ)Hn 7'{R{đJ`dFzbK$8GZ:>"͖q#f"5cn6# )*~Il:t;(݀ 0ֻHRg*3SĨ;B R&st0)cm`n7_K-ʏc—O/t. S?XDy3tgH$o3㝍U 7N|u?Rc+?"@iz\h#Ő};KaVigKV&4LQFirFpȘ &sּ3 Gf\Sh:O SvpI鴰GSo c =^ $U i[?bm Whx8ϔ}zgQ'O9swN9w b̜7<1|p49cRh#7kv=*mI~s{b׉c$`H_JBHE;!M6 Tl{7qt bX -YY'IB$_|ړ{0Kj5 Ӗ)<‰z 0p^4/4 if.fW6DugM $ߓca%zC 0 (C7Z?B 9D#ݢc-c&1mo4Z$gw^24G~tPu"GV~V\CȢC޸E%B/|3o-{`??ǿ_p?s6'zT2p45W=eg3Nvx9 *PrOGe3Etp SJfeNux8'',V :?~Apţ/;O8J1~ 9+3SqJzm8OJk,2շ!쮬M;\,PqTpő=L![jͧ&~0nngaG8W~[o'sǕ(++52|oJ@*m*i5 ޒr3y0D`B 9:@M~=BĢgVK)Z7 v9"ܻwWlm{֛-{1{ήyHi&ƌCɔR#MƇ{QW25KufdВ#>_nY~s/ 7UnvS5c3-A)Ma76 l?o~3 ~0 ,6(HVuWNq/9\k}ι-->;7 &5.F\Tgi'sж=VdEzFȰB) cjb3~+* _>e[ V/̾ ܣ@_*3*)#+pЀI+m۲ o_M*X?=tkS^9} Nyb8 =fü~t Sfd'퐨[gvIM{1;UN[IbzQM Sb=YBnV&!KFLu߃KA\FXou{c1,8<2 ")*4;4V%g.&u3JFrmdʁϰ9KGDn> g\1zC&3 LBz"Tzj"8 8tՊa 8t7{9*S )4ɊHViE feX6/$&S\42M ~ןGۇA\5" TS2ɛtZ}-Ijɗ8z wF i8BsfϿy~œsl+°!#yrL jk i؊NBvh -#UHJ8;fgDTNh\aMu8X׬v*3yIA2j /}%%#[G@A`a<>5q ſ * Յxc;ƣa6K? %!a9~Ҷm6ݿ~o>>9"T-:*b(8#$h*sḦ73BguMG:pu!`>?evTW9f(+7dgI;b(h6^NaQ5HzMUQ3a4r6?rf7cdh<+ 0񞓦B\)HN W[C' qLܮd]pztA8>>>'wkaz",0:8 wA=Aޔ,DTeX,&% !2 m0qȨUjZYg?1Ye: ֥lg Sd!4, c=2 X z|1T|O-a7!pS2\SFޮ+fnaZҳ\B}n)Pm(6HF۩H}iȅ V -8f0sVyL^͍Bٮ<{8,qyKJY-AVRbwqĄG+H1H)^͂UO0 [B iCҌh\4~pZN N#QQ,RUhU$'dp*YzFV\~GoGG\p7qzNjˌTuloLqz}qa3F8?"m _`\5֗.4j@+CpTArz(9\k6wC${MMgG wӿj>>?G x,W!7!nۤ{ VR c--}Bg-}|?Oټi yO⹑Id"!jr̛rZ%(#FMfHJ<ЯV\ݒt"LZe"P%Qغ %B ^`om13HuK+NCDƈ&t= %*OǑ(AaZT138jjN$HR0&\ڲ ]d9*C'4#&@g3 u 2ps8{`z!{ZX&h4V'Vx60./I@'a{Lok 'I[/asUyYt=wSRkrrg&5f}Bj.lcpFP kJu&$ẍ<ȆAD^]EQy4+9ѸEBjI-a75-M]l͐mr^;w+ьKR$64Tv2G nby_r`Q)M Hf#)UK_23EdW} K@+ LEpBVBdqs$!Ւ+*<f-<[r¤1 Y^Cfytdڐ'!WHH"" ~:'rLÇ҇Ͻ8pQƾg쳃]C=XwIFŃ&B31:kL5({ܡ5@!BO p_g0, HxKԙ\!6 s1@jpAgG 8#hE/IB8rLCCwMdJQ S3deZ1eItcos5ܲ7tjjLpmGi3͑M4l k 30酓 /H4)!cd@<ӖH*l3 لłfO*5#q {13*,RfPa:eZVf%J#p(VZH+f |>[ 㘈7k hMvq:.jSgxq32)eVk*7OͅCs/3X fer<"qdSt `aNnY67?qfd3tveUpvBd[QxɮjɊ#Dr#˵gmAUoZ1-fEtO*LYOdR =c(Ak#.:ajK=P!!PqD]E*!%.whZK*WLp"(!2N a HNH(E6Jvlbk^3$>d|l ^0 &jѶv 0Fl"mkcváyMSPd/kp4+F^ڒ}`*$)˿xi_}DÂ+sԨU~۞ܧ5{H{>!gGt1uЁ.b@_s 5 4H}]cUP<fk+y@I[4nXyl3a?i;TYOÿg%+RS)776;W$ɣ}G9%!Xy+Qp͉MB HP)гw6hDzlA'L[Haʑ1kf)A3oYwҍ4"T}GVE =< CfPgsT|7c&hBK@+F`QX*Q$x:;BјƔG nۥ'CTT6y5ќ+L~Ʋr \°R&+U,Џ#GV0n=If;YG\ް؎ƟC$9-eRRp:I-ↄfɓ gt jgcBHxv=_Hqyć{I$ɌH&]uh˼si.%bȓ))gGmY |2QCēh Hx0\MQ7c6'6G5&GM$~)"0YԞ72Qc?~DE dZ!+|ܖDלioӾ~¯2a' cH&y} @?98 Zs_cF-dΣ15?Zn {@.+rНT G@L8bo!6h\Q;@XWXB iW]/$Wlnl/O^wys!'Nāc!+CI0hFb7rXh 5'gGyËzLLP e2$fƁLSǸU9Ux'x2gc0~|U1$HiΘUm]!e(NXYcM3ǭcN6n*e@x l _*?y9;jqH,n6 Q ^88+^Gv [*M\VnuŐN[e!v8dKX]+il"MNx/aaj3A8%L~s T\ga;nQnY4B߶>8CЦ4);1W@V4}?p.[v`wkfHfx'27]yVduՊIrەD!fW&l+W,O 4B^W7hLϤn2tQ-Uym=leEc&&(p}\#H=vw]\1Sy4Oz*_S26i{Y5~Itޫ-,;CEͭuuJ0= 6!䦆/M~v]⫚4FCBBHR~x(O}_KE%=@m'{Zz}]Cp!= <8M_]~G,Ղ4nG.,\vAkHF0 Иmס wǰl v'M\m;R3[ C#4Ukﮞ)A5<Ga[S9"YASID ؊S~nל>89;t3{9VvȦSB9O-ĴuH:BVnx"'Gpp4onD2Ȓ@+f!3ILcVld5r3F*N8rnY j=&7id%b fb;H~MrX rd4DƁ? ,TIu$vLH*^sjy ڶFS]|v k&?g\ Rb 槑}&=noBl9NqUՂZXN`HhVh0BS`YW T͖\貚;ZA tޓ&F꺤Fpo J3%50u-AJ|mtJ6>uJxP AߥL2Lp:Aꆫn`J4p>AcBGI;◥n,sႋp:ixx1fn̋#@3s.xVCbǑЭJLBZMV6T\@2o<r}Uv Nc <sޒwDx8:[6;{wp7+kjb;lȹ%PҵrB.N*B2~աM01obT&o^?/hF#YQ =N\uddr@;Ej"JJ#!uDU (|0p$tPr; q 4.HdR/۟ ӣ9秤o:˞IYJb V%̩q 58&Յ#1s;Xp]< +~[ϿipWWY ܎TŸ 䰠s65#R"j~ >ct6ݝ_̃vA)υKǕ ;}בkgv=M3S qt\XcpOةZ?V*T+k?%\sE[ .mS%`Gɱ/S㌎b~`BRǘ \'%L r~>v+5vO8ԃDJ{l!)Q36Xgsy:(Iގl䈺qqd~`C`:q'vRY2iuƙxee16GMT:&0nXQaUz5qR嶏$fzLCAK5[>* m`Hh4aʙyg-s o!߼^rH;υmG^6GDXRJ~ԣbkxw"TGLX" 3)dt2I ( {Tɚc6>Sv$-GQ ~Gv d3Bq$\&4#$Wшx5_)N'_z_|z6*&WfXzb |wZR vHm ^DV$~$=cs C_ 6 qv+y S!9!n^ؑݏhɍ]_# *h@|jS~@ސ[WCe \A|`p $8ُ|YjS^3?k$DIOPa^DhPj3 qL*e#S]-g7Ni]G֋yHp'$%¶#;A[WBuoj >%2f$;.QS帩p$V4QWk0S2^";=8:9L?F|yvLBd:juo wcEȉ8v7ۚ>2dzH1*LG% n7BP@LL[LσmWN [~X2&ZTg+o#8 GCWoahָ#&s<ڍH41 ?AYYBZT+C@[CuݾdwSͤ*rgFwCh1М %;"RTy1';=w֥iMp.lp6筓S)pZW<6.)|G"2-,F.6;<;Z$\|ENS큣5A&9:9)4onnx;m9vx~ lwYef7ۏLb_z]~OGB/k_5;x4^9z{SV>cB͉ w BR;({wxTRH7f_#%4PTsdvI4oFsRt"KFKko^|xtCt$H]M :S7"bw<&+JWu(X8ѲIӆ1Dܔ<Õ$}MqhVKYa~x6x׿_mr*="ѦvxgK3}N1pvT##BZ{rېC02o9LHZ11?62k'5]jY=II! b숳b8#elre ;,A\VeaϟU SĕAMtnEF#r#դ ^PBm׸,uvG;oxy.r0 ~Nř9 8ߒUDKv{tGhN**`pCO3' 0TNv TA3ځABEz>ry0&g 7 ֪Cs;%qsǛ-gNyѼkQV^ԕgƖ4θ||)? cʬ7=G"qvt\Kh@_Cg1FZs\RrV-1`kb˖}0{22Xq̮+M@C(C`LEC 9^?u8l#ϟm/d=u]3$g;=8U,UEB #:21T)vj΄&b+#/0϶^qE/Es -R v8щUƪְU K،09zfd41%Ÿ19g82k\1y_<6o]Y_6yZ+ }j nqQ̀Nw-1-v%!=t<`ɔ~ ZyntH-WP]Yd5-A;kNw8[ϱܗMi O[\W|_Ht$ "oVc\sJS7xq<M}HT3ŎMe?}GWtKWX Ng0&.3# Q;G<'؍llNO4S@$X:pXּeF`HJlJ0qiMTfmC`d1*18.u l7/.8(mP^;\uxyO=i:7).?e I;~?÷ K#5]8Px;;GvJysl45,pXTp5'c[<>F)s8|Rm\x\r\I]W&|*$n?ޒF1$C+f*ĦdST*1NĘC5Z8ӂD4Bk" J'ki 9.n qȩ#Ěa ~\&'8ÖU_MΟSJr'}71z@ڳTy9V黕^-W|w2ƓD ޯнw^ȡ4Zg4~zV3 un yοn}ݤ#T-6Xl4`zןY\y˷3;XxP0Ec>ip{ϣF۝hal0VH+zWڜb=~3<~D&´qLgUzn{r'.HNk6"'i3&|b&t(=M+A'5qd1(GD*2vp\Ŧ_RpئGo7|ģ/|rŷ~.iѳ({KN3U9koh"̦0=nqi5˞B86yk}s4%pՍ!HU8՜m&\^Il m" EuF9 5n`PGRǝ٦7ٱyk#q-0X:ޘ=?ۅf,hՂؓ4&;C =jVv@`눬=?)ۙ|ѡ۩<"ū‰)\UJ@]{' Ո U\JE'nnoɛ%ˡCDhfGs<8[.Xtsfsv]! +;Y_ &K;shڝw&T(+ALD N16?0L!NM#"-9 ʎaiÆ8|:%+hqI{5TW04u'R>vz?X~.zJ[;E{RpMC^lp 4"OxIY TPP HuKU9s&?0ws.[ y0 h-;O\?ljp zQeWM@W~%jO_(y4feYS {]$6dRǞ/v;^iV87.C`Z{یSa~ +6[tdTfY9VP@%RxT3Q<5Lt@ҸDꆽ,*ɝCMΣ!9wLj/_p10m2A]+5Hd&4.$-ɑp{Y'\=;q؄WuByE;YzWFTP#I:m2F:p!r架yw@ە G +@M^Ô|2Mp#C$F qp4^1V[rZxTkkTG:?) Ǎ ~L^pA*B! 9PpgpG<@\:4vHN[{5;2҇3*q /=ЂFXzW\zb@}Kw7 ]S9P&Ġ#9@쟶\HGg~W@S6k  Wؑ5ƻ3B 2Sې2YgsKadV9f>rr6Ɋ3q.7yׁhx2;׉n8JۏR@l|KV786Tz ٩h5!]dBr mNBzyF8qJ0 ޒ q$zǤ D^T*SkvT33K(6A#LzVsE BsSg1ӳ}]̋[*[zgW&r H;.3HÐw֝$ƒr[d ]=ANZŮ0"9[Ɗvd9H x7A,< ~j?7qwkΥ7ewT]@rG]EvRqhq]Рc0"YuͶg*]Pזc Aʲb;Ba^֚MXPӽ[NoU4)A0px1;J(RҜ4XF I<@U1Y)_BE^b񬏛_8h#`{ R5+KpD ;_xRxO<@^삶HS;_uvԦl^vK<]# E2 ;:_p= E|'IhNwz+<ۉ?eW&1a3Yj)Ǔ#5}HÒfdzJ2`+D+@cI{lulN;}dyG y4&hI^.StTn` 3׊ic|rVU9RxvBꨝgg!8<ɞ{*qlrH[G7=F%f77kznK @":q8rxc6=cDw`717V*b%"iño>%k]nCϙ#pR >fF% TNq97ێj2aXíMw3p GݛHcKEnѺEq@zK 5|am03}U{/@=$JQRozDɛ"DNNNohؘݮQp fT}}=NQP̅d2/VdfĹ)˫)Et1Whc%"&ѻdB%g:11"9=ȢI =ā̜ $4PmffF +r*tTIKyoWW"~?_Y_KK{'j:KxlẁSF*L\MW/L; NKe:4:N2?-񀴸i1ح.)l{X-;}T\qé씏wnX+(Y*rsM-\q:;/8#G8X,Io̅LM해VB*QaւlЙ>4CX'i2tŀH)fnjra`d)1v#s8`.a#˫ aӤ _)i츹%JbuB{r bNMj>7i cLC4'O4'+je0II,H5mKȼq:亦:nigf&.&<~H5_ʸ.Pȴnќ8N8oU0k8̣f۳^R62I o:jSQRRލgqmb+N$K;Xy荴WUFlv lְXuBN8ypU1#q ͑q"[5NiyD7H+I1 ٲ٠5˨"H#T:_|mr:X2:R9A)f/*bCO=j0. 7"C$A뇞RZ3c Yl|_gH1Xֹr›"%[tіLpSF%5$&m48GeTxNG$&$4g8ld1Տ.;A*8!<$&=~^[]aO@ ^ugrGa"`Y}fȽ3fތujQAkAT%I$zg݋ZރޥZ #팅(Yb:~yP_Wu?q ك?oz{QiKʀ6B_)q>s>w4cZPy_"GgjnV~ 4/SFw \[,w CApӍKk7+V-&<״#@ґ2mۑq5ݘBtZ[h86łM8y8r64qjR7cbt(GM۞GO2UϧTsf_|fx 7g!V7~UaHC|9gQm|sz^f1gjQhd.eTd/ŭc1LEnx_\]Bu "w{M]౬RNmh3p[vn]pF\Z׾~7?A|O"s&WtjܗC,c #,,|K!/yčkrudM@{Xz2Y2*^⢠Ό\GR,hELVBK+BDLP*NВ.RjMNvgm-jog"zQCADxr{G0LN(Wf[~y?X'/+v5x|o;g tݓ6q1X~ s/o6 u5Q;&|vW rK_t!rt Q8V V{i;/wQI>@^!߀p_AjV倻Yqfդ|v_{Yp:Ŏ?qc_:μ0 Rr8v_:?7sB}43C);UGĤ .ҋE)_P&hB턣Fm-@pN˕i&Lvxb&kNϧm +%D愣gRۉʉ܏hGOдs %TuY]bM*s\w#}ƑG8Le`DXfۯ֪LE69Zy/4WiOŭ]]ϝ5[tzGގL|`;f|C&>^/4LNIc+ӡ(\^N[[EEj𢏬O,:UnoP8{{<º :GNB;T"\ 2nCٌVV2;yo/?c|2A[.{gB4}0v??ΏpdD9q )jw]*:LqĞϦ_/7~.;VhNH fS)%MwZH* xPUkT[vC)\N=OQ! 9_E[ -ņq;w˒ ` L]5:-;ގk|ڑ+mOhѻT?} (C㍝5>`Gۡ;Ka/h5ef=В4oW4|:}p4M>U/7uO4_j9b2)cP"f|:H/ z2i?!4,rF`<؛j)n*G3,@i[+ 3)f2;9n}` %@Y:G&R& \o3;nV\9.M/J7 L'Dvˬr9ES!D6#>S=S/Nۈag=>e IQ hx'Π܄M3R}w%ƚiPɳ nlXbwj3Cr[ .;t9C6L-H@ NA#.wG_A/~BuG]-oߘLHU|7wM{IO482w#~G}QG]BA*)S-FZS2ţlBRs(Tq$ؙRUsxg QKd('e-f$92;i%"{ZH,ٚ{2ͷ/CYKb~,p@^M gy1tV,CdCȋ Ssg/$!}/D.u{JK|cĝ% zJZ7_KP}}>K_x?k[ *,kHĐw\۶1Ϊ R8NG~/;ډg浅 VU VGց BJj pڂTFМ⧶6PtMX+8dwݐ$ qhʄ"VhhvL~P.<8=)5͆m)Q!2k￸&gOPի,KF :LGLt uhR.xSxc|+p-: JfGYm[R 8s3whYfa !E5.r5͕bޏ.G3qf⚋PC )pKl:Q Yar\o(5s:z\oh©uO<>; N} o-P8(*gZ]/t#*ߖT ޤ%8$ei/pj,Hdg6T\r[&Иde@“d*bJ*,kk;8 ΚV^>_pqe?Kj*%T,ל/2W_>p_|3x۱Gxӑ#œ״/B4zG>SRwEIݝ߀Y;n6 );=ջ lV:Topri'_3 _ѯ/Y>O4 @s"KK "=_rkwe| C,I]Ϛ$muEzdHh#2#bgê `u7|f6L]׈wHe=1qTA›?Yyzb%s\sgIw"sfHc/6sUYDT-*9D0Κ*hhJ&ޔH|B5c!ZJ^չ]WuVwˑo=gO]mL{ fN|ؚTW^uUBl*}o]п$rۥ=J+oWwAR޲2H%7%J[zkWzGz8?Gy?wUUgI'K]l)B=C8m2_]3`WU& 38LN@:'8&g\=_/\oRN&&8?L$Ň:F-xw\ *IS͸~JQ "6%r+T/kGLۘ*Xg 4ThH(Hsx8ezCm:*i0QkZ610f1oRFc<=2FncSHCV -VFGe>K>+.7ڊ}E#:FQey,tg.;8:QA9FԜQ&,xɤpdkВ u§MT 8LZK<9Ύ&^#5)4\5u>3VܙCe\haxI}IN6oE.:SQĝl$Y,!"f:]d4)dkVk> R|bgf>\w[R?[A 5ܡR9rLtOͻ ҲZ|D'Paǿ;`߇ּ^ uC߻=PwhtQ+&IB@Jz'KL;7 h?"_j`OXFSJ>qX)G3U+gg6 ֌0XV+c6> =21 o%25@.?XG&\T\t18 y$5Wh$?WVC{TmMHteYm`qjvLkOіDi '[j簾P*7O4GЀјx؎d{! :!r&@<Ou7|Qi#̌\7;6F, 3@&xIxc@Le8(ƑIH҄` I^js n| QTF3b |}+\cGݓ7z7*Ø/;4fSK"|/8 ? ?ddỈЪq|xK\28o̤ >'q(Mwv En3@Oe{ZgQ?,e_?? |_:%8<. 8:tEUͭԼ{Q|iڤ# ҕi?.^ebrF<IaY)c&i`9-$F'NVxa=qf3 *aGT\,CMYđ TsMUyLu1cдF&^t@{{L>ow=_[' ύT V:ݲS_Vw}>:3yv/7FQC϶H$GemsֵW^_MŦ:R'<[/Yj6y]<f.Sow6f,Qam5 =̣5m 1ڀu AߢȆPy@ŶEhʼq<8b<=<:;Laݰ]}zP#~DӈxOe*穛@utUʬsqp͆Z;"B.jQ /!BTFUSE $+8W~iE"^{M2bv]nZߣN&R{8h0O d\oíG$!t%*U?Y(A6,lk k/ZpU*gs;Y.ϑHFxt8So{SXh*&&)sTd$ ZL`ϡ Ubø0RXؐ# G9϶TQx1gn$McLI*q`]H0 Hqg8lJi;q}Բ#}2p*pS̡soVE=~#Vjl8> #WWbm>8*&o,{S;3\$am'+ },٣zQf>N+ǫ z/&8(<:bCI*qBad3{/e3Rf,tc#̽p\W )x5p#ZĘ;Q^i%A#HTN}B,cI D93wqBK"vxZgE }UEș1kL.9?f'3+ȣ$佽 x1 {hZ0q4 fc J@]4 7[0>L5"!r?qr4|V-x v5䣚ޑ1arψ\\s9iZg qX[fm 2m NhE|*r .ڊM'jDkQoBenj,q\D)?/ ~ Br齝?p , +y'TG Dhg JEou\(-P썔>MLUwO|ǿ~տ_C Pa5.E']ѷf iM3LpGP?LműNi`v y- IUbq }n[ O' :?cTLL-dlk.?G'3vXВh8^s9 D{[״WM8c Z*@2_?Rw*c-w?e{džTV1[xG܎%7yxӽ2'痙0䗰f-uzY(@}A?PθsythW4w^x o_x%t+&nsSO qy۾>%>}B^SG8gRe`/s96moḮ!G8S"Đn2 f>w/ ۋ<}'WK*`uڞ`]]ع{'*LF3(̌H`06\ccl {Y`@D@H  3#13M~{BUcN~{ ];Iuvkg<]jؿmE`o΋٤ īdϰ5Kб{c0,@S0 dٝk.e.E߱NK}`y"(8䜹VpYS*K2}ąC:=cK?N=,yVB{ڪm&s]i|q=3 3)b[Z7r%W ذa0bck$՞"aKmy ˋkoNe):B" HA$75: {/zNNk*Юa{nwt @opAMm+C6dCf*=ahyct (z Jؿk5!Av=چG DŽ+  Oo5`t|вcGI!95Q"wCm}%Hnd=IMt!(Y؄AX®SXvFCvAR@Pg6 NuBA P ?KY7@Rvl}]EB %ik4P 8C@@؋D R13;j4h,q |x5GWZs݆Q P%/'># sk9Apd Z <̗Ay>4%1hQ<~X^ickm /--bks [/_ ,(x%@f x%=1V1R1]Вl||"2c{y:=Q* tVas"/cѽҭ 9*^CyrPUOi)3[`@o `r} pj3 !B)+`j͓5Db7":L gFX^ @"W5s *j@щ`[['>ŝ 0i UpM^Xڸ3ËͶ9Vs,ΞI!B86~en.R J!U0k E1,"nCx>FCF•KC%mM@dv1 1EN/f9FtR83DlC#}k9altlm%+Cƒ$,БVa8@xhhF|c}xF#dK(v +Lإ׌dTju×@{qAvM@7QwrB=0BĻ]z8B[7u<;4jGgz!VA F"-z gC’e)dtg u0yhFWzCG}{ T)vvfdb7nox^0 G:vqd@sj: M B,c0Z{chb ELjc=;{XuZm,,.bjh5_ s:{>6Hz6, +ll $ݎ-#[`k9 x# <vA͵+.1 DP0lzvRX2;c2lx'aKB$be!rX ^H_b5=qiE<>VYK_:63;iݟANAz/p{qq #?oDO3d HVh_@h Jv%(\zZ7-D MoV].;(C 5g(@oA7N3 +s@@RCPU? _39Iq^dڥ4@Xp?=W NphppIbyYs;|wpGQX51`t@{O~ZG!G`pT[] z[r%}sS.‘F ;]l:N8$,qqq;Q[Z71{[xY\yiti,7[1AEBFm@XeKYuzǗ<| Gn[:<։tt o!ڽs/be2^kDQ  Psad ]=(``1j'NsCQБqBA0F#KScyDρZ'_jCqwAx{đ%q_ZZ>|ӟFE1Rw 8q>#ǎ{M7݌%=rZ )=-;R^‹;8(N^C |fo D{– sݛO`uu+EGJh@ѕ5lon|W}A`Z6x@},[%<,4<"ֈ"0v*w@oV1ꇱn,.-ZĖLakc 8<{9\Z[+8wvi"h?q$ADƒ8mXY!xKt@G侓Rm+g,Nm$+\%:Q.{ȏFU! Q`fȺ{cUuȖ) IBe> C@b0+,z0֎`e.6pP[!Dl邙65ʪ5H S,͢8 QOppsѥn b]fizI^ŚnU#wu 3Vn^s%M/ Nao姿s|?.~shww"e߃fBwnq_xq'֘7 Q{^|zocӟ{F-"6 aI %a;6hԛ88+\X۰auc-mϟiy'?Ϣ)E5D}}0=l "WOoVf6U5Gx#op¹>$^=~MGO|Q4+`uez}/+n6>xf %ΜHZ}VѬKcxx'y-A~xw?}/^Kk$2ʒ 01:(3_mfW>]BW6[Vo;;@6})Q[=v;yA;II*!ETB%!a#X}1NF м} l?v`.S9.#j(L<@ŰjPAa&fF*fcybxBX_2C_8i!ke:U xB %7{.s喯,{~'=|yY\x7Ugl{m܃?GWghF@SHB1BqGGZ}ijh/=O"2e]S˜a+-w`WcW;$Vo`لv1=ߍWy羌]͓y~ y{Ơ2C ۝]8Bsi_L5N]novMh۞Tabxpt17r⥔*7U ^ 6wB+Е7(J_O_3V߄rNHI dJ}~΁K*wr團u8RVt l`218SL" OmI# Sd5L :7|NA[HkSƼg. i׋^|0: @cڶKC(fny+!r\4!_mX;xEƩ3@,7 VbK)7#\#:|]8- ~~8_'C?5rs}_g9P` BK{aNx[_?Hkᶚ3Jl@S W*%JQ`Gk!F<5C (f'ʭeNhƓ3.m2zG_I)\uxGF^UGWM{{Hvv3_'`mUa4W$\8IxϞ {;2;1|; =uYh283WDor7 rsct 0g)3$X#fѶ1x|%o*~3N,1{(@0_=O^ U_sNbyAeh; <:OLf1 utJ&'\@\w5 M9YP |q|6Xj͗x"676-c>1Ĝ!Loѥ&C}!jZV@.Օ udDyܔt 5,Cz3V|WwUw_gtQg)a1h/t$E>M/7n9Q<7RM_0:48:猳̈֜ TEyߌ1C[ y\8s45S?/3 ȧ]oooyG?KN]]Ǹgg7E|1/GENW>r.E (+ F hts ~D59=a &uU}Ͳkʢ'fB / ;qdsJ4ĜPYiNB8ծl ,Qu)WF16| ՌzH !© [<=O|O|1ló_z'ׇ>QvCŚΥ~Kwd,"%h NUdmMl`B L`&aDLR0JQFQ.>`o9 "Ɗ/lWea&@*[4׶eP\>'c\:Q?מ-E7  +jX(؉5%A3km4֯`wo Vk v^Be~25J]VZ _)gN;׉3gqۅ03t ϞjhAZFfFVHw^Zw]:EݬuqGK8sWwhxqQJi8L RTH9L3J-5 ɐҠ:s Sb_"z ^@FDx=gt$FPW-(g5 'l_>EFC3QJTŞDWi۬VK )YdrmOk@pJrH "+ "QqELBoP^zª|'L ^S x9_hi)EUssLZ5Bw1fߥfFG14Z@QK'Lk|bBA؊5a=1&>jΚfs/sTQKW6phuJv# +Tb3N9+W y'D ^nݽbg B y??Qk,xVZ $q!+އ 0ſu}MJkJmUB5C0Fh@xΓ3G&iǹr]ŠAqHSgoc$@dP)pD (csBLxȥrRbtkێ>7pk07Am r N= t\w:7gA(@2A1\5b B9DyqVQ1)ftb]O`=Ps٘ {Z ґrNeKF*,>716@ ter^x!ZF"uhuu.`kk n:63B~)!;0 6Q8*uncKy^oB Qg2V$kS8=s*B hyC6 ~."LjB&fHɶ8'9pv9f0{LuTZ͟@r|D?a)xV9)a~Hh@kY)M0#qtl}MɈ ~س_8'KL`{qpkX2:5 5G`UM@=hۛ铘TriF6G6ef, j5o%:D@O1Ndp"&ty<4"1߾*H`A{{x?4.CJa ><1r_Ii ScQf,HZ>p@D\#cy-a@&w&@AKF9#<+vuqJ۔@V#@DVPxՉx TaMyrm#v9%"%@<Ϫ=|KdL̙ jV}B E17bF_<>L7q1ͽl89(=!TpYh lcGKC: /Vy$ #eiq++sARˑ$c >l=/@Հ !JC j*(Ȓw*򸬬 4nk[*$$,qS9O@QxANHyeDr-L"؍;F3H4O#yr.ݞNBk6>*&އkLyh.X,V$"An1ȢeW>]@ He- l\5!9A@ДEx;NBRuh9FѼKG| Cc0()擜;c|r&:s61[b>NsQixm a1!WtlkHAz(Ր^sF~k dnR R"*@1E):9FCYn_Ñc'~=B#HѝȜ}19S>K&۾Tbݽ]\;o-on5Gyem "d!vEgxnã<ťE͹7B0-UB$-s)0pgOb^K3G aR?Fnr* @p{{[v O1l Uzl#-Jq^"OHO‰I[ HOdVAb??w.4y}cJ |`[g`ś4QxŠM0s*P2=I>`E= dR$SKi$ޝo@i~\̓ U Bs;I 3 Fˊ0C抺6O؟pWr0s.#ZK(=O9o99S~]TQGtylnn#'`?4f`N^Jx雾 ?? 5%:8;˟ n)` = 10 Ad2K[[g@PF k"ՍJ]Dz ͅW9rCMK}`i3Nw;>IPDU'%$IƲ/UhXR*8%lksK4L K}8g0 8_ XB-@A[ zαs`'E/ 0+s&\g If}׺$R  ]>ІqQfHc$]TV/eҞ '_8@=0{UtE0,-#oo#c*oAylx@UxCGRƺ½OsyjSqyT 2@Đ\U&WJą=ReBrbŔ5:5iNB0>8a)5)Qj&~Àh}fb #%Hz3Q7-= _߇c= );;h>o6q,,d.-yJzuдjNd'3Y?9C\#|3oeԖhq-+0*7k4_bN7ގoW6UdC~CJy(E9~`ncT ^ )0Og!! ;d<5`]Ԝfp:J̟'W]a}4#vفy3BK-H6Iz~U]?nn-_Ce8_ 0sN)|~nڡI/>;Z^^!\) .yuJ1W8x)lmm=v+x{q/D F0rgv~BRVI!Rc/rNGy(D)H~KrIKCyêK.&;T̑$Y9uOQ C:V 6yq/ÈڗJ 臰GqtG-qa-V!b/@1 d? vIY`/gPհІU>ھ8=i9N)Ʃ抮jX^ZY BW*?Xɖl襗N7@^wǷ6> #1~ہz0a/#J$ݐ% O7#~.JI @/$~1 wAeA w4i EY9A2(51Aafs/pjv!HK3uX>k* )3q8_}'E33#Ji\:8yt9Іl@BBH )3ӚAJBY&De( jJ P>"VDZ/{+~kC᪠2sQu^O>}D?8Qfq!ᦛN̎i-'"f~J1wA<8zȾk/6?_s.ia&-J|/ i'Q]p-m2,N[ 24G#ٜqEe\suܰlȤ"0 g̀U!1Fd}m0ZFcnNC[%Ԥ]vn^8t8^sx}{ݣWzh"8IQo6җ~<SUgQ#V¤/ooVBSȻ8),5ԩ.c|P{U $m[ari`N͙yy}6H 9݁k1+T=LPx aV0~ˊTOյCshX;n"Rz]5ݸK o`b}b ZA9 0c̄. i4@ ¶;{Z*_ ֤D@/gZ:]ɱ&5RxpȑMI~gii++ʀ0,upߋ<A/]O'qo9|`-_~wKғOb{c3GN9Ռ3Z.w9Ϫ44N3}AmXd~O,e;v$\ݺvYֹ:g fP'PQ7TUgz`LEQc@Їy2?쨠jrz@d2TY:l`jF񱞯@"m2*AeHI@ )F 6aBmo՛x zן#?ߣ^3ZV$ίv J̹6D7y-4-xD); |y ;;RRB.tD8 BBD?~G #hz|m_eӧ^B[~4v1Tˢ~/2uGxWacK>[0?ap/c2ܴ=ߧ)&ۊY1e? :ƪApSvC~a'*og G.MV5\{ jpeiC-OrOKek; jRXhnBBjZ t`jm?(p+)Ϛe觉3 "a4._YVjpVWBJv]2eҥK!zq H0Ƹ~y?#\6$|ɧwo~ws[n:ߊ/?3?l~(#xċ/9'Q m Z'}4Z$#`Js(kѼ[01X Ldz>FD b<|̗HتڳMqA1&{ ß]kCҜR܅U\DZs]A|&Cڎ?^L蠋1|\= (Q frB NEg%q 5Nznw`PJdUH4Xϣ WG`wUK~MSe4$y0sr)̨ͯ/[fJnxPkT DlfSu&SֵC}YՓ 1kkkC%I B ۘL#̸(sUq 5h"`%>S52yn"~?}~~|ey߆_3|րA0aI2`[￈ڡ:wl;@4<3LlPvSQ%jm_B|ۿϼFt1D=4-9)F8GǠ+1 5U_?A4o0X\83W_#eːC>FM\1,Ÿ'H s 3FÉq.oD6kJ,eMGqB}遱(:BTGS㌘2P[Iϐ<1 0 F{z D:ach ;!66lS<139)%? b\Cb%g@|Ls_5 ,., 8o}a.kt }][vEk}Wqԛ+ f#Ql,1Sercjy3AΧaq~ ~?Q^*}{=t{ nv܅ 8r SEc "|ߛ X 3Ylq"mF}B*ّvFE'>oy||3}ع?I#,/__5lw:e)X1@=zfhjHeo`G=fthƐe8'HIu L\/% QyLW!i16&#AUDؓL$"˶sZ(b `:0 ;;ٟYxhak֥3y<㬔p67 2Qa}c*ϛja>tGr4w'5҈D&E8M<*1#)@00lv:x{}?ߏ7?LF^ |ތ fF6?qr (21KA%4x.*Qc>v`gqƛA HJW&q(B{DƧE^z%|泟+s஻B0T%6`eoܨ6v /7>!BfrgΞNzπ5+*=50l>xAɹ4*FG8s,X]Y?'ŇVL׼߂aX%LUE3h@G1x'cՐ47j0daARx83Hrrda?OSbP_6sՑa-Mj N)B b`a;OjSyЮ'r.єr>5Lu߃t">O剣= i b3h9 ߢ4:nac[Nr=S[-fpCKL3A4?)?-#L@tJy!h[k<ƸOWi: ^q؞TKC=\> ^.A5u 3X˄]̩ͰJT"iPc z5? )ZkyaZcwo|qL{;*9R2Mu]!㜊VG”ѹU[pk@>S1Կ+R,JD~afIsO`߃!6s! U.'JU0;ETURKi >я~7;9 p)bE%gnHǦ .uN \? }obO#lc hIPrZ< 6]w Ԟ,d; ]%QpNU1{Zt;:Ԧ1UUq*vK5)V\!N5ﲫ5֐50Yd ! R©0BSGs]Xce !e!3 Uu~ZfS柧=\aDQ4`yFQꐐ?owgu0јMK4 `ggQERO0±zƓs# [GgkIgKyO7~80SOd)ZLKsӯ;}@wo FgcDZ? 2BL0i"Il,4`->/U,(@`P)MR7/C<9jnՀ(f@'9iP#f>p9oz -EVJ AҷݘaB!c㙞 04ZH NQ<ϟ.qD`m4Č1 @>7&o]sFrzcL ,$X!sf16N=$uI plnnhџ$tpeJJI TQoH[ BB (\pcx[rG@k 4`4.DŽ>;8JVE.(i,˧DKΑ$Hc+1&N$-vfDZbJ-A`rּ`DL&5IZ&A&:(g *.f$eUirV3/1P;-ІR]D k`@gL[;u#!jkhJ?ڀm^{(?nA7. _Z `"D0|i{csA,0&4ha&v* ck72 ai& hcq@j`@=1H 0-)Q #郝3{,3yp|T[3c$ꁌ&g067.tLSo0 ]vwܔF:Ӆ؀`>ŚW$<)f-8 i<.ZEUC( Mєʬڀ/vt7l*sj̓;UiM_ QI *bA"m g v4"Z3@g0aEJD1Д˾eO"ةmWITsg/49QP&6<Ϭ] l]/m(Ӣ/_R ?90n\rqeer0P j$l?>`R2 3#E V77R HHa<!2uxw.[̻*MOnD9q)i亟vVcR )f,VKA<0  P 7@Jv~gli kK^/6䟪#40,B+gM@:SJ0h{6[hP e@!tHL\P_3z]!>aGuA0Zb6@؉) Gk`w̑@BLE5i>|"Y'R岙Ell]>NcccQ3iql(P'P#a޳UQ1=S0*g#`NY# hia(rN@ͭia ̪Pol ̒2'H&׭c` $ t_OH- #:@e,V3MeQ.0K{`m_ZvMN醙b/0.hs@xb(O"VϤp2l#y38|j$*'ԭ@NLhTPVƫa$$S?Õ]œ(;(<;k")'f*[[1N|&R VHp` w=IR5! 0 1[Qa~Z:5vY2 ?)q kk(v ] Vd1&ל `F@PY='͐s llt.1ê'3&I. '2fO8̌ EMI<P] KݯeH~”nŅIwRxCJ1fD83X.;Uru<10_1ڤF$=Ŏ6꓾*|X/I) *)5"g<MP`4D"~M8"tP {V^& tfls<8_՝1X8I@F9P6B1 ceik E`7*VO9Rᚐ,}…z50ʌ6G-9  !gە1qKsdUOXҞk&%y@8] \tF0:8h N.BQeTk$F9Tp'RRαJH'M~%ȓW@ 5h c 44@BuNć"<})uti}ٴNRt?qG#OS;-Ш3"DM­[)#2c;MĐcQ3kΦu$Urf/rʯ'6adG :XzIn &U3l IH\f1|a`M.bnOZ10RQ&k39R$631䤈LIk Hf1) PbscoU<97_et;X[[sU8sؑL v\CС ANdiH$>BNhxVokJiȡ$ʄǸE m]~\$mG {jI D@( HDӐ͊3[4LW!ZJySm57NI>0_$Q7w[9I.wsDh}C*ID@Hhydx3 D_@3G]"iXX$d9%SzT_#G;~3!Mu-$"n;;ZC5 F_E99luI!xRڔf|7#sunZmA2C`\Qt2/u ^(a4jut b5\*R;at㛴j`f9`PLh}Us1@LС uj}LOZay YiyǷz:<us/y@ϔf'u zsE}u 'zKA%UQ3X! 3r8hX^ *N|gϝOǏjάИ~%t;EU !p7ȑ#t2+{]w8RC_+S8tήecok3QڶzyMRD Azg3 C0礏Ā*|A| "Zm<p|Nxb  #h@k ǬI@62͵rgܭ\꥟>8PQH N}Oi8Ot?K1DMdTcqۿ k)W}/NQkdfuL)0Ckkۿ~Q;c ۏDru}}nw&""­ފï -o=wU0VӜ^x±K*f^k667+U2U۹sEa*r+3 CΞ;NVoZ7^kCw"9΂ gln(jƃ$@:@"wid .}, 4@gmLP[8i1 =k3y#O VXFSNs1!_Pg Gs`< "h/\$52>c8ˁ&0Hծe4Bc*#쉋ǭg2:I(m%k F`GEvnY̲vԵM|(㑇.,-.M+LKxի^5R6?&KiK PQ8NOB;J6]̄y umnLg=u{ggf?gϞrYL[8mWסb5Ph TJf4+ &Ellnh>ۅ ǟ0K=0ӸhՁ$@K \+"dfYacPMY<-?'jGPLd1A& (^˃4WsbOyL#=|~O,41NLtxFN-ʴm{I"Fs,<ӌHԱu;gǐ9@^o.Y??2 Lӟ5{Mkve?\]+7SL vvpa\M)+W$@K[Dvl<\b9s?n6H{PeN$:3/|!6± !T>i4QTCwyڝb xL9٤hV-̸n:qbߍ=6_,eQ,+{Ħ Xoo>eB T6-Pu,快wbHE$[~(-DK?'XqQ˴g[[GJo?ϧ.~?;n.Orl~g_A1K\)D02Lc'?/=~R4i1rڰ盛-<㙋gH>gv,9 FWX8z6y)ރ 5 )Ol)rh 6{xnˬ&/N"G̰"@ !QZLb WQ:UYOS{v#Z'E3#")DCR s%f,QhXA@d$Éت>K{ z+*ݟ?>᫾Κ犥h/G2~?{Os=[1gb61)<>/rQu^z%0A䲦#.mF\_lף^D&):*(? z &gB ,ʱ%{P eˬ]OceґsQ"e#WlAO KBc^gT:6Pm~jXWgfxbniR /LSP-4XQ)NIk4R1(%"ih. 0hu|q8^s+gV)ȾCģ<|U~kkgh4W>ןƳ=7Ըr_0b5v{Aa]nb(vPGi__k-8x8R/:?I\OgEm\pO Ȳu6h.5] [GERC#BxR:Wz3 $h~S@u &JGˆ?9g N U ЙS >dC&t?,cjw%T( qGy63{:^ogy|ߟ𗍺 J4+hA@T:$@dCͧLq$:F8 H+xU|<͹~?<+t=F}prgϝǻ&=nͭM,-.nfxy8rt ecR(d߯aX ðDZ1)gQ; x ?fX[[+",,, nQ*DH֯੧_ra|^OD UWҘ;ja}c Vͭ"ŹsgSO}\,Hŵ+U D_Z(VPW6~}Oo}x+Nbue fck-lll$׾l4rQ˨ފN~~ /o]~϶|Ƀ.\8u[;>^b3K}F,t?3SEv{|?⢕˵߂ DE?@Bȃh4WpQJ{}lPq 2M^g:6=4[mM'i(OV@lrߵX#n|x~5A4j>Z5tn:qD݂͍ < x)a?hiQ.O* c*D:9:Z&n9|7|sfG&֮g+W nx3@̌s?_Obg jh2Z8yrvww]\8N(F#L A c&ܱcX}GVQRVG;W~(Rjk" BxLE0Ш6FTQS%.RH{RJt%bV }FǏ#q dseǸ|2:{ x".>"WP&ZqF aۖ$|-)/YǕ;0%ONp5[/`틛t8 @Gp^tJIz+}}i|j8hh;lO^ng4sb#"kgN*|[r;N^k8DQJakkޘd$QKg5nyD|0klnc uЈ? $Ci4$z&;CDQNFrn?9K0BaM &)=[[g>) .rcU\OFqh+,݈<-ʕ+B 2bR*:_j/.- v ^^`{kkkk< !9)ZGq.ҟ7=d5D,qe*FhkpSBJ('N X( EaDi:IfɎOb=lly *S*۬FǎUtGO Wc~&3|VKO`2¾Vg Ny`V#\^ӷEtb~à L8+˝7mxHbW 9o3Oo`5䠦dZ~ƥ2hgll Y]俇PaDT"Mm`E TK*EjzET#ǥpk^*BEZ% YNyf ehĪo'}N$XgDn ¥☻f`cQ F̩`1"Rdv&E[L4 :Ned1cȩy0qlYz#EXZZ_o}v.:0Od&& XnV)/Q#K"IdPяo@Ln8^q g(8%%ULN9nHs '[+@AYHxj}| H$;e ۿV /q(zWMjB(B u^,N!@-r`̂$&: seE}GdÇlxС M3q)/Žϟ떕t.qn.?(*2zG iP0 ɲC@bfcdL3b%^DC]HI$%3n. BJH(}f*dxJCgӖp-d2I/6r`ɰJ*nvsݸ 0>˵3Ϭ1LY ٯlQ% Ȉ#UGdr)9*>*1V {'.Tr"qJBXf`Y9QnUI#crPRDL5 <7e"sǯ @+n4hnma~½&}'!J{zhļQN@2g$E>Ґ uwv4 I@6qZ#O3OTS{N'%@TEHIi.yyա|  Q!A"YPFGPC9wS r"|ÖN+W)]3kWܗ?67Shڵ;$9椔3/3H$1 I@sD#q_Is \l5fs˗/SN"3ړ8]DYM"3X9S!ȜlNQK6\q"Xs U$\Ti$. ]z˩SD8osNHRAtL%CJyS2sP,}A]ǡcϮv ;QL3HhcJS'uٱ^ \#@Z#ԍW,0>nI3Q^`=d#i(hnp@BG"KZ<*#*#&d 1DƖ25)*PrB}~J"O4.6$AV"0:GrĹkD.YB`aǎ^ٳX__d+=dy 0SFU*䱎|+Jǩ`=嚦YÝ͉ZPD8N]E/3TЈe.޳\;Iy>Y]HC0"QZNl(%+4cHQ.U%n˵ W&TQ:K#dhct8DmHP.hxXyqh*%1_"ؿtz"I(dC"X.#b4?@#pq3g6z\I]yts>Ȓ9b؈,zO;)TGcJ*E8C @E%\T] IU[;k;?k>͵,PrrF'ǫL7OV{TvBX0e ꓶpcp\QSg3= oR2"??m5Ŧ .8%QoQM T;.<_ϡ9"I|$78,TqtaQ!q8Ou ^l. 6!Zj'@6MQΥ3BՉ//)=yzcԱpb/leAs:RԆ^3 g6t<(Y1c&|c8iK+Mxp%,dQ,9)څ Cg^''v¡pƋ3P_Ց^ٲ=ʉB>BXFfpX_Ǔ+=s]?* :Dz=n]63iat<6ȠF&-J.+#: @ -G/дC6AN 2iC;%gVDhHjz\bm,`VNQbcc1gN@[)Lhi«y0qє-AR`k($=4!}iƝ nňG":/b;)}dgN@dxk ;G{ rή&qM7.ϖa`   [H -g } #)3vhrB # W.%sIGq}c8w\1!LZ·i1+CP6Gp5WvFq:$=aHʰ%6uM+4LX@be}n, z) [Y8zhWw+RRwNƂM-F =BvȒ0e`P+x#Ҙ/} CBn4^O}9$exY)B i[;m{)MMɜw8*iR`rA!!TRC=09/4T3Y09&wqr  ݧ7mDH3%^A`6V>ܭW+Ax/GO1`z2.q2;WhF9ɄM)@,/LV 3'7hxNrφzA (e[|lnag~=؂1mkp[7}DgT+ ޲Sۈ@0x_Gߋ[aBVYS%b}v',2>kXg>^ڊ.S'ff<CY ; `*8 s`HjRHeuE{>gR#G& B^fٳgq|g!.^8Z^Ja?W]3tS4 2VMB?L8ih>ܡZPBx+c @ \ /*sUd]W5LP*04Aǡ#+X\lb{N' c0xY ,[U7a>҆f0H3T 6@x̓,7Ghe^ Xi ¸,#qj)ɥ~Ր$=gUopVԫ z}4;3t;ơlChS1x3z8F~.]|O=4)U9hn(Mޯd.1~y4"AfA;C(jҘxǼ<%{sU)՛uԛ5DBӇ #@G8Y@H~GPzʜ?PDrp cnLc&-a'X M?)衷ރ11̀r4c:FWW}='⿫~{oC?k3.Zkx4~ދ8R#;ldaa}crz8{t4V{>C&%G`'yPxFhƕCqմ,WCP..g9OL6VΚ' k.lA}i+d@AWQj"ImSJB˷,l_صcY6 +\~n>ZJD[{cZ&8~ &zx\7U/̸x2r_*qj]A*vFg᧔ӾHn/R) םV!;lIUe3?G4&1?*zg(^dļl9OɓE3^B#޲ yq*z4I׍k3W.Q[YT"=#7Sc{XV񄁷g u6,2eu62\N]QK;=G (TXxWT݉vn)|YCቅ!=ff/\f`tz2z u9ia(#?$&!_ wF 6RCRU i"_Je[oC/TeN 4MdtwUF[*?"{FO`exۈj;:,z+nٟc*L3l*Zd)Isy|L{?Z9`6ؿb*Kb.9MSЯ2X&$4I#; WFWyWLq'4[W2N)s{9`wsA1ciS8DV T1 h+<(vH 6/q&z(-2{Dc y8* f`_}ig n迃"Lw7R7$$  ~DX%oQq))ԬԻ7TTMgt 0 |bZ29 =Mh&\,\n'~z{;} < A> hMK]<9BP @D7P?(j\"Sۏ(y4 jIP"RmNŸb9 #KXؖ}=#1j8|!x綰^*`OfOYsBlEK?ՍI[B\?Uun?>ey&VFQ%sc{De^e }pWKv9AƩ>[1iE`ЌG  ٫ $޲c6P]jiDcϓ0+#qr4ь/{^d*,*{"0Wo8@lh1@ Uz ?S3UNEi?(EoZC(+5>ahnie/"hX'`wø*hȫdZ+>*%G`̓HPOsB;vM TqW:ؼ0V?xy,=Q|Ru6?{⪈(cIѳ猿7w@э6%0 *j|Sf|vWf'/"X\f)%V/ުa7;iк>_)/KB#&UFig.X'' ^|TmKy"گWύvcWECŁH 3?R)>_'v^]CP_E{ [ x呫Z5`GhV3^oІOXOI`dL7ۍv 9? 2Ă/Yg i!7Sۄpuz9OA -ԛZC؏ t_A!yth.(e rR*WiΈ_9^[z'Tf?͑ef\C nlի+,O(@ ժ657B`Fc%$uDέK=C؋A^[T8e'bF#@]ǀX>@LyF~.>qHWxT&66̊707ۍmN'ȏ˯jfTҥbCĦf|`33H%K5 P4$CXً6gwHA&~^~8RڀE0 F{]>Ai.5Poա.N!3Qє yn]窌MJ+e[}#pcخOqN5<J$a[Z! oi5a"N6C@\EkJÍH@UTl *ab 6 !CCkDfA5R90>C `7{.I>/r S!Wnl7}E5$˭Z7" oia4Mإ$|m$Ǩ}07pH)Ga|ueKh.4Pk֊>Fr#$Xp@/e;EV@\9 k*M7ۍv}Pi牤A j6h/4 X/E q i-cԈQ딀:^ AT$V%Z uH)5y)/ٍRJWWE%vc~(8?nB&d&1 ӌ-ձ^ZnRx h', B<C6!'O540Oh0Ʃ ߱Ser >ӻ8aꝈ-4pc9VQµtIG G;!6,7pLxa̬% 2^H%.=)j7 =id3cv3W:& aUf3mipnl7HAq $lD'FO}Wjxh`Yƥbqha,,F1zWGk@XlmAZj!G]|b3ۜb!_\n87ۍϾp͜8p/ ;G5jQg1X6)rt<2/}_cBGhak^?L:gM{@{ aI&"xc|>w;PM 58x`G:kmo87ۍ_z NX7TohqDxYJ9,.&zFѨPh6N(0'n.9˭Zc8;I i`D]|!wv4b.GM[Clߵ57ۍvc N@3 mp!RxtW$(%Й)fXX*w׮L 2RZjvCkm b^S5'_Ei{]q㓛|ȿd=Ǐ/:xm7ۍf{u*K``T7ƅP:oֱ"d}&OeϾ:<cCh@ !1#tUVuS].zuEuQ7Y.d9eVg66 FM MRDh9[Cl w> o D[#k[ ˄!: v{kq$^PX^2, /ZR$s,%ؑ,G:F|7Eg FZ*>#A'B}t%(FpPǦm5S7?AP-FK /qZ&0zt+I&'pNL,8HQC8Rkuіĉ_~Nӆ68}'ßF%++KM1 O1$@Rf9F^n jfD}d^Ʈ!dB0 8II0:>Դ@0K//'LZi2рW/s?Inyϊ6./i4F(I$@"VEÊY $w<>ڒ(I4e-f#bZƦQJbVXR~L^HCRل5$>p8&ÀVnMFˋJjU^ j%Ft!nLx8;A0,/$)YRd,dž ?$ ƅeYR̸ctdI&ViS&u=)@.AT;)I;ݸ\SxHVcNI6dF"rD$u´|=BM}fIYWi@`xjF ? T B$dIB"FNaBr ZlK1l"]^ O) PcE 9,Ѱ@Ln@,} 秦qt dhudjh/u6J+`T3 9@@X&hy ϕ53J@2D{}#/+53dx^ Il6Q^VBFz7o?0(.O\ qg9,Q%@!e9B $YmQzJͽ?j'„7|Hq x_L|7<'0LWh0ߤ׮7txVzDIPdXu`.!Xq_9R#2Ϫ/s DꜸ׶ndMq!W5r@ .O K1d Mx@ (X`c bgZF-fR ómxNt9q۶bMIV_OOK\ǹ !SbY*&--qHuzL&#II I;y=?L@T@3S&ą  jcA"|NSE b2c=xGe5s2խ>'$:ŌF! 35=Xd`GVe^jezz@0B׮7q~vn}t=j Xo[i|QaUzکZOqQII]tvpuN~`(=V`l1cZvdRTφuLO{꡹&#cφ*@l{ᨡV  &4,GyH*`"dzk]gNԏd27)#`Emk>kTTX@aaX)Z.錄qF\YڱYͦxt1tpY`0PVRLRa{z=5Ez y}Y^ػT&&&ijɵML{<(Y!q f?PVAu_W8 WK(xVmلÑ;= ]͹d@%g^/3gbߋ2YMfcKb+쥸>-_?;Լ簸իhljFS ccAmfvg_ZܽIOo;wlƥ=?v;w|}tpi;~'\-፳Q/>K 'RXhvK@;s6! @qQA {ϟذhj[]jeYNH >{Br2FT;ZpX5_hX2Qp;Du~Y~&n~KpeeOtKdcΕ3In!e4Z \{c~+|n,@ _.&=} CyNGj4=f'7nPnn1X `(I8Ӝ:sNGvvy0q ѧGrW8*|~_}%rWph?;۶nfM)r}e`bb[m$+1]fKƷ֕^OfS/ KL Za40+ߖV˦ $Y"%z/o4?`гzUiij`T`0q͏ڤy_}{(c'hr}mU[?w 0a&&&۲lDzS^VBiI1I ^]ܽ׉?r}z}[$22ҩbjjo;MN_7,Q^>k'$G |mfTa#-/U1\ބ_Q$ $q=[Oՠh vƝ.>]RKYi z ݩ;ٹ(JNJbǶ--/ܼy{< PO0 T܊bf {abbQ%q˜f^/9t:HrAOQaN T;7X۶pq4  1c7ofS͆~y'u(KDaj6'+#H;<95ũw.?/bvSMT?HVfzk ٳk;}}??Rs#lޡ&*^gגF=-C/_N^*T ,WPg'~wA{x-/ezn:thbrsȯN0z[2[DVV&`5 UAܽ{ήnf$122ʹ |u[v O@<-hnEyYI8xLnjA_F9JyY $0?իrhjISs*,: t:kN9OAAkKz4bjz{;Y];N(fbbB55ƕa|IR,%9$  Nڨʠw:wurz_|NxÅKWسsjj6T>tܣ5Z&.jڹ-!b%IEtp?))|n4j_Jr2wSc_;w)-)fmY)rHCnNR:͆^vS5ekOl=g[j7b499uwKVfEs-YYL&23IIN&0:6ظ&,RRR0M)$''a4),$RR<{՚¶ddߝ:;os(YSĎm[yq3xpe~?vlh[4).iFcc˼} c\]돯t,+-F;O6VE#ieF庵|FPc-fstdg|ϵMhX8 iKWOkKTCVfƂ$wv*K9{wuA9٬lX iAaA>.qSm;4<4v*ʱm<|8wv"i$ 0TJzP8Lx$\n7~.fqM-aӨTCZi.]~`E#i :ֶ"BC^j6Tcrr3.<=eWo󠏍U}{wmg}E9/^SgComo0w'id.`('&&bm`0v#;mUZ&#@Yypƚ*&&&#]71twOFF̭vj6Tj=c0۬U<6dlIVf驩x232HIIfrj ^Nehh;wٲy#7Us{Ɔu'&8{:?qOLDTA4IOO255~6++i0$''1 ! RlAjkf2RDyOp``Os}0gAn'rie*z}{w\&ӜϸnW -$IJvtin9N\7O$l{ 9nNs >3;unf-$E'0LY̬_WopOLNNv6yy  ;wq:za>?ǿC!rW06v{##tvK8;tܻOSMzJł͖{bGz6:P(fdA˘LF))|>ܹ=}\ O$Ӣ"΂y}~ utc˦,3JԪ*buU9Ew|4I(..`dt3p fW_>HwoFQZnRZRU9)b׎:nappq\N7._5E*ǡ,[ZRLggWr 4 I`44huZRHNN&nCvM0F`Z-r8LR,37h4F?e\zFɩi̓Smz;.&s>RAUwuR^K W2ʼn"##GfYY82٬HF7 1d`h<|8cZkdtqY  97n@26TCrWc497Tu/y$@/^g23ɦAp縋9٪qOhBzzy<{H; ͱebU=;Ը;u϶TW4ڱm˜#;o/M6JZS' qC]uٵ=.l25=MCC q B)* \ Dbj.Ffl6#I`$xs׹-9ݼ4,dda2bt|l^s$lӳ(OKK}>NW$dMrr}]˜lRR\bfrrqy6SS|?B"VVV&yP.rmz8c9;(.*h4rMɜNϱ߲n wnnܪ(/ptu;HOK}lE \ɄFu~]殦e^#+50W^Wl_|˙ldCz²̙si|M}`0n"[ǒ_*-~i^bUCTK )).Tή˯n dg4|q$5f #왵<^/ڏr|bppOT/,X^>FWwc}rsW`0H&MNM0$%YqrҊeQKWp' 7wzcbbP(L("99# ߏccu=Yc$<*FV霚3E$%%iy{'d)+)rVk C#>{}޿feCz6o7 W9s#w:KYSh}gLLLrձ?˄eff e$$dYFѐzo4kK9,SS P$It32uOO ([ ;C#|Q&&'$NP).}a9yJA?nǠ7he5ܾuyNXWQh,Pgpp}clɹ 3HOccMcܼE{t ߳jЖ_M&#Μ6~7G̱SS]IE!WikD7=;Յ?S ;oc܍_ܽw.3::'jZ سk;k82 ~N6+g]TUQFGؽsC#|};Bph$ 餥wl\jg_.Y\l9 ARulLn*._acZ-*Qѱ1_=[N3.r g{]-v|%uˍN0/ff^4j|Fƙ&%%Y;"-5U :ZvivNExYjq4A`1$a|^ vqmlHݙ 159&9]n=gv{yq2/wo3&' {zjMH AYeR|j뤣R|s4W7P(D;oB~dd qeYM* x<9lYj C#\olfnnއ299Y#3Z|ق$ajjK Woy" 3#T>?v|I\x<^*֖?0` e1ݹ{I|9\|>:Ϝ^]nNˇ^$8uD-+ʵF\nom6+$/9yzN3LHMol}b0 ŒWoP^V5%9*fr۷25˯#Kčhzz&'INH_;1ܲ23س{G|"پrrVljfi|>z #6wœKj6TRS]"PQ!2w:֪ư į~ɧΜu9ON(/xv_?>N>l?_c$I~NseAi3.ʈkf v+w#Jf;;տKجV>HBtzc ]]7dRVL6c٦z|~?ߝ:KyY cc|q_uhjB0涆PcOs|hD1=퉛#ZnrѠ 83EG˸OhbJ:v"PJJ2/"6[bK䩙q],3Wp-fžy>sWbj<ډN.%HE{mLzZ*;>{{;2LhZE?KvӒێsh)$''xwٌ#+k p9wa^]9`0g}>߂R03i>{_@$De|~?W>_ +3U9a%ؽ#^@Xp: [+/a8whpu:=p]E97V/kZۿx]җBZZ*v{G~fDǞ민'k$ 99g`L5Օn͆Jճ_(ᮦ*JZT!DQuj?e%56އ>)rZ tP8.dy3 qX̑\עjiDE9 (^cY;##_=Vc!)sƚĺʑ0I $ir]uVF9ha2K{Gݼ=F֔2XjŕK4o4A^?3LFHINkji4oѨ.d~WnO9 :!pY, :?frNC# ņl ݖPnF+"cs>:|kdt'giZ,pdyS5َ,?}.M0$0+3䤤1F^%ΜgUN))IܻE^j#i"K=ܼu9Fe6'Oezڍ)sEm#ށE{ E l_82H}DD/Ёh$o?CWw/ۿ lSok[|$˷^d2 1 \|V">I|>dmy)IIa<g]_M> &&'y<Ǣ!uk)**/m[\_A(qWs2A~dܼuh]~yYtvu?@B~j 1LNMs^o0];*gvm._'?o5k )ϥ ?{]l^o$HaUr$#wnG!WM&7P⢂9w<}Ji骽.{v-+0?EQw:]j.%cj["| Q4B=OpHyƋTC8Pl"+3i׮7q~򞒒F# .Wyx 8o/.[Lj|wiTUV "99 <` 'ǁAg12)).Oh;]D/pdeVD~jzz8t.]JKkk8|EtYܽk;mAJEåRct3tuo+ N\f̹ BaL&#& i$7Tr6tPXGͼq'߳[6ݩx/~]9pCQak BCadd$IR{菎s naxd4n(bhx`0";y=$F=;غyerjYًLLNz $W;>?%x^Z^Wp2ԲqRB~‚yC45ғQ{" lV,fz[]-=\tU5xJMBJhljT*֖S_ j<[i}*.4nmz\G$PR\r]oS$'ܾ2c2)).$HvdrxϢlQ'Yy-7b28.tz=%kweK0R.7aFcr|uW8kC:B$ sC/PH݆#+[Z>wh}̌t20L$qG8ddkE?Dbͭ7YSسktup9 .`0ellѱ&'ȗꤥĤ3/S"*r3j,5;~7]AfӼ1luj2bU\_޿垓UԪ*Kc6q܏г [4'%9Url0앗!,\tl~NrW/c*JZ I~ȻeFGFΑĄ.fZG~Duq 9hF=X,Znw$@a:-PFBI0aYlZGr%R9:ٳk;Svw12:Bcz=n4QS][af ejzOiRFz6n }d!?mIIN"Ғb\$)H1e%khX)zJD{nYă>cx㵗IK?6V\*b v W}U\$nF Zrb; .F2208DFfF:z.x=dQ[[?Z*(E FN?B鴤$311ɍ*בJ>L{<$Y,def,$P\\^ܞIq??ǁp'G"24H)ܾm 119]5IM\9VUlNGgwk8??fÜs`px)VEBHӡeWO_~kzjSRV {w SFdMQ!Hۗ|_d2jyo(Dž;gÛ^đ 8w!.0WdUI0G>~vhN`X,4&֚H3 C>WQ^`|^s?F- ~%?DEK-KK ''{K=< JrfϮC!2HNNF^W^`4RGA RYh4NW/kF)ILOOkt&l2aX5A|>ߟ>G8fMq!]=tJy`=z}9%xb|ɚ.EIn``pNU9> o* zCV$Efdt ^LKĽ9M&HKK%)4 qLcjj+W⾽jظ;)).b Z$SIHK7th:zGe%Ť1 m~g7_|uT_M =7in0^{Vطߝ8IAAt5`(wߟڍg2(+)v`$488ǟe:J 92cF#َ,GԐȈ̜t\rXKK뭄dM)))hl^5h4sVW{^(?YFHk ?WͶvWSVZ,=s$##^O;9rC+).*7&B0ΜH ˼K CC/it  49Ycw_EfzV<ı_25N:zۿzi4VO>\;oe-겢+Es-;uK2 =IVKD$gteqAϦݽp8LK- F1=Us~ z=NN[r62ӨX[FwA2YSHšBs-^oTWZw>by2 CcS*GJvO~@@P{+c! s3h4Zֱw%fVþv[|~4b01 066NUe$Gl6Ӌfa?v"͈ pXjZntGԹɑ/:;I#%dm)) ~\\eqbVHOb6# i8_'wu&}AoۂnkC!|>/~;rmF]lϜw _ѰkG Wj'5N# {lqK~n#{vmg pV;/ZB76100h$?o5i^DG51F'bP!B : B`. \~]9v׮344U/ ?-7 L{$|5oawv#I*"+xffSa=SLMMHKKedd I#*'JqV;g]힘Yݵ_}kכhuiU)h4$Y,qy$a?%kHW&&&9u<1Dd`p(n5''kpڜ}MMM!7rrxedYsvN㳈s8fxVY~xv̱|]l[{9jgY|f6W7r%Z"$ XPUkJ2^X2Ȣ~ B$Ia4ya6h7rްT_E#-;m!3#Ocd2r~JJv/ǟ}+LNNżdb䲥'Dd@yqͭ 7P`AWwGV7$%%Ͼ M5|> Ø:_Ϥ` ˑIcsk4N CbƜ E&vKVKZ_&viZy l>\n~5W尮=3xHB [W?WҒb>{uD6+[j7p@w'46oflIۏIՊֽ{vm's} qd͆Jl6+}r4N Jv܆^WHOcxd7b{]-|};5W$ W4蓣~d tak}#IS?,$YHOK`@0f=d玺% @XvY2ڣ (M;.wB ~.Z,Xh C&Ve;hLmV+F?==gu>ğyff*{X)޺!'A~^.--")ɂ#+S~w-Nfmp^Ŏm6q;).*퟿ǎ?3Sa=Et:FF[v ֔]ܽ׉l퟿Q.K 7odzld]of[;{vm0?.gᵟӿ|IaAwnSp^NxKp zzE sTW*Z!/^! Oz{"a$qoFM-K/р?3:H=Ww$7n@i4Zk7"K{;*s݋ut9{?'{j4,<{H" ȄE7Y)h)wPr% ȗ*[K*k6Tճuz9r3|>Yn-ͭøn\ndrVb׶"P^VBVV٣tv`Y\ήn&z}2ttpOLvKqkpOL&.|ǯ&E߾C돤,X,Ve;(.4-O +jigS}g%.e)[p,Rtpu:EMj+g+hy֒Rږ ]n 3#do^.wu mDq'7o*.Qm%Hgl>c6Nc^~E=޵QvG GGN.f'3#݆՚2gaHES9GE(VK!FIJg6N@(R;q>SSqDdrj |''W`4'&#ע$I]!P=pH]ul܉b"s2ncю:>.""ɀ5ՕJ| D5ͭ/SgSXO#_M=pҝN!ښ)IvS Gz/.*fr%rW W|>dY&3#`0fgggq|p?p]"Tnw,J~Ư~G&ͭ\l`b`aA~T9g9q8\FcTJpEf7p%|>?iE V!%%ل!  ܻEnT*'acs+-7]C^HuOZ/xxNjfx$322lX NG>._Wkrdf_qvL$iZGFilnEBz$R( k:u|\\dZX;o99n˭NFǛpUb=D?8%D|ߢ >lQ?Yn9ߛ}m`)^,zϨۺ9pwoFDՄWc]%!*Ikhimc:fŌGb6p:x}>L&sU+hniOI~ݽ'.8 h^bb6c4E;A>/^3oޏȕk7XWQFQa~\{b:X$#4R`MID,_$IwS CdW|Ca6߻7^{ s'텈I}!83gqOj!rY3^3jԅbm[HOKn1=#ifNGXYSVF_8-188D[܏fcKNGfƦ;}u$N ɈӁwdXԚ0` ?n7zܤ2Q;]p}{wۧz !/wڱd :ɩHUNŠ?0HN9tu"2I  ޮ2bdd) sSR9+ZAͳeVQ=wA3^_~-h(~\W̭*dً8cC=^N|{*cagWϜʌ[ ݴ޺g`xdo;[ò˗LԇWo~( Pu6p:]x8)I?MF f3vռAȂh5 yAzZ*8sڱSh0 HH SLM&99Iփ~mݬJC%D:|<`dt[LNNQ?b mĽ{] /6^g,#0%ht9"T_ Mnߌ;o546r15L`f5:{OS1>sJ8|řD2"5B!lVg 嚠T ^GZZ*SSN22I$=|rrIj$I_*>>3 -Up(Z7>۫-,} .ZXfR8"f׼qy\ ӄg^b1#I/݅d͛l:<2BzzKONJ"iQ "8u:nL6l8t,3F7^{>~x)$W[KGQWW?oDNWq}5Օ/Ȣ㱮#_Xd߂TP'CկhxMղv#7[!ekHIN# N,OyJR.]FfF:%k'-5˼'mq׮J0̢k 5t5 ΀Vgxj.lozpp'Q-'NG]TWҕx\;r}itur111ƚ*ydPQi(6-i˷ߝ"HX}0 FvY[YTU" ߜ<Ž]a7e%\zѸ9 y A.jiui|`jz&Py#&/{f_lM^j_"X]l~Fc1Gւ'XĎ"^@М㧂 0܇fƦV>8PXlB8u<CS˥N8}ٜf=s']|gFr#.zM꣓|GaAC44\b{]zrn[WwuO͆_ :&PI;oE͆JnwáTbrJhj+&𺭛q\MYO##d yxyfsٟϥJ=-|AA[R-[S`yY奏L[q:]FYo݁ԙs-9>=o,ͧ8$rbݫnnk-99B*2>R0R7s8%q Vy O|륫RrYxxDʃPN.C~~,N>;oIvWUéxÊ2L?G0~UK9&=^|~O}8|hDg" p7=~;3RQ^Z;fэM-.<^/mdx u7im݌f46mK}zTcX/`!UA!;%ZK1=urPgYNvqǢ?RgNC"[~ĐÇsc}m6(9{r|u:9z‚<3mj_q3)oL-5craAΜw|>_0hk]k{Mufwl*O,99rX4\ez;w8((yD$BmAybUSN97gFϧ;8]nUqhkͿr1~phA ),ȧ*WȀf?.FQ%{#w|>\^u|?u[7  KytBP |Oy=^&cZXz m&?G5ϻb9h4FnFUQŤ=$9%!=jq+^H"+y{_!Z =ܯ ;wPyYiT*lۚJJձ$NI`l9?ݜ1ИJd|+XB.Օqc?1ȱ)!]6!EZz/$;]nu%+E*Iiln}bU;dƦUv$쩌=iv͆JyM5pSGAj+K|mVrʠpu*TK46z0$X.W^`$ILyf+FZTOMu*=D˥>N[}{]-GGn-JDZ$䧐t1n&'ہlRʱGV4|hzM x{v5.f!CFvD#n<*!Xb!RF#+j"oXH@6KlO)-TQ=^"Q(=i$ᯢ:G!QՇYz2.9,vu[kI:%bmvUKpppHUk3~.GFDZ+1nljQI个w"J9V݆n#Ǒ5oA96EeUWVp(uBΕDH~kǺ*iu\ .kΊc$o={܉D1.6\G;8.UeTHb[b%ρ2ܮ‚AA?> PO*|qu?ߘJd|+,z*U>ΜW~3+ywlJxXTo?GԀet]lJ͆J V9,KI3-:ߪITqllje{5abU7^{YDNM-٩O=e.{9h|-32>Rާ,ˏw0̢k 5t5 ΀VgQ.Bгߟ]x ?l2[)1frC){'d8b{,0/u+JO%ޞH[$%`Z~|o?1c7N+RwH||9}z>9xnvwƀa`4<Ȳ #b弯Bu2T&Haa>>H#ք'D?ԹOVaA#KtK6'g9?,w|?\,vvSѺ{B[j|>Xl??Գ($H%e%k G3< 7?z o| <f':v?. c1(2<^sYA sVv# a*GR|rHJa%I$IIE7~t'IH _ VxO   ,yO#lg !E!w+$~ OsprY?K& 6r(JQb첕'AY$  v V Ȓ&"r%ԯ'l% 4/ @8zA"{AT؍Lx^! ) @(V,`ׅ <+v;bHa&~0#k +afH[T)&C0F _f9ЊKx*@ #oz LfЃ̄} (O Y'603=D?6=H|X@!yHx^!CbC!V<59rԈتmx0 XC??u}bU)wMA]fnw,"<)P* - / (]^8 <˸/T ҊJ_,{7;A@@@@@@@@A@@@@@@@@A~H E(RIENDB`ImageVis3D-3.1.0/ImageVis3D/Resources/icon_64.png0000644000175000017500000001344512320517543021105 0ustar mathieumathieuPNG  IHDR@@iqIDATx[xTULz4)!TV lhi.V ˳"?Ā" B '}f2}L&Ch>g>ǜrs. ?bT*ߕ*O?ZNnI``b2//Gx~/\P)))&$m@KbUA*U*⑩V|x"bŊW,XO,֚Lg4[H~~I%,ӫG˲xw= g/Rn? Fl!7**l\m@$3_+b9[b2 2{1cǎw{d`-|Mv۷o'wW^{SG2t8ʕ+M#FZƏ?XczCXٳgoƌCj7oޮ+Whiiy1ߛ믟裏fϞ=QFo߾Ck>|Qۼy>%&$$خn۶-eҤIW^}W_}BׄccX$Mζu(? MJPݢ<&\m*6mOKK#̿kpͨWJ%Kl,4\T_QQImkVVVXtt&ja˗/?hѢh3֢͈,ڣutk[O?y_˲Re˲~mßpL4F`} ii~ D+C=޵%i)JRW>&&f98GǺ֢jj6nX4}l,#Y:dlN[h,1g=@}A>UxsK.͜6mZ5kfH*.ֳP]|Æ 7F!k;vΠ M:u%={`߾}3rssRSSє޵e˖g}v]txj4h#J{ƍN_~ jК1XW3f̰]O1/zXqPNm/_n^n;vFu2<5cW,P'l$c.pdO@ m /AaƭTl/H $$Ȩ&pk#fz<}x:hVlmrcFor:.]3FCd& 7fYAIL 2 &J;hZt׶_r 11cn"u̙|p;c`yuX~\i5pK ;zMM"}o|~]r0wdlDC18'a͙/rkSJ|8TJYdM38|GŗZW7^h<w0ٿ8p:]oQ$XK<-w#vW |#ڒ P"$A8q z!VXb| %+ȰwMۏ-.  v^,E&RE}-S\߽{w~N"-R[<|+W'9 G  sȷmfHԀK~yQ\Cqɺ&8&=JDN;5/JB'@~Op_*>f͚WSS3288m^<%VN&=>k(8T59`BCv Mf;D`pVLlse9`)A`#@&78 Yw-Ũ6488}UUp8`׮]c0ڝ#GJ JR=ڊtttF\xz/<4AQUt: ΊS`_h PhCZ@3#{<L0!\ypVe#Ţ0fG7 $`wCCC_TLW6&~(,xLiB$ Yn9a'mA XgJ;U,R,@%$dP iihg0V>n GA{ݺu+U0zߋ-]|*M-r8_i/BSyh}MXr%x$@X/~521e1cA6h2;ZpsxשW/[(޴iӀ;j\I`;|`@\݃ :P &^[$2V..bK`h/DZV 9|h ;D,(LAŻM8: i.>ϳAI@!H_0Ҟ )[{ap9}%xk` ա!}b("V`V.e9|kFwYR9p%v0 RSSy6`蛍/?<j$QOdeCh~7vx9tNNgg*#H˼[@NUA?4#q&2aŅ'4olp… 1Nr@0QjstA`#UF& 9t[p@VXȟY Hu8y0HJy"yFS '0[?,Xp70+QN>.:>H[.B\ʯEEOX缴ԗĝ~ Ck~4)#a r@R{ }n` u@:3w֪|64lk?4`<{Å_9UM`6Zx"D '> ^`7ۋBL&Jȁ2=-O;+Ԧ3u^SY#XM|ōOA x P47(ý@&s"z,N:Ĭ%@^cqs^@#d!(wwGu`>gHq/TXo0XqRʈU( c_oَ;0, )d2P>u⯝@?d+k,@+Vh(Wb8# `b~Ɍ<`C͆"|;#I+9R ( #%C$ 9h^>P0?vO(Jj'jc#@Zu k^kږlj 8@KdwP,D'-)hElEna:#. ʖ'*(}Pf?>-{ż:Pvh}0m? @O $ϗ ;Qu]\1@ %rxJI:0+ֱ). 6wJ7/DvhoM P~9|ŷ.P M`49ԉZU[v c_FL'WZ  Yډ|#qtH&p!gucA/\7,`@GOhZ 4`՛2vuAEWj02Z7>As(Z`(f*@ XL` h,u3:FuEPؔ.*ۢ`m-qmμMSUin״=FG_ [*PaBoPe*"e LP]?I*Xvi4øYJh5)^ߙ0v[UUϬ(~QBFJ-;) LE@mȽdȴrh`꣕팞d8I"@_1(H@Rcޛ+?ԻwPg^=UHւ_jN^A`,ksC4j=W@ÕvFO*ӻz@?VMWdqkg_j~W4Z^o}iQz47x$ !SN((MR<ȑQq\":0Ieeq-[rģ|ABqq `3zfIAP̐Hs UAA܄x8傗`< z>s:s/2& aՃfz@Pb 5PWiɰzbPU]Zw=+迴nGs\΢tڅt^ {-%t~A;Ԭˁ VYPsA ku.)a?IZ@T-t@wTyҌV{v}E}>ojdr>b+]u1Wkj-=f<˜%KtX3$E5?s'jӽ _fh^mH-4蛠, Fk;;h 6g{6asSS_n.FU\2]>YL62?srC;jؠj'Ǎ74,!% vGuWsS$t#DxqF@;x(qR^(G*m[ vw9zH?zH[tҪA,Rph~|$Ń81a~)+ ी GX¤$06+jA@O=.N1%)4>-*c*s##'L8=YڶDoP"H6\_ Uu U)Od1wdxi:bn.z|C+Te-kQUx fյk j"ŨSߐQf /e-}c;Ac: !%M C?QQB4 қV ,ME[rKR_o rz"gW{\J H3Q5 B.@ $pd!s#~<<+"x M0B\t8K@zB@F&S`cbP-`'{[! eDh;VEX0fK9-0IWfH  0Q){`##xFW<+*x<$9E[-qWW.(I+6aa@.y24x6_-"bbϫp@t~,/;m%h^ uf@Wp~<5j>{-]cK'Xto(hw?G%fIq^D$.Tʳ?D*A, `6B$BB dr`)B(Ͱ*`/@4Qhp.U=pa( Aa!ڈbX#!H$ ɈQ"K5H1RT UH=r9\F;2G1Q= C7F dt1r=6Ыhڏ>C03l0.B8, c˱" VcϱwE 6wB aAHXLXNH $4 7 Q'"K&b21XH,#/{C7$C2'ITFnR#,4H#dk9, +ȅ3![ b@qS(RjJ4e2AURݨT5ZBRQ4u9̓IKhhitݕNWGw Ljg(gwLӋT071oUX**| J&*/Tު UUT^S}FU3S ԖUPSSg;goT?~YYLOCQ_ cx,!k u5&|v*=9C3J3WRf?qtN (~))4L1e\kXHQG6EYAJ'\'GgSSݧ M=:.kDwn^Loy}/TmG X $ <5qo</QC]@Caaᄑ.ȽJtq]zۯ6iܟ4)Y3sCQ? 0k߬~OCOg#/c/Wװwa>>r><72Y_7ȷOo_C#dz%gA[z|!?:eAAA!h쐭!ΑiP~aa~ 'W?pX15wCsDDDޛg1O9-J5*>.j<74?.fYXXIlK9.*6nl {/]py.,:@LN8A*%w% yg"/6шC\*NH*Mz쑼5y$3,幄'L Lݛ:v m2=:1qB!Mggfvˬen/kY- BTZ(*geWf͉9+̳ې7ᒶKW-X潬j9(xoʿܔĹdff-[n ڴ VE/(ۻCɾUUMfeI?m]Nmq#׹=TR+Gw- 6 U#pDy  :v{vg/jBFS[b[O>zG499?rCd&ˮ/~јѡ򗓿m|x31^VwwO| (hSЧc3- cHRMz%u0`:o_FIDATxėYl\{n]`'q 1aKKRT%T -(TB]$(]ԖT6]T-)i 8$qx{<,w;}cHizoo'R?@otE^sBkRoG>z@(#c{olฐH6 >h=_Y^NZP FwN Kwnѳ'v@v7-|! XumrxJu YN/1S2Ю@v6@hQ=7K%o?֔wJZQ8Y;pr PDe % B D؇l_ (K<иwPwm$SL+QL)ʂ+SY.HX+^0@nږ.  ; L=GŴ'rs.VɃJwW,ؓ=y5ߏ5##ʫ_bgW|`-pjA9!-HMC )ү! r~=Ŭ= z-[bn+*ʦX󳖻w%\OBa6G,Y1bW PTb"3\c(0`4H_  Z>dK2SE)św]?*M؃_R3_R%87:JoU%.B4UƧ ^C2Crnd#ʸL{DA~%[tS#;0P5o0̐ZLܴ`f.Voc1 ] iUoCl6E1Œcf$ZO$? kmsq&K&uկ7F" hKM l c6iEk>HP4 h_u aU2kx43N"f5[Nj͞K*TB*YN{c{{e*r؅_p{s48/ar\=sio' tU˕⺑,Ãk1$ܚq+ Y 9r>͗tTO  Q4)V,l#gW"O>jkX 9ef||"L:3kΎ-xXB3c@^LdV+X.f7t"5_z2w$kz.7$%OO\tna0)s`f>~#w~+L8`h1WFj6hONPfr`kMQ?y&6CbvS\ `1HR'N9n1qg_, ʄ&~oޱcwЄCKΒmj QOzpE%wᲳD@0 n\_, OeH\u׷\n+yXVE<$J!=6a'(h9)L R6Qꕢ;<4|Ƞ놈ׁA`(l_jI[Ov(.{hCMJK!W)+Jv^Bs{q+UҾ&I_;/-!`p6@m w<J9WJR!B6B_)0y~aNt]@ Bڳԁ^F}nSWh7P+.JVtT?'@ 5StHvKK;z ݅Z3  nh熖O4F+nSE]y8GԋɡA`x |`o(ʹ墠m1eK + =j( &UQ(w-SHY[/P"9-7ap(nۂB6 !(%,e/|̊%sT<=:Y'bzIENDB`ImageVis3D-3.1.0/ImageVis3D/Resources/icon_128.png0000644000175000017500000004213212320517543021161 0ustar mathieumathieuPNG  IHDR>a pHYs   OiCCPPhotoshop ICC profilexڝSgTS=BKKoR RB&*! J!QEEȠQ, !{kּ> H3Q5 B.@ $pd!s#~<<+"x M0B\t8K@zB@F&S`cbP-`'{[! eDh;VEX0fK9-0IWfH  0Q){`##xFW<+*x<$9E[-qWW.(I+6aa@.y24x6_-"bbϫp@t~,/;m%h^ uf@Wp~<5j>{-]cK'Xto(hw?G%fIq^D$.Tʳ?D*A, `6B$BB dr`)B(Ͱ*`/@4Qhp.U=pa( Aa!ڈbX#!H$ ɈQ"K5H1RT UH=r9\F;2G1Q= C7F dt1r=6Ыhڏ>C03l0.B8, c˱" VcϱwE 6wB aAHXLXNH $4 7 Q'"K&b21XH,#/{C7$C2'ITFnR#,4H#dk9, +ȅ3![ b@qS(RjJ4e2AURݨT5ZBRQ4u9̓IKhhitݕNWGw Ljg(gwLӋT071oUX**| J&*/Tު UUT^S}FU3S ԖUPSSg;goT?~YYLOCQ_ cx,!k u5&|v*=9C3J3WRf?qtN (~))4L1e\kXHQG6EYAJ'\'GgSSݧ M=:.kDwn^Loy}/TmG X $ <5qo</QC]@Caaᄑ.ȽJtq]zۯ6iܟ4)Y3sCQ? 0k߬~OCOg#/c/Wװwa>>r><72Y_7ȷOo_C#dz%gA[z|!?:eAAA!h쐭!ΑiP~aa~ 'W?pX15wCsDDDޛg1O9-J5*>.j<74?.fYXXIlK9.*6nl {/]py.,:@LN8A*%w% yg"/6шC\*NH*Mz쑼5y$3,幄'L Lݛ:v m2=:1qB!Mggfvˬen/kY- BTZ(*geWf͉9+̳ې7ᒶKW-X潬j9(xoʿܔĹdff-[n ڴ VE/(ۻCɾUUMfeI?m]Nmq#׹=TR+Gw- 6 U#pDy  :v{vg/jBFS[b[O>zG499?rCd&ˮ/~јѡ򗓿m|x31^VwwO| (hSЧc3- cHRMz%u0`:o_F9IDATxy$Wy'FDFUtUuDK6  lIx@1bol{ =sG2MR ւ@K%uk_rόoQtW5[ǩ8Yq߷{KMp K].mpiK%\.v KoD`}%^Y &$UZ6}7񍝺o_d2.y_i7jԖƗ@/d2opR\\\oPhvhBqԌOܻ =333B60Rq|o4">徤~۶_0clD)()Y)S333E*ʹ|>FlvLf<''']uox.JJɈH(ĩS92#y{ޔJǴSΝ_~2!#^@uݚԹvmկ~c5>/2331U] oxChfkw]wijjdǏ<ѸsǙmKKKP jW׸܇5?λN;}OƝ'^^xazîήv_>Esؒ8wG2#qR588cvashhO>O@'??2M?k&8ѣG@{cǝ+5bQٶ8qB?쳿 rV:;U)8y&ڧ>np·We zjr<ޓJ*Zّwuz{i !^Ճ7nܱ_]qq۾}+ ۿoURn  JR`Y߃D3ŶŎ;ީG^`C`Rƞgg_~9lqqq;~hwϝ;7|СCcG}뮻kjjjX"Q(7.8{>{777~acOoNv~{ÏS]jL&c@\G8ydղ,bQlvK/toɓg˶G1́-Rt.xʢɃhٳ'W\~h|GgqÇ8p۶h`z8d|NC&z-,,xciuDV3ͦ`Gec[[ƃh09d/ Pcg0ވ=67s`H,ȋk E8L&SN}_Q(;t&qH!s皷zu4cǎ|#7₩!!sԐX`ql~Ͽ7g1@.ԙ9ԌgAJv\af&aˈr u87w0::wȑ?>O@} K+7M5ֺ5M~c~oՄHKOlUngd|koE -.Rw\cdl|fq6)X?+]z㱽0-rC=[_o9|0sE"6y~d2ZY7;Ke&l08ᔺ(chǾnoQCyyN&N7Ⱦko}\콘ym]sҭkTf.dSJu=c׮]Wwxu?uq?(.΂P|ׁa3Dcn}\id=y4k%gU c޳#W}~;yh }c?wWfQ @ѐ}k׾7=v#o.%~uoW']X08М~6eSf  ˈ7bpd'`mfw}wqZ )%]{qǎ;ָa:!r&8xMǫxG}o`@sTwcVM{y'JI$S}^x;#ӻr=AK8j8d6.?!Q<HCm)tP K&ݹ鉖7 zvϷko/ɓs=> h  X$m 3lT ^ڡ1aH'9, h^9epFoGX-l!rߚdVmRIX3#@JfZLBDO __/\.,´H TO'-7`v֨DA ,g?2u\gHg{yst2 Z<7>X384+DHlEEUpY4cX P=Z27_Cc{Xz$ds]7+o9lweO (D/"̀v xnuot_YXL wym{W}M \fvA;4?QE"2xoWclU.h"ٲ- G];CBdk:X+_8pMkh֪x:Sqࢻ_O^kbq !7#;BZjVؾX _d !w0(% C `1${24XfTGON:!L|j/!;;[m6{3LqdVK;|RhFJJi#ekc^=h6<|sDR|ILx$>ǵ߉/TF_xi}?at0y@6/~G*9| vGB(ai &>sA2e@[3N+`I.Pe p8}lN@psϠh`~aR ٳ/!A^wo_݇n91qY=uqq˾TEO*ODYKc)v^0cYǚ,TN_w]p%}^"Yr_Vx@H8g6%>uY<A*B}@!+@! +_oxkĽsKܔX6%"02rAv1g)`OؗW 8P3sv2ٷ$'cGk -RC)(ƠIrlM` ٶ% @^5Pe>Q#) elFҶt@/`lC&ل\%@*HE-bџ1pU_~oش^8bѼ!صAMFE"o$NC_[y`r)RG09)myG Ap49 H/ 37g=~ \B c ( )RGUAۗZ@ @Z&, %TLD>IAOx)$`Q,!g:H uGa 'Q; &8,#ȥs&o{ƃ+_ZaO.jA3c!ɀ6cޡ{yR8ԙ;y_ #a00xRZ~q B8@`p4l]pjXGH0 O*]T@JV@FiHlK2arfp`Yj)3)t/& $ByAW֔p("`H%82@kX8@ZHL9Tx{Q J rL˚o}r"8c VM'[OZY]EwgQu|]/[Ѻ`angNO>zi%1@-&xZpw¢@i ~K@Hr@*hvA@@HL~.T0,YP B*0@P Cq$D$d _ÿ?Y[v:u߳3:u+v]`7#HAE9"'3xP0Yr0]PuU0=:@@`@e ip$8GBs=6D@AAK2}8\ p `Ď29`I2|`X0SZ, <%k}u;gjDz&og| HF're Uc`:)Z5FA/`2[0$ )+C&16-m"H&c"PA k4/eAt@*0tZCp/\`fع Wi(P/^[-Xc]+}ᣚw# &R vBУQ>p>{P5FO$$N Ț 8#tOC Vj1>|W:dszOkO4E߿~Mm4Ϙwꨟ,R^9 c;)z7tQR-PlN2>> cw <l ]]3&LJ dURഈa Si!T@F`fH${ ̂a 3D{ e܄*6M^{UkEW`W啤b0-5oC]E $Hjb f0Ȳxnr径_ PN<:mń~O<6 uWF2*Pu4*BȽ-co}⤎45Vӎ']%,s<5zwRS+ 36 PmPx** B|Ǡ<[_)k+M95@WphK@o}x?fp(GbIk P'WP>E| gP|zKM+;ޭ:#}E5iBU}<9\ $y<$w Ym&tx'N]$~*$zp)g+{J%M`ITN-OA"\{k LB-`Dzw[7Loʏq~/wLcMdSzei (- @u#VA~^LA:"w+\^A1mn6jg겧'jF[Vtob+`\v{OQs[!G =J{2q,Ľ/YuW*暝ф%"|@yzw]FoϥeYB4ȤHnr)aE{ 㢘&_$;8[r0yI8M W%0mrsM'p ,ǩ8m`ej9jJ>DZd2 j_+1܄3FM2{@@Iƃlx'/:Azm@$dO ܺY ąxrc9]UEp#`WD(cpea)`Ş=Aay^o1q"@FKSk76q-lHO+j#(bu u/Io*S RoCDũ^;}Zq0G: m}rj qďPPp$בf)CВ% L={$تZ_P D,@bmm%7kaLf>;Y`6' U)Q&@}^X# w}j¾GO!m=.*.2"'`\Ϣ0d}gPkF:Q')BHj@kS$Z*i,LaQ ί,;%'^QFpJnr. Ep4\9"C =`HHm4 }.H2og` !pТx@.(@J0R%,n2H uY$w& olY@Pj0=o@r1$AyBns02#o`HH0,mb^DgQ`>d:m$T^_wf?E`Sdr`n9@SVGb@_), 9L[l:SR)аGH!-51 Ǔ<>Iyg>XBhbfʑ/A2cEUWqJ59*U @]{#-!d,~%JaN'20)S.8헍bxg=0Hp#3a&@lQԨF\H4j]#Ĺ RGW\ #] 0&oꩇ2HjERA J)򊋴Nm02"0$Npp}BP*qL0!,.l72է>*́|缃i[c ؇3RAVh\$?c A`"| Fò8TS$+dpXѱC6"hΒEj0#h[ 4Htl8"ʣx8 o-lw7 EQZ$՞{m@N-+4ʆBr!Y Wtpa NjnTH\ sO"oJvrd Xl"%ډ!PP6{W+b9]d]Wƭ6]x5䅠{eO.!>$ $(S .,|u&kMA6/ig'X ?mY=tTJhpm.Ln~.@j~ㄊ`=,X$ۓG2cIdƄs YWm8wA$rKRyy6R@RF%\/8:b]y90ڂ8\ gdrg6eSv*- ,$(N%/FAԏU)jZW9ZjzM\Cf|ԡf5a?YxFwM o+[.ՉMcob4W ٝ,Pjm H aŐ ], D*͌{i~l \,miwE26i \(Ļgؠ9Pܒuy+5L0p !ESn +?Ц{%ǡ3 C0 %wZS풰;A6_#Z  r:;vUuSw<>D[Jn8HI^Z96O3 M@j U,!@nܯ& *2Q@EYFߘIzַ( WK,#RᳮǷfXs]~_6M( @+un' [QJ5zɻF6$WDDk8& &U妭SExlEEBŬw"V#6Ct4SNY `[TLnVN^&Y?NԨ|d r-ގٳMΌ{PD A%10c}%m_7#cE uU{" u 5);Sqh]lxNZs+2_L2=C(.V!}2_# G_va,4Uٽ,fq|Za9cSrqp=Ǒ5 zS\"!RKf5XmkW _\XʯRHemPMnCb9Lw͊&I# 2 (ܒ !7OQuE#D6?|%gS&} 0l5@g|'lQ@a0av%P\06E("aH+遪ap+|=o9vC:c.R^oC6cp.If7L`bP F:Ъ CY{r,أ}LIe h50|3~R(+ab;LZ-+% 6̌)$ߐ[9 1vB})/d\:r ҙf@:7tX ·}h&`dte>0l@"km+فehMQm:KħedWbqNE3-"f݀tp8۶p] K]\yRy`HFȵ#:̌GcفPK"! z 5_%߸iǧ &c.^}do~Uf+pC`;vXbSH-]7 n['ٖzy:8@mh=Xj'؄P߆Vlە(;ymLiZ<PdԞ0<^߽ < JBvj\CWL¾Z1jˆegBsJSujh6(ZNKϝ?]%ϑ8YCxFeTkaVugH Z+9!>8 +8Y>&{&k=fދ r}&}}sL\5IGŐ"8F@3L?3ٓ56#]k$OY^۾'h ,/ě PL]*N1k [J)`al?4TlSV 4 ݖ &A>tF)8?Uhah] HxCǦ^cviw?Lfmۄ~GO!W}s$agi3fG bePN}Wo8ˮߍ@yktpXc _ꟆF{k kU2GH(äM8'O86Qڳu8 X-g=BJ]w!*P~B#WK GZC$#" W4нpil±H/w~L\ފph3L EP釱AjЙIENDB`ImageVis3D-3.1.0/ImageVis3D/Resources/icon_16.png0000644000175000017500000000650412320517543021100 0ustar mathieumathieuPNG  IHDRa pHYs   OiCCPPhotoshop ICC profilexڝSgTS=BKKoR RB&*! J!QEEȠQ, !{kּ> H3Q5 B.@ $pd!s#~<<+"x M0B\t8K@zB@F&S`cbP-`'{[! eDh;VEX0fK9-0IWfH  0Q){`##xFW<+*x<$9E[-qWW.(I+6aa@.y24x6_-"bbϫp@t~,/;m%h^ uf@Wp~<5j>{-]cK'Xto(hw?G%fIq^D$.Tʳ?D*A, `6B$BB dr`)B(Ͱ*`/@4Qhp.U=pa( Aa!ڈbX#!H$ ɈQ"K5H1RT UH=r9\F;2G1Q= C7F dt1r=6Ыhڏ>C03l0.B8, c˱" VcϱwE 6wB aAHXLXNH $4 7 Q'"K&b21XH,#/{C7$C2'ITFnR#,4H#dk9, +ȅ3![ b@qS(RjJ4e2AURݨT5ZBRQ4u9̓IKhhitݕNWGw Ljg(gwLӋT071oUX**| J&*/Tު UUT^S}FU3S ԖUPSSg;goT?~YYLOCQ_ cx,!k u5&|v*=9C3J3WRf?qtN (~))4L1e\kXHQG6EYAJ'\'GgSSݧ M=:.kDwn^Loy}/TmG X $ <5qo</QC]@Caaᄑ.ȽJtq]zۯ6iܟ4)Y3sCQ? 0k߬~OCOg#/c/Wװwa>>r><72Y_7ȷOo_C#dz%gA[z|!?:eAAA!h쐭!ΑiP~aa~ 'W?pX15wCsDDDޛg1O9-J5*>.j<74?.fYXXIlK9.*6nl {/]py.,:@LN8A*%w% yg"/6шC\*NH*Mz쑼5y$3,幄'L Lݛ:v m2=:1qB!Mggfvˬen/kY- BTZ(*geWf͉9+̳ې7ᒶKW-X潬j9(xoʿܔĹdff-[n ڴ VE/(ۻCɾUUMfeI?m]Nmq#׹=TR+Gw- 6 U#pDy  :v{vg/jBFS[b[O>zG499?rCd&ˮ/~јѡ򗓿m|x31^VwwO| (hSЧc3- cHRMz%u0`:o_FoIDATxt[HTQ9%% #K&THAdEv   z .AW #"j(|(3CTtС2̜{9gZ/_kEɦZuL0;1 1 f˴"rUbQY@I鰭۲m\AMTlKe*t@P j/XakLmYi>Skh>_ufSny3x16Uz뻪eeiJ-ɦ2K2|u|6!$P|?S @; F/q`hvLeiaK5ӯݱL\Mt\Jϯ:B]8ȳ=5\ED.*jv۩" @4>C͋)ZL1fuu^v%njE+mMDTTDMhJMĶ `x>4htIENDB`ImageVis3D-3.1.0/ui_files.props0000644000175000017500000000324312320517543016150 0ustar mathieumathieu Midl CustomBuild _SelectedFiles;$(UIDependsOn) $(QTDIR32)\bin\uic.exe "%(FullPath)" -o "%(RootDir)%(Directory)..\AutoGen\ui_%(Filename).h" %(RootDir)%(Directory)..\AutoGen\ui_%(Filename).h Creating UI File ui_%(Filename).h ... Midl CustomBuild _SelectedFiles;$(QRCDependsOn) $(QTDIR32)\bin\rcc.exe "%(FullPath)" -o "$(OutDir)..\..\rcc\qrc_%(Filename).cpp" $(OutDir)..\..\rcc\qrc_%(Filename).cpp Creating CPP File from resource %(Filename).rcc ... ImageVis3D-3.1.0/DemoData/0000755000175000017500000000000012320517543014740 5ustar mathieumathieuImageVis3D-3.1.0/DemoData/c60.1dt0000644000175000017500000000731212320517543015745 0ustar mathieumathieu256 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.01875 0 0 0 0.0171875 0 0 0 0.015625 0 0 0 0.0140625 0 0 0 0.0125 0 0 0 0.0117188 0 0 0 0.0109375 0 0 0 0.0101562 0 0 0 0.009375 0 0 0 0.00833333 0 0 0 0.00729167 0 0 0 0.00625 0 0 0 0.0046875 0 0 0 0.003125 0 0 0 0.00208333 0 0 0 0.00104167 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.797656 0 0 0 0.80625 0 0 0 0.822917 0 0.025 0 1 0 0.025 0 1 0 0.025 0 1 0 0.025 0 1 0 0.025 0 1 0 0.0255208 0 1 0 0.0260417 0 1 0 0.0265625 0 1 0 0.0270833 0 1 0 0.0276042 0 1 0 0.028125 0 1 0 0.028125 0 1 0 0.028125 0 1 0 0.0296875 0 1 0 0.03125 0 1 0 0.03125 0 1 0 0.03125 0 1 0 0.03125 0 1 0 0.03125 0 1 0 0.03125 0 1 0 0.03125 0 1 0 0.03125 0 1 0 0.0316406 0 1 0 0.0320313 0 1 0 0.0324219 0 1 0 0.0328125 0 1 0 0.0332031 0 1 0 0.0335938 0 1 0 0.0339844 0 1 0 0.034375 0 1 0 0.034375 0 1 0 0.034375 0 1 0 0.0359375 0 1 0 0.0375 0 1 0 0.0375 0 1 0 0.0375 0 1 0 0.0375 0 1 0 0.0375 0 1 0 0.0375 0 1 0 0.0385417 0 1 0 0.0395833 0 1 0 0.040625 0 1 0 0.040625 0 1 0 0.040625 0 1 0 0.040625 0 1 0 0.040625 0 1 0 0.040625 0 1 0 0.040625 0 1 0 0.040625 0 1 0 0.040625 0 1 0 0.040625 0 1 0 0.040625 0 1 0 0.040625 0 1 0 0.0416667 0 1 0 0.0427083 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.04375 0 1 0 0.046875 0 1 0 0.046875 0 1 0 0.046875 0 0 0 0.046875 0 0 0 0.046875 0 0 0 0.046875 0 0 0 0.046875 0 0 0 0.046875 0 0 0 0.046875 0 0 0 0.046875 0 0 0 0.046875 0 0 0 0.05 0 0 0 0.053125 0 0 0 0.0625 0 0 0 0.0625 0 0 0 0.0625 0 0 0 0.0625 0.96875 0 0 0.0640625 0.975 0 0 0.065625 0.984375 0 0 0.06875 0.99375 0 0 0.06875 0.995312 0 0 0.06875 0.996875 0 0 0.06875 0.998438 0 0 0.0697917 1 0 0 0.0708333 1 0 0 0.071875 1 0 0 0.075 1 0 0 0.075 1 0 0 0.08125 1 0 0 0.0822917 1 0 0 0.0833333 1 0 0 0.084375 1 0 0 0.0875 1 0 0 0.090625 1 0 0 0.090625 1 0 0 0.09375 1 0 0 0.0953125 1 0 0 0.096875 1 0 0 0.1 1 0 0 0.103125 1 0 0 0.10625 1 0 0 0.10625 1 0 0 0.10625 1 0 0 0.109375 1 0 0 0.110156 1 0 0 0.110938 1 0 0 0.111719 1 0 0 0.1125 1 0 0 0.113125 1 0 0 0.11375 1 0 0 0.114375 1 0 0 0.115 1 0 0 0.115625 1 0 0 0.115625 1 0 0 0.11875 1 0 0 0.11875 1 0 0 0.121875 1 0 0 0.121875 1 0 0 0.125 1 0 0 0.128125 1 0 0 0.13125 1 0 0 0.129687 1 0 0 0.128906 1 0 0 0.990625 1 0 0 0.990625 1 0 0 0.990625 1 0 0 0.990625 1 0 0 0.990625 1 0 0 0.990625 1 0 0 0.990625 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 0.978125 0 0 1 ImageVis3D-3.1.0/DemoData/c60.2dt0000644000175000017500000000675712320517543015762 0ustar mathieumathieu256 256 256 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 4 0.160712 0.759697 0.160712 0.883628 0.284643 0.883628 0.284643 0.759697 0.160712 0.821663 0.284643 0.821663 1 0.5 1 0 0 1 1 4 0.119307 0.266255 0.119307 0.666255 0.519307 0.666255 0.519307 0.266255 0.466013 0.509376 0.299445 0.394575 3 0 0 0 0 0.08 0.5 0 0.333333 0 0.2 1 0 0 0 0 0 4 0.73161 0.544294 0.73161 0.944294 1.13161 0.944294 1.13161 0.544294 0.669966 0.745876 1.13161 0.744294 3 0 0 0 0 0 0.5 1 1 0 1 1 0 0 0 0 0 4 0.877855 0.252381 0.877855 0.524405 0.999885 0.524405 0.999885 0.252381 0.877855 0.388393 0.999885 0.388393 3 0 0 0 0 0 0.5 1 0.333333 1 1 1 0 0 0 0 0 4 0.37683 0.633448 0.37683 0.819934 0.563315 0.819934 0.563315 0.633448 0.37683 0.726691 0.563315 0.726691 1 0.5 0 0 1 1 0 4 0.818785 0.146429 0.851785 0.00952381 0.310844 0.00952381 0.352613 0.146429 0.311397 0.0440986 0.851232 -0.025051 3 0 0 0 0 0 0.5 0.479873 0.585009 0.80874 0.14 1 0 0 0 0 ImageVis3D-3.1.0/DemoData/c60.uvf0000644000175000017500001200540612320517543016062 0ustar mathieumathieuUVF-DATApH>MS￲$a/:Qvis data volume converted from C60Large.dat by ImageVis3D ????                        !""######""!    !"#$%&'(())))(('&%$#"!    !"#$%'(*+,..////..,+*('%$#"!    !"$%')+-/024566665420/-+)'%$"!   !"$&(*,/1368:;<==<;:8631/,*(&$"!  !#%'*-/258;>@BCDDCB@>;852/-*'%#!  !$&),/269=@CFHJJJJHFC@=962/,)&$!  !$'*-159=AEILNPQQPNLIEA=951-*'$!  !$'+/37DIMRVY[\\[YVRMID>940+'$    #'+05;@FKQUY]_``_]YUQKF@;50+'#   "&+06;AGMSX\`bccb`\XSMGA;60+&"  !&*06DIMRVY[\\[YVRMID>940+'$   !$'+/37@BCDDCB@>;852/-*'%#!  !"$&(*,/1368:;<==<;:8631/,*(&$"!   !"$%')+-/024566665420/-+)'%$"!    !"#$%'(*+,..////..,+*('%$#"!    !"#$%&'(())))(('&%$#"!    !""######""!                                                  !!!""""""""###$$$$$$###""""""""!!!    ""#$$%%%&&''())******))(''&&%%%$$#""    "#$%&''()*+,-.//011110//.-,+*)(''&%$#"   !#$%'()*+,./1245678888765421/.,+*)('%$#!  !#%&()+,.02468:<=?@@@@?=<:86420.,+)(&%#!  !#%')+-/1368;>@CEFGHHGFEC@>;8631/-+)'%#!  !#%'),.0369=@CFILNOPPONLIFC@=9630.,)'%#!   #%'*,/259=AEILPSUWXXWUSPLIEA=952/,*'%#   "$'),037;@DINRVZ\^__^\ZVRNID@;730,)'$"   #&),048=BHMRW\`ceffec`\WRMHB=840,)&#   "%(,049?DJPV\aehkllkhea\VPJD?940,(%"   #'+/4:@FLSY_eimpqqpmie_YSLF@:4/+'#   "&*/4:@GNT[bhmqsuusqmhb[TNG@:4/*&"   $(-39@GNU]cjosvwwvsojc]UNG@93-($   "',28?FNV]djptwyywtpjd]VNF?82,'"   %*07>EMU\djptwyywtpjd\UME>70*%   #)/5EMT[bgknppnkgb[TME>6/)#  !'-4;CJRY_dhkmmkhd_YRJC;4-'!   &,2:AHOV\afhjjhfa\VOHA:2,&   $*18?FMTZ_cfggfc_ZTMF?81*$  #)07>ELSX]adffda]XSLE>70)#  #)/6=DKRX]aceeca]XRKD=6/)#  #)/6=DKRX]aceeca]XRKD=6/)#  #)07>ELSX]adffda]XSLE>70)#  $*18?FMTZ_cfggfc_ZTMF?81*$   &,2:AHOV\afhjjhfa\VOHA:2,&   !'-4;CJRY_dhkmmkhd_YRJC;4-'!  #)/6>EMT[bgknppnkgb[TME>6/)#   %+18@HOW^djnqssqnjd^WOH@81+%   !'-3:BJRY`gmqtvvtqmg`YRJB:3-'!  #)/5EMU\djptwyywtpjd\UME>70*%   "',28?FNV]djptwyywtpjd]VNF?82,'"   $(-39@GNU]cjosvwwvsojc]UNG@93-($   "&*/4:@GNT[bhmqsuusqmhb[TNG@:4/*&"   #'+/4:@FLSY_eimpqqpmie_YSLF@:4/+'#   "%(,049?DJPV\aehkllkhea\VPJD?940,(%"   #&),048=BHMRW\`ceffec`\WRMHB=840,)&#   "$'),037;@DINRVZ\^__^\ZVRNID@;730,)'$"   #%'*,/259=AEILPSUWXXWUSPLIEA=952/,*'%#   !#%'),.0369=@CFILNOPPONLIFC@=9630.,)'%#!  !#%')+-/1368;>@CEFGHHGFEC@>;8631/-+)'%#!  !#%&()+,.02468:<=?@@@@?=<:86420.,+)(&%#!  !#$%'()*+,./1245678888765421/.,+*)('%$#!   "#$%&''()*+,-.//011110//.-,+*)(''&%$#"    ""#$$%%%&&''())******))(''&&%%%$$#""    !!!""""""""###$$$$$$###""""""""!!!                                                     !"##$$##""!  !""##$$##"!   !#%&&'''&&&%%$$$$$$$$$$$$$$$$%%&&&'''&&%#!   !$%'())*****)))))**********)))))*****))('%$!  !#%')*+,----...//001111111100//...----,+*)'%#!  "$&)*,-./0112334567899999987654332110/.-,*)&$"  "%'*,-/01345679:<=?@ABBBBA@?=<:97654310/-,*'%"   "%(*,.023568:<>@BDFHIJKKJIHFDB@><:865320.,*(%"   "%(*,.13579;>@CFILNPRSTTSRPNLIFC@>;97531.,*(%"  "$'),.1368;>ADHLOSVY[]]]][YVSOLHDA>;8631.,)'$"  !#&)+.0369=@DHMQUZ^adeffeda^ZUQMHD@=9630.+)&#!  "%'*-036:>BGLQV[`eilnoonlie`[VQLGB>:630-*'%"   #&(+/26:>CINTZ`fkpsuwwuspkf`ZTNIC>:62/+(&#   !$&*-15:?DJQW^ekqvy|~~|yvqke^WQJD?:51-*&$!  !$(+/49>EKRYahou{{uohaYRKE>94/+($!  "%)-28>DKS[ckry~~yrkc[SKD>82-)%"   #'+06GOXajrzzrjaXOG>70*%   "(.4GOXajrzzrjaXOG>70*%   "',29@IQZckt{{tkcZQI@92,'"  !%).4;BJR[dlt{{tld[RJB;4.)%!   #'+06DKS[ckry~~yrkc[SKD>82-)%"  !$(+/49>EKRYahou{{uohaYRKE>94/+($!  !$&*-15:?DJQW^ekqvy|~~|yvqke^WQJD?:51-*&$!   #&(+/26:>CINTZ`fkpsuwwuspkf`ZTNIC>:62/+(&#   "%'*-036:>BGLQV[`eilnoonlie`[VQLGB>:630-*'%"  !#&)+.0369=@DHMQUZ^adeffeda^ZUQMHD@=9630.+)&#!  "$'),.1368;>ADHLOSVY[]]]][YVSOLHDA>;8631.,)'$"  "%(*,.13579;>@CFILNPRSTTSRPNLIFC@>;97531.,*(%"   "%(*,.023568:<>@BDFHIJKKJIHFDB@><:865320.,*(%"   "%'*,-/01345679:<=?@ABBBBA@?=<:97654310/-,*'%"  "$&)*,-./0112334567899999987654332110/.-,*)&$"  !#%')*+,----...//001111111100//...----,+*)'%#!  !$%'())*****)))))**********)))))*****))('%$!   !#%&&'''&&&%%$$$$$$$$$$$$$$$$%%&&&'''&&%#!   !"##$$##""!  !""##$$##"!                                                 !!  !!   !"#$$$$##"  "##$$$$#"!   "$&'((((('&%#"!  !"#%&'((((('&$"    "%')*+,,,,+*)('&%%$$######$$%%&'()*+,,,,+*)'%"   "%'*,./0000/..-,++************++,-../0000/.,*'%"  !$'*,/02334433222111111111111111122233443320/,*'$!  "%),.1346677777777888999::9998887777777766431.,)%"   #'*-035789:;;<<==>?@@ABBCCBBA@@?>==<<;;:987530-*'#    $'+.1468:;=>?@ABCEFGIJKLLLLKJIGFECBA@?>=;:8641.+'$   !$(+.1479;=?@BCEGIKMPRSUVVVVUSRPMKIGECB@?=;9741.+($!  !$'+.1479<>@BDGILORUX[]_`aa`_][XUROLIGDB@><9741.+'$!   #'*-0369<>ADGJMQTX\`cfikkkkifc`\XTQMJGDA><9630-*'#   "&),/258;>AEHLPUZ^chlpsuvvusplhc^ZUPLHEA>;852/,)&"  !$'*-047:>AEJNSY^djotx|~~|xtojd^YSNJEA>:740-*'$!  "%(+.259CJPX`hpxxph`XPJC>940,)&#    #&*-26CJPX`hpxxph`XPJC>940,)&#    #&),/37;?DJPW^emt{{tme^WPJD?;73/,)&#   "%(+.259AEJNSY^djotx|~~|xtojd^YSNJEA>:740-*'$!  "&),/258;>AEHLPUZ^chlpsuvvusplhc^ZUPLHEA>;852/,)&"   #'*-0369<>ADGJMQTX\`cfikkkkifc`\XTQMJGDA><9630-*'#   !$'+.1479<>@BDGILORUX[]_`aa`_][XUROLIGDB@><9741.+'$!  !$(+.1479;=?@BCEGIKMPRSUVVVVUSRPMKIGECB@?=;9741.+($!   $'+.1468:;=>?@ABCEFGIJKLLLLKJIGFECBA@?>=;:8641.+'$    #'*-035789:;;<<==>?@@ABBCCBBA@@?>==<<;;:987530-*'#   "%),.1346677777777888999::9998887777777766431.,)%"  !$'*,/02334433222111111111111111122233443320/,*'$!  "%'*,./0000/..-,++************++,-../0000/.,*'%"   "%')*+,,,,+*)('&%%$$######$$%%&'()*+,,,,+*)'%"    "$&'((((('&%#"!  !"#%&'((((('&$"   !"#$$$$##"  "##$$$$#"!   !!  !!                                               "##$$#"!  !"#$$##"    "$&'(((('&$#!!#$&'(((('&$"   !#&(*,,--,,*)'&$"!  !"$&')*,,--,,*(&#!  !$'*,.012210/.,+)(&%$##""""##$%&()+,./012210.,*'$!   $'*-024566654320/-,+**))))))**+,-/023456665420-*'$   "&*-14689:;;:98765432110000001123456789:;;:98641-*&"   $(,0479<=>???>=<<;::999999999999::;<<=>???>=<9740,($   "&*.269<>@BBCCCBBBAAAAAABBBBBBAAAAAABBBCCCBB@><962.*&"  #',048;>ACDFFGGGGHHHIJJKLLLLLLKJJIHHHGGGGFFDCA>;840,'#   $(,159CIOV]enwwne]VOIC>:62.+(%"  "%'+.26;@FMT\enxxne\TMF@;62.+'%"  !$'*.37=CJR[dnxxnd[RJC=73.*'$!  !#'*/49@GOXblwwlbXOG@94/*'#!   #'+06HR\gq{{qg\RH>6.'!   &-5>GQ[fpzzpf[QG>5-&    &-5>GQ[fpzzpf[QG>5-&   !'.6>HR\gq{{qg\RH>6.'!  "(/7@JT^is}}si^TJ@7/("  #*19BLValvvlaVLB91*#   &,3CIOV]enwwne]VOIC>:62.+(%"  "$(+.259=AFKQW]elt||tle]WQKFA=952.+($"   $'*.158<@DHMRW]cjqxxqjc]WRMHD@<851.*'$   "%)-048;?BFJNRW\agmsyysmga\WRNJFB?;840-)%"   #'+.26:=ADGKNRVZ^chmrw{{wrmhc^ZVRNKGDA=:62.+'#    $(,048;?BEHKNQTWZ^bfjnruwyzzywurnjfb^ZWTQNKHEB?;840,($   !$(-159<@CFHKMOQTVY\_behjlmnnmljheb_\YVTQOMKHFC@<951-($!  !$)-159=@CFHJKMNPRSUWY\^_abbbba_^\YWUSRPNMKJHFC@=951-)$!   $(,159ACDFFGGGGHHHIJJKLLLLLLKJJIHHHGGGGFFDCA>;840,'#  "&*.269<>@BBCCCBBBAAAAAABBBBBBAAAAAABBBCCCBB@><962.*&"   $(,0479<=>???>=<<;::999999999999::;<<=>???>=<9740,($   "&*-14689:;;:98765432110000001123456789:;;:98641-*&"   $'*-024566654320/-,+**))))))**+,-/023456665420-*'$   !$'*,.012210/.,+)(&%$##""""##$%&()+,./012210.,*'$!  !#&(*,,--,,*)'&$"!  !"$&')*,,--,,*(&#!   "$&'(((('&$#!!#$&'(((('&$"    "##$$#"!  !"#$$##"                                                !!!!  !!!!    "$%&&&&%#"  "#%&&&&%$"    "%')*+,++*('%#!!#%'(*++,+*)'%"    $'*,.01110/.,*(&$"  "$&(*,./01110.,*'$   !$(+.1356776531/-+)'%$#"!!!!"#$%')+-/1356776531.+($!   $(,0368:<<<<;97531/-+*)((''(()*+-/13579;<<<<:8630,($   #'+047;=?ABBA@?=;9754210//////0124579;=?@ABBA?=;740+'#  !%*/37;?BDFGGGFECA@><;:9877777789:;<>@ACEFGGGFDB?;73/*%!  #(,16;?CFHJKLLKJIHFEDCBAAA@@@@AAABCDEFHIJKLLKJHFC?;61,(#   %*/49=BFILNOPPPOONMLLKKKKKKKKKKKKKKLLMNOOPPPONLIFB=94/*%   "&+05:?DHKNQRTTTTTTTTTTTUUVVVVVVUUTTTTTTTTTTTRQNKHD?:50+&"  #',16;@EIMPSUVWXYYZZ[\]^_`abbbba`_^]\[ZZYYXWVUSPMIE@;61,'#  $(-27ENWalwwlaWNE>82.*&#!  "&).3:AIS]htþth]SIA:3.)&"  "%*/6=EOYdp}}pdYOE=6/*%"  "&+29AKU`lxxl`UKA92+&"  #(.5=GQ\htth\QG=5.(#   %+2:CMXdp||pdXMC:2+%   "(/7@JU`lxxl`UJ@7/("   &-5>GR]iuui]RG>5-&    %,3GR]iuui]RG>5-&   "(/7@JU`lxxl`UJ@7/("   %+2:CMXdp||pdXMC:2+%   #(.5=GQ\htth\QG=5.(#  "&+29AKU`lxxl`UKA92+&"  "%*/6=EOYdp}}pdYOE=6/*%"  "&).3:AIS]htþth]SIA:3.)&"  !#&*.28>ENWalwwlaWNE>82.*&#!   "%'+.27<;:9877777789:;<>@ACEFGGGFDB?;73/*%!  #'+047;=?ABBA@?=;9754210//////0124579;=?@ABBA?=;740+'#   $(,0368:<<<<;97531/-+*)((''(()*+-/13579;<<<<:8630,($   !$(+.1356776531/-+)'%$#"!!!!"#$%')+-/1356776531.+($!   $'*,.01110/.,*(&$"  "$&(*,./01110.,*'$    "%')*+,++*('%#!!#%'(*++,+*)'%"    "$%&&&&%#"  "#%&&&&%$"    !!!!  !!!!                                            !""##""  ""##""!   "$&'(((('%$"  "$%'(((('&$"   !$')+-...-,+)'$"  "$')+,-...-+)'$!  #&*-/13444420.,*'%#  #%'*,.02444431/-*&#  #'+/2589;;;:9742/-*(&$"! !"$&(*-/2479:;;;9852/+'#  #',048;>@ABAA?=;8630.,*('&&&&'(*,.0368;=?AABA@>;840,'#  "&+059=ADFHHHGFDB?<97421/.----./12479CFJLNOONLKHFCA><:8765555678:<>ACFHKLNOONLJFC>94/*%   #(-38=CGKORSTUTSQOMJHFDBA@?>>>>?@ABDFHJMOQSTUTSROKGC=83-(#   %*06;AFKPTVYZZZYXVTRPNMKJIIHHHHIIJKMNPRTVXYZZZYVTPKFA;60*%   "'-28>DJOSWZ]^___^\[YXWVUTTTTTTTTTTUVWXY[\^___^]ZWSOJD>82-'"  $).4:@FLQVZ^`bcdccbba``___````````___``abbccdcb`^ZVQLF@:4.)$  !%*06CGLQUZ^chnszzsnhc^ZUQLGC>:51-)&#    "%(+/26:?CGLQUZ`ekrz¼zrke`ZUQLGC?:62/+(%"   !$&),/36:>BGKPV[bhpxüxphb[VPKGB>:63/,)&$!   "$'),/259=AFKPW]emvvme]WPKFA=952/,)'$"   !"$&(+.148<@EKQYajt~ù~tjaYQKE@<841.+(&$"!   !#%'),/26;@FLT\fp|ù|pf\TLF@;62/,)'%#!    !#%'*-15:@GOWalx·xlaWOG@:51-*'%#!    !#&),05;BJR]htth]RJB;50,)&#!   !$'+06=ENXco|Ż|ocXNE=60+'$!   #',18@IS^jwwj^SI@81,'#   #(-4BGKPV[bhpxüxphb[VPKGB>:63/,)&$!   "%(+/26:?CGLQUZ`ekrz¼zrke`ZUQLGC?:62/+(%"    #&)-15:>CGLQUZ^chnszzsnhc^ZUQLGC>:51-)&#    #'+/38=BFKPUY^bfjotyytojfb^YUPKFB=83/+'#    #'+05:?DJOTX]adhlosw||wsolhda]XTOJD?:50+'#    #',16;AFLQV[_cfilorux{{xurolifc_[VQLFA;61,'#   #',16DJOSWZ]^___^\[YXWVUTTTTTTTTTTUVWXY[\^___^]ZWSOJD>82-'"   %*06;AFKPTVYZZZYXVTRPNMKJIIHHHHIIJKMNPRTVXYZZZYVTPKFA;60*%   #(-38=CGKORSTUTSQOMJHFDBA@?>>>>?@ABDFHJMOQSTUTSROKGC=83-(#   %*/49>CFJLNOONLKHFCA><:8765555678:<>ACFHKLNOONLJFC>94/*%   "&+059=ADFHHHGFDB?<97421/.----./12479@ABAA?=;8630.,*('&&&&'(*,.0368;=?AABA@>;840,'#  #'+/2589;;;:9742/-*(&$"! !"$&(*-/2479:;;;9852/+'#  #&*-/13444420.,*'%#  #%'*,.02444431/-*&#  !$')+-...-,+)'$"  "$')+,-...-+)'$!   "$&'(((('%$"  "$%'(((('&$"   !""##""  ""##""!                                             !#$$$$#"!!"#$$$$#!    #%'()**)('%#!!#%'()**)('%#   #&)+-/0000.-+)&$!!$&)+-.0000/-+)&#   $(+/1467776531.+)&#!!#&)+.1356777641/+($   !%)-158;=>>>=<:741.+)&$"!  !"$&)+.147:<=>>>=;851-)%!  !%*/38;851.,)(&%%%%&(),.158;>ACEFFFDB?<83/*%!   $)/49>BFILMNNLKHEB?;8520.-,++,-.0258;?BEHKLNNMLIFB>94/)$   #(.39?DIMPSUUUTRPMJFC@<:7543333457:<@CFJMPRTUUUSPMID?93.(#  !&,28>DJOSWZ\]]\ZWUQNKGEB@>=<;;<=>@BEGKNQUWZ\]]\ZWSOJD>82,&!  $*/6ELSZ`fjnqstttsqpnmlkjjjjjjjjjjjjklmnpqstttsqnjf`ZSLE>81+&!  #(-39@GNU\bhlptvwxxxwwvvvvvvwwxxxxwwvvvvvvwwxxxwvtplhb\UNG@93-(#   %).4:AHOU\bhmquxz{||}}~~~~}}||{zxuqmhb\UOHA:4.)%   "&*/5;AHNU\bgmquxz|~~|zxuqmgb\UNHA;5/*&"   #'+05;AGMTZ`fkoswz}}zwsokf`ZTMGA;50+'#   !$(+05:?EKQW]chlquy||yuqlhc]WQKE?:50+($!  "%(,/48>CHNTY^dhmqvzzvqmhd^YTNHC>84/,(%"   "%(+/27;@EJOTZ_dhmrw}ý}wrmhd_ZTOJE@;72/+(%"   !#%(+.148=AFJOTY^chnszƾzsnhc^YTOJFA=841.+(%#!  !#%'*,/259=AEJNSX]bhov~ù~vohb]XSNJEA=952/,*'%#!  !#%&(*-/258<@DHLQW\cjrzǼzrjc\WQLHD@<852/-*(&%#!  !"$%'(*,.147:=AFKPV]dmvɽvmd]VPKFA=:741.,*('%$"!  !"#$%&()+-/148;?DIOV^gq|ɼ|qg^VOID?;841/-+)(&%$#"!   !"##$%&')*,/259>CIPXalwǺwlaXPIC>952/,*)'&%$##"!    !"""#$%&(*,/37=CJR\frörf\RJC=73/,*(&%$#"""!    !!"$%'*.27=DLValy˿ylaVLD=72.*'%$"!!    !#%)-28?GP[gtŹtg[PG?82-)%#!   !$(-3:BKVbo|ɿ|obVKB:3-($!  !$)/5=GQ]jwùwj]QG=5/)$!  !&+2:CMYesžseYMC:2+&!  #)/7@JVbo||obVJ@7/)#  !'-5>HS_lz½zl_SH>5-'!  !&,4=GR^kxxk^RG=4,&!  !&,4=GR^kxxk^RG=4,&!  !'-5>HS_lz½zl_SH>5-'!  #)/7@JVbo||obVJ@7/)#  !&+2:CMYesžseYMC:2+&!  !$)/5=GQ]jwùwj]QG=5/)$!  !$(-3:BKVbo|ɿ|obVKB:3-($!   !#%)-28?GP[gtŹtg[PG?82-)%#!    !!"$%'*.27=DLValy˿ylaVLD=72.*'%$"!!    !"""#$%&(*,/37=CJR\frörf\RJC=73/,*(&%$#"""!    !"##$%&')*,/259>CIPXalwǺwlaXPIC>952/,*)'&%$##"!   !"#$%&()+-/148;?DIOV^gq|ɼ|qg^VOID?;841/-+)(&%$#"!  !"$%'(*,.147:=AFKPV]dmvɽvmd]VPKFA=:741.,*('%$"!  !#%&(*-/258<@DHLQW\cjrzǼzrjc\WQLHD@<852/-*(&%#!  !#%'*,/259=AEJNSX]bhov~ù~vohb]XSNJEA=952/,*'%#!  !#%(+.148=AFJOTY^chnszƾzsnhc^YTOJFA=841.+(%#!   "%(+/27;@EJOTZ_dhmrw}ý}wrmhd_ZTOJE@;72/+(%"   "%(,/48>CHNTY^dhmqvzzvqmhd^YTNHC>84/,(%"  !$(+05:?EKQW]chlquy||yuqlhc]WQKE?:50+($!   #'+05;AGMTZ`fkoswz}}zwsokf`ZTMGA;50+'#   "&*/5;AHNU\bgmquxz|~~|zxuqmgb\UNHA;5/*&"   %).4:AHOU\bhmquxz{||}}~~~~}}||{zxuqmhb\UOHA:4.)%   #(-39@GNU\bhlptvwxxxwwvvvvvvwwxxxxwwvvvvvvwwxxxwvtplhb\UNG@93-(#  !&+18>ELSZ`fjnqstttsqpnmlkjjjjjjjjjjjjklmnpqstttsqnjf`ZSLE>81+&!  $)/5DJOSWZ\]]\ZWUQNKGEB@>=<;;<=>@BEGKNQUWZ\]]\ZWSOJD>82,&!  #(.39?DIMPSUUUTRPMJFC@<:7543333457:<@CFJMPRTUUUSPMID?93.(#   $)/49>BFILMNNLKHEB?;8520.-,++,-.0258;?BEHKLNNMLIFB>94/)$   !%*/38;851.,)(&%%%%&(),.158;>ACEFFFDB?<83/*%!  !%)-158;=>>>=<:741.+)&$"!  !"$&)+.147:<=>>>=;851-)%!   $(+/1467776531.+)&#!!#&)+.1356777641/+($   #&)+-/0000.-+)&$!!$&)+-.0000/-+)&#   #%'()**)('%#!!#%'()**)('%#    !#$$$$#"!!"#$$$$#!                                                   "#%%&%%$"!!"$%%&%%#"   !#&()++++*)'%#!!#%')*++++)(&#!   #&),.012210/-*(%#  #%(*-/012210.,)&#   !%),035799987530-*'%"  "%'*-035789997530,)%!  "&*/37:=?@AA@><:730-*'$"!  !"$'*-037:<>@AA@?=:73/*&"  "&+05:>BEGIIIHFDA=:63/,*'&$$$$&'*,/36:=ADFHIIIGEB>:50+&"  !&,17EMT\dlsyysld\TME>71,'#  !%).39?FMT\dkrx~~xrkd\TMF?93.)%!   #'+/49?FLT[bipv||vpib[TLF?94/+'#   "%(,05:?EKRX_fmsx}}xsmf_XRKE?:50,(%"  !$'*-159>CIOU\bhnsy~¼~ysnhb\UOIC>951-*'$!   #%(+.159=AGLQW]chnsx}Ž}xsnhc]WQLGA=951.+(%#   !$&)+.147;?CHMRW\bglqw|ú|wqlgb\WRMHC?;741.+)&$!   "%'),.0369<@DHLQV[`ejpv}Ƚ}vpje`[VQLHD@<9630.,)'%"   !#%(*,.02469BFLRYbkvǹvkbYRLFB>:75310..-,+*)('%#!  !#$&'())**++,-./147;?DKR[do|ô|od[RKD?;741/.-,++**))('&$#!   "$%&'''(((((()*,.149>DKT^iu̾ui^TKD>941.,*)(((((('''&%$"   !"$%%&&%%%%$%%&')+.38>ENXco}Ƹ}ocXNE>83.+)'&%%$%%%%&&%%$"!   !"#$$$##""!!!"#$&)-28?HR]iw̿wi]RH?82-)&$#"!!!""##$$$#"!    !""""!!  "%).3;CMXdqŹqdXMC;3.)%"  !!""""!    !!!! "%*07?HS_lzʿzl_SH?70*%" !!!!    #'-3ENXco}Ƹ}ocXNE>83.+)'&%%$%%%%&&%%$"!   "$%&'''(((((()*,.149>DKT^iu̾ui^TKD>941.,*)(((((('''&%$"   !#$&'())**++,-./147;?DKR[do|ô|od[RKD?;741/.-,++**))('&$#!  !#%'()*+,-..01357:>BFLRYbkvǹvkbYRLFB>:75310..-,+*)('%#!  !#&')*,-./12468;=AEINSZair|ʼ|riaZSNIEA=;86421/.-,*)'&#!  !#&(*+-.02468:=@DHLPU[ahpx˾xpha[UPLHD@=:86420.-+*(&#!  !#%(*,.02469CIOU\bhnsy~¼~ysnhb\UOIC>951-*'$!  "%(,05:?EKRX_fmsx}}xsmf_XRKE?:50,(%"   #'+/49?FLT[bipv||vpib[TLF?94/+'#   !%).39?FMT\dkrx~~xrkd\TMF?93.)%!  #',17>EMT\dlsyysld\TME>71,'#  !%*06BEGIIIHFDA=:63/,*'&$$$$&'*,/36:=ADFHIIIGEB>:50+&"  "&*/37:=?@AA@><:730-*'$"!  !"$'*-037:<>@AA@?=:73/*&"  !%),035799987530-*'%"  "%'*-035789997530,)%!   #&),.012210/-*(%#  #%(*-/012210.,)&#   !#&()++++*)'%#!!#%')*++++)(&#!   "#%%&%%$"!!"$%%&%%#"                                                  !"""!!  !!"""!    "$%&'''&%#"  "#%&'''&%$"   !#&(*+,--,+*(&$!!$&(*+,--,+*(&#!  #&),/1233321/-*(%#  #%(*-/1233321/,)&#  !%)-0368:;;:9752/,)'$!!$'),/2579:;;:8630-)%!  "&+/48;>ABCCBA><952.+(%#! !#%(+.259<>ABCCBA>;84/+&"  "',16;@DGIKLLKIFC@<841-*(&%$$%&(*-148<@CFIKLLKIGD@;61,'"  "'-28>CHMPSUUUTROKGC?;730-+*))*+-037;?CGKORTUUUSPMHC>82-'"  !&,29?EKQVZ]^__][XTPKFB>:6310//0136:>BFKPTX[]__^]ZVQKE?92,&!   %+28?FMTZ_cfhiigea]XSOJEA>;876678;>AEJOSX]aegiihfc_ZTMF?82+%   $)07>FMU\bhmprssqnkfa\WRNJFCA????ACFJNRW\afknqssrpmhb\UMF>70)$  "'.5DKRYaiqyyqiaYRKD>84/+'$!   #'*-15:?DJQX_gnv}ÿ}vng_XQJD?:51-*'#    #&),/37;?DJPV\cjqx~ý~xqjc\VPJD?;73/,)&#   "%(+.148;?DHMSY_ekrx}û}xrke_YSMHD?;841.+(%"   #&*-0258;?BFKOTZ_ekpv{Ǿ{vpke_ZTOKFB?;8520-*&#   !%(+.1368;>ADHKPTY^chmsx~ʿ~xsmhc^YTPKHDA>;8631.+(%!  "&),/1468:@BEHKOSW\afms{ʽ{smfa\WSOKHEB@><;97641/,*&#    #'*-/135678:;<>@BDGKOSX]dks|Ⱥ|skd]XSOKGDB@><;:876531/-*'#    #'*,/1245567789:<>@CFJOU[bkuĵukb[UOJFC@><:9877655421/,*'#    #&),.01233444445689DKT^jwwj^TKD>951/.,,,,--..///.-+)'$"  !#&(*+,--,,+*))((()*,/38>ENXcp~ɻ~pcXNE>83/,*)((())*+,,--,+*(&#!   "%')*+++**)(&%%$$$%'*.28?HR]jx´xj]RH?82.*'%$$$%%&()**+++*)'%"   !$&')))))('%$#"!!!"#&).4;CMYesɼseYMC;4.)&#"!!!"#$%'()))))'&$!  !#%&'((('&%$"! !#&+07@JUao}÷}oaUJ@70+&#! !"$%&'((('&%#!   "$&''''&%$"! !$).5=GR^lzzl^RG=5.)$! !"$%&''''&$"    "$%&''&&%#"  #(-4ENXcp~ɻ~pcXNE>83/,*)((())*+,,--,+*(&#!  "$')+-.///..--,,,,./159>DKT^jwwj^TKD>951/.,,,,--..///.-+)'$"  "%(+-.001111000012358;?EKS[eq~ȹ~qe[SKE?;853210000111100.-+(%"   #&),.01233444445689@CFJOU[bkuĵukb[UOJFC@><:9877655421/,*'#    #'*-/135678:;<>@BDGKOSX]dks|Ⱥ|skd]XSOKGDB@><;:876531/-*'#    #&*,/14679;<>@BEHKOSW\afms{ʽ{smfa\WSOKHEB@><;97641/,*&#   "&),/1468:ADHKPTY^chmsx~ʿ~xsmhc^YTPKHDA>;8631.+(%!   #&*-0258;?BFKOTZ_ekpv{Ǿ{vpke_ZTOKFB?;8520-*&#   "%(+.148;?DHMSY_ekrx}û}xrke_YSMHD?;841.+(%"   #&),/37;?DJPV\cjqx~ý~xqjc\VPJD?;73/,)&#    #'*-15:?DJQX_gnv}ÿ}vng_XQJD?:51-*'#   !$'+/48>DKRYaiqyyqiaYRKD>84/+'$!  !%)-17FMU\bhmprssqnkfa\WRNJFCA????ACFJNRW\afknqssrpmhb\UMF>70)$   %+28?FMTZ_cfhiigea]XSOJEA>;876678;>AEJOSX]aegiihfc_ZTMF?82+%   !&,29?EKQVZ]^__][XTPKFB>:6310//0136:>BFKPTX[]__^]ZVQKE?92,&!  "'-28>CHMPSUUUTROKGC?;730-+*))*+-037;?CGKORTUUUSPMHC>82-'"  "',16;@DGIKLLKIFC@<841-*(&%$$%&(*-148<@CFIKLLKIGD@;61,'"  "&+/48;>ABCCBA><952.+(%#! !#%(+.259<>ABCCBA>;84/+&"  !%)-0368:;;:9752/,)'$!!$'),/2579:;;:8630-)%!  #&),/1233321/-*(%#  #%(*-/1233321/,)&#  !#&(*+,--,+*(&$!!$&(*+,--,+*(&#!   "$%&'''&%#"  "#%&'''&%$"    !"""!!  !!"""!                                                 !#$$$$$#"  "#$$$$$#!   !#%'())))('%#"  "#%'())))('%#!   #&)+,../..,+)'%"  "%')+,../..,+)&#   "&),/134554320-+(&#!!#&(+-023455431/,)&"   $(,0369;<<<;:852/,)'$"  "$'),/258:;<<<;9630,($   !&*/48;?ACDDDCA>;841.*(%#"!!"#%(*.148;>ACDDDCA?;84/*&!  "',16;@DHJLMMMKIFB>:62/,)'&%%&'),/26:>BFIKMMMLJHD@;61,'"  "'-38>DINQTVWWVTQNJEA<841.,*))*,.14883-'"  !'-3:@GMSX\_abb`^[WRMHC?:631/../136:?CHMRW[^`bba_\XSMG@:3-'!   &,3:AHOV\bfjlmlkhd`[VPKFA=:765567:=AFKPV[`dhklmljfb\VOHA:3,&   %+19@HPX`flquwxwvsojd_YSNIEA?=<<=?AEINSY_djosvwxwuqlf`XPH@91+%  #)07?GPXaipv|}ytnhb\WRNJGFEEFGJNRW\bhnty}|vpiaXPG?70)#  "'-5FOYcmw{vrnkiggggiknrv{wmcYOF>6/)$  #'-3:BKT^hr|~{xwuuuuwx{~|rh^TKB:3-'#  "&+17>FOXblvvlbXOF>71+&"  !%*/4:AIR[eoyyoe[RIA:4/*%!  !%)-28>DLT]gpzzpg]TLD>82-)%!  !%(,15;@GNV^gqzzqg^VNG@;51,(%!  !%(,048=CIPW_gpyypg_WPIC=840,(%!  !$(+/37;@EJPW^fnv~¿~vnf^WPJE@;73/+($!   #'+.26:>BFKQV]dkrzĿzrkd]VQKFB>:62.+'#   "&)-158?@ABBBCDEFHJMPTX^dkt};}tkd^XTPMJHFEDCBBBA@?><:740,($   #(,/369;=>>????>>??ABDGKOT[bkuǸukb[TOKGDBA??>>????>>=;963/,(#  #'+.2579;<<<<;;:999:;=?BFLRYblxxlbYRLFB?=;:999:;;<<<<;9752.+'#  "&*-13689::998765444568;?DJQZdp}ɹ}pdZQJD?;865444567899::98631-*&"  !%),/2467777653210///0248=CJS]iv²vi]SJC=8420///0123567777642/,)%!   $'+.0245554320/-,+**+,/27=DMWbo}ɻ}obWMD=72/,+**+,-/0234555420.+'$   #&*-/1233321/.,*)''&'(*.28?HR]jxôxj]RH?82.*('&'')*,./1233321/-*&#  "%)+.012210/-,*(&%$#$%'*/4;DMYesʽseYMD;4/*'%$#$%&(*,-/012210.+)%"  "%(+-/0110/.,*(&$#"!"#%(,29AKVbpƹpbVKA92,(%#"!"#$&(*,./0110/-+(%"  !%(*-.0000/-+*'%$"! !"$'+07@ITan}ĸ}naTI@70+'$"! !"$%'*+-/0000.-*(%!  !%(*-.0000/-+*'%$"! !"$'+07@ITan}ĸ}naTI@70+'$"! !"$%'*+-/0000.-*(%!  "%(+-/0110/.,*(&$#"!"#%(,29AKVbpƹpbVKA92,(%#"!"#$&(*,./0110/-+(%"  "%)+.012210/-,*(&%$#$%'*/4;DMYesʽseYMD;4/*'%$#$%&(*,-/012210.+)%"  #&*-/1233321/.,*)''&'(*.28?HR]jxôxj]RH?82.*('&'')*,./1233321/-*&#   $'+.0245554320/-,+**+,/27=DMWbo}ɻ}obWMD=72/,+**+,-/0234555420.+'$   !%),/2467777653210///0248=CJS]iv²vi]SJC=8420///0123567777642/,)%!  "&*-13689::998765444568;?DJQZdp}ɹ}pdZQJD?;865444567899::98631-*&"  #'+.2579;<<<<;;:999:;=?BFLRYblxxlbYRLFB?=;:999:;;<<<<;9752.+'#  #(,/369;=>>????>>??ABDGKOT[bkuǸukb[TOKGDBA??>>????>>=;963/,(#   $(,047:<>?@ABBBCDEFHJMPTX^dkt};}tkd^XTPMJHFEDCBBBA@?><:740,($   $(,047:=?ABCDEFHIKMORUY]bhnu}õ}unhb]YUROMKIHFEDCBA?=:740,($  #',037:=?BCEGHJLNQTWZ^cglrxǺxrlgc^ZWTQNLJHGECB?=:730,'#  "'+/36:=?BDFIKNPSW[_chlqw|ʾ|wqlhc_[WSPNKIFDB?=:63/+'"  !%)-158BFKQV]dkrzĿzrkd]VQKFB>:62.+'#   !$(+/37;@EJPW^fnv~¿~vnf^WPJE@;73/+($!  !%(,048=CIPW_gpyypg_WPIC=840,(%!  !%(,15;@GNV^gqzzqg^VNG@;51,(%!  !%)-28>DLT]gpzzpg]TLD>82-)%!  !%*/4:AIR[eoyyoe[RIA:4/*%!  "&+17>FOXblvvlbXOF>71+&"  #'-3:BKT^hr|~{xwuuuuwx{~|rh^TKB:3-'#  $)/6>FOYcmw{vrnkiggggiknrv{wmcYOF>6/)$   %+29AJT]gpy|vpkfb_][ZZ[]_bfkpv|ypg]TJA92+%   "'-5DINQTVWWVTQNJEA<841.,*))*,.14883-'"  "',16;@DHJLMMMKIFB>:62/,)'&%%&'),/26:>BFIKMMMLJHD@;61,'"  !&*/48;?ACDDDCA>;841.*(%#"!!"#%(*.148;>ACDDDCA?;84/*&!   $(,0369;<<<;:852/,)'$"  "$'),/258:;<<<;9630,($   "&),/134554320-+(&#!!#&(+-023455431/,)&"   #&)+,../..,+)'%"  "%')+,../..,+)&#   !#%'())))('%#"  "#%'())))('%#!   !#$$$$$#"  "#$$$$$#!                                                   "#$$$##"  "##$$$#"   !#%&'((''&%#"  "#%&''(('&%#!  !$&(*+,,,,+)(&$"!!"$&()+,,,,+*(&$!   #&)+./11110/-+)'%#!  !#%')+-/01111/.+)&#   "%),/2467776531/,*'%#"! !"#%'*,/1356777642/,)%"  #(,0369;=>>><;9630-*(&$#""#$&(*-0369;<>>>=;9630,(#   %).37;?BDEFFECA>;841.+)'%%%%')+.148;>ACEFFEDB?;73.)%   !&+06;@DHKMNOOMKHEA=952/,*(''(*,/259=AEHKMOONMKHD@;60+&!  !&,28>CINRUWYYXVTPLHD?;630-,++,-036;?DHLPTVXYYWURNIC>82,&!  !&,39@FMSX\`bccb`]YTPJE@<8520//0258<@EJPTY]`bccb`\XSMF@93,&!   &,3:AHPW]chknoomkgb]XRLGB>:754457:>BGLRX]bgkmoonkhc]WPHA:3,&   %+29AIQYahntwz{{yvrlgaZTOIEA><;;<>AEIOTZaglrvy{{zwtnhaYQIA92+%  #*08@IQZclsz|wqjd]WQLHECBBCEHLQW]djqw|zslcZQI@80*#  "(/6>GPZcmv~{tmg`ZUQNLKKLNQUZ`gmt{~vmcZPG>6/("  !&-4FPZep{{vspnmmnpsv{{peZPF>6/)$    $(.4;CKU_ju~|{{|~uj_UKC;4.($    $(-28?GPYdozzodYPG?82-($    $(,17=DKT]gr}}rg]TKD=71,($   !$(,16;AHOW`jt¾tj`WOHA;61,($!  !$(,05:?EKRZclvvlcZRKE?:50,($!   $(,059>CHNU\dlvvld\UNHC>950,($    $(,049=BFKQW]dlt}}tld]WQKFB=940,($   "'+/48BFJNQUY]afkpv|ſ|vpkfa]YUQNJFB>:51,'"  $).38<@DHLORUX[^bfjotyºytojfb^[XUROLHD@<83.)$   %*/49>BFIMORTVY[^adhlpty~Ƚ~ytplhda^[YVTROMIFB>94/*%   !&+05:?CGJMOQSTVWY[]`cfjnsx}÷}xsnjfc`][YWVTSQOMJGC?:50+&!  "',16;?CGJLNPQRRSTUWXZ]`dhlrx~˽~xrlhd`]ZXWUTSRRQPNLJGC?;61,'"  "',16;?CFIKMNOOOOOOPQRTVY]agmt|Ŷ|tmga]YVTRQPOOOOOONMKIFC?;61,'"  !&+05:>BEHJKLLLKJJIIIJKMPSW\bir|;|rib\WSPMKJIIIJJKLLLKJHEB>:50+&!  !&+049=ADFHIIIHGFEDCCCCEGJMRX`hr~ƶ~rh`XRMJGECCCCDEFGHIIIHFDA=940+&!   %*/38<:876668:=BHOXbmzƷzmbXOHB=:866678:<>@ABCCCB@=:62-)$  #(,058;>@AAA@><:8642101247;AHQ[fsͿsf[QHA;7421012468:<>@AAA@>;850,(#  "'+/37:<>??>=;97520.-,,-/26??><:73/+'"  !&*.258:<==<;97520-+*)))+.28>GQ\ivvi\QG>82.+)))*+-02579;<==<:852.*&!  !%)-1479;<<;:8630.+)('&')+/5GQ\ivvi\QG>82.+)))*+-02579;<==<:852.*&!  "'+/37:<>??>=;97520.-,,-/26??><:73/+'"  #(,058;>@AAA@><:8642101247;AHQ[fsͿsf[QHA;7421012468:<>@AAA@>;850,(#  $)-26:=@BCCCBA@><:876668:=BHOXbmzƷzmbXOHB=:866678:<>@ABCCCB@=:62-)$   %*/38BEHJKLLLKJJIIIJKMPSW\bir|;|rib\WSPMKJIIIJJKLLLKJHEB>:50+&!  "',16;?CFIKMNOOOOOOPQRTVY]agmt|Ŷ|tmga]YVTRQPOOOOOONMKIFC?;61,'"  "',16;?CGJLNPQRRSTUWXZ]`dhlrx~˽~xrlhd`]ZXWUTSRRQPNLJGC?;61,'"  !&+05:?CGJMOQSTVWY[]`cfjnsx}÷}xsnjfc`][YWVTSQOMJGC?:50+&!   %*/49>BFIMORTVY[^adhlpty~Ƚ~ytplhda^[YVTROMIFB>94/*%   $).38<@DHLORUX[^bfjotyºytojfb^[XUROLHD@<83.)$  "',15:>BFJNQUY]afkpv|ſ|vpkfa]YUQNJFB>:51,'"   %).37;@DHLPTY^ciou|¾|uoic^YTPLHD@;73.)%   "'+/48CHNU\dlvvld\UNHC>950,($   !$(,05:?EKRZclvvlcZRKE?:50,($!  !$(,16;AHOW`jt¾tj`WOHA;61,($!   $(,17=DKT]gr}}rg]TKD=71,($    $(-28?GPYdozzodYPG?82-($    $(.4;CKU_ju~|{{|~uj_UKC;4.($    $)/6>FPZep{{vspnmmnpsv{{peZPF>6/)$    %+19AJT^it~{uojfca``acfjou{~ti^TJA91+%   !&-4GPZcmv~{tmg`ZUQNLKKLNQUZ`gmt{~vmcZPG>6/("  #*08@IQZclsz|wqjd]WQLHECBBCEHLQW]djqw|zslcZQI@80*#  %+29AIQYahntwz{{yvrlgaZTOIEA><;;<>AEIOTZaglrvy{{zwtnhaYQIA92+%   &,3:AHPW]chknoomkgb]XRLGB>:754457:>BGLRX]bgkmoonkhc]WPHA:3,&   !&,39@FMSX\`bccb`]YTPJE@<8520//0258<@EJPTY]`bccb`\XSMF@93,&!  !&,28>CINRUWYYXVTPLHD?;630-,++,-036;?DHLPTVXYYWURNIC>82,&!  !&+06;@DHKMNOOMKHEA=952/,*(''(*,/259=AEHKMOONMKHD@;60+&!   %).37;?BDEFFECA>;841.+)'%%%%')+.148;>ACEFFEDB?;73.)%   #(,0369;=>>><;9630-*(&$#""#$&(*-0369;<>>>=;9630,(#  "%),/2467776531/,*'%#"! !"#%'*,/1356777642/,)%"   #&)+./11110/-+)'%#!  !#%')+-/01111/.+)&#   !$&(*+,,,,+)(&$"!!"$&()+,,,,+*(&$!  !#%&'((''&%#"  "#%&''(('&%#!   "#$$$##"  "##$$$#"                                            !!!!  !!!!   !"$$%$$#"!  !"#$$%$$"!  !#%&'(((''%$#!  !#$%''((('&%#!   #%')+,,,,+*('%$"!! !!"$%'(*+,,,,+)'%#   "%'*,./0000.-+*(&%#""""#%&(*+-.0000/.,*'%"   #'*-/234555420.,*('%$$$$%'(*,.024555432/-*'#   !%),03689:;::8642/-+)'&%%&')+-/2468::;:98630,)%!  "'+/37:=?@AA@?=;8520-+)(''()+-0258;=?@AA@?=:73/+'"  #(-26;?BEGHHHGEC@=9630-+*))*+-0369=@CEGHHHGEB?;62-(#  $)/49?CGKNPQQPNLIEB>:630.,,,,.036:>BEILNPQQPNKGC?94/)$   %*06:631/../136:>CGLPSVYZZYXUQMHB<60*%   %+18>ELRW\`cdedb_\WSNHC?;74322347;?CHNSW\_bdedc`\WRLE>81+%  %+18@GOV]chlnppomie`ZUOID@<976679<@DIOUZ`eimoppnlhc]VOG@81+%  $*18@HQYahotx{||{xtoic]VPJEA><;;<>AEJPV]ciotx{||{xtohaYQH@81*$  #)07@HQ[dlt{ysle^XRLHDBAABDHLRX^elsy{tld[QH@70)#  "(/6>GQ[dnw}vng`ZTOLIHHILOTZ`gnv}wnd[QG>6/("  !'-4DIPW^gpz¹zpg^WPID>950,'#  #',05:?DINT[bir{ž{rib[TNID?:50,'#  !&+05:?CHMSX^dks{ſ{skd^XSMHC?:50+&!   $)/49>CHMRV[`flry½yrlf`[VRMHC>94/)$   "',27=BGLQUY^bglqw~~wqlgb^YUQLGB=72,'"  $*/5;@FKOTX\`cgkptyĿytpkgc`\XTOKF@;5/*$  !&,17=CHMRVZ^adgjmqty}ü}ytqmjgda^ZVRMHC=71,&!  "'-39?EJOTX[^acegjloruy}ż}yuroljgeca^[XTOJE?93-'"  #(.4:AFLQUY\^`bcdfgikmpsvz~ɾ~zvspmkigfdcb`^\YUQLFA:4.(#  #)/5;AGLQUY[^_`aaabbcdfhknrv{ö{vrnkhfdcbbaaa`_^[YUQLGA;5/)#  #)/5;AGLQUXZ\]]]]\\\\\]^`cfjou{ɻ{uojfc`^]\\\\\]]]]\ZXUQLGA;5/)#  #).5;AFKPSVXZZZZYXVUTTTUVX[_cipx³xpic_[XVUTTTUVXYZZZZXVSPKFA;5.)#  "(.4:?EJNRTVWWWVTSQONMLLMNQTY^enwɹwne^YTQNMLLMNOQSTVWWWVTRNJE?:4.("  "'-38>CHLORSTTSRPNKIGFEDDFHKOU\dnyynd\UOKHFDDEFGIKNPRSTTSROLHC>83-'"  !&,17==>@CGLS[ep}ȹ}pe[SLGC@>==>?ADGILNPQQQOMJFA<71,&!   %*05;@DHKMNNNLJHEB?<:87779<@ELT^ivvi^TLE@<97778:BFHJKLKIGEB>;86422236:?FNXco}Ⱥ}ocXNF?:63222468;>BEGIKLKJHFB>94/)$  #(.38<@DGHIIIGEB?<8520/../25;AIS^jx´xj^SIA;52/../0258FP[gu˾ug[PF>82/-++,.036:=@CEGHHGEC?;72-(#  "',16;?BEFGGFEB?<952/-+**+-16FP[gu˾ug[PF>82/-++,.036:=@CEGHHGEC?;72-(#  #(.38<@DGHIIIGEB?<8520/../25;AIS^jx´xj^SIA;52/../0258BFHJKLKIGEB>;86422236:?FNXco}Ⱥ}ocXNF?:63222468;>BEGIKLKJHFB>94/)$   %*05;@DHKMNNNLJHEB?<:87779<@ELT^ivvi^TLE@<97778:==>@CGLS[ep}ȹ}pe[SLGC@>==>?ADGILNPQQQOMJFA<71,&!  "'-38>CHLORSTTSRPNKIGFEDDFHKOU\dnyynd\UOKHFDDEFGIKNPRSTTSROLHC>83-'"  "(.4:?EJNRTVWWWVTSQONMLLMNQTY^enwɹwne^YTQNMLLMNOQSTVWWWVTRNJE?:4.("  #).5;AFKPSVXZZZZYXVUTTTUVX[_cipx³xpic_[XVUTTTUVXYZZZZXVSPKFA;5.)#  #)/5;AGLQUXZ\]]]]\\\\\]^`cfjou{ɻ{uojfc`^]\\\\\]]]]\ZXUQLGA;5/)#  #)/5;AGLQUY[^_`aaabbcdfhknrv{ö{vrnkhfdcbbaaa`_^[YUQLGA;5/)#  #(.4:AFLQUY\^`bcdfgikmpsvz~ɾ~zvspmkigfdcb`^\YUQLFA:4.(#  "'-39?EJOTX[^acegjloruy}ż}yuroljgeca^[XTOJE?93-'"  !&,17=CHMRVZ^adgjmqty}ü}ytqmjgda^ZVRMHC=71,&!  $*/5;@FKOTX\`cgkptyĿytpkgc`\XTOKF@;5/*$  "',27=BGLQUY^bglqw~~wqlgb^YUQLGB=72,'"   $)/49>CHMRV[`flry½yrlf`[VRMHC>94/)$   !&+05:?CHMSX^dks{ſ{skd^XSMHC?:50+&!  #',05:?DINT[bir{ž{rib[TNID?:50,'#  #',059>DIPW^gpz¹zpg^WPID>950,'#  #'+049?DKRZcmwúwmcZRKD?940+'#  "&*/49?FMV_itýùti_VMF?94/*&"  "&*/4:AHQZep|ǿ|peZQHA:4/*&"  !%*/5;CKU_jvºvj_UKC;5/*%!   %*06=FOYdp|~yvtsstvy~ÿ|pdYOF=60*%    %*18@IS^iu~xrmjgffgjmrx~ui^SI@81*%   !&,2:CLValx{smgb^\[[\^bgms{xlaVLC:2,&!  !'-4GQ[dnw}vng`ZTOLIHHILOTZ`gnv}wnd[QG>6/("  #)07@HQ[dlt{ysle^XRLHDBAABDHLRX^elsy{tld[QH@70)#  $*18@HQYahotx{||{xtoic]VPJEA><;;<>AEJPV]ciotx{||{xtohaYQH@81*$  %+18@GOV]chlnppomie`ZUOID@<976679<@DIOUZ`eimoppnlhc]VOG@81+%  %+18>ELRW\`cdedb_\WSNHC?;74322347;?CHNSW\_bdedc`\WRLE>81+%   %*06:631/../136:>CGLPSVYZZYXUQMHB<60*%   $)/49?CGKNPQQPNLIEB>:630.,,,,.036:>BEILNPQQPNKGC?94/)$  #(-26;?BEGHHHGEC@=9630-+*))*+-0369=@CEGHHHGEB?;62-(#  "'+/37:=?@AA@?=;8520-+)(''()+-0258;=?@AA@?=:73/+'"  !%),03689:;::8642/-+)'&%%&')+-/2468::;:98630,)%!   #'*-/234555420.,*('%$$$$%'(*,.024555432/-*'#   "%'*,./0000.-+*(&%#""""#%&(*+-.0000/.,*'%"   #%')+,,,,+*('%$"!! !!"$%'(*+,,,,+)'%#   !#%&'(((''%$#!  !#$%''((('&%#!  !"$$%$$#"!  !"#$$%$$"!   !!!!  !!!!                                     !!!!  !!!!    "#$%%%$$#"!  !"#$$%%%$#"    "$&'()))('&%$#"!!!!"#$%&'()))('&$"   !$&(*,----,+)('%$$##$$%'()+,----,*(&$!  "%(*-/011110.-+*('&&&&'(*+-.011110/-*(%"  #&)-/2356655320.,+)(((()+,.0235566532/-)&#   $'+/2579::::97531/-,+**+,-/13579::::9752/+'$    %)-148;=>?@?>=;8641/.,,,,./1468;=>?@?>=;841-)%   !&*/37;>ACEEEDCA?<96410....01469;73/*&!  "',16:?CFIKLLKJHFC@<96420//02469<@CFHJKLLKIFC?:61,'"  #(-38=BGKNQSSSRPNKGD@<9642112469<@DGKNPRSSSQNKGB=83-(#  #(.4:@FLQUXZ\\\ZWTQLHD@<96433469<@DHLQTWZ\\\ZXUQLF@:4.(#  #)/5EMT[agknpqqolhc^XSMHC?<:99:6/)#  "(/6>FOW_fmsx{}}|zvqlf_YSMHD@>==>@DHMSY_flqvz|}}{xsmf_WOF>6/("  "(.6>GPYbksz|ung`YSNIECBBCEINSY`gnu|zskbYPG>6.("  !'-5=FPYcmwxphaZTOKIGGIKOTZahpxwmcYPF=5-'!   &,4GQ\gs»ysomkkmosysg\QG>70*%   !%*06=ENXco{ƾ|yxxy|ù{ocXNE=60*%!  "&+05CINU[cks}}skc[UNIC>93.*%   $).49>DIOTZagowǽwogaZTOID>94.)$  #(-39>DJOUZ`elryyrle`ZUOJD>93-(#   &+17=CIOUZ_djou{{uojd_ZUOIC=71+&   #)/5;BHNTZ_dhmqv{½{vqmhd_ZTNHB;5/)#   %+28?FLRX^cgkosw{¿{wsokgc^XRLF?82+%   !'-4;BIPV\afjnqtwy||ywtqnjfa\VPIB;4-'!  "(/6=DKRX^chloqtuwy{}û}{ywutqolhc^XRKD=6/("  #)07>FMTZ`eiloqrstuvwxz|ù|zxwvutsrqolie`ZTMF>70)#  $*18?FNT[`eilnppqpppppqrtvy|ƺ|yvtrqpppppqppnlie`[TNF?81*$  $*18?GNT[`ehkmmnmlkjihhhijlorw|˾|wroljihhhijklmnmmkhe`[TNG?81*$  #*07?FMSZ_cfijkjihfdb`____acfjov}õ}vojfca____`bdfhijkjifc_ZSMF?70*#  #)07>ELRX]adfggfec`^[YWVUUVX[_djr{ɺ{rjd_[XVUUVWY[^`cefggfda]XRLE>70)#  "(/5==>@CHNV`jwͿwj`VNHC@>==>@CFJMQUXZ\]][YUQLF@93,&    %+18>DJOSVYZZYWTQMIEA>;9778:=BHPYdp}Ƹ}pdYPHB=:8779;>AEIMQTWYZZYVSOJD>81+%   $*06=BHMQTVWWVTRNJFB>:7533358=CKT_kxxk_TKC=8533357:>BFJNRTVWWVTQMHB=60*$  $)/5;AGKOSUVVTRPLHD@;85200025:@HQ[guɽug[QH@:52000258;@DHLPRTVVUSOKGA;5/)$  #)/5;AFKORTUUTQOKGC>:631/./148>FOZfsǻsfZOF>841/./136:>CGKOQTUUTROKFA;5/)#  #)/5;AFKORTUUTQOKGC>:631/./148>FOZfsǻsfZOF>841/./136:>CGKOQTUUTROKFA;5/)#  $)/5;AGKOSUVVTRPLHD@;85200025:@HQ[guɽug[QH@:52000258;@DHLPRTVVUSOKGA;5/)$  $*06=BHMQTVWWVTRNJFB>:7533358=CKT_kxxk_TKC=8533357:>BFJNRTVWWVTQMHB=60*$   %+18>DJOSVYZZYWTQMIEA>;9778:=BHPYdp}Ƹ}pdYPHB=:8779;>AEIMQTWYZZYVSOJD>81+%    &,39@FLQUY[]]\ZXUQMJFC@>==>@CHNV`jwͿwj`VNHC@>==>@CFJMQUXZ\]][YUQLF@93,&   !'-4;AHNSX\^```^\YVROKIFEDDEGKPV^hr~Ǹ~rh^VPKGEDDEFIKORVY\^```^\XSNHA;4-'!  "(/5ELRX]adfggfec`^[YWVUUVX[_djr{ɺ{rjd_[XVUUVWY[^`cefggfda]XRLE>70)#  #*07?FMSZ_cfijkjihfdb`____acfjov}õ}vojfca____`bdfhijkjifc_ZSMF?70*#  $*18?GNT[`ehkmmnmlkjihhhijlorw|˾|wroljihhhijklmnmmkhe`[TNG?81*$  $*18?FNT[`eilnppqpppppqrtvy|ƺ|yvtrqpppppqppnlie`[TNF?81*$  #)07>FMTZ`eiloqrstuvwxz|ù|zxwvutsrqolie`ZTMF>70)#  "(/6=DKRX^chloqtuwy{}û}{ywutqolhc^XRKD=6/("  !'-4;BIPV\afjnqtwy||ywtqnjfa\VPIB;4-'!   %+28?FLRX^cgkosw{¿{wsokgc^XRLF?82+%   #)/5;BHNTZ_dhmqv{½{vqmhd_ZTNHB;5/)#   &+17=CIOUZ_djou{{uojd_ZUOIC=71+&   #(-39>DJOUZ`elryyrle`ZUOJD>93-(#  $).49>DIOTZagowǽwogaZTOID>94.)$   %*.39>CINU[cks}}skc[UNIC>93.*%   !%).38=BHOV]fozzof]VOHB=83.)%!   $)-27GQ\gs»ysomkkmosysg\QG>70*%    %*18AJT_kw|unidb``bdinu|wk_TJA81*%    %+2:CLWbmy{rkd_[XWWX[_dkr{ymbWLC:2+%    &,4GPYbksz|ung`YSNIECBBCEINSY`gnu|zskbYPG>6.("  "(/6>FOW_fmsx{}}|zvqlf_YSMHD@>==>@DHMSY_flqvz|}}{xsmf_WOF>6/("  #)/6>EMT[agknpqqolhc^XSMHC?<:99:6/)#  #)/5ACEEEDCA?<96410....01469;73/*&!   %)-148;=>?@?>=;8641/.,,,,./1468;=>?@?>=;841-)%    $'+/2579::::97531/-,+**+,-/13579::::9752/+'$   #&)-/2356655320.,+)(((()+,.0235566532/-)&#  "%(*-/011110.-+*('&&&&'(*+-.011110/-*(%"  !$&(*,----,+)('%$$##$$%'()+,----,*(&$!   "$&'()))('&%$#"!!!!"#$%&'()))('&$"    "#$%%%$$#"!  !"#$$%%%$#"    !!!!  !!!!                                     !"#$$$$##"!  !"##$$$$#"!  !#%'()))(('&$##""""##$&'(()))('%#!  "%'*+--..-,+*('&%%%%&'(*+,-..--+*'%"   #&),.0122210/.,+*)(()*+,./0122210.,)&#    $'+.135677765310.-,,,,-.013567776531.+'$    $(,0368:;<<;:975310/../013579:;<<;:8630,($    $)-158;>?@AA@><:864321123468:<>@AA@?>;851-)$    %).27;>ACEFFEDB@>;9754334579;>@BDEFFECA>;72.)%    %*/48=ADGIKKKJIFDA><97655679<>ADFIJKKKIGDA=84/*%   !%+05:?DHKNPQQQOMJHDA><987789<>ADHJMOQQQPNKHD?:50+%!  !&+17;:99:;>ADHKORUWXXWVSPLGB<71+&!  !&,28?EKPUY\^``_]ZWSOKGC@=;;;;=@CGKOSWZ]_``^\YUPKE?82,&!  !&,3:AGNTZ_cfhihgda]XTOJFB?=<<=?BFJOTX]adghihfc_ZTNGA:3,&!  !&-3;BJQX_ejnqrrqolhc^XSNIEB@??@BEINSX^chloqrrqnje_XQJB;3-&!   &,4;CLT\dkqvz}~}|yupjd^XRMHEBAABEHMRX^djpuy|}~}zvqkd\TLC;4,&    %,3;DMV_hpx~~xrkd]WQLHFEEFHLQW]dkrx~~xph_VMD;3,%   %+3;CMWajt}zskc\VQMJIIJMQV\cksz}tjaWMC;3+%  $*2:BLValw{rjc\WRPNNPRW\cjr{wlaVLB:2*$  $*18AKU`lw{rjc^YVTTVY^cjr{wl`UKA81*$  $)07?IS^jv{slfa^\\^afls{vj^SI?70)$   $)/6>GQ\gtž|uojgeegjou|ļtg\QG>6/)$   !%*/5=ENYdp}ytqppqtyȾ}pdYNE=5/*%!  "&+06FMU[bhnsx}ž}xsnhb[UMF>70)#  %,3:BJRY`gmsx|¾|xsmg`YRJB:3,%  !'.5=EMV]ekqv{{vqke]VME=5.'!  ")07?HPX`hnty}}ytnh`XPH?70)"  #)19AIRZbjpv{~ƽ~{vpjbZRIA91)#  #*19BJS[cjqv{~~~~~Ǽ~~~~~{vqjc[SJB91*#  #*2:BJS[cjqvz}~|{ywutsstuwz}ʾ}zwutsstuwy{|~}zvqjc[SJB:2*#  #*19AJRZbiotx{||{zwuromkihhijmpuz´zupmjihhikmoruwz{||{xtoibZRJA91*#  ")08@IQY`gmruxyxwurokhdb_^]]^adhnu}ǹ}unhda^]]^_bdhkoruwxyxurmg`YQI@80)"  "(/7?GOW^ejortutrpmiea]YWTSSTVY]cjr|̾|rjc]YVTSSTWY]aeimprtutroje^WOG?7/("  !'.6=EMU\bglopqpnkgc_ZVROLKJJLOSY`is~ĵ~si`YSOLJJKLORVZ_cgknpqpolgb\UME=6.'!   &-4;9778;?ELT_jwɽwj_TLE?;8779;>BGLQV[_ceffec_ZUNG@92+$  $*18?FMSY]acedc`]YTOID@;864458ELRX\`bccb_\XSMHC>:743246:?FOYeq¶qeYOF?:642347:>CHMSX\_bccb`\XRLE>70*#  #*07>ELRX\`bccb_\XSMHC>:743246:?FOYeq¶qeYOF?:642347:>CHMSX\_bccb`\XRLE>70*#  $*18?FMSY]acedc`]YTOID@;864458;9778;?ELT_jwɽwj_TLE?;8779;>BGLQV[_ceffec_ZUNG@92+$  %,3:AIPW\aehiihfb^ZUPKFC?=<<=@DJQZdo|µ|odZQJD@=<<=?CFKPUZ^bfhiihea\WPIA:3,%   &-4FMU[bhnsx}ž}xsnhb[UMF>70)#  !&-3:AHOV\bhnsy~~ysnhb\VOHA:3-&!  #)/5GQ\gtž|uojgeegjou|ļtg\QG>6/)$   $)07?IS^jv{slfa^\\^afls{vj^SI?70)$  $*18AKU`lw{rjc^YVTTVY^cjr{wl`UKA81*$  $*2:BLValw{rjc\WRPNNPRW\cjr{wlaVLB:2*$  %+3;CMWajt}zskc\VQMJIIJMQV\cksz}tjaWMC;3+%   %,3;DMV_hpx~~xrkd]WQLHFEEFHLQW]dkrx~~xph_VMD;3,%    &,4;CLT\dkqvz}~}|yupjd^XRMHEBAABEHMRX^djpuy|}~}zvqkd\TLC;4,&   !&-3;BJQX_ejnqrrqolhc^XSNIEB@??@BEINSX^chloqrrqnje_XQJB;3-&!  !&,3:AGNTZ_cfhihgda]XTOJFB?=<<=?BFJOTX]adghihfc_ZTNGA:3,&!  !&,28?EKPUY\^``_]ZWSOKGC@=;;;;=@CGKOSWZ]_``^\YUPKE?82,&!  !&+17;:99:;>ADHKORUWXXWVSPLGB<71+&!  !%+05:?DHKNPQQQOMJHDA><987789<>ADHJMOQQQPNKHD?:50+%!   %*/48=ADGIKKKJIFDA><97655679<>ADFIJKKKIGDA=84/*%    %).27;>ACEFFEDB@>;9754334579;>@BDEFFECA>;72.)%    $)-158;>?@AA@><:864321123468:<>@AA@?>;851-)$    $(,0368:;<<;:975310/../013579:;<<;:8630,($    $'+.135677765310.-,,,,-.013567776531.+'$    #&),.0122210/.,+*)(()*+,./0122210.,)&#   "%'*+--..-,+*('&%%%%&'(*+,-..--+*'%"  !#%'()))(('&$##""""##$&'(()))('%#!  !"#$$$$##"!  !"##$$$$#"!                                   !""""!  !""""!   !#%&''''&%$#"!!!!!!"#$%&''''&%#!   #&(*+,,,,+*)('&%%%%&'()*+,,,,+*(&#   !%(+-/122210/.-+**))**+-./012221/-+(%!  "&)-0256787764310/.--./0134677876520-)&"  "&*.258:<===<;98643211234689;<===<:852.*&"  "&*/37:=@ABCBA@><:87655678:<>@ABCBA@=:73/*&"  !&*/48=@CFGHHGFDB@><:9999:<>@BDFGHHGFC@=84/*&!  !%*/59>BFIKMMMLKIFDA?=<<<<=?ADFIKLMMMKIFB>95/*%!   %*05:@DILOQSSRQOMJGEB@?>>?@BEGJMOQRSSQOLID@:50*%    %*05;AFKOSVXXXXVTQNKGECA@@ACEGKNQTVXXXXVSOKFA;50*%   $*06ELSY_dhklmlkhe`\WSOKHFEEFHKOSW\`ehklmlkhd_YSLE>70*$  $*08?GNV]dinrtvutrnje`[VQMJHFFHJMQV[`ejnrtuvtrnid]VNG?80*$  #)08@HPYahouy}}yupjd_YTOLIHHILOTY_djpuy}}yuohaYPH@80)#  #)08@IR[dlt{}wpic\WRNKJJKNRW\cipw}{tld[RI@80)#  "(/7@IR\fpy~woha[UQNMMNQU[ahow~ypf\RI@7/("  "(/6?HR]hr}~vmf_YURPPRUY_fmv~}rh]RH?6/("  "'.5>GR]ht}tle^ZWUUWZ^elt}th]RG>5.'"  "'-5=FP[gs{ske`\[[\`eks{sg[PF=5-'"  "'-4DJPV]dlt}þķ}tld]VPJD>82,'"  !&,28?ELRX_elt{Ź{tle_XRLE?82,&!   %+18?FMTZagnt{ź{tngaZTMF?81+%   #)07>EMT[bipv|¸|vpib[TME>70)#   &-4;CKS[cjqw}ƽ}wqjc[SKC;4-&   ")08@HQYbjqx~ž~xqjbYQH@80)"  $+3;DMV_gow~Ŀ~wog_VMD;3+$   &.6>GQZclt||tlcZQG>6.&   !(/8@JS]foxxof]SJ@8/(!  ")09BKU_irzƿzri_UKB90)"  ")1:CLV`js{ż{sj`VLC:1)"  ")1:CLV`js{~}}}Ǽ}}}~{sj`VLC:1)"  ")19BLV_irz}yvsrppqsuy}ʾ}yusqpprsvy}zri_VLB91)"  !(08AKT^gpx~~yupligeddfhlpw~µ~wplhfddegilpuy~~xpg^TKA80(!   '/7@IR\emu{|wrmhd`]ZYYZ\`eks|ƹ|ske`\ZYYZ]`dhmrw|{ume\RI@7/'    &.6>GPYbjrx}{vqlfa\WTQPOPRV[air}ʾ}ria[VRPOPQTW\aflqv{}xrjbYPG>6.&   %,4<;;=AELT]htth]TLEA=;;<>AFKQW]cinruvwurnib[SJB:2*#  #)19AIQY`glpsttrokf`ZTNHC>;988:=BHPYdp}ǽ}pdYPHB=:889;>CHNTZ`fkorttsplg`YQIA91)#  ")08@HPX_fkorssqnje_YRLFA=97668;@FNXbn{Ż{nbXNF@;86679=AFLRY_ejnqssrokf_XPH@80)"  ")08@HPX_fkorssqnje_YRLFA=97668;@FNXbn{Ż{nbXNF@;86679=AFLRY_ejnqssrokf_XPH@80)"  #)19AIQY`glpsttrokf`ZTNHC>;988:=BHPYdp}ǽ}pdYPHB=:889;>CHNTZ`fkorttsplg`YQIA91)#  #*2:BJS[binruwvurnic]WQKFA><;;=AELT]htth]TLEA=;;<>AFKQW]cinruvwurnib[SJB:2*#  $+3;CLU]dkquxzzxuqlga[UOJFCA@ACFKQYcmyǼymcYQKFCA@ACFJOU[aglquxzzxuqkd]ULC;3+$  %,4GPYbjrx}{vqlfa\WTQPOPRV[air}ʾ}ria[VRPOPQTW\aflqv{}xrjbYPG>6.&    '/7@IR\emu{|wrmhd`]ZYYZ\`eks|ƹ|ske`\ZYYZ]`dhmrw|{ume\RI@7/'   !(08AKT^gpx~~yupligeddfhlpw~µ~wplhfddegilpuy~~xpg^TKA80(!  ")19BLV_irz}yvsrppqsuy}ʾ}yusqpprsvy}zri_VLB91)"  ")1:CLV`js{~}}}Ǽ}}}~{sj`VLC:1)"  ")1:CLV`js{ż{sj`VLC:1)"  ")09BKU_irzƿzri_UKB90)"  !(/8@JS]foxxof]SJ@8/(!   &.6>GQZclt||tlcZQG>6.&   $+3;DMV_gow~Ŀ~wog_VMD;3+$  ")08@HQYbjqx~ž~xqjbYQH@80)"   &-4;CKS[cjqw}ƽ}wqjc[SKC;4-&   #)07>EMT[bipv|¸|vpib[TME>70)#   %+18?FMTZagnt{ź{tngaZTMF?81+%   !&,28?ELRX_elt{Ź{tle_XRLE?82,&!  "',28>DJPV]dlt}þķ}tld]VPJD>82,'"  "',16GR]ht}tle^ZWUUWZ^elt}th]RG>5.'"  "(/6?HR]hr}~vmf_YURPPRUY_fmv~}rh]RH?6/("  "(/7@IR\fpy~woha[UQNMMNQU[ahow~ypf\RI@7/("  #)08@IR[dlt{}wpic\WRNKJJKNRW\cipw}{tld[RI@80)#  #)08@HPYahouy}}yupjd_YTOLIHHILOTY_djpuy}}yuohaYPH@80)#  $*08?GNV]dinrtvutrnje`[VQMJHFFHJMQV[`ejnrtuvtrnid]VNG?80*$  $*07>ELSY_dhklmlkhe`\WSOKHFEEFHKOSW\`ehklmlkhd_YSLE>70*$  $*06=DJPV[_bdeedb_\XTPLIFDDDDFILPTX\_bdeedb_[VPJD=60*$  $*06>?@BEGJMOQRSSQOLID@:50*%   !%*/59>BFIKMMMLKIFDA?=<<<<=?ADFIKLMMMKIFB>95/*%!  !&*/48=@CFGHHGFDB@><:9999:<>@BDFGHHGFC@=84/*&!  "&*/37:=@ABCBA@><:87655678:<>@ABCBA@=:73/*&"  "&*.258:<===<;98643211234689;<===<:852.*&"  "&)-0256787764310/.--./0134677876520-)&"  !%(+-/122210/.-+**))**+-./012221/-+(%!   #&(*+,,,,+*)('&%%%%&'()*+,,,,+*(&#   !#%&''''&%$#"!!!!!!"#$%&''''&%#!   !""""!  !""""!                           !"####""!  !""####"!   "$&())))('&%$##""##$%&'())))(&$"   "%(*,.////.-,+)((''(()+,-.////.,*(%"  #'*-02456654320/.----./02345665420-*'#   $(,0368:<<<;:97643222234679:;<<<:8630,($   $(-159DJRZcnyĹͿyncZRJD>83.)%!  "&+05;AGMT[dmw¸Ʒwmd[TMGA;50+&"  "',28>DJPW^emv̾vme^WPJD>82,'"  "'-39@FMSZ`gowýµwog`ZSMF@93-'"  !&,3:AHOV]djqxŹxqjd]VOHA:3,&!  $+29@HPW_fmt{ƻ{tmf_WPH@92+$  "(/7?GOX`hpw~ż~wph`XOG?7/("  %,3GR\gq{{qg\RG>4,%  &.6@JU_ju¿uj_UJ@6.&   '/8ALWbmxľxmbWLA8/'    '/8BMXcnyyncXMB8/'    '/8BMXcnyyncXMB8/'    '/8BLWbmx}zxwwwy|ø|ywwwxz}xmbWLB8/'   &.7AKVakv|wsoljjjknrw~ƺ~wrnkjjjlosw|vkaVKA7.&  %-6?IT^is}zsnida_^^_bfkrzɾzrkfb_^^_adinsz}si^TI?6-%  $,4=GQ\fpyyrle`[WUTSUW[ahpzzpha[WUSTUW[`elryypf\QG=4,$  #+3>?AEKR[ep{{pe[RKEA?>>@CHMSZaipw}~xph_UKB90(!  !(/8AJT]fnv|ztmf^WPJD@=;:;>BGNWalxŽxlaWNGB>;:;=@DJPW^fmtz|vnf]TJA8/(!  !'/7@IS\emt{}ysld]VOHC>;999<@EMU_jv»vj_UME@<999;>CHOV]dlsy}{tme\SI@7/'!  !'/7@IS\emt{}ysld]VOHC>;999<@EMU_jv»vj_UME@<999;>CHOV]dlsy}{tme\SI@7/'!  !(/8AJT]fnv|ztmf^WPJD@=;:;>BGNWalxŽxlaWNGB>;:;=@DJPW^fmtz|vnf]TJA8/(!  !(09BKU_hpx~}wpiaZSMHC@>>?AEKR[ep{{pe[RKEA?>>@CHMSZaipw}~xph_UKB90(!  ")1:CMWajs{{tmf_XRMIFDCDGKQX`juǾuj`XQKGDCDFIMRX_fmt{{sjaWMC:1)"  #+3GR\gq{{qg\RG>4,%  #*2;DNXblvvlbXND;2*#  !(/7@IS]foxľxof]SI@7/(!  %,3DJPW^emv̾vme^WPJD>82,'"  "&+05;AGMT[dmw¸Ʒwmd[TMGA;50+&"  !%).38>DJRZcnyĹͿyncZRJD>83.)%!  #'+05;BIQZdp|ȼĵ|pdZQIB;50+'#  !%).39@HQ[fr˿|xvvx|ǹrf[QH@93.)%!  #',28@HR]iuyspnnpsyǻui]RH@82,'#  !&+18@IS_kxyrlhffhlryĺxk_SI@81+&!   %*18AJUamzžzrkfbaabfkrzſzmaUJA81*%   $*19BLVbnz}umfa^\\^afmu}znbVLB91*$  $*2:CMWcnyxphb]ZXXZ]bhpxyncWMC:2*$  %+2;DMXbmw{ske_ZWVVWZ_eks{wmbXMD;2+%  %,3;DNWakt}}vohb\XUTTUX\bhov}}tkaWND;3,%   &,4?@@?>=;9876556789;=>?@@?><962.*%!  !%*/48<@CEGGGGFDB@>=<;;<=>@BDFGGGGEC@<84/*%!   %*/5:?CGJMNOONMKIGECBAABCEGIKMNOONMJGC?:5/*%   #)/5:@EJNRTVWVUTROMKIHGGHIKMORTUVWVTRNJE@:5/)#  "(.4:@FLQVY\]^]\ZXUSPNMLLMNPSUXZ\]^]\YVQLF@:4.("   &,29@GMSX]`cdedc`^[XUSQQQQSUX[^`cdedc`]XSMG@92,&   $*18?FMTZ_dgjkkjhfc`\YWUTTUWY\`cfhjkkjgd_ZTMF?81*$  #)/6=ELTZafknpqqpnkgd`]ZXWWXZ]`dgknpqqpnkfaZTLE=6/)#  !'.5GQ\hs~~voida__adiov~~sh\QG>5-'!  !&-4=FQ\gsyrkfbaabfkrysg\QF=4-&!  !'-4EMV`lxŹ~zxxz~xl`VME>82-)%!  #',05;AGOW`jv̽vj`WOGA;50,'#   %*.39>DJQYajuȼƷujaYQJD>93.*%   !&+16GPZclu}}ulcZPG>6.'   #*2:DMWaku~~ukaWMD:2*#  &-6?IS^is~~si^SI?6-&  !(09CMXdoz¿zodXMC90(!  "*2HT`lxxl`TH>4+#  $,5?JVbn{{nbVJ?5,$  $,6@KWcp|û|pcWK@6,$  $,6@KWcp|ú|pcWK@6,$  $,5?JVbo{}{{|}ĺ}|{{}{obVJ?5,$  #+4>IUamy{wspnmnorv|Ƽ|vronmnpsw{ymaUI>4+#  #*3=GS_kwxqlgdbaacfjpwȾwpjfcaabdglqxwk_SG=3*#  ")2;EQ\hs~vohb]ZWVVX[`fmuumf`[XVVWZ]bhov~sh\QE;2)"  !(09DNYep{wog`ZUQNMMORW]dmvvmd]WROMMNQUZ`gow{peYND90(!   '/8BLWbmxzqiaYSNJGFFGKOU]fpzzpf]UOKGFFGJNSYaiqzxmbWLB8/'   &.7@JU`ku~}uld\TNHDA@@BEJPW`juuj`WPJEB@@ADHNT\dlu}~uk`UJ@7.&  %-6?IT^is|zriaXQJEA><<>AFLT\fq}}qf\TLFA><<>AEJQXairz|si^TI?6-%  %-5>HS]hr{xpg_WOIC?<:;5-%  %-5>HS]hr{xpg_WOIC?<:;5-%  %-6?IT^is|zriaXQJEA><<>AFLT\fq}}qf\TLFA><<>AEJQXairz|si^TI?6-%  &.7@JU`ku~}uld\TNHDA@@BEJPW`juuj`WPJEB@@ADHNT\dlu}~uk`UJ@7.&   '/8BLWbmxzqiaYSNJGFFGKOU]fpzzpf]UOKGFFGJNSYaiqzxmbWLB8/'   !(09DNYep{wog`ZUQNMMORW]dmvvmd]WROMMNQUZ`gow{peYND90(!  ")2;EQ\hs~vohb]ZWVVX[`fmuumf`[XVVWZ]bhov~sh\QE;2)"  #*3=GS_kwxqlgdbaacfjpwȾwpjfcaabdglqxwk_SG=3*#  #+4>IUamy{wspnmnorv|Ƽ|vronmnpsw{ymaUI>4+#  $,5?JVbo{}{{|}ĺ}|{{}{obVJ?5,$  $,6@KWcp|ú|pcWK@6,$  $,6@KWcp|û|pcWK@6,$  $,5?JVbn{{nbVJ?5,$  #+4>HT`lxxl`TH>4+#  "*2GPZclu}}ulcZPG>6.'   #*18@IQZbkrzƽzrkbZQI@81*#  %,2:AIQX`hov}ÿø}voh`XQIA:2,%  !&,3:AHOV]dkry̿yrkd]VOHA:3,&!  "',28?ELRY`gnvƹvng`YRLE?82,'"  !&+16DJQYajuȼƷujaYQJD>93.*%   #',05;AGOW`jv̽vj`WOGA;50,'#  !%)-28>EMV`lxŹ~zxxz~xl`VME>82-)%!  "&+06GQ\hs~~voida__adiov~~sh\QG>5-'!  !'.6?HR\gr|{tmgc`^^`cgmt{|rg\RH?6.'!  "(/7?IR\fpyxrlfb_^^_bflrxypf\RI?7/("  ")08@IR\enw~|vpjea_]]_aejpv|~wne\RI@80)"  #*19AIR[dlt{~ytnida^]]^adinty~{tld[RIA91*#  $+2:BJS[ckrx}~zvqlhc`^\\^`chlqvz~}xrkc[SJB:2+$   &,3;CKS[bipuy|}}|zvsnjfb_][[]_bfjnsvz|}}|yupib[SKC;3,&   !'.5=<;;<=>@BDFGGGGEC@<84/*%!  !%*.269<>?@@?>=;9876556789;=>?@@?><962.*%!  !$(,/2468888764310////0134678888642/,($!   #&)+./01110/.,+*))))*+,./01110/.+)&#   !#%'))***)('&%$$##$$%&'()***))'%#!   !"#$$##"!  !"##$$#"!                          !"####""!  !""####"!   #%'()***)('&%$$##$$%&'()***)('%#    #&),.011210/.-,+****+,-./012110.,)&#   !%)-03689::987643210012346789::98630-)%!  "&+/37;>@ABBBA?=<:987789:<=?ABBBA@>;73/+&"  "&,16:?CFHJKKJIGEDB@?>>?@BDEGIJKKJHFC?:61,&"  !&+17GQZdmv~|wrnlkklnrw|~vmdZQG>6.'!  %,4HR^jw}vpljjlpv}wj^RH>6/)#   %*06>GQ\huxrnllnrxĹuh\QG>60*%   #',17?GP[gsǼ|vroorv|Ǻsg[PG?71,'#  "%*.49@HQZerözvttvzǹreZQH@94.*%"  !$)-27IUamy|ri`YRMJGFGIMRY`is}}si`YRMIGFGJMRY`ir|ymaUI>4+#  #*3=HS_kwwmd[TMHDBAADGMS[dmxxmd[SMGDAABDHMT[dmwwk_SH=3*#  "*2=>@DIOW`jttj`WOID@>=>@DIPX`js}ui]QF<2*"  ")2;FQ\ht{rh^VNHB><;<>BGNU^hr}}rh^UNGB><;<>BHNV^hr{th\QF;2)"  ")2;FQ\ht{rh^VNHB><;<>BGNU^hr}}rh^UNGB><;<>BHNV^hr{th\QF;2)"  "*2=>@DIOW`jttj`WOID@>=>@DIPX`js}ui]QF<2*"  #*3=HS_kwwmd[TMHDBAADGMS[dmxxmd[SMGDAABDHMT[dmwwk_SH=3*#  #+4>IUamy|ri`YRMJGFGIMRY`is}}si`YRMIGFGJMRY`ir|ymaUI>4+#  $-6@KWdp}ypg`ZUQONOQTY`gpyypg`YTQONOQUZ`gpy}pdWK@6-$  &.7BNZgtxohb^ZXWXZ]bhpxxphb]ZXWXZ^bhoxtgZNB7.&  '/9DP\iwyrmhecbcehmryyrmhecbcehmrywi\PD9/'   (0:FR^ly¿}xtqoooqty~~ytqoooqtx}yl^RF:0(   !(1;GS`n|}}}}}}Ŀ|n`SG;1(!  !)2GQ\huxrnllnrxĹuh\QG>60*%   #)/6>HR^jw}vpljjlpv}wj^RH>6/)#  "(/6?IS_kxÿ{tokiikot{xk_SI?6/("  "(/7@JU`lxzsnjiijnszxl`UJ@7/("  #)08AKValxysnkiiknsyxlaVKA80)#  #*19CLWalwxsnkiiknsxwlaWLC91*#  $+2;DNXblv~xsoljjlosx~vlbXND;2+$  %,4GQZdmv~|wrnlkklnrw|~vmdZQG>6.'!  ")08@IR\env}zuqnkjjknquz}vne\RI@80)"  $+2:CKT]fnu||wsoljhhjlosw||unf]TKC:2+$   &-5=ENV_gntz~|xtpligffgilptx|~ztng_VNE=5-&   ")07?GPX_gmswz||{yvsolhfdccdfhlosvy{||zwsmg_XPG?70)"  %+2:AIQX_fkortutspmjgda_^^_adgjmpstutrokf_XQIA:2+%  !'-4>?@BDEGIJKKJHFC?:61,&"  "&+/37;>@ABBBA?=<:987789:<=?ABBBA@>;73/+&"  !%)-03689::987643210012346789::98630-)%!   #&),.011210/.-,+****+,-./012110.,)&#    #%'()***)('&%$$##$$%&'()***)('%#   !"####""!  !""####"!                         !""!!  !!""!    "$&'()))('&%$##""##$%&'()))('&$"   #&)+-/01100/-,+*))))*+,-/00110/-+)&#  !%)-035799:987643210012346789:997530-)%!  "&+048;>@BCCBA@><;:9889:;<>@ABCCB@>;840+&"  "',27<@DGJLMMLKIGECBA@@ABCEGIKLMMLJGD@<72,'"  !',28>DIMQTVWWVUSQNLJIHHIJLNQSUVWWVTQMID>82,'!   &,29?FLRW[^`aa`^\ZWUSQQQQSUWZ\^`aa`^[WRLF?92,&   $*18?FNTZ`dhjkkjhfc`][ZYYZ[]`cfhjkkjhd`ZTNF?81*$  "(/6>FNU]cinqtutsqnkheca``acehknqstutqnic]UNF>6/("  %,4;DLU]elrwz}~}|zwspmjhgghjmpswz|}~}zwrle]ULD;4,%  #)19AJS\emtz~zvspnmmnpsvz~ztme\SJA91)#   &-5>GPZclt||xusrrsux||tlcZPG>5-&   #*2:CMW`js||ywuuwy||sj`WMC:2*#  !'/7@IS]gq{|yxxy|{qg]SI@7/'!  %,4GR]hs~|ywwy|~sh]RG>5-&   $+3DJPW^emvʽvme^WPJD>93.)$   %*06FMT[bipwƻĸwpib[TMF>81+%  $*18@GPX`how~~woh`XPG@81*$  "(/7?HQZclt}ļȿ}tlcZQH?7/("  &-5=FPZdnxxndZPF=5-&  ")1:CNXcnyþyncXNC:1)"  %-5?IT`lxĿxl`TI?5-%   '09CNZgtſtgZNC90'   "*2AEKQYbkt}}tkbYQKEA>==?BGMU^hr}sfZMB7.%  %-7AMYer{pf\SKE@=;;AEKQYbkt}}tkbYQKEA>==?BGMU^hr}sfZMB7.%  &/8CO[huvkaYQKFCAABEINU]enwwne]UNIEBAACFKQYakvuh[OC8/&   '0:EQ]kx{pg^WPLHGFGJNTZbjs||sjbZTNJGFGHLPW^gp{xk]QE:0'   !(1;GS`n{wne^XSPNNOQU[ahqyyqha[UQONNPSX^enw{n`SG;1(!  "*3=IUcq»vnga\YWWXZ^cipxxpic^ZXWWY\agnvûqcUI=3*"  #+4?KXftºxqkgdbbcehmsyysmhecbbdgkqxtfXK?4+#  $,6AMZhw¹}wsponoqtx}}xtqonopsw}żwhZMA6,$  $-7BN\jy~}|}~¾~}|}~ɿyj\NB7-$  %.7CO\kzþzk\OC7.%  %.8CO]kzþzk]OC8.%  %-7BN\jy¾ÿʿyj\NB7-%  $-6AMZhvƻvhZMA6-$  #+5?JWdrrdWJ?5+#  "*2FMT[bipwƻĸwpib[TMF>81+%   %*06DJPW^emvʽvme^WPJD>93.)$  "'+05:?EKRYajtŸĵtjaYRKE?:50+'"   $(,16;@GNV^ht}zz}ȹth^VNG@;61,($   !%)-27=CKT]htǺ}xvvx}ʼth]TKC=72-)%!  "%*.4:AJS]iv¶zvssvzʽvi]SJA:4.*%"  #',29@IS^kxǼ~xtrrtx~Ƚxk^SI@92,'#   %*18@JT`ly}wsqqsw}Żyl`TJ@81*%   $*08AKVan{ü}wsqqsw}{naVKA80*$  $*19BLWco|½~xtsstx~|ocWLB91*$  $*2:CNYdp}yvttvy}pdYNC:2*$  $+3GR]hs~|ywwy|~sh]RG>5-&   !'/7@JT_ju}zyyz}uj_TJ@7/'!  #)19CMWblw~{yy{~wlbWMC91)#  %,4GPZclt||xusrrsux||tlcZPG>5-&   #)19AJS\emtz~zvspnmmnpsvz~ztme\SJA91)#  %,4;DLU]elrwz}~}|zwspmjhgghjmpswz|}~}zwrle]ULD;4,%  "(/6>FNU]cinqtutsqnkheca``acehknqstutqnic]UNF>6/("  $*18?FNTZ`dhjkkjhfc`][ZYYZ[]`cfhjkkjhd`ZTNF?81*$   &,29?FLRW[^`aa`^\ZWUSQQQQSUWZ\^`aa`^[WRLF?92,&   !',28>DIMQTVWWVUSQNLJIHHIJLNQSUVWWVTQMID>82,'!  "',27<@DGJLMMLKIGECBA@@ABCEGIKLMMLJGD@<72,'"  "&+048;>@BCCBA@><;:9889:;<>@ABCCB@>;840+&"  !%)-035799:987643210012346789:997530-)%!  #&)+-/01100/-,+*))))*+,-/00110/-+)&#   "$&'()))('&%$##""##$%&'()))('&$"    !""!!  !!""!                            "$%&''&&%$#"!! !!"#$%&&''&%$"   !$'*,-.//..-,*)((''(()*,-..//.-,*'$!   $(+/2467887754310////0134577887642/+($   "&+/37:=?ABBA@?=<:987789:<=?@ABBA?=:73/+&"  "',17;@DGJKLLLKIGECBA@@ABCEGIKLLLKJGD@;71,'"  "'-39?DINRUWXXWVTQOMKJIIJKMOQTVWXXWURNID?93-'"   &,3:@GMSX\`bccba_\YWUTSSTUWY\_abccb`\XSMG@:3,&   %+29AHPW]cgkmoonligda_]\\]_adgilnoomkgc]WPHA92+%  ")08@HPX`gmrvyzzywtqnkhfeefhknqtwyzzyvrmg`XPH@80)"   &-5=FOXaiqw}~zwtqonnoqtwz~}wqiaXOF=5-&   #*2:CLV`irz|ywuuwy|zri`VLC:2*#   &.6?IS]gqz}||}zqg]SI?6.&   #*2;EOYdoyyodYOE;2*#   '.7@JU`kvvk`UJ@7.'   #*3DJPV\cjrzȺzrjc\VPJD>83-(#  #)/5;BHOV\cjpw˾ʽwpjc\VOHB;5/)#  #)/6=ELT[cjqxǻxqjc[TLE=6/)#  "(/6>FNW`hpxĹŻxph`WNF>6/("   &-5=FOXblu~żŽ~ulbXOF=5-&   #*2:DNXcmxƾ½xmcXND:2*#   &.7@JUalxƿĿxlaUJ@7.&   ")2;EQ]ivvi]QE;2)"  $,5?JVcq~¿ż~qcVJ?5,$  &.8CN[iwǼwi[NC8.&   '0:ER_n}¿ĸ}n_RE:0'   !(1AEKRYaiqyyqiaYRKEA><<=?DIQYcnz¾}oaTH<2)!  !(1AEKRYaiqyyqiaYRKEA><<=?DIQYcnz¾}oaTH<2)!  "*3=IUcqþ}rg]TMGC@?@ADINU\dlt||tld\UNIDA@?@CGMT]gr}»qcUI=3*"  #+4?KXetûwlbZSMIFEEGJNSZaiqyyqiaZSNJGEEFIMSZblwƿteXK?4+#  $,6AMZhw~sjaZTPMLLNQUZ`gov~~vog`ZUQNLLMPTZajs~ŻwhZMA6,$  %.8CO]kzɿ|rjc]YVUUWY]bhnv}}vnhb]YWUUVY]cjr|zk]OC8.%  &/9ER`n~ǽ|tmhda``acgkqw~~wqkgca``adhmt|ƺ~n`RE9/&  '0;GTbqźytpnllmorv{{vromllnpty˾qbTG;0'   (1FNW`hpxĹŻxph`WNF>6/("  #)/6=ELT[cjqxǻxqjc[TLE=6/)#  #)/5;BHOV\cjpw˾ʽwpjc\VOHB;5/)#  #(-38>DJPV\cjrzȺzrjc\VPJD>83-(#  "&+/49?DJPV]emwķ~~Ŷwme]VPJD?94/+&"   #(,059?DJQYakv}zz}ȹvkaYQJD?950,(#   !$(,05:@FNV_jvʽzxxzʼvj_VNF@:50,($!  !$(,16???><;9865555689;<>???>=;851-)%!  !&+05:>BEHIJJJIGECA@?>>?@ACEGIJJJIHEB>:50+&!  !',28>CHMQSUVVVTRPNLJIHHIJLNPRTVVVUSQMHC>82,'!  !&,3:@GMSX\_bccba^\YWUTSSTUWY\^abccb_\XSMG@:3,&!  %+2:AIPW^dhlnppomkheb`^]]^`behkmoppnlhd^WPIA:2+%  #)18AIQZbiotx{}}|ywtpmkihhikmptwy|}}{xtoibZQIA81)#   '.6>GQZclt{{xusrrsux{{tlcZQG>6.'   #+3;ENXclv~}||}~vlcXNE;3+#   '/7AKU`kuuk`UKA7/'   #*3ELU_jwɽ|zz|ʼwj_ULE>83.*'#    $'+/38=BHOW`kv˾{yy{Ⱥvk`WOHB=83/+'$   #'+/48=BGMT[clv|zz|Ʒvlc[TMGB=84/+'#  !%*/49>CHNSZ`hpy´~{{~õyph`ZSNHC>94/*%!  "',27=CIOU[agnu}Ķ~~Ϳ}unga[UOIC=72,'"  "(-4:AGNU\biov|Ÿɽ|voib\UNGA:4-("  "'.4;CKRZbiqx~ǺǼ~xqibZRKC;4.'"   &-4JXgwǻvnhc_]\\]`cglrx~~xrlgc`]\\]_chnvǸwgXJ>3)!   (1@CHMSZagnty~~ytngaZSMHC@>==?CHOW`kwǾyj\NB7-$  $,6AMZhwŽsh]SKD?<:9:<@DJPW^ekqw{~~{wqke^WPJD@<:9:CHNU\cjpuy|~~|yupjc\UNHC>;878:=CIQ[fq~¸ugYL@5,#  #,5@LYguû~qf[QIC=:878;>CHNU\cjpuy|~~|yupjc\UNHC>;878:=CIQ[fq~¸ugYL@5,#  $,6AMZhwŽsh]SKD?<:9:<@DJPW^ekqw{~~{wqke^WPJD@<:9:@CHMSZagnty~~ytngaZSMHC@>==?CHOW`kwǾyj\NB7-$  %.8DP^m|Ƽ}qf\TNHECBCEHLRW^elrx}}xrle^WRLHECBCEHNT\fq}¶|m^PD8.%  '0:FSap÷xmc[UPLJIJKNSX]djqw}}wqjd]XSNKJIJLPU[cmxȼpaSF:0'   (1JXgwǻvnhc_]\\]`cglrx~~xrlgc`]\\]_chnvǸwgXJ>3)!  "+5@LZiz÷ztokihghjmquzzuqmjhghikotz˼ziZL@5+"  #,6AN\l||yvutuvx{{xvutuvy||l\NA6,#  $-7BO]m}ɾ±}m]OB7-$  $-7CP^m~Ǿ±~m^PC7-$  %-7BO]m}}m]OB7-%  $-6AN\kz˼zk\NA6-$  $,5@LYgw¿ŶwgYL@5,$  "*3=IVcrɼrcVI=3*"  !(1:EQ^lzſɾzl^QE:1(!  &.7ALXerƿżreXLA7.&  $+3CHNSZ`hpy´~{{~õyph`ZSNHC>94/*%!  #'+/48=BGMT[clv|zz|Ʒvlc[TMGB=84/+'#   $'+/38=BHOW`kv˾{yy{Ⱥvk`WOHB=83/+'$    #'*.38>ELU_jwɽ|zz|ʼwj_ULE>83.*'#    #&+/5;CKU`kxǼ~{{~ʾxk`UKC;5/+&#    #(-3:BKUamzƼ~~ʾzmaUKB:3-(#   !&,2:BLWcp}Ƽɿ}pcWLB:2,&!   %+2:DNYfsƽȿsfYND:2+%    %,3GQZclt{{xusrrsux{{tlcZQG>6.'   #)18AIQZbiotx{}}|ywtpmkihhikmptwy|}}{xtoibZQIA81)#  %+2:AIPW^dhlnppomkheb`^]]^`behkmoppnlhd^WPIA:2+%  !&,3:@GMSX\_bccba^\YWUTSSTUWY\^abccb_\XSMG@:3,&!  !',28>CHMQSUVVVTRPNLJIHHIJLNPRTVVVUSQMHC>82,'!  !&+05:>BEHIJJJIGECA@?>>?@ACEGIJJJIHEB>:50+&!  !%)-158;=>???><;9865555689;<>???>=;851-)%!  #&),/1345554310/.-,,-./0134555431/,)&#   "%')*+,,++*)('&%%%%&'()*++,,+*)'%"    !"#$$##"!  !"##$$#"!                            "$%''((('&%$#""!!""#$%&'(((''%$"    $'),./01100/-,+*))))*+,-/00110/.,)'$   #'+/2579:;;;:87543211234578:;;;:9752/+'#   %*.37;?BDFFGFECA@>=;;;;=>@ACEFGFFDB?;73.*%   !&+16IUao}ļȾ}oaUI>4,$  ")1:DO[hvùvh[OD:1)"  !'.6@JVbo}Žɿ}obVJ@6.'!   &,4JXgv˿{oe\TNJGEEFHKOSY^dinrvxyyxvrnid^YSOKHFEEGJNT\eo{ƷvgXJ>3*!   (1@BEINSY_dinqtuutqnid_YSNIEB@>?@CGMU^htsdUH<1(   '0:FSapʿ{ncXOHB>;::;=AEJOU[afjnpqqpnjfa[UOJEA=;::;>BHOXcn{ǻpaSF:0'  &/9EQ_n}ƻxk_ULD?:8668:>BGMRX^chknoonkhc^XRMGB>:8668:?DLU_kxĸ}n_QE9/&  &.9DQ^m|Ĺvi]SJC=965568<@FKQW]bfjlnnljfb]WQKF@<865569=CJS]iv¶|m^QD9.&  &.9DQ^m|Ĺvi]SJC=965568<@FKQW]bfjlnnljfb]WQKF@<865569=CJS]iv¶|m^QD9.&  &/9EQ_n}ƻxk_ULD?:8668:>BGMRX^chknoonkhc^XRMGB>:8668:?DLU_kxĸ}n_QE9/&  '0:FSapʿ{ncXOHB>;::;=AEJOU[afjnpqqpnjfa[UOJEA=;::;>BHOXcn{ǻpaSF:0'   (1@BEINSY_dinqtuutqnid_YSNIEB@>?@CGMU^htsdUH<1(   !*3>JXgv˿{oe\TNJGEEFHKOSY^dinrvxyyxvrnid^YSOKHFEEGJNT\eo{ƷvgXJ>3*!  #+5@M[jzǹwmd]WROMMNORVZ_dinsw{}~~}{wsnid_ZVRONMMORW]dmw˽zj[M@5+#  $-7BO^m~´wnga\YWVWXZ^afkoty}}ytokfa^ZXWVWY\agnw²~m^OB7-$  %.9DR`pʽyrlhebaabdgjnrv{{vrnjgdbaabehlryǶp`RD9.%  '0:FTcsƹyuqonmmnpsvy}}yvspnmmnoquy˺scTF:0'   '1;GUdt·}{zyz{|~~|{zyz{}ͼtdUG;1'    (1IUao}ļȾ}oaUI>4,$  !(09CO[hvžùvh[OC90(!  $,5?JVcp~ſǾ~pcVJ?5,$  !(1:EP]jxý¸xj]PE:1(!  %-6@LXerſ»reXL@6-%  "*2=;;;;=>@ACEFGFFDB?;73.*%   #'+/2579:;;;:87543211234578:;;;:9752/+'#   $'),./01100/-,+*))))*+,-/00110/.,)'$    "$%''((('&%$#""!!""#$%&'(((''%$"                           !"####""!  !""####"!   !#&()+,,,,+*)'&%%%%%%&')*+,,,,+)(&#!  !$(+.13456654320/.----./02345665431.+($!  #',047;=?AAAA?><;98766789;<>?AAAA?=;740,'#   $).49=BFIKMNNMLJHFDBAAAABDFHJLMNNMKIFB=94.)$    %*06HT`lxxl`TH>4,$   '/9CNZgttgZNC9/'   #*3=HTan|½|naTH=3*#  %-6ALYguſøugYLA6-%  !(0:EQ^l{ľ{l^QE:0(!  #+4>IVcrƺrcVI>4+#  &.7BNZhw½whZNB7.&  ")2;FR_m|Ÿ|m_RF;2)"  %-6@KWesĽɼseWK@6-%  #)1:EP]jyǿyj]PE:1)#  !'.6@KVcqŸqcVK@6.'!   &,4EKRY`flrx}µ{vttv{}xrlf`YRKE>71+%   $*18?GOW_gnu||xvvx||ung_WOG?81*$  #)/7?GPYblu}ʾ}yxxy}ý}ulbYPG?7/)#   &-5=FPZdnyƻ|zz|yndZPF=5-&   #)19CMXcoz~}}~½zocXMC91)#  %-5>HT_lyĺǿyl_TH>5-%   '/8BNZgtûŹtgZNB8/'   ")2;FR_m|ſƸ|m_RF;2)"  #+3>IVdsósdVI>3+#  $,5?KYgw¾˻wgYK?5,$  $,6@M[jz¼zj[M@6,$  $,6AM[k|IJ|k[MA6,$  #,5AM[k|}{zyyyz{|}}|{zyyyz{}ų|k[MA5,#  #+5@L[j{ķ}yusqooopqstwy{|}~~}|{ywtsqpoooqsuy}IJ{j[L@5+#  "*3>KYhyɻ{uplhfeddegiknqtvxyzzyxvtqnkigeddefhlpu{°yhYK>3*"   (2AEINRW[_bdeedb_[WRNIEA><::;=AFLT^ivȹxhYL?4+"  !)3=JWfuŸ~pdYOGA<86567:=AEJOTX\_abba_\XTOJEA=:76568CHMQVY\^``^\YVQMHC>:7432358=DLU`mz˿sdUH<2(!   (1CHMQVY\^``^\YVQMHC>:7432358=DLU`mz˿sdUH<2(!  !)3=JWfuŸ~pdYOGA<86567:=AEJOTX\_abba_\XTOJEA=:76568AEINRW[_bdeedb_[WRNIEA><::;=AFLT^ivȹxhYL?4+"  $,6AN\l|Ķ|pe[SLGCA@@ACFJNRW[_cfhiihfc_[WRNJFCA@@ACGLS[ep|Ϳ|l\NA6,$  %.8DQ`o̾xmc[TOKIHGHJMPTX\`dgjlmmljgd`\XTPMJHGHIKOT[cmxŴo`QD8.%  '0:FTcsƸvme^YURPPPRTWZ^beilopqqpolieb^ZWTRPPPRUY^emvʹscTF:0'   (2KYhyɻ{uplhfeddegiknqtvxyzzyxvtqnkigeddefhlpu{°yhYK>3*"  #+5@L[j{ķ}yusqooopqstwy{|}~~}|{ywtsqpoooqsuy}IJ{j[L@5+#  #,5AM[k|}{zyyyz{|}}|{zyyyz{}ų|k[MA5,#  $,6AM[k|IJ|k[MA6,$  $,6@M[jz¼zj[M@6,$  $,5?KYgw¾˻wgYK?5,$  #+3>IVdsósdVI>3+#  ")2;FR_m|ſƸ|m_RF;2)"   '/8BNZgtûŹtgZNB8/'   %-5>HT_lyĺǿyl_TH>5-%  #)19CMXcoz~}}~½zocXMC91)#   &-5=FPZdnyƻ|zz|yndZPF=5-&   #)/7?GPYblu}ʾ}yxxy}ý}ulbYPG?7/)#  $*18?GOW_gnu||xvvx||ung_WOG?81*$   %+17>EKRY`flrx}µ{vttv{}xrlf`YRKE>71+%   !%*05;AGLRX]chmsyķzvttvzysmhc]XRLGA;50*%!   $)-27IVcrƺrcVI>4+#  !(0:EQ^l{ľ{l^QE:0(!  %-6ALYguſøugYLA6-%  #*3=HTan|½|naTH=3*#   '/9CNZgttgZNC9/'   $,4>HT`lxxl`TH>4,$  !(09BMXcnyyncXMB90(!  $,4<;98766789;<>?AAAA?=;740,'#  !$(+.13456654320/.----./02345665431.+($!  !#&()+,,,,+*)'&%%%%%%&')*+,,,,+)(&#!   !"####""!  !""####"!                       "#%&&''&%$#"!! !!"#$%&''&&%#"   !$'),-/000/.-,+*)(((()*+,-./000/-,)'$!  !$(,/3589:;;:9865321111235689:;;:9853/,($!  "',059=@CEFGGFECA@><;;;;<>@ACEFGGFEC@=950,'"  #).39>CHLPRTTTSRPNLJHGFFGHJLNPRSTTTRPLHC>93.)#  #)/6EMT[bglorssrpmjgdb`__`bdgjmprssrolgb[TME>6/)#  !'.5>FOW`hov{}yvspnmmnpsvy}{voh`WOF>5.'!  %,3IT`lxxl`TI>5,%  !(09DO[hu¾¾uh[OD90(!  #+4>IUbp~ż~pbUI>4+#  &.7BN[hwǽwh[NB7.&  !(1;FR`n}ÿƹ}n`RF;1(!  #+4>JWesseWJ>4+#  %-7AM[ixƸxi[MA7-%  !(0:EQ_n}˽}n_QE:0(!  #+3=IUcrrcUI=3+#   &.7AMZhvĵvhZMA7.&   #*2;FQ^l{ľǹ{l^QF;2*#  !'.6@KWdrĽʼrdWK@6.'!   &,3BFKPV^foyĹ{yy{yof^VPKFB>:740-*'#   #&*.26:>BFJNRW]cjqz{vttv{ɾzqjc]WRNJFB>:62.*&#   $)-27;@EJNSW[`ejpw~ɽ}wsppsw}ƻ~wpje`[WSNJE@;72-)$    %*/5:@FLQW\afjoty~ƺ{tpnnpt{ù~ytojfa\WQLF@:5/*%    %*06=CJQX^ekpuzĸysommosyzupke^XQJC=60*%   $)06=EMU]elszxsommosxzsle]UME=60)$  "'.5=ENW`ir{Ǽxsommosxþ{ri`WNE=5.'"  %+2:CLV`ku¸~xspnnpsx~uk`VLC:2+%  !'/7@IT_jvż~xtqppqtx~¼vj_TI@7/'!  #*2;DOZgsŽ}xurqqrux}ƼsgZOD;2*#  %,5>ITan|»|xusrrsux||naTI>5,%  &.7ALYft{xvtsstvx{tfYLA7.&   '/9CO\kz|ywuttttuwy|ʻzk\OC9/'    (0:EQ_n~ſ~{ywvuttttuvwy{~±~n_QE:0(    (0:FSapļ}zxvuttssssssttuvxz}ȶpaSF:0(    '0:FSaqƼ|ywusrqqqqqqqqqqqqqqrsuwy|˹qaSF:0'   '0:ERaq˾~zvspnmlkkllmnnoooonnmllkklmnpsvz~̺qaRE:0'  &.9DQ`pö|vqmjgedccdefghjkllllkjhgfedccdegjmqv|˹p`QD9.&  %-7BO^nʻwpjea^\[ZZ[\^`bdeghiihgedb`^\[ZZ[\^aejpwɶn^OB7-%  #+5@M[k|~tld^ZVTRQQRSUWZ\_acdeedca_\ZWUSRQQRTVZ^dlt~Ų|k[M@5+#  "*3>JXgxȹtjaZTPLJIIIJLOQTWZ]_`aa`_]ZWTQOLJIIIJLPTZajtпxgXJ>3*"   (1;GUdtwkaXQKGDBAABDFILORUXZ\]]\ZXUROLIFDBAABDGKQXakwʺtdUG;1(   &/9ER`pǸ|odYQJD@=;:;<>@DGKNQTVXYYXVTQNKGD@><;:;=@DJQYdo|Ĵp`RE9/&  %-7BO]l|vi]SJC>:755579CJS]iv;|l]OB7-%  #,5@MZiyȻqdXNF?952111358<@DGKNPRSSRPNKGD@<853111259?FNXdqȹyiZM@5,#  "+4?KXgwķ{maUKB;62/../036:>AEILNPQQPNLIEA>:630/../26;BKUam{ĶwgXK?4+"  "*3>JWfuµyl_SIA:41.-,-/259<@DHKMOPPOMKHD@<952/-,-.14:AIS_ly´ufWJ>3*"  "*3>JWfuµyl_SIA:41.-,-/259<@DHKMOPPOMKHD@<952/-,-.14:AIS_ly´ufWJ>3*"  "+4?KXgwķ{maUKB;62/../036:>AEILNPQQPNLIEA>:630/../26;BKUam{ĶwgXK?4+"  #,5@MZiyȻqdXNF?952111358<@DGKNPRSSRPNKGD@<853111259?FNXdqȹyiZM@5,#  %-7BO]l|vi]SJC>:755579CJS]iv;|l]OB7-%  &/9ER`pǸ|odYQJD@=;:;<>@DGKNQTVXYYXVTQNKGD@><;:;=@DJQYdo|Ĵp`RE9/&   (1;GUdtwkaXQKGDBAABDFILORUXZ\]]\ZXUROLIFDBAABDGKQXakwʺtdUG;1(   "*3>JXgxȹtjaZTPLJIIIJLOQTWZ]_`aa`_]ZWTQOLJIIIJLPTZajtпxgXJ>3*"  #+5@M[k|~tld^ZVTRQQRSUWZ\_acdeedca_\ZWUSRQQRTVZ^dlt~Ų|k[M@5+#  %-7BO^nʻwpjea^\[ZZ[\^`bdeghiihgedb`^\[ZZ[\^aejpwɶn^OB7-%  &.9DQ`pö|vqmjgedccdefghjkllllkjhgfedccdegjmqv|˹p`QD9.&  '0:ERaq˾~zvspnmlkkllmnnoooonnmllkklmnpsvz~̺qaRE:0'   '0:FSaqƼ|ywusrqqqqqqqqqqqqqqrsuwy|˹qaSF:0'    (0:FSapļ}zxvuttssssssttuvxz}ȶpaSF:0(    (0:EQ_n~ſ~{ywvuttttuvwy{~±~n_QE:0(    '/9CO\kz|ywuttttuwy|ʻzk\OC9/'   &.7ALYft{xvtsstvx{tfYLA7.&  %,5>ITan|»|xusrrsux||naTI>5,%  #*2;DOZgsŽ}xurqqrux}ƼsgZOD;2*#  !'/7@IT_jvż~xtqppqtx~¼vj_TI@7/'!  %+2:CLV`ku¸~xspnnpsx~uk`VLC:2+%  "'.5=ENW`ir{Ǽxsommosxþ{ri`WNE=5.'"  $)06=EMU]elszxsommosxzsle]UME=60)$   %*06=CJQX^ekpuzĸysommosyzupke^XQJC=60*%    %*/5:@FLQW\afjoty~ƺ{tpnnpt{ù~ytojfa\WQLF@:5/*%    $)-27;@EJNSW[`ejpw~ɽ}wsppsw}ƻ~wpje`[WSNJE@;72-)$   #&*.26:>BFJNRW]cjqz{vttv{ɾzqjc]WRNJFB>:62.*&#   #'*-047:>BFKPV^foyĹ{yy{yof^VPKFB>:740-*'#    "%(+-147;@EKS[dnzȽŹznd[SKE@;741-+(%"   !#%(+.26JWesseWJ>4+#  !(1;FR`n}ÿƹ}n`RF;1(!  &.7BN[hwǽwh[NB7.&  #+4>IUbp~ż~pbUI>4+#  !(09DO[hu¾¾uh[OD90(!  %,5>IT`lxxl`TI>5,%  ")09BMWbmxxmbWMB90)"  %,3FOW`hov{}yvspnmmnpsvy}{voh`WOF>5.'!  #)/6>EMT[bglorssrpmjgdb`__`bdgjmprssrolgb[TME>6/)#  #)/6CHLPRTTTSRPNLJHGFFGHJLNPRSTTTRPLHC>93.)#  "',059=@CEFGGFECA@><;;;;<>@ACEFGGFEC@=950,'"  !$(,/3589:;;:9865321111235689:;;:9853/,($!  !$'),-/000/.-,+*)(((()*+,-./000/-,)'$!   "#%&&''&%$#"!! !!"#$%&''&&%#"                        !!!!!  !!!!!    #%&()***)('&%$#""""#$%&'()***)(&%#   !%(+-/13344321/.-++**++-./12344331/-+(%!   $(,047:<>???>=<:8754444578:<=>???><:740,($   "&+05:>BFHJLLLKJHFDB@????@BDFHJKLLLJHFB>:50+&"  "'-39>DINRVXZ[[ZXVSQOMKKKKMOQSVXZ[[ZXVRNID>93-'"  "(.4;BIOV[`ehjjjigeb_\ZYXXYZ\_begijjjhe`[VOIB;4.("  !'-4GQ\huƹuh\QG>71+'#    "$'*.38>FNXco|ɽ|ocXNF>83.*'$"   !#%'*,/26;@GNWakw¸·wkaWNG@;62/,*'%#!  !#&(+-0258<@DJPX`jtĻǼtj`XPJD@<8520-+(&#!  !$'*.147:=@CGKOU[bjt~Ⱦ~ywwy~·~tjb[UOKGC@=:741.*'$!   #'+/36:>AEHLOSW\agnv~ù}wsqqsw}Ⱦ~vnga\WSOLHEA>:63/+'#    %).27<@EIMRUY]aeintzɿxrnllnrxĺztniea]YURMIE@<72.)%    %*/5:@EKPV[_dhlptx}Ż{tnjhhjnt{}xtplhd_[VPKE@:5/*%    %*06IVcrþzuqmjhfeddefhjmquz²rcVI>4,$  $,5?KXfuü|wsoljgfedccdefgjlosw|ɸufXK?5,$  $,5@KXgwǽ{wsoljgfdccbbbbccdfgjlosw{νwgXK@5,$  $,5?KXgw|xtpmjgedbbaaaaaaaaaabbdegjmptx|ѿwgXK?5,$  #+4>JXfwǺzuplheca_^]]]]^^^^^^^^]]]]^_acehlpuzwfXJ>4+#  ")2=IVeu|tnida][YXWWWXXYZ[[\\[[ZYXXWWWXY[]adint|ѾueVI=2)"   (0;FTbrȹzqic^YVSRPPPPQRTUVWXXXXWVUTRQPPPPRSVY^ciqzͻrbTF;0(   &.8DQ_ozpg_YSOLJIHHIJKMOQRTTUUTTRQOMKJIHHIJLOSY_gpzɷo_QD8.&  $,6AN\k|ȸ}qf]VOJFDBAAABDFHJLNPQQQQPNLJHFDBAAABDFJOV]fq}ñ|k\NA6,$  "*4>KXgwui^UMGB><:::;=?ACFHJLMNNMLJHFCA?=;:::<>BGMU^iuνwgXK>4*"  !(1KXgwui^UMGB><:::;=?ACFHJLMNNMLJHFCA?=;:::<>BGMU^iuνwgXK>4*"  $,6AN\k|ȸ}qf]VOJFDBAAABDFHJLNPQQQQPNLJHFDBAAABDFJOV]fq}ñ|k\NA6,$  &.8DQ_ozpg_YSOLJIHHIJKMOQRTTUUTTRQOMKJIHHIJLOSY_gpzɷo_QD8.&   (0;FTbrȹzqic^YVSRPPPPQRTUVWXXXXWVUTRQPPPPRSVY^ciqzͻrbTF;0(   ")2=IVeu|tnida][YXWWWXXYZ[[\\[[ZYXXWWWXY[]adint|ѾueVI=2)"  #+4>JXfwǺzuplheca_^]]]]^^^^^^^^]]]]^_acehlpuzwfXJ>4+#  $,5?KXgw|xtpmjgedbbaaaaaaaaaabbdegjmptx|ѿwgXK?5,$  $,5@KXgwǽ{wsoljgfdccbbbbccdfgjlosw{νwgXK@5,$  $,5?KXfuü|wsoljgfedccdefgjlosw|ɸufXK?5,$  $,4>IVcrþzuqmjhfeddefhjmquz²rcVI>4,$  $+3=GS`m|zupligeddegilpuzƸ|m`SG=3+$  #*2;DO[huxsnjgeddegjnsxƺuh[OD;2*#  !(/8AKVbn{|uokgeddegkou|¸{nbVKA8/(!   &-4=FP[fq}Ľwqkgeccegkqw}qf[PF=4-&   $*18AJS]gr|ļyrlheccehlry|rg]SJA81*$  !'-4;CLT]fox¸{tmheccehmt{xof]TLC;4-'!  #)/5AEHLOSW\agnv~ù}wsqqsw}Ⱦ~vnga\WSOLHEA>:63/+'#   !$'*.147:=@CGKOU[bjt~Ⱦ~ywwy~·~tjb[UOKGC@=:741.*'$!  !#&(+-0258<@DJPX`jtĻǼtj`XPJD@<8520-+(&#!  !#%'*,/26;@GNWakw¸·wkaWNG@;62/,*'%#!   "$'*.38>FNXco|ɽ|ocXNF>83.*'$"    #'+17>GQ\huƹuh\QG>71+'#   !&+18AJUan|¹ö|naUJA81+&!  !&,3;EO[iwüwi[OE;3,&!  !'.6@JVdrſͿrdVJ@6.'!  #*2DINRVXZ[[ZXVSQOMKKKKMOQSVXZ[[ZXVRNID>93-'"  "&+05:>BFHJLLLKJHFDB@????@BDFHJKLLLJHFB>:50+&"   $(,047:<>???>=<:8754444578:<=>???><:740,($   !%(+-/13344321/.-++**++-./12344331/-+(%!   #%&()***)('&%$#""""#$%&'()***)(&%#    !!!!!  !!!!!                        !"#####"!  !"#####"!   !#&(*+,,-,,+)('&%$$$$%&'()+,,-,,+*(&#!  !%(+.135677765320/.----./023567776531.+(%!   $(,048;>@BCCCBA?=;:877778:;=?ABCCCB@>;840,($   !&*05:?CGKMOQQQPNLJHFDCBBCDFHJLNPQQQOMKGC?:50*&!  !&,28>DJOTX\^```_][XUSQOOOOQSUX[]_```^\XTOJD>82,&!  !&,29@HOV\bgknpqqomjgda_]\\]_adgjmoqqpnkgb\VOH@92,&!  %+29AJRZbjqw|~{xtqnlkklnqtx{~|wqjbZRJA92+%  #)08AJS]fpx~|{{|~xpf]SJA80)#   &-5>HR]hr}}rh]RH>5-&   #*2:DOZfr~~rfZOD:2*#  %-6?JVbo}}obVJ?6-%  !(09DP\jxſǼxj\PD90(!  #*3=HUbqɼqbUH=3*#  %,6@LYhwƷwhYL@6,%  &/8CP]l|Ͽ|l]PC8/&  !(1:FSapƵpaSF:1(!  "*2=HUdtʹtdUH=2*"  $+4?KXgwͼwgXK?4+$  &-7AM[iyϾyi[MA7-&  !(09DP]l||l]PD90(!  $+3HR^iv}unhb^ZXWWXZ^bhnu}ƽvi^RH>6.'   !(/8AKWcp}ÿ~wpje`\YWVVWY\`ejpw~}pcWKA8/(!  ")19CNZgu~xqlfb^[XWVVWX[^bflqx~̾ugZNC91)"  ")1:EP]jyž|vqkgb_[YWVUUVWY[_bgkqv|Ǹyj]PE:1)"  ")1;EQ^l|ú}xsniea^[YWVUTTUVWY[^aeinsx}ξ|l^QE;1)"  !)1:EQ_m}ʿ|wrnjfb_\YWVUTSSSSTUVWY\_bfjnrw|°}m_QE:1)!  !(0:DQ^m}ƺ{vqlhd`]ZXVUSSRRQQQQRRSSUVXZ]`dhlqv{IJ}m^QD:0(!   '/8CO]l|~wpkfa^ZWUSRPPOOOOOOOOOOOOPPRSUWZ^afkpw~ı|l]OC8/'   %-6AM[jzʻ}tlf`[WTQOMLKKKKKLLLMMLLLKKKKKLMOQTW[`flt}¯zj[MA6-%  #+4?JXgvĴ~sjb\VQNKHGFEEEFGGHIIJJIIHGGFEEEFGHKNQV\bjs~оvgXJ?4+#  ")2@ABCDDCBA@>=;:9999;=@DJPXbmyŴn_QD9/'   %-6AM[jzͽqeZQIB=9643334579:<>?@AA@?><:9754333469=BIQZeqϿzj[MA6-%  #+4>JWfuŶxj^SJB<730/...013579;<=>>=<;975310.../0374+#  !)160,(&%$%&'),.135678876531.,)'&%$%&(,06>GQ]jyǹzk]OC8.&  %.7BN[jywi\PE<5/*'%##$%&)+-024677776420-+)&%$##%'*/560,(&%$%&'),.135678876531.,)'&%$%&(,06>GQ]jyǹzk]OC8.&   '09EQ_n}ǹ|n`TJA93.+('&'()+-02468999986420-+)('&'(+.39AJT`n|ʽ}n_QE90'   !)1JWfuŶxj^SJB<730/...013579;<=>>=<;975310.../0374+#  %-6AM[jzͽqeZQIB=9643334579:<>?@AA@?><:9754333469=BIQZeqϿzj[MA6-%   '/9DQ_nŵymbXPJD@=;9999:;=>@ABCDDCBA@>=;:9999;=@DJPXbmyŴn_QD9/'   ")2HR^iv}unhb^ZXWWXZ^bhnu}ƽvi^RH>6.'   %+3;DNXbnyyqjd_[YWWY[_djqy¼ynbXND;3+%  #)07?HQ[eoyÿ~umfa]ZXXZ]afmu~¿yoe[QH?70)#  !&,3:BJS\emv~ypic^[YY[^cipy~vme\SJB:3,&!  #)/5HR]hr}}rh]RH>5-&   #)08AJS]fpx~|{{|~xpf]SJA80)#  %+29AJRZbjqw|~{xtqnlkklnqtx{~|wqjbZRJA92+%  !&,29@HOV\bgknpqqomjgda_]\\]_adgjmoqqpnkgb\VOH@92,&!  !&,28>DJOTX\^```_][XUSQOOOOQSUX[]_```^\XTOJD>82,&!  !&*05:?CGKMOQQQPNLJHFDCBBCDFHJLNPQQQOMKGC?:50*&!   $(,048;>@BCCCBA?=;:877778:;=?ABCCCB@>;840,($   !%(+.135677765320/.----./023567776531.+(%!  !#&(*+,,-,,+)('&%$$$$%&'()+,,-,,+*(&#!   !"#####"!  !"#####"!                      !#$%%&&%$$"!  !"$$%&&%%$#!  !$')+-.////.-+*)'&&%%&&')*+-.////.-+)'$!  !%(,/2578::::9764210/../0124679::::8752/,(%!   $(,059<@BDFGGFEDB@><:9999:<>@BDEFGGFDB@<950,($    %*/49?CHLORTUUUSROMKHGEEEEGHKMORSUUUTROLHC?94/*%    %+17=CIOUZ^aceeeca^\YVTSRRSTVY\^aceeeca^ZUOIC=71+%    %+18?FNU\bhmqtvvvtrolheca``acehlortvvvtqmhb\UNF?81+%   #)07?GPXaiqx~}yurpoopruy}~xqiaXPG?70)#  !'.5>GPZdmwwmdZPG>5.'!  $+2;DNYdozzodYND;2+$   '.7@JUamzzmaUJ@7.'   #*2;EP\iwýwi\PE;2*#  %,5?JVcq¾ŹqcVJ?5,%   &.8BN[ixŶxi[NB8.&   !(0:EQ_n}}n_QE:0(!  ")2JWfuͼufWJ>4+#  $,5@LYhxxhYL@5,$  &.7AM[jz°zj[MA7.&  !'/8CO]l|ñ|l]OC8/'!  ")1:EQ^m}±}m^QE:1)"  $+3CGKORUX[]_acehlpuz{smgdbbdgms{zuplheca_][XUROKGC>:50+'"  "',16<;;;;;;<<====<<;;;;;;<>?BEINT[clwzk\OC8/'   %,5@KXfvƶ{odZRKFA=;87666667899::::99876666678;=AFKRZdo{̻vfXK@5,%  "*2:642100123456777777654321001246:>DKS\gsŴqbTH<2*"   '09DP^l|Ǹzl`ULD=830.-,,,-./023445544320/.-,,,-.038=DLU`lzξ|l^PD90'   %-6ALYhwtfZOF>72.+)('(()*,-/01222210/-,*)(('()+.27>FOZftǸwhYLA6-%  #+4>IVcrȺ}naUJA93.*'%$$$%&()+-./0000/.-+)(&%$$$%'*.39AJUan}rcVI>4+#  ")2;FS`n~µxj]QF=6/*'$"!!"#$&')+,-.//.-,+)'&$#"!!"$'*/6=FQ]jxȻ~n`SF;2)"  !(0:DQ^l{˿ugZND;3-($"  !"$&(*+,-..-,+*(&$"!  "$(-3;DNZguķ{l^QD:0(!   '/9DO\kyɽseXMB92,'#! "#%')*,----,*)'%#" !#',29BMXesµyk\OD9/'    '/9DO\kyɽseXMB92,'#! "#%')*,----,*)'%#" !#',29BMXesµyk\OD9/'   !(0:DQ^l{˿ugZND;3-($"  !"$&(*+,-..-,+*(&$"!  "$(-3;DNZguķ{l^QD:0(!  ")2;FS`n~µxj]QF=6/*'$"!!"#$&')+,-.//.-,+)'&$#"!!"$'*/6=FQ]jxȻ~n`SF;2)"  #+4>IVcrȺ}naUJA93.*'%$$$%&()+-./0000/.-+)(&%$$$%'*.39AJUan}rcVI>4+#  %-6ALYhwtfZOF>72.+)('(()*,-/01222210/-,*)(('()+.27>FOZftǸwhYLA6-%   '09DP^l|Ǹzl`ULD=830.-,,,-./023445544320/.-,,,-.038=DLU`lzξ|l^PD90'   "*2:642100123456777777654321001246:>DKS\gsŴqbTH<2*"  %,5@KXfvƶ{odZRKFA=;87666667899::::99876666678;=AFKRZdo{̻vfXK@5,%   '/8CO\kzͽwlc[TNIEB?><;;;;;;<<====<<;;;;;;<>?BEINT[clwzk\OC8/'   ")1;FR_n~ôuld]WRNJGECA@????????????????@ACEGJNRW]dluIJ~n_RF;1)"  #+3=HUbqȹ}umfa[WSOLJHFECCBBBBBBBBBBCCEFHJLOSW[afmu}ǵqbUH=3+#  %,5?JWds˾~wpkea\XUQNLJHGEEDDDDDDEEGHJLNQUX\aekpw~ȶsdWJ?5,%  &.6@KXetzuojfa]YUROLJIGFFEEFFGIJLORUY]afjouzƵteXK@6.&   '.7ALXesøztoje`\XTQNKJHGGGGHJKNQTX\`ejotzóseXLA7.'    '/7ALWdrú~ysnhc^YUQNLJIHHIJLNQUY^chnsy~̽rdWLA7/'    '.7@KVbo}»|voic^YTQNKJIIJKNQTY^ciov|ö}obVK@7.'    &.6?IS_kxĿ~wpic]XSPMKJJKMPSX]cipw~Źxk_SI?6.&   %,4=FP[fr~ÿ~vnga[VRNLKKLNRV[agnv~~rf[PF=4,%  $+2:CLV`kv¿|tle^XTPNLLNPTX^elt|þvk`VLC:2+$  ")/7?GPZcmwyqia[VRONNORV[aiqywmcZPG?7/)"   &,3:BJR[dlu}~ume^YURPPRUY^emu~}uld[RJB:3,&   #)/6CGKORUX[]_acehlpuz{smgdbbdgms{zuplheca_][XUROKGC>:50+'"  "&*.269=@CFIKMOQSVX\`djpx½{tokiikot{xpjd`\XVSQOMKIFC@=962.*&"  !$'+.1479;=?ACEGJMPUZ`goxĿ}xtrrtx}xog`ZUPMJGECA?=;9741.+'$!  "$'),.023578:JWfuͼufWJ>4+#  ")2GPZdmwwmdZPG>5.'!  #)07?GPXaiqx~}yurpoopruy}~xqiaXPG?70)#   %+18?FNU\bhmqtvvvtrolheca``acehlortvvvtqmhb\UNF?81+%    %+17=CIOUZ^aceeeca^\YVTSRRSTVY\^aceeeca^ZUOIC=71+%    %*/49?CHLORTUUUSROMKHGEEEEGHKMORSUUUTROLHC?94/*%    $(,059<@BDFGGFEDB@><:9999:<>@BDEFGGFDB@<950,($   !%(,/2578::::9764210/../0124679::::8752/,(%!  !$')+-.////.-+*)'&&%%&&')*+-.////.-+)'$!  !#$%%&&%$$"!  !"$$%&&%%$#!                       "$%&'((''&%$"!  !"$%&''(('&%$"   "%'*,.0111110.-+*)''&&'')*+-.0111110.,*'%"  "%),0368:<===<;9864210000124689;<===<:8630,)%"   $(,159=ADFHIJJIHFDB@><;::;<>@BDFHIJJIHFDA=951,($    %*/49>DHMQTVXYYXVTROMJHGFFGHJMORTVXYYXVTQMHD>94/*%    %*06ITao~;~oaTI>5.("  !%+18AKVbp~ɻ~pbVKA81+%!   "%).4;DMXdqĸqdXMD;4.)%"    !"$%(+.39@HQ[gsºsg[QH@93.+(%$"!   !"#$%&'()*,.149>ELU_jvļżvj_ULE>941.,*)('&%$#"!  !#%')+,-./012468;@EKRZdnyþyndZRKE@;864210/.-,+)'%#!  !$'*,/1346789:;=>ADHLRYais}{zz{}siaYRLHDA>=;:9876431/,*'$!  #&*-147:<>@ACDEFGIKMQUZ`goxytpooptyxog`ZUQMKIGFEDCA@><:741-*&#  #(,049<@CFIKMNPQRSTVX[_ciov~}uojgeegjou}~voic_[XVTSRQPNMKIFC@<940,(#  #(-27DIOTY]aehjlmnopqrsvx||tle_ZWVVWZ_elt||xvsrqponmljhea]YTOID>83-("  !&,28?ELRY_ejosvy|}~~ume^YTQPPQTY^emu~~}|yvsoje_YRLE?82,&!  #)06=ELT[cjqw}wog_YTOMKKMOTY_gow}wqjc[TLE=60)#   &,3;BKS\dmu}yqib[TOKIGGIKOT[biqy}umd\SKB;3,&   "(/6?GPYclv{sld]VQLHFEEFHLQV]dls{vlcYPG?6/("  #*19BKU_it|unf_XRMIFCBBCFIMRX_fnu|ti_UKB91*#  %+3;ENYdo{½|uohaZTOJFCA@@ACFJOTZahou|ļ{odYNE;3+%  %,4=GQ\htƿ{unhb\VPLGDB@??@BDGLPV\bhnu{ɾth\QG=4,%  &-5>HS^kxƽ}xsmga\VQLHEB@>>>>@BEHLQV\agmsx}ȼxk^SH>5-&  %-5>HS`lzzupje`[VQLHEB@>=<<=>@BEHLQV[`ejpuz´zl`SH>5-%  %,4>HS`m{·|vqlgb]XTOKHDB?><;;;;<>?BDHKOTX]bglqv|Ǹ{m`SH>4,%  $+3=;::99::;=>@CFIMQUY^chnt{ʺ{l_RG<3+$  "*2;EP]ky{ske_ZUQMIFCA><;:98888889:;<>ACFIMQUZ_eks{ʺyk]PE;2*"  !(09CNZhw;}skc\VQMIEB?=;:87766666666778:;=?BEIMQV\cks}ɸwhZNC90(!  &-6@KWesɺvlc[TNIEA>;9765444444444444445679;>AEINT[clvƵseWK@6-&  $+3=GS`o~ĵ{od[SLFA=:75321111111111111111112357:=AFLS[do{~o`SG=3+$  !(09DO\jyξth]SKD?:631/.-----..//////..-----./136:?DKS]ht˻yj\OD90(!  &-6@KWetǸzmaVME>840-+*))))**+,,----,,+**))))*+-048>EMVamzĴteWK@6-&  #*382.+('%%%%&''()**++**)(''&%%%%'(+.28>FPZgt˼}n`SG<3*#  !(09CO[ixǹ|naUJA93-)&$""!""#$%&'(())(('&%$#""!""$&)-39AJUan|ĵxi[OC90(!  &-6@KWdswi\PF=5/*&#  !"#$%&''''&%$#"!  #&*/5=FP\iwʽsdWK@6-&  $+4=HTao}ȼseXMB92,'#  !#$%%&&%%$#!  #',29BMXesĸ}oaTH=4+$  #*2;FR^lzĸ~pbVJ@70)$! "#$$%%$$#" !$)07@JVbp~zl^RF;2*#  ")1;EP]ky¶}oaTI?6.(#  !"#$$$$#"!  #(.6?ITao}Ⱦyk]PE;1)"  ")1;EP]ky¶}oaTI?6.(#  !"#$$$$#"!  #(.6?ITao}Ⱦyk]PE;1)"  #*2;FR^lzĸ~pbVJ@70)$! "#$$%%$$#" !$)07@JVbp~zl^RF;2*#  $+4=HTao}ȼseXMB92,'#  !#$%%&&%%$#!  #',29BMXesĸ}oaTH=4+$  &-6@KWdswi\PF=5/*&#  !"#$%&''''&%$#"!  #&*/5=FP\iwʽsdWK@6-&  !(09CO[ixǹ|naUJA93-)&$""!""#$%&'(())(('&%$#""!""$&)-39AJUan|ĵxi[OC90(!  #*382.+('%%%%&''()**++**)(''&%%%%'(+.28>FPZgt˼}n`SG<3*#  &-6@KWetǸzmaVME>840-+*))))**+,,----,,+**))))*+-048>EMVamzĴteWK@6-&  !(09DO\jyξth]SKD?:631/.-----..//////..-----./136:?DKS]ht˻yj\OD90(!  $+3=GS`o~ĵ{od[SLFA=:75321111111111111111112357:=AFLS[do{~o`SG=3+$  &-6@KWesɺvlc[TNIEA>;9765444444444444445679;>AEINT[clvƵseWK@6-&  !(09CNZhw;}skc\VQMIEB?=;:87766666666778:;=?BEIMQV\cks}ɸwhZNC90(!  "*2;EP]ky{ske_ZUQMIFCA><;:98888889:;<>ACFIMQUZ_eks{ʺyk]PE;2*"  $+3=;::99::;=>@CFIMQUY^chnt{ʺ{l_RG<3+$  %,4>HS`m{·|vqlgb]XTOKHDB?><;;;;<>?BDHKOTX]bglqv|Ǹ{m`SH>4,%  %-5>HS`lzzupje`[VQLHEB@>=<<=>@BEHLQV[`ejpuz´zl`SH>5-%  &-5>HS^kxƽ}xsmga\VQLHEB@>>>>@BEHLQV\agmsx}ȼxk^SH>5-&  %,4=GQ\htƿ{unhb\VPLGDB@??@BDGLPV\bhnu{ɾth\QG=4,%  %+3;ENYdo{½|uohaZTOJFCA@@ACFJOTZahou|ļ{odYNE;3+%  #*19BKU_it|unf_XRMIFCBBCFIMRX_fnu|ti_UKB91*#  "(/6?GPYclv{sld]VQLHFEEFHLQV]dls{vlcYPG?6/("   &,3;BKS\dmu}yqib[TOKIGGIKOT[biqy}umd\SKB;3,&   #)06=ELT[cjqw}wog_YTOMKKMOTY_gow}wqjc[TLE=60)#  !&,28?ELRY_ejosvy|}~~ume^YTQPPQTY^emu~~}|yvsoje_YRLE?82,&!  "(-38>DIOTY]aehjlmnopqrsvx||tle_ZWVVWZ_elt||xvsrqponmljhea]YTOID>83-("  #(-27@ACDEFGIKMQUZ`goxytpooptyxog`ZUQMKIGFEDCA@><:741-*&#  !$'*,/1346789:;=>ADHLRYais}{zz{}siaYRLHDA>=;:9876431/,*'$!  !#%')+,-./012468;@EKRZdnyþyndZRKE@;864210/.-,+)'%#!  !"#$%&'()*,.149>ELU_jvļżvj_ULE>941.,*)('&%$#"!   !"$%(+.39@HQ[gsºsg[QH@93.+(%$"!    "%).4;DMXdqĸqdXMD;4.)%"   !%+18AKVbp~ɻ~pbVKA81+%!  "(.5>ITao~;~oaTI>5.("   %,3=GS`o~±~o`SG=3,%   $*2;FR_n~ij~n_RF;2*$  ")1:EQ_n~ƴ~n_QE:1)"  !(09DP^m~ƴ~m^PD90(!   '/8CO]l|Ų|l]OC8/'    &.7BN[jz°zj[NB7.&   %-6ALYhxνxhYLA6-%  $,5?JWetǶteWJ?5,$  #+3=GSao~̾~oaSG=3+#  ")1:DP\jxxj\PD:1)"   '.7@KWcp~ȿ~pcWK@7.'   %,4DHMQTVXYYXVTROMJHGFFGHJMORTVXYYXVTQMHD>94/*%    $(,159=ADFHIJJIHFDB@><;::;<>@BDFHIJJIHFDA=951,($   "%),0368:<===<;9864210000124689;<===<:8630,)%"  "%'*,.0111110.-+*)''&&'')*+-.0111110.,*'%"   "$%&'((''&%$"!  !"$%&''(('&%$"                          !!!!!  !!!!!   !#%'())**)('&%#"!  !"#%&'()**))('%#!   #&)+-/123443210.,+)(''''()+,.012344321/-+)&#   #&*-147:<=????>=;97532100123579;=>????=<:741-*&#   $(-16:>BEHJLMMLKJHECA?=<;;<=?ACEHJKLMMLJHEB>:61-($   !%*/49?DIMRUXZ[\[ZXVSQNKIHGGHIKNQSVXZ[\[ZXURMID?94/*%!   %*05GQ\gr}}rg\QG>6.'!  #*19CMXco|þľ|ocXMC91*#  %,4=GR^jwþźwj^RG=4,%   '.6@JVcpǺpcVJ@6.'   !(/8BMZgvĵvgZMB8/(!  ")1:DP\kzͼzk\PD:1)"  #)1;EQ_m}±}m_QE;1)#  #*2;FR`oƴo`RF;2*#  #*2HS`n|˼|n`SH>6.(#  "&+07@IT`m{ŷ{m`TI@70+&"   !#&).3:BKUamzƾʾzmaUKB:3.)&#!    !!"###$$%'(+.27=EMWbmzƾ¸zmbWME=72.+('%$$###"!!    "$&'())**++,-.037@BEHMSZajs}{xvvx{}sjaZSMHEB@>==<<<;::87520-*&#   $(,048;>@BDEFFGGGGHIKMPUZ`fnvztoljjlotzvnf`ZUPMKIHGGGGFFEDB@>;840,($    %).38<@DGJMOPQRSSSSSTUWZ]aflsz}voieb``beiov}zslfa]ZWUTSSSSSRQPOMJGD@<83.)%   $)/4:?DINRUX[]^_``````abdfinrx~{sle`\YWWY\`els{~xrnifdba``````_^][XURNID?:4/)$  #(.4:AGMRX]aehjlnnoonnnnnopruy}zrjc]XTQOOQTX]cjrz}yurponnnnnoonnljhea]XRMGA:4.(#  !&,39@GNU\bhmrvy{}~~~~}|{{{{|~yrjc\VQMJIIJMQV\cjry~|{{{{|}~~~~}{yvrmhb\UNG@93,&!  #)07?FNV^elsyzrkc\VPKGEDDEGKPV\ckrzysle^VNF?70)#   &,3;CLT]fnv~zsle]WPKFCA??ACFKPW]elsz~vnf]TLC;3,&   !(/6?GQZdmwzsmf_XRLGB?=<<=?BGLRX_fmszwmdZQG?6/(!  #)19BKU_it~~ysmg`YSMHC?<:99:;864210////012468;>BEIMRW\agnv~ͿtgZNC:1)"  !'/8ALWdrõyog`ZTOJFB?<96421//.----.//12469ITan}³~si`YRLGC?<96420/.-,,,++,,,-./024695-%  #*2;EQ]jx;xlbYRKE@<8530/-,++**********++,-/0358<@EKRYblxƶxj]QE;2*#  !(/8BLXesɺrf\SKD>952/-+*)(((((((((((((((()*+-/259>DKS\frseXLB8/(!  %,4>HT`n|ôxl`ULD>83/,*('&%%%%%%%&&&&%%%%%%%&'(*,/38>DLU`lxɺ|n`TH>4,%  #)1:DO[hv˽reZOF>82.*'%$#"""""###$$$$###"""""#$%'*.28>FOZervh[OD:1)#   '.6@JVbp~Ķ{m`TJA92-)%#!  !!""""!!  !#%)-29AJT`m{ǹ~pbVJ@6.'   $+35.(##(.5>HS_m{Ⱦ|oaUJ?6.'   %,4=HS_lyĺxj]QE<3,&!!&,35.(##(.5>HS_m{Ⱦ|oaUJ?6.'   ")09BMYes÷pcVKA81*%!!%*18AKVcpĸseYMB90)"  $+382.*'%$#"""""###$$$$###"""""#$%'*.28>FOZervh[OD:1)#  %,4>HT`n|ôxl`ULD>83/,*('&%%%%%%%&&&&%%%%%%%&'(*,/38>DLU`lxɺ|n`TH>4,%  !(/8BLXesɺrf\SKD>952/-+*)(((((((((((((((()*+-/259>DKS\frseXLB8/(!  #*2;EQ]jx;xlbYRKE@<8530/-,++**********++,-/0358<@EKRYblxƶxj]QE;2*#  %-5>ITan}³~si`YRLGC?<96420/.-,,,++,,,-./024695-%  !'/8ALWdrõyog`ZTOJFB?<96421//.----.//12469;864210////012468;>BEIMRW\agnv~ͿtgZNC:1)"  #*2;EP\hu¶|uoid^ZUPLHD@=:753210012357:=@DHLPUZ^diou|˽uh\PE;2*#  $+3@BDEFFGGGGHIKMPUZ`fnvztoljjlotzvnf`ZUPMKIHGGGGFFEDB@>;840,($   #&*-02578::;<<<==>@BEHMSZajs}{xvvx{}sjaZSMHEB@>==<<<;::87520-*&#  !$&)+-.01122333467:=BGMU]fp{{pf]UMGB=:76433322110.-+)&$!   "$&'())**++,-.037HS`n|˼|n`SH>6.(#  !'-4=GS`n~~n`SG=4-'!   %,4=GSaoijoaSG=4,%   $+3GQ\gr}}rg\QG>6.'!  %+29BJT^gq{{qg^TJB92+%  "'-4BEHJLMMLKJHECA?=<;;<=?ACEHJKLMMLJHEB>:61-($   #&*-147:<=????>=;97532100123579;=>????=<:741-*&#   #&)+-/123443210.,+)(''''()+,.012344321/-+)&#   !#%'())**)('&%#"!  !"#%&'()**))('%#!   !!!!!  !!!!!                          !""###""!  !""###""!   !#%'(*++,,+*)('%$"!  !"$%'()*+,,++*('%#!  !$'*-/13456665420/-+)(''''()+-/02456665431/-*'$!   $'+/258;>?ABBBA?><:753210012357:<>?ABBBA?>;852/+'$   !%).27;?CFILNOOONMKIFCA?=<;;<=?ACFIKMNOOONLIFC?;72.)%!  !&*05:?DINSVY\^^^^\ZWTQNLIHGGHILNQTWZ\^^^^\YVSNID?:50*&!   %*06HT`n|ɺ|n`TH>5-&   !'.6?JVcqqcVJ?6.'!  !'.6@KWdsƵsdWK@6.'!  !'.6@KWetʸteWK@6.'!  !'.6@KWet˹teWK@6.'!  !'.6?JWdsʸsdWJ?6.'!  "'.6?JVcrǶrcVJ?6.'"  "(.6>ITbpòpbTI>6.("  #(.6>HS`n};}n`SH>6.(#  !%)/6>HS_lzƸzl_SH>6/)%!  !$'+17?HR^jx½˿xj^RH?71+'$!   !!!!!""#%'*.39@HR]iu·ui]RH@93.*'%#""!!!!!    "#$&&''''''(()+.16;BJS]htºth]SJB;61.+)((''''''&&$#"   !#&(*+,-......../136:?ELT^hs~~sh^TLE?:631/........-,+*(&#!   #&),/134566666656679;?CIOW_hr|~~|rh_WOIC?;976656666665431/,)&#   !%)-0479<=?@@@@??>>>?@BEIMSZajr{{vsqqsv{{rjaZSMIEB@?>>>??@@@@?=<9740-)%!  !&*/38<<>@CHMRY_flrw{~|{{{{}}wpiaXPH@80)#  %,3;DMV_hqy~|yupke_YRLGB>;9889;>BGLRY_ekpuy|~yqh_VMD;3,%  !'.6?HQ[eoy~|zwsoje_YSMGB>:754457:>BGMSY_ejoswz|~yoe[QH?6.'!  "(08AKU_ju~|zxuqmid_YSMHC>:64211246:>CHMSY_dimquxz|~uj_UKA80(" ")1:CMXcny|yvsolgc^YSNHC>:631/../136:>CHNSY^cglosvy|ſyncXMC:1)" #*2;DNYeq}ǿ~zvrnjea\XSMHC?:731.-,,-.137:?CHMSX\aejnrvz~}qeYND;2*# #*2;DOZfr|vqmhd_[VQMHC?;731.,++++,.137;?CHMQV[_dhmqv|ǽrfZOD;2*# ")1:DOZfrǼysmgb]YTOKGB>:730.,*))))*,.037:>BGKOTY]bgmsyrfZOD:1)" "(09CMYeq~vnga\WRMIEA=9630-+*)(''()*+-0369=AEIMRW\agnv~öqeYMC90("   '/7AKVbo}ö{rib[UPKGB?;741/-+)('&&&&'()+-/147;?BGKPU[bir{õ}obVKA7/'   %-5>HS_lyĶwmd\UOID@<8520-+)('&%%$$%%&'()+-0258<@DIOU\dmwyl_SH>5-%  #*2;EP[huõ~rh^VOHC>:630-+)(&%$$######$$%&()+-036:>CHOV^hr~˽uh[PE;2*#  !(/8ALWcp~zmbYPIB=840-+)'%$#"""!!!!!!"""#$%')+-048=BIPYbmzƸ~pcWLA8/(!  %,4=GR^jxʼuh]SJC<72.+(&$#"!  !"#$&(+.27HS_kx˿wj]RH?82,($"  "$(,28?HR]jwʽxk_SH>5.'   $*2:CNYerŸreXMC;3-($  $(-3;CMXerreYNC:2*$  !(/6?IT_lxȾ{m`TI?7/)$  $)/7?IT`m{Ĺxl_TI?6/(!  %,3HS_kx˿wj]RH?82,($"  "$(,28?HR]jwʽxk_SH>5.'   #)19CMXdqŷ}ocXME=71-)&$"  "$&)-17=EMXco}ŸqdXMC91)#  %,4=GR^jxʼuh]SJC<72.+(&$#"!  !"#$&(+.27:630-+)(&%$$######$$%&()+-036:>CHOV^hr~˽uh[PE;2*#  %-5>HS_lyĶwmd\UOID@<8520-+)('&%%$$%%&'()+-0258<@DIOU\dmwyl_SH>5-%   '/7AKVbo}ö{rib[UPKGB?;741/-+)('&&&&'()+-/147;?BGKPU[bir{õ}obVKA7/'   "(09CMYeq~vnga\WRMIEA=9630-+*)(''()*+-0369=AEIMRW\agnv~öqeYMC90(" ")1:DOZfrǼysmgb]YTOKGB>:730.,*))))*,.037:>BGKOTY]bgmsyrfZOD:1)" #*2;DOZfr|vqmhd_[VQMHC?;731.,++++,.137;?CHMQV[_dhmqv|ǽrfZOD;2*# #*2;DNYeq}ǿ~zvrnjea\XSMHC?:731.-,,-.137:?CHMSX\aejnrvz~}qeYND;2*# ")1:CMXcny|yvsolgc^YSNHC>:631/../136:>CHNSY^cglosvy|ſyncXMC:1)" "(08AKU_ju~|zxuqmid_YSMHC>:64211246:>CHMSY_dimquxz|~uj_UKA80("  !'.6?HQ[eoy~|zwsoje_YSMGB>:754457:>BGMSY_ejoswz|~yoe[QH?6.'!  %,3;DMV_hqy~|yupke_YRLGB>;9889;>BGLRY_ekpuy|~yqh_VMD;3,%  #)08@HPXaipw}}{{{{|~{wrlf_YRMHC@><<>@CHMRY_flrw{~|{{{{}}wpiaXPH@80)#   &-4;BJQY`flrvz}~|zxvtsrrstvy{~~ysmf`YSNIFCBBCFINSY`fmsy~~{yvtsrrstvxz|~}zvrlf`YQJB;4-&   #)/6>>?@BEIMSZajr{{vsqqsv{{rjaZSMIEB@?>>>??@@@@?=<9740-)%!   #&),/134566666656679;?CIOW_hr|~~|rh_WOIC?;976656666665431/,)&#   !#&(*+,-......../136:?ELT^hs~~sh^TLE?:631/........-,+*(&#!   "#$&&''''''(()+.16;BJS]htºth]SJB;61.+)((''''''&&$#"    !!!!!""#%'*.39@HR]iu·ui]RH@93.*'%#""!!!!!   !$'+17?HR^jx½˿xj^RH?71+'$!  !%)/6>HS_lzƸzl_SH>6/)%!  #(.6>HS`n};}n`SH>6.(#  "(.6>ITbpòpbTI>6.("  "'.6?JVcrǶrcVJ?6.'"  !'.6?JWdsʸsdWJ?6.'!  !'.6@KWet˹teWK@6.'!  !'.6@KWetʸteWK@6.'!  !'.6@KWdsƵsdWK@6.'!  !'.6?JVcqqcVJ?6.'!   &-5>HT`n|ɺ|n`TH>5-&   %,4?ABBBA?><:753210012357:<>?ABBBA?>;852/+'$   !$'*-/13456665420/-+)(''''()+-/02456665431/-*'$!  !#%'(*++,,+*)('%$"!  !"$%'()*+,,++*('%#!   !""###""!  !""###""!                            "#$%%%%%$#"  "#$%%%%%$#"    #%')+,-....-,*)'&$"!  !"$&')*,-....-,+)'%#    #&),/1457888876531/-+)('&&'()+-/1356788887541/,)&#   "%)-148;=@BCDDDCB@><:753100001357:<>@BCDDDCB@=;841-)%"  "&+/48=AEHKNPQRRQPNLIFCA><;::;<>ACFILNPQRRQPNKHEA=84/+&"  "',16;AFKPTX[^`aa`_]ZWTQNKIGFFGIKNQTWZ]_`aa`^[XTPKFA;61,'"  !&+17=CIPV[aejmoqqqpmkgc`\YVTTTTVY\`cgkmpqqqomjea[VPIC=71+&!  $*06=DKRYagnty}|xtplhecbbcehlptx|}ytngaYRKD=60*$  "'-4;CJS[clt{|xurqqrux|{tlc[SJC;4-'"  $*18@HQZdmwwmdZQH@81*$  !&-4GQ[gtüĸtg[QG>71-)&$"!!!!   !#$%%&&&&%%%&')+.38?GPZeq}»ĺ}qeZPG?83.+)'&%%%&&&&%%$#!   #%')*+,,,,,+++++-.15:@GOXcnyþĿyncXOG@:51.-+++++,,,,,+*)'%#   #&),.02334433211011358?@BEHMSYaiqyytpmllmptyyqiaYSMHEB@?>?@ABCEFFFFECA?;84/+&"  "',16;@DHKNPQQQQONLKIHGGGHJMQV[bhov}~xrmhda``adhmrx~}vohb[VQMJHGGGHIKLNOQQQQPNKHD@;61,'"  !&,28>CINRVY[]]]][ZXVTRQPOPQSVZ^ciouz}xrlfa\YVUUVY\aflrx}zuoic^ZVSQPOPQRTVXZ[]]]][YVRNIC>82,&!  %+18>ELRW\adgijjjigeb`^[ZYXXY[^aejosx||xsmgb\WROLKKLORW\bgmsx||xsojea^[YXXYZ[^`begijjjigda\WRLE>81+%  #)/6>EMT[aglptvxxxwuspmjgecaaaacehkorvxz||{zwsoid^XSNJFDCCDFJNSX^dioswz{||zxvrokhecaaaacegjmpsuwxxxvtplga[TME>6/)#   &,4;CLT\dkrx}~{xtqnljihhikmortuwwvusokfa[VPKFB?=<<=?BFKPV[afkosuvwwutromkihhijlnqtx{~}xrkd\TLC;4,&   ")08@IR[dlt|~zvsqonnnopqrssrqolhd_ZTNID@<976679<@DINTZ_dhloqrssrqponnnoqsvz~|tld[RI@80)" $+3;DNWakt}}yvtrqqpppponlifb]XSNHC>:74211247:>CHNSX]bfilnoppppqqrtvy}}tkaWND;3+$ &-5>HR\gq{}zwtrqonmkigd`\WRMHC>9520.--.0259>CHMRW\`dgikmnoqrtwz}{qg\RH>5-&  '/7AJU`kv{wsqnljgeb^ZVQLGB>951.,+**+,.159>BGLQVZ^begjlnqsw{vk`UJA7/'  !(09BLWcnzſ~ytpmifc`\YUPLGB>951.+)(''()+.159>BGLPUY\`cfimpty~ſzncWLB90(! !(09CMYdp}ļztojfb_[WSOKFB=951.+)'%%%%')+.159=BFKOSW[_bfjotzǿ}pdYMC90(! !(09CMYeq~ƽ{tnhc^ZVQMIEA=951.+(&%####%&(+.159=AEIMQVZ^chnt{ź~qeYMC90(! !(08BMXdq}ĺ{ske_ZUPLHD@<841-*(&$#"!!"#$&(*-148<@DHLPUZ_eks{Ƚ}qdXMB80(!  '.7AKVbo|ʾzqha[UOKFB>:630-*'%#"! !"#%'*-036:>BFKOU[ahqzɽ|obVKA7.'  %-5>IT_lyµxne]VPJE@<851.+)'$#!  !#$')+.158<@EJPV]enxȻyl_TI>5-% $+3HS^jw{ncXOG@:50,)&$"  "$&),05:@GOXcn{ƹwj^SH>5-&   $*2:DNXdp}ɼwj^TJB;50+'$"  "$'+05;BJT^jwʾ}pdXND:2*$  !'.6?HS^iv÷reZOF=60+'#  #'+06=FOZer¶vi^SH?6.'!  %+2;CMXco{Ƚ{maUJA92,'##',29AJUam{Ĺ{ocXMC;2+%  "(/6?HR\htvi\QF=5.(##(.5=FQ\ivĻth\RH?6/("   %,3;CMWbmyû~qdXMB91*%  %*19BMXdq~üymbWMC;3,%   #)07?HR\gs¼zm`TI?6.(""(.6?IT`mz¼sg\RH?70)#  !'-4HS^jw{ncXOG@:50,)&$"  "$&),05:@GOXcn{ƹwj^SH>5-&  ")09BLWcp}µ~rg]TLE?:51.+(&$"  "$&(+.15:?ELT]gr~}pcWLB90)" $+3IT_lyµxne]VPJE@<851.+)'$#!  !#$')+.158<@EJPV]enxȻyl_TI>5-%  '.7AKVbo|ʾzqha[UOKFB>:630-*'%#"! !"#%'*-036:>BFKOU[ahqzɽ|obVKA7.'  !(08BMXdq}ĺ{ske_ZUPLHD@<841-*(&$#"!!"#$&(*-148<@DHLPUZ_eks{Ƚ}qdXMB80(! !(09CMYeq~ƽ{tnhc^ZVQMIEA=951.+(&%####%&(+.159=AEIMQVZ^chnt{ź~qeYMC90(! !(09CMYdp}ļztojfb_[WSOKFB=951.+)'%%%%')+.159=BFKOSW[_bfjotzǿ}pdYMC90(! !(09BLWcnzſ~ytpmifc`\YUPLGB>951.+)(''()+.159>BGLPUY\`cfimpty~ſzncWLB90(!  '/7AJU`kv{wsqnljgeb^ZVQLGB>951.,+**+,.159>BGLQVZ^begjlnqsw{vk`UJA7/'  &-5>HR\gq{}zwtrqonmkigd`\WRMHC>9520.--.0259>CHMRW\`dgikmnoqrtwz}{qg\RH>5-& $+3;DNWakt}}yvtrqqpppponlifb]XSNHC>:74211247:>CHNSX]bfilnoppppqqrtvy}}tkaWND;3+$ ")08@IR[dlt|~zvsqonnnopqrssrqolhd_ZTNID@<976679<@DINTZ_dhloqrssrqponnnoqsvz~|tld[RI@80)"   &,4;CLT\dkrx}~{xtqnljihhikmortuwwvusokfa[VPKFB?=<<=?BFKPV[afkosuvwwutromkihhijlnqtx{~}xrkd\TLC;4,&   #)/6>EMT[aglptvxxxwuspmjgecaaaacehkorvxz||{zwsoid^XSNJFDCCDFJNSX^dioswz{||zxvrokhecaaaacegjmpsuwxxxvtplga[TME>6/)#  %+18>ELRW\adgijjjigeb`^[ZYXXY[^aejosx||xsmgb\WROLKKLORW\bgmsx||xsojea^[YXXYZ[^`begijjjigda\WRLE>81+%  !&,28>CINRVY[]]]][ZXVTRQPOPQSVZ^ciouz}xrlfa\YVUUVY\aflrx}zuoic^ZVSQPOPQRTVXZ[]]]][YVRNIC>82,&!  "',16;@DHKNPQQQQONLKIHGGGHJMQV[bhov}~xrmhda``adhmrx~}vohb[VQMJHGGGHIKLNOQQQQPNKHD@;61,'"  "&+/48;?ACEFFFFECBA@?>?@BEHMSYaiqyytpmllmptyyqiaYSMHEB@?>?@ABCEFFFFECA?;84/+&"  !%),0368:;<<<<;:987778:<@EJQXais|~{yy{~|siaXQJE@<:877789:;<<<<;:8630,)%!  #&),.02334433211011358GQ[gtüĸtg[QG>71-)&$"!!!!   !$'+17?HR^jxxj^RH?71+'$!  "&+07@IT`n|ɺ|n`TI@70+&"  !%+18AKVcqqcVKA81+%!  !%+19BMXetƵteXMB91+%!  !%+2:CNZhvʹvhZNC:2+%!  !&+3;DO\ix̻xi\OD;3+&!   &,3<;::;<>ACFILNPQRRQPNKHEA=84/+&"  "%)-148;=@BCDDDCB@><:753100001357:<>@BCDDDCB@=;841-)%"   #&),/1457888876531/-+)('&&'()+-/1356788887541/,)&#    #%')+,-....-,*)'&$"!  !"$&')*,-....-,+)'%#    "#$%%%%%$#"  "#$%%%%%$#"                                 !#%&'(((('&%$#!!#$%&'(((('&%#!   #%(*,./011100.-+)'&$"!!"$&')+-.001110/.,*(%#   "%),/2478:;;;;:97531/,*)'&&&&')*,/13579:;;;;:8742/,)%"  #'+/37:>@CEFGGGFECA?<97420////02479:73/+'#  #(-16;?DHKNQSTUUTSQOLIFB@=;:99:;=@BFILOQSTUUTSQNKHD?;61-(#  #(-28=CHMRW[^`bcdcb`]ZWSPLIGEEEEGILPSWZ]`bcdcb`^[WRMHC=82-(#  "',28>EKRX]cgloqsttrpnjfb^ZWTRQQRTWZ^bfjnprttsqolgc]XRKE>82,'"   %*17>ELS[biouz~{wrnjfc`__`cfjnrw{~zuoib[SLE>71*%   "(.5GQ[eq|Ŀ»|qe[QG>6/(#  $*08@JT^jv»Ⱦvj^TJ@80*$   %+19BKVamzþȽzmaVKB91+%    %+2:CLWcp}Ķ}pcWLC:2+%   !&+2:CMXdqɻqdXMC:2+&!  !&+2:CLXdqͽqdXLC:2+&!  !&+29BKVcp~ξ~pcVKB92+&!  !&+18@JUan}̼}naUJ@81+&!  !%*07?HS^lzɹzl^SH?70*%!  "%*/5=FP\hvĵvh\PF=5/*%"   "%).4;DMXer;reXMD;4.)%"    !#&).3:BKUan{Ķ{naUKB:3.)&#!    !!!!!""#%'*.39@IR]iv½ǻvi]RI@93.*'%#""!!!!!   !"$$%&&&&%%%&')+.38?GPZeq~Ƽ~qeZPG?83.+)'&%%%&&&&%$$"!   "%'(*++++++**))*+-038>EMWalxĿxlaWME>830-+*))**++++++*('%"   "%(+-/12222210/....0259>ELT^hs~~sh^TLE>9520..../01222221/-+(%"  !%(,/2579::::98764333357;?EKS[dnxxnd[SKE?;75333346789::::9752/,(%!  "&+/37;>@BCDDCBA?=;:9889;=AFKRYajs{{wtsstw{{sjaYRKFA=;9889:;=?ABCDDCB@>;73/+&"  "',16;@DGJLMNNMLJHFDB@?>>?ADHLRX_gnv}}wrmjgffgjmrw}}vng_XRLHDA?>>?@BDFHJLMNNMLJGD@;61,'"  "'-38>DIMQUWYYYYWUSPMKHGEEEFHKNSX^dkqw|~zuojea][ZZ[]aejouz~|wqkd^XSNKHFEEEGHKMPSUWYYYYWUQMID>83-'"   &,39@FMRX\`ceffeca^[XURPMLKKLNQUY^chmrvy{}}|zvrnid^ZVRPOOPRVZ^dinrvz|}}{yvrmhc^YUQNLKKLMPRUX[^aceffec`\XRMF@93,&   $*18@GOV\bhloqssrqnkhda]ZWTSRRSUWZ^bfjmpstttrolhc^YTOLHFEEFHLOTY^chlortttspmjfb^ZWUSRRSTWZ]adhknqrssqolhb\VOG@81*$  !(/6>FOW_fmsx|~~|yuqmiea^[YXXYZ\_adgjkmmmlifc^YTPKGC@>==>@CGKPTY^cfilmmmkjgda_\ZYXXY[^aeimquy|~~|xsmf_WOF>6/(! $+3;DMV_hpw~zuqlhdb_^^^^`acefghgfdb^ZVQLGC?;976679;?CGLQVZ^bdfghgfeca`^^^^_bdhlquz~wph_VMD;3+$  '/7@IS]fpy}xsnjgdcaaabbccccb`^[WSNJE@<8521001258<@EJNSW[^`bccccbbaaacdgjnsx}ypf]SI@7/'  ")1:DNXcmx~xsokhedcbaa``^][XTQLHC?:630-,++,-036:?CHLQTX[]^``aabcdehkosx~xmcXND:1)" $+4=GQ\hs~|vqmifdb`_^\ZXUROKFB>951.+)'''')+.159>BFKORUXZ\^_`bdfimqv|~sh\QG=4+$ %-6?IT`lx~xrmieb_][XVSPMIEA=941-*'%$##$%'*-149=AEIMPSVX[]_beimrx~¿xl`TI?6-% &.7@KVbn{ľ}vpkfb^[XUROKHD@<840-)'$"!!!!"$')-048<@DHKORUX[^bfkpv}»{nbVK@7.& &.7ALWcp}ºzslfa\XTQMJFC?;730,)&$"  "$&),037;?CFJMQTX\aflsz}pcWLA7.& &.7ALWcp}ĺ}umf`ZUQMIEA>:63/,)&#!!#&),/36:>AEIMQUZ`fmu}ĺ}pcWLA7.& &-6@KVbo|vme^XRMHD@<952.+(%#!!#%(+.259<@DHMRX^emvƻ|obVK@6-& %,5>IT`mzǼvmd\UNID?;841-*'%"  "%'*-148;?DINU\dmvźzm`TI>5,% #+382-)%"  "%)-28>FOXco|ƻ~rfZPE<3+$ ")08AJU_kwĹxk_TKB:3.)%!!%).3:BKT_kxǽwk_UJA80)"  &-46/*%!!%*/6>GP[gtǾ{odYOE<4-&  #*18@IS]hs~¹|pcWLC:2,&!!&,2:CLWcp|Ž~sh]SI@81*#  !'-4FNWajt~uj^SH>5-&   &-5>HS^ju~tjaWNF>70*%   $)/6=EMV_is|th]RG=4,% %,4=GR]ht|si_VME=6/)$  $)/6=EMV_is|th]RG=4,% %,4=GR]ht|si_VME=6/)$   %*07>FNWajt~uj^SH>5-&   &-5>HS^ju~tjaWNF>70*%   !&,29@HQZdnxxl`UJ@6.'!  !'.6@JU`lxxndZQH@92,&!  "(.56/*%!!%*/6>GP[gtǾ{odYOE<4-&  ")08AJU_kwĹxk_TKB:3.)%!!%).3:BKT_kxǽwk_UJA80)" $+382-)%"  "%)-28>FOXco|ƻ~rfZPE<3+$  '.7@JT`lx~rf\RJB<61-*&$!!$&*-16IT`mzǼvmd\UNID?;841-*'%"  "%'*-148;?DINU\dmvźzm`TI>5,% &-6@KVbo|vme^XRMHD@<952.+(%#!!#%(+.259<@DHMRX^emvƻ|obVK@6-& &.7ALWcp}ĺ}umf`ZUQMIEA>:63/,)&#!!#&),/36:>AEIMQUZ`fmu}ĺ}pcWLA7.& &.7ALWcp}ºzslfa\XTQMJFC?;730,)&$"  "$&),037;?CFJMQTX\aflsz}pcWLA7.& &.7@KVbn{ľ}vpkfb^[XUROKHD@<840-)'$"!!!!"$')-048<@DHKORUX[^bfkpv}»{nbVK@7.& %-6?IT`lx~xrmieb_][XVSPMIEA=941-*'%$##$%'*-149=AEIMPSVX[]_beimrx~¿xl`TI?6-% $+4=GQ\hs~|vqmifdb`_^\ZXUROKFB>951.+)'''')+.159>BFKORUXZ\^_`bdfimqv|~sh\QG=4+$ ")1:DNXcmx~xsokhedcbaa``^][XTQLHC?:630-,++,-036:?CHLQTX[]^``aabcdehkosx~xmcXND:1)"  '/7@IS]fpy}xsnjgdcaaabbccccb`^[WSNJE@<8521001258<@EJNSW[^`bccccbbaaacdgjnsx}ypf]SI@7/'  $+3;DMV_hpw~zuqlhdb_^^^^`acefghgfdb^ZVQLGC?;976679;?CGLQVZ^bdfghgfeca`^^^^_bdhlquz~wph_VMD;3+$ !(/6>FOW_fmsx|~~|yuqmiea^[YXXYZ\_adgjkmmmlifc^YTPKGC@>==>@CGKPTY^cfilmmmkjgda_\ZYXXY[^aeimquy|~~|xsmf_WOF>6/(!  $*18@GOV\bhloqssrqnkhda]ZWTSRRSUWZ^bfjmpstttrolhc^YTOLHFEEFHLOTY^chlortttspmjfb^ZWUSRRSTWZ]adhknqrssqolhb\VOG@81*$   &,39@FMRX\`ceffeca^[XURPMLKKLNQUY^chmrvy{}}|zvrnid^ZVRPOOPRVZ^dinrvz|}}{yvrmhc^YUQNLKKLMPRUX[^aceffec`\XRMF@93,&   "'-38>DIMQUWYYYYWUSPMKHGEEEFHKNSX^dkqw|~zuojea][ZZ[]aejouz~|wqkd^XSNKHFEEEGHKMPSUWYYYYWUQMID>83-'"  "',16;@DGJLMNNMLJHFDB@?>>?ADHLRX_gnv}}wrmjgffgjmrw}}vng_XRLHDA?>>?@BDFHJLMNNMLJGD@;61,'"  "&+/37;>@BCDDCBA?=;:9889;=AFKRYajs{{wtsstw{{sjaYRKFA=;9889:;=?ABCDDCB@>;73/+&"  !%(,/2579::::98764333357;?EKS[dnxxnd[SKE?;75333346789::::9752/,(%!  "%(+-/12222210/....0259>ELT^hs~~sh^TLE>9520..../01222221/-+(%"   "%'(*++++++**))*+-038>EMWalxĿxlaWME>830-+*))**++++++*('%"   !"$$%&&&&%%%&')+.38?GPZeq~Ƽ~qeZPG?83.+)'&%%%&&&&%$$"!   !!!!!""#%'*.39@IR]iv½ǻvi]RI@93.*'%#""!!!!!    !#&).3:BKUan{Ķ{naUKB:3.)&#!    "%).4;DMXer;reXMD;4.)%"   "%*/5=FP\hvĵvh\PF=5/*%"  !%*07?HS^lzɹzl^SH?70*%!  !&+18@JUan}̼}naUJ@81+&!  !&+29BKVcp~ξ~pcVKB92+&!  !&+2:CLXdqͽqdXLC:2+&!  !&+2:CMXdqɻqdXMC:2+&!   %+2:CLWcp}Ķ}pcWLC:2+%    %+19BKVamzþȽzmaVKB91+%   $*08@JT^jv»Ⱦvj^TJ@80*$  #(/6>GQ[eq|Ŀ»|qe[QG>6/(#  !'-4;DMV`juuj`VMD;4-'!  %*18@HQZcmv}}vmcZQH@81*%  "(.5ELS[biouz~{wrnjfc`__`cfjnrw{~zuoib[SLE>71*%   "',28>EKRX]cgloqsttrpnjfb^ZWTRQQRTWZ^bfjnprttsqolgc]XRKE>82,'"  #(-28=CHMRW[^`bcdcb`]ZWSPLIGEEEEGILPSWZ]`bcdcb`^[WRMHC=82-(#  #(-16;?DHKNQSTUUTSQOLIFB@=;:99:;=@BFILOQSTUUTSQNKHD?;61-(#  #'+/37:>@CEFGGGFECA?<97420////02479:73/+'#  "%),/2478:;;;;:97531/,*)'&&&&')*,/13579:;;;;:8742/,)%"   #%(*,./011100.-+)'&$"!!"$&')+-.001110/.,*(%#   !#%&'(((('&%$#!!#$%&'(((('&%#!                                  !"#####"!  !"#####"!  "$&()*++,++*('%#"  "#%'(*++,++*)(&$"  "%(+-01345554320.,*(%#!  !#%(*,.02345554310-+(%"   $'+/258;<>????><;8641.,*(&%%%%&(*,.1468;<>????><;852/+'$    %)-26:>ADGIJKKKJIGDB?<9631/.--./1369:62-)%    %*/49>CGKORUWXYYXVTROLHEA>;987789;>AEHLORTVXYYXWUROKGC>94/*%   $)/4:@FKQVZ^bdfgggeca]ZVRNJGECBBCEGJNRVZ]acegggfdb^ZVQKF@:4/)$  "(-4:AGNT[`fkoruvwwusqmie`\XTRPOOPRTX\`eimqsuwwvurokf`[TNGA:4-("   %+28?GNV]dkrw|~zupkfb_]\\]_bfkpuz~|wrkd]VNG?82+%   #(/5=DMU]fnv}{vqnkjjknqv{}vnf]UMD=5/(#   %+29AIR[dnw}zyyz}wnd[RIA92+%   "'-4GPZep{ſ{peZPG>6/)#   $*18@IS]ht»ùth]SI@81*$   !&+29AKU_kw¶wk_UKA92+&!  !&,2:BKU`lyȼyl`UKB:2,&!  "',2:BKU`lyͿyl`UKB:2,'"  #',29AJT_kyyk_TJA92,'#   #',28@IS^jwwj^SI@82,'#    #',17>GP[gt̾tg[PG>71,'#   !$'+06=ENXcp~ȹ~pcXNE=60+'$!  !"$'+/4;BKU`ly³yl`UKB;4/+'$"!   !"$%(+.39@HQ[gsȺsg[QH@93.+(%$"!    !"###$$%'(+.27=EMWbn{þʾ{nbWME=72.+('%$$###"!   !"$%&''''''(()+.16;BJS]htžɿth]SJB;61.+)((''''''&%$"!  "$&(*+,,,,++++++-.15:@GOYcnzýĽzncYOG@:51.-++++++,,,,+*(&$"  "%(*-/01222210/....0259>ELT^hs~~sh^TLE>9520..../01222210/-*(%"   $(+/24689::9876432112369=CIQYclvvlcYQIC=9632112346789::98642/+($   !&*.36:=?ABBBA@>=;9765567:=BHNV^gpy}zyyz}ypg^VNHB=:7655679;=>@ABBBA?=:63.*&!  "',16;?CFIKLLLKIGEB@=;:99:<>BGLSZbiqy|wsomkkmosw|yqibZSLGB><:99:;=@BEGIKLLLKIFC?;61,'"  "'-38>CHMQSVWWWUSQNKHEB@>==>@CGLQW^dkqw|}xsojfb`__`bfjosx}|wqkd^WQLGC@>==>@BEHKNQSUWWWVSQMHC>83-'"  !&-3:@GMRW\_accba_\XUQMJGECBBCEHLPUZ`ekptwyzzywtpkgb]ZVTSSTVZ]bgkptwyzzywtpke`ZUPLHECBBCEGJMQUX\_abcca_\WRMG@:3-&!  %+2:AHPW]cgknopomkhd`[WSOLIHGGHJLPTX\aeilnpponkhd_[VROLJIIJLORV[_dhknoppnliea\XTPLJHGGHILOSW[`dhkmoponkgc]WPHA:2+%  #)08@HQYahnsx{}}|{xuplgb]XTQNMLLLNPSVZ]`cefggeca]YUPLHEB@??@BEHLPUY]aceggfec`]ZVSPNLLLMNQTX]bglpux{|}}{xsnhaYQH@80)#  &-5>GPYbjry~ysmhc^YVSQPPPQSUWZ\^_`_^]ZWTPKGC?<:8778:5-&  "*1:CMWakt}ztnhc^ZWUTSSTUVWXYZYYWUROKGC?;8521001258;?CGKORUWYYZYXWVUTSSTUWZ^chntz}tkaWMC:1*" %-5>HS]hs}yslgb^ZXVUTTUUUUUTSQNKHD@<851/,+**+,/158<@DHKNQSTUUUUUTTUVXZ^bglsy}sh]SH>5-%  '/8BMXcoz~vpje`\YWVTTSRRQOMKHEB>:62/,)'&%%&'),/26:>BEHKMOQRRSTTVWY\`ejpv~zocXMB8/'  ")1;EP\htyrkfa]YWTSQPNLKHFC?<851-*'%#"!!"#%'*-158:730,)&#!  !#&),037:>ADFIKMORTX[`ekrzxk_SG=3*##+4>IUan{yqic]XTQMJHEB?<962/+(%#  #%(+/2694+#$,4>IUbo|º~ume_YTOKGDA>;841.+(%""%(+.148;>ADGKOTY_emu~ĺ|obUI>4,$$+4>IUbo|¸ypg`YSMIDA=:730-*'$!!$'*-037:=ADIMSY`gpyƼ|obUI>4+$#+4=HT`m{ɿ|ri`XQKFA=962/,)&#!!#&),/269=AFKQX`ir|ƻ{m`TH=4+#"*2952.+(%#  #%(+.259>CIPW`is~øxk^RF<2*" !(0:DO[gtƼti_VNF@;61.*'$""$'*.16;@FNV_itɿtg[OD:0(!  '.7AKWbo|Ǽsh]TKC=72.*&#!!#&*.27=CKT]hsù|obWKA7.'  %,4=GR]iuƻ~qf[QH@93.*&#  #&*.39@HQ[fq~Ƽui]RG=4,% #*1:CMXcnzù{ocXNE=60+&""&+06=ENXco{ƽzncXMC:1*# !'.6?HR]gs~ƾxl`UKB:3,'##',3:BKU`lxļ~sg]RH?6.'! %+3;CLV`kvth\QG>6/)$  $)/6>GQ\htvk`VLC;3+% #)/7?GPYcmx¾|pdYND;3,&! !&,3;DNYdp|xmcYPG?7/)#  &,3:BJS\fpyxl`UJA80)# #)08AJU`lxypf\SJB:3,&  $*06>ENV_hr{sh\QG>5-&! !&-5>GQ\hs{rh_VNE>60*$ "'-3:AIQYbkt}zodYND;2+$ $+2;DNYdoz}tkbYQIA:3-'" !&+17>EMU]fowwlaVLB90)# #)09BLValwwof]UME>71+&!  $*/5EMU]fowwlaVLB90)# #)09BLValwwof]UME>71+&! "'-3:AIQYbkt}zodYND;2+$ $+2;DNYdoz}tkbYQIA:3-'" $*06>ENV_hr{sh\QG>5-&! !&-5>GQ\hs{rh_VNE>60*$  &,3:BJS\fpyxl`UJA80)# #)08AJU`lxypf\SJB:3,&  #)/7?GPYcmx¾|pdYND;3,&! !&,3;DNYdp|xmcYPG?7/)# %+3;CLV`kvth\QG>6/)$  $)/6>GQ\htvk`VLC;3+% !'.6?HR]gs~ƾxl`UKB:3,'##',3:BKU`lxļ~sg]RH?6.'! #*1:CMXcnzù{ocXNE=60+&""&+06=ENXco{ƽzncXMC:1*# %,4=GR]iuƻ~qf[QH@93.*&#  #&*.39@HQ[fq~Ƽui]RG=4,%  '.7AKWbo|Ǽsh]TKC=72.*&#!!#&*.27=CKT]hsù|obWKA7.'  !(0:DO[gtƼti_VNF@;61.*'$""$'*.16;@FNV_itɿtg[OD:0(! "*2952.+(%#  #%(+.259>CIPW`is~øxk^RF<2*"#+4=HT`m{ɿ|ri`XQKFA=962/,)&#!!#&),/269=AFKQX`ir|ƻ{m`TH=4+#$+4>IUbo|¸ypg`YSMIDA=:730-*'$!!$'*-037:=ADIMSY`gpyƼ|obUI>4+$$,4>IUbo|º~ume_YTOKGDA>;841.+(%""%(+.148;>ADGKOTY_emu~ĺ|obUI>4,$#+4>IUan{yqic]XTQMJHEB?<962/+(%#  #%(+/2694+##*3=GS_kxzrke`[XTROMKIFDA>:730,)&#!  !#&),037:>ADFIKMORTX[`ekrzxk_SG=3*# ")1;EP\htyrkfa]YWTSQPNLKHFC?<851-*'%#"!!"#%'*-158:62/,)'&%%&'),/26:>BEHKMOQRRSTTVWY\`ejpv~zocXMB8/'  %-5>HS]hs}yslgb^ZXVUTTUUUUUTSQNKHD@<851/,+**+,/158<@DHKNQSTUUUUUTTUVXZ^bglsy}sh]SH>5-% "*1:CMWakt}ztnhc^ZWUTSSTUVWXYZYYWUROKGC?;8521001258;?CGKORUWYYZYXWVUTSSTUWZ^chntz}tkaWMC:1*"  &-5>GPYbjry~ysmhc^YVSQPPPQSUWZ\^_`_^]ZWTPKGC?<:8778:5-&  #)08@HQYahnsx{}}|{xuplgb]XTQNMLLLNPSVZ]`cefggeca]YUPLHEB@??@BEHLPUY]aceggfec`]ZVSPNLLLMNQTX]bglpux{|}}{xsnhaYQH@80)#  %+2:AHPW]cgknopomkhd`[WSOLIHGGHJLPTX\aeilnpponkhd_[VROLJIIJLORV[_dhknoppnliea\XTPLJHGGHILOSW[`dhkmoponkgc]WPHA:2+%  !&-3:@GMRW\_accba_\XUQMJGECBBCEHLPUZ`ekptwyzzywtpkgb]ZVTSSTVZ]bgkptwyzzywtpke`ZUPLHECBBCEGJMQUX\_abcca_\WRMG@:3-&!  "'-38>CHMQSVWWWUSQNKHEB@>==>@CGLQW^dkqw|}xsojfb`__`bfjosx}|wqkd^WQLGC@>==>@BEHKNQSUWWWVSQMHC>83-'"  "',16;?CFIKLLLKIGEB@=;:99:<>BGLSZbiqy|wsomkkmosw|yqibZSLGB><:99:;=@BEGIKLLLKIFC?;61,'"  !&*.36:=?ABBBA@>=;9765567:=BHNV^gpy}zyyz}ypg^VNHB=:7655679;=>@ABBBA?=:63.*&!   $(+/24689::9876432112369=CIQYclvvlcYQIC=9632112346789::98642/+($   "%(*-/01222210/....0259>ELT^hs~~sh^TLE>9520..../01222210/-*(%"  "$&(*+,,,,++++++-.15:@GOYcnzýĽzncYOG@:51.-++++++,,,,+*(&$"  !"$%&''''''(()+.16;BJS]htžɿth]SJB;61.+)((''''''&%$"!   !"###$$%'(+.27=EMWbn{þʾ{nbWME=72.+('%$$###"!    !"$%(+.39@HQ[gsȺsg[QH@93.+(%$"!   !"$'+/4;BKU`ly³yl`UKB;4/+'$"!  !$'+06=ENXcp~ȹ~pcXNE=60+'$!   #',17>GP[gt̾tg[PG>71,'#    #',28@IS^jwwj^SI@82,'#   #',29AJT_kyyk_TJA92,'#  "',2:BKU`lyͿyl`UKB:2,'"  !&,2:BKU`lyȼyl`UKB:2,&!  !&+29AKU_kw¶wk_UKA92+&!   $*18@IS]ht»ùth]SI@81*$   #)/6>GPZep{ſ{peZPG>6/)#  "'-4CGKORUWXYYXVTROLHEA>;987789;>AEHLORTVXYYXWUROKGC>94/*%    %)-26:>ADGIJKKKJIGDB?<9631/.--./1369:62-)%    $'+/258;<>????><;8641.,*(&%%%%&(*,.1468;<>????><;852/+'$   "%(+-01345554320.,*(%#!  !#%(*,.02345554310-+(%"  "$&()*++,++*('%#"  "#%'(*++,++*)(&$"  !"#####"!  !"#####"!                                     "$%&''''&%$"!!"$%&''''&%$"   !$')+-./00//.,*(&$"  "$&(*,.//00/.-+)'$!   $'+.136799:997642/-*(%#!!#%(*-/246799:997631.+'$   !%).269BFILNPPQPOMKHEB?;852/-,++,-/258;?BEHKMOPQPPNLIFB>950+&!  !&+06FNW`hqy|vqlifeefilqv|yqh`WNF>6/)#   &,2:BJS]fpy{wtsstw{ypf]SJB:2,&   "(.5=ENXblvvlbXNE=5.("  $*07?HQ[ep{ý{pe[QH?70*$  !&+29AJS]htºth]SJA92+&!  "',3:BKT_jvǿǽvj_TKB:3,'"   #(-3:BKU_kvü¶vk_UKB:3-(#   !$).4:BKT_jvĿĸvj_TKB:4.)$!  "%).4:AJS]htŷth]SJA:4.)%"  !#&*.39@HQ[fq~õ~qf[QH@93.*&#!   "$'*.38>FNXbnz̿znbXNF>83.*'$"   !"$&(+.27=CKT^iuǹui^TKC=72.+(&$"!   !"#$&')+.16;AHPZdp|¿̿|pdZPHA;61.+)'&$#"!    "#$%&'()*,.149>ELU_jv¶vj_ULE>941.,*)('&%$#"   !#%'())**++,-.037@ABBA@>=;9765567:=BHNV^gpy}}ypg^VNHB=:7655679;=>@ABBA@><952-)%   !&+05:>BEHJKKKJHFCA><:8778:<@EKQX`hpx|wtqppqtw|xph`XQKE@<:8778:<>ACFHJKKKJHEB>:50+&!  !&,27=BGLORTUUUSQNKHEB?<;::;<:99:<>ADHLOSVXZ[[ZYWTQOLIGFEEFHKNSX^djpv|ztlc[QH?7/'  $+3;841/-++++-/148;>BEGJKLMMMLKJIIIIKMPTX^dkszwlaVKA8/'  "*2;841.+)'&%%&')+.148;>ACEGHHIIIIIIJLNQUZ`gnv~th\QF<2*" $,5?JVbn{xpha[VROLJHGGFEDCA@=;852.+(&$"! !"$&(+.258;=@ACDEFGGHJLORV[ahpx{nbVJ?5,$&.8BMZftýypha[VQNKHFECB@?=;8530,)&$!!$&),0358;=?@BCEFHKNQV[ahpytfZMB8.& '09DP]jwºxog`ZTPLHECA?=;8631.+(%"  "%(+.1368;=?ACEHLPTZ`goxwj]PD90'  (1;FR^lzżvme]WQLHDA><9742/,*'$!!$'*,/2479<>ADHLQW]emvŻzl^RF;1( !(1;FR_m{Ż|riaYRMHC?<9631.+)&#!!#&)+.1369940,)&#!!#&),049>ELT]fq|ĸvh[OC9/' &.7ALXdrø}rg\SKC<71-)&#  #&)-17IT`ly¸}qf[RIA:4/*&#  #&*/4:AIR[fq}yl`TI>4,$#*2;EP[gs|peZPG?71,'#   #',17?GPZep|sg[PE;2*#!(/8AKValxļznbXMD<5.)$   $).5FOXajt}{odYOE<4,&! !&,46.("  &,2:AIRZclu}vk`UKB91*$ $*19BKU`kv}ulcZRIA:2,&  $)06=ELT\emu}|rg\RH?6.'!  !'.6?HR\gr|}ume\TLE=60)$ "(-3:AHOW^fnv}wncYOE<4,&    &,4DKRZaipw~}tjaWMC:2+$  $+2:CMWajt}~wpiaZRKD>71+&!  %*06DKRZaipw~}tjaWMC:2+$  $+2:CMWajt}~wpiaZRKD>71+&! "(-3:AHOW^fnv}wncYOE<4,&    &,4FOXajt}{odYOE<4,&! !&,46.(" $*19BKT^hr}sh\RH?6/)# #)/6?HR\hs}rh^TKB91*$ &-5=FPZep{ľwk`UKB92+&! !&+29BKU`kw¼{peZPF=5-&!(/8AKValxļznbXMD<5.)$   $).5IT`ly¸}qf[RIA:4/*&#  #&*/4:AIR[fq}yl`TI>4,$&.7ALXdrø}rg\SKC<71-)&#  #&)-17940,)&#!!#&),049>ELT]fq|ĸvh[OC9/'  (0:EQ]kyȾzoe\TLF@;730,*'$""$'*,037;@FLT\eozǼyk]QE:0( !(1;FR_l{¸vlc[SMGB=:630-*(%"  "%(*-036:=BGMS[clvɾ{l_RF;1(!!(1;FR_m{Ż|riaYRMHC?<9631.+)&#!!#&)+.1369<9742/,*'$!!$'*,/2479<>ADHLQW]emvŻzl^RF;1(  '09DP]jwºxog`ZTPLHECA?=;8631.+(%"  "%(+.1368;=?ACEHLPTZ`goxwj]PD90' &.8BMZftýypha[VQNKHFECB@?=;8530,)&$!!$&),0358;=?@BCEFHKNQV[ahpytfZMB8.&$,5?JVbn{xpha[VROLJHGGFEDCA@=;852.+(&$"! !"$&(+.258;=@ACDEFGGHJLORV[ahpx{nbVJ?5,$ "*2;841.+)'&%%&')+.148;>ACEGHHIIIIIIJLNQUZ`gnv~th\QF<2*"  '/8AKValwzskd^XTPMKIIIIJKLMMMLKJGEB>;841/-++++-/148;>BEGJKLMMMLKJIIIIKMPTX^dkszwlaVKA8/'  $+3<:99:<>ADHLOSVXZ[[ZYWTQOLIGFEEFHKNSX^djpv|ztlc[QH?7/'  #*19AIQYahnswy{zywsoje_ZTPKHECBBCEGKNRVY]`bcdcb`]ZVRNKGECBBCEGKNRVZ]`bcdcb`]YVRNKGECBBCEHKPTZ_ejoswyz{ywsnhaYQIA91*#  %,2:AHPV]bfjlmmljgc_ZUQLHEB@??@BEIMQV[`dhkmnnmkieb]YUROMLLMORUY]beikmnnmkhd`[VQMIEB@??@BEHLQUZ_cgjlmmljfb]VPHA:2,%  !&,39@FLRV[^`aa`^[XTQLIEB?=<<=?BFJPU[aglquxzzzxvrnjfa^[YWWY[^afjnrvxzzzxuqlga[UPJFB?=<<=?BEILQTX[^`aa`^[VRLF@93,&!  !&,27=BGLORTUUUSQNKHEB?<;::;BEHJKKKJHFCA><:8778:<@EKQX`hpx|wtqppqtw|xph`XQKE@<:8778:<>ACFHJKKKJHEB>:50+&!   %)-259<>@ABBA@>=;9765567:=BHNV^gpy}}ypg^VNHB=:7655679;=>@ABBA@><952-)%   #'*.14689:::98754333357;?EKS[dnxxnd[SKE?;75333345789:::98641.*'#  !$'*-/1233333211011358ELU_jv¶vj_ULE>941.,*)('&%$#"    !"#$&')+.16;AHPZdp|¿̿|pdZPHA;61.+)'&$#"!   !"$&(+.27=CKT^iuǹui^TKC=72.+(&$"!   "$'*.38>FNXbnz̿znbXNF>83.*'$"   !#&*.39@HQ[fq~õ~qf[QH@93.*&#!  "%).4:AJS]htŷth]SJA:4.)%"  !$).4:BKT_jvĿĸvj_TKB:4.)$!   #(-3:BKU_kvü¶vk_UKB:3-(#   "',3:BKT_jvǿǽvj_TKB:3,'"  !&+29AJS]htºth]SJA92+&!  $*07?HQ[ep{ý{pe[QH?70*$  "(.5=ENXblvvlbXNE=5.("   &,2:BJS]fpy{wtsstw{ypf]SJB:2,&   #)/6>FNW`hqy|vqlifeefilqv|yqh`WNF>6/)#  !&,3:AIQY`hou{|wrmgc^[YXXY[^cgmrw|{uoh`YQIA:3,&!  #(.5BFILNPPQPOMKHEB?;852/-,++,-/258;?BEHKMOPQPPNLIFB>950+&!  !%).269???>=;9641.+(%"  "%(+.1469;=>???><:851-)%!  "&+059=ADGIJKJJHFDA>;740-*(%$""""$%(*-047;>ADFHJJKJIGDA=950+&"  "',17DJPUY]`cdddca^[WSOJFB>:75322357:>BFJOSW[^acdddc`]YUPJD>82,&!   %+17>ELSY_eimprsrqpmjfa\XSNIEB?=<<=?BEINSX\afjmpqrsrpmie_YSLE>71+%   #)/6=ELT\cjpuz}|yupkf`[VQMJHGGHJMQV[`fkpuy|}zupjc\TLE=6/)#  !&,3;BKS\dlt{{uoic^ZVTSSTVZ^ciou{{tld\SKB;3,&!  $)07?GPYblt}~wqlgc`__`cglqw~}tlbYPG?70)$  !&,3;CLU_ir|ztpmllmptz|ri_ULC;3,&!  #)/6>FOYcnx}zxxz}xncYOF>6/)#  !%+18@IR\gr}ľ}rg\RI@81+%!  #'-3:BKT^itǿti^TKB:3-'#   $).4;CLU_jvŽŻvj_ULC;4.)$   "&+05@BCCCB@?=;:9889;=AFKRYbjs||sjbYRKFA=;9889:;=?@BCCCB@>;851,(#   %*/48=ADGIKKKJIGEB@=;:99:<>BGMSZbjrzzwtsstwzzrjbZSMGB><:99:;=@BEGIJKKKIGDA=84/*%    %+06EKPUY\^_`_]ZWSOKGC@=<;;;=@DINTZ`fkpuxz{{zxuqmiea^\[[\^aeimquxz{{zxupkf`ZTNID@=;;;<=@CGKOSWZ]_`_^\YUPKE>81+%   $+29@GNU[aehklkjhda\WRMIEA><;<=?AEINSX]bfjlnonmkhd`\YUSQPPQSUY\`dhkmnonljfb]XSNIEA?=<;<>AEIMRW\adhjklkhea[UNG@92+$  #)18@IQY`gmruxyxwtpkf`ZUOJFB?===>@BFIMRVY]_accba^[XTQMJHFEEFHJMQTX[^abcca_]YVRMIFB@>===?BFJOUZ`fkptwxyxurmg`YQI@81)# !'/7?HQ[clsz|wqjd]WQKGC@?>>?@CFILORUWXXXWVSPMJFC@>=<<=>@CFJMPSVWXXXWUROLIFC@?>>?@CGKQW]djqw|zslc[QH?7/'! $,4=FPZdnw}unf_XRLHDA@???ACEGJLMOOOONLIFC@=:75433457:=@CFILNOOOOMLJGECA???@ADHLRX_fnu}wndZPF=4,$ !(09CMXcnyyphaYSMIEB@??@ABCEFGHHHGECA>;8520.,,,,.0258;>ACEGHHHGFECBA@??@BEIMSYahpyyncXMC90(! #+4>HT`lw{riaZTNIFCA@??@@AABBAA?>;9630.+)'&%%&')+.0369;>?AABBAA@@??@ACFINTZair{wl`TH>4+#&.8BNZfs|sjbZTNIFCA?>>>>===<;97520-*(%#"! !"#%(*-02579;<===>>>>?ACFINTZbjs|sfZNB8.&!(1;FR_lzľ|siaZSMIEB@>=<;:987542/-*'%"  "%'*-/245789:;<=>@BEIMSZais|ľzl_RF;1(!"*3>IVcq¹{qh`XRLGC@>;:876431/-*(%#  #%(*-/134678:;>@CGLRX`hq{ǿqcVI>3*"#,5@LYfuĺyof]VOJEA=;86421/-+(&$!!$&(+-/12468;=AEJOV]foyźufYL@5,#$,6AMZhwøukbZRLFA=:742/-+)'%"  "%')+-/247:=AFLRZbkuʾwhZMA6,$$-7BN[ix{pg]UNGB=952/-*(&#!!#&(*-/259=BGNU]gp{xi[NB7-$$-7AN[iwźuj`WOHB<830-*'%"  "%'*-038ELT\ckrywne[RH?7/("  "(/7?HR[enwyrkc\TLE>70*$#(.4;AHOV^ekrx~{sjaXOE=5-&    &-5=EOXajs{~xrke^VOHA;4.(#"'-28?ELRY`flrx}~wog^ULC;3,%  %,3;CLU^gow~}xrlf`YRLE?82-'"!&,17=CIPV\bhnty~{tme\SJB:2+$  $+2:BJS\emt{~ytnhb\VPIC=71,&!!&+16ELT\ckrywne[RH?7/("  "(/7?HR[enwyrkc\TLE>70*$ %,2:AIQZbjsz|si_UKB91*$  $*19BKU_is|zsjbZQIA:2,% !'.5=ENW`ir{wmcXNE<4-&!  !&-4IVcq¹{qh`XRLGC@>;:876431/-*(%#  #%(*-/134678:;>@CGLRX`hq{ǿqcVI>3*"!(1;FR_lzľ|siaZSMIEB@>=<;:987542/-*'%"  "%'*-/245789:;<=>@BEIMSZais|ľzl_RF;1(!&.8BNZfs|sjbZTNIFCA?>>>>===<;97520-*(%#"! !"#%(*-02579;<===>>>>?ACFINTZbjs|sfZNB8.&#+4>HT`lw{riaZTNIFCA@??@@AABBAA?>;9630.+)'&%%&')+.0369;>?AABBAA@@??@ACFINTZair{wl`TH>4+# !(09CMXcnyyphaYSMIEB@??@ABCEFGHHHGECA>;8520.,,,,.0258;>ACEGHHHGFECBA@??@BEIMSYahpyyncXMC90(! $,4=FPZdnw}unf_XRLHDA@???ACEGJLMOOOONLIFC@=:75433457:=@CFILNOOOOMLJGECA???@ADHLRX_fnu}wndZPF=4,$ !'/7?HQ[clsz|wqjd]WQKGC@?>>?@CFILORUWXXXWVSPMJFC@>=<<=>@CFJMPSVWXXXWUROLIFC@?>>?@CGKQW]djqw|zslc[QH?7/'! #)18@IQY`gmruxyxwtpkf`ZUOJFB?===>@BFIMRVY]_accba^[XTQMJHFEEFHJMQTX[^abcca_]YVRMIFB@>===?BFJOUZ`fkptwxyxurmg`YQI@81)#  $+29@GNU[aehklkjhda\WRMIEA><;<=?AEINSX]bfjlnonmkhd`\YUSQPPQSUY\`dhkmnonljfb]XSNIEA?=<;<>AEIMRW\adhjklkhea[UNG@92+$   %+18>EKPUY\^_`_]ZWSOKGC@=<;;;=@DINTZ`fkpuxz{{zxuqmiea^\[[\^aeimquxz{{zxupkf`ZTNID@=;;;<=@CGKOSWZ]_`_^\YUPKE>81+%    %+06BGMSZbjrzzwtsstwzzrjbZSMGB><:99:;=@BEGIJKKKIGDA=84/*%   #(,158;>@BCCCB@?=;:9889;=AFKRYbjs||sjbYRKFA=;9889:;=?@BCCCB@>;851,(#  "&*-1469:;<<<;:987778:<@EJQXajs}}sjaXQJE@<:877789:;<<<;:9641-*&"   $'*-024566666666679;?CIOW_hr}}rh_WOIC?;976666666665420-*'$   "%'*,./1122334467:=BGMU]fp{ýû{pf]UMGB=:7644332211/.,*'%"   "%')+,-./012358;@EKRZcmxƽxmcZRKE@;853210/.-,+)'%"    #%&()+,./1369=BHOW`juǼuj`WOHB=9631/.,+)(&%#   !#%&(*+-036:?EKS\ep{ſŹ{pe\SKE?:630-+*(&%#!   !#%'*,/26;AGNW`jvvj`WNGA;62/,*'%#!   !#%(+.26FOYcnx}zxxz}xncYOF>6/)#  !&,3;CLU_ir|ztpmllmptz|ri_ULC;3,&!  $)07?GPYblt}~wqlgc`__`cglqw~}tlbYPG?70)$  !&,3;BKS\dlt{{uoic^ZVTSSTVZ^ciou{{tld\SKB;3,&!  #)/6=ELT\cjpuz}|yupkf`[VQMJHGGHJMQV[`fkpuy|}zupjc\TLE=6/)#   %+17>ELSY_eimprsrqpmjfa\XSNIEB?=<<=?BEINSX\afjmpqrsrpmie_YSLE>71+%   !&,28>DJPUY]`cdddca^[WSOJFB>:75322357:>BFJOSW[^acdddc`]YUPJD>82,&!  "',17;740-*(%$""""$%(*-047;>ADFHJJKJIGDA=950+&"  !%)-158:<>???>=;9641.+(%"  "%(+.1469;=>???><:851-)%!   #&*-/134555421/-*(%"  "%(*-/124555431/-*&#    #%')*+,,++)(&$"  "$&()++,,+*)'%#    "#$$$##"   "##$$$#"                                   !!   !!   !#%&'((('&%#! !#%&'((('&%#!  "%(*-.01110/-+)'$!!$')+-/01110.-*(%"  !$(,/3589:;;:8742/,)&#  #&),/2478:;;:9853/,($!  "&+/48:62/,*(''(*,/26:>CHLPTX[]^_^][XTOJE?93-'"  !&,39@GNTZ_dgjlllkifb^YTOJE@<8520000258<@EJOTY^bfikllljgd_ZTNG@93,&!  %+18@GOV^djptwz{{ywtqlgb\VQKGB><:99:<>BGKQV\bglqtwy{{zwtpjd^VOG@81+%  #)/6>FNW_gov|{vpjd^XRMIFDCCDFIMRX^djpv{|vog_WNF>6/)#  !&-4;CLU^gpyyrke_YUQOMMOQUY_ekryypg^ULC;4-&!  $*08@HR[eoxyrlfa]ZYYZ]aflryxoe[RH@80*$  "'-4;DMVakuysmifddfimsyukaVMD;4-'"   $*07?GQ[ep{zurppruz{pe[QG?70*$   "',29AJS^hs}{{}sh^SJA92,'"  !%)/5ADHLRY`ir|ľƿ|ri`YRLHDA>=;:9876531.,)&"   $'+.1468:;;<<<==>@BEIMSZair|¾¾|riaZSMIEB@>==<<<;;:8641.+'$   !%)-147:<>?@@@??>>>?@BEIMSZair{{riaZSMIEB@?>>>??@@@?><:741-)%!  "'+048?@BEHMSYaiqyyqiaYSMHEB@?>?@ABCDEFFECA?<840+'"  #(-27<@DGJKLMLKJHFDB@?>>?ADHLRX_gov~{xuttux{~vog_XRLHDA?>>?@BDFHJKLMLKJGD@<72-(#  $)/4:?DIMPSUUUTSPNKHEB@>==>@CGLQW^ekry~|xsoljiijlosx|~yrke^WQLGC@>==>@BEHKNPSTUUUSPMID?:4/)$  $)06ELSY_cgijjigd`\WRMIEA><;<=?AEINSX]bgjmoppnljfc_[XUSRRSUX[_cfjlnppomjgb]XSNIEA?=<;<>AEIMRW\`dgijjigc_YSLE>70)#  "(/7?GOW^ekpsvwwurnjd_YSMHD@=<;;<>@DHLPTX\_acccb`]ZWSPMJIHHIJMPSWZ]`bccca_\XTPLHD@><;;<=@DHMSY_djnruwwvspke^WOG?7/("  &.6>GPYbjrx}~ztngaZSMHC?=;::;=?BFIMPSUWXXWVTROLHEC@?>>?@CEHLORTVWXXWUSPMIFB?=;::;=?CHMSZagntz~}xrjbYPG>6.&  $+3ACFHKLMNNMLJGDB?<97655679<::9:;:99:;<>@BCDEEEDB@>;9631/.--./1369;>@BDEEEDCB@><;:99:;>AFLRYajs{yncXMC90(! $,5?IUamy}sjaXQJE@=:98889:;<=>>>=<:8631.,*(''''(*,.1368:<=>>>=<;:98889:=@EJQXajs}ymaUI?5,$ '09DP\iv}ri_WPID?<:877777888876531/,*(&$"!!!!"$&(*,/135678888777778:;875544443220/-+)&$"  "$&)+-/022344445578;>BHNU^gq{~pbUI=3*"$,6AMZhvżynd[SLFA<97532100/.-+*(&$!!$&(*+-./00123579:7420/.,+*('%#!!#%'(*+,./0247:>CIPXakvö|m^PD8.&'0:FSapź}qg]TMF@;741/-+*(&%#!!#%&(*+-/147;@FMT]gq}ɼpaSF:0' (183/+(%"   "%(+/38>EMU_juscUH<2(  (171+&" "&+17>FOYcozʿyk]PD9/'&.7BMYftǽzncXOE=6/*%    %*/6=EOXcnztfYMB7.&%,5?JUan{xmbWMD<4.(#  #(.46/("  "(/6>GPZdnx{qg\RI@7/(! &-46/("  "(/6>GPZdnx{qg\RI@7/(!")19CMWbmx}rh]SI@81*$  $*18@IS]hr}xmbWMC91)"#+371+&" "&+17>FOYcozʿyk]PD9/' (0;FR`n}·zncXOF?82,($! !$(,28?FOXcnzƹ}n`RF;0(  (183/+(%"   "%(+/38>EMU_juscUH<2(  (2:7420/.,+*('%#!!#%'(*+,./0247:>CIPXakvö|m^PD8.&$,6AMZhvżynd[SLFA<97532100/.-+*(&$!!$&(*+-./00123579;875544443220/-+)&$"  "$&)+-/022344445578;>BHNU^gq{~pbUI=3*" '09DP\iv}ri_WPID?<:877777888876531/,*(&$"!!!!"$&(*,/135678888777778:>>=<:8631.,*(''''(*,.1368:<=>>>=<;:98889:=@EJQXajs}ymaUI?5,$ !(09CMXcny{sjaYRLFA>;:99:;<>@BCDEEEDB@>;9631/.--./1369;>@BDEEEDCB@><;:99:;>AFLRYajs{yncXMC90(! $+3ACFHKLMNNMLJGDB?<97655679<::9:GPYbjrx}~ztngaZSMHC?=;::;=?BFIMPSUWXXWVTROLHEC@?>>?@CEHLORTVWXXWUSPMIFB?=;::;=?CHMSZagntz~}xrjbYPG>6.&  "(/7?GOW^ekpsvwwurnjd_YSMHD@=<;;<>@DHLPTX\_acccb`]ZWSPMJIHHIJMPSWZ]`bccca_\XTPLHD@><;;<=@DHMSY_djnruwwvspke^WOG?7/("  #)07>ELSY_cgijjigd`\WRMIEA><;<=?AEINSX]bgjmoppnljfc_[XUSRRSUX[_cfjlnppomjgb]XSNIEA?=<;<>AEIMRW\`dgijjigc_YSLE>70)#  $)06==>@CGLQW^ekry~|xsoljiijlosx|~yrke^WQLGC@>==>@BEHKNPSTUUUSPMID?:4/)$  #(-27<@DGJKLMLKJHFDB@?>>?ADHLRX_gov~{xuttux{~vog_XRLHDA?>>?@BDFHJKLMLKJGD@<72-(#  "'+048?@BEHMSYaiqyyqiaYSMHEB@?>?@ABCDEFFECA?<840+'"  !%)-147:<>?@@@??>>>?@BEIMSZair{{riaZSMIEB@?>>>??@@@?><:741-)%!   $'+.1468:;;<<<==>@BEIMSZair|¾¾|riaZSMIEB@>==<<<;;:8641.+'$   "&),.1356789:;=>ADHLRY`ir|ľƿ|ri`YRLHDA>=;:9876531.,)&"  !$'*,.024578:FNW_gov|{vpjd^XRMIFDCCDFIMRX^djpv{|vog_WNF>6/)#  %+18@GOV^djptwz{{ywtqlgb\VQKGB><:99:<>BGKQV\bglqtwy{{zwtpjd^VOG@81+%  !&,39@GNTZ_dgjlllkifb^YTOJE@<8520000258<@EJOTY^bfikllljgd_ZTNG@93,&!  "'-39?EJOTX[]^_^][XTPLHC>:62/,*(''(*,/26:>CHLPTX[]^_^][XTOJE?93-'"  "',27@AAA?>;852.+'$!!$'+.258;>?AAA@><962.)%!  "&,16;?CGIKMMLKIGC@<840,($!!$(,048<@CGIKLMMKIGC?;61,&"  "'-28>DINRUXYZYXVSOKGB>940,)%#!  !#%),049>BGKOSVXYZYXURNID>82-'"  !'-3:@GMTY^begggfd`]XSNID>951-*(&%%&(*-159>DINSX]`dfgggeb^YTMG@:3-'!   &,3:AIPW^ejortvvtrokfa[UOID?:620.--.026:?DIOU[afkortvvtroje^WPIA:3,&   $*18@HQYaipv|~ytoib\UOID?;865568;?DIOU\bioty~|vpiaYQH@81*$  #(/6>GPYbks{}wpib[UOJEB@>>@BEJOU[bipw}{skbYPG>6/(#  !&,3;DMV`jt}~wohaZUPLIHHILPUZahow~}tj`VMD;3,&!  $*08@IR]gr|}umf`[WTRRTW[`fmu}|rg]RI@80*$  "'-4ENWalx}{{}ĻxlaWNE>71,'#    #'*/4:@GPYcmyǽymcYPG@:4/*'#    #&*.27DJQYblwƽźwlbYQJD>951-*'$!  !$'*-047;@EKQYajt~~tjaYQKE@;740-*'$!  "%(+.147:=AFKQW_gpzúzpg_WQKFA=:741.+(%"  "%),/247:@ACEGILPUZ`goxýĿxog`ZUPLIGECA@><:852.+'#    $(,047:=?ABCDEFGIKMQUZagowwogaZUQMKIGFEDCBA?=:740,($   !%)-269=@BDEFGGGGGHIKMQUZ`fnu~~unf`ZUQMKIHGGGGGFEDB@=962-)%!  !&*/48<@CFHJKKKJJIHHHHJLOSX^dks{}||}{skd^XSOLJHHHHIJJKKKJHFC@<84/*&!  "&,16;@DHKNOPQPONMKIHGGGHJMQV[ahov}~zvtrrtvz~}voha[VQMJHGGGHIKMNOPQPONKHD@;61,&"  "'-28>CHMQTVWXXVUSPMKIGEEEFHKNSX^dkqx}|xsoljhhjlosx|}xqkd^XSNKHFEEEGIKMPSUVXXWVTQMHC>82-'"  "'-4:AGMRWZ]_``_^[XUQMJGECBBCEHLPUZ`fkquy|~~{xtplhda_^^_adhlptx{~~|yuqkf`ZUPLHECBBCEGJMQUX[^_``_]ZWRMGA:4-'"  !'.5@BFIMRVZ]`cdedca_\XUROLJJJJLORUX\_acdedc`]ZVRMIFB@>===?BFJOUZ`ejoruvvtrnib\TLD<5-&   %,4;987789;>@CFHKLMNNMLJGEB?=:9888:=@EKQX`gow~|tkaWMD;2*#  '/8BLWblwxof^VNHB>:865678:<>@BCDDDDBA?<:75310//01357:<:876568:>BHNV^foxwlbWLB8/'  $+4>IT`lxxnd[SLE@;8543445789;<<<<;:8641/-+*)(()*+-/1468:;<<<<;9875443458;@ELS[dnxxl`TI>4+$ '09DP\ivvlbXPIB=963211223455554320/,*(&%#""""#%&(*,/023455554322112369=BIPXblvvi\PD90' "*4>JVdqľsh^UMF?:7410/////00//.-,*(&$"  "$&(*,-.//00/////0147:?FMU^hs»qdVJ>4*"%-7CO\jy{odZQIB=841/.-,,,++**)'&$"!!"$&')**++,,,-./148=BIQZdo{Ǿyj\OC7-%'0;FSap¶vk`VMF?:52/-+*)(('&%$#!!#$%&'(()*+-/25:?FMV`kvȼpaSF;0'!)2=JWfu}qe[RIB<72/,*('&%$"!  !"$%&'(*,/2783/,)'%#"!!"#%'),/38>EMV`kwʻyiZL?4*"#+5AN\k{|pdYPG@94/+(&#!   !#&(+/49@GPYdp|;{k\NA5+##,6BO]l|ŷth]SJB;50+($"   "$(+05;BJS]htο|l]OB6,#$,6BO]l|Ⱥwk_ULC<50+'#   #'+05GQ\fq{~ukbXOF=5.("  "(.5=FOXbku~{qf\QG>5-& %,46/(#  #(/6>EMU]emtz{ung_WPH@81*$$*07>EMT[bioty}}ytnhaZRJC;4-'!  !'-4;CJRZahnty}}ytoib[TME>70*$#)/6=DKQX^djoswz}~{xtojd]VOH@92,&    &,29@HOV]djotx{~}zwsojd^XQKD=6/)##)/570*$  $*07>ELSZ`ejoruwyyzyxvtqnje`[UOHB;5/)##)/5;BHOU[`ejnqtvxyzyywuroje`ZSLE>70*$  $*07>ELSZ`ejoruwyyzyxvtqnje`[UOHB;5/)##)/5EMT[bioty}}ytnhaZRJC;4-'!  !'-4;CJRZahnty}}ytoib[TME>70*$$*18@HPW_gnu{ztme]UME>6/(#  #(/6>EMU]emtz{ung_WPH@81*$%+2:BJS\dmu|zrjbYQH@81*$  $*18@HQYbjrz|umd\SJB:2+%%,4GQ\fq{~ukbXOF=5.("  "(.5=FOXbku~{qf\QG>5-&  '/7AKUalwzpe[RH@70)$  $)07@HR[epzwlaUKA7/' !(09CNZfrľ~ti^TKB92+%    %+29BKT^it~ýrfZNC90(!")2;FQ^kxwkaVLC;3-'!  !'-3;CLVakwxk^QF;2)""*3=HUbp~ȿymbWMD<4.(#  #(.483/,)'%#"!!"#%'),/38>EMV`kwʻyiZL?4*"!)2=JWfu}qe[RIB<72/,*('&%$"!  !"$%&'(*,/27JVdqľsh^UMF?:7410/////00//.-,*(&$"  "$&(*,-.//00/////0147:?FMU^hs»qdVJ>4*" '09DP\ivvlbXPIB=963211223455554320/,*(&%#""""#%&(*,/023455554322112369=BIPXblvvi\PD90' $+4>IT`lxxnd[SLE@;8543445789;<<<<;:8641/-+*)(()*+-/1468:;<<<<;9875443458;@ELS[dnxxl`TI>4+$  '/8BLWblwxof^VNHB>:865678:<>@BCDDDDBA?<:75310//01357:<:876568:>BHNV^foxwlbWLB8/'  #*2;DMWakt|~wog`XQKE@=:8889:=?BEGJLMNNMLKHFC@>;987789;>@CFHKLMNNMLJGEB?=:9888:=@EKQX`gow~|tkaWMD;2*# %,4@BFIMRVZ]`cdedca_\XUROLJJJJLORUX\_acdedc`]ZVRMIFB@>===?BFJOUZ`ejoruvvtrnib\TLD<5-&   !'.5CHMQTVWXXVUSPMKIGEEEFHKNSX^dkqx}|xsoljhhjlosx|}xqkd^XSNKHFEEEGIKMPSUVXXWVTQMHC>82-'"  "&,16;@DHKNOPQPONMKIHGGGHJMQV[ahov}~zvtrrtvz~}voha[VQMJHGGGHIKMNOPQPONKHD@;61,&"  !&*/48<@CFHJKKKJJIHHHHJLOSX^dks{}||}{skd^XSOLJHHHHIJJKKKJHFC@<84/*&!  !%)-269=@BDEFGGGGGHIKMQUZ`fnu~~unf`ZUQMKIHGGGGGFEDB@=962-)%!   $(,047:=?ABCDEFGIKMQUZagowwogaZUQMKIGFEDCBA?=:740,($    #'+.258:<>@ACEGILPUZ`goxýĿxog`ZUPLIGECA@><:852.+'#   #&*-0368:=?ADGJNSX_fnwļºwnf_XSNJGDA?=:8630-*&#  "%),/247:DJQYblwƽźwlbYQJD>951-*'$!   #&*.27ENWalx}{{}ĻxlaWNE>71,'#    $).4;CKU_juý|wsrrsw|uj_UKC;4.)$   !&+18?HQ\fr}½~wqliggilqw~ÿ}rf\QH?81+&!  "'-4GPYbks{}wpib[UOJEB@>>@BEJOU[bipw}{skbYPG>6/(#  $*18@HQYaipv|~ytoib\UOID?;865568;?DIOU\bioty~|vpiaYQH@81*$   &,3:AIPW^ejortvvtrokfa[UOID?:620.--.026:?DIOU[afkortvvtroje^WPIA:3,&   !'-3:@GMTY^begggfd`]XSNID>951-*(&%%&(*-159>DINSX]`dfgggeb^YTMG@:3-'!  "'-28>DINRUXYZYXVSOKGB>940,)%#!  !#%),049>BGKOSVXYZYXURNID>82-'"  "&,16;?CGIKMMLKIGC@<840,($!!$(,048<@CGIKLMMKIGC?;61,&"  !%).269<>@AAA?>;852.+'$!!$'+.258;>?AAA@><962.)%!  #&*-0246666531/,)&#  #&),/1356666420-*&#   #%(*+,--,+*(&$! !$&(*+,--,+*(%#    "#$$$$#"   "#$$$$#"                                !!    !!    "$&'()(('%$" "$%'(()('&$"   !$'*,/012210.,)'$! !$'),.012210/,*'$!  #'+/368:<<<;:852/,(%!!%(,/258:;<<<:863/+'#   %*/38<@CEGHHGEC@=951-)%!!%)-159=@CEGHHGEC@<83/*%   !&+17FPYcmwxph`YRKFA>;::;>AFKRY`hpxwmcYPF>5.("  !&,3;CMWalv~umd]VPKGDCCDGKPV]dmu~vlaWMC;3,&!   $*08@IR]hs~yphaZUQNLLNQUZahpy~sh]RI@80*$   #(.4BFKPV]emwĻwme]VPKFB>:63/,($!  !%),047;>AEIMQW]cks|û|skc]WQMIEA>;740,)%!  !%)-158CGJMPQRSSSSSSTUWZ]aflry{xvvx{yrlfa]ZWUTSSSSSSRQPMJGC>94/*%    %*05;@EJNQTVWWWWVTSSRRSTWZ^chnt{{vrpooprv{{tnhc^ZWTSRRSSTVWWWWVTQNJE@;50*%    %+17=CHMRVY[\]]\ZXVTRQPOPQSVZ^chntz{vqmjgffgjmqv{ztnhc^ZVSQPOPQRTVXZ\]]\[YVRMHC=71+%    %+18>EKQV[^acddca^\XURPMLKKLNQUY^chmrvz}~|xtpkgc`^]]^`cgkptx|~}zvrmhc^YUQNLKKLMPRUX\^acddca^[VQKE>81+%   %+29@GNU[`ehkllkjgc`[WSOLIHGGHJLPTX\aeimprstsqolhd`\YVTSSTVY\`dhloqstsrpmiea\XTPLJHGGHILOSW[`cgjkllkhe`[UNG@92+%  $+29AIQY`flptvvvtqnid_ZTPKHECBBCEGKNRVZ]acefgfeb`\YUROMKJJKMORUY\`befgfeca]ZVRNKGECBBCEHKPTZ_dinqtvvvtplf`YQIA92+$  #*19AJS\dlrx}~zvpjc]WQKGC@?>>?@CFILORUWYZZZYWTQNKHECBAABCEHKNQTWYZZZYWUROLIFC@?>>?@CGKQW]cjpvz~}xrld\SJA91*# !(/8AJT^gpx~xpiaZSLGB?<:9::<>ACFIKMNOOOMLIGDA?<:9889:<::9::865678:<>@BCDEEDCB@=;864210012468;=@BCDEEDCB@><:876568:>BHNV^fox}si^TI?6-% "*396422234578:;<<<;:97520.,+*))*+,.02579:;<<<;:87543222469>CJQZclvui]RG<3*" &/8CNZgt~sh^ULE?:520////01234444321/-+)'&$####$&')+-/12344443210////025:?ELU^hs~tgZNC8/&"*3=IUcp~zncYPG@:62/-,,+,,---.--,+*(&$#!  !#$&(*+,--.---,,+,,-/26:@GPYcnz~pcUI=3*"%-7CO\kyǾui^TKC<72/,*)(((((((('&%$"  "$%&'(((((((()*,/2783/,)'&%%%$$##"!  !"##$$%%%&'),/38>FNXco{ʾrcTG;1' !*4?KYhxȻuh\RIA:4/+(&$#"!!  !!"#$&(+/4:AIR\huȹxhYK?4*!#,6BO]m}ôzmaVLC<50,(%#!  !#%(,0571,(%"   "%(,17>FOYerƶp`RD8.%&/9FScsvi]RH@82-(%! !%(-28@HR]ivʹscSF9/&&0:GTdtôyl`UKB:3-($!  !$(-3:BKU`ly˺tdTG:0&'0;GUdtŶ{nbWLC;4.($    $(.4;CLWbn{ʺtdUG;0''0;GTcsĶ}pcXMD<4.(#  #(.4HS^jvxndZPG?7/)#  #)/7?GPZdnxvj^SH>5,%$+471+%    %+17>ELRY_ejosw{}~|ytojc]UNF?70*$$*07>FMT[agmquxz|}}|{yvsokgb\VPJC=60*$  $*06=CJPV\bgkosvy{|}}|zxuqmga[TMF>70*$$*07>ELSZ`fkpsvxzzzzxvtqmie`[UOIB<5/)$  $)/570*$$*07>ELSZ`fkpsvxzzzzxvtqmie`[UOIB<5/)$  $)/570*$$*07>FMT[agmquxz|}}|{yvsokgb\VPJC=60*$  $*06=CJPV\bgkosvy{|}}|zxuqmga[TMF>70*$$*07?FNU]cjoty|~}{wsoje_YRLE>71+%    %+17>ELRY_ejosw{}~|ytojc]UNF?70*$$*18@HOW_fmsy~}ytoic\VOG@93,&!  !&,39@GOV\cioty}~ysmf_WOH@81*$$*19AIRZbjry{uohaZRKC<5.("  "(.5HS^jvxndZPG?7/)#  #)/7?GPZdnxvj^SH>5,%%-6@JVbo|}rh]SJA91*$  $*19AJS]hr}ſ|obVJ@6-%&.7AMYftúvk`VLB:2,&    &,2:BLV`kvtfYMA7.&&.8CO\jy·znbWMD;3-'!  !'-3;DMWbnzyj\OC8.&&/9EQ_n}ɽ|ocXND<4-'"  "'-471,(%"   "%(,17>FOYerƶp`RD8.%#,6BO]m}ôzmaVLC<50,(%#!  !#%(,0583/,)'&%%%$$##"!  !"##$$%%%&'),/38>FNXco{ʾrcTG;1' %-7CO\kyǾui^TKC<72/,*)(((((((('&%$"  "$%&'(((((((()*,/2796422234578:;<<<;:97520.,+*))*+,.02579:;<<<;:87543222469>CJQZclvui]RG<3*" %-6?IT^is}xof^VNHB>:865678:<>@BCDEEDCB@=;864210012468;=@BCDEEDCB@><:876568:>BHNV^fox}si^TI?6-% !(/8AJT^gpx~xpiaZSLGB?<:9::<>ACFIKMNOOOMLIGDA?<:9889:<::9:>?@CFILORUWYZZZYWTQNKHECBAABCEHKNQTWYZZZYWUROLIFC@?>>?@CGKQW]cjpvz~}xrld\SJA91*#  $+29AIQY`flptvvvtqnid_ZTPKHECBBCEGKNRVZ]acefgfeb`\YUROMKJJKMORUY\`befgfeca]ZVRNKGECBBCEHKPTZ_dinqtvvvtplf`YQIA92+$  %+29@GNU[`ehkllkjgc`[WSOLIHGGHJLPTX\aeimprstsqolhd`\YVTSSTVY\`dhloqstsrpmiea\XTPLJHGGHILOSW[`cgjkllkhe`[UNG@92+%   %+18>EKQV[^acddca^\XURPMLKKLNQUY^chmrvz}~|xtpkgc`^]]^`cgkptx|~}zvrmhc^YUQNLKKLMPRUX\^acddca^[VQKE>81+%    %+17=CHMRVY[\]]\ZXVTRQPOPQSVZ^chntz{vqmjgffgjmqv{ztnhc^ZVSQPOPQRTVXZ\]]\[YVRMHC=71+%    %*05;@EJNQTVWWWWVTSSRRSTWZ^chnt{{vrpooprv{{tnhc^ZWTSRRSSTVWWWWVTQNJE@;50*%    %*/49>CGJMPQRSSSSSSTUWZ]aflry{xvvx{yrlfa]ZWUTSSSSSSRQPMJGC>94/*%    %*.38<@DGJLNOPQRSTVX[_diov}~}}~}void_[XVTSRQPONLJGD@<83.*%    %).27;?BEHJLMOQSUX[`ejqx¿xqje`[XUSQOMLJHEB?;72.)%   !%)-269=@CFHKMPSVZ^djqx¼xqjd^ZVSPMKHFC@=962-)%!  !%)-158AEIMQW]cks|û|skc]WQMIEA>;740,)%!  !$(,/36:>BFKPV]emwĻwme]VPKFB>:63/,($!  !$(+/26:?CIOV]foy¹Ƽyof]VOIC?:62/+($!   #'*.26;@FMT]fpzǾ~~ɿzpf]TMF@;62.*'#    #&*.37=CJR[eo{}zxxz}{oe[RJC=73.*&#   #&*/49@GPYcny¹{vrpprv{yncYPG@94/*&#  "&+06FPYcmwxph`YRKFA>;::;>AFKRY`hpxwmcYPF>5.("  #)08@HQ[dlu|yrkc\TNGA<85322358@BBBA?=:63/+'#  #'+/36:=?ABBB@>;840,'#  $)/49>CGJLNONMKHEA=84/*&""&*/48=AEHKMNONLJGC>94/)$   %*07=CINSWZ[\\[XUQMHC=83.)%!!%).38=CHMQUX[\\[ZWSNIC=70*%   %+18?FMTZ`dhjkkigc_ZTNHB<61,($!!$(,16GQ[dnx}umd\TMF?:620//026:?FMT\dmu}xnd[QG>6/("  !'-4:8668:>CIOW_hqzyncYOE<4-'!   %+2:BLValw~tkbYRLFB@>>@BFLRYbkt~wlaVLB:2+%    %*07?HR\ht½vld\UOKHFFHKOU\dlvth\RH?70*%    $).5ENWalxxpid`^^`dipx·xlaWNE>82-)%!  "%)-27BFJMQUZ^djqxƾ{yy{xqjd^ZUQMJFB>950,'#  "'+05:?CGKNRUX\_dinu|~{yy{~ľ|unid_\XURNKGC?:50+'"  !&+05:?DHLPSUX[]`cgkpv}ÿ|ywwy|½}vpkgc`][XUSPLHD?:50+&!   %+05;@EJNQTWY[]^`behlpu{}xussux}{uplheb`^][YWTQNJE@;50+%    %*05;AFKPSWY[]^__`abdgjnsx~|wspoopsw|~xsnjgdba`__^][YWSPKFA;50*%   $*06FNV]djptwyyywtplgb]YTQNLLLLNPSVY]`cegiiihfc`\YUQNLJIIJLNQUY\`cfhiiigec`]YVSPNLLLLNQTY]bglptwyyywtpjd]VNF>6/("   '.6>FOX`hpv{~zupjd^XSNKHFEEFGILOQTWY[\]\[ZXUROKHECBAABCEHKORUXZ[\]\[YWTQOLIGFEEFHKNSX^djpuz~{vph`XOF>6.'   %-5=FPYclt|{umf_XRMHDA@???ACEGJLNOPQQPOMJHEB?=;:99:;=?BEHJMOPQQPONLJGECA???@ADHMRX_fmu{|tlcYPF=5-% #*3;:99:;<>@BDEFFFEDC@><975321123579<>@CDEFFFEDB@><;:99:;>AFLRYairzyodZOE<3*#  (09CNYep{wnd[SLE@;8543445789;<<==<;97531/-,+**+,-/13579;<==<<;9875443458;@ELS[dnw{peYNC90(  $,6@KWcp|}rh^ULE?:520////01234444321/.,*(&%$$$$%&(*,./12344443210////025:?ELU^hr}|pcWK@6,$!(1;GS`m{þxlaWNF?940.,+**++,,----,+*('%#"  "#%'(*+,----,,++**+,.049?FNWalx½{m`SG;1(!$,6AMZhwĻ~qeZPG?93/,)('&&&'''''&&%#"!!"#%&&'''''&&&'(),/39?GPZeq~ĺwhZMA6,$'0;FTbqƺwj^SIA:4/+(&$##"""""!!  !!"""""##$&(+/4:AIS^jwȼqbTF;0'!*4?KYhxĶ|obVLC;4/*'$"!  !"$'*/4;CLVbo|ȹxhYK?4*!$,7CP^n;sfZOE<5/*&#!!#&*/570+&#   #&+07>GQ]jx˺scTF9/%'0KZj{seYMC;3,'"  "',3;CMYesIJ{jZK>3)!!)3?LZj{tfZOD<4-'"  "'-4JXfvŷreZOE<4-&!  !&-43*""*3=IVdrɽ|ocXND;3,&    &,3;DNXco|˾rdVI=3*""*26/("  "(/6>FOYcmxth\PE;2)"")1:DNYdp{{qg^ULC;4-'!  !'-4;CLU^gq{{pdYND:1)"")1:CMWalv|sjbYPH@91+%    %+19@HPYbjs|vlaWMC:1)"#)19BKU_hr{{tld\TLD=6/)#  #)/6=DLT\dlt{{rh_UKB91)##*19AJS\env~zsle^WOHA:3-'"  "'-3:AHOW^elsz~vne\SJA91*##*19AIR[cksy}xsmf`YRLE>71+&    &+17>ELRY`fmsx}yskc[RIA91*#$*19AIQYaipv|{wrmgb\UOHB<5/*$  $*/571+&    &+17>ELRY`fmsx}yskc[RIA91*##*19AJS\env~zsle^WOHA:3-'"  "'-3:AHOW^elsz~vne\SJA91*##)19BKU_hr{{tld\TLD=6/)#  #)/6=DLT\dlt{{rh_UKB91)#")1:CMWalv|sjbYPH@91+%    %+19@HPYbjs|vlaWMC:1)"")1:DNYdp{{qg^ULC;4-'!  !'-4;CLU^gq{{pdYND:1)"")2;EP\ht¾xmcYOF>6/("  "(/6>FOYcmxth\PE;2)"")2JXfvŷreZOE<4-&!  !&-43*""*4?KYhx˼tg[OE<4-'"  "'-4KZj{seYMC;3,'"  "',3;CMYesIJ{jZK>3)! (2=JYhyϿpcWLB92,'"  "',29BLWcpñyhYJ=2( '070+&#   #&+07>GQ]jx˺scTF9/%$,7CP^n;sfZOE<5/*&#!!#&*/5;:99:;<>@BDEFFFEDC@><975321123579<>@CDEFFFEDB@><;:99:;>AFLRYairzyodZOE<3*# %-5=FPYclt|{umf_XRMHDA@???ACEGJLNOPQQPOMJHEB?=;:99:;=?BEHJMOPQQPONLJGECA???@ADHMRX_fmu{|tlcYPF=5-%   '.6>FOX`hpv{~zupjd^XSNKHFEEFGILOQTWY[\]\[ZXUROKHECBAABCEHKORUXZ[\]\[YWTQOLIGFEEFHKNSX^djpuz~{vph`XOF>6.'   "(/6>FNV]djptwyyywtplgb]YTQNLLLLNPSVY]`cegiiihfc`\YUQNLJIIJLNQUY\`cfhiiigec`]YVSPNLLLLNQTY]bglptwyyywtpjd]VNF>6/("  #)/6=ELSZ`ejmpqqpnlhea]ZWTSRRSUWZ^aeimpsuvvvtrokgc_[WUSRRSUW[_cgkortvvvuspmiea^ZWUSRRSTWZ]aehlnpqqpmje`ZSLE=6/)#  #)/6=DJQW\aehijjihec`^[ZXXXY[^aeinrw{~~{wrmid`][ZZ[]`dimrw{~~{wrniea^[YXXXZ[^`cehijjihea\WQJD=6/)#  $)06BFJMQUZ^djqxƾ{yy{xqjd^ZUQMJFB>950,'#  #',049=AEINRW]cjr{~zxxz~{rjc]WRNIEA=940,'#  #'+/48<@EJOU[bjs|{xvvx{Ⱦ|sjb[UOJE@<84/+'#  #'+/37;@EKQX`is}Ⱦ}wsqqsw}÷}si`XQKE@;73/+'#  "&*.27ENWalxxpid`^^`dipx·xlaWNE>82-)%!   $).3:AIR\hsȿxoga\XWWX\agoxƽsh\RIA:3.)$    $).5>@BFLRYbkt~wlaVLB:2+%   !'-4:8668:>CIOW_hqzyncYOE<4-'!  "(/6>GQ[dnx}umd\TMF?:620//026:?FMT\dmu}xnd[QG>6/("  #)08@HQZclt{|voh`XQIC<72.+)(()+.27CGJLNONMKHEA=84/*&""&*/48=AEHKMNONLJGC>94/)$  #',048;>@BBBA?=:63/+'#  #'+/36:=?ABBB@>;840,'#   $(+/1456776420-*&#   #&*-0246776541/+($   !$&(*,,--,+)'$" "$')+,--,,*(&$!  !"#$$$#"!  !"#$$$#"!                             "$%''(''&$"   "$&''(''%$"   !$'*,.01110.-*(%" "%(*-.01110.,*'$!   $(,0369:;<;:9640-)&" "&)-0469:;<;:9630,($   !&+059=ADFHHHFDB>:62.)%!!%).26:>BDFHHHFDA=950+&!  #(-39?DIMQSUUUTQNJFA<71,($  $(,17EMU\chmqstsqnje_YRKD>82,($!!$(,28>DKRY_ejnqstsqmhc\UME>6/)#  "(/6>GOXaipw|~ztmf_WOHA:4/*'$"!!"$'*/4:AHOW_fmtz~|wpiaXOG>6/("  "(.6>FPYcmv~|tlcZRJC<61-*(''(*-166.("  !'-4840.--.048>ELT]fpyyndYOE<4-'!   &,3:CMWbmy|rh_VMF@;753357;@FMV_hr|ymbWMC:3,&    %+18AJT_jw¾~si_WOHC>;::;>CHOW_is~½wj_TJA81+%   !%*06>GP[frƾ~si`WPJFCAACFJPW`is~úrf[PG>60*%!  !%*/5CHLQVZ_ejqx|vpmkkmpv|ĺxqje_ZVQLHC>94.)$   #).39>DINRW[_chlrx~ļ|vqmllmqv|û~xrlhc_[WRNID>93.)#  "(-39?DJOSX\_cfjnrw|ý{upmkkmpu{ſ|wrnjfc_\XSOJD?93-("  !&,28>DJPUY]adgilnquy~xrnjiijnrx¿~yuqnligda]YUPJD>82,&!   %+17>DJPV[_cfhjlmoqsuy|ztnjgeegjntz|yusqomljhfc_[VPJD>71+%   $*06=DJQW\aehjlmnnoopqsvy}ztniebaabeintz}yvsqpoonnmljhea\WQJD=60*$  #(/5??>=<:8641/-,+**+,-/1468:<=>??>=<;:98889:=@EKQXair|vj_TI?5-% "*2JWdr}qeZPG?93/,)('&&&'''''&&%$"!  !"$%&&'''''&&&'(),/39?GPZeq}ƿrdWJ>4*"%.9DQ^m|øuh\QH?82-)'$#"""!"!!!!  !!!!"!"""#$')-28?HQ\hu÷|m^QD9.%!)2=JWfvyk_SI@81,($"  "$(,18@IS_kyĶvfWJ=2)!#,6BO]m}ɻ}oaUJA81,'#  #',18AJUao}}m]OB6,#%.9FScs²rdWLB92+&" "&+29BLWdr˺scSF9.%'1LZk|̻xj\PE;3,&"  "&,3;EP\jxǵ|kZL>3) "*4@N]mϾzk^QF<4-'!  !'-45-'!  !'-5>HS`m|̹p_PB6,#$-7CP_o̼{m_SH>5.'!  !'.5>HS_m{ɷo_PC7-$$-7CP_nǸzl^RH>5-'!  !'-5>HR^lzŴn_PC7-$%-7CO^m}wi]QG=4-&!  !&-4=GQ]iw}m^OC7-%%-7BO\kzŸsfZOE<3,&    &,36/("  "(/6>FPYdozĿ~qdXLA7.& '/7ALWbnz|rh^TKC;3,&!  !&,3;CKT^hr|znbWLA7/' '/8AKValw}tjaXPG?81*$  $*18?GPXajt}wlaVKA8/' !(08AKU_jt~|tlc[SKC<5.(#  #(.582,'"  "',28>DJQW^djpv||une]TKB91*##*1:BKT]emu{~ytnhb\VOIC=71,'"  "',17=CIOV\bhnty~{ume]TKB:1*##*1:BKT]emu{~ytnhb\VOIC=71,'"  "',17=CIOV\bhnty~{ume]TKB:1*##*19BKT]enu||vpjd^WQJD>82,'"  "',28>DJQW^djpv||une]TKB91*##*19BKT]fow~ztnhaZTMF@:4.(#  #(.4:@FMTZahntz~wof]TKB91*#")19AKT^gpx{tmf_XQJC<60*%    %*066/("  "(/6>FPYdozĿ~qdXLA7.&&.7BMYftĺui^TJA80*#  #*08AJT^iutfYMB7.&%.7BN[iwƻ{ocWMC:2+%  %+2:CMWco{ʿwi[NB7.%%-7BO\kzŸsfZOE<3,&    &,35-'!  !'-5>HR^lzŴn_PC7-$$-7CP_o̼{m_SH>5.'!  !'.5>HS_m{ɷo_PC7-$#,6BP_pϾ|m`SH>5-'!  !'-5>HS`m|̹p_PB6,#"+6BO^oп|m_RG=5-'"  "'-5=GR_m|̺o^OB6+""*4@N]mϾzk^QF<4-'!  !'-4LZk|̻xj\PE;3,&"  "&,3;EP\jxǵ|kZL>3) '1JWdr}qeZPG?93/,)('&&&'''''&&%$"!  !"$%&&'''''&&&'(),/39?GPZeq}ƿrdWJ>4*"&/8CO[huyncYPG@:62/-,,+,,--...--,*)'&$"!  !"$&')*,--...--,,+,,-/26:@GPYcnyuh[OC8/& "*2??>=<:8641/-,+**+,-/1468:<=>??>=<;:98889:=@EKQXair|vj_TI?5-%  '/8AKU_jt}xphaYSMIEB@??@ABCEFGHIIHGECA?<975321123579DJPV[_cfhjlmoqsuy|ztnjgeegjntz|yusqomljhfc_[VPJD>71+%   !&,28>DJPUY]adgilnquy~xrnjiijnrx¿~yuqnligda]YUPJD>82,&!  "(-39?DJOSX\_cfjnrw|ý{upmkkmpu{ſ|wrnjfc_\XSOJD?93-("  #).39>DINRW[_chlrx~ļ|vqmllmqv|û~xrlhc_[WRNID>93.)#   $).49>CHLQVZ_ejqx|vpmkkmpv|ĺxqje_ZVQLHC>94.)$    %*.38=BGLPV[ahox·{tnkiiknt{xoha[VPLGB=83.*%   !%).37GP[frƾ~si`WPJFCAACFJPW`is~úrf[PG>60*%!   %+18AJT_jw¾~si_WOHC>;::;>CHOW_is~½wj_TJA81+%    &,3:CMWbmy|rh_VMF@;753357;@FMV_hr|ymbWMC:3,&   !'-4840.--.048>ELT]fpyyndYOE<4-'!  "(.6>FPYcmv~|tlcZRJC<61-*(''(*-166.("  "(/6>GOXaipw|~ztmf_WOHA:4/*'$"!!"$'*/4:AHOW_fmtz~|wpiaXOG>6/("  #)/6>EMU\chmqstsqnje_YRKD>82,($!!$(,28>DKRY_ejnqstsqmhc\UME>6/)#  #)/5:62.)%!!%).26:>BDFHHHFDA=950+&!   $(,0369:;<;:9640-)&" "&)-0469:;<;:9630,($   !$'*,.01110.-*(%" "%(*-.01110.,*'$!   "$%''(''&$"   "$&''(''%$"                         !"""""!  !"""""!   "%')*+++*)'%#   #%')*+++*)'%"    #'*-024555420.+(%! !%(+.024555420-*'#   "'+047;=?@A@?=;840,(%!!%(,048;=?@A@?=;740+'"   $*/49>CFJLMNMLJFC?:51,'##',15:?CFJLMNMLJFC>94/*$    &+18>DJOTWZ\\\ZWTOJE@:4/*%!!%*/4:@EJOTWZ\\\ZWTOJD>81+&   !&,3:AHPV\bfiklkifb]WQKD=71,'##',17=DKQW]bfiklkifb\VPHA:3,&!  !&-4;CKT\dkqvy|||yvqke^VOG@93.)$!!$).39@GOV^ekqvy|||yvqkd\TKC;4-&!   &,4;DMV`iqy{skcZRJB;5/*&#! !#&*/5;BJRZcks{yqi`VMD;4,&    %,3;CMWalvypf]TKC<60,)'&&'),0695211259>ELU_itwk_TJ@81*%    %*07?GQ\htsh^TLE?;8778;?ELT^hsļth\QG?70*%   !%*06=ENYdp}ź}rg]TLFA>==>AFLT]gr}Ⱦ}pdYNE=60*%!  "&+06CIPW_hr}öxne^YUSSUY^enxʽ}rh_WPIC>94/*&!  "&+05:?EJPV]emvƺ|rjb]YWWY]bjr|ʾvme]VPJE?:50+&"  !&+16;AFKQW]cjrzǻvmf`][[]`fmvȼzrjc]WQKFA;61+&!  !&+16==>@BEILPTX\_bdefffedca`_^^^_adhlqv{|umd[RH?7/(!  &-5>GQ[dnw{tnhc^ZWUTSSTTVWXXYYXWVTQNKGDA>;977779;>ADGKNQTVWXYYXXWVTTSSTUWZ^chnt{wnd[QG>5-&  $+3IUbo|~sh^UMF?:7410/////000//.-+)(&$#!  !#$&()+-.//000/////0147:?FMU^hs~|obUI>4+# '0:EQ^lzth^TKC<72/,*)((((((((''&$#"  "#$&''(((((((()*,/27KZj|ɸteWK@7/(#  #(/7@KWetǴ|jZK>3) "*5AN^nͻufXLA7/("  "(/7ALXfuͺn^NA5*"#,7CQ`qμwgYMA8/("  "(/8AMYgwѾq`QC7,#$-8DRbsμwhZMB80("  "(08BMZhwҿsbRD8-$%.9FTct̻vgYMB80("  "(08BMYgvҿtcTF9.%&/:FTdtɸufYLA8/("  "(/8ALYfuоtdTF:/&'0;GTctósdWKA7/(!  !(/7AKWds̻tcTG;0' '1;GTcs˼~obUJ?6.'!  !'.6?JUbo~ǷscTG;1' (15-&    &-5>GR^kyqbTG<1( !)26/("  "(/6>GQ[fr~{m`TH=3+#$,4>HT`ly¾uj`VLC;3,&    &,3;CLV`ju¾yl`TH>4,$%-5?IT_kwwmcYPG?80*$  $*08?GPYcmwwk_TI?5-%&.6@JT_jvxne\SKC;4.("  "(.4;CKS\enxvj_TJ@6.&'/7@JU_juxpg^VNF?81+&    &+18?FNV^gpxuj_UJ@7/'(/8AKU`jt~yqiaYQIB;5/)$  $)/5;BIQYaiqy~tj`UKA8/((09BLV`jt}{skd\TMF?92-'"  "'-29?FMT\dks{}tj`VLB90()19BLV`js|~voh`YQJC=71+&!  !&+17=CJQY`hov~|sj`VLB91))19CLV`js|{tmf^WPIB<60+%!  !%+06HT`ly¾uj`VLC;3,&    &,3;CLV`ju¾yl`TH>4,$#+3=HT`m{ž~rf[QG>6/("  "(/6>GQ[fr~{m`TH=3+#"*3=HTan}¸ymaVKB91*$  $*19BKVamy}naTH=3*"!)25-&    &-5>GR^kyqbTG<1( '1;GTcs˼~obUJ?6.'!  !'.6?JUbo~ǷscTG;1' '0;GTctósdWKA7/(!  !(/7AKWds̻tcTG;0'&/:FTdtɸufYLA8/("  "(/8ALYfuоtdTF:/&%.9FTct̻vgYMB80("  "(08BMYgvҿtcTF9.%$-8DRbsμwhZMB80("  "(08BMZhwҿsbRD8-$#,7CQ`qμwgYMA8/("  "(/8AMYgwѾq`QC7,#"*5AN^nͻufXLA7/("  "(/7ALXfuͺn^NA5*" )3>KZj|ɸteWK@7/(#  #(/7@KWetǴ|jZK>3) &0;HVfwŴrcVJ@7/(# #(/7@JVcrѿwfVH;0&$-8DQ`pο~oaUI?7/)$   $)/7?IUao~Ƕp`QD8-$"*4?LZiyǸ{m`TI?70*&""&*07?IT`m{ʼyiZL?4*"'0:FSbqʿyk^SI@81,($"  "$(,18@IS^kyʽqbSF:0'#,5@LZhvvi^SIA:4/+(&$##""""""!  !""""""##$&(+/4:AIS^ivƼvhZL@5,# '0:EQ^lzth^TKC<72/,*)((((((((''&$#"  "#$&''(((((((()*,/27IUbo|~sh^UMF?:7410/////000//.-+)(&$#!  !#$&()+-.//000/////0147:?FMU^hs~|obUI>4+# &.8BLXdp||ri_WPID?<:8777778888876431/-*)'&%$$%&')*-/1346788888777778:GQ[dnw{tnhc^ZWUTSSTTVWXXYYXWVTQNKGDA>;977779;>ADGKNQTVWXYYXXWVTTSSTUWZ^chnt{wnd[QG>5-&  !(/7?HR[dmu|{vqlhda_^^^_`acdefffedb_\XTPLIEB@>==>@BEILPTX\_bdefffedca`_^^^_adhlqv{|umd[RH?7/(!  #)18AIR[dlsz|xtqnkiihijkmoqrstttsqnkgc^ZUQMIFDCCDFIMQUZ^cgknqstttsrqomkjihiiknqtx|zsld[RIA81)#  $+2:BJS[ckrw|}zxutsrrsuwy{~~{wrmhc]XTPMKJJKMPTX]chmrw{~~{ywusrrstuxz}|wrkc[SJB:2+$   &-4CIPW_hr}öxne^YUSSUY^enxʽ}rh_WPIC>94/*&!  !%)-27=CIQYblxʾ}rh`YTPNNPTY`hr}ǺxlbYQIC=72-)%!   #(,16==>AFLT]gr}Ⱦ}pdYNE=60*%!   %*07?GQ\htsh^TLE?;8778;?ELT^hsļth\QG?70*%    %*18@JT_kwti_ULE>95211259>ELU_itwk_TJ@81*%    %+29BLValw}sh^ULD=72/,++,/27=DLU^hs}wlaVLB92+%    %,3;CMWalvypf]TKC<60,)'&&'),06DJOTWZ\\\ZWTOJE@:4/*%!!%*/4:@EJOTWZ\\\ZWTOJD>81+&    $*/49>CFJLMNMLJFC?:51,'##',15:?CFJLMNMLJFC>94/*$   "'+047;=?@A@?=;840,(%!!%(,048;=?@A@?=;740+'"   #'*-024555420.+(%! !%(+.024555420-*'#    "%')*+++*)'%#   #%')*+++*)'%"   !"""""!  !"""""!                   !#$%%%$#"   "#$%%%$#!   "%'*,-...-,*(&#   #&(*,-...-,*'%"  "&*-14689998641.+'$! !$'+.14689998641-*&"   %*.37;?BDEEEDB?<840,'##',04894/*&!!&*/49>CGKOQSSSQOKGC=82-'"  #)/5FNU\chmprsrpmhc\VOHA:4.)$  $).4:AHOV\chmprsrpmhc\UNF>70)#  #)08@HQZbjrx}}xrkc[SKC<5/*%""%*/5;99;>CIQZep}ʾylaVLD<50*&"  #',16>@CIOWalxǺti^TKC<61,'#  !%).28=DKS[ep|ŷsg]UNHECCEHNU]gs|pe[SKD=82.)%!  "&+/4:?EKRZclw̾xmbZRMIHHIMRZbmxǹwlcZRKE?:4/+&"  "',16;AGMSZbjs}³}qg^WQMKKMQW^gq}ʽ}sjbZSMGA;61,'"  "',28=CIOU[biqyĶtjaZTQOOQTZajt˾yqib[UOIC=82,'"  !',28>EKQW]cipwövlc\WSQQSW\clvʾwpic]WQKE>82,'!   &,28?FLRY_ejpv}wme^XUSSUX^emwƻ}vpje_YRLF?82,&   $*18?FMTZaglrw|Ǽvme^YUTTUY^emv|wrlgaZTMF?81*$  ")/6>EMT[bhnsx}ȿ~tkd]XUSSUX]dkt~}xsnhb[TME>6/)"   &-4;8520/../0258;>BEHKNPQSTTTTTTUUVXZ^bglszvk`VKA80(!  %-6?IT_juvng`ZUQNLJIIHHHHHGFECA?<9641.,+))))+,.1469>>===<<;98641/-*(&%$$$$%&(*-/14689;<<===>>>?ACFINTZbjs}ui]RG<3*#  '09DO[gt{qg^UNHB>;875544433221/.,*(&$"!  !"$&(*,./122334445578;>BHNU^gq{tg[OD90'  $,6@KXer{odZQIB=841/.-,,+++**)('%$"  "$%'()**+++,,-./148=BIQZdo{reXK@6,$ (183/,)'&%%%$$##"!  !"##$$%%%&'),/38>FNXcn{ƾ}oaSG<1( $,6BN[jyɾ{naVLC;4/*'$"!  !"$'*/4;CLVan{yj[NB6,$'1;HUcsŷ|naUJA81,'#  #',18AJUan|³scUH;1'"+5@M\k|˽~oaTI?7/)$   $)/7?ITao~ο|k\M@5+"%.9ESbr±pbTI>5.'" "'.5>ITbpʹrbSE9.%'15-&!  !&-5>IUbqðyhXI<1'!*4?M\l~ʸrcUI>4,%    %,4>IUcrʷ~l\M?4*!#,6BP`p̺scUI>4,%  %,4>IUcsнp`PB6,#$-8ESbtͺscUI=4,%  %,4=IUcstbSE8-$%/:FUev̹rcUH=4+$  $+4=HUcrïveUF:/%'0;HVfwɷqbTH=3+$  $+3=HTbqİwfVH;0' (1=IWgxųo`SG<2*#  #*2JXhxϿ{l^QE;2*#  #*2;EQ^l{xhXJ>3)!"*4?KYhxǷwh[NC90)"  ")09CN[hwͽxhYK?4*"#+5@LYhw̽rdWKA7/'!  !'/7AKWdrȹwhYL@5+#$,6AMZhwzl_SH>5-&    &-5>HS_lzõwhZMA6,$%.7BNZhvrfZND;2+$  $+2;DNZfrȽvhZNB7.%'/9CO[hvǾwk_TJ@80)"  ")08@JT_kwvh[OC9/'(1:EP\ivzocYNE<4-&!  !&-471+&!  !&+17>EMU]foxxmbWLB8//8BLWbmx~vmd[SKD<60*%    %*0671+&!  !&+17>EMU]foxxmbWLB8/.7AKValw|si`XOG@92,'"  "',29@GOX`is|wlaVKA7..6@JU`lwxoe\TKC<5/)#  #)/55-&    &-5>HS_lzõwhZMA6,$#+5@LYhw̽rdWKA7/'!  !'/7AKWdrȹwhYL@5+#"*4?KYhxǷwh[NC90)"  ")09CN[hwͽxhYK?4*"!)3>JXhxϿ{l^QE;2*#  #*2;EQ^l{xhXJ>3)! (1=IWgxųo`SG<2*#  #*24,%  %,4>IUcsнp`PB6,#!*4?M\l~ʸrcUI>4,%    %,4>IUcrʷ~l\M?4*!'15-&!  !&-5>IUbqðyhXI<1'%.9ESbr±pbTI>5.'" "'.5>ITbpʹrbSE9.%"+5@M\k|˽~oaTI?7/)$   $)/7?ITao~ο|k\M@5+"'1;HUcsŷ|naUJA81,'#  #',18AJUan|³scUH;1'$,6BN[jyɾ{naVLC;4/*'$"!  !"$'*/4;CLVan{yj[NB6,$ (183/,)'&%%%$$##"!  !"##$$%%%&'),/38>FNXcn{ƾ}oaSG<1( $,6@KXer{odZQIB=841/.-,,+++**)('%$"  "$%'()**+++,,-./148=BIQZdo{reXK@6,$  '09DO[gt{qg^UNHB>;875544433221/.,*(&$"!  !"$&(*,./122334445578;>BHNU^gq{tg[OD90'  #*3>>===<<;98641/-*(&%$$$$%&(*-/14689;<<===>>>?ACFINTZbjs}ui]RG<3*# %-6?IT_juvng`ZUQNLJIIHHHHHGFECA?<9641.,+))))+,.1469;8520/../0258;>BEHKNPQSTTTTTTUUVXZ^bglszvk`VKA80(!  #*2:DMXblv~xsnjgdcbaabbbbba`^\YVROKGC?<96544569EMT[bhnsx}ȿ~tkd]XUSSUX]dkt~}xsnhb[TME>6/)"  $*18?FMTZaglrw|Ǽvme^YUTTUY^emv|wrlgaZTMF?81*$   &,28?FLRY_ejpv}wme^XUSSUX^emwƻ}vpje_YRLF?82,&   !',28>EKQW]cipwövlc\WSQQSW\clvʾwpic]WQKE>82,'!  "',28=CIOU[biqyĶtjaZTQOOQTZajt˾yqib[UOIC=82,'"  "',16;AGMSZbjs}³}qg^WQMKKMQW^gq}ʽ}sjbZSMGA;61,'"  "&+/4:?EKRZclw̾xmbZRMIHHIMRZbmxǹwlcZRKE?:4/+&"  !%).28=DKS[ep|ŷsg]UNHECCEHNU]gs|pe[SKD=82.)%!  #',16>@CIOWalxǺti^TKC<61,'#  "&*05;99;>CIQZep}ʾylaVLD<50*&"   $)/5FNU\chmprsrpmhc\VOHA:4.)$  $).4:AHOV\chmprsrpmhc\UNF>70)#  #)/594/*&!!&*/49>CGKOQSSSQOKGC=82-'"   %*.37;?BDEEEDB?<840,'##',04871+&""&+17>ELS[bhnsvxyywsnhaZRJB:3,&    &,3;DMV_hpx~xph`WOF?81,'#!!#',18?FOW`hpx~xph_VMD;3,&   !&,3;DNXblvvlcYPG?82,(%#""#%(,28?GPYclvvlbXND;3,&!  !&,3;DNXcnzyndYPG?82-)'&&')-28?GPYdnyzncXND;3,&!  "',3;CMWco{¾zncXNF>72.+**+.27>FNXcnzÿ{ocWMC;3,'"  #'-3:BLVamzylaVLD=730..037=DLValyùzmaVLB:3-'#   $).4:BKT_kxŹui]SJB<743347DJPW]elu~wkaXPKGEEGKPXakwȻ~ule]WPJD>82,'"  "'-39@FLSY`fmu}ymcZSMIGGIMSZcmyʽ}umf`YSLF@93-'"  !&,3:AGNU\biov}znd[TOKIIKOT[dnzʾ}voib\UNGA:3,&!  %+29AHPW^elrx~ɼynd\UOLJJLOU\dnyȽ~xrle^WPHA92+%  #)08@HPX`gnu{¶wmc[TOLJJLOT[cmwĻ{ung`XPH@80)#  !'.6>FOW`hpw}ĺtjaYSNKIIKNSYajtž}wph`WOF>6.'!  $+3;DMV_hpxzpf^WQLIHHILQW^fpz¼xph_VMD;3+$  !(08@JS]foxÿ}sjbZSNJGEEGJNSZbjs}¾xof]SJ@80(!  %,4=FPZdmw}uld\UOJFDBBDFJOU\dlu}wmdZPF=4,%  ")19BLV`ku~{sld]VPJFB@??@BFJPV]dls{~uk`VLB91)"  &-6?HR]gr||voib\UOJEA><;;<>AEJOU\biov||rg]RH?6-&  #*2;DOYdoy~|zvsnid^YSMHC?<976679HR]it~xsnkhfdcba`_^\ZXUQNJFB>:630.-,,-.036:>BFJNQUXZ\^_`abcdfhknsx~ti]RH>4,%  ")1;DOZfr}~vpid`\ZWVUTSRQOMKIFC@=:630-+)(''()+-036:=@CFIKMOQRSTUVWZ\`dipv~}rfZOD;1)"  &.7ALWco{xpha[VROLJIGFEDCB@><:752/,*'&$#""#$&'*,/257:<>@BCDEFGIJLORV[ahpx{ocWLA7.& $+4>IT`mz}sjaZSMIEB@>=;;:986531/-+(&$"  "$&(+-/135689:;;=>@BEIMSZajs}zm`TI>4+$ !(1:EQ]jwþyoe[SLFA<9753210//.,+*(&$"  "$&(*+,.//01235795-&!  !&-5>HTbp˺sbSE9.%(1=JXhyƵpaTG=3+$  $+3=GTapñyhXJ=1(!*4@N]mɷpaSG<2*#  #*25-&  &-5>HS_lyŸ~oaSG<2)+4>IUbp~ǽ~qeYNC:2*$  $*2:CNYeq~~pbUI>4+-6@KWdrĻui]RH?6.'!  !'.6?HR]iużrdWK@6-/8BMYfsymbWLC:2+%  %+2:CLWbmysfYMB8/0:DP\hu{pe[PG>6/("  "(/6>GP[ep{uh\PD:0270)$  $)07>FOYcmxxl_SH=45?IUamy}sh^UKC;4-'"  "'-4;CKU^hs}ymaUI?56@JVbnzyoe[RIA92,&!  !&,29AIR[eoyznbVJ@66@KVbo{xmcYPG?81+%    %+18?GPYcmx{obVK@66@KVbo{xmcYPG?81+%    %+18?GPYcmx{obVK@66@JVbnzyoe[RIA92,&!  !&,29AIR[eoyznbVJ@65?IUamy}sh^UKC;4-'"  "'-4;CKU^hs}ymaUI?54=HS_lxxmcYOF>70)$  $)07>FOYcmxxl_SH=426/("  "(/6>GP[ep{uh\PD:0/8BMYfsymbWLC:2+%  %+2:CLWbmysfYMB8/-6@KWdrĻui]RH?6.'!  !'.6?HR]iużrdWK@6-+4>IUbp~ǽ~qeYNC:2*$  $*2:CNYeq~~pbUI>4+)25-&  &-5>HS_lyŸ~oaSG<2)'0:ER_n}ʼseXLB8/(!  !(/8BLXesɻ}n_RE:0'%.8CP^m}Ǹzk]QE;2*#  #*2;EQ]kz;}m^PC8.%$,6BN]l|²pbTH=4+$  $+4=HTbp|l]NB6,$"+5@M[k|ʹufXK@5-%  %-5@KXfuIJ|k[M@5+"!)3?KZj{yi[MA7.&  &.7AM[iyų{jZK?3)! (2=JXhzŲ|l]OC8/'    '/8CO]l|ƲzhXJ=2( &0;HVfxȵ~n^QD90(!  !(09DQ^n~űxfVH;0&%.9FTduʷo`RE:0(!  !(0:ER`o®udTF9.%#,7CQ`qʷp`RF;1)"  ")1;FR`pѾq`QC7,#!*4@N]mɷpaSG<2*#  #*25-&!  !&-5>HTbp˺sbSE9.%"+5AN\l|qcVJ@7/(# #(/7@JVcq|l\NA5+" (1IT`mz}sjaZSMIEB@>=;;:986531/-+(&$"  "$&(+-/135689:;;=>@BEIMSZajs}zm`TI>4+$ &.7ALWco{xpha[VROLJIGFEDCB@><:752/,*'&$#""#$&'*,/257:<>@BCDEFGIJLORV[ahpx{ocWLA7.&  ")1;DOZfr}~vpid`\ZWVUTSRQOMKIFC@=:630-+)(''()+-036:=@CFIKMOQRSTUVWZ\`dipv~}rfZOD;1)"  %,4>HR]it~xsnkhfdcba`_^\ZXUQNJFB>:630.-,,-.036:>BFJNQUXZ\^_`abcdfhknsx~ti]RH>4,%   '/8AKValw|yvusrrqponmjhea]YTOJFA=9642112469=AFJOTY]aehjmnopqrrsuvy|wlaVKA8/'   #*2;DOYdoy~|zvsnid^YSMHC?<976679<;;<>AEJOU\biov||rg]RH?6-&  ")19BLV`ku~{sld]VPJFB@??@BFJPV]dls{~uk`VLB91)"  %,4=FPZdmw}uld\UOJFDBBDFJOU\dlu}wmdZPF=4,%  !(08@JS]foxÿ}sjbZSNJGEEGJNSZbjs}¾xof]SJ@80(!  $+3;DMV_hpxzpf^WQLIHHILQW^fpz¼xph_VMD;3+$  !'.6>FOW`hpw}ĺtjaYSNKIIKNSYajtž}wph`WOF>6.'!  #)08@HPX`gnu{¶wmc[TOLJJLOT[cmwĻ{ung`XPH@80)#  %+29AHPW^elrx~ɼynd\UOLJJLOU\dnyȽ~xrle^WPHA92+%  !&,3:AGNU\biov}znd[TOKIIKOT[dnzʾ}voib\UNGA:3,&!  "'-39@FLSY`fmu}ymcZSMIGGIMSZcmyʽ}umf`YSLF@93-'"  "',28>DJPW]elu~wkaXPKGEEGKPXakwȻ~ule]WPJD>82,'"  "&+1672.+**+.27>FNXcnzÿ{ocWMC;3,'"  !&,3;DNXcnzyndYPG?82-)'&&')-28?GPYdnyzncXND;3,&!  !&,3;DNXblvvlcYPG?82,(%#""#%(,28?GPYclvvlbXND;3,&!   &,3;DMV_hpx~xph`WOF?81,'#!!#',18?FOW`hpx~xph_VMD;3,&    &,3:BJRZahnswyyxvsnhb[SLE>71+&""&+17>ELS[bhnsvxyywsnhaZRJB:3,&    %+18?FMSY^cfhhgfc^ZTNHA;5/*%!!%*/5;AHNTZ^cfghhfc^YSMF?81+%   $)/5;AFKPSVXXXVTPLGB=82-)$  $)-28=BGLPTVXXXVSPKFA;5/)$  "',16;?CFHIJIHFC@<83/+&""&+/38<@CFHIJIHFC?;61,'"   $(,0479;<=<;:852.+'#  #'+.258:;<=<;9740,($   !$'*,.01110/-+)&#   #&)+-/01110.,*'$!  !$%&'(('&%#! !#%&'(('&%$!               !!!!   !!!!   !#%')***))'&$! !$&'))***)'%#!  "&),/13444320.,)&#  #&),.02344431/,)&"  "&*.269<>?@@?=;852.*'#  #'*.258;=?@@?><962.*&"  $).38=BFIKMNMLJGD@<73.*&""&*.37<@DGJLMNMKIFB=83.)$  !&+18>DJOTWZ\]\[XUQLGA<61,'##',1681+&!  !'-4;BIPW]cgjlmmkhd_YSLF?93.)$!!$).39?FLSY_dhkmmljgc]WPIB;4-'!  "(.5=EMV^fmsx|~~|xsng`XPIB;4.)%""%).4;BIPX`gnsx|~~|xsmf^VME=5.("  "(/6>GPZcmu}}vme\SJC;5/*&#! !#&*/5;CJS\emv}}umcZPG>6/("  #)/6?HQ\fq|{qg]TKB;4/*'%$$%'*/4;BKT]gq{|qf\QH?6/)#  $)/6?HR\ht~sh]SJA:4/+)'')+/4:AJS]hs~th\RH?6/)$   %*07?GQ\htſ~rf[QH@93/-++-/39@HQ[fr~ºth\QG?70*%   "&+17?GQ[gsǽ|ocXNE>830//038>ENXco|sg[QG?71+&"   $(-28?GPZeq~ʾwj^TJB<742247;99;>DKT^jwͿymcZQJC=72-($  !%*/5:@FLS[clwʺ{nbWNGA><<>AGNWbn{Ǹwlc[SLF@:5/*%!  !&,17=CIPV]emvξqeZQJD@>>@DJQZeqvme]VPIC=71,&!  !&,29?FLSZ`gowsg\SLFB@@BFLS\gsŷwog`ZSLF?92,&!   &,3:AHOV]dkryϿth]TMGDBBDGMT]htȼyrkd]VOHA:3,&   %+2:AIQX`gnu|̽th^UNHDCCDHNU^htʿ|ung`XQIA:2+%  #*18AIQZbjryƸrg]TMHDCCDHMT]gryrjbZQIA81*#  !'.6?HQZclt|˾{oe[SLGDBBDGLS[eo{ǿ|tlcZQH?6.'!  $,3HR]hr}ý~tjaXQJEA><<>AEJQXajt~}rh]RH>5,%  !(09CNXdoz~ulcZSLFA=;99;=AFLSZclu~zodXNC90(!  %,5>IT_jv{skc[SMFA=976679=AFMS[cks{vj_TI>5,%  !)1:DNZeq}{ung`YSLFA<85322358:62/,)'&%%&'),/26:>BGKNRUX[]_acegjmqv{{ocWK@7.&  #*3<:875320.,*'%#!!#%'*,.023578:<>@CGLRX`hr|ſ}pcVJ?5,$ !(1;FR^lzºvkaXPIC>:7420/-,+)(&%#!!#%&()+,-/0247:>CIPXakvzl^RF;1(! $-6AMZgvĺ}qf[RIB<72/,*('&$#"!  !"#$&'(*,/2770+&#   #&+07>GQ]iwŸzk\NB7-$'1;HUdsͿtfYNC:2,&" "&,2:CNYftĵsdUH;1'"+5@M\k|²rdWK@7/(#  #(/7@KWdr|k\M@5+"%.9ESbrijqbTH>4,%    %,4>HTbqʹrbSE9.%(1KYizѿwgXK?4+$  $+4?KXgwƳziYK>3)!"+5@M\k|˺sdUH=3*"  "*3=HUdsƴ|k\M@5+"$-7BO^m~ijo`RF;1(!  !(1;FR`oŴ~m^OB7-$&/9DQ`o̼zj\OC8/'    '/8CO\jzijo`QD9/&(1;GTbq³seWK?5-%  %-5?KWes³qbTG;1(*3>IVdsƸ{m_RF<3*#  #*33*,6@LYguǻsfYMB80(!  !(08BMYfs˿ugYL@6,/8CO\ixǼyl_SH>5,%  %,5>HS_lyȽxi\OC8/1;FR_lzż~qdXMC91)#  #)19CMXdq~Ƽzl_RF;13>IUbo}ļui]RG>5-&    &-5>GR]iuļ}obUI>36@LXerüymaVLB91*$  $*19BLVamyûreXL@68CN[huý~rf[QG>5.'!  !'.5>GQ[fr~»uh[NC8:EP]jxĿxlaVLB:2+%  %+2:BLValx»xj]PE:;FR_lzsh]RH?70)#  #)07?HR]hszl_RF;5.'!  !'.5>GQ[fr~»uh[NC86@LXerüymaVLB91*$  $*19BLVamyûreXL@63>IUbo}ļui]RG>5-&    &-5>GR]iuļ}obUI>31;FR_lzż~qdXMC91)#  #)19CMXdq~Ƽzl_RF;1/8CO\ixǼyl_SH>5,%  %,5>HS_lyȽxi\OC8/,6@LYguǻsfYMB80(!  !(08BMYfs˿ugYL@6,*3>IVdsƸ{m_RF<3*#  #*33*(1;GTbq³seWK?5-%  %-5?KWes³qbTG;1(&/9DQ`o̼zj\OC8/'    '/8CO\jzijo`QD9/&$-7BO^m~ijo`RF;1(!  !(1;FR`oŴ~m^OB7-$"+5@M\k|˺sdUH=3*"  "*3=HUdsƴ|k\M@5+"!)3>KYizѿwgXK?4+$  $+4?KXgwƳziYK>3)!'14,%    %,4>HTbqʹrbSE9.%"+5@M\k|²rdWK@7/(#  #(/7@KWdr|k\M@5+"'1;HUdsͿtfYNC:2,&" "&,2:CNYftĵsdUH;1'$-7BN\kzʽwi]QG>70+&#   #&+07>GQ]iwŸzk\NB7-$!(2:7420/-,+)(&%#!!#%&()+,-/0247:>CIPXakvzl^RF;1(! $,5?JVcp}|rh`XRLGC@><:875320.,*'%#!!#%'*,.023578:<>@CGLRX`hr|ſ}pcVJ?5,$  '/9CNZgsÿypha[VQNKIGECA?=;9741.+)&$!  !$&)+.1479;=?ACEGIKNQV[ahpy½sgZNC9/'   #*3:62/,)'&%%&'),/26:>BGKNRUX[]_acegjmqv{{ocWK@7.&  ")1;EP[gt}zxvtrpnlifc_[VQLGB=951.,****,.159=BGLQV[_cfilnprtvxz}tg[PE;1)"  %-5?IU`lx|yvqmgb\VPJE?;731/../137;?EJPV\bgmqvy|xl`UI?5-%  !)1:DNZeq}{ung`YSLFA<85322358IT_jv{skc[SMFA=976679=AFMS[cks{vj_TI>5,%  !(09CNXdoz~ulcZSLFA=;99;=AFLSZclu~zodXNC90(!  %,5>HR]hr}ý~tjaXQJEA><<>AEJQXajt~}rh]RH>5,%  !(09BLV`jt~Ǿ|qg]UNHD@??@DHNU]gq|½~tj`VLB90(!  $,3>@DJQZeqvme]VPIC=71,&!  !%*/5:@FLS[clwʺ{nbWNGA><<>AGNWbn{Ǹwlc[SLF@:5/*%!  $(-27=CJQZcmyówj^TKD>;99;>DKT^jwͿymcZQJC=72-($  "&*/5:AHPYdo{ɺqdYOG@;8668;@GOYdqô{odYPHA:5/*&"   $(-28?GPZeq~ʾwj^TJB<742247830//038>ENXco|sg[QG?71+&"   %*07?GQ\htſ~rf[QH@93/-++-/39@HQ[fr~ºth\QG?70*%   $)/6?HR\ht~sh]SJA:4/+)'')+/4:AJS]hs~th\RH?6/)$  #)/6?HQ\fq|{qg]TKB;4/*'%$$%'*/4;BKT]gq{|qf\QH?6/)#  "(/6>GPZcmu}}vme\SJC;5/*&#! !#&*/5;CJS\emv}}umcZPG>6/("  "(.5=EMV^fmsx|~~|xsng`XPIB;4.)%""%).4;BIPX`gnsx|~~|xsmf^VME=5.("  !'-4;BIPW]cgjlmmkhd_YSLF?93.)$!!$).39?FLSY_dhkmmljgc]WPIB;4-'!  !&+18>DJOTWZ\]\[XUQLGA<61,'##',1681+&!  $).38=BFIKMNMLJGD@<73.*&""&*.37<@DGJLMNMKIFB=83.)$  "&*.269<>?@@?=;852.*'#  #'*.258;=?@@?><962.*&"  "&),/13444320.,)&#  #&),.02344431/,)&"  !#%')***))'&$! !$&'))***)'%#!   !!!!   !!!!           "#####"   "#####"   "%')*,,,,+*(&$"  "$&(*+,,,,*)'%"   #'*.0356776542/,*&#  #&*,/2456776530.*'#   #',048<>ABCCBA?<962.*'#  #'*.269<840,'#   %*05:?DHLNPQQPNKHD@;72.)%""%).27;@DHKNPQQPNLHD?:50*%   "'-39@FLRVZ^```_]YUQKF@;50+'#  #'+05;@FKQUY]_```^ZVRLF@93-'"  #(/6=DLSZ`fknpqqolhd^XQKD>72-($!!$(-27>DKQX^dhloqqpnkf`ZSLD=6/(#  #)07?GPYaipw|}ysle]UNF?93-)%#! !#%)-39?FNU]elsy}|wpiaYPG?70)#  $*18AIS]fpy{sjaXOG?93.)&$##$&).39?GOXajs{ypf]SIA81*$   %+19AJT_juwlbXOF?82.*(''(*.28?FOXblwuj_TJA91+%   !&+29BKU`kwxlaWME=72.+**+.27=EMWalxwk`UKB92+&!  #'-3:BKU`lxŽvj_TKC<62/--/26:99:>CKS^jwŶti`XPIC=72-(#   $*/5:@GMT[bkt~̻{maVMF@<::<@FMVam{~tkb[TMG@:5/*$    %+17=DJQX_fnvϾ}ocXOGB><<>BGOXco}ǹvnf_XQJD=71+%   %+28?FNU\cjqyп~pdYPHC?==?CHPYdp~yqjc\UNF?82+%  $+19@HPX`gov}ν~pdYPIC?==?CIPYdp~ź}vog`XPH@91+$  #)08@IQZckszʺ|ocXPHC?==?CHPXco|ɿzskcZQI@80)#   '.6?HQ[dmv~ôylaWNGB?==?BGNWalyº~vmd[QH?6.'   $,4IT_kvĺti_VMF@<9889<@FMV_itvk_TI>5,%  !(0:DOZfr~»wlbYPIB=965569=BIPYblw~rfZOD:0(!  $,5?IUamzwmd[RKD>96322369>DKR[dmwzmaUI?5,$   '09DO[gt¾|tkc[SKE>9520..0259>EKS[ckt|½tg[OD90'   #+4>ITan{|uog`YRKD>941.,++,.149>DKRY`gou|¼{naTI>4+#   '/8CNZgtþ~zvrmga[UOIC=83/,*(''(*,/38=CIOU[agmrvz~tgZNC8/'   #+4=HTan{|xuspmjfb^ZUPJE@;62.*(%$##$%(*.26;@EJPUZ^bfjmpsux|ƿ{naTH=4+#   '/8CN[guľ}wrmjfc`^[XTQMIE@<83/,(%#!  !#%(,/38<@EIMQTX[^`cfjmrw}Ľug[NC8/'   #+4>IUbo|ºyqke`\XURPMJGDA>;730,)&#!!#&),037;>ADGJMPRUX\`ekqy¹|obUI>4+#   '09DP\iwǿxog`YTPLIFCA><:741/,)&#!!#&),/147:<>ACFILPTY`goxwi\PD90'  $,5?KWdrżzof]VOJEA>;86420.,)'%"  "%'),.02468;>AEJOV]fozǾrdWK?5,$  (1;FR_l{ú~rg]TMF@;741/-+)(&$"  "$&()+-/147;@FMT]gr~ƽ{l_RF;1(  $,6ALYgv·xk`VME>83/,)'%#"  "#%'),/38>EMV`kxƻvgYLA6,$ (1;GTap¶reZOF>71,(%"   "%(,17>FOZerƺpaTG;1( #,6AM[iy´{m`TJ@81+&" "&+18@JT`m{ŷyi[MA6,#'0:FTbq³wi[PE;3,&"  "&,3;EP[iw³qbTF:0'"*4?LZiy³seXLA7/("  "(/7ALXes̽yiZL?4*"$-8DQ`pòqbTH=4,%  %,4=HTbqǶp`QD8-$'0;HVfvò~n_RE;1)"  ")1;ER_n~ϾvfVH;0'!)3?L[k|ñ|l]OC8/'    '/8CO]l|ų|k[L?3)!#,6BP_o°zj[MA6-%  %-6AM[jz˹o_PB6,#%.9EScsxgXK?4+#  #+4?KXgxоscSE9.%'1KYizʸqbSF;1(!  !(1;FSbqñziYK>3)!#,6AN\l}ij~m^PD8/&  &/8DP^m~ų}l\NA6,#%.8DQ_oνyiZMA6-%  %-6AMZiyŴo_QD8.%'0;GTbrŵsdVI>3+#  #+3>IVdsŵrbTG;0'*3>JWeu˼|m_QE:1(!  !(1:EQ_m|ŶueWJ>3*-6AMZixugYLA7.&  &.7ALYguŶxiZMA6-/9DQ^l{ö|n`SG=3+$  $+3=GS`n|ķ{l^QD9/2=HTbpŹtfYMB90(!  !(09BMYftŹpbTH=25@LXftƼyl_SH>4,%  %,4>HS_lyźtfXL@58CO\jxȾqeXMC91)"  ")19CMXeqƼxj\OC8;FS`n|wj^RH>5-&    &-5>HR^jwȾ|n`SF;>IVcrĻ~qdXMC:1*#  #*1:CMXdq~rcVI>@LYfuxk_TI?6.'!  !'.6?IT_kx¸ufYL@BN[iwƾtg[PF<4,%    %,4IVcrĻ~qdXMC:1*#  #*1:CMXdq~rcVI>;FS`n|wj^RH>5-&    &-5>HR^jwȾ|n`SF;8CO\jxȾqeXMC91)"  ")19CMXeqƼxj\OC85@LXftƼyl_SH>4,%  %,4>HS_lyźtfXL@52=HTbpŹtfYMB90(!  !(09BMYftŹpbTH=2/9DQ^l{ö|n`SG=3+$  $+3=GS`n|ķ{l^QD9/-6AMZixugYLA7.&  &.7ALYguŶxiZMA6-*3>JWeu˼|m_QE:1(!  !(1:EQ_m|ŶueWJ>3*'0;GTbrŵsdVI>3+#  #+3>IVdsŵrbTG;0'%.8DQ_oνyiZMA6-%  %-6AMZiyŴo_QD8.%#,6AN\l}ij~m^PD8/&  &/8DP^m~ų}l\NA6,#!)3>KYizʸqbSF;1(!  !(1;FSbqñziYK>3)!'171,(%"   "%(,17>FOZerƺpaTG;1( $,6ALYgv·xk`VME>83/,)'%#"  "#%'),/38>EMV`kxƻvgYLA6,$  (1;FR_l{ú~rg]TMF@;741/-+)(&$"  "$&()+-/147;@FMT]gr~ƽ{l_RF;1(  $,5?KWdrżzof]VOJEA>;86420.,)'%"  "%'),.02468;>AEJOV]fozǾrdWK?5,$  '09DP\iwǿxog`YTPLIFCA><:741/,)&#!!#&),/147:<>ACFILPTY`goxwi\PD90'   #+4>IUbo|ºyqke`\XURPMJGDA>;730,)&#!!#&),037;>ADGJMPRUX\`ekqy¹|obUI>4+#   '/8CN[guľ}wrmjfc`^[XTQMIE@<83/,(%#!  !#%(,/38<@EIMQTX[^`cfjmrw}Ľug[NC8/'   #+4=HTan{|xuspmjfb^ZUPJE@;62.*(%$##$%(*.26;@EJPUZ^bfjmpsux|ƿ{naTH=4+#   '/8CNZgtþ~zvrmga[UOIC=83/,*(''(*,/38=CIOU[agmrvz~tgZNC8/'   #+4>ITan{|uog`YRKD>941.,++,.149>DKRY`gou|¼{naTI>4+#   '09DO[gt¾|tkc[SKE>9520..0259>EKS[ckt|½tg[OD90'   $,5?IUamzwmd[RKD>96322369>DKR[dmwzmaUI?5,$  !(0:DOZfr~»wlbYPIB=965569=BIPYblw~rfZOD:0(!  %,5>IT_kvĺti_VMF@<9889<@FMV_itvk_TI>5,%  !(09CMWbmxȽ|pdZQJC?;::;?CJQZdp|xmbWMC90(!  $,4<<>BGOXco}ǹvnf_XQJD=71+%    $*/5:@GMT[bkt~̻{maVMF@<::<@FMVam{~tkb[TMG@:5/*$   #(-27=CIPX`itƶwj^SKC>:99:>CKS^jwŶti`XPIC=72-(#  !&*/49@FNV_iu;sfZPGA;8668;AGPZfsɺui_VNF@94/*&!  #',17=DLU_jv´zmaVLD=854458=DLVamzʼvj_ULD=71,'#  !%)/4;CKU_kx¶rf[PG@:521125:@GP[frƻxk_UKC;4/)%!  #'-3:BKU`lxŽvj_TKC<62/--/2672-($!!$(-27>DKQX^dhloqqpnkf`ZSLD=6/(#  "'-39@FLRVZ^```_]YUQKF@;50+'#  #'+05;@FKQUY]_```^ZVRLF@93-'"   %*05:?DHLNPQQPNKHD@;72.)%""%).27;@DHKNPQQPNLHD?:50*%   #',048<>ABCCBA?<962.*'#  #'*.269<840,'#   #'*.0356776542/,*&#  #&*,/2456776530.*'#   "%')*,,,,+*(&$"  "$&(*+,,,,*)'%"   "#####"   "#####"          "#$%%%%$#"  "#$%%%%$#"    #&(*,-....-+*(%#!!#%(*+-....-,*(&#    $(+/247899987530-*'$!!$'*-035789998742/+($   #(,159=@CEFFEDB@=:63/+'$!!$'+/36:=@BDEFFEC@=951,(#  !&+16FMU\chmqtuusqmhc]WPIC=72-)&#!!!!#&)-27=CIPW]chmqsuutqmhc\UMF>70)$  %+19@IRZcksy~xqjc[SLD>82.*'%$$%'*.28>DLS[cjqx~yskcZRI@91+%   %+2:BKU^hr{xof]ULE>82.+)(()+.28>ELU]fox{rh^UKB:2+%   !',3;CLValw|rh^TLD=72/,++,/27=DLT^hr|wlaVLC;3,'!  #(.4;DMWbnz}rg\RJB;62/../26;BJR\gr}znbWMD;4.(#  !%*/6=ENXcn{¸{ocYOG@:521125:@GOYco{ù{ncXNE=6/*%!   $(-28>FNXcn{ƺwj_TKC=854458=CKT_jwʾ{ncXNF>82-($   "&+05;AHPYcnzƸ}pdYOG@;8668;@GOYdp}zncYPHA;50+&"   %).38>DKR[dnyuh\RJC=:88:=CJR\hu;ynd[RKD>83.)%   "',17FNU]els{Ͼ}obWNGA=;;=AGNWbo}ǻ{sle]UNF>70)#  !(/7?GPXaiqy̼{naVMF@=;;=@FMVan{¸yqiaXPG?7/(!   &-5>GPZclu~Ƿyk_ULE?<::5-&   $+3:99:>CJR\huſxndZOE<3+$  !(09BMXcnyŶ}pdYOGA<8778IT`lxŹvj^TKD>964469>DKT^jvxl`TI>5,$   (0:DO[huzncYOG@:632236:@GOYcnz¼uh[OD:0(   #+4?JVbp}{pf\RJB<730//03783/,)((),/38>DLT\envǾ~pbUH=3*"  %-7BMZhvž~wpiaZRKD>82.*(&%%&(*.28>DKRZaipw~ĺvhZMB7-%  !(1;FS`n|ƿ|xsnhb\UOHB<72-)&$"!!"$&)-274+#  #+4>JXfvŴ}l]NA5+#%.8DRaqʹscUH<2)!  !)2KYhy|l\OB7-%  %-7BO\l|пyhYK>3*!$,6AN\l|̼wgYK?4+#  #+4?KYgw|l\NA6,$&/9ER`oŵrcUH<2)!  !)24+$  $+4>HTan}˿vhZMA69EQ^m{ƺugZNC90(!  !(09CNZgu¶{m^QE9=IUcrʿ|naTI>5-%  %-5>ITan|ƺrcUI=@LZhwŹuh[OD:1)#  #)1:DO[huʿwhZL@CP^l{}obVJ@6.'    '.6@JVbo}ö{l^PCFSapȽxk^RF<3+$  $+35-%  %-5>ITan|ƺrcUI=9EQ^m{ƺugZNC90(!  !(09CNZgu¶{m^QE96AMZhv¶}naTH>4+$  $+4>HTan}˿vhZMA62=HUcq˿vhZNB8/'    '/8BNZhvɼqcUH=2/9DP^l|Ⱥ~o`SG<2*"  "*2KYhy|l\OB7-%  %-7BO\l|пyhYK>3*!'0;GUduƵo`RE9/'    '/9ER`oͼudUG;0'%.8DRaqʹscUH<2)!  !)24+#  #+4>JXfvŴ}l]NA5+# )2=JXhxνyi[MA7-&  &-7AM[iyпxhXJ=2) &/:FTcsϿ|m^QD:0(!  !(0:DQ^m|ɸscTF:/&#,6BO]m}pbTH=4+%  %+4=HTbp}m]OB6,#!)2=JWfv³tfXLA8/("  "(/8ALXftǸvfWJ=2)!&.9DQ_n~õyk]QF<4-'!  !'-482.*(&%%&(*.28>DKRZaipw~ĺvhZMB7-%  "*3=HUbp~vne\TLD>83/,)((),/38>DLT\envǾ~pbUH=3*"  '/9CO\iwzpf]TKD=73/-,,-/37=DKT]fpzwi\OC9/'  #+4?JVbp}{pf\RJB<730//037IT`lxŹvj^TKD>964469>DKT^jvxl`TI>5,$  !(09BMXcnyŶ}pdYOGA<8778:99:>CJR\huſxndZOE<3+$   &-5>GPZclu~Ƿyk_ULE?<::5-&   !(/7?GPXaiqy̼{naVMF@=;;=@FMVan{¸yqiaXPG?7/(!  #)07>FNU]els{Ͼ}obWNGA=;;=AGNWbo}ǻ{sle]UNF>70)#  #)/6DKR[dnyuh\RJC=:88:=CJR\hu;ynd[RKD>83.)%   "&+05;AHPYcnzƸ}pdYOG@;8668;@GOYdp}zncYPHA;50+&"   $(-28>FNXcn{ƺwj_TKC=854458=CKT_jwʾ{ncXNF>82-($   !%*/6=ENXcn{¸{ocYOG@:521125:@GOYco{ù{ncXNE=6/*%!  #(.4;DMWbnz}rg\RJB;62/../26;BJR\gr}znbWMD;4.(#  !',3;CLValw|rh^TLD=72/,++,/27=DLT^hr|wlaVLC;3,'!   %+2:BKU^hr{xof]ULE>82.+)(()+.28>ELU]fox{rh^UKB:2+%   %+19@IRZcksy~xqjc[SLD>82.*'%$$%'*.28>DLS[cjqx~yskcZRI@91+%  $)07>FMU\chmqtuusqmhc]WPIC=72-)&#!!!!#&)-27=CIPW]chmqsuutqmhc\UMF>70)$  "(.4;AHNSY]`bddca^ZUPKE@:50,($!!$(,05:@EKPUZ^acddb`]YSNHA;4.("  !&+16BDFHHHGFDA>;740,)&#  #&),047;>ADFGHHHFDB>:62-($  !&,17FNU]djosvxxwuqmhb\VOIC=83/+)'&&')+/38=CIOV\bhmquwxxvsojd]UNF>70*$   %+29AIR[dlt{}wpiaZRKD>830-+**+-038>DKRZaipw}{tld[RIA92+%   !&,3;CLU_is|~umd[SKD>840.--.048>DKS[dmu~|si_ULC;3,&!  #(.4DKS\fq}ʼuh]SKD?<::83.)%!  #(-27=BIOW_hr}ĵyl`VMFA=;;=AFMV`ly}rh_WOIB=72-(#   %*05;AGNT[ckt~˺|nbWNGA><<>AGNWbn|̾~tkc[TNGA;50*%   !&,28?ELSZahpxξ}ocXOGB><<>BGOXco}ȺxphaZSLE?82,&!   &-3:BIQX_gnu}п}ocXOGA><<>AGOXco}ķ}ung_XQIB:3-&    &-4IVcp~ƽui^SJB;62/--/26;BJS^iuż~pcVI>4+#  &.8CO\jxüvk`VMD=72.,**,.27=DMV`kvƼxj\OC8.&  !)282.*(''(*.28>FNWakuŹqbUH<2)!  $,6AMZhwzqh_VNF?82-*'$##$'*-28?FNV_hqzwhZMA6,$  '/:ER_n}»yskd\TLE>82-)%#! !#%)-28>ELT\dksyǺ}n_RE:/'  "*3>IVdsº~zuojd]WPIC=71,($!!$(,17=CIPW]djouz~̿sdVI>3*"  %-7BN[jyĺ|wrnie`[VPKE?:50+'#  #'+05:?EKPV[`einrw|Ķyj[NB7-%   (1;FS`o~Ǽysmhc^ZVRMID?;61-)%!!%)-16;?DIMRVZ^chmsyȻ~o`SF;1(   #,5?KXfuʿ|tle_ZUQLIEA=951.*&#  #&*.159=AEILQUZ_elt|˿ufXK?5,#  '/9DQ^l{÷{qh`YRMHD@=9630,)&#  #&),0369=@DHMRY`hq{ö{l^QD9/' #+4>JVdrƻ|pf]UMGB=962/-*'%""%'*-/269=BGMU]fp|ȻrdVJ>4+# &/8CP]ky˿~rg\SKC=840,*'$"   "$'*,048=CKS\gr~yk]PC8/& "*3>IVdrĹui]SJB;50+(%"   "%(+05;BJS]iuǻrdVI>3*" %.8CO\kzʿzmaUKB:3-($!  !$(-3:BKUamzµzk\OC8.%!)2=HUcrƺseYND;3,'"  "',3;DNYesʽrcUH=2)!$-6BN\jzõzl_RG=5-'"  "'-5=GR_lzƸzj\NB6-$'0;FTbqͿtfYMB80("  "(08BMYftqbTF;0'"*4?KYhx˽~oaTH=3+$  $+3=HTao~ȹxhYK?4*"%-8CP^n~ɺzj\OC9/(!  !(/9CO\jz~n^PC8-%'0;GUdsǷvfXK?5,$  $,5?KXfvǷsdUG;0'"*4?KYhyĴrbTG<2)"  ")2JWfvȸueWJ>3*"  "*3>JWeuɹvfWJ>3)!$,6AN[jz²paSF;1(    (1;FSap˼zj[NA6,$'0:ER`oʻ{k\OC8.&  &.8CO\k{Ϳo`RE:0'*3>JWetôufXK?4+#  #+4?KXfu³teWJ>3*-7BN\jyɻ~n`SF;1)!  !)1;FS`n~ŷyj\NB7-1;GSaowhZMB7.&  &.7BMZhwȻoaSG;15@LYguƹ~pbUH=3+#  #+3=HUbp~̿ugYL@59DQ^m|˿wi\OC90(!  !(09CO\iwķ|m^QD9=IVdsŸpcVJ?5,%  %,5?JVcpɽsdVI=AN[jyxj]PE:1)"  ")1:EP]jxöyj[NAER`oȻseXLA7.&  &.7ALXesɼo`REIVetŸ|n`SG=3+$  $+3=GS`n|³teVILZixõxj\PD:1)"  ")1:DP\jxǹxiZLN\l|ugYMB7.'    '.7BMYgu˽|l\NP^n~seWK@6-%  %-6@KWes~n^PQ_ordVJ?5,%  %,5?JVdro_QQ_ordVJ?5,%  %,5?JVdro_QP^n~seWK@6-%  %-6@KWes~n^PN\l|ugYMB7.'    '.7BMYgu˽|l\NLZixõxj\PD:1)"  ")1:DP\jxǹxiZLIVetŸ|n`SG=3+$  $+3=GS`n|³teVIER`oȻseXLA7.&  &.7ALXesɼo`REAN[jyxj]PE:1)"  ")1:EP]jxöyj[NA=IVdsŸpcVJ?5,%  %,5?JVcpɽsdVI=9DQ^m|˿wi\OC90(!  !(09CO\iwķ|m^QD95@LYguƹ~pbUH=3+#  #+3=HUbp~̿ugYL@51;GSaowhZMB7.&  &.7BMZhwȻoaSG;1-7BN\jyɻ~n`SF;1)!  !)1;FS`n~ŷyj\NB7-*3>JWetôufXK?4+#  #+4?KXfu³teWJ>3*'0:ER`oʻ{k\OC8.&  &.8CO\k{Ϳo`RE:0'$,6AN[jz²paSF;1(    (1;FSap˼zj[NA6,$!)3>JWfvȸueWJ>3*"  "*3>JWeuɹvfWJ>3)!'0:FSbq̽yj[MA6-$  $-6AM[jyƵqbSF:0'$-7BO^m~~n_QD9/'    '/9DQ_n~±~m^OB7-$"*4?KYhyĴrbTG<2)"  ")2IVdrĹui]SJB;50+(%"   "%(+05;BJS]iuǻrdVI>3*" &/8CP]ky˿~rg\SKC=840,*'$"   "$'*,048=CKS\gr~yk]PC8/& #+4>JVdrƻ|pf]UMGB=962/-*'%""%'*-/269=BGMU]fp|ȻrdVJ>4+# '/9DQ^l{÷{qh`YRMHD@=9630,)&#  #&),0369=@DHMRY`hq{ö{l^QD9/'  #,5?KXfuʿ|tle_ZUQLIEA=951.*&#  #&*.159=AEILQUZ_elt|˿ufXK?5,#   (1;FS`o~Ǽysmhc^ZVRMID?;61-)%!!%)-16;?DIMRVZ^chmsyȻ~o`SF;1(   %-7BN[jyĺ|wrnie`[VPKE?:50+'#  #'+05:?EKPV[`einrw|Ķyj[NB7-%  "*3>IVdsº~zuojd]WPIC=71,($!!$(,17=CIPW]djouz~̿sdVI>3*"  '/:ER_n}»yskd\TLE>82-)%#! !#%)-28>ELT\dksyǺ}n_RE:/'  $,6AMZhwzqh_VNF?82-*'$##$'*-28?FNV_hqzwhZMA6,$  !)282.*(''(*.28>FNWakuŹqbUH<2)!  &.8CO\jxüvk`VMD=72.,**,.27=DMV`kvƼxj\OC8.&  #+4>IVcp~ƽui^SJB;62/--/26;BJS^iuż~pcVI>4+#   '/9CO[hu~qeZPG@:521125:@GPZeq~uh[OC9/'   #+4=HS_kxyl`UKC=853358=CKU`lyxk_SH=4+#   '/7AKVamx̽qeYOG@;8668;@GOYeqþxmaVKA7/'   ")1:CMWblvŴvi]SJC=:88:=CJS]ivvlbWMC:1)"  $+3;DMW`irz˺zl`ULE?<::<<>AGOXco}ķ}ung_XQIB:3-&   !&,28?ELSZahpxξ}ocXOGB><<>BGOXco}ȺxphaZSLE?82,&!   %*05;AGNT[ckt~˺|nbWNGA><<>AGNWbn|̾~tkc[TNGA;50*%   #(-27=BIOW_hr}ĵyl`VMFA=;;=AFMV`ly}rh_WOIB=72-(#  !%).38>DKS\fq}ʼuh]SKD?<::83.)%!  "&*/5;AIQZep}ʿ|odYPHB=:88:=BHPYdo|˿}peZQIA;5/*&"  #',28?GPYdp|Ƽui^ULE?;8668;?ELU^iuĺ|pdYPG?82,'#   %*/6=ENYco{xmbXPHA<853358840.--.048>DKS[dmu~|si_ULC;3,&!   %+29AIR[dlt{}wpiaZRKD>830-+**+-038>DKRZaipw}{tld[RIA92+%   $*07>FNU]djosvxxwuqmhb\VOIC=83/+)'&&')+/38=CIOV\bhmquwxxvsojd]UNF>70*$  #(.4;BHOTZ^befgfdb^ZVPKF@;61-*'$#""#$'*-16;@FKPVZ^bdfgfeb^ZTOHB;4.(#  !&,17BDFHHHGFDA>;740,)&#  #&),047;>ADFGHHHFDB>:62-($  !$(,0368:;<<;:9742/,)&#  #&),/2479:;<<;:8630,($!   #&)+-/01100/-+)'%"  "%')+-/00110/-+)&#   !"$%&''''&%#"  "#%&''''&%$"!     !!!!!  !!!!!   !#%'())*))('&$"  "$&'())*))('%#!   $'),.02333321/-+)'%"  "%')+-/12333320.,)'$   !$(,0369;=>>>><;9641.+(%#!!#%(+.1469;<>>>>=;9630,($!  $(-26;?BFHJKKKJHFC@=962/+(&#"! !"#&(+/269=@CFHJKKKJHFB?;62-($  !&+17:62.+(&%$$%&(+.26:>CGKORUWYYYXVTPLGB<71+&!  #(.4;AHOUZ_cfhiihfc`[WQLGB=840-+)(()+-048=BGLQW[`cfhiihfc_ZUOHA;4.(#  $*07>FNU]djptwzzzyvrnhc]VPJD?:52/-,,-/25:?DJPV]chnrvyzzzwtpjd]UNF>70*$   &+29AIR[clt{|vohaYRKE?;73100137;?EKRYahov|{tlc[RIA92+&   "'-3;CLU_is||skbZSKE?;754457;?EKSZbks||si_ULC;3-'"  $).5FOYco{ÿ~ti`WOHC><::<>CHOW`it~Ŀ{ocYOF>71+&"  !%).39@HQZep|{pe\SLFA><<>AFLS\ep{ú|peZQH@93.)%!   $(-27=CKS\fq}¶vj`VNHC@>>@CHNV`jvʾ}qf\SKC=72-($   #',16;AGNV^hr~zncYQJEA??AEJQYcnz~rh^VNGA;61,'#  !&+05:@FLSZbktǸ}pe[RKEB@@BEKR[ep}tkbZSLF@:50+&!  "(-39?ELRY`gox̽rf[RKEB@@BEKR[fr̾xog`YRLE?93-("  #)/6>@DIQZeqƺ|tmf^VNG?70)#  ")08@IRZclt|ͽ}ocXOGB><<>BGOXco}ĺ|tlcZRI@80)"   '/7@IS]gqzɸyl`ULE@<::<@ELU`lyŽzqg]SI@7/'   %,5>HS^it~²uh\RIB=9779=BIR\hu~ti^SH>5,%  ")2;FQ]iuȹ}obWME?:6556:?EMWbo}þui]QF;2)"  &.7BMYfsʼuh]RIA;631136;AIR]husfYMB7.&  ")3=HUbo~ȼzmaVLD=72/../27=DLVamzƽ~obUH=3)"  %-7BN[jx|pdYOF>82.,**,.28>FOYdp|ɾxj[NB7-%   (1;GTbqſ|qf[QH@93.+(''(+.39@HQ[fq|ɼqbTG;1(   #+5@LZhxzoe[RIA:3.*'$##$'*.3:AIR[eozŷxhZL@5+#  %.8DQ_n~}ulcZQIA:4.)&#! !#&).4:AIQZclu}Ϳ~n_QD8.%   (182-($  $(-28>DKRY_elqw|ʺxhYL?4+"  %.8CP^m}ĸ|vqlgb\WQLF@;50+'##'+05;@FLQW\bglqv|;}m^PC8.%   (1;GTbqƺ{tmgb]XSOJE@;72-)%!!%)-27;@EJOSX]bgmt{²qbTG;1(   #+5?KYgvɽwnf`YTOKFB>:62.*&""&*.26:>BFKOTY`fnwŶvgYK?5+#  &/9DP^l{ukbZSMHC?;730,)&#  #&),037;?CHMSZbkuǺ{l^PD9/& ")2=HUcqöuj_WOHB=841-*'$" "$'*-148=BHOW_juʽqcUH=2)" %-7AM[iwƺvj_ULD>83/+(%"   "%(+/38>DLU_jvwi[MA7-%  (1;GS`o~ɽyl`ULC<50+'$!  !$'+05JWet{m`SH>5.'!  !'.5>HS`m{ʾteWJ>4*"%.8CO]k{ȼtfYMB80("  "(08BMYftŸ{k]OC8.% (13*"  "*3>IVdsǺ}n_RE:0'+4>JWesƸ|m_QE:0(    (0:EQ_m|ʾseWJ>4+/8CP]kz˿vgYMA6-%  %-6AMYgvµzk]PC8/3=IUcrŹ~oaTH=3*"  "*3=HTao~ǻrcUI=37BN\jy˿xi\OC9/'    '/9CO\ixyj\NB74+#  #+4>JWet̼ueVWfwƶsdVI>3+#  #+3>IVdsͽwfWWfwƶsdVI>3+#  #+3>IVdsͽwfWVeuƶteWJ>4+#  #+4>JWet̼ueVTcsǷvgXK@5,%  %,5@KXgvȸscTQ`pǸxi[NB7.&  &.7BN[ixóp`QN\k{Ⱥ{l^QE:1(!  !(1:EQ^l{̽{k\NJWfvɼpbTH=3+#  #+3=HTbpŶvfWJER`o˿ufYLA7.&  &.7ALYfu˽o`REAMZixµzl^QE;1)!  !)1;EQ^lzõxiZMAJWesƸ|m_QE:0(    (0:EQ_m|ʾseWJ>4+'0:ER_n}̿sdVI>3*"  "*3>IVdsǺ}n_RE:0'$,6AMZhwŷxi[MA7-%  %-7AM[ixĶwhZMA6,$!)2JWet{m`SH>5.'!  !'.5>HS`m{ʾteWJ>4*"'0:EQ_m|ǻug[OE<4-'"  "'-483/+(%"   "%(+/38>DLU_jvwi[MA7-% ")2=HUcqöuj_WOHB=841-*'$" "$'*-148=BHOW_juʽqcUH=2)" &/9DP^l{ukbZSMHC?;730,)&#  #&),037;?CHMSZbkuǺ{l^PD9/&  #+5?KYgvɽwnf`YTOKFB>:62.*&""&*.26:>BFKOTY`fnwŶvgYK?5+#   (1;GTbqƺ{tmgb]XSOJE@;72-)%!!%)-27;@EJOSX]bgmt{²qbTG;1(   %.8CP^m}ĸ|vqlgb\WQLF@;50+'##'+05;@FLQW\bglqv|;}m^PC8.%  "+4?LYhx¸|wqle_YRKD>82-($  $(-28>DKRY_elqw|ʺxhYL?4+"   (182.,**,.28>FOYdp|ɾxj[NB7-%  ")3=HUbo~ȼzmaVLD=72/../27=DLVamzƽ~obUH=3)"  &.7BMYfsʼuh]RIA;631136;AIR]husfYMB7.&  ")2;FQ]iuȹ}obWME?:6556:?EMWbo}þui]QF;2)"  %,5>HS^it~²uh\RIB=9779=BIR\hu~ti^SH>5,%   '/7@IS]gqzɸyl`ULE@<::<@ELU`lyŽzqg]SI@7/'   ")08@IRZclt|ͽ}ocXOGB><<>BGOXco}ĺ|tlcZRI@80)"  #)07?GNV^fmt|пqeZQID@>>@DIQZeqƺ|tmf^VNG?70)#  #)/6>@CHNV`jvʾ}qf\SKC=72-($   !%).39@HQZep|{pe\SLFA><<>AFLS\ep{ú|peZQH@93.)%!  "&+17>FOYco{ÿ~ti`WOHC><::<>CHOW`it~Ŀ{ocYOF>71+&"  $).5FNU]djptwzzzyvrnhc]VPJD?:52/-,,-/25:?DJPV]chnrvyzzzwtpjd]UNF>70*$  #(.4;AHOUZ_cfhiihfc`[WQLGB=840-+)(()+-048=BGLQW[`cfhiihfc_ZUOHA;4.(#  !&+17:62.+(&%$$%&(+.26:>CGKORUWYYYXVTPLGB<71+&!  $(-26;?BFHJKKKJHFC@=962/+(&#"! !"#&(+/269=@CFHJKKKJHFB?;62-($  !$(,0369;=>>>><;9641.+(%#!!#%(+.1469;<>>>>=;9630,($!   $'),.02333321/-+)'%"  "%')+-/12333320.,)'$   !#%'())*))('&$"  "$&'())*))('%#!   !!!!!  !!!!!    !"#$$$$#"!  !"#$$$$#"!   !$&()+,,,,,+*('%#!  !#%'(*+,,,,,+)(&$!   $'*-/13566665420.,*(%#!  !#%(*,.02456666531/-*'$    $(,047:=?@AAAA?><9741.+)'%#"!!"#%')+.1479<>?AAAA@?=:740,($   #(,16;?CFIKMNNNMKIFC@<952/,*('&&'(*,/259<@CFIKMNNNMKIFC?;61,(#  !&+06FOXbmy|rh_XQKGDBBDGKQX_hr|þymbXOF>71,'#  "&+/4:AHQZdo{Ļxnd[TNIFDDFINT[dnx{odZQHA:4/+&"  "&*/39>ELS\fq|ƻ}rg^VPKHFFHKPV^gr}ǻ|qf\SLE>93/*&"  !%*.38>CIPW`ir}öuj`XQLHFFHLQX`juʽ}ri`WPIC>83.*%!  #(-28=CIOV]dlvʼwkaXQLHFFHLQXakw˽vld]VOIC=82-(#  $*06<<>AGNWamzwmcXND:2*"   '/8BMXdo{οtg\RJC>:88:>CJR\gt½{odXMB8/'   $,5?JVbo|ĵ{naVME>:6556:>EMVan{»|obVJ?5,$   (1;FR_lzŸsf[PH@:521125:@HP[fsùzl_RF;1(   #,5@LYgv·vj^TJB;51.--.15;BJT^jvǼvgYL@5,#  &/:FR`oļxlaVLD<60,*))*,06KXgwwlaWNE=60,(&%%&(,06=ENWalwǸwgXK>3*!  $-7BO^m~~tjaWNE=60+'$"!!"$'+06=ENWajt~~m^OB7-$  &0:FTcs¼xpg^UME=60+&#  #&+06=EMU^gpxȸscTF:0&  !)2=JXgxȾ~wpiaZRJC<5/*%!!%*/582.*&#    #&*.28>EMWamz̿tfXK?4+# &/8CO]ky|ocWMD<5/*&"  "&*/54+#  #+4>IVcqµ{l^QD9>JWetzk^QE:1(!  !(1:EQ^kzʾteWJ>DP^m|˿ugYLA7-%  %-7ALYguǺ|m^PDIVetʽqbUH=3*#  #*3=HUbqõteVIM\k{ʻ|m_QE:0(!  !(0:EQ_m|̾{k\MRaqʻyj[NB7.&  &.7BN[jyƵqaRVevʺwhYL@5,$  $,5@LYhwͼveVYhy˺ufWJ>4*#  #*4>JWfu°yhY[k|˺teVI=2)"  ")2=IVetų|k[\l~˺tdUH<2)!  !)24*#  #*4>JWfu°yhYVevʺwhYL@5,$  $,5@LYhwͼveVRaqʻyj[NB7.&  &.7BN[jyƵqaRM\k{ʻ|m_QE:0(!  !(0:EQ_m|̾{k\MIVetʽqbUH=3*#  #*3=HUbqõteVIDP^m|˿ugYLA7-%  %-7ALYguǺ|m^PD>JWetzk^QE:1(!  !(1:EQ^kzʾteWJ>9DQ^l{ĸqcVI>4+#  #+4>IVcqµ{l^QD94?JWesǼvh[NB8.&  &.8BN[hvźseWJ?409DP]kz|n`SG<2)"  ")282.*&#    #&*.28>EMWamz̿tfXK?4+#  (1;FSapɼxlaXOHA<73/+(%" "%(+/37KXgwwlaWNE=60,(&%%&(,06=ENWalwǸwgXK>3*!  &/:FR`oļxlaVLD<60,*))*,06:6556:>EMVan{»|obVJ?5,$   '/8BMXdo{οtg\RJC>:88:>CJR\gt½{odXMB8/'   "*2:DNXcmwǷzmaWNGA><<>AGNWamzwmcXND:2*"  $+3;DMW`irz̼~qeZQJEA??AEJQZeq~ƽzri`WMD;3+$  %,3;CKS[ckszth]TMGDBBDGMT]htƻzskc[SKC;3,%   %+29@GNV]dkryvj`WOJFDDFJOW`jvǻyrkd]VNG@92+%   $*06CIPW`ir}öuj`XQLHFFHLQX`juʽ}ri`WPIC>83.*%!  "&*/39>ELS\fq|ƻ}rg^VPKHFFHKPV^gr}ǻ|qf\SLE>93/*&"  "&+/4:AHQZdo{Ļxnd[TNIFDDFINT[dnx{odZQHA:4/+&"  #',17>FOXbmy|rh_XQKGDBBDGKQX_hr|þymbXOF>71,'#   $)/5<9741.+)'%#"!!"#%')+.1479<>?AAAA@?=:740,($    $'*-/13566665420.,*(%#!  !#%(*,.02456666531/-*'$   !$&()+,,,,,+*('%#!  !#%'(*+,,,,,+)(&$!   !"#$$$$#"!  !"#$$$$#"!   !"$%&''''&&%#"  "#%&&''''&%$"!  "$')+-./000//-,*)'%#!  !#%')*,-//000/.-+)'$"   #'*-035789:::986420.+)'%$#""#$%')+.024689:::987530-*'#    #(,047;>@BDEEEDCB@=;8520-+)(((()+-0258;=@BCDEEEDB@>;740,(#   "',05:?CGJMOQRRRQOMJGD@=:631/.--./136:=@DGJMOQRRRQOMJGC?:50,'"   %*/5;@FKPTX[^_``_^[YURNIEA=:75322357:=AEINRUY[^_``_^[XTPKF@;5/*%   "',29?FLSY_chkmooonkhea\WRNID@=:9889:=@DINRW\aehknooomkhc_YSLF?92,'"  #(.5==>@CGKPV\agmrvz}~|xtnhaZRKC<5.(#   %*07>FOW`hqx~xrkd^XRMHECBBCEHMRX^dkrx~xqh`WOF>70*%   "',29AIR[enx|ume^XRMJGFFGJMRX^emu|xne[RIA92,'"   $).4;CKT^hs}}uld]WRMKIIKMRW]dlu}}sh^TKC;4.)$    $(,17>EMV`kvÿ|rjb[UQNLLNQU[bjr|vk`VME>71,($    $',05;AHPYbmxǿwne^XSPNNPSX^enwżxmbYPHA;50,'$   #',05:?ELS\eoz{qh`YTQOOQTY`hq{·zoe\SLE?:50,'#  "'+05:?EKQX`hq|ǻ}ri`ZTQOOQTZ`ir}Ź|qh`XQKE?:50+'"   %*/5:@FKQX^emu~si`YTPNNPTY`is~ƹume^XQKF@:5/*%   !&,28?ELRY_fls{´~rh_XRNMMNRX_hr~Ÿ{slf_YRLE?82,&!  !'.4FNW_gow~ymbYRMIGGIMRYbmyú~wog_WNF>6.'!  &-5>GQ[dnw˼th^UNIECCEINU^htŽwnd[QG>5-&  $,4=GR\gr}ĵ{ocYQJDA??ADJQYco{ý}rg\RG=4,$  !)1;EQ\htʼuh]TKE@<;;<@EKT]huþth\QE;1)!  %.7BMZgt̿zmaWNF@;8668;@FNWamz»tgZMB7.%  !)3=IVcqʿ}qeZPG@:631136:@GPZeq}qcVI=3)!  %-8CP]l{Żsg\RIA:51.,,.15:AIR\gsŸ{l]PC8-%   (183.)$  $).38>DIOUZ`flszʹqaRD8.%  '0;GUdtǹ}tld^XRMHC>94/+&""&+/49>CHMRX^dlt}˺tdUG;0'  !*3>JXgwʼzpg^WQKFA<83/+'#   #'+/383*!  $,6AM[jy̾znd[RKE@;62.*'#   #'*.26;@EKR[dnz˼yj[MA6,$  &/9DQ^m|zncXOHA;51-)&"    "&)-15;AHOXcnzʼ|m^QD9/& !)272-(%!  !%(-27>ENXco|ʼqbTH<2)! $,5@KXft¶~qdXND<5/*%!  !%*/5JVcqǿvh\PE;2*#  #*2;EP\hvŽqcVJ>4+#&.8BN[hvº|naUI>5,%  %,5>IUan|vh[NB8.&!)24,$  $,4>IUao|ƾseXK@6,$ (0:EP]jxvi\OD90(!  !(09DO\ivxj]PE:0( #+4>IVbp~ŽqdWK?5,%  %,5?KWdqļ~pbVI>4+# '/9CO[hv¹zl^RF;2)"  ")2;FR^lzvh[OC9/' #+4>IUbo}ǿtgZMB8.&  &.8BMZgtû}obUI>4+#'/9CO[hvļ}obUI>4+#  #+4>IUbo}vh[OC9/'+4>JVcp~¸xj]PE:1(!  !(1:EP]jxż~pcVJ>4+0:EP]kxȿseXLA6-%  %-6ALXesúxk]PE:05@KXesǽ|n`TH=3*#  #*3=HT`n|·seXK@5;FR`n|Ƽwi\OD90'    '09DO\iw|n`RF;@LYhwƺseXK@6-%  %-6@KXes˿whYL@FSapǺ~oaTH=3*"  "*3=HTao~ʽpaSFKYhxȺ{l^QD:0'    '0:DQ^l{ȹxhYKQ_oɺyj[NB7-%  %-7BN[jyóo_QUeuʺwgYK?5+#  #+5?KYgw̼ueUYi{̻vfWJ>3*"  "*3>JWfvñ{iY]mͼueVH<2)!  !)23*"  "*3>JWfvñ{iYUeuʺwgYK?5+#  #+5?KYgw̼ueUQ_oɺyj[NB7-%  %-7BN[jyóo_QKYhxȺ{l^QD:0'    '0:DQ^l{ȹxhYKFSapǺ~oaTH=3*"  "*3=HTao~ʽpaSF@LYhwƺseXK@6-%  %-6@KXes˿whYL@;FR`n|Ƽwi\OD90'    '09DO\iw|n`RF;5@KXesǽ|n`TH=3*#  #*3=HT`n|·seXK@50:EP]kxȿseXLA6-%  %-6ALXesúxk]PE:0+4>JVcp~¸xj]PE:1(!  !(1:EP]jxż~pcVJ>4+'/9CO[hvļ}obUI>4+#  #+4>IUbo}vh[OC9/'#+4>IUbo}ǿtgZMB8.&  &.8BMZgtû}obUI>4+# '/9CO[hv¹zl^RF;2)"  ")2;FR^lzvh[OC9/' #+4>IVbp~ŽqdWK?5,%  %,5?KWdqļ~pbVI>4+# (0:EP]jxvi\OD90(!  !(09DO\ivxj]PE:0( $,6@KXesú|oaUI>4,$  $,4>IUao|ƾseXK@6,$!)25,%  %,5>IUan|vh[NB8.&#+4>JVcqǿvh\PE;2*#  #*2;EP\hvŽqcVJ>4+# (0:EQ^kyż~qdWLA8/("  "(/8ALWdq~úyk^QE:0( %-6ALYftúzm`TI?6.'!  !'.6?IT`mztfYLA6-% "*3=HTao}øvi]QF=4-'!  !'-4=FQ]ivɿ}oaTH=3*" '/9DP]jy÷sfZOE<4-(#  #(-472-(%!  !%(-27>ENXco|ʼqbTH<2)! &/9DQ^m|zncXOHA;51-)&"    "&)-15;AHOXcnzʼ|m^QD9/&  $,6AM[jy̾znd[RKE@;62.*'#   #'*.26;@EKR[dnz˼yj[MA6,$  !*3>JXgwʼzpg^WQKFA<83/+'#   #'+/383*!  '0;GUdtǹ}tld^XRMHC>94/+&""&+/49>CHMRX^dlt}˺tdUG;0'  %.8DRaqķzslf`ZUOID>83.)$  $).38>DIOUZ`flszʹqaRD8.%  #,6BO^n{uoic\VOIB<60+&""&+06GQ[dnw˼th^UNIECCEINU^htŽwnd[QG>5-&  !'.6>FNW_gow~ymbYRMIGGIMRYbmyú~wog_WNF>6.'!  !'.4EMV`kvÿ|rjb[UQNLLNQU[bjr|vk`VME>71,($    $).4;CKT^hs}}uld]WRMKIIKMRW]dlu}}sh^TKC;4.)$   "',29AIR[enx|ume^XRMJGFFGJMRX^emu|xne[RIA92,'"   %*07>FOW`hqx~xrkd^XRMHECBBCEHMRX^dkrx~xqh`WOF>70*%   #(.5==>@CGKPV\agmrvz}~|xtnhaZRKC<5.(#  "',29?FLSY_chkmooonkhea\WRNID@=:9889:=@DINRW\aehknooomkhc_YSLF?92,'"   %*/5;@FKPTX[^_``_^[YURNIEA=:75322357:=AEINRUY[^_``_^[XTPKF@;5/*%   "',05:?CGJMOQRRRQOMJGD@=:631/.--./136:=@DGJMOQRRRQOMJGC?:50,'"   #(,047;>@BDEEEDCB@=;8520-+)(((()+-0258;=@BCDEEEDB@>;740,(#    #'*-035789:::986420.+)'%$#""#$%')+.024689:::987530-*'#   "$')+-./000//-,*)'%#!  !#%')*,-//000/.-+)'$"  !"$%&''''&&%#"  "#%&&''''&%$"!   "$&')*++++**('&$"!  !"$&'(**++++*)'&$"   "%'*,/0234444320/-+)'&$####$&')+-/0234444320/,*'%"  #&*-1469;=>>?>><;97420.,*))))*,.02479;<>>?>>=;9641-*&#  #'+/37;?BDGHJJJJHGEB@=:7521////1257:=@BEGHJJJJHGDB?;73/+'#  !&*/49>CGKNQTVWWWVTROLIFB?<9765567994/*&!  #(.39?EJOTY]`bdeedc`^ZWSOKGC@><;;<>@CGKOSWZ^`cdeedb`]YTOJE?93.(#   %+07=DKQX^chlorstsrpmjfa]XSNJGDBAABDGJNSX]afjmprstsrolhc^XQKD=70+%   "'-3:AHPW_fmsx|~zvqlfa[VQMJHGGHJMQV[aflqvz~|xsmf_WPHA:3-'"  $)/5FOXakt}xqjc]YURQQRUY]cjqx}tkaXOF>71+&!   $).3:AIQ[doyxpib]YVTTVY]bipxyod[QIA:3.)$    $(,16EMT\cjpw}ŷwmd]WTRRTW]dmwɾ}wpjc\TME>6/)"  "(08@HQZbkrz~rh`YSONNOSY`hr~ȿzrkbZQH@80("   '/7@JT^hqzɼxmc[TNKIIKNT[cmx»zqh^TJ@7/'   %-6?JU`kv´~rg]UNIEDDEINU]gr~ÿvk`UJ?6-%  "*3=HS_lxŸvj`VNHC@>>@CHNV`jv½xl_SH=3*"  '/9DP]jxƺymbXOHB=:88:=BHOXbmyxj]PD9/'  "+4?KXfuø{odZPHA<743347JXhx¼{pe[RIA:4/,)((),/4:AIR[ep{˻xhXJ>3)!  #,6BO^nxndZQH@93.*&$##$&*.39@HQZdnxƵn^OB6,#  %/:FTctĽ|sjaXOG?82-($!!$(-28?GOXajs|ϽtcTF:/%  (1=IXhy|ume]UME>71+'""'+17>EMU]emu|ıyhXI=1(  !*4?M[l}zsmf_XPIB<5/*%!!%*/5940,($! !$(,049>CHNU]eoz̼ueVI<2(   "*4?KYgw³zncZQJC=83/+($! !$(+/38=CJQZcnz˻wgYK?4*"  $-6AN[jyõ{ocXOG?94/+'#    #'+/49?GOXco{Ⱥyj[NA6-$  '/9DP^l{ö}pcXNE=60+'#    #'+06=ENXcp}Ƹ{l^PD9/' !)25-&!  !&-5>HS_kxžyl_RF<2)" %,5@KVcp}¼{nbVK@7/'!  !'/7@KVbn{þ}pcVK@5,% '09DO[ht~reYNC91)"  ")19CNYer~¾th[OD90' #+3=HS`lyvi]QF<3+$  $+3HT`mz{naUI?5,$  $,5?IUan{zm`TH>4+0:DP\iv¼wj]QE;1)"  ")1;EQ]jwüvi\PD:06@KXesļsfYMB7.&  &.7BMYfsŽseXK@6;GS`n}ǽ}obUI>4+$  $+4>IUbo}Ⱦ}n`SG;AN[ixʿzl_RF;1)!  !)1;FR_lzʿxi[NAGTcrxj\OC8/'  '/8CO\jx˾rcTGM[k{ĵvgYL@6-$  $-6@LYgvʼ{k[MSbrǷufWJ>4+#  #+4>JWfuǷrbSXhyɹtdVI=2)!  !)2=IVdtyhX\m~̻tcUG;1(    (1;GUctȶ~m\`qμscTF:0'  '0:FTcsϼq`bsнsbSF:/&  &/:FSbssbcuѾsbSE9/&  &/9ESbsïuccuѾsbSE9/&  &/9ESbsïucbsнsbSF:/&  &/:FSbssb`qμscTF:0'  '0:FTcsϼq`\m~̻tcUG;1(    (1;GUctȶ~m\XhyɹtdVI=2)!  !)2=IVdtyhXSbrǷufWJ>4+#  #+4>JWfuǷrbSM[k{ĵvgYL@6-$  $-6@LYgvʼ{k[MGTcrxj\OC8/'  '/8CO\jx˾rcTGAN[ixʿzl_RF;1)!  !)1;FR_lzʿxi[NA;GS`n}ǽ}obUI>4+$  $+4>IUbo}Ⱦ}n`SG;6@KXesļsfYMB7.&  &.7BMYfsŽseXK@60:DP\iv¼wj]QE;1)"  ")1;EQ]jwüvi\PD:0+4>HT`mz{naUI?5,$  $,5?IUan{zm`TH>4+&/8BMYer~rfYMB8/'    '/8BMYfr~reYMB8/&"*25-&!  !&-5>HS_kxžyl_RF<2)" &/8CN[huǿvi\QF=4-&!  !&-4=FQ\ivuh[NC8/& $,5?JWdrtgZOE<4-'"  "'-4940,($! !$(,049>CHNU]eoz̼ueVI<2(   &0:FTctʼ|rib[TOID?:51,($   $(,15:?DIOT[bir|ͼtcTF:0&  %.8DRaqƸwohb\VPKE@:50+&""&+05:@EKPV\bhowͻqaRD8.%  #,6BO^oö~wpjd^XQKE?83-($  $(-38?EKQX^djpw~̹o^OB6,#  !*4?M[l}zsmf_XPIB<5/*%!!%*/571+'""'+17>EMU]emu|ıyhXI=1(  %/:FTctĽ|sjaXOG?82-($!!$(-28?GOXajs|ϽtcTF:/%  #,6BO^nxndZQH@93.*&$##$&*.39@HQZdnxƵn^OB6,#  !)3>JXhx¼{pe[RIA:4/,)((),/4:AIR[ep{˻xhXJ>3)!  &/9ER`oŽ|pe[QIA;51/--/15;AIQ[ep|˾o`RE9/&  "+4?KXfuø{odZPHA<743347>@CHNV`jv½xl_SH=3*"  %-6?JU`kv´~rg]UNIEDDEINU]gr~ÿvk`UJ?6-%   '/7@JT^hqzɼxmc[TNKIIKNT[cmx»zqh^TJ@7/'   "(08@HQZbkrz~rh`YSONNOSY`hr~ȿzrkbZQH@80("  ")/6>EMT\cjpw}ŷwmd]WTRRTW]dmwɾ}wpjc\TME>6/)"  "(.4:AGNT[agmt{ƹzpg`[WUUW[`gpzʾ{tmga[TNGA:4.("  !&+16FOXakt}xqjc]YURQQRUY]cjqx}tkaXOF>71+&!  $)/5<;;<>@CGKOSWZ^`cdeedb`]YTOJE?93.(#  !&*/49>CGKNQTVWWWVTROLIFB?<9765567994/*&!  #'+/37;?BDGHJJJJHGEB@=:7521////1257:=@BEGHJJJJHGDB?;73/+'#  #&*-1469;=>>?>><;97420.,*))))*,.02479;<>>?>>=;9641-*&#  "%'*,/0234444320/-+)'&$####$&')+-/0234444320/,*'%"   "$&')*++++**('&$"!  !"$&'(**++++*)'&$"    #%(*,-/0000/.-+*(&%$####$%&(*+-./0000/-,*(%#   "%(+.135789::987531/-,*))))*,-/135789::987531.+(%"  "&*-158;>@BCDEDCB@><:753100001357:<>@BCDEDCB@>;851-*&"  "&*.37<@CGJLNPPPPOMKHEB@=:977779:=@BEHKMOPPPPNLJGC@<73.*&"   $).38=BGLPTWZ\]]]\[XVROLHEB@>>>>@BEHLORVX[\]]]\ZWTPLGB=83.)$   "',17=CIOTY^behjkkkigda]YUQMJGFEEFGJMQUY]adgikkkjheb^YTOIC=71,'"  $).4;BHOV\bhmquwyzzxvtplhc^YUROMLLMORUY^chlptvxzzywuqmhb\VOHB;4.)$  !%+17>EMU\dkqw}|wrlgb]YVSRRSVY]bglrw|}wqkd\UME>71+%!  "'-3:AIQYbjrz|uoid_\YXXY\_diou|zrjbYQIA:3-'"  !%*/5FNW`jt~}vojebaabejov}~tj`WNF>82,($    $',05;AHPYblw¿zsmieddeimsz¾wlbYPHA;50,'$   !%(,05:?ELS\eoyü}vojgeegjov}yoe\SLE?:50,(%!  !%)-16:?DJPW_hq|ù~wpkgffgkpw~Ǿ|qh_WPJD?:61-)%!   $)-27IUbn{xmcZSLHDCCDHLSZcmxĿ{nbUI>4+#   '0:FR_m{ɿzndZRKEA><<>AEKRZdnzĺ{m_RF:0'   #,5AMZixĻzod[RJC>:7557:>CJR[dozxiZMA5,#  &0:FTbr¼yndZQIB<730//03771,'$!!$',17>ELU]env~veUG:/&  (1=JYi{Ƚ|ung`XQIB;5/*%""%*/5;BIQX`gnu|Ǵ{iYJ=1(  !*4?M\l~˿zsmg`YSLE?93-($  $(-39?ELSY`gmsz˸~l\M?4*!  "+6BO^oµyrke_YSMGA;50+&""&+05;AGMSY_ekryλo^OB6+"  $-7CQ`qǸ|skd]WQLFA<61-($  $(-16JWfuĶ{nbWNE>72-(%!  !%(-27>ENWbn{ŶufWJ>4*"  $,6@LYgvö}pcWMD<5/*%!  !%*/54+#  #+4>JVdrʾsdUHN]l|̿qbUH<2)"  ")24+#  #+4>JVdrʾsdUHBN[ix·seXLA6-%  %-6ALXesǽxi[NBJWfuĶ{nbWNE>72-(%!  !%(-27>ENWbn{ŶufWJ>4*"  !(271,'$!!$',17>ELU]env~veUG:/&  #,7CQ`p½|sj`WOG?93.*'%$$%'*.39?GOW`js|ʸp`QC7,#  !*3?LZjz½wmcYPHA:50-*))*-05:AHPYcmwϿzjZL?3*!  &0:FTbr¼yndZQIB<730//037:7557:>CJR[dozxiZMA5,#   '0:FR_m{ɿzndZRKEA><<>AEKRZdnzĺ{m_RF:0'   #+4>IUbn{xmcZSLHDCCDHLSZcmxĿ{nbUI>4+#  &.7AKWbmy˿vkbZSNKIIKNSZbkvymbWKA7.&  !(09BLV`jt}ȼ}siaZUQPPQUZais}ý}tj`VLB90(!  #)19AJS\dmt|¶ypg`[WUUW[`gpy|tmd\SJA91)#  #)08?GNV]dkqw}ǻumf`\[[\`fmu}wqkd]VNG?80)#  #)/5FNW`jt~}vojebaabejov}~tj`WNF>82,($   !%*/5EMU\dkqw}|wrlgb]YVSRRSVY]bglrw|}wqkd\UME>71+%!  $).4;BHOV\bhmquwyzzxvtplhc^YUROMLLMORUY^chlptvxzzywuqmhb\VOHB;4.)$  "',17=CIOTY^behjkkkigda]YUQMJGFEEFGJMQUY]adgikkkjheb^YTOIC=71,'"   $).38=BGLPTWZ\]]]\[XVROLHEB@>>>>@BEHLORVX[\]]]\ZWTPLGB=83.)$   "&*.37<@CGJLNPPPPOMKHEB@=:977779:=@BEHKMOPPPPNLJGC@<73.*&"  "&*-158;>@BCDEDCB@><:753100001357:<>@BCDEDCB@>;851-*&"  "%(+.135789::987531/-,*))))*,-/135789::987531.+(%"   #%(*,-/0000/.-+*(&%$####$%&(*+-./0000/-,*(%#   !$'*-/13456654310.,+*)(()*+,.01345665431/-*'$!  "%),0369;=?@@@?><:864210//012468:<>?@@@?=;9630,)%"  "&*.26:>ADGIJKKKJIGDB?=;987789;=?BDGIJKKKJIGDA>:62.*&"   %).27ELT]gq{½{vsqqsv{{qg]TLE>93/+'#   !$(,048=CIPW`is}ž}xussux}û}si`WPIC=840,($!  !%)-15:>CHNT[cluú}xussux}ȿulc[TNHC>:51-)%!   $).2795322359>DJRZcmwĵscTG;0'  !*4?L[j{ÿ|sjaXPHA;62.,++,.26;AHPXajs|{j[L?4*!  #-7CQ`q~vnf]UMF?93.+(&%%&(+.39?FMU]fnv~̺q`QC7-#  &/:GUev~woh`YQJC<60,($"  "$(,0683.*&"  "&*.38>EMV`kxŴpaRE:/&   (1;FSapõzmaVLC;5/*&"  "&*/5;CLVamzpaSF;1(   !)2IUbp~Ⱦ~pcWLB:2,&!  !&,2:BLWcp~~pbUI>4+#  %-6@KWcp~~qeYMC:2+%    %+2:CMYeq~~pcWK@6-%  '/8BMXdq~~rfZOD;2+%  %+2;DOZfr~~qdXMB8/'  ")1;DOZfr~~rf[PE<3,%  %,35-&    &-5>GQ[fpz~ukaVLC91)" '.7@JT^is}vlaWMC:1*#  #*1:CMWalv}si^TJ@7.' %,4=GR\gr|}sh^SI?6.&    &.6?IS^hs}|rg\RG=4,%*2;EOZfq|{peZOE<3+$  $+35-&    &-5>GQ[fpz~ukaVLC91)"%,4IUbp~Ⱦ~pcWLB:2,&!  !&,2:BLWcp~~pbUI>4+#  !)283.*&"  "&*.38>EMV`kxŴpaRE:/&  %.8DRaqwkaWOHB<72.*&# #&*.2795322359>DJRZcmwĵscTG;0'  #,6AN[jyyoe\TMFA=:99:=AFMT\eoyµyj[NA6,#   (1;FS`n|{pg^VOIEB@@BEIOV^gp{ż|n`SF;1(   $,5?JVcp}ż{qg_XRMJHHJMRX_gq{}pcVJ?5,$  '/8BLXcozǽ{qh`ZURPPRUZ`hq{zocXLB8/'  ")19CMWaku~Ǽyphb]YWWY]bhpy~ukaWMC91)"  #*1:BKT]emu|Ĺxpid`^^`dipx|ume]TKB:1*#  $*18@GOW^ekqw|vpjfeefjpv|wqke^WOG@81*$  #)/6CHNT[cluú}xussux}ȿulc[TNHC>:51-)%!  !$(,048=CIPW`is}ž}xussux}û}si`WPIC=840,($!   #'+/39>ELT]gq{½{vsqqsv{{qg]TLE>93/+'#   #'+05;BJR[dnx}xspnnpsx}xnd[RJB;50+'#   #(-29@GPXakt}~xsoljjlosx~}tkaXPG@92-(#   !%*07=EMU^fow}wqlifeefilqw}wof^UME=70*%!  #).4;BJQYaipw}ytojeb_^^_bejoty}wpiaYQJB;4.)#  "',28?FMT[bhnsx|~|xtojfa]ZXWWXZ]afjotx|~|xsnhb[TMF?82,'"   %*/5;AHNTZ_dilorsssqolhd`\XURPOOPRUX\`dhloqsssrolid_ZTNHA;5/*%   #',27ADGIJKKKJIGDB?=;987789;=?BDGIJKKKJIGDA>:62.*&"  "%),0369;=?@@@?><:864210//012468:<>?@@@?=;9630,)%"  !$'*-/13456654310.,+*)(()*+,.01345665431/-*'$!  "%),/2579;;<;;9864210/../0124689;;<;;9752/,)%"  "&*.269=@BDFGGFEDB@>;:876678:;>@BDEFGGFDB@=962.*&"  !%).37<@DHLNQRSSRQOMJHECA@??@ACEHJMOQRSSRQNLHD@<73.)%!  #(-27=BGLQUY\^```_][XUROLJIHHIJLORUX[]_```^\YUQLGB=72-(#  !&+06EMV_hr|}}|rh_VME>82-)%"   #&)-16;AHPXajtýĿtjaXPHA;61-)&#   !$'+.26;@ELSZclvûŽvlcZSLE@;62.+'$!  !%)-159=AFKQW^fnxƾxnf^WQKFA=951-)%!   $).27;@DIMRW]cjrzǾzrjc]WRMID@;72.)$   "',27=BGLQV[_ejpw~ż}{{}~wpje_[VQLGB=72,'"  #)/6==>AEJPW^gpyµyj[NA6,#  '0;GTcs}ulc[SLF@<865568<@FLS[clu}ĵscTG;0'  !*4?L[j{ľwog_WPIB=840.--.048=BIPW_gow{j[L?4*!  #,7CQ`q~xqibZSLE?940,)'&&'),049?ELSZbiqx~˹q`QC7,#  %/:FUevĹ|vpic\UNHA;60,(%#! !#%(,06;AHNU\cipv|veUF:/%  '1KZk}Ķyrlf`ZUOID>94/*&""&*/49>DIOUZ`flry˷}kZK>2(   !)4?M\m˼~umf_YSNHC>940+'##'+049>CHNSY_fmu~̹m\M?4)!  "*5@N]mó}siaZSMGB=940+'$  $'+049=BGMSZais}˹m]N@5*"  #+5AO]nȹ~rh^VNHB=83/+'$   $'+/38=BHNV^hr~ɷn]OA5+#  #,6BO]m~ͽth]TKD>83/+'#   #'+/38>DKT]htų~m]OB6,#  $-7BO]l|vi]SJB;50+'#    #'+05;BJS]iv|l]OB7-$  %.7BO\k{xk^SIA92-($    $(-29AIS^kxǹ{k\OB7.%  &.8CO\jyɾzl`TJ@81+&!  !&+18@JT`lzyj\OC8.&   '09DO\iwú{naUKA80*$  $*08AKUan{wi\OD90'   !)1:EP\hu|obWLB91*$  $*19BLWbo|¾uh\PE:1)!  #*3HR]hs~zncXMC:2*$  $*2:CMXcnz~sh]RH>5,% !'/7@JT^is}xmcXND;3+$  $+3;DNXcmx}si^TJ@7/'! #*2:CMV`jt}vlbXOE<4,%  %,4FPYclu}}ulbYOF=5-&    &-5=FOYblu}}ulcYPF>5-& #*19BJT]fow|tlcYPG>6.'!  !'.6>GPYclt|wof]TJB91*# '.5>FOXajrz|tld[RI@80)"  ")08@IR[dlt|zrjaXOF>5.' $+2:CLU^gow}}vnf]TKB:2+$  $+2:BKT]fnv}}wog^ULC:2+$")08@IR[dmu|yqi`WNE=5-&    &-5=ENW`iqy|umd[RI@80)" '.6>GPYbkt{}umd[RI@80)"  ")08@IR[dmu}{tkbYPG>6.' %,45-&    &-5>GQ[eoyvlaWLB90(.7@KValwzodYOE;3+$  $+3;EOYdozwlaVK@7.4>IT`lx{ocXMC90)"  ")09CMXco{xl`TI>4;EQ]jw|pcWLA7/'    '/7ALWcp|wj]QE;AMZgu~qdWK@6-%  %-6@KWdq~žugZMAHUcqøseWK?5,$  $,5?KWesĹqcUHN\k{̿tfXK?4+#  #+4?KXftǺ{k\NUdtǸwgXK?4+"  "+4?KXgwǷtdUZj{ξyhYK?4*"  "*4?KYhy±{jZ_pñ{jZL?4*"  "*4?LZj{̺p_ctǵ|k[L?4*!  !*4?L[k|tcewʷ}l[L?4*!  !*4?L[l}Ųwegy̸~l\M?4*!  !*4?M\l~ȴyggy̸~l\M?4*!  !*4?M\l~ȴygewʷ}l[L?4*!  !*4?L[l}Ųwectǵ|k[L?4*!  !*4?L[k|tc_pñ{jZL?4*"  "*4?LZj{̺p_Zj{ξyhYK?4*"  "*4?KYhy±{jZUdtǸwgXK?4+"  "+4?KXgwǷtdUN\k{̿tfXK?4+#  #+4?KXftǺ{k\NHUcqøseWK?5,$  $,5?KWesĹqcUHAMZgu~qdWK@6-%  %-6@KWdq~žugZMA;EQ]jw|pcWLA7/'    '/7ALWcp|wj]QE;4>IT`lx{ocXMC90)"  ")09CMXco{xl`TI>4.7@KValwzodYOE;3+$  $+3;EOYdozwlaVK@7.(09BLWalvyoe[QG>5-&    &-5>GQ[eoyvlaWLB90(#*2;DNWaku}zqg]TJA80)"  ")08AJT]gqz}ukaWND;2*#%,4GPYbkt{}umd[RI@80)"  ")08@IR[dmu}{tkbYPG>6.' ")08@IR[dmu|yqi`WNE=5-&    &-5=ENW`iqy|umd[RI@80)"$+2:CLU^gow}}vnf]TKB:2+$  $+2:BKT]fnv}}wog^ULC:2+$ '.5>FOXajrz|tld[RI@80)"  ")08@IR[dlt|zrjaXOF>5.' #*19BJT]fow|tlcYPG>6.'!  !'.6>GPYclt|wof]TJB91*# &-5>FPYclu}}ulbYOF=5-&    &-5=FOYblu}}ulcYPF>5-&  #*2:CMV`jt}vlbXOE<4,%  %,4HR]hs~zncXMC:2*$  $*2:CMXcnz~sh]RH>5,% #*383/+'#   #'+/38>DKT]htų~m]OB6,#  #+5AO]nȹ~rh^VNHB=83/+'$   $'+/38=BHNV^hr~ɷn]OA5+#  "*5@N]mó}siaZSMGB=940+'$  $'+049=BGMSZais}˹m]N@5*"  !)4?M\m˼~umf_YSNHC>940+'##'+049>CHNSY_fmu~̹m\M?4)!   (2>KZk}Ķyrlf`ZUOID>94/*&""&*/49>DIOUZ`flry˷}kZK>2(   '1==>AEJPW^gpyµyj[NA6,#   (1;GS`n|ÿ|sjaZSNJGFFGJNSZajs|ļ|n`SG;1(   $,5?JVcp}ƿuld]WSPNNPSW]dlu¾}pcVJ?5,$   '/8BLXcozļwnga\YWWY\agnwzocXLB8/'   ")1:CMWakt}ƽxqjeb``bejqx¼}tkaWMC:1)"  #*2:BKT\emt{ǽysmjhhjmsyü{tme\TKB:2*#  $*18@GOV]djpuz~ŻzuqooquzŽ~zupjd]VOG@81*$  #)/6EMV_hr|}}|rh_VME>82-)%"  "&*/5;:876678:;>@BDEFGGFDB@=962.*&"  "%),/2579;;<;;9864210/../0124689;;<;;9752/,)%"  #'+/269<>@ABBA@?=;9765445679;=?@ABBA@><962/+'#  "&+/48=ADHJLNNNMLJHECA?>==>?ACEHJLMNNNLJHDA=84/+&"   %).39>CHMQTWY[[[ZXVSPNKIHGGHIKNPSVXZ[[[YWTQMHC>93.)%   "',27=CIOTZ^behiiigeb_\YVTRQQRTVY\_begiiiheb^ZTOIC=72,'"  $)/5;AHOU\bhmqtwxxwusolhda^\[[\^adhlosuwxxwtqmhb\UOHA;5/)$  !&+17>ELT[bipv|}xtpligffgilptx}|vpib[TLE>71+&!  "'-39AHPX`hpx{wsqooqsw{xph`XPHA93-'"  $).5;CKS\dmv~|zxxz|~vmd\SKC;5.)$  !%*06=EMU^hq{{qh^UME=60*%!   $(,28?FOWajt~~tjaWOF?82,($    #'+/4:AHPYblvþĿvlbYPHA:4/+'#   "%(+/38=DJRZdmwžŽwmdZRJD=83/+(%"   #'*-048=BGNU]enx¹xne]UNGB=840-*'#   !$(,037;?CGLRX_gpyúypg_XRLGC?;730,($!   $(-16:>BFJOSX^dks{¹{skd^XSOJFB>:61-($   "',17KZiz»zsle^WPJD?:63100136:?DJPW^elszοziZK>3)!  #,6BP_o}wqke_XRKE?:51.+))))+.15:?EKRX_ekqw}ɸo_PB6,#  $.9ESctǼ~ytnic^XRLF@;61-)&$""""$&)-16;@FLRX^cinty~ѿtcSE9.$  &0;HVfxķ~wqlfa\VQKFA;61-)%"  "%)-16;AFKQV\aflqw~ıxfVH;0&  '1=JXi{;zrke_YTOJE@;62-)%""%)-26;@EJOTY_ekrzȴ{iXJ=1'   (2>KZj|Ʒxof_YSMHC?:61-)%""%)-16:?CHMSY_foxɵ|jZK>2(    )3>LZk|ξxmd[TNHB>951-)%""%)-159>BHNT[dmxǵ|kZL>3)   !)3?LZj{ĵzncYQJC>940,(%! !%(,049>CJQYcnzIJ{jZL?3)!  "*4?LZizɹ}pdYPG@:50+($! !$(+05:@GPYdp}ziZL?4*"  "*4?KYhwʼreZOF>82,($!  !$(,28>FOZerɺwhYK?4*"  "+4?JXfuɼuh[PF>60*%!  !%*06>FP[huufXJ?4+"  #+4>JVdrĺwj]RG>6/)$  $)/6>GR]jwørdVJ>4+#  $,4>IUbo}Ľxk_SH?6/("  "(/6?HS_kx}obUI>4,$  %-5?IT`myxl`TI@7/("  "(/7@IT`lxym`TI?5-%   &.6?IT_kvwk`UJ@7/("  "(/7@JU`kwvk_TI?6.&   !(/8AJT_is}uj_UKA80)"  ")08AKU_ju}si_TJA8/(! #*19BKU_hrz{rh^TKB91)#  #)19BKT^hr{zrh_UKB91*# &,470)#  #)07>FNV^elqvz|}}|yuoib[SKC;3,& %+2:BJRZbipvz}}yuohaYQIA92+%  %+29AIQYahouy}}zvpibZRJB:2+%#*19AJR[ckrx}~ztnf^VNE=5.'!  !'.5=ENV^fntz~}xrkc[RJA91*#")08@IR\dmu|{ume\SKB:2+$  $+2:BKS\emu{|umd\RI@80)"'/7@IS]fox~vmd[RH?7/("  "(/7?HR[dmv~xof]SI@7/'-5>HR]hr|xndZPG>5-&    &-5>GPZdnx|rh]RH>5-3HR]hr|xndZPG>5-&    &-5>GPZdnx|rh]RH>5-'/7@IS]fox~vmd[RH?7/("  "(/7?HR[dmv~xof]SI@7/'")08@IR\dmu|{ume\SKB:2+$  $+2:BKS\emu{|umd\RI@80)"#*19AJR[ckrx}~ztnf^VNE=5.'!  !'.5=ENV^fntz~}xrkc[RJA91*#%+2:BJRZbipvz}}yuohaYQIA92+%  %+29AIQYahouy}}zvpibZRJB:2+% &,3;CKS[biouy|}}|zvqle^VNF>70)#  #)07>FNV^elqvz|}}|yuoib[SKC;3,& !'.5=DLT\cjpuy|}}{yupjc\TLD<5.'!  !'.5IUbo}Ľxk_SH?6/("  "(/6?HS_kx}obUI>4,$  #+4>JVdrĺwj]RG>6/)$  $)/6>GR]jwørdVJ>4+#  "+4?JXfuɼuh[PF>60*%!  !%*06>FP[huufXJ?4+"  "*4?KYhwʼreZOF>82,($!  !$(,28>FOZerɺwhYK?4*"  "*4?LZizɹ}pdYPG@:50+($! !$(+05:@GPYdp}ziZL?4*"  !)3?LZj{ĵzncYQJC>940,(%! !%(,049>CJQYcnzIJ{jZL?3)!   )3>LZk|ξxmd[TNHB>951-)%""%)-159>BHNT[dmxǵ|kZL>3)    (2>KZj|Ʒxof_YSMHC?:61-)%""%)-16:?CHMSY_foxɵ|jZK>2(   '1=JXi{;zrke_YTOJE@;62-)%""%)-26;@EJOTY_ekrzȴ{iXJ=1'  &0;HVfxķ~wqlfa\VQKFA;61-)%"  "%)-16;AFKQV\aflqw~ıxfVH;0&  $.9ESctǼ~ytnic^XRLF@;61-)&$""""$&)-16;@FLRX^cinty~ѿtcSE9.$  #,6BP_o}wqke_XRKE?:51.+))))+.15:?EKRX_ekqw}ɸo_PB6,#  !)3>KZiz»zsle^WPJD?:63100136:?DJPW^elszοziZK>3)!  &/:FSbrýzskd\UOID?<:99:BFJOSX^dks{¹{skd^XSOJFB>:61-($   !$(,037;?CGLRX_gpyúypg_XRLGC?;730,($!   #'*-048=BGNU]enx¹xne]UNGB=840-*'#   "%(+/38=DJRZdmwžŽwmdZRJD=83/+(%"   #'+/4:AHPYblvþĿvlbYPHA:4/+'#    $(,28?FOWajt~~tjaWOF?82,($   !%*06=EMU^hq{{qh^UME=60*%!  $).5;CKS\dmv~|zxxz|~vmd\SKC;5.)$  "'-39AHPX`hpx{wsqooqsw{xph`XPHA93-'"  !&+17>ELT[bipv|}xtpligffgilptx}|vpib[TLE>71+&!  $)/5;AHOU\bhmqtwxxwusolhda^\[[\^adhlosuwxxwtqmhb\UOHA;5/)$  "',27=CIOTZ^behiiigeb_\YVTRQQRTVY\_begiiiheb^ZTOIC=72,'"   %).39>CHMQTWY[[[ZXVSPNKIHGGHIKNPSVXZ[[[YWTQMHC>93.)%   "&+/48=ADHJLNNNMLJHECA?>==>?ACEHJLMNNNLJHDA=84/+&"  #'+/269<>@ABBA@?=;9765445679;=?@ABBA@><962/+'#   $(-159=ADFGHHHGECA?=<;::;<=?ACEGHHHGFDA=951-($   "',16;@EIMPSTUVUSROMJHFEDDEFHJMORSUVUTSPMIE@;61,'"   $)/4:@FLQVZ^acddca_\YVTRPOOPRTVY\_acddca^ZVQLF@:4/)$   !&+17>EKRX^dimprssqomifc`][ZZ[]`cfimoqssrpmid^XRKE>71+&!  "(-4:AHPW_fmsx|~{wsoligffgilosw{~|xsmf_WPHA:4-("  $)/5FNW`irz}||}zri`WNF>70*%   !&+18@GPYblvvlbYPG@81+&!  #'-39AIQ[dnyynd[QIA93-'#  !%).4;BJR\epzĿýzpe\RJB;4.)%!  "%(,16CHOV^gq{Ƽ{qg^VOHC>952.+(%"   $'+.258<@DHMSY`hq{Ż{qh`YSMHD@<852.+'$   #(,059<@DHKOTX^dkr{Ǿ¸{rkd^XTOKHD@<950,(#  !&+06;@DIMQUX\`diov}¹Ǿ}void`\XUQMID@;60+&!  "(.4:AGLRW[_cfjnqv{ú¹{vqnjfc_[WRLGA:4.("  #)07>FMTZ`fkosvy|úļ|yvsokf`ZTMF>70)#  ")08AIRZbipv|}}Ľ|vpibZRIA80)"  !(08AKU^hqz|wtrrtw|½zqh^UKA80(!  &.7@KValw¿}vqliggilqv}wlaVK@7.&  #+4>ITamyxqjea^\\^aejqxymaTI>4+#  '0:EQ^ky¾yrkd^YURQQRUY^dkryžyk^QE:0'  "+4?LYgvzskd^XRNJHFFHJNRX^dkszǼvgYL?4+"  %.9ER`pƿ~xrke^WQLGC@><<>@CGLQW^ekrx~˾p`RE9.%   (2=JXgxzuojd]WQKFA=96433469=AFKQW]djouz˼xgXJ=2(   "+5AN]m~~yuplga\VPKE@;730-,++,-037;@EKPV\aglpuy~Ŵ~m]NA5+"  $-7DRar̿zuqlgc^YTOJE?;62.*(&$##$&(*.26;?EJOTY^cglquzͻraRD7-$  %.9FTduʼ|uoid_ZVQLHC>:51-)&#!!#&)-15:>CHLQVZ_diou|udTF9.%  &0;HVfxƷ{rjc]XSNJEA=840,(%""%(,048=AEJNSX]cjr{ðxfVH;0&  '0951-*'#  #'*-159>CHNV^gr~°xgWI<1'  '15.'!  !'.5>HR\gr}wlbWMC91)"  $*2:CLV_is{xoe[QH?6.'!  !'.6?HQ[eox{si_VLC:2*$  %,3;CLU^gow}{tlcZPG?6/("  "(/6?GPZclt{}wog^ULC;3,% !'.5=EMU]elsx}~zuoh`XOG>6/("  "(/6>GOX`houz~}xsle]UME=5.'! $*18?GNV]djptwyzywtpjd]UMF>6/("  "(/6>FMU]djptwyzywtpjd]VNG?81*$ "'.4;BJQX^djnqsttrolgaZSLE=6/)#  #)/6=ELSZaglorttsqnjd^XQJB;4.'"  %+29?FMT[afjmoppolid_YRKD=6/)#  #)/6=DKRY_diloppomjfa[TMF?92+% $*07>ELRY_dhknoonkhd^YRKD>70*$  $*07>DKRY^dhknoonkhd_YRLE>70*$#)/6=DKRX^dhlnoonlie`ZSMF?81+%    %+18?FMSZ`eilnoonlhd^XRKD=6/)#"(/6=DKSY`ejnprrqolhb]VOHA:3-'!  !'-3:AHOV]bhloqrrpnje`YSKD=6/("!(.5=ELT[bhnruwwvtqmga[TLE=6/)#  #)/6=ELT[agmqtvwwurnhb[TLE=5.(! '.5=ENV^elrw{}~~|ytohaZRJB;3,&    &,3;BJRZahoty|~~}{wrle^VNE=5.' &-4=FOXaiqx~~xrjbZQI@81*$  $*18@IQZbjrx~~xqiaXOF=4-&+3ELRY_dhknoonkhd^YRKD>70*$  $*07>DKRY^dhknoonkhd_YRLE>70*$ %+29?FMT[afjmoppolid_YRKD=6/)#  #)/6=DKRY_diloppomjfa[TMF?92+%  "'.4;BJQX^djnqsttrolgaZSLE=6/)#  #)/6=ELSZaglorttsqnjd^XQJB;4.'" $*18?GNV]djptwyzywtpjd]UMF>6/("  "(/6>FMU]djptwyzywtpjd]VNG?81*$ !'.5=EMU]elsx}~zuoh`XOG>6/("  "(/6>GOX`houz~}xsle]UME=5.'! %,3;CLU^gow}{tlcZPG?6/("  "(/6?GPZclt{}wog^ULC;3,%  $*2:CLV_is{xoe[QH?6.'!  !'.6?HQ[eox{si_VLC:2*$  ")19CMWblw}rg\RH>5.'!  !'.5>HR\gr}wlbWMC91)"  !(09CNYdp|th\QG=5-&    &-5=GQ\ht|pdYNC90(!  !(09DO[huth\PF<4,&!  !&,4951-*'#  #'*-159>CHNV^gr~°xgWI<1'  '0:51-)&#!!#&)-15:>CHLQVZ_diou|udTF9.%  $-7DRar̿zuqlgc^YTOJE?;62.*(&$##$&(*.26;?EJOTY^cglquzͻraRD7-$  "+5AN]m~~yuplga\VPKE@;730-,++,-037;@EKPV\aglpuy~Ŵ~m]NA5+"   (2=JXgxzuojd]WQKFA=96433469=AFKQW]djouz˼xgXJ=2(   %.9ER`pƿ~xrke^WQLGC@><<>@CGLQW^ekrx~˾p`RE9.%  "+4?LYgvzskd^XRNJHFFHJNRX^dkszǼvgYL?4+"  '0:EQ^ky¾yrkd^YURQQRUY^dkryžyk^QE:0'  #+4>ITamyxqjea^\\^aejqxymaTI>4+#  &.7@KValw¿}vqliggilqv}wlaVK@7.&  !(08AKU^hqz|wtrrtw|½zqh^UKA80(!  ")08AIRZbipv|}}Ľ|vpibZRIA80)"  #)07>FMTZ`fkosvy|úļ|yvsokf`ZTMF>70)#  "(.4:AGLRW[_cfjnqv{ú¹{vqnjfc_[WRLGA:4.("  !&+06;@DIMQUX\`diov}¹Ǿ}void`\XUQMID@;60+&!  #(,059<@DHKOTX^dkr{Ǿ¸{rkd^XTOKHD@<950,(#   $'+.258<@DHMSY`hq{Ż{qh`YSMHD@<852.+'$   "%(+.259>CHOV^gq{Ƽ{qg^VOHC>952.+(%"   #&),049?ELT]gq{ƾż{qg]TLE?940,)&#   "%(,16FNW`irz}||}zri`WNF>70*%   $)/5EKRX^dimprssqomifc`][ZZ[]`cfimoqssrpmid^XRKE>71+&!   $)/4:@FLQVZ^acddca_\YVTRPOOPRTVY\_acddca^ZVQLF@:4/)$   "',16;@EIMPSTUVUSROMJHFEDDEFHJMORSUVUTSPMIE@;61,'"   $(-159=ADFGHHHGECA?=<;::;<=?ACEGHHHGFDA=951-($    %*/38=AEIKMNONMLJHFDBA@@ABDFHJLMNONMKIEA=83/*%   "'-28>CINRVY[]]\[YWTROMLKKLMORTWY[\]][YVRNIC>82-'"  $)/5ENWalwúwlaWNE>71+'#   "&).28?FNWakv»ƼvkaWNF?82.)&"   "$'*-15;@GOW`juƿƼuj`WOG@;51-*'$"  !$'*,/26:>CIPX`is~Ĺ~si`XPIC>:62/,*'$!  #&)-0369<@DHMSYair|ǿ|riaYSMHD@<9630-)&#  #'+/37:>ADHKOSX]cjr{ļŻ{rjc]XSOKHDA>:73/+'#   %*/49>BFJNQTW[_chmt{ƾɿ{tmhc_[WTQNJFB>94/*%   "'-39?EJOTX\_behkosx}ƾ}xsokheb_\XTOJE?93-'"  "(/6=DKRX^cgknqtvx{~ļ~{xvtqnkgc^XRKD=6/("  "(/7?GPX`gmsx|ƿſ|xsmg`XPG?7/("   '/7@IS\fnw~Ŀ}||}~wnf\SI@7/'   %-5?IT_it~~ytqooqty~~ti_TI?5-%  "*3JWesĽ{tnhb\WROMKKMORW\bhnt{¸seWJ>3*"  $-8CP^m}Ž{vqlf`ZTOKGDA@@ADGKOTZ`flqv{Ǻ}m^PC8-$  '1:730-)&#  #&)-037:>CGLRYajuоudTF:/%  &/:FTct²xlbXPIC>951.*'$""$'*.159>CIPXblxͼtcTF:/&  &/9FSbrȹ}odYPG@:51-)&#   #&)-15:@GPYdo}ɸrbSF9/&  %.9ER`p˽sg[PG?82-)%" "%)-28?GP[gs³p`RE9.%  %.8CP^m|˿wj]RH?81+&"  "&+18?HR]jwǺ|m^PC8.%  %-7BN[iwǽ{m`TJ@80*%    %*08@JT`m{ǽwi[NB7-%  %-6@KXerſ|ocWLB91*$  $*19BLWco|»reXK@6-%  $,5?IUamz|pdXMC:1*$  $*1:CMXdp|zmaUI?5,$  %,4=GR]hs{pdYND;2+$  $+2;DNYdp{sh]RG=4,%  %,482,&!  !&,28>EKPVZ^acddca^ZVPKE?93-'"!&,28>DJOTY\_abba_\YTOJD>82,&!  !&,28>DJOTY\_abba_\YTOJD>82,&! &+18>DJPUY]`bccb`]YUPJD>82,'!  !',28>DJPUY]`bccb`]YUPJD>81+&  %+28?EKQW\`ceffec`\WRLF@:4.(#  #(.4:@FLRW\`ceffec`\WQKE?82+%  %+29@GNTZ_dgjkkjhea\VPJD=60*$  $*06=DJPV\aehjkkjgd_ZTNG@92+% %+2:AIPX^djnqrsrpmhc]WPIB;4-'"  "'-4;BIPW]chmprsrqnjd^XPIA:2+%$+2:BKS[cjpuy{||zwrmg`XPIA92+%    %+29AIPX`gmrwz||{yupjc[SKB:2+$*1:BLU^gow}yskcZRIA91*$  $*19AIRZcksy}wog^ULB:1*08BLV`jt}yqg^TJA90)#  #)09AJT^gqy}tj`VLB806@JUalwwlaWLB90)"  ")09BLWalwwlaUJ@6=HS_lx~rfZOD:1)"  ")1:DOZfr~xl_SH=CO\iwxk^QF;2)"  ")2;FQ^kxwi\OCJWesƾ~obTH=3*"  "*3=HTbo~seWJP^m}ɾteWJ>4*"  "*4>JWetƹ}m^PUdtȹyiZL@5+#  #+5@LZiyŷtdUZj{}l]NA6,#  #,6AN]l}{jZ^nǶo_PB7,#  #,7BP_oȶn^`q˹p`QC7-$  $-7CQ`pͻq`bsͻqaQD7-$  $-7DQaqоsbbsͻqaQD7-$  $-7DQaqоsb`q˹p`QC7-$  $-7CQ`pͻq`^nǶo_PB7,#  #,7BP_oȶn^Zj{}l]NA6,#  #,6AN]l}{jZUdtȹyiZL@5+#  #+5@LZiyŷtdUP^m}ɾteWJ>4*"  "*4>JWetƹ}m^PJWesƾ~obTH=3*"  "*3=HTbo~seWJCO\iwxk^QF;2)"  ")2;FQ^kxwi\OC=HS_lx~rfZOD:1)"  ")1:DOZfr~xl_SH=6@JUalwwlaWLB90)"  ")09BLWalwwlaUJ@608BLV`jt}yqg^TJA90)#  #)09AJT^gqy}tj`VLB80*1:BLU^gow}yskcZRIA91*$  $*19AIRZcksy}wog^ULB:1*$+2:BKS[cjpuy{||zwrmg`XPIA92+%    %+29AIPX`gmrwz||{yupjc[SKB:2+$%+2:AIPX^djnqrsrpmhc]WPIB;4-'"  "'-4;BIPW]chmprsrqnjd^XPIA:2+% %+29@GNTZ_dgjkkjhea\VPJD=60*$  $*06=DJPV\aehjkkjgd_ZTNG@92+%  %+28?EKQW\`ceffec`\WRLF@:4.(#  #(.4:@FLRW\`ceffec`\WQKE?82+%  &+18>DJPUY]`bccb`]YUPJD>82,'!  !',28>DJPUY]`bccb`]YUPJD>81+& !&,28>DJOTY\_abba_\YTOJD>82,&!  !&,28>DJOTY\_abba_\YTOJD>82,&!"'-39?EKPVZ^acddca^ZVPKE>82,&!  !&,28>EKPVZ^acddca^ZVPKE?93-'" #).5;AHNTY^beghhgea]XSMF?92,&!  !&,29?FMSX]aeghhgeb^YTNHA;5.)#  %+18?FLSY_dhkmnnmjfb\VOHA:3,&    &,3:AHOV\bfjmnnmkhd_YSLF?81+%  #)/6=DLSZagmqtvwvtqmgaZRJC;4-&    &-4;CJRZagmqtvwvtqmgaZSLD=6/)#  !'.5951.*'$""$'*.159>CIPXblxͼtcTF:/&  %/:FTduȹujaYRLGC>:730-)&#  #&)-037:>CGLRYajuоudTF:/%  %.9ESct;}sjc\WRMIEA=:62/+(%""%(+/26:=AEIMRW\cjs}оtcSE9.%  $-8DRar´|tmgb]XTPLHD@<841-*'$"  "$'*-148<@DHLPTX]bgmt|ͼraRD8-$  "+6BO^o÷}wrmiea]YUQLHC?;63/,)'&%%&'),/36;?CHLQUY]aeimrw}ȷo^OB6+"  !)3?L[j{ø|yuqnjfb^YUPKFA=9520.--.0259=AFKPUY^bfjnquy|{j[L?3)!  '1JWesĽ{tnhb\WROMKKMORW\bhnt{¸seWJ>3*"  &/8CO\iw}void_[XWWX[_diov}ÿwi\OC8/&  "*3BFJNQTW[_chmt{ƾɿ{tmhc_[WTQNJFB>94/*%   #'+/37:>ADHKOSX]cjr{ļŻ{rjc]XSOKHDA>:73/+'#  #&)-0369<@DHMSYair|ǿ|riaYSMHD@<9630-)&#  !$'*,/26:>CIPX`is~Ĺ~si`XPIC>:62/,*'$!  "$'*-15;@GOW`juƿƼuj`WOG@;51-*'$"   "&).28?FNWakv»ƼvkaWNF?82.)&"   #'+17>ENWalwúwlaWNE>71+'#   %*/6=ENWalwþýwlaWNE=6/*%   #).5CINRVY[]]\[YWTROMLKKLMORTWY[\]][YVRNIC>82-'"   %*/38=AEIKMNONMLJHFDBA@@ABDFHJLMNONMKIEA=83/*%   !&+06;@EJMQSTUUTRPNKIHFFFFHIKNPRTUUTSQMJE@;60+&!  #(.4:@FLRW\_bcddb`^[YVTSRRSTVY[^`bddcb_\WRLF@:4.(#  $)06=DLSZ`fkortttrpmjgda`__`adgjmprtttrokf`ZSLD=60)$  %*18@GPX`hov{}yuromllmoruy}{voh`XPG@81*%   %+29AJR\enw}{zz{}wne\RJA92+%    %+2:BKT^hr||rh^TKB:2+%    &,2:BKU_juuj_UKB:2,&   !&,2:BKU_jvÿþvj_UKB:2,&!  "',2:BJT_jvƿżvj_TJB:2,'"   $(-3:AJS]ht¼ɿth]SJA:3-($    #'*/4:AIR\fr~ýʾ~rf\RIA:4/*'#    "%'*.26ADGJNRW\cjs|½|sjc\WRNJGDA>;851.*&"   $).38<@DGKMPSVY\aflszüøzslfa\YVSPMKGD@<83.)$   !&,27=CHMQUX[^`behkpuzùzupkheb`^[XUQMHC=72,&!  !'.4;BIOU[`dgjlnprtvy}ƾ}yvtrpnljgd`[UOIB;4.'!  !'.6=ENU]djotwz|}~ü~}|zwtojd]UNE=6.'!  &-6>GQZckszþzskcZQG>6-&  $,4=GQ\gqz|ywwy|zqg\QG=4,$  !)1;EP\ht}wrnkjjknrw}th\PE;1)!  %-7AMYfs{tnida^]]^adint{sfYMA7-%  !)2:7421001247:>BGKOSW[_behjmptx|˻xgXJ=2(   !*4@M\l}Ȼ{tniea^[XTQNJGC?;740-+)(''()+-047;?CGJNQTX[^aeint{ò}l\M@4*!  "+6BO^oȺ}tle_[VROLHEB>;741-*'%#! !#%'*-147;>BEHLORV[_elt}Ƕo^OB6+"  #,7CQ`pƷvlc\VPLHDA=:741.+(%"  "%(+.147:=ADHLPV\clvʸp`QC7,#  $-7CQ`qznd[SMGB>:730-+(%"  "%(+-037:>BGMS[dnzɸq`QC7-$  $-7CQ`pʻrf\SKD>951.+(%#  #%(+.159>DKS\frǶp`QC7-$  $,7BP^nwj^TKC<61-)&#! !#&)-16IVcqvi\QF=5.("  "(.5=FQ\ivǿqcVI>3*"  ")2FOW`hov|ztme\SJB91*$  $*19BJS\emtz|voh`WOF>6/("  #)/6=ELT[bhnrvwxwuqlg`XQIA91*$  $*19AIQX`glquwxwvrnhb[TLE=6/)#  $*06=DKQW]bgjlmmkie`ZTMF?81*$  $*18?FMTZ`eikmmljgb]WQKD=60*$  !&,28>DJPUZ^acddca^ZUPJC=60*$  $*06=CJPUZ^acddca^ZUPJD>82,&! $)/4:@EJOTWZ\]^][XUQLFA;5/)$  $)/5;AFLQUX[]^]\ZWTOJE@:4/)$ #(-38=CGLPSVXYYXWTQMID>93.(#  #(.39>DIMQTWXYYXVSPLGC=83-(# #(-28=BGKORUVWWVUROKGB=82-(#  #(-28=BGKORUVWWVUROKGB=82-(##(-38>CHLPSVWXXWUSOKGB=82-(#  #(-28=BGKOSUWXXWVSPLHC>83-(##(.4:?EJOSVY[[[ZXURMID>93.)$  $).39>DIMRUXZ[[[YVSOJE?:4.(##)/5HR]hr|xndZPF=4,%  %,4=FPZdnx|rh]RH>4;EP\htvj_TI?5-%  %-5?IT_jvth\PE;AMYfs}qdXLA7.&  &.7ALXdq}sfYMAHTbp~ľwi\OC9/'  '/9CO\iw»~pbTHN[jy}n`RF:0'    '0:FR`n}ɿyj[NSbqsdUH<2(    (23)!  !)3>JXgwɻwgX[k|{jZL?4*!  !*4?LZj{±|k[^nij}l\M@4*"  "*4@M\l}Ƕn^_pƵ~m]NA5+"  "+5AN]m~ʹp__pƵ~m]NA5+"  "+5AN]m~ʹp_^nij}l\M@4*"  "*4@M\l}Ƕn^[k|{jZL?4*!  !*4?LZj{±|k[XgwȺwgXJ>3)!  !)3>JXgwɻwgXSbqsdUH<2(    (2HR]hr|xndZPF=4,%  %,4=FPZdnx|rh]RH>4.6?IR\fow~xph_VMD;3,%  %,3;DMV_hpx~wof\RI?6.(/7@HQYbipvz}~~}zupibZRJB:3,%    %,3:BJRZbipuz}~~}zvpibYQH@7/(")07?GNV]cimprsrpmhc]VOHA:3-'!  !'-3:AHOV]chmprsrpmic]VNG?70)"#)06=DKRX]behiihfb^YTNGA:4.(#  #(.4:AGNTY^bfhiiheb]XRKD=60)##)/593.)$  $).39>DIMRUXZ[[[YVSOJE?:4.(##(-38>CHLPSVWXXWUSOKGB=82-(#  #(-28=BGKOSUWXXWVSPLHC>83-(##(-28=BGKORUVWWVUROKGB=82-(#  #(-28=BGKORUVWWVUROKGB=82-(# #(-38=CGLPSVXYYXWTQMID>93.(#  #(.39>DIMQTWXYYXVSPLGC=83-(# $)/4:@EJOTWZ\]^][XUQLFA;5/)$  $)/5;AFLQUX[]^]\ZWTOJE@:4/)$ !&,28>DJPUZ^acddca^ZUPJC=60*$  $*06=CJPUZ^acddca^ZUPJD>82,&!  $*06=DKQW]bgjlmmkie`ZTMF?81*$  $*18?FMTZ`eikmmljgb]WQKD=60*$  #)/6=ELT[bhnrvwxwuqlg`XQIA91*$  $*19AIQX`glquwxwvrnhb[TLE=6/)#  "(/6>FOW`hov|ztme\SJB91*$  $*19BJS\emtz|voh`WOF>6/("  !(/7?IR\eox{ri_UKB91*#  #*19BKU_ir{xoe\RI?7/(!  !(08AKValvvk`UKA80)#  #)08AKU`kvvlaVKA80(!  !)1:DOZfr~xl`UJ@7/("  "(/7@JU`lx~rfZOD:1)!  ")2IVcqvi\QF=5.("  "(.5=FQ\ivǿqcVI>3*"  #+5@LYgvĸsfYND<4.($    $(.4951.+(%#  #%(+.159>DKS\frǶp`QC7-$  $-7CQ`qznd[SMGB>:730-+(%"  "%(+-037:>BGMS[dnzɸq`QC7-$  #,7CQ`pƷvlc\VPLHDA=:741.+(%"  "%(+.147:=ADHLPV\clvʸp`QC7,#  "+6BO^oȺ}tle_[VROLHEB>;741-*'%#! !#%'*-147;>BEHLORV[_elt}Ƕo^OB6+"  !*4@M\l}Ȼ{tniea^[XTQNJGC?;740-+)(''()+-047;?CGJNQTX[^aeint{ò}l\M@4*!   (2=JXgxƺ|xtpmjheb_[WSOKGB>:7421001247:>BGKOSW[_behjmptx|˻xgXJ=2(   &/:FSbr¸~{ywuspmjfb]XTOJFB?<:99:GQZckszþzskcZQG>6-&  !'.6=ENU]djotwz|}~ü~}|zwtojd]UNE=6.'!  !'.4;BIOU[`dgjlnprtvy}ƾ}yvtrpnljgd`[UOIB;4.'!  !&,27=CHMQUX[^`behkpuzùzupkheb`^[XUQMHC=72,&!   $).38<@DGKMPSVY\aflszüøzslfa\YVSPMKGD@<83.)$   "&*.158;>ADGJNRW\cjs|½|sjc\WRNJGDA>;851.*&"  "%(+.1469<@CHMSZbkuɼukbZSMHC@<9641.+(%"   #%(*-036:?DJRZcmx¾öxmcZRJD?:630-*(%#    "%'*.26CINRUXZZZYXUSQOMKKKKMOQSUXYZZZXURNIC>82,'"  #)/5FPZeröreZPF>60*%!  !$(,16=ENWbn{{nbWNE=61,($!  !#%(+/38>ELU_jvɻvj_ULE>83/+(%#!  !$&(+-036;@ELT]gr~´~rg]TLE@;630-+(&$!  !$'*,/1469ACFIMQV\cluɽulc\VQMIFCA><9630,($!  #(-16:>AEGJLOQTW[_ekr{ɾ{rke_[WTQOLJGEA>:61-(#   %+06;AFJNRUWY[]_behmryľǽyrmheb_][YWURNJFA;60+%    &,39@GMSX\`cfhijlmoruyúyuromljihfc`\XSMG@93,&    &-4KYhy{smgb^[XVSQNKIEB?;852/-+*))*+-/258;?BEIKNQSVX[^bgms{̽yhYK>2)   !*4@M[k|ule^YTQMJGEB?=:741.+(&$#"!!"#$&(+.147:=?BEGJMQTY^elu|k[M@4*!  "+5AN]m~̾zoe]VPKGC@=:752/-*(%#  #%(*-/257:=@CGKPV]eozó~m]NA5+"  "+5AN]m~ɺth^UNHB>:631.+)'$"  "$')+.136:>BHNU^htò~m]NA5+"  "+5AN\l|ôymaWNF@:51.+(&#!!#&(+.15:@FNWamy|l\NA5+"  "*4@LZjzȻreZOG?83.*'$! !$'*.38?GOZerɻzjZL@4*"  !*3>JXfvʾwj]RH?81,'#   #',18?HR]jwvfXJ>3*!  !)25-&    &-5>GR\hs~wl`UJ?6-%  %,4ELSZ`ejmoponjfa[TME>6/)#  #)/6>EMT[afjnopomje`ZSLE>70*$   %+17=CIOUZ^aceedb^ZUOIB<5.("  "(.5BGKNQSTUTSQNJFA<71,&!  !&,1794/*%!  $).27<@DGKMOPPPNLJFB>94/*%!  !%*/49>BFJLNPPPOMKGD@<72.)$   $).27;@CGJLMNNMLJGD@<73.)%    %).37<@DGJLMNNMLJGC@;72.)$  %*/38=AEHKMNOONLJGC@;72-)$    $)-27;@CGJLNOONMKHEA=83/*% !&+05;?DHLNQRRRQOLIEA=83.)%    %).38=AEILOQRRRQNLHD?;50+&!!',28=CHMQTVXXXWTQNJE@;60+&!  !&+06;@EJNQTWXXXVTQMHC=82,'!!'-3:@GMRW[^```_]YUQKF@:4/)$  $)/4:@FKQUY]_```^[WRMG@:3-'!!'.56.(!  !(.6>FOX`hpv|}xqjaXOF=4,2;EOYdnwyqg]SJ@80("  "(08@JS]gqywndYOE;29CNYdp{yodYND:1)"  ")1:DNYdoy{pdYNC9?JVco|vj^RG=3*#  #*3=GR^jv|ocVJ?FR_lz~qdWK?5,$  $,5?KWdq~zl_RFKYguùwi[NB7-%  %-7BN[iw¹ugYKQ_n}ĸ}n_QE9/&  &/9EQ_n}Ź}n_QUdtrcTG;0'  '0;GTcrõtdUYhyȹvfVI<1(    (12)    )2>KYiyij~m]]m~ϿyiYK>2)    )2>KYiyij~m][k|̽xhXJ=2(    (2=JXhx|k[YhyȹvfVI<1(    (16.(!  !(.6>FOX`hpv|}xqjaXOF=4,&-5=EMU]djosvwvtqmgaZSKC<5.'"  "'.594/*%!  !%*/49>BFJLNPPPOMKGD@<72.)$  !%*/49>BGKNQSTUTSQNJFA<71,&!  !&,1794/*%!  "',27=BHLQUXZ[\[YWSOJE?93-'"  "'-39?EJOSWY[\[ZXUQLHB=72,'"   %+17=CIOUZ^aceedb^ZUOIB<5.("  "(.5ELSZ`ejmoponjfa[TME>6/)#  #)/6>EMT[afjnopomje`ZSLE>70*$  $*18@HPX`gnsx{||{xtng`XPG?7/("  "(/7?GPX`gntx{||{xsng`XPH@81*$  $+2:CLU^gpw~|umd[QH?7/("  "(/7?HQ[dmu|~wpg^ULC:2+$  %,45-&    &-5>GR\hs~wl`UJ?6-%  &/8BMYfssg[PE<3,&    &,3JXfvʾwj]RH?81,'#   #',18?HR]jwvfXJ>3*!  "*4@LZjzȻreZOG?83.*'$! !$'*.38?GOZerɻzjZL@4*"  "+5AN\l|ôymaWNF@:51.+(&#!!#&(+.15:@FNWamy|l\NA5+"  "+5AN]m~ɺth^UNHB>:631.+)'$"  "$')+.136:>BHNU^htò~m]NA5+"  "+5AN]m~̾zoe]VPKGC@=:752/-*(%#  #%(*-/257:=@CGKPV]eozó~m]NA5+"  !*4@M[k|ule^YTQMJGEB?=:741.+(&$#"!!"#$&(+.147:=?BEGJMQTY^elu|k[M@4*!   )2>KYhy{smgb^[XVSQNKIEB?;852/-+*))*+-/258;?BEIKNQSVX[^bgms{̽yhYK>2)   '0;HUdtɽztplifdb`^[YVSOKGD@<9643223469<@DGKOSVY[^`bdfilptzŶtdUH;0'  %.8DQ_n~ù{xvtrqonljgda]YUQLHEA?=<<=?AEHLQUY]adgjlnoqrtvx{Ȼ~n_QD8.%  "+5@LYgvļ~~}|{ywtqmhd_ZUQNKIHHIKNQUZ_dhmqtwy{|}~~ƼvgYL@5+"   '0;FR_m{Ŀ}ytnid_[XVTTVX[_dinty}Ŀ{m_RF;0'   $,5@KWcp}ysnifcbbcfinsy}pcWK@5,$   (09CNYep{}xtqppqtx}{peYNC90(   #*3AEGJLOQTW[_ekr{ɾ{rke_[WTQOLJGEA>:61-(#  !$(,0369<>ACFIMQV\cluɽulc\VQMIFCA><9630,($!  !$'*,/1469ELU_jvɻvj_ULE>83/+(%#!  !$(,16=ENWbn{{nbWNE=61,($!  !%*06>FPZeröreZPF>60*%!   $*07?HR\huſ¶uh\RH?70*$   $)07@IS^jvſƽvj^SI@70)$  $*18AJT_kwwk_TJA81*$  $*19AKU_juuj_UKA91*$  $*19AJT^hr{{rh^TJA91*$  $*18@IR[clt{}zwuttuwz}{tlc[RI@81*$  $*07?FNV^ekquy{{{zwtqnkhfeefhknqtwz{{{yuqke^VNF?70*$  #)/5CINRUXZZZYXUSQOMKKKKMOQSUXYZZZXURNIC>82,'"  "(.4:@FLQVY\^__^\ZXUSQPOOPQSUXZ\^__^\YVQLF@:4.("  #)/6=ELSZ`eimoppnmjgda_]]]]_adgjmnppomie`ZSLE=6/)#  $*18@HPYaipv{~~{wtqnlkklnqtw{~~{vpiaYPH@81*$  $*19AJS]fpx~{zz{~xpf]SJA91*$  #*19AKU_juuj_UKA91*#  #)08AKU`lxxl`UKA80)#  "(/7@IT`lxüxl`TI@7/("  "(.5>HR^jwþùwj^RH>5.("  "'-4@BEHLQW^foyǹyof^WQLHEB@><9741.+'#   "'+048EKPUY]`bcdefgiknrw}ɿ}wrnkigfedcb`]YUPKE>81+%   %,3:BIQX^dhloqrssssstvx||xvtsssssrqolhd^XQIB:3,%  $+3;CLU]emsx|~}}~þý~}}~|xsme]ULC;3+$  ")1:CMWakt||tkaWMC:1)"  '/8ALWbmx}ywuuwy}xmbWLA8/'  #+4>IUamy}wrnjhffhjnrw}ymaUI>4+#  &/9DP]jx{vqlgc_\YXXY\_cglqv{xj]PD9/&  !*3>JWdsĽ}{yxxxxxxxwvtqnjea]XTQNLKKLNQTX]aejnqtvwxxxxxxxy{}sdWJ>3*!  $-7BO\k{ż}xtqomlkkjihfca^ZVRNJGDA@??@ADGJNRVZ^acfhijkklmoqtx}¶{k\OB7-$  &/:FSaq¶ysmieca_^\[YWUROLHEA>;86544568;>AEHLORUWY[\^_aceimsy̿qaSF:/&  '1JYhxƹyof_YTOLIFDB@>;9641.,)'%$#""#$%'),.1469;>@BDFILOTY_foy˼xhYJ>2)   !)3?KZizŷti`XQKFB?<:7531/,*(%#!!#%(*,/1357::631.,*(&$"  "$&(*,.136:>CIQYcn{̽ziZL?3)!  !)3>KYhxʼth\RJB<72.+)&$"  "$&)+.273)!  !)2=IWfuµ{maVLC;50+'$" "$'+05;CLVam{õufWI=2)!   (1;GTbqøsfZOE<5/)%! !%)/56/)$  $)/6>GR^jwļ{l^QE9/'  %.7BMZgtznaUJ@70)#  #)07@JUanztgZMB7.%  $,5>IUamz{ocXMC91*$  $*19CMXco{zmaUI>5,$  #*2;EP[fq|zodYOD;3+%  %+3;DOYdoz|qf[PE;2*#  ")08AKU_ir{vmcYOE<4,&    &,4FOXaipw}}wpi`WNE=5-&    &-5=ENW`ipw}}wpiaXOF>6.'!  !'-4;CJRY`glqtvvurnic\TLD<5-'!  !'-5:73/*&"  "&*/37:>ACEFGFFDC@=:62.*&! "'+048:50,'#  #',05:>CGJMOQQQPNKHC?:4/*%  %+17=CHMRUXYZYXURNJE@:5/*%    %*/5:@EJNRUXYZYXURMHC=71+%  &,29@GMSY]`cddc`]YTNHB<5/*$  $*/570*$  $*07>ELSZ`fjmopomje_YRJB:3,%+2;CLU]elsx{}}|yupibZRIA92+$  $+29AIRZbipuy|}}{xsle]ULC;2+1:CLV`jszzsjaWNE<4,%  %,470*$  $*07>ELSZ`fjmopomje_YRJB:3,% &,29@GMSY]`cddc`]YTNHB<5/*$  $*/5:50,'#  #',05:>CGJMOQQQPNKHC?:4/*% #(-27;?CFHJKKKIGEB?;72.*&!  !&*.27;?BEGIKKKJHFC?;72-(#"'+048:73/*&"  "&*/37:>ACEFGFFDC@=:62.*&! !%).26:=ACFGHIHGFC@=951,(#  #(,159=@CFGHIHGFCA=:62.)%! "&*/38<@DGJLMNMLJHEA=83.)$    $).38=AEHJLMNMLJGD@<83/*&"  #(-27FOXaipw}}wpi`WNE=5-&    &-5=ENW`ipw}}wpiaXOF>6.'!  ")08AKU_ir{vmcYOE<4,&    &,4IUamz{ocXMC91*$  $*19CMXco{zmaUI>5,$  %.7BMZgtznaUJ@70)#  #)07@JUanztgZMB7.%  '/9EQ^l{wj^RG>6/)$  $)/6>GR^jwļ{l^QE9/'   (1;GTbqøsfZOE<5/)%! !%)/5KYhxʼth\RJB<72.+)&$"  "$&)+.273)!  !)3?LZiz´{ncYQIC>:631.,*(&$"  "$&(*,.136:>CIQYcn{̽ziZL?3)!  !)3?KZizŷti`XQKFB?<:7531/,*(%#!!#%(*,/1357:JYhxƹyof_YTOLIFDB@>;9641.,)'%$#""#$%'),.1469;>@BDFILOTY_foy˼xhYJ>2)   '1;86544568;>AEHLORUWY[\^_aceimsy̿qaSF:/&  $-7BO\k{ż}xtqomlkkjihfca^ZVRNJGDA@??@ADGJNRVZ^acfhijkklmoqtx}¶{k\OB7-$  !*3>JWdsĽ}{yxxxxxxxwvtqnjea]XTQNLKKLNQTX]aejnqtvwxxxxxxxy{}sdWJ>3*!  &/9DP]jx{vqlgc_\YXXY\_cglqv{xj]PD9/&  #+4>IUamy}wrnjhffhjnrw}ymaUI>4+#  '/8ALWbmx}ywuuwy}xmbWLA8/'  ")1:CMWakt||tkaWMC:1)"  $+3;CLU]emsx|~}}~þý~}}~|xsme]ULC;3+$  %,3:BIQX^dhloqrssssstvx||xvtsssssrqolhd^XQIB:3,%   %+18>EKPUY]`bcdefgiknrw}ɿ}wrnkigfedcb`]YUPKE>81+%   $)/4:?DHLORTVWYZ\_bfkryĸyrkfb_\ZYWVTROLHD?:4/)$  "'+048@BEHLQW^foyǹyof^WQLHEB@><9741.+'#    #%(+-/1469HR^jwþùwj^RH>5.("  "(/7@IT`lxüxl`TI@7/("  #)08AKU`lxxl`UKA80)#  #*19AKU_juuj_UKA91*#  $*19AJS]fpx~{zz{~xpf]SJA91*$  $*18@HPYaipv{~~{wtqnlkklnqtw{~~{vpiaYPH@81*$  #)/6=ELSZ`eimoppnmjgda_]]]]_adgjmnppomie`ZSLE=6/)#  "(.4:@FLQVY\^__^\ZXUSQPOOPQSUXZ\^__^\YVQLF@:4.("  #(.5;BHNTY]`bccb`^[YVTSRRSTVY[^`bccb`]YTNHB;5.(#  $*07?FNU\chmqsttsqnkhfcaaaacfhknqsttsqmhc\UNF?70*$  $*19AIR[dlsy|yusqppqsuy|ysld[RIA91*$  #*19BKU_is||si_UKB91*#  #)09BLValwwlaVLB90)#  "(/7AKVamzzmaVKA7/("  !'.6?IT`ly¼¸yl`TI?6.'!  !&-4=FQ]jwȽwj]QF=4-&!  !&+2:DNYft˽tfYND:2+&!  !&+18AKUao}ɺ}oaUKA81+&!   #',17?GQ]iwĴwi]QG?71,'#    "$'*-27>ENXcp~̼~pcXNE>72-*'$"   !#%')+.149>DLU^jvvj^ULD>941.+)'%#!  "$'),.02469<@EKR[do|ŵ|od[RKE@<96420.,)'$"  #&*-03579;=?BEHMRYajtƷtjaYRMHEB?=;97530-*&#  !&*/37:=@CEFHJLNQUZ`goyķyog`ZUQNLJHFEC@=:73/*&!  #(.38=BFJMOQSTUVXZ]afls||slfa]ZXVUTSQOMJFB=83.(#  $*07=CINSWZ]_`aabcdfilqw~ƻ~wqlifdcbaa`_]ZWSNIC=70*$  $+29@HOU\afilnnoonnnoprvzƾzvrponnnoonnlifa\UOH@92+$  #*2:BJS[cjpuy|}~}|{yxwwxz}¼}zxwwxy{|}~}|yupjc[SJB:2*#  !(09BKU_hqy~}~~}~yqh_UKB90(!  &.6@JU`ku~{yy{~uk`UJ@6.&  "*3=GS_kw{vqnkjjknqv{wk_SG=3*"  %.8BN[hu}{z{|}|xsojfb_\[[\_bfjosx|}|{z{}uh[NB8.%  !)2<:8641/,*(&%$##$%&(*,/1468:<>@BCFHKOTZbjtƷueVH<1'   (2=IWfw{oe\TMGC?<:75420.,*(%#!  !#%(*,.02457:5.'"  "'.5>HS^jw}pcVJ?5,$  "*2GQZdmv}{rj`VMC:2+$  $+2:CMV`jr{}vmdZQG>5-&   %+2:BKS\dkrw{~~|xsme]ULC;3,%  %,3;CLU]emsx|~~{wrkd\SKB:2+%  $*07>FMT[agknpqpnje_YQJB:3,&    &,3:BJQY_ejnpqpnkga[TMF>70*$  #)/5;AHNTY]`cddc`]XSMF@92,&    &,29@FMSX]`cddc`]YTNHA;5/)#  $).39>CHMQTWXYXWTQMHB<60+%    %+0693.)$  !%).37<@DHKMOOONLJFB>94.)$  $).49>BFJLNOOOMKHD@<73.)%!  #'+/37;>ADFGHHGFDA=951,'#  #',159=ADFGHHGFDA>;73/+'# #&*.258;>@BCCCBA?<962.*%!  !%*.269;852.*&# #'+/258;=?@AA@?><963/,($    $(,/369<>?@AA@?=;852/+'#  $)-048;=?AABAA?=;852.*'#  #'*.258;=?AABAA?=;840-)$ "&+/37;>ACEEEEDB@=:62.+'#  #'+.26:=@BDEEEECA>;73/+&"#(-27<@DGIKLLKJGEA>:51,($    $(,15:>AEGJKLLKIGD@<72-(#$)/5:@EJMQSTTTRPMID@;61,'"  "',16;@DIMPRTTTSQMJE@:5/)$$*17>DJPUY\^__][WSNIC=71,&!  !&,17=CINSW[]__^\YUPJD>71*$$*19@GOV\aeijkjhe`[UNHA:3-'!  !'-3:AHNU[`ehjkjiea\VOG@91*$*19AJRZbiosvxxwtpjd]UME=5.("  "(.5=EMU]djptwxxvsoibZRJA91*08AJT]fov}{ume\SJA80)#  #)08AJS\emu{}vof]TJA806?IT^is|xndZOE<3+$  $+3DJPUY\^__][WSNIC=71,&!  !&,17=CINSW[]__^\YUPJD>71*$$)/5:@EJMQSTTTRPMID@;61,'"  "',16;@DIMPRTTTSQMJE@:5/)$#(-27<@DGIKLLKJGEA>:51,($    $(,15:>AEGJKLLKIGD@<72-(#"&+/37;>ACEEEEDB@=:62.+'#  #'+.26:=@BDEEEECA>;73/+&" $)-048;=?AABAA?=;852.*'#  #'*.258;=?AABAA?=;840-)$  #'+/258;=?@AA@?><963/,($    $(,/369<>?@AA@?=;852/+'# #&*.258;>@BCCCBA?<962.*%!  !%*.269;852.*&# #'+/37;>ADFGHHGFDA=951,'#  #',159=ADFGHHGFDA>;73/+'#  !%).37<@DHKMOOONLJFB>94.)$  $).49>BFJLNOOOMKHD@<73.)%!  $).39>CHMQTWXYXWTQMHB<60+%    %+0693.)$  #)/5;AHNTY]`cddc`]XSMF@92,&    &,29@FMSX]`cddc`]YTNHA;5/)#  $*07>FMT[agknpqpnje_YQJB:3,&    &,3:BJQY_ejnpqpnkga[TMF>70*$  %+2:BKS\dkrw{~~|xsme]ULC;3,%  %,3;CLU]emsx|~~{wrkd\SKB:2+%   &-5>GQZdmv}{rj`VMC:2+$  $+2:CMV`jr{}vmdZQG>5-&   !(08BLWalwvlaWLB91*#  #*19BLWalvwlaWLB80(!  "*25.'"  "'.5>HS^jw}pcVJ?5,$  %-7BN[iw¼tg[OE<4-'"  "'-4<:8641/,*(&%$##$%&(*,/1468:<>@BCFHKOTZbjtƷueVH<1'  &0:GTcr˿xoga\XURPNMKJHFDB?<9741/-,,,,-/1479DLU^jvvj^ULD>941.+)'%#!   "$'*-27>ENXcp~̼~pcXNE>72-*'$"    #',17?GQ]iwĴwi]QG?71,'#   !&+18AKUao}ɺ}oaUKA81+&!  !&+2:DNYft˽tfYND:2+&!  !&-4=FQ]jwȽwj]QF=4-&!  !'.6?IT`ly¼¸yl`TI?6.'!  "(/7AKVamzzmaVKA7/("  #)09BLValwwlaVLB90)#  #*19BKU_is||si_UKB91*#  $*19AIR[dlsy|yusqppqsuy|ysld[RIA91*$  $*07?FNU\chmqsttsqnkhfcaaaacfhknqsttsqmhc\UNF?70*$  #(.5;BHNTY]`bccb`^[YVTSRRSTVY[^`bccb`]YTNHB;5.(#  #)/6HT`mzżzm`TH>5-&    %,3CIPXbmyĴymbXPIC>:7420.,+(&$!  "%),/2468:;=@BFJPV^gq}ŵ}qg^VPJFB@=;:8642/,)%"  !%*.269=;:8641/-*('%$$$$%'(*-/1468:;=>@ACFIMQW^gp{´scUG;0'  '1952/-+)(&%#!!#%&()+-/259>CJS\gsõtdVH<1'  '0;GTcr{maVLD=72.+(%#"  "#%(+.27=DLVam{rcTG;0'  &/:ER`oĹtg[PF>71,'$! !$',17>FP[gtźo`RE:/&  %.8CP]kzĺzm`TJ@81+&" "&+18@JT`mzƽzk]PC8.%  $,6@LYftÿqeYMC:2+&!  !&+2:CMYeqtfYL@6,$  "*3=HT`mzth\QF=4,&!  !&,4=FQ\htzm`TH=3*"  !(0:DOZfr}uj^SI?6.'!  !'.6?IS^ju}rfZOD:0(!   &.6@IT^is}}tj_UJA80)"  ")08AJU_jt}}si^TI@6.&   $+3;DNWajrz~xpg^TKB91*#  #*19BKT^gpx~zrjaWND;3+$  #)08@HPX`hnsxz{{yupjc[SJB:2+$  $+2:BJS[cjpuy{{zxsnh`XPH@80)#  "(.5;CJQX^chkmmmjgb]VOH@92+%  %+29@HOV]bgjmmmkhc^XQJC;5.("  !',28>DJPUY]_`a_]ZVQKD>71+%  %+17>DKQVZ]_a`_]YUPJD>82,'!  "&+06;@EIMQSUUUTQNJE@;5/)$  $)/5;@EJNQTUUUSQMIE@;60+&"  #'+049=ADGIKLLKIGD@<72-(#  #(-27<@DGIKLLKIGDA=940+'#  !%)-048;>@BDDDDB@>;73/*&"  "&*/37;>@BDDDDB@>;840-)%!  !$(+/258:<>????=;9630,($    $(,0369;=????><:852/+($! !%),/258:;<===<:8630-)&"  "&)-0368:<===<;:852/,)%! #'+.258:<=>>>=<:852/,($!  !$(,/258:<=>>>=<:852.+'#!%)-159<>@ABBA@><963/,($!  !$(,/369<>@ABBA@><951-)%!"',059=ADFHHHGFDA>:62.*&"  "&*.26:>ADFGHHHFDA=950,'"#(.39>CGKNPQQPNLIEA<83.)%    %).3893.(##)/6FMSY^beggfda\WQKD>70*%  %*07>DKQW\adfggeb^YSMF>70)#)08@HPX_flpsuusplf`YRJB:3,&    &,3:BJRY`flpsuusplf_XPH@80)/7@IR[dltz}xqjbYPG>6.'!  !'.6>GPYbjqx}ztld[RI@7/5>HR\gqz}tkaWMC:1)"  ")1:CMWakt}zqg\RH>5;EP[gr}ti^RH>4,$  $,4>HR^it}rg[PE;ALXdq~}qeXMA7.&  &.7AMXeq}~qdXLAFS`m{yk^QE:1(    (1:EQ^ky{m`SFKXfuŽqcVI=3*"  "*3=IVcqufXKP]l{ǽwhYL@5+#  #+5@LYhw{l]PSaqŸ{k\NB6,$  $,6BN\k{ɽqaSUdtʽ~n^PC7-$  $-7CP^n~´tdUWfv̿o`QD8.%  %.8DQ`oŷvfWWfv̿o`QD8.%  %.8DQ`oŷvfWUdtʽ~n^PC7-$  $-7CP^n~´tdUSaqŸ{k\NB6,$  $,6BN\k{ɽqaSP]l{ǽwhYL@5+#  #+5@LYhw{l]PKXfuŽqcVI=3*"  "*3=IVcqufXKFS`m{yk^QE:1(    (1:EQ^ky{m`SFALXdq~}qeXMA7.&  &.7AMXeq}~qdXLA;EP[gr}ti^RH>4,$  $,4>HR^it}rg[PE;5>HR\gqz}tkaWMC:1)"  ")1:CMWakt}zqg\RH>5/7@IR[dltz}xqjbYPG>6.'!  !'.6>GPYbjqx}ztld[RI@7/)08@HPX_flpsuusplf`YRJB:3,&    &,3:BJRY`flpsuusplf_XPH@80)#)07>FMSY^beggfda\WQKD>70*%  %*07>DKQW\adfggeb^YSMF>70)##)/6CGKNPQQPNLIEA<83.)%    %).3893.(#"',059=ADFHHHGFDA>:62.*&"  "&*.26:>ADFGHHHFDA=950,'"!%)-159<>@ABBA@><963/,($!  !$(,/369<>@ABBA@><951-)%!#'+.258:<=>>>=<:852/,($!  !$(,/258:<=>>>=<:852.+'# !%),/258:;<===<:8630-)&"  "&)-0368:<===<;:852/,)%! !$(+/258:<>????=;9630,($    $(,0369;=????><:852/+($!  !%)-048;>@BDDDDB@>;73/*&"  "&*/37;>@BDDDDB@>;840-)%!  #'+049=ADGIKLLKIGD@<72-(#  #(-27<@DGIKLLKIGDA=940+'#  "&+06;@EIMQSUUUTQNJE@;5/)$  $)/5;@EJNQTUUUSQMIE@;60+&"  !',28>DJPUY]_`a_]ZVQKD>71+%  %+17>DKQVZ]_a`_]YUPJD>82,'!  "(.5;CJQX^chkmmmjgb]VOH@92+%  %+29@HOV]bgjmmmkhc^XQJC;5.("  #)08@HPX`hnsxz{{yupjc[SJB:2+$  $+2:BJS[cjpuy{{zxsnh`XPH@80)#  $+3;DNWajrz~xpg^TKB91*#  #*19BKT^gpx~zrjaWND;3+$   &.6@IT^is}}tj_UJA80)"  ")08AJU_jt}}si^TI@6.&   !(0:DOZfr}uj^SI?6.'!  !'.6?IS^ju}rfZOD:0(!  "*3=HT`mzth\QF=4,&!  !&,4=FQ\htzm`TH=3*"  $,6@LYftÿqeYMC:2+&!  !&+2:CMYeqtfYL@6,$  %.8CP]kzĺzm`TJ@81+&" "&+18@JT`mzƽzk]PC8.%  &/:ER`oĹtg[PF>71,'$! !$',17>FP[gtźo`RE:/&  '0;GTcr{maVLD=72.+(%#"  "#%(+.27=DLVam{rcTG;0'  '1952/-+)(&%#!!#%&()+-/259>CJS\gsõtdVH<1'  '1=;:8641/-*('%$$$$%'(*-/1468:;=>@ACFIMQW^gp{´scUG;0'  &/9ESapǻ~tkd^YURONLKJIGFDB?=:7420.----.0247:=?BDFGIJKLNORUY^dkt~˾paSE9/&  $-7CO]l|·woid`][ZYXWWVUSQOLIFC@=;977779;=@CFILOQSUVWWXYZ[]`diowķ|l]OC7-$  "+4?KYgvĻysnjhfeeeeeeedba^[XTQMJGECBBCEGJMQTX[^abdeeeeeeefhjnsyĺvgYK?4+"   (1;GS`n|{vspooopqrstttsqolhd`\XURPOOPRUX\`dhloqstttsrqpooopsv{Ŀ|n`SG;1(   %-7AMYfs|ywvvxy|~}yuplhda^]]^adhlpuy}~|yxvvwy|sfYMA7-%  ")2;FQ]iu~|{{|~}xtpnllnptx}~|{{|~ui]QF;2)"  %-5?IT^is}~|{|~~||~~|{|~}si^TI?5-%  !(/8AJT]fow}~|zyyz}}zyyz|~}wof]TJA8/(!  #)19AIQZahnswyz{zyxvtsstvx}}xvtsstvxyz{zywsnhaZQIA91)#  $*18?FMTZ_dgjklllkkjklnrv|Ľż|vrnlkjkklllkjgd_ZTMF?81*$  $)/6CIPXbmyĴymbXPIC>:7420.,+(&$!  !"$&(*,/37HT`mzżzm`TH>5-&   !(/7@KVbn{{nbVK@7/(!  ")09BLWbmyymbWLB90)"  #*19BLV`ku~~uk`VLB91*#  $*19BJS]enu||yvtsstvy||une]SJB91*$  $*18@GOW^ekpsvwwvtqnkhfdccdfhknqtvwwvspke^WOG@81*$  #)/6HT`m{Ŀǽ{m`TH>5-&   %+3;EP]jxxj]PE;3+%  $*19BLXesseXLB91*$   $)/6?HS`m|̽|m`SH?6/)$   !%).5@BDEFHJMPU[ajs~´~sja[UPMJHFEDB@><951-)%!  "'-27<@DGJLNOPQRTVX\afnv˾vnfa\XVTRQPONLJGD@<72-'"  #)/5;AGLQTWZ[\]]^^_acfkqxÿĸxqkfca_^^]]\[ZWTQLGA;5/)#  #*07>FMSY^cfhjkkjiiiijlotzƿŻztoljiiiijkkjhfc^YSMF>70*#  ")08@HQY`gmruxyyywvtsqqrsvz»zvsrqqstvwyyyxurmg`YQH@80)"   '/7@IS\enu||zxwwxz~~zxwwxz||une\SI@7/'   %,5>HS]hr|~{zyz{~~~~{zyz{~|rh]SH>5,%  !)1;EP\ht|zxxy{~~yuqonnoquy~~{yxxz|th\PE;1)!  %-6ALXer~yvuttvxz}~zvqmieb`^^`beimqvz~}zxvttuvy~reXLA6-%   (1;FR_m{¾ytpnmmmnpqrsttsqoliea]YVSQPPQSVY]aeiloqsttsrqpnmmmnpty½{m_RF;1(   "*4?KXft¹wqlhfdcccddddcba^\XUQNKHEDCCDEHKNQUX\^abcddddcccdfhlqw¸tfXK?4*"  $-7BO\k{~umgb^[YXWWVVUTSQOMJGDA>;987789;>ADGJMOQSTUVVWWXY[^bgmu~¶{k\OB7-$  %.9ER`oĹ|rib\WSPNLKJIHGEDB?=:7520/.--./0257:=?BDEGHIJKLNPSW\bir|ɼo`RE9.%  &0:FTbrǺzoe]VPKGEB@?><;98641/-+)'&%$$%&')+-/14689;<>?@BEGKPV]eozrbTF:0&  '0;GUcsƺvj`WOID?<975320/-+*(&$"  "$&(*+-/0235795-'!  !'-5>HR]it{pdYMC90'   %-5>HR]gr{|rh^TJ@7/("  "(/7@JT^hr|{rg]RH>5-%  $*2:CLV_hpx~}vof]SJA80)#  #)08AJS]fov}~xph_VLC:2*$  "(/6>FOW^flqvxyywsoiaZRIA91*$  $*19AIRZaioswyyxvqlf^WOF>6/("  !'-3:AHOV\afiklkiea[UNG@81*$  $*18@GNU[aeiklkifa\VOHA:3-'!   &+17=CINSW[]__^\XTOJC=70*$  $*07=CJOTX\^__][WSNIC=71+&   !%*/49>CHKOQSTSRPMID?:4.)$  $).4:?DIMPRSTSQOKHC>94/*%!  "&*.37;?BEGIJJIHEB?;61,'"  "',16;?BEHIJJIGEB?;73.*&"   $'+/269<>@BCCBA?<962.*%!  !%*.269<962/+'$    #'*-1469:<====<:852.+'#  #'+.258:<====<:9641-*'#  !$(+.14689;;;;:9742/,(%!  !%(,/2479:;;;;98641.+($! "&*-0368:;<<<;:8631-*'#    #'*-1368:;<<<;:8630-*&" $(,047:<>?@@?><:751.*'#    #'*.157:<>?@@?><:740,($ !&+/48<@BDFFFEDB?<851-)%!  !%)-15883-(#  #(-38>DINRUXYZYWTQLGA;5/)##)07>ELRX]adefeb_[UPIC<5/)$  $)/570)#(/7?GOW^ejnqssqnje^WPH@92+%  %+29@HPW^ejnqssqnje^WOG?7/(.6?HQZckrx}{voh`WNF=5-&    &-5=FNW`hov{}xrkcZQH?6.4=GQ[fox{ri_UKB90)"  ")09BKU_ir{xof[QG=4:DOZfq|}rg\QF<3+#  #+3ELRX]adefeb_[UPIC<5/)$  $)/570)##)/5;AGLQTWYZYXURNID>83-(#  #(-38>DINRUXYZYWTQLGA;5/)#"(-28=BFILNOONMJGC?;61,(#  #(,16;?CGJMNOONLIFB=82-("!&+/48<@BDFFFEDB?<851-)%!  !%)-158?@@?><:751.*'#    #'*.157:<>?@@?><:740,($ "&*-0368:;<<<;:8631-*'#    #'*-1368:;<<<;:8630-*&" !$(+.14689;;;;:9742/,(%!  !%(,/2479:;;;;98641.+($!  #'*-1469:<====<:852.+'#  #'+.258:<====<:9641-*'#    $'+/269<>@BCCBA?<962.*%!  !%*.269<962/+'$   "&*.37;?BEGIJJIHEB?;61,'"  "',16;?BEHIJJIGEB?;73.*&"  !%*/49>CHKOQSTSRPMID?:4.)$  $).4:?DIMPRSTSQOKHC>94/*%!   &+17=CINSW[]__^\XTOJC=70*$  $*07=CJOTX\^__][WSNIC=71+&   !'-3:AHOV\afiklkiea[UNG@81*$  $*18@GNU[aeiklkifa\VOHA:3-'!  "(/6>FOW^flqvxyywsoiaZRIA91*$  $*19AIRZaioswyyxvqlf^WOF>6/("  $*2:CLV_hpx~}vof]SJA80)#  #)08AJS]fov}~xph_VLC:2*$  %-5>HR]gr{|rh^TJ@7/("  "(/7@JT^hr|{rg]RH>5-%   '09CMYdp{ti]RH>5-'!  !'-5>HR]it{pdYMC90'   "*2<;98641/-+)'&%$$%&')+-/14689;<>?@BEGKPV]eozrbTF:0&  %.9ER`oĹ|rib\WSPNLKJIHGEDB?=:7520/.--./0257:=?BDEGHIJKLNPSW\bir|ɼo`RE9.%  $-7BO\k{~umgb^[YXWWVVUTSQOMJGDA>;987789;>ADGJMOQSTUVVWWXY[^bgmu~¶{k\OB7-$  "*4?KXft¹wqlhfdcccddddcba^\XUQNKHEDCCDEHKNQUX\^abcddddcccdfhlqw¸tfXK?4*"   (1;FR_m{¾ytpnmmmnpqrsttsqoliea]YVSQPPQSVY]aeiloqsttsrqpnmmmnpty½{m_RF;1(   %-6ALXer~yvuttvxz}~zvqmieb`^^`beimqvz~}zxvttuvy~reXLA6-%  !)1;EP\ht|zxxy{~~yuqonnoquy~~{yxxz|th\PE;1)!  %,5>HS]hr|~{zyz{~~~~{zyz{~|rh]SH>5,%   '/7@IS\enu||zxwwxz~~zxwwxz||une\SI@7/'   ")08@HQY`gmruxyyywvtsqqrsvz»zvsrqqstvwyyyxurmg`YQH@80)"  #*07>FMSY^cfhjkkjiiiijlotzƿŻztoljiiiijkkjhfc^YSMF>70*#  #)/5;AGLQTWZ[\]]^^_acfkqxÿĸxqkfca_^^]]\[ZWTQLGA;5/)#  "'-27<@DGJLNOPQRTVX\afnv˾vnfa\XVTRQPONLJGD@<72-'"  !%)-159<>@BDEFHJMPU[ajs~´~sja[UPMJHFEDB@><951-)%!  "%(,.13579;HT`m{Ŀǽ{m`TH>5-&   !'/7@KVbo|¾ý|obVK@7/'!  ")09BLWbnzznbWLB90)"  #*1:CLVakvvkaVLC:1*#  $*19BKT]fow~~zxvttvxz~~wof]TKB91*$  $*18@HPX_flquwyywvspmjgfeefgjmpsvwyywuqlf_XPH@81*$  #)/6=DJQW\`ceggfdb_]ZXWVVWXZ]_bdfggec`\WQJD=6/)#  #)/6=DJQW\`ceggfdb_]ZXWVVWXZ]_bdfggec`\WQJD=6/)#  $*18@HPX_flquwyywvspmjgfeefgjmpsvwyywuqlf_XPH@81*$  $*19BKT]fow~~zxvttvxz~~wof]TKB91*$  #*1:CLVakvvkaVLC:1*#  ")09BLWbnzznbWLB90)"  !'/7@KVbo|¾ý|obVK@7/'!   &-5>HT`m{Ŀǽ{m`TH>5-&   %+3;EP]jxxj]PE;3+%  $*19BLXesseXLB91*$   $)/6?HS`m|̽|m`SH?6/)$   !%).5@BDEFHJMPU[ajs~´~sja[UPMJHFEDB@><951-)%!  "'-27<@DGJLNOPQRTVX\afnv˾vnfa\XVTRQPONLJGD@<72-'"  #)/5;AGLQTWZ[\]]^^_acfkqxÿĸxqkfca_^^]]\[ZWTQLGA;5/)#  #*07>FMSY^cfhjkkjiiiijlotzƿŻztoljiiiijkkjhfc^YSMF>70*#  ")08@HQY`gmruxyyywvtsqqrsvz»zvsrqqstvwyyyxurmg`YQH@80)"   '/7@IS\enu||zxwwxz~~zxwwxz||une\SI@7/'   %,5>HS]hr|~{zyz{~~~~{zyz{~|rh]SH>5,%  !)1;EP\ht|zxxy{~~yuqonnoquy~~{yxxz|th\PE;1)!  %-6ALXer~yvuttvxz}~zvqmieb`^^`beimqvz~}zxvttuvy~reXLA6-%   (1;FR_m{¾ytpnmmmnpqrsttsqoliea]YVSQPPQSVY]aeiloqsttsrqpnmmmnpty½{m_RF;1(   "*4?KXft¹wqlhfdcccddddcba^\XUQNKHEDCCDEHKNQUX\^abcddddcccdfhlqw¸tfXK?4*"  $-7BO\k{~umgb^[YXWWVVUTSQOMJGDA>;987789;>ADGJMOQSTUVVWWXY[^bgmu~¶{k\OB7-$  %.9ER`oĹ|rib\WSPNLKJIHGEDB?=:7520/.--./0257:=?BDEGHIJKLNPSW\bir|ɼo`RE9.%  &0:FTbrǺzoe]VPKGEB@?><;98641/-+)'&%$$%&')+-/14689;<>?@BEGKPV]eozrbTF:0&  '0;GUcsƺvj`WOID?<975320/-+*(&$"  "$&(*+-/0235795-'!  !'-5>HR]it{pdYMC90'   %-5>HR]gr{|rh^TJ@7/("  "(/7@JT^hr|{rg]RH>5-%  $*2:CLV_hpx~}vof]SJA80)#  #)08AJS]fov}~xph_VLC:2*$  "(/6>FOW^flqvxyywsoiaZRIA91*$  $*19AIRZaioswyyxvqlf^WOF>6/("  !'-3:AHOV\afiklkiea[UNG@81*$  $*18@GNU[aeiklkifa\VOHA:3-'!   &+17=CINSW[]__^\XTOJC=70*$  $*07=CJOTX\^__][WSNIC=71+&   !%*/49>CHKOQSTSRPMID?:4.)$  $).4:?DIMPRSTSQOKHC>94/*%!  "&*.37;?BEGIJJIHEB?;61,'"  "',16;?BEHIJJIGEB?;73.*&"   $'+/269<>@BCCBA?<962.*%!  !%*.269<962/+'$    #'*-1469:<====<:852.+'#  #'+.258:<====<:9641-*'#  !$(+.14689;;;;:9742/,(%!  !%(,/2479:;;;;98641.+($! "&*-0368:;<<<;:8631-*'#    #'*-1368:;<<<;:8630-*&" $(,047:<>?@@?><:751.*'#    #'*.157:<>?@@?><:740,($ !&+/48<@BDFFFEDB?<851-)%!  !%)-15883-(#  #(-38>DINRUXYZYWTQLGA;5/)##)07>ELRX]adefeb_[UPIC<5/)$  $)/570)#(/7?GOW^ejnqssqnje^WPH@92+%  %+29@HPW^ejnqssqnje^WOG?7/(.6?HQZckrx}{voh`WNF=5-&    &-5=FNW`hov{}xrkcZQH?6.4=GQ[fox{ri_UKB90)"  ")09BKU_ir{xof[QG=4:DOZfq|}rg\QF<3+#  #+3ELRX]adefeb_[UPIC<5/)$  $)/570)##)/5;AGLQTWYZYXURNID>83-(#  #(-38>DINRUXYZYWTQLGA;5/)#"(-28=BFILNOONMJGC?;61,(#  #(,16;?CGJMNOONLIFB=82-("!&+/48<@BDFFFEDB?<851-)%!  !%)-158?@@?><:751.*'#    #'*.157:<>?@@?><:740,($ "&*-0368:;<<<;:8631-*'#    #'*-1368:;<<<;:8630-*&" !$(+.14689;;;;:9742/,(%!  !%(,/2479:;;;;98641.+($!  #'*-1469:<====<:852.+'#  #'+.258:<====<:9641-*'#    $'+/269<>@BCCBA?<962.*%!  !%*.269<962/+'$   "&*.37;?BEGIJJIHEB?;61,'"  "',16;?BEHIJJIGEB?;73.*&"  !%*/49>CHKOQSTSRPMID?:4.)$  $).4:?DIMPRSTSQOKHC>94/*%!   &+17=CINSW[]__^\XTOJC=70*$  $*07=CJOTX\^__][WSNIC=71+&   !'-3:AHOV\afiklkiea[UNG@81*$  $*18@GNU[aeiklkifa\VOHA:3-'!  "(/6>FOW^flqvxyywsoiaZRIA91*$  $*19AIRZaioswyyxvqlf^WOF>6/("  $*2:CLV_hpx~}vof]SJA80)#  #)08AJS]fov}~xph_VLC:2*$  %-5>HR]gr{|rh^TJ@7/("  "(/7@JT^hr|{rg]RH>5-%   '09CMYdp{ti]RH>5-'!  !'-5>HR]it{pdYMC90'   "*2<;98641/-+)'&%$$%&')+-/14689;<>?@BEGKPV]eozrbTF:0&  %.9ER`oĹ|rib\WSPNLKJIHGEDB?=:7520/.--./0257:=?BDEGHIJKLNPSW\bir|ɼo`RE9.%  $-7BO\k{~umgb^[YXWWVVUTSQOMJGDA>;987789;>ADGJMOQSTUVVWWXY[^bgmu~¶{k\OB7-$  "*4?KXft¹wqlhfdcccddddcba^\XUQNKHEDCCDEHKNQUX\^abcddddcccdfhlqw¸tfXK?4*"   (1;FR_m{¾ytpnmmmnpqrsttsqoliea]YVSQPPQSVY]aeiloqsttsrqpnmmmnpty½{m_RF;1(   %-6ALXer~yvuttvxz}~zvqmieb`^^`beimqvz~}zxvttuvy~reXLA6-%  !)1;EP\ht|zxxy{~~yuqonnoquy~~{yxxz|th\PE;1)!  %,5>HS]hr|~{zyz{~~~~{zyz{~|rh]SH>5,%   '/7@IS\enu||zxwwxz~~zxwwxz||une\SI@7/'   ")08@HQY`gmruxyyywvtsqqrsvz»zvsrqqstvwyyyxurmg`YQH@80)"  #*07>FMSY^cfhjkkjiiiijlotzƿŻztoljiiiijkkjhfc^YSMF>70*#  #)/5;AGLQTWZ[\]]^^_acfkqxÿĸxqkfca_^^]]\[ZWTQLGA;5/)#  "'-27<@DGJLNOPQRTVX\afnv˾vnfa\XVTRQPONLJGD@<72-'"  !%)-159<>@BDEFHJMPU[ajs~´~sja[UPMJHFEDB@><951-)%!  "%(,.13579;HT`m{Ŀǽ{m`TH>5-&   !'/7@KVbo|¾ý|obVK@7/'!  ")09BLWbnzznbWLB90)"  #*1:CLVakvvkaVLC:1*#  $*19BKT]fow~~zxvttvxz~~wof]TKB91*$  $*18@HPX_flquwyywvspmjgfeefgjmpsvwyywuqlf_XPH@81*$  #)/6=DJQW\`ceggfdb_]ZXWVVWXZ]_bdfggec`\WQJD=6/)#  #)/6HT`mzżzm`TH>5-&    %,3CIPXbmyĴymbXPIC>:7420.,+(&$!  "%),/2468:;=@BFJPV^gq}ŵ}qg^VPJFB@=;:8642/,)%"  !%*.269=;:8641/-*('%$$$$%'(*-/1468:;=>@ACFIMQW^gp{´scUG;0'  '1952/-+)(&%#!!#%&()+-/259>CJS\gsõtdVH<1'  '0;GTcr{maVLD=72.+(%#"  "#%(+.27=DLVam{rcTG;0'  &/:ER`oĹtg[PF>71,'$! !$',17>FP[gtźo`RE:/&  %.8CP]kzĺzm`TJ@81+&" "&+18@JT`mzƽzk]PC8.%  $,6@LYftÿqeYMC:2+&!  !&+2:CMYeqtfYL@6,$  "*3=HT`mzth\QF=4,&!  !&,4=FQ\htzm`TH=3*"  !(0:DOZfr}uj^SI?6.'!  !'.6?IS^ju}rfZOD:0(!   &.6@IT^is}}tj_UJA80)"  ")08AJU_jt}}si^TI@6.&   $+3;DNWajrz~xpg^TKB91*#  #*19BKT^gpx~zrjaWND;3+$  #)08@HPX`hnsxz{{yupjc[SJB:2+$  $+2:BJS[cjpuy{{zxsnh`XPH@80)#  "(.5;CJQX^chkmmmjgb]VOH@92+%  %+29@HOV]bgjmmmkhc^XQJC;5.("  !',28>DJPUY]_`a_]ZVQKD>71+%  %+17>DKQVZ]_a`_]YUPJD>82,'!  "&+06;@EIMQSUUUTQNJE@;5/)$  $)/5;@EJNQTUUUSQMIE@;60+&"  #'+049=ADGIKLLKIGD@<72-(#  #(-27<@DGIKLLKIGDA=940+'#  !%)-048;>@BDDDDB@>;73/*&"  "&*/37;>@BDDDDB@>;840-)%!  !$(+/258:<>????=;9630,($    $(,0369;=????><:852/+($! !%),/258:;<===<:8630-)&"  "&)-0368:<===<;:852/,)%! #'+.258:<=>>>=<:852/,($!  !$(,/258:<=>>>=<:852.+'#!%)-159<>@ABBA@><963/,($!  !$(,/369<>@ABBA@><951-)%!"',059=ADFHHHGFDA>:62.*&"  "&*.26:>ADFGHHHFDA=950,'"#(.39>CGKNPQQPNLIEA<83.)%    %).3893.(##)/6FMSY^beggfda\WQKD>70*%  %*07>DKQW\adfggeb^YSMF>70)#)08@HPX_flpsuusplf`YRJB:3,&    &,3:BJRY`flpsuusplf_XPH@80)/7@IR[dltz}xqjbYPG>6.'!  !'.6>GPYbjqx}ztld[RI@7/5>HR\gqz}tkaWMC:1)"  ")1:CMWakt}zqg\RH>5;EP[gr}ti^RH>4,$  $,4>HR^it}rg[PE;ALXdq~}qeXMA7.&  &.7AMXeq}~qdXLAFS`m{yk^QE:1(    (1:EQ^ky{m`SFKXfuŽqcVI=3*"  "*3=IVcqufXKP]l{ǽwhYL@5+#  #+5@LYhw{l]PSaqŸ{k\NB6,$  $,6BN\k{ɽqaSUdtʽ~n^PC7-$  $-7CP^n~´tdUWfv̿o`QD8.%  %.8DQ`oŷvfWWfv̿o`QD8.%  %.8DQ`oŷvfWUdtʽ~n^PC7-$  $-7CP^n~´tdUSaqŸ{k\NB6,$  $,6BN\k{ɽqaSP]l{ǽwhYL@5+#  #+5@LYhw{l]PKXfuŽqcVI=3*"  "*3=IVcqufXKFS`m{yk^QE:1(    (1:EQ^ky{m`SFALXdq~}qeXMA7.&  &.7AMXeq}~qdXLA;EP[gr}ti^RH>4,$  $,4>HR^it}rg[PE;5>HR\gqz}tkaWMC:1)"  ")1:CMWakt}zqg\RH>5/7@IR[dltz}xqjbYPG>6.'!  !'.6>GPYbjqx}ztld[RI@7/)08@HPX_flpsuusplf`YRJB:3,&    &,3:BJRY`flpsuusplf_XPH@80)#)07>FMSY^beggfda\WQKD>70*%  %*07>DKQW\adfggeb^YSMF>70)##)/6CGKNPQQPNLIEA<83.)%    %).3893.(#"',059=ADFHHHGFDA>:62.*&"  "&*.26:>ADFGHHHFDA=950,'"!%)-159<>@ABBA@><963/,($!  !$(,/369<>@ABBA@><951-)%!#'+.258:<=>>>=<:852/,($!  !$(,/258:<=>>>=<:852.+'# !%),/258:;<===<:8630-)&"  "&)-0368:<===<;:852/,)%! !$(+/258:<>????=;9630,($    $(,0369;=????><:852/+($!  !%)-048;>@BDDDDB@>;73/*&"  "&*/37;>@BDDDDB@>;840-)%!  #'+049=ADGIKLLKIGD@<72-(#  #(-27<@DGIKLLKIGDA=940+'#  "&+06;@EIMQSUUUTQNJE@;5/)$  $)/5;@EJNQTUUUSQMIE@;60+&"  !',28>DJPUY]_`a_]ZVQKD>71+%  %+17>DKQVZ]_a`_]YUPJD>82,'!  "(.5;CJQX^chkmmmjgb]VOH@92+%  %+29@HOV]bgjmmmkhc^XQJC;5.("  #)08@HPX`hnsxz{{yupjc[SJB:2+$  $+2:BJS[cjpuy{{zxsnh`XPH@80)#  $+3;DNWajrz~xpg^TKB91*#  #*19BKT^gpx~zrjaWND;3+$   &.6@IT^is}}tj_UJA80)"  ")08AJU_jt}}si^TI@6.&   !(0:DOZfr}uj^SI?6.'!  !'.6?IS^ju}rfZOD:0(!  "*3=HT`mzth\QF=4,&!  !&,4=FQ\htzm`TH=3*"  $,6@LYftÿqeYMC:2+&!  !&+2:CMYeqtfYL@6,$  %.8CP]kzĺzm`TJ@81+&" "&+18@JT`mzƽzk]PC8.%  &/:ER`oĹtg[PF>71,'$! !$',17>FP[gtźo`RE:/&  '0;GTcr{maVLD=72.+(%#"  "#%(+.27=DLVam{rcTG;0'  '1952/-+)(&%#!!#%&()+-/259>CJS\gsõtdVH<1'  '1=;:8641/-*('%$$$$%'(*-/1468:;=>@ACFIMQW^gp{´scUG;0'  &/9ESapǻ~tkd^YURONLKJIGFDB?=:7420.----.0247:=?BDFGIJKLNORUY^dkt~˾paSE9/&  $-7CO]l|·woid`][ZYXWWVUSQOLIFC@=;977779;=@CFILOQSUVWWXYZ[]`diowķ|l]OC7-$  "+4?KYgvĻysnjhfeeeeeeedba^[XTQMJGECBBCEGJMQTX[^abdeeeeeeefhjnsyĺvgYK?4+"   (1;GS`n|{vspooopqrstttsqolhd`\XURPOOPRUX\`dhloqstttsrqpooopsv{Ŀ|n`SG;1(   %-7AMYfs|ywvvxy|~}yuplhda^]]^adhlpuy}~|yxvvwy|sfYMA7-%  ")2;FQ]iu~|{{|~}xtpnllnptx}~|{{|~ui]QF;2)"  %-5?IT^is}~|{|~~||~~|{|~}si^TI?5-%  !(/8AJT]fow}~|zyyz}}zyyz|~}wof]TJA8/(!  #)19AIQZahnswyz{zyxvtsstvx}}xvtsstvxyz{zywsnhaZQIA91)#  $*18?FMTZ_dgjklllkkjklnrv|Ľż|vrnlkjkklllkjgd_ZTMF?81*$  $)/6CIPXbmyĴymbXPIC>:7420.,+(&$!  !"$&(*,/37HT`mzżzm`TH>5-&   !(/7@KVbn{{nbVK@7/(!  ")09BLWbmyymbWLB90)"  #*19BLV`ku~~uk`VLB91*#  $*19BJS]enu||yvtsstvy||une]SJB91*$  $*18@GOW^ekpsvwwvtqnkhfdccdfhknqtvwwvspke^WOG@81*$  #)/6ENXcp~̼~pcXNE>72-*'$"   !#%')+.149>DLU^jvvj^ULD>941.+)'%#!  "$'),.02469<@EKR[do|ŵ|od[RKE@<96420.,)'$"  #&*-03579;=?BEHMRYajtƷtjaYRMHEB?=;97530-*&#  !&*/37:=@CEFHJLNQUZ`goyķyog`ZUQNLJHFEC@=:73/*&!  #(.38=BFJMOQSTUVXZ]afls||slfa]ZXVUTSQOMJFB=83.(#  $*07=CINSWZ]_`aabcdfilqw~ƻ~wqlifdcbaa`_]ZWSNIC=70*$  $+29@HOU\afilnnoonnnoprvzƾzvrponnnoonnlifa\UOH@92+$  #*2:BJS[cjpuy|}~}|{yxwwxz}¼}zxwwxy{|}~}|yupjc[SJB:2*#  !(09BKU_hqy~}~~}~yqh_UKB90(!  &.6@JU`ku~{yy{~uk`UJ@6.&  "*3=GS_kw{vqnkjjknqv{wk_SG=3*"  %.8BN[hu}{z{|}|xsojfb_\[[\_bfjosx|}|{z{}uh[NB8.%  !)2<:8641/,*(&%$##$%&(*,/1468:<>@BCFHKOTZbjtƷueVH<1'   (2=IWfw{oe\TMGC?<:75420.,*(%#!  !#%(*,.02457:5.'"  "'.5>HS^jw}pcVJ?5,$  "*2GQZdmv}{rj`VMC:2+$  $+2:CMV`jr{}vmdZQG>5-&   %+2:BKS\dkrw{~~|xsme]ULC;3,%  %,3;CLU]emsx|~~{wrkd\SKB:2+%  $*07>FMT[agknpqpnje_YQJB:3,&    &,3:BJQY_ejnpqpnkga[TMF>70*$  #)/5;AHNTY]`cddc`]XSMF@92,&    &,29@FMSX]`cddc`]YTNHA;5/)#  $).39>CHMQTWXYXWTQMHB<60+%    %+0693.)$  !%).37<@DHKMOOONLJFB>94.)$  $).49>BFJLNOOOMKHD@<73.)%!  #'+/37;>ADFGHHGFDA=951,'#  #',159=ADFGHHGFDA>;73/+'# #&*.258;>@BCCCBA?<962.*%!  !%*.269;852.*&# #'+/258;=?@AA@?><963/,($    $(,/369<>?@AA@?=;852/+'#  $)-048;=?AABAA?=;852.*'#  #'*.258;=?AABAA?=;840-)$ "&+/37;>ACEEEEDB@=:62.+'#  #'+.26:=@BDEEEECA>;73/+&"#(-27<@DGIKLLKJGEA>:51,($    $(,15:>AEGJKLLKIGD@<72-(#$)/5:@EJMQSTTTRPMID@;61,'"  "',16;@DIMPRTTTSQMJE@:5/)$$*17>DJPUY\^__][WSNIC=71,&!  !&,17=CINSW[]__^\YUPJD>71*$$*19@GOV\aeijkjhe`[UNHA:3-'!  !'-3:AHNU[`ehjkjiea\VOG@91*$*19AJRZbiosvxxwtpjd]UME=5.("  "(.5=EMU]djptwxxvsoibZRJA91*08AJT]fov}{ume\SJA80)#  #)08AJS\emu{}vof]TJA806?IT^is|xndZOE<3+$  $+3DJPUY\^__][WSNIC=71,&!  !&,17=CINSW[]__^\YUPJD>71*$$)/5:@EJMQSTTTRPMID@;61,'"  "',16;@DIMPRTTTSQMJE@:5/)$#(-27<@DGIKLLKJGEA>:51,($    $(,15:>AEGJKLLKIGD@<72-(#"&+/37;>ACEEEEDB@=:62.+'#  #'+.26:=@BDEEEECA>;73/+&" $)-048;=?AABAA?=;852.*'#  #'*.258;=?AABAA?=;840-)$  #'+/258;=?@AA@?><963/,($    $(,/369<>?@AA@?=;852/+'# #&*.258;>@BCCCBA?<962.*%!  !%*.269;852.*&# #'+/37;>ADFGHHGFDA=951,'#  #',159=ADFGHHGFDA>;73/+'#  !%).37<@DHKMOOONLJFB>94.)$  $).49>BFJLNOOOMKHD@<73.)%!  $).39>CHMQTWXYXWTQMHB<60+%    %+0693.)$  #)/5;AHNTY]`cddc`]XSMF@92,&    &,29@FMSX]`cddc`]YTNHA;5/)#  $*07>FMT[agknpqpnje_YQJB:3,&    &,3:BJQY_ejnpqpnkga[TMF>70*$  %+2:BKS\dkrw{~~|xsme]ULC;3,%  %,3;CLU]emsx|~~{wrkd\SKB:2+%   &-5>GQZdmv}{rj`VMC:2+$  $+2:CMV`jr{}vmdZQG>5-&   !(08BLWalwvlaWLB91*#  #*19BLWalvwlaWLB80(!  "*25.'"  "'.5>HS^jw}pcVJ?5,$  %-7BN[iw¼tg[OE<4-'"  "'-4<:8641/,*(&%$##$%&(*,/1468:<>@BCFHKOTZbjtƷueVH<1'  &0:GTcr˿xoga\XURPNMKJHFDB?<9741/-,,,,-/1479DLU^jvvj^ULD>941.+)'%#!   "$'*-27>ENXcp~̼~pcXNE>72-*'$"    #',17?GQ]iwĴwi]QG?71,'#   !&+18AKUao}ɺ}oaUKA81+&!  !&+2:DNYft˽tfYND:2+&!  !&-4=FQ]jwȽwj]QF=4-&!  !'.6?IT`ly¼¸yl`TI?6.'!  "(/7AKVamzzmaVKA7/("  #)09BLValwwlaVLB90)#  #*19BKU_is||si_UKB91*#  $*19AIR[dlsy|yusqppqsuy|ysld[RIA91*$  $*07?FNU\chmqsttsqnkhfcaaaacfhknqsttsqmhc\UNF?70*$  #(.5;BHNTY]`bccb`^[YVTSRRSTVY[^`bccb`]YTNHB;5.(#  "(.4:@FLQVY\^__^\ZXUSQPOOPQSUXZ\^__^\YVQLF@:4.("  #)/6=ELSZ`eimoppnmjgda_]]]]_adgjmnppomie`ZSLE=6/)#  $*18@HPYaipv{~~{wtqnlkklnqtw{~~{vpiaYPH@81*$  $*19AJS]fpx~{zz{~xpf]SJA91*$  #*19AKU_juuj_UKA91*#  #)08AKU`lxxl`UKA80)#  "(/7@IT`lxüxl`TI@7/("  "(.5>HR^jwþùwj^RH>5.("  "'-4@BEHLQW^foyǹyof^WQLHEB@><9741.+'#   "'+048EKPUY]`bcdefgiknrw}ɿ}wrnkigfedcb`]YUPKE>81+%   %,3:BIQX^dhloqrssssstvx||xvtsssssrqolhd^XQIB:3,%  $+3;CLU]emsx|~}}~þý~}}~|xsme]ULC;3+$  ")1:CMWakt||tkaWMC:1)"  '/8ALWbmx}ywuuwy}xmbWLA8/'  #+4>IUamy}wrnjhffhjnrw}ymaUI>4+#  &/9DP]jx{vqlgc_\YXXY\_cglqv{xj]PD9/&  !*3>JWdsĽ}{yxxxxxxxwvtqnjea]XTQNLKKLNQTX]aejnqtvwxxxxxxxy{}sdWJ>3*!  $-7BO\k{ż}xtqomlkkjihfca^ZVRNJGDA@??@ADGJNRVZ^acfhijkklmoqtx}¶{k\OB7-$  &/:FSaq¶ysmieca_^\[YWUROLHEA>;86544568;>AEHLORUWY[\^_aceimsy̿qaSF:/&  '1JYhxƹyof_YTOLIFDB@>;9641.,)'%$#""#$%'),.1469;>@BDFILOTY_foy˼xhYJ>2)   !)3?KZizŷti`XQKFB?<:7531/,*(%#!!#%(*,/1357::631.,*(&$"  "$&(*,.136:>CIQYcn{̽ziZL?3)!  !)3>KYhxʼth\RJB<72.+)&$"  "$&)+.273)!  !)2=IWfuµ{maVLC;50+'$" "$'+05;CLVam{õufWI=2)!   (1;GTbqøsfZOE<5/)%! !%)/56/)$  $)/6>GR^jwļ{l^QE9/'  %.7BMZgtznaUJ@70)#  #)07@JUanztgZMB7.%  $,5>IUamz{ocXMC91*$  $*19CMXco{zmaUI>5,$  #*2;EP[fq|zodYOD;3+%  %+3;DOYdoz|qf[PE;2*#  ")08AKU_ir{vmcYOE<4,&    &,4FOXaipw}}wpi`WNE=5-&    &-5=ENW`ipw}}wpiaXOF>6.'!  !'-4;CJRY`glqtvvurnic\TLD<5-'!  !'-5:73/*&"  "&*/37:>ACEFGFFDC@=:62.*&! "'+048:50,'#  #',05:>CGJMOQQQPNKHC?:4/*%  %+17=CHMRUXYZYXURNJE@:5/*%    %*/5:@EJNRUXYZYXURMHC=71+%  &,29@GMSY]`cddc`]YTNHB<5/*$  $*/570*$  $*07>ELSZ`fjmopomje_YRJB:3,%+2;CLU]elsx{}}|yupibZRIA92+$  $+29AIRZbipuy|}}{xsle]ULC;2+1:CLV`jszzsjaWNE<4,%  %,470*$  $*07>ELSZ`fjmopomje_YRJB:3,% &,29@GMSY]`cddc`]YTNHB<5/*$  $*/5:50,'#  #',05:>CGJMOQQQPNKHC?:4/*% #(-27;?CFHJKKKIGEB?;72.*&!  !&*.27;?BEGIKKKJHFC?;72-(#"'+048:73/*&"  "&*/37:>ACEFGFFDC@=:62.*&! !%).26:=ACFGHIHGFC@=951,(#  #(,159=@CFGHIHGFCA=:62.)%! "&*/38<@DGJLMNMLJHEA=83.)$    $).38=AEHJLMNMLJGD@<83/*&"  #(-27FOXaipw}}wpi`WNE=5-&    &-5=ENW`ipw}}wpiaXOF>6.'!  ")08AKU_ir{vmcYOE<4,&    &,4IUamz{ocXMC91*$  $*19CMXco{zmaUI>5,$  %.7BMZgtznaUJ@70)#  #)07@JUanztgZMB7.%  '/9EQ^l{wj^RG>6/)$  $)/6>GR^jwļ{l^QE9/'   (1;GTbqøsfZOE<5/)%! !%)/5KYhxʼth\RJB<72.+)&$"  "$&)+.273)!  !)3?LZiz´{ncYQIC>:631.,*(&$"  "$&(*,.136:>CIQYcn{̽ziZL?3)!  !)3?KZizŷti`XQKFB?<:7531/,*(%#!!#%(*,/1357:JYhxƹyof_YTOLIFDB@>;9641.,)'%$#""#$%'),.1469;>@BDFILOTY_foy˼xhYJ>2)   '1;86544568;>AEHLORUWY[\^_aceimsy̿qaSF:/&  $-7BO\k{ż}xtqomlkkjihfca^ZVRNJGDA@??@ADGJNRVZ^acfhijkklmoqtx}¶{k\OB7-$  !*3>JWdsĽ}{yxxxxxxxwvtqnjea]XTQNLKKLNQTX]aejnqtvwxxxxxxxy{}sdWJ>3*!  &/9DP]jx{vqlgc_\YXXY\_cglqv{xj]PD9/&  #+4>IUamy}wrnjhffhjnrw}ymaUI>4+#  '/8ALWbmx}ywuuwy}xmbWLA8/'  ")1:CMWakt||tkaWMC:1)"  $+3;CLU]emsx|~}}~þý~}}~|xsme]ULC;3+$  %,3:BIQX^dhloqrssssstvx||xvtsssssrqolhd^XQIB:3,%   %+18>EKPUY]`bcdefgiknrw}ɿ}wrnkigfedcb`]YUPKE>81+%   $)/4:?DHLORTVWYZ\_bfkryĸyrkfb_\ZYWVTROLHD?:4/)$  "'+048@BEHLQW^foyǹyof^WQLHEB@><9741.+'#    #%(+-/1469HR^jwþùwj^RH>5.("  "(/7@IT`lxüxl`TI@7/("  #)08AKU`lxxl`UKA80)#  #*19AKU_juuj_UKA91*#  $*19AJS]fpx~{zz{~xpf]SJA91*$  $*18@HPYaipv{~~{wtqnlkklnqtw{~~{vpiaYPH@81*$  #)/6=ELSZ`eimoppnmjgda_]]]]_adgjmnppomie`ZSLE=6/)#  "(.4:@FLQVY\^__^\ZXUSQPOOPQSUXZ\^__^\YVQLF@:4.("  "',28>CINRUXZZZYXUSQOMKKKKMOQSUXYZZZXURNIC>82,'"  #)/5FPZeröreZPF>60*%!  !$(,16=ENWbn{{nbWNE=61,($!  !#%(+/38>ELU_jvɻvj_ULE>83/+(%#!  !$&(+-036;@ELT]gr~´~rg]TLE@;630-+(&$!  !$'*,/1469ACFIMQV\cluɽulc\VQMIFCA><9630,($!  #(-16:>AEGJLOQTW[_ekr{ɾ{rke_[WTQOLJGEA>:61-(#   %+06;AFJNRUWY[]_behmryľǽyrmheb_][YWURNJFA;60+%    &,39@GMSX\`cfhijlmoruyúyuromljihfc`\XSMG@93,&    &-4KYhy{smgb^[XVSQNKIEB?;852/-+*))*+-/258;?BEIKNQSVX[^bgms{̽yhYK>2)   !*4@M[k|ule^YTQMJGEB?=:741.+(&$#"!!"#$&(+.147:=?BEGJMQTY^elu|k[M@4*!  "+5AN]m~̾zoe]VPKGC@=:752/-*(%#  #%(*-/257:=@CGKPV]eozó~m]NA5+"  "+5AN]m~ɺth^UNHB>:631.+)'$"  "$')+.136:>BHNU^htò~m]NA5+"  "+5AN\l|ôymaWNF@:51.+(&#!!#&(+.15:@FNWamy|l\NA5+"  "*4@LZjzȻreZOG?83.*'$! !$'*.38?GOZerɻzjZL@4*"  !*3>JXfvʾwj]RH?81,'#   #',18?HR]jwvfXJ>3*!  !)25-&    &-5>GR\hs~wl`UJ?6-%  %,4ELSZ`ejmoponjfa[TME>6/)#  #)/6>EMT[afjnopomje`ZSLE>70*$   %+17=CIOUZ^aceedb^ZUOIB<5.("  "(.5BGKNQSTUTSQNJFA<71,&!  !&,1794/*%!  $).27<@DGKMOPPPNLJFB>94/*%!  !%*/49>BFJLNPPPOMKGD@<72.)$   $).27;@CGJLMNNMLJGD@<73.)%    %).37<@DGJLMNNMLJGC@;72.)$  %*/38=AEHKMNOONLJGC@;72-)$    $)-27;@CGJLNOONMKHEA=83/*% !&+05;?DHLNQRRRQOLIEA=83.)%    %).38=AEILOQRRRQNLHD?;50+&!!',28=CHMQTVXXXWTQNJE@;60+&!  !&+06;@EJNQTWXXXVTQMHC=82,'!!'-3:@GMRW[^```_]YUQKF@:4/)$  $)/4:@FKQUY]_```^[WRMG@:3-'!!'.56.(!  !(.6>FOX`hpv|}xqjaXOF=4,2;EOYdnwyqg]SJ@80("  "(08@JS]gqywndYOE;29CNYdp{yodYND:1)"  ")1:DNYdoy{pdYNC9?JVco|vj^RG=3*#  #*3=GR^jv|ocVJ?FR_lz~qdWK?5,$  $,5?KWdq~zl_RFKYguùwi[NB7-%  %-7BN[iw¹ugYKQ_n}ĸ}n_QE9/&  &/9EQ_n}Ź}n_QUdtrcTG;0'  '0;GTcrõtdUYhyȹvfVI<1(    (12)    )2>KYiyij~m]]m~ϿyiYK>2)    )2>KYiyij~m][k|̽xhXJ=2(    (2=JXhx|k[YhyȹvfVI<1(    (16.(!  !(.6>FOX`hpv|}xqjaXOF=4,&-5=EMU]djosvwvtqmgaZSKC<5.'"  "'.594/*%!  !%*/49>BFJLNPPPOMKGD@<72.)$  !%*/49>BGKNQSTUTSQNJFA<71,&!  !&,1794/*%!  "',27=BHLQUXZ[\[YWSOJE?93-'"  "'-39?EJOSWY[\[ZXUQLHB=72,'"   %+17=CIOUZ^aceedb^ZUOIB<5.("  "(.5ELSZ`ejmoponjfa[TME>6/)#  #)/6>EMT[afjnopomje`ZSLE>70*$  $*18@HPX`gnsx{||{xtng`XPG?7/("  "(/7?GPX`gntx{||{xsng`XPH@81*$  $+2:CLU^gpw~|umd[QH?7/("  "(/7?HQ[dmu|~wpg^ULC:2+$  %,45-&    &-5>GR\hs~wl`UJ?6-%  &/8BMYfssg[PE<3,&    &,3JXfvʾwj]RH?81,'#   #',18?HR]jwvfXJ>3*!  "*4@LZjzȻreZOG?83.*'$! !$'*.38?GOZerɻzjZL@4*"  "+5AN\l|ôymaWNF@:51.+(&#!!#&(+.15:@FNWamy|l\NA5+"  "+5AN]m~ɺth^UNHB>:631.+)'$"  "$')+.136:>BHNU^htò~m]NA5+"  "+5AN]m~̾zoe]VPKGC@=:752/-*(%#  #%(*-/257:=@CGKPV]eozó~m]NA5+"  !*4@M[k|ule^YTQMJGEB?=:741.+(&$#"!!"#$&(+.147:=?BEGJMQTY^elu|k[M@4*!   )2>KYhy{smgb^[XVSQNKIEB?;852/-+*))*+-/258;?BEIKNQSVX[^bgms{̽yhYK>2)   '0;HUdtɽztplifdb`^[YVSOKGD@<9643223469<@DGKOSVY[^`bdfilptzŶtdUH;0'  %.8DQ_n~ù{xvtrqonljgda]YUQLHEA?=<<=?AEHLQUY]adgjlnoqrtvx{Ȼ~n_QD8.%  "+5@LYgvļ~~}|{ywtqmhd_ZUQNKIHHIKNQUZ_dhmqtwy{|}~~ƼvgYL@5+"   '0;FR_m{Ŀ}ytnid_[XVTTVX[_dinty}Ŀ{m_RF;0'   $,5@KWcp}ysnifcbbcfinsy}pcWK@5,$   (09CNYep{}xtqppqtx}{peYNC90(   #*3AEGJLOQTW[_ekr{ɾ{rke_[WTQOLJGEA>:61-(#  !$(,0369<>ACFIMQV\cluɽulc\VQMIFCA><9630,($!  !$'*,/1469ELU_jvɻvj_ULE>83/+(%#!  !$(,16=ENWbn{{nbWNE=61,($!  !%*06>FPZeröreZPF>60*%!   $*07?HR\huſ¶uh\RH?70*$   $)07@IS^jvſƽvj^SI@70)$  $*18AJT_kwwk_TJA81*$  $*19AKU_juuj_UKA91*$  $*19AJT^hr{{rh^TJA91*$  $*18@IR[clt{}zwuttuwz}{tlc[RI@81*$  $*07?FNV^ekquy{{{zwtqnkhfeefhknqtwz{{{yuqke^VNF?70*$  #)/5CINRUXZZZYXUSQOMKKKKMOQSUXYZZZXURNIC>82,'"  !&+06;@EJMQSTUUTRPNKIHFFFFHIKNPRTUUTSQMJE@;60+&!  #(.4:@FLRW\_bcddb`^[YVTSRRSTVY[^`bddcb_\WRLF@:4.(#  $)06=DLSZ`fkortttrpmjgda`__`adgjmprtttrokf`ZSLD=60)$  %*18@GPX`hov{}yuromllmoruy}{voh`XPG@81*%   %+29AJR\enw}{zz{}wne\RJA92+%    %+2:BKT^hr||rh^TKB:2+%    &,2:BKU_juuj_UKB:2,&   !&,2:BKU_jvÿþvj_UKB:2,&!  "',2:BJT_jvƿżvj_TJB:2,'"   $(-3:AJS]ht¼ɿth]SJA:3-($    #'*/4:AIR\fr~ýʾ~rf\RIA:4/*'#    "%'*.26ADGJNRW\cjs|½|sjc\WRNJGDA>;851.*&"   $).38<@DGKMPSVY\aflszüøzslfa\YVSPMKGD@<83.)$   !&,27=CHMQUX[^`behkpuzùzupkheb`^[XUQMHC=72,&!  !'.4;BIOU[`dgjlnprtvy}ƾ}yvtrpnljgd`[UOIB;4.'!  !'.6=ENU]djotwz|}~ü~}|zwtojd]UNE=6.'!  &-6>GQZckszþzskcZQG>6-&  $,4=GQ\gqz|ywwy|zqg\QG=4,$  !)1;EP\ht}wrnkjjknrw}th\PE;1)!  %-7AMYfs{tnida^]]^adint{sfYMA7-%  !)2:7421001247:>BGKOSW[_behjmptx|˻xgXJ=2(   !*4@M\l}Ȼ{tniea^[XTQNJGC?;740-+)(''()+-047;?CGJNQTX[^aeint{ò}l\M@4*!  "+6BO^oȺ}tle_[VROLHEB>;741-*'%#! !#%'*-147;>BEHLORV[_elt}Ƕo^OB6+"  #,7CQ`pƷvlc\VPLHDA=:741.+(%"  "%(+.147:=ADHLPV\clvʸp`QC7,#  $-7CQ`qznd[SMGB>:730-+(%"  "%(+-037:>BGMS[dnzɸq`QC7-$  $-7CQ`pʻrf\SKD>951.+(%#  #%(+.159>DKS\frǶp`QC7-$  $,7BP^nwj^TKC<61-)&#! !#&)-16IVcqvi\QF=5.("  "(.5=FQ\ivǿqcVI>3*"  ")2FOW`hov|ztme\SJB91*$  $*19BJS\emtz|voh`WOF>6/("  #)/6=ELT[bhnrvwxwuqlg`XQIA91*$  $*19AIQX`glquwxwvrnhb[TLE=6/)#  $*06=DKQW]bgjlmmkie`ZTMF?81*$  $*18?FMTZ`eikmmljgb]WQKD=60*$  !&,28>DJPUZ^acddca^ZUPJC=60*$  $*06=CJPUZ^acddca^ZUPJD>82,&! $)/4:@EJOTWZ\]^][XUQLFA;5/)$  $)/5;AFLQUX[]^]\ZWTOJE@:4/)$ #(-38=CGLPSVXYYXWTQMID>93.(#  #(.39>DIMQTWXYYXVSPLGC=83-(# #(-28=BGKORUVWWVUROKGB=82-(#  #(-28=BGKORUVWWVUROKGB=82-(##(-38>CHLPSVWXXWUSOKGB=82-(#  #(-28=BGKOSUWXXWVSPLHC>83-(##(.4:?EJOSVY[[[ZXURMID>93.)$  $).39>DIMRUXZ[[[YVSOJE?:4.(##)/5HR]hr|xndZPF=4,%  %,4=FPZdnx|rh]RH>4;EP\htvj_TI?5-%  %-5?IT_jvth\PE;AMYfs}qdXLA7.&  &.7ALXdq}sfYMAHTbp~ľwi\OC9/'  '/9CO\iw»~pbTHN[jy}n`RF:0'    '0:FR`n}ɿyj[NSbqsdUH<2(    (23)!  !)3>JXgwɻwgX[k|{jZL?4*!  !*4?LZj{±|k[^nij}l\M@4*"  "*4@M\l}Ƕn^_pƵ~m]NA5+"  "+5AN]m~ʹp__pƵ~m]NA5+"  "+5AN]m~ʹp_^nij}l\M@4*"  "*4@M\l}Ƕn^[k|{jZL?4*!  !*4?LZj{±|k[XgwȺwgXJ>3)!  !)3>JXgwɻwgXSbqsdUH<2(    (2HR]hr|xndZPF=4,%  %,4=FPZdnx|rh]RH>4.6?IR\fow~xph_VMD;3,%  %,3;DMV_hpx~wof\RI?6.(/7@HQYbipvz}~~}zupibZRJB:3,%    %,3:BJRZbipuz}~~}zvpibYQH@7/(")07?GNV]cimprsrpmhc]VOHA:3-'!  !'-3:AHOV]chmprsrpmic]VNG?70)"#)06=DKRX]behiihfb^YTNGA:4.(#  #(.4:AGNTY^bfhiiheb]XRKD=60)##)/593.)$  $).39>DIMRUXZ[[[YVSOJE?:4.(##(-38>CHLPSVWXXWUSOKGB=82-(#  #(-28=BGKOSUWXXWVSPLHC>83-(##(-28=BGKORUVWWVUROKGB=82-(#  #(-28=BGKORUVWWVUROKGB=82-(# #(-38=CGLPSVXYYXWTQMID>93.(#  #(.39>DIMQTWXYYXVSPLGC=83-(# $)/4:@EJOTWZ\]^][XUQLFA;5/)$  $)/5;AFLQUX[]^]\ZWTOJE@:4/)$ !&,28>DJPUZ^acddca^ZUPJC=60*$  $*06=CJPUZ^acddca^ZUPJD>82,&!  $*06=DKQW]bgjlmmkie`ZTMF?81*$  $*18?FMTZ`eikmmljgb]WQKD=60*$  #)/6=ELT[bhnrvwxwuqlg`XQIA91*$  $*19AIQX`glquwxwvrnhb[TLE=6/)#  "(/6>FOW`hov|ztme\SJB91*$  $*19BJS\emtz|voh`WOF>6/("  !(/7?IR\eox{ri_UKB91*#  #*19BKU_ir{xoe\RI?7/(!  !(08AKValvvk`UKA80)#  #)08AKU`kvvlaVKA80(!  !)1:DOZfr~xl`UJ@7/("  "(/7@JU`lx~rfZOD:1)!  ")2IVcqvi\QF=5.("  "(.5=FQ\ivǿqcVI>3*"  #+5@LYgvĸsfYND<4.($    $(.4951.+(%#  #%(+.159>DKS\frǶp`QC7-$  $-7CQ`qznd[SMGB>:730-+(%"  "%(+-037:>BGMS[dnzɸq`QC7-$  #,7CQ`pƷvlc\VPLHDA=:741.+(%"  "%(+.147:=ADHLPV\clvʸp`QC7,#  "+6BO^oȺ}tle_[VROLHEB>;741-*'%#! !#%'*-147;>BEHLORV[_elt}Ƕo^OB6+"  !*4@M\l}Ȼ{tniea^[XTQNJGC?;740-+)(''()+-047;?CGJNQTX[^aeint{ò}l\M@4*!   (2=JXgxƺ|xtpmjheb_[WSOKGB>:7421001247:>BGKOSW[_behjmptx|˻xgXJ=2(   &/:FSbr¸~{ywuspmjfb]XTOJFB?<:99:GQZckszþzskcZQG>6-&  !'.6=ENU]djotwz|}~ü~}|zwtojd]UNE=6.'!  !'.4;BIOU[`dgjlnprtvy}ƾ}yvtrpnljgd`[UOIB;4.'!  !&,27=CHMQUX[^`behkpuzùzupkheb`^[XUQMHC=72,&!   $).38<@DGKMPSVY\aflszüøzslfa\YVSPMKGD@<83.)$   "&*.158;>ADGJNRW\cjs|½|sjc\WRNJGDA>;851.*&"  "%(+.1469<@CHMSZbkuɼukbZSMHC@<9641.+(%"   #%(*-036:?DJRZcmx¾öxmcZRJD?:630-*(%#    "%'*.26CINRVY[]]\[YWTROMLKKLMORTWY[\]][YVRNIC>82-'"  $)/5ENWalwúwlaWNE>71+'#   "&).28?FNWakv»ƼvkaWNF?82.)&"   "$'*-15;@GOW`juƿƼuj`WOG@;51-*'$"  !$'*,/26:>CIPX`is~Ĺ~si`XPIC>:62/,*'$!  #&)-0369<@DHMSYair|ǿ|riaYSMHD@<9630-)&#  #'+/37:>ADHKOSX]cjr{ļŻ{rjc]XSOKHDA>:73/+'#   %*/49>BFJNQTW[_chmt{ƾɿ{tmhc_[WTQNJFB>94/*%   "'-39?EJOTX\_behkosx}ƾ}xsokheb_\XTOJE?93-'"  "(/6=DKRX^cgknqtvx{~ļ~{xvtqnkgc^XRKD=6/("  "(/7?GPX`gmsx|ƿſ|xsmg`XPG?7/("   '/7@IS\fnw~Ŀ}||}~wnf\SI@7/'   %-5?IT_it~~ytqooqty~~ti_TI?5-%  "*3JWesĽ{tnhb\WROMKKMORW\bhnt{¸seWJ>3*"  $-8CP^m}Ž{vqlf`ZTOKGDA@@ADGKOTZ`flqv{Ǻ}m^PC8-$  '1:730-)&#  #&)-037:>CGLRYajuоudTF:/%  &/:FTct²xlbXPIC>951.*'$""$'*.159>CIPXblxͼtcTF:/&  &/9FSbrȹ}odYPG@:51-)&#   #&)-15:@GPYdo}ɸrbSF9/&  %.9ER`p˽sg[PG?82-)%" "%)-28?GP[gs³p`RE9.%  %.8CP^m|˿wj]RH?81+&"  "&+18?HR]jwǺ|m^PC8.%  %-7BN[iwǽ{m`TJ@80*%    %*08@JT`m{ǽwi[NB7-%  %-6@KXerſ|ocWLB91*$  $*19BLWco|»reXK@6-%  $,5?IUamz|pdXMC:1*$  $*1:CMXdp|zmaUI?5,$  %,4=GR]hs{pdYND;2+$  $+2;DNYdp{sh]RG=4,%  %,482,&!  !&,28>EKPVZ^acddca^ZVPKE?93-'"!&,28>DJOTY\_abba_\YTOJD>82,&!  !&,28>DJOTY\_abba_\YTOJD>82,&! &+18>DJPUY]`bccb`]YUPJD>82,'!  !',28>DJPUY]`bccb`]YUPJD>81+&  %+28?EKQW\`ceffec`\WRLF@:4.(#  #(.4:@FLRW\`ceffec`\WQKE?82+%  %+29@GNTZ_dgjkkjhea\VPJD=60*$  $*06=DJPV\aehjkkjgd_ZTNG@92+% %+2:AIPX^djnqrsrpmhc]WPIB;4-'"  "'-4;BIPW]chmprsrqnjd^XPIA:2+%$+2:BKS[cjpuy{||zwrmg`XPIA92+%    %+29AIPX`gmrwz||{yupjc[SKB:2+$*1:BLU^gow}yskcZRIA91*$  $*19AIRZcksy}wog^ULB:1*08BLV`jt}yqg^TJA90)#  #)09AJT^gqy}tj`VLB806@JUalwwlaWLB90)"  ")09BLWalwwlaUJ@6=HS_lx~rfZOD:1)"  ")1:DOZfr~xl_SH=CO\iwxk^QF;2)"  ")2;FQ^kxwi\OCJWesƾ~obTH=3*"  "*3=HTbo~seWJP^m}ɾteWJ>4*"  "*4>JWetƹ}m^PUdtȹyiZL@5+#  #+5@LZiyŷtdUZj{}l]NA6,#  #,6AN]l}{jZ^nǶo_PB7,#  #,7BP_oȶn^`q˹p`QC7-$  $-7CQ`pͻq`bsͻqaQD7-$  $-7DQaqоsbbsͻqaQD7-$  $-7DQaqоsb`q˹p`QC7-$  $-7CQ`pͻq`^nǶo_PB7,#  #,7BP_oȶn^Zj{}l]NA6,#  #,6AN]l}{jZUdtȹyiZL@5+#  #+5@LZiyŷtdUP^m}ɾteWJ>4*"  "*4>JWetƹ}m^PJWesƾ~obTH=3*"  "*3=HTbo~seWJCO\iwxk^QF;2)"  ")2;FQ^kxwi\OC=HS_lx~rfZOD:1)"  ")1:DOZfr~xl_SH=6@JUalwwlaWLB90)"  ")09BLWalwwlaUJ@608BLV`jt}yqg^TJA90)#  #)09AJT^gqy}tj`VLB80*1:BLU^gow}yskcZRIA91*$  $*19AIRZcksy}wog^ULB:1*$+2:BKS[cjpuy{||zwrmg`XPIA92+%    %+29AIPX`gmrwz||{yupjc[SKB:2+$%+2:AIPX^djnqrsrpmhc]WPIB;4-'"  "'-4;BIPW]chmprsrqnjd^XPIA:2+% %+29@GNTZ_dgjkkjhea\VPJD=60*$  $*06=DJPV\aehjkkjgd_ZTNG@92+%  %+28?EKQW\`ceffec`\WRLF@:4.(#  #(.4:@FLRW\`ceffec`\WQKE?82+%  &+18>DJPUY]`bccb`]YUPJD>82,'!  !',28>DJPUY]`bccb`]YUPJD>81+& !&,28>DJOTY\_abba_\YTOJD>82,&!  !&,28>DJOTY\_abba_\YTOJD>82,&!"'-39?EKPVZ^acddca^ZVPKE>82,&!  !&,28>EKPVZ^acddca^ZVPKE?93-'" #).5;AHNTY^beghhgea]XSMF?92,&!  !&,29?FMSX]aeghhgeb^YTNHA;5.)#  %+18?FLSY_dhkmnnmjfb\VOHA:3,&    &,3:AHOV\bfjmnnmkhd_YSLF?81+%  #)/6=DLSZagmqtvwvtqmgaZRJC;4-&    &-4;CJRZagmqtvwvtqmgaZSLD=6/)#  !'.5951.*'$""$'*.159>CIPXblxͼtcTF:/&  %/:FTduȹujaYRLGC>:730-)&#  #&)-037:>CGLRYajuоudTF:/%  %.9ESct;}sjc\WRMIEA=:62/+(%""%(+/26:=AEIMRW\cjs}оtcSE9.%  $-8DRar´|tmgb]XTPLHD@<841-*'$"  "$'*-148<@DHLPTX]bgmt|ͼraRD8-$  "+6BO^o÷}wrmiea]YUQLHC?;63/,)'&%%&'),/36;?CHLQUY]aeimrw}ȷo^OB6+"  !)3?L[j{ø|yuqnjfb^YUPKFA=9520.--.0259=AFKPUY^bfjnquy|{j[L?3)!  '1JWesĽ{tnhb\WROMKKMORW\bhnt{¸seWJ>3*"  &/8CO\iw}void_[XWWX[_diov}ÿwi\OC8/&  "*3BFJNQTW[_chmt{ƾɿ{tmhc_[WTQNJFB>94/*%   #'+/37:>ADHKOSX]cjr{ļŻ{rjc]XSOKHDA>:73/+'#  #&)-0369<@DHMSYair|ǿ|riaYSMHD@<9630-)&#  !$'*,/26:>CIPX`is~Ĺ~si`XPIC>:62/,*'$!  "$'*-15;@GOW`juƿƼuj`WOG@;51-*'$"   "&).28?FNWakv»ƼvkaWNF?82.)&"   #'+17>ENWalwúwlaWNE>71+'#   %*/6=ENWalwþýwlaWNE=6/*%   #).5CINRVY[]]\[YWTROMLKKLMORTWY[\]][YVRNIC>82-'"   %*/38=AEIKMNONMLJHFDBA@@ABDFHJLMNONMKIEA=83/*%    $(-159=ADFGHHHGECA?=<;::;<=?ACEGHHHGFDA=951-($   "',16;@EIMPSTUVUSROMJHFEDDEFHJMORSUVUTSPMIE@;61,'"   $)/4:@FLQVZ^acddca_\YVTRPOOPRTVY\_acddca^ZVQLF@:4/)$   !&+17>EKRX^dimprssqomifc`][ZZ[]`cfimoqssrpmid^XRKE>71+&!  "(-4:AHPW_fmsx|~{wsoligffgilosw{~|xsmf_WPHA:4-("  $)/5FNW`irz}||}zri`WNF>70*%   !&+18@GPYblvvlbYPG@81+&!  #'-39AIQ[dnyynd[QIA93-'#  !%).4;BJR\epzĿýzpe\RJB;4.)%!  "%(,16CHOV^gq{Ƽ{qg^VOHC>952.+(%"   $'+.258<@DHMSY`hq{Ż{qh`YSMHD@<852.+'$   #(,059<@DHKOTX^dkr{Ǿ¸{rkd^XTOKHD@<950,(#  !&+06;@DIMQUX\`diov}¹Ǿ}void`\XUQMID@;60+&!  "(.4:AGLRW[_cfjnqv{ú¹{vqnjfc_[WRLGA:4.("  #)07>FMTZ`fkosvy|úļ|yvsokf`ZTMF>70)#  ")08AIRZbipv|}}Ľ|vpibZRIA80)"  !(08AKU^hqz|wtrrtw|½zqh^UKA80(!  &.7@KValw¿}vqliggilqv}wlaVK@7.&  #+4>ITamyxqjea^\\^aejqxymaTI>4+#  '0:EQ^ky¾yrkd^YURQQRUY^dkryžyk^QE:0'  "+4?LYgvzskd^XRNJHFFHJNRX^dkszǼvgYL?4+"  %.9ER`pƿ~xrke^WQLGC@><<>@CGLQW^ekrx~˾p`RE9.%   (2=JXgxzuojd]WQKFA=96433469=AFKQW]djouz˼xgXJ=2(   "+5AN]m~~yuplga\VPKE@;730-,++,-037;@EKPV\aglpuy~Ŵ~m]NA5+"  $-7DRar̿zuqlgc^YTOJE?;62.*(&$##$&(*.26;?EJOTY^cglquzͻraRD7-$  %.9FTduʼ|uoid_ZVQLHC>:51-)&#!!#&)-15:>CHLQVZ_diou|udTF9.%  &0;HVfxƷ{rjc]XSNJEA=840,(%""%(,048=AEJNSX]cjr{ðxfVH;0&  '0951-*'#  #'*-159>CHNV^gr~°xgWI<1'  '15.'!  !'.5>HR\gr}wlbWMC91)"  $*2:CLV_is{xoe[QH?6.'!  !'.6?HQ[eox{si_VLC:2*$  %,3;CLU^gow}{tlcZPG?6/("  "(/6?GPZclt{}wog^ULC;3,% !'.5=EMU]elsx}~zuoh`XOG>6/("  "(/6>GOX`houz~}xsle]UME=5.'! $*18?GNV]djptwyzywtpjd]UMF>6/("  "(/6>FMU]djptwyzywtpjd]VNG?81*$ "'.4;BJQX^djnqsttrolgaZSLE=6/)#  #)/6=ELSZaglorttsqnjd^XQJB;4.'"  %+29?FMT[afjmoppolid_YRKD=6/)#  #)/6=DKRY_diloppomjfa[TMF?92+% $*07>ELRY_dhknoonkhd^YRKD>70*$  $*07>DKRY^dhknoonkhd_YRLE>70*$#)/6=DKRX^dhlnoonlie`ZSMF?81+%    %+18?FMSZ`eilnoonlhd^XRKD=6/)#"(/6=DKSY`ejnprrqolhb]VOHA:3-'!  !'-3:AHOV]bhloqrrpnje`YSKD=6/("!(.5=ELT[bhnruwwvtqmga[TLE=6/)#  #)/6=ELT[agmqtvwwurnhb[TLE=5.(! '.5=ENV^elrw{}~~|ytohaZRJB;3,&    &,3;BJRZahoty|~~}{wrle^VNE=5.' &-4=FOXaiqx~~xrjbZQI@81*$  $*18@IQZbjrx~~xqiaXOF=4-&+3ELRY_dhknoonkhd^YRKD>70*$  $*07>DKRY^dhknoonkhd_YRLE>70*$ %+29?FMT[afjmoppolid_YRKD=6/)#  #)/6=DKRY_diloppomjfa[TMF?92+%  "'.4;BJQX^djnqsttrolgaZSLE=6/)#  #)/6=ELSZaglorttsqnjd^XQJB;4.'" $*18?GNV]djptwyzywtpjd]UMF>6/("  "(/6>FMU]djptwyzywtpjd]VNG?81*$ !'.5=EMU]elsx}~zuoh`XOG>6/("  "(/6>GOX`houz~}xsle]UME=5.'! %,3;CLU^gow}{tlcZPG?6/("  "(/6?GPZclt{}wog^ULC;3,%  $*2:CLV_is{xoe[QH?6.'!  !'.6?HQ[eox{si_VLC:2*$  ")19CMWblw}rg\RH>5.'!  !'.5>HR\gr}wlbWMC91)"  !(09CNYdp|th\QG=5-&    &-5=GQ\ht|pdYNC90(!  !(09DO[huth\PF<4,&!  !&,4951-*'#  #'*-159>CHNV^gr~°xgWI<1'  '0:51-)&#!!#&)-15:>CHLQVZ_diou|udTF9.%  $-7DRar̿zuqlgc^YTOJE?;62.*(&$##$&(*.26;?EJOTY^cglquzͻraRD7-$  "+5AN]m~~yuplga\VPKE@;730-,++,-037;@EKPV\aglpuy~Ŵ~m]NA5+"   (2=JXgxzuojd]WQKFA=96433469=AFKQW]djouz˼xgXJ=2(   %.9ER`pƿ~xrke^WQLGC@><<>@CGLQW^ekrx~˾p`RE9.%  "+4?LYgvzskd^XRNJHFFHJNRX^dkszǼvgYL?4+"  '0:EQ^ky¾yrkd^YURQQRUY^dkryžyk^QE:0'  #+4>ITamyxqjea^\\^aejqxymaTI>4+#  &.7@KValw¿}vqliggilqv}wlaVK@7.&  !(08AKU^hqz|wtrrtw|½zqh^UKA80(!  ")08AIRZbipv|}}Ľ|vpibZRIA80)"  #)07>FMTZ`fkosvy|úļ|yvsokf`ZTMF>70)#  "(.4:AGLRW[_cfjnqv{ú¹{vqnjfc_[WRLGA:4.("  !&+06;@DIMQUX\`diov}¹Ǿ}void`\XUQMID@;60+&!  #(,059<@DHKOTX^dkr{Ǿ¸{rkd^XTOKHD@<950,(#   $'+.258<@DHMSY`hq{Ż{qh`YSMHD@<852.+'$   "%(+.259>CHOV^gq{Ƽ{qg^VOHC>952.+(%"   #&),049?ELT]gq{ƾż{qg]TLE?940,)&#   "%(,16FNW`irz}||}zri`WNF>70*%   $)/5EKRX^dimprssqomifc`][ZZ[]`cfimoqssrpmid^XRKE>71+&!   $)/4:@FLQVZ^acddca_\YVTRPOOPRTVY\_acddca^ZVQLF@:4/)$   "',16;@EIMPSTUVUSROMJHFEDDEFHJMORSUVUTSPMIE@;61,'"   $(-159=ADFGHHHGECA?=<;::;<=?ACEGHHHGFDA=951-($   #'+/269<>@ABBA@?=;9765445679;=?@ABBA@><962/+'#  "&+/48=ADHJLNNNMLJHECA?>==>?ACEHJLMNNNLJHDA=84/+&"   %).39>CHMQTWY[[[ZXVSPNKIHGGHIKNPSVXZ[[[YWTQMHC>93.)%   "',27=CIOTZ^behiiigeb_\YVTRQQRTVY\_begiiiheb^ZTOIC=72,'"  $)/5;AHOU\bhmqtwxxwusolhda^\[[\^adhlosuwxxwtqmhb\UOHA;5/)$  !&+17>ELT[bipv|}xtpligffgilptx}|vpib[TLE>71+&!  "'-39AHPX`hpx{wsqooqsw{xph`XPHA93-'"  $).5;CKS\dmv~|zxxz|~vmd\SKC;5.)$  !%*06=EMU^hq{{qh^UME=60*%!   $(,28?FOWajt~~tjaWOF?82,($    #'+/4:AHPYblvþĿvlbYPHA:4/+'#   "%(+/38=DJRZdmwžŽwmdZRJD=83/+(%"   #'*-048=BGNU]enx¹xne]UNGB=840-*'#   !$(,037;?CGLRX_gpyúypg_XRLGC?;730,($!   $(-16:>BFJOSX^dks{¹{skd^XSOJFB>:61-($   "',17KZiz»zsle^WPJD?:63100136:?DJPW^elszοziZK>3)!  #,6BP_o}wqke_XRKE?:51.+))))+.15:?EKRX_ekqw}ɸo_PB6,#  $.9ESctǼ~ytnic^XRLF@;61-)&$""""$&)-16;@FLRX^cinty~ѿtcSE9.$  &0;HVfxķ~wqlfa\VQKFA;61-)%"  "%)-16;AFKQV\aflqw~ıxfVH;0&  '1=JXi{;zrke_YTOJE@;62-)%""%)-26;@EJOTY_ekrzȴ{iXJ=1'   (2>KZj|Ʒxof_YSMHC?:61-)%""%)-16:?CHMSY_foxɵ|jZK>2(    )3>LZk|ξxmd[TNHB>951-)%""%)-159>BHNT[dmxǵ|kZL>3)   !)3?LZj{ĵzncYQJC>940,(%! !%(,049>CJQYcnzIJ{jZL?3)!  "*4?LZizɹ}pdYPG@:50+($! !$(+05:@GPYdp}ziZL?4*"  "*4?KYhwʼreZOF>82,($!  !$(,28>FOZerɺwhYK?4*"  "+4?JXfuɼuh[PF>60*%!  !%*06>FP[huufXJ?4+"  #+4>JVdrĺwj]RG>6/)$  $)/6>GR]jwørdVJ>4+#  $,4>IUbo}Ľxk_SH?6/("  "(/6?HS_kx}obUI>4,$  %-5?IT`myxl`TI@7/("  "(/7@IT`lxym`TI?5-%   &.6?IT_kvwk`UJ@7/("  "(/7@JU`kwvk_TI?6.&   !(/8AJT_is}uj_UKA80)"  ")08AKU_ju}si_TJA8/(! #*19BKU_hrz{rh^TKB91)#  #)19BKT^hr{zrh_UKB91*# &,470)#  #)07>FNV^elqvz|}}|yuoib[SKC;3,& %+2:BJRZbipvz}}yuohaYQIA92+%  %+29AIQYahouy}}zvpibZRJB:2+%#*19AJR[ckrx}~ztnf^VNE=5.'!  !'.5=ENV^fntz~}xrkc[RJA91*#")08@IR\dmu|{ume\SKB:2+$  $+2:BKS\emu{|umd\RI@80)"'/7@IS]fox~vmd[RH?7/("  "(/7?HR[dmv~xof]SI@7/'-5>HR]hr|xndZPG>5-&    &-5>GPZdnx|rh]RH>5-3HR]hr|xndZPG>5-&    &-5>GPZdnx|rh]RH>5-'/7@IS]fox~vmd[RH?7/("  "(/7?HR[dmv~xof]SI@7/'")08@IR\dmu|{ume\SKB:2+$  $+2:BKS\emu{|umd\RI@80)"#*19AJR[ckrx}~ztnf^VNE=5.'!  !'.5=ENV^fntz~}xrkc[RJA91*#%+2:BJRZbipvz}}yuohaYQIA92+%  %+29AIQYahouy}}zvpibZRJB:2+% &,3;CKS[biouy|}}|zvqle^VNF>70)#  #)07>FNV^elqvz|}}|yuoib[SKC;3,& !'.5=DLT\cjpuy|}}{yupjc\TLD<5.'!  !'.5IUbo}Ľxk_SH?6/("  "(/6?HS_kx}obUI>4,$  #+4>JVdrĺwj]RG>6/)$  $)/6>GR]jwørdVJ>4+#  "+4?JXfuɼuh[PF>60*%!  !%*06>FP[huufXJ?4+"  "*4?KYhwʼreZOF>82,($!  !$(,28>FOZerɺwhYK?4*"  "*4?LZizɹ}pdYPG@:50+($! !$(+05:@GPYdp}ziZL?4*"  !)3?LZj{ĵzncYQJC>940,(%! !%(,049>CJQYcnzIJ{jZL?3)!   )3>LZk|ξxmd[TNHB>951-)%""%)-159>BHNT[dmxǵ|kZL>3)    (2>KZj|Ʒxof_YSMHC?:61-)%""%)-16:?CHMSY_foxɵ|jZK>2(   '1=JXi{;zrke_YTOJE@;62-)%""%)-26;@EJOTY_ekrzȴ{iXJ=1'  &0;HVfxķ~wqlfa\VQKFA;61-)%"  "%)-16;AFKQV\aflqw~ıxfVH;0&  $.9ESctǼ~ytnic^XRLF@;61-)&$""""$&)-16;@FLRX^cinty~ѿtcSE9.$  #,6BP_o}wqke_XRKE?:51.+))))+.15:?EKRX_ekqw}ɸo_PB6,#  !)3>KZiz»zsle^WPJD?:63100136:?DJPW^elszοziZK>3)!  &/:FSbrýzskd\UOID?<:99:BFJOSX^dks{¹{skd^XSOJFB>:61-($   !$(,037;?CGLRX_gpyúypg_XRLGC?;730,($!   #'*-048=BGNU]enx¹xne]UNGB=840-*'#   "%(+/38=DJRZdmwžŽwmdZRJD=83/+(%"   #'+/4:AHPYblvþĿvlbYPHA:4/+'#    $(,28?FOWajt~~tjaWOF?82,($   !%*06=EMU^hq{{qh^UME=60*%!  $).5;CKS\dmv~|zxxz|~vmd\SKC;5.)$  "'-39AHPX`hpx{wsqooqsw{xph`XPHA93-'"  !&+17>ELT[bipv|}xtpligffgilptx}|vpib[TLE>71+&!  $)/5;AHOU\bhmqtwxxwusolhda^\[[\^adhlosuwxxwtqmhb\UOHA;5/)$  "',27=CIOTZ^behiiigeb_\YVTRQQRTVY\_begiiiheb^ZTOIC=72,'"   %).39>CHMQTWY[[[ZXVSPNKIHGGHIKNPSVXZ[[[YWTQMHC>93.)%   "&+/48=ADHJLNNNMLJHECA?>==>?ACEHJLMNNNLJHDA=84/+&"  #'+/269<>@ABBA@?=;9765445679;=?@ABBA@><962/+'#  "%),/2579;;<;;9864210/../0124689;;<;;9752/,)%"  "&*.269=@BDFGGFEDB@>;:876678:;>@BDEFGGFDB@=962.*&"  !%).37<@DHLNQRSSRQOMJHECA@??@ACEHJMOQRSSRQNLHD@<73.)%!  #(-27=BGLQUY\^```_][XUROLJIHHIJLORUX[]_```^\YUQLGB=72-(#  !&+06EMV_hr|}}|rh_VME>82-)%"   #&)-16;AHPXajtýĿtjaXPHA;61-)&#   !$'+.26;@ELSZclvûŽvlcZSLE@;62.+'$!  !%)-159=AFKQW^fnxƾxnf^WQKFA=951-)%!   $).27;@DIMRW]cjrzǾzrjc]WRMID@;72.)$   "',27=BGLQV[_ejpw~ż}{{}~wpje_[VQLGB=72,'"  #)/6==>AEJPW^gpyµyj[NA6,#  '0;GTcs}ulc[SLF@<865568<@FLS[clu}ĵscTG;0'  !*4?L[j{ľwog_WPIB=840.--.048=BIPW_gow{j[L?4*!  #,7CQ`q~xqibZSLE?940,)'&&'),049?ELSZbiqx~˹q`QC7,#  %/:FUevĹ|vpic\UNHA;60,(%#! !#%(,06;AHNU\cipv|veUF:/%  '1KZk}Ķyrlf`ZUOID>94/*&""&*/49>DIOUZ`flry˷}kZK>2(   !)4?M\m˼~umf_YSNHC>940+'##'+049>CHNSY_fmu~̹m\M?4)!  "*5@N]mó}siaZSMGB=940+'$  $'+049=BGMSZais}˹m]N@5*"  #+5AO]nȹ~rh^VNHB=83/+'$   $'+/38=BHNV^hr~ɷn]OA5+#  #,6BO]m~ͽth]TKD>83/+'#   #'+/38>DKT]htų~m]OB6,#  $-7BO]l|vi]SJB;50+'#    #'+05;BJS]iv|l]OB7-$  %.7BO\k{xk^SIA92-($    $(-29AIS^kxǹ{k\OB7.%  &.8CO\jyɾzl`TJ@81+&!  !&+18@JT`lzyj\OC8.&   '09DO\iwú{naUKA80*$  $*08AKUan{wi\OD90'   !)1:EP\hu|obWLB91*$  $*19BLWbo|¾uh\PE:1)!  #*3HR]hs~zncXMC:2*$  $*2:CMXcnz~sh]RH>5,% !'/7@JT^is}xmcXND;3+$  $+3;DNXcmx}si^TJ@7/'! #*2:CMV`jt}vlbXOE<4,%  %,4FPYclu}}ulbYOF=5-&    &-5=FOYblu}}ulcYPF>5-& #*19BJT]fow|tlcYPG>6.'!  !'.6>GPYclt|wof]TJB91*# '.5>FOXajrz|tld[RI@80)"  ")08@IR[dlt|zrjaXOF>5.' $+2:CLU^gow}}vnf]TKB:2+$  $+2:BKT]fnv}}wog^ULC:2+$")08@IR[dmu|yqi`WNE=5-&    &-5=ENW`iqy|umd[RI@80)" '.6>GPYbkt{}umd[RI@80)"  ")08@IR[dmu}{tkbYPG>6.' %,45-&    &-5>GQ[eoyvlaWLB90(.7@KValwzodYOE;3+$  $+3;EOYdozwlaVK@7.4>IT`lx{ocXMC90)"  ")09CMXco{xl`TI>4;EQ]jw|pcWLA7/'    '/7ALWcp|wj]QE;AMZgu~qdWK@6-%  %-6@KWdq~žugZMAHUcqøseWK?5,$  $,5?KWesĹqcUHN\k{̿tfXK?4+#  #+4?KXftǺ{k\NUdtǸwgXK?4+"  "+4?KXgwǷtdUZj{ξyhYK?4*"  "*4?KYhy±{jZ_pñ{jZL?4*"  "*4?LZj{̺p_ctǵ|k[L?4*!  !*4?L[k|tcewʷ}l[L?4*!  !*4?L[l}Ųwegy̸~l\M?4*!  !*4?M\l~ȴyggy̸~l\M?4*!  !*4?M\l~ȴygewʷ}l[L?4*!  !*4?L[l}Ųwectǵ|k[L?4*!  !*4?L[k|tc_pñ{jZL?4*"  "*4?LZj{̺p_Zj{ξyhYK?4*"  "*4?KYhy±{jZUdtǸwgXK?4+"  "+4?KXgwǷtdUN\k{̿tfXK?4+#  #+4?KXftǺ{k\NHUcqøseWK?5,$  $,5?KWesĹqcUHAMZgu~qdWK@6-%  %-6@KWdq~žugZMA;EQ]jw|pcWLA7/'    '/7ALWcp|wj]QE;4>IT`lx{ocXMC90)"  ")09CMXco{xl`TI>4.7@KValwzodYOE;3+$  $+3;EOYdozwlaVK@7.(09BLWalvyoe[QG>5-&    &-5>GQ[eoyvlaWLB90(#*2;DNWaku}zqg]TJA80)"  ")08AJT]gqz}ukaWND;2*#%,4GPYbkt{}umd[RI@80)"  ")08@IR[dmu}{tkbYPG>6.' ")08@IR[dmu|yqi`WNE=5-&    &-5=ENW`iqy|umd[RI@80)"$+2:CLU^gow}}vnf]TKB:2+$  $+2:BKT]fnv}}wog^ULC:2+$ '.5>FOXajrz|tld[RI@80)"  ")08@IR[dlt|zrjaXOF>5.' #*19BJT]fow|tlcYPG>6.'!  !'.6>GPYclt|wof]TJB91*# &-5>FPYclu}}ulbYOF=5-&    &-5=FOYblu}}ulcYPF>5-&  #*2:CMV`jt}vlbXOE<4,%  %,4HR]hs~zncXMC:2*$  $*2:CMXcnz~sh]RH>5,% #*383/+'#   #'+/38>DKT]htų~m]OB6,#  #+5AO]nȹ~rh^VNHB=83/+'$   $'+/38=BHNV^hr~ɷn]OA5+#  "*5@N]mó}siaZSMGB=940+'$  $'+049=BGMSZais}˹m]N@5*"  !)4?M\m˼~umf_YSNHC>940+'##'+049>CHNSY_fmu~̹m\M?4)!   (2>KZk}Ķyrlf`ZUOID>94/*&""&*/49>DIOUZ`flry˷}kZK>2(   '1==>AEJPW^gpyµyj[NA6,#   (1;GS`n|ÿ|sjaZSNJGFFGJNSZajs|ļ|n`SG;1(   $,5?JVcp}ƿuld]WSPNNPSW]dlu¾}pcVJ?5,$   '/8BLXcozļwnga\YWWY\agnwzocXLB8/'   ")1:CMWakt}ƽxqjeb``bejqx¼}tkaWMC:1)"  #*2:BKT\emt{ǽysmjhhjmsyü{tme\TKB:2*#  $*18@GOV]djpuz~ŻzuqooquzŽ~zupjd]VOG@81*$  #)/6EMV_hr|}}|rh_VME>82-)%"  "&*/5;:876678:;>@BDEFGGFDB@=962.*&"  "%),/2579;;<;;9864210/../0124689;;<;;9752/,)%"  !$'*-/13456654310.,+*)(()*+,.01345665431/-*'$!  "%),0369;=?@@@?><:864210//012468:<>?@@@?=;9630,)%"  "&*.26:>ADGIJKKKJIGDB?=;987789;=?BDGIJKKKJIGDA>:62.*&"   %).27ELT]gq{½{vsqqsv{{qg]TLE>93/+'#   !$(,048=CIPW`is}ž}xussux}û}si`WPIC=840,($!  !%)-15:>CHNT[cluú}xussux}ȿulc[TNHC>:51-)%!   $).2795322359>DJRZcmwĵscTG;0'  !*4?L[j{ÿ|sjaXPHA;62.,++,.26;AHPXajs|{j[L?4*!  #-7CQ`q~vnf]UMF?93.+(&%%&(+.39?FMU]fnv~̺q`QC7-#  &/:GUev~woh`YQJC<60,($"  "$(,0683.*&"  "&*.38>EMV`kxŴpaRE:/&   (1;FSapõzmaVLC;5/*&"  "&*/5;CLVamzpaSF;1(   !)2IUbp~Ⱦ~pcWLB:2,&!  !&,2:BLWcp~~pbUI>4+#  %-6@KWcp~~qeYMC:2+%    %+2:CMYeq~~pcWK@6-%  '/8BMXdq~~rfZOD;2+%  %+2;DOZfr~~qdXMB8/'  ")1;DOZfr~~rf[PE<3,%  %,35-&    &-5>GQ[fpz~ukaVLC91)" '.7@JT^is}vlaWMC:1*#  #*1:CMWalv}si^TJ@7.' %,4=GR\gr|}sh^SI?6.&    &.6?IS^hs}|rg\RG=4,%*2;EOZfq|{peZOE<3+$  $+35-&    &-5>GQ[fpz~ukaVLC91)"%,4IUbp~Ⱦ~pcWLB:2,&!  !&,2:BLWcp~~pbUI>4+#  !)283.*&"  "&*.38>EMV`kxŴpaRE:/&  %.8DRaqwkaWOHB<72.*&# #&*.2795322359>DJRZcmwĵscTG;0'  #,6AN[jyyoe\TMFA=:99:=AFMT\eoyµyj[NA6,#   (1;FS`n|{pg^VOIEB@@BEIOV^gp{ż|n`SF;1(   $,5?JVcp}ż{qg_XRMJHHJMRX_gq{}pcVJ?5,$  '/8BLXcozǽ{qh`ZURPPRUZ`hq{zocXLB8/'  ")19CMWaku~Ǽyphb]YWWY]bhpy~ukaWMC91)"  #*1:BKT]emu|Ĺxpid`^^`dipx|ume]TKB:1*#  $*18@GOW^ekqw|vpjfeefjpv|wqke^WOG@81*$  #)/6CHNT[cluú}xussux}ȿulc[TNHC>:51-)%!  !$(,048=CIPW`is}ž}xussux}û}si`WPIC=840,($!   #'+/39>ELT]gq{½{vsqqsv{{qg]TLE>93/+'#   #'+05;BJR[dnx}xspnnpsx}xnd[RJB;50+'#   #(-29@GPXakt}~xsoljjlosx~}tkaXPG@92-(#   !%*07=EMU^fow}wqlifeefilqw}wof^UME=70*%!  #).4;BJQYaipw}ytojeb_^^_bejoty}wpiaYQJB;4.)#  "',28?FMT[bhnsx|~|xtojfa]ZXWWXZ]afjotx|~|xsnhb[TMF?82,'"   %*/5;AHNTZ_dilorsssqolhd`\XURPOOPRUX\`dhloqsssrolid_ZTNHA;5/*%   #',27ADGIJKKKJIGDB?=;987789;=?BDGIJKKKJIGDA>:62.*&"  "%),0369;=?@@@?><:864210//012468:<>?@@@?=;9630,)%"  !$'*-/13456654310.,+*)(()*+,.01345665431/-*'$!   #%(*,-/0000/.-+*(&%$####$%&(*+-./0000/-,*(%#   "%(+.135789::987531/-,*))))*,-/135789::987531.+(%"  "&*-158;>@BCDEDCB@><:753100001357:<>@BCDEDCB@>;851-*&"  "&*.37<@CGJLNPPPPOMKHEB@=:977779:=@BEHKMOPPPPNLJGC@<73.*&"   $).38=BGLPTWZ\]]]\[XVROLHEB@>>>>@BEHLORVX[\]]]\ZWTPLGB=83.)$   "',17=CIOTY^behjkkkigda]YUQMJGFEEFGJMQUY]adgikkkjheb^YTOIC=71,'"  $).4;BHOV\bhmquwyzzxvtplhc^YUROMLLMORUY^chlptvxzzywuqmhb\VOHB;4.)$  !%+17>EMU\dkqw}|wrlgb]YVSRRSVY]bglrw|}wqkd\UME>71+%!  "'-3:AIQYbjrz|uoid_\YXXY\_diou|zrjbYQIA:3-'"  !%*/5FNW`jt~}vojebaabejov}~tj`WNF>82,($    $',05;AHPYblw¿zsmieddeimsz¾wlbYPHA;50,'$   !%(,05:?ELS\eoyü}vojgeegjov}yoe\SLE?:50,(%!  !%)-16:?DJPW_hq|ù~wpkgffgkpw~Ǿ|qh_WPJD?:61-)%!   $)-27IUbn{xmcZSLHDCCDHLSZcmxĿ{nbUI>4+#   '0:FR_m{ɿzndZRKEA><<>AEKRZdnzĺ{m_RF:0'   #,5AMZixĻzod[RJC>:7557:>CJR[dozxiZMA5,#  &0:FTbr¼yndZQIB<730//03771,'$!!$',17>ELU]env~veUG:/&  (1=JYi{Ƚ|ung`XQIB;5/*%""%*/5;BIQX`gnu|Ǵ{iYJ=1(  !*4?M\l~˿zsmg`YSLE?93-($  $(-39?ELSY`gmsz˸~l\M?4*!  "+6BO^oµyrke_YSMGA;50+&""&+05;AGMSY_ekryλo^OB6+"  $-7CQ`qǸ|skd]WQLFA<61-($  $(-16JWfuĶ{nbWNE>72-(%!  !%(-27>ENWbn{ŶufWJ>4*"  $,6@LYgvö}pcWMD<5/*%!  !%*/54+#  #+4>JVdrʾsdUHN]l|̿qbUH<2)"  ")24+#  #+4>JVdrʾsdUHBN[ix·seXLA6-%  %-6ALXesǽxi[NBJWfuĶ{nbWNE>72-(%!  !%(-27>ENWbn{ŶufWJ>4*"  !(271,'$!!$',17>ELU]env~veUG:/&  #,7CQ`p½|sj`WOG?93.*'%$$%'*.39?GOW`js|ʸp`QC7,#  !*3?LZjz½wmcYPHA:50-*))*-05:AHPYcmwϿzjZL?3*!  &0:FTbr¼yndZQIB<730//037:7557:>CJR[dozxiZMA5,#   '0:FR_m{ɿzndZRKEA><<>AEKRZdnzĺ{m_RF:0'   #+4>IUbn{xmcZSLHDCCDHLSZcmxĿ{nbUI>4+#  &.7AKWbmy˿vkbZSNKIIKNSZbkvymbWKA7.&  !(09BLV`jt}ȼ}siaZUQPPQUZais}ý}tj`VLB90(!  #)19AJS\dmt|¶ypg`[WUUW[`gpy|tmd\SJA91)#  #)08?GNV]dkqw}ǻumf`\[[\`fmu}wqkd]VNG?80)#  #)/5FNW`jt~}vojebaabejov}~tj`WNF>82,($   !%*/5EMU\dkqw}|wrlgb]YVSRRSVY]bglrw|}wqkd\UME>71+%!  $).4;BHOV\bhmquwyzzxvtplhc^YUROMLLMORUY^chlptvxzzywuqmhb\VOHB;4.)$  "',17=CIOTY^behjkkkigda]YUQMJGFEEFGJMQUY]adgikkkjheb^YTOIC=71,'"   $).38=BGLPTWZ\]]]\[XVROLHEB@>>>>@BEHLORVX[\]]]\ZWTPLGB=83.)$   "&*.37<@CGJLNPPPPOMKHEB@=:977779:=@BEHKMOPPPPNLJGC@<73.*&"  "&*-158;>@BCDEDCB@><:753100001357:<>@BCDEDCB@>;851-*&"  "%(+.135789::987531/-,*))))*,-/135789::987531.+(%"   #%(*,-/0000/.-+*(&%$####$%&(*+-./0000/-,*(%#    "$&')*++++**('&$"!  !"$&'(**++++*)'&$"   "%'*,/0234444320/-+)'&$####$&')+-/0234444320/,*'%"  #&*-1469;=>>?>><;97420.,*))))*,.02479;<>>?>>=;9641-*&#  #'+/37;?BDGHJJJJHGEB@=:7521////1257:=@BEGHJJJJHGDB?;73/+'#  !&*/49>CGKNQTVWWWVTROLIFB?<9765567994/*&!  #(.39?EJOTY]`bdeedc`^ZWSOKGC@><;;<>@CGKOSWZ^`cdeedb`]YTOJE?93.(#   %+07=DKQX^chlorstsrpmjfa]XSNJGDBAABDGJNSX]afjmprstsrolhc^XQKD=70+%   "'-3:AHPW_fmsx|~zvqlfa[VQMJHGGHJMQV[aflqvz~|xsmf_WPHA:3-'"  $)/5FOXakt}xqjc]YURQQRUY]cjqx}tkaXOF>71+&!   $).3:AIQ[doyxpib]YVTTVY]bipxyod[QIA:3.)$    $(,16EMT\cjpw}ŷwmd]WTRRTW]dmwɾ}wpjc\TME>6/)"  "(08@HQZbkrz~rh`YSONNOSY`hr~ȿzrkbZQH@80("   '/7@JT^hqzɼxmc[TNKIIKNT[cmx»zqh^TJ@7/'   %-6?JU`kv´~rg]UNIEDDEINU]gr~ÿvk`UJ?6-%  "*3=HS_lxŸvj`VNHC@>>@CHNV`jv½xl_SH=3*"  '/9DP]jxƺymbXOHB=:88:=BHOXbmyxj]PD9/'  "+4?KXfuø{odZPHA<743347JXhx¼{pe[RIA:4/,)((),/4:AIR[ep{˻xhXJ>3)!  #,6BO^nxndZQH@93.*&$##$&*.39@HQZdnxƵn^OB6,#  %/:FTctĽ|sjaXOG?82-($!!$(-28?GOXajs|ϽtcTF:/%  (1=IXhy|ume]UME>71+'""'+17>EMU]emu|ıyhXI=1(  !*4?M[l}zsmf_XPIB<5/*%!!%*/5940,($! !$(,049>CHNU]eoz̼ueVI<2(   "*4?KYgw³zncZQJC=83/+($! !$(+/38=CJQZcnz˻wgYK?4*"  $-6AN[jyõ{ocXOG?94/+'#    #'+/49?GOXco{Ⱥyj[NA6-$  '/9DP^l{ö}pcXNE=60+'#    #'+06=ENXcp}Ƹ{l^PD9/' !)25-&!  !&-5>HS_kxžyl_RF<2)" %,5@KVcp}¼{nbVK@7/'!  !'/7@KVbn{þ}pcVK@5,% '09DO[ht~reYNC91)"  ")19CNYer~¾th[OD90' #+3=HS`lyvi]QF<3+$  $+3HT`mz{naUI?5,$  $,5?IUan{zm`TH>4+0:DP\iv¼wj]QE;1)"  ")1;EQ]jwüvi\PD:06@KXesļsfYMB7.&  &.7BMYfsŽseXK@6;GS`n}ǽ}obUI>4+$  $+4>IUbo}Ⱦ}n`SG;AN[ixʿzl_RF;1)!  !)1;FR_lzʿxi[NAGTcrxj\OC8/'  '/8CO\jx˾rcTGM[k{ĵvgYL@6-$  $-6@LYgvʼ{k[MSbrǷufWJ>4+#  #+4>JWfuǷrbSXhyɹtdVI=2)!  !)2=IVdtyhX\m~̻tcUG;1(    (1;GUctȶ~m\`qμscTF:0'  '0:FTcsϼq`bsнsbSF:/&  &/:FSbssbcuѾsbSE9/&  &/9ESbsïuccuѾsbSE9/&  &/9ESbsïucbsнsbSF:/&  &/:FSbssb`qμscTF:0'  '0:FTcsϼq`\m~̻tcUG;1(    (1;GUctȶ~m\XhyɹtdVI=2)!  !)2=IVdtyhXSbrǷufWJ>4+#  #+4>JWfuǷrbSM[k{ĵvgYL@6-$  $-6@LYgvʼ{k[MGTcrxj\OC8/'  '/8CO\jx˾rcTGAN[ixʿzl_RF;1)!  !)1;FR_lzʿxi[NA;GS`n}ǽ}obUI>4+$  $+4>IUbo}Ⱦ}n`SG;6@KXesļsfYMB7.&  &.7BMYfsŽseXK@60:DP\iv¼wj]QE;1)"  ")1;EQ]jwüvi\PD:0+4>HT`mz{naUI?5,$  $,5?IUan{zm`TH>4+&/8BMYer~rfYMB8/'    '/8BMYfr~reYMB8/&"*25-&!  !&-5>HS_kxžyl_RF<2)" &/8CN[huǿvi\QF=4-&!  !&-4=FQ\ivuh[NC8/& $,5?JWdrtgZOE<4-'"  "'-4940,($! !$(,049>CHNU]eoz̼ueVI<2(   &0:FTctʼ|rib[TOID?:51,($   $(,15:?DIOT[bir|ͼtcTF:0&  %.8DRaqƸwohb\VPKE@:50+&""&+05:@EKPV\bhowͻqaRD8.%  #,6BO^oö~wpjd^XQKE?83-($  $(-38?EKQX^djpw~̹o^OB6,#  !*4?M[l}zsmf_XPIB<5/*%!!%*/571+'""'+17>EMU]emu|ıyhXI=1(  %/:FTctĽ|sjaXOG?82-($!!$(-28?GOXajs|ϽtcTF:/%  #,6BO^nxndZQH@93.*&$##$&*.39@HQZdnxƵn^OB6,#  !)3>JXhx¼{pe[RIA:4/,)((),/4:AIR[ep{˻xhXJ>3)!  &/9ER`oŽ|pe[QIA;51/--/15;AIQ[ep|˾o`RE9/&  "+4?KXfuø{odZPHA<743347>@CHNV`jv½xl_SH=3*"  %-6?JU`kv´~rg]UNIEDDEINU]gr~ÿvk`UJ?6-%   '/7@JT^hqzɼxmc[TNKIIKNT[cmx»zqh^TJ@7/'   "(08@HQZbkrz~rh`YSONNOSY`hr~ȿzrkbZQH@80("  ")/6>EMT\cjpw}ŷwmd]WTRRTW]dmwɾ}wpjc\TME>6/)"  "(.4:AGNT[agmt{ƹzpg`[WUUW[`gpzʾ{tmga[TNGA:4.("  !&+16FOXakt}xqjc]YURQQRUY]cjqx}tkaXOF>71+&!  $)/5<;;<>@CGKOSWZ^`cdeedb`]YTOJE?93.(#  !&*/49>CGKNQTVWWWVTROLIFB?<9765567994/*&!  #'+/37;?BDGHJJJJHGEB@=:7521////1257:=@BEGHJJJJHGDB?;73/+'#  #&*-1469;=>>?>><;97420.,*))))*,.02479;<>>?>>=;9641-*&#  "%'*,/0234444320/-+)'&$####$&')+-/0234444320/,*'%"   "$&')*++++**('&$"!  !"$&'(**++++*)'&$"   !"$%&''''&&%#"  "#%&&''''&%$"!  "$')+-./000//-,*)'%#!  !#%')*,-//000/.-+)'$"   #'*-035789:::986420.+)'%$#""#$%')+.024689:::987530-*'#    #(,047;>@BDEEEDCB@=;8520-+)(((()+-0258;=@BCDEEEDB@>;740,(#   "',05:?CGJMOQRRRQOMJGD@=:631/.--./136:=@DGJMOQRRRQOMJGC?:50,'"   %*/5;@FKPTX[^_``_^[YURNIEA=:75322357:=AEINRUY[^_``_^[XTPKF@;5/*%   "',29?FLSY_chkmooonkhea\WRNID@=:9889:=@DINRW\aehknooomkhc_YSLF?92,'"  #(.5==>@CGKPV\agmrvz}~|xtnhaZRKC<5.(#   %*07>FOW`hqx~xrkd^XRMHECBBCEHMRX^dkrx~xqh`WOF>70*%   "',29AIR[enx|ume^XRMJGFFGJMRX^emu|xne[RIA92,'"   $).4;CKT^hs}}uld]WRMKIIKMRW]dlu}}sh^TKC;4.)$    $(,17>EMV`kvÿ|rjb[UQNLLNQU[bjr|vk`VME>71,($    $',05;AHPYbmxǿwne^XSPNNPSX^enwżxmbYPHA;50,'$   #',05:?ELS\eoz{qh`YTQOOQTY`hq{·zoe\SLE?:50,'#  "'+05:?EKQX`hq|ǻ}ri`ZTQOOQTZ`ir}Ź|qh`XQKE?:50+'"   %*/5:@FKQX^emu~si`YTPNNPTY`is~ƹume^XQKF@:5/*%   !&,28?ELRY_fls{´~rh_XRNMMNRX_hr~Ÿ{slf_YRLE?82,&!  !'.4FNW_gow~ymbYRMIGGIMRYbmyú~wog_WNF>6.'!  &-5>GQ[dnw˼th^UNIECCEINU^htŽwnd[QG>5-&  $,4=GR\gr}ĵ{ocYQJDA??ADJQYco{ý}rg\RG=4,$  !)1;EQ\htʼuh]TKE@<;;<@EKT]huþth\QE;1)!  %.7BMZgt̿zmaWNF@;8668;@FNWamz»tgZMB7.%  !)3=IVcqʿ}qeZPG@:631136:@GPZeq}qcVI=3)!  %-8CP]l{Żsg\RIA:51.,,.15:AIR\gsŸ{l]PC8-%   (183.)$  $).38>DIOUZ`flszʹqaRD8.%  '0;GUdtǹ}tld^XRMHC>94/+&""&+/49>CHMRX^dlt}˺tdUG;0'  !*3>JXgwʼzpg^WQKFA<83/+'#   #'+/383*!  $,6AM[jy̾znd[RKE@;62.*'#   #'*.26;@EKR[dnz˼yj[MA6,$  &/9DQ^m|zncXOHA;51-)&"    "&)-15;AHOXcnzʼ|m^QD9/& !)272-(%!  !%(-27>ENXco|ʼqbTH<2)! $,5@KXft¶~qdXND<5/*%!  !%*/5JVcqǿvh\PE;2*#  #*2;EP\hvŽqcVJ>4+#&.8BN[hvº|naUI>5,%  %,5>IUan|vh[NB8.&!)24,$  $,4>IUao|ƾseXK@6,$ (0:EP]jxvi\OD90(!  !(09DO\ivxj]PE:0( #+4>IVbp~ŽqdWK?5,%  %,5?KWdqļ~pbVI>4+# '/9CO[hv¹zl^RF;2)"  ")2;FR^lzvh[OC9/' #+4>IUbo}ǿtgZMB8.&  &.8BMZgtû}obUI>4+#'/9CO[hvļ}obUI>4+#  #+4>IUbo}vh[OC9/'+4>JVcp~¸xj]PE:1(!  !(1:EP]jxż~pcVJ>4+0:EP]kxȿseXLA6-%  %-6ALXesúxk]PE:05@KXesǽ|n`TH=3*#  #*3=HT`n|·seXK@5;FR`n|Ƽwi\OD90'    '09DO\iw|n`RF;@LYhwƺseXK@6-%  %-6@KXes˿whYL@FSapǺ~oaTH=3*"  "*3=HTao~ʽpaSFKYhxȺ{l^QD:0'    '0:DQ^l{ȹxhYKQ_oɺyj[NB7-%  %-7BN[jyóo_QUeuʺwgYK?5+#  #+5?KYgw̼ueUYi{̻vfWJ>3*"  "*3>JWfvñ{iY]mͼueVH<2)!  !)23*"  "*3>JWfvñ{iYUeuʺwgYK?5+#  #+5?KYgw̼ueUQ_oɺyj[NB7-%  %-7BN[jyóo_QKYhxȺ{l^QD:0'    '0:DQ^l{ȹxhYKFSapǺ~oaTH=3*"  "*3=HTao~ʽpaSF@LYhwƺseXK@6-%  %-6@KXes˿whYL@;FR`n|Ƽwi\OD90'    '09DO\iw|n`RF;5@KXesǽ|n`TH=3*#  #*3=HT`n|·seXK@50:EP]kxȿseXLA6-%  %-6ALXesúxk]PE:0+4>JVcp~¸xj]PE:1(!  !(1:EP]jxż~pcVJ>4+'/9CO[hvļ}obUI>4+#  #+4>IUbo}vh[OC9/'#+4>IUbo}ǿtgZMB8.&  &.8BMZgtû}obUI>4+# '/9CO[hv¹zl^RF;2)"  ")2;FR^lzvh[OC9/' #+4>IVbp~ŽqdWK?5,%  %,5?KWdqļ~pbVI>4+# (0:EP]jxvi\OD90(!  !(09DO\ivxj]PE:0( $,6@KXesú|oaUI>4,$  $,4>IUao|ƾseXK@6,$!)25,%  %,5>IUan|vh[NB8.&#+4>JVcqǿvh\PE;2*#  #*2;EP\hvŽqcVJ>4+# (0:EQ^kyż~qdWLA8/("  "(/8ALWdq~úyk^QE:0( %-6ALYftúzm`TI?6.'!  !'.6?IT`mztfYLA6-% "*3=HTao}øvi]QF=4-'!  !'-4=FQ]ivɿ}oaTH=3*" '/9DP]jy÷sfZOE<4-(#  #(-472-(%!  !%(-27>ENXco|ʼqbTH<2)! &/9DQ^m|zncXOHA;51-)&"    "&)-15;AHOXcnzʼ|m^QD9/&  $,6AM[jy̾znd[RKE@;62.*'#   #'*.26;@EKR[dnz˼yj[MA6,$  !*3>JXgwʼzpg^WQKFA<83/+'#   #'+/383*!  '0;GUdtǹ}tld^XRMHC>94/+&""&+/49>CHMRX^dlt}˺tdUG;0'  %.8DRaqķzslf`ZUOID>83.)$  $).38>DIOUZ`flszʹqaRD8.%  #,6BO^n{uoic\VOIB<60+&""&+06GQ[dnw˼th^UNIECCEINU^htŽwnd[QG>5-&  !'.6>FNW_gow~ymbYRMIGGIMRYbmyú~wog_WNF>6.'!  !'.4EMV`kvÿ|rjb[UQNLLNQU[bjr|vk`VME>71,($    $).4;CKT^hs}}uld]WRMKIIKMRW]dlu}}sh^TKC;4.)$   "',29AIR[enx|ume^XRMJGFFGJMRX^emu|xne[RIA92,'"   %*07>FOW`hqx~xrkd^XRMHECBBCEHMRX^dkrx~xqh`WOF>70*%   #(.5==>@CGKPV\agmrvz}~|xtnhaZRKC<5.(#  "',29?FLSY_chkmooonkhea\WRNID@=:9889:=@DINRW\aehknooomkhc_YSLF?92,'"   %*/5;@FKPTX[^_``_^[YURNIEA=:75322357:=AEINRUY[^_``_^[XTPKF@;5/*%   "',05:?CGJMOQRRRQOMJGD@=:631/.--./136:=@DGJMOQRRRQOMJGC?:50,'"   #(,047;>@BDEEEDCB@=;8520-+)(((()+-0258;=@BCDEEEDB@>;740,(#    #'*-035789:::986420.+)'%$#""#$%')+.024689:::987530-*'#   "$')+-./000//-,*)'%#!  !#%')*,-//000/.-+)'$"  !"$%&''''&&%#"  "#%&&''''&%$"!   !"#$$$$#"!  !"#$$$$#"!   !$&()+,,,,,+*('%#!  !#%'(*+,,,,,+)(&$!   $'*-/13566665420.,*(%#!  !#%(*,.02456666531/-*'$    $(,047:=?@AAAA?><9741.+)'%#"!!"#%')+.1479<>?AAAA@?=:740,($   #(,16;?CFIKMNNNMKIFC@<952/,*('&&'(*,/259<@CFIKMNNNMKIFC?;61,(#  !&+06FOXbmy|rh_XQKGDBBDGKQX_hr|þymbXOF>71,'#  "&+/4:AHQZdo{Ļxnd[TNIFDDFINT[dnx{odZQHA:4/+&"  "&*/39>ELS\fq|ƻ}rg^VPKHFFHKPV^gr}ǻ|qf\SLE>93/*&"  !%*.38>CIPW`ir}öuj`XQLHFFHLQX`juʽ}ri`WPIC>83.*%!  #(-28=CIOV]dlvʼwkaXQLHFFHLQXakw˽vld]VOIC=82-(#  $*06<<>AGNWamzwmcXND:2*"   '/8BMXdo{οtg\RJC>:88:>CJR\gt½{odXMB8/'   $,5?JVbo|ĵ{naVME>:6556:>EMVan{»|obVJ?5,$   (1;FR_lzŸsf[PH@:521125:@HP[fsùzl_RF;1(   #,5@LYgv·vj^TJB;51.--.15;BJT^jvǼvgYL@5,#  &/:FR`oļxlaVLD<60,*))*,06KXgwwlaWNE=60,(&%%&(,06=ENWalwǸwgXK>3*!  $-7BO^m~~tjaWNE=60+'$"!!"$'+06=ENWajt~~m^OB7-$  &0:FTcs¼xpg^UME=60+&#  #&+06=EMU^gpxȸscTF:0&  !)2=JXgxȾ~wpiaZRJC<5/*%!!%*/582.*&#    #&*.28>EMWamz̿tfXK?4+# &/8CO]ky|ocWMD<5/*&"  "&*/54+#  #+4>IVcqµ{l^QD9>JWetzk^QE:1(!  !(1:EQ^kzʾteWJ>DP^m|˿ugYLA7-%  %-7ALYguǺ|m^PDIVetʽqbUH=3*#  #*3=HUbqõteVIM\k{ʻ|m_QE:0(!  !(0:EQ_m|̾{k\MRaqʻyj[NB7.&  &.7BN[jyƵqaRVevʺwhYL@5,$  $,5@LYhwͼveVYhy˺ufWJ>4*#  #*4>JWfu°yhY[k|˺teVI=2)"  ")2=IVetų|k[\l~˺tdUH<2)!  !)24*#  #*4>JWfu°yhYVevʺwhYL@5,$  $,5@LYhwͼveVRaqʻyj[NB7.&  &.7BN[jyƵqaRM\k{ʻ|m_QE:0(!  !(0:EQ_m|̾{k\MIVetʽqbUH=3*#  #*3=HUbqõteVIDP^m|˿ugYLA7-%  %-7ALYguǺ|m^PD>JWetzk^QE:1(!  !(1:EQ^kzʾteWJ>9DQ^l{ĸqcVI>4+#  #+4>IVcqµ{l^QD94?JWesǼvh[NB8.&  &.8BN[hvźseWJ?409DP]kz|n`SG<2)"  ")282.*&#    #&*.28>EMWamz̿tfXK?4+#  (1;FSapɼxlaXOHA<73/+(%" "%(+/37KXgwwlaWNE=60,(&%%&(,06=ENWalwǸwgXK>3*!  &/:FR`oļxlaVLD<60,*))*,06:6556:>EMVan{»|obVJ?5,$   '/8BMXdo{οtg\RJC>:88:>CJR\gt½{odXMB8/'   "*2:DNXcmwǷzmaWNGA><<>AGNWamzwmcXND:2*"  $+3;DMW`irz̼~qeZQJEA??AEJQZeq~ƽzri`WMD;3+$  %,3;CKS[ckszth]TMGDBBDGMT]htƻzskc[SKC;3,%   %+29@GNV]dkryvj`WOJFDDFJOW`jvǻyrkd]VNG@92+%   $*06CIPW`ir}öuj`XQLHFFHLQX`juʽ}ri`WPIC>83.*%!  "&*/39>ELS\fq|ƻ}rg^VPKHFFHKPV^gr}ǻ|qf\SLE>93/*&"  "&+/4:AHQZdo{Ļxnd[TNIFDDFINT[dnx{odZQHA:4/+&"  #',17>FOXbmy|rh_XQKGDBBDGKQX_hr|þymbXOF>71,'#   $)/5<9741.+)'%#"!!"#%')+.1479<>?AAAA@?=:740,($    $'*-/13566665420.,*(%#!  !#%(*,.02456666531/-*'$   !$&()+,,,,,+*('%#!  !#%'(*+,,,,,+)(&$!   !"#$$$$#"!  !"#$$$$#"!    !!!!!  !!!!!   !#%'())*))('&$"  "$&'())*))('%#!   $'),.02333321/-+)'%"  "%')+-/12333320.,)'$   !$(,0369;=>>>><;9641.+(%#!!#%(+.1469;<>>>>=;9630,($!  $(-26;?BFHJKKKJHFC@=962/+(&#"! !"#&(+/269=@CFHJKKKJHFB?;62-($  !&+17:62.+(&%$$%&(+.26:>CGKORUWYYYXVTPLGB<71+&!  #(.4;AHOUZ_cfhiihfc`[WQLGB=840-+)(()+-048=BGLQW[`cfhiihfc_ZUOHA;4.(#  $*07>FNU]djptwzzzyvrnhc]VPJD?:52/-,,-/25:?DJPV]chnrvyzzzwtpjd]UNF>70*$   &+29AIR[clt{|vohaYRKE?;73100137;?EKRYahov|{tlc[RIA92+&   "'-3;CLU_is||skbZSKE?;754457;?EKSZbks||si_ULC;3-'"  $).5FOYco{ÿ~ti`WOHC><::<>CHOW`it~Ŀ{ocYOF>71+&"  !%).39@HQZep|{pe\SLFA><<>AFLS\ep{ú|peZQH@93.)%!   $(-27=CKS\fq}¶vj`VNHC@>>@CHNV`jvʾ}qf\SKC=72-($   #',16;AGNV^hr~zncYQJEA??AEJQYcnz~rh^VNGA;61,'#  !&+05:@FLSZbktǸ}pe[RKEB@@BEKR[ep}tkbZSLF@:50+&!  "(-39?ELRY`gox̽rf[RKEB@@BEKR[fr̾xog`YRLE?93-("  #)/6>@DIQZeqƺ|tmf^VNG?70)#  ")08@IRZclt|ͽ}ocXOGB><<>BGOXco}ĺ|tlcZRI@80)"   '/7@IS]gqzɸyl`ULE@<::<@ELU`lyŽzqg]SI@7/'   %,5>HS^it~²uh\RIB=9779=BIR\hu~ti^SH>5,%  ")2;FQ]iuȹ}obWME?:6556:?EMWbo}þui]QF;2)"  &.7BMYfsʼuh]RIA;631136;AIR]husfYMB7.&  ")3=HUbo~ȼzmaVLD=72/../27=DLVamzƽ~obUH=3)"  %-7BN[jx|pdYOF>82.,**,.28>FOYdp|ɾxj[NB7-%   (1;GTbqſ|qf[QH@93.+(''(+.39@HQ[fq|ɼqbTG;1(   #+5@LZhxzoe[RIA:3.*'$##$'*.3:AIR[eozŷxhZL@5+#  %.8DQ_n~}ulcZQIA:4.)&#! !#&).4:AIQZclu}Ϳ~n_QD8.%   (182-($  $(-28>DKRY_elqw|ʺxhYL?4+"  %.8CP^m}ĸ|vqlgb\WQLF@;50+'##'+05;@FLQW\bglqv|;}m^PC8.%   (1;GTbqƺ{tmgb]XSOJE@;72-)%!!%)-27;@EJOSX]bgmt{²qbTG;1(   #+5?KYgvɽwnf`YTOKFB>:62.*&""&*.26:>BFKOTY`fnwŶvgYK?5+#  &/9DP^l{ukbZSMHC?;730,)&#  #&),037;?CHMSZbkuǺ{l^PD9/& ")2=HUcqöuj_WOHB=841-*'$" "$'*-148=BHOW_juʽqcUH=2)" %-7AM[iwƺvj_ULD>83/+(%"   "%(+/38>DLU_jvwi[MA7-%  (1;GS`o~ɽyl`ULC<50+'$!  !$'+05JWet{m`SH>5.'!  !'.5>HS`m{ʾteWJ>4*"%.8CO]k{ȼtfYMB80("  "(08BMYftŸ{k]OC8.% (13*"  "*3>IVdsǺ}n_RE:0'+4>JWesƸ|m_QE:0(    (0:EQ_m|ʾseWJ>4+/8CP]kz˿vgYMA6-%  %-6AMYgvµzk]PC8/3=IUcrŹ~oaTH=3*"  "*3=HTao~ǻrcUI=37BN\jy˿xi\OC9/'    '/9CO\ixyj\NB74+#  #+4>JWet̼ueVWfwƶsdVI>3+#  #+3>IVdsͽwfWWfwƶsdVI>3+#  #+3>IVdsͽwfWVeuƶteWJ>4+#  #+4>JWet̼ueVTcsǷvgXK@5,%  %,5@KXgvȸscTQ`pǸxi[NB7.&  &.7BN[ixóp`QN\k{Ⱥ{l^QE:1(!  !(1:EQ^l{̽{k\NJWfvɼpbTH=3+#  #+3=HTbpŶvfWJER`o˿ufYLA7.&  &.7ALYfu˽o`REAMZixµzl^QE;1)!  !)1;EQ^lzõxiZMAJWesƸ|m_QE:0(    (0:EQ_m|ʾseWJ>4+'0:ER_n}̿sdVI>3*"  "*3>IVdsǺ}n_RE:0'$,6AMZhwŷxi[MA7-%  %-7AM[ixĶwhZMA6,$!)2JWet{m`SH>5.'!  !'.5>HS`m{ʾteWJ>4*"'0:EQ_m|ǻug[OE<4-'"  "'-483/+(%"   "%(+/38>DLU_jvwi[MA7-% ")2=HUcqöuj_WOHB=841-*'$" "$'*-148=BHOW_juʽqcUH=2)" &/9DP^l{ukbZSMHC?;730,)&#  #&),037;?CHMSZbkuǺ{l^PD9/&  #+5?KYgvɽwnf`YTOKFB>:62.*&""&*.26:>BFKOTY`fnwŶvgYK?5+#   (1;GTbqƺ{tmgb]XSOJE@;72-)%!!%)-27;@EJOSX]bgmt{²qbTG;1(   %.8CP^m}ĸ|vqlgb\WQLF@;50+'##'+05;@FLQW\bglqv|;}m^PC8.%  "+4?LYhx¸|wqle_YRKD>82-($  $(-28>DKRY_elqw|ʺxhYL?4+"   (182.,**,.28>FOYdp|ɾxj[NB7-%  ")3=HUbo~ȼzmaVLD=72/../27=DLVamzƽ~obUH=3)"  &.7BMYfsʼuh]RIA;631136;AIR]husfYMB7.&  ")2;FQ]iuȹ}obWME?:6556:?EMWbo}þui]QF;2)"  %,5>HS^it~²uh\RIB=9779=BIR\hu~ti^SH>5,%   '/7@IS]gqzɸyl`ULE@<::<@ELU`lyŽzqg]SI@7/'   ")08@IRZclt|ͽ}ocXOGB><<>BGOXco}ĺ|tlcZRI@80)"  #)07?GNV^fmt|пqeZQID@>>@DIQZeqƺ|tmf^VNG?70)#  #)/6>@CHNV`jvʾ}qf\SKC=72-($   !%).39@HQZep|{pe\SLFA><<>AFLS\ep{ú|peZQH@93.)%!  "&+17>FOYco{ÿ~ti`WOHC><::<>CHOW`it~Ŀ{ocYOF>71+&"  $).5FNU]djptwzzzyvrnhc]VPJD?:52/-,,-/25:?DJPV]chnrvyzzzwtpjd]UNF>70*$  #(.4;AHOUZ_cfhiihfc`[WQLGB=840-+)(()+-048=BGLQW[`cfhiihfc_ZUOHA;4.(#  !&+17:62.+(&%$$%&(+.26:>CGKORUWYYYXVTPLGB<71+&!  $(-26;?BFHJKKKJHFC@=962/+(&#"! !"#&(+/269=@CFHJKKKJHFB?;62-($  !$(,0369;=>>>><;9641.+(%#!!#%(+.1469;<>>>>=;9630,($!   $'),.02333321/-+)'%"  "%')+-/12333320.,)'$   !#%'())*))('&$"  "$&'())*))('%#!   !!!!!  !!!!!     !"$%&''''&%#"  "#%&''''&%$"!   #&)+-/01100/-+)'%"  "%')+-/00110/-+)&#   !$(,0368:;<<;:9742/,)&#  #&),/2479:;<<;:8630,($!  $(-26:>BDFHHHGFDA>;740,)&#  #&),047;>ADFGHHHFDB>:62-($  !&,17FNU]djosvxxwuqmhb\VOIC=83/+)'&&')+/38=CIOV\bhmquwxxvsojd]UNF>70*$   %+29AIR[dlt{}wpiaZRKD>830-+**+-038>DKRZaipw}{tld[RIA92+%   !&,3;CLU_is|~umd[SKD>840.--.048>DKS[dmu~|si_ULC;3,&!  #(.4DKS\fq}ʼuh]SKD?<::83.)%!  #(-27=BIOW_hr}ĵyl`VMFA=;;=AFMV`ly}rh_WOIB=72-(#   %*05;AGNT[ckt~˺|nbWNGA><<>AGNWbn|̾~tkc[TNGA;50*%   !&,28?ELSZahpxξ}ocXOGB><<>BGOXco}ȺxphaZSLE?82,&!   &-3:BIQX_gnu}п}ocXOGA><<>AGOXco}ķ}ung_XQIB:3-&    &-4IVcp~ƽui^SJB;62/--/26;BJS^iuż~pcVI>4+#  &.8CO\jxüvk`VMD=72.,**,.27=DMV`kvƼxj\OC8.&  !)282.*(''(*.28>FNWakuŹqbUH<2)!  $,6AMZhwzqh_VNF?82-*'$##$'*-28?FNV_hqzwhZMA6,$  '/:ER_n}»yskd\TLE>82-)%#! !#%)-28>ELT\dksyǺ}n_RE:/'  "*3>IVdsº~zuojd]WPIC=71,($!!$(,17=CIPW]djouz~̿sdVI>3*"  %-7BN[jyĺ|wrnie`[VPKE?:50+'#  #'+05:?EKPV[`einrw|Ķyj[NB7-%   (1;FS`o~Ǽysmhc^ZVRMID?;61-)%!!%)-16;?DIMRVZ^chmsyȻ~o`SF;1(   #,5?KXfuʿ|tle_ZUQLIEA=951.*&#  #&*.159=AEILQUZ_elt|˿ufXK?5,#  '/9DQ^l{÷{qh`YRMHD@=9630,)&#  #&),0369=@DHMRY`hq{ö{l^QD9/' #+4>JVdrƻ|pf]UMGB=962/-*'%""%'*-/269=BGMU]fp|ȻrdVJ>4+# &/8CP]ky˿~rg\SKC=840,*'$"   "$'*,048=CKS\gr~yk]PC8/& "*3>IVdrĹui]SJB;50+(%"   "%(+05;BJS]iuǻrdVI>3*" %.8CO\kzʿzmaUKB:3-($!  !$(-3:BKUamzµzk\OC8.%!)2=HUcrƺseYND;3,'"  "',3;DNYesʽrcUH=2)!$-6BN\jzõzl_RG=5-'"  "'-5=GR_lzƸzj\NB6-$'0;FTbqͿtfYMB80("  "(08BMYftqbTF;0'"*4?KYhx˽~oaTH=3+$  $+3=HTao~ȹxhYK?4*"%-8CP^n~ɺzj\OC9/(!  !(/9CO\jz~n^PC8-%'0;GUdsǷvfXK?5,$  $,5?KXfvǷsdUG;0'"*4?KYhyĴrbTG<2)"  ")2JWfvȸueWJ>3*"  "*3>JWeuɹvfWJ>3)!$,6AN[jz²paSF;1(    (1;FSap˼zj[NA6,$'0:ER`oʻ{k\OC8.&  &.8CO\k{Ϳo`RE:0'*3>JWetôufXK?4+#  #+4?KXfu³teWJ>3*-7BN\jyɻ~n`SF;1)!  !)1;FS`n~ŷyj\NB7-1;GSaowhZMB7.&  &.7BMZhwȻoaSG;15@LYguƹ~pbUH=3+#  #+3=HUbp~̿ugYL@59DQ^m|˿wi\OC90(!  !(09CO\iwķ|m^QD9=IVdsŸpcVJ?5,%  %,5?JVcpɽsdVI=AN[jyxj]PE:1)"  ")1:EP]jxöyj[NAER`oȻseXLA7.&  &.7ALXesɼo`REIVetŸ|n`SG=3+$  $+3=GS`n|³teVILZixõxj\PD:1)"  ")1:DP\jxǹxiZLN\l|ugYMB7.'    '.7BMYgu˽|l\NP^n~seWK@6-%  %-6@KWes~n^PQ_ordVJ?5,%  %,5?JVdro_QQ_ordVJ?5,%  %,5?JVdro_QP^n~seWK@6-%  %-6@KWes~n^PN\l|ugYMB7.'    '.7BMYgu˽|l\NLZixõxj\PD:1)"  ")1:DP\jxǹxiZLIVetŸ|n`SG=3+$  $+3=GS`n|³teVIER`oȻseXLA7.&  &.7ALXesɼo`REAN[jyxj]PE:1)"  ")1:EP]jxöyj[NA=IVdsŸpcVJ?5,%  %,5?JVcpɽsdVI=9DQ^m|˿wi\OC90(!  !(09CO\iwķ|m^QD95@LYguƹ~pbUH=3+#  #+3=HUbp~̿ugYL@51;GSaowhZMB7.&  &.7BMZhwȻoaSG;1-7BN\jyɻ~n`SF;1)!  !)1;FS`n~ŷyj\NB7-*3>JWetôufXK?4+#  #+4?KXfu³teWJ>3*'0:ER`oʻ{k\OC8.&  &.8CO\k{Ϳo`RE:0'$,6AN[jz²paSF;1(    (1;FSap˼zj[NA6,$!)3>JWfvȸueWJ>3*"  "*3>JWeuɹvfWJ>3)!'0:FSbq̽yj[MA6-$  $-6AM[jyƵqbSF:0'$-7BO^m~~n_QD9/'    '/9DQ_n~±~m^OB7-$"*4?KYhyĴrbTG<2)"  ")2IVdrĹui]SJB;50+(%"   "%(+05;BJS]iuǻrdVI>3*" &/8CP]ky˿~rg\SKC=840,*'$"   "$'*,048=CKS\gr~yk]PC8/& #+4>JVdrƻ|pf]UMGB=962/-*'%""%'*-/269=BGMU]fp|ȻrdVJ>4+# '/9DQ^l{÷{qh`YRMHD@=9630,)&#  #&),0369=@DHMRY`hq{ö{l^QD9/'  #,5?KXfuʿ|tle_ZUQLIEA=951.*&#  #&*.159=AEILQUZ_elt|˿ufXK?5,#   (1;FS`o~Ǽysmhc^ZVRMID?;61-)%!!%)-16;?DIMRVZ^chmsyȻ~o`SF;1(   %-7BN[jyĺ|wrnie`[VPKE?:50+'#  #'+05:?EKPV[`einrw|Ķyj[NB7-%  "*3>IVdsº~zuojd]WPIC=71,($!!$(,17=CIPW]djouz~̿sdVI>3*"  '/:ER_n}»yskd\TLE>82-)%#! !#%)-28>ELT\dksyǺ}n_RE:/'  $,6AMZhwzqh_VNF?82-*'$##$'*-28?FNV_hqzwhZMA6,$  !)282.*(''(*.28>FNWakuŹqbUH<2)!  &.8CO\jxüvk`VMD=72.,**,.27=DMV`kvƼxj\OC8.&  #+4>IVcp~ƽui^SJB;62/--/26;BJS^iuż~pcVI>4+#   '/9CO[hu~qeZPG@:521125:@GPZeq~uh[OC9/'   #+4=HS_kxyl`UKC=853358=CKU`lyxk_SH=4+#   '/7AKVamx̽qeYOG@;8668;@GOYeqþxmaVKA7/'   ")1:CMWblvŴvi]SJC=:88:=CJS]ivvlbWMC:1)"  $+3;DMW`irz˺zl`ULE?<::<<>AGOXco}ķ}ung_XQIB:3-&   !&,28?ELSZahpxξ}ocXOGB><<>BGOXco}ȺxphaZSLE?82,&!   %*05;AGNT[ckt~˺|nbWNGA><<>AGNWbn|̾~tkc[TNGA;50*%   #(-27=BIOW_hr}ĵyl`VMFA=;;=AFMV`ly}rh_WOIB=72-(#  !%).38>DKS\fq}ʼuh]SKD?<::83.)%!  "&*/5;AIQZep}ʿ|odYPHB=:88:=BHPYdo|˿}peZQIA;5/*&"  #',28?GPYdp|Ƽui^ULE?;8668;?ELU^iuĺ|pdYPG?82,'#   %*/6=ENYco{xmbXPHA<853358840.--.048>DKS[dmu~|si_ULC;3,&!   %+29AIR[dlt{}wpiaZRKD>830-+**+-038>DKRZaipw}{tld[RIA92+%   $*07>FNU]djosvxxwuqmhb\VOIC=83/+)'&&')+/38=CIOV\bhmquwxxvsojd]UNF>70*$  #(.4;BHOTZ^befgfdb^ZVPKF@;61-*'$#""#$'*-16;@FKPVZ^bdfgfeb^ZTOHB;4.(#  !&,17BDFHHHGFDA>;740,)&#  #&),047;>ADFGHHHFDB>:62-($  !$(,0368:;<<;:9742/,)&#  #&),/2479:;<<;:8630,($!   #&)+-/01100/-+)'%"  "%')+-/00110/-+)&#   !"$%&''''&%#"  "#%&''''&%$"!        "#$%%%%$#"  "#$%%%%$#"    #&(*,-....-+*(%#!!#%(*+-....-,*(&#    $(+/247899987530-*'$!!$'*-035789998742/+($   #(,159=@CEFFEDB@=:63/+'$!!$'+/36:=@BDEFFEC@=951,(#  !&+16FMU\chmqtuusqmhc]WPIC=72-)&#!!!!#&)-27=CIPW]chmqsuutqmhc\UMF>70)$  %+19@IRZcksy~xqjc[SLD>82.*'%$$%'*.28>DLS[cjqx~yskcZRI@91+%   %+2:BKU^hr{xof]ULE>82.+)(()+.28>ELU]fox{rh^UKB:2+%   !',3;CLValw|rh^TLD=72/,++,/27=DLT^hr|wlaVLC;3,'!  #(.4;DMWbnz}rg\RJB;62/../26;BJR\gr}znbWMD;4.(#  !%*/6=ENXcn{¸{ocYOG@:521125:@GOYco{ù{ncXNE=6/*%!   $(-28>FNXcn{ƺwj_TKC=854458=CKT_jwʾ{ncXNF>82-($   "&+05;AHPYcnzƸ}pdYOG@;8668;@GOYdp}zncYPHA;50+&"   %).38>DKR[dnyuh\RJC=:88:=CJR\hu;ynd[RKD>83.)%   "',17FNU]els{Ͼ}obWNGA=;;=AGNWbo}ǻ{sle]UNF>70)#  !(/7?GPXaiqy̼{naVMF@=;;=@FMVan{¸yqiaXPG?7/(!   &-5>GPZclu~Ƿyk_ULE?<::5-&   $+3:99:>CJR\huſxndZOE<3+$  !(09BMXcnyŶ}pdYOGA<8778IT`lxŹvj^TKD>964469>DKT^jvxl`TI>5,$   (0:DO[huzncYOG@:632236:@GOYcnz¼uh[OD:0(   #+4?JVbp}{pf\RJB<730//03783/,)((),/38>DLT\envǾ~pbUH=3*"  %-7BMZhvž~wpiaZRKD>82.*(&%%&(*.28>DKRZaipw~ĺvhZMB7-%  !(1;FS`n|ƿ|xsnhb\UOHB<72-)&$"!!"$&)-274+#  #+4>JXfvŴ}l]NA5+#%.8DRaqʹscUH<2)!  !)2KYhy|l\OB7-%  %-7BO\l|пyhYK>3*!$,6AN\l|̼wgYK?4+#  #+4?KYgw|l\NA6,$&/9ER`oŵrcUH<2)!  !)24+$  $+4>HTan}˿vhZMA69EQ^m{ƺugZNC90(!  !(09CNZgu¶{m^QE9=IUcrʿ|naTI>5-%  %-5>ITan|ƺrcUI=@LZhwŹuh[OD:1)#  #)1:DO[huʿwhZL@CP^l{}obVJ@6.'    '.6@JVbo}ö{l^PCFSapȽxk^RF<3+$  $+35-%  %-5>ITan|ƺrcUI=9EQ^m{ƺugZNC90(!  !(09CNZgu¶{m^QE96AMZhv¶}naTH>4+$  $+4>HTan}˿vhZMA62=HUcq˿vhZNB8/'    '/8BNZhvɼqcUH=2/9DP^l|Ⱥ~o`SG<2*"  "*2KYhy|l\OB7-%  %-7BO\l|пyhYK>3*!'0;GUduƵo`RE9/'    '/9ER`oͼudUG;0'%.8DRaqʹscUH<2)!  !)24+#  #+4>JXfvŴ}l]NA5+# )2=JXhxνyi[MA7-&  &-7AM[iyпxhXJ=2) &/:FTcsϿ|m^QD:0(!  !(0:DQ^m|ɸscTF:/&#,6BO]m}pbTH=4+%  %+4=HTbp}m]OB6,#!)2=JWfv³tfXLA8/("  "(/8ALXftǸvfWJ=2)!&.9DQ_n~õyk]QF<4-'!  !'-482.*(&%%&(*.28>DKRZaipw~ĺvhZMB7-%  "*3=HUbp~vne\TLD>83/,)((),/38>DLT\envǾ~pbUH=3*"  '/9CO\iwzpf]TKD=73/-,,-/37=DKT]fpzwi\OC9/'  #+4?JVbp}{pf\RJB<730//037IT`lxŹvj^TKD>964469>DKT^jvxl`TI>5,$  !(09BMXcnyŶ}pdYOGA<8778:99:>CJR\huſxndZOE<3+$   &-5>GPZclu~Ƿyk_ULE?<::5-&   !(/7?GPXaiqy̼{naVMF@=;;=@FMVan{¸yqiaXPG?7/(!  #)07>FNU]els{Ͼ}obWNGA=;;=AGNWbo}ǻ{sle]UNF>70)#  #)/6DKR[dnyuh\RJC=:88:=CJR\hu;ynd[RKD>83.)%   "&+05;AHPYcnzƸ}pdYOG@;8668;@GOYdp}zncYPHA;50+&"   $(-28>FNXcn{ƺwj_TKC=854458=CKT_jwʾ{ncXNF>82-($   !%*/6=ENXcn{¸{ocYOG@:521125:@GOYco{ù{ncXNE=6/*%!  #(.4;DMWbnz}rg\RJB;62/../26;BJR\gr}znbWMD;4.(#  !',3;CLValw|rh^TLD=72/,++,/27=DLT^hr|wlaVLC;3,'!   %+2:BKU^hr{xof]ULE>82.+)(()+.28>ELU]fox{rh^UKB:2+%   %+19@IRZcksy~xqjc[SLD>82.*'%$$%'*.28>DLS[cjqx~yskcZRI@91+%  $)07>FMU\chmqtuusqmhc]WPIC=72-)&#!!!!#&)-27=CIPW]chmqsuutqmhc\UMF>70)$  "(.4;AHNSY]`bddca^ZUPKE@:50,($!!$(,05:@EKPUZ^acddb`]YSNHA;4.("  !&+16ABCCBA?<962.*'#  #'*.269<840,'#   %*05:?DHLNPQQPNKHD@;72.)%""%).27;@DHKNPQQPNLHD?:50*%   "'-39@FLRVZ^```_]YUQKF@;50+'#  #'+05;@FKQUY]_```^ZVRLF@93-'"  #(/6=DLSZ`fknpqqolhd^XQKD>72-($!!$(-27>DKQX^dhloqqpnkf`ZSLD=6/(#  #)07?GPYaipw|}ysle]UNF?93-)%#! !#%)-39?FNU]elsy}|wpiaYPG?70)#  $*18AIS]fpy{sjaXOG?93.)&$##$&).39?GOXajs{ypf]SIA81*$   %+19AJT_juwlbXOF?82.*(''(*.28?FOXblwuj_TJA91+%   !&+29BKU`kwxlaWME=72.+**+.27=EMWalxwk`UKB92+&!  #'-3:BKU`lxŽvj_TKC<62/--/26:99:>CKS^jwŶti`XPIC=72-(#   $*/5:@GMT[bkt~̻{maVMF@<::<@FMVam{~tkb[TMG@:5/*$    %+17=DJQX_fnvϾ}ocXOGB><<>BGOXco}ǹvnf_XQJD=71+%   %+28?FNU\cjqyп~pdYPHC?==?CHPYdp~yqjc\UNF?82+%  $+19@HPX`gov}ν~pdYPIC?==?CIPYdp~ź}vog`XPH@91+$  #)08@IQZckszʺ|ocXPHC?==?CHPXco|ɿzskcZQI@80)#   '.6?HQ[dmv~ôylaWNGB?==?BGNWalyº~vmd[QH?6.'   $,4IT_kvĺti_VMF@<9889<@FMV_itvk_TI>5,%  !(0:DOZfr~»wlbYPIB=965569=BIPYblw~rfZOD:0(!  $,5?IUamzwmd[RKD>96322369>DKR[dmwzmaUI?5,$   '09DO[gt¾|tkc[SKE>9520..0259>EKS[ckt|½tg[OD90'   #+4>ITan{|uog`YRKD>941.,++,.149>DKRY`gou|¼{naTI>4+#   '/8CNZgtþ~zvrmga[UOIC=83/,*(''(*,/38=CIOU[agmrvz~tgZNC8/'   #+4=HTan{|xuspmjfb^ZUPJE@;62.*(%$##$%(*.26;@EJPUZ^bfjmpsux|ƿ{naTH=4+#   '/8CN[guľ}wrmjfc`^[XTQMIE@<83/,(%#!  !#%(,/38<@EIMQTX[^`cfjmrw}Ľug[NC8/'   #+4>IUbo|ºyqke`\XURPMJGDA>;730,)&#!!#&),037;>ADGJMPRUX\`ekqy¹|obUI>4+#   '09DP\iwǿxog`YTPLIFCA><:741/,)&#!!#&),/147:<>ACFILPTY`goxwi\PD90'  $,5?KWdrżzof]VOJEA>;86420.,)'%"  "%'),.02468;>AEJOV]fozǾrdWK?5,$  (1;FR_l{ú~rg]TMF@;741/-+)(&$"  "$&()+-/147;@FMT]gr~ƽ{l_RF;1(  $,6ALYgv·xk`VME>83/,)'%#"  "#%'),/38>EMV`kxƻvgYLA6,$ (1;GTap¶reZOF>71,(%"   "%(,17>FOZerƺpaTG;1( #,6AM[iy´{m`TJ@81+&" "&+18@JT`m{ŷyi[MA6,#'0:FTbq³wi[PE;3,&"  "&,3;EP[iw³qbTF:0'"*4?LZiy³seXLA7/("  "(/7ALXes̽yiZL?4*"$-8DQ`pòqbTH=4,%  %,4=HTbqǶp`QD8-$'0;HVfvò~n_RE;1)"  ")1;ER_n~ϾvfVH;0'!)3?L[k|ñ|l]OC8/'    '/8CO]l|ų|k[L?3)!#,6BP_o°zj[MA6-%  %-6AM[jz˹o_PB6,#%.9EScsxgXK?4+#  #+4?KXgxоscSE9.%'1KYizʸqbSF;1(!  !(1;FSbqñziYK>3)!#,6AN\l}ij~m^PD8/&  &/8DP^m~ų}l\NA6,#%.8DQ_oνyiZMA6-%  %-6AMZiyŴo_QD8.%'0;GTbrŵsdVI>3+#  #+3>IVdsŵrbTG;0'*3>JWeu˼|m_QE:1(!  !(1:EQ_m|ŶueWJ>3*-6AMZixugYLA7.&  &.7ALYguŶxiZMA6-/9DQ^l{ö|n`SG=3+$  $+3=GS`n|ķ{l^QD9/2=HTbpŹtfYMB90(!  !(09BMYftŹpbTH=25@LXftƼyl_SH>4,%  %,4>HS_lyźtfXL@58CO\jxȾqeXMC91)"  ")19CMXeqƼxj\OC8;FS`n|wj^RH>5-&    &-5>HR^jwȾ|n`SF;>IVcrĻ~qdXMC:1*#  #*1:CMXdq~rcVI>@LYfuxk_TI?6.'!  !'.6?IT_kx¸ufYL@BN[iwƾtg[PF<4,%    %,4IVcrĻ~qdXMC:1*#  #*1:CMXdq~rcVI>;FS`n|wj^RH>5-&    &-5>HR^jwȾ|n`SF;8CO\jxȾqeXMC91)"  ")19CMXeqƼxj\OC85@LXftƼyl_SH>4,%  %,4>HS_lyźtfXL@52=HTbpŹtfYMB90(!  !(09BMYftŹpbTH=2/9DQ^l{ö|n`SG=3+$  $+3=GS`n|ķ{l^QD9/-6AMZixugYLA7.&  &.7ALYguŶxiZMA6-*3>JWeu˼|m_QE:1(!  !(1:EQ_m|ŶueWJ>3*'0;GTbrŵsdVI>3+#  #+3>IVdsŵrbTG;0'%.8DQ_oνyiZMA6-%  %-6AMZiyŴo_QD8.%#,6AN\l}ij~m^PD8/&  &/8DP^m~ų}l\NA6,#!)3>KYizʸqbSF;1(!  !(1;FSbqñziYK>3)!'171,(%"   "%(,17>FOZerƺpaTG;1( $,6ALYgv·xk`VME>83/,)'%#"  "#%'),/38>EMV`kxƻvgYLA6,$  (1;FR_l{ú~rg]TMF@;741/-+)(&$"  "$&()+-/147;@FMT]gr~ƽ{l_RF;1(  $,5?KWdrżzof]VOJEA>;86420.,)'%"  "%'),.02468;>AEJOV]fozǾrdWK?5,$  '09DP\iwǿxog`YTPLIFCA><:741/,)&#!!#&),/147:<>ACFILPTY`goxwi\PD90'   #+4>IUbo|ºyqke`\XURPMJGDA>;730,)&#!!#&),037;>ADGJMPRUX\`ekqy¹|obUI>4+#   '/8CN[guľ}wrmjfc`^[XTQMIE@<83/,(%#!  !#%(,/38<@EIMQTX[^`cfjmrw}Ľug[NC8/'   #+4=HTan{|xuspmjfb^ZUPJE@;62.*(%$##$%(*.26;@EJPUZ^bfjmpsux|ƿ{naTH=4+#   '/8CNZgtþ~zvrmga[UOIC=83/,*(''(*,/38=CIOU[agmrvz~tgZNC8/'   #+4>ITan{|uog`YRKD>941.,++,.149>DKRY`gou|¼{naTI>4+#   '09DO[gt¾|tkc[SKE>9520..0259>EKS[ckt|½tg[OD90'   $,5?IUamzwmd[RKD>96322369>DKR[dmwzmaUI?5,$  !(0:DOZfr~»wlbYPIB=965569=BIPYblw~rfZOD:0(!  %,5>IT_kvĺti_VMF@<9889<@FMV_itvk_TI>5,%  !(09CMWbmxȽ|pdZQJC?;::;?CJQZdp|xmbWMC90(!  $,4<<>BGOXco}ǹvnf_XQJD=71+%    $*/5:@GMT[bkt~̻{maVMF@<::<@FMVam{~tkb[TMG@:5/*$   #(-27=CIPX`itƶwj^SKC>:99:>CKS^jwŶti`XPIC=72-(#  !&*/49@FNV_iu;sfZPGA;8668;AGPZfsɺui_VNF@94/*&!  #',17=DLU_jv´zmaVLD=854458=DLVamzʼvj_ULD=71,'#  !%)/4;CKU_kx¶rf[PG@:521125:@GP[frƻxk_UKC;4/)%!  #'-3:BKU`lxŽvj_TKC<62/--/2672-($!!$(-27>DKQX^dhloqqpnkf`ZSLD=6/(#  "'-39@FLRVZ^```_]YUQKF@;50+'#  #'+05;@FKQUY]_```^ZVRLF@93-'"   %*05:?DHLNPQQPNKHD@;72.)%""%).27;@DHKNPQQPNLHD?:50*%   #',048<>ABCCBA?<962.*'#  #'*.269<840,'#   #'*.0356776542/,*&#  #&*,/2456776530.*'#   "%')*,,,,+*(&$"  "$&(*+,,,,*)'%"   "#####"   "#####"           !!!!   !!!!   !#%')***))'&$! !$&'))***)'%#!  "&),/13444320.,)&#  #&),.02344431/,)&"  "&*.269<>?@@?=;852.*'#  #'*.258;=?@@?><962.*&"  $).38=BFIKMNMLJGD@<73.*&""&*.37<@DGJLMNMKIFB=83.)$  !&+18>DJOTWZ\]\[XUQLGA<61,'##',1681+&!  !'-4;BIPW]cgjlmmkhd_YSLF?93.)$!!$).39?FLSY_dhkmmljgc]WPIB;4-'!  "(.5=EMV^fmsx|~~|xsng`XPIB;4.)%""%).4;BIPX`gnsx|~~|xsmf^VME=5.("  "(/6>GPZcmu}}vme\SJC;5/*&#! !#&*/5;CJS\emv}}umcZPG>6/("  #)/6?HQ\fq|{qg]TKB;4/*'%$$%'*/4;BKT]gq{|qf\QH?6/)#  $)/6?HR\ht~sh]SJA:4/+)'')+/4:AJS]hs~th\RH?6/)$   %*07?GQ\htſ~rf[QH@93/-++-/39@HQ[fr~ºth\QG?70*%   "&+17?GQ[gsǽ|ocXNE>830//038>ENXco|sg[QG?71+&"   $(-28?GPZeq~ʾwj^TJB<742247;99;>DKT^jwͿymcZQJC=72-($  !%*/5:@FLS[clwʺ{nbWNGA><<>AGNWbn{Ǹwlc[SLF@:5/*%!  !&,17=CIPV]emvξqeZQJD@>>@DJQZeqvme]VPIC=71,&!  !&,29?FLSZ`gowsg\SLFB@@BFLS\gsŷwog`ZSLF?92,&!   &,3:AHOV]dkryϿth]TMGDBBDGMT]htȼyrkd]VOHA:3,&   %+2:AIQX`gnu|̽th^UNHDCCDHNU^htʿ|ung`XQIA:2+%  #*18AIQZbjryƸrg]TMHDCCDHMT]gryrjbZQIA81*#  !'.6?HQZclt|˾{oe[SLGDBBDGLS[eo{ǿ|tlcZQH?6.'!  $,3HR]hr}ý~tjaXQJEA><<>AEJQXajt~}rh]RH>5,%  !(09CNXdoz~ulcZSLFA=;99;=AFLSZclu~zodXNC90(!  %,5>IT_jv{skc[SMFA=976679=AFMS[cks{vj_TI>5,%  !)1:DNZeq}{ung`YSLFA<85322358:62/,)'&%%&'),/26:>BGKNRUX[]_acegjmqv{{ocWK@7.&  #*3<:875320.,*'%#!!#%'*,.023578:<>@CGLRX`hr|ſ}pcVJ?5,$ !(1;FR^lzºvkaXPIC>:7420/-,+)(&%#!!#%&()+,-/0247:>CIPXakvzl^RF;1(! $-6AMZgvĺ}qf[RIB<72/,*('&$#"!  !"#$&'(*,/2770+&#   #&+07>GQ]iwŸzk\NB7-$'1;HUdsͿtfYNC:2,&" "&,2:CNYftĵsdUH;1'"+5@M\k|²rdWK@7/(#  #(/7@KWdr|k\M@5+"%.9ESbrijqbTH>4,%    %,4>HTbqʹrbSE9.%(1KYizѿwgXK?4+$  $+4?KXgwƳziYK>3)!"+5@M\k|˺sdUH=3*"  "*3=HUdsƴ|k\M@5+"$-7BO^m~ijo`RF;1(!  !(1;FR`oŴ~m^OB7-$&/9DQ`o̼zj\OC8/'    '/8CO\jzijo`QD9/&(1;GTbq³seWK?5-%  %-5?KWes³qbTG;1(*3>IVdsƸ{m_RF<3*#  #*33*,6@LYguǻsfYMB80(!  !(08BMYfs˿ugYL@6,/8CO\ixǼyl_SH>5,%  %,5>HS_lyȽxi\OC8/1;FR_lzż~qdXMC91)#  #)19CMXdq~Ƽzl_RF;13>IUbo}ļui]RG>5-&    &-5>GR]iuļ}obUI>36@LXerüymaVLB91*$  $*19BLVamyûreXL@68CN[huý~rf[QG>5.'!  !'.5>GQ[fr~»uh[NC8:EP]jxĿxlaVLB:2+%  %+2:BLValx»xj]PE:;FR_lzsh]RH?70)#  #)07?HR]hszl_RF;5.'!  !'.5>GQ[fr~»uh[NC86@LXerüymaVLB91*$  $*19BLVamyûreXL@63>IUbo}ļui]RG>5-&    &-5>GR]iuļ}obUI>31;FR_lzż~qdXMC91)#  #)19CMXdq~Ƽzl_RF;1/8CO\ixǼyl_SH>5,%  %,5>HS_lyȽxi\OC8/,6@LYguǻsfYMB80(!  !(08BMYfs˿ugYL@6,*3>IVdsƸ{m_RF<3*#  #*33*(1;GTbq³seWK?5-%  %-5?KWes³qbTG;1(&/9DQ`o̼zj\OC8/'    '/8CO\jzijo`QD9/&$-7BO^m~ijo`RF;1(!  !(1;FR`oŴ~m^OB7-$"+5@M\k|˺sdUH=3*"  "*3=HUdsƴ|k\M@5+"!)3>KYizѿwgXK?4+$  $+4?KXgwƳziYK>3)!'14,%    %,4>HTbqʹrbSE9.%"+5@M\k|²rdWK@7/(#  #(/7@KWdr|k\M@5+"'1;HUdsͿtfYNC:2,&" "&,2:CNYftĵsdUH;1'$-7BN\kzʽwi]QG>70+&#   #&+07>GQ]iwŸzk\NB7-$!(2:7420/-,+)(&%#!!#%&()+,-/0247:>CIPXakvzl^RF;1(! $,5?JVcp}|rh`XRLGC@><:875320.,*'%#!!#%'*,.023578:<>@CGLRX`hr|ſ}pcVJ?5,$  '/9CNZgsÿypha[VQNKIGECA?=;9741.+)&$!  !$&)+.1479;=?ACEGIKNQV[ahpy½sgZNC9/'   #*3:62/,)'&%%&'),/26:>BGKNRUX[]_acegjmqv{{ocWK@7.&  ")1;EP[gt}zxvtrpnlifc_[VQLGB=951.,****,.159=BGLQV[_cfilnprtvxz}tg[PE;1)"  %-5?IU`lx|yvqmgb\VPJE?;731/../137;?EJPV\bgmqvy|xl`UI?5-%  !)1:DNZeq}{ung`YSLFA<85322358IT_jv{skc[SMFA=976679=AFMS[cks{vj_TI>5,%  !(09CNXdoz~ulcZSLFA=;99;=AFLSZclu~zodXNC90(!  %,5>HR]hr}ý~tjaXQJEA><<>AEJQXajt~}rh]RH>5,%  !(09BLV`jt~Ǿ|qg]UNHD@??@DHNU]gq|½~tj`VLB90(!  $,3>@DJQZeqvme]VPIC=71,&!  !%*/5:@FLS[clwʺ{nbWNGA><<>AGNWbn{Ǹwlc[SLF@:5/*%!  $(-27=CJQZcmyówj^TKD>;99;>DKT^jwͿymcZQJC=72-($  "&*/5:AHPYdo{ɺqdYOG@;8668;@GOYdqô{odYPHA:5/*&"   $(-28?GPZeq~ʾwj^TJB<742247830//038>ENXco|sg[QG?71+&"   %*07?GQ\htſ~rf[QH@93/-++-/39@HQ[fr~ºth\QG?70*%   $)/6?HR\ht~sh]SJA:4/+)'')+/4:AJS]hs~th\RH?6/)$  #)/6?HQ\fq|{qg]TKB;4/*'%$$%'*/4;BKT]gq{|qf\QH?6/)#  "(/6>GPZcmu}}vme\SJC;5/*&#! !#&*/5;CJS\emv}}umcZPG>6/("  "(.5=EMV^fmsx|~~|xsng`XPIB;4.)%""%).4;BIPX`gnsx|~~|xsmf^VME=5.("  !'-4;BIPW]cgjlmmkhd_YSLF?93.)$!!$).39?FLSY_dhkmmljgc]WPIB;4-'!  !&+18>DJOTWZ\]\[XUQLGA<61,'##',1681+&!  $).38=BFIKMNMLJGD@<73.*&""&*.37<@DGJLMNMKIFB=83.)$  "&*.269<>?@@?=;852.*'#  #'*.258;=?@@?><962.*&"  "&),/13444320.,)&#  #&),.02344431/,)&"  !#%')***))'&$! !$&'))***)'%#!   !!!!   !!!!               !$%&'(('&%#! !#%&'(('&%$!  !$'*,.01110/-+)&#   #&)+-/01110.,*'$!   $(,0479;<=<;:852.+'#  #'+.258:;<=<;9740,($   "',16;?CFHIJIHFC@<83/+&""&+/38<@CFHIJIHFC?;61,'"  $)/5;AFKPSVXXXVTPLGB=82-)$  $)-28=BGLPTVXXXVSPKFA;5/)$   %+18?FMSY^cfhhgfc^ZTNHA;5/*%!!%*/5;AHNTZ^cfghhfc^YSMF?81+%    &,3:BJRZahnswyyxvsnhb[SLE>71+&""&+17>ELS[bhnsvxyywsnhaZRJB:3,&    &,3;DMV_hpx~xph`WOF?81,'#!!#',18?FOW`hpx~xph_VMD;3,&   !&,3;DNXblvvlcYPG?82,(%#""#%(,28?GPYclvvlbXND;3,&!  !&,3;DNXcnzyndYPG?82-)'&&')-28?GPYdnyzncXND;3,&!  "',3;CMWco{¾zncXNF>72.+**+.27>FNXcnzÿ{ocWMC;3,'"  #'-3:BLVamzylaVLD=730..037=DLValyùzmaVLB:3-'#   $).4:BKT_kxŹui]SJB<743347DJPW]elu~wkaXPKGEEGKPXakwȻ~ule]WPJD>82,'"  "'-39@FLSY`fmu}ymcZSMIGGIMSZcmyʽ}umf`YSLF@93-'"  !&,3:AGNU\biov}znd[TOKIIKOT[dnzʾ}voib\UNGA:3,&!  %+29AHPW^elrx~ɼynd\UOLJJLOU\dnyȽ~xrle^WPHA92+%  #)08@HPX`gnu{¶wmc[TOLJJLOT[cmwĻ{ung`XPH@80)#  !'.6>FOW`hpw}ĺtjaYSNKIIKNSYajtž}wph`WOF>6.'!  $+3;DMV_hpxzpf^WQLIHHILQW^fpz¼xph_VMD;3+$  !(08@JS]foxÿ}sjbZSNJGEEGJNSZbjs}¾xof]SJ@80(!  %,4=FPZdmw}uld\UOJFDBBDFJOU\dlu}wmdZPF=4,%  ")19BLV`ku~{sld]VPJFB@??@BFJPV]dls{~uk`VLB91)"  &-6?HR]gr||voib\UOJEA><;;<>AEJOU\biov||rg]RH?6-&  #*2;DOYdoy~|zvsnid^YSMHC?<976679HR]it~xsnkhfdcba`_^\ZXUQNJFB>:630.-,,-.036:>BFJNQUXZ\^_`abcdfhknsx~ti]RH>4,%  ")1;DOZfr}~vpid`\ZWVUTSRQOMKIFC@=:630-+)(''()+-036:=@CFIKMOQRSTUVWZ\`dipv~}rfZOD;1)"  &.7ALWco{xpha[VROLJIGFEDCB@><:752/,*'&$#""#$&'*,/257:<>@BCDEFGIJLORV[ahpx{ocWLA7.& $+4>IT`mz}sjaZSMIEB@>=;;:986531/-+(&$"  "$&(+-/135689:;;=>@BEIMSZajs}zm`TI>4+$ !(1:EQ]jwþyoe[SLFA<9753210//.,+*(&$"  "$&(*+,.//01235795-&!  !&-5>HTbp˺sbSE9.%(1=JXhyƵpaTG=3+$  $+3=GTapñyhXJ=1(!*4@N]mɷpaSG<2*#  #*25-&  &-5>HS_lyŸ~oaSG<2)+4>IUbp~ǽ~qeYNC:2*$  $*2:CNYeq~~pbUI>4+-6@KWdrĻui]RH?6.'!  !'.6?HR]iużrdWK@6-/8BMYfsymbWLC:2+%  %+2:CLWbmysfYMB8/0:DP\hu{pe[PG>6/("  "(/6>GP[ep{uh\PD:0270)$  $)07>FOYcmxxl_SH=45?IUamy}sh^UKC;4-'"  "'-4;CKU^hs}ymaUI?56@JVbnzyoe[RIA92,&!  !&,29AIR[eoyznbVJ@66@KVbo{xmcYPG?81+%    %+18?GPYcmx{obVK@66@KVbo{xmcYPG?81+%    %+18?GPYcmx{obVK@66@JVbnzyoe[RIA92,&!  !&,29AIR[eoyznbVJ@65?IUamy}sh^UKC;4-'"  "'-4;CKU^hs}ymaUI?54=HS_lxxmcYOF>70)$  $)07>FOYcmxxl_SH=426/("  "(/6>GP[ep{uh\PD:0/8BMYfsymbWLC:2+%  %+2:CLWbmysfYMB8/-6@KWdrĻui]RH?6.'!  !'.6?HR]iużrdWK@6-+4>IUbp~ǽ~qeYNC:2*$  $*2:CNYeq~~pbUI>4+)25-&  &-5>HS_lyŸ~oaSG<2)'0:ER_n}ʼseXLB8/(!  !(/8BLXesɻ}n_RE:0'%.8CP^m}Ǹzk]QE;2*#  #*2;EQ]kz;}m^PC8.%$,6BN]l|²pbTH=4+$  $+4=HTbp|l]NB6,$"+5@M[k|ʹufXK@5-%  %-5@KXfuIJ|k[M@5+"!)3?KZj{yi[MA7.&  &.7AM[iyų{jZK?3)! (2=JXhzŲ|l]OC8/'    '/8CO]l|ƲzhXJ=2( &0;HVfxȵ~n^QD90(!  !(09DQ^n~űxfVH;0&%.9FTduʷo`RE:0(!  !(0:ER`o®udTF9.%#,7CQ`qʷp`RF;1)"  ")1;FR`pѾq`QC7,#!*4@N]mɷpaSG<2*#  #*25-&!  !&-5>HTbp˺sbSE9.%"+5AN\l|qcVJ@7/(# #(/7@JVcq|l\NA5+" (1IT`mz}sjaZSMIEB@>=;;:986531/-+(&$"  "$&(+-/135689:;;=>@BEIMSZajs}zm`TI>4+$ &.7ALWco{xpha[VROLJIGFEDCB@><:752/,*'&$#""#$&'*,/257:<>@BCDEFGIJLORV[ahpx{ocWLA7.&  ")1;DOZfr}~vpid`\ZWVUTSRQOMKIFC@=:630-+)(''()+-036:=@CFIKMOQRSTUVWZ\`dipv~}rfZOD;1)"  %,4>HR]it~xsnkhfdcba`_^\ZXUQNJFB>:630.-,,-.036:>BFJNQUXZ\^_`abcdfhknsx~ti]RH>4,%   '/8AKValw|yvusrrqponmjhea]YTOJFA=9642112469=AFJOTY]aehjmnopqrrsuvy|wlaVKA8/'   #*2;DOYdoy~|zvsnid^YSMHC?<976679<;;<>AEJOU\biov||rg]RH?6-&  ")19BLV`ku~{sld]VPJFB@??@BFJPV]dls{~uk`VLB91)"  %,4=FPZdmw}uld\UOJFDBBDFJOU\dlu}wmdZPF=4,%  !(08@JS]foxÿ}sjbZSNJGEEGJNSZbjs}¾xof]SJ@80(!  $+3;DMV_hpxzpf^WQLIHHILQW^fpz¼xph_VMD;3+$  !'.6>FOW`hpw}ĺtjaYSNKIIKNSYajtž}wph`WOF>6.'!  #)08@HPX`gnu{¶wmc[TOLJJLOT[cmwĻ{ung`XPH@80)#  %+29AHPW^elrx~ɼynd\UOLJJLOU\dnyȽ~xrle^WPHA92+%  !&,3:AGNU\biov}znd[TOKIIKOT[dnzʾ}voib\UNGA:3,&!  "'-39@FLSY`fmu}ymcZSMIGGIMSZcmyʽ}umf`YSLF@93-'"  "',28>DJPW]elu~wkaXPKGEEGKPXakwȻ~ule]WPJD>82,'"  "&+1672.+**+.27>FNXcnzÿ{ocWMC;3,'"  !&,3;DNXcnzyndYPG?82-)'&&')-28?GPYdnyzncXND;3,&!  !&,3;DNXblvvlcYPG?82,(%#""#%(,28?GPYclvvlbXND;3,&!   &,3;DMV_hpx~xph`WOF?81,'#!!#',18?FOW`hpx~xph_VMD;3,&    &,3:BJRZahnswyyxvsnhb[SLE>71+&""&+17>ELS[bhnsvxyywsnhaZRJB:3,&    %+18?FMSY^cfhhgfc^ZTNHA;5/*%!!%*/5;AHNTZ^cfghhfc^YSMF?81+%   $)/5;AFKPSVXXXVTPLGB=82-)$  $)-28=BGLPTVXXXVSPKFA;5/)$  "',16;?CFHIJIHFC@<83/+&""&+/38<@CFHIJIHFC?;61,'"   $(,0479;<=<;:852.+'#  #'+.258:;<=<;9740,($   !$'*,.01110/-+)&#   #&)+-/01110.,*'$!  !$%&'(('&%#! !#%&'(('&%$!                   !#$%%%$#"   "#$%%%$#!   "%'*,-...-,*(&#   #&(*,-...-,*'%"  "&*-14689998641.+'$! !$'+.14689998641-*&"   %*.37;?BDEEEDB?<840,'##',04894/*&!!&*/49>CGKOQSSSQOKGC=82-'"  #)/5FNU\chmprsrpmhc\VOHA:4.)$  $).4:AHOV\chmprsrpmhc\UNF>70)#  #)08@HQZbjrx}}xrkc[SKC<5/*%""%*/5;99;>CIQZep}ʾylaVLD<50*&"  #',16>@CIOWalxǺti^TKC<61,'#  !%).28=DKS[ep|ŷsg]UNHECCEHNU]gs|pe[SKD=82.)%!  "&+/4:?EKRZclw̾xmbZRMIHHIMRZbmxǹwlcZRKE?:4/+&"  "',16;AGMSZbjs}³}qg^WQMKKMQW^gq}ʽ}sjbZSMGA;61,'"  "',28=CIOU[biqyĶtjaZTQOOQTZajt˾yqib[UOIC=82,'"  !',28>EKQW]cipwövlc\WSQQSW\clvʾwpic]WQKE>82,'!   &,28?FLRY_ejpv}wme^XUSSUX^emwƻ}vpje_YRLF?82,&   $*18?FMTZaglrw|Ǽvme^YUTTUY^emv|wrlgaZTMF?81*$  ")/6>EMT[bhnsx}ȿ~tkd]XUSSUX]dkt~}xsnhb[TME>6/)"   &-4;8520/../0258;>BEHKNPQSTTTTTTUUVXZ^bglszvk`VKA80(!  %-6?IT_juvng`ZUQNLJIIHHHHHGFECA?<9641.,+))))+,.1469>>===<<;98641/-*(&%$$$$%&(*-/14689;<<===>>>?ACFINTZbjs}ui]RG<3*#  '09DO[gt{qg^UNHB>;875544433221/.,*(&$"!  !"$&(*,./122334445578;>BHNU^gq{tg[OD90'  $,6@KXer{odZQIB=841/.-,,+++**)('%$"  "$%'()**+++,,-./148=BIQZdo{reXK@6,$ (183/,)'&%%%$$##"!  !"##$$%%%&'),/38>FNXcn{ƾ}oaSG<1( $,6BN[jyɾ{naVLC;4/*'$"!  !"$'*/4;CLVan{yj[NB6,$'1;HUcsŷ|naUJA81,'#  #',18AJUan|³scUH;1'"+5@M\k|˽~oaTI?7/)$   $)/7?ITao~ο|k\M@5+"%.9ESbr±pbTI>5.'" "'.5>ITbpʹrbSE9.%'15-&!  !&-5>IUbqðyhXI<1'!*4?M\l~ʸrcUI>4,%    %,4>IUcrʷ~l\M?4*!#,6BP`p̺scUI>4,%  %,4>IUcsнp`PB6,#$-8ESbtͺscUI=4,%  %,4=IUcstbSE8-$%/:FUev̹rcUH=4+$  $+4=HUcrïveUF:/%'0;HVfwɷqbTH=3+$  $+3=HTbqİwfVH;0' (1=IWgxųo`SG<2*#  #*2JXhxϿ{l^QE;2*#  #*2;EQ^l{xhXJ>3)!"*4?KYhxǷwh[NC90)"  ")09CN[hwͽxhYK?4*"#+5@LYhw̽rdWKA7/'!  !'/7AKWdrȹwhYL@5+#$,6AMZhwzl_SH>5-&    &-5>HS_lzõwhZMA6,$%.7BNZhvrfZND;2+$  $+2;DNZfrȽvhZNB7.%'/9CO[hvǾwk_TJ@80)"  ")08@JT_kwvh[OC9/'(1:EP\ivzocYNE<4-&!  !&-471+&!  !&+17>EMU]foxxmbWLB8//8BLWbmx~vmd[SKD<60*%    %*0671+&!  !&+17>EMU]foxxmbWLB8/.7AKValw|si`XOG@92,'"  "',29@GOX`is|wlaVKA7..6@JU`lwxoe\TKC<5/)#  #)/55-&    &-5>HS_lzõwhZMA6,$#+5@LYhw̽rdWKA7/'!  !'/7AKWdrȹwhYL@5+#"*4?KYhxǷwh[NC90)"  ")09CN[hwͽxhYK?4*"!)3>JXhxϿ{l^QE;2*#  #*2;EQ^l{xhXJ>3)! (1=IWgxųo`SG<2*#  #*24,%  %,4>IUcsнp`PB6,#!*4?M\l~ʸrcUI>4,%    %,4>IUcrʷ~l\M?4*!'15-&!  !&-5>IUbqðyhXI<1'%.9ESbr±pbTI>5.'" "'.5>ITbpʹrbSE9.%"+5@M\k|˽~oaTI?7/)$   $)/7?ITao~ο|k\M@5+"'1;HUcsŷ|naUJA81,'#  #',18AJUan|³scUH;1'$,6BN[jyɾ{naVLC;4/*'$"!  !"$'*/4;CLVan{yj[NB6,$ (183/,)'&%%%$$##"!  !"##$$%%%&'),/38>FNXcn{ƾ}oaSG<1( $,6@KXer{odZQIB=841/.-,,+++**)('%$"  "$%'()**+++,,-./148=BIQZdo{reXK@6,$  '09DO[gt{qg^UNHB>;875544433221/.,*(&$"!  !"$&(*,./122334445578;>BHNU^gq{tg[OD90'  #*3>>===<<;98641/-*(&%$$$$%&(*-/14689;<<===>>>?ACFINTZbjs}ui]RG<3*# %-6?IT_juvng`ZUQNLJIIHHHHHGFECA?<9641.,+))))+,.1469;8520/../0258;>BEHKNPQSTTTTTTUUVXZ^bglszvk`VKA80(!  #*2:DMXblv~xsnjgdcbaabbbbba`^\YVROKGC?<96544569EMT[bhnsx}ȿ~tkd]XUSSUX]dkt~}xsnhb[TME>6/)"  $*18?FMTZaglrw|Ǽvme^YUTTUY^emv|wrlgaZTMF?81*$   &,28?FLRY_ejpv}wme^XUSSUX^emwƻ}vpje_YRLF?82,&   !',28>EKQW]cipwövlc\WSQQSW\clvʾwpic]WQKE>82,'!  "',28=CIOU[biqyĶtjaZTQOOQTZajt˾yqib[UOIC=82,'"  "',16;AGMSZbjs}³}qg^WQMKKMQW^gq}ʽ}sjbZSMGA;61,'"  "&+/4:?EKRZclw̾xmbZRMIHHIMRZbmxǹwlcZRKE?:4/+&"  !%).28=DKS[ep|ŷsg]UNHECCEHNU]gs|pe[SKD=82.)%!  #',16>@CIOWalxǺti^TKC<61,'#  "&*05;99;>CIQZep}ʾylaVLD<50*&"   $)/5FNU\chmprsrpmhc\VOHA:4.)$  $).4:AHOV\chmprsrpmhc\UNF>70)#  #)/594/*&!!&*/49>CGKOQSSSQOKGC=82-'"   %*.37;?BDEEEDB?<840,'##',048CFJLMNMLJFC?:51,'##',15:?CFJLMNMLJFC>94/*$    &+18>DJOTWZ\\\ZWTOJE@:4/*%!!%*/4:@EJOTWZ\\\ZWTOJD>81+&   !&,3:AHPV\bfiklkifb]WQKD=71,'##',17=DKQW]bfiklkifb\VPHA:3,&!  !&-4;CKT\dkqvy|||yvqke^VOG@93.)$!!$).39@GOV^ekqvy|||yvqkd\TKC;4-&!   &,4;DMV`iqy{skcZRJB;5/*&#! !#&*/5;BJRZcks{yqi`VMD;4,&    %,3;CMWalvypf]TKC<60,)'&&'),0695211259>ELU_itwk_TJ@81*%    %*07?GQ\htsh^TLE?;8778;?ELT^hsļth\QG?70*%   !%*06=ENYdp}ź}rg]TLFA>==>AFLT]gr}Ⱦ}pdYNE=60*%!  "&+06CIPW_hr}öxne^YUSSUY^enxʽ}rh_WPIC>94/*&!  "&+05:?EJPV]emvƺ|rjb]YWWY]bjr|ʾvme]VPJE?:50+&"  !&+16;AFKQW]cjrzǻvmf`][[]`fmvȼzrjc]WQKFA;61+&!  !&+16==>@BEILPTX\_bdefffedca`_^^^_adhlqv{|umd[RH?7/(!  &-5>GQ[dnw{tnhc^ZWUTSSTTVWXXYYXWVTQNKGDA>;977779;>ADGKNQTVWXYYXXWVTTSSTUWZ^chnt{wnd[QG>5-&  $+3IUbo|~sh^UMF?:7410/////000//.-+)(&$#!  !#$&()+-.//000/////0147:?FMU^hs~|obUI>4+# '0:EQ^lzth^TKC<72/,*)((((((((''&$#"  "#$&''(((((((()*,/27KZj|ɸteWK@7/(#  #(/7@KWetǴ|jZK>3) "*5AN^nͻufXLA7/("  "(/7ALXfuͺn^NA5*"#,7CQ`qμwgYMA8/("  "(/8AMYgwѾq`QC7,#$-8DRbsμwhZMB80("  "(08BMZhwҿsbRD8-$%.9FTct̻vgYMB80("  "(08BMYgvҿtcTF9.%&/:FTdtɸufYLA8/("  "(/8ALYfuоtdTF:/&'0;GTctósdWKA7/(!  !(/7AKWds̻tcTG;0' '1;GTcs˼~obUJ?6.'!  !'.6?JUbo~ǷscTG;1' (15-&    &-5>GR^kyqbTG<1( !)26/("  "(/6>GQ[fr~{m`TH=3+#$,4>HT`ly¾uj`VLC;3,&    &,3;CLV`ju¾yl`TH>4,$%-5?IT_kwwmcYPG?80*$  $*08?GPYcmwwk_TI?5-%&.6@JT_jvxne\SKC;4.("  "(.4;CKS\enxvj_TJ@6.&'/7@JU_juxpg^VNF?81+&    &+18?FNV^gpxuj_UJ@7/'(/8AKU`jt~yqiaYQIB;5/)$  $)/5;BIQYaiqy~tj`UKA8/((09BLV`jt}{skd\TMF?92-'"  "'-29?FMT\dks{}tj`VLB90()19BLV`js|~voh`YQJC=71+&!  !&+17=CJQY`hov~|sj`VLB91))19CLV`js|{tmf^WPIB<60+%!  !%+06HT`ly¾uj`VLC;3,&    &,3;CLV`ju¾yl`TH>4,$#+3=HT`m{ž~rf[QG>6/("  "(/6>GQ[fr~{m`TH=3+#"*3=HTan}¸ymaVKB91*$  $*19BKVamy}naTH=3*"!)25-&    &-5>GR^kyqbTG<1( '1;GTcs˼~obUJ?6.'!  !'.6?JUbo~ǷscTG;1' '0;GTctósdWKA7/(!  !(/7AKWds̻tcTG;0'&/:FTdtɸufYLA8/("  "(/8ALYfuоtdTF:/&%.9FTct̻vgYMB80("  "(08BMYgvҿtcTF9.%$-8DRbsμwhZMB80("  "(08BMZhwҿsbRD8-$#,7CQ`qμwgYMA8/("  "(/8AMYgwѾq`QC7,#"*5AN^nͻufXLA7/("  "(/7ALXfuͺn^NA5*" )3>KZj|ɸteWK@7/(#  #(/7@KWetǴ|jZK>3) &0;HVfwŴrcVJ@7/(# #(/7@JVcrѿwfVH;0&$-8DQ`pο~oaUI?7/)$   $)/7?IUao~Ƕp`QD8-$"*4?LZiyǸ{m`TI?70*&""&*07?IT`m{ʼyiZL?4*"'0:FSbqʿyk^SI@81,($"  "$(,18@IS^kyʽqbSF:0'#,5@LZhvvi^SIA:4/+(&$##""""""!  !""""""##$&(+/4:AIS^ivƼvhZL@5,# '0:EQ^lzth^TKC<72/,*)((((((((''&$#"  "#$&''(((((((()*,/27IUbo|~sh^UMF?:7410/////000//.-+)(&$#!  !#$&()+-.//000/////0147:?FMU^hs~|obUI>4+# &.8BLXdp||ri_WPID?<:8777778888876431/-*)'&%$$%&')*-/1346788888777778:GQ[dnw{tnhc^ZWUTSSTTVWXXYYXWVTQNKGDA>;977779;>ADGKNQTVWXYYXXWVTTSSTUWZ^chnt{wnd[QG>5-&  !(/7?HR[dmu|{vqlhda_^^^_`acdefffedb_\XTPLIEB@>==>@BEILPTX\_bdefffedca`_^^^_adhlqv{|umd[RH?7/(!  #)18AIR[dlsz|xtqnkiihijkmoqrstttsqnkgc^ZUQMIFDCCDFIMQUZ^cgknqstttsrqomkjihiiknqtx|zsld[RIA81)#  $+2:BJS[ckrw|}zxutsrrsuwy{~~{wrmhc]XTPMKJJKMPTX]chmrw{~~{ywusrrstuxz}|wrkc[SJB:2+$   &-4CIPW_hr}öxne^YUSSUY^enxʽ}rh_WPIC>94/*&!  !%)-27=CIQYblxʾ}rh`YTPNNPTY`hr}ǺxlbYQIC=72-)%!   #(,16==>AFLT]gr}Ⱦ}pdYNE=60*%!   %*07?GQ\htsh^TLE?;8778;?ELT^hsļth\QG?70*%    %*18@JT_kwti_ULE>95211259>ELU_itwk_TJ@81*%    %+29BLValw}sh^ULD=72/,++,/27=DLU^hs}wlaVLB92+%    %,3;CMWalvypf]TKC<60,)'&&'),06DJOTWZ\\\ZWTOJE@:4/*%!!%*/4:@EJOTWZ\\\ZWTOJD>81+&    $*/49>CFJLMNMLJFC?:51,'##',15:?CFJLMNMLJFC>94/*$   "'+047;=?@A@?=;840,(%!!%(,048;=?@A@?=;740+'"   #'*-024555420.+(%! !%(+.024555420-*'#    "%')*+++*)'%#   #%')*+++*)'%"   !"""""!  !"""""!                         "$%''(''&$"   "$&''(''%$"   !$'*,.01110.-*(%" "%(*-.01110.,*'$!   $(,0369:;<;:9640-)&" "&)-0469:;<;:9630,($   !&+059=ADFHHHFDB>:62.)%!!%).26:>BDFHHHFDA=950+&!  #(-39?DIMQSUUUTQNJFA<71,($  $(,17EMU\chmqstsqnje_YRKD>82,($!!$(,28>DKRY_ejnqstsqmhc\UME>6/)#  "(/6>GOXaipw|~ztmf_WOHA:4/*'$"!!"$'*/4:AHOW_fmtz~|wpiaXOG>6/("  "(.6>FPYcmv~|tlcZRJC<61-*(''(*-166.("  !'-4840.--.048>ELT]fpyyndYOE<4-'!   &,3:CMWbmy|rh_VMF@;753357;@FMV_hr|ymbWMC:3,&    %+18AJT_jw¾~si_WOHC>;::;>CHOW_is~½wj_TJA81+%   !%*06>GP[frƾ~si`WPJFCAACFJPW`is~úrf[PG>60*%!  !%*/5CHLQVZ_ejqx|vpmkkmpv|ĺxqje_ZVQLHC>94.)$   #).39>DINRW[_chlrx~ļ|vqmllmqv|û~xrlhc_[WRNID>93.)#  "(-39?DJOSX\_cfjnrw|ý{upmkkmpu{ſ|wrnjfc_\XSOJD?93-("  !&,28>DJPUY]adgilnquy~xrnjiijnrx¿~yuqnligda]YUPJD>82,&!   %+17>DJPV[_cfhjlmoqsuy|ztnjgeegjntz|yusqomljhfc_[VPJD>71+%   $*06=DJQW\aehjlmnnoopqsvy}ztniebaabeintz}yvsqpoonnmljhea\WQJD=60*$  #(/5??>=<:8641/-,+**+,-/1468:<=>??>=<;:98889:=@EKQXair|vj_TI?5-% "*2JWdr}qeZPG?93/,)('&&&'''''&&%$"!  !"$%&&'''''&&&'(),/39?GPZeq}ƿrdWJ>4*"%.9DQ^m|øuh\QH?82-)'$#"""!"!!!!  !!!!"!"""#$')-28?HQ\hu÷|m^QD9.%!)2=JWfvyk_SI@81,($"  "$(,18@IS_kyĶvfWJ=2)!#,6BO]m}ɻ}oaUJA81,'#  #',18AJUao}}m]OB6,#%.9FScs²rdWLB92+&" "&+29BLWdr˺scSF9.%'1LZk|̻xj\PE;3,&"  "&,3;EP\jxǵ|kZL>3) "*4@N]mϾzk^QF<4-'!  !'-45-'!  !'-5>HS`m|̹p_PB6,#$-7CP_o̼{m_SH>5.'!  !'.5>HS_m{ɷo_PC7-$$-7CP_nǸzl^RH>5-'!  !'-5>HR^lzŴn_PC7-$%-7CO^m}wi]QG=4-&!  !&-4=GQ]iw}m^OC7-%%-7BO\kzŸsfZOE<3,&    &,36/("  "(/6>FPYdozĿ~qdXLA7.& '/7ALWbnz|rh^TKC;3,&!  !&,3;CKT^hr|znbWLA7/' '/8AKValw}tjaXPG?81*$  $*18?GPXajt}wlaVKA8/' !(08AKU_jt~|tlc[SKC<5.(#  #(.582,'"  "',28>DJQW^djpv||une]TKB91*##*1:BKT]emu{~ytnhb\VOIC=71,'"  "',17=CIOV\bhnty~{ume]TKB:1*##*1:BKT]emu{~ytnhb\VOIC=71,'"  "',17=CIOV\bhnty~{ume]TKB:1*##*19BKT]enu||vpjd^WQJD>82,'"  "',28>DJQW^djpv||une]TKB91*##*19BKT]fow~ztnhaZTMF@:4.(#  #(.4:@FMTZahntz~wof]TKB91*#")19AKT^gpx{tmf_XQJC<60*%    %*066/("  "(/6>FPYdozĿ~qdXLA7.&&.7BMYftĺui^TJA80*#  #*08AJT^iutfYMB7.&%.7BN[iwƻ{ocWMC:2+%  %+2:CMWco{ʿwi[NB7.%%-7BO\kzŸsfZOE<3,&    &,35-'!  !'-5>HR^lzŴn_PC7-$$-7CP_o̼{m_SH>5.'!  !'.5>HS_m{ɷo_PC7-$#,6BP_pϾ|m`SH>5-'!  !'-5>HS`m|̹p_PB6,#"+6BO^oп|m_RG=5-'"  "'-5=GR_m|̺o^OB6+""*4@N]mϾzk^QF<4-'!  !'-4LZk|̻xj\PE;3,&"  "&,3;EP\jxǵ|kZL>3) '1JWdr}qeZPG?93/,)('&&&'''''&&%$"!  !"$%&&'''''&&&'(),/39?GPZeq}ƿrdWJ>4*"&/8CO[huyncYPG@:62/-,,+,,--...--,*)'&$"!  !"$&')*,--...--,,+,,-/26:@GPYcnyuh[OC8/& "*2??>=<:8641/-,+**+,-/1468:<=>??>=<;:98889:=@EKQXair|vj_TI?5-%  '/8AKU_jt}xphaYSMIEB@??@ABCEFGHIIHGECA?<975321123579DJPV[_cfhjlmoqsuy|ztnjgeegjntz|yusqomljhfc_[VPJD>71+%   !&,28>DJPUY]adgilnquy~xrnjiijnrx¿~yuqnligda]YUPJD>82,&!  "(-39?DJOSX\_cfjnrw|ý{upmkkmpu{ſ|wrnjfc_\XSOJD?93-("  #).39>DINRW[_chlrx~ļ|vqmllmqv|û~xrlhc_[WRNID>93.)#   $).49>CHLQVZ_ejqx|vpmkkmpv|ĺxqje_ZVQLHC>94.)$    %*.38=BGLPV[ahox·{tnkiiknt{xoha[VPLGB=83.*%   !%).37GP[frƾ~si`WPJFCAACFJPW`is~úrf[PG>60*%!   %+18AJT_jw¾~si_WOHC>;::;>CHOW_is~½wj_TJA81+%    &,3:CMWbmy|rh_VMF@;753357;@FMV_hr|ymbWMC:3,&   !'-4840.--.048>ELT]fpyyndYOE<4-'!  "(.6>FPYcmv~|tlcZRJC<61-*(''(*-166.("  "(/6>GOXaipw|~ztmf_WOHA:4/*'$"!!"$'*/4:AHOW_fmtz~|wpiaXOG>6/("  #)/6>EMU\chmqstsqnje_YRKD>82,($!!$(,28>DKRY_ejnqstsqmhc\UME>6/)#  #)/5:62.)%!!%).26:>BDFHHHFDA=950+&!   $(,0369:;<;:9640-)&" "&)-0469:;<;:9630,($   !$'*,.01110.-*(%" "%(*-.01110.,*'$!   "$%''(''&$"   "$&''(''%$"                             !"#$$$#"!  !"#$$$#"!  !$&(*,,--,+)'$" "$')+,--,,*(&$!   $(+/1456776420-*&#   #&*-0246776541/+($   #',048;>@BBBA?=:63/+'#  #'+/36:=?ABBB@>;840,'#  $)/49>CGJLNONMKHEA=84/*&""&*/48=AEHKMNONLJGC>94/)$   %*07=CINSWZ[\\[XUQMHC=83.)%!!%).38=CHMQUX[\\[ZWSNIC=70*%   %+18?FMTZ`dhjkkigc_ZTNHB<61,($!!$(,16GQ[dnx}umd\TMF?:620//026:?FMT\dmu}xnd[QG>6/("  !'-4:8668:>CIOW_hqzyncYOE<4-'!   %+2:BLValw~tkbYRLFB@>>@BFLRYbkt~wlaVLB:2+%    %*07?HR\ht½vld\UOKHFFHKOU\dlvth\RH?70*%    $).5ENWalxxpid`^^`dipx·xlaWNE>82-)%!  "%)-27BFJMQUZ^djqxƾ{yy{xqjd^ZUQMJFB>950,'#  "'+05:?CGKNRUX\_dinu|~{yy{~ľ|unid_\XURNKGC?:50+'"  !&+05:?DHLPSUX[]`cgkpv}ÿ|ywwy|½}vpkgc`][XUSPLHD?:50+&!   %+05;@EJNQTWY[]^`behlpu{}xussux}{uplheb`^][YWTQNJE@;50+%    %*05;AFKPSWY[]^__`abdgjnsx~|wspoopsw|~xsnjgdba`__^][YWSPKFA;50*%   $*06FNV]djptwyyywtplgb]YTQNLLLLNPSVY]`cegiiihfc`\YUQNLJIIJLNQUY\`cfhiiigec`]YVSPNLLLLNQTY]bglptwyyywtpjd]VNF>6/("   '.6>FOX`hpv{~zupjd^XSNKHFEEFGILOQTWY[\]\[ZXUROKHECBAABCEHKORUXZ[\]\[YWTQOLIGFEEFHKNSX^djpuz~{vph`XOF>6.'   %-5=FPYclt|{umf_XRMHDA@???ACEGJLNOPQQPOMJHEB?=;:99:;=?BEHJMOPQQPONLJGECA???@ADHMRX_fmu{|tlcYPF=5-% #*3;:99:;<>@BDEFFFEDC@><975321123579<>@CDEFFFEDB@><;:99:;>AFLRYairzyodZOE<3*#  (09CNYep{wnd[SLE@;8543445789;<<==<;97531/-,+**+,-/13579;<==<<;9875443458;@ELS[dnw{peYNC90(  $,6@KWcp|}rh^ULE?:520////01234444321/.,*(&%$$$$%&(*,./12344443210////025:?ELU^hr}|pcWK@6,$!(1;GS`m{þxlaWNF?940.,+**++,,----,+*('%#"  "#%'(*+,----,,++**+,.049?FNWalx½{m`SG;1(!$,6AMZhwĻ~qeZPG?93/,)('&&&'''''&&%#"!!"#%&&'''''&&&'(),/39?GPZeq~ĺwhZMA6,$'0;FTbqƺwj^SIA:4/+(&$##"""""!!  !!"""""##$&(+/4:AIS^jwȼqbTF;0'!*4?KYhxĶ|obVLC;4/*'$"!  !"$'*/4;CLVbo|ȹxhYK?4*!$,7CP^n;sfZOE<5/*&#!!#&*/570+&#   #&+07>GQ]jx˺scTF9/%'0KZj{seYMC;3,'"  "',3;CMYesIJ{jZK>3)!!)3?LZj{tfZOD<4-'"  "'-4JXfvŷreZOE<4-&!  !&-43*""*3=IVdrɽ|ocXND;3,&    &,3;DNXco|˾rdVI=3*""*26/("  "(/6>FOYcmxth\PE;2)"")1:DNYdp{{qg^ULC;4-'!  !'-4;CLU^gq{{pdYND:1)"")1:CMWalv|sjbYPH@91+%    %+19@HPYbjs|vlaWMC:1)"#)19BKU_hr{{tld\TLD=6/)#  #)/6=DLT\dlt{{rh_UKB91)##*19AJS\env~zsle^WOHA:3-'"  "'-3:AHOW^elsz~vne\SJA91*##*19AIR[cksy}xsmf`YRLE>71+&    &+17>ELRY`fmsx}yskc[RIA91*#$*19AIQYaipv|{wrmgb\UOHB<5/*$  $*/571+&    &+17>ELRY`fmsx}yskc[RIA91*##*19AJS\env~zsle^WOHA:3-'"  "'-3:AHOW^elsz~vne\SJA91*##)19BKU_hr{{tld\TLD=6/)#  #)/6=DLT\dlt{{rh_UKB91)#")1:CMWalv|sjbYPH@91+%    %+19@HPYbjs|vlaWMC:1)"")1:DNYdp{{qg^ULC;4-'!  !'-4;CLU^gq{{pdYND:1)"")2;EP\ht¾xmcYOF>6/("  "(/6>FOYcmxth\PE;2)"")2JXfvŷreZOE<4-&!  !&-43*""*4?KYhx˼tg[OE<4-'"  "'-4KZj{seYMC;3,'"  "',3;CMYesIJ{jZK>3)! (2=JYhyϿpcWLB92,'"  "',29BLWcpñyhYJ=2( '070+&#   #&+07>GQ]jx˺scTF9/%$,7CP^n;sfZOE<5/*&#!!#&*/5;:99:;<>@BDEFFFEDC@><975321123579<>@CDEFFFEDB@><;:99:;>AFLRYairzyodZOE<3*# %-5=FPYclt|{umf_XRMHDA@???ACEGJLNOPQQPOMJHEB?=;:99:;=?BEHJMOPQQPONLJGECA???@ADHMRX_fmu{|tlcYPF=5-%   '.6>FOX`hpv{~zupjd^XSNKHFEEFGILOQTWY[\]\[ZXUROKHECBAABCEHKORUXZ[\]\[YWTQOLIGFEEFHKNSX^djpuz~{vph`XOF>6.'   "(/6>FNV]djptwyyywtplgb]YTQNLLLLNPSVY]`cegiiihfc`\YUQNLJIIJLNQUY\`cfhiiigec`]YVSPNLLLLNQTY]bglptwyyywtpjd]VNF>6/("  #)/6=ELSZ`ejmpqqpnlhea]ZWTSRRSUWZ^aeimpsuvvvtrokgc_[WUSRRSUW[_cgkortvvvuspmiea^ZWUSRRSTWZ]aehlnpqqpmje`ZSLE=6/)#  #)/6=DJQW\aehijjihec`^[ZXXXY[^aeinrw{~~{wrmid`][ZZ[]`dimrw{~~{wrniea^[YXXXZ[^`cehijjihea\WQJD=6/)#  $)06BFJMQUZ^djqxƾ{yy{xqjd^ZUQMJFB>950,'#  #',049=AEINRW]cjr{~zxxz~{rjc]WRNIEA=940,'#  #'+/48<@EJOU[bjs|{xvvx{Ⱦ|sjb[UOJE@<84/+'#  #'+/37;@EKQX`is}Ⱦ}wsqqsw}÷}si`XQKE@;73/+'#  "&*.27ENWalxxpid`^^`dipx·xlaWNE>82-)%!   $).3:AIR\hsȿxoga\XWWX\agoxƽsh\RIA:3.)$    $).5>@BFLRYbkt~wlaVLB:2+%   !'-4:8668:>CIOW_hqzyncYOE<4-'!  "(/6>GQ[dnx}umd\TMF?:620//026:?FMT\dmu}xnd[QG>6/("  #)08@HQZclt{|voh`XQIC<72.+)(()+.27CGJLNONMKHEA=84/*&""&*/48=AEHKMNONLJGC>94/)$  #',048;>@BBBA?=:63/+'#  #'+/36:=?ABBB@>;840,'#   $(+/1456776420-*&#   #&*-0246776541/+($   !$&(*,,--,+)'$" "$')+,--,,*(&$!  !"#$$$#"!  !"#$$$#"!                           !!    !!    "$&'()(('%$" "$%'(()('&$"   !$'*,/012210.,)'$! !$'),.012210/,*'$!  #'+/368:<<<;:852/,(%!!%(,/258:;<<<:863/+'#   %*/38<@CEGHHGEC@=951-)%!!%)-159=@CEGHHGEC@<83/*%   !&+17FPYcmwxph`YRKFA>;::;>AFKRY`hpxwmcYPF>5.("  !&,3;CMWalv~umd]VPKGDCCDGKPV]dmu~vlaWMC;3,&!   $*08@IR]hs~yphaZUQNLLNQUZahpy~sh]RI@80*$   #(.4BFKPV]emwĻwme]VPKFB>:63/,($!  !%),047;>AEIMQW]cks|û|skc]WQMIEA>;740,)%!  !%)-158CGJMPQRSSSSSSTUWZ]aflry{xvvx{yrlfa]ZWUTSSSSSSRQPMJGC>94/*%    %*05;@EJNQTVWWWWVTSSRRSTWZ^chnt{{vrpooprv{{tnhc^ZWTSRRSSTVWWWWVTQNJE@;50*%    %+17=CHMRVY[\]]\ZXVTRQPOPQSVZ^chntz{vqmjgffgjmqv{ztnhc^ZVSQPOPQRTVXZ\]]\[YVRMHC=71+%    %+18>EKQV[^acddca^\XURPMLKKLNQUY^chmrvz}~|xtpkgc`^]]^`cgkptx|~}zvrmhc^YUQNLKKLMPRUX\^acddca^[VQKE>81+%   %+29@GNU[`ehkllkjgc`[WSOLIHGGHJLPTX\aeimprstsqolhd`\YVTSSTVY\`dhloqstsrpmiea\XTPLJHGGHILOSW[`cgjkllkhe`[UNG@92+%  $+29AIQY`flptvvvtqnid_ZTPKHECBBCEGKNRVZ]acefgfeb`\YUROMKJJKMORUY\`befgfeca]ZVRNKGECBBCEHKPTZ_dinqtvvvtplf`YQIA92+$  #*19AJS\dlrx}~zvpjc]WQKGC@?>>?@CFILORUWYZZZYWTQNKHECBAABCEHKNQTWYZZZYWUROLIFC@?>>?@CGKQW]cjpvz~}xrld\SJA91*# !(/8AJT^gpx~xpiaZSLGB?<:9::<>ACFIKMNOOOMLIGDA?<:9889:<::9::865678:<>@BCDEEDCB@=;864210012468;=@BCDEEDCB@><:876568:>BHNV^fox}si^TI?6-% "*396422234578:;<<<;:97520.,+*))*+,.02579:;<<<;:87543222469>CJQZclvui]RG<3*" &/8CNZgt~sh^ULE?:520////01234444321/-+)'&$####$&')+-/12344443210////025:?ELU^hs~tgZNC8/&"*3=IUcp~zncYPG@:62/-,,+,,---.--,+*(&$#!  !#$&(*+,--.---,,+,,-/26:@GPYcnz~pcUI=3*"%-7CO\kyǾui^TKC<72/,*)(((((((('&%$"  "$%&'(((((((()*,/2783/,)'&%%%$$##"!  !"##$$%%%&'),/38>FNXco{ʾrcTG;1' !*4?KYhxȻuh\RIA:4/+(&$#"!!  !!"#$&(+/4:AIR\huȹxhYK?4*!#,6BO]m}ôzmaVLC<50,(%#!  !#%(,0571,(%"   "%(,17>FOYerƶp`RD8.%&/9FScsvi]RH@82-(%! !%(-28@HR]ivʹscSF9/&&0:GTdtôyl`UKB:3-($!  !$(-3:BKU`ly˺tdTG:0&'0;GUdtŶ{nbWLC;4.($    $(.4;CLWbn{ʺtdUG;0''0;GTcsĶ}pcXMD<4.(#  #(.4HS^jvxndZPG?7/)#  #)/7?GPZdnxvj^SH>5,%$+471+%    %+17>ELRY_ejosw{}~|ytojc]UNF?70*$$*07>FMT[agmquxz|}}|{yvsokgb\VPJC=60*$  $*06=CJPV\bgkosvy{|}}|zxuqmga[TMF>70*$$*07>ELSZ`fkpsvxzzzzxvtqmie`[UOIB<5/)$  $)/570*$$*07>ELSZ`fkpsvxzzzzxvtqmie`[UOIB<5/)$  $)/570*$$*07>FMT[agmquxz|}}|{yvsokgb\VPJC=60*$  $*06=CJPV\bgkosvy{|}}|zxuqmga[TMF>70*$$*07?FNU]cjoty|~}{wsoje_YRLE>71+%    %+17>ELRY_ejosw{}~|ytojc]UNF?70*$$*18@HOW_fmsy~}ytoic\VOG@93,&!  !&,39@GOV\cioty}~ysmf_WOH@81*$$*19AIRZbjry{uohaZRKC<5.("  "(.5HS^jvxndZPG?7/)#  #)/7?GPZdnxvj^SH>5,%%-6@JVbo|}rh]SJA91*$  $*19AJS]hr}ſ|obVJ@6-%&.7AMYftúvk`VLB:2,&    &,2:BLV`kvtfYMA7.&&.8CO\jy·znbWMD;3-'!  !'-3;DMWbnzyj\OC8.&&/9EQ_n}ɽ|ocXND<4-'"  "'-471,(%"   "%(,17>FOYerƶp`RD8.%#,6BO]m}ôzmaVLC<50,(%#!  !#%(,0583/,)'&%%%$$##"!  !"##$$%%%&'),/38>FNXco{ʾrcTG;1' %-7CO\kyǾui^TKC<72/,*)(((((((('&%$"  "$%&'(((((((()*,/2796422234578:;<<<;:97520.,+*))*+,.02579:;<<<;:87543222469>CJQZclvui]RG<3*" %-6?IT^is}xof^VNHB>:865678:<>@BCDEEDCB@=;864210012468;=@BCDEEDCB@><:876568:>BHNV^fox}si^TI?6-% !(/8AJT^gpx~xpiaZSLGB?<:9::<>ACFIKMNOOOMLIGDA?<:9889:<::9:>?@CFILORUWYZZZYWTQNKHECBAABCEHKNQTWYZZZYWUROLIFC@?>>?@CGKQW]cjpvz~}xrld\SJA91*#  $+29AIQY`flptvvvtqnid_ZTPKHECBBCEGKNRVZ]acefgfeb`\YUROMKJJKMORUY\`befgfeca]ZVRNKGECBBCEHKPTZ_dinqtvvvtplf`YQIA92+$  %+29@GNU[`ehkllkjgc`[WSOLIHGGHJLPTX\aeimprstsqolhd`\YVTSSTVY\`dhloqstsrpmiea\XTPLJHGGHILOSW[`cgjkllkhe`[UNG@92+%   %+18>EKQV[^acddca^\XURPMLKKLNQUY^chmrvz}~|xtpkgc`^]]^`cgkptx|~}zvrmhc^YUQNLKKLMPRUX\^acddca^[VQKE>81+%    %+17=CHMRVY[\]]\ZXVTRQPOPQSVZ^chntz{vqmjgffgjmqv{ztnhc^ZVSQPOPQRTVXZ\]]\[YVRMHC=71+%    %*05;@EJNQTVWWWWVTSSRRSTWZ^chnt{{vrpooprv{{tnhc^ZWTSRRSSTVWWWWVTQNJE@;50*%    %*/49>CGJMPQRSSSSSSTUWZ]aflry{xvvx{yrlfa]ZWUTSSSSSSRQPMJGC>94/*%    %*.38<@DGJLNOPQRSTVX[_diov}~}}~}void_[XVTSRQPONLJGD@<83.*%    %).27;?BEHJLMOQSUX[`ejqx¿xqje`[XUSQOMLJHEB?;72.)%   !%)-269=@CFHKMPSVZ^djqx¼xqjd^ZVSPMKHFC@=962-)%!  !%)-158AEIMQW]cks|û|skc]WQMIEA>;740,)%!  !$(,/36:>BFKPV]emwĻwme]VPKFB>:63/,($!  !$(+/26:?CIOV]foy¹Ƽyof]VOIC?:62/+($!   #'*.26;@FMT]fpzǾ~~ɿzpf]TMF@;62.*'#    #&*.37=CJR[eo{}zxxz}{oe[RJC=73.*&#   #&*/49@GPYcny¹{vrpprv{yncYPG@94/*&#  "&+06FPYcmwxph`YRKFA>;::;>AFKRY`hpxwmcYPF>5.("  #)08@HQ[dlu|yrkc\TNGA<85322358@AAA?>;852.+'$!!$'+.258;>?AAA@><962.)%!  "&,16;?CGIKMMLKIGC@<840,($!!$(,048<@CGIKLMMKIGC?;61,&"  "'-28>DINRUXYZYXVSOKGB>940,)%#!  !#%),049>BGKOSVXYZYXURNID>82-'"  !'-3:@GMTY^begggfd`]XSNID>951-*(&%%&(*-159>DINSX]`dfgggeb^YTMG@:3-'!   &,3:AIPW^ejortvvtrokfa[UOID?:620.--.026:?DIOU[afkortvvtroje^WPIA:3,&   $*18@HQYaipv|~ytoib\UOID?;865568;?DIOU\bioty~|vpiaYQH@81*$  #(/6>GPYbks{}wpib[UOJEB@>>@BEJOU[bipw}{skbYPG>6/(#  !&,3;DMV`jt}~wohaZUPLIHHILPUZahow~}tj`VMD;3,&!  $*08@IR]gr|}umf`[WTRRTW[`fmu}|rg]RI@80*$  "'-4ENWalx}{{}ĻxlaWNE>71,'#    #'*/4:@GPYcmyǽymcYPG@:4/*'#    #&*.27DJQYblwƽźwlbYQJD>951-*'$!  !$'*-047;@EKQYajt~~tjaYQKE@;740-*'$!  "%(+.147:=AFKQW_gpzúzpg_WQKFA=:741.+(%"  "%),/247:@ACEGILPUZ`goxýĿxog`ZUPLIGECA@><:852.+'#    $(,047:=?ABCDEFGIKMQUZagowwogaZUQMKIGFEDCBA?=:740,($   !%)-269=@BDEFGGGGGHIKMQUZ`fnu~~unf`ZUQMKIHGGGGGFEDB@=962-)%!  !&*/48<@CFHJKKKJJIHHHHJLOSX^dks{}||}{skd^XSOLJHHHHIJJKKKJHFC@<84/*&!  "&,16;@DHKNOPQPONMKIHGGGHJMQV[ahov}~zvtrrtvz~}voha[VQMJHGGGHIKMNOPQPONKHD@;61,&"  "'-28>CHMQTVWXXVUSPMKIGEEEFHKNSX^dkqx}|xsoljhhjlosx|}xqkd^XSNKHFEEEGIKMPSUVXXWVTQMHC>82-'"  "'-4:AGMRWZ]_``_^[XUQMJGECBBCEHLPUZ`fkquy|~~{xtplhda_^^_adhlptx{~~|yuqkf`ZUPLHECBBCEGJMQUX[^_``_]ZWRMGA:4-'"  !'.5@BFIMRVZ]`cdedca_\XUROLJJJJLORUX\_acdedc`]ZVRMIFB@>===?BFJOUZ`ejoruvvtrnib\TLD<5-&   %,4;987789;>@CFHKLMNNMLJGEB?=:9888:=@EKQX`gow~|tkaWMD;2*#  '/8BLWblwxof^VNHB>:865678:<>@BCDDDDBA?<:75310//01357:<:876568:>BHNV^foxwlbWLB8/'  $+4>IT`lxxnd[SLE@;8543445789;<<<<;:8641/-+*)(()*+-/1468:;<<<<;9875443458;@ELS[dnxxl`TI>4+$ '09DP\ivvlbXPIB=963211223455554320/,*(&%#""""#%&(*,/023455554322112369=BIPXblvvi\PD90' "*4>JVdqľsh^UMF?:7410/////00//.-,*(&$"  "$&(*,-.//00/////0147:?FMU^hs»qdVJ>4*"%-7CO\jy{odZQIB=841/.-,,,++**)'&$"!!"$&')**++,,,-./148=BIQZdo{Ǿyj\OC7-%'0;FSap¶vk`VMF?:52/-+*)(('&%$#!!#$%&'(()*+-/25:?FMV`kvȼpaSF;0'!)2=JWfu}qe[RIB<72/,*('&%$"!  !"$%&'(*,/2783/,)'%#"!!"#%'),/38>EMV`kwʻyiZL?4*"#+5AN\k{|pdYPG@94/+(&#!   !#&(+/49@GPYdp|;{k\NA5+##,6BO]l|ŷth]SJB;50+($"   "$(+05;BJS]htο|l]OB6,#$,6BO]l|Ⱥwk_ULC<50+'#   #'+05GQ\fq{~ukbXOF=5.("  "(.5=FOXbku~{qf\QG>5-& %,46/(#  #(/6>EMU]emtz{ung_WPH@81*$$*07>EMT[bioty}}ytnhaZRJC;4-'!  !'-4;CJRZahnty}}ytoib[TME>70*$#)/6=DKQX^djoswz}~{xtojd]VOH@92,&    &,29@HOV]djotx{~}zwsojd^XQKD=6/)##)/570*$  $*07>ELSZ`ejoruwyyzyxvtqnje`[UOHB;5/)##)/5;BHOU[`ejnqtvxyzyywuroje`ZSLE>70*$  $*07>ELSZ`ejoruwyyzyxvtqnje`[UOHB;5/)##)/5EMT[bioty}}ytnhaZRJC;4-'!  !'-4;CJRZahnty}}ytoib[TME>70*$$*18@HPW_gnu{ztme]UME>6/(#  #(/6>EMU]emtz{ung_WPH@81*$%+2:BJS\dmu|zrjbYQH@81*$  $*18@HQYbjrz|umd\SJB:2+%%,4GQ\fq{~ukbXOF=5.("  "(.5=FOXbku~{qf\QG>5-&  '/7AKUalwzpe[RH@70)$  $)07@HR[epzwlaUKA7/' !(09CNZfrľ~ti^TKB92+%    %+29BKT^it~ýrfZNC90(!")2;FQ^kxwkaVLC;3-'!  !'-3;CLVakwxk^QF;2)""*3=HUbp~ȿymbWMD<4.(#  #(.483/,)'%#"!!"#%'),/38>EMV`kwʻyiZL?4*"!)2=JWfu}qe[RIB<72/,*('&%$"!  !"$%&'(*,/27JVdqľsh^UMF?:7410/////00//.-,*(&$"  "$&(*,-.//00/////0147:?FMU^hs»qdVJ>4*" '09DP\ivvlbXPIB=963211223455554320/,*(&%#""""#%&(*,/023455554322112369=BIPXblvvi\PD90' $+4>IT`lxxnd[SLE@;8543445789;<<<<;:8641/-+*)(()*+-/1468:;<<<<;9875443458;@ELS[dnxxl`TI>4+$  '/8BLWblwxof^VNHB>:865678:<>@BCDDDDBA?<:75310//01357:<:876568:>BHNV^foxwlbWLB8/'  #*2;DMWakt|~wog`XQKE@=:8889:=?BEGJLMNNMLKHFC@>;987789;>@CFHKLMNNMLJGEB?=:9888:=@EKQX`gow~|tkaWMD;2*# %,4@BFIMRVZ]`cdedca_\XUROLJJJJLORUX\_acdedc`]ZVRMIFB@>===?BFJOUZ`ejoruvvtrnib\TLD<5-&   !'.5CHMQTVWXXVUSPMKIGEEEFHKNSX^dkqx}|xsoljhhjlosx|}xqkd^XSNKHFEEEGIKMPSUVXXWVTQMHC>82-'"  "&,16;@DHKNOPQPONMKIHGGGHJMQV[ahov}~zvtrrtvz~}voha[VQMJHGGGHIKMNOPQPONKHD@;61,&"  !&*/48<@CFHJKKKJJIHHHHJLOSX^dks{}||}{skd^XSOLJHHHHIJJKKKJHFC@<84/*&!  !%)-269=@BDEFGGGGGHIKMQUZ`fnu~~unf`ZUQMKIHGGGGGFEDB@=962-)%!   $(,047:=?ABCDEFGIKMQUZagowwogaZUQMKIGFEDCBA?=:740,($    #'+.258:<>@ACEGILPUZ`goxýĿxog`ZUPLIGECA@><:852.+'#   #&*-0368:=?ADGJNSX_fnwļºwnf_XSNJGDA?=:8630-*&#  "%),/247:DJQYblwƽźwlbYQJD>951-*'$!   #&*.27ENWalx}{{}ĻxlaWNE>71,'#    $).4;CKU_juý|wsrrsw|uj_UKC;4.)$   !&+18?HQ\fr}½~wqliggilqw~ÿ}rf\QH?81+&!  "'-4GPYbks{}wpib[UOJEB@>>@BEJOU[bipw}{skbYPG>6/(#  $*18@HQYaipv|~ytoib\UOID?;865568;?DIOU\bioty~|vpiaYQH@81*$   &,3:AIPW^ejortvvtrokfa[UOID?:620.--.026:?DIOU[afkortvvtroje^WPIA:3,&   !'-3:@GMTY^begggfd`]XSNID>951-*(&%%&(*-159>DINSX]`dfgggeb^YTMG@:3-'!  "'-28>DINRUXYZYXVSOKGB>940,)%#!  !#%),049>BGKOSVXYZYXURNID>82-'"  "&,16;?CGIKMMLKIGC@<840,($!!$(,048<@CGIKLMMKIGC?;61,&"  !%).269<>@AAA?>;852.+'$!!$'+.258;>?AAA@><962.)%!  #&*-0246666531/,)&#  #&),/1356666420-*&#   #%(*+,--,+*(&$! !$&(*+,--,+*(%#    "#$$$$#"   "#$$$$#"                                  !!   !!   !#%&'((('&%#! !#%&'((('&%#!  "%(*-.01110/-+)'$!!$')+-/01110.-*(%"  !$(,/3589:;;:8742/,)&#  #&),/2478:;;:9853/,($!  "&+/48:62/,*(''(*,/26:>CHLPTX[]^_^][XTOJE?93-'"  !&,39@GNTZ_dgjlllkifb^YTOJE@<8520000258<@EJOTY^bfikllljgd_ZTNG@93,&!  %+18@GOV^djptwz{{ywtqlgb\VQKGB><:99:<>BGKQV\bglqtwy{{zwtpjd^VOG@81+%  #)/6>FNW_gov|{vpjd^XRMIFDCCDFIMRX^djpv{|vog_WNF>6/)#  !&-4;CLU^gpyyrke_YUQOMMOQUY_ekryypg^ULC;4-&!  $*08@HR[eoxyrlfa]ZYYZ]aflryxoe[RH@80*$  "'-4;DMVakuysmifddfimsyukaVMD;4-'"   $*07?GQ[ep{zurppruz{pe[QG?70*$   "',29AJS^hs}{{}sh^SJA92,'"  !%)/5ADHLRY`ir|ľƿ|ri`YRLHDA>=;:9876531.,)&"   $'+.1468:;;<<<==>@BEIMSZair|¾¾|riaZSMIEB@>==<<<;;:8641.+'$   !%)-147:<>?@@@??>>>?@BEIMSZair{{riaZSMIEB@?>>>??@@@?><:741-)%!  "'+048?@BEHMSYaiqyyqiaYSMHEB@?>?@ABCDEFFECA?<840+'"  #(-27<@DGJKLMLKJHFDB@?>>?ADHLRX_gov~{xuttux{~vog_XRLHDA?>>?@BDFHJKLMLKJGD@<72-(#  $)/4:?DIMPSUUUTSPNKHEB@>==>@CGLQW^ekry~|xsoljiijlosx|~yrke^WQLGC@>==>@BEHKNPSTUUUSPMID?:4/)$  $)06ELSY_cgijjigd`\WRMIEA><;<=?AEINSX]bgjmoppnljfc_[XUSRRSUX[_cfjlnppomjgb]XSNIEA?=<;<>AEIMRW\`dgijjigc_YSLE>70)#  "(/7?GOW^ekpsvwwurnjd_YSMHD@=<;;<>@DHLPTX\_acccb`]ZWSPMJIHHIJMPSWZ]`bccca_\XTPLHD@><;;<=@DHMSY_djnruwwvspke^WOG?7/("  &.6>GPYbjrx}~ztngaZSMHC?=;::;=?BFIMPSUWXXWVTROLHEC@?>>?@CEHLORTVWXXWUSPMIFB?=;::;=?CHMSZagntz~}xrjbYPG>6.&  $+3ACFHKLMNNMLJGDB?<97655679<::9:;:99:;<>@BCDEEEDB@>;9631/.--./1369;>@BDEEEDCB@><;:99:;>AFLRYajs{yncXMC90(! $,5?IUamy}sjaXQJE@=:98889:;<=>>>=<:8631.,*(''''(*,.1368:<=>>>=<;:98889:=@EJQXajs}ymaUI?5,$ '09DP\iv}ri_WPID?<:877777888876531/,*(&$"!!!!"$&(*,/135678888777778:;875544443220/-+)&$"  "$&)+-/022344445578;>BHNU^gq{~pbUI=3*"$,6AMZhvżynd[SLFA<97532100/.-+*(&$!!$&(*+-./00123579:7420/.,+*('%#!!#%'(*+,./0247:>CIPXakvö|m^PD8.&'0:FSapź}qg]TMF@;741/-+*(&%#!!#%&(*+-/147;@FMT]gq}ɼpaSF:0' (183/+(%"   "%(+/38>EMU_juscUH<2(  (171+&" "&+17>FOYcozʿyk]PD9/'&.7BMYftǽzncXOE=6/*%    %*/6=EOXcnztfYMB7.&%,5?JUan{xmbWMD<4.(#  #(.46/("  "(/6>GPZdnx{qg\RI@7/(! &-46/("  "(/6>GPZdnx{qg\RI@7/(!")19CMWbmx}rh]SI@81*$  $*18@IS]hr}xmbWMC91)"#+371+&" "&+17>FOYcozʿyk]PD9/' (0;FR`n}·zncXOF?82,($! !$(,28?FOXcnzƹ}n`RF;0(  (183/+(%"   "%(+/38>EMU_juscUH<2(  (2:7420/.,+*('%#!!#%'(*+,./0247:>CIPXakvö|m^PD8.&$,6AMZhvżynd[SLFA<97532100/.-+*(&$!!$&(*+-./00123579;875544443220/-+)&$"  "$&)+-/022344445578;>BHNU^gq{~pbUI=3*" '09DP\iv}ri_WPID?<:877777888876531/,*(&$"!!!!"$&(*,/135678888777778:>>=<:8631.,*(''''(*,.1368:<=>>>=<;:98889:=@EJQXajs}ymaUI?5,$ !(09CMXcny{sjaYRLFA>;:99:;<>@BCDEEEDB@>;9631/.--./1369;>@BDEEEDCB@><;:99:;>AFLRYajs{yncXMC90(! $+3ACFHKLMNNMLJGDB?<97655679<::9:GPYbjrx}~ztngaZSMHC?=;::;=?BFIMPSUWXXWVTROLHEC@?>>?@CEHLORTVWXXWUSPMIFB?=;::;=?CHMSZagntz~}xrjbYPG>6.&  "(/7?GOW^ekpsvwwurnjd_YSMHD@=<;;<>@DHLPTX\_acccb`]ZWSPMJIHHIJMPSWZ]`bccca_\XTPLHD@><;;<=@DHMSY_djnruwwvspke^WOG?7/("  #)07>ELSY_cgijjigd`\WRMIEA><;<=?AEINSX]bgjmoppnljfc_[XUSRRSUX[_cfjlnppomjgb]XSNIEA?=<;<>AEIMRW\`dgijjigc_YSLE>70)#  $)06==>@CGLQW^ekry~|xsoljiijlosx|~yrke^WQLGC@>==>@BEHKNPSTUUUSPMID?:4/)$  #(-27<@DGJKLMLKJHFDB@?>>?ADHLRX_gov~{xuttux{~vog_XRLHDA?>>?@BDFHJKLMLKJGD@<72-(#  "'+048?@BEHMSYaiqyyqiaYSMHEB@?>?@ABCDEFFECA?<840+'"  !%)-147:<>?@@@??>>>?@BEIMSZair{{riaZSMIEB@?>>>??@@@?><:741-)%!   $'+.1468:;;<<<==>@BEIMSZair|¾¾|riaZSMIEB@>==<<<;;:8641.+'$   "&),.1356789:;=>ADHLRY`ir|ľƿ|ri`YRLHDA>=;:9876531.,)&"  !$'*,.024578:FNW_gov|{vpjd^XRMIFDCCDFIMRX^djpv{|vog_WNF>6/)#  %+18@GOV^djptwz{{ywtqlgb\VQKGB><:99:<>BGKQV\bglqtwy{{zwtpjd^VOG@81+%  !&,39@GNTZ_dgjlllkifb^YTOJE@<8520000258<@EJOTY^bfikllljgd_ZTNG@93,&!  "'-39?EJOTX[]^_^][XTPLHC>:62/,*(''(*,/26:>CHLPTX[]^_^][XTOJE?93-'"  "',27???>=;9641.+(%"  "%(+.1469;=>???><:851-)%!  "&+059=ADGIJKJJHFDA>;740-*(%$""""$%(*-047;>ADFHJJKJIGDA=950+&"  "',17DJPUY]`cdddca^[WSOJFB>:75322357:>BFJOSW[^acdddc`]YUPJD>82,&!   %+17>ELSY_eimprsrqpmjfa\XSNIEB?=<<=?BEINSX\afjmpqrsrpmie_YSLE>71+%   #)/6=ELT\cjpuz}|yupkf`[VQMJHGGHJMQV[`fkpuy|}zupjc\TLE=6/)#  !&,3;BKS\dlt{{uoic^ZVTSSTVZ^ciou{{tld\SKB;3,&!  $)07?GPYblt}~wqlgc`__`cglqw~}tlbYPG?70)$  !&,3;CLU_ir|ztpmllmptz|ri_ULC;3,&!  #)/6>FOYcnx}zxxz}xncYOF>6/)#  !%+18@IR\gr}ľ}rg\RI@81+%!  #'-3:BKT^itǿti^TKB:3-'#   $).4;CLU_jvŽŻvj_ULC;4.)$   "&+05@BCCCB@?=;:9889;=AFKRYbjs||sjbYRKFA=;9889:;=?@BCCCB@>;851,(#   %*/48=ADGIKKKJIGEB@=;:99:<>BGMSZbjrzzwtsstwzzrjbZSMGB><:99:;=@BEGIJKKKIGDA=84/*%    %+06EKPUY\^_`_]ZWSOKGC@=<;;;=@DINTZ`fkpuxz{{zxuqmiea^\[[\^aeimquxz{{zxupkf`ZTNID@=;;;<=@CGKOSWZ]_`_^\YUPKE>81+%   $+29@GNU[aehklkjhda\WRMIEA><;<=?AEINSX]bfjlnonmkhd`\YUSQPPQSUY\`dhkmnonljfb]XSNIEA?=<;<>AEIMRW\adhjklkhea[UNG@92+$  #)18@IQY`gmruxyxwtpkf`ZUOJFB?===>@BFIMRVY]_accba^[XTQMJHFEEFHJMQTX[^abcca_]YVRMIFB@>===?BFJOUZ`fkptwxyxurmg`YQI@81)# !'/7?HQ[clsz|wqjd]WQKGC@?>>?@CFILORUWXXXWVSPMJFC@>=<<=>@CFJMPSVWXXXWUROLIFC@?>>?@CGKQW]djqw|zslc[QH?7/'! $,4=FPZdnw}unf_XRLHDA@???ACEGJLMOOOONLIFC@=:75433457:=@CFILNOOOOMLJGECA???@ADHLRX_fnu}wndZPF=4,$ !(09CMXcnyyphaYSMIEB@??@ABCEFGHHHGECA>;8520.,,,,.0258;>ACEGHHHGFECBA@??@BEIMSYahpyyncXMC90(! #+4>HT`lw{riaZTNIFCA@??@@AABBAA?>;9630.+)'&%%&')+.0369;>?AABBAA@@??@ACFINTZair{wl`TH>4+#&.8BNZfs|sjbZTNIFCA?>>>>===<;97520-*(%#"! !"#%(*-02579;<===>>>>?ACFINTZbjs|sfZNB8.&!(1;FR_lzľ|siaZSMIEB@>=<;:987542/-*'%"  "%'*-/245789:;<=>@BEIMSZais|ľzl_RF;1(!"*3>IVcq¹{qh`XRLGC@>;:876431/-*(%#  #%(*-/134678:;>@CGLRX`hq{ǿqcVI>3*"#,5@LYfuĺyof]VOJEA=;86421/-+(&$!!$&(+-/12468;=AEJOV]foyźufYL@5,#$,6AMZhwøukbZRLFA=:742/-+)'%"  "%')+-/247:=AFLRZbkuʾwhZMA6,$$-7BN[ix{pg]UNGB=952/-*(&#!!#&(*-/259=BGNU]gp{xi[NB7-$$-7AN[iwźuj`WOHB<830-*'%"  "%'*-038ELT\ckrywne[RH?7/("  "(/7?HR[enwyrkc\TLE>70*$#(.4;AHOV^ekrx~{sjaXOE=5-&    &-5=EOXajs{~xrke^VOHA;4.(#"'-28?ELRY`flrx}~wog^ULC;3,%  %,3;CLU^gow~}xrlf`YRLE?82-'"!&,17=CIPV\bhnty~{tme\SJB:2+$  $+2:BJS\emt{~ytnhb\VPIC=71,&!!&+16ELT\ckrywne[RH?7/("  "(/7?HR[enwyrkc\TLE>70*$ %,2:AIQZbjsz|si_UKB91*$  $*19BKU_is|zsjbZQIA:2,% !'.5=ENW`ir{wmcXNE<4-&!  !&-4IVcq¹{qh`XRLGC@>;:876431/-*(%#  #%(*-/134678:;>@CGLRX`hq{ǿqcVI>3*"!(1;FR_lzľ|siaZSMIEB@>=<;:987542/-*'%"  "%'*-/245789:;<=>@BEIMSZais|ľzl_RF;1(!&.8BNZfs|sjbZTNIFCA?>>>>===<;97520-*(%#"! !"#%(*-02579;<===>>>>?ACFINTZbjs|sfZNB8.&#+4>HT`lw{riaZTNIFCA@??@@AABBAA?>;9630.+)'&%%&')+.0369;>?AABBAA@@??@ACFINTZair{wl`TH>4+# !(09CMXcnyyphaYSMIEB@??@ABCEFGHHHGECA>;8520.,,,,.0258;>ACEGHHHGFECBA@??@BEIMSYahpyyncXMC90(! $,4=FPZdnw}unf_XRLHDA@???ACEGJLMOOOONLIFC@=:75433457:=@CFILNOOOOMLJGECA???@ADHLRX_fnu}wndZPF=4,$ !'/7?HQ[clsz|wqjd]WQKGC@?>>?@CFILORUWXXXWVSPMJFC@>=<<=>@CFJMPSVWXXXWUROLIFC@?>>?@CGKQW]djqw|zslc[QH?7/'! #)18@IQY`gmruxyxwtpkf`ZUOJFB?===>@BFIMRVY]_accba^[XTQMJHFEEFHJMQTX[^abcca_]YVRMIFB@>===?BFJOUZ`fkptwxyxurmg`YQI@81)#  $+29@GNU[aehklkjhda\WRMIEA><;<=?AEINSX]bfjlnonmkhd`\YUSQPPQSUY\`dhkmnonljfb]XSNIEA?=<;<>AEIMRW\adhjklkhea[UNG@92+$   %+18>EKPUY\^_`_]ZWSOKGC@=<;;;=@DINTZ`fkpuxz{{zxuqmiea^\[[\^aeimquxz{{zxupkf`ZTNID@=;;;<=@CGKOSWZ]_`_^\YUPKE>81+%    %+06BGMSZbjrzzwtsstwzzrjbZSMGB><:99:;=@BEGIJKKKIGDA=84/*%   #(,158;>@BCCCB@?=;:9889;=AFKRYbjs||sjbYRKFA=;9889:;=?@BCCCB@>;851,(#  "&*-1469:;<<<;:987778:<@EJQXajs}}sjaXQJE@<:877789:;<<<;:9641-*&"   $'*-024566666666679;?CIOW_hr}}rh_WOIC?;976666666665420-*'$   "%'*,./1122334467:=BGMU]fp{ýû{pf]UMGB=:7644332211/.,*'%"   "%')+,-./012358;@EKRZcmxƽxmcZRKE@;853210/.-,+)'%"    #%&()+,./1369=BHOW`juǼuj`WOHB=9631/.,+)(&%#   !#%&(*+-036:?EKS\ep{ſŹ{pe\SKE?:630-+*(&%#!   !#%'*,/26;AGNW`jvvj`WNGA;62/,*'%#!   !#%(+.26FOYcnx}zxxz}xncYOF>6/)#  !&,3;CLU_ir|ztpmllmptz|ri_ULC;3,&!  $)07?GPYblt}~wqlgc`__`cglqw~}tlbYPG?70)$  !&,3;BKS\dlt{{uoic^ZVTSSTVZ^ciou{{tld\SKB;3,&!  #)/6=ELT\cjpuz}|yupkf`[VQMJHGGHJMQV[`fkpuy|}zupjc\TLE=6/)#   %+17>ELSY_eimprsrqpmjfa\XSNIEB?=<<=?BEINSX\afjmpqrsrpmie_YSLE>71+%   !&,28>DJPUY]`cdddca^[WSOJFB>:75322357:>BFJOSW[^acdddc`]YUPJD>82,&!  "',17;740-*(%$""""$%(*-047;>ADFHJJKJIGDA=950+&"  !%)-158:<>???>=;9641.+(%"  "%(+.1469;=>???><:851-)%!   #&*-/134555421/-*(%"  "%(*-/124555431/-*&#    #%')*+,,++)(&$"  "$&()++,,+*)'%#    "#$$$##"   "##$$$#"                                        "$%&''''&%$"!!"$%&''''&%$"   !$')+-./00//.,*(&$"  "$&(*,.//00/.-+)'$!   $'+.136799:997642/-*(%#!!#%(*-/246799:997631.+'$   !%).269BFILNPPQPOMKHEB?;852/-,++,-/258;?BEHKMOPQPPNLIFB>950+&!  !&+06FNW`hqy|vqlifeefilqv|yqh`WNF>6/)#   &,2:BJS]fpy{wtsstw{ypf]SJB:2,&   "(.5=ENXblvvlbXNE=5.("  $*07?HQ[ep{ý{pe[QH?70*$  !&+29AJS]htºth]SJA92+&!  "',3:BKT_jvǿǽvj_TKB:3,'"   #(-3:BKU_kvü¶vk_UKB:3-(#   !$).4:BKT_jvĿĸvj_TKB:4.)$!  "%).4:AJS]htŷth]SJA:4.)%"  !#&*.39@HQ[fq~õ~qf[QH@93.*&#!   "$'*.38>FNXbnz̿znbXNF>83.*'$"   !"$&(+.27=CKT^iuǹui^TKC=72.+(&$"!   !"#$&')+.16;AHPZdp|¿̿|pdZPHA;61.+)'&$#"!    "#$%&'()*,.149>ELU_jv¶vj_ULE>941.,*)('&%$#"   !#%'())**++,-.037@ABBA@>=;9765567:=BHNV^gpy}}ypg^VNHB=:7655679;=>@ABBA@><952-)%   !&+05:>BEHJKKKJHFCA><:8778:<@EKQX`hpx|wtqppqtw|xph`XQKE@<:8778:<>ACFHJKKKJHEB>:50+&!  !&,27=BGLORTUUUSQNKHEB?<;::;<:99:<>ADHLOSVXZ[[ZYWTQOLIGFEEFHKNSX^djpv|ztlc[QH?7/'  $+3;841/-++++-/148;>BEGJKLMMMLKJIIIIKMPTX^dkszwlaVKA8/'  "*2;841.+)'&%%&')+.148;>ACEGHHIIIIIIJLNQUZ`gnv~th\QF<2*" $,5?JVbn{xpha[VROLJHGGFEDCA@=;852.+(&$"! !"$&(+.258;=@ACDEFGGHJLORV[ahpx{nbVJ?5,$&.8BMZftýypha[VQNKHFECB@?=;8530,)&$!!$&),0358;=?@BCEFHKNQV[ahpytfZMB8.& '09DP]jwºxog`ZTPLHECA?=;8631.+(%"  "%(+.1368;=?ACEHLPTZ`goxwj]PD90'  (1;FR^lzżvme]WQLHDA><9742/,*'$!!$'*,/2479<>ADHLQW]emvŻzl^RF;1( !(1;FR_m{Ż|riaYRMHC?<9631.+)&#!!#&)+.1369940,)&#!!#&),049>ELT]fq|ĸvh[OC9/' &.7ALXdrø}rg\SKC<71-)&#  #&)-17IT`ly¸}qf[RIA:4/*&#  #&*/4:AIR[fq}yl`TI>4,$#*2;EP[gs|peZPG?71,'#   #',17?GPZep|sg[PE;2*#!(/8AKValxļznbXMD<5.)$   $).5FOXajt}{odYOE<4,&! !&,46.("  &,2:AIRZclu}vk`UKB91*$ $*19BKU`kv}ulcZRIA:2,&  $)06=ELT\emu}|rg\RH?6.'!  !'.6?HR\gr|}ume\TLE=60)$ "(-3:AHOW^fnv}wncYOE<4,&    &,4DKRZaipw~}tjaWMC:2+$  $+2:CMWajt}~wpiaZRKD>71+&!  %*06DKRZaipw~}tjaWMC:2+$  $+2:CMWajt}~wpiaZRKD>71+&! "(-3:AHOW^fnv}wncYOE<4,&    &,4FOXajt}{odYOE<4,&! !&,46.(" $*19BKT^hr}sh\RH?6/)# #)/6?HR\hs}rh^TKB91*$ &-5=FPZep{ľwk`UKB92+&! !&+29BKU`kw¼{peZPF=5-&!(/8AKValxļznbXMD<5.)$   $).5IT`ly¸}qf[RIA:4/*&#  #&*/4:AIR[fq}yl`TI>4,$&.7ALXdrø}rg\SKC<71-)&#  #&)-17940,)&#!!#&),049>ELT]fq|ĸvh[OC9/'  (0:EQ]kyȾzoe\TLF@;730,*'$""$'*,037;@FLT\eozǼyk]QE:0( !(1;FR_l{¸vlc[SMGB=:630-*(%"  "%(*-036:=BGMS[clvɾ{l_RF;1(!!(1;FR_m{Ż|riaYRMHC?<9631.+)&#!!#&)+.1369<9742/,*'$!!$'*,/2479<>ADHLQW]emvŻzl^RF;1(  '09DP]jwºxog`ZTPLHECA?=;8631.+(%"  "%(+.1368;=?ACEHLPTZ`goxwj]PD90' &.8BMZftýypha[VQNKHFECB@?=;8530,)&$!!$&),0358;=?@BCEFHKNQV[ahpytfZMB8.&$,5?JVbn{xpha[VROLJHGGFEDCA@=;852.+(&$"! !"$&(+.258;=@ACDEFGGHJLORV[ahpx{nbVJ?5,$ "*2;841.+)'&%%&')+.148;>ACEGHHIIIIIIJLNQUZ`gnv~th\QF<2*"  '/8AKValwzskd^XTPMKIIIIJKLMMMLKJGEB>;841/-++++-/148;>BEGJKLMMMLKJIIIIKMPTX^dkszwlaVKA8/'  $+3<:99:<>ADHLOSVXZ[[ZYWTQOLIGFEEFHKNSX^djpv|ztlc[QH?7/'  #*19AIQYahnswy{zywsoje_ZTPKHECBBCEGKNRVY]`bcdcb`]ZVRNKGECBBCEGKNRVZ]`bcdcb`]YVRNKGECBBCEHKPTZ_ejoswyz{ywsnhaYQIA91*#  %,2:AHPV]bfjlmmljgc_ZUQLHEB@??@BEIMQV[`dhkmnnmkieb]YUROMLLMORUY]beikmnnmkhd`[VQMIEB@??@BEHLQUZ_cgjlmmljfb]VPHA:2,%  !&,39@FLRV[^`aa`^[XTQLIEB?=<<=?BFJPU[aglquxzzzxvrnjfa^[YWWY[^afjnrvxzzzxuqlga[UPJFB?=<<=?BEILQTX[^`aa`^[VRLF@93,&!  !&,27=BGLORTUUUSQNKHEB?<;::;BEHJKKKJHFCA><:8778:<@EKQX`hpx|wtqppqtw|xph`XQKE@<:8778:<>ACFHJKKKJHEB>:50+&!   %)-259<>@ABBA@>=;9765567:=BHNV^gpy}}ypg^VNHB=:7655679;=>@ABBA@><952-)%   #'*.14689:::98754333357;?EKS[dnxxnd[SKE?;75333345789:::98641.*'#  !$'*-/1233333211011358ELU_jv¶vj_ULE>941.,*)('&%$#"    !"#$&')+.16;AHPZdp|¿̿|pdZPHA;61.+)'&$#"!   !"$&(+.27=CKT^iuǹui^TKC=72.+(&$"!   "$'*.38>FNXbnz̿znbXNF>83.*'$"   !#&*.39@HQ[fq~õ~qf[QH@93.*&#!  "%).4:AJS]htŷth]SJA:4.)%"  !$).4:BKT_jvĿĸvj_TKB:4.)$!   #(-3:BKU_kvü¶vk_UKB:3-(#   "',3:BKT_jvǿǽvj_TKB:3,'"  !&+29AJS]htºth]SJA92+&!  $*07?HQ[ep{ý{pe[QH?70*$  "(.5=ENXblvvlbXNE=5.("   &,2:BJS]fpy{wtsstw{ypf]SJB:2,&   #)/6>FNW`hqy|vqlifeefilqv|yqh`WNF>6/)#  !&,3:AIQY`hou{|wrmgc^[YXXY[^cgmrw|{uoh`YQIA:3,&!  #(.5BFILNPPQPOMKHEB?;852/-,++,-/258;?BEHKMOPQPPNLIFB>950+&!  !%).269????><;8641.,*(&%%%%&(*,.1468;<>????><;852/+'$    %)-26:>ADGIJKKKJIGDB?<9631/.--./1369:62-)%    %*/49>CGKORUWXYYXVTROLHEA>;987789;>AEHLORTVXYYXWUROKGC>94/*%   $)/4:@FKQVZ^bdfgggeca]ZVRNJGECBBCEGJNRVZ]acegggfdb^ZVQKF@:4/)$  "(-4:AGNT[`fkoruvwwusqmie`\XTRPOOPRTX\`eimqsuwwvurokf`[TNGA:4-("   %+28?GNV]dkrw|~zupkfb_]\\]_bfkpuz~|wrkd]VNG?82+%   #(/5=DMU]fnv}{vqnkjjknqv{}vnf]UMD=5/(#   %+29AIR[dnw}zyyz}wnd[RIA92+%   "'-4GPZep{ſ{peZPG>6/)#   $*18@IS]ht»ùth]SI@81*$   !&+29AKU_kw¶wk_UKA92+&!  !&,2:BKU`lyȼyl`UKB:2,&!  "',2:BKU`lyͿyl`UKB:2,'"  #',29AJT_kyyk_TJA92,'#   #',28@IS^jwwj^SI@82,'#    #',17>GP[gt̾tg[PG>71,'#   !$'+06=ENXcp~ȹ~pcXNE=60+'$!  !"$'+/4;BKU`ly³yl`UKB;4/+'$"!   !"$%(+.39@HQ[gsȺsg[QH@93.+(%$"!    !"###$$%'(+.27=EMWbn{þʾ{nbWME=72.+('%$$###"!   !"$%&''''''(()+.16;BJS]htžɿth]SJB;61.+)((''''''&%$"!  "$&(*+,,,,++++++-.15:@GOYcnzýĽzncYOG@:51.-++++++,,,,+*(&$"  "%(*-/01222210/....0259>ELT^hs~~sh^TLE>9520..../01222210/-*(%"   $(+/24689::9876432112369=CIQYclvvlcYQIC=9632112346789::98642/+($   !&*.36:=?ABBBA@>=;9765567:=BHNV^gpy}zyyz}ypg^VNHB=:7655679;=>@ABBBA?=:63.*&!  "',16;?CFIKLLLKIGEB@=;:99:<>BGLSZbiqy|wsomkkmosw|yqibZSLGB><:99:;=@BEGIKLLLKIFC?;61,'"  "'-38>CHMQSVWWWUSQNKHEB@>==>@CGLQW^dkqw|}xsojfb`__`bfjosx}|wqkd^WQLGC@>==>@BEHKNQSUWWWVSQMHC>83-'"  !&-3:@GMRW\_accba_\XUQMJGECBBCEHLPUZ`ekptwyzzywtpkgb]ZVTSSTVZ]bgkptwyzzywtpke`ZUPLHECBBCEGJMQUX\_abcca_\WRMG@:3-&!  %+2:AHPW]cgknopomkhd`[WSOLIHGGHJLPTX\aeilnpponkhd_[VROLJIIJLORV[_dhknoppnliea\XTPLJHGGHILOSW[`dhkmoponkgc]WPHA:2+%  #)08@HQYahnsx{}}|{xuplgb]XTQNMLLLNPSVZ]`cefggeca]YUPLHEB@??@BEHLPUY]aceggfec`]ZVSPNLLLMNQTX]bglpux{|}}{xsnhaYQH@80)#  &-5>GPYbjry~ysmhc^YVSQPPPQSUWZ\^_`_^]ZWTPKGC?<:8778:5-&  "*1:CMWakt}ztnhc^ZWUTSSTUVWXYZYYWUROKGC?;8521001258;?CGKORUWYYZYXWVUTSSTUWZ^chntz}tkaWMC:1*" %-5>HS]hs}yslgb^ZXVUTTUUUUUTSQNKHD@<851/,+**+,/158<@DHKNQSTUUUUUTTUVXZ^bglsy}sh]SH>5-%  '/8BMXcoz~vpje`\YWVTTSRRQOMKHEB>:62/,)'&%%&'),/26:>BEHKMOQRRSTTVWY\`ejpv~zocXMB8/'  ")1;EP\htyrkfa]YWTSQPNLKHFC?<851-*'%#"!!"#%'*-158:730,)&#!  !#&),037:>ADFIKMORTX[`ekrzxk_SG=3*##+4>IUan{yqic]XTQMJHEB?<962/+(%#  #%(+/2694+#$,4>IUbo|º~ume_YTOKGDA>;841.+(%""%(+.148;>ADGKOTY_emu~ĺ|obUI>4,$$+4>IUbo|¸ypg`YSMIDA=:730-*'$!!$'*-037:=ADIMSY`gpyƼ|obUI>4+$#+4=HT`m{ɿ|ri`XQKFA=962/,)&#!!#&),/269=AFKQX`ir|ƻ{m`TH=4+#"*2952.+(%#  #%(+.259>CIPW`is~øxk^RF<2*" !(0:DO[gtƼti_VNF@;61.*'$""$'*.16;@FNV_itɿtg[OD:0(!  '.7AKWbo|Ǽsh]TKC=72.*&#!!#&*.27=CKT]hsù|obWKA7.'  %,4=GR]iuƻ~qf[QH@93.*&#  #&*.39@HQ[fq~Ƽui]RG=4,% #*1:CMXcnzù{ocXNE=60+&""&+06=ENXco{ƽzncXMC:1*# !'.6?HR]gs~ƾxl`UKB:3,'##',3:BKU`lxļ~sg]RH?6.'! %+3;CLV`kvth\QG>6/)$  $)/6>GQ\htvk`VLC;3+% #)/7?GPYcmx¾|pdYND;3,&! !&,3;DNYdp|xmcYPG?7/)#  &,3:BJS\fpyxl`UJA80)# #)08AJU`lxypf\SJB:3,&  $*06>ENV_hr{sh\QG>5-&! !&-5>GQ\hs{rh_VNE>60*$ "'-3:AIQYbkt}zodYND;2+$ $+2;DNYdoz}tkbYQIA:3-'" !&+17>EMU]fowwlaVLB90)# #)09BLValwwof]UME>71+&!  $*/5EMU]fowwlaVLB90)# #)09BLValwwof]UME>71+&! "'-3:AIQYbkt}zodYND;2+$ $+2;DNYdoz}tkbYQIA:3-'" $*06>ENV_hr{sh\QG>5-&! !&-5>GQ\hs{rh_VNE>60*$  &,3:BJS\fpyxl`UJA80)# #)08AJU`lxypf\SJB:3,&  #)/7?GPYcmx¾|pdYND;3,&! !&,3;DNYdp|xmcYPG?7/)# %+3;CLV`kvth\QG>6/)$  $)/6>GQ\htvk`VLC;3+% !'.6?HR]gs~ƾxl`UKB:3,'##',3:BKU`lxļ~sg]RH?6.'! #*1:CMXcnzù{ocXNE=60+&""&+06=ENXco{ƽzncXMC:1*# %,4=GR]iuƻ~qf[QH@93.*&#  #&*.39@HQ[fq~Ƽui]RG=4,%  '.7AKWbo|Ǽsh]TKC=72.*&#!!#&*.27=CKT]hsù|obWKA7.'  !(0:DO[gtƼti_VNF@;61.*'$""$'*.16;@FNV_itɿtg[OD:0(! "*2952.+(%#  #%(+.259>CIPW`is~øxk^RF<2*"#+4=HT`m{ɿ|ri`XQKFA=962/,)&#!!#&),/269=AFKQX`ir|ƻ{m`TH=4+#$+4>IUbo|¸ypg`YSMIDA=:730-*'$!!$'*-037:=ADIMSY`gpyƼ|obUI>4+$$,4>IUbo|º~ume_YTOKGDA>;841.+(%""%(+.148;>ADGKOTY_emu~ĺ|obUI>4,$#+4>IUan{yqic]XTQMJHEB?<962/+(%#  #%(+/2694+##*3=GS_kxzrke`[XTROMKIFDA>:730,)&#!  !#&),037:>ADFIKMORTX[`ekrzxk_SG=3*# ")1;EP\htyrkfa]YWTSQPNLKHFC?<851-*'%#"!!"#%'*-158:62/,)'&%%&'),/26:>BEHKMOQRRSTTVWY\`ejpv~zocXMB8/'  %-5>HS]hs}yslgb^ZXVUTTUUUUUTSQNKHD@<851/,+**+,/158<@DHKNQSTUUUUUTTUVXZ^bglsy}sh]SH>5-% "*1:CMWakt}ztnhc^ZWUTSSTUVWXYZYYWUROKGC?;8521001258;?CGKORUWYYZYXWVUTSSTUWZ^chntz}tkaWMC:1*"  &-5>GPYbjry~ysmhc^YVSQPPPQSUWZ\^_`_^]ZWTPKGC?<:8778:5-&  #)08@HQYahnsx{}}|{xuplgb]XTQNMLLLNPSVZ]`cefggeca]YUPLHEB@??@BEHLPUY]aceggfec`]ZVSPNLLLMNQTX]bglpux{|}}{xsnhaYQH@80)#  %+2:AHPW]cgknopomkhd`[WSOLIHGGHJLPTX\aeilnpponkhd_[VROLJIIJLORV[_dhknoppnliea\XTPLJHGGHILOSW[`dhkmoponkgc]WPHA:2+%  !&-3:@GMRW\_accba_\XUQMJGECBBCEHLPUZ`ekptwyzzywtpkgb]ZVTSSTVZ]bgkptwyzzywtpke`ZUPLHECBBCEGJMQUX\_abcca_\WRMG@:3-&!  "'-38>CHMQSVWWWUSQNKHEB@>==>@CGLQW^dkqw|}xsojfb`__`bfjosx}|wqkd^WQLGC@>==>@BEHKNQSUWWWVSQMHC>83-'"  "',16;?CFIKLLLKIGEB@=;:99:<>BGLSZbiqy|wsomkkmosw|yqibZSLGB><:99:;=@BEGIKLLLKIFC?;61,'"  !&*.36:=?ABBBA@>=;9765567:=BHNV^gpy}zyyz}ypg^VNHB=:7655679;=>@ABBBA?=:63.*&!   $(+/24689::9876432112369=CIQYclvvlcYQIC=9632112346789::98642/+($   "%(*-/01222210/....0259>ELT^hs~~sh^TLE>9520..../01222210/-*(%"  "$&(*+,,,,++++++-.15:@GOYcnzýĽzncYOG@:51.-++++++,,,,+*(&$"  !"$%&''''''(()+.16;BJS]htžɿth]SJB;61.+)((''''''&%$"!   !"###$$%'(+.27=EMWbn{þʾ{nbWME=72.+('%$$###"!    !"$%(+.39@HQ[gsȺsg[QH@93.+(%$"!   !"$'+/4;BKU`ly³yl`UKB;4/+'$"!  !$'+06=ENXcp~ȹ~pcXNE=60+'$!   #',17>GP[gt̾tg[PG>71,'#    #',28@IS^jwwj^SI@82,'#   #',29AJT_kyyk_TJA92,'#  "',2:BKU`lyͿyl`UKB:2,'"  !&,2:BKU`lyȼyl`UKB:2,&!  !&+29AKU_kw¶wk_UKA92+&!   $*18@IS]ht»ùth]SI@81*$   #)/6>GPZep{ſ{peZPG>6/)#  "'-4CGKORUWXYYXVTROLHEA>;987789;>AEHLORTVXYYXWUROKGC>94/*%    %)-26:>ADGIJKKKJIGDB?<9631/.--./1369:62-)%    $'+/258;<>????><;8641.,*(&%%%%&(*,.1468;<>????><;852/+'$   "%(+-01345554320.,*(%#!  !#%(*,.02345554310-+(%"  "$&()*++,++*('%#"  "#%'(*++,++*)(&$"  !"#####"!  !"#####"!                                  !#%&'(((('&%$#!!#$%&'(((('&%#!   #%(*,./011100.-+)'&$"!!"$&')+-.001110/.,*(%#   "%),/2478:;;;;:97531/,*)'&&&&')*,/13579:;;;;:8742/,)%"  #'+/37:>@CEFGGGFECA?<97420////02479:73/+'#  #(-16;?DHKNQSTUUTSQOLIFB@=;:99:;=@BFILOQSTUUTSQNKHD?;61-(#  #(-28=CHMRW[^`bcdcb`]ZWSPLIGEEEEGILPSWZ]`bcdcb`^[WRMHC=82-(#  "',28>EKRX]cgloqsttrpnjfb^ZWTRQQRTWZ^bfjnprttsqolgc]XRKE>82,'"   %*17>ELS[biouz~{wrnjfc`__`cfjnrw{~zuoib[SLE>71*%   "(.5GQ[eq|Ŀ»|qe[QG>6/(#  $*08@JT^jv»Ⱦvj^TJ@80*$   %+19BKVamzþȽzmaVKB91+%    %+2:CLWcp}Ķ}pcWLC:2+%   !&+2:CMXdqɻqdXMC:2+&!  !&+2:CLXdqͽqdXLC:2+&!  !&+29BKVcp~ξ~pcVKB92+&!  !&+18@JUan}̼}naUJ@81+&!  !%*07?HS^lzɹzl^SH?70*%!  "%*/5=FP\hvĵvh\PF=5/*%"   "%).4;DMXer;reXMD;4.)%"    !#&).3:BKUan{Ķ{naUKB:3.)&#!    !!!!!""#%'*.39@IR]iv½ǻvi]RI@93.*'%#""!!!!!   !"$$%&&&&%%%&')+.38?GPZeq~Ƽ~qeZPG?83.+)'&%%%&&&&%$$"!   "%'(*++++++**))*+-038>EMWalxĿxlaWME>830-+*))**++++++*('%"   "%(+-/12222210/....0259>ELT^hs~~sh^TLE>9520..../01222221/-+(%"  !%(,/2579::::98764333357;?EKS[dnxxnd[SKE?;75333346789::::9752/,(%!  "&+/37;>@BCDDCBA?=;:9889;=AFKRYajs{{wtsstw{{sjaYRKFA=;9889:;=?ABCDDCB@>;73/+&"  "',16;@DGJLMNNMLJHFDB@?>>?ADHLRX_gnv}}wrmjgffgjmrw}}vng_XRLHDA?>>?@BDFHJLMNNMLJGD@;61,'"  "'-38>DIMQUWYYYYWUSPMKHGEEEFHKNSX^dkqw|~zuojea][ZZ[]aejouz~|wqkd^XSNKHFEEEGHKMPSUWYYYYWUQMID>83-'"   &,39@FMRX\`ceffeca^[XURPMLKKLNQUY^chmrvy{}}|zvrnid^ZVRPOOPRVZ^dinrvz|}}{yvrmhc^YUQNLKKLMPRUX[^aceffec`\XRMF@93,&   $*18@GOV\bhloqssrqnkhda]ZWTSRRSUWZ^bfjmpstttrolhc^YTOLHFEEFHLOTY^chlortttspmjfb^ZWUSRRSTWZ]adhknqrssqolhb\VOG@81*$  !(/6>FOW_fmsx|~~|yuqmiea^[YXXYZ\_adgjkmmmlifc^YTPKGC@>==>@CGKPTY^cfilmmmkjgda_\ZYXXY[^aeimquy|~~|xsmf_WOF>6/(! $+3;DMV_hpw~zuqlhdb_^^^^`acefghgfdb^ZVQLGC?;976679;?CGLQVZ^bdfghgfeca`^^^^_bdhlquz~wph_VMD;3+$  '/7@IS]fpy}xsnjgdcaaabbccccb`^[WSNJE@<8521001258<@EJNSW[^`bccccbbaaacdgjnsx}ypf]SI@7/'  ")1:DNXcmx~xsokhedcbaa``^][XTQLHC?:630-,++,-036:?CHLQTX[]^``aabcdehkosx~xmcXND:1)" $+4=GQ\hs~|vqmifdb`_^\ZXUROKFB>951.+)'''')+.159>BFKORUXZ\^_`bdfimqv|~sh\QG=4+$ %-6?IT`lx~xrmieb_][XVSPMIEA=941-*'%$##$%'*-149=AEIMPSVX[]_beimrx~¿xl`TI?6-% &.7@KVbn{ľ}vpkfb^[XUROKHD@<840-)'$"!!!!"$')-048<@DHKORUX[^bfkpv}»{nbVK@7.& &.7ALWcp}ºzslfa\XTQMJFC?;730,)&$"  "$&),037;?CFJMQTX\aflsz}pcWLA7.& &.7ALWcp}ĺ}umf`ZUQMIEA>:63/,)&#!!#&),/36:>AEIMQUZ`fmu}ĺ}pcWLA7.& &-6@KVbo|vme^XRMHD@<952.+(%#!!#%(+.259<@DHMRX^emvƻ|obVK@6-& %,5>IT`mzǼvmd\UNID?;841-*'%"  "%'*-148;?DINU\dmvźzm`TI>5,% #+382-)%"  "%)-28>FOXco|ƻ~rfZPE<3+$ ")08AJU_kwĹxk_TKB:3.)%!!%).3:BKT_kxǽwk_UJA80)"  &-46/*%!!%*/6>GP[gtǾ{odYOE<4-&  #*18@IS]hs~¹|pcWLC:2,&!!&,2:CLWcp|Ž~sh]SI@81*#  !'-4FNWajt~uj^SH>5-&   &-5>HS^ju~tjaWNF>70*%   $)/6=EMV_is|th]RG=4,% %,4=GR]ht|si_VME=6/)$  $)/6=EMV_is|th]RG=4,% %,4=GR]ht|si_VME=6/)$   %*07>FNWajt~uj^SH>5-&   &-5>HS^ju~tjaWNF>70*%   !&,29@HQZdnxxl`UJ@6.'!  !'.6@JU`lxxndZQH@92,&!  "(.56/*%!!%*/6>GP[gtǾ{odYOE<4-&  ")08AJU_kwĹxk_TKB:3.)%!!%).3:BKT_kxǽwk_UJA80)" $+382-)%"  "%)-28>FOXco|ƻ~rfZPE<3+$  '.7@JT`lx~rf\RJB<61-*&$!!$&*-16IT`mzǼvmd\UNID?;841-*'%"  "%'*-148;?DINU\dmvźzm`TI>5,% &-6@KVbo|vme^XRMHD@<952.+(%#!!#%(+.259<@DHMRX^emvƻ|obVK@6-& &.7ALWcp}ĺ}umf`ZUQMIEA>:63/,)&#!!#&),/36:>AEIMQUZ`fmu}ĺ}pcWLA7.& &.7ALWcp}ºzslfa\XTQMJFC?;730,)&$"  "$&),037;?CFJMQTX\aflsz}pcWLA7.& &.7@KVbn{ľ}vpkfb^[XUROKHD@<840-)'$"!!!!"$')-048<@DHKORUX[^bfkpv}»{nbVK@7.& %-6?IT`lx~xrmieb_][XVSPMIEA=941-*'%$##$%'*-149=AEIMPSVX[]_beimrx~¿xl`TI?6-% $+4=GQ\hs~|vqmifdb`_^\ZXUROKFB>951.+)'''')+.159>BFKORUXZ\^_`bdfimqv|~sh\QG=4+$ ")1:DNXcmx~xsokhedcbaa``^][XTQLHC?:630-,++,-036:?CHLQTX[]^``aabcdehkosx~xmcXND:1)"  '/7@IS]fpy}xsnjgdcaaabbccccb`^[WSNJE@<8521001258<@EJNSW[^`bccccbbaaacdgjnsx}ypf]SI@7/'  $+3;DMV_hpw~zuqlhdb_^^^^`acefghgfdb^ZVQLGC?;976679;?CGLQVZ^bdfghgfeca`^^^^_bdhlquz~wph_VMD;3+$ !(/6>FOW_fmsx|~~|yuqmiea^[YXXYZ\_adgjkmmmlifc^YTPKGC@>==>@CGKPTY^cfilmmmkjgda_\ZYXXY[^aeimquy|~~|xsmf_WOF>6/(!  $*18@GOV\bhloqssrqnkhda]ZWTSRRSUWZ^bfjmpstttrolhc^YTOLHFEEFHLOTY^chlortttspmjfb^ZWUSRRSTWZ]adhknqrssqolhb\VOG@81*$   &,39@FMRX\`ceffeca^[XURPMLKKLNQUY^chmrvy{}}|zvrnid^ZVRPOOPRVZ^dinrvz|}}{yvrmhc^YUQNLKKLMPRUX[^aceffec`\XRMF@93,&   "'-38>DIMQUWYYYYWUSPMKHGEEEFHKNSX^dkqw|~zuojea][ZZ[]aejouz~|wqkd^XSNKHFEEEGHKMPSUWYYYYWUQMID>83-'"  "',16;@DGJLMNNMLJHFDB@?>>?ADHLRX_gnv}}wrmjgffgjmrw}}vng_XRLHDA?>>?@BDFHJLMNNMLJGD@;61,'"  "&+/37;>@BCDDCBA?=;:9889;=AFKRYajs{{wtsstw{{sjaYRKFA=;9889:;=?ABCDDCB@>;73/+&"  !%(,/2579::::98764333357;?EKS[dnxxnd[SKE?;75333346789::::9752/,(%!  "%(+-/12222210/....0259>ELT^hs~~sh^TLE>9520..../01222221/-+(%"   "%'(*++++++**))*+-038>EMWalxĿxlaWME>830-+*))**++++++*('%"   !"$$%&&&&%%%&')+.38?GPZeq~Ƽ~qeZPG?83.+)'&%%%&&&&%$$"!   !!!!!""#%'*.39@IR]iv½ǻvi]RI@93.*'%#""!!!!!    !#&).3:BKUan{Ķ{naUKB:3.)&#!    "%).4;DMXer;reXMD;4.)%"   "%*/5=FP\hvĵvh\PF=5/*%"  !%*07?HS^lzɹzl^SH?70*%!  !&+18@JUan}̼}naUJ@81+&!  !&+29BKVcp~ξ~pcVKB92+&!  !&+2:CLXdqͽqdXLC:2+&!  !&+2:CMXdqɻqdXMC:2+&!   %+2:CLWcp}Ķ}pcWLC:2+%    %+19BKVamzþȽzmaVKB91+%   $*08@JT^jv»Ⱦvj^TJ@80*$  #(/6>GQ[eq|Ŀ»|qe[QG>6/(#  !'-4;DMV`juuj`VMD;4-'!  %*18@HQZcmv}}vmcZQH@81*%  "(.5ELS[biouz~{wrnjfc`__`cfjnrw{~zuoib[SLE>71*%   "',28>EKRX]cgloqsttrpnjfb^ZWTRQQRTWZ^bfjnprttsqolgc]XRKE>82,'"  #(-28=CHMRW[^`bcdcb`]ZWSPLIGEEEEGILPSWZ]`bcdcb`^[WRMHC=82-(#  #(-16;?DHKNQSTUUTSQOLIFB@=;:99:;=@BFILOQSTUUTSQNKHD?;61-(#  #'+/37:>@CEFGGGFECA?<97420////02479:73/+'#  "%),/2478:;;;;:97531/,*)'&&&&')*,/13579:;;;;:8742/,)%"   #%(*,./011100.-+)'&$"!!"$&')+-.001110/.,*(%#   !#%&'(((('&%$#!!#$%&'(((('&%#!                                 "#$%%%%%$#"  "#$%%%%%$#"    #%')+,-....-,*)'&$"!  !"$&')*,-....-,+)'%#    #&),/1457888876531/-+)('&&'()+-/1356788887541/,)&#   "%)-148;=@BCDDDCB@><:753100001357:<>@BCDDDCB@=;841-)%"  "&+/48=AEHKNPQRRQPNLIFCA><;::;<>ACFILNPQRRQPNKHEA=84/+&"  "',16;AFKPTX[^`aa`_]ZWTQNKIGFFGIKNQTWZ]_`aa`^[XTPKFA;61,'"  !&+17=CIPV[aejmoqqqpmkgc`\YVTTTTVY\`cgkmpqqqomjea[VPIC=71+&!  $*06=DKRYagnty}|xtplhecbbcehlptx|}ytngaYRKD=60*$  "'-4;CJS[clt{|xurqqrux|{tlc[SJC;4-'"  $*18@HQZdmwwmdZQH@81*$  !&-4GQ[gtüĸtg[QG>71-)&$"!!!!   !#$%%&&&&%%%&')+.38?GPZeq}»ĺ}qeZPG?83.+)'&%%%&&&&%%$#!   #%')*+,,,,,+++++-.15:@GOXcnyþĿyncXOG@:51.-+++++,,,,,+*)'%#   #&),.02334433211011358?@BEHMSYaiqyytpmllmptyyqiaYSMHEB@?>?@ABCEFFFFECA?;84/+&"  "',16;@DHKNPQQQQONLKIHGGGHJMQV[bhov}~xrmhda``adhmrx~}vohb[VQMJHGGGHIKLNOQQQQPNKHD@;61,'"  !&,28>CINRVY[]]]][ZXVTRQPOPQSVZ^ciouz}xrlfa\YVUUVY\aflrx}zuoic^ZVSQPOPQRTVXZ[]]]][YVRNIC>82,&!  %+18>ELRW\adgijjjigeb`^[ZYXXY[^aejosx||xsmgb\WROLKKLORW\bgmsx||xsojea^[YXXYZ[^`begijjjigda\WRLE>81+%  #)/6>EMT[aglptvxxxwuspmjgecaaaacehkorvxz||{zwsoid^XSNJFDCCDFJNSX^dioswz{||zxvrokhecaaaacegjmpsuwxxxvtplga[TME>6/)#   &,4;CLT\dkrx}~{xtqnljihhikmortuwwvusokfa[VPKFB?=<<=?BFKPV[afkosuvwwutromkihhijlnqtx{~}xrkd\TLC;4,&   ")08@IR[dlt|~zvsqonnnopqrssrqolhd_ZTNID@<976679<@DINTZ_dhloqrssrqponnnoqsvz~|tld[RI@80)" $+3;DNWakt}}yvtrqqpppponlifb]XSNHC>:74211247:>CHNSX]bfilnoppppqqrtvy}}tkaWND;3+$ &-5>HR\gq{}zwtrqonmkigd`\WRMHC>9520.--.0259>CHMRW\`dgikmnoqrtwz}{qg\RH>5-&  '/7AJU`kv{wsqnljgeb^ZVQLGB>951.,+**+,.159>BGLQVZ^begjlnqsw{vk`UJA7/'  !(09BLWcnzſ~ytpmifc`\YUPLGB>951.+)(''()+.159>BGLPUY\`cfimpty~ſzncWLB90(! !(09CMYdp}ļztojfb_[WSOKFB=951.+)'%%%%')+.159=BFKOSW[_bfjotzǿ}pdYMC90(! !(09CMYeq~ƽ{tnhc^ZVQMIEA=951.+(&%####%&(+.159=AEIMQVZ^chnt{ź~qeYMC90(! !(08BMXdq}ĺ{ske_ZUPLHD@<841-*(&$#"!!"#$&(*-148<@DHLPUZ_eks{Ƚ}qdXMB80(!  '.7AKVbo|ʾzqha[UOKFB>:630-*'%#"! !"#%'*-036:>BFKOU[ahqzɽ|obVKA7.'  %-5>IT_lyµxne]VPJE@<851.+)'$#!  !#$')+.158<@EJPV]enxȻyl_TI>5-% $+3HS^jw{ncXOG@:50,)&$"  "$&),05:@GOXcn{ƹwj^SH>5-&   $*2:DNXdp}ɼwj^TJB;50+'$"  "$'+05;BJT^jwʾ}pdXND:2*$  !'.6?HS^iv÷reZOF=60+'#  #'+06=FOZer¶vi^SH?6.'!  %+2;CMXco{Ƚ{maUJA92,'##',29AJUam{Ĺ{ocXMC;2+%  "(/6?HR\htvi\QF=5.(##(.5=FQ\ivĻth\RH?6/("   %,3;CMWbmyû~qdXMB91*%  %*19BMXdq~üymbWMC;3,%   #)07?HR\gs¼zm`TI?6.(""(.6?IT`mz¼sg\RH?70)#  !'-4HS^jw{ncXOG@:50,)&$"  "$&),05:@GOXcn{ƹwj^SH>5-&  ")09BLWcp}µ~rg]TLE?:51.+(&$"  "$&(+.15:?ELT]gr~}pcWLB90)" $+3IT_lyµxne]VPJE@<851.+)'$#!  !#$')+.158<@EJPV]enxȻyl_TI>5-%  '.7AKVbo|ʾzqha[UOKFB>:630-*'%#"! !"#%'*-036:>BFKOU[ahqzɽ|obVKA7.'  !(08BMXdq}ĺ{ske_ZUPLHD@<841-*(&$#"!!"#$&(*-148<@DHLPUZ_eks{Ƚ}qdXMB80(! !(09CMYeq~ƽ{tnhc^ZVQMIEA=951.+(&%####%&(+.159=AEIMQVZ^chnt{ź~qeYMC90(! !(09CMYdp}ļztojfb_[WSOKFB=951.+)'%%%%')+.159=BFKOSW[_bfjotzǿ}pdYMC90(! !(09BLWcnzſ~ytpmifc`\YUPLGB>951.+)(''()+.159>BGLPUY\`cfimpty~ſzncWLB90(!  '/7AJU`kv{wsqnljgeb^ZVQLGB>951.,+**+,.159>BGLQVZ^begjlnqsw{vk`UJA7/'  &-5>HR\gq{}zwtrqonmkigd`\WRMHC>9520.--.0259>CHMRW\`dgikmnoqrtwz}{qg\RH>5-& $+3;DNWakt}}yvtrqqpppponlifb]XSNHC>:74211247:>CHNSX]bfilnoppppqqrtvy}}tkaWND;3+$ ")08@IR[dlt|~zvsqonnnopqrssrqolhd_ZTNID@<976679<@DINTZ_dhloqrssrqponnnoqsvz~|tld[RI@80)"   &,4;CLT\dkrx}~{xtqnljihhikmortuwwvusokfa[VPKFB?=<<=?BFKPV[afkosuvwwutromkihhijlnqtx{~}xrkd\TLC;4,&   #)/6>EMT[aglptvxxxwuspmjgecaaaacehkorvxz||{zwsoid^XSNJFDCCDFJNSX^dioswz{||zxvrokhecaaaacegjmpsuwxxxvtplga[TME>6/)#  %+18>ELRW\adgijjjigeb`^[ZYXXY[^aejosx||xsmgb\WROLKKLORW\bgmsx||xsojea^[YXXYZ[^`begijjjigda\WRLE>81+%  !&,28>CINRVY[]]]][ZXVTRQPOPQSVZ^ciouz}xrlfa\YVUUVY\aflrx}zuoic^ZVSQPOPQRTVXZ[]]]][YVRNIC>82,&!  "',16;@DHKNPQQQQONLKIHGGGHJMQV[bhov}~xrmhda``adhmrx~}vohb[VQMJHGGGHIKLNOQQQQPNKHD@;61,'"  "&+/48;?ACEFFFFECBA@?>?@BEHMSYaiqyytpmllmptyyqiaYSMHEB@?>?@ABCEFFFFECA?;84/+&"  !%),0368:;<<<<;:987778:<@EJQXais|~{yy{~|siaXQJE@<:877789:;<<<<;:8630,)%!  #&),.02334433211011358GQ[gtüĸtg[QG>71-)&$"!!!!   !$'+17?HR^jxxj^RH?71+'$!  "&+07@IT`n|ɺ|n`TI@70+&"  !%+18AKVcqqcVKA81+%!  !%+19BMXetƵteXMB91+%!  !%+2:CNZhvʹvhZNC:2+%!  !&+3;DO\ix̻xi\OD;3+&!   &,3<;::;<>ACFILNPQRRQPNKHEA=84/+&"  "%)-148;=@BCDDDCB@><:753100001357:<>@BCDDDCB@=;841-)%"   #&),/1457888876531/-+)('&&'()+-/1356788887541/,)&#    #%')+,-....-,*)'&$"!  !"$&')*,-....-,+)'%#    "#$%%%%%$#"  "#$%%%%%$#"                            !""###""!  !""###""!   !#%'(*++,,+*)('%$"!  !"$%'()*+,,++*('%#!  !$'*-/13456665420/-+)(''''()+-/02456665431/-*'$!   $'+/258;>?ABBBA?><:753210012357:<>?ABBBA?>;852/+'$   !%).27;?CFILNOOONMKIFCA?=<;;<=?ACFIKMNOOONLIFC?;72.)%!  !&*05:?DINSVY\^^^^\ZWTQNLIHGGHILNQTWZ\^^^^\YVSNID?:50*&!   %*06HT`n|ɺ|n`TH>5-&   !'.6?JVcqqcVJ?6.'!  !'.6@KWdsƵsdWK@6.'!  !'.6@KWetʸteWK@6.'!  !'.6@KWet˹teWK@6.'!  !'.6?JWdsʸsdWJ?6.'!  "'.6?JVcrǶrcVJ?6.'"  "(.6>ITbpòpbTI>6.("  #(.6>HS`n};}n`SH>6.(#  !%)/6>HS_lzƸzl_SH>6/)%!  !$'+17?HR^jx½˿xj^RH?71+'$!   !!!!!""#%'*.39@HR]iu·ui]RH@93.*'%#""!!!!!    "#$&&''''''(()+.16;BJS]htºth]SJB;61.+)((''''''&&$#"   !#&(*+,-......../136:?ELT^hs~~sh^TLE?:631/........-,+*(&#!   #&),/134566666656679;?CIOW_hr|~~|rh_WOIC?;976656666665431/,)&#   !%)-0479<=?@@@@??>>>?@BEIMSZajr{{vsqqsv{{rjaZSMIEB@?>>>??@@@@?=<9740-)%!  !&*/38<<>@CHMRY_flrw{~|{{{{}}wpiaXPH@80)#  %,3;DMV_hqy~|yupke_YRLGB>;9889;>BGLRY_ekpuy|~yqh_VMD;3,%  !'.6?HQ[eoy~|zwsoje_YSMGB>:754457:>BGMSY_ejoswz|~yoe[QH?6.'!  "(08AKU_ju~|zxuqmid_YSMHC>:64211246:>CHMSY_dimquxz|~uj_UKA80(" ")1:CMXcny|yvsolgc^YSNHC>:631/../136:>CHNSY^cglosvy|ſyncXMC:1)" #*2;DNYeq}ǿ~zvrnjea\XSMHC?:731.-,,-.137:?CHMSX\aejnrvz~}qeYND;2*# #*2;DOZfr|vqmhd_[VQMHC?;731.,++++,.137;?CHMQV[_dhmqv|ǽrfZOD;2*# ")1:DOZfrǼysmgb]YTOKGB>:730.,*))))*,.037:>BGKOTY]bgmsyrfZOD:1)" "(09CMYeq~vnga\WRMIEA=9630-+*)(''()*+-0369=AEIMRW\agnv~öqeYMC90("   '/7AKVbo}ö{rib[UPKGB?;741/-+)('&&&&'()+-/147;?BGKPU[bir{õ}obVKA7/'   %-5>HS_lyĶwmd\UOID@<8520-+)('&%%$$%%&'()+-0258<@DIOU\dmwyl_SH>5-%  #*2;EP[huõ~rh^VOHC>:630-+)(&%$$######$$%&()+-036:>CHOV^hr~˽uh[PE;2*#  !(/8ALWcp~zmbYPIB=840-+)'%$#"""!!!!!!"""#$%')+-048=BIPYbmzƸ~pcWLA8/(!  %,4=GR^jxʼuh]SJC<72.+(&$#"!  !"#$&(+.27HS_kx˿wj]RH?82,($"  "$(,28?HR]jwʽxk_SH>5.'   $*2:CNYerŸreXMC;3-($  $(-3;CMXerreYNC:2*$  !(/6?IT_lxȾ{m`TI?7/)$  $)/7?IT`m{Ĺxl_TI?6/(!  %,3HS_kx˿wj]RH?82,($"  "$(,28?HR]jwʽxk_SH>5.'   #)19CMXdqŷ}ocXME=71-)&$"  "$&)-17=EMXco}ŸqdXMC91)#  %,4=GR^jxʼuh]SJC<72.+(&$#"!  !"#$&(+.27:630-+)(&%$$######$$%&()+-036:>CHOV^hr~˽uh[PE;2*#  %-5>HS_lyĶwmd\UOID@<8520-+)('&%%$$%%&'()+-0258<@DIOU\dmwyl_SH>5-%   '/7AKVbo}ö{rib[UPKGB?;741/-+)('&&&&'()+-/147;?BGKPU[bir{õ}obVKA7/'   "(09CMYeq~vnga\WRMIEA=9630-+*)(''()*+-0369=AEIMRW\agnv~öqeYMC90(" ")1:DOZfrǼysmgb]YTOKGB>:730.,*))))*,.037:>BGKOTY]bgmsyrfZOD:1)" #*2;DOZfr|vqmhd_[VQMHC?;731.,++++,.137;?CHMQV[_dhmqv|ǽrfZOD;2*# #*2;DNYeq}ǿ~zvrnjea\XSMHC?:731.-,,-.137:?CHMSX\aejnrvz~}qeYND;2*# ")1:CMXcny|yvsolgc^YSNHC>:631/../136:>CHNSY^cglosvy|ſyncXMC:1)" "(08AKU_ju~|zxuqmid_YSMHC>:64211246:>CHMSY_dimquxz|~uj_UKA80("  !'.6?HQ[eoy~|zwsoje_YSMGB>:754457:>BGMSY_ejoswz|~yoe[QH?6.'!  %,3;DMV_hqy~|yupke_YRLGB>;9889;>BGLRY_ekpuy|~yqh_VMD;3,%  #)08@HPXaipw}}{{{{|~{wrlf_YRMHC@><<>@CHMRY_flrw{~|{{{{}}wpiaXPH@80)#   &-4;BJQY`flrvz}~|zxvtsrrstvy{~~ysmf`YSNIFCBBCFINSY`fmsy~~{yvtsrrstvxz|~}zvrlf`YQJB;4-&   #)/6>>?@BEIMSZajr{{vsqqsv{{rjaZSMIEB@?>>>??@@@@?=<9740-)%!   #&),/134566666656679;?CIOW_hr|~~|rh_WOIC?;976656666665431/,)&#   !#&(*+,-......../136:?ELT^hs~~sh^TLE?:631/........-,+*(&#!   "#$&&''''''(()+.16;BJS]htºth]SJB;61.+)((''''''&&$#"    !!!!!""#%'*.39@HR]iu·ui]RH@93.*'%#""!!!!!   !$'+17?HR^jx½˿xj^RH?71+'$!  !%)/6>HS_lzƸzl_SH>6/)%!  #(.6>HS`n};}n`SH>6.(#  "(.6>ITbpòpbTI>6.("  "'.6?JVcrǶrcVJ?6.'"  !'.6?JWdsʸsdWJ?6.'!  !'.6@KWet˹teWK@6.'!  !'.6@KWetʸteWK@6.'!  !'.6@KWdsƵsdWK@6.'!  !'.6?JVcqqcVJ?6.'!   &-5>HT`n|ɺ|n`TH>5-&   %,4?ABBBA?><:753210012357:<>?ABBBA?>;852/+'$   !$'*-/13456665420/-+)(''''()+-/02456665431/-*'$!  !#%'(*++,,+*)('%$"!  !"$%'()*+,,++*('%#!   !""###""!  !""###""!                          !!!!!  !!!!!   !#%'())**)('&%#"!  !"#%&'()**))('%#!   #&)+-/123443210.,+)(''''()+,.012344321/-+)&#   #&*-147:<=????>=;97532100123579;=>????=<:741-*&#   $(-16:>BEHJLMMLKJHECA?=<;;<=?ACEHJKLMMLJHEB>:61-($   !%*/49?DIMRUXZ[\[ZXVSQNKIHGGHIKNQSVXZ[\[ZXURMID?94/*%!   %*05GQ\gr}}rg\QG>6.'!  #*19CMXco|þľ|ocXMC91*#  %,4=GR^jwþźwj^RG=4,%   '.6@JVcpǺpcVJ@6.'   !(/8BMZgvĵvgZMB8/(!  ")1:DP\kzͼzk\PD:1)"  #)1;EQ_m}±}m_QE;1)#  #*2;FR`oƴo`RF;2*#  #*2HS`n|˼|n`SH>6.(#  "&+07@IT`m{ŷ{m`TI@70+&"   !#&).3:BKUamzƾʾzmaUKB:3.)&#!    !!"###$$%'(+.27=EMWbmzƾ¸zmbWME=72.+('%$$###"!!    "$&'())**++,-.037@BEHMSZajs}{xvvx{}sjaZSMHEB@>==<<<;::87520-*&#   $(,048;>@BDEFFGGGGHIKMPUZ`fnvztoljjlotzvnf`ZUPMKIHGGGGFFEDB@>;840,($    %).38<@DGJMOPQRSSSSSTUWZ]aflsz}voieb``beiov}zslfa]ZWUTSSSSSRQPOMJGD@<83.)%   $)/4:?DINRUX[]^_``````abdfinrx~{sle`\YWWY\`els{~xrnifdba``````_^][XURNID?:4/)$  #(.4:AGMRX]aehjlnnoonnnnnopruy}zrjc]XTQOOQTX]cjrz}yurponnnnnoonnljhea]XRMGA:4.(#  !&,39@GNU\bhmrvy{}~~~~}|{{{{|~yrjc\VQMJIIJMQV\cjry~|{{{{|}~~~~}{yvrmhb\UNG@93,&!  #)07?FNV^elsyzrkc\VPKGEDDEGKPV\ckrzysle^VNF?70)#   &,3;CLT]fnv~zsle]WPKFCA??ACFKPW]elsz~vnf]TLC;3,&   !(/6?GQZdmwzsmf_XRLGB?=<<=?BGLRX_fmszwmdZQG?6/(!  #)19BKU_it~~ysmg`YSMHC?<:99:;864210////012468;>BEIMRW\agnv~ͿtgZNC:1)"  !'/8ALWdrõyog`ZTOJFB?<96421//.----.//12469ITan}³~si`YRLGC?<96420/.-,,,++,,,-./024695-%  #*2;EQ]jx;xlbYRKE@<8530/-,++**********++,-/0358<@EKRYblxƶxj]QE;2*#  !(/8BLXesɺrf\SKD>952/-+*)(((((((((((((((()*+-/259>DKS\frseXLB8/(!  %,4>HT`n|ôxl`ULD>83/,*('&%%%%%%%&&&&%%%%%%%&'(*,/38>DLU`lxɺ|n`TH>4,%  #)1:DO[hv˽reZOF>82.*'%$#"""""###$$$$###"""""#$%'*.28>FOZervh[OD:1)#   '.6@JVbp~Ķ{m`TJA92-)%#!  !!""""!!  !#%)-29AJT`m{ǹ~pbVJ@6.'   $+35.(##(.5>HS_m{Ⱦ|oaUJ?6.'   %,4=HS_lyĺxj]QE<3,&!!&,35.(##(.5>HS_m{Ⱦ|oaUJ?6.'   ")09BMYes÷pcVKA81*%!!%*18AKVcpĸseYMB90)"  $+382.*'%$#"""""###$$$$###"""""#$%'*.28>FOZervh[OD:1)#  %,4>HT`n|ôxl`ULD>83/,*('&%%%%%%%&&&&%%%%%%%&'(*,/38>DLU`lxɺ|n`TH>4,%  !(/8BLXesɺrf\SKD>952/-+*)(((((((((((((((()*+-/259>DKS\frseXLB8/(!  #*2;EQ]jx;xlbYRKE@<8530/-,++**********++,-/0358<@EKRYblxƶxj]QE;2*#  %-5>ITan}³~si`YRLGC?<96420/.-,,,++,,,-./024695-%  !'/8ALWdrõyog`ZTOJFB?<96421//.----.//12469;864210////012468;>BEIMRW\agnv~ͿtgZNC:1)"  #*2;EP\hu¶|uoid^ZUPLHD@=:753210012357:=@DHLPUZ^diou|˽uh\PE;2*#  $+3@BDEFFGGGGHIKMPUZ`fnvztoljjlotzvnf`ZUPMKIHGGGGFFEDB@>;840,($   #&*-02578::;<<<==>@BEHMSZajs}{xvvx{}sjaZSMHEB@>==<<<;::87520-*&#  !$&)+-.01122333467:=BGMU]fp{{pf]UMGB=:76433322110.-+)&$!   "$&'())**++,-.037HS`n|˼|n`SH>6.(#  !'-4=GS`n~~n`SG=4-'!   %,4=GSaoijoaSG=4,%   $+3GQ\gr}}rg\QG>6.'!  %+29BJT^gq{{qg^TJB92+%  "'-4BEHJLMMLKJHECA?=<;;<=?ACEHJKLMMLJHEB>:61-($   #&*-147:<=????>=;97532100123579;=>????=<:741-*&#   #&)+-/123443210.,+)(''''()+,.012344321/-+)&#   !#%'())**)('&%#"!  !"#%&'()**))('%#!   !!!!!  !!!!!                          "$%&'((''&%$"!  !"$%&''(('&%$"   "%'*,.0111110.-+*)''&&'')*+-.0111110.,*'%"  "%),0368:<===<;9864210000124689;<===<:8630,)%"   $(,159=ADFHIJJIHFDB@><;::;<>@BDFHIJJIHFDA=951,($    %*/49>DHMQTVXYYXVTROMJHGFFGHJMORTVXYYXVTQMHD>94/*%    %*06ITao~;~oaTI>5.("  !%+18AKVbp~ɻ~pbVKA81+%!   "%).4;DMXdqĸqdXMD;4.)%"    !"$%(+.39@HQ[gsºsg[QH@93.+(%$"!   !"#$%&'()*,.149>ELU_jvļżvj_ULE>941.,*)('&%$#"!  !#%')+,-./012468;@EKRZdnyþyndZRKE@;864210/.-,+)'%#!  !$'*,/1346789:;=>ADHLRYais}{zz{}siaYRLHDA>=;:9876431/,*'$!  #&*-147:<>@ACDEFGIKMQUZ`goxytpooptyxog`ZUQMKIGFEDCA@><:741-*&#  #(,049<@CFIKMNPQRSTVX[_ciov~}uojgeegjou}~voic_[XVTSRQPNMKIFC@<940,(#  #(-27DIOTY]aehjlmnopqrsvx||tle_ZWVVWZ_elt||xvsrqponmljhea]YTOID>83-("  !&,28?ELRY_ejosvy|}~~ume^YTQPPQTY^emu~~}|yvsoje_YRLE?82,&!  #)06=ELT[cjqw}wog_YTOMKKMOTY_gow}wqjc[TLE=60)#   &,3;BKS\dmu}yqib[TOKIGGIKOT[biqy}umd\SKB;3,&   "(/6?GPYclv{sld]VQLHFEEFHLQV]dls{vlcYPG?6/("  #*19BKU_it|unf_XRMIFCBBCFIMRX_fnu|ti_UKB91*#  %+3;ENYdo{½|uohaZTOJFCA@@ACFJOTZahou|ļ{odYNE;3+%  %,4=GQ\htƿ{unhb\VPLGDB@??@BDGLPV\bhnu{ɾth\QG=4,%  &-5>HS^kxƽ}xsmga\VQLHEB@>>>>@BEHLQV\agmsx}ȼxk^SH>5-&  %-5>HS`lzzupje`[VQLHEB@>=<<=>@BEHLQV[`ejpuz´zl`SH>5-%  %,4>HS`m{·|vqlgb]XTOKHDB?><;;;;<>?BDHKOTX]bglqv|Ǹ{m`SH>4,%  $+3=;::99::;=>@CFIMQUY^chnt{ʺ{l_RG<3+$  "*2;EP]ky{ske_ZUQMIFCA><;:98888889:;<>ACFIMQUZ_eks{ʺyk]PE;2*"  !(09CNZhw;}skc\VQMIEB?=;:87766666666778:;=?BEIMQV\cks}ɸwhZNC90(!  &-6@KWesɺvlc[TNIEA>;9765444444444444445679;>AEINT[clvƵseWK@6-&  $+3=GS`o~ĵ{od[SLFA=:75321111111111111111112357:=AFLS[do{~o`SG=3+$  !(09DO\jyξth]SKD?:631/.-----..//////..-----./136:?DKS]ht˻yj\OD90(!  &-6@KWetǸzmaVME>840-+*))))**+,,----,,+**))))*+-048>EMVamzĴteWK@6-&  #*382.+('%%%%&''()**++**)(''&%%%%'(+.28>FPZgt˼}n`SG<3*#  !(09CO[ixǹ|naUJA93-)&$""!""#$%&'(())(('&%$#""!""$&)-39AJUan|ĵxi[OC90(!  &-6@KWdswi\PF=5/*&#  !"#$%&''''&%$#"!  #&*/5=FP\iwʽsdWK@6-&  $+4=HTao}ȼseXMB92,'#  !#$%%&&%%$#!  #',29BMXesĸ}oaTH=4+$  #*2;FR^lzĸ~pbVJ@70)$! "#$$%%$$#" !$)07@JVbp~zl^RF;2*#  ")1;EP]ky¶}oaTI?6.(#  !"#$$$$#"!  #(.6?ITao}Ⱦyk]PE;1)"  ")1;EP]ky¶}oaTI?6.(#  !"#$$$$#"!  #(.6?ITao}Ⱦyk]PE;1)"  #*2;FR^lzĸ~pbVJ@70)$! "#$$%%$$#" !$)07@JVbp~zl^RF;2*#  $+4=HTao}ȼseXMB92,'#  !#$%%&&%%$#!  #',29BMXesĸ}oaTH=4+$  &-6@KWdswi\PF=5/*&#  !"#$%&''''&%$#"!  #&*/5=FP\iwʽsdWK@6-&  !(09CO[ixǹ|naUJA93-)&$""!""#$%&'(())(('&%$#""!""$&)-39AJUan|ĵxi[OC90(!  #*382.+('%%%%&''()**++**)(''&%%%%'(+.28>FPZgt˼}n`SG<3*#  &-6@KWetǸzmaVME>840-+*))))**+,,----,,+**))))*+-048>EMVamzĴteWK@6-&  !(09DO\jyξth]SKD?:631/.-----..//////..-----./136:?DKS]ht˻yj\OD90(!  $+3=GS`o~ĵ{od[SLFA=:75321111111111111111112357:=AFLS[do{~o`SG=3+$  &-6@KWesɺvlc[TNIEA>;9765444444444444445679;>AEINT[clvƵseWK@6-&  !(09CNZhw;}skc\VQMIEB?=;:87766666666778:;=?BEIMQV\cks}ɸwhZNC90(!  "*2;EP]ky{ske_ZUQMIFCA><;:98888889:;<>ACFIMQUZ_eks{ʺyk]PE;2*"  $+3=;::99::;=>@CFIMQUY^chnt{ʺ{l_RG<3+$  %,4>HS`m{·|vqlgb]XTOKHDB?><;;;;<>?BDHKOTX]bglqv|Ǹ{m`SH>4,%  %-5>HS`lzzupje`[VQLHEB@>=<<=>@BEHLQV[`ejpuz´zl`SH>5-%  &-5>HS^kxƽ}xsmga\VQLHEB@>>>>@BEHLQV\agmsx}ȼxk^SH>5-&  %,4=GQ\htƿ{unhb\VPLGDB@??@BDGLPV\bhnu{ɾth\QG=4,%  %+3;ENYdo{½|uohaZTOJFCA@@ACFJOTZahou|ļ{odYNE;3+%  #*19BKU_it|unf_XRMIFCBBCFIMRX_fnu|ti_UKB91*#  "(/6?GPYclv{sld]VQLHFEEFHLQV]dls{vlcYPG?6/("   &,3;BKS\dmu}yqib[TOKIGGIKOT[biqy}umd\SKB;3,&   #)06=ELT[cjqw}wog_YTOMKKMOTY_gow}wqjc[TLE=60)#  !&,28?ELRY_ejosvy|}~~ume^YTQPPQTY^emu~~}|yvsoje_YRLE?82,&!  "(-38>DIOTY]aehjlmnopqrsvx||tle_ZWVVWZ_elt||xvsrqponmljhea]YTOID>83-("  #(-27@ACDEFGIKMQUZ`goxytpooptyxog`ZUQMKIGFEDCA@><:741-*&#  !$'*,/1346789:;=>ADHLRYais}{zz{}siaYRLHDA>=;:9876431/,*'$!  !#%')+,-./012468;@EKRZdnyþyndZRKE@;864210/.-,+)'%#!  !"#$%&'()*,.149>ELU_jvļżvj_ULE>941.,*)('&%$#"!   !"$%(+.39@HQ[gsºsg[QH@93.+(%$"!    "%).4;DMXdqĸqdXMD;4.)%"   !%+18AKVbp~ɻ~pbVKA81+%!  "(.5>ITao~;~oaTI>5.("   %,3=GS`o~±~o`SG=3,%   $*2;FR_n~ij~n_RF;2*$  ")1:EQ_n~ƴ~n_QE:1)"  !(09DP^m~ƴ~m^PD90(!   '/8CO]l|Ų|l]OC8/'    &.7BN[jz°zj[NB7.&   %-6ALYhxνxhYLA6-%  $,5?JWetǶteWJ?5,$  #+3=GSao~̾~oaSG=3+#  ")1:DP\jxxj\PD:1)"   '.7@KWcp~ȿ~pcWK@7.'   %,4DHMQTVXYYXVTROMJHGFFGHJMORTVXYYXVTQMHD>94/*%    $(,159=ADFHIJJIHFDB@><;::;<>@BDFHIJJIHFDA=951,($   "%),0368:<===<;9864210000124689;<===<:8630,)%"  "%'*,.0111110.-+*)''&&'')*+-.0111110.,*'%"   "$%&'((''&%$"!  !"$%&''(('&%$"                       !#$%%&&%$$"!  !"$$%&&%%$#!  !$')+-.////.-+*)'&&%%&&')*+-.////.-+)'$!  !%(,/2578::::9764210/../0124679::::8752/,(%!   $(,059<@BDFGGFEDB@><:9999:<>@BDEFGGFDB@<950,($    %*/49?CHLORTUUUSROMKHGEEEEGHKMORSUUUTROLHC?94/*%    %+17=CIOUZ^aceeeca^\YVTSRRSTVY\^aceeeca^ZUOIC=71+%    %+18?FNU\bhmqtvvvtrolheca``acehlortvvvtqmhb\UNF?81+%   #)07?GPXaiqx~}yurpoopruy}~xqiaXPG?70)#  !'.5>GPZdmwwmdZPG>5.'!  $+2;DNYdozzodYND;2+$   '.7@JUamzzmaUJ@7.'   #*2;EP\iwýwi\PE;2*#  %,5?JVcq¾ŹqcVJ?5,%   &.8BN[ixŶxi[NB8.&   !(0:EQ_n}}n_QE:0(!  ")2JWfuͼufWJ>4+#  $,5@LYhxxhYL@5,$  &.7AM[jz°zj[MA7.&  !'/8CO]l|ñ|l]OC8/'!  ")1:EQ^m}±}m^QE:1)"  $+3CGKORUX[]_acehlpuz{smgdbbdgms{zuplheca_][XUROKGC>:50+'"  "',16<;;;;;;<<====<<;;;;;;<>?BEINT[clwzk\OC8/'   %,5@KXfvƶ{odZRKFA=;87666667899::::99876666678;=AFKRZdo{̻vfXK@5,%  "*2:642100123456777777654321001246:>DKS\gsŴqbTH<2*"   '09DP^l|Ǹzl`ULD=830.-,,,-./023445544320/.-,,,-.038=DLU`lzξ|l^PD90'   %-6ALYhwtfZOF>72.+)('(()*,-/01222210/-,*)(('()+.27>FOZftǸwhYLA6-%  #+4>IVcrȺ}naUJA93.*'%$$$%&()+-./0000/.-+)(&%$$$%'*.39AJUan}rcVI>4+#  ")2;FS`n~µxj]QF=6/*'$"!!"#$&')+,-.//.-,+)'&$#"!!"$'*/6=FQ]jxȻ~n`SF;2)"  !(0:DQ^l{˿ugZND;3-($"  !"$&(*+,-..-,+*(&$"!  "$(-3;DNZguķ{l^QD:0(!   '/9DO\kyɽseXMB92,'#! "#%')*,----,*)'%#" !#',29BMXesµyk\OD9/'    '/9DO\kyɽseXMB92,'#! "#%')*,----,*)'%#" !#',29BMXesµyk\OD9/'   !(0:DQ^l{˿ugZND;3-($"  !"$&(*+,-..-,+*(&$"!  "$(-3;DNZguķ{l^QD:0(!  ")2;FS`n~µxj]QF=6/*'$"!!"#$&')+,-.//.-,+)'&$#"!!"$'*/6=FQ]jxȻ~n`SF;2)"  #+4>IVcrȺ}naUJA93.*'%$$$%&()+-./0000/.-+)(&%$$$%'*.39AJUan}rcVI>4+#  %-6ALYhwtfZOF>72.+)('(()*,-/01222210/-,*)(('()+.27>FOZftǸwhYLA6-%   '09DP^l|Ǹzl`ULD=830.-,,,-./023445544320/.-,,,-.038=DLU`lzξ|l^PD90'   "*2:642100123456777777654321001246:>DKS\gsŴqbTH<2*"  %,5@KXfvƶ{odZRKFA=;87666667899::::99876666678;=AFKRZdo{̻vfXK@5,%   '/8CO\kzͽwlc[TNIEB?><;;;;;;<<====<<;;;;;;<>?BEINT[clwzk\OC8/'   ")1;FR_n~ôuld]WRNJGECA@????????????????@ACEGJNRW]dluIJ~n_RF;1)"  #+3=HUbqȹ}umfa[WSOLJHFECCBBBBBBBBBBCCEFHJLOSW[afmu}ǵqbUH=3+#  %,5?JWds˾~wpkea\XUQNLJHGEEDDDDDDEEGHJLNQUX\aekpw~ȶsdWJ?5,%  &.6@KXetzuojfa]YUROLJIGFFEEFFGIJLORUY]afjouzƵteXK@6.&   '.7ALXesøztoje`\XTQNKJHGGGGHJKNQTX\`ejotzóseXLA7.'    '/7ALWdrú~ysnhc^YUQNLJIHHIJLNQUY^chnsy~̽rdWLA7/'    '.7@KVbo}»|voic^YTQNKJIIJKNQTY^ciov|ö}obVK@7.'    &.6?IS_kxĿ~wpic]XSPMKJJKMPSX]cipw~Źxk_SI?6.&   %,4=FP[fr~ÿ~vnga[VRNLKKLNRV[agnv~~rf[PF=4,%  $+2:CLV`kv¿|tle^XTPNLLNPTX^elt|þvk`VLC:2+$  ")/7?GPZcmwyqia[VRONNORV[aiqywmcZPG?7/)"   &,3:BJR[dlu}~ume^YURPPRUY^emu~}uld[RJB:3,&   #)/6CGKORUX[]_acehlpuz{smgdbbdgms{zuplheca_][XUROKGC>:50+'"  "&*.269=@CFIKMOQSVX\`djpx½{tokiikot{xpjd`\XVSQOMKIFC@=962.*&"  !$'+.1479;=?ACEGJMPUZ`goxĿ}xtrrtx}xog`ZUPMJGECA?=;9741.+'$!  "$'),.023578:JWfuͼufWJ>4+#  ")2GPZdmwwmdZPG>5.'!  #)07?GPXaiqx~}yurpoopruy}~xqiaXPG?70)#   %+18?FNU\bhmqtvvvtrolheca``acehlortvvvtqmhb\UNF?81+%    %+17=CIOUZ^aceeeca^\YVTSRRSTVY\^aceeeca^ZUOIC=71+%    %*/49?CHLORTUUUSROMKHGEEEEGHKMORSUUUTROLHC?94/*%    $(,059<@BDFGGFEDB@><:9999:<>@BDEFGGFDB@<950,($   !%(,/2578::::9764210/../0124679::::8752/,(%!  !$')+-.////.-+*)'&&%%&&')*+-.////.-+)'$!  !#$%%&&%$$"!  !"$$%&&%%$#!                      !"#####"!  !"#####"!   !#&(*+,,-,,+)('&%$$$$%&'()+,,-,,+*(&#!  !%(+.135677765320/.----./023567776531.+(%!   $(,048;>@BCCCBA?=;:877778:;=?ABCCCB@>;840,($   !&*05:?CGKMOQQQPNLJHFDCBBCDFHJLNPQQQOMKGC?:50*&!  !&,28>DJOTX\^```_][XUSQOOOOQSUX[]_```^\XTOJD>82,&!  !&,29@HOV\bgknpqqomjgda_]\\]_adgjmoqqpnkgb\VOH@92,&!  %+29AJRZbjqw|~{xtqnlkklnqtx{~|wqjbZRJA92+%  #)08AJS]fpx~|{{|~xpf]SJA80)#   &-5>HR]hr}}rh]RH>5-&   #*2:DOZfr~~rfZOD:2*#  %-6?JVbo}}obVJ?6-%  !(09DP\jxſǼxj\PD90(!  #*3=HUbqɼqbUH=3*#  %,6@LYhwƷwhYL@6,%  &/8CP]l|Ͽ|l]PC8/&  !(1:FSapƵpaSF:1(!  "*2=HUdtʹtdUH=2*"  $+4?KXgwͼwgXK?4+$  &-7AM[iyϾyi[MA7-&  !(09DP]l||l]PD90(!  $+3HR^iv}unhb^ZXWWXZ^bhnu}ƽvi^RH>6.'   !(/8AKWcp}ÿ~wpje`\YWVVWY\`ejpw~}pcWKA8/(!  ")19CNZgu~xqlfb^[XWVVWX[^bflqx~̾ugZNC91)"  ")1:EP]jyž|vqkgb_[YWVUUVWY[_bgkqv|Ǹyj]PE:1)"  ")1;EQ^l|ú}xsniea^[YWVUTTUVWY[^aeinsx}ξ|l^QE;1)"  !)1:EQ_m}ʿ|wrnjfb_\YWVUTSSSSTUVWY\_bfjnrw|°}m_QE:1)!  !(0:DQ^m}ƺ{vqlhd`]ZXVUSSRRQQQQRRSSUVXZ]`dhlqv{IJ}m^QD:0(!   '/8CO]l|~wpkfa^ZWUSRPPOOOOOOOOOOOOPPRSUWZ^afkpw~ı|l]OC8/'   %-6AM[jzʻ}tlf`[WTQOMLKKKKKLLLMMLLLKKKKKLMOQTW[`flt}¯zj[MA6-%  #+4?JXgvĴ~sjb\VQNKHGFEEEFGGHIIJJIIHGGFEEEFGHKNQV\bjs~оvgXJ?4+#  ")2@ABCDDCBA@>=;:9999;=@DJPXbmyŴn_QD9/'   %-6AM[jzͽqeZQIB=9643334579:<>?@AA@?><:9754333469=BIQZeqϿzj[MA6-%  #+4>JWfuŶxj^SJB<730/...013579;<=>>=<;975310.../0374+#  !)160,(&%$%&'),.135678876531.,)'&%$%&(,06>GQ]jyǹzk]OC8.&  %.7BN[jywi\PE<5/*'%##$%&)+-024677776420-+)&%$##%'*/560,(&%$%&'),.135678876531.,)'&%$%&(,06>GQ]jyǹzk]OC8.&   '09EQ_n}ǹ|n`TJA93.+('&'()+-02468999986420-+)('&'(+.39AJT`n|ʽ}n_QE90'   !)1JWfuŶxj^SJB<730/...013579;<=>>=<;975310.../0374+#  %-6AM[jzͽqeZQIB=9643334579:<>?@AA@?><:9754333469=BIQZeqϿzj[MA6-%   '/9DQ_nŵymbXPJD@=;9999:;=>@ABCDDCBA@>=;:9999;=@DJPXbmyŴn_QD9/'   ")2HR^iv}unhb^ZXWWXZ^bhnu}ƽvi^RH>6.'   %+3;DNXbnyyqjd_[YWWY[_djqy¼ynbXND;3+%  #)07?HQ[eoyÿ~umfa]ZXXZ]afmu~¿yoe[QH?70)#  !&,3:BJS\emv~ypic^[YY[^cipy~vme\SJB:3,&!  #)/5HR]hr}}rh]RH>5-&   #)08AJS]fpx~|{{|~xpf]SJA80)#  %+29AJRZbjqw|~{xtqnlkklnqtx{~|wqjbZRJA92+%  !&,29@HOV\bgknpqqomjgda_]\\]_adgjmoqqpnkgb\VOH@92,&!  !&,28>DJOTX\^```_][XUSQOOOOQSUX[]_```^\XTOJD>82,&!  !&*05:?CGKMOQQQPNLJHFDCBBCDFHJLNPQQQOMKGC?:50*&!   $(,048;>@BCCCBA?=;:877778:;=?ABCCCB@>;840,($   !%(+.135677765320/.----./023567776531.+(%!  !#&(*+,,-,,+)('&%$$$$%&'()+,,-,,+*(&#!   !"#####"!  !"#####"!                        !!!!!  !!!!!    #%&()***)('&%$#""""#$%&'()***)(&%#   !%(+-/13344321/.-++**++-./12344331/-+(%!   $(,047:<>???>=<:8754444578:<=>???><:740,($   "&+05:>BFHJLLLKJHFDB@????@BDFHJKLLLJHFB>:50+&"  "'-39>DINRVXZ[[ZXVSQOMKKKKMOQSVXZ[[ZXVRNID>93-'"  "(.4;BIOV[`ehjjjigeb_\ZYXXYZ\_begijjjhe`[VOIB;4.("  !'-4GQ\huƹuh\QG>71+'#    "$'*.38>FNXco|ɽ|ocXNF>83.*'$"   !#%'*,/26;@GNWakw¸·wkaWNG@;62/,*'%#!  !#&(+-0258<@DJPX`jtĻǼtj`XPJD@<8520-+(&#!  !$'*.147:=@CGKOU[bjt~Ⱦ~ywwy~·~tjb[UOKGC@=:741.*'$!   #'+/36:>AEHLOSW\agnv~ù}wsqqsw}Ⱦ~vnga\WSOLHEA>:63/+'#    %).27<@EIMRUY]aeintzɿxrnllnrxĺztniea]YURMIE@<72.)%    %*/5:@EKPV[_dhlptx}Ż{tnjhhjnt{}xtplhd_[VPKE@:5/*%    %*06IVcrþzuqmjhfeddefhjmquz²rcVI>4,$  $,5?KXfuü|wsoljgfedccdefgjlosw|ɸufXK?5,$  $,5@KXgwǽ{wsoljgfdccbbbbccdfgjlosw{νwgXK@5,$  $,5?KXgw|xtpmjgedbbaaaaaaaaaabbdegjmptx|ѿwgXK?5,$  #+4>JXfwǺzuplheca_^]]]]^^^^^^^^]]]]^_acehlpuzwfXJ>4+#  ")2=IVeu|tnida][YXWWWXXYZ[[\\[[ZYXXWWWXY[]adint|ѾueVI=2)"   (0;FTbrȹzqic^YVSRPPPPQRTUVWXXXXWVUTRQPPPPRSVY^ciqzͻrbTF;0(   &.8DQ_ozpg_YSOLJIHHIJKMOQRTTUUTTRQOMKJIHHIJLOSY_gpzɷo_QD8.&  $,6AN\k|ȸ}qf]VOJFDBAAABDFHJLNPQQQQPNLJHFDBAAABDFJOV]fq}ñ|k\NA6,$  "*4>KXgwui^UMGB><:::;=?ACFHJLMNNMLJHFCA?=;:::<>BGMU^iuνwgXK>4*"  !(1KXgwui^UMGB><:::;=?ACFHJLMNNMLJHFCA?=;:::<>BGMU^iuνwgXK>4*"  $,6AN\k|ȸ}qf]VOJFDBAAABDFHJLNPQQQQPNLJHFDBAAABDFJOV]fq}ñ|k\NA6,$  &.8DQ_ozpg_YSOLJIHHIJKMOQRTTUUTTRQOMKJIHHIJLOSY_gpzɷo_QD8.&   (0;FTbrȹzqic^YVSRPPPPQRTUVWXXXXWVUTRQPPPPRSVY^ciqzͻrbTF;0(   ")2=IVeu|tnida][YXWWWXXYZ[[\\[[ZYXXWWWXY[]adint|ѾueVI=2)"  #+4>JXfwǺzuplheca_^]]]]^^^^^^^^]]]]^_acehlpuzwfXJ>4+#  $,5?KXgw|xtpmjgedbbaaaaaaaaaabbdegjmptx|ѿwgXK?5,$  $,5@KXgwǽ{wsoljgfdccbbbbccdfgjlosw{νwgXK@5,$  $,5?KXfuü|wsoljgfedccdefgjlosw|ɸufXK?5,$  $,4>IVcrþzuqmjhfeddefhjmquz²rcVI>4,$  $+3=GS`m|zupligeddegilpuzƸ|m`SG=3+$  #*2;DO[huxsnjgeddegjnsxƺuh[OD;2*#  !(/8AKVbn{|uokgeddegkou|¸{nbVKA8/(!   &-4=FP[fq}Ľwqkgeccegkqw}qf[PF=4-&   $*18AJS]gr|ļyrlheccehlry|rg]SJA81*$  !'-4;CLT]fox¸{tmheccehmt{xof]TLC;4-'!  #)/5AEHLOSW\agnv~ù}wsqqsw}Ⱦ~vnga\WSOLHEA>:63/+'#   !$'*.147:=@CGKOU[bjt~Ⱦ~ywwy~·~tjb[UOKGC@=:741.*'$!  !#&(+-0258<@DJPX`jtĻǼtj`XPJD@<8520-+(&#!  !#%'*,/26;@GNWakw¸·wkaWNG@;62/,*'%#!   "$'*.38>FNXco|ɽ|ocXNF>83.*'$"    #'+17>GQ\huƹuh\QG>71+'#   !&+18AJUan|¹ö|naUJA81+&!  !&,3;EO[iwüwi[OE;3,&!  !'.6@JVdrſͿrdVJ@6.'!  #*2DINRVXZ[[ZXVSQOMKKKKMOQSVXZ[[ZXVRNID>93-'"  "&+05:>BFHJLLLKJHFDB@????@BDFHJKLLLJHFB>:50+&"   $(,047:<>???>=<:8754444578:<=>???><:740,($   !%(+-/13344321/.-++**++-./12344331/-+(%!   #%&()***)('&%$#""""#$%&'()***)(&%#    !!!!!  !!!!!                        "#%&&''&%$#"!! !!"#$%&''&&%#"   !$'),-/000/.-,+*)(((()*+,-./000/-,)'$!  !$(,/3589:;;:9865321111235689:;;:9853/,($!  "',059=@CEFGGFECA@><;;;;<>@ACEFGGFEC@=950,'"  #).39>CHLPRTTTSRPNLJHGFFGHJLNPRSTTTRPLHC>93.)#  #)/6EMT[bglorssrpmjgdb`__`bdgjmprssrolgb[TME>6/)#  !'.5>FOW`hov{}yvspnmmnpsvy}{voh`WOF>5.'!  %,3IT`lxxl`TI>5,%  !(09DO[hu¾¾uh[OD90(!  #+4>IUbp~ż~pbUI>4+#  &.7BN[hwǽwh[NB7.&  !(1;FR`n}ÿƹ}n`RF;1(!  #+4>JWesseWJ>4+#  %-7AM[ixƸxi[MA7-%  !(0:EQ_n}˽}n_QE:0(!  #+3=IUcrrcUI=3+#   &.7AMZhvĵvhZMA7.&   #*2;FQ^l{ľǹ{l^QF;2*#  !'.6@KWdrĽʼrdWK@6.'!   &,3BFKPV^foyĹ{yy{yof^VPKFB>:740-*'#   #&*.26:>BFJNRW]cjqz{vttv{ɾzqjc]WRNJFB>:62.*&#   $)-27;@EJNSW[`ejpw~ɽ}wsppsw}ƻ~wpje`[WSNJE@;72-)$    %*/5:@FLQW\afjoty~ƺ{tpnnpt{ù~ytojfa\WQLF@:5/*%    %*06=CJQX^ekpuzĸysommosyzupke^XQJC=60*%   $)06=EMU]elszxsommosxzsle]UME=60)$  "'.5=ENW`ir{Ǽxsommosxþ{ri`WNE=5.'"  %+2:CLV`ku¸~xspnnpsx~uk`VLC:2+%  !'/7@IT_jvż~xtqppqtx~¼vj_TI@7/'!  #*2;DOZgsŽ}xurqqrux}ƼsgZOD;2*#  %,5>ITan|»|xusrrsux||naTI>5,%  &.7ALYft{xvtsstvx{tfYLA7.&   '/9CO\kz|ywuttttuwy|ʻzk\OC9/'    (0:EQ_n~ſ~{ywvuttttuvwy{~±~n_QE:0(    (0:FSapļ}zxvuttssssssttuvxz}ȶpaSF:0(    '0:FSaqƼ|ywusrqqqqqqqqqqqqqqrsuwy|˹qaSF:0'   '0:ERaq˾~zvspnmlkkllmnnoooonnmllkklmnpsvz~̺qaRE:0'  &.9DQ`pö|vqmjgedccdefghjkllllkjhgfedccdegjmqv|˹p`QD9.&  %-7BO^nʻwpjea^\[ZZ[\^`bdeghiihgedb`^\[ZZ[\^aejpwɶn^OB7-%  #+5@M[k|~tld^ZVTRQQRSUWZ\_acdeedca_\ZWUSRQQRTVZ^dlt~Ų|k[M@5+#  "*3>JXgxȹtjaZTPLJIIIJLOQTWZ]_`aa`_]ZWTQOLJIIIJLPTZajtпxgXJ>3*"   (1;GUdtwkaXQKGDBAABDFILORUXZ\]]\ZXUROLIFDBAABDGKQXakwʺtdUG;1(   &/9ER`pǸ|odYQJD@=;:;<>@DGKNQTVXYYXVTQNKGD@><;:;=@DJQYdo|Ĵp`RE9/&  %-7BO]l|vi]SJC>:755579CJS]iv;|l]OB7-%  #,5@MZiyȻqdXNF?952111358<@DGKNPRSSRPNKGD@<853111259?FNXdqȹyiZM@5,#  "+4?KXgwķ{maUKB;62/../036:>AEILNPQQPNLIEA>:630/../26;BKUam{ĶwgXK?4+"  "*3>JWfuµyl_SIA:41.-,-/259<@DHKMOPPOMKHD@<952/-,-.14:AIS_ly´ufWJ>3*"  "*3>JWfuµyl_SIA:41.-,-/259<@DHKMOPPOMKHD@<952/-,-.14:AIS_ly´ufWJ>3*"  "+4?KXgwķ{maUKB;62/../036:>AEILNPQQPNLIEA>:630/../26;BKUam{ĶwgXK?4+"  #,5@MZiyȻqdXNF?952111358<@DGKNPRSSRPNKGD@<853111259?FNXdqȹyiZM@5,#  %-7BO]l|vi]SJC>:755579CJS]iv;|l]OB7-%  &/9ER`pǸ|odYQJD@=;:;<>@DGKNQTVXYYXVTQNKGD@><;:;=@DJQYdo|Ĵp`RE9/&   (1;GUdtwkaXQKGDBAABDFILORUXZ\]]\ZXUROLIFDBAABDGKQXakwʺtdUG;1(   "*3>JXgxȹtjaZTPLJIIIJLOQTWZ]_`aa`_]ZWTQOLJIIIJLPTZajtпxgXJ>3*"  #+5@M[k|~tld^ZVTRQQRSUWZ\_acdeedca_\ZWUSRQQRTVZ^dlt~Ų|k[M@5+#  %-7BO^nʻwpjea^\[ZZ[\^`bdeghiihgedb`^\[ZZ[\^aejpwɶn^OB7-%  &.9DQ`pö|vqmjgedccdefghjkllllkjhgfedccdegjmqv|˹p`QD9.&  '0:ERaq˾~zvspnmlkkllmnnoooonnmllkklmnpsvz~̺qaRE:0'   '0:FSaqƼ|ywusrqqqqqqqqqqqqqqrsuwy|˹qaSF:0'    (0:FSapļ}zxvuttssssssttuvxz}ȶpaSF:0(    (0:EQ_n~ſ~{ywvuttttuvwy{~±~n_QE:0(    '/9CO\kz|ywuttttuwy|ʻzk\OC9/'   &.7ALYft{xvtsstvx{tfYLA7.&  %,5>ITan|»|xusrrsux||naTI>5,%  #*2;DOZgsŽ}xurqqrux}ƼsgZOD;2*#  !'/7@IT_jvż~xtqppqtx~¼vj_TI@7/'!  %+2:CLV`ku¸~xspnnpsx~uk`VLC:2+%  "'.5=ENW`ir{Ǽxsommosxþ{ri`WNE=5.'"  $)06=EMU]elszxsommosxzsle]UME=60)$   %*06=CJQX^ekpuzĸysommosyzupke^XQJC=60*%    %*/5:@FLQW\afjoty~ƺ{tpnnpt{ù~ytojfa\WQLF@:5/*%    $)-27;@EJNSW[`ejpw~ɽ}wsppsw}ƻ~wpje`[WSNJE@;72-)$   #&*.26:>BFJNRW]cjqz{vttv{ɾzqjc]WRNJFB>:62.*&#   #'*-047:>BFKPV^foyĹ{yy{yof^VPKFB>:740-*'#    "%(+-147;@EKS[dnzȽŹznd[SKE@;741-+(%"   !#%(+.26JWesseWJ>4+#  !(1;FR`n}ÿƹ}n`RF;1(!  &.7BN[hwǽwh[NB7.&  #+4>IUbp~ż~pbUI>4+#  !(09DO[hu¾¾uh[OD90(!  %,5>IT`lxxl`TI>5,%  ")09BMWbmxxmbWMB90)"  %,3FOW`hov{}yvspnmmnpsvy}{voh`WOF>5.'!  #)/6>EMT[bglorssrpmjgdb`__`bdgjmprssrolgb[TME>6/)#  #)/6CHLPRTTTSRPNLJHGFFGHJLNPRSTTTRPLHC>93.)#  "',059=@CEFGGFECA@><;;;;<>@ACEFGGFEC@=950,'"  !$(,/3589:;;:9865321111235689:;;:9853/,($!  !$'),-/000/.-,+*)(((()*+,-./000/-,)'$!   "#%&&''&%$#"!! !!"#$%&''&&%#"                       !"####""!  !""####"!   !#&()+,,,,+*)'&%%%%%%&')*+,,,,+)(&#!  !$(+.13456654320/.----./02345665431.+($!  #',047;=?AAAA?><;98766789;<>?AAAA?=;740,'#   $).49=BFIKMNNMLJHFDBAAAABDFHJLMNNMKIFB=94.)$    %*06HT`lxxl`TH>4,$   '/9CNZgttgZNC9/'   #*3=HTan|½|naTH=3*#  %-6ALYguſøugYLA6-%  !(0:EQ^l{ľ{l^QE:0(!  #+4>IVcrƺrcVI>4+#  &.7BNZhw½whZNB7.&  ")2;FR_m|Ÿ|m_RF;2)"  %-6@KWesĽɼseWK@6-%  #)1:EP]jyǿyj]PE:1)#  !'.6@KVcqŸqcVK@6.'!   &,4EKRY`flrx}µ{vttv{}xrlf`YRKE>71+%   $*18?GOW_gnu||xvvx||ung_WOG?81*$  #)/7?GPYblu}ʾ}yxxy}ý}ulbYPG?7/)#   &-5=FPZdnyƻ|zz|yndZPF=5-&   #)19CMXcoz~}}~½zocXMC91)#  %-5>HT_lyĺǿyl_TH>5-%   '/8BNZgtûŹtgZNB8/'   ")2;FR_m|ſƸ|m_RF;2)"  #+3>IVdsósdVI>3+#  $,5?KYgw¾˻wgYK?5,$  $,6@M[jz¼zj[M@6,$  $,6AM[k|IJ|k[MA6,$  #,5AM[k|}{zyyyz{|}}|{zyyyz{}ų|k[MA5,#  #+5@L[j{ķ}yusqooopqstwy{|}~~}|{ywtsqpoooqsuy}IJ{j[L@5+#  "*3>KYhyɻ{uplhfeddegiknqtvxyzzyxvtqnkigeddefhlpu{°yhYK>3*"   (2AEINRW[_bdeedb_[WRNIEA><::;=AFLT^ivȹxhYL?4+"  !)3=JWfuŸ~pdYOGA<86567:=AEJOTX\_abba_\XTOJEA=:76568CHMQVY\^``^\YVQMHC>:7432358=DLU`mz˿sdUH<2(!   (1CHMQVY\^``^\YVQMHC>:7432358=DLU`mz˿sdUH<2(!  !)3=JWfuŸ~pdYOGA<86567:=AEJOTX\_abba_\XTOJEA=:76568AEINRW[_bdeedb_[WRNIEA><::;=AFLT^ivȹxhYL?4+"  $,6AN\l|Ķ|pe[SLGCA@@ACFJNRW[_cfhiihfc_[WRNJFCA@@ACGLS[ep|Ϳ|l\NA6,$  %.8DQ`o̾xmc[TOKIHGHJMPTX\`dgjlmmljgd`\XTPMJHGHIKOT[cmxŴo`QD8.%  '0:FTcsƸvme^YURPPPRTWZ^beilopqqpolieb^ZWTRPPPRUY^emvʹscTF:0'   (2KYhyɻ{uplhfeddegiknqtvxyzzyxvtqnkigeddefhlpu{°yhYK>3*"  #+5@L[j{ķ}yusqooopqstwy{|}~~}|{ywtsqpoooqsuy}IJ{j[L@5+#  #,5AM[k|}{zyyyz{|}}|{zyyyz{}ų|k[MA5,#  $,6AM[k|IJ|k[MA6,$  $,6@M[jz¼zj[M@6,$  $,5?KYgw¾˻wgYK?5,$  #+3>IVdsósdVI>3+#  ")2;FR_m|ſƸ|m_RF;2)"   '/8BNZgtûŹtgZNB8/'   %-5>HT_lyĺǿyl_TH>5-%  #)19CMXcoz~}}~½zocXMC91)#   &-5=FPZdnyƻ|zz|yndZPF=5-&   #)/7?GPYblu}ʾ}yxxy}ý}ulbYPG?7/)#  $*18?GOW_gnu||xvvx||ung_WOG?81*$   %+17>EKRY`flrx}µ{vttv{}xrlf`YRKE>71+%   !%*05;AGLRX]chmsyķzvttvzysmhc]XRLGA;50*%!   $)-27IVcrƺrcVI>4+#  !(0:EQ^l{ľ{l^QE:0(!  %-6ALYguſøugYLA6-%  #*3=HTan|½|naTH=3*#   '/9CNZgttgZNC9/'   $,4>HT`lxxl`TH>4,$  !(09BMXcnyyncXMB90(!  $,4<;98766789;<>?AAAA?=;740,'#  !$(+.13456654320/.----./02345665431.+($!  !#&()+,,,,+*)'&%%%%%%&')*+,,,,+)(&#!   !"####""!  !""####"!                           "$%''((('&%$#""!!""#$%&'(((''%$"    $'),./01100/-,+*))))*+,-/00110/.,)'$   #'+/2579:;;;:87543211234578:;;;:9752/+'#   %*.37;?BDFFGFECA@>=;;;;=>@ACEFGFFDB?;73.*%   !&+16IUao}ļȾ}oaUI>4,$  ")1:DO[hvùvh[OD:1)"  !'.6@JVbo}Žɿ}obVJ@6.'!   &,4JXgv˿{oe\TNJGEEFHKOSY^dinrvxyyxvrnid^YSOKHFEEGJNT\eo{ƷvgXJ>3*!   (1@BEINSY_dinqtuutqnid_YSNIEB@>?@CGMU^htsdUH<1(   '0:FSapʿ{ncXOHB>;::;=AEJOU[afjnpqqpnjfa[UOJEA=;::;>BHOXcn{ǻpaSF:0'  &/9EQ_n}ƻxk_ULD?:8668:>BGMRX^chknoonkhc^XRMGB>:8668:?DLU_kxĸ}n_QE9/&  &.9DQ^m|Ĺvi]SJC=965568<@FKQW]bfjlnnljfb]WQKF@<865569=CJS]iv¶|m^QD9.&  &.9DQ^m|Ĺvi]SJC=965568<@FKQW]bfjlnnljfb]WQKF@<865569=CJS]iv¶|m^QD9.&  &/9EQ_n}ƻxk_ULD?:8668:>BGMRX^chknoonkhc^XRMGB>:8668:?DLU_kxĸ}n_QE9/&  '0:FSapʿ{ncXOHB>;::;=AEJOU[afjnpqqpnjfa[UOJEA=;::;>BHOXcn{ǻpaSF:0'   (1@BEINSY_dinqtuutqnid_YSNIEB@>?@CGMU^htsdUH<1(   !*3>JXgv˿{oe\TNJGEEFHKOSY^dinrvxyyxvrnid^YSOKHFEEGJNT\eo{ƷvgXJ>3*!  #+5@M[jzǹwmd]WROMMNORVZ_dinsw{}~~}{wsnid_ZVRONMMORW]dmw˽zj[M@5+#  $-7BO^m~´wnga\YWVWXZ^afkoty}}ytokfa^ZXWVWY\agnw²~m^OB7-$  %.9DR`pʽyrlhebaabdgjnrv{{vrnjgdbaabehlryǶp`RD9.%  '0:FTcsƹyuqonmmnpsvy}}yvspnmmnoquy˺scTF:0'   '1;GUdt·}{zyz{|~~|{zyz{}ͼtdUG;1'    (1IUao}ļȾ}oaUI>4,$  !(09CO[hvžùvh[OC90(!  $,5?JVcp~ſǾ~pcVJ?5,$  !(1:EP]jxý¸xj]PE:1(!  %-6@LXerſ»reXL@6-%  "*2=;;;;=>@ACEFGFFDB?;73.*%   #'+/2579:;;;:87543211234578:;;;:9752/+'#   $'),./01100/-,+*))))*+,-/00110/.,)'$    "$%''((('&%$#""!!""#$%&'(((''%$"                            !"#$$##"!  !"##$$#"!    "%')*+,,++*)('&%%%%&'()*++,,+*)'%"   #&),/1345554310/.-,,-./0134555431/,)&#  !%)-158;=>???><;9865555689;<>???>=;851-)%!  !&+05:>BEHIJJJIGECA@?>>?@ACEGIJJJIHEB>:50+&!  !',28>CHMQSUVVVTRPNLJIHHIJLNPRTVVVUSQMHC>82,'!  !&,3:@GMSX\_bccba^\YWUTSSTUWY\^abccb_\XSMG@:3,&!  %+2:AIPW^dhlnppomkheb`^]]^`behkmoppnlhd^WPIA:2+%  #)18AIQZbiotx{}}|ywtpmkihhikmptwy|}}{xtoibZQIA81)#   '.6>GQZclt{{xusrrsux{{tlcZQG>6.'   #+3;ENXclv~}||}~vlcXNE;3+#   '/7AKU`kuuk`UKA7/'   #*3ELU_jwɽ|zz|ʼwj_ULE>83.*'#    $'+/38=BHOW`kv˾{yy{Ⱥvk`WOHB=83/+'$   #'+/48=BGMT[clv|zz|Ʒvlc[TMGB=84/+'#  !%*/49>CHNSZ`hpy´~{{~õyph`ZSNHC>94/*%!  "',27=CIOU[agnu}Ķ~~Ϳ}unga[UOIC=72,'"  "(-4:AGNU\biov|Ÿɽ|voib\UNGA:4-("  "'.4;CKRZbiqx~ǺǼ~xqibZRKC;4.'"   &-4JXgwǻvnhc_]\\]`cglrx~~xrlgc`]\\]_chnvǸwgXJ>3)!   (1@CHMSZagnty~~ytngaZSMHC@>==?CHOW`kwǾyj\NB7-$  $,6AMZhwŽsh]SKD?<:9:<@DJPW^ekqw{~~{wqke^WPJD@<:9:CHNU\cjpuy|~~|yupjc\UNHC>;878:=CIQ[fq~¸ugYL@5,#  #,5@LYguû~qf[QIC=:878;>CHNU\cjpuy|~~|yupjc\UNHC>;878:=CIQ[fq~¸ugYL@5,#  $,6AMZhwŽsh]SKD?<:9:<@DJPW^ekqw{~~{wqke^WPJD@<:9:@CHMSZagnty~~ytngaZSMHC@>==?CHOW`kwǾyj\NB7-$  %.8DP^m|Ƽ}qf\TNHECBCEHLRW^elrx}}xrle^WRLHECBCEHNT\fq}¶|m^PD8.%  '0:FSap÷xmc[UPLJIJKNSX]djqw}}wqjd]XSNKJIJLPU[cmxȼpaSF:0'   (1JXgwǻvnhc_]\\]`cglrx~~xrlgc`]\\]_chnvǸwgXJ>3)!  "+5@LZiz÷ztokihghjmquzzuqmjhghikotz˼ziZL@5+"  #,6AN\l||yvutuvx{{xvutuvy||l\NA6,#  $-7BO]m}ɾ±}m]OB7-$  $-7CP^m~Ǿ±~m^PC7-$  %-7BO]m}}m]OB7-%  $-6AN\kz˼zk\NA6-$  $,5@LYgw¿ŶwgYL@5,$  "*3=IVcrɼrcVI=3*"  !(1:EQ^lzſɾzl^QE:1(!  &.7ALXerƿżreXLA7.&  $+3CHNSZ`hpy´~{{~õyph`ZSNHC>94/*%!  #'+/48=BGMT[clv|zz|Ʒvlc[TMGB=84/+'#   $'+/38=BHOW`kv˾{yy{Ⱥvk`WOHB=83/+'$    #'*.38>ELU_jwɽ|zz|ʼwj_ULE>83.*'#    #&+/5;CKU`kxǼ~{{~ʾxk`UKC;5/+&#    #(-3:BKUamzƼ~~ʾzmaUKB:3-(#   !&,2:BLWcp}Ƽɿ}pcWLB:2,&!   %+2:DNYfsƽȿsfYND:2+%    %,3GQZclt{{xusrrsux{{tlcZQG>6.'   #)18AIQZbiotx{}}|ywtpmkihhikmptwy|}}{xtoibZQIA81)#  %+2:AIPW^dhlnppomkheb`^]]^`behkmoppnlhd^WPIA:2+%  !&,3:@GMSX\_bccba^\YWUTSSTUWY\^abccb_\XSMG@:3,&!  !',28>CHMQSUVVVTRPNLJIHHIJLNPRTVVVUSQMHC>82,'!  !&+05:>BEHIJJJIGECA@?>>?@ACEGIJJJIHEB>:50+&!  !%)-158;=>???><;9865555689;<>???>=;851-)%!  #&),/1345554310/.-,,-./0134555431/,)&#   "%')*+,,++*)('&%%%%&'()*++,,+*)'%"    !"#$$##"!  !"##$$#"!                            "$%&''&&%$#"!! !!"#$%&&''&%$"   !$'*,-.//..-,*)((''(()*,-..//.-,*'$!   $(+/2467887754310////0134577887642/+($   "&+/37:=?ABBA@?=<:987789:<=?@ABBA?=:73/+&"  "',17;@DGJKLLLKIGECBA@@ABCEGIKLLLKJGD@;71,'"  "'-39?DINRUWXXWVTQOMKJIIJKMOQTVWXXWURNID?93-'"   &,3:@GMSX\`bccba_\YWUTSSTUWY\_abccb`\XSMG@:3,&   %+29AHPW]cgkmoonligda_]\\]_adgilnoomkgc]WPHA92+%  ")08@HPX`gmrvyzzywtqnkhfeefhknqtwyzzyvrmg`XPH@80)"   &-5=FOXaiqw}~zwtqonnoqtwz~}wqiaXOF=5-&   #*2:CLV`irz|ywuuwy|zri`VLC:2*#   &.6?IS]gqz}||}zqg]SI?6.&   #*2;EOYdoyyodYOE;2*#   '.7@JU`kvvk`UJ@7.'   #*3DJPV\cjrzȺzrjc\VPJD>83-(#  #)/5;BHOV\cjpw˾ʽwpjc\VOHB;5/)#  #)/6=ELT[cjqxǻxqjc[TLE=6/)#  "(/6>FNW`hpxĹŻxph`WNF>6/("   &-5=FOXblu~żŽ~ulbXOF=5-&   #*2:DNXcmxƾ½xmcXND:2*#   &.7@JUalxƿĿxlaUJ@7.&   ")2;EQ]ivvi]QE;2)"  $,5?JVcq~¿ż~qcVJ?5,$  &.8CN[iwǼwi[NC8.&   '0:ER_n}¿ĸ}n_RE:0'   !(1AEKRYaiqyyqiaYRKEA><<=?DIQYcnz¾}oaTH<2)!  !(1AEKRYaiqyyqiaYRKEA><<=?DIQYcnz¾}oaTH<2)!  "*3=IUcqþ}rg]TMGC@?@ADINU\dlt||tld\UNIDA@?@CGMT]gr}»qcUI=3*"  #+4?KXetûwlbZSMIFEEGJNSZaiqyyqiaZSNJGEEFIMSZblwƿteXK?4+#  $,6AMZhw~sjaZTPMLLNQUZ`gov~~vog`ZUQNLLMPTZajs~ŻwhZMA6,$  %.8CO]kzɿ|rjc]YVUUWY]bhnv}}vnhb]YWUUVY]cjr|zk]OC8.%  &/9ER`n~ǽ|tmhda``acgkqw~~wqkgca``adhmt|ƺ~n`RE9/&  '0;GTbqźytpnllmorv{{vromllnpty˾qbTG;0'   (1FNW`hpxĹŻxph`WNF>6/("  #)/6=ELT[cjqxǻxqjc[TLE=6/)#  #)/5;BHOV\cjpw˾ʽwpjc\VOHB;5/)#  #(-38>DJPV\cjrzȺzrjc\VPJD>83-(#  "&+/49?DJPV]emwķ~~Ŷwme]VPJD?94/+&"   #(,059?DJQYakv}zz}ȹvkaYQJD?950,(#   !$(,05:@FNV_jvʽzxxzʼvj_VNF@:50,($!  !$(,16@BCCBA@><;:9889:;<>@ABCCB@>;840+&"  "',27<@DGJLMMLKIGECBA@@ABCEGIKLMMLJGD@<72,'"  !',28>DIMQTVWWVUSQNLJIHHIJLNQSUVWWVTQMID>82,'!   &,29?FLRW[^`aa`^\ZWUSQQQQSUWZ\^`aa`^[WRLF?92,&   $*18?FNTZ`dhjkkjhfc`][ZYYZ[]`cfhjkkjhd`ZTNF?81*$  "(/6>FNU]cinqtutsqnkheca``acehknqstutqnic]UNF>6/("  %,4;DLU]elrwz}~}|zwspmjhgghjmpswz|}~}zwrle]ULD;4,%  #)19AJS\emtz~zvspnmmnpsvz~ztme\SJA91)#   &-5>GPZclt||xusrrsux||tlcZPG>5-&   #*2:CMW`js||ywuuwy||sj`WMC:2*#  !'/7@IS]gq{|yxxy|{qg]SI@7/'!  %,4GR]hs~|ywwy|~sh]RG>5-&   $+3DJPW^emvʽvme^WPJD>93.)$   %*06FMT[bipwƻĸwpib[TMF>81+%  $*18@GPX`how~~woh`XPG@81*$  "(/7?HQZclt}ļȿ}tlcZQH?7/("  &-5=FPZdnxxndZPF=5-&  ")1:CNXcnyþyncXNC:1)"  %-5?IT`lxĿxl`TI?5-%   '09CNZgtſtgZNC90'   "*2AEKQYbkt}}tkbYQKEA>==?BGMU^hr}sfZMB7.%  %-7AMYer{pf\SKE@=;;AEKQYbkt}}tkbYQKEA>==?BGMU^hr}sfZMB7.%  &/8CO[huvkaYQKFCAABEINU]enwwne]UNIEBAACFKQYakvuh[OC8/&   '0:EQ]kx{pg^WPLHGFGJNTZbjs||sjbZTNJGFGHLPW^gp{xk]QE:0'   !(1;GS`n{wne^XSPNNOQU[ahqyyqha[UQONNPSX^enw{n`SG;1(!  "*3=IUcq»vnga\YWWXZ^cipxxpic^ZXWWY\agnvûqcUI=3*"  #+4?KXftºxqkgdbbcehmsyysmhecbbdgkqxtfXK?4+#  $,6AMZhw¹}wsponoqtx}}xtqonopsw}żwhZMA6,$  $-7BN\jy~}|}~¾~}|}~ɿyj\NB7-$  %.7CO\kzþzk\OC7.%  %.8CO]kzþzk]OC8.%  %-7BN\jy¾ÿʿyj\NB7-%  $-6AMZhvƻvhZMA6-$  #+5?JWdrrdWJ?5+#  "*2FMT[bipwƻĸwpib[TMF>81+%   %*06DJPW^emvʽvme^WPJD>93.)$  "'+05:?EKRYajtŸĵtjaYRKE?:50+'"   $(,16;@GNV^ht}zz}ȹth^VNG@;61,($   !%)-27=CKT]htǺ}xvvx}ʼth]TKC=72-)%!  "%*.4:AJS]iv¶zvssvzʽvi]SJA:4.*%"  #',29@IS^kxǼ~xtrrtx~Ƚxk^SI@92,'#   %*18@JT`ly}wsqqsw}Żyl`TJ@81*%   $*08AKVan{ü}wsqqsw}{naVKA80*$  $*19BLWco|½~xtsstx~|ocWLB91*$  $*2:CNYdp}yvttvy}pdYNC:2*$  $+3GR]hs~|ywwy|~sh]RG>5-&   !'/7@JT_ju}zyyz}uj_TJ@7/'!  #)19CMWblw~{yy{~wlbWMC91)#  %,4GPZclt||xusrrsux||tlcZPG>5-&   #)19AJS\emtz~zvspnmmnpsvz~ztme\SJA91)#  %,4;DLU]elrwz}~}|zwspmjhgghjmpswz|}~}zwrle]ULD;4,%  "(/6>FNU]cinqtutsqnkheca``acehknqstutqnic]UNF>6/("  $*18?FNTZ`dhjkkjhfc`][ZYYZ[]`cfhjkkjhd`ZTNF?81*$   &,29?FLRW[^`aa`^\ZWUSQQQQSUWZ\^`aa`^[WRLF?92,&   !',28>DIMQTVWWVUSQNLJIHHIJLNQSUVWWVTQMID>82,'!  "',27<@DGJLMMLKIGECBA@@ABCEGIKLMMLJGD@<72,'"  "&+048;>@BCCBA@><;:9889:;<>@ABCCB@>;840+&"  !%)-035799:987643210012346789:997530-)%!  #&)+-/01100/-,+*))))*+,-/00110/-+)&#   "$&'()))('&%$##""##$%&'()))('&$"    !""!!  !!""!                         !"####""!  !""####"!   #%'()***)('&%$$##$$%&'()***)('%#    #&),.011210/.-,+****+,-./012110.,)&#   !%)-03689::987643210012346789::98630-)%!  "&+/37;>@ABBBA?=<:987789:<=?ABBBA@>;73/+&"  "&,16:?CFHJKKJIGEDB@?>>?@BDEGIJKKJHFC?:61,&"  !&+17GQZdmv~|wrnlkklnrw|~vmdZQG>6.'!  %,4HR^jw}vpljjlpv}wj^RH>6/)#   %*06>GQ\huxrnllnrxĹuh\QG>60*%   #',17?GP[gsǼ|vroorv|Ǻsg[PG?71,'#  "%*.49@HQZerözvttvzǹreZQH@94.*%"  !$)-27IUamy|ri`YRMJGFGIMRY`is}}si`YRMIGFGJMRY`ir|ymaUI>4+#  #*3=HS_kwwmd[TMHDBAADGMS[dmxxmd[SMGDAABDHMT[dmwwk_SH=3*#  "*2=>@DIOW`jttj`WOID@>=>@DIPX`js}ui]QF<2*"  ")2;FQ\ht{rh^VNHB><;<>BGNU^hr}}rh^UNGB><;<>BHNV^hr{th\QF;2)"  ")2;FQ\ht{rh^VNHB><;<>BGNU^hr}}rh^UNGB><;<>BHNV^hr{th\QF;2)"  "*2=>@DIOW`jttj`WOID@>=>@DIPX`js}ui]QF<2*"  #*3=HS_kwwmd[TMHDBAADGMS[dmxxmd[SMGDAABDHMT[dmwwk_SH=3*#  #+4>IUamy|ri`YRMJGFGIMRY`is}}si`YRMIGFGJMRY`ir|ymaUI>4+#  $-6@KWdp}ypg`ZUQONOQTY`gpyypg`YTQONOQUZ`gpy}pdWK@6-$  &.7BNZgtxohb^ZXWXZ]bhpxxphb]ZXWXZ^bhoxtgZNB7.&  '/9DP\iwyrmhecbcehmryyrmhecbcehmrywi\PD9/'   (0:FR^ly¿}xtqoooqty~~ytqoooqtx}yl^RF:0(   !(1;GS`n|}}}}}}Ŀ|n`SG;1(!  !)2GQ\huxrnllnrxĹuh\QG>60*%   #)/6>HR^jw}vpljjlpv}wj^RH>6/)#  "(/6?IS_kxÿ{tokiikot{xk_SI?6/("  "(/7@JU`lxzsnjiijnszxl`UJ@7/("  #)08AKValxysnkiiknsyxlaVKA80)#  #*19CLWalwxsnkiiknsxwlaWLC91*#  $+2;DNXblv~xsoljjlosx~vlbXND;2+$  %,4GQZdmv~|wrnlkklnrw|~vmdZQG>6.'!  ")08@IR\env}zuqnkjjknquz}vne\RI@80)"  $+2:CKT]fnu||wsoljhhjlosw||unf]TKC:2+$   &-5=ENV_gntz~|xtpligffgilptx|~ztng_VNE=5-&   ")07?GPX_gmswz||{yvsolhfdccdfhlosvy{||zwsmg_XPG?70)"  %+2:AIQX_fkortutspmjgda_^^_adgjmpstutrokf_XQIA:2+%  !'-4>?@BDEGIJKKJHFC?:61,&"  "&+/37;>@ABBBA?=<:987789:<=?ABBBA@>;73/+&"  !%)-03689::987643210012346789::98630-)%!   #&),.011210/.-,+****+,-./012110.,)&#    #%'()***)('&%$$##$$%&'()***)('%#   !"####""!  !""####"!                          !"#$$##"!  !"##$$#"!   !#%'))***)('&%$$##$$%&'()***))'%#!   #&)+./01110/.,+*))))*+,./01110/.+)&#   !$(,/2468888764310////0134678888642/,($!  !%*.269<>?@@?>=;9876556789;=>?@@?><962.*%!  !%*/48<@CEGGGGFDB@>=<;;<=>@BDFGGGGEC@<84/*%!   %*/5:?CGJMNOONMKIGECBAABCEGIKMNOONMJGC?:5/*%   #)/5:@EJNRTVWVUTROMKIHGGHIKMORTUVWVTRNJE@:5/)#  "(.4:@FLQVY\]^]\ZXUSPNMLLMNPSUXZ\]^]\YVQLF@:4.("   &,29@GMSX]`cdedc`^[XUSQQQQSUX[^`cdedc`]XSMG@92,&   $*18?FMTZ_dgjkkjhfc`\YWUTTUWY\`cfhjkkjgd_ZTMF?81*$  #)/6=ELTZafknpqqpnkgd`]ZXWWXZ]`dgknpqqpnkfaZTLE=6/)#  !'.5GQ\hs~~voida__adiov~~sh\QG>5-'!  !&-4=FQ\gsyrkfbaabfkrysg\QF=4-&!  !'-4EMV`lxŹ~zxxz~xl`VME>82-)%!  #',05;AGOW`jv̽vj`WOGA;50,'#   %*.39>DJQYajuȼƷujaYQJD>93.*%   !&+16GPZclu}}ulcZPG>6.'   #*2:DMWaku~~ukaWMD:2*#  &-6?IS^is~~si^SI?6-&  !(09CMXdoz¿zodXMC90(!  "*2HT`lxxl`TH>4+#  $,5?JVbn{{nbVJ?5,$  $,6@KWcp|û|pcWK@6,$  $,6@KWcp|ú|pcWK@6,$  $,5?JVbo{}{{|}ĺ}|{{}{obVJ?5,$  #+4>IUamy{wspnmnorv|Ƽ|vronmnpsw{ymaUI>4+#  #*3=GS_kwxqlgdbaacfjpwȾwpjfcaabdglqxwk_SG=3*#  ")2;EQ\hs~vohb]ZWVVX[`fmuumf`[XVVWZ]bhov~sh\QE;2)"  !(09DNYep{wog`ZUQNMMORW]dmvvmd]WROMMNQUZ`gow{peYND90(!   '/8BLWbmxzqiaYSNJGFFGKOU]fpzzpf]UOKGFFGJNSYaiqzxmbWLB8/'   &.7@JU`ku~}uld\TNHDA@@BEJPW`juuj`WPJEB@@ADHNT\dlu}~uk`UJ@7.&  %-6?IT^is|zriaXQJEA><<>AFLT\fq}}qf\TLFA><<>AEJQXairz|si^TI?6-%  %-5>HS]hr{xpg_WOIC?<:;5-%  %-5>HS]hr{xpg_WOIC?<:;5-%  %-6?IT^is|zriaXQJEA><<>AFLT\fq}}qf\TLFA><<>AEJQXairz|si^TI?6-%  &.7@JU`ku~}uld\TNHDA@@BEJPW`juuj`WPJEB@@ADHNT\dlu}~uk`UJ@7.&   '/8BLWbmxzqiaYSNJGFFGKOU]fpzzpf]UOKGFFGJNSYaiqzxmbWLB8/'   !(09DNYep{wog`ZUQNMMORW]dmvvmd]WROMMNQUZ`gow{peYND90(!  ")2;EQ\hs~vohb]ZWVVX[`fmuumf`[XVVWZ]bhov~sh\QE;2)"  #*3=GS_kwxqlgdbaacfjpwȾwpjfcaabdglqxwk_SG=3*#  #+4>IUamy{wspnmnorv|Ƽ|vronmnpsw{ymaUI>4+#  $,5?JVbo{}{{|}ĺ}|{{}{obVJ?5,$  $,6@KWcp|ú|pcWK@6,$  $,6@KWcp|û|pcWK@6,$  $,5?JVbn{{nbVJ?5,$  #+4>HT`lxxl`TH>4+#  "*2GPZclu}}ulcZPG>6.'   #*18@IQZbkrzƽzrkbZQI@81*#  %,2:AIQX`hov}ÿø}voh`XQIA:2,%  !&,3:AHOV]dkry̿yrkd]VOHA:3,&!  "',28?ELRY`gnvƹvng`YRLE?82,'"  !&+16DJQYajuȼƷujaYQJD>93.*%   #',05;AGOW`jv̽vj`WOGA;50,'#  !%)-28>EMV`lxŹ~zxxz~xl`VME>82-)%!  "&+06GQ\hs~~voida__adiov~~sh\QG>5-'!  !'.6?HR\gr|{tmgc`^^`cgmt{|rg\RH?6.'!  "(/7?IR\fpyxrlfb_^^_bflrxypf\RI?7/("  ")08@IR\enw~|vpjea_]]_aejpv|~wne\RI@80)"  #*19AIR[dlt{~ytnida^]]^adinty~{tld[RIA91*#  $+2:BJS[ckrx}~zvqlhc`^\\^`chlqvz~}xrkc[SJB:2+$   &,3;CKS[bipuy|}}|zvsnjfb_][[]_bfjnsvz|}}|yupib[SKC;3,&   !'.5=<;;<=>@BDFGGGGEC@<84/*%!  !%*.269<>?@@?>=;9876556789;=>?@@?><962.*%!  !$(,/2468888764310////0134678888642/,($!   #&)+./01110/.,+*))))*+,./01110/.+)&#   !#%'))***)('&%$$##$$%&'()***))'%#!   !"#$$##"!  !"##$$#"!                        !"####""!  !""####"!   "$&())))('&%$##""##$%&'())))(&$"   "%(*,.////.-,+)((''(()+,-.////.,*(%"  #'*-02456654320/.----./02345665420-*'#   $(,0368:<<<;:97643222234679:;<<<:8630,($   $(-159DJRZcnyĹͿyncZRJD>83.)%!  "&+05;AGMT[dmw¸Ʒwmd[TMGA;50+&"  "',28>DJPW^emv̾vme^WPJD>82,'"  "'-39@FMSZ`gowýµwog`ZSMF@93-'"  !&,3:AHOV]djqxŹxqjd]VOHA:3,&!  $+29@HPW_fmt{ƻ{tmf_WPH@92+$  "(/7?GOX`hpw~ż~wph`XOG?7/("  %,3GR\gq{{qg\RG>4,%  &.6@JU_ju¿uj_UJ@6.&   '/8ALWbmxľxmbWLA8/'    '/8BMXcnyyncXMB8/'    '/8BMXcnyyncXMB8/'    '/8BLWbmx}zxwwwy|ø|ywwwxz}xmbWLB8/'   &.7AKVakv|wsoljjjknrw~ƺ~wrnkjjjlosw|vkaVKA7.&  %-6?IT^is}zsnida_^^_bfkrzɾzrkfb_^^_adinsz}si^TI?6-%  $,4=GQ\fpyyrle`[WUTSUW[ahpzzpha[WUSTUW[`elryypf\QG=4,$  #+3>?AEKR[ep{{pe[RKEA?>>@CHMSZaipw}~xph_UKB90(!  !(/8AJT]fnv|ztmf^WPJD@=;:;>BGNWalxŽxlaWNGB>;:;=@DJPW^fmtz|vnf]TJA8/(!  !'/7@IS\emt{}ysld]VOHC>;999<@EMU_jv»vj_UME@<999;>CHOV]dlsy}{tme\SI@7/'!  !'/7@IS\emt{}ysld]VOHC>;999<@EMU_jv»vj_UME@<999;>CHOV]dlsy}{tme\SI@7/'!  !(/8AJT]fnv|ztmf^WPJD@=;:;>BGNWalxŽxlaWNGB>;:;=@DJPW^fmtz|vnf]TJA8/(!  !(09BKU_hpx~}wpiaZSMHC@>>?AEKR[ep{{pe[RKEA?>>@CHMSZaipw}~xph_UKB90(!  ")1:CMWajs{{tmf_XRMIFDCDGKQX`juǾuj`XQKGDCDFIMRX_fmt{{sjaWMC:1)"  #+3GR\gq{{qg\RG>4,%  #*2;DNXblvvlbXND;2*#  !(/7@IS]foxľxof]SI@7/(!  %,3DJPW^emv̾vme^WPJD>82,'"  "&+05;AGMT[dmw¸Ʒwmd[TMGA;50+&"  !%).38>DJRZcnyĹͿyncZRJD>83.)%!  #'+05;BIQZdp|ȼĵ|pdZQIB;50+'#  !%).39@HQ[fr˿|xvvx|ǹrf[QH@93.)%!  #',28@HR]iuyspnnpsyǻui]RH@82,'#  !&+18@IS_kxyrlhffhlryĺxk_SI@81+&!   %*18AJUamzžzrkfbaabfkrzſzmaUJA81*%   $*19BLVbnz}umfa^\\^afmu}znbVLB91*$  $*2:CMWcnyxphb]ZXXZ]bhpxyncWMC:2*$  %+2;DMXbmw{ske_ZWVVWZ_eks{wmbXMD;2+%  %,3;DNWakt}}vohb\XUTTUX\bhov}}tkaWND;3,%   &,4<:87655678:<>@ABCBA@=:73/*&"  !&*/48=@CFGHHGFDB@><:9999:<>@BDFGHHGFC@=84/*&!  !%*/59>BFIKMMMLKIFDA?=<<<<=?ADFIKLMMMKIFB>95/*%!   %*05:@DILOQSSRQOMJGEB@?>>?@BEGJMOQRSSQOLID@:50*%    %*05;AFKOSVXXXXVTQNKGECA@@ACEGKNQTVXXXXVSOKFA;50*%   $*06ELSY_dhklmlkhe`\WSOKHFEEFHKOSW\`ehklmlkhd_YSLE>70*$  $*08?GNV]dinrtvutrnje`[VQMJHFFHJMQV[`ejnrtuvtrnid]VNG?80*$  #)08@HPYahouy}}yupjd_YTOLIHHILOTY_djpuy}}yuohaYPH@80)#  #)08@IR[dlt{}wpic\WRNKJJKNRW\cipw}{tld[RI@80)#  "(/7@IR\fpy~woha[UQNMMNQU[ahow~ypf\RI@7/("  "(/6?HR]hr}~vmf_YURPPRUY_fmv~}rh]RH?6/("  "'.5>GR]ht}tle^ZWUUWZ^elt}th]RG>5.'"  "'-5=FP[gs{ske`\[[\`eks{sg[PF=5-'"  "'-4DJPV]dlt}þķ}tld]VPJD>82,'"  !&,28?ELRX_elt{Ź{tle_XRLE?82,&!   %+18?FMTZagnt{ź{tngaZTMF?81+%   #)07>EMT[bipv|¸|vpib[TME>70)#   &-4;CKS[cjqw}ƽ}wqjc[SKC;4-&   ")08@HQYbjqx~ž~xqjbYQH@80)"  $+3;DMV_gow~Ŀ~wog_VMD;3+$   &.6>GQZclt||tlcZQG>6.&   !(/8@JS]foxxof]SJ@8/(!  ")09BKU_irzƿzri_UKB90)"  ")1:CLV`js{ż{sj`VLC:1)"  ")1:CLV`js{~}}}Ǽ}}}~{sj`VLC:1)"  ")19BLV_irz}yvsrppqsuy}ʾ}yusqpprsvy}zri_VLB91)"  !(08AKT^gpx~~yupligeddfhlpw~µ~wplhfddegilpuy~~xpg^TKA80(!   '/7@IR\emu{|wrmhd`]ZYYZ\`eks|ƹ|ske`\ZYYZ]`dhmrw|{ume\RI@7/'    &.6>GPYbjrx}{vqlfa\WTQPOPRV[air}ʾ}ria[VRPOPQTW\aflqv{}xrjbYPG>6.&   %,4<;;=AELT]htth]TLEA=;;<>AFKQW]cinruvwurnib[SJB:2*#  #)19AIQY`glpsttrokf`ZTNHC>;988:=BHPYdp}ǽ}pdYPHB=:889;>CHNTZ`fkorttsplg`YQIA91)#  ")08@HPX_fkorssqnje_YRLFA=97668;@FNXbn{Ż{nbXNF@;86679=AFLRY_ejnqssrokf_XPH@80)"  ")08@HPX_fkorssqnje_YRLFA=97668;@FNXbn{Ż{nbXNF@;86679=AFLRY_ejnqssrokf_XPH@80)"  #)19AIQY`glpsttrokf`ZTNHC>;988:=BHPYdp}ǽ}pdYPHB=:889;>CHNTZ`fkorttsplg`YQIA91)#  #*2:BJS[binruwvurnic]WQKFA><;;=AELT]htth]TLEA=;;<>AFKQW]cinruvwurnib[SJB:2*#  $+3;CLU]dkquxzzxuqlga[UOJFCA@ACFKQYcmyǼymcYQKFCA@ACFJOU[aglquxzzxuqkd]ULC;3+$  %,4GPYbjrx}{vqlfa\WTQPOPRV[air}ʾ}ria[VRPOPQTW\aflqv{}xrjbYPG>6.&    '/7@IR\emu{|wrmhd`]ZYYZ\`eks|ƹ|ske`\ZYYZ]`dhmrw|{ume\RI@7/'   !(08AKT^gpx~~yupligeddfhlpw~µ~wplhfddegilpuy~~xpg^TKA80(!  ")19BLV_irz}yvsrppqsuy}ʾ}yusqpprsvy}zri_VLB91)"  ")1:CLV`js{~}}}Ǽ}}}~{sj`VLC:1)"  ")1:CLV`js{ż{sj`VLC:1)"  ")09BKU_irzƿzri_UKB90)"  !(/8@JS]foxxof]SJ@8/(!   &.6>GQZclt||tlcZQG>6.&   $+3;DMV_gow~Ŀ~wog_VMD;3+$  ")08@HQYbjqx~ž~xqjbYQH@80)"   &-4;CKS[cjqw}ƽ}wqjc[SKC;4-&   #)07>EMT[bipv|¸|vpib[TME>70)#   %+18?FMTZagnt{ź{tngaZTMF?81+%   !&,28?ELRX_elt{Ź{tle_XRLE?82,&!  "',28>DJPV]dlt}þķ}tld]VPJD>82,'"  "',16GR]ht}tle^ZWUUWZ^elt}th]RG>5.'"  "(/6?HR]hr}~vmf_YURPPRUY_fmv~}rh]RH?6/("  "(/7@IR\fpy~woha[UQNMMNQU[ahow~ypf\RI@7/("  #)08@IR[dlt{}wpic\WRNKJJKNRW\cipw}{tld[RI@80)#  #)08@HPYahouy}}yupjd_YTOLIHHILOTY_djpuy}}yuohaYPH@80)#  $*08?GNV]dinrtvutrnje`[VQMJHFFHJMQV[`ejnrtuvtrnid]VNG?80*$  $*07>ELSY_dhklmlkhe`\WSOKHFEEFHKOSW\`ehklmlkhd_YSLE>70*$  $*06=DJPV[_bdeedb_\XTPLIFDDDDFILPTX\_bdeedb_[VPJD=60*$  $*06>?@BEGJMOQRSSQOLID@:50*%   !%*/59>BFIKMMMLKIFDA?=<<<<=?ADFIKLMMMKIFB>95/*%!  !&*/48=@CFGHHGFDB@><:9999:<>@BDFGHHGFC@=84/*&!  "&*/37:=@ABCBA@><:87655678:<>@ABCBA@=:73/*&"  "&*.258:<===<;98643211234689;<===<:852.*&"  "&)-0256787764310/.--./0134677876520-)&"  !%(+-/122210/.-+**))**+-./012221/-+(%!   #&(*+,,,,+*)('&%%%%&'()*+,,,,+*(&#   !#%&''''&%$#"!!!!!!"#$%&''''&%#!   !""""!  !""""!                                   !"#$$$$##"!  !"##$$$$#"!  !#%'()))(('&$##""""##$&'(()))('%#!  "%'*+--..-,+*('&%%%%&'(*+,-..--+*'%"   #&),.0122210/.,+*)(()*+,./0122210.,)&#    $'+.135677765310.-,,,,-.013567776531.+'$    $(,0368:;<<;:975310/../013579:;<<;:8630,($    $)-158;>?@AA@><:864321123468:<>@AA@?>;851-)$    %).27;>ACEFFEDB@>;9754334579;>@BDEFFECA>;72.)%    %*/48=ADGIKKKJIFDA><97655679<>ADFIJKKKIGDA=84/*%   !%+05:?DHKNPQQQOMJHDA><987789<>ADHJMOQQQPNKHD?:50+%!  !&+17;:99:;>ADHKORUWXXWVSPLGB<71+&!  !&,28?EKPUY\^``_]ZWSOKGC@=;;;;=@CGKOSWZ]_``^\YUPKE?82,&!  !&,3:AGNTZ_cfhihgda]XTOJFB?=<<=?BFJOTX]adghihfc_ZTNGA:3,&!  !&-3;BJQX_ejnqrrqolhc^XSNIEB@??@BEINSX^chloqrrqnje_XQJB;3-&!   &,4;CLT\dkqvz}~}|yupjd^XRMHEBAABEHMRX^djpuy|}~}zvqkd\TLC;4,&    %,3;DMV_hpx~~xrkd]WQLHFEEFHLQW]dkrx~~xph_VMD;3,%   %+3;CMWajt}zskc\VQMJIIJMQV\cksz}tjaWMC;3+%  $*2:BLValw{rjc\WRPNNPRW\cjr{wlaVLB:2*$  $*18AKU`lw{rjc^YVTTVY^cjr{wl`UKA81*$  $)07?IS^jv{slfa^\\^afls{vj^SI?70)$   $)/6>GQ\gtž|uojgeegjou|ļtg\QG>6/)$   !%*/5=ENYdp}ytqppqtyȾ}pdYNE=5/*%!  "&+06FMU[bhnsx}ž}xsnhb[UMF>70)#  %,3:BJRY`gmsx|¾|xsmg`YRJB:3,%  !'.5=EMV]ekqv{{vqke]VME=5.'!  ")07?HPX`hnty}}ytnh`XPH?70)"  #)19AIRZbjpv{~ƽ~{vpjbZRIA91)#  #*19BJS[cjqv{~~~~~Ǽ~~~~~{vqjc[SJB91*#  #*2:BJS[cjqvz}~|{ywutsstuwz}ʾ}zwutsstuwy{|~}zvqjc[SJB:2*#  #*19AJRZbiotx{||{zwuromkihhijmpuz´zupmjihhikmoruwz{||{xtoibZRJA91*#  ")08@IQY`gmruxyxwurokhdb_^]]^adhnu}ǹ}unhda^]]^_bdhkoruwxyxurmg`YQI@80)"  "(/7?GOW^ejortutrpmiea]YWTSSTVY]cjr|̾|rjc]YVTSSTWY]aeimprtutroje^WOG?7/("  !'.6=EMU\bglopqpnkgc_ZVROLKJJLOSY`is~ĵ~si`YSOLJJKLORVZ_cgknpqpolgb\UME=6.'!   &-4;9778;?ELT_jwɽwj_TLE?;8779;>BGLQV[_ceffec_ZUNG@92+$  $*18?FMSY]acedc`]YTOID@;864458ELRX\`bccb_\XSMHC>:743246:?FOYeq¶qeYOF?:642347:>CHMSX\_bccb`\XRLE>70*#  #*07>ELRX\`bccb_\XSMHC>:743246:?FOYeq¶qeYOF?:642347:>CHMSX\_bccb`\XRLE>70*#  $*18?FMSY]acedc`]YTOID@;864458;9778;?ELT_jwɽwj_TLE?;8779;>BGLQV[_ceffec_ZUNG@92+$  %,3:AIPW\aehiihfb^ZUPKFC?=<<=@DJQZdo|µ|odZQJD@=<<=?CFKPUZ^bfhiihea\WPIA:3,%   &-4FMU[bhnsx}ž}xsnhb[UMF>70)#  !&-3:AHOV\bhnsy~~ysnhb\VOHA:3-&!  #)/5GQ\gtž|uojgeegjou|ļtg\QG>6/)$   $)07?IS^jv{slfa^\\^afls{vj^SI?70)$  $*18AKU`lw{rjc^YVTTVY^cjr{wl`UKA81*$  $*2:BLValw{rjc\WRPNNPRW\cjr{wlaVLB:2*$  %+3;CMWajt}zskc\VQMJIIJMQV\cksz}tjaWMC;3+%   %,3;DMV_hpx~~xrkd]WQLHFEEFHLQW]dkrx~~xph_VMD;3,%    &,4;CLT\dkqvz}~}|yupjd^XRMHEBAABEHMRX^djpuy|}~}zvqkd\TLC;4,&   !&-3;BJQX_ejnqrrqolhc^XSNIEB@??@BEINSX^chloqrrqnje_XQJB;3-&!  !&,3:AGNTZ_cfhihgda]XTOJFB?=<<=?BFJOTX]adghihfc_ZTNGA:3,&!  !&,28?EKPUY\^``_]ZWSOKGC@=;;;;=@CGKOSWZ]_``^\YUPKE?82,&!  !&+17;:99:;>ADHKORUWXXWVSPLGB<71+&!  !%+05:?DHKNPQQQOMJHDA><987789<>ADHJMOQQQPNKHD?:50+%!   %*/48=ADGIKKKJIFDA><97655679<>ADFIJKKKIGDA=84/*%    %).27;>ACEFFEDB@>;9754334579;>@BDEFFECA>;72.)%    $)-158;>?@AA@><:864321123468:<>@AA@?>;851-)$    $(,0368:;<<;:975310/../013579:;<<;:8630,($    $'+.135677765310.-,,,,-.013567776531.+'$    #&),.0122210/.,+*)(()*+,./0122210.,)&#   "%'*+--..-,+*('&%%%%&'(*+,-..--+*'%"  !#%'()))(('&$##""""##$&'(()))('%#!  !"#$$$$##"!  !"##$$$$#"!                                     !!!!  !!!!    "#$%%%$$#"!  !"#$$%%%$#"    "$&'()))('&%$#"!!!!"#$%&'()))('&$"   !$&(*,----,+)('%$$##$$%'()+,----,*(&$!  "%(*-/011110.-+*('&&&&'(*+-.011110/-*(%"  #&)-/2356655320.,+)(((()+,.0235566532/-)&#   $'+/2579::::97531/-,+**+,-/13579::::9752/+'$    %)-148;=>?@?>=;8641/.,,,,./1468;=>?@?>=;841-)%   !&*/37;>ACEEEDCA?<96410....01469;73/*&!  "',16:?CFIKLLKJHFC@<96420//02469<@CFHJKLLKIFC?:61,'"  #(-38=BGKNQSSSRPNKGD@<9642112469<@DGKNPRSSSQNKGB=83-(#  #(.4:@FLQUXZ\\\ZWTQLHD@<96433469<@DHLQTWZ\\\ZXUQLF@:4.(#  #)/5EMT[agknpqqolhc^XSMHC?<:99:6/)#  "(/6>FOW_fmsx{}}|zvqlf_YSMHD@>==>@DHMSY_flqvz|}}{xsmf_WOF>6/("  "(.6>GPYbksz|ung`YSNIECBBCEINSY`gnu|zskbYPG>6.("  !'-5=FPYcmwxphaZTOKIGGIKOTZahpxwmcYPF=5-'!   &,4GQ\gs»ysomkkmosysg\QG>70*%   !%*06=ENXco{ƾ|yxxy|ù{ocXNE=60*%!  "&+05CINU[cks}}skc[UNIC>93.*%   $).49>DIOTZagowǽwogaZTOID>94.)$  #(-39>DJOUZ`elryyrle`ZUOJD>93-(#   &+17=CIOUZ_djou{{uojd_ZUOIC=71+&   #)/5;BHNTZ_dhmqv{½{vqmhd_ZTNHB;5/)#   %+28?FLRX^cgkosw{¿{wsokgc^XRLF?82+%   !'-4;BIPV\afjnqtwy||ywtqnjfa\VPIB;4-'!  "(/6=DKRX^chloqtuwy{}û}{ywutqolhc^XRKD=6/("  #)07>FMTZ`eiloqrstuvwxz|ù|zxwvutsrqolie`ZTMF>70)#  $*18?FNT[`eilnppqpppppqrtvy|ƺ|yvtrqpppppqppnlie`[TNF?81*$  $*18?GNT[`ehkmmnmlkjihhhijlorw|˾|wroljihhhijklmnmmkhe`[TNG?81*$  #*07?FMSZ_cfijkjihfdb`____acfjov}õ}vojfca____`bdfhijkjifc_ZSMF?70*#  #)07>ELRX]adfggfec`^[YWVUUVX[_djr{ɺ{rjd_[XVUUVWY[^`cefggfda]XRLE>70)#  "(/5==>@CHNV`jwͿwj`VNHC@>==>@CFJMQUXZ\]][YUQLF@93,&    %+18>DJOSVYZZYWTQMIEA>;9778:=BHPYdp}Ƹ}pdYPHB=:8779;>AEIMQTWYZZYVSOJD>81+%   $*06=BHMQTVWWVTRNJFB>:7533358=CKT_kxxk_TKC=8533357:>BFJNRTVWWVTQMHB=60*$  $)/5;AGKOSUVVTRPLHD@;85200025:@HQ[guɽug[QH@:52000258;@DHLPRTVVUSOKGA;5/)$  #)/5;AFKORTUUTQOKGC>:631/./148>FOZfsǻsfZOF>841/./136:>CGKOQTUUTROKFA;5/)#  #)/5;AFKORTUUTQOKGC>:631/./148>FOZfsǻsfZOF>841/./136:>CGKOQTUUTROKFA;5/)#  $)/5;AGKOSUVVTRPLHD@;85200025:@HQ[guɽug[QH@:52000258;@DHLPRTVVUSOKGA;5/)$  $*06=BHMQTVWWVTRNJFB>:7533358=CKT_kxxk_TKC=8533357:>BFJNRTVWWVTQMHB=60*$   %+18>DJOSVYZZYWTQMIEA>;9778:=BHPYdp}Ƹ}pdYPHB=:8779;>AEIMQTWYZZYVSOJD>81+%    &,39@FLQUY[]]\ZXUQMJFC@>==>@CHNV`jwͿwj`VNHC@>==>@CFJMQUXZ\]][YUQLF@93,&   !'-4;AHNSX\^```^\YVROKIFEDDEGKPV^hr~Ǹ~rh^VPKGEDDEFIKORVY\^```^\XSNHA;4-'!  "(/5ELRX]adfggfec`^[YWVUUVX[_djr{ɺ{rjd_[XVUUVWY[^`cefggfda]XRLE>70)#  #*07?FMSZ_cfijkjihfdb`____acfjov}õ}vojfca____`bdfhijkjifc_ZSMF?70*#  $*18?GNT[`ehkmmnmlkjihhhijlorw|˾|wroljihhhijklmnmmkhe`[TNG?81*$  $*18?FNT[`eilnppqpppppqrtvy|ƺ|yvtrqpppppqppnlie`[TNF?81*$  #)07>FMTZ`eiloqrstuvwxz|ù|zxwvutsrqolie`ZTMF>70)#  "(/6=DKRX^chloqtuwy{}û}{ywutqolhc^XRKD=6/("  !'-4;BIPV\afjnqtwy||ywtqnjfa\VPIB;4-'!   %+28?FLRX^cgkosw{¿{wsokgc^XRLF?82+%   #)/5;BHNTZ_dhmqv{½{vqmhd_ZTNHB;5/)#   &+17=CIOUZ_djou{{uojd_ZUOIC=71+&   #(-39>DJOUZ`elryyrle`ZUOJD>93-(#  $).49>DIOTZagowǽwogaZTOID>94.)$   %*.39>CINU[cks}}skc[UNIC>93.*%   !%).38=BHOV]fozzof]VOHB=83.)%!   $)-27GQ\gs»ysomkkmosysg\QG>70*%    %*18AJT_kw|unidb``bdinu|wk_TJA81*%    %+2:CLWbmy{rkd_[XWWX[_dkr{ymbWLC:2+%    &,4GPYbksz|ung`YSNIECBBCEINSY`gnu|zskbYPG>6.("  "(/6>FOW_fmsx{}}|zvqlf_YSMHD@>==>@DHMSY_flqvz|}}{xsmf_WOF>6/("  #)/6>EMT[agknpqqolhc^XSMHC?<:99:6/)#  #)/5ACEEEDCA?<96410....01469;73/*&!   %)-148;=>?@?>=;8641/.,,,,./1468;=>?@?>=;841-)%    $'+/2579::::97531/-,+**+,-/13579::::9752/+'$   #&)-/2356655320.,+)(((()+,.0235566532/-)&#  "%(*-/011110.-+*('&&&&'(*+-.011110/-*(%"  !$&(*,----,+)('%$$##$$%'()+,----,*(&$!   "$&'()))('&%$#"!!!!"#$%&'()))('&$"    "#$%%%$$#"!  !"#$$%%%$#"    !!!!  !!!!                                     !!!!  !!!!   !"$$%$$#"!  !"#$$%$$"!  !#%&'(((''%$#!  !#$%''((('&%#!   #%')+,,,,+*('%$"!! !!"$%'(*+,,,,+)'%#   "%'*,./0000.-+*(&%#""""#%&(*+-.0000/.,*'%"   #'*-/234555420.,*('%$$$$%'(*,.024555432/-*'#   !%),03689:;::8642/-+)'&%%&')+-/2468::;:98630,)%!  "'+/37:=?@AA@?=;8520-+)(''()+-0258;=?@AA@?=:73/+'"  #(-26;?BEGHHHGEC@=9630-+*))*+-0369=@CEGHHHGEB?;62-(#  $)/49?CGKNPQQPNLIEB>:630.,,,,.036:>BEILNPQQPNKGC?94/)$   %*06:631/../136:>CGLPSVYZZYXUQMHB<60*%   %+18>ELRW\`cdedb_\WSNHC?;74322347;?CHNSW\_bdedc`\WRLE>81+%  %+18@GOV]chlnppomie`ZUOID@<976679<@DIOUZ`eimoppnlhc]VOG@81+%  $*18@HQYahotx{||{xtoic]VPJEA><;;<>AEJPV]ciotx{||{xtohaYQH@81*$  #)07@HQ[dlt{ysle^XRLHDBAABDHLRX^elsy{tld[QH@70)#  "(/6>GQ[dnw}vng`ZTOLIHHILOTZ`gnv}wnd[QG>6/("  !'-4DIPW^gpz¹zpg^WPID>950,'#  #',05:?DINT[bir{ž{rib[TNID?:50,'#  !&+05:?CHMSX^dks{ſ{skd^XSMHC?:50+&!   $)/49>CHMRV[`flry½yrlf`[VRMHC>94/)$   "',27=BGLQUY^bglqw~~wqlgb^YUQLGB=72,'"  $*/5;@FKOTX\`cgkptyĿytpkgc`\XTOKF@;5/*$  !&,17=CHMRVZ^adgjmqty}ü}ytqmjgda^ZVRMHC=71,&!  "'-39?EJOTX[^acegjloruy}ż}yuroljgeca^[XTOJE?93-'"  #(.4:AFLQUY\^`bcdfgikmpsvz~ɾ~zvspmkigfdcb`^\YUQLFA:4.(#  #)/5;AGLQUY[^_`aaabbcdfhknrv{ö{vrnkhfdcbbaaa`_^[YUQLGA;5/)#  #)/5;AGLQUXZ\]]]]\\\\\]^`cfjou{ɻ{uojfc`^]\\\\\]]]]\ZXUQLGA;5/)#  #).5;AFKPSVXZZZZYXVUTTTUVX[_cipx³xpic_[XVUTTTUVXYZZZZXVSPKFA;5.)#  "(.4:?EJNRTVWWWVTSQONMLLMNQTY^enwɹwne^YTQNMLLMNOQSTVWWWVTRNJE?:4.("  "'-38>CHLORSTTSRPNKIGFEDDFHKOU\dnyynd\UOKHFDDEFGIKNPRSTTSROLHC>83-'"  !&,17==>@CGLS[ep}ȹ}pe[SLGC@>==>?ADGILNPQQQOMJFA<71,&!   %*05;@DHKMNNNLJHEB?<:87779<@ELT^ivvi^TLE@<97778:BFHJKLKIGEB>;86422236:?FNXco}Ⱥ}ocXNF?:63222468;>BEGIKLKJHFB>94/)$  #(.38<@DGHIIIGEB?<8520/../25;AIS^jx´xj^SIA;52/../0258FP[gu˾ug[PF>82/-++,.036:=@CEGHHGEC?;72-(#  "',16;?BEFGGFEB?<952/-+**+-16FP[gu˾ug[PF>82/-++,.036:=@CEGHHGEC?;72-(#  #(.38<@DGHIIIGEB?<8520/../25;AIS^jx´xj^SIA;52/../0258BFHJKLKIGEB>;86422236:?FNXco}Ⱥ}ocXNF?:63222468;>BEGIKLKJHFB>94/)$   %*05;@DHKMNNNLJHEB?<:87779<@ELT^ivvi^TLE@<97778:==>@CGLS[ep}ȹ}pe[SLGC@>==>?ADGILNPQQQOMJFA<71,&!  "'-38>CHLORSTTSRPNKIGFEDDFHKOU\dnyynd\UOKHFDDEFGIKNPRSTTSROLHC>83-'"  "(.4:?EJNRTVWWWVTSQONMLLMNQTY^enwɹwne^YTQNMLLMNOQSTVWWWVTRNJE?:4.("  #).5;AFKPSVXZZZZYXVUTTTUVX[_cipx³xpic_[XVUTTTUVXYZZZZXVSPKFA;5.)#  #)/5;AGLQUXZ\]]]]\\\\\]^`cfjou{ɻ{uojfc`^]\\\\\]]]]\ZXUQLGA;5/)#  #)/5;AGLQUY[^_`aaabbcdfhknrv{ö{vrnkhfdcbbaaa`_^[YUQLGA;5/)#  #(.4:AFLQUY\^`bcdfgikmpsvz~ɾ~zvspmkigfdcb`^\YUQLFA:4.(#  "'-39?EJOTX[^acegjloruy}ż}yuroljgeca^[XTOJE?93-'"  !&,17=CHMRVZ^adgjmqty}ü}ytqmjgda^ZVRMHC=71,&!  $*/5;@FKOTX\`cgkptyĿytpkgc`\XTOKF@;5/*$  "',27=BGLQUY^bglqw~~wqlgb^YUQLGB=72,'"   $)/49>CHMRV[`flry½yrlf`[VRMHC>94/)$   !&+05:?CHMSX^dks{ſ{skd^XSMHC?:50+&!  #',05:?DINT[bir{ž{rib[TNID?:50,'#  #',059>DIPW^gpz¹zpg^WPID>950,'#  #'+049?DKRZcmwúwmcZRKD?940+'#  "&*/49?FMV_itýùti_VMF?94/*&"  "&*/4:AHQZep|ǿ|peZQHA:4/*&"  !%*/5;CKU_jvºvj_UKC;5/*%!   %*06=FOYdp|~yvtsstvy~ÿ|pdYOF=60*%    %*18@IS^iu~xrmjgffgjmrx~ui^SI@81*%   !&,2:CLValx{smgb^\[[\^bgms{xlaVLC:2,&!  !'-4GQ[dnw}vng`ZTOLIHHILOTZ`gnv}wnd[QG>6/("  #)07@HQ[dlt{ysle^XRLHDBAABDHLRX^elsy{tld[QH@70)#  $*18@HQYahotx{||{xtoic]VPJEA><;;<>AEJPV]ciotx{||{xtohaYQH@81*$  %+18@GOV]chlnppomie`ZUOID@<976679<@DIOUZ`eimoppnlhc]VOG@81+%  %+18>ELRW\`cdedb_\WSNHC?;74322347;?CHNSW\_bdedc`\WRLE>81+%   %*06:631/../136:>CGLPSVYZZYXUQMHB<60*%   $)/49?CGKNPQQPNLIEB>:630.,,,,.036:>BEILNPQQPNKGC?94/)$  #(-26;?BEGHHHGEC@=9630-+*))*+-0369=@CEGHHHGEB?;62-(#  "'+/37:=?@AA@?=;8520-+)(''()+-0258;=?@AA@?=:73/+'"  !%),03689:;::8642/-+)'&%%&')+-/2468::;:98630,)%!   #'*-/234555420.,*('%$$$$%'(*,.024555432/-*'#   "%'*,./0000.-+*(&%#""""#%&(*+-.0000/.,*'%"   #%')+,,,,+*('%$"!! !!"$%'(*+,,,,+)'%#   !#%&'(((''%$#!  !#$%''((('&%#!  !"$$%$$#"!  !"#$$%$$"!   !!!!  !!!!                                            "#$$$##"  "##$$$#"   !#%&'((''&%#"  "#%&''(('&%#!  !$&(*+,,,,+)(&$"!!"$&()+,,,,+*(&$!   #&)+./11110/-+)'%#!  !#%')+-/01111/.+)&#   "%),/2467776531/,*'%#"! !"#%'*,/1356777642/,)%"  #(,0369;=>>><;9630-*(&$#""#$&(*-0369;<>>>=;9630,(#   %).37;?BDEFFECA>;841.+)'%%%%')+.148;>ACEFFEDB?;73.)%   !&+06;@DHKMNOOMKHEA=952/,*(''(*,/259=AEHKMOONMKHD@;60+&!  !&,28>CINRUWYYXVTPLHD?;630-,++,-036;?DHLPTVXYYWURNIC>82,&!  !&,39@FMSX\`bccb`]YTPJE@<8520//0258<@EJPTY]`bccb`\XSMF@93,&!   &,3:AHPW]chknoomkgb]XRLGB>:754457:>BGLRX]bgkmoonkhc]WPHA:3,&   %+29AIQYahntwz{{yvrlgaZTOIEA><;;<>AEIOTZaglrvy{{zwtnhaYQIA92+%  #*08@IQZclsz|wqjd]WQLHECBBCEHLQW]djqw|zslcZQI@80*#  "(/6>GPZcmv~{tmg`ZUQNLKKLNQUZ`gmt{~vmcZPG>6/("  !&-4FPZep{{vspnmmnpsv{{peZPF>6/)$    $(.4;CKU_ju~|{{|~uj_UKC;4.($    $(-28?GPYdozzodYPG?82-($    $(,17=DKT]gr}}rg]TKD=71,($   !$(,16;AHOW`jt¾tj`WOHA;61,($!  !$(,05:?EKRZclvvlcZRKE?:50,($!   $(,059>CHNU\dlvvld\UNHC>950,($    $(,049=BFKQW]dlt}}tld]WQKFB=940,($   "'+/48BFJNQUY]afkpv|ſ|vpkfa]YUQNJFB>:51,'"  $).38<@DHLORUX[^bfjotyºytojfb^[XUROLHD@<83.)$   %*/49>BFIMORTVY[^adhlpty~Ƚ~ytplhda^[YVTROMIFB>94/*%   !&+05:?CGJMOQSTVWY[]`cfjnsx}÷}xsnjfc`][YWVTSQOMJGC?:50+&!  "',16;?CGJLNPQRRSTUWXZ]`dhlrx~˽~xrlhd`]ZXWUTSRRQPNLJGC?;61,'"  "',16;?CFIKMNOOOOOOPQRTVY]agmt|Ŷ|tmga]YVTRQPOOOOOONMKIFC?;61,'"  !&+05:>BEHJKLLLKJJIIIJKMPSW\bir|;|rib\WSPMKJIIIJJKLLLKJHEB>:50+&!  !&+049=ADFHIIIHGFEDCCCCEGJMRX`hr~ƶ~rh`XRMJGECCCCDEFGHIIIHFDA=940+&!   %*/38<:876668:=BHOXbmzƷzmbXOHB=:866678:<>@ABCCCB@=:62-)$  #(,058;>@AAA@><:8642101247;AHQ[fsͿsf[QHA;7421012468:<>@AAA@>;850,(#  "'+/37:<>??>=;97520.-,,-/26??><:73/+'"  !&*.258:<==<;97520-+*)))+.28>GQ\ivvi\QG>82.+)))*+-02579;<==<:852.*&!  !%)-1479;<<;:8630.+)('&')+/5GQ\ivvi\QG>82.+)))*+-02579;<==<:852.*&!  "'+/37:<>??>=;97520.-,,-/26??><:73/+'"  #(,058;>@AAA@><:8642101247;AHQ[fsͿsf[QHA;7421012468:<>@AAA@>;850,(#  $)-26:=@BCCCBA@><:876668:=BHOXbmzƷzmbXOHB=:866678:<>@ABCCCB@=:62-)$   %*/38BEHJKLLLKJJIIIJKMPSW\bir|;|rib\WSPMKJIIIJJKLLLKJHEB>:50+&!  "',16;?CFIKMNOOOOOOPQRTVY]agmt|Ŷ|tmga]YVTRQPOOOOOONMKIFC?;61,'"  "',16;?CGJLNPQRRSTUWXZ]`dhlrx~˽~xrlhd`]ZXWUTSRRQPNLJGC?;61,'"  !&+05:?CGJMOQSTVWY[]`cfjnsx}÷}xsnjfc`][YWVTSQOMJGC?:50+&!   %*/49>BFIMORTVY[^adhlpty~Ƚ~ytplhda^[YVTROMIFB>94/*%   $).38<@DHLORUX[^bfjotyºytojfb^[XUROLHD@<83.)$  "',15:>BFJNQUY]afkpv|ſ|vpkfa]YUQNJFB>:51,'"   %).37;@DHLPTY^ciou|¾|uoic^YTPLHD@;73.)%   "'+/48CHNU\dlvvld\UNHC>950,($   !$(,05:?EKRZclvvlcZRKE?:50,($!  !$(,16;AHOW`jt¾tj`WOHA;61,($!   $(,17=DKT]gr}}rg]TKD=71,($    $(-28?GPYdozzodYPG?82-($    $(.4;CKU_ju~|{{|~uj_UKC;4.($    $)/6>FPZep{{vspnmmnpsv{{peZPF>6/)$    %+19AJT^it~{uojfca``acfjou{~ti^TJA91+%   !&-4GPZcmv~{tmg`ZUQNLKKLNQUZ`gmt{~vmcZPG>6/("  #*08@IQZclsz|wqjd]WQLHECBBCEHLQW]djqw|zslcZQI@80*#  %+29AIQYahntwz{{yvrlgaZTOIEA><;;<>AEIOTZaglrvy{{zwtnhaYQIA92+%   &,3:AHPW]chknoomkgb]XRLGB>:754457:>BGLRX]bgkmoonkhc]WPHA:3,&   !&,39@FMSX\`bccb`]YTPJE@<8520//0258<@EJPTY]`bccb`\XSMF@93,&!  !&,28>CINRUWYYXVTPLHD?;630-,++,-036;?DHLPTVXYYWURNIC>82,&!  !&+06;@DHKMNOOMKHEA=952/,*(''(*,/259=AEHKMOONMKHD@;60+&!   %).37;?BDEFFECA>;841.+)'%%%%')+.148;>ACEFFEDB?;73.)%   #(,0369;=>>><;9630-*(&$#""#$&(*-0369;<>>>=;9630,(#  "%),/2467776531/,*'%#"! !"#%'*,/1356777642/,)%"   #&)+./11110/-+)'%#!  !#%')+-/01111/.+)&#   !$&(*+,,,,+)(&$"!!"$&()+,,,,+*(&$!  !#%&'((''&%#"  "#%&''(('&%#!   "#$$$##"  "##$$$#"                                                   !#$$$$$#"  "#$$$$$#!   !#%'())))('%#"  "#%'())))('%#!   #&)+,../..,+)'%"  "%')+,../..,+)&#   "&),/134554320-+(&#!!#&(+-023455431/,)&"   $(,0369;<<<;:852/,)'$"  "$'),/258:;<<<;9630,($   !&*/48;?ACDDDCA>;841.*(%#"!!"#%(*.148;>ACDDDCA?;84/*&!  "',16;@DHJLMMMKIFB>:62/,)'&%%&'),/26:>BFIKMMMLJHD@;61,'"  "'-38>DINQTVWWVTQNJEA<841.,*))*,.14883-'"  !'-3:@GMSX\_abb`^[WRMHC?:631/../136:?CHMRW[^`bba_\XSMG@:3-'!   &,3:AHOV\bfjlmlkhd`[VPKFA=:765567:=AFKPV[`dhklmljfb\VOHA:3,&   %+19@HPX`flquwxwvsojd_YSNIEA?=<<=?AEINSY_djosvwxwuqlf`XPH@91+%  #)07?GPXaipv|}ytnhb\WRNJGFEEFGJNRW\bhnty}|vpiaXPG?70)#  "'-5FOYcmw{vrnkiggggiknrv{wmcYOF>6/)$  #'-3:BKT^hr|~{xwuuuuwx{~|rh^TKB:3-'#  "&+17>FOXblvvlbXOF>71+&"  !%*/4:AIR[eoyyoe[RIA:4/*%!  !%)-28>DLT]gpzzpg]TLD>82-)%!  !%(,15;@GNV^gqzzqg^VNG@;51,(%!  !%(,048=CIPW_gpyypg_WPIC=840,(%!  !$(+/37;@EJPW^fnv~¿~vnf^WPJE@;73/+($!   #'+.26:>BFKQV]dkrzĿzrkd]VQKFB>:62.+'#   "&)-158?@ABBBCDEFHJMPTX^dkt};}tkd^XTPMJHFEDCBBBA@?><:740,($   #(,/369;=>>????>>??ABDGKOT[bkuǸukb[TOKGDBA??>>????>>=;963/,(#  #'+.2579;<<<<;;:999:;=?BFLRYblxxlbYRLFB?=;:999:;;<<<<;9752.+'#  "&*-13689::998765444568;?DJQZdp}ɹ}pdZQJD?;865444567899::98631-*&"  !%),/2467777653210///0248=CJS]iv²vi]SJC=8420///0123567777642/,)%!   $'+.0245554320/-,+**+,/27=DMWbo}ɻ}obWMD=72/,+**+,-/0234555420.+'$   #&*-/1233321/.,*)''&'(*.28?HR]jxôxj]RH?82.*('&'')*,./1233321/-*&#  "%)+.012210/-,*(&%$#$%'*/4;DMYesʽseYMD;4/*'%$#$%&(*,-/012210.+)%"  "%(+-/0110/.,*(&$#"!"#%(,29AKVbpƹpbVKA92,(%#"!"#$&(*,./0110/-+(%"  !%(*-.0000/-+*'%$"! !"$'+07@ITan}ĸ}naTI@70+'$"! !"$%'*+-/0000.-*(%!  !%(*-.0000/-+*'%$"! !"$'+07@ITan}ĸ}naTI@70+'$"! !"$%'*+-/0000.-*(%!  "%(+-/0110/.,*(&$#"!"#%(,29AKVbpƹpbVKA92,(%#"!"#$&(*,./0110/-+(%"  "%)+.012210/-,*(&%$#$%'*/4;DMYesʽseYMD;4/*'%$#$%&(*,-/012210.+)%"  #&*-/1233321/.,*)''&'(*.28?HR]jxôxj]RH?82.*('&'')*,./1233321/-*&#   $'+.0245554320/-,+**+,/27=DMWbo}ɻ}obWMD=72/,+**+,-/0234555420.+'$   !%),/2467777653210///0248=CJS]iv²vi]SJC=8420///0123567777642/,)%!  "&*-13689::998765444568;?DJQZdp}ɹ}pdZQJD?;865444567899::98631-*&"  #'+.2579;<<<<;;:999:;=?BFLRYblxxlbYRLFB?=;:999:;;<<<<;9752.+'#  #(,/369;=>>????>>??ABDGKOT[bkuǸukb[TOKGDBA??>>????>>=;963/,(#   $(,047:<>?@ABBBCDEFHJMPTX^dkt};}tkd^XTPMJHFEDCBBBA@?><:740,($   $(,047:=?ABCDEFHIKMORUY]bhnu}õ}unhb]YUROMKIHFEDCBA?=:740,($  #',037:=?BCEGHJLNQTWZ^cglrxǺxrlgc^ZWTQNLJHGECB?=:730,'#  "'+/36:=?BDFIKNPSW[_chlqw|ʾ|wqlhc_[WSPNKIFDB?=:63/+'"  !%)-158BFKQV]dkrzĿzrkd]VQKFB>:62.+'#   !$(+/37;@EJPW^fnv~¿~vnf^WPJE@;73/+($!  !%(,048=CIPW_gpyypg_WPIC=840,(%!  !%(,15;@GNV^gqzzqg^VNG@;51,(%!  !%)-28>DLT]gpzzpg]TLD>82-)%!  !%*/4:AIR[eoyyoe[RIA:4/*%!  "&+17>FOXblvvlbXOF>71+&"  #'-3:BKT^hr|~{xwuuuuwx{~|rh^TKB:3-'#  $)/6>FOYcmw{vrnkiggggiknrv{wmcYOF>6/)$   %+29AJT]gpy|vpkfb_][ZZ[]_bfkpv|ypg]TJA92+%   "'-5DINQTVWWVTQNJEA<841.,*))*,.14883-'"  "',16;@DHJLMMMKIFB>:62/,)'&%%&'),/26:>BFIKMMMLJHD@;61,'"  !&*/48;?ACDDDCA>;841.*(%#"!!"#%(*.148;>ACDDDCA?;84/*&!   $(,0369;<<<;:852/,)'$"  "$'),/258:;<<<;9630,($   "&),/134554320-+(&#!!#&(+-023455431/,)&"   #&)+,../..,+)'%"  "%')+,../..,+)&#   !#%'())))('%#"  "#%'())))('%#!   !#$$$$$#"  "#$$$$$#!                                                 !"""!!  !!"""!    "$%&'''&%#"  "#%&'''&%$"   !#&(*+,--,+*(&$!!$&(*+,--,+*(&#!  #&),/1233321/-*(%#  #%(*-/1233321/,)&#  !%)-0368:;;:9752/,)'$!!$'),/2579:;;:8630-)%!  "&+/48;>ABCCBA><952.+(%#! !#%(+.259<>ABCCBA>;84/+&"  "',16;@DGIKLLKIFC@<841-*(&%$$%&(*-148<@CFIKLLKIGD@;61,'"  "'-28>CHMPSUUUTROKGC?;730-+*))*+-037;?CGKORTUUUSPMHC>82-'"  !&,29?EKQVZ]^__][XTPKFB>:6310//0136:>BFKPTX[]__^]ZVQKE?92,&!   %+28?FMTZ_cfhiigea]XSOJEA>;876678;>AEJOSX]aegiihfc_ZTMF?82+%   $)07>FMU\bhmprssqnkfa\WRNJFCA????ACFJNRW\afknqssrpmhb\UMF>70)$  "'.5DKRYaiqyyqiaYRKD>84/+'$!   #'*-15:?DJQX_gnv}ÿ}vng_XQJD?:51-*'#    #&),/37;?DJPV\cjqx~ý~xqjc\VPJD?;73/,)&#   "%(+.148;?DHMSY_ekrx}û}xrke_YSMHD?;841.+(%"   #&*-0258;?BFKOTZ_ekpv{Ǿ{vpke_ZTOKFB?;8520-*&#   !%(+.1368;>ADHKPTY^chmsx~ʿ~xsmhc^YTPKHDA>;8631.+(%!  "&),/1468:@BEHKOSW\afms{ʽ{smfa\WSOKHEB@><;97641/,*&#    #'*-/135678:;<>@BDGKOSX]dks|Ⱥ|skd]XSOKGDB@><;:876531/-*'#    #'*,/1245567789:<>@CFJOU[bkuĵukb[UOJFC@><:9877655421/,*'#    #&),.01233444445689DKT^jwwj^TKD>951/.,,,,--..///.-+)'$"  !#&(*+,--,,+*))((()*,/38>ENXcp~ɻ~pcXNE>83/,*)((())*+,,--,+*(&#!   "%')*+++**)(&%%$$$%'*.28?HR]jx´xj]RH?82.*'%$$$%%&()**+++*)'%"   !$&')))))('%$#"!!!"#&).4;CMYesɼseYMC;4.)&#"!!!"#$%'()))))'&$!  !#%&'((('&%$"! !#&+07@JUao}÷}oaUJ@70+&#! !"$%&'((('&%#!   "$&''''&%$"! !$).5=GR^lzzl^RG=5.)$! !"$%&''''&$"    "$%&''&&%#"  #(-4ENXcp~ɻ~pcXNE>83/,*)((())*+,,--,+*(&#!  "$')+-.///..--,,,,./159>DKT^jwwj^TKD>951/.,,,,--..///.-+)'$"  "%(+-.001111000012358;?EKS[eq~ȹ~qe[SKE?;853210000111100.-+(%"   #&),.01233444445689@CFJOU[bkuĵukb[UOJFC@><:9877655421/,*'#    #'*-/135678:;<>@BDGKOSX]dks|Ⱥ|skd]XSOKGDB@><;:876531/-*'#    #&*,/14679;<>@BEHKOSW\afms{ʽ{smfa\WSOKHEB@><;97641/,*&#   "&),/1468:ADHKPTY^chmsx~ʿ~xsmhc^YTPKHDA>;8631.+(%!   #&*-0258;?BFKOTZ_ekpv{Ǿ{vpke_ZTOKFB?;8520-*&#   "%(+.148;?DHMSY_ekrx}û}xrke_YSMHD?;841.+(%"   #&),/37;?DJPV\cjqx~ý~xqjc\VPJD?;73/,)&#    #'*-15:?DJQX_gnv}ÿ}vng_XQJD?:51-*'#   !$'+/48>DKRYaiqyyqiaYRKD>84/+'$!  !%)-17FMU\bhmprssqnkfa\WRNJFCA????ACFJNRW\afknqssrpmhb\UMF>70)$   %+28?FMTZ_cfhiigea]XSOJEA>;876678;>AEJOSX]aegiihfc_ZTMF?82+%   !&,29?EKQVZ]^__][XTPKFB>:6310//0136:>BFKPTX[]__^]ZVQKE?92,&!  "'-28>CHMPSUUUTROKGC?;730-+*))*+-037;?CGKORTUUUSPMHC>82-'"  "',16;@DGIKLLKIFC@<841-*(&%$$%&(*-148<@CFIKLLKIGD@;61,'"  "&+/48;>ABCCBA><952.+(%#! !#%(+.259<>ABCCBA>;84/+&"  !%)-0368:;;:9752/,)'$!!$'),/2579:;;:8630-)%!  #&),/1233321/-*(%#  #%(*-/1233321/,)&#  !#&(*+,--,+*(&$!!$&(*+,--,+*(&#!   "$%&'''&%#"  "#%&'''&%$"    !"""!!  !!"""!                                                  "#%%&%%$"!!"$%%&%%#"   !#&()++++*)'%#!!#%')*++++)(&#!   #&),.012210/-*(%#  #%(*-/012210.,)&#   !%),035799987530-*'%"  "%'*-035789997530,)%!  "&*/37:=?@AA@><:730-*'$"!  !"$'*-037:<>@AA@?=:73/*&"  "&+05:>BEGIIIHFDA=:63/,*'&$$$$&'*,/36:=ADFHIIIGEB>:50+&"  !&,17EMT\dlsyysld\TME>71,'#  !%).39?FMT\dkrx~~xrkd\TMF?93.)%!   #'+/49?FLT[bipv||vpib[TLF?94/+'#   "%(,05:?EKRX_fmsx}}xsmf_XRKE?:50,(%"  !$'*-159>CIOU\bhnsy~¼~ysnhb\UOIC>951-*'$!   #%(+.159=AGLQW]chnsx}Ž}xsnhc]WQLGA=951.+(%#   !$&)+.147;?CHMRW\bglqw|ú|wqlgb\WRMHC?;741.+)&$!   "%'),.0369<@DHLQV[`ejpv}Ƚ}vpje`[VQLHD@<9630.,)'%"   !#%(*,.02469BFLRYbkvǹvkbYRLFB>:75310..-,+*)('%#!  !#$&'())**++,-./147;?DKR[do|ô|od[RKD?;741/.-,++**))('&$#!   "$%&'''(((((()*,.149>DKT^iu̾ui^TKD>941.,*)(((((('''&%$"   !"$%%&&%%%%$%%&')+.38>ENXco}Ƹ}ocXNE>83.+)'&%%$%%%%&&%%$"!   !"#$$$##""!!!"#$&)-28?HR]iw̿wi]RH?82-)&$#"!!!""##$$$#"!    !""""!!  "%).3;CMXdqŹqdXMC;3.)%"  !!""""!    !!!! "%*07?HS_lzʿzl_SH?70*%" !!!!    #'-3ENXco}Ƹ}ocXNE>83.+)'&%%$%%%%&&%%$"!   "$%&'''(((((()*,.149>DKT^iu̾ui^TKD>941.,*)(((((('''&%$"   !#$&'())**++,-./147;?DKR[do|ô|od[RKD?;741/.-,++**))('&$#!  !#%'()*+,-..01357:>BFLRYbkvǹvkbYRLFB>:75310..-,+*)('%#!  !#&')*,-./12468;=AEINSZair|ʼ|riaZSNIEA=;86421/.-,*)'&#!  !#&(*+-.02468:=@DHLPU[ahpx˾xpha[UPLHD@=:86420.-+*(&#!  !#%(*,.02469CIOU\bhnsy~¼~ysnhb\UOIC>951-*'$!  "%(,05:?EKRX_fmsx}}xsmf_XRKE?:50,(%"   #'+/49?FLT[bipv||vpib[TLF?94/+'#   !%).39?FMT\dkrx~~xrkd\TMF?93.)%!  #',17>EMT\dlsyysld\TME>71,'#  !%*06BEGIIIHFDA=:63/,*'&$$$$&'*,/36:=ADFHIIIGEB>:50+&"  "&*/37:=?@AA@><:730-*'$"!  !"$'*-037:<>@AA@?=:73/*&"  !%),035799987530-*'%"  "%'*-035789997530,)%!   #&),.012210/-*(%#  #%(*-/012210.,)&#   !#&()++++*)'%#!!#%')*++++)(&#!   "#%%&%%$"!!"$%%&%%#"                                                   !#$$$$#"!!"#$$$$#!    #%'()**)('%#!!#%'()**)('%#   #&)+-/0000.-+)&$!!$&)+-.0000/-+)&#   $(+/1467776531.+)&#!!#&)+.1356777641/+($   !%)-158;=>>>=<:741.+)&$"!  !"$&)+.147:<=>>>=;851-)%!  !%*/38;851.,)(&%%%%&(),.158;>ACEFFFDB?<83/*%!   $)/49>BFILMNNLKHEB?;8520.-,++,-.0258;?BEHKLNNMLIFB>94/)$   #(.39?DIMPSUUUTRPMJFC@<:7543333457:<@CFJMPRTUUUSPMID?93.(#  !&,28>DJOSWZ\]]\ZWUQNKGEB@>=<;;<=>@BEGKNQUWZ\]]\ZWSOJD>82,&!  $*/6ELSZ`fjnqstttsqpnmlkjjjjjjjjjjjjklmnpqstttsqnjf`ZSLE>81+&!  #(-39@GNU\bhlptvwxxxwwvvvvvvwwxxxxwwvvvvvvwwxxxwvtplhb\UNG@93-(#   %).4:AHOU\bhmquxz{||}}~~~~}}||{zxuqmhb\UOHA:4.)%   "&*/5;AHNU\bgmquxz|~~|zxuqmgb\UNHA;5/*&"   #'+05;AGMTZ`fkoswz}}zwsokf`ZTMGA;50+'#   !$(+05:?EKQW]chlquy||yuqlhc]WQKE?:50+($!  "%(,/48>CHNTY^dhmqvzzvqmhd^YTNHC>84/,(%"   "%(+/27;@EJOTZ_dhmrw}ý}wrmhd_ZTOJE@;72/+(%"   !#%(+.148=AFJOTY^chnszƾzsnhc^YTOJFA=841.+(%#!  !#%'*,/259=AEJNSX]bhov~ù~vohb]XSNJEA=952/,*'%#!  !#%&(*-/258<@DHLQW\cjrzǼzrjc\WQLHD@<852/-*(&%#!  !"$%'(*,.147:=AFKPV]dmvɽvmd]VPKFA=:741.,*('%$"!  !"#$%&()+-/148;?DIOV^gq|ɼ|qg^VOID?;841/-+)(&%$#"!   !"##$%&')*,/259>CIPXalwǺwlaXPIC>952/,*)'&%$##"!    !"""#$%&(*,/37=CJR\frörf\RJC=73/,*(&%$#"""!    !!"$%'*.27=DLValy˿ylaVLD=72.*'%$"!!    !#%)-28?GP[gtŹtg[PG?82-)%#!   !$(-3:BKVbo|ɿ|obVKB:3-($!  !$)/5=GQ]jwùwj]QG=5/)$!  !&+2:CMYesžseYMC:2+&!  #)/7@JVbo||obVJ@7/)#  !'-5>HS_lz½zl_SH>5-'!  !&,4=GR^kxxk^RG=4,&!  !&,4=GR^kxxk^RG=4,&!  !'-5>HS_lz½zl_SH>5-'!  #)/7@JVbo||obVJ@7/)#  !&+2:CMYesžseYMC:2+&!  !$)/5=GQ]jwùwj]QG=5/)$!  !$(-3:BKVbo|ɿ|obVKB:3-($!   !#%)-28?GP[gtŹtg[PG?82-)%#!    !!"$%'*.27=DLValy˿ylaVLD=72.*'%$"!!    !"""#$%&(*,/37=CJR\frörf\RJC=73/,*(&%$#"""!    !"##$%&')*,/259>CIPXalwǺwlaXPIC>952/,*)'&%$##"!   !"#$%&()+-/148;?DIOV^gq|ɼ|qg^VOID?;841/-+)(&%$#"!  !"$%'(*,.147:=AFKPV]dmvɽvmd]VPKFA=:741.,*('%$"!  !#%&(*-/258<@DHLQW\cjrzǼzrjc\WQLHD@<852/-*(&%#!  !#%'*,/259=AEJNSX]bhov~ù~vohb]XSNJEA=952/,*'%#!  !#%(+.148=AFJOTY^chnszƾzsnhc^YTOJFA=841.+(%#!   "%(+/27;@EJOTZ_dhmrw}ý}wrmhd_ZTOJE@;72/+(%"   "%(,/48>CHNTY^dhmqvzzvqmhd^YTNHC>84/,(%"  !$(+05:?EKQW]chlquy||yuqlhc]WQKE?:50+($!   #'+05;AGMTZ`fkoswz}}zwsokf`ZTMGA;50+'#   "&*/5;AHNU\bgmquxz|~~|zxuqmgb\UNHA;5/*&"   %).4:AHOU\bhmquxz{||}}~~~~}}||{zxuqmhb\UOHA:4.)%   #(-39@GNU\bhlptvwxxxwwvvvvvvwwxxxxwwvvvvvvwwxxxwvtplhb\UNG@93-(#  !&+18>ELSZ`fjnqstttsqpnmlkjjjjjjjjjjjjklmnpqstttsqnjf`ZSLE>81+&!  $)/5DJOSWZ\]]\ZWUQNKGEB@>=<;;<=>@BEGKNQUWZ\]]\ZWSOJD>82,&!  #(.39?DIMPSUUUTRPMJFC@<:7543333457:<@CFJMPRTUUUSPMID?93.(#   $)/49>BFILMNNLKHEB?;8520.-,++,-.0258;?BEHKLNNMLIFB>94/)$   !%*/38;851.,)(&%%%%&(),.158;>ACEFFFDB?<83/*%!  !%)-158;=>>>=<:741.+)&$"!  !"$&)+.147:<=>>>=;851-)%!   $(+/1467776531.+)&#!!#&)+.1356777641/+($   #&)+-/0000.-+)&$!!$&)+-.0000/-+)&#   #%'()**)('%#!!#%'()**)('%#    !#$$$$#"!!"#$$$$#!                                             !""##""  ""##""!   "$&'(((('%$"  "$%'(((('&$"   !$')+-...-,+)'$"  "$')+,-...-+)'$!  #&*-/13444420.,*'%#  #%'*,.02444431/-*&#  #'+/2589;;;:9742/-*(&$"! !"$&(*-/2479:;;;9852/+'#  #',048;>@ABAA?=;8630.,*('&&&&'(*,.0368;=?AABA@>;840,'#  "&+059=ADFHHHGFDB?<97421/.----./12479CFJLNOONLKHFCA><:8765555678:<>ACFHKLNOONLJFC>94/*%   #(-38=CGKORSTUTSQOMJHFDBA@?>>>>?@ABDFHJMOQSTUTSROKGC=83-(#   %*06;AFKPTVYZZZYXVTRPNMKJIIHHHHIIJKMNPRTVXYZZZYVTPKFA;60*%   "'-28>DJOSWZ]^___^\[YXWVUTTTTTTTTTTUVWXY[\^___^]ZWSOJD>82-'"  $).4:@FLQVZ^`bcdccbba``___````````___``abbccdcb`^ZVQLF@:4.)$  !%*06CGLQUZ^chnszzsnhc^ZUQLGC>:51-)&#    "%(+/26:?CGLQUZ`ekrz¼zrke`ZUQLGC?:62/+(%"   !$&),/36:>BGKPV[bhpxüxphb[VPKGB>:63/,)&$!   "$'),/259=AFKPW]emvvme]WPKFA=952/,)'$"   !"$&(+.148<@EKQYajt~ù~tjaYQKE@<841.+(&$"!   !#%'),/26;@FLT\fp|ù|pf\TLF@;62/,)'%#!    !#%'*-15:@GOWalx·xlaWOG@:51-*'%#!    !#&),05;BJR]htth]RJB;50,)&#!   !$'+06=ENXco|Ż|ocXNE=60+'$!   #',18@IS^jwwj^SI@81,'#   #(-4BGKPV[bhpxüxphb[VPKGB>:63/,)&$!   "%(+/26:?CGLQUZ`ekrz¼zrke`ZUQLGC?:62/+(%"    #&)-15:>CGLQUZ^chnszzsnhc^ZUQLGC>:51-)&#    #'+/38=BFKPUY^bfjotyytojfb^YUPKFB=83/+'#    #'+05:?DJOTX]adhlosw||wsolhda]XTOJD?:50+'#    #',16;AFLQV[_cfilorux{{xurolifc_[VQLFA;61,'#   #',16DJOSWZ]^___^\[YXWVUTTTTTTTTTTUVWXY[\^___^]ZWSOJD>82-'"   %*06;AFKPTVYZZZYXVTRPNMKJIIHHHHIIJKMNPRTVXYZZZYVTPKFA;60*%   #(-38=CGKORSTUTSQOMJHFDBA@?>>>>?@ABDFHJMOQSTUTSROKGC=83-(#   %*/49>CFJLNOONLKHFCA><:8765555678:<>ACFHKLNOONLJFC>94/*%   "&+059=ADFHHHGFDB?<97421/.----./12479@ABAA?=;8630.,*('&&&&'(*,.0368;=?AABA@>;840,'#  #'+/2589;;;:9742/-*(&$"! !"$&(*-/2479:;;;9852/+'#  #&*-/13444420.,*'%#  #%'*,.02444431/-*&#  !$')+-...-,+)'$"  "$')+,-...-+)'$!   "$&'(((('%$"  "$%'(((('&$"   !""##""  ""##""!                                            !!!!  !!!!    "$%&&&&%#"  "#%&&&&%$"    "%')*+,++*('%#!!#%'(*++,+*)'%"    $'*,.01110/.,*(&$"  "$&(*,./01110.,*'$   !$(+.1356776531/-+)'%$#"!!!!"#$%')+-/1356776531.+($!   $(,0368:<<<<;97531/-+*)((''(()*+-/13579;<<<<:8630,($   #'+047;=?ABBA@?=;9754210//////0124579;=?@ABBA?=;740+'#  !%*/37;?BDFGGGFECA@><;:9877777789:;<>@ACEFGGGFDB?;73/*%!  #(,16;?CFHJKLLKJIHFEDCBAAA@@@@AAABCDEFHIJKLLKJHFC?;61,(#   %*/49=BFILNOPPPOONMLLKKKKKKKKKKKKKKLLMNOOPPPONLIFB=94/*%   "&+05:?DHKNQRTTTTTTTTTTTUUVVVVVVUUTTTTTTTTTTTRQNKHD?:50+&"  #',16;@EIMPSUVWXYYZZ[\]^_`abbbba`_^]\[ZZYYXWVUSPMIE@;61,'#  $(-27ENWalwwlaWNE>82.*&#!  "&).3:AIS]htþth]SIA:3.)&"  "%*/6=EOYdp}}pdYOE=6/*%"  "&+29AKU`lxxl`UKA92+&"  #(.5=GQ\htth\QG=5.(#   %+2:CMXdp||pdXMC:2+%   "(/7@JU`lxxl`UJ@7/("   &-5>GR]iuui]RG>5-&    %,3GR]iuui]RG>5-&   "(/7@JU`lxxl`UJ@7/("   %+2:CMXdp||pdXMC:2+%   #(.5=GQ\htth\QG=5.(#  "&+29AKU`lxxl`UKA92+&"  "%*/6=EOYdp}}pdYOE=6/*%"  "&).3:AIS]htþth]SIA:3.)&"  !#&*.28>ENWalwwlaWNE>82.*&#!   "%'+.27<;:9877777789:;<>@ACEFGGGFDB?;73/*%!  #'+047;=?ABBA@?=;9754210//////0124579;=?@ABBA?=;740+'#   $(,0368:<<<<;97531/-+*)((''(()*+-/13579;<<<<:8630,($   !$(+.1356776531/-+)'%$#"!!!!"#$%')+-/1356776531.+($!   $'*,.01110/.,*(&$"  "$&(*,./01110.,*'$    "%')*+,++*('%#!!#%'(*++,+*)'%"    "$%&&&&%#"  "#%&&&&%$"    !!!!  !!!!                                                "##$$#"!  !"#$$##"    "$&'(((('&$#!!#$&'(((('&$"   !#&(*,,--,,*)'&$"!  !"$&')*,,--,,*(&#!  !$'*,.012210/.,+)(&%$##""""##$%&()+,./012210.,*'$!   $'*-024566654320/-,+**))))))**+,-/023456665420-*'$   "&*-14689:;;:98765432110000001123456789:;;:98641-*&"   $(,0479<=>???>=<<;::999999999999::;<<=>???>=<9740,($   "&*.269<>@BBCCCBBBAAAAAABBBBBBAAAAAABBBCCCBB@><962.*&"  #',048;>ACDFFGGGGHHHIJJKLLLLLLKJJIHHHGGGGFFDCA>;840,'#   $(,159CIOV]enwwne]VOIC>:62.+(%"  "%'+.26;@FMT\enxxne\TMF@;62.+'%"  !$'*.37=CJR[dnxxnd[RJC=73.*'$!  !#'*/49@GOXblwwlbXOG@94/*'#!   #'+06HR\gq{{qg\RH>6.'!   &-5>GQ[fpzzpf[QG>5-&    &-5>GQ[fpzzpf[QG>5-&   !'.6>HR\gq{{qg\RH>6.'!  "(/7@JT^is}}si^TJ@7/("  #*19BLValvvlaVLB91*#   &,3CIOV]enwwne]VOIC>:62.+(%"  "$(+.259=AFKQW]elt||tle]WQKFA=952.+($"   $'*.158<@DHMRW]cjqxxqjc]WRMHD@<851.*'$   "%)-048;?BFJNRW\agmsyysmga\WRNJFB?;840-)%"   #'+.26:=ADGKNRVZ^chmrw{{wrmhc^ZVRNKGDA=:62.+'#    $(,048;?BEHKNQTWZ^bfjnruwyzzywurnjfb^ZWTQNKHEB?;840,($   !$(-159<@CFHKMOQTVY\_behjlmnnmljheb_\YVTQOMKHFC@<951-($!  !$)-159=@CFHJKMNPRSUWY\^_abbbba_^\YWUSRPNMKJHFC@=951-)$!   $(,159ACDFFGGGGHHHIJJKLLLLLLKJJIHHHGGGGFFDCA>;840,'#  "&*.269<>@BBCCCBBBAAAAAABBBBBBAAAAAABBBCCCBB@><962.*&"   $(,0479<=>???>=<<;::999999999999::;<<=>???>=<9740,($   "&*-14689:;;:98765432110000001123456789:;;:98641-*&"   $'*-024566654320/-,+**))))))**+,-/023456665420-*'$   !$'*,.012210/.,+)(&%$##""""##$%&()+,./012210.,*'$!  !#&(*,,--,,*)'&$"!  !"$&')*,,--,,*(&#!   "$&'(((('&$#!!#$&'(((('&$"    "##$$#"!  !"#$$##"                                               !!  !!   !"#$$$$##"  "##$$$$#"!   "$&'((((('&%#"!  !"#%&'((((('&$"    "%')*+,,,,+*)('&%%$$######$$%%&'()*+,,,,+*)'%"   "%'*,./0000/..-,++************++,-../0000/.,*'%"  !$'*,/02334433222111111111111111122233443320/,*'$!  "%),.1346677777777888999::9998887777777766431.,)%"   #'*-035789:;;<<==>?@@ABBCCBBA@@?>==<<;;:987530-*'#    $'+.1468:;=>?@ABCEFGIJKLLLLKJIGFECBA@?>=;:8641.+'$   !$(+.1479;=?@BCEGIKMPRSUVVVVUSRPMKIGECB@?=;9741.+($!  !$'+.1479<>@BDGILORUX[]_`aa`_][XUROLIGDB@><9741.+'$!   #'*-0369<>ADGJMQTX\`cfikkkkifc`\XTQMJGDA><9630-*'#   "&),/258;>AEHLPUZ^chlpsuvvusplhc^ZUPLHEA>;852/,)&"  !$'*-047:>AEJNSY^djotx|~~|xtojd^YSNJEA>:740-*'$!  "%(+.259CJPX`hpxxph`XPJC>940,)&#    #&*-26CJPX`hpxxph`XPJC>940,)&#    #&),/37;?DJPW^emt{{tme^WPJD?;73/,)&#   "%(+.259AEJNSY^djotx|~~|xtojd^YSNJEA>:740-*'$!  "&),/258;>AEHLPUZ^chlpsuvvusplhc^ZUPLHEA>;852/,)&"   #'*-0369<>ADGJMQTX\`cfikkkkifc`\XTQMJGDA><9630-*'#   !$'+.1479<>@BDGILORUX[]_`aa`_][XUROLIGDB@><9741.+'$!  !$(+.1479;=?@BCEGIKMPRSUVVVVUSRPMKIGECB@?=;9741.+($!   $'+.1468:;=>?@ABCEFGIJKLLLLKJIGFECBA@?>=;:8641.+'$    #'*-035789:;;<<==>?@@ABBCCBBA@@?>==<<;;:987530-*'#   "%),.1346677777777888999::9998887777777766431.,)%"  !$'*,/02334433222111111111111111122233443320/,*'$!  "%'*,./0000/..-,++************++,-../0000/.,*'%"   "%')*+,,,,+*)('&%%$$######$$%%&'()*+,,,,+*)'%"    "$&'((((('&%#"!  !"#%&'((((('&$"   !"#$$$$##"  "##$$$$#"!   !!  !!                                                 !"##$$##""!  !""##$$##"!   !#%&&'''&&&%%$$$$$$$$$$$$$$$$%%&&&'''&&%#!   !$%'())*****)))))**********)))))*****))('%$!  !#%')*+,----...//001111111100//...----,+*)'%#!  "$&)*,-./0112334567899999987654332110/.-,*)&$"  "%'*,-/01345679:<=?@ABBBBA@?=<:97654310/-,*'%"   "%(*,.023568:<>@BDFHIJKKJIHFDB@><:865320.,*(%"   "%(*,.13579;>@CFILNPRSTTSRPNLIFC@>;97531.,*(%"  "$'),.1368;>ADHLOSVY[]]]][YVSOLHDA>;8631.,)'$"  !#&)+.0369=@DHMQUZ^adeffeda^ZUQMHD@=9630.+)&#!  "%'*-036:>BGLQV[`eilnoonlie`[VQLGB>:630-*'%"   #&(+/26:>CINTZ`fkpsuwwuspkf`ZTNIC>:62/+(&#   !$&*-15:?DJQW^ekqvy|~~|yvqke^WQJD?:51-*&$!  !$(+/49>EKRYahou{{uohaYRKE>94/+($!  "%)-28>DKS[ckry~~yrkc[SKD>82-)%"   #'+06GOXajrzzrjaXOG>70*%   "(.4GOXajrzzrjaXOG>70*%   "',29@IQZckt{{tkcZQI@92,'"  !%).4;BJR[dlt{{tld[RJB;4.)%!   #'+06DKS[ckry~~yrkc[SKD>82-)%"  !$(+/49>EKRYahou{{uohaYRKE>94/+($!  !$&*-15:?DJQW^ekqvy|~~|yvqke^WQJD?:51-*&$!   #&(+/26:>CINTZ`fkpsuwwuspkf`ZTNIC>:62/+(&#   "%'*-036:>BGLQV[`eilnoonlie`[VQLGB>:630-*'%"  !#&)+.0369=@DHMQUZ^adeffeda^ZUQMHD@=9630.+)&#!  "$'),.1368;>ADHLOSVY[]]]][YVSOLHDA>;8631.,)'$"  "%(*,.13579;>@CFILNPRSTTSRPNLIFC@>;97531.,*(%"   "%(*,.023568:<>@BDFHIJKKJIHFDB@><:865320.,*(%"   "%'*,-/01345679:<=?@ABBBBA@?=<:97654310/-,*'%"  "$&)*,-./0112334567899999987654332110/.-,*)&$"  !#%')*+,----...//001111111100//...----,+*)'%#!  !$%'())*****)))))**********)))))*****))('%$!   !#%&&'''&&&%%$$$$$$$$$$$$$$$$%%&&&'''&&%#!   !"##$$##""!  !""##$$##"!                                                     !!!""""""""###$$$$$$###""""""""!!!    ""#$$%%%&&''())******))(''&&%%%$$#""    "#$%&''()*+,-.//011110//.-,+*)(''&%$#"   !#$%'()*+,./1245678888765421/.,+*)('%$#!  !#%&()+,.02468:<=?@@@@?=<:86420.,+)(&%#!  !#%')+-/1368;>@CEFGHHGFEC@>;8631/-+)'%#!  !#%'),.0369=@CFILNOPPONLIFC@=9630.,)'%#!   #%'*,/259=AEILPSUWXXWUSPLIEA=952/,*'%#   "$'),037;@DINRVZ\^__^\ZVRNID@;730,)'$"   #&),048=BHMRW\`ceffec`\WRMHB=840,)&#   "%(,049?DJPV\aehkllkhea\VPJD?940,(%"   #'+/4:@FLSY_eimpqqpmie_YSLF@:4/+'#   "&*/4:@GNT[bhmqsuusqmhb[TNG@:4/*&"   $(-39@GNU]cjosvwwvsojc]UNG@93-($   "',28?FNV]djptwyywtpjd]VNF?82,'"   %*07>EMU\djptwyywtpjd\UME>70*%   #)/5EMT[bgknppnkgb[TME>6/)#  !'-4;CJRY_dhkmmkhd_YRJC;4-'!   &,2:AHOV\afhjjhfa\VOHA:2,&   $*18?FMTZ_cfggfc_ZTMF?81*$  #)07>ELSX]adffda]XSLE>70)#  #)/6=DKRX]aceeca]XRKD=6/)#  #)/6=DKRX]aceeca]XRKD=6/)#  #)07>ELSX]adffda]XSLE>70)#  $*18?FMTZ_cfggfc_ZTMF?81*$   &,2:AHOV\afhjjhfa\VOHA:2,&   !'-4;CJRY_dhkmmkhd_YRJC;4-'!  #)/6>EMT[bgknppnkgb[TME>6/)#   %+18@HOW^djnqssqnjd^WOH@81+%   !'-3:BJRY`gmqtvvtqmg`YRJB:3-'!  #)/5EMU\djptwyywtpjd\UME>70*%   "',28?FNV]djptwyywtpjd]VNF?82,'"   $(-39@GNU]cjosvwwvsojc]UNG@93-($   "&*/4:@GNT[bhmqsuusqmhb[TNG@:4/*&"   #'+/4:@FLSY_eimpqqpmie_YSLF@:4/+'#   "%(,049?DJPV\aehkllkhea\VPJD?940,(%"   #&),048=BHMRW\`ceffec`\WRMHB=840,)&#   "$'),037;@DINRVZ\^__^\ZVRNID@;730,)'$"   #%'*,/259=AEILPSUWXXWUSPLIEA=952/,*'%#   !#%'),.0369=@CFILNOPPONLIFC@=9630.,)'%#!  !#%')+-/1368;>@CEFGHHGFEC@>;8631/-+)'%#!  !#%&()+,.02468:<=?@@@@?=<:86420.,+)(&%#!  !#$%'()*+,./1245678888765421/.,+*)('%$#!   "#$%&''()*+,-.//011110//.-,+*)(''&%$#"    ""#$$%%%&&''())******))(''&&%%%$$#""    !!!""""""""###$$$$$$###""""""""!!!                                                  !""######""!    !"#$%&'(())))(('&%$#"!    !"#$%'(*+,..////..,+*('%$#"!    !"$%')+-/024566665420/-+)'%$"!   !"$&(*,/1368:;<==<;:8631/,*(&$"!  !#%'*-/258;>@BCDDCB@>;852/-*'%#!  !$&),/269=@CFHJJJJHFC@=962/,)&$!  !$'*-159=AEILNPQQPNLIEA=951-*'$!  !$'+/37DIMRVY[\\[YVRMID>940+'$    #'+05;@FKQUY]_``_]YUQKF@;50+'#   "&+06;AGMSX\`bccb`\XSMGA;60+&"  !&*06DIMRVY[\\[YVRMID>940+'$   !$'+/37@BCDDCB@>;852/-*'%#!  !"$&(*,/1368:;<==<;:8631/,*(&$"!   !"$%')+-/024566665420/-+)'%$"!    !"#$%'(*+,..////..,+*('%$#"!    !"#$%&'(())))(('&%$#"!    !""######""!                         1D Histrogram5M`(s@b`TNKEHAX>;7X7p71(/3@,,,p,h(&P()%#p&$h"@#!"("p X ` @x (x(@`xp0P `@HPP(H0x88H H(XP`@8@XX`8 8H ` p(X   ` P Hp 08 `` xp (` P (p x  x h X 8 8 ` ` h h p p h H hHdU2D Histogram for datablock Qvis data volume converted from C60Large.dat by ImageVis3D3=08(0? LXU @hxWZ80P 3P.@x`xP  pXh  @ 0H   P pp x0x00H(8   Xh0H`0x h H 8  h HxHHH8 hp ( hx0x` ``x X 800008P    xH0H8xh 8 8 Pp000H`hx hhp (`@`@`0Hxx` 0`HH @xHHHH`HH(P 8H000HH H xxp`  hhhH00`08(hh  x```hP@hHx0H0H0`H0Hxh0x` `0x0HH00HxHHhx(H0X8PxH`00`0P  xp@pX0`0000H0HxHHh@x```x0`0x`HxX(HHHH8H``0``0x@(h0X0H0HH000HH`0H`H8@xh0`0H0HxHHHHx`p@(HH0H0x000H0008`phHP 000000000`00xH`0Xp`HH0H00H0`00H`xHxHP@ H@(Hx00000000``H0H``0xxxH`xx 0`H000`0HH``PpX  Hx00`0000x00HHhXh`H000H00``H00``Hx0xP8@`hX`0`0H0HH`H`0HH8X(hPHH000H0H`HH00x @`8`00H0H0HHH0xP hH@8HxH0H0HH`x0HHHH`0H0xhX`PH000000`0HH``0H``  x@(H0x 0000000`H`00`0H  @Px`H0000HH0Hx``0`0PPxhH000H0H`HH00xHxxhX8HPX0`00HH0H00HH`00Px H00000000HHH`x```x00xhPpx`000000x0xHH`H`0xHxh8( H0000HHH0x0xHH PPxHH0HH`H0000000`0`00HHx0x0` PPP000HH0`0H0`0HHHH`H0`0``h X(  xH00H`00H`x0000``(P@800000000H0`00HHxH xP (XH`0H00Hx`0`0H00x``xH P@ 8 8x`H0`0000000``0`0H`xH0 P88h0H000`H`HH0``H0H0H``` PX(  x00H000000H`000x00H x8h( 8H`HH00H0H00HH``00HH00Hx  h 8 x xH000`0H`H`0`0H`H00000x8P`h0000000H0H0HHHH`H`xHHHHxh8`00Hx00`000H0`x0xHPh H000`00HH000``0H0000HHx`H`xxxhh PH0000H0000000HH00x0`H`00x``hPh xH0H000000`x00H00Hx00H`H0HHxxPPPHPH`00000H00H0`0000H0H0xHH`` xh00`00000000``0H0HH00xx00`0xHHh 8 ` Px0H00H000`000000HHx0`0``HH``H PH 8`HHH0H00`000`000`000x000H`H00P xP0`0HHH00H0000000H00`0x0Hx`8P`88PP0H`0`00H`00000000H`H0H0HHHH0`0` x8  x0`H0000H`0H00000`HH`0``0xxh` PxH000H00000H0`H0`H0H``xHx   `0`x000`H0xH00000H00HH000Hx`HH0 hx8 xHP`Hx000``0`000H0H`HHH`Hx  `PxxHx`0HH00000000`00HHH`Hx`8 HP0`00H0HH0H0HH00H00H000HH000H0`HHH`HP  8H 0`00`000HHH000`0x00000000`0H`xHxx0HxH0000000H00`0H0HH00`0x0``008 x H`0`00H`0HH0`00HHH00x0HH0xxxH 8h`xxH``0H00`HHH000000xH00H`H0H`0xxx````Hxx0H000000``0`0H000x0H`HxH0 PH`00``0000H00H00`000`HHH0H`HH`xxPx`8H``000H00H0000HH00`H00xx0P8`xHH0H0`000x000HH0H00`x00x0Hxx0`PHHx00H0H0HH00`000H000H00HHHxx8 `x0HHH0H00`0000000`00H0H`x``0x8` xxH00H`000000`0HH0`HH00HH00xHH`H0x`xx`x`x``x0000HH0x0000H00H0H0000H000H0x0xxHx h``H`xHx000H`00`0HH`00H0`000000H`0HH00HxH80x`H000000x`x00``H000H0Hx``0Hxx0HxHHxH0`0H0H0H0000`H00H`00H0H00H``HHxx0Hx00xH000H00H0`00HHH0`00Hxxx``x`000`x`00``00H000000000xH0Hx0`xxx x` HH0000H00x0`H0000H00xHHH0HHHHH``x`H````Px`0H00HH00H00H0H`0H`0HHHHxxHxHxx`Hx`x`x`Hx000H00HH000000H`0H``H``x`` ``0 HH0x0`000H`000HHx0HHxH0`x`H`x`HH0`H`0``00`x00H000H00xH0x0H`x0HxHxHx``xx`00000`H0`HH000`xHH```0x`xH`8`x00HH000HHH00`00HH0000HH0H`0xxxHxxx0xHH000H000H0H00x``00H0H`HH`H``HHxH`H``0x`HH00H0H00HH00Hx`00HH00``HH0`0xxxx`00H000`00HHH00`0`00H0`xxxx`x`H`H0x`8H`0H`H0H0H0``00xHHHHHx0HHHxxH`Hx`x0`0x`0x0H0H00`H0000H0HxH`00`0H0xxH0xx``xxx`xHxx0xH0HHH0H0H0000000`0xHH`xHxxH`0`H`xH`HH`0000x00HH0H`0x0H00x0x```0`00xH`x0x0`000H000`x0HH000H000H0H`HH`xx0 0`0xH``HxH0HH00xH0000H0000`H00`H0`HH`xx0`HH0x0H`H0H000000H00`Hx0H0x``0H`xHHHHHx```Hx``HHH``Hxx00H0`0H0`0000``x``000`Hx0x`x`0xxH0H000H`00000`0000`000hx`xH`xH0``x ```000`H00HHHH0H000xx`HxxH0`Hx0`H0xxx`000HxHH0H0H00`000x00xxH00xx0H00H``H`x`0x0x0`HH0`0`H00H`HH0`000H`xxxHH00HHHH`x0`x00x0`0H0H0H0H0``0`0`00`xxxH0H`xH0HH0x`xHHx00000HH00xH0HH0H0Hx0```Hxx0H``H00H0`0``00`00HH0000H`H0`0`xHx`Hx00xx`0HH0`H00`0000H`0H`HH`xH0`H0`HH0x`H `0H0x000H`H0H000`H00000Hx0`00x`00`x``H0H0``0xH0`0xHxH`H00H0000H0`0``Hx00`Hx`x`H```00HH0H0x0`Hx0H000```Hx0`0``xHxxH00`H000`HH00`H```HH`HHH00000HxH0H0xx`Hx`xHx`x0`xH0``x`0H`0H`00H00`0x`00H`H0x`x0````H00``00x``x```H`000HHHxH``00```000`xH0H``H000H`00H0000Hx000`HHHH0`xH0`H``Hx00`H`0H``0x`0`0x00000HH`00H`H0``0`000000H```00HHH0x`H0H0HH00HHHHH00HHx000H0`0`Hx0HH`xH00Hx0xHx00`0Hx00000H``H`0`HH`HH00xH0`00H`x`x`0x0Hx0x00000x00H`00H`HH0HHHH0xxH`HHx0`Hx000`HH`H0H``H00HHxHxHHHxH0HH`H00```0H0H``0H0000000`000`0Hx00HHH``HH00``0H00xHH0xHxx0000H0``0`H`0Hx0``0`x``H000x00`00H0H00000000`xHHH0xH000HH`x`HHxxHHxxHH0H0000HH0HH0HH`xHxxH0H````H0x0H`0x`0Hx0`H0H0H`H0HH0H`H000H00``xHH```xHH`x`HH`00x`0x000000HHH00HH0`H0HHH```HH0`H00xH00x00H00000`H`0`xH`0x0xxHx`0`H`0`xx`0HHH0``0HHH0H`000H000H0HH000`00H0HxHH`0H0H0Hx`H0H`x`H0000HH0HH0xH0``xHHHxH`0`H``0x`HH`H`xH0000000H0`HH0HHx`x0`00H0```0`H00`0HHxHHHH00000xH0`0`xH`000`x`xH0HH0HH00HH000H00`H`H0`H`00H00H0000HH00xx```00`H0`0`H0x0x0H00HHH`00000HH0H`H0HH``H0000`H0`0HH0HH`H00xxxH00H0HHH0x0`x000``HHH`x0x0`Hx0HH`0000H`x0x`xH0H000H000Hxx0xH0`HxH`H00H0H0x000HH00x0xH00000HH000000xHH````0`Hx`H0H00x0000`H`0xHHH000000H0H`HxHHxH0H`H`xH`x000H`HH000x0H0xH00x0`H00H0H`000H00`xHH0`xH``HHH`00H0HH`H`HH00`xH`000H0`H0`0x00xx`H`HH`0`H`H0`H`0xH0H00H00H0H000`H`00H0Hx00HH000```0HHxH`H0H000000`H0`````xH`xH00000`0`HH00H0x`0H0`H0HH0`H000HH00x`Hx`000000x``0`Hx`00`0H00HHH```HH00``H0H000H00HH`HxxxH0HH0Hxx0H00H00H0`00x`0`0x`000`0x00````H``HHHx`xHH0x000H``H`0H0`x`0H000000`00`0HHH00HxHH``0x0000`HH00x`000`00`0xH000x``HHHH`00H00H0000Hx0``0H0H00000`Hxx0`0`x`H0000`xxH`0``0HH00H00H`00H00H000H00H`H`x0`x`0H`0HH0H0H`H0HH`H00000`000H00HHxH`0H``HHHHH0HH0H0HH0H0`0HH000H00x000HH`xH00H000H`x`HH0`HH`0H0H000000000x`0HH0000H0`00`H`0Hxx`0x00`HH0`0H0000Hx```HHHH000``00HHHxH`0`H0HH0HH0HH000H`xxH0H`0HxH00x0000H`H0`HxH`0`H0``0``0000H`0HH0HH`H000`0Hx`0x0x`H000000`0`0H00HHx0`H00x`H00H000H`HHH0HHH0`H0`xH`0``x0000Hx0`0000H000H0`0000xxxH0`x0000H0`H0xH00x0`H00x0000H00`0H``x``H``xxHHH`H000`H00``00H0`0`0`0`H000H000`0000x`0HHxH0H000H000HH0`H`0H`H``HH`H0000000`00H`0x`H`0HH0H0`Hx00H0H0x00H000HH000`00HH0H00`HH`0H`0H0H00HH00H000`0H0H00H0HHx0`Hx`x00HH0H0H0HH```H`000HH0HHHHx00HH0H0HH0Hxx000H``x00H`0HHH0`H``H00HH0000H0000H0`H0`HH0`0H0x0H0`x0``00x00`HH0`0H0H00`000000H`0HH0Hx`HHHH0`xH0H0H00`x000H00H000000H00`00xx0`H0HHH00x`0`H`xHH000xH`H`x```0H0`0HHH0Hx000`000`HH`HHH00H0H0`0`000HHH0H00H000xHxHHxx`xH0H00xH0H0H00H0HH0H000`x00000H000H00`Hx`0HHx``000H0H000HH0`H`0H0H000H0`0HH`0xH`0`HHH`0`00H000H00H00000H0H`H00``0HH000H`000HHH`00HH000HHH`H000x0000H0H`H000H000H00x`H0`000`HHHHx0xH00H`00`H0000``0HH0000H0H00H00`0H0000H0`0H0H00HHx00H000HxH0`H0`000HHH0H`0HHH0H00000000H`0HH`00`0H000000``H0HH00000000H000H0`00HH000xH000HH0`0`0H00000H00x0x00000`000``0`H`H0000`H00H000000H`0H000H0HH0H00`H0HH`0`0H00H```0H0`0H0``00`00`000xH0`0000HHHH0HH`H`000`0`0000H000`H`H000xHH0H00Hx0H0H`0H00H`0H0H`H00HHHH0H0H0000000000H000``0`0x000000000`0H0H0HH000H`H000`0HHH`HH00H00H0000H00000H00``0H000H`0H00000H``00`0000000000H0H00``H`0Hx00xHH00000000H0xH0H00H0HH00HHH`0HH00`0`00`0000H00H00xH000H000`00``H`000H0H`0HH00HH0`HH0`HHHH`000`0`0HH000H0HHHHHHH00000Hx0H000H0H`0`0000H000HHH0H`0000`00H0x0H00000x000`0`H000000HHH0000`HH0000``00HHHHH00HH0`0H00`000`H`x`0`0000000```000H`H00``HH0H`0HHH`H0000H00H000000x0H00HHH00000H00HHH00HH`0000`0000000HH``H000``H0H0000000`HH0HH0HH00HH0Hx00H0x000H0HHH00`0HH`0HxxHHH0HH000H00000HHx000H`00`H00HH00xH000`0000000000H0H00``Hxx000H0`H000H0`H0H0000H000000HxH0H0H0H0`00H000H0HH0000`0000`H000HH0H00`H00H000H0H0H0000H0H0H0xHH0`H000000H0x0x0H0000HHH`HH0Hx0H0HH0Hx00H0Hx0H0x000H00000000xHx00`H0`H00HH00HH0H0H`00H0H0x0`H000HH00H0000HH0H00`0HHH0H0x00H000x0000`00`0`00000H0HH0HH0HH0HHHH00H00000000`H0``0H000000000000000H0000`HHH00H00H0H0000`H0H0H000H00``H000`H0000`0000H`xx0`0HH0000`000`0`0HH`H000HH0HH00HH0HHHHH0000H0H00000HH000H0H000xH0`00`HH00`0`0H000000HH00000H0000H000H`000HHH0H0H00H00H00H000`000000HH0x00`000H00H`H`0H0000000x0000`0000H`00000000HH00H00`H00H00`00000000HH000xHH0H00x0H00H00HH000000000000`000H00H0000`00`0000`HHHHH00H00H00H00000`0H00x`H00H0H000000xHHH0HHH0HHH000`00HH00H0`HHH`0```0H00000000000000H0`00`0000H0000H00H0`000000000H0xH0H0HHH0H00H0H00000H00H000H000`000H00HHH000000`H0H000H00`x0xHH000H00000000000`0H00H`0H000H0HH0000000000H0H`00H0000H00000`0H`H00HH00000HH00H000H000`00H0000H0000H0``H0H00000``00HH0000000`000000HH000H0H0HH00000H000HH00H000H0H0`0HH000H00000H0000H000H0`H000000H00H00H00000`0000000000x000000000H000H000000H000000H000H00000HHHH0000H00000HH0000000H0HxH00`0HxHH0`0H`0H00000H0x0000`0`0H00`00HHHHx0H0H000000HH00HH000`0000HHH0H000000`HHH0H00000000000x000`H000H00H0000HH0000HH0H00HH0HH0000000000000`00H0H0`00HH0`0`H0000000H00000x000`00HH000000000000x0H0HH0H00000000000000H000`00000H00000H`000000000000H0`00HH00000000000000000000`000H00H0H0H00HHx0`0000H00000000`0000H00HH0H00000000H0HH0H000H000000000H00x0H00`00000000H0H00000H0x0000`0000H`0H0000H000000000H00000H00000x0`0H00HH`0000H00`0H`0`000000000H00H`x`0000H`0000H00`00H`0HH00000000000`Hx000x0`000H0H000000H0000HH000000`H0HH00HH00`0H00HH00H0H0H000H00`000H0x00x0x0H`H0HH0HHH000000`0``0000H0`x0H0005``h00(H`0(`pHxxH``xx0x ``HHxHHHH`x0``0`x0x00HHH00Brick Max/Min Valueso@ImageVis3D-3.1.0/ui_files.targets0000644000175000017500000001323712320517543016462 0ustar mathieumathieu _UI _QRC $(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml $(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml @(UI, '|') $(ComputeLinkInputsTargets); ComputeUIOutput; $(ComputeLibInputsTargets); ComputeUIOutput; @(QRC, '|') $(ComputeLinkInputsTargets); ComputeQRCOutput; $(ComputeLibInputsTargets); ComputeQRCOutput; ImageVis3D-3.1.0/Scripts/0000755000175000017500000000000012320517543014711 5ustar mathieumathieuImageVis3D-3.1.0/Scripts/mk_app.sh0000755000175000017500000000426312320517543016524 0ustar mathieumathieu#!/bin/bash if test ! -z "$1" ; then IV3D_BUILD_TYPE=$1 fi source Scripts/util.sh || source util.sh TARGETPATH=Build TARGETAPP=ImageVis3D.app PREFIX="${TARGETPATH}/${TARGETAPP}" if test -n "$1" -a -d "$1" ; then echo "Using '$1' as .app directory." PREFIX="$1" fi if ! test -d "${PREFIX}" ; then die "$PREFIX does not exist, build the application first!" fi echo "Copying Shaders ..." rm -f "${PREFIX}/Contents/Resources/*.glsl" mkdir -p "${PREFIX}/Contents/Resources" cp tuvok/Shaders/* "${PREFIX}/Contents/Resources" echo "Removing subversion garbage ..." find "${PREFIX}" -iname .svn -exec rm -fr {} + echo "done!" macdeployqt="macdeployqt" if test -n "${QT_BIN}" -a -x "${QT_BIN}/macdeployqt" ; then macdeployqt="${QT_BIN}/macdeployqt" fi echo "Running Qt's mac deployment tool." ${macdeployqt} ${PREFIX} version revision echo "Copying ImageVis3D Manual into app..." man=$(manual) import=$(import_data_manual) pushd ${PREFIX}/Contents/Resources rm -f ImageVis3D.pdf echo "Downloading manual from: ${man}" curl -skLO "${man}" mv $(basename "${man}") ImageVis3D.pdf echo "Downloading import data manual from: ${import}" curl -skLO "${import}" popd tarball=$(nm_tarball) zipfile=$(nm_zipfile) pushd Build/ &>/dev/null ver="${IV3D_MAJOR}.${IV3D_MINOR}.${IV3D_PATCH}" sed -i -e "s,VERSION,${ver}," \ ImageVis3D.app/Contents/Info.plist tar zcf ${tarball} ImageVis3D.app zip -9r ${zipfile} ImageVis3D.app popd &>/dev/null mv Build/${tarball} Build/${zipfile} . mkdir -p staging cp -R CmdLineConverter/Build/uvfconvert.app staging/ cp -R Build/ImageVis3D.app staging/ echo "Running Qt's mac deployment tool on uvfconvert..." pushd staging/ &>/dev/null ${macdeployqt} uvfconvert.app popd &>/dev/null echo "Copying manuals into root of dmg..." pushd staging/ &>/dev/null ln ImageVis3D.app/Contents/Resources/ImageVis3D.pdf ln ImageVis3D.app/Contents/Resources/$(basename "${import}") popd &>/dev/null hdiutil create \ -volname "ImageVis3D" \ -srcfolder staging/ \ -format UDZO \ -imagekey zlib-level=9 \ ${zipfile%%zip}dmg rm -fr staging/ hdiutil internet-enable -yes ${zipfile%%zip}dmg ImageVis3D-3.1.0/Scripts/revision.py0000644000175000017500000000107112320517543017120 0ustar mathieumathieu# A replacement for "svn info . | grep Revision | awk '{print $2}', # because windows' shell is worthless. import subprocess import sys import os p1 = subprocess.Popen(["svn", "info", "%s" % sys.argv[1]], stdout=subprocess.PIPE) p2 = subprocess.Popen(["grep", "Revision"], stdin=p1.stdout, stdout=subprocess.PIPE) if os.name == "nt": p3 = subprocess.Popen(["gawk", "{print $2}"], stdin=p2.stdout, stdout=subprocess.PIPE) else: p3 = subprocess.Popen(["awk", "{print $2}"], stdin=p2.stdout, stdout=subprocess.PIPE) output = p3.communicate()[0] print output.rstrip() ImageVis3D-3.1.0/Scripts/WinVM.bat0000644000175000017500000002201112320517543016375 0ustar mathieumathieucd.. set path=%path%;C:\Program Files (x86)\CollabNet Subversion Client;C:\Program Files (x86)\CollabNet Subversion;C:\Program Files (x86)\Inno Setup 5;C:\tools SETLOCAL ENABLEDELAYEDEXPANSION date /t > result.txt time /t >> result.txt echo Start >> result.txt svn cleanup cd Tuvok svn cleanup cd Basics svn cleanup cd .. cd .. svn update time /t >> result.txt echo SVN completed >> result.txt svn info > rev1.txt cd Tuvok svn info > ..\rev2.txt cd .. pushd Scripts\installer del /f ImageVis3D.pdf wget --no-check-certificate http://www.sci.utah.edu/images/docs/imagevis3d.pdf wget --no-check-certificate http://ci.sci.utah.edu:8011/devbuilds/GettingDataIntoImageVis3D.pdf rename imagevis3d.pdf ImageVis3D.pdf popd for /f "tokens=1,2" %%i in (rev1.txt) do if %%i==Revision: set IV3DVERSION=%%j for /f "tokens=1,2" %%i in (rev2.txt) do if %%i==Revision: set TUVOKVERSION=%%j for /f "tokens=2,3" %%i in (ImageVis3D\StdDefines.h) do if %%i==IV3D_MAJOR set IV3D_MAJOR=%%j for /f "tokens=2,3" %%i in (ImageVis3D\StdDefines.h) do if %%i==IV3D_MINOR set IV3D_MINOR=%%j for /f "tokens=2,3" %%i in (ImageVis3D\StdDefines.h) do if %%i==IV3D_PATCH set IV3D_PATCH=%%j for /f "tokens=2,3" %%i in (Tuvok\StdTuvokDefines.h) do if %%i==TUVOK_MAJOR set TUVOK_MAJOR=%%j for /f "tokens=2,3" %%i in (Tuvok\StdTuvokDefines.h) do if %%i==TUVOK_MINOR set TUVOK_MINOR=%%j for /f "tokens=2,3" %%i in (Tuvok\StdTuvokDefines.h) do if %%i==TUVOK_PATCH set TUVOK_PATCH=%%j set TUVOKCODEVERSION=%TUVOK_MAJOR%.%TUVOK_MINOR%.%TUVOK_PATCH% set IV3DCODEVERSION=%IV3D_MAJOR%.%IV3D_MINOR%.%IV3D_PATCH% del rev1.txt del rev2.txt echo #ifndef IV3D_SVN_VERSION >> ImageVis3D\StdDefines.h echo #define IV3D_SVN_VERSION %IV3DVERSION% >> ImageVis3D\StdDefines.h echo #endif >> ImageVis3D\StdDefines.h echo #ifndef TUVOK_SVN_VERSION >> Tuvok\StdTuvokDefines.h echo #define TUVOK_SVN_VERSION %TUVOKVERSION% >> Tuvok\StdTuvokDefines.h echo #endif >> Tuvok\StdTuvokDefines.h set REVSTR=%IV3DVERSION%_%TUVOKVERSION% set CONFIG=Release (with DirectX) echo f | xcopy result.txt \\geronimo\share\IV3D-WIN\ImageVis3D_%IV3DCODEVERSION%_Win_r%REVSTR%.log /Y IF EXIST "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" ( call "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" amd64 goto ENVSET ) IF EXIST "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" ( call "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86 goto ENVSET ) IF EXIST "C:\Program Files (x86)\Microsoft Visual Studio 8.0\VC\vcvarsall.bat" ( call "C:\Program Files (x86)\Microsoft Visual Studio 8.0\VC\vcvarsall.bat" amd64 goto ENVSET ) IF EXIST "C:\Program Files\Microsoft Visual Studio 8.0\VC\vcvarsall.bat" ( call "C:\Program Files\Microsoft Visual Studio 8.0\VC\vcvarsall.bat" x86 goto ENVSET ) goto ENVFAIL :ENVSET time /t >> result.txt echo Deleting previous binaries >> result.txt del "Build\Win32\%CONFIG%\ImageVis3D-32.exe" del "CmdLineConverter\Build\v\%CONFIG%\TuvokConverter32.exe" del "UVFReader\Build\Win32\%CONFIG%\TuvokReader32.exe" del "Build\x64\%CONFIG%\ImageVis3D-64.exe" del "CmdLineConverter\Build\x64\%CONFIG%\TuvokConverter64.exe" del "UVFReader\Build\x64\%CONFIG%\TuvokReader64.exe" echo Build Environment completed >> result.txt echo on IF EXIST out64.txt del out64.txt rem devenv ImageVis3D.sln /rebuild "%CONFIG%|x64" /out out64.txt msbuild ImageVis3D.sln /nologo /p:Configuration="%CONFIG%",Platform=x64 /t:rebuild /fileLogger /fileLoggerParameters:LogFile=out64.txt IF ERRORLEVEL 0 ( set FAILED64=FALSE ) ELSE ( set FAILED64=TRUE ) time /t >> result.txt IF EXIST "Build\x64\%CONFIG%\ImageVis3D-64.exe" ( set BUILD64=TRUE echo ImageVis 64bit build completed >> result.txt iscc Scripts\installer\64.iss ) ELSE ( set BUILD64=FALSE echo ImageVis 64bit build failed >> result.txt ) IF EXIST "CmdLineConverter\Build\x64\%CONFIG%\TuvokConverter64.exe" ( set BUILDUVF64=TRUE echo TuvokConverter64 completed >> result.txt ) ELSE ( set BUILDUVF64=FALSE echo TuvokConverter64 failed >> result.txt ) IF EXIST "UVFReader\Build\x64\%CONFIG%\TuvokReader64.exe" ( set BUILDUVFR64=TRUE echo TuvokReader64 completed >> result.txt ) ELSE ( set BUILDUVFR64=FALSE echo TuvokReader64 failed >> result.txt ) IF EXIST out32.txt del out32.txt rem devenv ImageVis3D.sln /rebuild "%CONFIG%|win32" /out out32.txt msbuild ImageVis3D.sln /nologo /p:Configuration="%CONFIG%",Platform=win32 /t:rebuild /fileLogger /fileLoggerParameters:LogFile=out32.txt IF ERRORLEVEL 0 ( set FAILED32=FALSE ) ELSE ( set FAILED32=TRUE ) time /t >> result.txt IF EXIST "Build\Win32\%CONFIG%\ImageVis3D-32.exe" ( set BUILD32=TRUE echo ImageVis 32bit build completed >> result.txt iscc Scripts\installer\32.iss ) ELSE ( set BUILD32=FALSE echo ImageVis 32bit build failed >> result.txt ) IF EXIST "CmdLineConverter\Build\Win32\%CONFIG%\TuvokConverter32.exe" ( set BUILDUVF32=TRUE echo TuvokConverter32 completed >> result.txt ) ELSE ( set BUILDUVF32=FALSE echo TuvokConverter32 failed >> result.txt ) IF EXIST "UVFReader\Build\Win32\%CONFIG%\TuvokReader32.exe" ( set BUILDUVFR32=TRUE echo TuvokReader32 completed >> result.txt ) ELSE ( set BUILDUVFR32=FALSE echo TuvokReader32 failed >> result.txt ) IF NOT EXIST \\geronimo\share\IV3D-WIN\nul mkdir \\geronimo\share\IV3D-WIN if NOT !BUILD64!==TRUE ( if NOT !BUILD32!==TRUE goto ALLFAILED ) time /t >> result.txt echo Packing ZIP file >> result.txt mkdir Nightly cd Nightly if !BUILD64!==TRUE xcopy /y "..\Build\x64\%CONFIG%\ImageVis3D-64.exe" . if !BUILD32!==TRUE xcopy /y "..\Build\Win32\%CONFIG%\ImageVis3D-32.exe" . mkdir Shaders xcopy /Y ..\Tuvok\Shaders\*.glsl .\Shaders del ..\ImageVis3D*.zip "C:\Program Files\7-Zip\7z" a -r ..\ImageVis3D_%IV3DCODEVERSION%_Win_r%REVSTR%.zip del . /F /S /Q rmDir Shaders IF EXIST ..\ImageVis3D_%IV3DCODEVERSION%_Win_r%REVSTR%.zip ( time /t >> ..\result.txt echo ImageVis3D build successful >> ..\result.txt ) else ( goto ZIPFAIL ) echo %IV3DCODEVERSION% > Windows_Latest_Version.txt echo %IV3DVERSION% >> Windows_Latest_Version.txt echo %TUVOKCODEVERSION% >> Windows_Latest_Version.txt echo %TUVOKVERSION% >> Windows_Latest_Version.txt xcopy Windows_Latest_Version.txt \\geronimo\share\IV3D-WIN /Y del Windows_Latest_Version.txt if NOT !BUILDUVF64!==TRUE ( if NOT !BUILDUVF32!==TRUE goto UVFAILED ) if !BUILDUVF64!==TRUE xcopy /y "..\CmdLineConverter\Build\x64\%CONFIG%\*.exe" . if !BUILDUVF32!==TRUE xcopy /y "..\CmdLineConverter\Build\Win32\%CONFIG%\*.exe" . if !BUILDUVFR64!==TRUE xcopy /y "..\UVFReader\Build\x64\%CONFIG%\*.exe" . if !BUILDUVFR32!==TRUE xcopy /y "..\UVFReader\Build\Win32\%CONFIG%\*.exe" . "C:\Program Files\7-Zip\7z" a -r ..\TuvokCmdlineTools_Win_r%REVSTR%.zip del . /F /S /Q xcopy ..\ImageVis3D_%IV3DCODEVERSION%_Win_r%REVSTR%.zip \\geronimo\share\IV3D-WIN /Y del ..\ImageVis3D_%IV3DCODEVERSION%_Win_r%REVSTR%.zip if !BUILD32!==TRUE ( echo f | xcopy ..\Scripts\installer\ImageVis3D-32bit.exe \\geronimo\share\IV3D-WIN\ImageVis3D_%IV3DCODEVERSION%_Win_r%REVSTR%-32bit-installer.exe /Y echo f | xcopy ..\Scripts\installer\ImageVis3D-32bit.exe \\geronimo\share\IV3D-WIN\ImageVis3D-Latest-32bit-installer.exe /Y del ..\Scripts\installer\ImageVis3D-32bit.exe ) if !BUILD64!==TRUE ( echo f | xcopy ..\Scripts\installer\ImageVis3D-64bit.exe \\geronimo\share\IV3D-WIN\ImageVis3D_%IV3DCODEVERSION%_Win_r%REVSTR%-64bit-installer.exe /Y echo f | xcopy ..\Scripts\installer\ImageVis3D-64bit.exe \\geronimo\share\IV3D-WIN\ImageVis3D-Latest-64bit-installer.exe /Y del ..\Scripts\installer\ImageVis3D-64bit.exe ) IF EXIST ..\TuvokCmdlineTools_Win_r%REVSTR%.zip ( time /t >> ..\result.txt echo Command Line tools build successful >> ..\result.txt ) else ( goto ZIPFAILUVF ) xcopy ..\TuvokCmdlineTools_Win_r%REVSTR%.zip \\geronimo\share\IV3D-WIN /Y del ..\TuvokCmdlineTools_Win_r%REVSTR%.zip :UVFAILED cd .. rmdir Nightly echo f | xcopy "Tuvok\Build\Win32\%CONFIG%\objects\BuildLog.htm" \\geronimo\share\IV3D-WIN\tuvok32.htm /Y echo f | xcopy "Tuvok\Build\x64\%CONFIG%\objects\BuildLog.htm" \\geronimo\share\IV3D-WIN\tuvok64.htm /Y echo f | xcopy "Build\Win32\%CONFIG%\objects\BuildLog.htm" \\geronimo\share\IV3D-WIN\IV3D32.htm /Y echo f | xcopy "Build\x64\%CONFIG%\objects\BuildLog.htm" \\geronimo\share\IV3D-WIN\IV3D64.htm /Y GOTO END :ENVFAIL echo Could not set Visual Studio Environment >> result.txt goto END :ZIPFAIL echo Packing the final ImageVis3D ZIP file failed >> result.txt goto END :ZIPFAILUVF echo Packing the final TuvokConverter ZIP file failed >> result.txt goto END :ALLFAILED echo All builds failed to compile >> result.txt goto END :END echo.>> result.txt echo.>> result.txt echo -------------------------------->> result.txt echo.>> result.txt echo.>> result.txt type out32.txt >> result.txt type out64.txt >> result.txt echo f | xcopy result.txt \\geronimo\share\IV3D-WIN\ImageVis3D_%IV3DCODEVERSION%_Win_r%REVSTR%.log /Y IF EXIST result.txt del result.txt IF EXIST out32.txt del out32.txt IF EXIST out64.txt del out64.txt del ImageVis3D\StdDefines.h del Tuvok\StdTuvokDefines.h echo done > \\geronimo\share\IV3D-WIN\done.trigger ImageVis3D-3.1.0/Scripts/installer/0000755000175000017500000000000012320517543016706 5ustar mathieumathieuImageVis3D-3.1.0/Scripts/installer/32-debug.iss0000644000175000017500000001354512320517543020746 0ustar mathieumathieu; For more information, please see: http://software.sci.utah.edu ; ; The MIT License ; ; Copyright (c) 2009 Scientific Computing and Imaging Institute, ; University of Utah. ; ; ; Permission is hereby granted, free of charge, to any person obtaining a ; copy of this software and associated documentation files (the "Software"), ; to deal in the Software without restriction, including without limitation ; the rights to use, copy, modify, merge, publish, distribute, sublicense, ; and/or sell copies of the Software, and to permit persons to whom the ; Software is furnished to do so, subject to the following conditions: ; ; The above copyright notice and this permission notice shall be included ; in all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ; OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ; THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ; DEALINGS IN THE SOFTWARE. ; ; ; ; Hilbert Curve implementation copyright 1998, Rice University. ; ; ; ; LZ4 - Fast LZ compression algorithm ; Copyright (C) 2011-2012, Yann Collet. ; BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions are ; met: ; ; * Redistributions of source code must retain the above copyright ; notice, this list of conditions and the following disclaimer. ; * Redistributions in binary form must reproduce the above ; copyright notice, this list of conditions and the following disclaimer ; in the documentation and/or other materials provided with the ; distribution. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ; ; ; ; ImageVis3D 32 bit installer script: creates an installer for x86 systems. ; From the root of the ImageVis3D subversion tree, process this file with ; "iscc.exe" from Inno Setup 5. ; This is for debug installations. [Setup] AppName=ImageVis3D AppVerName=ImageVis3D 3.1.0 AppVersion=3.1.0 AppPublisher=SCI Institute AppPublisherURL=http://software.sci.utah.edu/ AppSupportURL=http://software.sci.utah.edu/ AppUpdatesURL=http://software.sci.utah.edu/ AppCopyright=Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. DefaultDirName={pf}\ImageVis3D DefaultGroupName=ImageVis3D OutputDir=Scripts\installer OutputBaseFilename=ImageVis3D-32bit-debug AllowNoIcons=no Compression=lzma/ultra InternalCompressLevel=ultra SolidCompression=yes SourceDir=../../ LicenseFile=LICENSE ; Install on Windows XP or newer (actually a Windows NT build number) MinVersion=0,5.01 ArchitecturesAllowed=x64 x86 [Languages] Name: english; MessagesFile: compiler:Default.isl [Tasks] Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked [Dirs] Name: {app} Name: {userappdata}\ImageVis3D; Flags: uninsalwaysuninstall [Files] ; Dependencies. ; MS redistributable crap. ; Getting rid of redistributable until we can either: 1) run vcredist_x86.exe during setup, or 2) install visual studio 2010 ; as opposed to visual studio 2010 express edition. Express edition does NOT come with a redist directory, but the full ; version does: ; http://connect.microsoft.com/VisualStudio/feedback/details/559425/c-2010-express-web-install-vc-redist-folder-missing ; Source: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\redist\x86\Microsoft.VC100.CRT\*; DestDir: {app}; Flags: recursesubdirs Source: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\redist\x86\Microsoft.VC100.MFC\*; DestDir: {app}; Flags: recursesubdirs ;;Source: "vcredist.exe"; DestDir: {tmp}; DestName: vcredist.exe; Flags: deleteafterinstall; ; ImageVis3D Source: Build\Win32\Debug\ImageVis3D-32.exe; DestDir: {app}; Flags: ignoreversion replacesameversion Source: CmdLineConverter\Build\Win32\Debug\TuvokConverter32.exe; DestDir: {app}; Flags: ignoreversion replacesameversion Source: Tuvok\Shaders\*; DestDir: {app}\Shaders; Excludes: .svn; Flags: ignoreversion replacesameversion Source: imagevis3d.pdf; DestDir: {app}; Flags: ignoreversion replacesameversion Source: GettingDataIntoImageVis3D.pdf; DestDir: {app}; Flags: ignoreversion replacesameversion [Icons] Name: {group}\ImageVis3D; Filename: {app}\ImageVis3D-32-debug.exe; WorkingDir: {app} Name: {commondesktop}\ImageVis3D; Filename: {app}\ImageVis3D-32-debug.exe; WorkingDir: {app} Name: {group}\{cm:UninstallProgram,ImageVis3D}; Filename: {uninstallexe} Name: {group}\Manual; Filename: {app}\ImageVis3D.pdf; WorkingDir: {app} Name: {group}\Manual; Filename: {app}\GettingDataIntoImageVis3D.pdf; WorkingDir: {app} [Run] Filename: {app}\ImageVis3D.exe; Description: {cm:LaunchProgram,ImageVis3D}; Flags: nowait postinstall ;Filename: {tmp}\vcredist.exe; StatusMsg: "Installing required Visual C++ runtime..." [UninstallDelete] Type: filesandordirs; Name: {userappdata}\ImageVis3D* ImageVis3D-3.1.0/Scripts/installer/64-debug.iss0000644000175000017500000001300312320517543020740 0ustar mathieumathieu; For more information, please see: http://software.sci.utah.edu ; ; The MIT License ; ; Copyright (c) 2009 Scientific Computing and Imaging Institute, ; University of Utah. ; ; ; Permission is hereby granted, free of charge, to any person obtaining a ; copy of this software and associated documentation files (the "Software"), ; to deal in the Software without restriction, including without limitation ; the rights to use, copy, modify, merge, publish, distribute, sublicense, ; and/or sell copies of the Software, and to permit persons to whom the ; Software is furnished to do so, subject to the following conditions: ; ; The above copyright notice and this permission notice shall be included ; in all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ; OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ; THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ; DEALINGS IN THE SOFTWARE. ; ; ; ; Hilbert Curve implementation copyright 1998, Rice University. ; ; ; ; LZ4 - Fast LZ compression algorithm ; Copyright (C) 2011-2012, Yann Collet. ; BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions are ; met: ; ; * Redistributions of source code must retain the above copyright ; notice, this list of conditions and the following disclaimer. ; * Redistributions in binary form must reproduce the above ; copyright notice, this list of conditions and the following disclaimer ; in the documentation and/or other materials provided with the ; distribution. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ; ; ; ; ImageVis3D 64 bit installer script: creates an installer for amd64 systems. ; From the root of the ImageVis3D subversion tree, process this file with ; "iscc.exe" from Inno Setup 5. [Setup] AppName=ImageVis3D AppVerName=ImageVis3D 3.1.0 AppVersion=3.1.0 AppPublisher=SCI Institute AppPublisherURL=http://software.sci.utah.edu/ AppSupportURL=http://software.sci.utah.edu/ AppUpdatesURL=http://software.sci.utah.edu/ AppCopyright=Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. DefaultDirName={pf}\ImageVis3D DefaultGroupName=ImageVis3D OutputDir=Scripts\installer OutputBaseFilename=ImageVis3D-64bit-debug AllowNoIcons=no Compression=lzma/ultra InternalCompressLevel=ultra SolidCompression=yes SourceDir=../../ LicenseFile=LICENSE ; Install on Windows XP or newer (actually a Windows NT build number) MinVersion=0,5.01 ArchitecturesAllowed=x64 ArchitecturesInstallIn64BitMode=x64 [Languages] Name: english; MessagesFile: compiler:Default.isl [Tasks] Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked [Dirs] Name: {app} Name: {userappdata}\ImageVis3D; Flags: uninsalwaysuninstall [Files] ; Dependencies. ; MS redistributable crap. Source: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\redist\x64\Microsoft.VC100.CRT\*; DestDir: {app}; Flags: recursesubdirs Source: "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\redist\x64\Microsoft.VC100.MFC\*"; DestDir: "{app}"; Flags: recursesubdirs ;Source: "vcredist_x64.exe"; DestDir: {tmp}; DestName: vcredist.exe; Flags: deleteafterinstall; ; ImageVis3D Source: build\x64\Debug\ImageVis3D-64.exe; DestDir: {app}; Flags: ignoreversion replacesameversion Source: CmdLineConverter\Build\x64\Debug\TuvokConverter64.exe; DestDir: {app}; Flags: ignoreversion replacesameversion Source: Tuvok\Shaders\*; DestDir: {app}\Shaders; Excludes: .svn; Flags: ignoreversion replacesameversion Source: Scripts\installer\imagevis3d.pdf; DestDir: {app}; Flags: ignoreversion replacesameversion Source: Scripts\installer\GettingDataIntoImageVis3D.pdf; DestDir: {app}; Flags: ignoreversion replacesameversion [Icons] Name: {group}\ImageVis3D; Filename: {app}\ImageVis3D-64.exe; WorkingDir: {app} Name: {commondesktop}\ImageVis3D; Filename: {app}\ImageVis3D-64.exe; WorkingDir: {app} Name: {group}\{cm:UninstallProgram,ImageVis3D}; Filename: {uninstallexe} Name: {group}\Manual; Filename: {app}\ImageVis3D.pdf; WorkingDir: {app} Name: {group}\Manual; Filename: {app}\GettingDataIntoImageVis3D.pdf; WorkingDir: {app} [Run] Filename: {app}\ImageVis3D-64.exe; Description: {cm:LaunchProgram,ImageVis3D}; Flags: nowait postinstall ;Filename: {tmp}\vcredist.exe; StatusMsg: "Installing required Visual C++ runtime..." [UninstallDelete] Type: filesandordirs; Name: {userappdata}\ImageVis3D* ImageVis3D-3.1.0/Scripts/installer/64.iss0000644000175000017500000001303712320517543017663 0ustar mathieumathieu; For more information, please see: http://software.sci.utah.edu ; ; The MIT License ; ; Copyright (c) 2009 Scientific Computing and Imaging Institute, ; University of Utah. ; ; ; Permission is hereby granted, free of charge, to any person obtaining a ; copy of this software and associated documentation files (the "Software"), ; to deal in the Software without restriction, including without limitation ; the rights to use, copy, modify, merge, publish, distribute, sublicense, ; and/or sell copies of the Software, and to permit persons to whom the ; Software is furnished to do so, subject to the following conditions: ; ; The above copyright notice and this permission notice shall be included ; in all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ; OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ; THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ; DEALINGS IN THE SOFTWARE. ; ; ; ; Hilbert Curve implementation copyright 1998, Rice University. ; ; ; ; LZ4 - Fast LZ compression algorithm ; Copyright (C) 2011-2012, Yann Collet. ; BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions are ; met: ; ; * Redistributions of source code must retain the above copyright ; notice, this list of conditions and the following disclaimer. ; * Redistributions in binary form must reproduce the above ; copyright notice, this list of conditions and the following disclaimer ; in the documentation and/or other materials provided with the ; distribution. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ; ; ; ; ImageVis3D 64 bit installer script: creates an installer for amd64 systems. ; From the root of the ImageVis3D subversion tree, process this file with ; "iscc.exe" from Inno Setup 5. [Setup] AppName=ImageVis3D AppVerName=ImageVis3D 3.1.0 AppVersion=3.1.0 AppPublisher=SCI Institute AppPublisherURL=http://software.sci.utah.edu/ AppSupportURL=http://software.sci.utah.edu/ AppUpdatesURL=http://software.sci.utah.edu/ AppCopyright=Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. DefaultDirName={pf}\ImageVis3D DefaultGroupName=ImageVis3D OutputDir=Scripts\installer OutputBaseFilename=ImageVis3D-64bit AllowNoIcons=no Compression=lzma/ultra InternalCompressLevel=ultra SolidCompression=yes SourceDir=../../ LicenseFile=LICENSE ; Install on Windows XP or newer (actually a Windows NT build number) MinVersion=0,5.01 ArchitecturesAllowed=x64 ArchitecturesInstallIn64BitMode=x64 [Languages] Name: english; MessagesFile: compiler:Default.isl [Tasks] Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked [Dirs] Name: {app} Name: {userappdata}\ImageVis3D; Flags: uninsalwaysuninstall [Files] ; Dependencies. ; MS redistributable crap. Source: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\redist\x64\Microsoft.VC100.CRT\*; DestDir: {app}; Flags: recursesubdirs Source: "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\redist\x64\Microsoft.VC100.MFC\*"; DestDir: "{app}"; Flags: recursesubdirs ;Source: "vcredist_x64.exe"; DestDir: {tmp}; DestName: vcredist.exe; Flags: deleteafterinstall; ; ImageVis3D Source: build\x64\Release (with DirectX)\ImageVis3D-64.exe; DestDir: {app}; Flags: ignoreversion replacesameversion Source: CmdLineConverter\Build\x64\Release (with DirectX)\TuvokConverter64.exe; DestDir: {app}; Flags: ignoreversion replacesameversion Source: Tuvok\Shaders\*; DestDir: {app}\Shaders; Excludes: .svn; Flags: ignoreversion replacesameversion Source: Scripts\installer\imagevis3d.pdf; DestDir: {app}; Flags: ignoreversion replacesameversion Source: Scripts\installer\GettingDataIntoImageVis3D.pdf; DestDir: {app}; Flags: ignoreversion replacesameversion [Icons] Name: {group}\ImageVis3D; Filename: {app}\ImageVis3D-64.exe; WorkingDir: {app} Name: {commondesktop}\ImageVis3D; Filename: {app}\ImageVis3D-64.exe; WorkingDir: {app} Name: {group}\{cm:UninstallProgram,ImageVis3D}; Filename: {uninstallexe} Name: {group}\Manual; Filename: {app}\ImageVis3D.pdf; WorkingDir: {app} Name: {group}\Manual; Filename: {app}\GettingDataIntoImageVis3D.pdf; WorkingDir: {app} [Run] Filename: {app}\ImageVis3D-64.exe; Description: {cm:LaunchProgram,ImageVis3D}; Flags: nowait postinstall ;Filename: {tmp}\vcredist.exe; StatusMsg: "Installing required Visual C++ runtime..." [UninstallDelete] Type: filesandordirs; Name: {userappdata}\ImageVis3D* ImageVis3D-3.1.0/Scripts/installer/32.iss0000644000175000017500000001277412320517543017665 0ustar mathieumathieu; For more information, please see: http://software.sci.utah.edu ; ; The MIT License ; ; Copyright (c) 2009 Scientific Computing and Imaging Institute, ; University of Utah. ; ; ; Permission is hereby granted, free of charge, to any person obtaining a ; copy of this software and associated documentation files (the "Software"), ; to deal in the Software without restriction, including without limitation ; the rights to use, copy, modify, merge, publish, distribute, sublicense, ; and/or sell copies of the Software, and to permit persons to whom the ; Software is furnished to do so, subject to the following conditions: ; ; The above copyright notice and this permission notice shall be included ; in all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ; OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ; THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ; DEALINGS IN THE SOFTWARE. ; ; ; ; Hilbert Curve implementation copyright 1998, Rice University. ; ; ; ; LZ4 - Fast LZ compression algorithm ; Copyright (C) 2011-2012, Yann Collet. ; BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions are ; met: ; ; * Redistributions of source code must retain the above copyright ; notice, this list of conditions and the following disclaimer. ; * Redistributions in binary form must reproduce the above ; copyright notice, this list of conditions and the following disclaimer ; in the documentation and/or other materials provided with the ; distribution. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ; ; ; ; ImageVis3D 32 bit installer script: creates an installer for x86 systems. ; From the root of the ImageVis3D subversion tree, process this file with ; "iscc.exe" from Inno Setup 5. [Setup] AppName=ImageVis3D AppVerName=ImageVis3D 3.1.0 AppVersion=3.1.0 AppPublisher=SCI Institute AppPublisherURL=http://software.sci.utah.edu/ AppSupportURL=http://software.sci.utah.edu/ AppUpdatesURL=http://software.sci.utah.edu/ AppCopyright=Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. DefaultDirName={pf}\ImageVis3D DefaultGroupName=ImageVis3D OutputDir=Scripts\installer OutputBaseFilename=ImageVis3D-32bit AllowNoIcons=no Compression=lzma/ultra InternalCompressLevel=ultra SolidCompression=yes SourceDir=../../ LicenseFile=LICENSE ; Install on Windows XP or newer (actually a Windows NT build number) MinVersion=0,5.01 ArchitecturesAllowed=x64 x86 [Languages] Name: english; MessagesFile: compiler:Default.isl [Tasks] Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked [Dirs] Name: {app} Name: {userappdata}\ImageVis3D; Flags: uninsalwaysuninstall [Files] ; Dependencies. ; MS redistributable crap. Source: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\redist\x86\Microsoft.VC100.CRT\*; DestDir: {app}; Flags: recursesubdirs Source: "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\redist\x86\Microsoft.VC100.MFC\*"; DestDir: "{app}"; Flags: recursesubdirs ;Source: "vcredist.exe"; DestDir: {tmp}; DestName: vcredist.exe; Flags: deleteafterinstall; ; ImageVis3D Source: build\Win32\Release (with DirectX)\ImageVis3D-32.exe; DestDir: {app}; Flags: ignoreversion replacesameversion Source: CmdLineConverter\Build\Win32\Release (with DirectX)\TuvokConverter32.exe; DestDir: {app}; Flags: ignoreversion replacesameversion Source: Tuvok\Shaders\*; DestDir: {app}\Shaders; Excludes: .svn; Flags: ignoreversion replacesameversion Source: Scripts\installer\imagevis3d.pdf; DestDir: {app}; Flags: ignoreversion replacesameversion Source: Scripts\installer\GettingDataIntoImageVis3D.pdf; DestDir: {app}; Flags: ignoreversion replacesameversion [Icons] Name: {group}\ImageVis3D; Filename: {app}\ImageVis3D-32.exe; WorkingDir: {app} Name: {commondesktop}\ImageVis3D; Filename: {app}\ImageVis3D-32.exe; WorkingDir: {app} Name: {group}\{cm:UninstallProgram,ImageVis3D}; Filename: {uninstallexe} Name: {group}\Manual; Filename: {app}\ImageVis3D.pdf; WorkingDir: {app} Name: {group}\Manual; Filename: {app}\GettingDataIntoImageVis3D.pdf; WorkingDir: {app} [Run] Filename: {app}\ImageVis3D-32.exe; Description: {cm:LaunchProgram,ImageVis3D}; Flags: nowait postinstall ;Filename: {tmp}\vcredist.exe; StatusMsg: "Installing required Visual C++ runtime..." [UninstallDelete] Type: filesandordirs; Name: {userappdata}\ImageVis3D* ImageVis3D-3.1.0/Scripts/oneshot-release.bat0000644000175000017500000000141012320517543020472 0ustar mathieumathieuREM IV3D release build set w32_cf="-D_CRT_SECURE_NO_WARNINGS=1 -D_SCL_SECURE_NO_WARNINGS=1" set bld="msbuild" IF "%1"=="x64" ( REM Handle 64 bit compilation call "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" x64 %bld% ^ ImageVis3D-2010.sln ^ /nologo ^ /p:Configuration="Release (with DirectX)",Platform=x64 ^ /t:Build ^ /m:2 ) ELSE ( REM Handle 32 bit compilation call "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" %bld% ^ ImageVis3D-2010.sln ^ /nologo ^ /p:Configuration="Release (with DirectX)",Platform=Win32 ^ /t:Build ^ /m:2 ) REM download documentation powershell -ExecutionPolicy Unrestricted -file Scripts\dl.ps1 REM bundle it IF "%1"=="x64" ( iscc Scripts/installer/64.iss ) ELSE ( iscc Scripts/installer/32.iss ) ImageVis3D-3.1.0/Scripts/mk_tarball.sh0000644000175000017500000000151212320517543017354 0ustar mathieumathieu#!/bin/bash # Creates a tarball binary of ImageVis3D. if test ! -z "$1" ; then IV3D_BUILD_TYPE=$1 fi source Scripts/util.sh tarball=$(nm_tarball) mkdir staging man=$(manual) import=$(import_data_manual) version pushd staging >/dev/null ver="${IV3D_MAJOR}.${IV3D_MINOR}.${IV3D_PATCH}" dir="ImageVis3D-${ver}" mkdir "${dir}" cp ../Build/ImageVis3D ./${dir} cp ../CmdLineConverter/Build/uvfconvert ${dir} cp -R ../Tuvok/Shaders ./${dir} rm -fr ${dir}/Shaders/.svn # remove dumb svn crap # grab manuals wget -q --no-check-certificate "${man}" mv $(basename "${man}") ImageVis3D.pdf # uppercase it. mv ImageVis3D.pdf ${dir} wget -q --no-check-certificate "${import}" mv $(basename "${import}") ${dir} # tar it all up GZIP="--best" tar zcf "${tarball}" ${dir} mv "${tarball}" ../ popd >/dev/null rm -fr staging ImageVis3D-3.1.0/Scripts/neon.sh0000644000175000017500000000404712320517543016211 0ustar mathieumathieu#!/bin/sh cd ${HOME}/imagevis3d source Scripts/util.sh export PATH="${HOME}/sw/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin" # this affects what BSD mail uses for the Reply-To header: export REPLYTO="tfogal@sci.utah.edu" # if something should fail: em="tfogal@sci.utah.edu" # warnings and other information: full_em="tfogal@sci.utah.edu" status="status-neon" # like 'try' but sends an email if it fails. function mailtry { $@ if test $? -ne 0 ; then echo "'$@' failed, bailing .." echo "Command: '$@' failed..." >> ${status} cat ${status} | mail -s "Neon nightly FAILED" ${em} exit 1 fi } echo "Using compiler version:" > ${status} g++ --version >> ${status} echo "" >> ${status} echo "On system:" >> ${status} uname -a >> ${status} echo "" >> ${status} echo "-------------------------------------" >> ${status} try cd ${HOME}/imagevis3d rm -f *.tar.gz *.zip *.dmg warnings mailtry sh Scripts/nightly.sh grep -v "IO/3rdParty" warnings > warn_no_3rd mv warn_no_3rd warnings cat warnings >> ${status} subj="" if test `file warnings | awk '{print $2}'` = "empty" ; then subj="Neon nightly (clean) -- `date`" else subj="Neon nightly (warnings) -- `date`" fi if test "$1" != "-q" ; then cat ${status} | mail -s "${subj}" ${full_em} fi devb="/usr/sci/projects/sciweb/devbuilds/imagevis3d/" mailtry scp *.zip tfogal@shell.sci.utah.edu:${devb} mailtry scp *.dmg tfogal@shell.sci.utah.edu:${devb} # Now update the `latest version' symlink. fn_zip=$(nm_zipfile) fn_zip="${devb}/${fn_zip}" fn_latest="${devb}/ImageVis3D-OSX-10.5-Latest.zip" mailtry ssh tfogal@shell.sci.utah.edu rm -f ${fn_latest} mailtry ssh tfogal@shell.sci.utah.edu rm -f ${fn_latest%%zip}dmg mailtry ssh tfogal@shell.sci.utah.edu ln -s ${fn_zip} ${fn_latest} mailtry ssh tfogal@shell.sci.utah.edu ln -s ${fn_zip%%zip}dmg \ ${fn_latest%%zip}dmg # Update the text file for determining the latest version. mailtry mv latest OSX_Latest_Version.txt mailtry scp OSX_Latest_Version.txt tfogal@shell.sci.utah.edu:${devb} ImageVis3D-3.1.0/Scripts/deb-vm.sh0000644000175000017500000000264212320517543016423 0ustar mathieumathieu#!/bin/sh cd ${HOME}/imagevis3d source Scripts/util.sh export PATH="${HOME}/sw/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin" rm -f ${status} warnings echo "Using compiler version:" > ${status} g++ --version >> ${status} echo "" >> ${status} echo "On system:" >> ${status} uname -a >> ${status} echo "" >> ${status} echo "-------------------------------------" >> ${status} mailtry cd ${HOME}/imagevis3d rm -f *.tar.gz *.zip warnings mailtry sh Scripts/nightly.sh touch warnings # we assume the file exists. grep -v "IO/3rdParty" warnings > warn_no_3rd mv warn_no_3rd warnings cat warnings >> ${status} subj="" if test `file warnings | awk '{print $2}'` = "empty" ; then subj="deb-vm nightly (clean) -- `date`" else subj="deb-vm nightly (warnings) -- `date`" fi if test "$1" != "-q" ; then cat ${status} | mail -s "${subj}" ${full_em} fi devbuilds="/usr/sci/projects/sciweb/devbuilds/imagevis3d" devb_host="shell.sci.utah.edu" mailtry scp *.tar.gz tfogal@${devb_host}:${devbuilds} # Update `latest version' symlink. fn_tarball=$(nm_tarball) fn_tarball="${devbuilds}/${fn_tarball}" fn_latest="${devbuilds}/ImageVis3D-Linux-Latest.tar.gz" mailtry ssh tfogal@${devb_host} rm -f ${fn_latest} mailtry ssh tfogal@${devb_host} ln -s ${fn_tarball} ${fn_latest} # Update the text file for automagic version checks. mailtry mv latest Linux_Latest_Version.txt mailtry scp Linux_Latest_Version.txt tfogal@${devb_host}:${devbuilds} ImageVis3D-3.1.0/Scripts/vg-nightly.sh0000644000175000017500000000073312320517543017340 0ustar mathieumathieu#!/bin/sh # Run valgrind on the converter. Intended for automatic operation. . Scripts/util.sh if ! test -f aneur.nrrd ; then wget http://www.sci.utah.edu/~tfogal/aneur.nrrd fi revs=$(revision) echo "revision: ${revs}" valgrind --leak-check=no --undef-value-errors=yes \ --log-file="vg-log-${revs}" \ CmdLineConverter/Build/UVFConverter \ -f aneur.nrrd \ -out tmp.uvf if test $? -ne 0 ; then echo "Abnormal termination." fi rm -f tmp.uvf ImageVis3D-3.1.0/Scripts/oneshot-debug.sh0000755000175000017500000000405412320517543020016 0ustar mathieumathieu#!/bin/sh # Script to build everything we can in a single invocation, using # a set of options which is appropriate for creating debug builds. IV3D_BUILD_TYPE="debug" VIS="-fvisibility=hidden" INL="-fvisibility-inlines-hidden" if test `uname -s` != "Darwin"; then COVERAGE="-fprofile-arcs -ftest-coverage" else COVERAGE="" fi CF="-g -Wall -Wextra -O0 -D_DEBUG -fstack-protector ${COVERAGE}" CXF="-D_GLIBCXX_CONCEPT_CHECK -fstack-protector ${COVERAGE}" MKSPEC="" LDFLAGS="${COVERAGE}" if test "$1" == "32" ; then CF="${CF} -m32" CXF="${CXF} -m32" LDFLAGS="${LDFLAGS} -m32" fi # Darwin's debug STL support is broken. # Ditto: OpenMP if test `uname -s` != "Darwin"; then CXF="${CXF} -D_GLIBCXX_DEBUG -Werror --param ssp-buffer-size=4" LDFLAGS="${LDFLAGS} --param ssp-buffer-size=4" else # We don't turn -Werror on because of warnings that deal # with generated code, and some unused template specialization # warnings. MKSPEC="-spec unsupported/macx-clang" fi # Users can set the QT_BIN env var to point at a different Qt implementation. if test -n "${QT_BIN}" ; then echo "Using qmake from '${QT_BIN}' instead of the default from PATH." qm="${QT_BIN}/qmake" else qm="qmake" fi dirs="." dirs="$dirs Tuvok/IO/test" echo "Configuring..." for d in $dirs ; do pushd ${d} &> /dev/null || exit 1 ${qm} \ -makefile \ ${MKSPEC} \ CONFIG+="debug" \ QMAKE_CFLAGS+="${VIS} ${CF}" \ QMAKE_CXXFLAGS+="${VIS} ${INL} ${CF} ${CXF}" \ QMAKE_LFLAGS+="${VIS} ${LDFLAGS}" \ -recursive || exit 1 popd &> /dev/null done # Unless the user gave us input as to options to use, default to a small-scale # parallel build. if test -z "${MAKE_OPTIONS}" ; then MAKE_OPTIONS="-j2 -l 2.0" fi echo "BUILDING Tuvok..." make --no-print-directory ${MAKE_OPTIONS} || exit 1 pushd Tuvok/IO/test &> /dev/null || exit 1 make --no-print-directory ${MAKE_OPTIONS} || exit 1 popd &> /dev/null echo "Bundling..." if test `uname -s` = "Darwin" ; then bash Scripts/mk_app.sh $IV3D_BUILD_TYPE else bash Scripts/mk_tarball.sh $IV3D_BUILD_TYPE fi ImageVis3D-3.1.0/Scripts/Mac-DynamicQt-Cocoa.sh0000755000175000017500000000333612320517543020666 0ustar mathieumathieu#!/bin/sh VERSION=4.8.4 PREFIX="${HOME}/sw" QTDIR="qt-everywhere-opensource-src-${VERSION}" echo "Removing old build..." rm -fr ${QTDIR} tarball="${QTDIR}.tar" echo "Extracting..." # Do they have a bzip'd or a gzip'd tarball? if test -f ${tarball}.bz2 ; then tar jxf ${tarball}.bz2 elif test -f ${tarball}.gz ; then tar zxf ${tarball}.gz else echo "${tarball}.gz not found; Downloading Qt..." curl -kLO http://releases.qt-project.org/qt4/source/${tarball}.gz tar zxf ${tarball}.gz fi pushd ${QTDIR} || exit 1 echo "yes" | \ ./configure \ -prefix ${HOME}/sw \ -buildkey "imagevis3d" \ -release \ -opensource \ -largefile \ -exceptions \ -fast \ -stl \ -no-qt3support \ -no-xmlpatterns \ -no-multimedia \ -no-audio-backend \ -no-phonon \ -no-phonon-backend \ -no-svg \ -no-webkit \ -no-javascript-jit \ -no-script \ -no-scripttools \ -no-declarative \ -no-declarative-debug \ -platform macx-g++ \ -no-scripttools \ -system-zlib \ -no-gif \ -qt-libtiff \ -qt-libpng \ -qt-libmng \ -qt-libjpeg \ -no-openssl \ -make libs \ -make tools \ -nomake examples \ -nomake demos \ -nomake docs \ -nomake translations \ -no-nis \ -no-cups \ -no-iconv \ -no-pch \ -no-dbus \ -arch "x86 x86_64" if test $? -ne 0; then echo "configure failed" exit 1 fi nice make -j6 || exit 1 rm -fr ${PREFIX}/bin/qmake ${PREFIX}/lib/libQt* ${PREFIX}/lib/Qt* rm -fr ${PREFIX}/include/Qt* nice make install || exit 1 popd ImageVis3D-3.1.0/Scripts/argon.sh0000644000175000017500000000313212320517543016352 0ustar mathieumathieu#!/bin/sh cd ${HOME}/imagevis3d source Scripts/util.sh export PATH="${HOME}/sw/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin" echo "Using compiler version:" > ${status} g++ --version >> ${status} echo "" >> ${status} echo "On system:" >> ${status} uname -a >> ${status} echo "" >> ${status} echo "-------------------------------------" >> ${status} mailtry cd ${HOME}/imagevis3d rm -f *.tar.gz *.zip *.dmg warnings mailtry sh Scripts/nightly.sh touch warnings # we assume the file exists. grep -v "IO/3rdParty" warnings > warn_no_3rd mv warn_no_3rd warnings cat warnings >> ${status} subj="" if test `file warnings | awk '{print $2}'` = "empty" ; then subj="Argon nightly (clean) -- `date`" else subj="Argon nightly (warnings) -- `date`" fi if test "$1" != "-q" ; then cat ${status} | mail -s "${subj}" ${full_em} fi devb="/usr/sci/projects/sciweb/devbuilds/imagevis3d/" mailtry scp *.zip tfogal@shell.sci.utah.edu:${devb} mailtry scp *.dmg tfogal@shell.sci.utah.edu:${devb} # Now update the `latest version' symlink. fn_zip=$(nm_zipfile) fn_zip="${devb}/${fn_zip}" fn_latest="${devb}/ImageVis3D-OSX-10.5-Latest.zip" mailtry ssh tfogal@shell.sci.utah.edu rm -f ${fn_latest} mailtry ssh tfogal@shell.sci.utah.edu rm -f ${fn_latest%%zip}dmg mailtry ssh tfogal@shell.sci.utah.edu ln -s ${fn_zip} ${fn_latest} mailtry ssh tfogal@shell.sci.utah.edu ln -s ${fn_zip%%zip}dmg \ ${fn_latest%%zip}dmg # Update the text file for determining the latest version. mailtry mv latest OSX_Latest_Version.txt mailtry scp OSX_Latest_Version.txt tfogal@shell.sci.utah.edu:${devb} ImageVis3D-3.1.0/Scripts/nightly.sh0000755000175000017500000000335412320517543016733 0ustar mathieumathieu#!/bin/sh source Scripts/util.sh spec="linux-g++" if test `uname` = "Darwin" ; then spec="macx-g++" fi vcs_update version revision if test "x$1" != "x--dirty" ; then make clean &>/dev/null # manual clean, just in case Qt's clean isn't good enough (it isn't.) find . \( -iname \*.o -or -iname moc_\*.cpp -or -iname ui_\*.h \) -delete fi rm -fr Build/ImageVis3D.app rm -f Build/ImageVis3D warnings # Find qmake -- expect it in PATH, but the user can set QT_BIN to pick a # specific Qt. if test -n "${QT_BIN}" -a -x "${QT_BIN}/qmake" ; then qmake="${QT_BIN}/qmake" echo "QT_BIN set; using ${qmake} instead of `which qmake`" else qmake="qmake" fi # use qmake to generate makefiles, potentially in debug mode. D_TUVOK="-DTUVOK_SVN_VERSION=${R_TUVOK}" D_IV3D="-DIV3D_SVN_VERSION=${R_IMAGEVIS3D}" CF="-fno-strict-aliasing ${D_TUVOK} ${D_IV3D} -U_DEBUG -DNDEBUG" CFG="release" if test "x$1" = "x-debug"; then CF="${CF} -Wextra -D_GLIBCXX_DEBUG -D_DEBUG -UNDEBUG -g" CFG="debug" fi ${qmake} \ QMAKE_CONFIG=${CFG} \ QMAKE_CFLAGS="${CF}" \ QMAKE_CXXFLAGS+="${CF}" \ QMAKE_LFLAGS="${CF} ${LDF} ${LDFLAGS}" \ -spec ${spec} \ -recursive if test $? -ne 0 ; then die "qmake failed." fi make -j3 2> warnings try make tarball=$(nm_tarball) zipfile=$(nm_zipfile) if test `uname` = "Darwin" ; then echo "Building app file ..." try bash Scripts/mk_app.sh elif test `uname` = "Linux" ; then echo "Packaging ..." try bash Scripts/mk_tarball.sh fi rm -f latest echo "${IV3D_MAJOR}.${IV3D_MINOR}.${IV3D_PATCH}" > latest echo "${R_IMAGEVIS3D}" >> latest echo "${TUVOK_MAJOR}.${TUVOK_MINOR}.${TUVOK_PATCH}" >> latest echo "${R_TUVOK}" >> latest if test -f warnings ; then echo "Warnings:" cat warnings fi ImageVis3D-3.1.0/Scripts/oneshot-release.sh0000755000175000017500000000377712320517543020363 0ustar mathieumathieu#!/bin/sh # Script to build everything we can in a single invocation, using # a set of options which is appropriate for creating release builds. IV3D_BUILD_TYPE="release" VIS="-fvisibility=hidden" INL="-fvisibility-inlines-hidden" COVERAGE="" CF="-Wall -Wextra -O2 -fstack-protector ${COVERAGE}" CXF="-D_GLIBCXX_CONCEPT_CHECK -fstack-protector -DQT_NODEBUG ${COVERAGE}" QLF="" MKSPEC="" if test "$1" == "32" ; then CF="$CF -m32" COVERAGE="$COVERAGE -m32" fi LDFLAGS="${COVERAGE}" # Users can set the QT_BIN env var to point at a different Qt implementation. if test -n "${QT_BIN}" ; then echo "Using qmake from '${QT_BIN}' instead of the default from PATH." qm="${QT_BIN}/qmake" else qm="qmake" fi dirs="." if test `uname` != "Darwin" ; then dirs="$dirs Tuvok/IO/test" CXF="${CXF} -Werror --param ssp-buffer-size=4" CF="${CF} --param ssp-buffer-size=4" QLF="${QLF}" else # We don't turn -Werror on because of warnings that deal # with generated code, and some unused template specialization # warnings. MKSPEC="-spec unsupported/macx-clang" fi echo "Configuring..." for d in $dirs ; do pushd ${d} &> /dev/null || exit 1 ${qm} \ -makefile \ ${MKSPEC} \ CONFIG+="release" \ QMAKE_CFLAGS+="${VIS} ${CF}" \ QMAKE_CXXFLAGS+="${VIS} ${INL} ${CF} ${CXF}" \ QMAKE_LFLAGS+="${VIS} ${COVERAGE} ${QLF}" \ -recursive || exit 1 popd &> /dev/null done # Unless the user gave us input as to options to use, default to a small-scale # parallel build. if test -z "${MAKE_OPTIONS}" ; then MAKE_OPTIONS="-j2 -l 2.0" fi echo "BUILDING Tuvok..." make --no-print-directory ${MAKE_OPTIONS} || exit 1 # Darwin's compiler is broken w.r.t. tr1, our IO tests won't work. if test `uname -s` != "Darwin" ; then pushd Tuvok/IO/test &> /dev/null || exit 1 make --no-print-directory ${MAKE_OPTIONS} || exit 1 popd &> /dev/null fi echo "Bundling..." if test `uname -s` = "Darwin" ; then bash Scripts/mk_app.sh $IV3D_BUILD_TYPE else bash Scripts/mk_tarball.sh $IV3D_BUILD_TYPE fi ImageVis3D-3.1.0/Scripts/debian.sh0000644000175000017500000000456712320517543016503 0ustar mathieumathieu#!/bin/sh # A script to checkout and create .debs of the ImageVis3D repository. . util.sh || . Scripts/util.sh mode="debian" if test "$1" = "--ubuntu-ppa" ; then mode="ubuntu-ppa" fi version VER="${IV3D_MAJOR}.${IV3D_MINOR}.${IV3D_PATCH}" DEB_VER=1 SVN=https://gforge.sci.utah.edu/svn/imagevis3d function die { echo "$@" exit 1 } rm -fr imagevis3d-${VER}* rm -f ./*.changes ./*.deb ./*.tar.gz ./*.dsc ./*.diff.gz ./*_source.upload \ ./*_source.changes revs=$(svn export --force ${SVN} | \ grep "Exported" | \ awk '{print $(NF)'} | \ cut -d. -f1 | \ tr "[:space:]" "~" \ ) if test $? -ne 0; then die "svn export failed." ; fi echo "revs: ${revs}" if test "${mode}" = "ubuntu-ppa" ; then VER="${VER}~ppa${revs}" else VER="${VER}~svn${revs}" fi mv imagevis3d "imagevis3d-${VER}" export GZIP="--best" tar zcf imagevis3d_${VER}.orig.tar.gz imagevis3d-${VER} pushd imagevis3d-${VER} || die "imagevis3d-${VER} directory does not exist" if test -d ../../notdebian ; then echo "Running from Scripts/? Using local debian dir." cp -R ../../notdebian debian || die "couldn't copy debian dir" else echo "Not running from scripts; using in-repo debian dir." ln -s notdebian debian || die "couldn't symlink debian dir" fi # Generate a valid changelog. pushd debian || die "no debian dir." if test "${mode}" = "ubuntu-ppa" ; then distroseries="precise" else distroseries="unstable" fi echo "imagevis3d (${VER}-${DEB_VER}) ${distroseries}; urgency=low" > ncl echo "" >> ncl echo " * Nightly build." >> ncl echo "" >> ncl echo " -- Thomas Fogal $(date -R)" >> ncl echo "" >> ncl cat changelog >> ncl mv ncl changelog # So one can review what that generated: echo "changelog:" head changelog popd if test "${mode}" = "ubuntu-ppa" ; then dpkg-buildpackage -rfakeroot -sgpg -S -sa || die "buildpackage failed." else dpkg-buildpackage -rfakeroot -sgpg -sa -j4 || die "buildpackage failed" fi popd if test "${mode}" = "ubuntu-ppa" ; then lintian -I -i imagevis3d_${VER}-${DEB_VER}_source.changes | less read -p "dput to launchpad? " upload if test "${upload}" = "y"; then dput -f sci-ppa imagevis3d_${VER}-${DEB_VER}_source.changes fi else lintian -I -i imagevis3d_${VER}-${DEB_VER}_amd64.changes fi ImageVis3D-3.1.0/Scripts/Win-StaticQt-4.8.bat0000644000175000017500000000121012320517543020171 0ustar mathieumathieunmake clean configure ^ -buildkey "imagevis3d" ^ -debug-and-release ^ -opensource ^ -confirm-license ^ -static ^ -ltcg ^ -exceptions ^ -stl ^ -no-sql-sqlite ^ -no-sql-sqlite2 ^ -no-qt3support ^ -platform win32-msvc2012 ^ -largefile ^ -no-gif ^ -qt-libpng ^ -no-libmng ^ -qt-libtiff ^ -qt-libjpeg ^ -no-incredibuild-xge ^ -no-phonon ^ -no-phonon-backend ^ -no-multimedia ^ -no-audio-backend ^ -no-webkit ^ -no-script ^ -no-scripttools ^ -no-declarative ^ -no-declarative-debug ^ -mp ^ -nomake examples ^ -nomake demos ^ -nomake docs nmake sub-src ImageVis3D-3.1.0/Scripts/Linux-StaticQt.sh0000755000175000017500000000330312320517543020100 0ustar mathieumathieu#!/bin/sh VERSION=4.8.1 PREFIX="${HOME}/sw" QTDIR="qt-everywhere-opensource-src-${VERSION}" echo "Removing old build..." rm -fr ${QTDIR} tarball="${QTDIR}.tar" echo "Extracting..." # Do they have a bzip'd or a gzip'd tarball? if test -f ${tarball}.bz2 ; then tar jxf ${tarball}.bz2 elif test -f ${tarball}.gz ; then tar zxf ${tarball}.gz else echo "${tarball}.gz not found; Downloading Qt..." wget -q http://get.qt.nokia.com/qt/source/${tarball}.gz tar zxf ${tarball}.gz fi pushd ${QTDIR} || exit 1 echo "yes" | \ ./configure \ -prefix ${HOME}/sw \ -buildkey "imagevis3d" \ -static \ -release \ -opensource \ -fast \ -largefile \ -exceptions \ -no-accessibility \ -stl \ -no-qt3support \ -no-xmlpatterns \ -no-multimedia \ -no-audio-backend \ -no-phonon \ -no-phonon-backend \ -no-webkit \ -no-javascript-jit \ -no-scripttools \ -no-declarative \ -no-declarative-debug \ -graphicssystem opengl \ -no-gif \ -qt-libtiff \ -qt-libpng \ -qt-libmng \ -qt-libjpeg \ -no-openssl \ -no-nis \ -no-cups \ -no-iconv \ -no-nas-sound \ -opengl desktop \ -no-openvg \ -no-sm \ -make libs \ -make tools \ -nomake examples \ -nomake demos \ -nomake docs \ -nomake translations if test $? -ne 0; then echo "configure failed" exit 1 fi nice make -j2 || exit 1 rm -fr ${PREFIX}/bin/qmake ${PREFIX}/lib/libQt* ${PREFIX}/lib/Qt* rm -fr ${PREFIX}/include/Qt* nice make install || exit 1 popd ImageVis3D-3.1.0/Scripts/version.py0000644000175000017500000000050612320517543016751 0ustar mathieumathieu# A replacement for "grep IV3D_MAJOR StdDefines.h | awk "{print $3}" # because windows' shell is worthless. import subprocess import sys p1 = subprocess.Popen(["grep", "%s" % sys.argv[1], "ImageVis3D/StdDefines.h"], stdout=subprocess.PIPE) output = p1.communicate()[0] ver = output.split() print ver[2] ImageVis3D-3.1.0/Scripts/dl.ps10000644000175000017500000000054612320517543015742 0ustar mathieumathieucd Scripts $manual="http://www.sci.utah.edu/images/docs/imagevis3d.pdf" $mdata="http://ci.sci.utah.edu:8011/devbuilds/GettingDataIntoImageVis3D.pdf" $webClient = New-Object System.Net.WebClient $webClient.DownloadFile($manual, $pwd.path+"\installer\ImageVis3D.pdf") $webClient.DownloadFile($mdata, $pwd.path+"\installer\GettingDataIntoImageVis3D.pdf") ImageVis3D-3.1.0/Scripts/oneshot-debug.bat0000644000175000017500000000271312320517543020147 0ustar mathieumathieuREM Script to build everything we can in a single invocation, using REM a set of options which is appropriate for creating debug builds. set w32_cf="-D_CRT_SECURE_NO_WARNINGS=1 -D_SCL_SECURE_NO_WARNINGS=1" REM qmake -tp vc ^ REM QMAKE_CFLAGS+=%w32_cf% ^ REM QMAKE_CXXFLAGS+=%w32_cf% ^ REM -recursive ^ REM ImageVis3d.pro set bld="msbuild" IF "%1"=="x64" ( REM Handle 64 bit compilation call "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" x64 %bld% ^ ImageVis3D-2010.sln ^ /nologo ^ /p:Configuration="Debug",Platform=x64 ^ /t:Build ^ /m:2 ) ELSE ( REM Handle 32 bit compilation call "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" %bld% ^ ImageVis3D-2010.sln ^ /nologo ^ /p:Configuration="Debug",Platform=Win32 ^ /t:Build ^ /m:2 ) pushd Tuvok\IO\test python ../3rdParty/cxxtest/cxxtestgen.py ^ --no-static-init ^ --error-printer ^ -o alltests.cpp ^ quantize.h ^ jpeg.h qmake -tp vc ^ QMAKE_CFLAGS+=%w32_cf% ^ QMAKE_CXXFLAGS+=%w32_cf% ^ -recursive ^ test.pro %bld% ^ cxxtester.vcproj ^ /nologo ^ /t:Build popd REM download documentation set manual="http://www.sci.utah.edu/images/docs/imagevis3d.pdf" set mdata="http://ci.sci.utah.edu:8011/devbuilds/GettingDataIntoImageVis3D.pdf" wget --no-check-certificate -q %manual% wget --no-check-certificate -q %mdata% REM bundle it. IF "%1"=="x64" ( iscc Scripts/installer/64-debug.iss ) ELSE ( iscc Scripts/installer/32-debug.iss ) ImageVis3D-3.1.0/Scripts/iv3d-arch.sh0000644000175000017500000000026712320517543017032 0ustar mathieumathieu#!/bin/bash # This exists so that CI can easily grab the arch string we'll embed into # tarballs and the like. source Scripts/util.sh 2>/dev/null|| source util.sh || exit 1 sci_arch ImageVis3D-3.1.0/Scripts/util.sh0000644000175000017500000001262212320517543016225 0ustar mathieumathieu#!/bin/sh # Various utility functions useful in nightly scripts. # this affects what BSD mail uses for the Reply-To header: export REPLYTO="tfogal@sci.utah.edu" # if something should fail: em="tfogal@sci.utah.edu" # warnings and other information: full_em="tfogal@sci.utah.edu" export status="status-${hostname}" # Give an error message and exit uncleanly. function die { echo "'$@' failed, bailing..." exit 1 } # Run a command which must succeed, else the script terminates. function try { $@ if test $? -ne 0 ; then die "$@" fi } # like 'try' but sends an email if it fails. function mailtry { $@ if test $? -ne 0 ; then echo "'$@' failed, bailing .." echo "Command: '$@' failed..." >> ${status} if test -f warnings ; then echo "-------------------------------------" >> ${status} echo "" >> ${status} cat warnings >> ${status} fi cat ${status} | mail -s "$(hostname) nightly FAILED" ${em} exit 1 fi } # Determines the appropriate VCS system to use. Mainly to handles/distinguish # between svn and git-svn repositories. Sets variable `VCS' to the appropriate # executable. VCS="" function _vcs { if test -d .git ; then VCS="git svn" else VCS="svn" fi } # Updates a git-svn repository. One argument: a directory to cd to first. function git_svn_update { pushd "$@" git diff --exit-code --quiet &>/dev/null local saved=0 if test $? -ne 0 ; then git stash save "uncomitted changes from `date`" saved=1 fi git checkout master $VCS rebase git checkout private git rebase master if test $saved -eq 1 ; then git stash pop fi popd } # Does the appropriate update, based on $VCS. For git, assumes you do your # personal work in a branch `private' function vcs_update { if test -z "${VCS}" ; then _vcs fi if test "x${VCS}" = "xsvn" ; then svn update else git_svn_update "." git_svn_update "Tuvok" git_svn_update "Tuvok/Basics" git_svn_update "Tuvok/IO" fi } # Echoes the revision numbers from the two repositories. Also sets # R_IMAGEVIS3D and R_TUVOK shell variables. function revision { if test -z "${VCS}" ; then _vcs fi R_IMAGEVIS3D=`$VCS info | grep Revision | awk '{print $2}'` pushd Tuvok &>/dev/null R_TUVOK=`$VCS info | grep Revision | awk '{print $2}'` popd &> /dev/null pushd Tuvok/Basics &>/dev/null R_BASICS=`$VCS info | grep Revision | awk '{print $2}'` popd &> /dev/null pushd Tuvok/IO &>/dev/null R_IO=`$VCS info | grep Revision | awk '{print $2}'` popd &> /dev/null echo "${R_IMAGEVIS3D}_${R_TUVOK}_${R_BASICS}_${R_IO}" } # Reads the version numbers from Std*Defines.h. Sets IV3D_VERSION, # TUVOK_VERSION. function version { # search for StdDefs: we might be in the Scripts/ dir. if test -f "ImageVis3D/StdDefines.h" ; then vheader="ImageVis3D/StdDefines.h" else vheader="../ImageVis3D/StdDefines.h" fi export IV3D_MAJOR=` \ grep "IV3D_MAJOR" ${vheader} | \ awk '{ print $3 }'` export IV3D_MINOR=` \ grep "IV3D_MINOR" ${vheader} | \ awk '{ print $3 }'` export IV3D_PATCH=` \ grep "IV3D_PATCH" ${vheader} | \ awk '{ print $3 }'` if test -f "Tuvok/StdTuvokDefines.h" ; then vheader="Tuvok/StdTuvokDefines.h" else vheader="../Tuvok/StdTuvokDefines.h" fi export TUVOK_MAJOR=` \ grep "TUVOK_MAJOR" ${vheader} | \ awk '{ print $3 }'` export TUVOK_MINOR=` \ grep "TUVOK_MINOR" ${vheader} | \ awk '{ print $3 }'` export TUVOK_PATCH=` \ grep "TUVOK_PATCH" ${vheader} | \ awk '{ print $3 }'` export IV3D_VERSION="${IV3D_MAJOR}.${IV3D_MINOR}.${IV3D_PATCH}" export TUVOK_VERSION="${TUVOK_MAJOR}.${TUVOK_MINOR}.${TUVOK_PATCH}" } # Determine the platform of the current machine. function sci_arch { local arch=`uname -m` local opsys=`uname -s` if test "x${opsys}" = "xDarwin" ; then # 10.4? 10.5? This gets the system version. local sysver=$(system_profiler \ -detailLevel mini SPSoftwareDataType | \ grep "System Version:" | \ awk '{print $6}') opsys="${opsys}-${sysver}" fi if test `uname` = "Linux" ; then distro=$(lsb_release -i | awk '{print $3}') distro_release=$(lsb_release -r | awk '{print $2}') echo "${distro}-${distro_release}-${arch}" else echo "${opsys}-${arch}" fi } # Gives the name of the appropriate tarball. function nm_tarball { local arch=$(sci_arch) local revs=$(revision) if test ! -z "$IV3D_BUILD_TYPE" ; then local btype=$IV3D_BUILD_TYPE else local btype="na" fi version echo "ImageVis3D-${arch}-${IV3D_VERSION}-r${revs}-$btype.tar.gz" } # Gives the name of the appropriate zip file. function nm_zipfile { local tb_name=$(nm_tarball) echo "${tb_name%%.tar.gz}.zip" } # Finds out the current URL for the manual. function manual { m=$(grep HELP_URL ./ImageVis3D/StdDefines.h | awk '{print $3}' | \ cut -d \" -f 2) echo "${m}" } # Returns the current location of the data manual function import_data_manual { echo "http://ci.sci.utah.edu:8011/devbuilds/GettingDataIntoImageVis3D.pdf" } ImageVis3D-3.1.0/Scripts/download-test-data.sh0000644000175000017500000000034012320517543020735 0ustar mathieumathieu#!/bin/sh if test -z "${IV3D_DATA_ROOT}" ; then echo "IV3D_DATA_ROOT environment variable not set. Bailing." exit 1 fi unison \ -batch \ ${IV3D_DATA_ROOT} \ socket://155.98.20.225:43212/iv3d-test-data || exit 1 ImageVis3D-3.1.0/Scripts/gcc-dev-cfg.sh0000755000175000017500000000307612320517543017323 0ustar mathieumathieu#!/bin/bash #-D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED VIS="-fvisibility=hidden" INL="-fvisibility-inlines-hidden" DEBUG="-Wall -Wextra -D_DEBUG -O0 -g" CF="${DEBUG} -fstack-protector" CXF="${DEBUG} -D_GLIBCXX_CONCEPT_CHECK -fstack-protector" LF="" MKSPEC="" if test `uname -s` != "Darwin" ; then CF="${CF} -ggdb3 --param ssp-buffer-size=4" CXF="${CXF} -D_GLIBCXX_DEBUG -Werror --param ssp-buffer-size=4" CXF="${CXF} -D_GLIBCXX_DEBUG_PEDANTIC" LF="${LF}" else ALLWARN="" #ALLWARN='-Werror -Wno-padded -Wno-weak-vtables -Weverything' # -Wno-#warnings: Temporarily disable #warnings until a new release of QT is issued. # -Wno-padded: Don't care about 'adding bytes' to ensure byte alignment. # -Wno-weak-vtables: We have several classes which do not have out-of-line virtual # method definitions (resulting in the vtable being emitted in # every translation unit). Examples: Exception ( CF="${CF}" CXF="${CXF} ${ALLWARN}" MKSPEC="-spec unsupported/macx-clang" fi if test -n "${QT_BIN}" ; then echo "Using custom qmake..." qm="${QT_BIN}/qmake" else qm="qmake" fi for d in . tuvok/IO/test ; do pushd ${d} &>/dev/null ${qm} \ ${MKSPEC} \ QMAKE_CONFIG="debug" \ CONFIG="debug" \ QMAKE_CFLAGS+="${VIS} ${CF}" \ QMAKE_CXXFLAGS+="${VIS} ${INL} ${CF} ${CXF}" \ QMAKE_CFLAGS_RELEASE="-O0" \ QMAKE_CXXFLAGS_RELEASE="-O0" \ QMAKE_LFLAGS+="${LF}" \ -recursive || exit 1 popd &>/dev/null done echo "Configure succeeded." exit 0 ImageVis3D-3.1.0/Scripts/build-4.6.0.bat0000644000175000017500000000040212320517543017137 0ustar mathieumathieuset VER=4.6.0 rmdir /S /Q qt-%VER% qt-%VER%-64bit "C:/program files/7-zip/7z.exe" x qt-everywhere-opensource-src-%VER%.zip move /Y qt-everywhere-opensource-src-%VER% qt-%VER%-64bit cd qt-%VER%-64bit copy /Y ..\Win-StaticQt-%VER%.bat . Win-StaticQt-%VER%.bat ImageVis3D-3.1.0/Doxyfile0000644000175000017500000015135612320517543015003 0ustar mathieumathieu# This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file that # follow. The default is UTF-8 which is also the encoding used for all text before # the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into # libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of # possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = "ImageVis3D" # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = doc/doxygen # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, # Italian, Japanese, Japanese-en (Japanese with English messages), Korean, # Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, # Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the DETAILS_AT_TOP tag is set to YES then Doxygen # will output the detailed description near the top, like JavaDoc. # If set to NO, the detailed description appears after the member # documentation. DETAILS_AT_TOP = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 2 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for Java. # For instance, namespaces will be presented as packages, qualified scopes # will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to # include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will # be extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the # base name of the file that contains the anonymous namespace. By # default anonymous namespace are hidden. EXTRACT_ANON_NSPACES = YES # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from the # version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = NO # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = ImageVis3D Tuvok # This tag can be used to specify the character encoding of the # source files that doxygen parses. Internally doxygen uses the UTF-8 # encoding, which is also the default input encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible # encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py FILE_PATTERNS = # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = Tuvok/3rdParty # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the output. # The symbol name can be a fully qualified name, a word, or if the wildcard * is used, # a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH # then you must also enable this option. If you don't then doxygen will produce # a warning and turn it on anyway SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES (the default) # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES (the default) # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. Otherwise they will link to the documentstion. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compressed HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # If the GENERATE_TREEVIEW tag is set to YES, a side panel will be # generated containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = NO # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = NO # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to # produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to # specify the directory where the mscgen tool resides. If left empty the tool is assumed to # be found in the default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES # then doxygen will generate a call dependency graph for every global # function or class method. Note that enabling this option will # significantly increase the time of a run. So in most cases it will # be better to enable call graphs for selected functions only using the # \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to # YES then doxygen will generate a caller dependency graph for every # global function or class method. Note that enabling this option will # significantly increase the time of a run. So in most cases it will # be better to enable caller graphs for selected functions only using # the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the number # of direct children of the root node in a graph is already larger than # MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 6 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, which results in a white background. # Warning: Depending on the platform used, enabling this option may lead to # badly anti-aliased labels on the edges of a graph (i.e. they become hard to # read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO ImageVis3D-3.1.0/notdebian/0000755000175000017500000000000012320517543015225 5ustar mathieumathieuImageVis3D-3.1.0/notdebian/dirs0000644000175000017500000000001012320517543016100 0ustar mathieumathieuusr/bin ImageVis3D-3.1.0/notdebian/copyright0000644000175000017500000000071712320517543017165 0ustar mathieumathieuThis package was debianized by Tom Fogal on Tue, 19 May 2009 13:34:29 -0600. It was downloaded from https://gforge.sci.utah.edu/svn/imagevis3d Upstream Authors: Tom Fogal Jens Krueger Copyright: Copyright (C) 2008-2009 SCI Institute License: MIT The Debian packaging is (C) 2009, Tom Fogal and is licensed under the GPL, see `/usr/share/common-licenses/GPL'. ImageVis3D-3.1.0/notdebian/menu0000644000175000017500000000017312320517543016115 0ustar mathieumathieu?package(imagevis3d):needs="X11|vc|wm" section="Science/Data Analysis"\ title="ImageVis3D" command="/usr/bin/imagevis3d" ImageVis3D-3.1.0/notdebian/control0000644000175000017500000000224512320517543016633 0ustar mathieumathieuSource: imagevis3d Section: x11 Priority: optional Maintainer: Thomas Fogal Build-Depends: debhelper (>= 7), bison, flex, libqt4-dev, qt4-dev-tools, libqt4-opengl-dev, zlib1g-dev, libbz2-dev Standards-Version: 3.8.0 Homepage: http://www.imagevis3d.org/ Package: imagevis3d Architecture: any Depends: ${shlibs:Depends}, libqtcore4, libqtgui4, libqt4-opengl, libqt4-network, zlib1g, libbz2 Description: desktop volume rendering application for large data ImageVis3D is a volume rendering application specifically designed to render large data. This is achieved by splitting the dataset into multiple levels of detail (LoD), with each level itself decomposed into multiple bricks (atomic rendering primitive). Interaction occurs at the coarsest LoD, which can be rendered instantaneously on almost all modern systems. After a configurable delay, ImageVis3D will successively render finer levels of detail, until the data are visible at their native resolution. . Development of ImageVis3D is sponsored by the NIH/NCRR Center for Integrative Biomedical Computing (CIBC), and the DOE Visualization And Analytics Center for Enabling Technologies (VACET). ImageVis3D-3.1.0/notdebian/watch0000644000175000017500000000023212320517543016253 0ustar mathieumathieuversion=3 # Site Directory Pattern Version Script software.sci.utah.edu / ImageVis3D-(.*)\.tar.gz debian uupdate ImageVis3D-3.1.0/notdebian/README.Debian0000644000175000017500000000044312320517543017267 0ustar mathieumathieuimagevis3d for Debian --------------------- The builtin autoupdate feature will at best not work, and at worst be unreliable, using the Debianized version of ImageVis3D. Use your package manager to manage new versions. -- Tom Fogal Tue, 19 May 2009 13:34:29 -0600 ImageVis3D-3.1.0/notdebian/changelog0000644000175000017500000000234712320517543017105 0ustar mathieumathieuimagevis3d (2.1.1-1.0) unstable; urgency=low * Non-maintainer upload. * New upstream release. -- Thomas Fogal Mon, 20 Aug 2012 18:03:56 -0600 imagevis3d (2.1.0-1.0) unstable; urgency=low * Non-maintainer upload. * New upstream release. -- Thomas Fogal Thu, 12 Jul 2012 15:42:21 -0600 imagevis3d (1.1.1-1.0) unstable; urgency=low * Non-maintainer upload. * New upstream release. -- Thomas Fogal Fri, 26 Jun 2009 17:42:33 -0600 imagevis3d (1.1-1.0) unstable; urgency=low * Non-maintainer upload. * New upstream release. -- Thomas Fogal Sat, 06 Jun 2009 16:49:49 -0600 imagevis3d (1.0-1.1) unstable; urgency=low * Non-maintainer upload. * New upstream release. -- Thomas Fogal Fri, 29 May 2009 17:34:41 -0600 imagevis3d (1.0rc1-1.1) unstable; urgency=low * Non-maintainer upload. * Fixed some typos in the long description. -- Thomas Fogal Tue, 26 May 2009 19:35:50 -0600 imagevis3d (1.0rc1-1.0) unstable; urgency=low * Non-maintainer upload. * Initial release (Closes: #530666) -- Thomas Fogal Tue, 19 May 2009 13:34:29 -0600 ImageVis3D-3.1.0/notdebian/imagevis3d.substvars0000644000175000017500000000036612320517543021243 0ustar mathieumathieushlibs:Depends=libc6 (>= 2.7-1), libgcc1 (>= 1:4.1.1), libgl1-mesa-glx | libgl1, libglu1-mesa | libglu1, libqt4-network (>= 4.4.3), libqt4-opengl (>= 4.4.3), libqtcore4 (>= 4.4.3), libqtgui4 (>= 4.4.3), libstdc++6 (>= 4.1.1), zlib1g (>= 1:1.1.4) ImageVis3D-3.1.0/notdebian/compat0000644000175000017500000000000212320517543016423 0ustar mathieumathieu7 ImageVis3D-3.1.0/notdebian/rules0000755000175000017500000000643712320517543016317 0ustar mathieumathieu#!/usr/bin/make -f # -*- makefile -*- # Sample debian/rules that uses debhelper. # This file was originally written by Joey Hess and Craig Small. # As a special exception, when this file is copied by dh-make into a # dh-make output file, you may use that output file without restriction. # This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 TARFILE=imagevis3d_2.0.0~svn$(shell date +%Y%m%d).orig.tar.gz DESTDIR=$(CURDIR)/debian/imagevis3d configure: configure-stamp configure-stamp: dh_testdir # Add here commands to configure the package. FLAGS="-fno-strict-aliasing -U_DEBUG -DNDEBUG -QT_SHARED -DDEBIAN" FLAGS="$(FLAGS) -DPACKAGE_MANAGER" qmake QMAKE_CONFIG=release \ QMAKE_CFLAGS+="$(FLAGS)" \ QMAKE_CXXFLAGS+="$(FLAGS)" \ CONFIG+="release" \ -recursive \ -spec linux-g++ || (echo "qmake failed" && exit 1) mkdir -p Build/objects Tuvok/Build/objects ImageVis3D/UI/AutoGen touch configure-stamp build: build-stamp build-stamp: configure-stamp dh_testdir # Add here commands to compile the package. $(MAKE) touch $@ clean: dh_testdir dh_testroot rm -f build-stamp configure-stamp # Needs to work even with initial checkout, which might not have makefiles. test -f Makefile || qmake # Add here commands to clean up after the build process. $(MAKE) clean # qmake is pretty awesome; `clean' isn't really clean. rm -f Build/ImageVis3D \ Tuvok/Build/libTuvok.a \ ExtractDebugInfo/Build/ExtractDebugInfo \ CmdLineConverter/Build/uvfconvert dh_clean install: build dh_testdir dh_testroot dh_prep dh_installdirs # Add here commands to install the package into debian/imagevis3d. $(MAKE) DESTDIR=$(CURDIR)/debian/imagevis3d install # qmake's default `make install' appears to do nothing. install -s Build/ImageVis3D $(CURDIR)/debian/imagevis3d/usr/bin/imagevis3d gzip -9c doc/imagevis3d.1 > doc/imagevis3d.1.gz mkdir -p $(CURDIR)/debian/imagevis3d/usr/share/man/man1 install doc/imagevis3d.1.gz $(CURDIR)/debian/imagevis3d/usr/share/man/man1 mkdir -p $(CURDIR)/debian/imagevis3d/usr/share/imagevis3d/shaders install --mode 644 Tuvok/Shaders/* $(DESTDIR)/usr/share/imagevis3d/shaders install -s CmdLineConverter/Build/uvfconvert \ $(CURDIR)/debian/imagevis3d/usr/bin/uvfconvert gzip -9c doc/uvfconvert.1 > doc/uvfconvert.1.gz install doc/uvfconvert.1.gz $(CURDIR)/debian/imagevis3d/usr/share/man/man1 get-orig-source: svn export https://gforge.sci.utah.edu/svn/imagevis3d (cd ../ && \ tar zcf $(TARFILE) imagevis3d) rm -fr imagevis3d # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. # Build architecture-dependent files here. binary-arch: build install dh_testdir dh_testroot dh_installchangelogs dh_installdocs dh_installexamples # dh_install # dh_installmenu # dh_installdebconf # dh_installlogrotate # dh_installemacsen # dh_installpam # dh_installmime # dh_python # dh_installinit # dh_installcron # dh_installinfo dh_installman dh_link dh_strip dh_compress dh_fixperms # dh_perl # dh_makeshlibs dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install configure ImageVis3D-3.1.0/BatchRenderer/0000755000175000017500000000000012320517543015772 5ustar mathieumathieuImageVis3D-3.1.0/BatchRenderer/BatchContext.cpp0000644000175000017500000000626312320517543021073 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file batchContext.cpp \author Tom Fogal SCI Institute University of Utah \brief Establishes an OpenGL context. */ #include #include #include #include "Renderer/GL/GLStateManager.h" #include "BatchContext.h" #include "CGLContext.h" #include "GLXContext.h" #include "WGLContext.h" #include "NSContext.h" namespace tuvok { BatchContext::BatchContext() : Context(0) // Tuvok specific { ctx = nullptr; // Tuvok specific } BatchContext* BatchContext::Create(uint32_t width, uint32_t height, uint8_t color_bits, uint8_t depth_bits, uint8_t stencil_bits, bool double_buffer, bool visible) { BatchContext* bctx; #ifdef DETECTED_OS_WINDOWS bctx = new WGLContext(width, height, color_bits, depth_bits, stencil_bits, double_buffer, visible); #elif defined(DETECTED_OS_APPLE) && defined(USE_CGL) bctx = new CGLContext(width, height, color_bits, depth_bits, stencil_bits, double_buffer, visible); #elif defined(DETECTED_OS_APPLE) bctx = new NSContext(width, height, color_bits, depth_bits, stencil_bits, double_buffer, visible); #else bctx = new GLXBatchContext(width, height, color_bits, depth_bits, stencil_bits, double_buffer, visible); #endif if (bctx->makeCurrent() == false) std::cerr << "Unable to make context current!" << std::endl; GLenum glerr = glewInit(); if (GLEW_OK != glerr) { std::cerr << "Error initializing GLEW: " << glewGetErrorString(glerr) << "\n"; throw std::runtime_error("could not initialize GLEW."); } // Tuvok specific bctx->m_pState = std::shared_ptr(new GLStateManager()); // Tuvok specific (this is really bad, but no one uses the pointer to the // context anyways...). bctx->ctx = (const void*)bctx; return bctx; } } ImageVis3D-3.1.0/BatchRenderer/NSContext.mm0000644000175000017500000000716712320517543020225 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /// \author James Hughes /// \date December 2012 #include "NSContext.h" #include #import #import namespace tuvok { // Simple error reporting macros #define REPORTGLERROR(task) { GLenum tGLErr = glGetError(); if (tGLErr != GL_NO_ERROR) { std::cout << "OpenGL error " << tGLErr << " while " << task << "\n"; } } #define REPORT_ERROR_AND_EXIT(desc) { std::cout << desc << "\n"; return; } #define NULL_ERROR_EXIT(test, desc) { if (!test) REPORT_ERROR_AND_EXIT(desc); } struct NSContextInfo { NSOpenGLContext* openGLContext; }; //------------------------------------------------------------------------------ NSContext::NSContext( uint32_t, uint32_t, uint8_t colorBits, uint8_t depthBits, uint8_t, bool doubleBuffer, bool) : mCI(new NSContextInfo) { // On screen doesn't matter, we will be using an FBO anyways. NSOpenGLPixelFormatAttribute attributes[] = { NSOpenGLPFAAccelerated, // 'on screen' accelerated. NSOpenGLPFANoRecovery, // Do not fall back to sw. NSOpenGLPFAColorSize, colorBits, NSOpenGLPFADepthSize, depthBits, NSOpenGLPFAAlphaSize, 8, doubleBuffer ? NSOpenGLPFADoubleBuffer : (NSOpenGLPixelFormatAttribute)0, (NSOpenGLPixelFormatAttribute) 0 }; NSOpenGLPixelFormat* pixFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes] autorelease]; // Create the OpenGL context to render with (with color and depth buffers) mCI->openGLContext = [[NSOpenGLContext alloc] initWithFormat:pixFormat shareContext:nil]; if (mCI->openGLContext == NULL) { std::cerr << "Unable to create NSOpenGLContext.\n"; throw std::runtime_error("NS context error."); } } //------------------------------------------------------------------------------ NSContext::~NSContext() { [mCI->openGLContext clearDrawable]; [mCI->openGLContext release]; } //------------------------------------------------------------------------------ bool NSContext::isValid() const { return (mCI->openGLContext != NULL); } //------------------------------------------------------------------------------ bool NSContext::makeCurrent() { [mCI->openGLContext makeCurrentContext]; return [NSOpenGLContext currentContext] == mCI->openGLContext; } //------------------------------------------------------------------------------ bool NSContext::swapBuffers() { return false; } } // end namespace tuvok ImageVis3D-3.1.0/BatchRenderer/main.cpp0000644000175000017500000000736712320517543017437 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /// Simple batch renderer using Tuvok. /// This file is dead simple as most of the logic resides in Lua files. #include #include #include "GLEW/GL/glew.h" #include "tclap/CmdLine.h" #include "LuaScripting/LuaScripting.h" #include "LuaScripting/TuvokSpecific/LuaTuvokTypes.h" #include "Controller/Controller.h" #include "Controller/MasterController.h" #include "BatchContext.h" #include "TuvokLuaScriptExec.h" using namespace std; using namespace tuvok; std::shared_ptr createContext(uint32_t width, uint32_t height, int32_t color_bits, int32_t depth_bits, int32_t stencil_bits, bool double_buffer, bool visible) { std::shared_ptr ctx( BatchContext::Create(width,height, color_bits,depth_bits,stencil_bits, double_buffer,visible)); if(!ctx->isValid() || ctx->makeCurrent() == false) { std::cerr << "Could not utilize context."; return std::shared_ptr(); } return ctx; } int main(int argc, const char* argv[]) { // Read Lua filename from the first program argument std::string filename; bool debug = false; try { TCLAP::CmdLine cmd("Lua batch renderer"); TCLAP::ValueArg luaFile("f", "script", "Script to execute.", true, "", "filename"); TCLAP::SwitchArg dbg("g", "debug", "Enable debugging mode", false); cmd.add(luaFile); cmd.add(dbg); cmd.parse(argc, argv); filename = luaFile.getValue(); debug = dbg.getValue(); } catch (const TCLAP::ArgException& e) { std::cerr << "Error: " << e.error() << " for arg " << e.argId() << std::endl; return EXIT_FAILURE; } if(debug) { Controller::Instance().DebugOut()->SetOutput(true, true, true, true); } else { Controller::Instance().DebugOut()->SetOutput(true, true, false, false); } try { // Register context creation function std::shared_ptr ss = Controller::Instance().LuaScript(); /// \todo Investigate why we can't use lambdas in function regisrtation. ss->registerFunction(createContext, "tuvok.createContext", "Creates a rendering context and returns it.", false); TuvokLuaScriptExec luaExec; luaExec.execFile(filename); } catch(const std::exception& e) { std::cerr << "Exception: " << e.what() << "\n"; return EXIT_FAILURE; } } ImageVis3D-3.1.0/BatchRenderer/TuvokLuaScriptExec.cpp0000644000175000017500000000561112320517543022245 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /// \author James Hughes /// \date November 2012 #include #include #include #include #include "TuvokLuaScriptExec.h" #include "Controller/Controller.h" #include "Controller/MasterController.h" namespace tuvok { //------------------------------------------------------------------------------ TuvokLuaScriptExec::TuvokLuaScriptExec() { // Register context creation function. } //------------------------------------------------------------------------------ TuvokLuaScriptExec::~TuvokLuaScriptExec() { } //------------------------------------------------------------------------------ void TuvokLuaScriptExec::execFile(const std::string& filename) { std::shared_ptr ss = Controller::Instance().LuaScript(); // Execute entire file in Lua. try { lua_State* L = ss->getLuaState(); luaL_loadfile(L, filename.c_str()); const int err = lua_pcall(L, 0, LUA_MULTRET, 0); switch(err) { case 0: /* success. */ break; case LUA_ERRRUN: std::cerr << "Error interpreting file: " << filename << std::endl; if (lua_gettop(L) != 0 && lua_isstring(L, lua_gettop(L))) std::cerr << "Error: " << lua_tostring(L, lua_gettop(L)) << std::endl; break; case LUA_ERRMEM: std::cerr << "Memory allocation error.\n"; break; case LUA_ERRERR: std::cerr << "Error running Lua error function(?!)\n"; break; default: std::cerr << "Unknown Lua error (" << err << ").\n"; break; } } catch (...) { // If an exception occurred in Lua, the description will be fairly verbose. throw; } } } // end of namespace tuvok ImageVis3D-3.1.0/BatchRenderer/testNSContext.mm0000644000175000017500000000374412320517543021122 0ustar mathieumathieu// clang++ testNSContext.mm -o testNSContext -framework Cocoa -framework OpenGL // When building the batch renderer project with qmake, I found that the // OpenGL context was only usable with explicit context declaration // through CGMacros and ctx_obj. This file helps eliminate makefile // variables. // As it turns out, this is something related to the settings in qmake... #include #import #import // Simple error reporting macros to help keep the sample code clean #define REPORTGLERROR(task) { GLenum tGLErr = glGetError(); if (tGLErr != GL_NO_ERROR) { std::cout << "OpenGL error " << tGLErr << " while " << task << "\n"; } } #define REPORT_ERROR_AND_EXIT(desc) { std::cout << desc << "\n"; return 1; } #define NULL_ERROR_EXIT(test, desc) { if (!test) REPORT_ERROR_AND_EXIT(desc); } int main (int argc, char * const argv[]) { NSOpenGLPixelBuffer* pixBuf; NSOpenGLContext* openGLContext; NSOpenGLPixelFormatAttribute attributes[] = { NSOpenGLPFANoRecovery, NSOpenGLPFAAccelerated, NSOpenGLPFADepthSize, 24, (NSOpenGLPixelFormatAttribute) 0 }; NSOpenGLPixelFormat* pixFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes] autorelease]; // OpenGL context openGLContext = [[NSOpenGLContext alloc] initWithFormat:pixFormat shareContext:nil]; NULL_ERROR_EXIT(openGLContext, "Unable to create NSOpenGLContext"); [openGLContext makeCurrentContext]; // Test very basic calls to OpenGL const GLubyte* vendor = glGetString(GL_VENDOR); const GLubyte* renderer = glGetString(GL_RENDERER); const GLubyte* versionl = glGetString(GL_VERSION); if (vendor && renderer && versionl) std::cerr << "OpenGL initialization. Running on a " << vendor << " " << renderer << " with OpenGL version " << versionl << std::endl; else std::cerr << "Unable to obtain OpenGL strings." << std::endl; // Cleanup [openGLContext clearDrawable]; [openGLContext release]; return 0; } ImageVis3D-3.1.0/BatchRenderer/BatchContext.h0000644000175000017500000000463112320517543020535 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file batchContext.cpp \author Tom Fogal SCI Institute University of Utah \brief Simple wrapper for establishing an OpenGL context. */ #ifndef BATCH_RENDERER_CONTEXT_H #define BATCH_RENDERER_CONTEXT_H #include #include "Renderer/Context.h" // Tuvok specific namespace tuvok { class BatchContext : public Context // Tuvok specific { public: /// This virtual constructor will create the appropriate context based /// on the current operating system. static BatchContext* Create(uint32_t width, uint32_t height, uint8_t color_bits=32, uint8_t depth_bits=24, uint8_t stencil_bits=8, bool double_buffer=true, bool visible=false); virtual ~BatchContext() {} virtual bool isValid() const=0; virtual bool makeCurrent()=0; virtual bool swapBuffers()=0; protected: BatchContext(); }; class NoAvailableContext : public std::exception { public: virtual ~NoAvailableContext() throw() {} virtual const char* what() const throw() { return "No context was available to utilize."; } }; } #endif // BATCH_RENDERER_CONTEXT_H ImageVis3D-3.1.0/BatchRenderer/TuvokLuaScriptExec.h0000644000175000017500000000344012320517543021710 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /// \author James Hughes /// \date November 2012 #ifndef BATCHRENDERER_TUVOKLUASCRIPTEXEC_H #define BATCHRENDERER_TUVOKLUASCRIPTEXEC_H #include #include #include "LuaScripting/LuaScripting.h" #include "BatchContext.h" namespace tuvok { /// Simple class to execute a Lua script given a rendering context. class TuvokLuaScriptExec { public: TuvokLuaScriptExec(); virtual ~TuvokLuaScriptExec(); /// Executes the file given by the parameter 'filename'. void execFile(const std::string& filename); private: }; } // namespace tuvok #endif ImageVis3D-3.1.0/BatchRenderer/WGLContext.cpp0000644000175000017500000001467412320517543020510 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file WGLContext.cpp \author Tom Fogal SCI Institute University of Utah \brief Establishes an OpenGL context on windows. */ #ifdef DETECTED_OS_WINDOWS # include # include # include #else # include #endif #include "WGLContext.h" #include namespace tuvok { struct winfo { HDC deviceContext; HGLRC renderingContext; HWND window; }; static void outputLastError() { DWORD lastError = GetLastError(); LPVOID msgBuffer; FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, lastError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&msgBuffer, 0, NULL ); T_ERROR("Win32 error: %s", std::string((LPSTR)msgBuffer)); LocalFree(msgBuffer); } WGLContext::WGLContext(uint32_t w, uint32_t h, uint8_t color_bits, uint8_t depth_bits, uint8_t stencil_bits, bool double_buffer, bool visible) : wi(new struct winfo()) { wi->deviceContext = NULL; wi->renderingContext = NULL; wi->window = NULL; if(w == 0 || h == 0 || !(color_bits==8 || color_bits==16 || color_bits==24 || color_bits==32) || !(depth_bits==8 || depth_bits==16 || depth_bits==24 || depth_bits==32 || depth_bits==0) || !(stencil_bits == 0 || stencil_bits == 8)) { T_ERROR("Invalid parameters passed to constructor."); throw NoAvailableContext(); } wi->window = CreateWindowExW(WS_EX_TOOLWINDOW, L"Static", L"GLContextWindow", WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN , 0, 0, w, h, 0, 0, GetModuleHandle(NULL), 0); if (!wi->window) { outputLastError(); return; } if(visible) { ShowWindow(wi->window, SW_SHOW); } else { ShowWindow(wi->window, SW_HIDE); } wi->deviceContext = GetDC(wi->window); if(!wi->deviceContext) { // GetDC doesn't SetLastError, but this still works anyway... outputLastError(); DestroyWindow(wi->window); throw NoAvailableContext(); } PIXELFORMATDESCRIPTOR pfd; pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); pfd.nVersion = 1; pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_TYPE_RGBA; if (double_buffer) pfd.dwFlags |= PFD_DOUBLEBUFFER; pfd.iPixelType = PFD_TYPE_RGBA; pfd.cColorBits = color_bits; pfd.cRedBits = 0; pfd.cRedShift = 0; pfd.cGreenBits = 0; pfd.cGreenShift = 0; pfd.cBlueBits = 0; pfd.cBlueShift = 0; pfd.cAlphaBits = 0; pfd.cAlphaShift = 0; pfd.cAccumBits = 0; pfd.cAccumRedBits = 0; pfd.cAccumGreenBits = 0; pfd.cAccumBlueBits = 0; pfd.cAccumAlphaBits = 0; pfd.cDepthBits = depth_bits; pfd.cStencilBits = stencil_bits; pfd.cAuxBuffers = 0; pfd.iLayerType = PFD_MAIN_PLANE; pfd.bReserved = 0; pfd.dwLayerMask = 0; pfd.dwVisibleMask = 0; pfd.dwDamageMask = 0; int pixelFormat = ChoosePixelFormat(wi->deviceContext, &pfd); if (!pixelFormat) { outputLastError(); ReleaseDC(wi->window, wi->deviceContext); DestroyWindow(wi->window); throw NoAvailableContext(); } PIXELFORMATDESCRIPTOR pfdResult; DescribePixelFormat(wi->deviceContext, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfdResult); if (!(pfdResult.dwFlags & PFD_SUPPORT_OPENGL)) { T_ERROR("No OpenGL support."); ReleaseDC(wi->window, wi->deviceContext); DestroyWindow(wi->window); throw NoAvailableContext(); } if (double_buffer && !(pfdResult.dwFlags & PFD_DOUBLEBUFFER)) { WARNING("No double buffer support!"); } std::ostringstream ss; if (pfdResult.cColorBits != color_bits) { ss << "Color bits requested: " << color_bits << ", actual color bits: " << pfdResult.cColorBits << "\n"; } if (pfdResult.cDepthBits != depth_bits) { ss << "Depth bits requested " << depth_bits << ", actual depth bits: " << pfdResult.cDepthBits << "\n"; } if (pfdResult.cStencilBits != stencil_bits) { ss << "Stencil bits requested " << stencil_bits << ", actual stencil bits:" << pfdResult.cStencilBits << "\n"; } MESSAGE("%s", ss.str().c_str()); if (!SetPixelFormat(wi->deviceContext, pixelFormat, &pfd)) { outputLastError(); ReleaseDC(wi->window, wi->deviceContext); DestroyWindow(wi->window); throw NoAvailableContext(); } wi->renderingContext = wglCreateContext(wi->deviceContext); if (!wi->renderingContext) { outputLastError(); ReleaseDC(wi->window, wi->deviceContext); DestroyWindow(wi->window); throw NoAvailableContext(); } makeCurrent(); } WGLContext::~WGLContext() { wglDeleteContext(wi->renderingContext); ReleaseDC(wi->window, wi->deviceContext); DestroyWindow(wi->window); } bool WGLContext::isValid() const { // Object would not be created otherwise (throw in constructor) return true; } bool WGLContext::makeCurrent() { if(!wglMakeCurrent(wi->deviceContext, wi->renderingContext)) { outputLastError(); return false; } return true; } bool WGLContext::swapBuffers() { if(!isValid()) { return false; } if(!SwapBuffers(wi->deviceContext)) { outputLastError(); return false; } return true; } } /* tuvok namespace */ ImageVis3D-3.1.0/BatchRenderer/NSContext.h0000644000175000017500000000353112320517543020032 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /// \author James Hughes /// \date December 2012 #ifndef BATCHRENDERER_NSCONTEXT_H #define BATCHRENDERER_NSCONTEXT_H #include #include "BatchContext.h" namespace tuvok { struct NSContextInfo; /// Uses Objective-C to obtain a context. class NSContext : public BatchContext { public: NSContext(uint32_t w, uint32_t h, uint8_t colorBits, uint8_t depthBits, uint8_t stencilBits, bool doubleBuffer, bool visible); virtual ~NSContext(); bool isValid() const; bool makeCurrent(); bool swapBuffers(); private: std::shared_ptr mCI; }; } // namespace tuvok #endif ImageVis3D-3.1.0/BatchRenderer/GLXContext.cpp0000644000175000017500000001303412320517543020476 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include "GLXContext.h" #include "Controller/Controller.h" namespace tuvok { struct xinfo { Display *display; XVisualInfo *visual; Window win; GLXContext ctx; Colormap cmap; }; static struct xinfo x_connect(uint32_t, uint32_t, bool, bool); static XVisualInfo* find_visual(Display*, bool); static void glx_init(Display*, XVisualInfo*, GLXContext&); GLXBatchContext::GLXBatchContext(uint32_t w, uint32_t h, uint8_t, uint8_t, uint8_t, bool double_buffer, bool visible) : xi(new struct xinfo()) { #ifndef NDEBUG // Enable X debugging. _Xdebug = 1; #endif // if you *really* require a specific value... just hack this class // to your liking. You probably want to add those parameters to x_connect // and use them there. WARNING("Ignoring color, depth, stencil bits. For many applications, it " "is better to let the GLX library choose the \"best\" visual."); *this->xi = x_connect(w, h, double_buffer, visible); glx_init(xi->display, xi->visual, xi->ctx); this->makeCurrent(); MESSAGE("Current context: %p", glXGetCurrentContext()); } GLXBatchContext::~GLXBatchContext() { glXDestroyContext(xi->display, xi->ctx); XDestroyWindow(xi->display, xi->win); XFree(xi->visual); XCloseDisplay(xi->display); xi.reset(); } bool GLXBatchContext::isValid() const { return this->xi->display != NULL && this->xi->ctx != NULL; } bool GLXBatchContext::makeCurrent() { if(glXMakeCurrent(this->xi->display, this->xi->win, this->xi->ctx) != True) { T_ERROR("Could not make context current!"); return false; } return true; } bool GLXBatchContext::swapBuffers() { glXSwapBuffers(this->xi->display, this->xi->win); // SwapBuffers generates an X error if it fails. return true; } static struct xinfo x_connect(uint32_t width, uint32_t height, bool dbl_buffer, bool visible) { struct xinfo rv; rv.display = XOpenDisplay(NULL); if(rv.display == NULL) { T_ERROR("Could not connect to display: '%s'!", XDisplayName(NULL)); throw NoAvailableContext(); } XSynchronize(rv.display, True); rv.visual = find_visual(rv.display, dbl_buffer); Window parent = RootWindow(rv.display, rv.visual->screen); XSetWindowAttributes xw_attr; xw_attr.override_redirect = False; xw_attr.background_pixel = 0; xw_attr.colormap = XCreateColormap(rv.display, parent, rv.visual->visual, AllocNone); xw_attr.event_mask = StructureNotifyMask | ExposureMask; // X will create BadValue exceptions if these aren't true... much easier to // debug via asserts. assert(rv.visual->depth > 0); assert(width > 0); assert(height > 0); rv.win = XCreateWindow(rv.display, parent, 0,0, width,height, 0, rv.visual->depth, InputOutput, rv.visual->visual, CWBackPixel | CWBorderPixel | CWColormap | CWOverrideRedirect | CWEventMask, &xw_attr); XStoreName(rv.display, rv.win, "Tuvok"); if(visible) { if(XMapRaised(rv.display, rv.win) != 0) { T_ERROR("Could not map window!"); throw std::runtime_error("could not map window"); } } XSync(rv.display, False); return rv; } static void glx_init(Display *disp, XVisualInfo *visual, GLXContext& ctx) { if(!glXQueryExtension(disp, NULL, NULL)) { T_ERROR("Display does not support glX."); return; } ctx = glXCreateContext(disp, visual, 0, GL_TRUE); if(!ctx) { T_ERROR("glX Context creation failed."); } } static XVisualInfo * find_visual(Display *d, bool double_buffered) { XVisualInfo *ret_v; // GLX_USE_GL is basically a no-op, so this provides a convenient // way of specifying double buffering or not. int att_buf = double_buffered ? GLX_DOUBLEBUFFER : GLX_USE_GL; int attr[] = { GLX_RGBA, att_buf, GLX_RED_SIZE, 5, GLX_GREEN_SIZE, 6, GLX_BLUE_SIZE, 5, GLX_ALPHA_SIZE, 8, GLX_DEPTH_SIZE, 8, GLX_ACCUM_RED_SIZE, 0, GLX_ACCUM_GREEN_SIZE, 0, GLX_ACCUM_BLUE_SIZE, 0, None }; ret_v = glXChooseVisual(d, DefaultScreen(d), attr); MESSAGE("ChooseVisual got us %p", (const void*)ret_v); return ret_v; } } // namespace tuvok ImageVis3D-3.1.0/BatchRenderer/WGLContext.h0000644000175000017500000000366012320517543020146 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file WGLContext.cpp \author Tom Fogal SCI Institute University of Utah \brief Establishes an OpenGL context on windows. */ #ifndef TUVOK_WGL_CONTEXT_H #define TUVOK_WGL_CONTEXT_H #include #include "BatchContext.h" namespace tuvok { struct winfo; class WGLContext : public BatchContext { public: WGLContext(uint32_t w, uint32_t h, uint8_t color_bits, uint8_t depth_bits, uint8_t stencil_bits, bool double_buffer, bool visible); virtual ~WGLContext(); bool isValid() const; bool makeCurrent(); bool swapBuffers(); private: std::shared_ptr wi; }; } #endif /* TUVOK_WGL_CONTEXT_H */ ImageVis3D-3.1.0/BatchRenderer/CGLContext.h0000644000175000017500000000343512320517543020122 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef TUVOK_CGL_CONTEXT_H #define TUVOK_CGL_CONTEXT_H #include #include "BatchContext.h" namespace tuvok { struct CGLContextInfo; class CGLContext : public BatchContext { public: CGLContext(uint32_t w, uint32_t h, uint8_t color_bits, uint8_t depth_bits, uint8_t stencil_bits, bool double_buffer, bool visible); virtual ~CGLContext(); bool isValid() const; bool makeCurrent(); bool swapBuffers(); private: std::shared_ptr ci; }; } #endif /* TUVOK_CGL_CONTEXT_H */ ImageVis3D-3.1.0/BatchRenderer/GLXContext.h0000644000175000017500000000341412320517543020144 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef TUVOK_GLX_CONTEXT_H #define TUVOK_GLX_CONTEXT_H #include #include "BatchContext.h" namespace tuvok { struct xinfo; class GLXBatchContext: public BatchContext { public: GLXBatchContext(uint32_t w, uint32_t h, uint8_t color_bits, uint8_t depth_bits, uint8_t stencil_bits, bool double_buffer, bool visible); virtual ~GLXBatchContext(); bool isValid() const; bool makeCurrent(); bool swapBuffers(); private: std::shared_ptr xi; }; } #endif /* TUVOK_GLX_CONTEXT_H */ ImageVis3D-3.1.0/BatchRenderer/BatchRenderer.pro0000644000175000017500000000530012320517543021222 0ustar mathieumathieuTEMPLATE = app CONFIG += exceptions qt rtti staticlib static stl warn_on TARGET = BatchRenderer DEPENDPATH = . INCLUDEPATH = . ../Tuvok \ INCLUDEPATH += ../Tuvok/3rdParty INCLUDEPATH += ../Tuvok/Basics/3rdParty INCLUDEPATH += ../Tuvok/3rdParty/GLEW INCLUDEPATH += ../Tuvok/IO/3rdParty/boost/ QMAKE_LIBDIR += ../Tuvok/Build ../Tuvok/IO/expressions QT += opengl LIBS += -lTuvok -ltuvokexpr -lz !macx:unix:QMAKE_LFLAGS += -fopenmp # Operating system definitions now in the makefile instead of # a header file. unix:!macx { DEFINES += "DETECTED_OS_LINUX" } macx { DEFINES += "DETECTED_OS_APPLE" } win32 { DEFINES += "DETECTED_OS_WINDOWS" } #### # General unix configuration (including Mac OS X). #### unix:QMAKE_CXXFLAGS += -fno-strict-aliasing -g -std=c++0x unix:QMAKE_CFLAGS += -fno-strict-aliasing -g #### # Non-OSX Unix configuration #### # Note: Do NOT specific the GL linker flag (-lGL) on Mac! unix:!macx:LIBS += -lGL -lX11 -lGLU # Try to link to GLU statically. gludirs = /usr/lib /usr/lib/x86_64-linux-gnu for(d, gludirs) { if(exists($${d}/libGLU.a) && static) { LIBS -= -lGLU; LIBS += $${d}/libGLU.a } } #### # Mac OS X configuration #### macx:QMAKE_CXXFLAGS += -mmacosx-version-min=10.7 -stdlib=libc++ macx:QMAKE_OBJECTIVE_CFLAGS += -mmacosx-version-min=10.7 -std=c++0x -stdlib=libc++ macx:QMAKE_CFLAGS += -mmacosx-version-min=10.7 macx:LIBS += -mmacosx-version-min=10.7 -stdlib=libc++ -framework Cocoa -framework OpenGL macx:CONFIG -= app_bundle macx:INCLUDEPATH += /usr/X11R6/include macx:QMAKE_LIBDIR += /usr/X11R6/lib ### Should we link Qt statically or as a shared lib? # Find the location of QtCore`s prl file, and include it here so we can look at # the QMAKE_PRL_CONFIG variable. TEMP = $$[QT_INSTALL_LIBS] libQtCore.prl PRL = $$[QT_INSTALL_LIBS] QtCore.framework/QtCore.prl TEMP = $$join(TEMP, "/") PRL = $$join(PRL, "/") exists($$TEMP) { include($$join(TEMP, "/")) } exists($$PRL) { include($$join(PRL, "/")) } # If that contains the `shared` configuration, the installed Qt is shared. # In that case, disable the image plugins. contains(QMAKE_PRL_CONFIG, shared) { QTPLUGIN -= qgif qjpeg } else { QTPLUGIN += qgif qjpeg } SOURCES += \ main.cpp \ BatchContext.cpp \ TuvokLuaScriptExec.cpp unix:!macx { SOURCES += GLXContext.cpp } macx { SOURCES += CGLContext.cpp } macx { OBJECTIVE_SOURCES += NSContext.mm } win32 { SOURCES += WGLContext.cpp } HEADERS += \ BatchContext.h \ CGLContext.h \ NSContext.h \ GLXContext.h \ WGLContext.h \ TuvokLuaScriptExec.h ImageVis3D-3.1.0/BatchRenderer/CGLContext.cpp0000644000175000017500000000653212320517543020456 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include #include #include "CGLContext.h" namespace tuvok { struct CGLContextInfo { CGLContextObj ctx; }; CGLContext::CGLContext(uint32_t, uint32_t, uint8_t color_bits, uint8_t depth_bits, uint8_t stencil_bits, bool double_buffer, bool) : ci(new struct CGLContextInfo()) { CGLPixelFormatAttribute attribs[] = { kCGLPFAAccelerated, kCGLPFANoRecovery, // Do not fall back to software. kCGLPFAColorSize, static_cast(color_bits), kCGLPFAAlphaSize, static_cast(8), kCGLPFADepthSize, static_cast(depth_bits), kCGLPFAStencilSize, static_cast(stencil_bits), double_buffer ? kCGLPFADoubleBuffer : static_cast(0), static_cast(NULL) }; int nscreens; CGLPixelFormatObj pix; CGLError glerr = CGLChoosePixelFormat(attribs, &pix, &nscreens); if (glerr != kCGLNoError) { std::cerr << "CGL pixel format error: " << static_cast(glerr); throw std::runtime_error("CGL error."); } glerr = CGLCreateContext(pix, NULL, &ci->ctx); if (glerr != kCGLNoError) { std::cerr << "CGL ctx creation error: %d" << static_cast(glerr); throw std::runtime_error("CGL error."); } CGLDestroyPixelFormat(pix); } //------------------------------------------------------------------------------ CGLContext::~CGLContext() { CGLReleaseContext(ci->ctx); } //------------------------------------------------------------------------------ bool CGLContext::isValid() const { return ci->ctx != NULL; } //------------------------------------------------------------------------------ bool CGLContext::makeCurrent() { return CGLSetCurrentContext(ci->ctx) == kCGLNoError; } //------------------------------------------------------------------------------ bool CGLContext::swapBuffers() { return CGLFlushDrawable(ci->ctx) == kCGLNoError; } } ImageVis3D-3.1.0/rpm/0000755000175000017500000000000012320517543014060 5ustar mathieumathieuImageVis3D-3.1.0/rpm/imagevis3d.spec0000644000175000017500000001135512320517543016774 0ustar mathieumathieuName: imagevis3d Summary: Desktop volume rendering application for large data Version: trunk License: MIT Release: 0 Group: unsorted Provides: imagevis3d Autoreqprov: yes Source: imagevis3d-svn.tar.gz Vendor: SCI Institute Packager: Tom Fogal %description ImageVis3D is a volume rendering application specifically designed to render large data. This is achieved by splitting the dataset into multiple levels of detail (LoD), with each level itself decomposed into multiple bricks (atomic rendering primitive). Interaction occurs at the coarsest LoD, which can be rendered instantaneously on almost all modern systems. After a configurable delay, ImageVis3D will successively render finer levels of detail, until the data are visible at their native resolution. Development of ImageVis3D is/was sponsored by the NIH/NCRR Center for Integrative Biomedical Computing (CIBC), and the DOE Visualization And Analytics Center for Enabling Technologies (VACET). %prep if test -d imagevis3d ; then (cd imagevis3d && svn update) else svn co https://gforge.sci.utah.edu/svn/imagevis3d fi rm -fr imagevis3d-build cp -r imagevis3d imagevis3d-build cd imagevis3d-build CF="-fvisibility=hidden -Wall -Wextra" CFX="${CF} -fvisibility-inlines-hidden" qmake \ QMAKE_CFLAGS="${CF}" \ QMAKE_CXXFLAGS="${CFX}" \ -recursive %build cd imagevis3d-build make -j4 %install mkdir -p %{buildroot}%{_bindir} %{buildroot}%{_mandir}/man1 mkdir -p %{buildroot}%{_datadir}/imagevis3d/shaders cd imagevis3d-build cp Build/ImageVis3D %{buildroot}%{_bindir}/imagevis3d mkdir -p %{buildroot}%{_mandir}/man1 gzip -9c doc/imagevis3d.1 > %{buildroot}%{_mandir}/man1/imagevis3d.1.gz gzip -9c doc/uvfconvert.1 > %{buildroot}%{_mandir}/man1/uvfconvert.1.gz mkdir -p %{buildroot}%{_datadir}/imagevis3d/shaders install --mode 644 Tuvok/Shaders/* %{buildroot}%{_datadir}/imagevis3d/shaders %files %{_bindir}/imagevis3d %{_datadir}/imagevis3d/shaders/ %{_datadir}/imagevis3d/shaders/1D-slice-FS.glsl %{_datadir}/imagevis3d/shaders/2D-slice-FS.glsl %{_datadir}/imagevis3d/shaders/BBox-FS.glsl %{_datadir}/imagevis3d/shaders/BBox-VS.glsl %{_datadir}/imagevis3d/shaders/BTF.glsl %{_datadir}/imagevis3d/shaders/clip-plane.glsl %{_datadir}/imagevis3d/shaders/Compose-AF-FS.glsl %{_datadir}/imagevis3d/shaders/Compose-Anaglyphs-FS.glsl %{_datadir}/imagevis3d/shaders/Compose-Color-FS.glsl %{_datadir}/imagevis3d/shaders/Compose-CV-FS.glsl %{_datadir}/imagevis3d/shaders/Compose-FS.glsl %{_datadir}/imagevis3d/shaders/Compose-SBS-FS.glsl %{_datadir}/imagevis3d/shaders/Compose-Scanline-FS.glsl %{_datadir}/imagevis3d/shaders/Compositing.glsl %{_datadir}/imagevis3d/shaders/FTB.glsl %{_datadir}/imagevis3d/shaders/GLRaycaster-1D-FS.glsl %{_datadir}/imagevis3d/shaders/GLRaycaster-1D-light-FS.glsl %{_datadir}/imagevis3d/shaders/GLRaycaster-2D-FS.glsl %{_datadir}/imagevis3d/shaders/GLRaycaster-2D-light-FS.glsl %{_datadir}/imagevis3d/shaders/GLRaycaster-Color-FS.glsl %{_datadir}/imagevis3d/shaders/GLRaycaster-frontfaces-FS.glsl %{_datadir}/imagevis3d/shaders/GLRaycaster-ISO-CV-FS.glsl %{_datadir}/imagevis3d/shaders/GLRaycaster-ISO-FS.glsl %{_datadir}/imagevis3d/shaders/GLRaycaster-MIP-Rot-FS.glsl %{_datadir}/imagevis3d/shaders/GLRaycasterNoTransform-VS.glsl %{_datadir}/imagevis3d/shaders/GLRaycaster-VS.glsl %{_datadir}/imagevis3d/shaders/GLSBVR-1D-FS.glsl %{_datadir}/imagevis3d/shaders/GLSBVR-1D-light-FS.glsl %{_datadir}/imagevis3d/shaders/GLSBVR-2D-FS.glsl %{_datadir}/imagevis3d/shaders/GLSBVR-2D-light-FS.glsl %{_datadir}/imagevis3d/shaders/GLSBVR-Color-FS.glsl %{_datadir}/imagevis3d/shaders/GLSBVR-ISO-FS.glsl %{_datadir}/imagevis3d/shaders/GLSBVR-Mesh-1D-FS.glsl %{_datadir}/imagevis3d/shaders/GLSBVR-Mesh-1D-light-FS.glsl %{_datadir}/imagevis3d/shaders/GLSBVR-Mesh-2D-FS.glsl %{_datadir}/imagevis3d/shaders/GLSBVR-Mesh-2D-light-FS.glsl %{_datadir}/imagevis3d/shaders/GLSBVR-Mesh-VS.glsl %{_datadir}/imagevis3d/shaders/GLSBVR-MIP-Rot-FS.glsl %{_datadir}/imagevis3d/shaders/GLSBVR-VS.glsl %{_datadir}/imagevis3d/shaders/lighting.glsl %{_datadir}/imagevis3d/shaders/Mesh-FS.glsl %{_datadir}/imagevis3d/shaders/Mesh-VS.glsl %{_datadir}/imagevis3d/shaders/MIP-slice-FS.glsl %{_datadir}/imagevis3d/shaders/RefineIsosurface.glsl %{_datadir}/imagevis3d/shaders/SlicesIn3D.glsl %{_datadir}/imagevis3d/shaders/Transfer-FS.glsl %{_datadir}/imagevis3d/shaders/Transfer-MIP-FS.glsl %{_datadir}/imagevis3d/shaders/Transfer-VS.glsl %{_datadir}/imagevis3d/shaders/Volume2D-linear.glsl %{_datadir}/imagevis3d/shaders/Volume2D-nearest.glsl %{_datadir}/imagevis3d/shaders/Volume3D.glsl %{_datadir}/imagevis3d/shaders/vr-col-tfqn.glsl %{_datadir}/imagevis3d/shaders/vr-col-tfqn-lit.glsl %{_datadir}/imagevis3d/shaders/vr-scal-tfqn.glsl %{_datadir}/imagevis3d/shaders/vr-scal-tfqn-lit.glsl %doc %{_mandir}/man1/imagevis3d.1.gz %doc %{_mandir}/man1/uvfconvert.1.gz ImageVis3D-3.1.0/ExtractDebugInfo/0000755000175000017500000000000012320517543016457 5ustar mathieumathieuImageVis3D-3.1.0/ExtractDebugInfo/ExtractDebugInfo.pro0000644000175000017500000000334512320517543022403 0ustar mathieumathieuTEMPLATE = app win32:TEMPLATE = vcapp CONFIG += exceptions largefile rtti static stl warn_on CONFIG -= app_bundle macx:DEFINES += QT_MAC_USE_COCOA=1 TARGET = Build/ExtractDebugInfo DEPENDPATH += . INCLUDEPATH += . ../ ../Tuvok/Basics/3rdParty ../Tuvok QMAKE_LIBDIR += ../Tuvok/Build ../Tuvok/IO/expressions LIBS = -lTuvok -ltuvokexpr QT += opengl unix:LIBS += -lz win32:LIBS += shlwapi.lib unix:!macx:LIBS += -lGLU QMAKE_CXXFLAGS_WARN_ON += -Wno-unknown-pragmas !macx:unix:QMAKE_LFLAGS += -fopenmp # Try to link to GLU statically. gludirs = /usr/lib /usr/lib/x86_64-linux-gnu for(d, gludirs) { if(exists($${d}/libGLU.a) && static) { LIBS -= -lGLU; LIBS += $${d}/libGLU.a } } unix:QMAKE_CXXFLAGS += -std=c++0x unix:QMAKE_CXXFLAGS += -fno-strict-aliasing unix:QMAKE_CFLAGS += -fno-strict-aliasing macx:QMAKE_CXXFLAGS += -stdlib=libc++ -mmacosx-version-min=10.7 macx:QMAKE_CFLAGS += -mmacosx-version-min=10.7 macx:LIBS += -stdlib=libc++ -framework CoreFoundation -mmacosx-version-min=10.7 # Find the location of QtGui's prl file, and include it here so we can look at # the QMAKE_PRL_CONFIG variable. TEMP = $$[QT_INSTALL_LIBS] libQtGui.prl PRL = $$[QT_INSTALL_LIBS] QtGui.framework/QtGui.prl TEMP = $$join(TEMP, "/") PRL = $$join(PRL, "/") exists($$TEMP) { include($$TEMP) } exists($$PRL) { include($$PRL) } ### Should we link Qt statically or as a shared lib? # If the PRL config contains the `shared' configuration, then the installed # Qt is shared. In that case, disable the image plugins. contains(QMAKE_PRL_CONFIG, shared) { QTPLUGIN -= qgif qjpeg qtiff } else { QTPLUGIN += qgif qjpeg qtiff } # Input SOURCES += main.cpp ImageVis3D-3.1.0/ExtractDebugInfo/main.cpp0000644000175000017500000001162512320517543020114 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : main.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #include "Basics/StdDefines.h" #include "StdTuvokDefines.h" #include "Basics/SysTools.h" #include "Basics/Appendix.h" #include using namespace std; #define EXTRACTOR_VERSION 1.0 /* #ifdef _WIN32 // CRT's memory leak detection on windows #if defined(DEBUG) || defined(_DEBUG) #include #endif #endif */ void ShowUsage(string filename) { cout << endl << filename << " V" << EXTRACTOR_VERSION << " (using Tuvok V" << TUVOK_VERSION << TUVOK_VERSION_TYPE << ")"<< endl << " (c) Scientific Computing and Imaging Institute, University of Utah" << endl << endl << " Usage:" << endl << " " << filename << " -f InFile [-x ^ -l] [-d OutDir]" << endl << endl << " Mandatory Arguments:" << endl << " -f the input filename" << endl << " -l list the contents of the file" << endl << " XOR" << endl << " -x extract the file" << endl << " Optional Arguments:" << endl << " -d the target directory" << endl << endl; } int main(int argc, char* argv[]) { /* // Enable run-time memory check for debug builds on windows #ifdef _WIN32 #if defined(DEBUG) | defined(_DEBUG) _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif #endif */ // get command line paramers SysTools::CmdLineParams parameters(argc, argv); string strFilename = SysTools::GetFilename(argv[0]); if (parameters.SwitchSet("?") || parameters.SwitchSet("HELP")) { ShowUsage(strFilename); return 1; } string strInFile = ""; string strOutDir = ""; parameters.GetValue("F",strInFile); parameters.GetValue("D",strOutDir); if (strInFile == "") { cout << "Must specify input file via parameter 'f'." << endl; ShowUsage(strFilename); return 1; } if (!parameters.SwitchSet("x") && !parameters.SwitchSet("l")) { cout << "Must specify parameter either 'x' or parameter 'l'." << endl; ShowUsage(strFilename); return 1; } if (parameters.SwitchSet("x") && parameters.SwitchSet("l")) { cout << "Must specify parameter either 'x' or parameter 'l' but not both." << endl; ShowUsage(strFilename); return 1; } if (!SysTools::FileExists(strInFile)) { cout << "Input file " << strInFile << " not found" << endl; return 2; } Appendix a(strInFile); if (!a.IsOK()) { cout << "Invalid input file." << endl; return 3; } vector fi = a.ListFiles(); if (parameters.SwitchSet("l")) { for (size_t i = 0;i Debug (with DirectX) Win32 Debug (with DirectX) x64 Debug Win32 Debug x64 Release (with DirectX) Win32 Release (with DirectX) x64 Release Win32 Release x64 {5494E269-CBE9-443E-9C3D-997B141FDDC7} ExtractDebugInfo Win32Proj Application Unicode true Application Unicode Application Unicode true Application Unicode Application Unicode true Application Unicode Application Unicode true Application Unicode <_ProjectFileVersion>10.0.40219.1 Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ true Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ true Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ false Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ false Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ true Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ true Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ false Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ false AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset $(ProjectName)64 $(ProjectName)64 $(ProjectName)64 $(ProjectName)64 $(ProjectName)32 $(ProjectName)32 $(ProjectName)32 $(ProjectName)32 Disabled ..\Tuvok\3rdParty;..\Tuvok\Basics\3rdParty;..\Tuvok\3rdParty\GLEW;..\Tuvok\IO\3rdParty\boost;..\Tuvok;.;$(QTDIR32)\include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 EditAndContinue 4127;4512;%(DisableSpecificWarnings) Winmm.lib;ws2_32.lib;Imm32.lib;Tuvok.lib;opengl32.lib;shlwapi.lib;QtOpenGLd.lib;QtGuid.lib;QtCored.lib;QtNetwork.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)32.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR32)\lib;$(QTDIR32)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console MachineX86 X64 Disabled ..\Tuvok\3rdParty;..\Tuvok\Basics\3rdParty;..\Tuvok\3rdParty\GLEW;..\Tuvok\IO\3rdParty\boost;..\Tuvok;.;$(QTDIR64)\include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) Winmm.lib;ws2_32.lib;Imm32.lib;Tuvok.lib;opengl32.lib;shlwapi.lib;QtOpenGLd.lib;QtGuid.lib;QtCored.lib;QtNetwork.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)64.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR64)\lib;$(QTDIR64)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console MachineX64 /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) MaxSpeed true ..\Tuvok\3rdParty;..\Tuvok\Basics\3rdParty;..\Tuvok\3rdParty\GLEW;..\Tuvok\IO\3rdParty\boost;..\Tuvok;.;$(QTDIR32)\include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) Winmm.lib;ws2_32.lib;Imm32.lib;Tuvok.lib;opengl32.lib;shlwapi.lib;QtOpenGL.lib;QtGui.lib;QtCore.lib;QtNetwork.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)32.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR32)\lib;$(QTDIR32)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console true true MachineX86 X64 /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) MaxSpeed true ..\Tuvok\3rdParty;..\Tuvok\Basics\3rdParty;..\Tuvok\3rdParty\GLEW;..\Tuvok\IO\3rdParty\boost;..\Tuvok;.;$(QTDIR64)\include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) Winmm.lib;ws2_32.lib;Imm32.lib;Tuvok.lib;opengl32.lib;shlwapi.lib;QtOpenGL.lib;QtGui.lib;QtCore.lib;QtNetwork.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)64.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR64)\lib;$(QTDIR64)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console true true MachineX64 Disabled ..\Tuvok\3rdParty;..\Tuvok\Basics\3rdParty;..\Tuvok\3rdParty\GLEW;..\Tuvok\IO\3rdParty\boost;..\Tuvok;.;$(QTDIR32)\include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 EditAndContinue 4127;4512;%(DisableSpecificWarnings) Winmm.lib;ws2_32.lib;Imm32.lib;Tuvok.lib;opengl32.lib;shlwapi.lib;QtOpenGLd.lib;QtGuid.lib;QtCored.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)32.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR32)\lib;$(QTDIR32)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console MachineX86 X64 Disabled ..\Tuvok\3rdParty;..\Tuvok\Basics\3rdParty;..\Tuvok\3rdParty\GLEW;..\Tuvok\IO\3rdParty\boost;..\Tuvok;.;$(QTDIR64)\include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) Winmm.lib;ws2_32.lib;Imm32.lib;Tuvok.lib;opengl32.lib;shlwapi.lib;QtOpenGLd.lib;QtGuid.lib;QtCored.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)64.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR64)\lib;$(QTDIR64)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console MachineX64 /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) MaxSpeed true ..\Tuvok\3rdParty;..\Tuvok\Basics\3rdParty;..\Tuvok\3rdParty\GLEW;..\Tuvok\IO\3rdParty\boost;..\Tuvok;.;$(QTDIR32)\include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) Tuvok.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)32.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR32)\lib;$(QTDIR32)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console true true MachineX86 X64 /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) MaxSpeed true ..\Tuvok\3rdParty;..\Tuvok\Basics\3rdParty;..\Tuvok\3rdParty\GLEW;..\Tuvok\IO\3rdParty\boost;..\Tuvok;.;$(QTDIR64)\include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) Winmm.lib;ws2_32.lib;Imm32.lib;Tuvok.lib;opengl32.lib;shlwapi.lib;QtOpenGL.lib;QtGui.lib;QtCore.lib;QtNetwork.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)64.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR64)\lib;$(QTDIR64)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console true true MachineX64 {3d1630aa-c160-493b-88f2-e29ab13af140} false {85742de8-68c9-4140-a6a7-412cf789deca} false {d474a1e1-2ed3-42e6-826c-372430e549b9} false ImageVis3D-3.1.0/CmdLineConverter/0000755000175000017500000000000012320517543016465 5ustar mathieumathieuImageVis3D-3.1.0/CmdLineConverter/main.cpp0000644000175000017500000005111712320517543020122 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : main.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : December 2008 // //! Copyright (C) 2008 SCI Institute #include "../Tuvok/StdTuvokDefines.h" #include #include #include #include #include #include #include "DebugOut/HRConsoleOut.h" #include "../Tuvok/Controller/Controller.h" #include "../Tuvok/Basics/SysTools.h" #include "../Tuvok/Basics/SystemInfo.h" #include "../Tuvok/IO/AbstrConverter.h" #include "../Tuvok/IO/AbstrGeoConverter.h" #include "../Tuvok/IO/DirectoryParser.h" #include "../Tuvok/IO/IOManager.h" #include "../Tuvok/IO/TuvokIOError.h" #include "../Tuvok/IO/uvfDataset.h" using namespace std; using namespace tuvok; /* #ifdef _WIN32 // CRT's memory leak detection on windows #if defined(DEBUG) || defined(_DEBUG) #include #endif #endif */ enum { EXIT_FAILURE_ARG = 1, // invalid argument EXIT_FAILURE_UNKNOWN_OUT, // unknown file type for output file EXIT_FAILURE_RO_VOL_OUT, // file known as volume but converter is read only EXIT_FAILURE_RO_GEO_OUT, // file known as mesh but converter is read only EXIT_FAILURE_RO_VOL_IN, // file known as volume but converter is write only EXIT_FAILURE_RO_GEO_IN, // file known as mesh but converter is write only EXIT_FAILURE_UNKNOWN_1, // unknown file type for first input file EXIT_FAILURE_UNKNOWN_2, // unknown file type for second file in merge EXIT_FAILURE_CROSS_1, // trying to convert a volume into a mesh EXIT_FAILURE_CROSS_2, // trying to convert a mesh into a volume EXIT_FAILURE_MESH_MERGE, // trying to merge meshes EXIT_FAILURE_TO_RAW, // error during source to raw conversion step EXIT_FAILURE_TO_UVF, // error during raw to uvf conversion step EXIT_FAILURE_GENERAL, // general error during conversion (not to UVF) EXIT_FAILURE_IN_MESH_LOAD, // unable to open the input mesh EXIT_FAILURE_OUT_MESH_WRITE,// unable to write output mesh EXIT_FAILURE_MERGE, // general error during file merge EXIT_FAILURE_DIR_MERGE, // attempting to merge in directory mode EXIT_FAILURE_MERGE_NO_UVF, // attempting to merge to format other than UVF EXIT_FAILURE_GENERAL_DIR, // general error during conversion in dir mode EXIT_FAILURE_NEED_UVF, // UVFs must be input to eval expressions. }; static int export_data(const IOManager&, const std::string in, const std::string out); // reads an entire file into a string. static std::string readfile(const std::string& filename) { // open in append mode so the file pointer will be at EOF and we can // therefore easily/quickly figure out the file size. std::ifstream ifs(filename.c_str(), std::ios::in | std::ios::ate); if(!ifs.is_open()) { T_ERROR("Could not open file '%s'", filename.c_str()); return ""; } std::ifstream::pos_type len = ifs.tellg(); ifs.seekg(0, std::ios::beg); std::vector contents(len+std::ifstream::pos_type(1), 0); size_t offset=0; do { std::streamsize length = std::streamsize(len) - std::streamsize(offset); ifs.read(&contents[offset], length); offset += ifs.gcount(); } while(!ifs.eof() && std::ifstream::pos_type(offset) < len); ifs.close(); return std::string(&contents[0]); } int main(int argc, const char* argv[]) { /* // Enable run-time memory check for debug builds on windows #ifdef _WIN32 #if defined(DEBUG) | defined(_DEBUG) _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif #endif */ std::vector input; std::string output, directory; std::string expression; // temp string strInFile; string strInFile2; string strInDir; string strOutFile; double fScale = 0.0; double fBias = 0.0; bool debug; uint32_t bricksize = 64; uint32_t bricklayout = 0; // 0 is default scanline layout const uint32_t brickoverlap = 2; uint32_t compression = 1; // 1 is default zlib compression uint32_t level = 1; // generic compression level 1 is best speed float fMem = 0.8f; try { TCLAP::CmdLine cmd("uvf converter"); TCLAP::MultiArg inputs("i", "input", "input file. " "Repeat to merge volumes", true, "filename"); TCLAP::ValueArg directory("d", "directory", "input directory", true, "", "path"); TCLAP::ValueArg expr("e", "expression", "merge expression", false, "", "string"); TCLAP::ValueArg output("o", "output", "output file (uvf)", true, "", "filename"); TCLAP::ValueArg bias("b", "bias", "(merging) bias value for second file", false, 0.0, "floating point number"); TCLAP::ValueArg scale("s", "scale", "(merging) scaling value for second file", false, 0.0, "floating point number"); TCLAP::ValueArg opt_mem("m", "memory", "max allowed fraction of installed RAM to use" " (0.05..0.95)", false, 0.8f, "floating point number"); TCLAP::ValueArg opt_bricksize("c", "bricksize", "set maximum brick size (64)", false, 64, "positive integer"); TCLAP::ValueArg opt_bricklayout("l", "bricklayout", "brick layout" " on disk 0: scanline, 1: morton, 2: " "hilbert, 3: random order", false, 0, "positive integer"); TCLAP::ValueArg opt_compression("p", "compress", "UVF compression " "method 0: no compression, 1: zlib, " "2: lzma, 3: lz4, 4: bzlib, " "5: lzham", false, 1, "positive integer"); TCLAP::ValueArg opt_level("v", "level", "UVF compression level " "between (1..10)", false, 1, "positive integer"); TCLAP::SwitchArg dbg("g", "debug", "Enable debugging mode", false); TCLAP::SwitchArg experim("", "experimental", "Enable experimental features", false); cmd.xorAdd(inputs, directory); cmd.add(output); cmd.add(bias); cmd.add(scale); cmd.add(opt_mem); cmd.add(opt_bricksize); cmd.add(opt_bricklayout); cmd.add(opt_compression); cmd.add(opt_level); cmd.add(expr); cmd.add(dbg); cmd.add(experim); cmd.parse(argc, argv); // which of "-i" or "-d" did they give? if(inputs.isSet()) { strInFile = inputs.getValue()[0]; if(inputs.getValue().size() > 1) { strInFile2 = inputs.getValue()[1]; } input = inputs.getValue(); } if(directory.isSet()) { strInDir = directory.getValue(); } strOutFile = output.getValue(); fBias = bias.getValue(); fScale = scale.getValue(); fMem = opt_mem.getValue(); bricksize = opt_bricksize.getValue(); bricklayout = opt_bricklayout.getValue(); compression = opt_compression.getValue(); level = opt_level.getValue(); if(expr.isSet()) { expression = expr.getValue(); if(SysTools::FileExists(expression)) { expression = readfile(expression); } } debug = dbg.getValue(); Controller::Instance().ExperimentalFeatures(experim.getValue()); } catch(const TCLAP::ArgException& e) { std::cerr << "error: " << e.error() << " for arg " << e.argId() << "\n"; return EXIT_FAILURE_ARG; } HRConsoleOut* debugOut = new HRConsoleOut(); debugOut->SetOutput(true, true, true, false); if(!debug) { debugOut->SetClearOldMessage(true); } Controller::Instance().AddDebugOut(debugOut); if (fMem < 0.05f) { fMem = 0.05f; MESSAGE("Clamped max allowed RAM utilization to: %.2f%%", fMem * 100); } else if (fMem > 0.95) { fMem = 0.95f; MESSAGE("Clamped max allowed RAM utilization to: %.2f%%", fMem * 100); } else { MESSAGE("Max allowed RAM utilization: %.2f", fMem * 100); } const uint64_t memTotal = Controller::Const().SysInfo().GetCPUMemSize(); Controller::Instance().SetMaxCPUMem((memTotal*fMem)/(1024*1024)); uint32_t mem = uint32_t(Controller::Instance().SysInfo()->GetMaxUsableCPUMem()/1024/1024); MESSAGE("Using up to %u MB RAM", mem); cout << endl; IOManager ioMan; ioMan.SetCompression(compression); ioMan.SetCompressionLevel(level); ioMan.SetLayout(bricklayout); // If they gave us an expression, evaluate that. Otherwise we're doing a // normal conversion. if(!expression.empty()) { // All the input files need to be UVFs if they're merging volumes. for(std::vector::const_iterator f = input.begin(); f != input.end(); ++f) { if(ioMan.NeedsConversion(*f)) { T_ERROR("Expression evaluation currently requires all input volumes " "to be stored as UVFs."); return EXIT_FAILURE_NEED_UVF; } } try { ioMan.EvaluateExpression(expression.c_str(), input, strOutFile); } catch(const std::exception& e) { std::cerr << "expr exception: " << e.what() << "\n"; return EXIT_FAILURE; } return EXIT_SUCCESS; } // Verify we can actually convert the data. We can't do this for // directories unless we've scanned the directory already, so delay // error detection there. if(strInDir.empty()) { for(auto f = input.cbegin(); f != input.cend(); ++f) { std::string ext = SysTools::ToLowerCase(SysTools::GetExt(*f)); bool conv_vol = ioMan.GetConverterForExt(ext, false, true) != NULL; bool conv_geo = ioMan.GetGeoConverterForExt(ext, false, true) != NULL; if(conv_vol || conv_geo || !ioMan.NeedsConversion(*f)) { continue; } if(!conv_vol && !conv_geo) { T_ERROR("Unknown file type for '%s'", f->c_str()); return EXIT_FAILURE_UNKNOWN_OUT; } } } string targetType = SysTools::ToLowerCase(SysTools::GetExt(strOutFile)); if (!strInFile.empty()) { string sourceType = SysTools::ToLowerCase(SysTools::GetExt(strInFile)); bool bIsVolExtOut = ioMan.GetConverterForExt(targetType, false, false) != NULL; bool bIsGeoExtOut = ioMan.GetGeoConverterForExt(targetType, false, false) != NULL; bool bIsVolExt1 = ioMan.GetConverterForExt(sourceType, false, false) != NULL; bool bIsGeoExt1 = ioMan.GetGeoConverterForExt(sourceType, false, false) != NULL; if(!ioMan.NeedsConversion(strInFile)) { return export_data(ioMan, strInFile, strOutFile); } if (!bIsVolExt1 && !bIsGeoExt1) { std::cerr << "error: Unknown file type for '" << strInFile << "'\n"; return EXIT_FAILURE_UNKNOWN_1; } if (bIsVolExt1 && bIsGeoExtOut) { std::cerr << "error: cannot convert volume to geometry\n"; return EXIT_FAILURE_CROSS_1; } if (bIsGeoExt1 && bIsVolExtOut) { std::cerr << "error: cannot convert geometry to volume\n"; return EXIT_FAILURE_CROSS_2; } if (bIsGeoExt1 && bIsGeoExtOut) { AbstrGeoConverter* importer = ioMan.GetGeoConverterForExt(sourceType, false, false); AbstrGeoConverter* exporter = ioMan.GetGeoConverterForExt(targetType, false, false); if (!importer->CanImportData()) { std::cerr << "error: cannot read that type of geometry (only write)\n"; return EXIT_FAILURE_RO_GEO_IN; } if (!exporter->CanExportData()) { std::cerr << "error: cannot write that type of geometry (only read)\n"; return EXIT_FAILURE_RO_GEO_OUT; } } if (bIsVolExt1 && bIsVolExtOut) { std::shared_ptr importer = ioMan.GetConverterForExt(sourceType, false, false); std::shared_ptr exporter = ioMan.GetConverterForExt(targetType, false, false); if (!importer->CanImportData()) { std::cerr << "error: cannot read that type of volume (only write)\n"; return EXIT_FAILURE_RO_VOL_IN; } if (!exporter->CanExportData()) { std::cerr << "error: cannot write that type of volume (only read)\n"; return EXIT_FAILURE_RO_VOL_OUT; } } if (strInFile2.empty()) { if (bIsVolExt1) { if (targetType == "uvf" && sourceType == "uvf") { cout << endl << "Running in UVF to UVF mode, " << "perserving only the raw data from " << strInFile << " to " << strOutFile << endl; cout << "Step 1. Extracting raw data" << endl; /// use some simple format as intermediate file string tmpFile = SysTools::ChangeExt(strOutFile,"nrrd"); // HACK: use the output file's dir as temp dir if (ioMan.ConvertDataset(strInFile, tmpFile, SysTools::GetPath(tmpFile), true, bricksize, brickoverlap)) { cout << endl << "Success." << endl << endl; } else { cout << endl << "Extraction failed!" << endl << endl; return EXIT_FAILURE_TO_RAW; } cout << "Step 2. Writing new UVF file" << endl; // HACK: use the output file's dir as temp dir if (ioMan.ConvertDataset(tmpFile, strOutFile, SysTools::GetPath(strOutFile), true, bricksize, brickoverlap)) { if(std::remove(tmpFile.c_str()) == -1) { cout << endl << "Conversion succeeded but " << " could not delete tmp file " << tmpFile << "\n\n"; } else { cout << "\nSuccess.\n\n"; } return EXIT_SUCCESS; } else { if(std::remove(tmpFile.c_str()) == -1) { cout << "\nUVF write failed and could not delete tmp file " << tmpFile << "\n\n"; } else { cout << "\nUVF write failed.\n\n"; } return EXIT_FAILURE_TO_UVF; } } else { cout << endl << "Running in volume file mode.\nConverting " << strInFile << " to " << strOutFile << "\n\n"; // HACK: use the output file's dir as temp dir if (ioMan.ConvertDataset(strInFile, strOutFile, SysTools::GetPath(strOutFile), true, bricksize, brickoverlap)) { cout << "\nSuccess.\n\n"; return EXIT_SUCCESS; } else { cout << "\nConversion failed!\n\n"; return EXIT_FAILURE_GENERAL; } } } else { AbstrGeoConverter* sourceConv = ioMan.GetGeoConverterForExt(sourceType, false, true); AbstrGeoConverter* targetConv = ioMan.GetGeoConverterForExt(targetType, true, false); cout << "\nRunning in geometry file mode.\n" << "Converting " << strInFile << " (" << sourceConv->GetDesc() << ") to " << strOutFile << " (" << targetConv->GetDesc() << ")\n"; std::shared_ptr m; try { m = sourceConv->ConvertToMesh(strInFile); } catch (const tuvok::io::DSOpenFailed& err) { cerr << "Error trying to open the input mesh " << "(" << err.what() << ")\n"; return EXIT_FAILURE_IN_MESH_LOAD; } if (!targetConv->ConvertToNative(*m,strOutFile)) { cerr << "Error writing target mesh\n"; return EXIT_FAILURE_OUT_MESH_WRITE; } } } else { string sourceType2 = SysTools::ToLowerCase(SysTools::GetExt(strInFile2)); bool bIsVolExt2 = ioMan.GetConverterForExt(sourceType2, false, true) != NULL; bool bIsGeoExt2 = ioMan.GetGeoConverterForExt(sourceType2, false, true) != NULL; if (!bIsVolExt2 && !bIsGeoExt2) { std::cerr << "error: Unknown file type for '" << strInFile2 << "'\n"; return EXIT_FAILURE_UNKNOWN_2; } if (bIsGeoExt2) { std::cerr << "error: Mesh merge not supported at the moment\n"; return EXIT_FAILURE_MESH_MERGE; } vector vDataSets; vector vScales; vector vBiases; vDataSets.push_back(strInFile); vScales.push_back(1.0); vBiases.push_back(0.0); vDataSets.push_back(strInFile2); vScales.push_back(fScale); vBiases.push_back(fBias); cout << endl << "Running in merge mode.\nConverting"; for (size_t i = 0;i<> dirinfo = ioMan.ScanDirectory(strInDir); vector vStrFilenames(dirinfo.size()); if (dirinfo.size() == 1) { vStrFilenames[0] = strOutFile; } else { string strFilenameAndDirectory = SysTools::RemoveExt(strOutFile); // should be "uvf" but we never know what the user specified string strExt = SysTools::GetExt(strOutFile); for (size_t i = 0;i(ds); // use the output file's dir as temp dir if(!iom.ExportDataset(uvf, 0, out, SysTools::GetPath(out))) { return EXIT_FAILURE_GENERAL; } return EXIT_SUCCESS; } ImageVis3D-3.1.0/CmdLineConverter/TuvokConverter.vcxproj0000644000175000017500000006722212320517543023113 0ustar mathieumathieu Debug (with DirectX) Win32 Debug (with DirectX) x64 Debug Win32 Debug x64 Release (with DirectX) Win32 Release (with DirectX) x64 Release Win32 Release x64 {3D1630AA-C160-493B-88F2-E29AB13AF140} UVFConverter Win32Proj Application Unicode true Application Unicode Application Unicode true Application Unicode Application Unicode true Application Unicode Application Unicode true Application Unicode <_ProjectFileVersion>10.0.40219.1 Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ true Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ false Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ true Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ false Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ true Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ false Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ true Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ false AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset $(ProjectName)64 $(ProjectName)64 $(ProjectName)64 $(ProjectName)64 $(ProjectName)32 $(ProjectName)32 $(ProjectName)32 $(ProjectName)32 Disabled ../Tuvok;../Tuvok/3rdParty;../Tuvok/3rdParty/GLEW;../Tuvok/Basics;../Tuvok/Basics/3rdParty;../Tuvok/Basics/3rdParty/boost;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/exception;../Tuvok/IO/expressions;.;$(QTDIR32)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 EditAndContinue 4127;4512;%(DisableSpecificWarnings) Tuvok.lib;opengl32.lib;shlwapi.lib;QtOpenGLd.lib;QtGuid.lib;QtCored.lib;QtNetwork.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)32.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR32)\lib;$(QTDIR32)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console MachineX86 /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) MaxSpeed true ../Tuvok;../Tuvok/3rdParty;../Tuvok/3rdParty/GLEW;../Tuvok/Basics;../Tuvok/Basics/3rdParty;../Tuvok/Basics/3rdParty/boost;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/exception;../Tuvok/IO/expressions;.;$(QTDIR32)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) Tuvok.lib;opengl32.lib;shlwapi.lib;QtOpenGL.lib;QtGui.lib;QtCore.lib;QtNetwork.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)32.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR32)\lib;$(QTDIR32)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console true true MachineX86 Disabled ../Tuvok;../Tuvok/3rdParty;../Tuvok/3rdParty/GLEW;../Tuvok/Basics;../Tuvok/Basics/3rdParty;../Tuvok/Basics/3rdParty/boost;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/exception;../Tuvok/IO/expressions;.;$(QTDIR32)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 EditAndContinue 4127;4512;%(DisableSpecificWarnings) Tuvok.lib;opengl32.lib;shlwapi.lib;QtOpenGLd.lib;QtGuid.lib;QtCored.lib;QtNetwork.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)32.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR32)\lib;$(QTDIR32)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console MachineX86 /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) MaxSpeed true ../Tuvok;../Tuvok/3rdParty;../Tuvok/3rdParty/GLEW;../Tuvok/Basics;../Tuvok/Basics/3rdParty;../Tuvok/Basics/3rdParty/boost;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/exception;../Tuvok/IO/expressions;.;$(QTDIR32)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) Tuvok.lib;opengl32.lib;shlwapi.lib;QtOpenGL.lib;QtGui.lib;QtCore.lib;QtNetwork.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)32.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR32)\lib;$(QTDIR32)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console true true MachineX86 X64 Disabled ../Tuvok;../Tuvok/3rdParty;../Tuvok/3rdParty/GLEW;../Tuvok/Basics;../Tuvok/Basics/3rdParty;../Tuvok/Basics/3rdParty/boost;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/exception;../Tuvok/IO/expressions;.;$(QTDIR64)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) Tuvok.lib;opengl32.lib;shlwapi.lib;QtGuid.lib;QtOpenGLd.lib;QtCored.lib;QtNetwork.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)64.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR64)\lib;$(QTDIR64)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console MachineX64 X64 /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) MaxSpeed true ../Tuvok;../Tuvok/3rdParty;../Tuvok/3rdParty/GLEW;../Tuvok/Basics;../Tuvok/Basics/3rdParty;../Tuvok/Basics/3rdParty/boost;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/exception;../Tuvok/IO/expressions;.;$(QTDIR64)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) Tuvok.lib;opengl32.lib;shlwapi.lib;QtOpenGL.lib;QtGui.lib;QtCore.lib;QtNetwork.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)64.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR64)\lib;$(QTDIR64)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console true true MachineX64 X64 Disabled ../Tuvok;../Tuvok/3rdParty;../Tuvok/3rdParty/GLEW;../Tuvok/Basics;../Tuvok/Basics/3rdParty;../Tuvok/Basics/3rdParty/boost;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/exception;../Tuvok/IO/expressions;.;$(QTDIR64)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) Tuvok.lib;opengl32.lib;shlwapi.lib;QtOpenGLd.lib;QtGuid.lib;QtCored.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)64.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR64)\lib;$(QTDIR64)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console MachineX64 X64 /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) MaxSpeed true ../Tuvok;../Tuvok/3rdParty;../Tuvok/3rdParty/GLEW;../Tuvok/Basics;../Tuvok/Basics/3rdParty;../Tuvok/Basics/3rdParty/boost;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/exception;../Tuvok/IO/expressions;.;$(QTDIR64)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) Tuvok.lib;opengl32.lib;shlwapi.lib;QtOpenGL.lib;QtGui.lib;QtCore.lib;QtNetwork.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)64.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR64)\lib;$(QTDIR64)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console true true MachineX64 {d474a1e1-2ed3-42e6-826c-372430e549b9} false ImageVis3D-3.1.0/CmdLineConverter/CmdLineConverter.pro0000644000175000017500000000424712320517543022421 0ustar mathieumathieuTEMPLATE = app win32:TEMPLATE = vcapp CONFIG += exceptions largefile qt rtti static stl warn_on macx:CONFIG += app_bundle macx:DEFINES += QT_MAC_USE_COCOA=1 TARGET = Build/UVFConverter unix:TARGET = Build/uvfconvert QT = core gui opengl incpath = ../Tuvok/3rdParty/GLEW incpath += ../Tuvok/IO/3rdParty/boost/ incpath += ../Tuvok/IO/exception incpath += ../Tuvok/Basics incpath += ../Tuvok/Basics/3rdParty incpath += ../Tuvok DEPENDPATH += $$incpath INCLUDEPATH += $$incpath QMAKE_LIBDIR += ../Tuvok/Build ../Tuvok/IO/expressions LIBS += -lTuvok -ltuvokexpr unix:LIBS += -lz win32:LIBS += shlwapi.lib macx:QMAKE_CXXFLAGS += -stdlib=libc++ -mmacosx-version-min=10.7 macx:QMAKE_CFLAGS += -mmacosx-version-min=10.7 macx:LIBS += -stdlib=libc++ -framework CoreFoundation macx:LIBS += -mmacosx-version-min=10.7 QMAKE_CXXFLAGS_WARN_ON += -Wno-unknown-pragmas !macx:unix:QMAKE_LFLAGS += -fopenmp # Try to link to GLU statically. gludirs = /usr/lib /usr/lib/x86_64-linux-gnu found=false for(d, gludirs) { if(exists($${d}/libGLU.a)) { LIBS += $${d}/libGLU.a found=true } } if(!found) { # not mac: GLU comes in the GL framework. unix:!macx:LIBS += -lGLU } unix:!macx:LIBS += -lGL # Find the location of QtGui's prl file, and include it here so we can look at # the QMAKE_PRL_CONFIG variable. TEMP = $$[QT_INSTALL_LIBS] libQtGui.prl PRL = $$[QT_INSTALL_LIBS] QtGui.framework/QtGui.prl TEMP = $$join(TEMP, "/") PRL = $$join(PRL, "/") exists($$TEMP) { include($$TEMP) } exists($$PRL) { include($$PRL) } ### Should we link Qt statically or as a shared lib? # If the PRL config contains the `shared' configuration, then the installed # Qt is shared. In that case, disable the image plugins. contains(QMAKE_PRL_CONFIG, shared) { QTPLUGIN -= qgif qjpeg qtiff } else { QTPLUGIN += qgif qjpeg qtiff } unix:QMAKE_CXXFLAGS += -std=c++0x unix:QMAKE_CXXFLAGS += -fno-strict-aliasing unix:QMAKE_CFLAGS += -fno-strict-aliasing # Input HEADERS += DebugOut/HRConsoleOut.h SOURCES += DebugOut/HRConsoleOut.cpp \ main.cpp ImageVis3D-3.1.0/CmdLineConverter/DebugOut/0000755000175000017500000000000012320517543020203 5ustar mathieumathieuImageVis3D-3.1.0/CmdLineConverter/DebugOut/HRConsoleOut.h0000644000175000017500000000374212320517543022706 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file HRConsoleOut.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date August 2008 */ #pragma once #ifndef HRCONSOLEOUT_H #define HRCONSOLEOUT_H #include "../../Tuvok/DebugOut/AbstrDebugOut.h" class HRConsoleOut : public AbstrDebugOut{ public: HRConsoleOut(); ~HRConsoleOut(); void SetClearOldMessage(bool bClearOldMessage) {m_bClearOldMessage = bClearOldMessage;} bool GetClearOldMessage() {return m_bClearOldMessage;} virtual void printf(enum DebugChannel, const char* source, const char* msg); virtual void printf(const char *s) const; private: size_t m_iLengthLastMessage; bool m_bClearOldMessage; }; #endif // HRCONSOLEOUT_H ImageVis3D-3.1.0/CmdLineConverter/DebugOut/HRConsoleOut.cpp0000644000175000017500000000512412320517543023235 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file HRConsoleOut.cpp \author Jens Krueger SCI Institute University of Utah \version 1.0 \date August 2008 */ #include #include #include #include #include "HRConsoleOut.h" #include "../../Tuvok/Basics/Console.h" HRConsoleOut::HRConsoleOut() : m_iLengthLastMessage(0), m_bClearOldMessage(false) { } HRConsoleOut::~HRConsoleOut() { } void HRConsoleOut::printf(enum DebugChannel channel, const char*, const char* msg) { char buff[16384]; #ifdef WIN32 strncpy_s(buff, 16384, msg, 16384); #else strncpy(buff, msg, 16384); #endif if (m_bClearOldMessage) { // Remove any newlines from the string. for (size_t i=0;i {c1471151-b033-44b0-b041-38c2035de411} DebugOut DebugOut ImageVis3D-3.1.0/ui_files.xml0000644000175000017500000002044212320517543015605 0ustar mathieumathieu General Command Line Execute Before Specifies the targets for the build customization to run before. Execute After Specifies the targets for the build customization to run after. Additional Options Additional Options General Command Line Execute Before Specifies the targets for the build customization to run before. Execute After Specifies the targets for the build customization to run after. Additional Options Additional Options ImageVis3D-3.1.0/LuaScripts/0000755000175000017500000000000012320517543015353 5ustar mathieumathieuImageVis3D-3.1.0/LuaScripts/FlyThroughAnimator.lua0000644000175000017500000004102612320517543021647 0ustar mathieumathieudescription = [[ ************************************************************************************************************* Brief: ImageVis3D Lua script to interactively generate a key frame sequence for an animated fly through Author: Alexander Schiewe Date: October 2012 HowTo: - press 'F'-key to enable first person mode and use first person mode navigation only - use '0'-key to capture key frame and insert it at currently active key frame position - use ','/'.'-key to delete active key frame - use '1'/'2'/'3'-keys to jump to previous/active/next key frames - use 'Enter'-key to print captured key frames - use '/'-key to write captured key frames to file - use '*'-key to generate animation preview data structures - use '-'/'+'-keys to step along the last generated animation path TODOs: - automatically update animation data structure when manipulating key points ************************************************************************************************************* ]] print(description) iv3d.setStayOpen(true) inputDir = 'S:/Share/Datasets/Octrees/ImageVis/' --filename = inputDir ..'mandelbulb1024-20s-bs32-8.uvf' --filename = inputDir ..'mandelbulb2048-20s-bs32-8.uvf' --filename = inputDir ..'mandelbulb4096-20s-bs32-8.uvf' --filename = inputDir ..'mandelbulb8192-20s-bs32-8.uvf' --filename = inputDir ..'mandelbulb16384-20s-bs64-8.uvf' --filename = inputDir ..'RichtmyerMeshkov-2048x2048x1920-8bit-64.uvf' --filename = inputDir ..'VisualHuman-512x512x1884-16bit-32-median-clamp-zlib.uvf' filename = inputDir ..'wholebody-32.uvf' data = iv3d.renderer.new(filename) --data.lighting(false) --data.resize({1920, 1080}) --data.resize({960, 540}) data.resize({480, 270}) rw = data.getRawRenderer() rw.setBGColors({0, 0, 255}, {0, 255, 255}) --rw.setBGColors({255, 255, 255}, {255, 255, 255}) --rw.setBGColors({0, 0, 0}, {0, 0, 0}) region = rw.getFirst3DRenderRegion() -- key point capturing ************************************************************************************** outputSequence = 0 activeKeyPoint = 0 keyPoints = {} function getCamera() return {eye={x=rw.getViewPos()[1], y=rw.getViewPos()[2], z=rw.getViewPos()[3]}, ref={x=rw.getViewDir()[1], y=rw.getViewDir()[2], z=rw.getViewDir()[3]}, vup={x=rw.getUpDir()[1], y=rw.getUpDir()[2], z=rw.getUpDir()[3]}} end function setCamera(cam) rw.setViewPos({cam.eye.x, cam.eye.y, cam.eye.z}) rw.setViewDir({cam.ref.x, cam.ref.y, cam.ref.z}) rw.setUpDir( {cam.vup.x, cam.vup.y, cam.vup.z}) iv3d.processUI() end function cameraToString(cam) return "{eye={x=".. cam.eye.x ..", y=".. cam.eye.y ..", z=".. cam.eye.z .."}, ref={x=".. cam.ref.x ..", y=".. cam.ref.y ..", z=".. cam.ref.z .."}, vup={x=".. cam.vup.x ..", y=".. cam.vup.y ..", z=".. cam.vup.z .."}}" end function matrixToString(mat) return "{{"..mat[1][1]..", "..mat[1][2]..", "..mat[1][3]..", "..mat[1][4].."}, {"..mat[2][1]..", "..mat[2][2]..", "..mat[2][3]..", "..mat[2][4].."}, {"..mat[3][1]..", "..mat[3][2]..", "..mat[3][3]..", "..mat[3][4].."}, {"..mat[4][1]..", "..mat[4][2]..", "..mat[4][3]..", "..mat[4][4].."}}" end function insertKeyFrame(index) table.insert(keyPoints, index, getCamera()) print("Captured key frame at index ".. index .."/".. #keyPoints ..": ".. cameraToString(keyPoints[index])) end function deleteKeyFrame(index) if index < 1 or index > #keyPoints then print("There is no captured key frame with index ".. index .. " to be deleted") return end print("Deleting key frame at index ".. index .."/".. #keyPoints ..": ".. cameraToString(keyPoints[index])) table.remove(keyPoints, index) if activeKeyPoint > #keyPoints then activeKeyPoint = #keyPoints end end function jumpToKeyFrame(index) if #keyPoints == 0 then print("There are no captured key frames to jump to") return end if index < 1 then index = #keyPoints print("WRAPPED AROUND to the last key frame") elseif index > #keyPoints then index = 1 print("WRAPPED AROUND to the first key frame") end print("Jumping to key frame: ".. index) local cam = keyPoints[index] activeKeyPoint = index setCamera(cam) end function printKeyFrames() if #keyPoints == 0 then print("There are no captured key frames to print") return end for i = 1, #keyPoints do print(string.format("%02d", i) ..": ".. cameraToString(keyPoints[i])) end print("Active key frame: ".. activeKeyPoint) end function writeKeyFramesToFile(filename) io.output(filename) -- would be very useful if we could read those values into a matrix easily --io.write("translation = ".. matrixToString(region.getTranslation4x4()) .."\n") --io.write("rotation = ".. matrixToString(region.getRotation4x4()) .."\n") local t = region.getTranslation4x4() io.write("local t=matrix.identity()\n") io.write("t[1][1]="..t[1][1].."; t[1][2]="..t[1][2].."; t[1][3]="..t[1][3].."; t[1][4]="..t[1][4].."\n"); io.write("t[2][1]="..t[2][1].."; t[2][2]="..t[2][2].."; t[2][3]="..t[2][3].."; t[2][4]="..t[2][4].."\n"); io.write("t[3][1]="..t[3][1].."; t[3][2]="..t[3][2].."; t[3][3]="..t[3][3].."; t[3][4]="..t[3][4].."\n"); io.write("t[4][1]="..t[4][1].."; t[4][2]="..t[4][2].."; t[4][3]="..t[4][3].."; t[4][4]="..t[4][4].."\n"); io.write("region.setTranslation4x4(t)\n"); local r = region.getRotation4x4() io.write("local r=matrix.identity()\n") io.write("r[1][1]="..r[1][1].."; r[1][2]="..r[1][2].."; r[1][3]="..r[1][3].."; r[1][4]="..r[1][4].."\n"); io.write("r[2][1]="..r[2][1].."; r[2][2]="..r[2][2].."; r[2][3]="..r[2][3].."; r[2][4]="..r[2][4].."\n"); io.write("r[3][1]="..r[3][1].."; r[3][2]="..r[3][2].."; r[3][3]="..r[3][3].."; r[3][4]="..r[3][4].."\n"); io.write("r[4][1]="..r[4][1].."; r[4][2]="..r[4][2].."; r[4][3]="..r[4][3].."; r[4][4]="..r[4][4].."\n"); io.write("region.setRotation4x4(r)\n"); if #keyPoints == 0 then print("There are no captured key frames but dataset transformation parameters were written to file: "..filename) return true end io.write("keyPoints = {}\n") for i = 1, #keyPoints do io.write("keyPoints[".. i .."] = ".. cameraToString(keyPoints[i]) .."\n") end io.flush() io.close() print("Wrote ".. #keyPoints .." captured key frames to file: ".. filename) return true end -- animation stuff ****************************************************************************************** -- basic vector calculus function vminus(a, b) return {x=a.x-b.x, y=a.y-b.y, z=a.z-b.z} end function vadd(a, b) return {x=a.x+b.x, y=a.y+b.y, z=a.z+b.z} end function vlength(v) return math.sqrt(v.x*v.x + v.y*v.y + v.z*v.z) end function vnormalize(v) local len = vlength(v) return {x=v.x/len, y=v.y/len, z=v.z/len} end function vscale(v, scale) return {x=v.x*scale, y=v.y*scale, z=v.z*scale} end -- scale and bias a 'value' from the 'i' range to the 'o' range function remap(value, imin, imax, omin, omax) return omin + (value-imin) * ((omax-omin)/(imax-imin)) end -- linear interpolation between two values function lerp(a, b, u) assert(0.0 <= u and u <= 1.0) return (1-u) * a + u * b end -- linear interpolation between two vectors function vlerp(v0, v1, u) return {x=lerp(v0.x, v1.x, u), y=lerp(v0.y, v1.y, u), z=lerp(v0.z, v1.z, u)} end -- evaluate decasteljau algorithm for given curve parameter u [0, 1] function decasteljau(p00, p01, p02, p03, u) -- first gen points local p10 = vlerp(p00, p01, u) local p11 = vlerp(p01, p02, u) local p12 = vlerp(p02, p03, u) -- second gen points local p20 = vlerp(p10, p11, u) local p21 = vlerp(p11, p12, u) -- third gen points local p30 = vlerp(p20, p21, u) -- return both bezier segments -- [3] p30 is the sampled point return {p10, p20, p30, p21, p12} end -- compute tangents for bezier curve from key points function computeTangents(p0, p1, p2, p3) local c = vlength(vminus(p2, p1)) local alpha = c / 2 if (alpha == 0.0) then --print('KEY POINTS ARE IDENTICAL') return p1, p2 end local q1 = vadd(p1, vscale(vnormalize(vminus(p2, p0)), alpha)) local q2 = vadd(p2, vscale(vnormalize(vminus(p1, p3)), alpha)) return q1, q2 end -- adaptively sample arc length parameterization of bezier curve function adaptivelySampleBezierCurve(p1, q1, q2, p2, uA, uB, epsilon, samples) local segments = decasteljau(p1, q1, q2, p2, 0.5) local p = segments[3] local a = vlength(vminus(p, p1)) local b = vlength(vminus(p2, p)) local c = vlength(vminus(p2, p1)) -- subdivide curve segment if triangle is too large and recurse if math.abs(c - (a + b)) > epsilon then local u = (uB - uA) / 2 adaptivelySampleBezierCurve(p1, segments[1], segments[2], p, uA - u, uA, epsilon, samples) adaptivelySampleBezierCurve(p, segments[4], segments[5], p2, uB - u, uB, epsilon, samples) else local lastEntry = samples[#samples] local newEntryA = {distance = lastEntry.distance + a, parameter = uA} local newEntryB = {distance = newEntryA.distance + b, parameter = uB} table.insert(samples, newEntryA) table.insert(samples, newEntryB) end end -- initialize arc length parametrization for given segment defined by four key points function sampleArcLengthForSegment(p0, p1, p2, p3, u, epsilon, samples) local q1, q2 = computeTangents(p0, p1, p2, p3) adaptivelySampleBezierCurve(p1, q1, q2, p2, u, u+0.5, epsilon, samples) end -- compute arc length lookup table function sampleArcLength(keyPoints, frameCount) local distance = 0 for i = 4,#keyPoints do local d = vlength(vminus(keyPoints[i-1].eye, keyPoints[i-2].eye)) --print("distance " .. i-2 .. " to " .. i-1 .. ": " .. d) distance = distance + d end print("Linear distance: ".. distance) -- sample curve according to epsilon threshold local epsilon = distance / frameCount print("Split epsilon: ".. epsilon) local samples = {} samples[1] = {distance=0, parameter=2} for i = 4,#keyPoints do sampleArcLengthForSegment(keyPoints[i-3].eye, keyPoints[i-2].eye, keyPoints[i-1].eye, keyPoints[i].eye, i-1.5, epsilon, samples) end --for i = 1, #samples do print(i .."\t".. samples[i].distance .."\t".. samples[i].parameter) end print("Sampled distance: ".. samples[#samples].distance .." (".. #samples .." samples)") return samples end -- interpolate camera properties for given traveled distance s function animateCamera(keyPoints, lookup, s, indexHint) assert(lookup[1].distance == 0.0) if s < 0.0 then s = 0.0 print("CLAMPED S TO MIN VALUE") elseif s > lookup[#lookup].distance then s = lookup[#lookup].distance print("CLAMPED S TO MAX VALUE") end -- find first index that distance is equal or larger than s if indexHint < 2 then indexHint = 2 elseif indexHint > #lookup then indexHint = #lookup end local idx = indexHint -- default should be 2 while lookup[idx].distance < s do idx = idx + 1 end -- interpolate u local u = remap(s, lookup[idx-1].distance, lookup[idx].distance, lookup[idx-1].parameter, lookup[idx].parameter) local i = math.floor(u) -- key point index local w = u - i -- local curve parameter --print("u: ".. u .." i: ".. i .." w: ".. w) if i == u then print("EARLY EXIT") return keyPoints[i], idx -- early exit, we hit exactly a key point end local p0, p1, p2, p3 = keyPoints[i-1], keyPoints[i], keyPoints[i+1], keyPoints[i+2] local q1, q2 = {}, {} q1.eye, q2.eye = computeTangents(p0.eye, p1.eye, p2.eye, p3.eye) q1.ref, q2.ref = computeTangents(p0.ref, p1.ref, p2.ref, p3.ref) q1.vup, q2.vup = computeTangents(p0.vup, p1.vup, p2.vup, p3.vup) local Eye = decasteljau(p1.eye, q1.eye, q2.eye, p2.eye, w)[3] local Ref = decasteljau(p1.ref, q1.ref, q2.ref, p2.ref, w)[3] local Vup = decasteljau(p1.vup, q1.vup, q2.vup, p2.vup, w)[3] -- now we can construct our new camera and return the last used lookup index to speed up next search return {eye=Eye, ref=Ref, vup=Vup}, idx end -- http://lua-users.org/wiki/CopyTable function deepcopy(object) local lookup_table = {} local function _copy(object) if type(object) ~= "table" then return object elseif lookup_table[object] then return lookup_table[object] end local new_table = {} lookup_table[object] = new_table for index, value in pairs(object) do new_table[_copy(index)] = _copy(value) end --return setmetatable(new_table, getmetatable(object)) return setmetatable(new_table, _copy( getmetatable(object))) end return _copy(object) end -- hot keys ************************************************************************************************* function key0Pressed() --print("key0Pressed()") -- capture key frame activeKeyPoint = activeKeyPoint + 1 insertKeyFrame(activeKeyPoint) end function key1Pressed() --print("key1Pressed()") -- jump to previous key frame jumpToKeyFrame(activeKeyPoint - 1) end function key2Pressed() --print("key2Pressed()") -- jump to current key frame jumpToKeyFrame(activeKeyPoint) end function key3Pressed() --print("key3Pressed()") -- jump to next key frame jumpToKeyFrame(activeKeyPoint + 1) end function keyCommaOrPeriodPressed() --print("keyCommaOrPeriodPressed()") -- delete key frame deleteKeyFrame(activeKeyPoint) end function keyEnterPressed() --print("keyEnterPressed()") -- print key frames printKeyFrames() end function keySlashPressed() --print("keySlashPressed()") -- write key frames to file if writeKeyFramesToFile(filename .."-KeyFrames".. string.format("%02d", outputSequence) ..".txt") then outputSequence = outputSequence + 1 end end -- parameters for the animation preview loopAnimation = false -- do we want a looped animation preview? animation = {} -- prepared key points lookup = {} -- arc length lookup table indexHint = 1 -- (currently not used) distance = 0 -- total arc length for the whole animation path (will be computed) delta = 0.000 -- distance that should be traveled on keyPlusPressed()/keyMinusPressed() (good starting value is 0.005) frameCount = 20 -- used frame count if delta is set to zero s = 0 -- current arc length function keyAsteriskPressed() --print("keyAsteriskPressed()") -- prepare animation preview animation = deepcopy(keyPoints) if loopAnimation then -- prepend last point and append first point to form a perfect loop (first and last frame will be identical) table.insert(animation, 1, animation[#animation]) -- we need the last point here to have the right tangent for the first point table.insert(animation, animation[2]) -- we need the original first point to have the right tangent for the last point table.insert(animation, animation[3]) -- we need one more point to make sure to end up at the first point again else -- just duplicate first and last key point table.insert(animation, 1, animation[1]) table.insert(animation, animation[#animation]) end lookup = sampleArcLength(animation, 100000) distance = lookup[#lookup].distance if delta == 0 then delta = distance / frameCount else frameCount = distance / delta end print("Animation delta is set to: ".. delta .." (resulting in ".. frameCount .." frames)") local idx = 1 while lookup[idx].parameter < (activeKeyPoint + 1) do idx = idx + 1 end s = lookup[idx].distance collectgarbage() print("Prepared animation. Set current arc length according to active key point (".. activeKeyPoint ..") to: ".. s) end function keyMinusPressed() --print("keyMinusPressed()") s = s - delta if s < 0 then print("WRAPPED AROUND to the last animation frame") s = distance end local cam, hint = animateCamera(animation, lookup, s, indexHint) activeKeyPoint = math.floor(lookup[hint].parameter) - 1 print("Animated. Set active key point according to current arc length (".. s ..") to: ".. activeKeyPoint) indexHint = 1 setCamera(cam) end function keyPlusPressed() --print("keyPlusPressed()") s = s + delta if s > distance then print("WRAPPED AROUND to the first animation frame") s = 0 end local cam, hint = animateCamera(animation, lookup, s, indexHint) activeKeyPoint = math.floor(lookup[hint].parameter) - 1 print("Animated. Set active key point according to current arc length (".. s ..") to: ".. activeKeyPoint) indexHint = 1 setCamera(cam) end ImageVis3D-3.1.0/LuaScripts/BatchRenderer.lua0000644000175000017500000000274412320517543020575 0ustar mathieumathieudescription = [[ ******************************************************************************** Brief: Example ImageVis3D batch renderer. Author: James Hughes Date: December 2012 ******************************************************************************** ]] print(description) -- Program arguments? dataset = "/Users/jhughes/sci/datasets/c60.uvf" outputDir = "/Users/jhughes/sci/output/BatchRenderer" shadersDir = "/Users/jhughes/sci/imagevis3d/Tuvok/Shaders" -- Build 3D slice based volume renderer. -- Parameters are: renderer type, use only power of two textures, downsample to 8 bits, -- disable border, bias and scale TF. print("Initializing renderer") renderer = tuvok.renderer.new(tuvok.renderer.types.OpenGL_SBVR, false, false, false, false, false) -- Both load dataset and add shader path must be done before passing the context. renderer.loadDataset(dataset) renderer.addShaderPath(shadersDir) -- tuvok.createContext() is a function that is bound in BatchRenderer. -- Parameters are: Framebuffer width and height, color bits, depth bits, stencil -- bits, double buffer, and if visible. context = tuvok.createContext(640,480, 32,24,8, true, false) renderer.initialize(context) renderer.resize({640, 480}) renderer.setRendererTarget(tuvok.renderer.types.RT_Headless) renderer.paint() renderer.setRendererTarget(tuvok.renderer.types.RT_Capture) renderer.captureSingleFrame(outputDir .. '/render.png', true) renderer.cleanup() deleteClass(renderer) ImageVis3D-3.1.0/Tuvok/0000755000175000017500000000000012344277037014401 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/test/0000755000175000017500000000000012320456500015344 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/test/render/0000755000175000017500000000000012320456500016623 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/test/render/render.cpp0000644000175000017500000001047212320456500020612 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file render.cpp \author Tom Fogal SCI Institute University of Utah \brief Simple program to use Tuvok to render a dataset. */ #include "StdTuvokDefines.h" #include #include #include #include #include "Basics/SysTools.h" #include "Controller/Controller.h" #include "IO/IOManager.h" #include "Renderer/AbstrRenderer.h" #include "Renderer/ContextIdentification.h" #include "Renderer/GL/GLContext.h" #include "Renderer/GL/GLFBOTex.h" #include "Renderer/GL/GLFrameCapture.h" #include "Renderer/GL/GLRenderer.h" #include "LuaScripting/LuaScripting.h" #include "LuaScripting/TuvokSpecific/LuaTuvokTypes.h" #include "context.h" using namespace tuvok; int main(int argc, const char *argv[]) { std::string filename; try { TCLAP::CmdLine cmd("rendering test program"); TCLAP::ValueArg dset("d", "dataset", "Dataset to render.", true, "", "filename"); cmd.add(dset); cmd.parse(argc, argv); filename = dset.getValue(); } catch(const TCLAP::ArgException& e) { std::cerr << "error: " << e.error() << " for arg " << e.argId() << "\n"; return EXIT_FAILURE; } try { std::auto_ptr ctx(TvkContext::Create(640,480, 32,24,8, true)); if(!ctx->isValid() || ctx->makeCurrent() == false) { T_ERROR("Could not utilize context."); return EXIT_FAILURE; } Controller::Instance().DebugOut()->SetOutput(true,true,true,true); // Convert the data into a UVF. std::string uvf_file; uvf_file = SysTools::RemoveExt(filename) + ".uvf"; const std::string tmpdir = "/tmp/"; const bool quantize8 = false; Controller::Const().IOMan().ConvertDataset( filename, uvf_file, tmpdir, true, 256, 4, quantize8 ); // AbstrRenderer* ren; // ren = Controller::Instance().RequestNewVolumeRenderer( // MasterController::OPENGL_SBVR, false, false, false, false, false // ); std::shared_ptr ss = Controller::Instance().LuaScript(); LuaClassInstance luaRen = ss->cexecRet( "tuvok.renderer.new", int(MasterController::OPENGL_SBVR), false, false, false, false, false); ss->cexec(luaRen.fqName() + ".loadDataset", uvf_file); ss->cexec(luaRen.fqName() + ".addShaderPath", "../../Shaders"); ss->cexec(luaRen.fqName() + ".initialize", GLContext::Current(0)); ss->cexec(luaRen.fqName() + ".resize", UINTVECTOR2(640,480)); ss->cexec(luaRen.fqName() + ".setRendererTarget",AbstrRenderer::RT_HEADLESS); ss->cexec(luaRen.fqName() + ".paint"); AbstrRenderer* ren = luaRen.getRawPointer(ss); GLRenderer* glren = dynamic_cast(ren); GLFBOTex* fbo = glren->GetLastFBO(); GLTargetBinder bind(&Controller::Instance()); GLFrameCapture fc; fc.CaptureSingleFrame("test.png", fbo); ss->cexec(luaRen.fqName() + ".cleanup"); Controller::Instance().ReleaseVolumeRenderer(ren); } catch(const std::exception& e) { std::cerr << "Exception: " << e.what() << "\n"; return EXIT_FAILURE; } return EXIT_SUCCESS; } ImageVis3D-3.1.0/Tuvok/test/render/render.pro0000644000175000017500000000376412320456500020636 0ustar mathieumathieuTEMPLATE = app CONFIG += exceptions qt rtti staticlib static stl warn_on TARGET = tuvok p = . ../ ../../ p += ../../Basics/3rdParty p += ../../IO/3rdParty p += ../../IO/3rdParty/boost p += ../../3rdParty/GLEW DEPENDPATH = $$p INCLUDEPATH = $$p macx:INCLUDEPATH += /usr/X11R6/include macx:QMAKE_LIBDIR+= /usr/X11R6/lib QMAKE_LIBDIR += ../../Build ../../IO/expressions QT += opengl LIBS += -lTuvok -ltuvokexpr -lz unix:LIBS += -lGL -lX11 unix:!macx:LIBS += -lGLU # Try to link to GLU statically. gludirs = /usr/lib /usr/lib/x86_64-linux-gnu for(d, gludirs) { if(exists($${d}/libGLU.a) && static) { LIBS -= -lGLU; LIBS += $${d}/libGLU.a } } unix:QMAKE_CXXFLAGS += -std=c++0x unix:QMAKE_CXXFLAGS += -fno-strict-aliasing -g unix:QMAKE_CFLAGS += -fno-strict-aliasing -g macx:QMAKE_CXXFLAGS += -stdlib=libc++ -mmacosx-version-min=10.7 macx:QMAKE_CFLAGS += -mmacosx-version-min=10.7 macx:LIBS += -stdlib=libc++ -framework CoreFoundation -mmacosx-version-min=10.7 ### Should we link Qt statically or as a shared lib? # Find the location of QtCore's prl file, and include it here so we can look at # the QMAKE_PRL_CONFIG variable. TEMP = $$[QT_INSTALL_LIBS] libQtCore.prl PRL = $$[QT_INSTALL_LIBS] QtCore.framework/QtCore.prl TEMP = $$join(TEMP, "/") PRL = $$join(PRL, "/") exists($$TEMP) { include($$join(TEMP, "/")) } exists($$PRL) { include($$join(PRL, "/")) } # If that contains the `shared' configuration, the installed Qt is shared. # In that case, disable the image plugins. contains(QMAKE_PRL_CONFIG, shared) { QTPLUGIN -= qgif qjpeg } else { QTPLUGIN += qgif qjpeg } SOURCES += \ ../context.cpp \ render.cpp unix:!macx { SOURCES += ../glx-context.cpp } macx { SOURCES += ../cgl-context.cpp ../agl-context.cpp } win32 { SOURCES += ../wgl-context.cpp } HEADERS += \ ../context.h \ ../cgl-context.h \ ../glx-context.h \ ../wgl-context.h ImageVis3D-3.1.0/Tuvok/test/wgl-context.h0000644000175000017500000000341512320456500017773 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef TUVOK_WGL_CONTEXT_H #define TUVOK_WGL_CONTEXT_H #include #include "context.h" namespace tuvok { struct winfo; class TvkWGLContext : public TvkContext { public: TvkWGLContext(uint32_t w, uint32_t h, uint8_t color_bits, uint8_t depth_bits, uint8_t stencil_bits, bool double_buffer, bool visible); virtual ~TvkWGLContext(); bool isValid() const; bool makeCurrent(); bool swapBuffers(); private: std::shared_ptr wi; }; } #endif /* TUVOK_WGL_CONTEXT_H */ ImageVis3D-3.1.0/Tuvok/test/context.cpp0000644000175000017500000000537112320456500017542 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file context.cpp \author Tom Fogal SCI Institute University of Utah \brief Establishes an OpenGL context. */ #include "StdTuvokDefines.h" #include #include #include "Controller/Controller.h" #include "context.h" #include "agl-context.h" #include "cgl-context.h" #include "glx-context.h" #include "wgl-context.h" namespace tuvok { TvkContext::~TvkContext() { } TvkContext* TvkContext::Create(uint32_t width, uint32_t height, uint8_t color_bits, uint8_t depth_bits, uint8_t stencil_bits, bool double_buffer, bool visible) { TvkContext* ctx; #ifdef DETECTED_OS_WINDOWS ctx = new TvkWGLContext(width, height, color_bits, depth_bits, stencil_bits, double_buffer, visible); #elif defined(DETECTED_OS_APPLE) && defined(USE_CGL) ctx = new TvkCGLContext(width, height, color_bits, depth_bits, stencil_bits, double_buffer, visible); #elif defined(DETECTED_OS_APPLE) ctx = new TvkAGLContext(width, height, color_bits, depth_bits, stencil_bits, double_buffer, visible); #else ctx = new TvkGLXContext(width, height, color_bits, depth_bits, stencil_bits, double_buffer, visible); #endif GLenum glerr = glewInit(); if(GLEW_OK != glerr) { T_ERROR("Error initializing GLEW: %s", glewGetErrorString(glerr)); throw std::runtime_error("could not initialize GLEW."); } return ctx; } } ImageVis3D-3.1.0/Tuvok/test/glx-context.h0000644000175000017500000000352412320456500017775 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef TUVOK_GLX_CONTEXT_H #define TUVOK_GLX_CONTEXT_H #include "StdTuvokDefines.h" #include #include "context.h" namespace tuvok { struct xinfo; class TvkGLXContext: public TvkContext { public: TvkGLXContext(uint32_t w, uint32_t h, uint8_t color_bits, uint8_t depth_bits, uint8_t stencil_bits, bool double_buffer, bool visible); virtual ~TvkGLXContext(); bool isValid() const; bool makeCurrent(); bool swapBuffers(); private: std::shared_ptr xi; }; } #endif /* TUVOK_GLX_CONTEXT_H */ ImageVis3D-3.1.0/Tuvok/test/context.h0000644000175000017500000000441212320456500017202 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file context.cpp \author Tom Fogal SCI Institute University of Utah \brief Simple wrapper for establishing an OpenGL context. */ #ifndef TUVOK_TEST_CONTEXT_H #define TUVOK_TEST_CONTEXT_H #include "StdTuvokDefines.h" #include #include namespace tuvok { class TvkContext { public: virtual ~TvkContext(); // Virtual coonstructor for appropriate kind of context. static TvkContext* Create(uint32_t width, uint32_t height, uint8_t color_bits=32, uint8_t depth_bits=24, uint8_t stencil_bits=8, bool double_buffer=true, bool visible=false); virtual bool isValid() const=0; virtual bool makeCurrent()=0; virtual bool swapBuffers()=0; }; class NoAvailableContext : public std::exception { public: virtual ~NoAvailableContext() throw() {} virtual const char* what() const throw() { return "No context was available to utilize."; } }; } #endif // TUVOK_TEST_CONTEXT_H ImageVis3D-3.1.0/Tuvok/test/context/0000755000175000017500000000000012320456500017030 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/test/context/context.pro0000644000175000017500000000376512320456500021251 0ustar mathieumathieuTEMPLATE = app CONFIG += exceptions qt rtti staticlib static stl warn_on TARGET = tvktest p = . ../ ../../ p += ../../Basics/3rdParty p += ../../IO/3rdParty p += ../../IO/3rdParty/boost p += ../../3rdParty/GLEW DEPENDPATH = $$p INCLUDEPATH = $$p macx:INCLUDEPATH += /usr/X11R6/include macx:QMAKE_LIBDIR+= /usr/X11R6/lib QMAKE_LIBDIR += ../../Build ../../IO/expressions QT += opengl LIBS += -lTuvok -ltuvokexpr -lz unix:LIBS += -lGL -lX11 unix:!macx:LIBS += -lGLU # Try to link to GLU statically. gludirs = /usr/lib /usr/lib/x86_64-linux-gnu for(d, gludirs) { if(exists($${d}/libGLU.a) && static) { LIBS -= -lGLU; LIBS += $${d}/libGLU.a } } unix:QMAKE_CXXFLAGS += -std=c++0x unix:QMAKE_CXXFLAGS += -fno-strict-aliasing -g unix:QMAKE_CFLAGS += -fno-strict-aliasing -g macx:QMAKE_CXXFLAGS += -stdlib=libc++ -mmacosx-version-min=10.7 macx:QMAKE_CFLAGS += -mmacosx-version-min=10.7 macx:LIBS += -stdlib=libc++ -framework CoreFoundation -mmacosx-version-min=10.7 ### Should we link Qt statically or as a shared lib? # Find the location of QtCore's prl file, and include it here so we can look at # the QMAKE_PRL_CONFIG variable. TEMP = $$[QT_INSTALL_LIBS] libQtCore.prl PRL = $$[QT_INSTALL_LIBS] QtCore.framework/QtCore.prl TEMP = $$join(TEMP, "/") PRL = $$join(PRL, "/") exists($$TEMP) { include($$join(TEMP, "/")) } exists($$PRL) { include($$join(PRL, "/")) } # If that contains the `shared' configuration, the installed Qt is shared. # In that case, disable the image plugins. contains(QMAKE_PRL_CONFIG, shared) { QTPLUGIN -= qgif qjpeg } else { QTPLUGIN += qgif qjpeg } SOURCES += \ ../context.cpp \ empty.cpp unix:!macx { SOURCES += ../glx-context.cpp } macx { SOURCES += ../cgl-context.cpp ../agl-context.cpp } win32 { SOURCES += ../wgl-context.cpp } HEADERS += \ ../context.h \ ../cgl-context.h \ ../glx-context.h \ ../wgl-context.h ImageVis3D-3.1.0/Tuvok/test/context/empty.cpp0000644000175000017500000000507012320456500020674 0ustar mathieumathieu/** \brief Empty program which does OGL init; for simple testing. */ #include "StdTuvokDefines.h" #include #include #include #include #include #include "Controller/Controller.h" #include "context.h" using namespace tuvok; uint32_t windowWidth = 4, windowHeight = 4; int main(int, const char *[]) { try { std::auto_ptr ctx(TvkContext::Create(windowWidth,windowHeight, 32, 24, 8, true)); Controller::Instance().DebugOut()->SetOutput(true,true,true,true); GL(glClearColor(0.1f, 0.2f, 0.3f, 1.0f)); GL(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)); GLubyte* pixels = new GLubyte[windowWidth*windowHeight*4]; GL(glReadPixels(0, 0, windowWidth, windowHeight, GL_RGBA, GL_UNSIGNED_BYTE, pixels)); for (uint32_t v = 0;v #include "context.h" namespace tuvok { struct cinfo; class TvkAGLContext : public TvkContext { public: TvkAGLContext(uint32_t w, uint32_t h, uint8_t color_bits, uint8_t depth_bits, uint8_t stencil_bits, bool double_buffer, bool visible); virtual ~TvkAGLContext(); bool isValid() const; bool makeCurrent(); bool swapBuffers(); private: std::shared_ptr ci; }; } #endif /* TUVOK_AGL_CONTEXT_H */ ImageVis3D-3.1.0/Tuvok/test/wgl-context.cpp0000644000175000017500000001474212320456500020333 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file context.cpp \author Tom Fogal SCI Institute University of Utah \brief Establishes an OpenGL context. */ #include "StdTuvokDefines.h" #ifdef DETECTED_OS_WINDOWS # include # include # include #else # include #endif #include "Controller/Controller.h" #include "wgl-context.h" #include namespace tuvok { struct winfo { HDC deviceContext; HGLRC renderingContext; HWND window; }; static void outputLastError() { DWORD lastError = GetLastError(); LPVOID msgBuffer; FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, lastError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&msgBuffer, 0, NULL ); T_ERROR("Win32 error: %s", std::string((LPSTR)msgBuffer)); LocalFree(msgBuffer); } TvkWGLContext::TvkWGLContext(uint32_t w, uint32_t h, uint8_t color_bits, uint8_t depth_bits, uint8_t stencil_bits, bool double_buffer, bool visible) : wi(new struct winfo()) { wi->deviceContext = NULL; wi->renderingContext = NULL; wi->window = NULL; if(w == 0 || h == 0 || !(color_bits==8 || color_bits==16 || color_bits==24 || color_bits==32) || !(depth_bits==8 || depth_bits==16 || depth_bits==24 || depth_bits==32 || depth_bits==0) || !(stencil_bits == 0 || stencil_bits == 8)) { T_ERROR("Invalid parameters passed to constructor."); throw NoAvailableContext(); } wi->window = CreateWindowExW(WS_EX_TOOLWINDOW, L"Static", L"GLContextWindow", WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN , 0, 0, w, h, 0, 0, GetModuleHandle(NULL), 0); if (!wi->window) { outputLastError(); return; } if(visible) { ShowWindow(wi->window, SW_SHOW); } else { ShowWindow(wi->window, SW_HIDE); } wi->deviceContext = GetDC(wi->window); if(!wi->deviceContext) { // GetDC doesn't SetLastError, but this still works anyway... outputLastError(); DestroyWindow(wi->window); throw NoAvailableContext(); } PIXELFORMATDESCRIPTOR pfd; pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); pfd.nVersion = 1; pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_TYPE_RGBA; if (double_buffer) pfd.dwFlags |= PFD_DOUBLEBUFFER; pfd.iPixelType = PFD_TYPE_RGBA; pfd.cColorBits = color_bits; pfd.cRedBits = 0; pfd.cRedShift = 0; pfd.cGreenBits = 0; pfd.cGreenShift = 0; pfd.cBlueBits = 0; pfd.cBlueShift = 0; pfd.cAlphaBits = 0; pfd.cAlphaShift = 0; pfd.cAccumBits = 0; pfd.cAccumRedBits = 0; pfd.cAccumGreenBits = 0; pfd.cAccumBlueBits = 0; pfd.cAccumAlphaBits = 0; pfd.cDepthBits = depth_bits; pfd.cStencilBits = stencil_bits; pfd.cAuxBuffers = 0; pfd.iLayerType = PFD_MAIN_PLANE; pfd.bReserved = 0; pfd.dwLayerMask = 0; pfd.dwVisibleMask = 0; pfd.dwDamageMask = 0; int pixelFormat = ChoosePixelFormat(wi->deviceContext, &pfd); if (!pixelFormat) { outputLastError(); ReleaseDC(wi->window, wi->deviceContext); DestroyWindow(wi->window); throw NoAvailableContext(); } PIXELFORMATDESCRIPTOR pfdResult; DescribePixelFormat(wi->deviceContext, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfdResult); if (!(pfdResult.dwFlags & PFD_SUPPORT_OPENGL)) { T_ERROR("No OpenGL support."); ReleaseDC(wi->window, wi->deviceContext); DestroyWindow(wi->window); throw NoAvailableContext(); } if (double_buffer && !(pfdResult.dwFlags & PFD_DOUBLEBUFFER)) { WARNING("No double buffer support!"); } std::ostringstream ss; if (pfdResult.cColorBits != color_bits) { ss << "Color bits requested: " << color_bits << ", actual color bits: " << pfdResult.cColorBits << "\n"; } if (pfdResult.cDepthBits != depth_bits) { ss << "Depth bits requested " << depth_bits << ", actual depth bits: " << pfdResult.cDepthBits << "\n"; } if (pfdResult.cStencilBits != stencil_bits) { ss << "Stencil bits requested " << stencil_bits << ", actual stencil bits:" << pfdResult.cStencilBits << "\n"; } MESSAGE("%s", ss.str().c_str()); if (!SetPixelFormat(wi->deviceContext, pixelFormat, &pfd)) { outputLastError(); ReleaseDC(wi->window, wi->deviceContext); DestroyWindow(wi->window); throw NoAvailableContext(); } wi->renderingContext = wglCreateContext(wi->deviceContext); if (!wi->renderingContext) { outputLastError(); ReleaseDC(wi->window, wi->deviceContext); DestroyWindow(wi->window); throw NoAvailableContext(); } makeCurrent(); } TvkWGLContext::~TvkWGLContext() { wglDeleteContext(wi->renderingContext); ReleaseDC(wi->window, wi->deviceContext); DestroyWindow(wi->window); } bool TvkWGLContext::isValid() const { // Object would not be created otherwise (throw in constructor) return true; } bool TvkWGLContext::makeCurrent() { if(!wglMakeCurrent(wi->deviceContext, wi->renderingContext)) { outputLastError(); return false; } return true; } bool TvkWGLContext::swapBuffers() { if(!isValid()) { return false; } if(!SwapBuffers(wi->deviceContext)) { outputLastError(); return false; } return true; } } /* tuvok namespace */ ImageVis3D-3.1.0/Tuvok/test/cgl-context.cpp0000644000175000017500000000570512320456500020306 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include "cgl-context.h" #include "Controller/Controller.h" namespace tuvok { struct cinfo { CGLPixelFormatObj pix; CGLContextObj ctx; }; TvkCGLContext::TvkCGLContext(uint32_t, uint32_t, uint8_t color_bits, uint8_t depth_bits, uint8_t stencil_bits, bool double_buffer, bool) : ci(new struct cinfo()) { ci->pix = NULL; ci->ctx = NULL; CGLPixelFormatAttribute attribs[] = { kCGLPFAColorSize, static_cast(color_bits), kCGLPFAAlphaSize, static_cast(8), kCGLPFADepthSize, static_cast(depth_bits), kCGLPFAStencilSize, static_cast(stencil_bits), double_buffer ? kCGLPFADoubleBuffer : static_cast(0), static_cast(NULL) }; int nscreens; CGLError glerr; glerr = CGLChoosePixelFormat(attribs, &ci->pix, &nscreens); if(glerr != kCGLNoError) { T_ERROR("CGL pixel format error: %d", static_cast(glerr)); throw std::runtime_error("CGL error."); } glerr = CGLCreateContext(ci->pix, NULL, &ci->ctx); if(glerr != kCGLNoError) { T_ERROR("CGL ctx creation error: %d", static_cast(glerr)); throw std::runtime_error("CGL error."); } } TvkCGLContext::~TvkCGLContext() { CGLReleaseContext(ci->ctx); CGLReleasePixelFormat(ci->pix); } bool TvkCGLContext::isValid() const { return ci->ctx != NULL; } bool TvkCGLContext::makeCurrent() { return CGLSetCurrentContext(ci->ctx) == kCGLNoError; } bool TvkCGLContext::swapBuffers() { return CGLFlushDrawable(ci->ctx) == kCGLNoError; } } ImageVis3D-3.1.0/Tuvok/test/glx-context.cpp0000644000175000017500000001305412320456500020327 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "StdTuvokDefines.h" #include #include #include "glx-context.h" #include "Controller/Controller.h" namespace tuvok { struct xinfo { Display *display; XVisualInfo *visual; Window win; GLXContext ctx; Colormap cmap; }; static struct xinfo x_connect(uint32_t, uint32_t, bool, bool); static XVisualInfo* find_visual(Display*, bool); static void glx_init(Display*, XVisualInfo*, GLXContext&); TvkGLXContext::TvkGLXContext(uint32_t w, uint32_t h, uint8_t, uint8_t, uint8_t, bool double_buffer, bool visible) : xi(new struct xinfo()) { #ifndef NDEBUG // Enable X debugging. _Xdebug = 1; #endif // if you *really* require a specific value... just hack this class // to your liking. You probably want to add those parameters to x_connect // and use them there. WARNING("Ignoring color, depth, stencil bits. For many applications, it " "is better to let the GLX library choose the \"best\" visual."); *this->xi = x_connect(w, h, double_buffer, visible); glx_init(xi->display, xi->visual, xi->ctx); this->makeCurrent(); MESSAGE("Current context: %p", glXGetCurrentContext()); } TvkGLXContext::~TvkGLXContext() { glXDestroyContext(xi->display, xi->ctx); XDestroyWindow(xi->display, xi->win); XFree(xi->visual); XCloseDisplay(xi->display); xi.reset(); } bool TvkGLXContext::isValid() const { return this->xi->display != NULL && this->xi->ctx != NULL; } bool TvkGLXContext::makeCurrent() { if(glXMakeCurrent(this->xi->display, this->xi->win, this->xi->ctx) != True) { T_ERROR("Could not make context current!"); return false; } return true; } bool TvkGLXContext::swapBuffers() { glXSwapBuffers(this->xi->display, this->xi->win); // SwapBuffers generates an X error if it fails. return true; } static struct xinfo x_connect(uint32_t width, uint32_t height, bool dbl_buffer, bool visible) { struct xinfo rv; rv.display = XOpenDisplay(NULL); if(rv.display == NULL) { T_ERROR("Could not connect to display: '%s'!", XDisplayName(NULL)); throw NoAvailableContext(); } XSynchronize(rv.display, True); rv.visual = find_visual(rv.display, dbl_buffer); Window parent = RootWindow(rv.display, rv.visual->screen); XSetWindowAttributes xw_attr; xw_attr.override_redirect = False; xw_attr.background_pixel = 0; xw_attr.colormap = XCreateColormap(rv.display, parent, rv.visual->visual, AllocNone); xw_attr.event_mask = StructureNotifyMask | ExposureMask; // X will create BadValue exceptions if these aren't true... much easier to // debug via asserts. assert(rv.visual->depth > 0); assert(width > 0); assert(height > 0); rv.win = XCreateWindow(rv.display, parent, 0,0, width,height, 0, rv.visual->depth, InputOutput, rv.visual->visual, CWBackPixel | CWBorderPixel | CWColormap | CWOverrideRedirect | CWEventMask, &xw_attr); XStoreName(rv.display, rv.win, "Tuvok"); if(visible) { if(XMapRaised(rv.display, rv.win) != 0) { T_ERROR("Could not map window!"); throw std::runtime_error("could not map window"); } } XSync(rv.display, False); return rv; } static void glx_init(Display *disp, XVisualInfo *visual, GLXContext& ctx) { if(!glXQueryExtension(disp, NULL, NULL)) { T_ERROR("Display does not support glX."); return; } ctx = glXCreateContext(disp, visual, 0, GL_TRUE); if(!ctx) { T_ERROR("glX Context creation failed."); } } static XVisualInfo * find_visual(Display *d, bool double_buffered) { XVisualInfo *ret_v; // GLX_USE_GL is basically a no-op, so this provides a convenient // way of specifying double buffering or not. int att_buf = double_buffered ? GLX_DOUBLEBUFFER : GLX_USE_GL; int attr[] = { GLX_RGBA, att_buf, GLX_RED_SIZE, 5, GLX_GREEN_SIZE, 6, GLX_BLUE_SIZE, 5, GLX_ALPHA_SIZE, 8, GLX_DEPTH_SIZE, 8, GLX_ACCUM_RED_SIZE, 0, GLX_ACCUM_GREEN_SIZE, 0, GLX_ACCUM_BLUE_SIZE, 0, None }; ret_v = glXChooseVisual(d, DefaultScreen(d), attr); MESSAGE("ChooseVisual got us %p", (const void*)ret_v); return ret_v; } } // namespace tuvok ImageVis3D-3.1.0/Tuvok/test/cgl-context.h0000644000175000017500000000341512320456500017747 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef TUVOK_CGL_CONTEXT_H #define TUVOK_CGL_CONTEXT_H #include #include "context.h" namespace tuvok { struct cinfo; class TvkCGLContext : public TvkContext { public: TvkCGLContext(uint32_t w, uint32_t h, uint8_t color_bits, uint8_t depth_bits, uint8_t stencil_bits, bool double_buffer, bool visible); virtual ~TvkCGLContext(); bool isValid() const; bool makeCurrent(); bool swapBuffers(); private: std::shared_ptr ci; }; } #endif /* TUVOK_CGL_CONTEXT_H */ ImageVis3D-3.1.0/Tuvok/test/agl-context.cpp0000644000175000017500000000553412320456500020304 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include "agl-context.h" #include "Controller/Controller.h" namespace tuvok { struct cinfo { AGLContext ctx; }; TvkAGLContext::TvkAGLContext(uint32_t, uint32_t, uint8_t color_bits, uint8_t depth_bits, uint8_t stencil_bits, bool double_buffer, bool visible) : ci(new struct cinfo()) { ci->ctx = NULL; GLint attribs[] = { AGL_BUFFER_SIZE, color_bits, AGL_RGBA, AGL_DEPTH_SIZE, depth_bits, AGL_STENCIL_SIZE, stencil_bits, AGL_NONE, // space for potential AGL_DOUBLEBUFFER AGL_NONE, // space for potential AGL_OFFSCREEN AGL_NONE, }; if(double_buffer && !visible) { attribs[sizeof(attribs)/sizeof(GLint) - 2] = AGL_DOUBLEBUFFER; attribs[sizeof(attribs)/sizeof(GLint) - 1] = AGL_OFFSCREEN; } else if(double_buffer) { attribs[sizeof(attribs)/sizeof(GLint) - 2] = AGL_DOUBLEBUFFER; } else if(!visible) { attribs[sizeof(attribs)/sizeof(GLint) - 2] = AGL_OFFSCREEN; } AGLPixelFormat pix; pix = aglCreatePixelFormat(attribs); ci->ctx = aglCreateContext(pix, NULL); if(ci->ctx == NULL) { T_ERROR("agl context creation error: %d", static_cast(aglGetError())); throw std::runtime_error("agl context creation error."); } aglDestroyPixelFormat(pix); } TvkAGLContext::~TvkAGLContext() { aglDestroyContext(ci->ctx); } bool TvkAGLContext::isValid() const { return ci->ctx != NULL; } bool TvkAGLContext::makeCurrent() { return aglSetCurrentContext(ci->ctx) == GL_TRUE; } bool TvkAGLContext::swapBuffers() { aglSwapBuffers(ci->ctx); return true; } } ImageVis3D-3.1.0/Tuvok/test/shaders/0000755000175000017500000000000012320456500016775 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/test/shaders/shaders.pro0000644000175000017500000000371612320456500021157 0ustar mathieumathieuTEMPLATE = app CONFIG += exceptions qt rtti staticlib static stl warn_on TARGET = shtest DEPENDPATH += . ../../ INCLUDEPATH += ../ INCLUDEPATH += ../../ ../../IO/3rdParty/boost INCLUDEPATH += ../../Basics/3rdParty INCLUDEPATH += ../../3rdParty/GLEW # for glX macx:INCLUDEPATH += /usr/X11R6/include macx:QMAKE_LIBDIR+= /usr/X11R6/lib QMAKE_LIBDIR += ../../Build ../../IO/expressions QT += opengl LIBS += -lTuvok -ltuvokexpr -lz unix:LIBS += -lGL -lX11 unix:QMAKE_CXXFLAGS += -std=c++0x unix:QMAKE_CXXFLAGS += -fno-strict-aliasing -g unix:QMAKE_CFLAGS += -fno-strict-aliasing -g unix:!macx:LIBS += -lGLU # Try to link to GLU statically. gludirs = /usr/lib /usr/lib/x86_64-linux-gnu for(d, gludirs) { if(exists($${d}/libGLU.a) && static) { LIBS -= -lGLU; LIBS += $${d}/libGLU.a } } macx:QMAKE_CXXFLAGS += -stdlib=libc++ -mmacosx-version-min=10.7 macx:QMAKE_CFLAGS += -mmacosx-version-min=10.7 macx:LIBS += -stdlib=libc++ -lX11 -framework CoreFoundation -mmacosx-version-min=10.7 ### Should we link Qt statically or as a shared lib? # Find the location of QtGui's prl file, and include it here so we can look at # the QMAKE_PRL_CONFIG variable. TEMP = $$[QT_INSTALL_LIBS] libQtCore.prl PRL = $$[QT_INSTALL_LIBS] QtCore.framework/QtCore.prl TEMP = $$join(TEMP, "/") PRL = $$join(PRL, "/") exists($$TEMP) { include($$join(TEMP, "/")) } exists($$PRL) { include($$join(PRL, "/")) } # If that contains the `shared' configuration, the installed Qt is shared. # In that case, disable the image plugins. contains(QMAKE_PRL_CONFIG, shared) { QTPLUGIN -= qgif qjpeg } else { QTPLUGIN += qgif qjpeg } SOURCES += \ ../context.cpp \ shadertest.cpp unix:!macx { SOURCES += ../glx-context.cpp } macx { SOURCES += ../cgl-context.cpp ../agl-context.cpp } win32 { SOURCES += ../wgl-context.cpp } HEADERS += \ ../context.h \ ../cgl-context.h \ ../glx-context.h \ ../wgl-context.h ImageVis3D-3.1.0/Tuvok/test/shaders/shadertest.cpp0000644000175000017500000001140212320456500021645 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \author Tom Fogal SCI Institute University of Utah \brief Tries to load all of Tuvok's shaders, to make sure they compile. */ #include "StdTuvokDefines.h" #include #include #include #include #include "Basics/SysTools.h" #include "Controller/Controller.h" #include "IO/IOManager.h" #include "Renderer/AbstrRenderer.h" #include "Renderer/ContextIdentification.h" #include "Renderer/GL/GLFBOTex.h" #include "Renderer/GL/GLFrameCapture.h" #include "Renderer/GL/GLRenderer.h" #include "LuaScripting/LuaScripting.h" #include "LuaScripting/TuvokSpecific/LuaTuvokTypes.h" #include "context.h" using namespace tuvok; int main(int argc, char *argv[]) { std::string filename; try { TCLAP::CmdLine cmd("shader test program"); TCLAP::ValueArg dset("d", "dataset", "Dataset to render.", true, "", "filename"); cmd.add(dset); cmd.parse(argc, argv); filename = dset.getValue(); } catch(const TCLAP::ArgException& e) { std::cerr << "error: " << e.error() << " for arg " << e.argId() << "\n"; return EXIT_FAILURE; } try { std::auto_ptr ctx(TvkContext::Create(320,240, 32,24,8, true)); Controller::Instance().DebugOut()->SetOutput(true,true,false,true); // Convert the data into a UVF. std::string uvf_file; uvf_file = SysTools::RemoveExt(filename) + ".uvf"; const std::string tmpdir = "/tmp/"; const bool quantize8 = false; Controller::Const().IOMan().ConvertDataset( filename, uvf_file, tmpdir, true, 256, 4, quantize8 ); AbstrRenderer* ren; std::shared_ptr ss = Controller::Instance().LuaScript(); for(int i=0; i < MasterController::RENDERER_LAST; ++i) { // ren = Controller::Instance().RequestNewVolumeRenderer( // static_cast(i), // false, false, false, false, false // ); LuaClassInstance luaRen = ss->cexecRet( "tuvok.renderer.new", i, false, false, false, false, false); if(ren != NULL) { ss->cexec(luaRen.fqName() + ".loadDataset", uvf_file); ss->cexec(luaRen.fqName() + ".addShaderPath", "../../Shaders"); ss->cexec(luaRen.fqName() + ".resize", UINTVECTOR2(100,100)); ss->cexec(luaRen.fqName() + ".initialize", GLContextID::Current(0)); ss->cexec(luaRen.fqName() + ".cleanup"); ren = luaRen.getRawPointer(ss); Controller::Instance().ReleaseVolumeRenderer(ren); } // again w/ Raycaster clip planes disabled. // ren = Controller::Instance().RequestNewVolumeRenderer( // static_cast(i), // false, false, false, true, false // ); luaRen = ss->cexecRet( "tuvok.renderer.new", i, false, false, false, true, false); if(ren != NULL) { ss->cexec(luaRen.fqName() + ".loadDataset", uvf_file); ss->cexec(luaRen.fqName() + ".addShaderPath", "../../Shaders"); ss->cexec(luaRen.fqName() + ".resize", UINTVECTOR2(100,100)); ss->cexec(luaRen.fqName() + ".initialize", GLContextID::Current(0)); ss->cexec(luaRen.fqName() + ".cleanup"); ren = luaRen.getRawPointer(ss); Controller::Instance().ReleaseVolumeRenderer(ren); } } } catch(const std::exception& e) { std::cerr << "Exception: " << e.what() << "\n"; return EXIT_FAILURE; } return EXIT_SUCCESS; } ImageVis3D-3.1.0/Tuvok/Basics/0000755000175000017500000000000012320456500015571 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/Basics/Threads.cpp0000644000175000017500000002042612320456500017673 0ustar mathieumathieu#include "Threads.h" #include "Controller/Controller.h" #ifndef DETECTED_OS_WINDOWS #include #include #endif namespace tuvok { CriticalSection::CriticalSection() { #ifdef DETECTED_OS_WINDOWS InitializeCriticalSection(&m_csIDGuard); #else pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); pthread_mutex_init(&m_csIDGuard, &attr); pthread_mutexattr_destroy(&attr); #endif } CriticalSection::~CriticalSection() { #ifdef DETECTED_OS_WINDOWS DeleteCriticalSection(&m_csIDGuard); #else pthread_mutex_destroy(&m_csIDGuard); #endif } void CriticalSection::Lock() { #ifdef DETECTED_OS_WINDOWS EnterCriticalSection(&m_csIDGuard); #else pthread_mutex_lock(&m_csIDGuard); #endif } bool CriticalSection::TryLock() { #ifdef _WIN32 return TryEnterCriticalSection(&m_csIDGuard)!=0; #else return pthread_mutex_trylock(&m_csIDGuard) == 0; #endif } void CriticalSection::Unlock() { #ifdef DETECTED_OS_WINDOWS LeaveCriticalSection(&m_csIDGuard); #else pthread_mutex_unlock (&m_csIDGuard); #endif } WaitCondition::WaitCondition() { #ifdef DETECTED_OS_WINDOWS InitializeConditionVariable(&m_cvWaitCondition); #else pthread_cond_init(&m_cvWaitCondition, NULL); #endif } WaitCondition::~WaitCondition() { #ifndef DETECTED_OS_WINDOWS pthread_cond_destroy(&m_cvWaitCondition); #endif } bool WaitCondition::Wait(CriticalSection& criticalSection, uint32_t timeoutInMilliseconds) { bool bWaitResult = false; #ifdef DETECTED_OS_WINDOWS if (timeoutInMilliseconds != INFINITE_TIMEOUT) bWaitResult = (SleepConditionVariableCS(&m_cvWaitCondition, &criticalSection.m_csIDGuard, (DWORD)timeoutInMilliseconds) != 0); else bWaitResult = (SleepConditionVariableCS(&m_cvWaitCondition, &criticalSection.m_csIDGuard, INFINITE) != 0); #else if (timeoutInMilliseconds != INFINITE_TIMEOUT) { timeval tv; timespec ts; gettimeofday(&tv, NULL); ts.tv_sec = tv.tv_sec + (timeoutInMilliseconds / 10000); ts.tv_nsec = tv.tv_usec * 1000; bWaitResult = (pthread_cond_timedwait(&m_cvWaitCondition, &criticalSection.m_csIDGuard, &ts) == 0); } else bWaitResult = (pthread_cond_wait(&m_cvWaitCondition, &criticalSection.m_csIDGuard) == 0); #endif return bWaitResult; } void WaitCondition::WakeOne() { #ifdef DETECTED_OS_WINDOWS WakeConditionVariable(&m_cvWaitCondition); #else pthread_cond_signal(&m_cvWaitCondition); #endif } void WaitCondition::WakeAll() { #ifdef DETECTED_OS_WINDOWS WakeAllConditionVariable(&m_cvWaitCondition); #else pthread_cond_broadcast(&m_cvWaitCondition); #endif } ThreadClass::ThreadClass() : m_bContinue(true) #ifdef DETECTED_OS_WINDOWS , m_hThread(NULL) #else // do not initialize m_hThread for pthreads! , m_bInitialized(false) , m_bJoinable(false) #endif , m_pStartData(NULL) , m_bResumable(false) {} bool ThreadClass::StartThread(void * pData) { if (!IsRunning()) { m_bContinue = true; m_bResumable = false; delete m_pStartData; m_pStartData = new ThreadData; m_pStartData->pThread = this; m_pStartData->pData = pData; #ifdef DETECTED_OS_WINDOWS if (m_hThread) CloseHandle(m_hThread); m_hThread = CreateThread(NULL, 0, StaticStartFunc, m_pStartData, NULL, 0); if (m_hThread) return true; #else m_bJoinable = false; if (pthread_create(&m_hThread, NULL, StaticStartFunc, (void*)m_pStartData) == 0) { m_bInitialized = true; m_bJoinable = true; pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); return true; } #endif } delete m_pStartData; m_pStartData = NULL; return false; } bool ThreadClass::JoinThread(uint32_t timeoutInMilliseconds) { #ifdef DETECTED_OS_WINDOWS // IsRunning() test is needed here so this behaves like pthread_join-based implementation below // pthread_join will fail on consecutive joins on the same thread (ESRCH, EINVAL) -> tested on Mac (return ESRCH, no such process) // while WaitForSingleObject returns success each time // consequently, JoinThread will return false if called on a thread not running anymore, even on first call if (IsRunning()) return (WaitForSingleObject(m_hThread, (DWORD)timeoutInMilliseconds) == WAIT_OBJECT_0); else return false; #else // behavior should be consistent with WaitForSingleObject like this // even in case of pthread_join returning immediately with EDEADLK, since we wait before calling it // but actually not sure what possible WaitForSingleObject error values are and in what way a deadlock may be handled // we assume a deadlock does not cause WaitForSingleObject to return immediately, which goes along with below pthread-based implementation bool performJoin = true; m_JoinMutex.Lock(); if (m_bJoinable) { if (!m_JoinWaitCondition.Wait(m_JoinMutex, timeoutInMilliseconds)) performJoin = false; } // handle ultra-rare case when thread set itself to non joinable, but has not returned yet (see StaticStartFunc) // or thread has not set itself to joinable yet, but is already running (see StartThread) // second case could be handled by using m_join_mutex in StartThread, but this handles both, so not necessary // we then perform a join as we know the thread will return immediately else if (!IsRunning()) performJoin = false; m_JoinMutex.Unlock(); if (performJoin) return (pthread_join(m_hThread, NULL) == 0); else return false; #endif } bool ThreadClass::KillThread() { #ifdef DETECTED_OS_WINDOWS return (TerminateThread(m_hThread, 0) != 0); #else return (pthread_cancel(m_hThread) == 0); #endif } bool ThreadClass::IsRunning() { #ifdef DETECTED_OS_WINDOWS // could use GetExitCodeThread here as well return (WaitForSingleObject(m_hThread, 0) == WAIT_TIMEOUT); #else if (!m_bInitialized) return false; else return (pthread_kill(m_hThread, 0) == 0); #endif } ThreadClass::~ThreadClass() { if (m_hThread) { #if defined(DETECTED_OS_WINDOWS) if (IsRunning()) { WARNING("Attempting to kill thread"); if(!KillThread()) { T_ERROR("Could not kill thread."); } else { WARNING("Thread successfully killed."); } } CloseHandle(m_hThread); #endif delete m_pStartData; m_pStartData = NULL; } } #ifdef DETECTED_OS_WINDOWS DWORD WINAPI ThreadClass::StaticStartFunc(LPVOID pThreadStarterData) { ThreadData * d = (ThreadData*)pThreadStarterData; d->pThread->ThreadMain(d->pData); return 0; } #else void * ThreadClass::StaticStartFunc(void * pThreadStarterData) { ThreadData * d = (ThreadData*)pThreadStarterData; d->pThread->ThreadMain(d->pData); d->pThread->m_JoinMutex.Lock(); d->pThread->m_bJoinable = false; d->pThread->m_JoinWaitCondition.WakeOne(); d->pThread->m_JoinMutex.Unlock(); return 0; } #endif // we may want to have Resume public // otherwise, a thread calling Suspend can never be resumed using only ThreadClass methods // if both are public and we would use SuspendThread, Suspend would not block on Windows (SuspendThread does not block), but it would on other systems // so to be consistent, we use wait condition based implementation in general // also, there is no way of suspending a thread from another thread in linux without handling this within the thread main method or using SIGSTOP/SIGCONT (linux only, non-portable) // so only way this makes sense and behaves similar on Windows and linux, etc. is with Suspend protected and Resume public/protected bool ThreadClass::Suspend(PredicateFunction pPredicate) { bool bSuspendResult = false; bool bSuspendable = false; m_SuspendGuard.Lock(); // check predicate if available and resumable state if (pPredicate) bSuspendable = pPredicate() && !m_bResumable; else bSuspendable = !m_bResumable; // suspend if there is no work to do if (bSuspendable) { m_bResumable = true; bSuspendResult = m_SuspendWait.Wait(m_SuspendGuard); } m_SuspendGuard.Unlock(); return bSuspendResult; } bool ThreadClass::Resume() { bool bResumeResult = false; m_SuspendGuard.Lock(); // wake thread if it was suspended before if (m_bResumable) { m_bResumable = false; bResumeResult = true; m_SuspendWait.WakeOne(); } m_SuspendGuard.Unlock(); return bResumeResult; } } ImageVis3D-3.1.0/Tuvok/Basics/MinMaxBlock.h0000644000175000017500000000415512320456500020113 0ustar mathieumathieu#ifndef TUVOK_MAX_MIN_BLOCK_H #define TUVOK_MAX_MIN_BLOCK_H #include #include namespace tuvok { /// Stores minimum and maximum data for a block of data. class MinMaxBlock { public: MinMaxBlock() : minScalar(DBL_MAX), maxScalar(-FLT_MAX), minGradient(DBL_MAX), maxGradient(-FLT_MAX) {} MinMaxBlock(double _minScalar, double _maxScalar, double _minGradient, double _maxGradient) : minScalar(_minScalar), maxScalar(_maxScalar), minGradient(_minGradient), maxGradient(_maxGradient) {} void Merge(const MinMaxBlock& other) { minScalar = std::min(minScalar, other.minScalar); maxScalar = std::max(maxScalar, other.maxScalar); minGradient = std::min(minGradient, other.minGradient); maxGradient = std::max(maxGradient, other.maxGradient); } double minScalar; double maxScalar; double minGradient; double maxGradient; }; } #endif /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2013 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/Basics/GeometryGenerator.h0000644000175000017500000000466712320456500021421 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GeometryGenerator.cpp \author Jens Krueger SCI Institute University of Utah \date Januar 2009 */ #pragma once #ifndef BASICS_GEOMETRYGENERATOR_H #define BASICS_GEOMETRYGENERATOR_H #include #include "StdDefines.h" #include "Vectors.h" namespace tuvok { class PosNormalVertex { public: PosNormalVertex(const FLOATVECTOR3& vPos = FLOATVECTOR3(0,0,0), const FLOATVECTOR3& vNormal = FLOATVECTOR3(1,0,0)) : m_vPos(vPos), m_vNormal(vNormal) {} FLOATVECTOR3 m_vPos; FLOATVECTOR3 m_vNormal; }; class Triangle { public: Triangle(const PosNormalVertex& a, const PosNormalVertex& b, const PosNormalVertex& c) { m_vertices[0] = a; m_vertices[1] = b; m_vertices[2] = c; } PosNormalVertex m_vertices[3];; }; /** \class GeometryGenerator */ class GeometryGenerator { public: static std::vector GenArrow(float fOverallLength, float fShaftToHeadRatio, float fShaftRadius, float fHeadRadius, uint32_t iSegments); }; } #endif // BASICS_GEOMETRYGENERATOR_H ImageVis3D-3.1.0/Tuvok/Basics/DynamicDX.h0000644000175000017500000002654512320456500017576 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DynamicDX.h \author Jens Krueger SCI Institute University of Utah \date January 2009 */ #pragma once #ifndef DYNAMICDX_H #define DYNAMICDX_H #if defined(_WIN32) && defined(USE_DIRECTX) #include "StdDefines.h" #include #include #include //----------------------------------------------------------------------------- // Defines, and constants //----------------------------------------------------------------------------- #ifndef SAFE_DELETE #define SAFE_DELETE(p) { if (p) { delete (p); (p)=NULL; } } #endif #ifndef SAFE_DELETE_ARRAY #define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p)=NULL; } } #endif #ifndef SAFE_RELEASE #define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p)=NULL; } } #endif #pragma warning( disable : 4995 ) // disable deprecated warning #include #pragma warning( default : 4995 ) enum DX10FormatDataType { FDT_TYPELESS, FDT_UNORM, FDT_UNORM_SRGB, FDT_SNORM, FDT_UINT, FDT_SINT, FDT_FLOAT, FDT_SHAREDEXP, }; class DX10Format { public: DX10FormatDataType m_DataType; unsigned int m_iChannelCount; unsigned int m_iByteSize; std::wstring m_strDesc; DX10Format() : m_DataType(FDT_TYPELESS), m_iChannelCount(0), m_iByteSize(0), m_strDesc(L"Invalid") { } DX10Format(DX10FormatDataType DataType, int iChannelCount, int iByteSize, std::wstring strDesc) : m_DataType(DataType), m_iChannelCount(iChannelCount), m_iByteSize(iByteSize), m_strDesc(strDesc) { } }; static DX10Format g_dx10Format[] = { DX10Format(FDT_TYPELESS, 0, 0, L"DXGI_FORMAT_UNKNOWN"), // = 0, DX10Format(FDT_TYPELESS, 4, 16, L"DXGI_FORMAT_R32G32B32A32_TYPELESS"), // = 1, DX10Format(FDT_FLOAT , 4, 16, L"DXGI_FORMAT_R32G32B32A32_FLOAT"), // = 2, DX10Format(FDT_UINT , 4, 16, L"DXGI_FORMAT_R32G32B32A32_UINT"), // = 3, DX10Format(FDT_SINT , 4, 16, L"DXGI_FORMAT_R32G32B32A32_SINT"), // = 4, DX10Format(FDT_TYPELESS, 3, 12, L"DXGI_FORMAT_R32G32B32_TYPELESS"), // = 5, DX10Format(FDT_FLOAT , 3, 12, L"DXGI_FORMAT_R32G32B32_FLOAT"), // = 6, DX10Format(FDT_UINT , 3, 12, L"DXGI_FORMAT_R32G32B32_UINT"), // = 7, DX10Format(FDT_SINT , 3, 12, L"DXGI_FORMAT_R32G32B32_SINT"), // = 8, DX10Format(FDT_TYPELESS, 4, 8, L"DXGI_FORMAT_R16G16B16A16_TYPELESS"), // = 9, DX10Format(FDT_FLOAT , 4, 8, L"DXGI_FORMAT_R16G16B16A16_FLOAT"), // = 10, DX10Format(FDT_UNORM , 4, 8, L"DXGI_FORMAT_R16G16B16A16_UNORM"), // = 11, DX10Format(FDT_UINT , 4, 8, L"DXGI_FORMAT_R16G16B16A16_UINT"), // = 12, DX10Format(FDT_SNORM , 4, 8, L"DXGI_FORMAT_R16G16B16A16_SNORM"), // = 13, DX10Format(FDT_SINT , 4, 8, L"DXGI_FORMAT_R16G16B16A16_SINT"), // = 14, DX10Format(FDT_TYPELESS, 2, 8, L"DXGI_FORMAT_R32G32_TYPELESS"), // = 15, DX10Format(FDT_FLOAT , 2, 8, L"DXGI_FORMAT_R32G32_FLOAT"), // = 16, DX10Format(FDT_UINT , 2, 8, L"DXGI_FORMAT_R32G32_UINT"), // = 17, DX10Format(FDT_SINT , 2, 8, L"DXGI_FORMAT_R32G32_SINT"), // = 18, DX10Format(FDT_TYPELESS, 3, 8, L"DXGI_FORMAT_R32G8X24_TYPELESS"), // = 19, DX10Format(FDT_FLOAT , 1, 4, L"DXGI_FORMAT_D32_FLOAT_S8X24_UINT"), // = 20, DX10Format(FDT_FLOAT , 1, 4, L"DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS"), // = 21, DX10Format(FDT_TYPELESS, 2, 4, L"DXGI_FORMAT_X32_TYPELESS_G8X24_UINT"), // = 22, DX10Format(FDT_TYPELESS, 4, 4, L"DXGI_FORMAT_R10G10B10A2_TYPELESS"), // = 23, DX10Format(FDT_UNORM , 4, 4, L"DXGI_FORMAT_R10G10B10A2_UNORM"), // = 24, DX10Format(FDT_UINT , 4, 4, L"DXGI_FORMAT_R10G10B10A2_UINT"), // = 25, DX10Format(FDT_FLOAT , 3, 4, L"DXGI_FORMAT_R11G11B10_FLOAT"), // = 26, DX10Format(FDT_TYPELESS , 4, 4, L"DXGI_FORMAT_R8G8B8A8_TYPELESS"), // = 27, DX10Format(FDT_UNORM , 4, 4, L"DXGI_FORMAT_R8G8B8A8_UNORM"), // = 28, DX10Format(FDT_UNORM_SRGB, 4, 4, L"DXGI_FORMAT_R8G8B8A8_UNORM_SRGB"), // = 29, DX10Format(FDT_UINT , 4, 4, L"DXGI_FORMAT_R8G8B8A8_UINT"), // = 30, DX10Format(FDT_SNORM , 4, 4, L"DXGI_FORMAT_R8G8B8A8_SNORM"), // = 31, DX10Format(FDT_SINT , 4, 4, L"DXGI_FORMAT_R8G8B8A8_SINT"), // = 32, DX10Format(FDT_TYPELESS, 2, 8, L"DXGI_FORMAT_R16G16_TYPELESS"), // = 33, DX10Format(FDT_FLOAT , 2, 8, L"DXGI_FORMAT_R16G16_FLOAT"), // = 34, DX10Format(FDT_UNORM , 2, 8, L"DXGI_FORMAT_R16G16_UNORM"), // = 35, DX10Format(FDT_UINT , 2, 8, L"DXGI_FORMAT_R16G16_UINT"), // = 36, DX10Format(FDT_SNORM , 2, 8, L"DXGI_FORMAT_R16G16_SNORM"), // = 37, DX10Format(FDT_SINT , 2, 8, L"DXGI_FORMAT_R16G16_SINT"), // = 38, DX10Format(FDT_TYPELESS, 1, 4, L"DXGI_FORMAT_R32_TYPELESS"), // = 39, DX10Format(FDT_FLOAT , 1, 4, L"DXGI_FORMAT_D32_FLOAT"), // = 40, DX10Format(FDT_FLOAT , 1, 4, L"DXGI_FORMAT_R32_FLOAT"), // = 41, DX10Format(FDT_UINT , 1, 4, L"DXGI_FORMAT_R32_UINT"), // = 42, DX10Format(FDT_SINT , 1, 4, L"DXGI_FORMAT_R32_SINT"), // = 43, DX10Format(FDT_TYPELESS, 2, 4, L"DXGI_FORMAT_R24G8_TYPELESS"), // = 44, DX10Format(FDT_UNORM , 2, 4, L"DXGI_FORMAT_D24_UNORM_S8_UINT"), // = 45, DX10Format(FDT_UNORM , 2, 4, L"DXGI_FORMAT_R24_UNORM_X8_TYPELESS"), // = 46, DX10Format(FDT_TYPELESS, 2, 4, L"DXGI_FORMAT_X24_TYPELESS_G8_UINT"), // = 47, DX10Format(FDT_TYPELESS, 2, 2, L"DXGI_FORMAT_R8G8_TYPELESS"), // = 48, DX10Format(FDT_UNORM , 2, 2, L"DXGI_FORMAT_R8G8_UNORM"), // = 49, DX10Format(FDT_UINT , 2, 2, L"DXGI_FORMAT_R8G8_UINT"), // = 50, DX10Format(FDT_SNORM , 2, 2, L"DXGI_FORMAT_R8G8_SNORM"), // = 51, DX10Format(FDT_SINT , 2, 2, L"DXGI_FORMAT_R8G8_SINT"), // = 52, DX10Format(FDT_TYPELESS, 1, 2, L"DXGI_FORMAT_R16_TYPELESS"), // = 53, DX10Format(FDT_FLOAT , 1, 2, L"DXGI_FORMAT_R16_FLOAT"), // = 54, DX10Format(FDT_UNORM , 1, 2, L"DXGI_FORMAT_D16_UNORM"), // = 55, DX10Format(FDT_UNORM , 1, 2, L"DXGI_FORMAT_R16_UNORM"), // = 56, DX10Format(FDT_UINT , 1, 2, L"DXGI_FORMAT_R16_UINT"), // = 57, DX10Format(FDT_SNORM , 1, 2, L"DXGI_FORMAT_R16_SNORM"), // = 58, DX10Format(FDT_SINT , 1, 2, L"DXGI_FORMAT_R16_SINT"), // = 59, DX10Format(FDT_TYPELESS, 1, 1, L"DXGI_FORMAT_R8_TYPELESS"), // = 60, DX10Format(FDT_UNORM , 1, 1, L"DXGI_FORMAT_R8_UNORM"), // = 61, DX10Format(FDT_UINT , 1, 1, L"DXGI_FORMAT_R8_UINT"), // = 62, DX10Format(FDT_SNORM , 1, 1, L"DXGI_FORMAT_R8_SNORM"), // = 63, DX10Format(FDT_SINT , 1, 1, L"DXGI_FORMAT_R8_SINT"), // = 64, DX10Format(FDT_UNORM , 1, 1, L"DXGI_FORMAT_A8_UNORM"), // = 65, DX10Format(FDT_UNORM , 1, 1, L"DXGI_FORMAT_R1_UNORM"), // = 66, DX10Format(FDT_SHAREDEXP, 4, 4, L"DXGI_FORMAT_R9G9B9E5_SHAREDEXP"), // = 67, DX10Format(FDT_UNORM , 4, 4, L"DXGI_FORMAT_R8G8_B8G8_UNORM"), // = 68, DX10Format(FDT_UNORM , 4, 4, L"DXGI_FORMAT_G8R8_G8B8_UNORM"), // = 69, DX10Format(FDT_TYPELESS , 0, 0, L"DXGI_FORMAT_BC1_TYPELESS"), // = 70, DX10Format(FDT_UNORM , 0, 0, L"DXGI_FORMAT_BC1_UNORM"), // = 71, DX10Format(FDT_UNORM_SRGB, 0, 0, L"DXGI_FORMAT_BC1_UNORM_SRGB"), // = 72, DX10Format(FDT_TYPELESS , 0, 0, L"DXGI_FORMAT_BC2_TYPELESS"), // = 73, DX10Format(FDT_UNORM , 0, 0, L"DXGI_FORMAT_BC2_UNORM"), // = 74, DX10Format(FDT_UNORM_SRGB, 0, 0, L"DXGI_FORMAT_BC2_UNORM_SRGB"), // = 75, DX10Format(FDT_TYPELESS , 0, 0, L"DXGI_FORMAT_BC3_TYPELESS"), // = 76, DX10Format(FDT_UNORM , 0, 0, L"DXGI_FORMAT_BC3_UNORM"), // = 77, DX10Format(FDT_UNORM_SRGB, 0, 0, L"DXGI_FORMAT_BC3_UNORM_SRGB"), // = 78, DX10Format(FDT_TYPELESS , 0, 0, L"DXGI_FORMAT_BC4_TYPELESS"), // = 79, DX10Format(FDT_UNORM , 0, 0, L"DXGI_FORMAT_BC4_UNORM"), // = 80, DX10Format(FDT_SNORM , 0, 0, L"DXGI_FORMAT_BC4_SNORM"), // = 81, DX10Format(FDT_TYPELESS , 0, 0, L"DXGI_FORMAT_BC5_TYPELESS"), // = 82, DX10Format(FDT_UNORM , 0, 0, L"DXGI_FORMAT_BC5_UNORM"), // = 83, DX10Format(FDT_SNORM , 0, 0, L"DXGI_FORMAT_BC5_SNORM"), // = 84, DX10Format(FDT_UNORM , 3, 2, L"DXGI_FORMAT_B5G6R5_UNORM"), // = 85, DX10Format(FDT_UNORM , 4, 2, L"DXGI_FORMAT_B5G5R5A1_UNORM"), // = 86, DX10Format(FDT_UNORM , 4, 4, L"DXGI_FORMAT_B8G8R8A8_UNORM"), // = 87, DX10Format(FDT_UNORM , 4, 4, L"DXGI_FORMAT_B8G8R8X8_UNORM"), // = 88, }; class DynamicDX { public: static bool InitializeDX(); static void CleanupDX(); static bool IsInitialized() {return m_bDynamicDXIsInitialized;} // DXGI calls typedef HRESULT ( WINAPI* LPCREATEDXGIFACTORY )( REFIID, void** ); static LPCREATEDXGIFACTORY CreateDXGIFactory; // D3D10 calls typedef HRESULT ( WINAPI* LPD3D10CREATEDEVICE )( IDXGIAdapter*, D3D10_DRIVER_TYPE, HMODULE, UINT, UINT, ID3D10Device** ); static LPD3D10CREATEDEVICE D3D10CreateDevice; // D3DX10 calls typedef HRESULT (WINAPI *LPD3DX10CREATEEFFECTFROMFILEW)(LPCWSTR pFileName, CONST D3D10_SHADER_MACRO *pDefines, ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult); static LPD3DX10CREATEEFFECTFROMFILEW D3DX10CreateEffectFromFileW; typedef HRESULT (WINAPI *LPD3DX10CREATEEFFECTFROMFILEA)(LPCSTR pFileName, CONST D3D10_SHADER_MACRO *pDefines, ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult); static LPD3DX10CREATEEFFECTFROMFILEA D3DX10CreateEffectFromFileA; static int GetD3DX10Version() {return m_iD3DX10Version;} private: static int m_iD3DX10Version; static bool m_bDynamicDXIsInitialized; static HINSTANCE m_hD3D10; static HINSTANCE m_hDXGI; static HINSTANCE m_hD3DX10; }; #else // _WIN32 && USE_DIRECTX typedef void ID3D10Device; #endif // _WIN32 && USE_DIRECTX #endif // DYNAMICDX_H ImageVis3D-3.1.0/Tuvok/Basics/AvgMinMaxTracker.h0000644000175000017500000000635712320456500021120 0ustar mathieumathieu#pragma once #ifndef TUVOK_AVGMINMAXTRACKER_H #define TUVOK_AVGMINMAXTRACKER_H #include #include #include namespace tuvok { template struct AvgMinMaxStruct { AvgMinMaxStruct(T const& average, T const& minimum, T const& maximum) : avg(average), min(minimum), max(maximum) {} T avg, min, max; friend std::ostream& operator<<(std::ostream &os, AvgMinMaxStruct const& amm) { return os << amm.avg << " [" << amm.min << ", " << amm.max << "]"; } }; template class AvgMinMaxTracker { public: AvgMinMaxTracker(uint32_t historyLength) : m_History() , m_Avg() , m_Min() , m_Max() , m_MaxHistoryLength(historyLength) {} void SetMaxHistoryLength(uint32_t maxHistoryLength) { m_MaxHistoryLength = maxHistoryLength; } uint32_t GetMaxHistoryLength() const { return m_MaxHistoryLength; } uint32_t GetHistroryLength() const { return (uint32_t)m_History.size(); } AvgMinMaxStruct GetAvgMinMax() const { return AvgMinMaxStruct(GetAvg(), GetMin(), GetMax()); } T const GetAvg() const { if (m_History.empty()) return 0; else return m_Avg / GetHistroryLength(); } T const& GetMin() const { return m_Min; } T const& GetMax() const { return m_Max; } void Push(T const& value) { m_History.push_back(value); m_Avg += value; while (m_MaxHistoryLength < m_History.size()) { m_Avg -= m_History.front(); m_History.pop_front(); } if (!m_History.empty()) { auto i = m_History.begin(); m_Min = *i; // min in avg interval m_Max = *i; // max in avg interval for (; i != m_History.end(); ++i) { m_Min = std::min(m_Min, *i); m_Max = std::max(m_Max, *i); } } } std::vector GetHistory() const { return std::vector(m_History.begin(), m_History.end()); } private: std::deque m_History; T m_Avg; T m_Min; T m_Max; uint32_t m_MaxHistoryLength; }; } // namespace tuvok #endif // TUVOK_AVGMINMAXTRACKER_H /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/Basics/BStream.h0000644000175000017500000000314012320456500017275 0ustar mathieumathieu#ifndef TUVOK_BSTREAM_H #define TUVOK_BSTREAM_H #include struct BStreamDescriptor { uint64_t elements; ///< number of elements in the stream size_t components; size_t width; ///< byte width bool is_signed; bool fp; ///< is it floating point? bool big_endian; size_t timesteps; }; #endif /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/Basics/SystemInfo.h0000644000175000017500000000612012320456500020041 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file SystemInfo.h \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #pragma once #ifndef SYSTEMINFO_H #define SYSTEMINFO_H #include "StdDefines.h" #include class SystemInfo { public: SystemInfo(std::string strProgramPath="", uint64_t iDefaultCPUMemSize=uint64_t(32)*uint64_t(1024)*uint64_t(1024)*uint64_t(1024), uint64_t iDefaultGPUMemSize=uint64_t(8)*uint64_t(1024)*uint64_t(1024)*uint64_t(1024)); void SetProgramPath(std::string strProgramPath) {m_strProgramPath = strProgramPath;} std::string GetProgramPath() const {return m_strProgramPath;} uint32_t GetProgramBitWidth() const {return m_iProgramBitWidth;} uint64_t GetCPUMemSize() const {return m_iCPUMemSize;} uint64_t GetGPUMemSize() const {return m_iGPUMemSize;} bool IsCPUSizeComputed() const {return m_bIsCPUSizeComputed;} bool IsGPUSizeComputed() const {return m_bIsGPUSizeComputed;} uint64_t GetMaxUsableCPUMem() const {return m_iUseMaxCPUMem;} uint64_t GetMaxUsableGPUMem() const {return m_iUseMaxGPUMem;} void SetMaxUsableCPUMem(uint64_t iUseMaxCPUMem) {m_iUseMaxCPUMem = iUseMaxCPUMem;} void SetMaxUsableGPUMem(uint64_t iUseMaxGPUMem) {m_iUseMaxGPUMem = iUseMaxGPUMem;} bool IsNumberOfCPUsComputed() const {return m_bIsNumberOfCPUsComputed;} uint32_t GetNumberOfCPUs() const {return m_iNumberOfCPUs;} bool IsDirectX10Capable() const {return m_bIsDirectX10Capable; } private: uint32_t ComputeNumCPUs(); uint64_t ComputeCPUMemSize(); uint64_t ComputeGPUMemory(); std::string m_strProgramPath; uint32_t m_iProgramBitWidth; uint64_t m_iUseMaxCPUMem; uint64_t m_iUseMaxGPUMem; uint64_t m_iCPUMemSize; uint64_t m_iGPUMemSize; uint32_t m_iNumberOfCPUs; bool m_bIsCPUSizeComputed; bool m_bIsGPUSizeComputed; bool m_bIsNumberOfCPUsComputed; bool m_bIsDirectX10Capable; }; #endif // SYSTEMINFO_H ImageVis3D-3.1.0/Tuvok/Basics/TuvokException.h0000644000175000017500000000371612320456500020740 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /// \brief Base class for all Tuvok exceptions. #ifndef TUVOK_EXCEPTION_H #define TUVOK_EXCEPTION_H #include "StdTuvokDefines.h" #include namespace tuvok { class Exception : virtual public std::exception { public: Exception() : location(NULL), line(0) {} Exception(std::string e, const char* where = NULL, size_t ln=0) : std::exception(), error(e), location(where), line(ln) { } virtual ~Exception() throw() { } virtual const char* what() const throw() { return this->error.c_str(); } const char* where() const { return this->location; } size_t lineno() const { return this->line; } protected: std::string error; const char* location; size_t line; }; } #endif // TUVOK_EXCEPTION_H ImageVis3D-3.1.0/Tuvok/Basics/ProgressTimer.h0000644000175000017500000000313412320456500020550 0ustar mathieumathieu#pragma once #ifndef PROGRESSTIMER_H #define PROGRESSTIMER_H #include "StdDefines.h" #include "Timer.h" #include /** \class ProgressTimer */ class ProgressTimer : public Timer { public: ProgressTimer(); std::string GetProgressMessage(double progress, bool bIncludeElapsed=true, bool bIncludeRemaining=true) const; }; #endif // PROGRESSTIMER_H /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/Basics/Checksums/0000755000175000017500000000000012320456500017516 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/Basics/Checksums/crc32.h0000644000175000017500000000523412320456500020607 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file crc32.cpp \author Jens Krueger SCI Institute University of Utah \date October 2008 */ #pragma once #ifndef CRC32_H #define CRC32_H #include #include #include #include "../../StdTuvokDefines.h" typedef unsigned long DWORD; /* * CRC32 (802.3) implementation using table lookups */ class CRC32 { public: CRC32(uint32_t dwPoly=0x04C11DB7) { for (uint32_t ui=0; ui<256; ui++) { uint32_t dwR = reflect(ui); for (int i=0; i<8; i++) dwR = ((dwR&0x80000000) ? (dwR<<1) ^ dwPoly : (dwR<<1)); m_dwTable[ui]=reflect(dwR); } } ~CRC32(void) {} inline DWORD get(const unsigned char *message, size_t stLength) const { DWORD dwR = 0xFFFFFFFF; chunk(message,stLength,dwR); return (dwR^0xFFFFFFFF); } inline DWORD get(const char *message, size_t stLength) const { return get((unsigned char*)(message),stLength); } inline void chunk(const unsigned char *message, size_t stLength, DWORD &dwR) const { for (size_t st=0; st> 8) ^ m_dwTable[(dwR&0xFF) ^ message[st]]; } private: inline uint32_t reflect(uint32_t dw) { for (uint32_t ui=0; ui<16; ui++) { uint32_t dwR=(dw&(1<>(32-2*ui-1)); // swap bits } return dw; } uint32_t m_dwTable[256]; }; #endif // CRC32_H ImageVis3D-3.1.0/Tuvok/Basics/Checksums/MD5.h0000644000175000017500000000334212320456500020256 0ustar mathieumathieu#pragma once #ifndef MD5_H #define MD5_H #include "../StdDefines.h" #include #include class MD5 { public: MD5(); virtual ~MD5() {}; //RSA MD5 Implementation void Transform(const uint8_t Block[64], int& error); void Update(const uint8_t* Input, uint32_t nInputLen, int& error); std::vector Final(int& iErrorCalculate); protected: inline uint32_t RotateLeft(uint32_t x, int n); inline void FF( uint32_t& A, uint32_t B, uint32_t C, uint32_t D, uint32_t X, uint32_t S, uint32_t T); inline void GG( uint32_t& A, uint32_t B, uint32_t C, uint32_t D, uint32_t X, uint32_t S, uint32_t T); inline void HH( uint32_t& A, uint32_t B, uint32_t C, uint32_t D, uint32_t X, uint32_t S, uint32_t T); inline void II( uint32_t& A, uint32_t B, uint32_t C, uint32_t D, uint32_t X, uint32_t S, uint32_t T); // Helpers inline void UINTToByte(uint8_t* Output, const uint32_t* Input, uint32_t nLength, int& error); inline void ByteToUINT(uint32_t* Output, const uint8_t* Input, uint32_t nLength, int& error); void MemoryMove(uint8_t* from, uint8_t* to, uint32_t size); private: uint8_t m_lpszBuffer[64]; // InputBuffer uint32_t m_nCount[2] ; // bitcount, modulo 2^64 (lsb first) uint32_t m_lMD5[4] ; // MD5 sum }; template std::array md5(Iter begin, Iter end) { MD5 md; int error = 0; while(begin != end) { md.Update((const uint8_t*)&*begin, sizeof(T), error); ++begin; } std::vector final = md.Final(error); std::array rv; std::copy(final.begin(), final.end(), rv.begin()); return rv; } #endif // MD5_H ImageVis3D-3.1.0/Tuvok/Basics/Checksums/MD5.cpp0000644000175000017500000002710612320456500020615 0ustar mathieumathieu#include "MD5.h" #include #define MD5_INIT_STATE_0 0x67452301 #define MD5_INIT_STATE_1 0xefcdab89 #define MD5_INIT_STATE_2 0x98badcfe #define MD5_INIT_STATE_3 0x10325476 #define MD5_S11 7 #define MD5_S12 12 #define MD5_S13 17 #define MD5_S14 22 #define MD5_S21 5 #define MD5_S22 9 #define MD5_S23 14 #define MD5_S24 20 #define MD5_S31 4 #define MD5_S32 11 #define MD5_S33 16 #define MD5_S34 23 #define MD5_S41 6 #define MD5_S42 10 #define MD5_S43 15 #define MD5_S44 21 //Transformation constants - Round 1 #define MD5_T01 0xd76aa478 //Transformation constant 1 #define MD5_T02 0xe8c7b756 //Transformation constant 2 #define MD5_T03 0x242070db //Transformation constant 3 #define MD5_T04 0xc1bdceee //Transformation constant 4 #define MD5_T05 0xf57c0faf //Transformation constant 5 #define MD5_T06 0x4787c62a //Transformation constant 6 #define MD5_T07 0xa8304613 //Transformation constant 7 #define MD5_T08 0xfd469501 //Transformation constant 8 #define MD5_T09 0x698098d8 //Transformation constant 9 #define MD5_T10 0x8b44f7af //Transformation constant 10 #define MD5_T11 0xffff5bb1 //Transformation constant 11 #define MD5_T12 0x895cd7be //Transformation constant 12 #define MD5_T13 0x6b901122 //Transformation constant 13 #define MD5_T14 0xfd987193 //Transformation constant 14 #define MD5_T15 0xa679438e //Transformation constant 15 #define MD5_T16 0x49b40821 //Transformation constant 16 //Transformation constants - Round 2 #define MD5_T17 0xf61e2562 //Transformation constant 17 #define MD5_T18 0xc040b340 //Transformation constant 18 #define MD5_T19 0x265e5a51 //Transformation constant 19 #define MD5_T20 0xe9b6c7aa //Transformation constant 20 #define MD5_T21 0xd62f105d //Transformation constant 21 #define MD5_T22 0x02441453 //Transformation constant 22 #define MD5_T23 0xd8a1e681 //Transformation constant 23 #define MD5_T24 0xe7d3fbc8 //Transformation constant 24 #define MD5_T25 0x21e1cde6 //Transformation constant 25 #define MD5_T26 0xc33707d6 //Transformation constant 26 #define MD5_T27 0xf4d50d87 //Transformation constant 27 #define MD5_T28 0x455a14ed //Transformation constant 28 #define MD5_T29 0xa9e3e905 //Transformation constant 29 #define MD5_T30 0xfcefa3f8 //Transformation constant 30 #define MD5_T31 0x676f02d9 //Transformation constant 31 #define MD5_T32 0x8d2a4c8a //Transformation constant 32 //Transformation constants - Round 3 #define MD5_T33 0xfffa3942 //Transformation constant 33 #define MD5_T34 0x8771f681 //Transformation constant 34 #define MD5_T35 0x6d9d6122 //Transformation constant 35 #define MD5_T36 0xfde5380c //Transformation constant 36 #define MD5_T37 0xa4beea44 //Transformation constant 37 #define MD5_T38 0x4bdecfa9 //Transformation constant 38 #define MD5_T39 0xf6bb4b60 //Transformation constant 39 #define MD5_T40 0xbebfbc70 //Transformation constant 40 #define MD5_T41 0x289b7ec6 //Transformation constant 41 #define MD5_T42 0xeaa127fa //Transformation constant 42 #define MD5_T43 0xd4ef3085 //Transformation constant 43 #define MD5_T44 0x04881d05 //Transformation constant 44 #define MD5_T45 0xd9d4d039 //Transformation constant 45 #define MD5_T46 0xe6db99e5 //Transformation constant 46 #define MD5_T47 0x1fa27cf8 //Transformation constant 47 #define MD5_T48 0xc4ac5665 //Transformation constant 48 //Transformation constants - Round 4 #define MD5_T49 0xf4292244 //Transformation constant 49 #define MD5_T50 0x432aff97 //Transformation constant 50 #define MD5_T51 0xab9423a7 //Transformation constant 51 #define MD5_T52 0xfc93a039 //Transformation constant 52 #define MD5_T53 0x655b59c3 //Transformation constant 53 #define MD5_T54 0x8f0ccc92 //Transformation constant 54 #define MD5_T55 0xffeff47d //Transformation constant 55 #define MD5_T56 0x85845dd1 //Transformation constant 56 #define MD5_T57 0x6fa87e4f //Transformation constant 57 #define MD5_T58 0xfe2ce6e0 //Transformation constant 58 #define MD5_T59 0xa3014314 //Transformation constant 59 #define MD5_T60 0x4e0811a1 //Transformation constant 60 #define MD5_T61 0xf7537e82 //Transformation constant 61 #define MD5_T62 0xbd3af235 //Transformation constant 62 #define MD5_T63 0x2ad7d2bb //Transformation constant 63 #define MD5_T64 0xeb86d391 //Transformation constant 64 static uint8_t PADDING[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; using namespace std; uint32_t MD5::RotateLeft(uint32_t x, int n) { return (x << n) | (x >> (32-n));} void MD5::FF( uint32_t& A, uint32_t B, uint32_t C, uint32_t D, uint32_t X, uint32_t S, uint32_t T) { uint32_t F = (B & C) | (~B & D); A += F + X + T; A = RotateLeft(A, S); A += B; } void MD5::GG( uint32_t& A, uint32_t B, uint32_t C, uint32_t D, uint32_t X, uint32_t S, uint32_t T) { uint32_t G = (B & D) | (C & ~D); A += G + X + T; A = RotateLeft(A, S); A += B; } void MD5::HH( uint32_t& A, uint32_t B, uint32_t C, uint32_t D, uint32_t X, uint32_t S, uint32_t T) { uint32_t H = (B ^ C ^ D); A += H + X + T; A = RotateLeft(A, S); A += B; } void MD5::II( uint32_t& A, uint32_t B, uint32_t C, uint32_t D, uint32_t X, uint32_t S, uint32_t T) { uint32_t I = (C ^ (B | ~D)); A += I + X + T; A = RotateLeft(A, S); A += B; } void MD5::ByteToUINT(uint32_t* Output, const uint8_t* Input, uint32_t nLength, int& error) { //entry invariants if( nLength % 4 != 0 ) error = -23; //Initialization uint32_t i=0; uint32_t j=0; for ( ; j < nLength; i++, j += 4) { Output[i] = (uint32_t)Input[j] | (uint32_t)Input[j+1] << 8 | (uint32_t)Input[j+2] << 16 | (uint32_t)Input[j+3] << 24; } } void MD5::Transform(const uint8_t Block[64], int& error) { uint32_t a = m_lMD5[0]; uint32_t b = m_lMD5[1]; uint32_t c = m_lMD5[2]; uint32_t d = m_lMD5[3]; uint32_t X[16]; ByteToUINT( X, Block, 64, error); //Round 1 Transformation FF (a, b, c, d, X[ 0], MD5_S11, MD5_T01); FF (d, a, b, c, X[ 1], MD5_S12, MD5_T02); FF (c, d, a, b, X[ 2], MD5_S13, MD5_T03); FF (b, c, d, a, X[ 3], MD5_S14, MD5_T04); FF (a, b, c, d, X[ 4], MD5_S11, MD5_T05); FF (d, a, b, c, X[ 5], MD5_S12, MD5_T06); FF (c, d, a, b, X[ 6], MD5_S13, MD5_T07); FF (b, c, d, a, X[ 7], MD5_S14, MD5_T08); FF (a, b, c, d, X[ 8], MD5_S11, MD5_T09); FF (d, a, b, c, X[ 9], MD5_S12, MD5_T10); FF (c, d, a, b, X[10], MD5_S13, MD5_T11); FF (b, c, d, a, X[11], MD5_S14, MD5_T12); FF (a, b, c, d, X[12], MD5_S11, MD5_T13); FF (d, a, b, c, X[13], MD5_S12, MD5_T14); FF (c, d, a, b, X[14], MD5_S13, MD5_T15); FF (b, c, d, a, X[15], MD5_S14, MD5_T16); //Round 2 Transformation GG (a, b, c, d, X[ 1], MD5_S21, MD5_T17); GG (d, a, b, c, X[ 6], MD5_S22, MD5_T18); GG (c, d, a, b, X[11], MD5_S23, MD5_T19); GG (b, c, d, a, X[ 0], MD5_S24, MD5_T20); GG (a, b, c, d, X[ 5], MD5_S21, MD5_T21); GG (d, a, b, c, X[10], MD5_S22, MD5_T22); GG (c, d, a, b, X[15], MD5_S23, MD5_T23); GG (b, c, d, a, X[ 4], MD5_S24, MD5_T24); GG (a, b, c, d, X[ 9], MD5_S21, MD5_T25); GG (d, a, b, c, X[14], MD5_S22, MD5_T26); GG (c, d, a, b, X[ 3], MD5_S23, MD5_T27); GG (b, c, d, a, X[ 8], MD5_S24, MD5_T28); GG (a, b, c, d, X[13], MD5_S21, MD5_T29); GG (d, a, b, c, X[ 2], MD5_S22, MD5_T30); GG (c, d, a, b, X[ 7], MD5_S23, MD5_T31); GG (b, c, d, a, X[12], MD5_S24, MD5_T32); //Round 3 Transformation HH (a, b, c, d, X[ 5], MD5_S31, MD5_T33); HH (d, a, b, c, X[ 8], MD5_S32, MD5_T34); HH (c, d, a, b, X[11], MD5_S33, MD5_T35); HH (b, c, d, a, X[14], MD5_S34, MD5_T36); HH (a, b, c, d, X[ 1], MD5_S31, MD5_T37); HH (d, a, b, c, X[ 4], MD5_S32, MD5_T38); HH (c, d, a, b, X[ 7], MD5_S33, MD5_T39); HH (b, c, d, a, X[10], MD5_S34, MD5_T40); HH (a, b, c, d, X[13], MD5_S31, MD5_T41); HH (d, a, b, c, X[ 0], MD5_S32, MD5_T42); HH (c, d, a, b, X[ 3], MD5_S33, MD5_T43); HH (b, c, d, a, X[ 6], MD5_S34, MD5_T44); HH (a, b, c, d, X[ 9], MD5_S31, MD5_T45); HH (d, a, b, c, X[12], MD5_S32, MD5_T46); HH (c, d, a, b, X[15], MD5_S33, MD5_T47); HH (b, c, d, a, X[ 2], MD5_S34, MD5_T48); //Round 4 Transformation II (a, b, c, d, X[ 0], MD5_S41, MD5_T49); II (d, a, b, c, X[ 7], MD5_S42, MD5_T50); II (c, d, a, b, X[14], MD5_S43, MD5_T51); II (b, c, d, a, X[ 5], MD5_S44, MD5_T52); II (a, b, c, d, X[12], MD5_S41, MD5_T53); II (d, a, b, c, X[ 3], MD5_S42, MD5_T54); II (c, d, a, b, X[10], MD5_S43, MD5_T55); II (b, c, d, a, X[ 1], MD5_S44, MD5_T56); II (a, b, c, d, X[ 8], MD5_S41, MD5_T57); II (d, a, b, c, X[15], MD5_S42, MD5_T58); II (c, d, a, b, X[ 6], MD5_S43, MD5_T59); II (b, c, d, a, X[13], MD5_S44, MD5_T60); II (a, b, c, d, X[ 4], MD5_S41, MD5_T61); II (d, a, b, c, X[11], MD5_S42, MD5_T62); II (c, d, a, b, X[ 2], MD5_S43, MD5_T63); II (b, c, d, a, X[ 9], MD5_S44, MD5_T64); m_lMD5[0] += a; m_lMD5[1] += b; m_lMD5[2] += c; m_lMD5[3] += d; } MD5::MD5() { memset( m_lpszBuffer, 0, 64 ); m_nCount[0] = m_nCount[1] = 0; // load magic state m_lMD5[0] = MD5_INIT_STATE_0; m_lMD5[1] = MD5_INIT_STATE_1; m_lMD5[2] = MD5_INIT_STATE_2; m_lMD5[3] = MD5_INIT_STATE_3; } void MD5::UINTToByte(uint8_t* Output, const uint32_t* Input, uint32_t nLength, int& error) { //entry invariants if( nLength % 4 != 0 ) error = -22; uint32_t i = 0; uint32_t j = 0; for ( ; j < nLength; i++, j += 4) { Output[j] = (uint8_t)(Input[i] & 0xff); Output[j+1] = (uint8_t)((Input[i] >> 8) & 0xff); Output[j+2] = (uint8_t)((Input[i] >> 16) & 0xff); Output[j+3] = (uint8_t)((Input[i] >> 24) & 0xff); } } std::vector MD5::Final(int& error) { uint8_t Bits[8]; UINTToByte( Bits, m_nCount, 8, error); uint32_t nIndex = (uint32_t)((m_nCount[0] >> 3) & 0x3f); uint32_t nPadLen = (nIndex < 56) ? (56 - nIndex) : (120 - nIndex); Update( PADDING, nPadLen, error ); Update( Bits, 8, error ); const int nMD5Size = 16; std::vector lpszMD5; lpszMD5.resize(nMD5Size); UINTToByte( &lpszMD5[0], m_lMD5, nMD5Size,error ); return lpszMD5; } void MD5::Update(const uint8_t* Input, uint32_t nInputLen, int& error) { uint32_t nIndex = (uint32_t)((m_nCount[0] >> 3) & 0x3F); if ((m_nCount[0] += nInputLen << 3) < (nInputLen << 3)) { m_nCount[1]++; } m_nCount[1] += (nInputLen >> 29); uint32_t i=0; uint32_t nPartLen = 64 - nIndex; if (nInputLen >= nPartLen) { memmove(&m_lpszBuffer[nIndex], Input, nPartLen); Transform( m_lpszBuffer, error ); for (i = nPartLen; i + 63 < nInputLen; i += 64) { Transform( &Input[i], error ); } nIndex = 0; } else { i = 0; } memmove(&m_lpszBuffer[nIndex], &Input[i], nInputLen-i); } ImageVis3D-3.1.0/Tuvok/Basics/LargeFile.h0000644000175000017500000001244212320456500017577 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef BASICS_LARGEFILE_H #define BASICS_LARGEFILE_H #ifndef _LARGEFILE64_SOURCE # define _LARGEFILE64_SOURCE 1 #endif #include #include #include #include #include "nonstd.h" /** Generic class for accessing large quantities of binary data. */ class LargeFile { public: /// @argument header_size is maintained as a "base" offset. Seeking to /// byte 0 actually seeks to 'header_size'. /// @argument length some implementations are better if you can guarantee /// up front how much data you'll access. LargeFile(const std::string fn, std::ios_base::openmode mode = std::ios_base::in, uint64_t header_size=0, uint64_t length=0); /// @argument header_size is maintained as a "base" offset. Seeking to /// byte 0 actually seeks to 'header_size'. /// @argument length some implementations are better if you can guarantee /// up front how much data you'll access. LargeFile(const std::wstring fn, std::ios_base::openmode mode = std::ios_base::in, uint64_t header_size=0, uint64_t length=0); virtual ~LargeFile() {} /// The file is automatically opened upon construction, but you can use /// this to reopen in a different mode, for example. /// LargeFiles are always 'raw': std::ios::binary is implied. virtual void open(std::ios_base::openmode mode = std::ios_base::in) = 0; /// Uses the current byte offset to read data from the file. virtual std::shared_ptr rd(size_t len); /// reads a block of data, returns a pointer to it. User must cast it to /// the type that makes sense for them. /// The file's current byte offset is undefined after this operation. virtual std::shared_ptr rd(uint64_t offset, size_t len) = 0; /// returns the number of bytes read during the last read. virtual uint64_t gcount() const; /// writes a block of data. /// The file's current byte offset is undefined after this operation. virtual void wr(const std::shared_ptr& data, uint64_t offset, size_t len) = 0; /// writes data at the current byte offset virtual void wr(const std::shared_ptr& data, size_t len); /// read/write calls of a single element. Only usable with implicit /// offsets. ///@{ // a 'delete' functor that just does nothing. template void read(T* v, size_t N=1) { std::shared_ptr m = this->rd(this->byte_offset, sizeof(T)*N); const T* mem = static_cast(m.get()); std::copy(mem, mem+N, v); this->byte_offset += sizeof(T)*N; } template void write(const T& v) { this->wr(std::shared_ptr(&v, nonstd::null_deleter()), this->byte_offset, sizeof(T)); this->byte_offset += sizeof(T); } template void write(const T* v, size_t N=1) { this->wr(std::shared_ptr(v, nonstd::null_deleter()), sizeof(T)*N); // don't increase byte_offset -- this version of wr() does it for us! } ///@} /// notifies the object that we're going to need the following data soon. /// Many implementations will prefetch this data when it knows this. virtual void enqueue(uint64_t offset, size_t len) = 0; std::string filename() const { return this->m_filename; } virtual uint64_t filesize() const = 0; virtual void seek(uint64_t); virtual uint64_t offset() const; virtual bool is_open() const = 0; virtual void close() = 0; virtual void truncate(uint64_t length=0); static void truncate(const char* path, uint64_t length); protected: std::string m_filename; uint64_t header_size; uint64_t byte_offset; uint64_t bytes_read; // number of bytes read during last read private: LargeFile(const LargeFile&); LargeFile& operator=(const LargeFile&); }; #endif /* BASICS_LARGEFILE_H */ ImageVis3D-3.1.0/Tuvok/Basics/LargeFileC.h0000644000175000017500000000576112320456500017710 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef BASICS_LARGEFILE_C_H #define BASICS_LARGEFILE_C_H #include #include "LargeFile.h" /** Uses standard C API calls (fopen/fread/fwrite) as the backing impl. */ class LargeFileC : public LargeFile { public: /// @argument header_size is maintained as a "base" offset. Seeking to /// byte 0 actually seeks to 'header_size'. LargeFileC(const std::string fn, std::ios_base::openmode mode = std::ios_base::in, uint64_t header_size=0, uint64_t length=0); /// @argument header_size is maintained as a "base" offset. Seeking to /// byte 0 actually seeks to 'header_size'. LargeFileC(const std::wstring fn, std::ios_base::openmode mode = std::ios_base::in, uint64_t header_size=0, uint64_t length=0); virtual ~LargeFileC(); virtual void open(std::ios_base::openmode mode = std::ios_base::in); /// reads a block of data, returns a pointer to it. User must cast it to /// the type that makes sense for them. virtual std::shared_ptr rd(uint64_t offset, size_t len); using LargeFile::read; using LargeFile::rd; /// writes a block of data. virtual void wr(const std::shared_ptr& data, uint64_t offset, size_t len); /// notifies the object that we're going to need the following data soon. /// Many implementations will prefetch this data when it knows this. virtual void enqueue(uint64_t offset, size_t len); virtual uint64_t filesize() const; virtual bool is_open() const; virtual void close(); virtual void truncate(uint64_t length=0); protected: FILE* fp; }; #endif /* BASICS_LARGEFILE_C_H */ ImageVis3D-3.1.0/Tuvok/Basics/Console.h0000644000175000017500000001215412320456500017347 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Console.h \author Thomas Schiwietz Jens Krueger SCI Institute University of Utah \version 1.0 \date July 2008 */ #pragma once #ifndef CONSOLE_H #define CONSOLE_H #include #include #ifdef WIN32 #pragma warning(disable:4505) #else #include #endif #include "StdTuvokDefines.h" #if defined(__GNUC__) && __GNUC__ > 3 || \ (__GNUC__ == 3 && __GNUC_MINOR_ >= 4) # define FQN_UNUSED __attribute__ ((unused)) # define FQN_PRINTF __attribute__ ((format (printf, 1, 2))) #else # define FQN_UNUSED /* nothing */ # define FQN_PRINTF /* nothing */ #endif namespace Console { #ifdef _WIN32 #include // undef stupid windows defines to max and min #ifdef max #undef max #endif #ifdef min #undef min #endif static void printf(const WCHAR* format, ...) { // output string WCHAR buff[16384]; // arguments va_list args; va_start(args, format); // build string _vsnwprintf_s( buff, 16384, sizeof(buff), format, args); // conver to unicode OutputDebugStringW(buff); } static void printfd(const WCHAR* format, ...) { #ifdef _DEBUG // output string WCHAR buff[16384]; // arguments va_list args; va_start(args, format); // build string _vsnwprintf_s( buff, 16384, sizeof(buff), format, args); // conver to unicode OutputDebugStringW(buff); #else UNREFERENCED_PARAMETER(format); #endif } static void printf(const CHAR* format, ...) { // output string CHAR buff[16384]; // arguments va_list args; va_start(args, format); // build string _vsnprintf_s( buff, 16384, sizeof(buff), format, args); // conver to unicode OutputDebugStringA(buff); } static void printfd(const CHAR* format, ...) { #ifdef _DEBUG // output string CHAR buff[16384]; // arguments va_list args; va_start(args, format); // build string _vsnprintf_s( buff, 16384, sizeof(buff), format, args); // conver to unicode OutputDebugStringA(buff); #else UNREFERENCED_PARAMETER(format); #endif } #else #include static void printf(const wchar_t *, ...) FQN_UNUSED; static void printfd(const wchar_t*, ...) FQN_UNUSED; static void printf(const char* , ...) FQN_UNUSED FQN_PRINTF; static void printfd(const char*, ...) FQN_UNUSED FQN_PRINTF; static void printf(const wchar_t* format, ...) { // output string wchar_t buff[16384]; // arguments va_list args; va_start(args, format); vswprintf( buff, sizeof(buff), format, args); std::cout << buff; } #ifdef _DEBUG static void printfd(const wchar_t* format, ...) { // output string wchar_t buff[16384]; // arguments va_list args; va_start(args, format); vswprintf( buff, sizeof(buff), format, args); std::cout << buff; } #else static void printfd(const wchar_t*, ...) {} #endif static void printf(const char* format, ...) { // output string char buff[16384]; // arguments va_list args; va_start(args, format); vsnprintf( buff, sizeof(buff), format, args); std::cout << buff; } #ifdef _DEBUG static void printfd(const char* format, ...) { // output string char buff[16384]; // arguments va_list args; va_start(args, format); vsnprintf( buff, sizeof(buff), format, args); std::cout << buff; } #else static void printfd(const char*, ...) {} #endif #endif }; #endif // CONSOLE_H ImageVis3D-3.1.0/Tuvok/Basics/LargeFileMMap.h0000644000175000017500000000524312320456500020353 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef BASICS_LARGEFILE_MMAP_H #define BASICS_LARGEFILE_MMAP_H #include "LargeFileFD.h" // experimentally found to be the largest value we can mmap. const uint64_t UINT64_PAGE_MAX = 35184372088832ULL; /** A large raw file backed by an 'mmap' implementation. */ class LargeFileMMap : public LargeFileFD { public: LargeFileMMap(const std::string fn, std::ios_base::openmode mode = std::ios_base::in, uint64_t header_size=0, uint64_t length = UINT64_PAGE_MAX); LargeFileMMap(const std::wstring fn, std::ios_base::openmode mode = std::ios_base::in, uint64_t header_size=0, uint64_t length = UINT64_PAGE_MAX); virtual ~LargeFileMMap(); void open(std::ios_base::openmode mode = std::ios_base::in); /// reads a block of data, returns a pointer to it. User must cast it to /// the type that makes sense for them. std::shared_ptr rd(uint64_t offset, size_t len); using LargeFile::read; using LargeFile::rd; /// writes a block of data. void wr(const std::shared_ptr& data, uint64_t offset, size_t len); using LargeFile::wr; virtual bool is_open() const; virtual void close(); private: void* map; uint64_t length; private: LargeFileMMap(const LargeFileMMap&); LargeFileMMap& operator=(const LargeFileMMap&); }; #endif /* BASICS_LARGEFILE_MMAP_H */ ImageVis3D-3.1.0/Tuvok/Basics/LargeRAWFile.h0000644000175000017500000001317512320456500020155 0ustar mathieumathieu#pragma once #ifndef LARGERAWFILE_H #define LARGERAWFILE_H #define _LARGEFILE64_SOURCE 1 #define _FILE_OFFSET_BITS 64 #define _LARGEFILE_SOURCE 1 #include #include #include "EndianConvert.h" #ifdef _WIN32 #define NOMINMAX #include #include #include #include #include #include // undef stupid windows defines to max and min #ifdef max #undef max #endif #ifdef min #undef min #endif #endif #ifdef _WIN32 typedef HANDLE FILETYPE; #else typedef FILE* FILETYPE; #endif class LargeRAWFile { public: LargeRAWFile(const std::string& strFilename, uint64_t iHeaderSize=0); LargeRAWFile(const std::wstring& wstrFilename, uint64_t iHeaderSize=0); LargeRAWFile(const LargeRAWFile &other); virtual ~LargeRAWFile() {Close();} virtual bool Open(bool bReadWrite=false); virtual bool IsOpen() const { return m_bIsOpen;} virtual bool IsWritable() const { return m_bWritable;} virtual bool Create(uint64_t iInitialSize=0); virtual bool Append(); virtual void Close(); virtual void Delete(); virtual bool Truncate(); virtual bool Truncate(uint64_t iPos); virtual uint64_t GetCurrentSize(); std::string GetFilename() const { return m_strFilename;} virtual void SeekStart(); virtual uint64_t SeekEnd(); virtual uint64_t GetPos(); virtual void SeekPos(uint64_t iPos); virtual size_t ReadRAW(unsigned char* pData, uint64_t iCount); virtual size_t WriteRAW(const unsigned char* pData, uint64_t iCount); virtual bool CopyRAW(uint64_t iCount, uint64_t iSourcePos, uint64_t iTargetPos, unsigned char* pBuffer, uint64_t iBufferSize); template void Read(const T* pData, uint64_t iCount, uint64_t iPos, uint64_t iOffset) { SeekPos(iOffset+sizeof(T)*iPos); ReadRAW((unsigned char*)pData, sizeof(T)*iCount); } template void Write(const T* pData, uint64_t iCount, uint64_t iPos, uint64_t iOffset) { SeekPos(iOffset+sizeof(T)*iPos); WriteRAW((unsigned char*)pData, sizeof(T)*iCount); } template void ReadData(T& value, bool bIsBigEndian) { ReadRAW((unsigned char*)&value, sizeof(T)); if (EndianConvert::IsBigEndian() != bIsBigEndian) EndianConvert::Swap(value); } template void WriteData(const T& value, bool bIsBigEndian) { if (EndianConvert::IsBigEndian() != bIsBigEndian) EndianConvert::Swap(value); WriteRAW((unsigned char*)&value, sizeof(T)); if (EndianConvert::IsBigEndian() != bIsBigEndian) EndianConvert::Swap(value); } template void ReadData(std::vector &value, uint64_t count, bool bIsBigEndian) { if (count == 0) return; value.resize(size_t(count)); ReadRAW( (unsigned char*)&value[0], sizeof(T)*size_t(count)); if (EndianConvert::IsBigEndian() != bIsBigEndian) { for (size_t i = 0; i < count; i++) { EndianConvert::Swap(value[i]); } } } template void WriteData(const std::vector &value, bool bIsBigEndian) { uint64_t count = value.size(); if (count == 0) return; if (EndianConvert::IsBigEndian() != bIsBigEndian) { for (size_t i = 0; i < count; i++) { EndianConvert::Swap(value[i]); } } WriteRAW((unsigned char*)&value[0], sizeof(T)*size_t(count)); if (EndianConvert::IsBigEndian() != bIsBigEndian) { for (size_t i = 0; i < count; i++) { EndianConvert::Swap(value[i]); } } } virtual void ReadData(std::string &value, uint64_t count) { if (count == 0) return; value.resize(size_t(count)); ReadRAW((unsigned char*)&value[0], sizeof(char)*size_t(count)); } virtual void WriteData(const std::string &value) { if (value.empty()) return; WriteRAW((unsigned char*)&value[0], sizeof(char)*size_t(value.length())); } enum IOHint { NORMAL, ///< reset back to default state SEQUENTIAL, ///< going to access this sequentially NOREUSE, ///< will use this once and then it's useless. WILLNEED, ///< don't need this now, but will soon DONTNEED ///< no longer need this region }; // Hint to the underlying driver how we'll access data virtual void Hint(IOHint hint, uint64_t offset, uint64_t length) const; static bool Copy(const std::string& strSource, const std::string& strTarget, uint64_t iSourceHeaderSkip=0, std::string* strMessage=NULL); static bool Copy(const std::wstring& wstrSource, const std::wstring& wstrTarget, uint64_t iSourceHeaderSkip=0, std::wstring* wstrMessage=NULL); static bool Compare(const std::string& strFirstFile, const std::string& strSecondFile, std::string* strMessage=NULL); static bool Compare(const std::wstring& wstrFirstFile, const std::wstring& wstrSecondFile, std::wstring* wstrMessage=NULL); protected: FILETYPE m_StreamFile; std::string m_strFilename; bool m_bIsOpen; bool m_bWritable; uint64_t m_iHeaderSize; }; #include typedef std::shared_ptr LargeRAWFile_ptr; // A TempFile is an RAII LargeRAWFile, which deletes itself when it // goes out of scope. There shouldn't be any need to explicitly delete // it, but you can do so early with the 'Delete' call, if desired. class TempFile : public LargeRAWFile { public: TempFile(const std::string& filename) : LargeRAWFile(filename, 0) {} virtual ~TempFile() { Close(); Delete(); } }; #endif // LARGERAWFILE_H ImageVis3D-3.1.0/Tuvok/Basics/Plane.h0000644000175000017500000000701412320456500017003 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Plane.h \author Jens Krueger SCI Institute University of Utah */ #pragma once #ifndef TUVOK_PLANE_H #define TUVOK_PLANE_H #include #include "Vectors.h" /// Stores a plane as an always-normalized normal and a perpendicular vector. /// The latter is used when rendering the plane: it tells us in which direction /// we'd like the plane to (visibly) extend. By packaging them together, we /// can ensure that both are always transformed equally, keeping them in sync. class ExtendedPlane { public: ExtendedPlane(); // Used to construct an extended plane inside Lua. ExtendedPlane(const FLOATMATRIX4& m1, const FLOATMATRIX4& m2, const PLANE& plane); static ExtendedPlane FarawayPlane(); /// Transform the plane by the given matrix. void Transform(const FLOATMATRIX4&, bool bSecondar); /// Figures out the appropriate quadrilateral for rendering this plane (the /// quad's normal will be the plane's normal). /// @return true if the returned set of points should be rendered counter /// clockwise. bool Quad(const FLOATVECTOR3& vEye, std::vector& quad, const float fWidgetSize=0.5f) const; /// Sets the plane back to default values. void Default(bool bSecondary=false); float& d() { return m_Plane.w; } const float& d() const { return m_Plane.w; } float x() const { return m_Plane.x; } float y() const { return m_Plane.y; } float z() const { return m_Plane.z; } const PLANE& Plane() const { return m_Plane; } const FLOATMATRIX4& Mat1() const {return m_mat[0];} const FLOATMATRIX4& Mat2() const {return m_mat[1];} bool operator ==(const ExtendedPlane &ep) const { return m_Plane == ep.m_Plane; } private: void UpdatePlane(); /// The default / initial settings for the plane and its perpendicular /// vector. Use these when constructing initial copies of an /// ExtendedPlane (the default if you're using the default constructor). ///@{ static const PLANE ms_Plane; ///@} FLOATMATRIX4 GetCompleteTransform() const; PLANE m_Plane; ///< the plane's normal FLOATMATRIX4 m_mat[2]; ///< accumulated plane transformations }; #endif // TUVOK_PLANE_H ImageVis3D-3.1.0/Tuvok/Basics/MathTools.h0000644000175000017500000000663412320456500017665 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file MathTools.h \author Jens Krueger SCI Institute University of Utah \date October 2008 */ #pragma once #ifndef MATHTOOLS_H #define MATHTOOLS_H #include "StdDefines.h" // Old gcc's have some tr1 missing features/bugs. Apple didn't fix // these even with their compiler upgrade, however. #if defined(_MSC_VER) || \ defined(DETECTED_OS_APPLE) || \ (defined(__GNUC__) && ((__GNUC__ == 4 && (__GNUC_MINOR__ == 0 || \ __GNUC_MINOR__ == 1)))) #else # define USABLE_TR1 1 #endif #include #ifdef _DEBUG # include #endif #define ROOT3 1.732050f namespace MathTools { uint32_t Log(uint32_t value, uint32_t base); float Log(float value, float base); uint32_t Pow(uint32_t base, uint32_t exponent); uint64_t Pow(uint64_t base, uint64_t exponent); uint32_t Log2(uint32_t n); uint32_t Pow2(uint32_t e); uint64_t Log2(uint64_t n); uint64_t Pow2(uint64_t e); uint32_t GaussianSum(uint32_t n); bool IsPow2(uint32_t n); uint32_t NextPow2(uint32_t n, bool bReturn_ID_on_Pow2=true); template inline T sign(T v) { return T((v > T(0)) - (v < T(0))); } template inline T MakeMultiple(T v, T m) { return v + (((v%m) == T(0)) ? T(0) : m-(v%m)); } template static inline out lerp(in value, in imin, in imax, out omin, out omax) { out ret = out(omin + (value-imin) * (static_cast(omax-omin) / (imax-imin))); #if defined(_DEBUG) && defined(USABLE_TR1) // Very useful while debugging, but too expensive for general use. if(std::isnan(ret) || std::isinf(ret)) { throw std::range_error("NaN or infinity!"); } #endif return ret; } // Attempts to detect NaNs. Imprecise; only useful for asserts and // debugging, do not rely on it! bool NaN(float f); float Clamp(float val, float a, float b); uint32_t Clamp(uint32_t val, uint32_t a, uint32_t b); uint64_t Clamp(uint64_t val, uint64_t a, uint64_t b); int Clamp(int val, int a, int b); }; #endif // MATHTOOLS_H ImageVis3D-3.1.0/Tuvok/Basics/TuvokHT.h0000644000175000017500000000276612320456500017321 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef BASICS_HASHTABLE_H #define BASICS_HASHTABLE_H #include #include "tr1.h" namespace tuvok { template struct Hash { typedef std::unordered_map> Table; }; } #endif /* BASICS_TR1_H */ ImageVis3D-3.1.0/Tuvok/Basics/EndianConvert.h0000644000175000017500000001400612320456500020502 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file EndianConvert.h \author Jens Schneider Jens Krueger SCI Institute University of Utah \version 1.0 \date July 2008 */ #pragma once #ifndef ENDIANCONVERT_H #define ENDIANCONVERT_H #include #include #ifndef WIN32 #include #endif #include "StdDefines.h" #define ENDIANCONVERT_THREAD_SAFE ///< Switch on to ensure Thread-safeness. Quick and untested hack. namespace EndianConvert { /** * Swap routine to convert between little and big-endian. * x is converted in situ. * \param x pointer to data we should swap. * \return void * \date October.2004 */ template inline void SwapSitu(TYPE* x) { #ifndef ENDIANCONVERT_THREAD_SAFE static #endif union { TYPE t; char c[sizeof(TYPE)]; } uSwapSpace; #ifndef ENDIANCONVERT_THREAD_SAFE static #endif char c; uSwapSpace.t=*x; for (size_t i=0; i<(sizeof(TYPE)>>1); i++) { c=uSwapSpace.c[i]; uSwapSpace.c[i]=uSwapSpace.c[sizeof(TYPE)-i-1]; uSwapSpace.c[sizeof(TYPE)-i-1]=c; } *x=uSwapSpace.t; } /** * Swap routine to convert between little and big-endian. * x is converted and returned. * \param x * \return the converted element * \date October.2004 */ template inline TYPE Swap(const TYPE x) { #ifndef ENDIANCONVERT_THREAD_SAFE static #endif union { TYPE t; char c[sizeof(TYPE)]; } uSwapSpace; #ifndef ENDIANCONVERT_THREAD_SAFE static #endif char c; uSwapSpace.t=x; for (int i=0; i<(int)(sizeof(TYPE)>>1); i++) { // use int here to suppress warning when called with 8bit data c=uSwapSpace.c[i]; uSwapSpace.c[i]=uSwapSpace.c[sizeof(TYPE)-i-1]; uSwapSpace.c[sizeof(TYPE)-i-1]=c; } return uSwapSpace.t; } /** * Checks whether this machine is big-endian. * \return true if the machine is big-endian, false otherwise * \date December.2004 */ inline bool IsBigEndian(void) { union { int i; char c[sizeof(int)]; } tmp; static_assert(sizeof(int) > 1, "else we won't test the right thing."); tmp.i=0x1020; return tmp.c[0]!=0x20; } /** * Checks whether this machine is little-endian. * \return true if the machine is little-endian, false otherwise * \date December.2004 */ inline bool IsLittleEndian(void) { return !IsBigEndian(); } template inline bool IsNaN(T a) { return (!(a<=T(42.0)) && !(a>=T(42.0))); } /** * Swaps the endianness without prior knowledge about bit order. * \param data array to swap every element of. * \param NumElements size of the array. * \return the variance of the swapped data. * \date Jul.2006 */ template inline double SmartSwap(T* data, size_t NumElements) { double AVG=0.0,VAR=0.0; double AVG2=0.0,VAR2=0.0; for (size_t i=0; i(&data[i]); d=double(data[i]); AVG2+=d; VAR2+=d*d; // Early NaN-Check to speed up the process if ((i%1024)!=1023 && i!=NumElements-1) {} else { if (IsNaN(VAR)) { // early out, swapped is correct for (size_t j=i+1; j(&data[j]); d=double(data[j]); AVG2+=d; VAR2+=d*d; } AVG2/=double(NumElements); VAR2=(VAR2-double(NumElements)*AVG2*AVG2)/double(NumElements-1); #ifdef _DEBUG printf("%s (%.3f vs NaN) ",IsBigEndian() ? "little endian" : "big endian",VAR2); #endif return VAR2; } else if (IsNaN(VAR2)) { // early out, non-swapped was correct for (size_t j=0; j<=i; j++) Swap(&data[j]); for (size_t j=i=i+1; j(&data[i]); return VAR; } else { #ifdef _DEBUG printf("%s (%.3f vs %.3f) ",IsBigEndian() ? "little endian" : "big endian",VAR2,VAR); #endif return VAR2; } } }; #endif // ENDIANCONVERT_H ImageVis3D-3.1.0/Tuvok/Basics/ArcBall.h0000644000175000017500000000530212320456500017242 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file ArcBall.cpp \author Jens Krueger SCI Institute University of Utah Based on the NeHe Tutorial 48 \date October 2008 */ #pragma once #ifndef ARCBALL_H #define ARCBALL_H #include "StdDefines.h" #include "Vectors.h" /** \class ArcBall */ class ArcBall { public: ArcBall(uint32_t iWinWidth=0, uint32_t iWinHeight=0, int iWinOffsetX=0, int iWinOffsetY=0, bool bUseTranslation = false); void SetRadius(float fRadius) {m_fRadius = fRadius;} void SetTranslation(const FLOATMATRIX4& mTranslation) {m_mTranslation = mTranslation;} const FLOATMATRIX4& GetTranslation() const {return m_mTranslation;} void SetUseTranslation(bool bUseTranslation) {m_bUseTranslation = bUseTranslation;} bool GetUseTranslation() {return m_bUseTranslation;} void SetWindowSize(uint32_t iWinWidth, uint32_t iWinHeight); void SetWindowOffset(int iWinOffsetX, int iWinOffsetY); void Click(UINTVECTOR2 vPosition); FLOATQUATERNION4 Drag(UINTVECTOR2 vPosition); protected: static float ms_fEpsilon; FLOATVECTOR3 m_vStartDrag; ///< Saved click vector UINTVECTOR2 m_iWinDim; ///< window dimensions INTVECTOR2 m_iWinOffsets; ///< Horizontal/Vertical window offset float m_fRadius; ///< radius of the ball FLOATMATRIX4 m_mTranslation; ///< translation of the ball bool m_bUseTranslation; ///< whether to the translation of the ball FLOATVECTOR3 MapToSphere(UINTVECTOR2 vPosition) const; }; #endif // ARCBALL_H ImageVis3D-3.1.0/Tuvok/Basics/LargeFileMMap.cpp0000644000175000017500000001672412320456500020714 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "LargeFileMMap.h" #include #include #include #include #include #include #include #include #include #include LargeFileMMap::LargeFileMMap(const std::string fn, std::ios_base::openmode mode, uint64_t header_size, uint64_t length) : LargeFileFD(fn, mode, header_size), map(NULL), length(length) { this->open(mode); } LargeFileMMap::LargeFileMMap(const std::wstring fn, std::ios_base::openmode mode, uint64_t header_size, uint64_t length) : LargeFileFD(fn, mode, header_size), map(NULL), length(length) { this->open(mode); } LargeFileMMap::~LargeFileMMap() { /* change the memory protection, if we can. We might have given away * pointers (on say a read() call) which won't be valid anymore, since we're * destroying the map. * With this, at least the user will get a segfault, instead of silently * reading garbage data. */ mprotect(this->map, this->length, PROT_NONE); this->close(); } std::shared_ptr LargeFileMMap::rd(uint64_t offset, size_t len) { if(len == 0 || (!this->is_open())) { return std::shared_ptr(); } const char* bytes = static_cast(this->map); const char* begin = bytes + this->header_size + offset; const char* end = bytes+offset+this->header_size+len; const char* end_buffer = bytes + this->length; // what if they try to read beyond the end of the buffer? if(end > end_buffer) { end = end_buffer; } /* Our shared_ptr here is a bit sketch. We give them a pointer, but if * 'this' dies we'll kill the mmap, thereby invalidating the pointer. So, * umm.. don't do that. */ #ifdef __clang__ // Clang has an issue in its libc++ where an allocator is created using the // type of the first parameter (in this case, begin), and if the type is // 'const', then duplicate member functions will be created in std::allocator. // In this case, the address function: // const char * address ... // const const char * address ... (this gets reduced to the above, presumably) std::shared_ptr mem(const_cast(begin), nonstd::null_deleter()); #else std::shared_ptr mem(begin, nonstd::null_deleter()); #endif this->bytes_read = end - begin; /* Note that we don't actually use the 'length' parameter. We really can't. * It's up to the user to make sure they don't go beyond the length they gave * us... */ return mem; } void LargeFileMMap::wr(const std::shared_ptr& data, uint64_t offset, size_t len) { if(len == 0) { return; } if(!this->is_open()) { throw std::invalid_argument("file is not open."); } if(this->filesize() < offset+this->header_size+len) { /* extend the file because it is too small -- mmap cannot make files * larger. */ if(ftruncate(fd, offset+this->header_size+len) != 0) { assert(errno == 0 && "ftruncate failed"); throw std::runtime_error("could not extend file."); } } const char* bytes = static_cast(data.get()); char* dest_bytes = static_cast(this->map); std::copy(bytes, bytes + len, dest_bytes + this->header_size + offset); } void LargeFileMMap::open(std::ios_base::openmode mode) { if(LargeFileFD::is_open()) { LargeFileFD::close(); } LargeFileFD::open(mode); #if _POSIX_C_SOURCE >= 200112L /* if they're going to write... make sure the disk space exists. This should * help keep the file contiguous on disk. */ if(mode & std::ios_base::out) { posix_fallocate(this->fd, 0, this->length+this->header_size); } #endif int mmap_prot = PROT_READ, mmap_flags = MAP_SHARED; if(mode & std::ios_base::out) { mmap_prot = PROT_WRITE; mmap_flags = MAP_SHARED; } else if(mode & std::ios_base::in) { mmap_prot = PROT_READ; mmap_flags = MAP_SHARED; /* MAP_PRIVATE? */ } // if the file is empty... we can't map it anyway. Just close it and bail. if(this->filesize() == 0) { LargeFileFD::close(); return; } /* are we opening the file read only? Truncate the length down to the file * size, then -- mapping less memory is easier on the kernel. */ if(mode & std::ios_base::in && !(mode & std::ios_base::out)) { this->length = std::min(this->length, this->filesize()); } /* length must be a multiple of the page size. Round it up. */ const long page_size = sysconf(_SC_PAGESIZE); const uint64_t u_page_size = static_cast(page_size); if(page_size != -1 && (this->length % u_page_size) != 0) { /* i.e. sysconf was successful and length isn't a multiple of page size. */ this->length += (u_page_size * ((this->length-1) / u_page_size)) + (u_page_size - this->length); assert((this->length % u_page_size) == 0); } assert(this->length > 0); // what header size did they request? Maybe we can just offset our // mmap a bit. This is generally good because some mmap's don't like // the length of the map to get too long. off_t begin = 0; if(this->byte_offset > u_page_size) { begin = this->byte_offset / u_page_size; this->byte_offset = this->byte_offset % u_page_size; } this->map = mmap(NULL, static_cast(this->length), mmap_prot, mmap_flags, this->fd, begin); if(MAP_FAILED == this->map) { assert(this->map != MAP_FAILED); this->close(); return; } } bool LargeFileMMap::is_open() const { return LargeFileFD::is_open() && this->map != NULL; } void LargeFileMMap::close() { if(!this->is_open()) { return; } if(this->map) { int mu = munmap(this->map, static_cast(this->length)); /* the only real errors that can occur here are programming errors; us not * properly maintaining "length", for example. */ assert(mu == 0 && "munmap can only fail due to a programming error."); if(mu != 0) { throw std::invalid_argument("could not unmap file; writes probably did " "not propagate."); } } this->map = NULL; LargeFileFD::close(); } ImageVis3D-3.1.0/Tuvok/Basics/Appendix.cpp0000644000175000017500000001274212320456500020053 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Appendix.cpp \author Jens Krueger SCI Institute University of Utah \date January 2009 */ #include "Appendix.h" #include "SysTools.h" #include "LargeRAWFile.h" using namespace std; Appendix::Appendix(string strTarget, const vector& vstrSource) : m_strAPXFile(strTarget), m_bOK(false) { uint64_t iOffset=0; for (size_t i = 0;i(m_vHeaderData.size(), false); uint64_t iMaxSize = 0; for (size_t i = 0;i(filename.length(), false); target.WriteRAW((unsigned char*)&(filename[0]), filename.length()); target.WriteData(m_vHeaderData[i].m_iSize, false); iMaxSize = max(iMaxSize, m_vHeaderData[i].m_iSize); } m_iHeaderLength = target.GetPos(); // append the files uint64_t iCopySize = min(iMaxSize,BLOCK_COPY_SIZE); unsigned char* pBuffer = new unsigned char[size_t(iCopySize)]; for (size_t i = 0;i 0); fInput.Close(); // remove path from file and leave only filename m_vHeaderData[i].m_strName = SysTools::GetFilename(m_vHeaderData[i].m_strName); } delete [] pBuffer; // done target.Close(); m_bOK = true; } Appendix::Appendix(string strAPXFile) : m_strAPXFile(strAPXFile), m_bOK(false) { LargeRAWFile fInput(m_strAPXFile); fInput.Open(false); if (!fInput.IsOpen()) { return; } string fileMagic = "12345678"; fInput.ReadRAW((unsigned char*)&(fileMagic[0]),8); if (fileMagic != "APPENDIX") { fInput.Close(); return; } uint64_t iFileCount = 0; uint64_t iOffset=0; fInput.ReadData(iFileCount, false); for (size_t i = 0;i(iNameLength, false); strName.resize(size_t(iNameLength)); fInput.ReadRAW((unsigned char*)&(strName[0]), iNameLength); fInput.ReadData(iSize, false); m_vHeaderData.push_back(InternalFileInfo(strName, iSize, iOffset)); iOffset += iSize; } m_iHeaderLength = fInput.GetPos(); fInput.Close(); m_bOK = true; } std::vector Appendix::ListFiles() { std::vector list; for (size_t i = 0;i= m_vHeaderData.size()) return false; LargeRAWFile fInput(m_strAPXFile); fInput.Open(false); if (!fInput.IsOpen()) { return false; } fInput.SeekPos(m_iHeaderLength+m_vHeaderData[i].m_iOffset); LargeRAWFile fOutput(strTarget); fOutput.Create(); if (!fOutput.IsOpen()) { fInput.Close(); return false; } uint64_t iCopySize = min(m_vHeaderData[i].m_iSize, BLOCK_COPY_SIZE); uint64_t iWritten = 0; unsigned char* pBuffer = new unsigned char[size_t(iCopySize)]; do { iCopySize = fInput.ReadRAW(pBuffer, iCopySize); fOutput.WriteRAW(pBuffer, iCopySize); iWritten += iCopySize; if (m_vHeaderData[i].m_iSize - iWritten < iCopySize) iCopySize = m_vHeaderData[i].m_iSize - iWritten; } while (iWritten < m_vHeaderData[i].m_iSize); delete [] pBuffer; fInput.Close(); fOutput.Close(); return true; } ImageVis3D-3.1.0/Tuvok/Basics/Systeminfo/0000755000175000017500000000000012320456500017731 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/Basics/Systeminfo/VidMemViaDDraw.cpp0000644000175000017500000001265712320456500023213 0ustar mathieumathieu//---------------------------------------------------------------------------- // File: VidMemViaDDraw.cpp // // This method queries the DirectDraw 7 interfaces for the amount of available // video memory. On a discrete video card, this is often close to the amount // of dedicated video memory and usually does not take into account the amount // of shared system memory. // // Copyright (c) Microsoft Corp. All rights reserved. //----------------------------------------------------------------------------- #if defined(_WIN32) && defined(USE_DIRECTX) #define INITGUID #include #include #include #include #include #define COMPILE_MULTIMON_STUBS #include //----------------------------------------------------------------------------- // Defines, and constants //----------------------------------------------------------------------------- #ifndef SAFE_DELETE #define SAFE_DELETE(p) { if (p) { delete (p); (p)=NULL; } } #endif #ifndef SAFE_DELETE_ARRAY #define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p)=NULL; } } #endif #ifndef SAFE_RELEASE #define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p)=NULL; } } #endif typedef HRESULT ( WINAPI* LPDIRECTDRAWCREATE )( GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter ); BOOL CALLBACK MonitorEnumProc( HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData ); struct DDRAW_MATCH { GUID guid; HMONITOR hMonitor; CHAR strDriverName[512]; bool bFound; }; //----------------------------------------------------------------------------- BOOL WINAPI DDEnumCallbackEx( GUID FAR* lpGUID, LPSTR , LPSTR lpDriverName, LPVOID lpContext, HMONITOR hm ) { DDRAW_MATCH* pDDMatch = ( DDRAW_MATCH* ) lpContext; if( pDDMatch->hMonitor == hm ) { pDDMatch->bFound = true; strcpy_s( pDDMatch->strDriverName, 512, lpDriverName ); memcpy( &pDDMatch->guid, lpGUID, sizeof( GUID ) ); } return TRUE; } //----------------------------------------------------------------------------- HRESULT GetVideoMemoryViaDirectDraw( HMONITOR hMonitor, DWORD* pdwAvailableVidMem ) { LPDIRECTDRAW pDDraw = NULL; LPDIRECTDRAWENUMERATEEXA pDirectDrawEnumerateEx = NULL; HRESULT hr; bool bGotMemory = false; *pdwAvailableVidMem = 0; HINSTANCE hInstDDraw; LPDIRECTDRAWCREATE pDDCreate = NULL; hInstDDraw = LoadLibrary( L"ddraw.dll" ); if( hInstDDraw ) { DDRAW_MATCH match; ZeroMemory( &match, sizeof( DDRAW_MATCH ) ); match.hMonitor = hMonitor; pDirectDrawEnumerateEx = ( LPDIRECTDRAWENUMERATEEXA )GetProcAddress( hInstDDraw, "DirectDrawEnumerateExA" ); if( pDirectDrawEnumerateEx ) { hr = pDirectDrawEnumerateEx( DDEnumCallbackEx, ( VOID* )&match, DDENUM_ATTACHEDSECONDARYDEVICES ); } pDDCreate = ( LPDIRECTDRAWCREATE )GetProcAddress( hInstDDraw, "DirectDrawCreate" ); if( pDDCreate ) { pDDCreate( &match.guid, &pDDraw, NULL ); LPDIRECTDRAW7 pDDraw7; if( SUCCEEDED( pDDraw->QueryInterface( IID_IDirectDraw7, ( VOID** )&pDDraw7 ) ) ) { DDSCAPS2 ddscaps; ZeroMemory( &ddscaps, sizeof( DDSCAPS2 ) ); ddscaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM; hr = pDDraw7->GetAvailableVidMem( &ddscaps, pdwAvailableVidMem, NULL ); if( SUCCEEDED( hr ) ) bGotMemory = true; pDDraw7->Release(); } } FreeLibrary( hInstDDraw ); } if( bGotMemory ) return S_OK; else return E_FAIL; } HRESULT GetDeviceIDFromHMonitor( HMONITOR hm, WCHAR* strDeviceID, int cchDeviceID ) { HINSTANCE hInstDDraw; hInstDDraw = LoadLibrary( L"ddraw.dll" ); if( hInstDDraw ) { DDRAW_MATCH match; ZeroMemory( &match, sizeof( DDRAW_MATCH ) ); match.hMonitor = hm; LPDIRECTDRAWENUMERATEEXA pDirectDrawEnumerateEx = NULL; pDirectDrawEnumerateEx = ( LPDIRECTDRAWENUMERATEEXA )GetProcAddress( hInstDDraw, "DirectDrawEnumerateExA" ); if( pDirectDrawEnumerateEx ) pDirectDrawEnumerateEx( DDEnumCallbackEx, ( VOID* )&match, DDENUM_ATTACHEDSECONDARYDEVICES ); if( match.bFound ) { LONG iDevice = 0; DISPLAY_DEVICEA dispdev; ZeroMemory( &dispdev, sizeof( dispdev ) ); dispdev.cb = sizeof( dispdev ); while( EnumDisplayDevicesA( NULL, iDevice, ( DISPLAY_DEVICEA* )&dispdev, 0 ) ) { // Skip devices that are monitors that echo another display if( dispdev.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER ) { iDevice++; continue; } // Skip devices that aren't attached since they cause problems if( ( dispdev.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP ) == 0 ) { iDevice++; continue; } if( _stricmp( match.strDriverName, dispdev.DeviceName ) == 0 ) { MultiByteToWideChar( CP_ACP, 0, dispdev.DeviceID, -1, strDeviceID, cchDeviceID ); return S_OK; } iDevice++; } } FreeLibrary( hInstDDraw ); } return E_FAIL; } #endif ImageVis3D-3.1.0/Tuvok/Basics/Systeminfo/VidMemViaDXGI.cpp0000644000175000017500000000557712320456500022750 0ustar mathieumathieu//---------------------------------------------------------------------------- // File: VidMemViaDXGI.cpp // // // DXGI is only available on Windows Vista or later. This method returns the // amount of dedicated video memory, the amount of dedicated system memory, // and the amount of shared system memory. DXGI is more reflective of the true // system configuration than the previous 4 methods. // // Copyright (c) Microsoft Corp. All rights reserved. //----------------------------------------------------------------------------- #if defined(_WIN32) && defined(USE_DIRECTX) #define INITGUID #include #include #include #include #include #include "../DynamicDX.h" HRESULT GetVideoMemoryViaDXGI( HMONITOR hMonitor, SIZE_T* pDedicatedVideoMemory, SIZE_T* pDedicatedSystemMemory, SIZE_T* pSharedSystemMemory ) { HRESULT hr; bool bGotMemory = false; *pDedicatedVideoMemory = 0; *pDedicatedSystemMemory = 0; *pSharedSystemMemory = 0; if( DynamicDX::IsInitialized() ) { IDXGIFactory* pDXGIFactory = NULL; DynamicDX::CreateDXGIFactory( __uuidof( IDXGIFactory ), ( LPVOID* )&pDXGIFactory ); for( int index = 0; ; ++index ) { bool bFoundMatchingAdapter = false; IDXGIAdapter* pAdapter = NULL; hr = pDXGIFactory->EnumAdapters( index, &pAdapter ); if( FAILED( hr ) ) // DXGIERR_NOT_FOUND is expected when the end of the list is hit break; for( int iOutput = 0; ; ++iOutput ) { IDXGIOutput* pOutput = NULL; hr = pAdapter->EnumOutputs( iOutput, &pOutput ); if( FAILED( hr ) ) // DXGIERR_NOT_FOUND is expected when the end of the list is hit break; DXGI_OUTPUT_DESC outputDesc; ZeroMemory( &outputDesc, sizeof( DXGI_OUTPUT_DESC ) ); if( SUCCEEDED( pOutput->GetDesc( &outputDesc ) ) ) { if( hMonitor == outputDesc.Monitor ) bFoundMatchingAdapter = true; } SAFE_RELEASE( pOutput ); } if( bFoundMatchingAdapter ) { DXGI_ADAPTER_DESC desc; ZeroMemory( &desc, sizeof( DXGI_ADAPTER_DESC ) ); if( SUCCEEDED( pAdapter->GetDesc( &desc ) ) ) { bGotMemory = true; *pDedicatedVideoMemory = desc.DedicatedVideoMemory; *pDedicatedSystemMemory = desc.DedicatedSystemMemory; *pSharedSystemMemory = desc.SharedSystemMemory; } break; } } } if( bGotMemory ) return S_OK; else return E_FAIL; } #endif ImageVis3D-3.1.0/Tuvok/Basics/Plane.cpp0000644000175000017500000001243412320456500017340 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Plane.h \author Jens Krueger SCI Institute University of Utah */ #include "Plane.h" const PLANE ExtendedPlane::ms_Plane(0,0,1,0); ExtendedPlane::ExtendedPlane(): m_Plane(ms_Plane) { m_mat[0] = FLOATMATRIX4(); m_mat[1] = FLOATMATRIX4(); } ExtendedPlane::ExtendedPlane(const FLOATMATRIX4& m1, const FLOATMATRIX4& m2, const PLANE& plane) : m_Plane(plane) { m_mat[0] = m1; m_mat[1] = m2; } ExtendedPlane ExtendedPlane::FarawayPlane() { ExtendedPlane p; FLOATMATRIX4 translation; translation.Translation(0,0,100000); p.Transform(translation,false); return p; } void ExtendedPlane::Transform(const FLOATMATRIX4& mat, bool bSecondary) { if (bSecondary) { // perform the rotation of the clip plane always relative to the // object center, therefore, we need to shift the plane to the center first // then perform the transformation (e.g. rotation) and then shift it back FLOATMATRIX4 transComp, invTransComp; transComp.m41 = m_mat[0].m41; transComp.m42 = m_mat[0].m42; transComp.m43 = m_mat[0].m43; invTransComp.m41 = -m_mat[0].m41; invTransComp.m42 = -m_mat[0].m42; invTransComp.m43 = -m_mat[0].m43; m_mat[1] = m_mat[1] * transComp * mat * invTransComp; } else { m_mat[0] = m_mat[0] * mat; } UpdatePlane(); } void ExtendedPlane::UpdatePlane() { m_Plane = ms_Plane * GetCompleteTransform(); } bool ExtendedPlane::Quad(const FLOATVECTOR3& vEye, std::vector& quad, const float fWidgetSize) const { FLOATMATRIX4 complete = GetCompleteTransform(); // transform the coordinate frame of the quad FLOATVECTOR3 v1 = (FLOATVECTOR4(1,0,0,0) * complete).xyz(); FLOATVECTOR3 v2 = (FLOATVECTOR4(0,1,0,0) * complete).xyz(); // normalize just to be sure v1.normalize(); v2.normalize(); // construct a line from the center of the dataset in the direction of the plane FLOATVECTOR3 centerOfDataset = (FLOATVECTOR4(0,0,0,1) * m_mat[0]).xyz(); FLOATVECTOR3 centerOfDatasetToPlane = centerOfDataset+m_Plane.normal(); // find the intersection of that line with the clip plane // this is the closest point of the plane to the object center and // we will use this point as the center of the widget FLOATVECTOR3 pt_on_plane; m_Plane.intersect(centerOfDataset,centerOfDatasetToPlane, pt_on_plane); FLOATVECTOR3 viewDir = pt_on_plane-vEye; // "push back" the triangulated quad if((m_Plane.xyz() ^ viewDir) < 0) { quad.push_back((pt_on_plane + (fWidgetSize*(v1 + v2)))); quad.push_back((pt_on_plane + (fWidgetSize*(v1 - v2)))); quad.push_back((pt_on_plane + (fWidgetSize*(-v1 - v2)))); quad.push_back((pt_on_plane + (fWidgetSize*(-v1 - v2)))); quad.push_back((pt_on_plane + (fWidgetSize*(-v1 + v2)))); quad.push_back((pt_on_plane + (fWidgetSize*(v1 + v2)))); } else { quad.push_back((pt_on_plane + (fWidgetSize*(-v1 - v2)))); quad.push_back((pt_on_plane + (fWidgetSize*(v1 - v2)))); quad.push_back((pt_on_plane + (fWidgetSize*(v1 + v2)))); quad.push_back((pt_on_plane + (fWidgetSize*(v1 + v2)))); quad.push_back((pt_on_plane + (fWidgetSize*(-v1 + v2)))); quad.push_back((pt_on_plane + (fWidgetSize*(-v1 - v2)))); } // "push back" the lines for the border quad.push_back((pt_on_plane + (fWidgetSize*(v1 + v2)))); quad.push_back((pt_on_plane + (fWidgetSize*(v1 - v2)))); quad.push_back((pt_on_plane + (fWidgetSize*(v1 - v2)))); quad.push_back((pt_on_plane + (fWidgetSize*(-v1 - v2)))); quad.push_back((pt_on_plane + (fWidgetSize*(-v1 - v2)))); quad.push_back((pt_on_plane + (fWidgetSize*(-v1 + v2)))); quad.push_back((pt_on_plane + (fWidgetSize*(-v1 + v2)))); quad.push_back((pt_on_plane + (fWidgetSize*(v1 + v2)))); return (m_Plane.xyz() ^ viewDir) < 0; } /// Sets the plane back to default values. void ExtendedPlane::Default(bool bSecondary) { m_mat[(bSecondary) ? 1 : 0] = FLOATMATRIX4(); UpdatePlane(); } FLOATMATRIX4 ExtendedPlane::GetCompleteTransform() const { return m_mat[1] * m_mat[0]; } ImageVis3D-3.1.0/Tuvok/Basics/MathTools.cpp0000644000175000017500000000605012320456500020210 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file MathTools.cpp \author Jens Krueger SCI Institute University of Utah \version 1.11 \date October 2008 */ #include "MathTools.h" #include uint32_t MathTools::Log(uint32_t value, uint32_t base) { return uint32_t(log(float(value)) / log(float(base))); } float MathTools::Log(float value, float base) { return log(value) / log(base); } uint32_t MathTools::Pow(uint32_t base, uint32_t exponent) { return uint32_t(0.5f+pow(float(base), float(exponent))); } uint64_t MathTools::Pow(uint64_t base, uint64_t exponent) { return uint64_t(0.5+pow(double(base), double(exponent))); } uint32_t MathTools::Log2(uint32_t n) { int iLog=0; while( n>>=1 ) iLog++; return iLog; } uint32_t MathTools::Pow2(uint32_t e) { return 1<>=1 ) iLog++; return iLog; } uint64_t MathTools::Pow2(uint64_t e) { return static_cast(1) << e; } uint32_t MathTools::GaussianSum(uint32_t n) { return n*(n+1)/2; } bool MathTools::IsPow2(uint32_t n) { return ((n&(n-1))==0); }; uint32_t MathTools::NextPow2(uint32_t n, bool bReturn_ID_on_Pow2) { if (bReturn_ID_on_Pow2 && IsPow2(n)) return n; return Pow2(Log2(n)+1); } bool MathTools::NaN(float f) { #ifdef USABLE_TR1 return std::isnan(f); #elif defined(_MSC_VER) return _finite(f) == 0; #else // Hack, relies on 'f' being IEEE-754! return f != f; #endif } float MathTools::Clamp(float val, float a, float b) { return std::max(a, std::min(b, val)); } uint32_t MathTools::Clamp(uint32_t val, uint32_t a, uint32_t b) { return std::max(a, std::min(b, val)); } uint64_t MathTools::Clamp(uint64_t val, uint64_t a, uint64_t b) { return std::max(a, std::min(b, val)); } int MathTools::Clamp(int val, int a, int b) { return std::max(a, std::min(b, val)); } ImageVis3D-3.1.0/Tuvok/Basics/Threads.h0000644000175000017500000001526412320456500017344 0ustar mathieumathieu#pragma once #ifndef TUVOK_THREADS_H #define TUVOK_THREADS_H #include "StdDefines.h" #include #include #include #include #ifdef DETECTED_OS_WINDOWS #include #else #include #endif // TODO // add timeout to CriticalSection Lock() (use CreateMutex/WaitForSingleObject etc. for this on Windows) // add exceptions (same style as in Sockets) namespace tuvok { static const uint32_t INFINITE_TIMEOUT = std::numeric_limits::max(); class CriticalSection { friend class WaitCondition; public: CriticalSection(); ~CriticalSection(); void Lock(); bool TryLock(); void Unlock(); protected: #ifdef DETECTED_OS_WINDOWS CRITICAL_SECTION m_csIDGuard; #else pthread_mutex_t m_csIDGuard; #endif private: // object is non copyable, declare private c'tor and assignment operator to prevent compiler warnings CriticalSection(CriticalSection const&); CriticalSection& operator=(CriticalSection const&); }; class ScopedLock { public: ScopedLock(CriticalSection& guard) : m_Guard(guard) { m_Guard.Lock(); } ScopedLock(CriticalSection* pGuard) : m_Guard(*pGuard) { assert(pGuard != NULL); m_Guard.Lock(); } ScopedLock(std::shared_ptr& pGuard) : m_Guard(*pGuard.get()) { assert(pGuard.get() != NULL); m_Guard.Lock(); } ~ScopedLock() { m_Guard.Unlock(); } private: // object is non copyable, declare private c'tor and assignment operator to prevent compiler warnings ScopedLock(ScopedLock const& other); ScopedLock& operator=(ScopedLock const& other); CriticalSection& m_Guard; }; #define SCOPEDLOCK(guard) tuvok::ScopedLock scopedLock(guard); class WaitCondition { public: WaitCondition(); ~WaitCondition(); bool Wait(CriticalSection& criticalSection, uint32_t timeoutInMilliseconds = INFINITE_TIMEOUT); // returns false if timeout occurred void WakeOne(); void WakeAll(); protected: #ifdef DETECTED_OS_WINDOWS CONDITION_VARIABLE m_cvWaitCondition; #else pthread_cond_t m_cvWaitCondition; #endif private: // object is non copyable, declare private c'tor and assignment operator to prevent compiler warnings WaitCondition(WaitCondition const&); WaitCondition& operator=(WaitCondition const&); }; class ThreadClass { public: ThreadClass(); virtual ~ThreadClass(); // will kill thread if not joined in derived class d'tor virtual bool StartThread(void* pData = NULL); bool JoinThread(uint32_t timeoutInMilliseconds = INFINITE_TIMEOUT); bool KillThread(); // only use in extreme cases at own risk void RequestThreadStop() { m_bContinue = false; Resume(); } bool IsThreadStopRequested() const { return !m_bContinue; } bool IsRunning(); bool Resume(); typedef std::function PredicateFunction; protected: virtual void ThreadMain(void* pData = NULL) = 0; bool Suspend(PredicateFunction pPredicate = PredicateFunction()); CriticalSection m_SuspendGuard; bool m_bContinue; #ifdef DETECTED_OS_WINDOWS HANDLE m_hThread; #else pthread_t m_hThread; #endif private: // object is non copyable, declare private c'tor and assignment operator to prevent compiler warnings ThreadClass(ThreadClass const&); ThreadClass& operator=(ThreadClass const&); struct ThreadData { void* pData; ThreadClass* pThread; }; #ifdef DETECTED_OS_WINDOWS static DWORD WINAPI StaticStartFunc(LPVOID pThreadStarterData); #else static void* StaticStartFunc(void* pThreadStarterData); bool m_bInitialized; bool m_bJoinable; CriticalSection m_JoinMutex; WaitCondition m_JoinWaitCondition; #endif ThreadData* m_pStartData; bool m_bResumable; WaitCondition m_SuspendWait; }; class LambdaThread : public ThreadClass { public: // interface to be able to call protected thread methods from some function that gets executed by ThreadMain class Interface { friend class LambdaThread; public: bool Suspend(PredicateFunction pPredicate = PredicateFunction()) { return m_Parent.Suspend(pPredicate); } CriticalSection& GetSuspendGuard() { return m_Parent.m_SuspendGuard; } private: // object is non copyable, declare private c'tor and assignment operator to prevent compiler warnings Interface(Interface const&); Interface& operator=(Interface const&); Interface(LambdaThread& parent) : m_Parent(parent) {} LambdaThread& m_Parent; }; typedef std::function ThreadMainFunction; LambdaThread(ThreadMainFunction pMain) : ThreadClass(), m_pMain(pMain) {} protected: virtual void ThreadMain(void*) { Interface threadInterface(*this); m_pMain(m_bContinue, threadInterface); } private: ThreadMainFunction m_pMain; }; template class AtomicAccess { public: AtomicAccess() : m_Value(), m_pGuard(new CriticalSection()) {} AtomicAccess(T const& value) : m_Value(value), m_pGuard(new CriticalSection()) {} AtomicAccess& operator=(T const& rhs) { SetValue(rhs); return *this; } CriticalSection& GetGuard() const { return *(m_pGuard.get()); } T GetValue() const { SCOPEDLOCK(GetGuard()); return m_Value; } void SetValue(T const& value) { SCOPEDLOCK(GetGuard()); m_Value = value; } private: T m_Value; std::unique_ptr m_pGuard; }; } // namespace tuvok #endif // TUVOK_THREADS_H /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/Basics/PerfCounter.h0000644000175000017500000000763612320456500020212 0ustar mathieumathieu#ifndef TUVOK_PERF_COUNTER_H #define TUVOK_PERF_COUNTER_H /// Valid performance counters the system should track. /// When adding a new counter, please add a (units) clause so we know how to /// interpret the value! enum PerfCounter { // structured timers, indention signals timer hierarchy PERF_SUBFRAMES=0, // number of subframes (counter) PERF_RENDER, // (milliseconds) PERF_RAYCAST, // raycasting part of rendering (milliseconds) PERF_READ_HTABLE, // reading hash table from GPU (milliseconds) PERF_CONDENSE_HTABLE, // condensing hash table [removing empties] (milliseconds) PERF_SORT_HTABLE, // sort bricks by file offset, necessary for layouts PERF_UPLOAD_BRICKS, // uploading bricks to GPU [tex updates] (milliseconds) PERF_POOL_SORT, // sorting the brick pool info (milliseconds) PERF_POOL_UPLOADED_MEM, // overall uploaded mem to GPU (bytes) PERF_POOL_GET_BRICK, // overall operation of GetBrick call from the pool (milliseconds) PERF_DY_GET_BRICK, // overall operation of GetBrick call for dynamic bricked datasets (milliseconds) PERF_DY_CACHE_LOOKUPS, // cache look ups (counter) PERF_DY_CACHE_LOOKUP, // looking up/copying from cache (milliseconds) PERF_DY_RESERVE_BRICK, // aquire brick memory PERF_DY_LOAD_BRICK, // load (GetBrick) brick from the underlying dataset (milliseconds) PERF_DY_CACHE_ADDS, // cache adds (counter) PERF_DY_CACHE_ADD, // adding/copying into the brick cache (milliseconds) PERF_DY_BRICK_COPIED, // brick copying (counter) PERF_DY_BRICK_COPY, // copying data into rebricked bricks (milliseconds) PERF_POOL_UPLOAD_BRICK, // pool upload of a single brick (milliseconds) PERF_POOL_UPLOAD_TEXEL, // uploading single texel of pool (milliseconds) PERF_POOL_UPLOAD_METADATA, // uploading complete pool metadata instead of single texels (milliseconds) // low level Extended Octree measures // these timers belong under PERF_DY_LOAD_BRICK or PERF_POOL_GET_BRICK if // there is no dyn bricked dataset PERF_EO_BRICKS, // number of bricks read/processed (counter) PERF_EO_DISK_READ, // reading bricks from disk (milliseconds) PERF_EO_DECOMPRESSION, // decompressing brick data (milliseconds) PERF_MM_PRECOMPUTE, // computing min/max for new bricks (milliseconds) PERF_SOMETHING, // ad hoc, always changing (milliseconds) PERF_END // invalid; used for sizing table. }; /// interface for classes which can be queried in this way. struct PerfQueryable { virtual double PerfQuery(enum PerfCounter) = 0; }; #endif /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2013 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/Basics/Clipper.cpp0000644000175000017500000001512012320456500017672 0ustar mathieumathieu#include "Clipper.h" #include #include // Calculates the intersection point of a line segment lb->la which crosses the // plane with normal 'n'. static bool RayPlaneIntersection(const FLOATVECTOR3 &la, const FLOATVECTOR3 &lb, const FLOATVECTOR3 &n, const float D, FLOATVECTOR3 &hit) { const float denom = n ^ (la - lb); if(EpsilonEqual(denom, 0.0f)) { return false; } const float t = ((n ^ la) + D) / denom; hit = la + (t*(lb - la)); return true; } // Splits a triangle along a plane with the given normal. // Assumes: plane's D == 0. // triangle does span the plane. void SplitTriangle(FLOATVECTOR3 a, FLOATVECTOR3 b, FLOATVECTOR3 c, float fa, float fb, float fc, const FLOATVECTOR3 &normal, const float D, std::vector& out, std::vector& newVerts) { // rotation / mirroring. // c // o Push `c' to be alone on one side of the plane, making // / \ `a' and `b' on the other. Later we'll be able to // plane --------- assume that there will be an intersection with the // / \ clip plane along the lines `ac' and `bc'. This // o-------o reduces the number of cases below. // a b // if fa*fc is non-negative, both have the same sign -- and thus are on the // same side of the plane. if(fa*fc >= 0) { std::swap(fb, fc); std::swap(b, c); std::swap(fa, fb); std::swap(a, b); } else if(fb*fc >= 0) { std::swap(fa, fc); std::swap(a, c); std::swap(fa, fb); std::swap(a, b); } // Find the intersection points. FLOATVECTOR3 A, B; RayPlaneIntersection(a,c, normal,D, A); RayPlaneIntersection(b,c, normal,D, B); if(fc >= 0) { out.push_back(a); out.push_back(b); out.push_back(A); out.push_back(b); out.push_back(B); out.push_back(A); } else { out.push_back(A); out.push_back(B); out.push_back(c); } newVerts.push_back(A); newVerts.push_back(B); } std::vector Clipper::TriPlane(std::vector& posData, const FLOATVECTOR3 &normal, const float D) { std::vector newVertices; std::vector out; if (posData.size() % 3 != 0) return newVertices; for(auto iter = posData.begin(); iter < (posData.end()-2); iter += 3) { const FLOATVECTOR3 &a = (*iter); const FLOATVECTOR3 &b = (*(iter+1)); const FLOATVECTOR3 &c = (*(iter+2)); float fa = (normal ^ a) + D; float fb = (normal ^ b) + D; float fc = (normal ^ c) + D; if(fabs(fa) < (2 * std::numeric_limits::epsilon())) { fa = 0; } if(fabs(fb) < (2 * std::numeric_limits::epsilon())) { fb = 0; } if(fabs(fc) < (2 * std::numeric_limits::epsilon())) { fc = 0; } if(fa >= 0 && fb >= 0 && fc >= 0) { // trivial reject // discard -- i.e. do nothing / ignore tri. continue; } else if(fa <= 0 && fb <= 0 && fc <= 0) { // trivial accept out.push_back(a); out.push_back(b); out.push_back(c); } else { // triangle spans plane -- must be split. std::vector tris, newVerts; SplitTriangle(a,b,c, fa,fb,fc,normal,D, tris, newVerts); // append triangles and vertices to lists out.insert(out.end(), tris.begin(), tris. end()); newVertices.insert(newVertices.end(), newVerts.begin(), newVerts. end()); } } posData = out; return newVertices; } struct CompSorter { bool operator() (const FLOATVECTOR3& i, const FLOATVECTOR3& j) const { return i.x < j.x || (i.x == j.x && i.y < j.y) || (i.x == j.x && i.y == j.y && i.z < j.z); } }; static bool AngleSorter(const FLOATVECTOR3& i, const FLOATVECTOR3& j, const FLOATVECTOR3& center, const FLOATVECTOR3& refVec, const FLOATVECTOR3& normal) { FLOATVECTOR3 vecI = (i-center).normalized(); float cosI = refVec ^ vecI; float sinI = (vecI % refVec)^ normal; FLOATVECTOR3 vecJ = (j-center).normalized(); float cosJ = refVec ^ vecJ; float sinJ = (vecJ % refVec) ^ normal; float acI = atan2(sinI, cosI); float acJ = atan2(sinJ, cosJ); return acI > acJ; } void Clipper::BoxPlane(std::vector& posData, const FLOATVECTOR3 &normal, const float D) { std::vector newVertices = Clipper::TriPlane(posData, normal, D); if (newVertices.size() < 3) return; // remove duplicate vertices std::sort(newVertices.begin(), newVertices.end(), CompSorter()); newVertices.erase(std::unique(newVertices.begin(), newVertices.end()), newVertices.end()); // sort counter clockwise using namespace std::placeholders; FLOATVECTOR3 center; for (auto vertex = newVertices.begin();vertex #include #include #include #ifndef NDEBUG # include # define DEBUG(...) do { std::cerr << __VA_ARGS__ << "\n"; } while(0) #else # define DEBUG(...) do { /* nothing, debug msg removed. */ } while(0) #endif #include #include #include "LargeFileAIO.h" /// searches for a request among a list of outstanding AIO ops. The given /// offset is intended to be exact (i.e. this won't apply header offsets). static struct aiocb* find_request(const LargeFileAIO::Reqs& reqs, uint64_t offset, size_t len); LargeFileAIO::LargeFileAIO(const std::string fn, std::ios_base::openmode mode, uint64_t header_size, uint64_t /* length */) : LargeFileFD(fn, mode, header_size), writes_copied(true) { this->open(mode); } LargeFileAIO::LargeFileAIO(const std::wstring fn, std::ios_base::openmode mode, uint64_t header_size, uint64_t /* length */) : LargeFileFD(fn, mode, header_size), writes_copied(true) { this->open(mode); } LargeFileAIO::~LargeFileAIO() { this->close(); } namespace nonstd { // hack. This only works here because we know we are always allocating // bytes, even though our interface requires us to shove them into a const // void*. template<> struct DeleteArray { void operator()(const void* t) const { delete[] static_cast(t); } }; } std::shared_ptr LargeFileAIO::rd(uint64_t offset, size_t len) { struct aiocb *cb; // first, try to find this request among our list of outstanding requests. const uint64_t real_offset = offset + this->header_size; cb = find_request(this->control, real_offset, len); if(NULL == cb) { if((cb = submit_new_request(real_offset, len)) == NULL) { DEBUG("could not submit new request."); // .. so just bail. return std::shared_ptr(); } } const struct aiocb* const cblist[1] = { cb }; { int susp=0; do { susp = aio_suspend(cblist, 1, NULL); } while(susp == -1 && errno==EINTR); } #ifndef NDEBUG int e = aio_error(cb); if(e != 0) { DEBUG("aio incomplete! aio_error(" << cb << ") = " << e); } #endif ssize_t bytes = aio_return(cb); assert(bytes == static_cast(len)); this->bytes_read = bytes; // both our control block and our data buffer are dynamically allocated. // Make sure they'll both get freed up; control block now, and the data will // be the return shared_ptr, so it's that ptr's responsibility to clean it // up. std::shared_ptr mem = this->control.find(cb)->second; delete cb; this->control.erase(cb); return mem; } /// notifies the object that we're going to need the following data soon. /// Many implementations will prefetch this data when it knows this. void LargeFileAIO::enqueue(uint64_t offset, size_t len) { if(len == 0) { return; } struct aiocb* cb; // hint at the FD level. Not terribly important; the kernel will get the // read request in just a second, when we submit. But it might be able to // read a page or two before we get to submitting the request -- especially // if we happen to get put to sleep between now and then. LargeFileFD::enqueue(offset, len); // do they already have such a request outstanding? const uint64_t real_offset = offset + this->header_size; cb = find_request(this->control, real_offset, len); if(cb != NULL) { DEBUG("request already exists... ignoring it."); return; } submit_new_request(real_offset, len); } void LargeFileAIO::wr(const std::shared_ptr& data, uint64_t offset, size_t len) { if(len == 0) { return; } flush_writes(); // only allow one pending write.. struct aiocb* cb = new struct aiocb; ::memset(cb, 0, sizeof(struct aiocb)); cb->aio_fildes = this->fd; cb->aio_offset = offset + this->header_size; cb->aio_nbytes = len; std::shared_ptr saved_data; if(writes_copied) { // allocate a new buffer and hold on to that. int8_t* buf = new int8_t[len]; ::memcpy(buf, data.get(), len); #ifdef __clang__ saved_data = std::shared_ptr( buf, nonstd::DeleteArray() ); #else const void* bufv = static_cast(buf); saved_data = std::shared_ptr( bufv, nonstd::DeleteArray() ); #endif } else { saved_data = std::shared_ptr(data); } // cast away the const. We know the AIO op won't modify the data anyway -- // it's a write operation. cb->aio_buf = const_cast(saved_data.get()); { struct sigevent sigev; ::memset(&sigev, 0, sizeof(struct sigevent)); sigev.sigev_notify = SIGEV_NONE; cb->aio_sigevent = sigev; } cb->aio_lio_opcode = LIO_WRITE; if(aio_write(cb) != 0) { DEBUG("aio_write failed, errno=" << errno); switch(errno) { case EAGAIN: throw std::ios_base::failure("temporary lack of resources"); break; case ENOSYS: throw std::ios_base::failure("AIO not implemented on this platform."); break; case EBADF: throw std::ios_base::failure("invalid file descriptor."); break; case EINVAL: throw std::ios_base::failure("offset or reqprio was invalid."); break; } return; } // make sure we hold on to the memory. this->control.insert(std::make_pair(cb, saved_data)); } static void wait_on(struct aiocb* cb) { const struct aiocb* const cblist[1] = { cb }; int rv = 0; do { rv = aio_suspend(cblist, 1, NULL); } while(rv == -1 && errno == EINTR); assert(rv == 0); rv = aio_error(cb); assert(rv != EINPROGRESS); assert(rv != ECANCELED); rv = aio_return(cb); assert(rv != EINVAL); } void LargeFileAIO::copy_writes(bool copy) { this->writes_copied = copy; } void LargeFileAIO::close() { if(!this->is_open()) { return; } // if there were pending reads... who cares. But pending writes? We need to // wait on those and make sure they finish. this->flush_writes(); // okay. anything left in there isn't important. just cancel all of 'em. if(aio_cancel(this->fd, NULL) == EBADF) { throw std::out_of_range("bad file descriptor"); } // all of those aiocb* were dynamically allocated. free them up. for(Reqs::const_iterator i = this->control.begin(); i != this->control.end(); ++i) { // _return on them first; the library might be waiting for us to do that // before it frees up internal resources. #ifndef NDEBUG ssize_t rv = aio_return(i->first); assert(rv != EINVAL); #else aio_return(i->first); #endif delete i->first; } // we don't worry about the shared_ptr's -- they'll clean themselves up // automagically. this->control.clear(); LargeFileFD::close(); } struct aiocb* LargeFileAIO::submit_new_request(uint64_t offset, size_t len) { struct aiocb* cb = new struct aiocb; ::memset(cb, 0, sizeof(struct aiocb)); cb->aio_fildes = this->fd; cb->aio_offset = offset; std::shared_ptr data(new int8_t[len], nonstd::DeleteArray()); cb->aio_buf = data.get(); cb->aio_nbytes = len; { struct sigevent sigev; ::memset(&sigev, 0, sizeof(struct sigevent)); sigev.sigev_notify = SIGEV_NONE; cb->aio_sigevent = sigev; } cb->aio_lio_opcode = LIO_READ; if(aio_read(cb) == -1) { delete cb; switch(errno) { case EAGAIN: throw std::ios_base::failure("temporary lack of resources."); break; case ENOSYS: throw std::ios_base::failure("AIO not implemented on this platform"); break; case EBADF: throw std::ios_base::failure("invalid file descriptor."); break; case EINVAL: throw std::ios_base::failure("offset or reqprio is invalid."); break; } return NULL; } this->control.insert(std::make_pair(cb, data)); return cb; } /// searches for a request among a list of outstanding AIO ops. The given /// offset is intended to be exact (i.e. this won't apply header offsets). static struct aiocb* find_request( const LargeFileAIO::Reqs& reqs, uint64_t offset, size_t len) { for(LargeFileAIO::Reqs::const_iterator i = reqs.begin(); i != reqs.end(); ++i) { if(static_cast(i->first->aio_offset) == offset && i->first->aio_nbytes == len) { return i->first; } } return NULL; } // flushes any pending writes by waiting on them. void LargeFileAIO::flush_writes() { Reqs::const_iterator i = this->control.begin(); while(i != this->control.end()) { if(i->first->aio_lio_opcode == LIO_WRITE) { wait_on(i->first); delete i->first; #ifdef DETECTED_OS_APPLE /// @todo FIXME apple's tr1 is broken again, at least on 10.5. We no /// longer support 10.5 anyway, so test on 10.6. It's probably still /// broken on 10.6; we should fix the define so it is a bit more /// specific, instead of just blacklisting apple. this->control.erase(i); ++i; #else i = this->control.erase(i); #endif } else { ++i; } } } ImageVis3D-3.1.0/Tuvok/Basics/Grids.h0000644000175000017500000001366312320456500017023 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Grids.h \brief Simple grid templates \author Jens Krueger SCI Institute University of Utah \version 1.0 \date July 2008 */ #pragma once #ifndef GRIDS_H #define GRIDS_H #include "StdTuvokDefines.h" #include "Vectors.h" template class GridnD { public: GridnD() : m_pData(NULL) {} virtual ~GridnD() {delete [] this->m_pData;} T* GetDataPointer() {return this->m_pData;} T GetLinear(size_t i) const {return this->m_pData[i];} void SetLinear(size_t i, T tValue) {this->m_pData[i] = tValue;} protected: T* m_pData; }; template class Grid1D : public GridnD { public: Grid1D() : GridnD(), m_iSize(0) {} Grid1D(const size_t& iSize) : m_iSize(iSize) { this->m_pData = new T[m_iSize];} Grid1D(const Grid1D &other): m_iSize(other.m_iSize) { this->m_pData = new T[m_iSize]; memcpy(this->m_pData, other->m_pData, sizeof(T)*m_iSize); } virtual ~Grid1D() {} size_t GetFilledSize() const { size_t iSize = 0; for (size_t i = 0;im_pData[i] != 0) iSize = i+1; } return iSize; } size_t GetSize() const {return m_iSize;} void Resize(const size_t& iSize) { delete [] this->m_pData; m_iSize = iSize; this->m_pData = new T[m_iSize]; } T Get(size_t i) const {return this->m_pData[i];} void Set(size_t i, T tValue) {this->m_pData[i] = tValue;} Grid1D& operator=(const Grid1D& other) { delete [] this->m_pData; m_iSize = other.m_iSize; this->m_pData = new T[m_iSize]; memcpy(this->m_pData, other->m_pData, sizeof(T)*m_iSize); return *this; } private: size_t m_iSize; }; template class Grid2D : public GridnD { public: Grid2D() : GridnD(), m_iSize(0,0) {} Grid2D(const VECTOR2& iSize) : m_iSize(iSize) { this->m_pData = new T[m_iSize.area()];} Grid2D(const Grid2D &other): m_iSize(other.m_iSize) { this->m_pData = new T[m_iSize.area()]; memcpy(this->m_pData, other->m_pData, sizeof(T)*m_iSize.area()); } virtual ~Grid2D() {} VECTOR2 GetFilledSize() const { VECTOR2 vSize(0,0); for (size_t y = 0;yGet(x,y) != 0) { if ((x+1) > vSize.x) vSize.x = x+1; vSize.y = y+1; } } } return vSize; } VECTOR2 GetSize() const {return m_iSize;} void Resize(const VECTOR2& iSize) { delete [] this->m_pData; m_iSize = iSize; this->m_pData = new T[m_iSize.area()]; } T Get(const UINTVECTOR2& pos) const {return this->m_pData[pos.x+pos.y*m_iSize.x];} void Set(const UINTVECTOR2& pos, T tValue) {this->m_pData[pos.x+pos.y*m_iSize.x] = tValue;} T Get(size_t x, size_t y) const {return this->m_pData[x+m_iSize.x*y];} void Set(size_t x, size_t y, T tValue) {this->m_pData[x+m_iSize.x*y] = tValue;} Grid2D& operator=(const Grid2D& other) { delete [] this->m_pData; m_iSize = other.m_iSize; this->m_pData = new T[m_iSize.area()]; memcpy(this->m_pData, other->m_pData, sizeof(T)*m_iSize.area()); return *this; } private: VECTOR2 m_iSize; }; template class Grid3D : public GridnD { public: Grid3D() : GridnD(), m_iSize(0,0,0) {} Grid3D(const VECTOR3& iSize) : m_iSize(iSize) { this->m_pData = new T[m_iSize.volume()];} Grid3D(const Grid3D &other): m_iSize(other.m_iSize) { this->m_pData = new T[m_iSize.volume()]; memcpy(this->m_pData, other->m_pData, sizeof(T)*m_iSize.volume()); } virtual ~Grid3D() {} VECTOR3 GetSize() const {return m_iSize;} void Resize(const VECTOR3& iSize) { delete [] this->m_pData; m_iSize = iSize; this->m_pData = new T[m_iSize.volume()]; } T Get(const UINTVECTOR3& pos) const {return this->m_pData[pos.x+pos.y*m_iSize.x+pos.z*m_iSize.x*m_iSize.y];} void Set(const UINTVECTOR3& pos, T tValue) {this->m_pData[pos.x+pos.y*m_iSize.x+pos.z*m_iSize.x*m_iSize.y] = tValue;} T Get(size_t x, size_t y, size_t z) const {return this->m_pData[x+m_iSize.x*y+z*m_iSize.x*m_iSize.y];} void Set(size_t x, size_t y, size_t z, T tValue) {this->m_pData[x+m_iSize.x*y+z*m_iSize.x*m_iSize.y] = tValue;} Grid3D& operator=(const Grid3D& other) { delete [] this->m_pData; m_iSize = other.m_iSize; this->m_pData = new T[m_iSize.volume()]; memcpy(this->m_pData, other->m_pData, sizeof(T)*m_iSize.volume()); return *this; } private: VECTOR3 m_iSize; }; #endif // GRIDS_H ImageVis3D-3.1.0/Tuvok/Basics/ctti.h0000644000175000017500000001253012320456500016706 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2009 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifndef TUVOK_BASICS_CTTI_H #define TUVOK_BASICS_CTTI_H /** \brief CTTI: compile time type information * A lot of this we can glean from C++11, but code needing this kind of * functionality existed before C++11. So: * @todo see what can be removed in favor of C++11 definitions. */ #include "StdDefines.h" #include struct signed_tag {}; struct unsigned_tag {}; namespace { /// "Compile time type info" /// Metaprogramming type traits that we need but aren't in c++0x. /// is_signed: std::is_signed only returns true for *integral* signed types.. /// ridiculous. so we use this as a replacement. /// size_type: unsigned variant of 'T'. /// signed_type: signed variant of 'T'. ///@{ template struct ctti_base { enum { is_signed = std::is_signed::value || std::is_floating_point::value }; }; template struct ctti : ctti_base { }; template<> struct ctti : ctti_base { typedef bool size_type; typedef signed_tag sign_tag; }; template<> struct ctti : ctti_base { typedef unsigned char size_type; typedef signed char signed_type; typedef signed_tag sign_tag ; }; template<> struct ctti : ctti_base { typedef unsigned char size_type; typedef signed char signed_type; static const bool is_signed = true; typedef signed_tag sign_tag; }; template<> struct ctti : ctti_base { typedef unsigned char size_type; typedef signed char signed_type; typedef unsigned_tag sign_tag; }; template<> struct ctti : ctti_base { typedef unsigned short size_type; typedef short signed_type; typedef signed_tag sign_tag; }; template<> struct ctti : ctti_base { typedef unsigned short size_type; typedef short signed_type; typedef unsigned_tag sign_tag; }; #if defined(DETECTED_OS_WINDOWS) && _MSC_VER < 1600 template<> struct ctti : ctti_base { typedef unsigned int size_type; typedef int signed_type; typedef signed_tag sign_tag; }; template<> struct ctti : ctti_base { typedef uint32_t size_type; typedef int32_t signed_type; typedef unsigned_tag sign_tag; }; #endif template<> struct ctti : ctti_base { typedef uint32_t size_type; typedef int32_t signed_type; typedef signed_tag sign_tag; }; template<> struct ctti : ctti_base { typedef uint32_t size_type; typedef int32_t signed_type; typedef unsigned_tag sign_tag; }; template<> struct ctti : ctti_base { typedef uint64_t size_type; typedef int64_t signed_type; typedef signed_tag sign_tag; }; template<> struct ctti : ctti_base { typedef uint64_t size_type; typedef int64_t signed_type; typedef unsigned_tag sign_tag; }; template<> struct ctti : ctti_base { typedef float size_type; typedef float signed_type; typedef signed_tag sign_tag; }; template<> struct ctti : ctti_base { typedef double size_type; typedef double signed_type; typedef signed_tag sign_tag; }; ///@} }; /// Type tagging. namespace { struct signed_type {}; struct unsigned_type {}; signed_type type_category(signed char) { return signed_type(); } unsigned_type type_category(unsigned char) { return unsigned_type(); } signed_type type_category(short) { return signed_type(); } unsigned_type type_category(unsigned short) { return unsigned_type(); } #if defined(DETECTED_OS_WINDOWS) && _MSC_VER < 1600 signed_type type_category(int) { return signed_type(); } unsigned_type type_category(unsigned int) { return unsigned_type(); } #endif signed_type type_category(int32_t) { return signed_type(); } unsigned_type type_category(uint32_t) { return unsigned_type(); } signed_type type_category(int64_t) { return signed_type(); } unsigned_type type_category(uint64_t) { return unsigned_type(); } signed_type type_category(float) { return signed_type(); } signed_type type_category(double) { return signed_type(); } } #endif // TUVOK_BASICS_CTTI_H ImageVis3D-3.1.0/Tuvok/Basics/LargeFile.cpp0000644000175000017500000001036412320456500020133 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "StdDefines.h" #include #include #ifdef DETECTED_OS_WINDOWS # include #endif #if defined(DETECTED_OS_APPLE) || defined(DETECTED_OS_LINUX) # include #endif #ifndef NDEBUG # include # define DEBUG(...) do { std::cerr << __VA_ARGS__ << "\n"; } while(0) #else # define DEBUG(...) do { /* nothing, debug msg removed. */ } while(0) #endif #include "LargeFile.h" LargeFile::LargeFile(const std::string fn, std::ios_base::openmode, uint64_t hsz, uint64_t /* length */) : m_filename(fn), header_size(hsz), byte_offset(0), bytes_read(0) { } LargeFile::LargeFile(const std::wstring fn, std::ios_base::openmode, uint64_t hsz, uint64_t /* length */) : m_filename(fn.begin(), fn.end()), header_size(hsz), byte_offset(0), bytes_read(0) { } std::shared_ptr LargeFile::rd(size_t length) { // The other 'read' will take account of the header_size. std::shared_ptr rv(this->rd(this->byte_offset, length)); this->byte_offset += length; return rv; } uint64_t LargeFile::gcount() const { return this->bytes_read; } void LargeFile::wr(const std::shared_ptr& data, size_t length) { this->wr(data, this->byte_offset, length); this->byte_offset += length; } void LargeFile::seek(uint64_t to) { this->byte_offset = to; } uint64_t LargeFile::offset() const { return this->byte_offset; } void LargeFile::truncate(const char* path, uint64_t length) { DEBUG("path=" << path); #ifdef DETECTED_OS_WINDOWS HANDLE fp = CreateFileA(path, GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); LARGE_INTEGER location; location.QuadPart = static_cast(length); SetFilePointerEx(fp, location, NULL, FILE_BEGIN); SetEndOfFile(fp); CloseHandle(fp); #else int rv = 0; do { rv = ::truncate(path, length); } while(rv == -1 && errno == EINTR); if(rv == -1) { switch(errno) { case EFBIG: /* fall through */ case EINVAL: throw std::length_error("broken length"); break; case EIO: throw std::ios::failure("io error"); break; case EACCES: throw std::runtime_error("permission error"); break; case EISDIR: throw std::domain_error("path given is directory"); break; case ELOOP: throw std::runtime_error("too many levels of symlinks"); break; case ENAMETOOLONG: throw std::runtime_error("path too long"); break; case ENOENT: throw std::runtime_error("bad path"); break; case ENOTDIR: throw std::domain_error("path is not valid"); break; case EROFS: throw std::runtime_error("path is on RO filesystem"); break; } } #endif } void LargeFile::truncate(uint64_t length) { LargeFile::truncate(this->m_filename.c_str(), length); // move offset down if it's beyond EOF. this->byte_offset = std::min(this->byte_offset, length); } ImageVis3D-3.1.0/Tuvok/Basics/MC.h0000644000175000017500000000630012320456500016240 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : MC.h //! Author : Jens Krueger //! SCI Institute //! University of Utah //! MC tables by others (see remarks below) //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #pragma once #include "Vectors.h" #define EPSILON 0.000001f #define DATA_INDEX(I, J, K, IDIM, JDIM) ((I) + ((IDIM) * (J)) + ((IDIM * JDIM) * (K))) #define EDGE_INDEX(E, I, J, IDIM) ((E) + (12 * (I)) + ((12 * (IDIM)) * (J))) #define NO_EDGE -1 template class LayerTempData { public: T* pTBotData; T* pTTopData; int* piEdges; // tag indexing into vertex list LayerTempData(INTVECTOR3 vVolSize, T* pTVolume); virtual ~LayerTempData(); void NextIteration(); private: INTVECTOR3 m_vVolSize; }; class Isosurface { public: FLOATVECTOR3* vfVertices; FLOATVECTOR3* vfNormals; INTVECTOR3* viTriangles; int iVertices; int iTriangles; Isosurface(); Isosurface(int iMaxVertices, int iMaxTris); virtual ~Isosurface(); int AddTriangle(int a, int b, int c); int AddVertex(FLOATVECTOR3 v, FLOATVECTOR3 n); void AppendData(const Isosurface* other); void Transform(const FLOATMATRIX4& matrix); }; template class MarchingCubes { public: Isosurface* m_Isosurface; MarchingCubes(void); virtual ~MarchingCubes(void); virtual void SetVolume(int iSizeX, int iSizeY, int iSizeZ, T* pTVolume); virtual void Process(T TIsoValue); protected: static int ms_edgeTable[256]; static int ms_triTable[256][16]; INTVECTOR3 m_vVolSize; INTVECTOR3 m_vOffset; T* m_pTVolume; T m_TIsoValue; virtual void MarchLayer(LayerTempData *layer, int iLayer); virtual int MakeVertex(int whichEdge, int i, int j, int k, Isosurface* sliceIso); virtual FLOATVECTOR3 InterpolateNormal(T fValueAtPos, INTVECTOR3 vPosition); }; #include "MC.inl" ImageVis3D-3.1.0/Tuvok/Basics/LargeRAWFile.cpp0000644000175000017500000002634712320456500020515 0ustar mathieumathieu#include #include #include "LargeRAWFile.h" #include "nonstd.h" using namespace std; LargeRAWFile::LargeRAWFile(const std::string& strFilename, uint64_t iHeaderSize): m_StreamFile(NULL), m_strFilename(strFilename), m_bIsOpen(false), m_bWritable(false), m_iHeaderSize(iHeaderSize) { } LargeRAWFile::LargeRAWFile(const std::wstring& wstrFilename, uint64_t iHeaderSize): m_bIsOpen(false), m_bWritable(false), m_iHeaderSize(iHeaderSize) { string strFilename(wstrFilename.begin(), wstrFilename.end()); m_strFilename = strFilename; } LargeRAWFile::LargeRAWFile(const LargeRAWFile &other) : m_StreamFile(NULL), m_strFilename(other.m_strFilename), m_bIsOpen(other.m_bIsOpen), m_bWritable(other.m_bWritable), m_iHeaderSize(other.m_iHeaderSize) { /// @todo !?!? need a better fix, a copy constructor shouldn't be expensive. assert(!m_bWritable && "Copying a file in write mode is too expensive."); if(m_bIsOpen) { Open(false); } } bool LargeRAWFile::Open(bool bReadWrite) { #ifdef _WIN32 m_StreamFile = CreateFileA(m_strFilename.c_str(), (bReadWrite) ? GENERIC_READ | GENERIC_WRITE : GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); m_bIsOpen = m_StreamFile != INVALID_HANDLE_VALUE; #else m_StreamFile = fopen(m_strFilename.c_str(), (bReadWrite) ? "r+b" : "rb"); if(m_StreamFile == NULL) { std::ostringstream err_file; err_file << "fopen '" << m_strFilename << "'"; perror(err_file.str().c_str()); } m_bIsOpen = m_StreamFile != NULL; #endif if (m_bIsOpen && m_iHeaderSize != 0) SeekStart(); m_bWritable = (m_bIsOpen) ? bReadWrite : false; return m_bIsOpen; } bool LargeRAWFile::Create(uint64_t iInitialSize) { #ifdef _WIN32 m_StreamFile = CreateFileA(m_strFilename.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); m_bIsOpen = m_StreamFile != INVALID_HANDLE_VALUE; #else m_StreamFile = fopen(m_strFilename.c_str(), "w+b"); m_bIsOpen = m_StreamFile != NULL; #endif if (m_bIsOpen && iInitialSize>0) { SeekPos(iInitialSize-1); WriteData(0,false); SeekStart(); } m_bWritable = m_bIsOpen; return m_bIsOpen; } bool LargeRAWFile::Append() { #ifdef _WIN32 m_StreamFile = CreateFileA(m_strFilename.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, 0, NULL); m_bIsOpen = m_StreamFile != INVALID_HANDLE_VALUE; #else m_StreamFile = fopen(m_strFilename.c_str(), "a+b"); m_bIsOpen = m_StreamFile != NULL; #endif if (m_bIsOpen) SeekEnd(); m_bWritable = m_bIsOpen; return m_bIsOpen; } void LargeRAWFile::Close() { if (m_bIsOpen) { #ifdef _WIN32 CloseHandle(m_StreamFile); #else fclose(m_StreamFile); #endif m_bIsOpen =false; } } uint64_t LargeRAWFile::GetCurrentSize() { uint64_t iPrevPos = GetPos(); SeekStart(); uint64_t ulStart = GetPos(); uint64_t ulEnd = SeekEnd(); uint64_t ulFileLength = ulEnd - ulStart; SeekPos(iPrevPos); return ulFileLength; } void LargeRAWFile::SeekStart() { SeekPos(0); } uint64_t LargeRAWFile::SeekEnd() { #ifdef _WIN32 LARGE_INTEGER liTarget, liRealTarget; liTarget.QuadPart = 0; SetFilePointerEx(m_StreamFile, liTarget, &liRealTarget, FILE_END); return uint64_t(liRealTarget.QuadPart)-m_iHeaderSize; #else // get current position=file size! if(fseeko(m_StreamFile, 0, SEEK_END)==0) return ftello(m_StreamFile)-m_iHeaderSize; else return 0; #endif } uint64_t LargeRAWFile::GetPos() { #ifdef _WIN32 LARGE_INTEGER liTarget, liRealTarget; liTarget.QuadPart = 0; SetFilePointerEx(m_StreamFile, liTarget, &liRealTarget, FILE_CURRENT); return uint64_t(liRealTarget.QuadPart)-m_iHeaderSize; #else //get current position=file size! return ftello(m_StreamFile)-m_iHeaderSize; #endif } void LargeRAWFile::SeekPos(uint64_t iPos) { #ifdef _WIN32 LARGE_INTEGER liTarget; liTarget.QuadPart = LONGLONG(iPos+m_iHeaderSize); SetFilePointerEx(m_StreamFile, liTarget, NULL, FILE_BEGIN); #else fseeko(m_StreamFile, off_t(iPos+m_iHeaderSize), SEEK_SET); #endif } size_t LargeRAWFile::ReadRAW(unsigned char* pData, uint64_t iCount) { #ifdef _WIN32 uint64_t iTotalRead = 0; DWORD dwReadBytes; while (iCount > std::numeric_limits::max()) { if (!ReadFile(m_StreamFile, pData, std::numeric_limits::max(), &dwReadBytes, NULL)) { return iTotalRead; } if (dwReadBytes == 0) { return iTotalRead; } iCount -= dwReadBytes; iTotalRead += dwReadBytes; pData += dwReadBytes; } if (!ReadFile(m_StreamFile, pData, DWORD(iCount), &dwReadBytes, NULL)) { return iTotalRead; } return iTotalRead + dwReadBytes; #else return fread(pData,1,iCount,m_StreamFile); #endif } size_t LargeRAWFile::WriteRAW(const unsigned char* pData, uint64_t iCount) { #ifdef _WIN32 uint64_t iTotalWritten = 0; DWORD dwWrittenBytes; while (iCount > std::numeric_limits::max()) { if (!WriteFile(m_StreamFile, pData, std::numeric_limits::max(), &dwWrittenBytes, NULL)) { return iTotalWritten; } if (dwWrittenBytes == 0) { return iTotalWritten; } iCount -= dwWrittenBytes; iTotalWritten += dwWrittenBytes; pData += dwWrittenBytes; } if (!WriteFile(m_StreamFile, pData, DWORD(iCount), &dwWrittenBytes, NULL)) { return iTotalWritten; } return iTotalWritten + dwWrittenBytes; #else return fwrite(pData,1,iCount,m_StreamFile); #endif } bool LargeRAWFile::CopyRAW(uint64_t iCount, uint64_t iSourcePos, uint64_t iTargetPos, unsigned char* pBuffer, uint64_t iBufferSize) { uint64_t iBytesRead = 0; do { SeekPos(iSourcePos+iBytesRead); uint64_t iBytesJustRead = ReadRAW(pBuffer,min(iBufferSize,iCount-iBytesRead)); SeekPos(iTargetPos+iBytesRead); uint64_t iBytesJustWritten = WriteRAW(pBuffer, iBytesJustRead); if (iBytesJustRead != iBytesJustWritten) return false; iBytesRead += iBytesJustRead; } while(iBytesRead < iCount); return true; } void LargeRAWFile::Delete() { if (m_bIsOpen) Close(); remove(m_strFilename.c_str()); } bool LargeRAWFile::Truncate() { #ifdef _WIN32 return 0 != SetEndOfFile(m_StreamFile); #else uint64_t iPos = GetPos(); return 0 == ftruncate(fileno(m_StreamFile), off_t(iPos)); #endif } bool LargeRAWFile::Truncate(uint64_t iPos) { #ifdef _WIN32 SeekPos(iPos); return 0 != SetEndOfFile(m_StreamFile); #else return 0 == ftruncate(fileno(m_StreamFile), off_t(iPos+m_iHeaderSize)); #endif } // no-op, but I want to leave the argument names in the header so it's nicer to // implement it here. void LargeRAWFile::Hint(IOHint, uint64_t, uint64_t) const { } bool LargeRAWFile::Copy(const std::string& strSource, const std::string& strTarget, uint64_t iSourceHeaderSkip, std::string* strMessage) { std::wstring wstrSource(strSource.begin(), strSource.end()); std::wstring wstrTarget(strTarget.begin(), strTarget.end()); if (!strMessage) return Copy(wstrSource, wstrTarget, iSourceHeaderSkip, NULL); else { std::wstring wstrMessage; bool bResult = Copy(wstrSource, wstrTarget, iSourceHeaderSkip, &wstrMessage); (*strMessage) = string(wstrMessage.begin(), wstrMessage.end()); return bResult; } } bool LargeRAWFile::Copy(const std::wstring& wstrSource, const std::wstring& wstrTarget, uint64_t iSourceHeaderSkip, std::wstring* wstrMessage) { LargeRAWFile source(wstrSource, iSourceHeaderSkip); LargeRAWFile target(wstrTarget); source.Open(false); if (!source.IsOpen()) { if (wstrMessage) (*wstrMessage) = L"Unable to open source file " + wstrSource; return false; } target.Create(); if (!target.IsOpen()) { if (wstrMessage) (*wstrMessage) = L"Unable to open target file " + wstrTarget; source.Close(); return false; } uint64_t iFileSize = source.GetCurrentSize(); uint64_t iCopySize = min(iFileSize,BLOCK_COPY_SIZE); std::shared_ptr pBuffer( new unsigned char[size_t(iCopySize)], nonstd::DeleteArray() ); do { iCopySize = source.ReadRAW(pBuffer.get(), iCopySize); target.WriteRAW(pBuffer.get(), iCopySize); } while (iCopySize>0); target.Close(); source.Close(); return true; } bool LargeRAWFile::Compare(const std::string& strFirstFile, const std::string& strSecondFile, std::string* strMessage) { std::wstring wstrFirstFile(strFirstFile.begin(), strFirstFile.end()); std::wstring wstrSecondFile(strSecondFile.begin(), strSecondFile.end()); if (!strMessage) return Compare(wstrFirstFile, wstrSecondFile, NULL); else { std::wstring wstrMessage; bool bResult = Compare(wstrFirstFile, wstrSecondFile, &wstrMessage); (*strMessage) = string(wstrMessage.begin(), wstrMessage.end()); return bResult; } } bool LargeRAWFile::Compare(const std::wstring& wstrFirstFile, const std::wstring& wstrSecondFile, std::wstring* wstrMessage) { LargeRAWFile first(wstrFirstFile); LargeRAWFile second(wstrSecondFile); first.Open(false); if (!first.IsOpen()) { if (wstrMessage) (*wstrMessage) = L"Unable to open input file " + wstrFirstFile; return false; } second.Open(false); if (!second.IsOpen()) { if (wstrMessage) (*wstrMessage) = L"Unable to open input file " + wstrSecondFile; first.Close(); return false; } if (first.GetCurrentSize() != second.GetCurrentSize()) { first.Close(); second.Close(); if (wstrMessage) (*wstrMessage) = L"Files differ in size"; return false; } uint64_t iFileSize = first.GetCurrentSize(); uint64_t iCopySize = min(iFileSize,BLOCK_COPY_SIZE/2); unsigned char* pBuffer1 = new unsigned char[size_t(iCopySize)]; unsigned char* pBuffer2 = new unsigned char[size_t(iCopySize)]; uint64_t iCopiedSize = 0; uint64_t iDiffCount = 0; if (wstrMessage) (*wstrMessage) = L""; do { iCopySize = first.ReadRAW(pBuffer1, iCopySize); second.ReadRAW(pBuffer2, iCopySize); for (uint64_t i = 0;i 0); first.Close(); second.Close(); delete [] pBuffer1; delete [] pBuffer2; return iDiffCount == 0; } ImageVis3D-3.1.0/Tuvok/Basics/Vectors.h0000644000175000017500000016762612320456500017411 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Vectors.h \brief Vector, matrix, and quaternion templates with additional OpenGL and Direct3D features \author Jens Krueger SCI Institute University of Utah \version 3.0 \date December 2008 */ #pragma once #ifndef VECTORS_H #define VECTORS_H #if defined DIRECT3D_VERSION #define USEDX #endif #if defined __GL_H__ #define USEGL #endif // some DX files define min/max but that interferes // with the numeric_limits so undef them #ifdef min #undef min #endif #ifdef max #undef max #endif // use MAX / MIN instead #ifndef MAX #define MAX(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef MIN #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif #include #include #include #include #include #include #ifdef WIN32 #pragma warning( disable : 4995 ) // disable deprecated warning #endif #include #ifdef WIN32 #pragma warning( default : 4995 ) #endif #ifdef WIN32 #pragma warning( disable : 4201 ) // Disable warning messages about nameless union #ifdef USEDX #pragma message(" [vectors.h] Using DX extensions.") #endif #ifdef USEGL #pragma message(" [vectors.h] Using GL extensions.") #endif #endif #include "StdDefines.h" template class MATRIX2; template class MATRIX3; template class MATRIX4; template class VECTOR2 { public: T x,y; VECTOR2(): x(0), y(0) {} template explicit VECTOR2( const std::vector& v, const T& defaultVal = T(0) ) { x = T(!v.empty() ? v[0] : defaultVal); y = T(v.size()>1 ? v[1] : defaultVal); } VECTOR2(const VECTOR2 &other): x(other.x), y(other.y) {} template explicit VECTOR2(const VECTOR2 &other): x(T(other.x)), y(T(other.y)) {} VECTOR2(const T _x, const T _y) : x(_x), y(_y) {} VECTOR2(const T* vec) : x(vec[0]), y(vec[1]) {} bool operator == ( const VECTOR2& other ) const {return (other.x==x && other.y==y); } bool operator != ( const VECTOR2& other ) const {return (other.x!=x || other.y!=y); } // binary operators with scalars VECTOR2 operator + ( T scalar ) const {return VECTOR2(x+scalar,y+scalar);} VECTOR2 operator - ( T scalar ) const {return VECTOR2(x-scalar,y-scalar);} VECTOR2 operator * ( T scalar ) const {return VECTOR2(x*scalar,y*scalar);} VECTOR2 operator / ( T scalar ) const {return VECTOR2(x/scalar,y/scalar);} VECTOR2 operator % ( T scalar ) const {return VECTOR2(x%scalar,y%scalar);} // binary operators with vectors VECTOR2 operator + ( const VECTOR2& other ) const {return VECTOR2(x+other.x,y+other.y);} VECTOR2 operator - ( const VECTOR2& other ) const {return VECTOR2(x-other.x,y-other.y);} VECTOR2 operator / ( const VECTOR2& other ) const {return VECTOR2(x/other.x,y/other.y);} VECTOR2 operator * ( const VECTOR2& other ) const {return VECTOR2(x*other.x,y*other.y);} // component product T operator ^ ( const VECTOR2& other ) const {return T(x*other.x+y*other.y);} // dot product // unary operators VECTOR2 operator + () const {return *this;} VECTOR2 operator - () const {return *this * -1;} VECTOR2 operator ~ () const {return VECTOR2(T(1)/x,T(1)/y);} // binary operators with a matrix VECTOR2 operator * ( const MATRIX2& matrix ) const { return VECTOR2(x*matrix.m11+y*matrix.m21, x*matrix.m12+y*matrix.m22); } VECTOR2& operator=(const VECTOR2& other) { x = other.x; y = other.y;return *this; } VECTOR2& operator+=(const VECTOR2& other) { x += other.x; y += other.y;return *this; } VECTOR2& operator-=(const VECTOR2& other) { x -= other.x; y -= other.y;return *this; } VECTOR2& operator*=(const VECTOR2& other) { x *= other.x; y *= other.y;return *this; } VECTOR2& operator/=(const VECTOR2& other) { x /= other.x; y /= other.y;return *this; } VECTOR2& operator=(const T& other) { x = other; y = other;return *this; } VECTOR2& operator+=(const T& other) { x += other; y += other;return *this; } VECTOR2& operator-=(const T& other) { x -= other; y -= other;return *this; } VECTOR2& operator*=(const T& other) { x *= other; y *= other;return *this; } VECTOR2& operator/=(const T& other) { x /= other; y /= other;return *this; } friend std::ostream& operator<<(std::ostream &os,const VECTOR2& v){os << v.x << '\t' << v.y; return os;} T& operator [](size_t i) { assert(i <= 1); return (i == 0) ? this->x : this->y; } const T& operator [](size_t i) const { assert(i <= 1); return (i == 0) ? this->x : this->y; } VECTOR2 abs() const {return VECTOR2(fabs(x),fabs(y));} T area() const {return x*y;} T length() const {return sqrt(T(x*x+y*y));} void normalize() {T len = length(); x/=len;y/=len;} T maxVal() const {return MAX(x,y);} T minVal() const {return MIN(x,y);} VECTOR2 makepow2() const { VECTOR2 vOut; vOut.x = T(1< &other) { x = std::min(x,other.x); y = std::min(y,other.y); } void StoreMax(const VECTOR2 &other) { x = std::max(x,other.x); y = std::max(y,other.y); } #ifdef USEDX VECTOR2(const D3DXVECTOR2 &other): x(T(other.x)), y(T(other.y)) {} D3DXVECTOR2 toD3DXVEC() const {return D3DXVECTOR2(float(x),float(y));} bool operator == ( const D3DXVECTOR2& other ) const {return (other.x==T(x) && other.y== T(y)); } bool operator != ( const D3DXVECTOR2& other ) const {return (other.x!=T(x) || other.y!= T(y)); } operator D3DXVECTOR2(void) const {return toD3DXVEC();} #endif // OpenGL #ifdef USEGL void glVertex() { glVertex2f(GLfloat(x),GLfloat(y)); } #endif }; template VECTOR2 operator + ( T scalar, const VECTOR2& vec ) {return VECTOR2(scalar+vec.x,scalar+vec.y);} template VECTOR2 operator - ( T scalar, const VECTOR2& vec ) {return VECTOR2(scalar-vec.x,scalar-vec.y);} template VECTOR2 operator * ( T scalar, const VECTOR2& vec ) {return VECTOR2(scalar*vec.x,scalar*vec.y);} template VECTOR2 operator / ( T scalar, const VECTOR2& vec ) {return VECTOR2(scalar/vec.x,scalar/vec.y);} template VECTOR2 operator % ( T scalar, const VECTOR2& vec ) {return VECTOR2(scalar%vec.x,scalar%vec.y);} template class VECTOR3 { public: T x,y,z; VECTOR3(): x(0), y(0),z(0) {} template explicit VECTOR3( const std::vector& v, const T& defaultVal = T(0) ) { x = T(!v.empty() ? v[0] : defaultVal); y = T(!v.empty() ? v[1] : defaultVal); z = T(!v.empty() ? v[2] : defaultVal); } VECTOR3(const VECTOR3 &other): x(other.x), y(other.y), z(other.z) {} template explicit VECTOR3(const VECTOR3 &other): x(T(other.x)), y(T(other.y)), z(T(other.z)) {} VECTOR3(const VECTOR2 &other, const T _z): x(other.x), y(other.y), z(_z) {} VECTOR3(const T _x, const T _y, const T _z) : x(_x), y(_y), z(_z) {} VECTOR3(const T* vec) : x(vec[0]), y(vec[1]), z(vec[2]) {} bool operator == ( const VECTOR3& other ) const {return (other.x==x && other.y==y && other.z==z); } bool operator != ( const VECTOR3& other ) const {return (other.x!=x || other.y!=y || other.z!=z); } // binary operators with scalars VECTOR3 operator + ( T scalar ) const {return VECTOR3(x+scalar,y+scalar,z+scalar);} VECTOR3 operator - ( T scalar ) const {return VECTOR3(x-scalar,y-scalar,z-scalar);} VECTOR3 operator * ( T scalar ) const {return VECTOR3(x*scalar,y*scalar,z*scalar);} VECTOR3 operator / ( T scalar ) const {return VECTOR3(x/scalar,y/scalar,z/scalar);} VECTOR3 operator % ( T scalar ) const {return VECTOR3(x%scalar,y%scalar,z%scalar);} // binary operators with vectors VECTOR3 operator + ( const VECTOR3& other ) const {return VECTOR3(x+other.x,y+other.y,z+other.z);} VECTOR3 operator - ( const VECTOR3& other ) const {return VECTOR3(x-other.x,y-other.y,z-other.z);} VECTOR3 operator / ( const VECTOR3& other ) const {return VECTOR3(x/other.x,y/other.y,z/other.z);} VECTOR3 operator * ( const VECTOR3& other ) const {return VECTOR3(x*other.x,y*other.y,z*other.z);} // component product VECTOR3 operator % ( const VECTOR3& other ) const {return VECTOR3(y*other.z-z*other.y,z*other.x-x*other.z,x*other.y-y*other.x);} // cross product T operator ^ ( const VECTOR3& other ) const {return T(x*other.x+y*other.y+z*other.z);} // dot product // unary opartors VECTOR3 operator + () const {return *this;} VECTOR3 operator - () const {return *this * -1;} VECTOR3 operator ~ () const {return VECTOR3(T(1)/x,T(1)/y,T(1)/z);} // binary operators with a matrix VECTOR3 operator * ( const MATRIX3& matrix ) const { return VECTOR3(x*matrix.m11+y*matrix.m21+z*matrix.m31, x*matrix.m12+y*matrix.m22+z*matrix.m32, x*matrix.m13+y*matrix.m23+z*matrix.m33); } VECTOR3& operator=(const VECTOR3& other) { x = other.x; y = other.y; z = other.z; return *this; } VECTOR3& operator+=(const VECTOR3& other) { x += other.x; y += other.y; z += other.z; return *this; } VECTOR3& operator-=(const VECTOR3& other) { x -= other.x; y -= other.y; z -= other.z; return *this; } VECTOR3& operator*=(const VECTOR3& other) { x *= other.x; y *= other.y; z *= other.z; return *this; } VECTOR3& operator/=(const VECTOR3& other) { x /= other.x; y /= other.y; z /= other.z; return *this; } VECTOR3& operator=(const T& other) { x = other; y = other; z = other; return *this; } VECTOR3& operator+=(const T& other) { x += other; y += other; z += other; return *this; } VECTOR3& operator-=(const T& other) { x -= other; y -= other; z -= other; return *this; } VECTOR3& operator*=(const T& other) { x *= other; y *= other; z *= other; return *this; } VECTOR3& operator/=(const T& other) { x /= other; y /= other; z /= other; return *this; } friend std::ostream& operator<<(std::ostream &os,const VECTOR3& v){os << v.x << '\t' << v.y << '\t' << v.z; return os;} T& operator [](size_t i) { assert(i <= 2); switch(i) { case 0: return this->x; case 1: return this->y; default: return this->z; } } const T& operator [](size_t i) const { assert(i <= 2); switch(i) { case 0: return this->x; case 1: return this->y; default: return this->z; } } VECTOR3 abs() const FUNC_CONST {return VECTOR3(fabs(x),fabs(y),fabs(z));} T maxVal() const FUNC_CONST {return MAX(x,MAX(y,z));} T minVal() const FUNC_CONST {return MIN(x,MIN(y,z));} T volume() const FUNC_CONST {return x*y*z;} T length() const { return sqrt( T(this->x*this->x + this->y*this->y + this->z*this->z)); } void normalize() {T len = length(); x/=len;y/=len;z/=len;} void normalize(T epsilon, const VECTOR3& replacement=VECTOR3(T(0),T(0),T(1))) { T len = length(); if (len > epsilon) { x/=len; y/=len; z/=len; } else { // specify some arbitrary normal x = replacement.x; y = replacement.y; z = replacement.z; } } VECTOR3 normalized() const FUNC_CONST { T len = length(); return VECTOR3(x/len,y/len,z/len); } VECTOR3 normalized(T epsilon, const VECTOR3& replacement = VECTOR3(T(0),T(0),T(1))) const { T len = length(); if (len > epsilon) { return VECTOR3(x/len,y/len,z/len); } else { // specify some arbitrary normal return replacement; } } VECTOR2 xx() const {return VECTOR2(x,x);} VECTOR2 xy() const {return VECTOR2(x,y);} VECTOR2 xz() const {return VECTOR2(x,z);} VECTOR2 yx() const {return VECTOR2(y,x);} VECTOR2 yy() const {return VECTOR2(y,y);} VECTOR2 yz() const {return VECTOR2(y,z);} VECTOR2 zx() const {return VECTOR2(z,x);} VECTOR2 zy() const {return VECTOR2(z,y);} VECTOR2 zz() const {return VECTOR2(z,z);} VECTOR3 makepow2() const { VECTOR3 vOut; vOut.x = T(1< &other) { x = std::min(x,other.x); y = std::min(y,other.y); z = std::min(z,other.z); } void StoreMax(const VECTOR3 &other) { x = std::max(x,other.x); y = std::max(y,other.y); z = std::max(z,other.z); } #ifdef USEDX VECTOR3(const D3DXVECTOR3 &other): x(T(other.x)), y(T(other.y)), z(T(other.z)) {} VECTOR3(const D3DXVECTOR4 &other): x(T(other.x)), y(T(other.y)), z(T(other.z)) {} D3DXVECTOR3 toD3DXVEC() const {return D3DXVECTOR3(float(x),float(y),float(z));} bool operator == ( const D3DXVECTOR3& other ) const {return (other.x==T(x) && other.y== T(y) && other.z== T(z)); } bool operator != ( const D3DXVECTOR3& other ) const {return (other.x!=T(x) || other.y!= T(y) || other.z!= T(z)); } operator D3DXVECTOR3(void) const {return toD3DXVEC();} #endif // OpenGL #ifdef USEGL void glVertex() { glVertex3f(GLfloat(x),GLfloat(y),GLfloat(z)); } void glNormal() { glNormal3f(GLfloat(x),GLfloat(y),GLfloat(z)); } void glNNormal() { normalize(); glNormal3f(GLfloat(x),GLfloat(y),GLfloat(z)); } #endif }; template VECTOR3 operator + ( T scalar, const VECTOR3& vec ) {return VECTOR3(scalar+vec.x,scalar+vec.y,scalar+vec.z);} template VECTOR3 operator - ( T scalar, const VECTOR3& vec ) {return VECTOR3(scalar-vec.x,scalar-vec.y,scalar-vec.z);} template VECTOR3 operator * ( T scalar, const VECTOR3& vec ) {return VECTOR3(scalar*vec.x,scalar*vec.y,scalar*vec.z);} template VECTOR3 operator / ( T scalar, const VECTOR3& vec ) {return VECTOR3(scalar/vec.x,scalar/vec.y,scalar/vec.z);} template VECTOR3 operator % ( T scalar, const VECTOR3& vec ) {return VECTOR3(scalar%vec.x,scalar%vec.y,scalar%vec.z);} // RedHat's patched gcc warns on the operator>> below if we don't explicitly // mark the symbol as hidden, despite -fvisibility settings. #if defined(__GNUC__) && __GNUC__ >= 4 # define HIDDEN __attribute__ ((visibility("hidden"))) #else # define HIDDEN /* nothing */ #endif template class VECTOR4 { template HIDDEN friend std::istream& operator >>(std::istream &, VECTOR4&); public: T x,y,z,w; VECTOR4(): x(0), y(0),z(0), w(0) {} template explicit VECTOR4( const std::vector& v, const T& defaultVal = T(0) ) { x = T(!v.empty() ? v[0] : defaultVal); y = T(!v.empty() ? v[1] : defaultVal); z = T(!v.empty() ? v[2] : defaultVal); w = T(!v.empty() ? v[3] : defaultVal); } VECTOR4(const VECTOR2 &other, const T _z, const T _w): x(other.x), y(other.y), z(_z), w(_w) {} VECTOR4(const VECTOR3 &other, const T _w): x(other.x), y(other.y), z(other.z), w(_w) {} VECTOR4(const VECTOR4 &other): x(other.x), y(other.y), z(other.z), w(other.w) {} template explicit VECTOR4(const VECTOR4 &other): x(T(other.x)), y(T(other.y)), z(T(other.z)), w(T(other.w)) {} VECTOR4(const VECTOR3 &other): x(other.x), y(other.y), z(other.z), w(1) {} VECTOR4(const T _x, const T _y, const T _z, const T _w) : x(_x), y(_y), z(_z), w(_w) {} VECTOR4(const T* vec) : x(vec[0]), y(vec[1]), z(vec[2]), w(vec[3]) {} bool operator == ( const VECTOR4& other ) const {return (other.x==x && other.y==y && other.z==z && other.w==w); } bool operator != ( const VECTOR4& other ) const {return (other.x!=x || other.y!=y || other.z!=z || other.w!=w); } // binary operators with scalars VECTOR4 operator + ( T scalar ) const {return VECTOR4(x+scalar,y+scalar,z+scalar,w+scalar);} VECTOR4 operator - ( T scalar ) const {return VECTOR4(x-scalar,y-scalar,z-scalar,w-scalar);} VECTOR4 operator * ( T scalar ) const {return VECTOR4(x*scalar,y*scalar,z*scalar,w*scalar);} VECTOR4 operator / ( T scalar ) const {return VECTOR4(x/scalar,y/scalar,z/scalar,w/scalar);} VECTOR4 operator % ( T scalar ) const {return VECTOR4(x%scalar,y%scalar,z%scalar,w%scalar);} // binary operators with vectors VECTOR4 operator + ( const VECTOR4& other ) const {return VECTOR4(x+other.x,y+other.y,z+other.z,w+other.w);} VECTOR4 operator - ( const VECTOR4& other ) const {return VECTOR4(x-other.x,y-other.y,z-other.z,w-other.w);} VECTOR4 operator * ( const VECTOR4& other ) const {return VECTOR4(x*other.x,y*other.y,z*other.z,w*other.w);} VECTOR4 operator / ( const VECTOR4& other ) const {return VECTOR4(x/other.x,y/other.y,z/other.z,w/other.w);} T operator ^ ( const VECTOR4& other ) const {return T(x*other.x+y*other.y+z*other.z+w*other.w);} // dot product // binary operators with a matrix VECTOR4 operator * ( const MATRIX4& matrix ) const { return VECTOR4(x*matrix.m11+y*matrix.m21+z*matrix.m31+w*matrix.m41, x*matrix.m12+y*matrix.m22+z*matrix.m32+w*matrix.m42, x*matrix.m13+y*matrix.m23+z*matrix.m33+w*matrix.m43, x*matrix.m14+y*matrix.m24+z*matrix.m34+w*matrix.m44); } // unary opartors VECTOR4 operator + () const {return *this;} VECTOR4 operator - () const {return *this * -1;} VECTOR4 operator ~ () const {return VECTOR4(T(1)/x,T(1)/y,T(1)/z,T(1)/w);} T& operator [](size_t i) { assert(i <= 3); switch(i) { case 0: return this->x; case 1: return this->y; case 2: return this->z; default: return this->w; } } const T& operator [](size_t i) const { assert(i <= 3); switch(i) { case 0: return this->x; case 1: return this->y; case 2: return this->z; default: return this->w; } } VECTOR4& operator=(const VECTOR4& other) { x = other.x; y = other.y; z = other.z; w = other.w; return *this; } VECTOR4& operator+=(const VECTOR4& other) { x += other.x; y += other.y; z += other.z; w += other.w; return *this; } VECTOR4& operator-=(const VECTOR4& other) { x -= other.x; y -= other.y; z -= other.z; w -= other.w; return *this; } VECTOR4& operator*=(const VECTOR4& other) { x *= other.x; y *= other.y; z *= other.z; w *= other.w; return *this; } VECTOR4& operator/=(const VECTOR4& other) { x /= other.x; y /= other.y; z /= other.z; w /= other.w; return *this; } VECTOR4& operator=(const T& other) { x = other; y = other; z = other; w = other; return *this; } VECTOR4& operator+=(const T& other) { x += other; y += other; z += other; w += other; return *this; } VECTOR4& operator-=(const T& other) { x -= other; y -= other; z -= other; w -= other; return *this; } VECTOR4& operator*=(const T& other) { x *= other; y *= other; z *= other; w *= other; return *this; } VECTOR4& operator/=(const T& other) { x /= other; y /= other; z /= other; w /= other; return *this; } friend std::ostream& operator<<(std::ostream &os,const VECTOR4& v) { os << "[" << std::setiosflags(std::ios::left) << std::setw(7) << std::setprecision(3) << v.x << std::resetiosflags(std::ios::left) << std::setw(7) << std::setprecision(3) << v.y << std::setw(7) << std::setprecision(3) << v.z << std::setw(7) << std::setprecision(3) << v.w << "]"; return os; } T max() const {return MAX(MAX(x,y),MAX(z,w));} T min() const {return MIN(MIN(x,y),MIN(z,w));} VECTOR4 abs() const {return VECTOR4(fabs(x),fabs(y),fabs(z),fabs(w));} VECTOR4 makepow2() const { VECTOR4 vOut; vOut.x = T(1< dehomo() const { VECTOR3 vOut; vOut.x = x/w; vOut.y = y/w; vOut.z = z/w; return vOut; } void StoreMin(const VECTOR4 &other) { x = std::min(x,other.x); y = std::min(y,other.y); z = std::min(z,other.z); w = std::min(w,other.w); } void StoreMax(const VECTOR4 &other) { x = std::max(x,other.x); y = std::max(y,other.y); z = std::max(z,other.z); w = std::max(w,other.w); } VECTOR2 xx() const {return VECTOR2(x,x);} VECTOR2 xy() const {return VECTOR2(x,y);} VECTOR2 xz() const {return VECTOR2(x,z);} VECTOR2 yx() const {return VECTOR2(y,x);} VECTOR2 yy() const {return VECTOR2(y,y);} VECTOR2 yz() const {return VECTOR2(y,z);} VECTOR2 zx() const {return VECTOR2(z,x);} VECTOR2 zy() const {return VECTOR2(z,y);} VECTOR2 zz() const {return VECTOR2(z,z);} VECTOR2 zw() const {return VECTOR2(z,w);} VECTOR3 xyz() const {return VECTOR3(x,y,z);} // DirectX #ifdef USEDX VECTOR4(const D3DXVECTOR4 &other): x(T(other.x)), y(T(other.y)), z(T(other.z)), w(T(other.w)){} D3DXVECTOR4 toD3DXVEC() const {return D3DXVECTOR4(float(x),float(y),float(z),float(w));} bool operator == ( const D3DXVECTOR4& other ) const {return (other.x==T(x) && other.y==T(y) && other.z==T(z) && other.w==T(w)); } bool operator != ( const D3DXVECTOR4& other ) const {return (other.x!=T(x) || other.y!=T(y) || other.z!=T(z) || other.w!=T(w)); } operator D3DXVECTOR4(void) const {return toD3DXVEC();} #endif // OpenGL #ifdef USEGL void glVertex() { glVertex4f(GLfloat(x),GLfloat(y),GLfloat(z),GLfloat(w)); } void glNormal() { dehomo().glNormal(); } #endif }; template std::istream& operator >>(std::istream &is, VECTOR4& v4) { is >> v4[0]; is >> v4[1]; is >> v4[2]; is >> v4[3]; return is; } template VECTOR4 operator + ( T scalar, const VECTOR4& vec ) {return VECTOR4(scalar+vec.x,scalar+vec.y,scalar+vec.z,scalar+vec.w);} template VECTOR4 operator - ( T scalar, const VECTOR4& vec ) {return VECTOR4(scalar-vec.x,scalar-vec.y,scalar-vec.z,scalar-vec.w);} template VECTOR4 operator * ( T scalar, const VECTOR4& vec ) {return VECTOR4(scalar*vec.x,scalar*vec.y,scalar*vec.z,scalar*vec.w);} template VECTOR4 operator / ( T scalar, const VECTOR4& vec ) {return VECTOR4(scalar/vec.x,scalar/vec.y,scalar/vec.z,scalar/vec.w);} template VECTOR4 operator % ( T scalar, const VECTOR4& vec ) {return VECTOR4(scalar%vec.x,scalar%vec.y,scalar%vec.z,scalar%vec.w);} typedef VECTOR4<> INTVECTOR4; typedef VECTOR3<> INTVECTOR3; typedef VECTOR2<> INTVECTOR2; typedef VECTOR4 UINTVECTOR4; typedef VECTOR3 UINTVECTOR3; typedef VECTOR2 UINTVECTOR2; typedef VECTOR2 UINT64VECTOR2; typedef VECTOR3 UINT64VECTOR3; typedef VECTOR4 UINT64VECTOR4; typedef VECTOR4 USHORTVECTOR4; typedef VECTOR3 USHORTVECTOR3; typedef VECTOR2 USHORTVECTOR2; typedef VECTOR4 FLOATVECTOR4; typedef VECTOR3 FLOATVECTOR3; typedef VECTOR2 FLOATVECTOR2; typedef VECTOR4 DOUBLEVECTOR4; typedef VECTOR3 DOUBLEVECTOR3; typedef VECTOR2 DOUBLEVECTOR2; template class MATRIX2 { public: union { struct { T m11,m12, m21,m22; }; T array[4]; }; MATRIX2() : m11(1), m12(0), m21(0), m22(1) {}; MATRIX2( const T *e ) : m11(e[0]), m12(e[1]), m21(e[4]), m22(e[5]) {}; MATRIX2( const MATRIX2& other ) : m11(other.m11), m12(other.m12), m21(other.m21), m22(other.m22) {}; MATRIX2( const MATRIX3& other ) : m11(other.m11), m12(other.m12), m21(other.m21), m22(other.m22) {}; MATRIX2( const MATRIX4& other ) : m11(other.m11), m12(other.m12), m21(other.m21), m22(other.m22) {}; MATRIX2( const VECTOR2 *rows ) : m11(rows[0].x), m12(rows[0].y), m21(rows[1].x), m22(rows[1].y) {}; MATRIX2(T _m11, T _m12, T _m21, T _m22) : m11(_m11), m12(_m12), m21(_m21), m22(_m22) {}; bool operator == ( const MATRIX2& other ) const {return (other.m11==m11 && other.m12==m12 && other.m21==m21 && other.m22==m22); } bool operator != ( const MATRIX2& other ) const {return (other.m11!=m11 || other.m12!=m12 || other.m21!=m21 || other.m22!=m22); } friend std::ostream& operator<<(std::ostream &os,const MATRIX2& m){os << m.m11 << '\t' << m.m12 << '\n' << m.m21 << '\t' << m.m22; return os;} // binary operators with scalars MATRIX2 operator * ( T scalar ) const {return MATRIX2(m11*scalar,m12*scalar, m21*scalar,m22*scalar);} MATRIX2 operator + ( T scalar ) const {return MATRIX2(m11+scalar,m12+scalar, m21+scalar,m22+scalar);} MATRIX2 operator - ( T scalar ) const {return MATRIX2(m11-scalar,m12-scalar, m21-scalar,m22-scalar);} MATRIX2 operator / ( T scalar ) const {return MATRIX2(m11/scalar,m12/scalar, m21/scalar,m22/scalar);} // binary operators with matrices MATRIX2 operator * ( const MATRIX4& other ) const { MATRIX2 result; for (int x = 0;x<4;x+=2) for (int y = 0;y<2;y++) result[x+y] = array[0+x]*other.array[0+y] + array[1+x]*other.array[2+y]; return result; } // binary operators with vectors VECTOR2 operator * ( const VECTOR2& other ) const { return VECTOR2(other.x*m11+other.y*m12, other.x*m22+other.y*m22); } MATRIX2 inverse() const { T determinant = m11*m22-m12*m21; return MATRIX2 (m22/determinant, -m12/determinant,-m21/determinant, m11/determinant); } }; template class MATRIX3 { public: union { struct { T m11,m12,m13, m21,m22,m23, m31,m32,m33; }; T array[9]; }; MATRIX3() : m11(1), m12(0), m13(0), m21(0), m22(1), m23(0), m31(0), m32(0), m33(1) {}; MATRIX3( const T *e ) : m11(e[0]), m12(e[1]), m13(e[2]), m21(e[3]), m22(e[4]), m23(e[5]), m31(e[6]), m32(e[7]), m33(e[8]) {}; MATRIX3( const MATRIX3& other ) : m11(other.m11), m12(other.m12), m13(other.m13), m21(other.m21), m22(other.m22), m23(other.m23), m31(other.m31), m32(other.m32), m33(other.m33) {}; MATRIX3( const MATRIX4& other ) : m11(other.m11), m12(other.m12), m13(other.m13), m21(other.m21), m22(other.m22), m23(other.m23), m31(other.m31), m32(other.m32), m33(other.m33) {}; MATRIX3( const VECTOR3 *rows ) : m11(rows[0].x), m12(rows[0].y), m13(rows[0].z), m21(rows[1].x), m22(rows[1].y), m23(rows[1].z), m31(rows[2].x), m32(rows[2].y), m33(rows[2].z) {}; MATRIX3(T _m11, T _m12, T _m13, T _m21, T _m22, T _m23, T _m31, T _m32, T _m33) : m11(_m11), m12(_m12), m13(_m13), m21(_m21), m22(_m22), m23(_m23), m31(_m31), m32(_m32), m33(_m33) {}; bool operator == ( const MATRIX3& other ) const {return (other.m11==m11 && other.m12==m12 && other.m13==m13 && other.m21==m21 && other.m22==m22 && other.m23==m23 && other.m31==m31 && other.m32==m32 && other.m33==m33); } bool operator != ( const MATRIX3& other ) const {return (other.m11!=m11 || other.m12!=m12 || other.m13!=m13 || other.m21!=m21 || other.m22!=m22 || other.m23!=m23 || other.m31!=m31 || other.m32!=m32 || other.m33!=m33); } friend std::ostream& operator<<(std::ostream &os,const MATRIX3& m){os << m.m11 << '\t' << m.m12 << '\t' << m.m13 << '\n' << m.m21 << '\t' << m.m22 << '\t' << m.m23 << '\n' << m.m31 << '\t' << m.m32 << '\t' << m.m33; return os;} // binary operators with matrices MATRIX3 operator * ( const MATRIX3& other ) const { MATRIX3 result; for (int x = 0;x<9;x+=3) for (int y = 0;y<3;y++) result[x+y] = array[1+x] * other.array[0+y]+ array[2+x] * other.array[3+y]+ array[3+x] * other.array[6+y]; return result; } // binary operators with scalars MATRIX3 operator * ( T scalar ) const {return MATRIX3(m11*scalar,m12*scalar,m13*scalar, m21*scalar,m22*scalar,m23*scalar, m31*scalar,m32*scalar,m33*scalar);} MATRIX3 operator + ( T scalar ) const {return MATRIX3(m11+scalar,m12+scalar,m13+scalar, m21+scalar,m22+scalar,m23+scalar, m31+scalar,m32+scalar,m33+scalar);} MATRIX3 operator - ( T scalar ) const {return MATRIX3(m11-scalar,m12-scalar,m13-scalar, m21-scalar,m22-scalar,m23-scalar, m31-scalar,m32-scalar,m33-scalar);} MATRIX3 operator / ( T scalar ) const {return MATRIX3(m11/scalar,m12/scalar,m13/scalar, m21/scalar,m22/scalar,m23/scalar, m31/scalar,m32/scalar,m33/scalar);} // binary operators with vectors VECTOR3 operator * ( const VECTOR3& other ) const { return VECTOR3(other.x*m11+other.y*m12+other.z*m13, other.x*m21+other.y*m22+other.z*m23, other.x*m31+other.y*m32+other.z*m33); } void Scaling(T x, T y, T z) { m11=x; m12=0; m13=0; m21=0; m22=y; m23=0; m31=0; m32=0; m33=z; } void RotationX(double angle) { T dCosAngle = T(cos(angle)); T dSinAngle = T(sin(angle)); m11=1; m12=0; m13=0; m21=0; m22= dCosAngle; m23=dSinAngle; m31=0; m32=-dSinAngle; m33=dCosAngle; } void RotationY(double angle) { T dCosAngle = T(cos(angle)); T dSinAngle = T(sin(angle)); m11=dCosAngle; m12=0; m13=-dSinAngle; m21=0; m22=1; m23=0; m31=dSinAngle; m32=0; m33=dCosAngle; } void RotationZ(double angle) { T dCosAngle = T(cos(angle)); T dSinAngle = T(sin(angle)); m11=dCosAngle; m12=dSinAngle; m13=0; m21=-dSinAngle; m22=dCosAngle; m23=0; m31=0; m32=0; m33=1; } void RotationAxis(const VECTOR3& axis, double angle) { T dCosAngle = T(cos(angle)); T dSinAngle = T(sin(angle)); T dOneMinusCosAngle = 1-dCosAngle; VECTOR3 sqrAxis = axis * axis; m11 = dCosAngle+dOneMinusCosAngle*sqrAxis.x; m12 = dOneMinusCosAngle*axis.x*axis.y-dSinAngle*axis.z; m13 = dOneMinusCosAngle*axis.x*axis.z+dSinAngle*axis.y; m21 = dOneMinusCosAngle*axis.x*axis.y+dSinAngle*axis.z; m22 = dCosAngle+dOneMinusCosAngle*sqrAxis.y; m23 = dOneMinusCosAngle*axis.y*axis.z-dSinAngle*axis.x; m31 = dOneMinusCosAngle*axis.x*axis.z-dSinAngle*axis.y; m32 = dOneMinusCosAngle*axis.y*axis.z+dSinAngle*axis.x; m33=dCosAngle+dOneMinusCosAngle*sqrAxis.z; } MATRIX3 inverse() const { T determ = 1.0f/(array[0]*(array[4]*array[8]-array[5]*array[7]) - array[1]*(array[3]*array[8]-array[5]*array[6]) + array[2]*(array[3]*array[7]-array[4]*array[6])); MATRIX3 result; result.array[0]=determ*(array[4]*array[8]-array[5]*array[7]); result.array[3]=determ*(array[2]*array[7]-array[1]*array[8]); result.array[6]=determ*(array[1]*array[5]-array[2]*array[4]); result.array[1]=determ*(array[5]*array[6]-array[3]*array[8]); result.array[4]=determ*(array[0]*array[8]-array[2]*array[6]); result.array[7]=determ*(array[2]*array[3]-array[0]*array[5]); result.array[2]=determ*(array[3]*array[7]-array[4]*array[6]); result.array[5]=determ*(array[1]*array[6]-array[0]*array[7]); result.array[8]=determ*(array[0]*array[4]-array[1]*array[3]); return result; } // DirectX #ifdef USEDX MATRIX3( const D3DXMATRIX& other ) : m11(other(0,0)), m12(other(0,1)), m13(other(0,2)), m21(other(1,0)), m22(other(1,1)), m23(other(1,2)), m31(other(2,0)), m32(other(2,1)), m33(other(2,2)) {}; D3DXMATRIX toD3DXMAT() const {return D3DXMATRIX(m11,m12,m13,0,m21,m22,m23,0,m31,m32,m33,0,0,0,0,1);} operator D3DXMATRIX(void) const {return toD3DXMAT();} #endif // OpenGL #ifdef USEGL void getProjection() { float P[16]; glGetFloatv(GL_PROJECTION_MATRIX,P); m11 = T(P[0]); m12 = T(P[1]); m13 = T(P[2]); m21 = T(P[4]); m22 = T(P[5]); m23 = T(P[6]); m31 = T(P[8]); m32 = T(P[9]); m33 = T(P[10]); } void getModelview() { float M[16]; glGetFloatv(GL_MODELVIEW_MATRIX,M); m11 = T(M[0]); m12 = T(M[1]); m13 = T(M[2]); m21 = T(M[4]); m22 = T(M[5]); m23 = T(M[6]); m31 = T(M[8]); m32 = T(M[9]); m33 = T(M[10]); } void multModelview() const { float M[16]; M[0] = float(m11); M[1] = float(m12); M[2] = float(m13); M[3] = 0; M[4] = float(m21); M[5] = float(m22); M[6] = float(m23); M[7] = 0; M[8] = float(m31); M[9] = float(m32); M[10] = float(m33); M[11] = 0; M[12] = 0; M[13] = 0; M[14] = 0; M[15] =1; glMatrixMode(GL_MODELVIEW); glMultMatrixf(M); } void setModelview() const { float M[16]; M[0] = float(m11); M[1] = float(m12); M[2] = float(m13); M[3] = 0; M[4] = float(m21); M[5] = float(m22); M[6] = float(m23); M[7] = 0; M[8] = float(m31); M[9] = float(m32); M[10] = float(m33); M[11] = 0; M[12] = 0; M[13] = 0; M[14] = 0; M[15] =1; glMatrixMode(GL_MODELVIEW); glLoadMatrixf(M); } #endif }; template class MATRIX4 { public: union { struct { T m11,m12,m13,m14, m21,m22,m23,m24, m31,m32,m33,m34, m41,m42,m43,m44; }; T array[16]; }; MATRIX4() : m11(1), m12(0), m13(0), m14(0), m21(0), m22(1), m23(0), m24(0), m31(0), m32(0), m33(1), m34(0), m41(0), m42(0), m43(0), m44(1) {}; MATRIX4( const T *e ) : m11(e[0]), m12(e[1]), m13(e[2]), m14(e[3]), m21(e[4]), m22(e[5]), m23(e[6]), m24(e[7]), m31(e[8]), m32(e[9]), m33(e[10]), m34(e[11]), m41(e[12]), m42(e[13]), m43(e[14]), m44(e[15]) {}; MATRIX4( const MATRIX4& other ) : m11(other.m11), m12(other.m12), m13(other.m13), m14(other.m14), m21(other.m21), m22(other.m22), m23(other.m23), m24(other.m24), m31(other.m31), m32(other.m32), m33(other.m33), m34(other.m34), m41(other.m41), m42(other.m42), m43(other.m43), m44(other.m44) {}; MATRIX4( const MATRIX3& other ) : m11(other.m11), m12(other.m12), m13(other.m13), m14(0), m21(other.m21), m22(other.m22), m23(other.m23), m24(0), m31(other.m31), m32(other.m32), m33(other.m33), m34(0), m41(0), m42(0), m43(0), m44(1) {}; MATRIX4( const VECTOR4 *rows ) : m11(rows[0].x), m12(rows[0].y), m13(rows[0].z), m14(rows[0].w), m21(rows[1].x), m22(rows[1].y), m23(rows[1].z), m24(rows[1].w), m31(rows[2].x), m32(rows[2].y), m33(rows[2].z), m34(rows[2].w), m41(rows[3].x), m42(rows[3].y), m43(rows[3].z), m44(rows[3].w) {}; MATRIX4(T _m11, T _m12, T _m13, T _m14, T _m21, T _m22, T _m23, T _m24, T _m31, T _m32, T _m33, T _m34, T _m41, T _m42, T _m43, T _m44) : m11(_m11), m12(_m12), m13(_m13), m14(_m14), m21(_m21), m22(_m22), m23(_m23), m24(_m24), m31(_m31), m32(_m32), m33(_m33), m34(_m34), m41(_m41), m42(_m42), m43(_m43), m44(_m44) {}; bool operator == ( const MATRIX4& other ) const {return (other.m11==m11 && other.m12==m12 && other.m13==m13 && other.m14==m14 && other.m21==m21 && other.m22==m22 && other.m23==m23 && other.m24==m24 && other.m31==m31 && other.m32==m32 && other.m33==m33 && other.m34==m34 && other.m31==m41 && other.m32==m42 && other.m33==m43 && other.m44==m44); } bool operator != ( const MATRIX4& other ) const {return (other.m11!=m11 || other.m12!=m12 || other.m13!=m13 || other.m14!=m14 || other.m21!=m21 || other.m22!=m22 || other.m23!=m23 || other.m24!=m24 || other.m31!=m31 || other.m32!=m32 || other.m33!=m33 || other.m34!=m34 || other.m41!=m41 || other.m42!=m42 || other.m43!=m43 || other.m44!=m44); } friend std::ostream& operator<<(std::ostream &os,const MATRIX4& m){os << m.m11 << '\t' << m.m12 << '\t' << m.m13 << '\t' << m.m14 << '\n' << m.m21 << '\t' << m.m22 << '\t' << m.m23 << '\t' << m.m24 << '\n' << m.m31 << '\t' << m.m32 << '\t' << m.m33 << '\t' << m.m34 << '\n' << m.m41 << '\t' << m.m42 << '\t' << m.m43 << '\t' << m.m44 ; return os;} operator T*(void) {return &m11;} operator const T*(void) const {return &m11;} const T *operator *(void) const {return &m11;} T *operator *(void) {return &m11;} // binary operators with scalars MATRIX4 operator * ( T scalar ) const {return MATRIX4(m11*scalar,m12*scalar,m13*scalar,m14*scalar, m21*scalar,m22*scalar,m23*scalar,m24*scalar, m31*scalar,m32*scalar,m33*scalar,m34*scalar, m41*scalar,m42*scalar,m43*scalar,m44*scalar);} MATRIX4 operator + ( T scalar ) const {return MATRIX4(m11+scalar,m12+scalar,m13+scalar,m14+scalar, m21+scalar,m22+scalar,m23+scalar,m24+scalar, m31+scalar,m32+scalar,m33+scalar,m34+scalar, m41+scalar,m42+scalar,m43+scalar,m44+scalar);} MATRIX4 operator - ( T scalar ) const {return MATRIX4(m11-scalar,m12-scalar,m13-scalar,m14-scalar, m21-scalar,m22-scalar,m23-scalar,m24-scalar, m31-scalar,m32-scalar,m33-scalar,m34-scalar, m41-scalar,m42-scalar,m43-scalar,m44-scalar);} MATRIX4 operator / ( T scalar ) const {return MATRIX4(m11/scalar,m12/scalar,m13/scalar,m14/scalar, m21/scalar,m22/scalar,m23/scalar,m24/scalar, m31/scalar,m32/scalar,m33/scalar,m34/scalar, m41/scalar,m42/scalar,m43/scalar,m44/scalar);} // binary operators with matrices MATRIX4 operator * ( const MATRIX4& other ) const { MATRIX4 result; for (int x = 0;x<16;x+=4) for (int y = 0;y<4;y++) result[x+y] = array[0+x] * other.array[0+y]+ array[1+x] * other.array[4+y]+ array[2+x] * other.array[8+y]+ array[3+x] * other.array[12+y]; return result; } // binary operators with vectors VECTOR4 operator * ( const VECTOR4& other ) const { return VECTOR4(other.x*m11+other.y*m12+other.z*m13+other.w*m14, other.x*m21+other.y*m22+other.z*m23+other.w*m24, other.x*m31+other.y*m32+other.z*m33+other.w*m34, other.x*m41+other.y*m42+other.z*m43+other.w*m44); } VECTOR3 operator * ( const VECTOR3& other ) const { return VECTOR3(other.x*m11+other.y*m12+other.z*m13, other.x*m21+other.y*m22+other.z*m23, other.x*m31+other.y*m32+other.z*m33); } void Translation(VECTOR3 trans) { Translation(trans.x, trans.y, trans.z); } void Scaling(VECTOR3 scale) { Scaling(scale.x, scale.y, scale.z); } void Translation(T x, T y, T z) { m11=1; m12=0; m13=0; m14=0; m21=0; m22=1; m23=0; m24=0; m31=0; m32=0; m33=1; m34=0; m41=x; m42=y; m43=z; m44=1; } void Scaling(T x, T y, T z) { m11=x; m12=0; m13=0; m14=0; m21=0; m22=y; m23=0; m24=0; m31=0; m32=0; m33=z; m34=0; m41=0; m42=0; m43=0; m44=1; } void RotationX(double angle) { T dCosAngle = T(cos(angle)); T dSinAngle = T(sin(angle)); m11=1; m12=0; m13=0; m14=0; m21=0; m22= dCosAngle; m23=dSinAngle; m24=0; m31=0; m32=-dSinAngle; m33=dCosAngle; m34=0; m41=0; m42=0; m43=0; m44=1; } void RotationY(double angle) { T dCosAngle = T(cos(angle)); T dSinAngle = T(sin(angle)); m11=dCosAngle; m12=0; m13=-dSinAngle; m14=0; m21=0; m22=1; m23=0; m24=0; m31=dSinAngle; m32=0; m33=dCosAngle; m34=0; m41=0; m42=0; m43=0; m44=1; } void RotationZ(double angle) { T dCosAngle = T(cos(angle)); T dSinAngle = T(sin(angle)); m11=dCosAngle; m12=dSinAngle; m13=0; m21=-dSinAngle; m22=dCosAngle; m23=0; m31=0; m32=0; m33=1; m41=0; m42=0; m43=0; m44=1; } void RotationAxis(const VECTOR3& axis, double angle) { T dCosAngle = T(cos(angle)); T dSinAngle = T(sin(angle)); T dOneMinusCosAngle = 1-dCosAngle; VECTOR3 sqrAxis = axis * axis; m11 = dCosAngle+dOneMinusCosAngle*sqrAxis.x; m12 = dOneMinusCosAngle*axis.x*axis.y-dSinAngle*axis.z; m13 = dOneMinusCosAngle*axis.x*axis.z+dSinAngle*axis.y; m14=0; m21 = dOneMinusCosAngle*axis.x*axis.y+dSinAngle*axis.z; m22 = dCosAngle+dOneMinusCosAngle*sqrAxis.y; m23 = dOneMinusCosAngle*axis.y*axis.z-dSinAngle*axis.x; m24=0; m31 = dOneMinusCosAngle*axis.x*axis.z-dSinAngle*axis.y; m32 = dOneMinusCosAngle*axis.y*axis.z+dSinAngle*axis.x; m33 = dCosAngle+dOneMinusCosAngle*sqrAxis.z; m34=0; m41 = 0; m42 = 0; m43 = 0; m44=1; } MATRIX4 Transpose() const { MATRIX4 result; result.m41 = m14; result.m31 = m13; result.m42 = m24; result.m21 = m12; result.m32 = m23; result.m43 = m34; result.m11 = m11; result.m22 = m22; result.m33 = m33; result.m44 = m44; result.m12 = m21; result.m23 = m32; result.m34 = m43; result.m13 = m31; result.m24 = m42; result.m14 = m41; return result; } MATRIX4 inverse() const { MATRIX4 result; T Q = m21 *(m34*( m12 * m43 - m13 * m42)+ m14 *(-m32 * m43 + m42 * m33)+ m44*( m13 * m32 - m12 * m33)) + m24 *(m11 *( m32 * m43 - m42 * m33)+ m13 *(-m41* m32 + m31 * m42)+ m12 *(-m31 * m43 + m41 * m33)) + m44*(m22 *(-m31 * m13 + m11 * m33)+ m23 *(-m11 * m32 + m12 * m31)) + m34*(m11 *(-m22 * m43 + m23 * m42)+ m41*( m13 * m22 - m23 * m12)) + m14* (m23 *( m32 * m41 - m42 * m31)+ m22 *( m31 * m43 - m41 * m33)); result.m11 = ( m24 * m32 * m43 + m44 * m22 * m33 - m44 * m23 * m32 - m34 * m22 * m43 - m24 * m42 * m33 + m34 * m23 * m42)/Q; result.m21 = -( m21 * m44 * m33 - m21 * m34 * m43 - m44 * m23 * m31 + m34 * m23 * m41 + m24 * m31 * m43 - m24 * m41 * m33)/Q; result.m31 = (- m21 * m34 * m42 + m21 * m44 * m32 - m44 * m31 * m22 - m24 * m41 * m32 + m34 * m41 * m22 + m24 * m31 * m42)/Q; result.m41 = -(m21 * m32 * m43 - m21 * m42 * m33 + m41 * m22 * m33 - m32 * m23 * m41 - m31 * m22 * m43 + m42 * m23 * m31)/Q; /// 2 result.m12 = (- m12 * m44 * m33 + m12 * m34 * m43 - m34 * m13 * m42 - m14 * m32 * m43 + m44 * m13 * m32 + m14 * m42 * m33)/Q; result.m22 = (- m44 * m13 * m31 + m44 * m11 * m33 - m34 * m11 * m43 - m14 * m41 * m33 + m34 * m13 * m41 + m14 * m31 * m43)/Q; result.m32 = -(-m12 * m44 * m31 + m12 * m34 * m41 + m44 * m11 * m32 - m14 * m32 * m41 + m14 * m42 * m31 - m34 * m11 * m42)/Q; result.m42 = (- m12 * m31 * m43 + m12 * m41 * m33 + m11 * m32 * m43 - m11 * m42 * m33 - m41 * m13 * m32 + m31 * m13 * m42)/Q; /// 3 result.m13 = -( m44 * m13 * m22 - m24 * m13 * m42 - m14 * m22 * m43 + m12 * m24 * m43 - m12 * m44 * m23 + m14 * m42 * m23)/Q; result.m23 = (- m21 * m14 * m43 + m21 * m44 * m13 + m24 * m11 * m43 - m44 * m23 * m11 - m24 * m41 * m13 + m14 * m23 * m41)/Q; result.m33 = -(-m44 * m11 * m22 + m44 * m12 * m21 + m14 * m41 * m22 + m24 * m11 * m42 - m24 * m12 * m41 - m14 * m21 * m42)/Q; result.m43 = -( m43 * m11 * m22 - m43 * m12 * m21 - m13 * m41 * m22 - m23 * m11 * m42 + m23 * m12 * m41 + m13 * m21 * m42)/Q; /// 4 result.m14 = (- m12 * m34 * m23 + m12 * m24 * m33 - m24 * m13 * m32 - m14 * m22 * m33 + m34 * m13 * m22 + m14 * m32 * m23)/Q; result.m24 = -(-m21 * m14 * m33 + m21 * m34 * m13 + m24 * m11 * m33 - m34 * m23 * m11 + m14 * m23 * m31 - m24 * m31 * m13)/Q; result.m34 = (- m34 * m11 * m22 + m34 * m12 * m21 + m14 * m31 * m22 + m24 * m11 * m32 - m24 * m12 * m31 - m14 * m21 * m32)/Q; result.m44 = ( m33 * m11 * m22 - m33 * m12 * m21 - m13 * m31 * m22 - m23 * m11 * m32 + m23 * m12 * m31 + m13 * m21 * m32)/Q; return result; } // DirectX #ifdef USEDX MATRIX4( const D3DXMATRIX& other ) : m11(other(0,0)), m12(other(0,1)), m13(other(0,2)),m14(other(0,3)), m21(other(1,0)), m22(other(1,1)), m23(other(1,2)),m24(other(1,3)), m31(other(2,0)), m32(other(2,1)), m33(other(2,2)),m34(other(2,3)), m41(other(3,0)), m42(other(3,1)), m43(other(3,2)),m44(other(3,3)) {}; D3DXMATRIX toD3DXMAT() const {return D3DXMATRIX(FLOAT(m11),FLOAT(m12),FLOAT(m13),FLOAT(m14), FLOAT(m21),FLOAT(m22),FLOAT(m23),FLOAT(m24), FLOAT(m31),FLOAT(m32),FLOAT(m33),FLOAT(m34), FLOAT(m41),FLOAT(m42),FLOAT(m43),FLOAT(m44));} operator D3DXMATRIX(void) const {return toD3DXMAT();} #endif // OpenGL #ifdef USEGL static void BuildStereoLookAtAndProjection(const VECTOR3& vEye, const VECTOR3& vAt, const VECTOR3& vUp, T fFOVY, T fAspect, T fZNear, T fZFar, T fFocalLength, T fEyeDist, int iEyeID, MATRIX4& mView, MATRIX4& mProj) { T radians = T(3.14159265358979323846/180.0) * fFOVY/T(2); T wd2 = fZNear * T(tan(radians)); T nfdl = fZNear / fFocalLength; T fShift = fEyeDist * nfdl; T left = - fAspect * wd2 + T(iEyeID)*fShift; T right = fAspect * wd2 + T(iEyeID)*fShift; T top = wd2; T bottom = - wd2; // projection matrix mProj.MatrixPerspectiveOffCenter(left, right, bottom, top, fZNear, fZFar); // view matrix mView.BuildLookAt(vEye, vAt, vUp); MATRIX4 mTranslate; mTranslate.Translation(fEyeDist*T(iEyeID), 0.0f, 0.0f); mView= mTranslate * mView; } static void BuildStereoLookAtAndProjection(const VECTOR3& vEye, const VECTOR3& vAt, const VECTOR3& vUp, T fFOVY, T fAspect, T fZNear, T fZFar, T fFocalLength, T fEyeDist, MATRIX4& mViewLeft, MATRIX4& mViewRight, MATRIX4& mProjLeft, MATRIX4& mProjRight) { T radians = T(3.14159265358979323846/180.0) * fFOVY/2; T wd2 = fZNear * T(tan(radians)); T nfdl = fZNear / fFocalLength; T fShift = fEyeDist * nfdl; T left = - fAspect * wd2 + fShift; T right = fAspect * wd2 + fShift; T top = wd2; T bottom = - wd2; // projection matrices mProjLeft.MatrixPerspectiveOffCenter(left, right, bottom, top, fZNear, fZFar); left = - fAspect * wd2 - fShift; right = fAspect * wd2 - fShift; mProjRight.MatrixPerspectiveOffCenter(left, right, bottom, top, fZNear, fZFar); // view matrices mViewLeft.BuildLookAt(vEye, vAt, vUp); mViewRight.BuildLookAt(vEye, vAt, vUp); // eye translation MATRIX4 mTranslate; mTranslate.Translation(fEyeDist, 0.0f, 0.0f); mViewLeft = mTranslate * mViewLeft; mTranslate.Translation(-fEyeDist, 0.0f, 0.0f); mViewRight = mTranslate * mViewRight; } void BuildLookAt(const VECTOR3& vEye, const VECTOR3& vAt, const VECTOR3& vUp) { VECTOR3 F = vAt-vEye; VECTOR3 U = vUp; VECTOR3 S = F % U; U = S % F; F.normalize(); U.normalize(); S.normalize(); array[ 0]= S[0]; array[ 4]= S[1]; array[ 8]= S[2]; array[12]=-(S^vEye); array[ 1]= U[0]; array[ 5]= U[1]; array[ 9]= U[2]; array[13]=-(U^vEye); array[ 2]=-F[0]; array[ 6]=-F[1]; array[10]=-F[2]; array[14]= (F^vEye); array[ 3]= T(0); array[ 7]=T(0); array[11]=T(0); array[15]= T(1); } void Perspective(T fovy, T aspect, T n, T f) { // deg 2 rad fovy = fovy * T(3.14159265358979323846/180.0); T cotan = T(1.0/tan(double(fovy)/2.0)); array[ 0]= cotan/aspect; array[ 4]=T(0); array[ 8]=T(0); array[12]=T(0); array[ 1]= T(0); array[ 5]=cotan; array[ 9]=T(0); array[13]=T(0); array[ 2]= T(0); array[ 6]=T(0); array[10]=-(f+n)/(f-n); array[14]=T(-2)*(f*n)/(f-n); array[ 3]= T(0); array[ 7]=T(0); array[11]=T(-1); array[15]=T(0); } void Ortho(T left, T right, T bottom, T top, T znear, T zfar ) { array[ 0]= T(2)/(right-left); array[ 4]=T(0); array[ 8]=T(0); array[12]=-(right+left)/(right-left); array[ 1]= T(0); array[ 5]=T(2)/(top-bottom); array[ 9]=T(0); array[13]=-(top+bottom)/(top-bottom); array[ 2]= T(0); array[ 6]=T(0); array[10]=-T(2)/(zfar-znear); array[14]=-(zfar+znear)/(zfar-znear); array[ 3]= T(0); array[ 7]=T(0); array[11]=T(0); array[15]=T(1); } void MatrixPerspectiveOffCenter(T left, T right, T bottom, T top, T n, T f) { array[ 0]= T(2)*n/(right-left); array[ 4]=T(0); array[ 8]=(right+left)/(right-left); array[12]=T(0); array[ 1]= T(0); array[ 5]=T(2)*n/(top-bottom); array[ 9]=(top+bottom)/(top-bottom); array[13]=T(0); array[ 2]= T(0); array[ 6]=T(0); array[10]=-(f+n)/(f-n); array[14]=T(-2)*(f*n)/(f-n); array[ 3]= T(0); array[ 7]=T(0); array[11]=T(-1); array[15]=T(0); } void getProjection() { float P[16]; glGetFloatv(GL_PROJECTION_MATRIX,P); for (int i=0;i<16;i++) array[i] = T(P[i]); } void getModelview() { float M[16]; glGetFloatv(GL_MODELVIEW_MATRIX,M); for (int i=0;i<16;i++) array[i] = T(M[i]); } void multModelview() const { float M[16]; for (int i=0;i<16;i++) M[i] = float(array[i]); glMatrixMode(GL_MODELVIEW); glMultMatrixf(M); } void setProjection() const { float M[16]; for (int i=0;i<16;i++) M[i] = float(array[i]); glMatrixMode(GL_PROJECTION); glLoadMatrixf(M); } void setModelview() const { float M[16]; for (int i=0;i<16;i++) M[i] = float(array[i]); glMatrixMode(GL_MODELVIEW); glLoadMatrixf(M); } void setTextureMatrix(int iUnit = 0) const { float M[16]; for (int i=0;i<16;i++) M[i] = float(array[i]); glActiveTextureARB(GL_TEXTURE0_ARB+iUnit); glMatrixMode(GL_TEXTURE); glLoadMatrixf(M); } #endif }; typedef MATRIX2 INTMATRIX2; typedef MATRIX3 INTMATRIX3; typedef MATRIX4 INTMATRIX4; typedef MATRIX2 FLOATMATRIX2; typedef MATRIX3 FLOATMATRIX3; typedef MATRIX4 FLOATMATRIX4; typedef MATRIX2 DOUBLEMATRIX2; typedef MATRIX3 DOUBLEMATRIX3; typedef MATRIX4 DOUBLEMATRIX4; template class QUATERNION4 { public: float x, y, z, w; QUATERNION4(): x(0), y(0),z(0), w(0) {} QUATERNION4(T _x, T _y, T _z, T _w): x(_x), y(_y), z(_z), w(_w) {} QUATERNION4(const T& other) : x(other.x), y(other.y), z(other.z), w(other.w) {} MATRIX4 ComputeRotation() { float n, s; float xs, ys, zs; float wx, wy, wz; float xx, xy, xz; float yy, yz, zz; n = (x * x) + (y * y) + (z * z) + (w * w); s = (n > 0.0f) ? (2.0f / n) : 0.0f; xs = x * s; ys = y * s; zs = z * s; wx = w * xs; wy = w * ys; wz = w * zs; xx = x * xs; xy = x * ys; xz = x * zs; yy = y * ys; yz = y * zs; zz = z * zs; return MATRIX4(T(1.0f - (yy + zz)), T(xy - wz), T(xz + wy), T(0), T(xy + wz), T(1.0f - (xx + zz)), T(yz - wx), T(0), T(xz - wy), T(yz + wx), T(1.0f - (xx + yy)), T(0), T(0), T(0), T(0), T(1)); } bool operator == ( const QUATERNION4& other ) const {return (other.x==x && other.y==y && other.z==z && other.w==w); } bool operator != ( const QUATERNION4& other ) const {return (other.x!=x || other.y!=y || other.z!=z || other.w!=w); } // binary operators with other quaternions QUATERNION4 operator + ( const QUATERNION4& other ) const {return QUATERNION4(x+other.x,y+other.y,z+other.z,w+other.w);} QUATERNION4 operator - ( const QUATERNION4& other ) const {return QUATERNION4(x-other.x,y-other.y,z-other.z,w-other.w);} QUATERNION4 operator * ( const QUATERNION4& other ) const { VECTOR3 v1(x,y,z); VECTOR3 v2(other.x,other.y,other.z); T _w = w * other.w - (v1 ^ v2); VECTOR3 _v = (v2 * w) + (v1 * other.w) + (v1 % v2); return QUATERNION4(_v.x, _v.y, _v.z, _w); } // binary operator with scalars QUATERNION4 operator * ( const T other ) const { return QUATERNION4(x*other,y*other,z*other,w*other); } QUATERNION4& operator=(const QUATERNION4& other) { x = other.x; y = other.y; z = other.z; w = other.w; return *this; } QUATERNION4& operator+=(const T& other) { x += other; y += other; z += other; w += other; return *this; } QUATERNION4& operator-=(const T& other) { x -= other; y -= other; z -= other; w -= other; return *this; } }; typedef QUATERNION4 FLOATQUATERNION4; typedef QUATERNION4 DOUBLEQUATERNION4; /// Tests to see if the two values are basically the same. template static bool EpsilonEqual(T a, T b) { /// @todo FIXME provide specializations for types; currently this would only /// be correct if instantiated as a float! return fabs(a-b) <= std::numeric_limits::epsilon(); } /// a PLANE is a VECTOR4 which is always normalized. template class PLANE : public VECTOR4 { public: PLANE(): VECTOR4(0,0,0,0) {} // plane from paramters (usually all 4 are given) template explicit PLANE( const std::vector& v ) { this->x = T(!v.empty() ? v[0] : 0); this->y = T(!v.empty() ? v[1] : 0); this->z = T(!v.empty() ? v[2] : 0); this->w = T(!v.empty() ? v[3] : 0); } // plane from points template explicit PLANE( const VECTOR3& v0, const VECTOR3& v1, const VECTOR3& v2 ) { this->x = T(v0.y) * (T(v1.z) - T(v2.z)) + T(v1.y) * (T(v2.z) - T(v0.z)) + T(v2.y) * (T(v0.z) - T(v1.z)); this->y = T(v0.z) * (T(v1.x) - T(v2.x)) + T(v1.z) * (T(v2.x) - T(v0.x)) + T(v2.z) * (T(v0.x) - T(v1.x)); this->z = T(v0.x) * (T(v1.y) - T(v2.y)) + T(v1.x) * (T(v2.y) - T(v0.y)) + T(v2.x) * (T(v0.y) - T(v1.y)); this->w = - (T(v0.x) * (T(v1.y) * T(v2.z) - T(v2.y) * T(v1.z)) + T(v1.x) * (T(v2.y) * T(v0.z) - T(v0.y) * T(v2.z)) + T(v2.x) * (T(v0.y) * T(v1.z) - T(v1.y) * T(v0.z))); } PLANE(const VECTOR2 &other, const T _z, const T _w): VECTOR4(other, _z, _w) {} PLANE(const VECTOR3 &other, const T _w = 1): VECTOR4(other, _w) {} PLANE(const VECTOR4 &other): VECTOR4(other) {} template explicit PLANE(const PLANE &other): VECTOR4(other) {} PLANE(const T _x, const T _y, const T _z, const T _w) : VECTOR4(_x,_y,_z,_w) {} PLANE(const T* vec) : VECTOR4(vec) {} /// @return true if the given point is clipped by this plane. bool clip(VECTOR3 point) const { return ((FLOATVECTOR4::xyz() ^ point)+this->w >= 0); } /// Transform the plane by the given matrix. void transform(const MATRIX4 &m) { FLOATMATRIX4 mIT(m.inverse()); mIT = mIT.Transpose(); transformIT(mIT); } /// Transform the plane by the inverse transpose of the given matrix. void transformIT(const MATRIX4 &M) { (*this) = FLOATVECTOR4::operator*(M); normalize(); } void normalize() { const T x = this->x; const T y = this->y; const T z = this->z; T length = sqrt(x*x + y*y + z*z); (*this) /= length; } T d() const { return this->w; } VECTOR3 normal() const { return this->xyz(); } // binary operators with a matrix PLANE operator * ( const MATRIX4& matrix ) const { PLANE tmp(*this); tmp.transform(matrix); return tmp; } /// Determine the intersection point of the plane and a line `ab'. /// @return whether or not the two intersect. If false, `hit' will not be /// valid. bool intersect(const VECTOR3& a, const VECTOR3& b, VECTOR3& hit) const { T t; bool bIntersect = intersect(a,b,t); if (!bIntersect) return false; hit = a + (t*(b - a)); return true; } /// Determine the parametric intersection point of the plane and a line `ab'. /// @return whether or not the two intersect. If false, `hit' will not be /// valid. bool intersect(const VECTOR3& a, const VECTOR3& b, T& hit) const { const T denom = (*this).xyz() ^ (a - b); if(EpsilonEqual(denom, 0.0f)) { return false; } hit = (((*this).xyz() ^ a) + this->d()) / denom; return true; } }; typedef PLANE FLOATPLANE; typedef PLANE DOUBLEPLANE; #endif // VECTORS_H ImageVis3D-3.1.0/Tuvok/Basics/LargeFileFD.cpp0000644000175000017500000001622412320456500020346 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include #include #include #ifndef NDEBUG # include # define DEBUG(s) do { std::cerr << s << "\n"; } while(0) #else # define DEBUG(s) do { /* nothing, debug msg removed. */ } while(0) #endif #include "LargeFileFD.h" LargeFileFD::LargeFileFD(const std::string fn, std::ios_base::openmode mode, uint64_t header_size, uint64_t /* length */) : LargeFile(fn, mode, header_size), fd(-1) { this->open(mode); } LargeFileFD::LargeFileFD(const std::wstring fn, std::ios_base::openmode mode, uint64_t header_size, uint64_t /* length */) : LargeFile(fn, mode, header_size), fd(-1) { this->open(mode); } LargeFileFD::~LargeFileFD() { if(this->is_open()) { this->close(); } } std::shared_ptr LargeFileFD::rd(uint64_t offset, size_t len) { if(!this->is_open()) { throw std::ios_base::failure("file is not open!!"); } if(lseek(this->fd, offset+this->header_size, SEEK_SET) < 0) { throw std::ios_base::failure("could not seek to correct file position."); } #ifdef POSIX_FADV_WILLNEED posix_fadvise(this->fd, offset+this->header_size, len, POSIX_FADV_WILLNEED); #endif std::shared_ptr data = std::shared_ptr(new char[len], nonstd::DeleteArray()); ssize_t bytes; size_t completed = 0; do { bytes = ::read(this->fd, static_cast(data.get())+completed, len-completed); if(bytes < 0 && errno != EINTR) { throw std::ios_base::failure("read failure."); } completed += bytes; } while(completed < len && errno == EINTR); this->bytes_read = completed; // we need to cast it to a 'const void' to return it... std::shared_ptr mem = std::static_pointer_cast(data); return mem; } void LargeFileFD::wr(const std::shared_ptr& data, uint64_t offset, size_t len) { if(!this->is_open()) { throw std::ios_base::failure("file is not open!!"); } if(lseek(this->fd, offset+this->header_size, SEEK_SET) < 0) { throw std::ios_base::failure("could not seek to correct file position."); } const char* bytes = static_cast(data.get()); ssize_t wr; size_t written=0; do { wr = ::write(this->fd, bytes+written, len-written); if(wr < 0 && errno != EINTR) { throw std::ios_base::failure("write failure."); } written += wr; } while(written < len && errno == EINTR); } void LargeFileFD::enqueue(uint64_t offset, size_t len) { if(len == 0) { return; } #ifdef POSIX_FADV_WILLNEED int adv = posix_fadvise(this->fd, offset, len, POSIX_FADV_WILLNEED); // this should basically always succeed. the only way it can fail is if we // gave it a bogus FD or something. if that's the case, that points to // either a programming error or some sort of nasty memory corruption. switch(adv) { case 0: /* nothing, good. */ break; case EBADF: throw std::out_of_range("bad file descriptor."); break; case EINVAL: throw std::invalid_argument("bad argument"); break; case ESPIPE: throw std::domain_error("fd refers to a pipe?!"); break; } #else (void) offset; (void) len; #endif } uint64_t LargeFileFD::filesize() const { struct stat st; if(stat(m_filename.c_str(), &st) == -1) { switch(errno) { case EACCES: throw std::ios::failure("no search permission."); break; case EIO: throw std::ios::failure("I/O error."); break; case ELOOP: throw std::ios::failure("loop in symbolic links."); break; case ENAMETOOLONG: throw std::ios::failure("name too long"); break; case ENOENT: throw std::ios::failure("file does not exist."); break; case EOVERFLOW: throw std::overflow_error("need more bits."); break; } return 0; } return static_cast(st.st_size); } bool LargeFileFD::is_open() const { return this->fd != -1; } void LargeFileFD::close() { if(!LargeFileFD::is_open()) { return; } int cl; do { cl = ::close(this->fd); } while(cl == -1 && errno == EINTR); assert(errno != EBADF); if(cl == -1 && errno == EBADF) { throw std::invalid_argument("invalid file descriptor"); } else if(cl == -1 && errno == EIO) { throw std::runtime_error("I/O error."); } this->fd = -1; } void LargeFileFD::open(std::ios_base::openmode mode) { if(LargeFileFD::is_open()) { this->close(); } int access = O_RDONLY; if(mode & std::ios_base::out) { access = O_RDWR | O_CREAT; } else { access = O_RDONLY; } this->fd = ::open(this->m_filename.c_str(), access, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if(this->fd == -1) { throw std::ios_base::failure("Could not open file."); } } void LargeFileFD::truncate(uint64_t len) { if(this->fd == -1) { LargeFile::truncate(this->m_filename.c_str(), len); return; } if(ftruncate(this->fd, len) != 0) { switch(errno) { case EFBIG: /* fall through */ case EINVAL: throw std::length_error("broken length"); break; case EIO: throw std::ios::failure("io error"); break; case EACCES: throw std::runtime_error("permission error"); break; case EISDIR: throw std::domain_error("path given is directory"); break; case ELOOP: throw std::runtime_error("too many levels of symlinks"); break; case ENAMETOOLONG: throw std::runtime_error("path too long"); break; case ENOENT: throw std::runtime_error("bad path"); break; case ENOTDIR: throw std::domain_error("path is not valid"); break; case EROFS: throw std::runtime_error("path is on RO filesystem"); break; case EBADF: throw std::ios::failure("invalid file descriptor"); break; } } // move the offset down if it's beyond EOF. this->byte_offset = std::min(this->byte_offset, len); } ImageVis3D-3.1.0/Tuvok/Basics/StdDefines.h0000644000175000017500000001061012320456500017770 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file StdDefines.h \author Jens Krueger SCI Institute University of Utah \date May 2009 */ #pragma once #ifndef STDDEFINES_H #define STDDEFINES_H #if defined(_MSC_VER) && _MSC_VER < 1600 # warning "VS 2010 required for cstdint header." #endif #include #include using std::int64_t; using std::int32_t; using std::int16_t; using std::int8_t; using std::uint64_t; using std::uint32_t; using std::uint16_t; using std::uint8_t; // Make sure windows doesn't give us stupid macros that interfere with // functions in 'std'. #define NOMINMAX // Disable checked iterators on Windows, only necessary for // pre VS2010 versions (VS2010 has _MSC_VER = 1600) // in VS 2010 MS finally realized that a 2x performance // penalty for STL operations sucks, more details can be found here // http://channel9.msdn.com/Shows/Going+Deep/C9-Lectures-Stephan-T-Lavavej-Advanced-STL-3-of-n #ifndef _DEBUG #if _MSC_VER < 1600 # undef _SECURE_SCL # define _SECURE_SCL 0 #endif #endif // Get rid of stupid warnings. #define _CRT_SECURE_NO_WARNINGS 1 // Get rid of stupid warnings Part 2. #define _SCL_SECURE_NO_WARNINGS 1 #define UNUSED (0) #define UNUSED_FLOAT (0.0f) #define UNUSED_DOUBLE (0.0) #define UINT32_INVALID (std::numeric_limits::max()) #define UINT64_INVALID (std::numeric_limits::max()) #define BLOCK_COPY_SIZE (uint64_t(64*1024*1024)) // undef all OS types first #ifdef DETECTED_OS_WINDOWS #undef DETECTED_OS_WINDOWS #endif #ifdef DETECTED_OS_APPLE #undef DETECTED_OS_APPLE #endif #ifdef DETECTED_OS_LINUX #undef DETECTED_OS_LINUX #endif // now figure out which OS we are compiling on #ifdef _WIN32 #define DETECTED_OS_WINDOWS #endif #if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__)) #define DETECTED_OS_APPLE #endif #if defined(__linux__) #define DETECTED_OS_LINUX #endif // Disabled for now; clean up include ordering at some point before // re-enabling. #if 0 # define _POSIX_C_SOURCE 200112L #endif // Disable the "secure CRT" garbage warnings. #undef _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS 1 #ifdef _MSC_VER // The above is the documented way to do it, but doesn't work. This does: # pragma warning(disable: 4996) // prevent MSVC from complaining that it doesn't implement checked exceptions. # pragma warning(disable: 4290) #endif // set some strings to reflect that OS #ifdef DETECTED_OS_WINDOWS #ifdef _WIN64 #ifdef USE_DIRECTX #define TUVOK_DETAILS "Windows 64bit build with DirectX extensions" #else #define TUVOK_DETAILS "Windows 64bit build" #endif #else #ifdef USE_DIRECTX #define TUVOK_DETAILS "Windows 32bit build with DirectX extensions" #else #define TUVOK_DETAILS "Windows 32bit build" #endif #endif #endif #ifdef DETECTED_OS_APPLE #define TUVOK_DETAILS "OSX build" #endif #ifdef DETECTED_OS_LINUX #define TUVOK_DETAILS "Linux build" #endif #ifndef TUVOK_DETAILS # define TUVOK_DETAILS "Unsupported system build" #endif #ifdef __GNUC__ # define FUNC_PURE __attribute__((pure)) # define FUNC_CONST __attribute__((const)) #else # define FUNC_PURE /* nothing */ # define FUNC_CONST /* nothing */ #endif #endif // STDDEFINES_H ImageVis3D-3.1.0/Tuvok/Basics/GeometryGenerator.cpp0000644000175000017500000001063112320456500021740 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GeometryGenerator.cpp \author Jens Krueger SCI Institute University of Utah \date Januar 2009 */ #include "GeometryGenerator.h" #include #define CONST_PI 3.14159265358979323846f using namespace std; namespace tuvok { vector GeometryGenerator::GenArrow(float fOverallLength, float fShaftToHeadRatio, float fShaftRadius, float fHeadRadius, uint32_t iSegments) { vector vGeometry; // compute helper vars float fDegreePerSegment = (CONST_PI*2.0f)/float(iSegments); float fLengthShaft = fOverallLength * fShaftToHeadRatio; // compute coords on a circle vector vDisk; for (uint32_t i = 0;i #include #include #include #include namespace TCLAP { /** * This class handles lists of Arg's that are to be XOR'd on the command * line. This is used by CmdLine and you shouldn't ever use it. */ class XorHandler { protected: /** * The list of of lists of Arg's to be or'd together. */ std::vector< std::vector > _orList; public: /** * Constructor. Does nothing. */ XorHandler( ) {} /** * Add a list of Arg*'s that will be orred together. * \param ors - list of Arg* that will be xor'd. */ void add( std::vector& ors ); /** * Checks whether the specified Arg is in one of the xor lists and * if it does match one, returns the size of the xor list that the * Arg matched. If the Arg matches, then it also sets the rest of * the Arg's in the list. You shouldn't use this. * \param a - The Arg to be checked. */ int check( const Arg* a ); /** * Returns the XOR specific short usage. */ std::string shortUsage(); /** * Prints the XOR specific long usage. * \param os - Stream to print to. */ void printLongUsage(std::ostream& os); /** * Simply checks whether the Arg is contained in one of the arg * lists. * \param a - The Arg to be checked. */ bool contains( const Arg* a ); std::vector< std::vector >& getXorList(); }; ////////////////////////////////////////////////////////////////////// //BEGIN XOR.cpp ////////////////////////////////////////////////////////////////////// inline void XorHandler::add( std::vector& ors ) { _orList.push_back( ors ); } inline int XorHandler::check( const Arg* a ) { // iterate over each XOR list for ( int i = 0; static_cast(i) < _orList.size(); i++ ) { // if the XOR list contains the arg.. ArgVectorIterator ait = std::find( _orList[i].begin(), _orList[i].end(), a ); if ( ait != _orList[i].end() ) { // go through and set each arg that is not a for ( ArgVectorIterator it = _orList[i].begin(); it != _orList[i].end(); it++ ) if ( a != (*it) ) (*it)->xorSet(); // return the number of required args that have now been set if ( (*ait)->allowMore() ) return 0; else return static_cast(_orList[i].size()); } } if ( a->isRequired() ) return 1; else return 0; } inline bool XorHandler::contains( const Arg* a ) { for ( int i = 0; static_cast(i) < _orList.size(); i++ ) for ( ArgVectorIterator it = _orList[i].begin(); it != _orList[i].end(); it++ ) if ( a == (*it) ) return true; return false; } inline std::vector< std::vector >& XorHandler::getXorList() { return _orList; } ////////////////////////////////////////////////////////////////////// //END XOR.cpp ////////////////////////////////////////////////////////////////////// } //namespace TCLAP #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/StdOutput.h0000644000175000017500000002040412320456500022530 0ustar mathieumathieu// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- /****************************************************************************** * * file: StdOutput.h * * Copyright (c) 2004, Michael E. Smoot * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ #ifndef TCLAP_STDCMDLINEOUTPUT_H #define TCLAP_STDCMDLINEOUTPUT_H #include #include #include #include #include #include #include #include #include namespace TCLAP { /** * A class that isolates any output from the CmdLine object so that it * may be easily modified. */ class StdOutput : public CmdLineOutput { public: /** * Prints the usage to stdout. Can be overridden to * produce alternative behavior. * \param c - The CmdLine object the output is generated for. */ virtual void usage(CmdLineInterface& c); /** * Prints the version to stdout. Can be overridden * to produce alternative behavior. * \param c - The CmdLine object the output is generated for. */ virtual void version(CmdLineInterface& c); /** * Prints (to stderr) an error message, short usage * Can be overridden to produce alternative behavior. * \param c - The CmdLine object the output is generated for. * \param e - The ArgException that caused the failure. */ virtual void failure(CmdLineInterface& c, ArgException& e ); protected: /** * Writes a brief usage message with short args. * \param c - The CmdLine object the output is generated for. * \param os - The stream to write the message to. */ void _shortUsage( CmdLineInterface& c, std::ostream& os ) const; /** * Writes a longer usage message with long and short args, * provides descriptions and prints message. * \param c - The CmdLine object the output is generated for. * \param os - The stream to write the message to. */ void _longUsage( CmdLineInterface& c, std::ostream& os ) const; /** * This function inserts line breaks and indents long strings * according the params input. It will only break lines at spaces, * commas and pipes. * \param os - The stream to be printed to. * \param s - The string to be printed. * \param maxWidth - The maxWidth allowed for the output line. * \param indentSpaces - The number of spaces to indent the first line. * \param secondLineOffset - The number of spaces to indent the second * and all subsequent lines in addition to indentSpaces. */ void spacePrint( std::ostream& os, const std::string& s, int maxWidth, int indentSpaces, int secondLineOffset ) const; }; inline void StdOutput::version(CmdLineInterface& _cmd) { std::string progName = _cmd.getProgramName(); std::string version = _cmd.getVersion(); std::cout << std::endl << progName << " version: " << version << std::endl << std::endl; } inline void StdOutput::usage(CmdLineInterface& _cmd ) { std::cout << std::endl << "USAGE: " << std::endl << std::endl; _shortUsage( _cmd, std::cout ); std::cout << std::endl << std::endl << "Where: " << std::endl << std::endl; _longUsage( _cmd, std::cout ); std::cout << std::endl; } inline void StdOutput::failure( CmdLineInterface& _cmd, ArgException& e ) { std::string progName = _cmd.getProgramName(); std::cerr << "PARSE ERROR: " << e.argId() << std::endl << " " << e.error() << std::endl << std::endl; if ( _cmd.hasHelpAndVersion() ) { std::cerr << "Brief USAGE: " << std::endl; _shortUsage( _cmd, std::cerr ); std::cerr << std::endl << "For complete USAGE and HELP type: " << std::endl << " " << progName << " --help" << std::endl << std::endl; } else usage(_cmd); throw ExitException(1); } inline void StdOutput::_shortUsage( CmdLineInterface& _cmd, std::ostream& os ) const { std::list argList = _cmd.getArgList(); std::string progName = _cmd.getProgramName(); XorHandler xorHandler = _cmd.getXorHandler(); std::vector< std::vector > xorList = xorHandler.getXorList(); std::string s = progName + " "; // first the xor for ( int i = 0; static_cast(i) < xorList.size(); i++ ) { s += " {"; for ( ArgVectorIterator it = xorList[i].begin(); it != xorList[i].end(); it++ ) s += (*it)->shortID() + "|"; s[s.length()-1] = '}'; } // then the rest for (ArgListIterator it = argList.begin(); it != argList.end(); it++) if ( !xorHandler.contains( (*it) ) ) s += " " + (*it)->shortID(); // if the program name is too long, then adjust the second line offset int secondLineOffset = static_cast(progName.length()) + 2; if ( secondLineOffset > 75/2 ) secondLineOffset = static_cast(75/2); spacePrint( os, s, 75, 3, secondLineOffset ); } inline void StdOutput::_longUsage( CmdLineInterface& _cmd, std::ostream& os ) const { std::list argList = _cmd.getArgList(); std::string message = _cmd.getMessage(); XorHandler xorHandler = _cmd.getXorHandler(); std::vector< std::vector > xorList = xorHandler.getXorList(); // first the xor for ( int i = 0; static_cast(i) < xorList.size(); i++ ) { for ( ArgVectorIterator it = xorList[i].begin(); it != xorList[i].end(); it++ ) { spacePrint( os, (*it)->longID(), 75, 3, 3 ); spacePrint( os, (*it)->getDescription(), 75, 5, 0 ); if ( it+1 != xorList[i].end() ) spacePrint(os, "-- OR --", 75, 9, 0); } os << std::endl << std::endl; } // then the rest for (ArgListIterator it = argList.begin(); it != argList.end(); it++) if ( !xorHandler.contains( (*it) ) ) { spacePrint( os, (*it)->longID(), 75, 3, 3 ); spacePrint( os, (*it)->getDescription(), 75, 5, 0 ); os << std::endl; } os << std::endl; spacePrint( os, message, 75, 3, 0 ); } inline void StdOutput::spacePrint( std::ostream& os, const std::string& s, int maxWidth, int indentSpaces, int secondLineOffset ) const { int len = static_cast(s.length()); if ( (len + indentSpaces > maxWidth) && maxWidth > 0 ) { int allowedLen = maxWidth - indentSpaces; int start = 0; while ( start < len ) { // find the substring length // int stringLen = std::min( len - start, allowedLen ); // doing it this way to support a VisualC++ 2005 bug using namespace std; int stringLen = min( len - start, allowedLen ); // trim the length so it doesn't end in middle of a word if ( stringLen == allowedLen ) while ( stringLen >= 0 && s[stringLen+start] != ' ' && s[stringLen+start] != ',' && s[stringLen+start] != '|' ) stringLen--; // ok, the word is longer than the line, so just split // wherever the line ends if ( stringLen <= 0 ) stringLen = allowedLen; // check for newlines for ( int i = 0; i < stringLen; i++ ) if ( s[start+i] == '\n' ) stringLen = i+1; // print the indent for ( int i = 0; i < indentSpaces; i++ ) os << " "; if ( start == 0 ) { // handle second line offsets indentSpaces += secondLineOffset; // adjust allowed len allowedLen -= secondLineOffset; } os << s.substr(start,stringLen) << std::endl; // so we don't start a line with a space while ( s[stringLen+start] == ' ' && start < len ) start++; start += stringLen; } } else { for ( int i = 0; i < indentSpaces; i++ ) os << " "; os << s << std::endl; } } } //namespace TCLAP #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/MultiArg.h0000644000175000017500000002675412320456500022317 0ustar mathieumathieu/****************************************************************************** * * file: MultiArg.h * * Copyright (c) 2003, Michael E. Smoot . * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ #ifndef TCLAP_MULTIPLE_ARGUMENT_H #define TCLAP_MULTIPLE_ARGUMENT_H #include #include #include #include namespace TCLAP { /** * An argument that allows multiple values of type T to be specified. Very * similar to a ValueArg, except a vector of values will be returned * instead of just one. */ template class MultiArg : public Arg { public: typedef std::vector container_type; typedef typename container_type::iterator iterator; typedef typename container_type::const_iterator const_iterator; protected: /** * The list of values parsed from the CmdLine. */ std::vector _values; /** * The description of type T to be used in the usage. */ std::string _typeDesc; /** * A list of constraint on this Arg. */ Constraint* _constraint; /** * Extracts the value from the string. * Attempts to parse string as type T, if this fails an exception * is thrown. * \param val - The string to be read. */ void _extractValue( const std::string& val ); /** * Used by XorHandler to decide whether to keep parsing for this arg. */ bool _allowMore; public: /** * Constructor. * \param flag - The one character flag that identifies this * argument on the command line. * \param name - A one word name for the argument. Can be * used as a long flag on the command line. * \param desc - A description of what the argument is for or * does. * \param req - Whether the argument is required on the command * line. * \param typeDesc - A short, human readable description of the * type that this object expects. This is used in the generation * of the USAGE statement. The goal is to be helpful to the end user * of the program. * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ MultiArg( const std::string& flag, const std::string& name, const std::string& desc, bool req, const std::string& typeDesc, Visitor* v = NULL); /** * Constructor. * \param flag - The one character flag that identifies this * argument on the command line. * \param name - A one word name for the argument. Can be * used as a long flag on the command line. * \param desc - A description of what the argument is for or * does. * \param req - Whether the argument is required on the command * line. * \param typeDesc - A short, human readable description of the * type that this object expects. This is used in the generation * of the USAGE statement. The goal is to be helpful to the end user * of the program. * \param parser - A CmdLine parser object to add this Arg to * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ MultiArg( const std::string& flag, const std::string& name, const std::string& desc, bool req, const std::string& typeDesc, CmdLineInterface& parser, Visitor* v = NULL ); /** * Constructor. * \param flag - The one character flag that identifies this * argument on the command line. * \param name - A one word name for the argument. Can be * used as a long flag on the command line. * \param desc - A description of what the argument is for or * does. * \param req - Whether the argument is required on the command * line. * \param constraint - A pointer to a Constraint object used * to constrain this Arg. * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ MultiArg( const std::string& flag, const std::string& name, const std::string& desc, bool req, Constraint* constraint, Visitor* v = NULL ); /** * Constructor. * \param flag - The one character flag that identifies this * argument on the command line. * \param name - A one word name for the argument. Can be * used as a long flag on the command line. * \param desc - A description of what the argument is for or * does. * \param req - Whether the argument is required on the command * line. * \param constraint - A pointer to a Constraint object used * to constrain this Arg. * \param parser - A CmdLine parser object to add this Arg to * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ MultiArg( const std::string& flag, const std::string& name, const std::string& desc, bool req, Constraint* constraint, CmdLineInterface& parser, Visitor* v = NULL ); /** * Handles the processing of the argument. * This re-implements the Arg version of this method to set the * _value of the argument appropriately. It knows the difference * between labeled and unlabeled. * \param i - Pointer the the current argument in the list. * \param args - Mutable list of strings. Passed from main(). */ virtual bool processArg(int* i, std::vector& args); /** * Returns a vector of type T containing the values parsed from * the command line. */ const std::vector& getValue(); /** * Returns an iterator over the values parsed from the command * line. */ const_iterator begin() const { return _values.begin(); } /** * Returns the end of the values parsed from the command * line. */ const_iterator end() const { return _values.end(); } /** * Returns the a short id string. Used in the usage. * \param val - value to be used. */ virtual std::string shortID(const std::string& val="val") const; /** * Returns the a long id string. Used in the usage. * \param val - value to be used. */ virtual std::string longID(const std::string& val="val") const; /** * Once we've matched the first value, then the arg is no longer * required. */ virtual bool isRequired() const; virtual bool allowMore(); virtual void reset(); }; template MultiArg::MultiArg(const std::string& flag, const std::string& name, const std::string& desc, bool req, const std::string& typeDesc, Visitor* v) : Arg( flag, name, desc, req, true, v ), _typeDesc( typeDesc ), _constraint( NULL ), _allowMore(false) { _acceptsMultipleValues = true; } template MultiArg::MultiArg(const std::string& flag, const std::string& name, const std::string& desc, bool req, const std::string& typeDesc, CmdLineInterface& parser, Visitor* v) : Arg( flag, name, desc, req, true, v ), _typeDesc( typeDesc ), _constraint( NULL ), _allowMore(false) { parser.add( this ); _acceptsMultipleValues = true; } /** * */ template MultiArg::MultiArg(const std::string& flag, const std::string& name, const std::string& desc, bool req, Constraint* constraint, Visitor* v) : Arg( flag, name, desc, req, true, v ), _typeDesc( constraint->shortID() ), _constraint( constraint ), _allowMore(false) { _acceptsMultipleValues = true; } template MultiArg::MultiArg(const std::string& flag, const std::string& name, const std::string& desc, bool req, Constraint* constraint, CmdLineInterface& parser, Visitor* v) : Arg( flag, name, desc, req, true, v ), _typeDesc( constraint->shortID() ), _constraint( constraint ), _allowMore(false) { parser.add( this ); _acceptsMultipleValues = true; } template const std::vector& MultiArg::getValue() { return _values; } template bool MultiArg::processArg(int *i, std::vector& args) { if ( _ignoreable && Arg::ignoreRest() ) return false; if ( _hasBlanks( args[*i] ) ) return false; std::string flag = args[*i]; std::string value = ""; trimFlag( flag, value ); if ( argMatches( flag ) ) { if ( Arg::delimiter() != ' ' && value == "" ) throw( ArgParseException( "Couldn't find delimiter for this argument!", toString() ) ); // always take the first one, regardless of start string if ( value == "" ) { (*i)++; if ( static_cast(*i) < args.size() ) _extractValue( args[*i] ); else throw( ArgParseException("Missing a value for this argument!", toString() ) ); } else _extractValue( value ); /* // continuing taking the args until we hit one with a start string while ( (unsigned int)(*i)+1 < args.size() && args[(*i)+1].find_first_of( Arg::flagStartString() ) != 0 && args[(*i)+1].find_first_of( Arg::nameStartString() ) != 0 ) _extractValue( args[++(*i)] ); */ _alreadySet = true; _checkWithVisitor(); return true; } else return false; } /** * */ template std::string MultiArg::shortID(const std::string& val) const { static_cast(val); // Ignore input, don't warn return Arg::shortID(_typeDesc) + " ... "; } /** * */ template std::string MultiArg::longID(const std::string& val) const { static_cast(val); // Ignore input, don't warn return Arg::longID(_typeDesc) + " (accepted multiple times)"; } /** * Once we've matched the first value, then the arg is no longer * required. */ template bool MultiArg::isRequired() const { if ( _required ) { if ( _values.size() > 1 ) return false; else return true; } else return false; } template void MultiArg::_extractValue( const std::string& val ) { try { T tmp; ExtractValue(tmp, val, typename ArgTraits::ValueCategory()); _values.push_back(tmp); } catch( ArgParseException &e) { throw ArgParseException(e.error(), toString()); } if ( _constraint != NULL ) if ( ! _constraint->check( _values.back() ) ) throw( CmdLineParseException( "Value '" + val + "' does not meet constraint: " + _constraint->description(), toString() ) ); } template bool MultiArg::allowMore() { bool am = _allowMore; _allowMore = true; return am; } template void MultiArg::reset() { Arg::reset(); _values.clear(); } } // namespace TCLAP #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/UnlabeledValueArg.h0000644000175000017500000002626512320456500024112 0ustar mathieumathieu /****************************************************************************** * * file: UnlabeledValueArg.h * * Copyright (c) 2003, Michael E. Smoot . * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ #ifndef TCLAP_UNLABELED_VALUE_ARGUMENT_H #define TCLAP_UNLABELED_VALUE_ARGUMENT_H #include #include #include #include namespace TCLAP { /** * The basic unlabeled argument that parses a value. * This is a template class, which means the type T defines the type * that a given object will attempt to parse when an UnlabeledValueArg * is reached in the list of args that the CmdLine iterates over. */ template class UnlabeledValueArg : public ValueArg { // If compiler has two stage name lookup (as gcc >= 3.4 does) // this is requried to prevent undef. symbols using ValueArg::_ignoreable; using ValueArg::_hasBlanks; using ValueArg::_extractValue; using ValueArg::_typeDesc; using ValueArg::_name; using ValueArg::_description; using ValueArg::_alreadySet; using ValueArg::toString; public: /** * UnlabeledValueArg constructor. * \param name - A one word name for the argument. Note that this is used for * identification, not as a long flag. * \param desc - A description of what the argument is for or * does. * \param req - Whether the argument is required on the command * line. * \param value - The default value assigned to this argument if it * is not present on the command line. * \param typeDesc - A short, human readable description of the * type that this object expects. This is used in the generation * of the USAGE statement. The goal is to be helpful to the end user * of the program. * \param ignoreable - Allows you to specify that this argument can be * ignored if the '--' flag is set. This defaults to false (cannot * be ignored) and should generally stay that way unless you have * some special need for certain arguments to be ignored. * \param v - Optional Vistor. You should leave this blank unless * you have a very good reason. */ UnlabeledValueArg( const std::string& name, const std::string& desc, bool req, T value, const std::string& typeDesc, bool ignoreable = false, Visitor* v = NULL); /** * UnlabeledValueArg constructor. * \param name - A one word name for the argument. Note that this is used for * identification, not as a long flag. * \param desc - A description of what the argument is for or * does. * \param req - Whether the argument is required on the command * line. * \param value - The default value assigned to this argument if it * is not present on the command line. * \param typeDesc - A short, human readable description of the * type that this object expects. This is used in the generation * of the USAGE statement. The goal is to be helpful to the end user * of the program. * \param parser - A CmdLine parser object to add this Arg to * \param ignoreable - Allows you to specify that this argument can be * ignored if the '--' flag is set. This defaults to false (cannot * be ignored) and should generally stay that way unless you have * some special need for certain arguments to be ignored. * \param v - Optional Vistor. You should leave this blank unless * you have a very good reason. */ UnlabeledValueArg( const std::string& name, const std::string& desc, bool req, T value, const std::string& typeDesc, CmdLineInterface& parser, bool ignoreable = false, Visitor* v = NULL ); /** * UnlabeledValueArg constructor. * \param name - A one word name for the argument. Note that this is used for * identification, not as a long flag. * \param desc - A description of what the argument is for or * does. * \param req - Whether the argument is required on the command * line. * \param value - The default value assigned to this argument if it * is not present on the command line. * \param constraint - A pointer to a Constraint object used * to constrain this Arg. * \param ignoreable - Allows you to specify that this argument can be * ignored if the '--' flag is set. This defaults to false (cannot * be ignored) and should generally stay that way unless you have * some special need for certain arguments to be ignored. * \param v - Optional Vistor. You should leave this blank unless * you have a very good reason. */ UnlabeledValueArg( const std::string& name, const std::string& desc, bool req, T value, Constraint* constraint, bool ignoreable = false, Visitor* v = NULL ); /** * UnlabeledValueArg constructor. * \param name - A one word name for the argument. Note that this is used for * identification, not as a long flag. * \param desc - A description of what the argument is for or * does. * \param req - Whether the argument is required on the command * line. * \param value - The default value assigned to this argument if it * is not present on the command line. * \param constraint - A pointer to a Constraint object used * to constrain this Arg. * \param parser - A CmdLine parser object to add this Arg to * \param ignoreable - Allows you to specify that this argument can be * ignored if the '--' flag is set. This defaults to false (cannot * be ignored) and should generally stay that way unless you have * some special need for certain arguments to be ignored. * \param v - Optional Vistor. You should leave this blank unless * you have a very good reason. */ UnlabeledValueArg( const std::string& name, const std::string& desc, bool req, T value, Constraint* constraint, CmdLineInterface& parser, bool ignoreable = false, Visitor* v = NULL); /** * Handles the processing of the argument. * This re-implements the Arg version of this method to set the * _value of the argument appropriately. Handling specific to * unlabled arguments. * \param i - Pointer the the current argument in the list. * \param args - Mutable list of strings. */ virtual bool processArg(int* i, std::vector& args); /** * Overrides shortID for specific behavior. */ virtual std::string shortID(const std::string& val="val") const; /** * Overrides longID for specific behavior. */ virtual std::string longID(const std::string& val="val") const; /** * Overrides operator== for specific behavior. */ virtual bool operator==(const Arg& a ) const; /** * Instead of pushing to the front of list, push to the back. * \param argList - The list to add this to. */ virtual void addToList( std::list& argList ) const; }; /** * Constructor implemenation. */ template UnlabeledValueArg::UnlabeledValueArg(const std::string& name, const std::string& desc, bool req, T val, const std::string& typeDesc, bool ignoreable, Visitor* v) : ValueArg("", name, desc, req, val, typeDesc, v) { _ignoreable = ignoreable; OptionalUnlabeledTracker::check(req, toString()); } template UnlabeledValueArg::UnlabeledValueArg(const std::string& name, const std::string& desc, bool req, T val, const std::string& typeDesc, CmdLineInterface& parser, bool ignoreable, Visitor* v) : ValueArg("", name, desc, req, val, typeDesc, v) { _ignoreable = ignoreable; OptionalUnlabeledTracker::check(req, toString()); parser.add( this ); } /** * Constructor implemenation. */ template UnlabeledValueArg::UnlabeledValueArg(const std::string& name, const std::string& desc, bool req, T val, Constraint* constraint, bool ignoreable, Visitor* v) : ValueArg("", name, desc, req, val, constraint, v) { _ignoreable = ignoreable; OptionalUnlabeledTracker::check(req, toString()); } template UnlabeledValueArg::UnlabeledValueArg(const std::string& name, const std::string& desc, bool req, T val, Constraint* constraint, CmdLineInterface& parser, bool ignoreable, Visitor* v) : ValueArg("", name, desc, req, val, constraint, v) { _ignoreable = ignoreable; OptionalUnlabeledTracker::check(req, toString()); parser.add( this ); } /** * Implementation of processArg(). */ template bool UnlabeledValueArg::processArg(int *i, std::vector& args) { if ( _alreadySet ) return false; if ( _hasBlanks( args[*i] ) ) return false; // never ignore an unlabeled arg _extractValue( args[*i] ); _alreadySet = true; return true; } /** * Overriding shortID for specific output. */ template std::string UnlabeledValueArg::shortID(const std::string& val) const { static_cast(val); // Ignore input, don't warn return std::string("<") + _typeDesc + ">"; } /** * Overriding longID for specific output. */ template std::string UnlabeledValueArg::longID(const std::string& val) const { static_cast(val); // Ignore input, don't warn // Ideally we would like to be able to use RTTI to return the name // of the type required for this argument. However, g++ at least, // doesn't appear to return terribly useful "names" of the types. return std::string("<") + _typeDesc + ">"; } /** * Overriding operator== for specific behavior. */ template bool UnlabeledValueArg::operator==(const Arg& a ) const { if ( _name == a.getName() || _description == a.getDescription() ) return true; else return false; } template void UnlabeledValueArg::addToList( std::list& argList ) const { argList.push_back( const_cast(static_cast(this)) ); } } #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/StandardTraits.h0000644000175000017500000001016512320456500023507 0ustar mathieumathieu// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- /****************************************************************************** * * file: StandardTraits.h * * Copyright (c) 2007, Daniel Aarno, Michael E. Smoot . * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ // This is an internal tclap file, you should probably not have to // include this directly #ifndef TCLAP_STANDARD_TRAITS_H #define TCLAP_STANDARD_TRAITS_H #ifdef HAVE_CONFIG_H #include // To check for long long #endif namespace TCLAP { // ====================================================================== // Integer types // ====================================================================== /** * longs have value-like semantics. */ template<> struct ArgTraits { typedef ValueLike ValueCategory; }; /** * ints have value-like semantics. */ template<> struct ArgTraits { typedef ValueLike ValueCategory; }; /** * shorts have value-like semantics. */ template<> struct ArgTraits { typedef ValueLike ValueCategory; }; /** * chars have value-like semantics. */ template<> struct ArgTraits { typedef ValueLike ValueCategory; }; #ifdef HAVE_LONG_LONG /** * long longs have value-like semantics. */ template<> struct ArgTraits { typedef ValueLike ValueCategory; }; #endif // ====================================================================== // Unsigned integer types // ====================================================================== /** * unsigned longs have value-like semantics. */ template<> struct ArgTraits { typedef ValueLike ValueCategory; }; /** * unsigned ints have value-like semantics. */ template<> struct ArgTraits { typedef ValueLike ValueCategory; }; /** * unsigned shorts have value-like semantics. */ template<> struct ArgTraits { typedef ValueLike ValueCategory; }; /** * unsigned chars have value-like semantics. */ template<> struct ArgTraits { typedef ValueLike ValueCategory; }; /** Microsoft implements size_t awkwardly. */ #if defined(_MSC_VER) && defined(_M_X64) /** * size_ts have value-like semantics. */ template<> struct ArgTraits { typedef ValueLike ValueCategory; }; #endif #ifdef HAVE_LONG_LONG /** * unsigned long longs have value-like semantics. */ template<> struct ArgTraits { typedef ValueLike ValueCategory; }; #endif // ====================================================================== // Float types // ====================================================================== /** * floats have value-like semantics. */ template<> struct ArgTraits { typedef ValueLike ValueCategory; }; /** * doubles have value-like semantics. */ template<> struct ArgTraits { typedef ValueLike ValueCategory; }; // ====================================================================== // Other types // ====================================================================== /** * bools have value-like semantics. */ template<> struct ArgTraits { typedef ValueLike ValueCategory; }; #ifndef _MSC_VER /** * wchar_ts have value-like semantics. */ template<> struct ArgTraits { typedef ValueLike ValueCategory; }; #endif /** * Strings have string like argument traits. */ template<> struct ArgTraits { typedef StringLike ValueCategory; }; template void SetString(T &dst, const std::string &src) { dst = src; } } // namespace #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/Arg.h0000644000175000017500000004074612320456500021301 0ustar mathieumathieu// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- /****************************************************************************** * * file: Arg.h * * Copyright (c) 2003, Michael E. Smoot . * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno . * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ #ifndef TCLAP_ARGUMENT_H #define TCLAP_ARGUMENT_H #ifdef HAVE_CONFIG_H #include #else #define HAVE_SSTREAM #endif #include #include #include #include #include #include #if defined(HAVE_SSTREAM) #include typedef std::istringstream istringstream; #elif defined(HAVE_STRSTREAM) #include typedef std::istrstream istringstream; #else #error "Need a stringstream (sstream or strstream) to compile!" #endif #include #include #include #include #include namespace TCLAP { /** * A virtual base class that defines the essential data for all arguments. * This class, or one of its existing children, must be subclassed to do * anything. */ class Arg { private: /** * Indicates whether the rest of the arguments should be ignored. */ static bool& ignoreRestRef() { static bool ign = false; return ign; } /** * The delimiter that separates an argument flag/name from the * value. */ static char& delimiterRef() { static char delim = ' '; return delim; } protected: /** * The single char flag used to identify the argument. * This value (preceded by a dash {-}), can be used to identify * an argument on the command line. The _flag can be blank, * in fact this is how unlabeled args work. Unlabeled args must * override appropriate functions to get correct handling. Note * that the _flag does NOT include the dash as part of the flag. */ std::string _flag; /** * A single work namd indentifying the argument. * This value (preceded by two dashed {--}) can also be used * to identify an argument on the command line. Note that the * _name does NOT include the two dashes as part of the _name. The * _name cannot be blank. */ std::string _name; /** * Description of the argument. */ std::string _description; /** * Indicating whether the argument is required. */ bool _required; /** * Label to be used in usage description. Normally set to * "required", but can be changed when necessary. */ std::string _requireLabel; /** * Indicates whether a value is required for the argument. * Note that the value may be required but the argument/value * combination may not be, as specified by _required. */ bool _valueRequired; /** * Indicates whether the argument has been set. * Indicates that a value on the command line has matched the * name/flag of this argument and the values have been set accordingly. */ bool _alreadySet; /** * A pointer to a vistitor object. * The visitor allows special handling to occur as soon as the * argument is matched. This defaults to NULL and should not * be used unless absolutely necessary. */ Visitor* _visitor; /** * Whether this argument can be ignored, if desired. */ bool _ignoreable; /** * Indicates that the arg was set as part of an XOR and not on the * command line. */ bool _xorSet; bool _acceptsMultipleValues; /** * Performs the special handling described by the Vistitor. */ void _checkWithVisitor() const; /** * Primary constructor. YOU (yes you) should NEVER construct an Arg * directly, this is a base class that is extended by various children * that are meant to be used. Use SwitchArg, ValueArg, MultiArg, * UnlabeledValueArg, or UnlabeledMultiArg instead. * * \param flag - The flag identifying the argument. * \param name - The name identifying the argument. * \param desc - The description of the argument, used in the usage. * \param req - Whether the argument is required. * \param valreq - Whether the a value is required for the argument. * \param v - The visitor checked by the argument. Defaults to NULL. */ Arg( const std::string& flag, const std::string& name, const std::string& desc, bool req, bool valreq, Visitor* v = NULL ); public: /** * Destructor. */ virtual ~Arg(); /** * Adds this to the specified list of Args. * \param argList - The list to add this to. */ virtual void addToList( std::list& argList ) const; /** * Begin ignoring arguments since the "--" argument was specified. */ static void beginIgnoring() { ignoreRestRef() = true; } /** * Whether to ignore the rest. */ static bool ignoreRest() { return ignoreRestRef(); } /** * The delimiter that separates an argument flag/name from the * value. */ static char delimiter() { return delimiterRef(); } /** * The char used as a place holder when SwitchArgs are combined. * Currently set to the bell char (ASCII 7). */ static char blankChar() { return (char)7; } /** * The char that indicates the beginning of a flag. Currently '-'. */ static char flagStartChar() { return '-'; } /** * The sting that indicates the beginning of a flag. Currently "-". * Should be identical to flagStartChar. */ static const std::string flagStartString() { return "-"; } /** * The sting that indicates the beginning of a name. Currently "--". * Should be flagStartChar twice. */ static const std::string nameStartString() { return "--"; } /** * The name used to identify the ignore rest argument. */ static const std::string ignoreNameString() { return "ignore_rest"; } /** * Sets the delimiter for all arguments. * \param c - The character that delimits flags/names from values. */ static void setDelimiter( char c ) { delimiterRef() = c; } /** * Pure virtual method meant to handle the parsing and value assignment * of the string on the command line. * \param i - Pointer the the current argument in the list. * \param args - Mutable list of strings. What is * passed in from main. */ virtual bool processArg(int *i, std::vector& args) = 0; /** * Operator ==. * Equality operator. Must be virtual to handle unlabeled args. * \param a - The Arg to be compared to this. */ virtual bool operator==(const Arg& a) const; /** * Returns the argument flag. */ const std::string& getFlag() const; /** * Returns the argument name. */ const std::string& getName() const; /** * Returns the argument description. */ std::string getDescription() const; /** * Indicates whether the argument is required. */ virtual bool isRequired() const; /** * Sets _required to true. This is used by the XorHandler. * You really have no reason to ever use it. */ void forceRequired(); /** * Sets the _alreadySet value to true. This is used by the XorHandler. * You really have no reason to ever use it. */ void xorSet(); /** * Indicates whether a value must be specified for argument. */ bool isValueRequired() const; /** * Indicates whether the argument has already been set. Only true * if the arg has been matched on the command line. */ bool isSet() const; /** * Indicates whether the argument can be ignored, if desired. */ bool isIgnoreable() const; /** * A method that tests whether a string matches this argument. * This is generally called by the processArg() method. This * method could be re-implemented by a child to change how * arguments are specified on the command line. * \param s - The string to be compared to the flag/name to determine * whether the arg matches. */ virtual bool argMatches( const std::string& s ) const; /** * Returns a simple string representation of the argument. * Primarily for debugging. */ virtual std::string toString() const; /** * Returns a short ID for the usage. * \param valueId - The value used in the id. */ virtual std::string shortID( const std::string& valueId = "val" ) const; /** * Returns a long ID for the usage. * \param valueId - The value used in the id. */ virtual std::string longID( const std::string& valueId = "val" ) const; /** * Trims a value off of the flag. * \param flag - The string from which the flag and value will be * trimmed. Contains the flag once the value has been trimmed. * \param value - Where the value trimmed from the string will * be stored. */ virtual void trimFlag( std::string& flag, std::string& value ) const; /** * Checks whether a given string has blank chars, indicating that * it is a combined SwitchArg. If so, return true, otherwise return * false. * \param s - string to be checked. */ bool _hasBlanks( const std::string& s ) const; /** * Sets the requireLabel. Used by XorHandler. You shouldn't ever * use this. * \param s - Set the requireLabel to this value. */ void setRequireLabel( const std::string& s ); /** * Used for MultiArgs and XorHandler to determine whether args * can still be set. */ virtual bool allowMore(); /** * Use by output classes to determine whether an Arg accepts * multiple values. */ virtual bool acceptsMultipleValues(); /** * Clears the Arg object and allows it to be reused by new * command lines. */ virtual void reset(); }; /** * Typedef of an Arg list iterator. */ typedef std::list::iterator ArgListIterator; /** * Typedef of an Arg vector iterator. */ typedef std::vector::iterator ArgVectorIterator; /** * Typedef of a Visitor list iterator. */ typedef std::list::iterator VisitorListIterator; /* * Extract a value of type T from it's string representation contained * in strVal. The ValueLike parameter used to select the correct * specialization of ExtractValue depending on the value traits of T. * ValueLike traits use operator>> to assign the value from strVal. */ template void ExtractValue(T &destVal, const std::string& strVal, ValueLike vl) { static_cast(vl); // Avoid warning about unused vl std::istringstream is(strVal); int valuesRead = 0; while ( is.good() ) { if ( is.peek() != EOF ) #ifdef TCLAP_SETBASE_ZERO is >> std::setbase(0) >> destVal; #else is >> destVal; #endif else break; valuesRead++; } if ( is.fail() ) throw( ArgParseException("Couldn't read argument value " "from string '" + strVal + "'")); if ( valuesRead > 1 ) throw( ArgParseException("More than one valid value parsed from " "string '" + strVal + "'")); } /* * Extract a value of type T from it's string representation contained * in strVal. The ValueLike parameter used to select the correct * specialization of ExtractValue depending on the value traits of T. * StringLike uses assignment (operator=) to assign from strVal. */ template void ExtractValue(T &destVal, const std::string& strVal, StringLike sl) { static_cast(sl); // Avoid warning about unused sl SetString(destVal, strVal); } ////////////////////////////////////////////////////////////////////// //BEGIN Arg.cpp ////////////////////////////////////////////////////////////////////// inline Arg::Arg(const std::string& flag, const std::string& name, const std::string& desc, bool req, bool valreq, Visitor* v) : _flag(flag), _name(name), _description(desc), _required(req), _requireLabel("required"), _valueRequired(valreq), _alreadySet(false), _visitor( v ), _ignoreable(true), _xorSet(false), _acceptsMultipleValues(false) { if ( _flag.length() > 1 ) throw(SpecificationException( "Argument flag can only be one character long", toString() ) ); if ( _name != ignoreNameString() && ( _flag == Arg::flagStartString() || _flag == Arg::nameStartString() || _flag == " " ) ) throw(SpecificationException("Argument flag cannot be either '" + Arg::flagStartString() + "' or '" + Arg::nameStartString() + "' or a space.", toString() ) ); if ( ( _name.substr( 0, Arg::flagStartString().length() ) == Arg::flagStartString() ) || ( _name.substr( 0, Arg::nameStartString().length() ) == Arg::nameStartString() ) || ( _name.find( " ", 0 ) != std::string::npos ) ) throw(SpecificationException("Argument name begin with either '" + Arg::flagStartString() + "' or '" + Arg::nameStartString() + "' or space.", toString() ) ); } inline Arg::~Arg() { } inline std::string Arg::shortID( const std::string& valueId ) const { std::string id = ""; if ( _flag != "" ) id = Arg::flagStartString() + _flag; else id = Arg::nameStartString() + _name; if ( _valueRequired ) id += std::string( 1, Arg::delimiter() ) + "<" + valueId + ">"; if ( !_required ) id = "[" + id + "]"; return id; } inline std::string Arg::longID( const std::string& valueId ) const { std::string id = ""; if ( _flag != "" ) { id += Arg::flagStartString() + _flag; if ( _valueRequired ) id += std::string( 1, Arg::delimiter() ) + "<" + valueId + ">"; id += ", "; } id += Arg::nameStartString() + _name; if ( _valueRequired ) id += std::string( 1, Arg::delimiter() ) + "<" + valueId + ">"; return id; } inline bool Arg::operator==(const Arg& a) const { if ( ( _flag != "" && _flag == a._flag ) || _name == a._name) return true; else return false; } inline std::string Arg::getDescription() const { std::string desc = ""; if ( _required ) desc = "(" + _requireLabel + ") "; // if ( _valueRequired ) // desc += "(value required) "; desc += _description; return desc; } inline const std::string& Arg::getFlag() const { return _flag; } inline const std::string& Arg::getName() const { return _name; } inline bool Arg::isRequired() const { return _required; } inline bool Arg::isValueRequired() const { return _valueRequired; } inline bool Arg::isSet() const { if ( _alreadySet && !_xorSet ) return true; else return false; } inline bool Arg::isIgnoreable() const { return _ignoreable; } inline void Arg::setRequireLabel( const std::string& s) { _requireLabel = s; } inline bool Arg::argMatches( const std::string& argFlag ) const { if ( ( argFlag == Arg::flagStartString() + _flag && _flag != "" ) || argFlag == Arg::nameStartString() + _name ) return true; else return false; } inline std::string Arg::toString() const { std::string s = ""; if ( _flag != "" ) s += Arg::flagStartString() + _flag + " "; s += "(" + Arg::nameStartString() + _name + ")"; return s; } inline void Arg::_checkWithVisitor() const { if ( _visitor != NULL ) _visitor->visit(); } /** * Implementation of trimFlag. */ inline void Arg::trimFlag(std::string& flag, std::string& value) const { int stop = 0; for ( int i = 0; static_cast(i) < flag.length(); i++ ) if ( flag[i] == Arg::delimiter() ) { stop = i; break; } if ( stop > 1 ) { value = flag.substr(stop+1); flag = flag.substr(0,stop); } } /** * Implementation of _hasBlanks. */ inline bool Arg::_hasBlanks( const std::string& s ) const { for ( int i = 1; static_cast(i) < s.length(); i++ ) if ( s[i] == Arg::blankChar() ) return true; return false; } inline void Arg::forceRequired() { _required = true; } inline void Arg::xorSet() { _alreadySet = true; _xorSet = true; } /** * Overridden by Args that need to added to the end of the list. */ inline void Arg::addToList( std::list& argList ) const { argList.push_front( const_cast(this) ); } inline bool Arg::allowMore() { return false; } inline bool Arg::acceptsMultipleValues() { return _acceptsMultipleValues; } inline void Arg::reset() { _xorSet = false; _alreadySet = false; } ////////////////////////////////////////////////////////////////////// //END Arg.cpp ////////////////////////////////////////////////////////////////////// } //namespace TCLAP #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/ArgTraits.h0000644000175000017500000000467312320456500022467 0ustar mathieumathieu// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- /****************************************************************************** * * file: ArgTraits.h * * Copyright (c) 2007, Daniel Aarno, Michael E. Smoot . * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ // This is an internal tclap file, you should probably not have to // include this directly #ifndef TCLAP_ARGTRAITS_H #define TCLAP_ARGTRAITS_H namespace TCLAP { // We use two empty structs to get compile type specialization // function to work /** * A value like argument value type is a value that can be set using * operator>>. This is the default value type. */ struct ValueLike { typedef ValueLike ValueCategory; }; /** * A string like argument value type is a value that can be set using * operator=(string). Usefull if the value type contains spaces which * will be broken up into individual tokens by operator>>. */ struct StringLike {}; /** * A class can inherit from this object to make it have string like * traits. This is a compile time thing and does not add any overhead * to the inherenting class. */ struct StringLikeTrait { typedef StringLike ValueCategory; }; /** * A class can inherit from this object to make it have value like * traits. This is a compile time thing and does not add any overhead * to the inherenting class. */ struct ValueLikeTrait { typedef ValueLike ValueCategory; }; /** * Arg traits are used to get compile type specialization when parsing * argument values. Using an ArgTraits you can specify the way that * values gets assigned to any particular type during parsing. The two * supported types are string like and value like. */ template struct ArgTraits { typedef typename T::ValueCategory ValueCategory; //typedef ValueLike ValueCategory; }; #endif } // namespace ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/Constraint.h0000644000175000017500000000341012320456500022677 0ustar mathieumathieu /****************************************************************************** * * file: Constraint.h * * Copyright (c) 2005, Michael E. Smoot * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ #ifndef TCLAP_CONSTRAINT_H #define TCLAP_CONSTRAINT_H #include #include #include #include #include #include namespace TCLAP { /** * The interface that defines the interaction between the Arg and Constraint. */ template class Constraint { public: /** * Returns a description of the Constraint. */ virtual std::string description() const =0; /** * Returns the short ID for the Constraint. */ virtual std::string shortID() const =0; /** * The method used to verify that the value parsed from the command * line meets the constraint. * \param value - The value that will be checked. */ virtual bool check(const T& value) const =0; /** * Destructor. * Silences warnings about Constraint being a base class with virtual * functions but without a virtual destructor. */ virtual ~Constraint() { ; } }; } //namespace TCLAP #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/OptionalUnlabeledTracker.h0000644000175000017500000000327112320456500025475 0ustar mathieumathieu /****************************************************************************** * * file: OptionalUnlabeledTracker.h * * Copyright (c) 2005, Michael E. Smoot . * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ #ifndef TCLAP_OPTIONAL_UNLABELED_TRACKER_H #define TCLAP_OPTIONAL_UNLABELED_TRACKER_H #include namespace TCLAP { class OptionalUnlabeledTracker { public: static void check( bool req, const std::string& argName ); static void gotOptional() { alreadyOptionalRef() = true; } static bool& alreadyOptional() { return alreadyOptionalRef(); } private: static bool& alreadyOptionalRef() { static bool ct = false; return ct; } }; inline void OptionalUnlabeledTracker::check( bool req, const std::string& argName ) { if ( OptionalUnlabeledTracker::alreadyOptional() ) throw( SpecificationException( "You can't specify ANY Unlabeled Arg following an optional Unlabeled Arg", argName ) ); if ( !req ) OptionalUnlabeledTracker::gotOptional(); } } // namespace TCLAP #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/VersionVisitor.h0000644000175000017500000000351712320456500023570 0ustar mathieumathieu// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- /****************************************************************************** * * file: VersionVisitor.h * * Copyright (c) 2003, Michael E. Smoot . * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ #ifndef TCLAP_VERSION_VISITOR_H #define TCLAP_VERSION_VISITOR_H #include #include #include namespace TCLAP { /** * A Vistor that will call the version method of the given CmdLineOutput * for the specified CmdLine object and then exit. */ class VersionVisitor: public Visitor { protected: /** * The CmdLine of interest. */ CmdLineInterface* _cmd; /** * The output object. */ CmdLineOutput** _out; public: /** * Constructor. * \param cmd - The CmdLine the output is generated for. * \param out - The type of output. */ VersionVisitor( CmdLineInterface* cmd, CmdLineOutput** out ) : Visitor(), _cmd( cmd ), _out( out ) { } /** * Calls the version method of the output object using the * specified CmdLine. */ void visit() { (*_out)->version(*_cmd); throw ExitException(0); } }; } #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/MultiSwitchArg.h0000644000175000017500000001277312320456500023475 0ustar mathieumathieu /****************************************************************************** * * file: MultiSwitchArg.h * * Copyright (c) 2003, Michael E. Smoot . * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. * Copyright (c) 2005, Michael E. Smoot, Daniel Aarno, Erik Zeek. * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ #ifndef TCLAP_MULTI_SWITCH_ARG_H #define TCLAP_MULTI_SWITCH_ARG_H #include #include #include namespace TCLAP { /** * A multiple switch argument. If the switch is set on the command line, then * the getValue method will return the number of times the switch appears. */ class MultiSwitchArg : public SwitchArg { protected: /** * The value of the switch. */ int _value; /** * Used to support the reset() method so that ValueArg can be * reset to their constructed value. */ int _default; public: /** * MultiSwitchArg constructor. * \param flag - The one character flag that identifies this * argument on the command line. * \param name - A one word name for the argument. Can be * used as a long flag on the command line. * \param desc - A description of what the argument is for or * does. * \param init - Optional. The initial/default value of this Arg. * Defaults to 0. * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ MultiSwitchArg(const std::string& flag, const std::string& name, const std::string& desc, int init = 0, Visitor* v = NULL); /** * MultiSwitchArg constructor. * \param flag - The one character flag that identifies this * argument on the command line. * \param name - A one word name for the argument. Can be * used as a long flag on the command line. * \param desc - A description of what the argument is for or * does. * \param parser - A CmdLine parser object to add this Arg to * \param init - Optional. The initial/default value of this Arg. * Defaults to 0. * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ MultiSwitchArg(const std::string& flag, const std::string& name, const std::string& desc, CmdLineInterface& parser, int init = 0, Visitor* v = NULL); /** * Handles the processing of the argument. * This re-implements the SwitchArg version of this method to set the * _value of the argument appropriately. * \param i - Pointer the the current argument in the list. * \param args - Mutable list of strings. Passed * in from main(). */ virtual bool processArg(int* i, std::vector& args); /** * Returns int, the number of times the switch has been set. */ int getValue(); /** * Returns the shortID for this Arg. */ std::string shortID(const std::string& val) const; /** * Returns the longID for this Arg. */ std::string longID(const std::string& val) const; void reset(); }; ////////////////////////////////////////////////////////////////////// //BEGIN MultiSwitchArg.cpp ////////////////////////////////////////////////////////////////////// inline MultiSwitchArg::MultiSwitchArg(const std::string& flag, const std::string& name, const std::string& desc, int init, Visitor* v ) : SwitchArg(flag, name, desc, false, v), _value( init ), _default( init ) { } inline MultiSwitchArg::MultiSwitchArg(const std::string& flag, const std::string& name, const std::string& desc, CmdLineInterface& parser, int init, Visitor* v ) : SwitchArg(flag, name, desc, false, v), _value( init ), _default( init ) { parser.add( this ); } inline int MultiSwitchArg::getValue() { return _value; } inline bool MultiSwitchArg::processArg(int *i, std::vector& args) { if ( _ignoreable && Arg::ignoreRest() ) return false; if ( argMatches( args[*i] )) { // so the isSet() method will work _alreadySet = true; // Matched argument: increment value. ++_value; _checkWithVisitor(); return true; } else if ( combinedSwitchesMatch( args[*i] ) ) { // so the isSet() method will work _alreadySet = true; // Matched argument: increment value. ++_value; // Check for more in argument and increment value. while ( combinedSwitchesMatch( args[*i] ) ) ++_value; _checkWithVisitor(); return false; } else return false; } inline std::string MultiSwitchArg::shortID(const std::string& val) const { return Arg::shortID(val) + " ... "; } inline std::string MultiSwitchArg::longID(const std::string& val) const { return Arg::longID(val) + " (accepted multiple times)"; } inline void MultiSwitchArg::reset() { MultiSwitchArg::_value = MultiSwitchArg::_default; } ////////////////////////////////////////////////////////////////////// //END MultiSwitchArg.cpp ////////////////////////////////////////////////////////////////////// } //namespace TCLAP #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/ValueArg.h0000644000175000017500000003271612320456500022274 0ustar mathieumathieu/****************************************************************************** * * file: ValueArg.h * * Copyright (c) 2003, Michael E. Smoot . * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ #ifndef TCLAP_VALUE_ARGUMENT_H #define TCLAP_VALUE_ARGUMENT_H #include #include #include #include namespace TCLAP { /** * The basic labeled argument that parses a value. * This is a template class, which means the type T defines the type * that a given object will attempt to parse when the flag/name is matched * on the command line. While there is nothing stopping you from creating * an unflagged ValueArg, it is unwise and would cause significant problems. * Instead use an UnlabeledValueArg. */ template class ValueArg : public Arg { protected: /** * The value parsed from the command line. * Can be of any type, as long as the >> operator for the type * is defined. */ T _value; /** * Used to support the reset() method so that ValueArg can be * reset to their constructed value. */ T _default; /** * A human readable description of the type to be parsed. * This is a hack, plain and simple. Ideally we would use RTTI to * return the name of type T, but until there is some sort of * consistent support for human readable names, we are left to our * own devices. */ std::string _typeDesc; /** * A Constraint this Arg must conform to. */ Constraint* _constraint; /** * Extracts the value from the string. * Attempts to parse string as type T, if this fails an exception * is thrown. * \param val - value to be parsed. */ void _extractValue( const std::string& val ); public: /** * Labeled ValueArg constructor. * You could conceivably call this constructor with a blank flag, * but that would make you a bad person. It would also cause * an exception to be thrown. If you want an unlabeled argument, * use the other constructor. * \param flag - The one character flag that identifies this * argument on the command line. * \param name - A one word name for the argument. Can be * used as a long flag on the command line. * \param desc - A description of what the argument is for or * does. * \param req - Whether the argument is required on the command * line. * \param value - The default value assigned to this argument if it * is not present on the command line. * \param typeDesc - A short, human readable description of the * type that this object expects. This is used in the generation * of the USAGE statement. The goal is to be helpful to the end user * of the program. * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ ValueArg( const std::string& flag, const std::string& name, const std::string& desc, bool req, T value, const std::string& typeDesc, Visitor* v = NULL); /** * Labeled ValueArg constructor. * You could conceivably call this constructor with a blank flag, * but that would make you a bad person. It would also cause * an exception to be thrown. If you want an unlabeled argument, * use the other constructor. * \param flag - The one character flag that identifies this * argument on the command line. * \param name - A one word name for the argument. Can be * used as a long flag on the command line. * \param desc - A description of what the argument is for or * does. * \param req - Whether the argument is required on the command * line. * \param value - The default value assigned to this argument if it * is not present on the command line. * \param typeDesc - A short, human readable description of the * type that this object expects. This is used in the generation * of the USAGE statement. The goal is to be helpful to the end user * of the program. * \param parser - A CmdLine parser object to add this Arg to * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ ValueArg( const std::string& flag, const std::string& name, const std::string& desc, bool req, T value, const std::string& typeDesc, CmdLineInterface& parser, Visitor* v = NULL ); /** * Labeled ValueArg constructor. * You could conceivably call this constructor with a blank flag, * but that would make you a bad person. It would also cause * an exception to be thrown. If you want an unlabeled argument, * use the other constructor. * \param flag - The one character flag that identifies this * argument on the command line. * \param name - A one word name for the argument. Can be * used as a long flag on the command line. * \param desc - A description of what the argument is for or * does. * \param req - Whether the argument is required on the command * line. * \param value - The default value assigned to this argument if it * is not present on the command line. * \param constraint - A pointer to a Constraint object used * to constrain this Arg. * \param parser - A CmdLine parser object to add this Arg to. * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ ValueArg( const std::string& flag, const std::string& name, const std::string& desc, bool req, T value, Constraint* constraint, CmdLineInterface& parser, Visitor* v = NULL ); /** * Labeled ValueArg constructor. * You could conceivably call this constructor with a blank flag, * but that would make you a bad person. It would also cause * an exception to be thrown. If you want an unlabeled argument, * use the other constructor. * \param flag - The one character flag that identifies this * argument on the command line. * \param name - A one word name for the argument. Can be * used as a long flag on the command line. * \param desc - A description of what the argument is for or * does. * \param req - Whether the argument is required on the command * line. * \param value - The default value assigned to this argument if it * is not present on the command line. * \param constraint - A pointer to a Constraint object used * to constrain this Arg. * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ ValueArg( const std::string& flag, const std::string& name, const std::string& desc, bool req, T value, Constraint* constraint, Visitor* v = NULL ); /** * Handles the processing of the argument. * This re-implements the Arg version of this method to set the * _value of the argument appropriately. It knows the difference * between labeled and unlabeled. * \param i - Pointer the the current argument in the list. * \param args - Mutable list of strings. Passed * in from main(). */ virtual bool processArg(int* i, std::vector& args); /** * Returns the value of the argument. */ T& getValue() ; /** * Specialization of shortID. * \param val - value to be used. */ virtual std::string shortID(const std::string& val = "val") const; /** * Specialization of longID. * \param val - value to be used. */ virtual std::string longID(const std::string& val = "val") const; virtual void reset() ; }; /** * Constructor implementation. */ template ValueArg::ValueArg(const std::string& flag, const std::string& name, const std::string& desc, bool req, T val, const std::string& typeDesc, Visitor* v) : Arg(flag, name, desc, req, true, v), _value( val ), _default( val ), _typeDesc( typeDesc ), _constraint( NULL ) { } template ValueArg::ValueArg(const std::string& flag, const std::string& name, const std::string& desc, bool req, T val, const std::string& typeDesc, CmdLineInterface& parser, Visitor* v) : Arg(flag, name, desc, req, true, v), _value( val ), _default( val ), _typeDesc( typeDesc ), _constraint( NULL ) { parser.add( this ); } template ValueArg::ValueArg(const std::string& flag, const std::string& name, const std::string& desc, bool req, T val, Constraint* constraint, Visitor* v) : Arg(flag, name, desc, req, true, v), _value( val ), _default( val ), _typeDesc( constraint->shortID() ), _constraint( constraint ) { } template ValueArg::ValueArg(const std::string& flag, const std::string& name, const std::string& desc, bool req, T val, Constraint* constraint, CmdLineInterface& parser, Visitor* v) : Arg(flag, name, desc, req, true, v), _value( val ), _default( val ), _typeDesc( constraint->shortID() ), _constraint( constraint ) { parser.add( this ); } /** * Implementation of getValue(). */ template T& ValueArg::getValue() { return _value; } /** * Implementation of processArg(). */ template bool ValueArg::processArg(int *i, std::vector& args) { if ( _ignoreable && Arg::ignoreRest() ) return false; if ( _hasBlanks( args[*i] ) ) return false; std::string flag = args[*i]; std::string value = ""; trimFlag( flag, value ); if ( argMatches( flag ) ) { if ( _alreadySet ) throw( CmdLineParseException("Argument already set!", toString()) ); if ( Arg::delimiter() != ' ' && value == "" ) throw( ArgParseException( "Couldn't find delimiter for this argument!", toString() ) ); if ( value == "" ) { (*i)++; if ( static_cast(*i) < args.size() ) _extractValue( args[*i] ); else throw( ArgParseException("Missing a value for this argument!", toString() ) ); } else _extractValue( value ); _alreadySet = true; _checkWithVisitor(); return true; } else return false; } /** * Implementation of shortID. */ template std::string ValueArg::shortID(const std::string& val) const { static_cast(val); // Ignore input, don't warn return Arg::shortID( _typeDesc ); } /** * Implementation of longID. */ template std::string ValueArg::longID(const std::string& val) const { static_cast(val); // Ignore input, don't warn return Arg::longID( _typeDesc ); } template void ValueArg::_extractValue( const std::string& val ) { try { ExtractValue(_value, val, typename ArgTraits::ValueCategory()); } catch( ArgParseException &e) { throw ArgParseException(e.error(), toString()); } if ( _constraint != NULL ) if ( ! _constraint->check( _value ) ) throw( CmdLineParseException( "Value '" + val + + "' does not meet constraint: " + _constraint->description(), toString() ) ); } template void ValueArg::reset() { Arg::reset(); _value = _default; } } // namespace TCLAP #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/Makefile.am0000644000175000017500000000110112320456500022431 0ustar mathieumathieu libtclapincludedir = $(includedir)/tclap libtclapinclude_HEADERS = \ CmdLineInterface.h \ ArgException.h \ CmdLine.h \ XorHandler.h \ MultiArg.h \ UnlabeledMultiArg.h \ ValueArg.h \ UnlabeledValueArg.h \ Visitor.h Arg.h \ HelpVisitor.h \ SwitchArg.h \ MultiSwitchArg.h \ VersionVisitor.h \ IgnoreRestVisitor.h \ CmdLineOutput.h \ StdOutput.h \ DocBookOutput.h \ ZshCompletionOutput.h \ OptionalUnlabeledTracker.h \ Constraint.h \ ValuesConstraint.h \ ArgTraits.h \ StandardTraits.h ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/ArgException.h0000644000175000017500000001166412320456500023155 0ustar mathieumathieu// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- /****************************************************************************** * * file: ArgException.h * * Copyright (c) 2003, Michael E. Smoot . * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ #ifndef TCLAP_ARG_EXCEPTION_H #define TCLAP_ARG_EXCEPTION_H #include #include namespace TCLAP { /** * A simple class that defines and argument exception. Should be caught * whenever a CmdLine is created and parsed. */ class ArgException : public std::exception { public: /** * Constructor. * \param text - The text of the exception. * \param id - The text identifying the argument source. * \param td - Text describing the type of ArgException it is. * of the exception. */ ArgException( const std::string& text = "undefined exception", const std::string& id = "undefined", const std::string& td = "Generic ArgException") : std::exception(), _errorText(text), _argId( id ), _typeDescription(td) { } /** * Destructor. */ virtual ~ArgException() throw() { } /** * Returns the error text. */ std::string error() const { return ( _errorText ); } /** * Returns the argument id. */ std::string argId() const { if ( _argId == "undefined" ) return " "; else return ( "Argument: " + _argId ); } /** * Returns the arg id and error text. */ const char* what() const throw() { static std::string ex; ex = _argId + " -- " + _errorText; return ex.c_str(); } /** * Returns the type of the exception. Used to explain and distinguish * between different child exceptions. */ std::string typeDescription() const { return _typeDescription; } private: /** * The text of the exception message. */ std::string _errorText; /** * The argument related to this exception. */ std::string _argId; /** * Describes the type of the exception. Used to distinguish * between different child exceptions. */ std::string _typeDescription; }; /** * Thrown from within the child Arg classes when it fails to properly * parse the argument it has been passed. */ class ArgParseException : public ArgException { public: /** * Constructor. * \param text - The text of the exception. * \param id - The text identifying the argument source * of the exception. */ ArgParseException( const std::string& text = "undefined exception", const std::string& id = "undefined" ) : ArgException( text, id, std::string( "Exception found while parsing " ) + std::string( "the value the Arg has been passed." )) { } }; /** * Thrown from CmdLine when the arguments on the command line are not * properly specified, e.g. too many arguments, required argument missing, etc. */ class CmdLineParseException : public ArgException { public: /** * Constructor. * \param text - The text of the exception. * \param id - The text identifying the argument source * of the exception. */ CmdLineParseException( const std::string& text = "undefined exception", const std::string& id = "undefined" ) : ArgException( text, id, std::string( "Exception found when the values ") + std::string( "on the command line do not meet ") + std::string( "the requirements of the defined ") + std::string( "Args." )) { } }; /** * Thrown from Arg and CmdLine when an Arg is improperly specified, e.g. * same flag as another Arg, same name, etc. */ class SpecificationException : public ArgException { public: /** * Constructor. * \param text - The text of the exception. * \param id - The text identifying the argument source * of the exception. */ SpecificationException( const std::string& text = "undefined exception", const std::string& id = "undefined" ) : ArgException( text, id, std::string("Exception found when an Arg object ")+ std::string("is improperly defined by the ") + std::string("developer." )) { } }; class ExitException { public: ExitException(int estat) : _estat(estat) {} int getExitStatus() const { return _estat; } private: int _estat; }; } // namespace TCLAP #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/DocBookOutput.h0000644000175000017500000002024412320456500023320 0ustar mathieumathieu// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- /****************************************************************************** * * file: DocBookOutput.h * * Copyright (c) 2004, Michael E. Smoot * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ #ifndef TCLAP_DOCBOOKOUTPUT_H #define TCLAP_DOCBOOKOUTPUT_H #include #include #include #include #include #include #include #include #include namespace TCLAP { /** * A class that generates DocBook output for usage() method for the * given CmdLine and its Args. */ class DocBookOutput : public CmdLineOutput { public: /** * Prints the usage to stdout. Can be overridden to * produce alternative behavior. * \param c - The CmdLine object the output is generated for. */ virtual void usage(CmdLineInterface& c); /** * Prints the version to stdout. Can be overridden * to produce alternative behavior. * \param c - The CmdLine object the output is generated for. */ virtual void version(CmdLineInterface& c); /** * Prints (to stderr) an error message, short usage * Can be overridden to produce alternative behavior. * \param c - The CmdLine object the output is generated for. * \param e - The ArgException that caused the failure. */ virtual void failure(CmdLineInterface& c, ArgException& e ); protected: /** * Substitutes the char r for string x in string s. * \param s - The string to operate on. * \param r - The char to replace. * \param x - What to replace r with. */ void substituteSpecialChars( std::string& s, char r, std::string& x ); void removeChar( std::string& s, char r); void basename( std::string& s ); void printShortArg(Arg* it); void printLongArg(Arg* it); char theDelimiter; }; inline void DocBookOutput::version(CmdLineInterface& _cmd) { std::cout << _cmd.getVersion() << std::endl; } inline void DocBookOutput::usage(CmdLineInterface& _cmd ) { std::list argList = _cmd.getArgList(); std::string progName = _cmd.getProgramName(); std::string version = _cmd.getVersion(); theDelimiter = _cmd.getDelimiter(); XorHandler xorHandler = _cmd.getXorHandler(); std::vector< std::vector > xorList = xorHandler.getXorList(); basename(progName); std::cout << "" << std::endl; std::cout << "" << std::endl << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << progName << "" << std::endl; std::cout << "1" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << progName << "" << std::endl; std::cout << "" << _cmd.getMessage() << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << progName << "" << std::endl; // xor for ( int i = 0; (unsigned int)i < xorList.size(); i++ ) { std::cout << "" << std::endl; for ( ArgVectorIterator it = xorList[i].begin(); it != xorList[i].end(); it++ ) printShortArg((*it)); std::cout << "" << std::endl; } // rest of args for (ArgListIterator it = argList.begin(); it != argList.end(); it++) if ( !xorHandler.contains( (*it) ) ) printShortArg((*it)); std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "Description" << std::endl; std::cout << "" << std::endl; std::cout << _cmd.getMessage() << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "Options" << std::endl; std::cout << "" << std::endl; for (ArgListIterator it = argList.begin(); it != argList.end(); it++) printLongArg((*it)); std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "Version" << std::endl; std::cout << "" << std::endl; std::cout << version << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; } inline void DocBookOutput::failure( CmdLineInterface& _cmd, ArgException& e ) { static_cast(_cmd); // unused std::cout << e.what() << std::endl; throw ExitException(1); } inline void DocBookOutput::substituteSpecialChars( std::string& s, char r, std::string& x ) { size_t p; while ( (p = s.find_first_of(r)) != std::string::npos ) { s.erase(p,1); s.insert(p,x); } } inline void DocBookOutput::removeChar( std::string& s, char r) { size_t p; while ( (p = s.find_first_of(r)) != std::string::npos ) { s.erase(p,1); } } inline void DocBookOutput::basename( std::string& s ) { size_t p = s.find_last_of('/'); if ( p != std::string::npos ) { s.erase(0, p + 1); } } inline void DocBookOutput::printShortArg(Arg* a) { std::string lt = "<"; std::string gt = ">"; std::string id = a->shortID(); substituteSpecialChars(id,'<',lt); substituteSpecialChars(id,'>',gt); removeChar(id,'['); removeChar(id,']'); std::string choice = "opt"; if ( a->isRequired() ) choice = "plain"; std::cout << "acceptsMultipleValues() ) std::cout << " rep='repeat'"; std::cout << '>'; if ( !a->getFlag().empty() ) std::cout << a->flagStartChar() << a->getFlag(); else std::cout << a->nameStartString() << a->getName(); if ( a->isValueRequired() ) { std::string arg = a->shortID(); removeChar(arg,'['); removeChar(arg,']'); removeChar(arg,'<'); removeChar(arg,'>'); arg.erase(0, arg.find_last_of(theDelimiter) + 1); std::cout << theDelimiter; std::cout << "" << arg << ""; } std::cout << "" << std::endl; } inline void DocBookOutput::printLongArg(Arg* a) { std::string lt = "<"; std::string gt = ">"; std::string desc = a->getDescription(); substituteSpecialChars(desc,'<',lt); substituteSpecialChars(desc,'>',gt); std::cout << "" << std::endl; if ( !a->getFlag().empty() ) { std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; } std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << desc << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; } } //namespace TCLAP #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/SwitchArg.h0000644000175000017500000001455512320456500022462 0ustar mathieumathieu /****************************************************************************** * * file: SwitchArg.h * * Copyright (c) 2003, Michael E. Smoot . * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ #ifndef TCLAP_SWITCH_ARG_H #define TCLAP_SWITCH_ARG_H #include #include #include namespace TCLAP { /** * A simple switch argument. If the switch is set on the command line, then * the getValue method will return the opposite of the default value for the * switch. */ class SwitchArg : public Arg { protected: /** * The value of the switch. */ bool _value; /** * Used to support the reset() method so that ValueArg can be * reset to their constructed value. */ bool _default; public: /** * SwitchArg constructor. * \param flag - The one character flag that identifies this * argument on the command line. * \param name - A one word name for the argument. Can be * used as a long flag on the command line. * \param desc - A description of what the argument is for or * does. * \param def - The default value for this Switch. * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ SwitchArg(const std::string& flag, const std::string& name, const std::string& desc, bool def = false, Visitor* v = NULL); /** * SwitchArg constructor. * \param flag - The one character flag that identifies this * argument on the command line. * \param name - A one word name for the argument. Can be * used as a long flag on the command line. * \param desc - A description of what the argument is for or * does. * \param parser - A CmdLine parser object to add this Arg to * \param def - The default value for this Switch. * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ SwitchArg(const std::string& flag, const std::string& name, const std::string& desc, CmdLineInterface& parser, bool def = false, Visitor* v = NULL); /** * Handles the processing of the argument. * This re-implements the Arg version of this method to set the * _value of the argument appropriately. * \param i - Pointer the the current argument in the list. * \param args - Mutable list of strings. Passed * in from main(). */ virtual bool processArg(int* i, std::vector& args); /** * Checks a string to see if any of the chars in the string * match the flag for this Switch. */ bool combinedSwitchesMatch(std::string& combined); /** * Returns bool, whether or not the switch has been set. */ bool getValue(); virtual void reset(); }; ////////////////////////////////////////////////////////////////////// //BEGIN SwitchArg.cpp ////////////////////////////////////////////////////////////////////// inline SwitchArg::SwitchArg(const std::string& flag, const std::string& name, const std::string& desc, bool default_val, Visitor* v ) : Arg(flag, name, desc, false, false, v), _value( default_val ), _default( default_val ) { } inline SwitchArg::SwitchArg(const std::string& flag, const std::string& name, const std::string& desc, CmdLineInterface& parser, bool default_val, Visitor* v ) : Arg(flag, name, desc, false, false, v), _value( default_val ), _default(default_val) { parser.add( this ); } inline bool SwitchArg::getValue() { return _value; } inline bool SwitchArg::combinedSwitchesMatch(std::string& combinedSwitches ) { // make sure this is actually a combined switch if ( combinedSwitches.length() > 0 && combinedSwitches[0] != Arg::flagStartString()[0] ) return false; // make sure it isn't a long name if ( combinedSwitches.substr( 0, Arg::nameStartString().length() ) == Arg::nameStartString() ) return false; // make sure the delimiter isn't in the string if ( combinedSwitches.find_first_of( Arg::delimiter() ) != std::string::npos ) return false; // ok, we're not specifying a ValueArg, so we know that we have // a combined switch list. for ( unsigned int i = 1; i < combinedSwitches.length(); i++ ) if ( _flag.length() > 0 && combinedSwitches[i] == _flag[0] && _flag[0] != Arg::flagStartString()[0] ) { // update the combined switches so this one is no longer present // this is necessary so that no unlabeled args are matched // later in the processing. //combinedSwitches.erase(i,1); combinedSwitches[i] = Arg::blankChar(); return true; } // none of the switches passed in the list match. return false; } inline bool SwitchArg::processArg(int *i, std::vector& args) { if ( _ignoreable && Arg::ignoreRest() ) return false; if ( argMatches( args[*i] ) || combinedSwitchesMatch( args[*i] ) ) { // If we match on a combined switch, then we want to return false // so that other switches in the combination will also have a // chance to match. bool ret = false; if ( argMatches( args[*i] ) ) ret = true; if ( _alreadySet || ( !ret && combinedSwitchesMatch( args[*i] ) ) ) throw(CmdLineParseException("Argument already set!", toString())); _alreadySet = true; if ( _value == true ) _value = false; else _value = true; _checkWithVisitor(); return ret; } else return false; } inline void SwitchArg::reset() { Arg::reset(); _value = _default; } ////////////////////////////////////////////////////////////////////// //End SwitchArg.cpp ////////////////////////////////////////////////////////////////////// } //namespace TCLAP #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/CmdLine.h0000644000175000017500000003223612320456500022076 0ustar mathieumathieu// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- /****************************************************************************** * * file: CmdLine.h * * Copyright (c) 2003, Michael E. Smoot . * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ #ifndef TCLAP_CMDLINE_H #define TCLAP_CMDLINE_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // Needed for exit(), which isn't defined in some envs. namespace TCLAP { template void DelPtr(T ptr) { delete ptr; } template void ClearContainer(C &c) { typedef typename C::value_type value_type; std::for_each(c.begin(), c.end(), DelPtr); c.clear(); } /** * The base class that manages the command line definition and passes * along the parsing to the appropriate Arg classes. */ class CmdLine : public CmdLineInterface { protected: /** * The list of arguments that will be tested against the * command line. */ std::list _argList; /** * The name of the program. Set to argv[0]. */ std::string _progName; /** * A message used to describe the program. Used in the usage output. */ std::string _message; /** * The version to be displayed with the --version switch. */ std::string _version; /** * The number of arguments that are required to be present on * the command line. This is set dynamically, based on the * Args added to the CmdLine object. */ int _numRequired; /** * The character that is used to separate the argument flag/name * from the value. Defaults to ' ' (space). */ char _delimiter; /** * The handler that manages xoring lists of args. */ XorHandler _xorHandler; /** * A list of Args to be explicitly deleted when the destructor * is called. At the moment, this only includes the three default * Args. */ std::list _argDeleteOnExitList; /** * A list of Visitors to be explicitly deleted when the destructor * is called. At the moment, these are the Vistors created for the * default Args. */ std::list _visitorDeleteOnExitList; /** * Object that handles all output for the CmdLine. */ CmdLineOutput* _output; /** * Should CmdLine handle parsing exceptions internally? */ bool _handleExceptions; /** * Throws an exception listing the missing args. */ void missingArgsException(); /** * Checks whether a name/flag string matches entirely matches * the Arg::blankChar. Used when multiple switches are combined * into a single argument. * \param s - The message to be used in the usage. */ bool _emptyCombined(const std::string& s); /** * Perform a delete ptr; operation on ptr when this object is deleted. */ void deleteOnExit(Arg* ptr); /** * Perform a delete ptr; operation on ptr when this object is deleted. */ void deleteOnExit(Visitor* ptr); private: /** * Encapsulates the code common to the constructors * (which is all of it). */ void _constructor(); /** * Is set to true when a user sets the output object. We use this so * that we don't delete objects that are created outside of this lib. */ bool _userSetOutput; /** * Whether or not to automatically create help and version switches. */ bool _helpAndVersion; public: /** * Command line constructor. Defines how the arguments will be * parsed. * \param message - The message to be used in the usage * output. * \param delimiter - The character that is used to separate * the argument flag/name from the value. Defaults to ' ' (space). * \param version - The version number to be used in the * --version switch. * \param helpAndVersion - Whether or not to create the Help and * Version switches. Defaults to true. */ CmdLine(const std::string& message, const char delimiter = ' ', const std::string& version = "none", bool helpAndVersion = true); /** * Deletes any resources allocated by a CmdLine object. */ virtual ~CmdLine(); /** * Adds an argument to the list of arguments to be parsed. * \param a - Argument to be added. */ void add( Arg& a ); /** * An alternative add. Functionally identical. * \param a - Argument to be added. */ void add( Arg* a ); /** * Add two Args that will be xor'd. If this method is used, add does * not need to be called. * \param a - Argument to be added and xor'd. * \param b - Argument to be added and xor'd. */ void xorAdd( Arg& a, Arg& b ); /** * Add a list of Args that will be xor'd. If this method is used, * add does not need to be called. * \param xors - List of Args to be added and xor'd. */ void xorAdd( std::vector& xors ); /** * Parses the command line. * \param argc - Number of arguments. * \param argv - Array of arguments. */ void parse(int argc, const char * const * argv); /** * Parses the command line. * \param args - A vector of strings representing the args. * args[0] is still the program name. */ void parse(std::vector& args); /** * */ CmdLineOutput* getOutput(); /** * */ void setOutput(CmdLineOutput* co); /** * */ std::string& getVersion(); /** * */ std::string& getProgramName(); /** * */ std::list& getArgList(); /** * */ XorHandler& getXorHandler(); /** * */ char getDelimiter(); /** * */ std::string& getMessage(); /** * */ bool hasHelpAndVersion(); /** * Disables or enables CmdLine's internal parsing exception handling. * * @param state Should CmdLine handle parsing exceptions internally? */ void setExceptionHandling(const bool state); /** * Returns the current state of the internal exception handling. * * @retval true Parsing exceptions are handled internally. * @retval false Parsing exceptions are propagated to the caller. */ bool getExceptionHandling() const; /** * Allows the CmdLine object to be reused. */ void reset(); }; /////////////////////////////////////////////////////////////////////////////// //Begin CmdLine.cpp /////////////////////////////////////////////////////////////////////////////// inline CmdLine::CmdLine(const std::string& m, char delim, const std::string& v, bool help ) : _progName("not_set_yet"), _message(m), _version(v), _numRequired(0), _delimiter(delim), _handleExceptions(true), _userSetOutput(false), _helpAndVersion(help) { _constructor(); } inline CmdLine::~CmdLine() { ClearContainer(_argDeleteOnExitList); ClearContainer(_visitorDeleteOnExitList); if ( !_userSetOutput ) { delete _output; _output = 0; } } inline void CmdLine::_constructor() { _output = new StdOutput; Arg::setDelimiter( _delimiter ); Visitor* v; if ( _helpAndVersion ) { v = new HelpVisitor( this, &_output ); SwitchArg* help = new SwitchArg("h","help", "Displays usage information and exits.", false, v); add( help ); deleteOnExit(help); deleteOnExit(v); v = new VersionVisitor( this, &_output ); SwitchArg* vers = new SwitchArg("","version", "Displays version information and exits.", false, v); add( vers ); deleteOnExit(vers); deleteOnExit(v); } v = new IgnoreRestVisitor(); SwitchArg* ignore = new SwitchArg(Arg::flagStartString(), Arg::ignoreNameString(), "Ignores the rest of the labeled arguments following this flag.", false, v); add( ignore ); deleteOnExit(ignore); deleteOnExit(v); } inline void CmdLine::xorAdd( std::vector& ors ) { _xorHandler.add( ors ); for (ArgVectorIterator it = ors.begin(); it != ors.end(); it++) { (*it)->forceRequired(); (*it)->setRequireLabel( "OR required" ); add( *it ); } } inline void CmdLine::xorAdd( Arg& a, Arg& b ) { std::vector ors; ors.push_back( &a ); ors.push_back( &b ); xorAdd( ors ); } inline void CmdLine::add( Arg& a ) { add( &a ); } inline void CmdLine::add( Arg* a ) { for( ArgListIterator it = _argList.begin(); it != _argList.end(); it++ ) if ( *a == *(*it) ) throw( SpecificationException( "Argument with same flag/name already exists!", a->longID() ) ); a->addToList( _argList ); if ( a->isRequired() ) _numRequired++; } inline void CmdLine::parse(int argc, const char * const * argv) { // this step is necessary so that we have easy access to // mutable strings. std::vector args; for (int i = 0; i < argc; i++) args.push_back(argv[i]); parse(args); } inline void CmdLine::parse(std::vector& args) { bool shouldExit = false; int estat = 0; try { _progName = args.front(); args.erase(args.begin()); int requiredCount = 0; for (int i = 0; static_cast(i) < args.size(); i++) { bool matched = false; for (ArgListIterator it = _argList.begin(); it != _argList.end(); it++) { if ( (*it)->processArg( &i, args ) ) { requiredCount += _xorHandler.check( *it ); matched = true; break; } } // checks to see if the argument is an empty combined // switch and if so, then we've actually matched it if ( !matched && _emptyCombined( args[i] ) ) matched = true; if ( !matched && !Arg::ignoreRest() ) throw(CmdLineParseException("Couldn't find match " "for argument", args[i])); } if ( requiredCount < _numRequired ) missingArgsException(); if ( requiredCount > _numRequired ) throw(CmdLineParseException("Too many arguments!")); } catch ( ArgException& e ) { // If we're not handling the exceptions, rethrow. if ( !_handleExceptions) { throw; } try { _output->failure(*this,e); } catch ( ExitException &ee ) { estat = ee.getExitStatus(); shouldExit = true; } } catch (ExitException &ee) { // If we're not handling the exceptions, rethrow. if ( !_handleExceptions) { throw; } estat = ee.getExitStatus(); shouldExit = true; } if (shouldExit) exit(estat); } inline bool CmdLine::_emptyCombined(const std::string& s) { if ( s.length() > 0 && s[0] != Arg::flagStartChar() ) return false; for ( int i = 1; static_cast(i) < s.length(); i++ ) if ( s[i] != Arg::blankChar() ) return false; return true; } inline void CmdLine::missingArgsException() { int count = 0; std::string missingArgList; for (ArgListIterator it = _argList.begin(); it != _argList.end(); it++) { if ( (*it)->isRequired() && !(*it)->isSet() ) { missingArgList += (*it)->getName(); missingArgList += ", "; count++; } } missingArgList = missingArgList.substr(0,missingArgList.length()-2); std::string msg; if ( count > 1 ) msg = "Required arguments missing: "; else msg = "Required argument missing: "; msg += missingArgList; throw(CmdLineParseException(msg)); } inline void CmdLine::deleteOnExit(Arg* ptr) { _argDeleteOnExitList.push_back(ptr); } inline void CmdLine::deleteOnExit(Visitor* ptr) { _visitorDeleteOnExitList.push_back(ptr); } inline CmdLineOutput* CmdLine::getOutput() { return _output; } inline void CmdLine::setOutput(CmdLineOutput* co) { _userSetOutput = true; _output = co; } inline std::string& CmdLine::getVersion() { return _version; } inline std::string& CmdLine::getProgramName() { return _progName; } inline std::list& CmdLine::getArgList() { return _argList; } inline XorHandler& CmdLine::getXorHandler() { return _xorHandler; } inline char CmdLine::getDelimiter() { return _delimiter; } inline std::string& CmdLine::getMessage() { return _message; } inline bool CmdLine::hasHelpAndVersion() { return _helpAndVersion; } inline void CmdLine::setExceptionHandling(const bool state) { _handleExceptions = state; } inline bool CmdLine::getExceptionHandling() const { return _handleExceptions; } inline void CmdLine::reset() { for( ArgListIterator it = _argList.begin(); it != _argList.end(); it++ ) { (*it)->reset(); } _progName.clear(); } /////////////////////////////////////////////////////////////////////////////// //End CmdLine.cpp /////////////////////////////////////////////////////////////////////////////// } //namespace TCLAP #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/COPYING0000644000175000017500000000206712320456500021444 0ustar mathieumathieu Copyright (c) 2003 Michael E. Smoot Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/IgnoreRestVisitor.h0000644000175000017500000000246712320456500024227 0ustar mathieumathieu /****************************************************************************** * * file: IgnoreRestVisitor.h * * Copyright (c) 2003, Michael E. Smoot . * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ #ifndef TCLAP_IGNORE_REST_VISITOR_H #define TCLAP_IGNORE_REST_VISITOR_H #include #include namespace TCLAP { /** * A Vistor that tells the CmdLine to begin ignoring arguments after * this one is parsed. */ class IgnoreRestVisitor: public Visitor { public: /** * Constructor. */ IgnoreRestVisitor() : Visitor() {} /** * Sets Arg::_ignoreRest. */ void visit() { Arg::beginIgnoring(); } }; } #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/ZshCompletionOutput.h0000644000175000017500000001737312320456500024607 0ustar mathieumathieu// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- /****************************************************************************** * * file: ZshCompletionOutput.h * * Copyright (c) 2006, Oliver Kiddle * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ #ifndef TCLAP_ZSHCOMPLETIONOUTPUT_H #define TCLAP_ZSHCOMPLETIONOUTPUT_H #include #include #include #include #include #include #include #include #include namespace TCLAP { /** * A class that generates a Zsh completion function as output from the usage() * method for the given CmdLine and its Args. */ class ZshCompletionOutput : public CmdLineOutput { public: ZshCompletionOutput(); /** * Prints the usage to stdout. Can be overridden to * produce alternative behavior. * \param c - The CmdLine object the output is generated for. */ virtual void usage(CmdLineInterface& c); /** * Prints the version to stdout. Can be overridden * to produce alternative behavior. * \param c - The CmdLine object the output is generated for. */ virtual void version(CmdLineInterface& c); /** * Prints (to stderr) an error message, short usage * Can be overridden to produce alternative behavior. * \param c - The CmdLine object the output is generated for. * \param e - The ArgException that caused the failure. */ virtual void failure(CmdLineInterface& c, ArgException& e ); protected: void basename( std::string& s ); void quoteSpecialChars( std::string& s ); std::string getMutexList( CmdLineInterface& _cmd, Arg* a ); void printOption( Arg* it, std::string mutex ); void printArg( Arg* it ); std::map common; char theDelimiter; }; ZshCompletionOutput::ZshCompletionOutput() { common["host"] = "_hosts"; common["hostname"] = "_hosts"; common["file"] = "_files"; common["filename"] = "_files"; common["user"] = "_users"; common["username"] = "_users"; common["directory"] = "_directories"; common["path"] = "_directories"; common["url"] = "_urls"; } inline void ZshCompletionOutput::version(CmdLineInterface& _cmd) { std::cout << _cmd.getVersion() << std::endl; } inline void ZshCompletionOutput::usage(CmdLineInterface& _cmd ) { std::list argList = _cmd.getArgList(); std::string progName = _cmd.getProgramName(); std::string version = _cmd.getVersion(); theDelimiter = _cmd.getDelimiter(); basename(progName); std::cout << "#compdef " << progName << std::endl << std::endl << "# " << progName << " version " << _cmd.getVersion() << std::endl << std::endl << "_arguments -s -S"; for (ArgListIterator it = argList.begin(); it != argList.end(); it++) { if ( (*it)->shortID().at(0) == '<' ) printArg((*it)); else if ( (*it)->getFlag() != "-" ) printOption((*it), getMutexList(_cmd, *it)); } std::cout << std::endl; } inline void ZshCompletionOutput::failure( CmdLineInterface& _cmd, ArgException& e ) { static_cast(_cmd); // unused std::cout << e.what() << std::endl; } inline void ZshCompletionOutput::quoteSpecialChars( std::string& s ) { size_t idx = s.find_last_of(':'); while ( idx != std::string::npos ) { s.insert(idx, 1, '\\'); idx = s.find_last_of(':', idx); } idx = s.find_last_of('\''); while ( idx != std::string::npos ) { s.insert(idx, "'\\'"); if (idx == 0) idx = std::string::npos; else idx = s.find_last_of('\'', --idx); } } inline void ZshCompletionOutput::basename( std::string& s ) { size_t p = s.find_last_of('/'); if ( p != std::string::npos ) { s.erase(0, p + 1); } } inline void ZshCompletionOutput::printArg(Arg* a) { static int count = 1; std::cout << " \\" << std::endl << " '"; if ( a->acceptsMultipleValues() ) std::cout << '*'; else std::cout << count++; std::cout << ':'; if ( !a->isRequired() ) std::cout << ':'; std::cout << a->getName() << ':'; std::map::iterator compArg = common.find(a->getName()); if ( compArg != common.end() ) { std::cout << compArg->second; } else { std::cout << "_guard \"^-*\" " << a->getName(); } std::cout << '\''; } inline void ZshCompletionOutput::printOption(Arg* a, std::string mutex) { std::string flag = a->flagStartChar() + a->getFlag(); std::string name = a->nameStartString() + a->getName(); std::string desc = a->getDescription(); // remove full stop and capitalisation from description as // this is the convention for zsh function if (!desc.compare(0, 12, "(required) ")) { desc.erase(0, 12); } if (!desc.compare(0, 15, "(OR required) ")) { desc.erase(0, 15); } size_t len = desc.length(); if (len && desc.at(--len) == '.') { desc.erase(len); } if (len) { desc.replace(0, 1, 1, tolower(desc.at(0))); } std::cout << " \\" << std::endl << " '" << mutex; if ( a->getFlag().empty() ) { std::cout << name; } else { std::cout << "'{" << flag << ',' << name << "}'"; } if ( theDelimiter == '=' && a->isValueRequired() ) std::cout << "=-"; quoteSpecialChars(desc); std::cout << '[' << desc << ']'; if ( a->isValueRequired() ) { std::string arg = a->shortID(); arg.erase(0, arg.find_last_of(theDelimiter) + 1); if ( arg.at(arg.length()-1) == ']' ) arg.erase(arg.length()-1); if ( arg.at(arg.length()-1) == ']' ) { arg.erase(arg.length()-1); } if ( arg.at(0) == '<' ) { arg.erase(arg.length()-1); arg.erase(0, 1); } size_t p = arg.find('|'); if ( p != std::string::npos ) { do { arg.replace(p, 1, 1, ' '); } while ( (p = arg.find_first_of('|', p)) != std::string::npos ); quoteSpecialChars(arg); std::cout << ": :(" << arg << ')'; } else { std::cout << ':' << arg; std::map::iterator compArg = common.find(arg); if ( compArg != common.end() ) { std::cout << ':' << compArg->second; } } } std::cout << '\''; } inline std::string ZshCompletionOutput::getMutexList( CmdLineInterface& _cmd, Arg* a) { XorHandler xorHandler = _cmd.getXorHandler(); std::vector< std::vector > xorList = xorHandler.getXorList(); if (a->getName() == "help" || a->getName() == "version") { return "(-)"; } std::ostringstream list; if ( a->acceptsMultipleValues() ) { list << '*'; } for ( int i = 0; static_cast(i) < xorList.size(); i++ ) { for ( ArgVectorIterator it = xorList[i].begin(); it != xorList[i].end(); it++) if ( a == (*it) ) { list << '('; for ( ArgVectorIterator iu = xorList[i].begin(); iu != xorList[i].end(); iu++ ) { bool notCur = (*iu) != a; bool hasFlag = !(*iu)->getFlag().empty(); if ( iu != xorList[i].begin() && (notCur || hasFlag) ) list << ' '; if (hasFlag) list << (*iu)->flagStartChar() << (*iu)->getFlag() << ' '; if ( notCur || hasFlag ) list << (*iu)->nameStartString() << (*iu)->getName(); } list << ')'; return list.str(); } } // wasn't found in xor list if (!a->getFlag().empty()) { list << "(" << a->flagStartChar() << a->getFlag() << ' ' << a->nameStartString() << a->getName() << ')'; } return list.str(); } } //namespace TCLAP #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/UnlabeledMultiArg.h0000644000175000017500000002262312320456500024122 0ustar mathieumathieu /****************************************************************************** * * file: UnlabeledMultiArg.h * * Copyright (c) 2003, Michael E. Smoot. * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ #ifndef TCLAP_MULTIPLE_UNLABELED_ARGUMENT_H #define TCLAP_MULTIPLE_UNLABELED_ARGUMENT_H #include #include #include #include namespace TCLAP { /** * Just like a MultiArg, except that the arguments are unlabeled. Basically, * this Arg will slurp up everything that hasn't been matched to another * Arg. */ template class UnlabeledMultiArg : public MultiArg { // If compiler has two stage name lookup (as gcc >= 3.4 does) // this is requried to prevent undef. symbols using MultiArg::_ignoreable; using MultiArg::_hasBlanks; using MultiArg::_extractValue; using MultiArg::_typeDesc; using MultiArg::_name; using MultiArg::_description; using MultiArg::_alreadySet; using MultiArg::toString; public: /** * Constructor. * \param name - The name of the Arg. Note that this is used for * identification, not as a long flag. * \param desc - A description of what the argument is for or * does. * \param req - Whether the argument is required on the command * line. * \param typeDesc - A short, human readable description of the * type that this object expects. This is used in the generation * of the USAGE statement. The goal is to be helpful to the end user * of the program. * \param ignoreable - Whether or not this argument can be ignored * using the "--" flag. * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ UnlabeledMultiArg( const std::string& name, const std::string& desc, bool req, const std::string& typeDesc, bool ignoreable = false, Visitor* v = NULL ); /** * Constructor. * \param name - The name of the Arg. Note that this is used for * identification, not as a long flag. * \param desc - A description of what the argument is for or * does. * \param req - Whether the argument is required on the command * line. * \param typeDesc - A short, human readable description of the * type that this object expects. This is used in the generation * of the USAGE statement. The goal is to be helpful to the end user * of the program. * \param parser - A CmdLine parser object to add this Arg to * \param ignoreable - Whether or not this argument can be ignored * using the "--" flag. * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ UnlabeledMultiArg( const std::string& name, const std::string& desc, bool req, const std::string& typeDesc, CmdLineInterface& parser, bool ignoreable = false, Visitor* v = NULL ); /** * Constructor. * \param name - The name of the Arg. Note that this is used for * identification, not as a long flag. * \param desc - A description of what the argument is for or * does. * \param req - Whether the argument is required on the command * line. * \param constraint - A pointer to a Constraint object used * to constrain this Arg. * \param ignoreable - Whether or not this argument can be ignored * using the "--" flag. * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ UnlabeledMultiArg( const std::string& name, const std::string& desc, bool req, Constraint* constraint, bool ignoreable = false, Visitor* v = NULL ); /** * Constructor. * \param name - The name of the Arg. Note that this is used for * identification, not as a long flag. * \param desc - A description of what the argument is for or * does. * \param req - Whether the argument is required on the command * line. * \param constraint - A pointer to a Constraint object used * to constrain this Arg. * \param parser - A CmdLine parser object to add this Arg to * \param ignoreable - Whether or not this argument can be ignored * using the "--" flag. * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ UnlabeledMultiArg( const std::string& name, const std::string& desc, bool req, Constraint* constraint, CmdLineInterface& parser, bool ignoreable = false, Visitor* v = NULL ); /** * Handles the processing of the argument. * This re-implements the Arg version of this method to set the * _value of the argument appropriately. It knows the difference * between labeled and unlabeled. * \param i - Pointer the the current argument in the list. * \param args - Mutable list of strings. Passed from main(). */ virtual bool processArg(int* i, std::vector& args); /** * Returns the a short id string. Used in the usage. * \param val - value to be used. */ virtual std::string shortID(const std::string& val="val") const; /** * Returns the a long id string. Used in the usage. * \param val - value to be used. */ virtual std::string longID(const std::string& val="val") const; /** * Opertor ==. * \param a - The Arg to be compared to this. */ virtual bool operator==(const Arg& a) const; /** * Pushes this to back of list rather than front. * \param argList - The list this should be added to. */ virtual void addToList( std::list& argList ) const; }; template UnlabeledMultiArg::UnlabeledMultiArg(const std::string& name, const std::string& desc, bool req, const std::string& typeDesc, bool ignoreable, Visitor* v) : MultiArg("", name, desc, req, typeDesc, v) { _ignoreable = ignoreable; OptionalUnlabeledTracker::check(true, toString()); } template UnlabeledMultiArg::UnlabeledMultiArg(const std::string& name, const std::string& desc, bool req, const std::string& typeDesc, CmdLineInterface& parser, bool ignoreable, Visitor* v) : MultiArg("", name, desc, req, typeDesc, v) { _ignoreable = ignoreable; OptionalUnlabeledTracker::check(true, toString()); parser.add( this ); } template UnlabeledMultiArg::UnlabeledMultiArg(const std::string& name, const std::string& desc, bool req, Constraint* constraint, bool ignoreable, Visitor* v) : MultiArg("", name, desc, req, constraint, v) { _ignoreable = ignoreable; OptionalUnlabeledTracker::check(true, toString()); } template UnlabeledMultiArg::UnlabeledMultiArg(const std::string& name, const std::string& desc, bool req, Constraint* constraint, CmdLineInterface& parser, bool ignoreable, Visitor* v) : MultiArg("", name, desc, req, constraint, v) { _ignoreable = ignoreable; OptionalUnlabeledTracker::check(true, toString()); parser.add( this ); } template bool UnlabeledMultiArg::processArg(int *i, std::vector& args) { if ( _hasBlanks( args[*i] ) ) return false; // never ignore an unlabeled multi arg // always take the first value, regardless of the start string _extractValue( args[(*i)] ); /* // continue taking args until we hit the end or a start string while ( (unsigned int)(*i)+1 < args.size() && args[(*i)+1].find_first_of( Arg::flagStartString() ) != 0 && args[(*i)+1].find_first_of( Arg::nameStartString() ) != 0 ) _extractValue( args[++(*i)] ); */ _alreadySet = true; return true; } template std::string UnlabeledMultiArg::shortID(const std::string& val) const { static_cast(val); // Ignore input, don't warn return std::string("<") + _typeDesc + "> ..."; } template std::string UnlabeledMultiArg::longID(const std::string& val) const { static_cast(val); // Ignore input, don't warn return std::string("<") + _typeDesc + "> (accepted multiple times)"; } template bool UnlabeledMultiArg::operator==(const Arg& a) const { if ( _name == a.getName() || _description == a.getDescription() ) return true; else return false; } template void UnlabeledMultiArg::addToList( std::list& argList ) const { argList.push_back( const_cast(static_cast(this)) ); } } #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/Visitor.h0000644000175000017500000000235212320456500022216 0ustar mathieumathieu /****************************************************************************** * * file: Visitor.h * * Copyright (c) 2003, Michael E. Smoot . * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ #ifndef TCLAP_VISITOR_H #define TCLAP_VISITOR_H namespace TCLAP { /** * A base class that defines the interface for visitors. */ class Visitor { public: /** * Constructor. Does nothing. */ Visitor() { } /** * Destructor. Does nothing. */ virtual ~Visitor() { } /** * Does nothing. Should be overridden by child. */ virtual void visit() { } }; } #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/ValuesConstraint.h0000644000175000017500000000616012320456500024064 0ustar mathieumathieu /****************************************************************************** * * file: ValuesConstraint.h * * Copyright (c) 2005, Michael E. Smoot * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ #ifndef TCLAP_VALUESCONSTRAINT_H #define TCLAP_VALUESCONSTRAINT_H #include #include #include #ifdef HAVE_CONFIG_H #include #else #define HAVE_SSTREAM #endif #if defined(HAVE_SSTREAM) #include #elif defined(HAVE_STRSTREAM) #include #else #error "Need a stringstream (sstream or strstream) to compile!" #endif namespace TCLAP { /** * A Constraint that constrains the Arg to only those values specified * in the constraint. */ template class ValuesConstraint : public Constraint { public: /** * Constructor. * \param allowed - vector of allowed values. */ ValuesConstraint(std::vector& allowed); /** * Virtual destructor. */ virtual ~ValuesConstraint() {} /** * Returns a description of the Constraint. */ virtual std::string description() const; /** * Returns the short ID for the Constraint. */ virtual std::string shortID() const; /** * The method used to verify that the value parsed from the command * line meets the constraint. * \param value - The value that will be checked. */ virtual bool check(const T& value) const; protected: /** * The list of valid values. */ std::vector _allowed; /** * The string used to describe the allowed values of this constraint. */ std::string _typeDesc; }; template ValuesConstraint::ValuesConstraint(std::vector& allowed) : _allowed(allowed) { for ( unsigned int i = 0; i < _allowed.size(); i++ ) { #if defined(HAVE_SSTREAM) std::ostringstream os; #elif defined(HAVE_STRSTREAM) std::ostrstream os; #else #error "Need a stringstream (sstream or strstream) to compile!" #endif os << _allowed[i]; std::string temp( os.str() ); if ( i > 0 ) _typeDesc += "|"; _typeDesc += temp; } } template bool ValuesConstraint::check( const T& val ) const { if ( std::find(_allowed.begin(),_allowed.end(),val) == _allowed.end() ) return false; else return true; } template std::string ValuesConstraint::shortID() const { return _typeDesc; } template std::string ValuesConstraint::description() const { return _typeDesc; } } //namespace TCLAP #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/README0000644000175000017500000000155412320456500021271 0ustar mathieumathieu--- Additional Note --- This is TCLAP version 1.2.0, as obtained from: http://tclap.sourceforge.net/ This is a "stripped" version of the code meant only for inclusion in ImageVis3D and related software. If you would like to use this library for your own projects, you should go download the full distribution from the aforementioned website. --- Additional Note --- TCLAP - Templatized Command Line Argument Parser This is a simple C++ library that facilitates parsing command line arguments in a type independent manner. It doesn't conform exactly to either the GNU or POSIX standards, although it is close. See docs/manual.html for descriptions of how things work or look at the simple examples in the examples dir. To find out what the latest changes are read the NEWS file in this directory. Any and all feedback is welcome to: Mike Smoot ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/HelpVisitor.h0000644000175000017500000000340712320456500023031 0ustar mathieumathieu /****************************************************************************** * * file: HelpVisitor.h * * Copyright (c) 2003, Michael E. Smoot . * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ #ifndef TCLAP_HELP_VISITOR_H #define TCLAP_HELP_VISITOR_H #include #include #include namespace TCLAP { /** * A Visitor object that calls the usage method of the given CmdLineOutput * object for the specified CmdLine object. */ class HelpVisitor: public Visitor { protected: /** * The CmdLine the output will be generated for. */ CmdLineInterface* _cmd; /** * The output object. */ CmdLineOutput** _out; public: /** * Constructor. * \param cmd - The CmdLine the output will be generated for. * \param out - The type of output. */ HelpVisitor(CmdLineInterface* cmd, CmdLineOutput** out) : Visitor(), _cmd( cmd ), _out( out ) { } /** * Calls the usage method of the CmdLineOutput for the * specified CmdLine. */ void visit() { (*_out)->usage(*_cmd); throw ExitException(0); } }; } #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/Makefile.in0000644000175000017500000002660612320456500022463 0ustar mathieumathieu# Makefile.in generated by automake 1.9.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = include/tclap DIST_COMMON = $(libtclapinclude_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/ac_cxx_have_long_long.m4 \ $(top_srcdir)/config/ac_cxx_have_sstream.m4 \ $(top_srcdir)/config/ac_cxx_have_strstream.m4 \ $(top_srcdir)/config/ac_cxx_namespaces.m4 \ $(top_srcdir)/config/bb_enable_doxygen.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libtclapincludedir)" libtclapincludeHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(libtclapinclude_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DOC_FALSE = @DOC_FALSE@ DOC_TRUE = @DOC_TRUE@ DOT = @DOT@ DOXYGEN = @DOXYGEN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ HAVE_GNU_COMPILERS_FALSE = @HAVE_GNU_COMPILERS_FALSE@ HAVE_GNU_COMPILERS_TRUE = @HAVE_GNU_COMPILERS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ datadir = @datadir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ libtclapincludedir = $(includedir)/tclap libtclapinclude_HEADERS = \ CmdLineInterface.h \ ArgException.h \ CmdLine.h \ XorHandler.h \ MultiArg.h \ UnlabeledMultiArg.h \ ValueArg.h \ UnlabeledValueArg.h \ Visitor.h Arg.h \ HelpVisitor.h \ SwitchArg.h \ MultiSwitchArg.h \ VersionVisitor.h \ IgnoreRestVisitor.h \ CmdLineOutput.h \ StdOutput.h \ DocBookOutput.h \ ZshCompletionOutput.h \ OptionalUnlabeledTracker.h \ Constraint.h \ ValuesConstraint.h \ ArgTraits.h \ StandardTraits.h all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/tclap/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu include/tclap/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-libtclapincludeHEADERS: $(libtclapinclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(libtclapincludedir)" || $(mkdir_p) "$(DESTDIR)$(libtclapincludedir)" @list='$(libtclapinclude_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(libtclapincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libtclapincludedir)/$$f'"; \ $(libtclapincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libtclapincludedir)/$$f"; \ done uninstall-libtclapincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(libtclapinclude_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(libtclapincludedir)/$$f'"; \ rm -f "$(DESTDIR)$(libtclapincludedir)/$$f"; \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(HEADERS) installdirs: for dir in "$(DESTDIR)$(libtclapincludedir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-libtclapincludeHEADERS install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am uninstall-libtclapincludeHEADERS .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ ctags distclean distclean-generic distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-exec install-exec-am \ install-info install-info-am install-libtclapincludeHEADERS \ install-man install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ uninstall uninstall-am uninstall-info-am \ uninstall-libtclapincludeHEADERS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/Makefile0000644000175000017500000002657212320456500022060 0ustar mathieumathieu# Makefile.in generated by automake 1.9.2 from Makefile.am. # include/tclap/Makefile. Generated from Makefile.in by configure. # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. srcdir = . top_srcdir = ../.. pkgdatadir = $(datadir)/tclap pkglibdir = $(libdir)/tclap pkgincludedir = $(includedir)/tclap top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = /usr/bin/install -c install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = include/tclap DIST_COMMON = $(libtclapinclude_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/ac_cxx_have_long_long.m4 \ $(top_srcdir)/config/ac_cxx_have_sstream.m4 \ $(top_srcdir)/config/ac_cxx_have_strstream.m4 \ $(top_srcdir)/config/ac_cxx_namespaces.m4 \ $(top_srcdir)/config/bb_enable_doxygen.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libtclapincludedir)" libtclapincludeHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(libtclapinclude_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = aclocal -I /home/tfogal/shigeru/share/aclocal AMDEP_FALSE = # AMDEP_TRUE = AMTAR = ${SHELL} /home/tfogal/tmp/opt/tclap-1.2.0/config/missing --run tar AUTOCONF = ${SHELL} /home/tfogal/tmp/opt/tclap-1.2.0/config/missing --run autoconf AUTOHEADER = ${SHELL} /home/tfogal/tmp/opt/tclap-1.2.0/config/missing --run autoheader AUTOMAKE = ${SHELL} /home/tfogal/tmp/opt/tclap-1.2.0/config/missing --run automake-1.9 AWK = gawk CPPFLAGS = CXX = g++ CXXCPP = g++ -E CXXDEPMODE = depmode=gcc3 CXXFLAGS = -g -O2 CYGPATH_W = echo DEFS = -DHAVE_CONFIG_H DEPDIR = .deps DOC_FALSE = # DOC_TRUE = DOT = YES DOXYGEN = /usr/bin/doxygen ECHO_C = ECHO_N = -n ECHO_T = EGREP = grep -E EXEEXT = HAVE_GNU_COMPILERS_FALSE = # HAVE_GNU_COMPILERS_TRUE = INSTALL_DATA = ${INSTALL} -m 644 INSTALL_PROGRAM = ${INSTALL} INSTALL_SCRIPT = ${INSTALL} INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s LDFLAGS = LIBOBJS = LIBS = LTLIBOBJS = MAKEINFO = ${SHELL} /home/tfogal/tmp/opt/tclap-1.2.0/config/missing --run makeinfo OBJEXT = o PACKAGE = tclap PACKAGE_BUGREPORT = PACKAGE_NAME = PACKAGE_STRING = PACKAGE_TARNAME = PACKAGE_VERSION = PATH_SEPARATOR = : RANLIB = ranlib SET_MAKE = SHELL = /bin/sh STRIP = VERSION = 1.2.0 ac_ct_CXX = g++ ac_ct_RANLIB = ranlib ac_ct_STRIP = am__fastdepCXX_FALSE = # am__fastdepCXX_TRUE = am__include = include am__leading_dot = . am__quote = am__tar = ${AMTAR} chof - "$$tardir" am__untar = ${AMTAR} xf - bindir = ${exec_prefix}/bin build_alias = datadir = ${prefix}/share exec_prefix = ${prefix} host_alias = includedir = ${prefix}/include infodir = ${prefix}/info install_sh = /home/tfogal/tmp/opt/tclap-1.2.0/config/install-sh libdir = ${exec_prefix}/lib libexecdir = ${exec_prefix}/libexec localstatedir = ${prefix}/var mandir = ${prefix}/man mkdir_p = mkdir -p -- oldincludedir = /usr/include prefix = /usr/local program_transform_name = s,x,x, sbindir = ${exec_prefix}/sbin sharedstatedir = ${prefix}/com sysconfdir = ${prefix}/etc target_alias = libtclapincludedir = $(includedir)/tclap libtclapinclude_HEADERS = \ CmdLineInterface.h \ ArgException.h \ CmdLine.h \ XorHandler.h \ MultiArg.h \ UnlabeledMultiArg.h \ ValueArg.h \ UnlabeledValueArg.h \ Visitor.h Arg.h \ HelpVisitor.h \ SwitchArg.h \ MultiSwitchArg.h \ VersionVisitor.h \ IgnoreRestVisitor.h \ CmdLineOutput.h \ StdOutput.h \ DocBookOutput.h \ ZshCompletionOutput.h \ OptionalUnlabeledTracker.h \ Constraint.h \ ValuesConstraint.h \ ArgTraits.h \ StandardTraits.h all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/tclap/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu include/tclap/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-libtclapincludeHEADERS: $(libtclapinclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(libtclapincludedir)" || $(mkdir_p) "$(DESTDIR)$(libtclapincludedir)" @list='$(libtclapinclude_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(libtclapincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libtclapincludedir)/$$f'"; \ $(libtclapincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libtclapincludedir)/$$f"; \ done uninstall-libtclapincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(libtclapinclude_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(libtclapincludedir)/$$f'"; \ rm -f "$(DESTDIR)$(libtclapincludedir)/$$f"; \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(HEADERS) installdirs: for dir in "$(DESTDIR)$(libtclapincludedir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-libtclapincludeHEADERS install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am uninstall-libtclapincludeHEADERS .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ ctags distclean distclean-generic distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-exec install-exec-am \ install-info install-info-am install-libtclapincludeHEADERS \ install-man install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ uninstall uninstall-am uninstall-info-am \ uninstall-libtclapincludeHEADERS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/CmdLineInterface.h0000644000175000017500000000705312320456500023716 0ustar mathieumathieu /****************************************************************************** * * file: CmdLineInterface.h * * Copyright (c) 2003, Michael E. Smoot . * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ #ifndef TCLAP_COMMANDLINE_INTERFACE_H #define TCLAP_COMMANDLINE_INTERFACE_H #include #include #include #include #include namespace TCLAP { class Arg; class CmdLineOutput; class XorHandler; /** * The base class that manages the command line definition and passes * along the parsing to the appropriate Arg classes. */ class CmdLineInterface { public: /** * Destructor */ virtual ~CmdLineInterface() {} /** * Adds an argument to the list of arguments to be parsed. * \param a - Argument to be added. */ virtual void add( Arg& a )=0; /** * An alternative add. Functionally identical. * \param a - Argument to be added. */ virtual void add( Arg* a )=0; /** * Add two Args that will be xor'd. * If this method is used, add does * not need to be called. * \param a - Argument to be added and xor'd. * \param b - Argument to be added and xor'd. */ virtual void xorAdd( Arg& a, Arg& b )=0; /** * Add a list of Args that will be xor'd. If this method is used, * add does not need to be called. * \param xors - List of Args to be added and xor'd. */ virtual void xorAdd( std::vector& xors )=0; /** * Parses the command line. * \param argc - Number of arguments. * \param argv - Array of arguments. */ virtual void parse(int argc, const char * const * argv)=0; /** * Parses the command line. * \param args - A vector of strings representing the args. * args[0] is still the program name. */ void parse(std::vector& args); /** * Returns the CmdLineOutput object. */ virtual CmdLineOutput* getOutput()=0; /** * \param co - CmdLineOutput object that we want to use instead. */ virtual void setOutput(CmdLineOutput* co)=0; /** * Returns the version string. */ virtual std::string& getVersion()=0; /** * Returns the program name string. */ virtual std::string& getProgramName()=0; /** * Returns the argList. */ virtual std::list& getArgList()=0; /** * Returns the XorHandler. */ virtual XorHandler& getXorHandler()=0; /** * Returns the delimiter string. */ virtual char getDelimiter()=0; /** * Returns the message string. */ virtual std::string& getMessage()=0; /** * Indicates whether or not the help and version switches were created * automatically. */ virtual bool hasHelpAndVersion()=0; /** * Resets the instance as if it had just been constructed so that the * instance can be reused. */ virtual void reset()=0; }; } //namespace #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/tclap/CmdLineOutput.h0000644000175000017500000000360512320456500023315 0ustar mathieumathieu /****************************************************************************** * * file: CmdLineOutput.h * * Copyright (c) 2004, Michael E. Smoot * All rights reverved. * * See the file COPYING in the top directory of this distribution for * more information. * * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ #ifndef TCLAP_CMDLINEOUTPUT_H #define TCLAP_CMDLINEOUTPUT_H #include #include #include #include #include #include namespace TCLAP { class CmdLineInterface; class ArgException; /** * The interface that any output object must implement. */ class CmdLineOutput { public: /** * Virtual destructor. */ virtual ~CmdLineOutput() {} /** * Generates some sort of output for the USAGE. * \param c - The CmdLine object the output is generated for. */ virtual void usage(CmdLineInterface& c)=0; /** * Generates some sort of output for the version. * \param c - The CmdLine object the output is generated for. */ virtual void version(CmdLineInterface& c)=0; /** * Generates some sort of output for a failure. * \param c - The CmdLine object the output is generated for. * \param e - The ArgException that caused the failure. */ virtual void failure( CmdLineInterface& c, ArgException& e )=0; }; } //namespace TCLAP #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/0000755000175000017500000000000012320456500020427 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config.hpp0000644000175000017500000000400212320456500022401 0ustar mathieumathieu// Boost config.hpp configuration header file ------------------------------// // (C) Copyright John Maddock 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/config for most recent version. // Boost config.hpp policy and rationale documentation has been moved to // http://www.boost.org/libs/config // // CAUTION: This file is intended to be completely stable - // DO NOT MODIFY THIS FILE! // #ifndef BOOST_CONFIG_HPP #define BOOST_CONFIG_HPP // if we don't have a user config, then use the default location: #if !defined(BOOST_USER_CONFIG) && !defined(BOOST_NO_USER_CONFIG) # define BOOST_USER_CONFIG #endif // include it first: #ifdef BOOST_USER_CONFIG # include BOOST_USER_CONFIG #endif // if we don't have a compiler config set, try and find one: #if !defined(BOOST_COMPILER_CONFIG) && !defined(BOOST_NO_COMPILER_CONFIG) && !defined(BOOST_NO_CONFIG) # include #endif // if we have a compiler config, include it now: #ifdef BOOST_COMPILER_CONFIG # include BOOST_COMPILER_CONFIG #endif // if we don't have a std library config set, try and find one: #if !defined(BOOST_STDLIB_CONFIG) && !defined(BOOST_NO_STDLIB_CONFIG) && !defined(BOOST_NO_CONFIG) # include #endif // if we have a std library config, include it now: #ifdef BOOST_STDLIB_CONFIG # include BOOST_STDLIB_CONFIG #endif // if we don't have a platform config set, try and find one: #if !defined(BOOST_PLATFORM_CONFIG) && !defined(BOOST_NO_PLATFORM_CONFIG) && !defined(BOOST_NO_CONFIG) # include #endif // if we have a platform config, include it now: #ifdef BOOST_PLATFORM_CONFIG # include BOOST_PLATFORM_CONFIG #endif // get config suffix code: #include #endif // BOOST_CONFIG_HPP ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/limits.hpp0000644000175000017500000001374712320456500022455 0ustar mathieumathieu // (C) Copyright John maddock 1999. // (C) David Abrahams 2002. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // use this header as a workaround for missing // See http://www.boost.org/libs/compatibility/index.html for documentation. #ifndef BOOST_LIMITS #define BOOST_LIMITS #include #ifdef BOOST_NO_LIMITS # include #else # include #endif #if (defined(BOOST_HAS_LONG_LONG) && defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS)) \ || (defined(BOOST_HAS_MS_INT64) && defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS)) // Add missing specializations for numeric_limits: #ifdef BOOST_HAS_MS_INT64 # define BOOST_LLT __int64 # define BOOST_ULLT unsigned __int64 #else # define BOOST_LLT ::boost::long_long_type # define BOOST_ULLT ::boost::ulong_long_type #endif #include // for CHAR_BIT namespace std { template<> class numeric_limits { public: BOOST_STATIC_CONSTANT(bool, is_specialized = true); #ifdef BOOST_HAS_MS_INT64 static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0x8000000000000000i64; } static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0x7FFFFFFFFFFFFFFFi64; } #elif defined(LLONG_MAX) static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LLONG_MIN; } static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LLONG_MAX; } #elif defined(LONGLONG_MAX) static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LONGLONG_MIN; } static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LONGLONG_MAX; } #else static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 1LL << (sizeof(BOOST_LLT) * CHAR_BIT - 1); } static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ~(min)(); } #endif BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT -1); BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT) - 1) * 301L / 1000); BOOST_STATIC_CONSTANT(bool, is_signed = true); BOOST_STATIC_CONSTANT(bool, is_integer = true); BOOST_STATIC_CONSTANT(bool, is_exact = true); BOOST_STATIC_CONSTANT(int, radix = 2); static BOOST_LLT epsilon() throw() { return 0; }; static BOOST_LLT round_error() throw() { return 0; }; BOOST_STATIC_CONSTANT(int, min_exponent = 0); BOOST_STATIC_CONSTANT(int, min_exponent10 = 0); BOOST_STATIC_CONSTANT(int, max_exponent = 0); BOOST_STATIC_CONSTANT(int, max_exponent10 = 0); BOOST_STATIC_CONSTANT(bool, has_infinity = false); BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false); BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false); BOOST_STATIC_CONSTANT(bool, has_denorm = false); BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false); static BOOST_LLT infinity() throw() { return 0; }; static BOOST_LLT quiet_NaN() throw() { return 0; }; static BOOST_LLT signaling_NaN() throw() { return 0; }; static BOOST_LLT denorm_min() throw() { return 0; }; BOOST_STATIC_CONSTANT(bool, is_iec559 = false); BOOST_STATIC_CONSTANT(bool, is_bounded = true); BOOST_STATIC_CONSTANT(bool, is_modulo = true); BOOST_STATIC_CONSTANT(bool, traps = false); BOOST_STATIC_CONSTANT(bool, tinyness_before = false); BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero); }; template<> class numeric_limits { public: BOOST_STATIC_CONSTANT(bool, is_specialized = true); #ifdef BOOST_HAS_MS_INT64 static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0ui64; } static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0xFFFFFFFFFFFFFFFFui64; } #elif defined(ULLONG_MAX) && defined(ULLONG_MIN) static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULLONG_MIN; } static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULLONG_MAX; } #elif defined(ULONGLONG_MAX) && defined(ULONGLONG_MIN) static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULONGLONG_MIN; } static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULONGLONG_MAX; } #else static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0uLL; } static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ~0uLL; } #endif BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT); BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT)) * 301L / 1000); BOOST_STATIC_CONSTANT(bool, is_signed = false); BOOST_STATIC_CONSTANT(bool, is_integer = true); BOOST_STATIC_CONSTANT(bool, is_exact = true); BOOST_STATIC_CONSTANT(int, radix = 2); static BOOST_ULLT epsilon() throw() { return 0; }; static BOOST_ULLT round_error() throw() { return 0; }; BOOST_STATIC_CONSTANT(int, min_exponent = 0); BOOST_STATIC_CONSTANT(int, min_exponent10 = 0); BOOST_STATIC_CONSTANT(int, max_exponent = 0); BOOST_STATIC_CONSTANT(int, max_exponent10 = 0); BOOST_STATIC_CONSTANT(bool, has_infinity = false); BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false); BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false); BOOST_STATIC_CONSTANT(bool, has_denorm = false); BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false); static BOOST_ULLT infinity() throw() { return 0; }; static BOOST_ULLT quiet_NaN() throw() { return 0; }; static BOOST_ULLT signaling_NaN() throw() { return 0; }; static BOOST_ULLT denorm_min() throw() { return 0; }; BOOST_STATIC_CONSTANT(bool, is_iec559 = false); BOOST_STATIC_CONSTANT(bool, is_bounded = true); BOOST_STATIC_CONSTANT(bool, is_modulo = true); BOOST_STATIC_CONSTANT(bool, traps = false); BOOST_STATIC_CONSTANT(bool, tinyness_before = false); BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero); }; } #endif #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/0000755000175000017500000000000012320456500021674 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/platform/0000755000175000017500000000000012320456500023520 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/platform/beos.hpp0000644000175000017500000000112112320456500025154 0ustar mathieumathieu// (C) Copyright John Maddock 2001. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // BeOS specific config options: #define BOOST_PLATFORM "BeOS" #define BOOST_NO_CWCHAR #define BOOST_NO_CWCTYPE #define BOOST_HAS_UNISTD_H #define BOOST_HAS_BETHREADS #ifndef BOOST_DISABLE_THREADS # define BOOST_HAS_THREADS #endif // boilerplate code: #include ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/platform/linux.hpp0000644000175000017500000000465012320456500025375 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Jens Maurer 2001 - 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // linux specific config options: #define BOOST_PLATFORM "linux" // make sure we have __GLIBC_PREREQ if available at all #include // // added to glibc 2.1.1 // We can only test for 2.1 though: // #if defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))) // defines int64_t unconditionally, but defines // int64_t only if __GNUC__. Thus, assume a fully usable // only when using GCC. # if defined __GNUC__ # define BOOST_HAS_STDINT_H # endif #endif #if defined(__LIBCOMO__) // // como on linux doesn't have std:: c functions: // NOTE: versions of libcomo prior to beta28 have octal version numbering, // e.g. version 25 is 21 (dec) // # if __LIBCOMO_VERSION__ <= 20 # define BOOST_NO_STDC_NAMESPACE # endif # if __LIBCOMO_VERSION__ <= 21 # define BOOST_NO_SWPRINTF # endif #endif // // If glibc is past version 2 then we definitely have // gettimeofday, earlier versions may or may not have it: // #if defined(__GLIBC__) && (__GLIBC__ >= 2) # define BOOST_HAS_GETTIMEOFDAY #endif #ifdef __USE_POSIX199309 # define BOOST_HAS_NANOSLEEP #endif #if defined(__GLIBC__) && defined(__GLIBC_PREREQ) // __GLIBC_PREREQ is available since 2.1.2 // swprintf is available since glibc 2.2.0 # if !__GLIBC_PREREQ(2,2) || (!defined(__USE_ISOC99) && !defined(__USE_UNIX98)) # define BOOST_NO_SWPRINTF # endif #else # define BOOST_NO_SWPRINTF #endif // boilerplate code: #define BOOST_HAS_UNISTD_H #include #ifndef __GNUC__ // // if the compiler is not gcc we still need to be able to parse // the GNU system headers, some of which (mainly ) // use GNU specific extensions: // # ifndef __extension__ # define __extension__ # endif # ifndef __const__ # define __const__ const # endif # ifndef __volatile__ # define __volatile__ volatile # endif # ifndef __signed__ # define __signed__ signed # endif # ifndef __typeof__ # define __typeof__ typeof # endif # ifndef __inline__ # define __inline__ inline # endif #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/platform/cygwin.hpp0000644000175000017500000000240312320456500025530 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // cygwin specific config options: #define BOOST_PLATFORM "Cygwin" #define BOOST_NO_CWCTYPE #define BOOST_NO_CWCHAR #define BOOST_NO_SWPRINTF #define BOOST_HAS_DIRENT_H #define BOOST_HAS_LOG1P #define BOOST_HAS_EXPM1 // // Threading API: // See if we have POSIX threads, if we do use them, otherwise // revert to native Win threads. #define BOOST_HAS_UNISTD_H #include #if defined(_POSIX_THREADS) && (_POSIX_THREADS+0 >= 0) && !defined(BOOST_HAS_WINTHREADS) # define BOOST_HAS_PTHREADS # define BOOST_HAS_SCHED_YIELD # define BOOST_HAS_GETTIMEOFDAY # define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE # define BOOST_HAS_SIGACTION #else # if !defined(BOOST_HAS_WINTHREADS) # define BOOST_HAS_WINTHREADS # endif # define BOOST_HAS_FTIME #endif // // find out if we have a stdint.h, there should be a better way to do this: // #include #ifdef _STDINT_H #define BOOST_HAS_STDINT_H #endif // boilerplate code: #include ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/platform/bsd.hpp0000644000175000017500000000464512320456500025012 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Darin Adler 2001. // (C) Copyright Douglas Gregor 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // generic BSD config options: #if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__) #error "This platform is not BSD" #endif #ifdef __FreeBSD__ #define BOOST_PLATFORM "FreeBSD " BOOST_STRINGIZE(__FreeBSD__) #elif defined(__NetBSD__) #define BOOST_PLATFORM "NetBSD " BOOST_STRINGIZE(__NetBSD__) #elif defined(__OpenBSD__) #define BOOST_PLATFORM "OpenBSD " BOOST_STRINGIZE(__OpenBSD__) #elif defined(__DragonFly__) #define BOOST_PLATFORM "DragonFly " BOOST_STRINGIZE(__DragonFly__) #endif // // is this the correct version check? // FreeBSD has but does not // advertise the fact in : // #if (defined(__FreeBSD__) && (__FreeBSD__ >= 3)) || defined(__DragonFly__) # define BOOST_HAS_NL_TYPES_H #endif // // FreeBSD 3.x has pthreads support, but defines _POSIX_THREADS in // and not in // #if (defined(__FreeBSD__) && (__FreeBSD__ <= 3))\ || defined(__OpenBSD__) || defined(__DragonFly__) # define BOOST_HAS_PTHREADS #endif // // No wide character support in the BSD header files: // #if defined(__NetBSD__) #define __NetBSD_GCC__ (__GNUC__ * 1000000 \ + __GNUC_MINOR__ * 1000 \ + __GNUC_PATCHLEVEL__) // XXX - the following is required until c++config.h // defines _GLIBCXX_HAVE_SWPRINTF and friends // or the preprocessor conditionals are removed // from the cwchar header. #define _GLIBCXX_HAVE_SWPRINTF 1 #endif #if !((defined(__FreeBSD__) && (__FreeBSD__ >= 5)) \ || (__NetBSD_GCC__ >= 2095003) || defined(__DragonFly__)) # define BOOST_NO_CWCHAR #endif // // The BSD has macros only, no functions: // #if !defined(__OpenBSD__) || defined(__DragonFly__) # define BOOST_NO_CTYPE_FUNCTIONS #endif // // thread API's not auto detected: // #define BOOST_HAS_SCHED_YIELD #define BOOST_HAS_NANOSLEEP #define BOOST_HAS_GETTIMEOFDAY #define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE #define BOOST_HAS_SIGACTION // boilerplate code: #define BOOST_HAS_UNISTD_H #include ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/platform/macos.hpp0000644000175000017500000000452612320456500025342 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Darin Adler 2001 - 2002. // (C) Copyright Bill Kempf 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Mac OS specific config options: #define BOOST_PLATFORM "Mac OS" #if __MACH__ && !defined(_MSL_USING_MSL_C) // Using the Mac OS X system BSD-style C library. # ifndef BOOST_HAS_UNISTD_H # define BOOST_HAS_UNISTD_H # endif // // Begin by including our boilerplate code for POSIX // feature detection, this is safe even when using // the MSL as Metrowerks supply their own // to replace the platform-native BSD one. G++ users // should also always be able to do this on MaxOS X. // # include # ifndef BOOST_HAS_STDINT_H # define BOOST_HAS_STDINT_H # endif // // BSD runtime has pthreads, sigaction, sched_yield and gettimeofday, // of these only pthreads are advertised in , so set the // other options explicitly: // # define BOOST_HAS_SCHED_YIELD # define BOOST_HAS_GETTIMEOFDAY # define BOOST_HAS_SIGACTION # if (__GNUC__ < 3) && !defined( __APPLE_CC__) // GCC strange "ignore std" mode works better if you pretend everything // is in the std namespace, for the most part. # define BOOST_NO_STDC_NAMESPACE # endif # if (__GNUC__ == 4) // Both gcc and intel require these. # define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE # define BOOST_HAS_NANOSLEEP # endif #else // Using the MSL C library. // We will eventually support threads in non-Carbon builds, but we do // not support this yet. # if ( defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON ) || ( defined(TARGET_CARBON) && TARGET_CARBON ) # if !defined(BOOST_HAS_PTHREADS) # define BOOST_HAS_MPTASKS # elif ( __dest_os == __mac_os_x ) // We are doing a Carbon/Mach-O/MSL build which has pthreads, but only the // gettimeofday and no posix. # define BOOST_HAS_GETTIMEOFDAY # endif // The MP task implementation of Boost Threads aims to replace MP-unsafe // parts of the MSL, so we turn on threads unconditionally. # define BOOST_HAS_THREADS // The remote call manager depends on this. # define BOOST_BIND_ENABLE_PASCAL # endif #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/platform/win32.hpp0000644000175000017500000000316312320456500025176 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Bill Kempf 2001. // (C) Copyright Aleksey Gurtovoy 2003. // (C) Copyright Rene Rivera 2005. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Win32 specific config options: #define BOOST_PLATFORM "Win32" // Get the information about the MinGW runtime, i.e. __MINGW32_*VERSION. #if defined(__MINGW32__) # include <_mingw.h> #endif #if defined(__GNUC__) && !defined(BOOST_NO_SWPRINTF) # define BOOST_NO_SWPRINTF #endif #if !defined(__GNUC__) && !defined(BOOST_HAS_DECLSPEC) # define BOOST_HAS_DECLSPEC #endif #if defined(__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 2) || ((__MINGW32_MAJOR_VERSION == 2) && (__MINGW32_MINOR_VERSION >= 0))) # define BOOST_HAS_STDINT_H # define __STDC_LIMIT_MACROS # define BOOST_HAS_DIRENT_H # define BOOST_HAS_UNISTD_H #endif // // Win32 will normally be using native Win32 threads, // but there is a pthread library avaliable as an option, // we used to disable this when BOOST_DISABLE_WIN32 was // defined but no longer - this should allow some // files to be compiled in strict mode - while maintaining // a consistent setting of BOOST_HAS_THREADS across // all translation units (needed for shared_ptr etc). // #ifdef _WIN32_WCE # define BOOST_NO_ANSI_APIS #endif #ifndef BOOST_HAS_PTHREADS # define BOOST_HAS_WINTHREADS #endif #ifndef BOOST_DISABLE_WIN32 // WEK: Added #define BOOST_HAS_FTIME #define BOOST_WINDOWS 1 #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/platform/solaris.hpp0000644000175000017500000000131112320456500025701 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Jens Maurer 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // sun specific config options: #define BOOST_PLATFORM "Sun Solaris" #define BOOST_HAS_GETTIMEOFDAY // boilerplate code: #define BOOST_HAS_UNISTD_H #include // // pthreads don't actually work with gcc unless _PTHREADS is defined: // #if defined(__GNUC__) && defined(_POSIX_THREADS) && !defined(_PTHREADS) # undef BOOST_HAS_PTHREADS #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/platform/hpux.hpp0000644000175000017500000000465512320456500025227 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Jens Maurer 2001 - 2003. // (C) Copyright David Abrahams 2002. // (C) Copyright Toon Knapen 2003. // (C) Copyright Boris Gubenko 2006 - 2007. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // hpux specific config options: #define BOOST_PLATFORM "HP-UX" // In principle, HP-UX has a nice under the name // However, it has the following problem: // Use of UINT32_C(0) results in "0u l" for the preprocessed source // (verifyable with gcc 2.95.3) #if (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__HP_aCC) # define BOOST_HAS_STDINT_H #endif #if !(defined(__HP_aCC) || !defined(_INCLUDE__STDC_A1_SOURCE)) # define BOOST_NO_SWPRINTF #endif #if defined(__HP_aCC) && !defined(_INCLUDE__STDC_A1_SOURCE) # define BOOST_NO_CWCTYPE #endif #if defined(__GNUC__) # if (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3)) // GNU C on HP-UX does not support threads (checked up to gcc 3.3) # define BOOST_DISABLE_THREADS # elif !defined(BOOST_DISABLE_THREADS) // threads supported from gcc-3.3 onwards: # define BOOST_HAS_THREADS # define BOOST_HAS_PTHREADS # endif #elif defined(__HP_aCC) && !defined(BOOST_DISABLE_THREADS) # define BOOST_HAS_PTHREADS #endif // boilerplate code: #define BOOST_HAS_UNISTD_H #include // the following are always available: #ifndef BOOST_HAS_GETTIMEOFDAY # define BOOST_HAS_GETTIMEOFDAY #endif #ifndef BOOST_HAS_SCHED_YIELD # define BOOST_HAS_SCHED_YIELD #endif #ifndef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE # define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE #endif #ifndef BOOST_HAS_NL_TYPES_H # define BOOST_HAS_NL_TYPES_H #endif #ifndef BOOST_HAS_NANOSLEEP # define BOOST_HAS_NANOSLEEP #endif #ifndef BOOST_HAS_GETTIMEOFDAY # define BOOST_HAS_GETTIMEOFDAY #endif #ifndef BOOST_HAS_DIRENT_H # define BOOST_HAS_DIRENT_H #endif #ifndef BOOST_HAS_CLOCK_GETTIME # define BOOST_HAS_CLOCK_GETTIME #endif #ifndef BOOST_HAS_SIGACTION # define BOOST_HAS_SIGACTION #endif #ifndef BOOST_HAS_NRVO # ifndef __parisc # define BOOST_HAS_NRVO # endif #endif #ifndef BOOST_HAS_LOG1P # define BOOST_HAS_LOG1P #endif #ifndef BOOST_HAS_EXPM1 # define BOOST_HAS_EXPM1 #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/platform/irix.hpp0000644000175000017500000000142512320456500025206 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Jens Maurer 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // SGI Irix specific config options: #define BOOST_PLATFORM "SGI Irix" #define BOOST_NO_SWPRINTF // // these are not auto detected by POSIX feature tests: // #define BOOST_HAS_GETTIMEOFDAY #define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE #ifdef __GNUC__ // GNU C on IRIX does not support threads (checked up to gcc 3.3) # define BOOST_DISABLE_THREADS #endif // boilerplate code: #define BOOST_HAS_UNISTD_H #include ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/platform/qnxnto.hpp0000644000175000017500000000137612320456500025567 0ustar mathieumathieu// (C) Copyright Jim Douglas 2005. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // QNX specific config options: #define BOOST_PLATFORM "QNX" #define BOOST_HAS_UNISTD_H #include // QNX claims XOpen version 5 compatibility, but doesn't have an nl_types.h // or log1p and expm1: #undef BOOST_HAS_NL_TYPES_H #undef BOOST_HAS_LOG1P #undef BOOST_HAS_EXPM1 #define BOOST_HAS_PTHREADS #define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE #define BOOST_HAS_GETTIMEOFDAY #define BOOST_HAS_CLOCK_GETTIME #define BOOST_HAS_NANOSLEEP ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/platform/amigaos.hpp0000644000175000017500000000067212320456500025656 0ustar mathieumathieu// (C) Copyright John Maddock 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. #define BOOST_PLATFORM "AmigaOS" #define BOOST_DISABLE_THREADS #define BOOST_NO_CWCHAR #define BOOST_NO_STD_WSTRING #define BOOST_NO_INTRINSIC_WCHAR_T ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/platform/aix.hpp0000644000175000017500000000156112320456500025015 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // IBM/Aix specific config options: #define BOOST_PLATFORM "IBM Aix" #define BOOST_HAS_UNISTD_H #define BOOST_HAS_NL_TYPES_H #define BOOST_HAS_NANOSLEEP #define BOOST_HAS_CLOCK_GETTIME // This needs support in "boost/cstdint.hpp" exactly like FreeBSD. // This platform has header named which includes all // the things needed. #define BOOST_HAS_STDINT_H // Threading API's: #define BOOST_HAS_PTHREADS #define BOOST_HAS_PTHREAD_DELAY_NP #define BOOST_HAS_SCHED_YIELD //#define BOOST_HAS_PTHREAD_YIELD // boilerplate code: #include ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/select_compiler_config.hpp0000644000175000017500000000723212320456500027107 0ustar mathieumathieu// Boost compiler configuration selection header file // (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Martin Wille 2003. // (C) Copyright Guillaume Melquiond 2003. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/ for most recent version. // one identification macro for each of the // compilers we support: # define BOOST_CXX_GCCXML 0 # define BOOST_CXX_COMO 0 # define BOOST_CXX_DMC 0 # define BOOST_CXX_INTEL 0 # define BOOST_CXX_GNUC 0 # define BOOST_CXX_KCC 0 # define BOOST_CXX_SGI 0 # define BOOST_CXX_TRU64 0 # define BOOST_CXX_GHS 0 # define BOOST_CXX_BORLAND 0 # define BOOST_CXX_CW 0 # define BOOST_CXX_SUNPRO 0 # define BOOST_CXX_HPACC 0 # define BOOST_CXX_MPW 0 # define BOOST_CXX_IBMCPP 0 # define BOOST_CXX_MSVC 0 # define BOOST_CXX_PGI 0 // locate which compiler we are using and define // BOOST_COMPILER_CONFIG as needed: #if defined(__GCCXML__) // GCC-XML emulates other compilers, it has to appear first here! # define BOOST_COMPILER_CONFIG "boost/config/compiler/gcc_xml.hpp" #elif defined __COMO__ // Comeau C++ # define BOOST_COMPILER_CONFIG "boost/config/compiler/comeau.hpp" #elif defined __DMC__ // Digital Mars C++ # define BOOST_COMPILER_CONFIG "boost/config/compiler/digitalmars.hpp" #elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC) // Intel # define BOOST_COMPILER_CONFIG "boost/config/compiler/intel.hpp" # elif defined __GNUC__ // GNU C++: # define BOOST_COMPILER_CONFIG "boost/config/compiler/gcc.hpp" #elif defined __KCC // Kai C++ # define BOOST_COMPILER_CONFIG "boost/config/compiler/kai.hpp" #elif defined __sgi // SGI MIPSpro C++ # define BOOST_COMPILER_CONFIG "boost/config/compiler/sgi_mipspro.hpp" #elif defined __DECCXX // Compaq Tru64 Unix cxx # define BOOST_COMPILER_CONFIG "boost/config/compiler/compaq_cxx.hpp" #elif defined __ghs // Greenhills C++ # define BOOST_COMPILER_CONFIG "boost/config/compiler/greenhills.hpp" #elif defined __CODEGEARC__ // CodeGear - must be checked for before Borland # define BOOST_COMPILER_CONFIG "boost/config/compiler/codegear.hpp" #elif defined __BORLANDC__ // Borland # define BOOST_COMPILER_CONFIG "boost/config/compiler/borland.hpp" #elif defined __MWERKS__ // Metrowerks CodeWarrior # define BOOST_COMPILER_CONFIG "boost/config/compiler/metrowerks.hpp" #elif defined __SUNPRO_CC // Sun Workshop Compiler C++ # define BOOST_COMPILER_CONFIG "boost/config/compiler/sunpro_cc.hpp" #elif defined __HP_aCC // HP aCC # define BOOST_COMPILER_CONFIG "boost/config/compiler/hp_acc.hpp" #elif defined(__MRC__) || defined(__SC__) // MPW MrCpp or SCpp # define BOOST_COMPILER_CONFIG "boost/config/compiler/mpw.hpp" #elif defined(__IBMCPP__) // IBM Visual Age # define BOOST_COMPILER_CONFIG "boost/config/compiler/vacpp.hpp" #elif defined(__PGI) // Portland Group Inc. # define BOOST_COMPILER_CONFIG "boost/config/compiler/pgi.hpp" #elif defined _MSC_VER // Microsoft Visual C++ // // Must remain the last #elif since some other vendors (Metrowerks, for // example) also #define _MSC_VER # define BOOST_COMPILER_CONFIG "boost/config/compiler/visualc.hpp" #elif defined (BOOST_ASSERT_CONFIG) // this must come last - generate an error if we don't // recognise the compiler: # error "Unknown compiler - please configure (http://www.boost.org/libs/config/config.htm#configuring) and report the results to the main boost mailing list (http://www.boost.org/more/mailing_lists.htm#main)" #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/abi/0000755000175000017500000000000012320456500022427 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/abi/borland_suffix.hpp0000644000175000017500000000043012320456500026142 0ustar mathieumathieu// (C) Copyright John Maddock 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) # pragma option pop #pragma nopushoptwarn ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/abi/msvc_suffix.hpp0000644000175000017500000000037412320456500025500 0ustar mathieumathieu// (C) Copyright John Maddock 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #pragma pack(pop) ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/abi/borland_prefix.hpp0000644000175000017500000000174712320456500026147 0ustar mathieumathieu// (C) Copyright John Maddock 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // for C++ Builder the following options effect the ABI: // // -b (on or off - effect emum sizes) // -Vx (on or off - empty members) // -Ve (on or off - empty base classes) // -aX (alignment - 5 options). // -pX (Calling convention - 4 options) // -VmX (member pointer size and layout - 5 options) // -VC (on or off, changes name mangling) // -Vl (on or off, changes struct layout). // In addition the following warnings are sufficiently annoying (and // unfixable) to have them turned off by default: // // 8027 - functions containing [for|while] loops are not expanded inline // 8026 - functions taking class by value arguments are not expanded inline #pragma nopushoptwarn # pragma option push -Vx -Ve -a8 -b -pc -Vmv -VC- -Vl- -w-8027 -w-8026 ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/abi/msvc_prefix.hpp0000644000175000017500000000146312320456500025471 0ustar mathieumathieu// (C) Copyright John Maddock 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Boost binaries are built with the compiler's default ABI settings, // if the user changes their default alignment in the VS IDE then their // code will no longer be binary compatible with the bjam built binaries // unless this header is included to force Boost code into a consistent ABI. // // Note that inclusion of this header is only necessary for libraries with // separate source, header only libraries DO NOT need this as long as all // translation units are built with the same options. // #if defined(_M_X64) # pragma pack(push,16) #else # pragma pack(push,8) #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/requires_threads.hpp0000644000175000017500000000666312320456500025771 0ustar mathieumathieu// (C) Copyright John Maddock 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_CONFIG_REQUIRES_THREADS_HPP #define BOOST_CONFIG_REQUIRES_THREADS_HPP #ifndef BOOST_CONFIG_HPP # include #endif #if defined(BOOST_DISABLE_THREADS) // // special case to handle versions of gcc which don't currently support threads: // #if defined(__GNUC__) && ((__GNUC__ < 3) || (__GNUC_MINOR__ <= 3) || !defined(BOOST_STRICT_CONFIG)) // // this is checked up to gcc 3.3: // #if defined(__sgi) || defined(__hpux) # error "Multi-threaded programs are not supported by gcc on HPUX or Irix (last checked with gcc 3.3)" #endif #endif # error "Threading support unavaliable: it has been explicitly disabled with BOOST_DISABLE_THREADS" #elif !defined(BOOST_HAS_THREADS) # if defined __COMO__ // Comeau C++ # error "Compiler threading support is not turned on. Please set the correct command line options for threading: -D_MT (Windows) or -D_REENTRANT (Unix)" #elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC) // Intel #ifdef _WIN32 # error "Compiler threading support is not turned on. Please set the correct command line options for threading: either /MT /MTd /MD or /MDd" #else # error "Compiler threading support is not turned on. Please set the correct command line options for threading: -openmp" #endif # elif defined __GNUC__ // GNU C++: # error "Compiler threading support is not turned on. Please set the correct command line options for threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)" #elif defined __sgi // SGI MIPSpro C++ # error "Compiler threading support is not turned on. Please set the correct command line options for threading: -D_SGI_MP_SOURCE" #elif defined __DECCXX // Compaq Tru64 Unix cxx # error "Compiler threading support is not turned on. Please set the correct command line options for threading: -pthread" #elif defined __BORLANDC__ // Borland # error "Compiler threading support is not turned on. Please set the correct command line options for threading: -tWM" #elif defined __MWERKS__ // Metrowerks CodeWarrior # error "Compiler threading support is not turned on. Please set the correct command line options for threading: either -runtime sm, -runtime smd, -runtime dm, or -runtime dmd" #elif defined __SUNPRO_CC // Sun Workshop Compiler C++ # error "Compiler threading support is not turned on. Please set the correct command line options for threading: -mt" #elif defined __HP_aCC // HP aCC # error "Compiler threading support is not turned on. Please set the correct command line options for threading: -mt" #elif defined(__IBMCPP__) // IBM Visual Age # error "Compiler threading support is not turned on. Please compile the code with the xlC_r compiler" #elif defined _MSC_VER // Microsoft Visual C++ // // Must remain the last #elif since some other vendors (Metrowerks, for // example) also #define _MSC_VER # error "Compiler threading support is not turned on. Please set the correct command line options for threading: either /MT /MTd /MD or /MDd" #else # error "Compiler threading support is not turned on. Please consult your compiler's documentation for the appropriate options to use" #endif // compilers #endif // BOOST_HAS_THREADS #endif // BOOST_CONFIG_REQUIRES_THREADS_HPP ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/select_stdlib_config.hpp0000644000175000017500000000540712320456500026560 0ustar mathieumathieu// Boost compiler configuration selection header file // (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Jens Maurer 2001 - 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // locate which std lib we are using and define BOOST_STDLIB_CONFIG as needed: // First include to determine if some version of STLport is in use as the std lib // (do not rely on this header being included since users can short-circuit this header // if they know whose std lib they are using.) #include #if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) // STLPort library; this _must_ come first, otherwise since // STLport typically sits on top of some other library, we // can end up detecting that first rather than STLport: # define BOOST_STDLIB_CONFIG "boost/config/stdlib/stlport.hpp" #else // If our std lib was not some version of STLport, then include as it is about // the smallest of the std lib headers that includes real C++ stuff. (Some std libs do not // include their C++-related macros in so this additional include makes sure // we get those definitions) // (again do not rely on this header being included since users can short-circuit this // header if they know whose std lib they are using.) #include #if defined(__LIBCOMO__) // Comeau STL: #define BOOST_STDLIB_CONFIG "boost/config/stdlib/libcomo.hpp" #elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER) // Rogue Wave library: # define BOOST_STDLIB_CONFIG "boost/config/stdlib/roguewave.hpp" #elif defined(__GLIBCPP__) || defined(__GLIBCXX__) // GNU libstdc++ 3 # define BOOST_STDLIB_CONFIG "boost/config/stdlib/libstdcpp3.hpp" #elif defined(__STL_CONFIG_H) // generic SGI STL # define BOOST_STDLIB_CONFIG "boost/config/stdlib/sgi.hpp" #elif defined(__MSL_CPP__) // MSL standard lib: # define BOOST_STDLIB_CONFIG "boost/config/stdlib/msl.hpp" #elif defined(__IBMCPP__) // take the default VACPP std lib # define BOOST_STDLIB_CONFIG "boost/config/stdlib/vacpp.hpp" #elif defined(MSIPL_COMPILE_H) // Modena C++ standard library # define BOOST_STDLIB_CONFIG "boost/config/stdlib/modena.hpp" #elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER) // Dinkumware Library (this has to appear after any possible replacement libraries): # define BOOST_STDLIB_CONFIG "boost/config/stdlib/dinkumware.hpp" #elif defined (BOOST_ASSERT_CONFIG) // this must come last - generate an error if we don't // recognise the library: # error "Unknown standard library - please configure and report the results to boost.org" #endif #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/abi_prefix.hpp0000644000175000017500000000127212320456500024517 0ustar mathieumathieu// abi_prefix header -------------------------------------------------------// // (c) Copyright John Maddock 2003 // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt). #ifndef BOOST_CONFIG_ABI_PREFIX_HPP # define BOOST_CONFIG_ABI_PREFIX_HPP #else # error double inclusion of header boost/config/abi_prefix.hpp is an error #endif #include // this must occur after all other includes and before any code appears: #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif #if defined( __BORLANDC__ ) #pragma nopushoptwarn #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/warning_disable.hpp0000644000175000017500000000343412320456500025541 0ustar mathieumathieu// Copyright John Maddock 2008 // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // This file exists to turn off some overly-pedantic warning emitted // by certain compilers. You should include this header only in: // // * A test case, before any other headers, or, // * A library source file before any other headers. // // IT SHOULD NOT BE INCLUDED BY ANY BOOST HEADER. // // YOU SHOULD NOT INCLUDE IT IF YOU CAN REASONABLY FIX THE WARNING. // // The only warnings disabled here are those that are: // // * Quite unreasonably pedantic. // * Generally only emitted by a single compiler. // * Can't easily be fixed: for example if the vendors own std lib // code emits these warnings! // // Note that THIS HEADER MUST NOT INCLUDE ANY OTHER HEADERS: // not even std library ones! Doing so may turn the warning // off too late to be of any use. For example the VC++ C4996 // warning can be omitted from if that header is included // before or by this one :-( // #ifndef BOOST_CONFIG_WARNING_DISABLE_HPP #define BOOST_CONFIG_WARNING_DISABLE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1400) // Error 'function': was declared deprecated // http://msdn2.microsoft.com/en-us/library/ttcz0bys(VS.80).aspx // This error is emitted when you use some perfectly conforming // std lib functions in a perfectly correct way, and also by // some of Microsoft's own std lib code ! # pragma warning(disable:4996) #endif #if defined(__INTEL_COMPILER) || defined(__ICL) // As above: gives warning when a "deprecated" // std library function is encountered. # pragma warning(disable:1786) #endif #endif // BOOST_CONFIG_WARNING_DISABLE_HPP ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/select_platform_config.hpp0000644000175000017500000000552012320456500027117 0ustar mathieumathieu// Boost compiler configuration selection header file // (C) Copyright John Maddock 2001 - 2002. // (C) Copyright Jens Maurer 2001. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // locate which platform we are on and define BOOST_PLATFORM_CONFIG as needed. // Note that we define the headers to include using "header_name" not // in order to prevent macro expansion within the header // name (for example "linux" is a macro on linux systems). #if defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) // linux, also other platforms (Hurd etc) that use GLIBC, should these really have their own config headers though? # define BOOST_PLATFORM_CONFIG "boost/config/platform/linux.hpp" #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) // BSD: # define BOOST_PLATFORM_CONFIG "boost/config/platform/bsd.hpp" #elif defined(sun) || defined(__sun) // solaris: # define BOOST_PLATFORM_CONFIG "boost/config/platform/solaris.hpp" #elif defined(__sgi) // SGI Irix: # define BOOST_PLATFORM_CONFIG "boost/config/platform/irix.hpp" #elif defined(__hpux) // hp unix: # define BOOST_PLATFORM_CONFIG "boost/config/platform/hpux.hpp" #elif defined(__CYGWIN__) // cygwin is not win32: # define BOOST_PLATFORM_CONFIG "boost/config/platform/cygwin.hpp" #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) // win32: # define BOOST_PLATFORM_CONFIG "boost/config/platform/win32.hpp" #elif defined(__BEOS__) // BeOS # define BOOST_PLATFORM_CONFIG "boost/config/platform/beos.hpp" #elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) // MacOS # define BOOST_PLATFORM_CONFIG "boost/config/platform/macos.hpp" #elif defined(__IBMCPP__) || defined(_AIX) // IBM # define BOOST_PLATFORM_CONFIG "boost/config/platform/aix.hpp" #elif defined(__amigaos__) // AmigaOS # define BOOST_PLATFORM_CONFIG "boost/config/platform/amigaos.hpp" #elif defined(__QNXNTO__) // QNX: # define BOOST_PLATFORM_CONFIG "boost/config/platform/qnxnto.hpp" #elif defined(__VXWORKS__) // vxWorks: # define BOOST_PLATFORM_CONFIG "boost/config/platform/vxworks.hpp" #else # if defined(unix) \ || defined(__unix) \ || defined(_XOPEN_SOURCE) \ || defined(_POSIX_SOURCE) // generic unix platform: # ifndef BOOST_HAS_UNISTD_H # define BOOST_HAS_UNISTD_H # endif # include # endif # if defined (BOOST_ASSERT_CONFIG) // this must come last - generate an error if we don't // recognise the platform: # error "Unknown platform - please configure and report the results to boost.org" # endif #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/posix_features.hpp0000644000175000017500000000723012320456500025447 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // All POSIX feature tests go in this file, // Note that we test _POSIX_C_SOURCE and _XOPEN_SOURCE as well // _POSIX_VERSION and _XOPEN_VERSION: on some systems POSIX API's // may be present but none-functional unless _POSIX_C_SOURCE and // _XOPEN_SOURCE have been defined to the right value (it's up // to the user to do this *before* including any header, although // in most cases the compiler will do this for you). # if defined(BOOST_HAS_UNISTD_H) # include // XOpen has , but is this the correct version check? # if defined(_XOPEN_VERSION) && (_XOPEN_VERSION >= 3) # define BOOST_HAS_NL_TYPES_H # endif // POSIX version 6 requires # if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 200100) # define BOOST_HAS_STDINT_H # endif // POSIX version 2 requires # if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199009L) # define BOOST_HAS_DIRENT_H # endif // POSIX version 3 requires to have sigaction: # if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199506L) # define BOOST_HAS_SIGACTION # endif // POSIX defines _POSIX_THREADS > 0 for pthread support, // however some platforms define _POSIX_THREADS without // a value, hence the (_POSIX_THREADS+0 >= 0) check. // Strictly speaking this may catch platforms with a // non-functioning stub , but such occurrences should // occur very rarely if at all. # if defined(_POSIX_THREADS) && (_POSIX_THREADS+0 >= 0) && !defined(BOOST_HAS_WINTHREADS) && !defined(BOOST_HAS_MPTASKS) # define BOOST_HAS_PTHREADS # endif // BOOST_HAS_NANOSLEEP: // This is predicated on _POSIX_TIMERS or _XOPEN_REALTIME: # if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS+0 >= 0)) \ || (defined(_XOPEN_REALTIME) && (_XOPEN_REALTIME+0 >= 0)) # define BOOST_HAS_NANOSLEEP # endif // BOOST_HAS_CLOCK_GETTIME: // This is predicated on _POSIX_TIMERS (also on _XOPEN_REALTIME // but at least one platform - linux - defines that flag without // defining clock_gettime): # if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS+0 >= 0)) # define BOOST_HAS_CLOCK_GETTIME # endif // BOOST_HAS_SCHED_YIELD: // This is predicated on _POSIX_PRIORITY_SCHEDULING or // on _POSIX_THREAD_PRIORITY_SCHEDULING or on _XOPEN_REALTIME. # if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING+0 > 0)\ || (defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING+0 > 0))\ || (defined(_XOPEN_REALTIME) && (_XOPEN_REALTIME+0 >= 0)) # define BOOST_HAS_SCHED_YIELD # endif // BOOST_HAS_GETTIMEOFDAY: // BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE: // These are predicated on _XOPEN_VERSION, and appears to be first released // in issue 4, version 2 (_XOPEN_VERSION > 500). // Likewise for the functions log1p and expm1. # if defined(_XOPEN_VERSION) && (_XOPEN_VERSION+0 >= 500) # define BOOST_HAS_GETTIMEOFDAY # if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE+0 >= 500) # define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE # endif # ifndef BOOST_HAS_LOG1P # define BOOST_HAS_LOG1P # endif # ifndef BOOST_HAS_EXPM1 # define BOOST_HAS_EXPM1 # endif # endif # endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/compiler/0000755000175000017500000000000012320456500023506 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/compiler/intel.hpp0000644000175000017500000001413312320456500025334 0ustar mathieumathieu// (C) Copyright John Maddock 2001-8. // (C) Copyright Peter Dimov 2001. // (C) Copyright Jens Maurer 2001. // (C) Copyright David Abrahams 2002 - 2003. // (C) Copyright Aleksey Gurtovoy 2002 - 2003. // (C) Copyright Guillaume Melquiond 2002 - 2003. // (C) Copyright Beman Dawes 2003. // (C) Copyright Martin Wille 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Intel compiler setup: #include "boost/config/compiler/common_edg.hpp" #if defined(__INTEL_COMPILER) # define BOOST_INTEL_CXX_VERSION __INTEL_COMPILER #elif defined(__ICL) # define BOOST_INTEL_CXX_VERSION __ICL #elif defined(__ICC) # define BOOST_INTEL_CXX_VERSION __ICC #elif defined(__ECC) # define BOOST_INTEL_CXX_VERSION __ECC #endif #define BOOST_COMPILER "Intel C++ version " BOOST_STRINGIZE(BOOST_INTEL_CXX_VERSION) #define BOOST_INTEL BOOST_INTEL_CXX_VERSION #if defined(_WIN32) || defined(_WIN64) # define BOOST_INTEL_WIN BOOST_INTEL #else # define BOOST_INTEL_LINUX BOOST_INTEL #endif #if (BOOST_INTEL_CXX_VERSION <= 500) && defined(_MSC_VER) # define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS # define BOOST_NO_TEMPLATE_TEMPLATES #endif #if (BOOST_INTEL_CXX_VERSION <= 600) # if defined(_MSC_VER) && (_MSC_VER <= 1300) // added check for <= VC 7 (Peter Dimov) // Boost libraries assume strong standard conformance unless otherwise // indicated by a config macro. As configured by Intel, the EDG front-end // requires certain compiler options be set to achieve that strong conformance. // Particularly /Qoption,c,--arg_dep_lookup (reported by Kirk Klobe & Thomas Witt) // and /Zc:wchar_t,forScope. See boost-root/tools/build/intel-win32-tools.jam for // details as they apply to particular versions of the compiler. When the // compiler does not predefine a macro indicating if an option has been set, // this config file simply assumes the option has been set. // Thus BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP will not be defined, even if // the compiler option is not enabled. # define BOOST_NO_SWPRINTF # endif // Void returns, 64 bit integrals don't work when emulating VC 6 (Peter Dimov) # if defined(_MSC_VER) && (_MSC_VER <= 1200) # define BOOST_NO_VOID_RETURNS # define BOOST_NO_INTEGRAL_INT64_T # endif #endif #if (BOOST_INTEL_CXX_VERSION <= 710) && defined(_WIN32) # define BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS #endif // See http://aspn.activestate.com/ASPN/Mail/Message/boost/1614864 #if BOOST_INTEL_CXX_VERSION < 600 # define BOOST_NO_INTRINSIC_WCHAR_T #else // We should test the macro _WCHAR_T_DEFINED to check if the compiler // supports wchar_t natively. *BUT* there is a problem here: the standard // headers define this macro if they typedef wchar_t. Anyway, we're lucky // because they define it without a value, while Intel C++ defines it // to 1. So we can check its value to see if the macro was defined natively // or not. // Under UNIX, the situation is exactly the same, but the macro _WCHAR_T // is used instead. # if ((_WCHAR_T_DEFINED + 0) == 0) && ((_WCHAR_T + 0) == 0) # define BOOST_NO_INTRINSIC_WCHAR_T # endif #endif #if defined(__GNUC__) && !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) // // Figure out when Intel is emulating this gcc bug // (All Intel versions prior to 9.0.26, and versions // later than that if they are set up to emulate gcc 3.2 // or earlier): // # if ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)) || (BOOST_INTEL < 900) || (__INTEL_COMPILER_BUILD_DATE < 20050912) # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # endif #endif #if (defined(__GNUC__) && (__GNUC__ < 4)) || defined(_WIN32) || (BOOST_INTEL_CXX_VERSION <= 1110) // GCC or VC emulation: #define BOOST_NO_TWO_PHASE_NAME_LOOKUP #endif // // Verify that we have actually got BOOST_NO_INTRINSIC_WCHAR_T // set correctly, if we don't do this now, we will get errors later // in type_traits code among other things, getting this correct // for the Intel compiler is actually remarkably fragile and tricky: // #if defined(BOOST_NO_INTRINSIC_WCHAR_T) #include template< typename T > struct assert_no_intrinsic_wchar_t; template<> struct assert_no_intrinsic_wchar_t { typedef void type; }; // if you see an error here then you need to unset BOOST_NO_INTRINSIC_WCHAR_T // where it is defined above: typedef assert_no_intrinsic_wchar_t::type assert_no_intrinsic_wchar_t_; #else template< typename T > struct assert_intrinsic_wchar_t; template<> struct assert_intrinsic_wchar_t {}; // if you see an error here then define BOOST_NO_INTRINSIC_WCHAR_T on the command line: template<> struct assert_intrinsic_wchar_t {}; #endif #if _MSC_VER+0 >= 1000 # if _MSC_VER >= 1200 # define BOOST_HAS_MS_INT64 # endif # define BOOST_NO_SWPRINTF # define BOOST_NO_TWO_PHASE_NAME_LOOKUP #elif defined(_WIN32) # define BOOST_DISABLE_WIN32 #endif // I checked version 6.0 build 020312Z, it implements the NRVO. // Correct this as you find out which version of the compiler // implemented the NRVO first. (Daniel Frey) #if (BOOST_INTEL_CXX_VERSION >= 600) # define BOOST_HAS_NRVO #endif // // versions check: // we don't support Intel prior to version 5.0: #if BOOST_INTEL_CXX_VERSION < 500 # error "Compiler not supported or configured - please reconfigure" #endif // Intel on MacOS requires #if defined(__APPLE__) && defined(__INTEL_COMPILER) # define BOOST_NO_TWO_PHASE_NAME_LOOKUP #endif // Intel on Altix Itanium #if defined(__itanium__) && defined(__INTEL_COMPILER) # define BOOST_NO_TWO_PHASE_NAME_LOOKUP #endif // // last known and checked version: #if (BOOST_INTEL_CXX_VERSION > 1110) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # elif defined(_MSC_VER) // // We don't emit this warning any more, since we have so few // defect macros set anyway (just the one). // //# pragma message("Unknown compiler version - please run the configure tests and report the results") # endif #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/compiler/digitalmars.hpp0000644000175000017500000000510312320456500026516 0ustar mathieumathieu// Copyright (C) Christof Meerwald 2003 // Copyright (C) Dan Watkins 2003 // // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // Digital Mars C++ compiler setup: #define BOOST_COMPILER __DMC_VERSION_STRING__ #define BOOST_HAS_LONG_LONG #define BOOST_HAS_PRAGMA_ONCE #if (__DMC__ <= 0x833) #define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL #define BOOST_NO_TEMPLATE_TEMPLATES #define BOOST_NEEDS_TOKEN_PASTING_OP_FOR_TOKENS_JUXTAPOSING #define BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS #define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS #endif #if (__DMC__ <= 0x840) || !defined(BOOST_STRICT_CONFIG) #define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS #define BOOST_NO_MEMBER_TEMPLATE_FRIENDS #define BOOST_NO_OPERATORS_IN_NAMESPACE #define BOOST_NO_UNREACHABLE_RETURN_DETECTION #define BOOST_NO_SFINAE #define BOOST_NO_USING_TEMPLATE #define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL #endif // // has macros: #if (__DMC__ >= 0x840) #define BOOST_HAS_DIRENT_H #define BOOST_HAS_STDINT_H #define BOOST_HAS_WINTHREADS #endif #if (__DMC__ >= 0x847) #define BOOST_HAS_EXPM1 #define BOOST_HAS_LOG1P #endif // // Is this really the best way to detect whether the std lib is in namespace std? // #include #if !defined(__STL_IMPORT_VENDOR_CSTD) && !defined(_STLP_IMPORT_VENDOR_CSTD) # define BOOST_NO_STDC_NAMESPACE #endif // check for exception handling support: #ifndef _CPPUNWIND # define BOOST_NO_EXCEPTIONS #endif // // C++0x features // #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_INITIALIZER_LISTS #define BOOST_NO_LAMBDAS #define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES #if __DMC__ < 0x800 #error "Compiler not supported or configured - please reconfigure" #endif // // last known and checked version is ...: #if (__DMC__ > 0x848) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/compiler/vacpp.hpp0000644000175000017500000000524012320456500025331 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Toon Knapen 2001 - 2003. // (C) Copyright Lie-Quan Lee 2001. // (C) Copyright Markus Schoepflin 2002 - 2003. // (C) Copyright Beman Dawes 2002 - 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Visual Age (IBM) C++ compiler setup: #if __IBMCPP__ <= 501 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS #endif #if (__IBMCPP__ <= 502) // Actually the compiler supports inclass member initialization but it // requires a definition for the class member and it doesn't recognize // it as an integral constant expression when used as a template argument. # define BOOST_NO_INCLASS_MEMBER_INITIALIZATION # define BOOST_NO_INTEGRAL_INT64_T # define BOOST_NO_MEMBER_TEMPLATE_KEYWORD #endif #if (__IBMCPP__ <= 600) || !defined(BOOST_STRICT_CONFIG) # define BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS # define BOOST_NO_INITIALIZER_LISTS #endif // // On AIX thread support seems to be indicated by _THREAD_SAFE: // #ifdef _THREAD_SAFE # define BOOST_HAS_THREADS #endif #define BOOST_COMPILER "IBM Visual Age version " BOOST_STRINGIZE(__IBMCPP__) // // versions check: // we don't support Visual age prior to version 5: #if __IBMCPP__ < 500 #error "Compiler not supported or configured - please reconfigure" #endif // // last known and checked version is 600: #if (__IBMCPP__ > 1010) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif #endif // Some versions of the compiler have issues with default arguments on partial specializations #define BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS // // C++0x features // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_LAMBDAS #define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/compiler/mpw.hpp0000644000175000017500000000462112320456500025025 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2002. // (C) Copyright Aleksey Gurtovoy 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // MPW C++ compilers setup: # if defined(__SC__) # define BOOST_COMPILER "MPW SCpp version " BOOST_STRINGIZE(__SC__) # elif defined(__MRC__) # define BOOST_COMPILER "MPW MrCpp version " BOOST_STRINGIZE(__MRC__) # else # error "Using MPW compiler configuration by mistake. Please update." # endif // // MPW 8.90: // #if (MPW_CPLUS <= 0x890) || !defined(BOOST_STRICT_CONFIG) # define BOOST_NO_CV_SPECIALIZATIONS # define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS # define BOOST_NO_INCLASS_MEMBER_INITIALIZATION # define BOOST_NO_INTRINSIC_WCHAR_T # define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION # define BOOST_NO_USING_TEMPLATE # define BOOST_NO_CWCHAR # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS # define BOOST_NO_STD_ALLOCATOR /* actually a bug with const reference overloading */ #endif // // C++0x features // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_INITIALIZER_LISTS #define BOOST_NO_LAMBDAS #define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES // // versions check: // we don't support MPW prior to version 8.9: #if MPW_CPLUS < 0x890 # error "Compiler not supported or configured - please reconfigure" #endif // // last known and checked version is 0x890: #if (MPW_CPLUS > 0x890) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/compiler/metrowerks.hpp0000644000175000017500000000770012320456500026425 0ustar mathieumathieu// (C) Copyright John Maddock 2001. // (C) Copyright Darin Adler 2001. // (C) Copyright Peter Dimov 2001. // (C) Copyright David Abrahams 2001 - 2002. // (C) Copyright Beman Dawes 2001 - 2003. // (C) Copyright Stefan Slapeta 2004. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Metrowerks C++ compiler setup: // locale support is disabled when linking with the dynamic runtime # ifdef _MSL_NO_LOCALE # define BOOST_NO_STD_LOCALE # endif # if __MWERKS__ <= 0x2301 // 5.3 # define BOOST_NO_FUNCTION_TEMPLATE_ORDERING # define BOOST_NO_POINTER_TO_MEMBER_CONST # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS # define BOOST_NO_MEMBER_TEMPLATE_KEYWORD # endif # if __MWERKS__ <= 0x2401 // 6.2 //# define BOOST_NO_FUNCTION_TEMPLATE_ORDERING # endif # if(__MWERKS__ <= 0x2407) // 7.x # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS # define BOOST_NO_UNREACHABLE_RETURN_DETECTION # endif # if(__MWERKS__ <= 0x3003) // 8.x # define BOOST_NO_SFINAE # endif // the "|| !defined(BOOST_STRICT_CONFIG)" part should apply to the last // tested version *only*: # if(__MWERKS__ <= 0x3207) || !defined(BOOST_STRICT_CONFIG) // 9.6 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # define BOOST_NO_IS_ABSTRACT # endif #if !__option(wchar_type) # define BOOST_NO_INTRINSIC_WCHAR_T #endif #if !__option(exceptions) # define BOOST_NO_EXCEPTIONS #endif #if (__INTEL__ && _WIN32) || (__POWERPC__ && macintosh) # if __MWERKS__ == 0x3000 # define BOOST_COMPILER_VERSION 8.0 # elif __MWERKS__ == 0x3001 # define BOOST_COMPILER_VERSION 8.1 # elif __MWERKS__ == 0x3002 # define BOOST_COMPILER_VERSION 8.2 # elif __MWERKS__ == 0x3003 # define BOOST_COMPILER_VERSION 8.3 # elif __MWERKS__ == 0x3200 # define BOOST_COMPILER_VERSION 9.0 # elif __MWERKS__ == 0x3201 # define BOOST_COMPILER_VERSION 9.1 # elif __MWERKS__ == 0x3202 # define BOOST_COMPILER_VERSION 9.2 # elif __MWERKS__ == 0x3204 # define BOOST_COMPILER_VERSION 9.3 # elif __MWERKS__ == 0x3205 # define BOOST_COMPILER_VERSION 9.4 # elif __MWERKS__ == 0x3206 # define BOOST_COMPILER_VERSION 9.5 # elif __MWERKS__ == 0x3207 # define BOOST_COMPILER_VERSION 9.6 # else # define BOOST_COMPILER_VERSION __MWERKS__ # endif #else # define BOOST_COMPILER_VERSION __MWERKS__ #endif // // C++0x features // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // #if __MWERKS__ > 0x3206 && __option(rvalue_refs) # define BOOST_HAS_RVALUE_REFS #else # define BOOST_NO_RVALUE_REFERENCES #endif #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_INITIALIZER_LISTS #define BOOST_NO_LAMBDAS #define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES #define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) // // versions check: // we don't support Metrowerks prior to version 5.3: #if __MWERKS__ < 0x2301 # error "Compiler not supported or configured - please reconfigure" #endif // // last known and checked version: #if (__MWERKS__ > 0x3205) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/compiler/common_edg.hpp0000644000175000017500000000522512320456500026332 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2002. // (C) Copyright Jens Maurer 2001. // (C) Copyright David Abrahams 2002. // (C) Copyright Aleksey Gurtovoy 2002. // (C) Copyright Markus Schoepflin 2005. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // // Options common to all edg based compilers. // // This is included from within the individual compiler mini-configs. #ifndef __EDG_VERSION__ # error This file requires that __EDG_VERSION__ be defined. #endif #if (__EDG_VERSION__ <= 238) # define BOOST_NO_INTEGRAL_INT64_T # define BOOST_NO_SFINAE #endif #if (__EDG_VERSION__ <= 240) # define BOOST_NO_VOID_RETURNS #endif #if (__EDG_VERSION__ <= 241) && !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) # define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP #endif #if (__EDG_VERSION__ <= 244) && !defined(BOOST_NO_TEMPLATE_TEMPLATES) # define BOOST_NO_TEMPLATE_TEMPLATES #endif #if (__EDG_VERSION__ < 300) && !defined(BOOST_NO_IS_ABSTRACT) # define BOOST_NO_IS_ABSTRACT #endif #if (__EDG_VERSION__ <= 303) && !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL #endif // See also kai.hpp which checks a Kai-specific symbol for EH # if !defined(__KCC) && !defined(__EXCEPTIONS) # define BOOST_NO_EXCEPTIONS # endif # if !defined(__NO_LONG_LONG) # define BOOST_HAS_LONG_LONG # else # define BOOST_NO_LONG_LONG # endif // // C++0x features // // See above for BOOST_NO_LONG_LONG // #if (__EDG_VERSION__ <= 310) || !defined(BOOST_STRICT_CONFIG) // No support for initializer lists # define BOOST_NO_INITIALIZER_LISTS #endif #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_LAMBDAS #define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES #ifdef c_plusplus // EDG has "long long" in non-strict mode // However, some libraries have insufficient "long long" support // #define BOOST_HAS_LONG_LONG #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/compiler/sunpro_cc.hpp0000644000175000017500000001004712320456500026214 0ustar mathieumathieu// (C) Copyright John Maddock 2001. // (C) Copyright Jens Maurer 2001 - 2003. // (C) Copyright Peter Dimov 2002. // (C) Copyright Aleksey Gurtovoy 2002 - 2003. // (C) Copyright David Abrahams 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Sun C++ compiler setup: # if __SUNPRO_CC <= 0x500 # define BOOST_NO_MEMBER_TEMPLATES # define BOOST_NO_FUNCTION_TEMPLATE_ORDERING # endif # if (__SUNPRO_CC <= 0x520) // // Sunpro 5.2 and earler: // // although sunpro 5.2 supports the syntax for // inline initialization it often gets the value // wrong, especially where the value is computed // from other constants (J Maddock 6th May 2001) # define BOOST_NO_INCLASS_MEMBER_INITIALIZATION // Although sunpro 5.2 supports the syntax for // partial specialization, it often seems to // bind to the wrong specialization. Better // to disable it until suppport becomes more stable // (J Maddock 6th May 2001). # define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION # endif # if (__SUNPRO_CC <= 0x530) // Requesting debug info (-g) with Boost.Python results // in an internal compiler error for "static const" // initialized in-class. // >> Assertion: (../links/dbg_cstabs.cc, line 611) // while processing ../test.cpp at line 0. // (Jens Maurer according to Gottfried Ganssauge 04 Mar 2002) # define BOOST_NO_INCLASS_MEMBER_INITIALIZATION // SunPro 5.3 has better support for partial specialization, // but breaks when compiling std::less > // (Jens Maurer 4 Nov 2001). // std::less specialization fixed as reported by George // Heintzelman; partial specialization re-enabled // (Peter Dimov 17 Jan 2002) //# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // integral constant expressions with 64 bit numbers fail # define BOOST_NO_INTEGRAL_INT64_T # endif # if (__SUNPRO_CC < 0x570) # define BOOST_NO_TEMPLATE_TEMPLATES // see http://lists.boost.org/MailArchives/boost/msg47184.php // and http://lists.boost.org/MailArchives/boost/msg47220.php # define BOOST_NO_INCLASS_MEMBER_INITIALIZATION # define BOOST_NO_SFINAE # define BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS # endif # if (__SUNPRO_CC <= 0x580) # define BOOST_NO_IS_ABSTRACT # endif // // Issues that effect all known versions: // #define BOOST_NO_TWO_PHASE_NAME_LOOKUP #define BOOST_NO_ADL_BARRIER // // C++0x features // #if(__SUNPRO_CC >= 0x590) # define BOOST_HAS_LONG_LONG #else # define BOOST_NO_LONG_LONG #endif #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_INITIALIZER_LISTS #define BOOST_NO_LAMBDAS #define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES // // Version // #define BOOST_COMPILER "Sun compiler version " BOOST_STRINGIZE(__SUNPRO_CC) // // versions check: // we don't support sunpro prior to version 4: #if __SUNPRO_CC < 0x400 #error "Compiler not supported or configured - please reconfigure" #endif // // last known and checked version is 0x590: #if (__SUNPRO_CC > 0x590) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/compiler/pgi.hpp0000644000175000017500000000324612320456500025003 0ustar mathieumathieu// (C) Copyright Noel Belcourt 2007. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // PGI C++ compiler setup: #define BOOST_COMPILER_VERSION __PGIC__##__PGIC_MINOR__ #define BOOST_COMPILER "PGI compiler version " BOOST_STRINGIZE(_COMPILER_VERSION) // // Threading support: // Turn this on unconditionally here, it will get turned off again later // if no threading API is detected. // #if (__PGIC__ >= 7) #define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL #define BOOST_NO_TWO_PHASE_NAME_LOOKUP #define BOOST_NO_SWPRINTF #else # error "Pgi compiler not configured - please reconfigure" #endif // // C++0x features // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_INITIALIZER_LISTS #define BOOST_NO_LAMBDAS #define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES // // version check: // probably nothing to do here? ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/compiler/gcc_xml.hpp0000644000175000017500000000162112320456500025633 0ustar mathieumathieu// (C) Copyright John Maddock 2006. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // GCC-XML C++ compiler setup: # if !defined(__GCCXML_GNUC__) || ((__GCCXML_GNUC__ <= 3) && (__GCCXML_GNUC_MINOR__ <= 3)) # define BOOST_NO_IS_ABSTRACT # endif // // Threading support: Turn this on unconditionally here (except for // those platforms where we can know for sure). It will get turned off again // later if no threading API is detected. // #if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(linux) && !defined(__linux) && !defined(__linux__) # define BOOST_HAS_THREADS #endif // // gcc has "long long" // #define BOOST_HAS_LONG_LONG #define BOOST_COMPILER "GCC-XML C++ version " __GCCXML__ ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/compiler/greenhills.hpp0000644000175000017500000000145712320456500026362 0ustar mathieumathieu// (C) Copyright John Maddock 2001. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Greenhills C++ compiler setup: #define BOOST_COMPILER "Greenhills C++ version " BOOST_STRINGIZE(__ghs) #include "boost/config/compiler/common_edg.hpp" // // versions check: // we don't support Greenhills prior to version 0: #if __ghs < 0 # error "Compiler not supported or configured - please reconfigure" #endif // // last known and checked version is 0: #if (__ghs > 0) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/compiler/visualc.hpp0000644000175000017500000001737512320456500025702 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Darin Adler 2001 - 2002. // (C) Copyright Peter Dimov 2001. // (C) Copyright Aleksey Gurtovoy 2002. // (C) Copyright David Abrahams 2002 - 2003. // (C) Copyright Beman Dawes 2002 - 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Microsoft Visual C++ compiler setup: #define BOOST_MSVC _MSC_VER #if _MSC_FULL_VER > 100000000 # define BOOST_MSVC_FULL_VER _MSC_FULL_VER #else # define BOOST_MSVC_FULL_VER (_MSC_FULL_VER * 10) #endif // turn off the warnings before we #include anything #pragma warning( disable : 4503 ) // warning: decorated name length exceeded #if _MSC_VER < 1300 // 1200 == VC++ 6.0, 1200-1202 == eVC++4 # pragma warning( disable : 4786 ) // ident trunc to '255' chars in debug info # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS # define BOOST_NO_VOID_RETURNS # define BOOST_NO_EXCEPTION_STD_NAMESPACE # if BOOST_MSVC == 1202 # define BOOST_NO_STD_TYPEINFO # endif // disable min/max macro defines on vc6: // #endif #if (_MSC_VER <= 1300) // 1300 == VC++ 7.0 # if !defined(_MSC_EXTENSIONS) && !defined(BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS) // VC7 bug with /Za # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS # endif # define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS # define BOOST_NO_INCLASS_MEMBER_INITIALIZATION # define BOOST_NO_PRIVATE_IN_AGGREGATE # define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP # define BOOST_NO_INTEGRAL_INT64_T # define BOOST_NO_DEDUCED_TYPENAME # define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE // VC++ 6/7 has member templates but they have numerous problems including // cases of silent failure, so for safety we define: # define BOOST_NO_MEMBER_TEMPLATES // For VC++ experts wishing to attempt workarounds, we define: # define BOOST_MSVC6_MEMBER_TEMPLATES # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION # define BOOST_NO_CV_VOID_SPECIALIZATIONS # define BOOST_NO_FUNCTION_TEMPLATE_ORDERING # define BOOST_NO_USING_TEMPLATE # define BOOST_NO_SWPRINTF # define BOOST_NO_TEMPLATE_TEMPLATES # define BOOST_NO_SFINAE # define BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS # define BOOST_NO_IS_ABSTRACT # define BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS // TODO: what version is meant here? Have there really been any fixes in cl 12.01 (as e.g. shipped with eVC4)? # if (_MSC_VER > 1200) # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS # endif #endif #if _MSC_VER < 1400 // although a conforming signature for swprint exists in VC7.1 // it appears not to actually work: # define BOOST_NO_SWPRINTF #endif #if defined(UNDER_CE) // Windows CE does not have a conforming signature for swprintf # define BOOST_NO_SWPRINTF #endif #if _MSC_VER <= 1400 // 1400 == VC++ 8.0 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS #endif #if _MSC_VER <= 1600 // 1600 == VC++ 10.0 # define BOOST_NO_TWO_PHASE_NAME_LOOKUP #endif #if _MSC_VER == 1500 // 1500 == VC++ 9.0 // A bug in VC9: # define BOOST_NO_ADL_BARRIER #endif #if _MSC_VER <= 1500 || !defined(BOOST_STRICT_CONFIG) // 1500 == VC++ 9.0 # define BOOST_NO_INITIALIZER_LISTS #endif #ifndef _NATIVE_WCHAR_T_DEFINED # define BOOST_NO_INTRINSIC_WCHAR_T #endif #if defined(_WIN32_WCE) || defined(UNDER_CE) # define BOOST_NO_THREADEX # define BOOST_NO_GETSYSTEMTIMEASFILETIME # define BOOST_NO_SWPRINTF #endif // // check for exception handling support: #ifndef _CPPUNWIND # define BOOST_NO_EXCEPTIONS #endif // // __int64 support: // #if (_MSC_VER >= 1200) # define BOOST_HAS_MS_INT64 #endif #if (_MSC_VER >= 1310) && (defined(_MSC_EXTENSIONS) || (_MSC_VER >= 1500)) # define BOOST_HAS_LONG_LONG #else # define BOOST_NO_LONG_LONG #endif #if (_MSC_VER >= 1400) && !defined(_DEBUG) # define BOOST_HAS_NRVO #endif // // disable Win32 API's if compiler extentions are // turned off: // #if !defined(_MSC_EXTENSIONS) && !defined(BOOST_DISABLE_WIN32) # define BOOST_DISABLE_WIN32 #endif #if !defined(_CPPRTTI) && !defined(BOOST_NO_RTTI) # define BOOST_NO_RTTI #endif // // all versions support __declspec: // #define BOOST_HAS_DECLSPEC // // C++0x features // // See above for BOOST_NO_LONG_LONG // C++ features supported by VC++ 10 (aka 2010) // #if _MSC_VER < 1600 #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_NO_DECLTYPE #define BOOST_NO_LAMBDAS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_STATIC_ASSERT #endif // _MSC_VER < 1600 // C++0x features not supported by any versions #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_INITIALIZER_LISTS #define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES // // prefix and suffix headers: // #ifndef BOOST_ABI_PREFIX # define BOOST_ABI_PREFIX "boost/config/abi/msvc_prefix.hpp" #endif #ifndef BOOST_ABI_SUFFIX # define BOOST_ABI_SUFFIX "boost/config/abi/msvc_suffix.hpp" #endif // TODO: // these things are mostly bogus. 1200 means version 12.0 of the compiler. The // artificial versions assigned to them only refer to the versions of some IDE // these compilers have been shipped with, and even that is not all of it. Some // were shipped with freely downloadable SDKs, others as crosscompilers in eVC. // IOW, you can't use these 'versions' in any sensible way. Sorry. # if defined(UNDER_CE) # if _MSC_VER < 1200 // Note: these are so far off, they are not really supported # elif _MSC_VER < 1300 // eVC++ 4 comes with 1200-1202 # define BOOST_COMPILER_VERSION evc4.0 # elif _MSC_VER == 1400 # define BOOST_COMPILER_VERSION evc8 # elif _MSC_VER == 1500 # define BOOST_COMPILER_VERSION evc9 # elif _MSC_VER == 1600 # define BOOST_COMPILER_VERSION evc10 # else # if defined(BOOST_ASSERT_CONFIG) # error "Unknown EVC++ compiler version - please run the configure tests and report the results" # else # pragma message("Unknown EVC++ compiler version - please run the configure tests and report the results") # endif # endif # else # if _MSC_VER < 1200 // Note: these are so far off, they are not really supported # define BOOST_COMPILER_VERSION 5.0 # elif _MSC_VER < 1300 # define BOOST_COMPILER_VERSION 6.0 # elif _MSC_VER == 1300 # define BOOST_COMPILER_VERSION 7.0 # elif _MSC_VER == 1310 # define BOOST_COMPILER_VERSION 7.1 # elif _MSC_VER == 1400 # define BOOST_COMPILER_VERSION 8.0 # elif _MSC_VER == 1500 # define BOOST_COMPILER_VERSION 9.0 # elif _MSC_VER == 1600 # define BOOST_COMPILER_VERSION 10.0 # else # define BOOST_COMPILER_VERSION _MSC_VER # endif # endif #define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) // // versions check: // we don't support Visual C++ prior to version 6: #if _MSC_VER < 1200 #error "Compiler not supported or configured - please reconfigure" #endif // // last known and checked version is 1600 (VC10, aka 2010): #if (_MSC_VER > 1600) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # else # pragma message("Unknown compiler version - please run the configure tests and report the results") # endif #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/compiler/codegear.hpp0000644000175000017500000001132512320456500025772 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright David Abrahams 2002 - 2003. // (C) Copyright Aleksey Gurtovoy 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // CodeGear C++ compiler setup: #if !defined( BOOST_WITH_CODEGEAR_WARNINGS ) // these warnings occur frequently in optimized template code # pragma warn -8004 // var assigned value, but never used # pragma warn -8008 // condition always true/false # pragma warn -8066 // dead code can never execute # pragma warn -8104 // static members with ctors not threadsafe # pragma warn -8105 // reference member in class without ctors #endif // // versions check: // last known and checked version is 0x620 #if (__CODEGEARC__ > 0x620) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # else # pragma message( "Unknown compiler version - please run the configure tests and report the results") # endif #endif // CodeGear C++ Builder 2009 #if (__CODEGEARC__ <= 0x613) # define BOOST_NO_INTEGRAL_INT64_T # define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS # define BOOST_NO_PRIVATE_IN_AGGREGATE # define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE // we shouldn't really need this - but too many things choke // without it, this needs more investigation: # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS # define BOOST_SP_NO_SP_CONVERTIBLE #endif // CodeGear C++ Builder 2010 #if (__CODEGEARC__ <= 0x620) # define BOOST_NO_TYPENAME_WITH_CTOR // Cannot use typename keyword when making temporaries of a dependant type # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # define BOOST_NO_NESTED_FRIENDSHIP // TC1 gives nested classes access rights as any other member # define BOOST_NO_USING_TEMPLATE # define BOOST_NO_TWO_PHASE_NAME_LOOKUP // Temporary hack, until specific MPL preprocessed headers are generated # define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS # ifdef NDEBUG // fix broken so that Boost.test works: # include # undef strcmp # endif // fix broken errno declaration: # include # ifndef errno # define errno errno # endif #endif // // C++0x macros: // #define BOOST_HAS_CHAR16_T #define BOOST_HAS_CHAR32_T #define BOOST_HAS_LONG_LONG // #define BOOST_HAS_ALIGNOF #define BOOST_HAS_DECLTYPE #define BOOST_HAS_EXPLICIT_CONVERSION_OPS // #define BOOST_HAS_RVALUE_REFS #define BOOST_HAS_SCOPED_ENUM // #define BOOST_HAS_STATIC_ASSERT #define BOOST_HAS_STD_TYPE_TRAITS #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_INITIALIZER_LISTS #define BOOST_NO_LAMBDAS #define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SFINAE_EXPR #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES // // TR1 macros: // #define BOOST_HAS_TR1_HASH #define BOOST_HAS_TR1_TYPE_TRAITS #define BOOST_HAS_TR1_UNORDERED_MAP #define BOOST_HAS_TR1_UNORDERED_SET #define BOOST_HAS_MACRO_USE_FACET #define BOOST_NO_INITIALIZER_LISTS // On non-Win32 platforms let the platform config figure this out: #ifdef _WIN32 # define BOOST_HAS_STDINT_H #endif // // __int64: // #if !defined(__STRICT_ANSI__) # define BOOST_HAS_MS_INT64 #endif // // check for exception handling support: // #if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif // // all versions have a : // #if !defined(__STRICT_ANSI__) # define BOOST_HAS_DIRENT_H #endif // // all versions support __declspec: // #if !defined(__STRICT_ANSI__) # define BOOST_HAS_DECLSPEC #endif // // ABI fixing headers: // #ifndef BOOST_ABI_PREFIX # define BOOST_ABI_PREFIX "boost/config/abi/borland_prefix.hpp" #endif #ifndef BOOST_ABI_SUFFIX # define BOOST_ABI_SUFFIX "boost/config/abi/borland_suffix.hpp" #endif // // Disable Win32 support in ANSI mode: // # pragma defineonoption BOOST_DISABLE_WIN32 -A // // MSVC compatibility mode does some nasty things: // TODO: look up if this doesn't apply to the whole 12xx range // #if defined(_MSC_VER) && (_MSC_VER <= 1200) # define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP # define BOOST_NO_VOID_RETURNS #endif #define BOOST_COMPILER "CodeGear C++ version " BOOST_STRINGIZE(__CODEGEARC__) ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/compiler/compaq_cxx.hpp0000644000175000017500000000076512320456500026371 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Tru64 C++ compiler setup (now HP): #define BOOST_COMPILER "HP Tru64 C++ " BOOST_STRINGIZE(__DECCXX_VER) #include "boost/config/compiler/common_edg.hpp" // // versions check: // Nothing to do here? ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/compiler/hp_acc.hpp0000644000175000017500000001001312320456500025427 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Jens Maurer 2001 - 2003. // (C) Copyright Aleksey Gurtovoy 2002. // (C) Copyright David Abrahams 2002 - 2003. // (C) Copyright Toon Knapen 2003. // (C) Copyright Boris Gubenko 2006 - 2007. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // HP aCC C++ compiler setup: #if defined(__EDG__) #include "boost/config/compiler/common_edg.hpp" #endif #if (__HP_aCC <= 33100) # define BOOST_NO_INTEGRAL_INT64_T # define BOOST_NO_OPERATORS_IN_NAMESPACE # if !defined(_NAMESPACE_STD) # define BOOST_NO_STD_LOCALE # define BOOST_NO_STRINGSTREAM # endif #endif #if (__HP_aCC <= 33300) // member templates are sufficiently broken that we disable them for now # define BOOST_NO_MEMBER_TEMPLATES # define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS # define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE #endif #if (__HP_aCC <= 38000) # define BOOST_NO_TWO_PHASE_NAME_LOOKUP #endif #if (__HP_aCC > 50000) && (__HP_aCC < 60000) # define BOOST_NO_UNREACHABLE_RETURN_DETECTION # define BOOST_NO_TEMPLATE_TEMPLATES # define BOOST_NO_SWPRINTF # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS # define BOOST_NO_IS_ABSTRACT # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS #endif // optional features rather than defects: #if (__HP_aCC >= 33900) # define BOOST_HAS_LONG_LONG # define BOOST_HAS_PARTIAL_STD_ALLOCATOR #endif #if (__HP_aCC >= 50000 ) && (__HP_aCC <= 53800 ) || (__HP_aCC < 31300 ) # define BOOST_NO_MEMBER_TEMPLATE_KEYWORD #endif // This macro should not be defined when compiling in strict ansi // mode, but, currently, we don't have the ability to determine // what standard mode we are compiling with. Some future version // of aCC6 compiler will provide predefined macros reflecting the // compilation options, including the standard mode. #if (__HP_aCC >= 60000) || ((__HP_aCC > 38000) && defined(__hpxstd98)) # define BOOST_NO_TWO_PHASE_NAME_LOOKUP #endif #define BOOST_COMPILER "HP aCC version " BOOST_STRINGIZE(__HP_aCC) // // versions check: // we don't support HP aCC prior to version 33000: #if __HP_aCC < 33000 # error "Compiler not supported or configured - please reconfigure" #endif // // Extended checks for supporting aCC on PA-RISC #if __HP_aCC > 30000 && __HP_aCC < 50000 # if __HP_aCC < 38000 // versions prior to version A.03.80 not supported # error "Compiler version not supported - version A.03.80 or higher is required" # elif !defined(__hpxstd98) // must compile using the option +hpxstd98 with version A.03.80 and above # error "Compiler option '+hpxstd98' is required for proper support" # endif //PA-RISC #endif // // C++0x features // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // #if !defined(__EDG__) #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_INITIALIZER_LISTS #define BOOST_NO_LAMBDAS #define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES #endif // // last known and checked version for HP-UX/ia64 is 61300 // last known and checked version for PA-RISC is 38000 #if ((__HP_aCC > 61300) || ((__HP_aCC > 38000) && defined(__hpxstd98))) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/compiler/kai.hpp0000644000175000017500000000173612320456500024772 0ustar mathieumathieu// (C) Copyright John Maddock 2001. // (C) Copyright David Abrahams 2002. // (C) Copyright Aleksey Gurtovoy 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Kai C++ compiler setup: #include "boost/config/compiler/common_edg.hpp" # if (__KCC_VERSION <= 4001) || !defined(BOOST_STRICT_CONFIG) // at least on Sun, the contents of is not in namespace std # define BOOST_NO_STDC_NAMESPACE # endif // see also common_edg.hpp which needs a special check for __KCC # if !defined(_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS # endif // // last known and checked version is 4001: #if (__KCC_VERSION > 4001) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/compiler/borland.hpp0000644000175000017500000001665212320456500025652 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright David Abrahams 2002 - 2003. // (C) Copyright Aleksey Gurtovoy 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Borland C++ compiler setup: // // versions check: // we don't support Borland prior to version 5.4: #if __BORLANDC__ < 0x540 # error "Compiler not supported or configured - please reconfigure" #endif // last known compiler version: #if (__BORLANDC__ > 0x613) //# if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" //# else //# pragma message( "Unknown compiler version - please run the configure tests and report the results") //# endif #elif (__BORLANDC__ == 0x600) # error "CBuilderX preview compiler is no longer supported" #endif // // Support macros to help with standard library detection #if (__BORLANDC__ < 0x560) || defined(_USE_OLD_RW_STL) # define BOOST_BCB_WITH_ROGUE_WAVE #elif __BORLANDC__ < 0x570 # define BOOST_BCB_WITH_STLPORT #else # define BOOST_BCB_WITH_DINKUMWARE #endif // // Version 5.0 and below: # if __BORLANDC__ <= 0x0550 // Borland C++Builder 4 and 5: # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # if __BORLANDC__ == 0x0550 // Borland C++Builder 5, command-line compiler 5.5: # define BOOST_NO_OPERATORS_IN_NAMESPACE # endif # endif // Version 5.51 and below: #if (__BORLANDC__ <= 0x551) # define BOOST_NO_CV_SPECIALIZATIONS # define BOOST_NO_CV_VOID_SPECIALIZATIONS # define BOOST_NO_DEDUCED_TYPENAME // workaround for missing WCHAR_MAX/WCHAR_MIN: #include #include #ifndef WCHAR_MAX # define WCHAR_MAX 0xffff #endif #ifndef WCHAR_MIN # define WCHAR_MIN 0 #endif #endif // Borland C++ Builder 6 and below: #if (__BORLANDC__ <= 0x564) # ifdef NDEBUG // fix broken so that Boost.test works: # include # undef strcmp # endif // fix broken errno declaration: # include # ifndef errno # define errno errno # endif #endif // // new bug in 5.61: #if (__BORLANDC__ >= 0x561) && (__BORLANDC__ <= 0x580) // this seems to be needed by the command line compiler, but not the IDE: # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS #endif // Borland C++ Builder 2006 Update 2 and below: #if (__BORLANDC__ <= 0x582) # define BOOST_NO_SFINAE # define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG # define BOOST_NO_TEMPLATE_TEMPLATES # define BOOST_NO_PRIVATE_IN_AGGREGATE # ifdef _WIN32 # define BOOST_NO_SWPRINTF # elif defined(linux) || defined(__linux__) || defined(__linux) // we should really be able to do without this // but the wcs* functions aren't imported into std:: # define BOOST_NO_STDC_NAMESPACE // _CPPUNWIND doesn't get automatically set for some reason: # pragma defineonoption BOOST_CPPUNWIND -x # endif #endif #if (__BORLANDC__ <= 0x613) // Beman has asked Alisdair for more info // we shouldn't really need this - but too many things choke // without it, this needs more investigation: # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS # define BOOST_NO_IS_ABSTRACT # define BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS # define BOOST_NO_USING_TEMPLATE # define BOOST_SP_NO_SP_CONVERTIBLE // Temporary workaround #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS #endif // Borland C++ Builder 2008 and below: # define BOOST_NO_INTEGRAL_INT64_T # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # define BOOST_NO_TWO_PHASE_NAME_LOOKUP # define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE # define BOOST_NO_NESTED_FRIENDSHIP # define BOOST_NO_TYPENAME_WITH_CTOR #if (__BORLANDC__ < 0x600) # define BOOST_ILLEGAL_CV_REFERENCES #endif // // Positive Feature detection // // Borland C++ Builder 2008 and below: #if (__BORLANDC__ >= 0x599) # pragma defineonoption BOOST_CODEGEAR_0X_SUPPORT -Ax #endif // // C++0x Macros: // #if !defined( BOOST_CODEGEAR_0X_SUPPORT ) || (__BORLANDC__ < 0x610) # define BOOST_NO_CHAR16_T # define BOOST_NO_CHAR32_T # define BOOST_NO_DECLTYPE # define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS # define BOOST_NO_EXTERN_TEMPLATE # define BOOST_NO_RVALUE_REFERENCES # define BOOST_NO_SCOPED_ENUMS # define BOOST_NO_STATIC_ASSERT #else # define BOOST_HAS_ALIGNOF # define BOOST_HAS_CHAR16_T # define BOOST_HAS_CHAR32_T # define BOOST_HAS_DECLTYPE # define BOOST_HAS_EXPLICIT_CONVERSION_OPS # define BOOST_HAS_REF_QUALIFIER # define BOOST_HAS_RVALUE_REFS # define BOOST_HAS_STATIC_ASSERT #endif #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_INITIALIZER_LISTS #define BOOST_NO_LAMBDAS #define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS // UTF-8 still not supported #define BOOST_NO_VARIADIC_TEMPLATES #if __BORLANDC__ >= 0x590 # define BOOST_HAS_TR1_HASH # define BOOST_HAS_MACRO_USE_FACET #endif // // Post 0x561 we have long long and stdint.h: #if __BORLANDC__ >= 0x561 # ifndef __NO_LONG_LONG # define BOOST_HAS_LONG_LONG # else # define BOOST_NO_LONG_LONG # endif // On non-Win32 platforms let the platform config figure this out: # ifdef _WIN32 # define BOOST_HAS_STDINT_H # endif #endif // Borland C++Builder 6 defaults to using STLPort. If _USE_OLD_RW_STL is // defined, then we have 0x560 or greater with the Rogue Wave implementation // which presumably has the std::DBL_MAX bug. #if defined( BOOST_BCB_WITH_ROGUE_WAVE ) // is partly broken, some macros define symbols that are really in // namespace std, so you end up having to use illegal constructs like // std::DBL_MAX, as a fix we'll just include float.h and have done with: #include #endif // // __int64: // #if (__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__) # define BOOST_HAS_MS_INT64 #endif // // check for exception handling support: // #if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif // // all versions have a : // #ifndef __STRICT_ANSI__ # define BOOST_HAS_DIRENT_H #endif // // all versions support __declspec: // #ifndef __STRICT_ANSI__ # define BOOST_HAS_DECLSPEC #endif // // ABI fixing headers: // #if __BORLANDC__ != 0x600 // not implemented for version 6 compiler yet #ifndef BOOST_ABI_PREFIX # define BOOST_ABI_PREFIX "boost/config/abi/borland_prefix.hpp" #endif #ifndef BOOST_ABI_SUFFIX # define BOOST_ABI_SUFFIX "boost/config/abi/borland_suffix.hpp" #endif #endif // // Disable Win32 support in ANSI mode: // #if __BORLANDC__ < 0x600 # pragma defineonoption BOOST_DISABLE_WIN32 -A #elif defined(__STRICT_ANSI__) # define BOOST_DISABLE_WIN32 #endif // // MSVC compatibility mode does some nasty things: // TODO: look up if this doesn't apply to the whole 12xx range // #if defined(_MSC_VER) && (_MSC_VER <= 1200) # define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP # define BOOST_NO_VOID_RETURNS #endif #define BOOST_COMPILER "Borland C++ version " BOOST_STRINGIZE(__BORLANDC__) ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/compiler/comeau.hpp0000644000175000017500000000313712320456500025474 0ustar mathieumathieu// (C) Copyright John Maddock 2001. // (C) Copyright Douglas Gregor 2001. // (C) Copyright Peter Dimov 2001. // (C) Copyright Aleksey Gurtovoy 2003. // (C) Copyright Beman Dawes 2003. // (C) Copyright Jens Maurer 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Comeau C++ compiler setup: #include "boost/config/compiler/common_edg.hpp" #if (__COMO_VERSION__ <= 4245) # if defined(_MSC_VER) && _MSC_VER <= 1300 # if _MSC_VER > 100 // only set this in non-strict mode: # define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP # endif # endif // Void returns don't work when emulating VC 6 (Peter Dimov) // TODO: look up if this doesn't apply to the whole 12xx range # if defined(_MSC_VER) && (_MSC_VER < 1300) # define BOOST_NO_VOID_RETURNS # endif #endif // version 4245 // // enable __int64 support in VC emulation mode // # if defined(_MSC_VER) && (_MSC_VER >= 1200) # define BOOST_HAS_MS_INT64 # endif #define BOOST_COMPILER "Comeau compiler version " BOOST_STRINGIZE(__COMO_VERSION__) // // versions check: // we don't know Comeau prior to version 4245: #if __COMO_VERSION__ < 4245 # error "Compiler not configured - please reconfigure" #endif // // last known and checked version is 4245: #if (__COMO_VERSION__ > 4245) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/compiler/sgi_mipspro.hpp0000644000175000017500000000140612320456500026553 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // SGI C++ compiler setup: #define BOOST_COMPILER "SGI Irix compiler version " BOOST_STRINGIZE(_COMPILER_VERSION) #include "boost/config/compiler/common_edg.hpp" // // Threading support: // Turn this on unconditionally here, it will get turned off again later // if no threading API is detected. // #define BOOST_HAS_THREADS #define BOOST_NO_TWO_PHASE_NAME_LOOKUP #undef BOOST_NO_SWPRINTF #undef BOOST_DEDUCED_TYPENAME // // version check: // probably nothing to do here? ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/compiler/gcc.hpp0000644000175000017500000001354512320456500024763 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Darin Adler 2001 - 2002. // (C) Copyright Jens Maurer 2001 - 2002. // (C) Copyright Beman Dawes 2001 - 2003. // (C) Copyright Douglas Gregor 2002. // (C) Copyright David Abrahams 2002 - 2003. // (C) Copyright Synge Todo 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // GNU C++ compiler setup: #if __GNUC__ < 3 # if __GNUC_MINOR__ == 91 // egcs 1.1 won't parse shared_ptr.hpp without this: # define BOOST_NO_AUTO_PTR # endif # if __GNUC_MINOR__ < 95 // // Prior to gcc 2.95 member templates only partly // work - define BOOST_MSVC6_MEMBER_TEMPLATES // instead since inline member templates mostly work. // # define BOOST_NO_MEMBER_TEMPLATES # if __GNUC_MINOR__ >= 9 # define BOOST_MSVC6_MEMBER_TEMPLATES # endif # endif # if __GNUC_MINOR__ < 96 # define BOOST_NO_SFINAE # endif # if __GNUC_MINOR__ <= 97 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # define BOOST_NO_OPERATORS_IN_NAMESPACE # endif # define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # define BOOST_NO_IS_ABSTRACT #elif __GNUC__ == 3 # if defined (__PATHSCALE__) # define BOOST_NO_TWO_PHASE_NAME_LOOKUP # define BOOST_NO_IS_ABSTRACT # endif // // gcc-3.x problems: // // Bug specific to gcc 3.1 and 3.2: // # if ((__GNUC_MINOR__ == 1) || (__GNUC_MINOR__ == 2)) # define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS # endif # if __GNUC_MINOR__ < 4 # define BOOST_NO_IS_ABSTRACT # endif #endif #if __GNUC__ < 4 // // All problems to gcc-3.x and earlier here: // #define BOOST_NO_TWO_PHASE_NAME_LOOKUP # ifdef __OPEN64__ # define BOOST_NO_IS_ABSTRACT # endif #endif #ifndef __EXCEPTIONS # define BOOST_NO_EXCEPTIONS #endif // // Threading support: Turn this on unconditionally here (except for // those platforms where we can know for sure). It will get turned off again // later if no threading API is detected. // #if !defined(__MINGW32__) && !defined(linux) && !defined(__linux) && !defined(__linux__) # define BOOST_HAS_THREADS #endif // // gcc has "long long" // #define BOOST_HAS_LONG_LONG // // gcc implements the named return value optimization since version 3.1 // #if __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 ) #define BOOST_HAS_NRVO #endif // // RTTI and typeinfo detection is possible post gcc-4.3: // #if __GNUC__ * 100 + __GNUC_MINOR__ >= 403 # ifndef __GXX_RTTI # define BOOST_NO_TYPEID # define BOOST_NO_RTTI # endif #endif // C++0x features not implemented in any GCC version // #define BOOST_NO_CONSTEXPR #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_LAMBDAS #define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS // C++0x features in 4.3.n and later // #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) && defined(__GXX_EXPERIMENTAL_CXX0X__) // C++0x features are only enabled when -std=c++0x or -std=gnu++0x are // passed on the command line, which in turn defines // __GXX_EXPERIMENTAL_CXX0X__. # define BOOST_HAS_DECLTYPE # define BOOST_HAS_RVALUE_REFS # define BOOST_HAS_STATIC_ASSERT # define BOOST_HAS_VARIADIC_TMPL #else # define BOOST_NO_DECLTYPE # define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS # define BOOST_NO_RVALUE_REFERENCES # define BOOST_NO_STATIC_ASSERT // Variadic templates compiler: // http://www.generic-programming.org/~dgregor/cpp/variadic-templates.html # ifdef __VARIADIC_TEMPLATES # define BOOST_HAS_VARIADIC_TMPL # else # define BOOST_NO_VARIADIC_TEMPLATES # endif #endif // C++0x features in 4.4.n and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) || !defined(__GXX_EXPERIMENTAL_CXX0X__) # define BOOST_NO_AUTO_DECLARATIONS # define BOOST_NO_AUTO_MULTIDECLARATIONS # define BOOST_NO_CHAR16_T # define BOOST_NO_CHAR32_T # define BOOST_NO_DEFAULTED_FUNCTIONS # define BOOST_NO_DELETED_FUNCTIONS # define BOOST_NO_INITIALIZER_LISTS # define BOOST_NO_SCOPED_ENUMS #endif #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) # define BOOST_NO_SFINAE_EXPR #endif // C++0x features in 4.4.1 and later // #if (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40401) || !defined(__GXX_EXPERIMENTAL_CXX0X__) // scoped enums have a serious bug in 4.4.0, so define BOOST_NO_SCOPED_ENUMS before 4.4.1 // See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064 # define BOOST_NO_SCOPED_ENUMS #endif // C++0x features in 4.5.n and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__) # define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #endif // ConceptGCC compiler: // http://www.generic-programming.org/software/ConceptGCC/ #ifdef __GXX_CONCEPTS__ # define BOOST_HAS_CONCEPTS # define BOOST_COMPILER "ConceptGCC version " __VERSION__ #else # define BOOST_NO_CONCEPTS #endif #ifndef BOOST_COMPILER # define BOOST_COMPILER "GNU C++ version " __VERSION__ #endif // // versions check: // we don't know gcc prior to version 2.90: #if (__GNUC__ == 2) && (__GNUC_MINOR__ < 90) # error "Compiler not configured - please reconfigure" #endif // // last known and checked version is 4.4 (Pre-release): #if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 4)) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # else // we don't emit warnings here anymore since there are no defect macros defined for // gcc post 3.4, so any failures are gcc regressions... //# warning "Unknown compiler version - please run the configure tests and report the results" # endif #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/suffix.hpp0000644000175000017500000004506012320456500023716 0ustar mathieumathieu// Boost config.hpp configuration header file ------------------------------// // Copyright (c) 2001-2003 John Maddock // Copyright (c) 2001 Darin Adler // Copyright (c) 2001 Peter Dimov // Copyright (c) 2002 Bill Kempf // Copyright (c) 2002 Jens Maurer // Copyright (c) 2002-2003 David Abrahams // Copyright (c) 2003 Gennaro Prota // Copyright (c) 2003 Eric Friedman // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/ for most recent version. // Boost config.hpp policy and rationale documentation has been moved to // http://www.boost.org/libs/config/ // // This file is intended to be stable, and relatively unchanging. // It should contain boilerplate code only - no compiler specific // code unless it is unavoidable - no changes unless unavoidable. #ifndef BOOST_CONFIG_SUFFIX_HPP #define BOOST_CONFIG_SUFFIX_HPP // // look for long long by looking for the appropriate macros in . // Note that we use limits.h rather than climits for maximal portability, // remember that since these just declare a bunch of macros, there should be // no namespace issues from this. // #if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_LONG_LONG) \ && !defined(BOOST_MSVC) && !defined(__BORLANDC__) # include # if (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX)) # define BOOST_HAS_LONG_LONG # else # define BOOST_NO_LONG_LONG # endif #endif // GCC 3.x will clean up all of those nasty macro definitions that // BOOST_NO_CTYPE_FUNCTIONS is intended to help work around, so undefine // it under GCC 3.x. #if defined(__GNUC__) && (__GNUC__ >= 3) && defined(BOOST_NO_CTYPE_FUNCTIONS) # undef BOOST_NO_CTYPE_FUNCTIONS #endif // // Assume any extensions are in namespace std:: unless stated otherwise: // # ifndef BOOST_STD_EXTENSION_NAMESPACE # define BOOST_STD_EXTENSION_NAMESPACE std # endif // // If cv-qualified specializations are not allowed, then neither are cv-void ones: // # if defined(BOOST_NO_CV_SPECIALIZATIONS) \ && !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) # define BOOST_NO_CV_VOID_SPECIALIZATIONS # endif // // If there is no numeric_limits template, then it can't have any compile time // constants either! // # if defined(BOOST_NO_LIMITS) \ && !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS # define BOOST_NO_MS_INT64_NUMERIC_LIMITS # define BOOST_NO_LONG_LONG_NUMERIC_LIMITS # endif // // if there is no long long then there is no specialisation // for numeric_limits either: // #if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS) # define BOOST_NO_LONG_LONG_NUMERIC_LIMITS #endif // // if there is no __int64 then there is no specialisation // for numeric_limits<__int64> either: // #if !defined(BOOST_HAS_MS_INT64) && !defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS) # define BOOST_NO_MS_INT64_NUMERIC_LIMITS #endif // // if member templates are supported then so is the // VC6 subset of member templates: // # if !defined(BOOST_NO_MEMBER_TEMPLATES) \ && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) # define BOOST_MSVC6_MEMBER_TEMPLATES # endif // // Without partial specialization, can't test for partial specialisation bugs: // # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ && !defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) # define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG # endif // // Without partial specialization, we can't have array-type partial specialisations: // # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ && !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) # define BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS # endif // // Without partial specialization, std::iterator_traits can't work: // # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ && !defined(BOOST_NO_STD_ITERATOR_TRAITS) # define BOOST_NO_STD_ITERATOR_TRAITS # endif // // Without partial specialization, partial // specialization with default args won't work either: // # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ && !defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS) # define BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS # endif // // Without member template support, we can't have template constructors // in the standard library either: // # if defined(BOOST_NO_MEMBER_TEMPLATES) \ && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \ && !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) # define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS # endif // // Without member template support, we can't have a conforming // std::allocator template either: // # if defined(BOOST_NO_MEMBER_TEMPLATES) \ && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \ && !defined(BOOST_NO_STD_ALLOCATOR) # define BOOST_NO_STD_ALLOCATOR # endif // // without ADL support then using declarations will break ADL as well: // #if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) && !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL #endif // // Without typeid support we have no dynamic RTTI either: // #if defined(BOOST_NO_TYPEID) && !defined(BOOST_NO_RTTI) # define BOOST_NO_RTTI #endif // // If we have a standard allocator, then we have a partial one as well: // #if !defined(BOOST_NO_STD_ALLOCATOR) # define BOOST_HAS_PARTIAL_STD_ALLOCATOR #endif // // We can't have a working std::use_facet if there is no std::locale: // # if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_USE_FACET) # define BOOST_NO_STD_USE_FACET # endif // // We can't have a std::messages facet if there is no std::locale: // # if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_MESSAGES) # define BOOST_NO_STD_MESSAGES # endif // // We can't have a working std::wstreambuf if there is no std::locale: // # if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_WSTREAMBUF) # define BOOST_NO_STD_WSTREAMBUF # endif // // We can't have a if there is no : // # if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_CWCTYPE) # define BOOST_NO_CWCTYPE # endif // // We can't have a swprintf if there is no : // # if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_SWPRINTF) # define BOOST_NO_SWPRINTF # endif // // If Win32 support is turned off, then we must turn off // threading support also, unless there is some other // thread API enabled: // #if defined(BOOST_DISABLE_WIN32) && defined(_WIN32) \ && !defined(BOOST_DISABLE_THREADS) && !defined(BOOST_HAS_PTHREADS) # define BOOST_DISABLE_THREADS #endif // // Turn on threading support if the compiler thinks that it's in // multithreaded mode. We put this here because there are only a // limited number of macros that identify this (if there's any missing // from here then add to the appropriate compiler section): // #if (defined(__MT__) || defined(_MT) || defined(_REENTRANT) \ || defined(_PTHREADS) || defined(__APPLE__) || defined(__DragonFly__)) \ && !defined(BOOST_HAS_THREADS) # define BOOST_HAS_THREADS #endif // // Turn threading support off if BOOST_DISABLE_THREADS is defined: // #if defined(BOOST_DISABLE_THREADS) && defined(BOOST_HAS_THREADS) # undef BOOST_HAS_THREADS #endif // // Turn threading support off if we don't recognise the threading API: // #if defined(BOOST_HAS_THREADS) && !defined(BOOST_HAS_PTHREADS)\ && !defined(BOOST_HAS_WINTHREADS) && !defined(BOOST_HAS_BETHREADS)\ && !defined(BOOST_HAS_MPTASKS) # undef BOOST_HAS_THREADS #endif // // Turn threading detail macros off if we don't (want to) use threading // #ifndef BOOST_HAS_THREADS # undef BOOST_HAS_PTHREADS # undef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE # undef BOOST_HAS_PTHREAD_YIELD # undef BOOST_HAS_PTHREAD_DELAY_NP # undef BOOST_HAS_WINTHREADS # undef BOOST_HAS_BETHREADS # undef BOOST_HAS_MPTASKS #endif // // If the compiler claims to be C99 conformant, then it had better // have a : // # if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) # define BOOST_HAS_STDINT_H # ifndef BOOST_HAS_LOG1P # define BOOST_HAS_LOG1P # endif # ifndef BOOST_HAS_EXPM1 # define BOOST_HAS_EXPM1 # endif # endif // // Define BOOST_NO_SLIST and BOOST_NO_HASH if required. // Note that this is for backwards compatibility only. // # if !defined(BOOST_HAS_SLIST) && !defined(BOOST_NO_SLIST) # define BOOST_NO_SLIST # endif # if !defined(BOOST_HAS_HASH) && !defined(BOOST_NO_HASH) # define BOOST_NO_HASH # endif // // Set BOOST_SLIST_HEADER if not set already: // #if defined(BOOST_HAS_SLIST) && !defined(BOOST_SLIST_HEADER) # define BOOST_SLIST_HEADER #endif // // Set BOOST_HASH_SET_HEADER if not set already: // #if defined(BOOST_HAS_HASH) && !defined(BOOST_HASH_SET_HEADER) # define BOOST_HASH_SET_HEADER #endif // // Set BOOST_HASH_MAP_HEADER if not set already: // #if defined(BOOST_HAS_HASH) && !defined(BOOST_HASH_MAP_HEADER) # define BOOST_HASH_MAP_HEADER #endif // // Set BOOST_NO_INITIALIZER_LISTS if there is no library support. // #if defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) && !defined(BOOST_NO_INITIALIZER_LISTS) # define BOOST_NO_INITIALIZER_LISTS #endif // BOOST_HAS_ABI_HEADERS // This macro gets set if we have headers that fix the ABI, // and prevent ODR violations when linking to external libraries: #if defined(BOOST_ABI_PREFIX) && defined(BOOST_ABI_SUFFIX) && !defined(BOOST_HAS_ABI_HEADERS) # define BOOST_HAS_ABI_HEADERS #endif #if defined(BOOST_HAS_ABI_HEADERS) && defined(BOOST_DISABLE_ABI_HEADERS) # undef BOOST_HAS_ABI_HEADERS #endif // BOOST_NO_STDC_NAMESPACE workaround --------------------------------------// // Because std::size_t usage is so common, even in boost headers which do not // otherwise use the C library, the workaround is included here so // that ugly workaround code need not appear in many other boost headers. // NOTE WELL: This is a workaround for non-conforming compilers; // must still be #included in the usual places so that inclusion // works as expected with standard conforming compilers. The resulting // double inclusion of is harmless. # ifdef BOOST_NO_STDC_NAMESPACE # include namespace std { using ::ptrdiff_t; using ::size_t; } # endif // Workaround for the unfortunate min/max macros defined by some platform headers #define BOOST_PREVENT_MACRO_SUBSTITUTION #ifndef BOOST_USING_STD_MIN # define BOOST_USING_STD_MIN() using std::min #endif #ifndef BOOST_USING_STD_MAX # define BOOST_USING_STD_MAX() using std::max #endif // BOOST_NO_STD_MIN_MAX workaround -----------------------------------------// # ifdef BOOST_NO_STD_MIN_MAX namespace std { template inline const _Tp& min BOOST_PREVENT_MACRO_SUBSTITUTION (const _Tp& __a, const _Tp& __b) { return __b < __a ? __b : __a; } template inline const _Tp& max BOOST_PREVENT_MACRO_SUBSTITUTION (const _Tp& __a, const _Tp& __b) { return __a < __b ? __b : __a; } } # endif // BOOST_STATIC_CONSTANT workaround --------------------------------------- // // On compilers which don't allow in-class initialization of static integral // constant members, we must use enums as a workaround if we want the constants // to be available at compile-time. This macro gives us a convenient way to // declare such constants. # ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION # define BOOST_STATIC_CONSTANT(type, assignment) enum { assignment } # else # define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment # endif // BOOST_USE_FACET / HAS_FACET workaround ----------------------------------// // When the standard library does not have a conforming std::use_facet there // are various workarounds available, but they differ from library to library. // The same problem occurs with has_facet. // These macros provide a consistent way to access a locale's facets. // Usage: // replace // std::use_facet(loc); // with // BOOST_USE_FACET(Type, loc); // Note do not add a std:: prefix to the front of BOOST_USE_FACET! // Use for BOOST_HAS_FACET is analogous. #if defined(BOOST_NO_STD_USE_FACET) # ifdef BOOST_HAS_TWO_ARG_USE_FACET # define BOOST_USE_FACET(Type, loc) std::use_facet(loc, static_cast(0)) # define BOOST_HAS_FACET(Type, loc) std::has_facet(loc, static_cast(0)) # elif defined(BOOST_HAS_MACRO_USE_FACET) # define BOOST_USE_FACET(Type, loc) std::_USE(loc, Type) # define BOOST_HAS_FACET(Type, loc) std::_HAS(loc, Type) # elif defined(BOOST_HAS_STLP_USE_FACET) # define BOOST_USE_FACET(Type, loc) (*std::_Use_facet(loc)) # define BOOST_HAS_FACET(Type, loc) std::has_facet< Type >(loc) # endif #else # define BOOST_USE_FACET(Type, loc) std::use_facet< Type >(loc) # define BOOST_HAS_FACET(Type, loc) std::has_facet< Type >(loc) #endif // BOOST_NESTED_TEMPLATE workaround ------------------------------------------// // Member templates are supported by some compilers even though they can't use // the A::template member syntax, as a workaround replace: // // typedef typename A::template rebind binder; // // with: // // typedef typename A::BOOST_NESTED_TEMPLATE rebind binder; #ifndef BOOST_NO_MEMBER_TEMPLATE_KEYWORD # define BOOST_NESTED_TEMPLATE template #else # define BOOST_NESTED_TEMPLATE #endif // BOOST_UNREACHABLE_RETURN(x) workaround -------------------------------------// // Normally evaluates to nothing, unless BOOST_NO_UNREACHABLE_RETURN_DETECTION // is defined, in which case it evaluates to return x; Use when you have a return // statement that can never be reached. #ifdef BOOST_NO_UNREACHABLE_RETURN_DETECTION # define BOOST_UNREACHABLE_RETURN(x) return x; #else # define BOOST_UNREACHABLE_RETURN(x) #endif // BOOST_DEDUCED_TYPENAME workaround ------------------------------------------// // // Some compilers don't support the use of `typename' for dependent // types in deduced contexts, e.g. // // template void f(T, typename T::type); // ^^^^^^^^ // Replace these declarations with: // // template void f(T, BOOST_DEDUCED_TYPENAME T::type); #ifndef BOOST_NO_DEDUCED_TYPENAME # define BOOST_DEDUCED_TYPENAME typename #else # define BOOST_DEDUCED_TYPENAME #endif #ifndef BOOST_NO_TYPENAME_WITH_CTOR # define BOOST_CTOR_TYPENAME typename #else # define BOOST_CTOR_TYPENAME #endif // long long workaround ------------------------------------------// // On gcc (and maybe other compilers?) long long is alway supported // but it's use may generate either warnings (with -ansi), or errors // (with -pedantic -ansi) unless it's use is prefixed by __extension__ // #if defined(BOOST_HAS_LONG_LONG) namespace boost{ # ifdef __GNUC__ __extension__ typedef long long long_long_type; __extension__ typedef unsigned long long ulong_long_type; # else typedef long long long_long_type; typedef unsigned long long ulong_long_type; # endif } #endif // BOOST_[APPEND_]EXPLICIT_TEMPLATE_[NON_]TYPE macros --------------------------// // // Some compilers have problems with function templates whose template // parameters don't appear in the function parameter list (basically // they just link one instantiation of the template in the final // executable). These macros provide a uniform way to cope with the // problem with no effects on the calling syntax. // Example: // // #include // #include // #include // // template // void f() { std::cout << n << ' '; } // // template // void g() { std::cout << typeid(T).name() << ' '; } // // int main() { // f<1>(); // f<2>(); // // g(); // g(); // } // // With VC++ 6.0 the output is: // // 2 2 double double // // To fix it, write // // template // void f(BOOST_EXPLICIT_TEMPLATE_NON_TYPE(int, n)) { ... } // // template // void g(BOOST_EXPLICIT_TEMPLATE_TYPE(T)) { ... } // #if defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS # include "boost/type.hpp" # include "boost/non_type.hpp" # define BOOST_EXPLICIT_TEMPLATE_TYPE(t) boost::type* = 0 # define BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) boost::type* # define BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) boost::non_type* = 0 # define BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) boost::non_type* # define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t) \ , BOOST_EXPLICIT_TEMPLATE_TYPE(t) # define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) \ , BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) # define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) \ , BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) # define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) \ , BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) #else // no workaround needed: expand to nothing # define BOOST_EXPLICIT_TEMPLATE_TYPE(t) # define BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) # define BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) # define BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) # define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t) # define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) # define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) # define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) #endif // defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS // ---------------------------------------------------------------------------// // // Helper macro BOOST_STRINGIZE: // Converts the parameter X to a string after macro replacement // on X has been performed. // #define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X) #define BOOST_DO_STRINGIZE(X) #X // // Helper macro BOOST_JOIN: // The following piece of macro magic joins the two // arguments together, even when one of the arguments is // itself a macro (see 16.3.1 in C++ standard). The key // is that macro expansion of macro arguments does not // occur in BOOST_DO_JOIN2 but does in BOOST_DO_JOIN. // #define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y ) #define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y) #define BOOST_DO_JOIN2( X, Y ) X##Y // // Set some default values for compiler/library/platform names. // These are for debugging config setup only: // # ifndef BOOST_COMPILER # define BOOST_COMPILER "Unknown ISO C++ Compiler" # endif # ifndef BOOST_STDLIB # define BOOST_STDLIB "Unknown ISO standard library" # endif # ifndef BOOST_PLATFORM # if defined(unix) || defined(__unix) || defined(_XOPEN_SOURCE) \ || defined(_POSIX_SOURCE) # define BOOST_PLATFORM "Generic Unix" # else # define BOOST_PLATFORM "Unknown" # endif # endif #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/stdlib/0000755000175000017500000000000012320456500023155 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/stdlib/vacpp.hpp0000644000175000017500000000253312320456500025002 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. #if __IBMCPP__ <= 501 # define BOOST_NO_STD_ALLOCATOR #endif #define BOOST_HAS_MACRO_USE_FACET #define BOOST_NO_STD_MESSAGES // C++0x headers not yet implemented // # define BOOST_NO_0X_HDR_ARRAY # define BOOST_NO_0X_HDR_CHRONO # define BOOST_NO_0X_HDR_CODECVT # define BOOST_NO_0X_HDR_CONCEPTS # define BOOST_NO_0X_HDR_CONDITION_VARIABLE # define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS # define BOOST_NO_0X_HDR_FORWARD_LIST # define BOOST_NO_0X_HDR_FUTURE # define BOOST_NO_0X_HDR_INITIALIZER_LIST # define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS # define BOOST_NO_0X_HDR_MEMORY_CONCEPTS # define BOOST_NO_0X_HDR_MUTEX # define BOOST_NO_0X_HDR_RANDOM # define BOOST_NO_0X_HDR_RATIO # define BOOST_NO_0X_HDR_REGEX # define BOOST_NO_0X_HDR_SYSTEM_ERROR # define BOOST_NO_0X_HDR_THREAD # define BOOST_NO_0X_HDR_TUPLE # define BOOST_NO_0X_HDR_TYPE_TRAITS # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET #define BOOST_STDLIB "Visual Age default standard library" ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/stdlib/libstdcpp3.hpp0000644000175000017500000001105512320456500025737 0ustar mathieumathieu// (C) Copyright John Maddock 2001. // (C) Copyright Jens Maurer 2001. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // config for libstdc++ v3 // not much to go in here: #ifdef __GLIBCXX__ #define BOOST_STDLIB "GNU libstdc++ version " BOOST_STRINGIZE(__GLIBCXX__) #else #define BOOST_STDLIB "GNU libstdc++ version " BOOST_STRINGIZE(__GLIBCPP__) #endif #if !defined(_GLIBCPP_USE_WCHAR_T) && !defined(_GLIBCXX_USE_WCHAR_T) # define BOOST_NO_CWCHAR # define BOOST_NO_CWCTYPE # define BOOST_NO_STD_WSTRING # define BOOST_NO_STD_WSTREAMBUF #endif #if defined(__osf__) && !defined(_REENTRANT) \ && ( defined(_GLIBCXX_HAVE_GTHR_DEFAULT) || defined(_GLIBCPP_HAVE_GTHR_DEFAULT) ) // GCC 3 on Tru64 forces the definition of _REENTRANT when any std lib header // file is included, therefore for consistency we define it here as well. # define _REENTRANT #endif #ifdef __GLIBCXX__ // gcc 3.4 and greater: # if defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \ || defined(_GLIBCXX__PTHREADS) // // If the std lib has thread support turned on, then turn it on in Boost // as well. We do this because some gcc-3.4 std lib headers define _REENTANT // while others do not... // # define BOOST_HAS_THREADS # else # define BOOST_DISABLE_THREADS # endif #elif defined(__GLIBCPP__) \ && !defined(_GLIBCPP_HAVE_GTHR_DEFAULT) \ && !defined(_GLIBCPP__PTHREADS) // disable thread support if the std lib was built single threaded: # define BOOST_DISABLE_THREADS #endif #if (defined(linux) || defined(__linux) || defined(__linux__)) && defined(__arm__) && defined(_GLIBCPP_HAVE_GTHR_DEFAULT) // linux on arm apparently doesn't define _REENTRANT // so just turn on threading support whenever the std lib is thread safe: # define BOOST_HAS_THREADS #endif #if !defined(_GLIBCPP_USE_LONG_LONG) \ && !defined(_GLIBCXX_USE_LONG_LONG)\ && defined(BOOST_HAS_LONG_LONG) // May have been set by compiler/*.hpp, but "long long" without library // support is useless. # undef BOOST_HAS_LONG_LONG #endif #if defined(__GLIBCXX__) || (defined(__GLIBCPP__) && __GLIBCPP__>=20020514) // GCC >= 3.1.0 # define BOOST_STD_EXTENSION_NAMESPACE __gnu_cxx # define BOOST_HAS_SLIST # define BOOST_HAS_HASH # define BOOST_SLIST_HEADER # if !defined(__GNUC__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) # define BOOST_HASH_SET_HEADER # define BOOST_HASH_MAP_HEADER # else # define BOOST_HASH_SET_HEADER # define BOOST_HASH_MAP_HEADER # endif #endif // stdlibc++ C++0x support is detected via __GNUC__, __GNUC_MINOR__, and possibly // __GNUC_PATCHLEVEL__ at the suggestion of Jonathan Wakely, one of the stdlibc++ // developers. He also commented: // // "I'm not sure how useful __GLIBCXX__ is for your purposes, for instance in // GCC 4.2.4 it is set to 20080519 but in GCC 4.3.0 it is set to 20080305. // Although 4.3.0 was released earlier than 4.2.4, it has better C++0x support // than any release in the 4.2 series." // // Another resource for understanding stdlibc++ features is: // http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#manual.intro.status.standard.200x // C++0x headers in GCC 4.3.0 and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || !defined(__GXX_EXPERIMENTAL_CXX0X__) # define BOOST_NO_0X_HDR_ARRAY # define BOOST_NO_0X_HDR_RANDOM # define BOOST_NO_0X_HDR_REGEX # define BOOST_NO_0X_HDR_TUPLE # define BOOST_NO_0X_HDR_TYPE_TRAITS # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET #endif // C++0x headers in GCC 4.4.0 and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) || !defined(__GXX_EXPERIMENTAL_CXX0X__) # define BOOST_NO_0X_HDR_CHRONO # define BOOST_NO_0X_HDR_CONDITION_VARIABLE # define BOOST_NO_0X_HDR_FORWARD_LIST # define BOOST_NO_0X_HDR_INITIALIZER_LIST # define BOOST_NO_0X_HDR_MUTEX # define BOOST_NO_0X_HDR_RATIO # define BOOST_NO_0X_HDR_SYSTEM_ERROR # define BOOST_NO_0X_HDR_THREAD #endif // C++0x headers not yet implemented // # define BOOST_NO_0X_HDR_CODECVT # define BOOST_NO_0X_HDR_CONCEPTS # define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS # define BOOST_NO_0X_HDR_FUTURE # define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS # define BOOST_NO_0X_HDR_MEMORY_CONCEPTS // --- end --- ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/stdlib/dinkumware.hpp0000644000175000017500000001110712320456500026034 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Jens Maurer 2001. // (C) Copyright Peter Dimov 2001. // (C) Copyright David Abrahams 2002. // (C) Copyright Guillaume Melquiond 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Dinkumware standard library config: #if !defined(_YVALS) && !defined(_CPPLIB_VER) #include #if !defined(_YVALS) && !defined(_CPPLIB_VER) #error This is not the Dinkumware lib! #endif #endif #if defined(_CPPLIB_VER) && (_CPPLIB_VER >= 306) // full dinkumware 3.06 and above // fully conforming provided the compiler supports it: # if !(defined(_GLOBAL_USING) && (_GLOBAL_USING+0 > 0)) && !defined(__BORLANDC__) && !defined(_STD) && !(defined(__ICC) && (__ICC >= 700)) // can be defined in yvals.h # define BOOST_NO_STDC_NAMESPACE # endif # if !(defined(_HAS_MEMBER_TEMPLATES_REBIND) && (_HAS_MEMBER_TEMPLATES_REBIND+0 > 0)) && !(defined(_MSC_VER) && (_MSC_VER > 1300)) && defined(BOOST_MSVC) # define BOOST_NO_STD_ALLOCATOR # endif # define BOOST_HAS_PARTIAL_STD_ALLOCATOR # if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) // if this lib version is set up for vc6 then there is no std::use_facet: # define BOOST_NO_STD_USE_FACET # define BOOST_HAS_TWO_ARG_USE_FACET // C lib functions aren't in namespace std either: # define BOOST_NO_STDC_NAMESPACE // and nor is # define BOOST_NO_EXCEPTION_STD_NAMESPACE # endif // There's no numeric_limits support unless _LONGLONG is defined: # if !defined(_LONGLONG) && (_CPPLIB_VER <= 310) # define BOOST_NO_MS_INT64_NUMERIC_LIMITS # endif // 3.06 appears to have (non-sgi versions of) & , // and no at all #else # define BOOST_MSVC_STD_ITERATOR 1 # define BOOST_NO_STD_ITERATOR # define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS # define BOOST_NO_STD_ALLOCATOR # define BOOST_NO_STDC_NAMESPACE # define BOOST_NO_STD_USE_FACET # define BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN # define BOOST_HAS_MACRO_USE_FACET # ifndef _CPPLIB_VER // Updated Dinkum library defines this, and provides // its own min and max definitions, as does MTA version. # ifndef __MTA__ # define BOOST_NO_STD_MIN_MAX # endif # define BOOST_NO_MS_INT64_NUMERIC_LIMITS # endif #endif // // std extension namespace is stdext for vc7.1 and later, // the same applies to other compilers that sit on top // of vc7.1 (Intel and Comeau): // #if defined(_MSC_VER) && (_MSC_VER >= 1310) && !defined(__BORLANDC__) # define BOOST_STD_EXTENSION_NAMESPACE stdext #endif #if (defined(_MSC_VER) && (_MSC_VER <= 1300) && !defined(__BORLANDC__)) || !defined(_CPPLIB_VER) || (_CPPLIB_VER < 306) // if we're using a dinkum lib that's // been configured for VC6/7 then there is // no iterator traits (true even for icl) # define BOOST_NO_STD_ITERATOR_TRAITS #endif #if defined(__ICL) && (__ICL < 800) && defined(_CPPLIB_VER) && (_CPPLIB_VER <= 310) // Intel C++ chokes over any non-trivial use of // this may be an overly restrictive define, but regex fails without it: # define BOOST_NO_STD_LOCALE #endif // C++0x headers implemented in 520 (as shipped by Microsoft) // #if !defined(_CPPLIB_VER) || _CPPLIB_VER < 520 # define BOOST_NO_0X_HDR_ARRAY # define BOOST_NO_0X_HDR_CODECVT # define BOOST_NO_0X_HDR_FORWARD_LIST # define BOOST_NO_0X_HDR_INITIALIZER_LIST # define BOOST_NO_0X_HDR_RANDOM # define BOOST_NO_0X_HDR_REGEX # define BOOST_NO_0X_HDR_SYSTEM_ERROR # define BOOST_NO_0X_HDR_TYPE_TRAITS # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET #endif // C++0x headers not yet implemented // # define BOOST_NO_0X_HDR_CHRONO # define BOOST_NO_0X_HDR_CONCEPTS # define BOOST_NO_0X_HDR_CONDITION_VARIABLE # define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS # define BOOST_NO_0X_HDR_FUTURE # define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS # define BOOST_NO_0X_HDR_MEMORY_CONCEPTS # define BOOST_NO_0X_HDR_MUTEX # define BOOST_NO_0X_HDR_RATIO # define BOOST_NO_0X_HDR_THREAD # define BOOST_NO_0X_HDR_TUPLE #ifdef _CPPLIB_VER # define BOOST_DINKUMWARE_STDLIB _CPPLIB_VER #else # define BOOST_DINKUMWARE_STDLIB 1 #endif #ifdef _CPPLIB_VER # define BOOST_STDLIB "Dinkumware standard library version " BOOST_STRINGIZE(_CPPLIB_VER) #else # define BOOST_STDLIB "Dinkumware standard library version 1.x" #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/stdlib/stlport.hpp0000644000175000017500000001700712320456500025402 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2002. // (C) Copyright Darin Adler 2001. // (C) Copyright Jens Maurer 2001. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // STLPort standard library config: #if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) # include # if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) # error "This is not STLPort!" # endif #endif // // __STL_STATIC_CONST_INIT_BUG implies BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS // for versions prior to 4.1(beta) // #if (defined(__STL_STATIC_CONST_INIT_BUG) || defined(_STLP_STATIC_CONST_INIT_BUG)) && (__SGI_STL_PORT <= 0x400) # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS #endif // // If STLport thinks that there is no partial specialisation, then there is no // std::iterator traits: // #if !(defined(_STLP_CLASS_PARTIAL_SPECIALIZATION) || defined(__STL_CLASS_PARTIAL_SPECIALIZATION)) # define BOOST_NO_STD_ITERATOR_TRAITS #endif // // No new style iostreams on GCC without STLport's iostreams enabled: // #if (defined(__GNUC__) && (__GNUC__ < 3)) && !(defined(__SGI_STL_OWN_IOSTREAMS) || defined(_STLP_OWN_IOSTREAMS)) # define BOOST_NO_STRINGSTREAM #endif // // No new iostreams implies no std::locale, and no std::stringstream: // #if defined(__STL_NO_IOSTREAMS) || defined(__STL_NO_NEW_IOSTREAMS) || defined(_STLP_NO_IOSTREAMS) || defined(_STLP_NO_NEW_IOSTREAMS) # define BOOST_NO_STD_LOCALE # define BOOST_NO_STRINGSTREAM #endif // // If the streams are not native, and we have a "using ::x" compiler bug // then the io stream facets are not available in namespace std:: // #ifdef _STLPORT_VERSION # if !(_STLPORT_VERSION >= 0x500) && !defined(_STLP_OWN_IOSTREAMS) && defined(_STLP_USE_NAMESPACES) && defined(BOOST_NO_USING_TEMPLATE) && !defined(__BORLANDC__) # define BOOST_NO_STD_LOCALE # endif #else # if !defined(__SGI_STL_OWN_IOSTREAMS) && defined(__STL_USE_NAMESPACES) && defined(BOOST_NO_USING_TEMPLATE) && !defined(__BORLANDC__) # define BOOST_NO_STD_LOCALE # endif #endif #if defined(_STLPORT_VERSION) && ((_STLPORT_VERSION < 0x500) || (_STLPORT_VERSION >= 0x520)) # define BOOST_NO_STD_UNORDERED #endif #if defined(_STLPORT_VERSION) && (_STLPORT_VERSION >= 0x520) # define BOOST_HAS_TR1_UNORDERED_SET # define BOOST_HAS_TR1_UNORDERED_MAP #endif // // Without member template support enabled, their are no template // iterate constructors, and no std::allocator: // #if !(defined(__STL_MEMBER_TEMPLATES) || defined(_STLP_MEMBER_TEMPLATES)) # define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS # define BOOST_NO_STD_ALLOCATOR #endif // // however we always have at least a partial allocator: // #define BOOST_HAS_PARTIAL_STD_ALLOCATOR #if !defined(_STLP_MEMBER_TEMPLATE_CLASSES) || defined(_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) # define BOOST_NO_STD_ALLOCATOR #endif #if defined(_STLP_NO_MEMBER_TEMPLATE_KEYWORD) && defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) # define BOOST_NO_STD_ALLOCATOR #endif // // If STLport thinks there is no wchar_t at all, then we have to disable // the support for the relevant specilazations of std:: templates. // #if !defined(_STLP_HAS_WCHAR_T) && !defined(_STLP_WCHAR_T_IS_USHORT) # ifndef BOOST_NO_STD_WSTRING # define BOOST_NO_STD_WSTRING # endif # ifndef BOOST_NO_STD_WSTREAMBUF # define BOOST_NO_STD_WSTREAMBUF # endif #endif // // We always have SGI style hash_set, hash_map, and slist: // #ifndef _STLP_NO_EXTENSIONS #define BOOST_HAS_HASH #define BOOST_HAS_SLIST #endif // // STLport does a good job of importing names into namespace std::, // but doesn't always get them all, define BOOST_NO_STDC_NAMESPACE, since our // workaround does not conflict with STLports: // // // Harold Howe says: // Borland switched to STLport in BCB6. Defining BOOST_NO_STDC_NAMESPACE with // BCB6 does cause problems. If we detect C++ Builder, then don't define // BOOST_NO_STDC_NAMESPACE // #if !defined(__BORLANDC__) && !defined(__DMC__) // // If STLport is using it's own namespace, and the real names are in // the global namespace, then we duplicate STLport's using declarations // (by defining BOOST_NO_STDC_NAMESPACE), we do this because STLport doesn't // necessarily import all the names we need into namespace std:: // # if (defined(__STL_IMPORT_VENDOR_CSTD) \ || defined(__STL_USE_OWN_NAMESPACE) \ || defined(_STLP_IMPORT_VENDOR_CSTD) \ || defined(_STLP_USE_OWN_NAMESPACE)) \ && (defined(__STL_VENDOR_GLOBAL_CSTD) || defined (_STLP_VENDOR_GLOBAL_CSTD)) # define BOOST_NO_STDC_NAMESPACE # define BOOST_NO_EXCEPTION_STD_NAMESPACE # endif #elif defined(__BORLANDC__) && __BORLANDC__ < 0x560 // STLport doesn't import std::abs correctly: #include namespace std { using ::abs; } // and strcmp/strcpy don't get imported either ('cos they are macros) #include #ifdef strcpy # undef strcpy #endif #ifdef strcmp # undef strcmp #endif #ifdef _STLP_VENDOR_CSTD namespace std{ using _STLP_VENDOR_CSTD::strcmp; using _STLP_VENDOR_CSTD::strcpy; } #endif #endif // // std::use_facet may be non-standard, uses a class instead: // #if defined(__STL_NO_EXPLICIT_FUNCTION_TMPL_ARGS) || defined(_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS) # define BOOST_NO_STD_USE_FACET # define BOOST_HAS_STLP_USE_FACET #endif // // If STLport thinks there are no wide functions, etc. is not working; but // only if BOOST_NO_STDC_NAMESPACE is not defined (if it is then we do the import // into std:: ourselves). // #if defined(_STLP_NO_NATIVE_WIDE_FUNCTIONS) && !defined(BOOST_NO_STDC_NAMESPACE) # define BOOST_NO_CWCHAR # define BOOST_NO_CWCTYPE #endif // // If STLport for some reason was configured so that it thinks that wchar_t // is not an intrinsic type, then we have to disable the support for it as // well (we would be missing required specializations otherwise). // #if !defined( _STLP_HAS_WCHAR_T) || defined(_STLP_WCHAR_T_IS_USHORT) # undef BOOST_NO_INTRINSIC_WCHAR_T # define BOOST_NO_INTRINSIC_WCHAR_T #endif // // Borland ships a version of STLport with C++ Builder 6 that lacks // hashtables and the like: // #if defined(__BORLANDC__) && (__BORLANDC__ == 0x560) # undef BOOST_HAS_HASH #endif // // gcc-2.95.3/STLPort does not like the using declarations we use to get ADL with std::min/max // #if defined(__GNUC__) && (__GNUC__ < 3) # include // for std::min and std::max # define BOOST_USING_STD_MIN() ((void)0) # define BOOST_USING_STD_MAX() ((void)0) namespace boost { using std::min; using std::max; } #endif // C++0x headers not yet implemented // # define BOOST_NO_0X_HDR_ARRAY # define BOOST_NO_0X_HDR_CHRONO # define BOOST_NO_0X_HDR_CODECVT # define BOOST_NO_0X_HDR_CONCEPTS # define BOOST_NO_0X_HDR_CONDITION_VARIABLE # define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS # define BOOST_NO_0X_HDR_FORWARD_LIST # define BOOST_NO_0X_HDR_FUTURE # define BOOST_NO_0X_HDR_INITIALIZER_LIST # define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS # define BOOST_NO_0X_HDR_MEMORY_CONCEPTS # define BOOST_NO_0X_HDR_MUTEX # define BOOST_NO_0X_HDR_RANDOM # define BOOST_NO_0X_HDR_RATIO # define BOOST_NO_0X_HDR_REGEX # define BOOST_NO_0X_HDR_SYSTEM_ERROR # define BOOST_NO_0X_HDR_THREAD # define BOOST_NO_0X_HDR_TUPLE # define BOOST_NO_0X_HDR_TYPE_TRAITS # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET #define BOOST_STDLIB "STLPort standard library version " BOOST_STRINGIZE(__SGI_STL_PORT) ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/stdlib/libcomo.hpp0000644000175000017500000000420012320456500025306 0ustar mathieumathieu// (C) Copyright John Maddock 2002 - 2003. // (C) Copyright Jens Maurer 2002 - 2003. // (C) Copyright Beman Dawes 2002 - 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Comeau STL: #if !defined(__LIBCOMO__) # include # if !defined(__LIBCOMO__) # error "This is not the Comeau STL!" # endif #endif // // std::streambuf is non-standard // NOTE: versions of libcomo prior to beta28 have octal version numbering, // e.g. version 25 is 21 (dec) #if __LIBCOMO_VERSION__ <= 22 # define BOOST_NO_STD_WSTREAMBUF #endif #if (__LIBCOMO_VERSION__ <= 31) && defined(_WIN32) #define BOOST_NO_SWPRINTF #endif #if __LIBCOMO_VERSION__ >= 31 # define BOOST_HAS_HASH # define BOOST_HAS_SLIST #endif // C++0x headers not yet implemented // # define BOOST_NO_0X_HDR_ARRAY # define BOOST_NO_0X_HDR_CHRONO # define BOOST_NO_0X_HDR_CODECVT # define BOOST_NO_0X_HDR_CONCEPTS # define BOOST_NO_0X_HDR_CONDITION_VARIABLE # define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS # define BOOST_NO_0X_HDR_FORWARD_LIST # define BOOST_NO_0X_HDR_FUTURE # define BOOST_NO_0X_HDR_INITIALIZER_LIST # define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS # define BOOST_NO_0X_HDR_MEMORY_CONCEPTS # define BOOST_NO_0X_HDR_MUTEX # define BOOST_NO_0X_HDR_RANDOM # define BOOST_NO_0X_HDR_RATIO # define BOOST_NO_0X_HDR_REGEX # define BOOST_NO_0X_HDR_SYSTEM_ERROR # define BOOST_NO_0X_HDR_THREAD # define BOOST_NO_0X_HDR_TUPLE # define BOOST_NO_0X_HDR_TYPE_TRAITS # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET // // Intrinsic type_traits support. // The SGI STL has it's own __type_traits class, which // has intrinsic compiler support with SGI's compilers. // Whatever map SGI style type traits to boost equivalents: // #define BOOST_HAS_SGI_TYPE_TRAITS #define BOOST_STDLIB "Comeau standard library " BOOST_STRINGIZE(__LIBCOMO_VERSION__) ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/stdlib/roguewave.hpp0000644000175000017500000001257412320456500025703 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Jens Maurer 2001. // (C) Copyright David Abrahams 2003. // (C) Copyright Boris Gubenko 2007. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Rogue Wave std lib: #if !defined(__STD_RWCOMPILER_H__) && !defined(_RWSTD_VER) # include # if !defined(__STD_RWCOMPILER_H__) && !defined(_RWSTD_VER) # error This is not the Rogue Wave standard library # endif #endif // // figure out a consistent version number: // #ifndef _RWSTD_VER # define BOOST_RWSTD_VER 0x010000 #elif _RWSTD_VER < 0x010000 # define BOOST_RWSTD_VER (_RWSTD_VER << 8) #else # define BOOST_RWSTD_VER _RWSTD_VER #endif #ifndef _RWSTD_VER # define BOOST_STDLIB "Rogue Wave standard library version (Unknown version)" #elif _RWSTD_VER < 0x04010200 # define BOOST_STDLIB "Rogue Wave standard library version " BOOST_STRINGIZE(_RWSTD_VER) #else # ifdef _RWSTD_VER_STR # define BOOST_STDLIB "Apache STDCXX standard library version " _RWSTD_VER_STR # else # define BOOST_STDLIB "Apache STDCXX standard library version " BOOST_STRINGIZE(_RWSTD_VER) # endif #endif // // Prior to version 2.2.0 the primary template for std::numeric_limits // does not have compile time constants, even though specializations of that // template do: // #if BOOST_RWSTD_VER < 0x020200 # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS #endif // Sun CC 5.5 patch 113817-07 adds long long specialization, but does not change the // library version number (http://sunsolve6.sun.com/search/document.do?assetkey=1-21-113817): #if BOOST_RWSTD_VER <= 0x020101 && (!defined(__SUNPRO_CC) || (__SUNPRO_CC < 0x550)) # define BOOST_NO_LONG_LONG_NUMERIC_LIMITS # endif // // Borland version of numeric_limits lacks __int64 specialisation: // #ifdef __BORLANDC__ # define BOOST_NO_MS_INT64_NUMERIC_LIMITS #endif // // No std::iterator if it can't figure out default template args: // #if defined(_RWSTD_NO_SIMPLE_DEFAULT_TEMPLATES) || defined(RWSTD_NO_SIMPLE_DEFAULT_TEMPLATES) || (BOOST_RWSTD_VER < 0x020000) # define BOOST_NO_STD_ITERATOR #endif // // No iterator traits without partial specialization: // #if defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) || defined(RWSTD_NO_CLASS_PARTIAL_SPEC) # define BOOST_NO_STD_ITERATOR_TRAITS #endif // // Prior to version 2.0, std::auto_ptr was buggy, and there were no // new-style iostreams, and no conformant std::allocator: // #if (BOOST_RWSTD_VER < 0x020000) # define BOOST_NO_AUTO_PTR # define BOOST_NO_STRINGSTREAM # define BOOST_NO_STD_ALLOCATOR # define BOOST_NO_STD_LOCALE #endif // // No template iterator constructors without member template support: // #if defined(RWSTD_NO_MEMBER_TEMPLATES) || defined(_RWSTD_NO_MEMBER_TEMPLATES) # define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS #endif // // RW defines _RWSTD_ALLOCATOR if the allocator is conformant and in use // (the or _HPACC_ part is a hack - the library seems to define _RWSTD_ALLOCATOR // on HP aCC systems even though the allocator is in fact broken): // #if !defined(_RWSTD_ALLOCATOR) || (defined(__HP_aCC) && __HP_aCC <= 33100) # define BOOST_NO_STD_ALLOCATOR #endif // // If we have a std::locale, we still may not have std::use_facet: // #if defined(_RWSTD_NO_TEMPLATE_ON_RETURN_TYPE) && !defined(BOOST_NO_STD_LOCALE) # define BOOST_NO_STD_USE_FACET # define BOOST_HAS_TWO_ARG_USE_FACET #endif // // There's no std::distance prior to version 2, or without // partial specialization support: // #if (BOOST_RWSTD_VER < 0x020000) || defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) #define BOOST_NO_STD_DISTANCE #endif // // Some versions of the rogue wave library don't have assignable // OutputIterators: // #if BOOST_RWSTD_VER < 0x020100 # define BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN #endif // // Disable BOOST_HAS_LONG_LONG when the library has no support for it. // #if !defined(_RWSTD_LONG_LONG) && defined(BOOST_HAS_LONG_LONG) # undef BOOST_HAS_LONG_LONG #endif // // check that on HP-UX, the proper RW library is used // #if defined(__HP_aCC) && !defined(_HP_NAMESPACE_STD) # error "Boost requires Standard RW library. Please compile and link with -AA" #endif // // Define macros specific to RW V2.2 on HP-UX // #if defined(__HP_aCC) && (BOOST_RWSTD_VER == 0x02020100) # ifndef __HP_TC1_MAKE_PAIR # define __HP_TC1_MAKE_PAIR # endif # ifndef _HP_INSTANTIATE_STD2_VL # define _HP_INSTANTIATE_STD2_VL # endif #endif // C++0x headers not yet implemented // # define BOOST_NO_0X_HDR_ARRAY # define BOOST_NO_0X_HDR_CHRONO # define BOOST_NO_0X_HDR_CODECVT # define BOOST_NO_0X_HDR_CONCEPTS # define BOOST_NO_0X_HDR_CONDITION_VARIABLE # define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS # define BOOST_NO_0X_HDR_FORWARD_LIST # define BOOST_NO_0X_HDR_FUTURE # define BOOST_NO_0X_HDR_INITIALIZER_LIST # define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS # define BOOST_NO_0X_HDR_MEMORY_CONCEPTS # define BOOST_NO_0X_HDR_MUTEX # define BOOST_NO_0X_HDR_RANDOM # define BOOST_NO_0X_HDR_RATIO # define BOOST_NO_0X_HDR_REGEX # define BOOST_NO_0X_HDR_SYSTEM_ERROR # define BOOST_NO_0X_HDR_THREAD # define BOOST_NO_0X_HDR_TUPLE # define BOOST_NO_0X_HDR_TYPE_TRAITS # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/stdlib/msl.hpp0000644000175000017500000000420612320456500024463 0ustar mathieumathieu// (C) Copyright John Maddock 2001. // (C) Copyright Darin Adler 2001. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Metrowerks standard library: #ifndef __MSL_CPP__ # include # ifndef __MSL_CPP__ # error This is not the MSL standard library! # endif #endif #if __MSL_CPP__ >= 0x6000 // Pro 6 # define BOOST_HAS_HASH # define BOOST_STD_EXTENSION_NAMESPACE Metrowerks #endif #define BOOST_HAS_SLIST #if __MSL_CPP__ < 0x6209 # define BOOST_NO_STD_MESSAGES #endif // check C lib version for #include #if defined(__MSL__) && (__MSL__ >= 0x5000) # define BOOST_HAS_STDINT_H # if !defined(__PALMOS_TRAPS__) # define BOOST_HAS_UNISTD_H # endif // boilerplate code: # include #endif #if defined(_MWMT) || _MSL_THREADSAFE # define BOOST_HAS_THREADS #endif #ifdef _MSL_NO_EXPLICIT_FUNC_TEMPLATE_ARG # define BOOST_NO_STD_USE_FACET # define BOOST_HAS_TWO_ARG_USE_FACET #endif // C++0x headers not yet implemented // # define BOOST_NO_0X_HDR_ARRAY # define BOOST_NO_0X_HDR_CHRONO # define BOOST_NO_0X_HDR_CODECVT # define BOOST_NO_0X_HDR_CONCEPTS # define BOOST_NO_0X_HDR_CONDITION_VARIABLE # define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS # define BOOST_NO_0X_HDR_FORWARD_LIST # define BOOST_NO_0X_HDR_FUTURE # define BOOST_NO_0X_HDR_INITIALIZER_LIST # define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS # define BOOST_NO_0X_HDR_MEMORY_CONCEPTS # define BOOST_NO_0X_HDR_MUTEX # define BOOST_NO_0X_HDR_RANDOM # define BOOST_NO_0X_HDR_RATIO # define BOOST_NO_0X_HDR_REGEX # define BOOST_NO_0X_HDR_SYSTEM_ERROR # define BOOST_NO_0X_HDR_THREAD # define BOOST_NO_0X_HDR_TUPLE # define BOOST_NO_0X_HDR_TYPE_TRAITS # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET #define BOOST_STDLIB "Metrowerks Standard Library version " BOOST_STRINGIZE(__MSL_CPP__) ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/stdlib/sgi.hpp0000644000175000017500000000770512320456500024461 0ustar mathieumathieu// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Darin Adler 2001. // (C) Copyright Jens Maurer 2001 - 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // generic SGI STL: #if !defined(__STL_CONFIG_H) # include # if !defined(__STL_CONFIG_H) # error "This is not the SGI STL!" # endif #endif // // No std::iterator traits without partial specialisation: // #if !defined(__STL_CLASS_PARTIAL_SPECIALIZATION) # define BOOST_NO_STD_ITERATOR_TRAITS #endif // // No std::stringstream with gcc < 3 // #if defined(__GNUC__) && (__GNUC__ < 3) && \ ((__GNUC_MINOR__ < 95) || (__GNUC_MINOR__ == 96)) && \ !defined(__STL_USE_NEW_IOSTREAMS) || \ defined(__APPLE_CC__) // Note that we only set this for GNU C++ prior to 2.95 since the // latest patches for that release do contain a minimal // If you are running a 2.95 release prior to 2.95.3 then this will need // setting, but there is no way to detect that automatically (other // than by running the configure script). // Also, the unofficial GNU C++ 2.96 included in RedHat 7.1 doesn't // have . # define BOOST_NO_STRINGSTREAM #endif // // Assume no std::locale without own iostreams (this may be an // incorrect assumption in some cases): // #if !defined(__SGI_STL_OWN_IOSTREAMS) && !defined(__STL_USE_NEW_IOSTREAMS) # define BOOST_NO_STD_LOCALE #endif // // Original native SGI streams have non-standard std::messages facet: // #if defined(__sgi) && (_COMPILER_VERSION <= 650) && !defined(__SGI_STL_OWN_IOSTREAMS) # define BOOST_NO_STD_LOCALE #endif // // SGI's new iostreams have missing "const" in messages<>::open // #if defined(__sgi) && (_COMPILER_VERSION <= 740) && defined(__STL_USE_NEW_IOSTREAMS) # define BOOST_NO_STD_MESSAGES #endif // // No template iterator constructors, or std::allocator // without member templates: // #if !defined(__STL_MEMBER_TEMPLATES) # define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS # define BOOST_NO_STD_ALLOCATOR #endif // // We always have SGI style hash_set, hash_map, and slist: // #define BOOST_HAS_HASH #define BOOST_HAS_SLIST // // If this is GNU libstdc++2, then no and no std::wstring: // #if (defined(__GNUC__) && (__GNUC__ < 3)) # include # if defined(__BASTRING__) # define BOOST_NO_LIMITS // Note: will provide compile-time constants # undef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS # define BOOST_NO_STD_WSTRING # endif #endif // // There is no standard iterator unless we have namespace support: // #if !defined(__STL_USE_NAMESPACES) # define BOOST_NO_STD_ITERATOR #endif // // Intrinsic type_traits support. // The SGI STL has it's own __type_traits class, which // has intrinsic compiler support with SGI's compilers. // Whatever map SGI style type traits to boost equivalents: // #define BOOST_HAS_SGI_TYPE_TRAITS // C++0x headers not yet implemented // # define BOOST_NO_0X_HDR_ARRAY # define BOOST_NO_0X_HDR_CHRONO # define BOOST_NO_0X_HDR_CODECVT # define BOOST_NO_0X_HDR_CONCEPTS # define BOOST_NO_0X_HDR_CONDITION_VARIABLE # define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS # define BOOST_NO_0X_HDR_FORWARD_LIST # define BOOST_NO_0X_HDR_FUTURE # define BOOST_NO_0X_HDR_INITIALIZER_LIST # define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS # define BOOST_NO_0X_HDR_MEMORY_CONCEPTS # define BOOST_NO_0X_HDR_MUTEX # define BOOST_NO_0X_HDR_RANDOM # define BOOST_NO_0X_HDR_RATIO # define BOOST_NO_0X_HDR_REGEX # define BOOST_NO_0X_HDR_SYSTEM_ERROR # define BOOST_NO_0X_HDR_THREAD # define BOOST_NO_0X_HDR_TUPLE # define BOOST_NO_0X_HDR_TYPE_TRAITS # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET #define BOOST_STDLIB "SGI standard library" ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/stdlib/modena.hpp0000644000175000017500000000305312320456500025132 0ustar mathieumathieu// (C) Copyright Jens Maurer 2001. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Modena C++ standard library (comes with KAI C++) #if !defined(MSIPL_COMPILE_H) # include # if !defined(__MSIPL_COMPILE_H) # error "This is not the Modena C++ library!" # endif #endif #ifndef MSIPL_NL_TYPES #define BOOST_NO_STD_MESSAGES #endif #ifndef MSIPL_WCHART #define BOOST_NO_STD_WSTRING #endif // C++0x headers not yet implemented // # define BOOST_NO_0X_HDR_ARRAY # define BOOST_NO_0X_HDR_CHRONO # define BOOST_NO_0X_HDR_CODECVT # define BOOST_NO_0X_HDR_CONCEPTS # define BOOST_NO_0X_HDR_CONDITION_VARIABLE # define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS # define BOOST_NO_0X_HDR_FORWARD_LIST # define BOOST_NO_0X_HDR_FUTURE # define BOOST_NO_0X_HDR_INITIALIZER_LIST # define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS # define BOOST_NO_0X_HDR_MEMORY_CONCEPTS # define BOOST_NO_0X_HDR_MUTEX # define BOOST_NO_0X_HDR_RANDOM # define BOOST_NO_0X_HDR_RATIO # define BOOST_NO_0X_HDR_REGEX # define BOOST_NO_0X_HDR_SYSTEM_ERROR # define BOOST_NO_0X_HDR_THREAD # define BOOST_NO_0X_HDR_TUPLE # define BOOST_NO_0X_HDR_TYPE_TRAITS # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET #define BOOST_STDLIB "Modena C++ standard library" ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/auto_link.hpp0000644000175000017500000002420112320456500024371 0ustar mathieumathieu// (C) Copyright John Maddock 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) /* * LOCATION: see http://www.boost.org for most recent version. * FILE auto_link.hpp * VERSION see * DESCRIPTION: Automatic library inclusion for Borland/Microsoft compilers. */ /************************************************************************* USAGE: ~~~~~~ Before including this header you must define one or more of define the following macros: BOOST_LIB_NAME: Required: A string containing the basename of the library, for example boost_regex. BOOST_LIB_TOOLSET: Optional: the base name of the toolset. BOOST_DYN_LINK: Optional: when set link to dll rather than static library. BOOST_LIB_DIAGNOSTIC: Optional: when set the header will print out the name of the library selected (useful for debugging). BOOST_AUTO_LINK_NOMANGLE: Specifies that we should link to BOOST_LIB_NAME.lib, rather than a mangled-name version. These macros will be undef'ed at the end of the header, further this header has no include guards - so be sure to include it only once from your library! Algorithm: ~~~~~~~~~~ Libraries for Borland and Microsoft compilers are automatically selected here, the name of the lib is selected according to the following formula: BOOST_LIB_PREFIX + BOOST_LIB_NAME + "_" + BOOST_LIB_TOOLSET + BOOST_LIB_THREAD_OPT + BOOST_LIB_RT_OPT "-" + BOOST_LIB_VERSION These are defined as: BOOST_LIB_PREFIX: "lib" for static libraries otherwise "". BOOST_LIB_NAME: The base name of the lib ( for example boost_regex). BOOST_LIB_TOOLSET: The compiler toolset name (vc6, vc7, bcb5 etc). BOOST_LIB_THREAD_OPT: "-mt" for multithread builds, otherwise nothing. BOOST_LIB_RT_OPT: A suffix that indicates the runtime library used, contains one or more of the following letters after a hiphen: s static runtime (dynamic if not present). d debug build (release if not present). g debug/diagnostic runtime (release if not present). p STLPort Build. BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. ***************************************************************************/ #ifdef __cplusplus # ifndef BOOST_CONFIG_HPP # include # endif #elif defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__EDG_VERSION__) // // C language compatability (no, honestly) // # define BOOST_MSVC _MSC_VER # define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X) # define BOOST_DO_STRINGIZE(X) #X #endif // // Only include what follows for known and supported compilers: // #if defined(BOOST_MSVC) \ || defined(__BORLANDC__) \ || (defined(__MWERKS__) && defined(_WIN32) && (__MWERKS__ >= 0x3000)) \ || (defined(__ICL) && defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200)) #ifndef BOOST_VERSION_HPP # include #endif #ifndef BOOST_LIB_NAME # error "Macro BOOST_LIB_NAME not set (internal error)" #endif // // error check: // #if defined(__MSVC_RUNTIME_CHECKS) && !defined(_DEBUG) # pragma message("Using the /RTC option without specifying a debug runtime will lead to linker errors") # pragma message("Hint: go to the code generation options and switch to one of the debugging runtimes") # error "Incompatible build options" #endif // // select toolset if not defined already: // #ifndef BOOST_LIB_TOOLSET // Note: no compilers before 1200 are supported #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) # ifdef UNDER_CE // vc6: # define BOOST_LIB_TOOLSET "evc4" # else // vc6: # define BOOST_LIB_TOOLSET "vc6" # endif #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300) // vc7: # define BOOST_LIB_TOOLSET "vc7" #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1310) // vc71: # define BOOST_LIB_TOOLSET "vc71" #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1400) // vc80: # define BOOST_LIB_TOOLSET "vc80" #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1500) // vc90: # define BOOST_LIB_TOOLSET "vc90" #elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1600) // vc10: # define BOOST_LIB_TOOLSET "vc100" #elif defined(__BORLANDC__) // CBuilder 6: # define BOOST_LIB_TOOLSET "bcb" #elif defined(__ICL) // Intel C++, no version number: # define BOOST_LIB_TOOLSET "iw" #elif defined(__MWERKS__) && (__MWERKS__ <= 0x31FF ) // Metrowerks CodeWarrior 8.x # define BOOST_LIB_TOOLSET "cw8" #elif defined(__MWERKS__) && (__MWERKS__ <= 0x32FF ) // Metrowerks CodeWarrior 9.x # define BOOST_LIB_TOOLSET "cw9" #endif #endif // BOOST_LIB_TOOLSET // // select thread opt: // #if defined(_MT) || defined(__MT__) # define BOOST_LIB_THREAD_OPT "-mt" #else # define BOOST_LIB_THREAD_OPT #endif #if defined(_MSC_VER) || defined(__MWERKS__) # ifdef _DLL # if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS)) # if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) # define BOOST_LIB_RT_OPT "-gdp" # elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-gdp" # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") # error "Build options aren't compatible with pre-built libraries" # else # define BOOST_LIB_RT_OPT "-p" # endif # elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) # if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) # define BOOST_LIB_RT_OPT "-gdpn" # elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-gdpn" # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") # error "Build options aren't compatible with pre-built libraries" # else # define BOOST_LIB_RT_OPT "-pn" # endif # else # if defined(_DEBUG) # define BOOST_LIB_RT_OPT "-gd" # else # define BOOST_LIB_RT_OPT # endif # endif # else # if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS)) # if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) # define BOOST_LIB_RT_OPT "-sgdp" # elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-sgdp" # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") # error "Build options aren't compatible with pre-built libraries" # else # define BOOST_LIB_RT_OPT "-sp" # endif # elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) # if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) # define BOOST_LIB_RT_OPT "-sgdpn" # elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-sgdpn" # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") # error "Build options aren't compatible with pre-built libraries" # else # define BOOST_LIB_RT_OPT "-spn" # endif # else # if defined(_DEBUG) # define BOOST_LIB_RT_OPT "-sgd" # else # define BOOST_LIB_RT_OPT "-s" # endif # endif # endif #elif defined(__BORLANDC__) // // figure out whether we want the debug builds or not: // #if __BORLANDC__ > 0x561 #pragma defineonoption BOOST_BORLAND_DEBUG -v #endif // // sanity check: // #if defined(__STL_DEBUG) || defined(_STLP_DEBUG) #error "Pre-built versions of the Boost libraries are not provided in STLPort-debug form" #endif # ifdef _RTLDLL # ifdef BOOST_BORLAND_DEBUG # define BOOST_LIB_RT_OPT "-d" # else # define BOOST_LIB_RT_OPT # endif # else # ifdef BOOST_BORLAND_DEBUG # define BOOST_LIB_RT_OPT "-sd" # else # define BOOST_LIB_RT_OPT "-s" # endif # endif #endif // // select linkage opt: // #if (defined(_DLL) || defined(_RTLDLL)) && defined(BOOST_DYN_LINK) # define BOOST_LIB_PREFIX #elif defined(BOOST_DYN_LINK) # error "Mixing a dll boost library with a static runtime is a really bad idea..." #else # define BOOST_LIB_PREFIX "lib" #endif // // now include the lib: // #if defined(BOOST_LIB_NAME) \ && defined(BOOST_LIB_PREFIX) \ && defined(BOOST_LIB_TOOLSET) \ && defined(BOOST_LIB_THREAD_OPT) \ && defined(BOOST_LIB_RT_OPT) \ && defined(BOOST_LIB_VERSION) #ifndef BOOST_AUTO_LINK_NOMANGLE # pragma comment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib") # ifdef BOOST_LIB_DIAGNOSTIC # pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib") # endif #else # pragma comment(lib, BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib") # ifdef BOOST_LIB_DIAGNOSTIC # pragma message ("Linking to lib file: " BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib") # endif #endif #else # error "some required macros where not defined (internal logic error)." #endif #endif // _MSC_VER || __BORLANDC__ // // finally undef any macros we may have set: // #ifdef BOOST_LIB_PREFIX # undef BOOST_LIB_PREFIX #endif #if defined(BOOST_LIB_NAME) # undef BOOST_LIB_NAME #endif // Don't undef this one: it can be set by the user and should be the // same for all libraries: //#if defined(BOOST_LIB_TOOLSET) //# undef BOOST_LIB_TOOLSET //#endif #if defined(BOOST_LIB_THREAD_OPT) # undef BOOST_LIB_THREAD_OPT #endif #if defined(BOOST_LIB_RT_OPT) # undef BOOST_LIB_RT_OPT #endif #if defined(BOOST_LIB_LINK_OPT) # undef BOOST_LIB_LINK_OPT #endif #if defined(BOOST_LIB_DEBUG_OPT) # undef BOOST_LIB_DEBUG_OPT #endif #if defined(BOOST_DYN_LINK) # undef BOOST_DYN_LINK #endif #if defined(BOOST_AUTO_LINK_NOMANGLE) # undef BOOST_AUTO_LINK_NOMANGLE #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/user.hpp0000644000175000017500000001204512320456500023365 0ustar mathieumathieu// boost/config/user.hpp ---------------------------------------------------// // (C) Copyright John Maddock 2001. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // Do not check in modified versions of this file, // This file may be customized by the end user, but not by boost. // // Use this file to define a site and compiler specific // configuration policy: // // define this to locate a compiler config file: // #define BOOST_COMPILER_CONFIG // define this to locate a stdlib config file: // #define BOOST_STDLIB_CONFIG // define this to locate a platform config file: // #define BOOST_PLATFORM_CONFIG // define this to disable compiler config, // use if your compiler config has nothing to set: // #define BOOST_NO_COMPILER_CONFIG // define this to disable stdlib config, // use if your stdlib config has nothing to set: // #define BOOST_NO_STDLIB_CONFIG // define this to disable platform config, // use if your platform config has nothing to set: // #define BOOST_NO_PLATFORM_CONFIG // define this to disable all config options, // excluding the user config. Use if your // setup is fully ISO compliant, and has no // useful extensions, or for autoconf generated // setups: // #define BOOST_NO_CONFIG // define this to make the config "optimistic" // about unknown compiler versions. Normally // unknown compiler versions are assumed to have // all the defects of the last known version, however // setting this flag, causes the config to assume // that unknown compiler versions are fully conformant // with the standard: // #define BOOST_STRICT_CONFIG // define this to cause the config to halt compilation // with an #error if it encounters anything unknown -- // either an unknown compiler version or an unknown // compiler/platform/library: // #define BOOST_ASSERT_CONFIG // define if you want to disable threading support, even // when available: // #define BOOST_DISABLE_THREADS // define when you want to disable Win32 specific features // even when available: // #define BOOST_DISABLE_WIN32 // BOOST_DISABLE_ABI_HEADERS: Stops boost headers from including any // prefix/suffix headers that normally control things like struct // packing and alignment. // #define BOOST_DISABLE_ABI_HEADERS // BOOST_ABI_PREFIX: A prefix header to include in place of whatever // boost.config would normally select, any replacement should set up // struct packing and alignment options as required. // #define BOOST_ABI_PREFIX my-header-name // BOOST_ABI_SUFFIX: A suffix header to include in place of whatever // boost.config would normally select, any replacement should undo // the effects of the prefix header. // #define BOOST_ABI_SUFFIX my-header-name // BOOST_ALL_DYN_LINK: Forces all libraries that have separate source, // to be linked as dll's rather than static libraries on Microsoft Windows // (this macro is used to turn on __declspec(dllimport) modifiers, so that // the compiler knows which symbols to look for in a dll rather than in a // static library). Note that there may be some libraries that can only // be statically linked (Boost.Test for example) and others which may only // be dynamically linked (Boost.Threads for example), in these cases this // macro has no effect. // #define BOOST_ALL_DYN_LINK // BOOST_WHATEVER_DYN_LINK: Forces library "whatever" to be linked as a dll // rather than a static library on Microsoft Windows: replace the WHATEVER // part of the macro name with the name of the library that you want to // dynamically link to, for example use BOOST_DATE_TIME_DYN_LINK or // BOOST_REGEX_DYN_LINK etc (this macro is used to turn on __declspec(dllimport) // modifiers, so that the compiler knows which symbols to look for in a dll // rather than in a static library). // Note that there may be some libraries that can only be statically linked // (Boost.Test for example) and others which may only be dynamically linked // (Boost.Threads for example), in these cases this macro is unsupported. // #define BOOST_WHATEVER_DYN_LINK // BOOST_ALL_NO_LIB: Tells the config system not to automatically select // which libraries to link against. // Normally if a compiler supports #pragma lib, then the correct library // build variant will be automatically selected and linked against, // simply by the act of including one of that library's headers. // This macro turns that feature off. // #define BOOST_ALL_NO_LIB // BOOST_WHATEVER_NO_LIB: Tells the config system not to automatically // select which library to link against for library "whatever", // replace WHATEVER in the macro name with the name of the library; // for example BOOST_DATE_TIME_NO_LIB or BOOST_REGEX_NO_LIB. // Normally if a compiler supports #pragma lib, then the correct library // build variant will be automatically selected and linked against, simply // by the act of including one of that library's headers. This macro turns // that feature off. // #define BOOST_WHATEVER_NO_LIB ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/abi_suffix.hpp0000644000175000017500000000141512320456500024525 0ustar mathieumathieu// abi_sufffix header -------------------------------------------------------// // (c) Copyright John Maddock 2003 // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt). // This header should be #included AFTER code that was preceded by a #include // . #ifndef BOOST_CONFIG_ABI_PREFIX_HPP # error Header boost/config/abi_suffix.hpp must only be used after boost/config/abi_prefix.hpp #else # undef BOOST_CONFIG_ABI_PREFIX_HPP #endif // the suffix header occurs after all of our code: #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif #if defined( __BORLANDC__ ) #pragma nopushoptwarn #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/no_tr1/0000755000175000017500000000000012320456500023076 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/no_tr1/utility.hpp0000644000175000017500000000152612320456500025316 0ustar mathieumathieu// (C) Copyright John Maddock 2005. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // The aim of this header is just to include but to do // so in a way that does not result in recursive inclusion of // the Boost TR1 components if boost/tr1/tr1/utility is in the // include search path. We have to do this to avoid circular // dependencies: // #ifndef BOOST_CONFIG_UTILITY # define BOOST_CONFIG_UTILITY # ifndef BOOST_TR1_NO_RECURSION # define BOOST_TR1_NO_RECURSION # define BOOST_CONFIG_NO_UTILITY_RECURSION # endif # include # ifdef BOOST_CONFIG_NO_UTILITY_RECURSION # undef BOOST_TR1_NO_RECURSION # undef BOOST_CONFIG_NO_UTILITY_RECURSION # endif #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/no_tr1/complex.hpp0000644000175000017500000000152612320456500025262 0ustar mathieumathieu// (C) Copyright John Maddock 2005. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // The aim of this header is just to include but to do // so in a way that does not result in recursive inclusion of // the Boost TR1 components if boost/tr1/tr1/complex is in the // include search path. We have to do this to avoid circular // dependencies: // #ifndef BOOST_CONFIG_COMPLEX # define BOOST_CONFIG_COMPLEX # ifndef BOOST_TR1_NO_RECURSION # define BOOST_TR1_NO_RECURSION # define BOOST_CONFIG_NO_COMPLEX_RECURSION # endif # include # ifdef BOOST_CONFIG_NO_COMPLEX_RECURSION # undef BOOST_TR1_NO_RECURSION # undef BOOST_CONFIG_NO_COMPLEX_RECURSION # endif #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/no_tr1/memory.hpp0000644000175000017500000000151612320456500025122 0ustar mathieumathieu// (C) Copyright John Maddock 2005. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // The aim of this header is just to include but to do // so in a way that does not result in recursive inclusion of // the Boost TR1 components if boost/tr1/tr1/memory is in the // include search path. We have to do this to avoid circular // dependencies: // #ifndef BOOST_CONFIG_MEMORY # define BOOST_CONFIG_MEMORY # ifndef BOOST_TR1_NO_RECURSION # define BOOST_TR1_NO_RECURSION # define BOOST_CONFIG_NO_MEMORY_RECURSION # endif # include # ifdef BOOST_CONFIG_NO_MEMORY_RECURSION # undef BOOST_TR1_NO_RECURSION # undef BOOST_CONFIG_NO_MEMORY_RECURSION # endif #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/no_tr1/functional.hpp0000644000175000017500000000155612320456500025760 0ustar mathieumathieu// (C) Copyright John Maddock 2005. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // The aim of this header is just to include but to do // so in a way that does not result in recursive inclusion of // the Boost TR1 components if boost/tr1/tr1/functional is in the // include search path. We have to do this to avoid circular // dependencies: // #ifndef BOOST_CONFIG_FUNCTIONAL # define BOOST_CONFIG_FUNCTIONAL # ifndef BOOST_TR1_NO_RECURSION # define BOOST_TR1_NO_RECURSION # define BOOST_CONFIG_NO_FUNCTIONAL_RECURSION # endif # include # ifdef BOOST_CONFIG_NO_FUNCTIONAL_RECURSION # undef BOOST_TR1_NO_RECURSION # undef BOOST_CONFIG_NO_FUNCTIONAL_RECURSION # endif #endif ImageVis3D-3.1.0/Tuvok/Basics/3rdParty/boost/config/no_tr1/cmath.hpp0000644000175000017500000000150612320456500024705 0ustar mathieumathieu// (C) Copyright John Maddock 2008. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // The aim of this header is just to include but to do // so in a way that does not result in recursive inclusion of // the Boost TR1 components if boost/tr1/tr1/cmath is in the // include search path. We have to do this to avoid circular // dependencies: // #ifndef BOOST_CONFIG_CMATH # define BOOST_CONFIG_CMATH # ifndef BOOST_TR1_NO_RECURSION # define BOOST_TR1_NO_RECURSION # define BOOST_CONFIG_NO_CMATH_RECURSION # endif # include # ifdef BOOST_CONFIG_NO_CMATH_RECURSION # undef BOOST_TR1_NO_RECURSION # undef BOOST_CONFIG_NO_CMATH_RECURSION # endif #endif ImageVis3D-3.1.0/Tuvok/Basics/nonstd.h0000644000175000017500000000310712320456500017250 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef BASICS_NONSTD_H #define BASICS_NONSTD_H namespace nonstd { // a 'delete' functor that does nothing. struct null_deleter { void operator()(const void*) const {} }; // functor for the array-delete operator template struct DeleteArray { void operator()(const T* t) const { delete[] t; } }; } #endif /* BASICS_NONSTD_H */ ImageVis3D-3.1.0/Tuvok/Basics/Mesh.h0000644000175000017500000001710412320456500016641 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : Mesh.h //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #pragma once #ifndef BASICS_MESH_H #define BASICS_MESH_H #include #include #include "StdDefines.h" #include "Vectors.h" #include "Ray.h" namespace tuvok { class KDTree; typedef std::vector VertVec; typedef std::vector NormVec; typedef std::vector TexCoordVec; typedef std::vector ColorVec; typedef std::vector IndexVec; #define noIntersection (std::numeric_limits::max()) class BasicMeshData { public: BasicMeshData() {} BasicMeshData(const VertVec& vertices, const NormVec& normals, const TexCoordVec& texcoords, const ColorVec& colors, const IndexVec& vIndices, const IndexVec& nIndices, const IndexVec& tIndices, const IndexVec& cIndices) : m_vertices(vertices), m_normals(normals), m_texcoords(texcoords), m_colors(colors), m_VertIndices(vIndices), m_NormalIndices(nIndices), m_TCIndices(tIndices), m_COLIndices(cIndices) {} VertVec m_vertices; NormVec m_normals; TexCoordVec m_texcoords; ColorVec m_colors; IndexVec m_VertIndices; IndexVec m_NormalIndices; IndexVec m_TCIndices; IndexVec m_COLIndices; void RemoveUnusedVertices(); protected: template void RemoveUnusedEntries(IndexVec& indices, std::vector& entries) const { // compute an inverse lookup index, i.e. for each // vertex, store what indices point to it std::vector inverseIndex(entries.size(),0); for (size_t i = 0;i=0;--i) { // unused vertex found, i.e. vertex that has no indices pointing to it if (inverseIndex[size_t(i)] == 0) { // shift all indices for (size_t j = 0;j size_t(i) ) indices[j]--; } // delete vertex entries.erase(entries.begin()+size_t(i)); } } } }; class Mesh { public: enum EMeshType { MT_TRIANGLES = 0, MT_LINES, MT_COUNT }; Mesh(); Mesh(const VertVec& vertices, const NormVec& normals, const TexCoordVec& texcoords, const ColorVec& colors, const IndexVec& vIndices, const IndexVec& nIndices, const IndexVec& tIndices, const IndexVec& cIndices, bool bBuildKDTree, bool bScaleToUnitCube, const std::string& desc, EMeshType meshType); Mesh(const BasicMeshData& bmd, bool bBuildKDTree, bool bScaleToUnitCube, const std::string& desc, EMeshType meshType); virtual ~Mesh(); void Clone(const Mesh* other); void RecomputeNormals(); void ScaleToUnitCube(); void ComputeUnitCubeScale(FLOATVECTOR3& scale, FLOATVECTOR3& translation); void Transform(const FLOATMATRIX4& m); void ScaleAndBias(const FLOATVECTOR3& scale, const FLOATVECTOR3& translation); double Pick(const Ray& ray, FLOATVECTOR3& normal, FLOATVECTOR2& tc, FLOATVECTOR4& color) const { double tmin=0, tmax=0; if (!AABBIntersect(ray, tmin, tmax)) return std::numeric_limits::max(); else return IntersectInternal(ray, normal, tc, color, tmin, tmax); } void ComputeKDTree(); const KDTree* GetKDTree() const; // reorders normals, textures, etc. such that the index lists // all contain the same entries (i.e. reduce the mesh to a // single index list), returns true iff the unification was // possible bool UnifyIndices(); // computes a vector of meshes whereas all of those meshes // have index vectors smaller then iMaxIndexCount std::vector PartitionMesh(size_t iMaxIndexCount, bool bOptimize) const; bool HasUniformIndices() const; bool Validate(bool bDeepValidation=false); const BasicMeshData& GetBasicMeshData() const {return m_Data;} const VertVec& GetVertices() const {return m_Data.m_vertices;} const NormVec& GetNormals() const {return m_Data.m_normals;} const TexCoordVec& GetTexCoords() const {return m_Data.m_texcoords;} const ColorVec& GetColors() const {return m_Data.m_colors;} const IndexVec& GetVertexIndices() const {return m_Data.m_VertIndices;} const IndexVec& GetNormalIndices() const {return m_Data.m_NormalIndices;} const IndexVec& GetTexCoordIndices() const {return m_Data.m_TCIndices;} const IndexVec& GetColorIndices() const {return m_Data.m_COLIndices;} const FLOATVECTOR4& GetDefaultColor() const {return m_DefColor;} virtual void SetDefaultColor(const FLOATVECTOR4& color) {m_DefColor = color;} bool UseDefaultColor() const {return m_Data.m_COLIndices.empty();} const std::string& Name() const {return m_MeshDesc;} const FLOATMATRIX4& GetTransformFromOriginal() const { return m_TransformFromOriginal; } void DeleteTransformFromOriginal() {m_TransformFromOriginal = FLOATMATRIX4();} const FLOATVECTOR3& GetMin() const {return m_Bounds[0];} const FLOATVECTOR3& GetMax() const {return m_Bounds[1];} // currently these two calls are somewhat redundant, but in the future we // may want to support curved surfaces, in that case the first call would // be used during rendering while the second would be useful for list // traversal EMeshType GetMeshType() const {return m_meshType;} size_t GetVerticesPerPoly() const {return m_VerticesPerPoly;} protected: KDTree* m_KDTree; BasicMeshData m_Data; FLOATVECTOR4 m_DefColor; std::string m_MeshDesc; EMeshType m_meshType; size_t m_VerticesPerPoly; FLOATMATRIX4 m_TransformFromOriginal; void ComputeAABB(); virtual void GeometryHasChanged(bool bUpdateAABB, bool bUpdateKDtree); private: // picking double IntersectInternal(const Ray& ray, FLOATVECTOR3& normal, FLOATVECTOR2& tc, FLOATVECTOR4& color, double tmin, double tmax) const; double IntersectTriangle(size_t i, const Ray& ray, FLOATVECTOR3& normal, FLOATVECTOR2& tc, FLOATVECTOR4& color) const; // AABB Test bool AABBIntersect(const Ray& r, double& tmin, double& tmax) const; FLOATVECTOR3 m_Bounds[2]; friend class KDTree; }; } #endif // BASICS_MESH_H ImageVis3D-3.1.0/Tuvok/Basics/Interpolant.h0000644000175000017500000000261612320456500020246 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifndef TUVOK_INTERPOLANT_H #define TUVOK_INTERPOLANT_H namespace tuvok { enum Interpolant { Linear, NearestNeighbor }; } #endif // TUVOK_INTERPOLANT_H ImageVis3D-3.1.0/Tuvok/Basics/LargeFileFD.h0000644000175000017500000000572312320456500020015 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef BASICS_LARGEFILE_FD_H #define BASICS_LARGEFILE_FD_H #include "LargeFile.h" /** Data access using standard file descriptors. */ class LargeFileFD : public LargeFile { public: /// @argument header_size is maintained as a "base" offset. Seeking to /// byte 0 actually seeks to 'header_size'. LargeFileFD(const std::string fn, std::ios_base::openmode mode = std::ios_base::in, uint64_t header_size=0, uint64_t length=0); /// @argument header_size is maintained as a "base" offset. Seeking to /// byte 0 actually seeks to 'header_size'. LargeFileFD(const std::wstring fn, std::ios_base::openmode mode = std::ios_base::in, uint64_t header_size=0, uint64_t length=0); virtual ~LargeFileFD(); virtual void open(std::ios_base::openmode mode = std::ios_base::in); /// reads a block of data, returns a pointer to it. User must cast it to /// the type that makes sense for them. virtual std::shared_ptr rd(uint64_t offset, size_t len); using LargeFile::read; using LargeFile::rd; /// writes a block of data. virtual void wr(const std::shared_ptr& data, uint64_t offset, size_t len); /// notifies the object that we're going to need the following data soon. /// Many implementations will prefetch this data when it knows this. virtual void enqueue(uint64_t offset, size_t len); virtual uint64_t filesize() const; virtual bool is_open() const; virtual void close(); virtual void truncate(uint64_t length=0); protected: int fd; }; #endif /* BASICS_LARGEFILE_FD_H */ ImageVis3D-3.1.0/Tuvok/Basics/ProgressTimer.cpp0000644000175000017500000000531112320456500021102 0ustar mathieumathieu#include "ProgressTimer.h" #include #include ProgressTimer::ProgressTimer() : Timer() {} static std::string TimeToString(double dMiliSecs) { const uint64_t miliSecs = uint64_t(dMiliSecs); const uint64_t secs = (miliSecs/(1000))%60; const uint64_t mins = (miliSecs/(1000*60))%60; const uint64_t hours = (miliSecs/(1000*60*60))%24; const uint64_t days = (miliSecs/(1000*60*60*24))%7; const uint64_t weeks = (miliSecs/(1000*60*60*24*7)); std::stringstream result; if (weeks > 0) { if (weeks > 1) result << weeks << " Weeks "; else result << weeks << " Week "; } if (days > 0) { if (days > 1) result << days << " Days "; else result << days << " Day "; } if (hours > 0) { result << hours << ":"; } result << std::setw(2) << std::setfill('0') << mins << ":" << std::setw(2) << std::setfill('0') << secs; return result.str(); } std::string ProgressTimer::GetProgressMessage(double progress, bool bIncludeElapsed, bool bIncludeRemaining) const { const double miliSecs = Elapsed(); std::string result; if (bIncludeElapsed) { if (!result.empty()) result += " "; result += "Elapsed: " + TimeToString(miliSecs); } if (bIncludeRemaining && progress > 0.0) { if (!result.empty()) result += " "; result += "Remaining: " + TimeToString(miliSecs * (1.0-progress)/progress); } return result; } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/Basics/EndianFile.h0000644000175000017500000000527312320456500017747 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef BASICS_ENDIAN_FILE_H #define BASICS_ENDIAN_FILE_H #include #include "EndianConvert.h" #include "LargeFile.h" /// An 'EndianFile' wraps a LargeFile class so that it transparently /// converts endianness on reads. You must tell the class whether /// you're on a big endian or little endian system when you instantiate /// it, and if necessary it will convert every read. class EndianFile { public: EndianFile(LargeFile& lf, bool isBigEndian); virtual ~EndianFile() {} /// read/write calls of a single element. Only usable with implicit /// offsets. template void read(T* v, size_t N=1) { this->lf.read(v, N); if(this->big_endian != EndianConvert::IsBigEndian()) { std::transform(v, v+N, v, EndianConvert::Swap); } } template void write(const T& v) { T u = v; if(this->big_endian != EndianConvert::IsBigEndian()) { u = EndianConvert::Swap(u); } lf.write(u); } template void write(const T* v, size_t N=1) { if(this->big_endian != EndianConvert::IsBigEndian()) { std::shared_ptr mem = std::shared_ptr(new T[N]); std::transform(v, v+N, static_cast(mem.get()), EndianConvert::Swap); lf.wr(mem, N*sizeof(T)); } else { lf.write(v, N); } } private: LargeFile& lf; bool big_endian; }; #endif /* BASICS_ENDIAN_FILE_H */ ImageVis3D-3.1.0/Tuvok/Basics/Clipper.h0000644000175000017500000000314412320456500017342 0ustar mathieumathieu#pragma once #ifndef CLIPPER_H #define CLIPPER_H #include "StdDefines.h" #include "Vectors.h" /** \class Clipper */ class Clipper { public: static std::vector TriPlane(std::vector& posData, const VECTOR3 &normal, const float D); static void BoxPlane(std::vector& posData, const VECTOR3 &normal, const float D); }; #endif // CLIPPER_H /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/Basics/MC.cpp0000644000175000017500000000766012320456500016605 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : MC.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #include #include #include #include "MC.h" Isosurface::Isosurface() : vfVertices(NULL), vfNormals(NULL), viTriangles(NULL), iVertices(0), iTriangles(0) {} Isosurface::Isosurface(int iMaxVertices, int iMaxTris) : vfVertices(new VECTOR3[iMaxVertices]), vfNormals(new VECTOR3[iMaxVertices]), viTriangles(new VECTOR3[iMaxTris]), iVertices(0), iTriangles(0) {} Isosurface::~Isosurface() { delete [] vfVertices; delete [] vfNormals; delete [] viTriangles; } int Isosurface::AddTriangle(int a, int b, int c) { viTriangles[iTriangles++] = VECTOR3(a,b,c); return iTriangles-1; } int Isosurface::AddVertex(VECTOR3 v, VECTOR3 n) { vfVertices[iVertices] = v; vfNormals[iVertices++] = n; return iVertices-1; } void Isosurface::AppendData(const Isosurface* other) { // if verts in other, expand the storage this surface if (other->iVertices > 0) { // create new mem VECTOR3* temp_Vertices = new VECTOR3[iVertices + other->iVertices]; VECTOR3* temp_Normals = new VECTOR3[iVertices + other->iVertices]; VECTOR3* temp_Triangles = new VECTOR3[iTriangles + other->iTriangles]; // copy "old" data memcpy(temp_Vertices, vfVertices, sizeof(VECTOR3)*iVertices); memcpy(temp_Normals, vfNormals, sizeof(VECTOR3)*iVertices); memcpy(temp_Triangles, viTriangles, sizeof(VECTOR3)*iTriangles); // append new data memcpy(temp_Vertices+iVertices, other->vfVertices, sizeof(VECTOR3)*other->iVertices); memcpy(temp_Normals+iVertices, other->vfNormals, sizeof(VECTOR3)*other->iVertices); memcpy(temp_Triangles+iTriangles, other->viTriangles, sizeof(VECTOR3)*other->iTriangles); // delete "old" data delete [] vfVertices; delete [] vfNormals; delete [] viTriangles; // rename vfVertices = temp_Vertices; vfNormals = temp_Normals; viTriangles = temp_Triangles; } // update this list's counters iVertices += other->iVertices; iTriangles += other->iTriangles; } void Isosurface::Transform(const FLOATMATRIX4& matrix) { FLOATMATRIX4 itMatrix = matrix.inverse(); itMatrix = itMatrix.Transpose(); for (int i = 0;i ms_fEpsilon) //if its non-zero return FLOATQUATERNION4(vCross.x, vCross.y, vCross.z, fDot); else return FLOATQUATERNION4(0,0,0,0); } FLOATVECTOR3 ArcBall::MapToSphere(UINTVECTOR2 vPosition) const { FLOATVECTOR3 vResult; // normalize position to [-1 ... 1] FLOATVECTOR2 vNormPosition; vNormPosition.x = -(((vPosition.x-m_iWinOffsets.x) / (float(m_iWinDim.x - 1) / 2.0f)) - 1.0f); vNormPosition.y = ((vPosition.y-m_iWinOffsets.y) / (float(m_iWinDim.y - 1) / 2.0f)) - 1.0f; if (m_bUseTranslation) { FLOATMATRIX4 mTranslation(m_mTranslation); mTranslation.m43 = 0; vNormPosition = (FLOATVECTOR4(vNormPosition,0.0f,1.0f) * mTranslation).xy(); } // Compute the length of the vector to the point from the center float length = vNormPosition.length(); // If the point is mapped outside of the sphere... (length > radius) if (length > m_fRadius) { // Compute a normalizing factor (radius / length) float norm = float(m_fRadius / length); // Return the "normalized" vector, a point on the sphere vResult.x = vNormPosition.x * norm; vResult.y = vNormPosition.y * norm; vResult.z = 0.0f; } else // Else it's on the inside { // Return a vector to a point mapped inside the sphere vResult.x = vNormPosition.x; vResult.y = vNormPosition.y; vResult.z = length-m_fRadius; } return vResult; } ImageVis3D-3.1.0/Tuvok/Basics/MemMappedFile.h0000644000175000017500000000633412320456500020415 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file MemMappedFile.h \author Jens Krueger SCI Institute University of Utah \version 1.2 \date July 2008 */ #pragma once #ifndef MEMMAPPEDFILE_H #define MEMMAPPEDFILE_H #include "StdDefines.h" #include #ifdef _WIN32 # define NOMINMAX # include #endif enum MMFILE_ACCESS { MMFILE_ACCESS_READONLY = 0, MMFILE_ACCESS_READWRITE, }; class MemMappedFile { public: MemMappedFile(const std::wstring strFilename, const MMFILE_ACCESS eAccesMode = MMFILE_ACCESS_READONLY, const uint64_t& iLengthForNewFile = 0, const uint64_t& iOffset=0, const uint64_t& iBytesToMap=0); MemMappedFile(const std::string strFilename, const MMFILE_ACCESS eAccesMode = MMFILE_ACCESS_READONLY, const uint64_t& iLengthForNewFile = 0, const uint64_t& iOffset=0, const uint64_t& iBytesToMap=0); ~MemMappedFile(void); void* GetDataPointer() const {return m_pData;} uint64_t GetFileMappingSize() const {return m_dwFileMappingSize;} uint64_t GetFileLength() const {return m_dwFileSize;} bool IsOpen() const {return m_bIsOpen;} void Flush(); void Close(); void Erase(); void* ReOpen(const uint64_t& iOffset=0, const uint64_t& iBytesToMap=0); void* ReMap(const uint64_t& iOffset=0, const uint64_t& iBytesToMap=0); void ChangeView(const uint64_t& iOffset=0, const uint64_t& iBytesToMap=0); protected: bool m_bIsOpen; void* m_pData; uint64_t m_dwFileMappingSize; uint64_t m_dwFileSize; // for reopen std::string m_strFilename; MMFILE_ACCESS m_eAccesMode; uint64_t m_iLengthForNewFile; int OpenFile(const char* strPath, const MMFILE_ACCESS eAccesMode, const uint64_t& iLengthForNewFile = 0, const uint64_t& iOffset=0, const uint64_t& iBytesToMap=0); private: void ComputeAllocationGranularity(); #ifdef WIN32 DWORD m_AllocationGranularity; HANDLE m_hMem; DWORD m_dwDesiredAccessMap; #else long m_AllocationGranularity; int m_fdes; int m_dwMmmapMode; #endif }; #endif // MEMMAPPEDFILE_H ImageVis3D-3.1.0/Tuvok/Basics/LargeFileAIO.h0000644000175000017500000000717712320456500020141 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef BASICS_LARGEFILE_AIO_H #define BASICS_LARGEFILE_AIO_H #include #include "LargeFileFD.h" struct aiocb; /** Uses AIO to read data. 'read' is still synchronous, but the additional * 'buffer' method can be used to enqueue a read that is not yet needed. */ class LargeFileAIO : public LargeFileFD { public: /// @argument header_size is maintained as a "base" offset. Seeking to /// byte 0 actually seeks to 'header_size'. LargeFileAIO(const std::string fn, std::ios_base::openmode mode = std::ios_base::in, uint64_t header_size=0, uint64_t length=0); /// @argument header_size is maintained as a "base" offset. Seeking to /// byte 0 actually seeks to 'header_size'. LargeFileAIO(const std::wstring fn, std::ios_base::openmode mode = std::ios_base::in, uint64_t header_size=0, uint64_t length=0); virtual ~LargeFileAIO(); /// reads a block of data, returns a pointer to it. User must cast it to /// the type that makes sense for them. virtual std::shared_ptr rd(uint64_t offset, size_t len); using LargeFile::read; using LargeFile::rd; /// notifies the object that we're going to need the following data soon. /// Many implementations will prefetch this data when it knows this. virtual void enqueue(uint64_t offset, size_t len); /// writes a block of data. virtual void wr(const std::shared_ptr& data, uint64_t offset, size_t len); using LargeFile::write; /// Allows the user to unset a copy of the data on write. When false, this /// means that once you've given a pointer to 'write', the client must not /// touch the data it points to... ever again. /// When true (the default), the system has to copy the data to a new chunk /// of memory before it can return. void copy_writes(bool); virtual void close(); typedef std::unordered_map> Reqs; private: LargeFileAIO(const LargeFileAIO&); LargeFileAIO& operator=(const LargeFileAIO&); struct aiocb* submit_new_request(uint64_t offset, size_t len); void flush_writes(); private: Reqs control; bool writes_copied; }; #endif /* BASICS_LARGEFILE_AIO_H */ ImageVis3D-3.1.0/Tuvok/Basics/Ray.h0000644000175000017500000000356712320456500016510 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : Mesh.h //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #pragma once #ifndef BASICS_RAY_H #define BASICS_RAY_H #include "StdDefines.h" #include "Vectors.h" namespace tuvok { class Ray { public: DOUBLEVECTOR3 start; DOUBLEVECTOR3 direction; Ray(void) : start(), direction() { } Ray(const DOUBLEVECTOR3& s, const DOUBLEVECTOR3& d):start(s),direction(d) {} DOUBLEVECTOR3 PointOnRay(const double d) const { return start+direction*d; } }; } #endif // BASICS_RAY_H ImageVis3D-3.1.0/Tuvok/Basics/Appendix.h0000644000175000017500000000461112320456500017514 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Appendix.cpp \author Jens Krueger SCI Institute University of Utah \date January 2009 */ #pragma once #ifndef APPENDIX_H #define APPENDIX_H #include #include #include "StdDefines.h" /** \class FileInfo */ class FileInfo { public: FileInfo(std::string strName, uint64_t iSize) : m_strName(strName), m_iSize(iSize) {} std::string m_strName; uint64_t m_iSize; }; class InternalFileInfo : public FileInfo { public: InternalFileInfo(std::string strName, uint64_t iSize, uint64_t iOffset) : FileInfo(strName, iSize), m_iOffset(iOffset) {} uint64_t m_iOffset; }; /** \class Appendix */ class Appendix { public: Appendix(std::string strTarget, const std::vector& vstrSource); Appendix(std::string strAPXFile); bool IsOK() {return m_bOK;} bool ExtractFile(size_t i, std::string strTarget); std::vector ListFiles(); protected: std::string m_strAPXFile; uint64_t m_iHeaderLength; bool m_bOK; std::vector m_vHeaderData; }; #endif // APPENDIX_H ImageVis3D-3.1.0/Tuvok/Basics/MC.inl0000644000175000017500000012765712320456500016616 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : MC.inl //! Author : Jens Krueger //! SCI Institute //! University of Utah //! MC tables by others (see remarks below) //! Date : January 2009 // //! Copyright (C) 2008 SCI Institute #include #include /* these tables for computing the Marching Cubes algorithm are Paul Bourke, based on code by Cory Gene Bloyd. The indexing of vertices and edges in a cube are defined as: _4____________4_____________5 /| / / | /| / | / | 7 | / | / | /5 | / | / | / 8 / 9 / | / | 7/________|______6____________/6 | | | | | | | | | | | | | | |0____________0_____|_______|1 11 / | / | / 10 / | / | / | /3 | /1 | / | / | / | / | / |/ |/3____________2_____________|2 For purposes of calculating vertices along the edges and the triangulations created, there are 15 distinct cases, with upper limits of 12 edge intersections 5 triangles created per cell */ template int MarchingCubes::ms_edgeTable[256]={ 0x0 , 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c, 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00, 0x190, 0x99 , 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c, 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90, 0x230, 0x339, 0x33 , 0x13a, 0x636, 0x73f, 0x435, 0x53c, 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30, 0x3a0, 0x2a9, 0x1a3, 0xaa , 0x7a6, 0x6af, 0x5a5, 0x4ac, 0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0, 0x460, 0x569, 0x663, 0x76a, 0x66 , 0x16f, 0x265, 0x36c, 0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60, 0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff , 0x3f5, 0x2fc, 0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0, 0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55 , 0x15c, 0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950, 0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc , 0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0, 0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc, 0xcc , 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0, 0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c, 0x15c, 0x55 , 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650, 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc, 0x2fc, 0x3f5, 0xff , 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0, 0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c, 0x36c, 0x265, 0x16f, 0x66 , 0x76a, 0x663, 0x569, 0x460, 0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac, 0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa , 0x1a3, 0x2a9, 0x3a0, 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c, 0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33 , 0x339, 0x230, 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c, 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99 , 0x190, 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c, 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0 }; template int MarchingCubes::ms_triTable[256][16] = {{NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 8, 3, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 1, 9, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 8, 3, 9, 8, 1, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 2, 10, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 8, 3, 1, 2, 10, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 2, 10, 0, 2, 9, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {2, 8, 3, 2, 10, 8, 10, 9, 8, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {3, 11, 2, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 11, 2, 8, 11, 0, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 9, 0, 2, 3, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 11, 2, 1, 9, 11, 9, 8, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {3, 10, 1, 11, 10, 3, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 10, 1, 0, 8, 10, 8, 11, 10, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {3, 9, 0, 3, 11, 9, 11, 10, 9, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 8, 10, 10, 8, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {4, 7, 8, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {4, 3, 0, 7, 3, 4, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 1, 9, 8, 4, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {4, 1, 9, 4, 7, 1, 7, 3, 1, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 2, 10, 8, 4, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {3, 4, 7, 3, 0, 4, 1, 2, 10, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 2, 10, 9, 0, 2, 8, 4, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {8, 4, 7, 3, 11, 2, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {11, 4, 7, 11, 2, 4, 2, 0, 4, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 0, 1, 8, 4, 7, 2, 3, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {3, 10, 1, 3, 11, 10, 7, 8, 4, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {4, 7, 11, 4, 11, 9, 9, 11, 10, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 5, 4, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 5, 4, 0, 8, 3, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 5, 4, 1, 5, 0, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {8, 5, 4, 8, 3, 5, 3, 1, 5, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 2, 10, 9, 5, 4, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {3, 0, 8, 1, 2, 10, 4, 9, 5, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {5, 2, 10, 5, 4, 2, 4, 0, 2, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 5, 4, 2, 3, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 11, 2, 0, 8, 11, 4, 9, 5, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 5, 4, 0, 1, 5, 2, 3, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {10, 3, 11, 10, 1, 3, 9, 5, 4, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {5, 4, 8, 5, 8, 10, 10, 8, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 7, 8, 5, 7, 9, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 3, 0, 9, 5, 3, 5, 7, 3, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 7, 8, 0, 1, 7, 1, 5, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 5, 3, 3, 5, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 7, 8, 9, 5, 7, 10, 1, 2, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {2, 10, 5, 2, 5, 3, 3, 5, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {7, 9, 5, 7, 8, 9, 3, 11, 2, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {11, 2, 1, 11, 1, 7, 7, 1, 5, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, NO_EDGE}, {11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, NO_EDGE}, {11, 10, 5, 7, 11, 5, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {10, 6, 5, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 8, 3, 5, 10, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 0, 1, 5, 10, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 8, 3, 1, 9, 8, 5, 10, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 6, 5, 2, 6, 1, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 6, 5, 1, 2, 6, 3, 0, 8, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 6, 5, 9, 0, 6, 0, 2, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {2, 3, 11, 10, 6, 5, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {11, 0, 8, 11, 2, 0, 10, 6, 5, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 1, 9, 2, 3, 11, 5, 10, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {6, 3, 11, 6, 5, 3, 5, 1, 3, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {6, 5, 9, 6, 9, 11, 11, 9, 8, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {5, 10, 6, 4, 7, 8, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {4, 3, 0, 4, 7, 3, 6, 5, 10, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 9, 0, 5, 10, 6, 8, 4, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {6, 1, 2, 6, 5, 1, 4, 7, 8, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, NO_EDGE}, {3, 11, 2, 7, 8, 4, 10, 6, 5, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, NO_EDGE}, {8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, NO_EDGE}, {0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, NO_EDGE}, {6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {10, 4, 9, 6, 4, 10, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {4, 10, 6, 4, 9, 10, 0, 8, 3, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {10, 0, 1, 10, 6, 0, 6, 4, 0, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 4, 9, 1, 2, 4, 2, 6, 4, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 2, 4, 4, 2, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {8, 3, 2, 8, 2, 4, 4, 2, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {10, 4, 9, 10, 6, 4, 11, 2, 3, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, NO_EDGE}, {9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, NO_EDGE}, {3, 11, 6, 3, 6, 0, 0, 6, 4, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {6, 4, 8, 11, 6, 8, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {7, 10, 6, 7, 8, 10, 8, 9, 10, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {10, 6, 7, 10, 7, 1, 1, 7, 3, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, NO_EDGE}, {7, 8, 0, 7, 0, 6, 6, 0, 2, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {7, 3, 2, 6, 7, 2, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, NO_EDGE}, {1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, NO_EDGE}, {11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, NO_EDGE}, {0, 9, 1, 11, 6, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {7, 11, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {7, 6, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {3, 0, 8, 11, 7, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 1, 9, 11, 7, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {8, 1, 9, 8, 3, 1, 11, 7, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {10, 1, 2, 6, 11, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 2, 10, 3, 0, 8, 6, 11, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {2, 9, 0, 2, 10, 9, 6, 11, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {7, 2, 3, 6, 2, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {7, 0, 8, 7, 6, 0, 6, 2, 0, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {2, 7, 6, 2, 3, 7, 0, 1, 9, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {10, 7, 6, 10, 1, 7, 1, 3, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {7, 6, 10, 7, 10, 8, 8, 10, 9, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {6, 8, 4, 11, 8, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {3, 6, 11, 3, 0, 6, 0, 4, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {8, 6, 11, 8, 4, 6, 9, 0, 1, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {6, 8, 4, 6, 11, 8, 2, 10, 1, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, NO_EDGE}, {8, 2, 3, 8, 4, 2, 4, 6, 2, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 4, 2, 4, 6, 2, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 9, 4, 1, 4, 2, 2, 4, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {10, 1, 0, 10, 0, 6, 6, 0, 4, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, NO_EDGE}, {10, 9, 4, 6, 10, 4, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {4, 9, 5, 7, 6, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 8, 3, 4, 9, 5, 11, 7, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {5, 0, 1, 5, 4, 0, 7, 6, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 5, 4, 10, 1, 2, 7, 6, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, NO_EDGE}, {7, 2, 3, 7, 6, 2, 5, 4, 9, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, NO_EDGE}, {9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, NO_EDGE}, {4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, NO_EDGE}, {7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {6, 9, 5, 6, 11, 9, 11, 8, 9, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {6, 11, 3, 6, 3, 5, 5, 3, 1, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, NO_EDGE}, {11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, NO_EDGE}, {6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 5, 6, 9, 6, 0, 0, 6, 2, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, NO_EDGE}, {1, 5, 6, 2, 1, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, NO_EDGE}, {10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 3, 8, 5, 6, 10, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {10, 5, 6, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {11, 5, 10, 7, 5, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {11, 5, 10, 11, 7, 5, 8, 3, 0, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {5, 11, 7, 5, 10, 11, 1, 9, 0, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {11, 1, 2, 11, 7, 1, 7, 5, 1, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, NO_EDGE}, {2, 5, 10, 2, 3, 5, 3, 7, 5, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, NO_EDGE}, {1, 3, 5, 3, 7, 5, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 8, 7, 0, 7, 1, 1, 7, 5, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 0, 3, 9, 3, 5, 5, 3, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 8, 7, 5, 9, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {5, 8, 4, 5, 10, 8, 10, 11, 8, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, NO_EDGE}, {2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, NO_EDGE}, {0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, NO_EDGE}, {9, 4, 5, 2, 11, 3, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {5, 10, 2, 5, 2, 4, 4, 2, 0, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, NO_EDGE}, {5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {8, 4, 5, 8, 5, 3, 3, 5, 1, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 4, 5, 1, 0, 5, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 4, 5, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {4, 11, 7, 4, 9, 11, 9, 10, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, NO_EDGE}, {4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, NO_EDGE}, {11, 7, 4, 11, 4, 2, 2, 4, 0, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, NO_EDGE}, {3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, NO_EDGE}, {1, 10, 2, 8, 7, 4, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {4, 9, 1, 4, 1, 7, 7, 1, 3, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {4, 0, 3, 7, 4, 3, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {4, 8, 7, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 10, 8, 10, 11, 8, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {3, 0, 9, 3, 9, 11, 11, 9, 10, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 1, 10, 0, 10, 8, 8, 10, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {3, 1, 10, 11, 3, 10, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 2, 11, 1, 11, 9, 9, 11, 8, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 2, 11, 8, 0, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {3, 2, 11, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {2, 3, 8, 2, 8, 10, 10, 8, 9, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {9, 10, 2, 0, 9, 2, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 10, 2, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {1, 3, 8, 9, 1, 8, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 9, 1, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {0, 3, 8, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}, {NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE}}; template MarchingCubes::MarchingCubes(void) { m_vVolSize = INTVECTOR3(0,0,0); m_pTVolume = NULL; m_Isosurface = NULL; } template MarchingCubes::~MarchingCubes(void) { delete m_Isosurface; } template void MarchingCubes::SetVolume(int iSizeX, int iSizeY, int iSizeZ, T* pTVolume) { m_pTVolume = pTVolume; m_vVolSize = INTVECTOR3(iSizeX, iSizeY, iSizeZ); m_TIsoValue = 0; } template void MarchingCubes::Process(T TIsoValue) { // store isovalue m_TIsoValue = TIsoValue; // init isosurface data delete m_Isosurface; m_Isosurface = new Isosurface(); // if the volume is empty we are done if (m_vVolSize.volume() == 0) return; // create a new layer - dataset LayerTempData* layerData = new LayerTempData(m_vVolSize,m_pTVolume); // march the first layer MarchLayer(layerData, 0); // now do the remaining layers for (int iZ = 1; iZ < m_vVolSize.z - 1; iZ++) { // prepare the temp data to be used in the next layer layerData->NextIteration(); // march the next layer MarchLayer(layerData, iZ); } // delete the layer dataset delete layerData; } template void MarchingCubes::MarchLayer(LayerTempData *layer, int iLayer) { int cellVerts[12]; // the 12 possible vertices in a cell for (int i = 0; i < 12; i++) cellVerts[i] = NO_EDGE; // local part of the isosurface with at most 12 vertices and at most 5 triangles per cell Isosurface* sliceIsosurface = new Isosurface((m_vVolSize.x-1) * (m_vVolSize.y-1) * 12, (m_vVolSize.x-1) * (m_vVolSize.y-1) * 5); // march all cells in the layer for(int i = 0; i < m_vVolSize.x-1; i++) { for(int j = 0; j < m_vVolSize.y-1; j++) { // fetch data from the volume T fVolumeValues[8]; fVolumeValues[0] = (layer->pTBotData[(j+1) * m_vVolSize.x + i]); fVolumeValues[1] = (layer->pTBotData[(j+1) * m_vVolSize.x + i+1]); fVolumeValues[2] = (layer->pTBotData[j * m_vVolSize.x + i+1]); fVolumeValues[3] = (layer->pTBotData[j * m_vVolSize.x + i]); fVolumeValues[4] = (layer->pTTopData[(j+1) * m_vVolSize.x + i]); fVolumeValues[5] = (layer->pTTopData[(j+1) * m_vVolSize.x + i+1]); fVolumeValues[6] = (layer->pTTopData[j * m_vVolSize.x + i+1]); fVolumeValues[7] = (layer->pTTopData[j * m_vVolSize.x + i]); // compute the index for the table lookup int cellIndex = 1*int(fVolumeValues[0] < m_TIsoValue)+ 2*int(fVolumeValues[1] < m_TIsoValue)+ 4*int(fVolumeValues[2] < m_TIsoValue)+ 8*int(fVolumeValues[3] < m_TIsoValue)+ 16*int(fVolumeValues[4] < m_TIsoValue)+ 32*int(fVolumeValues[5] < m_TIsoValue)+ 64*int(fVolumeValues[6] < m_TIsoValue)+ 128*int(fVolumeValues[7] < m_TIsoValue); // get the coordinates for the vertices, compute the triangulation and interpolate the normals if (ms_edgeTable[cellIndex] & 1) { if (layer->piEdges[EDGE_INDEX(0, i, j, m_vVolSize.x-1)] == NO_EDGE) { cellVerts[0] = m_Isosurface->iVertices + MakeVertex(0, i, j, iLayer, sliceIsosurface); } else { cellVerts[0] = layer->piEdges[EDGE_INDEX(0, i, j, m_vVolSize.x-1)]; } } if (ms_edgeTable[cellIndex] & 2) { if (layer->piEdges[EDGE_INDEX(1, i, j, m_vVolSize.x-1)] == NO_EDGE) { cellVerts[1] = m_Isosurface->iVertices+MakeVertex(1, i, j, iLayer, sliceIsosurface); } else { cellVerts[1] = layer->piEdges[EDGE_INDEX(1, i, j, m_vVolSize.x-1)]; } } if (ms_edgeTable[cellIndex] & 4) { if (layer->piEdges[EDGE_INDEX(2, i, j, m_vVolSize.x-1)] == NO_EDGE) { cellVerts[2] = m_Isosurface->iVertices +MakeVertex(2, i, j, iLayer, sliceIsosurface); } else { cellVerts[2] = layer->piEdges[EDGE_INDEX(2, i, j, m_vVolSize.x-1)]; } } if (ms_edgeTable[cellIndex] & 8) { if (layer->piEdges[EDGE_INDEX(3, i, j, m_vVolSize.x-1)] == NO_EDGE) { cellVerts[3] = m_Isosurface->iVertices+MakeVertex(3, i, j, iLayer, sliceIsosurface); } else { cellVerts[3] = layer->piEdges[EDGE_INDEX(3, i, j, m_vVolSize.x-1)]; } } if (ms_edgeTable[cellIndex] & 16) { if (layer->piEdges[EDGE_INDEX(4, i, j, m_vVolSize.x-1)] == NO_EDGE) { cellVerts[4] = m_Isosurface->iVertices+MakeVertex(4, i, j, iLayer, sliceIsosurface); } else { cellVerts[4] = layer->piEdges[EDGE_INDEX(4, i, j, m_vVolSize.x-1)]; } } if (ms_edgeTable[cellIndex] & 32) { if (layer->piEdges[EDGE_INDEX(5, i, j, m_vVolSize.x-1)] == NO_EDGE) { cellVerts[5] = m_Isosurface->iVertices+MakeVertex(5, i, j, iLayer, sliceIsosurface); } else { cellVerts[5] = layer->piEdges[EDGE_INDEX(5, i, j, m_vVolSize.x-1)]; } } if (ms_edgeTable[cellIndex] & 64) { if (layer->piEdges[EDGE_INDEX(6, i, j, m_vVolSize.x-1)] == NO_EDGE) { cellVerts[6] = m_Isosurface->iVertices +MakeVertex(6, i, j, iLayer, sliceIsosurface); } else { cellVerts[6] = layer->piEdges[EDGE_INDEX(6, i, j, m_vVolSize.x-1)]; } } if (ms_edgeTable[cellIndex] & 128) { if (layer->piEdges[EDGE_INDEX(7, i, j, m_vVolSize.x-1)] == NO_EDGE) { cellVerts[7] = m_Isosurface->iVertices +MakeVertex(7, i, j, iLayer, sliceIsosurface); } else { cellVerts[7] = layer->piEdges[EDGE_INDEX(7, i, j, m_vVolSize.x-1)]; } } if (ms_edgeTable[cellIndex] & 256) { if (layer->piEdges[EDGE_INDEX(8, i, j, m_vVolSize.x-1)] == NO_EDGE) { cellVerts[8] = m_Isosurface->iVertices +MakeVertex(8, i, j, iLayer, sliceIsosurface); } else { cellVerts[8] = layer->piEdges[EDGE_INDEX(8, i, j, m_vVolSize.x-1)]; } } if (ms_edgeTable[cellIndex] & 512) { if (layer->piEdges[EDGE_INDEX(9, i, j, m_vVolSize.x-1)] == NO_EDGE) { cellVerts[9] = m_Isosurface->iVertices +MakeVertex(9, i, j, iLayer, sliceIsosurface); } else { cellVerts[9] = layer->piEdges[EDGE_INDEX(9, i, j, m_vVolSize.x-1)]; } } if (ms_edgeTable[cellIndex] & 1024) { if (layer->piEdges[EDGE_INDEX(10, i, j, m_vVolSize.x-1)] == NO_EDGE) { cellVerts[10] = m_Isosurface->iVertices +MakeVertex(10, i, j, iLayer, sliceIsosurface); } else { cellVerts[10] = layer->piEdges[EDGE_INDEX(10, i, j, m_vVolSize.x-1)]; } } if (ms_edgeTable[cellIndex] & 2048) { if (layer->piEdges[EDGE_INDEX(11, i, j, m_vVolSize.x-1)] == NO_EDGE) { cellVerts[11] = m_Isosurface->iVertices +MakeVertex(11, i, j, iLayer, sliceIsosurface); } else { cellVerts[11] = layer->piEdges[EDGE_INDEX(11, i, j, m_vVolSize.x-1)]; } } // put the cellVerts tags into this cell's layer->edges table for (int iEdge = 0; iEdge < 12; iEdge++) { if (cellVerts[iEdge] != NO_EDGE) { layer->piEdges[EDGE_INDEX(iEdge, i, j, m_vVolSize.x-1)] = cellVerts[iEdge]; } } // now propagate the vertex/normal tags to the adjacent cells to // the right and behind in this layer. if (i < m_vVolSize.x - 2) { // we should propagate to the right layer->piEdges[EDGE_INDEX( 3, i+1, j, m_vVolSize.x-1)] = cellVerts[1]; layer->piEdges[EDGE_INDEX( 7, i+1, j, m_vVolSize.x-1)] = cellVerts[5]; layer->piEdges[EDGE_INDEX( 8, i+1, j, m_vVolSize.x-1)] = cellVerts[9]; layer->piEdges[EDGE_INDEX(11, i+1, j, m_vVolSize.x-1)] = cellVerts[10]; } if (j < m_vVolSize.y - 2) { // we should propagate to the rear layer->piEdges[EDGE_INDEX( 2, i, j+1, m_vVolSize.x-1)] = cellVerts[0]; layer->piEdges[EDGE_INDEX( 6, i, j+1, m_vVolSize.x-1)] = cellVerts[4]; layer->piEdges[EDGE_INDEX(11, i, j+1, m_vVolSize.x-1)] = cellVerts[8]; layer->piEdges[EDGE_INDEX(10, i, j+1, m_vVolSize.x-1)] = cellVerts[9]; } // store the vertex indices in the triangle data structure int iTableIndex = 0; while (ms_triTable[cellIndex][iTableIndex] != -1) { sliceIsosurface->AddTriangle(cellVerts[ms_triTable[cellIndex][iTableIndex+0]], cellVerts[ms_triTable[cellIndex][iTableIndex+1]], cellVerts[ms_triTable[cellIndex][iTableIndex+2]]); iTableIndex+=3; } } } // add this layer's triangles to the global list m_Isosurface->AppendData(sliceIsosurface); delete sliceIsosurface; } template int MarchingCubes::MakeVertex(int iEdgeIndex, int i, int j, int k, Isosurface* sliceIso) { INTVECTOR3 vFrom; // first grid vertex INTVECTOR3 vTo; // second grid vertex // on the edge index decide what the edges are switch (iEdgeIndex) { case 0: vFrom = INTVECTOR3( i,j+1, k); vTo = INTVECTOR3(i+1,j+1, k); break; case 1: vFrom = INTVECTOR3(i+1,j+1, k); vTo = INTVECTOR3(i+1, j, k); break; case 2: vFrom = INTVECTOR3(i+1, j, k); vTo = INTVECTOR3( i, j, k); break; case 3: vFrom = INTVECTOR3( i, j, k); vTo = INTVECTOR3( i,j+1, k); break; case 4: vFrom = INTVECTOR3( i,j+1,k+1); vTo = INTVECTOR3(i+1,j+1,k+1); break; case 5: vFrom = INTVECTOR3(i+1,j+1,k+1); vTo = INTVECTOR3(i+1, j,k+1); break; case 6: vFrom = INTVECTOR3(i+1, j,k+1); vTo = INTVECTOR3( i, j,k+1); break; case 7: vFrom = INTVECTOR3( i, j,k+1); vTo = INTVECTOR3( i,j+1,k+1); break; case 8: vFrom = INTVECTOR3( i,j+1, k); vTo = INTVECTOR3( i,j+1,k+1); break; case 9: vFrom = INTVECTOR3(i+1,j+1, k); vTo = INTVECTOR3(i+1,j+1,k+1); break; case 10: vFrom = INTVECTOR3(i+1, j, k); vTo = INTVECTOR3(i+1, j,k+1); break; case 11: vFrom = INTVECTOR3( i, j, k); vTo = INTVECTOR3( i, j,k+1); break; } T fFromValue = m_pTVolume[DATA_INDEX(vFrom.x, vFrom.y, vFrom.z, m_vVolSize.x, m_vVolSize.y)]; T fToValue = m_pTVolume[DATA_INDEX( vTo.x, vTo.y, vTo.z, m_vVolSize.x, m_vVolSize.y)]; // determine the relative distance along edge vFrom->vTo that the isosurface vertex lies float d = float( fFromValue - m_TIsoValue) / float( fFromValue - fToValue ); if (d < EPSILON) d = 0.0f; else if (d > (1.0f-EPSILON)) d = 1.0f; // interpolate the vertex FLOATVECTOR3 vVertex = FLOATVECTOR3(vFrom) + d * FLOATVECTOR3(vTo - vFrom); // now determine the gradients at the endpoints of the edge // and interpolate the normal for the isosurface vertex FLOATVECTOR3 vNormFrom = InterpolateNormal(fFromValue,vFrom); FLOATVECTOR3 vNormTo = InterpolateNormal( fToValue, vTo); // interpolate the normal FLOATVECTOR3 vNormal = FLOATVECTOR3(float(vNormFrom.x) + d * float(vNormTo.x - vNormFrom.x), float(vNormFrom.y) + d * float(vNormTo.y - vNormFrom.y), float(vNormFrom.z) + d * float(vNormTo.z - vNormFrom.z)); vNormal.normalize(EPSILON); // insert the vertex and normal into the isosurface structure and return the index for this vertex return sliceIso->AddVertex(vVertex, vNormal); } template FLOATVECTOR3 MarchingCubes::InterpolateNormal(T fValueAtPos, INTVECTOR3 vPosition) { // the gradients are computed by central differences, except // on the boundaries of the dataset, where forward or backward // differencing is used (three point form) DOUBLEVECTOR3 result; // the x component if (vPosition.x == 0) { // left border -> forward diff result.x = 0.5f * float(-3.0f * fValueAtPos + 4.0f * m_pTVolume[DATA_INDEX(vPosition.x+1, vPosition.y, vPosition.z, m_vVolSize.x, m_vVolSize.y)] + -1.0f * m_pTVolume[DATA_INDEX(vPosition.x+2, vPosition.y, vPosition.z, m_vVolSize.x, m_vVolSize.y)]); } else if (vPosition.x == m_vVolSize.x - 1) { // right border -> forward diff result.x = 0.5f * float( 3.0f * fValueAtPos+ -4.0f * m_pTVolume[DATA_INDEX(vPosition.x-1, vPosition.y, vPosition.z, m_vVolSize.x, m_vVolSize.y)] + 1.0f * m_pTVolume[DATA_INDEX(vPosition.x-2, vPosition.y, vPosition.z, m_vVolSize.x, m_vVolSize.y)]); } else { // interior -> central diff result.x = 0.5f * float( m_pTVolume[DATA_INDEX(vPosition.x+1, vPosition.y, vPosition.z, m_vVolSize.x, m_vVolSize.y)] - m_pTVolume[DATA_INDEX(vPosition.x-1, vPosition.y, vPosition.z, m_vVolSize.x, m_vVolSize.y)]); } // the y component if (vPosition.y == 0) { //forward diff result.y = 0.5f * (-3.0f * fValueAtPos + 4.0f * m_pTVolume[DATA_INDEX(vPosition.x, vPosition.y+1, vPosition.z, m_vVolSize.x, m_vVolSize.y)] + -1.0f * m_pTVolume[DATA_INDEX(vPosition.x, vPosition.y+2, vPosition.z, m_vVolSize.x, m_vVolSize.y)]); } else if (vPosition.y == m_vVolSize.y - 1) { // forward diff result.y = 0.5f * ( 3.0f * fValueAtPos+ -4.0f * m_pTVolume[DATA_INDEX(vPosition.x, vPosition.y-1, vPosition.z, m_vVolSize.x, m_vVolSize.y)] + 1.0f * m_pTVolume[DATA_INDEX(vPosition.x, vPosition.y-2, vPosition.z, m_vVolSize.x, m_vVolSize.y)]); } else { // central diff result.y = 0.5f * ( m_pTVolume[DATA_INDEX(vPosition.x, vPosition.y+1, vPosition.z, m_vVolSize.x, m_vVolSize.y)] - m_pTVolume[DATA_INDEX(vPosition.x, vPosition.y-1, vPosition.z, m_vVolSize.x, m_vVolSize.y)]); } // the z component if (vPosition.z == 0) { //forward diff result.z = 0.5f * (-3.0f * fValueAtPos + 4.0f * m_pTVolume[DATA_INDEX(vPosition.x, vPosition.y, vPosition.z+1, m_vVolSize.x, m_vVolSize.y)] + -1.0f * m_pTVolume[DATA_INDEX(vPosition.x, vPosition.y, vPosition.z+2, m_vVolSize.x, m_vVolSize.y)]); } else if (vPosition.z == m_vVolSize.z - 1) { // forward diff result.z = 0.5f * ( 3.0f * fValueAtPos+ -4.0f * m_pTVolume[DATA_INDEX(vPosition.x, vPosition.y, vPosition.z-1, m_vVolSize.x, m_vVolSize.y)] + 1.0f * m_pTVolume[DATA_INDEX(vPosition.x, vPosition.y, vPosition.z-2, m_vVolSize.x, m_vVolSize.y)]); } else { // central diff result.z = 0.5f * ( m_pTVolume[DATA_INDEX(vPosition.x, vPosition.y, vPosition.z+1, m_vVolSize.x, m_vVolSize.y)] - m_pTVolume[DATA_INDEX(vPosition.x, vPosition.y, vPosition.z-1, m_vVolSize.x, m_vVolSize.y)]); } FLOATVECTOR3 ret(static_cast(result.x), static_cast(result.y), static_cast(result.z)); return ret; } template LayerTempData::LayerTempData(VECTOR3 vVolSize, T* pTVolume) { m_vVolSize = vVolSize; pTBotData = pTVolume; pTTopData = pTVolume+DATA_INDEX(0, 0, 1, vVolSize.x, vVolSize.y); piEdges = new int[(vVolSize.x-1) * (vVolSize.y-1) * 12]; // allocate storage to hold the indexing tags for edges in the layer for (int i = 0; i < (vVolSize.x-1) * (vVolSize.y-1) * 12; i++) piEdges[i] = NO_EDGE; // init edge list } template LayerTempData::~LayerTempData() { delete [] piEdges; } template void LayerTempData::NextIteration() { // update the layer for this iteration pTBotData = pTTopData; // now topData points to next layer of scalar data pTTopData += DATA_INDEX(0, 0, 1, m_vVolSize.x, m_vVolSize.y); // percolate the last layer's top edges to this layer's bottom edges for (int iY = 0; iY < m_vVolSize.y-1; iY++) { for (int iX = 0; iX < m_vVolSize.x-1; iX++) { for (int iEdges = 0; iEdges < 4; iEdges++) { piEdges[EDGE_INDEX(iEdges, iX, iY, m_vVolSize.x-1)] = piEdges[EDGE_INDEX(iEdges+4, iX, iY, m_vVolSize.x-1)]; } // reinitialize all of the remaining edges for (int iEdges = 4; iEdges < 12; iEdges++) { piEdges[EDGE_INDEX(iEdges, iX, iY, m_vVolSize.x-1)] = NO_EDGE; } } } } ImageVis3D-3.1.0/Tuvok/Basics/Timer.cpp0000644000175000017500000000477012320456500017365 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Timer.cpp \author Jens Krueger SCI Institute University of Utah \date Januar 2009 */ #include #include #include "Timer.h" #ifndef DETECTED_OS_WINDOWS using namespace std; #endif Timer::Timer() { #ifndef DETECTED_OS_WINDOWS #else LARGE_INTEGER ticksPerSecond; QueryPerformanceFrequency(&ticksPerSecond); m_fTicksPerMSecond = double(ticksPerSecond.QuadPart) / 1000.0; #endif } void Timer::Start() { #ifndef DETECTED_OS_WINDOWS gettimeofday(&m_timeStart, NULL); #else QueryPerformanceCounter(&m_timeStart); #endif } double Timer::Elapsed() const { #ifndef DETECTED_OS_WINDOWS struct timeval timeProbe; gettimeofday(&timeProbe, NULL); return (timeProbe.tv_sec - m_timeStart.tv_sec) * 1000.0 + (timeProbe.tv_usec - m_timeStart.tv_usec) / 1000.0; #else LARGE_INTEGER timeProbe; QueryPerformanceCounter(&timeProbe); ULONGLONG ticksPassed = timeProbe.QuadPart - m_timeStart.QuadPart;// = tick.QuadPart/ticksPerSecond.QuadPart; return double(ticksPassed)/m_fTicksPerMSecond; #endif } double Timer::Now() { #ifndef DETECTED_OS_WINDOWS struct timeval tm; gettimeofday(&tm, NULL); return tm.tv_sec + (tm.tv_usec/1000000); #else assert(1 == 0); /// @todo implement return -42.4242; #endif } ImageVis3D-3.1.0/Tuvok/Basics/EndianFile.cpp0000644000175000017500000000255112320456500020276 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "EndianFile.h" EndianFile::EndianFile(LargeFile& largefile, bool isBigEndian) : lf(largefile), big_endian(isBigEndian) {} ImageVis3D-3.1.0/Tuvok/Basics/SystemInfo.cpp0000644000175000017500000001756312320456500020411 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file SystemInfo.cpp \author Jens Krueger SCI Institute University of Utah \date July 2008 */ #include "SystemInfo.h" #include "StdDefines.h" #ifdef _WIN32 #include #else #ifdef DETECTED_OS_APPLE #include #else #include #include #include #include #include #include #include "IO/KeyValueFileParser.h" #endif #endif SystemInfo::SystemInfo(std::string strProgramPath, uint64_t iDefaultCPUMemSize, uint64_t iDefaultGPUMemSize) : m_strProgramPath(strProgramPath), m_iProgramBitWidth(sizeof(void*)*8), m_iUseMaxCPUMem(iDefaultCPUMemSize), m_iUseMaxGPUMem(iDefaultGPUMemSize), m_iCPUMemSize(iDefaultCPUMemSize), m_iGPUMemSize(iDefaultGPUMemSize), m_bIsCPUSizeComputed(false), m_bIsGPUSizeComputed(false), m_bIsNumberOfCPUsComputed(false), m_bIsDirectX10Capable(false) { uint32_t iNumberOfCPUs = ComputeNumCPUs(); if (iNumberOfCPUs > 0) { m_iNumberOfCPUs = iNumberOfCPUs; m_bIsNumberOfCPUsComputed = true; } uint64_t iCPUMemSize = ComputeCPUMemSize(); if (iCPUMemSize > 0) { m_iCPUMemSize = iCPUMemSize; m_bIsCPUSizeComputed = true; } uint64_t iGPUMemSize = ComputeGPUMemory(); // also sets m_bIsDirectX10Capable if (iGPUMemSize > 0) { m_iGPUMemSize = iGPUMemSize; m_bIsGPUSizeComputed = true; } } uint32_t SystemInfo::ComputeNumCPUs() { #ifdef _WIN32 SYSTEM_INFO siSysInfo; GetSystemInfo(&siSysInfo); return siSysInfo.dwNumberOfProcessors; #else #ifdef DETECTED_OS_APPLE return 0; #else return 0; #endif #endif } #ifdef __linux__ #ifndef NDEBUG # define DBG(str) do { std::cerr << str << std::endl; } while(0) #else # define DBG(str) /* nothing */ #endif static unsigned long lnx_mem_sysinfo() { struct sysinfo si; if(sysinfo(&si) < 0) { perror("sysinfo"); return 0; } return si.totalram; } static uint64_t lnx_mem_rlimit() { struct rlimit limit; // RLIMIT_MEMLOCK returns 32768 (that's *bytes*) on my 6gb-RAM system, so // that number is worthless to us. // RLIMIT_DATA isn't great, because it gets the entire data segment size // allowable, not just the heap size ... if(getrlimit(RLIMIT_DATA, &limit) != 0) { perror("getrlimit"); return 0; } // Frequently the information given by getrlimit(2) is essentially // worthless, because it assumes we don't care about swapping. if(limit.rlim_cur == RLIM_INFINITY || limit.rlim_max == RLIM_INFINITY) { DBG("getrlimit gave useless info..."); return 0; } return limit.rlim_max; } static uint64_t lnx_mem_proc() { KeyValueFileParser meminfo("/proc/meminfo"); if(!meminfo.FileReadable()) { DBG("could not open proc memory filesystem"); return 0; } KeyValPair *mem_total = meminfo.GetData("MemTotal"); if(mem_total == NULL) { DBG("proc mem fs did not have a `MemTotal' entry."); return 0; } std::istringstream mem_strm(mem_total->strValue); uint64_t mem; mem_strm >> mem; return mem * 1024; } static uint64_t lnx_mem() { uint64_t m; if((m = lnx_mem_proc()) == 0) { DBG("proc failed, falling back to rlimit"); if((m = lnx_mem_rlimit()) == 0) { DBG("rlimit failed, falling back to sysinfo"); if((m = lnx_mem_sysinfo()) == 0) { DBG("all memory lookups failed; pretending you have 1Gb of memory."); return 1024*1024*1024; } } } return m; } #endif uint64_t SystemInfo::ComputeCPUMemSize() { #ifdef _WIN32 MEMORYSTATUSEX statex; statex.dwLength = sizeof (statex); GlobalMemoryStatusEx (&statex); return statex.ullTotalPhys; #else #ifdef DETECTED_OS_APPLE uint64_t phys = 0; int mib[2] = { CTL_HW, HW_MEMSIZE }; size_t len = sizeof(phys); if(sysctl(mib, sizeof(mib)/sizeof(mib[0]), &phys, &len, NULL, 0) != 0) { perror("max memory query"); return 0; } return phys; #elif defined(__linux__) return static_cast(lnx_mem()); #else std::cerr << "Unknown system, can't lookup max memory. " << "Using a hard setting of 10 gb." << std::endl; return 1024ULL*1024ULL*1024ULL*10ULL; #endif #endif } #if defined(_WIN32) && defined(USE_DIRECTX) #define INITGUID #include #include #include #include #include #pragma comment( lib, "d3d9.lib" ) HRESULT GetVideoMemoryViaDirectDraw( HMONITOR hMonitor, DWORD* pdwAvailableVidMem ); HRESULT GetVideoMemoryViaDXGI( HMONITOR hMonitor, SIZE_T* pDedicatedVideoMemory, SIZE_T* pDedicatedSystemMemory, SIZE_T* pSharedSystemMemory ); #ifndef SAFE_RELEASE #define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p)=NULL; } } #endif typedef IDirect3D9* ( WINAPI* LPDIRECT3DCREATE9 )( UINT ); LPDIRECT3DCREATE9 pDirect3DCreate9; uint64_t SystemInfo::ComputeGPUMemory( ) { HINSTANCE hD3D9 = LoadLibrary( L"d3d9.dll" ); if (!hD3D9) return 0; pDirect3DCreate9 = ( LPDIRECT3DCREATE9 )GetProcAddress( hD3D9, "Direct3DCreate9" ); if (!pDirect3DCreate9) { FreeLibrary( hD3D9 ); return 0; } IDirect3D9* pD3D9 = NULL; pD3D9 = pDirect3DCreate9( D3D_SDK_VERSION ); if( pD3D9 ) { UINT dwAdapterCount = pD3D9->GetAdapterCount(); if (dwAdapterCount > 0) { UINT iAdapter = 0; HMONITOR hMonitor = pD3D9->GetAdapterMonitor( iAdapter ); SIZE_T DedicatedVideoMemory; SIZE_T DedicatedSystemMemory; SIZE_T SharedSystemMemory; if( SUCCEEDED( GetVideoMemoryViaDXGI( hMonitor, &DedicatedVideoMemory, &DedicatedSystemMemory, &SharedSystemMemory ) ) ) { m_bIsDirectX10Capable = true; SAFE_RELEASE( pD3D9 ); return uint64_t(DedicatedVideoMemory); } else { DWORD dwAvailableVidMem; if( SUCCEEDED( GetVideoMemoryViaDirectDraw( hMonitor, &dwAvailableVidMem ) ) ) { SAFE_RELEASE( pD3D9 ); FreeLibrary( hD3D9 ); return uint64_t(dwAvailableVidMem); } else { SAFE_RELEASE( pD3D9 ); FreeLibrary( hD3D9 ); return 0; } } } SAFE_RELEASE( pD3D9 ); FreeLibrary( hD3D9 ); return 0; } else { FreeLibrary( hD3D9 ); return 0; } } #else uint64_t SystemInfo::ComputeGPUMemory( ) { #ifdef DETECTED_OS_APPLE return 0; #else // Linux return 0; #endif } #endif ImageVis3D-3.1.0/Tuvok/Basics/KDTree.h0000644000175000017500000001166412320456500017070 0ustar mathieumathieu#ifndef KDTREE_H #define KDTREE_H #include "Mesh.h" #include #include namespace tuvok { typedef std::vector triVec; class KDTreeNode { public: KDTreeNode(std::istream& kdfile) : m_Axis(0), m_SplitPos(0), m_leftChild(0), m_rightChild(0), m_bIsLeaf(true) { unsigned int itemCount; int iAxis; kdfile >> iAxis>> m_SplitPos>> m_bIsLeaf >> itemCount; m_Axis = (unsigned char)(iAxis); m_items.resize(itemCount); for (unsigned int i=0;i> m_items[i]; if (!m_bIsLeaf) { m_leftChild = new KDTreeNode(kdfile); m_rightChild = new KDTreeNode(kdfile); } } KDTreeNode() : m_Axis(0), m_SplitPos(0), m_leftChild(0), m_rightChild(0), m_bIsLeaf(true) {} ~KDTreeNode() { delete m_leftChild; delete m_rightChild; } void Save(std::ostream& kdfile) const { int iAxis = m_Axis; kdfile << iAxis << " " << m_SplitPos << " " << m_bIsLeaf << " " << (unsigned int)(m_items.size()) << std::endl; for (unsigned int i=0;i<(unsigned int)m_items.size();i++) kdfile << m_items[i] << " "; kdfile << std::endl; if (!m_bIsLeaf) { m_leftChild->Save(kdfile); m_rightChild->Save(kdfile); } } void GetGeometry(VertVec& vertices, NormVec& normals, IndexVec& vIndices, IndexVec& nIndices, const FLOATVECTOR3& min, const FLOATVECTOR3& max, unsigned int iDepth) { uint32_t sNormals = uint32_t(normals.size()); // indices for two triangles for (int i = 0;i<6;i++) nIndices.push_back(sNormals); FLOATVECTOR3 normal(0,0,0); normal[m_Axis] = 1.0; normals.push_back(normal); uint32_t sVertices = uint32_t(vertices.size()); UINTVECTOR3 iVertices1(sVertices,sVertices+1,sVertices+3); UINTVECTOR3 iVertices2(sVertices+2,sVertices+3,sVertices+0); vIndices.push_back(sVertices); vIndices.push_back(sVertices+1); vIndices.push_back(sVertices+3); vIndices.push_back(sVertices+2); vIndices.push_back(sVertices+3); vIndices.push_back(sVertices); FLOATVECTOR3 vertex1 = min; FLOATVECTOR3 vertex2 = min; FLOATVECTOR3 vertex3 = min; FLOATVECTOR3 vertex4 = max; vertex1[m_Axis] = float(m_SplitPos); vertex2[m_Axis] = float(m_SplitPos); vertex3[m_Axis] = float(m_SplitPos); vertex4[m_Axis] = float(m_SplitPos); switch (m_Axis) { case 0 : vertex2.y = max.y; vertex3.z = max.z; break; case 1 : vertex2.x = max.x; vertex3.z = max.z; break; default : vertex2.x = max.x; vertex3.y = max.y; break; } vertices.push_back(vertex1); vertices.push_back(vertex2); vertices.push_back(vertex3); vertices.push_back(vertex4); if (!m_bIsLeaf && iDepth > 0) { FLOATVECTOR3 max1 = max; max1[m_Axis] = float(m_SplitPos); FLOATVECTOR3 min2 = min; min2[m_Axis] = float(m_SplitPos); m_leftChild->GetGeometry(vertices, normals, vIndices, nIndices, min, max1, iDepth-1); m_rightChild->GetGeometry(vertices, normals, vIndices, nIndices, min2, max, iDepth-1); } } void SetAxis( unsigned char axis ) { m_Axis = axis; } unsigned char GetAxis() const { return m_Axis; } void SetSplitPos( double pos ) { m_SplitPos = pos; } double GetSplitPos() const { return m_SplitPos; } void SetLeft( KDTreeNode* leftChild ) { m_leftChild = leftChild; } void SetRight( KDTreeNode* rightChild ) { m_rightChild = rightChild; } KDTreeNode* GetLeft() const { return m_leftChild; } KDTreeNode* GetRight() const { return m_rightChild; } void Add( size_t triIndex ) {m_items.push_back(triIndex);} bool IsLeaf() const { return m_bIsLeaf; } void SetLeaf( bool bIsLeaf ) { m_bIsLeaf = bIsLeaf; } triVec& GetList() { return m_items; } private: unsigned char m_Axis; double m_SplitPos; KDTreeNode* m_leftChild; KDTreeNode* m_rightChild; triVec m_items; bool m_bIsLeaf; }; class KDTree { public: KDTree(Mesh* mesh, const std::string& filename = "", unsigned int maxDepth = 20); ~KDTree(void); double Intersect(const Ray& ray, FLOATVECTOR3& normal, FLOATVECTOR2& tc, FLOATVECTOR4& color, double tmin, double tmax) const; Mesh* GetGeometry(unsigned int iDepth, bool buildKDTree) const; void RescaleAndShift(const FLOATVECTOR3& translation, const FLOATVECTOR3& scale) { RescaleAndShift(m_Root, translation, scale); } private: Mesh* m_mesh; unsigned int m_maxDepth; KDTreeNode* m_Root; void Subdivide(KDTreeNode* node, const DOUBLEVECTOR3& min, const DOUBLEVECTOR3& max, int recDepth); void RescaleAndShift(KDTreeNode* node, const FLOATVECTOR3& translation, const FLOATVECTOR3& scale); }; } #endif // KDTREE_H ImageVis3D-3.1.0/Tuvok/Basics/KDTree.cpp0000644000175000017500000002454712320456500017427 0ustar mathieumathieu#include "KDTree.h" #include #include #include #include #include using namespace tuvok; class splitElem { public: splitElem(double p=0) : pos(p), n1count(0), n2count(0) {} double pos; size_t n1count; size_t n2count; bool operator<(const splitElem& other) const { return pos < other.pos; } }; typedef std::vector slist; typedef std::pair dPair; typedef std::vector< dPair > eventVec; bool compMin(const dPair& a, const dPair& b) {return a.first < b.first;} bool compMax(const dPair& a, const dPair& b) {return a.second < b.second;} bool compFirst(const dPair& a, const double b) {return a.second < b;} KDTree::KDTree(Mesh* mesh, const std::string& filename, unsigned int maxDepth) : m_mesh(mesh), m_maxDepth(maxDepth), m_Root(0) { if (filename != "") { // try to load kd from disk if filename is given std::ifstream kdfile; kdfile.open(filename.c_str()); if (kdfile.is_open()) { std::cout << "Loading KD-Tree " << filename << std::endl; kdfile >> m_maxDepth; m_Root = new KDTreeNode(kdfile); kdfile.close(); std::cout << "Done" << std::endl; return; } } assert(m_maxDepth>0); std::cout << "Generating KD-Tree" << std::endl; m_Root = new KDTreeNode(); for ( size_t e = 0; e < m_mesh->m_Data.m_VertIndices.size(); e++ ) m_Root->Add( e ); Subdivide( m_Root, DOUBLEVECTOR3(m_mesh->m_Bounds[0]), DOUBLEVECTOR3(m_mesh->m_Bounds[1]), m_maxDepth ); std::cout << "Done" << std::endl; if (filename != "") { std::cout << "Saving KD-Tree " << filename << std::endl; std::ofstream kdfile; kdfile.open(filename.c_str()); if (kdfile.is_open()) { kdfile << m_maxDepth << std::endl; m_Root->Save(kdfile); kdfile.close(); } std::cout << "Done" << std::endl; } } KDTree::~KDTree(void) { delete m_Root; } #include struct StackElem { KDTreeNode* node; // pointer to far child double t; // the entry/exit signed distance DOUBLEVECTOR3 pb; // the coordinates of entry/exit point int prev; // the pointer to the previous stack item }; double KDTree::Intersect(const Ray& ray, FLOATVECTOR3& normal, FLOATVECTOR2& tc, FLOATVECTOR4& color, double tmin, double tmax) const { StackElem* stack = new StackElem[m_maxDepth+3]; // init stack int enPt = 0, exPt = 1; // init traversal KDTreeNode* farchild = 0, *currnode = m_Root; stack[enPt].t = tmin; stack[enPt].pb = (tmin > 0) ? (ray.start + ray.direction * tmin) :ray.start; stack[enPt].node = 0; stack[enPt].prev = 0; stack[exPt].t = tmax; stack[exPt].pb = ray.start + ray.direction * tmax; stack[exPt].node = 0; stack[enPt].prev = 0; // traverse kd-tree while (currnode) { while (!currnode->IsLeaf()) { double splitpos = currnode->GetSplitPos(); int axis = currnode->GetAxis(); if (stack[enPt].pb[axis] <= splitpos) { if (stack[exPt].pb[axis] <= splitpos) { currnode = currnode->GetLeft(); continue; } farchild = currnode->GetRight(); currnode = currnode->GetLeft(); } else { if (stack[exPt].pb[axis] > splitpos) { currnode = currnode->GetRight(); continue; } farchild = currnode->GetLeft(); currnode = currnode->GetRight(); } double t = (splitpos - ray.start[axis]) / ray.direction[axis]; int tmp = exPt++; if (exPt == enPt) exPt++; stack[exPt].prev = tmp; stack[exPt].t = t; stack[exPt].node = farchild; stack[exPt].pb = ray.start + ray.direction * t; } // check leaf cell double t = std::numeric_limits::max(); FLOATVECTOR3 _normal; FLOATVECTOR2 _tc; FLOATVECTOR4 _color; for (size_t i = 0;iGetList().size();i++) { double currentT = m_mesh->IntersectTriangle(currnode->GetList()[i], ray, _normal, _tc, _color); if (currentT < t) { normal = _normal; t = currentT; tc = _tc; color = _color; } } if (t != std::numeric_limits::max()) { delete [] stack; return t; } enPt = exPt; currnode = stack[exPt].node; exPt = stack[enPt].prev; } delete [] stack; return std::numeric_limits::max(); } void KDTree::Subdivide(KDTreeNode* node, const DOUBLEVECTOR3& min, const DOUBLEVECTOR3& max, int recDepth) { // determine split axis (always split along the longest axis) DOUBLEVECTOR3 bboxSize = max-min; unsigned char axis = 2; if ((bboxSize.x >= bboxSize.y) && (bboxSize.x >= bboxSize.z)) axis = 0; else if ((bboxSize.y >= bboxSize.x) && (bboxSize.y >= bboxSize.z)) axis = 1; node->SetAxis(axis); // make a list of the split position candidates double pos1 = min[axis]; double pos2 = max[axis]; slist splitCandidates; splitCandidates.reserve(node->GetList().size()); eventVec events; for (size_t i = 0;iGetList().size();i++) { size_t triIndex = node->GetList()[i]; double vertices[3] = { m_mesh->m_Data.m_vertices[m_mesh->m_Data.m_VertIndices[triIndex*3+0]][axis], m_mesh->m_Data.m_vertices[m_mesh->m_Data.m_VertIndices[triIndex*3+1]][axis], m_mesh->m_Data.m_vertices[m_mesh->m_Data.m_VertIndices[triIndex*3+2]][axis] }; double pMin = vertices[0]; double pMax = vertices[0]; for (size_t j = 1;j<3;j++) { if (vertices[j] < pMin) pMin = vertices[j]; if (vertices[j] > pMax) pMax = vertices[j]; } if ( pMin >= pos1 ) splitCandidates.push_back( pMin ); if ( pMax <= pos2 ) splitCandidates.push_back( pMax ); events.push_back(std::make_pair(pMin,pMax)); } // calculate the inverse half surface area for // current node, used for normalization double halfInverseArea = 1.0/(bboxSize[0]*bboxSize[1] + bboxSize[0]*bboxSize[2] + bboxSize[1]*bboxSize[2]); double minCost = std::numeric_limits::max(); double bestpos = 0; // sort the triangles (events) bythe max and min index and then figure out // the number of triangles on the right and on the left by using binary search eventVec eventsMax = events; sort(events.begin(), events.end(), compMin); sort(eventsMax.begin(), eventsMax.end(), compMax); for (size_t i = 0;ipos - min[axis]; DOUBLEVECTOR3 b2 = bboxSize; b2[axis] -= b1[axis]; // compute the cost for this split double halfArea1 = b1.x * b1.y + b1.y * b1.z + b1.x * b1.z; double halfArea2 = b2.x * b2.y + b2.y * b2.z + b2.x * b2.z; // the 0.3 is some wild guess for the tree // (travesal/triangle intersect)-cost double splitcost = 0.3 + halfInverseArea * (halfArea1 * candidate->n1count + halfArea2 * candidate->n2count); // update best cost tracking variables if (minCost > splitcost) { minCost = splitcost; bestpos = candidate->pos; } } // calculate cost for not splitting double noSplitCost = double(node->GetList().size()); // if splitting makes things worse -> stop if (minCost > noSplitCost) return; // split node->SetLeaf(false); KDTreeNode* left = new KDTreeNode; KDTreeNode* right = new KDTreeNode; // push objects into children for (size_t i = 0;iGetList().size();i++) { size_t triIndex = node->GetList()[i]; double vertices[3] = { m_mesh->m_Data.m_vertices[m_mesh->m_Data.m_VertIndices[triIndex*3+0]][axis], m_mesh->m_Data.m_vertices[m_mesh->m_Data.m_VertIndices[triIndex*3+1]][axis], m_mesh->m_Data.m_vertices[m_mesh->m_Data.m_VertIndices[triIndex*3+2]][axis] }; if ( vertices[0] <= bestpos || vertices[1] <= bestpos || vertices[2] <= bestpos) left->Add(triIndex); if ( vertices[0] > bestpos || vertices[1] > bestpos || vertices[2] > bestpos) right->Add(triIndex); } node->SetLeft(left); node->SetRight(right); node->SetAxis(axis); node->SetSplitPos(bestpos); if (recDepth > 1) { DOUBLEVECTOR3 max1 = max; max1[axis] = bestpos; if (left->GetList().size() > 2) Subdivide( left, min, max1, recDepth-1); DOUBLEVECTOR3 min2 = min; min2[axis] = bestpos; if (right->GetList().size() > 2) Subdivide( right, min2, max, recDepth-1); } } Mesh* KDTree::GetGeometry(unsigned int iDepth, bool buildKDTree) const { VertVec vertices; NormVec normals; TexCoordVec texcoords; ColorVec colors; IndexVec vIndices; IndexVec nIndices; IndexVec tIndices; IndexVec cIndices; // as the GetGeometry call does not create colors or texture coords // we do not pass these two to this call but since the constructor // requires them to be given we pass the empty vectors to it m_Root->GetGeometry(vertices, normals, vIndices, nIndices, m_mesh->m_Bounds[0], m_mesh->m_Bounds[1], iDepth); return new Mesh(vertices, normals, texcoords, colors, vIndices, nIndices, tIndices, cIndices, buildKDTree,false,"KD-Tree Mesh", Mesh::MT_TRIANGLES); } void KDTree::RescaleAndShift(KDTreeNode* node, const FLOATVECTOR3& translation, const FLOATVECTOR3& scale) { unsigned char axis = node->GetAxis(); double pos = node->GetSplitPos(); pos = pos * scale[axis] + translation[axis]; node->SetSplitPos(pos); if (!node->IsLeaf()) { RescaleAndShift(node->GetLeft(), translation, scale); RescaleAndShift(node->GetRight(), translation, scale); } } ImageVis3D-3.1.0/Tuvok/Basics/SysTools.cpp0000644000175000017500000011626412320456500020106 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file SysTools.cpp \brief Simple routines for filename handling \author Jens Krueger SCI Institute University of Utah \version 1.5 \date Dec 2008 */ #include "StdDefines.h" #include #include #include #include #include #include #include #include #include #include #include #ifndef _WIN32 #include #include #include #include #define LARGE_STAT(name,buffer) stat(name,buffer) #else #include #define LARGE_STAT(name,buffer) _stat64(name,buffer) #endif #ifdef DETECTED_OS_APPLE #include #endif // define MAX / MIN #ifndef MAX #define MAX(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef MIN #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif #include "SysTools.h" using namespace std; namespace SysTools { vector Tokenize(const string& strInput, EProtectMode mode, char const customOrOpeningDelimiter, char const closingDelimiter) { vector strElements; const wstring wstrInput(strInput.begin(), strInput.end()); const string strCustomOrOpeningDelimter(1, customOrOpeningDelimiter); const wstring wstrCustomOrOpeningDelimiter(strCustomOrOpeningDelimter.begin(), strCustomOrOpeningDelimter.end()); assert(wstrCustomOrOpeningDelimiter.size() == 1); const string strClosingDelimter(1, closingDelimiter); const wstring wstrClosingDelimiter(strClosingDelimter.begin(), strClosingDelimter.end()); assert(wstrClosingDelimiter.size() == 1); vector wstrElements = Tokenize(wstrInput, mode, wstrCustomOrOpeningDelimiter.at(0), wstrClosingDelimiter.at(0)); for (size_t i=0; i Tokenize(const wstring& strInput, EProtectMode mode, wchar_t const customOrOpeningDelimiter, wchar_t const closingDelimiter) { vector strElements; switch (mode) { case PM_QUOTES : { wstring buf; wstringstream ss(strInput); bool bProtected = false; while (ss >> buf) { wstring cleanBuf = buf; if (cleanBuf[0] == L'\"') cleanBuf = cleanBuf.substr(1, cleanBuf.length()-1); if (!cleanBuf.empty() && cleanBuf[cleanBuf.size()-1] == L'\"') cleanBuf = cleanBuf.substr(0, cleanBuf.length()-1); if (bProtected) { size_t end = strElements.size()-1; strElements[end] = strElements[end] + L" " + cleanBuf; } else strElements.push_back(cleanBuf); if (buf[0] == L'\"') bProtected = true; if (buf[buf.size()-1] == L'\"') bProtected = false; } } break; case PM_BRACKETS : { int iLevel = 0; size_t iStart = 0; size_t i = 0; for (;i 0) strElements.push_back(strInput.substr(iStart, i-iStart)); iStart = i+1; } continue; } switch (strInput[i]) { case L' ': case L'\n': case L'\r': case L'\t': if (iLevel == 0) { if (i-iStart > 0) strElements.push_back(strInput.substr(iStart, i-iStart)); iStart = i+1; } break; } } if (i-iStart > 0) strElements.push_back(strInput.substr(iStart, i-iStart)); } break; case PM_CUSTOM_DELIMITER : { size_t iStart = 0; size_t i = 0; for (;i 0) strElements.push_back(strInput.substr(iStart, i-iStart)); iStart = i+1; } } if (i-iStart > 0) strElements.push_back(strInput.substr(iStart, i-iStart)); } break; default : { wstring buf; wstringstream ss(strInput); while (ss >> buf) strElements.push_back(buf); } break; } return strElements; } string GetFromResourceOnMac(const string& strFileName) { #ifdef DETECTED_OS_APPLE CFStringRef cfFilename = CFStringCreateWithCString(kCFAllocatorDefault, RemoveExt(GetFilename(strFileName)).c_str(), CFStringGetSystemEncoding()); CFStringRef cfExt = CFStringCreateWithCString(kCFAllocatorDefault, GetExt(GetFilename(strFileName)).c_str(), CFStringGetSystemEncoding()); CFURLRef imageURL = CFBundleCopyResourceURL( CFBundleGetMainBundle(), cfFilename, cfExt, NULL ); if (imageURL == NULL) return ""; CFStringRef macPath = CFURLCopyFileSystemPath(imageURL, kCFURLPOSIXPathStyle); const char *pathPtr = CFStringGetCStringPtr(macPath, CFStringGetSystemEncoding()); if (macPath != 0 && pathPtr != 0) { string result = pathPtr; return result; } else return strFileName; #else return strFileName; #endif } wstring GetFromResourceOnMac(const wstring& wstrFileName) { #ifdef DETECTED_OS_APPLE // for now just call the string method by converting the unicode string down to an 8bit string string strFileName(wstrFileName.begin(), wstrFileName.end()); string strResult = GetFromResourceOnMac(strFileName); wstring wstrResult(strResult.begin(), strResult.end()); return wstrResult; #else return wstrFileName; #endif } void ReplaceAll(string& input, const string& search, const string& replace) { size_t pos=0; while(pos(c));} inline int myToupper(int c) {return toupper(static_cast(c));} std::string TrimStrLeft( const std::string& Src, const std::string& c) { size_t p1 = Src.find_first_not_of(c); if (p1 == std::string::npos) {return std::string();} return Src.substr(p1); } std::string TrimStrRight( const std::string& Src, const std::string& c) { size_t p2 = Src.find_last_not_of(c); if (p2 == std::string::npos) {return std::string();} return Src.substr(0, p2+1); } std::string TrimStr( const std::string& Src, const std::string& c) { size_t p2 = Src.find_last_not_of(c); if (p2 == std::string::npos) {return std::string();} size_t p1 = Src.find_first_not_of(c); if (p1 == std::string::npos) p1 = 0; return Src.substr(p1, (p2-p1)+1); } std::wstring TrimStrLeft( const std::wstring& Src, const std::wstring& c) { size_t p1 = Src.find_first_not_of(c); if (p1 == std::wstring::npos) {return std::wstring();} return Src.substr(p1); } std::wstring TrimStrRight( const std::wstring& Src, const std::wstring& c) { size_t p2 = Src.find_last_not_of(c); if (p2 == std::wstring::npos) {return std::wstring();} size_t p1 = Src.find_first_not_of(c); if (p1 == std::wstring::npos) p1 = 0; return Src.substr(0, p2+1); } std::wstring TrimStr( const std::wstring& Src, const std::wstring& c) { size_t p2 = Src.find_last_not_of(c); if (p2 == std::wstring::npos) {return std::wstring();} size_t p1 = Src.find_first_not_of(c); if (p1 == std::wstring::npos) p1 = 0; return Src.substr(p1, (p2-p1)+1); } bool GetFileStats(const string& strFileName, LARGE_STAT_BUFFER& stat_buf) { return (LARGE_STAT( strFileName.c_str(), &stat_buf) >= 0); } bool GetFileStats(const wstring& wstrFileName, LARGE_STAT_BUFFER& stat_buf) { string strFileName(wstrFileName.begin(), wstrFileName.end()); return (LARGE_STAT( strFileName.c_str(), &stat_buf) >= 0); } bool FileExists(const wstring& wstrFileName) { LARGE_STAT_BUFFER stat_buf; return GetFileStats(wstrFileName, stat_buf); } bool FileExists(const string& strFileName) { LARGE_STAT_BUFFER stat_buf; return GetFileStats(strFileName, stat_buf); } string GetExt(const string& fileName) { size_t indexDot = fileName.find_last_of("."); size_t indexSlash = MAX(int(fileName.find_last_of("\\")),int(fileName.find_last_of("/"))); if (indexDot == string::npos || (indexSlash != string::npos && indexDot < indexSlash)) return ""; string ext = fileName.substr(indexDot+1); return ext; } wstring GetExt(const wstring& fileName) { size_t indexDot = fileName.find_last_of(L"."); size_t indexSlash = MAX(int(fileName.find_last_of(L"\\")),int(fileName.find_last_of(L"/"))); if (indexDot == wstring::npos || (indexSlash != wstring::npos && indexDot < indexSlash)) return L""; wstring ext = fileName.substr(indexDot+1); return ext; } wstring ToLowerCase(const wstring& str) { wstring result(str); transform(str.begin(), str.end(), result.begin(), myTolower); return result; } string ToLowerCase(const string& str) { string result(str); transform(str.begin(), str.end(), result.begin(), myTolower); return result; } wstring ToUpperCase(const wstring& str) { wstring result(str); transform(str.begin(), str.end(), result.begin(), myToupper); return result; } string ToUpperCase(const string& str) { string result(str); transform(str.begin(), str.end(), result.begin(), myToupper); return result; } string GetPath(const string& fileName) { string path = fileName.substr(0,MAX(int(fileName.find_last_of("\\")),int(fileName.find_last_of("/")))+1); if(path.empty()) { path = "./"; } return path; } wstring GetPath(const wstring& fileName) { wstring path = fileName.substr(0,MAX(int(fileName.find_last_of(L"\\")),int(fileName.find_last_of(L"/")))+1); if(path.empty()) { path = L"./"; } return path; } std::string GetFilename(const std::string& fileName) { size_t index = MAX(int(fileName.find_last_of("\\")),int(fileName.find_last_of("/")))+1; string name = fileName.substr(index,fileName.length()-index); return name; } std::wstring GetFilename(const std::wstring& fileName) { size_t index = MAX(int(fileName.find_last_of(L"\\")),int(fileName.find_last_of(L"/")))+1; wstring name = fileName.substr(index,fileName.length()-index); return name; } std::string basename(const std::string& f) { return GetFilename(f); } std::string dirname(const std::string& f) { return GetPath(f); } #ifdef DETECTED_OS_WINDOWS # define MAX_PATH_LENGTH MAX_PATH #else # define MAX_PATH_LENGTH PATH_MAX #endif std::string CanonicalizePath(const std::string& path) { #ifdef DETECTED_OS_WINDOWS wchar_t resolved[MAX_PATH_LENGTH]; wchar_t wide[MAX_PATH_LENGTH]; mbstowcs(wide, path.c_str(), MAX_PATH_LENGTH); if(PathCanonicalize(resolved, wide) == FALSE) #else char resolved[MAX_PATH_LENGTH]; if(realpath(path.c_str(), resolved) == NULL) #endif { std::ostringstream fn; fn << "realpath " << path << ": "; perror(fn.str().c_str()); return path; // need to return *something*. } #ifdef DETECTED_OS_WINDOWS char buffer[MAX_PATH_LENGTH]; const wchar_t *res_ptr = resolved; mbstate_t mbs = {0}; wcsrtombs(buffer, &res_ptr, MAX_PATH_LENGTH, &mbs); return std::string(buffer); #else return std::string(resolved); #endif } string FindPath(const string& fileName, const string& path) { string searchFile; string slash = ""; if (fileName[0] != '/' && fileName[0] != '\\' && path[path.length()-1] != '/' && path[path.length()-1] != '\\') { slash = "/"; } // search in the given path searchFile = path + slash + fileName; // search in the given path searchFile = path + fileName; if (FileExists(searchFile)) return searchFile; // search in the current directory searchFile = "./" + fileName; if (FileExists(searchFile)) return searchFile; // search in the parent directory searchFile = "../" + fileName; if (FileExists(searchFile)) return searchFile; return ""; } wstring FindPath(const wstring& fileName, const wstring& path) { wstring searchFile; wstring slash = L""; if (fileName[0] != '/' && fileName[0] != '\\' && path[path.length()-1] != '/' && path[path.length()-1] != '\\') { slash = L"/"; } // search in the given path searchFile = path + slash + fileName; if (FileExists(searchFile)) return searchFile; // search in the current directory searchFile = L".\\" + fileName; if (FileExists(searchFile)) return searchFile; // search in the parent directory searchFile = L"..\\" + fileName; if (FileExists(searchFile)) return searchFile; return L""; } std::string RemoveExt(const std::string& fileName) { size_t indexDot = fileName.find_last_of("."); size_t indexSlash = MAX(int(fileName.find_last_of("\\")),int(fileName.find_last_of("/"))); if (indexDot == string::npos || (indexSlash != string::npos && indexDot < indexSlash)) return fileName; return fileName.substr(0,indexDot); } std::wstring RemoveExt(const std::wstring& fileName) { size_t indexDot = fileName.find_last_of(L"."); size_t indexSlash = MAX(int(fileName.find_last_of(L"\\")),int(fileName.find_last_of(L"/"))); if (indexDot == wstring::npos || (indexSlash != wstring::npos && indexDot < indexSlash)) return fileName; return fileName.substr(0,indexDot); } string ChangeExt(const string& fileName, const std::string& newext) { return RemoveExt(fileName)+ "." + newext; } wstring ChangeExt(const std::wstring& fileName, const std::wstring& newext) { return RemoveExt(fileName)+ L"." + newext; } string CheckExt(const string& fileName, const std::string& newext) { string currentExt = GetExt(fileName); #ifdef _WIN32 // do a case insensitive check on windows systems if (ToLowerCase(currentExt) != ToLowerCase(newext)) #else if (currentExt != newext) #endif return fileName + "." + newext; else return fileName; } wstring CheckExt(const std::wstring& fileName, const std::wstring& newext) { wstring currentExt = GetExt(fileName); #ifdef _WIN32 // do a case insensitive check on windows systems if (ToLowerCase(currentExt) != ToLowerCase(newext)) #else if (currentExt != newext) #endif return fileName + L"." + newext; else return fileName; } string AppendFilename(const string& fileName, const int iTag) { return AppendFilename(fileName, ToString(iTag)); } wstring AppendFilename(const wstring& fileName, const int iTag) { return AppendFilename(fileName, ToWString(iTag)); } string AppendFilename(const string& fileName, const string& tag) { return RemoveExt(fileName) + tag + "." + GetExt(fileName); } wstring AppendFilename(const wstring& fileName, const wstring& tag) { return RemoveExt(fileName) + tag + L"." + GetExt(fileName); } vector GetSubDirList(const wstring& dir) { vector subDirs; wstring rootdir; #ifdef _WIN32 wstringstream s; if (dir == L"") { WCHAR path[4096]; GetCurrentDirectoryW(4096, path); s << path << L"/"; } else { s << dir << L"/"; } rootdir = s.str(); WIN32_FIND_DATAW FindFileData; HANDLE hFind; hFind=FindFirstFileW((rootdir + L"*.*").c_str(), &FindFileData); if (hFind != INVALID_HANDLE_VALUE) { do { wstring wstrFilename = FindFileData.cFileName; if( (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && wstrFilename != L"." && wstrFilename != L"..") { subDirs.push_back(wstrFilename); } }while ( FindNextFileW(hFind, &FindFileData) ); } FindClose(hFind); #else if (dir == L"") { rootdir = L"./"; } else { rootdir = dir + L"/"; } string strDir(rootdir.begin(), rootdir.end()); DIR* dirData=opendir(strDir.c_str()); if (dirData != NULL) { struct dirent *inode; while ((inode=readdir(dirData)) != NULL) { string strFilenameLocal = inode->d_name; wstring wstrFilename(strFilenameLocal.begin(), strFilenameLocal.end()); string strFilename = strDir + strFilenameLocal; struct ::stat st; if (::stat(strFilename.c_str(), &st) != -1) if (S_ISDIR(st.st_mode) && strFilenameLocal != "." && strFilenameLocal != "..") { subDirs.push_back(wstrFilename); } } closedir(dirData); } #endif vector completeSubDirs(subDirs.size()); for (size_t i = 0;i GetSubDirList(const string& dir) { vector subDirs; string rootdir; #ifdef _WIN32 stringstream s; if (dir == "") { CHAR path[4096]; GetCurrentDirectoryA(4096, path); s << path << "/"; } else { s << dir << "/"; } rootdir = s.str(); WIN32_FIND_DATAA FindFileData; HANDLE hFind; hFind=FindFirstFileA((rootdir + "*.*").c_str(), &FindFileData); if (hFind != INVALID_HANDLE_VALUE) { do { string strFilename = FindFileData.cFileName; if( (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && strFilename != "." && strFilename != "..") { subDirs.push_back(strFilename); } }while ( FindNextFileA(hFind, &FindFileData) ); } FindClose(hFind); #else if (dir == "") { rootdir = "./"; } else { rootdir = dir + "/"; } DIR* dirData=opendir(rootdir.c_str()); if (dirData != NULL) { struct dirent *inode; while ((inode=readdir(dirData)) != NULL) { string strFilenameLocal = inode->d_name; string strFilename = rootdir + strFilenameLocal; struct ::stat st; if (::stat(strFilename.c_str(), &st) != -1) if (S_ISDIR(st.st_mode) && strFilenameLocal != "." && strFilenameLocal != "..") { subDirs.push_back(strFilenameLocal); } } closedir(dirData); } #endif vector completeSubDirs(subDirs.size()); for (size_t i = 0;i GetDirContents(const wstring& dir, const wstring& fileName, const wstring& ext) { vector files; wstringstream s; #ifdef _WIN32 wstring wstrDir; if (dir == L"") { WCHAR path[4096]; GetCurrentDirectoryW(4096, path); s << path << L"/" << fileName << L"." << ext; wstrDir = wstring(path); } else { s << dir << L"/" << fileName << L"." << ext; wstrDir = dir; } WIN32_FIND_DATAW FindFileData; HANDLE hFind; hFind=FindFirstFileW(s.str().c_str(), &FindFileData); if (hFind != INVALID_HANDLE_VALUE) { do { if( 0 == (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ) { files.push_back(wstrDir + L"/" + wstring(FindFileData.cFileName)); } }while ( FindNextFileW(hFind, &FindFileData) ); } FindClose(hFind); #else wstring wstrDir; if (dir == L"") { wstrDir = L"./"; } else { wstrDir = dir + L"/"; } string strDir(wstrDir.begin(), wstrDir.end()); // filter files via regexpr string regExpr = "^"; regex_t preg; if (fileName != L"") { string strFileName(fileName.begin(), fileName.end()); regExpr = regExpr + strFileName; // replace * by .* and ? by . ReplaceAll(regExpr, "*", ".*"); ReplaceAll(regExpr, "?", "."); } if (ext != L"") { if (fileName == L"") regExpr = regExpr + ".*"; string tmpext(ext.begin(), ext.end()); // replace * by .* and ? by . ReplaceAll(tmpext, "*", ".*"); ReplaceAll(tmpext, "?", "."); // append dot and extension to regular expression regExpr = regExpr + "\\." + tmpext + "$"; } if (regcomp(&preg, regExpr.c_str(), REG_EXTENDED | REG_NOSUB) != 0) return files; DIR* dirData=opendir(strDir.c_str()); if (dirData != NULL) { struct dirent *finfo; while ((finfo=readdir(dirData)) != NULL) { string strFilename = finfo->d_name; wstring wstrFilename(strFilename.begin(), strFilename.end()); strFilename = strDir + strFilename; struct ::stat st; if (::stat(strFilename.c_str(), &st) != -1) if (!S_ISDIR(st.st_mode) && !regexec(&preg, finfo->d_name, size_t(0), NULL, 0)) { files.push_back(wstrFilename); } } closedir(dirData); } regfree(&preg); #endif return files; } vector GetDirContents(const string& dir, const string& fileName, const string& ext) { vector files; stringstream s; #ifdef _WIN32 WIN32_FIND_DATAA FindFileData; HANDLE hFind; string strDir; if (dir == "") { char path[4096]; GetCurrentDirectoryA(4096, path); s << path << "/" << fileName << "." << ext; strDir = string(path); } else { s << dir << "/" << fileName << "." << ext; strDir = dir; } hFind=FindFirstFileA(s.str().c_str(), &FindFileData); if (hFind != INVALID_HANDLE_VALUE) { do { if( 0 == (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ) { files.push_back(strDir + "/" + string(FindFileData.cFileName)); } }while ( FindNextFileA(hFind, &FindFileData) ); } FindClose(hFind); #else string strDir; if (dir == "") { strDir = "./"; } else { strDir = dir + "/"; } // filter files via regexpr string regExpr = "^"; regex_t preg; if (fileName != "") { regExpr = regExpr + fileName; // replace * by .* and ? by . ReplaceAll(regExpr, "*", ".*"); ReplaceAll(regExpr, "?", "."); } if (ext != "") { if (fileName == "") regExpr = regExpr + ".*"; string tmpext = ext; // replace * by .* and ? by . ReplaceAll(tmpext, "*", ".*"); ReplaceAll(tmpext, "?", "."); // append dot and extension to regular expression regExpr = regExpr + "\\." + tmpext + "$"; } if (regcomp(&preg, regExpr.c_str(), REG_EXTENDED | REG_NOSUB) != 0) return files; DIR* dirData=opendir(strDir.c_str()); if (dirData != NULL) { struct dirent *finfo; while ((finfo=readdir(dirData)) != NULL) { string strFilename = finfo->d_name; strFilename = strDir + strFilename; struct ::stat st; if (::stat(strFilename.c_str(), &st) != -1) { if (!S_ISDIR(st.st_mode) && !regexec(&preg, finfo->d_name, size_t(0), NULL, 0)) { files.push_back(std::string(strFilename.c_str())); } } } closedir(dirData); } regfree(&preg); #endif return files; } std::string FindNextSequenceName(const std::string& strFilename) { std::string dir = SysTools::GetPath(strFilename); std::string fileName = SysTools::RemoveExt(SysTools::GetFilename(strFilename)); std::string ext = SysTools::GetExt(strFilename); return FindNextSequenceName(fileName, ext, dir); } std::wstring FindNextSequenceName(const std::wstring& wStrFilename) { std::wstring dir = SysTools::GetPath(wStrFilename); std::wstring fileName = SysTools::RemoveExt(SysTools::GetFilename(wStrFilename)); std::wstring ext = SysTools::GetExt(wStrFilename); return FindNextSequenceName(fileName, ext, dir); } // Functor to identify the numeric ID appended to a given filename. template struct fileNumber : public std::unary_function { size_t operator()(const T& filename) const { // get just the filename itself, without extension or path information. T fn = RemoveExt(GetFilename(filename)); if (fn.length() == 0) return 0; // Find where the numbers start. typename T::const_iterator numerals = fn.end()-1; while (numerals != fn.begin() && ::isdigit(*(numerals-1))) --numerals; // the string should only contain the numbers or a _ otherweise the // filename in question was just a prefix to another longer filename size_t iNonNumeralCharCount = fn.length()-T(&*numerals).length(); if (iNonNumeralCharCount > 1) return 0; if (iNonNumeralCharCount > 0) { T leadingCharacter = fn.substr(0,1); std::string tmp(leadingCharacter.begin(), leadingCharacter.end()); if (tmp != "_") return 0; } // convert it to a size_t and return that. size_t retval = 0; FromString(retval, T(&*numerals)); return retval; } }; // Given a filename model and a directory, identify the next filename in the // sequence. Sequences start at 0 and increment. string FindNextSequenceName(const string& fileName, const string& ext, const string& dir) { stringstream out; vector files = GetDirContents(dir, fileName+"*", ext); // chop of original filename (in case it also ends with numbers) for (auto i=files.begin(); i < files.end(); ++i) { std::string tmp = GetFilename(*i); (*i) = tmp.substr(fileName.length(), tmp.length()-fileName.length()); } // Get a list of all the trailing numeric values. std::vector values; values.reserve(files.size()); std::transform(files.begin(), files.end(), std::back_inserter(values), fileNumber()); // No files in the dir? Default to 1. if(values.empty()) { out << dir << fileName << "_" << 1 << "." << ext; } else { // Otherwise, the next number is the current max + 1. size_t max_val = *(std::max_element(values.begin(), values.end())); out << dir << fileName << "_" << max_val+1 << "." << ext; } return out.str(); } wstring FindNextSequenceName(const wstring& fileName, const wstring& ext, const wstring& dir) { wstringstream out; vector files = GetDirContents(dir, fileName+L"*", ext); // Get a list of all the trailing numeric values. std::vector values; values.reserve(files.size()); std::transform(files.begin(), files.end(), std::back_inserter(values), fileNumber()); // No files in the dir? Default to 0. if(values.empty()) { out << dir << fileName << 0 << L"." << ext; } else { // Otherwise, the next number is the current max + 1. size_t max_val = *(std::max_element(values.begin(), values.end())); out << dir << fileName << max_val+1 << L"." << ext; } return out.str(); } uint32_t FindNextSequenceIndex(const string& fileName, const string& ext, const string& dir) { vector files = GetDirContents(dir, fileName+"*", ext); uint32_t iMaxIndex = 0; for (size_t i = 0; i files = GetDirContents(dir, fileName+L"*", ext); uint32_t iMaxIndex = 0; for (size_t i = 0; ipw_dir ); return true; } else return false; } #endif } bool GetHomeDirectory(std::wstring& path) { #ifdef DETECTED_OS_WINDOWS WCHAR infoBuf[INFO_BUFFER_SIZE]; DWORD dwRet = GetEnvironmentVariableW(L"HOMEDRIVE", infoBuf, INFO_BUFFER_SIZE); if (dwRet) { path = std::wstring(infoBuf); } else { return false; } dwRet = GetEnvironmentVariableW(L"HOMEPATH", infoBuf, INFO_BUFFER_SIZE); if (dwRet) { path = path + std::wstring(infoBuf); return true; } else { return false; } #else // too lazy to find the unicode version for linux and mac std::string astrPath; if (!GetHomeDirectory(astrPath)) return false; path = std::wstring( astrPath.begin(), astrPath.end()); return true; #endif } bool GetTempDirectory(std::string& path) { #ifdef DETECTED_OS_WINDOWS DWORD result = ::GetTempPathA(0, ""); if(result == 0) return false; std::vector tempPath(result + 1); result = ::GetTempPathA(static_cast(tempPath.size()), &tempPath[0]); if((result == 0) || (result >= tempPath.size())) return false; path = std::string( tempPath.begin(), tempPath.begin() + static_cast(result) ); return true; #else char * pointer; pointer = tmpnam(NULL); path = GetPath(std::string( pointer )); return true; #endif } bool GetTempDirectory(std::wstring& path) { #ifdef DETECTED_OS_WINDOWS DWORD result = ::GetTempPathW(0, L""); if(result == 0) return false; std::vector tempPath(result + 1); result = ::GetTempPathW(static_cast(tempPath.size()), &tempPath[0]); if((result == 0) || (result >= tempPath.size())) return false; path = std::wstring( tempPath.begin(), tempPath.begin() + static_cast(result) ); return true; #else // too lazy to find the unicode version for linux and mac std::string astrPath; if (!GetTempDirectory(astrPath)) return false; path = std::wstring( astrPath.begin(), astrPath.end()); return true; #endif } #ifdef _WIN32 bool GetFilenameDialog(const string& lpstrTitle, const CHAR* lpstrFilter, string &filename, const bool save, HWND owner, DWORD* nFilterIndex) { BOOL result; OPENFILENAMEA ofn; ZeroMemory(&ofn,sizeof(OPENFILENAMEA)); static CHAR szFile[MAX_PATH]; char szDir[MAX_PATH]; if (filename.length()>0) { errno_t err=strcpy_s(szDir,MAX_PATH,filename.c_str()); filename.clear(); if (err) return false; } else szDir[0]=0; ofn.lpstrInitialDir = szDir; szFile[0] = 0; //====== Dialog parameters ofn.lStructSize = sizeof(OPENFILENAMEA); ofn.lpstrFilter = lpstrFilter; ofn.nFilterIndex = 1; ofn.lpstrFile = szFile; ofn.nMaxFile = sizeof(szFile); ofn.lpstrTitle = lpstrTitle.c_str(); ofn.nMaxFileTitle = sizeof (lpstrTitle.c_str()); ofn.hwndOwner = owner; if (save) { ofn.Flags = OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_EXPLORER | OFN_OVERWRITEPROMPT; result = GetSaveFileNameA(&ofn); } else { ofn.Flags = OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_EXPLORER | OFN_FILEMUSTEXIST; result = GetOpenFileNameA(&ofn); } if (result) { filename = szFile; if (nFilterIndex != NULL) *nFilterIndex = ofn.nFilterIndex; return true; } else { filename = ""; return false; } } bool GetFilenameDialog(const wstring& lpstrTitle, const WCHAR* lpstrFilter, wstring &filename, const bool save, HWND owner, DWORD* nFilterIndex) { BOOL result; OPENFILENAMEW ofn; ZeroMemory(&ofn,sizeof(OPENFILENAMEW)); static WCHAR szFile[MAX_PATH]; szFile[0] = 0; WCHAR szDir[MAX_PATH]; if (filename.length()>0) { errno_t err=wcscpy_s(szDir,MAX_PATH,filename.c_str()); filename.clear(); if (err) return false; } else szDir[0]=0; ofn.lpstrInitialDir = szDir; //====== Dialog parameters ofn.lStructSize = sizeof(OPENFILENAMEW); ofn.lpstrFilter = lpstrFilter; ofn.nFilterIndex = 1; ofn.lpstrFile = szFile; ofn.nMaxFile = sizeof(szFile); ofn.lpstrTitle = lpstrTitle.c_str(); ofn.nMaxFileTitle = sizeof (lpstrTitle.c_str()); ofn.hwndOwner = owner; if (save) { ofn.Flags = OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_EXPLORER | OFN_OVERWRITEPROMPT; result = GetSaveFileNameW(&ofn); } else { ofn.Flags = OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_EXPLORER | OFN_FILEMUSTEXIST; result = GetOpenFileNameW(&ofn); } if (result) { filename = szFile; if (nFilterIndex != NULL) *nFilterIndex = ofn.nFilterIndex; return true; } else { filename = L""; return false; } } CmdLineParams::CmdLineParams() { int argc; LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc); wstring wTmp = SysTools::GetFilename(argv[0]); string Tmp; m_strFilename = string(wTmp.begin(),wTmp.end()); for(int a=1 ; a typedef wchar_t WCHAR; typedef unsigned char CHAR; #endif /// True if the given string is an argument to an "-option" static bool is_argument(const char *str) { // Right now, this means the string doesn't start with "-", or "-" is the // entire string. return strcmp(str, "-") == 0 || str[0] != '-'; } CmdLineParams::CmdLineParams(int argc, char** argv) { m_strFilename = SysTools::GetFilename(argv[0]); for(int a=1 ; a #include "Mesh.h" #include "KDTree.h" using namespace tuvok; Mesh::Mesh() : m_KDTree(0), m_DefColor(1,1,1,1), m_MeshDesc("Generic Triangle Mesh"), m_meshType(MT_TRIANGLES) { m_VerticesPerPoly = (m_meshType == Mesh::MT_TRIANGLES) ? 3 : 2; } Mesh::Mesh(const BasicMeshData& bmd, bool bBuildKDTree, bool bScaleToUnitCube, const std::string& desc, EMeshType meshType) : m_KDTree(0), m_Data(bmd), m_DefColor(1,1,1,1), m_MeshDesc(desc), m_meshType(meshType) { m_VerticesPerPoly = (m_meshType == Mesh::MT_TRIANGLES) ? 3 : 2; ComputeAABB(); if (bScaleToUnitCube) ScaleToUnitCube(); if (bBuildKDTree) m_KDTree = new KDTree(this); } Mesh::Mesh(const VertVec& vertices, const NormVec& normals, const TexCoordVec& texcoords, const ColorVec& colors, const IndexVec& vIndices, const IndexVec& nIndices, const IndexVec& tIndices, const IndexVec& cIndices, bool bBuildKDTree, bool bScaleToUnitCube, const std::string& desc, EMeshType meshType) : m_KDTree(0), m_Data(vertices,normals,texcoords,colors,vIndices,nIndices,tIndices,cIndices), m_DefColor(1,1,1,1), m_MeshDesc(desc), m_meshType(meshType) { m_VerticesPerPoly = (m_meshType == Mesh::MT_TRIANGLES) ? 3 : 2; ComputeAABB(); if (bScaleToUnitCube) ScaleToUnitCube(); if (bBuildKDTree) m_KDTree = new KDTree(this); } void Mesh::ComputeAABB() { if (m_Data.m_vertices.empty()) return; m_Bounds[0] = m_Data.m_vertices[0]; m_Bounds[1] = m_Data.m_vertices[0]; for (VertVec::iterator i = m_Data.m_vertices.begin()+1;ix < m_Bounds[0].x) m_Bounds[0].x = i->x; if (i->x > m_Bounds[1].x) m_Bounds[1].x = i->x; if (i->y < m_Bounds[0].y) m_Bounds[0].y = i->y; if (i->y > m_Bounds[1].y) m_Bounds[1].y = i->y; if (i->z < m_Bounds[0].z) m_Bounds[0].z = i->z; if (i->z > m_Bounds[1].z) m_Bounds[1].z = i->z; } } void Mesh::ComputeUnitCubeScale(FLOATVECTOR3& scale, FLOATVECTOR3& translation) { if (m_Data.m_vertices.empty()) { translation = FLOATVECTOR3(0,0,0); scale = FLOATVECTOR3(1,1,1); return; } FLOATVECTOR3 maxExtensionV = (m_Bounds[1]-m_Bounds[0]); float maxExtension = (maxExtensionV.x > maxExtensionV.y) ? ((maxExtensionV.x > maxExtensionV.z) ? maxExtensionV.x : maxExtensionV.z) : ((maxExtensionV.y > maxExtensionV.z) ? maxExtensionV.y : maxExtensionV.z); scale = 1.0f/maxExtension; translation = - (m_Bounds[1]+m_Bounds[0])/(2*maxExtension); } void Mesh::Transform(const FLOATMATRIX4& m) { for (VertVec::iterator i = m_Data.m_vertices.begin();im_Data.m_vertices; m_Data.m_normals = other->m_Data.m_normals; m_Data.m_texcoords = other->m_Data.m_texcoords; m_Data.m_colors = other->m_Data.m_colors; m_Data.m_VertIndices = other->m_Data.m_VertIndices; m_Data.m_NormalIndices = other->m_Data.m_NormalIndices; m_Data.m_TCIndices = other->m_Data.m_TCIndices; m_Data.m_COLIndices = other->m_Data.m_COLIndices; m_DefColor = other->m_DefColor; m_MeshDesc = other->m_MeshDesc; m_meshType = other->m_meshType; m_VerticesPerPoly = other->m_VerticesPerPoly; m_TransformFromOriginal = other->m_TransformFromOriginal; GeometryHasChanged(true, true); } void Mesh::ScaleAndBias(const FLOATVECTOR3& scale, const FLOATVECTOR3& translation) { for (VertVec::iterator i = m_Data.m_vertices.begin();i 0) m_Data.m_normals[i] = m_Data.m_normals[i] / l;; } m_Data.m_NormalIndices = m_Data.m_VertIndices; } bool Mesh::UnifyIndices() { if (m_Data.m_NormalIndices.empty() && m_Data.m_TCIndices.empty() && m_Data.m_COLIndices.empty()) return true; if (!Validate()) return false; if (HasUniformIndices()) return true; VertVec vertices(m_Data.m_vertices); NormVec normals(m_Data.m_normals); TexCoordVec texcoords(m_Data.m_texcoords); ColorVec colors(m_Data.m_colors); // compute an inverse lookup index, i.e. for each // vertex, store what indices point to it std::vector> inverseIndex(m_Data.m_vertices.size()); for (size_t i = 0;i 1 && inverseIndex[index][0] == i)) { if (!m_Data.m_NormalIndices.empty()) normals[index] = m_Data.m_normals[m_Data.m_NormalIndices[i]]; if (!m_Data.m_TCIndices.empty()) texcoords[index] = m_Data.m_texcoords[m_Data.m_TCIndices[i]]; if (!m_Data.m_COLIndices.empty()) colors[index] = m_Data.m_colors[m_Data.m_COLIndices[i]]; continue; } // more complicated case of a multiply used point if (inverseIndex[index].size() > 1) { if ((!m_Data.m_NormalIndices.empty() && m_Data.m_normals[m_Data.m_NormalIndices[i]] != m_Data.m_normals[m_Data.m_NormalIndices[inverseIndex[index][0]]]) || (!m_Data.m_TCIndices.empty() && m_Data.m_texcoords[m_Data.m_TCIndices[i]] != m_Data.m_texcoords[m_Data.m_TCIndices[inverseIndex[index][0]]]) || (!m_Data.m_COLIndices.empty() && m_Data.m_colors[m_Data.m_COLIndices[i]] != m_Data.m_colors[m_Data.m_COLIndices[inverseIndex[index][0]]])) { m_Data.m_VertIndices[i] = uint32_t(vertices.size()); vertices.push_back(m_Data.m_vertices[index]); if (!m_Data.m_NormalIndices.empty()) normals.push_back( m_Data.m_normals[m_Data.m_NormalIndices[i]]); if (!m_Data.m_TCIndices.empty()) texcoords.push_back(m_Data.m_texcoords[m_Data.m_TCIndices[i]]); if (!m_Data.m_COLIndices.empty()) colors.push_back(m_Data.m_colors[m_Data.m_COLIndices[i]]); } else { if (!m_Data.m_NormalIndices.empty()) normals[index] = m_Data.m_normals[m_Data.m_NormalIndices[inverseIndex[index][0]]]; if (!m_Data.m_TCIndices.empty()) texcoords[index] = m_Data.m_texcoords[m_Data.m_TCIndices[inverseIndex[index][0]]]; if (!m_Data.m_COLIndices.empty()) colors[index] = m_Data.m_colors[m_Data.m_COLIndices[inverseIndex[index][0]]]; } } } m_Data.m_vertices = vertices; m_Data.m_normals = normals; m_Data.m_texcoords = texcoords; m_Data.m_colors =colors; m_Data.m_NormalIndices = m_Data.m_TCIndices = m_Data.m_COLIndices = m_Data.m_VertIndices; return true; } std::vector Mesh::PartitionMesh(size_t iMaxIndexCount, bool bOptimize) const { const Mesh* source; if (HasUniformIndices()) { source = this; } else { Mesh* unifiedIndexMesh = new Mesh(); unifiedIndexMesh->Clone(this); unifiedIndexMesh->UnifyIndices(); source = unifiedIndexMesh; } // march over all vertices and hash them into the sub-meshes // based on their index modulo iMaxIndex, those primitives that // have indices that spawn over multiple of those sub-meshes // are stored in an boundary list std::vector boundaryList; std::vector basicMeshVec( size_t( ceil(source->m_Data.m_vertices.size() / double(iMaxIndexCount)) ) ); size_t iLastBinsize = source->m_Data.m_vertices.size()%iMaxIndexCount; for (size_t i = 0;im_Data.m_NormalIndices.empty()) basicMeshVec[i].m_normals.resize(iBinsize); if (!source->m_Data.m_TCIndices.empty()) basicMeshVec[i].m_texcoords.resize(iBinsize); if (!source->m_Data.m_COLIndices.empty()) basicMeshVec[i].m_colors.resize(iBinsize); } for (size_t i = 0;im_Data.m_VertIndices.size();i+=m_VerticesPerPoly) { bool bConsistentBin = true; size_t iTargetBin = source->m_Data.m_VertIndices[i] / iMaxIndexCount; for (size_t j = 1;jm_Data.m_VertIndices[i+j] / iMaxIndexCount != iTargetBin) { bConsistentBin = false; break; } } if (!bConsistentBin) { boundaryList.push_back(i); continue; } size_t iIndexTransform = iMaxIndexCount*iTargetBin; for (size_t j = 0;jm_Data.m_VertIndices[i+j] - iIndexTransform); basicMeshVec[iTargetBin].m_VertIndices.push_back( iNewIndex ); basicMeshVec[iTargetBin].m_vertices[iNewIndex] = source->m_Data.m_vertices[source->m_Data.m_VertIndices[i+j]]; if (!source->m_Data.m_NormalIndices.empty()) { basicMeshVec[iTargetBin].m_NormalIndices.push_back( iNewIndex ); basicMeshVec[iTargetBin].m_normals[iNewIndex] = source->m_Data.m_normals[source->m_Data.m_VertIndices[i+j]]; } if (!source->m_Data.m_TCIndices.empty()) { basicMeshVec[iTargetBin].m_TCIndices.push_back( iNewIndex ); basicMeshVec[iTargetBin].m_texcoords[iNewIndex] = source->m_Data.m_texcoords[source->m_Data.m_VertIndices[i+j]]; } if (!source->m_Data.m_COLIndices.empty()) { basicMeshVec[iTargetBin].m_COLIndices.push_back( iNewIndex ); basicMeshVec[iTargetBin].m_colors[iNewIndex] = source->m_Data.m_colors[source->m_Data.m_VertIndices[i+j]]; } } } if (bOptimize) { // remove unused items for (size_t i = 0;i iMaxIndexCount) { ++iTargetBin; if (iTargetBin >= basicMeshVec.size()) { basicMeshVec.push_back(BasicMeshData()); break; } } for (size_t j = 0;jm_Data.m_vertices[source->m_Data.m_VertIndices[sourceIndex]]); if (!source->m_Data.m_NormalIndices.empty()) { basicMeshVec[iTargetBin].m_NormalIndices.push_back( iNewIndex ); basicMeshVec[iTargetBin].m_normals.push_back(source->m_Data.m_normals[source->m_Data.m_VertIndices[sourceIndex]]); } if (!source->m_Data.m_TCIndices.empty()) { basicMeshVec[iTargetBin].m_TCIndices.push_back( iNewIndex ); basicMeshVec[iTargetBin].m_texcoords.push_back(source->m_Data.m_texcoords[source->m_Data.m_VertIndices[sourceIndex]]); } if (!source->m_Data.m_COLIndices.empty()) { basicMeshVec[iTargetBin].m_COLIndices.push_back( iNewIndex ); basicMeshVec[iTargetBin].m_colors.push_back(source->m_Data.m_colors[source->m_Data.m_VertIndices[sourceIndex]]); } } } if (bOptimize) { // TODO: remove duplicate vertices } // cleanup and convert BasicMeshData back to "full featured" mesh if (source != this) delete source; std::vector meshVec(basicMeshVec.size()); for (size_t i = 0;i= count) return false; } count = m_Data.m_normals.size(); for (IndexVec::iterator i = m_Data.m_NormalIndices.begin(); i != m_Data.m_NormalIndices.end(); i++) { if ((*i) >= count) return false; } count = m_Data.m_texcoords.size(); for (IndexVec::iterator i = m_Data.m_TCIndices.begin(); i != m_Data.m_TCIndices.end(); i++) { if ((*i) >= count) return false; } count = m_Data.m_colors.size(); for (IndexVec::iterator i = m_Data.m_COLIndices.begin(); i != m_Data.m_COLIndices.end(); i++) { if ((*i) >= count) return false; } return true; } double Mesh::IntersectInternal(const Ray& ray, FLOATVECTOR3& normal, FLOATVECTOR2& tc, FLOATVECTOR4& color, double tmin, double tmax) const { if (m_meshType != MT_TRIANGLES) return noIntersection; if (m_KDTree) { return m_KDTree->Intersect(ray, normal, tc, color, tmin, tmax); } else { double t = noIntersection; FLOATVECTOR3 _normal; FLOATVECTOR2 _tc; FLOATVECTOR4 _color; for (size_t i = 0;i::max(); FLOATVECTOR3 vert0 = m_Data.m_vertices[m_Data.m_VertIndices[i]]; FLOATVECTOR3 vert1 = m_Data.m_vertices[m_Data.m_VertIndices[i+1]]; FLOATVECTOR3 vert2 = m_Data.m_vertices[m_Data.m_VertIndices[i+2]]; // find vectors for two edges sharing vert0 DOUBLEVECTOR3 edge1 = DOUBLEVECTOR3(vert1 - vert0); DOUBLEVECTOR3 edge2 = DOUBLEVECTOR3(vert2 - vert0); // begin calculating determinant - also used to calculate U parameter DOUBLEVECTOR3 pvec = ray.direction % edge2; // if determinant is near zero, ray lies in plane of triangle double det = edge1 ^ pvec; if (det > -0.00000001 && det < 0.00000001) return t; double inv_det = 1.0 / det; // calculate distance from vert0 to ray origin DOUBLEVECTOR3 tvec = ray.start - DOUBLEVECTOR3(vert0); // calculate U parameter and test bounds double u = tvec ^pvec * inv_det; if (u < 0.0 || u > 1.0) return t; // prepare to test V parameter DOUBLEVECTOR3 qvec = tvec % edge1; // calculate V parameter and test bounds double v = (ray.direction ^ qvec) * inv_det; if (v < 0.0 || u + v > 1.0) return t; // calculate t, ray intersects triangle t = (edge2 ^ qvec) * inv_det; if (t<0) return std::numeric_limits::max(); // interpolate normal if (m_Data.m_NormalIndices.size()) { FLOATVECTOR3 normal0 = m_Data.m_normals[m_Data.m_NormalIndices[i]]; FLOATVECTOR3 normal1 = m_Data.m_normals[m_Data.m_NormalIndices[i+1]]; FLOATVECTOR3 normal2 = m_Data.m_normals[m_Data.m_NormalIndices[i+1]]; FLOATVECTOR3 du = normal1 - normal0; FLOATVECTOR3 dv = normal2 - normal0; normal = normal0 + du * float(u) + dv * float(v); } else { // compute face normal if no normals are given normal = FLOATVECTOR3(edge1 % edge2); } normal.normalize(); if ((FLOATVECTOR3(ray.direction) ^ normal) > 0) normal = normal *-1; // interpolate texture coordinates if (m_Data.m_TCIndices.size()) { FLOATVECTOR2 tc0 = m_Data.m_texcoords[m_Data.m_TCIndices[i]]; FLOATVECTOR2 tc1 = m_Data.m_texcoords[m_Data.m_TCIndices[i+1]]; FLOATVECTOR2 tc2 = m_Data.m_texcoords[m_Data.m_TCIndices[i+2]]; double dtu1 = tc1.x - tc0.x; double dtu2 = tc2.x - tc0.x; double dtv1 = tc1.y - tc0.y; double dtv2 = tc2.y - tc0.y; tc.x = float(tc0.x + u * dtu1 + v * dtu2); tc.y = float(tc0.y + u * dtv1 + v * dtv2); } else { tc.x = 0; tc.y = 0; } // interpolate color if (m_Data.m_COLIndices.size()) { FLOATVECTOR4 col0 = m_Data.m_colors[m_Data.m_TCIndices[i]]; FLOATVECTOR4 col1 = m_Data.m_colors[m_Data.m_TCIndices[i+1]]; FLOATVECTOR4 col2 = m_Data.m_colors[m_Data.m_TCIndices[i+2]]; double dtu1 = col1.x - col0.x; double dtu2 = col2.x - col0.x; double dtv1 = col1.y - col0.y; double dtv2 = col2.y - col0.y; color.x = float(col0.x + u * dtu1 + v * dtu2); color.y = float(col0.y + u * dtv1 + v * dtv2); } else { color.x = 0; color.y = 0; } return t; } void Mesh::ComputeKDTree() { delete m_KDTree; m_KDTree = new KDTree(this); } const KDTree* Mesh::GetKDTree() const { return m_KDTree; } bool Mesh::AABBIntersect(const Ray& r, double& tmin, double& tmax) const { double tymin, tymax, tzmin, tzmax; DOUBLEVECTOR3 inv_direction(1.0/r.direction.x, 1.0/r.direction.y, 1.0/r.direction.z); int sign[3] = {inv_direction.x < 0, inv_direction.y < 0, inv_direction.z < 0}; tmin = (m_Bounds[sign[0]].x - r.start.x) * inv_direction.x; tmax = (m_Bounds[1-sign[0]].x - r.start.x) * inv_direction.x; tymin = (m_Bounds[sign[1]].y - r.start.y) * inv_direction.y; tymax = (m_Bounds[1-sign[1]].y - r.start.y) * inv_direction.y; if ( (tmin > tymax) || (tymin > tmax) ) return false; if (tymin > tmin) tmin = tymin; if (tymax < tmax) tmax = tymax; tzmin = (m_Bounds[sign[2]].z - r.start.z) * inv_direction.z; tzmax = (m_Bounds[1-sign[2]].z - r.start.z) * inv_direction.z; if ( (tmin > tzmax) || (tzmin > tmax) ) return false; if (tzmin > tmin) tmin = tzmin; if (tzmax < tmax) tmax = tzmax; return tmax > 0; } void BasicMeshData::RemoveUnusedVertices() { RemoveUnusedEntries(m_VertIndices, m_vertices); if (!m_NormalIndices.empty()) RemoveUnusedEntries(m_NormalIndices, m_normals); if (!m_TCIndices.empty()) RemoveUnusedEntries(m_TCIndices, m_texcoords); if (!m_COLIndices.empty()) RemoveUnusedEntries(m_COLIndices, m_colors); } ImageVis3D-3.1.0/Tuvok/Basics/DynamicDX.cpp0000644000175000017500000000710112320456500020114 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DynamicDX.cpp \author Jens Krueger SCI Institute University of Utah \date January 2009 */ #if defined(_WIN32) && defined(USE_DIRECTX) #include "DynamicDX.h" #include #include using namespace std; DynamicDX::LPCREATEDXGIFACTORY DynamicDX::CreateDXGIFactory = NULL; DynamicDX::LPD3D10CREATEDEVICE DynamicDX::D3D10CreateDevice = NULL; DynamicDX::LPD3DX10CREATEEFFECTFROMFILEW DynamicDX::D3DX10CreateEffectFromFileW = NULL; DynamicDX::LPD3DX10CREATEEFFECTFROMFILEA DynamicDX::D3DX10CreateEffectFromFileA = NULL; int DynamicDX::m_iD3DX10Version = 0; bool DynamicDX::m_bDynamicDXIsInitialized = false; HINSTANCE DynamicDX::m_hD3D10 = NULL; HINSTANCE DynamicDX::m_hDXGI = NULL; HINSTANCE DynamicDX::m_hD3DX10 = NULL; bool DynamicDX::InitializeDX() { if (m_bDynamicDXIsInitialized) return true; m_hD3D10 = LoadLibrary( L"d3d10.dll" ); m_hDXGI = LoadLibrary( L"dxgi.dll" ); #ifdef _DEBUG wstring wstrD3DX10DLL_prefix = L"d3dx10d_"; #else wstring wstrD3DX10DLL_prefix = L"d3dx10_"; #endif // try a few different D3DX10 DLLs for (int i = 42; i>=33; i--) { wstringstream wstrD3DX10DLL; wstrD3DX10DLL << wstrD3DX10DLL_prefix << i << ".dll"; m_iD3DX10Version = i; m_hD3DX10 = LoadLibrary( wstrD3DX10DLL.str().c_str() ); if (m_hD3DX10) break; } if( !m_hD3D10 || !m_hDXGI || !m_hD3DX10 ) return false; // DXGI calls CreateDXGIFactory = ( LPCREATEDXGIFACTORY )GetProcAddress( m_hDXGI, "CreateDXGIFactory" ); if (!CreateDXGIFactory) return false; // D3D10 calls D3D10CreateDevice = ( LPD3D10CREATEDEVICE )GetProcAddress( m_hD3D10, "D3D10CreateDevice" ); if (!D3D10CreateDevice) return false; // D3DX10 calls D3DX10CreateEffectFromFileW = ( LPD3DX10CREATEEFFECTFROMFILEW )GetProcAddress( m_hD3DX10, "D3DX10CreateEffectFromFileW" ); if (!D3DX10CreateEffectFromFileW) return false; D3DX10CreateEffectFromFileA = ( LPD3DX10CREATEEFFECTFROMFILEA )GetProcAddress( m_hD3DX10, "D3DX10CreateEffectFromFileA" ); if (!D3DX10CreateEffectFromFileA) return false; m_bDynamicDXIsInitialized = true; return true; } void DynamicDX::CleanupDX( ) { if (m_bDynamicDXIsInitialized) return; FreeLibrary( m_hD3D10 ); FreeLibrary( m_hDXGI ); FreeLibrary( m_hD3DX10 ); } #endif // _WIN32 && USE_DIRECTX ImageVis3D-3.1.0/Tuvok/Basics/LargeFileC.cpp0000644000175000017500000001332512320456500020236 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "StdDefines.h" #include #include #include #include #if _POSIX_C_SOURCE >= 200112L # include #endif #ifdef _MSC_VER # include #endif #ifndef NDEBUG # include # define DEBUG(...) do { std::cerr << __VA_ARGS__ << "\n"; } while(0) #else # define DEBUG(...) do { /* nothing, debug msg removed. */ } while(0) #endif #if defined(DETECTED_OS_APPLE) || defined(DETECTED_OS_LINUX) # include #endif #include "LargeFileC.h" LargeFileC::LargeFileC(const std::string fn, std::ios_base::openmode mode, uint64_t header_size, uint64_t /* length */) : LargeFile(fn, mode, header_size), fp(NULL) { this->open(mode); } LargeFileC::LargeFileC(const std::wstring fn, std::ios_base::openmode mode, uint64_t header_size, uint64_t /* length */) : LargeFile(fn, mode, header_size), fp(NULL) { this->open(mode); } LargeFileC::~LargeFileC() { if(this->is_open()) { this->close(); } } int seeko(FILE* strm, uint64_t off, int whence) { #if _POSIX_C_SOURCE >= 200112L if(fseeko(strm, off, whence) < 0) { #else if(fseek(strm, static_cast(off), whence) < 0) { #endif DEBUG("seek failed, errno=" << errno); return -1; } return 0; } std::shared_ptr LargeFileC::rd(uint64_t offset, size_t len) { if(!this->is_open()) { throw std::ios_base::failure("file is not open!"); } if(seeko(this->fp, offset+this->header_size, SEEK_SET) < 0) { throw std::ios_base::failure("could not seek to correct file position"); } std::shared_ptr data(new char[len], nonstd::DeleteArray()); size_t nitems = fread(data.get(), 1, len, this->fp); this->bytes_read = nitems; // we need to cast it to a 'const void' to return it... std::shared_ptr mem = std::static_pointer_cast(data); return mem; } void LargeFileC::wr(const std::shared_ptr& data, uint64_t offset, size_t len) { if(!this->is_open()) { throw std::ios_base::failure("file is not open!"); } if(seeko(this->fp, offset+this->header_size, SEEK_SET) < 0) { throw std::ios_base::failure("seek failed!"); } if(fwrite(data.get(), len, 1, this->fp) <= 0) { std::ios_base::failure("write failed."); } } void LargeFileC::enqueue(uint64_t, size_t) { /* unimplemented... */ } static uint64_t offs(FILE* fp) { #if _POSIX_C_SOURCE >= 200112L return static_cast(ftello(fp)); #else return static_cast(ftell(fp)); #endif } uint64_t LargeFileC::filesize() const { if(!this->is_open()) { throw std::ios_base::failure("file is not open"); } const uint64_t current = offs(this->fp); // save so we can reset seeko(this->fp, 0, SEEK_END); uint64_t end = offs(this->fp); seeko(this->fp, 0, SEEK_SET); uint64_t begin = offs(this->fp); seeko(this->fp, current, SEEK_SET); // reset file pointer return end - begin; } bool LargeFileC::is_open() const { return this->fp != NULL; } void LargeFileC::close() { if(!LargeFileC::is_open()) { return; } if(fclose(this->fp) != 0) { assert(errno != EBADF); if(errno == EBADF) { throw std::invalid_argument("invalid file descriptor"); } throw std::runtime_error("I/O error, writes might not have flushed!"); } this->fp = NULL; } void LargeFileC::open(std::ios_base::openmode mode) { if(this->is_open()) { this->close(); } const char* omode = NULL; if((mode & std::ios::out) && (mode & std::ios::trunc)) { omode = "w+b"; } else if(mode & std::ios::out) { omode = "r+b"; } else { omode = "rb"; } this->fp = fopen(this->m_filename.c_str(), omode); if(this->fp == NULL) { throw std::ios_base::failure("Could not open file."); } } int filenumber(FILE* strm) { #ifdef _MSC_VER return _fileno(strm); #else return fileno(strm); #endif } int lftruncate(int fd, uint64_t length) { #ifdef _MSC_VER return _chsize(fd, length); #else return ftruncate(fd, length); #endif } void LargeFileC::truncate(uint64_t len) { if(!this->is_open()) { this->open(std::ios::out); } int fno = filenumber(this->fp); if(lftruncate(fno, len) != 0) { DEBUG("truncate to len=" << len << " failed, errno=" << errno); throw std::ios::failure("truncate failed"); } // move the offset down if it's beyond EOF. this->byte_offset = std::min(this->byte_offset, len); } ImageVis3D-3.1.0/Tuvok/Basics/Timer.h0000644000175000017500000000350012320456500017020 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Timer.cpp \author Jens Krueger SCI Institute University of Utah \date September 2009 */ #pragma once #ifndef TIMER_H #define TIMER_H #include "StdDefines.h" #ifndef DETECTED_OS_WINDOWS #include #else #include #endif /** \class Timer */ class Timer { public: Timer(); void Start(); double Elapsed() const; // returns milliseconds static double Now(); private: #ifndef DETECTED_OS_WINDOWS timeval m_timeStart; #else double m_fTicksPerMSecond; LARGE_INTEGER m_timeStart; #endif }; #endif // TIMER_H ImageVis3D-3.1.0/Tuvok/Basics/basics.pro0000644000175000017500000000301312320456500017554 0ustar mathieumathieuTEMPLATE = lib win32:TEMPLATE = vclib CONFIG = create_prl exceptions largefile static staticlib stl CONFIG += warn_on TARGET = tuvokbasics win32 { DESTDIR = Build } OBJECTS_DIR = Build/objects d = 3rdParty/boost 3rdParty/tclap . ../ DEPENDPATH = $$d INCLUDEPATH = $$d win32:LIBS += shlwapi.lib unix:QMAKE_CXXFLAGS += -fno-strict-aliasing unix:QMAKE_CFLAGS += -fno-strict-aliasing macx:QMAKE_CXXFLAGS += -stdlib=libc++ -mmacosx-version-min=10.7 macx:QMAKE_CFLAGS += -mmacosx-version-min=10.7 macx:LIBS += -stdlib=libc++ -framework CoreFoundation -mmacosx-version-min=10.7 # Input SOURCES += \ ./Appendix.cpp \ ./ArcBall.cpp \ ./Checksums/MD5.cpp \ ./DynamicDX.cpp \ ./GeometryGenerator.cpp \ ./KDTree.cpp \ ./LargeRAWFile.cpp \ ./MathTools.cpp \ ./MC.cpp \ ./MemMappedFile.cpp \ ./Mesh.cpp \ ./Plane.cpp \ ./SystemInfo.cpp \ ./Systeminfo/VidMemViaDDraw.cpp \ ./Systeminfo/VidMemViaDXGI.cpp \ ./SysTools.cpp \ ./Timer.cpp \ ./ProgressTimer.cpp \ ./Clipper.cpp HEADERS += \ ./Appendix.h \ ./ArcBall.h \ ./Checksums/crc32.h \ ./Checksums/MD5.h \ ./Console.h \ ./DynamicDX.h \ ./EndianConvert.h \ ./GeometryGenerator.h \ ./Grids.h \ ./KDTree.h \ ./LargeRAWFile.h \ ./MathTools.h \ ./MC.h \ ./MemMappedFile.h \ ./Mesh.h \ ./Plane.h \ ./Ray.h \ ./StdDefines.h \ ./SystemInfo.h \ ./SysTools.h \ ./Timer.h \ ./ProgressTimer.h \ ./Clipper.h \ ./tr1.h \ ./TuvokException.h \ ./Vectors.h ImageVis3D-3.1.0/Tuvok/Basics/SysTools.h0000644000175000017500000002461312320456500017547 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file SysTools.h \brief Simple routines for filename handling \author Jens Krueger SCI Institute University of Utah \date Dec 2008 */ #pragma once #ifndef SYSTOOLS_H #define SYSTOOLS_H #include #include #include #ifdef _WIN32 #include #ifdef max #undef max #endif #ifdef min #undef min #endif #define LARGE_STAT_BUFFER struct __stat64 #else #include #include typedef wchar_t WCHAR; typedef unsigned char CHAR; #define LARGE_STAT_BUFFER struct stat #endif #include "StdDefines.h" class AbstrDebugOut; namespace SysTools { template std::string ToString(const T& aValue) { std::stringstream ss; ss << aValue; return ss.str(); } template std::wstring ToWString(const T& aValue) { std::wstringstream ss; ss << aValue; return ss.str(); } template bool FromString(T& t, const std::string& s, std::ios_base& (*f)(std::ios_base&) = std::dec) { std::istringstream iss(s); return !(iss >> f >> t).fail(); } template bool FromString(T& t, const std::wstring& s, std::ios_base& (*f)(std::ios_base&) = std::dec) { std::wistringstream iss(s); return !(iss >> f >> t).fail(); } template T FromString(const std::string& s, std::ios_base& (*f)(std::ios_base&) = std::dec) { T t; std::istringstream iss(s); iss >> f >> t; return t; } template T FromString(const std::wstring& s, std::ios_base& (*f)(std::ios_base&) = std::dec) { T t; std::wistringstream iss(s); iss >> f >> t; return t; } std::wstring ToLowerCase(const std::wstring& str); std::string ToLowerCase(const std::string& str); std::wstring ToUpperCase(const std::wstring& str); std::string ToUpperCase(const std::string& str); enum EProtectMode { PM_NONE = 0, PM_QUOTES, PM_BRACKETS, PM_CUSTOM_DELIMITER }; std::vector Tokenize(const std::string& strInput, EProtectMode mode = PM_QUOTES, char customOrOpeningDelimiter='{', char closingDelimiter='}'); std::vector Tokenize(const std::wstring& strInput, EProtectMode mode = PM_QUOTES, wchar_t customOrOpeningDelimiter=L'{', wchar_t closingDelimiter=L'{'); std::string GetFromResourceOnMac(const std::string& fileName); std::wstring GetFromResourceOnMac(const std::wstring& fileName); bool FileExists(const std::string& fileName); bool FileExists(const std::wstring& fileName); std::string GetExt(const std::string& fileName); std::wstring GetExt(const std::wstring& fileName); std::string GetPath(const std::string& fileName); std::wstring GetPath(const std::wstring& fileName); std::string GetFilename(const std::string& fileName); std::wstring GetFilename(const std::wstring& fileName); std::string basename(const std::string& f); std::string dirname(const std::string& f); std::string CanonicalizePath(const std::string& path); std::string FindPath(const std::string& fileName, const std::string& path); std::wstring FindPath(const std::wstring& fileName, const std::wstring& path); std::string RemoveExt(const std::string& fileName); std::wstring RemoveExt(const std::wstring& fileName); std::string CheckExt(const std::string& fileName, const std::string& newext); std::wstring CheckExt(const std::wstring& fileName, const std::wstring& newext); std::string ChangeExt(const std::string& fileName, const std::string& newext); std::wstring ChangeExt(const std::wstring& fileName, const std::wstring& newext); std::string AppendFilename(const std::string& fileName, const int iTag); std::wstring AppendFilename(const std::wstring& fileName, const int iTag); std::string AppendFilename(const std::string& fileName, const std::string& tag); std::wstring AppendFilename(const std::wstring& fileName, const std::wstring& tag); std::string FindNextSequenceName(const std::string& strFilename); std::wstring FindNextSequenceName(const std::wstring& wStrFilename); std::string FindNextSequenceName(const std::string& fileName, const std::string& ext, const std::string& dir=""); std::wstring FindNextSequenceName(const std::wstring& fileName, const std::wstring& ext, const std::wstring& dir=L""); uint32_t FindNextSequenceIndex(const std::string& fileName, const std::string& ext, const std::string& dir=""); uint32_t FindNextSequenceIndex(const std::wstring& fileName, const std::wstring& ext, const std::wstring& dir=L""); bool GetHomeDirectory(std::string& path); bool GetHomeDirectory(std::wstring& path); bool GetTempDirectory(std::string& path); bool GetTempDirectory(std::wstring& path); #ifdef _WIN32 std::vector GetDirContents(const std::wstring& dir, const std::wstring& fileName=L"*", const std::wstring& ext=L"*"); std::vector GetDirContents(const std::string& dir, const std::string& fileName="*", const std::string& ext="*"); #else std::vector GetDirContents(const std::wstring& dir, const std::wstring& fileName=L"*", const std::wstring& ext=L""); std::vector GetDirContents(const std::string& dir, const std::string& fileName="*", const std::string& ext=""); #endif std::vector GetSubDirList(const std::wstring& dir); std::vector GetSubDirList(const std::string& dir); bool GetFileStats(const std::string& strFileName, LARGE_STAT_BUFFER& stat_buf); bool GetFileStats(const std::wstring& wstrFileName, LARGE_STAT_BUFFER& stat_buf); std::wstring TrimStrLeft(const std::wstring &str, const std::wstring& c = L" \r\n\t"); std::string TrimStrLeft(const std::string &str, const std::string& c = " \r\n\t"); std::wstring TrimStrRight(const std::wstring &str, const std::wstring& c = L" \r\n\t"); std::string TrimStrRight(const std::string &str, const std::string& c = " \r\n\t"); std::wstring TrimStr(const std::wstring &str, const std::wstring& c = L" \r\n\t"); std::string TrimStr(const std::string &str, const std::string& c = " \r\n\t"); void ReplaceAll(std::string& input, const std::string& search, const std::string& replace); void ReplaceAll(std::wstring& input, const std::wstring& search, const std::wstring& replace); #ifdef _WIN32 bool GetFilenameDialog(const std::string& lpstrTitle, const CHAR* lpstrFilter, std::string &filename, const bool save, HWND owner=NULL, DWORD* nFilterIndex=NULL); bool GetFilenameDialog(const std::wstring& lpstrTitle, const WCHAR* lpstrFilter, std::wstring &filename, const bool save, HWND owner=NULL, DWORD* nFilterIndex=NULL); #endif class CmdLineParams { public: #ifdef _WIN32 CmdLineParams(); #endif CmdLineParams(int argc, char** argv); bool SwitchSet(const std::string& parameter); bool SwitchSet(const std::wstring& parameter); bool GetValue(const std::string& parameter, double& value); bool GetValue(const std::wstring& parameter, double& value); bool GetValue(const std::string& parameter, float& value); bool GetValue(const std::wstring& parameter, float& value); bool GetValue(const std::string& parameter, int& value); bool GetValue(const std::wstring& parameter, int& value); bool GetValue(const std::string& parameter, unsigned int& value); bool GetValue(const std::wstring& parameter, unsigned int& value); bool GetValue(const std::string& parameter, std::string& value); bool GetValue(const std::wstring& parameter, std::wstring& value); protected: std::vector m_strArrayParameters; std::vector m_strArrayValues; std::string m_strFilename; }; } #endif // SYSTOOLS_H ImageVis3D-3.1.0/Tuvok/Basics/MemMappedFile.cpp0000644000175000017500000002411112320456500020741 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file MemMappedFile.cpp \author Jens Krueger SCI Institute University of Utah \version 1.2 \date July 2008 */ #include "MemMappedFile.h" using namespace std; #include #include #include #include #include #include #include #ifdef _WIN32 #include #else #include #include #endif MemMappedFile::MemMappedFile(const string strFilename, const MMFILE_ACCESS eAccesMode, const uint64_t& iLengthForNewFile, const uint64_t& iOffset, const uint64_t& iBytesToMap) : m_strFilename(strFilename), m_eAccesMode(eAccesMode), m_iLengthForNewFile(iLengthForNewFile), m_AllocationGranularity(0), #ifdef WIN32 m_hMem(NULL), m_dwDesiredAccessMap(0) #else m_fdes(0), m_dwMmmapMode(0) #endif { ComputeAllocationGranularity(); m_bIsOpen = OpenFile(m_strFilename.c_str(), m_eAccesMode, m_iLengthForNewFile, iOffset, iBytesToMap) == 0; } MemMappedFile::MemMappedFile(const wstring strFilename, const MMFILE_ACCESS eAccesMode, const uint64_t& iLengthForNewFile, const uint64_t& iOffset, const uint64_t& iBytesToMap): m_strFilename(strFilename.begin(), strFilename.end()), m_eAccesMode(eAccesMode), m_iLengthForNewFile(iLengthForNewFile), m_AllocationGranularity(0), #ifdef WIN32 m_hMem(NULL), m_dwDesiredAccessMap(0) #else m_fdes(0), m_dwMmmapMode(0) #endif { ComputeAllocationGranularity(); string st(strFilename.begin(),strFilename.end()); m_bIsOpen = OpenFile(st.c_str(), m_eAccesMode, m_iLengthForNewFile, iOffset, iBytesToMap) == 0; } MemMappedFile::~MemMappedFile(void) { Close(); } void MemMappedFile::Flush() { #ifdef WIN32 if (m_pData) FlushViewOfFile(m_pData, 0); #else if (m_pData) msync(m_pData, m_dwFileMappingSize, MS_SYNC); #endif } void MemMappedFile::Close() { if (m_bIsOpen) { #ifdef _WIN32 CloseHandle(m_hMem); if (m_pData) UnmapViewOfFile(m_pData); #else close(m_fdes); if (m_pData) munmap(m_pData, m_dwFileMappingSize); #endif m_bIsOpen = false; m_pData = NULL; } } void MemMappedFile::Erase() { Close(); remove(m_strFilename.c_str()); } void* MemMappedFile::ReOpen(const uint64_t& iOffset, const uint64_t& iBytesToMap) { if (m_bIsOpen) Close(); m_bIsOpen = OpenFile(m_strFilename.c_str(), m_eAccesMode, m_iLengthForNewFile, iOffset, iBytesToMap) == 0; return m_pData; } void* MemMappedFile::ReMap(const uint64_t& iOffset, const uint64_t& iBytesToMap) { if (!m_bIsOpen) return ReOpen(iOffset, iBytesToMap); uint64_t iPosAdjustment = (iOffset % uint64_t(m_AllocationGranularity)); #ifdef _WIN32 if (m_pData) UnmapViewOfFile(m_pData); DWORD dwHigh = DWORD((((iOffset-iPosAdjustment) >> 32) & 0xFFFFFFFF)); DWORD dwLow = DWORD(((iOffset-iPosAdjustment) & 0xFFFFFFFF)); m_pData = MapViewOfFile(m_hMem, m_dwDesiredAccessMap, dwHigh, dwLow, (iBytesToMap == 0) ? 0 : (size_t)(iBytesToMap+iPosAdjustment)); if (m_pData == NULL) { #else if (m_pData) munmap(m_pData, m_dwFileMappingSize); m_pData = mmap(NULL, ((iBytesToMap == 0) ? (m_dwFileSize-iOffset) : iBytesToMap)+iPosAdjustment, m_dwMmmapMode, MAP_SHARED, m_fdes, iOffset-iPosAdjustment); if (m_pData == (void *)-1) { #endif m_dwFileMappingSize = 0; return NULL; } m_pData = (char*)m_pData + iPosAdjustment; m_dwFileMappingSize = (iBytesToMap != 0) ? iBytesToMap : m_dwFileSize; return m_pData; } int MemMappedFile::OpenFile(const char* strPath, const MMFILE_ACCESS eAccesMode, const uint64_t& iLengthForNewFile, const uint64_t& iOffset, const uint64_t& iBytesToMap) { bool bExists = true, bGrowFile = false; char buffer[4096]; int res; uint64_t iPosAdjustment = (iOffset % m_AllocationGranularity); #ifdef _WIN32 struct _stati64 stat_buf; HANDLE hFile; DWORD sz; // check if file already exists and determine its length res = _stat64(strPath, &stat_buf); if (res < 0) { if (errno == ENOENT) bExists = false; else return -1; } if (bExists) if (uint64_t(stat_buf.st_size)>=iLengthForNewFile) m_dwFileSize = stat_buf.st_size; else { m_dwFileSize = iLengthForNewFile; bGrowFile = true; } else { if (iLengthForNewFile == 0) { return -1; } else { m_dwFileSize = iLengthForNewFile; } } DWORD dwDesiredAccess = (!bExists || eAccesMode == MMFILE_ACCESS_READWRITE) ? GENERIC_READ | GENERIC_WRITE : GENERIC_READ; DWORD dwShareMode = (!bExists || eAccesMode == MMFILE_ACCESS_READWRITE) ? FILE_SHARE_READ | FILE_SHARE_WRITE : FILE_SHARE_READ; DWORD flProtect = (!bExists || eAccesMode == MMFILE_ACCESS_READWRITE) ? PAGE_READWRITE : PAGE_READONLY; m_dwDesiredAccessMap = (!bExists || eAccesMode == MMFILE_ACCESS_READWRITE) ? FILE_MAP_ALL_ACCESS : FILE_MAP_READ; // create security descriptor (needed for Windows NT) PSECURITY_DESCRIPTOR pSD = (PSECURITY_DESCRIPTOR) malloc(SECURITY_DESCRIPTOR_MIN_LENGTH); if(pSD == NULL) return -2; InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION); SetSecurityDescriptorDacl(pSD, TRUE, (PACL) NULL, FALSE); SECURITY_ATTRIBUTES sa; sa.nLength = sizeof(sa); sa.lpSecurityDescriptor = pSD; sa.bInheritHandle = TRUE; // create or open file hFile = CreateFileA (strPath, dwDesiredAccess, dwShareMode, &sa, bExists ? OPEN_EXISTING : OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { free(pSD); return -3; } if (! bExists || bGrowFile) { uint64_t dwWriteSize; if (bGrowFile) { SetFilePointer(hFile, 0, NULL, FILE_END); dwWriteSize = m_dwFileSize - stat_buf.st_size; } else { dwWriteSize = m_dwFileSize; } // ensure that file is long enough and filled with zero memset(buffer, 0, sizeof(buffer)); for (uint64_t i = 0; i < dwWriteSize/sizeof(buffer); ++i) { if (! WriteFile(hFile, buffer, sizeof(buffer), &sz, NULL)) { return -3; } } if (! WriteFile(hFile, buffer, static_cast(dwWriteSize%sizeof(buffer)), &sz, NULL)) { return -3; } } // create file mapping m_hMem = CreateFileMappingA(hFile, &sa, flProtect, static_cast((m_dwFileSize & 0xFFFFFFFF00000000) >> 32), static_cast(m_dwFileSize & 0xFFFFFFFF), NULL); free(pSD); if (NULL == m_hMem) return -3; DWORD dwHigh = DWORD((((iOffset-iPosAdjustment) >> 32) & 0xFFFFFFFF)); DWORD dwLow = DWORD(((iOffset-iPosAdjustment) & 0xFFFFFFFF)); // map the file to memory m_pData = MapViewOfFile(m_hMem, m_dwDesiredAccessMap, dwHigh, dwLow, (iBytesToMap == 0) ? 0 : (size_t)(iBytesToMap+iPosAdjustment)); CloseHandle(hFile); if (NULL == m_pData) { CloseHandle(m_hMem); return -3; } #else struct stat stat_buf; // check if file already exists and determine its length res = stat(strPath, &stat_buf); if (res < 0) { if (errno == ENOENT) bExists = false; else return -1; } if (bExists) { if (uint64_t(stat_buf.st_size)>iLengthForNewFile) m_dwFileSize = stat_buf.st_size; else { m_dwFileSize = iLengthForNewFile; bGrowFile = true; } } else { if (iLengthForNewFile == 0) return -1; else m_dwFileSize = iLengthForNewFile; } int dwDesiredAccess = (!bExists || eAccesMode == MMFILE_ACCESS_READWRITE) ? O_RDWR : O_RDONLY; int dwShareMode = (!bExists || eAccesMode == MMFILE_ACCESS_READWRITE) ? S_IRUSR | S_IWUSR : S_IRUSR; m_dwMmmapMode = (!bExists || eAccesMode == MMFILE_ACCESS_READWRITE) ? PROT_READ | PROT_WRITE : PROT_READ; // open / create mapped file m_fdes = open(strPath, (bExists) ? dwDesiredAccess : dwDesiredAccess | O_CREAT, dwShareMode); if (m_fdes < -1) return -1; // ensure that file is long enough and filled with zero if (! bExists || bGrowFile) { uint64_t dwWriteSize; if (bGrowFile) { lseek(m_fdes, 0, SEEK_END); dwWriteSize = m_dwFileSize - stat_buf.st_size; } else dwWriteSize = m_dwFileSize; memset(buffer, 0, sizeof(buffer)); for (size_t i = 0; i < dwWriteSize/sizeof(buffer); ++i) { if (write(m_fdes, buffer, sizeof(buffer)) != sizeof(buffer)) { return -1; } } if ((size_t)(write(m_fdes, buffer, dwWriteSize%sizeof(buffer))) != dwWriteSize%sizeof(buffer)) { return -1; } } // map the file to memory m_pData = mmap(NULL, ((iBytesToMap == 0) ? (m_dwFileSize-iOffset) : iBytesToMap)+iPosAdjustment, m_dwMmmapMode, MAP_SHARED, m_fdes, iOffset-iPosAdjustment); if (m_pData == (void *)-1) return -1; #endif m_pData = (char*)m_pData + iPosAdjustment; m_dwFileMappingSize = (iBytesToMap != 0) ? iBytesToMap : m_dwFileSize; return 0; } void MemMappedFile::ComputeAllocationGranularity() { #ifdef _WIN32 SYSTEM_INFO siSysInfo; GetSystemInfo(&siSysInfo); m_AllocationGranularity = siSysInfo.dwAllocationGranularity; #else m_AllocationGranularity = sysconf(_SC_PAGE_SIZE); #endif } ImageVis3D-3.1.0/Tuvok/doc/0000755000175000017500000000000012320456500015132 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/doc/genlua/0000755000175000017500000000000012320456500016405 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/doc/genlua/main.cpp0000644000175000017500000001223412320456500020037 0ustar mathieumathieu/// Simple program to generate documention for the Lua functions registered in /// Tuvok. Basically just grabs a list of all those functions and outputs it /// in asciidoc(1) format. Usage: /// /// ./a.out -o output.adoc /// /// and then run a2x on the generated 'output.adoc' file. /// /// This also generates individual .adoc files for *every* registered Lua /// command. These can be run with the 'manpage' document type to generate man /// pages for the functions. #include #include #include #include #include #include #include #include "Controller/Controller.h" #include "LuaScripting/LuaScripting.h" using namespace tuvok; std::string trim(std::string s) { const std::string ws(" \n\t"); size_t end = s.find_last_not_of(ws); size_t begin = s.find_first_not_of(ws); return s.substr(begin, end-begin+1); } std::vector split(const std::string& s, const char delim) { std::istringstream ss(s); std::vector rv; while(!ss.eof()) { std::string elem; std::getline(ss, elem, delim); rv.push_back(trim(elem)); } return rv; } void makeman(std::ostream& man, const LuaScripting::FunctionDesc& f) { man << "Tuvok API(1)\n" "============\n" ":doctype: manpage\n\n" "NAME\n" "----\n" << f.funcName << " - " << f.funcDesc << "\n\n" << "SYNOPSIS\n" << "--------\n" << "*" << f.funcFQName << "*('"; std::vector args = split(f.paramSig, ','); std::copy(args.begin(), args.end()-1, std::ostream_iterator(man, "', '")); man << args[args.size()-1] << "')\n\n" << "DESCRIPTION\n" << "-----------\n" << "The '" << f.funcName << "' function ...\n"; } void makemanbook(std::ostream& man, const LuaScripting::FunctionDesc& f) { man << f.funcFQName << "\n"; for(size_t i=0; i < f.funcFQName.length(); ++i) { man << "-"; } man << "\n"; man << "[float]\n" << "NAME\n" << "~~~~\n" << f.funcName << " - " << f.funcDesc << "\n\n" << "[float]\n" << "SYNOPSIS\n" << "~~~~~~~~\n" << "*" << f.funcFQName << "*('"; std::vector args = split(f.paramSig, ','); std::copy(args.begin(), args.end()-1, std::ostream_iterator(man, "', '")); man << args[args.size()-1] << "')\n\n" << "[float]\n" << "DESCRIPTION\n" << "~~~~~~~~~~~\n" << "The '" << f.funcName << "' function ...\n"; } void gendoc(std::ostream& ofs) { const std::shared_ptr ss = Controller::Instance().LuaScript(); std::vector fd = ss->getAllFuncDescs(); ofs << "// a2x: --dblatex-opts \"-P latex.output.revhistory=0\"\n" << "The Tuvok Blue Book\n" << "===================\n" << "The ImageVis3D Development Team\n\n"; std::sort(fd.begin(), fd.end(), [](const LuaScripting::FunctionDesc& f1, const LuaScripting::FunctionDesc& f2) { return strcasecmp(f1.funcFQName.c_str(), f2.funcFQName.c_str()) < 0; }); for(auto f = fd.begin(); f != fd.end(); ++f) { std::ofstream manpage((f->funcName + ".adoc").c_str(), std::ios::trunc); makeman(manpage, *f); manpage.close(); makemanbook(ofs, *f); ofs << "\n\n<<<<<<<\n\n"; // generates a hard page break. } } int main(int argc, char* argv[]) { std::string fn; try { TCLAP::CmdLine cmd("lua 'blue book' generator"); TCLAP::ValueArg output("o", "output", "output file", true, "", "filename"); cmd.add(output); cmd.parse(argc, argv); fn = output.getValue(); } catch(const TCLAP::ArgException& e) { std::cerr << "error: " << e.error() << " for arg " << e.argId() << "\n"; return EXIT_FAILURE; } std::ofstream ofile(fn, std::ios::trunc); gendoc(ofile); // do the work. return EXIT_SUCCESS; } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2013 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/doc/genlua/genlua.pro0000644000175000017500000000164512320456500020410 0ustar mathieumathieuTEMPLATE = app win32:TEMPLATE = vcapp CONFIG = exceptions largefile qt rtti static stl warn_on QT += core opengl TARGET = bluebook DEPENDPATH = . INCLUDEPATH = ../../ INCLUDEPATH += ../../Basics/3rdParty INCLUDEPATH += ../../IO/3rdParty/boost/ QMAKE_LIBDIR += ../../Build QMAKE_LIBDIR += ../../IO/expressions LIBS = -lTuvok -ltuvokexpr unix:LIBS += -lz win32:LIBS += shlwapi.lib macx:LIBS += -stdlib=libc++ macx:LIBS += -mmacosx-version-min=10.7 macx:LIBS += -framework CoreFoundation unix:!macx:LIBS += -lGLU -lGL # don't complain about not understanding OpenMP pragmas. QMAKE_CXXFLAGS += -Wno-unknown-pragmas macx:QMAKE_CXXFLAGS += -stdlib=libc++ macx:QMAKE_CXXFLAGS += -mmacosx-version-min=10.7 unix:QMAKE_CXXFLAGS += -std=c++0x unix:QMAKE_CXXFLAGS += -fno-strict-aliasing unix:QMAKE_CFLAGS += -fno-strict-aliasing !macx:unix:QMAKE_LFLAGS += -fopenmp SOURCES = \ main.cpp ImageVis3D-3.1.0/Tuvok/LuaScripting/0000755000175000017500000000000012320456500016771 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/LuaScripting/LuaStackRAII.cpp0000644000175000017500000001064112320456500021653 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief Implements RAII for the Lua stack. For internal LuaScripting uses only. Requires an unshared pointer to LuaScripting, and is only meant to exist for the lifetime of one block. */ #ifdef TUVOK_LUARAII_ASSERT # include #endif #include #include "LuaScripting.h" #include "LuaStackRAII.h" using namespace std; //#define TUVOK_LUARAII_ASSERT namespace tuvok { //----------------------------------------------------------------------------- LuaStackRAII::LuaStackRAII(lua_State* L, int valsConsumed, int valsReturned) { mL = L; mInitialStackTop = lua_gettop(mL); mValsConsumed = valsConsumed; mValsReturned = valsReturned; if (valsConsumed < 0) throw LuaError("LuaStackRAII valsConsumed must be >= 0."); if (valsReturned < 0) throw LuaError("LuaStackRAII valsReturned must be >= 0."); } //----------------------------------------------------------------------------- static void luaStackRAIIInternalDoString(lua_State* mL, std::string str) { luaL_dostring(mL, str.c_str()); } //----------------------------------------------------------------------------- LuaStackRAII::~LuaStackRAII() { int stackTop = lua_gettop(mL); int stackTarget = mInitialStackTop - mValsConsumed + mValsReturned; if (stackTop != stackTarget) { lua_getfield(mL, LUA_REGISTRYINDEX, LuaScripting::REG_EXPECTED_EXCEPTION_FLAG); bool expected = lua_toboolean(mL, -1) ? true : false; lua_pop(mL, 1); // Pull value out of the Lua register to see if this is really an // error, or an expected event (in the case of unit testing this would // likely be an expected exception) if (expected == false) { // Take advantage of the fact that this class will be used in conjunction // with LuaScripting. ostringstream os; os << "log.warn([==[LuaStackRAII: unexpected stack size. Expected: " << stackTarget << ". Actual: " << stackTop << ".\n"; // To ensure we don't wipe out Lua error messages (generally, these will // be caught by lua_atpanic). if (lua_isstring(mL, -1)) { std::string str = lua_tostring(mL, -1); os << " String on the top of the stack: " << str; } os << "]==])\n" << "log.warn(\"This probably means we're cleaning up after a thrown " "exception.\")\n"; //luaL_dostring(mL, os.str().c_str()); luaStackRAIIInternalDoString(mL, os.str()); #ifdef TUVOK_LUARAII_ASSERT assert(stackTop == stackTarget); #endif } // Ensure stack ends up at the stack target (RAII) if (mValsReturned == 0) { // Simply set the top to the stack target. lua_settop(mL, stackTarget); } else { // NOTE: In this case, we can't just set the top to stack target. // Doing that will wipe out any potential return values. // Calculate absolute position removal index. int curTop = lua_gettop(mL); // Keep removing values from the stack until we get to the stack target. while (curTop > stackTarget) { lua_remove(mL, lua_gettop(mL) - mValsReturned); curTop = lua_gettop(mL); } } } } } ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaClassRegistration.h0000644000175000017500000002026112320456500023245 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief Class made to be composited inside of a Lua class instance. All class instance function registrations must happen through this class. */ #ifndef TUVOK_LUACLASSREGISTRATION_H_ #define TUVOK_LUACLASSREGISTRATION_H_ #include "LuaMemberRegUnsafe.h" namespace tuvok { class LuaClassConstructor; template class LuaClassRegistration { friend class LuaClassConstructor; // The only class that can instantiate us. public: ~LuaClassRegistration() {} bool canRegister() const {return (mPtr != NULL);} /// Registers a member function. Same parameters as /// LuaScripting::registerFunction but with the unqualifiedName parameter. /// unqualifiedName is the name of the function to register without the class /// name appended to it. /// \return The fully qualified name for this function. Useful for applying /// option parameters and defaults. template std::string function(FunPtr f, const std::string& unqualifiedName, const std::string& desc, bool undoRedo); /// Same as 'function' but allows you to register functions that are attached /// to classes other than the one that has been instantiated by the Lua /// system. Use this function with care, as a dangling pointer will be left /// if the other class is deleted. template std::string functionProxy(CLS* otherClass, FunPtr f, const std::string& unqualifiedName, const std::string& desc, bool undoRedo); std::string getFQName() const {return getLuaInstance().fqName();} LuaClassInstance getLuaInstance() const {return LuaClassInstance(mGlobalID);} /// Inherits a function from another class instance. /// Use this if you have complete control over the other class instance /// and you know the inherited function won't be called when the other class /// has been deleted. void inherit(LuaClassInstance inst, const std::string& function); /// Makes this class instance inherit ALL methods from the given class. /// Use this function sparingly. A strong reference to the given instance will /// be generated. /// TODO: Detect inherited classes and make them weak references. void inherit(LuaClassInstance from); /// Clears out any registered proxy functions. Generally, when constructing a /// proxy class, you would use this function when you switch pointers /// internally. void clearProxyFunctions(); private: // Feel free to copy the class. LuaClassRegistration(LuaScripting* ss, T* t, int globalID) : mSS(ss) , mGlobalID(globalID) , mPtr(t) , mRegistration(ss) {} LuaScripting* mSS; int mGlobalID; T* mPtr; LuaMemberRegUnsafe mRegistration; std::vector mProxyFunctions; }; template template std::string LuaClassRegistration::function(FunPtr f, const std::string& unqualifiedName, const std::string& desc, bool undoRedo) { if (canRegister() == false) throw LuaError("Check canRegister before registering functions! This " "error indicates that you have a Lua class that was not created using " "the scripting system."); LuaClassInstance inst(mGlobalID); std::ostringstream qualifiedName; qualifiedName << inst.fqName() << "." << unqualifiedName; // Function pointer f is guaranteed to be a member function pointer. mRegistration.registerFunction(mPtr, f, qualifiedName.str(), desc, undoRedo); return qualifiedName.str(); } template template std::string LuaClassRegistration::functionProxy( CLS* otherClass, FunPtr f, const std::string& unqualifiedName, const std::string& desc, bool undoRedo) { if (canRegister() == false) throw LuaError("Check canRegister before registering functions! This " "error indicates that you have a Lua class that was not created using " "the scripting system."); LuaClassInstance inst(mGlobalID); std::ostringstream qualifiedName; qualifiedName << inst.fqName() << "." << unqualifiedName; // Function pointer f is guaranteed to be a member function pointer. mRegistration.registerFunction(otherClass, f, qualifiedName.str(), desc, undoRedo); // Add this function to the proxy function list. This list can be used to // wipe out existing proxy functions. mProxyFunctions.push_back(unqualifiedName); return qualifiedName.str(); } template void LuaClassRegistration::inherit(LuaClassInstance them) { LuaScripting* ss(mSS); lua_State* L = ss->getLuaState(); LuaStackRAII _a(L, 0, 0); // Generate our own LuaClassInstance. LuaClassInstance us(mGlobalID); // Obtain the metatable for 'us'. if (ss->getFunctionTable(us.fqName()) == false) throw LuaError("Invalid 'us' function table."); int ourTable = lua_gettop(L); if (ss->getFunctionTable(them.fqName()) == false) throw LuaError("Invalid 'them' function table."); int theirTable = lua_gettop(L); if (lua_getmetatable(L, ourTable) == 0) throw LuaError("Unable to find metatable for our class!"); // Set the index metamethod. lua_pushvalue(L, theirTable); lua_setfield(L, -2, "__index"); lua_pop(L, 1); // pop off the metatable. lua_pop(L, 2); } template void LuaClassRegistration::inherit(LuaClassInstance them, const std::string& function) { LuaScripting* ss(mSS); lua_State* L = ss->getLuaState(); LuaStackRAII _a(L, 0, 0); // Generate our own LuaClassInstance. LuaClassInstance us(mGlobalID); // Obtain the metatable for 'us'. if (ss->getFunctionTable(us.fqName()) == false) throw LuaError("Invalid 'us' function table."); int ourTable = lua_gettop(L); if (ss->getFunctionTable(them.fqName()) == false) throw LuaError("Invalid 'them' function table."); int theirTable = lua_gettop(L); if (lua_isnil(L, ourTable)) throw LuaNonExistantClassInstancePointer("Can't find destination table."); if (lua_isnil(L, theirTable)) throw LuaNonExistantClassInstancePointer("Can't find source table."); // Grab their function and place it in our class. lua_getfield(L, theirTable, function.c_str()); if (lua_isnil(L, -1)) throw LuaNonExistantFunction("No function found in source table."); lua_setfield(L, ourTable, function.c_str()); lua_pop(L, 2); } template void LuaClassRegistration::clearProxyFunctions() { LuaClassInstance inst(mGlobalID); for (std::vector::iterator it = mProxyFunctions.begin(); it != mProxyFunctions.end(); ++it) { std::ostringstream os; os << inst.fqName() << "." << *it; mSS->unregisterFunction(os.str()); } mProxyFunctions.clear(); } } /* namespace tuvok */ #endif /* LUACLASSREGISTRATION_H_ */ ImageVis3D-3.1.0/Tuvok/LuaScripting/regression/0000755000175000017500000000000012320456500021151 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/LuaScripting/regression/iv3d/0000755000175000017500000000000012320456500022016 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/LuaScripting/regression/iv3d/mathIndexMethods.lua0000644000175000017500000000173512320456500025774 0ustar mathieumathieu-- The following code tests mathematical methods exposed via the __index -- metamethod. header = 'Indexmethods test: ' ------------------------------------- -- Test matrix __index metamethods -- ------------------------------------- m1 = math.m4x4() m1[1] = math.v4(2.0, 0.0, 0.0, 0.0) m1[2] = math.v4(0.0, 4.0, 0.0, 0.0) m1[3] = math.v4(0.0, 0.0, 8.0, 0.0) m1[4] = math.v4(0.0, 0.0, 0.0, 16.0) -- Super simplified inversion test r = m1:inverse() if r[1][1] ~= 0.5 or r[2][2] ~= 0.25 or r[3][3] ~= 0.125 or r[4][4] ~= 0.0625 then error(header .. 'Failed 4x4 matrix inversion test.') end print('Passed matrix inversion test.') -- Transpose test m1[1] = math.v4(0.0, 0.0, 0.0, 4.0) m1[2] = math.v4(0.0, 0.0, 3.0, 0.0) m1[3] = math.v4(0.0, 2.0, 0.0, 0.0) m1[4] = math.v4(1.0, 0.0, 0.0, 0.0) r = m1:transpose() if r[4][1] ~= 4.0 or r[3][2] ~= 3.0 or r[2][3] ~= 2.0 or r[1][4] ~= 1.0 then error(header .. 'Failed 4x4 matrix transpose test.') end print('Passed matrix transpose test.') ImageVis3D-3.1.0/Tuvok/LuaScripting/regression/iv3d/renWinIDProvenance.lua0000644000175000017500000000614312320456500026225 0ustar mathieumathieu-- The following regression test expects regress_c60Dir to be a global -- variable that contains a valid path to the c60 dataset. -- This regression test is currently broken (provenance has been disabled) -- @todo Need a way of testing to see if the provenance system is enabled. -- Hack to terminate early if true then return end -- Available variables: -- regress_c60Dir -- Stress testing variable. Increase or decrease the amount as needed. local stress = 2 for i=1,stress do local r0 = iv3d.renderer.new(regress_c60Dir) deleteClass(r0) -- Test successive creation/deletion of a render window. local r1 = iv3d.renderer.new(regress_c60Dir) local r1id = getClassUNID(r1) print('r1id: ' .. r1id) local r1rawid = getClassUNID(r1.getRawRenderer()) print('r1rawid: ' .. r1rawid) deleteClass(r1) local r2 = iv3d.renderer.new(regress_c60Dir) local r2id = getClassUNID(r2) print('r2id: ' .. r2id) local r2rawid = getClassUNID(r2.getRawRenderer()) print('r2rawid: ' .. r2rawid) deleteClass(r2) provenance.undo() r2 = getClassWithUNID(r2id) -- By issuing the next call, we clear the redo we made with the prior undo. r2.setBGColors({1,0,0},{1,1,0}) -- Set annoying BG colors if r2id ~= getClassUNID(r2) then error('Id\'s not the same.') end provenance.undo() -- Undoes set background colors provenance.undo() -- Undoes creation of r2 provenance.undo() -- Undoes deletion of r1 r1 = getClassWithUNID(r1id) print('r1raw: ' .. getClassUNID(r1)) r1.setBGColors({0,1,0},{1,1,0}) if r1id ~= getClassUNID(r1) then error('Id\'s not the same.') end provenance.undo() -- Undoes set background colors provenance.undo() -- Undoes creation of r1 provenance.undo() -- Undo the deletion of the first renderer provenance.undo() -- Undo the creation of the first renderer provenance.redo() -- Redo the creation of the first renderer provenance.redo() -- Redo the deletion of the first renderer provenance.redo() -- Redo the creation of r1 provenance.redo() -- Redo setting the BG color (at the top of the stack) provenance.undo() -- Undo setting bg color provenance.undo() -- Undo creation of r1 provenance.undo() -- Undo deletion of first renderer provenance.undo() -- Undo creation of first renderer provenance.redo() -- Redo the creation of the first renderer provenance.redo() -- Redo the deletion of the first renderer provenance.redo() -- Redo the creation of r1 provenance.redo() -- Redo setting the BG color (at the top of the stack) -- Now actually delete the class so we don't have a stack of windows. -- We will have to mind undo/redoing this. deleteClass(getClassWithUNID(r1id)) end print('Attempting ' .. stress*5 .. ' undos.') -- Now we should be able to undo stress * 5 times for i=1,stress*5 do provenance.undo() end print('Attempting ' .. stress*5 .. ' redos.') -- And redo... for i=1,stress*5 do provenance.redo() end print('Attempting ' .. stress*5 .. ' undos.') -- And undo once more to place us where we were first located on the undo stack for i=1,stress*5 do provenance.undo() end ImageVis3D-3.1.0/Tuvok/LuaScripting/regression/iv3d/mathMetamethods.lua0000644000175000017500000001630012320456500025645 0ustar mathieumathieu-- The following code tests the mathematical metamethods that are supplied -- in Lua. header = 'Metamethods test: ' -- Test vector metamethods v1 = math.v4(1.0, 1.0, 1.0, 1.0) v2 = math.v4(0.0, 1.0, 2.0, 4.0) a = 10 b = 100 print('Contents of v1.') print('Using ipairs.') for i,v in ipairs(v1) do print(i .. ': ' .. v) end print('Using # length unary operator. Valid because we use integer indices.') for i=1,#v1 do print(i .. ': ' .. v1[i]) end print('Pretty printed vector:') helpStr(v1) print('Metatable:') for i,v in ipairs(getmetatable(v1)) do print(i .. ': ' .. v) end print('Contents of v2: ' .. helpStr(v2)) ----------------------------------------- -- Test scalar * vector multiplication -- ----------------------------------------- v = a * v1 if v[1] ~= 10.0 or v[2] ~= 10.0 or v[3] ~= 10.0 or v[4] ~= 10.0 then error(header .. 'Failed scalar/vector multiplication.') end print('Passed scalar multiplication: ' .. helpStr(v)) v = v1 * a if v[1] ~= 10.0 or v[2] ~= 10.0 or v[3] ~= 10.0 or v[4] ~= 10.0 then error(header .. 'Failed scalar/vector multiplication.') end print('Passed scalar multiplication: ' .. helpStr(v)) v = b * v2 if v[1] ~= 0.0 or v[2] ~= 100.0 or v[3] ~= 200.0 or v[4] ~= 400.0 then error(header .. 'Failed scalar/vector multiplication.') end print('Passed scalar multiplication: ' .. helpStr(v)) v = v2 * b if v[1] ~= 0.0 or v[2] ~= 100.0 or v[3] ~= 200.0 or v[4] ~= 400.0 then error(header .. 'Failed scalar/vector multiplication.') end print('Passed scalar multiplication: ' .. helpStr(v)) ----------------------------- -- Test vector dot product -- ----------------------------- r = v1 * v2 if r < 6.999 or r > 7.001 then error(header .. 'Failed vector dot product.') end print('Passed dot product: ' .. r) r = v2 * v1 if r < 6.999 or r > 7.001 then error(header .. 'Failed vector dot product.') end print('Passed dot product: ' .. r) -------------------------- -- Test vector addition -- -------------------------- v = v1 + v2 if v[1] ~= 1.0 or v[2] ~= 2.0 or v[3] ~= 3.0 or v[4] ~= 5.0 then error(header .. 'Failed vector addition.') end print('Passed vector addition: ' .. helpStr(v)) v = v2 + v1 if v[1] ~= 1.0 or v[2] ~= 2.0 or v[3] ~= 3.0 or v[4] ~= 5.0 then error(header .. 'Failed vector addition.') end print('Passed vector addition: ' .. helpStr(v)) ----------------------------- -- Test vector subtraction -- ----------------------------- vr = v1 - v2 if vr[1] ~= 1.0 or vr[2] ~= 0.0 or vr[3] ~= -1.0 or vr[4] ~= -3.0 then error(header .. 'Failed vector subtraction.') end print('Passed vector subtraction: ' .. helpStr(vr)) vr = v2 - v1 if vr[1] ~= -1.0 or vr[2] ~= 0.0 or vr[3] ~= 1.0 or vr[4] ~= 3.0 then error(header .. 'Failed vector subtraction.') end print('Passed vector subtraction: ' .. helpStr(vr)) --v1 = math.v4(1.0, 1.0, 1.0, 1.0) --v2 = math.v4(0.0, 1.0, 2.0, 4.0) ------------------------- -- Test unary negation -- ------------------------- vr = -v1 if vr[1] ~= -1.0 or vr[2] ~= -1.0 or vr[3] ~= -1.0 or vr[4] ~= -1.0 then error(header .. 'Failed unary negation.') end print('Passed unary negation: ' .. helpStr(vr)) vr = -v2 if vr[1] ~= 0.0 or vr[2] ~= -1.0 or vr[3] ~= -2.0 or vr[4] ~= -4.0 then error(header .. 'Failed unary negation.') end print('Passed unary negation: ' .. helpStr(vr)) -- Test matrix metamethods print ('Beginning matrix tests') m1 = math.m4x4() -- Constructs an identity matrix by default. vt = math.v4(1.0, 2.0, 3.0, 4.0) print('Contents of m1: ' .. helpStr(m1)) ----------------------------------------- -- Test Matrix * scalar multiplication -- ----------------------------------------- r = m1 * a if r[1][1] ~= 10.0 or r[2][2] ~= 10.0 or r[3][3] ~= 10.0 or r[4][4] ~= 10.0 then error(header .. 'Failed matrix scalar multiplication.') end -- Perform dot products against rows to verify... if r[1] * vt ~= 10.0 then error(header .. 'Failed matrix scalar multiplication; dot product 1.') end if r[2] * vt ~= 20.0 then error(header .. 'Failed matrix scalar multiplication; dot product 2.') end if r[3] * vt ~= 30.0 then error(header .. 'Failed matrix scalar multiplication; dot product 3.') end if r[4] * vt ~= 40.0 then error(header .. 'Failed matrix scalar multiplication; dot product 4.') end print('Passed scalar right multiplication') print('Contents of r: ' .. helpStr(r)) r = a * m1 -- Perform dot products against rows to verify... if r[1] * vt ~= 10.0 then error(header .. 'Failed matrix scalar multiplication; dot product 1.') end if r[2] * vt ~= 20.0 then error(header .. 'Failed matrix scalar multiplication; dot product 2.') end if r[3] * vt ~= 30.0 then error(header .. 'Failed matrix scalar multiplication; dot product 3.') end if r[4] * vt ~= 40.0 then error(header .. 'Failed matrix scalar multiplication; dot product 4.') end print('Passed scalar left multiplication') print('Contents of r: ' .. helpStr(r)) ----------------------------------------- -- Test Matrix * vector multiplication -- ----------------------------------------- r = 2 * m1 r = r * math.v4(1.0, 2.0, 3.0, 4.0) if r[1] ~= 2.0 or r[2] ~= 4.0 or r[3] ~= 6.0 or r[4] ~= 8.0 then error(header .. 'Failed matrix * vector multiplication') end print('Passed matrix * vector multiplication.') ----------------------------------------- -- Test matrix * matrix multiplication -- ----------------------------------------- m1 = math.m4x4(); m1[1] = math.v4(1.0, 2.0, 3.0, 4.0) m1[2] = math.v4(4.0, 3.0, 2.0, 1.0) m1[3] = math.v4(0.0, 1.0, -1.0, 0.0) m1[4] = math.v4(-20.0, 0.0, 3.0, 4.0) print('m1: ' .. helpStr(m1)) m2 = math.m4x4(); m2[1] = math.v4(1.0, 1.0, 1.0, 1.0) m2[2] = math.v4(-1.0, -1.0, 1.0, 1.0) m2[3] = math.v4(1.0, -1.0, 1.0, -1.0) m2[4] = math.v4(1.0, 1.0, -1.0, -1.0) print('m2: ' .. helpStr(m2)) r = m1 * m2 if r[1][1] ~= m1[1][1]*m2[1][1]+m1[1][2]*m2[2][1]+m1[1][3]*m2[3][1]+m1[1][4]*m2[4][1] or r[1][2] ~= m1[1][1]*m2[1][2]+m1[1][2]*m2[2][2]+m1[1][3]*m2[3][2]+m1[1][4]*m2[4][2] or r[1][3] ~= m1[1][1]*m2[1][3]+m1[1][2]*m2[2][3]+m1[1][3]*m2[3][3]+m1[1][4]*m2[4][3] or r[1][4] ~= m1[1][1]*m2[1][4]+m1[1][2]*m2[2][4]+m1[1][3]*m2[3][4]+m1[1][4]*m2[4][4] or r[2][1] ~= m1[2][1]*m2[1][1]+m1[2][2]*m2[2][1]+m1[2][3]*m2[3][1]+m1[2][4]*m2[4][1] or r[2][2] ~= m1[2][1]*m2[1][2]+m1[2][2]*m2[2][2]+m1[2][3]*m2[3][2]+m1[2][4]*m2[4][2] or r[2][3] ~= m1[2][1]*m2[1][3]+m1[2][2]*m2[2][3]+m1[2][3]*m2[3][3]+m1[2][4]*m2[4][3] or r[2][4] ~= m1[2][1]*m2[1][4]+m1[2][2]*m2[2][4]+m1[2][3]*m2[3][4]+m1[2][4]*m2[4][4] or r[3][1] ~= m1[3][1]*m2[1][1]+m1[3][2]*m2[2][1]+m1[3][3]*m2[3][1]+m1[3][4]*m2[4][1] or r[3][2] ~= m1[3][1]*m2[1][2]+m1[3][2]*m2[2][2]+m1[3][3]*m2[3][2]+m1[3][4]*m2[4][2] or r[3][3] ~= m1[3][1]*m2[1][3]+m1[3][2]*m2[2][3]+m1[3][3]*m2[3][3]+m1[3][4]*m2[4][3] or r[3][4] ~= m1[3][1]*m2[1][4]+m1[3][2]*m2[2][4]+m1[3][3]*m2[3][4]+m1[3][4]*m2[4][4] or r[4][1] ~= m1[4][1]*m2[1][1]+m1[4][2]*m2[2][1]+m1[4][3]*m2[3][1]+m1[4][4]*m2[4][1] or r[4][2] ~= m1[4][1]*m2[1][2]+m1[4][2]*m2[2][2]+m1[4][3]*m2[3][2]+m1[4][4]*m2[4][2] or r[4][3] ~= m1[4][1]*m2[1][3]+m1[4][2]*m2[2][3]+m1[4][3]*m2[3][3]+m1[4][4]*m2[4][3] or r[4][4] ~= m1[4][1]*m2[1][4]+m1[4][2]*m2[2][4]+m1[4][3]*m2[3][4]+m1[4][4]*m2[4][4] then error(header .. 'Failed matrix * matrix multiplication') end print('Passed matrix * matrix multiplication.') print('Result of multiplication: ' .. helpStr(r)) ImageVis3D-3.1.0/Tuvok/LuaScripting/regression/iv3d/datasets.lua0000644000175000017500000000004612320456500024331 0ustar mathieumathieu-- Tests dataset proxy functionality. ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaMemberRegUnsafe.cpp0000644000175000017500000001331312320456500023147 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief This mediator class handles member function registration. This class is used for internal purposes only, please use LuaMemberReg instead. Exists solely to provide member function registration to LuaScripting and its composited classes (without the need for a shared_ptr). If you do use this class instead of LuaMemberReg, be sure to call the unregisterAll function manually when your class is destroyed. It is your responsibility to ensure that the LuaScripting pointer remains valid throughout the lifetime of LuaMemberRegUnsafe. */ #include #include "LuaScripting.h" #include "LuaMemberRegUnsafe.h" using namespace std; namespace tuvok { //----------------------------------------------------------------------------- LuaMemberRegUnsafe::LuaMemberRegUnsafe(LuaScripting* scriptSys) : mScriptSystem(scriptSys) , mHookID(scriptSys->getNewMemberHookID()) { } //----------------------------------------------------------------------------- LuaMemberRegUnsafe::~LuaMemberRegUnsafe() { // We assume it is UNSAFE to do anything with the scriptSys variable here! // The majority of the time, this class will be subclassed by // LuaMemberReg, and LuaMemberReg may end up destroying the shared pointer to // LuaScripting. So we have no guarantees that the pointer to our // LuaScripting class is still valid. } //----------------------------------------------------------------------------- void LuaMemberRegUnsafe::unregisterAll() { // Unhook BEFORE unregister! unregisterHooks(); unregisterUndoRedoFunctions(); unregisterFunctions(); } //----------------------------------------------------------------------------- void LuaMemberRegUnsafe::unregisterFunctions() { // Loop through the registered functions and unregister them with the system. for (vector::iterator it = mRegisteredFunctions.begin(); it != mRegisteredFunctions.end(); ++it) { try { mScriptSystem->unregisterFunction(*it); } catch (LuaError&) { // If this happens, it means that someone else unregistered our // function. // Ignore it and move on. } } mRegisteredFunctions.clear(); } //----------------------------------------------------------------------------- void LuaMemberRegUnsafe::unregisterHooks() { lua_State* L = mScriptSystem->getLuaState(); LuaStackRAII _a = LuaStackRAII(L, 0, 0); // Loop through the hooks, and unregister them from their functions for (vector::iterator it = mHookedFunctions.begin(); it != mHookedFunctions.end(); ++it) { // Push the table associated with the function to the top. if (mScriptSystem->getFunctionTable(*it) == false) { // Ignore missing function table and move one (in this instance, it is // likely that the function was unregistered before we got the chance // to unregister our hook). continue; } // Obtain the hooked member function table. lua_getfield(L, -1, LuaScripting::TBL_MD_MEMBER_HOOKS); // Just set the member hook ID field to nil, don't check to see if its there // since we do not wan to throw an exception (likely called from // destructor). lua_pushnil(L); lua_setfield(L, -2, mHookID.c_str()); // Pop function table and hooks table off the stack. lua_pop(L, 2); } mHookedFunctions.clear(); } //----------------------------------------------------------------------------- void LuaMemberRegUnsafe::unregisterUndoRedoFunctions() { lua_State* L = mScriptSystem->getLuaState(); LuaStackRAII _a = LuaStackRAII(L, 0, 0); // Loop through the hooks, and unregister them from their functions for (vector::iterator it = mRegisteredUndoRedo.begin(); it != mRegisteredUndoRedo.end(); ++it) { // Push the table associated with the function to the top. if (mScriptSystem->getFunctionTable(it->functionName) == false) { // Ignore missing function table and move on. continue; } lua_pushnil(L); if (it->isUndo) { lua_setfield(L, -2, LuaScripting::TBL_MD_UNDO_FUNC); } else { lua_setfield(L, -2, LuaScripting::TBL_MD_REDO_FUNC); } // Pop function table off the stack. lua_pop(L, 1); } mRegisteredUndoRedo.clear(); } //============================================================================== // // UNIT TESTING // //============================================================================== // Unit testing for this class is in LuaMemberReg. } /* namespace tuvok */ ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaClassInstance.h0000644000175000017500000001101212320456500022331 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief Class used to identify class instances inside of Lua. Class proxies are easier to use than some management scheme to keep track of class instances internally. These class proxies also give us a chance to perform undo/redo appropriately for the lifetime of objects. */ #ifndef TUVOK_LUACLASSINSTANCE_H_ #define TUVOK_LUACLASSINSTANCE_H_ namespace tuvok { class LuaScripting; class LuaClassInstance { public: typedef int IDType; explicit LuaClassInstance(IDType instanceID); LuaClassInstance(); ~LuaClassInstance() {} /// Retrieves the fully qualified name to the class instance. /// You can use this fully qualified name to hook functions associated /// with the class (using LuaMemberReg), or perform other operations. std::string fqName() const; /// Looks up the class constructor. std::string getClassConstructor() const; /// Retrieves global instance ID IDType getGlobalInstID() const {return mInstanceID;} /// Returns true if this is the default instance of this class (no /// real data or functions). bool isDefaultInstance() const; bool isValid(std::shared_ptr ss) const; bool isValid(LuaScripting* ss) const; void invalidate(); // Invalidates this class instance. isValid will return // false and the instanceID will be lost. /// Data stored in the instance metatable. ///@{ static const char* MD_GLOBAL_INSTANCE_ID; ///< Instance ID static const char* MD_FACTORY_NAME; ///< Generational factory. static const char* MD_INSTANCE; ///< Instance pointer. static const char* MD_DEL_FUN; ///< Delete function. static const char* MD_DEL_CALLBACK_PTR; ///< Delete callback function. static const char* MD_NO_DELETE_HINT; ///< If true, delete will not be ///< called on the class. ///< Used when the constructor ///< notifies us of destruction. ///@} /// SYSTEM_TABLE really should be stored in LuaScripting. But do to its /// use in LuaFunBinding.h, it is stored here. static const char* SYSTEM_TABLE; ///< The LuaScripting system table static const char* CLASS_INSTANCE_TABLE; ///< The global class instance table static const char* CLASS_INSTANCE_PREFIX; ///< Prefix for class instances static const char* CLASS_LOOKUP_TABLE; ///< Global class lookup table. static const int DEFAULT_INSTANCE_ID = -1; /// Only use these two functions for testing. /// Please use LuaScripting::exec() instead. /// This pointer can die on you at any time. Undo/redo can invalidate /// this pointer. template T* getRawPointer(std::shared_ptr ss); template T* getRawPointer_NoSharedPtr(LuaScripting* ss); void* getVoidPointer(LuaScripting* ss); private: IDType mInstanceID; }; template T* LuaClassInstance::getRawPointer(std::shared_ptr ss) { return getRawPointer_NoSharedPtr(ss.get()); } template T* LuaClassInstance::getRawPointer_NoSharedPtr(LuaScripting* ss) { // TODO: Add RTTI return reinterpret_cast(getVoidPointer(ss)); } } /* namespace tuvok */ #endif ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaScripting.cpp0000644000175000017500000030667312320456500022120 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file LuaScripting.cpp \author James Hughes SCI Institute University of Utah \date Mar 21, 2012 \brief Interface to the Lua scripting system built for Tuvok. To see examples of how to use the system, consult the unit tests at the bottom of LuaMemberReg.cpp and LuaScripting.cpp. */ #include "StdTuvokDefines.h" #include #include #include #include // We are including this ourselves because we do not want dependencies // on Tuvok's SysTools. #ifndef DETECTED_OS_WINDOWS # include # include #else /// @todo Add directory management headers for windows. #endif #ifndef LUASCRIPTING_NO_TUVOK # include "Controller/Controller.h" #else # include # include #endif #include "LuaScripting.h" #include "LuaProvenance.h" using namespace std; #define QUALIFIED_NAME_DELIMITER "." // Disable "'this' used in base member initializer list warning" // this is not referenced in either of the initialized classes, // but is merely stored. #ifdef DETECTED_OS_WINDOWS #pragma warning( disable : 4355 ) #endif namespace tuvok { const char* LuaScripting::TBL_MD_DESC = "desc"; const char* LuaScripting::TBL_MD_SIG = "signature"; const char* LuaScripting::TBL_MD_SIG_NO_RET = "sigNoRet"; const char* LuaScripting::TBL_MD_SIG_NAME = "sigName"; const char* LuaScripting::TBL_MD_NUM_EXEC = "numExec"; const char* LuaScripting::TBL_MD_QNAME = "fqName"; const char* LuaScripting::TBL_MD_FUN_PDEFS = "tblDefaults"; const char* LuaScripting::TBL_MD_FUN_LAST_EXEC = "tblLastExec"; const char* LuaScripting::TBL_MD_HOOKS = "tblHooks"; const char* LuaScripting::TBL_MD_HOOK_INDEX = "hookIndex"; const char* LuaScripting::TBL_MD_MEMBER_HOOKS = "tblMHooks"; const char* LuaScripting::TBL_MD_CPP_CLASS = "scriptingCPP"; const char* LuaScripting::TBL_MD_STACK_EXEMPT = "stackExempt"; const char* LuaScripting::TBL_MD_PROV_EXEMPT = "provExempt"; const char* LuaScripting::TBL_MD_NUM_PARAMS = "numParams"; const char* LuaScripting::TBL_MD_UNDO_FUNC = "undoHook"; const char* LuaScripting::TBL_MD_REDO_FUNC = "redoHook"; const char* LuaScripting::TBL_MD_NULL_UNDO = "nullUndo"; const char* LuaScripting::TBL_MD_NULL_REDO = "nullRedo"; const char* LuaScripting::TBL_MD_PARAM_DESC = "tblParamDesc"; const char* LuaScripting::PARAM_DESC_NAME_SUFFIX = "n"; const char* LuaScripting::PARAM_DESC_INFO_SUFFIX = "i"; const char* LuaScripting::SYSTEM_NOP_COMMAND = "_sys_.nop"; // To avoid naming conflicts with other libraries, we prefix all of our // registry values with tuvok_ const char* LuaScripting::REG_EXPECTED_EXCEPTION_FLAG = "tuvok_exceptFlag"; #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS const char* LuaScripting::TBL_MD_TYPES_TABLE = "typesTable"; #endif //----------------------------------------------------------------------------- LuaScripting::LuaScripting() : mMemberHookIndex(0) , mGlobalInstanceID(0) , mGlobalTempInstRange(false) , mGlobalTempInstLow(0) , mGlobalTempInstHigh(0) , mGlobalTempCurrent(0) , mProvenance(new LuaProvenance(this)) , mMemberReg(new LuaMemberRegUnsafe(this)) , mClassCons(new LuaClassConstructor(this)) , mVerboseMode(false) { mL = lua_newstate(luaInternalAlloc, NULL); if (mL == NULL) throw LuaError("Failed to initialize Lua."); lua_atpanic(mL, &luaPanic); luaL_openlibs(mL); LuaStackRAII _a(mL, 0, 0); // First construct the system table (functions in registerScriptFunctions // may want to register themselves in _sys_). // Functions registered in _sys_ do not show up when performing help(), // but they must be manually deregistered. lua_newtable(mL); lua_setglobal(mL, LuaClassInstance::SYSTEM_TABLE); setExpectedExceptionFlag(false); registerScriptFunctions(); mProvenance->registerLuaProvenanceFunctions(); // Generate class lookup table. { ostringstream os; os << LuaClassInstance::CLASS_LOOKUP_TABLE << " = {}"; luaL_dostring(mL, os.str().c_str()); } } //----------------------------------------------------------------------------- LuaScripting::~LuaScripting() { removeAllRegistrations(); lua_close(mL); } //----------------------------------------------------------------------------- void LuaScripting::clean() { exec("provenance.clear()"); // Provenance will perform the full GC. } //----------------------------------------------------------------------------- void LuaScripting::clearAllLastExecTables() { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); for (vector::const_iterator it = mRegisteredGlobals.begin(); it != mRegisteredGlobals.end(); ++it) { string global = (*it); lua_getglobal(mL, (*it).c_str()); // Don't need to check if the top of the stack is nil. unregisterFunction // removes all global functions from mRegisteredGlobals. clearLastExecFromTable(); lua_pop(mL, 1); } // Be sure to clear all class functions. if (getFunctionTable(LuaClassInstance::CLASS_INSTANCE_TABLE) != false) { clearLastExecFromTable(); lua_pop(mL, 1); } } //----------------------------------------------------------------------------- void LuaScripting::removeAllRegistrations() { // Class instances should be destroyed before removing functions // (deleteClass needs to be present when deleting instances). deleteAllClassInstances(); cleanupClassConstructors(); unregisterAllFunctions(); } #ifdef DETECTED_OS_WINDOWS #pragma warning( disable : 4702 ) // Unreachable code warning. #endif //----------------------------------------------------------------------------- int LuaScripting::luaPanic(lua_State* L) { // Note: We compile Lua as c plus plus, so we won't have problems throwing // exceptions from functions called by Lua. When not compiling as CPP, Lua // uses set_jmp and long_jmp. This can cause issues when exceptions are // thrown, see: // http://developers.sun.com/solaris/articles/mixing.html#except . ostringstream os; os << "Error description from Lua: '" << lua_tostring(L, -1) << "'."; //// Obtain extra debugging information. //lua_Debug ar; //if (lua_getstack(L, 1, &ar) == 1) //{ // lua_getinfo(L, "nSl", &ar); // name, namewhat, source, short_src, // // linedefined, lastlinedefined, what, // // currentline // os << "Lua state info -- name: '" << ar.name << "' " // << "namewhat: '" << ar.namewhat << "'" << " source: '" // << ar.source << "' short_src: '" << ar.short_src << "' linedefined: '" // << ar.linedefined << "' lastlinedefined: '" << ar.lastlinedefined // << "' what: '" << ar.what << "' currentline: '" << ar.currentline << "'" // << std::endl; //} lua_getfield(L, LUA_REGISTRYINDEX, LuaScripting::REG_EXPECTED_EXCEPTION_FLAG); bool isExpectingException = lua_toboolean(L, -1) ? true : false; if (isExpectingException == false) { // Even though we are in the Lua panic function, we can still use Lua to // log information and errors. ostringstream luaOut; luaOut << "log.error([==[" << os.str() << "]==])"; // Could also use [[ ]] string error = luaOut.str(); luaL_dostring(L, error.c_str()); } throw LuaError(os.str().c_str()); // Returning from this function would mean that abort() gets called by Lua. // We don't want this. return 0; } #ifdef DETECTED_OS_WINDOWS #pragma warning(default:4702) // Reenable unreachable code warning #endif //----------------------------------------------------------------------------- void* LuaScripting::luaInternalAlloc(void* /*ud*/, void* ptr, size_t /*osize*/, size_t nsize) { // TODO: Convert to use new (mind the realloc). if (nsize == 0) { free(ptr); return NULL; } else { return realloc(ptr, nsize); } } //----------------------------------------------------------------------------- static int nopFun() { // This function's existence is to do nothing. return 0; } //----------------------------------------------------------------------------- void LuaScripting::registerScriptFunctions() { // Note: All these functions are provenance exempt because we do not want // to even see that they were run in the provenance log. There is no reason // include them. lua_pushnil(mL); lua_setglobal(mL, "print"); mMemberReg->registerFunction(this, &LuaScripting::infoHelp, "help", "Prints detailed help regarding a function or " "class.", false); setProvenanceExempt("help"); mMemberReg->registerFunction(this, &LuaScripting::getInfoHelp, "helpStr", "Returns detailed help regarding a function or " "class.", false); setProvenanceExempt("helpStr"); mMemberReg->registerFunction(this, &LuaScripting::deleteLuaClassInstance, "deleteClass", "Deletes a Lua class instance.", true); setNullUndoFun("deleteClass"); // Undo doesn't do anything. Instance // cleanup is done inside of provenance. // All child undo items are still executed. mMemberReg->registerFunction(this, &LuaScripting::getClassUniqueID, "getClassUNID", "Retrieves the unique ID of the given class.", false); mMemberReg->registerFunction(this, &LuaScripting::getClassWithUniqueID, "getClassWithUNID", "Retrieves the class with the specified unique " "ID.", false); mMemberReg->registerFunction(this, &LuaScripting::logInfo, "print", "Logs general information.", false); setProvenanceExempt("print"); mMemberReg->registerFunction(this, &LuaScripting::logInfo, "log.info", "Logs general information.", false); setProvenanceExempt("log.info"); mMemberReg->registerFunction(this, &LuaScripting::logWarn, "log.warn", "Logs general information.", false); setProvenanceExempt("log.warn"); mMemberReg->registerFunction(this, &LuaScripting::logError, "log.error", "Logs an error.", false); setProvenanceExempt("log.error"); mMemberReg->registerFunction(this, &LuaScripting::printFunctions, "log.printFunctions", "Prints all registered functions using " "'log.info'.", false); setProvenanceExempt("log.printFunctions"); mMemberReg->registerFunction(this, &LuaScripting::enableVerboseMode, "luaVerboseMode", "Enables/disables lua debug mode " "(verbose mode).", false); setProvenanceExempt("luaVerboseMode"); mMemberReg->registerFunction(this, &LuaScripting::printHelp, "helpAllFunctions", "Same as log.printFunctions with an additional " "header.", false); setProvenanceExempt("helpAllFunctions"); registerFunction(&nopFun, SYSTEM_NOP_COMMAND, "No-op " "function that helps to logically group commands in the provenance " "system.", true); registerLuaUtilityFunctions(); } //----------------------------------------------------------------------------- void LuaScripting::logInfo(string log) { // TODO: Add logging functionality for Tuvok. #ifdef LUASCRIPTING_NO_TUVOK cout << log << endl; #else MESSAGE(log.c_str()); #endif std::cout << log << "\n"; } //----------------------------------------------------------------------------- void LuaScripting::logWarn(string log) { // TODO: Add logging functionality for Tuvok. #ifdef LUASCRIPTING_NO_TUVOK cout << "Warn: " << log << endl; #else MESSAGE(log.c_str()); #endif } //----------------------------------------------------------------------------- void LuaScripting::logError(string log) { // TODO: Add logging functionality for Tuvok. #ifdef LUASCRIPTING_NO_TUVOK cout << "Error: " << log << endl; #else T_ERROR(log.c_str()); #endif } //----------------------------------------------------------------------------- void LuaScripting::printFunctions() { vector funcDescs = getAllFuncDescs(); for (vector::iterator it = funcDescs.begin(); it != funcDescs.end(); ++it) { FunctionDesc d = *it; ostringstream os; os << "'" << d.funcFQName << "' -- " << d.funcDesc; cexec("log.info", os.str()); } } //----------------------------------------------------------------------------- void LuaScripting::printHelp() { // We execute the commands from lua because there may be hooks on the logInfo // and logError functions. cexec("log.info", ""); cexec("log.info", "------------------------------"); cexec("log.info", "Tuvok Scripting Interface"); cexec("log.info", "List of all functions follows"); cexec("log.info", "------------------------------"); cexec("log.info", ""); printFunctions(); cexec("log.info", ""); cexec("log.info", "Use the 'help' function to get additional information on " "classes and functions. E.G. help(print)"); } //----------------------------------------------------------------------------- bool IsParenthesesOrSpacePred(char c) { switch(c) { case '(': case ')': case ' ': return true; default: return false; } } struct FuncHelpSorter : public std::binary_function { bool operator()(const LuaScripting::FunctionDesc& a, const LuaScripting::FunctionDesc& b) { return a.funcName < b.funcName; } }; //----------------------------------------------------------------------------- string LuaScripting::getClassHelp(int tableIndex) { ostringstream ret; vector funcDescs; lua_pushvalue(mL, tableIndex); getTableFuncDefs(funcDescs); lua_pop(mL, 1); if (lua_getmetatable(mL, tableIndex) == 0) throw LuaError("Unable to obtain function metatable."); lua_getfield(mL, -1, LuaClassInstance::MD_FACTORY_NAME); string factoryName = lua_tostring(mL, -1); lua_pop(mL, 2); // Pop metatable and factory name off the stack. string header = "Function listing follows for class created from '"; header += factoryName; header += "'"; ret << std::endl << header << std::endl; std::sort(funcDescs.begin(), funcDescs.end(), FuncHelpSorter()); for (vector::iterator it = funcDescs.begin(); it != funcDescs.end(); ++it) { FunctionDesc d = *it; ret << "'" << getUnqualifiedName(d.funcFQName) << "' -- " << d.funcDesc << std::endl; } return ret.str(); } //----------------------------------------------------------------------------- void LuaScripting::infoHelp(LuaTable table) { cexec("log.info", getInfoHelp(table)); } //----------------------------------------------------------------------------- string LuaScripting::getInfoHelp(LuaTable table) { ostringstream ret; LuaStackRAII _a(mL, 0, 0); int funTable = table.getStackLocation(); if (isLuaClassInstance(funTable)) { return getClassHelp(funTable); } // Check to see if this is a value with a metatable and something set for // TUVOK_LUA_MT_TYPE_TO_STR_FUN. if (lua_getmetatable(mL, funTable) != 0) { // Check to see if the metatable contains TUVOK_LUA_MT_TYPE_TO_STR_FUN. int mt = lua_gettop(mL); lua_pushstring(mL, TUVOK_LUA_MT_TYPE_TO_STR_FUN); lua_rawget(mL, mt); if (lua_isnil(mL, -1) == 0) { // This is a type that can be described through the function now on the // stack. // Push first function argument. lua_pushvalue(mL, funTable); lua_call(mL, 1, 1); // We should now have a string describing the variable on the stack. ret << lua_tostring(mL, lua_gettop(mL)); // Pop metatable and the variable description string. lua_pop(mL, 2); return ret.str(); } // Pop metatable and nil lua_pop(mL, 2); } if (isRegisteredFunction(funTable) == false) { cexec("log.warn", "Value given is not recognized as a function."); return ret.str(); } // Obtain basic descriptions from the table. FunctionDesc desc = getFunctionDescFromTable(lua_gettop(mL)); // Obtain extra information about the function's parameters. ret << std::endl << desc.funcFQName << std::endl; ret << " " << desc.funcDesc << std::endl; // Parse the function's parameters string commaDelimitedParams = desc.paramSig; commaDelimitedParams.erase(remove_if( commaDelimitedParams.begin(), commaDelimitedParams.end(), &IsParenthesesOrSpacePred), commaDelimitedParams.end()); // Tokenize the fully qualified name. const string delims(","); vector tokens; string::size_type beg = 0; string::size_type end = 0; while (end != string::npos) { end = commaDelimitedParams.find_first_of(delims, beg); string tmpStr; if (end != string::npos) { tmpStr = commaDelimitedParams.substr(beg, end - beg); if (!tmpStr.empty()) tokens.push_back(tmpStr); beg = end + 1; if (beg == commaDelimitedParams.size()) throw LuaFunBindError("Invalid function name. No function " "name after trailing period."); } else { tmpStr = commaDelimitedParams.substr(beg, string::npos); if (!tmpStr.empty()) tokens.push_back(tmpStr); } } // Could be nil. lua_getfield(mL, funTable, TBL_MD_PARAM_DESC); int descTable = lua_gettop(mL); vector paramOutput; ostringstream osUsage; osUsage << " Signature: '"<< desc.funcFQName << "("; if (tokens.size() != 0) { paramOutput.push_back(""); paramOutput.push_back(" Parameters:"); int accum = 1; for (vector::iterator it = tokens.begin(); it != tokens.end(); ++it) { // Check to see if the parameter has an additional description. string paramInfo = ""; string paramName = ""; if (it != tokens.begin()) osUsage << ", "; osUsage << *it; if (!lua_isnil(mL, descTable)) { ostringstream pName; ostringstream pDesc; pName << accum << PARAM_DESC_NAME_SUFFIX; pDesc << accum << PARAM_DESC_INFO_SUFFIX; lua_getfield(mL, descTable, pName.str().c_str()); if (!lua_isnil(mL, -1)) { paramName = lua_tostring(mL, -1); osUsage << " " << paramName; } lua_pop(mL, 1); lua_getfield(mL, descTable, pDesc.str().c_str()); if (!lua_isnil(mL, -1)) paramInfo = lua_tostring(mL, -1); lua_pop(mL, 1); } ostringstream infoStream; infoStream << " " << *it; if (!paramName.empty()) { infoStream << " " << paramName; } if (!paramInfo.empty()) { infoStream << " -- " << paramInfo; } paramOutput.push_back(infoStream.str()); ++accum; } } osUsage << ")'"; ret << osUsage.str() << std::endl; for (vector::iterator it = paramOutput.begin(); it != paramOutput.end(); ++it) { ret << *it << std::endl; } // Add return value information (stored at index 0 in the parameter table). string sig = desc.funcSig; size_t found = sig.find_first_of(" "); // Extract first keyword string retType = sig.substr(0, found); // found is the # of characters if (retType.compare("void") != 0) { ret << std::endl << " Return Value:" << std::endl; ret << " " << retType; string paramInfo = ""; string paramName = ""; if (!lua_isnil(mL, descTable)) { ostringstream pName; ostringstream pDesc; pName << "0" << PARAM_DESC_NAME_SUFFIX; pDesc << "0" << PARAM_DESC_INFO_SUFFIX; lua_getfield(mL, descTable, pName.str().c_str()); if (!lua_isnil(mL, -1)) paramName = lua_tostring(mL, -1); lua_pop(mL, 1); lua_getfield(mL, descTable, pDesc.str().c_str()); if (!lua_isnil(mL, -1)) paramInfo = lua_tostring(mL, -1); lua_pop(mL, 1); } if (!paramName.empty()) { ret << " " << paramName; } if (!paramInfo.empty()) { ret << " -- " << paramInfo; } ret << std::endl; } // Pop the description table off the stack lua_pop(mL, 1); // Pop the function table off the stack lua_pop(mL, 1); return ret.str(); } //----------------------------------------------------------------------------- void LuaScripting::addParamInfo(const std::string& fqname, int paramID, const std::string& name, const std::string& desc) { LuaStackRAII _a(mL, 0, 0); // Correct the zero based parameter. paramID++; if (getFunctionTable(fqname) == false) { cexec("log.warn", "Unable to find function: " + fqname); return; } int funTable = lua_gettop(mL); ostringstream nameKey; ostringstream infoKey; nameKey << paramID << PARAM_DESC_NAME_SUFFIX; infoKey << paramID << PARAM_DESC_INFO_SUFFIX; lua_getfield(mL, funTable, TBL_MD_PARAM_DESC); if (lua_isnil(mL, -1)) { // Create the table since it doesn't exist. lua_pop(mL, 1); lua_newtable(mL); lua_pushvalue(mL, -1); lua_setfield(mL, funTable, TBL_MD_PARAM_DESC); } int descTable = lua_gettop(mL); lua_pushstring(mL, name.c_str()); lua_setfield(mL, descTable, nameKey.str().c_str()); lua_pushstring(mL, desc.c_str()); lua_setfield(mL, descTable, infoKey.str().c_str()); // Pop the function table and the description table lua_pop(mL, 2); } //----------------------------------------------------------------------------- void LuaScripting::addReturnInfo(const std::string& fqname, const std::string& desc) { addParamInfo(fqname, 0, "", desc); } //----------------------------------------------------------------------------- bool LuaScripting::isProvenanceEnabled() const { return mProvenance->isEnabled(); } //----------------------------------------------------------------------------- void LuaScripting::enableProvenance(bool enable) { mProvenance->setEnabled(enable); } //----------------------------------------------------------------------------- void LuaScripting::unregisterAllFunctions() { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); for (vector::const_iterator it = mRegisteredGlobals.begin(); it != mRegisteredGlobals.end(); ++it) { string global = (*it); lua_getglobal(mL, (*it).c_str()); // Don't need to check if the top of the stack is nil. unregisterFunction // removes all global functions from mRegisteredGlobals. removeFunctionsFromTable(0, (*it).c_str()); lua_pop(mL, 1); } mRegisteredGlobals.clear(); // Special case system nop function. if (getFunctionTable("_sys_") == false) throw LuaError("Unable to find system table!"); int parentTable = lua_gettop(mL); if (getFunctionTable(SYSTEM_NOP_COMMAND) == false) throw LuaError("Unable to find no-op command in system table!"); removeFunctionsFromTable(parentTable, SYSTEM_NOP_COMMAND); lua_pop(mL, 2); } //----------------------------------------------------------------------------- void LuaScripting::deleteAllClassInstances() { // Iterate over the class instance table and call destroyClassInstanceTable // on all of the key values. LuaStackRAII _a(mL, 0, 0); lua_getglobal(mL, LuaClassInstance::SYSTEM_TABLE); if (lua_isnil(mL, -1) == 1) { lua_pop(mL, 1); return; } lua_pop(mL, 1); // Place the class instance table on the top of the stack. { ostringstream os; os << "return " << LuaClassInstance::CLASS_INSTANCE_TABLE; luaL_dostring(mL, os.str().c_str()); } int instTable = lua_gettop(mL); if (lua_isnil(mL, instTable) == 0) { // Push first key. lua_pushnil(mL); while (lua_next(mL, instTable)) { // Check if the value is a table. If so, check to see if it is a function, // otherwise, recurse into the table. destroyClassInstanceTable(lua_gettop(mL)); lua_pop(mL, 1); // Pop value off stack. // It is safe to clear existing fields while traversing the table with // next. See http://www.lua.org/manual/5.2/manual.html#pdf-next -- // while this is the next function inside of lua, it applies to lua_next // as well. lua_pushvalue(mL, -1); lua_pushnil(mL); lua_settable(mL, instTable); } // Push a new table and replace the old instance table with it // (permanently removing all residual instance tables). { ostringstream os; os << LuaClassInstance::CLASS_INSTANCE_TABLE << " = {}"; luaL_dostring(mL, os.str().c_str()); } // Erase the old lookup table. { ostringstream os; os << LuaClassInstance::CLASS_LOOKUP_TABLE << " = {}"; luaL_dostring(mL, os.str().c_str()); } } // Pop off the instance table (or nil). lua_pop(mL, 1); } //----------------------------------------------------------------------------- void LuaScripting::destroyClassInstanceTable(int tableIndex) { LuaStackRAII _a(mL, 0, 0); if (lua_getmetatable(mL, tableIndex) == 0) throw LuaError("Unable to obtain function metatable."); int mt = lua_gettop(mL); // Pull the delete function from the table. lua_getfield(mL, mt, LuaClassInstance::MD_DEL_FUN); LuaClassConstructor::DelFunSig fun = reinterpret_cast< LuaClassConstructor::DelFunSig>(lua_touserdata(mL, -1)); lua_pop(mL, 1); // Pull the instance pointer from the table. lua_getfield(mL, mt, LuaClassInstance::MD_INSTANCE); void* cls = lua_touserdata(mL, -1); lua_pop(mL, 1); lua_getfield(mL, mt, LuaClassInstance::MD_GLOBAL_INSTANCE_ID); int instID = static_cast(lua_tointeger(mL, -1)); lua_pop(mL, 1); // Call the delete function with the instance pointer. // Permanently removes the memory for our class. getProvenanceSys()->addDeletedInstanceToLastURItem(instID); lua_getfield(mL, mt, LuaClassInstance::MD_NO_DELETE_HINT); if (lua_toboolean(mL, -1) == 0) { fun(cls); } lua_pop(mL, 1); // Remove metatable from the stack. lua_pop(mL, 1); } //----------------------------------------------------------------------------- void LuaScripting::cleanupClassConstructors() { LuaStackRAII _a(mL, 0, 0); for (vector::iterator it = mRegisteredClasses.begin(); it != mRegisteredClasses.end(); ++it) { if (getFunctionTable(*it) == false) continue; int tblIndex = lua_gettop(mL); lua_getfield(mL, tblIndex, "new"); if (lua_isnil(mL, lua_gettop(mL))) { lua_pop(mL, 2); continue; } int consTable = lua_gettop(mL); lua_getfield(mL, consTable, LuaClassInstance::MD_DEL_CALLBACK_PTR); LuaClassConstructor::DelFunSig delCallbackFun = reinterpret_cast< LuaClassConstructor::DelFunSig>(lua_touserdata(mL, -1)); lua_pop(mL, 1); // Delete the function pointer light user data. It is stored in the // constructor's table. lua_getfield(mL, consTable, LuaClassConstructor::CONS_MD_FUNC_REGISTRATION_FPTR); delCallbackFun(lua_touserdata(mL, -1)); lua_pushnil(mL); lua_setfield(mL, tblIndex, "new"); lua_pop(mL, 3); } mRegisteredClasses.clear(); } //----------------------------------------------------------------------------- void LuaScripting::notifyOfDeletion(LuaClassInstance inst) { LuaStackRAII _a(mL, 0, 0); setExpectedExceptionFlag(true); try { // Don't even attempt anything if we did not find the function table. if (getFunctionTable(inst.fqName()) == false) { setExpectedExceptionFlag(false); return; } lua_pop(mL, 1); // Pop the function table. // Ensure the delete call does not attempt to delete the object. // (since this function is called from the destructor, delete has already // been called on this object). { ostringstream os; os << "getmetatable(" << inst.fqName() << ")." << LuaClassInstance::MD_NO_DELETE_HINT << " = true"; luaL_dostring(mL, os.str().c_str()); } // Execute the delete call. { ostringstream os; os << "deleteClass(" << inst.fqName() << ")"; exec(os.str()); } } catch (LuaNonExistantClassInstancePointer&) { // Ignore. We weren't created by the scripting engine. } setExpectedExceptionFlag(false); } //----------------------------------------------------------------------------- void LuaScripting::removeFunctionsFromTable(int parentTable, const char* tableName) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); // Iterate over the first table on the stack. int tablePos = lua_gettop(mL); // Check to see if it is a registered function. if (isRegisteredFunction(-1)) { // Only output function info its registered to us. if (isOurRegisteredFunction(-1)) { if (parentTable == 0) { lua_pushnil(mL); lua_setglobal(mL, tableName); } else { lua_pushnil(mL); lua_setfield(mL, parentTable, tableName); } } // This was a function, not a table. return; } string nextTableName; // Push first key. lua_pushnil(mL); while (lua_next(mL, tablePos)) { // Check if the value is a table. If so, check to see if it is a function, // otherwise, recurse into the table. int type = lua_type(mL, -1); if (type == LUA_TTABLE) { // Obtain the key value (we don't want to call lua_tostring on the key // used for lua_next. This will confuse lua_next). lua_pushvalue(mL, -2); nextTableName = lua_tostring(mL, -1); lua_pop(mL, 1); // Recurse into the table. lua_checkstack(mL, 4); removeFunctionsFromTable(tablePos, nextTableName.c_str()); } // Pop value off of the stack in preparation for the next iteration. lua_pop(mL, 1); } } //----------------------------------------------------------------------------- void LuaScripting::clearLastExecFromTable() { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); // Iterate over the first table on the stack. int tablePos = lua_gettop(mL); // Check to see if we are a registered function. if (isRegisteredFunction(-1)) { // Only output function info its registered to us. if (isOurRegisteredFunction(-1)) { lua_pushnil(mL); lua_setfield(mL, tablePos, TBL_MD_FUN_LAST_EXEC); copyDefaultsTableToLastExec(tablePos); } // This was a function, not a table. return; } // Push first key. lua_pushnil(mL); while (lua_next(mL, tablePos)) { // Check if the value is a table. If so, check to see if it is a function, // otherwise, recurse into the table. int type = lua_type(mL, -1); if (type == LUA_TTABLE) { // Recurse into the table. lua_checkstack(mL, 4); clearLastExecFromTable(); } // Pop value off of the stack in preparation for the next iteration. lua_pop(mL, 1); } } //----------------------------------------------------------------------------- vector LuaScripting::getAllFuncDescs() const { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); // 3.7.3.1 -- Automatic storage duration. // 6.7.2 -- Destroyed at the end of the block in // reverse order of creation. vector ret; // Iterate over all registered modules and do a recursive descent through // all of the tables to find all functions. for (vector::const_iterator it = mRegisteredGlobals.begin(); it != mRegisteredGlobals.end(); ++it) { lua_getglobal(mL, (*it).c_str()); getTableFuncDefs(ret); lua_pop(mL, 1); } return ret; } //----------------------------------------------------------------------------- void LuaScripting::getTableFuncDefs(vector& descs) const { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); // Iterate over the first table on the stack. int tablePos = lua_gettop(mL); // Check to see if it is a registered function. if (isRegisteredFunction(-1)) { // Only output function info its registered to us. if (isOurRegisteredFunction(-1)) { // The name of the function is the 'key'. FunctionDesc desc = getFunctionDescFromTable(lua_gettop(mL)); descs.push_back(desc); } // This was a function, not a table. return; } // Push first key. lua_pushnil(mL); while (lua_next(mL, tablePos)) { // Check if the value is a table. If so, check to see if it is a function, // otherwise, recurse into the table. int type = lua_type(mL, -1); if (type == LUA_TTABLE) { // Recurse into the table. lua_checkstack(mL, 4); getTableFuncDefs(descs); } // Pop value off of the stack in preparation for the next iteration. lua_pop(mL, 1); } // Check the '__index' metamethod if a metatable exists. if (lua_getmetatable(mL, tablePos)) { lua_getfield(mL, -1, "__index"); if (lua_isnil(mL, -1) == false) { // Recurse into the table. lua_checkstack(mL, 4); getTableFuncDefs(descs); } lua_pop(mL, 2); } } //----------------------------------------------------------------------------- LuaScripting::FunctionDesc LuaScripting::getFunctionDescFromTable(int table) const { LuaStackRAII _a(mL, 0, 0); FunctionDesc desc; lua_getfield(mL, table, TBL_MD_QNAME); desc.funcName = getUnqualifiedName(string(lua_tostring(mL, -1))); desc.funcFQName = string(lua_tostring(mL, -1)); lua_pop(mL, 1); lua_getfield(mL, table, TBL_MD_DESC); desc.funcDesc = lua_tostring(mL, -1); lua_pop(mL, 1); lua_getfield(mL, table, TBL_MD_SIG_NAME); desc.funcSig = string(lua_tostring(mL, -1)); lua_pop(mL, 1); lua_getfield(mL, table, TBL_MD_SIG_NO_RET); desc.paramSig = string(lua_tostring(mL, -1)); lua_pop(mL, 1); return desc; } //----------------------------------------------------------------------------- string LuaScripting::getUnqualifiedName(const string& fqName) { const string delims(QUALIFIED_NAME_DELIMITER); string::size_type beg = fqName.find_last_of(delims); if (beg == string::npos) { return fqName; } else { return fqName.substr(beg + 1, string::npos); } } //----------------------------------------------------------------------------- vector LuaScripting::performCorrection(int tbl, const std::string& name) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); vector ret; lua_pushnil(mL); while (lua_next(mL, tbl)) { // We don't care about the value, only the key. lua_pop(mL, 1); // Push a copy of the key, so we don't mess up the iteration. lua_pushvalue(mL, lua_gettop(mL)); // We only want string keys. if (lua_isstring(mL, lua_gettop(mL))) { const char* str = lua_tostring(mL, lua_gettop(mL)); // Check to see if name is contained as a prefix of str. if (name.size() == 0 || name.compare((size_t)0, name.size(), str, 0, name.size()) == 0) { ret.push_back(str); } } lua_pop(mL, 1); } return ret; } //----------------------------------------------------------------------------- vector LuaScripting::completeCommand(const std::string& fqName) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); vector ret; // Tokenize the fully qualified name. const string delims(QUALIFIED_NAME_DELIMITER); vector tokens; string::size_type beg = 0; string::size_type end = 0; while (end != string::npos) { end = fqName.find_first_of(delims, beg); if (end != string::npos) { tokens.push_back(fqName.substr(beg, end - beg)); beg = end + 1; } else { tokens.push_back(fqName.substr(beg, string::npos)); } } if (tokens.size() == 0) throw LuaFunBindError("No function name specified."); // Build name hierarchy in Lua, handle base case specially due to globals. vector::iterator it = tokens.begin(); string token = (*it); ++it; lua_getglobal(mL, token.c_str()); int type = lua_type(mL, -1); if (it != tokens.end()) { // Create a new table (module) at the global level. if (type != LUA_TTABLE) { lua_pop(mL, 1); // pop value off the stack. // Iterate through the global's table and compare the names of all // registered keys. If the key contains the same prefix, then we should // add it to the returned vector. // Grab the globals table and perform correction. lua_rawgeti(mL, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS); ret = performCorrection(lua_gettop(mL), token); lua_pop(mL, 1); return ret; } // keep the table on the stack } else { lua_pop(mL, 1); // pop value off the stack. // Iterate through the global's table and compare the names of all // registered keys. If the key contains the same prefix, then we should // add it to the returned vector. // Grab the globals table. lua_rawgeti(mL, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS); ret = performCorrection(lua_gettop(mL), token); lua_pop(mL, 1); return ret; } for (; it != tokens.end(); ++it) { token = *it; // The table we are working with is on the top of the stack. // Retrieve the key and test its type. lua_pushstring(mL, token.c_str()); lua_gettable(mL, -2); type = lua_type(mL, -1); // Check to see if we are at the end. if ((it != tokens.end()) && (it + 1 == tokens.end())) { // Attempt to perform a correction (this is the last element in the // vector). lua_pop(mL, 1); // pop value off the stack. // Iterate through the global's table and compare the names of all // registered keys. If the key contains the same prefix, then we should // add it to the returned vector. ret = performCorrection(lua_gettop(mL), token); lua_pop(mL, 1); return ret; } else { // Create a new table (module) at the global level. if (type != LUA_TTABLE) { lua_pop(mL, 1); // pop value off the stack. // Iterate through the global's table and compare the names of all // registered keys. If the key contains the same prefix, then we should // add it to the returned vector. ret = performCorrection(lua_gettop(mL), token); lua_pop(mL, 1); return ret; } // keep the table on the stack, but remove the old table. lua_remove(mL, -2); } } return ret; } //----------------------------------------------------------------------------- std::string LuaScripting::getCmdPath(std::string fqName) { const string delims(QUALIFIED_NAME_DELIMITER); vector tokens; string::size_type beg = 0; string::size_type end = 0; while (end != string::npos) { end = fqName.find_first_of(delims, beg); if (end != string::npos) { tokens.push_back(fqName.substr(beg, end - beg)); beg = end + 1; } else { tokens.push_back(fqName.substr(beg, string::npos)); } } vector::iterator it = tokens.begin(); string token; string ret; for (; it != tokens.end(); ++it) { token = *it; // Check to see if we are at the end. if ((it != tokens.end()) && (it + 1 == tokens.end())) { return ret; } else { if (it != tokens.begin()) ret += "."; ret += token; } } return ret; } //----------------------------------------------------------------------------- void LuaScripting::bindClosureTableWithFQName(const string& fqName, int tableIndex) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); // Tokenize the fully qualified name. const string delims(QUALIFIED_NAME_DELIMITER); vector tokens; string::size_type beg = 0; string::size_type end = 0; while (end != string::npos) { end = fqName.find_first_of(delims, beg); if (end != string::npos) { tokens.push_back(fqName.substr(beg, end - beg)); beg = end + 1; if (beg == fqName.size()) throw LuaFunBindError("Invalid function name. No function " "name after trailing period."); } else { tokens.push_back(fqName.substr(beg, string::npos)); } } if (tokens.size() == 0) throw LuaFunBindError("No function name specified."); // Build name hierarchy in Lua, handle base case specially due to globals. vector::iterator it = tokens.begin(); string token = (*it); ++it; lua_getglobal(mL, token.c_str()); int type = lua_type(mL, -1); if (it != tokens.end()) { // Create a new table (module) at the global level. if (type == LUA_TNIL) { lua_pop(mL, 1); // Pop nil off the stack lua_newtable(mL); lua_pushvalue(mL, -1); // Push table to keep it on the stack. lua_setglobal(mL, token.c_str()); // Add table name to the list of registered globals. // Only add it if it is NOT in the system table. The system table // stores class instances, and other accumulations of functions // that we do not want showing up in help. // We also will clean up the system table manually. if (token.compare(LuaClassInstance::SYSTEM_TABLE) != 0) mRegisteredGlobals.push_back(token); } else if (type == LUA_TTABLE) // Other { if (isRegisteredFunction(-1)) { throw LuaFunBindError("Can't register functions on top of other " "functions."); } } else { throw LuaFunBindError("A module in the fully qualified name " "not of type table."); } // keep the table on the stack } else { if (type == LUA_TNIL) { lua_pop(mL, 1); // Pop nil off the stack lua_pushvalue(mL, tableIndex); lua_setglobal(mL, token.c_str()); // Since the function is registered at the global level, we need to add // it to the registered globals list. This ensures all functions are // covered during a getAllFuncDescs function call. mRegisteredGlobals.push_back(token); } else { throw LuaFunBindError("Unable to bind function closure. " "Duplicate name already exists in globals."); } } for (; it != tokens.end(); ++it) { token = *it; // The table we are working with is on the top of the stack. // Retrieve the key and test its type. lua_pushstring(mL, token.c_str()); lua_gettable(mL, -2); type = lua_type(mL, -1); // Check to see if we are at the end. if ((it != tokens.end()) && (it + 1 == tokens.end())) { // This should be where the function closure is bound, no exceptions are // made for tables. if (type == LUA_TNIL) { lua_pop(mL, 1); // Pop nil off the stack. lua_pushstring(mL, token.c_str()); lua_pushvalue(mL, tableIndex); lua_settable(mL, -3); lua_pop(mL, 1); // Pop last table off of the stack. } else { throw LuaFunBindError("Unable to bind function closure. " "Duplicate name already exists at last " "descendant."); } } else { // Create a new table (module) at the global level. if (type == LUA_TNIL) { lua_pop(mL, 1); // Pop nil off the stack lua_newtable(mL); lua_pushstring(mL, token.c_str()); lua_pushvalue(mL, -2); // Push table to keep it on the stack. lua_settable(mL, -4); // Assign new table to prior table. lua_remove(mL, -2); // Remove prior table from the stack. } else if (type == LUA_TTABLE) { // Keep the table at the top, but remove the table we came from. lua_remove(mL, -2); if (isRegisteredFunction(-1)) { throw LuaFunBindError("Can't register functions on top of other " "functions."); } } else { throw LuaFunBindError("A module in the fully qualified name " "not of type table."); } } } } //----------------------------------------------------------------------------- bool LuaScripting::isOurRegisteredFunction(int stackIndex) const { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); // Extract the light user data that holds a pointer to the class that was // used to register this function. lua_getfield(mL, stackIndex, TBL_MD_CPP_CLASS); if (lua_isnil(mL, -1) == 0) { if (lua_touserdata(mL, -1) == this) { lua_pop(mL, 1); return true; } } lua_pop(mL, 1); return false; } //----------------------------------------------------------------------------- bool LuaScripting::isRegisteredFunction(int stackIndex) const { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); // Check to make sure this table is NOT a registered function. if (lua_getmetatable(mL, stackIndex) != 0) { // We have a metatable, check to see if isRegFunc exists and is 1. lua_getfield(mL, -1, "isRegFunc"); if (lua_isnil(mL, -1) == 0) { // We already know that it is a function at this point, but lets go // through the motions anyways. if (lua_toboolean(mL, -1) == 1) { lua_pop(mL, 2); // Pop the metatable and isRegFunc off the stack. return true; } } lua_pop(mL, 2); // Pop the metatable and isRegFunc off the stack. } return false; } //----------------------------------------------------------------------------- void LuaScripting::createCallableFuncTable(lua_CFunction proxyFunc, void* realFuncToCall) { LuaStackRAII _a = LuaStackRAII(mL, 0, 1); // Table containing the function closure. lua_newtable(mL); // Create a new metatable lua_newtable(mL); // Push C Closure containing our function pointer onto the Lua stack. lua_pushlightuserdata(mL, realFuncToCall); lua_pushboolean(mL, 0); // We are NOT a hook being called. // We are safe pushing this unprotected pointer: LuaScripting always // deregisters all functions it has registered, so no residual light // user data will be left in Lua. lua_pushlightuserdata(mL, static_cast(this)); lua_pushcclosure(mL, proxyFunc, 3); // Associate closure with __call metamethod. lua_setfield(mL, -2, "__call"); // Add boolean to the metatable indicating that this table is a registered // function. Used to ensure that we can't register functions 'on top' of // other functions. // e.g. If we register renderer.eye as a function, without this check, we // could also register renderer.eye.ball as a function. // While it works just fine, it's confusing, so we're disallowing it. lua_pushboolean(mL, 1); lua_setfield(mL, -2, "isRegFunc"); // Associate metatable with primary table. lua_setmetatable(mL, -2); // Leave the table on the top of the stack... } //----------------------------------------------------------------------------- void LuaScripting::populateWithMetadata(const std::string& name, const std::string& desc, const std::string& sig, const std::string& sigWithName, const std::string& sigNoReturn, int tableIndex) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); // Function description lua_pushstring(mL, desc.c_str()); lua_setfield(mL, tableIndex, TBL_MD_DESC); // Function signature lua_pushstring(mL, sig.c_str()); lua_setfield(mL, tableIndex, TBL_MD_SIG); // Function signature with name lua_pushstring(mL, sigWithName.c_str()); lua_setfield(mL, tableIndex, TBL_MD_SIG_NAME); // Function signature no return. lua_pushstring(mL, sigNoReturn.c_str()); lua_setfield(mL, tableIndex, TBL_MD_SIG_NO_RET); // Number of times this function has been executed // (takes into account undos, so if a function is undone then this // count will decrease). lua_pushnumber(mL, 0); lua_setfield(mL, tableIndex, TBL_MD_NUM_EXEC); // Fully qualified function name. lua_pushstring(mL, name.c_str()); lua_setfield(mL, tableIndex, TBL_MD_QNAME); // Build empty hook tables. lua_newtable(mL); lua_setfield(mL, tableIndex, TBL_MD_HOOKS); lua_newtable(mL); lua_setfield(mL, tableIndex, TBL_MD_MEMBER_HOOKS); lua_pushinteger(mL, 0); lua_setfield(mL, tableIndex, TBL_MD_HOOK_INDEX); lua_pushboolean(mL, 0); lua_setfield(mL, tableIndex, TBL_MD_STACK_EXEMPT); lua_pushboolean(mL, 0); lua_setfield(mL, tableIndex, TBL_MD_PROV_EXEMPT); // Ensure our class is present as a light user data. // In this way, we can identify our own functions, and our functions // can modify state (such as provenance). lua_pushlightuserdata(mL, this); lua_setfield(mL, tableIndex, TBL_MD_CPP_CLASS); } //----------------------------------------------------------------------------- void LuaScripting::createDefaultsAndLastExecTables(int tableIndex, int numFunParams) { LuaStackRAII _a = LuaStackRAII(mL, numFunParams, 0); int firstParamPos = (lua_gettop(mL) - numFunParams) + 1; // Create defaults table. lua_newtable(mL); int defTablePos = lua_gettop(mL); copyParamsToTable(defTablePos, firstParamPos, numFunParams); // Insert defaults table in closure table. lua_pushstring(mL, TBL_MD_FUN_PDEFS); lua_pushvalue(mL, defTablePos); lua_settable(mL, tableIndex); // Pop the defaults table. lua_pop(mL, 1); // Remove parameters from the stack. lua_pop(mL, numFunParams); copyDefaultsTableToLastExec(tableIndex); } //----------------------------------------------------------------------------- void LuaScripting::copyParamsToTable(int tableIndex, int paramStartIndex, int numParams) { // Push table onto the top of the stack. // This is why you shouldn't use psuedo indices for paramStartIndex. for (int i = 0; i < numParams; i++) { int stackIndex = paramStartIndex + i; lua_pushinteger(mL, i); lua_pushvalue(mL, stackIndex); lua_settable(mL, tableIndex); } } //----------------------------------------------------------------------------- bool LuaScripting::getFunctionTable(const std::string& fqName) { int baseStackIndex = lua_gettop(mL); // Tokenize the fully qualified name. const string delims(QUALIFIED_NAME_DELIMITER); vector tokens; string::size_type beg = 0; string::size_type end = 0; string token; int depth = 0; while (end != string::npos) { end = fqName.find_first_of(delims, beg); if (end != string::npos) { token = fqName.substr(beg, end - beg); beg = end + 1; // If the depth is 0, pull from globals, otherwise pull from the table // on the top of the stack. if (depth == 0) { lua_getglobal(mL, token.c_str()); } else { lua_getfield(mL, -1, token.c_str()); lua_remove(mL, -2); // Remove the old table from the stack. } if (lua_isnil(mL, -1)) { lua_settop(mL, baseStackIndex); return false; } if (beg == fqName.size()) { // Empty function name. lua_settop(mL, baseStackIndex); return false; } } else { token = fqName.substr(beg, string::npos); // Attempt to retrieve the function. if (depth == 0) { lua_getglobal(mL, token.c_str()); } else { lua_getfield(mL, -1, token.c_str()); lua_remove(mL, -2); // Remove the old table from the stack. } if (lua_isnil(mL, -1)) { lua_settop(mL, baseStackIndex); return false; } // Leave the function table on the top of the stack. return true; } ++depth; } lua_settop(mL, baseStackIndex); return false; } //----------------------------------------------------------------------------- void LuaScripting::unregisterFunction(const std::string& fqName) { // Lookup the function table based on the fully qualified name. int baseStackIndex = lua_gettop(mL); // Tokenize the fully qualified name. const string delims(QUALIFIED_NAME_DELIMITER); vector tokens; string::size_type beg = 0; string::size_type end = 0; string token; int depth = 0; while (end != string::npos) { end = fqName.find_first_of(delims, beg); if (end != string::npos) { token = fqName.substr(beg, end - beg); beg = end + 1; // If the depth is 0, pull from globals, otherwise pull from the table // on the top of the stack. if (depth == 0) { lua_getglobal(mL, token.c_str()); } else { lua_getfield(mL, -1, token.c_str()); lua_remove(mL, -2); } if (lua_isnil(mL, -1)) { lua_settop(mL, baseStackIndex); throw LuaNonExistantFunction("Function not found in unregister."); } if (beg == fqName.size()) { // Empty function name. lua_settop(mL, baseStackIndex); throw LuaNonExistantFunction("Function not found in unregister."); } } else { token = fqName.substr(beg, string::npos); // Attempt to retrieve the function. if (depth == 0) { lua_getglobal(mL, token.c_str()); } else { lua_getfield(mL, -1, token.c_str()); } if (lua_isnil(mL, -1)) { lua_settop(mL, baseStackIndex); throw LuaNonExistantFunction("Function not found in unregister."); } if (isRegisteredFunction(lua_gettop(mL))) { // Remove the function from the top of the stack, we don't need it // anymore. lua_pop(mL, 1); if (depth == 0) { // Unregister from globals (just assign nil to the variable) // http://www.lua.org/pil/1.2.html lua_setglobal(mL, token.c_str()); // Also remove from mRegisteredGlobals. mRegisteredGlobals.erase(remove(mRegisteredGlobals.begin(), mRegisteredGlobals.end(), fqName), mRegisteredGlobals.end()); } else { // Unregister from parent table. lua_pushnil(mL); lua_setfield(mL, -2, token.c_str()); } } else { lua_settop(mL, baseStackIndex); throw LuaNonExistantFunction("Function not found in unregister."); } } ++depth; } lua_settop(mL, baseStackIndex); } //----------------------------------------------------------------------------- void LuaScripting::doHooks(lua_State* L, int tableIndex, bool provExempt) { int stackTop = lua_gettop(L); int numArgs = stackTop - tableIndex; lua_checkstack(L, numArgs + 3); int numStaticHooks = 0; // Obtain the hooks table and iterate over it calling the lua closures. lua_getfield(L, tableIndex, TBL_MD_HOOKS); int hookTable = lua_gettop(L); try { lua_pushnil(L); while (lua_next(L, hookTable)) { // The value at the top of the stack is the lua closure to call. // This call will automatically pop the function off the stack, // so we don't need a pop at the end of the loop // Push all of the arguments. for (int i = 0; i < numArgs; i++) { lua_pushvalue(L, tableIndex + i + 1); } lua_pcall(L, numArgs, 0, 0); ++numStaticHooks; } lua_pop(L, 1); // Remove the hooks table. } catch (exception& e) { ostringstream os; os << " Static Hook: " << e.what(); logExecFailure(os.str()); throw; } catch (...) { ostringstream os; os << " Static Hook"; logExecFailure(os.str()); throw; } int numMemberHooks = 0; // Obtain the member function hooks table, and iterate over it. // XXX: Update to allow classes to register multiple hook for one function // I don't see a need for this now, so I'm not implementing it. // But a way to do it would be to make this member hooks table contain // tables named after the member hook references, and index the // function much like we index them in the hooks table above (with an // index stored in the table). lua_getfield(L, tableIndex, TBL_MD_MEMBER_HOOKS); hookTable = lua_gettop(L); try { lua_pushnil(L); while (lua_next(L, hookTable)) { // Push all of the arguments. for (int i = 0; i < numArgs; i++) { lua_pushvalue(L, tableIndex + i + 1); } lua_pcall(L, numArgs, 0, 0); ++numMemberHooks; } lua_pop(L, 1); // Remove the member hooks table. } catch (exception& e) { ostringstream os; os << " Member Hook: " << e.what(); logExecFailure(os.str()); throw; } catch (...) { ostringstream os; os << " Member Hook"; logExecFailure(os.str()); throw; } int totalHooks = numStaticHooks + numMemberHooks; if (totalHooks > 0 && provExempt == false) mProvenance->logHooks(numStaticHooks, numMemberHooks); assert(stackTop == lua_gettop(L)); } //----------------------------------------------------------------------------- std::string LuaScripting::getNewMemberHookID() { ostringstream os; os << "mh" << mMemberHookIndex; ++mMemberHookIndex; return os.str(); } //----------------------------------------------------------------------------- bool LuaScripting::doProvenanceFromExec(lua_State* L, std::shared_ptr funParams, std::shared_ptr emptyParams) { if (mProvenance->isEnabled()) { // Obtain fully qualified function name (doProvenanceFromExec is executed // from the context of the exec function in one of the LuaCallback structs). lua_getfield(L, 1, LuaScripting::TBL_MD_QNAME); std::string fqName = lua_tostring(L, -1); lua_pop(L, 1); lua_getfield(L, 1, LuaScripting::TBL_MD_STACK_EXEMPT); bool stackExempt = lua_toboolean(L, -1) ? true : false; lua_pop(L, 1); lua_getfield(L, 1, LuaScripting::TBL_MD_PROV_EXEMPT); bool provExempt = lua_toboolean(L, -1) ? true : false; lua_pop(L, 1); if (provExempt == false) { // Execute provenace. mProvenance->logExecution(fqName, stackExempt, funParams, emptyParams); } return provExempt; } return true; } //----------------------------------------------------------------------------- void LuaScripting::setUndoRedoStackExempt(const string& funcName) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); lua_State* L = mL; if (getFunctionTable(funcName) == false) { std::ostringstream nf; nf << "Could not find '" << funcName << "'\n"; throw LuaNonExistantFunction(nf.str(), _func_, __LINE__); } lua_pushboolean(L, 1); lua_setfield(L, -2, TBL_MD_STACK_EXEMPT); // Remove tables that are usually associated with undo/redo functionality. lua_pushnil(L); lua_setfield(L, -2, TBL_MD_FUN_PDEFS); lua_pushnil(L); lua_setfield(L, -2, TBL_MD_FUN_LAST_EXEC); // Pop off the function table. lua_pop(L, 1); } //----------------------------------------------------------------------------- void LuaScripting::setProvenanceExempt(const std::string& fqName) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); setUndoRedoStackExempt(fqName); lua_State* L = mL; if (getFunctionTable(fqName) == false) { std::ostringstream nf; nf << "Could not find '" << fqName << "' function."; throw LuaNonExistantFunction(nf.str(), _func_, __LINE__); } lua_pushboolean(L, 1); lua_setfield(L, -2, TBL_MD_PROV_EXEMPT); // Pop off the function table. lua_pop(L, 1); } //----------------------------------------------------------------------------- void LuaScripting::copyDefaultsTableToLastExec(int funTableIndex) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); // Push a copy of the defaults table onto the stack. lua_getfield(mL, funTableIndex, TBL_MD_FUN_PDEFS); if (lua_isnil(mL, -1)) { lua_pop(mL, 1); return; } int defTablePos = lua_gettop(mL); // Do a deep copy of the defaults table. // If we don't do this, we push another reference of the defaults table // instead of a deep copy of the table. lua_newtable(mL); int lastExecTablePos = lua_gettop(mL); lua_pushnil(mL); // First key // We use lua_next because order is not important. Just getting the key // value pairs is important. while (lua_next(mL, defTablePos)) { lua_pushvalue(mL, -2); // Push key lua_pushvalue(mL, -2); // Push value lua_settable(mL, lastExecTablePos); lua_pop(mL, 1); // Pop value, keep key for next iteration. } // lua_next has popped off our initial key. // Push a copy of the defaults table onto the stack, and use it as the // 'last executed values'. lua_pushstring(mL, TBL_MD_FUN_LAST_EXEC); lua_pushvalue(mL, lastExecTablePos); lua_settable(mL, funTableIndex); lua_pop(mL, 2); // Pop the last-exec and the default tables. } //----------------------------------------------------------------------------- void LuaScripting::prepForExecution(const std::string& fqName) { if (getFunctionTable(fqName) == false) { std::ostringstream nf; nf << "Could not find '" << fqName << "' function."; throw LuaNonExistantFunction(nf.str(), _func_, __LINE__); } if (lua_getmetatable(mL, -1) == 0) throw LuaError("Unable to find function metatable."); lua_getfield(mL, -1, "__call"); // Remove metatable. lua_remove(mL, lua_gettop(mL) - 1); // Push a reference of the function table. This will be the first parameter // to the function we call. lua_pushvalue(mL, -2); // Remove the function table we pushed with getFunctionTable. lua_remove(mL, lua_gettop(mL) - 2); } //----------------------------------------------------------------------------- void LuaScripting::executeFunctionOnStack(int nparams, int nret) { // - 2 because we have the function table as a transparent parameter // and lua_call will also pop the function off the stack. LuaStackRAII _a = LuaStackRAII(mL, nparams + 2, nret); // + 1 is for the function table that was pushed by prepForExecution. lua_call(mL, nparams + 1, nret); } //----------------------------------------------------------------------------- void LuaScripting::exec(const std::string& cmd) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); luaL_loadstring(mL, cmd.c_str()); lua_call(mL, 0, 0); } //----------------------------------------------------------------------------- void LuaScripting::cexec(const std::string& cmd) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(cmd); executeFunctionOnStack(0, 0); } //----------------------------------------------------------------------------- void LuaScripting::resetFunDefault(int argumentPos, int ftableStackPos) { LuaStackRAII _a = LuaStackRAII(mL, 1, 0); int valPos = lua_gettop(mL); lua_getfield(mL, ftableStackPos, TBL_MD_FUN_PDEFS); int defs = lua_gettop(mL); lua_getfield(mL, ftableStackPos, TBL_MD_FUN_LAST_EXEC); int exec = lua_gettop(mL); lua_pushinteger(mL, argumentPos); lua_pushvalue(mL, valPos); lua_settable(mL, defs); lua_pushinteger(mL, argumentPos); lua_pushvalue(mL, valPos); lua_settable(mL, exec); lua_pop(mL, 3); // Pop the defaults table, last exec table, and value at // top of the stack. } //----------------------------------------------------------------------------- void LuaScripting::logExecFailure(const std::string& failure) { ostringstream os; os << " -- FAILED"; if (!failure.empty()) { os << ": " << failure; } mProvenance->ammendLastProvLog(os.str()); } //----------------------------------------------------------------------------- void LuaScripting::setExpectedExceptionFlag(bool expected) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); lua_pushboolean(mL, expected ? 1 : 0); lua_setfield(mL, LUA_REGISTRYINDEX, LuaScripting::REG_EXPECTED_EXCEPTION_FLAG); } //----------------------------------------------------------------------------- void LuaScripting::setTempProvDisable(bool disable) { mProvenance->setDisableProvTemporarily(disable); } //----------------------------------------------------------------------------- void LuaScripting::beginCommand() { mProvenance->beginCommand(); } //----------------------------------------------------------------------------- void LuaScripting::endCommand() { mProvenance->endCommand(); } //----------------------------------------------------------------------------- LuaClassInstance LuaScripting::getLuaClassInstance(void* p) { LuaStackRAII _a(mL, 0, 0); // Grab lookup table and attempt to lookup the light user data. if (getFunctionTable(LuaClassInstance::CLASS_LOOKUP_TABLE) == false) throw LuaNonExistantFunction("Could not find class lookup table!"); lua_pushlightuserdata(mL, p); lua_gettable(mL, -2); if (lua_isnil(mL, -1)) { throw LuaNonExistantClassInstancePointer("Unable to find class instance"); } int instID = static_cast(luaL_checkinteger(mL, -1)); lua_pop(mL, 2); return LuaClassInstance(instID); } //----------------------------------------------------------------------------- bool LuaScripting::getClassTable(LuaClassInstance inst) { LuaStackRAII _a(mL, 0, 1); return getFunctionTable(inst.fqName()); } //----------------------------------------------------------------------------- void LuaScripting::deleteLuaClassInstance(LuaClassInstance inst) { LuaStackRAII _a(mL, 0, 0); if (getFunctionTable(inst.fqName())) { // Hurry and grab the raw pointer before we delete the table and // invalidate the LuaClassInstance. void* rawPointer = inst.getVoidPointer(this); // Erase the class instance. We want to do this first, before we delete // the entity itself. This is to facilitate re-entry (if we attempt to // delete the entity again, we can't, we won't make it passed the // getFunctionTable function). { ostringstream os; os << inst.fqName() << " = nil"; luaL_dostring(mL, os.str().c_str()); } destroyClassInstanceTable(lua_gettop(mL)); // Remove the class ID from the lookup table. if (getFunctionTable(LuaClassInstance::CLASS_LOOKUP_TABLE)) { lua_pushlightuserdata(mL, rawPointer); lua_pushnil(mL); lua_settable(mL, -3); lua_pop(mL, 1); } else { throw LuaError("Unable to find class lookup table..."); } // Pop the class instance table. lua_pop(mL, 1); } } //----------------------------------------------------------------------------- int LuaScripting::getNewClassInstID() { if (mGlobalTempInstRange) { int ret = mGlobalTempCurrent; ++mGlobalTempCurrent; if (mGlobalTempCurrent > mGlobalTempInstHigh) { mGlobalTempInstRange = false; } vPrint("Class - Reuse: %d", ret); return ret; } else { vPrint("Class - New: %d", mGlobalInstanceID); return mGlobalInstanceID++; } } //----------------------------------------------------------------------------- void LuaScripting::setNextTempClassInstRange(LuaClassInstance::IDType low, LuaClassInstance::IDType high) { mGlobalTempInstRange = true; mGlobalTempInstLow = low; mGlobalTempInstHigh = high; mGlobalTempCurrent = low; } //----------------------------------------------------------------------------- void LuaScripting::setNullUndoFun(const std::string& name) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); // Need to check the signature of the function that we are trying to bind // into the script system. if (getFunctionTable(name) == false) { throw LuaNonExistantFunction("Unable to find function with which to" "associate a null undo function."); } lua_pushboolean(mL, 1); lua_setfield(mL, -2, TBL_MD_NULL_UNDO); lua_pop(mL, 1); } //----------------------------------------------------------------------------- void LuaScripting::setNullRedoFun(const std::string& name) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); // Need to check the signature of the function that we are trying to bind // into the script system. if (getFunctionTable(name) == false) { throw LuaNonExistantFunction("Unable to find function with which to" "associate a null redo function."); } lua_pushboolean(mL, 1); lua_setfield(mL, -2, TBL_MD_NULL_REDO); lua_pop(mL, 1); } //----------------------------------------------------------------------------- bool LuaScripting::isLuaClassInstance(int tableIndex) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); if (lua_getmetatable(mL, tableIndex) == 0) { return false; } lua_getfield(mL, -1, LuaClassInstance::MD_GLOBAL_INSTANCE_ID); if (lua_isnil(mL, -1)) { lua_pop(mL, 2); // nil and metatable off the stack. return false; } lua_pop(mL, 2); return true; } //----------------------------------------------------------------------------- int LuaScripting::getClassUniqueID(LuaClassInstance inst) { return inst.getGlobalInstID(); } //----------------------------------------------------------------------------- LuaClassInstance LuaScripting::getClassWithUniqueID(LuaClassInstance::IDType ID) { return LuaClassInstance(ID); } static const char* DirMetatable = "_sys_.dir"; static const char* DirFunName = "dir"; #define DIR_METATABLE "_sys_.dir" #ifndef DETECTED_OS_WINDOWS // This directory code is taken from http://www.lua.org/pil/29.1.html . // forward declaration for the iterator function static int dir_iter (lua_State *L); static int l_dir (lua_State *L) { const char *path = luaL_checkstring(L, 1); // create a userdatum to store a DIR address DIR** d = (DIR**)lua_newuserdata(L, sizeof(DIR*)); // set its metatable luaL_getmetatable(L, DirMetatable); lua_setmetatable(L, -2); // try to open the given directory *d = opendir(path); if (*d == NULL) // error opening the directory? luaL_error(L, "cannot open %s: %s", path, strerror(errno)); // creates and returns the iterator function // (its sole upvalue, the directory userdatum, // is already on the stack top lua_pushcclosure(L, dir_iter, 1); return 1; } static int dir_iter (lua_State *L) { DIR *d = *(DIR **)lua_touserdata(L, lua_upvalueindex(1)); struct dirent *entry; if ((entry = readdir(d)) != NULL) { lua_pushstring(L, entry->d_name); return 1; } else return 0; // no more values to return } static int dir_gc (lua_State *L) { DIR *d = *(DIR **)lua_touserdata(L, 1); if (d) closedir(d); return 0; } static int luaopen_dir(lua_State *L) { LuaStackRAII _a(L, 0, 0); luaL_newmetatable(L, DirMetatable); // set its __gc field lua_pushstring(L, "__gc"); lua_pushcfunction(L, dir_gc); lua_settable(L, -3); lua_pop(L, 1); // Pop the metatable. // register the `dir' function lua_pushcfunction(L, l_dir); lua_setglobal(L, DirFunName); return 0; } /// @todo implement windows Lua directory iteration so that we can properly /// perform regression testing on windows... #endif static const char* LuaOSCaptureFun = "os.capture = function(cmd, raw)\n" "local f = assert(io.popen(cmd, 'r'))\n" "local s = assert(f:read('*a'))\n" "f:close()\n" "if raw then return s end\n" "s = string.gsub(s, '^%s+', '')\n" "s = string.gsub(s, '%s+$', '')\n" "s = string.gsub(s, '[\\n\\r]+', ' ')\n" "return s\n" "end\n"; //----------------------------------------------------------------------------- void LuaScripting::registerLuaUtilityFunctions() { LuaStackRAII _a(mL, 0, 0); // Register the dir() lua function. #ifndef DETECTED_OS_WINDOWS luaopen_dir(mL); #endif // Place capture command at the top of the stack. exec(LuaOSCaptureFun); } //----------------------------------------------------------------------------- void LuaScripting::enableVerboseMode(bool enable) { mVerboseMode = enable; } //----------------------------------------------------------------------------- void LuaScripting::vPrint(const char* fmt, ...) { if (isVerbose() == false) return; char msgBuffer[1024]; // We're not concerned with efficiency in this func. va_list arglist; va_start(arglist, fmt); vsnprintf(msgBuffer, 1000, fmt, arglist); va_end(arglist); string complete = "Verbose["; complete += msgBuffer; complete += "]"; cexec("log.info", complete); } //----------------------------------------------------------------------------- void LuaScripting::beginCommandGroup() { // Initiate provenance with a 'dummy' function. cexec(SYSTEM_NOP_COMMAND); mProvenance->setLastURItemAlsoRedoChildren(); beginCommand(); } //----------------------------------------------------------------------------- void LuaScripting::endCommandGroup() { // End the provenance begun with the 'dummy' function above. endCommand(); } } /* namespace tuvok */ //============================================================================== // // UNIT TESTING // //============================================================================== #ifdef LUASCRIPTING_UNIT_TESTS #include "utestCommon.h" using namespace tuvok; void printRegisteredFunctions(LuaScripting* s); SUITE(TestLuaScriptingSystem) { int dfun(int a, int b, int c) { return a + b + c; } TEST( TestDynamicModuleRegistration ) { TEST_HEADER; unique_ptr sc(new LuaScripting()); // want to use unique_ptr // Test successful bindings and their results. sc->registerFunction(&dfun, "test.dummyFun", "My test dummy func.", true); sc->registerFunction(&dfun, "p1.p2.p3.dummy", "Test", true); sc->registerFunction(&dfun, "p1.p2.p.dummy", "Test", true); sc->registerFunction(&dfun, "p1.np.p3.p4.dummy", "Test", true); sc->registerFunction(&dfun, "test.dummyFun2", "Test", true); sc->registerFunction(&dfun, "test.test2.dummy", "Test", true); sc->registerFunction(&dfun, "func", "Test", true); CHECK_EQUAL(42, sc->execRet("test.dummyFun(1,2,39)")); CHECK_EQUAL(42, sc->execRet("p1.p2.p3.dummy(1,2,39)")); CHECK_EQUAL(65, sc->execRet("p1.p2.p.dummy(5,21,39)")); CHECK_EQUAL(42, sc->execRet("p1.np.p3.p4.dummy(1,2,39)")); CHECK_EQUAL(42, sc->execRet("test.dummyFun2(1,2,39)")); CHECK_EQUAL(42, sc->execRet("test.test2.dummy(1,2,39)")); CHECK_EQUAL(42, sc->execRet("func(1,2,39)")); // Test failure cases. // Check for appropriate exceptions. // XXX: We could make more exception classes whose names more closely // match the exceptions we are getting. // Exception: No trailing name after period. sc->setExpectedExceptionFlag(true); CHECK_THROW( sc->registerFunction(&dfun, "err.err.dummyFun.", "Func.", true), LuaFunBindError); // Exception: Duplicate name already exists in globals. CHECK_THROW( sc->registerFunction(&dfun, "p1", "Func.", true), LuaFunBindError); // Exception: Duplicate name already exists at last descendant. CHECK_THROW( sc->registerFunction(&dfun, "p1.p2", "Func.", true), LuaFunBindError); // Exception: A module in the fully qualified name not of type table. // (descendant case). CHECK_THROW( sc->registerFunction(&dfun, "test.dummyFun.Func", "Func.", true), LuaFunBindError); // Exception: A module in the fully qualified name not of type table. // (global case). CHECK_THROW( sc->registerFunction(&dfun, "func.Func2", "Func.", true), LuaFunBindError); sc->setExpectedExceptionFlag(false); } string str_int(int in) { ostringstream os; os << "(" << in << ")"; return os.str(); } string str_int2(int in, int in2) { ostringstream os; os << "(" << in << "," << in2 << ")"; return os.str(); } // Maximum number of parameters. float flt_flt2_int2_dbl2(float a, float b, int c, int d, double e, double f) { return a * float(c + d) + b * float(e + f); } int int_() { return 79; } void print_flt(float in) { printf("%f", in); } string mixer(bool a, int b, float c, double d, string s) { ostringstream os; os << s << " " << a << " " << b << " " << c << " " << d; return os.str(); } // When you add new types to LuaFunBinding.h, test them here. TEST( TestRegistration ) { TEST_HEADER; unique_ptr sc(new LuaScripting()); // want to use unique_ptr sc->registerFunction(&str_int, "str.int", "", true); sc->registerFunction(&str_int2, "str.int2", "", true); sc->registerFunction(&flt_flt2_int2_dbl2, "flt.flt2.int2.dbl2", "", true); sc->registerFunction(&mixer, "mixer", "", true); CHECK_EQUAL("(97)", sc->execRet("str.int(97)").c_str()); CHECK_EQUAL("(978,42)", sc->execRet("str.int2(978, 42)").c_str()); CHECK_EQUAL("My sTrIng 1 10 12.6 392.9", sc->execRet("mixer(true, 10, 12.6, 392.9, 'My sTrIng')") .c_str()); CHECK_CLOSE(30.0f, sc->execRet("flt.flt2.int2.dbl2(2,2,1,4,5,5)"), 0.0001f); } // Tests a series of functions closure metadata. TEST( TestClosureMetadata ) { TEST_HEADER; unique_ptr sc(new LuaScripting()); // want to use unique_ptr sc->registerFunction(&str_int, "str.fint", "desc str_int", true); sc->registerFunction(&str_int2, "str.fint2", "desc str_int2", true); sc->registerFunction(&int_, "fint", "desc int_", true); sc->registerFunction(&print_flt, "print_flt", "Prints Floats", true); string exe; // The following sections exploit lua_call's ability to 'execute' variables. // The result is the variable itself (if 1+ returns or LUA_MULTRET). // We are using our internal function result evaluation methods (execRet) // to evaluate and check the types of variables coming out of lua. //------------------ // Test description //------------------ exe = string("str.fint.") + LuaScripting::TBL_MD_DESC; CHECK_EQUAL("desc str_int", sc->execRet(exe).c_str()); exe = string("str.fint2.") + LuaScripting::TBL_MD_DESC; CHECK_EQUAL("desc str_int2", sc->execRet(exe).c_str()); exe = string("fint.") + LuaScripting::TBL_MD_DESC; CHECK_EQUAL("desc int_", sc->execRet(exe).c_str()); exe = string("print_flt.") + LuaScripting::TBL_MD_DESC; CHECK_EQUAL("Prints Floats", sc->execRet(exe).c_str()); //---------------- // Test signature //---------------- std::string temp; exe = "str.fint."; temp = string(exe + LuaScripting::TBL_MD_SIG); CHECK_EQUAL("string (int)", sc->execRet(temp).c_str()); temp = string(exe + LuaScripting::TBL_MD_SIG_NAME); CHECK_EQUAL("string fint(int)", sc->execRet(temp).c_str()); exe = "str.fint2."; temp = string(exe + LuaScripting::TBL_MD_SIG); CHECK_EQUAL("string (int, int)", sc->execRet(temp).c_str()); temp = string(exe + LuaScripting::TBL_MD_SIG_NAME); CHECK_EQUAL("string fint2(int, int)", sc->execRet(temp).c_str()); exe = "fint."; temp = string(exe + LuaScripting::TBL_MD_SIG); CHECK_EQUAL("int ()", sc->execRet(temp).c_str()); temp = string(exe + LuaScripting::TBL_MD_SIG_NAME); CHECK_EQUAL("int fint()", sc->execRet(temp).c_str()); exe = "print_flt."; temp = string(exe + LuaScripting::TBL_MD_SIG); CHECK_EQUAL("void (float)", sc->execRet(temp).c_str()); temp = string(exe + LuaScripting::TBL_MD_SIG_NAME); CHECK_EQUAL("void print_flt(float)", sc->execRet(temp).c_str()); //------------------------------------------------------------------ // Number of executions (simple value -- only testing one function) //------------------------------------------------------------------ exe = string("print_flt.") + LuaScripting::TBL_MD_NUM_EXEC; CHECK_EQUAL(0, sc->execRet(exe)); //------------------------------------------------------------ // Qualified name (simple value -- only testing one function) //------------------------------------------------------------ exe = string("str.fint2.") + LuaScripting::TBL_MD_QNAME; CHECK_EQUAL("str.fint2", sc->execRet(exe).c_str()); } TEST(Test_getAllFuncDescs) { TEST_HEADER; // Test retrieval of all function descriptions. unique_ptr sc(new LuaScripting()); // want to use unique_ptr sc->registerFunction(&str_int, "str.int", "Desc 1", true); sc->registerFunction(&str_int2, "str2.int2", "Desc 2", true); sc->registerFunction(&flt_flt2_int2_dbl2, "flt.flt2.int2.dbl2", "Desc 3", true); sc->registerFunction(&mixer, "mixer", "Desc 4", true); // std::vector d = sc->getAllFuncDescs(); // We want to skip all of the subsystems that were registered when // LuaScripting is created (like provenance). // So we just look at the size of d, and use that as an indexing // mechanism. int ds = d.size(); int i; // Verify all of the function descriptions. // Since all of the functions are in different base tables, we can extract // them in the order that we registered them. // Otherwise, its determine by the hashing function used internally by // Lua (key/value pair association). i = ds - 4; CHECK_EQUAL("int", d[i].funcName.c_str()); CHECK_EQUAL("Desc 1", d[i].funcDesc.c_str()); CHECK_EQUAL("string int(int)", d[i].funcSig.c_str()); i = ds - 3; CHECK_EQUAL("int2", d[i].funcName.c_str()); CHECK_EQUAL("Desc 2", d[i].funcDesc.c_str()); CHECK_EQUAL("string int2(int, int)", d[i].funcSig.c_str()); i = ds - 2; CHECK_EQUAL("dbl2", d[i].funcName.c_str()); CHECK_EQUAL("Desc 3", d[i].funcDesc.c_str()); CHECK_EQUAL("float dbl2(float, float, int, int, double, double)", d[i].funcSig.c_str()); i = ds - 1; CHECK_EQUAL("mixer", d[i].funcName.c_str()); CHECK_EQUAL("Desc 4", d[i].funcDesc.c_str()); CHECK_EQUAL("string mixer(bool, int, float, double, string)", d[i].funcSig.c_str()); // printRegisteredFunctions(sc.get()); } static int hook1Called = 0; static int hook1CallVal = 0; static int hook1aCalled = 0; static int hook1aCallVal = 0; static int hook2Called = 0; static int hook2CallVal1 = 0; static int hook2CallVal2 = 0; void myHook1(int a) { printf("Called my hook 1 with %d\n", a); ++hook1Called; hook1CallVal = a; } void myHook1a(int a) { printf("Called my hook 1a with %d\n", a); ++hook1aCalled; hook1aCallVal = a; } void myHook2(int a, int b) { printf("Called my hook 2 with %d %d\n", a, b); ++hook2Called; hook2CallVal1 = a; hook2CallVal2 = b; } TEST(StaticStrictHook) { TEST_HEADER; unique_ptr sc(new LuaScripting()); sc->registerFunction(&str_int, "func1", "Function 1", true); sc->registerFunction(&str_int2, "a.func2", "Function 2", true); sc->strictHook(&myHook1, "func1"); sc->strictHook(&myHook1, "func1"); sc->strictHook(&myHook1a, "func1"); sc->strictHook(&myHook2, "a.func2"); // Test hooks on function 1 (the return value of hooks don't matter) sc->exec("func1(23)"); // Test hooks on function 2 sc->exec("a.func2(42, 53)"); CHECK_EQUAL(2, hook1Called); CHECK_EQUAL(23, hook1CallVal); CHECK_EQUAL(1, hook1aCalled); CHECK_EQUAL(23, hook1aCallVal); CHECK_EQUAL(1, hook2Called); CHECK_EQUAL(42, hook2CallVal1); CHECK_EQUAL(53, hook2CallVal2); // Test failure cases // Invalid function names sc->setExpectedExceptionFlag(true); CHECK_THROW( sc->strictHook(&myHook1, "func3"), LuaNonExistantFunction); CHECK_THROW( sc->strictHook(&myHook2, "b.func2"), LuaNonExistantFunction); // Incompatible function signatures CHECK_THROW( sc->strictHook(&myHook1, "a.func2"), LuaInvalidFunSignature); CHECK_THROW( sc->strictHook(&myHook1a, "a.func2"), LuaInvalidFunSignature); CHECK_THROW( sc->strictHook(&myHook2, "func1"), LuaInvalidFunSignature); sc->setExpectedExceptionFlag(false); } static int i1 = 0; static string s1 = "nop"; static bool b1 = false; static void set_i1(int a) {i1 = a;} static void set_s1(string s) {s1 = s;} static void set_b1(bool a) {b1 = a;} static int get_i1() {return i1;} static string get_s1() {return s1;} static bool get_b1() {return b1;} static void paste_i1() {i1 = 25;} int ti1 = 0, ti2 = 0, ti3 = 0, ti4 = 0, ti5 = 0, ti6 = 0; static void set_1ti(int i1) {ti1 = i1;} static void set_2ti(int i1, int i2) { ti1 = i1; ti2 = i2 ;} static void set_3ti(int i1, int i2, int i3) { ti1 = i1; ti2 = i2; ti3 = i3; } static void set_4ti(int i1, int i2, int i3, int i4) { ti1 = i1; ti2 = i2; ti3 = i3; ti4 = i4; } static void set_5ti(int i1, int i2, int i3, int i4, int i5) { ti1 = i1; ti2 = i2; ti3 = i3; ti4 = i4; ti5 = i5;} static void set_6ti(int i1, int i2, int i3, int i4, int i5, int i6) { ti1 = i1; ti2 = i2; ti3 = i3; ti4 = i4; ti5 = i5; ti6 = i6;} static string testParamReturn(int a, bool b, float c, string s) { ostringstream os; os << "Out: " << a << " " << b << " " << c << " " << s; return os.str(); } TEST(CallingLuaScript) { TEST_HEADER; unique_ptr sc(new LuaScripting()); sc->registerFunction(&set_i1, "set_i1", "", true); sc->registerFunction(&set_s1, "set_s1", "", true); sc->registerFunction(&set_b1, "set_b1", "", true); sc->registerFunction(&paste_i1, "paste_i1", "", true); sc->registerFunction(&get_i1, "get_i1", "", false); sc->registerFunction(&get_s1, "get_s1", "", false); sc->registerFunction(&get_b1, "get_b1", "", false); // Test execute function and executeRet function. sc->exec("set_i1(34)"); CHECK_EQUAL(34, i1); sc->exec("provenance.undo()"); CHECK_EQUAL(0, i1); CHECK_EQUAL(0, sc->execRet("get_i1()")); sc->exec("set_i1(34)"); CHECK_EQUAL(34, sc->execRet("get_i1()")); sc->exec("set_s1('My String')"); CHECK_EQUAL("My String", s1.c_str()); CHECK_EQUAL("My String", sc->execRet("get_s1()").c_str()); // Test out c++ parameter execution sc->registerFunction(&set_1ti, "set_1ti", "", true); sc->registerFunction(&set_2ti, "set_2ti", "", true); sc->registerFunction(&set_3ti, "set_3ti", "", true); sc->registerFunction(&set_4ti, "set_4ti", "", true); sc->registerFunction(&set_5ti, "set_5ti", "", true); sc->registerFunction(&set_6ti, "set_6ti", "", true); // No parameter versions. sc->cexec("paste_i1"); CHECK_EQUAL(25, sc->cexecRet("get_i1")); // 1 parameter. sc->cexec("set_1ti", 10); CHECK_EQUAL(10, ti1); // 2 parameters sc->cexec("set_2ti", 20, 22); CHECK_EQUAL(20, ti1); CHECK_EQUAL(22, ti2); // 3 parameters sc->cexec("set_3ti", 30, 32, 34); CHECK_EQUAL(30, ti1); CHECK_EQUAL(32, ti2); CHECK_EQUAL(34, ti3); // 4 parameters sc->cexec("set_4ti", 40, 42, 44, 46); CHECK_EQUAL(40, ti1); CHECK_EQUAL(42, ti2); CHECK_EQUAL(44, ti3); CHECK_EQUAL(46, ti4); // 5 parameters sc->cexec("set_5ti", 50, 52, 54, 56, 58); CHECK_EQUAL(50, ti1); CHECK_EQUAL(52, ti2); CHECK_EQUAL(54, ti3); CHECK_EQUAL(56, ti4); CHECK_EQUAL(58, ti5); // 6 parameters sc->cexec("set_6ti", 60, 62, 64, 66, 68, 70); CHECK_EQUAL(60, ti1); CHECK_EQUAL(62, ti2); CHECK_EQUAL(64, ti3); CHECK_EQUAL(66, ti4); CHECK_EQUAL(68, ti5); CHECK_EQUAL(70, ti6); // Multiple parameters, and 1 return value. sc->registerFunction(&testParamReturn, "tpr", "", true); CHECK_EQUAL("Out: 65 1 4.3 str!", sc->cexecRet("tpr", 65, true, 4.3f, "str!").c_str()); } TEST(TestDefaultSettings) { TEST_HEADER; unique_ptr sc(new LuaScripting()); sc->registerFunction(&set_i1, "set_i1", "", true); sc->setDefaults("set_i1", 40, true); sc->registerFunction(&set_s1, "set_s1", "", true); sc->setDefaults("set_s1", "s1", true); sc->registerFunction(&set_b1, "set_b1", "", true); sc->setDefaults("set_b1", true, true); sc->registerFunction(&paste_i1, "paste_i1", "", true); // Ensure we don't have anything on the undo stack already. // (tests to make sure the provenance system was disabled when a call // was made to registered functions inside of setDefaults). sc->setExpectedExceptionFlag(true); CHECK_THROW(sc->exec("provenance.undo()"), LuaProvenanceInvalidUndo); sc->setExpectedExceptionFlag(false); CHECK_EQUAL(40, i1); CHECK_EQUAL("s1", s1.c_str()); CHECK_EQUAL(true, b1); sc->cexec("set_i1", 42); CHECK_EQUAL(42, i1); sc->cexec("set_b1", false); CHECK_EQUAL(false, b1); sc->cexec("set_s1", "new"); CHECK_EQUAL("new", s1.c_str()); sc->exec("provenance.undo()"); CHECK_EQUAL("s1", s1.c_str()); sc->exec("provenance.undo()"); CHECK_EQUAL(true, b1); sc->exec("provenance.undo()"); CHECK_EQUAL(40, i1); sc->exec("provenance.redo()"); CHECK_EQUAL(42, i1); sc->exec("provenance.undo()"); sc->setExpectedExceptionFlag(true); CHECK_THROW(sc->exec("provenance.undo()"), LuaProvenanceInvalidUndo); sc->setExpectedExceptionFlag(false); // Test out c++ parameter execution sc->registerFunction(&set_1ti, "set_1ti", "", true); sc->setDefaults("set_1ti", 10, true); CHECK_EQUAL(10, ti1); sc->registerFunction(&set_2ti, "set_2ti", "", true); sc->setDefaults("set_2ti", 11, 21, true); CHECK_EQUAL(11, ti1); CHECK_EQUAL(21, ti2); sc->registerFunction(&set_3ti, "set_3ti", "", true); sc->setDefaults("set_3ti", 12, 22, 32, true); CHECK_EQUAL(12, ti1); CHECK_EQUAL(22, ti2); CHECK_EQUAL(32, ti3); sc->registerFunction(&set_4ti, "set_4ti", "", true); sc->setDefaults("set_4ti", 13, 23, 33, 43, true); CHECK_EQUAL(13, ti1); CHECK_EQUAL(23, ti2); CHECK_EQUAL(33, ti3); CHECK_EQUAL(43, ti4); sc->registerFunction(&set_5ti, "set_5ti", "", true); sc->setDefaults("set_5ti", 14, 24, 34, 44, 54, true); CHECK_EQUAL(14, ti1); CHECK_EQUAL(24, ti2); CHECK_EQUAL(34, ti3); CHECK_EQUAL(44, ti4); CHECK_EQUAL(54, ti5); sc->registerFunction(&set_6ti, "set_6ti", "", true); sc->setDefaults("set_6ti", 15, 25, 35, 45, 55, 65, true); CHECK_EQUAL(15, ti1); CHECK_EQUAL(25, ti2); CHECK_EQUAL(35, ti3); CHECK_EQUAL(45, ti4); CHECK_EQUAL(55, ti5); CHECK_EQUAL(65, ti6); sc->setExpectedExceptionFlag(true); CHECK_THROW(sc->exec("provenance.undo()"), LuaProvenanceInvalidUndo); sc->setExpectedExceptionFlag(false); sc->cexec("set_6ti", 60, 62, 64, 66, 68, 70); CHECK_EQUAL(60, ti1); CHECK_EQUAL(62, ti2); CHECK_EQUAL(64, ti3); CHECK_EQUAL(66, ti4); CHECK_EQUAL(68, ti5); CHECK_EQUAL(70, ti6); sc->exec("provenance.undo()"); CHECK_EQUAL(15, ti1); CHECK_EQUAL(25, ti2); CHECK_EQUAL(35, ti3); CHECK_EQUAL(45, ti4); CHECK_EQUAL(55, ti5); CHECK_EQUAL(65, ti6); } TEST(MiscPrinting) { TEST_HEADER; unique_ptr sc(new LuaScripting()); sc->registerFunction(&set_i1, "set_i1", "", true); sc->registerFunction(&set_s1, "set_s1", "", true); sc->registerFunction(&set_b1, "set_b1", "", true); sc->registerFunction(&paste_i1, "paste_i1", "", true); sc->registerFunction(&get_i1, "get_i1", "", false); sc->registerFunction(&get_s1, "get_s1", "", false); sc->registerFunction(&get_b1, "get_b1", "", false); sc->exec("help()"); } static float f1 = 0.0; void set_f1(float f) {f1 = f;} void undo_i1(int i) {i1 = i * 2;} void undo_f1(float f) {f1 = f + 2.5f;} void undo_s1(string s){s1 = s + "hi";} void redo_i1(int i) {i1 = i * 4;} void redo_f1(float f) {f1 = f - 5.0f;} void redo_s1(string s){s1 = s + "hi2";} TEST(TestUndoRedoHooks) { TEST_HEADER; // Setup custom undo/redo hooks and test their efficacy. shared_ptr sc(new LuaScripting()); sc->registerFunction(&set_i1, "set_i1", "", true); sc->registerFunction(&set_s1, "set_s1", "", true); sc->registerFunction(&set_b1, "set_b1", "", true); sc->registerFunction(&set_f1, "set_f1", "", true); // Customize undo functions (these undo functions will result in invalid // undo state, but thats what we want in order to detect correct redo/undo // hook installation). sc->setUndoFun(&undo_i1, "set_i1"); sc->setUndoFun(&undo_f1, "set_f1"); sc->setUndoFun(&undo_s1, "set_s1"); sc->setRedoFun(&redo_i1, "set_i1"); sc->setRedoFun(&redo_f1, "set_f1"); sc->setRedoFun(&redo_s1, "set_s1"); sc->exec("set_i1(100)"); sc->exec("set_f1(126.5)"); sc->exec("set_s1('Test')"); CHECK_EQUAL(i1, 100); CHECK_CLOSE(f1, 126.5f, 0.001f); CHECK_EQUAL(s1.c_str(), "Test"); sc->exec("set_i1(1000)"); sc->exec("set_f1(500.0)"); sc->exec("set_s1('nop')"); sc->exec("provenance.undo()"); CHECK_EQUAL("Testhi", s1.c_str()); sc->exec("provenance.undo()"); CHECK_CLOSE(129.0f, f1, 0.001f); sc->exec("provenance.undo()"); CHECK_EQUAL(200, i1); sc->exec("provenance.redo()"); CHECK_EQUAL(4000, i1); sc->exec("provenance.redo()"); CHECK_CLOSE(495.0, f1, 0.001f); sc->exec("provenance.redo()"); CHECK_EQUAL("nophi2", s1.c_str()); } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS TEST(TestLuaRTTIChecks) { TEST_HEADER; unique_ptr sc(new LuaScripting()); sc->registerFunction(&testParamReturn, "tpr", "", true); CHECK_EQUAL("Out: 65 1 4.3 str!", sc->cexecRet("tpr", 65, true, 4.3f, "str!").c_str()); // Testing automatic type conversion. We should not got an argument // exception on either the integer parameter, or the floating point param. CHECK_EQUAL("Out: 65 1 4.3 str!", sc->cexecRet("tpr", static_cast(65), true, 4.3, "str!")); sc->setExpectedExceptionFlag(true); CHECK_THROW(sc->cexec("tpr", 12, true), LuaUnequalNumParams); CHECK_THROW(sc->cexec("tpr", 12, true, 4.3f, "s", 1), LuaUnequalNumParams); CHECK_THROW(sc->cexec("tpr", 12, "s", 4.3f, "s"), LuaInvalidType); CHECK_THROW(sc->cexec("tpr", "s", false, 4.3f, "s"), LuaInvalidType); CHECK_THROW(sc->cexec("tpr", 5, false, 32, "s"), LuaInvalidType); CHECK_THROW(sc->cexec("tpr", 5, false, 32.0f, 3), LuaInvalidType); sc->setExpectedExceptionFlag(false); } #endif std::string r1; std::string r2; void strRef1(const std::string& ref) { r1 = ref; } void strRef2(std::string& ref) { r2 = ref; } TEST(TestStringReferences) { TEST_HEADER; unique_ptr sc(new LuaScripting()); sc->registerFunction(&strRef1, "set_r1", "", true); sc->setDefaults("set_r1", "ref 1", true); sc->registerFunction(&strRef2, "set_r2", "", true); sc->setDefaults("set_r2", "ref 2", true); CHECK_EQUAL("ref 1", r1.c_str()); CHECK_EQUAL("ref 2", r2.c_str()); sc->cexec("set_r1", "r1 - change1"); CHECK_EQUAL("r1 - change1", r1.c_str()); sc->cexec("set_r1", "r1 - change2"); CHECK_EQUAL("r1 - change2", r1.c_str()); sc->cexec("set_r2", "r2 - change1"); CHECK_EQUAL("r2 - change1", r2.c_str()); sc->cexec("set_r1", "r1 - change3"); CHECK_EQUAL("r1 - change3", r1.c_str()); sc->cexec("provenance.undo"); CHECK_EQUAL("r1 - change2", r1.c_str()); sc->cexec("provenance.undo"); CHECK_EQUAL("ref 2", r2.c_str()); sc->cexec("provenance.undo"); CHECK_EQUAL("r1 - change1", r1.c_str()); sc->cexec("provenance.undo"); CHECK_EQUAL("ref 1", r1.c_str()); } vector vecA; vector vecB; void vecIntString(vector a, vector b) { vecA.clear(); vecB.clear(); vecA.resize(a.size()); vecB.resize(b.size()); copy(a.begin(), a.end(), vecA.begin()); copy(b.begin(), b.end(), vecB.begin()); } bool predString(string a, string b) { return a.compare(b) == 0; } bool predInt(int a, int b) { return a == b; } TEST(TestVectors) { TEST_HEADER; unique_ptr sc(new LuaScripting()); sc->registerFunction(&vecIntString, "vecIntStr", "", true); vector a; vector b; a.push_back(5); a.push_back(10); a.push_back(15); a.push_back(20); a.push_back(25); a.push_back(30); b.push_back("String 1"); b.push_back("String 2"); b.push_back("Str 3"); b.push_back("Str 4"); b.push_back("Str 5"); sc->cexec("vecIntStr", a, b); CHECK_EQUAL(true, equal(vecA.begin(), vecA.end(), a.begin(), predInt)); CHECK_EQUAL(true, equal(vecB.begin(), vecB.end(), b.begin(), predString)); int intArray[4] = {23, 48, 59, 12}; string strArray[4] = {"str 1", "str 2", "str 3", "str 4"}; sc->exec("vecIntStr({23, 48, 59, 12}, {'str 1', 'str 2', 'str 3', 'str 4'})"); CHECK_EQUAL(true, equal(vecA.begin(), vecA.end(), intArray, predInt)); CHECK_EQUAL(true, equal(vecB.begin(), vecB.end(), strArray, predString)); } // More unit tests are spread out amongst the Lua* files. /// TODO: Add tests for passing shared_ptr's around, and how they work /// with regards to the undo/redo stack. /// TODO: Add tests to check the exceptions thrown in the case of too many / /// too little parameters for cexec, and the return values for execRet. } void printRegisteredFunctions(LuaScripting* s) { vector regFuncs = s->getAllFuncDescs(); printf("\n All registered functions \n"); for (vector::iterator it = regFuncs.begin(); it != regFuncs.end(); ++it) { printf("\n Function: %s\n", it->funcName.c_str()); printf(" Description: %s\n", it->funcDesc.c_str()); printf(" Signature: %s\n", it->funcSig.c_str()); } } #endif ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaProvenance.h0000644000175000017500000002566012320456500021715 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief Provenance system composited inside of the LuaScripting class. Not reentrant (logging and command depth). */ #ifndef TUVOK_LUAPROVENANCE_H_ #define TUVOK_LUAPROVENANCE_H_ #include "LuaMemberRegUnsafe.h" #include namespace tuvok { class LuaScripting; // TODO: Implement MAX size for undo / redo buffer. Think circular buffer, or // just std::vector::erase for simplicity. class LuaProvenance { public: // This class is made for compositing inside LuaScripting, hence the pointer. LuaProvenance(LuaScripting* scripting); ~LuaProvenance(); bool isEnabled() const; void setEnabled(bool enabled); /// Enable/Disable provenance logs of all commands. void enableLogAll(bool enabled); /// Logs the execution of a function. /// \param function Name of the function that executed. /// \param undoRedoStackExempt True if no entry should be genereated inside /// the undo/redo stacks. /// \param funParams The parameters used when executing function. /// \param emptyParams The same type as funParams, but initialized /// to defaults. void logExecution(const std::string& function, bool undoRedoStackExempt, std::shared_ptr funParams, std::shared_ptr emptyParams); // Modifies the last provenance log. void ammendLastProvLog(const std::string& ammend); /// Performs an undo. void issueUndo(); /// Performs a redo. void issueRedo(); /// Registers provenance functions with Lua. /// These functions are NEVER deregistered and persist for the lifetime /// of the associated LuaScripting system. void registerLuaProvenanceFunctions(); /// Clears all provenance and the undo/redo stack. void clearProvenance(); /// Enable / disable the provenance reentry exception. /// Disabling this will not make provenance reentrant. Instead it will not /// throw an exception, and it return from provenance function immediately /// without performing any work. void enableProvReentryEx(bool enable); /// Log hooks will be called directly after the function is called. /// Each parameter indicates the number of hooks called. void logHooks(int staticHooks, int memberHooks); /// Temporarily disables provenance. Used when setting defaults for /// functions in the scripting system. We don't want to register any calls /// to provenance when we are registering defaults. void setDisableProvTemporarily(bool disable); /// Begin a new command group. /// Command groups lump commands together that should be undone / redone /// together. void beginCommand(); /// End a command group. void endCommand(); /// Retrieve command depth. int getCommandDepth() {return mCommandDepth;} /// Testing function to check if the last undo/redo item contains the list /// of deleted items. /// Returns true if all of the deleted items are present. bool testLastURItemHasDeletedItems(const std::vector& delItems) const; /// Testing function to check if the last undo/redo item contains the list /// of created items. /// Returns true if all of the created items are present. bool testLastURItemHasCreatedItems(const std::vector& createdItems)const; /// Looks at the top of the undo/redo stack, and sets the /// 'alsoRedoChildren' flag to true in the UndoRedoItem. void setLastURItemAlsoRedoChildren(); // The following two functions are only meant for LuaClassConstructor // and LuaScripting. /// Adds a deleted instance to the last Undo/Redo item. void addDeletedInstanceToLastURItem(int globalID); /// Adds a constructed instance to the last Undo/Redo item. void addCreatedInstanceToLastURItem(int globalID); private: /// Issue an undo that does NOT check whether instances were created / /// destroyed. void issueUndoInternal(); /// Determines the number of undos that need to be executed in order to /// compeletly rebuild the instances at the given undo index. /// Returns the number of undos that must be executed to get to a state /// directly before the instance object was created. /// Returns 3 integers: /// 1) Number of undos that must be performed /// 2) Lower ID bound for the instances created (lowest ID created). /// 3) Higher ID bound for the instances created (highest ID created). int bruteRerollDetermineUndos(int undoIndex); struct UndoRedoItem { UndoRedoItem(const std::string& funName, std::shared_ptr undo, std::shared_ptr redo) : function(funName), undoParams(undo), redoParams(redo), childItems() , instCreations(), instDeletions(), alsoRedoChildren(false) {} /// Function name we operate on at this stack index. std::string function; /// Prior execution of undoFunction (saved in lastExec table entry). std::shared_ptr undoParams; /// Parameters of the function, exactly as it was called. std::shared_ptr redoParams; /// Child items will be RARELY used. Only by those few functions that /// nest lua provenance enabled function calls inside of other lua /// provenance enabled functions (function composition). Built to perform /// provenance on composited class instances and to handle function /// composition better. /// /// Generally, the undo step will be the only step that cares about these /// child items (redoing will call the function that generated these items /// in the first place -- so redoing will ignore the child items completely) /// I have some hand written notes on the structure of this provenance /// system, if there are any interested parties. std::shared_ptr> childItems; /// Pushing child items like this (along with the way the provenance calls /// functions, then their children) reverses the order in which the /// functions were called originally. We want this for undo. /// /// Reversing the call sequence appropriately resets the state of the /// program back to before the composited function was called (see /// ProvenanceCompositeSingle unit test). Mostly has to deal with the top /// most composited function having different parameter defaults / current /// undoredo stack state. void addChildItem(const UndoRedoItem& item) { if (childItems.get() == NULL) { childItems = std::shared_ptr>( new std::vector()); } childItems->push_back(item); } /// Instance IDs that were created as a result of this call /// (these instance IDs will be contiguous. e.g. [2, 5] or [234, 265], but /// never {245, 246, 248} where we are missing an instance ID in a specific /// range). std::shared_ptr> instCreations; void addInstCreation(int id) { if (instCreations.get() == NULL) { instCreations = std::shared_ptr>( new std::vector()); } instCreations->push_back(id); std::sort(instCreations->begin(), instCreations->end()); } /// Instance IDs that were deleted as a result of this call. std::shared_ptr> instDeletions; void addInstDeletion(int id) { if (instDeletions.get() == NULL) { instDeletions = std::shared_ptr>( new std::vector()); } instDeletions->push_back(id); std::sort(instDeletions->begin(), instDeletions->end()); } /// This flag informs the system that the children of this undo/redo /// item must be explicitly called by the redo mechanism. This is only /// used to group command together. bool alsoRedoChildren; }; typedef std::vector URStackType; // Calls the function at UndoRedoItem index: funcIndex using the params // specified by funcToUse. void performUndoRedoOp(const std::string& funcName, std::shared_ptr params, bool isUndo); std::vector getUndoStackDesc(); void printUndoStack(); std::vector getRedoStackDesc(); void printRedoStack(); std::vector getFullProvenanceDesc(); void printProvRecord(); void printProvRecordToFile(const std::string& file); bool mEnabled; bool mTemporarilyDisabled; bool mUndoingInstanceDel; ///< Used in error checking. URStackType mUndoRedoStack; ///< Contains all undo/redo entries. int mStackPointer; ///< 1 based Index into ///< mUndoRedoStack. /// Provenance description list. Text description of all functions executed to /// this point (including undo/redo exempt functions). std::vector mProvenanceDescList; LuaScripting* const mScripting; LuaMemberRegUnsafe mMemberReg; ///< Used for member registration. /// This flag is only used when issuing an undo or redo. This is to ensure /// we don't get called when we are logging provenance. bool mLoggingProvenance; bool mDoProvReenterException; bool mProvenanceDescLogEnabled; /// Used to disable the provenance system when issuing an undo or redo /// call. bool mUndoRedoProvenanceDisable; /// Current command depth. Only the first command is placed in provenance /// and the undo/redo buffer. The calls deeper than the first command are /// still logged into the provenance logging system for debugging purposes. int mCommandDepth; }; } #endif ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaClassConstructor.cpp0000644000175000017500000001274612320456500023464 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief */ #include #include "LuaScripting.h" #include "LuaProvenance.h" using namespace std; namespace tuvok { const char* LuaClassConstructor::CONS_MD_FACTORY_NAME = "factoryName"; const char* LuaClassConstructor::CONS_MD_FUNC_REGISTRATION_FPTR = "consFptr"; LuaClassConstructor::LuaClassConstructor(LuaScripting* ss) : mSS(ss) { } LuaClassConstructor::~LuaClassConstructor() { } void LuaClassConstructor::addToLookupTable(LuaScripting* ss, lua_State* L, void* ptr, int instID) { // Push our index into the lookup table. Use the class instance pointer // we created earlier as the lookup in this table. if (ss->getFunctionTable(LuaClassInstance::CLASS_LOOKUP_TABLE) == false) throw LuaError("Unable to obtain class lookup table!"); lua_pushlightuserdata(L, ptr); lua_pushinteger(L, instID); lua_settable(L, -3); lua_pop(L, 1); } int LuaClassConstructor::createCoreMetatable(lua_State* L, int instID, int consTable) { // Pull factory name from the constructor table. lua_getfield(L, consTable, CONS_MD_FACTORY_NAME); std::string factoryFQName = lua_tostring(L, -1); lua_pop(L, 1); lua_newtable(L); int mt = lua_gettop(L); lua_pushinteger(L, instID); lua_setfield(L, mt, LuaClassInstance::MD_GLOBAL_INSTANCE_ID); lua_pushstring(L, factoryFQName.c_str()); lua_setfield(L, mt, LuaClassInstance::MD_FACTORY_NAME); lua_pushboolean(L, 0); lua_setfield(L, mt, LuaClassInstance::MD_NO_DELETE_HINT); return mt; } void LuaClassConstructor::finalizeMetatable(lua_State* L, int mt, void* ptr, void* delPtr) { // Setup metatable attributes that depend on the class pointer and // the type FunPtr. lua_pushlightuserdata(L, ptr); lua_setfield(L, mt, LuaClassInstance::MD_INSTANCE); lua_pushlightuserdata(L, delPtr); lua_setfield(L, mt, LuaClassInstance::MD_DEL_FUN); } LuaClassInstance LuaClassConstructor::finalizeInstanceTable(LuaScripting* ss, int instTable, int instID) { LuaClassInstance instance(instID); ss->bindClosureTableWithFQName(instance.fqName(), instTable); return instance; } void LuaClassConstructor::postExecFailure(LuaScripting* ss, LuaClassInstance inst) { string removeClass = inst.fqName(); removeClass += " = nil"; luaL_dostring(ss->getLuaState(), removeClass.c_str()); } void LuaClassConstructor::postExecSuccess(LuaScripting* ss, LuaClassInstance inst) { ss->getProvenanceSys()->addCreatedInstanceToLastURItem( inst.getGlobalInstID()); } LuaClassInstance LuaClassConstructor::buildCoreInstanceTable(lua_State* L, LuaScripting* ss, int consTable, int instID) { // Build instance table. lua_newtable(L); int instTable = lua_gettop(L); createCoreMetatable(L, instID, consTable); // Attach an instance of the instance table so that the constructor // can register its functions. lua_pushvalue(L, -1); lua_setmetatable(L, instTable); // Bind the instance table so that the user can register functions in // their constructor. return finalizeInstanceTable(ss, instTable, instID); } void LuaClassConstructor::finalize(lua_State* L, LuaScripting* ss, void* r, LuaClassInstance inst, int mt, int instTable, void* delFun) { addToLookupTable(ss, L, r, inst.getGlobalInstID()); finalizeMetatable(L, mt, r, delFun); // Remove the metatable first, then the instance table (otherwise, // metatable's index would be one lower than what we recorded). lua_remove(L, mt); lua_remove(L, instTable); // Place function table on the top of the stack (could just leave instTable // on the top of the stack). if (ss->getFunctionTable(inst.fqName()) == false) throw LuaFunBindError("Unable to find table after it was created!"); } } /* namespace tuvok */ ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaClassInstance.cpp0000644000175000017500000000741312320456500022676 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief */ #include #include #include "LuaScripting.h" using namespace std; namespace tuvok { const char* LuaClassInstance::MD_GLOBAL_INSTANCE_ID = "globalID"; const char* LuaClassInstance::MD_FACTORY_NAME = "factoryName"; const char* LuaClassInstance::MD_INSTANCE = "instance"; const char* LuaClassInstance::MD_DEL_FUN = "delFun"; const char* LuaClassInstance::MD_DEL_CALLBACK_PTR = "delCallbackPtr"; const char* LuaClassInstance::MD_NO_DELETE_HINT = "deleteHint"; // NOTE: Only keys that begin with an underscore and are followed by upper // case letters are reserved by Lua. See: // http://www.lua.org/manual/5.2/manual.html#4.5 . As such, we do not use // uppercase lettersin SYSTEMT_TABLE, just lower case letters. const char* LuaClassInstance::SYSTEM_TABLE = "_sys_"; const char* LuaClassInstance::CLASS_INSTANCE_TABLE = "_sys_.inst"; const char* LuaClassInstance::CLASS_INSTANCE_PREFIX = "m"; const char* LuaClassInstance::CLASS_LOOKUP_TABLE = "_sys_.lookup"; LuaClassInstance::LuaClassInstance(int instanceID) : mInstanceID(instanceID) { } LuaClassInstance::LuaClassInstance() : mInstanceID(DEFAULT_INSTANCE_ID) { } //{return mFullyQualifiedName;} std::string LuaClassInstance::fqName() const { std::ostringstream os; os << LuaClassInstance::CLASS_INSTANCE_TABLE << "." << LuaClassInstance::CLASS_INSTANCE_PREFIX << mInstanceID; return os.str(); } bool LuaClassInstance::isDefaultInstance() const { return (mInstanceID == DEFAULT_INSTANCE_ID); } bool LuaClassInstance::isValid(std::shared_ptr ss) const { return isValid(ss.get()); } bool LuaClassInstance::isValid(LuaScripting* ss) const { LuaStackRAII _a(ss->getLuaState(), 0, 0); if (isDefaultInstance()) return false; // Check to see whether an instance is present in the instance table. // If it is not, then this is NOT a valid class. if (ss->getFunctionTable(fqName())) { lua_pop(ss->getLuaState(), 1); return true; } else { return false; } } void* LuaClassInstance::getVoidPointer(LuaScripting* ss) { lua_State* L = ss->getLuaState(); LuaStackRAII _a(L, 0, 0); if (ss->getFunctionTable(fqName()) == false) throw LuaError("Invalid function table."); if (lua_getmetatable(L, -1) == 0) throw LuaError("Unable to obtain function metatable"); lua_getfield(L, -1, MD_INSTANCE); void* r = lua_touserdata(L, -1); lua_pop(L, 3); // Table, metatable, and userdata. return r; } void LuaClassInstance::invalidate() { mInstanceID = DEFAULT_INSTANCE_ID; } } ImageVis3D-3.1.0/Tuvok/LuaScripting/TuvokSpecific/0000755000175000017500000000000012320456500021547 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/LuaScripting/TuvokSpecific/LuaTransferFun2DProxy.h0000644000175000017500000002025512320456500026053 0ustar mathieumathieu /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief Lua proxy for IO's 2D transfer function. */ #ifndef TUVOK_LUATRANSFERFUN2DPROXY_H #define TUVOK_LUATRANSFERFUN2DPROXY_H // Necessary for setting up LuaStrictStack for TFPolygon. #include "IO/TransferFunction2D.h" namespace tuvok { /// @brief classDescription class LuaTransferFun2DProxy { public: LuaTransferFun2DProxy(); virtual ~LuaTransferFun2DProxy(); void bind(TransferFunction2D* tf); static LuaTransferFun2DProxy* luaConstruct() { return new LuaTransferFun2DProxy(); } static void defineLuaInterface(LuaClassRegistration& reg, LuaTransferFun2DProxy* me, LuaScripting* ss); /// Transfer function pointer retrieval. TransferFunction2D* get2DTransferFunction() {return m2DTrans;} private: /// Proxies to split apart overloaded functions. /// @{ bool proxyLoadWithSize(const std::string& file, const VECTOR2& size); bool proxySave(const std::string& file); /// @} /// Update1DTrans proxy exists because IO does not understand Lua types /// (in this case, LuaClassInstance). void proxyUpdate1DTrans(LuaClassInstance tf1d); /// The following proxies exist because it isn't necessary to create a new /// LuaStrictStack template specialization because const we prepended onto /// VECTOR2. VECTOR2 proxyGetSize(); VECTOR2 proxyGetRenderSize(); /// Class registration we received from defineLuaInterface. /// @todo Change to unique pointer. LuaClassRegistration* mReg; /// The 2D transfer function that we represent. TransferFunction2D* m2DTrans; LuaScripting* mSS; }; /// This template specialization converts what it means to be a swatch in C++ /// to what it means to be a swatch in Lua and vice versa. template<> class LuaStrictStack { public: typedef TFPolygon Type; static TFPolygon get(lua_State* L, int pos) { LuaStackRAII _a(L, 0, 0); TFPolygon ret; // There should be a table at 'pos', containing four numerical elements. luaL_checktype(L, pos, LUA_TTABLE); lua_pushstring(L, "radial"); lua_gettable(L, pos); ret.bRadial = LuaStrictStack::get(L, lua_gettop(L)); lua_pop(L, 1); lua_pushstring(L, "points"); lua_gettable(L, pos); ret.pPoints = LuaStrictStack>::get(L, lua_gettop(L)); lua_pop(L, 1); lua_pushstring(L, "gradCoords0"); lua_gettable(L, pos); ret.pGradientCoords[0] = LuaStrictStack::get(L,lua_gettop(L)); lua_pop(L, 1); lua_pushstring(L, "gradCoords1"); lua_gettable(L, pos); ret.pGradientCoords[1] = LuaStrictStack::get(L,lua_gettop(L)); lua_pop(L, 1); lua_pushstring(L, "gradStops"); lua_gettable(L, pos); ret.pGradientStops = LuaStrictStack>::get(L,lua_gettop(L)); return ret; } static void push(lua_State* L, TFPolygon in) { LuaStackRAII _a(L, 0, 1); lua_newtable(L); int tbl = lua_gettop(L); lua_pushstring(L, "radial"); LuaStrictStack::push(L, in.bRadial); lua_settable(L, tbl); lua_pushstring(L, "points"); LuaStrictStack>::push(L, in.pPoints); lua_settable(L, tbl); lua_pushstring(L, "gradCoords0"); LuaStrictStack::push(L, in.pGradientCoords[0]); lua_settable(L, tbl); lua_pushstring(L, "gradCoords1"); LuaStrictStack::push(L, in.pGradientCoords[1]); lua_settable(L, tbl); lua_pushstring(L, "gradStops"); LuaStrictStack>::push(L, in.pGradientStops); lua_settable(L, tbl); } static std::string getValStr(TFPolygon in) { std::ostringstream os; os << "{" << LuaStrictStack::getValStr(in.bRadial) << "," << LuaStrictStack>::getValStr( in.pPoints) << "," << LuaStrictStack::getValStr(in.pGradientCoords[0]) << "," << LuaStrictStack::getValStr(in.pGradientCoords[1]) << "," << LuaStrictStack>::getValStr( in.pGradientStops) << "}"; return os.str(); } static std::string getTypeStr() { return "TFPolygon"; } static TFPolygon getDefault() { return TFPolygon(); } }; // Duplicate of the above code, with only const TFPolygon& changed to TFPolygon. template<> class LuaStrictStack { public: typedef TFPolygon Type; static TFPolygon get(lua_State* L, int pos) { LuaStackRAII _a(L, 0, 0); TFPolygon ret; // There should be a table at 'pos', containing four numerical elements. luaL_checktype(L, pos, LUA_TTABLE); lua_pushstring(L, "radial"); lua_gettable(L, pos); ret.bRadial = LuaStrictStack::get(L, lua_gettop(L)); lua_pop(L, 1); lua_pushstring(L, "points"); lua_gettable(L, pos); ret.pPoints = LuaStrictStack>::get(L, lua_gettop(L)); lua_pop(L, 1); lua_pushstring(L, "gradCoords0"); lua_gettable(L, pos); ret.pGradientCoords[0] = LuaStrictStack::get(L,lua_gettop(L)); lua_pop(L, 1); lua_pushstring(L, "gradCoords1"); lua_gettable(L, pos); ret.pGradientCoords[1] = LuaStrictStack::get(L,lua_gettop(L)); lua_pop(L, 1); lua_pushstring(L, "gradStops"); lua_gettable(L, pos); ret.pGradientStops = LuaStrictStack>::get(L,lua_gettop(L)); return ret; } static void push(lua_State* L, TFPolygon in) { LuaStackRAII _a(L, 0, 1); lua_newtable(L); int tbl = lua_gettop(L); lua_pushstring(L, "radial"); LuaStrictStack::push(L, in.bRadial); lua_settable(L, tbl); lua_pushstring(L, "points"); LuaStrictStack>::push(L, in.pPoints); lua_settable(L, tbl); lua_pushstring(L, "gradCoords0"); LuaStrictStack::push(L, in.pGradientCoords[0]); lua_settable(L, tbl); lua_pushstring(L, "gradCoords1"); LuaStrictStack::push(L, in.pGradientCoords[1]); lua_settable(L, tbl); lua_pushstring(L, "gradStops"); LuaStrictStack>::push(L, in.pGradientStops); lua_settable(L, tbl); } static std::string getValStr(TFPolygon in) { std::ostringstream os; os << "{" << LuaStrictStack::getValStr(in.bRadial) << "," << LuaStrictStack>::getValStr( in.pPoints) << "," << LuaStrictStack::getValStr(in.pGradientCoords[0]) << "," << LuaStrictStack::getValStr(in.pGradientCoords[1]) << "," << LuaStrictStack>::getValStr( in.pGradientStops) << "}"; return os.str(); } static std::string getTypeStr() { return "TFPolygon"; } static TFPolygon getDefault() { return TFPolygon(); } }; } // namespace tuvok #endif // TUVOK_LUATRANSFERFUN2DPROXY_H ImageVis3D-3.1.0/Tuvok/LuaScripting/TuvokSpecific/LuaDatasetProxy.h0000644000175000017500000000527412320456500025021 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief A Lua class proxy for IO's dataset class. */ #ifndef TUVOK_LUADATASETPROXY_H_ #define TUVOK_LUADATASETPROXY_H_ #include "../LuaScripting.h" #include "../LuaClassRegistration.h" namespace tuvok { class Dataset; namespace Registrar { // entry point for registering all the tuvok.dataset functions. void dataset(std::shared_ptr&); } class LuaDatasetProxy { public: /// Will be removed in the future... /// @todo when?? enum DatasetType { Unknown=0, UVF }; LuaDatasetProxy(); virtual ~LuaDatasetProxy(); Dataset* CreateDS(const std::string& uvf, unsigned bricksize); void bind(Dataset* ds, std::shared_ptr ss); static LuaDatasetProxy* luaConstruct() {return new LuaDatasetProxy;} static void defineLuaInterface(LuaClassRegistration& reg, LuaDatasetProxy* me, LuaScripting* ss); /// @todo get rid of dataset type when we fix the dataset base class. DatasetType getDatasetType() const {return mDatasetType;} Dataset* getDataset() const {return mDS;} private: std::vector> proxyGetMetadata(); /// Class registration we received from defineLuaInterface. /// @todo Change to unique pointer. LuaClassRegistration* mReg; Dataset* mDS; /// The type of dataset. DatasetType mDatasetType; }; } /* namespace tuvok */ #endif /* TUVOK_LUADATASETPROXY_H_ */ ImageVis3D-3.1.0/Tuvok/LuaScripting/TuvokSpecific/MatrixMath.cpp0000644000175000017500000000412712320456500024335 0ustar mathieumathieu#include #include #include "Basics/Vectors.h" #include "../LuaScripting.h" #include "LuaTuvokTypes.h" #include "MatrixMath.h" static FLOATMATRIX4 RotateX(float angle) { FLOATMATRIX4 matRot; matRot.RotationX(3.141592653589793238462643383*angle/180.0); return matRot; } static FLOATMATRIX4 RotateY(float angle) { FLOATMATRIX4 matRot; matRot.RotationY(3.141592653589793238462643383*angle/180.0); return matRot; } static FLOATMATRIX4 RotateZ(float angle) { FLOATMATRIX4 matRot; matRot.RotationZ(3.141592653589793238462643383*angle/180.0); return matRot; } static FLOATMATRIX4 Translate(float x, float y, float z) { FLOATMATRIX4 matTrans; matTrans.Translation(x, y, z); return matTrans; } static FLOATMATRIX4 Identity() { FLOATMATRIX4 matIdent; return matIdent; } static std::string VecToString(const FLOATVECTOR3& v) { std::ostringstream s; s << "{ " << v.x << ", " << v.y << ", " << v.z << " }"; return s.str(); } static FLOATMATRIX4 MulMatrices(const FLOATMATRIX4& a, const FLOATMATRIX4& b) { return a * b; } void tuvok::registrar::matrix_math(std::shared_ptr& ss) { ss->registerFunction(&RotateX, "matrix.rotateX", "Constructs matrix rotated around x, N degrees.", false); ss->registerFunction(&RotateY, "matrix.rotateY", "Constructs matrix rotated around y, N degrees.", false); ss->registerFunction(&RotateZ, "matrix.rotateZ", "Constructs matrix rotated around z, N degrees.", false); ss->registerFunction(&Translate, "matrix.translate", "Constructs matrix translated by the given x,y,z", false); ss->registerFunction(&Identity, "matrix.identity", "Constructs identity matrix.", false); ss->registerFunction(&MulMatrices, "matrix.multiply", "multiplies two matrices", false); ss->registerFunction(&VecToString, "strvec", "converts vec to string", false); } ImageVis3D-3.1.0/Tuvok/LuaScripting/TuvokSpecific/LuaTransferFun1DProxy.cpp0000644000175000017500000001222212320456500026400 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief A Lua class proxy for IO's TransferFunction1D class. */ #include #include "Controller/Controller.h" #include "IO/TransferFunction1D.h" #include "3rdParty/LUA/lua.hpp" #include "../LuaScripting.h" #include "../LuaClassRegistration.h" #include "LuaTuvokTypes.h" #include "LuaTransferFun1DProxy.h" using namespace tuvok; //------------------------------------------------------------------------------ LuaTransferFun1DProxy::LuaTransferFun1DProxy() : mReg(NULL), m1DTrans(NULL) { } //------------------------------------------------------------------------------ LuaTransferFun1DProxy::~LuaTransferFun1DProxy() { if (mReg != NULL) delete mReg; } //------------------------------------------------------------------------------ void LuaTransferFun1DProxy::bind(TransferFunction1D* tf) { if (mReg == NULL) throw LuaError("Unable to bind transfer function 1D , no class registration" " available."); mReg->clearProxyFunctions(); m1DTrans = tf; if (tf != NULL) { // Register TransferFunction1D functions using tf. std::string id; id = mReg->functionProxy(tf, &TransferFunction1D::GetSize, "getSize", "", false); /// Note: Lua could accept the vector datatype, mutate it, /// and return it back to the transfer function. id = mReg->functionProxy(tf, &TransferFunction1D::GetColorData, "getColorData", "Retrieves mutable color data. " "This function is for C++ use only, to change " "xfer function data in Lua, use getColor and " "setColor.", false); id = mReg->functionProxy(tf, &TransferFunction1D::GetColor, "getColor", "Retrieves the color at 'index'.", false); id = mReg->functionProxy(tf, &TransferFunction1D::SetColor, "setColor", "Sets the color at 'index'.", true); /// @todo In order for provenance to work, we need to always call SetColor /// or have another function that sets all of the color data at once /// (setting all of the color data at once is the more efficient route /// and would transfer into a Lua setting quite easily). } } //------------------------------------------------------------------------------ void LuaTransferFun1DProxy::defineLuaInterface( LuaClassRegistration& reg, LuaTransferFun1DProxy* me, LuaScripting*) { me->mReg = new LuaClassRegistration(reg); /// @todo Determine if the following function should be provenance enabled. reg.function(&LuaTransferFun1DProxy::proxyLoadWithFilenameAndSize, "loadFromFileWithSize", "Loads 'file' into the 1D " " transfer function with 'size'.", false); /// @todo Determine if the following function should be provenance enabled. reg.function(&LuaTransferFun1DProxy::proxySetStdFunction, "setStdFunction", "", true); reg.function(&LuaTransferFun1DProxy::proxySave, "save", "", false); } //------------------------------------------------------------------------------ bool LuaTransferFun1DProxy::proxyLoadWithFilenameAndSize( const std::string& file, size_t size) { if (m1DTrans == NULL) return false; return m1DTrans->Load(file, size); } //------------------------------------------------------------------------------ void LuaTransferFun1DProxy::proxySetStdFunction( float centerPoint, float invGradient, int component, bool invertedStep) { if (m1DTrans == NULL) return; m1DTrans->SetStdFunction(centerPoint, invGradient, component, invertedStep); } //------------------------------------------------------------------------------ bool LuaTransferFun1DProxy::proxySave(const std::string& filename) const { if (m1DTrans == NULL) return false; return m1DTrans->Save(filename); } ImageVis3D-3.1.0/Tuvok/LuaScripting/TuvokSpecific/LuaDatasetProxy.cpp0000644000175000017500000002105012320456500025342 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief A Lua class proxy for IO's dataset class. */ #include #include "3rdParty/LUA/lua.hpp" #include "Controller/Controller.h" #include "IO/DynamicBrickingDS.h" #include "IO/FileBackedDataset.h" #include "IO/IOManager.h" #include "IO/uvfDataset.h" #include "../LuaClassRegistration.h" #include "../LuaScripting.h" #include "LuaDatasetProxy.h" #include "LuaTuvokTypes.h" using namespace std; namespace tuvok { namespace Registrar { void addIOInterface(LuaClassRegistration& reg, Dataset*, LuaScripting*) { reg.function(&Dataset::GetLODLevelCount, "LODs", "help?", false); } // exposes "IOManager::ExportDataset". bool exportDS(LuaClassInstance lua_ds, uint64_t LOD, const std::string& filename) { const LuaDatasetProxy* datasetProxy = lua_ds.getRawPointer(Controller::Instance().LuaScript()); const tuvok::Dataset* ds = datasetProxy->getDataset(); const IOManager& ioman = Controller::Const().IOMan(); return ioman.ExportDataset(dynamic_cast(ds), LOD, filename, "."); } void dataset(std::shared_ptr& ss) { LuaDatasetProxy* proxy = new LuaDatasetProxy; ss->registerClass( proxy, &LuaDatasetProxy::CreateDS, "tuvok.dataset", "creates a new dataset", LuaClassRegCallback::Type(addIOInterface) ); delete proxy; ss->registerFunction(&exportDS, "tuvok.dataset.export", "exports a DS", true); } } LuaDatasetProxy::LuaDatasetProxy() : mReg(NULL) , mDS(NULL) , mDatasetType(Unknown) { } LuaDatasetProxy::~LuaDatasetProxy() { delete mReg; mReg = NULL; mDS = NULL; } Dataset* LuaDatasetProxy::CreateDS(const std::string& uvf, unsigned bricksize) { return Controller::Const().IOMan().CreateDataset(uvf, uint64_t(bricksize), false ); } void LuaDatasetProxy::bind(Dataset* ds, shared_ptr ss) { if (mReg == NULL) throw LuaError("Unable to bind dataset, no class registration available."); mReg->clearProxyFunctions(); mDS = ds; if (ds != NULL) { // Register dataset functions using ds. string id; id = mReg->functionProxy(ds, &Dataset::GetDomainSize, "getDomainSize", "", false); id = mReg->functionProxy(ds, &Dataset::GetRange, "getRange", "", false); id = mReg->functionProxy(ds, &Dataset::GetLODLevelCount, "getLODLevelCount", "", false); id = mReg->functionProxy(ds, &Dataset::GetNumberOfTimesteps, "getNumberOfTimesteps", "", false); id = mReg->functionProxy(ds, &Dataset::GetMeshes, "getMeshes", "", false); // We do NOT want the return values from GetMeshes stuck in the provenance // system (Okay, so the provenance system doesn't store return values, just // function parameters. But it's best to be safe). ss->setProvenanceExempt(id); id = mReg->functionProxy(ds, &Dataset::GetBitWidth, "getBitWidth", "", false); id = mReg->functionProxy(ds, &Dataset::Get1DHistogram, "get1DHistogram", "", false); id = mReg->functionProxy(ds, &Dataset::Get2DHistogram, "get2DHistogram", "", false); id = mReg->functionProxy(ds, &Dataset::SaveRescaleFactors, "saveRescaleFactors", "", false); id = mReg->functionProxy(ds, &Dataset::GetRescaleFactors, "getRescaleFactors", "", false); id = mReg->functionProxy(ds, &Dataset::Clear, "clear", "clears cache data", false); // Attempt to cast the dataset to a file backed dataset. FileBackedDataset* fileDataset = dynamic_cast(ds); if (fileDataset != NULL) { MESSAGE("Binding extra FileBackedDS functions."); id = mReg->functionProxy(fileDataset, &FileBackedDataset::Filename, "fullpath", "Full path to the dataset.", false); id = mReg->functionProxy(ds, &FileBackedDataset::Name, "name", "Dataset descriptive name.", false); } try { BrickedDataset& bds = dynamic_cast(*ds); id = mReg->functionProxy(&bds, &BrickedDataset::GetMaxUsedBrickSizes, "maxUsedBrickSize", "the size of the largest brick", false); } catch(const std::bad_cast&) { WARNING("Not binding BrickedDataset functions."); } try { UVFDataset& uvfDataset = dynamic_cast(*ds); MESSAGE("Binding extra UVF functions."); mDatasetType = UVF; mReg->functionProxy(&uvfDataset, &UVFDataset::RemoveMesh, "removeMesh", "", true); mReg->functionProxy(&uvfDataset, &UVFDataset::AppendMesh, "appendMesh", "", false); id = mReg->functionProxy(&uvfDataset, &UVFDataset::GeometryTransformToFile, "geomTransformToFile", "", false ); ss->setProvenanceExempt(id); } catch(const std::bad_cast&) { WARNING("Not a uvf; not binding mesh functions."); } try { DynamicBrickingDS& dynDS = dynamic_cast(*ds); MESSAGE("Binding dynamic bricking cache control functions"); id = mReg->functionProxy(&dynDS, &DynamicBrickingDS::SetCacheSize, "setCacheSize", "sets the size of the cache, in megabytes.", false); ss->addParamInfo(id, 0, "cacheMB", "cache size (megabytes)"); id = mReg->functionProxy(&dynDS, &DynamicBrickingDS::GetCacheSize, "getCacheSize", "gets the size of the cache, in megabytes.", false); } catch(const std::bad_cast&) { MESSAGE("Not dynamically bricked; not adding cache control functions."); } /// @todo Expose 1D/2D histogram? Currently, it is being transfered /// via shared_ptr. If lua wants to interpret this, the histogram /// will need to be placed in terms that lua can understand. /// Two approaches: /// 1) Add Grid1D to the LuaStrictStack. /// 2) Create a Histogram1D and Histogram2D proxy. /// /// The second solution would be more efficient, since there wouldn't /// be any time spent converting datatypes to and from Lua (and with /// histograms, that time wouldn't be negligible). } } void LuaDatasetProxy::defineLuaInterface( LuaClassRegistration& reg, LuaDatasetProxy* me, LuaScripting* ss) { me->mReg = new LuaClassRegistration(reg); string id; // Register our functions id = reg.function(&LuaDatasetProxy::getDatasetType, "getDSType", "", false); id = reg.function(&LuaDatasetProxy::proxyGetMetadata, "getMetadata", "", false); lua_State* L = ss->getLuaState(); lua_pushinteger(L, DynamicBrickingDS::MM_SOURCE); lua_setglobal(L, "MM_SOURCE"); lua_pushinteger(L, DynamicBrickingDS::MM_PRECOMPUTE); lua_setglobal(L, "MM_PRECOMPUTE"); lua_pushinteger(L, DynamicBrickingDS::MM_DYNAMIC); lua_setglobal(L, "MM_DYNAMIC"); } std::vector> LuaDatasetProxy::proxyGetMetadata() { return mDS->GetMetadata(); } } /* namespace tuvok */ ImageVis3D-3.1.0/Tuvok/LuaScripting/TuvokSpecific/LuaIOManagerProxy.h0000644000175000017500000002331312320456500025230 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief Lua class proxy for IO's IOManager. */ #ifndef TUVOK_LUAIOMANAGERPROXY_H_ #define TUVOK_LUAIOMANAGERPROXY_H_ #include #include #include #include "Basics/Vectors.h" #include "../LuaScripting.h" #include "../LuaClassRegistration.h" #include "../LuaMemberReg.h" class FileStackInfo; namespace tuvok { class Dataset; class LuaIOManagerProxy { public: LuaIOManagerProxy(IOManager* ioman, std::shared_ptr ss); virtual ~LuaIOManagerProxy(); private: IOManager* mIO; LuaMemberReg mReg; std::shared_ptr mSS; void bind(); /// Proxy functions for IOManager. These functions exist because IO /// does not known about LuaScripting. /// @{ bool ExportDataset(LuaClassInstance ds, uint64_t iLODlevel, const std::string& strTargetFilename, const std::string& strTempDir) const; bool ExtractIsosurface( LuaClassInstance ds, uint64_t iLODlevel, double fIsovalue, const FLOATVECTOR4& vfColor, const std::string& strTargetFilename, const std::string& strTempDir) const; bool ExtractImageStack( LuaClassInstance ds, LuaClassInstance tf1d, uint64_t iLODlevel, const std::string& strTargetFilename, const std::string& strTempDir, bool bAllDirs) const; bool ExportMesh(std::shared_ptr mesh, const std::string& strTargetFilename) const; bool ReBrickDataset(const std::string& strSourceFilename, const std::string& strTargetFilename, const std::string& strTempDir) const; bool ConvertDataset(const std::list& files, const std::string& strTargetFilename, const std::string& strTempDir, bool bNoUserInteraction, bool bQuantizeTo8Bit); bool ConvertDatasetWithStack( std::shared_ptr stack, const std::string& strTargetFilename, const std::string& strTempDir, bool bQuantizeTo8Bit); std::tuple AnalyzeDataset( const std::string& strFilename, const std::string& strTempDir); /// @} /// The following evaluateExpression proxy was made because of the /// "throw (tuvok::Exception)" exception specification on /// IOManager::EvaluateExpression. /// When MSVC 2010 attempts to bind IOManager::evaluateExpression, the /// compiler uses a LuaCFunExec template specialization that specifies a /// return type (even though this function is of void return type!). /// Does not happen on clang. void evaluateExpression(const std::string& expr, const std::vector& volumes, const std::string& out_fn) const; }; // This proxy allows us to "easily" serialize to/from Lua. struct TupleStructProxy { UINT64VECTOR3 domSize; FLOATVECTOR3 aspect; unsigned componentSize; int valueType; std::pair fRange; std::pair iRange; std::pair uiRange; }; template<> class LuaStrictStack { public: typedef TupleStructProxy Type; static TupleStructProxy get(lua_State* L, int pos) { LuaStackRAII a_(L, 14, 0); Type ret; // if there's not a table on the top of the stack, something is very wrong. luaL_checktype(L, pos, LUA_TTABLE); for(size_t i=0; i < 3; ++i) { lua_pushinteger(L, i+1); lua_gettable(L, pos); ret.domSize[i] = LuaStrictStack::get(L, lua_gettop(L)); lua_pop(L, 1); } for(size_t i=0; i < 3; ++i) { lua_pushinteger(L, 3+i+1); lua_gettable(L, pos); ret.aspect[i] = LuaStrictStack::get(L, lua_gettop(L)); lua_pop(L, 1); } lua_pushinteger(L, 7); lua_gettable(L, pos); ret.componentSize = LuaStrictStack::get(L, lua_gettop(L)); lua_pushinteger(L, 8); lua_gettable(L, pos); ret.valueType = LuaStrictStack::get(L, lua_gettop(L)); lua_pushinteger(L, 9); lua_gettable(L, pos); ret.fRange.first = LuaStrictStack::get(L, lua_gettop(L)); lua_pushinteger(L, 10); lua_gettable(L, pos); ret.fRange.second = LuaStrictStack::get(L, lua_gettop(L)); lua_pushinteger(L, 11); lua_gettable(L, pos); ret.iRange.first = LuaStrictStack::get(L, lua_gettop(L)); lua_pushinteger(L, 12); lua_gettable(L, pos); ret.iRange.second = LuaStrictStack::get(L, lua_gettop(L)); lua_pushinteger(L, 13); lua_gettable(L, pos); ret.uiRange.first = LuaStrictStack::get(L, lua_gettop(L)); lua_pushinteger(L, 14); lua_gettable(L, pos); ret.uiRange.second = LuaStrictStack::get(L, lua_gettop(L)); return ret; } static void push(lua_State* L, TupleStructProxy data) { LuaStackRAII a_(L, 0, 14); lua_newtable(L); int tblposition = lua_gettop(L); for(size_t i=0; i < 3; ++i) { lua_pushinteger(L, i+1); LuaStrictStack::push(L, data.domSize[i]); lua_settable(L, tblposition); } for(size_t i=0; i < 3; ++i) { lua_pushinteger(L, 3+i+1); LuaStrictStack::push(L, data.aspect[i]); lua_settable(L, tblposition); } lua_pushinteger(L, 7); LuaStrictStack::push(L, data.componentSize); lua_settable(L, tblposition); lua_pushinteger(L, 8); LuaStrictStack::push(L, data.valueType); lua_settable(L, tblposition); lua_pushinteger(L, 9); LuaStrictStack::push(L, data.fRange.first); lua_settable(L, tblposition); lua_pushinteger(L, 10); LuaStrictStack::push(L, data.fRange.second); lua_settable(L, tblposition); lua_pushinteger(L, 11); LuaStrictStack::push(L, data.iRange.first); lua_settable(L, tblposition); lua_pushinteger(L, 12); LuaStrictStack::push(L, data.iRange.second); lua_settable(L, tblposition); lua_pushinteger(L, 13); LuaStrictStack::push(L, data.uiRange.first); lua_settable(L, tblposition); lua_pushinteger(L, 14); LuaStrictStack::push(L, data.uiRange.second); lua_settable(L, tblposition); } static std::string getValStr(TupleStructProxy in) { std::ostringstream oss; oss << "{ " << "[ " << in.domSize[0] << ", " << in.domSize[1] << ", " << in.domSize[2] << " ], [" << in.aspect[0] << ", " << in.aspect[1] << ", " << in.aspect[2] << "]," << " " << in.componentSize << ", " << in.valueType << ", (" << in.fRange.first << ", " << in.fRange.second << "), (" << in.iRange.first << ", " << in.iRange.second << "), (" << in.uiRange.first << ", " << in.uiRange.second << ") }"; return oss.str(); } static std::string getTypesStr() { return "TupleStructProxy"; } static TupleStructProxy getDefault() { return TupleStructProxy(); } }; template<> class LuaStrictStack { public: typedef RangeInfo Type; static RangeInfo get(lua_State* L, int pos) { TupleStructProxy tupleProxy = LuaStrictStack::get(L, pos); RangeInfo ret; ret.m_vDomainSize = tupleProxy.domSize; ret.m_vAspect = tupleProxy.aspect; ret.m_iComponentSize = tupleProxy.componentSize; ret.m_iValueType = tupleProxy.valueType; ret.m_fRange = tupleProxy.fRange; ret.m_iRange = tupleProxy.iRange; ret.m_uiRange = tupleProxy.uiRange; return ret; } static TupleStructProxy makeTupleFromStruct(RangeInfo in) { TupleStructProxy tupleProxy = { /* .domSize = */ in.m_vDomainSize, /* .aspect = */ in.m_vAspect, /* .componentSize = */ in.m_iComponentSize, /* .valueType = */ in.m_iValueType, /* .fRange = */ in.m_fRange, /* .iRange = */ in.m_iRange, /* .uiRange = */ in.m_uiRange }; return tupleProxy; } static void push(lua_State* L, RangeInfo in) { TupleStructProxy tupleProxy = makeTupleFromStruct(in); LuaStrictStack::push(L, tupleProxy); } static std::string getValStr(RangeInfo in) { TupleStructProxy tupleProxy = makeTupleFromStruct(in); return LuaStrictStack::getValStr(tupleProxy); } static std::string getTypeStr() { return "RangeInfo"; } static RangeInfo getDefault() { return RangeInfo(); } }; } /* namespace tuvok */ #endif /* TUVOK_LUAIOMANAGERPROXY_H_ */ ImageVis3D-3.1.0/Tuvok/LuaScripting/TuvokSpecific/LuaTransferFun1DProxy.h0000644000175000017500000000503512320456500026051 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief Lua proxy for IO's 1D transfer function. */ #ifndef TUVOK_LUATRANSFERFUN1DPROXY_H #define TUVOK_LUATRANSFERFUN1DPROXY_H class TransferFunction1D; namespace tuvok { /// @brief classDescription class LuaTransferFun1DProxy { public: LuaTransferFun1DProxy(); virtual ~LuaTransferFun1DProxy(); void bind(TransferFunction1D* tf); static LuaTransferFun1DProxy* luaConstruct() { return new LuaTransferFun1DProxy(); } static void defineLuaInterface(LuaClassRegistration& reg, LuaTransferFun1DProxy* me, LuaScripting* ss); /// Transfer function pointer retrieval. TransferFunction1D* get1DTransferFunction() {return m1DTrans;} private: /// Auxiliary functions bool proxyLoadWithFilenameAndSize(const std::string& file, size_t size); void proxySetStdFunction(float centerPoint, float invGradient, int component, bool invertedStep); bool proxySave(const std::string& filename) const; /// Class registration we received from defineLuaInterface. /// @todo Change to unique pointer. LuaClassRegistration* mReg; /// The 1D transfer function that we represent. TransferFunction1D* m1DTrans; }; } // namespace tuvok #endif // TUVOK_LUATRANSFERFUN1DPROXY_H ImageVis3D-3.1.0/Tuvok/LuaScripting/TuvokSpecific/LuaTuvokTypes.cpp0000644000175000017500000001204612320456500025055 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. License for the specific language governing rights and limitations under Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "LuaTuvokTypes.h" namespace tuvok { //----------------------------------------------------------------------------- VECTOR4 luaMakeV4(float x, float y, float z, float w) { /// @todo Convert these into non-register function calls. Use lua directly. /// The reason is so that we can overload the call and have it used for /// multiple different input parameter types. // Create the vector 4 and push it onto the lua stack. VECTOR4 v(x,y,z,w); return v; } //----------------------------------------------------------------------------- MATRIX4 luaMakeM44() { /// @todo Convert these into non-register function calls. Use lua directly. /// The reason is so that we can overload the call and have it used for /// multiple different input parameter types. // Default constructor constructs an identity (see Tuvok/Basics/Vectors.h...) // matrix. MATRIX4 m; return m; } //----------------------------------------------------------------------------- void LuaMathFunctions::registerMathFunctions(std::shared_ptr ss) { ss->registerFunction(luaMakeV4, "math.v4", "Generates a numeric vector4.", false); ss->registerFunction(luaMakeM44, "math.m4x4", "Generates a numeric matrix4.", false); lua_State* L = ss->getLuaState(); // Build Matrix4 metatable. if (luaL_newmetatable( L, LuaStrictStack>::getTypeStr().c_str()) == 1) { // Metatable does not already exist in the registry -- populate it. buildMatrix4Metatable(L, lua_gettop(L)); } lua_pop(L, 1); // Build Vector4 metatable. } //----------------------------------------------------------------------------- bool LuaMathFunctions::isOfType(lua_State* L, int object, int mt) { LuaStackRAII _a(L, 0, 0); // Push our metatable onto the top of the stack. int ourMT = mt; // Grab the metatable of the object at 'index'. if (lua_getmetatable(L, object) == 0) { return false; } int theirMT = lua_gettop(L); // Test to see if the metatable of the type given at index is identical // to our types metatable (they will only be identical if they are the // same type). if (lua_rawequal(L, ourMT, theirMT) == 1) { lua_pop(L, 1); return true; } else { lua_pop(L, 1); return false; } } //----------------------------------------------------------------------------- int luaMatrix4Inverse(lua_State* L) { // The table containing the matrix 4 is at the top of the stack. MATRIX4 m = LuaStrictStack>::get(L, 1); LuaStrictStack>::push(L, m.inverse()); return 1; } //----------------------------------------------------------------------------- int luaMatrix4Transpose(lua_State* L) { MATRIX4 m = LuaStrictStack>::get(L, 1); LuaStrictStack>::push(L, m.Transpose()); return 1; } //----------------------------------------------------------------------------- void LuaMathFunctions::buildMatrix4Metatable(lua_State* L, int mt) { // Push the getLuaValStr luaCFunction. lua_pushcfunction(L, &LuaStrictStack>::getLuaValStr); lua_setfield(L, mt, TUVOK_LUA_MT_TYPE_TO_STR_FUN); lua_pushcfunction(L, &LuaStrictStack>::multiplyMetamethod); lua_setfield(L, mt, "__mul"); // Build pre-registered table of operations, and place a reference to it in // the metatable. lua_newtable(L); int opTable = lua_gettop(L); lua_pushcfunction(L, &luaMatrix4Inverse); lua_setfield(L, opTable, "inverse"); lua_pushcfunction(L, &luaMatrix4Transpose); lua_setfield(L, opTable, "transpose"); lua_setfield(L, mt, "__index"); } } // tuvok namespace ImageVis3D-3.1.0/Tuvok/LuaScripting/TuvokSpecific/MatrixMath.h0000644000175000017500000000345012320456500024000 0ustar mathieumathieu#ifndef TUVOK_LUA_MATRIX_MATH #define TUVOK_LUA_MATRIX_MATH #include namespace tuvok { class LuaScripting; namespace registrar { /// Registers a set of matrix-related functions into Lua. /// matrix.rotateX -- returns matrix rotated N degrees around X /// matrix.rotateY -- returns matrix rotated N degrees around Y /// matrix.rotateZ -- returns matrix rotated N degrees around Z /// matrix.translate -- returns matrix translated by X,Y,Z /// matrix.identity -- returns identity matrix /// matrix.multiply -- multiplies two matrices /// strvec -- converts a FLOATVECTOR3 to a string void matrix_math(std::shared_ptr&); } } #endif /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2013 IVDA Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/LuaScripting/TuvokSpecific/LuaTuvokTypes.h0000644000175000017500000007321012320456500024522 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief Exposes specific types found in Tuvok (such as the vector types) to the LuaScripting system. Do NOT include this header file if you are compiling the LuaScripting system outside of Tuvok. */ #ifndef TUVOK_LUATUVOKSPECIFICTYPES_H_ #define TUVOK_LUATUVOKSPECIFICTYPES_H_ #include "3rdParty/LUA/lua.hpp" // LuaFunBinding must always come before our implementation, because we depend // on the templates it has built. #include "../LuaFunBinding.h" // Standard #include "../../Basics/Vectors.h" #include "../../Basics/Plane.h" #include "../../StdTuvokDefines.h" #include "../../Renderer/AbstrRenderer.h" #include "../../Renderer/RenderRegion.h" #include "../../Controller/MasterController.h" #include "LuaDatasetProxy.h" namespace tuvok { // Another possibility is just storing a light user data pointer to the // appropriate 'getValStr', and 'get' functions. Then call: // getValStr(get(L, pos)). /// Utility lua math registration class. class LuaMathFunctions { public: // Called from MasterController to register misc mathematical functions. static void registerMathFunctions(std::shared_ptr ss); // // Utility functions. // // Returns true if the metatable of the object at stack position 'object' // matches the metatable given by the stack position 'mt'. static bool isOfType(lua_State* L, int object, int mt); // Called from getMT in LuaStrictStack> static void buildMatrix4Metatable(lua_State* L, int mtPos); }; // All numeric types are converted to doubles inside Lua. Therefore there is // no need to specialize on the type of vector. template class LuaStrictStack> { public: typedef VECTOR4 Type; static Type get(lua_State* L, int pos) { Type ret; // There should be a table at 'pos', containing four numerical elements. luaL_checktype(L, pos, LUA_TTABLE); // We don't check the metatable here anymore. It is valid to take a table // containing 4 numerical elements, and convert that into a vector. lua_pushinteger(L, 1); lua_gettable(L, pos); ret.x = static_cast(luaL_checknumber(L, -1)); lua_pop(L, 1); lua_pushinteger(L, 2); lua_gettable(L, pos); ret.y = static_cast(luaL_checknumber(L, -1)); lua_pop(L, 1); lua_pushinteger(L, 3); lua_gettable(L, pos); ret.z = static_cast(luaL_checknumber(L, -1)); lua_pop(L, 1); lua_pushinteger(L, 4); lua_gettable(L, pos); ret.w = static_cast(luaL_checknumber(L, -1)); lua_pop(L, 1); return ret; } static void push(lua_State* L, const Type& in) { lua_newtable(L); int tbl = lua_gettop(L); lua_pushinteger(L, 1); lua_pushnumber(L, static_cast(in.x)); lua_settable(L, tbl); lua_pushinteger(L, 2); lua_pushnumber(L, static_cast(in.y)); lua_settable(L, tbl); lua_pushinteger(L, 3); lua_pushnumber(L, static_cast(in.z)); lua_settable(L, tbl); lua_pushinteger(L, 4); lua_pushnumber(L, static_cast(in.w)); lua_settable(L, tbl); // Associate metatable. lua_setmetatable will pop off the metatable. getMT(L); lua_setmetatable(L, tbl); } static std::string getValStr(const Type& in) { std::ostringstream os; os << "{" << in.x << ", " << in.y << ", " << in.z << ", " << in.w << "}"; return os.str(); } static std::string getTypeStr() { return "Vector4"; } static Type getDefault() { return Type(); } // Used to determine if the value at stack location 'index' is of 'our type'. static bool isOurType(lua_State* L, int index) { LuaStackRAII _a(L, 0, 0); getMT(L); bool ret = LuaMathFunctions::isOfType(L, index, lua_gettop(L)); lua_pop(L, 1); return ret; } /// C function called from Lua to obtain a textual description of the data /// in this object. static int getLuaValStr(lua_State* L) { LuaStackRAII _a(L, 0, 1); // The user should have handed us a Lua value of this type. // Check the metatable of the type the user handed us to ensure we are // dealing with the same types. if (isOurType(L, lua_gettop(L))) { LuaStrictStack>::Type val = LuaStrictStack>::get(L, lua_gettop(L)); lua_pushstring(L, LuaStrictStack>:: getValStr(val).c_str()); } else { lua_pushstring(L, "Cannot describe type; invalid type passed into " "getLuaValStr."); } return 1; // Returning 1 result, the textual description of this object. } enum MUL_SEMANTIC { SCALAR_PRODUCT, VECTOR_SCALE_PRODUCT, // I'm not sure what this product should be named. // It is essentially taking the first vector and // constructing a 4x4 matrix whose diagonal entries // are the entries from the vector, then multiplying // the second vector by this matrix. So the first // vector could be seen as scaling the second (or // vice versa). }; static int multiplyMetamethod(lua_State* L) { LuaStackRAII _a(L, 0, 1); // Should only have two values on the stack, one at stack position 1 and // the other at stack position 2. MUL_SEMANTIC semantic = SCALAR_PRODUCT; lua_Number scalar = 0.0; LuaStrictStack>::Type v1; LuaStrictStack>::Type v2; // The first thing we need to do is determine the types of the parameters. if (isOurType(L, 1)) { v1 = LuaStrictStack>::get(L, 1); if (lua_isnumber(L, 2)) // Is the second parameter a scalar? { // Perform a scalar multiplication. scalar = lua_tonumber(L, 2); } else if (isOurType(L, 2)) // Is the second parameter another vector? { semantic = VECTOR_SCALE_PRODUCT; v2 = LuaStrictStack>::get(L, 2); } else { throw LuaError("Unable to perform multiplication. Incompatible " "arguments (vector handler 1)"); } } else { // Must be scalar * vector multiplication. // However, Matrix * vector multiplication would have gotten caught by // the Matrix's metatable. // Check to make sure the value is a scalar... if (lua_isnumber(L, 1)) // Is the first parameter a scalar? { scalar = lua_tonumber(L, 1); if (isOurType(L, 2)) { v1 = LuaStrictStack>::get(L, 2); } else { throw LuaError("Unable to perform multiplication. Incompatible " "arguments (vector handler 2)."); } } else { throw LuaError("Unable to perform multiplication. Incompatible " "arguments (vector handler 3)."); } } // We don't cover matrix * vector multiplication, since that will be covered // by the matrice's meta methods. switch (semantic) { case SCALAR_PRODUCT: LuaStrictStack>::push( L, static_cast(scalar) * v1); break; case VECTOR_SCALE_PRODUCT: LuaStrictStack>::push(L, v1 * v2); break; } return 1; // Return the result of the multiplication. } static int additionMetamethod(lua_State* L) { // There is only one possible way to implement addition. if (isOurType(L, 1) == false) throw LuaError("Unable to perform addition. Incompatible " "arguments (expecting two vectors 1)."); if (isOurType(L, 2) == false) throw LuaError("Unable to perform addition. Incompatible " "arguments (expecting two vectors 2)."); LuaStrictStack>::Type v1 = LuaStrictStack>::get(L, 1); LuaStrictStack>::Type v2 = LuaStrictStack>::get(L, 2); LuaStrictStack>::push(L, v1 + v2); return 1; } static int subtractionMetamethod(lua_State* L) { // This really is just addition with a unary negation... if (isOurType(L, 1) == false) throw LuaError("Unable to perform subtraction. Incompatible " "arguments (expecting two vectors 1)."); if (isOurType(L, 2) == false) throw LuaError("Unable to perform subtraction. Incompatible " "arguments (expecting two vectors 1)."); LuaStrictStack>::Type v1 = LuaStrictStack>::get(L, 1); LuaStrictStack>::Type v2 = LuaStrictStack>::get(L, 2); LuaStrictStack>::push(L, v1 - v2); return 1; } static int unaryNegationMetamethod(lua_State* L) { if (isOurType(L, 1) == false) throw LuaError("Unable to perform unary negation. Incompatible " "argument (expecting a single vector)."); LuaStrictStack>::Type v1 = LuaStrictStack>::get(L, 1); LuaStrictStack>::push(L, -v1); return 1; } // Retrieves the metatable for this type. // The metatable is stored in the Lua registry and only one metatable is // generated for this type, reducing the overhead of the type. static void getMT(lua_State* L) { LuaStackRAII _a(L, 0, 1); if (luaL_newmetatable(L, getTypeStr().c_str()) == 1) { // Metatable does not already exist in the registry -- populate it. int mt = lua_gettop(L); // Push the getLuaValStr luaCFunction. lua_pushcfunction(L, &LuaStrictStack>::getLuaValStr); lua_setfield(L, mt, TUVOK_LUA_MT_TYPE_TO_STR_FUN); lua_pushcfunction(L, &LuaStrictStack>::multiplyMetamethod); lua_setfield(L, mt, "__mul"); lua_pushcfunction(L, &LuaStrictStack>::additionMetamethod); lua_setfield(L, mt, "__add"); lua_pushcfunction(L, &LuaStrictStack>::subtractionMetamethod); lua_setfield(L, mt, "__sub"); lua_pushcfunction(L, &LuaStrictStack>::unaryNegationMetamethod); lua_setfield(L, mt, "__unm"); /// @todo Move to cpp file and add (%) as cross product, and (^) as dot /// product. /// Multiply operator should not perform a dot product, but a component /// wise product, to keep in-line with current vector4 operation. // Add __index metamethod to add various vector functions. } // If luaL_newmetatable returns 0, then there already exists a MT with this // type name: http://www.lua.org/manual/5.2/manual.html#luaL_newmetatable. // Leave it on the top of the stack. } }; template class LuaStrictStack& > { public: typedef VECTOR4 Type; static Type get(lua_State* L, int pos) { return LuaStrictStack::get(L, pos); } static void push(lua_State* L, const Type& in) { LuaStrictStack::push(L, in); } static std::string getValStr(const Type& in) { return LuaStrictStack::getValStr(in); } static std::string getTypeStr() { return LuaStrictStack::getTypeStr(); } static Type getDefault() { return LuaStrictStack::getDefault(); } }; template class LuaStrictStack> { public: typedef VECTOR3 Type; static Type get(lua_State* L, int pos) { Type ret; // There should be a table at 'pos', containing three numerical elements. luaL_checktype(L, pos, LUA_TTABLE); lua_pushinteger(L, 1); lua_gettable(L, pos); ret.x = static_cast(luaL_checknumber(L, -1)); lua_pop(L, 1); lua_pushinteger(L, 2); lua_gettable(L, pos); ret.y = static_cast(luaL_checknumber(L, -1)); lua_pop(L, 1); lua_pushinteger(L, 3); lua_gettable(L, pos); ret.z = static_cast(luaL_checknumber(L, -1)); lua_pop(L, 1); return ret; } static void push(lua_State* L, const Type& in) { lua_newtable(L); int tbl = lua_gettop(L); lua_pushinteger(L, 1); lua_pushnumber(L, static_cast(in.x)); lua_settable(L, tbl); lua_pushinteger(L, 2); lua_pushnumber(L, static_cast(in.y)); lua_settable(L, tbl); lua_pushinteger(L, 3); lua_pushnumber(L, static_cast(in.z)); lua_settable(L, tbl); } static std::string getValStr(const Type& in) { std::ostringstream os; os << "{" << in.x << ", " << in.y << ", " << in.z << "}"; return os.str(); } static std::string getTypeStr() { return "Vector3"; } static Type getDefault() { return Type(); } }; template class LuaStrictStack& > { public: typedef VECTOR3 Type; static Type get(lua_State* L, int pos) { return LuaStrictStack::get(L, pos); } static void push(lua_State* L, const Type& in) { LuaStrictStack::push(L, in); } static std::string getValStr(const Type& in) { return LuaStrictStack::getValStr(in); } static std::string getTypeStr() { return LuaStrictStack::getTypeStr(); } static VECTOR3 getDefault() { return LuaStrictStack::getDefault(); } }; template class LuaStrictStack> { public: typedef VECTOR2 Type; static Type get(lua_State* L, int pos) { Type ret; // There should be a table at 'pos', containing four numerical elements. luaL_checktype(L, pos, LUA_TTABLE); lua_pushinteger(L, 1); lua_gettable(L, pos); ret.x = static_cast(luaL_checknumber(L, -1)); lua_pop(L, 1); lua_pushinteger(L, 2); lua_gettable(L, pos); ret.y = static_cast(luaL_checknumber(L, -1)); lua_pop(L, 1); return ret; } static void push(lua_State* L, const Type& in) { lua_newtable(L); int tbl = lua_gettop(L); lua_pushinteger(L, 1); lua_pushnumber(L, static_cast(in.x)); lua_settable(L, tbl); lua_pushinteger(L, 2); lua_pushnumber(L, static_cast(in.y)); lua_settable(L, tbl); } static std::string getValStr(const Type& in) { std::ostringstream os; os << "{" << in.x << ", " << in.y << "}"; return os.str(); } static std::string getTypeStr() { return "Vector2"; } static Type getDefault() { return Type(); } }; template class LuaStrictStack& > { public: typedef VECTOR2 Type; static Type get(lua_State* L, int pos) { return LuaStrictStack::get(L, pos); } static void push(lua_State* L, const Type& in) { LuaStrictStack::push(L, in); } static std::string getValStr(const Type& in) { return LuaStrictStack::getValStr(in); } static std::string getTypeStr() { return LuaStrictStack::getTypeStr(); } static Type getDefault() { return LuaStrictStack::getDefault(); } }; /// NOTE: We are choosing to store matrices in row-major order because /// initialization of these matrices looks prettier in Lua: /// M = { {0, 1, 0}, /// {1, 2, 1}, /// {0, 1, 0} } /// /// Plus, M[1][2] is a natural analog of the mathematical notation M_12. /// @todo Add metamethods so we can perform linear algebra with the normal /// matrix/matrix and matrix/vector products inside of Lua. template class LuaStrictStack> { public: typedef MATRIX2 Type; static Type get(lua_State* L, int pos) { VECTOR2 rows[2]; luaL_checktype(L, pos, LUA_TTABLE); lua_pushinteger(L, 1); lua_gettable(L, pos); rows[0] = LuaStrictStack>::get(L, lua_gettop(L)); lua_pop(L, 1); lua_pushinteger(L, 2); lua_gettable(L, pos); rows[1] = LuaStrictStack>::get(L, lua_gettop(L)); lua_pop(L, 1); return MATRIX2(rows); } static void push(lua_State* L, const Type& in) { lua_newtable(L); int tbl = lua_gettop(L); // Push rows of the matrix. lua_pushinteger(L, 1); LuaStrictStack>::push(L, VECTOR2(in.m11, in.m12)); lua_settable(L, tbl); lua_pushinteger(L, 2); LuaStrictStack>::push(L, VECTOR2(in.m21, in.m22)); lua_settable(L, tbl); } static std::string getValStr(const Type& in) { std::ostringstream os; os << "{ \n "; os << LuaStrictStack>::getValStr(VECTOR2(in.m11, in.m12)); os << ",\n"; os << " "; os << LuaStrictStack>::getValStr(VECTOR2(in.m21, in.m22)); os << " }"; return os.str(); } static std::string getTypeStr() { return "Matrix22"; } static Type getDefault() { return Type(); } }; template class LuaStrictStack> { public: typedef MATRIX3 Type; static Type get(lua_State* L, int pos) { VECTOR3 rows[3]; luaL_checktype(L, pos, LUA_TTABLE); lua_pushinteger(L, 1); lua_gettable(L, pos); rows[0] = LuaStrictStack>::get(L, lua_gettop(L)); lua_pop(L, 1); lua_pushinteger(L, 2); lua_gettable(L, pos); rows[1] = LuaStrictStack>::get(L, lua_gettop(L)); lua_pop(L, 1); lua_pushinteger(L, 3); lua_gettable(L, pos); rows[2] = LuaStrictStack>::get(L, lua_gettop(L)); lua_pop(L, 1); return MATRIX3(rows); } static void push(lua_State* L, const Type& in) { lua_newtable(L); int tbl = lua_gettop(L); // Push rows of the matrix. lua_pushinteger(L, 1); LuaStrictStack>::push(L, VECTOR3(in.m11, in.m12, in.m13)); lua_settable(L, tbl); lua_pushinteger(L, 2); LuaStrictStack>::push(L, VECTOR3(in.m21, in.m22, in.m23)); lua_settable(L, tbl); lua_pushinteger(L, 3); LuaStrictStack>::push(L, VECTOR3(in.m31, in.m32, in.m33)); lua_settable(L, tbl); } static std::string getValStr(const Type& in) { std::ostringstream os; os << "{ \n "; os << LuaStrictStack>::getValStr(VECTOR3(in.m11, in.m12, in.m13)); os << ",\n"; os << " "; os << LuaStrictStack>::getValStr(VECTOR3(in.m21, in.m22, in.m23)); os << ",\n"; os << " "; os << LuaStrictStack>::getValStr(VECTOR3(in.m31, in.m32, in.m33)); os << " }"; return os.str(); } static std::string getTypeStr() { return "Matrix33"; } static Type getDefault() { return Type(); } }; template class LuaStrictStack> { public: typedef MATRIX4 Type; static Type get(lua_State* L, int pos) { VECTOR4 rows[4]; luaL_checktype(L, pos, LUA_TTABLE); // Check the metatable. if (isOurType(L, pos) == false) throw LuaError("Attempting to convert a vector type that is missing its " "metatable."); lua_pushinteger(L, 1); lua_gettable(L, pos); rows[0] = LuaStrictStack>::get(L, lua_gettop(L)); lua_pop(L, 1); lua_pushinteger(L, 2); lua_gettable(L, pos); rows[1] = LuaStrictStack>::get(L, lua_gettop(L)); lua_pop(L, 1); lua_pushinteger(L, 3); lua_gettable(L, pos); rows[2] = LuaStrictStack>::get(L, lua_gettop(L)); lua_pop(L, 1); lua_pushinteger(L, 4); lua_gettable(L, pos); rows[3] = LuaStrictStack>::get(L, lua_gettop(L)); lua_pop(L, 1); return MATRIX4(rows); } static void push(lua_State* L, const Type& in) { lua_newtable(L); int tbl = lua_gettop(L); // Push rows of the matrix. lua_pushinteger(L, 1); LuaStrictStack>::push(L, VECTOR4(in.m11, in.m12, in.m13, in.m14)); lua_settable(L, tbl); lua_pushinteger(L, 2); LuaStrictStack>::push(L, VECTOR4(in.m21, in.m22, in.m23, in.m24)); lua_settable(L, tbl); lua_pushinteger(L, 3); LuaStrictStack>::push(L, VECTOR4(in.m31, in.m32, in.m33, in.m34)); lua_settable(L, tbl); lua_pushinteger(L, 4); LuaStrictStack>::push(L, VECTOR4(in.m41, in.m42, in.m43, in.m44)); lua_settable(L, tbl); // Associate metatable. lua_setmetatable will pop off the metatable. getMT(L); lua_setmetatable(L, tbl); } static std::string getValStr(const Type& in) { std::ostringstream os; os << "{ \n "; os << LuaStrictStack>::getValStr(VECTOR4(in.m11, in.m12, in.m13, in.m14)); os << ",\n"; os << " "; os << LuaStrictStack>::getValStr(VECTOR4(in.m21, in.m22, in.m23, in.m24)); os << ",\n"; os << " "; os << LuaStrictStack>::getValStr(VECTOR4(in.m31, in.m32, in.m33, in.m34)); os << ",\n"; os << " "; os << LuaStrictStack>::getValStr(VECTOR4(in.m41, in.m42, in.m43, in.m44)); os << " }"; return os.str(); } static std::string getTypeStr() { return "Matrix44"; } static Type getDefault() { return Type(); } // Used to determine if the value at stack location 'index' is of 'our type'. static bool isOurType(lua_State* L, int index) { LuaStackRAII _a(L, 0, 0); getMT(L); bool ret = LuaMathFunctions::isOfType(L, index, lua_gettop(L)); lua_pop(L, 1); return ret; } /// C function called from Lua to obtain a textual description of the data /// in this object. static int getLuaValStr(lua_State* L) { LuaStackRAII _a(L, 0, 1); // The user should have handed us a Lua value of this type. // Check the metatable of the type the user handed us to ensure we are // dealing with the same types. if (isOurType(L, lua_gettop(L))) { LuaStrictStack>::Type val = LuaStrictStack>::get(L, lua_gettop(L)); lua_pushstring(L, LuaStrictStack>:: getValStr(val).c_str()); } else { lua_pushstring(L, "Cannot describe type; invalid type passed into " "getLuaValStr."); } return 1; // Returning 1 result, the textual description of this object. } enum MUL_SEMANTIC { SCALAR_PRODUCT, VECTOR_PRODUCT, MATRIX_PRODUCT, }; static int multiplyMetamethod(lua_State* L) { LuaStackRAII _a(L, 0, 1); // Should only have two values on the stack, one at stack position 1 and // the other at stack position 2. MUL_SEMANTIC semantic = SCALAR_PRODUCT; lua_Number scalar = 0.0; LuaStrictStack>::Type v; LuaStrictStack>::Type m1; LuaStrictStack>::Type m2; // The first thing we need to do is determine the types of the parameters. if (isOurType(L, 1)) { m1 = LuaStrictStack>::get(L, 1); if (lua_isnumber(L, 2)) // Is the second parameter a scalar? { // Perform a scalar multiplication. scalar = lua_tonumber(L, 2); } else if (LuaStrictStack>::isOurType(L, 2)) // Is the second parameter a vector? { semantic = VECTOR_PRODUCT; v = LuaStrictStack>::get(L, 2); } else if (isOurType(L, 2)) // Is the third parameter a matrix? { semantic = MATRIX_PRODUCT; m2 = LuaStrictStack>::get(L, 2); } else { throw LuaError("Unable to perform matrix multiplication. Incompatible " "arguments (1)"); } } else { // MUST be a scalar. The first parameter cannot be a valid matrix, which // is the only other valid multiplication type. if (lua_isnumber(L, 1)) // Is the first parameter a scalar? { scalar = lua_tonumber(L, 1); if (isOurType(L, 2)) { m1 = LuaStrictStack>::get(L, 2); } else if (LuaStrictStack>::isOurType(L, 2)) // Is the second parameter a vector? { throw LuaError("Attempting to multiply 4x1 * 4x4. Multiplication not " "defined."); } else { throw LuaError("Unable to perform multiplication. Incompatible " "arguments (2)."); } } else { throw LuaError("Unable to perform multiplication. Incompatible " "arguments (3)."); } } // We don't cover matrix * vector multiplication, since that will be covered // by the matrice's meta methods. switch (semantic) { case SCALAR_PRODUCT: LuaStrictStack>::push(L, m1 * scalar); break; case VECTOR_PRODUCT: LuaStrictStack>::push(L, m1 * v); break; case MATRIX_PRODUCT: LuaStrictStack>::push(L, m1 * m2); break; } return 1; // Return the result of the multiplication. } // Retrieves the metatable for this type. // The metatable is stored in the Lua registry and only one metatable is // generated for this type, reducing the overhead of the type. static void getMT(lua_State* L) { LuaStackRAII _a(L, 0, 1); if (luaL_newmetatable( L, LuaStrictStack>::getTypeStr().c_str()) == 1) { // Build the metatable LuaMathFunctions::buildMatrix4Metatable(L, lua_gettop(L)); } } }; template class LuaStrictStack& > { public: typedef MATRIX4 Type; static Type get(lua_State* L, int pos) { return LuaStrictStack::get(L, pos); } static void push(lua_State* L, const Type& in) { LuaStrictStack::push(L, in); } static std::string getValStr(const Type& in) { return LuaStrictStack::getValStr(in); } static std::string getTypeStr() { return LuaStrictStack::getTypeStr(); } static MATRIX4 getDefault() { return LuaStrictStack::getDefault(); } }; /// @todo Write extended plane type and update RenderWindow.cpp to use this /// instead of bypassing the LuaClassInstance. template<> class LuaStrictStack { public: typedef ExtendedPlane Type; static Type get(lua_State* L, int pos) { luaL_checktype(L, pos, LUA_TTABLE); lua_pushinteger(L, 1); lua_gettable(L, pos); VECTOR4 plane=LuaStrictStack>::get(L, lua_gettop(L)); lua_pop(L, 1); lua_pushinteger(L, 2); lua_gettable(L, pos); FLOATMATRIX4 m1 = LuaStrictStack::get(L, lua_gettop(L)); lua_pop(L, 1); lua_pushinteger(L, 3); lua_gettable(L, pos); FLOATMATRIX4 m2 = LuaStrictStack::get(L, lua_gettop(L)); lua_pop(L, 1); return ExtendedPlane(m1, m2, plane); } static void push(lua_State* L, const Type& in) { lua_newtable(L); int tbl = lua_gettop(L); // Push rows of the matrix. lua_pushinteger(L, 1); LuaStrictStack>::push(L, VECTOR4(in.Plane().x, in.Plane().y, in.Plane().z, in.Plane().w)); lua_settable(L, tbl); lua_pushinteger(L, 2); LuaStrictStack::push(L, FLOATMATRIX4(in.Mat1())); lua_settable(L, tbl); lua_pushinteger(L, 3); LuaStrictStack::push(L, FLOATMATRIX4(in.Mat2())); lua_settable(L, tbl); } static std::string getValStr(const Type& in) { std::ostringstream os; os << "{ "; os << LuaStrictStack>::getValStr( VECTOR4(in.Plane())); os << " }"; return os.str(); } static std::string getTypeStr() { return "ExtendedPlane"; } static Type getDefault() { return Type(); } }; } // namespace tuvok // Register standard Tuvok enumerations. These enumerations declare their own // namespace, so they must be outside of the tuvok namespace. // TODO: Embelish on this standard enumeration. Should be able to indicate // what values are present in the renderer. TUVOK_LUA_REGISTER_ENUM_TYPE(AbstrRenderer::ERendererType) TUVOK_LUA_REGISTER_ENUM_TYPE(AbstrRenderer::ERendererTarget) TUVOK_LUA_REGISTER_ENUM_TYPE(AbstrRenderer::EStereoMode) TUVOK_LUA_REGISTER_ENUM_TYPE(AbstrRenderer::EBlendPrecision) TUVOK_LUA_REGISTER_ENUM_TYPE(AbstrRenderer::ScalingMethod) TUVOK_LUA_REGISTER_ENUM_TYPE(AbstrRenderer::ERenderMode) TUVOK_LUA_REGISTER_ENUM_TYPE(Interpolant) TUVOK_LUA_REGISTER_ENUM_TYPE(LuaDatasetProxy::DatasetType) TUVOK_LUA_REGISTER_ENUM_TYPE(MasterController::EVolumeRendererType) TUVOK_LUA_REGISTER_ENUM_TYPE(RenderRegion::EWindowMode) #endif /* LUATUVOKSPECIFICTYPES_H_ */ ImageVis3D-3.1.0/Tuvok/LuaScripting/TuvokSpecific/LuaIOManagerProxy.cpp0000644000175000017500000002712512320456500025570 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief Lua class proxy for IO's IOManager. */ #include "Controller/Controller.h" #include "3rdParty/LUA/lua.hpp" #include "IO/IOManager.h" #include "IO/FileBackedDataset.h" #include "IO/uvfDataset.h" #include #include "../LuaScripting.h" #include "../LuaClassRegistration.h" #include "LuaTuvokTypes.h" #include "LuaIOManagerProxy.h" #include "LuaTransferFun1DProxy.h" using namespace std; namespace tuvok { LuaIOManagerProxy::LuaIOManagerProxy(IOManager* ioman, std::shared_ptr ss) : mIO(ioman), mReg(ss), mSS(ss) { bind(); } LuaIOManagerProxy::~LuaIOManagerProxy() { mIO = NULL; } void LuaIOManagerProxy::bind() { if (mIO != NULL) { std::string id; const std::string nm = "tuvok.io."; // namespace id = mReg.registerFunction(this, &LuaIOManagerProxy::ExportDataset, nm + "exportDataset", "", false); id = mReg.registerFunction(this, &LuaIOManagerProxy::ExtractIsosurface, nm + "extractIsosurface", "", false); id = mReg.registerFunction(this, &LuaIOManagerProxy::ExtractImageStack, nm + "extractImageStack", "", false); id = mReg.registerFunction(this, &LuaIOManagerProxy::ExportMesh, nm + "exportMesh", "", false); id = mReg.registerFunction(this, &LuaIOManagerProxy::ReBrickDataset, nm + "rebrickDataset", "", false); id = mReg.registerFunction(this, &LuaIOManagerProxy::ConvertDataset, nm + "convertDataset", "", false); id = mReg.registerFunction(this, &LuaIOManagerProxy::ConvertDatasetWithStack, nm + "convertDatasetWithStack", "", false); id = mReg.registerFunction(this, &LuaIOManagerProxy::AnalyzeDataset, nm + "analyzeDataset", "", false); mSS->addParamInfo(id, 0, "MultRet", "Returns a tuple consisting of a " "(1) boolean value representing whether or not the " "function failed, and (2) the RangeInfo structure."); id = mReg.registerFunction(this, &LuaIOManagerProxy::evaluateExpression, nm + "evaluateExpression", "", false); /// Functions that are not overloaded and can be registered directly. id = mReg.registerFunction(mIO, &IOManager::GetMaxBrickSize, nm + "getMaxBrickSize", "", false); id = mReg.registerFunction(mIO, &IOManager::SetMaxBrickSize, nm + "setMaxBrickSize", "", true); id = mReg.registerFunction(mIO, &IOManager::GetBuilderBrickSize, nm + "getBuilderBrickSize", "", false); id = mReg.registerFunction(mIO, &IOManager::GetLoadDialogString, nm + "getLoadDialogString", "", false); id = mReg.registerFunction(mIO, &IOManager::GetGeoExportDialogString, nm + "getGeoExportDialogString", "", false); id = mReg.registerFunction(mIO, &IOManager::HasConverterForExt, nm + "hasConverterForExt", "", false); id = mReg.registerFunction(mIO, &IOManager::HasGeoConverterForExt, nm + "hasGeoConverterForExt", "", false); id = mReg.registerFunction(mIO, &IOManager::LoadMesh, nm + "loadMesh", "", false); id = mReg.registerFunction(mIO, &IOManager::GetLoadGeoDialogString, nm + "getLoadGeoDialogString", "", false); id = mReg.registerFunction(mIO, &IOManager::NeedsConversion, nm + "needsConversion", "", false); id = mReg.registerFunction(mIO, &IOManager::Verify, nm + "verify", "", false); id = mReg.registerFunction(mIO, &IOManager::GetExportDialogString, nm + "getExportDialogString", "", false); id = mReg.registerFunction(mIO, &IOManager::ExportDialogFilterToExt, nm + "exportDialogFilterToExt", "", false); id = mReg.registerFunction(mIO, &IOManager::GetImageExportDialogString, nm + "getImageExportDialogString", "", false); id = mReg.registerFunction(mIO, &IOManager::ImageExportDialogFilterToExt, nm + "imageExportDialogFilterToExt", "", false); id = mReg.registerFunction(mIO, &IOManager::MergeDatasets, nm + "mergeDatasets", "", false); id = mReg.registerFunction(mIO, &IOManager::GetFormatList, nm + "getFormatList", "", false); id = mReg.registerFunction(mIO, &IOManager::GetGeoFormatList, nm + "getGeoFormatList", "", false); id = mReg.registerFunction(mIO, &IOManager::SetUseMedianFilter, nm + "setUseMedianFilter", "", false); id = mReg.registerFunction(mIO, &IOManager::SetClampToEdge, nm + "setClampToEdge", "", false); id = mReg.registerFunction(mIO, &IOManager::SetCompression, nm + "setUVFCompression", "", false); id = mReg.registerFunction(mIO, &IOManager::SetCompressionLevel, nm + "setUVFCompressionLevel", "", false); id = mReg.registerFunction(mIO, &IOManager::SetLayout, nm + "setUVFLayout", "Select brick ordering" " on disk", false); id = mReg.registerFunction(mIO, &IOManager::ScanDirectory, nm + "scanDirectory", "", false); id = mReg.registerFunction(mIO, &IOManager::RegisterFinalConverter, nm + "registerFinalConverter", "", false); id = mReg.registerFunction(mIO, &IOManager::RegisterExternalConverter, nm + "registerExternalConverter", "", false); } } bool LuaIOManagerProxy::ExtractIsosurface( LuaClassInstance ds, uint64_t iLODlevel, double fIsovalue, const FLOATVECTOR4& vfColor, const std::string& strTargetFilename, const std::string& strTempDir) const { if (mSS->cexecRet( ds.fqName() + ".getDSType") != LuaDatasetProxy::UVF) { T_ERROR("tuvok.io.exportDataset only accepts UVF."); return false; } // Convert LuaClassInstance -> LuaDatasetProxy -> UVFdataset LuaDatasetProxy* dsProxy = ds.getRawPointer(mSS); UVFDataset* uvf = dynamic_cast(dsProxy->getDataset()); assert(uvf != NULL); return mIO->ExtractIsosurface(uvf, iLODlevel, fIsovalue, vfColor, strTargetFilename, strTempDir); } bool LuaIOManagerProxy::ExtractImageStack( LuaClassInstance ds, LuaClassInstance tf1d, uint64_t iLODlevel, const std::string& strTargetFilename, const std::string& strTempDir, bool bAllDirs) const { if (mSS->cexecRet( ds.fqName() + ".getDSType") != LuaDatasetProxy::UVF) { T_ERROR("tuvok.io.exportDataset only accepts UVF."); return false; } // Convert LuaClassInstance -> LuaDatasetProxy -> UVFdataset LuaDatasetProxy* dsProxy = ds.getRawPointer(mSS); UVFDataset* uvf = dynamic_cast(dsProxy->getDataset()); assert(uvf != NULL); // Now we need to extract the transfer function... LuaTransferFun1DProxy* tfProxy = tf1d.getRawPointer( mSS); TransferFunction1D* pTrans = tfProxy->get1DTransferFunction(); assert(pTrans != NULL); return mIO->ExtractImageStack( uvf, pTrans, iLODlevel, strTargetFilename, strTempDir, bAllDirs); } bool LuaIOManagerProxy::ExportDataset(LuaClassInstance ds, uint64_t iLODlevel, const string& strTargetFilename, const string& strTempDir) const { if (mSS->cexecRet( ds.fqName() + ".getDSType") != LuaDatasetProxy::UVF) { T_ERROR("tuvok.io.exportDataset only accepts UVF."); return false; } // Convert LuaClassInstance -> LuaDatasetProxy -> UVFdataset LuaDatasetProxy* dsProxy = ds.getRawPointer(mSS); UVFDataset* uvf = dynamic_cast(dsProxy->getDataset()); assert(uvf != NULL); return mIO->ExportDataset(uvf, iLODlevel, strTargetFilename, strTempDir); } bool LuaIOManagerProxy::ExportMesh(shared_ptr mesh, const string& strTargetFilename) const { return mIO->ExportMesh(mesh, strTargetFilename); } bool LuaIOManagerProxy::ReBrickDataset(const string& strSourceFilename, const string& strTargetFilename, const string& strTempDir) const { return mIO->ReBrickDataset(strSourceFilename, strTargetFilename, strTempDir, mIO->GetBuilderBrickSize(), mIO->GetBrickOverlap(), false); } bool LuaIOManagerProxy::ConvertDataset(const list& files, const string& strTargetFilename, const string& strTempDir, bool bNoUserInteraction, bool bQuantizeTo8Bit) { return mIO->ConvertDataset(files, strTargetFilename, strTempDir, bNoUserInteraction, bQuantizeTo8Bit); } bool LuaIOManagerProxy::ConvertDatasetWithStack( shared_ptr stack, const string& strTargetFilename, const string& strTempDir, bool bQuantizeTo8Bit) { /// @todo Convert 'ConvertDataset' to use shared_ptr instead of raw ptr. return mIO->ConvertDataset(stack.get(), strTargetFilename, strTempDir, bQuantizeTo8Bit); } std::tuple LuaIOManagerProxy::AnalyzeDataset( const string& strFilename, const string& strTempDir) { RangeInfo info; bool res = mIO->AnalyzeDataset(strFilename, info, strTempDir); return make_tuple(res, info); } void LuaIOManagerProxy::evaluateExpression( const std::string& expr, const std::vector& volumes, const std::string& out_fn) const { mIO->EvaluateExpression(expr, volumes, out_fn); } } /* namespace tuvok */ ImageVis3D-3.1.0/Tuvok/LuaScripting/TuvokSpecific/LuaTransferFun2DProxy.cpp0000644000175000017500000001561012320456500026405 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief A Lua class proxy for IO's TransferFunction2D class. */ #include #include "Controller/Controller.h" #include "3rdParty/LUA/lua.hpp" #include "../LuaScripting.h" #include "../LuaClassRegistration.h" #include "LuaTuvokTypes.h" #include "LuaTransferFun2DProxy.h" #include "LuaTransferFun1DProxy.h" using namespace tuvok; using namespace std; //------------------------------------------------------------------------------ LuaTransferFun2DProxy::LuaTransferFun2DProxy() : mReg(NULL), m2DTrans(NULL), mSS(NULL) { } //------------------------------------------------------------------------------ LuaTransferFun2DProxy::~LuaTransferFun2DProxy() { if (mReg != NULL) delete mReg; } //------------------------------------------------------------------------------ void LuaTransferFun2DProxy::bind(TransferFunction2D* tf) { if (mReg == NULL) throw LuaError("Unable to bind transfer function 2D , no class registration" " available."); mReg->clearProxyFunctions(); m2DTrans = tf; if (tf != NULL) { // Register TransferFunction2D functions using tf. std::string id; /// @todo Determine which of the following functions should have provenance /// enabled. id = mReg->functionProxy(tf, &TransferFunction2D::SwatchArrayGetSize, "swatchGetCount", "", false); id = mReg->functionProxy(tf, &TransferFunction2D::SwatchPushBack, "swatchPushBack", "", false); id = mReg->functionProxy(tf, &TransferFunction2D::SwatchErase, "swatchErase", "", false); id = mReg->functionProxy(tf, &TransferFunction2D::SwatchInsert, "swatchInsert", "", false); id = mReg->functionProxy(tf, &TransferFunction2D::SwatchUpdate, "swatchUpdate", "", false); id = mReg->functionProxy(tf, &TransferFunction2D::SwatchIsRadial, "swatchIsRadial", "", false); id = mReg->functionProxy(tf, &TransferFunction2D::SwatchSetRadial, "swatchSetRadial", "", true); id = mReg->functionProxy(tf, &TransferFunction2D::SwatchGetNumPoints, "swatchGetNumPoints", "", false); id = mReg->functionProxy(tf, &TransferFunction2D::SwatchErasePoint, "swatchErasePoint", "", false); id = mReg->functionProxy(tf, &TransferFunction2D::SwatchInsertPoint, "swatchInsertPoint", "", false); id = mReg->functionProxy(tf, &TransferFunction2D::SwatchGetGradientCount, "swatchGetGradientCount", "", false); id = mReg->functionProxy(tf, &TransferFunction2D::SwatchGetGradient, "swatchGetGradient", "", false); id = mReg->functionProxy(tf, &TransferFunction2D::SwatchInsertGradient, "swatchInsertGradient", "", true); id = mReg->functionProxy(tf, &TransferFunction2D::SwatchPushBackGradient, "swatchPushBackGradient", "", true); id = mReg->functionProxy(tf, &TransferFunction2D::SwatchEraseGradient, "swatchEraseGradient", "", true); id = mReg->functionProxy(tf, &TransferFunction2D::SwatchUpdateGradient, "swatchUpdateGradient", "", true); id = mReg->functionProxy(tf, &TransferFunction2D::SwatchGet, "swatchGet", "", false); } } //------------------------------------------------------------------------------ void LuaTransferFun2DProxy::defineLuaInterface( LuaClassRegistration& reg, LuaTransferFun2DProxy* me, LuaScripting* ss) { me->mReg = new LuaClassRegistration(reg); me->mSS = ss; reg.function(&LuaTransferFun2DProxy::proxyLoadWithSize, "loadWithSize", "Loads 'file' into the 2D " " transfer function given 'size'.", false); reg.function(&LuaTransferFun2DProxy::proxyGetRenderSize, "getRenderSize", "", false); reg.function(&LuaTransferFun2DProxy::proxyGetSize, "getSize", "", false); reg.function(&LuaTransferFun2DProxy::proxySave, "save", "", false); reg.function(&LuaTransferFun2DProxy::proxyUpdate1DTrans, "update1DTrans", "", false); } //------------------------------------------------------------------------------ bool LuaTransferFun2DProxy::proxyLoadWithSize(const string& file, const VECTOR2& size) { if (m2DTrans == NULL) return false; return m2DTrans->Load(file, size); } //------------------------------------------------------------------------------ VECTOR2 LuaTransferFun2DProxy::proxyGetSize() { if (m2DTrans == NULL) return VECTOR2(); return m2DTrans->GetSize(); } //------------------------------------------------------------------------------ VECTOR2 LuaTransferFun2DProxy::proxyGetRenderSize() { if (m2DTrans == NULL) return VECTOR2(); return m2DTrans->GetRenderSize(); } //------------------------------------------------------------------------------ bool LuaTransferFun2DProxy::proxySave(const std::string& file) { if (m2DTrans == NULL) return false; return m2DTrans->Save(file); } //------------------------------------------------------------------------------ void LuaTransferFun2DProxy::proxyUpdate1DTrans(LuaClassInstance tf1d) { if (m2DTrans == NULL) return; // Extract TransferFunction1D pointer from LuaClassInstance. LuaTransferFun1DProxy* tfProxy = tf1d.getRawPointer_NoSharedPtr(mSS); const TransferFunction1D* p1DTrans = tfProxy->get1DTransferFunction(); m2DTrans->Update1DTrans(p1DTrans); } ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaClassRegistration.cpp0000644000175000017500000015441612320456500023612 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief */ #include #include "LuaScripting.h" using namespace std; namespace tuvok { } /* namespace tuvok */ //============================================================================== // // UNIT TESTING // //============================================================================== #ifdef LUASCRIPTING_UNIT_TESTS #include "utestCommon.h" #include "LuaClassRegistration.h" #include "LuaProvenance.h" using namespace tuvok; SUITE(LuaTestClassRegistration) { int a_constructor = 0; int a_destructor = 0; class A { public: A(int a, float b, string c, shared_ptr ss) { ++a_constructor; i1 = a; i2 = 0; f1 = b; f2 = 0.0f; s1 = c; } ~A() { ++a_destructor; } int i1, i2; float f1, f2; string s1, s2; void set_i1(int i) {i1 = i;} void set_i2(int i) {i2 = i;} int get_i1() {return i1;} int get_i2() {return i2;} void set_f1(float f) {f1 = f;} void set_f2(float f) {f2 = f;} float get_f1() {return f1;} float get_f2() {return f2;} void set_s1(string s) {s1 = s;} void set_s2(string s) {s2 = s;} string get_s1() {return s1;} string get_s2() {return s2;} // Class definition. The real meat defining a class. static void registerFunctions(LuaClassRegistration& d, A* me, LuaScripting* ss) { d.function(&A::set_i1, "set_i1", "", true); d.function(&A::set_i2, "set_i2", "", true); d.function(&A::get_i1, "get_i1", "", false); d.function(&A::get_i2, "get_i2", "", false); d.function(&A::set_f1, "set_f1", "", true); d.function(&A::set_f2, "set_f2", "", true); d.function(&A::get_f1, "get_f1", "", false); d.function(&A::get_f2, "get_f2", "", false); d.function(&A::set_s1, "set_s1", "", true); d.function(&A::set_s2, "set_s2", "", true); d.function(&A::get_s1, "get_s1", "", false); d.function(&A::get_s2, "get_s2", "", false); } static A* luaConstruct(int a, float b, string c, shared_ptr ss) { return new A(a, b, c, ss); } }; int b_constructor = 0; int b_destructor = 0; class B { public: B(shared_ptr ss) { ++b_constructor; i1 = 0; f1 = 0; } ~B() { ++b_destructor; } int i1; float f1; string s1; void set_i1(int i) {i1 = i;} int get_i1() {return i1;} void set_f1(float f) {f1 = f;} float get_f1() {return f1;} void set_s1(string s) {s1 = s;} string get_s1() {return s1;} static void registerFunctions(LuaClassRegistration& d, B* me, LuaScripting* ss) { d.function(&B::set_i1, "set_i1", "", true); d.function(&B::get_i1, "get_i1", "", false); d.function(&B::set_f1, "set_f1", "", true); d.function(&B::get_f1, "get_f1", "", false); d.function(&B::set_s1, "set_s1", "", true); d.function(&B::get_s1, "get_s1", "", false); } static B* luaConstruct(shared_ptr ss) {return new B(ss);} }; TEST(ClassRegistration) { TEST_HEADER; a_destructor = 0; { shared_ptr sc(new LuaScripting()); // Register class definitions. sc->registerClassStatic(&A::luaConstruct, "factory.a1", "a class", LuaClassRegCallback::Type( &A::registerFunctions)); sc->registerClassStatic(&B::luaConstruct, "factory.b1", "b class", LuaClassRegCallback::Type( &B::registerFunctions)); // Test the classes. LuaClassInstance a_1 = sc->cexecRet( "factory.a1.new", 2, 2.63, "str", sc); // Dummy instances to test destructors when the scripting system // goes out of scope. sc->cexecRet("factory.a1.new", 2, 2.63, "str", sc); sc->cexecRet("factory.b1.new", sc); // Testing only the first instance of a1. std::string aInst = a_1.fqName(); A* a = a_1.getRawPointer(sc); CHECK_EQUAL(2, a->i1); CHECK_CLOSE(2.63f, a->f1, 0.001f); CHECK_EQUAL("str", a->s1.c_str()); // Call into the class. sc->exec(aInst + ".set_i1(15)"); sc->exec(aInst + ".set_i2(60)"); sc->exec(aInst + ".set_f1(1.5)"); sc->exec(aInst + ".set_f2(3.5)"); sc->cexec(aInst + ".set_s1", "String 1"); sc->cexec(aInst + ".set_s2", "String 2"); CHECK_EQUAL(15, a->i1); CHECK_EQUAL(15, sc->execRet(aInst + ".get_i1()")); CHECK_EQUAL(60, a->i2); CHECK_EQUAL(60, sc->execRet(aInst + ".get_i2()")); CHECK_CLOSE(1.5f, a->f1, 0.001f); CHECK_CLOSE(1.5f, sc->execRet(aInst + ".get_f1()"), 0.001f); CHECK_CLOSE(3.5f, a->f2, 0.001f); CHECK_CLOSE(3.5f, sc->execRet(aInst + ".get_f2()"), 0.001f); CHECK_EQUAL("String 1", a->s1.c_str()); CHECK_EQUAL("String 1", sc->execRet(aInst + ".get_s1()")); CHECK_EQUAL("String 2", a->s2.c_str()); CHECK_EQUAL("String 2", sc->execRet(aInst + ".get_s2()")); sc->clean(); } // Ensure destructor was called (we created two instances of the class). CHECK_EQUAL(2, a_destructor); CHECK_EQUAL(1, b_destructor); a_destructor = 0; b_destructor = 0; // More thorough checks { shared_ptr sc(new LuaScripting()); // Register class definitions. sc->registerClassStatic(&A::luaConstruct, "factory.a1", "a class", LuaClassRegCallback::Type( &A::registerFunctions)); sc->registerClassStatic(&B::luaConstruct, "factory.b1", "b class", LuaClassRegCallback::Type( &B::registerFunctions)); LuaClassInstance a1 = sc->cexecRet( "factory.a1.new", 2, 6.0, "mystr", sc); { const int csize = 1; int ra[csize] = {0}; const vector v(ra, ra+csize); CHECK_EQUAL(true, sc->getProvenanceSys()->testLastURItemHasCreatedItems(v)); } LuaClassInstance a2 = sc->cexecRet( "factory.a1.new", 4, 2.63, "str", sc); { const int csize = 1; int ra[csize] = {1}; const vector v(ra, ra+csize); CHECK_EQUAL(true, sc->getProvenanceSys()->testLastURItemHasCreatedItems(v)); } LuaClassInstance b1 = sc->cexecRet( "factory.b1.new", sc); { const int csize = 1; int ra[csize] = {2}; const vector v(ra, ra+csize); CHECK_EQUAL(true, sc->getProvenanceSys()->testLastURItemHasCreatedItems(v)); } std::string a1Name = a1.fqName(); A* a1Ptr = a1.getRawPointer(sc); std::string a2Name = a2.fqName(); A* a2Ptr = a2.getRawPointer(sc); std::string b1Name = b1.fqName(); B* b1Ptr = b1.getRawPointer(sc); int a1InstID = a1.getGlobalInstID(); int a2InstID = a2.getGlobalInstID(); int b1InstID = b1.getGlobalInstID(); // Check global ID (a1 == 0, a2 == 1, b1 == 2) CHECK_EQUAL(0, a1InstID); CHECK_EQUAL(1, a2InstID); CHECK_EQUAL(2, b1InstID); sc->exec(a1Name + ".set_i1(15)"); sc->exec(a1Name + ".set_i2(60)"); sc->exec(a1Name + ".set_f1(1.5)"); sc->exec(a1Name + ".set_f2(3.5)"); sc->cexec(a1Name + ".set_s1", "String 1"); sc->cexec(a1Name + ".set_s2", "String 2"); sc->exec(a2Name + ".set_i2(60)"); sc->exec(a2Name + ".set_f2(3.5)"); sc->cexec(a2Name + ".set_s2", "String 2"); sc->exec(b1Name + ".set_i1(158)"); sc->exec(b1Name + ".set_f1(345.89)"); sc->cexec(b1Name + ".set_s1", "B1 str"); // Check a1 CHECK_EQUAL(15, a1Ptr->i1); CHECK_EQUAL(15, sc->execRet(a1Name + ".get_i1()")); CHECK_EQUAL(60, a1Ptr->i2); CHECK_EQUAL(60, sc->execRet(a1Name + ".get_i2()")); CHECK_CLOSE(1.5f, a1Ptr->f1, 0.001f); CHECK_CLOSE(1.5f, sc->execRet(a1Name + ".get_f1()"), 0.001f); CHECK_CLOSE(3.5f, a1Ptr->f2, 0.001f); CHECK_CLOSE(3.5f, sc->execRet(a1Name + ".get_f2()"), 0.001f); CHECK_EQUAL("String 1", a1Ptr->s1.c_str()); CHECK_EQUAL("String 1", sc->execRet(a1Name + ".get_s1()")); CHECK_EQUAL("String 2", a1Ptr->s2.c_str()); CHECK_EQUAL("String 2", sc->execRet(a1Name + ".get_s2()")); // Check a2 CHECK_EQUAL(4, a2Ptr->i1); CHECK_CLOSE(2.63f, a2Ptr->f1, 0.001f); CHECK_EQUAL("str", a2Ptr->s1.c_str()); CHECK_EQUAL(60, a2Ptr->i2); CHECK_CLOSE(3.5f, a2Ptr->f2, 0.001f); CHECK_EQUAL("String 2", a2Ptr->s2); // Check b1 CHECK_EQUAL(158, b1Ptr->i1); CHECK_CLOSE(345.89f, b1Ptr->f1, 0.001f); CHECK_EQUAL("B1 str", b1Ptr->s1); // Check whether the class delete function works. sc->exec("deleteClass(" + a2Name + ")"); sc->setExpectedExceptionFlag(true); CHECK_THROW(sc->exec(a2Name + ".set_i2(60)"), LuaError); sc->setExpectedExceptionFlag(false); CHECK_EQUAL(1, a_destructor); { const int csize = 1; int ra[csize] = {a2InstID}; const vector v(ra, ra+csize); CHECK_EQUAL(true, sc->getProvenanceSys()->testLastURItemHasDeletedItems(v)); } sc->exec("deleteClass(" + a1Name + ")"); CHECK_EQUAL(2, a_destructor); { const int csize = 1; int ra[csize] = {a1InstID}; const vector v(ra, ra+csize); CHECK_EQUAL(true, sc->getProvenanceSys()->testLastURItemHasDeletedItems(v)); } sc->exec("deleteClass(" + b1Name + ")"); CHECK_EQUAL(1, b_destructor); { const int csize = 1; int ra[csize] = {b1InstID}; const vector v(ra, ra+csize); CHECK_EQUAL(true, sc->getProvenanceSys()->testLastURItemHasDeletedItems(v)); } // We MUST do this since we are passing around shared_ptr references // to our LuaScripting class. sc->clean(); } // TODO: Test exceptions. } int hooki1 = 0; float hookf1 = 0.0; string hooks1; void testHookSeti1(int i) { hooki1 = i; } void testHookSetf1(float f) { hookf1 = f; } void testHookSets1(string s) { hooks1 = s; } TEST(ClassHooks) { TEST_HEADER; shared_ptr sc(new LuaScripting()); { sc->registerClassStatic(&A::luaConstruct, "factory.a1", "a class", LuaClassRegCallback::Type( &A::registerFunctions)); LuaClassInstance a_1 = sc->cexecRet( "factory.a1.new", 2, 2.63, "str", sc); std::string aInst = a_1.fqName(); A* a = a_1.getRawPointer(sc); // Hook i1, f1, and s1. // Member function hooks would work in the same way, but using // LuaMemberReg . sc->strictHook(&testHookSeti1, aInst + ".set_i1"); sc->strictHook(&testHookSetf1, aInst + ".set_f1"); sc->strictHook(&testHookSets1, aInst + ".set_s1"); // Call into the class. sc->exec(aInst + ".set_i1(15)"); sc->exec(aInst + ".set_f1(1.5)"); sc->cexec(aInst + ".set_s1", "String 1"); CHECK_EQUAL(15, a->i1); CHECK_EQUAL(15, hooki1); CHECK_CLOSE(1.5f, a->f1, 0.001f); CHECK_CLOSE(1.5f, hookf1, 0.001f); CHECK_EQUAL("String 1", a->s1.c_str()); CHECK_EQUAL("String 1", hooks1); } sc->clean(); } TEST(ClassProvenance) { TEST_HEADER; // Thoroughly test class provenance. shared_ptr sc(new LuaScripting()); // Register class definitions. sc->registerClassStatic(&A::luaConstruct, "factory.a1", "a class", LuaClassRegCallback::Type( &A::registerFunctions)); sc->registerClassStatic(&B::luaConstruct, "factory.b1", "b class", LuaClassRegCallback::Type( &B::registerFunctions)); a_destructor = 0; LuaClassInstance a1 = sc->cexecRet( "factory.a1.new", 2, 2.63, "str", sc); // Testing only the first instance of a1. std::string a1Name = a1.fqName(); A* a1p = a1.getRawPointer(sc); // Call into the class. sc->exec(a1Name + ".set_i1(15)"); sc->exec(a1Name + ".set_i2(60)"); sc->exec(a1Name + ".set_f1(1.5)"); sc->exec(a1Name + ".set_f2(3.5)"); sc->cexec(a1Name + ".set_s1", "String 1"); sc->cexec(a1Name + ".set_s2", "String 2"); sc->exec("deleteClass(" + a1Name + ")"); // RAW POINTER IS NOW BAD. NEED TO REFORM THE POINTER! // THIS IS WHY YOU DON'T USE THE POINTER! b_destructor = 0; LuaClassInstance b1 = sc->cexecRet("factory.b1.new", sc); // Testing only the first instance of a1. std::string b1Name = b1.fqName(); sc->exec(b1Name + ".set_i1(158)"); sc->exec(b1Name + ".set_f1(345.89)"); sc->cexec(b1Name + ".set_s1", "B1 str"); sc->exec("provenance.undo()"); sc->exec("provenance.undo()"); sc->exec("provenance.undo()"); // Delete class b. sc->exec("provenance.undo()"); CHECK_EQUAL(1, b_destructor); // Recreate class a (with its last state) sc->exec("provenance.undo()"); // Since the class was just recreated on undo, we can now get the raw // pointer. a1p = a1.getRawPointer(sc); // Notice, the state is back where it was when we deleted the class. // The provenance system handles this automatically. CHECK_EQUAL(15, a1p->i1); CHECK_EQUAL(60, a1p->i2); CHECK_CLOSE(1.5f, a1p->f1, 0.001f); CHECK_CLOSE(3.5f, a1p->f2, 0.001f); CHECK_EQUAL("String 1", a1p->s1.c_str()); CHECK_EQUAL("String 2", a1p->s2.c_str()); sc->clean(); } shared_ptr gSS; static int c_constructor = 0; static int c_destructor = 0; class C { public: C() : a(gSS->cexecRet("factory.a.new", 2, 2.63, "str", gSS)) { ++c_constructor; i1 = 0; f1 = 0.0f; } ~C() { ++c_destructor; gSS->exec("deleteClass(" + a.fqName() + ")"); // Our responsibility } LuaClassInstance a; int i1; float f1; string s1; void set_i1(int i) {i1 = i;} int get_i1() {return i1;} void set_f1(float f) {f1 = f;} float get_f1() {return f1;} void set_s1(string s) {s1 = s;} string get_s1() {return s1;} // Methods to set i1 values in a. void set_a_i2(int i) { ostringstream os; os << a.fqName() << ".set_i2(" << i << ")"; gSS->exec(os.str()); } int get_a_i2() { return gSS->execRet(a.fqName() + ".get_i2()"); } void set_a_f2(float f) { ostringstream os; os << a.fqName() << ".set_f2(" << f << ")"; gSS->exec(os.str()); } float get_a_f2() { return gSS->execRet(a.fqName() + ".get_f2()"); } void set_a_s2(string s) { ostringstream os; os << a.fqName() << ".set_s2('" << s << "')"; gSS->exec(os.str()); } string get_a_s2() { return gSS->execRet(a.fqName() + "get_s2()"); } static void registerFunctions(LuaClassRegistration& d, C* me, LuaScripting* ss) { d.function(&C::set_i1, "set_i1", "", true); d.function(&C::get_i1, "get_i1", "", false); d.function(&C::set_f1, "set_f1", "", true); d.function(&C::get_f1, "get_f1", "", false); d.function(&C::set_s1, "set_s1", "", true); d.function(&C::get_s1, "get_s1", "", false); d.function(&C::set_a_i2, "set_a_i2", "", true); d.function(&C::get_a_i2, "get_a_i2", "", false); d.function(&C::set_a_f2, "set_a_f2", "", true); d.function(&C::get_a_f2, "get_a_f2", "", false); d.function(&C::set_a_s2, "set_a_s2", "", true); d.function(&C::get_a_s2, "get_a_s2", "", false); } static C* luaConstruct() {return new C();} }; static int d_constructor = 0; static int d_destructor = 0; class D { public: D() : b(gSS->cexecRet("factory.b.new", gSS)) , c(gSS->execRet("factory.c.new()")) { ++d_constructor; } ~D() { ++d_destructor; gSS->exec("deleteClass(" + c.fqName() + ")"); // Our responsibility gSS->exec("deleteClass(" + b.fqName() + ")"); // Our responsibility } LuaClassInstance b; LuaClassInstance c; void set_i1(int i) { ostringstream os; os << b.fqName() << ".set_i1(" << i << ")"; gSS->exec(os.str()); } int get_i1() { return gSS->execRet(b.fqName() + ".get_i1()"); } void set_f1(float f) { ostringstream os; os << b.fqName() << ".set_f1(" << f << ")"; gSS->exec(os.str()); } float get_f1() { return gSS->execRet(b.fqName() + "get_f1()"); } void set_s1(string s) { ostringstream os; os << b.fqName() << ".set_s1('" << s << "')"; gSS->exec(os.str()); } string get_s1() { return gSS->execRet(b.fqName() + "get_s1()"); } // 3 levels of indirection (D -> C -> A) void set_a_i2(int i) { ostringstream os; os << c.fqName() << ".set_a_i2(" << i << ")"; gSS->exec(os.str()); } int get_a_i2() { return gSS->execRet(c.fqName() + ".get_a_i2()"); } void set_a_f2(float f) { ostringstream os; os << c.fqName() << ".set_a_f2(" << f << ")"; gSS->exec(os.str()); } float get_a_f2() { return gSS->execRet(c.fqName() + "get_a_f2()"); } void set_a_s2(string s) { ostringstream os; os << c.fqName() << ".set_a_s2('" << s << "')"; gSS->exec(os.str()); } string get_a_s2() { return gSS->execRet(c.fqName() + "get_a_s2()"); } static void registerFunctions(LuaClassRegistration& d, D* me, LuaScripting* ss) { d.function(&D::set_i1, "set_i1", "", true); d.function(&D::get_i1, "get_i1", "", false); d.function(&D::set_f1, "set_f1", "", true); d.function(&D::get_f1, "get_f1", "", false); d.function(&D::set_s1, "set_s1", "", true); d.function(&D::get_s1, "get_s1", "", false); d.function(&D::set_a_i2, "set_a_i2", "", true); d.function(&D::get_a_i2, "get_a_i2", "", false); d.function(&D::set_a_f2, "set_a_f2", "", true); d.function(&D::get_a_f2, "get_a_f2", "", false); d.function(&D::set_a_s2, "set_a_s2", "", true); d.function(&D::get_a_s2, "get_a_s2", "", false); } static D* luaConstruct() {return new D();} }; // Helps keeps track of destructor / constructor calls. int a_con = 0; int a_des = 0; int b_con = 0; int b_des = 0; int c_con = 0; int c_des = 0; int d_con = 0; int d_des = 0; void compareAccumulators() { CHECK_EQUAL(a_con, a_constructor); CHECK_EQUAL(a_des, a_destructor); CHECK_EQUAL(b_con, b_constructor); CHECK_EQUAL(b_des, b_destructor); CHECK_EQUAL(c_con, c_constructor); CHECK_EQUAL(c_des, c_destructor); CHECK_EQUAL(d_con, d_constructor); CHECK_EQUAL(d_des, d_destructor); } void clearAccumulators() { a_constructor = 0; a_destructor = 0; b_constructor = 0; b_destructor = 0; c_constructor = 0; c_destructor = 0; d_constructor = 0; d_destructor = 0; a_con = 0; a_des = 0; b_con = 0; b_des = 0; c_con = 0; c_des = 0; d_con = 0; d_des = 0; } TEST(ClassProvenanceCompositing) { // Test compositing classes together (new Lua classes are created from // another class' constructor). // This will be a complex case, testing the provenance system's integrity. TEST_HEADER; // Thoroughly test class provenance. gSS = shared_ptr(new LuaScripting()); gSS->registerClassStatic(&A::luaConstruct, "factory.a", "a class", LuaClassRegCallback::Type( &A::registerFunctions)); gSS->registerClassStatic(&B::luaConstruct, "factory.b", "b class", LuaClassRegCallback::Type( &B::registerFunctions)); gSS->registerClassStatic(&C::luaConstruct, "factory.c", "c class", LuaClassRegCallback::Type( &C::registerFunctions)); gSS->registerClassStatic(&D::luaConstruct, "factory.d", "d class", LuaClassRegCallback::Type( &D::registerFunctions)); clearAccumulators(); // Test Just the D class for now (composition). { lua_State* L = gSS->getLuaState(); string lastExecTable = "return deleteClass."; lastExecTable += LuaScripting::TBL_MD_FUN_LAST_EXEC; int tableIndex, numParams; LuaClassInstance d = gSS->execRet("factory.d.new()"); ++a_con; ++b_con; ++c_con; ++d_con; compareAccumulators(); // Obtain instances to all of our classes. string dn = d.fqName(); D* dp = d.getRawPointer(gSS); LuaClassInstance d_c = dp->c; LuaClassInstance d_b = dp->b; string d_cn = d_c.fqName(); C* d_cp = d_c.getRawPointer(gSS); string d_bn = d_b.fqName(); B* d_bp = d_b.getRawPointer(gSS); LuaClassInstance d_c_a = d_cp->a; string d_c_an = d_c_a.fqName(); A* d_c_ap = d_c_a.getRawPointer(gSS); // Set several variables using d's functions. // Set B's variables through C functions gSS->exec(dn + ".set_i1(643)"); gSS->exec(dn + ".set_f1(34.83)"); gSS->exec(dn + ".set_s1('James')"); // Set C's A _#2's variables through C functions. gSS->exec(dn + ".set_a_i2(121)"); gSS->exec(dn + ".set_a_f2(12.21)"); gSS->exec(dn + ".set_a_s2('Hughes')"); // Set C's variables through C. gSS->exec(d_cn + ".set_i1(823)"); gSS->exec(d_cn + ".set_f1(230.212)"); gSS->exec(d_cn + ".set_s1('C Vars')"); // Set A's _#1 variables through A. gSS->exec(d_c_an + ".set_i1(2346)"); gSS->exec(d_c_an + ".set_f1(543.4325)"); gSS->exec(d_c_an + ".set_s1('A Vars')"); // Test that B's variables were set. CHECK_EQUAL(643, d_bp->i1); CHECK_CLOSE(34.83, d_bp->f1, 0.0001f); CHECK_EQUAL("James", d_bp->s1.c_str()); // Test that A's _#2 variables were set. CHECK_EQUAL(121, d_c_ap->i2); CHECK_CLOSE(12.21, d_c_ap->f2, 0.0001f); CHECK_EQUAL("Hughes", d_c_ap->s2.c_str()); // Test that C's variables were set. CHECK_EQUAL(823, d_cp->i1); CHECK_CLOSE(230.212, d_cp->f1, 0.0001f); CHECK_EQUAL("C Vars", d_cp->s1.c_str()); // Test that A's variables were set. CHECK_EQUAL(2346, d_c_ap->i1); CHECK_CLOSE(543.4325, d_c_ap->f1, 0.0001f); CHECK_EQUAL("A Vars", d_c_ap->s1.c_str()); // Undo A's _#1 variables gSS->exec("provenance.undo()"); gSS->exec("provenance.undo()"); gSS->exec("provenance.undo()"); // Remember: A has a constructor, but it does not set its values using // its getter/setter functions, so there state will not be // what the constructor set them as. They will be defaults. // Their state will return to normal once we undo/redo D's // constructor. CHECK_EQUAL(0, d_c_ap->i1); CHECK_CLOSE(0.0, d_c_ap->f1, 0.0001f); CHECK_EQUAL("", d_c_ap->s1.c_str()); // Undo C's variables gSS->exec("provenance.undo()"); gSS->exec("provenance.undo()"); gSS->exec("provenance.undo()"); CHECK_EQUAL(0, d_cp->i1); CHECK_CLOSE(0.0f, d_cp->f1, 0.0001f); CHECK_EQUAL("", d_cp->s1.c_str()); // Undo C's A _#2's variables gSS->exec("provenance.undo()"); gSS->exec("provenance.undo()"); gSS->exec("provenance.undo()"); CHECK_EQUAL(0, d_c_ap->i2); CHECK_CLOSE(0.0f, d_c_ap->f2, 0.0001f); CHECK_EQUAL("", d_c_ap->s2.c_str()); // Undo B's variables gSS->exec("provenance.undo()"); gSS->exec("provenance.undo()"); gSS->exec("provenance.undo()"); CHECK_EQUAL(0, d_bp->i1); CHECK_CLOSE(0.0f, d_bp->f1, 0.0001f); CHECK_EQUAL("", d_bp->s1.c_str()); // Redo all of the way back. gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); // Recheck variables // Test that B's variables were set. CHECK_EQUAL(643, d_bp->i1); CHECK_CLOSE(34.83, d_bp->f1, 0.0001f); CHECK_EQUAL("James", d_bp->s1.c_str()); // Test that A's _#2 variables were set. CHECK_EQUAL(121, d_c_ap->i2); CHECK_CLOSE(12.21, d_c_ap->f2, 0.0001f); CHECK_EQUAL("Hughes", d_c_ap->s2.c_str()); // Test that C's variables were set. CHECK_EQUAL(823, d_cp->i1); CHECK_CLOSE(230.212, d_cp->f1, 0.0001f); CHECK_EQUAL("C Vars", d_cp->s1.c_str()); // Test that A's variables were set. CHECK_EQUAL(2346, d_c_ap->i1); CHECK_CLOSE(543.4325, d_c_ap->f1, 0.0001f); CHECK_EQUAL("A Vars", d_c_ap->s1.c_str()); int oldInstTop = gSS->getCurrentClassInstID(); luaL_dostring(L, lastExecTable.c_str()); tableIndex = lua_gettop(L); lua_pushnil(L); numParams = 0; while (lua_next(L, tableIndex)) { ++numParams; lua_pop(L, 1); } CHECK_EQUAL(1, numParams); // Delete the class. gSS->exec("deleteClass(" + dn + ")"); ++a_des; ++b_des; ++c_des; ++d_des; compareAccumulators(); CHECK_EQUAL(oldInstTop, gSS->getCurrentClassInstID()); // Undo deletion (all classes should be recreated with the above state). gSS->exec("provenance.undo()"); ++a_con; ++b_con; ++c_con; ++d_con; compareAccumulators(); CHECK_EQUAL(oldInstTop, gSS->getCurrentClassInstID()); // Re-grab pointers (the globalID's will not have changed). dp = d.getRawPointer(gSS); d_cp = d_c.getRawPointer(gSS); d_bp = d_b.getRawPointer(gSS); d_c_ap = d_c_a.getRawPointer(gSS); // Recheck variables // Test that B's variables were set. CHECK_EQUAL(643, d_bp->i1); CHECK_CLOSE(34.83, d_bp->f1, 0.0001f); CHECK_EQUAL("James", d_bp->s1.c_str()); // Test that A's _#2 variables were set. CHECK_EQUAL(121, d_c_ap->i2); CHECK_CLOSE(12.21, d_c_ap->f2, 0.0001f); CHECK_EQUAL("Hughes", d_c_ap->s2.c_str()); // Test that C's variables were set. CHECK_EQUAL(823, d_cp->i1); CHECK_CLOSE(230.212, d_cp->f1, 0.0001f); CHECK_EQUAL("C Vars", d_cp->s1.c_str()); // Test that A's variables were set. CHECK_EQUAL(2346, d_c_ap->i1); CHECK_CLOSE(543.4325, d_c_ap->f1, 0.0001f); CHECK_EQUAL("A Vars", d_c_ap->s1.c_str()); gSS->exec("provenance.undo()"); gSS->exec("provenance.undo()"); gSS->exec("provenance.undo()"); gSS->exec("provenance.undo()"); gSS->exec("provenance.undo()"); gSS->exec("provenance.undo()"); gSS->exec("provenance.undo()"); gSS->exec("provenance.undo()"); gSS->exec("provenance.undo()"); gSS->exec("provenance.undo()"); gSS->exec("provenance.undo()"); gSS->exec("provenance.undo()"); CHECK_EQUAL(0, d_c_ap->i1); CHECK_CLOSE(0.0, d_c_ap->f1, 0.0001f); CHECK_EQUAL("", d_c_ap->s1.c_str()); CHECK_EQUAL(0, d_cp->i1); CHECK_CLOSE(0.0f, d_cp->f1, 0.0001f); CHECK_EQUAL("", d_cp->s1.c_str()); CHECK_EQUAL(0, d_c_ap->i2); CHECK_CLOSE(0.0f, d_c_ap->f2, 0.0001f); CHECK_EQUAL("", d_c_ap->s2.c_str()); CHECK_EQUAL(0, d_bp->i1); CHECK_CLOSE(0.0f, d_bp->f1, 0.0001f); CHECK_EQUAL("", d_bp->s1.c_str()); // Undo class creation. gSS->exec("provenance.undo()"); ++a_des; ++b_des; ++c_des; ++d_des; compareAccumulators(); // Redo class creation. gSS->exec("provenance.redo()"); ++a_con; ++b_con; ++c_con; ++d_con; compareAccumulators(); // Re-grab pointers (the globalID's will not have changed). dp = d.getRawPointer(gSS); d_cp = d_c.getRawPointer(gSS); d_bp = d_b.getRawPointer(gSS); d_c_ap = d_c_a.getRawPointer(gSS); // Remember! The constructor was just called. So a's constructed // values should be in the class (2, 2.63, 'str') CHECK_EQUAL(2, d_c_ap->i1); CHECK_CLOSE(2.63, d_c_ap->f1, 0.0001f); CHECK_EQUAL("str", d_c_ap->s1.c_str()); CHECK_EQUAL(0, d_cp->i1); CHECK_CLOSE(0.0f, d_cp->f1, 0.0001f); CHECK_EQUAL("", d_cp->s1.c_str()); CHECK_EQUAL(0, d_c_ap->i2); CHECK_CLOSE(0.0f, d_c_ap->f2, 0.0001f); CHECK_EQUAL("", d_c_ap->s2.c_str()); CHECK_EQUAL(0, d_bp->i1); CHECK_CLOSE(0.0f, d_bp->f1, 0.0001f); CHECK_EQUAL("", d_bp->s1.c_str()); // Redo all of the way back. gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); gSS->exec("provenance.redo()"); // Recheck variables // Test that B's variables were set. CHECK_EQUAL(643, d_bp->i1); CHECK_CLOSE(34.83, d_bp->f1, 0.0001f); CHECK_EQUAL("James", d_bp->s1.c_str()); // Test that A's _#2 variables were set. CHECK_EQUAL(121, d_c_ap->i2); CHECK_CLOSE(12.21, d_c_ap->f2, 0.0001f); CHECK_EQUAL("Hughes", d_c_ap->s2.c_str()); // Test that C's variables were set. CHECK_EQUAL(823, d_cp->i1); CHECK_CLOSE(230.212, d_cp->f1, 0.0001f); CHECK_EQUAL("C Vars", d_cp->s1.c_str()); // Test that A's variables were set. CHECK_EQUAL(2346, d_c_ap->i1); CHECK_CLOSE(543.4325, d_c_ap->f1, 0.0001f); CHECK_EQUAL("A Vars", d_c_ap->s1.c_str()); // Check the last exec table for deleteClass... { luaL_dostring(L, lastExecTable.c_str()); tableIndex = lua_gettop(L); lua_pushnil(L); numParams = 0; while (lua_next(L, tableIndex)) { ++numParams; lua_pop(L, 1); } lua_pop(L, 1); CHECK_EQUAL(1, numParams); } // Redo deletion gSS->exec("provenance.redo()"); ++a_des; ++b_des; ++c_des; ++d_des; compareAccumulators(); { luaL_dostring(L, lastExecTable.c_str()); tableIndex = lua_gettop(L); lua_pushnil(L); numParams = 0; while (lua_next(L, tableIndex)) { ++numParams; lua_pop(L, 1); } lua_pop(L, 1); CHECK_EQUAL(1, numParams); } // We can check this class after we are done below. } // No need to clear the accumulators, just keep them going. // Test interleaving creation of A,B,C, and D. { // This 'z' class will be used to test creating / destroying all // classes when we issue an undo delete on 'z'. LuaClassInstance z = gSS->cexecRet("factory.b.new",gSS); ++b_con; compareAccumulators(); string zn = z.fqName(); // --== Create d ==-- LuaClassInstance d = gSS->execRet("factory.d.new()"); ++a_con; ++b_con; ++c_con; ++d_con; compareAccumulators(); // Obtain instances to all of our classes. string dn = d.fqName(); D* dp = d.getRawPointer(gSS); LuaClassInstance d_c = dp->c; LuaClassInstance d_b = dp->b; string d_cn = d_c.fqName(); C* d_cp = d_c.getRawPointer(gSS); string d_bn = d_b.fqName(); B* d_bp = d_b.getRawPointer(gSS); LuaClassInstance d_c_a = d_cp->a; string d_c_an = d_c_a.fqName(); // A* d_c_ap = d_c_a.getRawPointer(gSS); // Set misc values for d // Set B's variables through C functions gSS->exec(dn + ".set_i1(643)"); gSS->exec(dn + ".set_f1(34.83)"); gSS->exec(dn + ".set_s1('James')"); // Test that B's variables were set. CHECK_EQUAL(643, d_bp->i1); CHECK_CLOSE(34.83, d_bp->f1, 0.0001f); CHECK_EQUAL("James", d_bp->s1.c_str()); // --== Create a ==-- LuaClassInstance a = gSS->cexecRet("factory.a.new", 42, 42.42, "4242-10", gSS); ++a_con; compareAccumulators(); string an = a.fqName(); //A* ap = a.getRawPointer(gSS); // Set misc values for a/d gSS->exec(an + ".set_i2(158)"); gSS->exec(an + ".set_f2(345.89)"); gSS->cexec(an + ".set_s2", "A str"); gSS->exec(dn + ".set_i1(128)"); gSS->exec(dn + ".set_f1(64.64)"); gSS->exec(dn + ".set_s1('bit')"); // --== Create c ==-- LuaClassInstance c = gSS->execRet("factory.c.new()"); ++c_con; ++a_con; compareAccumulators(); string cn = c.fqName(); //C* cp = c.getRawPointer(gSS); gSS->exec(cn + ".set_i1(64)"); gSS->exec(cn + ".set_f1(32.32)"); gSS->exec(cn + ".set_s1('b--')"); // --== Create b ==-- LuaClassInstance b = gSS->cexecRet("factory.b.new",gSS); ++b_con; compareAccumulators(); string bn = b.fqName(); //B* bp = b.getRawPointer(gSS); gSS->exec(bn + ".set_i1(32)"); gSS->exec(bn + ".set_f1(16.16)"); gSS->exec(bn + ".set_s1('-it')"); // --== delete a ==-- gSS->exec("deleteClass(" + an + ")"); ++a_des; compareAccumulators(); // set misc values for b,c,d gSS->exec(bn + ".set_i1(16)"); gSS->exec(bn + ".set_f1(8.8)"); gSS->exec(bn + ".set_s1('test')"); gSS->exec(cn + ".set_i1(8)"); gSS->exec(cn + ".set_f1(4.4)"); gSS->exec(cn + ".set_s1('test2')"); gSS->exec(dn + ".set_a_i2(4)"); gSS->exec(dn + ".set_a_f2(2.2)"); gSS->exec(dn + ".set_a_s2('test3')"); // delete d gSS->exec("deleteClass(" + dn + ")"); ++a_des; ++b_des; ++c_des; ++d_des; compareAccumulators(); // set misc values for c and b gSS->exec(bn + ".set_i1(2)"); gSS->exec(bn + ".set_f1(1.1)"); gSS->exec(bn + ".set_s1('t1')"); gSS->exec(cn + ".set_i1(256)"); gSS->exec(cn + ".set_f1(128.128)"); gSS->exec(cn + ".set_s1('t2')"); // delete b gSS->exec("deleteClass(" + bn + ")"); ++b_des; compareAccumulators(); // set misc values for c gSS->exec(cn + ".set_a_i2(512)"); gSS->exec(cn + ".set_a_f2(256.256)"); gSS->exec(cn + ".set_a_s2('t3')"); // delete c gSS->exec("deleteClass(" + cn + ")"); ++a_des; ++c_des; compareAccumulators(); // delete z gSS->exec("deleteClass(" + zn + ")"); ++b_des; // test undo/redo of this system. clearAccumulators(); // Undo the deletion of z -- this is an extremely large undertaking. // This is the worst case scenario for the brute reroll algorithm in // the provenance system. It ends undoing / redoing everything since // we began this system. gSS->exec("provenance.undo()"); // Keep in mind, everything has been destroyed, so no destructor increase // will be recorded. BUT, every class should be created and destroyed... ++b_con; ++a_con; ++c_con; ++a_des; ++c_des; ++b_con; ++b_des; ++a_con; ++b_con; ++c_con; ++d_con; ++a_des; ++b_des; ++c_des; ++d_des; ++a_con; ++a_des; compareAccumulators(); // All classes but z were created and destroyed in the last call // (due to the nature of brute reroll -- a more intelligent algorithm // could be built. But this works for now, and serves as the base case // we know works). // Undo the deletion of C. gSS->exec("provenance.undo()"); ++c_con; ++a_con; ++b_con; ++b_des; ++a_con; ++b_con; ++c_con; ++d_con; ++a_des; ++b_des; ++c_des; ++d_des; ++a_con; ++a_des; compareAccumulators(); } // Get rid of our global instance. // Because of the bad form we used above (not placing weak pointers in // the instances of the lua classes, and instead reference a global // variabl that contains a reference to the scripting class) we have to get // rid of all registered lua classes before we call reset). gSS->clean(); gSS->removeAllRegistrations(); gSS.reset(); } // Keep a weak pointer reference to ss if stored in X. class X { public: X(shared_ptr ss) {} int i1; float f1; string s1; void set_i1(int i) {i1 = i;} int get_i1() {return i1;} void set_f1(float f) {f1 = f;} float get_f1() {return f1;} void set_s1(string s) {s1 = s;} string get_s1() {return s1;} static void registerFunctions(LuaClassRegistration& d, X* me, LuaScripting* ss) { d.function(&X::set_i1, "set_i1", "", true); d.function(&X::get_i1, "get_i1", "", false); d.function(&X::set_f1, "set_f1", "", true); d.function(&X::get_f1, "get_f1", "", false); d.function(&X::set_s1, "set_s1", "", true); d.function(&X::get_s1, "get_s1", "", false); } }; class Y { public: Y(shared_ptr ss) : mSS(ss) {} X* constructX() { return new X(mSS); } private: shared_ptr mSS; }; TEST(MemberFunctionConstructor) { TEST_HEADER; // Tests out using member functions as constructors. shared_ptr sc(new LuaScripting()); Y* y = new Y(sc); // Register class definitions. sc->registerClass(y, &Y::constructX, "factory.x", "", LuaClassRegCallback::Type( &X::registerFunctions)); // Test the classes. LuaClassInstance xc = sc->cexecRet( "factory.x.new"); // Testing only the first instance of a1. std::string xInst = xc.fqName(); X* x = xc.getRawPointer(sc); // Call into the class. sc->exec(xInst + ".set_i1(15)"); sc->exec(xInst + ".set_f1(1.5)"); sc->cexec(xInst + ".set_s1", "String 1"); CHECK_EQUAL(15, x->i1); CHECK_CLOSE(1.5f, x->f1, 0.001f); CHECK_EQUAL("String 1", x->s1.c_str()); sc->clean(); delete y; } TEST(PointerRetrievalOfClasses) { TEST_HEADER; shared_ptr sc(new LuaScripting()); // Register class definitions. sc->registerClassStatic(&A::luaConstruct, "factory.a1", "a class", LuaClassRegCallback::Type( &A::registerFunctions)); // Test the classes. LuaClassInstance a_1 = sc->cexecRet( "factory.a1.new", 2, 2.63, "str", sc); // Testing only the first instance of a1. std::string aInst = a_1.fqName(); A* a = a_1.getRawPointer(sc); LuaClassInstance aAlt = sc->getLuaClassInstance(reinterpret_cast(a)); CHECK_EQUAL(a_1.getGlobalInstID(), aAlt.getGlobalInstID()); sc->clean(); } TEST(ClassHelpAndLog) { // Help should be given for classes, but not for any of their instances // in the _sys_ table. } TEST(ClassRTTITypeChecks) { shared_ptr sc(new LuaScripting()); } } SUITE(LuaTestClassRegistration_MultipleInheritenceFromTop) { // The classes knowing about A is not realistic, but serves to test our // casting implmentation well. // A more realistic implementation is the from bottom unit test. class A; class B { public: virtual ~B() {}; void registerBFuncs(LuaClassRegistration& reg); void set_b1(int b) {b1 = b;} int get_b1() {return b1;} virtual string B_className() = 0; int b1; }; class C { public: virtual ~C() {}; void registerCFuncs(LuaClassRegistration& reg); void set_c1(int v) {c1 = v;} int get_c1() {return c1;} virtual string C_className() {return "C Class";} int c1; }; class X { public: virtual ~X() {}; void registerXFuncs(LuaClassRegistration& reg); void set_x1(int v) {x1 = v;} int get_x1() {return x1;} virtual string X_className() {return "X class";} int x1; }; class Y { public: virtual ~Y() {}; void registerYFuncs(LuaClassRegistration& reg); void set_y1(int v) {y1 = v;} int get_y1() {return y1;} virtual string Y_className() {return "Y class";} int y1; }; class Z : public X, public Y { public: virtual ~Z() {}; void registerZFuncs(LuaClassRegistration& reg); // We only override X, not Y. virtual string Y_className() {return "Z from Y class";} virtual string X_className() {return "Z from X class";} virtual string Z_className() {return "Z class";} void set_z1(int v) {z1 = v;} int get_z1() {return z1;} void set_z2(int v) {z2 = v;} int get_z2() {return z2;} int z1; int z2; }; int a_constructor = 0; int a_destructor = 0; class A : public C, public B, public Z { public: A(int a, float b, string c, shared_ptr ss) { ++a_constructor; i1 = a; f1 = b; s1 = c; } ~A() { ++a_destructor; } int i1; float f1; string s1; void set_i1(int i) {i1 = i;} int get_i1() {return i1;} void set_f1(float f) {f1 = f;} float get_f1() {return f1;} void set_s1(string s) {s1 = s;} string get_s1() {return s1;} // Class definition. The real meat defining a class. static void registerFunctions(LuaClassRegistration& d, A* me, LuaScripting* ss) { d.function(&A::set_i1, "set_i1", "", true); d.function(&A::get_i1, "get_i1", "", false); d.function(&A::set_f1, "set_f1", "", true); d.function(&A::get_f1, "get_f1", "", false); d.function(&A::set_s1, "set_s1", "", true); d.function(&A::get_s1, "get_s1", "", false); me->registerBFuncs(d); me->registerCFuncs(d); me->registerXFuncs(d); me->registerYFuncs(d); me->registerZFuncs(d); } // Overriden methods // Override B (mandatory) virtual string B_className() {return "A from B class";} // Do NOT override Z_className // Do NOT override X_className // Override Y virtual string Y_className() {return "A from Y class";} // Override C virtual string C_className() {return "A from C class";} static A* luaConstruct(int a, float b, string c, shared_ptr ss) { return new A(a, b, c, ss); } }; void B::registerBFuncs(LuaClassRegistration& reg) { reg.function(&B::set_b1, "set_b1", "", true); reg.function(&B::get_b1, "get_b1", "", false); reg.function(&B::B_className, "B_className", "", false); } void C::registerCFuncs(LuaClassRegistration& reg) { reg.function(&C::set_c1, "set_c1", "", true); reg.function(&C::get_c1, "get_c1", "", false); reg.function(&C::C_className, "C_className", "", false); } void X::registerXFuncs(LuaClassRegistration& reg) { reg.function(&X::set_x1, "set_x1", "", true); reg.function(&X::get_x1, "get_x1", "", false); reg.function(&X::X_className, "X_className", "", false); } void Y::registerYFuncs(LuaClassRegistration& reg) { reg.function(&Y::set_y1, "set_y1", "", true); reg.function(&Y::get_y1, "get_y1", "", false); reg.function(&Y::Y_className, "Y_className", "", false); } void Z::registerZFuncs(LuaClassRegistration& reg) { reg.function(&Z::set_z1, "set_z1", "", true); reg.function(&Z::get_z1, "get_z1", "", false); reg.function(&Z::set_z2, "set_z2", "", true); reg.function(&Z::get_z2, "get_z2", "", false); reg.function(&Z::Z_className, "Z_className", "", false); } TEST(TestMultipleInheritence_FromTop) { TEST_HEADER; // Help should be given for classes, but not for any of their instances // in the _sys_ table. shared_ptr sc(new LuaScripting()); // Register class definitions. sc->registerClassStatic(&A::luaConstruct, "factory.a1", "", LuaClassRegCallback::Type( &A::registerFunctions)); // Test the classes. LuaClassInstance a_1 = sc->cexecRet( "factory.a1.new", 2, 2.63, "str", sc); // Testing only the first instance of a1. std::string nm = a_1.fqName(); A* a = a_1.getRawPointer(sc); // Test out function registrations and check the results. sc->cexec(nm + ".set_x1", 11); CHECK_EQUAL(11, sc->cexecRet(nm + ".get_x1")); sc->cexec(nm + ".set_y1", 21); CHECK_EQUAL(21, sc->cexecRet(nm + ".get_y1")); sc->cexec(nm + ".set_z1", 101); CHECK_EQUAL(101, sc->cexecRet(nm + ".get_z1")); sc->cexec(nm + ".set_z2", 102); CHECK_EQUAL(102, sc->cexecRet(nm + ".get_z2")); sc->cexec(nm + ".set_b1", 500); CHECK_EQUAL(500, sc->cexecRet(nm + ".get_b1")); sc->cexec(nm + ".set_c1", 1000); CHECK_EQUAL(1000, sc->cexecRet(nm + ".get_c1")); sc->exec(nm + ".set_i1(15)"); sc->exec(nm + ".set_f1(1.5)"); sc->cexec(nm + ".set_s1", "String 1"); CHECK_EQUAL(15, a->i1); CHECK_CLOSE(1.5f, a->f1, 0.001f); CHECK_EQUAL("String 1", a->s1.c_str()); // Test overriden methods. CHECK_EQUAL(sc->cexecRet(nm + ".B_className").c_str(), "A from B class"); CHECK_EQUAL(sc->cexecRet(nm + ".C_className").c_str(), "A from C class"); CHECK_EQUAL(sc->cexecRet(nm + ".X_className").c_str(), "Z from X class"); CHECK_EQUAL(sc->cexecRet(nm + ".Y_className").c_str(), "A from Y class"); CHECK_EQUAL(sc->cexecRet(nm + ".Z_className").c_str(), "Z class"); cout << "--"; cout << "--" << endl; sc->clean(); } } SUITE(LuaTestClassRegistration_MultipleInheritenceFromBottom) { // The classes knowing about A is not realistic, but serves to test our // casting implmentation well. // A more realistic implementation is the from bottom unit test. class A; class B { public: virtual ~B() {}; void set_b1(int b) {b1 = b;} int get_b1() {return b1;} virtual string B_className() = 0; int b1; }; class C { public: virtual ~C() {}; void set_c1(int v) {c1 = v;} int get_c1() {return c1;} virtual string C_className() {return "C Class";} int c1; }; class X { public: X(shared_ptr ss) {} virtual ~X() {}; static void registerXFuncs(LuaClassRegistration& d, X* me, LuaScripting* ss) { d.function(&X::set_x1, "set_x1", "", true); d.function(&X::get_x1, "get_x1", "", false); d.function(&X::X_className, "X_className", "", false); me->registerDerived(d); } virtual void registerDerived(LuaClassRegistration& d) {} void set_x1(int v) {x1 = v;} int get_x1() {return x1;} virtual string X_className() {return "X class";} int x1; }; class Y { public: virtual ~Y() {}; void set_y1(int v) {y1 = v;} int get_y1() {return y1;} virtual string Y_className() {return "Y class";} int y1; }; class Z : public X, public Y { public: Z(shared_ptr ss) : X(ss) {} virtual ~Z() {}; virtual void registerDerived(LuaClassRegistration& d) { X::registerDerived(d); d.function(&Z::set_z1, "set_z1", "", true); d.function(&Z::get_z1, "get_z1", "", false); d.function(&Z::set_z2, "set_z2", "", true); d.function(&Z::get_z2, "get_z2", "", false); d.function(&Z::Z_className, "Z_className", "", false); } // We only override X, not Y. virtual string Y_className() {return "Z from Y class";} virtual string X_className() {return "Z from X class";} virtual string Z_className() {return "Z class";} void set_z1(int v) {z1 = v;} int get_z1() {return z1;} void set_z2(int v) {z2 = v;} int get_z2() {return z2;} int z1; int z2; }; int a_constructor = 0; int a_destructor = 0; class A : public C, public B, public Z { public: A(int a, float b, string c, shared_ptr ss) : Z(ss) { ++a_constructor; i1 = a; f1 = b; s1 = c; } ~A() { ++a_destructor; } int i1; float f1; string s1; void set_i1(int i) {i1 = i;} int get_i1() {return i1;} void set_f1(float f) {f1 = f;} float get_f1() {return f1;} void set_s1(string s) {s1 = s;} string get_s1() {return s1;} // Class definition. The real meat defining a class. virtual void registerDerived(LuaClassRegistration& d) { Z::registerDerived(d); d.function(&A::set_i1, "set_i1", "", true); d.function(&A::get_i1, "get_i1", "", false); d.function(&A::set_f1, "set_f1", "", true); d.function(&A::get_f1, "get_f1", "", false); d.function(&A::set_s1, "set_s1", "", true); d.function(&A::get_s1, "get_s1", "", false); // There is NO dynamic cast from X to B, C, or Y. Therefore, we cannot // register ANY of their functions. // But we can register these functions as A. d.function(&A::B_className, "B_className", "", false); d.function(&A::C_className, "C_className", "", false); d.function(&A::Y_className, "Y_className", "", false); d.function(&A::set_b1, "set_b1", "", true); d.function(&A::get_b1, "get_b1", "", false); d.function(&A::set_c1, "set_c1", "", true); d.function(&A::get_c1, "get_c1", "", false); d.function(&A::set_y1, "set_y1", "", true); d.function(&A::get_y1, "get_y1", "", false); } // Overriden methods // Override B (mandatory) virtual string B_className() {return "A from B class";} // Do NOT override Z_className // Do NOT override X_className // Override Y virtual string Y_className() {return "A from Y class";} // Override C virtual string C_className() {return "A from C class";} static A* luaConstruct(int a, float b, string c, shared_ptr ss) { return new A(a, b, c, ss); } }; TEST(TestMultipleInheritence_FromBottom) { TEST_HEADER; // Help should be given for classes, but not for any of their instances // in the _sys_ table. shared_ptr sc(new LuaScripting()); // Register class definitions. sc->registerClassStatic(&A::luaConstruct, "factory.a1", "", LuaClassRegCallback::Type(&X::registerXFuncs) ); // Test the classes. LuaClassInstance a_1 = sc->cexecRet( "factory.a1.new", 2, 2.63, "str", sc); // Testing only the first instance of a1. std::string nm = a_1.fqName(); A* a = a_1.getRawPointer(sc); // Test out function registrations and check the results. sc->cexec(nm + ".set_x1", 11); CHECK_EQUAL(11, sc->cexecRet(nm + ".get_x1")); sc->cexec(nm + ".set_y1", 21); CHECK_EQUAL(21, sc->cexecRet(nm + ".get_y1")); sc->cexec(nm + ".set_z1", 101); CHECK_EQUAL(101, sc->cexecRet(nm + ".get_z1")); sc->cexec(nm + ".set_z2", 102); CHECK_EQUAL(102, sc->cexecRet(nm + ".get_z2")); sc->cexec(nm + ".set_b1", 500); CHECK_EQUAL(500, sc->cexecRet(nm + ".get_b1")); sc->cexec(nm + ".set_c1", 1000); CHECK_EQUAL(1000, sc->cexecRet(nm + ".get_c1")); sc->exec(nm + ".set_i1(15)"); sc->exec(nm + ".set_f1(1.5)"); sc->cexec(nm + ".set_s1", "String 1"); CHECK_EQUAL(15, a->i1); CHECK_CLOSE(1.5f, a->f1, 0.001f); CHECK_EQUAL("String 1", a->s1.c_str()); // Test overriden methods. CHECK_EQUAL(sc->cexecRet(nm + ".B_className").c_str(), "A from B class"); CHECK_EQUAL(sc->cexecRet(nm + ".C_className").c_str(), "A from C class"); CHECK_EQUAL(sc->cexecRet(nm + ".X_className").c_str(), "Z from X class"); CHECK_EQUAL(sc->cexecRet(nm + ".Y_className").c_str(), "A from Y class"); CHECK_EQUAL(sc->cexecRet(nm + ".Z_className").c_str(), "Z class"); cout << "--"; cout << "--" << endl; sc->clean(); } } #endif ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaMemberReg.cpp0000644000175000017500000002253312320456500022011 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file LuaMemberReg.cpp \author James Hughes SCI Institute University of Utah \date Mar 26, 2012 \brief This mediator class handles member function registration. Should be instantiated alongside an encapsulating class. */ #include #include "LuaScripting.h" #include "LuaMemberReg.h" using namespace std; namespace tuvok { //----------------------------------------------------------------------------- LuaMemberReg::LuaMemberReg(shared_ptr scriptSys) : LuaMemberRegUnsafe(scriptSys.get()) , mScriptSystem_shared(scriptSys) { } //----------------------------------------------------------------------------- LuaMemberReg::~LuaMemberReg() { // We need to make this call since LuaMemberRegUnsafe assumes that any // reference to mScriptSystem is unsafe in its destructor (since the shared // pointer we are using in derived classes will go out of scope before // its destructor is called). unregisterAll(); } } /* namespace tuvok */ //============================================================================== // // UNIT TESTING // //============================================================================== #ifdef LUASCRIPTING_UNIT_TESTS #include "utestCommon.h" using namespace tuvok; SUITE(LuaTestMemberFunctionRegistration) { class A { public: A(shared_ptr ss) : mReg(ss) {} bool m1() {return true;} bool m2(int a) {return (a > 40) ? true : false;} string m3(float a) {return "Test str";} int m4(string reg) { printf("Str Print: %s\n", reg.c_str()); return 67; } void m5() {printf("Test scoping.\n");} int hookm2_var; void hookm2(int a) { hookm2_var = a; } float hookm3_var; void hookm3(float a) { hookm3_var = a; } // The registration instance. LuaMemberReg mReg; }; TEST(MemberFunctionRegistration) { TEST_HEADER; unique_ptr a; shared_ptr sc(new LuaScripting()); a = unique_ptr(new A(sc)); a->mReg.registerFunction(a.get(), &A::m1, "a.m1", "A::m1", true); a->mReg.registerFunction(a.get(), &A::m2, "a.m2", "A::m2", true); a->mReg.registerFunction(a.get(), &A::m3, "a.m3", "A::m3", true); a->mReg.registerFunction(a.get(), &A::m4, "m4", "A::m4", true); CHECK_EQUAL(true, sc->execRet("a.m1()")); CHECK_EQUAL(true, sc->execRet("a.m2(41)")); CHECK_EQUAL(false, sc->execRet("a.m2(40)")); CHECK_EQUAL("Test str", sc->execRet("a.m3(4.2)").c_str()); CHECK_EQUAL(67, sc->execRet("m4('This is my string')")); } TEST(MemberFunctionDeregistration) { TEST_HEADER; shared_ptr sc(new LuaScripting()); { unique_ptr a(new A(sc)); a->mReg.registerFunction(a.get(), &A::m1, "a.m1", "A::m1", true); a->mReg.registerFunction(a.get(), &A::m2, "a.m2", "A::m2", true); a->mReg.registerFunction(a.get(), &A::m5, "a.m5", "A::m5", true); sc->exec("a.m5()"); } /// TODO Ensure LuaNonExistantFunction is thrown. This will have to be /// coordinated with Lua somehow when using exec. Should be /// straightforward with cexec. sc->setExpectedExceptionFlag(true); CHECK_THROW(sc->exec("a.m1()"), LuaError); CHECK_THROW(sc->exec("a.m2(34)"), LuaError); CHECK_THROW(sc->exec("a.m5()"), LuaError); sc->setExpectedExceptionFlag(false); } TEST(MemberFunctionCallHooksAndDereg) { TEST_HEADER; shared_ptr sc(new LuaScripting()); unique_ptr a(new A(sc)); a->mReg.registerFunction(a.get(), &A::m1, "m1", "A::m1", true); a->mReg.registerFunction(a.get(), &A::m2, "m2", "A::m2", true); a->mReg.registerFunction(a.get(), &A::m3, "m3", "A::m3", true); a->mReg.registerFunction(a.get(), &A::m4, "m4", "A::m4", true); a->mReg.registerFunction(a.get(), &A::m5, "m5", "A::m5", true); a->mReg.strictHook(a.get(), &A::hookm2, "m2"); a->mReg.strictHook(a.get(), &A::hookm3, "m3"); sc->exec("m2(34)"); sc->exec("m3(6.3)"); // Check CHECK_EQUAL(34, a->hookm2_var); CHECK_CLOSE(6.3, a->hookm3_var, 0.001); sc->setExpectedExceptionFlag(true); CHECK_THROW(a->mReg.strictHook(a.get(), &A::hookm2, "m1a"), LuaNonExistantFunction); CHECK_THROW(a->mReg.strictHook(a.get(), &A::hookm2, "m1"), LuaInvalidFunSignature); CHECK_THROW(a->mReg.strictHook(a.get(), &A::hookm2, "m2"), LuaFunBindError); sc->setExpectedExceptionFlag(false); a->mReg.unregisterHooks(); // Test hooks with new values, and ensure they remain unchanged. sc->exec("m2(42)"); sc->exec("m3(42.2)"); CHECK_EQUAL(34, a->hookm2_var); CHECK_CLOSE(6.3, a->hookm3_var, 0.001); // Retest hooking after deregistration. a->mReg.strictHook(a.get(), &A::hookm2, "m2"); sc->exec("m2(452)"); CHECK_EQUAL(452, a->hookm2_var); sc->exec("provenance.logProvRecord_toConsole()"); } class B { public: B(shared_ptr ss) : mReg(ss) { i1 = 0; i2 = 0; f1 = 0.0f; f2 = 0.0f; } int i1, i2; float f1, f2; string s1, s2; void set_i1(int i) {i1 = i;} void set_i2(int i) {i2 = i;} int get_i1() {return i1;} int get_i2() {return i2;} void set_f1(float f) {f1 = f;} void set_f2(float f) {f2 = f;} float get_f1() {return f1;} float get_f2() {return f2;} void set_s1(string s) {s1 = s;} void set_s2(string s) {s2 = s;} string get_s1() {return s1;} string get_s2() {return s2;} void undo_i1(int i) {i1 = i * 2;} void undo_f1(float f) {f1 = f + 2.5f;} void undo_s1(string s){s1 = s + "hi";} void redo_i1(int i) {i1 = i * 4;} void redo_f1(float f) {f1 = f - 5.0f;} void redo_s1(string s){s1 = s + "hi2";} LuaMemberReg mReg; }; TEST(MemberUndoRedoHooks) { TEST_HEADER; // Setup custom undo/redo hooks and test their efficacy. shared_ptr sc(new LuaScripting()); unique_ptr b(new B(sc)); b->mReg.registerFunction(b.get(), &B::set_i1, "set_i1", "", true); b->mReg.registerFunction(b.get(), &B::set_i2, "set_i2", "", true); b->mReg.registerFunction(b.get(), &B::get_i1, "get_i1", "", false); b->mReg.registerFunction(b.get(), &B::get_i2, "get_i2", "", false); b->mReg.registerFunction(b.get(), &B::set_f1, "set_f1", "", true); b->mReg.registerFunction(b.get(), &B::set_f2, "set_f2", "", true); b->mReg.registerFunction(b.get(), &B::get_f1, "get_f1", "", false); b->mReg.registerFunction(b.get(), &B::get_f2, "get_f2", "", false); b->mReg.registerFunction(b.get(), &B::set_s1, "set_s1", "", true); b->mReg.registerFunction(b.get(), &B::set_s2, "set_s2", "", true); b->mReg.registerFunction(b.get(), &B::get_s1, "get_s1", "", false); b->mReg.registerFunction(b.get(), &B::get_s2, "get_s2", "", false); // Customize undo functions (these undo functions will result in invalid // undo state, but thats what we want in order to detect correct redo/undo // hook installation). b->mReg.setUndoFun(b.get(), &B::undo_i1, "set_i1"); b->mReg.setUndoFun(b.get(), &B::undo_f1, "set_f1"); b->mReg.setUndoFun(b.get(), &B::undo_s1, "set_s1"); b->mReg.setRedoFun(b.get(), &B::redo_i1, "set_i1"); b->mReg.setRedoFun(b.get(), &B::redo_f1, "set_f1"); b->mReg.setRedoFun(b.get(), &B::redo_s1, "set_s1"); sc->exec("set_i1(100)"); sc->exec("set_f1(126.5)"); sc->exec("set_s1('Test')"); CHECK_EQUAL(b->i1, 100); CHECK_CLOSE(b->f1, 126.5f, 0.001f); CHECK_EQUAL(b->s1.c_str(), "Test"); sc->exec("set_i1(1000)"); sc->exec("set_f1(500.0)"); sc->exec("set_s1('nop')"); sc->exec("provenance.undo()"); CHECK_EQUAL("Testhi", b->s1.c_str()); sc->exec("provenance.undo()"); CHECK_CLOSE(129.0f, b->f1, 0.001f); sc->exec("provenance.undo()"); CHECK_EQUAL(200, b->i1); sc->exec("provenance.redo()"); CHECK_EQUAL(4000, b->i1); sc->exec("provenance.redo()"); CHECK_CLOSE(495.0, b->f1, 0.001f); sc->exec("provenance.redo()"); CHECK_EQUAL("nophi2", b->s1.c_str()); } } #endif ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaDebug.cpp0000644000175000017500000000567712320456500021204 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file LuaDebug.cpp \author James Hughes \date Jun 29, 2012 \brief */ #include #include #include "LuaDebug.h" namespace tuvok { //----------------------------------------------------------------------------- LuaDebug::LuaDebug(LuaScripting* scripting) : mMemberReg(scripting) { } //----------------------------------------------------------------------------- LuaDebug::~LuaDebug() { // We purposefully do NOT unregister our Lua functions. // Since we are being destroyed, it is likely the lua_State has already // been closed by the class that composited us. } //----------------------------------------------------------------------------- void LuaDebug::registerLuaDebugFunctions() { // NOTE: We cannot use the LuaMemberReg class to manage our registered // functions because it relies on a shared pointer to LuaScripting; since we // are composited inside of LuaScripting, no such shared pointer is available. /// @todo Implement this function. It's not as simple as inserting a strict /// hook since we don't know the function's parameters. We should /// implement it so that it is able to print out the parameters /// that were used to call the function as well. // mMemberReg.registerFunction(this, &LuaDebug::watchFunction, // "debug.watchToConsole", // "Watches the given function. Whenever the " // "function is executed, a notification is " // "printed to the console.", // false); } //----------------------------------------------------------------------------- void LuaDebug::watchFunction(const std::string& function) { } } /* namespace tuvok */ ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaClassConstructor.h0000644000175000017500000004311112320456500023117 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief */ #ifndef TUVOK_LUACLASSCONSTRUCTOR_H_ #define TUVOK_LUACLASSCONSTRUCTOR_H_ #include #include "LuaClassInstance.h" namespace tuvok { class LuaClassConstructor { public: LuaClassConstructor(LuaScripting* ss); virtual ~LuaClassConstructor(); /// Data stored in the constructor table ///@{ static const char* CONS_MD_FACTORY_NAME; static const char* CONS_MD_FUNC_REGISTRATION_FPTR; ///@} template void registerConstructor( FunPtr f, const std::string& name, const std::string& desc, bool undoRedo, typename LuaClassRegCallback::Type& callback) { lua_State* L = mSS->getLuaState(); LuaStackRAII _a = LuaStackRAII(L, 0, 0); // Idea: Build a 'callable' table. // Its metatable will have a __call metamethod that points to the C // function closure. // We do this because all metatables are unique per-type which eliminates // the possibilty of using a metatable on the function closure itself. // The only exception to this rule is the table type itself. // Create a callable function table and leave it on the stack. lua_CFunction proxyFunc = &LuaConstructorCallback::exec; mSS->createCallableFuncTable(proxyFunc, reinterpret_cast(f)); int tableIndex = lua_gettop(L); // Add function metadata to the table. // We know the constructor will return a class that strict stack is not // capable of handling. So we insert our own return value. std::string sig = "LuaClassInstance " + LuaCFunExec::getSigNoReturn(""); std::string sigWithName = "LuaClassInstance " + LuaCFunExec::getSigNoReturn(mSS->getUnqualifiedName(name)); std::string sigNoRet = LuaCFunExec::getSigNoReturn(""); mSS->populateWithMetadata(name, desc, sig, sigWithName, sigNoRet, tableIndex); // Push default values for function parameters onto the stack. LuaCFunExec defaultParams = LuaCFunExec(); lua_checkstack(L, LUAC_MAX_NUM_PARAMS + 2); defaultParams.pushParamsToStack(L); int numFunParams = lua_gettop(L) - tableIndex; mSS->createDefaultsAndLastExecTables(tableIndex, numFunParams); lua_pushinteger(L, numFunParams); lua_setfield(L, tableIndex, LuaScripting::TBL_MD_NUM_PARAMS); // Add indicator that we are NOT a member function ( #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS // Generate the type table (buildTypeTable places table on top of the stack). LuaCFunExec::buildTypeTable(L); lua_setfield(L, tableIndex, LuaScripting::TBL_MD_TYPES_TABLE); #endif lua_pushlightuserdata(L, new typename LuaClassRegCallback::Type( callback)); lua_setfield(L, tableIndex, LuaClassConstructor::CONS_MD_FUNC_REGISTRATION_FPTR); lua_pushlightuserdata(L, reinterpret_cast( &LuaConstructorCallback::delCallback)); lua_setfield(L, tableIndex, LuaClassInstance::MD_DEL_CALLBACK_PTR); // Install the callable table in the appropriate module based on its // fully qualified name. mSS->bindClosureTableWithFQName(name, tableIndex); lua_pop(L, 1); // Pop the callable table. if (undoRedo == false) mSS->setUndoRedoStackExempt(name); } // This is the exact same function as LuaMemberRegUnsafe::registerFunction // with the exception of the proxyFunc, and addition to the global // registered function list. template void registerMemberConstructor( T* C, FunPtr f, const std::string& name, const std::string& desc, bool undoRedo, typename LuaClassRegCallback::Type& callback) { lua_State* L = mSS->getLuaState(); LuaStackRAII _a = LuaStackRAII(L, 0, 0); // Member function pointers are not pointing to a function, they are // compiler dependent and are pointing to a memory address. // They need to be copied into lua in an portable manner. // See the C++ standard. // Create a callable function table and leave it on the stack. lua_CFunction proxyFunc = &LuaMemberConstructorCallback::exec; // Table containing the function closure. lua_newtable(L); int tableIndex = lua_gettop(L); // Create a new metatable lua_newtable(L); // Create a full user data and store the function pointer data inside of it. void* udata = lua_newuserdata(L, sizeof(FunPtr)); memcpy(udata, &f, sizeof(FunPtr)); lua_pushlightuserdata(L, static_cast(C)); lua_pushboolean(L, 0); // We are NOT a hook. // We are safe pushing this unprotected pointer: LuaScripting always // deregisters all functions it has registered, so no residual light // user data will be left in Lua. lua_pushlightuserdata(L, static_cast(mSS)); lua_pushcclosure(L, proxyFunc, 4); // Associate closure with __call metamethod. lua_setfield(L, -2, "__call"); // Add boolean to the metatable indicating that this table is a registered // function. Used to ensure that we can't register functions 'on top' of // other functions. // e.g. If we register renderer.eye as a function, without this check, we // could also register renderer.eye.ball as a function. // While it works just fine, it's confusing, so we're disallowing it. lua_pushboolean(L, 1); lua_setfield(L, -2, "isRegFunc"); // Associate metatable with primary table. lua_setmetatable(L, -2); // Add function metadata to the table. std::string sig = "LuaClassInstance " + LuaCFunExec::getSigNoReturn(""); std::string sigWithName = "LuaClassInstance " + LuaCFunExec::getSigNoReturn(mSS->getUnqualifiedName(name)); std::string sigNoRet = LuaCFunExec::getSigNoReturn(""); mSS->populateWithMetadata(name, desc, sig, sigWithName, sigNoRet, tableIndex); // Push default values for function parameters onto the stack. LuaCFunExec defaultParams = LuaCFunExec(); lua_checkstack(L, LUAC_MAX_NUM_PARAMS); // Max num parameters supported defaultParams.pushParamsToStack(L); int numFunParams = lua_gettop(L) - tableIndex; mSS->createDefaultsAndLastExecTables(tableIndex, numFunParams); lua_pushinteger(L, numFunParams); lua_setfield(L, tableIndex, LuaScripting::TBL_MD_NUM_PARAMS); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS // Generate the type table (buildTypeTable places table on top of the stack). LuaCFunExec::buildTypeTable(L); lua_setfield(L, tableIndex, LuaScripting::TBL_MD_TYPES_TABLE); #endif // This will be freed by LuaScripting -- in the destroyClassTable function. lua_pushlightuserdata(L, new typename LuaClassRegCallback::Type( callback)); lua_setfield(L, tableIndex, LuaClassConstructor::CONS_MD_FUNC_REGISTRATION_FPTR); lua_pushlightuserdata(L, reinterpret_cast( &LuaConstructorCallback::delCallback)); lua_setfield(L, tableIndex, LuaClassInstance::MD_DEL_CALLBACK_PTR); // Install the callable table in the appropriate module based on its // fully qualified name. mSS->bindClosureTableWithFQName(name, tableIndex); lua_pop(L, 1); // Pop the callable table. if (undoRedo == false) mSS->setUndoRedoStackExempt(name); } /// Signature for delFun in LuaConstructorCallback. typedef void (*DelFunSig)(void* inst); private: template struct LuaConstructorCallback { // Lines marked with a double forward slash are those that differ from // the function above (the exec function above). static int exec(lua_State* L) { LuaStackRAII _a = LuaStackRAII(L, 0, 1); // 1 return value. // The function table that called us on the top of the stack. int consTable = 1; typename LuaCFunExec::returnType r = NULL; FunPtr fp = reinterpret_cast( // lua_touserdata(L, lua_upvalueindex(1))); // LuaScripting* ss = static_cast( // lua_touserdata(L, lua_upvalueindex(3))); // std::shared_ptr execParams( new LuaCFunExec()); std::shared_ptr emptyParams( new LuaCFunExec()); // Fill execParams. Function parameters start at index 2. execParams->pullParamsFromStack(L, 2); // Obtain reference to LuaScripting in order to invoke provenance. // See createCallableFuncTable for justification on pulling an // instance of LuaScripting out of Lua. bool provExempt = ss->doProvenanceFromExec(L, execParams, emptyParams); // Places the instance table and its metatable at stack position -2 and // -1 respectively. LuaClassInstance inst = buildCoreInstanceTable(L, ss, consTable, ss->getNewClassInstID()); int mt = lua_gettop(L); int instTable = mt - 1; ss->beginCommand(); try { r = LuaCFunExec::run(L, 2, fp); // } catch (std::exception& e) { ss->endCommand(); postExecFailure(ss, inst); ss->logExecFailure(e.what()); throw; } catch (...) { ss->endCommand(); postExecFailure(ss, inst); ss->logExecFailure(""); throw; } ss->endCommand(); // Check to see if the function succeeded. if (r != NULL) { postExecSuccess(ss, inst); // Call registration fptr. lua_getfield(L, consTable, LuaClassConstructor::CONS_MD_FUNC_REGISTRATION_FPTR); typename LuaClassRegCallback::Type* cbFptr = reinterpret_cast::Type* >( lua_touserdata(L, -1)); LuaClassRegistration reg(ss, dynamic_cast(r), inst.getGlobalInstID()); (*cbFptr)(reg, r, ss); lua_pop(L, 1); ss->doHooks(L, 1, provExempt); // Places function table on the top of the stack. finalize(L, ss, reinterpret_cast(r), inst, mt, instTable, reinterpret_cast( &LuaConstructorCallback::del)); } else { // Remove the instance table and its metatable. // (must be removed in the correct order). lua_remove(L, mt); lua_remove(L, instTable); ss->vPrint("Failed to load class."); postExecFailure(ss, inst); // Create a default LuaClassInstance and return that. LuaClassInstance instFail; LuaStrictStack::push(L, instFail); } return 1; } // Casts the void* to the appropriate type, and deletes the class // instance. static void del(void* inst) { // Cast and delete the class instance. // NOTE: returnType should already be a pointer type. delete (reinterpret_cast::returnType>( inst)); } static void delCallback(void* callback) { delete (reinterpret_cast::Type* >( callback)); } }; template struct LuaMemberConstructorCallback { // Lines marked with a double forward slash are those that differ from // the function above (the exec function above). static int exec(lua_State* L) { LuaStackRAII _a = LuaStackRAII(L, 0, 1); // 1 return value. // The function table that called us on the top of the stack. int consTable = 1; typename LuaCFunExec::returnType r = NULL; FunPtr fp = *static_cast(lua_touserdata(L, // lua_upvalueindex(1))); // typename LuaCFunExec::classType* C = // static_cast::classType*>( // lua_touserdata(L, lua_upvalueindex(2))); // LuaScripting* ss = static_cast( // lua_touserdata(L, lua_upvalueindex(4))); // std::shared_ptr execParams( new LuaCFunExec()); std::shared_ptr emptyParams( new LuaCFunExec()); // Fill execParams. Function parameters start at index 2. execParams->pullParamsFromStack(L, 2); // Obtain reference to LuaScripting in order to invoke provenance. // See createCallableFuncTable for justification on pulling an // instance of LuaScripting out of Lua. bool provExempt = ss->doProvenanceFromExec(L, execParams, emptyParams); // Places the instance table and its metatable at stack position -2 and -1 // respectively. LuaClassInstance inst = buildCoreInstanceTable(L, ss, consTable, ss->getNewClassInstID()); int mt = lua_gettop(L); int instTable = mt - 1; ss->beginCommand(); try { r = LuaCFunExec::run(L, 2, C, fp); // } catch (std::exception& e) { ss->endCommand(); postExecFailure(ss, inst); ss->logExecFailure(e.what()); throw; } catch (...) { ss->endCommand(); postExecFailure(ss, inst); ss->logExecFailure(""); throw; } ss->endCommand(); if (r != NULL) { postExecSuccess(ss, inst); // Call registration fptr. lua_getfield(L, consTable, LuaClassConstructor::CONS_MD_FUNC_REGISTRATION_FPTR); typename LuaClassRegCallback::Type* cbFptr = reinterpret_cast::Type* >( lua_touserdata(L, -1)); LuaClassRegistration reg(ss, dynamic_cast(r), inst.getGlobalInstID()); (*cbFptr)(reg, r, ss); lua_pop(L, 1); ss->doHooks(L, 1, provExempt); // Places function table on the top of the stack. finalize(L, ss, reinterpret_cast(r), inst, mt, instTable, reinterpret_cast( &LuaMemberConstructorCallback::del) ); } else { // Remove the instance table and its metatable. // (must be removed in the correct order). lua_remove(L, mt); lua_remove(L, instTable); ss->vPrint("Failed to load class."); postExecFailure(ss, inst); // Create a default LuaClassInstance and return that. LuaClassInstance instFail; LuaStrictStack::push(L, instFail); } return 1; } // Casts the void* to the appropriate type, and deletes the class // instance. static void del(void* inst) { // Cast and delete the class instance. // NOTE: returnType should already be a pointer type. delete (reinterpret_cast::returnType>( inst)); } static void delCallback(void* callback) { delete (reinterpret_cast::Type* >( callback)); } }; LuaScripting* mSS; static LuaClassInstance buildCoreInstanceTable(lua_State* L, LuaScripting* ss, int consTable, int instID); static void finalize(lua_State* L, LuaScripting* ss, void* r, LuaClassInstance inst, int mt, int instTable, void* delFun); // Utility functions for buildCoreInstanceTable and finalize. static void addToLookupTable(LuaScripting* ss, lua_State* L, void* ptr, int instID); static int createCoreMetatable(lua_State* L, int instID, int consTable); static void finalizeMetatable(lua_State* L, int mt, void* ptr, void* delPtr); static LuaClassInstance finalizeInstanceTable(LuaScripting* ss, int instTable, int instID); static void postExecSuccess(LuaScripting* ss, LuaClassInstance inst); static void postExecFailure(LuaScripting* ss, LuaClassInstance inst); }; } /* namespace tuvok */ #endif /* LUACLASSCONSTRUCTOR_H_ */ ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaMemberRegUnsafe.h0000644000175000017500000003617512320456500022627 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief This mediator class handles member function registration. This class is used for internal purposes only, please use LuaMemberReg instead. Exists solely to provide member function registration to LuaScripting and its composited classes (without the need for a shared_ptr). If you do use this class instead of LuaMemberReg, be sure to call the unregisterAll function manually when your class is destroyed. It is your responsibility to ensure that the LuaScripting pointer remains valid throughout the lifetime of LuaMemberRegUnsafe. */ #ifndef TUVOK_LUAMEMBER_REG_UNSAFE_H_ #define TUVOK_LUAMEMBER_REG_UNSAFE_H_ #include "LuaScripting.h" #include namespace tuvok { class LuaScripting; //=============================== // LUA BINDING HELPER STRUCTURES //=============================== class LuaMemberRegUnsafe { public: LuaMemberRegUnsafe(LuaScripting* scriptSys); virtual ~LuaMemberRegUnsafe(); /// See LuaScripting::registerFunction for an in depth description of params. /// The only difference is the parameter C, which is the context class for the /// member function pointer. /// \return The name parameter. template std::string registerFunction(T* C, FunPtr f, const std::string& name, const std::string& desc, bool undoRedo); /// See LuaScripting::strictHook. template void strictHook(T* C, FunPtr f, const std::string& name); /// See LuaScripting::undoHook. Sets the undo function for the registered /// function at 'name'. template void setUndoFun(T* C, FunPtr f, const std::string& name); /// See LuaScripting::redoHook. Sets the redo function for the registered /// function at 'name'. template void setRedoFun(T* C, FunPtr f, const std::string& name); /// Unregisters all functions and hooks in the correct order. void unregisterAll(); // Before issuing a call to any of the functions below, please // consider using unregisterAll instead. In certain circumstances, // unregisterHooks must be called before unregisterFunctions. void unregisterFunctions(); void unregisterHooks(); void unregisterUndoRedoFunctions(); private: /// Scripting system we are bound to. LuaScripting* mScriptSystem; /// Functions registered. /// Used to unregister all functions. std::vector mRegisteredFunctions; /// Functions registered with this hook -- used for unregistering hooks. std::vector mHookedFunctions; /// ID used by Lua in order to identify the functions hooked by this class. /// This ID is used as the key in the hook table. const std::string mHookID; struct UndoRedoReg { UndoRedoReg(const std::string& funName, bool undo) : functionName(funName), isUndo(undo) {} std::string functionName; bool isUndo; }; std::vector mRegisteredUndoRedo; /// Strict hook internal -- called by strictHook and the setUndoFun and /// setRedoFun methods. template void strictHookInternal(T* C, FunPtr f, const std::string& name, bool registerUndo, bool registerRedo); template struct LuaMemberCallback { static int exec(lua_State* L) { LuaStackRAII _a = LuaStackRAII(L, 0, 1); // 1 for the return value. FunPtr fp = *static_cast(lua_touserdata(L, lua_upvalueindex(1))); T* bClass = reinterpret_cast(lua_touserdata(L, lua_upvalueindex(2))); typename LuaCFunExec::classType* C = dynamic_cast::classType*>(bClass); typename LuaStrictStack::Type r; if (lua_toboolean(L, lua_upvalueindex(3)) == 0) { LuaScripting* ss = static_cast( lua_touserdata(L, lua_upvalueindex(4))); std::shared_ptr execParams( new LuaCFunExec()); std::shared_ptr emptyParams( new LuaCFunExec()); // Fill execParams. Function parameters start at index 2 (callable // table starts at index 1). execParams->pullParamsFromStack(L, 2); // Obtain reference to LuaScripting to invoke provenance. // See createCallableFuncTable for justification on pulling an // instance of LuaScripting out of Lua. bool provExempt = ss->doProvenanceFromExec(L, execParams, emptyParams); ss->beginCommand(); try { r = LuaCFunExec::run(L, 2, C, fp); } catch (std::exception& e) { ss->logExecFailure(e.what()); ss->endCommand(); throw; } catch (...) { ss->logExecFailure(""); ss->endCommand(); throw; } ss->endCommand(); ss->doHooks(L, 1, provExempt); } else { // We are a hook call. r = LuaCFunExec::run(L, 1, C, fp); } LuaStrictStack().push(L, r); return 1; } }; template struct LuaMemberCallback { static int exec(lua_State* L) { LuaStackRAII _a = LuaStackRAII(L, 0, 0); FunPtr fp = *static_cast(lua_touserdata(L, lua_upvalueindex(1))); T* bClass = reinterpret_cast(lua_touserdata(L, lua_upvalueindex(2))); typename LuaCFunExec::classType* C = dynamic_cast::classType*>(bClass); if (lua_toboolean(L, lua_upvalueindex(3)) == 0) { LuaScripting* ss = static_cast( lua_touserdata(L, lua_upvalueindex(4))); std::shared_ptr execParams( new LuaCFunExec()); std::shared_ptr emptyParams( new LuaCFunExec()); execParams->pullParamsFromStack(L, 2); bool provExempt = ss->doProvenanceFromExec(L, execParams, emptyParams); ss->beginCommand(); try { LuaCFunExec::run(L, 2, C, fp); } catch (std::exception& e) { ss->logExecFailure(e.what()); ss->endCommand(); throw; } catch (...) { ss->logExecFailure(""); ss->endCommand(); throw; } ss->endCommand(); ss->doHooks(L, 1, provExempt); } else { LuaCFunExec::run(L, 1, C, fp); } return 0; } }; }; template std::string LuaMemberRegUnsafe::registerFunction(T* C, FunPtr f, const std::string& name, const std::string& desc, bool undoRedo) { LuaScripting* ss = mScriptSystem; lua_State* L = ss->getLuaState(); LuaStackRAII _a = LuaStackRAII(L, 0, 0); // Member function pointers are not pointing to a function, they are // compiler dependent and are pointing to a memory address. // They need to be copied into lua in an portable manner. // See the C++ standard. // Create a callable function table and leave it on the stack. lua_CFunction proxyFunc = &LuaMemberCallback::returnType>::exec; // Table containing the function closure. lua_newtable(L); int tableIndex = lua_gettop(L); // Create a new metatable lua_newtable(L); // Create a full user data and store the function pointer data inside of it. void* udata = lua_newuserdata(L, sizeof(FunPtr)); memcpy(udata, &f, sizeof(FunPtr)); lua_pushlightuserdata(L, reinterpret_cast(C)); lua_pushboolean(L, 0); // We are NOT a hook. // We are safe pushing this unprotected pointer: LuaScripting always // deregisters all functions it has registered, so no residual light // user data will be left in Lua. lua_pushlightuserdata(L, static_cast(mScriptSystem)); lua_pushcclosure(L, proxyFunc, 4); // Associate closure with __call metamethod. lua_setfield(L, -2, "__call"); // Add boolean to the metatable indicating that this table is a registered // function. Used to ensure that we can't register functions 'on top' of // other functions. // e.g. If we register renderer.eye as a function, without this check, we // could also register renderer.eye.ball as a function. // While it works just fine, it's confusing, so we're disallowing it. lua_pushboolean(L, 1); lua_setfield(L, -2, "isRegFunc"); // Associate metatable with primary table. lua_setmetatable(L, -2); // Add function metadata to the table. std::string sig = LuaCFunExec::getSignature(""); std::string sigWithName = LuaCFunExec::getSignature( ss->getUnqualifiedName(name)); std::string sigNoRet = LuaCFunExec::getSigNoReturn(""); ss->populateWithMetadata(name, desc, sig, sigWithName, sigNoRet, tableIndex); // Push default values for function parameters onto the stack. LuaCFunExec defaultParams = LuaCFunExec(); lua_checkstack(L, LUAC_MAX_NUM_PARAMS); // Max num parameters supported defaultParams.pushParamsToStack(L); int numFunParams = lua_gettop(L) - tableIndex; ss->createDefaultsAndLastExecTables(tableIndex, numFunParams); lua_pushinteger(L, numFunParams); lua_setfield(L, tableIndex, LuaScripting::TBL_MD_NUM_PARAMS); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS // Generate the type table (buildTypeTable places table on top of the stack). LuaCFunExec::buildTypeTable(L); lua_setfield(L, tableIndex, LuaScripting::TBL_MD_TYPES_TABLE); #endif // Install the callable table in the appropriate module based on its // fully qualified name. ss->bindClosureTableWithFQName(name, tableIndex); lua_pop(L, 1); // Pop the callable table. // Add this function to the list of registered functions. // (an exception would have gotten thrown before this point if there // was a duplicate function registered in the system). mRegisteredFunctions.push_back(name); if (undoRedo == false) ss->setUndoRedoStackExempt(name); return name; } template void LuaMemberRegUnsafe::strictHook(T* C, FunPtr f, const std::string& name) { strictHookInternal(C, f, name, false, false); } template void LuaMemberRegUnsafe::strictHookInternal( T* C, FunPtr f, const std::string& name, bool registerUndo, bool registerRedo ) { LuaScripting* ss = mScriptSystem; lua_State* L = ss->getLuaState(); LuaStackRAII _a = LuaStackRAII(L, 0, 0); // Need to check the signature of the function that we are trying to bind // into the script system. if (ss->getFunctionTable(name) == false) { throw LuaNonExistantFunction("Unable to find function with which to" "associate a hook."); } int funcTable = lua_gettop(L); // Check function signatures. lua_getfield(L, funcTable, LuaScripting::TBL_MD_SIG_NO_RET); std::string sigReg = lua_tostring(L, -1); std::string sigHook = LuaCFunExec::getSigNoReturn(""); if (sigReg.compare(sigHook) != 0) { std::ostringstream os; os << "Hook's parameter signature and the parameter signature of the " "function to hook must match. Hook's signature: \"" << sigHook << "\"Function to hook's signature: " << sigReg; throw LuaInvalidFunSignature(os.str().c_str()); } lua_pop(L, 1); // Obtain hook table. lua_getfield(L, -1, LuaScripting::TBL_MD_MEMBER_HOOKS); int hookTable = lua_gettop(L); bool regUndoRedo = (registerUndo || registerRedo); if (!regUndoRedo) { // Ensure our hook descriptor is not already there. lua_getfield(L, -1, mHookID.c_str()); if (lua_isnil(L, -1) == 0) { std::ostringstream os; os << "Instance of LuaMemberReg has already bound " << name; throw LuaFunBindError(os.str().c_str()); } lua_pop(L, 1); } // Push closure lua_CFunction proxyFunc = &LuaMemberCallback::returnType>::exec; void* udata = lua_newuserdata(L, sizeof(FunPtr)); memcpy(udata, &f, sizeof(FunPtr)); lua_pushlightuserdata(L, static_cast(C)); lua_pushboolean(L, 1); // We ARE a hook. This affects the stack, and // whether we want to perform provenance. // Also, we don't need to push a ref to // mScriptSystem. lua_pushcclosure(L, proxyFunc, 3); if (!regUndoRedo) { // Associate closure with hook table. lua_setfield(L, hookTable, mHookID.c_str()); mHookedFunctions.push_back(name); } else { std::string fieldToQuery = LuaScripting::TBL_MD_UNDO_FUNC; bool isUndo = true; if (registerRedo) { fieldToQuery = LuaScripting::TBL_MD_REDO_FUNC; isUndo = false; } lua_getfield(L, funcTable, fieldToQuery.c_str()); if (lua_isnil(L, -1) == 0) { if (isUndo) throw LuaUndoFuncAlreadySet("Undo function already set."); else throw LuaRedoFuncAlreadySet("Redo function already set."); } lua_pop(L, 1); lua_setfield(L, funcTable, fieldToQuery.c_str()); mRegisteredUndoRedo.push_back(UndoRedoReg(name, isUndo)); } lua_pop(L, 2); // Remove the function table and the hooks table. } // See LuaScripting::undoHook. template void LuaMemberRegUnsafe::setUndoFun(T* C, FunPtr f, const std::string& name) { // Uses strict hook. strictHookInternal(C, f, name, true, false); } // See LuaScripting::redoHook. template void LuaMemberRegUnsafe::setRedoFun(T* C, FunPtr f, const std::string& name) { // Uses strict hook. strictHookInternal(C, f, name, false, true); } } #endif ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaScripting.h0000644000175000017500000013177012320456500021557 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file LuaScripting.h \author James Hughes SCI Institute University of Utah \date Mar 21, 2012 \brief Interface to the Lua scripting system built for Tuvok. To see examples of how to use the system, consult the unit tests at the bottom of LuaMemberReg.cpp and LuaScripting.cpp. */ #ifndef TUVOK_LUASCRIPTING_H_ #define TUVOK_LUASCRIPTING_H_ #include #include #ifndef LUASCRIPTING_NO_TUVOK #include "3rdParty/LUA/lua.hpp" #else #include "Lua/lua.hpp" #include "NoTuvok/LuaTuvokException.h" #ifdef __clang__ // Place shared_ptr and function in the tr1 namespace. namespace std { namespace tr1 { using std::shared_ptr; using std::function; } } #endif #endif #include "LuaCommon.h" #include "LuaError.h" #include "LuaFunBinding.h" #include "LuaStackRAII.h" #include "LuaScriptingExecHeader.h" namespace tuvok { class LuaProvenance; class LuaMemberRegUnsafe; class LuaClassConstructor; template class LuaClassRegistration; /// Usage Note: If you construct any Lua Class instances that retain a /// shared_ptr reference to this LuaScripting class, be sure to call /// removeAllRegistrations before deleting LuaScripting. /// Consider using weak_ptr instead. class LuaScripting { // TODO: Expose getLuaState function and most of these can go away. friend class LuaMemberRegUnsafe; // For getNewMemberHookID. friend class LuaProvenance; // For obtaining function tables. friend class LuaStackRAII; // For unwinding lua stack during exception friend class LuaClassInstanceHook;// For getNewMemberHookID. friend class LuaClassConstructor; // For createCallableFuncTable. template friend class LuaClassRegistration;// For notifyOfDeletion. friend class LuaClassInstance; // For obtaining Lua instance. public: LuaScripting(); virtual ~LuaScripting(); /// It is highly recommended to call this function as your program is about /// to terminate. All it does is clear the provenance history and perform /// a complete Lua garbage collection cycle. This is necessary to get rid /// of any shared_ptr objects that may be in the provenance system. /// If you pass any shared_ptr's that reference LuaScripting, you must call /// this function. Otherwise, you will have memory leaks. void clean(); /// Removes all class definitions and function registrations from the system. /// This will clean up any lingering classes that may have lingering /// shared pointer references. void removeAllRegistrations(); /// Registers a static C++ function with Lua. /// Since Lua is compiled as CPP, it is safe to throw exceptions from the /// function pointed to by f (since Lua detects that it is being compiled in /// cpp, and uses exceptions instead of long jumping). /// \param f Any function pointer. /// f's parameters and return value will be handled /// automatically. /// The number of parameters allowed in f is limited by /// the templates in LuaFunBinding.h. /// \param name Period delimited fully qualified name of f inside of Lua /// No characters other than those regularly allowed inside /// C++ functions are allowed, with the exception of periods /// Example: "renderer.eye" /// \param desc Description of f. /// \param undoRedo If true, this function will add itself to the /// provenance tracking system and undo/redo will be handled /// automatically. If false, the function will not use /// undo/redo functionality in the provenance system. /// You will not want undo/redo on functions that do not /// modify state (such as getters). /// /// \return The name parameter. You can use this as an id. /// /// NOTES: The system is re-entrant, so you may call lua from within /// registered functions, or even call other registered functions. /// /// Automatic Undo/Redo: In order for automatic undo/redo to function /// properly with registered functions, the following property needs to be /// satisfied: your functions must be idempotent, or a composition /// of idempotent functions such that all of the side-effects of the function /// are known to the provenance system. This is further explained in the /// Lua Scripting paper. /// /// TO REGISTER MEMBER FUNCTIONS: /// Use the LuaMemberReg mediator class. It will clean up for you. template std::string registerFunction(FunPtr f, const std::string& name, const std::string& desc, bool undoRedo); /// Hooks a fully qualified function name with the given function. /// All hooks are called directly after the bound Lua function is called, /// but before the return values (if any) are sent back to Lua. /// \param f Function pointer. /// \param name Fully qualified name to hook. // /// TO HOOK USING MEMBER FUNCTIONS: /// Use the LuaMemberReg mediator class. It will clean up for you. template void strictHook(FunPtr f, const std::string& name); /// Sets the undo function for the registered function specified by 'name'. /// The default undo function is to re-execute the last command executed. /// E.G. If you execute "fun(1.5)", then "fun(5.5)", then execute an undo, /// the undo will execute fun(1.5) to undo fun(5.5). /// If there is no prior command, then the command is called with 'default' /// values. Default values are determined by the LuaStrictStack class, or /// by the user specifying them using setDefault. /// E.G. If an undo is executed again on the example given above, fun(0.0) /// will be executed to undo fun(1.5). 0.0 is the default for a float. /// To reset defaults on a per function basis, use the setDefaults /// family of functions. /// \param f Function to call. If the function does not have the /// same signature of the function registered at 'name', /// a runtime exception will be thrown if RTTI is enabled. /// \param name The fully qualified name of the function that you wish to /// reset the undo function for. template void setUndoFun(FunPtr f, const std::string& name); /// Use this function to ensure that no functions are called on undo. /// The last executed parameters table is still updated upon undo. /// Use this function if you don't know what arguments /// the function takes and you would like to nullify its undo/redo /// operations. It is used to nullify undo on constructors / destructors /// of lua instance classes. /// All composited functions are called. /// XXX: Could be replaced with a function hook that ignores the function's /// arguments (does not enforce strict argument compliance). void setNullUndoFun(const std::string& name); /// Sets the redo function for the registered function specified by name. /// The default redo is just to re-execute the function with the same args. /// The f and name parameters are the exact same as setUndoFun. template void setRedoFun(FunPtr f, const std::string& name); /// Use this function to ensure that no functions are called on redo. /// The last executed parameters table is still updated upon redo. void setNullRedoFun(const std::string& name); /// Registers a Lua class. This method was ultimately chosen due to 3 reasons: /// 1) Depending on what registration functions we use, we can potentially /// determine what functions are associated with a particular class /// without having to create an instance of the class. /// 2) Gets rid of the pointer stack / id stacks that we setup to support /// function registration in the second method. /// 3) Can register classes that know nothing about LuaScripting. /// Particularly useful for not breaking encapsulation. A practical /// example of this is to register the Dataset IO class without IO /// knowing about Tuvok. /// \param fp Pointer to a function that will construct the class and /// return a pointer to it. /// \param className Fully qualified class name. /// \param desc Class description. /// \param callback Callback issued directly after the constructor is called /// This callback is tightly bound to the return type of /// FunPtr. If FunPtr has the return type of T*, then the /// function signature the callback is: /// callback(LuaClassRegistration& reg, T* cls); /// @{ template void registerClass(T* t, FunPtr fp, const std::string& className, const std::string& desc, typename LuaClassRegCallback::Type callback); template void registerClassStatic(FunPtr fp, const std::string& className, const std::string& desc, typename LuaClassRegCallback::Type callback); /// @} /// Retrieves the LuaClassInstance given the object pointer. /// Only use the pointer that was returned from the class constructor. LuaClassInstance getLuaClassInstance(void* p); /// Executes a command. /// /// Example: exec("provenance.undo()") /// or exec("myFunc(34, "string", ...)") void exec(const std::string& cmd); /// Executes a command and returns 1 value. /// /// Example: T a = executeRet("myFunc()") template T execRet(const std::string& cmd); /// The following functions allow you to call a function using C++ types. /// These function are more efficient than the exec functions given above. /// The general form of these functions is given in the below example /// /// Example: cexec("myFunc", a, b, c, d, ...) ///@{ void cexec(const std::string& cmd); // Include the cexec function prototypes. TUVOK_LUA_CEXEC_FUNCTIONS ///@} /// The following functions allow you to call a function using C++ types. /// Unlike the functions above, these functions also return the execution /// result of the function. /// /// NOTE: You must match the return type of the function exactly, otherwise /// a runtime exception will be thrown. /// /// Example: T a = cexecRet("myFunc", p1, p2, ...) ///@{ template T cexecRet(const std::string& cmd); // Include the cexecRet function prototypes. TUVOK_LUA_CEXEC_RET_FUNCTIONS ///@} /// The following functions allow you to specify default parameters to use /// for registered functions. /// This is so you can specify different undo/redo defaults (such as turning /// lighting ON by default). /// NOTE: You should call this directly after registering the function (name). /// Waiting to set defaults until after the function has been called /// results in undefined behavior on the undo/redo stack. /// \param name Fully qualified name of the function whose defaults /// you would like to set. /// \param callFunc If true, the function will be called for you with the /// given parameters. /// \param call If true, the function indicated by (name) will be /// called with the given parameters. This call will /// not be logged with the provenance system. /// /// Example: setDefaults("myFunc", p1, p2, ... , false) ///@{ // Here is an example function prototype for setDefaults. // template // void setDefaults(const std::string& name, // P1 p1, bool call); // Include setDefaults function prototypes. TUVOK_LUA_SETDEFAULTS_FUNCTIONS ///@} /// TODO: Build the set optional parameters functions. /// Possible signature: /// void setOptional(std::string id, int arg, T paramValue); /// Lets you specify optional parameters for registered functions. /// All optional parameters must be grouped at the end of the parameter list. /// Optional parameters are different from defaults in that defaults deal /// with undoing the very first call. Whereas, optional parameters /// indicate that if certain parameters aren't specified, the parameters /// should be filled with the given optional values. /// Sets additional parameter information (such as name and description). /// \param fqname Fully qualified name of the function. /// \param paramID Zero based. 0 represents the first parameter, n represents /// the (n-1)'th parameter. /// \param name The name of the parameter. /// \param desc The description. void addParamInfo(const std::string& fqname, int paramID, const std::string& name, const std::string& desc); /// Sets additional return value information. void addReturnInfo(const std::string& fqname, const std::string& desc); /// Default: Provenance is enabled. Disabling provenance will disable undo/ /// redo. bool isProvenanceEnabled() const; void enableProvenance(bool enable); LuaClassInstance::IDType getCurGlobalInstID() const{return mGlobalInstanceID;} void incrementGlobalInstID() {mGlobalInstanceID++;} /// Function description returned from getFuncDescs(). struct FunctionDesc { std::string funcName; ///< Name of the function. std::string funcDesc; ///< Description of the function provided by the ///< registrar. std::string paramSig; ///< Function parameter signature, only parameters. std::string funcSig; ///< Full function signature. std::string funcFQName; ///< Fully qualified function name. }; /// Return all function descriptions. std::vector getAllFuncDescs() const; // Names for data stored in a function's encapsulating table. // Exposed for unit testing purposes. static const char* TBL_MD_DESC; ///< Description static const char* TBL_MD_SIG; ///< Signature static const char* TBL_MD_SIG_NO_RET; ///< No name signature without return static const char* TBL_MD_SIG_NAME; ///< Signature with name static const char* TBL_MD_NUM_EXEC; ///< Number of executions static const char* TBL_MD_QNAME; ///< Fully qualified function name static const char* TBL_MD_FUN_PDEFS; ///< Function parameter defaults static const char* TBL_MD_FUN_LAST_EXEC;///< Parameters from last execution static const char* TBL_MD_HOOKS; ///< Static function hooks table static const char* TBL_MD_HOOK_INDEX; ///< Static function hook index static const char* TBL_MD_MEMBER_HOOKS; ///< Class member function hook table static const char* TBL_MD_CPP_CLASS; ///< Light user data to LuaScripting static const char* TBL_MD_STACK_EXEMPT; ///< True if undo/redo stack exempt static const char* TBL_MD_PROV_EXEMPT; ///< True if provenance exempt. static const char* TBL_MD_NUM_PARAMS; ///< Number of parameters accepted. static const char* TBL_MD_UNDO_FUNC; ///< Non-nil if undo hook present. static const char* TBL_MD_REDO_FUNC; ///< Non-nil if redo hook present. static const char* TBL_MD_NULL_UNDO; ///< If true, no undo function ///< is called. static const char* TBL_MD_NULL_REDO; ///< If true, no redo function ///< is called. static const char* TBL_MD_PARAM_DESC; ///< Additional parameter descriptions ///< table. #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static const char* TBL_MD_TYPES_TABLE; ///< type_info userdata table. #endif static const char* PARAM_DESC_NAME_SUFFIX; static const char* PARAM_DESC_INFO_SUFFIX; static const char* SYSTEM_NOP_COMMAND; ///< The no-op command. /// Sets a flag in the Lua registry indicating that an exception is expected /// that will cause the lua stack to be unbalanced in internal functions. /// This is to avoid debug log output, more than anything else. void setExpectedExceptionFlag(bool expected); /// Please do not use this function in production code. It is used for /// testing purposes. LuaProvenance* getProvenanceSys() const {return mProvenance.get();} /// Used for testing purposes only. LuaClassInstance::IDType getCurrentClassInstID() {return mGlobalInstanceID;} /// Retrieves the last created instance ID LuaClassInstance::IDType getLastCreatedInstID(){return mGlobalInstanceID - 1;} /// Used by friend class LuaProvenance. /// Any public use of this function should be for testing purposes only. lua_State* getLuaState() const {return mL;} /// Notifies the scripting system of an object's deletion. /// Use this function in the object's destructor if you believe deleteClass /// was not called on the object (E.G. the object is GUI window, and the user /// clicked the close button, and you have no control over the deletion of /// the object). /// It is safe to call this function repeatedly. You may also call the /// function even though deleteClass was called. deleteClass is reentrant for /// the same class. void notifyOfDeletion(LuaClassInstance inst); /// Allows you to temporarily disable the provenance system. This will not /// wipe any provenance records, but will allow you to make lua calls without /// having them logged by the system. /// This function routes to mProvenance->setDisableProvTemporarily(...) void setTempProvDisable(bool disable); /// This function should be used sparingly, and only for those functions that /// do not modify state nor return internal state in some way. /// Turns out that we want functions that get called every frame to be /// provenance exempt as well. Otherwise the provenance record is useless /// and grows too fast (which is a performance concern). /// E.G. Debug logging functions should be provenance exempt. void setProvenanceExempt(const std::string& fqName); /// Returns true if we are running in verbose mode. bool isVerbose() {return mVerboseMode;} /// Returns a list of possible completions to the given command. std::vector completeCommand(const std::string& fqName); /// Retrieves the commands 'path'. /// E.G. getCmdPath("iv3d.ren.two.get") = "iv3d.ren.two" std::string getCmdPath(std::string fqName); /// All commands between these two function calls will be grouped together /// so that one provenance.undo() command will undo/redo all of them. /// @{ void beginCommandGroup(); void endCommandGroup(); /// @} /// Verbose print. Prints a message using log.info only if verbose is enabled. void vPrint(const char* fmt, ...); private: // Used by LuaMemberRegUnsafe /// Just calls provenance begin/end command. void beginCommand(); void endCommand(); /// Exec failure. void logExecFailure(const std::string& failure); /// Stack expectations: the function table at tableIndex, and the parameters /// required to call the function directly after the table on the stack. /// There must be no other values on the stack above tableIndex other than the /// table and the parameters to call the function. void doHooks(lua_State* L, int tableIndex, bool provExempt); /// Returns true if the function is provenance exempt. /// Used to tell whether or not we should log hooks later on. bool doProvenanceFromExec(lua_State* L, std::shared_ptr funParams, std::shared_ptr emptyParams); private: template void strictHookInternal(FunPtr f, const std::string& name, bool registerUndo, bool registerRedo); /// Clears out all function's last exec tables. This is done when the /// provenance system is cleared. This even clears every class function's /// last exec table -- all tables must be cleared in order to get rid of /// dangling shared_ptrs. void clearAllLastExecTables(); void clearLastExecFromTable(); ///< Expects recurse table to be on stack top. /// Pushes the table associated with the LuaClassInstance to the top of the /// stack. Returns false if it could not find the class instance table. bool getClassTable(LuaClassInstance inst); /// Ensures the function is not added to the undo/redo stack. Examples include /// the undo and redo functions themselves. void setUndoRedoStackExempt(const std::string& funcName); /// Prepare function for execution (places function on the top of the stack). void prepForExecution(const std::string& fqName); /// Execute the function on the top of the stack. Works excatly like lua_call. void executeFunctionOnStack(int nparams, int nret); /// Unregisters the function associated with the fully qualified name. void unregisterFunction(const std::string& fqName); /// Resets default for function. Value to set as default is assumed to be on /// the top of the stack. It is popped off the stack. /// \param argumentPos Function argument position (e.g. f(1,2,3), 1 is at /// argument pos 0, 2 at pos 1, and 3 at pos 2). /// \param ftableStackPos Stack position of the function table. void resetFunDefault(int argumentPos, int ftableStackPos); /// Unregisters all functions registered using this LuaScripting instance. /// Should NEVER be called outside LuaScripting's destructor. void unregisterAllFunctions(); /// Returns a new member hook ID. std::string getNewMemberHookID(); /// Recursive helper function for unregisterAllFunctions(). /// Expects that the table from which to remove functions is on the top of the /// stack. /// \param parentTable If 0, the table is remove from globals if it is a /// function. /// \param tableName Name of the table on the top of the stack. void removeFunctionsFromTable(int parentTable, const char* tableName); /// Returns true if the table at stackIndex is a registered function. /// Makes no guarantees that it is a function registered by this class. bool isRegisteredFunction(int stackIndex) const; /// Returns true if the function table at stackIndex was create by this /// LuaScripting class. For now, we create our own unique Lua instance, so /// we are guaranteed this, but this is forward thinking for the future /// when we need to share the Lua state. bool isOurRegisteredFunction(int stackIndex) const; /// Returns true if the given fully qualified function name would be stored /// in lua globlas. bool isGlobalFunction(std::string fqName); /// Retrieves the function table given the fully qualified function name. /// Places the function table at the top of the stack. If the function fails /// to find the function table, false is returned and nothing is pushed /// onto the stack. /// Note: You can use this function as a generic way of grabbing tables /// at a particular fully qualified name. bool getFunctionTable(const std::string& fqName); /// Creates a callable Lua table. classInstance can be NULL. /// Leaves the table on the top of the Lua stack. void createCallableFuncTable(lua_CFunction proxyFunc, void* realFuncToCall); /// Populates the table at the given index with the given function metadata. void populateWithMetadata(const std::string& name, const std::string& description, const std::string& signature, const std::string& signatureWithName, const std::string& sigNoReturn, int tableIndex); /// Creates the defaults and last exec tables and places them inside the /// table given at tableIndex. /// Expects that the parameters are at the top of the stack. void createDefaultsAndLastExecTables(int tableIndex, int numParams); /// Binds the closure given at closureIndex to the fully qualified name (fq). /// In reality, you can use this function to bind any lua value to the /// indicated function name. void bindClosureTableWithFQName(const std::string& fqName, int closureIndex); /// Retrieves the unqualified name given the qualified name. static std::string getUnqualifiedName(const std::string& fqName); /// Recursive function helper for getAllFuncDescs. void getTableFuncDefs(std::vector& descs) const; /// Retrieve the function description from the given table. FunctionDesc getFunctionDescFromTable(int table) const; /// Lua panic function. Lua calls this when an unrecoverable error occurs /// in the interpreter. static int luaPanic(lua_State* L); /// Customized memory allocator called from within Lua. static void* luaInternalAlloc(void* ud, void* ptr, size_t osize, size_t nsize); /// Expects the function table to be given at funTableIndex /// Copies the defaults table to the last exec table (used for undo/redo). void copyDefaultsTableToLastExec(int funTableIndex); /// Expects parameters to start at paramStartIndex. The table to receive the /// parameters should be at tableIndex. /// Do NOT use psuedo indices for tableIndex or paramStartIndex. void copyParamsToTable(int tableIndex, int paramStartIndex, int numParams); /// Registers our functions with the scripting system. void registerScriptFunctions(); /// Logs info. void logInfo(std::string log); /// Logs a warning. void logWarn(std::string log); /// Logs a failure. void logError(std::string log); /// Prints all currently registered functions using log.info. void printFunctions(); /// Prints all currently registered functions using log.info. void printHelp(); /// Prints help for the given class instance table. std::string getClassHelp(int tableIndex); /// Prints help about a specific function given by func. void infoHelp(LuaTable table); /// Retrieves info about the given table as a string. std::string getInfoHelp(LuaTable table); /// Delete's a lua class instance. Does not delete a class definition. /// Class definitions are permanent. void deleteLuaClassInstance(LuaClassInstance inst); /// Retrieves a new class instance ID. This function is modified by /// setNextTempClassInstRange. int getNewClassInstID(); /// Removes all class instances from the system table. void deleteAllClassInstances(); /// Cleans up class constructors stored in mRegisteredClasses. void cleanupClassConstructors(); /// Deletes the class instance in the table. The table should be removed /// and no longer called after this function is executable. void destroyClassInstanceTable(int tableIndex); /// Retrieves the class' unique ID. int getClassUniqueID(LuaClassInstance inst); /// Retrieves the class with the given Unique ID. LuaClassInstance getClassWithUniqueID(LuaClassInstance::IDType ID); /// Used when redoing class instance creation. Ensures that the same id is /// used when creating the classes. Starts getNewClassInstID at low, and /// when current > high, we move to where we were when creating instance IDs. /// \param low The lowest instance ID to return when using /// getNewClassInstID. /// \param high The highest instance void setNextTempClassInstRange(LuaClassInstance::IDType low, LuaClassInstance::IDType high); /// Returns true if the path specified points to a class instance. bool isLuaClassInstance(int tableIndex); /// Registers Lua utility functions, such as dir and os.capture. void registerLuaUtilityFunctions(); /// Enable / disable verbose mode for the scripting system. void enableVerboseMode(bool enable); /// Performs a correction search given the table in which to search, and the /// name within the table. If the name is unique, it will be the only value /// in the returned vector of strings. std::vector performCorrection(int tbl, const std::string& name); /// Lua Registry Values ///@{ /// Expected exception flag. Affects LuaStackRAII, and the logging of errors. static const char* REG_EXPECTED_EXCEPTION_FLAG; ///@} /// The one true Lua state. lua_State* mL; /// List of registered modules/functions in Lua's global table. /// Used to iterate through all registered functions. std::vector mRegisteredGlobals; /// List of registered classes. Needed for cleanup purposes. std::vector mRegisteredClasses; /// Index used to assign a unique ID to classes that wish to register /// hooks. int mMemberHookIndex; /// Current global instance ID that will be used to create new Lua classes. LuaClassInstance::IDType mGlobalInstanceID; bool mGlobalTempInstRange; LuaClassInstance::IDType mGlobalTempInstLow; LuaClassInstance::IDType mGlobalTempInstHigh; LuaClassInstance::IDType mGlobalTempCurrent; std::unique_ptr mProvenance; std::unique_ptr mMemberReg; std::unique_ptrmClassCons; bool mVerboseMode; /// These structures were created in order to handle void return types easily ///@{ template struct LuaCallback { static int exec(lua_State* L) { LuaStackRAII _a = LuaStackRAII(L, 0, 1); // 1 return value. FunPtr fp = reinterpret_cast( lua_touserdata(L, lua_upvalueindex(1))); typename LuaStrictStack::Type r; if (lua_toboolean(L, lua_upvalueindex(2)) == 0) { LuaScripting* ss = static_cast( lua_touserdata(L, lua_upvalueindex(3))); std::shared_ptr execParams( new LuaCFunExec()); std::shared_ptr emptyParams( new LuaCFunExec()); // Fill execParams. Function parameters start at index 2. execParams->pullParamsFromStack(L, 2); // Obtain reference to LuaScripting in order to invoke provenance. // See createCallableFuncTable for justification on pulling an // instance of LuaScripting out of Lua. bool provExempt = ss->doProvenanceFromExec(L, execParams, emptyParams); // We are NOT a hook. Our parameters start at index 2 (because the // callable table is at the first index). We will want to call all // hooks associated with our table. ss->beginCommand(); try { r = LuaCFunExec::run(L, 2, fp); } catch (std::exception& e) { ss->endCommand(); ss->logExecFailure(e.what()); throw; } catch (...) { ss->endCommand(); ss->logExecFailure(""); throw; } ss->endCommand(); // Call registered hooks. // Note: The first parameter on the stack (not on the top, but // on the bottom) is the table associated with the function. ss->doHooks(L, 1, provExempt); } else { // The catching of hook failures is done in doHooks. r = LuaCFunExec::run(L, 1, fp); } LuaStrictStack().push(L, r); return 1; } }; template struct LuaCallback { static int exec(lua_State* L) { LuaStackRAII _a = LuaStackRAII(L, 0, 0); FunPtr fp = reinterpret_cast( lua_touserdata(L, lua_upvalueindex(1))); if (lua_toboolean(L, lua_upvalueindex(2)) == 0) { LuaScripting* ss = static_cast( lua_touserdata(L, lua_upvalueindex(3))); std::shared_ptr execParams( new LuaCFunExec()); std::shared_ptr emptyParams( new LuaCFunExec()); // Fill execParams. Function parameters start at index 2. execParams->pullParamsFromStack(L, 2); bool provExempt = ss->doProvenanceFromExec(L, execParams, emptyParams); ss->beginCommand(); try { LuaCFunExec::run(L, 2, fp); } catch (std::exception& e) { ss->logExecFailure(e.what()); ss->endCommand(); throw; } catch (...) { ss->logExecFailure(""); ss->endCommand(); throw; } ss->endCommand(); ss->doHooks(L, 1, provExempt); } else { // The catching of hook failures is done in doHooks. LuaCFunExec::run(L, 1, fp); } return 0; } }; ///@} }; } // namespace tuvok // We need to place this here to resolve a circular reference introduced by the // functions below. #include "LuaClassConstructor.h" namespace tuvok { template void LuaScripting::registerClass( T* t, FunPtr fp, const std::string& className, const std::string& desc, typename LuaClassRegCallback::Type callback) { // Register f as the function _new. This function will be called to construct // a pointer to the class we want to create. This function is guaranteed // to be a static function. // Construct 'constructor' table. lua_State* L = getLuaState(); LuaStackRAII _a(L, 0, 0); // Register 'new'. This will automatically create the necessary class table. std::string fqFunName = className; fqFunName += ".new"; mClassCons->registerMemberConstructor(t, fp, fqFunName, desc, true, callback); setNullUndoFun(fqFunName); // We do not want to exe new when undoing // All child undo items are still executed. // Since we did the registerConstructor above we will have our function // table present. if (getFunctionTable(className) == false) throw LuaFunBindError("Unable to find table we just built!"); // Pop function table off stack. lua_pop(L, 1); // Populate the 'new' function's table with the class definition function, // and the full factory name. std::ostringstream retNewFun; retNewFun << "return " << className << ".new"; luaL_dostring(mL, retNewFun.str().c_str()); lua_pushstring(mL, className.c_str()); lua_setfield(mL, -2, LuaClassConstructor::CONS_MD_FACTORY_NAME); // Pop the new function table. lua_pop(mL, 1); // Store the class in the 'registered class' stack. // This stack lets us get rid of the callback pointers stored inside of the // 'new' function in the class constructor. mRegisteredClasses.push_back(className); } template void LuaScripting::registerClassStatic( FunPtr fp, const std::string& className, const std::string& desc, typename LuaClassRegCallback::Type callback) { // Register f as the function _new. This function will be called to construct // a pointer to the class we want to create. This function is guaranteed // to be a static function. // Construct 'constructor' table. lua_State* L = getLuaState(); LuaStackRAII _a(L, 0, 0); // Register 'new'. This will automatically create the necessary class table. std::string fqFunName = className; fqFunName += ".new"; mClassCons->registerConstructor(fp, fqFunName, desc, true, callback); setNullUndoFun(fqFunName); // We do not want to exe new when undoing // All child undo items are still executed. // Since we did the registerConstructor above we will have our function // table present. if (getFunctionTable(className) == false) throw LuaFunBindError("Unable to find table we just built!"); // Pop function table off stack. lua_pop(L, 1); // Populate the 'new' function's table with the class definition function, // and the full factory name. std::ostringstream retNewFun; retNewFun << "return " << className << ".new"; luaL_dostring(mL, retNewFun.str().c_str()); lua_pushstring(mL, className.c_str()); lua_setfield(mL, -2, LuaClassConstructor::CONS_MD_FACTORY_NAME); // Pop the new function table. lua_pop(mL, 1); // Store the class in the 'registered class' stack. // This stack lets us get rid of the callback pointers stored inside of the // 'new' function in the class constructor. mRegisteredClasses.push_back(className); } template T LuaScripting::execRet(const std::string& cmd) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); std::string retCmd = "return " + cmd; luaL_loadstring(mL, retCmd.c_str()); lua_call(mL, 0, LUA_MULTRET); T ret = LuaStrictStack::get(mL, lua_gettop(mL)); lua_pop(mL, 1); // Pop return value. return ret; } template T LuaScripting::cexecRet(const std::string& name) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(name); executeFunctionOnStack(0, 1); T ret = LuaStrictStack::get(mL, lua_gettop(mL)); lua_pop(mL, 1); // Pop return value. return ret; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS template void Tuvok_luaCheckParam(lua_State* L, const std::string& name, int typesTable, int check_pos) { LuaStackRAII _a = LuaStackRAII(L, 0, 0); lua_pushinteger(L, check_pos++); lua_gettable(L, typesTable); if (LSS_compareToTypeOnStack(L, -1) == false) { // Test the one special case (const char* --> std::string) if (( LSS_compareToTypeOnStack(L, -1) || LSS_compareToTypeOnStack(L, -1))) { if ( LSS_compareTypes() || LSS_compareTypes()) { lua_pop(L, 1); return; } } if ( LSS_compareToTypeOnStack(L, -1) || LSS_compareToTypeOnStack(L, -1) ) { if ( LSS_compareTypes() || LSS_compareTypes() ) { lua_pop(L, 1); return; } } if ( LSS_compareToTypeOnStack(L, -1) || LSS_compareToTypeOnStack(L, -1) ) { if ( LSS_compareTypes() || LSS_compareTypes() ) { lua_pop(L, 1); return; } } std::ostringstream os; os << "Invalid argument at position " << check_pos; os << " for call to function " << name; throw LuaInvalidType(os.str().c_str()); } lua_pop(L, 1); } #endif // Include cexec/cexecRet/setDefaults function bodies #include "LuaScriptingExecBody.h" template std::string LuaScripting::registerFunction(FunPtr f, const std::string& name, const std::string& desc, bool undoRedo) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); // Idea: Build a 'callable' table. // Its metatable will have a __call metamethod that points to the C // function closure. // We do this because all metatables are unique per-type which eliminates // the possibilty of using a metatable on the function closure itself. // The only exception to this rule is the table type itself. // Create a callable function table and leave it on the stack. lua_CFunction proxyFunc = &LuaCallback::returnType>::exec; createCallableFuncTable(proxyFunc, reinterpret_cast(f)); int tableIndex = lua_gettop(mL); // Add function metadata to the table. std::string sig = LuaCFunExec::getSignature(""); std::string sigWithName = LuaCFunExec::getSignature( getUnqualifiedName(name)); std::string sigNoRet = LuaCFunExec::getSigNoReturn(""); populateWithMetadata(name, desc, sig, sigWithName, sigNoRet, tableIndex); // Push default values for function parameters onto the stack. LuaCFunExec defaultParams = LuaCFunExec(); lua_checkstack(mL, LUAC_MAX_NUM_PARAMS + 2); defaultParams.pushParamsToStack(mL); int numFunParams = lua_gettop(mL) - tableIndex; createDefaultsAndLastExecTables(tableIndex, numFunParams); lua_pushinteger(mL, numFunParams); lua_setfield(mL, tableIndex, TBL_MD_NUM_PARAMS); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS // Generate the type table (buildTypeTable places table on top of the stack). LuaCFunExec::buildTypeTable(mL); lua_setfield(mL, tableIndex, TBL_MD_TYPES_TABLE); #endif // Install the callable table in the appropriate module based on its // fully qualified name. bindClosureTableWithFQName(name, tableIndex); lua_pop(mL, 1); // Pop the callable table. if (undoRedo == false) setUndoRedoStackExempt(name); return name; } template void LuaScripting::strictHookInternal( FunPtr f, const std::string& name, bool registerUndo, bool registerRedo) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); // Need to check the signature of the function that we are trying to bind // into the script system. if (getFunctionTable(name) == false) { throw LuaNonExistantFunction("Unable to find function with which to" "associate a hook."); } int funcTable = lua_gettop(mL); // Check function signatures. lua_getfield(mL, funcTable, TBL_MD_SIG_NO_RET); std::string sigReg = lua_tostring(mL, -1); std::string sigHook = LuaCFunExec::getSigNoReturn(""); if (sigReg.compare(sigHook) != 0) { std::ostringstream os; os << "Hook's parameter signature and the parameter signature of the " "function to hook must match. Hook's signature: \"" << sigHook << "\"Function to hook's signature: " << sigReg; throw LuaInvalidFunSignature(os.str().c_str()); } lua_pop(mL, 1); // Obtain hook table. lua_getfield(mL, -1, TBL_MD_HOOKS); int hookTable = lua_gettop(mL); bool regUndoRedo = (registerUndo || registerRedo); std::ostringstream os; if (!regUndoRedo) { // Generate a hook descriptor (we make it a name as opposed to a natural // number because we want Lua to use the hash table implementation behind // the scenes, not the array table). lua_getfield(mL, funcTable, TBL_MD_HOOK_INDEX); int hookIndex = lua_tointeger(mL, -1); os << "h" << hookIndex; lua_pop(mL, 1); lua_pushinteger(mL, hookIndex + 1); lua_setfield(mL, funcTable, TBL_MD_HOOK_INDEX); } // Push closure lua_CFunction proxyFunc = &LuaCallback::returnType>::exec; lua_pushlightuserdata(mL, reinterpret_cast(f)); lua_pushboolean(mL, 1); // We ARE a hook. This affects the stack, and // whether we want to perform provenance. // As a hook, we don't need to add mScriptSystem to the closure, since // we don't perform provenance on hooks. lua_pushcclosure(mL, proxyFunc, 2); if (!regUndoRedo) { // Associate closure with hook table. lua_setfield(mL, hookTable, os.str().c_str()); } else { std::string fieldToQuery = LuaScripting::TBL_MD_UNDO_FUNC; bool isUndo = true; if (registerRedo) { fieldToQuery = LuaScripting::TBL_MD_REDO_FUNC; isUndo = false; } lua_getfield(mL, funcTable, fieldToQuery.c_str()); if (lua_isnil(mL, -1) == 0) { if (isUndo) throw LuaUndoFuncAlreadySet("Undo function already set."); else throw LuaRedoFuncAlreadySet("Redo function already set."); } lua_pop(mL, 1); lua_setfield(mL, funcTable, fieldToQuery.c_str()); } lua_pop(mL, 2); // Remove the function table and the hooks table. } template void LuaScripting::strictHook(FunPtr f, const std::string& name) { strictHookInternal(f, name, false, false); } template void LuaScripting::setUndoFun(FunPtr f, const std::string& name) { // Uses strict hook. strictHookInternal(f, name, true, false); } template void LuaScripting::setRedoFun(FunPtr f, const std::string& name) { // Uses strict hook. strictHookInternal(f, name, false, true); } } /* namespace tuvok */ #endif /* LUASCRIPTING_H_ */ ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaStackRAII.h0000644000175000017500000000505212320456500021320 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief Implements RAII for the Lua stack. For internal LuaScripting uses only. Requires an unshared pointer to LuaScripting, and is only meant to exist for the lifetime of one block. */ #ifndef TUVOK_LUA_STACK_RAII_H_ #define TUVOK_LUA_STACK_RAII_H_ namespace tuvok { class LuaStackRAII { public: /// Use this class to ensure the Lua stack is cleaned up properly when an /// exception is thrown. /// \param valsConsumed The # of values removed from the stack. /// This number should NOT take into account /// valsReturned. /// \param valsReturned The number of return values pushed onto the stack. /// This number should NOT take into account /// valsConsumed. /// Example: /// void someFun(..) /// { /// LuaStackRAII _a(mL, 2, 1); /// ... /// } /// After successful completion of this function, LuaStackRAII's destructor /// expects that the stack will contain one less element relative to when /// LuaStackRAII was constructed. LuaStackRAII(lua_State* L, int valsConsumed, int valsReturned); virtual ~LuaStackRAII(); private: int mInitialStackTop; int mValsConsumed; int mValsReturned; lua_State* mL; }; } #endif ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaMemberReg.h0000644000175000017500000000402612320456500021453 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file LuaMemberReg.h \author James Hughes SCI Institute University of Utah \date Mar 26, 2012 \brief This mediator class handles member function registration. Should be instantiated alongside an encapsulating class. This is just a safe wrapper over LuaMemberRegUnsafe. */ #ifndef TUVOK_LUAMEMBER_REG_H_ #define TUVOK_LUAMEMBER_REG_H_ #include "LuaMemberRegUnsafe.h" namespace tuvok { class LuaScripting; //=============================== // LUA BINDING HELPER STRUCTURES //=============================== class LuaMemberReg : public LuaMemberRegUnsafe { public: LuaMemberReg(std::shared_ptr scriptSys); virtual ~LuaMemberReg(); private: /// Shared instance of the scripting system we are bound to. std::shared_ptr mScriptSystem_shared; }; } #endif ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaProvenance.cpp0000644000175000017500000012525012320456500022244 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief Provenance system composited inside of the LuaScripting class. Not reentrant (logging and command depth). */ #include #include #include #include "LuaScripting.h" #include "LuaProvenance.h" using namespace std; #define DEFAULT_UNDOREDO_BUFFER_SIZE (50) #define DEFAULT_PROVENANCE_BUFFER_SIZE (150) namespace tuvok { //----------------------------------------------------------------------------- LuaProvenance::LuaProvenance(LuaScripting* scripting) : mEnabled(true) , mTemporarilyDisabled(false) , mUndoingInstanceDel(false) , mStackPointer(0) , mScripting(scripting) , mMemberReg(scripting) , mLoggingProvenance(false) , mDoProvReenterException(true) , mProvenanceDescLogEnabled(false) // Disable the provenance log (performance) , mUndoRedoProvenanceDisable(false) , mCommandDepth(0) { mUndoRedoStack.reserve(DEFAULT_PROVENANCE_BUFFER_SIZE); mProvenanceDescList.reserve(DEFAULT_PROVENANCE_BUFFER_SIZE); } //----------------------------------------------------------------------------- LuaProvenance::~LuaProvenance() { // We purposefully do NOT unregister our Lua functions. // Since we are being destroyed, it is likely the lua_State has already // been closed by the class that composited us. } //----------------------------------------------------------------------------- void LuaProvenance::registerLuaProvenanceFunctions() { // NOTE: We cannot use the LuaMemberReg class to manage our registered // functions because it relies on a shared pointer to LuaScripting; since we // are composited inside of LuaScripting, no such shared pointer is available. mMemberReg.registerFunction(this, &LuaProvenance::issueUndo, "provenance.undo", "Undoes last command.", false); mMemberReg.registerFunction(this, &LuaProvenance::issueRedo, "provenance.redo", "Redoes the last undo.", false); mMemberReg.registerFunction(this, &LuaProvenance::setEnabled, "provenance.enable", "Enable/Disable provenance. This is not an " "undoable action and will clear your provenance " "history if disabled.", false); mMemberReg.registerFunction(this, &LuaProvenance::enableLogAll, "provenance.enableProvLog", "Enables/Disables provenance log (def: false).", false); mMemberReg.registerFunction(this, &LuaProvenance::clearProvenance, "provenance.clear", "Clears all provenance and undo/redo stacks. " "This is not an undo-able action.", false); mMemberReg.registerFunction(this, &LuaProvenance::enableProvReentryEx, "provenance.enableReentryException", "Enables/Disables the provenance reentry " "exception.", true); mMemberReg.registerFunction(this, &LuaProvenance::printUndoStack, "provenance.logUndoStack", "Prints the contents of the undo stack " "to 'log.info'.", false); mMemberReg.registerFunction(this, &LuaProvenance::printRedoStack, "provenance.logRedoStack", "Prints the contents of the redo stack " "to 'log.info'.", false); mMemberReg.registerFunction(this, &LuaProvenance::printProvRecordToFile, "provenance.logProvRecord_toFile", "Prints the entire provenance record " "to 'log.info'.", false); mMemberReg.registerFunction(this, &LuaProvenance::printProvRecord, "provenance.logProvRecord_toConsole", "Prints the entire provenance record " "to 'log.info'.", false); // Reentry exception does not need to be stack exempt. } //----------------------------------------------------------------------------- bool LuaProvenance::isEnabled() const { return mEnabled; } //----------------------------------------------------------------------------- void LuaProvenance::enableLogAll(bool enabled) { mProvenanceDescLogEnabled = enabled; if (mProvenanceDescLogEnabled == false) { mProvenanceDescList.clear(); } } //----------------------------------------------------------------------------- void LuaProvenance::setEnabled(bool enabled) { if (enabled == false && mEnabled == true) { clearProvenance(); } mEnabled = enabled; } //----------------------------------------------------------------------------- void LuaProvenance::ammendLastProvLog(const string& ammend) { if (mProvenanceDescList.size() <= 0) return; string ammendedLog = mProvenanceDescList.back(); ammendedLog += ammend; mProvenanceDescList.pop_back(); mProvenanceDescList.push_back(ammendedLog); } //----------------------------------------------------------------------------- void LuaProvenance::logHooks(int staticHooks, int memberHooks) { if (mEnabled == false || mProvenanceDescLogEnabled == false) return; int hooksCalled = staticHooks + memberHooks; ostringstream os; os << " -- " << hooksCalled << " hook(s) called"; ammendLastProvLog(os.str()); } //----------------------------------------------------------------------------- void LuaProvenance::logExecution(const string& fname, bool undoRedoStackExempt, shared_ptr funParams, shared_ptr emptyParams) { // TODO: Add indentation to provenance record for registered functions that // are called within other registered functions. if (mTemporarilyDisabled || mEnabled == false) return; if (mLoggingProvenance) { if (mDoProvReenterException) { /// Throw provenance reentry exception. throw LuaProvenanceReenter("LuaProvenance reentry not allowed. Consider" "disabling provenance.enableReentryException"); } else { return; } } mLoggingProvenance = true; if (mProvenanceDescLogEnabled) { string provParams = funParams->getFormattedParameterValues(); ostringstream os; if (mUndoRedoProvenanceDisable) os << " -- Called: \""; os << fname << "(" << provParams << ")" << " - depth:" << mCommandDepth; if (mUndoRedoProvenanceDisable) { os << "\""; ammendLastProvLog(os.str()); } else { mProvenanceDescList.push_back(os.str()); } } if (undoRedoStackExempt || mUndoRedoProvenanceDisable) { mLoggingProvenance = false; return; } // Erase redo hisory if we have a stack pointer beneath the top of the stack. int stackDiff = static_cast(mUndoRedoStack.size()) - mStackPointer; for (int i = 0; i < stackDiff; i++) { mUndoRedoStack.pop_back(); } assert(mUndoRedoStack.size() == static_cast(mStackPointer)); // Gather last execution parameters for inclusion in the undo stack. lua_State* L = mScripting->getLuaState(); LuaStackRAII _a = LuaStackRAII(L, 0, 0); if (mScripting->getFunctionTable(fname.c_str()) == false) throw LuaError("Provenance unable to find function"); lua_getfield(L, -1, LuaScripting::TBL_MD_FUN_LAST_EXEC); int lastExecTable = lua_gettop(L); lua_checkstack(L, LUAC_MAX_NUM_PARAMS + 2); // 2 = key/value pair. // Count the number of parameters. int numParams = 0; lua_pushnil(L); while (lua_next(L, lastExecTable)) { lua_pop(L, 1); ++numParams; } // Populate the stack in the correct order (order is incredibly important!) for (int i = 0; i < numParams; i++) { lua_pushinteger(L, i); lua_gettable(L, lastExecTable); } // Now we have all of the parameters at the top of the stack, extract them // using emptyParams. if (numParams != 0) { int stackTopWithParams = lua_gettop(L); emptyParams->pullParamsFromStack(L, stackTopWithParams - (numParams - 1)); lua_pop(L, numParams); } if (mCommandDepth == 0) { mUndoRedoStack.push_back(UndoRedoItem(fname, emptyParams, funParams)); ++mStackPointer; } else { assert(!mUndoRedoStack.empty()); // Push a child (child on the top of the stack -- we know there must be an // entry on the top of the stack because our depth is greater than 0). mUndoRedoStack.back().addChildItem( UndoRedoItem(fname, emptyParams, funParams)); } // Repopulate the lastExec table to most recently executed function parameters // We are overwriting the previous entries (see // createDefaultsAndLastExecTables in LuaScripting). int firstParam = lua_gettop(L) + 1; funParams->pushParamsToStack(L); assert(numParams == (lua_gettop(L) - (firstParam - 1))); for (int i = 0; i < numParams; i++) { lua_pushinteger(L, i); lua_pushvalue(L, firstParam + i); lua_settable(L, lastExecTable); } lua_pop(L, numParams); lua_pop(L, 2); // Function's table and last exec table. mLoggingProvenance = false; } //----------------------------------------------------------------------------- int LuaProvenance::bruteRerollDetermineUndos(int undoIndex) { int numUndos = 0; vector unresolved; // Unresolved instances. bool resolved = false; while (undoIndex >= 0) { UndoRedoItem undoItem = mUndoRedoStack[undoIndex]; ++numUndos; // Always want to undo once more than resolved location. if (undoItem.instDeletions.get()) { // It doesn't matter where we copy (front or back). // Don't need to worry about duplicates. We can't delete classes // multiple times. unresolved.reserve( unresolved.size() + undoItem.instDeletions->size()); unresolved.insert( unresolved.end(), undoItem.instDeletions->begin(), undoItem.instDeletions->end()); sort(unresolved.begin(), unresolved.end()); // Sanity check that there are no duplicates, and that the list is // sequential (no gaps). These must be true due to non-duplication int last = *unresolved.begin(); for (vector::iterator it = unresolved.begin() + 1; it != unresolved.end(); ++it) { if (last == *it) { throw LuaProvenanceFailedUndo("Duplicate global IDs"); } last = *it; } } if (undoItem.instCreations.get()) { // instDeletions and instCreations are always sorted. vector diff; // Could make this more efficient if stored above. diff.resize(max(unresolved.size(), undoItem.instCreations->size()), 0); vector::iterator it = set_difference( unresolved.begin(), unresolved.end(), undoItem.instCreations->begin(), undoItem.instCreations->end(), diff.begin()); // Could just use back_inserter... unresolved.clear(); vector::size_type resultSize = it - diff.begin(); if (resultSize > 0) { unresolved.resize(resultSize, 0); std::copy(diff.begin(), it, unresolved.begin()); } } if (unresolved.size() == 0) { resolved = true; break; } --undoIndex; } if (resolved == false) { throw LuaProvenanceFailedUndo("Not enough information in undo buffer " "to undo specified operation."); } return numUndos; } //----------------------------------------------------------------------------- void LuaProvenance::issueUndo() { if (mEnabled == false) return; // If mStackPointer is at 1, then we can undo to the 'default' state. if (mStackPointer == 0) { throw LuaProvenanceInvalidUndo("Undo pointer at bottom of stack."); } int undoIndex = mStackPointer - 1; UndoRedoItem undoItem = mUndoRedoStack[undoIndex]; int numUndos = 1; // Check to see if this step deleted any instances. If it did, we will have // to check how far back we need to undo. Then force the entire system // to undo to that point. if (undoItem.instDeletions.get() != 0) { // Detect how far back we need to roll. mUndoingInstanceDel = true; numUndos = bruteRerollDetermineUndos(undoIndex); } // This is the brute reroll. // In order to deal with class deletions, we roll back to when they // were created and redo everything. // There is a more efficient way of doing this, but this is // guaranteed to work without any special code. It serves as a good // baseline algorithm. for (int i = 0; i < numUndos; i++) { issueUndoInternal(); } // Redo back to directly before undo (the vast majority of the time -- the // times we don't have any instance deletions -- we never enter this loop). // NOTE: We don't need to set the global ID instance range here! That is // handled automatically inside issueRedo. for (int i = 0; i < numUndos - 1; i++) { issueRedo(); } mUndoingInstanceDel = false; } //----------------------------------------------------------------------------- void LuaProvenance::issueUndoInternal() { if (mStackPointer == 0) { throw LuaProvenanceInvalidUndo("Undo pointer at bottom of stack."); } int undoIndex = mStackPointer - 1; UndoRedoItem undoItem = mUndoRedoStack[undoIndex]; try { performUndoRedoOp(undoItem.function, undoItem.undoParams, true); } catch (LuaProvenanceInvalidUndoOrRedo& e) { throw LuaProvenanceInvalidUndo(e.what(), e.where(), e.lineno()); } if (undoItem.childItems.get() != NULL) { // Iterate through all of the children, and undo those as well. // Note: Notice, we are undoing the parent first, then all of the children. // This constitutes a reversal of the function calls from redo. for (std::vector::iterator it = undoItem.childItems->begin(); it != undoItem.childItems->end(); it++) { try { performUndoRedoOp(it->function, it->undoParams, true); } catch (LuaProvenanceInvalidUndoOrRedo& e) { throw LuaProvenanceInvalidUndo(e.what(), e.where(), e.lineno()); } } } // Delete any instances that were created at the end of the redo chain. if (undoItem.instCreations.get() != 0) { // Manually call the delete function (no provenance). mUndoRedoProvenanceDisable = true; for (vector::iterator it = undoItem.instCreations->begin(); it != undoItem.instCreations->end(); ++it) { mScripting->deleteLuaClassInstance(LuaClassInstance(*it)); } mUndoRedoProvenanceDisable = false; } --mStackPointer; } //----------------------------------------------------------------------------- void LuaProvenance::issueRedo() { if (mEnabled == false) return; if (static_cast(mStackPointer) == mUndoRedoStack.size()) { throw LuaProvenanceInvalidRedo("Redo pointer at top of stack."); } // The stack pointer is 1 based, this is the next element on the stack. int redoIndex = mStackPointer; UndoRedoItem redoItem = mUndoRedoStack[redoIndex]; // Upon recreation of instances, we need to ensure our instances have // the same ID's. This code block will ensure that. if (redoItem.instCreations.get() != 0) { // instCreations is always ordered. int lowestID = redoItem.instCreations->front(); int highestID = redoItem.instCreations->back(); mScripting->setNextTempClassInstRange(lowestID, highestID); } try { performUndoRedoOp(redoItem.function, redoItem.redoParams, false); } catch (LuaProvenanceInvalidUndoOrRedo& e) { throw LuaProvenanceInvalidRedo(e.what(), e.where(), e.lineno()); } // Issue redo to all children ONLY if flag is set (the only function that // sets the flag is setLastItemAsAlsoRedoChildren). if (redoItem.alsoRedoChildren) { if (redoItem.childItems.get() != NULL) { // Iterate through all of the children, and undo those as well. // Note: Notice, we are undoing the parent first, then all of the children. // This constitutes a reversal of the function calls from redo. for (std::vector::iterator it=redoItem.childItems->begin(); it != redoItem.childItems->end(); it++) { try { performUndoRedoOp(it->function, it->redoParams, false); } catch (LuaProvenanceInvalidUndoOrRedo& e) { throw LuaProvenanceInvalidRedo(e.what(), e.where(), e.lineno()); } } } } // Notice, we ignore any child undo/redo items. They exist solely to help // undo reset the program state when a composited function is undone. ++mStackPointer; } //----------------------------------------------------------------------------- void LuaProvenance::performUndoRedoOp(const string& funcName, shared_ptr params, bool isUndo) { // Obtain function's table, then grab its metamethod __call. // Push parameters onto the stack after the __call method, and execute. lua_State* L = mScripting->getLuaState(); LuaStackRAII _a = LuaStackRAII(L, 0, 0); if (mScripting->getFunctionTable(funcName) == false) { if (mUndoingInstanceDel) { // Failed to find the function. Since we are undoing, we assume this was // due to an instance call that no longer exists. We ignore it for now. return; } else { throw LuaProvenanceInvalidUndoOrRedo("Function table does not exist."); } } int funTable = lua_gettop(L); if (lua_isnil(L, -1)) { throw LuaProvenanceInvalidUndoOrRedo("Function table does not exist."); } if (lua_getmetatable(L, -1)) { // Push function onto the stack. bool hasHook = false; if (isUndo) { // Check to see if we should not execute any undo. lua_getfield(L, funTable, LuaScripting::TBL_MD_NULL_UNDO); if (!(lua_isnil(L, -1) == 0 && lua_toboolean(L, -1) == 1)) { lua_pop(L, 1); // Check for an undo hook lua_getfield(L, funTable, LuaScripting::TBL_MD_UNDO_FUNC); if (lua_isnil(L, -1) == 0) hasHook = true; else lua_pop(L, 1); } else { lua_pop(L, 1); luaL_dostring(L, "return function(...) end"); // null vararg function hasHook = true; } } else { // Check for redo hook lua_getfield(L, funTable, LuaScripting::TBL_MD_NULL_REDO); if (!(lua_isnil(L, -1) == 0 && lua_toboolean(L, -1) == 1)) { lua_pop(L, 1); lua_getfield(L, funTable, LuaScripting::TBL_MD_REDO_FUNC); if (lua_isnil(L, -1) == 0) hasHook = true; else lua_pop(L, 1); } else { lua_pop(L, 1); luaL_dostring(L, "return function(...) end"); // null vararg function hasHook = true; } } // If we don't have a hook, just use the function itself. if (hasHook == false) { lua_getfield(L, -1, "__call"); if (lua_isnil(L, -1)) { throw LuaProvenanceInvalidUndoOrRedo("Function has invalid function " "pointer."); } // Before we push the parameters, we need to push the function table. // (this is always the first parameter for non-hook functions). lua_pushvalue(L, funTable); } // Push parameters onto the stack. int paramStart = lua_gettop(L); params->pushParamsToStack(L); int numParams = lua_gettop(L) - paramStart; paramStart += 1; // Determine the number of parameters. There is one extra parameter for // functions who are not hooks (the function table itself). int functionParams = numParams; if (hasHook == false) functionParams++; // Execute the call (ignore return values). // This will pop all parameters and the function off the stack. mUndoRedoProvenanceDisable = true; lua_call(L, functionParams, 0); mUndoRedoProvenanceDisable = false; // Pop the metatable lua_pop(L, 1); // Last exec table parameters will match what we just executed. paramStart = lua_gettop(L); params->pushParamsToStack(L); numParams = lua_gettop(L) - paramStart; paramStart += 1; lua_getfield(L, funTable, LuaScripting::TBL_MD_FUN_LAST_EXEC); mScripting->copyParamsToTable(lua_gettop(L), paramStart, numParams); // Remove last exec table from the stack. lua_pop(L, 1); // Remove parameters from stack. lua_pop(L, numParams); } else { throw LuaProvenanceInvalidUndoOrRedo("Does not appear to be a valid " "function."); } // Pop the function table lua_pop(L, 1); } //----------------------------------------------------------------------------- void LuaProvenance::clearProvenance() { mUndoRedoStack.clear(); mStackPointer = 0; // Clear out last exec for ALL functions. This will clean up any dangling // shared pointers. mScripting->clearAllLastExecTables(); mScripting->exec("collectgarbage()"); // Force a gc cycle to clean up all // shared_ptrs. } //----------------------------------------------------------------------------- void LuaProvenance::enableProvReentryEx(bool enable) { mDoProvReenterException = enable; } //----------------------------------------------------------------------------- vector LuaProvenance::getUndoStackDesc() { // Print from the current stack pointer downwards. vector ret; string undoVals; string redoVals; string result; for (int i = mStackPointer - 1; i >= 0; i--) { undoVals = mUndoRedoStack[i].undoParams->getFormattedParameterValues(); redoVals = mUndoRedoStack[i].redoParams->getFormattedParameterValues(); ostringstream os; const string& fun = mUndoRedoStack[i].function; os << fun << "(" << undoVals << ") -- " << fun << "(" << redoVals << ")"; ret.push_back(os.str()); } return ret; } //----------------------------------------------------------------------------- vector LuaProvenance::getRedoStackDesc() { // Print from the current stack pointer downwards. vector ret; string undoVals; string redoVals; string result; for (vector::size_type i = mStackPointer; i < mUndoRedoStack.size(); i++) { undoVals = mUndoRedoStack[i].undoParams->getFormattedParameterValues(); redoVals = mUndoRedoStack[i].redoParams->getFormattedParameterValues(); ostringstream os; const string& fun = mUndoRedoStack[i].function; os << fun << "(" << redoVals << ") -- " << fun << "(" << undoVals << ")"; ret.push_back(os.str()); } return ret; } //----------------------------------------------------------------------------- void LuaProvenance::beginCommand() { if (mEnabled == false) return; ++mCommandDepth; } //----------------------------------------------------------------------------- void LuaProvenance::endCommand() { if (mEnabled == false) return; --mCommandDepth; } //----------------------------------------------------------------------------- std::vector LuaProvenance::getFullProvenanceDesc() { return mProvenanceDescList; } //----------------------------------------------------------------------------- void LuaProvenance::printUndoStack() { mScripting->exec("log.info(''); log.info('Undo Stack (left is undo, " "right redo):');"); if (mEnabled == false) mScripting->exec("log.info('** Provenance disabled.')"); vector undoStack = getUndoStackDesc(); for (vector::reverse_iterator it = undoStack.rbegin(); it != undoStack.rend(); ++it) { // We use cexec for a little bit more efficiency. mScripting->cexec("log.info", (*it)); } } //----------------------------------------------------------------------------- void LuaProvenance::printRedoStack() { mScripting->exec("log.info(''); log.info('Redo Stack (left is redo, " "right undo):');"); if (mEnabled == false) mScripting->exec("log.info('** Provenance disabled.')"); vector undoStack = getRedoStackDesc(); for (vector::reverse_iterator it = undoStack.rbegin(); it != undoStack.rend(); ++it) { mScripting->cexec("log.info", (*it)); } } //----------------------------------------------------------------------------- void LuaProvenance::printProvRecord() { mScripting->exec("log.info(''); log.info('Provenance Record:');"); if (mEnabled == false) mScripting->exec("log.info('** Provenance disabled.')"); vector undoStack = getFullProvenanceDesc(); for (vector::iterator it = undoStack.begin(); it != undoStack.end(); ++it) { mScripting->cexec("log.info", (*it)); } } //----------------------------------------------------------------------------- void LuaProvenance::printProvRecordToFile(const std::string& file) { ofstream f; f.open(file.c_str()); f << "Provenance Record:" << endl; if (mEnabled == false) { f << "** Provenance disabled." << endl; } vector undoStack = getFullProvenanceDesc(); for (vector::iterator it = undoStack.begin(); it != undoStack.end(); ++it) { f << (*it) << endl; } f.close(); } //----------------------------------------------------------------------------- void LuaProvenance::setDisableProvTemporarily(bool disable) { mTemporarilyDisabled = disable; } //----------------------------------------------------------------------------- void LuaProvenance::addDeletedInstanceToLastURItem(int globalID) { if (mUndoRedoProvenanceDisable == true || mEnabled == false) return; // The stack pointer might be zero if we are being deleted at program // termination. if (mStackPointer >= 1) { mUndoRedoStack.back().addInstDeletion(globalID); } } //----------------------------------------------------------------------------- void LuaProvenance::addCreatedInstanceToLastURItem(int globalID) { if (mUndoRedoProvenanceDisable == true || mEnabled == false) return; assert(mStackPointer >= 1); mUndoRedoStack.back().addInstCreation(globalID); } //----------------------------------------------------------------------------- bool LuaProvenance::testLastURItemHasDeletedItems(const vector& delItems) const { if (mUndoRedoStack.size() == 0) return false; UndoRedoItem ur = mUndoRedoStack.back(); if (ur.instDeletions.get() == 0) { return delItems.size() == 0 ? true : false; } for (vector::const_iterator it = delItems.begin(); it != delItems.end(); ++it) { if (find(ur.instDeletions->begin(), ur.instDeletions->end(), *it) == ur.instDeletions->end()) { return false; } } return true; } //----------------------------------------------------------------------------- bool LuaProvenance::testLastURItemHasCreatedItems(const vector& createdItems) const { if (mUndoRedoStack.size() == 0) return false; UndoRedoItem ur = mUndoRedoStack.back(); if (ur.instCreations.get() == 0) { return createdItems.size() == 0 ? true : false; } for (vector::const_iterator it = createdItems.begin(); it != createdItems.end(); ++it) { if (find(ur.instCreations->begin(), ur.instCreations->end(), *it) == ur.instCreations->end()) { return false; } } return true; } //----------------------------------------------------------------------------- void LuaProvenance::setLastURItemAlsoRedoChildren() { if (!mUndoRedoStack.empty()) { mUndoRedoStack.back().alsoRedoChildren = true; } } } // namespace tuvok //============================================================================== // // UNIT TESTING // //============================================================================== #ifdef LUASCRIPTING_UNIT_TESTS #include "utestCommon.h" #include "LuaMemberReg.h" using namespace tuvok; SUITE(LuaProvenanceTests) { class A { public: A(shared_ptr ss) : mReg(ss) { i1 = 0; i2 = 0; f1 = 0.0f; f2 = 0.0f; } int i1, i2; float f1, f2; string s1, s2; void set_i1(int i) {i1 = i;} void set_i2(int i) {i2 = i;} int get_i1() {return i1;} int get_i2() {return i2;} void set_f1(float f) {f1 = f;} void set_f2(float f) {f2 = f;} float get_f1() {return f1;} float get_f2() {return f2;} void set_s1(string s) {s1 = s;} void set_s2(string s) {s2 = s;} string get_s1() {return s1;} string get_s2() {return s2;} LuaMemberReg mReg; }; TEST(ProvenanceClassTests) { TEST_HEADER; shared_ptr sc(new LuaScripting()); unique_ptr a(new A(sc)); a->mReg.registerFunction(a.get(), &A::set_i1, "set_i1", "", true); a->mReg.registerFunction(a.get(), &A::set_i2, "set_i2", "", true); a->mReg.registerFunction(a.get(), &A::get_i1, "get_i1", "", false); a->mReg.registerFunction(a.get(), &A::get_i2, "get_i2", "", false); a->mReg.registerFunction(a.get(), &A::set_f1, "set_f1", "", true); a->mReg.registerFunction(a.get(), &A::set_f2, "set_f2", "", true); a->mReg.registerFunction(a.get(), &A::get_f1, "get_f1", "", false); a->mReg.registerFunction(a.get(), &A::get_f2, "get_f2", "", false); a->mReg.registerFunction(a.get(), &A::set_s1, "set_s1", "", true); a->mReg.registerFunction(a.get(), &A::set_s2, "set_s2", "", true); a->mReg.registerFunction(a.get(), &A::get_s1, "get_s1", "", false); a->mReg.registerFunction(a.get(), &A::get_s2, "get_s2", "", false); sc->setExpectedExceptionFlag(true); CHECK_THROW(sc->exec("provenance.redo()"), LuaProvenanceInvalidRedo); CHECK_THROW(sc->exec("provenance.undo()"), LuaProvenanceInvalidUndo); sc->setExpectedExceptionFlag(false); sc->exec("set_i1(1)"); sc->exec("set_i2(10)"); sc->exec("set_i1(2)"); sc->exec("set_i1(3)"); sc->exec("set_i2(20)"); sc->exec("set_f1(2.3)"); sc->exec("set_s1('T')"); sc->exec("set_s1('Test')"); sc->exec("set_s2('Test2')"); sc->exec("set_f1(1.5)"); sc->exec("set_i1(100)"); sc->exec("set_i2(30)"); sc->exec("set_f2(-5.3)"); // Check final values. CHECK_EQUAL(a->i1, 100); CHECK_EQUAL(a->i2, 30); CHECK_CLOSE(a->f1, 1.5f, 0.001f); CHECK_CLOSE(a->f2, -5.3f, 0.001f); CHECK_EQUAL(a->s1.c_str(), "Test"); CHECK_EQUAL(a->s2.c_str(), "Test2"); sc->setExpectedExceptionFlag(true); CHECK_THROW(sc->exec("provenance.redo()"), LuaProvenanceInvalidRedo); sc->setExpectedExceptionFlag(false); // Begin issuing undo / redos sc->exec("provenance.undo()"); CHECK_CLOSE(a->f2, 0.0f, 0.001f); sc->exec("provenance.redo()"); CHECK_CLOSE(a->f2, -5.3f, 0.001f); sc->exec("provenance.undo()"); CHECK_CLOSE(a->f2, 0.0f, 0.001f); sc->exec("provenance.undo()"); CHECK_EQUAL(a->i2, 20); sc->exec("provenance.undo()"); CHECK_EQUAL(a->i1, 3); sc->exec("provenance.redo()"); CHECK_EQUAL(a->i1, 100); sc->exec("provenance.undo()"); CHECK_EQUAL(a->i1, 3); sc->exec("provenance.undo()"); CHECK_CLOSE(a->f1, 2.3f, 0.001f); sc->exec("provenance.undo()"); CHECK_EQUAL(a->s2.c_str(), ""); sc->exec("provenance.redo()"); CHECK_EQUAL(a->s2.c_str(), "Test2"); sc->exec("provenance.redo()"); CHECK_CLOSE(a->f1, 1.5f, 0.001f); sc->exec("provenance.redo()"); CHECK_EQUAL(a->i1, 100); sc->exec("provenance.undo()"); CHECK_EQUAL(a->i1, 3); sc->exec("provenance.undo()"); CHECK_CLOSE(a->f1, 2.3f, 0.001f); sc->exec("provenance.undo()"); CHECK_EQUAL(a->s2.c_str(), ""); sc->exec("provenance.undo()"); CHECK_EQUAL(a->s1.c_str(), "T"); sc->exec("provenance.undo()"); CHECK_EQUAL(a->s1.c_str(), ""); sc->exec("provenance.undo()"); CHECK_CLOSE(a->f1, 0.0f, 0.001f); sc->exec("provenance.undo()"); CHECK_EQUAL(a->i2, 10); sc->exec("provenance.undo()"); CHECK_EQUAL(a->i1, 2); sc->exec("provenance.undo()"); CHECK_EQUAL(a->i1, 1); sc->exec("provenance.undo()"); CHECK_EQUAL(a->i2, 0); sc->exec("provenance.undo()"); CHECK_EQUAL(a->i1, 0); // This invalid undo should not destroy state. sc->setExpectedExceptionFlag(true); CHECK_THROW(sc->exec("provenance.undo()"), LuaProvenanceInvalidUndo); sc->setExpectedExceptionFlag(false); // Check to make sure default values are present. CHECK_EQUAL(a->i1, 0); CHECK_EQUAL(a->i2, 0); CHECK_CLOSE(a->f1, 0.0f, 0.001f); CHECK_CLOSE(a->f2, 0.0f, 0.001f); CHECK_EQUAL(a->s1.c_str(), ""); CHECK_EQUAL(a->s2.c_str(), ""); // Check redoing EVERYTHING. sc->exec("provenance.redo()"); CHECK_EQUAL(a->i1, 1); sc->exec("provenance.redo()"); CHECK_EQUAL(a->i2, 10); sc->exec("provenance.redo()"); CHECK_EQUAL(a->i1, 2); sc->exec("provenance.redo()"); CHECK_EQUAL(a->i1, 3); sc->exec("provenance.redo()"); CHECK_EQUAL(a->i2, 20); sc->exec("provenance.redo()"); CHECK_CLOSE(a->f1, 2.3f, 0.001f); sc->exec("provenance.redo()"); CHECK_EQUAL(a->s1, "T"); sc->exec("provenance.redo()"); CHECK_EQUAL(a->s1, "Test"); sc->exec("provenance.redo()"); CHECK_EQUAL(a->s2, "Test2"); sc->exec("provenance.redo()"); CHECK_CLOSE(a->f1, 1.5f, 0.001f); sc->exec("provenance.redo()"); CHECK_EQUAL(a->i1, 100); sc->exec("provenance.redo()"); CHECK_EQUAL(a->i2, 30); sc->exec("provenance.redo()"); CHECK_CLOSE(a->f2, -5.3f, 0.001f); sc->setExpectedExceptionFlag(true); CHECK_THROW(sc->exec("provenance.redo()"), LuaProvenanceInvalidRedo); sc->setExpectedExceptionFlag(false); // Check final values again. CHECK_EQUAL(a->i1, 100); CHECK_EQUAL(a->i2, 30); CHECK_CLOSE(a->f1, 1.5f, 0.001f); CHECK_CLOSE(a->f2, -5.3f, 0.001f); CHECK_EQUAL(a->s1.c_str(), "Test"); CHECK_EQUAL(a->s2.c_str(), "Test2"); // Check lopping off sections of the redo buffer. sc->exec("provenance.undo()"); sc->exec("provenance.undo()"); sc->exec("provenance.undo()"); sc->exec("set_i1(42)"); CHECK_EQUAL(42, a->i1); sc->setExpectedExceptionFlag(true); CHECK_THROW(sc->exec("provenance.redo()"), LuaProvenanceInvalidRedo); sc->setExpectedExceptionFlag(false); sc->exec("provenance.undo()"); sc->exec("provenance.undo()"); sc->exec("provenance.redo()"); sc->exec("set_i1(45)"); sc->setExpectedExceptionFlag(true); CHECK_THROW(sc->exec("provenance.redo()"), LuaProvenanceInvalidRedo); sc->setExpectedExceptionFlag(false); // Uncomment to view all provenance. //sc->exec("provenance.logProvRecord()"); } static int i1 = 0; static string s1 = "nop"; static bool b1 = false; static void set_i1(int a) {i1 = a;} static void set_s1(string s) {s1 = s;} static void set_b1(bool a) {b1 = a;} TEST(ProvenanceStaticTests) { // We don't need to test the provenance functionality, just that it is // hooked up correctly. The above TEST tests the provenance system fairly // thoroughly. TEST_HEADER; unique_ptr sc(new LuaScripting()); sc->registerFunction(&set_i1, "set_i1", "", true); sc->registerFunction(&set_s1, "set_s1", "", true); sc->setDefaults("set_s1", "nop", false); sc->registerFunction(&set_b1, "set_b1", "", true); sc->exec("set_i1(23)"); sc->exec("set_s1('Test String')"); sc->exec("set_b1(true)"); CHECK_EQUAL(23, i1); CHECK_EQUAL("Test String", s1.c_str()); CHECK_EQUAL(true, b1); sc->exec("provenance.undo()"); CHECK_EQUAL(false, b1); sc->exec("provenance.undo()"); CHECK_EQUAL("nop", s1.c_str()); sc->exec("provenance.redo()"); CHECK_EQUAL("Test String", s1.c_str()); sc->exec("provenance.undo()"); CHECK_EQUAL("nop", s1.c_str()); sc->exec("provenance.undo()"); CHECK_EQUAL(0, i1); } LuaScripting* sc = NULL; static void set_i1_s1_b1(int a, string b, bool c) { // This is roundabout, but the whole idea is to test composited lua // provenance enabled functions. { ostringstream os; os << "set_i1(" << a << ")"; sc->exec(os.str()); } { ostringstream os; os << "set_s1('" << b << "')"; sc->exec(os.str()); } { ostringstream os; if (c) os << "set_b1(true)"; else os << "set_b1(false)"; sc->exec(os.str()); } } TEST(ProvenanceCompositeSingle) { TEST_HEADER; sc = new LuaScripting(); sc->registerFunction(&set_i1, "set_i1", "", true); sc->registerFunction(&set_s1, "set_s1", "", true); sc->setDefaults("set_s1", "nop", false); sc->registerFunction(&set_b1, "set_b1", "", true); sc->registerFunction(&set_i1_s1_b1, "setAll", "", true); sc->exec("set_i1(23)"); sc->exec("set_s1('Test String')"); sc->exec("set_b1(true)"); CHECK_EQUAL(23, i1); CHECK_EQUAL("Test String", s1.c_str()); CHECK_EQUAL(true, b1); sc->exec("setAll(78, 'Str Test', false)"); CHECK_EQUAL(78, i1); CHECK_EQUAL("Str Test", s1.c_str()); CHECK_EQUAL(false, b1); sc->exec("provenance.undo()"); // Check to make sure i1, s1, and b1 do not have default values. // (ensure composited functions implement undo correctly). CHECK_EQUAL(23, i1); CHECK_EQUAL("Test String", s1.c_str()); CHECK_EQUAL(true, b1); delete sc; } static int i2 = 0; static string s2 = "nop"; static bool b2 = false; static void set_i2(int a) {i2 = a;} static void set_s2(string s) {s2 = s;} static void set_b2(bool a) {b2 = a;} static void dup_s2(string b) { { ostringstream os; os << "set_s2('" << b << "')"; sc->exec(os.str()); } } static void setMultPrelude(int a, string b) { { ostringstream os; os << "set_i2(" << a << ")"; sc->exec(os.str()); } { ostringstream os; os << "dup_s2('" << b << "')"; sc->exec(os.str()); } } static void setMult(int a, string b, bool c) { { ostringstream os; os << "setAll_1(" << a << ",'" << b << "'," << boolalpha << c << ")"; sc->exec(os.str()); } { ostringstream os; os << "setMult_2(" << a << ",'" << b << "')"; sc->exec(os.str()); } { ostringstream os; os << "set_b2(" << boolalpha << c << ")"; sc->exec(os.str()); } } TEST(ProvenanceCompositeMultiple) { TEST_HEADER; // Similar to ProvenanceSingleCommandDepth, but we want to test // composited functions of composited functions. sc = new LuaScripting(); sc->registerFunction(&set_i1, "set_i1", "", true); sc->registerFunction(&set_s1, "set_s1", "", true); sc->registerFunction(&set_b1, "set_b1", "", true); sc->registerFunction(&set_i1_s1_b1, "setAll_1", "", true); sc->registerFunction(&set_i2, "set_i2", "", true); sc->registerFunction(&set_s2, "set_s2", "", true); sc->registerFunction(&dup_s2, "dup_s2", "", true); sc->registerFunction(&set_b2, "set_b2", "", true); sc->registerFunction(&setMultPrelude, "setMult_2", "", true); sc->registerFunction(&setMult, "setAll", "", true); sc->exec("set_i1(23)"); sc->exec("set_s1('Test String')"); sc->exec("set_b1(true)"); CHECK_EQUAL(23, i1); CHECK_EQUAL("Test String", s1.c_str()); CHECK_EQUAL(true, b1); sc->exec("set_i2(46)"); sc->exec("set_s2('2nd string')"); sc->exec("set_b2(true)"); CHECK_EQUAL(46, i2); CHECK_EQUAL("2nd string", s2.c_str()); CHECK_EQUAL(true, b2); sc->exec("setAll(78, 'Str Test', false)"); CHECK_EQUAL(78, i1); CHECK_EQUAL("Str Test", s1.c_str()); CHECK_EQUAL(false, b1); CHECK_EQUAL(78, i2); CHECK_EQUAL("Str Test", s2.c_str()); CHECK_EQUAL(false, b2); sc->exec("provenance.undo()"); // Check to make sure i1, s1, and b1 do not have default values. // (ensure composited functions implement undo correctly). CHECK_EQUAL(23, i1); CHECK_EQUAL("Test String", s1.c_str()); CHECK_EQUAL(true, b1); CHECK_EQUAL(46, i2); CHECK_EQUAL("2nd string", s2.c_str()); CHECK_EQUAL(true, b2); delete sc; } TEST(ProvenanceNullUndoRedo) { TEST_HEADER; unique_ptr sc(new LuaScripting()); sc->registerFunction(&set_i1, "set_i1", "", true); sc->setNullUndoFun("set_i1"); sc->registerFunction(&set_s1, "set_s1", "", true); sc->setNullUndoFun("set_s1"); sc->registerFunction(&set_b1, "set_b1", "", true); sc->setNullRedoFun("set_b1"); sc->exec("set_i1(23)"); sc->exec("set_s1('Test String')"); sc->exec("set_b1(true)"); CHECK_EQUAL(23, i1); CHECK_EQUAL("Test String", s1.c_str()); CHECK_EQUAL(true, b1); sc->exec("provenance.undo()"); CHECK_EQUAL(false, b1); // Null undo function. sc->exec("provenance.undo()"); CHECK_EQUAL("Test String", s1.c_str()); sc->exec("provenance.redo()"); CHECK_EQUAL("Test String", s1.c_str()); sc->exec("provenance.undo()"); CHECK_EQUAL("Test String", s1.c_str()); // Null undo function sc->exec("provenance.undo()"); CHECK_EQUAL(23, i1); sc->exec("provenance.redo()"); sc->exec("provenance.redo()"); // Null redo function sc->exec("provenance.redo()"); CHECK_EQUAL(false, b1); } TEST(ProvenanceDisabling) { TEST_HEADER; // Test whether the provenance system can be properly disabled. } } #endif ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaScriptingExecHeader.h0000644000175000017500000001511012320456500023462 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ // This header file is automatically generated. // Contains definitions for executing bound Lua functions inside of a class. #ifndef TUVOK_LUAEXECHEADER_H_ #define TUVOK_LUAEXECHEADER_H_ #define TUVOK_LUA_CEXEC_FUNCTIONS \ template \ void cexec(const std::string& cmd, P1 p1);\ template \ void cexec(const std::string& cmd, P1 p1, P2 p2);\ template \ void cexec(const std::string& cmd, P1 p1, P2 p2, P3 p3);\ template \ void cexec(const std::string& cmd, P1 p1, P2 p2, P3 p3, P4 p4);\ template \ void cexec(const std::string& cmd, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5);\ template \ void cexec(const std::string& cmd, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6);\ template \ void cexec(const std::string& cmd, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7);\ template \ void cexec(const std::string& cmd, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8);\ template \ void cexec(const std::string& cmd, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9);\ template \ void cexec(const std::string& cmd, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10); #define TUVOK_LUA_CEXEC_RET_FUNCTIONS \ template \ T cexecRet(const std::string& cmd, P1 p1);\ template \ T cexecRet(const std::string& cmd, P1 p1, P2 p2);\ template \ T cexecRet(const std::string& cmd, P1 p1, P2 p2, P3 p3);\ template \ T cexecRet(const std::string& cmd, P1 p1, P2 p2, P3 p3, P4 p4);\ template \ T cexecRet(const std::string& cmd, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5);\ template \ T cexecRet(const std::string& cmd, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6);\ template \ T cexecRet(const std::string& cmd, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7);\ template \ T cexecRet(const std::string& cmd, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8);\ template \ T cexecRet(const std::string& cmd, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9);\ template \ T cexecRet(const std::string& cmd, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10); #define TUVOK_LUA_SETDEFAULTS_FUNCTIONS \ template \ void setDefaults(const std::string& cmd, P1 p1, bool call);\ template \ void setDefaults(const std::string& cmd, P1 p1, P2 p2, bool call);\ template \ void setDefaults(const std::string& cmd, P1 p1, P2 p2, P3 p3, bool call);\ template \ void setDefaults(const std::string& cmd, P1 p1, P2 p2, P3 p3, P4 p4, bool call);\ template \ void setDefaults(const std::string& cmd, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, bool call);\ template \ void setDefaults(const std::string& cmd, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, bool call);\ template \ void setDefaults(const std::string& cmd, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, bool call);\ template \ void setDefaults(const std::string& cmd, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, bool call);\ template \ void setDefaults(const std::string& cmd, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, bool call);\ template \ void setDefaults(const std::string& cmd, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10, bool call); #endif ImageVis3D-3.1.0/Tuvok/LuaScripting/NoTuvok/0000755000175000017500000000000012320456500020376 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/LuaScripting/NoTuvok/LuaTuvokException.h0000644000175000017500000000376212320456500024210 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file LuaTuvokException.cpp \author James Hughes \brief Provides tuvok::Exception when LuaScripting is compiled outside ouf tuvok. */ #ifndef LUA_TUVOKEXCEPTION_H_ #define LUA_TUVOKEXCEPTION_H_ #include namespace tuvok { class Exception : virtual public std::exception { public: Exception() : location(NULL), line(0) {} Exception(const char* e, const char* where = NULL, size_t ln = 0) : std::exception(), error(e), location(where), line(ln) {} virtual ~Exception() throw() {} virtual const char* what() const throw() {return this->error.c_str(); } const char* where() const {return this->location;} size_t lineno() const {return this->line;} protected: std::string error; const char* location; size_t line; }; } #endif /* LUA_TUVOKEXCEPTION_H_ */ ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaFunBindingCore.h0000644000175000017500000043620412320456500022451 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ // This file is automatically generated #ifndef TUVOK_LUAFUNBINDING_CORE_H_ #define TUVOK_LUAFUNBINDING_CORE_H_ #include #include #include #include #include "LuaClassInstance.h" #include "LuaStackRAII.h" namespace tuvok { #ifdef TLUA_VNM #error __FILE__ redefines TLUA_VNM #endif #ifdef TLUA_M_VNM #error __FILE__ redefines TLUA_M_VNM #endif // Variable Name #define TLUA_VNM(x) x##_v // Member variable name and definition. #define TLUA_M_VNM(x) x##_mv // Abstract base classed used to push and pull parameters off of internal // undo/redo stacks. class LuaCFunAbstract { public: virtual ~LuaCFunAbstract() {} virtual void pushParamsToStack(lua_State* L) const = 0; /// Pulls parameters from the stack, starting at the non-pseudo index si. /// Does NOT pop the parameters off the stack. virtual void pullParamsFromStack(lua_State* L, int si) = 0; /// Returns a string with the formated parameter values in it /// e.g. If there were 3 parameters, a boolean, a string, and an int, then /// "true, 'hi', 463" would be a possible result of the function. virtual std::string getFormattedParameterValues() const = 0; }; // LUA C function execution base unspecialized template. template class LuaCFunExec : public LuaCFunAbstract { public: // We want to keep the run and getSignature functions static so we don't // have to initialize member variables for these common operations // (we don't know their types). static std::string getSigNoReturn(const std::string& funcName); static std::string getSignature(const std::string& funcName); static void buildTypeTable(lua_State* L); // Pushing and pulling parameters from the stack are used to store parameters // on the undo / redo stacks within the program. virtual void pushParamsToStack(lua_State* L) const; virtual void pullParamsFromStack(lua_State* L, int si); // si = starting // stack index virtual std::string getFormattedParameterValues() const; }; //------------------ // // STATIC FUNCTIONS // //------------------ // Are return values useful to store alongside the parameters? //-------------- // 0 PARAMETERS //-------------- template class LuaCFunExec : public LuaCFunAbstract { public: typedef Ret returnType; typedef Ret (*fpType)(); static Ret run(lua_State*, int, fpType fp) { return fp(); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "()"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } static void constructTypesTable(lua_State*, int) {} virtual void pushParamsToStack(lua_State*) const {} virtual void pullParamsFromStack(lua_State*, int) {} virtual std::string getFormattedParameterValues() const { return ""; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { lua_newtable(L); } #endif }; #define LUAC_MAX_NUM_PARAMS (10) //--------------- // 1 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 0; typedef Ret returnType; typedef Ret (*fpType)(P1); static Ret run(lua_State* L, int paramStackIndex, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); return fp(TLUA_VNM(P1)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P1) of this function."); typename LuaStrictStack::Type TLUA_M_VNM(P1); }; //--------------- // 2 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 0; typedef Ret returnType; typedef Ret (*fpType)(P1, P2); static Ret run(lua_State* L, int paramStackIndex, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); return fp(TLUA_VNM(P1), TLUA_VNM(P2)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P1) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P2) of this function."); typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); }; //--------------- // 3 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 0; typedef Ret returnType; typedef Ret (*fpType)(P1, P2, P3); static Ret run(lua_State* L, int paramStackIndex, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); return fp(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P1) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P2) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P3) of this function."); typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); }; //--------------- // 4 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 0; typedef Ret returnType; typedef Ret (*fpType)(P1, P2, P3, P4); static Ret run(lua_State* L, int paramStackIndex, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P4) = LuaStrictStack::get(L, pos++); return fp(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3), TLUA_VNM(P4)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P4)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); LuaStrictStack::push(L, TLUA_M_VNM(P4)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P4) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P4)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P1) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P2) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P3) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P4) of this function."); typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); typename LuaStrictStack::Type TLUA_M_VNM(P4); }; //--------------- // 5 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 0; typedef Ret returnType; typedef Ret (*fpType)(P1, P2, P3, P4, P5); static Ret run(lua_State* L, int paramStackIndex, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P4) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P5) = LuaStrictStack::get(L, pos++); return fp(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3), TLUA_VNM(P4), TLUA_VNM(P5)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P4)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P5)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); LuaStrictStack::push(L, TLUA_M_VNM(P4)); LuaStrictStack::push(L, TLUA_M_VNM(P5)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P4) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P5) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P4)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P5)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P1) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P2) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P3) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P4) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P5) of this function."); typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); typename LuaStrictStack::Type TLUA_M_VNM(P4); typename LuaStrictStack::Type TLUA_M_VNM(P5); }; //--------------- // 6 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 0; typedef Ret returnType; typedef Ret (*fpType)(P1, P2, P3, P4, P5, P6); static Ret run(lua_State* L, int paramStackIndex, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P4) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P5) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P6) = LuaStrictStack::get(L, pos++); return fp(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3), TLUA_VNM(P4), TLUA_VNM(P5), TLUA_VNM(P6)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P4)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P5)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P6)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); LuaStrictStack::push(L, TLUA_M_VNM(P4)); LuaStrictStack::push(L, TLUA_M_VNM(P5)); LuaStrictStack::push(L, TLUA_M_VNM(P6)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P4) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P5) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P6) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P4)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P5)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P6)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P1) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P2) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P3) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P4) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P5) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P6) of this function."); typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); typename LuaStrictStack::Type TLUA_M_VNM(P4); typename LuaStrictStack::Type TLUA_M_VNM(P5); typename LuaStrictStack::Type TLUA_M_VNM(P6); }; //--------------- // 7 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 0; typedef Ret returnType; typedef Ret (*fpType)(P1, P2, P3, P4, P5, P6, P7); static Ret run(lua_State* L, int paramStackIndex, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P4) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P5) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P6) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P7) = LuaStrictStack::get(L, pos++); return fp(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3), TLUA_VNM(P4), TLUA_VNM(P5), TLUA_VNM(P6), TLUA_VNM(P7)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P4)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P5)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P6)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P7)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); LuaStrictStack::push(L, TLUA_M_VNM(P4)); LuaStrictStack::push(L, TLUA_M_VNM(P5)); LuaStrictStack::push(L, TLUA_M_VNM(P6)); LuaStrictStack::push(L, TLUA_M_VNM(P7)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P4) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P5) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P6) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P7) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P4)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P5)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P6)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P7)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P1) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P2) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P3) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P4) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P5) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P6) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P7) of this function."); typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); typename LuaStrictStack::Type TLUA_M_VNM(P4); typename LuaStrictStack::Type TLUA_M_VNM(P5); typename LuaStrictStack::Type TLUA_M_VNM(P6); typename LuaStrictStack::Type TLUA_M_VNM(P7); }; //--------------- // 8 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 0; typedef Ret returnType; typedef Ret (*fpType)(P1, P2, P3, P4, P5, P6, P7, P8); static Ret run(lua_State* L, int paramStackIndex, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P4) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P5) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P6) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P7) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P8) = LuaStrictStack::get(L, pos++); return fp(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3), TLUA_VNM(P4), TLUA_VNM(P5), TLUA_VNM(P6), TLUA_VNM(P7), TLUA_VNM(P8)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P4)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P5)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P6)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P7)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P8)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); LuaStrictStack::push(L, TLUA_M_VNM(P4)); LuaStrictStack::push(L, TLUA_M_VNM(P5)); LuaStrictStack::push(L, TLUA_M_VNM(P6)); LuaStrictStack::push(L, TLUA_M_VNM(P7)); LuaStrictStack::push(L, TLUA_M_VNM(P8)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P4) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P5) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P6) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P7) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P8) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P4)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P5)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P6)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P7)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P8)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P1) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P2) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P3) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P4) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P5) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P6) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P7) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P8) of this function."); typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); typename LuaStrictStack::Type TLUA_M_VNM(P4); typename LuaStrictStack::Type TLUA_M_VNM(P5); typename LuaStrictStack::Type TLUA_M_VNM(P6); typename LuaStrictStack::Type TLUA_M_VNM(P7); typename LuaStrictStack::Type TLUA_M_VNM(P8); }; //--------------- // 9 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 0; typedef Ret returnType; typedef Ret (*fpType)(P1, P2, P3, P4, P5, P6, P7, P8, P9); static Ret run(lua_State* L, int paramStackIndex, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P4) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P5) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P6) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P7) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P8) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P9) = LuaStrictStack::get(L, pos++); return fp(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3), TLUA_VNM(P4), TLUA_VNM(P5), TLUA_VNM(P6), TLUA_VNM(P7), TLUA_VNM(P8), TLUA_VNM(P9)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P4)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P5)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P6)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P7)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P8)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P9)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); LuaStrictStack::push(L, TLUA_M_VNM(P4)); LuaStrictStack::push(L, TLUA_M_VNM(P5)); LuaStrictStack::push(L, TLUA_M_VNM(P6)); LuaStrictStack::push(L, TLUA_M_VNM(P7)); LuaStrictStack::push(L, TLUA_M_VNM(P8)); LuaStrictStack::push(L, TLUA_M_VNM(P9)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P4) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P5) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P6) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P7) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P8) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P9) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P4)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P5)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P6)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P7)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P8)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P9)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P1) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P2) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P3) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P4) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P5) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P6) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P7) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P8) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P9) of this function."); typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); typename LuaStrictStack::Type TLUA_M_VNM(P4); typename LuaStrictStack::Type TLUA_M_VNM(P5); typename LuaStrictStack::Type TLUA_M_VNM(P6); typename LuaStrictStack::Type TLUA_M_VNM(P7); typename LuaStrictStack::Type TLUA_M_VNM(P8); typename LuaStrictStack::Type TLUA_M_VNM(P9); }; //--------------- // 10 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 0; typedef Ret returnType; typedef Ret (*fpType)(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10); static Ret run(lua_State* L, int paramStackIndex, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P4) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P5) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P6) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P7) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P8) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P9) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P10) = LuaStrictStack::get(L, pos++); return fp(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3), TLUA_VNM(P4), TLUA_VNM(P5), TLUA_VNM(P6), TLUA_VNM(P7), TLUA_VNM(P8), TLUA_VNM(P9), TLUA_VNM(P10)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P4)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P5)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P6)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P7)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P8)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P9)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P10)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); LuaStrictStack::push(L, TLUA_M_VNM(P4)); LuaStrictStack::push(L, TLUA_M_VNM(P5)); LuaStrictStack::push(L, TLUA_M_VNM(P6)); LuaStrictStack::push(L, TLUA_M_VNM(P7)); LuaStrictStack::push(L, TLUA_M_VNM(P8)); LuaStrictStack::push(L, TLUA_M_VNM(P9)); LuaStrictStack::push(L, TLUA_M_VNM(P10)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P4) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P5) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P6) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P7) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P8) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P9) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P10) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P4)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P5)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P6)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P7)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P8)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P9)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P10)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P1) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P2) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P3) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P4) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P5) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P6) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P7) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P8) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P9) of this function."); static_assert(false ==std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P10) of this function."); typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); typename LuaStrictStack::Type TLUA_M_VNM(P4); typename LuaStrictStack::Type TLUA_M_VNM(P5); typename LuaStrictStack::Type TLUA_M_VNM(P6); typename LuaStrictStack::Type TLUA_M_VNM(P7); typename LuaStrictStack::Type TLUA_M_VNM(P8); typename LuaStrictStack::Type TLUA_M_VNM(P9); typename LuaStrictStack::Type TLUA_M_VNM(P10); }; //------------------ // // MEMBER FUNCTIONS // //------------------ //-------------- // 0 PARAMETERS //-------------- template class LuaCFunExec : public LuaCFunAbstract { public: typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)(); static Ret run(lua_State*, int, T* c, fpType fp) { return (c->*fp)(); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "()"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } virtual std::string getFormattedParameterValues() const { return ""; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { lua_newtable(L); } #endif virtual void pushParamsToStack(lua_State*) const {} virtual void pullParamsFromStack(lua_State*, int) {} }; //--------------- // 1 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 1; typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)(P1); static Ret run(lua_State* L, int paramStackIndex, T* c, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); return (c->*fp)(TLUA_VNM(P1)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)); } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P1) of this function."); typename LuaStrictStack::Type TLUA_M_VNM(P1); }; //--------------- // 2 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 1; typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)(P1, P2); static Ret run(lua_State* L, int paramStackIndex, T* c, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); return (c->*fp)(TLUA_VNM(P1), TLUA_VNM(P2)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P1) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P2) of this function."); typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); }; //--------------- // 3 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 1; typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)(P1, P2, P3); static Ret run(lua_State* L, int paramStackIndex, T* c, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); return (c->*fp)(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P1) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P2) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P3) of this function."); typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); }; //--------------- // 4 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 1; typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)(P1, P2, P3, P4); static Ret run(lua_State* L, int paramStackIndex, T* c, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P4) = LuaStrictStack::get(L, pos++); return (c->*fp)(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3), TLUA_VNM(P4)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P4)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); LuaStrictStack::push(L, TLUA_M_VNM(P4)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P4) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P4)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P1) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P2) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P3) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P4) of this function."); typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); typename LuaStrictStack::Type TLUA_M_VNM(P4); }; //--------------- // 5 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 1; typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)(P1, P2, P3, P4, P5); static Ret run(lua_State* L, int paramStackIndex, T* c, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P4) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P5) = LuaStrictStack::get(L, pos++); return (c->*fp)(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3), TLUA_VNM(P4), TLUA_VNM(P5)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P4)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P5)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); LuaStrictStack::push(L, TLUA_M_VNM(P4)); LuaStrictStack::push(L, TLUA_M_VNM(P5)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P4) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P5) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P4)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P5)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P1) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P2) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P3) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P4) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P5) of this function."); typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); typename LuaStrictStack::Type TLUA_M_VNM(P4); typename LuaStrictStack::Type TLUA_M_VNM(P5); }; //--------------- // 6 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 1; typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)(P1, P2, P3, P4, P5, P6); static Ret run(lua_State* L, int paramStackIndex, T* c, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P4) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P5) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P6) = LuaStrictStack::get(L, pos++); return (c->*fp)(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3), TLUA_VNM(P4), TLUA_VNM(P5), TLUA_VNM(P6)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P4)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P5)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P6)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); LuaStrictStack::push(L, TLUA_M_VNM(P4)); LuaStrictStack::push(L, TLUA_M_VNM(P5)); LuaStrictStack::push(L, TLUA_M_VNM(P6)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P4) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P5) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P6) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P4)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P5)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P6)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P1) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P2) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P3) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P4) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P5) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P6) of this function."); typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); typename LuaStrictStack::Type TLUA_M_VNM(P4); typename LuaStrictStack::Type TLUA_M_VNM(P5); typename LuaStrictStack::Type TLUA_M_VNM(P6); }; //--------------- // 7 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 1; typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)(P1, P2, P3, P4, P5, P6, P7); static Ret run(lua_State* L, int paramStackIndex, T* c, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P4) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P5) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P6) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P7) = LuaStrictStack::get(L, pos++); return (c->*fp)(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3), TLUA_VNM(P4), TLUA_VNM(P5), TLUA_VNM(P6), TLUA_VNM(P7)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P4)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P5)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P6)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P7)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); LuaStrictStack::push(L, TLUA_M_VNM(P4)); LuaStrictStack::push(L, TLUA_M_VNM(P5)); LuaStrictStack::push(L, TLUA_M_VNM(P6)); LuaStrictStack::push(L, TLUA_M_VNM(P7)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P4) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P5) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P6) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P7) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P4)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P5)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P6)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P7)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P1) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P2) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P3) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P4) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P5) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P6) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P7) of this function."); typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); typename LuaStrictStack::Type TLUA_M_VNM(P4); typename LuaStrictStack::Type TLUA_M_VNM(P5); typename LuaStrictStack::Type TLUA_M_VNM(P6); typename LuaStrictStack::Type TLUA_M_VNM(P7); }; //--------------- // 8 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 1; typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)(P1, P2, P3, P4, P5, P6, P7, P8); static Ret run(lua_State* L, int paramStackIndex, T* c, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P4) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P5) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P6) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P7) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P8) = LuaStrictStack::get(L, pos++); return (c->*fp)(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3), TLUA_VNM(P4), TLUA_VNM(P5), TLUA_VNM(P6), TLUA_VNM(P7), TLUA_VNM(P8)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P4)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P5)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P6)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P7)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P8)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); LuaStrictStack::push(L, TLUA_M_VNM(P4)); LuaStrictStack::push(L, TLUA_M_VNM(P5)); LuaStrictStack::push(L, TLUA_M_VNM(P6)); LuaStrictStack::push(L, TLUA_M_VNM(P7)); LuaStrictStack::push(L, TLUA_M_VNM(P8)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P4) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P5) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P6) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P7) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P8) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P4)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P5)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P6)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P7)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P8)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P1) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P2) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P3) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P4) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P5) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P6) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P7) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P8) of this function."); typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); typename LuaStrictStack::Type TLUA_M_VNM(P4); typename LuaStrictStack::Type TLUA_M_VNM(P5); typename LuaStrictStack::Type TLUA_M_VNM(P6); typename LuaStrictStack::Type TLUA_M_VNM(P7); typename LuaStrictStack::Type TLUA_M_VNM(P8); }; //--------------- // 9 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 1; typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)(P1, P2, P3, P4, P5, P6, P7, P8, P9); static Ret run(lua_State* L, int paramStackIndex, T* c, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P4) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P5) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P6) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P7) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P8) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P9) = LuaStrictStack::get(L, pos++); return (c->*fp)(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3), TLUA_VNM(P4), TLUA_VNM(P5), TLUA_VNM(P6), TLUA_VNM(P7), TLUA_VNM(P8), TLUA_VNM(P9)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P4)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P5)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P6)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P7)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P8)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P9)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); LuaStrictStack::push(L, TLUA_M_VNM(P4)); LuaStrictStack::push(L, TLUA_M_VNM(P5)); LuaStrictStack::push(L, TLUA_M_VNM(P6)); LuaStrictStack::push(L, TLUA_M_VNM(P7)); LuaStrictStack::push(L, TLUA_M_VNM(P8)); LuaStrictStack::push(L, TLUA_M_VNM(P9)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P4) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P5) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P6) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P7) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P8) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P9) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P4)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P5)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P6)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P7)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P8)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P9)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P1) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P2) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P3) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P4) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P5) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P6) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P7) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P8) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P9) of this function."); typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); typename LuaStrictStack::Type TLUA_M_VNM(P4); typename LuaStrictStack::Type TLUA_M_VNM(P5); typename LuaStrictStack::Type TLUA_M_VNM(P6); typename LuaStrictStack::Type TLUA_M_VNM(P7); typename LuaStrictStack::Type TLUA_M_VNM(P8); typename LuaStrictStack::Type TLUA_M_VNM(P9); }; //--------------- // 10 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 1; typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10); static Ret run(lua_State* L, int paramStackIndex, T* c, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P4) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P5) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P6) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P7) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P8) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P9) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P10) = LuaStrictStack::get(L, pos++); return (c->*fp)(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3), TLUA_VNM(P4), TLUA_VNM(P5), TLUA_VNM(P6), TLUA_VNM(P7), TLUA_VNM(P8), TLUA_VNM(P9), TLUA_VNM(P10)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P4)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P5)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P6)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P7)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P8)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P9)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P10)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); LuaStrictStack::push(L, TLUA_M_VNM(P4)); LuaStrictStack::push(L, TLUA_M_VNM(P5)); LuaStrictStack::push(L, TLUA_M_VNM(P6)); LuaStrictStack::push(L, TLUA_M_VNM(P7)); LuaStrictStack::push(L, TLUA_M_VNM(P8)); LuaStrictStack::push(L, TLUA_M_VNM(P9)); LuaStrictStack::push(L, TLUA_M_VNM(P10)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P4) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P5) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P6) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P7) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P8) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P9) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P10) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P4)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P5)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P6)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P7)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P8)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P9)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P10)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P1) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P2) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P3) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P4) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P5) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P6) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P7) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P8) of this function."); static_assert(false == std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P9) of this function."); static_assert(false ==std::is_void::Type>::value, "You are missing an overload of LuaStrictStack for the " "argument type (P10) of this function."); typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); typename LuaStrictStack::Type TLUA_M_VNM(P4); typename LuaStrictStack::Type TLUA_M_VNM(P5); typename LuaStrictStack::Type TLUA_M_VNM(P6); typename LuaStrictStack::Type TLUA_M_VNM(P7); typename LuaStrictStack::Type TLUA_M_VNM(P8); typename LuaStrictStack::Type TLUA_M_VNM(P9); typename LuaStrictStack::Type TLUA_M_VNM(P10); }; //------------------ // // MEMBER FUNCTIONS // //------------------ //-------------- // 0 PARAMETERS //-------------- template class LuaCFunExec : public LuaCFunAbstract { public: typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)() const; static Ret run(lua_State*, int, T* c, fpType fp) { return (c->*fp)(); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "()"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } virtual std::string getFormattedParameterValues() const { return ""; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { lua_newtable(L); } #endif virtual void pushParamsToStack(lua_State*) const {} virtual void pullParamsFromStack(lua_State*, int) {} }; //--------------- // 1 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 1; typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)(P1) const; static Ret run(lua_State* L, int paramStackIndex, T* c, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); return (c->*fp)(TLUA_VNM(P1)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif typename LuaStrictStack::Type TLUA_M_VNM(P1); }; //--------------- // 2 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 1; typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)(P1, P2) const; static Ret run(lua_State* L, int paramStackIndex, T* c, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); return (c->*fp)(TLUA_VNM(P1), TLUA_VNM(P2)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); }; //--------------- // 3 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 1; typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)(P1, P2, P3) const; static Ret run(lua_State* L, int paramStackIndex, T* c, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); return (c->*fp)(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); }; //--------------- // 4 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 1; typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)(P1, P2, P3, P4) const; static Ret run(lua_State* L, int paramStackIndex, T* c, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P4) = LuaStrictStack::get(L, pos++); return (c->*fp)(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3), TLUA_VNM(P4)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P4)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); LuaStrictStack::push(L, TLUA_M_VNM(P4)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P4) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P4)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); typename LuaStrictStack::Type TLUA_M_VNM(P4); }; //--------------- // 5 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 1; typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)(P1, P2, P3, P4, P5) const; static Ret run(lua_State* L, int paramStackIndex, T* c, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P4) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P5) = LuaStrictStack::get(L, pos++); return (c->*fp)(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3), TLUA_VNM(P4), TLUA_VNM(P5)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P4)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P5)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); LuaStrictStack::push(L, TLUA_M_VNM(P4)); LuaStrictStack::push(L, TLUA_M_VNM(P5)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P4) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P5) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P4)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P5)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); typename LuaStrictStack::Type TLUA_M_VNM(P4); typename LuaStrictStack::Type TLUA_M_VNM(P5); }; //--------------- // 6 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 1; typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)(P1, P2, P3, P4, P5, P6) const; static Ret run(lua_State* L, int paramStackIndex, T* c, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P4) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P5) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P6) = LuaStrictStack::get(L, pos++); return (c->*fp)(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3), TLUA_VNM(P4), TLUA_VNM(P5), TLUA_VNM(P6)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P4)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P5)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P6)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); LuaStrictStack::push(L, TLUA_M_VNM(P4)); LuaStrictStack::push(L, TLUA_M_VNM(P5)); LuaStrictStack::push(L, TLUA_M_VNM(P6)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P4) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P5) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P6) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P4)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P5)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P6)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); typename LuaStrictStack::Type TLUA_M_VNM(P4); typename LuaStrictStack::Type TLUA_M_VNM(P5); typename LuaStrictStack::Type TLUA_M_VNM(P6); }; //--------------- // 7 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 1; typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)(P1, P2, P3, P4, P5, P6, P7) const; static Ret run(lua_State* L, int paramStackIndex, T* c, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P4) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P5) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P6) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P7) = LuaStrictStack::get(L, pos++); return (c->*fp)(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3), TLUA_VNM(P4), TLUA_VNM(P5), TLUA_VNM(P6), TLUA_VNM(P7)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P4)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P5)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P6)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P7)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); LuaStrictStack::push(L, TLUA_M_VNM(P4)); LuaStrictStack::push(L, TLUA_M_VNM(P5)); LuaStrictStack::push(L, TLUA_M_VNM(P6)); LuaStrictStack::push(L, TLUA_M_VNM(P7)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P4) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P5) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P6) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P7) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P4)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P5)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P6)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P7)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); typename LuaStrictStack::Type TLUA_M_VNM(P4); typename LuaStrictStack::Type TLUA_M_VNM(P5); typename LuaStrictStack::Type TLUA_M_VNM(P6); typename LuaStrictStack::Type TLUA_M_VNM(P7); }; //--------------- // 8 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 1; typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)(P1, P2, P3, P4, P5, P6, P7, P8) const; static Ret run(lua_State* L, int paramStackIndex, T* c, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P4) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P5) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P6) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P7) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P8) = LuaStrictStack::get(L, pos++); return (c->*fp)(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3), TLUA_VNM(P4), TLUA_VNM(P5), TLUA_VNM(P6), TLUA_VNM(P7), TLUA_VNM(P8)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P4)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P5)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P6)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P7)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P8)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); LuaStrictStack::push(L, TLUA_M_VNM(P4)); LuaStrictStack::push(L, TLUA_M_VNM(P5)); LuaStrictStack::push(L, TLUA_M_VNM(P6)); LuaStrictStack::push(L, TLUA_M_VNM(P7)); LuaStrictStack::push(L, TLUA_M_VNM(P8)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P4) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P5) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P6) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P7) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P8) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P4)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P5)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P6)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P7)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P8)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); typename LuaStrictStack::Type TLUA_M_VNM(P4); typename LuaStrictStack::Type TLUA_M_VNM(P5); typename LuaStrictStack::Type TLUA_M_VNM(P6); typename LuaStrictStack::Type TLUA_M_VNM(P7); typename LuaStrictStack::Type TLUA_M_VNM(P8); }; //--------------- // 9 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 1; typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)(P1, P2, P3, P4, P5, P6, P7, P8, P9) const; static Ret run(lua_State* L, int paramStackIndex, T* c, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P4) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P5) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P6) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P7) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P8) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P9) = LuaStrictStack::get(L, pos++); return (c->*fp)(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3), TLUA_VNM(P4), TLUA_VNM(P5), TLUA_VNM(P6), TLUA_VNM(P7), TLUA_VNM(P8), TLUA_VNM(P9)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P4)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P5)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P6)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P7)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P8)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P9)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); LuaStrictStack::push(L, TLUA_M_VNM(P4)); LuaStrictStack::push(L, TLUA_M_VNM(P5)); LuaStrictStack::push(L, TLUA_M_VNM(P6)); LuaStrictStack::push(L, TLUA_M_VNM(P7)); LuaStrictStack::push(L, TLUA_M_VNM(P8)); LuaStrictStack::push(L, TLUA_M_VNM(P9)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P4) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P5) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P6) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P7) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P8) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P9) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P4)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P5)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P6)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P7)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P8)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P9)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); typename LuaStrictStack::Type TLUA_M_VNM(P4); typename LuaStrictStack::Type TLUA_M_VNM(P5); typename LuaStrictStack::Type TLUA_M_VNM(P6); typename LuaStrictStack::Type TLUA_M_VNM(P7); typename LuaStrictStack::Type TLUA_M_VNM(P8); typename LuaStrictStack::Type TLUA_M_VNM(P9); }; //--------------- // 10 PARAMETERS //--------------- template class LuaCFunExec : public LuaCFunAbstract { public: static const int memberFunc = 1; typedef T classType; typedef Ret returnType; typedef Ret (T::*fpType)(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) const; static Ret run(lua_State* L, int paramStackIndex, T* c, fpType fp) { int pos = paramStackIndex; typename LuaStrictStack::Type TLUA_VNM(P1) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P2) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P3) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P4) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P5) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P6) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P7) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P8) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P9) = LuaStrictStack::get(L, pos++); typename LuaStrictStack::Type TLUA_VNM(P10) = LuaStrictStack::get(L, pos++); return (c->*fp)(TLUA_VNM(P1), TLUA_VNM(P2), TLUA_VNM(P3), TLUA_VNM(P4), TLUA_VNM(P5), TLUA_VNM(P6), TLUA_VNM(P7), TLUA_VNM(P8), TLUA_VNM(P9), TLUA_VNM(P10)); } static std::string getSigNoReturn(const std::string& funcName) { return funcName + "(" + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ", " + LuaStrictStack::getTypeStr() + ")"; } static std::string getSignature(const std::string& funcName) { return LuaStrictStack::getTypeStr() + " " + getSigNoReturn(funcName); } LuaCFunExec() : TLUA_M_VNM(P1)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P2)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P3)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P4)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P5)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P6)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P7)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P8)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P9)(LuaStrictStack::getDefault()) , TLUA_M_VNM(P10)(LuaStrictStack::getDefault()) {} virtual void pushParamsToStack(lua_State* L) const { LuaStrictStack::push(L, TLUA_M_VNM(P1)); LuaStrictStack::push(L, TLUA_M_VNM(P2)); LuaStrictStack::push(L, TLUA_M_VNM(P3)); LuaStrictStack::push(L, TLUA_M_VNM(P4)); LuaStrictStack::push(L, TLUA_M_VNM(P5)); LuaStrictStack::push(L, TLUA_M_VNM(P6)); LuaStrictStack::push(L, TLUA_M_VNM(P7)); LuaStrictStack::push(L, TLUA_M_VNM(P8)); LuaStrictStack::push(L, TLUA_M_VNM(P9)); LuaStrictStack::push(L, TLUA_M_VNM(P10)); } virtual void pullParamsFromStack(lua_State* L, int si) { int pos = si; TLUA_M_VNM(P1) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P2) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P3) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P4) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P5) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P6) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P7) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P8) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P9) = LuaStrictStack::get(L, pos++); TLUA_M_VNM(P10) = LuaStrictStack::get(L, pos++); } virtual std::string getFormattedParameterValues() const { return LuaStrictStack::getValStr(TLUA_M_VNM(P1)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P2)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P3)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P4)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P5)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P6)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P7)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P8)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P9)) + ", " + LuaStrictStack::getValStr(TLUA_M_VNM(P10)) ; } #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS static void buildTypeTable(lua_State* L) { int pos = 0; lua_newtable(L); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); lua_pushinteger(L, pos++); LSS_pushTypeInfo(L); lua_settable(L, -3); } #endif typename LuaStrictStack::Type TLUA_M_VNM(P1); typename LuaStrictStack::Type TLUA_M_VNM(P2); typename LuaStrictStack::Type TLUA_M_VNM(P3); typename LuaStrictStack::Type TLUA_M_VNM(P4); typename LuaStrictStack::Type TLUA_M_VNM(P5); typename LuaStrictStack::Type TLUA_M_VNM(P6); typename LuaStrictStack::Type TLUA_M_VNM(P7); typename LuaStrictStack::Type TLUA_M_VNM(P8); typename LuaStrictStack::Type TLUA_M_VNM(P9); typename LuaStrictStack::Type TLUA_M_VNM(P10); }; #undef TLUA_VNM #undef TLUA_M_VNM } /* namespace tuvok */ #endif /* LUAFUNBINDING_H_ */ ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaScriptingExecBody.h0000644000175000017500000012320212320456500023171 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ // This header file is automatically generated. // Contains definitions for executing bound Lua functions. #ifndef TUVOK_LUAEXECBODY_H_ #define TUVOK_LUAEXECBODY_H_ template void LuaScripting::cexec(const std::string& name, P1 p1) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(name); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS int ftable = lua_gettop(mL); lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 1) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); executeFunctionOnStack(1, 0); } template void LuaScripting::cexec(const std::string& name, P1 p1, P2 p2) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(name); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS int ftable = lua_gettop(mL); lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 2) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); LuaStrictStack::push(mL, p2); executeFunctionOnStack(2, 0); } template void LuaScripting::cexec(const std::string& name, P1 p1, P2 p2, P3 p3) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(name); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS int ftable = lua_gettop(mL); lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 3) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); LuaStrictStack::push(mL, p2); LuaStrictStack::push(mL, p3); executeFunctionOnStack(3, 0); } template void LuaScripting::cexec(const std::string& name, P1 p1, P2 p2, P3 p3, P4 p4) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(name); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS int ftable = lua_gettop(mL); lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 4) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); LuaStrictStack::push(mL, p2); LuaStrictStack::push(mL, p3); LuaStrictStack::push(mL, p4); executeFunctionOnStack(4, 0); } template void LuaScripting::cexec(const std::string& name, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(name); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS int ftable = lua_gettop(mL); lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 5) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); LuaStrictStack::push(mL, p2); LuaStrictStack::push(mL, p3); LuaStrictStack::push(mL, p4); LuaStrictStack::push(mL, p5); executeFunctionOnStack(5, 0); } template void LuaScripting::cexec(const std::string& name, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(name); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS int ftable = lua_gettop(mL); lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 6) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); LuaStrictStack::push(mL, p2); LuaStrictStack::push(mL, p3); LuaStrictStack::push(mL, p4); LuaStrictStack::push(mL, p5); LuaStrictStack::push(mL, p6); executeFunctionOnStack(6, 0); } template void LuaScripting::cexec(const std::string& name, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(name); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS int ftable = lua_gettop(mL); lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 7) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); LuaStrictStack::push(mL, p2); LuaStrictStack::push(mL, p3); LuaStrictStack::push(mL, p4); LuaStrictStack::push(mL, p5); LuaStrictStack::push(mL, p6); LuaStrictStack::push(mL, p7); executeFunctionOnStack(7, 0); } template void LuaScripting::cexec(const std::string& name, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(name); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS int ftable = lua_gettop(mL); lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 8) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); LuaStrictStack::push(mL, p2); LuaStrictStack::push(mL, p3); LuaStrictStack::push(mL, p4); LuaStrictStack::push(mL, p5); LuaStrictStack::push(mL, p6); LuaStrictStack::push(mL, p7); LuaStrictStack::push(mL, p8); executeFunctionOnStack(8, 0); } template void LuaScripting::cexec(const std::string& name, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(name); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS int ftable = lua_gettop(mL); lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 9) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); LuaStrictStack::push(mL, p2); LuaStrictStack::push(mL, p3); LuaStrictStack::push(mL, p4); LuaStrictStack::push(mL, p5); LuaStrictStack::push(mL, p6); LuaStrictStack::push(mL, p7); LuaStrictStack::push(mL, p8); LuaStrictStack::push(mL, p9); executeFunctionOnStack(9, 0); } template void LuaScripting::cexec(const std::string& name, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(name); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS int ftable = lua_gettop(mL); lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 10) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); LuaStrictStack::push(mL, p2); LuaStrictStack::push(mL, p3); LuaStrictStack::push(mL, p4); LuaStrictStack::push(mL, p5); LuaStrictStack::push(mL, p6); LuaStrictStack::push(mL, p7); LuaStrictStack::push(mL, p8); LuaStrictStack::push(mL, p9); LuaStrictStack::push(mL, p10); executeFunctionOnStack(10, 0); } template T LuaScripting::cexecRet(const std::string& name, P1 p1) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(name); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS int ftable = lua_gettop(mL); lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 1) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); executeFunctionOnStack(1, 1); T ret = LuaStrictStack::get(mL, lua_gettop(mL)); lua_pop(mL, 1); return ret; } template T LuaScripting::cexecRet(const std::string& name, P1 p1, P2 p2) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(name); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS int ftable = lua_gettop(mL); lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 2) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); LuaStrictStack::push(mL, p2); executeFunctionOnStack(2, 1); T ret = LuaStrictStack::get(mL, lua_gettop(mL)); lua_pop(mL, 1); return ret; } template T LuaScripting::cexecRet(const std::string& name, P1 p1, P2 p2, P3 p3) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(name); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS int ftable = lua_gettop(mL); lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 3) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); LuaStrictStack::push(mL, p2); LuaStrictStack::push(mL, p3); executeFunctionOnStack(3, 1); T ret = LuaStrictStack::get(mL, lua_gettop(mL)); lua_pop(mL, 1); return ret; } template T LuaScripting::cexecRet(const std::string& name, P1 p1, P2 p2, P3 p3, P4 p4) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(name); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS int ftable = lua_gettop(mL); lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 4) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); LuaStrictStack::push(mL, p2); LuaStrictStack::push(mL, p3); LuaStrictStack::push(mL, p4); executeFunctionOnStack(4, 1); T ret = LuaStrictStack::get(mL, lua_gettop(mL)); lua_pop(mL, 1); return ret; } template T LuaScripting::cexecRet(const std::string& name, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(name); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS int ftable = lua_gettop(mL); lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 5) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); LuaStrictStack::push(mL, p2); LuaStrictStack::push(mL, p3); LuaStrictStack::push(mL, p4); LuaStrictStack::push(mL, p5); executeFunctionOnStack(5, 1); T ret = LuaStrictStack::get(mL, lua_gettop(mL)); lua_pop(mL, 1); return ret; } template T LuaScripting::cexecRet(const std::string& name, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(name); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS int ftable = lua_gettop(mL); lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 6) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); LuaStrictStack::push(mL, p2); LuaStrictStack::push(mL, p3); LuaStrictStack::push(mL, p4); LuaStrictStack::push(mL, p5); LuaStrictStack::push(mL, p6); executeFunctionOnStack(6, 1); T ret = LuaStrictStack::get(mL, lua_gettop(mL)); lua_pop(mL, 1); return ret; } template T LuaScripting::cexecRet(const std::string& name, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(name); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS int ftable = lua_gettop(mL); lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 7) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); LuaStrictStack::push(mL, p2); LuaStrictStack::push(mL, p3); LuaStrictStack::push(mL, p4); LuaStrictStack::push(mL, p5); LuaStrictStack::push(mL, p6); LuaStrictStack::push(mL, p7); executeFunctionOnStack(7, 1); T ret = LuaStrictStack::get(mL, lua_gettop(mL)); lua_pop(mL, 1); return ret; } template T LuaScripting::cexecRet(const std::string& name, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(name); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS int ftable = lua_gettop(mL); lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 8) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); LuaStrictStack::push(mL, p2); LuaStrictStack::push(mL, p3); LuaStrictStack::push(mL, p4); LuaStrictStack::push(mL, p5); LuaStrictStack::push(mL, p6); LuaStrictStack::push(mL, p7); LuaStrictStack::push(mL, p8); executeFunctionOnStack(8, 1); T ret = LuaStrictStack::get(mL, lua_gettop(mL)); lua_pop(mL, 1); return ret; } template T LuaScripting::cexecRet(const std::string& name, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(name); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS int ftable = lua_gettop(mL); lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 9) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); LuaStrictStack::push(mL, p2); LuaStrictStack::push(mL, p3); LuaStrictStack::push(mL, p4); LuaStrictStack::push(mL, p5); LuaStrictStack::push(mL, p6); LuaStrictStack::push(mL, p7); LuaStrictStack::push(mL, p8); LuaStrictStack::push(mL, p9); executeFunctionOnStack(9, 1); T ret = LuaStrictStack::get(mL, lua_gettop(mL)); lua_pop(mL, 1); return ret; } template T LuaScripting::cexecRet(const std::string& name, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); prepForExecution(name); #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS int ftable = lua_gettop(mL); lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 10) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); LuaStrictStack::push(mL, p2); LuaStrictStack::push(mL, p3); LuaStrictStack::push(mL, p4); LuaStrictStack::push(mL, p5); LuaStrictStack::push(mL, p6); LuaStrictStack::push(mL, p7); LuaStrictStack::push(mL, p8); LuaStrictStack::push(mL, p9); LuaStrictStack::push(mL, p10); executeFunctionOnStack(10, 1); T ret = LuaStrictStack::get(mL, lua_gettop(mL)); lua_pop(mL, 1); return ret; } template void LuaScripting::setDefaults(const std::string& name, P1 p1, bool call) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); if (getFunctionTable(name) == false) throw LuaNonExistantFunction("Can't find function"); int ftable = lua_gettop(mL); int pos = 0; #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 1) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); resetFunDefault(pos++, ftable); lua_pop(mL, 1); setTempProvDisable(true); if (call) cexec(name, p1); setTempProvDisable(false); } template void LuaScripting::setDefaults(const std::string& name, P1 p1, P2 p2, bool call) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); if (getFunctionTable(name) == false) throw LuaNonExistantFunction("Can't find function"); int ftable = lua_gettop(mL); int pos = 0; #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 2) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p2); resetFunDefault(pos++, ftable); lua_pop(mL, 1); setTempProvDisable(true); if (call) cexec(name, p1, p2); setTempProvDisable(false); } template void LuaScripting::setDefaults(const std::string& name, P1 p1, P2 p2, P3 p3, bool call) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); if (getFunctionTable(name) == false) throw LuaNonExistantFunction("Can't find function"); int ftable = lua_gettop(mL); int pos = 0; #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 3) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p2); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p3); resetFunDefault(pos++, ftable); lua_pop(mL, 1); setTempProvDisable(true); if (call) cexec(name, p1, p2, p3); setTempProvDisable(false); } template void LuaScripting::setDefaults(const std::string& name, P1 p1, P2 p2, P3 p3, P4 p4, bool call) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); if (getFunctionTable(name) == false) throw LuaNonExistantFunction("Can't find function"); int ftable = lua_gettop(mL); int pos = 0; #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 4) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p2); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p3); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p4); resetFunDefault(pos++, ftable); lua_pop(mL, 1); setTempProvDisable(true); if (call) cexec(name, p1, p2, p3, p4); setTempProvDisable(false); } template void LuaScripting::setDefaults(const std::string& name, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, bool call) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); if (getFunctionTable(name) == false) throw LuaNonExistantFunction("Can't find function"); int ftable = lua_gettop(mL); int pos = 0; #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 5) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p2); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p3); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p4); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p5); resetFunDefault(pos++, ftable); lua_pop(mL, 1); setTempProvDisable(true); if (call) cexec(name, p1, p2, p3, p4, p5); setTempProvDisable(false); } template void LuaScripting::setDefaults(const std::string& name, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, bool call) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); if (getFunctionTable(name) == false) throw LuaNonExistantFunction("Can't find function"); int ftable = lua_gettop(mL); int pos = 0; #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 6) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p2); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p3); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p4); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p5); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p6); resetFunDefault(pos++, ftable); lua_pop(mL, 1); setTempProvDisable(true); if (call) cexec(name, p1, p2, p3, p4, p5, p6); setTempProvDisable(false); } template void LuaScripting::setDefaults(const std::string& name, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, bool call) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); if (getFunctionTable(name) == false) throw LuaNonExistantFunction("Can't find function"); int ftable = lua_gettop(mL); int pos = 0; #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 7) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p2); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p3); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p4); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p5); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p6); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p7); resetFunDefault(pos++, ftable); lua_pop(mL, 1); setTempProvDisable(true); if (call) cexec(name, p1, p2, p3, p4, p5, p6, p7); setTempProvDisable(false); } template void LuaScripting::setDefaults(const std::string& name, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, bool call) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); if (getFunctionTable(name) == false) throw LuaNonExistantFunction("Can't find function"); int ftable = lua_gettop(mL); int pos = 0; #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 8) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p2); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p3); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p4); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p5); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p6); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p7); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p8); resetFunDefault(pos++, ftable); lua_pop(mL, 1); setTempProvDisable(true); if (call) cexec(name, p1, p2, p3, p4, p5, p6, p7, p8); setTempProvDisable(false); } template void LuaScripting::setDefaults(const std::string& name, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, bool call) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); if (getFunctionTable(name) == false) throw LuaNonExistantFunction("Can't find function"); int ftable = lua_gettop(mL); int pos = 0; #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 9) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p2); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p3); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p4); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p5); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p6); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p7); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p8); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p9); resetFunDefault(pos++, ftable); lua_pop(mL, 1); setTempProvDisable(true); if (call) cexec(name, p1, p2, p3, p4, p5, p6, p7, p8, p9); setTempProvDisable(false); } template void LuaScripting::setDefaults(const std::string& name, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10, bool call) { LuaStackRAII _a = LuaStackRAII(mL, 0, 0); if (getFunctionTable(name) == false) throw LuaNonExistantFunction("Can't find function"); int ftable = lua_gettop(mL); int pos = 0; #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS lua_getfield(mL, ftable, TBL_MD_NUM_PARAMS); if (lua_tointeger(mL, -1) != 10) throw LuaUnequalNumParams("Unequal params"); lua_pop(mL, 1); lua_getfield(mL, ftable, LuaScripting::TBL_MD_TYPES_TABLE); int ttable = lua_gettop(mL); int check_pos = 0; Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); Tuvok_luaCheckParam(mL, name, ttable, check_pos++); lua_pop(mL, 1); #endif LuaStrictStack::push(mL, p1); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p2); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p3); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p4); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p5); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p6); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p7); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p8); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p9); resetFunDefault(pos++, ftable); LuaStrictStack::push(mL, p10); resetFunDefault(pos++, ftable); lua_pop(mL, 1); setTempProvDisable(true); if (call) cexec(name, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); setTempProvDisable(false); } #endif ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaCommon.h0000644000175000017500000000320712320456500021036 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief Holds common definitions for the LuaScripting system. */ #ifndef TUVOK_LUACOMMON_H_ #define TUVOK_LUACOMMON_H_ namespace tuvok { template class LuaClassRegistration; class LuaScripting; template struct LuaClassRegCallback { typedef std::function& reg, T* cls, LuaScripting * ss)> Type; }; } #endif /* LUACOMMON_H_ */ ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaError.h0000644000175000017500000001242612320456500020702 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file LuaError.h \author James Hughes SCI Institute University of Utah \date Mar 21, 2012 \brief Defines exceptions thrown in the LUA scripting system. */ #ifndef TUVOK_LUAERROR_H_ #define TUVOK_LUAERROR_H_ #include #ifndef LUASCRIPTING_NO_TUVOK #include "Basics/TuvokException.h" #else #include "NoTuvok/LuaTuvokException.h" #endif namespace tuvok { /// Generic Lua error. class LuaError : public Exception { public: explicit LuaError(std::string e, const char* where = NULL, size_t ln = 0) : Exception(e, where, ln) {} virtual ~LuaError() throw() { } }; /// Errors dealing with the Lua-Based function registration system. class LuaFunBindError : public LuaError { public: explicit LuaFunBindError(std::string e, const char* where = NULL, size_t ln = 0) : LuaError(e, where, ln) {} virtual ~LuaFunBindError() throw() { } }; class LuaNonExistantFunction : public LuaError { public: explicit LuaNonExistantFunction(std::string e, const char* where = NULL, size_t ln = 0) : LuaError(e, where, ln) {} virtual ~LuaNonExistantFunction() throw() { } }; class LuaInvalidFunSignature : public LuaError { public: explicit LuaInvalidFunSignature(std::string e, const char* where = NULL, size_t ln = 0) : LuaError(e, where, ln) {} virtual ~LuaInvalidFunSignature() throw() { } }; class LuaProvenanceReenter : public LuaError { public: explicit LuaProvenanceReenter(std::string e, const char* where = NULL, size_t ln = 0) : LuaError(e, where, ln) {} virtual ~LuaProvenanceReenter() throw() { } }; class LuaProvenanceInvalidUndoOrRedo : public LuaError { public: explicit LuaProvenanceInvalidUndoOrRedo(std::string e, const char* where = NULL, size_t ln = 0) : LuaError(e, where, ln) {} virtual ~LuaProvenanceInvalidUndoOrRedo() throw() { } }; class LuaProvenanceInvalidRedo : public LuaError { public: explicit LuaProvenanceInvalidRedo(std::string e, const char* where = NULL, size_t ln = 0) : LuaError(e, where, ln) {} virtual ~LuaProvenanceInvalidRedo() throw() { } }; class LuaProvenanceInvalidUndo : public LuaError { public: explicit LuaProvenanceInvalidUndo(std::string e, const char* where = NULL, size_t ln = 0) : LuaError(e, where, ln) {} virtual ~LuaProvenanceInvalidUndo() throw() { } }; class LuaProvenanceFailedUndo : public LuaError { public: explicit LuaProvenanceFailedUndo(std::string e, const char* where = NULL, size_t ln = 0) : LuaError(e, where, ln) {} virtual ~LuaProvenanceFailedUndo() throw() { } }; class LuaInvalidType : public LuaError { public: explicit LuaInvalidType(std::string e, const char* where = NULL, size_t ln = 0) : LuaError(e, where, ln) {} virtual ~LuaInvalidType() throw() { } }; class LuaUnequalNumParams : public LuaError { public: explicit LuaUnequalNumParams(std::string e, const char* where = NULL, size_t ln = 0) : LuaError(e, where, ln) {} virtual ~LuaUnequalNumParams() throw() { } }; class LuaUndoFuncAlreadySet : public LuaError { public: explicit LuaUndoFuncAlreadySet(std::string e, const char* where = NULL, size_t ln = 0) : LuaError(e, where, ln) {} }; class LuaRedoFuncAlreadySet : public LuaError { public: explicit LuaRedoFuncAlreadySet(std::string e, const char* where = NULL, size_t ln = 0) : LuaError(e, where, ln) {} }; class LuaNonExistantClassInstancePointer : public LuaError { public: explicit LuaNonExistantClassInstancePointer(std::string e, const char* where = NULL, size_t ln = 0) : LuaError(e, where, ln) {} }; } /* namespace tuvok */ #endif /* LUAERROR_H_ */ ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaFunBinding.h0000644000175000017500000010571112320456500021634 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file LuaFunBinding.h \author James Hughes SCI Institute University of Utah \date Mar 21, 2012 \brief Auxiliary templates used to implement 1-1 function binding in LUA. */ /// TODO: Look into rewriting using variadic templates when we support C++11. // The basic ideas behind LuaStrictStack (managing the lua stack using // template specialization) and LuaCFunExec (binding functions // using template specialization) in this file come from LuaBridge. // https://github.com/vinniefalco/LuaBridge #ifndef TUVOK_LUAFUNBINDING_H_ #define TUVOK_LUAFUNBINDING_H_ #include #include #include #include #include #include #include "Basics/PerfCounter.h" #include "LuaClassInstance.h" #include "LuaStackRAII.h" #include "LuaError.h" // Uncomment TUVOK_DEBUG_LUA_USE_RTTI_CHECKS to check types of function calls // made through lua at run time. // (will be especially useful to debug shared_ptr type issues) // // I haven't used RTTI up to this point, and have relied on templates instead, // so I don't want to make it a requirement now. #define TUVOK_DEBUG_LUA_USE_RTTI_CHECKS #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS #include #endif #define TUVOK_LUA_MT_TYPE_TO_STR_FUN "typeToStr" namespace tuvok { // Defines the expected input from lua to be a table. class LuaTable { public: LuaTable(int stackLocation) : mStackLocation(stackLocation) {} LuaTable() : mStackLocation(INVALID_STACK_LOC) {} bool isTableValid() const {return mStackLocation != INVALID_STACK_LOC;} int getStackLocation() const {return mStackLocation;} private: static const int INVALID_STACK_LOC = 0; int mStackLocation; }; //============================================================== // // LUA PARAM GETTER/PUSHER (we do NOT pop off of the LUA stack) // //============================================================== // Lua strict type stack // This template enforces strict type compliance while converting types on the // Lua stack. template class LuaStrictStack { public: typedef void Type; // This type will be used to store the data. // Intentionally left unimplemented to generate compiler errors if this // template is chosen. static T get(lua_State* L, int pos); static void push(lua_State* L, T data); static std::string getValStr(T in); static std::string getTypesStr(); static T getDefault(); }; // Specializations (supported parameter/return types) template<> class LuaStrictStack { public: typedef void Type; // All functions except getTypeStr and push don't do anything since none of // these functions make sense in the context of 'void'. // getTypeStr is only called when building the return type of function // signatures. static int get(lua_State* L, int pos); static void push(lua_State* L, int in); static std::string getValStr(int in); static std::string getTypeStr() { return "void"; } static int getDefault(); }; template<> class LuaStrictStack { public: typedef LuaTable Type; static Type get(lua_State*, int pos) { return LuaTable(pos); } static void push(lua_State* L, const Type& in) { lua_pushvalue(L, in.getStackLocation()); } static std::string getValStr(const Type& in) { std::ostringstream os; os << "Table at stack pos: " << in.getStackLocation(); return os.str(); } static std::string getTypeStr() { return "LuaTable"; } static Type getDefault() { return Type(); } }; template<> class LuaStrictStack { public: typedef int Type; static Type get(lua_State* L, int pos) { return luaL_checkint(L, pos); } static void push(lua_State* L, Type in) { lua_pushinteger(L, in); } static std::string getValStr(Type in) { std::ostringstream os; os << in; return os.str(); } static std::string getTypeStr() { return "int"; } static Type getDefault() { return 0; } }; template<> class LuaStrictStack { public: typedef long Type; static Type get(lua_State* L, int pos) { return static_cast(luaL_checknumber(L, pos)); } static void push(lua_State* L, Type in) { lua_pushnumber(L, static_cast(in)); } static std::string getValStr(Type in) { std::ostringstream os; os << in; return os.str(); } static std::string getTypeStr() { return "long"; } static Type getDefault() { return 0; } }; template<> class LuaStrictStack { public: typedef unsigned long Type; static Type get(lua_State* L, int pos) { return static_cast(luaL_checknumber(L, pos)); } static void push(lua_State* L, Type in) { lua_pushnumber(L, static_cast(in)); } static std::string getValStr(Type in) { std::ostringstream os; os << in; return os.str(); } static std::string getTypeStr() { return "unsigned long"; } static Type getDefault() { return 0; } }; template <> class LuaStrictStack { public: typedef unsigned long long Type; static Type get(lua_State* L, int pos) { return static_cast(luaL_checknumber(L, pos)); } static void push(lua_State* L, Type in) { lua_pushnumber(L, static_cast(in)); } static std::string getValStr(Type in) { std::ostringstream os; os << in; return os.str(); } static std::string getTypeStr() { return "unsigned long long"; } static Type getDefault() { return 0; } }; template <> class LuaStrictStack { public: typedef long long Type; static long long get(lua_State* L, int pos) { return static_cast(luaL_checknumber(L, pos)); } static void push(lua_State* L, long long in) { lua_pushnumber(L, static_cast(in)); } static std::string getValStr(long long in) { std::ostringstream os; os << in; return os.str(); } static std::string getTypeStr() { return "long long"; } static long long getDefault(){ return 0; } }; template<> class LuaStrictStack { public: typedef unsigned int Type; static Type get(lua_State* L, int pos) { return static_cast(luaL_checknumber(L, pos)); } static void push(lua_State* L, Type in) { lua_pushnumber(L, static_cast(in)); } static std::string getValStr(Type in) { std::ostringstream os; os << in; return os.str(); } static std::string getTypeStr() { return "unsigned int"; } static Type getDefault() { return 0; } }; template<> class LuaStrictStack { public: typedef enum PerfCounter Type; static Type get(lua_State* L, int pos) { return static_cast(static_cast(luaL_checknumber(L, pos))); } static void push(lua_State* L, Type in) { lua_pushnumber(L, static_cast(in)); } static std::string getValStr(Type in) { std::ostringstream os; os << in; return os.str(); } static std::string getTypeStr() { return "PerfCounter"; } static Type getDefault() { return PERF_END; } }; template<> class LuaStrictStack { public: typedef bool Type; static Type get(lua_State* L, int pos) { luaL_checktype(L, pos, LUA_TBOOLEAN); int retVal = lua_toboolean(L, pos); return (retVal != 0) ? true : false; } static void push(lua_State* L, Type in) { lua_pushboolean(L, in ? 1 : 0); } static std::string getValStr(Type in) { std::ostringstream os; os << std::boolalpha << in; return os.str(); } static std::string getTypeStr() { return "bool"; } static Type getDefault() { return false; } }; template<> class LuaStrictStack { public: typedef float Type; static Type get(lua_State* L, int pos) { return static_cast(luaL_checknumber(L, pos)); } static void push(lua_State* L, Type in) { lua_pushnumber(L, static_cast(in)); } static std::string getValStr(Type in) { std::ostringstream os; os << std::setprecision(10) << in; return os.str(); } static std::string getTypeStr() { return "float"; } static Type getDefault() { return 0.0f; } }; template<> class LuaStrictStack { public: typedef double Type; static Type get(lua_State* L, int pos) { return static_cast(luaL_checknumber(L, pos)); } static void push(lua_State* L, Type in) { lua_pushnumber(L, static_cast(in)); } static std::string getValStr(Type in) { std::ostringstream os; os << std::setprecision(20) << in; return os.str(); } static std::string getTypeStr() { return "double"; } static Type getDefault() { return 0.0; } }; template<> class LuaStrictStack { public: typedef std::string Type; static const char* get(lua_State* L, int pos) { return luaL_checkstring(L, pos); } static void push(lua_State* L, const char* in) { lua_pushstring(L, in); } static void push(lua_State* L, const std::string& in) { lua_pushstring(L, in.c_str()); } static std::string getValStr(const char* in) { std::ostringstream os; os << "'" << in << "'"; return os.str(); } static std::string getTypeStr() { return "string"; } static std::string getDefault() { return ""; } }; template<> class LuaStrictStack { public: typedef std::string Type; static Type get(lua_State* L, int pos) { return luaL_checkstring(L, pos); } static void push(lua_State* L, const Type& in) { lua_pushstring(L, in.c_str()); } static std::string getValStr(const Type& in) { std::ostringstream os; os << "'" << in << "'"; return os.str(); } static std::string getTypeStr() { return "string"; } static Type getDefault() { return ""; } }; template<> class LuaStrictStack { public: typedef std::string Type; static Type get(lua_State* L, int pos) { return LuaStrictStack::get(L, pos); } static void push(lua_State* L, const Type& in) { LuaStrictStack::push(L, in); } static std::string getValStr(const Type& in) { return LuaStrictStack::getValStr(in); } static std::string getTypeStr() { return LuaStrictStack::getTypeStr(); } static Type getDefault() { return LuaStrictStack::getDefault(); } }; template<> class LuaStrictStack { public: typedef std::string Type; static Type get(lua_State* L, int pos) { return LuaStrictStack::get(L, pos); } static void push(lua_State* L, const Type& in) { LuaStrictStack::push(L, in); } static std::string getValStr(const Type& in) { return LuaStrictStack::getValStr(in); } static std::string getTypeStr() { return LuaStrictStack::getTypeStr(); } static Type getDefault() { return LuaStrictStack::getDefault(); } }; template<> class LuaStrictStack { public: typedef LuaClassInstance Type; static LuaClassInstance get(lua_State* L, int pos) { LuaStackRAII _a(L, 0, 0); // If the class that was passed to us didn't exist (nil) then we will // ignore the attempted retrieval, and return the default instance ID. // This allows out of order deletion (ignoring deletions of already // deleted classes). if (lua_isnil(L, pos)) { return LuaClassInstance(LuaClassInstance::DEFAULT_INSTANCE_ID); } lua_getfield(L, pos, "_DefaultInstance_"); if (lua_isnil(L, -1)) { lua_pop(L, 1); // Grab the metatable of the table at pos and extract global ID. if(lua_getmetatable(L, pos) == 0) throw LuaError("Unable to find class metatable."); lua_getfield(L, -1, LuaClassInstance::MD_GLOBAL_INSTANCE_ID); int globalID = static_cast(luaL_checkinteger(L, -1)); lua_pop(L, 2); return LuaClassInstance(globalID); } else { lua_pop(L, 1); return LuaClassInstance(LuaClassInstance::DEFAULT_INSTANCE_ID); } } static void push(lua_State* L, LuaClassInstance in) { LuaStackRAII _a(L, 0, 1); // Lookup the instance table in the global instance table based on the // instance ID. // TODO: This can be done more efficiently by parsing and walking the // tables ourselves (LuaScripting::getFunctionTable) if (in.getGlobalInstID() != LuaClassInstance::DEFAULT_INSTANCE_ID) { std::ostringstream os; os << "return " << LuaClassInstance::CLASS_INSTANCE_TABLE << "." << LuaClassInstance::CLASS_INSTANCE_PREFIX << in.getGlobalInstID(); luaL_dostring(L, os.str().c_str()); // Return the class instance. // Interesting corner case: If the class instance has already been // deleted, luaL_dostring will return nil, and result in us deleting // elements from our last exec table. // // Since deleteClass has a null undo function, we are safe doing this. // deleteClass will be the only function that runs into this corner case. if (lua_isnil(L, -1)) { lua_pop(L, 1); // Empty table. lua_newtable(L); lua_pushboolean(L, 1); lua_setfield(L, -2, "_DefaultInstance_"); } } else { // Empty table. lua_newtable(L); lua_pushboolean(L, 1); lua_setfield(L, -2, "_DefaultInstance_"); } } static std::string getValStr(LuaClassInstance in) { std::ostringstream os; os << LuaClassInstance::CLASS_INSTANCE_TABLE << "." << LuaClassInstance::CLASS_INSTANCE_PREFIX << in.getGlobalInstID(); return os.str(); } static std::string getTypeStr() { return "LuaClass"; } static LuaClassInstance getDefault() { return LuaClassInstance(-1); } }; // Shared pointer type to allow arbitrary pointers to be passed into the system. // Be careful when using shared pointers with the LuaScripting class. // The LuaScripting class will not be destroyed until the provenance // record is cleared. This is because a shared pointer // reference to LuaScripting will be stored inside of the provenance system. template class LuaStrictStack> { public: typedef std::shared_ptr Type; static std::shared_ptr get(lua_State* L, int pos) { std::shared_ptr* ptr = reinterpret_cast* >(lua_touserdata(L, pos)); return *ptr; } static int gc(lua_State* L) { // Explicitly call the shared pointer's destructor. std::shared_ptr& ptr = *reinterpret_cast* >(lua_touserdata(L, 1)); // Using clang for external unit testing. While VC and GCC don't have a // problem with the latter syntax, clang can't handle it. #ifdef __clang__ ptr.~shared_ptr(); #else ptr.std::template shared_ptr::~shared_ptr(); #endif return 0; } static void push(lua_State* L, std::shared_ptr in) { // Allocate space for a shared pointer. void* spData = lua_newuserdata(L, sizeof(std::shared_ptr)); new(spData) std::shared_ptr(in); // Setup metatable for the shared pointer to ensure it is dereferenced // when the lua instance is destroyed. We need to explicitly call the // destructor of the user data. lua_newtable(L); lua_pushcfunction(L, gc); lua_setfield(L, -2, "__gc"); lua_setmetatable(L, -2); } static std::string getValStr(std::shared_ptr) { std::ostringstream os; os << "SharedPointer"; return os.str(); } static std::string getTypeStr() { return "shared_ptr"; } static std::shared_ptr getDefault() { return std::shared_ptr(); } }; // Generic vector type that uses previously defined types on the stack. template class LuaStrictStack> { public: typedef std::pair::Type,typename LuaStrictStack::Type > Type; static Type get(lua_State* L, int pos) { // Ensure that there is a table on the top of the stack. LuaStackRAII _a(L, 0, 0); Type ret; luaL_checktype(L, pos, LUA_TTABLE); lua_pushinteger(L, 1); lua_gettable(L, pos); ret.first = LuaStrictStack::get(L, lua_gettop(L)); lua_pop(L, 1); lua_pushinteger(L, 2); lua_gettable(L, pos); ret.second = LuaStrictStack::get(L, lua_gettop(L)); lua_pop(L, 1); return ret; } static void push(lua_State* L, const Type& in) { LuaStackRAII _a(L, 0, 1); // Place all of our vector values in a new table. lua_newtable(L); int tblPos = lua_gettop(L); lua_pushinteger(L, 1); LuaStrictStack::push(L, in.first); lua_settable(L, tblPos); lua_pushinteger(L, 2); LuaStrictStack::push(L, in.second); lua_settable(L, tblPos); } static std::string getValStr(const Type& in) { std::ostringstream os; os << "{"; os << LuaStrictStack::getValStr(in.first); os << ", "; os << LuaStrictStack::getValStr(in.second); os << "}"; return os.str(); } static std::string getTypeStr() { return "GenericPair"; } static Type getDefault() { return std::make_pair(LuaStrictStack::getDefault(), LuaStrictStack::getDefault()); } }; // Generic vector type that uses previously defined types on the stack. template class LuaStrictStack> { public: typedef std::vector::Type > Type; static Type get(lua_State* L, int pos) { // Ensure that there is a table on the top of the stack. LuaStackRAII _a(L, 0, 0); Type ret; luaL_checktype(L, pos, LUA_TTABLE); // There should be a table at 'pos', containing four numerical elements. int index = 1; while ( 1 ) { // Check to see if this index exists in the table. lua_pushinteger(L, index); lua_gettable(L, pos); if (lua_isnil(L, -1)) { lua_pop(L, 1); break; } ret.push_back(LuaStrictStack::get(L, lua_gettop(L))); lua_pop(L, 1); ++index; } return ret; } static void push(lua_State* L, const Type& in) { LuaStackRAII _a(L, 0, 1); // Place all of our vector values in a new table. lua_newtable(L); int tblPos = lua_gettop(L); int index = 1; typename Type::const_iterator it; for (it = in.begin(); it != in.end(); ++it) { lua_pushinteger(L, index); LuaStrictStack::push(L, *it); lua_settable(L, tblPos); ++index; } } static std::string getValStr(const Type& in) { std::ostringstream os; os << "{"; for (typename Type::const_iterator it = in.begin(); it != in.end(); ++it) { if (it != in.begin()) os << ", "; os << LuaStrictStack::getValStr(*it); } os << "}"; return os.str(); } static std::string getTypeStr() { return "GenericVector"; } static Type getDefault() {return Type();} }; template class LuaStrictStack& > { public: typedef std::vector::Type > Type; static Type get(lua_State* L, int pos) { return LuaStrictStack::get(L, pos); } static void push(lua_State* L, const Type& in) { LuaStrictStack::push(L, in); } static std::string getValStr(const Type& in) { return LuaStrictStack::getValStr(in); } static std::string getTypeStr() { return LuaStrictStack::getTypeStr(); } static Type getDefault() {return LuaStrictStack::getDefault();} }; // Essentially the same implementation as std::vector. template class LuaStrictStack> { public: typedef std::list::Type > Type; static Type get(lua_State* L, int pos) { // Ensure that there is a table on the top of the stack. LuaStackRAII _a(L, 0, 0); Type ret; luaL_checktype(L, pos, LUA_TTABLE); // There should be a table at 'pos', containing four numerical elements. int index = 1; while ( 1 ) { // Check to see if this index exists in the table. lua_pushinteger(L, index); lua_gettable(L, pos); if (lua_isnil(L, -1)) { lua_pop(L, 1); break; } ret.push_back(LuaStrictStack::get(L, lua_gettop(L))); lua_pop(L, 1); ++index; } return ret; } static void push(lua_State* L, const Type& in) { LuaStackRAII _a(L, 0, 1); // Place all of our vector values in a new table. lua_newtable(L); int tblPos = lua_gettop(L); int index = 1; for (typename Type::const_iterator it = in.begin(); it != in.end(); ++it) { lua_pushinteger(L, index); LuaStrictStack::push(L, *it); lua_settable(L, tblPos); ++index; } } static std::string getValStr(const Type& in) { std::ostringstream os; os << "{"; for (typename Type::const_iterator it = in.begin(); it != in.end(); ++it) { if (it != in.begin()) os << ", "; os << LuaStrictStack::getValStr(*it); } os << "}"; return os.str(); } static std::string getTypeStr() { return "GenericList"; } static Type getDefault() { return Type(); } }; // Same implementation as above template class LuaStrictStack& > { public: typedef std::list::Type > Type; static Type get(lua_State* L, int pos) { return LuaStrictStack::get(L, pos); } static void push(lua_State* L, const Type& in) { LuaStrictStack::push(L, in); } static std::string getValStr(const Type& in) { return LuaStrictStack::getValStr(in); } static std::string getTypeStr() { return LuaStrictStack::getTypeStr(); } static Type getDefault() {return LuaStrictStack::getDefault();} }; #ifdef DETECTED_OS_WINDOWS /// Visual Studio 2010 and Visual Studio 2012 don't support variadic templates /// so we need to specialize every tuple we use. template class LuaStrictStack> { public: typedef std::tuple Type; static Type get(lua_State* L, int pos) { // Ensure that there is a table on the top of the stack. LuaStackRAII _a(L, 0, 0); Type ret; luaL_checktype(L, pos, LUA_TTABLE); lua_pushinteger(L, 2); lua_gettable(L, pos); lua_pushinteger(L, 1); lua_gettable(L, pos); ret = std::make_tuple(LuaStrictStack::get(L, -1), LuaStrictStack::get(L, -2)); lua_pop(L, 2); return ret; } static void push(lua_State* L, const Type& in) { LuaStackRAII _a(L, 0, 1); // Place all of our vector values in a new table. lua_newtable(L); int tblPos = lua_gettop(L); lua_pushinteger(L, 1); LuaStrictStack::push(L, std::get<0>(in)); lua_settable(L, tblPos); lua_pushinteger(L, 2); LuaStrictStack::push(L, std::get<1>(in)); lua_settable(L, tblPos); } static std::string getValStr(const Type&) { return std::string("Not implemented for tuples on windows."); } static std::string getTypeStr() { return "2-tuple"; } static Type getDefault() { return Type(); } }; /// Handles tConverterFormat (in IOManager) template class LuaStrictStack> { public: typedef std::tuple Type; static Type get(lua_State* L, int pos) { // Ensure that there is a table on the top of the stack. LuaStackRAII _a(L, 0, 0); Type ret; luaL_checktype(L, pos, LUA_TTABLE); lua_pushinteger(L, 4); lua_gettable(L, pos); lua_pushinteger(L, 3); lua_gettable(L, pos); lua_pushinteger(L, 2); lua_gettable(L, pos); lua_pushinteger(L, 1); lua_gettable(L, pos); ret = std::make_tuple(LuaStrictStack::get(L, -1), LuaStrictStack::get(L, -2), LuaStrictStack::get(L, -3), LuaStrictStack::get(L, -4)); lua_pop(L, 4); return ret; } static void push(lua_State* L, const Type& in) { LuaStackRAII _a(L, 0, 1); // Place all of our vector values in a new table. lua_newtable(L); int tblPos = lua_gettop(L); lua_pushinteger(L, 1); LuaStrictStack::push(L, std::get<0>(in)); lua_settable(L, tblPos); lua_pushinteger(L, 2); LuaStrictStack::push(L, std::get<1>(in)); lua_settable(L, tblPos); lua_pushinteger(L, 3); LuaStrictStack::push(L, std::get<2>(in)); lua_settable(L, tblPos); lua_pushinteger(L, 4); LuaStrictStack::push(L, std::get<3>(in)); lua_settable(L, tblPos); } static std::string getValStr(const Type& ) { return std::string("Not implemented for tuples on windows."); } static std::string getTypeStr() { return "4-tuple"; } static Type getDefault() { return Type(); } }; template class LuaStrictStack> { public: typedef std::tuple Type; static Type get(lua_State* L, int pos) { // Ensure that there is a table on the top of the stack. LuaStackRAII _a(L, 0, 0); Type ret; luaL_checktype(L, pos, LUA_TTABLE); lua_pushinteger(L, 7); lua_gettable(L, pos); lua_pushinteger(L, 6); lua_gettable(L, pos); lua_pushinteger(L, 5); lua_gettable(L, pos); lua_pushinteger(L, 4); lua_gettable(L, pos); lua_pushinteger(L, 3); lua_gettable(L, pos); lua_pushinteger(L, 2); lua_gettable(L, pos); lua_pushinteger(L, 1); lua_gettable(L, pos); ret = std::make_tuple(LuaStrictStack::get(L, -1), LuaStrictStack::get(L, -2), LuaStrictStack::get(L, -3), LuaStrictStack::get(L, -4), LuaStrictStack::get(L, -5), LuaStrictStack::get(L, -6), LuaStrictStack::get(L, -7)); lua_pop(L, 4); return ret; } static void push(lua_State* L, const Type& in) { LuaStackRAII _a(L, 0, 1); // Place all of our vector values in a new table. lua_newtable(L); int tblPos = lua_gettop(L); lua_pushinteger(L, 1); LuaStrictStack::push(L, std::get<0>(in)); lua_settable(L, tblPos); lua_pushinteger(L, 2); LuaStrictStack::push(L, std::get<1>(in)); lua_settable(L, tblPos); lua_pushinteger(L, 3); LuaStrictStack::push(L, std::get<2>(in)); lua_settable(L, tblPos); lua_pushinteger(L, 4); LuaStrictStack::push(L, std::get<3>(in)); lua_settable(L, tblPos); lua_pushinteger(L, 5); LuaStrictStack::push(L, std::get<4>(in)); lua_settable(L, tblPos); lua_pushinteger(L, 6); LuaStrictStack::push(L, std::get<5>(in)); lua_settable(L, tblPos); lua_pushinteger(L, 7); LuaStrictStack::push(L, std::get<6>(in)); lua_settable(L, tblPos); } static std::string getValStr(const Type&) { return std::string("Not implemented for tuples on windows."); } static std::string getTypeStr() { return "7-tuple"; } static Type getDefault() { return Type(); } }; #else /// Structure allowing recursive creation of tuples and extraction of their /// values. Watch out for the indices; std::get and std::tuple_element are 0 /// based while Lua indices (passed into lua_pushinteger) are 1 based. template struct LuaTuvokTupleTable { static void push(lua_State* L, int pos, const Tuple& t) { LuaTuvokTupleTable::push(L, pos, t); LuaStackRAII _a(L, 0, 0); lua_pushinteger(L, N); LuaStrictStack::type>:: push(L, std::get(t)); lua_settable(L, pos); } static void pull(lua_State* L, int pos, Tuple& t) { LuaTuvokTupleTable::pull(L, pos, t); LuaStackRAII _a(L, 0, 0); lua_pushinteger(L, N); lua_gettable(L, pos); if (lua_isnil(L, -1)) { // Something went really wrong. The number of values in the tuple // does not agree with the number of values in Lua. lua_pop(L, 1); throw LuaError("Number of values in a Lua table represnting a tuple " "disagrees with the number of values actually present " "in the tuple!"); } std::get(t) = LuaStrictStack::type>:: get(L, lua_gettop(L)); lua_pop(L, 1); } static void print(const Tuple& t, std::ostringstream& os) { LuaTuvokTupleTable::print(t, os); os << ", " << LuaStrictStack::type > ::getValStr(std::get(t)); } }; /// Base case specialization. template struct LuaTuvokTupleTable { static void push(lua_State* L, int pos, const Tuple& t) { LuaStackRAII _a(L, 0, 0); lua_pushinteger(L, 1); LuaStrictStack::type>:: push(L, std::get<0>(t)); lua_settable(L, pos); } static void pull(lua_State* L, int pos, Tuple& t) { LuaStackRAII _a(L, 0, 0); lua_pushinteger(L, 1); lua_gettable(L, pos); if (lua_isnil(L, -1)) { // Something went really wrong. The number of values in the tuple // does not agree with the number of values in Lua. lua_pop(L, 1); throw LuaError("Number of values in a Lua table represnting a tuple " "disagrees with the number of values actually present " "in the tuple!"); } std::get<0>(t) = // Returns a reference LuaStrictStack::type>:: get(L, lua_gettop(L)); lua_pop(L, 1); } static void print(const Tuple& t, std::ostringstream& os) { os << LuaStrictStack::type>:: getValStr(std::get<0>(t)); } }; template void luaPushTupleValuesToTable(lua_State* L, int tblPos, const std::tuple& t) { LuaTuvokTupleTable, sizeof...(TupleArgs)>::push(L, tblPos, t); } template std::tuple luaPullTupleValuesFromTable(lua_State* L, int tblPos) { std::tuple ret; LuaTuvokTupleTable, sizeof...(TupleArgs)>::pull(L, tblPos, ret); return ret; } template void luaPrintTuple(const std::tuple& t, std::ostringstream& os) { LuaTuvokTupleTable, sizeof...(TupleArgs)>::print(t, os); } // Implementation of tuple-Lua-pass-through using variadic templates. template class LuaStrictStack> { public: typedef std::tuple Type; static Type get(lua_State* L, int pos) { // Ensure that there is a table on the top of the stack. LuaStackRAII _a(L, 0, 0); luaL_checktype(L, pos, LUA_TTABLE); return luaPullTupleValuesFromTable(L, pos); } static void push(lua_State* L, const Type& in) { LuaStackRAII _a(L, 0, 1); // Place all of our vector values in a new table. lua_newtable(L); int tblPos = lua_gettop(L); luaPushTupleValuesToTable(L, tblPos, in); } static std::string getValStr(const Type& in) { std::ostringstream os; os << "{"; luaPrintTuple(in, os); os << "}"; return os.str(); } static std::string getTypeStr() { return "Tuple"; } static Type getDefault() { return Type(); } }; #endif // For binding enumeration types, we provide the following template // specialization definition. // TODO: Add convertable to int field that tells the RTTI mechanism that we // can just static_cast to an integer and be fine. #define TUVOK_LUA_STRINGIFY(X) #X #define TUVOK_LUA_REGISTER_ENUM_TYPE(X)\ namespace tuvok { \ template<> \ class LuaStrictStack \ { \ public: \ typedef X Type; \ static X get(lua_State* L, int pos) \ { \ return static_cast(luaL_checkint(L, pos)); \ } \ \ static void push(lua_State* L, X in) \ { \ lua_pushinteger(L, static_cast(in)); \ } \ \ static std::string getValStr(X in) \ { \ std::ostringstream os; \ os << static_cast(in); \ return os.str(); \ } \ static std::string getTypeStr() { return TUVOK_LUA_STRINGIFY(X); } \ static X getDefault() { return static_cast(0); } \ };\ } //======================== // // RUN TIME TYPE CHECKING // //======================== #ifdef TUVOK_DEBUG_LUA_USE_RTTI_CHECKS // // From the C++ Standard [ISO/IEC 14882:1998(E)] // to ISO N3337 (post-C++11 standard with minor corrections) // 5.2.8, first point. I paraphrase below (standard is copyrighted). // // typeid returns an object of static type std::type_info. The object // referred to by the return value (lvalue) of typeid is guaranteed to exist // for the lifetime of the program. // // From this, we can safely deduce that the address of any type_info class will // remain valid for the life of the program. // // As such, we can store a pointer to a type_info object inside lua as a void* // and recast the object to compare types at a later time. // This functionality is needed for the setDefaults function and to ensure // that the objects pointed to by shared_ptrs are indeed the same type. // typedef const std::type_info* LSSTypeID; template LSSTypeID LSS_getTypeInfo() { return &typeid(T); } template bool LSS_compareToTypeOnStack(lua_State* L, int stackIndex) { LSSTypeID a = static_cast(lua_touserdata(L, stackIndex)); return (*a) == (*LSS_getTypeInfo()); } template bool LSS_compareTypes() { return (*LSS_getTypeInfo()) == (*LSS_getTypeInfo()); } template void LSS_pushTypeInfo(lua_State* L) { lua_pushlightuserdata(L,const_cast(reinterpret_cast( LSS_getTypeInfo()))); } #endif } /* namespace tuvok */ //============================ // // FUNCTION BINDING TEMPLATES // //============================ #include "LuaFunBindingCore.h" #endif /* LUAFUNBINDING_H_ */ ImageVis3D-3.1.0/Tuvok/LuaScripting/LuaDebug.h0000644000175000017500000000351212320456500020633 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file LuaDebug.h \author James Hughes \date Jun 29, 2012 \brief Provides debugging functions within Lua. */ #ifndef LUADEBUG_H_ #define LUADEBUG_H_ #include "LuaMemberRegUnsafe.h" namespace tuvok { class LuaScripting; class LuaDebug { public: LuaDebug(LuaScripting* scripting); virtual ~LuaDebug(); /// Registers debugging functions in Lua. void registerLuaDebugFunctions(); private: /// Watches the given function for changes. void watchFunction(const std::string& function); LuaMemberRegUnsafe mMemberReg; ///< Used for member registration. }; } /* namespace tuvok */ #endif /* LUADEBUG_H_ */ ImageVis3D-3.1.0/Tuvok/Tuvok.pro0000644000175000017500000000015612320456500016221 0ustar mathieumathieuSUBDIRS = IO/expressions tvk.pro doc/genlua TEMPLATE = subdirs CONFIG += ordered ImageVis3D-3.1.0/Tuvok/Shaders/0000755000175000017500000000000012320456500015756 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/Shaders/GLSBVR-Mesh-VS.glsl0000644000175000017500000000352712320456500021067 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Mesh-FS.glsl \author Jens Krueger SCI Institute University of Utah \date June 2010 */ varying vec3 vPosition; varying vec3 normal; void main(void) { if (gl_MultiTexCoord0.a < 1.5) { if (gl_Normal == vec3(2,2,2)) { normal = gl_Normal; } else { normal = gl_NormalMatrix * gl_Normal; } gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; gl_FrontColor = gl_MultiTexCoord0; gl_BackColor = gl_MultiTexCoord0; } else { gl_Position = gl_ProjectionMatrix * gl_Vertex; } gl_TexCoord[0] = gl_MultiTexCoord0; vPosition = gl_Vertex.xyz; } ImageVis3D-3.1.0/Tuvok/Shaders/Compose-Anaglyphs-FS.glsl0000644000175000017500000000346412320456500022507 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Compose-Anaglyphs-FS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ uniform sampler2D texRightEye; uniform sampler2D texLeftEye; void main(void){ vec4 vLeftEye = texture2D(texLeftEye, gl_TexCoord[0].xy); vec4 vRightEye = texture2D(texRightEye, gl_TexCoord[0].xy); float fGrayLeftEye = dot(vLeftEye.rgb, vec3(0.3,0.59,0.11)); float fGrayRightEye = dot(vRightEye.rgb, vec3(0.3,0.59,0.11)); gl_FragColor = vec4(fGrayLeftEye,fGrayRightEye*0.5,fGrayRightEye,max(vLeftEye.a,vRightEye.a)); }ImageVis3D-3.1.0/Tuvok/Shaders/GLGridLeaper-Method-iso.glsl0000644000175000017500000000375612320456500023123 0ustar mathieumathieu#version 420 core uniform float fIsoval; uniform vec3 vDomainScale; float samplePool(vec3 coords); vec3 ComputeNormal(vec3 vCenter, vec3 StepSize, vec3 DomainScale); bool GetVolumeHit(vec3 currentPoolCoords, out vec4 color) { color = vec4(1.0, 1.0, 1.0, 1.0); return samplePool(currentPoolCoords) >= fIsoval; } vec3 GetVolumeNormal(vec3 currentPoolCoords, vec3 sampleDelta) { return ComputeNormal(currentPoolCoords, sampleDelta, vDomainScale); } vec3 RefineIsosurface(in vec3 vRayDir, in vec3 vCurrentPos) { vRayDir /= 2.0; vCurrentPos -= vRayDir; for (int i = 0; i < 5; i++) { vRayDir /= 2.0; float voxel = samplePool(vCurrentPos); if (voxel >= fIsoval) { vCurrentPos -= vRayDir; } else { vCurrentPos += vRayDir; } } return vCurrentPos; } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ImageVis3D-3.1.0/Tuvok/Shaders/2D-slice-FS.glsl0000644000175000017500000000545712320456500020524 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file 2D-slice-FS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ vec4 sampleVolume(vec3 coords); uniform sampler2D texTrans; ///< the 2D Transfer function uniform float fTransScale; ///< value scale for 2D Transfer function lookup uniform float fGradientScale; ///< gradient scale for 2D Transfer function lookup uniform vec3 vVoxelStepsize; ///< Stepsize (in texcoord) to get to the next voxel void main(void) { /// get volume value float fVolumVal = sampleVolume(gl_TexCoord[0].xyz).x; /// compute the gradient float fVolumValXp = sampleVolume( gl_TexCoord[0].xyz+vec3(+vVoxelStepsize.x,0,0)).x; float fVolumValXm = sampleVolume( gl_TexCoord[0].xyz+vec3(-vVoxelStepsize.x,0,0)).x; float fVolumValYp = sampleVolume( gl_TexCoord[0].xyz+vec3(0,-vVoxelStepsize.y,0)).x; float fVolumValYm = sampleVolume( gl_TexCoord[0].xyz+vec3(0,+vVoxelStepsize.y,0)).x; float fVolumValZp = sampleVolume( gl_TexCoord[0].xyz+vec3(0,0,+vVoxelStepsize.z)).x; float fVolumValZm = sampleVolume( gl_TexCoord[0].xyz+vec3(0,0,-vVoxelStepsize.z)).x; vec3 vGradient = vec3((fVolumValXm-fVolumValXp)/2.0, (fVolumValYp-fVolumValYm)/2.0, (fVolumValZm-fVolumValZp)/2.0); float fGradientMag = length(vGradient); /// apply 2D transfer function vec4 vTransVal = texture2D(texTrans, vec2(fVolumVal*fTransScale, 1.0-fGradientMag*fGradientScale)); vTransVal.rgb *= vTransVal.a; vTransVal.a = 1.0; /// write result to fragment color gl_FragColor = vTransVal; } ImageVis3D-3.1.0/Tuvok/Shaders/GLGridLeaper-Method-iso-color.glsl0000644000175000017500000000375312320456500024234 0ustar mathieumathieu#version 420 core uniform float fIsoval; uniform vec3 vDomainScale; vec4 samplePool4(vec3 coords); vec3 ComputeAlphaNormal(vec3 vCenter, vec3 StepSize, vec3 DomainScale); bool GetVolumeHit(vec3 currentPoolCoords, out vec4 color) { color = samplePool4(currentPoolCoords); return color.a >= fIsoval; } vec3 GetVolumeNormal(vec3 currentPoolCoords, vec3 sampleDelta) { return ComputeAlphaNormal(currentPoolCoords, sampleDelta, vDomainScale); } vec3 RefineIsosurface(in vec3 vRayDir, in vec3 vCurrentPos) { vRayDir /= 2.0; vCurrentPos -= vRayDir; for (int i = 0; i < 5; i++) { vRayDir /= 2.0; float voxel = samplePool4(vCurrentPos).a; if (voxel >= fIsoval) { vCurrentPos -= vRayDir; } else { vCurrentPos += vRayDir; } } return vCurrentPos; } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ImageVis3D-3.1.0/Tuvok/Shaders/GLSBVR-Color-FS.glsl0000644000175000017500000000445012320456500021225 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLSBVR-Color-FS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ vec4 sampleVolume(vec3 coords); uniform vec3 vVoxelStepsize; ///< Stepsize (in texcoord) to get to the next voxel uniform float fIsoval; ///< the isovalue uniform vec3 vDomainScale; varying vec3 vPosition; vec3 ComputeNormal(vec3 vHitPosTex, vec3 StepSize, vec3 DomainScale); void main(void) { /// get volume value vec4 fVolumVal = sampleVolume(gl_TexCoord[0].xyz); // if we hit (or shot over) an isosurface if (fVolumVal.a >= fIsoval) { // store surface position and red channel gl_FragData[0] = vec4(vPosition.xyz,fVolumVal.r+1.0); // red chanel plus one (to make sure this value is not accideantially zero) // store normal and green and blue channel gl_FragData[1] = vec4(ComputeNormal(gl_TexCoord[0].xyz, vVoxelStepsize, vDomainScale), floor(fVolumVal.g * 512.0) + fVolumVal.b); } else { discard; } } ImageVis3D-3.1.0/Tuvok/Shaders/Volume2D-linear.glsl0000644000175000017500000000532112320456500021547 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Volume2D.glsl \author Jens Krueger DFKI Saarbrcken & SCI Institute, University of Utah \version 1.0 \date May 2010 */ uniform sampler2D texSlice0; uniform sampler2D texSlice1; uniform sampler2D texSlice2; vec4 sampleVolume(vec3 coords){ vec4 v0 = texture2D(texSlice0, coords.xy); vec4 v1 = texture2D(texSlice1, coords.xy); return (1.0-coords.z) * v0 + coords.z * v1; } vec3 ComputeGradient(vec3 vCenter, vec3 StepSize) { float fVolumValXp = sampleVolume(vCenter+vec3(+StepSize.x,0,0)).x; float fVolumValXm = sampleVolume(vCenter+vec3(-StepSize.x,0,0)).x; float fVolumValYp = sampleVolume(vCenter+vec3(0,-StepSize.y,0)).x; float fVolumValYm = sampleVolume(vCenter+vec3(0,+StepSize.y,0)).x; float t = vCenter.z; float fVolumValZ = (1.0-t) * texture2D(texSlice0, vCenter.xy).x + t * texture2D(texSlice1, vCenter.xy).x; float fVolumValZp = (1.0-t) * texture2D(texSlice1, vCenter.xy).x + t * texture2D(texSlice2, vCenter.xy).x; return (gl_TextureMatrix[0] * vec4((fVolumValXm - fVolumValXp)/2.0, (fVolumValYp - fVolumValYm)/2.0, (fVolumValZ - fVolumValZp)*1.0,1.0)).xyz; } vec3 ComputeNormal(vec3 vCenter, vec3 StepSize, vec3 DomainScale) { vec3 vGradient = ComputeGradient(vCenter, StepSize); vec3 vNormal = gl_NormalMatrix * (vGradient * DomainScale); float l = length(vNormal); if (l>0.0) vNormal /= l; // safe normalization return vNormal; } ImageVis3D-3.1.0/Tuvok/Shaders/GLGridLeaper-Method-1D.glsl0000644000175000017500000000310512320456500022561 0ustar mathieumathieu#version 420 core layout(binding=2) uniform sampler1D transferFunction; uniform float fTransScale; float samplePool(vec3 coords); vec4 ComputeColorFromVolume(vec3 currentPoolCoords, vec3 modelSpacePosition, vec3 sampleDelta) { // fetch volume float data = samplePool(currentPoolCoords); // apply 1D TF return texture(transferFunction, data*fTransScale); } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ImageVis3D-3.1.0/Tuvok/Shaders/GLSBVR-Mesh-1D-light-FS.glsl0000644000175000017500000001034712320456500022414 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : GLSBVR-Mesh-1D-light-FS.glsl //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute vec4 sampleVolume(vec3 coords); vec3 ComputeNormal(vec3 vCenter, vec3 StepSize, vec3 DomainScale); uniform float fTransScale; ///< scale for 1D Transfer function lookup uniform float fStepScale; ///< opacity correction quotient uniform vec3 vVoxelStepsize; ///< Stepsize (in texcoord) to get to the next voxel uniform vec3 vDomainScale; uniform vec3 vLightAmbient; uniform vec3 vLightDiffuse; uniform vec3 vLightSpecular; uniform vec3 vLightAmbientM; uniform vec3 vLightDiffuseM; uniform vec3 vLightSpecularM; uniform vec3 vLightDir; varying vec3 vPosition; varying vec3 normal; vec3 Lighting(vec3 vPosition, vec3 vNormal, vec3 vLightAmbient, vec3 vLightDiffuse, vec3 vLightSpecular, vec3 vLightDir); #ifdef BIAS_SCALE uniform float TFuncBias; ///< bias amount for transfer func vec4 VRender1DLit(const vec3 tex_pos, in float tf_scale, in float tf_bias, in float opacity_correction, const vec3 voxel_step_size, const vec3 domain_scale, const vec3 position, const vec3 l_ambient, const vec3 l_diffuse, const vec3 l_specular, const vec3 l_direction); #else vec4 VRender1DLit(const vec3 tex_pos, in float tf_scale, in float opacity_correction, const vec3 voxel_step_size, const vec3 domain_scale, const vec3 position, const vec3 l_ambient, const vec3 l_diffuse, const vec3 l_specular, const vec3 l_direction); #endif vec4 TraversalOrderDepColor(const vec4 color); void main(void) { if (gl_TexCoord[0].a < 1.5) { // save way of testing for 2 if (normal == vec3(2,2,2)) { gl_FragColor = gl_Color; } else { vec3 vLightColor = Lighting(vPosition, normal, vLightAmbientM*gl_Color.xyz, vLightDiffuseM*gl_Color.xyz, vLightSpecularM, vLightDir); gl_FragColor = vec4(vLightColor.x,vLightColor.y,vLightColor.z,gl_Color.w); } } else { #if defined(BIAS_SCALE) gl_FragColor = VRender1DLit( gl_TexCoord[0].xyz, fTransScale, TFuncBias, fStepScale, vVoxelStepsize, vDomainScale, vPosition.xyz, vLightAmbient, vLightDiffuse, vLightSpecular, vLightDir ); #else gl_FragColor = VRender1DLit( gl_TexCoord[0].xyz, fTransScale, fStepScale, vVoxelStepsize, vDomainScale, vPosition.xyz, vLightAmbient, vLightDiffuse, vLightSpecular, vLightDir ); #endif } // pre-multiplication of alpha, if needed. gl_FragColor = TraversalOrderDepColor(gl_FragColor); } ImageVis3D-3.1.0/Tuvok/Shaders/GLRaycaster-ISO-CV-FS.glsl0000644000175000017500000001132312320456500022265 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLRaycaster-ISO-CV-FS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ uniform sampler2D texRayExitPos; ///< the backface (or ray exit point) texture in eyecoords uniform sampler2D texLastHit; ///< the texcoords hit + ray param from the first pass uniform sampler2D texLastHitPos; ///< the worldspace pos + tile ID from the first pass uniform vec3 vVoxelStepsize; ///< Stepsize (in texcoord) to get to the next voxel uniform float fRayStepsize; ///< stepsize along the ray uniform float fIsoval; ///< the isovalue uniform vec2 vScreensize; ///< the size of the screen in pixels uniform vec2 vProjParam; ///< X = far / (far - near) / Y = (far * near / (near - far)) uniform int iTileID; ///< ID of the current tile uniform vec3 vDomainScale; varying vec3 vEyePos; vec4 sampleVolume(vec3 coords); vec3 ComputeNormal(vec3 vHitPosTex, vec3 StepSize, vec3 DomainScale); vec3 RefineIsosurface(in vec3 vRayDir, inout vec3 vCurrentPos, in float fIsoval); void main(void) { // compute the coordinates to look up the previous pass vec2 vFragCoords = vec2(gl_FragCoord.x / vScreensize.x , gl_FragCoord.y / vScreensize.y); // compute the ray parameters vec3 vRayEntry = texture2D(texRayExitPos, vFragCoords).xyz; vec3 vRayExit = vEyePos; vec3 vRayEntryTex = (gl_TextureMatrix[0] * vec4(vRayEntry,1.0)).xyz; vec3 vRayExitTex = (gl_TextureMatrix[0] * vec4(vRayExit,1.0)).xyz; // if in the first iso pass we found a hit in the same tile as we are processing now // we can start from the last position float fLastTileID = texture2D(texLastHitPos, vFragCoords).w; if (float(iTileID) == fLastTileID) { // update entry point to last stop float fLastHitParam = texture2D(texLastHit, vFragCoords).w; vRayEntry = vRayEntry * (1.0-fLastHitParam) + vRayEntry * fLastHitParam; vRayEntryTex = vRayEntryTex * (1.0-fLastHitParam) + vRayExitTex * fLastHitParam; } float fRayLength = length(vRayExit - vRayEntry); float fRayLengthTex = length(vRayExitTex - vRayEntryTex); // compute the maximum number of steps before the domain is left int iStepCount = int(fRayLength/fRayStepsize)+1; vec3 vRayIncTex = (vRayExitTex-vRayEntryTex)/(fRayLength/fRayStepsize); // do the actual raycasting vec4 vHitPosTex = vec4(0.0,0.0,0.0,0.0); vec3 vCurrentPosTex = vRayEntryTex; for (int i = 0;i= fIsoval) { vHitPosTex = vec4(vCurrentPosTex.x, vCurrentPosTex.y, vCurrentPosTex.z, 1); break; } vCurrentPosTex += vRayIncTex; } // store surface hit if one is found if (vHitPosTex.a != 0.0) vHitPosTex.xyz = RefineIsosurface(vRayIncTex, vHitPosTex.xyz, fIsoval); else discard; // interpolate eye space position float fInterpolParam = length(vHitPosTex.xyz-vRayEntryTex)/fRayLengthTex; vec3 vHitPos = vRayEntry * (1.0-fInterpolParam) + vRayExit * fInterpolParam; gl_FragData[0] = vec4(vHitPos.xyz,fInterpolParam); // store non-linear depth gl_FragDepth = vProjParam.x + (vProjParam.y / -vEyePos.z); // as the surface maybe transparent set depth to the ray exit pos, so we get at least the bbox correct // store normal vec3 vNormal = ComputeNormal(vHitPosTex.xyz, vVoxelStepsize, vDomainScale); gl_FragData[1] = vec4(vNormal,float(iTileID)); } ImageVis3D-3.1.0/Tuvok/Shaders/MIP-slice-FS.glsl0000644000175000017500000000275212320456500020677 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file MIP-slice-FS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ vec4 sampleVolume(vec3 coords); void main(void) { gl_FragColor = sampleVolume(gl_TexCoord[0].xyz).xxxx; } ImageVis3D-3.1.0/Tuvok/Shaders/Transfer-MIP-FS.glsl0000644000175000017500000000373712320456500021370 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Transfer-MIP-FS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date December 2008 */ uniform sampler2D texLast; ///< the maximum value from the previous passes uniform sampler1D texTrans; ///< the 1D Transfer function uniform float fTransScale; ///< scale for 1D Transfer function lookup void main(void){ // fetch MIP value vec2 fVLastVal = texture2D(texLast, gl_TexCoord[0].xy).xw; // apply 1D transfer function but ignore opacity if (fVLastVal.y > 0.5) // this is a "very robust" float test for fVLastVal.y == 1 && fVLastVal.y != 0 gl_FragColor = vec4(texture1D(texTrans, fVLastVal.x*fTransScale).rgb,1.0); else gl_FragColor = vec4(0.0,0.0,0.0,1.0); } ImageVis3D-3.1.0/Tuvok/Shaders/GLRaycaster-VS.glsl0000644000175000017500000000302512320456500021347 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLRaycaster-VS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ varying vec3 vEyePos; void main(void) { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; vEyePos = (gl_ModelViewMatrix * gl_Vertex).xyz; }ImageVis3D-3.1.0/Tuvok/Shaders/GLSBVR-ISO-FS.glsl0000644000175000017500000000414312320456500020600 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLSBVR-ISO-FS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ uniform vec3 vVoxelStepsize; ///< Stepsize (in texcoord) to get to the next voxel uniform float fIsoval; ///< the isovalue uniform vec3 vDomainScale; varying vec3 vPosition; vec4 sampleVolume(vec3 coords); vec3 ComputeNormal(vec3 vHitPosTex, vec3 StepSize, vec3 DomainScale); void main(void) { // get volume value float fVolumVal = sampleVolume(gl_TexCoord[0].xyz).x; // if we hit (or shot over) an isosurface if (fVolumVal >= fIsoval) { // store surface position gl_FragData[0] = vec4(vPosition.xyz,1.0); // store normal gl_FragData[1] = vec4(ComputeNormal(gl_TexCoord[0].xyz, vVoxelStepsize, vDomainScale), 1.0); } else { discard; } } ImageVis3D-3.1.0/Tuvok/Shaders/VRender1D-Color.glsl0000644000175000017500000000374212320456500021455 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \author Tom Fogal University of Utah \brief Performs volume rendering w/o applying a transfer function */ uniform sampler1D texTrans; ///< the 1D Transfer function vec4 sampleVolume(vec3); // since this is color data... we aren't really using a "bit width"-based idea // to scale the transfer function. However this matches the VRender1D_BitWidth // interface as opposed to the _BiasScale interface, so we use the name anyway. vec4 VRender1D_BitWidth(const vec3 tex_pos, in float tf_scale, in float opacity_correction) { vec4 v = sampleVolume(tex_pos); v = v * texture1D(texTrans, (v.r+v.g+v.b)/3.0); v.a = 1.0 - pow(1.0 - v.a, opacity_correction); // opacity correction return v; } ImageVis3D-3.1.0/Tuvok/Shaders/VRender1DLit.glsl0000644000175000017500000000523012320456500021044 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \author Tom Fogal University of Utah \brief Function for performing "standard" volume rendering. */ uniform sampler1D texTrans; ///< the 1D Transfer function vec4 sampleVolume(vec3); vec3 ComputeNormal(vec3 vCenter, vec3 StepSize, vec3 DomainScale); vec3 Lighting(vec3 vPosition, vec3 vNormal, vec3 vLightAmbient, vec3 vLightDiffuse, vec3 vLightSpecular, vec3 vLightDir); vec4 bit_width(const vec3 tex_pos, const float tf_scale) { float fVolumVal = sampleVolume(tex_pos).x; return texture1D(texTrans, fVolumVal * tf_scale); } /* Basic volume rendering w/ lighting */ vec4 VRender1DLit(const vec3 tex_pos, in float tf_scale, in float opacity_correction, const vec3 voxel_step_size, const vec3 domain_scale, const vec3 position, const vec3 l_ambient, const vec3 l_diffuse, const vec3 l_specular, const vec3 l_direction) { vec4 lut_v = bit_width(tex_pos, tf_scale); // compute gradient vec3 normal = ComputeNormal(tex_pos, voxel_step_size, domain_scale); vec3 light_color = Lighting(position, normal, l_ambient, l_diffuse * lut_v.xyz, l_specular, l_direction); // opacity correction lut_v.a = 1.0 - pow(1.0 - lut_v.a, opacity_correction); return vec4(light_color.x, light_color.y, light_color.z, lut_v.a); } ImageVis3D-3.1.0/Tuvok/Shaders/Compose-Color-FS.glsl0000644000175000017500000000664412320456500021642 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Compose-Color-FS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ uniform sampler2D texRayHitPos; ///< the hitposition of the ray (alpha flags hit yes/no) uniform sampler2D texRayHitNormal; ///< the surface normal at the hit position uniform vec3 vLightAmbient; uniform vec3 vLightDiffuse; uniform vec3 vLightSpecular; uniform vec3 vLightDir; uniform vec2 vScreensize; ///< the size of the screen in pixels uniform vec2 vProjParam; ///< X = far / (far - near) / Y = (far * near / (near - far)) vec3 Lighting(vec3 vPosition, vec3 vNormal, vec3 vLightAmbient, vec3 vLightDiffuse, vec3 vLightSpecular) { vNormal.z = abs(vNormal.z); vec3 vViewDir = normalize(vec3(0.0,0.0,0.0)-vPosition); vec3 vReflection = normalize(reflect(vViewDir, vNormal)); return clamp(vLightAmbient+ vLightDiffuse*max(abs(dot(vNormal, -vLightDir)),0.0)+ vLightSpecular*pow(max(dot(vReflection, vLightDir),0.0),8.0), 0.0,1.0); } void main(void) { // compute the coordinates to look up the previous pass vec2 vFragCoords = vec2(gl_FragCoord.x / vScreensize.x , gl_FragCoord.y / vScreensize.y); // get hitposition and check if a isosurface hit for this ray was found vec4 vPosition = texture2D(texRayHitPos, vFragCoords); if (vPosition.a == 0.0) discard; // get hit normal vec4 vNormalFetch = texture2D(texRayHitNormal, vFragCoords); vec3 vNormal = vec3(vNormalFetch.xy,abs(vNormalFetch.z)); // recover color from the two alpha channels vec3 vColor = vec3(vPosition.a-1.0, floor(vNormalFetch.a/2.0)/256.0, vNormalFetch.a-floor(vNormalFetch.a)); // compute lighting vec3 vViewDir = normalize(vec3(0.0,0.0,0.0)-vPosition.xyz); float l = length(vNormal); vNormal.z = abs(vNormal.z); vec3 vLightColor = Lighting(vPosition.xyz, vNormal, vLightAmbient, vColor.rgb*vLightDiffuse, vLightSpecular); /// write result to fragment color gl_FragColor = vec4(vLightColor.x, vLightColor.y, vLightColor.z, 1.0); // compute non linear depth from linear eye depth gl_FragDepth = vProjParam.x + (vProjParam.y / -vPosition.z); } ImageVis3D-3.1.0/Tuvok/Shaders/GLGridLeaper-GradientTools.glsl0000644000175000017500000000601212320456500023655 0ustar mathieumathieu#version 420 core float samplePool(vec3 coords); float samplePoolAlpha(vec3 coords); vec3 ComputeGradient(vec3 vCenter, vec3 sampleDelta) { float fVolumValXp = samplePool(vCenter+vec3(+sampleDelta.x,0,0)); float fVolumValXm = samplePool(vCenter+vec3(-sampleDelta.x,0,0)); float fVolumValYp = samplePool(vCenter+vec3(0,-sampleDelta.y,0)); float fVolumValYm = samplePool(vCenter+vec3(0,+sampleDelta.y,0)); float fVolumValZp = samplePool(vCenter+vec3(0,0,+sampleDelta.z)); float fVolumValZm = samplePool(vCenter+vec3(0,0,-sampleDelta.z)); return vec3(fVolumValXm - fVolumValXp, fVolumValYp - fVolumValYm, fVolumValZm - fVolumValZp) / 2.0; } vec3 ComputeNormal(vec3 vCenter, vec3 StepSize, vec3 DomainScale) { vec3 vGradient = ComputeGradient(vCenter, StepSize); vec3 vNormal = vGradient * DomainScale; float l = length(vNormal); if (l>0.0) vNormal /= l; // safe normalization return vNormal; } vec3 ComputeGradientAlpha(vec3 vCenter, vec3 sampleDelta) { float fVolumValXp = samplePoolAlpha(vCenter+vec3(+sampleDelta.x,0,0)); float fVolumValXm = samplePoolAlpha(vCenter+vec3(-sampleDelta.x,0,0)); float fVolumValYp = samplePoolAlpha(vCenter+vec3(0,-sampleDelta.y,0)); float fVolumValYm = samplePoolAlpha(vCenter+vec3(0,+sampleDelta.y,0)); float fVolumValZp = samplePoolAlpha(vCenter+vec3(0,0,+sampleDelta.z)); float fVolumValZm = samplePoolAlpha(vCenter+vec3(0,0,-sampleDelta.z)); return vec3(fVolumValXm - fVolumValXp, fVolumValYp - fVolumValYm, fVolumValZm - fVolumValZp) / 2.0; } vec3 ComputeAlphaNormal(vec3 vCenter, vec3 StepSize, vec3 DomainScale) { vec3 vGradient = ComputeGradient(vCenter, StepSize); vec3 vNormal = vGradient * DomainScale; float l = length(vNormal); if (l>0.0) vNormal /= l; // safe normalization return vNormal; } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ImageVis3D-3.1.0/Tuvok/Shaders/GLRaycaster-Color-FS.glsl0000644000175000017500000001002112320456500022375 0ustar mathieumathieuvec4 sampleVolume(vec3 coords); uniform sampler2D texRayExitPos; ///< the backface (or ray exit point) texture in eyecoords uniform vec3 vVoxelStepsize; ///< Stepsize (in texcoord) to get to the next voxel uniform float fRayStepsize; ///< stepsize along the ray uniform float fIsoval; ///< the isovalue uniform vec2 vScreensize; ///< the size of the screen in pixels uniform vec2 vProjParam; ///< X = far / (far - near) / Y = (far * near / (near - far)) uniform vec3 vDomainScale; varying vec3 vEyePos; vec3 ComputeNormal(vec3 vHitPosTex, vec3 StepSize, vec3 DomainScale); vec3 RefineIsosurface(in vec3 vRayDir, inout vec3 vCurrentPos, in float fIsoval); void main(void) { // compute the coordinates to look up the previous pass vec2 vFragCoords = vec2(gl_FragCoord.x / vScreensize.x , gl_FragCoord.y / vScreensize.y); // compute the ray parameters vec3 vRayEntry = texture2D(texRayExitPos, vFragCoords).xyz; vec3 vRayExit = vEyePos; vec3 vRayEntryTex = (gl_TextureMatrix[0] * vec4(vRayEntry,1.0)).xyz; vec3 vRayExitTex = (gl_TextureMatrix[0] * vec4(vRayExit,1.0)).xyz; float fRayLength = length(vRayExit - vRayEntry); float fRayLengthTex = length(vRayExitTex - vRayEntryTex); // compute the maximum number of steps before the domain is left int iStepCount = int(fRayLength/fRayStepsize)+1; vec3 vRayIncTex = (vRayExitTex-vRayEntryTex)/(fRayLength/fRayStepsize); // do the actual raycasting vec4 vHitPosTex = vec4(0.0,0.0,0.0,0.0); vec3 vCurrentPosTex = vRayEntryTex; for (int i = 0;i= fIsoval) { vHitPosTex = vec4(vCurrentPosTex.x, vCurrentPosTex.y, vCurrentPosTex.z, 1); break; } vCurrentPosTex += vRayIncTex; } // store surface hit if one is found if (vHitPosTex.a != 0.0) vHitPosTex.xyz = RefineIsosurface(vRayIncTex, vHitPosTex.xyz, fIsoval); else discard; vec3 fVolumeColor = sampleVolume(vCurrentPosTex).rgb; // interpolate eye space position float fInterpolParam = length(vHitPosTex.xyz-vRayEntryTex)/fRayLengthTex; vec3 vHitPos = vRayEntry * (1.0-fInterpolParam) + vRayExit * fInterpolParam; // store surface position and red channel gl_FragData[0] = vec4(vHitPos.xyz,fVolumeColor.r+1.0); // red chanel plus one (to make sure this value is not accideantially zero) // store non-linear depth gl_FragDepth = vProjParam.x + (vProjParam.y / -vHitPos.z); // store normal and green and blue channel vec3 vNormal = ComputeNormal(vHitPosTex.xyz, vVoxelStepsize, vDomainScale); // do a floor just to be sure gl_FragData[1] = vec4(vNormal,floor(fVolumeColor.g*512.0)+fVolumeColor.b); } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/Shaders/Compositing.glsl0000644000175000017500000000266312320456500021143 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Compositing.glsl */ vec4 UnderCompositing(vec4 src, vec4 dst) { vec4 result = dst; result.rgb += src.rgb * (1.0-dst.a)*src.a; result.a += src.a * (1.0-dst.a); return result; } ImageVis3D-3.1.0/Tuvok/Shaders/lighting.glsl0000644000175000017500000000373612320456500020457 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file lighting.glsl */ vec3 Lighting(vec3 vEyePos, vec3 vPosition, vec3 vNormal, vec3 vLightAmbient, vec3 vLightDiffuse, vec3 vLightSpecular, vec3 vLightDir) { vec3 vViewDir = normalize(vEyePos-vPosition); vec3 vReflection = normalize(reflect(vViewDir, vNormal)); return clamp( vLightAmbient + vLightDiffuse * max(abs(dot(vNormal, vLightDir)),0.0) + vLightSpecular * pow(max(dot(vReflection, vLightDir),0.0),8.0), 0.0,1.0 ); } vec3 Lighting(vec3 vPosition, vec3 vNormal, vec3 vLightAmbient, vec3 vLightDiffuse, vec3 vLightSpecular, vec3 vLightDir) { return Lighting(vec3(0.0,0.0,0.0), vPosition, vNormal, vLightAmbient, vLightDiffuse, vLightSpecular, vLightDir); } ImageVis3D-3.1.0/Tuvok/Shaders/GLGridLeaper-Method-1D-L.glsl0000644000175000017500000000441212320456500022754 0ustar mathieumathieu#version 420 core layout(binding=2) uniform sampler1D transferFunction; uniform float fTransScale; uniform vec3 vLightAmbient; uniform vec3 vLightDiffuse; uniform vec3 vLightSpecular; uniform vec3 vModelSpaceLightDir; uniform vec3 vModelSpaceEyePos; uniform vec3 vDomainScale; float samplePool(vec3 coords); vec3 Lighting(vec3 vEyePos, vec3 vPosition, vec3 vNormal, vec3 vLightAmbient, vec3 vLightDiffuse, vec3 vLightSpecular, vec3 vLightDir); vec3 ComputeNormal(vec3 vCenter, vec3 StepSize, vec3 DomainScale); vec4 ComputeColorFromVolume(vec3 currentPoolCoords, vec3 modelSpacePosition, vec3 sampleDelta) { // fetch volume float data = samplePool(currentPoolCoords); // apply 1D TF vec4 color = texture(transferFunction, data*fTransScale); // compute normal vec3 normal = ComputeNormal(currentPoolCoords, sampleDelta, vDomainScale); // compute lighting vec3 litColor = Lighting(vModelSpaceEyePos, modelSpacePosition, normal, vLightAmbient, color.rgb*vLightDiffuse, vLightSpecular, vModelSpaceLightDir); return vec4(litColor,color.a); } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ImageVis3D-3.1.0/Tuvok/Shaders/GLSBVR-Mesh-2D-light-FS.glsl0000644000175000017500000000744512320456500022422 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : GLSBVR-Mesh-2D-light-FS.glsl //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute uniform sampler2D texTrans; ///< the 2D Transfer function uniform float fTransScale; ///< value scale for 2D Transfer function lookup uniform float fGradientScale; ///< gradient scale for 2D Transfer function lookup uniform float fStepScale; ///< opacity correction quotient uniform vec3 vVoxelStepsize; ///< Stepsize (in texcoord) to get to the next voxel uniform vec3 vLightAmbient; uniform vec3 vLightDiffuse; uniform vec3 vLightSpecular; uniform vec3 vLightAmbientM; uniform vec3 vLightDiffuseM; uniform vec3 vLightSpecularM; uniform vec3 vLightDir; uniform vec3 vDomainScale; varying vec3 vPosition; varying vec3 normal; vec4 sampleVolume(vec3 coords); vec3 ComputeGradient(vec3 vCenter, vec3 StepSize); vec3 Lighting(vec3 vPosition, vec3 vNormal, vec3 vLightAmbient, vec3 vLightDiffuse, vec3 vLightSpecular, vec3 vLightDir); vec4 TraversalOrderDepColor(const vec4 color); void main(void) { if (gl_TexCoord[0].a < 1.5) { // save way of testing for 2 if (normal == vec3(2,2,2)) { gl_FragColor = gl_Color; } else { vec3 vLightColor = Lighting(vPosition, normal, vLightAmbientM*gl_Color.xyz, vLightDiffuseM*gl_Color.xyz, vLightSpecularM, vLightDir); gl_FragColor = vec4(vLightColor.x,vLightColor.y,vLightColor.z,gl_Color.w); } } else { // get volume value float fVolumVal = sampleVolume(gl_TexCoord[0].xyz).x; // compute the gradient vec3 vGradient = ComputeGradient(gl_TexCoord[0].xyz, vVoxelStepsize); float fGradientMag = length(vGradient); // apply 2D transfer function vec4 vTransVal = texture2D(texTrans, vec2(fVolumVal*fTransScale, 1.0-fGradientMag*fGradientScale)); // compute lighting vec3 vNormal = gl_NormalMatrix * (vGradient * vDomainScale); float l = length(vNormal); if (l>0.0) vNormal /= l; // secure normalization vec3 vLightColor = Lighting(vPosition.xyz, vNormal, vLightAmbient, vLightDiffuse*vTransVal.xyz, vLightSpecular, vLightDir); // apply opacity correction vTransVal.a = 1.0 - pow(1.0 - vTransVal.a, fStepScale); // write result to fragment color gl_FragColor = vec4(vLightColor.x, vLightColor.y, vLightColor.z, vTransVal.a); } gl_FragColor = TraversalOrderDepColor(gl_FragColor); } ImageVis3D-3.1.0/Tuvok/Shaders/GLRaycaster-2D-FS.glsl0000644000175000017500000000676712320456500021612 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLRaycaster-2D-FS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ uniform sampler2D texTrans; ///< the 2D Transfer function uniform sampler2D texRayExitPos; ///< the backface (or ray exit point) texture in eyecoords uniform float fTransScale; ///< value scale for 2D Transfer function lookup uniform float fGradientScale; ///< gradient scale for 2D Transfer function lookup uniform float fStepScale; ///< opacity correction quotient uniform vec3 vVoxelStepsize; ///< Stepsize (in texcoord) to get to the next voxel uniform vec2 vScreensize; ///< the size of the screen in pixels uniform float fRayStepsize; ///< stepsize along the ray varying vec3 vEyePos; vec4 sampleVolume(vec3 coords); vec4 UnderCompositing(vec4 src, vec4 dst); vec3 ComputeGradient(vec3 vCenter, vec3 StepSize); void main(void) { // compute the coordinates to look up the previous pass vec2 vFragCoords = vec2(gl_FragCoord.x / vScreensize.x , gl_FragCoord.y / vScreensize.y); // compute the ray parameters vec3 vRayEntry = texture2D(texRayExitPos, vFragCoords).xyz; vec3 vRayExit = vEyePos; vec3 vRayEntryTex = (gl_TextureMatrix[0] * vec4(vRayEntry,1.0)).xyz; vec3 vRayExitTex = (gl_TextureMatrix[0] * vec4(vRayExit,1.0)).xyz; float fRayLength = length(vRayExit - vRayEntry); // compute the maximum number of steps before the domain is left int iStepCount = int(fRayLength/fRayStepsize)+1; vec3 vRayIncTex = (vRayExitTex-vRayEntryTex)/(fRayLength/fRayStepsize); // do the actual raycasting vec4 vColor = vec4(0.0,0.0,0.0,0.0); vec3 vCurrentPosTex = vRayEntryTex; for (int i = 0;i= 0.99) break; } gl_FragColor = vColor; } ImageVis3D-3.1.0/Tuvok/Shaders/Volume2D-nearest.glsl0000644000175000017500000000535712320456500021747 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Volume2D.glsl \author Jens Krueger DFKI Saarbrcken & SCI Institute, University of Utah \version 1.0 \date May 2010 */ uniform sampler2D texSlice0; uniform sampler2D texSlice1; uniform sampler2D texSlice2; vec4 sampleVolume(vec3 coords) { if((1.0-coords.z) > 0.5) { //return v0; return texture2D(texSlice0, coords.xy); } else { //return v1; return texture2D(texSlice1, coords.xy); } } vec3 ComputeGradient(vec3 vCenter, vec3 StepSize) { float fVolumValXp = sampleVolume(vCenter+vec3(+StepSize.x,0,0)).x; float fVolumValXm = sampleVolume(vCenter+vec3(-StepSize.x,0,0)).x; float fVolumValYp = sampleVolume(vCenter+vec3(0,-StepSize.y,0)).x; float fVolumValYm = sampleVolume(vCenter+vec3(0,+StepSize.y,0)).x; float t = vCenter.z; float fVolumValZ = (1.0-t) * texture2D(texSlice0, vCenter.xy).x + t * texture2D(texSlice1, vCenter.xy).x; float fVolumValZp = (1.0-t) * texture2D(texSlice1, vCenter.xy).x + t * texture2D(texSlice2, vCenter.xy).x; return (gl_TextureMatrix[0] * vec4((fVolumValXm - fVolumValXp)/2.0, (fVolumValYp - fVolumValYm)/2.0, (fVolumValZ - fVolumValZp)*1.0,1.0)).xyz; } vec3 ComputeNormal(vec3 vCenter, vec3 StepSize, vec3 DomainScale) { vec3 vGradient = ComputeGradient(vCenter, StepSize); vec3 vNormal = gl_NormalMatrix * (vGradient * DomainScale); float l = length(vNormal); if (l>0.0) vNormal /= l; // safe normalization return vNormal; } ImageVis3D-3.1.0/Tuvok/Shaders/BBox-FS.glsl0000644000175000017500000000262512320456500020006 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file BBox-FS.glsl \author Jens Krueger SCI Institute University of Utah \date June 2010 */ void main(void) { gl_FragColor = gl_Color; } ImageVis3D-3.1.0/Tuvok/Shaders/Compose-FS.glsl0000644000175000017500000000560612320456500020563 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Compose-FS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ uniform sampler2D texRayHitPos; ///< the hitposition of the ray (alpha flags hit yes/no) uniform sampler2D texRayHitNormal; ///< the surface normal at the hit position uniform vec3 vLightAmbient; uniform vec3 vLightDiffuse; uniform vec3 vLightSpecular; uniform vec3 vLightDir; uniform vec2 vScreensize; ///< the size of the screen in pixels uniform vec2 vProjParam; ///< X = far / (far - near) / Y = (far * near / (near - far)) vec3 Lighting(vec3 vPosition, vec3 vNormal, vec3 vLightAmbient, vec3 vLightDiffuse, vec3 vLightSpecular) { vNormal.z = abs(vNormal.z); vec3 vViewDir = normalize(vec3(0.0,0.0,0.0)-vPosition); vec3 vReflection = normalize(reflect(vViewDir, vNormal)); return clamp(vLightAmbient+ vLightDiffuse*max(abs(dot(vNormal, -vLightDir)),0.0)+ vLightSpecular*pow(max(dot(vReflection, vLightDir),0.0),8.0), 0.0,1.0); } void main(void){ // compute the coordinates to look up the previous pass vec2 vFragCoords = vec2(gl_FragCoord.x / vScreensize.x , gl_FragCoord.y / vScreensize.y); // get hitposition and check if a isosurface hit for this ray was found vec4 vPosition = texture2D(texRayHitPos, vFragCoords); if (vPosition.a == 0.0) discard; // get hit normal vec3 vNormal = texture2D(texRayHitNormal, vFragCoords).xyz; gl_FragColor = vec4(Lighting(vPosition.xyz, vNormal, vLightAmbient, vLightDiffuse, vLightSpecular),1.0); // compute non linear depth from linear eye depth float normZ = vProjParam.x + (vProjParam.y / -vPosition.z); gl_FragDepth = normZ; }ImageVis3D-3.1.0/Tuvok/Shaders/GLSBVR-2D-FS.glsl0000644000175000017500000000464012320456500020415 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLSBVR-2D-FS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ vec4 sampleVolume(vec3 coords); vec3 ComputeGradient(vec3 vCenter, vec3 StepSize); vec4 TraversalOrderDepColor(const vec4 color); uniform sampler2D texTrans; ///< the 2D Transfer function uniform float fTransScale; ///< value scale for 2D Transfer function lookup uniform float fGradientScale; ///< gradient scale for 2D Transfer function lookup uniform float fStepScale; ///< opacity correction quotient uniform vec3 vVoxelStepsize; ///< Stepsize (in texcoord) to get to the next voxel void main(void) { // get volume value float fVolumVal = sampleVolume( gl_TexCoord[0].xyz).x; // compute the gradient vec3 vGradient = ComputeGradient(gl_TexCoord[0].xyz, vVoxelStepsize); float fGradientMag = length(vGradient); // apply 2D transfer function vec4 vTransVal = texture2D(texTrans, vec2(fVolumVal*fTransScale, 1.0-fGradientMag*fGradientScale)); // apply opacity correction vTransVal.a = 1.0 - pow(1.0 - vTransVal.a, fStepScale); // pre-multiplication of alpha, if needed. gl_FragColor = TraversalOrderDepColor(vTransVal); } ImageVis3D-3.1.0/Tuvok/Shaders/Transfer-VS.glsl0000644000175000017500000000274212320456500020760 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Transfer-VS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ void main(void) { gl_Position = vec4(gl_Vertex.xy,0.5,1.0); gl_TexCoord[0] = gl_MultiTexCoord0; }ImageVis3D-3.1.0/Tuvok/Shaders/1D-slice-FS.glsl0000644000175000017500000000341012320456500020506 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file 1D-slice-FS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ vec4 sampleVolume(vec3 coords); uniform sampler1D texTrans; ///< the 1D Transfer function uniform float fTransScale; ///< scale for 1D Transfer function lookup vec4 VRender1D(const vec3 pos); void main(void) { float fVolumVal = sampleVolume(gl_TexCoord[0].xyz).x; gl_FragColor = texture1D(texTrans, fVolumVal*fTransScale); gl_FragColor.rgb *= gl_FragColor.a; gl_FragColor.a = 1.0; } ImageVis3D-3.1.0/Tuvok/Shaders/GLSBVR-Mesh-2D-FS.glsl0000644000175000017500000000640512320456500021310 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : GLSBVR-Mesh-2D-FS.glsl //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute uniform sampler2D texTrans; ///< the 2D Transfer function uniform float fTransScale; ///< value scale for 2D Transfer function lookup uniform float fGradientScale; ///< gradient scale for 2D Transfer function lookup uniform float fStepScale; ///< opacity correction quotient uniform vec3 vVoxelStepsize; ///< Stepsize (in texcoord) to get to the next voxel uniform vec3 vLightAmbientM; uniform vec3 vLightDiffuseM; uniform vec3 vLightSpecularM; uniform vec3 vLightDir; varying vec3 vPosition; varying vec3 normal; vec4 sampleVolume(vec3 coords); vec3 ComputeGradient(vec3 vCenter, vec3 StepSize); vec3 Lighting(vec3 vPosition, vec3 vNormal, vec3 vLightAmbient, vec3 vLightDiffuse, vec3 vLightSpecular, vec3 vLightDir); vec4 TraversalOrderDepColor(const vec4 color); void main(void) { if (gl_TexCoord[0].a < 1.5) { // save way of testing for 2 if (normal == vec3(2,2,2)) { gl_FragColor = gl_Color; } else { vec3 vLightColor = Lighting(vPosition, normal, vLightAmbientM*gl_Color.xyz, vLightDiffuseM*gl_Color.xyz, vLightSpecularM, vLightDir); gl_FragColor = vec4(vLightColor.x,vLightColor.y,vLightColor.z,gl_Color.w); } } else { // get volume value float fVolumVal = sampleVolume(gl_TexCoord[0].xyz).x; // compute the gradient vec3 vGradient = ComputeGradient(gl_TexCoord[0].xyz, vVoxelStepsize); float fGradientMag = length(vGradient); // apply 2D transfer function vec4 vTransVal = texture2D(texTrans, vec2(fVolumVal*fTransScale, 1.0-fGradientMag*fGradientScale)); // apply opacity correction vTransVal.a = 1.0 - pow(1.0 - vTransVal.a, fStepScale); // write result to fragment color gl_FragColor = vTransVal; } gl_FragColor = TraversalOrderDepColor(gl_FragColor); } ImageVis3D-3.1.0/Tuvok/Shaders/GLGridLeaper-Method-2D.glsl0000644000175000017500000000353112320456500022565 0ustar mathieumathieu#version 420 core layout(binding=2) uniform sampler2D transferFunction; uniform float fTransScale; uniform float fGradientScale; float samplePool(vec3 coords); vec3 ComputeGradient(vec3 vCenter, vec3 sampleDelta); vec4 ComputeColorFromVolume(vec3 currentPoolCoords, vec3 modelSpacePosition, vec3 sampleDelta) { // fetch volume float data = samplePool(currentPoolCoords); // compute the gradient vec3 vGradient = ComputeGradient(currentPoolCoords, sampleDelta); float fGradientMag = length(vGradient); // apply 2D transfer function return texture(transferFunction, vec2(data*fTransScale, 1.0-fGradientMag*fGradientScale)); } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ImageVis3D-3.1.0/Tuvok/Shaders/VRender1DProxy.glsl0000644000175000017500000000451712320456500021444 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief Proxy function to provide a unified interface over the VRender functions. 'VRender1D' takes different parameters depending on whether or not we are using the 'bias + scale' version or the version that assumes ranges based on bit widths. This version calls the appropriate one based on a runtime setting. */ uniform int ScaleMethod; uniform float TFuncBias; ///< bias for 1D TFqn lookup uniform float fTransScale; ///< scale for 1D Transfer function lookup uniform float fStepScale; ///< opacity correction quotient vec4 VRender1D_BitWidth(const vec3 tex_pos, in float scale, in float opac); vec4 VRender1D_BiasScale(const vec3 tex_pos, in float scale, in float bias, in float opac); vec4 VRender1D(const vec3 tex_pos) { if(0 == ScaleMethod) { // default / normal operation. return VRender1D_BitWidth(tex_pos, fTransScale, fStepScale); } else if(1 == ScaleMethod) { // bias and scale method return VRender1D_BiasScale(tex_pos, fTransScale, TFuncBias, fStepScale); } // error case: make things red. return vec4(1.0, 0.0, 0.0, 0.01); } ImageVis3D-3.1.0/Tuvok/Shaders/SlicesIn3D.glsl0000644000175000017500000000273412320456500020547 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file SlicesIn3D.glsl \author Jens Krueger SCI Institute University of Utah \date May 2009 */ void main(void) { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; gl_TexCoord[0] = gl_MultiTexCoord0; } ImageVis3D-3.1.0/Tuvok/Shaders/Volume3D.glsl0000644000175000017500000000456212320456500020306 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Volume3D.glsl \author Jens Krueger DFKI Saarbrcken & SCI Institute, University of Utah \version 1.0 \date May 2010 */ uniform sampler3D texVolume; ///< the data volume vec4 sampleVolume(vec3 coords) { return texture3D(texVolume, coords); } vec3 ComputeGradient(vec3 vCenter, vec3 StepSize) { float fVolumValXp = sampleVolume(vCenter+vec3(+StepSize.x,0,0)).x; float fVolumValXm = sampleVolume(vCenter+vec3(-StepSize.x,0,0)).x; float fVolumValYp = sampleVolume(vCenter+vec3(0,-StepSize.y,0)).x; float fVolumValYm = sampleVolume(vCenter+vec3(0,+StepSize.y,0)).x; float fVolumValZp = sampleVolume(vCenter+vec3(0,0,+StepSize.z)).x; float fVolumValZm = sampleVolume(vCenter+vec3(0,0,-StepSize.z)).x; return vec3(fVolumValXm - fVolumValXp, fVolumValYp - fVolumValYm, fVolumValZm - fVolumValZp) / 2.0; } vec3 ComputeNormal(vec3 vCenter, vec3 StepSize, vec3 DomainScale) { vec3 vGradient = ComputeGradient(vCenter, StepSize); vec3 vNormal = gl_NormalMatrix * (vGradient * DomainScale); float l = length(vNormal); if (l>0.0) vNormal /= l; // safe normalization return vNormal; } ImageVis3D-3.1.0/Tuvok/Shaders/GLSBVR-1D-light-FS.glsl0000644000175000017500000000650712320456500021525 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLSBVR-1D-light-FS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ uniform float fTransScale; ///< scale for 1D Transfer function lookup uniform float fStepScale; ///< opacity correction quotient uniform vec3 vVoxelStepsize; ///< Stepsize (in texcoord) to get to the next voxel uniform vec3 vDomainScale; uniform vec3 vLightAmbient; uniform vec3 vLightDiffuse; uniform vec3 vLightSpecular; uniform vec3 vLightDir; varying vec3 vPosition; #ifdef BIAS_SCALE uniform float TFuncBias; ///< bias amount for transfer func vec4 VRender1DLit(const vec3 tex_pos, in float tf_scale, in float tf_bias, in float opacity_correction, const vec3 voxel_step_size, const vec3 domain_scale, const vec3 position, const vec3 l_ambient, const vec3 l_diffuse, const vec3 l_specular, const vec3 l_direction); #else vec4 VRender1DLit(const vec3 tex_pos, in float tf_scale, in float opacity_correction, const vec3 voxel_step_size, const vec3 domain_scale, const vec3 position, const vec3 l_ambient, const vec3 l_diffuse, const vec3 l_specular, const vec3 l_direction); #endif vec4 TraversalOrderDepColor(const vec4 color); void main(void) { #if defined(BIAS_SCALE) gl_FragColor = VRender1DLit( gl_TexCoord[0].xyz, fTransScale, TFuncBias, fStepScale, vVoxelStepsize, vDomainScale, vPosition.xyz, vLightAmbient, vLightDiffuse, vLightSpecular, vLightDir ); #else gl_FragColor = VRender1DLit( gl_TexCoord[0].xyz, fTransScale, fStepScale, vVoxelStepsize, vDomainScale, vPosition.xyz, vLightAmbient, vLightDiffuse, vLightSpecular, vLightDir ); #endif // pre-multiplication of alpha, if needed. gl_FragColor = TraversalOrderDepColor(gl_FragColor); } ImageVis3D-3.1.0/Tuvok/Shaders/BTF.glsl0000644000175000017500000000300112320456500017246 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : FTB.glsl //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute vec4 TraversalOrderDepColor(const vec4 color) { return color; } ImageVis3D-3.1.0/Tuvok/Shaders/Transfer-FS.glsl0000644000175000017500000000307312320456500020736 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Transfer-FS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ uniform sampler2D texColor; uniform sampler2D texDepth; void main(void){ gl_FragColor = texture2D(texColor, gl_TexCoord[0].xy); gl_FragDepth = texture2D(texDepth, gl_TexCoord[0].xy).r; }ImageVis3D-3.1.0/Tuvok/Shaders/GLRaycasterNoTransform-VS.glsl0000644000175000017500000000307012320456500023540 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLRaycasterNoTransform-VS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ varying vec3 vEyePos; void main(void) { gl_Position = gl_Vertex; vec4 near = (gl_ProjectionMatrix * vec4(gl_Vertex.x,gl_Vertex.y,-1,1)); vEyePos = near.xyz/near.w; }ImageVis3D-3.1.0/Tuvok/Shaders/BBox-VS.glsl0000644000175000017500000000275112320456500020026 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file BBox-VS.glsl \author Jens Krueger SCI Institute University of Utah \date June 2010 */ void main(void) { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; gl_Position.z += 0.001; gl_FrontColor = gl_Color; }ImageVis3D-3.1.0/Tuvok/Shaders/GLRaycaster-1D-light-FS.glsl0000644000175000017500000001155412320456500022704 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLRaycaster-1D-light-FS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ uniform sampler2D texRayExit; ///< the backface (or ray exit point) texture in texcoords uniform sampler2D texRayExitPos; ///< the backface (or ray exit point) texture in eyecoords uniform float fTransScale; ///< scale for 1D Transfer function lookup uniform float fStepScale; ///< opacity correction quotient uniform vec3 vVoxelStepsize; ///< Stepsize (in texcoord) to get to the next voxel uniform vec2 vScreensize; ///< the size of the screen in pixels uniform float fRayStepsize; ///< stepsize along the ray uniform vec3 vLightAmbient; uniform vec3 vLightDiffuse; uniform vec3 vLightSpecular; uniform vec3 vLightDir; uniform vec3 vDomainScale; varying vec3 vEyePos; #ifdef BIAS_SCALE uniform float TFuncBias; ///< bias amount for transfer func vec4 VRender1DLit(const vec3 tex_pos, in float tf_scale, in float tf_bias, in float opacity_correction, const vec3 voxel_step_size, const vec3 domain_scale, const vec3 position, const vec3 l_ambient, const vec3 l_diffuse, const vec3 l_specular, const vec3 l_direction); #else vec4 VRender1DLit(const vec3 tex_pos, in float tf_scale, in float opacity_correction, const vec3 voxel_step_size, const vec3 domain_scale, const vec3 position, const vec3 l_ambient, const vec3 l_diffuse, const vec3 l_specular, const vec3 l_direction); #endif vec4 sampleVolume(vec3 coords); vec4 UnderCompositing(vec4 src, vec4 dst); void main(void) { // compute the coordinates to look up the previous pass vec2 vFragCoords = vec2(gl_FragCoord.x / vScreensize.x , gl_FragCoord.y / vScreensize.y); // compute the ray parameters vec3 vRayEntry = texture2D(texRayExitPos, vFragCoords).xyz; vec3 vRayExit = vEyePos; vec3 vRayEntryTex = (gl_TextureMatrix[0] * vec4(vRayEntry,1.0)).xyz; vec3 vRayExitTex = (gl_TextureMatrix[0] * vec4(vRayExit,1.0)).xyz; vec3 vRayDir = vRayExit - vRayEntry; float fRayLength = length(vRayDir); vRayDir /= fRayLength; // compute the maximum number of steps before the domain is left int iStepCount = int(fRayLength/fRayStepsize)+1; vec3 fRayInc = vRayDir*fRayStepsize; vec3 vRayIncTex = (vRayExitTex-vRayEntryTex)/(fRayLength/fRayStepsize); // do the actual raycasting vec4 vColor = vec4(0.0,0.0,0.0,0.0); vec3 vCurrentPosTex = vRayEntryTex; vec3 vCurrentPos = vRayEntry; for (int i = 0;i= 0.99) break; } gl_FragColor = vColor; } ImageVis3D-3.1.0/Tuvok/Shaders/GLGridLeaper-frontfaces-FS.glsl0000644000175000017500000000266612320456500023552 0ustar mathieumathieu#version 420 core in vec3 vPosInViewCoords; uniform mat4x4 mEyeToModel; void main() { gl_FragColor = vec4((mEyeToModel * vec4(vPosInViewCoords.x, vPosInViewCoords.y, vPosInViewCoords.z, 1.0)).xyz, vPosInViewCoords.z); } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ImageVis3D-3.1.0/Tuvok/Shaders/RefineIsosurface.glsl0000644000175000017500000000360512320456500022101 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : RefineIsosurface.glsl //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : Dec. 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute vec4 sampleVolume(vec3 coords); vec3 RefineIsosurface(in vec3 vRayDir, inout vec3 vCurrentPos, in float fIsoval) { vRayDir /= 2.0; vCurrentPos -= vRayDir; for (int i = 0; i < 5; i++) { vRayDir /= 2.0; float voxel = sampleVolume( vCurrentPos).x; if (voxel >= fIsoval) { vCurrentPos -= vRayDir; } else { vCurrentPos += vRayDir; } } return vCurrentPos; } ImageVis3D-3.1.0/Tuvok/Shaders/GLGridLeaper-iso.glsl0000644000175000017500000001742612320456500021704 0ustar mathieumathieu#version 420 core // get ray start points & color layout(binding=0) uniform sampler2D rayStartPoint; layout(binding=1) uniform sampler2D rayStartNormal; // 2 is unused // 3 is volume pool metadata (inside volume pool) // 4 is volume pool (inside volume pool) // 5 is hastable (inside hash table) // 6 is unused // 7 is hastable for working set tracking (inside hash table) // get pixel coordinates layout(pixel_center_integer) in vec4 gl_FragCoord; // volume and view parameter uniform float sampleRateModifier; uniform mat4x4 mEyeToModel; uniform mat4x4 mModelToEye; uniform mat4x4 mModelViewIT; // import VolumePool functions bool GetBrick(in vec3 normEntryCoords, inout uint iLOD, in vec3 direction, out vec3 poolEntryCoords, out vec3 poolExitCoords, out vec3 normExitCoords, out bool bEmpty, out vec3 normToPoolScale, out vec3 normToPoolTrans, out uvec4 brickCoords); vec3 TransformToPoolSpace(in vec3 direction, in float sampleRateModifier); vec3 GetSampleDelta(); uint ComputeLOD(float dist); // import Compositing functions vec4 UnderCompositing(vec4 src, vec4 dst); // helper functions -> may be better of in an external file void OpacityCorrectColor(float opacity_correction, inout vec4 color) { color.a = 1.0 - pow(1.0 - color.a, opacity_correction); } // data from vertex stage in vec3 vPosInViewCoords; // outputs into render targets layout(location=0) out vec4 rayHitPos; layout(location=1) out vec4 rayHitNormal; layout(location=2) out vec4 rayResumePos; layout(location=3) out vec4 rayResumeNormal; #ifdef DEBUG layout(location=3) out vec4 debugFBO; #endif // layout (depth_greater) out float gl_FragDepth; void TerminateRay(bool bOptimalResolution) { if (bOptimalResolution) { rayResumePos.w = (rayHitPos.a == 0) ? 1000.0 : 499+rayHitPos.a; } rayResumeNormal = rayHitNormal; } bool GetVolumeHit(vec3 currentPoolCoords, out vec4 color); vec3 GetVolumeNormal(vec3 currentPoolCoords, vec3 sampleDelta); vec3 RefineIsosurface(in vec3 vRayDir, in vec3 vCurrentPos); // go void main() { // read ray parameters and start color ivec2 screenpos = ivec2(gl_FragCoord.xy); // fetch ray entry from texture and get ray exit point from vs-shader rayResumePos = texelFetch(rayStartPoint, screenpos,0); rayHitPos = vec4(0.0); rayHitNormal = vec4(0.0); // if the ray has terminated without finding an // isosurface already, exit early if (floor(rayResumePos.w) == 1000) return; // if the ray has terminated already finding an // isosurface, copy and exit early if (floor(rayResumePos.w) == 500) { rayHitPos = mModelToEye * vec4(rayResumePos.xyz, 1.0); rayHitPos.a = rayResumePos.w-floor(rayResumePos.w)+1.0; rayHitNormal = texelFetch(rayStartNormal, screenpos,0); rayResumeNormal = rayHitNormal; return; } vec4 exitParam = vec4((mEyeToModel * vec4(vPosInViewCoords.x, vPosInViewCoords.y, vPosInViewCoords.z, 1.0)).xyz, vPosInViewCoords.z); // for clarity, separate postions from depth (stored in w) vec3 normEntryPos = rayResumePos.xyz; float entryDepth = rayResumePos.w; vec3 normExitCoords = exitParam.xyz; float exitDepth = exitParam.w; // compute ray direction vec3 direction = normExitCoords-normEntryPos; float rayLength = length(direction); vec3 voxelSpaceDirection = TransformToPoolSpace(direction, sampleRateModifier); vec3 sampleDelta = GetSampleDelta(); float stepSize = length(voxelSpaceDirection); // iterate over the bricks along the ray float t = 0; bool bOptimalResolution = true; float voxelSize = 0.125/2000.; // TODO make this a quater of one voxel (or smaller) vec3 currentPos = normEntryPos; // fetch brick coords at the current position with the // correct resolution. if that brick is not present the // call returns false and the coords to a lower resolution brick vec3 poolEntryCoords; vec3 poolExitCoords; vec3 normBrickExitCoords; bool bEmpty; uvec4 brickCoords; uvec4 lastBrickCoords = uvec4(0,0,0,9999); if (rayLength > voxelSize) { for(uint j = 0;j<100;++j) { // j is just for savety, stop traversal after 100 bricks // compute the current LoD float currentDepth = mix(entryDepth, exitDepth, t); uint iLOD = ComputeLOD(currentDepth); vec3 normToPoolScale; vec3 normToPoolTrans; bool bRequestOK = GetBrick(currentPos, iLOD, direction, poolEntryCoords, poolExitCoords, normBrickExitCoords, bEmpty, normToPoolScale, normToPoolTrans, brickCoords); if (!bRequestOK && bOptimalResolution) { // for the first time in this pass, we got a brick // at lower than requested resolution then record this // position bOptimalResolution = false; rayResumePos = vec4(currentPos, currentDepth); } if (!bEmpty && lastBrickCoords != brickCoords) { // compute the number of steps it takes to // leave the brick int iSteps = int(ceil(length(poolExitCoords-poolEntryCoords)/stepSize)); // or leave the entire voluem (min = whatever comes first) iSteps = min(iSteps, int(ceil(length((normExitCoords-currentPos)*normToPoolScale)/stepSize))); // now raycast through this brick vec3 currentPoolCoords = poolEntryCoords; for (int i=0;i 0.9999) { TerminateRay(bOptimalResolution); return; } } } TerminateRay(bOptimalResolution); } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ImageVis3D-3.1.0/Tuvok/Shaders/GLGridLeaper-Method-1D-color.glsl0000644000175000017500000000313312320456500023676 0ustar mathieumathieu#version 420 core layout(binding=2) uniform sampler1D transferFunction; uniform float fTransScale; vec4 samplePool4(vec3 coords); vec4 ComputeColorFromVolume(vec3 currentPoolCoords, vec3 modelSpacePosition, vec3 sampleDelta) { // fetch volume vec4 data = samplePool4(currentPoolCoords); // apply 1D TF data.a = texture(transferFunction, data.a*fTransScale).a; return data; } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ImageVis3D-3.1.0/Tuvok/Shaders/GLGridLeaper-Method-1D-L-color.glsl0000644000175000017500000000452012320456500024070 0ustar mathieumathieu#version 420 core layout(binding=2) uniform sampler1D transferFunction; uniform float fTransScale; uniform vec3 vLightAmbient; uniform vec3 vLightDiffuse; uniform vec3 vLightSpecular; uniform vec3 vModelSpaceLightDir; uniform vec3 vModelSpaceEyePos; uniform vec3 vDomainScale; vec4 samplePool4(vec3 coords); vec3 Lighting(vec3 vEyePos, vec3 vPosition, vec3 vNormal, vec3 vLightAmbient, vec3 vLightDiffuse, vec3 vLightSpecular, vec3 vLightDir); vec3 ComputeNormal(vec3 vCenter, vec3 StepSize, vec3 DomainScale); vec3 ComputeAlphaNormal(vec3 vCenter, vec3 StepSize, vec3 DomainScale); vec4 ComputeColorFromVolume(vec3 currentPoolCoords, vec3 modelSpacePosition, vec3 sampleDelta) { // fetch volume vec4 data = samplePool4(currentPoolCoords); // apply 1D TF data.a = texture(transferFunction, data.a*fTransScale).a; // compute normal vec3 normal = ComputeNormal(currentPoolCoords, sampleDelta, vDomainScale); // compute lighting vec3 litColor = Lighting(vModelSpaceEyePos, modelSpacePosition, normal, vLightAmbient, data.rgb*vLightDiffuse, vLightSpecular, vModelSpaceLightDir); return vec4(litColor,data.a); } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ImageVis3D-3.1.0/Tuvok/Shaders/GLSBVR-Mesh-1D-FS.glsl0000644000175000017500000000507312320456500021307 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : GLSBVR-Mesh-1D-FS.glsl //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute uniform vec3 vLightAmbientM; uniform vec3 vLightDiffuseM; uniform vec3 vLightSpecularM; uniform vec3 vLightDir; varying vec3 vPosition; varying vec3 normal; uniform float fTransScale; ///< scale for 1D Transfer function lookup uniform float fStepScale; ///< opacity correction quotient vec3 Lighting(vec3 vPosition, vec3 vNormal, vec3 vLightAmbient, vec3 vLightDiffuse, vec3 vLightSpecular, vec3 vLightDir); vec4 VRender1D(const vec3 tex_pos); vec4 TraversalOrderDepColor(const vec4 color); void main(void) { if (gl_TexCoord[0].a < 1.5) { // save way of testing for 2 if (normal == vec3(2,2,2)) { gl_FragColor = gl_Color; } else { vec3 vLightColor = Lighting(vPosition, normal, vLightAmbientM*gl_Color.xyz, vLightDiffuseM*gl_Color.xyz, vLightSpecularM, vLightDir); gl_FragColor = vec4(vLightColor.x,vLightColor.y,vLightColor.z,gl_Color.w); } } else { gl_FragColor = VRender1D(gl_TexCoord[0].xyz); } // pre-multiplication of alpha, if needed. gl_FragColor = TraversalOrderDepColor(gl_FragColor); } ImageVis3D-3.1.0/Tuvok/Shaders/GLGridLeaper-Method-2D-L.glsl0000644000175000017500000000474712320456500022770 0ustar mathieumathieu#version 420 core layout(binding=2) uniform sampler2D transferFunction; uniform float fTransScale; uniform float fGradientScale; uniform vec3 vLightAmbient; uniform vec3 vLightDiffuse; uniform vec3 vLightSpecular; uniform vec3 vModelSpaceLightDir; uniform vec3 vModelSpaceEyePos; uniform vec3 vDomainScale; float samplePool(vec3 coords); vec3 ComputeGradient(vec3 vCenter, vec3 sampleDelta); vec3 Lighting(vec3 vEyePos, vec3 vPosition, vec3 vNormal, vec3 vLightAmbient, vec3 vLightDiffuse, vec3 vLightSpecular, vec3 vLightDir); vec4 ComputeColorFromVolume(vec3 currentPoolCoords, vec3 modelSpacePosition, vec3 sampleDelta) { // fetch volume float data = samplePool(currentPoolCoords); // compute the gradient vec3 vGradient = ComputeGradient(currentPoolCoords, sampleDelta); float fGradientMag = length(vGradient); // apply 2D transfer function vec4 color = texture(transferFunction, vec2(data*fTransScale, 1.0-fGradientMag*fGradientScale)); // compute normal vec3 normal = vDomainScale * ((fGradientMag > 0) ? vGradient/fGradientMag : vGradient); // compute lighting vec3 litColor = Lighting(vModelSpaceEyePos, modelSpacePosition, normal, vLightAmbient, color.rgb*vLightDiffuse, vLightSpecular, vModelSpaceLightDir); return vec4(litColor,color.a); } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ImageVis3D-3.1.0/Tuvok/Shaders/Compose-SBS-FS.glsl0000644000175000017500000000353512320456500021207 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : Compose-SBS-FS.glsl //! Author : Jens Krueger //! IVDA, MMCI, DFKI Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 IVDA, MMC, DFKI, SCI Institute uniform sampler2D texRightEye; uniform sampler2D texLeftEye; uniform float fSplitCoord; void main(void) { if (gl_TexCoord[0].x < fSplitCoord) gl_FragColor = texture2D(texLeftEye, vec2(gl_TexCoord[0].x*2.0,gl_TexCoord[0].y)); else gl_FragColor = texture2D(texRightEye, vec2((gl_TexCoord[0].x-fSplitCoord)*2.0,gl_TexCoord[0].y)); } ImageVis3D-3.1.0/Tuvok/Shaders/GLSBVR-VS.glsl0000644000175000017500000000303212320456500020164 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLSBVR-VS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ varying vec3 vPosition; void main(void) { gl_Position = gl_ProjectionMatrix * gl_Vertex; gl_TexCoord[0] = gl_MultiTexCoord0; vPosition = gl_Vertex.xyz; }ImageVis3D-3.1.0/Tuvok/Shaders/GLGridLeaper-Method-2D-color.glsl0000644000175000017500000000361212320456500023701 0ustar mathieumathieu#version 420 core layout(binding=2) uniform sampler2D transferFunction; uniform float fTransScale; uniform float fGradientScale; vec4 samplePool4(vec3 coords); vec3 ComputeGradientAlpha(vec3 vCenter, vec3 sampleDelta); vec4 ComputeColorFromVolume(vec3 currentPoolCoords, vec3 modelSpacePosition, vec3 sampleDelta) { // fetch volume vec4 data = samplePool4(currentPoolCoords); // compute the gradient vec3 vGradient = ComputeGradientAlpha(currentPoolCoords, sampleDelta); float fGradientMag = length(vGradient); // Apply 2D TF data.a = texture(transferFunction, vec2(data.a*fTransScale, 1.0-fGradientMag*fGradientScale)).a; // apply 2D transfer function return data; } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ImageVis3D-3.1.0/Tuvok/Shaders/VRender1DLit-BScale.glsl0000644000175000017500000000544712320456500022205 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \author Tom Fogal University of Utah \brief Function for performing "standard" volume rendering. */ uniform sampler1D texTrans; ///< the 1D Transfer function vec4 sampleVolume(vec3); vec3 ComputeNormal(vec3 vCenter, vec3 StepSize, vec3 DomainScale); vec3 Lighting(vec3 vPosition, vec3 vNormal, vec3 vLightAmbient, vec3 vLightDiffuse, vec3 vLightSpecular, vec3 vLightDir); /* bias and scale method for mapping a TF to a value. */ vec4 bias_scale(const vec3 tex_pos, const float bias, const float scale) { float vol_val = sampleVolume(tex_pos).x; vol_val = (vol_val + bias) / scale; return texture1D(texTrans, vol_val); } /* Basic volume rendering w/ lighting */ vec4 VRender1DLit(const vec3 tex_pos, in float tf_scale, in float tf_bias, in float opacity_correction, const vec3 voxel_step_size, const vec3 domain_scale, const vec3 position, const vec3 l_ambient, const vec3 l_diffuse, const vec3 l_specular, const vec3 l_direction) { vec4 lut_v = bias_scale(tex_pos, tf_bias, tf_scale); // compute gradient vec3 normal = ComputeNormal(tex_pos, voxel_step_size, domain_scale); vec3 light_color = Lighting(position, normal, l_ambient, l_diffuse * lut_v.xyz, l_specular, l_direction); // opacity correction lut_v.a = 1.0 - pow(1.0 - lut_v.a, opacity_correction); return vec4(light_color.x, light_color.y, light_color.z, lut_v.a); } ImageVis3D-3.1.0/Tuvok/Shaders/GLRaycaster-MIP-Rot-FS.glsl0000644000175000017500000000545012320456500022520 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLRaycaster-MIP-Rot-FS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date December 2008 */ vec4 sampleVolume(vec3 coords); uniform sampler2D texRayExitPos; ///< the backface (or ray exit point) texture in eyecoords uniform vec3 vVoxelStepsize; ///< Stepsize (in texcoord) to get to the next voxel uniform float fRayStepsize; ///< stepsize along the ray uniform vec2 vScreensize; ///< the size of the screen in pixel varying vec3 vEyePos; void main(void) { // compute the coordinates to look up the previous pass vec2 vFragCoords = vec2(gl_FragCoord.x / vScreensize.x , gl_FragCoord.y / vScreensize.y); // compute the ray parameters vec3 vRayEntry = texture2D(texRayExitPos, vFragCoords).xyz; vec3 vRayExit = vEyePos; vec3 vRayEntryTex = (gl_TextureMatrix[0] * vec4(vRayEntry,1.0)).xyz; vec3 vRayExitTex = (gl_TextureMatrix[0] * vec4(vRayExit,1.0)).xyz; float fRayLength = length(vRayExit - vRayEntry); float fRayLengthTex = length(vRayExitTex - vRayEntryTex); // compute the maximum number of steps before the domain is left int iStepCount = int(fRayLength/fRayStepsize)+1; vec3 vRayIncTex = (vRayExitTex-vRayEntryTex)/(fRayLength/fRayStepsize); // do the actual raycasting float fMaxVal = 0.0; vec3 vCurrentPosTex = vRayEntryTex; for (int i = 0;i0.0) vNormal /= l; // secure normalization vec3 vLightColor = Lighting(vCurrentPos, vNormal, vLightAmbient, vLightDiffuse*vTransVal.xyz, vLightSpecular, vLightDir); /// apply opacity correction vTransVal.a = 1.0 - pow(1.0 - vTransVal.a, fStepScale); vTransVal = clamp(vec4(vLightColor.x, vLightColor.y, vLightColor.z, vTransVal.a),0.0,1.0); vColor = UnderCompositing(vTransVal,vColor); vCurrentPos += fRayInc; vCurrentPosTex += vRayIncTex; if (vColor.a >= 0.99) break; } gl_FragColor = vColor; } ImageVis3D-3.1.0/Tuvok/Shaders/GLRaycaster-frontfaces-FS.glsl0000644000175000017500000000273212320456500023463 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLRaycaster-frontfaces-FS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date November 2008 */ varying vec3 vEyePos; void main(void) { gl_FragColor = vec4(vEyePos,1); }ImageVis3D-3.1.0/Tuvok/Shaders/VRender1DLit-Color.glsl0000644000175000017500000000472212320456500022125 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \author Tom Fogal University of Utah \brief Performs volume rendering w/o applying a transfer function */ uniform sampler1D texTrans; ///< the 1D Transfer function vec4 sampleVolume(vec3); vec3 ComputeNormal(vec3 vCenter, vec3 StepSize, vec3 DomainScale); vec3 Lighting(vec3 vPosition, vec3 vNormal, vec3 vLightAmbient, vec3 vLightDiffuse, vec3 vLightSpecular, vec3 vLightDir); vec4 VRender1DLit(const vec3 tex_pos, in float tf_scale, in float opacity_correction, const vec3 voxel_step_size, const vec3 domain_scale, const vec3 position, const vec3 l_ambient, const vec3 l_diffuse, const vec3 l_specular, const vec3 l_direction) { vec4 v = sampleVolume(tex_pos); v = v * texture1D(texTrans, (v.r+v.g+v.b)/3.0); v.a = 1.0 - pow(1.0 - v.a, opacity_correction); // opacity correction vec3 normal = ComputeNormal(tex_pos, voxel_step_size, domain_scale); vec3 light_color = Lighting(position, normal, l_ambient, l_diffuse * v.xyz, l_specular, l_direction); return vec4(light_color.x, light_color.y, light_color.z, v.a); } ImageVis3D-3.1.0/Tuvok/Shaders/FTB.glsl0000644000175000017500000000314612320456500017260 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : FTB.glsl //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute vec4 TraversalOrderDepColor(const vec4 color) { return vec4(color.r*color.a, color.g*color.a, color.b*color.a, color.a); } ImageVis3D-3.1.0/Tuvok/Shaders/GLRaycaster-1D-FS.glsl0000644000175000017500000000557312320456500021603 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLRaycaster-1D-FS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ uniform sampler2D texRayExitPos; ///< the backface (or ray exit point) texture in eyecoords uniform float fTransScale; ///< scale for 1D Transfer function lookup uniform float fStepScale; ///< opacity correction quotient uniform vec2 vScreensize; ///< the size of the screen in pixels uniform float fRayStepsize; ///< stepsize along the ray varying vec3 vEyePos; vec4 VRender1D(const vec3 tex_pos); vec4 sampleVolume(vec3 coords); vec4 UnderCompositing(vec4 src, vec4 dst); void main(void) { // compute the coordinates to look up the previous pass vec2 vFragCoords = vec2(gl_FragCoord.x / vScreensize.x , gl_FragCoord.y / vScreensize.y); // compute the ray parameters vec3 vRayEntry = texture2D(texRayExitPos, vFragCoords).xyz; vec3 vRayExit = vEyePos; vec3 vRayEntryTex = (gl_TextureMatrix[0] * vec4(vRayEntry,1.0)).xyz; vec3 vRayExitTex = (gl_TextureMatrix[0] * vec4(vRayExit,1.0)).xyz; float fRayLength = length(vRayExit - vRayEntry); // compute the maximum number of steps before the domain is left int iStepCount = int(fRayLength/fRayStepsize)+1; vec3 vRayIncTex = (vRayExitTex-vRayEntryTex)/(fRayLength/fRayStepsize); // do the actual raycasting vec4 vColor = vec4(0.0,0.0,0.0,0.0); vec3 vCurrentPosTex = vRayEntryTex; for (int i = 0;i= 0.99) break; vCurrentPosTex += vRayIncTex; } gl_FragColor = vColor; } ImageVis3D-3.1.0/Tuvok/Shaders/GLSBVR-2D-light-FS.glsl0000644000175000017500000000626112320456500021523 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLSBVR-2D-light-FS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ uniform sampler2D texTrans; ///< the 2D Transfer function uniform float fTransScale; ///< value scale for 2D Transfer function lookup uniform float fGradientScale; ///< gradient scale for 2D Transfer function lookup uniform float fStepScale; ///< opacity correction quotient uniform vec3 vVoxelStepsize; ///< Stepsize (in texcoord) to get to the next voxel uniform vec3 vLightAmbient; uniform vec3 vLightSpecular; uniform vec3 vLightDiffuse; uniform vec3 vLightDir; uniform vec3 vDomainScale; varying vec3 vPosition; vec4 sampleVolume(vec3 coords); vec3 ComputeGradient(vec3 vCenter, vec3 StepSize); vec3 Lighting(vec3 vPosition, vec3 vNormal, vec3 vLightAmbient, vec3 vLightDiffuse, vec3 vLightSpecular, vec3 vLightDir); vec4 TraversalOrderDepColor(const vec4 color); void main(void) { // get volume value float fVolumVal = sampleVolume(gl_TexCoord[0].xyz).x; // compute the gradient vec3 vGradient = ComputeGradient(gl_TexCoord[0].xyz, vVoxelStepsize); float fGradientMag = length(vGradient); // apply 2D transfer function vec4 vTransVal = texture2D(texTrans, vec2(fVolumVal*fTransScale, 1.0-fGradientMag*fGradientScale)); // compute lighting vec3 vNormal = gl_NormalMatrix * (vGradient * vDomainScale); float l = length(vNormal); if (l>0.0) vNormal /= l; // secure normalization vec3 vLightColor = Lighting(vPosition.xyz, vNormal, vLightAmbient, vLightDiffuse*vTransVal.xyz, vLightSpecular, vLightDir); // apply opacity correction vTransVal.a = 1.0 - pow(1.0 - vTransVal.a, fStepScale); // write result to fragment color gl_FragColor = vec4(vLightColor.x, vLightColor.y, vLightColor.z, vTransVal.a); // pre-multiplication of alpha, if needed. gl_FragColor = TraversalOrderDepColor(gl_FragColor); } ImageVis3D-3.1.0/Tuvok/Shaders/Mesh-VS.glsl0000644000175000017500000000360712320456500020071 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : Mesh-VS.glsl //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute uniform float fOffset; varying vec3 normal; varying vec4 position; varying vec2 texture_coordinate; void main(void) { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; gl_Position.z -= fOffset; if (gl_Normal == vec3(2,2,2)) { normal = gl_Normal; } else { normal = gl_NormalMatrix * gl_Normal; } texture_coordinate = vec2(gl_MultiTexCoord0); gl_FrontColor = gl_Color; gl_BackColor = gl_Color; position = gl_Vertex; } ImageVis3D-3.1.0/Tuvok/Shaders/GLGridLeaper-VS.glsl0000644000175000017500000000262012320456500021430 0ustar mathieumathieu#version 420 core layout (location=0) in vec3 vertexPosition; uniform mat4x4 mModelViewProjection; void main(void) { gl_Position = mModelViewProjection * vec4(vertexPosition, 1.0); } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ImageVis3D-3.1.0/Tuvok/Shaders/GLGridLeaper-blend.glsl0000644000175000017500000002017712320456500022173 0ustar mathieumathieu#version 420 core // get ray start points & color layout(binding=0) uniform sampler2D rayStartPoint; layout(binding=1) uniform sampler2D rayStartColor; // 2 is transfer function (inside render method shader) // 3 is volume pool metadata (inside volume pool) // 4 is volume pool (inside volume pool) // 5 is hastable (inside hash table) #ifdef DEBUG layout(binding=6) uniform sampler2D debugColor; // 7 is hastable for working set tracking (inside hash table) #endif // get pixel coordinates layout(pixel_center_integer) in vec4 gl_FragCoord; // volume and view parameter uniform float sampleRateModifier; uniform mat4x4 mEyeToModel; // import VolumePool functions bool GetBrick(in vec3 normEntryCoords, inout uint iLOD, in vec3 direction, out vec3 poolEntryCoords, out vec3 poolExitCoords, out vec3 normExitCoords, out bool bEmpty, out vec3 normToPoolScale, out vec3 normToPoolTrans, out uvec4 brickCoords); vec3 TransformToPoolSpace(in vec3 direction, in float sampleRateModifier); vec3 GetSampleDelta(); uint ComputeLOD(float dist); // import Compositing functions vec4 UnderCompositing(vec4 src, vec4 dst); // helper functions -> may be better of in an external file void OpacityCorrectColor(float opacity_correction, inout vec4 color) { color.a = 1.0 - pow(1.0 - color.a, opacity_correction); } // data from vertex stage in vec3 vPosInViewCoords; // outputs into render targets layout(location=0) out vec4 accRayColor; layout(location=1) out vec4 rayResumeColor; layout(location=2) out vec4 rayResumePos; #ifdef DEBUG layout(location=3) out vec4 debugFBO; #endif // layout (depth_greater) out float gl_FragDepth; void TerminateRay(bool bOptimalResolution) { if (bOptimalResolution) { rayResumePos.w = 1000; rayResumeColor = accRayColor; } } vec4 ComputeColorFromVolume(vec3 currentPoolCoords, vec3 modelSpacePosition, vec3 sampleDelta); // go void main() { // read ray parameters and start color ivec2 screenpos = ivec2(gl_FragCoord.xy); accRayColor = texelFetch(rayStartColor, screenpos,0); rayResumeColor = accRayColor; #ifdef DEBUG debugFBO = texelFetch(debugColor, screenpos,0); debugFBO.w = 1; #endif // fetch ray entry from texture and get ray exit point from vs-shader rayResumePos = texelFetch(rayStartPoint, screenpos,0); // if the ray has terminated already, exit early if (rayResumePos.w == 1000) return; vec4 exitParam = vec4((mEyeToModel * vec4(vPosInViewCoords.x, vPosInViewCoords.y, vPosInViewCoords.z, 1.0)).xyz, vPosInViewCoords.z); // for clarity, separate postions from depth (stored in w) vec3 normEntryPos = rayResumePos.xyz; float entryDepth = rayResumePos.w; vec3 normExitCoords = exitParam.xyz; float exitDepth = exitParam.w; // compute ray direction vec3 direction = normExitCoords-normEntryPos; float rayLength = length(direction); vec3 voxelSpaceDirection = TransformToPoolSpace(direction, sampleRateModifier); vec3 sampleDelta = GetSampleDelta(); float stepSize = length(voxelSpaceDirection); // iterate over the bricks along the ray float t = 0; bool bOptimalResolution = true; float voxelSize = 0.125/2000.; // TODO make this a quater of one voxel (or smaller) vec3 currentPos = normEntryPos; // fetch brick coords at the current position with the // correct resolution. if that brick is not present the // call returns false and the coords to a lower resolution brick vec3 poolEntryCoords; vec3 poolExitCoords; vec3 normBrickExitCoords; bool bEmpty; uvec4 brickCoords; uvec4 lastBrickCoords = uvec4(0,0,0,9999); if (rayLength > voxelSize) { for(uint j = 0;j<100;++j) { // j is just for savety, stop traversal after 100 bricks // compute the current LoD float currentDepth = mix(entryDepth, exitDepth, t); uint iLOD = ComputeLOD(currentDepth); vec3 normToPoolScale; vec3 normToPoolTrans; bool bRequestOK = GetBrick(currentPos, iLOD, direction, poolEntryCoords, poolExitCoords, normBrickExitCoords, bEmpty, normToPoolScale, normToPoolTrans, brickCoords); if (!bRequestOK && bOptimalResolution) { // for the first time in this pass, we got a brick // at lower than requested resolution then record this // position bOptimalResolution = false; rayResumePos = vec4(currentPos, currentDepth); rayResumeColor = accRayColor; } if (!bEmpty && lastBrickCoords != brickCoords) { // compute the number of steps it takes to // leave the brick int iSteps = int(ceil(length(poolExitCoords-poolEntryCoords)/stepSize)); // or leave the entire voluem (min = whatever comes first) iSteps = min(iSteps, int(ceil(length((normExitCoords-currentPos)*normToPoolScale)/stepSize))); // compute opacity correction factor //float ocFactor = exp2(float(iLOD)) / sampleRateModifier; float ocFactor = 1.0 / sampleRateModifier; // use the nicer "opacity correction" for now // now raycast through this brick vec3 currentPoolCoords = poolEntryCoords; for (int i=0;i 0.99) { #ifdef DEBUG if (bOptimalResolution) { debugFBO.b = 1; debugFBO.w = 1; } #endif TerminateRay(bOptimalResolution); return; } // advance ray currentPoolCoords += voxelSpaceDirection; #ifdef DEBUG if (bOptimalResolution) { debugFBO.r += 0.0025; debugFBO.w = 1; } #endif } currentPos = (currentPoolCoords-normToPoolTrans)/normToPoolScale; } else { currentPos = normBrickExitCoords+voxelSize*direction/rayLength; } lastBrickCoords = brickCoords; // global position along the ray t = length(normEntryPos-normBrickExitCoords)/rayLength; if (t > 0.9999) { TerminateRay(bOptimalResolution); return; } #ifdef DEBUG if (bEmpty && bOptimalResolution) { debugFBO.g += 0.05; debugFBO.w = 1; } #endif } } TerminateRay(bOptimalResolution); } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ImageVis3D-3.1.0/Tuvok/Shaders/README0000644000175000017500000000405112320456500016636 0ustar mathieumathieuThese shaders can be a bit confusing. This is a quick guide to how this works. The issue we have is that we need to support different functionality based on situations which are not known until runtime. For example, the user could load a scalar field or an RGB[A] field. If they load a scalar field, we want to do volume rendering as normal. For an RGBA field, we want to use the currently-set transfer function to scale the individual channels, but we don't actually want to change the colors. Another example is sampling the volume: if their card supports 3D textures, the problem is simple -- just sample the 3D texture. If it doesn't, we create a set of 2D textures, change them dynamically, and manually interpolate between the slices. This sampling is an irrelevant detail to the code that just does volume rendering. Therefore there are multiple 'sampleVolume' functions, all with the same interface. The 3D version simply calls texture3D as one might expect. The 2D version samples two of the textures and returns an interpolated result between the two of them. The two versions define a function with the same signature. We therefore cannot use both of them at the same time, of course. The C++ code, generally in Renderer/GL/ checks what kind of texture we are using and then chooses one and only one of them to link in to the final program. In this way, 'sampleVolume' is essentially a function which is runtime-dispatched based on the type of textures (2D or 3D) we have available. We need runtime-dispatch for 'VRender1D' as well, but it must work differently. In that case, the signature of the method must change depending on a runtime variable which decides the 'scaling method'. (The short of what's behind the 'scaling method' is that we have a bias+scale method for transforming data values for the case of a client app which does not do the quantization that ImageVis3D does.) For this case, we have a trampoline function (VRender1DProxy.glsl) which just bounces into the appropriate method based on a special uniform we define just for this purpose. ImageVis3D-3.1.0/Tuvok/Shaders/GLRaycaster-ISO-FS.glsl0000644000175000017500000000773212320456500021770 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLRaycaster-ISO-FS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ vec4 sampleVolume(vec3 coords); uniform sampler2D texRayExitPos; ///< the backface (or ray exit point) texture in eyecoords uniform vec3 vVoxelStepsize; ///< Stepsize (in texcoord) to get to the next voxel uniform float fRayStepsize; ///< stepsize along the ray uniform float fIsoval; ///< the isovalue, normalized to be in [0,1] uniform vec2 vScreensize; ///< the size of the screen in pixels uniform vec2 vProjParam; ///< X = far / (far - near) / Y = (far * near / (near - far)) uniform int iTileID; ///< ID of the current tile uniform vec3 vDomainScale; varying vec3 vEyePos; vec3 ComputeNormal(vec3 vHitPosTex, vec3 StepSize, vec3 DomainScale); vec3 RefineIsosurface(in vec3 vRayDir, inout vec3 vCurrentPos, in float fIsoval); void main(void) { // compute the coordinates to look up the previous pass vec2 vFragCoords = vec2(gl_FragCoord.x / vScreensize.x , gl_FragCoord.y / vScreensize.y); // compute the ray parameters vec3 vRayEntry = texture2D(texRayExitPos, vFragCoords).xyz; vec3 vRayExit = vEyePos; vec3 vRayEntryTex = (gl_TextureMatrix[0] * vec4(vRayEntry,1.0)).xyz; vec3 vRayExitTex = (gl_TextureMatrix[0] * vec4(vRayExit,1.0)).xyz; float fRayLength = length(vRayExit - vRayEntry); float fRayLengthTex = length(vRayExitTex - vRayEntryTex); // compute the maximum number of steps before the domain is left int iStepCount = int(fRayLength/fRayStepsize)+1; vec3 vRayIncTex = (vRayExitTex-vRayEntryTex)/(fRayLength/fRayStepsize); // do the actual raycasting vec4 vHitPosTex = vec4(0.0,0.0,0.0,0.0); vec3 vCurrentPosTex = vRayEntryTex; for (int i = 0;i= fIsoval) { vHitPosTex = vec4(vCurrentPosTex.x, vCurrentPosTex.y, vCurrentPosTex.z, 1); break; } vCurrentPosTex += vRayIncTex; } // store surface hit if one is found if (vHitPosTex.a != 0.0) vHitPosTex.xyz = RefineIsosurface(vRayIncTex, vHitPosTex.xyz, fIsoval); else discard; // interpolate eye space position float fInterpolParam = length(vHitPosTex.xyz-vRayEntryTex)/fRayLengthTex; vec3 vHitPos = vRayEntry * (1.0-fInterpolParam) + vRayExit * fInterpolParam; gl_FragData[0] = vec4(vHitPos.xyz,fInterpolParam); // store non-linear depth gl_FragDepth = vProjParam.x + (vProjParam.y / -vHitPos.z); // store normal vec3 vNormal = ComputeNormal(vHitPosTex.xyz, vVoxelStepsize, vDomainScale); gl_FragData[1] = vec4(vNormal,float(iTileID)); } ImageVis3D-3.1.0/Tuvok/Shaders/VRender1D-Color-BScale.glsl0000644000175000017500000000352012320456500022576 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \author Tom Fogal University of Utah \brief Performs volume rendering w/o applying a transfer function */ uniform sampler1D texTrans; ///< the 1D Transfer function vec4 sampleVolume(vec3); // TODO: // do something with scale and bias vec4 VRender1D_BiasScale(const vec3 tex_pos, in float tf_scale, in float tf_bias, in float opacity_correction) { vec4 v = sampleVolume(tex_pos); v = v * texture1D(texTrans, (v.r+v.g+v.b)/3.0); v.a = 1.0 - pow(1.0 - v.a, opacity_correction); // opacity correction return v; } ImageVis3D-3.1.0/Tuvok/Shaders/Compose-Scanline-FS.glsl0000644000175000017500000000337712320456500022320 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Compose-Scanline-FS.glsl \author Jens Krueger DFKI & SCI Institute, University of Utah \version 1.0 \date March 2010 */ uniform sampler2D texRightEye; uniform sampler2D texLeftEye; uniform vec2 vScreensize; ///< the size of the screen in pixels void main(void){ float fLine = floor(gl_TexCoord[0].y * vScreensize.y); if (fLine/2.0 == floor(fLine/2.0)) gl_FragColor = texture2D(texLeftEye, gl_TexCoord[0].xy); else gl_FragColor = texture2D(texRightEye, gl_TexCoord[0].xy); }ImageVis3D-3.1.0/Tuvok/Shaders/GLSBVR-MIP-Rot-FS.glsl0000644000175000017500000000277112320456500021342 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLSBVR-MIP-Rot-FS.glsl \author Jens Krueger SCI Institute University of Utah \version 1.0 \date October 2008 */ vec4 sampleVolume(vec3 coords); void main(void) { gl_FragColor = vec4(sampleVolume( gl_TexCoord[0].xyz).xx,1,1); }ImageVis3D-3.1.0/Tuvok/Shaders/GLGridLeaper-entry-VS.glsl0000644000175000017500000000301312320456500022564 0ustar mathieumathieu#version 420 core layout (location=0) in vec3 vertexPosition; uniform mat4x4 mModelViewProjection; uniform mat4x4 mModelView; out vec3 vPosInViewCoords; void main(void) { gl_Position = mModelViewProjection * vec4(vertexPosition, 1.0); vPosInViewCoords = (mModelView * vec4(vertexPosition, 1.0)).xyz; } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ImageVis3D-3.1.0/Tuvok/Shaders/Compose-AF-FS.glsl0000644000175000017500000000333612320456500021045 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : Compose-AF-FS.glsl //! Author : Jens Krueger //! IVDA, MMCI, DFKI Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 IVDA, MMC, DFKI, SCI Institute uniform sampler2D texRightEye; uniform sampler2D texLeftEye; uniform int iAlternatingFrameID; void main(void) { if (iAlternatingFrameID == 0) gl_FragColor = texture2D(texLeftEye,gl_TexCoord[0].xy); else gl_FragColor = texture2D(texRightEye,gl_TexCoord[0].xy); } ImageVis3D-3.1.0/Tuvok/Shaders/VRender1DLit-Color-BScale.glsl0000644000175000017500000000504512320456500023253 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \author Tom Fogal University of Utah \brief Performs volume rendering w/o applying a transfer function */ uniform sampler1D texTrans; ///< the 1D Transfer function vec4 sampleVolume(vec3); vec3 ComputeNormal(vec3 vCenter, vec3 StepSize, vec3 DomainScale); vec3 Lighting(vec3 vPosition, vec3 vNormal, vec3 vLightAmbient, vec3 vLightDiffuse, vec3 vLightSpecular, vec3 vLightDir); // TODO: // do something with scale and bias vec4 VRender1DLit(const vec3 tex_pos, in float tf_scale, in float tf_bias, in float opacity_correction, const vec3 voxel_step_size, const vec3 domain_scale, const vec3 position, const vec3 l_ambient, const vec3 l_diffuse, const vec3 l_specular, const vec3 l_direction) { vec4 v = sampleVolume(tex_pos); v = v * texture1D(texTrans, (v.r+v.g+v.b)/3.0); v.a = 1.0 - pow(1.0 - v.a, opacity_correction); // opacity correction vec3 normal = ComputeNormal(tex_pos, voxel_step_size, domain_scale); vec3 light_color = Lighting(position, normal, l_ambient, l_diffuse * v.xyz, l_specular, l_direction); return vec4(light_color.x, light_color.y, light_color.z, v.a); } ImageVis3D-3.1.0/Tuvok/Shaders/VRender1D-BScale.glsl0000644000175000017500000000422512320456500021525 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \author Tom Fogal University of Utah \brief Function for performing "standard" volume rendering. */ uniform sampler1D texTrans; ///< the 1D Transfer function vec4 sampleVolume(vec3); /* bias and scale method for mapping a TF to a value. */ vec4 bias_scale(const vec3 tex_pos, const float bias, const float scale) { float vol_val = sampleVolume(tex_pos).x; vol_val = (vol_val + bias) / scale; return texture1D(texTrans, vol_val); } /* Performs the basic 1D volume rendering; sampling, looking up the value in * the LUT (tfqn), and doing opacity correction. */ vec4 VRender1D_BiasScale(const vec3 tex_pos, in float tf_scale, in float tf_bias, in float opacity_correction) { vec4 lut_v = bias_scale(tex_pos, tf_bias, tf_scale); // apply opacity correction lut_v.a = 1.0 - pow(1.0 - lut_v.a, opacity_correction); return lut_v; } ImageVis3D-3.1.0/Tuvok/Shaders/GLGridLeaper-NearPlane-VS.glsl0000644000175000017500000000300512320456500023271 0ustar mathieumathieu#version 420 core layout (location=0) in vec3 vertexPosition; uniform mat4x4 mInvProjection; out vec3 vPosInViewCoords; void main(void) { gl_Position = vec4(vertexPosition, 1.0); vec4 near = (mInvProjection * vec4(vertexPosition.x,vertexPosition.y,-1,1)); vPosInViewCoords = near.xyz/near.w; } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ImageVis3D-3.1.0/Tuvok/Shaders/GLGridLeaper-Method-2D-L-color.glsl0000644000175000017500000000474012320456500024075 0ustar mathieumathieu#version 420 core layout(binding=2) uniform sampler2D transferFunction; uniform float fTransScale; uniform float fGradientScale; uniform vec3 vLightAmbient; uniform vec3 vLightDiffuse; uniform vec3 vLightSpecular; uniform vec3 vModelSpaceLightDir; uniform vec3 vModelSpaceEyePos; uniform vec3 vDomainScale; vec4 samplePool4(vec3 coords); vec3 ComputeGradientAlpha(vec3 vCenter, vec3 sampleDelta); vec3 Lighting(vec3 vEyePos, vec3 vPosition, vec3 vNormal, vec3 vLightAmbient, vec3 vLightDiffuse, vec3 vLightSpecular, vec3 vLightDir); vec4 ComputeColorFromVolume(vec3 currentPoolCoords, vec3 modelSpacePosition, vec3 sampleDelta) { // fetch volume vec4 data = samplePool4(currentPoolCoords); // compute the gradient vec3 vGradient = ComputeGradientAlpha(currentPoolCoords, sampleDelta); float fGradientMag = length(vGradient); // Apply 2D TF data.a = texture(transferFunction, vec2(data.a*fTransScale, 1.0-fGradientMag*fGradientScale)).a; // compute normal vec3 normal = vDomainScale * ((fGradientMag > 0) ? vGradient/fGradientMag : vGradient); // compute lighting vec3 litColor = Lighting(vModelSpaceEyePos, modelSpacePosition, normal, vLightAmbient, data.rgb*vLightDiffuse, vLightSpecular, vModelSpaceLightDir); return vec4(litColor,data.a); } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ImageVis3D-3.1.0/Tuvok/Shaders/Mesh-FS.glsl0000644000175000017500000000441012320456500020042 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : Mesh-FS.glsl //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute uniform vec3 vLightAmbientM; uniform vec3 vLightDiffuseM; uniform vec3 vLightSpecularM; uniform vec3 vLightDir; vec3 Lighting(vec3 vPosition, vec3 vNormal, vec3 vLightAmbient, vec3 vLightDiffuse, vec3 vLightSpecular, vec3 vLightDir); vec4 TraversalOrderDepColor(const vec4 color); varying vec3 normal; varying vec2 texture_coordinate; varying vec4 position; void main(void) { vec3 pos = position.xyz / position.w; if (normal == vec3(2,2,2)) { gl_FragColor = TraversalOrderDepColor(gl_Color); } else { vec3 vLightColor = Lighting(pos, normal, vLightAmbientM*gl_Color.xyz, vLightDiffuseM*gl_Color.xyz, vLightSpecularM, vLightDir); gl_FragColor = TraversalOrderDepColor(vec4(vLightColor.x,vLightColor.y,vLightColor.z,gl_Color.w)); } } ImageVis3D-3.1.0/Tuvok/Controller/0000755000175000017500000000000012320456500016510 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/Controller/MasterController.cpp0000644000175000017500000004562412320456500022526 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : MasterController.cpp //! Author : Jens Krueger //! SCI Institute //! University of Utah //! Date : September 2008 // //! Copyright (C) 2008 SCI Institute #include #include #include #include "MasterController.h" #include "../Basics/SystemInfo.h" #include "../Basics/SysTools.h" #include "../IO/IOManager.h" #include "../IO/TransferFunction1D.h" #include "../IO/Dataset.h" #include "../IO/AbstrConverter.h" #include "../Renderer/GPUMemMan/GPUMemMan.h" #include "../Renderer/GL/GLRaycaster.h" #include "../Renderer/GL/GLGridLeaper.h" #include "../Renderer/GL/GLSBVR.h" #include "../Renderer/GL/GLSBVR2D.h" #include "../LuaScripting/LuaScripting.h" #include "../LuaScripting/LuaMemberReg.h" #include "../LuaScripting/TuvokSpecific/LuaTuvokTypes.h" #include "../LuaScripting/TuvokSpecific/LuaDatasetProxy.h" #include "../LuaScripting/TuvokSpecific/LuaTransferFun1DProxy.h" #include "../LuaScripting/TuvokSpecific/LuaTransferFun2DProxy.h" #include "../LuaScripting/TuvokSpecific/LuaIOManagerProxy.h" #include "../LuaScripting/TuvokSpecific/MatrixMath.h" using namespace tuvok; MasterController::MasterController() : m_bDeleteDebugOutOnExit(false), m_bExperimentalFeatures(false), m_pLuaScript(new LuaScripting()), m_pMemReg(new LuaMemberReg(m_pLuaScript)), m_pActiveRenderer(NULL) { m_pSystemInfo = new SystemInfo(); m_pIOManager = new IOManager(); m_pGPUMemMan = new GPUMemMan(this); using namespace std::placeholders; std::function f = std::bind(&GPUMemMan::LoadDataset, m_pGPUMemMan, _1, _2); m_pIOManager->SetMemManLoadFunction(f); RegisterLuaCommands(); // Register IO commands. m_pIOProxy = std::unique_ptr( new LuaIOManagerProxy(m_pIOManager, m_pLuaScript)); // TEMPORARY -- Disable the provenance system. LuaScript()->cexec("provenance.enable", false); RState.BStrategy = RendererState::BS_SkipTwoLevels; std::fill(m_Perf, m_Perf+PERF_END, 0.0); } MasterController::~MasterController() { Cleanup(); m_DebugOut.clear(); } void MasterController::Cleanup() { std::for_each(m_vVolumeRenderer.begin(), m_vVolumeRenderer.end(), [](AbstrRenderer* i) { delete i; }); m_vVolumeRenderer.clear(); delete m_pSystemInfo; m_pSystemInfo = NULL; delete m_pIOManager; m_pIOManager = NULL; delete m_pGPUMemMan; m_pGPUMemMan = NULL; m_pActiveRenderer = NULL; } void MasterController::AddDebugOut(AbstrDebugOut* debugOut) { if (debugOut != NULL) { m_DebugOut.Other(_func_, "Disconnecting from this debug out"); m_DebugOut.AddDebugOut(debugOut); debugOut->Other(_func_, "Connected to this debug out"); } else { m_DebugOut.Warning(_func_, "New debug is a NULL pointer, ignoring it."); } } void MasterController::RemoveDebugOut(AbstrDebugOut* debugOut) { m_DebugOut.RemoveDebugOut(debugOut); } /// Access the currently-active debug stream. AbstrDebugOut* MasterController::DebugOut() { return (m_DebugOut.empty()) ? static_cast(&m_DefaultOut) : static_cast(&m_DebugOut); } const AbstrDebugOut *MasterController::DebugOut() const { return (m_DebugOut.empty()) ? static_cast(&m_DefaultOut) : static_cast(&m_DebugOut); } AbstrRenderer* MasterController::RequestNewVolumeRenderer(EVolumeRendererType eRendererType, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder, bool bBiasAndScaleTF) { std::string api; std::string method; AbstrRenderer *retval; switch (eRendererType) { case OPENGL_SBVR : api = "OpenGL"; method = "Slice-Based Volume Renderer"; retval = new GLSBVR(this, bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder); break; case OPENGL_CHOOSE: // we just need to make something up, will fix later case OPENGL_2DSBVR: api = "OpenGL"; method = "Axis-Aligned 2D Slice-Based Volume Renderer"; retval = new GLSBVR2D(this, bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder); break; case OPENGL_RAYCASTER : api = "OpenGL"; method = "Raycaster"; retval = new GLRaycaster(this, bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder); break; case OPENGL_GRIDLEAPER : api = "OpenGL"; method = "Grid Leaper"; retval = new GLGridLeaper(this, bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder); break; case DIRECTX_RAYCASTER : case DIRECTX_2DSBVR : case DIRECTX_SBVR : case DIRECTX_GRIDLEAPER: m_DebugOut.Error(_func_,"DirectX 10 renderer not yet implemented." "Please select OpenGL as the render API " "in the settings dialog."); return NULL; default : m_DebugOut.Error(_func_, "Unsupported Volume renderer requested"); return NULL; }; m_DebugOut.Message(_func_, "Starting up new renderer (API=%s, Method=%s)", api.c_str(), method.c_str()); if(bBiasAndScaleTF) { retval->SetScalingMethod(AbstrRenderer::SMETH_BIAS_AND_SCALE); } m_vVolumeRenderer.push_back(retval); return m_vVolumeRenderer[m_vVolumeRenderer.size()-1]; } void MasterController::ReleaseVolumeRenderer(LuaClassInstance pRenderer) { ReleaseVolumeRenderer(pRenderer.getRawPointer(LuaScript())); } void MasterController::ReleaseVolumeRenderer(AbstrRenderer* pVolumeRenderer) { // Note: Even if this function is called from deleteClass inside lua, it is // still safe to check whether the pointer exists inside of lua. The pointer // in the pointer lookup table is always removed before deletion of the // pointer itself. LuaClassInstance inst; try { inst = LuaScript()->getLuaClassInstance(pVolumeRenderer); } catch (LuaNonExistantClassInstancePointer&) { // Ignore it. This more than likely means we are inside of the class' // destructor. } bool foundRenderer = false; for(auto i = m_vVolumeRenderer.begin(); i != m_vVolumeRenderer.end(); ++i) { if (*i == pVolumeRenderer) { foundRenderer = true; m_DebugOut.Message(_func_, "Removing volume renderer"); m_vVolumeRenderer.erase(i); break; } } // Only warn if we did find the instance in lua, but didn't find it in our // abstract renderer list. if (foundRenderer == false && inst.isValid(LuaScript())) m_DebugOut.Warning(_func_, "requested volume renderer not found"); // Delete the class if it hasn't been already. This covers the case where // the class calls ReleaseVolumeRenderer instead of calling deleteClass. if (inst.isValid(LuaScript())) LuaScript()->cexec("deleteClass", inst); } RenderRegion* MasterController::LuaCreateRenderRegion3D(LuaClassInstance ren) { return new RenderRegion3D(ren.getRawPointer(LuaScript())); } RenderRegion* MasterController::LuaCreateRenderRegion2D( int mode, uint64_t sliceIndex, LuaClassInstance ren) { return new RenderRegion2D(static_cast(mode), sliceIndex, ren.getRawPointer(LuaScript())); } void MasterController::AddLuaRendererType(const std::string& rendererLoc, const std::string& rendererName, int value) { std::ostringstream os; os << rendererLoc << ".types." << rendererName << "=" << value; LuaScript()->exec(os.str()); } void MasterController::SetBrickStrategy(size_t strat) { assert(strat <= RendererState::BS_SkipTwoLevels); // hack this->RState.BStrategy = static_cast(strat); } void MasterController::SetRehashCount(uint32_t n) { this->RState.RehashCount = n; } void MasterController::SetMDUpdateStrategy(unsigned strat) { this->RState.MDUpdateBehavior = strat; } void MasterController::SetHTSize(unsigned size) { this->RState.HashTableSize = size; } size_t MasterController::GetBrickStrategy() const { return static_cast(this->RState.BStrategy); } uint32_t MasterController::GetRehashCount() const { return this->RState.RehashCount; } unsigned MasterController::GetMDUpdateStrategy() const { return static_cast(this->RState.MDUpdateBehavior); } unsigned MasterController::GetHTSize() const { return this->RState.HashTableSize; } double MasterController::PerfQuery(enum PerfCounter pc) { assert(pc < PERF_END); double tmp = m_Perf[pc]; m_Perf[pc] = 0.0; return tmp; } void MasterController::IncrementPerfCounter(enum PerfCounter pc, double amount) { assert(pc < PERF_END); m_Perf[pc] += amount; } void MasterController::SetMaxGPUMem(uint64_t megs) { const uint64_t megabyte = 1024 * 1024; m_pSystemInfo->SetMaxUsableGPUMem(megabyte * megs); m_pGPUMemMan->MemSizesChanged(); } void MasterController::SetMaxCPUMem(uint64_t megs) { const uint64_t megabyte = 1024 * 1024; m_pSystemInfo->SetMaxUsableCPUMem(megabyte * megs); m_pGPUMemMan->MemSizesChanged(); } uint64_t MasterController::GetMaxGPUMem() const { const uint64_t megabyte = 1024 * 1024; return m_pSystemInfo->GetMaxUsableGPUMem() / megabyte; } uint64_t MasterController::GetMaxCPUMem() const { const uint64_t megabyte = 1024 * 1024; return m_pSystemInfo->GetMaxUsableCPUMem() / megabyte; } void register_unsigned(lua_State* lua, const char* name, unsigned value) { lua_pushinteger(lua, value); lua_setglobal(lua, name); } void register_perf_enum(std::shared_ptr& ss) { lua_State* lua = ss->getLuaState(); register_unsigned(lua, "PERF_SUBFRAMES", PERF_SUBFRAMES); register_unsigned(lua, "PERF_RENDER", PERF_RENDER); register_unsigned(lua, "PERF_RAYCAST", PERF_RAYCAST); register_unsigned(lua, "PERF_READ_HTABLE", PERF_READ_HTABLE); register_unsigned(lua, "PERF_CONDENSE_HTABLE", PERF_CONDENSE_HTABLE); register_unsigned(lua, "PERF_SORT_HTABLE", PERF_SORT_HTABLE); register_unsigned(lua, "PERF_UPLOAD_BRICKS", PERF_UPLOAD_BRICKS); register_unsigned(lua, "PERF_POOL_SORT", PERF_POOL_SORT); register_unsigned(lua, "PERF_POOL_UPLOADED_MEM", PERF_POOL_UPLOADED_MEM); register_unsigned(lua, "PERF_POOL_GET_BRICK", PERF_POOL_GET_BRICK); register_unsigned(lua, "PERF_DY_GET_BRICK", PERF_DY_GET_BRICK); register_unsigned(lua, "PERF_DY_CACHE_LOOKUPS", PERF_DY_CACHE_LOOKUPS); register_unsigned(lua, "PERF_DY_CACHE_LOOKUP", PERF_DY_CACHE_LOOKUP); register_unsigned(lua, "PERF_DY_RESERVE_BRICK", PERF_DY_RESERVE_BRICK); register_unsigned(lua, "PERF_DY_LOAD_BRICK", PERF_DY_LOAD_BRICK); register_unsigned(lua, "PERF_DY_CACHE_ADDS", PERF_DY_CACHE_ADDS); register_unsigned(lua, "PERF_DY_CACHE_ADD", PERF_DY_CACHE_ADD); register_unsigned(lua, "PERF_DY_BRICK_COPIED", PERF_DY_BRICK_COPIED); register_unsigned(lua, "PERF_DY_BRICK_COPY", PERF_DY_BRICK_COPY); register_unsigned(lua, "PERF_POOL_UPLOAD_BRICK", PERF_POOL_UPLOAD_BRICK); register_unsigned(lua, "PERF_POOL_UPLOAD_TEXEL", PERF_POOL_UPLOAD_TEXEL); register_unsigned(lua, "PERF_POOL_UPLOAD_METADATA", PERF_POOL_UPLOAD_METADATA); register_unsigned(lua, "PERF_EO_BRICKS", PERF_EO_BRICKS); register_unsigned(lua, "PERF_EO_DISK_READ", PERF_EO_DISK_READ); register_unsigned(lua, "PERF_EO_DECOMPRESSION", PERF_EO_DECOMPRESSION); register_unsigned(lua, "PERF_MM_PRECOMPUTE", PERF_MM_PRECOMPUTE); register_unsigned(lua, "PERF_SOMETHING", PERF_SOMETHING); } void MasterController::RegisterLuaCommands() { std::shared_ptr ss = LuaScript(); // Register volume renderer class. std::string renderer = "tuvok.renderer"; ss->registerClass( this, &MasterController::RequestNewVolumeRenderer, renderer, "Constructs a new renderer. The first parameter is one " "of the values in the tuvok.renderer.types table.", LuaClassRegCallback::Type( AbstrRenderer::RegisterLuaFunctions)); tuvok::Registrar::dataset(ss); // Populate the tuvok.renderer.type table. ss->exec(renderer + ".types = {}"); AddLuaRendererType(renderer, "OpenGL_SBVR", OPENGL_SBVR); AddLuaRendererType(renderer, "OpenGL_2DSBVR", OPENGL_2DSBVR); AddLuaRendererType(renderer, "OpenGL_Raycaster", OPENGL_RAYCASTER); AddLuaRendererType(renderer, "OpenGL_GridLeaper", OPENGL_GRIDLEAPER); AddLuaRendererType(renderer, "DirectX_SBVR", DIRECTX_SBVR); AddLuaRendererType(renderer, "DirectX_2DSBVR", DIRECTX_2DSBVR); AddLuaRendererType(renderer, "DirectX_Raycaster", DIRECTX_RAYCASTER); AddLuaRendererType(renderer, "DirectX_GridLeaper", DIRECTX_GRIDLEAPER); AddLuaRendererType(renderer, "RT_Interactive", AbstrRenderer::RT_INTERACTIVE); AddLuaRendererType(renderer, "RT_Capture", AbstrRenderer::RT_CAPTURE); AddLuaRendererType(renderer, "RT_Headless", AbstrRenderer::RT_HEADLESS); // Register RenderRegion3D. ss->registerClass(this, &MasterController::LuaCreateRenderRegion3D, "tuvok.renderRegion3D", "Constructs a 3D render region.", LuaClassRegCallback::Type( RenderRegion::defineLuaInterface)); // Register RenderRegion2D. ss->registerClass(this, &MasterController::LuaCreateRenderRegion2D, "tuvok.renderRegion2D", "Constructs a 2D render region.", LuaClassRegCallback::Type( RenderRegion::defineLuaInterface)); ss->addParamInfo("tuvok.renderRegion2D.new", 0, "mode", "Specifies viewing axis."); ss->addParamInfo("tuvok.renderRegion2D.new", 1, "sliceIndex", "Index of slice to view."); // Register dataset proxy ss->registerClassStatic( &LuaDatasetProxy::luaConstruct, "tuvok.datasetProxy", "Constructs a dataset proxy.", LuaClassRegCallback::Type( LuaDatasetProxy::defineLuaInterface)); // Register 1D transfer function proxy ss->registerClassStatic( &LuaTransferFun1DProxy::luaConstruct, "tuvok.transferFun1D", "Constructs a 1D transfer function proxy. Construction of these proxies " "should be left to the renderer.", LuaClassRegCallback::Type( LuaTransferFun1DProxy::defineLuaInterface)); // Register 2D transfer function proxy ss->registerClassStatic( &LuaTransferFun2DProxy::luaConstruct, "tuvok.transferFun2D", "Constructs a 2D transfer function proxy. Construction of these proxies " "should be left to the renderer.", LuaClassRegCallback::Type( LuaTransferFun2DProxy::defineLuaInterface)); // register matrix math functions. tuvok::registrar::matrix_math(ss); m_pMemReg->registerFunction(this, &MasterController::SetBrickStrategy, "tuvok.state.brickStrategy", "", false ); m_pMemReg->registerFunction(this, &MasterController::SetRehashCount, "tuvok.state.rehashCount", "", false ); m_pMemReg->registerFunction(this, &MasterController::SetMaxGPUMem, "tuvok.state.gpuMem", "sets a new max amount of GPU memory. In megabytes.", false ); m_pMemReg->registerFunction(this, &MasterController::SetMaxCPUMem, "tuvok.state.cpuMem", "sets a new max amount of CPU memory. In megabytes.", false ); m_pMemReg->registerFunction(this, &MasterController::GetMaxGPUMem, "tuvok.state.getGpuMem", "gets the max amount of GPU memory. In megabytes.", false ); m_pMemReg->registerFunction(this, &MasterController::GetMaxCPUMem, "tuvok.state.getCpuMem", "gets the max amount of CPU memory. In megabytes.", false ); m_pMemReg->registerFunction(this, &MasterController::SetMDUpdateStrategy, "tuvok.state.mdUpdateStrategy", "control the background metadata update " "thread.\n 0: enabled (default)\n 1: async thread does nothing\n 2: " "async thread is never even created.\n 3: skip all metadata computations;" " effectively disables empty space leaping.", false); m_pMemReg->registerFunction(this, &MasterController::SetHTSize, "tuvok.state.hashTableSize", "sets the size of the hash table. Larger " "values give better raw performance; smaller values make the system more " " responsive. default: 509", false); m_pMemReg->registerFunction(this, &MasterController::GetBrickStrategy, "tuvok.state.getBrickStrategy", "", false); m_pMemReg->registerFunction(this, &MasterController::GetRehashCount, "tuvok.state.getRehashCount", "", false); m_pMemReg->registerFunction(this, &MasterController::GetMDUpdateStrategy, "tuvok.state.getMdUpdateStrategy", "", false); m_pMemReg->registerFunction(this, &MasterController::GetHTSize, "tuvok.state.getHashTableSize", "", false); m_pMemReg->registerFunction(this, &MasterController::PerfQuery, "tuvok.perf", "queries performance information. meaning is query-specific.", false ); ss->registerFunction(&SysTools::basename, "basename", "basename for the given filename", false); ss->registerFunction(&SysTools::dirname, "dirname", "dirname for the given filename", false); register_perf_enum(ss); // Register Tuvok specific math functions... LuaMathFunctions::registerMathFunctions(ss); } bool MasterController::ExperimentalFeatures() const { return m_bExperimentalFeatures; } void MasterController::ExperimentalFeatures(bool b) { m_bExperimentalFeatures = b; } ImageVis3D-3.1.0/Tuvok/Controller/Controller.h0000644000175000017500000000612012320456500021003 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2009 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! Author : Tom Fogal //! SCI Institute //! University of Utah //! Date : March 2009 //! //! Copyright (C) 2009 SCI Institute #pragma once #ifndef TUVOK_CONTROLLER_H #define TUVOK_CONTROLLER_H #include "MasterController.h" #include "boost/serialization/singleton.hpp" namespace tuvok { namespace serial = boost::serialization; namespace Controller { inline MasterController& Instance() { return serial::singleton::get_mutable_instance(); } inline const MasterController& ConstInstance() { return serial::singleton::get_const_instance(); } inline const MasterController& Const() { // alias for the above return serial::singleton::get_const_instance(); } namespace Debug { inline AbstrDebugOut& Out() { return *(Controller::Instance().DebugOut()); } inline const AbstrDebugOut& ConstOut() { return *(Controller::ConstInstance().DebugOut()); } }; }} #define T_ERROR(...) \ do { \ tuvok::Controller::Debug::Out().Error(_func_, __VA_ARGS__); \ } while(0) #define WARNING(...) \ do { \ tuvok::Controller::Debug::Out().Warning(_func_, __VA_ARGS__); \ } while(0) #define MESSAGE(...) \ do { \ tuvok::Controller::Debug::Out().Message(_func_, __VA_ARGS__); \ } while(0) #define OTHER(...) \ do { \ tuvok::Controller::Debug::Out().Other(_func_, __VA_ARGS__); \ } while(0) #endif // TUVOK_CONTROLLER_H ImageVis3D-3.1.0/Tuvok/Controller/StackTimer.h0000644000175000017500000000423212320456500020730 0ustar mathieumathieu#ifndef TUVOK_STACK_TIMER_H #define TUVOK_STACK_TIMER_H #include "Basics/PerfCounter.h" #include "Basics/Timer.h" #include "Controller.h" namespace tuvok { /// Simple mechanism for timing blocks of code. Create a StackTimer on /// the stack and it will record timing information when it goes out of /// scope. For example: /// /// if(doLongComplicatedTask) { /// StackTimer task_identifier(PERF_DISK_READ); /// this->Function(); /// } struct StackTimer { StackTimer(enum PerfCounter pc) : counter(pc) { timer.Start(); } ~StackTimer() { Controller::Instance().IncrementPerfCounter(counter, timer.Elapsed()); } enum PerfCounter counter; Timer timer; }; } /// For short blocks, it may be easier to use this macro: /// /// TimedStatement(PERF_DISK_READ, this->Function()); #define TimedStatement(pc, block) \ do { \ tuvok::StackTimer _generic_timer(pc); \ block; \ } while(0) #endif /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2013 IVDA Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/Controller/MasterController.h0000644000175000017500000001652512320456500022171 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifndef TUVOK_MASTERCONTROLLER_H #define TUVOK_MASTERCONTROLLER_H #include "../StdTuvokDefines.h" #include #include #include #include #include #include "Basics/PerfCounter.h" #include "Basics/Vectors.h" #include "../DebugOut/MultiplexOut.h" #include "../DebugOut/ConsoleOut.h" #include "LuaScripting/LuaClassInstance.h" class SystemInfo; class IOManager; namespace tuvok { class AbstrRenderer; class GPUMemMan; class LuaScripting; class LuaMemberReg; class LuaIOManagerProxy; class RenderRegion; typedef std::deque AbstrRendererList; struct RendererState { enum BrickStrategy { BS_OnlyNeeded=0, BS_RequestAll, BS_SkipOneLevel, BS_SkipTwoLevels }; BrickStrategy BStrategy; uint32_t RehashCount; unsigned MDUpdateBehavior; unsigned HashTableSize; RendererState() : BStrategy(BS_RequestAll), RehashCount(10), MDUpdateBehavior(0), HashTableSize(509) {} }; /** \class MasterController * Centralized controller for Tuvok. * * MasterController is a router for all of the components of * Tuvok. We try to keep modules communicating through this controller, * as opposed to directly with other modules. * You probably don't want to create an instance directly. Use the singleton * provided by Controller::Instance(). */ class MasterController : public PerfQueryable { public: enum EVolumeRendererType { OPENGL_SBVR = 0, OPENGL_RAYCASTER, DIRECTX_SBVR, DIRECTX_RAYCASTER, OPENGL_2DSBVR, DIRECTX_2DSBVR, OPENGL_GRIDLEAPER, DIRECTX_GRIDLEAPER, OPENGL_CHOOSE, ///< let the system choose for the user RENDERER_LAST, }; /// Defaults to using a Console-based debug output stream. MasterController(); virtual ~MasterController(); /// Deallocate any memory we're holding; rendering or doing any real work is /// undefined after this operation. void Cleanup(); /// Lua scripting engine. ///@{ std::shared_ptr LuaScript() { return m_pLuaScript; } ///@} /// Add another debug output /// \param debugOut the new stream void AddDebugOut(AbstrDebugOut* debugOut); /// Removes the given debug output stream. /// The stream must be the currently connected/used one. void RemoveDebugOut(AbstrDebugOut* debugOut); /// Access the currently-active debug stream. ///@{ AbstrDebugOut* DebugOut(); const AbstrDebugOut *DebugOut() const; ///@} /// The GPU memory manager moves data from CPU to GPU memory, and /// removes data from GPU memory. ///@{ GPUMemMan* MemMan() { return m_pGPUMemMan; } const GPUMemMan* MemMan() const { return m_pGPUMemMan; } ///@} /// The IO manager is responsible for loading data into host memory. ///@{ IOManager* IOMan() { return m_pIOManager;} const IOManager& IOMan() const { return *m_pIOManager;} ///@} /// System information is for looking up host parameters, such as the /// amount of memory available. ///@{ SystemInfo* SysInfo() { return m_pSystemInfo; } const SystemInfo& SysInfo() const { return *m_pSystemInfo; } ///@} /// Whether or not to expose certain features which aren't actually ready for /// users. bool ExperimentalFeatures() const; void ExperimentalFeatures(bool b); /// Indicate that a renderer is no longer needed. /// This is now called from Abstract renderer's destructor. /// All LuaClassInstances should be destroyed with the destroyClass lua call. /// @{ void ReleaseVolumeRenderer(AbstrRenderer* pVolumeRenderer); void ReleaseVolumeRenderer(LuaClassInstance pVolumeRenderer); /// @} void SetMaxGPUMem(uint64_t megs); void SetMaxCPUMem(uint64_t megs); /// return max mem in megabyte uint64_t GetMaxGPUMem() const; uint64_t GetMaxCPUMem() const; /// centralized storage for renderer parameters ///@{ void SetBrickStrategy(size_t strat); void SetRehashCount(uint32_t count); void SetMDUpdateStrategy(unsigned); ///< takes DM_* enum void SetHTSize(unsigned); ///< hash table size size_t GetBrickStrategy() const; uint32_t GetRehashCount() const; unsigned GetMDUpdateStrategy() const; unsigned GetHTSize() const; RendererState RState; ///@} /// Performance query interface. Each id is a separate performance metric. /// @warning Querying a metric resets it! double PerfQuery(enum PerfCounter); void IncrementPerfCounter(enum PerfCounter, double amount); private: /// Initializer; add all our builtin commands. void RegisterLuaCommands(); RenderRegion* LuaCreateRenderRegion3D(LuaClassInstance ren); RenderRegion* LuaCreateRenderRegion2D(int mode, // RenderRegion::EWindowMode uint64_t sliceIndex, LuaClassInstance ren); /// Helper function for RegisterLuaCommands. Helps in setting up the renderer /// types table in tuvok.renderer. void AddLuaRendererType(const std::string& rendererLoc, const std::string& rendererName, int value); //-------------- // Lua commands //-------------- /// Creates a new volume renderer. /// Used as a constructor function for Lua classes. AbstrRenderer* RequestNewVolumeRenderer(EVolumeRendererType eRendererType, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder, bool bBiasAndScaleTF); private: SystemInfo* m_pSystemInfo; GPUMemMan* m_pGPUMemMan; IOManager* m_pIOManager; MultiplexOut m_DebugOut; ConsoleOut m_DefaultOut; bool m_bDeleteDebugOutOnExit; bool m_bExperimentalFeatures; std::shared_ptr m_pLuaScript; std::unique_ptr m_pMemReg; std::unique_ptr m_pIOProxy; AbstrRendererList m_vVolumeRenderer; // The active renderer should point into a member of the renderer list. AbstrRenderer* m_pActiveRenderer; /// for PerfCounter tracking. double m_Perf[PERF_END]; }; } #endif // TUVOK_MASTERCONTROLLER_H ImageVis3D-3.1.0/Tuvok/Tuvok.vcxproj.filters0000644000175000017500000026563112320456500020576 0ustar mathieumathieu {9bff2b39-0d9e-415b-abf7-c5bf835d8128} {e014a01f-a848-4ece-9abc-5be11189a3b2} {320c9a95-e96a-4670-9bd1-d9d07b9c87c1} {06a6a28c-7006-4467-ad6e-ac4d8ae3d5ee} {75821063-4f81-48b9-9ac8-894457ffa65b} {841ffddb-757d-4f22-820c-e6bcb66cb3f4} {8145980f-8833-494b-ae5c-cd2a83926d6f} {48baf25f-8030-468c-9b3f-27f3f74cf2d4} {5112d8a5-5258-4c61-9601-540752636dd0} {2d5b7469-4161-4d79-9625-f2cefaf8f07b} {f70a3ed3-48e2-476b-a303-25b0a4d5d6e2} {b343b944-618f-4fd3-ade7-088d96f5bc13} {8caa5966-59f7-4d73-a237-0d8dd5df1a95} {86e74cef-71bd-463b-8bfa-ef85694721ee} {2560de00-0c50-4830-b15a-4cc5183f67ac} {8ff196d7-9e8b-4123-ad7c-9a37978172a9} {e9e91d52-9d81-449d-93bb-9b1315983cbb} {e75796d8-c7e3-4a45-98ac-49a6c7828f72} {5bfecb6d-53fe-44aa-9c13-e49d58a762a2} {2f915819-6d19-4e8e-be37-516700d417ec} {8e402825-af76-455c-8b1d-75d1c83c706a} {5cc49d15-4c8b-45cc-8f5f-9b4c37b0f39c} {544845f0-8dde-415b-a39b-517452f51645} {5aaa2a4c-0a76-45ea-ac14-ceab259954c4} {61403f19-546a-47ea-98cf-53eab8be6999} {3edf3d9a-31da-4c57-9aea-909ab8d60451} {ba09eabc-65fa-4a96-a8af-c8aeb15ddc63} {47493534-2cc1-42b2-acf9-b746d07f3237} {de778f2f-80af-4be8-bc99-ba0de8c94f53} {008b546a-d825-4a8b-bf21-a2d52a2c718b} {b027d86a-f794-477a-8320-dec268444e48} {45b9a6dd-a5b4-4973-9eb8-da3ef9371218} {106b191d-bc8b-4785-9610-6320a9c070fe} {8aa5eec1-bd38-44ed-a2dd-309c6961ef7c} {1e4cc322-e18f-4a8d-b2c8-1fcd1b0e6e47} {5cc872bb-81d0-4e04-b08d-aceaf76ab364} {ac830070-fb1d-49ef-8a74-e988a6000f11} {c1103421-38e0-4390-b8a5-bbc892417c77} {5d62b647-22a5-486f-a9ba-53f204ad07d6} {0000d4dc-9766-44b7-9d82-9db287ca24b0} {b9f713b0-87f3-4ccf-96c7-fb4cc8035fd9} {f742fb6f-4164-45f5-8a98-c2867ea81931} Basics Basics Basics Basics Basics Basics Basics Basics Basics Basics Basics Basics Basics\Systeminfo Basics\Systeminfo Basics\Checksums Basics\Mesh Basics\Mesh Renderer Renderer Renderer Renderer Renderer\MemMan Renderer\MemMan Renderer\MemMan\GL Renderer\MemMan\GL Renderer\MemMan\GL Renderer\MemMan\GL Renderer\MemMan\GL Renderer\MemMan\GL Renderer\MemMan\GL Renderer\MemMan\GL Renderer\MemMan\GL Renderer\MemMan\GL Renderer\MemMan\DX Renderer\MemMan\DX Renderer\MemMan\DX Renderer\MemMan\DX Renderer\GL Renderer\GL Renderer\GL Renderer\GL Renderer\GL Renderer\GL Renderer\DX Renderer\DX Renderer\DX Renderer\Capturing Renderer\Geometry Generators Renderer\Geometry Generators Renderer\Geometry Generators DebugOut DebugOut DebugOut DebugOut 3rd Party\GLEW\GL IO IO IO IO IO IO IO IO IO IO IO IO IO\DICOM IO\Images IO\UVF IO\UVF IO\UVF IO\UVF IO\UVF IO\UVF IO\UVF IO\UVF IO\UVF IO\UVF IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\bzip2 IO\bzip2 IO\bzip2 IO\bzip2 IO\bzip2 IO\bzip2 IO\bzip2 IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter\Helper IO\Volume Converter\Helper IO\Volume Converter\Helper IO\Geometry Converter IO\Geometry Converter IO\Geometry Converter IO\Geometry Converter IO\Geometry Converter IO\Geometry Converter IO\Geometry Converter IO\expressions IO\expressions IO\expressions IO\expressions IO\expressions IO\expressions IO\expressions Controller Renderer IO\Images IO\Geometry Converter Renderer\MemMan\GL IO\UVF\ExtendedOctree IO\UVF\ExtendedOctree IO\UVF IO\Volume Converter 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA Renderer Renderer\GL LuaScripting LuaScripting LuaScripting LuaScripting LuaScripting LuaScripting LuaScripting LuaScripting LuaScripting\TuvokSpecific Renderer IO\UVF\ExtendedOctree IO Renderer\GL Renderer\GL IO\TTIFFWriter LuaScripting\TuvokSpecific IO LuaScripting\TuvokSpecific Basics Basics LuaScripting\TuvokSpecific Renderer Basics IO\Volume Converter Renderer\GL Renderer\GL LuaScripting\TuvokSpecific IO\lzma IO\lzma IO\lzma IO\UVF\ExtendedOctree IO\UVF\ExtendedOctree IO\UVF\ExtendedOctree IO\lz4 IO\lz4 IO\UVF\ExtendedOctree IO\UVF\ExtendedOctree IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO IO\Geometry Converter IO IO LuaScripting\TuvokSpecific Basics Basics Basics Basics Basics Basics Basics Basics Basics Basics Basics Basics Basics Basics Basics Basics Basics Basics\Checksums Basics\Checksums Basics\Mesh Basics\Mesh Basics\Mesh Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Basics\3rdParty\tclap Renderer Renderer Renderer Renderer Renderer Renderer Renderer\MemMan Renderer\MemMan Renderer\MemMan\GL Renderer\MemMan\GL Renderer\MemMan\GL Renderer\MemMan\GL Renderer\MemMan\GL Renderer\MemMan\GL Renderer\MemMan\GL Renderer\MemMan\GL Renderer\MemMan\GL Renderer\MemMan\GL Renderer\MemMan\GL Renderer\MemMan\GL Renderer\MemMan\DX Renderer\MemMan\DX Renderer\MemMan\DX Renderer\MemMan\DX Renderer\MemMan\DX Renderer\MemMan\API Independent Renderer\GL Renderer\GL Renderer\GL Renderer\GL Renderer\GL Renderer\GL Renderer\GL Renderer\DX Renderer\DX Renderer\DX Renderer\Capturing Renderer\Capturing Renderer\Geometry Generators Renderer\Geometry Generators Renderer\Geometry Generators DebugOut DebugOut DebugOut DebugOut 3rd Party\GLEW\GL 3rd Party\GLEW\GL 3rd Party\GLEW\GL 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost 3rd Party\boost IO IO IO IO IO IO IO IO IO IO IO IO IO IO IO IO IO\DICOM IO\Images IO\UVF IO\UVF IO\UVF IO\UVF IO\UVF IO\UVF IO\UVF IO\UVF IO\UVF IO\UVF IO\UVF IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\jpeglib IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\TIFF IO\bzip2 IO\bzip2 IO\zlib IO\zlib IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter IO\Volume Converter\Helper IO\Volume Converter\Helper IO\Volume Converter\Helper IO\Geometry Converter IO\Geometry Converter IO\Geometry Converter IO\Geometry Converter IO\Geometry Converter IO\Geometry Converter IO\Geometry Converter IO\expressions IO\expressions IO\expressions IO\expressions IO\expressions IO\expressions IO\expressions IO\expressions IO\expressions IO\expressions Controller Controller Renderer Renderer\GL Renderer\GL Renderer\DX Renderer IO\Images Basics IO\Geometry Converter Renderer\MemMan\GL IO\UVF\ExtendedOctree IO\UVF\ExtendedOctree IO\UVF IO\Volume Converter 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA 3rd Party\LUA Renderer Renderer\GL LuaScripting LuaScripting LuaScripting LuaScripting LuaScripting LuaScripting LuaScripting LuaScripting LuaScripting LuaScripting LuaScripting\TuvokSpecific LuaScripting\TuvokSpecific IO\UVF\ExtendedOctree IO Renderer\GL Renderer\GL IO\TTIFFWriter LuaScripting\TuvokSpecific IO LuaScripting\TuvokSpecific Basics Basics Basics LuaScripting\TuvokSpecific Renderer Basics IO\Volume Converter Renderer\GL Renderer\GL Basics IO\UVF\ExtendedOctree IO\UVF\ExtendedOctree IO\lzma IO\lzma IO\lzma IO\lzma IO\lzma IO\lzma IO\UVF\ExtendedOctree IO\UVF\ExtendedOctree IO\UVF\ExtendedOctree IO\lz4 IO\lz4 IO\UVF\ExtendedOctree IO\UVF\ExtendedOctree IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lzham IO\lz4 IO\lzham IO IO\Geometry Converter IO IO LuaScripting\TuvokSpecific Basics Basics Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders IO\UVF\ExtendedOctree Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders Shaders ImageVis3D-3.1.0/Tuvok/IO/0000755000175000017500000000000012320456500014674 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/IO/.gitignore0000644000175000017500000000005012320456500016657 0ustar mathieumathieuMakefile Build *.gcda *.gcno .gitignore ImageVis3D-3.1.0/Tuvok/IO/DICOM/0000755000175000017500000000000012320456500015527 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/IO/DICOM/DICOMParser.cpp0000644000175000017500000012166012320456500020251 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DICOMParser.cpp \author Jens Krueger SCI Institute University of Utah \version 1.2 \date September 2008 */ #include #include #include #include #include "DICOMParser.h" #include #include #ifdef DEBUG_DICOM #define DICOM_DBG(...) Console::printf(__VA_ARGS__) #include #else #define DICOM_DBG(...) #endif #ifdef DEBUG_DICOM #include #endif using namespace boost; std::string DICOM_TypeStrings[28] = { "AE", // Application Entity string 16 bytes maximum "AS", // Age String string 4 bytes fixed "AT", // Attribute Tag string 4 bytes fixed "CS", // Code String string 16 bytes maximum "DA", // Date string 8 bytes fixed "DS", // Decimal String string 16 bytes maximum "DT", // Date Time string 26 bytes maximum "FL", // Floating Point Single binary 4 bytes fixed "FD", // Floating Point Double binary 8 bytes fixed "IS", // Integer String string 12 bytes maximum "LO", // Long String string 64 chars maximum "LT", // Long Text string 1024 chars maximum "OB", // Other Byte "OW", // Other Word "OF", // Other Float "PN", // Person Name string 64 chars maximum "SH", // Short String string 16 chars maximum "SL", // Signed Long binary 4 bytes fixed "SQ", // Sequence of Items - - "SS", // Signed Short binary 2 bytes fixed "ST", // Short Text string 1024 chars maximum "TM", // Time string 16 bytes maximum "UI", // Unique Identifier (UID) string 64 bytes maximum "UL", // Unsigned Long binary 4 bytes fixed "US", // Unsigned Short binary 2 bytes fixed "UT", // Unlimited Text string 232-2 "UN", // Unknown "Implicit" }; using namespace std; DICOMParser::DICOMParser(void) { } DICOMParser::~DICOMParser(void) { } bool StacksSmaller ( FileStackInfo* pElem1, FileStackInfo* pElem2 ) { DICOMStackInfo* elem1 = (DICOMStackInfo*)pElem1; DICOMStackInfo* elem2 = (DICOMStackInfo*)pElem2; return elem1->m_iSeries < elem2->m_iSeries; } void DICOMParser::GetDirInfo(string strDirectory) { vector files = SysTools::GetDirContents(strDirectory); vector fileInfos; // query directory for DICOM files for (size_t i = 0;iMatch(&fileInfos[i])) { MESSAGE("found match at %u(%s), dropping %u(%s) out.", static_cast(j), m_FileStacks[j]->m_strDesc.c_str(), static_cast(i), fileInfos[i].m_strDesc.c_str()); bFoundMatch = true; break; } } if (!bFoundMatch) { DICOMStackInfo* newStack = new DICOMStackInfo(&fileInfos[i]); m_FileStacks.push_back(newStack); } } // sort stacks by sequence number sort( m_FileStacks.begin( ), m_FileStacks.end( ), StacksSmaller ); // fix Z aspect ratio - which is broken in many DICOMs - using the patient position for (size_t i = 0; im_Elements.size() < 2) continue; float fZDistance = fabs(((SimpleDICOMFileInfo*)m_FileStacks[i]->m_Elements[1])->m_fvPatientPosition.z - ((SimpleDICOMFileInfo*)m_FileStacks[i]->m_Elements[0])->m_fvPatientPosition.z); if (fZDistance != 0) m_FileStacks[i]->m_fvfAspect.z = fZDistance; } } void DICOMParser::GetDirInfo(wstring wstrDirectory) { string strDirectory(wstrDirectory.begin(), wstrDirectory.end()); GetDirInfo(strDirectory); } void DICOMParser::ReadHeaderElemStart(ifstream& fileDICOM, short& iGroupID, short& iElementID, DICOM_eType& eElementType, uint32_t& iElemLength, bool bImplicit, bool bNeedsEndianConversion) { string typeString = " "; fileDICOM.read((char*)&iGroupID,2); fileDICOM.read((char*)&iElementID,2); if (iGroupID == 0x2) { // ignore input for meta block bImplicit = false; bNeedsEndianConversion = EndianConvert::IsBigEndian(); } if (bNeedsEndianConversion) { iGroupID = EndianConvert::Swap(iGroupID); iElementID = EndianConvert::Swap(iElementID); } if (bImplicit) { eElementType = TYPE_Implicit; fileDICOM.read((char*)&iElemLength,4); if (bNeedsEndianConversion) iElemLength = EndianConvert::Swap(iElemLength); DICOM_DBG("Reader read implict field iGroupID=%i, iElementID=%i, iElemLength=%i\n", int(iGroupID), int(iElementID), iElemLength); } else { fileDICOM.read(&typeString[0],2); short tmp; fileDICOM.read((char*)&tmp,2); if (bNeedsEndianConversion) tmp = EndianConvert::Swap(tmp); iElemLength = tmp; eElementType = TYPE_UN; uint32_t i=0; for (;i<27;i++) { if (typeString == DICOM_TypeStrings[i]) { eElementType = DICOM_eType(i); break; } } if (i==27) { DICOM_DBG("WARNING: Reader could not interpret type %c%c (iGroupID=%i, iElementID=%i, iElemLength=%i)\n",typeString[0], typeString[1], int(iGroupID), int(iElementID), iElemLength); } else { DICOM_DBG("Read type %c%c field (iGroupID=%x (%i), iElementID= %x (%i), iElemLength=%i)\n",typeString[0], typeString[1], int(iGroupID), int(iGroupID), int(iElementID), int(iElementID), iElemLength); } } if ((eElementType == TYPE_OF || eElementType == TYPE_OW || eElementType == TYPE_OB || eElementType == TYPE_UT) && iElemLength == 0) { fileDICOM.read((char*)&iElemLength,4); if (bNeedsEndianConversion) iElemLength = EndianConvert::Swap(iElemLength); DICOM_DBG("Reader found zero length %c%c field and read the length again which is now (iElemLength=%i)\n", typeString[0], typeString[1], iElemLength); } } uint32_t DICOMParser::GetUInt(ifstream& fileDICOM, const DICOM_eType eElementType, const uint32_t iElemLength, const bool bNeedsEndianConversion) { string value; uint32_t result; switch (eElementType) { case TYPE_Implicit : case TYPE_IS : { ReadSizedElement(fileDICOM, value, iElemLength); result = atoi(value.c_str()); break; } case TYPE_UL : { fileDICOM.read((char*)&result,4); if (bNeedsEndianConversion) result = EndianConvert::Swap(result); break; } case TYPE_US : { short tmp; fileDICOM.read((char*)&tmp,2); if (bNeedsEndianConversion) tmp = EndianConvert::Swap(tmp); result = tmp; break; } default : result = 0; break; } return result; } #ifdef DEBUG_DICOM void DICOMParser::ParseUndefLengthSequence(ifstream& fileDICOM, short& iSeqGroupID, short& iSeqElementID, DICOMFileInfo& info, const bool bImplicit, const bool bNeedsEndianConversion, uint32_t iDepth) { for (int i = 0;i 0) { ReadHeaderElemStart(fileDICOM, iGroupID, iElementID, elementType, iData, bImplicit, bNeedsEndianConversion); if (elementType == TYPE_SQ) { fileDICOM.read((char*)&iData,4); if (iData == 0xFFFFFFFF) { #ifdef DEBUG_DICOM ParseUndefLengthSequence(fileDICOM, iGroupID, iElementID, info, bImplicit, bNeedsEndianConversion, 1); #else ParseUndefLengthSequence(fileDICOM, iGroupID, iElementID, info, bImplicit, bNeedsEndianConversion); #endif } else { // HACK: here we simply skip over the entire sequence value.resize(iData); fileDICOM.read(&value[0],iData); value = "SKIPPED EXPLICIT SEQUENCE"; } } else { if (iData == 0xFFFFFFFF) { #ifdef DEBUG_DICOM ParseUndefLengthSequence(fileDICOM, iGroupID, iElementID, info, bImplicit, bNeedsEndianConversion, iDepth+1); #else ParseUndefLengthSequence(fileDICOM, iGroupID, iElementID, info, bImplicit, bNeedsEndianConversion); #endif } else { if(iData > 0) { value.resize(iData); fileDICOM.read(&value[0],iData); #ifdef DEBUG_DICOM for (uint32_t i = 0;i 0); if(iElemLength == 0) { iElemLength = 1; } // guarantee progress. ReadSizedElement(fileDICOM, value, iElemLength); } break; case 0x10 : { // Parse Type to find out endianess ReadSizedElement(fileDICOM, value, iElemLength); if (value[iElemLength-1] == 0) value.resize(iElemLength-1); if (value == "1.2.840.10008.1.2") { // Implicit VR Little Endian bImplicit = true; bNeedsEndianConversion = EndianConvert::IsBigEndian(); info.m_bIsBigEndian = false; DICOM_DBG("DICOM file is Implicit VR Little Endian\n"); } else if (value == "1.2.840.10008.1.2.1") { // Explicit VR Little Endian bImplicit = false; bNeedsEndianConversion = EndianConvert::IsBigEndian(); info.m_bIsBigEndian = false; DICOM_DBG("DICOM file is Explicit VR Little Endian\n"); } else if (value == "1.2.840.10008.1.2.2") { // Explicit VR Big Endian bImplicit = false; bNeedsEndianConversion = EndianConvert::IsLittleEndian(); info.m_bIsBigEndian = true; DICOM_DBG("DICOM file is Explicit VR Big Endian\n"); } else if (value == "1.2.840.10008.1.2.4.50" || // JPEG Baseline ( untested due to lack of example DICOMs) value == "1.2.840.10008.1.2.4.51" || // JPEG Extended ( untested due to lack of example DICOMs) value == "1.2.840.10008.1.2.4.55" || // JPEG Progressive ( untested due to lack of example DICOMs) value == "1.2.840.10008.1.2.4.57" || // JPEG Lossless ( untested due to lack of example DICOMs) value == "1.2.840.10008.1.2.4.58" || // JPEG Lossless ( untested due to lack of example DICOMs) value == "1.2.840.10008.1.2.4.70" || // JPEG Lossless ( untested due to lack of example DICOMs) value == "1.2.840.10008.1.2.4.80" || // JPEG-LS Lossless ( untested due to lack of example DICOMs) value == "1.2.840.10008.1.2.4.81" || // JPEG-LS Near-lossless ( untested due to lack of example DICOMs) value == "1.2.840.10008.1.2.4.90" || // JPEG 2000 Lossless ( untested due to lack of example DICOMs) value == "1.2.840.10008.1.2.4.91" ) { // JPEG 2000 ( untested due to lack of example DICOMs) info.m_bIsJPEGEncoded = true; bImplicit = false; bNeedsEndianConversion = EndianConvert::IsBigEndian(); info.m_bIsBigEndian = false; DICOM_DBG("DICOM file is JPEG Explicit VR Big Endian\n"); } else { WARNING("Unknown DICOM type '%s' -- not a DICOM? " "Might just be something we haven't seen: please " "send a debug log.", value.c_str()); return false; // unsupported file format } fileDICOM.seekg(iMetaHeaderEnd, std::ios_base::beg); bParsingMetaHeader = false; } break; default : { SkipUnusedElement(fileDICOM, value, iElemLength); } break; } ReadHeaderElemStart(fileDICOM, iGroupID, iElementID, elementType, iElemLength, bImplicit, bNeedsEndianConversion); } } do { if (elementType == TYPE_SQ) { // read explicit sequence fileDICOM.read((char*)&iElemLength,4); if (iElemLength == 0xFFFFFFFF) { #ifdef DEBUG_DICOM ParseUndefLengthSequence(fileDICOM, iGroupID, iElementID, info, false, bNeedsEndianConversion, 1); #else ParseUndefLengthSequence(fileDICOM, iGroupID, iElementID, info, false, bNeedsEndianConversion); #endif value = "SEQUENCE"; } else { // HACK: here we simply skip over the entire sequence SkipUnusedElement(fileDICOM, value, iElemLength); value = "SKIPPED EXPLICIT SEQUENCE"; } } else if (elementType == TYPE_Implicit && iElemLength == 0xFFFFFFFF) { // read implicit sequence #ifdef DEBUG_DICOM ParseUndefLengthSequence(fileDICOM, iGroupID, iElementID, info, true, bNeedsEndianConversion, 1); #else ParseUndefLengthSequence(fileDICOM, iGroupID, iElementID, info, true, bNeedsEndianConversion); #endif value = "SEQUENCE"; } else { switch (iGroupID) { case 0x8 : switch (iElementID) { case 0x22 : { // Acquisition Date info.m_strAcquDate.resize(iElemLength); fileDICOM.read(&info.m_strAcquDate[0],iElemLength); #ifdef DEBUG_DICOM { stringstream ss; ss << info.m_strAcquDate << " (Acquisition Date: recognized and stored)"; value = ss.str(); } #endif } break; case 0x32 : { // Acquisition Time info.m_strAcquTime.resize(iElemLength); fileDICOM.read(&info.m_strAcquTime[0],iElemLength); #ifdef DEBUG_DICOM { stringstream ss; ss << info.m_strAcquTime << " (Acquisition Time: recognized and stored)"; value = ss.str(); } #endif } break; case 0x60 : { // Modality info.m_strModality.resize(iElemLength); fileDICOM.read(&info.m_strModality[0],iElemLength); #ifdef DEBUG_DICOM { stringstream ss; ss << info.m_strModality << " (Modality: recognized and stored)"; value = ss.str(); } #endif } break; case 0x1030 : { // Study Description info.m_strDesc.resize(iElemLength); fileDICOM.read(&info.m_strDesc[0],iElemLength); #ifdef DEBUG_DICOM { stringstream ss; ss << info.m_strDesc << " (Study Description: recognized and stored)"; value = ss.str(); } #endif } break; default : { SkipUnusedElement(fileDICOM, value, iElemLength); } break; } break; case 0x18 : switch (iElementID) { case 0x50 : { // Slice Thickness ReadSizedElement(fileDICOM, value, iElemLength); info.m_fvfAspect.z = float(atof(value.c_str())); #ifdef DEBUG_DICOM { stringstream ss; ss << info.m_fvfAspect.z << " (Slice Thinkness: recognized and stored)"; value = ss.str(); } #endif } break; case 0x88 : { // Spacing ReadSizedElement(fileDICOM, value, iElemLength); #ifdef DEBUG_DICOM fSliceSpacing = float(atof(value.c_str())); { stringstream ss; ss << fSliceSpacing << " (Slice Spacing: recognized)"; value = ss.str(); } #endif } break; default : { SkipUnusedElement(fileDICOM, value, iElemLength); } break; } break; case 0x20 : switch (iElementID) { case 0x11 : { // Series Number info.m_iSeries = GetUInt(fileDICOM, elementType, iElemLength, bNeedsEndianConversion); #ifdef DEBUG_DICOM { stringstream ss; ss << info.m_iSeries << " (Series Number: recognized and stored)"; value = ss.str(); } #endif } break; case 0x13 : { // Image Number info.m_iImageIndex = GetUInt(fileDICOM, elementType, iElemLength, bNeedsEndianConversion); #ifdef DEBUG_DICOM { stringstream ss; ss << info.m_iImageIndex << " (Image Number: recognized and stored)"; value = ss.str(); } #endif } break; case 0x32 : // patient position { ReadSizedElement(fileDICOM, value, iElemLength); size_t iDelimiter = value.find_first_of("\\"); info.m_fvPatientPosition.x = float(atof(value.substr(0,iDelimiter).c_str())); value = value.substr(iDelimiter+1, value.length()); iDelimiter = value.find_first_of("\\"); info.m_fvPatientPosition.y = float(atof(value.substr(0,iDelimiter).c_str())); info.m_fvPatientPosition.z = float(atof(value.substr(iDelimiter+1, value.length()).c_str())); #ifdef DEBUG_DICOM { stringstream ss; ss << info.m_fvPatientPosition.x << ", " << info.m_fvPatientPosition.y << ", " << info.m_fvPatientPosition.z << " (x,y,z Patient Position: recognized and stored)"; value = ss.str(); } #endif } break; default : { SkipUnusedElement(fileDICOM, value, iElemLength); } break; } break; case 0x28 : switch (iElementID) { case 0x2 : // component count if (elementType == TYPE_Implicit) elementType = TYPE_US; info.m_iComponentCount = GetUInt(fileDICOM, elementType, iElemLength, bNeedsEndianConversion); #ifdef DEBUG_DICOM { stringstream ss; ss << info.m_iComponentCount << " (samples per pixel: recognized and stored)"; value = ss.str(); } #endif break; case 0x8 : // Slices if (elementType == TYPE_Implicit) elementType = TYPE_IS; info.m_ivSize.z = GetUInt(fileDICOM, elementType, iElemLength, bNeedsEndianConversion); #ifdef DEBUG_DICOM { stringstream ss; ss << info.m_ivSize.z << " (Slices: recognized and stored)"; value = ss.str(); } #endif break; case 0x10 : // Rows if (elementType == TYPE_Implicit) elementType = TYPE_US; info.m_ivSize.y = GetUInt(fileDICOM, elementType, iElemLength, bNeedsEndianConversion); #ifdef DEBUG_DICOM { stringstream ss; ss << info.m_ivSize.y << " (Rows: recognized and stored)"; value = ss.str(); } #endif break; case 0x11 : // Columns if (elementType == TYPE_Implicit) elementType = TYPE_US; info.m_ivSize.x = GetUInt(fileDICOM, elementType, iElemLength, bNeedsEndianConversion); #ifdef DEBUG_DICOM { stringstream ss; ss << info.m_ivSize.x << " (Columns: recognized and stored)"; value = ss.str(); } #endif break; case 0x30 : // x,y spacing { ReadSizedElement(fileDICOM, value, iElemLength); size_t iDelimiter = value.find_first_of("\\"); info.m_fvfAspect.x = float(atof(value.substr(0,iDelimiter).c_str())); info.m_fvfAspect.y = float(atof(value.substr(iDelimiter+1, value.length()).c_str())); #ifdef DEBUG_DICOM { stringstream ss; ss << info.m_fvfAspect.x << ", " << info.m_fvfAspect.y << " (x,y spacing: recognized and stored)"; value = ss.str(); } #endif } break; case 0x100 : // Allocated if (elementType == TYPE_Implicit) elementType = TYPE_US; info.m_iAllocated = GetUInt(fileDICOM, elementType, iElemLength, bNeedsEndianConversion); #ifdef DEBUG_DICOM { stringstream ss; ss << info.m_iAllocated << " (Allocated bits: recognized and stored)"; value = ss.str(); } #endif break; case 0x101 : // Stored if (elementType == TYPE_Implicit) elementType = TYPE_US; info.m_iStored = GetUInt(fileDICOM, elementType, iElemLength, bNeedsEndianConversion); #ifdef DEBUG_DICOM { stringstream ss; ss << info.m_iStored << " (Stored bits: recognized and stored)"; value = ss.str(); } #endif break; case 0x0103 : // sign if (elementType == TYPE_Implicit) elementType = TYPE_US; info.m_bSigned = GetUInt(fileDICOM, elementType, iElemLength, bNeedsEndianConversion) == 1; #ifdef DEBUG_DICOM { stringstream ss; ss << info.m_bSigned << " (Sign bit: recognized and stored)"; value = ss.str(); } #endif break; case 0x1050: // Window Center ReadSizedElement(fileDICOM, value, iElemLength); info.m_fWindowCenter = float(atof(value.c_str())); #ifdef DEBUG_DICOM { stringstream ss; ss << info.m_fWindowCenter << " (Window Center: recognized and stored)"; value = ss.str(); } #endif break; case 0x1051: // Window Width ReadSizedElement(fileDICOM, value, iElemLength); info.m_fWindowWidth =-float(atof(value.c_str())); #ifdef DEBUG_DICOM { stringstream ss; ss << info.m_fWindowWidth << " (Window Width: recognized and stored)"; value = ss.str(); } #endif break; case 0x1052 : // Rescale Intercept (Bias) ReadSizedElement(fileDICOM, value, iElemLength); info.m_fBias = float(atof(value.c_str())); #ifdef DEBUG_DICOM { stringstream ss; ss << info.m_fBias << " (Rescale Intercept (Bias): recognized and stored)"; value = ss.str(); } #endif break; case 0x1053 : // Rescale Slope (Scale) ReadSizedElement(fileDICOM, value, iElemLength); info.m_fScale = float(atof(value.c_str())); #ifdef DEBUG_DICOM { stringstream ss; ss << info.m_fScale << " (Rescale Slope (Scale): recognized and stored)"; value = ss.str(); } #endif break; default : { SkipUnusedElement(fileDICOM, value, iElemLength); } break; } break; default : { SkipUnusedElement(fileDICOM, value, iElemLength); } break; } } #ifdef DEBUG_DICOM if (value != "SEQUENCE") Console::printf("iGroupID=%x iElementID=%x elementType=%s value=%s\n", iGroupID, iElementID, DICOM_TypeStrings[int(elementType)].c_str(), value.c_str()); #endif ReadHeaderElemStart(fileDICOM, iGroupID, iElementID, elementType, iElemLength, bImplicit, info.m_bIsBigEndian); } while (iGroupID != 0x7fe0 && elementType != TYPE_UN); if (elementType != TYPE_UN) { if (!bImplicit) { // for an explicit file we can actually check if we found the pixel // data block (and not some color table) uint32_t iPixelDataSize = info.m_ivSize.volume() * info.m_iAllocated / 8; uint32_t iDataSizeInFile = iElemLength; if (iDataSizeInFile == 0) fileDICOM.read((char*)&iDataSizeInFile,4); if (info.m_bIsJPEGEncoded) { unsigned char iJPEGID[2]; while (!fileDICOM.eof()) { fileDICOM.read((char*)iJPEGID,2); if (iJPEGID[0] == 0xFF && iJPEGID[1] == 0xE0 ) break; } // Try to get the offset, which can fail. If it does, report an error // and fake an offset -- we're screwed at that point anyway. size_t offset = static_cast(fileDICOM.tellg()); if(static_cast(fileDICOM.tellg()) == -1) { T_ERROR("JPEG offset unknown; DICOM parsing failed. " "Assuming offset 0. Please send a debug log."); offset = 4; // make sure it won't underflow in the next line. } offset -= 4; MESSAGE("JPEG is at offset: %u", static_cast(offset)); info.SetOffsetToData(static_cast(offset)); } else { if (iPixelDataSize != iDataSizeInFile) { elementType = TYPE_UN; } else info.SetOffsetToData(uint32_t(fileDICOM.tellg())); } } else { // otherwise just believe we have found the right data block info.SetOffsetToData(uint32_t(fileDICOM.tellg())); } } if (elementType == TYPE_UN) { // ok we encoutered some strange DICOM file (most likely that additional // SIEMENS header) and found an unknown tag, // so lets just march througth the rest of the file and search the magic // 0x7fe0, then use the last one found DICOM_DBG("Manual search for GroupId 0x7fe0\n"); size_t iPosition = size_t(fileDICOM.tellg()); fileDICOM.seekg(0,ios::end); size_t iFileLength = size_t(fileDICOM.tellg()); fileDICOM.seekg(iPosition,ios::beg); DICOM_DBG("volume size: %u\n", info.m_ivSize.volume()); DICOM_DBG("n components: %u\n", info.m_iComponentCount); uint32_t iPixelDataSize = info.m_iComponentCount * info.m_ivSize.volume() * info.m_iAllocated / 8; bool bOK = false; do { iGroupID = 0; iPosition = size_t(fileDICOM.tellg()); while (!fileDICOM.eof() && iGroupID != 0x7fe0 && iPosition+iPixelDataSize < iFileLength) { iPosition++; fileDICOM.read((char*)&iGroupID,2); } DICOM_DBG("At eof: %d\n", fileDICOM.eof()); // check if this 0x7fe0 is really a group ID if (iGroupID == 0x7fe0) { fileDICOM.seekg(-2, ios_base::cur); ReadHeaderElemStart(fileDICOM, iGroupID, iElementID, elementType, iElemLength, bImplicit, info.m_bIsBigEndian); bOK = (elementType == TYPE_OW || elementType == TYPE_OB || elementType == TYPE_OF); if (bOK) { DICOM_DBG("Manual search for GroupID seemed to work.\n"); if (!bImplicit) { uint32_t iVolumeDataSize = info.m_ivSize.volume() * info.m_iAllocated / 8; uint32_t iDataSizeInFile; fileDICOM.read((char*)&iDataSizeInFile,4); if (iVolumeDataSize != iDataSizeInFile) bOK = false; } info.SetOffsetToData(int(fileDICOM.tellg())); } else { DICOM_DBG("Manual search failed (for this iteration), " "skipping element of type '%d'!", (int)elementType); fileDICOM.seekg(iElemLength, ios_base::cur); } } } while(iGroupID == 0x7fe0); if (!bOK) { // ok everthing failed than let's just use the data we have so far, // and let's hope that the file ends with the data WARNING("Trouble parsing DICOM file; assuming data starts at %u", static_cast(iFileLength - size_t(iPixelDataSize))); info.SetOffsetToData(uint32_t(iFileLength - size_t(iPixelDataSize))); } } fileDICOM.close(); return info.m_ivSize.volume() != 0; } /*************************************************************************************/ SimpleDICOMFileInfo::SimpleDICOMFileInfo(const std::string& strFileName) : SimpleFileInfo(strFileName), m_fvPatientPosition(0,0,0), m_iComponentCount(1), m_fScale(1.0f), m_fBias(0.0f), m_fWindowWidth(0), m_fWindowCenter(0), m_bSigned(false), m_iOffsetToData(0) { } SimpleDICOMFileInfo::SimpleDICOMFileInfo(const std::wstring& wstrFileName) : SimpleFileInfo(wstrFileName), m_fvPatientPosition(0,0,0), m_iComponentCount(1), m_fScale(1.0f), m_fBias(0.0f), m_bSigned(false), m_iOffsetToData(0) { } SimpleDICOMFileInfo::SimpleDICOMFileInfo() : SimpleFileInfo(), m_fvPatientPosition(0,0,0), m_iComponentCount(1), m_fScale(1.0f), m_fBias(0.0f), m_bSigned(false), m_iOffsetToData(0) { } SimpleDICOMFileInfo::SimpleDICOMFileInfo(const SimpleDICOMFileInfo* other) : SimpleFileInfo(other), m_fvPatientPosition(other->m_fvPatientPosition), m_iComponentCount(other->m_iComponentCount), m_fScale(other->m_fScale), m_fBias(other->m_fBias), m_bSigned(other->m_bSigned), m_iOffsetToData(other->m_iOffsetToData) { } uint32_t SimpleDICOMFileInfo::GetComponentCount() const { return m_iComponentCount; } bool SimpleDICOMFileInfo::GetData(std::vector& vData, uint32_t iLength, uint32_t iOffset) { ifstream fs; fs.open(m_strFileName.c_str(),fstream::binary); if (fs.fail()) return false; fs.seekg(m_iOffsetToData+iOffset, ios_base::cur); fs.read(&vData[0], iLength); fs.close(); return true; } SimpleFileInfo* SimpleDICOMFileInfo::clone() { SimpleDICOMFileInfo* pSimpleDICOMFileInfo = new SimpleDICOMFileInfo(this); return (SimpleFileInfo*)pSimpleDICOMFileInfo; } /*************************************************************************************/ DICOMFileInfo::DICOMFileInfo() : SimpleDICOMFileInfo(), m_iSeries(0), m_ivSize(0,0,1), m_fvfAspect(1,1,1), m_iAllocated(0), m_iStored(0), m_bIsBigEndian(false), m_bIsJPEGEncoded(false), m_strAcquDate(""), m_strAcquTime(""), m_strModality(""), m_strDesc("") {} DICOMFileInfo::DICOMFileInfo(const std::string& strFileName) : SimpleDICOMFileInfo(strFileName), m_iSeries(0), m_ivSize(0,0,1), m_fvfAspect(1,1,1), m_iAllocated(0), m_iStored(0), m_bIsBigEndian(false), m_bIsJPEGEncoded(false), m_strAcquDate(""), m_strAcquTime(""), m_strModality(""), m_strDesc("") {} DICOMFileInfo::DICOMFileInfo(const std::wstring& wstrFileName) : SimpleDICOMFileInfo(wstrFileName), m_iSeries(0), m_ivSize(0,0,1), m_fvfAspect(1,1,1), m_iAllocated(0), m_iStored(0), m_bIsBigEndian(false), m_bIsJPEGEncoded(false), m_strAcquDate(""), m_strAcquTime(""), m_strModality(""), m_strDesc("") {} void DICOMFileInfo::SetOffsetToData(const uint32_t iOffset) { m_iOffsetToData = iOffset; m_iDataSize = m_iComponentCount*m_ivSize.volume()*m_iAllocated/8; } /*************************************************************************************/ DICOMStackInfo::DICOMStackInfo() : FileStackInfo(), m_iSeries(0), m_strAcquDate(""), m_strAcquTime(""), m_strModality("") {} DICOMStackInfo::DICOMStackInfo(const DICOMFileInfo* fileInfo) : FileStackInfo(fileInfo->m_ivSize, fileInfo->m_fvfAspect, fileInfo->m_iAllocated, fileInfo->m_iStored, fileInfo->m_iComponentCount, fileInfo->m_bSigned, fileInfo->m_bIsBigEndian, fileInfo->m_bIsJPEGEncoded, fileInfo->m_strDesc, "DICOM"), m_iSeries(fileInfo->m_iSeries), m_strAcquDate(fileInfo->m_strAcquDate), m_strAcquTime(fileInfo->m_strAcquTime), m_strModality(fileInfo->m_strModality) { m_Elements.push_back(new SimpleDICOMFileInfo(fileInfo)); } DICOMStackInfo::DICOMStackInfo(const DICOMStackInfo* other) : m_iSeries(other->m_iSeries), m_strAcquDate(other->m_strAcquDate), m_strAcquTime(other->m_strAcquTime), m_strModality(other->m_strModality) { m_ivSize = other->m_ivSize; m_fvfAspect = other->m_fvfAspect; m_iAllocated = other->m_iAllocated; m_iStored = other->m_iStored; m_iComponentCount = other->m_iComponentCount; m_bSigned = other->m_bSigned; m_bIsBigEndian = other->m_bIsBigEndian; m_bIsJPEGEncoded = other->m_bIsJPEGEncoded; m_strDesc = other->m_strDesc; m_strFileType = other->m_strFileType; for (size_t i=0;im_Elements.size();i++) { SimpleDICOMFileInfo* e = new SimpleDICOMFileInfo((SimpleDICOMFileInfo*)other->m_Elements[i]); m_Elements.push_back(e); } } bool DICOMStackInfo::Match(const DICOMFileInfo* info) { if (m_iSeries == info->m_iSeries && m_ivSize == info->m_ivSize && m_iAllocated == info->m_iAllocated && m_iStored == info->m_iStored && m_iComponentCount == info->m_iComponentCount && m_bSigned == info->m_bSigned && m_fvfAspect == info->m_fvfAspect && m_bIsBigEndian == info->m_bIsBigEndian && m_bIsJPEGEncoded == info->m_bIsJPEGEncoded && m_strAcquDate == info->m_strAcquDate && //m_strAcquTime == info->m_strAcquTime && m_strModality == info->m_strModality && m_strDesc == info->m_strDesc) { std::vector::iterator iter; for (iter = m_Elements.begin(); iter < m_Elements.end(); ++iter) { if ((*iter)->m_iImageIndex > info->m_iImageIndex) break; } m_Elements.insert(iter,new SimpleDICOMFileInfo(info)); return true; } else return false; } ImageVis3D-3.1.0/Tuvok/IO/DICOM/DICOMParser.h0000644000175000017500000001547412320456500017723 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DICOMParser.h \author Jens Krueger SCI Institute University of Utah \version 1.2 \date September 2008 */ #pragma once #ifndef DICOMPARSER_H #define DICOMPARSER_H #include #include // if the following define is set, the DICOM parser outputs detailed parsing // information. Be careful with this option: it creates a massive amount of // output. #ifdef _DEBUG //#define DEBUG_DICOM #endif #include "../../StdTuvokDefines.h" #include #include "../../Basics/Vectors.h" #include "../../Basics/EndianConvert.h" class SimpleDICOMFileInfo : public SimpleFileInfo { public: SimpleDICOMFileInfo(); SimpleDICOMFileInfo(const std::string& strFileName); SimpleDICOMFileInfo(const std::wstring& wstrFileName); SimpleDICOMFileInfo(const SimpleDICOMFileInfo* info); virtual ~SimpleDICOMFileInfo() {} virtual uint32_t GetComponentCount() const; virtual bool GetData(std::vector&, uint32_t iLength, uint32_t iOffset); virtual uint32_t GetOffsetToData() const { return m_iOffsetToData; } virtual SimpleFileInfo* clone(); // this data is needed to fix aspect ratio which is broken in many DICOM // files ... idiots FLOATVECTOR3 m_fvPatientPosition; uint32_t m_iComponentCount; float m_fScale; float m_fBias; float m_fWindowWidth; float m_fWindowCenter; bool m_bSigned; protected: uint32_t m_iOffsetToData; }; class DICOMFileInfo : public SimpleDICOMFileInfo { public: DICOMFileInfo(); DICOMFileInfo(const std::string& strFileName); DICOMFileInfo(const std::wstring& wstrFileName); virtual ~DICOMFileInfo() {} uint32_t m_iSeries; UINTVECTOR3 m_ivSize; FLOATVECTOR3 m_fvfAspect; uint32_t m_iAllocated; uint32_t m_iStored; bool m_bIsBigEndian; bool m_bIsJPEGEncoded; std::string m_strAcquDate; std::string m_strAcquTime; std::string m_strModality; std::string m_strDesc; void SetOffsetToData(const uint32_t iOffset); }; class DICOMStackInfo : public FileStackInfo { public: DICOMStackInfo(); DICOMStackInfo(const DICOMFileInfo* info); DICOMStackInfo(const DICOMStackInfo* other); virtual ~DICOMStackInfo() {} bool Match(const DICOMFileInfo* info); uint32_t m_iSeries; std::string m_strAcquDate; std::string m_strAcquTime; std::string m_strModality; }; enum DICOM_eType { TYPE_AE, ///< Application Entity string 16 bytes maximum TYPE_AS, ///< Age String string 4 bytes fixed TYPE_AT, ///< Attribute Tag string 4 bytes fixed TYPE_CS, ///< Code String string 16 bytes maximum TYPE_DA, ///< Date string 8 bytes fixed TYPE_DS, ///< Decimal String string 16 bytes maximum TYPE_DT, ///< Date Time string 26 bytes maximum TYPE_FL, ///< Floating Point Single binary 4 bytes fixed TYPE_FD, ///< Floating Point Double binary 8 bytes fixed TYPE_IS, ///< Integer String string 12 bytes maximum TYPE_LO, ///< Long String string 64 chars maximum TYPE_LT, ///< Long Text string 1024 chars maximum TYPE_OB, ///< Other Byte TYPE_OW, ///< Other Word TYPE_OF, ///< Other Float TYPE_PN, ///< Person Name string 64 chars maximum TYPE_SH, ///< Short String string 16 chars maximum TYPE_SL, ///< Signed Long binary 4 bytes fixed TYPE_SQ, ///< Sequence of Items - - TYPE_SS, ///< Signed Short binary 2 bytes fixed TYPE_ST, ///< Short Text string 1024 chars maximum TYPE_TM, ///< Time string 16 bytes maximum TYPE_UI, ///< Unique Identifier (UID) string 64 bytes maximum TYPE_UL, ///< Unsigned Long binary 4 bytes fixed TYPE_US, ///< Unsigned Short binary 2 bytes fixed TYPE_UT, ///< Unlimited Text string 232-2 TYPE_UN, ///< Unknown TYPE_Implicit ///< Implict File no type }; class DICOMParser : public DirectoryParser { public: DICOMParser(void); ~DICOMParser(void); virtual void GetDirInfo(std::string strDirectory); virtual void GetDirInfo(std::wstring wstrDirectory); static bool GetDICOMFileInfo(const std::string& fileName, DICOMFileInfo& info); protected: static void ReadSizedElement(std::ifstream& fileDICOM, std::string& value, const uint32_t iElemLength); static void SkipUnusedElement(std::ifstream& fileDICOM, std::string& value, const uint32_t iElemLength); static void ReadHeaderElemStart(std::ifstream& fileDICOM, short& iGroupID, short& iElementID, DICOM_eType& eElementType, uint32_t& iElemLength, bool bImplicit, bool bNeedsEndianConversion); static uint32_t GetUInt(std::ifstream& fileDICOM, const DICOM_eType eElementType, const uint32_t iElemLength, const bool bNeedsEndianConversion); #ifdef DEBUG_DICOM static void ParseUndefLengthSequence(std::ifstream& fileDICOM, short& iSeqGroupID, short& iSeqElementID, DICOMFileInfo& info, const bool bImplicit, const bool bNeedsEndianConversion, uint32_t iDepth); #else static void ParseUndefLengthSequence(std::ifstream& fileDICOM, short& iSeqGroupID, short& iSeqElementID, DICOMFileInfo& info, const bool bImplicit, const bool bNeedsEndianConversion); #endif }; #endif // DICOMPARSER_H ImageVis3D-3.1.0/Tuvok/IO/test/0000755000175000017500000000000012320456500015653 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/IO/test/test.pro0000644000175000017500000000423312320456500017356 0ustar mathieumathieuTEMPLATE = app win32:TEMPLATE = vcapp CONFIG += exceptions largefile link_prl qt rtti static stl warn_on TARGET = cxxtester DEFINES += _FILE_OFFSET_BITS=64 DEPENDPATH += . ../ INCLUDEPATH += ../ ../../ ../3rdParty/boost ../3rdParty/cxxtest INCLUDEPATH += ../../Basics QT += core gui opengl QMAKE_LIBDIR += ../../Build ../expressions LIBS += -lTuvok -ltuvokexpr unix:LIBS += -lz unix:!macx:LIBS += -lrt -lGLU -lGL win32:LIBS += shlwapi.lib unix:QMAKE_CXXFLAGS += -std=c++0x unix:!macx:QMAKE_CXXFLAGS += -fopenmp unix:!macx:QMAKE_LFLAGS += -fopenmp unix:QMAKE_CXXFLAGS += -fno-strict-aliasing unix:QMAKE_CFLAGS += -fno-strict-aliasing unix:CONFIG(debug, debug|release) { QMAKE_CFLAGS += -D_GLIBCXX_DEBUG QMAKE_CXXFLAGS += -D_GLIBCXX_DEBUG !macx LIBS += -lGLU } macx:QMAKE_CXXFLAGS += -stdlib=libc++ -mmacosx-version-min=10.7 macx:QMAKE_CFLAGS += -mmacosx-version-min=10.7 macx:LIBS += -stdlib=libc++ -mmacosx-version-min=10.7 -framework CoreFoundation ### Should we link Qt statically or as a shared lib? # Find the location of QtGui's prl file, and include it here so we can look at # the QMAKE_PRL_CONFIG variable. TEMP = $$[QT_INSTALL_LIBS] libQtGui.prl PRL = $$[QT_INSTALL_LIBS] QtGui.framework/QtGui.prl TEMP = $$join(TEMP, "/") PRL = $$join(PRL, "/") exists($$TEMP) { include($$TEMP) } exists($$PRL) { include($$PRL) } # If that contains the `shared' configuration, the installed Qt is shared. # In that case, disable the image plugins. contains(QMAKE_PRL_CONFIG, shared) { message("Shared build, ensuring there will be image plugins linked in.") QTPLUGIN -= qgif qjpeg } else { message("Static build, forcing image plugins to get loaded.") QTPLUGIN += qgif qjpeg } TEST_HEADERS=quantize.h largefile.h rebricking.h cbi.h bcache.h TG_PARAMS=--have-eh --abort-on-fail --no-static-init --error-printer alltests.target = alltests.cpp alltests.commands = python ../3rdParty/cxxtest/cxxtestgen.py \ $$TG_PARAMS -o alltests.cpp $$TEST_HEADERS alltests.depends = $$TEST_HEADERS #cxxtester.depends = alltests.cpp QMAKE_EXTRA_TARGETS += alltests SOURCES += alltests.cpp ImageVis3D-3.1.0/Tuvok/IO/test/rebricking.h0000644000175000017500000004644312320456500020156 0ustar mathieumathieu#include #include #include #include #include "Basics/SysTools.h" #include "Controller/Controller.h" #include "DynamicBrickingDS.h" #include "RAWConverter.h" #include "uvfDataset.h" #include "util-test.h" static const std::array, 8> data = {{ {{ 0, 1, 2, 3, 4, 5, 6, 7 }}, {{ 8, 9,10,11,12,13,14,15 }}, {{ 16,17,18,19,20,21,22,23 }}, {{ 24,25,26,27,28,29,30,31 }}, {{ 32,33,34,35,36,37,38,39 }}, {{ 40,41,42,43,44,45,46,47 }}, {{ 48,49,50,51,52,53,54,55 }}, {{ 56,57,58,59,60,61,62,63 }} }}; static void mk8x8(const char* filename) { std::ofstream ofs(filename, std::ios::trunc | std::ios::binary); ofs.write(reinterpret_cast(data[0].data()), sizeof(uint16_t) * 8*8); ofs.close(); } static void mk_uvf(const char* filename, const char* uvf) { RAWConverter::ConvertRAWDataset(filename, uvf, ".", 0, sizeof(uint16_t)*8, 1, 1, false, false, false, UINT64VECTOR3(8,8,1), FLOATVECTOR3(1,1,1), "desc", "iotest", 16, 2, true, false, 0,0, 0, NULL, false); } // creates an 8x8x1 uvf test data set and returns it. std::shared_ptr mk8x8testdata() { const char* outfn = "out.uvf"; ///< @todo fixme use a real temp filename mk8x8("abc"); ///< @todo fixme use a real temporary file mk_uvf("abc", outfn); std::shared_ptr ds(new UVFDataset(outfn, 128, false)); return ds; } // number of ghost cells per dimension... static unsigned ghost() { return 4; } /// tries to find the given dataset. ///@returns false if the data are not available. bool check_for(std::string file) { if(SysTools::FileExists(file + ".uvf")) { return true; } // can convert engine.. if(SysTools::FileExists(file + ".raw.gz") && file == "engine") { TS_TRACE("Found raw engine data; converting it for tests."); const IOManager& iom = Controller::Const().IOMan(); std::ofstream nhdr("engine.nhdr"); if(!nhdr) { return false; } nhdr << "NRRD0001\n" "encoding: gzip\n" "type: uint8\n" "sizes: 256 256 128\n" "dimension: 3\n" "data file: engine.raw.gz\n"; nhdr.close(); return iom.ConvertDataset("engine.nhdr", file+".uvf", ".", true, 256, 2, false); } // otherwise just try to convert it. if(SysTools::FileExists(file + ".dat")) { TS_TRACE("Attempting to convert data..."); const IOManager& iom = Controller::Const().IOMan(); return iom.ConvertDataset(file+".dat", file+".uvf", ".", true, 256, 2, false); } return false; } /// tries to find the engine, so that we can use it for some tests. /// @returns false if we can't find it, so you can abort the test if so. bool check_for_engine() { if(!SysTools::FileExists("engine.uvf") && !SysTools::FileExists("engine.raw.gz")) { return false; } if(SysTools::FileExists("engine.uvf")) { return true; } // if we have the raw data, we can just convert it. if(SysTools::FileExists("engine.raw.gz")) { TS_TRACE("Found raw engine data; converting it for tests."); const IOManager& iom = Controller::Const().IOMan(); std::ofstream nhdr("engine.nhdr"); if(!nhdr) { return false; } nhdr << "NRRD0001\n" "encoding: gzip\n" "type: uint8\n" "sizes: 256 256 128\n" "dimension: 3\n" "data file: engine.raw.gz\n"; nhdr.close(); return iom.ConvertDataset("engine.nhdr", "engine.uvf", ".", true, 256, 2, false); } return true; } static const size_t cacheBytes = 1024U*1024U*2048U; // just creates and destroys the object. void tsimple() { std::shared_ptr ds = mk8x8testdata(); MESSAGE("8x8x1 size: %llux%llux%llu", ds->GetDomainSize(0,0)[0], ds->GetDomainSize(0,0)[1], ds->GetDomainSize(0,0)[2]); DynamicBrickingDS dynamic(ds, {{16,16,16}}, cacheBytes); } // splits a 1-brick 8x8x1 volume into two bricks, of size 4x8x1 each. void tmake_two() { std::shared_ptr ds = mk8x8testdata(); DynamicBrickingDS dynamic(ds, {{8,16,16}}, cacheBytes); TS_ASSERT_EQUALS(dynamic.GetTotalBrickCount(), static_cast(5)); } // does not divide the volume evenly. void tuneven() { std::shared_ptr ds = mk8x8testdata(); TS_ASSERT_THROWS(DynamicBrickingDS dynamic(ds, {{9,16,16}}, cacheBytes), std::runtime_error); } // all previous test split on X, make sure Y works too! void ty() { std::shared_ptr ds = mk8x8testdata(); DynamicBrickingDS dynamic(ds, {{16,8,16}}, cacheBytes); TS_ASSERT_EQUALS(dynamic.GetTotalBrickCount(), static_cast(5)); } void tuneven_multiple_dims() { std::shared_ptr ds = mk8x8testdata(); TS_ASSERT_THROWS(DynamicBrickingDS dynamic(ds, {{9,9,16}}, cacheBytes), std::runtime_error); } // we gave an 8x8x1 buffer of values in [0,31]; even though the data are // uint64_t, we should recognize that we actually have 8bit data, etc. void tdata_type() { std::shared_ptr ds = mk8x8testdata(); DynamicBrickingDS dynamic(ds, {{16,16,16}}, cacheBytes); TS_ASSERT_EQUALS(dynamic.GetBitWidth(), 8U); TS_ASSERT_EQUALS(dynamic.GetComponentCount(), 1ULL); TS_ASSERT_EQUALS(dynamic.GetIsSigned(), false); TS_ASSERT_EQUALS(dynamic.GetIsFloat(), false); TS_ASSERT_EQUALS(dynamic.IsSameEndianness(), true); TS_ASSERT_DELTA(dynamic.GetRange().first, 0.0, 0.001); TS_ASSERT_DELTA(dynamic.GetRange().second, 63.0, 0.001); } void tno_dynamic() { std::shared_ptr ds = mk8x8testdata(); BrickKey bk(0,0,0); std::vector d; if(ds->GetBrick(bk, d) == false) { TS_FAIL("could not read data"); } TS_ASSERT_EQUALS(d.size(), (data.size()+ghost()) * (data[0].size()+ghost()) * (1+ghost()) ); const UINT64VECTOR3 bs( ds->GetBrickMetadata(bk).n_voxels[0], ds->GetBrickMetadata(bk).n_voxels[1], ds->GetBrickMetadata(bk).n_voxels[2] ); // run through each element and check for equality. however we have ghost // data, make sure to skip over that (since our source array doesn't have // it!) const size_t offset = ghost()/2; const size_t slice_sz = (data.size() + ghost()) * (data[0].size() + ghost()); for(size_t y=offset; y < bs[1]-offset; ++y) { for(size_t x=offset; x < bs[0]-offset; ++x) { const size_t idx = slice_sz*2 + y*bs[0] + x; // yes, the x/y indices are reversed in 'data'. TS_ASSERT_EQUALS(d[idx], data[y-offset][x-offset]); } } } void tdomain_size() { std::shared_ptr ds = mk8x8testdata(); { DynamicBrickingDS dynamic(ds, {{16,16,16}}, cacheBytes); TS_ASSERT_EQUALS(ds->GetDomainSize(0,0)[0], dynamic.GetDomainSize(0,0)[0]); TS_ASSERT_EQUALS(ds->GetDomainSize(0,0)[1], dynamic.GetDomainSize(0,0)[1]); TS_ASSERT_EQUALS(ds->GetDomainSize(0,0)[2], dynamic.GetDomainSize(0,0)[2]); } { DynamicBrickingDS dynamic(ds, {{8,8,16}}, cacheBytes); TS_ASSERT_EQUALS(ds->GetDomainSize(0,0)[0], dynamic.GetDomainSize(0,0)[0]); TS_ASSERT_EQUALS(ds->GetDomainSize(0,0)[1], dynamic.GetDomainSize(0,0)[1]); TS_ASSERT_EQUALS(ds->GetDomainSize(0,0)[2], dynamic.GetDomainSize(0,0)[2]); } } // very simple case: "rebrick" a dataset into the same number of bricks. void tdata_simple () { std::shared_ptr ds = mk8x8testdata(); DynamicBrickingDS dynamic(ds, {{16,16,16}}, cacheBytes); BrickKey bk(0,0,0); std::vector d; if(dynamic.GetBrick(bk, d) == false) { TS_FAIL("getting brick data failed."); } TS_ASSERT_EQUALS(d.size(), (data.size()+ghost()) * (data[0].size()+ghost()) * (1+ghost()) ); const UINT64VECTOR3 bs( ds->GetBrickMetadata(bk).n_voxels[0], ds->GetBrickMetadata(bk).n_voxels[1], ds->GetBrickMetadata(bk).n_voxels[2] ); TS_ASSERT_EQUALS(bs[0], 12ULL); TS_ASSERT_EQUALS(bs[1], 12ULL); TS_ASSERT_EQUALS(bs[2], 5ULL); const UINTVECTOR3 dynamic_bs = dynamic.GetBrickMetadata(bk).n_voxels; TS_ASSERT_EQUALS(bs[0], dynamic_bs[0]); TS_ASSERT_EQUALS(bs[1], dynamic_bs[1]); TS_ASSERT_EQUALS(bs[2], dynamic_bs[2]); // run through each element and check for equality. however we have ghost // data, make sure to skip over that (since our source array doesn't have // it!) const size_t offset = ghost()/2; const size_t slice_sz = (data.size() + ghost()) * (data[0].size() + ghost()); for(size_t y=offset; y < bs[1]-offset; ++y) { for(size_t x=offset; x < bs[0]-offset; ++x) { const size_t idx = slice_sz*2 + y*bs[0] + x; // yes, the x/y indexes are reversed in 'data'. TS_ASSERT_EQUALS(d[idx], data[y-offset][x-offset]); } } } // create bricks that are half the size of the source. static void verify_half_split(DynamicBrickingDS& dynamic) { BrickKey bk(0,0,0); const UINTVECTOR3 bs = dynamic.GetBrickMetadata(bk).n_voxels; TS_ASSERT_EQUALS(bs[0], 6ULL); TS_ASSERT_EQUALS(bs[1], 12ULL); TS_ASSERT_EQUALS(bs[2], 5ULL); std::vector d; if(dynamic.GetBrick(bk, d) == false) { TS_FAIL("reading brick data failed"); } TS_ASSERT_EQUALS(d.size(), bs.volume()); const size_t slice_sz = bs[0] * bs[1]; const size_t offset = ghost()/2; for(size_t y=offset; y < bs[1]-offset; ++y) { for(size_t x=offset; x < bs[0]-offset; ++x) { const size_t idx = slice_sz*2 + y*bs[0] + x; TS_ASSERT_EQUALS(d[idx], data[y-offset][x-offset]); } } } void tdata_half_split() { std::shared_ptr ds = mk8x8testdata(); DynamicBrickingDS dynamic(ds, {{6,16,16}}, cacheBytes); verify_half_split(dynamic); } // tests GetBrickVoxelCount API. void tvoxel_count() { std::shared_ptr ds = mk8x8testdata(); { DynamicBrickingDS dynamic(ds, {{16,16,16}}, cacheBytes); const BrickKey bk(0,0,0); TS_ASSERT_EQUALS(dynamic.GetBrickVoxelCounts(bk)[0], 12U); TS_ASSERT_EQUALS(dynamic.GetBrickVoxelCounts(bk)[1], 12U); TS_ASSERT_EQUALS(dynamic.GetBrickVoxelCounts(bk)[2], 5U); } { DynamicBrickingDS dynamic(ds, {{6,16,16}}, cacheBytes); BrickKey bk(0,0,0); TS_ASSERT_EQUALS(dynamic.GetBrickVoxelCounts(bk)[0], 6U); TS_ASSERT_EQUALS(dynamic.GetBrickVoxelCounts(bk)[1], 12U); TS_ASSERT_EQUALS(dynamic.GetBrickVoxelCounts(bk)[2], 5U); bk = BrickKey(0,0,1); TS_ASSERT_EQUALS(dynamic.GetBrickVoxelCounts(bk)[0], 6U); TS_ASSERT_EQUALS(dynamic.GetBrickVoxelCounts(bk)[1], 12U); TS_ASSERT_EQUALS(dynamic.GetBrickVoxelCounts(bk)[2], 5U); } } // rebricking should not change the world space layouts void tmetadata() { std::shared_ptr ds = mk8x8testdata(); const BrickKey bk(0,0,0); const BrickMD& src_md = ds->GetBrickMetadata(bk); { // bricks are bigger than DS -> DS unchanged -> metadata unchanged DynamicBrickingDS dynamic(ds, {{16,16,16}}, cacheBytes); const BrickMD& tgt_md = dynamic.GetBrickMetadata(bk); TS_ASSERT_EQUALS(src_md.center[0], tgt_md.center[0]); TS_ASSERT_EQUALS(src_md.center[1], tgt_md.center[1]); TS_ASSERT_EQUALS(src_md.center[2], tgt_md.center[2]); TS_ASSERT_EQUALS(src_md.extents[2], tgt_md.extents[2]); } } void trealdata() { if(!check_for_engine()) { TS_FAIL("need engine for this test"); } std::shared_ptr ds(new UVFDataset("engine.uvf", 256, false, false)); DynamicBrickingDS dynamic(ds, {{256,256,256}}, cacheBytes); BrickKey k(0,0, 0); std::vector data; dynamic.GetBrick(k, data); } void trealdata_2() { if(!check_for_engine()) { TS_FAIL("need engine for this test"); } std::shared_ptr ds(new UVFDataset("engine.uvf", 256, false, false)); DynamicBrickingDS dynamic(ds, {{130,256,256}}, cacheBytes); } void trealdata_make_two_lod2() { if(!check_for_engine()) { TS_FAIL("need engine for this test"); } std::shared_ptr ds(new UVFDataset("engine.uvf", 256, false, false)); DynamicBrickingDS dynamic(ds, {{130,256,256}}, cacheBytes); BrickKey k(0,1,0); std::vector data; dynamic.GetBrick(k, data); TS_ASSERT_EQUALS(data.size(), 130U*132U*68U); // root bricks are both 126x256x128... + ghost voxels. TS_ASSERT_EQUALS(dynamic.GetBrickMetadata(BrickKey(0,0,0)).n_voxels, UINTVECTOR3(130U, 256U, 132U)); TS_ASSERT_EQUALS(dynamic.GetBrickMetadata(BrickKey(0,0,1)).n_voxels, UINTVECTOR3(130U, 256U, 132U)); // and there's a tiny little brick left over on the side. TS_ASSERT_EQUALS(dynamic.GetBrickMetadata(BrickKey(0,0,2)).n_voxels, UINTVECTOR3(8U, 256U, 132U)); // as we get coarser, the LODs end up the same again. const BrickMD dy_md = dynamic.GetBrickMetadata(BrickKey(0,2,0)); const BrickMD uvf_md = ds->GetBrickMetadata(BrickKey(0,2,0)); TS_ASSERT_EQUALS(dy_md.n_voxels, uvf_md.n_voxels); } void tbsizes() { std::shared_ptr ds = mk8x8testdata(); DynamicBrickingDS dynamic(ds, {{16,16,16}}, cacheBytes); TS_ASSERT_EQUALS(dynamic.GetMaxBrickSize()[0], 16U); TS_ASSERT_EQUALS(dynamic.GetMaxBrickSize()[1], 16U); TS_ASSERT_EQUALS(dynamic.GetMaxBrickSize()[2], 16U); TS_ASSERT_EQUALS(dynamic.GetMaxUsedBrickSizes()[0], 12U); TS_ASSERT_EQUALS(dynamic.GetMaxUsedBrickSizes()[1], 12U); TS_ASSERT_EQUALS(dynamic.GetMaxUsedBrickSizes()[2], 5U); } void tprecompute() { if(!check_for_engine()) { TS_FAIL("need engine for this test"); } std::shared_ptr ds(new UVFDataset("engine.uvf", 512, false, false)); DynamicBrickingDS dynamic(ds, {{130,256,256}}, cacheBytes, DynamicBrickingDS::MM_PRECOMPUTE); } void output_slice(const std::vector& data, const std::array size, const size_t z) { fputs("\n", stderr); for(size_t y=0; y < size[1]; ++y) { for(size_t x=0; x < size[0]; ++x) { const size_t idx = z*size[1]*size[0] + y*size[0] + x; fprintf(stderr, "%02u ", static_cast(data[idx])); } fputs("\n", stderr); } fputs("\n", stderr); } // compute the min/max info when requested, and it should be exactly right void tminmax_dynamic() { std::shared_ptr ds = mk8x8testdata(); DynamicBrickingDS dynamic(ds, {{16,8,16}}, cacheBytes, DynamicBrickingDS::MM_DYNAMIC); BrickKey bk(0,0,0); std::vector d; if(dynamic.GetBrick(bk, d) == false) { TS_FAIL("getting brick data failed."); } TS_ASSERT_EQUALS(d.size(), 12U*8U*5U); #if 0 if(dynamic.GetBrick(BrickKey(0,0,1), d) == false) { TS_FAIL("getting brick data failed."); } TS_ASSERT_EQUALS(d.size(), 12U*8U*5U); output_slice(d, {{12,8,5}}, 2); #endif MinMaxBlock mm = dynamic.MaxMinForKey(BrickKey(0,0,0)); TS_ASSERT_DELTA(mm.minScalar, 0.0, 0.001); TS_ASSERT_DELTA(mm.maxScalar, 47.0, 0.001); // 47: includes the ghost! mm = dynamic.MaxMinForKey(BrickKey(0,0,1)); TS_ASSERT_DELTA(mm.minScalar, 0.0, 0.001); // likewise w/ 0: ghost. TS_ASSERT_DELTA(mm.maxScalar, 63.0, 0.001); } void tcache_disable() { std::shared_ptr ds = mk8x8testdata(); DynamicBrickingDS dynamic(ds, {{6,16,16}}, cacheBytes); verify_half_split(dynamic); dynamic.SetCacheSize(0); verify_half_split(dynamic); } void tengine_four() { if(!check_for_engine()) { TS_FAIL("need engine for this test"); } std::shared_ptr ds(new UVFDataset("engine.uvf", 256, false, false)); DynamicBrickingDS dynamic(ds, {{67,256,256}}, cacheBytes, DynamicBrickingDS::MM_SOURCE); } void rmi_bench() { if(!check_for("rmi")) { TS_FAIL("need RMI for this test."); return; } std::shared_ptr ds(new UVFDataset("rmi.uvf", 1024, false, false)); DynamicBrickingDS dynamic(ds, {{68,68,68}}, cacheBytes, DynamicBrickingDS::MM_SOURCE); std::vector data; for(size_t rep=0; rep < 4; ++rep) { size_t i=0; for(auto b=dynamic.BricksBegin(); i < 32 && b != dynamic.BricksEnd(); ++b) { dynamic.GetBrick(b->first, data); ++i; } } #if 0 double cache_add = Controller::Instance().PerfQuery(PERF_CACHE_ADD); double cache_lookup = Controller::Instance().PerfQuery(PERF_CACHE_LOOKUP); double something = Controller::Instance().PerfQuery(PERF_SOMETHING); fprintf(stderr, "\ncache add: %g\ncache lookup: %g\nsomething: %g\n", cache_add, cache_lookup, something); #endif } void trescale() { std::shared_ptr ds = mk8x8testdata(); DynamicBrickingDS dynamic(ds, {{6,16,16}}, cacheBytes); // should forward to the underlying object TS_ASSERT_EQUALS(dynamic.GetRescaleFactors(), ds->GetRescaleFactors()); // should forward; they are one in the same, so changing either should be // visible from the other. dynamic.SetRescaleFactors(DOUBLEVECTOR3(2.0, 1.0, 1.0)); TS_ASSERT_EQUALS(ds->GetRescaleFactors(), DOUBLEVECTOR3(2.0, 1.0, 1.0)); ds->SetRescaleFactors(DOUBLEVECTOR3(1.0, 2.0, 1.0)); TS_ASSERT_EQUALS(dynamic.GetRescaleFactors(), DOUBLEVECTOR3(1.0, 2.0, 1.0)); TS_ASSERT_EQUALS(dynamic.GetScale(), ds->GetScale()); const size_t lod_dynamic = dynamic.GetLargestSingleBrickLOD(0); const size_t lod_root = ds->GetLargestSingleBrickLOD(0); const BrickKey k_dynamic(0, lod_dynamic, 0); const BrickKey k_root(0, lod_root, 0); TS_ASSERT_EQUALS(dynamic.GetBrickExtents(k_dynamic), ds->GetBrickExtents(k_root)); } void tmulti_component() { if(!check_for("vhuman")) { TS_FAIL("need vishuman for this test."); return; } std::shared_ptr ds(new UVFDataset("vhuman.uvf", 260, false, false)); DynamicBrickingDS dynamic(ds, {{260, 260, 260}}, cacheBytes); TS_ASSERT_EQUALS(dynamic.GetComponentCount(), ds->GetComponentCount()); for(size_t i=0; i < 32; ++i) { BrickKey bk(0,0,i); std::vector dyndata, srcdata; if(!dynamic.GetBrick(bk, dyndata)) { TS_FAIL("failed read dynamic data"); } if(!ds->GetBrick(bk, srcdata)) { TS_FAIL("failed read source data"); } TS_ASSERT_EQUALS(dyndata.size(), srcdata.size()); TS_ASSERT(std::equal(dyndata.begin(), dyndata.end(), srcdata.begin())); double iso = 42.42; TS_ASSERT_EQUALS(dynamic.ContainsData(bk, iso), ds->ContainsData(bk, iso)); } } class RebrickerTests : public CxxTest::TestSuite { public: void test_simple() { tsimple(); } void test_make_two() { tmake_two(); } void test_uneven() { tuneven(); } void test_y() { ty(); } void test_uneven_multiple_dims() { tuneven_multiple_dims(); } void test_data_type() { tdata_type(); } void test_no_dynamic() { tno_dynamic(); } void test_domain_size() { tdomain_size(); } void test_data_simple() { tdata_simple(); } void test_data_half_split() { tdata_half_split(); } void test_voxel_count() { tvoxel_count(); } void test_metadata() { tmetadata(); } void test_real() { trealdata(); } void test_real_2() { trealdata_2(); } void test_real_make_two_lod2() { trealdata_make_two_lod2(); } void test_brick_sizes() { tbsizes(); } void test_precompute() { tprecompute(); } void test_minmax_dynamic() { tminmax_dynamic(); } void test_cache_disable() { tcache_disable(); } void test_engine_four() { tengine_four(); } void test_rmi_bench() { rmi_bench(); } void test_rescale() { trescale(); } }; ImageVis3D-3.1.0/Tuvok/IO/test/largefile.h0000644000175000017500000004744112320456500017770 0ustar mathieumathieu#include #include #include #include #include #include #include "LargeFileAIO.h" #include "LargeFileC.h" #include "LargeFileFD.h" #include "LargeFileMMap.h" #include "util-test.h" // create a temporary file with a constant value. namespace { template std::string tmp_constant(T constant, size_t len) { std::ofstream ofs; const std::string tmpf = mk_tmpfile(ofs, std::ios::out | std::ios::binary); gen_constant(ofs, len, constant); ofs.close(); return tmpf; } // verifies 'open' works without testing anything else... if this is broken, // there's no use looking at other tests until it's fixed. template void lf_generic_open() { const std::string tmpf = tmp_constant(86, 42); T lf(tmpf, std::ios::in, 0); if(!lf.is_open()) { TS_FAIL("Could not open file at all."); } remove(tmpf.c_str()); } } namespace { // uses standard ostreams to write a file with a constant value in it, then // reads the file with the class under test. Verifies that reads work // without relying on any write functionality in the class. template void lf_generic_read() { const uint64_t cval = 86; const size_t len = 42; const std::string tmpf = tmp_constant(cval, len); T lf(tmpf, std::ios::in); if(!lf.is_open()) { TS_FAIL("Could not open file at all."); return; } std::shared_ptr mem = lf.rd(0, len * sizeof(uint64_t)); const uint64_t* data = static_cast(mem.get()); assert(data != NULL); for(size_t i=0; i < len; ++i) { TS_ASSERT_EQUALS(data[i], cval); } remove(tmpf.c_str()); } } static int64_t generate_constant(int64_t val) { return val; } static void null_deleter(void*) {} namespace { // basic write test. Write 'N' elements, read them back and make sure // they're what we just wrote. template void lf_generic_write() { std::ofstream ofs; const std::string tmpf = mk_tmpfile(ofs, std::ios::out | std::ios::binary); clean f = cleanup(tmpf); ofs.close(); const size_t N = 64; const int64_t VALUE = -42; { /* write */ T lf(tmpf, std::ios::out, 0, sizeof(int64_t)*N); int64_t data[N]; std::generate(data, data+N, std::bind(generate_constant, VALUE)); lf.wr(std::shared_ptr(data, null_deleter), 0, sizeof(int64_t)*N); lf.close(); } MESSAGE("Write complete, closed. Starting read."); { T lf(tmpf, std::ios::in); std::shared_ptr mem = lf.rd(0, N*sizeof(int64_t)); const int64_t* data = static_cast(mem.get()); for(size_t i=0; i < N; ++i) { TS_ASSERT_EQUALS(data[i], VALUE); } } } } namespace { // tests write, but uses std streams to read it back; so doesn't rely on the // 'read' implementation. template void lf_generic_write_only() { std::ofstream ofs; const std::string tmpf = mk_tmpfile(ofs, std::ios::out | std::ios::binary); clean f = cleanup(tmpf); ofs.close(); const size_t N = 64; const int64_t VALUE = -42; { /* write */ T lf(tmpf, std::ios::out, 0, sizeof(int64_t)*N); int64_t data[N]; std::generate(data, data+N, std::bind(generate_constant, VALUE)); lf.wr(std::shared_ptr(data, null_deleter), 0, sizeof(int64_t)*N); lf.close(); } { std::ifstream ifs(tmpf.c_str(), std::ios::in | std::ios::binary); ifs.exceptions(std::fstream::failbit | std::fstream::badbit); if(!ifs.is_open()) { TS_FAIL("Could not open the file we just wrote!"); } int64_t elem; for(size_t i=0; i < N; ++i) { elem = 0; // reset elem so we'll know if the read failed. ifs.read(reinterpret_cast(&elem), sizeof(int64_t)); TS_ASSERT_EQUALS(elem, VALUE); } } } } // make sure we respect header offsets. namespace { template void lf_generic_header() { EnableDebugMessages dbg; std::ofstream ofs; const std::string tmpf = mk_tmpfile(ofs, std::ios::out | std::ios::binary); clean f = cleanup(tmpf); ofs.close(); // we'll write N elements of VALUE[0], then N of VALUE[1]. Then we'll use // a header offset on read to jump into the middle of that. const size_t N = 64; const int64_t VALUE[2] = { -42, 42 }; { /* write */ T lf(tmpf, std::ios::out, 0, sizeof(int64_t)*N*2); int64_t data[N]; std::generate(data, data+N, std::bind(generate_constant, VALUE[0])); lf.wr(std::shared_ptr(data, null_deleter), 0, sizeof(int64_t)*N); std::generate(data, data+N, std::bind(generate_constant, VALUE[1])); lf.wr(std::shared_ptr(data, null_deleter), sizeof(int64_t)*N, sizeof(int64_t)*N); lf.close(); } { /* read. offset so we see 1 VALUE[0] and N VALUE[1]'s. */ T lf(tmpf, std::ios::in, sizeof(int64_t)*(N-1)); std::shared_ptr mem = lf.rd(0, (N+1)*sizeof(int64_t)); const int64_t* data = static_cast(mem.get()); TS_ASSERT_EQUALS(data[0], VALUE[0]); for(size_t i=1; i < N+1; ++i) { TS_ASSERT_EQUALS(data[i], VALUE[1]); } } } } namespace { // tests with a large header. Leaves a bunch of bytes at the head of the // file undefined, by using offsets to control where the writes happen. // Then read everything back using an offsetted file, ensure we got what we // wrote. template void lf_generic_large_header() { std::ofstream ofs; const std::string tmpf = mk_tmpfile(ofs, std::ios::out | std::ios::binary); clean f = cleanup(tmpf); ofs.close(); const size_t N = 64; const int64_t VALUE[2] = { -42, 42 }; const size_t offset = 32768; { /* write. */ T lf(tmpf, std::ios::out, 0, sizeof(int64_t)*N*2+offset); int64_t data[N]; lf.seek(offset); std::generate(data, data+N, std::bind(generate_constant, VALUE[0])); lf.wr(std::shared_ptr(data, null_deleter), offset, sizeof(int64_t)*N); std::generate(data, data+N, std::bind(generate_constant, VALUE[1])); lf.wr(std::shared_ptr(data, null_deleter), sizeof(int64_t)*N + offset, sizeof(int64_t)*N); lf.close(); } { /* now read. We'll use a header offset so that we expect to see one * VALUE[0] and then N VALUE[1]s.*/ T lf(tmpf, std::ios::in, offset); std::shared_ptr mem = lf.rd(0, 2*N*sizeof(int64_t)); const int64_t* data = static_cast(mem.get()); for(size_t i=0; i < N; ++i) { TS_ASSERT_EQUALS(data[i], VALUE[0]); } for(size_t i=N; i < 2*N; ++i) { TS_ASSERT_EQUALS(data[i], VALUE[1]); } } } } // tests AIO with the nocopy flag doing multiple writes. void lf_aio_nocopy() { std::ofstream ofs; const std::string tmpf = mk_tmpfile(ofs, std::ios::out | std::ios::binary); clean f = cleanup(tmpf); ofs.close(); const size_t N = 64; const int64_t VALUE[3] = { -42, 42, 19 }; const size_t offset = 32768; int64_t data[3][N]; { LargeFileAIO lf(tmpf, std::ios::out, 0, sizeof(int64_t)*N*3+offset); lf.copy_writes(false); // write 3 arrays of data, each array is filled with VALUE[i] for(size_t i=0; i < 3; ++i) { std::generate(data[i], data[i]+N, std::bind(generate_constant, VALUE[i])); lf.wr(std::shared_ptr(data[i], null_deleter), offset + i*N*sizeof(int64_t), sizeof(int64_t)*N); } } { std::ifstream ifs(tmpf.c_str(), std::ios::in | std::ios::binary); ifs.exceptions(std::fstream::failbit | std::fstream::badbit); if(!ifs.is_open()) { TS_FAIL("Could not open the file we just wrote!"); } ifs.seekg(offset); // jump past the offset we should have skipped above int64_t elem; for(size_t j=0; j < 3; ++j) { for(size_t i=0; i < N; ++i) { elem = 0; // reset elem so we'll know if the read failed. ifs.read(reinterpret_cast(&elem), sizeof(int64_t)); TS_ASSERT_EQUALS(elem, VALUE[j]); } } } } // does a bunch of writes followed by a read. Hints that we'll need the read // data soonish in between all those writes. namespace { template void lf_generic_enqueue() { std::ofstream ofs; const std::string tmpf = mk_tmpfile(ofs, std::ios::out | std::ios::binary); clean f = cleanup(tmpf); ofs.close(); const size_t N = 64; const int64_t VALUE[8] = { -42,42, 19,-6, 4,12, 24,9 }; const size_t offset = 32768; T lf(tmpf, std::ios::in | std::ios::out, 0, sizeof(int64_t)*N*8+offset); for(size_t i=0; i < 8; ++i) { int64_t data[N]; const uint64_t this_offset = offset + i*(sizeof(int64_t)*N); std::generate(data, data+N, std::bind(generate_constant, VALUE[i])); lf.wr(std::shared_ptr(data, null_deleter), this_offset, sizeof(int64_t)*N); if(i == 5) { lf.enqueue(offset, sizeof(int64_t)*N); } } std::shared_ptr mem = lf.rd(offset, sizeof(int64_t)*N); const int64_t* data = static_cast(mem.get()); for(size_t i=0; i < N; ++i) { TS_ASSERT_EQUALS(data[i], VALUE[0]); } } } // tests reopening a file r/w after opening in RO. namespace { template void lf_generic_reopen() { std::ofstream ofs; const std::string tmpf = mk_tmpfile(ofs, std::ios::out | std::ios::binary); clean f = cleanup(tmpf); ofs.close(); const size_t N = 64; const int64_t VALUE = -42; T lf(tmpf, std::ios::in, 0, sizeof(int64_t)*N); { int64_t data[N]; std::generate(data, data+N, std::bind(generate_constant, VALUE)); lf.open(std::ios::out); lf.wr(std::shared_ptr(data, null_deleter), 0, sizeof(int64_t)*N); } lf.close(); T lfread(tmpf, std::ios::in, 0, sizeof(int64_t)*N); std::shared_ptr mem = lfread.rd(0, sizeof(int64_t)*N); const int64_t* data = static_cast(mem.get()); for(size_t i=0; i < N; ++i) { TS_ASSERT_EQUALS(data[i], VALUE); } } } // tests to make sure 'truncate' works static void lf_truncate() { std::ofstream ofs; const std::string tmpf = mk_tmpfile(ofs, std::ios::out | std::ios::binary); clean f = cleanup(tmpf); const size_t N = 64; const int64_t VALUE = -42; { int64_t data[N]; std::generate(data, data+N, std::bind(generate_constant, VALUE)); ofs.write(reinterpret_cast(data), sizeof(int64_t)*N); } ofs.close(); LargeFile::truncate(tmpf.c_str(), 0); std::ifstream ifs(tmpf.c_str(), std::ios::in | std::ios::binary); { int64_t test; TS_ASSERT(!ifs.fail()); // stream should be okay. ifs.read(reinterpret_cast(&test), sizeof(int64_t)); TS_ASSERT(ifs.fail()); // ... but that read should have broken it. } } // tests convenience read/write of a single value calls namespace { template void lf_generic_rw_single() { std::ofstream ofs; const std::string tmpf = mk_tmpfile(ofs, std::ios::out | std::ios::binary); clean fclean = cleanup(tmpf); ofs.close(); int8_t s8 = -7; uint8_t u8 = 19; int16_t s16 = 6; uint16_t u16 = 74; int32_t s32 = -15; uint32_t u32 = 2048; int64_t s64 = -21438907; uint64_t u64 = 234987; float f = 9.81; double d = 4.242; { // just overestimate the size, it doesn't matter much anyway. T lf(tmpf, std::ios::out, 0, sizeof(int64_t)*128); lf.write(s8); lf.write(u8); lf.write(s16); lf.write(u16); lf.write(s32); lf.write(u32); lf.write(s64); lf.write(u64); lf.write(f); lf.write(d); } { // just overestimate the size, it doesn't matter much anyway. T lf(tmpf, std::ios::out, 0, sizeof(int64_t)*128); s8 = u8 = s16 = u16 = s32 = u32 = s64 = u64 = 0; d = f = 0.0f; lf.read(&s8); lf.read(&u8); lf.read(&s16); lf.read(&u16); lf.read(&s32); lf.read(&u32); lf.read(&s64); lf.read(&u64); lf.read(&f); lf.read(&d); TS_ASSERT_EQUALS(s8, -7); TS_ASSERT_EQUALS(u8, 19); TS_ASSERT_EQUALS(s16, 6); TS_ASSERT_EQUALS(u16, 74); TS_ASSERT_EQUALS(s32, -15); TS_ASSERT_EQUALS(u32, 2048UL); TS_ASSERT_EQUALS(s64, -21438907); TS_ASSERT_EQUALS(u64, 234987ULL); TS_ASSERT_DELTA(f, 9.81, 0.0001); TS_ASSERT_DELTA(d, 4.242, 0.0001); } } } // test truncate actually cutting off some values namespace { template void lf_generic_truncate() { std::ofstream ofs; const std::string tmpf = mk_tmpfile(ofs, std::ios::out | std::ios::binary); clean f = cleanup(tmpf); ofs.close(); const size_t N = 64; const int64_t VALUE[] = { -42, 96, 67 }; { // write N VALUE[0]'s, N VALUE[1]'s, then truncate down to two values. T lf(tmpf, std::ios::out, 0, sizeof(int64_t)*128); int64_t data[N]; std::generate(data, data+N, std::bind(generate_constant, VALUE[0])); lf.write(data, N); { int64_t d[N]; std::generate(d, d+N, std::bind(generate_constant, VALUE[1])); lf.write(d, N); } lf.close(); lf.truncate(sizeof(int64_t)*2); } { // ensure the filesize is correct (truncate did something) std::ifstream ifs(tmpf.c_str(), std::ios::in | std::ios::binary); ifs.seekg(0, std::ios::end); TS_ASSERT_EQUALS(static_cast(ifs.tellg()), sizeof(int64_t)*2); } { // append N VALUE[2]'s T lf(tmpf, std::ios::out, 0, sizeof(int64_t)*128); int64_t data[N]; std::generate(data, data+N, std::bind(generate_constant, VALUE[2])); lf.seek(sizeof(int64_t)*2); lf.write(data, N); } { // now make sure we have 2 VALUE[0]'s and N VALUE[2]'s, no VALUE[1]'s! const uint64_t len = sizeof(int64_t)*(N+2); T lf(tmpf, std::ios::in, 0, len); std::shared_ptr mem = lf.rd(0, len); const int64_t* data = static_cast(mem.get()); TS_ASSERT_EQUALS(data[0], VALUE[0]); TS_ASSERT_EQUALS(data[1], VALUE[0]); for(size_t i=2; i < N+2; ++i) { // should be no VALUE[1]'s; we truncated that. TS_ASSERT_EQUALS(data[i], VALUE[2]); } } } } // ensures writing increases the offset as it should. namespace { template void lf_generic_wroffset() { std::ofstream ofs; const std::string tmpf = mk_tmpfile(ofs, std::ios::out | std::ios::binary); clean f = cleanup(tmpf); ofs.close(); const size_t N = 64; const int64_t VALUE[] = { -42, 96, 67 }; { // write N VALUE[0]'s, N VALUE[1]'s, then truncate down to two values. T lf(tmpf, std::ios::out, 0, sizeof(int64_t)*128); TS_ASSERT_EQUALS(lf.offset(), static_cast(0)); int64_t data[N]; std::generate(data, data+N, std::bind(generate_constant, VALUE[0])); lf.write(data, N); TS_ASSERT_EQUALS(lf.offset(), sizeof(int64_t)*N); lf.write(data[0]); TS_ASSERT_EQUALS(lf.offset(), sizeof(int64_t)*(N+1)); lf.seek(lf.offset()-sizeof(int64_t)); TS_ASSERT_EQUALS(lf.offset(), sizeof(int64_t)*N); lf.seek(0); TS_ASSERT_EQUALS(lf.offset(), static_cast(0)); } } } // ensures reading increases the offset as it should. namespace { template void lf_generic_rdoffset() { std::ofstream ofs; const std::string tmpf = mk_tmpfile(ofs, std::ios::out | std::ios::binary); clean f = cleanup(tmpf); const size_t N = 64; const int64_t VALUE[] = { -42 }; { int64_t data[N]; std::generate(data, data+N, std::bind(generate_constant, VALUE[0])); ofs.write(reinterpret_cast(data), sizeof(int64_t)*N); } ofs.close(); T lf(tmpf, std::ios::in, 0, sizeof(int64_t)*128); TS_ASSERT_EQUALS(lf.offset(), static_cast(0)); const size_t len = sizeof(int64_t)*(N/2); lf.rd(len); TS_ASSERT_EQUALS(lf.offset(), sizeof(int64_t)*(N/2)); { int64_t data[N/2]; lf.seek(sizeof(int64_t)); lf.read(data, N/4); TS_ASSERT_EQUALS(lf.offset(), sizeof(int64_t)*((N/4)+1)); TS_ASSERT_EQUALS(data[0], VALUE[0]); } } } class LargeFileTests : public CxxTest::TestSuite { public: void test_truncate() { lf_truncate(); } void test_mmap_open() { lf_generic_open(); } void test_mmap_read() { lf_generic_read(); } void test_mmap_write() { lf_generic_write(); } void test_mmap_write_only() { lf_generic_write_only(); } void test_mmap_header() { lf_generic_header(); } void test_mmap_large_header() { lf_generic_large_header(); } void test_mmap_enqueue() { lf_generic_enqueue(); } void test_mmap_reopen() { lf_generic_reopen(); } void test_mmap_rw_single() { lf_generic_rw_single(); } void test_mmap_truncate() { lf_generic_truncate(); } void test_mmap_wroffset() { lf_generic_wroffset(); } void test_mmap_rdoffset() { lf_generic_rdoffset(); } void test_fd_open() { lf_generic_open(); } void test_fd_read() { lf_generic_read(); } void test_fd_write() { lf_generic_write(); } void test_fd_write_only() { lf_generic_write_only(); } void test_fd_header() { lf_generic_header(); } void test_fd_large_header() { lf_generic_large_header(); } void test_fd_enqueue() { lf_generic_enqueue(); } void test_fd_reopen() { lf_generic_reopen(); } void test_fd_rw_single() { lf_generic_rw_single(); } void test_fd_truncate() { lf_generic_truncate(); } void test_fd_wroffset() { lf_generic_wroffset(); } void test_fd_rdoffset() { lf_generic_rdoffset(); } void test_aio_open() { lf_generic_open(); } void test_aio_read() { lf_generic_read(); } void test_aio_write() { lf_generic_write(); } void test_aio_write_only() { lf_generic_write_only(); } void test_aio_header() { lf_generic_header(); } void test_aio_large_header() { lf_generic_large_header(); } void test_aio_nocopy() { lf_aio_nocopy(); } void test_aio_enqueue() { lf_generic_enqueue(); } void test_aio_reopen() { lf_generic_reopen(); } void test_aio_rw_single() { lf_generic_rw_single(); } void test_aio_truncate() { lf_generic_truncate(); } void test_aio_wroffset() { lf_generic_wroffset(); } void test_aio_rdoffset() { lf_generic_rdoffset(); } void test_c_open() { lf_generic_open(); } void test_c_read() { lf_generic_read(); } void test_c_write() { lf_generic_write(); } void test_c_write_only() { lf_generic_write_only(); } void test_c_header() { lf_generic_header(); } void test_c_large_header() { lf_generic_large_header(); } void test_c_enqueue() { lf_generic_enqueue(); } void test_c_reopen() { lf_generic_reopen(); } void test_c_rw_single() { lf_generic_rw_single(); } void test_c_truncate() { lf_generic_truncate(); } void test_c_wroffset() { lf_generic_wroffset(); } void test_c_rdoffset() { lf_generic_rdoffset(); } }; ImageVis3D-3.1.0/Tuvok/IO/test/multisrc.h0000644000175000017500000000167512320456500017677 0ustar mathieumathieu#include #include #include #include #include #include #include #include "Controller/Controller.h" #include "Quantize.h" #include "util-test.h" using namespace tuvok; // marchsnerrlob -- 0:255 // out.dat.raw: 0:204 class MultiDataSrcTesting: public CxxTest::TestSuite { public: void test_multi() { LargeRAWFile f1 = LargeRAWFile("data/MarschnerLobb.raw"); f1.Open(false); LargeRAWFile f2 = LargeRAWFile("data/out.dat.raw"); f2.Open(false); std::vector files; files.push_back(f1); files.push_back(f2); multi_raw_data_src multisrc((files)); NullProgress np; std::pair mm = io_minmax(multisrc, NullHistogram(), np, static_cast(DEFAULT_INCORESIZE)); check_equality(mm.first, 0); check_equality(mm.second, 254); } }; ImageVis3D-3.1.0/Tuvok/IO/test/expression.h0000644000175000017500000000233712320456500020230 0ustar mathieumathieu#include #include "RAWConverter.h" #include "util-test.h" // creates a temporary UVF from the specified data. returns its filename. static std::string mkuvf(uint64_t value) { std::ofstream f; std::string rawdata = mk_tmpfile(f, std::ios::out | std::ios::binary); clean inputs = cleanup(rawdata); gen_constant(f, 1, value); f.flush(); f.close(); std::string uvf = mk_tmpfile(f, std::ios::out | std::ios::binary); if(RAWConverter::ConvertRAWDataset( rawdata, uvf, ".", 0, sizeof(uint64_t)*8, 1, 1, false, false, false, UINT64VECTOR3(1,1,1), FLOATVECTOR3(1.0, 1.0, 1.0), "description", "nosrc", 64, 4, true, false, 0) != true) { TS_FAIL("converting data set failed."); } return uvf; } static std::vector smalluvfs() { std::vector uvfs; uvfs.push_back(mkuvf(42)); uvfs.push_back(mkuvf(19)); return uvfs; } class TestExpressions : public CxxTest::TestSuite { public: void test_addition_1() { EnableDebugMessages edm; std::vector uvf = smalluvfs(); clean fclean = cleanup(uvf[0]).add(uvf[1]); const IOManager& iom = *Controller::Instance().IOMan(); iom.EvaluateExpression("v[0] + 1", uvf, ".temp"); } }; ImageVis3D-3.1.0/Tuvok/IO/test/util-test.h0000644000175000017500000001006312320456500017756 0ustar mathieumathieu#ifndef SCIO_TEST_UTIL_H #define SCIO_TEST_UTIL_H #include #include #include #include #include "Controller/Controller.h" using namespace tuvok; // "tuvok" ubyte, "tuvok" byte. // we can't just use byte because MS' compiler defines it. typedef unsigned char tubyte; typedef signed char tbyte; size_t filesize(const char fn[]) { std::ifstream ifs(fn, std::ios::binary); ifs.seekg(0, std::ios::end); size_t retval = static_cast(static_cast(ifs.tellg())); ifs.seekg(0, std::ios::beg); return retval; } template static function_t for_each(element_t (&x)[n], function_t func) { return std::for_each(x, x+n, func); } template static void Delete(T* t) { delete t; } /// Put one of these on your stack to enable Tuvok's debug messages for a single /// test. Or put it as a private member of your test class to enable debugging /// for that whole set of tests. struct EnableDebugMessages { EnableDebugMessages() { Controller::Debug::Out().SetOutput(true,true,true,true); } ~EnableDebugMessages() { Controller::Debug::Out().SetOutput(true,true,false,false); } }; // An equality check that automatically switches to allowing a small epsilon // when used with FP types. template inline void check_equality(T a, T b) { TS_ASSERT_EQUALS(a, b); } template <> inline void check_equality(double a, double b) { TS_ASSERT_DELTA(a,b, 0.0001); } // Create a temporary file and return the name. // This isn't great -- there's a race between when we close and reopen it -- // but there's no (standard) way to turn a file descriptor into a std::fstream. std::string mk_tmpfile(std::ofstream& ofs, std::ios_base::openmode mode) { #ifdef _WIN32 char *templ = tmpnam((char*)0); ofs.open(templ, mode); #else char templ[64]; strcpy(templ, ".iotest.XXXXXX"); int fd = mkstemp(templ); close(fd); ofs.open(templ, mode); #endif return std::string(templ); } // Data generation code. namespace { // Generates data with a constant value template void gen_constant(std::ostream& os, const size_t sz, const T& val) { for(size_t i=0; i < sz; ++i) { os.write(reinterpret_cast(&val), sizeof(T)); } } // Generates data along a normal distribution with the given mean and // standard deviation. Returns the min/max of the generated data. template std::pair gen_normal(std::ostream& os, const size_t sz, const T& mean, const T& stddev) { std::pair minmax = std::make_pair( std::numeric_limits::max(), -(std::numeric_limits::max()-1) // bleh, not great. ); // double: RNGs are only defined for FP types. We'll generate double // and just cast to T. std::random_device genSeed; std::mt19937 mtwister(genSeed()); std::normal_distribution normalDist(mean, stddev); std::function getRandNormal(std::bind(normalDist, mtwister)); for(size_t i=0; i < sz/sizeof(T); ++i) { T v = static_cast(getRandNormal()); minmax.first = std::min(minmax.first, v); minmax.second = std::max(minmax.second, v); os.write(reinterpret_cast(&v), sizeof(T)); } return minmax; } } /// Wrapper to help make sure temporary files get cleaned up. /// Usage: /// clean blah = cleanup("file1").add("another_file").add("etc."); class cleanup { public: cleanup(const char* fn) { this->files.push_back(std::string(fn)); } cleanup(std::string fn) { this->files.push_back(fn); } cleanup& add(const char* fn) { this->files.push_back(std::string(fn)); return *this; } cleanup& add(std::string fn) { this->files.push_back(fn); return *this; } private: friend class clean; std::vector files; }; class clean { public: clean(const cleanup& c) { this->files = c.files; } ~clean() { std::for_each(files.begin(), files.end(), [](const std::string& f) { std::remove(f.c_str()); }); } private: std::vector files; }; #endif // SCIO_TEST_UTIL_H ImageVis3D-3.1.0/Tuvok/IO/test/quantize.h0000644000175000017500000002167312320456500017675 0ustar mathieumathieu#include #include #include #include #include #include #include #include "AbstrConverter.h" #include "Controller/Controller.h" #include "UVF/Histogram1DDataBlock.h" #include "../Quantize.h" #include "util-test.h" using namespace tuvok; template bool quantize(LargeRAWFile& input, const std::string& outfn, uint64_t values, Histogram1DDataBlock* hist, T) { BStreamDescriptor bsd; bsd.elements = values; bsd.components = 1; bsd.width = sizeof(T); bsd.is_signed = ctti::is_signed; bsd.fp = std::is_floating_point::value; bsd.big_endian = EndianConvert::IsBigEndian(); bsd.timesteps = 1; return Quantize(input, bsd, outfn, hist); } template <> bool quantize(LargeRAWFile& input, const std::string& outfn, uint64_t values, Histogram1DDataBlock* hist, tbyte) { return AbstrConverter::Process8Bits(input, outfn, values, true, hist); } template <> bool quantize(LargeRAWFile& input, const std::string& outfn, uint64_t values, Histogram1DDataBlock* hist, tubyte) { return AbstrConverter::Process8Bits(input, outfn, values, false, hist); } template bool quantize8(LargeRAWFile& input, const std::string& outfn, uint64_t values, Histogram1DDataBlock* hist, T) { BStreamDescriptor bsd; bsd.elements = values; bsd.components = 1; bsd.width = sizeof(T); bsd.is_signed = ctti::is_signed; bsd.fp = std::is_floating_point::value; bsd.big_endian = EndianConvert::IsBigEndian(); bsd.timesteps = 1; return Quantize(input, bsd, outfn, hist); } template <> bool quantize8(LargeRAWFile& input, const std::string& outfn, uint64_t values, Histogram1DDataBlock* hist, tbyte) { return AbstrConverter::Process8Bits(input, outfn, values, true, hist); } template <> bool quantize8(LargeRAWFile& input, const std::string& outfn, uint64_t values, Histogram1DDataBlock* hist, tubyte) { return AbstrConverter::Process8Bits(input, outfn, values, false, hist); } template bool is_8bit(T) { return false; } template<> bool is_8bit(tbyte) { return true; } template<> bool is_8bit(tubyte) { return true; } template void verify_type() { const size_t N_VALUES = 100; typedef typename ctti::signed_type sT; const sT STARTING_NEG = ctti::is_signed ? -64 : 0; std::string fn, outfn; { std::ofstream dataf; fn = mk_tmpfile(dataf, std::ios::out | std::ios::binary); assert(dataf.is_open()); for(sT start=STARTING_NEG; start < static_cast(N_VALUES+STARTING_NEG); ++start) { gen_constant(dataf, 1, start); } dataf.close(); // need a filename for a temporary output file outfn = mk_tmpfile(dataf, std::ios::out | std::ios::binary); dataf.close(); } clean fclean = cleanup(fn).add(outfn); Histogram1DDataBlock hist1d; { LargeRAWFile input(fn); input.Open(false); MESSAGE("quantizing %s to %s", fn.c_str(), outfn.c_str()); if(!quantize(input, outfn, static_cast(N_VALUES), &hist1d, T())) { outfn = fn; } } // verify data std::ifstream outdata; outdata.clear(); outdata.exceptions(std::fstream::failbit | std::fstream::badbit); MESSAGE("reading %s for data", outfn.c_str()); outdata.open(outfn.c_str(), std::fstream::in | std::fstream::binary); outdata.clear(); assert(outdata.is_open()); typedef typename ctti::size_type uT; const uT bias = -STARTING_NEG; for(size_t i=0; i < N_VALUES; ++i) { if(is_8bit(T())) { unsigned char val = 42; outdata.read(reinterpret_cast(&val), sizeof(unsigned char)); if(ctti::is_signed) { TS_ASSERT_EQUALS(val, STARTING_NEG+i+128); } else { TS_ASSERT_EQUALS(val, static_cast(STARTING_NEG+i)); } } else if(!std::is_floating_point::value) { // Don't test this part when we've got FP data; we allow "expanding" // quantization in that case, so these assumptions are wrong. unsigned short val; outdata.read(reinterpret_cast(&val), sizeof(unsigned short)); double quant = 65535.0 / N_VALUES; quant = std::min(quant, 1.0); TS_ASSERT_EQUALS(val, static_cast ((STARTING_NEG+i+bias) * quant)); } } outdata.close(); // now verify 1D histogram const std::vector& histo = hist1d.GetHistogram(); for(size_t i=0; i < histo.size(); ++i) { // For data wider than 8 bit, we bias s.t. the minimum value ends up at 0. // Therefore the first N_VALUES of our histogram will have data. For 8 bit // data, we don't shift correctly, because it would require an extra pass // over the data to get the minimum. if(is_8bit(T())) { uT low; if(ctti::is_signed) { low = static_cast(STARTING_NEG + 128); } else { low = 0; } if(static_cast(low) <= i && i < low+N_VALUES) { TS_ASSERT_EQUALS(histo[i], static_cast(1)); } else { TS_ASSERT_EQUALS(histo[i], static_cast(0)); } } else if(!std::is_floating_point::value) { // we expand FP data; hard to assert a specific histogram in that case. if(static_cast(i < N_VALUES)) { TS_ASSERT_EQUALS(histo[i], static_cast(1)); } else { TS_ASSERT_EQUALS(histo[i], static_cast(0)); } } } } template void verify_8b_type() { const size_t N_VALUES = 100; typedef typename ctti::signed_type sT; const sT STARTING_NEG = ctti::is_signed ? -64 : 0; std::string fn, outfn; { std::ofstream dataf; fn = mk_tmpfile(dataf, std::ios::out | std::ios::binary); assert(dataf.is_open()); for(sT start=STARTING_NEG; start < static_cast(N_VALUES+STARTING_NEG); ++start) { gen_constant(dataf, 1, start); } dataf.close(); // need a filename for a temporary output file outfn = mk_tmpfile(dataf, std::ios::out | std::ios::binary); dataf.close(); } clean fclean = cleanup(fn).add(outfn); Histogram1DDataBlock hist1d; { LargeRAWFile input(fn); input.Open(false); if(!quantize8(input, outfn, static_cast(N_VALUES), &hist1d, T())) { outfn = fn; } } // verify data std::ifstream outdata; outdata.clear(); outdata.exceptions(std::fstream::failbit | std::fstream::badbit); outdata.open(outfn.c_str(), std::ios::in | std::ios::binary); assert(outdata.is_open()); typedef typename ctti::size_type uT; const uT bias = -STARTING_NEG; for(size_t i=0; i < N_VALUES; ++i) { unsigned char val; outdata.read(reinterpret_cast(&val), sizeof(unsigned char)); if(ctti::is_signed) { if(is_8bit(T())) { TS_ASSERT_EQUALS(val, STARTING_NEG+i+128); } else { double quant = 256.0 / N_VALUES; quant = std::min(quant, 1.0); TS_ASSERT_EQUALS(val, static_cast ((STARTING_NEG+i+bias) * quant)); } } else { TS_ASSERT_EQUALS(val, static_cast(STARTING_NEG+i)); } } outdata.close(); // now verify 1D histogram const std::vector& histo = hist1d.GetHistogram(); for(size_t i=0; i < histo.size(); ++i) { // For data wider than 8 bit, we bias s.t. the minimum value ends up at 0. // Therefore the first N_VALUES of our histogram will have data. For 8 bit // data, we don't shift correctly, because it would require an extra pass // over the data to get the minimum. if(is_8bit(T())) { uT low; if(ctti::is_signed) { low = static_cast(STARTING_NEG + 128); } else { low = 0; } if(static_cast(low) <= i && i < low+N_VALUES) { TS_ASSERT_EQUALS(histo[i], static_cast(1)); } else { TS_ASSERT_EQUALS(histo[i], static_cast(0)); } } else { if(static_cast(i < N_VALUES)) { TS_ASSERT_EQUALS(histo[i], static_cast(1)); } else { TS_ASSERT_EQUALS(histo[i], static_cast(0)); } } } } class QuantizeTests : public CxxTest::TestSuite { public: void test_byte() { verify_type(); } void test_short() { verify_type(); } void test_float() { verify_type(); } void test_double() { verify_type(); } void test_ubyte() { verify_type(); } void test_ushort() { verify_type(); } void test_int() { verify_type(); } void test_uint() { verify_type(); } void test_8b_byte() { verify_8b_type(); } void test_8b_ubyte() { verify_8b_type(); } void test_8b_short() { verify_8b_type(); } void test_8b_ushort() { verify_8b_type(); } void test_8b_int() { verify_8b_type(); } void test_8b_uint() { verify_8b_type(); } }; ImageVis3D-3.1.0/Tuvok/IO/test/cbi.h0000644000175000017500000000774612320456500016577 0ustar mathieumathieu#include #include #include #include "Basics/MathTools.h" #include "const-brick-iterator.h" void simple_center() { std::array voxels = {{12,6,24}}; std::array bsize = {{12,6,24}}; std::array,2> extents = {{ {{ 0.0f, 0.0f, 0.0f }}, {{ 10.0f, 35.0f, 19.0f }} }}; tuvok::const_brick_iterator cbi = tuvok::begin(voxels, bsize, extents); TS_ASSERT_DELTA((*cbi).second.center[0], 5.0f, 0.0001f); TS_ASSERT_DELTA((*cbi).second.center[1], 17.5f, 0.0001f); TS_ASSERT_DELTA((*cbi).second.center[2], 9.5f, 0.0001f); } void simple_extents() { std::array voxels = {{12,6,24}}; std::array bsize = {{12,6,24}}; std::array,2> extents = {{ {{ 0.0f, 0.0f, 0.0f }}, {{ 12.0f, 6.0f, 24.0f }} }}; tuvok::const_brick_iterator cbi = tuvok::begin(voxels, bsize, extents); TS_ASSERT_DELTA((*cbi).second.extents[0], 12.0f, 0.0001f); TS_ASSERT_DELTA((*cbi).second.extents[1], 6.0f, 0.0001f); TS_ASSERT_DELTA((*cbi).second.extents[2], 24.0f, 0.0001f); } // split the domain in two && make sure centers are correct void two_center() { std::array voxels = {{12,6,24}}; std::array bsize = {{6,6,24}}; std::array,2> extents = {{ {{ 0.0f, 0.0f, 0.0f }}, {{ 10.0f, 35.0f, 19.0f }} }}; tuvok::const_brick_iterator cbi = tuvok::begin(voxels, bsize, extents); TS_ASSERT_DELTA((*cbi).second.center[0], 2.5f, 0.0001f); TS_ASSERT_DELTA((*cbi).second.center[1], 17.5f, 0.0001f); TS_ASSERT_DELTA((*cbi).second.center[2], 9.5f, 0.0001f); ++cbi; TS_ASSERT_DELTA((*cbi).second.center[0], 7.5f, 0.0001f); TS_ASSERT_DELTA((*cbi).second.center[1], 17.5f, 0.0001f); TS_ASSERT_DELTA((*cbi).second.center[2], 9.5f, 0.0001f); } // split the domain in two && make sure extents are correct void two_extents() { std::array voxels = {{12,6,24}}; std::array bsize = {{6,6,24}}; std::array,2> extents = {{ {{ 0.0f, 0.0f, 0.0f }}, {{ 10.0f, 35.0f, 19.0f }} }}; tuvok::const_brick_iterator cbi = tuvok::begin(voxels, bsize, extents); TS_ASSERT_DELTA((*cbi).second.extents[0], 5.0f, 0.0001f); TS_ASSERT_DELTA((*cbi).second.extents[1], 35.0f, 0.0001f); TS_ASSERT_DELTA((*cbi).second.extents[2], 19.0f, 0.0001f); ++cbi; TS_ASSERT_DELTA((*cbi).second.extents[0], 5.0f, 0.0001f); TS_ASSERT_DELTA((*cbi).second.extents[1], 35.0f, 0.0001f); TS_ASSERT_DELTA((*cbi).second.extents[2], 19.0f, 0.0001f); } void four_parts() { std::array voxels = {{256, 256, 128}}; std::array bsize = {{64, 256, 128}}; std::array,2> extents = {{ {{ -0.5f, -0.5f, -0.25f }}, {{ 0.5f, 0.5f, 0.25f }} }}; tuvok::const_brick_iterator cbi = tuvok::begin(voxels, bsize, extents); while(cbi != tuvok::end()) { ++cbi; } } // tests a bug we once had with the params from the engine. void engine_bug() { std::array voxels = {{252, 252, 128}}; std::array bsize = {{63, 252, 128}}; std::array,2> extents = {{ {{ -0.5f, -0.5f, -0.25f }}, {{ 0.5f, 0.5f, 0.25f }} }}; tuvok::const_brick_iterator cbi = tuvok::begin(voxels, bsize, extents); while(cbi != tuvok::end()) { MESSAGE("cbi %ux%ux%u...", static_cast((*cbi).second.n_voxels[0]), static_cast((*cbi).second.n_voxels[1]), static_cast((*cbi).second.n_voxels[2])); // we skip out on 31---that's a new (the coarsest) LOD! if((*cbi).second.n_voxels[0] != 31U) { TS_ASSERT_EQUALS((*cbi).second.n_voxels[0], 63U); } ++cbi; } } class BHIteratorTests : public CxxTest::TestSuite { public: void test_simple_center() { simple_center(); } void test_simple_extents() { simple_extents(); } void test_two_center() { two_center(); } void test_two_extents() { two_extents(); } void test_four_parts() { four_parts(); } void test_engine_bug() { engine_bug(); } }; ImageVis3D-3.1.0/Tuvok/IO/test/jpeg.h0000644000175000017500000000622512320456500016756 0ustar mathieumathieu#include #include #include #include "TuvokJPEG.h" #include "Controller/Controller.h" #include "util-test.h" struct testjpeg { const char *file; const size_t width; const size_t height; const size_t bpp; }; #if 0 {"ref/J2KP4files/codestreams_profile1/p1_01.j2k", 64,64, 3}, // dims? {"ref/J2KP4files/reference_class0_profile0/c0p0_01.pgx", 64,64, 3}, // dims? {"ref/J2KP4files/reference_class0_profile1/c0p1_01.pgx", 64,64, 3}, // dims? {"ref/J2KP4files/reference_class1_profile0/c1p0_01_0.pgx", 64,64, 3}, // d? {"ref/J2KP4files/reference_class1_profile1/c1p1_04_0.pgx", 64,64, 3}, // d? {"ref/J2KP4files/testfiles_jp2/file3.jp2", 64,64, 3}, // d? #endif static const struct testjpeg jpegs[] = { #if 1 {"data/einstein.jpeg", 113, 144, 3}, {"data/ssc-small.jpeg", 450, 450, 3}, {"data/lena-1bpp.jpeg", 512, 512, 1}, {"data/lena-3bpp.jpeg", 512, 512, 3}, #endif {"data/lossless.jpeg", 224,256, 1}, // dims? }; struct valid_from_file : public std::unary_function { void operator()(const struct testjpeg &tj) const { #ifdef VERBOSE TS_TRACE(std::string("file validity for ") + tj.file); #endif tuvok::JPEG jpeg(tj.file); TS_ASSERT(jpeg.valid()); TS_ASSERT_EQUALS(jpeg.width(), tj.width); TS_ASSERT_EQUALS(jpeg.height(), tj.height); TS_ASSERT_EQUALS(jpeg.components(), tj.bpp); } }; struct valid_from_mem : public std::unary_function { void operator()(const struct testjpeg &jpg) const { #ifdef VERBOSE TS_TRACE(std::string("mem validity for ") + jpg.file); #endif std::vector buffer(filesize(jpg.file)); std::ifstream ifs(jpg.file, std::ios::binary); ifs.read(&buffer.at(0), filesize(jpg.file)); ifs.close(); tuvok::JPEG jpeg(buffer); TS_ASSERT(jpeg.valid()); TS_ASSERT_EQUALS(jpeg.width(), jpg.width); TS_ASSERT_EQUALS(jpeg.height(), jpg.height); TS_ASSERT_EQUALS(jpeg.components(), jpg.bpp); } }; struct file_can_read : public std::unary_function { void operator()(const struct testjpeg &jpg) const { tuvok::JPEG jpeg(jpg.file); TS_ASSERT(jpeg.valid()); TS_ASSERT_EQUALS(jpeg.width(), jpg.width); TS_ASSERT_EQUALS(jpeg.height(), jpg.height); TS_ASSERT_EQUALS(jpeg.components(), jpg.bpp); TS_ASSERT(jpeg.data() != NULL); } }; struct mem_can_read : public std::unary_function { void operator()(const struct testjpeg &jpg) const { #ifdef VERBOSE TS_TRACE(std::string("readable test for ") + jpg.file); #endif std::vector buffer(filesize(jpg.file)); std::ifstream ifs(jpg.file, std::ios::binary); ifs.read(&buffer.at(0), filesize(jpg.file)); ifs.close(); tuvok::JPEG jpeg(buffer); TS_ASSERT_DIFFERS(jpeg.data(), static_cast(NULL)); } }; class JpegTest : public CxxTest::TestSuite { public: void test_validity_file() { for_each(jpegs, valid_from_file()); } void test_validity_memory() { for_each(jpegs, valid_from_mem()); } void test_readable_file() { for_each(jpegs, file_can_read()); } void test_readable_memory() { for_each(jpegs, mem_can_read()); } private: }; ImageVis3D-3.1.0/Tuvok/IO/test/dicom.h0000644000175000017500000000243712320456500017125 0ustar mathieumathieu#include #include #include #include #include "DICOM/DICOMParser.h" #include "Basics/SysTools.h" #include "Controller/Controller.h" #include "IO/IOManager.h" #include "util-test.h" struct testdicom { const char *file; }; static const struct testdicom dicoms[] = { {"data/dicoms/8b-00.dcm"} }; struct size : public std::unary_function { void operator()(const testdicom &td) const { #ifdef VERBOSE TS_TRACE(std::string("testing size of ") + td.file); #endif DICOMParser dparse; dparse.GetDirInfo(SysTools::GetPath(td.file)); TS_ASSERT_EQUALS(dparse.m_FileStacks.size(), static_cast(1)); } }; struct stacks : public std::unary_function { void operator()(const testdicom &td) { #ifdef VERBOSE TS_TRACE(std::string("testing stacks; ") + td.file); #endif const IOManager &iomgr = Controller::Const().IOMan(); std::vector files = iomgr.ScanDirectory(SysTools::GetPath(td.file)); TS_ASSERT(!files.empty()); std::for_each(files.begin(), files.end(), Delete); } }; class DicomTests : public CxxTest::TestSuite { public: void test_size() { for_each(dicoms, size()); } void test_stacks() { for_each(dicoms, stacks()); } }; ImageVis3D-3.1.0/Tuvok/IO/test/minmax.h0000644000175000017500000004634012320456500017324 0ustar mathieumathieu#include #include #include #include #include #include #include #include "Controller/Controller.h" #include "Quantize.h" #include "util-test.h" #define PREFIX "/home/tfogal/data" using namespace tuvok; template struct testfile { const char *file; size_t bytes_to_skip; T data_min; T data_max; typedef T base_type; }; template struct test_quant : public std::unary_function, void> { test_quant() : sz(0) {} void operator()(const testfile &tf) const { #ifdef VERBOSE { std::ostringstream trace; trace << "testing " << sizeof(T)*8 << "bit data in " << tf.file; TS_TRACE(trace.str()); } #endif std::string fn = std::string(tf.file); const size_t filesz = filesize(fn.c_str()); const size_t n_elems = filesz / sizeof(T); std::vector hist; { #ifdef VERBOSE TS_TRACE("raw_data_src"); #endif Unsigned12BitHistogram histw(hist); LargeRAWFile raw(fn); raw.Open(false); std::pair mm = io_minmax(raw_data_src(raw), histw, TuvokProgress(n_elems), sz); check_equality(tf.data_min, mm.first); check_equality(tf.data_max, mm.second); raw.Close(); } { #ifdef VERBOSE TS_TRACE("ios_data_src"); #endif Unsigned12BitHistogram histw(hist); std::ifstream fs(fn.c_str()); std::pair mm = io_minmax(ios_data_src(fs), histw, TuvokProgress(n_elems), sz); check_equality(tf.data_min, mm.first); check_equality(tf.data_max, mm.second); fs.close(); } } size_t sz; }; // Minmax tests. namespace { template void t(size_t sz, T mean, T stddev) { std::ofstream dataf; const std::string fn = mk_tmpfile(dataf, std::ios::out | std::ios::binary); clean fclean = cleanup(fn); const std::pair minmax = gen_normal(dataf, sz, mean, stddev); dataf.close(); { struct testfile tf = { fn.c_str(), 0, minmax.first, minmax.second }; test_quant tester; tester.sz = sz; tester(tf); } } template void t_constant(size_t sz, T value) { std::ofstream dataf; const std::string fn = mk_tmpfile(dataf, std::ios::out | std::ios::binary); clean fclean = cleanup(fn); gen_constant(dataf, sz, value); dataf.close(); { struct testfile tf = { fn.c_str(), 0, value, value }; test_quant tester; tester(tf); } } } class MinMaxTesting : public CxxTest::TestSuite { public: void atest_short() { struct testfile files_short[] = { {"data/short",0, -32765, 32741} }; for_each(files_short, test_quant()); } void atest_ubyte() { struct testfile files_ubyte[] = { {"data/ubyte",0, 0,255} }; for_each(files_ubyte, test_quant()); } void atest_float() { struct testfile files_float[] = { {"data/float",0, 1.3389827,235.573898}, }; for_each(files_float, test_quant()); } void atest_double() { struct testfile files_double[] = { {"data/double",0, 1.3389827013, 235.5738983154}, }; for_each(files_double, test_quant()); } // We have a wide set of variables to test: // every type: byte,ubyte, short,ushort, int,uint, INT64,UINT64, // float, double // fits in 12 bits, doesn't fit in 12 bits // all values negative, spans 0, all positive // pathological cases: all the same neg/pos value, all 0. // file < in core size, file == in core size, file > in core size // "tuvok byte" -- "byte" is defined by MS' compiler. typedef signed char tbyte; // byte, (they always fit in 12 bits :), all neg, small file void test_byte_neg_lt_incore() { t(DEFAULT_INCORESIZE/64, -90, 2); } // byte, (always fits in 12 bits ;), all neg, == DEFAULT_INCORESIZE. void test_byte_neg_eq_incore() { t(DEFAULT_INCORESIZE, -90, 2); } // byte, (always fit in 12 bits ;), all neg, > DEFAULT_INCORESIZE. void test_byte_neg_gt_incore() { t(DEFAULT_INCORESIZE*2, -90, 2); } // byte, (always fits in 12 bits ;), spans 0, < DEFAULT_INCORESIZE void test_byte_span_lt_incore() { t(DEFAULT_INCORESIZE/64, 0, 3); } // byte, (always fits in 12 bits ;), spans 0, == DEFAULT_INCORESIZE void test_byte_span_eq_incore() { t(DEFAULT_INCORESIZE, 0, 3); } // byte, (always fits in 12 bits ;), spans 0, > DEFAULT_INCORESIZE void test_byte_span_gt_incore() { t(DEFAULT_INCORESIZE*2, 0, 3); } void test_char_neg_lt_incore() { t(DEFAULT_INCORESIZE/64, -90, 2); } void test_char_neg_eq_incore() { t(DEFAULT_INCORESIZE, -90, 2); } void test_char_neg_gt_incore() { t(DEFAULT_INCORESIZE*2, -90, 2); } void test_char_span_lt_incore() { t(DEFAULT_INCORESIZE/64, 0, 3); } void test_char_span_eq_incore() { t(DEFAULT_INCORESIZE, 0, 3); } void test_char_span_gt_incore() { t(DEFAULT_INCORESIZE*2, 0, 3); } void test_char_pos_lt_incore() { t(DEFAULT_INCORESIZE/64, 90, 4); } void test_char_pos_eq_incore() { t(DEFAULT_INCORESIZE, 90, 4); } void test_char_pos_gt_incore() { t(DEFAULT_INCORESIZE*2, 90, 4); } typedef unsigned char ubyte; void test_ubyte_neg_lt_incore() { t(DEFAULT_INCORESIZE/64, -90, 2); } void test_ubyte_neg_eq_incore() { t(DEFAULT_INCORESIZE, -90, 2); } void test_ubyte_neg_gt_incore() { t(DEFAULT_INCORESIZE*2, -90, 2); } void test_ubyte_span_lt_incore() { t(DEFAULT_INCORESIZE/64, 0, 3); } void test_ubyte_span_eq_incore() { t(DEFAULT_INCORESIZE, 0, 3); } void test_ubyte_span_gt_incore() { t(DEFAULT_INCORESIZE*2, 0, 3); } void test_ubyte_pos_lt_incore() { t(DEFAULT_INCORESIZE/64, 90, 4); } void test_ubyte_pos_eq_incore() { t(DEFAULT_INCORESIZE, 90, 4); } void test_ubyte_pos_gt_incore() { t(DEFAULT_INCORESIZE*2, 90, 4); } void test_short_neg_12bit_lt_incore() { t(DEFAULT_INCORESIZE/64, -4096, 32); } void test_short_neg_12bit_eq_incore() { t(DEFAULT_INCORESIZE, -4096, 32); } void test_short_neg_12bit_gt_incore() { t(DEFAULT_INCORESIZE*2, -4096, 32); } // negative, doesn't fit in 12 bits: center at -16384, w/ a std dev of // 4096. Since the data will be normally distributed, 99.7% of the data // will be w/in 3 std devs, i.e. 99.7% of the data will be < -16384+3*4096 // == -4096. I guess there's a 0.3% chance of an outlier, but not only // would it have to be an outlier, it would have to be an outlier that's 4 // std deviations away from the mean. void test_short_neg_not12bit_lt_incore() { t(DEFAULT_INCORESIZE/64, -16384, 4096); } void test_short_neg_not12bit_eq_incore() { t(DEFAULT_INCORESIZE, -16384, 4096); } void test_short_neg_not12bit_gt_incore() { t(DEFAULT_INCORESIZE*2, -16384, 4096); } void test_short_span_12bit_lt_incore() { t(DEFAULT_INCORESIZE/64, 0, 32); } void test_short_span_12bit_eq_incore() { t(DEFAULT_INCORESIZE, 0, 32); } void test_short_span_12bit_gt_incore() { t(DEFAULT_INCORESIZE*2, 0, 32); } void test_short_span_not12bit_lt_incore() { t(DEFAULT_INCORESIZE/64, 0, 8192); } void test_short_span_not12bit_eq_incore() { t(DEFAULT_INCORESIZE, 0, 8192); } void test_short_span_not12bit_gt_incore() { t(DEFAULT_INCORESIZE*2, 0, 8192); } void test_short_pos_12bit_lt_incore() { t(DEFAULT_INCORESIZE/64, 16384, 32); } void test_short_pos_12bit_eq_incore() { t(DEFAULT_INCORESIZE, 16384, 32); } void test_short_pos_12bit_gt_incore() { t(DEFAULT_INCORESIZE*2, 16384, 32); } void test_short_pos_not12bit_lt_incore() { t(DEFAULT_INCORESIZE/64, 16384, 4096); } void test_short_pos_not12bit_eq_incore() { t(DEFAULT_INCORESIZE, 16384, 4096); } void test_short_pos_not12bit_gt_incore() { t(DEFAULT_INCORESIZE*2, 16384, 4096); } typedef unsigned short ushort; void test_ushort_0_12b_lti() { t(DEFAULT_INCORESIZE/64, 0, 64); } void test_ushort_0_12b_ei() { t(DEFAULT_INCORESIZE, 0, 64); } void test_ushort_0_12b_gti() { t(DEFAULT_INCORESIZE*2, 0, 64); } void test_ushort_0_n12b_lti() { t(DEFAULT_INCORESIZE/64, 0, 8192); } void test_ushort_0_n12b_ei() { t(DEFAULT_INCORESIZE, 0, 16384); } void test_ushort_0_n12b_gti() { t(DEFAULT_INCORESIZE*2, 0, 32768); } void test_ushort_p_12b_lti() { t(DEFAULT_INCORESIZE/64, 30123, 64); } void test_ushort_p_12b_ei() { t(DEFAULT_INCORESIZE, 30456, 64); } void test_ushort_p_12b_gti() { t(DEFAULT_INCORESIZE*2, 30789, 64); } void test_ushort_p_n12b_lti() { t(DEFAULT_INCORESIZE/64, 29487, 8192); } void test_ushort_p_n12b_ei() { t(DEFAULT_INCORESIZE, 24891, 4096); } void test_ushort_p_n12b_gti() { t(DEFAULT_INCORESIZE*2, 23489, 2048); } void test_int_n_12b_lti() { t(DEFAULT_INCORESIZE/64, -65534, 32); } void test_int_n_12b_ei() { t(DEFAULT_INCORESIZE, -65534, 32); } void test_int_n_12b_gti() { t(DEFAULT_INCORESIZE*2, -65534, 32); } void test_int_n_n12b_lti() { t(DEFAULT_INCORESIZE/64, -268435456, 4096); } void test_int_n_n12b_ei() { t(DEFAULT_INCORESIZE, -268435456, 4096); } void test_int_n_n12b_gti() { t(DEFAULT_INCORESIZE*2, -268435456, 4096); } void test_int_0_12b_lti() { t(DEFAULT_INCORESIZE/64, 0, 128); } void test_int_0_12b_ei() { t(DEFAULT_INCORESIZE, 0, 128); } void test_int_0_12b_gti() { t(DEFAULT_INCORESIZE*2, 0, 128); } void test_int_0_n12b_lti() { t(DEFAULT_INCORESIZE/64, 0, 4096); } void test_int_0_n12b_ei() { t(DEFAULT_INCORESIZE, 0, 4096); } void test_int_0_n12b_gti() { t(DEFAULT_INCORESIZE*2, 0, 4096); } void test_int_p_12b_lti() { t(DEFAULT_INCORESIZE/64, 16777216, 128); } void test_int_p_12b_ei() { t(DEFAULT_INCORESIZE, 16777216, 128); } void test_int_p_12b_gti() { t(DEFAULT_INCORESIZE*2, 16777216, 128); } void test_int_p_n12b_lti() { t(DEFAULT_INCORESIZE/64, 16777216, 4096); } void test_int_p_n12b_ei() { t(DEFAULT_INCORESIZE, 16777216, 4096); } void test_int_p_n12b_gti() { t(DEFAULT_INCORESIZE*2, 16777216, 4096); } typedef unsigned int uint; void test_uint_0_12b_lti() { t(DEFAULT_INCORESIZE/64, 0, 64); } void test_uint_0_12b_ei() { t(DEFAULT_INCORESIZE, 0, 64); } void test_uint_0_12b_gti() { t(DEFAULT_INCORESIZE*2, 0, 64); } void test_uint_0_n12b_lti() { t(DEFAULT_INCORESIZE/64, 0, 4096); } void test_uint_0_n12b_ei() { t(DEFAULT_INCORESIZE, 0, 4096); } void test_uint_0_n12b_gti() { t(DEFAULT_INCORESIZE*2, 0, 4096); } void test_uint_p_12b_lti() { t(DEFAULT_INCORESIZE/64, 134217728, 16); } void test_uint_p_12b_ei() { t(DEFAULT_INCORESIZE, 134217728, 16); } void test_uint_p_12b_gti() { t(DEFAULT_INCORESIZE*2, 134217728, 16); } void test_uint_p_n12b_lti() { t(DEFAULT_INCORESIZE/64, 536870912, 4096); } void test_uint_p_n12b_ei() { t(DEFAULT_INCORESIZE, 536870912, 4096); } void test_uint_p_n12b_gti() { t(DEFAULT_INCORESIZE*2, 536870912, 4096); } typedef boost::int64_t int64; void test_int64_n_12b_lti() { t(DEFAULT_INCORESIZE/64, -8589934592, 8); } void test_int64_n_12b_ei() { t(DEFAULT_INCORESIZE, -8589934592, 8); } void test_int64_n_12b_gti() { t(DEFAULT_INCORESIZE*2, -8589934592, 8); } void test_int64_n_n12b_lti() { t(DEFAULT_INCORESIZE/64, -8589934592, 4096); } void test_int64_n_n12b_ei() { t(DEFAULT_INCORESIZE, -8589934592, 4096); } void test_int64_n_n12b_gti() { t(DEFAULT_INCORESIZE*2, -8589934592, 4096); } void test_int64_0_12b_lti() { t(DEFAULT_INCORESIZE/64, 0, 4); } void test_int64_0_12b_ei() { t(DEFAULT_INCORESIZE, 0, 4); } void test_int64_0_12b_gti() { t(DEFAULT_INCORESIZE*2, 0, 4); } void test_int64_0_n12b_lti() { t(DEFAULT_INCORESIZE/64, 0, 16384); } void test_int64_0_n12b_ei() { t(DEFAULT_INCORESIZE, 0, 16384); } void test_int64_0_n12b_gti() { t(DEFAULT_INCORESIZE*2, 0, 16384); } void test_int64_p_12b_lti() { t(DEFAULT_INCORESIZE/64, 17179869184, 32); } void test_int64_p_12b_ei() { t(DEFAULT_INCORESIZE, 17179869184, 32); } void test_int64_p_12b_gti() { t(DEFAULT_INCORESIZE*2, 17179869184, 32); } void test_int64_p_n12b_lti() { t(DEFAULT_INCORESIZE/64, 17179869184, 8192); } void test_int64_p_n12b_ei() { t(DEFAULT_INCORESIZE, 17179869184, 8192); } void test_int64_p_n12b_gti() { t(DEFAULT_INCORESIZE*2, 17179869184, 8192); } typedef boost::uint64_t uint64; void test_uint64_0_12b_lti() { t(DEFAULT_INCORESIZE/64, 0, 256); } void test_uint64_0_12b_ei() { t(DEFAULT_INCORESIZE, 0, 256); } void test_uint64_0_12b_gti() { t(DEFAULT_INCORESIZE*2, 0, 256); } void test_uint64_0_n12b_lti() { t(DEFAULT_INCORESIZE/64, 0, 16384); } void test_uint64_0_n12b_ei() { t(DEFAULT_INCORESIZE, 0, 16384); } void test_uint64_0_n12b_gti() { t(DEFAULT_INCORESIZE*2, 0, 16384); } void test_uint64_p_12b_lti() { t(DEFAULT_INCORESIZE/64, 268435456, 256); } void test_uint64_p_12b_ei() { t(DEFAULT_INCORESIZE, 268435456, 256); } void test_uint64_p_12b_gti() { t(DEFAULT_INCORESIZE*2, 268435456, 256); } void test_uint64_p_n12b_lti() { t(DEFAULT_INCORESIZE/64, 268435456, 4096); } void test_uint64_p_n12b_ei() { t(DEFAULT_INCORESIZE, 268435456, 4096); } void test_uint64_p_n12b_gti() { t(DEFAULT_INCORESIZE*2, 268435456, 4096); } void test_float_n_12b_lti() { t(DEFAULT_INCORESIZE/64, -16384.4f, 32.6f); } void test_float_n_12b_ei() { t(DEFAULT_INCORESIZE, -16384.4f, 32.6f); } void test_float_n_12b_gti() { t(DEFAULT_INCORESIZE*2, -16384.4f, 32.6f); } void test_float_n_n12b_lti() { t(DEFAULT_INCORESIZE/64,-50000.6f, 8168.2f);} void test_float_n_n12b_ei() { t(DEFAULT_INCORESIZE, -50000.7f, 8168.3f);} void test_float_n_n12b_gti() { t(DEFAULT_INCORESIZE*2, -50000.8f, 8168.7f);} void test_float_0_12b_lti() { t(DEFAULT_INCORESIZE/64, 0.0f, 39.6f); } void test_float_0_12b_ei() { t(DEFAULT_INCORESIZE, 0.0f, 39.6f); } void test_float_0_12b_gti() { t(DEFAULT_INCORESIZE*2, 0.0f, 39.6f); } void test_float_0_n12b_lti() { t(DEFAULT_INCORESIZE/64, 0.0f, 32768.2f); } void test_float_0_n12b_ei() { t(DEFAULT_INCORESIZE, 0.0f, 32768.3f); } void test_float_0_n12b_gti() { t(DEFAULT_INCORESIZE*2, 0.0f, 32768.7f); } void test_float_p_12b_lti() { t(DEFAULT_INCORESIZE/64, 123984.4f, 4.2f); } void test_float_p_12b_ei() { t(DEFAULT_INCORESIZE, 123984.4f, 8.6f); } void test_float_p_12b_gti() { t(DEFAULT_INCORESIZE*2, 123984.4f, 22.2f); } void test_float_p_n12b_lti() { t(DEFAULT_INCORESIZE/64,123984.4f, 3456.7f);} void test_float_p_n12b_ei() { t(DEFAULT_INCORESIZE, 123984.4f, 3456.7f);} void test_float_p_n12b_gti() { t(DEFAULT_INCORESIZE*2, 123984.4f, 3456.7f);} void test_double_n_12b_lti() { t(DEFAULT_INCORESIZE/64, -16384.4, 32.6); } void test_double_n_12b_ei() { t(DEFAULT_INCORESIZE, -16384.4, 32.6); } void test_double_n_12b_gti() { t(DEFAULT_INCORESIZE*2, -16384.4, 32.6); } void test_double_n_n12b_lti() { t(DEFAULT_INCORESIZE/64,-50000.6, 8168.2);} void test_double_n_n12b_ei() { t(DEFAULT_INCORESIZE, -50000.7, 8168.3);} void test_double_n_n12b_gti() { t(DEFAULT_INCORESIZE*2, -50000.8, 8168.7);} void test_double_0_12b_lti() { t(DEFAULT_INCORESIZE/64, 0.0, 39.6); } void test_double_0_12b_ei() { t(DEFAULT_INCORESIZE, 0.0, 39.6); } void test_double_0_12b_gti() { t(DEFAULT_INCORESIZE*2, 0.0, 39.6); } void test_double_0_n12b_lti() { t(DEFAULT_INCORESIZE/64, 0.0, 32768.2); } void test_double_0_n12b_ei() { t(DEFAULT_INCORESIZE, 0.0, 32768.3); } void test_double_0_n12b_gti() { t(DEFAULT_INCORESIZE*2, 0.0, 32768.7); } void test_double_p_12b_lti() { t(DEFAULT_INCORESIZE/64, 123984.4, 4.2); } void test_double_p_12b_ei() { t(DEFAULT_INCORESIZE, 123984.4, 8.6); } void test_double_p_12b_gti() { t(DEFAULT_INCORESIZE*2, 123984.4, 22.2); } void test_double_p_n12b_lti() { t(DEFAULT_INCORESIZE/64,123984.4, 3456.7);} void test_double_p_n12b_ei() { t(DEFAULT_INCORESIZE, 123984.4, 3456.7);} void test_double_p_n12b_gti() { t(DEFAULT_INCORESIZE*2, 123984.4, 3456.7);} // Ridiculous cases: i.e. all the same value void test_byte_neg() { t_constant(DEFAULT_INCORESIZE/64, -42); } void test_byte_0() { t_constant(DEFAULT_INCORESIZE/64, 0); } void test_byte_pos() { t_constant(DEFAULT_INCORESIZE/64, 42); } void test_ubyte_0() { t_constant(DEFAULT_INCORESIZE/64, 0); } void test_ubyte_pos() { t_constant(DEFAULT_INCORESIZE/64, 42); } void test_short_neg() { t_constant(DEFAULT_INCORESIZE/64, -5192); } void test_short_0() { t_constant(DEFAULT_INCORESIZE/64, 0); } void test_short_pos() { t_constant(DEFAULT_INCORESIZE/64, 1296); } void test_int_neg() { t_constant(DEFAULT_INCORESIZE/64, -70000); } void test_int_0() { t_constant(DEFAULT_INCORESIZE/64, 0); } void test_int_pos() { t_constant(DEFAULT_INCORESIZE/64, 52378); } void test_uint_0() { t_constant(DEFAULT_INCORESIZE/64, 0); } void test_uint_pos() { t_constant(DEFAULT_INCORESIZE/64, 213897); } void test_int64_neg() { t_constant(DEFAULT_INCORESIZE/64, -1389710); } void test_int64_0() { t_constant(DEFAULT_INCORESIZE/64, 0); } void test_int64_pos() { t_constant(DEFAULT_INCORESIZE/64, 2314987); } void test_uint64_0() { t_constant(DEFAULT_INCORESIZE/64, 0); } void test_uint64_pos() { t_constant(DEFAULT_INCORESIZE/64, 2938471); } void test_float_neg() { t_constant(DEFAULT_INCORESIZE/64, -981237.13f); } void test_float_0() { t_constant(DEFAULT_INCORESIZE/64, 0.0f); } void test_float_pos() { t_constant(DEFAULT_INCORESIZE/64, 24197.936f); } void test_double_neg() { t_constant(DEFAULT_INCORESIZE/64, -4789612.12); } void test_double_0() { t_constant(DEFAULT_INCORESIZE/64, 0.0); } void test_double_pos() { t_constant(DEFAULT_INCORESIZE/64, 14789612.2); } }; ImageVis3D-3.1.0/Tuvok/IO/test/bcache.h0000644000175000017500000000775012320456500017242 0ustar mathieumathieu#include #include #include #include "BrickCache.h" #include "Controller/Controller.h" #include "util-test.h" using namespace tuvok; // just make the object! void simple() { tuvok::BrickCache c; } void add() { BrickCache c; BrickKey k(0,0,0); std::array elems = {{9, 12, 42, 19}}; { std::vector data(4); std::copy(elems.begin(), elems.end(), data.begin()); c.add(k, data); } // what we put in should be the same coming out! const uint8_t* rv = static_cast(c.lookup(k, uint8_t(42))); TS_ASSERT(std::equal(elems.begin(), elems.end(), rv)); } // once had a bug that lookup would re-insert every entry! void lookup_bug() { BrickCache c; BrickKey k(0,0,0); std::array elems = {{9, 12, 42, 19}}; { std::vector data(4); std::copy(elems.begin(), elems.end(), data.begin()); c.add(k, data); } TS_ASSERT_EQUALS(c.size(), sizeof(uint8_t)*4); c.lookup(k, uint8_t(42)); TS_ASSERT_EQUALS(c.size(), sizeof(uint8_t)*4); c.lookup(k, uint8_t(42)); TS_ASSERT_EQUALS(c.size(), sizeof(uint8_t)*4); c.lookup(k, uint8_t(42)); TS_ASSERT_EQUALS(c.size(), sizeof(uint8_t)*4); c.remove(); TS_ASSERT_EQUALS(c.size(), 0U); } void lookup_bug16() { BrickCache c; BrickKey k(0,0,0); std::array elems = {{9, 12, 42, 19}}; { std::vector data(4); std::copy(elems.begin(), elems.end(), data.begin()); c.add(k, data); } TS_ASSERT_EQUALS(c.size(), sizeof(uint16_t)*4); c.lookup(k, uint16_t(42)); TS_ASSERT_EQUALS(c.size(), sizeof(uint16_t)*4); c.lookup(k, uint16_t(42)); TS_ASSERT_EQUALS(c.size(), sizeof(uint16_t)*4); c.lookup(k, uint16_t(42)); TS_ASSERT_EQUALS(c.size(), sizeof(uint16_t)*4); c.remove(); TS_ASSERT_EQUALS(c.size(), 0U); } void remove() { BrickCache c; BrickKey k(0,0,0); { std::vector data(1); data[0] = 42; c.add(k, data); } TS_ASSERT_EQUALS(c.size(), sizeof(uint8_t)*1); c.remove(); TS_ASSERT_EQUALS(c.size(), 0U); } void sizes() { BrickCache c; BrickKey k(0,0,0); { std::vector data(1); data[0] = 42U; c.add(k, data); } TS_ASSERT_EQUALS(c.size(), sizeof(uint32_t) * 1); c.remove(); TS_ASSERT_EQUALS(c.size(), 0U); c.remove(); TS_ASSERT_EQUALS(c.size(), 0U); } namespace { template void normal(std::vector& data, const T& mean, const T& stddev) { // double: RNGs are only defined for FP types. We'll generate double // and just cast to T. std::random_device genSeed; std::mt19937 mtwister(genSeed()); std::normal_distribution normalDist(mean, stddev); std::function getRandNormal(std::bind(normalDist, mtwister)); for(size_t i=0; i < data.size(); ++i) { T v = static_cast(getRandNormal()); data[i] = v; } } } // this is really a benchmark, not a test per se... void add_many() { BrickCache c; std::vector src(68*68*68); normal(src, uint8_t(64), uint8_t(12)); EnableDebugMessages edm; BrickKey key(0,0,0); for(size_t i=0; i < 2048; ++i) { std::vector buf(68*68*68); std::copy(src.begin(), src.end(), buf.begin()); key = std::make_tuple(0U, 0U, i); c.add(key, buf); } double cache_add = Controller::Instance().PerfQuery(PERF_DY_CACHE_ADD); double cache_lookup = Controller::Instance().PerfQuery(PERF_DY_CACHE_LOOKUP); double something = Controller::Instance().PerfQuery(PERF_SOMETHING); double bcopy = Controller::Instance().PerfQuery(PERF_DY_BRICK_COPY); fprintf(stderr, "\ncache add: %g\ncache lookup: %g\bcopy: %g\n" "something: %g\n", cache_add, cache_lookup, bcopy, something); } class BCacheTests : public CxxTest::TestSuite { public: void test_simple() { simple(); } void test_add() { add(); } void test_remove() { remove(); } void test_sizes() { sizes(); } void test_lookup_bug() { lookup_bug(); } void test_lookup_bug16() { lookup_bug16(); } // void test_add_many() { add_many(); } }; ImageVis3D-3.1.0/Tuvok/IO/VGStudioConverter.cpp0000644000175000017500000001023612320456500020776 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : VGStudioConverter.cpp //! Author : Jens Krueger //! DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : June 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #include #include "VGStudioConverter.h" #include #include #include using namespace std; VGStudioConverter::VGStudioConverter() { m_vConverterDesc = "VGStudio Data"; m_vSupportedExt.push_back("VGI"); } bool VGStudioConverter::ConvertToRAW(const std::string& strSourceFilename, const std::string&, bool, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile) { MESSAGE("Attempting to convert VGStudio dataset %s", strSourceFilename.c_str()); bDeleteIntermediateFile = false; strTitle = "VGStudio data"; iHeaderSkip = 0; bConvertEndianess = EndianConvert::IsBigEndian(); vVolumeAspect = FLOATVECTOR3(1,1,1); VGIHeaderParser parser(strSourceFilename); if (parser.FileReadable()) { KeyValPair* fileformat = parser.GetData("FILEFORMAT"); if (fileformat == NULL) { T_ERROR("Tag 'fileformat' not found!"); return false; } if (fileformat->strValueUpper != "RAW"){ T_ERROR("Currenly, only raw VGStudio files are supported!"); return false; } KeyValPair* filename = parser.GetData("NAME"); if (filename == NULL) { T_ERROR("Tag 'name' not found!"); return false; } strIntermediateFile = SysTools::GetPath(strSourceFilename) + SysTools::GetFilename(filename->strValue); KeyValPair* resolution = parser.GetData("SIZE"); if (resolution == NULL || resolution->vuiValue.size() != 3) { T_ERROR("Tag 'size' not found!"); return false; } vVolumeSize = UINT64VECTOR3(resolution->vuiValue); KeyValPair* bitsperelement = parser.GetData("BITSPERELEMENT"); if (bitsperelement == NULL) { T_ERROR("Tag 'bitsperelement' not found!"); return false; } iComponentSize = bitsperelement->iValue; KeyValPair* datatype = parser.GetData("DATATYPE"); if (datatype == NULL) { T_ERROR("Tag 'datatype' not found!"); return false; } if(datatype->strValueUpper == "UNSIGNED INTEGER") { bSigned = false; iComponentCount = 1; bIsFloat = false; } else if (datatype->strValueUpper == "FLOAT") { bSigned = true; iComponentCount = 1; bIsFloat = true; } } else return false; return true; } ImageVis3D-3.1.0/Tuvok/IO/InveonConverter.cpp0000644000175000017500000002500412320456500020527 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file InveonConverter.cpp \author Tom Fogal SCI Institute University of Utah */ #include "../StdTuvokDefines.h" #include #include #include #include #include #include #include #include "InveonConverter.h" #include "Basics/EndianConvert.h" #include "Basics/SysTools.h" InveonConverter::InveonConverter() { m_vConverterDesc = "Inveon"; m_vSupportedExt.push_back("HDR"); } typedef std::unordered_map LineMap; // The 'hdr' files we are given consist of a series of lines which begin with a // keyword, and then a series of space-separated parameters. This searches for // lines which begin with the strings in the keys of the map, and fills the // values with the rest of the lines. // Ex: a stream consists of: // abc 42 // def 19 // qwerty 12.5512 123 // foo bar // then if the input map contains: // "abc":"" // "qwerty":"" // "foo":"" // then the output map will contain: // "abc":"42" // "qwerty":"12.5512 123" // "foo":"bar" static void findlines(std::ifstream& ifs, LineMap& values) { ifs.seekg(0); std::string line; while(ifs) { if(getline(ifs, line)) { // iterate through all our keys and see if the line begins with // any of them. for(LineMap::iterator l = values.begin(); l != values.end(); ++l) { if(line.find(l->first) == 0) { l->second = line.substr(l->first.length()+1); // +1: skip space. } } } } } namespace { template T convert(const std::string& s) { T t; std::istringstream conv(s); conv >> t; return t; } } bool InveonConverter::ConvertToRAW(const std::string& strSourceFilename, const std::string&, bool /* bNoUserInteraction */, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile) { std::ifstream infn(strSourceFilename.c_str(), std::ios::in); if(!infn.is_open()) { T_ERROR("Could not open %s", strSourceFilename.c_str()); return false; } iHeaderSkip = 0; iComponentCount = 1; bDeleteIntermediateFile = false; bSigned = true; // format does not distinguish strTitle = "Inveon"; // The filename is actually stored in the header, but it includes // a full pathname and is thus garbage in many instances; e.g. the // files I have say: "F:/somefolder/xyz/blah/whatever/file.ct.img", // and I'm on a Unix system, so "F:" doesn't even make sense. // Therefore we just ignore the filename in the header and use the // "hdr" filename sans the "hdr" extension, which seems to be the // convention. strIntermediateFile = SysTools::RemoveExt(strSourceFilename); LineMap lines; lines.insert(LineMap::value_type("version","")); lines.insert(LineMap::value_type("number_of_dimensions","")); lines.insert(LineMap::value_type("x_dimension","")); lines.insert(LineMap::value_type("y_dimension","")); lines.insert(LineMap::value_type("z_dimension","")); lines.insert(LineMap::value_type("pixel_size_x","")); lines.insert(LineMap::value_type("pixel_size_y","")); lines.insert(LineMap::value_type("pixel_size_z","")); lines.insert(LineMap::value_type("data_type","")); findlines(infn, lines); for(LineMap::const_iterator l = lines.begin(); l != lines.end(); ++l) { MESSAGE("read %s -> '%s'", l->first.c_str(), l->second.c_str()); if(l->first == "version" && l->second != "001.910") { WARNING("Unknown version. Attempting to continue, but I might " "be interpreting this file incorrectly."); } else if(l->first == "number_of_dimensions" && l->second != "3") { WARNING("%s dimensions instead of 3; continuing anyway...", l->second.c_str()); } else if(l->first == "x_dimension") { vVolumeSize[0] = convert(l->second); } else if(l->first == "y_dimension") { vVolumeSize[1] = convert(l->second); } else if(l->first == "z_dimension") { vVolumeSize[2] = convert(l->second); } else if(l->first == "pixel_size_x") { vVolumeAspect[0] = convert(l->second); } else if(l->first == "pixel_size_y") { vVolumeAspect[1] = convert(l->second); } else if(l->first == "pixel_size_z") { vVolumeAspect[2] = convert(l->second); } else if(l->first == "data_type") { size_t type = convert(l->second); switch(type) { case 1: // byte iComponentSize = 8; bConvertEndianess = false; bIsFloat = false; break; case 2: // 2-byte integer, intel style iComponentSize = 16; bConvertEndianess = EndianConvert::IsBigEndian(); bIsFloat = false; break; case 3: // 4-byte integer, intel style iComponentSize = 32; bConvertEndianess = EndianConvert::IsBigEndian(); bIsFloat = false; break; case 4: // 4-byte float, intel style iComponentSize = 32; bConvertEndianess = EndianConvert::IsBigEndian(); bIsFloat = true; break; case 5: // 4-byte float, sun style iComponentSize = 32; bConvertEndianess = !EndianConvert::IsBigEndian(); bIsFloat = true; break; case 6: // 2-byte integer, sun style iComponentSize = 16; bConvertEndianess = !EndianConvert::IsBigEndian(); bIsFloat = false; break; case 7: // 4-byte integer, sun style iComponentSize = 32; bConvertEndianess = !EndianConvert::IsBigEndian(); bIsFloat = false; break; default: T_ERROR("Unknown data type %u", static_cast(type)); return false; break; } } } return true; } bool InveonConverter::ConvertToNative( const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bIsFloat, UINT64VECTOR3 vVolumeSize, FLOATVECTOR3 vVolumeAspect, bool bNoUserInteraction, const bool bQuantizeTo8Bit) { std::ofstream hdr(strTargetFilename.c_str(), std::ios::out); if(!hdr.is_open()) { T_ERROR("Unable to open target file %s", strTargetFilename.c_str()); return false; } hdr << "#\n" // we use this to check if it's an Inveon file << "version 001.910\n" << "number_of_dimensions 3\n" << "x_dimension " << vVolumeSize[0] << "\n" << "y_dimension " << vVolumeSize[1] << "\n" << "z_dimension " << vVolumeSize[2] << "\n" << "pixel_size_x " << vVolumeAspect[0] << "\n" << "pixel_size_y " << vVolumeAspect[1] << "\n" << "pixel_size_z " << vVolumeAspect[2] << "\n" << "data_type "; if(iComponentSize == 8) { hdr << "1\n"; } else if(iComponentSize == 16 && EndianConvert::IsBigEndian()) { hdr << "2\n"; } else if(iComponentSize == 32 && EndianConvert::IsBigEndian() && !bIsFloat) { hdr << "3\n"; } else if(iComponentSize == 32 && EndianConvert::IsBigEndian() && bIsFloat) { hdr << "4\n"; } else if(iComponentSize == 32 && !EndianConvert::IsBigEndian() && bIsFloat) { hdr << "5\n"; } else if(iComponentSize == 16 && !EndianConvert::IsBigEndian() && !bIsFloat) { hdr << "6\n"; } else if(iComponentSize == 32 && !EndianConvert::IsBigEndian() && !bIsFloat) { hdr << "7\n"; } else { T_ERROR("Unknown data type!\n"); hdr << "0\n"; } std::string data_file = SysTools::RemoveExt(strTargetFilename.c_str()); if(!RAWConverter::ConvertToNative( strRawFilename, data_file, iHeaderSkip, iComponentSize, iComponentCount, bSigned, bIsFloat, vVolumeSize, vVolumeAspect, bNoUserInteraction, bQuantizeTo8Bit)) { T_ERROR("Error creating raw file '%s'", data_file.c_str()); remove(data_file.c_str()); return false; } return true; } // checks for comment lines, ascii. bool InveonConverter::CanRead(const std::string&, const std::vector& start) const { using namespace std::placeholders; std::string as_string( static_cast(&*start.begin()), static_cast(&*(start.end()-1)) ); if(as_string.find("Header") == std::string::npos) { MESSAGE("No 'Header' in our header... not mine."); return false; } // Are there any non-ascii characters? std::vector::const_iterator notascii = std::find_if( start.begin(), start.end(), std::bind( std::not_equal_to(), std::bind(isascii, _1), 1 ) ); // first char is nothing/comment, and we couldn't find a character // which wasn't ascii. return (std::isspace(static_cast(static_cast(start[0]))) || static_cast(start[0]) == '#') && notascii == start.end(); } ImageVis3D-3.1.0/Tuvok/IO/gzio.h0000644000175000017500000000371712320456500016025 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifndef IV3D_GZIO_H #define IV3D_GZIO_H #include #include "3rdParty/zlib/zlib.h" #ifdef __cplusplus extern "C" { #endif /* Decompress from file source to file dest until stream ends or EOF. inf() returns Z_OK on success, Z_MEM_ERROR if memory could not be allocated for processing, Z_DATA_ERROR if the deflate data is invalid or incomplete, Z_VERSION_ERROR if the version of zlib.h and the version of the library linked do not match, or Z_ERRNO if there is an error reading or writing the files. */ int gz_inflate(FILE *source, FILE *dest); /** Reads the gzip header; inflate apparently doesn't like to read this. */ void gz_skip_header(FILE *fs); #ifdef __cplusplus } #endif #endif /* IV3D_GZIO_H */ ImageVis3D-3.1.0/Tuvok/IO/AbstrGeoConverter.h0000644000175000017500000000675312320456500020456 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : AbstrGeoConverter.h //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #pragma once #ifndef TUVOK_ABSTRGEOCONVERTER_H #define TUVOK_ABSTRGEOCONVERTER_H #include "../StdTuvokDefines.h" #include #include #include #include "Basics/Vectors.h" namespace tuvok { typedef std::vector VertVec; typedef std::vector IndexVec; class Mesh; class AbstrGeoConverter { public: virtual ~AbstrGeoConverter() {} virtual std::shared_ptr ConvertToMesh( const std::string& strRawFilename ); virtual bool ConvertToNative(const Mesh& m, const std::string& strTargetFilename); /// @param filename the file in question /// @return SupportedExtension() for the file's extension virtual bool CanRead(const std::string& fn) const; const std::vector& SupportedExt() const { return m_vSupportedExt; } const std::string& GetDesc() const { return m_vConverterDesc; } virtual bool CanExportData() const { return false; } virtual bool CanImportData() const { return false; } protected: /// @param ext the extension for the filename /// @return true if the filename is a supported extension for this converter bool SupportedExtension(const std::string& ext) const; void SortByGradient(const VertVec& vertices, IndexVec& v, IndexVec& n, IndexVec& t, IndexVec& c); std::string m_vConverterDesc; std::vector m_vSupportedExt; void AddToMesh(const VertVec& vertices, IndexVec& v, IndexVec& n, IndexVec& t, IndexVec& c, IndexVec& VertIndices, IndexVec& NormalIndices, IndexVec& TCIndices, IndexVec& COLIndices); // parser helper std::string TrimToken(const std::string& Src, const std::string& delim = " \r\n\t", bool bOnlyFirst = false); std::string GetToken(std::string& Src, const std::string& delim = " \r\n\t", bool bOnlyFirst = false); }; } #endif // TUVOK_ABSTRGEOCONVERTER_H ImageVis3D-3.1.0/Tuvok/IO/AmiraConverter.h0000644000175000017500000000566412320456500020001 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef TUVOK_AMIRA_CONVERTER_H #define TUVOK_AMIRA_CONVERTER_H #include "RAWConverter.h" /// A converter for Amira files, we think. class AmiraConverter : public RAWConverter { public: AmiraConverter(); virtual ~AmiraConverter() {} virtual bool CanRead(const std::string& fn, const std::vector& start) const; virtual bool ConvertToRAW(const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianness, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile); virtual bool ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize, FLOATVECTOR3 vVolumeAspect, bool bNoUserInteraction, const bool bQuantizeTo8Bit); virtual bool CanExportData() const { return false; } virtual bool CanImportData() const { return true; } }; #endif // TUVOK_AMIRA_CONVERTER_H ImageVis3D-3.1.0/Tuvok/IO/TuvokSizes.h0000644000175000017500000000305412320456500017175 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifndef TUVOK_SIZES_H #define TUVOK_SIZES_H const unsigned int DEFAULT_BRICKSIZE = 256; const unsigned int DEFAULT_BUILDER_BRICKSIZE = 64; const unsigned int DEFAULT_BRICKOVERLAP = 2; const unsigned int DEFAULT_INCORESIZE = DEFAULT_BRICKSIZE * DEFAULT_BRICKSIZE * DEFAULT_BRICKSIZE; #endif /* TUVOK_SIZES_H */ ImageVis3D-3.1.0/Tuvok/IO/MedAlyVisGeoConverter.h0000644000175000017500000000364312320456500021233 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : MedAlyVisGeoConverter.h //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #pragma once #ifndef MEDALYVISGEOCONVERTER_H #define MEDALYVISGEOCONVERTER_H #include "../StdTuvokDefines.h" #include "AbstrGeoConverter.h" namespace tuvok { class MedAlyVisGeoConverter : public AbstrGeoConverter { public: MedAlyVisGeoConverter(); virtual ~MedAlyVisGeoConverter() {} virtual std::shared_ptr ConvertToMesh(const std::string& strFilename); virtual bool CanImportData() const { return true; } }; } #endif // MEDALYVISGEOCONVERTER_H ImageVis3D-3.1.0/Tuvok/IO/VGIHeaderParser.cpp0000644000175000017500000000613612320456500020321 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : VGIHeaderParser.cpp //! Author : Jens Krueger //! DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : June 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #include "VGIHeaderParser.h" #include #include #include #include "Basics/SysTools.h" using namespace std; using namespace SysTools; VGIHeaderParser::VGIHeaderParser(const string& strFilename) { m_bFileReadable = ParseFile(strFilename); } VGIHeaderParser::VGIHeaderParser(const wstring& wstrFilename) { string strFilename(wstrFilename.begin(), wstrFilename.end()); m_bFileReadable = ParseFile(strFilename); } VGIHeaderParser::VGIHeaderParser(ifstream& fileData) { m_bFileReadable = ParseFile(fileData); } VGIHeaderParser::~VGIHeaderParser() { } bool VGIHeaderParser::ParseFile(const std::string& strFilename) { ifstream fileData(strFilename.c_str(),ios::binary); bool result = ParseFile(fileData); fileData.close(); return result; } bool VGIHeaderParser::ParseFile(ifstream& fileData) { string line; m_iStopPos = 0; if (fileData.is_open()) { WaitForSection(fileData,"{volume1}"); WaitForSection(fileData,"[file1]"); ParseUntilInvalid(fileData); } else return false; return true; } void VGIHeaderParser::WaitForSection(ifstream& fileData, const string& match) { string line; while (! fileData.eof() ) { getline (fileData,line); if (TrimStr(line) == match) return; } } void VGIHeaderParser::ParseUntilInvalid(ifstream& fileData) { string line; m_iStopPos = 0; if (fileData.is_open()) { bool bContinue = true; while (! fileData.eof() && bContinue ) { getline (fileData,line); bContinue = ParseKeyValueLine(line, false, true, "=", ""); if (!bContinue) m_iStopPos = static_cast(fileData.tellg()); } } } ImageVis3D-3.1.0/Tuvok/IO/VGStudioConverter.h0000644000175000017500000000474412320456500020452 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : VGStudioConverter.h //! Author : Jens Krueger //! DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : June 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #pragma once #ifndef VGSTUDIOCONVERTER_H #define VGSTUDIOCONVERTER_H #include "../StdTuvokDefines.h" #include "RAWConverter.h" class VGStudioConverter : public RAWConverter { public: VGStudioConverter(); virtual ~VGStudioConverter() {} virtual bool ConvertToRAW(const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile); virtual bool CanExportData() const { return false; } virtual bool CanImportData() const { return true; } }; #endif // VGSTUDIOCONVERTER_H ImageVis3D-3.1.0/Tuvok/IO/StkConverter.h0000644000175000017500000000620112320456500017475 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file StkConverter.h \author Tom Fogal SCI Institute University of Utah */ #pragma once #ifndef STKCONVERTER_H #define STKCONVERTER_H #include "../StdTuvokDefines.h" #include "RAWConverter.h" /** A converter for `stk' files, created by the Metamorph software. These are * basically TiffVolumes, in that they are embedded in a TIFF container within * a single file. Unfortunately they don't use the standard TIFF mechanisms to * specify data or metadata. */ class StkConverter : public RAWConverter { public: StkConverter(); virtual ~StkConverter() {} virtual bool ConvertToRAW(const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile); /// unimplemented! virtual bool ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize, FLOATVECTOR3 vVolumeAspect, bool bNoUserInteraction, const bool bQuantizeTo8Bit); virtual bool CanExportData() const { return false; } virtual bool CanImportData() const { return true; } }; #endif // STKCONVERTER_H ImageVis3D-3.1.0/Tuvok/IO/const-brick-iterator.cpp0000644000175000017500000002334312320456500021452 0ustar mathieumathieu#include #include #include "Basics/MathTools.h" #include "const-brick-iterator.h" namespace tuvok { // converts a 3D index ('loc') into a 1D index. static uint64_t to1d(const std::array& loc, const std::array& size) { return loc[2]*size[1]*size[0] + loc[1]*size[0] + loc[0]; } // just converts a 3-element array into a UINTVECTOR3. static UINTVECTOR3 va(const std::array& a) { return UINTVECTOR3(a[0], a[1], a[2]); } /// @param l the current location, in brick coords /// @param bsz size of the bricks /// @param voxels number of voxels /// @returns the number of voxels 'l' has. this is normally 'bsz', but can be /// smaller when the 'l' abuts the side of a dimension static std::array nvoxels(const std::array l, const std::array bsz, const std::array voxels) { // the brick starts at 'v' and goes to 'v+bricksize'. But 'v+bricksize' // might exceed beyond the bounds of the domain ('voxels'), and therefore // it should shrink. std::array v = {{ l[0] * bsz[0], l[1] * bsz[1], l[2] * bsz[2] }}; const std::array difference = {{ static_cast(voxels[0] - v[0]), static_cast(voxels[1] - v[1]), static_cast(voxels[2] - v[2]) }}; // get a uint32 version so we don't have to cast w/ e.g. min below. const std::array bs = {{ static_cast(bsz[0]), static_cast(bsz[1]), static_cast(bsz[2]), }}; std::array nvox = {{ difference[0] ? std::min(bs[0], difference[0]) : bs[0], difference[1] ? std::min(bs[1], difference[1]) : bs[1], difference[2] ? std::min(bs[2], difference[2]) : bs[2], }}; return nvox; } // The dimension with the largest ratio of size-to-bricksize #define DIM \ (vox[0] / bsize[0] > vox[1] / bsize[1] ? \ (vox[0] / bsize[0] > vox[2] / bsize[2] ? 0 : 2) \ : (vox[1] / bsize[1] > vox[2] / bsize[2] ? 1 : 2)) const_brick_iterator::const_brick_iterator( const std::array& vox, const std::array& bricksize, const std::array,2>& exts ) : bsize(bricksize), // a bit intense for an initializer list, but it needs to be here so this // can be const. MaxLODs(static_cast(ceil(double(vox[DIM]) / bricksize[DIM]))), voxels(vox), LOD(0), extents(exts) #undef DIM { location[0] = location[1] = location[2] = 1ULL; } /// gives the brick layout for a given decomposition. i.e. the number of bricks /// in each dimension static std::array layout(const std::array voxels, const std::array bsize) { std::array tmp = {{ static_cast(ceil(static_cast(voxels[0]) / bsize[0])), static_cast(ceil(static_cast(voxels[1]) / bsize[1])), static_cast(ceil(static_cast(voxels[2]) / bsize[2])), }}; return tmp; } const_brick_iterator& const_brick_iterator::advance() { // the layout for this level const std::array ly = layout(this->voxels, this->bsize); // increment the x coord. if it goes beyond the end, then switch to // Y... and so on. this->location[0]++; if(this->location[0] > ly[0]) { this->location[0] = 1; this->location[1]++; } if(this->location[1] > ly[1]) { this->location[1] = 1; this->location[2]++; } if(this->location[2] > ly[2]) { this->location[2] = 1; this->LOD++; // we also have to decrease the number of voxels for the new level this->voxels[0] = voxels[0] /= 2; if(voxels[0] == 0) { voxels[0] = 1; } this->voxels[1] = voxels[1] /= 2; if(voxels[1] == 0) { voxels[1] = 1; } this->voxels[2] = voxels[2] /= 2; if(voxels[2] == 0) { voxels[2] = 1; } } if(this->LOD >= this->MaxLODs) { // invalidate the iterator. this->voxels[0] = this->voxels[1] = this->voxels[2] = 0ULL; this->location[0] = this->location[1] = this->location[2] = 0ULL; } return *this; } const_brick_iterator& const_brick_iterator::operator++() { return this->advance(); } const std::pair const_brick_iterator::dereference() const { const size_t timestep = 0; // unsupported/unimplemented. std::array loc_sub1 = {{ this->location[0] - 1, this->location[1] - 1, this->location[2] - 1 }}; uint64_t index = to1d( loc_sub1, layout(this->voxels, this->bsize) ); BrickKey bk(timestep, this->LOD, index); FLOATVECTOR3 exts, center; { // what percentage of the way through the volume are we? const std::array vlow = {{ loc_sub1[0] * this->bsize[0], loc_sub1[1] * this->bsize[1], loc_sub1[2] * this->bsize[2] }}; // the high coord is the low coord + the number of voxels in the brick const std::array bsz = nvoxels(loc_sub1, this->bsize, this->voxels); const std::array vhigh = {{ vlow[0]+bsz[0], vlow[1]+bsz[1], vlow[2]+bsz[2] }}; // where the center of this brick would be, in voxels. note this is FP: // the 'center' could be a half-voxel in, if the brick has an odd number of // voxels. const std::array vox_center = {{ ((vhigh[0]-vlow[0])/2.0f) + vlow[0], ((vhigh[1]-vlow[1])/2.0f) + vlow[1], ((vhigh[2]-vlow[2])/2.0f) + vlow[2], }}; const std::array voxelsf = {{ // for type purposes. static_cast(this->voxels[0]), static_cast(this->voxels[1]), static_cast(this->voxels[2]) }}; assert(vox_center[0] < voxelsf[0]); assert(vox_center[1] < voxelsf[1]); assert(vox_center[2] < voxelsf[2]); // we know the center in voxels, and we know the width of the domain in // world space. interpolate to get the center in world space. center = FLOATVECTOR3( MathTools::lerp(vox_center[0], 0.0f,voxelsf[0], this->extents[0][0], this->extents[1][0]), MathTools::lerp(vox_center[1], 0.0f,voxelsf[1], this->extents[0][1], this->extents[1][1]), MathTools::lerp(vox_center[2], 0.0f,voxelsf[2], this->extents[0][2], this->extents[1][2]) ); assert(extents[0][0] <= center[0] && center[0] <= extents[1][0]); assert(extents[0][1] <= center[1] && center[1] <= extents[1][1]); assert(extents[0][2] <= center[2] && center[2] <= extents[1][2]); const uint64_t zero = 0ULL; // for type purposes. const FLOATVECTOR3 wlow( MathTools::lerp(vlow[0], zero,this->voxels[0], this->extents[0][0],this->extents[1][0]), MathTools::lerp(vlow[1], zero,this->voxels[1], this->extents[0][1],this->extents[1][1]), MathTools::lerp(vlow[2], zero,this->voxels[2], this->extents[0][2],this->extents[1][2]) ); const FLOATVECTOR3 whigh( MathTools::lerp(vhigh[0], zero,this->voxels[0], this->extents[0][0],this->extents[1][0]), MathTools::lerp(vhigh[1], zero,this->voxels[1], this->extents[0][1],this->extents[1][1]), MathTools::lerp(vhigh[2], zero,this->voxels[2], this->extents[0][2],this->extents[1][2]) ); exts = FLOATVECTOR3(whigh[0]-wlow[0], whigh[1]-wlow[1], whigh[2]-wlow[2]); assert(exts[0] <= (this->extents[1][0]-this->extents[0][0])); assert(exts[1] <= (this->extents[1][1]-this->extents[0][1])); assert(exts[2] <= (this->extents[1][2]-this->extents[0][2])); } UINTVECTOR3 nvox = va(nvoxels(loc_sub1, this->bsize, this->voxels)); BrickMD md = { center, exts, nvox }; return std::make_pair(bk, md); } const std::pair const_brick_iterator::operator*() const { return this->dereference(); } bool const_brick_iterator::equals(const const_brick_iterator& iter) const { return this->location == iter.location; } bool const_brick_iterator::operator==(const const_brick_iterator& that) const { return this->equals(that); } bool const_brick_iterator::operator!=(const const_brick_iterator& that) const { return !this->equals(that); } const_brick_iterator begin(const std::array& voxels, const std::array& bricksize, const std::array,2>& extents) { return const_brick_iterator(voxels, bricksize, extents); } const_brick_iterator end() { return const_brick_iterator(); } } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2013 IVDA Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/gzio.c0000644000175000017500000001214412320456500016012 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include "gzio.h" #ifdef WIN32 #pragma warning( disable : 4706) // disable "assignment in conditional" warning #endif #define CHUNK (1024 * 1024 * 64) /* Decompress from file source to file dest until stream ends or EOF. inf() returns Z_OK on success, Z_MEM_ERROR if memory could not be allocated for processing, Z_DATA_ERROR if the deflate data is invalid or incomplete, Z_VERSION_ERROR if the version of zlib.h and the version of the library linked do not match, or Z_ERRNO if there is an error reading or writing the files. */ int gz_inflate(FILE *source, FILE *dest) { int ret; unsigned have; z_stream strm; unsigned char *in = malloc(CHUNK); unsigned char *out = malloc(CHUNK); /* allocate inflate state */ strm.zalloc = Z_NULL; strm.zfree = Z_NULL; strm.opaque = Z_NULL; strm.avail_in = 0; strm.next_in = Z_NULL; ret = inflateInit2(&strm, -MAX_WBITS); if (ret != Z_OK) { free(in); free(out); return ret; } /* decompress until deflate stream ends or end of file */ do { strm.avail_in = (uInt)fread(in, 1, CHUNK, source); if (ferror(source)) { (void)inflateEnd(&strm); free(in); free(out); return Z_ERRNO; } if (strm.avail_in == 0) break; strm.next_in = in; /* run inflate() on input until output buffer not full */ do { strm.avail_out = CHUNK; strm.next_out = out; ret = inflate(&strm, Z_NO_FLUSH); assert(ret != Z_STREAM_ERROR); /* state not clobbered */ switch (ret) { case Z_NEED_DICT: ret = Z_DATA_ERROR; /* and fall through */ case Z_DATA_ERROR: case Z_MEM_ERROR: (void)inflateEnd(&strm); free(in); free(out); return ret; } have = CHUNK - strm.avail_out; if (fwrite(out, 1, have, dest) != have || ferror(dest)) { (void)inflateEnd(&strm); free(in); free(out); return Z_ERRNO; } } while (strm.avail_out == 0); /* done when inflate() says it's done */ } while (ret != Z_STREAM_END); /* clean up and return */ (void)inflateEnd(&strm); free(in); free(out); return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR; } /* gzip flag byte */ enum GZFlags { GZ_TEXT = 0x01, GZ_HDR_CRC = 0x02, GZ_EXTRA = 0x04, GZ_NAME = 0x08, GZ_COMMENT = 0x10, GZ_RESERVED1 = 0x10, GZ_RESERVED2 = 0x20, GZ_RESERVED3 = 0x40 }; void gz_skip_header(FILE *fs) { int byte; int flags; size_t i; byte = fgetc(fs); assert(byte == 0x1f); byte = fgetc(fs); assert(byte == 0x8b); byte = fgetc(fs); /* `method' byte */ assert(byte = Z_DEFLATED); flags = fgetc(fs); /* gzip header flags, details `members' */ /** skip 6 bytes of worthless metadata? */ for(i=0; i < 6; ++i) { fgetc(fs); } /** if there's an `extra' member, it's a length followed by a payload. * skip it. */ if((flags & GZ_EXTRA) != 0) { size_t len = fgetc(fs); len += (fgetc(fs) << 8); // skip len bytes, or the rest of the file, whichever is first. while(len-- != 0 && fgetc(fs) != EOF); } /* if there's a `name' member, it's a null terminated string. */ if((flags & GZ_NAME) != 0) { while((byte = fgetc(fs)) && byte != EOF); } /* likewise with the `comment' member. */ if((flags & GZ_COMMENT) != 0) { while((byte = fgetc(fs)) && byte != EOF); } /* the CRC is somehow optional... we should probably store this so we can * check it later, but we ignore it for now ... */ if((flags & GZ_HDR_CRC)) { fgetc(fs); fgetc(fs); } } ImageVis3D-3.1.0/Tuvok/IO/Quantize.h0000644000175000017500000005643412320456500016661 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2009 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifndef SCIO_QUANTIZE_H #define SCIO_QUANTIZE_H #include #include #include #include #include #include #include "Basics/BStream.h" #include "Basics/LargeRAWFile.h" #include "Basics/ctti.h" #include "UVF/Histogram1DDataBlock.h" #include "TuvokSizes.h" #include "AbstrConverter.h" namespace { // force internal linkage. // Figure out what factor we should multiply each element in the data set by // to quantize it. template double QuantizationFactor(size_t max_out, const T& mn, const T& mx) { double quant = max_out / (static_cast(mx) - mn); // ensure we don't "stretch" the data values, only "compress" them if // necessary. return std::min(quant, 1.0); } // For FP data we allow the range to be stretched. Even if the // max/min range is 0.3, we could still have a million different // values in there. Attempting to `compress' the range and that to // integers is going to leave us with 1 value. template <> double QuantizationFactor(size_t max_out, const float& mn, const float& mx) { return max_out / (mx - mn); } // Side note: we use references here because constant template parameters // must be integral or reference types. template <> double QuantizationFactor(size_t max_out, const double& mn, const double& mx) { return max_out / (mx - mn); } /// We'll need a bin for each unique value of in the data... but /// we can't easily compute that when the type is FP. Just punt /// in that case. ///@{ template size_t bins_needed(std::pair minmax) { return static_cast(minmax.second-minmax.first) + 1; } template<> size_t bins_needed(std::pair) { return std::numeric_limits::max(); } template<> size_t bins_needed(std::pair) { return std::numeric_limits::max(); } ///@} } // For minmax ranges, we want to initialize the "max" to be the smallest value // which can be held by the type. e.g. a `short' should get -32768, whereas // an `unsigned short' should get 0. namespace { template T initialmax(const unsigned_type&) { return 0; } template T initialmax(const signed_type&) { return -(std::numeric_limits::max()+1); } } /// Progress policies. Must implement a constructor and `notify' method which /// both take a `T'. The constructor is given the max value; the notify method /// is given the current value. /// NullProgress -- nothing, use when you don't care. /// TuvokProgress -- forward progress info to Tuvok debug logs. ///@{ template struct NullProgress { NullProgress() {}; NullProgress(T) {}; static void notify(T) {} }; template struct TuvokProgress { TuvokProgress(T total) : tMax(total) {} void notify(const std::string& operation, T current) const { assert(current <= tMax); MESSAGE("%s (%5.3f%% complete).", operation.c_str(), static_cast(current) / static_cast(tMax)*100.0); } private: T tMax; }; ///@} /// Data source policies. Must implement: /// constructor: takes an opened file. /// size(): returns the number of elements in the file. /// read(data, e): reads `e' elements into `data'. Returns number of elems /// actually read. /// To emphasize: These always work with the number of *elements*, NOT the /// number of bytes!!! /// ios_data_src -- data source for C++ iostreams. /// raw_data_src -- data source for Basics' LargeRAWFile. ///@{ template struct ios_data_src { ios_data_src(std::ifstream& fs) : ifs(fs) { if(!ifs.is_open()) { throw std::runtime_error(__FILE__); } ifs.seekg(0, std::ios::cur); } uint64_t size() { std::streampos cur = ifs.tellg(); ifs.seekg(0, std::ios::end); uint64_t retval = ifs.tellg(); ifs.seekg(cur, std::ios::beg); return retval/sizeof(T); } size_t read(unsigned char *data, size_t max_elems) { const size_t max_bytes = max_elems * sizeof(T); ifs.read(reinterpret_cast(data), std::streamsize(max_bytes)); return ifs.gcount()/sizeof(T); } private: std::ifstream& ifs; const char *filename; }; template struct raw_data_src { raw_data_src(LargeRAWFile& r) : raw(r) { if(!raw.IsOpen()) { throw std::runtime_error(__FILE__); } reset(); } uint64_t size() { return raw.GetCurrentSize() / sizeof(T); } size_t read(unsigned char *data, size_t max_elems) { return raw.ReadRAW(data, max_elems*sizeof(T))/sizeof(T); } void reset() { raw.SeekStart(); } private: LargeRAWFile& raw; }; template struct multi_raw_data_src { multi_raw_data_src(std::vector f) : files(f), cur_file(0), total_size(0) { for(std::vector::const_iterator rf = files.begin(); rf != files.end(); ++rf) { if(!rf->IsOpen()) { throw std::runtime_error(__FILE__ ": file not open"); } } } uint64_t size() { if(total_size == 0) { for(std::vector::iterator rf = files.begin(); rf != files.end(); ++rf) { total_size += rf->GetCurrentSize() / sizeof(T); } } return total_size; } size_t read(unsigned char *data, size_t max_bytes) { size_t bytes = files[cur_file].ReadRAW(data, max_bytes); while(bytes == 0) { cur_file++; if(cur_file >= files.size()) { return 0; } bytes = files[cur_file].ReadRAW(data, max_bytes); } return bytes / sizeof(T); } private: std::vector files; size_t cur_file; uint64_t total_size; }; ///@} /// If we just do a standard "is the value of type T <= 4096?" then compilers /// complain with 8bit types because the comparison is always true. Great, /// thanks, I didn't know that. So, this basically gets around a warning. /// I love C++ sometimes. namespace { namespace Fits { template bool inXBits(T v) { return v < static_cast(sz); } template<> bool inXBits(int8_t) { return true; } template<> bool inXBits(int8_t) { return true; } template<> bool inXBits(uint8_t) { return true; } template<> bool inXBits(uint8_t) { return true; } } } /// Histogram policies. minmax can sometimes compute a 1D histogram as it /// marches over the data. It may happen that the data must be quantized /// though, forcing the histogram to be recalculated. /// Must implement: /// bin(T): bin the given value. return false if we shouldn't bother /// computing the histogram anymore. template struct NullHistogram { static bool bin(T) { return false; } }; // Calculate a 12Bit histogram, but when we encounter a value which does not // fit (i.e., we know we'll need to quantize), don't bother anymore. template struct UnsignedHistogram { UnsignedHistogram(std::vector& h) : histo(h), calculate(true) {} bool bin(T value) { if(!calculate || !Fits::inXBits(value)) { calculate = false; } else { update(value); } return calculate; } void update(T value) { // Calculate our bias factor up front. typename ctti::size_type bias; bias = static_cast::size_type>( std::fabs(static_cast( initialmax(type_category(T())) )) ); typename ctti::size_type u_value; u_value = ctti::is_signed ? value + bias : value; // Either the data are unsigned, or there exist no values s.t. the value // plus the bias is negative (and therefore *this* value + the bias is // nonnegative). // Unfortunately we can't assert this since compilers are too dumb: with // an unsigned T, they complain that "value+bias >= 0 is always true", // despite the fact that the comparison would never happen for unsigned // values. // assert(!ctti::is_signed || (ctti::is_signed && ((value+bias) >= 0))); if(u_value < histo.size()) { ++histo[static_cast(u_value)]; } } private: std::vector& histo; bool calculate; }; /// Computes the minimum and maximum of a conceptually one dimensional dataset. /// Takes policies to tell it how to access data && notify external entities of /// progress. namespace { template class DataSrc, template class Histogram, class Progress> std::pair io_minmax(DataSrc ds, Histogram histogram, const Progress& progress, uint64_t iElems, size_t iCurrentInCoreSizeBytes) { const size_t InCoreElems = iCurrentInCoreSizeBytes / sizeof(T); std::vector data(InCoreElems); uint64_t iPos = 0; // Default min is the max value representable by the data type. Default max // is the smallest value representable by the data type. std::pair t_minmax(std::numeric_limits::max(), initialmax(type_category(T()))); // ... but if the data type is unsigned, the correct default 'max' is 0. if(!ctti::is_signed) { t_minmax.second = std::numeric_limits::min(); // ... == 0. } while(iPos < iElems) { size_t n_records = ds.read( (unsigned char*)(&(data.at(0))), std::min(static_cast(iElems-iPos), InCoreElems) ); if(n_records == 0) { WARNING("Short file during minmax (%llu of %llu)", iPos, iElems); break; // bail out if the read gave us nothing. } data.resize(n_records); iPos += uint64_t(n_records); assert(iPos <= iElems); progress.notify("Computing value range", iPos); typedef typename std::vector::const_iterator iterator; std::pair cur_mm = std::minmax_element(data.begin(), data.end()); t_minmax.first = std::min(t_minmax.first, *cur_mm.first); t_minmax.second = std::max(t_minmax.second, *cur_mm.second); // Run over the data again and bin the data for the histogram. for(size_t i=0; i < n_records && histogram.bin(data[i]); ++i) { } } assert(iPos == iElems); MESSAGE("min/max is: [%g:%g]", static_cast(t_minmax.first), static_cast(t_minmax.second)); return t_minmax; } /// @returns false on error; true if we successfully generated /// 'strTargetFilename'. template static bool ApplyMapping(const uint64_t iElems, const size_t iCurrentInCoreSizeBytes, raw_data_src& ds, const std::string& strTargetFilename, std::map& binAssignments, Histogram1DDataBlock* Histogram1D, TuvokProgress progress) { const size_t iCurrentInCoreElems = iCurrentInCoreSizeBytes / sizeof(U); ds.reset(); LargeRAWFile TargetData(strTargetFilename); TargetData.Create(); std::vector targetData(iCurrentInCoreElems); std::vector sourceData(iCurrentInCoreElems); uint64_t iPos = 0; assert(iElems > 0); // our minmax assert later will fail anyway, if false. while(iPos < iElems) { size_t n_records = ds.read( (unsigned char*)(&(sourceData.at(0))), std::min(static_cast(iElems-iPos), iCurrentInCoreElems) ); if(n_records == 0) { WARNING("Short file during mapping."); break; // bail out if the read gave us nothing. } sourceData.resize(n_records); iPos += uint64_t(n_records); assert(iPos <= iElems); progress.notify("Mapping data values to bins", iPos); // Run over the in-core data and apply mapping for(size_t i=0; i < n_records; ++i) { targetData[i] = U(binAssignments[sourceData[i]]); } TargetData.WriteRAW((unsigned char*)&targetData[0], sizeof(U)*n_records); } assert(iPos == iElems); TargetData.Close(); LargeRAWFile MappedData(strTargetFilename); MappedData.Open(false); if(!MappedData.IsOpen()) { T_ERROR("Could not open intermediate file '%s'", strTargetFilename.c_str()); return false; } // now compute histogram size_t hist_size = binAssignments.size(); if(sizeof(U) == 1) { hist_size = 256; } static_assert(sizeof(U) <= 2, "we assume histo sizes"); std::vector aHist(hist_size, 0); std::pair minmax; const size_t sz = (sizeof(U) == 2 ? 4096 : 256); minmax = io_minmax(raw_data_src(MappedData), UnsignedHistogram(aHist), TuvokProgress(iElems), iElems, iCurrentInCoreSizeBytes); assert(minmax.second >= minmax.first); MappedData.Close(); if(Histogram1D) { Histogram1D->SetHistogram(aHist); } return true; } /// Quantizes an (already-open) file to 'strTargetFilename'. If 'InputData' /// doesn't need any quantization, this might be a no-op. /// @returns true if we generated 'strTargetFilename', false if the caller /// can just use 'InputData' as-is or on error. template static bool Quantize(LargeRAWFile& InputData, const BStreamDescriptor& Input, const std::string& strTargetFilename, Histogram1DDataBlock* Histogram1D=0, size_t* iBinCount=0) { if (iBinCount) { MESSAGE("Resetting bin count to 0."); *iBinCount = 0; } // this code won't behave correctly when quantizing to very wide data // types. Make sure we only deal with 8 and 16 bit outputs. size_t hist_size = 4096; if(sizeof(U) == 1) { hist_size = 256; } static_assert(sizeof(U) <= 2, "we assume histogram sizes"); const size_t iCurrentInCoreSizeBytes = AbstrConverter::GetIncoreSize(); const size_t iCurrentInCoreElems = iCurrentInCoreSizeBytes / sizeof(T); if(!InputData.IsOpen()) { T_ERROR("Open the file before you call this."); return false; } InputData.SeekStart(); assert(Input.width == sizeof(T)); const uint64_t iSize = Input.elements * Input.components * Input.timesteps * Input.width; const uint64_t iElems = Input.elements * Input.components * Input.timesteps; MESSAGE("%s should have %llu bytes.", InputData.GetFilename().c_str(), iSize); // figure out min/max std::vector aHist(hist_size, 0); std::pair minmax; const size_t sz = (sizeof(U) == 2 ? 4096 : 256); minmax = io_minmax(raw_data_src(InputData), UnsignedHistogram(aHist), TuvokProgress(iElems), iElems, iCurrentInCoreSizeBytes); assert(minmax.second >= minmax.first); // Unsigned N bit data does not need to be biased/quantized. if(!ctti::is_signed && minmax.second < static_cast(hist_size) && sizeof(T) <= ((hist_size == 256) ? 1 : 2)) { MESSAGE("Returning early; data does not need processing."); // if we have very few values, let the calling function know // how much exactly, so we can reduce the bit depth of // the data if (iBinCount) { for (size_t bin = 0;bin(minmax); MESSAGE("We need %u bins", static_cast(*iBinCount)); } size_t max_output_val = (1 << (sizeof(U)*8)) - 1; if(hist_size == 256) { max_output_val = 255; } double fQuantFact = QuantizationFactor(max_output_val, minmax.first, minmax.second); double fQuantFactHist = QuantizationFactor(hist_size-1, minmax.first, minmax.second); bool bDataWillbeChanged = fQuantFact != 1.0 || minmax.first != 0 || sizeof(T) > 2 || sizeof(T) > sizeof(U); LargeRAWFile OutputData(strTargetFilename); // if the only reason for quantization is the histogram computation // we don't need an output file if (bDataWillbeChanged) { OutputData.Create(iSize*sizeof(U)); if(!OutputData.IsOpen()) { InputData.Close(); T_ERROR("Could not create output file '%s'", strTargetFilename.c_str()); return false; } } T* pInData = new T[iCurrentInCoreElems]; U* pOutData = new U[iCurrentInCoreElems]; InputData.SeekStart(); uint64_t iPos = 0; uint64_t iLastDisplayedPercent = 0; while(iPos < iSize) { size_t iRead = InputData.ReadRAW((unsigned char*)pInData, std::min((iSize - iPos)*sizeof(T), uint64_t(iCurrentInCoreSizeBytes)))/sizeof(T); if(iRead == 0) { break; } // bail if the read gave us nothing // calculate hist + quantize to output file. for(size_t i=0; i < iRead; ++i) { U iNewVal = std::min(static_cast(max_output_val), static_cast((pInData[i]-minmax.first) * fQuantFact) ); U iHistIndex = std::min(static_cast(hist_size-1), static_cast((pInData[i]-minmax.first) * fQuantFactHist) ); pOutData[i] = iNewVal; aHist[iHistIndex]++; } iPos += static_cast(iRead); if((100*iPos)/iSize > iLastDisplayedPercent) { std::ostringstream qmsg; if (fQuantFact == 1.0) if (minmax.first == 0) qmsg << "Computing quantized histogram with " << hist_size << " bins (input range: [" << minmax.first << "--" << minmax.second << "])\n" << (100*iPos)/iSize << "% complete"; else qmsg << "Quantizing to " << (minmax.second-minmax.first)+1 << " integer values (input range: [" << minmax.first << "--" << minmax.second << ")\n" << (100*iPos)/iSize << "% complete"; else qmsg << "Quantizing to " << max_output_val << " integer values (input range: [" << minmax.first << "--" << minmax.second << ")\n" << (100*iPos)/iSize << "% complete"; MESSAGE("%s", qmsg.str().c_str()); iLastDisplayedPercent = (100*iPos)/iSize; } if (bDataWillbeChanged) OutputData.WriteRAW(reinterpret_cast(pOutData), sizeof(U)*iRead); } delete[] pInData; delete[] pOutData; if(Histogram1D) { Histogram1D->SetHistogram(aHist); } if (bDataWillbeChanged) { OutputData.Close(); return true; } else { return false; } } /// @returns true if we generated 'strTargetFilename', false if the caller /// can just use 'InputData' as-is or on error. template static bool BinningQuantize(LargeRAWFile& InputData, const std::string& strTargetFilename, uint64_t iElems, unsigned& iComponentSize, Histogram1DDataBlock* Histogram1D=0) { MESSAGE("Attempting to recover integer values by binning the data."); iComponentSize = sizeof(U)*8; const size_t iCurrentInCoreSizeBytes = AbstrConverter::GetIncoreSize(); const size_t iCurrentInCoreElems = iCurrentInCoreSizeBytes / sizeof(T); if(!InputData.IsOpen()) { T_ERROR("'%s' is not open.", InputData.GetFilename().c_str()); return false; } InputData.SeekStart(); MESSAGE("Counting number of unique values in the data"); raw_data_src ds(InputData); std::vector data(iCurrentInCoreElems); TuvokProgress progress(iElems); uint64_t iPos = 0; bool bBinningPossible = true; std::map bins; while(bBinningPossible && iPos < iElems) { size_t n_records = ds.read( (unsigned char*)(&(data.at(0))), std::min(static_cast(iElems-iPos), iCurrentInCoreElems) ); if(n_records == 0) { WARNING("Short file during counting."); break; // bail out if the read gave us nothing. } data.resize(n_records); iPos += uint64_t(n_records); assert(iPos <= iElems); progress.notify("Counting number of unique values in the data", iPos); // Run over the in core data and sort it into bins for(size_t i=0; i < n_records; ++i) { bins[data[i]]++; // We max out at 4k bins for Tuvok, regardless of data size. const size_t max_bins = 4096; if (bins.size() > std::min(max_bins, static_cast(1 << (sizeof(U) * 8)))) { bBinningPossible = false; break; } } MESSAGE("%lu bins needed...", static_cast(bins.size())); MESSAGE("minmax so far: %g,%g", static_cast(std::min_element(bins.begin(), bins.end())->first), static_cast(std::max_element(bins.begin(), bins.end())->first)); } data.clear(); // too many values, need to actually quantize the data if (!bBinningPossible) { InputData.SeekStart(); BStreamDescriptor bsd; bsd.elements = iElems; bsd.components = 1; bsd.width = sizeof(T); bsd.is_signed = ctti::is_signed; bsd.fp = std::is_floating_point::value; bsd.big_endian = EndianConvert::IsBigEndian(); bsd.timesteps = 1; return Quantize(InputData, bsd, strTargetFilename, Histogram1D); } // now compute the mapping from values to bins std::map binAssignments; size_t binID = 0; for (typename std::map::iterator it=bins.begin(); it != bins.end(); it++) { binAssignments[(*it).first] = binID; binID++; } bins.clear(); // apply this mapping MESSAGE("Binning possible, applying mapping"); if (binAssignments.size() < 256) { iComponentSize = 8; // now we are only using 8 bits using namespace boost; return ApplyMapping(iElems, iCurrentInCoreSizeBytes, ds, strTargetFilename, binAssignments, Histogram1D, progress); } else { return ApplyMapping(iElems, iCurrentInCoreSizeBytes, ds, strTargetFilename, binAssignments, Histogram1D, progress); } } } #endif // SCIO_QUANTIZE_H ImageVis3D-3.1.0/Tuvok/IO/DirectoryParser.cpp0000644000175000017500000001044312320456500020523 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DirectoryParser.cpp \author Jens Krueger SCI Institute University of Utah \version 1.2 \date September 2008 */ #include "DirectoryParser.h" #include #include #include using namespace std; DirectoryParser::DirectoryParser(void) { } DirectoryParser::~DirectoryParser(void) { for (size_t i = 0; im_strFileName), m_wstrFileName(other->m_wstrFileName), m_iImageIndex(other->m_iImageIndex), m_iDataSize(other->m_iDataSize) { } bool SimpleFileInfo::GetData(std::vector& vData) { vData.resize(GetDataSize(), 0); return GetData(vData, GetDataSize(), 0); } /*************************************************************************************/ FileStackInfo::FileStackInfo() : m_ivSize(0,0,0), m_fvfAspect(1,1,1), m_iAllocated(0), m_iStored(0), m_iComponentCount(1), m_bSigned(false), m_bIsBigEndian(false), m_bIsJPEGEncoded(false), m_strDesc(""), m_strFileType("") {} FileStackInfo::FileStackInfo(const FileStackInfo* other) : m_ivSize(other->m_ivSize), m_fvfAspect(other->m_fvfAspect), m_iAllocated(other->m_iAllocated), m_iStored(other->m_iStored), m_iComponentCount(other->m_iComponentCount), m_bSigned(other->m_bSigned), m_bIsBigEndian(other->m_bIsBigEndian), m_bIsJPEGEncoded(other->m_bIsJPEGEncoded), m_strDesc(other->m_strDesc), m_strFileType(other->m_strFileType) { for (size_t i=0;im_Elements.size();i++) { SimpleFileInfo* e = other->m_Elements[i]->clone(); m_Elements.push_back(e); } } FileStackInfo::~FileStackInfo() { for (size_t i=0;i #include "IOException.h" namespace tuvok { namespace io { /// Generic base for a failed open class DSOpenFailed : virtual public IOException { public: DSOpenFailed(std::string s, const char* where=NULL, size_t ln=0) : IOException(s, where, ln) {} DSOpenFailed(std::string filename, std::string s, const char* where=NULL, size_t ln=0) : IOException(s, where, ln), file(filename) {} virtual ~DSOpenFailed() throw() {} const char* File() const { return file.c_str(); } private: std::string file; }; /// something went wrong in the parse process of a file class DSParseFailed : virtual public DSOpenFailed { public: DSParseFailed(std::string err, const char* where=NULL, size_t ln=0) : DSOpenFailed(err, where, ln) {} DSParseFailed(std::string f, std::string s, const char* where=NULL, size_t ln=0) : DSOpenFailed(f, s, where, ln) {} virtual ~DSParseFailed() throw() {} }; /// any kind of dataset verification failed; e.g. a checksum for the /// file was invalid. class DSVerificationFailed : virtual public DSOpenFailed { public: DSVerificationFailed(std::string s, const char* where=NULL, size_t ln=0) : DSOpenFailed(s, where, ln) {} virtual ~DSVerificationFailed() throw() {} }; /// Oversized bricks; needs re-bricking class DSBricksOversized : virtual public DSOpenFailed { public: DSBricksOversized(std::string s, size_t bsz, const char* where=NULL, size_t ln=0) : DSOpenFailed(s, where, ln), brick_size(bsz) {} size_t BrickSize() const { return this->brick_size; } private: size_t brick_size; }; } // io } // tuvok #endif // TUVOK_IO_ERROR_H ImageVis3D-3.1.0/Tuvok/IO/MobileGeoConverter.cpp0000644000175000017500000001332112320456500021132 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : MobileGeoConverter.cpp //! Author : Georg Tamm //! DFKI, Saarbruecken //! Date : July 2010 // //! Copyright (C) 2010 DFKI Institute #include "MobileGeoConverter.h" #include "Controller/Controller.h" #include "G3D.h" #include "SysTools.h" #include "Mesh.h" #include "TuvokIOError.h" using namespace tuvok; using namespace std; MobileGeoConverter::MobileGeoConverter() : AbstrGeoConverter() { m_vConverterDesc = "Mobile Geometry File"; m_vSupportedExt.push_back("G3D"); m_vSupportedExt.push_back("G3DX"); } bool MobileGeoConverter::ConvertToNative(const Mesh& m, const std::string& strTargetFilename) { if (m.GetVertices().empty()) return false; /* // include this once we have mesh downsampling implemented bool bSimplify = SysTools::ToUpperCase( SysTools::GetExt(strTargetFilename) ) == "G3D"; */ G3D::GeometrySoA geometry; geometry.info.isOpaque = false; geometry.info.numberPrimitives = uint32_t(m.GetVertexIndices().size() / m.GetVerticesPerPoly()); geometry.info.primitiveType = (m.GetMeshType() == Mesh::MT_TRIANGLES) ? G3D::Triangle : G3D::Line; geometry.info.numberIndices = uint32_t(m.GetVertexIndices().size()); geometry.info.numberVertices = uint32_t(m.GetVertices().size()); uint32_t vertexFloats = 0; geometry.info.attributeSemantics.push_back(G3D::Position); geometry.vertexAttributes.push_back((float*)&m.GetVertices().at(0)); vertexFloats += G3D::floats(G3D::Position); if (m.GetNormals().size() == m.GetVertices().size()) { geometry.info.attributeSemantics.push_back(G3D::Normal); geometry.vertexAttributes.push_back((float*)&m.GetNormals().at(0)); vertexFloats += G3D::floats(G3D::Normal); } if (m.GetTexCoords().size() == m.GetVertices().size()) { geometry.info.attributeSemantics.push_back(G3D::Tex); geometry.vertexAttributes.push_back((float*)&m.GetTexCoords().at(0)); vertexFloats += G3D::floats(G3D::Tex); } geometry.info.attributeSemantics.push_back(G3D::Color); vertexFloats += G3D::floats(G3D::Color); ColorVec colors; if (m.GetColors().size() == m.GetVertices().size()) { geometry.vertexAttributes.push_back((float*)&m.GetColors().at(0)); } else { colors = ColorVec(m.GetVertices().size(), m.GetDefaultColor()); geometry.vertexAttributes.push_back((float*)&colors.at(0)); } geometry.info.indexSize = sizeof(uint32_t); geometry.info.vertexSize = vertexFloats * sizeof(float); geometry.indices = (uint32_t*)&m.GetVertexIndices().at(0); G3D::write(strTargetFilename, &geometry); return true; } std::shared_ptr MobileGeoConverter::ConvertToMesh(const std::string& strFilename) { VertVec vertices; NormVec normals; TexCoordVec texcoords; ColorVec colors; IndexVec VertIndices; IndexVec NormalIndices; IndexVec TCIndices; IndexVec COLIndices; G3D::GeometrySoA geometry; G3D::read(strFilename, &geometry); if (geometry.info.indexSize == sizeof(uint16_t)) { for (uint32_t i=0; i::iterator it=geometry.info.attributeSemantics.begin(); it( new Mesh(vertices,normals,texcoords,colors, VertIndices,NormalIndices,TCIndices,COLIndices, false, false, desc, Mesh::MT_TRIANGLES) ); } ImageVis3D-3.1.0/Tuvok/IO/RAWConverter.h0000644000175000017500000001666712320456500017406 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file RAWConverter.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date December 2008 */ #pragma once #ifndef RAWCONVERTER_H #define RAWCONVERTER_H #include "../StdTuvokDefines.h" #include #include "AbstrConverter.h" #include "Controller/Controller.h" #include "IOManager.h" // for the size defines typedef std::vector> KVPairs; template class MinMaxScanner { public: MinMaxScanner(LargeRAWFile* file, T& minValue, T& maxValue, uint64_t iElemCount) { size_t iMaxElemCount = size_t(std::min(BLOCK_COPY_SIZE, iElemCount) / sizeof(T)); T* pInData = new T[iMaxElemCount]; uint64_t iPos = 0; while (iPos < iElemCount) { size_t iRead = file->ReadRAW((unsigned char*)pInData, iMaxElemCount*sizeof(T))/sizeof(T); if (iRead == 0) break; for (size_t i = 0;i pInData[i]) minValue = pInData[i]; if (maxValue < pInData[i]) maxValue = pInData[i]; } iPos += uint64_t(iRead); } delete [] pInData; } }; class RAWConverter : public AbstrConverter { public: virtual ~RAWConverter() {} static bool ConvertRAWDataset(const std::string& strFilename, const std::string& strTargetFilename, const std::string& strTempDir, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, uint64_t timesteps, bool bConvertEndianness, bool bSigned, bool bIsFloat, UINT64VECTOR3 vVolumeSize, FLOATVECTOR3 vVolumeAspect, const std::string& strDesc, const std::string& strSource, const uint64_t iTargetBrickSize, const uint64_t iTargetBrickOverlap, const bool bUseMedian, const bool bClampToEdge, uint32_t iBrickCompression, uint32_t iBrickCompressionLevel, uint32_t iBrickLayout, KVPairs* pKVPairs = NULL, const bool bQuantizeTo8Bit=false); static bool ExtractGZIPDataset(const std::string& strFilename, const std::string& strUncompressedFile, uint64_t iHeaderSkip); static bool ExtractBZIP2Dataset(const std::string& strFilename, const std::string& strUncompressedFile, uint64_t iHeaderSkip); static bool ParseTXTDataset(const std::string& strFilename, const std::string& strBinaryFile, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bIsFloat, UINT64VECTOR3 vVolumeSize); static bool AppendRAW(const std::string& strRawFilename, uint64_t iHeaderSkip, const std::string& strTargetFilename, unsigned iComponentSize, bool bChangeEndianess=false, bool bToSigned=false, const bool bQuantizeTo8Bit=false); virtual bool ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize, FLOATVECTOR3 vVolumeAspect, bool bNoUserInteraction, const bool bQuantizeTo8Bit); virtual bool ConvertToUVF(const std::string& strSourceFilename, const std::string& strTargetFilename, const std::string& strTempDir, const bool bNoUserInteraction, const uint64_t iTargetBrickSize, const uint64_t iTargetBrickOverlap, const bool bUseMedian, const bool bClampToEdge, uint32_t iBrickCompression, uint32_t iBrickCompressionLevel, uint32_t iBrickLayout, const bool bQuantizeTo8Bit); virtual bool ConvertToUVF(const std::list& files, const std::string& strTargetFilename, const std::string& strTempDir, const bool bNoUserInteraction, const uint64_t iTargetBrickSize, const uint64_t iTargetBrickOverlap, const bool bUseMedian, const bool bClampToEdge, uint32_t iBrickCompression, uint32_t iBrickCompressionLevel, uint32_t iBrickLayout, const bool bQuantizeTo8Bit); virtual bool Analyze(const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, RangeInfo& info); static bool Analyze(const std::string& strSourceFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize, RangeInfo& info); virtual bool CanExportData() const { return true; } virtual bool CanImportData() const { return true; } /// Removes the given file or directory. Warns if the file could not be /// deleted. /// @return true if the remove succeeded. static bool Remove(const std::string &, AbstrDebugOut &); }; #endif // RAWCONVERTER_H ImageVis3D-3.1.0/Tuvok/IO/LinearIndexDataset.cpp0000644000175000017500000000514712320456500021117 0ustar mathieumathieu#include #include "LinearIndexDataset.h" namespace tuvok { // given a (x,y,z,LOD) tuple, convert that to one of our Brickkeys, which use a // 1D (brick) index internally. BrickKey LinearIndexDataset::IndexFrom4D(const UINTVECTOR4& four, size_t timestep) const { // the fourth component represents the LOD. const size_t lod = static_cast(four.w); UINTVECTOR3 layout = this->GetBrickLayout(lod, timestep); const BrickKey k = BrickKey(timestep, lod, four.x + four.y*layout.x + four.z*layout.x*layout.y); // it must be an actual brick we know about! assert(this->bricks.find(k) != this->bricks.end()); return k; } // our brick Keys have 1D indices internally; compute the (x,y,z,LOD) tuple // index based on the 1D index and the dataset size. UINTVECTOR4 LinearIndexDataset::IndexTo4D(const BrickKey& key) const { assert(this->bricks.find(key) != this->bricks.end()); const size_t timestep = std::get<0>(key); const size_t lod = std::get<1>(key); const size_t idx1d = std::get<2>(key); const UINTVECTOR3 layout = this->GetBrickLayout(lod, timestep); const UINTVECTOR4 rv = UINTVECTOR4( idx1d % layout.x, (idx1d / layout.x) % layout.y, idx1d / (layout.x*layout.y), lod ); assert(rv[2] < layout[2]); return rv; } } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/AbstrGeoConverter.cpp0000644000175000017500000001664612320456500021013 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : AbstrGeoConverter.cpp //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #include #include #include #include "AbstrGeoConverter.h" #include "SysTools.h" using namespace tuvok; std::shared_ptr AbstrGeoConverter::ConvertToMesh(const std::string&) { return std::shared_ptr(); } bool AbstrGeoConverter::ConvertToNative(const Mesh&, const std::string&) { return false; } bool AbstrGeoConverter::CanRead(const std::string& fn) const { return SupportedExtension(SysTools::ToUpperCase(SysTools::GetExt(fn))); } /// @param ext the extension for the filename /// @return true if the filename is a supported extension for this converter bool AbstrGeoConverter::SupportedExtension(const std::string& ext) const { return std::find(m_vSupportedExt.begin(), m_vSupportedExt.end(), ext) != m_vSupportedExt.end(); } // ******************************************* // code to triangulate planar, convex polygons // ******************************************* // swaps two index entries static void Swap(IndexVec& v, IndexVec& n, IndexVec& t, IndexVec& c, size_t sI, size_t tI) { std::swap(v[sI],v[tI]); if (v.size() == n.size()) std::swap(n[sI],n[tI]); if (v.size() == t.size()) std::swap(t[sI],t[tI]); if (v.size() == c.size()) std::swap(c[sI],c[tI]); } // Checks the ordering of two points relative to a third. static bool CheckOrdering(const FLOATVECTOR3& a, const FLOATVECTOR3& b, const FLOATVECTOR3& c, size_t iPlaneX, size_t iPlaneY) { float g1 = (a[iPlaneY]-c[iPlaneY])/(a[iPlaneX]-c[iPlaneX]), g2 = (b[iPlaneY]-c[iPlaneY])/(b[iPlaneX]-c[iPlaneX]); if (EpsilonEqual(a[iPlaneX],c[iPlaneX])) return (g2 < 0) || (EpsilonEqual(g2,0.0f) && b[iPlaneX] < c[iPlaneX]); if (EpsilonEqual(b[iPlaneX],c[iPlaneX])) return (g1 > 0) || (EpsilonEqual(g1,0.0f) && a[iPlaneX] > c[iPlaneX]); if (a[iPlaneX] < c[iPlaneX]) if (b[iPlaneX] < c[iPlaneX]) return g1 < g2; else return false; else if (b[iPlaneX] < c[iPlaneX]) return true; else return g1 < g2; } static void SortPoints(const VertVec& vertices, IndexVec& v, IndexVec& n, IndexVec& t, IndexVec& c, size_t iPlaneX, size_t iPlaneY) { // for small arrays, this bubble sort actually beats qsort. for (size_t i= 1;i vertices[v[i]][iPlaneY]) { Swap(v,n,t,c,0,i); } } // *** sort points according to gradient SortPoints(vertices,v,n,t,c,iPlaneX,iPlaneY); } void AbstrGeoConverter::AddToMesh(const VertVec& vertices, IndexVec& v, IndexVec& n, IndexVec& t, IndexVec& c, IndexVec& VertIndices, IndexVec& NormalIndices, IndexVec& TCIndices, IndexVec& COLIndices) { if (v.size() > 3) { // per OBJ definition any poly with more than 3 verices has // to be planar and convex, so we can safely triangulate it SortByGradient(vertices,v,n,t,c); for (size_t i = 0;i #include #include #include #include #include "3rdParty/bzip2/bzlib.h" #include "RAWConverter.h" #include "Basics/nonstd.h" #include "Basics/SysTools.h" #include "Basics/SystemInfo.h" #include "IO/gzio.h" #include "UVF/Histogram1DDataBlock.h" #include "UVF/Histogram2DDataBlock.h" #include "UVF/MaxMinDataBlock.h" #include "UVF/RasterDataBlock.h" #include "UVF/KeyValuePairDataBlock.h" #include "UVF/TOCBlock.h" #include "UVF/UVF.h" #include "TuvokIOError.h" #include "Quantize.h" using namespace std; using namespace tuvok; // holds UVF data blocks, because they cannot be deleted until the UVF file is // written. struct TimestepBlocks { std::shared_ptr tocblock; std::shared_ptr rdb; std::shared_ptr maxmin; std::shared_ptr hist2d; }; namespace { template void change_endianness(unsigned char* buffer, size_t bytes_read) { Target* buf = reinterpret_cast(buffer); const size_t N = bytes_read / sizeof(Target); std::transform(buf, buf+N, buf, EndianConvert::Swap); } } static std::string convert_endianness(const std::string& strFilename, const std::string& strTempDir, uint64_t iHeaderSkip, unsigned iComponentSize, size_t in_core_size) { using namespace tuvok::io; if(iComponentSize != 16 && iComponentSize != 32 && iComponentSize != 64) { T_ERROR("Unable to endian convert anything but 16-, 32-, and 64-bit data" " (input data is %d-bit).", iComponentSize); return ""; } LargeRAWFile WrongEndianData(strFilename, iHeaderSkip); WrongEndianData.Open(false); if(!WrongEndianData.IsOpen()) { T_ERROR("Unable to open source file '%s'", strFilename.c_str()); throw DSOpenFailed(strFilename.c_str(), "Unable to open source file", __FILE__, __LINE__); } const std::string tmp_file = strTempDir + SysTools::GetFilename(strFilename) + ".endianness"; LargeRAWFile ConvertedEndianData(tmp_file); ConvertedEndianData.Create(); if(!ConvertedEndianData.IsOpen()) { WrongEndianData.Close(); throw DSOpenFailed(tmp_file.c_str(), "Unable to create file", __FILE__, __LINE__); } MESSAGE("Performing endianness conversion ..."); uint64_t byte_length = WrongEndianData.GetCurrentSize(); size_t buffer_size = std::min(static_cast(byte_length), static_cast(in_core_size)); uint64_t bytes_converted = 0; std::shared_ptr buffer( new unsigned char[buffer_size], nonstd::DeleteArray() ); while(bytes_converted < byte_length) { using namespace boost; size_t bytes_read = WrongEndianData.ReadRAW(buffer.get(), buffer_size); switch(iComponentSize) { case 16: change_endianness(buffer.get(), bytes_read); break; case 32: change_endianness(buffer.get(), bytes_read); break; case 64: change_endianness(buffer.get(), bytes_read); break; } size_t bytes_written = ConvertedEndianData.WriteRAW(buffer.get(), bytes_read); if(bytes_read != bytes_written) { WrongEndianData.Close(); ConvertedEndianData.Close(); remove(tmp_file.c_str()); throw IOException("Write failed during endianness conversion.", __FILE__, __LINE__); } bytes_converted += static_cast(bytes_written); MESSAGE("Performing endianness conversion" "\n%i%% complete", int(float(bytes_converted) / float(byte_length)*100.0f)); } WrongEndianData.Close(); ConvertedEndianData.Close(); return tmp_file; } static std::shared_ptr metadata( const string& strDesc, const string& strSource, bool bLittleEndian, bool bSigned, bool bIsFloat, unsigned iComponentSize, KVPairs* pKVPairs ) { std::shared_ptr meta = std::shared_ptr(new KeyValuePairDataBlock()); if(!strSource.empty()) { meta->AddPair("Data Source", strSource); } if(!strDesc.empty()) { meta->AddPair("Description", strDesc); } if(bLittleEndian) { meta->AddPair("Source Endianness", "little"); } else { meta->AddPair("Source Endianness", "big"); } if(bIsFloat) { meta->AddPair("Source Type", "float"); } else { if(bSigned) { meta->AddPair("Source Type", "signed integer"); } else { meta->AddPair("Source Type", "integer"); } } meta->AddPair("Source Bitwidth", SysTools::ToString(iComponentSize)); if(pKVPairs) { for (size_t i=0; i < pKVPairs->size(); i++) { meta->AddPair(pKVPairs->at(i).first, pKVPairs->at(i).second); } } return meta; } /// figures out if we need to quantize the data and does, if so. /// @param iComponentSize bit width of data, in-out param. std::shared_ptr quantize(std::shared_ptr sourceData, const std::string tmpQuantizedFile, const bool bSigned, const bool bIsFloat, unsigned& iComponentSize, const uint64_t iComponentCount, const uint64_t timesteps, const uint64_t volumeSize, const bool bQuantizeTo8Bit, Histogram1DDataBlock* Histogram1D) { bool target = false; BStreamDescriptor bsd; bsd.elements = volumeSize; bsd.components = iComponentCount; bsd.width = iComponentSize / 8; assert(bsd.width > 0); bsd.is_signed = bSigned; bsd.fp = bIsFloat; bsd.big_endian = EndianConvert::IsBigEndian(); // should be native, now. bsd.timesteps = timesteps; if (bQuantizeTo8Bit && iComponentSize > 8) { target = AbstrConverter::QuantizeTo8Bit( *sourceData, tmpQuantizedFile, iComponentSize, iComponentCount*volumeSize*timesteps, bSigned, bIsFloat, Histogram1D ); iComponentSize = 8; } else { switch (iComponentSize) { case 8 : // do not run the Process8Bits when we are dealing with unsigned // color data, in that case only the histogram would be computed // and we do not use in that case. /// \todo change this if we want to support non-color /// multi-component data MESSAGE("Dataset is 8bit."); if (iComponentCount == 1 || bSigned) { MESSAGE("%u component, %s data", static_cast(iComponentCount), (bSigned) ? "signed" : "unsigned"); target = AbstrConverter::Process8Bits( *sourceData, tmpQuantizedFile, iComponentCount*volumeSize*timesteps, bSigned, Histogram1D ); } break; case 16 : MESSAGE("Dataset is 16bit integers (shorts)"); if(bSigned) { target = Quantize( *sourceData, bsd, tmpQuantizedFile, Histogram1D ); } else { size_t iBinCount = 0; target = Quantize( *sourceData, bsd, tmpQuantizedFile, Histogram1D, &iBinCount ); if (iBinCount > 0 && iBinCount <= 256) { target = BinningQuantize( *sourceData, tmpQuantizedFile, iComponentCount*volumeSize*timesteps, iComponentSize, Histogram1D ); break; } } break; case 32 : if (bIsFloat) { MESSAGE("Dataset is 32bit FP (floats)"); target = BinningQuantize( *sourceData, tmpQuantizedFile, iComponentCount*volumeSize*timesteps, iComponentSize, Histogram1D ); } else { MESSAGE("Dataset is 32bit integers."); if(bSigned) { target = Quantize( *sourceData, bsd, tmpQuantizedFile, Histogram1D ); } else { size_t iBinCount = 0; target = Quantize( *sourceData, bsd, tmpQuantizedFile, Histogram1D, &iBinCount ); if (iBinCount > 0 && iBinCount <= 256) { target = BinningQuantize( *sourceData, tmpQuantizedFile, iComponentCount*volumeSize*timesteps, iComponentSize, Histogram1D ); break; } } iComponentSize = 16; } break; case 64 : if (bIsFloat) { MESSAGE("Dataset is 64bit FP (doubles)."); target = BinningQuantize( *sourceData, tmpQuantizedFile, iComponentCount*volumeSize*timesteps, iComponentSize, Histogram1D ); } else { if(bSigned) { MESSAGE("Dataset is 64bit integers."); target = Quantize( *sourceData, bsd, tmpQuantizedFile, Histogram1D ); } else { MESSAGE("Dataset is 64bit unsigned integers."); size_t iBinCount = 0; target = Quantize( *sourceData, bsd, tmpQuantizedFile, Histogram1D, &iBinCount ); if (iBinCount > 0 && iBinCount <= 256) { target = BinningQuantize( *sourceData, tmpQuantizedFile, iComponentCount*volumeSize*timesteps, iComponentSize, Histogram1D ); break; } } iComponentSize = 16; } break; } } if(target) { std::shared_ptr rv(new TempFile(tmpQuantizedFile)); rv->Open(false); return rv; } return sourceData; } // Create a temporary file and return the name. // This isn't great -- there's a race between when we close and reopen it -- // but there's no (standard) way to turn a file descriptor into an fstream or // RAWFile... static std::string mk_tmpfile(std::ofstream& ofs, std::ios::openmode mode) { #ifdef _WIN32 char *templ = tmpnam((char*)0); ofs.open(templ, mode); #else char templ[64]; strcpy(templ, "iv3d-tmp-raw.XXXXXX"); int fd = mkstemp(templ); close(fd); ofs.open(templ, mode); #endif return std::string(templ); } /// given a data source, grab out every 'N'th element and put it in its own /// file. /// @return a list of temporary files with each component std::vector> make_raw(std::shared_ptr source, uint64_t n_components, size_t csize) { typedef std::vector> files; const size_t nc = static_cast(n_components); std::vector> components(nc); for(files::iterator f=components.begin(); f != components.end(); ++f) { std::ofstream ofs; std::string filename = mk_tmpfile(ofs, std::ios::out | std::ios::binary); *f = std::shared_ptr(new TempFile(filename)); (*f)->Open(true); } source->SeekStart(); std::shared_ptr data(new unsigned char[csize], nonstd::DeleteArray()); size_t bytes=1; do { for(size_t c=0; c < nc; ++c) { bytes = source->ReadRAW(data.get(), csize); if(bytes) { components[c]->WriteRAW(data.get(), csize); } } } while(bytes > 0); // close/reopen as read-only. for(files::iterator f=components.begin(); f != components.end(); ++f) { (*f)->Close(); (*f)->Open(); } return components; } bool RAWConverter::ConvertRAWDataset(const string& strFilename, const string& strTargetFilename, const string& strTempDir, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, uint64_t timesteps, bool bConvertEndianness, bool bSigned, bool bIsFloat, UINT64VECTOR3 vVolumeSize, FLOATVECTOR3 vVolumeAspect, const string& strDesc, const string& strSource, const uint64_t iTargetBrickSize, const uint64_t iTargetBrickOverlap, const bool bUseMedian, const bool bClampToEdge, uint32_t iBrickCompression, uint32_t iBrickCompressionLevel, uint32_t iBrickLayout, KVPairs* pKVPairs, const bool bQuantizeTo8Bit) { if (!SysTools::FileExists(strFilename)) { T_ERROR("Data file %s not found; maybe there is an invalid reference in " "the header file?", strFilename.c_str()); return false; } // Save the original metadata now: as we quantize or whatnot, we will modify // it, and we need to know the original settings for recording it in the UVF. std::shared_ptr metaPairs = metadata( strDesc, strSource, (bConvertEndianness && EndianConvert::IsBigEndian()) || (EndianConvert::IsLittleEndian() && !bConvertEndianness), bSigned, bIsFloat, iComponentSize, pKVPairs ); if(iComponentSize < 8) { T_ERROR("width too small; you probably forgot it is in BITS (not bytes)"); #ifndef NDEBUG abort(); #endif return false; } if (iComponentCount > 4) { T_ERROR("Currently, only up to four component data is supported."); return false; } if (bConvertEndianness && iComponentSize < 16) { // catch silly user input WARNING("Requested endian conversion for 8bit data... broken reader?"); bConvertEndianness = false; } if(iTargetBrickSize <= (2*iTargetBrickOverlap)) { T_ERROR("Bricks would contain only ghost data or occupy negative space" " (brick size: %llu, brick overlap: %llu)", iTargetBrickSize, iTargetBrickOverlap); return false; } if(!(vVolumeSize.volume() > 0)) { T_ERROR("Data must be volumetric."); return false; } if(!(vVolumeAspect.volume() > 0)) { T_ERROR("Invalid aspect ratio (%f)!", vVolumeAspect.volume()); return false; } MESSAGE("Converting RAW dataset %s to %s", strFilename.c_str(), strTargetFilename.c_str()); string tmpQuantizedFile = strTempDir+SysTools::GetFilename(strFilename)+".quantized"; std::shared_ptr sourceData; if (bConvertEndianness) { // the new data source is the endian-converted file. size_t core_size = static_cast(iTargetBrickSize*iTargetBrickSize* iTargetBrickSize * iComponentSize/8); string tmpEndianConvertedFile = convert_endianness(strFilename, strTempDir, iHeaderSkip, iComponentSize, core_size); iHeaderSkip = 0; // the new file is straight raw without any header MESSAGE("temporary source data; no header skip."); sourceData = std::shared_ptr( new TempFile(tmpEndianConvertedFile) ); } else { MESSAGE("non-temp source data, with %llu-byte header skip", iHeaderSkip); sourceData = std::shared_ptr( new LargeRAWFile(strFilename, iHeaderSkip) ); } sourceData->Open(false); if(!sourceData->IsOpen()) { using namespace tuvok::io; throw DSOpenFailed(sourceData->GetFilename().c_str(), "Could not open data" " for processing.", __FILE__, __LINE__); } Histogram1DDataBlock Histogram1D; assert((iComponentCount*vVolumeSize.volume()*timesteps) > 0); sourceData = quantize(sourceData, tmpQuantizedFile, bSigned, bIsFloat, iComponentSize, iComponentCount, timesteps, vVolumeSize.volume(), bQuantizeTo8Bit, &Histogram1D); // if it was signed, we un-signed it. If it was unsigned.. it was unsigned. bSigned = false; bIsFloat = false; // we always produce non-FP data. wstring wstrUVFName(strTargetFilename.begin(), strTargetFilename.end()); UVF uvfFile(wstrUVFName); // assume all timesteps have same dimensions / etc, so the LOD calculation // applies to all TSs. uint64_t iLodLevelCount = 1; uint64_t iMaxVal = vVolumeSize.maxVal(); // generate LOD down to at least a 64^3 brick while (iMaxVal > std::min(64, iTargetBrickSize)) { iMaxVal /= 2; iLodLevelCount++; } GlobalHeader uvfGlobalHeader; uvfGlobalHeader.bIsBigEndian = EndianConvert::IsBigEndian(); uvfGlobalHeader.ulChecksumSemanticsEntry = UVFTables::CS_MD5; uvfFile.SetGlobalHeader(uvfGlobalHeader); std::vector blocks(static_cast(timesteps)); for(size_t ts=0; ts < static_cast(timesteps); ++ts) { blocks[ts].maxmin = std::shared_ptr( new MaxMinDataBlock(static_cast(iComponentCount)) ); blocks[ts].hist2d = std::shared_ptr( new Histogram2DDataBlock() ); std::shared_ptr MaxMinData = blocks[ts].maxmin; blocks[ts].tocblock = std::shared_ptr( new TOCBlock(UVF::ms_ulReaderVersion) ); std::shared_ptr dataVolume = blocks[ts].tocblock; if (strSource == "") { dataVolume->strBlockID = (strDesc!="") ? strDesc + " volume converted by ImageVis3D" : "Volume converted by ImageVis3D"; } else { dataVolume->strBlockID = (strDesc!="") ? strDesc + " volume converted from " + strSource + " by ImageVis3D" : "Volume converted from " + strSource + " by ImageVis3D"; } ExtendedOctree::COMPONENT_TYPE ct = ExtendedOctree::CT_UINT8; switch (iComponentSize) { case 8 : ct = (bSigned) ? ExtendedOctree::CT_INT8 : ExtendedOctree::CT_UINT8; break; case 16 : ct = (bSigned) ? ExtendedOctree::CT_INT16 : ExtendedOctree::CT_UINT16; break; case 32 : if (bIsFloat) ct = ExtendedOctree::CT_FLOAT32; else ct = (bSigned) ? ExtendedOctree::CT_INT32 : ExtendedOctree::CT_UINT32; break; case 64 : if (bIsFloat) ct = ExtendedOctree::CT_FLOAT64; else ct = (bSigned) ? ExtendedOctree::CT_INT64 : ExtendedOctree::CT_UINT64; break; } std::string tmpfile; { ostringstream tmpfn; tmpfn << strTempDir << ts << "tempFile.tmp"; tmpfile = tmpfn.str(); } MESSAGE("Building level of detail hierarchy ..."); if(dataVolume->FlatDataToBrickedLOD(sourceData, tmpfile, ct, iComponentCount, vVolumeSize, DOUBLEVECTOR3(vVolumeAspect), UINT64VECTOR3(iTargetBrickSize,iTargetBrickSize,iTargetBrickSize), uint32_t(iTargetBrickOverlap), bUseMedian, bClampToEdge, size_t(Controller::ConstInstance().SysInfo().GetMaxUsableCPUMem()), MaxMinData, &Controller::Debug::Out(), COMPRESSION_TYPE(iBrickCompression), iBrickCompressionLevel, LAYOUT_TYPE(iBrickLayout)) != true) { T_ERROR("Brick generation failed, aborting."); uvfFile.Close(); return false; } MESSAGE("Hierarchy computation complete."); if (!uvfFile.AddDataBlock(dataVolume)) { T_ERROR("AddDataBlock failed!"); uvfFile.Close(); return false; } // do not compute histograms when we are dealing with color data /// \todo change this if we want to support non color multi component data if (iComponentCount != 4 && iComponentCount != 3) { // if no re-sampling was performed above, we need to compute the // 1d histogram here if (Histogram1D.GetHistogram().empty()) { MESSAGE("Computing 1D Histogram..."); if (!Histogram1D.Compute(dataVolume.get(),0)) { T_ERROR("Computation of 1D Histogram failed!"); uvfFile.Close(); return false; } } MESSAGE("Computing 2D Histogram..."); std::shared_ptr Histogram2D = blocks[ts].hist2d; if (!Histogram2D->Compute(dataVolume.get(), 0, Histogram1D.GetHistogram().size(), MaxMinData->GetGlobalValue().maxScalar)) { T_ERROR("Computation of 2D Histogram failed!"); uvfFile.Close(); return false; } MESSAGE("Storing histogram data..."); uvfFile.AddDataBlock( std::shared_ptr(&Histogram1D, nonstd::null_deleter()) ); uvfFile.AddDataBlock(Histogram2D); } else { WARNING("Multicomponent data; skipping histogram computations."); } MESSAGE("Storing acceleration data..."); uvfFile.AddDataBlock(MaxMinData); sourceData->Close(); } MESSAGE("Storing metadata..."); uvfFile.AddDataBlock(metaPairs); MESSAGE("Writing UVF file..."); uvfFile.Create(); MESSAGE("Computing checksum..."); uvfFile.Close(); blocks.clear(); MESSAGE("Done!"); return true; } #ifdef WIN32 #pragma warning( disable : 4996 ) // disable deprecated warning #endif /** Converts a gzip-compressed chunk of a file to a raw file. * @param strFilename the input (compressed) file * @param strTargetFilename the target uvf file * @param iHeaderSkip number of bytes to skip off of strFilename */ bool RAWConverter::ExtractGZIPDataset(const string& strFilename, const string& strUncompressedFile, uint64_t iHeaderSkip) { FILE *f_compressed; FILE *f_inflated; int ret; MESSAGE("Deflating GZIP data ..."); f_compressed = fopen(strFilename.c_str(), "rb"); f_inflated = fopen(strUncompressedFile.c_str(), "wb"); if(f_compressed == NULL) { T_ERROR("Could not open %s", strFilename.c_str()); fclose(f_inflated); return false; } if(f_inflated == NULL) { T_ERROR("Could not open %s", strUncompressedFile.c_str()); fclose(f_compressed); return false; } if(fseek(f_compressed, static_cast(iHeaderSkip), SEEK_SET) != 0) { /// \todo use strerror(errno) and actually report the damn error. T_ERROR("Seek failed"); fclose(f_compressed); fclose(f_inflated); remove(strUncompressedFile.c_str()); return false; } gz_skip_header(f_compressed); // always needed? ret = gz_inflate(f_compressed, f_inflated); fclose(f_compressed); fclose(f_inflated); switch(ret) { case Z_OK: MESSAGE("Decompression successful."); break; case Z_MEM_ERROR: T_ERROR("Not enough memory decompress %s", strFilename.c_str()); return false; break; case Z_DATA_ERROR: T_ERROR("Deflation invalid or incomplete"); return false; break; case Z_VERSION_ERROR: T_ERROR("Zlib library versioning error!"); return false; break; default: WARNING("Unknown / unhandled case %d", ret); return false; break; } return true; } /** Tests a bzip return code for errors, and translates it to a string for the * debug logs. * @param bz_err the error code (given by the bzip2 library) * @return true if an error occurred */ static bool bz_err_test(int bz_err) { #ifdef TUVOK_NO_IO T_ERROR("bzip2 library not available!"); return true; #else bool error_occurred = true; switch(bz_err) { case BZ_OK: /* FALL THROUGH */ case BZ_RUN_OK: /* FALL THROUGH */ case BZ_FLUSH_OK: /* FALL THROUGH */ case BZ_FINISH_OK: MESSAGE("Bzip operation successful."); error_occurred = false; break; case BZ_STREAM_END: MESSAGE("End of bzip stream."); break; case BZ_CONFIG_ERROR: T_ERROR("Bzip configuration error"); break; case BZ_SEQUENCE_ERROR: T_ERROR("Bzip sequencing error"); break; case BZ_PARAM_ERROR: T_ERROR("Bzip parameter error"); break; case BZ_MEM_ERROR: T_ERROR("Bzip memory allocation failed."); break; case BZ_DATA_ERROR_MAGIC: WARNING("Bzip stream does not have correct magic bytes!"); /* FALL THROUGH */ case BZ_DATA_ERROR: T_ERROR("Bzip data integrity error; this usually means the " "compressed file is corrupt."); break; case BZ_IO_ERROR: { const char *err_msg = strerror(errno); T_ERROR("Bzip IO error: %s", err_msg); break; } case BZ_UNEXPECTED_EOF: WARNING("EOF before end of Bzip stream."); break; case BZ_OUTBUFF_FULL: T_ERROR("Bzip output buffer is not large enough"); break; } return error_occurred; #endif } /** Converts a bzip2-compressed file chunk to a raw file. * @param strFilename the input (compressed) file * @param strTargetFilename the target uvf file * @param iHeaderSkip number of bytes to skip of strFilename's header*/ bool RAWConverter::ExtractBZIP2Dataset(const string& strFilename, const string& strUncompressedFile, uint64_t iHeaderSkip) { #ifdef TUVOK_NO_IO T_ERROR("Tuvok built without IO routines; bzip2 not available!"); return false; #else BZFILE *bzf; int bz_err; size_t iCurrentIncoreSize = GetIncoreSize(); std::vector buffer(iCurrentIncoreSize); FILE *f_compressed = fopen(strFilename.c_str(), "rb"); FILE *f_inflated = fopen(strUncompressedFile.c_str(), "wb"); if(f_compressed == NULL) { T_ERROR("Could not open %s", strFilename.c_str()); fclose(f_inflated); return false; } if(f_inflated == NULL) { T_ERROR("Could not open %s", strUncompressedFile.c_str()); fclose(f_compressed); return false; } if(fseek(f_compressed, static_cast(iHeaderSkip), SEEK_SET) != 0) { /// \todo use strerror(errno) and actually report the damn error. T_ERROR("Seek failed"); fclose(f_inflated); fclose(f_compressed); return false; } bzf = BZ2_bzReadOpen(&bz_err, f_compressed, 0, 0, NULL, 0); if(bz_err_test(bz_err)) { T_ERROR("Bzip library error occurred; bailing."); fclose(f_inflated); fclose(f_compressed); return false; } do { int nbytes = BZ2_bzRead(&bz_err, bzf, &buffer[0], int(iCurrentIncoreSize)); if(bz_err != BZ_STREAM_END && bz_err_test(bz_err)) { T_ERROR("Bzip library error occurred; bailing."); fclose(f_inflated); fclose(f_compressed); return false; } if(1 != fwrite(&buffer[0], nbytes, 1, f_inflated)) { WARNING("%d-byte write of decompressed file failed.", nbytes); fclose(f_inflated); fclose(f_compressed); return false; } } while(bz_err == BZ_OK); fclose(f_inflated); fclose(f_compressed); return true; #endif } bool RAWConverter::ParseTXTDataset(const string& strFilename, const string& strBinaryFile, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bIsFloat, UINT64VECTOR3 vVolumeSize) { ifstream sourceFile(strFilename.c_str(),ios::binary); if (!sourceFile.is_open()) { T_ERROR("Unable to open source file %s.", strFilename.c_str()); return false; } LargeRAWFile binaryFile(strBinaryFile); binaryFile.Create(iComponentSize/8 * iComponentCount * vVolumeSize.volume()); if (!binaryFile.IsOpen()) { T_ERROR("Unable to open temp file %s.", strBinaryFile.c_str()); sourceFile.close(); return false; } sourceFile.seekg(static_cast(iHeaderSkip)); if (bIsFloat) { if (!bSigned) { T_ERROR("Unsupported data type (unsigned float)"); sourceFile.close(); binaryFile.Delete(); return false; } switch (iComponentSize) { case 32 : { float tmp; while (sourceFile) { sourceFile >> tmp; if(sourceFile) { binaryFile.WriteRAW((unsigned char*)&tmp,4); } } break; } case 64 : { double tmp; while (sourceFile) { sourceFile >> tmp; if(sourceFile) { binaryFile.WriteRAW((unsigned char*)&tmp,8); } } break; } default : { T_ERROR("Unable unsupported data type. (float)"); sourceFile.close(); binaryFile.Delete(); return false; } } } else { switch (iComponentSize) { case 8 : { int tmp=0; if (bSigned) { while (sourceFile) { sourceFile >> tmp; if(sourceFile) { signed char tmp2 = static_cast(tmp); binaryFile.WriteRAW((unsigned char*)&tmp2,1); } } } else { while (sourceFile) { sourceFile >> tmp; if(sourceFile) { unsigned char tmp2 = static_cast(tmp); binaryFile.WriteRAW(&tmp2,1); } } } break; } case 16 : { if (bSigned) { signed short tmp; while (sourceFile) { sourceFile >> tmp; if(sourceFile) { binaryFile.WriteRAW((unsigned char*)&tmp,2); } } } else { unsigned short tmp; while (sourceFile) { sourceFile >> tmp; if(sourceFile) { binaryFile.WriteRAW((unsigned char*)&tmp,2); } } } break; } case 32 : { if (bSigned) { signed int tmp; while (sourceFile) { sourceFile >> tmp; if(sourceFile) { binaryFile.WriteRAW((unsigned char*)&tmp,4); } } } else { uint32_t tmp; while (sourceFile) { sourceFile >> tmp; if(sourceFile) { binaryFile.WriteRAW((unsigned char*)&tmp,4); } } } break; } default : { T_ERROR("Unable unsupported data type. (int)"); sourceFile.close(); binaryFile.Delete(); return false; } } } binaryFile.Close(); sourceFile.close(); return true; } bool RAWConverter::ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t, bool, bool, UINT64VECTOR3, FLOATVECTOR3, bool, bool bQuantizeTo8Bit) { // convert raw to raw is easy :-), just copy the file and ignore the metadata // if the file exists, delete it first if (SysTools::FileExists(strTargetFilename)) Remove(strTargetFilename, Controller::Debug::Out()); if (SysTools::FileExists(strTargetFilename)) { T_ERROR("Unable to remove existing target file %s.", strTargetFilename.c_str()); return false; } return AppendRAW(strRawFilename, iHeaderSkip, strTargetFilename, iComponentSize, EndianConvert::IsBigEndian(),bQuantizeTo8Bit); } bool RAWConverter::AppendRAW(const std::string& strRawFilename, uint64_t iHeaderSkip, const std::string& strTargetFilename, unsigned iComponentSize, bool bChangeEndianess, bool bToSigned, bool bQuantizeTo8Bit) { // TODO: // should we ever need this combination // "append +quantize" the implementation should be here :-) if (bQuantizeTo8Bit) { T_ERROR("Quantization to 8bit during append operations not supported."); return false; } // open source file LargeRAWFile fSource(strRawFilename, iHeaderSkip); fSource.Open(false); if (!fSource.IsOpen()) { T_ERROR("Unable to open source file %s.", strRawFilename.c_str()); return false; } // append to target file LargeRAWFile fTarget(strTargetFilename); fTarget.Append(); if (!fTarget.IsOpen()) { fSource.Close(); T_ERROR("Unable to open target file %s.", strTargetFilename.c_str()); return false; } uint64_t iSourceSize = fSource.GetCurrentSize(); uint64_t iCopySize = min(iSourceSize,BLOCK_COPY_SIZE); unsigned char* pBuffer = new unsigned char[size_t(iCopySize)]; uint64_t iCopiedSize = 0; do { MESSAGE("Writing output data\n%g%% completed", 100.0f*float(iCopiedSize)/float(iSourceSize)); iCopySize = fSource.ReadRAW(pBuffer, iCopySize); if (bToSigned) { switch (iComponentSize) { case 8 : // char to uchar for (size_t i = 0;i::max(); break; case 16 : // short to ushort for (size_t i = 0;i::max(); break; case 32 : // int to uint for (size_t i = 0;i::max(); break; case 64 : // ulonglong to longlong for (size_t i = 0;i::max(); break; default : T_ERROR("Unsupported data type for vff files."); return false; } } if (bChangeEndianess) { switch (iComponentSize) { case 16 : change_endianness(pBuffer, size_t(iCopySize)); break; case 32 : change_endianness(pBuffer, size_t(iCopySize)); break; case 64 : change_endianness(pBuffer, size_t(iCopySize)); break; } } fTarget.WriteRAW(pBuffer, iCopySize); iCopiedSize += iCopySize; } while (iCopySize > 0); fSource.Close(); fTarget.Close(); delete [] pBuffer; return true; } bool RAWConverter::ConvertToUVF(const std::string& strSourceFilename, const std::string& strTargetFilename, const std::string& strTempDir, const bool bNoUserInteraction, const uint64_t iTargetBrickSize, const uint64_t iTargetBrickOverlap, const bool bUseMedian, const bool bClampToEdge, uint32_t iBrickCompression, uint32_t iBrickCompressionLevel, uint32_t iBrickLayout, const bool bQuantizeTo8Bit) { std::list files; files.push_front(strSourceFilename); return ConvertToUVF(files, strTargetFilename, strTempDir, bNoUserInteraction, iTargetBrickSize, iTargetBrickOverlap, bUseMedian, bClampToEdge, iBrickCompression, iBrickCompressionLevel, iBrickLayout, bQuantizeTo8Bit); } static void RemoveStdString(std::string s) { remove(s.c_str()); } bool RAWConverter::ConvertToUVF(const std::list& files, const std::string& strTargetFilename, const std::string& strTempDir, const bool bNoUserInteraction, const uint64_t iTargetBrickSize, const uint64_t iTargetBrickOverlap, const bool bUseMedian, const bool bClampToEdge, uint32_t iBrickCompression, uint32_t iBrickCompressionLevel, uint32_t iBrickLayout, const bool bQuantizeTo8Bit) { // all the parameters set here are just defaults, they should all be // overridden in ConvertToRAW which takes them as call by reference unsigned iComponentSize=8; uint64_t iComponentCount=1; bool bConvertEndianess=false; bool bSigned=true; bool bIsFloat=false; UINT64VECTOR3 vVolumeSize; FLOATVECTOR3 vVolumeAspect; string strTitle; std::list strIntermediateFile; std::list bDeleteIntermediateFile; std::list header_skip; bool success = true; for(std::list::const_iterator fn = files.begin(); fn != files.end(); ++fn) { std::string intermediate; bool bDelete; uint64_t iHeaderSkip; /// @todo assuming iComponentSize, etc. are the same for all files; should /// really be a list for each of them, like for intermediate, iHeaderskip, /// etc. success &= ConvertToRAW(*fn, strTempDir, bNoUserInteraction, iHeaderSkip, iComponentSize, iComponentCount, bConvertEndianess, bSigned, bIsFloat, vVolumeSize, vVolumeAspect, strTitle, intermediate, bDelete); if(!success) { break; } assert(iComponentSize == 8 || iComponentSize == 16 || iComponentSize == 32 || iComponentSize == 64); assert(iComponentCount > 0); assert(vVolumeSize.volume() > 0); assert(vVolumeAspect.volume() > 0); strIntermediateFile.push_front(intermediate); bDeleteIntermediateFile.push_front(bDelete); header_skip.push_front(iHeaderSkip); } // then rewrite convertrawdataset to take the new list if (!success) { T_ERROR("Convert to RAW step failed, aborting."); std::for_each(strIntermediateFile.begin(), strIntermediateFile.end(), RemoveStdString); return false; } std::string merged_fn; std::string dataSource; if(files.size() > 1) { merged_fn = strTempDir + ".merged_time_filename"; remove(merged_fn.c_str()); // copy all of the data to a single file LargeRAWFile merged(merged_fn); merged.Create(); std::list::const_iterator del = bDeleteIntermediateFile.begin(); std::list::const_iterator hdr = header_skip.begin(); const uint64_t payload_sz = vVolumeSize.volume() * iComponentSize/8 * iComponentCount; for(std::list::const_iterator fn = strIntermediateFile.begin(); fn != strIntermediateFile.end(); ++fn, ++del, ++hdr) { LargeRAWFile input(*fn, *hdr); input.Open(false); unsigned char *data = new unsigned char[GetIncoreSize()]; size_t bytes_written =0; do { size_t elems = input.ReadRAW(data, GetIncoreSize()); if(elems == 0) { WARNING("Input file '%s' ended before we expected.", fn->c_str()); break; } merged.WriteRAW(data, std::min(payload_sz - bytes_written, static_cast(elems))); bytes_written += elems; } while(bytes_written < payload_sz); if(*del) { input.Delete(); } else { input.Close(); } } *bDeleteIntermediateFile.begin() = true; *header_skip.begin() = 0; { ostringstream strlist; strlist << "Merged from "; std::copy(files.begin(), files.end(), std::ostream_iterator(strlist, ", ")); dataSource = strlist.str(); } } else { merged_fn = *strIntermediateFile.begin(); dataSource = SysTools::GetFilename(*files.begin()); } bool bUVFCreated = ConvertRAWDataset(merged_fn, strTargetFilename, strTempDir, *header_skip.begin(), iComponentSize, iComponentCount, files.size(), bConvertEndianess, bSigned, bIsFloat, vVolumeSize, vVolumeAspect, strTitle, dataSource, iTargetBrickSize, iTargetBrickOverlap, bUseMedian, bClampToEdge, iBrickCompression, iBrickCompressionLevel, iBrickLayout, 0, bQuantizeTo8Bit); if (*bDeleteIntermediateFile.begin()) { Remove(merged_fn, Controller::Debug::Out()); } return bUVFCreated; } bool RAWConverter::Analyze(const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, RangeInfo& info) { uint64_t iHeaderSkip=0; unsigned iComponentSize=0; uint64_t iComponentCount=0; bool bConvertEndianess=false; bool bSigned=false; bool bIsFloat=false; UINT64VECTOR3 vVolumeSize(0,0,0); FLOATVECTOR3 vVolumeAspect(0,0,0); string strTitle = ""; string strSource = ""; string strRAWFilename = ""; bool bRAWDelete = false; bool bConverted = ConvertToRAW(strSourceFilename, strTempDir, bNoUserInteraction, iHeaderSkip, iComponentSize, iComponentCount, bConvertEndianess, bSigned, bIsFloat, vVolumeSize, vVolumeAspect, strTitle, strRAWFilename, bRAWDelete); strSource = SysTools::GetFilename(strSourceFilename); if (!bConverted) return false; info.m_vAspect = vVolumeAspect; info.m_vDomainSize = vVolumeSize; // ConvertToRAW either creates a 16 or 8 bit unsigned int, so checking // the iComponentSize is sufficient to make sure the types are the same info.m_iComponentSize = iComponentSize; bool bAnalyzed = Analyze(strRAWFilename, iHeaderSkip, iComponentSize, iComponentCount, bSigned, bIsFloat, vVolumeSize, info); if (bRAWDelete) { Remove(strRAWFilename, Controller::Debug::Out()); } return bAnalyzed; } bool RAWConverter::Analyze(const std::string& strSourceFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize, RangeInfo& info) { // open source file LargeRAWFile fSource(strSourceFilename, iHeaderSkip); fSource.Open(false); if (!fSource.IsOpen()) { T_ERROR("Unable to open source file %s.", strSourceFilename.c_str()); return false; } uint64_t iElemCount = vVolumeSize.volume()*iComponentCount; if (bFloatingPoint) { if (!bSigned) { T_ERROR("Unable unsupported data type. (unsigned float)"); fSource.Close(); return false; } info.m_iValueType = 0; switch (iComponentSize) { case 32 : { float fMin = numeric_limits::max(); float fMax = -numeric_limits::max(); MinMaxScanner scanner(&fSource, fMin, fMax, iElemCount); info.m_fRange.first = fMin; info.m_fRange.second = fMax; break; } case 64 : { double fMin = numeric_limits::max(); double fMax = -numeric_limits::max(); MinMaxScanner scanner(&fSource, fMin, fMax, iElemCount); info.m_fRange.first = fMin; info.m_fRange.second = fMax; break; } default : { T_ERROR("Unable unsupported data type. (float)"); fSource.Close(); return false; } } } else { if (bSigned) info.m_iValueType = 1; else info.m_iValueType = 2; switch (iComponentSize) { case 8 : { if (bSigned) { char iMin = numeric_limits::max(); char iMax = -numeric_limits::max(); MinMaxScanner scanner(&fSource, iMin, iMax, iElemCount); info.m_iRange.first = iMin; info.m_iRange.second = iMax; break; } else { unsigned char iMin = numeric_limits::max(); unsigned char iMax = numeric_limits::min(); MinMaxScanner scanner(&fSource, iMin, iMax, iElemCount); info.m_uiRange.first = iMin; info.m_uiRange.second = iMax; } break; } case 16 : { if (bSigned) { short iMin = numeric_limits::max(); short iMax = -numeric_limits::max(); MinMaxScanner scanner(&fSource, iMin, iMax, iElemCount); info.m_iRange.first = iMin; info.m_iRange.second = iMax; break; } else { unsigned short iMin = numeric_limits::max(); unsigned short iMax = numeric_limits::min(); MinMaxScanner scanner(&fSource, iMin, iMax, iElemCount); info.m_uiRange.first = iMin; info.m_uiRange.second = iMax; } break; } case 32 : { if (bSigned) { int iMin = numeric_limits::max(); int iMax = -numeric_limits::max(); MinMaxScanner scanner(&fSource, iMin, iMax, iElemCount); info.m_iRange.first = iMin; info.m_iRange.second = iMax; break; } else { unsigned int iMin = numeric_limits::max(); unsigned int iMax = numeric_limits::min(); MinMaxScanner scanner(&fSource, iMin, iMax, iElemCount); info.m_uiRange.first = iMin; info.m_uiRange.second = iMax; } break; } case 64 : { if (bSigned) { int64_t iMin = numeric_limits::max(); int64_t iMax = -numeric_limits::max(); MinMaxScanner scanner(&fSource, iMin, iMax, iElemCount); info.m_iRange.first = iMin; info.m_iRange.second = iMax; break; } else { uint64_t iMin = numeric_limits::max(); uint64_t iMax = numeric_limits::min(); MinMaxScanner scanner(&fSource, iMin, iMax, iElemCount); info.m_uiRange.first = iMin; info.m_uiRange.second = iMax; } break; } default : { T_ERROR("Unable unsupported data type. (int)"); fSource.Close(); return false; } } } fSource.Close(); return true; } /// Uses remove(3) to remove the file. /// @return true if the remove succeeded. bool RAWConverter::Remove(const std::string &path, AbstrDebugOut &dbg) { if(std::remove(path.c_str()) == -1) { #ifdef _WIN32 char buffer[200]; strerror_s(buffer, 200, errno); dbg.Warning(_func_, "Could not remove `%s': %s", path.c_str(), buffer); #else dbg.Warning(_func_, "Could not remove `%s': %s", path.c_str(), strerror(errno)); #endif return false; } return true; } ImageVis3D-3.1.0/Tuvok/IO/MedAlyVisFiberTractGeoConverter.h0000644000175000017500000000430412320456500023174 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : MedAlyVisFiberTractGeoConverter.h //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #pragma once #ifndef MEDALYVISFIBERTRACTGEOCONVERTER_H #define MEDALYVISFIBERTRACTGEOCONVERTER_H #include "../StdTuvokDefines.h" #include "AbstrGeoConverter.h" namespace tuvok { class MedAlyVisFiberTractGeoConverter : public AbstrGeoConverter { public: MedAlyVisFiberTractGeoConverter(); virtual ~MedAlyVisFiberTractGeoConverter() {} virtual std::shared_ptr ConvertToMesh( const std::string& strFilename ); virtual bool CanImportData() const { return true; } private: enum { SEARCHING_DIM = 0, SEARCHING_SCALE, SEARCHING_TRANSLATION, SEARCHING_METADATA, PARSING_COUNTER, PARSING_DATA, STATE_COUNT }; }; } #endif // MEDALYVISFIBERTRACTGEOCONVERTER_H ImageVis3D-3.1.0/Tuvok/IO/IASSConverter.cpp0000644000175000017500000002762212320456500020040 0ustar mathieumathieu/* The MIT License Copyright (c) 2010 Department Image Processing, Fraunhofer ITWM. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file IASSConverter.cpp \author Andre Liebscher Department Image Processing Fraunhofer ITWM \date March 2010 */ #include #include #include #include #include #ifndef TUVOK_NO_ZLIB # include "3rdParty/zlib/zlib.h" #endif #include "IASSConverter.h" #include "Basics/EndianConvert.h" #include "Basics/SysTools.h" #include "Controller/Controller.h" using namespace std; using namespace tuvok; IASSConverter::IASSConverter() { m_vConverterDesc = "Fraunhofer MAVI Volume"; m_vSupportedExt.push_back("IASS"); m_vSupportedExt.push_back("IASS.GZ"); } bool IASSConverter::ConvertToRAW(const std::string& strSourceFilename, const std::string& strTempDir, bool, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile) { MESSAGE("Attempting to convert IASS dataset %s", strSourceFilename.c_str()); // Find out machine endianess bConvertEndianess = EndianConvert::IsBigEndian(); // Check whether file is compressed and uncompress if necessary string strInputFile; if (IsZipped(strSourceFilename)) { MESSAGE("IASS data is GZIP compressed."); strInputFile = strTempDir + SysTools::GetFilename(strSourceFilename) + ".uncompressed"; if (!ExtractGZIPDataset(strSourceFilename, strInputFile, 0)) { WARNING("Error while decompressing %s", strSourceFilename.c_str()); return false; } } else { strInputFile = strSourceFilename; } // Read header and check for "magic" values of the IASS file stHeader header; ifstream fileData(strInputFile.c_str()); if (fileData.is_open()) { if(!ReadHeader(header,fileData)) { WARNING("The file %s is not a IASS file (missing magic)", strInputFile.c_str()); return false; } } else { WARNING("Could not open IASS file %s", strInputFile.c_str()); return false; } fileData.close(); // Init data strTitle = "Fraunhofer MAVI Volume"; vVolumeAspect = FLOATVECTOR3(1,1,1); iComponentCount = 1; vVolumeSize[0] = header.size.x; vVolumeSize[1] = header.size.y; vVolumeSize[2] = header.size.z; iComponentSize = header.bpp*8; iHeaderSkip = 0; bDeleteIntermediateFile = true; if (header.type >= MONO && header.type <= GREY_32) { bSigned = false; bIsFloat = false; } else if (header.type == GREY_F) { bSigned = true; bIsFloat = true; } else if (header.type == COLOR) { bSigned = false; bIsFloat = false; iComponentCount = 3; } else { T_ERROR("Unsupported image type in file %s", strInputFile.c_str()); return false; } // Convert raw data to x-locality and decode MONO files LargeRAWFile zLocalData(strInputFile, header.skip); zLocalData.Open(false); if (!zLocalData.IsOpen()) { T_ERROR("Unable to open source file %s", strInputFile.c_str()); return false; } strIntermediateFile = strTempDir + SysTools::GetFilename(strSourceFilename) + ".x-local"; LargeRAWFile xLocalData(strIntermediateFile); xLocalData.Create(); if (!xLocalData.IsOpen()) { T_ERROR("Unable to open temp file %s for locality conversion", strIntermediateFile.c_str()); xLocalData.Close(); return false; } uint64_t strideZ = header.size.x*header.size.y*header.bpp-header.bpp; uint64_t sliceSize = header.size.y * header.size.z * header.bpp; unsigned char* sliceBuffer = new unsigned char[static_cast(sliceSize)]; if (header.type == MONO) { unsigned char* rleBuffer = new unsigned char[static_cast(header.rleLength)]; zLocalData.ReadRAW(rleBuffer,header.rleLength); uint64_t posRLEStream = 0; uint64_t posOutStream = 0; uint64_t currLength = *rleBuffer; uint64_t sliceIndex = 0; uint64_t currValue = 1; do { // This loop is entered if another pixel run would exceed the size of // the slice buffer while (posOutStream + currLength >= sliceSize) { // How many pixels are left to fill up buffer uint64_t restLength = sliceSize - posOutStream; // Set these remaining pixels memset(&sliceBuffer[posOutStream], static_cast((currValue%2)*0xff), static_cast(restLength)); for (uint64_t y = 0; y < header.size.y; y++) { xLocalData.SeekPos(y*header.size.x+sliceIndex); for (uint64_t z = 0; z < header.size.z; z++) { xLocalData.WriteRAW(&sliceBuffer[y*header.size.z+z],1); xLocalData.SeekPos(xLocalData.GetPos()+strideZ); } } currLength -= restLength; posOutStream = 0; sliceIndex++; } // Set pixels of required length if (currLength > 0) { memset(&sliceBuffer[posOutStream], static_cast((currValue%2)*0xff), static_cast(currLength)); posOutStream += currLength; } currValue++; posRLEStream++; currLength = *(rleBuffer + posRLEStream); } while (posRLEStream < header.rleLength); delete[] rleBuffer; } else { for (uint64_t x = 0; x < header.size.x; x++) { zLocalData.ReadRAW(sliceBuffer,sliceSize); for (uint64_t y = 0; y < header.size.y; y++) { xLocalData.SeekPos((y*header.size.x+x)*header.bpp); for (uint64_t z = 0; z < header.size.z; z++) { xLocalData.WriteRAW(&sliceBuffer[(y*header.size.z+z)*header.bpp], header.bpp); xLocalData.SeekPos(xLocalData.GetPos()+strideZ); } } } } delete[] sliceBuffer; if ( strInputFile != strSourceFilename ) Remove(strInputFile, Controller::Debug::Out()); return true; } // unimplemented! bool IASSConverter::ConvertToNative(const std::string&, const std::string&, uint64_t, unsigned, uint64_t, bool, bool, UINT64VECTOR3, FLOATVECTOR3, bool, bool) { return false; } bool IASSConverter::CanRead(const std::string& fn, const std::vector&) const { std::string ext = SysTools::GetExt(fn); std::transform(ext.begin(), ext.end(), ext.begin(), (int(*)(int))std::toupper); if (ext != "IASS") { std::string extPt1 = SysTools::GetExt(SysTools::RemoveExt(fn)); std::transform(extPt1.begin(), extPt1.end(), extPt1.begin(), (int(*)(int))std::toupper); ext = extPt1 + "." + ext; } return SupportedExtension(ext); } bool IASSConverter::IsZipped(const std::string& strFile) { #ifdef TUVOK_NO_ZLIB T_ERROR("No zlib support! Faking this..."); return false; #else gzFile file = gzopen(strFile.c_str(), "rb"); if (file==0) return false; int rt = gzdirect(file); gzclose(file); return rt == 1 ? false : true; #endif } IASSConverter::stHeader::stHeader() : type(INVALID), bpp(0), skip(0), rleLength(0), size(), spacing(), creator(""), history("") {} void IASSConverter::stHeader::Reset() { type = INVALID; bpp = 0; skip = 0; rleLength = 0; size.x = 0; size.y = 0; size.z = 0; spacing.x = 0.0; spacing.y = 0.0; spacing.z = 0.0; creator = ""; history = ""; } bool IASSConverter::ReadHeader(stHeader& header, std::istream& inputStream) { header.Reset(); if(!inputStream.good()) return false; std::string strLine; // read magic getline(inputStream, strLine); if (!(strLine.substr(0, 9) == "SVstatmat" || strLine.substr(0, 4) == "a4iL") || inputStream.fail()) { return false; } // read header do { getline(inputStream, strLine); if (inputStream.fail()) return false; if (strLine.substr(0, 11) == "# SPACING: ") { std::istringstream in(strLine.substr(11, strLine.length())); in >> header.spacing.x >> header.spacing.y >> header.spacing.z; } else if (strLine.substr(0, 11) == "# CREATOR: ") header.creator = strLine.substr(11, strLine.length()); else if (strLine.substr(0, 11) == "# HISTORY: ") header.history = strLine.substr(11, strLine.length()); else if (strLine.substr(0, 8) == "# TYPE: ") { if (isdigit(strLine[8])) { std::string tmp = strLine.substr(8, strLine.length()); std::istringstream input_helper(tmp); unsigned int type; input_helper >> type; header.type = static_cast(type); if (header.type < 0 || header.type >= INVALID) return false; } else { if (strLine.substr(8, strLine.length()) == "MONO") { header.type = MONO; } else if (strLine.substr(8, strLine.length()) == "GREY_8") { header.type = GREY_8; } else if (strLine.substr(8, strLine.length()) == "GREY_16") { header.type = GREY_16; } else if (strLine.substr(8, strLine.length()) == "GREY_32") { header.type = GREY_32; } else if (strLine.substr(8, strLine.length()) == "GREY_F") { header.type = GREY_F; } else if (strLine.substr(8, strLine.length()) == "COLOR" || strLine.substr(8, strLine.length()) == "RGB_8") { header.type = COLOR; } else if (strLine.substr(8, strLine.length()) == "COMPLEX_F") { header.type = COMPLEX_F; } else { return false; } } } } while (strLine[0] == '#'); if (inputStream.fail() || inputStream.eof()) { return false; } else { std::istringstream input_helper(strLine); input_helper >> header.size.x >> header.size.y >> header.size.z; if (inputStream.fail()) { return false; } } if (header.type == MONO) { getline(inputStream, strLine); if (inputStream.fail() || inputStream.eof()) { return false; } std::istringstream input_helper(strLine); input_helper >> header.rleLength; } header.skip = inputStream.tellg(); switch(header.type) { case(MONO): header.bpp = 1; break; case(GREY_8): header.bpp = 1; break; case(GREY_16): header.bpp = 2; break; case(GREY_32): header.bpp = 4; break; case(GREY_F): header.bpp = 4; break; case(COLOR): header.bpp = 3; break; case(COMPLEX_F): header.bpp = 8; break; case(INVALID): return false; }; return true; } ImageVis3D-3.1.0/Tuvok/IO/IASSConverter.h0000644000175000017500000001160012320456500017472 0ustar mathieumathieu/* The MIT License Copyright (c) 2010 Department Image Processing, Fraunhofer ITWM. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file IASSConverter.h \author Andre Liebscher Department Image Processing Fraunhofer ITWM \version 1.0 \date March 2010 */ #pragma once #ifndef TUVOK_IASSCONVERTER_H #define TUVOK_IASSCONVERTER_H #include "../StdTuvokDefines.h" #include "RAWConverter.h" /** A converter for Fraunhofer MAVI volume images. */ class IASSConverter : public RAWConverter { public: IASSConverter(); virtual ~IASSConverter() {} virtual bool ConvertToRAW(const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile); /// @todo unimplemented! virtual bool ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize, FLOATVECTOR3 vVolumeAspect, bool bNoUserInteraction, const bool bQuantizeTo8Bit); virtual bool CanRead(const std::string& fn, const std::vector& start) const; virtual bool CanExportData() const {return false;} virtual bool CanImportData() const { return true; } private: /// supported pixel types enum ePixelType { MONO = 0, ///< monochrome, one bit per pixle runlenght encoded - /// 0=background, 1=foreground GREY_8 = 1, ///< greyscale 8 bit per pixel, unsigned integer GREY_16 = 2, ///< greyscale 16 bit per pixel, unsigned integer GREY_32 = 3, ///< greyscale 32 bit per pixel, unsigned integer GREY_F = 4, ///< greyscale 32 bit per pixel, floating point COLOR = 5, ///< 3 channel RGB, 1 byte/channel image /// Note: Images of this type are not actually used RGB_8 = COLOR, ///< same as COLOR COMPLEX_F = 6, ///< greyscale 64 bit per pixel, complex, ordered pair /// of floats /// Note: This is actually a two component image INVALID }; /// iass header structure struct stHeader { // constructor stHeader(); // reset header void Reset(); /// value triple template struct stTriple { T x; ///< x coord T y; ///< y coord T z; ///< z coord }; typedef stTriple sizeType; ///< type for size triple typedef stTriple spacingType; ///< type for spacing triple ePixelType type; ///< pixel/data type uint64_t bpp; ///< bytes per pixel uint64_t skip; uint64_t rleLength; ///< length of rle stream sizeType size; ///< sample size spacingType spacing; ///< dimensions of one pixel in meters std::string creator; /*< creator of the sample/file */ std::string history; /*< history of the sample */ }; bool IsZipped(const std::string& strFile); bool ReadHeader(stHeader& header, std::istream& inputStream); }; #endif // TUVOK_IASSCONVERTER_H ImageVis3D-3.1.0/Tuvok/IO/DynamicBrickingDS.h0000644000175000017500000001470312320456500020336 0ustar mathieumathieu#ifndef TUVOK_DYNAMIC_BRICKING_DS_H #define TUVOK_DYNAMIC_BRICKING_DS_H #include #include #include #include "LinearIndexDataset.h" #include "FileBackedDataset.h" namespace tuvok { /// A dataset which will dynamically break up another data set into the /// user-given brick sizes. This is constructed purely in memory! /// @note The brick size you give this data set *includes* the brick overlap! class DynamicBrickingDS : public LinearIndexDataset, public FileBackedDataset { public: /// methods for handling the calculation of min/max data. /// MM_SOURCE: use the min/max from the source dataset. this is likely to /// have a greater range the actual data, but might still be okay. /// MM_PRECOMPUTE: precompute all the new bricks' min/max info when this /// object is created. Induces huge delays. /// MM_DYNAMIC: compute the exact min/max dynamically when the brick is /// requested. enum MinMaxMode { MM_SOURCE=0, MM_PRECOMPUTE, MM_DYNAMIC }; /// @param ds the source data set to break up /// @param maxBrickSize the brick size to use in the new data set /// @param cacheBytes how many bytes to use for the brick cache /// @param mm how should we handle brick min maxes? DynamicBrickingDS(std::shared_ptr ds, std::array maxBrickSize, size_t cacheBytes, enum MinMaxMode mm=MM_DYNAMIC); virtual ~DynamicBrickingDS(); virtual std::shared_ptr Get1DHistogram() const; virtual std::shared_ptr Get2DHistogram() const; /// modifies the cache size used for holding large bricks. void SetCacheSize(size_t megabytes); /// get the cache size used for holding large bricks in MB size_t GetCacheSize() const; virtual float MaxGradientMagnitude() const; /// Removes all the cache information we've made so far. virtual void Clear(); /// Data access ///@{ virtual bool GetBrick(const BrickKey&, std::vector&) const; virtual bool GetBrick(const BrickKey&, std::vector&) const; virtual bool GetBrick(const BrickKey&, std::vector&) const; virtual bool GetBrick(const BrickKey&, std::vector&) const; virtual bool GetBrick(const BrickKey&, std::vector&) const; virtual bool GetBrick(const BrickKey&, std::vector&) const; virtual bool GetBrick(const BrickKey&, std::vector&) const; virtual bool GetBrick(const BrickKey&, std::vector&) const; ///@} /// User rescaling factors. ///@{ void SetRescaleFactors(const DOUBLEVECTOR3&); DOUBLEVECTOR3 GetRescaleFactors() const; /// If the underlying file format supports it, save the current scaling /// factors to the file. The format should implicitly load and apply the /// scaling factors when opening the data set. virtual bool SaveRescaleFactors(); DOUBLEVECTOR3 GetScale() const; ///@} virtual unsigned GetLODLevelCount() const; virtual uint64_t GetNumberOfTimesteps() const; virtual UINT64VECTOR3 GetDomainSize(const size_t lod=0, const size_t ts=0) const; virtual UINTVECTOR3 GetBrickOverlapSize() const; UINT64VECTOR3 GetEffectiveBrickSize(const BrickKey&) const; virtual UINTVECTOR3 GetMaxBrickSize() const; virtual UINTVECTOR3 GetBrickLayout(size_t lod, size_t ts) const; virtual unsigned GetBitWidth() const; virtual uint64_t GetComponentCount() const; virtual bool GetIsSigned() const; virtual bool GetIsFloat() const; virtual bool IsSameEndianness() const; virtual std::pair GetRange() const; /// Acceleration queries. virtual bool ContainsData(const BrickKey&, double /*isoval*/) const; virtual bool ContainsData(const BrickKey&, double /*fMin*/, double /*fMax*/) const; virtual bool ContainsData(const BrickKey&, double /*fMin*/, double /*fMax*/, double /*fMinGradient*/, double /*fMaxGradient*/) const; virtual tuvok::MinMaxBlock MaxMinForKey(const BrickKey& k) const; /// unimplemented! Override these if you want tools built on this IO layer /// to be able to create data in your format. virtual bool Export(uint64_t iLODLevel, const std::string& targetFilename, bool bAppend) const; virtual bool ApplyFunction(uint64_t iLODLevel, bool (*brickFunc)(void* pData, const UINT64VECTOR3& vBrickSize, const UINT64VECTOR3& vBrickOffset, void* pUserContext), void *pUserContext, uint64_t iOverlap) const; /// Virtual constructor. virtual DynamicBrickingDS* Create(const std::string&, uint64_t, bool) const; /// functions for FileBackedDataset interface ///@{ virtual std::string Filename() const; virtual const char* Name() const; virtual bool CanRead(const std::string&, const std::vector&) const; virtual bool Verify(const std::string&) const; virtual std::list Extensions() const; ///@} private: // rebricks the data according to the current brick size parameters. void Rebrick(); private: struct dbinfo; std::unique_ptr di; }; } #endif // TUVOK_DATASET_H /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 IVDA group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/TiffVolumeConverter.cpp0000644000175000017500000002211012320456500021344 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file TiffVolumeConverter.h \author Tom Fogal SCI Institute University of Utah */ #include #ifndef TUVOK_NO_IO # include "3rdParty/tiff/tiffio.h" #else struct TIFF; #endif #include "TiffVolumeConverter.h" #include "../StdTuvokDefines.h" #include "../Controller/Controller.h" #include "../Basics/SysTools.h" #ifdef __GNUC__ # define _malloc __attribute__((malloc)) #else # define _malloc /* nothing */ #endif static void tv_dimensions(TIFF *, size_t dims[3]); _malloc static uint8_t* tv_read_slice(TIFF *); TiffVolumeConverter::TiffVolumeConverter() { m_vConverterDesc = "TIFF Volume (Image stack)"; #ifndef TUVOK_NO_IO m_vSupportedExt.push_back("OME.TIF"); m_vSupportedExt.push_back("OME.TIFF"); m_vSupportedExt.push_back("TIF"); m_vSupportedExt.push_back("TIFF"); #endif } // converts a TiffVolume to a `raw' file. We'll read through the TIFF // slice-by-slice, copying each slice to the raw file. bool TiffVolumeConverter::ConvertToRAW(const std::string& strSourceFilename, const std::string& strTempDir, bool, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile) { #ifndef TUVOK_NO_IO MESSAGE("Attempting to convert TiffVolume: %s", strSourceFilename.c_str()); TIFF *tif = TIFFOpen(strSourceFilename.c_str(), "r"); if(tif == NULL) { T_ERROR("Could not open %s", strSourceFilename.c_str()); return false; } // Get the dimensions of the volume. { size_t dims[3]; tv_dimensions(tif, dims); vVolumeSize[0] = static_cast(dims[0]); vVolumeSize[1] = static_cast(dims[1]); vVolumeSize[2] = static_cast(dims[2]); MESSAGE("TiffVolume dimensions: %ux%ux%u", static_cast(dims[0]), static_cast(dims[1]), static_cast(dims[2])); if(dims[2] <= 1) { T_ERROR("TIFF is not a volume; use " "`Load Dataset from Directory' instead!"); TIFFClose(tif); return false; } } iHeaderSkip = 0; // read the number of bits per component from the tiff tag. { uint16_t bits_per_sample; TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bits_per_sample); iComponentSize = bits_per_sample; MESSAGE("%ld bits per component.", iComponentSize); } // likewise for the number of components / pixel. { uint16_t components; TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &components); iComponentCount = components; { std::ostringstream com; com << iComponentCount << " component"; if(components > 1) { com << "s"; } com << "."; MESSAGE("%s", com.str().c_str()); } } // Libtiff handles the endian issue for us. bConvertEndianess = false; // Data type/kind: signed or unsigned, floating point or not. { bSigned = false; bIsFloat = false; uint16_t sf; if(TIFFGetField(tif, TIFFTAG_SAMPLEFORMAT, &sf) != 0) { bSigned = (sf == SAMPLEFORMAT_INT) || (sf == SAMPLEFORMAT_IEEEFP) || (sf == SAMPLEFORMAT_COMPLEXINT); bIsFloat = (sf == SAMPLEFORMAT_IEEEFP); } } // Not sure if these are readable/stored in a TIFF. vVolumeAspect[0] = 1; vVolumeAspect[1] = 1; vVolumeAspect[2] = 1; strTitle = "TIFF Volume"; // Create an intermediate file to hold the data. strIntermediateFile = strTempDir + SysTools::GetFilename(strSourceFilename) + ".binary"; LargeRAWFile binary(strIntermediateFile); binary.Create(iComponentSize/8 * iComponentCount * vVolumeSize.volume()); if(!binary.IsOpen()) { T_ERROR("Could not create binary file %s", strIntermediateFile.c_str()); TIFFClose(tif); return false; } bDeleteIntermediateFile = true; // Populate the intermediate file. We'll do this slice-by-slice, which isn't // exactly kosher for this library -- a slice could technically be larger // than INCORESIZE. But it won't be. unsigned slice_idx=0; do { MESSAGE("Reading %llux%llu TIFF slice %u of %llu", vVolumeSize[0], vVolumeSize[1], slice_idx++, vVolumeSize[2]-1); uint8_t* slice = tv_read_slice(tif); if(slice) { // assuming 8-bit data here, which might not always be valid. binary.WriteRAW(static_cast(slice), vVolumeSize[0]*vVolumeSize[1] * sizeof(uint8_t)*iComponentCount); _TIFFfree(slice); } else { binary.Close(); binary.Delete(); TIFFClose(tif); return false; } } while(TIFFReadDirectory(tif)); binary.Close(); TIFFClose(tif); return true; #else T_ERROR("Tuvok was not built with IO support!"); return false; #endif } // unimplemented! bool TiffVolumeConverter::ConvertToNative(const std::string&, const std::string&, uint64_t, unsigned, uint64_t, bool, bool, UINT64VECTOR3, FLOATVECTOR3, bool, bool) { return false; } // Reads the dimensions of the TIFF volume. X and Y come from the dimensions // of the first image in the stack: we assume that this stays constant // throughout the volume. Z comes from the number of images in the stack. static void tv_dimensions(TIFF *tif, size_t dims[3]) { #ifndef TUVOK_NO_IO uint32_t x,y; size_t z=0; TIFFSetDirectory(tif, 0); TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &x); // tiff calls the height "length" for some reason. TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &y); do { uint32_t tmpx, tmpy; TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &tmpx); TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &tmpy); if(tmpx != x) { WARNING("TIFF x dimension changes in stack!"); } if(tmpy != y) { WARNING("TIFF y dimension changes in stack!"); } ++z; } while(TIFFReadDirectory(tif)); TIFFSetDirectory(tif, 0); dims[0] = x; dims[1] = y; dims[2] = z; #endif } _malloc static uint8_t* tv_read_slice(TIFF *tif) { #ifdef TUVOK_NO_IO return NULL; #else uint8_t *slice; uint32_t width; uint32_t height; uint16_t bpp; uint16_t components; TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &width); TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &height); TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bpp); TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &components); if(bpp != 8) { T_ERROR("%hu-bit data is unsupported!", bpp); // Actually, this routine should handle it fine, // it's just that the caller and probably the rest // of Tuvok doesn't handle this well. return NULL; } const tsize_t slice_sz = width*height*(bpp/8)*components * sizeof(uint8_t); slice = static_cast(_TIFFmalloc(slice_sz)); if(slice == NULL) { T_ERROR("TIFFmalloc failed."); return NULL; } const tstrip_t n_strips = TIFFNumberOfStrips(tif); { uint8_t *data = slice; tdata_t buf = static_cast(_TIFFmalloc(TIFFStripSize(tif))); // strips shouldn't be bigger than slices. assert(TIFFStripSize(tif) <= slice_sz); for(tstrip_t s=0; s < n_strips; ++s) { tsize_t n_bytes; n_bytes = TIFFReadEncodedStrip(tif, s, buf, static_cast(-1)); std::memcpy(data, buf, n_bytes); data += n_bytes; } _TIFFfree(buf); } return slice; #endif } ImageVis3D-3.1.0/Tuvok/IO/MedAlyVisGeoConverter.cpp0000644000175000017500000000741312320456500021565 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : MedAlyVisGeoConverter.cpp //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #include "MedAlyVisGeoConverter.h" #include "Controller/Controller.h" #include "SysTools.h" #include "Mesh.h" #include #include "TuvokIOError.h" using namespace tuvok; using namespace std; MedAlyVisGeoConverter::MedAlyVisGeoConverter() : AbstrGeoConverter() { m_vConverterDesc = "MedAlyVis Hull File"; m_vSupportedExt.push_back("TRI"); } std::shared_ptr MedAlyVisGeoConverter::ConvertToMesh(const std::string& strFilename) { ifstream trisoup(strFilename.c_str(), ios::binary); if(!trisoup) { // hack, we really want some kind of 'file not found' exception. throw tuvok::io::DSOpenFailed(strFilename.c_str(), __FILE__, __LINE__); } unsigned n_vertices; unsigned n_triangles; trisoup.read(reinterpret_cast(&n_vertices), sizeof(unsigned)); trisoup.read(reinterpret_cast(&n_triangles), sizeof(unsigned)); MESSAGE("%u vertices and %u triangles.", n_vertices, n_triangles); assert(n_vertices > 0); assert(n_triangles > 0); VertVec vertices(n_vertices); // read in the world space coords of each vertex MESSAGE("reading %u vertices (each 3x floats)...", n_vertices); for(unsigned i=0; trisoup && i < n_vertices; ++i) { trisoup.read(reinterpret_cast(&(vertices[i].x)), sizeof(float)); trisoup.read(reinterpret_cast(&(vertices[i].y)), sizeof(float)); trisoup.read(reinterpret_cast(&(vertices[i].z)), sizeof(float)); } if(!trisoup) { throw tuvok::io::DSVerificationFailed("file ends before triangle indices.", __FILE__, __LINE__); } IndexVec VertIndices(n_triangles*3); // read in the triangle indices MESSAGE("reading %u triangles...", n_triangles); for(unsigned i=0; trisoup && i < n_triangles; ++i) { trisoup.read(reinterpret_cast(&(VertIndices[i*3+0])), sizeof(unsigned)); trisoup.read(reinterpret_cast(&(VertIndices[i*3+1])), sizeof(unsigned)); trisoup.read(reinterpret_cast(&(VertIndices[i*3+2])), sizeof(unsigned)); } trisoup.close(); std::string desc = m_vConverterDesc + " data converted from " + SysTools::GetFilename(strFilename); std::shared_ptr m( new Mesh(vertices,NormVec(),TexCoordVec(),ColorVec(), VertIndices,IndexVec(),IndexVec(),IndexVec(), false,false,desc,Mesh::MT_TRIANGLES) ); return m; } ImageVis3D-3.1.0/Tuvok/IO/BOVConverter.cpp0000644000175000017500000002243412320456500017723 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file BOVConverter.h \author Tom Fogal SCI Institute University of Utah */ #include #include #include #include "BOVConverter.h" #include "IO/KeyValueFileParser.h" #include "Controller/Controller.h" #include "Basics/SysTools.h" #include "exception/FileNotFound.h" enum DataType { UnknownType, Short, UShort, /* extension! */ Float, Integer, Char }; static DataType bov_type(const KeyValueFileParser &kvp); static const KeyValPair *find_header(const KeyValueFileParser &, const char *s, ...); BOVConverter::BOVConverter() { m_vConverterDesc = "Brick of Values"; m_vSupportedExt.push_back("BOV"); } bool BOVConverter::ConvertToRAW( const std::string& strSourceFilename, const std::string&, bool, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianness, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile) { MESSAGE("Attempting to convert BOV: %s", strSourceFilename.c_str()); KeyValueFileParser hdr(strSourceFilename.c_str()); if(!hdr.FileReadable()) { T_ERROR("Could not parse %s; could not open.", strSourceFilename.c_str()); return false; } KeyValPair *file = hdr.GetData("DATA_FILE"); const KeyValPair *size = find_header(hdr, "DATA SIZE", "DATA_SIZE", NULL); KeyValPair *aspect_x = hdr.GetData("BRICK X_AXIS"); KeyValPair *aspect_y = hdr.GetData("BRICK Y_AXIS"); KeyValPair *aspect_z = hdr.GetData("BRICK Z_AXIS"); strTitle = "BOV Volume"; { iHeaderSkip = 0; strIntermediateFile = SysTools::CanonicalizePath(file->strValue); // Try the path the file gave first.. if(!SysTools::FileExists(strIntermediateFile)) { // .. but if that didn't work, prepend the directory of the .bov file. strIntermediateFile = SysTools::CanonicalizePath( SysTools::GetPath(strSourceFilename) + file->strValue ); if(!SysTools::FileExists(strIntermediateFile)) { std::ostringstream err; err << "Data file referenced in BOV (" << strIntermediateFile << ") not found!"; T_ERROR("%s", err.str().c_str()); throw FILE_NOT_FOUND(err.str().c_str()); } } MESSAGE("Reading data from %s", strIntermediateFile.c_str()); bDeleteIntermediateFile = false; } { std::istringstream ss(size->strValue); ss >> vVolumeSize[0] >> vVolumeSize[1] >> vVolumeSize[2]; MESSAGE("Dimensions: %ux%ux%u", uint32_t(vVolumeSize[0]), uint32_t(vVolumeSize[1]), uint32_t(vVolumeSize[2])); iHeaderSkip = 0; } { iComponentCount = 1; iComponentSize = 8; bConvertEndianness = false; bIsFloat = false; bSigned = false; switch(bov_type(hdr)) { case Char: iComponentSize = 8; bSigned = true; break; case Short: iComponentSize = 16; bSigned = true; break; case UShort: // extension! iComponentSize = 16; break; case Integer: iComponentSize = 32; bSigned = true; break; case Float: iComponentSize = 32; bSigned = true; bIsFloat = true; break; default: T_ERROR("Unknown BOV data type."); return false; } MESSAGE("%lu-bit %s, %s data", iComponentSize, bSigned ? "signed" : "unsigned", bIsFloat ? "floating point" : "integer"); } { // e.g. "BRICK X_AXIS 1.000 0.000 0.000". Might not exist. vVolumeAspect[0] = vVolumeAspect[1] = vVolumeAspect[2] = 1.0; if(aspect_x && aspect_y && aspect_z) { std::stringstream x(aspect_x->strValue); std::stringstream y(aspect_y->strValue); std::stringstream z(aspect_z->strValue); float junk; x >> vVolumeAspect[0]; y >> junk >> vVolumeAspect[1]; z >> junk >> junk >> vVolumeAspect[2]; } MESSAGE("Aspect: %2.2fx%2.2fx%2.2f", vVolumeAspect[0], vVolumeAspect[1], vVolumeAspect[2]); } return true; } bool BOVConverter::ConvertToNative(const std::string& raw, const std::string& target, uint64_t skip, unsigned component_size, uint64_t n_components, bool is_signed, bool fp, UINT64VECTOR3 dimensions, FLOATVECTOR3 aspect, bool batch, const bool bQuantizeTo8Bit) { std::string fn_data = SysTools::RemoveExt(target); std::ofstream header(target.c_str(), std::ios::out | std::ios::trunc); std::string data_format; switch(component_size) { case 8: data_format = "BYTE"; break; case 16: data_format = "SHORT"; break; case 32: if(fp) { data_format = "FLOAT"; } else { data_format = "INT"; } break; case 64: // In BOV, a 64bit integer dataset is a 2-component 32-bit integer // dataset. As far as I can tell... if(fp) { data_format = "DOUBLE"; } else { data_format = "INT"; } break; } header << "DATA_FILE: " << raw << ".data" << std::endl << "DATA SIZE: " << dimensions[0] << " " << dimensions[1] << " " << dimensions[2] << std::endl << "DATA FORMAT: " << data_format << std::endl << "DATA_COMPONENTS: " << n_components << std::endl << "VARIABLE: from_imagevis3d" << std::endl << "BRICK_SIZE: " << dimensions[0] << " " << dimensions[1] << " " << dimensions[2] << std::endl << "CENTERING: nodal" << std::endl; header.close(); // copy the raw file. return RAWConverter::ConvertToNative(raw, raw + ".data", skip, component_size, n_components, is_signed, fp, dimensions, aspect, batch, bQuantizeTo8Bit); } static DataType bov_type(const KeyValueFileParser &kvp) { const KeyValPair *format = NULL; DataType retval = UnknownType; // Search a list of strings until we find one. static const char formats[][16] = { "DATA FORMAT", "DATA_FORMAT", "FORMAT" }; for(size_t i=0; i < sizeof(formats); ++i) { format = kvp.GetData(formats[i]); if(format != NULL) { break; } } // Might not have found any of those. if(format == NULL) { T_ERROR("Could not determine data format. " "Is this a BOV file? Potentially corrupt."); return UnknownType; } // Data type is specified by strings, but the exact string isn't quite // uniform. Another search. static const char floats[][16] = { "FLOAT", "FLOATS" }; for(size_t i=0; i < sizeof(floats); ++i) { if(format->strValueUpper == std::string(floats[i])) { retval = Float; break; } } if(format->strValueUpper == std::string("SHORT")) { retval = Short; } if(format->strValueUpper == std::string("USHORT")) { retval = UShort; } if(format->strValueUpper == std::string("BYTE")) { retval = Char; } if(retval != Float && retval != Short && retval != Char) { WARNING("Unknown BOV data type '%s'", format->strValue.c_str()); } return retval; } // Given a list of strings, returns the first KeyValPair that exists. Useful // since some bovs use "_" between words in a key, some don't... // The argument list must be NULL-terminated. static const KeyValPair * find_header(const KeyValueFileParser &kvp, const char *s, ...) { va_list args; const KeyValPair *ret; // First try 's'. ret = kvp.GetData(s); if(ret) { return ret; } va_start(args, s); const char *key = va_arg(args, const char *); while(key) { ret = kvp.GetData(key); if(ret) { return ret; } } va_end(args); return NULL; } ImageVis3D-3.1.0/Tuvok/IO/Dataset.h0000644000175000017500000001671112320456500016440 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Dataset.h \author Tom Fogal SCI Institute University of Utah */ #pragma once #ifndef TUVOK_DATASET_H #define TUVOK_DATASET_H #include "StdTuvokDefines.h" #include #include #include #include #include #include #include "Basics/Grids.h" #include "Basics/Vectors.h" #include "Brick.h" #define MAX_TRANSFERFUNCTION_SIZE 4096 typedef Grid1D Histogram1D; typedef Grid2D Histogram2D; class LargeRAWFile; namespace tuvok { class Metadata; class Mesh; /// Abstract interface to a dataset. /// noncopyable not because it wouldn't work, but because we might be holding a /// lot of data -- copying would be prohibitively expensive. class Dataset : public boost::noncopyable { public: Dataset(); virtual ~Dataset(); // GetMeshes no longer returns a reference to its mesh vector. // Any function that is routed through the scripting system *cannot* return // references. It doesn't make sense in terms of Lua. Pointers in the form of // shared_ptr's are fine however and are represented as lightuserdata in Lua. // See Tuvok's LuaDatasetProxy. std::vector> GetMeshes() const { return m_vpMeshList; } virtual std::shared_ptr Get1DHistogram() const { return m_pHist1D; } virtual std::shared_ptr Get2DHistogram() const { return m_pHist2D; } virtual float MaxGradientMagnitude() const = 0; /// Remove all cached bricks / brick metadata. virtual void Clear() = 0; /// Gets the number of voxels, per dimension. virtual UINTVECTOR3 GetBrickVoxelCounts(const BrickKey&) const = 0; /// World space extents. virtual FLOATVECTOR3 GetBrickExtents(const BrickKey &) const = 0; /// Data access ///@{ virtual bool GetBrick(const BrickKey&, std::vector&) const=0; virtual bool GetBrick(const BrickKey&, std::vector&) const = 0; virtual bool GetBrick(const BrickKey&, std::vector&) const=0; virtual bool GetBrick(const BrickKey&, std::vector&) const=0; virtual bool GetBrick(const BrickKey&, std::vector&) const=0; virtual bool GetBrick(const BrickKey&, std::vector&) const=0; virtual bool GetBrick(const BrickKey&, std::vector&) const=0; virtual bool GetBrick(const BrickKey&, std::vector&) const=0; ///@} virtual BrickTable::const_iterator BricksBegin() const = 0; virtual BrickTable::const_iterator BricksEnd() const = 0; /// @return the number of bricks in a given LoD + timestep. virtual BrickTable::size_type GetBrickCount(size_t lod, size_t ts) const = 0; /// @return the LOD idx for a large 1-brick LOD. virtual size_t GetLargestSingleBrickLOD(size_t ts) const=0; virtual bool BrickIsFirstInDimension(size_t, const BrickKey&) const = 0; virtual bool BrickIsLastInDimension(size_t, const BrickKey&) const = 0; /// User rescaling factors. ///@{ void SetRescaleFactors(const DOUBLEVECTOR3&); DOUBLEVECTOR3 GetRescaleFactors() const; /// If the underlying file format supports it, save the current scaling /// factors to the file. The format should implicitly load and apply the /// scaling factors when opening the file. virtual bool SaveRescaleFactors() {return false;} ///@} /// If the underlying file format supports it, crop the dataset at the /// given plane, i.e. set all values one side to zero virtual bool Crop( const PLANE& , const std::string&, bool, bool, bool ) {return false;} virtual unsigned GetLODLevelCount() const = 0; /// @todo FIXME, should be pure virtual && overridden in derived virtual uint64_t GetNumberOfTimesteps() const { return 1; } virtual UINT64VECTOR3 GetDomainSize(const size_t lod=0, const size_t ts=0) const = 0; virtual DOUBLEVECTOR3 GetScale() const {return m_DomainScale * m_UserScale;} virtual UINTVECTOR3 GetBrickOverlapSize() const = 0; /// @return the number of voxels for the given brick, per dimension, taking /// into account any brick overlaps. virtual UINT64VECTOR3 GetEffectiveBrickSize(const BrickKey &) const = 0; virtual unsigned GetBitWidth() const = 0; virtual uint64_t GetComponentCount() const = 0; virtual bool GetIsSigned() const = 0; virtual bool GetIsFloat() const = 0; virtual bool IsSameEndianness() const = 0; virtual std::pair GetRange() const = 0; virtual const std::vector> GetMetadata() const { std::vector> v; return v; } /// Acceleration queries. virtual bool ContainsData(const BrickKey&, double /*isoval*/) const {return true;} virtual bool ContainsData(const BrickKey&, double /*fMin*/, double /*fMax*/) const {return true;} virtual bool ContainsData(const BrickKey&, double /*fMin*/, double /*fMax*/, double /*fMinGradient*/, double /*fMaxGradient*/) const {return true;} /// unimplemented! Override these if you want tools built on this IO layer /// to be able to create data in your format. virtual bool Export(uint64_t iLODLevel, const std::string& targetFilename, bool bAppend) const = 0; virtual bool ApplyFunction(uint64_t iLODLevel, bool (*brickFunc)(void* pData, const UINT64VECTOR3& vBrickSize, const UINT64VECTOR3& vBrickOffset, void* pUserContext), void *pUserContext, uint64_t iOverlap) const = 0; /// Virtual constructor. virtual Dataset* Create(const std::string&, uint64_t, bool) const=0; /// this function computes the texture coordinates for a given brick /// this may be non trivial with power of two padding, overlap handling /// and per brick rescale virtual std::pair GetTextCoords( BrickTable::const_iterator brick, bool bUseOnlyPowerOfTwo ) const; protected: std::shared_ptr m_pHist1D; std::shared_ptr m_pHist2D; std::vector> m_vpMeshList; DOUBLEVECTOR3 m_UserScale; DOUBLEVECTOR3 m_DomainScale; void DeleteMeshes(); }; } #endif // TUVOK_DATASET_H ImageVis3D-3.1.0/Tuvok/IO/MobileGeoConverter.h0000644000175000017500000000402112320456500020574 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : MobileGeoConverter.h //! Author : Georg Tamm //! DFKI, Saarbruecken //! Date : July 2010 // //! Copyright (C) 2010 DFKI Institute #pragma once #ifndef MOBILEGEOCONVERTER_H #define MOBILEGEOCONVERTER_H #include "../StdTuvokDefines.h" #include "AbstrGeoConverter.h" namespace tuvok { class Mesh; class MobileGeoConverter : public AbstrGeoConverter { public: MobileGeoConverter(); virtual ~MobileGeoConverter() {} virtual std::shared_ptr ConvertToMesh(const std::string& strFilename); virtual bool ConvertToNative(const Mesh& m, const std::string& strTargetFilename); virtual bool CanExportData() const { return true; } virtual bool CanImportData() const { return true; } }; } #endif // MOBILEGEOCONVERTER_H ImageVis3D-3.1.0/Tuvok/IO/NRRDConverter.cpp0000644000175000017500000004553312320456500020047 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file NRRDConverter.cpp \author Jens Krueger SCI Institute University of Utah \date December 2008 */ #include #include "NRRDConverter.h" #include #include #include #include #include "TuvokIOError.h" using namespace std; NRRDConverter::NRRDConverter() { m_vConverterDesc = "Nearly Raw Raster Data"; m_vSupportedExt.push_back("NRRD"); m_vSupportedExt.push_back("NHDR"); } bool NRRDConverter::ConvertToRAW(const std::string& strSourceFilename, const std::string& strTempDir, bool, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile) { MESSAGE("Attempting to convert NRRD dataset %s", strSourceFilename.c_str()); // Check Magic value in NRRD File first ifstream fileData(strSourceFilename.c_str()); string strFirstLine; if (fileData.is_open()) { getline (fileData,strFirstLine); if (strFirstLine.substr(0,7) != "NRRD000") { WARNING("The file %s is not a NRRD file (missing magic)", strSourceFilename.c_str()); return false; } } else { WARNING("Could not open NRRD file %s", strSourceFilename.c_str()); return false; } fileData.close(); // init data strTitle = "NRRD data"; iComponentSize=8; iComponentCount=1; bSigned=false; bool bBigEndian=false; vVolumeSize = UINT64VECTOR3(1,1,1); vVolumeAspect = FLOATVECTOR3(1,1,1); string strRAWFile; bDeleteIntermediateFile = false; // read data KeyValueFileParser parser(strSourceFilename, true); if (!parser.FileReadable()) { WARNING("Could not open NRRD file %s", strSourceFilename.c_str()); return false; } KeyValPair* kvpType = parser.GetData("TYPE"); if (kvpType == NULL) { T_ERROR("Could not open find token \"type\" in file %s", strSourceFilename.c_str()); return false; } else { if (kvpType->strValueUpper == "SIGNED CHAR" || kvpType->strValueUpper == "INT8" || kvpType->strValueUpper == "INT8_T") { bSigned = true; bIsFloat = false; iComponentSize = 8; } else if (kvpType->strValueUpper == "UCHAR" || kvpType->strValueUpper == "UNSIGNED CHAR" || kvpType->strValueUpper == "UINT8" || kvpType->strValueUpper == "UINT8_T") { bSigned = false; bIsFloat = false; iComponentSize = 8; } else if (kvpType->strValueUpper == "SHORT" || kvpType->strValueUpper == "SHORT INT" || kvpType->strValueUpper == "SIGNED SHORT" || kvpType->strValueUpper == "SIGNED SHORT INT" || kvpType->strValueUpper == "INT16" || kvpType->strValueUpper == "INT16_T") { bSigned = true; bIsFloat = false; iComponentSize = 16; } else if (kvpType->strValueUpper == "USHORT" || kvpType->strValueUpper == "UNSIGNED SHORT" || kvpType->strValueUpper == "UNSIGNED SHORT INT" || kvpType->strValueUpper == "UINT16" || kvpType->strValueUpper == "UINT16_T") { bSigned = false; bIsFloat = false; iComponentSize = 16; } else if (kvpType->strValueUpper == "INT" || kvpType->strValueUpper == "SIGNED INT" || kvpType->strValueUpper == "INT32" || kvpType->strValueUpper == "INT32_T") { bSigned = true; bIsFloat = false; iComponentSize = 32; } else if (kvpType->strValueUpper == "UINT" || kvpType->strValueUpper == "UNSIGNED INT" || kvpType->strValueUpper == "UINT32" || kvpType->strValueUpper == "UINT32_T") { bSigned = false; bIsFloat = false; iComponentSize = 32; } else if (kvpType->strValueUpper == "LONGLONG" || kvpType->strValueUpper == "LONG LONG" || kvpType->strValueUpper == "LONG LONG INT" || kvpType->strValueUpper == "SIGNED LONG LONG" || kvpType->strValueUpper == "SIGNED LONG LONG INT" || kvpType->strValueUpper == "INT64" || kvpType->strValueUpper == "INT64_T") { bSigned = true; bIsFloat = false; iComponentSize = 64; } else if (kvpType->strValueUpper == "ULONGLONG" || kvpType->strValueUpper == "UNSIGNED LONG LONG" || kvpType->strValueUpper == "UNSIGNED LONG LONG INT" || kvpType->strValueUpper == "UINT64" || kvpType->strValueUpper == "UINT64_T") { bSigned = true; bIsFloat = false; iComponentSize = 64; } else if (kvpType->strValueUpper == "FLOAT" || kvpType->strValueUpper == "FLOAT32") { bSigned = true; bIsFloat = true; iComponentSize = 32; MESSAGE("Floating point nrrd."); } else if (kvpType->strValueUpper == "DOUBLE" || kvpType->strValueUpper == "FLOAT64") { bSigned = true; bIsFloat = true; iComponentSize = 64; MESSAGE("Double-precision nrrd."); } else { T_ERROR("Unsupported \"type\" in file %s", strSourceFilename.c_str()); return false; } } KeyValPair* kvpSizes = parser.GetData("SIZES"); if (kvpSizes == NULL) { T_ERROR("Could not open find token \"sizes\" in file %s", strSourceFilename.c_str()); return false; } else { size_t j = 0; for (size_t i = 0;ivuiValue.size();i++) { if (kvpSizes->vuiValue[i] > 1) { if (j>2) { T_ERROR("Only 3D NRRDs are supported at the moment"); return false; } vVolumeSize[j] = kvpSizes->vuiValue[i]; j++; } } } KeyValPair* kvpDim = parser.GetData("DIMENSION"); if (kvpDim == NULL) { T_ERROR("Could not open find token \"dimension\" in file %s", strSourceFilename.c_str()); return false; } else { if (kvpDim->iValue < 3) { WARNING("The dimension of this NRRD file is less than three."); } if (kvpDim->iValue > 3) { WARNING("The dimension of this NRRD file is more than three."); } } bool bDetachedHeader; KeyValPair* kvpDataFile1 = parser.GetData("DATA FILE"); KeyValPair* kvpDataFile2 = parser.GetData("DATAFILE"); if (kvpDataFile1 == NULL && kvpDataFile2 == NULL) { iHeaderSkip = uint64_t(parser.GetStopPos()); strRAWFile = strSourceFilename; bDetachedHeader = false; if (iHeaderSkip == 0) { // parser read the entire file and did not find a // data part (separated by an empty line) T_ERROR("NRRD file does neither specify detached data file nor does it " "contain data after the header, separated by an empty line."); return false; } } else { if (kvpDataFile1 && kvpDataFile2 && kvpDataFile1->strValue != kvpDataFile2->strValue) WARNING( "Found different 'data file' and 'datafile' fields, using 'datafile'."); if (kvpDataFile1) strRAWFile = SysTools::GetPath(strSourceFilename) + kvpDataFile1->strValue; if (kvpDataFile2) strRAWFile = SysTools::GetPath(strSourceFilename) + kvpDataFile2->strValue; iHeaderSkip = 0; bDetachedHeader = true; } KeyValPair* kvpSpacings = parser.GetData("SPACINGS"); if (kvpSpacings != NULL) { size_t j = 0; for (size_t i = 0;ivuiValue.size();i++) { if (kvpSpacings->vfValue.size() <= i) break; if (kvpSizes->vuiValue[i] > 1) { vVolumeAspect[j] = kvpSpacings->vfValue[i]; j++; } } } try { KeyValPair* kvpSpaceDirs = parser.GetData("SPACE DIRECTIONS"); if (kvpSpaceDirs != NULL) { std::vector dirs = kvpSpaceDirs->vstrValue; if (dirs.size() == 3) { for (size_t dim = 0;dim<3;dim++) { FLOATVECTOR3 axis; size_t iStart = 0; for (size_t vDim = 0;vDim<3;vDim++) { while (!isdigit(dirs[dim][iStart]) && '.' != dirs[dim][iStart] && '-' != dirs[dim][iStart] && 'e' != dirs[dim][iStart]) { iStart++; if (iStart >= dirs[dim].length()) { throw tuvok::io::DSParseFailed("malformed 'space directions' tag."); } } size_t iEnd = iStart+1; while (isdigit(dirs[dim][iEnd]) || '.' == dirs[dim][iEnd] || '-' == dirs[dim][iEnd] || 'e' == dirs[dim][iEnd]) { iEnd++; if (iEnd >= dirs[dim].length()) { throw tuvok::io::DSParseFailed("malformed 'space directions' tag."); } } axis[vDim] = SysTools::FromString(dirs[dim].substr(iStart, 1+iStart-iEnd)); iStart = iEnd; } vVolumeAspect[dim] *= axis.length(); } } else { WARNING("Ignoring malformed 'space directions' tag."); } } } catch (const tuvok::io::DSParseFailed& err) { WARNING(err.what()); } for(size_t i=0; i < 3; ++i) { // reset broken space directions parsing. if(vVolumeAspect[i] == 0.0) { vVolumeAspect[i] = 1.0f; } } int iLineSkip = 0; int iByteSkip = 0; KeyValPair* kvpLineSkip1 = parser.GetData("LINE SKIP"); if (kvpLineSkip1 != NULL) iLineSkip = kvpLineSkip1->iValue; KeyValPair* kvpLineSkip2 = parser.GetData("LINESKIP"); if (kvpLineSkip2 != NULL) { if (kvpLineSkip1 != NULL && iLineSkip != kvpLineSkip2->iValue) WARNING( "Found different 'line skip' and 'lineskip' fields, using 'lineskip'."); iLineSkip = kvpLineSkip2->iValue; } KeyValPair* kvpByteSkip1 = parser.GetData("BYTE SKIP"); if (kvpByteSkip1 != NULL) iByteSkip = kvpByteSkip1->iValue; KeyValPair* kvpByteSkip2 = parser.GetData("BYTESKIP"); if (kvpByteSkip2 != NULL) { if (kvpByteSkip1 != NULL && iByteSkip != kvpByteSkip2->iValue) WARNING( "Found different 'byte skip' and 'byteskip' fields, using 'byteskip'."); iByteSkip = kvpByteSkip2->iValue; } if (iLineSkip < 0) { WARNING( "Negative 'line skip' found, ignoring."); iLineSkip = 0; } if (iByteSkip == -1 && iLineSkip != 0) { WARNING( "'byte skip' = -1 'line skip' found, ignoring 'line skip'."); iLineSkip = 0; } std::streamoff iLineSkipBytes = 0; if (iLineSkip != 0) { ifstream fileData(strRAWFile.c_str(),ios::binary); string line; if (fileData.is_open()) { int i = 0; while (! fileData.eof() ) { getline (fileData,line); i++; if (i == iLineSkip) { iLineSkipBytes = fileData.tellg(); break; } } if (iLineSkipBytes == 0) WARNING( "Invalid 'line skip', file to short, ignoring 'line skip'."); fileData.close(); } else { WARNING( "Unable to open target file, ignoring 'line skip'."); } } KeyValPair* kvpEndian = parser.GetData("ENDIAN"); if (kvpEndian != NULL && kvpEndian->strValueUpper == "BIG") bBigEndian = true; bConvertEndianess = bBigEndian != EndianConvert::IsBigEndian(); KeyValPair* kvpEncoding = parser.GetData("ENCODING"); if (kvpEncoding == NULL) { T_ERROR("Could not find token \"encoding\" in file %s", strSourceFilename.c_str()); return false; } else { if (kvpEncoding->strValueUpper == "RAW") { MESSAGE("NRRD data is in RAW format!"); if (iByteSkip == -1) { LargeRAWFile f(strRAWFile); f.Open(false); uint64_t iSize = f.GetCurrentSize(); f.Close(); iHeaderSkip = iSize - (iComponentSize/8 * iComponentCount * uint64_t(vVolumeSize.volume())); } else { if (iByteSkip != 0) { if (bDetachedHeader) iHeaderSkip = iByteSkip; else { WARNING( "Skip value in attached header found."); iHeaderSkip += iByteSkip; } } } iHeaderSkip += iLineSkipBytes; strIntermediateFile = strRAWFile; bDeleteIntermediateFile = false; return true; } else { if (iByteSkip == -1) WARNING( "Found illegal -1 'byte skip' in non RAW mode, ignoring 'byte skip'."); if (kvpEncoding->strValueUpper == "TXT" || kvpEncoding->strValueUpper == "TEXT" || kvpEncoding->strValueUpper == "ASCII") { MESSAGE("NRRD data is plain textformat."); string strBinaryFile = strTempDir+SysTools::GetFilename(strSourceFilename)+".binary"; bool bResult = ParseTXTDataset(strRAWFile, strBinaryFile, iHeaderSkip, iComponentSize, iComponentCount, bSigned, bIsFloat, vVolumeSize); strIntermediateFile = strBinaryFile; bDeleteIntermediateFile = true; iHeaderSkip = 0; bConvertEndianess = false; return bResult; } else if (kvpEncoding->strValueUpper == "HEX") { T_ERROR("NRRD data is in hexadecimal text format which is not supported at the moment."); } else if (kvpEncoding->strValueUpper == "GZ" || kvpEncoding->strValueUpper == "GZIP") { MESSAGE("NRRD data is GZIP compressed RAW format."); string strUncompressedFile = strTempDir+SysTools::GetFilename(strSourceFilename)+".uncompressed"; bool bResult = ExtractGZIPDataset(strRAWFile, strUncompressedFile, iHeaderSkip); strIntermediateFile = strUncompressedFile; bDeleteIntermediateFile = true; iHeaderSkip = 0; return bResult; } else if (kvpEncoding->strValueUpper == "BZ" || kvpEncoding->strValueUpper == "BZIP2") { MESSAGE("NRRD data is BZIP2 compressed RAW format."); string strUncompressedFile = strTempDir+SysTools::GetFilename(strSourceFilename)+".uncompressed"; bool bResult = ExtractBZIP2Dataset(strRAWFile, strUncompressedFile, iHeaderSkip); strIntermediateFile = strUncompressedFile; bDeleteIntermediateFile = true; iHeaderSkip = 0; return bResult; } else { T_ERROR("NRRD data is in unknown \"%s\" format."); } } return false; } } bool NRRDConverter::ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize,FLOATVECTOR3 vVolumeAspect, bool bNoUserInteraction, const bool bQuantizeTo8Bit) { bool bDetached = SysTools::ToLowerCase(SysTools::GetExt(strTargetFilename)) == "nhdr"; // compute fromat string string strFormat; bool bFormatOK = true; if (bFloatingPoint) { if (bSigned) { switch (iComponentSize) { case 32 : strFormat = "FLOAT"; break; case 64 : strFormat = "DOUBLE"; break; default : bFormatOK = false; break; } } else { bFormatOK = false; } } else { if (bSigned) { switch (iComponentSize) { case 8 : strFormat = "SIGNED CHAR"; break; case 16 : strFormat = "SHORT"; break; case 32 : strFormat = "INT"; break; case 64 : strFormat = "LONGLONG"; break; default : bFormatOK = false; break; } } else { switch (iComponentSize) { case 8 : strFormat = "UCHAR"; break; case 16 : strFormat = "USHORT"; break; case 32 : strFormat = "UINT"; break; case 64 : strFormat = "ULONGLONG"; break; default : bFormatOK = false; break; } } } if (!bFormatOK) { T_ERROR("This data type is not supported by NRRD files."); return false; } // create header textfile from metadata ofstream fAsciiTarget(strTargetFilename.c_str()); if (!fAsciiTarget.is_open()) { T_ERROR("Unable to open target file %s.", strTargetFilename.c_str()); return false; } fAsciiTarget << "NRRD0001" << endl; fAsciiTarget << "type: " << strFormat << endl; fAsciiTarget << "dimension: 3" << endl; fAsciiTarget << "sizes: " << vVolumeSize.x << " " << vVolumeSize.y << " "<< vVolumeSize.z << endl; fAsciiTarget << "spacings: " << vVolumeAspect.x << " " << vVolumeAspect.y << " "<< vVolumeAspect.z << endl; fAsciiTarget << "endian: little" << endl; fAsciiTarget << "encoding: raw" << endl; if (bDetached) { string strTargetRAWFilename = strTargetFilename+".raw"; fAsciiTarget << "data file: ./" << SysTools::GetFilename(strTargetRAWFilename) << endl; fAsciiTarget.close(); // copy RAW file using the parent's call bool bRAWSuccess = RAWConverter::ConvertToNative(strRawFilename, strTargetRAWFilename, iHeaderSkip, iComponentSize, iComponentCount, bSigned, bFloatingPoint, vVolumeSize, vVolumeAspect, bNoUserInteraction, bQuantizeTo8Bit); if (bRAWSuccess) { return true; } else { T_ERROR("Error creating raw target file %s.", strTargetRAWFilename.c_str()); remove(strTargetFilename.c_str()); return false; } } else { // add the "empty line" header delimiter fAsciiTarget << endl; fAsciiTarget.close(); // append RAW data using the parent's call bool bRAWSuccess = AppendRAW(strRawFilename, iHeaderSkip, strTargetFilename, iComponentSize, bQuantizeTo8Bit); if (bRAWSuccess) { return true; } else { T_ERROR("Error appending raw data to header file %s.", strTargetFilename.c_str()); remove(strTargetFilename.c_str()); return false; } } } ImageVis3D-3.1.0/Tuvok/IO/TTIFFWriter/0000755000175000017500000000000012320456500016745 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/IO/TTIFFWriter/TTIFFWriter.h0000644000175000017500000000631212320456500021171 0ustar mathieumathieu#ifndef TTIFFWRITER #define TTIFFWRITER #include "StdTuvokDefines.h" #include #include #include #include #include class ttiff_error : public std::runtime_error { public: ttiff_error(const std::string& m) : std::runtime_error(m) { } }; class TTIFFWriter { public: enum TTDataType { TT_RGB, TT_RGBA }; static void Write(const std::string& filename, uint32_t width, uint32_t height, TTDataType dataType, const std::vector& data); static void Write(const std::string& filename, uint32_t width, uint32_t height, TTDataType dataType, const std::vector& data); static void Write(const std::string& filename, uint32_t width, uint32_t height, TTDataType dataType, const std::vector& data); static void Write(const std::string& filename, uint32_t width, uint32_t height, TTDataType dataType, const std::vector& data); private: static void WriteHeader(std::ofstream& file); static void WriteIDF(std::ofstream& file, uint32_t width, uint32_t height, uint16_t bytesPerComponent, TTDataType dataType, bool isFloat); template static bool VerifyVector(uint32_t width, uint32_t height, TTDataType dataType, const std::vector& data) { return data.size() >= width*height*TypeToSize(dataType); } template static void WriteData(std::ofstream& file, uint32_t width, uint32_t height, TTDataType dataType, const std::vector& data) { size_t iElementCount = width*height*TypeToSize(dataType); file.write((const char*)&(data[0]), iElementCount*sizeof(T)); } static size_t TypeToSize(TTDataType dataType); }; #endif // TTIFFWRITER /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/TTIFFWriter/TTIFFWriter.cpp0000644000175000017500000002220112320456500021517 0ustar mathieumathieu#include "TTIFFWriter.h" void TTIFFWriter::Write(const std::string& filename, uint32_t width, uint32_t height, TTDataType dataType, const std::vector& data) { if (!VerifyVector(width, height, dataType, data)) throw ttiff_error("Data vector too small"); std::ofstream file; file.open(filename.c_str(), std::ios::binary); if (file.bad()) throw ttiff_error("Unable to open file"); WriteHeader(file); WriteIDF(file, width, height, 1, dataType, false); WriteData(file, width, height, dataType, data); } void TTIFFWriter::Write(const std::string& filename, uint32_t width, uint32_t height, TTDataType dataType, const std::vector& data) { if (!VerifyVector(width, height, dataType, data)) throw ttiff_error("Data vector too small"); std::ofstream file; file.open(filename.c_str(), std::ios::binary); if (file.bad()) throw ttiff_error("Unable to open file"); WriteHeader(file); WriteIDF(file, width, height, 2, dataType, false); WriteData(file, width, height, dataType, data); } void TTIFFWriter::Write(const std::string& filename, uint32_t width, uint32_t height, TTDataType dataType, const std::vector& data) { if (!VerifyVector(width, height, dataType, data)) throw ttiff_error("Data vector too small"); std::ofstream file; file.open(filename.c_str(), std::ios::binary); if (file.bad()) throw ttiff_error("Unable to open file"); WriteHeader(file); WriteIDF(file, width, height, 4, dataType, false); WriteData(file, width, height, dataType, data); } void TTIFFWriter::Write(const std::string& filename, uint32_t width, uint32_t height, TTDataType dataType, const std::vector& data) { if (!VerifyVector(width, height, dataType, data)) throw ttiff_error("Data vector too small"); std::ofstream file; file.open(filename.c_str(), std::ios::binary); if (file.bad()) throw ttiff_error("Unable to open file"); WriteHeader(file); WriteIDF(file, width, height, 4, dataType, true); WriteData(file, width, height, dataType, data); } void TTIFFWriter::WriteHeader(std::ofstream& file) { uint32_t offset = 8; uint32_t magic = uint32_t(0x002a4949); file.write((const char*)&magic, 4); file.write((const char*)&offset, 4); } class TagItem { public: TagItem(uint16_t _tag) : tag(_tag) {} TagItem(uint16_t _tag, uint16_t data) : tag(_tag) {data16.push_back(data);} TagItem(uint16_t _tag, uint32_t data) : tag(_tag) {data32.push_back(data);} TagItem(uint16_t _tag, const std::vector& data) : tag(_tag), data16(data) {} TagItem(uint16_t _tag, const std::vector& data) : tag(_tag), data32(data) {} uint16_t GetAdditionalOffset() { if (data16.size() > 1 || data32.size() > 1) return uint16_t(data16.size()*2 + data32.size()*4); else return 0; } void Write(std::ofstream& file, uint16_t iCurrentOffset, uint16_t iTotalOffset) { if (data16.size() == 1) { WriteTag(file, tag, 1, data16[0]); return; } if (data32.size() == 1) { WriteTag(file, tag, 1, data32[0]); return; } if (data16.size() > 1) { WriteTag(file, tag, uint32_t(data16.size()), iCurrentOffset); return; } if (data32.size() > 1) { WriteTag(file, tag, uint32_t(data32.size()), iCurrentOffset); return; } // special case: write the offset as data (normally used for image location) WriteTag(file, tag, 1, iTotalOffset); } void WriteVectorData(std::ofstream& file) { if (data16.size() > 1) { for (std::vector::iterator elem = data16.begin(); elem 1) { for (std::vector::iterator elem = data32.begin(); elem data16; std::vector data32; void WriteTag(std::ofstream& file, uint16_t tag, uint32_t size, uint16_t data) { file.write((const char*)&tag, 2); uint16_t type = 3; // 16bit int file.write((const char*)&type, 2); file.write((const char*)&size, 4); uint32_t elem = data; file.write((const char*)&elem, 4); } void WriteTag(std::ofstream& file, uint16_t tag, uint32_t size, uint32_t data) { file.write((const char*)&tag, 2); uint16_t type = 4; // 32bit int file.write((const char*)&type, 2); file.write((const char*)&size, 4); file.write((const char*)&data, 4); } }; class TagVector { public: TagVector() : iOffset(0) {} void add(const TagItem& tag) { tags.push_back(tag); } void Write(std::ofstream& file, uint16_t iBaseOffset) { // write footer elem count uint16_t count = uint16_t(tags.size()); file.write((const char*)&count, 2); iBaseOffset += 2 // footer elem count + 12*count // footer tags + 4; // footer termination; uint16_t iCurrentOffset = iBaseOffset; uint16_t iTotalOffset = iBaseOffset; // compute total offset to find image data start for (std::vector::iterator tag = tags.begin(); tagGetAdditionalOffset(); } // write tags for (std::vector::iterator tag = tags.begin(); tagWrite(file, iCurrentOffset, iTotalOffset); iCurrentOffset += tag->GetAdditionalOffset(); } // footer termination; uint32_t term = 0; // this is the one and only image plane so terminate file.write((const char*)&term, 4); // write tag's vector data for (std::vector::iterator tag = tags.begin(); tagWriteVectorData(file); } } private: std::vector tags; uint16_t iOffset; }; void TTIFFWriter::WriteIDF(std::ofstream& file, uint32_t width, uint32_t height, uint16_t bytesPerComponent, TTDataType dataType, bool bIsFloat) { // for details check out: // http://www.awaresystems.be/imaging/tiff/tifftags/baseline.html TagVector tags; tags.add(TagItem(256, width)); tags.add(TagItem(257, height)); std::vector bpp; bpp.push_back(bytesPerComponent*8); bpp.push_back(bytesPerComponent*8); bpp.push_back(bytesPerComponent*8); if (dataType == TT_RGBA) bpp.push_back(bytesPerComponent*8); tags.add(TagItem(258, bpp)); // vector tag bytesPerComponent tags.add(TagItem(259, uint16_t(1))); // no compression tags.add(TagItem(262, uint16_t(2))); // 2 = RGB (even for RGBA !!!) tags.add(TagItem(273)); // offset to data tags.add(TagItem(274, uint16_t(1))); // default orientation tags.add(TagItem(277, uint16_t(TypeToSize(dataType)))); // SamplesPerPixel tags.add(TagItem(278, height)); // Rows per strip uint32_t stripByteCount = uint32_t(width*height*bytesPerComponent*TypeToSize(dataType)); tags.add(TagItem(279, stripByteCount)); // Strip Byte Counts tags.add(TagItem(284, uint16_t(1))); // Planar configuration if (dataType == TT_RGBA) tags.add(TagItem(338, uint16_t(1))); // 4th channel is alpha uint16_t iFormat = (bIsFloat) ? 3 : 1; // sample format (1=int, 3=float) std::vector sampleFormat; sampleFormat.push_back(iFormat); sampleFormat.push_back(iFormat); sampleFormat.push_back(iFormat); if (dataType == TT_RGBA) sampleFormat.push_back(iFormat); tags.add(TagItem(339, sampleFormat)); // vector tag bytesPerComponent tags.Write(file, 8); } size_t TTIFFWriter::TypeToSize(TTDataType dataType) { switch (dataType) { case TT_RGB: return 3; case TT_RGBA: return 4; default : return 0; } } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/DirectoryParser.h0000644000175000017500000000654612320456500020201 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DirectoryParser.h \author Jens Krueger SCI Institute University of Utah \date September 2008 */ #pragma once #ifndef DIRECTORYPARSER_H #define DIRECTORYPARSER_H #include #include #include #include "StdTuvokDefines.h" #include "Basics/Vectors.h" class SimpleFileInfo { public: SimpleFileInfo(); SimpleFileInfo(const std::string& strFileName); SimpleFileInfo(const std::wstring& wstrFileName); SimpleFileInfo(const SimpleFileInfo* info); virtual ~SimpleFileInfo() {} std::string m_strFileName; std::wstring m_wstrFileName; uint32_t m_iImageIndex; uint32_t GetDataSize() const { return m_iDataSize; /* = m_iComponentCount*m_ivSize.volume()*m_iAllocated/8; */ } virtual uint32_t GetComponentCount() const = 0; virtual bool GetData(std::vector&); virtual bool GetData(std::vector&, uint32_t iLength, uint32_t iOffset) = 0; virtual SimpleFileInfo* clone() = 0; protected: uint32_t m_iDataSize; }; class FileStackInfo { public: FileStackInfo(); FileStackInfo(const FileStackInfo* other); FileStackInfo(UINTVECTOR3 ivSize, FLOATVECTOR3 fvfAspect, uint32_t iAllocated, uint32_t iStored, uint32_t iComponentCount, bool bSigned, bool bIsBigEndian, bool bIsJPEGEncoded, const std::string& strDesc, const std::string& strFileType); virtual ~FileStackInfo(); std::vector m_Elements; UINTVECTOR3 m_ivSize; FLOATVECTOR3 m_fvfAspect; uint32_t m_iAllocated; uint32_t m_iStored; /// @todo get rid of this, read it from the first file in the sequence /// instead. uint32_t m_iComponentCount; bool m_bSigned; bool m_bIsBigEndian; bool m_bIsJPEGEncoded; std::string m_strDesc; std::string m_strFileType; }; class DirectoryParser { public: DirectoryParser(void); virtual ~DirectoryParser(void); virtual void GetDirInfo(std::string strDirectory) = 0; virtual void GetDirInfo(std::wstring wstrDirectory) = 0; std::vector m_FileStacks; }; #endif // DIRECTORYPARSER_H ImageVis3D-3.1.0/Tuvok/IO/KeyValueFileParser.cpp0000644000175000017500000002256212320456500021111 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file KeyValueFileParser.cpp \author Jens Krueger SCI Institute University of Utah \date September 2008 */ #include "KeyValueFileParser.h" #include #include #include #include "Basics/SysTools.h" using namespace std; KeyValPair::KeyValPair() : strKey(""), wstrKey(L""), strKeyUpper(""), wstrKeyUpper(L""), strValue(""), wstrValue(L""), strValueUpper(""), wstrValueUpper(L"") {} KeyValPair::KeyValPair(const string& key, const string& value) : strKey(key), wstrKey(key.begin(), key.end()), strValue(value), wstrValue(value.begin(), value.end()) { vstrValue = SysTools::Tokenize(value); for (size_t i = 0;i 0) { iValue = viValue[0]; uiValue = vuiValue[0]; fValue = vfValue[0]; } else { iValue = 0; uiValue = 0; fValue = 0.0f; } strKeyUpper = SysTools::ToUpperCase(strKey); wstrKeyUpper = SysTools::ToUpperCase(wstrKey); strValueUpper = SysTools::ToUpperCase(strValue); wstrValueUpper = SysTools::ToUpperCase(wstrValue); } KeyValueFileParser::KeyValueFileParser(const string& strFilename, bool bStopOnEmptyLine, const string& strToken, const std::string& strEndToken) { m_bFileReadable = ParseFile(strFilename, bStopOnEmptyLine, strToken, strEndToken); } KeyValueFileParser::KeyValueFileParser(const wstring& wstrFilename, bool bStopOnEmptyLine, const wstring& wstrToken, const std::wstring& wstrEndToken) { string strFilename(wstrFilename.begin(), wstrFilename.end()); string strToken(wstrToken.begin(), wstrToken.end()); string strEndToken(wstrEndToken.begin(), wstrEndToken.end()); m_bFileReadable = ParseFile(strFilename, bStopOnEmptyLine, strToken, strEndToken); } KeyValueFileParser::KeyValueFileParser(ifstream& fileData, bool bStopOnEmptyLine, const wstring& wstrToken, const wstring& wstrEndToken) { string strToken(wstrToken.begin(), wstrToken.end()); string strEndToken(wstrEndToken.begin(), wstrEndToken.end()); m_bFileReadable = ParseFile(fileData, bStopOnEmptyLine, strToken, strEndToken); } KeyValueFileParser::KeyValueFileParser(ifstream& fileData, bool bStopOnEmptyLine, const string& strToken, const string& strEndToken) { m_bFileReadable = ParseFile(fileData, bStopOnEmptyLine, strToken, strEndToken); } KeyValueFileParser::~KeyValueFileParser() { } KeyValPair* KeyValueFileParser::GetData(const string& strKey, const bool bCaseSensitive) { if (!bCaseSensitive) { string upperKey(strKey); transform(upperKey.begin(), upperKey.end(), upperKey.begin(), ::toupper); for (uint32_t i = 0;i { bool operator()(const std::string &key, const KeyValPair &kv) const { return key == kv.strKey; } }; const KeyValPair* KeyValueFileParser::GetData(const std::string& strKey, const bool bCaseSensitive) const { std::string key(strKey); if(!bCaseSensitive) { std::transform(key.begin(), key.end(), key.begin(), ::toupper); } std::vector::const_iterator iter; iter = std::find_if(m_vecTokens.begin(), m_vecTokens.end(), std::bind1st(matching_keys(), key)); if(iter == m_vecTokens.end()) { return NULL; } return &(*iter); } bool KeyValueFileParser::ParseFile(const std::string& strFilename, bool bStopOnEmptyLine, const std::string& strToken, const std::string& strEndToken) { ifstream fileData(strFilename.c_str(),ios::binary); bool result = ParseFile(fileData, bStopOnEmptyLine, strToken, strEndToken); fileData.close(); return result; } bool KeyValueFileParser::ParseKeyValueLine(std::string line, bool bStopOnEmptyLine, bool bStopOnInvalidLine, const std::string& strToken, const std::string& strEndToken) { line = SysTools::TrimStrLeft(line); // remove windows line endings if (line.length() > 0 && line[line.length()-1] == 13) line = line.substr(0,line.length()-1); if ((strEndToken != "" && strEndToken == line) || (bStopOnEmptyLine && line.empty())) { return false; } // skip comments size_t cPos = line.find_first_of('#'); if (cPos != std::string::npos) line = line.substr(0,cPos); line = SysTools::TrimStr(line); if (line.length() == 0) return true; // skips empty and comment lines // skip invalid lines if (line.find_first_of(strToken) == string::npos) return !bStopOnInvalidLine; string strKey = SysTools::TrimStrRight(line.substr(0, line.find_first_of(strToken))); line = SysTools::TrimStr(line.substr(line.find_first_of(strToken)+strToken.length(), line.length())); if (strKey.length() == 0 || line.length() == 0) return true; KeyValPair newKey(strKey, line); m_vecTokens.push_back(newKey); return true; } bool KeyValueFileParser::ParseFile(ifstream& fileData, bool bStopOnEmptyLine, const std::string& strToken, const std::string& strEndToken) { string line; m_iStopPos = 0; if (fileData.is_open()) { bool bContinue = true; while (! fileData.eof() && bContinue ) { getline (fileData,line); bContinue = ParseKeyValueLine(line, bStopOnEmptyLine, false, strToken, strEndToken); if (!bContinue) m_iStopPos = size_t(fileData.tellg()); } } else return false; return true; } ImageVis3D-3.1.0/Tuvok/IO/TransferFunction1D.cpp0000644000175000017500000002772412320456500021073 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file TransferFunction1D.cpp \author Jens Krueger SCI Institute University of Utah \version 1.0 \date September 2008 */ #include #include #include #include #include #include "Basics/MathTools.h" #include "Controller/Controller.h" #include "TransferFunction1D.h" using namespace std; TransferFunction1D::TransferFunction1D(size_t iSize) : m_vValueBBox(0,0), m_pvColorData(new vector()) { Resize(iSize); } TransferFunction1D::TransferFunction1D(const std::string& filename) : m_pvColorData(new vector()) { Load(filename); } TransferFunction1D::~TransferFunction1D(void) { } void TransferFunction1D::Resize(size_t iSize) { m_pvColorData->resize(iSize); } float TransferFunction1D::Smoothstep(float x) const { return 3*x*x-2*x*x*x; } void TransferFunction1D::SetStdFunction(float fCenterPoint, float fInvGradient) { SetStdFunction(fCenterPoint, fInvGradient,0, false); SetStdFunction(fCenterPoint, fInvGradient,1, false); SetStdFunction(fCenterPoint, fInvGradient,2, false); SetStdFunction(fCenterPoint, fInvGradient,3, false); } void TransferFunction1D::SetStdFunction(float fCenterPoint, float fInvGradient, int iComponent, bool bInvertedStep) { size_t iCenterPoint = size_t((m_pvColorData->size()-1) * float(std::min(std::max(0,fCenterPoint),1))); size_t iInvGradient = size_t((m_pvColorData->size()-1) * float(std::min(std::max(0,fInvGradient),1))); size_t iRampStartPoint = (iInvGradient/2 > iCenterPoint) ? 0 : iCenterPoint-(iInvGradient/2); size_t iRampEndPoint = (iInvGradient/2 + iCenterPoint > m_pvColorData->size()) ? m_pvColorData->size() : iCenterPoint+(iInvGradient/2); if (bInvertedStep) { for (size_t i = 0;isize();i++) (*m_pvColorData)[i][iComponent] = 0; } else { for (size_t i = 0;isize();i++) (*m_pvColorData)[i][iComponent] = 1; } ComputeNonZeroLimits(); } /// Finds the minimum and maximum per-channel of a 4-component packed vector. template void minmax_component4(ForwardIter first, ForwardIter last, Out c_min[4], Out c_max[4]) { c_min[0] = c_min[1] = c_min[2] = c_min[3] = *first; c_max[0] = c_max[1] = c_max[2] = c_max[3] = *first; if(first == last) { return; } while(first < last) { if(*(first+0) < c_min[0]) { c_min[0] = *(first+0); } if(*(first+1) < c_min[1]) { c_min[1] = *(first+1); } if(*(first+2) < c_min[2]) { c_min[2] = *(first+2); } if(*(first+3) < c_min[3]) { c_min[3] = *(first+3); } if(*(first+0) > c_max[0]) { c_max[0] = *(first+0); } if(*(first+1) > c_max[1]) { c_max[1] = *(first+1); } if(*(first+2) > c_max[2]) { c_max[2] = *(first+2); } if(*(first+3) > c_max[3]) { c_max[3] = *(first+3); } // Ugh. Bail out if incrementing the iterator would go beyond the end. // We'd never actually deref the iterator in that case (because of the // while conditional), but we hit internal libstdc++ asserts anyway. if(static_cast(std::distance(first, last)) < 4) { break; } std::advance(first, 4); } } /// Set the transfer function from an external source. Assumes the vector /// has 4-components per element, in RGBA order. void TransferFunction1D::Set(const std::vector& tf) { assert(!tf.empty()); m_pvColorData->resize(tf.size()/4); unsigned char tfmin[4]; unsigned char tfmax[4]; // A bit tricky. We need the min/max of our vector so that we know how to // interpolate, but it needs to be a per-channel min/max. minmax_component4(tf.begin(),tf.end(), tfmin,tfmax); // Similarly, we need the min/max of our output format. const float fmin = 0.0; const float fmax = 1.0; assert(tfmin[0] <= tfmax[0]); assert(tfmin[1] <= tfmax[1]); assert(tfmin[2] <= tfmax[2]); assert(tfmin[3] <= tfmax[3]); for(size_t i=0; i < m_pvColorData->size(); ++i) { (*m_pvColorData)[i] = FLOATVECTOR4( MathTools::lerp(tf[4*i+0], tfmin[0],tfmax[0], fmin,fmax), MathTools::lerp(tf[4*i+1], tfmin[1],tfmax[1], fmin,fmax), MathTools::lerp(tf[4*i+2], tfmin[2],tfmax[2], fmin,fmax), MathTools::lerp(tf[4*i+3], static_cast(0), static_cast(255), fmin,fmax) ); } ComputeNonZeroLimits(); } void TransferFunction1D::Clear() { for (size_t i = 0;isize();i++) (*m_pvColorData)[i] = FLOATVECTOR4(0,0,0,0); m_vValueBBox = UINT64VECTOR2(0,0); } void TransferFunction1D::FillOrTruncate(size_t iTargetSize) { vector< FLOATVECTOR4 > vTmpColorData(iTargetSize); for (size_t i = 0;isize()) vTmpColorData[i] = (*m_pvColorData)[i]; else vTmpColorData[i] = FLOATVECTOR4(0,0,0,0); } *m_pvColorData = vTmpColorData; ComputeNonZeroLimits(); } void TransferFunction1D::Resample(size_t iTargetSize) { size_t iSourceSize = m_pvColorData->size(); if (iTargetSize == iSourceSize) return; vector< FLOATVECTOR4 > vTmpColorData(iTargetSize); if (iTargetSize < iSourceSize) { // downsample size_t iFrom = 0; for (size_t i = 0;isize()-1); float fInterp = fPos - float(iFloor); vTmpColorData[i] = (*m_pvColorData)[iFloor] * (1-fInterp) + (*m_pvColorData)[iCeil] * fInterp; } } *m_pvColorData = vTmpColorData; ComputeNonZeroLimits(); } bool TransferFunction1D::Load(const std::string& filename, size_t iTargetSize) { if (!Load(filename)) { T_ERROR("Load from %s failed", filename.c_str()); return false; } else { Resample(iTargetSize); return true; } } bool TransferFunction1D::Load(const std::string& filename) { ifstream file(filename.c_str()); if (!Load(file)) { T_ERROR("Load of '%s' failed.", filename.c_str()); return false; } file.close(); ComputeNonZeroLimits(); return true; } bool TransferFunction1D::Load(std::istream& tf, size_t iTargetSize) { if (!Load(tf)) { T_ERROR("Load from stream failed."); return false; } else { Resample(iTargetSize); return true; } } bool TransferFunction1D::Save(const std::string& filename) const { ofstream file(filename.c_str()); if (!Save(file)) return false; file.close(); return true; } bool TransferFunction1D::Load(std::istream& tf) { uint32_t iSize; tf >> iSize; if(!tf) { T_ERROR("Size information invalid."); return false; } m_pvColorData->resize(iSize); for(size_t i=0;isize();++i){ for(size_t j=0;j<4;++j){ tf >> (*m_pvColorData)[i][j]; } } return tf.good(); } bool TransferFunction1D::Save(std::ostream& file) const { file << m_pvColorData->size() << endl; for(size_t i=0;isize();++i){ for(size_t j=0;j<4;++j){ file << (*m_pvColorData)[i][j] << " "; } file << endl; } return true; } void TransferFunction1D::GetByteArray(std::vector& vData, unsigned char cUsedRange) const { // bail out immediately if we've got no data if(m_pvColorData->empty()) { return; } vData.resize(m_pvColorData->size() * 4); unsigned char *pcDataIterator = &vData.at(0); for (size_t i = 0;isize();i++) { unsigned char r = (unsigned char)(std::max(0.0f,std::min((*m_pvColorData)[i][0],1.0f))*cUsedRange); unsigned char g = (unsigned char)(std::max(0.0f,std::min((*m_pvColorData)[i][1],1.0f))*cUsedRange); unsigned char b = (unsigned char)(std::max(0.0f,std::min((*m_pvColorData)[i][2],1.0f))*cUsedRange); unsigned char a = (unsigned char)(std::max(0.0f,std::min((*m_pvColorData)[i][3],1.0f))*cUsedRange); *pcDataIterator++ = r; *pcDataIterator++ = g; *pcDataIterator++ = b; *pcDataIterator++ = a; } } void TransferFunction1D::GetShortArray(unsigned short** psData, unsigned short sUsedRange) const { // bail out immediately if we've got no data if(m_pvColorData->empty()) { return; } if (*psData == NULL) *psData = new unsigned short[m_pvColorData->size()*4]; unsigned short *psDataIterator = *psData; for (size_t i = 0;isize();i++) { unsigned short r = (unsigned short)(std::max(0.0f,std::min((*m_pvColorData)[i][0],1.0f))*sUsedRange); unsigned short g = (unsigned short)(std::max(0.0f,std::min((*m_pvColorData)[i][1],1.0f))*sUsedRange); unsigned short b = (unsigned short)(std::max(0.0f,std::min((*m_pvColorData)[i][2],1.0f))*sUsedRange); unsigned short a = (unsigned short)(std::max(0.0f,std::min((*m_pvColorData)[i][3],1.0f))*sUsedRange); *psDataIterator++ = r; *psDataIterator++ = g; *psDataIterator++ = b; *psDataIterator++ = a; } } void TransferFunction1D::GetFloatArray(float** pfData) const { // bail out immediately if we've got no data if(m_pvColorData->empty()) { return; } if (*pfData == NULL) *pfData = new float[4*m_pvColorData->size()]; memcpy(*pfData, &pfData[0], sizeof(float)*4*m_pvColorData->size()); } void TransferFunction1D::ComputeNonZeroLimits() { m_vValueBBox = UINT64VECTOR2(uint64_t(m_pvColorData->size()),0); for (size_t i = 0;isize();i++) { if ((*m_pvColorData)[i][3] != 0) { m_vValueBBox.x = MIN(m_vValueBBox.x, i); m_vValueBBox.y = i; } } } std::shared_ptr> TransferFunction1D::GetColorData() { return m_pvColorData; } FLOATVECTOR4 TransferFunction1D::GetColor(size_t index) const { return (*m_pvColorData)[index]; } void TransferFunction1D::SetColor(size_t index, FLOATVECTOR4 color) { (*m_pvColorData)[index] = color; } ImageVis3D-3.1.0/Tuvok/IO/GeomViewConverter.h0000644000175000017500000000352312320456500020462 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Scientific Computing and Imaging Institute Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifndef TUVOK_GEOMVIEW_GEO_CONVERTER_H #define TUVOK_GEOMVIEW_GEO_CONVERTER_H #include "AbstrGeoConverter.h" namespace tuvok { // "GeomView" mesh importer. // Seems to be a simple ascii-based format, similar to Obj. class GeomViewConverter: public AbstrGeoConverter { public: GeomViewConverter(); virtual ~GeomViewConverter() {} virtual std::shared_ptr ConvertToMesh(const std::string&); virtual bool CanExportData() const { return false; } virtual bool CanImportData() const { return true; } }; } #endif // TUVOK_GEOMVIEW_GEO_CONVERTER_H ImageVis3D-3.1.0/Tuvok/IO/exception/0000755000175000017500000000000012320456500016672 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/IO/exception/FileNotFound.h0000644000175000017500000000374112320456500021404 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file FileNotFound.h \author Tom Fogal SCI Institute University of Utah \brief Base class for all IO exceptions */ #pragma once #ifndef SCIO_FILE_NOT_FOUND_H #define SCIO_FILE_NOT_FOUND_H #include "IOException.h" /// Interface at the exception site: /// throw FILE_NOT_FOUND("the_filename"); /// It automatically sets the location information. #define FILE_NOT_FOUND(msg) tuvok::io::FileNotFound(msg, __FILE__, __LINE__) namespace tuvok { namespace io { class FileNotFound : virtual public IOException { public: FileNotFound(std::string e, const char* where=NULL, size_t ln=0) : IOException(e, where, ln) {} virtual ~FileNotFound() throw() {} }; }} #endif /* SCIO_FILE_NOT_FOUND_H */ ImageVis3D-3.1.0/Tuvok/IO/exception/ReadTimeout.h0000644000175000017500000000372112320456500021270 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file ReadTimeout.h \author Tom Fogal SCI Institute University of Utah \brief Base class for all IO exceptions */ #pragma once #ifndef SCIO_READ_TIMEOUT_H #define SCIO_READ_TIMEOUT_H #include "IOException.h" /// Interface at the exception site: /// throw READ_TIMEOUT("the_filename"); /// It automatically sets the location information. #define READ_TIMEOUT(msg) tuvok::io::ReadTimeout(msg, __FILE__, __LINE__) namespace tuvok { namespace io { class ReadTimeout : virtual public IOException { public: ReadTimeout(std::string e, const char* where=NULL, size_t ln=0) : IOException(e, where, ln) {} virtual ~ReadTimeout() throw() {} }; }} #endif /* SCIO_READ_TIMEOUT_H */ ImageVis3D-3.1.0/Tuvok/IO/exception/UnmergeableDatasets.h0000644000175000017500000000336512320456500022771 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \brief Exception to throw when datasets cannot be used in the same expression. */ #pragma once #ifndef SCIO_IO_UNMERGEABLE_DATASETS_H_H #define SCIO_IO_UNMERGEABLE_DATASETS_H_H #include #include "Basics/TuvokException.h" namespace tuvok { namespace io { class UnmergeableDatasets : virtual public tuvok::Exception { public: UnmergeableDatasets(std::string e, const char* where=NULL, size_t ln=0) : tuvok::Exception(e, where, ln) {} }; }} #endif /* SCIO_IO_UNMERGEABLE_DATASETS_H_H */ ImageVis3D-3.1.0/Tuvok/IO/exception/IOException.h0000644000175000017500000000353612320456500021240 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file IOException.h \author Tom Fogal SCI Institute University of Utah \brief Base class for all IO exceptions */ #pragma once #ifndef SCIO_IO_EXCEPTION_H #define SCIO_IO_EXCEPTION_H #include "TuvokException.h" namespace tuvok { namespace io { class IOException : virtual public tuvok::Exception { public: IOException() : tuvok::Exception(std::string("unknown error"), NULL, 0) {} IOException(std::string e, const char* where=NULL, size_t ln=0) : tuvok::Exception(e, where, ln) {} virtual ~IOException() throw() {} }; }} #endif /* SCIO_IO_EXCEPTION_H */ ImageVis3D-3.1.0/Tuvok/IO/AmiraConverter.cpp0000644000175000017500000001512312320456500020323 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include "AmiraConverter.h" // Your standard ostream_iterator will essentially do "stream << *iter". That // doesn't work well for binary files, however, in which we need to use // "stream.write(&*iter, sizeof(T))". Hence this implements a binary // ostream_iterator. class binary_ostream_iterator : public std::iterator { public: binary_ostream_iterator(std::ostream& os) : stream(&os) {} binary_ostream_iterator(const binary_ostream_iterator& boi) : stream(boi.stream) { } binary_ostream_iterator& operator=(const value_type& value) { this->stream->write(reinterpret_cast(&value), sizeof(double)); return *this; } binary_ostream_iterator& operator*() { return *this; } binary_ostream_iterator& operator++() { return *this; } binary_ostream_iterator operator++(int) { return *this; } private: std::ostream* stream; }; AmiraConverter::AmiraConverter() { m_vConverterDesc = "Amira"; m_vSupportedExt.push_back("AM"); } bool AmiraConverter::CanRead(const std::string& fn, const std::vector& start) const { if(!AbstrConverter::CanRead(fn, start)) { MESSAGE("Base class says we can't read it..."); return false; } // the file should start with: // # AmiraMesh ASCII 1.0 // if it doesn't we probably don't know how to read it. std::vector::const_iterator nl = std::find(start.begin(), start.end(), '\n'); if(nl == start.end()) { // no newline found. This isn't one of our files. MESSAGE("No newline near the beginning of the file; not mine."); return false; } std::string firstline( static_cast(&start[0]), static_cast(&*nl) ); if(firstline.find("AmiraMesh") == std::string::npos) { MESSAGE("No 'AmiraMesh'... not mine."); return false; } if(firstline.find("ASCII") == std::string::npos) { MESSAGE("Not in ASCII format... this might be mine, but I can't read it."); return false; } return true; } bool AmiraConverter::ConvertToRAW(const std::string& strSourceFilename, const std::string& strTempDir, bool, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianness, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile) { strTitle = "from Amira converter"; std::ifstream amira(strSourceFilename.c_str()); if(!amira) { T_ERROR("Could not open %s!", strSourceFilename.c_str()); return false; } iHeaderSkip = 0; // we'll create a new, raw file. iComponentSize = 64; iComponentCount = 1; bConvertEndianness = false; bSigned = true; bIsFloat = true; vVolumeAspect = FLOATVECTOR3(1.0, 1.0, 1.0); strIntermediateFile = strTempDir + "/" + "am.iv3d.tmp"; bDeleteIntermediateFile = true; std::string junk; std::string version; amira >> junk >> junk >> junk >> version; // "# AmiraMesh ASCII 1.0" MESSAGE("Reading 'AmiraMesh' file, version %s", version.c_str()); // "define Lattice X Y Z" amira >> junk >> junk >> vVolumeSize[0] >> vVolumeSize[1] >> vVolumeSize[2]; assert(vVolumeSize[0] > 0); assert(vVolumeSize[1] > 0); assert(vVolumeSize[2] > 0); MESSAGE("%llu-bit %llux%llux%llu data.", iComponentSize, vVolumeSize[0], vVolumeSize[1], vVolumeSize[2]); // The rest of the header is stuff we don't bother with right now, and then: // // Lattice { float Data } = @1 // // @1 // first-elem 2nd-elem ... // // Presumably they could define multiple "Lattice"s and then use @2, @3, // etc., but I don't have any such example data files, so screw it. // We're just going to read up until that @1. Then we'll read up until the // next @1. At that point we can just copy each elem into an output file. do { amira >> junk; } while(junk != "@1"); // " ... } = @1" do { amira >> junk; } while(junk != "@1"); // "@1\n" std::ofstream inter(strIntermediateFile.c_str(), std::ofstream::out | std::ofstream::out); if(!inter) { T_ERROR("Could not create intermediate file '%s'.", strIntermediateFile.c_str()); bDeleteIntermediateFile = false; return false; } std::copy(std::istream_iterator(amira), std::istream_iterator(), binary_ostream_iterator(inter)); return true; } bool AmiraConverter::ConvertToNative(const std::string&, const std::string&, uint64_t, unsigned, uint64_t, bool, bool, UINT64VECTOR3, FLOATVECTOR3, bool, const bool) { return false; } ImageVis3D-3.1.0/Tuvok/IO/REKConverter.cpp0000644000175000017500000001013112320456500017705 0ustar mathieumathieu/* The MIT License Copyright (c) 2009 Institut of Mechanics and Fluid Dynamics, TU Bergakademie Freiberg. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file REKConverter.cpp \author Andre Liebscher Institut of Mechanics and Fluid Dynamics TU Bergakademie Freiberg \date March 2009 */ #include #include #include #include "REKConverter.h" #include "Controller/Controller.h" #include "Basics/EndianConvert.h" using namespace std; REKConverter::REKConverter() { m_vConverterDesc = "Fraunhofer Raw Volume"; m_vSupportedExt.push_back("REK"); } bool REKConverter::ConvertToRAW(const std::string& strSourceFilename, const std::string&, bool, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile) { MESSAGE("Attempting to convert REK dataset %s", strSourceFilename.c_str()); // Find out machine endianess bConvertEndianess = EndianConvert::IsBigEndian(); // Read header an check for "magic" values of the REK file ifstream fileData(strSourceFilename.c_str(), ifstream::in | ifstream::binary); char buffer[2048]; if(fileData.is_open()) { fileData.read( buffer, sizeof(buffer) ); if(Parse( &buffer[10], bConvertEndianess ) != 2 && Parse( &buffer[12], bConvertEndianess ) != 4) { WARNING("The file %s is not a REK file", strSourceFilename.c_str()); fileData.close(); return false; } } else { WARNING("Could not open REK file %s", strSourceFilename.c_str()); return false; } fileData.close(); // Standard values which are always true (I guess) strTitle = "Fraunhofer EZRT"; vVolumeAspect = FLOATVECTOR3(1,1,1); bSigned = false; bIsFloat = false; iComponentCount = 1; strIntermediateFile = strSourceFilename; bDeleteIntermediateFile = false; // Read file format from header vVolumeSize[0] = Parse(&buffer[0], bConvertEndianess); vVolumeSize[1] = Parse(&buffer[2], bConvertEndianess); vVolumeSize[2] = Parse(&buffer[6], bConvertEndianess); iComponentSize = Parse(&buffer[4], bConvertEndianess); iHeaderSkip = Parse(&buffer[8], bConvertEndianess); return true; } // unimplemented! bool REKConverter::ConvertToNative(const std::string&, const std::string&, uint64_t, unsigned, uint64_t, bool, bool, UINT64VECTOR3, FLOATVECTOR3, bool, bool) { return false; } ImageVis3D-3.1.0/Tuvok/IO/StLGeoConverter.cpp0000644000175000017500000004103312320456500020426 0ustar mathieumathieu#include "StLGeoConverter.h" #include "Controller/Controller.h" #include "Basics/LargeRAWFile.h" #include "SysTools.h" #include "Mesh.h" #include #include "TuvokIOError.h" using namespace tuvok; StLGeoConverter::StLGeoConverter() : AbstrGeoConverter() { m_vConverterDesc = "Stereo Lithography Format"; m_vSupportedExt.push_back("STL"); } FLOATVECTOR3 StLGeoConverter::ComputeFaceNormal(const Mesh& m, size_t polyIndex, bool bHasNormals) const { FLOATVECTOR3 faceNormal; if (bHasNormals) { // compute normal as average over the vertices for (size_t j = 0;j StLGeoConverter::ConvertToMesh(const std::string& strFilename) { VertVec vertices; NormVec normals; TexCoordVec texcoords; ColorVec colors; IndexVec VertIndices; IndexVec NormalIndices; IndexVec TCIndices; IndexVec COLIndices; // first figure out if this a binary or an ASCII file LargeRAWFile inFile(strFilename); inFile.Open(); if (!inFile.IsOpen()) { // hack, we really want some kind of 'file not found' exception. throw tuvok::io::DSOpenFailed(strFilename.c_str(), __FILE__, __LINE__); } uint8_t header[80]; inFile.ReadRAW(header, 80); // skip whitespaces size_t iStartPos = 0; for (;iStartPos<80;++iStartPos) { if (header[iStartPos] != ' ' && header[iStartPos] != '\t') break; } // now search for the keyword "solid" if (iStartPos > 75 || toupper(header[iStartPos+0]) != 'S' || toupper(header[iStartPos+1]) != 'O' || toupper(header[iStartPos+2]) != 'L' || toupper(header[iStartPos+3]) != 'I' || toupper(header[iStartPos+4]) != 'D') { // file must be binary, treat is as such uint32_t iNumFaces; inFile.ReadData(iNumFaces, false); for (uint32_t f = 0;f norm = SysTools::Tokenize(line, SysTools::PM_NONE); FLOATVECTOR3 normal(SysTools::FromString(norm[2]), SysTools::FromString(norm[3]), SysTools::FromString(norm[4])); normals.push_back(normal); getline(fs, line); // should be "outer loop" line = SysTools::ToLowerCase(SysTools::TrimStr(line)); if (line != "outer loop") break; for (size_t i = 0;i<3;i++) { getline(fs, line); // should be "vertex x y z" line = SysTools::ToLowerCase(SysTools::TrimStr(line)); std::vector< std::string > v = SysTools::Tokenize(line, SysTools::PM_NONE); if (v[0] != "vertex") break; FLOATVECTOR3 pos(SysTools::FromString(v[1]), SysTools::FromString(v[2]), SysTools::FromString(v[3])); vertices.push_back(pos); VertIndices.push_back(uint32_t(vertices.size()-1)); NormalIndices.push_back(uint32_t(normals.size()-1)); } getline(fs, line); // should be "endloop" line = SysTools::ToLowerCase(SysTools::TrimStr(line)); if (line != "endloop") break; getline(fs, line); // should be "endfacet" line = SysTools::ToLowerCase(SysTools::TrimStr(line)); if (line != "endfacet") break; } fs.close(); } std::string desc = m_vConverterDesc + std::string(" data converted from ") + SysTools::GetFilename(strFilename); std::shared_ptr m( new Mesh(vertices,normals,texcoords,colors, VertIndices,NormalIndices,TCIndices,COLIndices, false, false, desc, Mesh::MT_TRIANGLES) ); return m; } /* The MIT License Copyright (c) 2013 Jens Krueger Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* std::shared_ptr StLGeoConverter::ConvertToMesh(const std::string& strFilename) { bool bFlipVertices = false; VertVec vertices; NormVec normals; TexCoordVec texcoords; ColorVec colors; IndexVec VertIndices; IndexVec NormalIndices; IndexVec TCIndices; IndexVec COLIndices; std::ifstream fs; std::string line; fs.open(strFilename.c_str()); if (fs.fail()) { // hack, we really want some kind of 'file not found' exception. throw tuvok::io::DSOpenFailed(strFilename.c_str(), __FILE__, __LINE__); } float x,y,z,w; size_t iVerticesPerPoly = 0; fs.seekg(0,std::ios::end); std::streamoff iFileLength = fs.tellg(); fs.seekg(0,std::ios::beg); size_t iBytesRead = 0; size_t iLine = 0; while (!fs.fail()) { getline(fs, line); iBytesRead += line.size() + 1; iLine++; if (fs.fail()) break; // no more lines to read line = SysTools::ToLowerCase(SysTools::TrimStr(line)); // remove comments size_t cPos = line.find_first_of('#'); if (cPos != std::string::npos) line = line.substr(0,cPos); line = SysTools::TrimStr(line); if (line.length() == 0) continue; // skips empty and comment lines // find the linetype size_t off = line.find_first_of(" \r\n\t"); if (off == std::string::npos) continue; std::string linetype = SysTools::TrimStrRight(line.substr(0,off)); line = SysTools::TrimStr(line.substr(linetype.length())); if (linetype == "o") { WARNING("Skipping Object Tag in OBJ file"); } else if (linetype == "mtllib") { WARNING("Skipping Material Library Tag in OBJ file"); } else if (linetype == "v") { // vertex attrib found std::vector< std::string > pos = SysTools::Tokenize(line, SysTools::PM_NONE); if (pos.size() < 3) { WARNING("Found broken v tag (to few coordinates, " "filling with zeroes"); x = (pos.size() > 0) ? SysTools::FromString(pos[0]) : 0.0f; y = (pos.size() > 1) ? SysTools::FromString(pos[1]) : 0.0f; z = 0.0f; } else { x = SysTools::FromString(pos[0]); y = SysTools::FromString(pos[1]); z = SysTools::FromString(pos[2]); if (pos.size() >= 6) { // this is a "meshlab extended" obj file that includes vertex colors float r = SysTools::FromString(pos[3]); float g = SysTools::FromString(pos[4]); float b = SysTools::FromString(pos[5]); float a = (pos.size() > 6) ? SysTools::FromString(pos[6]):1.0f; colors.push_back(FLOATVECTOR4(r,g,b,a)); } else if (pos.size() > 3) { // file specifies homogeneous coordinate float w = SysTools::FromString(pos[3]); if (w != 0) { x /= w; y /= w; z /= w; } } } vertices.push_back(FLOATVECTOR3(x,y,(bFlipVertices) ? -z : z)); } else if (linetype == "vt") { // vertex texcoord found x = float(atof(GetToken(line).c_str())); y = float(atof(GetToken(line).c_str())); texcoords.push_back(FLOATVECTOR2(x,y)); } else if (linetype == "vc") { // vertex color found x = float(atof(GetToken(line).c_str())); y = float(atof(GetToken(line).c_str())); z = float(atof(GetToken(line).c_str())); w = float(atof(GetToken(line).c_str())); colors.push_back(FLOATVECTOR4(x,y,z,w)); } else if (linetype == "vn") { // vertex normal found x = float(atof(GetToken(line).c_str())); y = float(atof(GetToken(line).c_str())); z = float(atof(GetToken(line).c_str())); FLOATVECTOR3 n(x,y,z); n.normalize(); normals.push_back(n); } else if (linetype == "f" || linetype == "l") { // face or line found size_t off = line.find_first_of(" \r\n\t"); if (off == std::string::npos) continue; std::string analysis = SysTools::TrimStrRight(line.substr(0,off)); int count = 0;//CountOccurences(analysis,"/"); IndexVec v, n, t, c; while (line.length() > 0) { switch (count) { case 0 : { int vI = atoi(GetToken(line).c_str())-1; v.push_back(vI); break; } case 1 : { int vI = atoi(GetToken(line,"/",true).c_str())-1; v.push_back(vI); int vT = atoi(GetToken(line).c_str())-1; t.push_back(vT); line = TrimToken(line); break; } case 2 : { int vI = atoi(GetToken(line,"/",true).c_str())-1; v.push_back(vI); if (line[0] != '/') { int vT = atoi(GetToken(line,"/",true).c_str())-1; t.push_back(vT); }else line = TrimToken(line,"/",true); int vN = atoi(GetToken(line).c_str())-1; n.push_back(vN); break; } case 3 : { int vI = atoi(GetToken(line,"/",true).c_str())-1; v.push_back(vI); if (line[0] != '/') { int vT = atoi(GetToken(line,"/",true).c_str())-1; t.push_back(vT); }else line = TrimToken(line,"/",true); if (line[0] != '/') { int vN = atoi(GetToken(line,"/",true).c_str())-1; n.push_back(vN); } else line = TrimToken(line,"/",true); int vC = atoi(GetToken(line).c_str())-1; c.push_back(vC); break; } } SysTools::TrimStrLeft(line); } if (v.size() == 1) { WARNING("Skipping points in OBJ file"); continue; } if (iVerticesPerPoly == 0) iVerticesPerPoly = v.size(); if (v.size() == 2) { if ( iVerticesPerPoly != 2 ) { WARNING("Skipping a line in a file that also contains polygons"); continue; } AddToMesh(vertices,v,n,t,c,VertIndices,NormalIndices,TCIndices,COLIndices); } else { if ( iVerticesPerPoly == 2 ) { WARNING("Skipping polygon in file that also contains lines"); continue; } AddToMesh(vertices,v,n,t,c,VertIndices,NormalIndices,TCIndices,COLIndices); } } else { WARNING("Skipping unknown tag %s in OBJ file", linetype.c_str()); } if (iLine % 5000 == 0) { MESSAGE("Reading line %u (%u / %u kb)", unsigned(iLine), unsigned(iBytesRead/1024),unsigned(iFileLength/1024)); } } fs.close(); std::string desc = m_vConverterDesc + " data converted from " + SysTools::GetFilename(strFilename); // generate color indies for "meshlab extended" format if (COLIndices.size() == 0 && vertices.size() == colors.size()) COLIndices = VertIndices; std::shared_ptr m( new Mesh(vertices,normals,texcoords,colors, VertIndices,NormalIndices,TCIndices,COLIndices, false, false, desc, ((iVerticesPerPoly == 2) ? Mesh::MT_LINES : Mesh::MT_TRIANGLES)) ); return m; } */ImageVis3D-3.1.0/Tuvok/IO/Images/0000755000175000017500000000000012320456500016101 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/IO/Images/StackExporter.cpp0000644000175000017500000002331712320456500021411 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file StackExporter.cpp \author Jens Krueger SCI Institute University of Utah */ #include "StdTuvokDefines.h" #include #ifndef TUVOK_NO_QT #include #include #endif #include "StackExporter.h" #include "Basics/SysTools.h" #include "Basics/LargeRAWFile.h" #include "Basics/nonstd.h" #include "Controller/Controller.h" std::vector> StackExporter::GetSuportedImageFormats() { std::vector> formats; formats.push_back(std::make_pair("raw","RAW RGBA file without header information")); #ifndef TUVOK_NO_QT QList listImageFormats = QImageWriter::supportedImageFormats(); for (int i = 0;i(pData), vSize, fRescale, pTrans); break; case 32 : ApplyTFInplace(reinterpret_cast(pData), vSize, fRescale, pTrans); break; default : return false; } break; case 2 : PadInplace(pData, vSize, 3, 1, 0); break; default : break; // all other cases (RGB & RGBA) are written as they are } // write data to disk std::string strCurrentTargetFilename = SysTools::FindNextSequenceName(strCurrentDiFilename); return WriteImage(pData,strCurrentTargetFilename, vSize, iImageCompCount); } void StackExporter::PadInplace(unsigned char* pData, UINT64VECTOR2 vSize, unsigned int iStepping, unsigned int iPadcount, unsigned char iValue) { assert(iStepping > iPadcount) ; for (size_t i = 0;i 4) { T_ERROR("Invalid channel count, no more than four components are accepted by the stack exporter."); return false; } size_t iDataByteWith = size_t(iBitWidth/8); // convert to 8bit for more than 1 comp data if (iBitWidth != 8 && iComponentCount > 1) { T_ERROR("Invalid bit depth, only 8bit data is accepted by the stack exporter for multi channel data."); return false; /* LargeRAWFile quantizeDataSource(strRAWFilename); if (!quantizeDataSource.Open(true)) return false; // TODO quantize quantizeDataSource.Close(); iDataByteWith = 1; */ } LargeRAWFile dataSource(strRAWFilename); if (!dataSource.Open()) return false; size_t iMaxPair = size_t((vDomainSize.x <= vDomainSize.y && vDomainSize.x <= vDomainSize.z) ? vDomainSize.z * vDomainSize.y : ( (vDomainSize.y <= vDomainSize.x && vDomainSize.y <= vDomainSize.z) ? vDomainSize.x * vDomainSize.z : vDomainSize.x * vDomainSize.y)); std::shared_ptr data( new unsigned char[4*iMaxPair*iDataByteWith], nonstd::DeleteArray() ); UINT64VECTOR2 vSize(vDomainSize.z, vDomainSize.y); std::string strCurrentDirTargetFilename = SysTools::AppendFilename(strTargetFilename, "_x"); size_t elemSize = iComponentCount*iDataByteWith; if (bAllDirs) { for (uint64_t x = 0;x #include #include "../../StdTuvokDefines.h" #include "../Basics/Vectors.h" #include "../TransferFunction1D.h" class StackExporter { public: static std::vector> GetSuportedImageFormats(); static bool WriteStacks(const std::string& strRAWFilename, const std::string& strTargetFilename, const TransferFunction1D* pTrans, uint64_t iBitWidth, uint64_t iComponentCount, float fRescale, UINT64VECTOR3 vDomainSize, bool bAllDirs); static bool WriteImage(unsigned char* pData, const std::string& strTargetFilename, const UINT64VECTOR2& vSize, uint64_t iComponentCount); protected: template static void ApplyTFInplace(T* pData, UINT64VECTOR2 vSize, float fRescale, const TransferFunction1D* pTrans) { unsigned char* pCharInterpOfData = (unsigned char*)pData; for (size_t i = 0;iGetSize()-1); FLOATVECTOR4 fvColor = pTrans->GetColor(lookupVal); pCharInterpOfData[targetPos+0] = (unsigned char)(fvColor.x*255); pCharInterpOfData[targetPos+1] = (unsigned char)(fvColor.y*255); pCharInterpOfData[targetPos+2] = (unsigned char)(fvColor.z*255); pCharInterpOfData[targetPos+3] = (unsigned char)(fvColor.w*255); } } static void PadInplace(unsigned char* pData, UINT64VECTOR2 vSize, unsigned int iStepping, unsigned int iPadcount, unsigned char iValue); static bool WriteSlice(unsigned char* pData, const TransferFunction1D* pTrans, uint64_t iBitWidth, const std::string& strCurrentDiFilename, const UINT64VECTOR2& vSize, float fRescale, uint64_t iComponentCount); }; #endif // STACKEXPORTER_H ImageVis3D-3.1.0/Tuvok/IO/Images/ImageParser.h0000644000175000017500000000530712320456500020456 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file ImageParser.h \author Jens Krueger SCI Institute University of Utah \version 1.2 \date September 2008 */ #pragma once #ifndef IMAGEPARSER_H #define IMAGEPARSER_H #include #include "../../StdTuvokDefines.h" #include #include "../../Basics/Vectors.h" // if the following define is set, the DICOM parser putputs detailed parsing information // be carfull with this option it may create a huge amount of output #ifndef DEBUG //#define DEBUG_DICOM #endif class ImageFileInfo : public SimpleFileInfo { public: ImageFileInfo(); ImageFileInfo(const std::string& strFileName); ImageFileInfo(const std::wstring& wstrFileName); virtual ~ImageFileInfo() {} virtual uint32_t GetComponentCount() const; virtual bool GetData(std::vector&, uint32_t iLength, uint32_t iOffset); virtual SimpleFileInfo* clone(); UINTVECTOR2 m_ivSize; uint32_t m_iAllocated; uint32_t m_iComponentCount; void ComputeSize(); }; class ImageStackInfo : public FileStackInfo { public: ImageStackInfo(); ImageStackInfo(const ImageFileInfo* info); ImageStackInfo(const ImageStackInfo* other); virtual ~ImageStackInfo() {} bool Match(const ImageFileInfo* info); }; class ImageParser : public DirectoryParser { public: ImageParser(void); ~ImageParser(void); virtual void GetDirInfo(std::string strDirectory); virtual void GetDirInfo(std::wstring wstrDirectory); protected: }; #endif // IMAGEPARSER_H ImageVis3D-3.1.0/Tuvok/IO/Images/ImageParser.cpp0000644000175000017500000001642512320456500021014 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file ImageParser.cpp \author Jens Krueger SCI Institute University of Utah \version 1.2 \date September 2008 */ #include "ImageParser.h" #ifndef TUVOK_NO_QT # include # include #endif #include #include using namespace boost; using namespace std; ImageFileInfo::ImageFileInfo() : SimpleFileInfo(), m_ivSize(0,0), m_iAllocated(0), m_iComponentCount(1) {} ImageFileInfo::ImageFileInfo(const std::string& strFileName) : SimpleFileInfo(strFileName), m_ivSize(0,0), m_iAllocated(0), m_iComponentCount(1) {} ImageFileInfo::ImageFileInfo(const std::wstring& wstrFileName) : SimpleFileInfo(wstrFileName), m_ivSize(0,0), m_iAllocated(0), m_iComponentCount(1) {} void ImageFileInfo::ComputeSize() { m_iDataSize = m_iComponentCount*m_ivSize.area()*m_iAllocated/8; } SimpleFileInfo* ImageFileInfo::clone() { SimpleFileInfo* sinfo = new ImageFileInfo(*this); return sinfo; } uint32_t ImageFileInfo::GetComponentCount() const { return m_iComponentCount; } #ifdef TUVOK_NO_QT bool ImageFileInfo::GetData(std::vector&, uint32_t, uint32_t) #else bool ImageFileInfo::GetData(std::vector& vData, uint32_t iLength, uint32_t iOffset) #endif { #ifndef TUVOK_NO_QT QImage qImage(m_strFileName.c_str()); if (qImage.isNull()) return false; if(qImage.depth() == 32) { m_iComponentCount = 4; ComputeSize(); vData.resize(GetDataSize()); size_t w = static_cast(qImage.width()); size_t h = static_cast(qImage.height()); #if QT_VERSION >= 0x040600 assert(static_cast(qImage.byteCount()) == (w*h*m_iComponentCount)); #endif // Qt says we can't use bits() directly as a uchar; the byte order differs // per-platform. So pull out each component the slow way. const QRgb* bits = reinterpret_cast(qImage.bits()); for(uint64_t i=0; i < uint64_t(w)*h; ++i) { vData[i*4 + 0] = qRed(*bits); vData[i*4 + 1] = qGreen(*bits); vData[i*4 + 2] = qBlue(*bits); vData[i*4 + 3] = qAlpha(*bits); ++bits; } } else { int iCount = 0; for (int y = 0;y iCount) { continue; } QColor pixel(qImage.pixel(x,y)); unsigned char cValue = (unsigned char)((pixel.red() + pixel.green() + pixel.blue()) / 3); unsigned char *pData = reinterpret_cast(&vData[0]); pData[iCount-iOffset] = cValue; if (int(iLength) == iCount-int(iOffset)) break; iCount++; } } } return true; #else T_ERROR("Qt needed/used to load image data!"); return false; #endif } /*************************************************************************************/ ImageStackInfo::ImageStackInfo() : FileStackInfo() {} ImageStackInfo::ImageStackInfo(const ImageFileInfo* fileInfo) : FileStackInfo(UINTVECTOR3(fileInfo->m_ivSize,1), FLOATVECTOR3(1,1,1), fileInfo->m_iAllocated, fileInfo->m_iAllocated, fileInfo->m_iComponentCount, false, false, false, "image file", "IMAGE") { m_Elements.push_back(new ImageFileInfo(*fileInfo)); } ImageStackInfo::ImageStackInfo(const ImageStackInfo* other) { m_ivSize = other->m_ivSize; m_fvfAspect = other->m_fvfAspect; m_iAllocated = other->m_iAllocated; m_iStored = other->m_iStored; m_iComponentCount = other->m_iComponentCount; m_bSigned = other->m_bSigned; m_bIsBigEndian = other->m_bIsBigEndian; m_bIsJPEGEncoded = other->m_bIsJPEGEncoded; m_strDesc = other->m_strDesc; m_strFileType = other->m_strFileType; for (size_t i=0;im_Elements.size();i++) { ImageFileInfo* e = new ImageFileInfo( *dynamic_cast(other->m_Elements[i]) ); m_Elements.push_back(e); } } bool ImageStackInfo::Match(const ImageFileInfo* info) { if (m_ivSize.xy() == info->m_ivSize && m_iAllocated == info->m_iAllocated && m_iComponentCount == info->m_iComponentCount) { std::vector::iterator iter; for(iter = m_Elements.begin(); iter < m_Elements.end(); ++iter) { if ((*iter)->m_iImageIndex > info->m_iImageIndex) break; } m_Elements.insert(iter,new ImageFileInfo(*info)); return true; } else return false; } /*************************************************************************************/ ImageParser::ImageParser(void) { } ImageParser::~ImageParser(void) { } void ImageParser::GetDirInfo(string strDirectory) { vector files = SysTools::GetDirContents(strDirectory); vector fileInfos; #ifndef TUVOK_NO_QT // query directory for image files for (size_t i = 0;iMatch(&fileInfos[i])) { bFoundMatch = true; break; } } if (!bFoundMatch) { ImageStackInfo* newStack = new ImageStackInfo(&fileInfos[i]); m_FileStacks.push_back(newStack); } } } void ImageParser::GetDirInfo(wstring wstrDirectory) { string strDirectory(wstrDirectory.begin(), wstrDirectory.end()); GetDirInfo(strDirectory); } ImageVis3D-3.1.0/Tuvok/IO/AnalyzeConverter.h0000644000175000017500000000612212320456500020341 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef TUVOK_ANALYZE_CONVERTER_H #define TUVOK_ANALYZE_CONVERTER_H /** \file AnalyzeConverter.h \author Tom Fogal SCI Institute University of Utah */ #include "RAWConverter.h" /// A converter for Analyze 7.5 files, popularized by Mayo Clinic software. class AnalyzeConverter : public RAWConverter { public: AnalyzeConverter(); virtual ~AnalyzeConverter() {} virtual bool CanRead(const std::string& fn, const std::vector& start) const; virtual bool ConvertToRAW(const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianness, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile); virtual bool ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize, FLOATVECTOR3 vVolumeAspect, bool bNoUserInteraction, const bool bQuantizeTo8Bit); virtual bool CanExportData() const { return false; } virtual bool CanImportData() const { return true; } }; #endif // TUVOK_ANALYZE_CONVERTER_H ImageVis3D-3.1.0/Tuvok/IO/TransferFunction1D.h0000644000175000017500000000673112320456500020533 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file TransferFunction1D.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date September 2008 */ #pragma once #ifndef TRANSFERFUNCTION1D #define TRANSFERFUNCTION1D #include #include #include #include "StdTuvokDefines.h" #include "Basics/Vectors.h" #include "Basics/Grids.h" typedef VECTOR2 UINT64VECTOR2; typedef Grid1D Histogram1D; typedef Grid1D NormalizedHistogram1D; class TransferFunction1D { public: TransferFunction1D(size_t iSize = 0); TransferFunction1D(const std::string& filename); ~TransferFunction1D(void); void SetStdFunction(float fCenterPoint=0.5f, float fInvGradient=0.5f); void SetStdFunction(float fCenterPoint, float fInvGradient, int iComponent, bool bInvertedStep); /// Set the transfer function from an external source. Assumes the vector /// has 4-components per element, in RGBA order. void Set(const std::vector&); size_t GetSize() const {return m_pvColorData->size();} void Resize(size_t iSize); void Resample(size_t iTargetSize); void FillOrTruncate(size_t iTargetSize); std::shared_ptr> GetColorData(); FLOATVECTOR4 GetColor(size_t index) const; void SetColor(size_t index, FLOATVECTOR4 color); bool Load(const std::string& filename); bool Load(const std::string& filename, size_t iTargetSize); bool Load(std::istream& file); bool Load(std::istream& file, size_t iTargetSize); bool Save(std::ostream& file) const; bool Save(const std::string& filename) const; void Clear(); void GetByteArray(std::vector& vData, unsigned char cUsedRange = 255) const; void GetShortArray(unsigned short** psData, unsigned short sUsedRange=4095) const; void GetFloatArray(float** pfData) const; void ComputeNonZeroLimits(); const UINT64VECTOR2& GetNonZeroLimits() { return m_vValueBBox;} private: UINT64VECTOR2 m_vValueBBox; /// m_pvColorData exists as a shared pointer so that it can be handed off in /// an efficient manner to C++ code (from Lua inside of Tuvok). std::shared_ptr> m_pvColorData; float Smoothstep(float x) const; }; #endif // TRANSFERFUNCTION1D ImageVis3D-3.1.0/Tuvok/IO/AnalyzeConverter.cpp0000644000175000017500000002203312320456500020673 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file AnalyzeConverter.cpp \author Tom Fogal SCI Institute University of Utah */ #include #include "AnalyzeConverter.h" #include "Basics/SysTools.h" AnalyzeConverter::AnalyzeConverter() { m_vConverterDesc = "Analyze 7.5"; m_vSupportedExt.push_back("HDR"); } struct analyze_hdr { int hdr_size; char data_type[10]; char db_name[18]; int extents; short session_err; char regular; char hkey_un0; short dim[8]; // yes, really. short datatype; short bpp; float aspect[3]; float voxel_offset; }; enum AnalyzeDataTypes { DT_NONE=0, DT_BINARY, // 1 bit/voxel DT_UNSIGNED_CHAR, // 8 bit DT_SIGNED_SHORT=4, DT_SIGNED_INT=8, DT_FLOAT=16, DT_COMPLEX=32, DT_DOUBLE=64, DT_RGB=128, DT_ALL=255 }; bool AnalyzeConverter::CanRead(const std::string& fn, const std::vector& start) const { if(!AbstrConverter::CanRead(fn, start)) { return false; } if((start[0] == '#' && start[1] == '\n') || (start[0] == ' ' && start[1] == '\n' && start[2] == '\n')) { WARNING("Looks like an ascii file... not mine."); return false; } return true; } bool AnalyzeConverter::ConvertToRAW(const std::string& strSourceFilename, const std::string&, bool, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianness, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile) { strTitle = "from analyze converter"; std::ifstream analyze(strSourceFilename.c_str(), std::ios::binary); if(!analyze) { T_ERROR("Could not open %s!", strSourceFilename.c_str()); return false; } struct analyze_hdr hdr; analyze.read(reinterpret_cast(&hdr.hdr_size), 4); analyze.read(hdr.data_type, 10); analyze.read(hdr.db_name, 18); analyze.read(reinterpret_cast(&hdr.extents), 4); analyze.read(reinterpret_cast(&hdr.session_err), 2); analyze.read(&hdr.regular, 1); analyze.read(&hdr.hkey_un0, 1); short num_dimensions; analyze.read(reinterpret_cast(&num_dimensions), 2); if(num_dimensions <= 2) { T_ERROR("%dd data; must have at least 3 dimensions!"); return false; } for(size_t i=0; i < 7; ++i) { analyze.read(reinterpret_cast(&hdr.dim[i]), 2); } // 14 bytes of unused garbage. analyze.seekg(14, std::ios_base::cur); analyze.read(reinterpret_cast(&hdr.datatype), 2); // DT_xxx .. analyze.read(reinterpret_cast(&hdr.bpp), 2); analyze.seekg(2, std::ios_base::cur); // "dim_un0", unused. float num_aspect; analyze.read(reinterpret_cast(&num_aspect), 4); analyze.read(reinterpret_cast(&hdr.aspect[0]), 4); analyze.read(reinterpret_cast(&hdr.aspect[1]), 4); analyze.read(reinterpret_cast(&hdr.aspect[2]), 4); analyze.seekg(12, std::ios_base::cur); // 4 unused aspect values // 'voxel_offset' really is a float that stores a byte offset. Seriously. // Maybe some of the same people that wrote DICOM made Analyze as well. analyze.read(reinterpret_cast(&hdr.voxel_offset), 4); // The header size was meant to be used in case the analyze format // was extended. It never was. Thus the headers are always 348 // bytes. This provides a convenient check for endianness; if the // size isn't 348, then we need to endian convert everything. bConvertEndianness = false; if(hdr.hdr_size != 348) { MESSAGE("Endianness is wrong, swapping..."); bConvertEndianness = true; hdr.bpp = EndianConvert::Swap(hdr.bpp); hdr.dim[0] = EndianConvert::Swap(hdr.dim[0]); hdr.dim[1] = EndianConvert::Swap(hdr.dim[1]); hdr.dim[2] = EndianConvert::Swap(hdr.dim[2]); hdr.aspect[0] = EndianConvert::Swap(hdr.aspect[0]); hdr.aspect[1] = EndianConvert::Swap(hdr.aspect[1]); hdr.aspect[2] = EndianConvert::Swap(hdr.aspect[2]); hdr.voxel_offset = EndianConvert::Swap(hdr.voxel_offset); hdr.datatype = EndianConvert::Swap(hdr.datatype); } iComponentCount = 1; // always, I guess? iComponentSize = hdr.bpp; vVolumeSize = UINT64VECTOR3(hdr.dim[0], hdr.dim[1], hdr.dim[2]); vVolumeAspect = FLOATVECTOR3(hdr.aspect[0], hdr.aspect[1], hdr.aspect[2]); MESSAGE("%gx%gx%g aspect ratio", vVolumeAspect[0], vVolumeAspect[1], vVolumeAspect[2]); MESSAGE("%llu-bit %llux%llux%llu data.", iComponentSize, vVolumeSize[0], vVolumeSize[1], vVolumeSize[2]); { uint64_t bits=0; switch(hdr.datatype) { case DT_BINARY: bits = 1; bSigned = false; bIsFloat = false; MESSAGE("binary"); break; case DT_UNSIGNED_CHAR: bits = 8; bSigned = false; bIsFloat = false; MESSAGE("uchar"); break; case DT_SIGNED_SHORT: bits = 16; bSigned = true; bIsFloat = false; MESSAGE("signed short"); break; case DT_SIGNED_INT: bits = 32; bSigned = true; bIsFloat = false; MESSAGE("int"); break; case DT_FLOAT: bits = 32; bSigned = true; bIsFloat = true; MESSAGE("float"); break; case DT_COMPLEX: T_ERROR("Don't know how to handle complex data."); return false; break; case DT_DOUBLE: bits = 64; bSigned = true; bIsFloat = true; MESSAGE("double"); break; default: WARNING("Unknown data type."); bits = 0; break; } if(iComponentSize != bits) { T_ERROR("Bits per pixel and data type disagree! Broken file?"); analyze.close(); return false; } } // If the voxel offset is negative, then there is padding between every slice // in the data set. We would need to write an intermediate file to handle // that; instead, we just don't handle it. if(hdr.voxel_offset < 0.0) { analyze.close(); T_ERROR("Analyze voxel offset is negative (%g). Intermediate file " "required; this converter is broken."); return false; } iHeaderSkip = static_cast(hdr.voxel_offset); MESSAGE("Skipping %llu bytes.", iHeaderSkip); strIntermediateFile = SysTools::RemoveExt(strSourceFilename) + ".img"; MESSAGE("Using intermediate file %s", strIntermediateFile.c_str()); bDeleteIntermediateFile = false; return true; } bool AnalyzeConverter::ConvertToNative(const std::string&, const std::string&, uint64_t, unsigned, uint64_t, bool, bool, UINT64VECTOR3, FLOATVECTOR3, bool, const bool) { return false; } ImageVis3D-3.1.0/Tuvok/IO/Brick.h0000644000175000017500000000563212320456500016105 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2009 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Brick.h \author Tom Fogal SCI Institute University of Utah */ #pragma once #ifndef TUVOK_BRICK_H #define TUVOK_BRICK_H #include "StdTuvokDefines.h" #include #include #include #include #include #include "Basics/Vectors.h" namespace tuvok { /// Datasets are organized as a set of bricks, stored in a hash table. A key /// into this table consists of an LOD index plus a brick index. /// An element in the table contains /// brick metadata, but no data; to obtain the data one must query the dataset. /// @todo FIXME: this can be a tuple internally, but the interface should be a /// struct or similar: if a new component gets added to the key which is not /// the last component, it shifts all the indices, necessitating massive code /// changes. typedef std::tuple BrickKey; ///< timestep + LOD + 1D brick index struct BrickMD { FLOATVECTOR3 center; ///< center of the brick, in world coords FLOATVECTOR3 extents; ///< width/height/depth of the brick. UINTVECTOR3 n_voxels; ///< number of voxels, per dimension. }; struct BKeyHash : std::unary_function { std::size_t operator()(const BrickKey& bk) const { size_t ts = std::hash()(std::get<0>(bk)); size_t h_lod = std::hash()(std::get<1>(bk)); size_t brick = std::hash()(std::get<2>(bk)); size_t seed = h_lod; seed ^= brick + 0x9e3779b9 + (seed << 6) + (seed >> 2); seed ^= ts + 0x9e3779b9 + (seed << 6) + (seed >> 2); return seed; } }; typedef std::unordered_map BrickTable; } // namespace tuvok #endif // TUVOK_BRICK_H ImageVis3D-3.1.0/Tuvok/IO/Tuvok_QtPlugins.h0000644000175000017500000000327212320456500020167 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifndef TUVOK_QTPLUGINS_H #define TUVOK_QTPLUGINS_H /** \file TUVOK_QtPlugins.h \date December 2008 */ #ifndef TUVOK_NO_QT # include #endif #ifndef TUVOK_NO_IO #ifndef QT_SHARED #if defined(_WIN32) #pragma comment( lib, "Imm32.lib" ) #pragma comment( lib, "Winmm.lib" ) #pragma comment( lib, "ws2_32.lib" ) #endif // _WIN32 #endif // QT_SHARED #endif // TUVOK_NO_IO #endif // TUVOK_QTPLUGINS_H ImageVis3D-3.1.0/Tuvok/IO/TuvokJPEG.h0000644000175000017500000000653212320456500016631 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2009 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file TuvokJPEG.h \author Tom Fogal SCI Institute University of Utah \brief Tuvok wrapper for JPEG loading code. */ #pragma once #ifndef TUVOK_JPEG_H #define TUVOK_JPEG_H #include #include #include namespace tuvok { /// Simple wrapper for reading a JPEG using libjpeg. /// There's an implicit assumption that the returned data will have 8bits per /// component. Since we've only got one libjpeg library, this assumption is /// valid for our configuration; libjpeg will always downsample the data. /// Other libraries include multiple libjpegs, each with a modified #define for /// the number of bits in a component. class JPEG { public: /// Loads a JPEG from a file, starting at the given offset. JPEG(const std::string &, std::streamoff offset=0); /// Loads a JPEG from an in-memory buffer. JPEG(const std::vector& buf); ~JPEG(); /// Query for validity of the given JPEG. If we can't decode the header, /// this returns false. /// Note that if a JPEG stream is corrupt in its payload but not its /// header, we'll say it's valid here but won't actually be able to read /// it. bool valid() const; /// Convenient accessors for image metadata. ///@{ size_t width() const; size_t height() const; size_t components() const; /// Convenience; simply width * height * components. size_t size() const; ///@} /// Reads the underlying JPEG data and returns the data as a raw array. /// The given pointer is valid for the lifetime of this object. const char* data(); public: /// for avoiding a jpeglib.h dependence. struct j_impl { virtual ~j_impl() {} }; private: /// No reason one couldn't define this, but it'd require setting the buffer /// after construction. Since we don't have that needed companion method /// currently, this doesn't make any sense. JPEG(); /// Sets up jpeg_impl. Reads header information. void initialize(); private: size_t w, h; size_t bpp; std::vector buffer; j_impl *jpeg_impl; }; }; #endif // TUVOK_JPEG_H ImageVis3D-3.1.0/Tuvok/IO/DSFactory.h0000644000175000017500000000513312320456500016705 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2009 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DSFactory.h \author Tom Fogal SCI Institute University of Utah \brief Instantiates the correct kind of dataset from a file */ #pragma once #ifndef TUVOK_DS_FACTORY_H #define TUVOK_DS_FACTORY_H #include "StdTuvokDefines.h" #include #include #include #include "TuvokIOError.h" // Get rid of the warning about "non-empty throw specification". #ifdef DETECTED_OS_WINDOWS #pragma warning(disable:4290) #endif namespace tuvok { class Dataset; class FileBackedDataset; namespace io { class DSFactory { public: /// Instantiates a new dataset. /// @param the filename for the dataset to be opened /// @param maximum brick size allowed by the caller /// @param whether the dataset should do expensive work to verify that the /// file is valid/correct. Dataset* Create(const std::string&, uint64_t, bool) const; /// Identify the reader which can read the given file. /// @return The dataset if we find a match, or NULL if not. const std::weak_ptr Reader(const std::string&) const; void AddReader(std::shared_ptr); // We can't copy datasets. So we store pointers to them instead. typedef std::list> DSList; const DSList& Readers() const; private: DSList datasets; }; } // io } // tuvok #endif // TUVOK_DS_FACTORY_H ImageVis3D-3.1.0/Tuvok/IO/XML3DGeoConverter.h0000644000175000017500000000422612320456500020223 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : XML3DGeoConverter.h //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #pragma once #ifndef XML3DGEOCONVERTER_H #define XML3DGEOCONVERTER_H #include "../StdTuvokDefines.h" #include "AbstrGeoConverter.h" namespace tuvok { class XML3DGeoConverter : public AbstrGeoConverter { public: XML3DGeoConverter(); virtual ~XML3DGeoConverter() {} virtual bool ConvertToNative(const Mesh& m, const std::string& strTargetFilename); virtual bool CanExportData() const { return true; } protected: void ConvertToNative(const Mesh& m, size_t iMeshIndex, std::ofstream& outStream) const; void WriteHeader(std::ofstream& outStream); void WriteFooter(std::ofstream& outStream, size_t iMeshCount); }; } #endif // XML3DGEOCONVERTER_H ImageVis3D-3.1.0/Tuvok/IO/InveonConverter.h0000644000175000017500000000620712320456500020200 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file InveonConverter.h \author Tom Fogal SCI Institute University of Utah */ #pragma once #ifndef TUVOK_IO_INVEON_CONVERTER_H #define TUVOK_IO_INVEON_CONVERTER_H #include "../StdTuvokDefines.h" #include "RAWConverter.h" /** A converter for `hdr' and `img' files, which seems to come out of an * 'Inveon' scanner. */ class InveonConverter : public RAWConverter { public: InveonConverter(); virtual ~InveonConverter() {} virtual bool ConvertToRAW(const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile); virtual bool ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize, FLOATVECTOR3 vVolumeAspect, bool bNoUserInteraction, const bool bQuantizeTo8Bit); // checks for comment lines, ascii. virtual bool CanRead(const std::string& fn, const std::vector& start) const; virtual bool CanExportData() const { return true; } virtual bool CanImportData() const { return true; } }; #endif // TUVOK_IO_INVEON_CONVERTER_H ImageVis3D-3.1.0/Tuvok/IO/AbstrConverter.h0000644000175000017500000001452412320456500020016 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file AbstrConverter.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date December 2008 */ #pragma once #ifndef ABSTRCONVERTER_H #define ABSTRCONVERTER_H #include "../StdTuvokDefines.h" #include #include #include "Basics/Vectors.h" #include "Controller/Controller.h" #include "UVF/UVFTables.h" #include "UVF/Histogram1DDataBlock.h" /// If you modify this class, be sure to update the corresponding /// LuaStrictStack definition in LuaIOManagerProxy. class RangeInfo { public: UINT64VECTOR3 m_vDomainSize; FLOATVECTOR3 m_vAspect; unsigned m_iComponentSize; int m_iValueType; std::pair m_fRange; std::pair m_iRange; std::pair m_uiRange; }; class AbstrConverter { public: virtual ~AbstrConverter() {} virtual bool ConvertToUVF(const std::string& strSourceFilename, const std::string& strTargetFilename, const std::string& strTempDir, const bool bNoUserInteraction, const uint64_t iTargetBrickSize, const uint64_t iTargetBrickOverlap, const bool bUseMedian, const bool bClampToEdge, uint32_t iBrickCompression, uint32_t iBrickCompressionLevel, uint32_t iBrickLayout, const bool bQuantizeTo8Bit) = 0; virtual bool ConvertToUVF(const std::list& files, const std::string& strTargetFilename, const std::string& strTempDir, const bool bNoUserInteraction, const uint64_t iTargetBrickSize, const uint64_t iTargetBrickOverlap, const bool bUseMedian, const bool bClampToEdge, uint32_t iBrickCompression, uint32_t iBrickCompressionLevel, uint32_t iBrickLayout, const bool bQuantizeTo8Bit) = 0; virtual bool ConvertToRAW(const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile) = 0; virtual bool ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize, FLOATVECTOR3 vVolumeAspect, bool bNoUserInteraction, const bool bQuantizeTo8Bit) = 0; virtual bool Analyze(const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, RangeInfo& info) = 0; /// @param filename the file in question /// @param start the first few bytes of the file /// @return SupportedExtension() for the file's extension; ignores "start". virtual bool CanRead(const std::string& fn, const std::vector& start) const; const std::vector& SupportedExt() { return m_vSupportedExt; } virtual const std::string& GetDesc() { return m_vConverterDesc; } virtual bool CanExportData() const { return false; } virtual bool CanImportData() const { return true; } static bool Process8Bits(LargeRAWFile& InputData, const std::string& strTargetFilename, uint64_t iSize, bool bSigned, Histogram1DDataBlock* Histogram1D=0); static bool QuantizeTo8Bit(LargeRAWFile& rawfile, const std::string& strTargetFilename, unsigned iComponentSize, uint64_t iSize, bool bSigned, bool bIsFloat, Histogram1DDataBlock* Histogram1D=0); static size_t GetIncoreSize(); protected: /// @param ext the extension for the filename /// @return true if the filename is a supported extension for this converter bool SupportedExtension(const std::string& ext) const; protected: std::string m_vConverterDesc; std::vector m_vSupportedExt; }; #endif // ABSTRCONVERTER_H ImageVis3D-3.1.0/Tuvok/IO/LinesGeoConverter.cpp0000644000175000017500000001070612320456500021001 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "StdTuvokDefines.h" #include #include #include "Basics/Mesh.h" #include "Controller/Controller.h" #include "LinesGeoConverter.h" #include "TuvokIOError.h" namespace tuvok { LinesGeoConverter::LinesGeoConverter() { m_vSupportedExt.push_back("IV3DLINES"); m_vSupportedExt.push_back("LNE"); m_vConverterDesc = "IV3D Hacky Lines"; } using namespace io; std::shared_ptr LinesGeoConverter::ConvertToMesh(const std::string& rawFilename) { MESSAGE("Converting %s...", rawFilename.c_str()); std::ifstream lines(rawFilename.c_str(), std::ios::in); if(!lines) { throw DSOpenFailed(rawFilename.c_str(), "open failed", __FILE__, __LINE__); } uint64_t n_vertices; lines >> n_vertices; if(!lines || n_vertices == 0) { throw DSParseFailed(rawFilename.c_str(), "number of vertices", __FILE__, __LINE__); } size_t n_vertices_st = static_cast(n_vertices); MESSAGE("%llu vertices.", n_vertices); VertVec vertices(n_vertices_st); for(size_t i=0; i < n_vertices_st; ++i) { FLOATVECTOR3 tmp; lines >> tmp[0] >> tmp[1] >> tmp[2]; vertices[i] = tmp; } if(!lines) { throw DSParseFailed(rawFilename.c_str(), "vertices list short", __FILE__, __LINE__); } uint64_t n_edges; lines >> n_edges; if(!lines) { throw DSParseFailed("number of edges", __FILE__, __LINE__); } MESSAGE("%llu edges.", n_edges); size_t n_edges_st = static_cast(n_edges); IndexVec edges(static_cast(n_edges*2)); // an indexVec holds a single elem, not a pair for(size_t i=0; i < n_edges_st; ++i) { UINTVECTOR2 e; lines >> e[0] >> e[1]; edges[i+0] = e[0]-1; edges[i+1] = e[1]-1; } if(!lines) { throw DSParseFailed("error reading edge list", __FILE__, __LINE__); } uint64_t n_colors; lines >> n_colors; if(!lines || n_colors == 0) { throw DSParseFailed("number of colors", __FILE__, __LINE__); } MESSAGE("%llu colors.", n_colors); size_t n_colors_st = static_cast(n_colors); ColorVec colors(n_colors_st); FLOATVECTOR3 c; for(size_t i=0; i < n_colors; ++i) { lines >> c[0] >> c[1] >> c[2]; colors[i] = c; } if(!lines) { throw std::runtime_error("error reading color array"); } uint64_t n_color_indices; lines >> n_color_indices; if(!lines || n_color_indices == 0) { throw DSParseFailed("number of color indices", __FILE__, __LINE__); } MESSAGE("%llu color indices", n_color_indices); size_t n_color_indices_st = static_cast(n_color_indices); IndexVec c_indices(n_color_indices_st); uint32_t cindex; for(size_t i=0; i < n_color_indices_st; ++i) { lines >> cindex; c_indices[i] = cindex-1; } if(!lines) { throw DSParseFailed("short color index list", __FILE__, __LINE__); } lines.close(); // we're good, except the data are in a different coordinate space. // oops! Subtract 0.5 from X and Y to get it into the right place. for(VertVec::iterator v = vertices.begin(); v != vertices.end(); ++v) { *v = FLOATVECTOR3((*v)[0]-0.5f, (*v)[1]-0.5f, (*v)[2]); } return std::shared_ptr(new Mesh( vertices, NormVec(), TexCoordVec(), colors, edges, IndexVec(), IndexVec(), c_indices, false, false, "Esra-mesh", Mesh::MT_LINES )); } } ImageVis3D-3.1.0/Tuvok/IO/StLGeoConverter.h0000644000175000017500000000401112320456500020066 0ustar mathieumathieu#pragma once #ifndef STLGEOCONVERTER_H #define STLGEOCONVERTER_H #include "../StdTuvokDefines.h" #include "AbstrGeoConverter.h" namespace tuvok { class StLGeoConverter : public AbstrGeoConverter { public: StLGeoConverter(); virtual ~StLGeoConverter() {} virtual std::shared_ptr ConvertToMesh(const std::string& strFilename); virtual bool ConvertToNative(const Mesh& m, const std::string& strTargetFilename); virtual bool ConvertToNative(const Mesh& m, const std::string& strTargetFilename, bool bASCII); virtual bool CanExportData() const { return true; } virtual bool CanImportData() const { return true; } private: FLOATVECTOR3 ComputeFaceNormal(const Mesh& m, size_t i, bool bHasNormals) const; }; } #endif // STLGEOCONVERTER_H /* The MIT License Copyright (c) 2013 Jens Krueger Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/FileBackedDataset.h0000644000175000017500000000457212320456500020334 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2009 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file FileBackedDataset.h \author Tom Fogal SCI Institute University of Utah */ #pragma once #ifndef TUVOK_FILE_BACKED_DATASET_H #define TUVOK_FILE_BACKED_DATASET_H #include #include #include #include namespace tuvok { class Dataset; /// Interface for Datasets which are actually backed by files class FileBackedDataset { public: virtual std::string Filename() const=0; /// A user-visible name for your format. This might get displayed in UI /// elements; e.g. the GUI might ask if the user wants to use the "Name() /// reader" to open a particular file. virtual const char* Name() const { return "Generic"; } virtual bool CanRead(const std::string&, const std::vector&) const=0; /// Use to verify checksum. Default implementation says the checksum is /// always valid. virtual bool Verify(const std::string&) const; virtual Dataset* Create(const std::string&, uint64_t, bool) const=0; /// @return a list of file extensions readable by this format virtual std::list Extensions() const=0; }; } // namespace tuvok #endif // TUVOK_FILE_BACKED_DATASET_H ImageVis3D-3.1.0/Tuvok/IO/OBJGeoConverter.h0000644000175000017500000000422412320456500020004 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : OBJGeoConverter.h //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #pragma once #ifndef OBJGEOCONVERTER_H #define OBJGEOCONVERTER_H #include "../StdTuvokDefines.h" #include "AbstrGeoConverter.h" namespace tuvok { class OBJGeoConverter : public AbstrGeoConverter { public: OBJGeoConverter(); virtual ~OBJGeoConverter() {} virtual std::shared_ptr ConvertToMesh(const std::string& strFilename); virtual bool ConvertToNative(const Mesh& m, const std::string& strTargetFilename); virtual bool CanExportData() const { return true; } virtual bool CanImportData() const { return true; } protected: int CountOccurences(const std::string& str, const std::string& substr); }; } #endif // OBJGEOCONVERTER_H ImageVis3D-3.1.0/Tuvok/IO/VFFConverter.h0000644000175000017500000000505312320456500017361 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file VFFConverter.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date December 2008 */ #pragma once #ifndef VFFCONVERTER_H #define VFFCONVERTER_H #include "../StdTuvokDefines.h" #include "RAWConverter.h" class VFFConverter : public RAWConverter { public: VFFConverter(); virtual ~VFFConverter() {} virtual bool ConvertToRAW( const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile ); virtual bool ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize,FLOATVECTOR3 vVolumeAspect, bool bNoUserInteraction, const bool bQuantizeTo8Bit); virtual bool CanExportData() const {return true;} virtual bool CanImportData() const { return true; } }; #endif // VFFCONVERTER_H ImageVis3D-3.1.0/Tuvok/IO/LinesGeoConverter.h0000644000175000017500000000417012320456500020444 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifndef TUVOK_LINES_GEO_CONVERTER_H #define TUVOK_LINES_GEO_CONVERTER_H #include "AbstrGeoConverter.h" namespace tuvok { /// Simple/homegrown format for getting a bunch of line geometry loaded. /// This is specifically to get a collaborator rolling quickly and isn't really /// a great format; it is expected to change. /// The format is: /// n_vertices /// vertexX vertexY vertexZ /// .... /// n_edges /// vert_index_A vert_index_B /// .... /// n_colors /// R G B /// ... /// n_color_indices /// color_index_0 /// color_index_1 /// .... class LinesGeoConverter: public AbstrGeoConverter { public: LinesGeoConverter(); virtual ~LinesGeoConverter() {} virtual std::shared_ptr ConvertToMesh(const std::string&); virtual bool CanExportData() const { return false; } virtual bool CanImportData() const { return true; } }; } #endif // TUVOK_LINES_GEO_CONVERTER_H ImageVis3D-3.1.0/Tuvok/IO/TransferFunction2D.cpp0000644000175000017500000004120212320456500021057 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file TransferFunction2D.cpp \author Jens Krueger SCI Institute University of Utah \version 1.0 \date September 2008 */ #include #include "TransferFunction2D.h" #include "Controller/Controller.h" using namespace std; TransferFunction2D::TransferFunction2D() : m_pvSwatches(new vector), m_iSize(0,0), m_pColorData(NULL), m_pPixelData(NULL), m_pRCanvas(NULL), m_bUseCachedData(false) { } TransferFunction2D::TransferFunction2D(const std::string& filename): m_pvSwatches(new vector), m_iSize(0,0), m_pColorData(NULL), m_pPixelData(NULL), m_pRCanvas(NULL), m_bUseCachedData(false) { Load(filename); } TransferFunction2D::TransferFunction2D(const VECTOR2& iSize): m_pvSwatches(new vector), m_iSize(iSize), m_pColorData(NULL), m_pPixelData(NULL), m_pRCanvas(NULL), m_bUseCachedData(false) { Resize(m_iSize); } void TransferFunction2D::DeleteCanvasData() { delete m_pColorData; delete [] m_pPixelData; delete m_pRCanvas; } TransferFunction2D::~TransferFunction2D(void) { DeleteCanvasData(); } void TransferFunction2D::Resize(const VECTOR2& iSize) { m_iSize = iSize; m_Trans1D.Resize(iSize.x); m_Trans1D.Clear(); DeleteCanvasData(); } void TransferFunction2D::Resample(const VECTOR2& iSize) { m_iSize = iSize; m_Trans1D.Resample(iSize.x); } bool TransferFunction2D::Load(const std::string& filename, const VECTOR2& vTargetSize) { ifstream file(filename.c_str()); if (!file.is_open()) return false; m_iSize = vTargetSize; // ignore the size in the file (read it but never use it again) VECTOR2 vSizeInFile; file >> vSizeInFile.x >> vSizeInFile.y; if(!file) { T_ERROR("2DTF '%s' ends after file size!", filename.c_str()); return false; } // load 1D Trans if(!m_Trans1D.Load(file, vTargetSize.x)) { T_ERROR("Failed loading 1DTF within 2DTF! (in %s)", filename.c_str()); return false; } // load swatch count uint32_t iSwatchCount; file >> iSwatchCount; if(!file) { T_ERROR("Swatch count is missing in %s.", filename.c_str()); return false; } m_pvSwatches->resize(iSwatchCount); // load Swatches for (size_t i = 0;isize();i++) { if(!(*m_pvSwatches)[i].Load(file)) { T_ERROR("Failed loading swatch %u/%u in %s", static_cast(i), static_cast(m_pvSwatches->size()-1), filename.c_str()); return false; } } file.close(); return true; } bool TransferFunction2D::Load(const std::string& filename) { ifstream file(filename.c_str()); if (!file.is_open()) return false; // load size file >> m_iSize.x >> m_iSize.y; if(!file) { T_ERROR("Could not get 1D TF size from stream (in %s).", filename.c_str()); return false; } // load 1D Trans if(!m_Trans1D.Load(file, m_iSize.x)) { T_ERROR("2DTF '%s': Could not load 1D TF.", filename.c_str()); return false; } // load swatch count uint32_t iSwatchCount; file >> iSwatchCount; if(!file) { T_ERROR("Invalid swatch count in %s", filename.c_str()); return false; } m_pvSwatches->resize(iSwatchCount); if(iSwatchCount == 0) { WARNING("No swatches?! Ridiculous 2D TFqn, bailing..."); return false; } // load Swatches for (size_t i = 0;isize();i++) { if(!(*m_pvSwatches)[i].Load(file)) { T_ERROR("Failed loading swatch %u/%u in %s", static_cast(i), static_cast(m_pvSwatches->size()-1), filename.c_str()); return false; } } file.close(); return true; } bool TransferFunction2D::Save(const std::string& filename) const { ofstream file(filename.c_str()); if (!file.is_open()) return false; // save size file << m_iSize.x << " " << m_iSize.y << endl; // save 1D Trans m_Trans1D.Save(file); // save swatch count file << m_pvSwatches->size() << endl; // save Swatches for (size_t i = 0;isize();i++) (*m_pvSwatches)[i].Save(file); file.close(); return true; } void TransferFunction2D::GetByteArray(unsigned char** pcData) { if (*pcData == NULL) *pcData = new unsigned char[m_iSize.area()*4]; size_t iSize = m_iSize.area(); unsigned char *pcSourceDataIterator = RenderTransferFunction8Bit(); unsigned char *pcDataIterator = *pcData; memcpy(pcDataIterator, pcSourceDataIterator, iSize*4); for (size_t i = 0;iGetDataPointer(); for (size_t i = 0;iGetSize().area();i++) { *psDataIterator++ = (unsigned short)((*piSourceIterator)[0]*sUsedRange); *psDataIterator++ = (unsigned short)((*piSourceIterator)[1]*sUsedRange); *psDataIterator++ = (unsigned short)((*piSourceIterator)[2]*sUsedRange); *psDataIterator++ = (unsigned short)((*piSourceIterator)[3]*sUsedRange); piSourceIterator++; } } void TransferFunction2D::GetFloatArray(float** pfData) { if (*pfData == NULL) *pfData = new float[4*m_iSize.area()]; RenderTransferFunction(); memcpy(*pfData, m_pColorData->GetDataPointer(), 4*sizeof(float)*m_iSize.area()); } INTVECTOR2 TransferFunction2D::Normalized2Offscreen(FLOATVECTOR2 vfCoord, VECTOR2 iSize) const { return INTVECTOR2(int(vfCoord.x*int(iSize.x)), int(vfCoord.y*int(iSize.y))); } unsigned char* TransferFunction2D::RenderTransferFunction8Bit() { VECTOR2 vRS = GetRenderSize(); if (m_pColorData == NULL) m_pColorData = new ColorData2D(m_iSize); if (m_pPixelData == NULL) m_pPixelData = new unsigned char[4*m_iSize.area()]; #ifndef TUVOK_NO_QT if (m_pRCanvas == NULL) m_pRCanvas = new QImage(int(vRS.x), int(vRS.y), QImage::Format_ARGB32); if (m_pPixelData != NULL && m_bUseCachedData) return m_pPixelData; m_pRCanvas->fill(0); // render 1D trans QRect imageRect(0, 0, int(vRS.x), int(vRS.y)); m_Painter.begin(m_pRCanvas); m_Painter.drawImage(imageRect,m_Trans1DImage); // render swatches QPen noBorderPen(Qt::NoPen); m_Painter.setPen(noBorderPen); for (size_t i = 0;isize();i++) { TFPolygon& currentSwatch = (*m_pvSwatches)[i]; std::vector pointList(currentSwatch.pPoints.size()); for (size_t j = 0;jsetColorAt(currentSwatch.pGradientStops[j].first, QColor(int(currentSwatch.pGradientStops[j].second[0]*255), int(currentSwatch.pGradientStops[j].second[1]*255), int(currentSwatch.pGradientStops[j].second[2]*255), int(currentSwatch.pGradientStops[j].second[3]*255))); } m_Painter.setBrush(*pGradientBrush); if(!pointList.empty()) { m_Painter.drawPolygon(&pointList[0], int(currentSwatch.pPoints.size())); } delete pGradientBrush; } m_Painter.end(); memcpy(m_pPixelData, m_pRCanvas->scaled(int(m_iSize.x), int(m_iSize.y)).bits(), 4*m_iSize.area()); m_bUseCachedData = true; #else if (!m_pvSwatches->empty()) { m_pvSwatches->clear(); WARNING("Cannot render transfer functions without Qt, returning empty transfer function."); memset(m_pPixelData, 0, 4*m_iSize.area()); } #endif return m_pPixelData; } ColorData2D* TransferFunction2D::RenderTransferFunction() { unsigned char* pPixelData = RenderTransferFunction8Bit(); FLOATVECTOR4* p = (FLOATVECTOR4*)(m_pColorData->GetDataPointer()); for (size_t i = 0;iGetSize().area();i++) { p[i] = FLOATVECTOR4(pPixelData[4*i+2]/255.0f, pPixelData[4*i+1]/255.0f, pPixelData[4*i+0]/255.0f, pPixelData[4*i+3]/255.0f); } return m_pColorData; } void TransferFunction2D::ComputeNonZeroLimits() { unsigned char* pPixelData = RenderTransferFunction8Bit(); m_vValueBBox = UINT64VECTOR4(uint64_t(m_iSize.x),0, uint64_t(m_iSize.y),0); size_t i = 3; for (size_t y = 0;y(m_iSize.x, m_Trans1D.GetSize()); m_Trans1DImage = QImage(int(iSize), 1, QImage::Format_ARGB32); shared_ptr> tfdata = m_Trans1D.GetColorData(); for (size_t i = 0;isize(); } void TransferFunction2D::SwatchPushBack(const TFPolygon& swatch) { m_pvSwatches->push_back(swatch); } void TransferFunction2D::SwatchErase(size_t swatchIndex) { vector::iterator nth = m_pvSwatches->begin() + swatchIndex; m_pvSwatches->erase(nth); } void TransferFunction2D::SwatchInsert(size_t i, const TFPolygon& swatch) { vector::iterator nth = m_pvSwatches->begin() + i; m_pvSwatches->insert(nth, swatch); } size_t TransferFunction2D::SwatchGetNumPoints(size_t i) const { return (*m_pvSwatches)[i].pPoints.size(); } bool TransferFunction2D::SwatchIsRadial(size_t i) const { return (*m_pvSwatches)[i].bRadial; } void TransferFunction2D::SwatchSetRadial(size_t i, bool radial) { (*m_pvSwatches)[i].bRadial = radial; } size_t TransferFunction2D::SwatchGetGradientCount(size_t i) const { return (*m_pvSwatches)[i].pGradientStops.size(); } GradientStop TransferFunction2D::SwatchGetGradient(size_t swatch, size_t i) const { return (*m_pvSwatches)[swatch].pGradientStops[i]; } void TransferFunction2D::SwatchInsertGradient(size_t swatch, size_t i, GradientStop stop) { vector::iterator nth = (*m_pvSwatches)[swatch].pGradientStops.begin() + i; (*m_pvSwatches)[swatch].pGradientStops.insert(nth, stop); } void TransferFunction2D::SwatchPushBackGradient(size_t swatch, GradientStop stop) { (*m_pvSwatches)[swatch].pGradientStops.push_back(stop); } void TransferFunction2D::SwatchEraseGradient(size_t swatch, size_t i) { vector::iterator nth = (*m_pvSwatches)[swatch].pGradientStops.begin() + i; (*m_pvSwatches)[swatch].pGradientStops.erase(nth); } void TransferFunction2D::SwatchUpdateGradient(size_t swatch, size_t i, GradientStop stop) { (*m_pvSwatches)[swatch].pGradientStops[i] = stop; } void TransferFunction2D::SwatchErasePoint(size_t swatch, size_t i) { vector< FLOATVECTOR2 >::iterator nth = (*m_pvSwatches)[swatch].pPoints.begin() + i; (*m_pvSwatches)[swatch].pPoints.erase(nth); } void TransferFunction2D::SwatchInsertPoint(size_t swatch, size_t i, FLOATVECTOR2 coord) { vector< FLOATVECTOR2 >::iterator nth = (*m_pvSwatches)[swatch].pPoints.begin() + i; (*m_pvSwatches)[swatch].pPoints.insert(nth, coord); } void TransferFunction2D::SwatchUpdate(size_t i, const TFPolygon& swatch) { (*m_pvSwatches)[i] = swatch; } std::shared_ptr> TransferFunction2D::SwatchGet() const { return m_pvSwatches; } // *************************************************************************** bool TFPolygon::Load(ifstream& file) { uint32_t iSize; file >> bRadial; file >> iSize; if(!file) { return false; } pPoints.resize(iSize); if(iSize == 0) { // We don't want to bail, though, because we should still read the // gradient stop information. WARNING("polygon with no points..."); } for(size_t i=0;i> pPoints[i][j]; } } file >> pGradientCoords[0][0] >> pGradientCoords[0][1]; file >> pGradientCoords[1][0] >> pGradientCoords[1][1]; file >> iSize; if(!file) { return false; } pGradientStops.resize(iSize); for(size_t i=0;i> pGradientStops[i].first; for(size_t j=0;j<4;++j){ file >> pGradientStops[i].second[j]; } } return !(file.fail()); } void TFPolygon::Save(ofstream& file) const { file << bRadial << endl; file << uint32_t(pPoints.size()) << endl; for(size_t i=0;i&) const; virtual bool ConvertToRAW( const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile ); virtual bool CanImportData() const { return true; } }; #endif // TUVOK_VTK_CONVERTER_H /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2013 IVDA Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/uvfMesh.cpp0000644000175000017500000000634012320456500017020 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : uvfMesh.cpp //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #include #include #include #include "uvfMesh.h" #include "UVF/GeometryDataBlock.h" using namespace std; using namespace tuvok; uvfMesh::uvfMesh(const GeometryDataBlock& tsb) { m_DefColor = FLOATVECTOR4(tsb.GetDefaultColor()); m_MeshDesc = tsb.m_Desc; switch (tsb.GetPolySize()) { case 2 : m_meshType = MT_LINES; break; case 3 : m_meshType = MT_TRIANGLES; break; default : throw std::runtime_error("reading unsupported mesh type"); } m_VerticesPerPoly = size_t(tsb.GetPolySize()); vector fVec; fVec = tsb.GetVertices(); assert(fVec.size()%3 == 0); if (fVec.size() > 0) { m_Data.m_vertices.resize(fVec.size()/3); memcpy(&m_Data.m_vertices[0],&fVec[0],fVec.size()*sizeof(float));} fVec = tsb.GetNormals(); assert(fVec.size()%3 == 0); if (fVec.size() > 0) { m_Data.m_normals.resize(fVec.size()/3); memcpy(&m_Data.m_normals[0],&fVec[0],fVec.size()*sizeof(float));} fVec = tsb.GetTexCoords(); assert(fVec.size()%2 == 0); if (fVec.size() > 0) { m_Data.m_texcoords.resize(fVec.size()/2); memcpy(&m_Data.m_texcoords[0],&fVec[0],fVec.size()*sizeof(float));} fVec = tsb.GetColors(); assert(fVec.size()%4 == 0); if (fVec.size() > 0) { m_Data.m_colors.resize(fVec.size()/4); memcpy(&m_Data.m_colors[0],&fVec[0],fVec.size()*sizeof(float));} fVec.clear(); m_Data.m_VertIndices = tsb.GetVertexIndices(); assert(m_Data.m_VertIndices.size()%tsb.GetPolySize() == 0); m_Data.m_NormalIndices = tsb.GetNormalIndices(); assert(m_Data.m_NormalIndices.size()%tsb.GetPolySize() == 0); m_Data.m_TCIndices = tsb.GetTexCoordIndices(); assert(m_Data.m_TCIndices.size()%tsb.GetPolySize() == 0); m_Data.m_COLIndices = tsb.GetColorIndices(); assert(m_Data.m_COLIndices.size()%tsb.GetPolySize() == 0); GeometryHasChanged(true, true); } ImageVis3D-3.1.0/Tuvok/IO/IOManager.h0000644000175000017500000002627212320456500016660 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file IOManager.h \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #pragma once #ifndef IOMANAGER_H #define IOMANAGER_H #include "StdTuvokDefines.h" #include #include #include #include #include #include #include "Basics/TuvokException.h" #include "Basics/Vectors.h" typedef std::tuple tConverterFormat; class AbstrConverter; class FileStackInfo; class RangeInfo; class UVF; class GeometryDataBlock; class TransferFunction1D; namespace tuvok { class AbstrGeoConverter; class AbstrRenderer; class Dataset; class FileBackedDataset; class Mesh; class UVFDataset; namespace io { class DSFactory; } } class IOManager { public: IOManager(); ~IOManager(); std::vector> ScanDirectory(std::string strDirectory) const; bool ConvertDataset(FileStackInfo* pStack, const std::string& strTargetFilename, const std::string& strTempDir, const uint64_t iMaxBrickSize, uint64_t iBrickOverlap, bool bQuantizeTo8Bit=false) const; bool ConvertDataset(const std::string& strFilename, const std::string& strTargetFilename, const std::string& strTempDir, const bool bNoUserInteraction, const uint64_t iMaxBrickSize, uint64_t iBrickOverlap, bool bQuantizeTo8Bit=false) const; bool ConvertDataset(const std::list& files, const std::string& strTargetFilename, const std::string& strTempDir, const bool bNoUserInteraction, const uint64_t iMaxBrickSize, uint64_t iBrickOverlap, bool bQuantizeTo8Bit=false) const; bool MergeDatasets(const std::vector& strFilenames, const std::vector& vScales, const std::vector& vBiases, const std::string& strTargetFilename, const std::string& strTempDir, bool bUseMaxMode=true, bool bNoUserInteraction=false) const; /// evaluates the given expression. v[n] in the expression refers to /// the volume given by volumes[n]. void EvaluateExpression(const std::string& expr, const std::vector& volumes, const std::string& out_fn) const throw(tuvok::Exception); bool ReBrickDataset(const std::string& strSourceFilename, const std::string& strTargetFilename, const std::string& strTempDir, const uint64_t iMaxBrickSize, const uint64_t iBrickOverlap, bool bQuantizeTo8Bit=false) const; bool ConvertDataset(FileStackInfo* pStack, const std::string& strTargetFilename, const std::string& strTempDir, const bool bQuantizeTo8Bit=false) const{ return ConvertDataset(pStack, strTargetFilename, strTempDir, m_iBuilderBrickSize, m_iBrickOverlap, bQuantizeTo8Bit); } bool ConvertDataset(const std::list& files, const std::string& strTargetFilename, const std::string& strTempDir, const bool bNoUserInteraction=false, const bool bQuantizeTo8Bit=false) const { return ConvertDataset(files, strTargetFilename, strTempDir, bNoUserInteraction, m_iBuilderBrickSize, m_iBrickOverlap, bQuantizeTo8Bit); } std::shared_ptr LoadMesh(const std::string& meshfile) const; void AddMesh(const UVF* sourceDataset, const std::string& trisoup_file, const std::string& uvf) const; ///@{ /// We jump into the memory manager to load a data set, but the memory /// manager is defined elsewhere. This sets/uses the callback to utilize the /// memory manager to call us. The MMgr will in turn use the DSFactory from /// here to actually create the data set. void SetMemManLoadFunction( std::function& f ); tuvok::Dataset* LoadDataset(const std::string& strFilename, tuvok::AbstrRenderer* requester) const; /// @param filename the data to load /// @param the bricksize we should rebrick into /// @param minmaxType how we should handle brick min/maxes. 0=use the source /// dataset, 1=precompute on load (big delay), 2=compute on demand tuvok::Dataset* LoadRebrickedDataset(const std::string& filename, const UINTVECTOR3 bricksize, size_t minmaxType) const; ///@} tuvok::Dataset* CreateDataset(const std::string& filename, uint64_t max_brick_size, bool verify) const; void AddReader(std::shared_ptr); bool AnalyzeDataset(const std::string& strFilename, RangeInfo& info, const std::string& strTempDir) const; bool NeedsConversion(const std::string& strFilename) const; bool Verify(const std::string& strFilename) const; bool ExportMesh(const std::shared_ptr mesh, const std::string& strTargetFilename); bool ExportDataset(const tuvok::UVFDataset* pSourceData, uint64_t iLODlevel, const std::string& strTargetFilename, const std::string& strTempDir) const; bool ExtractIsosurface(const tuvok::UVFDataset* pSourceData, uint64_t iLODlevel, double fIsovalue, const FLOATVECTOR4& vfColor, const std::string& strTargetFilename, const std::string& strTempDir) const; bool ExtractImageStack(const tuvok::UVFDataset* pSourceData, const TransferFunction1D* pTrans, uint64_t iLODlevel, const std::string& strTargetFilename, const std::string& strTempDir, bool bAllDirs) const; void RegisterExternalConverter(std::shared_ptr pConverter); void RegisterFinalConverter(std::shared_ptr pConverter); std::string GetLoadDialogString() const; std::string GetExportDialogString() const; std::string ExportDialogFilterToExt(const std::string& filter) const; std::string GetImageExportDialogString() const; std::string ImageExportDialogFilterToExt(const std::string& filter) const; std::vector> GetImportFormatList() const; std::vector> GetExportFormatList() const; std::vector GetFormatList() const; bool HasConverterForExt(std::string ext, bool bMustSupportExport, bool bMustSupportImport) const { return (GetConverterForExt(ext,bMustSupportExport,bMustSupportImport)!=NULL); } std::shared_ptr GetConverterForExt(std::string ext, bool bMustSupportExport, bool bMustSupportImport) const; std::string GetLoadGeoDialogString() const; std::string GetGeoExportDialogString() const; std::vector> GetGeoImportFormatList() const; std::vector> GetGeoExportFormatList() const; std::vector GetGeoFormatList() const; bool HasGeoConverterForExt(std::string ext, bool bMustSupportExport, bool bMustSupportImport) const { return GetGeoConverterForExt(ext, bMustSupportExport, bMustSupportImport) != NULL; } tuvok::AbstrGeoConverter* GetGeoConverterForExt(std::string ext, bool bMustSupportExport, bool bMustSupportImport) const; uint64_t GetMaxBrickSize() const {return m_iMaxBrickSize;} uint64_t GetBuilderBrickSize() const {return m_iBuilderBrickSize;} uint64_t GetBrickOverlap() const {return m_iBrickOverlap;} uint64_t GetIncoresize() const {return m_iIncoresize;} bool SetMaxBrickSize(uint64_t iMaxBrickSize, uint64_t iBuilderBrickSize); bool SetBrickOverlap(const uint64_t iBrickOverlap); void SetUseMedianFilter(bool bUseMedianFilter) { m_bUseMedianFilter = bUseMedianFilter; } bool GetUseMedianFilter() const { return m_bUseMedianFilter; } void SetClampToEdge(bool bClampToEdge) { m_bClampToEdge = bClampToEdge; } void SetCompression(uint32_t iCompression) { m_iCompression = iCompression; } void SetCompressionLevel(uint32_t iCompressionLevel) { m_iCompressionLevel = iCompressionLevel; } void SetLayout(uint32_t iLayout) { m_iLayout = iLayout; } bool GetClampToEdge() const { return m_bClampToEdge; } private: std::vector m_vpGeoConverters; std::vector> m_vpConverters; std::shared_ptr m_pFinalConverter; std::auto_ptr m_dsFactory; uint64_t m_iMaxBrickSize; uint64_t m_iBuilderBrickSize; uint64_t m_iBrickOverlap; uint64_t m_iIncoresize; bool m_bUseMedianFilter; bool m_bClampToEdge; uint32_t m_iCompression; uint32_t m_iCompressionLevel; uint32_t m_iLayout; std::function m_LoadDS; void CopyToTSB(const tuvok::Mesh& m, GeometryDataBlock* tsb) const; }; #endif // IOMANAGER_H ImageVis3D-3.1.0/Tuvok/IO/DSFactory.cpp0000644000175000017500000000634612320456500017247 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2009 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DSFactory.cpp \author Tom Fogal SCI Institute University of Utah \brief Instantiates the correct kind of dataset from a file */ #include "StdTuvokDefines.h" #include #include "DSFactory.h" #include "Controller/Controller.h" #include "Dataset.h" #include "FileBackedDataset.h" namespace tuvok { namespace io { static void first_block(const std::string& filename, std::vector& block) { std::ifstream ifs(filename.c_str(), std::ifstream::in | std::ifstream::binary); block.resize(512, 0); if(!ifs.is_open()) { return; } ifs.read(reinterpret_cast(&block[0]), 512); ifs.close(); } Dataset* DSFactory::Create(const std::string& filename, uint64_t max_brick_size, bool verify) const { std::vector bytes(512); first_block(filename, bytes); const std::weak_ptr ds = this->Reader(filename); if(!ds.expired()) { return ds.lock()->Create(filename, max_brick_size, verify); } throw DSOpenFailed(filename.c_str(), "No reader can read this data!", __FILE__, __LINE__); } const std::weak_ptr DSFactory::Reader(const std::string& filename) const { std::vector bytes(512); first_block(filename, bytes); for(auto ds = datasets.cbegin(); ds != datasets.cend(); ++ds) { /// downcast to FileBackedDataset for now. We could move CanRead /// up into Dataset, but there's currently no need and that doesn't /// make much sense. const std::shared_ptr fds = std::dynamic_pointer_cast(*ds); if(fds->CanRead(filename, bytes)) { return *ds; } } return std::weak_ptr(); } void DSFactory::AddReader(std::shared_ptr ds) { this->datasets.push_front(ds); } const DSFactory::DSList& DSFactory::Readers() const { return this->datasets; } } // io } // tuvok ImageVis3D-3.1.0/Tuvok/IO/QVISConverter.cpp0000644000175000017500000002006712320456500020057 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file QVISConverter.cpp \author Jens Krueger SCI Institute University of Utah \date December 2008 */ #include #include "QVISConverter.h" #include #include #include using namespace std; QVISConverter::QVISConverter() { m_vConverterDesc = "QVis Data"; m_vSupportedExt.push_back("DAT"); } bool QVISConverter::ConvertToRAW( const std::string& strSourceFilename, const std::string&, bool, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile ) { MESSAGE("Attempting to convert QVIS dataset %s", strSourceFilename.c_str()); bDeleteIntermediateFile = false; strTitle = "Qvis data"; iHeaderSkip = 0; iComponentSize = 8; iComponentCount = 1; bSigned = false; bConvertEndianess = EndianConvert::IsBigEndian(); KeyValueFileParser parser(strSourceFilename); if (parser.FileReadable()) { KeyValPair* format = parser.GetData("FORMAT"); if (format == NULL) return false; else { // The "CHAR" here is correct; QVis cannot store signed 8bit data. if(format->strValueUpper == "CHAR" || format->strValueUpper == "UCHAR" || format->strValueUpper == "BYTE") { bSigned = false; iComponentSize = 8; iComponentCount = 1; bIsFloat = false; } else if (format->strValueUpper == "SHORT") { bSigned = true; iComponentSize = 16; iComponentCount = 1; bIsFloat = false; } else if (format->strValueUpper == "USHORT") { bSigned = false; iComponentSize = 16; iComponentCount = 1; bIsFloat = false; } else if (format->strValueUpper == "FLOAT") { bSigned = true; iComponentSize = 32; iComponentCount = 1; bIsFloat = true; } else if (format->strValueUpper == "UCHAR4") { bSigned = false; iComponentSize = 8; iComponentCount = 4; bIsFloat = false; } else if(format->strValueUpper == "USHORT3") { bSigned = false; iComponentSize = 16; iComponentCount = 3; bIsFloat = false; } else if(format->strValueUpper == "USHORT4") { bSigned = false; iComponentSize = 16; iComponentCount = 4; bIsFloat = false; } } KeyValPair* objectfilename = parser.GetData("OBJECTFILENAME"); if (objectfilename == NULL) { WARNING("This is not a valid QVIS dat file."); return false; } else strIntermediateFile = objectfilename->strValue; KeyValPair* resolution = parser.GetData("RESOLUTION"); if (resolution == NULL || resolution->vuiValue.size() != 3) { WARNING("This is not a valid QVIS dat file."); return false; } else vVolumeSize = UINT64VECTOR3(resolution->vuiValue); KeyValPair* endianess = parser.GetData("ENDIANESS"); if (endianess && endianess->strValueUpper == "BIG") bConvertEndianess = !bConvertEndianess; KeyValPair* sliceThickness = parser.GetData("SLICETHICKNESS"); if (sliceThickness == NULL || sliceThickness->vuiValue.size() != 3) { WARNING("This is not a valid QVIS dat file."); vVolumeAspect = FLOATVECTOR3(1,1,1); } else { vVolumeAspect = FLOATVECTOR3(sliceThickness->vfValue); vVolumeAspect = vVolumeAspect / vVolumeAspect.maxVal(); } strIntermediateFile = SysTools::GetPath(strSourceFilename) + strIntermediateFile; } else return false; return true; } bool QVISConverter::ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize, FLOATVECTOR3 vVolumeAspect, bool bNoUserInteraction, const bool bQuantizeTo8Bit) { // compute fromat string string strFormat; if (!bQuantizeTo8Bit) { if (!bFloatingPoint && bSigned && iComponentSize == 32 && iComponentCount == 1) strFormat = "FLOAT"; else if (!bFloatingPoint && bSigned && iComponentSize == 8 && iComponentCount == 1) strFormat = "CHAR"; else if (!bFloatingPoint && !bSigned && iComponentSize == 8 && iComponentCount == 1) strFormat = "UCHAR"; else if (!bFloatingPoint && bSigned && iComponentSize == 16 && iComponentCount == 1) strFormat = "SHORT"; else if (!bFloatingPoint && !bSigned && iComponentSize == 16 && iComponentCount == 1) strFormat = "USHORT"; else if (!bFloatingPoint && !bSigned && iComponentSize == 8 && iComponentCount == 4) strFormat = "UCHAR4"; else { T_ERROR("This data type is not supported by QVIS DAT/RAW files."); return false; } } else { if (bSigned) strFormat = "CHAR"; else strFormat = "UCHAR"; } // create DAT textfile from metadata string strTargetRAWFilename = strTargetFilename+".raw"; ofstream fTarget(strTargetFilename.c_str()); if (!fTarget.is_open()) { T_ERROR("Unable to open target file %s.", strTargetFilename.c_str()); return false; } MESSAGE("Writing DAT File"); fTarget << "ObjectFileName: " << SysTools::GetFilename(strTargetRAWFilename) << endl; fTarget << "TaggedFileName: ---" << endl; fTarget << "Resolution: " << vVolumeSize.x << " " << vVolumeSize.y << " "<< vVolumeSize.z << endl; fTarget << "SliceThickness: " << vVolumeAspect.x << " " << vVolumeAspect.y << " "<< vVolumeAspect.z << endl; fTarget << "Format: " << strFormat << endl; fTarget << "ObjectType: TEXTURE_VOLUME_OBJECT" << endl; fTarget << "ObjectModel: RGBA" << endl; fTarget << "GridType: EQUIDISTANT" << endl; fTarget << "Endianess: " << (EndianConvert::IsBigEndian() ? "BIG" : "LITTLE") << endl; fTarget.close(); MESSAGE("Writing RAW File"); // copy RAW file using the parent's call bool bRAWSuccess = RAWConverter::ConvertToNative(strRawFilename, strTargetRAWFilename, iHeaderSkip, iComponentSize, iComponentCount, bSigned, bFloatingPoint, vVolumeSize, vVolumeAspect, bNoUserInteraction,bQuantizeTo8Bit); if (bRAWSuccess) { return true; } else { T_ERROR("Error creating raw target file %s.", strTargetRAWFilename.c_str()); remove(strTargetFilename.c_str()); return false; } } ImageVis3D-3.1.0/Tuvok/IO/MRCConverter.cpp0000644000175000017500000001405112320456500017712 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include "MRCConverter.h" enum DataType { IMAGE_8BIT_SIGNED = 0, // Range: [-128, 127] IMAGE_16BIT_HALFWORDS = 1, IMAGE_32BIT_REALS = 2, TRANSFORM_COMPLEX_16BIT_INTEGERS = 3, TRANSFORM_COMPLEX_32BIT_REALS = 4, IMAGE_16BIT_UNSIGNED = 6, // Range: [0, 65535] }; // Structure should be exactly 1024 bytes. #pragma pack(push, 1) struct MRCHeader { int32_t nx; // Number of columns (fastest changing in map) int32_t ny; // Number of rows int32_t nz; // Number of sections (slowest changing in map) int32_t mode; // Is the dataType enumeration int32_t nxStart; // Number of first column in map (Default = 0) int32_t nyStart; // Number of first row in map int32_t nzStart; // Number of first section in map int32_t mx; // Number of intervals along X int32_t my; // Number of intervals along Y int32_t mz; // Number of intervals along Z int32_t cellA[3]; // Cell dimensions in angstroms int32_t cellB[3]; // Cell angles in degrees int32_t mapC; // Axis corresponding to columns (1,2,3 for X,Y,Z) int32_t mapR; // Axis corresponding to rows (1,2,3 for X,Y,Z) int32_t mapS; // Axis corresponding to sections (1,2,3 for X,Y,Z) int32_t dMin; // Minimum density value int32_t dMax; // Maximum density value int32_t dMean; // Mean density value int32_t ispc; // Space group number 0 or 1 (default = 0) int32_t nSymBt; // Number of bytes used for symmetry data (0 or 80) int32_t extra[25];// Extra space used for anything int32_t origin[3];// Origin in X,Y,Z used for transforms int32_t map; // Character string 'MAP' to identify file type int32_t machSt; // Machine stamp. int32_t rms; // rms deviation of map from mean density int32_t nLabl; // Number of labels being used char textLabels[10][80]; // 10 80-character text labels }; #pragma pack(pop) MRCConverter::MRCConverter() { static_assert(sizeof(MRCHeader) == 1024, "structure must be 1024 bytes."); m_vConverterDesc = "Medical Research Council's electron density format."; m_vSupportedExt.push_back("MRC"); } bool MRCConverter::ConvertToNative( const std::string&, const std::string&, uint64_t, unsigned, uint64_t, bool, bool, UINT64VECTOR3, FLOATVECTOR3, bool, const bool) { return false; } bool MRCConverter::ConvertToRAW( const std::string& strSourceFilename, const std::string& strTempDir, bool, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string&, std::string& strIntermediateFile, bool& bDeleteIntermediateFile) { // Input file std::ifstream iFile(strSourceFilename.c_str(), std::ios::binary); if(!iFile) { T_ERROR("Could not open %s!", strSourceFilename.c_str()); return false; } MRCHeader hdr; iFile.read(reinterpret_cast(&hdr), sizeof(MRCHeader)); vVolumeSize[0] = hdr.nx; vVolumeSize[1] = hdr.ny; vVolumeSize[2] = hdr.nz; iHeaderSkip = 0; // we'll create a new, raw file. iComponentCount = 1; bConvertEndianess = true; vVolumeAspect = FLOATVECTOR3(1.0, 1.0, 1.0); strIntermediateFile = strTempDir + "/" + "mrc.iv3d.tmp"; bDeleteIntermediateFile = true; // Output file std::ofstream oFile(strIntermediateFile.c_str(), std::ios::binary); if(!oFile) { T_ERROR("Could not create intermediate file '%s'.", strIntermediateFile.c_str()); bDeleteIntermediateFile = false; return false; } // Only handling two types for now (16bit ints and 32bit floats) bool success = true; if (hdr.mode == IMAGE_16BIT_HALFWORDS) { bSigned = true; bIsFloat = false; iComponentSize = 16; // Spit out the MRC file std::copy(std::istreambuf_iterator(iFile), std::istreambuf_iterator(), std::ostreambuf_iterator(oFile)); } else if (hdr.mode == IMAGE_32BIT_REALS) { bSigned = true; bIsFloat = true; iComponentSize = 32; // Spit out the MRC file std::copy(std::istreambuf_iterator(iFile), std::istreambuf_iterator(), std::ostreambuf_iterator(oFile)); } else { success = false; // =( } return success; } bool MRCConverter::CanRead(const std::string&, const std::vector& bytes) const { /// @todo Read header and ensure 'map' corresponds to the character string /// "MAP" (assuming last byte is a null terminator). return static_cast(std::toupper(bytes[0])) == 'M' && static_cast(std::toupper(bytes[0])) == 'A' && static_cast(std::toupper(bytes[0])) == 'P'; } ImageVis3D-3.1.0/Tuvok/IO/3rdParty/0000755000175000017500000000000012320456500016404 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzma/0000755000175000017500000000000012320456500017347 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzma/LzmaDec.c0000644000175000017500000006503512320456500021043 0ustar mathieumathieu/* LzmaDec.c -- LZMA Decoder 2009-09-20 : Igor Pavlov : Public domain */ #include "LzmaDec.h" #include #define kNumTopBits 24 #define kTopValue ((UInt32)1 << kNumTopBits) #define kNumBitModelTotalBits 11 #define kBitModelTotal (1 << kNumBitModelTotalBits) #define kNumMoveBits 5 #define RC_INIT_SIZE 5 #define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); } #define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) #define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); #define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits)); #define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \ { UPDATE_0(p); i = (i + i); A0; } else \ { UPDATE_1(p); i = (i + i) + 1; A1; } #define GET_BIT(p, i) GET_BIT2(p, i, ; , ;) #define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); } #define TREE_DECODE(probs, limit, i) \ { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; } /* #define _LZMA_SIZE_OPT */ #ifdef _LZMA_SIZE_OPT #define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i) #else #define TREE_6_DECODE(probs, i) \ { i = 1; \ TREE_GET_BIT(probs, i); \ TREE_GET_BIT(probs, i); \ TREE_GET_BIT(probs, i); \ TREE_GET_BIT(probs, i); \ TREE_GET_BIT(probs, i); \ TREE_GET_BIT(probs, i); \ i -= 0x40; } #endif #define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); } #define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) #define UPDATE_0_CHECK range = bound; #define UPDATE_1_CHECK range -= bound; code -= bound; #define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \ { UPDATE_0_CHECK; i = (i + i); A0; } else \ { UPDATE_1_CHECK; i = (i + i) + 1; A1; } #define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;) #define TREE_DECODE_CHECK(probs, limit, i) \ { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; } #define kNumPosBitsMax 4 #define kNumPosStatesMax (1 << kNumPosBitsMax) #define kLenNumLowBits 3 #define kLenNumLowSymbols (1 << kLenNumLowBits) #define kLenNumMidBits 3 #define kLenNumMidSymbols (1 << kLenNumMidBits) #define kLenNumHighBits 8 #define kLenNumHighSymbols (1 << kLenNumHighBits) #define LenChoice 0 #define LenChoice2 (LenChoice + 1) #define LenLow (LenChoice2 + 1) #define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) #define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) #define kNumLenProbs (LenHigh + kLenNumHighSymbols) #define kNumStates 12 #define kNumLitStates 7 #define kStartPosModelIndex 4 #define kEndPosModelIndex 14 #define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) #define kNumPosSlotBits 6 #define kNumLenToPosStates 4 #define kNumAlignBits 4 #define kAlignTableSize (1 << kNumAlignBits) #define kMatchMinLen 2 #define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) #define IsMatch 0 #define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) #define IsRepG0 (IsRep + kNumStates) #define IsRepG1 (IsRepG0 + kNumStates) #define IsRepG2 (IsRepG1 + kNumStates) #define IsRep0Long (IsRepG2 + kNumStates) #define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) #define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) #define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) #define LenCoder (Align + kAlignTableSize) #define RepLenCoder (LenCoder + kNumLenProbs) #define Literal (RepLenCoder + kNumLenProbs) #define LZMA_BASE_SIZE 1846 #define LZMA_LIT_SIZE 768 #define LzmaProps_GetNumProbs(p) ((UInt32)LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((p)->lc + (p)->lp))) #if Literal != LZMA_BASE_SIZE StopCompilingDueBUG #endif #define LZMA_DIC_MIN (1 << 12) /* First LZMA-symbol is always decoded. And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization Out: Result: SZ_OK - OK SZ_ERROR_DATA - Error p->remainLen: < kMatchSpecLenStart : normal remain = kMatchSpecLenStart : finished = kMatchSpecLenStart + 1 : Flush marker = kMatchSpecLenStart + 2 : State Init Marker */ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit) { CLzmaProb *probs = p->probs; unsigned state = p->state; UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3]; unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1; unsigned lpMask = ((unsigned)1 << (p->prop.lp)) - 1; unsigned lc = p->prop.lc; Byte *dic = p->dic; SizeT dicBufSize = p->dicBufSize; SizeT dicPos = p->dicPos; UInt32 processedPos = p->processedPos; UInt32 checkDicSize = p->checkDicSize; unsigned len = 0; const Byte *buf = p->buf; UInt32 range = p->range; UInt32 code = p->code; do { CLzmaProb *prob; UInt32 bound; unsigned ttt; unsigned posState = processedPos & pbMask; prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; IF_BIT_0(prob) { unsigned symbol; UPDATE_0(prob); prob = probs + Literal; if (checkDicSize != 0 || processedPos != 0) prob += (LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) + (dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc)))); if (state < kNumLitStates) { state -= (state < 4) ? state : 3; symbol = 1; do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100); } else { unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; unsigned offs = 0x100; state -= (state < 10) ? 3 : 6; symbol = 1; do { unsigned bit; CLzmaProb *probLit; matchByte <<= 1; bit = (matchByte & offs); probLit = prob + offs + bit + symbol; GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit) } while (symbol < 0x100); } dic[dicPos++] = (Byte)symbol; processedPos++; continue; } else { UPDATE_1(prob); prob = probs + IsRep + state; IF_BIT_0(prob) { UPDATE_0(prob); state += kNumStates; prob = probs + LenCoder; } else { UPDATE_1(prob); if (checkDicSize == 0 && processedPos == 0) return SZ_ERROR_DATA; prob = probs + IsRepG0 + state; IF_BIT_0(prob) { UPDATE_0(prob); prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; IF_BIT_0(prob) { UPDATE_0(prob); dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; dicPos++; processedPos++; state = state < kNumLitStates ? 9 : 11; continue; } UPDATE_1(prob); } else { UInt32 distance; UPDATE_1(prob); prob = probs + IsRepG1 + state; IF_BIT_0(prob) { UPDATE_0(prob); distance = rep1; } else { UPDATE_1(prob); prob = probs + IsRepG2 + state; IF_BIT_0(prob) { UPDATE_0(prob); distance = rep2; } else { UPDATE_1(prob); distance = rep3; rep3 = rep2; } rep2 = rep1; } rep1 = rep0; rep0 = distance; } state = state < kNumLitStates ? 8 : 11; prob = probs + RepLenCoder; } { unsigned limit, offset; CLzmaProb *probLen = prob + LenChoice; IF_BIT_0(probLen) { UPDATE_0(probLen); probLen = prob + LenLow + (posState << kLenNumLowBits); offset = 0; limit = (1 << kLenNumLowBits); } else { UPDATE_1(probLen); probLen = prob + LenChoice2; IF_BIT_0(probLen) { UPDATE_0(probLen); probLen = prob + LenMid + (posState << kLenNumMidBits); offset = kLenNumLowSymbols; limit = (1 << kLenNumMidBits); } else { UPDATE_1(probLen); probLen = prob + LenHigh; offset = kLenNumLowSymbols + kLenNumMidSymbols; limit = (1 << kLenNumHighBits); } } TREE_DECODE(probLen, limit, len); len += offset; } if (state >= kNumStates) { UInt32 distance; prob = probs + PosSlot + ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits); TREE_6_DECODE(prob, distance); if (distance >= kStartPosModelIndex) { unsigned posSlot = (unsigned)distance; int numDirectBits = (int)(((distance >> 1) - 1)); distance = (2 | (distance & 1)); if (posSlot < kEndPosModelIndex) { distance <<= numDirectBits; prob = probs + SpecPos + distance - posSlot - 1; { UInt32 mask = 1; unsigned i = 1; do { GET_BIT2(prob + i, i, ; , distance |= mask); mask <<= 1; } while (--numDirectBits != 0); } } else { numDirectBits -= kNumAlignBits; do { NORMALIZE range >>= 1; { UInt32 t; code -= range; t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */ distance = (distance << 1) + (t + 1); code += range & t; } /* distance <<= 1; if (code >= range) { code -= range; distance |= 1; } */ } while (--numDirectBits != 0); prob = probs + Align; distance <<= kNumAlignBits; { unsigned i = 1; GET_BIT2(prob + i, i, ; , distance |= 1); GET_BIT2(prob + i, i, ; , distance |= 2); GET_BIT2(prob + i, i, ; , distance |= 4); GET_BIT2(prob + i, i, ; , distance |= 8); } if (distance == (UInt32)0xFFFFFFFF) { len += kMatchSpecLenStart; state -= kNumStates; break; } } } rep3 = rep2; rep2 = rep1; rep1 = rep0; rep0 = distance + 1; if (checkDicSize == 0) { if (distance >= processedPos) return SZ_ERROR_DATA; } else if (distance >= checkDicSize) return SZ_ERROR_DATA; state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3; } len += kMatchMinLen; if (limit == dicPos) return SZ_ERROR_DATA; { SizeT rem = limit - dicPos; unsigned curLen = ((rem < len) ? (unsigned)rem : len); SizeT pos = (dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0); processedPos += curLen; len -= curLen; if (pos + curLen <= dicBufSize) { Byte *dest = dic + dicPos; ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos; const Byte *lim = dest + curLen; dicPos += curLen; do *(dest) = (Byte)*(dest + src); while (++dest != lim); } else { do { dic[dicPos++] = dic[pos]; if (++pos == dicBufSize) pos = 0; } while (--curLen != 0); } } } } while (dicPos < limit && buf < bufLimit); NORMALIZE; p->buf = buf; p->range = range; p->code = code; p->remainLen = len; p->dicPos = dicPos; p->processedPos = processedPos; p->reps[0] = rep0; p->reps[1] = rep1; p->reps[2] = rep2; p->reps[3] = rep3; p->state = state; return SZ_OK; } static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit) { if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart) { Byte *dic = p->dic; SizeT dicPos = p->dicPos; SizeT dicBufSize = p->dicBufSize; unsigned len = p->remainLen; UInt32 rep0 = p->reps[0]; if (limit - dicPos < len) len = (unsigned)(limit - dicPos); if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len) p->checkDicSize = p->prop.dicSize; p->processedPos += len; p->remainLen -= len; while (len-- != 0) { dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; dicPos++; } p->dicPos = dicPos; } } static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit) { do { SizeT limit2 = limit; if (p->checkDicSize == 0) { UInt32 rem = p->prop.dicSize - p->processedPos; if (limit - p->dicPos > rem) limit2 = p->dicPos + rem; } RINOK(LzmaDec_DecodeReal(p, limit2, bufLimit)); if (p->processedPos >= p->prop.dicSize) p->checkDicSize = p->prop.dicSize; LzmaDec_WriteRem(p, limit); } while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart); if (p->remainLen > kMatchSpecLenStart) { p->remainLen = kMatchSpecLenStart; } return 0; } typedef enum { DUMMY_ERROR, /* unexpected end of input stream */ DUMMY_LIT, DUMMY_MATCH, DUMMY_REP } ELzmaDummy; static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize) { UInt32 range = p->range; UInt32 code = p->code; const Byte *bufLimit = buf + inSize; CLzmaProb *probs = p->probs; unsigned state = p->state; ELzmaDummy res; { CLzmaProb *prob; UInt32 bound; unsigned ttt; unsigned posState = (p->processedPos) & ((1 << p->prop.pb) - 1); prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; IF_BIT_0_CHECK(prob) { UPDATE_0_CHECK /* if (bufLimit - buf >= 7) return DUMMY_LIT; */ prob = probs + Literal; if (p->checkDicSize != 0 || p->processedPos != 0) prob += (LZMA_LIT_SIZE * ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) + (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc)))); if (state < kNumLitStates) { unsigned symbol = 1; do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100); } else { unsigned matchByte = p->dic[p->dicPos - p->reps[0] + ((p->dicPos < p->reps[0]) ? p->dicBufSize : 0)]; unsigned offs = 0x100; unsigned symbol = 1; do { unsigned bit; CLzmaProb *probLit; matchByte <<= 1; bit = (matchByte & offs); probLit = prob + offs + bit + symbol; GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit) } while (symbol < 0x100); } res = DUMMY_LIT; } else { unsigned len; UPDATE_1_CHECK; prob = probs + IsRep + state; IF_BIT_0_CHECK(prob) { UPDATE_0_CHECK; state = 0; prob = probs + LenCoder; res = DUMMY_MATCH; } else { UPDATE_1_CHECK; res = DUMMY_REP; prob = probs + IsRepG0 + state; IF_BIT_0_CHECK(prob) { UPDATE_0_CHECK; prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; IF_BIT_0_CHECK(prob) { UPDATE_0_CHECK; NORMALIZE_CHECK; return DUMMY_REP; } else { UPDATE_1_CHECK; } } else { UPDATE_1_CHECK; prob = probs + IsRepG1 + state; IF_BIT_0_CHECK(prob) { UPDATE_0_CHECK; } else { UPDATE_1_CHECK; prob = probs + IsRepG2 + state; IF_BIT_0_CHECK(prob) { UPDATE_0_CHECK; } else { UPDATE_1_CHECK; } } } state = kNumStates; prob = probs + RepLenCoder; } { unsigned limit, offset; CLzmaProb *probLen = prob + LenChoice; IF_BIT_0_CHECK(probLen) { UPDATE_0_CHECK; probLen = prob + LenLow + (posState << kLenNumLowBits); offset = 0; limit = 1 << kLenNumLowBits; } else { UPDATE_1_CHECK; probLen = prob + LenChoice2; IF_BIT_0_CHECK(probLen) { UPDATE_0_CHECK; probLen = prob + LenMid + (posState << kLenNumMidBits); offset = kLenNumLowSymbols; limit = 1 << kLenNumMidBits; } else { UPDATE_1_CHECK; probLen = prob + LenHigh; offset = kLenNumLowSymbols + kLenNumMidSymbols; limit = 1 << kLenNumHighBits; } } TREE_DECODE_CHECK(probLen, limit, len); len += offset; } if (state < 4) { unsigned posSlot; prob = probs + PosSlot + ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits); TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot); if (posSlot >= kStartPosModelIndex) { int numDirectBits = ((posSlot >> 1) - 1); /* if (bufLimit - buf >= 8) return DUMMY_MATCH; */ if (posSlot < kEndPosModelIndex) { prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits) - posSlot - 1; } else { numDirectBits -= kNumAlignBits; do { NORMALIZE_CHECK range >>= 1; code -= range & (((code - range) >> 31) - 1); /* if (code >= range) code -= range; */ } while (--numDirectBits != 0); prob = probs + Align; numDirectBits = kNumAlignBits; } { unsigned i = 1; do { GET_BIT_CHECK(prob + i, i); } while (--numDirectBits != 0); } } } } } NORMALIZE_CHECK; return res; } static void LzmaDec_InitRc(CLzmaDec *p, const Byte *data) { p->code = ((UInt32)data[1] << 24) | ((UInt32)data[2] << 16) | ((UInt32)data[3] << 8) | ((UInt32)data[4]); p->range = 0xFFFFFFFF; p->needFlush = 0; } void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) { p->needFlush = 1; p->remainLen = 0; p->tempBufSize = 0; if (initDic) { p->processedPos = 0; p->checkDicSize = 0; p->needInitState = 1; } if (initState) p->needInitState = 1; } void LzmaDec_Init(CLzmaDec *p) { p->dicPos = 0; LzmaDec_InitDicAndState(p, True, True); } static void LzmaDec_InitStateReal(CLzmaDec *p) { UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (p->prop.lc + p->prop.lp)); UInt32 i; CLzmaProb *probs = p->probs; for (i = 0; i < numProbs; i++) probs[i] = kBitModelTotal >> 1; p->reps[0] = p->reps[1] = p->reps[2] = p->reps[3] = 1; p->state = 0; p->needInitState = 0; } SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) { SizeT inSize = *srcLen; (*srcLen) = 0; LzmaDec_WriteRem(p, dicLimit); *status = LZMA_STATUS_NOT_SPECIFIED; while (p->remainLen != kMatchSpecLenStart) { int checkEndMarkNow; if (p->needFlush != 0) { for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--) p->tempBuf[p->tempBufSize++] = *src++; if (p->tempBufSize < RC_INIT_SIZE) { *status = LZMA_STATUS_NEEDS_MORE_INPUT; return SZ_OK; } if (p->tempBuf[0] != 0) return SZ_ERROR_DATA; LzmaDec_InitRc(p, p->tempBuf); p->tempBufSize = 0; } checkEndMarkNow = 0; if (p->dicPos >= dicLimit) { if (p->remainLen == 0 && p->code == 0) { *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK; return SZ_OK; } if (finishMode == LZMA_FINISH_ANY) { *status = LZMA_STATUS_NOT_FINISHED; return SZ_OK; } if (p->remainLen != 0) { *status = LZMA_STATUS_NOT_FINISHED; return SZ_ERROR_DATA; } checkEndMarkNow = 1; } if (p->needInitState) LzmaDec_InitStateReal(p); if (p->tempBufSize == 0) { SizeT processed; const Byte *bufLimit; if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) { int dummyRes = LzmaDec_TryDummy(p, src, inSize); if (dummyRes == DUMMY_ERROR) { memcpy(p->tempBuf, src, inSize); p->tempBufSize = (unsigned)inSize; (*srcLen) += inSize; *status = LZMA_STATUS_NEEDS_MORE_INPUT; return SZ_OK; } if (checkEndMarkNow && dummyRes != DUMMY_MATCH) { *status = LZMA_STATUS_NOT_FINISHED; return SZ_ERROR_DATA; } bufLimit = src; } else bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX; p->buf = src; if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0) return SZ_ERROR_DATA; processed = (SizeT)(p->buf - src); (*srcLen) += processed; src += processed; inSize -= processed; } else { unsigned rem = p->tempBufSize, lookAhead = 0; while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize) p->tempBuf[rem++] = src[lookAhead++]; p->tempBufSize = rem; if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) { int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem); if (dummyRes == DUMMY_ERROR) { (*srcLen) += lookAhead; *status = LZMA_STATUS_NEEDS_MORE_INPUT; return SZ_OK; } if (checkEndMarkNow && dummyRes != DUMMY_MATCH) { *status = LZMA_STATUS_NOT_FINISHED; return SZ_ERROR_DATA; } } p->buf = p->tempBuf; if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0) return SZ_ERROR_DATA; lookAhead -= (rem - (unsigned)(p->buf - p->tempBuf)); (*srcLen) += lookAhead; src += lookAhead; inSize -= lookAhead; p->tempBufSize = 0; } } if (p->code == 0) *status = LZMA_STATUS_FINISHED_WITH_MARK; return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA; } SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) { SizeT outSize = *destLen; SizeT inSize = *srcLen; *srcLen = *destLen = 0; for (;;) { SizeT inSizeCur = inSize, outSizeCur, dicPos; ELzmaFinishMode curFinishMode; SRes res; if (p->dicPos == p->dicBufSize) p->dicPos = 0; dicPos = p->dicPos; if (outSize > p->dicBufSize - dicPos) { outSizeCur = p->dicBufSize; curFinishMode = LZMA_FINISH_ANY; } else { outSizeCur = dicPos + outSize; curFinishMode = finishMode; } res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status); src += inSizeCur; inSize -= inSizeCur; *srcLen += inSizeCur; outSizeCur = p->dicPos - dicPos; memcpy(dest, p->dic + dicPos, outSizeCur); dest += outSizeCur; outSize -= outSizeCur; *destLen += outSizeCur; if (res != 0) return res; if (outSizeCur == 0 || outSize == 0) return SZ_OK; } } void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) { alloc->Free(alloc, p->probs); p->probs = 0; } static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc) { alloc->Free(alloc, p->dic); p->dic = 0; } void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc) { LzmaDec_FreeProbs(p, alloc); LzmaDec_FreeDict(p, alloc); } SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size) { UInt32 dicSize; Byte d; if (size < LZMA_PROPS_SIZE) return SZ_ERROR_UNSUPPORTED; else dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24); if (dicSize < LZMA_DIC_MIN) dicSize = LZMA_DIC_MIN; p->dicSize = dicSize; d = data[0]; if (d >= (9 * 5 * 5)) return SZ_ERROR_UNSUPPORTED; p->lc = d % 9; d /= 9; p->pb = d / 5; p->lp = d % 5; return SZ_OK; } static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc) { UInt32 numProbs = LzmaProps_GetNumProbs(propNew); if (p->probs == 0 || numProbs != p->numProbs) { LzmaDec_FreeProbs(p, alloc); p->probs = (CLzmaProb *)alloc->Alloc(alloc, numProbs * sizeof(CLzmaProb)); p->numProbs = numProbs; if (p->probs == 0) return SZ_ERROR_MEM; } return SZ_OK; } SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) { CLzmaProps propNew; RINOK(LzmaProps_Decode(&propNew, props, propsSize)); RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); p->prop = propNew; return SZ_OK; } SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) { CLzmaProps propNew; SizeT dicBufSize; RINOK(LzmaProps_Decode(&propNew, props, propsSize)); RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); dicBufSize = propNew.dicSize; if (p->dic == 0 || dicBufSize != p->dicBufSize) { LzmaDec_FreeDict(p, alloc); p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize); if (p->dic == 0) { LzmaDec_FreeProbs(p, alloc); return SZ_ERROR_MEM; } } p->dicBufSize = dicBufSize; p->prop = propNew; return SZ_OK; } SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, ELzmaStatus *status, ISzAlloc *alloc) { CLzmaDec p; SRes res; SizeT inSize = *srcLen; SizeT outSize = *destLen; *srcLen = *destLen = 0; if (inSize < RC_INIT_SIZE) return SZ_ERROR_INPUT_EOF; LzmaDec_Construct(&p); res = LzmaDec_AllocateProbs(&p, propData, propSize, alloc); if (res != 0) return res; p.dic = dest; p.dicBufSize = outSize; LzmaDec_Init(&p); *srcLen = inSize; res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status); if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT) res = SZ_ERROR_INPUT_EOF; (*destLen) = p.dicPos; LzmaDec_FreeProbs(&p, alloc); return res; } ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzma/LzmaDec.h0000644000175000017500000001532112320456500021041 0ustar mathieumathieu/* LzmaDec.h -- LZMA Decoder 2009-02-07 : Igor Pavlov : Public domain */ #ifndef __LZMA_DEC_H #define __LZMA_DEC_H #include "Types.h" #ifdef __cplusplus extern "C" { #endif /* #define _LZMA_PROB32 */ /* _LZMA_PROB32 can increase the speed on some CPUs, but memory usage for CLzmaDec::probs will be doubled in that case */ #ifdef _LZMA_PROB32 #define CLzmaProb UInt32 #else #define CLzmaProb UInt16 #endif /* ---------- LZMA Properties ---------- */ #define LZMA_PROPS_SIZE 5 typedef struct _CLzmaProps { unsigned lc, lp, pb; UInt32 dicSize; } CLzmaProps; /* LzmaProps_Decode - decodes properties Returns: SZ_OK SZ_ERROR_UNSUPPORTED - Unsupported properties */ SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size); /* ---------- LZMA Decoder state ---------- */ /* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case. Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */ #define LZMA_REQUIRED_INPUT_MAX 20 typedef struct { CLzmaProps prop; CLzmaProb *probs; Byte *dic; const Byte *buf; UInt32 range, code; SizeT dicPos; SizeT dicBufSize; UInt32 processedPos; UInt32 checkDicSize; unsigned state; UInt32 reps[4]; unsigned remainLen; int needFlush; int needInitState; UInt32 numProbs; unsigned tempBufSize; Byte tempBuf[LZMA_REQUIRED_INPUT_MAX]; } CLzmaDec; #define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; } void LzmaDec_Init(CLzmaDec *p); /* There are two types of LZMA streams: 0) Stream with end mark. That end mark adds about 6 bytes to compressed size. 1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */ typedef enum { LZMA_FINISH_ANY, /* finish at any point */ LZMA_FINISH_END /* block must be finished at the end */ } ELzmaFinishMode; /* ELzmaFinishMode has meaning only if the decoding reaches output limit !!! You must use LZMA_FINISH_END, when you know that current output buffer covers last bytes of block. In other cases you must use LZMA_FINISH_ANY. If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK, and output value of destLen will be less than output buffer size limit. You can check status result also. You can use multiple checks to test data integrity after full decompression: 1) Check Result and "status" variable. 2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize. 3) Check that output(srcLen) = compressedSize, if you know real compressedSize. You must use correct finish mode in that case. */ typedef enum { LZMA_STATUS_NOT_SPECIFIED, /* use main error code instead */ LZMA_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */ LZMA_STATUS_NOT_FINISHED, /* stream was not finished */ LZMA_STATUS_NEEDS_MORE_INPUT, /* you must provide more input bytes */ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK /* there is probability that stream was finished without end mark */ } ELzmaStatus; /* ELzmaStatus is used only as output value for function call */ /* ---------- Interfaces ---------- */ /* There are 3 levels of interfaces: 1) Dictionary Interface 2) Buffer Interface 3) One Call Interface You can select any of these interfaces, but don't mix functions from different groups for same object. */ /* There are two variants to allocate state for Dictionary Interface: 1) LzmaDec_Allocate / LzmaDec_Free 2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs You can use variant 2, if you set dictionary buffer manually. For Buffer Interface you must always use variant 1. LzmaDec_Allocate* can return: SZ_OK SZ_ERROR_MEM - Memory allocation error SZ_ERROR_UNSUPPORTED - Unsupported properties */ SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc); void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc); SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc); void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc); /* ---------- Dictionary Interface ---------- */ /* You can use it, if you want to eliminate the overhead for data copying from dictionary to some other external buffer. You must work with CLzmaDec variables directly in this interface. STEPS: LzmaDec_Constr() LzmaDec_Allocate() for (each new stream) { LzmaDec_Init() while (it needs more decompression) { LzmaDec_DecodeToDic() use data from CLzmaDec::dic and update CLzmaDec::dicPos } } LzmaDec_Free() */ /* LzmaDec_DecodeToDic The decoding to internal dictionary buffer (CLzmaDec::dic). You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!! finishMode: It has meaning only if the decoding reaches output limit (dicLimit). LZMA_FINISH_ANY - Decode just dicLimit bytes. LZMA_FINISH_END - Stream must be finished after dicLimit. Returns: SZ_OK status: LZMA_STATUS_FINISHED_WITH_MARK LZMA_STATUS_NOT_FINISHED LZMA_STATUS_NEEDS_MORE_INPUT LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK SZ_ERROR_DATA - Data error */ SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); /* ---------- Buffer Interface ---------- */ /* It's zlib-like interface. See LzmaDec_DecodeToDic description for information about STEPS and return results, but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need to work with CLzmaDec variables manually. finishMode: It has meaning only if the decoding reaches output limit (*destLen). LZMA_FINISH_ANY - Decode just destLen bytes. LZMA_FINISH_END - Stream must be finished after (*destLen). */ SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); /* ---------- One Call Interface ---------- */ /* LzmaDecode finishMode: It has meaning only if the decoding reaches output limit (*destLen). LZMA_FINISH_ANY - Decode just destLen bytes. LZMA_FINISH_END - Stream must be finished after (*destLen). Returns: SZ_OK status: LZMA_STATUS_FINISHED_WITH_MARK LZMA_STATUS_NOT_FINISHED LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK SZ_ERROR_DATA - Data error SZ_ERROR_MEM - Memory allocation error SZ_ERROR_UNSUPPORTED - Unsupported properties SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src). */ SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, ELzmaStatus *status, ISzAlloc *alloc); #ifdef __cplusplus } #endif #endif ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzma/LzFind.h0000644000175000017500000000633212320456500020712 0ustar mathieumathieu/* LzFind.h -- Match finder for LZ algorithms 2009-04-22 : Igor Pavlov : Public domain */ #ifndef __LZ_FIND_H #define __LZ_FIND_H #include "Types.h" #ifdef __cplusplus extern "C" { #endif typedef UInt32 CLzRef; typedef struct _CMatchFinder { Byte *buffer; UInt32 pos; UInt32 posLimit; UInt32 streamPos; UInt32 lenLimit; UInt32 cyclicBufferPos; UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */ UInt32 matchMaxLen; CLzRef *hash; CLzRef *son; UInt32 hashMask; UInt32 cutValue; Byte *bufferBase; ISeqInStream *stream; int streamEndWasReached; UInt32 blockSize; UInt32 keepSizeBefore; UInt32 keepSizeAfter; UInt32 numHashBytes; int directInput; size_t directInputRem; int btMode; int bigHash; UInt32 historySize; UInt32 fixedHashSize; UInt32 hashSizeSum; UInt32 numSons; SRes result; UInt32 crc[256]; } CMatchFinder; #define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer) #define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)]) #define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos) int MatchFinder_NeedMove(CMatchFinder *p); Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p); void MatchFinder_MoveBlock(CMatchFinder *p); void MatchFinder_ReadIfRequired(CMatchFinder *p); void MatchFinder_Construct(CMatchFinder *p); /* Conditions: historySize <= 3 GB keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB */ int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ISzAlloc *alloc); void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc); void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems); void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue); UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son, UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue, UInt32 *distances, UInt32 maxLen); /* Conditions: Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func. Mf_GetPointerToCurrentPos_Func's result must be used only before any other function */ typedef void (*Mf_Init_Func)(void *object); typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index); typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object); typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object); typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances); typedef void (*Mf_Skip_Func)(void *object, UInt32); typedef struct _IMatchFinder { Mf_Init_Func Init; Mf_GetIndexByte_Func GetIndexByte; Mf_GetNumAvailableBytes_Func GetNumAvailableBytes; Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos; Mf_GetMatches_Func GetMatches; Mf_Skip_Func Skip; } IMatchFinder; void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable); void MatchFinder_Init(CMatchFinder *p); UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); #ifdef __cplusplus } #endif #endif ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzma/LzmaEnc.h0000644000175000017500000000553112320456500021055 0ustar mathieumathieu/* LzmaEnc.h -- LZMA Encoder 2009-02-07 : Igor Pavlov : Public domain */ #ifndef __LZMA_ENC_H #define __LZMA_ENC_H #include "Types.h" #ifdef __cplusplus extern "C" { #endif #define LZMA_PROPS_SIZE 5 typedef struct _CLzmaEncProps { int level; /* 0 <= level <= 9 */ UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version (1 << 12) <= dictSize <= (1 << 30) for 64-bit version default = (1 << 24) */ int lc; /* 0 <= lc <= 8, default = 3 */ int lp; /* 0 <= lp <= 4, default = 0 */ int pb; /* 0 <= pb <= 4, default = 2 */ int algo; /* 0 - fast, 1 - normal, default = 1 */ int fb; /* 5 <= fb <= 273, default = 32 */ int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */ int numHashBytes; /* 2, 3 or 4, default = 4 */ UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */ unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */ int numThreads; /* 1 or 2, default = 2 */ } CLzmaEncProps; void LzmaEncProps_Init(CLzmaEncProps *p); void LzmaEncProps_Normalize(CLzmaEncProps *p); UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2); /* ---------- CLzmaEncHandle Interface ---------- */ /* LzmaEnc_* functions can return the following exit codes: Returns: SZ_OK - OK SZ_ERROR_MEM - Memory allocation error SZ_ERROR_PARAM - Incorrect paramater in props SZ_ERROR_WRITE - Write callback error. SZ_ERROR_PROGRESS - some break from progress callback SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) */ typedef void * CLzmaEncHandle; CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc); void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig); SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props); SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size); SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); /* ---------- One Call Interface ---------- */ /* LzmaEncode Return code: SZ_OK - OK SZ_ERROR_MEM - Memory allocation error SZ_ERROR_PARAM - Incorrect paramater SZ_ERROR_OUTPUT_EOF - output buffer overflow SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) */ SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); #ifdef __cplusplus } #endif #endif ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzma/7zVersion.h0000644000175000017500000000037612320456500021434 0ustar mathieumathieu#define MY_VER_MAJOR 9 #define MY_VER_MINOR 20 #define MY_VER_BUILD 0 #define MY_VERSION "9.20" #define MY_DATE "2010-11-18" #define MY_COPYRIGHT ": Igor Pavlov : Public domain" #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " : " MY_DATE ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzma/LzFind.c0000644000175000017500000004640012320456500020705 0ustar mathieumathieu/* LzFind.c -- Match finder for LZ algorithms 2009-04-22 : Igor Pavlov : Public domain */ #include #include "LzFind.h" #include "LzHash.h" #define kEmptyHashValue 0 #define kMaxValForNormalize ((UInt32)0xFFFFFFFF) #define kNormalizeStepMin (1 << 10) /* it must be power of 2 */ #define kNormalizeMask (~(kNormalizeStepMin - 1)) #define kMaxHistorySize ((UInt32)3 << 30) #define kStartMaxLen 3 static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc) { if (!p->directInput) { alloc->Free(alloc, p->bufferBase); p->bufferBase = 0; } } /* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */ static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc) { UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv; if (p->directInput) { p->blockSize = blockSize; return 1; } if (p->bufferBase == 0 || p->blockSize != blockSize) { LzInWindow_Free(p, alloc); p->blockSize = blockSize; p->bufferBase = (Byte *)alloc->Alloc(alloc, (size_t)blockSize); } return (p->bufferBase != 0); } Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; } Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; } UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; } void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue) { p->posLimit -= subValue; p->pos -= subValue; p->streamPos -= subValue; } static void MatchFinder_ReadBlock(CMatchFinder *p) { if (p->streamEndWasReached || p->result != SZ_OK) return; if (p->directInput) { UInt32 curSize = 0xFFFFFFFF - p->streamPos; if (curSize > p->directInputRem) curSize = (UInt32)p->directInputRem; p->directInputRem -= curSize; p->streamPos += curSize; if (p->directInputRem == 0) p->streamEndWasReached = 1; return; } for (;;) { Byte *dest = p->buffer + (p->streamPos - p->pos); size_t size = (p->bufferBase + p->blockSize - dest); if (size == 0) return; p->result = p->stream->Read(p->stream, dest, &size); if (p->result != SZ_OK) return; if (size == 0) { p->streamEndWasReached = 1; return; } p->streamPos += (UInt32)size; if (p->streamPos - p->pos > p->keepSizeAfter) return; } } void MatchFinder_MoveBlock(CMatchFinder *p) { memmove(p->bufferBase, p->buffer - p->keepSizeBefore, (size_t)(p->streamPos - p->pos + p->keepSizeBefore)); p->buffer = p->bufferBase + p->keepSizeBefore; } int MatchFinder_NeedMove(CMatchFinder *p) { if (p->directInput) return 0; /* if (p->streamEndWasReached) return 0; */ return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter); } void MatchFinder_ReadIfRequired(CMatchFinder *p) { if (p->streamEndWasReached) return; if (p->keepSizeAfter >= p->streamPos - p->pos) MatchFinder_ReadBlock(p); } static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p) { if (MatchFinder_NeedMove(p)) MatchFinder_MoveBlock(p); MatchFinder_ReadBlock(p); } static void MatchFinder_SetDefaultSettings(CMatchFinder *p) { p->cutValue = 32; p->btMode = 1; p->numHashBytes = 4; p->bigHash = 0; } #define kCrcPoly 0xEDB88320 void MatchFinder_Construct(CMatchFinder *p) { UInt32 i; p->bufferBase = 0; p->directInput = 0; p->hash = 0; MatchFinder_SetDefaultSettings(p); for (i = 0; i < 256; i++) { UInt32 r = i; int j; for (j = 0; j < 8; j++) r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1)); p->crc[i] = r; } } static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAlloc *alloc) { alloc->Free(alloc, p->hash); p->hash = 0; } void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc) { MatchFinder_FreeThisClassMemory(p, alloc); LzInWindow_Free(p, alloc); } static CLzRef* AllocRefs(UInt32 num, ISzAlloc *alloc) { size_t sizeInBytes = (size_t)num * sizeof(CLzRef); if (sizeInBytes / sizeof(CLzRef) != num) return 0; return (CLzRef *)alloc->Alloc(alloc, sizeInBytes); } int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ISzAlloc *alloc) { UInt32 sizeReserv; if (historySize > kMaxHistorySize) { MatchFinder_Free(p, alloc); return 0; } sizeReserv = historySize >> 1; if (historySize > ((UInt32)2 << 30)) sizeReserv = historySize >> 2; sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19); p->keepSizeBefore = historySize + keepAddBufferBefore + 1; p->keepSizeAfter = matchMaxLen + keepAddBufferAfter; /* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */ if (LzInWindow_Create(p, sizeReserv, alloc)) { UInt32 newCyclicBufferSize = historySize + 1; UInt32 hs; p->matchMaxLen = matchMaxLen; { p->fixedHashSize = 0; if (p->numHashBytes == 2) hs = (1 << 16) - 1; else { hs = historySize - 1; hs |= (hs >> 1); hs |= (hs >> 2); hs |= (hs >> 4); hs |= (hs >> 8); hs >>= 1; hs |= 0xFFFF; /* don't change it! It's required for Deflate */ if (hs > (1 << 24)) { if (p->numHashBytes == 3) hs = (1 << 24) - 1; else hs >>= 1; } } p->hashMask = hs; hs++; if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size; if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size; if (p->numHashBytes > 4) p->fixedHashSize += kHash4Size; hs += p->fixedHashSize; } { UInt32 prevSize = p->hashSizeSum + p->numSons; UInt32 newSize; p->historySize = historySize; p->hashSizeSum = hs; p->cyclicBufferSize = newCyclicBufferSize; p->numSons = (p->btMode ? newCyclicBufferSize * 2 : newCyclicBufferSize); newSize = p->hashSizeSum + p->numSons; if (p->hash != 0 && prevSize == newSize) return 1; MatchFinder_FreeThisClassMemory(p, alloc); p->hash = AllocRefs(newSize, alloc); if (p->hash != 0) { p->son = p->hash + p->hashSizeSum; return 1; } } } MatchFinder_Free(p, alloc); return 0; } static void MatchFinder_SetLimits(CMatchFinder *p) { UInt32 limit = kMaxValForNormalize - p->pos; UInt32 limit2 = p->cyclicBufferSize - p->cyclicBufferPos; if (limit2 < limit) limit = limit2; limit2 = p->streamPos - p->pos; if (limit2 <= p->keepSizeAfter) { if (limit2 > 0) limit2 = 1; } else limit2 -= p->keepSizeAfter; if (limit2 < limit) limit = limit2; { UInt32 lenLimit = p->streamPos - p->pos; if (lenLimit > p->matchMaxLen) lenLimit = p->matchMaxLen; p->lenLimit = lenLimit; } p->posLimit = p->pos + limit; } void MatchFinder_Init(CMatchFinder *p) { UInt32 i; for (i = 0; i < p->hashSizeSum; i++) p->hash[i] = kEmptyHashValue; p->cyclicBufferPos = 0; p->buffer = p->bufferBase; p->pos = p->streamPos = p->cyclicBufferSize; p->result = SZ_OK; p->streamEndWasReached = 0; MatchFinder_ReadBlock(p); MatchFinder_SetLimits(p); } static UInt32 MatchFinder_GetSubValue(CMatchFinder *p) { return (p->pos - p->historySize - 1) & kNormalizeMask; } void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems) { UInt32 i; for (i = 0; i < numItems; i++) { UInt32 value = items[i]; if (value <= subValue) value = kEmptyHashValue; else value -= subValue; items[i] = value; } } static void MatchFinder_Normalize(CMatchFinder *p) { UInt32 subValue = MatchFinder_GetSubValue(p); MatchFinder_Normalize3(subValue, p->hash, p->hashSizeSum + p->numSons); MatchFinder_ReduceOffsets(p, subValue); } static void MatchFinder_CheckLimits(CMatchFinder *p) { if (p->pos == kMaxValForNormalize) MatchFinder_Normalize(p); if (!p->streamEndWasReached && p->keepSizeAfter == p->streamPos - p->pos) MatchFinder_CheckAndMoveAndRead(p); if (p->cyclicBufferPos == p->cyclicBufferSize) p->cyclicBufferPos = 0; MatchFinder_SetLimits(p); } static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, UInt32 *distances, UInt32 maxLen) { son[_cyclicBufferPos] = curMatch; for (;;) { UInt32 delta = pos - curMatch; if (cutValue-- == 0 || delta >= _cyclicBufferSize) return distances; { const Byte *pb = cur - delta; curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)]; if (pb[maxLen] == cur[maxLen] && *pb == *cur) { UInt32 len = 0; while (++len != lenLimit) if (pb[len] != cur[len]) break; if (maxLen < len) { *distances++ = maxLen = len; *distances++ = delta - 1; if (len == lenLimit) return distances; } } } } } UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, UInt32 *distances, UInt32 maxLen) { CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; CLzRef *ptr1 = son + (_cyclicBufferPos << 1); UInt32 len0 = 0, len1 = 0; for (;;) { UInt32 delta = pos - curMatch; if (cutValue-- == 0 || delta >= _cyclicBufferSize) { *ptr0 = *ptr1 = kEmptyHashValue; return distances; } { CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); const Byte *pb = cur - delta; UInt32 len = (len0 < len1 ? len0 : len1); if (pb[len] == cur[len]) { if (++len != lenLimit && pb[len] == cur[len]) while (++len != lenLimit) if (pb[len] != cur[len]) break; if (maxLen < len) { *distances++ = maxLen = len; *distances++ = delta - 1; if (len == lenLimit) { *ptr1 = pair[0]; *ptr0 = pair[1]; return distances; } } } if (pb[len] < cur[len]) { *ptr1 = curMatch; ptr1 = pair + 1; curMatch = *ptr1; len1 = len; } else { *ptr0 = curMatch; ptr0 = pair; curMatch = *ptr0; len0 = len; } } } } static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue) { CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; CLzRef *ptr1 = son + (_cyclicBufferPos << 1); UInt32 len0 = 0, len1 = 0; for (;;) { UInt32 delta = pos - curMatch; if (cutValue-- == 0 || delta >= _cyclicBufferSize) { *ptr0 = *ptr1 = kEmptyHashValue; return; } { CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); const Byte *pb = cur - delta; UInt32 len = (len0 < len1 ? len0 : len1); if (pb[len] == cur[len]) { while (++len != lenLimit) if (pb[len] != cur[len]) break; { if (len == lenLimit) { *ptr1 = pair[0]; *ptr0 = pair[1]; return; } } } if (pb[len] < cur[len]) { *ptr1 = curMatch; ptr1 = pair + 1; curMatch = *ptr1; len1 = len; } else { *ptr0 = curMatch; ptr0 = pair; curMatch = *ptr0; len0 = len; } } } } #define MOVE_POS \ ++p->cyclicBufferPos; \ p->buffer++; \ if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p); #define MOVE_POS_RET MOVE_POS return offset; static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; } #define GET_MATCHES_HEADER2(minLen, ret_op) \ UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \ lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \ cur = p->buffer; #define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0) #define SKIP_HEADER(minLen) GET_MATCHES_HEADER2(minLen, continue) #define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue #define GET_MATCHES_FOOTER(offset, maxLen) \ offset = (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \ distances + offset, maxLen) - distances); MOVE_POS_RET; #define SKIP_FOOTER \ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS; static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) { UInt32 offset; GET_MATCHES_HEADER(2) HASH2_CALC; curMatch = p->hash[hashValue]; p->hash[hashValue] = p->pos; offset = 0; GET_MATCHES_FOOTER(offset, 1) } UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) { UInt32 offset; GET_MATCHES_HEADER(3) HASH_ZIP_CALC; curMatch = p->hash[hashValue]; p->hash[hashValue] = p->pos; offset = 0; GET_MATCHES_FOOTER(offset, 2) } static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) { UInt32 hash2Value, delta2, maxLen, offset; GET_MATCHES_HEADER(3) HASH3_CALC; delta2 = p->pos - p->hash[hash2Value]; curMatch = p->hash[kFix3HashSize + hashValue]; p->hash[hash2Value] = p->hash[kFix3HashSize + hashValue] = p->pos; maxLen = 2; offset = 0; if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) { for (; maxLen != lenLimit; maxLen++) if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) break; distances[0] = maxLen; distances[1] = delta2 - 1; offset = 2; if (maxLen == lenLimit) { SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS_RET; } } GET_MATCHES_FOOTER(offset, maxLen) } static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) { UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; GET_MATCHES_HEADER(4) HASH4_CALC; delta2 = p->pos - p->hash[ hash2Value]; delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; curMatch = p->hash[kFix4HashSize + hashValue]; p->hash[ hash2Value] = p->hash[kFix3HashSize + hash3Value] = p->hash[kFix4HashSize + hashValue] = p->pos; maxLen = 1; offset = 0; if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) { distances[0] = maxLen = 2; distances[1] = delta2 - 1; offset = 2; } if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) { maxLen = 3; distances[offset + 1] = delta3 - 1; offset += 2; delta2 = delta3; } if (offset != 0) { for (; maxLen != lenLimit; maxLen++) if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) break; distances[offset - 2] = maxLen; if (maxLen == lenLimit) { SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS_RET; } } if (maxLen < 3) maxLen = 3; GET_MATCHES_FOOTER(offset, maxLen) } static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) { UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; GET_MATCHES_HEADER(4) HASH4_CALC; delta2 = p->pos - p->hash[ hash2Value]; delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; curMatch = p->hash[kFix4HashSize + hashValue]; p->hash[ hash2Value] = p->hash[kFix3HashSize + hash3Value] = p->hash[kFix4HashSize + hashValue] = p->pos; maxLen = 1; offset = 0; if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) { distances[0] = maxLen = 2; distances[1] = delta2 - 1; offset = 2; } if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) { maxLen = 3; distances[offset + 1] = delta3 - 1; offset += 2; delta2 = delta3; } if (offset != 0) { for (; maxLen != lenLimit; maxLen++) if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) break; distances[offset - 2] = maxLen; if (maxLen == lenLimit) { p->son[p->cyclicBufferPos] = curMatch; MOVE_POS_RET; } } if (maxLen < 3) maxLen = 3; offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), distances + offset, maxLen) - (distances)); MOVE_POS_RET } UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) { UInt32 offset; GET_MATCHES_HEADER(3) HASH_ZIP_CALC; curMatch = p->hash[hashValue]; p->hash[hashValue] = p->pos; offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), distances, 2) - (distances)); MOVE_POS_RET } static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num) { do { SKIP_HEADER(2) HASH2_CALC; curMatch = p->hash[hashValue]; p->hash[hashValue] = p->pos; SKIP_FOOTER } while (--num != 0); } void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) { do { SKIP_HEADER(3) HASH_ZIP_CALC; curMatch = p->hash[hashValue]; p->hash[hashValue] = p->pos; SKIP_FOOTER } while (--num != 0); } static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num) { do { UInt32 hash2Value; SKIP_HEADER(3) HASH3_CALC; curMatch = p->hash[kFix3HashSize + hashValue]; p->hash[hash2Value] = p->hash[kFix3HashSize + hashValue] = p->pos; SKIP_FOOTER } while (--num != 0); } static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) { do { UInt32 hash2Value, hash3Value; SKIP_HEADER(4) HASH4_CALC; curMatch = p->hash[kFix4HashSize + hashValue]; p->hash[ hash2Value] = p->hash[kFix3HashSize + hash3Value] = p->pos; p->hash[kFix4HashSize + hashValue] = p->pos; SKIP_FOOTER } while (--num != 0); } static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) { do { UInt32 hash2Value, hash3Value; SKIP_HEADER(4) HASH4_CALC; curMatch = p->hash[kFix4HashSize + hashValue]; p->hash[ hash2Value] = p->hash[kFix3HashSize + hash3Value] = p->hash[kFix4HashSize + hashValue] = p->pos; p->son[p->cyclicBufferPos] = curMatch; MOVE_POS } while (--num != 0); } void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) { do { SKIP_HEADER(3) HASH_ZIP_CALC; curMatch = p->hash[hashValue]; p->hash[hashValue] = p->pos; p->son[p->cyclicBufferPos] = curMatch; MOVE_POS } while (--num != 0); } void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable) { vTable->Init = (Mf_Init_Func)MatchFinder_Init; vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte; vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes; vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos; if (!p->btMode) { vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches; vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip; } else if (p->numHashBytes == 2) { vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches; vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip; } else if (p->numHashBytes == 3) { vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches; vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip; } else { vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches; vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip; } } ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzma/Types.h0000644000175000017500000001256412320456500020634 0ustar mathieumathieu/* Types.h -- Basic types 2010-10-09 : Igor Pavlov : Public domain */ #ifndef __7Z_TYPES_H #define __7Z_TYPES_H #ifndef _7ZIP_ST #define _7ZIP_ST // disable multi threading #endif #include #ifdef _WIN32 #include #endif #ifndef EXTERN_C_BEGIN #ifdef __cplusplus #define EXTERN_C_BEGIN extern "C" { #define EXTERN_C_END } #else #define EXTERN_C_BEGIN #define EXTERN_C_END #endif #endif EXTERN_C_BEGIN #define SZ_OK 0 #define SZ_ERROR_DATA 1 #define SZ_ERROR_MEM 2 #define SZ_ERROR_CRC 3 #define SZ_ERROR_UNSUPPORTED 4 #define SZ_ERROR_PARAM 5 #define SZ_ERROR_INPUT_EOF 6 #define SZ_ERROR_OUTPUT_EOF 7 #define SZ_ERROR_READ 8 #define SZ_ERROR_WRITE 9 #define SZ_ERROR_PROGRESS 10 #define SZ_ERROR_FAIL 11 #define SZ_ERROR_THREAD 12 #define SZ_ERROR_ARCHIVE 16 #define SZ_ERROR_NO_ARCHIVE 17 typedef int SRes; #ifdef _WIN32 typedef DWORD WRes; #else typedef int WRes; #endif #ifndef RINOK #define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; } #endif typedef unsigned char Byte; typedef short Int16; typedef unsigned short UInt16; #ifdef _LZMA_UINT32_IS_ULONG typedef long Int32; typedef unsigned long UInt32; #else typedef int Int32; typedef unsigned int UInt32; #endif #ifdef _SZ_NO_INT_64 /* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers. NOTES: Some code will work incorrectly in that case! */ typedef long Int64; typedef unsigned long UInt64; #else #if defined(_MSC_VER) || defined(__BORLANDC__) typedef __int64 Int64; typedef unsigned __int64 UInt64; #define UINT64_CONST(n) n #else typedef long long int Int64; typedef unsigned long long int UInt64; #define UINT64_CONST(n) n ## ULL #endif #endif #ifdef _LZMA_NO_SYSTEM_SIZE_T typedef UInt32 SizeT; #else typedef size_t SizeT; #endif typedef int Bool; #define True 1 #define False 0 #ifdef _WIN32 #define MY_STD_CALL __stdcall #else #define MY_STD_CALL #endif #ifdef _MSC_VER #if _MSC_VER >= 1300 #define MY_NO_INLINE __declspec(noinline) #else #define MY_NO_INLINE #endif #define MY_CDECL __cdecl #define MY_FAST_CALL __fastcall #else #define MY_CDECL #define MY_FAST_CALL #endif /* The following interfaces use first parameter as pointer to structure */ typedef struct { Byte (*Read)(void *p); /* reads one byte, returns 0 in case of EOF or error */ } IByteIn; typedef struct { void (*Write)(void *p, Byte b); } IByteOut; typedef struct { SRes (*Read)(void *p, void *buf, size_t *size); /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. (output(*size) < input(*size)) is allowed */ } ISeqInStream; /* it can return SZ_ERROR_INPUT_EOF */ SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size); SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType); SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf); typedef struct { size_t (*Write)(void *p, const void *buf, size_t size); /* Returns: result - the number of actually written bytes. (result < size) means error */ } ISeqOutStream; typedef enum { SZ_SEEK_SET = 0, SZ_SEEK_CUR = 1, SZ_SEEK_END = 2 } ESzSeek; typedef struct { SRes (*Read)(void *p, void *buf, size_t *size); /* same as ISeqInStream::Read */ SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin); } ISeekInStream; typedef struct { SRes (*Look)(void *p, const void **buf, size_t *size); /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. (output(*size) > input(*size)) is not allowed (output(*size) < input(*size)) is allowed */ SRes (*Skip)(void *p, size_t offset); /* offset must be <= output(*size) of Look */ SRes (*Read)(void *p, void *buf, size_t *size); /* reads directly (without buffer). It's same as ISeqInStream::Read */ SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin); } ILookInStream; SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size); SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset); /* reads via ILookInStream::Read */ SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType); SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size); #define LookToRead_BUF_SIZE (1 << 14) typedef struct { ILookInStream s; ISeekInStream *realStream; size_t pos; size_t size; Byte buf[LookToRead_BUF_SIZE]; } CLookToRead; void LookToRead_CreateVTable(CLookToRead *p, int lookahead); void LookToRead_Init(CLookToRead *p); typedef struct { ISeqInStream s; ILookInStream *realStream; } CSecToLook; void SecToLook_CreateVTable(CSecToLook *p); typedef struct { ISeqInStream s; ILookInStream *realStream; } CSecToRead; void SecToRead_CreateVTable(CSecToRead *p); typedef struct { SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize); /* Returns: result. (result != SZ_OK) means break. Value (UInt64)(Int64)-1 for size means unknown value. */ } ICompressProgress; typedef struct { void *(*Alloc)(void *p, size_t size); void (*Free)(void *p, void *address); /* address can be 0 */ } ISzAlloc; #define IAlloc_Alloc(p, size) (p)->Alloc((p), size) #define IAlloc_Free(p, a) (p)->Free((p), a) #ifdef _WIN32 #define CHAR_PATH_SEPARATOR '\\' #define WCHAR_PATH_SEPARATOR L'\\' #define STRING_PATH_SEPARATOR "\\" #define WSTRING_PATH_SEPARATOR L"\\" #else #define CHAR_PATH_SEPARATOR '/' #define WCHAR_PATH_SEPARATOR L'/' #define STRING_PATH_SEPARATOR "/" #define WSTRING_PATH_SEPARATOR L"/" #endif EXTERN_C_END #endif ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzma/LzHash.h0000644000175000017500000000365412320456500020721 0ustar mathieumathieu/* LzHash.h -- HASH functions for LZ algorithms 2009-02-07 : Igor Pavlov : Public domain */ #ifndef __LZ_HASH_H #define __LZ_HASH_H #define kHash2Size (1 << 10) #define kHash3Size (1 << 16) #define kHash4Size (1 << 20) #define kFix3HashSize (kHash2Size) #define kFix4HashSize (kHash2Size + kHash3Size) #define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size) #define HASH2_CALC hashValue = cur[0] | ((UInt32)cur[1] << 8); #define HASH3_CALC { \ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ hash2Value = temp & (kHash2Size - 1); \ hashValue = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; } #define HASH4_CALC { \ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ hash2Value = temp & (kHash2Size - 1); \ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ hashValue = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & p->hashMask; } #define HASH5_CALC { \ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ hash2Value = temp & (kHash2Size - 1); \ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)); \ hashValue = (hash4Value ^ (p->crc[cur[4]] << 3)) & p->hashMask; \ hash4Value &= (kHash4Size - 1); } /* #define HASH_ZIP_CALC hashValue = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */ #define HASH_ZIP_CALC hashValue = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF; #define MT_HASH2_CALC \ hash2Value = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1); #define MT_HASH3_CALC { \ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ hash2Value = temp & (kHash2Size - 1); \ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); } #define MT_HASH4_CALC { \ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ hash2Value = temp & (kHash2Size - 1); \ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); } #endif ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzma/LzmaEnc.c0000644000175000017500000017203112320456500021050 0ustar mathieumathieu/* LzmaEnc.c -- LZMA Encoder 2010-04-16 : Igor Pavlov : Public domain */ #include /* #define SHOW_STAT */ /* #define SHOW_STAT2 */ #if defined(SHOW_STAT) || defined(SHOW_STAT2) #include #endif #include "LzmaEnc.h" #include "LzFind.h" #ifndef _7ZIP_ST #include "LzFindMt.h" #endif #ifdef SHOW_STAT static int ttt = 0; #endif #define kBlockSizeMax ((1 << LZMA_NUM_BLOCK_SIZE_BITS) - 1) #define kBlockSize (9 << 10) #define kUnpackBlockSize (1 << 18) #define kMatchArraySize (1 << 21) #define kMatchRecordMaxSize ((LZMA_MATCH_LEN_MAX * 2 + 3) * LZMA_MATCH_LEN_MAX) #define kNumMaxDirectBits (31) #define kNumTopBits 24 #define kTopValue ((UInt32)1 << kNumTopBits) #define kNumBitModelTotalBits 11 #define kBitModelTotal (1 << kNumBitModelTotalBits) #define kNumMoveBits 5 #define kProbInitValue (kBitModelTotal >> 1) #define kNumMoveReducingBits 4 #define kNumBitPriceShiftBits 4 #define kBitPrice (1 << kNumBitPriceShiftBits) void LzmaEncProps_Init(CLzmaEncProps *p) { p->level = 5; p->dictSize = p->mc = 0; p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1; p->writeEndMark = 0; } void LzmaEncProps_Normalize(CLzmaEncProps *p) { int level = p->level; if (level < 0) level = 5; p->level = level; if (p->dictSize == 0) p->dictSize = (level <= 5 ? (1 << (level * 2 + 14)) : (level == 6 ? (1 << 25) : (1 << 26))); if (p->lc < 0) p->lc = 3; if (p->lp < 0) p->lp = 0; if (p->pb < 0) p->pb = 2; if (p->algo < 0) p->algo = (level < 5 ? 0 : 1); if (p->fb < 0) p->fb = (level < 7 ? 32 : 64); if (p->btMode < 0) p->btMode = (p->algo == 0 ? 0 : 1); if (p->numHashBytes < 0) p->numHashBytes = 4; if (p->mc == 0) p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1); if (p->numThreads < 0) p->numThreads = #ifndef _7ZIP_ST ((p->btMode && p->algo) ? 2 : 1); #else 1; #endif } UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2) { CLzmaEncProps props = *props2; LzmaEncProps_Normalize(&props); return props.dictSize; } /* #define LZMA_LOG_BSR */ /* Define it for Intel's CPU */ #ifdef LZMA_LOG_BSR #define kDicLogSizeMaxCompress 30 #define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); } UInt32 GetPosSlot1(UInt32 pos) { UInt32 res; BSR2_RET(pos, res); return res; } #define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } #define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); } #else #define kNumLogBits (9 + (int)sizeof(size_t) / 2) #define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7) void LzmaEnc_FastPosInit(Byte *g_FastPos) { int c = 2, slotFast; g_FastPos[0] = 0; g_FastPos[1] = 1; for (slotFast = 2; slotFast < kNumLogBits * 2; slotFast++) { UInt32 k = (1 << ((slotFast >> 1) - 1)); UInt32 j; for (j = 0; j < k; j++, c++) g_FastPos[c] = (Byte)slotFast; } } #define BSR2_RET(pos, res) { UInt32 i = 6 + ((kNumLogBits - 1) & \ (0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \ res = p->g_FastPos[pos >> i] + (i * 2); } /* #define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \ p->g_FastPos[pos >> 6] + 12 : \ p->g_FastPos[pos >> (6 + kNumLogBits - 1)] + (6 + (kNumLogBits - 1)) * 2; } */ #define GetPosSlot1(pos) p->g_FastPos[pos] #define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } #define GetPosSlot(pos, res) { if (pos < kNumFullDistances) res = p->g_FastPos[pos]; else BSR2_RET(pos, res); } #endif #define LZMA_NUM_REPS 4 typedef unsigned CState; typedef struct { UInt32 price; CState state; int prev1IsChar; int prev2; UInt32 posPrev2; UInt32 backPrev2; UInt32 posPrev; UInt32 backPrev; UInt32 backs[LZMA_NUM_REPS]; } COptimal; #define kNumOpts (1 << 12) #define kNumLenToPosStates 4 #define kNumPosSlotBits 6 #define kDicLogSizeMin 0 #define kDicLogSizeMax 32 #define kDistTableSizeMax (kDicLogSizeMax * 2) #define kNumAlignBits 4 #define kAlignTableSize (1 << kNumAlignBits) #define kAlignMask (kAlignTableSize - 1) #define kStartPosModelIndex 4 #define kEndPosModelIndex 14 #define kNumPosModels (kEndPosModelIndex - kStartPosModelIndex) #define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) #ifdef _LZMA_PROB32 #define CLzmaProb UInt32 #else #define CLzmaProb UInt16 #endif #define LZMA_PB_MAX 4 #define LZMA_LC_MAX 8 #define LZMA_LP_MAX 4 #define LZMA_NUM_PB_STATES_MAX (1 << LZMA_PB_MAX) #define kLenNumLowBits 3 #define kLenNumLowSymbols (1 << kLenNumLowBits) #define kLenNumMidBits 3 #define kLenNumMidSymbols (1 << kLenNumMidBits) #define kLenNumHighBits 8 #define kLenNumHighSymbols (1 << kLenNumHighBits) #define kLenNumSymbolsTotal (kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) #define LZMA_MATCH_LEN_MIN 2 #define LZMA_MATCH_LEN_MAX (LZMA_MATCH_LEN_MIN + kLenNumSymbolsTotal - 1) #define kNumStates 12 typedef struct { CLzmaProb choice; CLzmaProb choice2; CLzmaProb low[LZMA_NUM_PB_STATES_MAX << kLenNumLowBits]; CLzmaProb mid[LZMA_NUM_PB_STATES_MAX << kLenNumMidBits]; CLzmaProb high[kLenNumHighSymbols]; } CLenEnc; typedef struct { CLenEnc p; UInt32 prices[LZMA_NUM_PB_STATES_MAX][kLenNumSymbolsTotal]; UInt32 tableSize; UInt32 counters[LZMA_NUM_PB_STATES_MAX]; } CLenPriceEnc; typedef struct { UInt32 range; Byte cache; UInt64 low; UInt64 cacheSize; Byte *buf; Byte *bufLim; Byte *bufBase; ISeqOutStream *outStream; UInt64 processed; SRes res; } CRangeEnc; typedef struct { CLzmaProb *litProbs; CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; CLzmaProb isRep[kNumStates]; CLzmaProb isRepG0[kNumStates]; CLzmaProb isRepG1[kNumStates]; CLzmaProb isRepG2[kNumStates]; CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; CLzmaProb posAlignEncoder[1 << kNumAlignBits]; CLenPriceEnc lenEnc; CLenPriceEnc repLenEnc; UInt32 reps[LZMA_NUM_REPS]; UInt32 state; } CSaveState; typedef struct { IMatchFinder matchFinder; void *matchFinderObj; #ifndef _7ZIP_ST Bool mtMode; CMatchFinderMt matchFinderMt; #endif CMatchFinder matchFinderBase; #ifndef _7ZIP_ST Byte pad[128]; #endif UInt32 optimumEndIndex; UInt32 optimumCurrentIndex; UInt32 longestMatchLength; UInt32 numPairs; UInt32 numAvail; COptimal opt[kNumOpts]; #ifndef LZMA_LOG_BSR Byte g_FastPos[1 << kNumLogBits]; #endif UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits]; UInt32 matches[LZMA_MATCH_LEN_MAX * 2 + 2 + 1]; UInt32 numFastBytes; UInt32 additionalOffset; UInt32 reps[LZMA_NUM_REPS]; UInt32 state; UInt32 posSlotPrices[kNumLenToPosStates][kDistTableSizeMax]; UInt32 distancesPrices[kNumLenToPosStates][kNumFullDistances]; UInt32 alignPrices[kAlignTableSize]; UInt32 alignPriceCount; UInt32 distTableSize; unsigned lc, lp, pb; unsigned lpMask, pbMask; CLzmaProb *litProbs; CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; CLzmaProb isRep[kNumStates]; CLzmaProb isRepG0[kNumStates]; CLzmaProb isRepG1[kNumStates]; CLzmaProb isRepG2[kNumStates]; CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; CLzmaProb posAlignEncoder[1 << kNumAlignBits]; CLenPriceEnc lenEnc; CLenPriceEnc repLenEnc; unsigned lclp; Bool fastMode; CRangeEnc rc; Bool writeEndMark; UInt64 nowPos64; UInt32 matchPriceCount; Bool finished; Bool multiThread; SRes result; UInt32 dictSize; UInt32 matchFinderCycles; int needInit; CSaveState saveState; } CLzmaEnc; void LzmaEnc_SaveState(CLzmaEncHandle pp) { CLzmaEnc *p = (CLzmaEnc *)pp; CSaveState *dest = &p->saveState; int i; dest->lenEnc = p->lenEnc; dest->repLenEnc = p->repLenEnc; dest->state = p->state; for (i = 0; i < kNumStates; i++) { memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); } for (i = 0; i < kNumLenToPosStates; i++) memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); memcpy(dest->reps, p->reps, sizeof(p->reps)); memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb)); } void LzmaEnc_RestoreState(CLzmaEncHandle pp) { CLzmaEnc *dest = (CLzmaEnc *)pp; const CSaveState *p = &dest->saveState; int i; dest->lenEnc = p->lenEnc; dest->repLenEnc = p->repLenEnc; dest->state = p->state; for (i = 0; i < kNumStates; i++) { memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); } for (i = 0; i < kNumLenToPosStates; i++) memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); memcpy(dest->reps, p->reps, sizeof(p->reps)); memcpy(dest->litProbs, p->litProbs, (0x300 << dest->lclp) * sizeof(CLzmaProb)); } SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2) { CLzmaEnc *p = (CLzmaEnc *)pp; CLzmaEncProps props = *props2; LzmaEncProps_Normalize(&props); if (props.lc > LZMA_LC_MAX || props.lp > LZMA_LP_MAX || props.pb > LZMA_PB_MAX || props.dictSize > ((UInt32)1 << kDicLogSizeMaxCompress) || props.dictSize > ((UInt32)1 << 30)) return SZ_ERROR_PARAM; p->dictSize = props.dictSize; p->matchFinderCycles = props.mc; { unsigned fb = props.fb; if (fb < 5) fb = 5; if (fb > LZMA_MATCH_LEN_MAX) fb = LZMA_MATCH_LEN_MAX; p->numFastBytes = fb; } p->lc = props.lc; p->lp = props.lp; p->pb = props.pb; p->fastMode = (props.algo == 0); p->matchFinderBase.btMode = props.btMode; { UInt32 numHashBytes = 4; if (props.btMode) { if (props.numHashBytes < 2) numHashBytes = 2; else if (props.numHashBytes < 4) numHashBytes = props.numHashBytes; } p->matchFinderBase.numHashBytes = numHashBytes; } p->matchFinderBase.cutValue = props.mc; p->writeEndMark = props.writeEndMark; #ifndef _7ZIP_ST /* if (newMultiThread != _multiThread) { ReleaseMatchFinder(); _multiThread = newMultiThread; } */ p->multiThread = (props.numThreads > 1); #endif return SZ_OK; } static const int kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5}; static const int kMatchNextStates[kNumStates] = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10}; static const int kRepNextStates[kNumStates] = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11}; static const int kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11}; #define IsCharState(s) ((s) < 7) #define GetLenToPosState(len) (((len) < kNumLenToPosStates + 1) ? (len) - 2 : kNumLenToPosStates - 1) #define kInfinityPrice (1 << 30) static void RangeEnc_Construct(CRangeEnc *p) { p->outStream = 0; p->bufBase = 0; } #define RangeEnc_GetProcessed(p) ((p)->processed + ((p)->buf - (p)->bufBase) + (p)->cacheSize) #define RC_BUF_SIZE (1 << 16) static int RangeEnc_Alloc(CRangeEnc *p, ISzAlloc *alloc) { if (p->bufBase == 0) { p->bufBase = (Byte *)alloc->Alloc(alloc, RC_BUF_SIZE); if (p->bufBase == 0) return 0; p->bufLim = p->bufBase + RC_BUF_SIZE; } return 1; } static void RangeEnc_Free(CRangeEnc *p, ISzAlloc *alloc) { alloc->Free(alloc, p->bufBase); p->bufBase = 0; } static void RangeEnc_Init(CRangeEnc *p) { /* Stream.Init(); */ p->low = 0; p->range = 0xFFFFFFFF; p->cacheSize = 1; p->cache = 0; p->buf = p->bufBase; p->processed = 0; p->res = SZ_OK; } static void RangeEnc_FlushStream(CRangeEnc *p) { size_t num; if (p->res != SZ_OK) return; num = p->buf - p->bufBase; if (num != p->outStream->Write(p->outStream, p->bufBase, num)) p->res = SZ_ERROR_WRITE; p->processed += num; p->buf = p->bufBase; } static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p) { if ((UInt32)p->low < (UInt32)0xFF000000 || (int)(p->low >> 32) != 0) { Byte temp = p->cache; do { Byte *buf = p->buf; *buf++ = (Byte)(temp + (Byte)(p->low >> 32)); p->buf = buf; if (buf == p->bufLim) RangeEnc_FlushStream(p); temp = 0xFF; } while (--p->cacheSize != 0); p->cache = (Byte)((UInt32)p->low >> 24); } p->cacheSize++; p->low = (UInt32)p->low << 8; } static void RangeEnc_FlushData(CRangeEnc *p) { int i; for (i = 0; i < 5; i++) RangeEnc_ShiftLow(p); } static void RangeEnc_EncodeDirectBits(CRangeEnc *p, UInt32 value, int numBits) { do { p->range >>= 1; p->low += p->range & (0 - ((value >> --numBits) & 1)); if (p->range < kTopValue) { p->range <<= 8; RangeEnc_ShiftLow(p); } } while (numBits != 0); } static void RangeEnc_EncodeBit(CRangeEnc *p, CLzmaProb *prob, UInt32 symbol) { UInt32 ttt = *prob; UInt32 newBound = (p->range >> kNumBitModelTotalBits) * ttt; if (symbol == 0) { p->range = newBound; ttt += (kBitModelTotal - ttt) >> kNumMoveBits; } else { p->low += newBound; p->range -= newBound; ttt -= ttt >> kNumMoveBits; } *prob = (CLzmaProb)ttt; if (p->range < kTopValue) { p->range <<= 8; RangeEnc_ShiftLow(p); } } static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol) { symbol |= 0x100; do { RangeEnc_EncodeBit(p, probs + (symbol >> 8), (symbol >> 7) & 1); symbol <<= 1; } while (symbol < 0x10000); } static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol, UInt32 matchByte) { UInt32 offs = 0x100; symbol |= 0x100; do { matchByte <<= 1; RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + (symbol >> 8)), (symbol >> 7) & 1); symbol <<= 1; offs &= ~(matchByte ^ symbol); } while (symbol < 0x10000); } void LzmaEnc_InitPriceTables(UInt32 *ProbPrices) { UInt32 i; for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits)) { const int kCyclesBits = kNumBitPriceShiftBits; UInt32 w = i; UInt32 bitCount = 0; int j; for (j = 0; j < kCyclesBits; j++) { w = w * w; bitCount <<= 1; while (w >= ((UInt32)1 << 16)) { w >>= 1; bitCount++; } } ProbPrices[i >> kNumMoveReducingBits] = ((kNumBitModelTotalBits << kCyclesBits) - 15 - bitCount); } } #define GET_PRICE(prob, symbol) \ p->ProbPrices[((prob) ^ (((-(int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; #define GET_PRICEa(prob, symbol) \ ProbPrices[((prob) ^ ((-((int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; #define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits] #define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] #define GET_PRICE_0a(prob) ProbPrices[(prob) >> kNumMoveReducingBits] #define GET_PRICE_1a(prob) ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] static UInt32 LitEnc_GetPrice(const CLzmaProb *probs, UInt32 symbol, UInt32 *ProbPrices) { UInt32 price = 0; symbol |= 0x100; do { price += GET_PRICEa(probs[symbol >> 8], (symbol >> 7) & 1); symbol <<= 1; } while (symbol < 0x10000); return price; } static UInt32 LitEnc_GetPriceMatched(const CLzmaProb *probs, UInt32 symbol, UInt32 matchByte, UInt32 *ProbPrices) { UInt32 price = 0; UInt32 offs = 0x100; symbol |= 0x100; do { matchByte <<= 1; price += GET_PRICEa(probs[offs + (matchByte & offs) + (symbol >> 8)], (symbol >> 7) & 1); symbol <<= 1; offs &= ~(matchByte ^ symbol); } while (symbol < 0x10000); return price; } static void RcTree_Encode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) { UInt32 m = 1; int i; for (i = numBitLevels; i != 0;) { UInt32 bit; i--; bit = (symbol >> i) & 1; RangeEnc_EncodeBit(rc, probs + m, bit); m = (m << 1) | bit; } } static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) { UInt32 m = 1; int i; for (i = 0; i < numBitLevels; i++) { UInt32 bit = symbol & 1; RangeEnc_EncodeBit(rc, probs + m, bit); m = (m << 1) | bit; symbol >>= 1; } } static UInt32 RcTree_GetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices) { UInt32 price = 0; symbol |= (1 << numBitLevels); while (symbol != 1) { price += GET_PRICEa(probs[symbol >> 1], symbol & 1); symbol >>= 1; } return price; } static UInt32 RcTree_ReverseGetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices) { UInt32 price = 0; UInt32 m = 1; int i; for (i = numBitLevels; i != 0; i--) { UInt32 bit = symbol & 1; symbol >>= 1; price += GET_PRICEa(probs[m], bit); m = (m << 1) | bit; } return price; } static void LenEnc_Init(CLenEnc *p) { unsigned i; p->choice = p->choice2 = kProbInitValue; for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumLowBits); i++) p->low[i] = kProbInitValue; for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumMidBits); i++) p->mid[i] = kProbInitValue; for (i = 0; i < kLenNumHighSymbols; i++) p->high[i] = kProbInitValue; } static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState) { if (symbol < kLenNumLowSymbols) { RangeEnc_EncodeBit(rc, &p->choice, 0); RcTree_Encode(rc, p->low + (posState << kLenNumLowBits), kLenNumLowBits, symbol); } else { RangeEnc_EncodeBit(rc, &p->choice, 1); if (symbol < kLenNumLowSymbols + kLenNumMidSymbols) { RangeEnc_EncodeBit(rc, &p->choice2, 0); RcTree_Encode(rc, p->mid + (posState << kLenNumMidBits), kLenNumMidBits, symbol - kLenNumLowSymbols); } else { RangeEnc_EncodeBit(rc, &p->choice2, 1); RcTree_Encode(rc, p->high, kLenNumHighBits, symbol - kLenNumLowSymbols - kLenNumMidSymbols); } } } static void LenEnc_SetPrices(CLenEnc *p, UInt32 posState, UInt32 numSymbols, UInt32 *prices, UInt32 *ProbPrices) { UInt32 a0 = GET_PRICE_0a(p->choice); UInt32 a1 = GET_PRICE_1a(p->choice); UInt32 b0 = a1 + GET_PRICE_0a(p->choice2); UInt32 b1 = a1 + GET_PRICE_1a(p->choice2); UInt32 i = 0; for (i = 0; i < kLenNumLowSymbols; i++) { if (i >= numSymbols) return; prices[i] = a0 + RcTree_GetPrice(p->low + (posState << kLenNumLowBits), kLenNumLowBits, i, ProbPrices); } for (; i < kLenNumLowSymbols + kLenNumMidSymbols; i++) { if (i >= numSymbols) return; prices[i] = b0 + RcTree_GetPrice(p->mid + (posState << kLenNumMidBits), kLenNumMidBits, i - kLenNumLowSymbols, ProbPrices); } for (; i < numSymbols; i++) prices[i] = b1 + RcTree_GetPrice(p->high, kLenNumHighBits, i - kLenNumLowSymbols - kLenNumMidSymbols, ProbPrices); } static void MY_FAST_CALL LenPriceEnc_UpdateTable(CLenPriceEnc *p, UInt32 posState, UInt32 *ProbPrices) { LenEnc_SetPrices(&p->p, posState, p->tableSize, p->prices[posState], ProbPrices); p->counters[posState] = p->tableSize; } static void LenPriceEnc_UpdateTables(CLenPriceEnc *p, UInt32 numPosStates, UInt32 *ProbPrices) { UInt32 posState; for (posState = 0; posState < numPosStates; posState++) LenPriceEnc_UpdateTable(p, posState, ProbPrices); } static void LenEnc_Encode2(CLenPriceEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState, Bool updatePrice, UInt32 *ProbPrices) { LenEnc_Encode(&p->p, rc, symbol, posState); if (updatePrice) if (--p->counters[posState] == 0) LenPriceEnc_UpdateTable(p, posState, ProbPrices); } static void MovePos(CLzmaEnc *p, UInt32 num) { #ifdef SHOW_STAT ttt += num; printf("\n MovePos %d", num); #endif if (num != 0) { p->additionalOffset += num; p->matchFinder.Skip(p->matchFinderObj, num); } } static UInt32 ReadMatchDistances(CLzmaEnc *p, UInt32 *numDistancePairsRes) { UInt32 lenRes = 0, numPairs; p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches); #ifdef SHOW_STAT printf("\n i = %d numPairs = %d ", ttt, numPairs / 2); ttt++; { UInt32 i; for (i = 0; i < numPairs; i += 2) printf("%2d %6d | ", p->matches[i], p->matches[i + 1]); } #endif if (numPairs > 0) { lenRes = p->matches[numPairs - 2]; if (lenRes == p->numFastBytes) { const Byte *pby = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; UInt32 distance = p->matches[numPairs - 1] + 1; UInt32 numAvail = p->numAvail; if (numAvail > LZMA_MATCH_LEN_MAX) numAvail = LZMA_MATCH_LEN_MAX; { const Byte *pby2 = pby - distance; for (; lenRes < numAvail && pby[lenRes] == pby2[lenRes]; lenRes++); } } } p->additionalOffset++; *numDistancePairsRes = numPairs; return lenRes; } #define MakeAsChar(p) (p)->backPrev = (UInt32)(-1); (p)->prev1IsChar = False; #define MakeAsShortRep(p) (p)->backPrev = 0; (p)->prev1IsChar = False; #define IsShortRep(p) ((p)->backPrev == 0) static UInt32 GetRepLen1Price(CLzmaEnc *p, UInt32 state, UInt32 posState) { return GET_PRICE_0(p->isRepG0[state]) + GET_PRICE_0(p->isRep0Long[state][posState]); } static UInt32 GetPureRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 state, UInt32 posState) { UInt32 price; if (repIndex == 0) { price = GET_PRICE_0(p->isRepG0[state]); price += GET_PRICE_1(p->isRep0Long[state][posState]); } else { price = GET_PRICE_1(p->isRepG0[state]); if (repIndex == 1) price += GET_PRICE_0(p->isRepG1[state]); else { price += GET_PRICE_1(p->isRepG1[state]); price += GET_PRICE(p->isRepG2[state], repIndex - 2); } } return price; } static UInt32 GetRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 len, UInt32 state, UInt32 posState) { return p->repLenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN] + GetPureRepPrice(p, repIndex, state, posState); } static UInt32 Backward(CLzmaEnc *p, UInt32 *backRes, UInt32 cur) { UInt32 posMem = p->opt[cur].posPrev; UInt32 backMem = p->opt[cur].backPrev; p->optimumEndIndex = cur; do { if (p->opt[cur].prev1IsChar) { MakeAsChar(&p->opt[posMem]) p->opt[posMem].posPrev = posMem - 1; if (p->opt[cur].prev2) { p->opt[posMem - 1].prev1IsChar = False; p->opt[posMem - 1].posPrev = p->opt[cur].posPrev2; p->opt[posMem - 1].backPrev = p->opt[cur].backPrev2; } } { UInt32 posPrev = posMem; UInt32 backCur = backMem; backMem = p->opt[posPrev].backPrev; posMem = p->opt[posPrev].posPrev; p->opt[posPrev].backPrev = backCur; p->opt[posPrev].posPrev = cur; cur = posPrev; } } while (cur != 0); *backRes = p->opt[0].backPrev; p->optimumCurrentIndex = p->opt[0].posPrev; return p->optimumCurrentIndex; } #define LIT_PROBS(pos, prevByte) (p->litProbs + ((((pos) & p->lpMask) << p->lc) + ((prevByte) >> (8 - p->lc))) * 0x300) static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes) { UInt32 numAvail, mainLen, numPairs, repMaxIndex, i, posState, lenEnd, len, cur; UInt32 matchPrice, repMatchPrice, normalMatchPrice; UInt32 reps[LZMA_NUM_REPS], repLens[LZMA_NUM_REPS]; UInt32 *matches; const Byte *data; Byte curByte, matchByte; if (p->optimumEndIndex != p->optimumCurrentIndex) { const COptimal *opt = &p->opt[p->optimumCurrentIndex]; UInt32 lenRes = opt->posPrev - p->optimumCurrentIndex; *backRes = opt->backPrev; p->optimumCurrentIndex = opt->posPrev; return lenRes; } p->optimumCurrentIndex = p->optimumEndIndex = 0; if (p->additionalOffset == 0) mainLen = ReadMatchDistances(p, &numPairs); else { mainLen = p->longestMatchLength; numPairs = p->numPairs; } numAvail = p->numAvail; if (numAvail < 2) { *backRes = (UInt32)(-1); return 1; } if (numAvail > LZMA_MATCH_LEN_MAX) numAvail = LZMA_MATCH_LEN_MAX; data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; repMaxIndex = 0; for (i = 0; i < LZMA_NUM_REPS; i++) { UInt32 lenTest; const Byte *data2; reps[i] = p->reps[i]; data2 = data - (reps[i] + 1); if (data[0] != data2[0] || data[1] != data2[1]) { repLens[i] = 0; continue; } for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); repLens[i] = lenTest; if (lenTest > repLens[repMaxIndex]) repMaxIndex = i; } if (repLens[repMaxIndex] >= p->numFastBytes) { UInt32 lenRes; *backRes = repMaxIndex; lenRes = repLens[repMaxIndex]; MovePos(p, lenRes - 1); return lenRes; } matches = p->matches; if (mainLen >= p->numFastBytes) { *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; MovePos(p, mainLen - 1); return mainLen; } curByte = *data; matchByte = *(data - (reps[0] + 1)); if (mainLen < 2 && curByte != matchByte && repLens[repMaxIndex] < 2) { *backRes = (UInt32)-1; return 1; } p->opt[0].state = (CState)p->state; posState = (position & p->pbMask); { const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); p->opt[1].price = GET_PRICE_0(p->isMatch[p->state][posState]) + (!IsCharState(p->state) ? LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : LitEnc_GetPrice(probs, curByte, p->ProbPrices)); } MakeAsChar(&p->opt[1]); matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]); repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]); if (matchByte == curByte) { UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, p->state, posState); if (shortRepPrice < p->opt[1].price) { p->opt[1].price = shortRepPrice; MakeAsShortRep(&p->opt[1]); } } lenEnd = ((mainLen >= repLens[repMaxIndex]) ? mainLen : repLens[repMaxIndex]); if (lenEnd < 2) { *backRes = p->opt[1].backPrev; return 1; } p->opt[1].posPrev = 0; for (i = 0; i < LZMA_NUM_REPS; i++) p->opt[0].backs[i] = reps[i]; len = lenEnd; do p->opt[len--].price = kInfinityPrice; while (len >= 2); for (i = 0; i < LZMA_NUM_REPS; i++) { UInt32 repLen = repLens[i]; UInt32 price; if (repLen < 2) continue; price = repMatchPrice + GetPureRepPrice(p, i, p->state, posState); do { UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][repLen - 2]; COptimal *opt = &p->opt[repLen]; if (curAndLenPrice < opt->price) { opt->price = curAndLenPrice; opt->posPrev = 0; opt->backPrev = i; opt->prev1IsChar = False; } } while (--repLen >= 2); } normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[p->state]); len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2); if (len <= mainLen) { UInt32 offs = 0; while (len > matches[offs]) offs += 2; for (; ; len++) { COptimal *opt; UInt32 distance = matches[offs + 1]; UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN]; UInt32 lenToPosState = GetLenToPosState(len); if (distance < kNumFullDistances) curAndLenPrice += p->distancesPrices[lenToPosState][distance]; else { UInt32 slot; GetPosSlot2(distance, slot); curAndLenPrice += p->alignPrices[distance & kAlignMask] + p->posSlotPrices[lenToPosState][slot]; } opt = &p->opt[len]; if (curAndLenPrice < opt->price) { opt->price = curAndLenPrice; opt->posPrev = 0; opt->backPrev = distance + LZMA_NUM_REPS; opt->prev1IsChar = False; } if (len == matches[offs]) { offs += 2; if (offs == numPairs) break; } } } cur = 0; #ifdef SHOW_STAT2 if (position >= 0) { unsigned i; printf("\n pos = %4X", position); for (i = cur; i <= lenEnd; i++) printf("\nprice[%4X] = %d", position - cur + i, p->opt[i].price); } #endif for (;;) { UInt32 numAvailFull, newLen, numPairs, posPrev, state, posState, startLen; UInt32 curPrice, curAnd1Price, matchPrice, repMatchPrice; Bool nextIsChar; Byte curByte, matchByte; const Byte *data; COptimal *curOpt; COptimal *nextOpt; cur++; if (cur == lenEnd) return Backward(p, backRes, cur); newLen = ReadMatchDistances(p, &numPairs); if (newLen >= p->numFastBytes) { p->numPairs = numPairs; p->longestMatchLength = newLen; return Backward(p, backRes, cur); } position++; curOpt = &p->opt[cur]; posPrev = curOpt->posPrev; if (curOpt->prev1IsChar) { posPrev--; if (curOpt->prev2) { state = p->opt[curOpt->posPrev2].state; if (curOpt->backPrev2 < LZMA_NUM_REPS) state = kRepNextStates[state]; else state = kMatchNextStates[state]; } else state = p->opt[posPrev].state; state = kLiteralNextStates[state]; } else state = p->opt[posPrev].state; if (posPrev == cur - 1) { if (IsShortRep(curOpt)) state = kShortRepNextStates[state]; else state = kLiteralNextStates[state]; } else { UInt32 pos; const COptimal *prevOpt; if (curOpt->prev1IsChar && curOpt->prev2) { posPrev = curOpt->posPrev2; pos = curOpt->backPrev2; state = kRepNextStates[state]; } else { pos = curOpt->backPrev; if (pos < LZMA_NUM_REPS) state = kRepNextStates[state]; else state = kMatchNextStates[state]; } prevOpt = &p->opt[posPrev]; if (pos < LZMA_NUM_REPS) { UInt32 i; reps[0] = prevOpt->backs[pos]; for (i = 1; i <= pos; i++) reps[i] = prevOpt->backs[i - 1]; for (; i < LZMA_NUM_REPS; i++) reps[i] = prevOpt->backs[i]; } else { UInt32 i; reps[0] = (pos - LZMA_NUM_REPS); for (i = 1; i < LZMA_NUM_REPS; i++) reps[i] = prevOpt->backs[i - 1]; } } curOpt->state = (CState)state; curOpt->backs[0] = reps[0]; curOpt->backs[1] = reps[1]; curOpt->backs[2] = reps[2]; curOpt->backs[3] = reps[3]; curPrice = curOpt->price; nextIsChar = False; data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; curByte = *data; matchByte = *(data - (reps[0] + 1)); posState = (position & p->pbMask); curAnd1Price = curPrice + GET_PRICE_0(p->isMatch[state][posState]); { const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); curAnd1Price += (!IsCharState(state) ? LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : LitEnc_GetPrice(probs, curByte, p->ProbPrices)); } nextOpt = &p->opt[cur + 1]; if (curAnd1Price < nextOpt->price) { nextOpt->price = curAnd1Price; nextOpt->posPrev = cur; MakeAsChar(nextOpt); nextIsChar = True; } matchPrice = curPrice + GET_PRICE_1(p->isMatch[state][posState]); repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[state]); if (matchByte == curByte && !(nextOpt->posPrev < cur && nextOpt->backPrev == 0)) { UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, state, posState); if (shortRepPrice <= nextOpt->price) { nextOpt->price = shortRepPrice; nextOpt->posPrev = cur; MakeAsShortRep(nextOpt); nextIsChar = True; } } numAvailFull = p->numAvail; { UInt32 temp = kNumOpts - 1 - cur; if (temp < numAvailFull) numAvailFull = temp; } if (numAvailFull < 2) continue; numAvail = (numAvailFull <= p->numFastBytes ? numAvailFull : p->numFastBytes); if (!nextIsChar && matchByte != curByte) /* speed optimization */ { /* try Literal + rep0 */ UInt32 temp; UInt32 lenTest2; const Byte *data2 = data - (reps[0] + 1); UInt32 limit = p->numFastBytes + 1; if (limit > numAvailFull) limit = numAvailFull; for (temp = 1; temp < limit && data[temp] == data2[temp]; temp++); lenTest2 = temp - 1; if (lenTest2 >= 2) { UInt32 state2 = kLiteralNextStates[state]; UInt32 posStateNext = (position + 1) & p->pbMask; UInt32 nextRepMatchPrice = curAnd1Price + GET_PRICE_1(p->isMatch[state2][posStateNext]) + GET_PRICE_1(p->isRep[state2]); /* for (; lenTest2 >= 2; lenTest2--) */ { UInt32 curAndLenPrice; COptimal *opt; UInt32 offset = cur + 1 + lenTest2; while (lenEnd < offset) p->opt[++lenEnd].price = kInfinityPrice; curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); opt = &p->opt[offset]; if (curAndLenPrice < opt->price) { opt->price = curAndLenPrice; opt->posPrev = cur + 1; opt->backPrev = 0; opt->prev1IsChar = True; opt->prev2 = False; } } } } startLen = 2; /* speed optimization */ { UInt32 repIndex; for (repIndex = 0; repIndex < LZMA_NUM_REPS; repIndex++) { UInt32 lenTest; UInt32 lenTestTemp; UInt32 price; const Byte *data2 = data - (reps[repIndex] + 1); if (data[0] != data2[0] || data[1] != data2[1]) continue; for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); while (lenEnd < cur + lenTest) p->opt[++lenEnd].price = kInfinityPrice; lenTestTemp = lenTest; price = repMatchPrice + GetPureRepPrice(p, repIndex, state, posState); do { UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][lenTest - 2]; COptimal *opt = &p->opt[cur + lenTest]; if (curAndLenPrice < opt->price) { opt->price = curAndLenPrice; opt->posPrev = cur; opt->backPrev = repIndex; opt->prev1IsChar = False; } } while (--lenTest >= 2); lenTest = lenTestTemp; if (repIndex == 0) startLen = lenTest + 1; /* if (_maxMode) */ { UInt32 lenTest2 = lenTest + 1; UInt32 limit = lenTest2 + p->numFastBytes; UInt32 nextRepMatchPrice; if (limit > numAvailFull) limit = numAvailFull; for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); lenTest2 -= lenTest + 1; if (lenTest2 >= 2) { UInt32 state2 = kRepNextStates[state]; UInt32 posStateNext = (position + lenTest) & p->pbMask; UInt32 curAndLenCharPrice = price + p->repLenEnc.prices[posState][lenTest - 2] + GET_PRICE_0(p->isMatch[state2][posStateNext]) + LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), data[lenTest], data2[lenTest], p->ProbPrices); state2 = kLiteralNextStates[state2]; posStateNext = (position + lenTest + 1) & p->pbMask; nextRepMatchPrice = curAndLenCharPrice + GET_PRICE_1(p->isMatch[state2][posStateNext]) + GET_PRICE_1(p->isRep[state2]); /* for (; lenTest2 >= 2; lenTest2--) */ { UInt32 curAndLenPrice; COptimal *opt; UInt32 offset = cur + lenTest + 1 + lenTest2; while (lenEnd < offset) p->opt[++lenEnd].price = kInfinityPrice; curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); opt = &p->opt[offset]; if (curAndLenPrice < opt->price) { opt->price = curAndLenPrice; opt->posPrev = cur + lenTest + 1; opt->backPrev = 0; opt->prev1IsChar = True; opt->prev2 = True; opt->posPrev2 = cur; opt->backPrev2 = repIndex; } } } } } } /* for (UInt32 lenTest = 2; lenTest <= newLen; lenTest++) */ if (newLen > numAvail) { newLen = numAvail; for (numPairs = 0; newLen > matches[numPairs]; numPairs += 2); matches[numPairs] = newLen; numPairs += 2; } if (newLen >= startLen) { UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]); UInt32 offs, curBack, posSlot; UInt32 lenTest; while (lenEnd < cur + newLen) p->opt[++lenEnd].price = kInfinityPrice; offs = 0; while (startLen > matches[offs]) offs += 2; curBack = matches[offs + 1]; GetPosSlot2(curBack, posSlot); for (lenTest = /*2*/ startLen; ; lenTest++) { UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN]; UInt32 lenToPosState = GetLenToPosState(lenTest); COptimal *opt; if (curBack < kNumFullDistances) curAndLenPrice += p->distancesPrices[lenToPosState][curBack]; else curAndLenPrice += p->posSlotPrices[lenToPosState][posSlot] + p->alignPrices[curBack & kAlignMask]; opt = &p->opt[cur + lenTest]; if (curAndLenPrice < opt->price) { opt->price = curAndLenPrice; opt->posPrev = cur; opt->backPrev = curBack + LZMA_NUM_REPS; opt->prev1IsChar = False; } if (/*_maxMode && */lenTest == matches[offs]) { /* Try Match + Literal + Rep0 */ const Byte *data2 = data - (curBack + 1); UInt32 lenTest2 = lenTest + 1; UInt32 limit = lenTest2 + p->numFastBytes; UInt32 nextRepMatchPrice; if (limit > numAvailFull) limit = numAvailFull; for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); lenTest2 -= lenTest + 1; if (lenTest2 >= 2) { UInt32 state2 = kMatchNextStates[state]; UInt32 posStateNext = (position + lenTest) & p->pbMask; UInt32 curAndLenCharPrice = curAndLenPrice + GET_PRICE_0(p->isMatch[state2][posStateNext]) + LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), data[lenTest], data2[lenTest], p->ProbPrices); state2 = kLiteralNextStates[state2]; posStateNext = (posStateNext + 1) & p->pbMask; nextRepMatchPrice = curAndLenCharPrice + GET_PRICE_1(p->isMatch[state2][posStateNext]) + GET_PRICE_1(p->isRep[state2]); /* for (; lenTest2 >= 2; lenTest2--) */ { UInt32 offset = cur + lenTest + 1 + lenTest2; UInt32 curAndLenPrice; COptimal *opt; while (lenEnd < offset) p->opt[++lenEnd].price = kInfinityPrice; curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); opt = &p->opt[offset]; if (curAndLenPrice < opt->price) { opt->price = curAndLenPrice; opt->posPrev = cur + lenTest + 1; opt->backPrev = 0; opt->prev1IsChar = True; opt->prev2 = True; opt->posPrev2 = cur; opt->backPrev2 = curBack + LZMA_NUM_REPS; } } } offs += 2; if (offs == numPairs) break; curBack = matches[offs + 1]; if (curBack >= kNumFullDistances) GetPosSlot2(curBack, posSlot); } } } } } #define ChangePair(smallDist, bigDist) (((bigDist) >> 7) > (smallDist)) static UInt32 GetOptimumFast(CLzmaEnc *p, UInt32 *backRes) { UInt32 numAvail, mainLen, mainDist, numPairs, repIndex, repLen, i; const Byte *data; const UInt32 *matches; if (p->additionalOffset == 0) mainLen = ReadMatchDistances(p, &numPairs); else { mainLen = p->longestMatchLength; numPairs = p->numPairs; } numAvail = p->numAvail; *backRes = (UInt32)-1; if (numAvail < 2) return 1; if (numAvail > LZMA_MATCH_LEN_MAX) numAvail = LZMA_MATCH_LEN_MAX; data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; repLen = repIndex = 0; for (i = 0; i < LZMA_NUM_REPS; i++) { UInt32 len; const Byte *data2 = data - (p->reps[i] + 1); if (data[0] != data2[0] || data[1] != data2[1]) continue; for (len = 2; len < numAvail && data[len] == data2[len]; len++); if (len >= p->numFastBytes) { *backRes = i; MovePos(p, len - 1); return len; } if (len > repLen) { repIndex = i; repLen = len; } } matches = p->matches; if (mainLen >= p->numFastBytes) { *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; MovePos(p, mainLen - 1); return mainLen; } mainDist = 0; /* for GCC */ if (mainLen >= 2) { mainDist = matches[numPairs - 1]; while (numPairs > 2 && mainLen == matches[numPairs - 4] + 1) { if (!ChangePair(matches[numPairs - 3], mainDist)) break; numPairs -= 2; mainLen = matches[numPairs - 2]; mainDist = matches[numPairs - 1]; } if (mainLen == 2 && mainDist >= 0x80) mainLen = 1; } if (repLen >= 2 && ( (repLen + 1 >= mainLen) || (repLen + 2 >= mainLen && mainDist >= (1 << 9)) || (repLen + 3 >= mainLen && mainDist >= (1 << 15)))) { *backRes = repIndex; MovePos(p, repLen - 1); return repLen; } if (mainLen < 2 || numAvail <= 2) return 1; p->longestMatchLength = ReadMatchDistances(p, &p->numPairs); if (p->longestMatchLength >= 2) { UInt32 newDistance = matches[p->numPairs - 1]; if ((p->longestMatchLength >= mainLen && newDistance < mainDist) || (p->longestMatchLength == mainLen + 1 && !ChangePair(mainDist, newDistance)) || (p->longestMatchLength > mainLen + 1) || (p->longestMatchLength + 1 >= mainLen && mainLen >= 3 && ChangePair(newDistance, mainDist))) return 1; } data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; for (i = 0; i < LZMA_NUM_REPS; i++) { UInt32 len, limit; const Byte *data2 = data - (p->reps[i] + 1); if (data[0] != data2[0] || data[1] != data2[1]) continue; limit = mainLen - 1; for (len = 2; len < limit && data[len] == data2[len]; len++); if (len >= limit) return 1; } *backRes = mainDist + LZMA_NUM_REPS; MovePos(p, mainLen - 2); return mainLen; } static void WriteEndMarker(CLzmaEnc *p, UInt32 posState) { UInt32 len; RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); p->state = kMatchNextStates[p->state]; len = LZMA_MATCH_LEN_MIN; LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, (1 << kNumPosSlotBits) - 1); RangeEnc_EncodeDirectBits(&p->rc, (((UInt32)1 << 30) - 1) >> kNumAlignBits, 30 - kNumAlignBits); RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, kAlignMask); } static SRes CheckErrors(CLzmaEnc *p) { if (p->result != SZ_OK) return p->result; if (p->rc.res != SZ_OK) p->result = SZ_ERROR_WRITE; if (p->matchFinderBase.result != SZ_OK) p->result = SZ_ERROR_READ; if (p->result != SZ_OK) p->finished = True; return p->result; } static SRes Flush(CLzmaEnc *p, UInt32 nowPos) { /* ReleaseMFStream(); */ p->finished = True; if (p->writeEndMark) WriteEndMarker(p, nowPos & p->pbMask); RangeEnc_FlushData(&p->rc); RangeEnc_FlushStream(&p->rc); return CheckErrors(p); } static void FillAlignPrices(CLzmaEnc *p) { UInt32 i; for (i = 0; i < kAlignTableSize; i++) p->alignPrices[i] = RcTree_ReverseGetPrice(p->posAlignEncoder, kNumAlignBits, i, p->ProbPrices); p->alignPriceCount = 0; } static void FillDistancesPrices(CLzmaEnc *p) { UInt32 tempPrices[kNumFullDistances]; UInt32 i, lenToPosState; for (i = kStartPosModelIndex; i < kNumFullDistances; i++) { UInt32 posSlot = GetPosSlot1(i); UInt32 footerBits = ((posSlot >> 1) - 1); UInt32 base = ((2 | (posSlot & 1)) << footerBits); tempPrices[i] = RcTree_ReverseGetPrice(p->posEncoders + base - posSlot - 1, footerBits, i - base, p->ProbPrices); } for (lenToPosState = 0; lenToPosState < kNumLenToPosStates; lenToPosState++) { UInt32 posSlot; const CLzmaProb *encoder = p->posSlotEncoder[lenToPosState]; UInt32 *posSlotPrices = p->posSlotPrices[lenToPosState]; for (posSlot = 0; posSlot < p->distTableSize; posSlot++) posSlotPrices[posSlot] = RcTree_GetPrice(encoder, kNumPosSlotBits, posSlot, p->ProbPrices); for (posSlot = kEndPosModelIndex; posSlot < p->distTableSize; posSlot++) posSlotPrices[posSlot] += ((((posSlot >> 1) - 1) - kNumAlignBits) << kNumBitPriceShiftBits); { UInt32 *distancesPrices = p->distancesPrices[lenToPosState]; UInt32 i; for (i = 0; i < kStartPosModelIndex; i++) distancesPrices[i] = posSlotPrices[i]; for (; i < kNumFullDistances; i++) distancesPrices[i] = posSlotPrices[GetPosSlot1(i)] + tempPrices[i]; } } p->matchPriceCount = 0; } void LzmaEnc_Construct(CLzmaEnc *p) { RangeEnc_Construct(&p->rc); MatchFinder_Construct(&p->matchFinderBase); #ifndef _7ZIP_ST MatchFinderMt_Construct(&p->matchFinderMt); p->matchFinderMt.MatchFinder = &p->matchFinderBase; #endif { CLzmaEncProps props; LzmaEncProps_Init(&props); LzmaEnc_SetProps(p, &props); } #ifndef LZMA_LOG_BSR LzmaEnc_FastPosInit(p->g_FastPos); #endif LzmaEnc_InitPriceTables(p->ProbPrices); p->litProbs = 0; p->saveState.litProbs = 0; } CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc) { void *p; p = alloc->Alloc(alloc, sizeof(CLzmaEnc)); if (p != 0) LzmaEnc_Construct((CLzmaEnc *)p); return p; } void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc) { alloc->Free(alloc, p->litProbs); alloc->Free(alloc, p->saveState.litProbs); p->litProbs = 0; p->saveState.litProbs = 0; } void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) { #ifndef _7ZIP_ST MatchFinderMt_Destruct(&p->matchFinderMt, allocBig); #endif MatchFinder_Free(&p->matchFinderBase, allocBig); LzmaEnc_FreeLits(p, alloc); RangeEnc_Free(&p->rc, alloc); } void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig) { LzmaEnc_Destruct((CLzmaEnc *)p, alloc, allocBig); alloc->Free(alloc, p); } static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize, UInt32 maxUnpackSize) { UInt32 nowPos32, startPos32; if (p->needInit) { p->matchFinder.Init(p->matchFinderObj); p->needInit = 0; } if (p->finished) return p->result; RINOK(CheckErrors(p)); nowPos32 = (UInt32)p->nowPos64; startPos32 = nowPos32; if (p->nowPos64 == 0) { UInt32 numPairs; Byte curByte; if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) return Flush(p, nowPos32); ReadMatchDistances(p, &numPairs); RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][0], 0); p->state = kLiteralNextStates[p->state]; curByte = p->matchFinder.GetIndexByte(p->matchFinderObj, 0 - p->additionalOffset); LitEnc_Encode(&p->rc, p->litProbs, curByte); p->additionalOffset--; nowPos32++; } if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) != 0) for (;;) { UInt32 pos, len, posState; if (p->fastMode) len = GetOptimumFast(p, &pos); else len = GetOptimum(p, nowPos32, &pos); #ifdef SHOW_STAT2 printf("\n pos = %4X, len = %d pos = %d", nowPos32, len, pos); #endif posState = nowPos32 & p->pbMask; if (len == 1 && pos == (UInt32)-1) { Byte curByte; CLzmaProb *probs; const Byte *data; RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 0); data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; curByte = *data; probs = LIT_PROBS(nowPos32, *(data - 1)); if (IsCharState(p->state)) LitEnc_Encode(&p->rc, probs, curByte); else LitEnc_EncodeMatched(&p->rc, probs, curByte, *(data - p->reps[0] - 1)); p->state = kLiteralNextStates[p->state]; } else { RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); if (pos < LZMA_NUM_REPS) { RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 1); if (pos == 0) { RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 0); RangeEnc_EncodeBit(&p->rc, &p->isRep0Long[p->state][posState], ((len == 1) ? 0 : 1)); } else { UInt32 distance = p->reps[pos]; RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 1); if (pos == 1) RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 0); else { RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 1); RangeEnc_EncodeBit(&p->rc, &p->isRepG2[p->state], pos - 2); if (pos == 3) p->reps[3] = p->reps[2]; p->reps[2] = p->reps[1]; } p->reps[1] = p->reps[0]; p->reps[0] = distance; } if (len == 1) p->state = kShortRepNextStates[p->state]; else { LenEnc_Encode2(&p->repLenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); p->state = kRepNextStates[p->state]; } } else { UInt32 posSlot; RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); p->state = kMatchNextStates[p->state]; LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); pos -= LZMA_NUM_REPS; GetPosSlot(pos, posSlot); RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot); if (posSlot >= kStartPosModelIndex) { UInt32 footerBits = ((posSlot >> 1) - 1); UInt32 base = ((2 | (posSlot & 1)) << footerBits); UInt32 posReduced = pos - base; if (posSlot < kEndPosModelIndex) RcTree_ReverseEncode(&p->rc, p->posEncoders + base - posSlot - 1, footerBits, posReduced); else { RangeEnc_EncodeDirectBits(&p->rc, posReduced >> kNumAlignBits, footerBits - kNumAlignBits); RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, posReduced & kAlignMask); p->alignPriceCount++; } } p->reps[3] = p->reps[2]; p->reps[2] = p->reps[1]; p->reps[1] = p->reps[0]; p->reps[0] = pos; p->matchPriceCount++; } } p->additionalOffset -= len; nowPos32 += len; if (p->additionalOffset == 0) { UInt32 processed; if (!p->fastMode) { if (p->matchPriceCount >= (1 << 7)) FillDistancesPrices(p); if (p->alignPriceCount >= kAlignTableSize) FillAlignPrices(p); } if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) break; processed = nowPos32 - startPos32; if (useLimits) { if (processed + kNumOpts + 300 >= maxUnpackSize || RangeEnc_GetProcessed(&p->rc) + kNumOpts * 2 >= maxPackSize) break; } else if (processed >= (1 << 15)) { p->nowPos64 += nowPos32 - startPos32; return CheckErrors(p); } } } p->nowPos64 += nowPos32 - startPos32; return Flush(p, nowPos32); } #define kBigHashDicLimit ((UInt32)1 << 24) static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) { UInt32 beforeSize = kNumOpts; Bool btMode; if (!RangeEnc_Alloc(&p->rc, alloc)) return SZ_ERROR_MEM; btMode = (p->matchFinderBase.btMode != 0); #ifndef _7ZIP_ST p->mtMode = (p->multiThread && !p->fastMode && btMode); #endif { unsigned lclp = p->lc + p->lp; if (p->litProbs == 0 || p->saveState.litProbs == 0 || p->lclp != lclp) { LzmaEnc_FreeLits(p, alloc); p->litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb)); p->saveState.litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb)); if (p->litProbs == 0 || p->saveState.litProbs == 0) { LzmaEnc_FreeLits(p, alloc); return SZ_ERROR_MEM; } p->lclp = lclp; } } p->matchFinderBase.bigHash = (p->dictSize > kBigHashDicLimit); if (beforeSize + p->dictSize < keepWindowSize) beforeSize = keepWindowSize - p->dictSize; #ifndef _7ZIP_ST if (p->mtMode) { RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)); p->matchFinderObj = &p->matchFinderMt; MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder); } else #endif { if (!MatchFinder_Create(&p->matchFinderBase, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)) return SZ_ERROR_MEM; p->matchFinderObj = &p->matchFinderBase; MatchFinder_CreateVTable(&p->matchFinderBase, &p->matchFinder); } return SZ_OK; } void LzmaEnc_Init(CLzmaEnc *p) { UInt32 i; p->state = 0; for (i = 0 ; i < LZMA_NUM_REPS; i++) p->reps[i] = 0; RangeEnc_Init(&p->rc); for (i = 0; i < kNumStates; i++) { UInt32 j; for (j = 0; j < LZMA_NUM_PB_STATES_MAX; j++) { p->isMatch[i][j] = kProbInitValue; p->isRep0Long[i][j] = kProbInitValue; } p->isRep[i] = kProbInitValue; p->isRepG0[i] = kProbInitValue; p->isRepG1[i] = kProbInitValue; p->isRepG2[i] = kProbInitValue; } { UInt32 num = 0x300 << (p->lp + p->lc); for (i = 0; i < num; i++) p->litProbs[i] = kProbInitValue; } { for (i = 0; i < kNumLenToPosStates; i++) { CLzmaProb *probs = p->posSlotEncoder[i]; UInt32 j; for (j = 0; j < (1 << kNumPosSlotBits); j++) probs[j] = kProbInitValue; } } { for (i = 0; i < kNumFullDistances - kEndPosModelIndex; i++) p->posEncoders[i] = kProbInitValue; } LenEnc_Init(&p->lenEnc.p); LenEnc_Init(&p->repLenEnc.p); for (i = 0; i < (1 << kNumAlignBits); i++) p->posAlignEncoder[i] = kProbInitValue; p->optimumEndIndex = 0; p->optimumCurrentIndex = 0; p->additionalOffset = 0; p->pbMask = (1 << p->pb) - 1; p->lpMask = (1 << p->lp) - 1; } void LzmaEnc_InitPrices(CLzmaEnc *p) { if (!p->fastMode) { FillDistancesPrices(p); FillAlignPrices(p); } p->lenEnc.tableSize = p->repLenEnc.tableSize = p->numFastBytes + 1 - LZMA_MATCH_LEN_MIN; LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, p->ProbPrices); LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, p->ProbPrices); } static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) { UInt32 i; for (i = 0; i < (UInt32)kDicLogSizeMaxCompress; i++) if (p->dictSize <= ((UInt32)1 << i)) break; p->distTableSize = i * 2; p->finished = False; p->result = SZ_OK; RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig)); LzmaEnc_Init(p); LzmaEnc_InitPrices(p); p->nowPos64 = 0; return SZ_OK; } static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ISzAlloc *alloc, ISzAlloc *allocBig) { CLzmaEnc *p = (CLzmaEnc *)pp; p->matchFinderBase.stream = inStream; p->needInit = 1; p->rc.outStream = outStream; return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig); } SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, ISeqInStream *inStream, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) { CLzmaEnc *p = (CLzmaEnc *)pp; p->matchFinderBase.stream = inStream; p->needInit = 1; return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); } static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen) { p->matchFinderBase.directInput = 1; p->matchFinderBase.bufferBase = (Byte *)src; p->matchFinderBase.directInputRem = srcLen; } SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) { CLzmaEnc *p = (CLzmaEnc *)pp; LzmaEnc_SetInputBuf(p, src, srcLen); p->needInit = 1; return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); } void LzmaEnc_Finish(CLzmaEncHandle pp) { #ifndef _7ZIP_ST CLzmaEnc *p = (CLzmaEnc *)pp; if (p->mtMode) MatchFinderMt_ReleaseStream(&p->matchFinderMt); #else pp = pp; #endif } typedef struct { ISeqOutStream funcTable; Byte *data; SizeT rem; Bool overflow; } CSeqOutStreamBuf; static size_t MyWrite(void *pp, const void *data, size_t size) { CSeqOutStreamBuf *p = (CSeqOutStreamBuf *)pp; if (p->rem < size) { size = p->rem; p->overflow = True; } memcpy(p->data, data, size); p->rem -= size; p->data += size; return size; } UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp) { const CLzmaEnc *p = (CLzmaEnc *)pp; return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); } const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp) { const CLzmaEnc *p = (CLzmaEnc *)pp; return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; } SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize) { CLzmaEnc *p = (CLzmaEnc *)pp; UInt64 nowPos64; SRes res; CSeqOutStreamBuf outStream; outStream.funcTable.Write = MyWrite; outStream.data = dest; outStream.rem = *destLen; outStream.overflow = False; p->writeEndMark = False; p->finished = False; p->result = SZ_OK; if (reInit) LzmaEnc_Init(p); LzmaEnc_InitPrices(p); nowPos64 = p->nowPos64; RangeEnc_Init(&p->rc); p->rc.outStream = &outStream.funcTable; res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize); *unpackSize = (UInt32)(p->nowPos64 - nowPos64); *destLen -= outStream.rem; if (outStream.overflow) return SZ_ERROR_OUTPUT_EOF; return res; } static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress) { SRes res = SZ_OK; #ifndef _7ZIP_ST Byte allocaDummy[0x300]; int i = 0; for (i = 0; i < 16; i++) allocaDummy[i] = (Byte)i; #endif for (;;) { res = LzmaEnc_CodeOneBlock(p, False, 0, 0); if (res != SZ_OK || p->finished != 0) break; if (progress != 0) { res = progress->Progress(progress, p->nowPos64, RangeEnc_GetProcessed(&p->rc)); if (res != SZ_OK) { res = SZ_ERROR_PROGRESS; break; } } } LzmaEnc_Finish(p); return res; } SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) { RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig)); return LzmaEnc_Encode2((CLzmaEnc *)pp, progress); } SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size) { CLzmaEnc *p = (CLzmaEnc *)pp; int i; UInt32 dictSize = p->dictSize; if (*size < LZMA_PROPS_SIZE) return SZ_ERROR_PARAM; *size = LZMA_PROPS_SIZE; props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc); for (i = 11; i <= 30; i++) { if (dictSize <= ((UInt32)2 << i)) { dictSize = (2 << i); break; } if (dictSize <= ((UInt32)3 << i)) { dictSize = (3 << i); break; } } for (i = 0; i < 4; i++) props[1 + i] = (Byte)(dictSize >> (8 * i)); return SZ_OK; } SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) { SRes res; CLzmaEnc *p = (CLzmaEnc *)pp; CSeqOutStreamBuf outStream; LzmaEnc_SetInputBuf(p, src, srcLen); outStream.funcTable.Write = MyWrite; outStream.data = dest; outStream.rem = *destLen; outStream.overflow = False; p->writeEndMark = writeEndMark; p->rc.outStream = &outStream.funcTable; res = LzmaEnc_MemPrepare(pp, src, srcLen, 0, alloc, allocBig); if (res == SZ_OK) res = LzmaEnc_Encode2(p, progress); *destLen -= outStream.rem; if (outStream.overflow) return SZ_ERROR_OUTPUT_EOF; return res; } SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) { CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc); SRes res; if (p == 0) return SZ_ERROR_MEM; res = LzmaEnc_SetProps(p, props); if (res == SZ_OK) { res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize); if (res == SZ_OK) res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen, writeEndMark, progress, alloc, allocBig); } LzmaEnc_Destroy(p, alloc, allocBig); return res; } ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/0000755000175000017500000000000012320456500020106 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/0000755000175000017500000000000012320456500021610 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/LinkedList.cpp0000644000175000017500000000611612320456500024362 0ustar mathieumathieu#ifndef __cxxtest__LinkedList_cpp__ #define __cxxtest__LinkedList_cpp__ #include namespace CxxTest { List GlobalFixture::_list = { 0, 0 }; List RealSuiteDescription::_suites = { 0, 0 }; void List::initialize() { _head = _tail = 0; } Link *List::head() { Link *l = _head; while ( l && !l->active() ) l = l->next(); return l; } const Link *List::head() const { Link *l = _head; while ( l && !l->active() ) l = l->next(); return l; } Link *List::tail() { Link *l = _tail; while ( l && !l->active() ) l = l->prev(); return l; } const Link *List::tail() const { Link *l = _tail; while ( l && !l->active() ) l = l->prev(); return l; } bool List::empty() const { return (_head == 0); } unsigned List::size() const { unsigned count = 0; for ( const Link *l = head(); l != 0; l = l->next() ) ++ count; return count; } Link *List::nth( unsigned n ) { Link *l = head(); while ( n -- ) l = l->next(); return l; } void List::activateAll() { for ( Link *l = _head; l != 0; l = l->justNext() ) l->setActive( true ); } void List::leaveOnly( const Link &link ) { for ( Link *l = head(); l != 0; l = l->next() ) if ( l != &link ) l->setActive( false ); } Link::Link() : _next( 0 ), _prev( 0 ), _active( true ) { } Link::~Link() { } bool Link::active() const { return _active; } void Link::setActive( bool value ) { _active = value; } Link * Link::justNext() { return _next; } Link * Link::justPrev() { return _prev; } Link * Link::next() { Link *l = _next; while ( l && !l->_active ) l = l->_next; return l; } Link * Link::prev() { Link *l = _prev; while ( l && !l->_active ) l = l->_prev; return l; } const Link * Link::next() const { Link *l = _next; while ( l && !l->_active ) l = l->_next; return l; } const Link * Link::prev() const { Link *l = _prev; while ( l && !l->_active ) l = l->_prev; return l; } void Link::attach( List &l ) { if ( l._tail ) l._tail->_next = this; _prev = l._tail; _next = 0; if ( l._head == 0 ) l._head = this; l._tail = this; } void Link::detach( List &l ) { if ( _prev ) _prev->_next = _next; else l._head = _next; if ( _next ) _next->_prev = _prev; else l._tail = _prev; } }; #endif // __cxxtest__LinkedList_cpp__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/YesNoRunner.h0000644000175000017500000000104212320456500024205 0ustar mathieumathieu#ifndef __cxxtest__YesNoRunner_h__ #define __cxxtest__YesNoRunner_h__ // // The YesNoRunner is a simple TestListener that // just returns true iff all tests passed. // #include #include namespace CxxTest { class YesNoRunner : public TestListener { public: YesNoRunner() { } int run() { TestRunner::runAllTests( *this ); return tracker().failedTests(); } }; } #endif // __cxxtest__YesNoRunner_h__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/TestRunner.h0000644000175000017500000000635412320456500024102 0ustar mathieumathieu#ifndef __cxxtest_TestRunner_h__ #define __cxxtest_TestRunner_h__ // // TestRunner is the class that runs all the tests. // To use it, create an object that implements the TestListener // interface and call TestRunner::runAllTests( myListener ); // #include #include #include #include namespace CxxTest { class TestRunner { public: static void runAllTests( TestListener &listener ) { tracker().setListener( &listener ); _TS_TRY { TestRunner().runWorld(); } _TS_LAST_CATCH( { tracker().failedTest( __FILE__, __LINE__, "Exception thrown from world" ); } ); tracker().setListener( 0 ); } static void runAllTests( TestListener *listener ) { if ( listener ) { listener->warning( __FILE__, __LINE__, "Deprecated; Use runAllTests( TestListener & )" ); runAllTests( *listener ); } } private: void runWorld() { RealWorldDescription wd; WorldGuard sg; tracker().enterWorld( wd ); if ( wd.setUp() ) { for ( SuiteDescription *sd = wd.firstSuite(); sd; sd = sd->next() ) if ( sd->active() ) runSuite( *sd ); wd.tearDown(); } tracker().leaveWorld( wd ); } void runSuite( SuiteDescription &sd ) { StateGuard sg; tracker().enterSuite( sd ); if ( sd.setUp() ) { for ( TestDescription *td = sd.firstTest(); td; td = td->next() ) if ( td->active() ) runTest( *td ); sd.tearDown(); } tracker().leaveSuite( sd ); } void runTest( TestDescription &td ) { StateGuard sg; tracker().enterTest( td ); if ( td.setUp() ) { td.run(); td.tearDown(); } tracker().leaveTest( td ); } class StateGuard { #ifdef _CXXTEST_HAVE_EH bool _abortTestOnFail; #endif // _CXXTEST_HAVE_EH unsigned _maxDumpSize; public: StateGuard() { #ifdef _CXXTEST_HAVE_EH _abortTestOnFail = abortTestOnFail(); #endif // _CXXTEST_HAVE_EH _maxDumpSize = maxDumpSize(); } ~StateGuard() { #ifdef _CXXTEST_HAVE_EH setAbortTestOnFail( _abortTestOnFail ); #endif // _CXXTEST_HAVE_EH setMaxDumpSize( _maxDumpSize ); } }; class WorldGuard : public StateGuard { public: WorldGuard() : StateGuard() { #ifdef _CXXTEST_HAVE_EH setAbortTestOnFail( CXXTEST_DEFAULT_ABORT ); #endif // _CXXTEST_HAVE_EH setMaxDumpSize( CXXTEST_MAX_DUMP_SIZE ); } }; }; // // For --no-static-init // void initialize(); }; #endif // __cxxtest_TestRunner_h__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/Flags.h0000644000175000017500000000704112320456500023017 0ustar mathieumathieu#ifndef __cxxtest__Flags_h__ #define __cxxtest__Flags_h__ // // These are the flags that control CxxTest // #if !defined(CXXTEST_FLAGS) # define CXXTEST_FLAGS #endif // !CXXTEST_FLAGS #if defined(CXXTEST_HAVE_EH) && !defined(_CXXTEST_HAVE_EH) # define _CXXTEST_HAVE_EH #endif // CXXTEST_HAVE_EH #if defined(CXXTEST_HAVE_STD) && !defined(_CXXTEST_HAVE_STD) # define _CXXTEST_HAVE_STD #endif // CXXTEST_HAVE_STD #if defined(CXXTEST_OLD_TEMPLATE_SYNTAX) && !defined(_CXXTEST_OLD_TEMPLATE_SYNTAX) # define _CXXTEST_OLD_TEMPLATE_SYNTAX #endif // CXXTEST_OLD_TEMPLATE_SYNTAX #if defined(CXXTEST_OLD_STD) && !defined(_CXXTEST_OLD_STD) # define _CXXTEST_OLD_STD #endif // CXXTEST_OLD_STD #if defined(CXXTEST_ABORT_TEST_ON_FAIL) && !defined(_CXXTEST_ABORT_TEST_ON_FAIL) # define _CXXTEST_ABORT_TEST_ON_FAIL #endif // CXXTEST_ABORT_TEST_ON_FAIL #if defined(CXXTEST_NO_COPY_CONST) && !defined(_CXXTEST_NO_COPY_CONST) # define _CXXTEST_NO_COPY_CONST #endif // CXXTEST_NO_COPY_CONST #if defined(CXXTEST_FACTOR) && !defined(_CXXTEST_FACTOR) # define _CXXTEST_FACTOR #endif // CXXTEST_FACTOR #if defined(CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION) && !defined(_CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION) # define _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION #endif // CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION #if defined(CXXTEST_LONGLONG) # if defined(_CXXTEST_LONGLONG) # undef _CXXTEST_LONGLONG # endif # define _CXXTEST_LONGLONG CXXTEST_LONGLONG #endif // CXXTEST_LONGLONG #ifndef CXXTEST_MAX_DUMP_SIZE # define CXXTEST_MAX_DUMP_SIZE 0 #endif // CXXTEST_MAX_DUMP_SIZE #if defined(_CXXTEST_ABORT_TEST_ON_FAIL) && !defined(CXXTEST_DEFAULT_ABORT) # define CXXTEST_DEFAULT_ABORT true #endif // _CXXTEST_ABORT_TEST_ON_FAIL && !CXXTEST_DEFAULT_ABORT #if !defined(CXXTEST_DEFAULT_ABORT) # define CXXTEST_DEFAULT_ABORT false #endif // !CXXTEST_DEFAULT_ABORT #if defined(_CXXTEST_ABORT_TEST_ON_FAIL) && !defined(_CXXTEST_HAVE_EH) # warning "CXXTEST_ABORT_TEST_ON_FAIL is meaningless without CXXTEST_HAVE_EH" # undef _CXXTEST_ABORT_TEST_ON_FAIL #endif // _CXXTEST_ABORT_TEST_ON_FAIL && !_CXXTEST_HAVE_EH // // Some minimal per-compiler configuration to allow us to compile // #ifdef __BORLANDC__ # if __BORLANDC__ <= 0x520 // Borland C++ 5.2 or earlier # ifndef _CXXTEST_OLD_STD # define _CXXTEST_OLD_STD # endif # ifndef _CXXTEST_OLD_TEMPLATE_SYNTAX # define _CXXTEST_OLD_TEMPLATE_SYNTAX # endif # endif # if __BORLANDC__ >= 0x540 // C++ Builder 4.0 or later # ifndef _CXXTEST_NO_COPY_CONST # define _CXXTEST_NO_COPY_CONST # endif # ifndef _CXXTEST_LONGLONG # define _CXXTEST_LONGLONG __int64 # endif # endif #endif // __BORLANDC__ #ifdef _MSC_VER // Visual C++ # ifndef _CXXTEST_LONGLONG # define _CXXTEST_LONGLONG __int64 # endif # if (_MSC_VER >= 0x51E) # ifndef _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION # define _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION # endif # endif # pragma warning( disable : 4127 ) # pragma warning( disable : 4290 ) # pragma warning( disable : 4511 ) # pragma warning( disable : 4512 ) # pragma warning( disable : 4514 ) #endif // _MSC_VER #ifdef __GNUC__ # if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 9) # ifndef _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION # define _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION # endif # endif #endif // __GNUC__ #ifdef __DMC__ // Digital Mars # ifndef _CXXTEST_OLD_STD # define _CXXTEST_OLD_STD # endif #endif #endif // __cxxtest__Flags_h__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/Gui.h0000644000175000017500000001341412320456500022510 0ustar mathieumathieu#ifndef __CXXTEST__GUI_H #define __CXXTEST__GUI_H // // GuiListener is a simple base class for the differes GUIs // GuiTuiRunner combines a GUI with a text-mode error formatter // #include namespace CxxTest { class GuiListener : public TestListener { public: GuiListener() : _state( GREEN_BAR ) {} virtual ~GuiListener() {} virtual void runGui( int &argc, char **argv, TestListener &listener ) { enterGui( argc, argv ); TestRunner::runAllTests( listener ); leaveGui(); } virtual void enterGui( int & /*argc*/, char ** /*argv*/ ) {} virtual void leaveGui() {} // // The easy way is to implement these functions: // virtual void guiEnterWorld( unsigned /*numTotalTests*/ ) {} virtual void guiEnterSuite( const char * /*suiteName*/ ) {} virtual void guiEnterTest( const char * /*suiteName*/, const char * /*testName*/ ) {} virtual void yellowBar() {} virtual void redBar() {} // // The hard way is this: // void enterWorld( const WorldDescription &d ) { guiEnterWorld( d.numTotalTests() ); } void enterSuite( const SuiteDescription &d ) { guiEnterSuite( d.suiteName() ); } void enterTest( const TestDescription &d ) { guiEnterTest( d.suiteName(), d.testName() ); } void leaveTest( const TestDescription & ) {} void leaveSuite( const SuiteDescription & ) {} void leaveWorld( const WorldDescription & ) {} void warning( const char * /*file*/, unsigned /*line*/, const char * /*expression*/ ) { yellowBarSafe(); } void failedTest( const char * /*file*/, unsigned /*line*/, const char * /*expression*/ ) { redBarSafe(); } void failedAssert( const char * /*file*/, unsigned /*line*/, const char * /*expression*/ ) { redBarSafe(); } void failedAssertEquals( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*x*/, const char * /*y*/ ) { redBarSafe(); } void failedAssertSameData( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*sizeStr*/, const void * /*x*/, const void * /*y*/, unsigned /*size*/ ) { redBarSafe(); } void failedAssertDelta( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*dStr*/, const char * /*x*/, const char * /*y*/, const char * /*d*/ ) { redBarSafe(); } void failedAssertDiffers( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*value*/ ) { redBarSafe(); } void failedAssertLessThan( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*x*/, const char * /*y*/ ) { redBarSafe(); } void failedAssertLessThanEquals( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*x*/, const char * /*y*/ ) { redBarSafe(); } void failedAssertPredicate( const char * /*file*/, unsigned /*line*/, const char * /*predicate*/, const char * /*xStr*/, const char * /*x*/ ) { redBarSafe(); } void failedAssertRelation( const char * /*file*/, unsigned /*line*/, const char * /*relation*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*x*/, const char * /*y*/ ) { redBarSafe(); } void failedAssertThrows( const char * /*file*/, unsigned /*line*/, const char * /*expression*/, const char * /*type*/, bool /*otherThrown*/ ) { redBarSafe(); } void failedAssertThrowsNot( const char * /*file*/, unsigned /*line*/, const char * /*expression*/ ) { redBarSafe(); } protected: void yellowBarSafe() { if ( _state < YELLOW_BAR ) { yellowBar(); _state = YELLOW_BAR; } } void redBarSafe() { if ( _state < RED_BAR ) { redBar(); _state = RED_BAR; } } private: enum { GREEN_BAR, YELLOW_BAR, RED_BAR } _state; }; template class GuiTuiRunner : public TeeListener { int &_argc; char **_argv; GuiT _gui; TuiT _tui; public: GuiTuiRunner( int &argc, char **argv ) : _argc( argc ), _argv( argv ) { setFirst( _gui ); setSecond( _tui ); } int run() { _gui.runGui( _argc, _argv, *this ); return tracker().failedTests(); } }; }; #endif //__CXXTEST__GUI_H ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/TestTracker.cpp0000644000175000017500000001621312320456500024552 0ustar mathieumathieu#ifndef __cxxtest__TestTracker_cpp__ #define __cxxtest__TestTracker_cpp__ #include namespace CxxTest { bool TestTracker::_created = false; TestTracker::TestTracker() { if ( !_created ) { initialize(); _created = true; } } TestTracker::~TestTracker() { } TestTracker & TestTracker::tracker() { static TestTracker theTracker; return theTracker; } void TestTracker::initialize() { _warnings = 0; _failedTests = 0; _testFailedAsserts = 0; _suiteFailedTests = 0; _failedSuites = 0; setListener( 0 ); _world = 0; _suite = 0; _test = 0; } const TestDescription *TestTracker::fixTest( const TestDescription *d ) const { return d ? d : &dummyTest(); } const SuiteDescription *TestTracker::fixSuite( const SuiteDescription *d ) const { return d ? d : &dummySuite(); } const WorldDescription *TestTracker::fixWorld( const WorldDescription *d ) const { return d ? d : &dummyWorld(); } const TestDescription &TestTracker::dummyTest() const { return dummySuite().testDescription(0); } const SuiteDescription &TestTracker::dummySuite() const { return dummyWorld().suiteDescription(0); } const WorldDescription &TestTracker::dummyWorld() const { return _dummyWorld; } void TestTracker::setListener( TestListener *l ) { _l = l ? l : &_dummyListener; } void TestTracker::enterWorld( const WorldDescription &wd ) { setWorld( &wd ); _warnings = _failedTests = _testFailedAsserts = _suiteFailedTests = _failedSuites = 0; _l->enterWorld( wd ); } void TestTracker::enterSuite( const SuiteDescription &sd ) { setSuite( &sd ); _testFailedAsserts = _suiteFailedTests = 0; _l->enterSuite(sd); } void TestTracker::enterTest( const TestDescription &td ) { setTest( &td ); _testFailedAsserts = false; _l->enterTest(td); } void TestTracker::leaveTest( const TestDescription &td ) { _l->leaveTest( td ); setTest( 0 ); } void TestTracker::leaveSuite( const SuiteDescription &sd ) { _l->leaveSuite( sd ); setSuite( 0 ); } void TestTracker::leaveWorld( const WorldDescription &wd ) { _l->leaveWorld( wd ); setWorld( 0 ); } void TestTracker::trace( const char *file, unsigned line, const char *expression ) { _l->trace( file, line, expression ); } void TestTracker::warning( const char *file, unsigned line, const char *expression ) { countWarning(); _l->warning( file, line, expression ); } void TestTracker::failedTest( const char *file, unsigned line, const char *expression ) { countFailure(); _l->failedTest( file, line, expression ); } void TestTracker::failedAssert( const char *file, unsigned line, const char *expression ) { countFailure(); _l->failedAssert( file, line, expression ); } void TestTracker::failedAssertEquals( const char *file, unsigned line, const char *xStr, const char *yStr, const char *x, const char *y ) { countFailure(); _l->failedAssertEquals( file, line, xStr, yStr, x, y ); } void TestTracker::failedAssertSameData( const char *file, unsigned line, const char *xStr, const char *yStr, const char *sizeStr, const void *x, const void *y, unsigned size ) { countFailure(); _l->failedAssertSameData( file, line, xStr, yStr, sizeStr, x, y, size ); } void TestTracker::failedAssertDelta( const char *file, unsigned line, const char *xStr, const char *yStr, const char *dStr, const char *x, const char *y, const char *d ) { countFailure(); _l->failedAssertDelta( file, line, xStr, yStr, dStr, x, y, d ); } void TestTracker::failedAssertDiffers( const char *file, unsigned line, const char *xStr, const char *yStr, const char *value ) { countFailure(); _l->failedAssertDiffers( file, line, xStr, yStr, value ); } void TestTracker::failedAssertLessThan( const char *file, unsigned line, const char *xStr, const char *yStr, const char *x, const char *y ) { countFailure(); _l->failedAssertLessThan( file, line, xStr, yStr, x, y ); } void TestTracker::failedAssertLessThanEquals( const char *file, unsigned line, const char *xStr, const char *yStr, const char *x, const char *y ) { countFailure(); _l->failedAssertLessThanEquals( file, line, xStr, yStr, x, y ); } void TestTracker::failedAssertPredicate( const char *file, unsigned line, const char *predicate, const char *xStr, const char *x ) { countFailure(); _l->failedAssertPredicate( file, line, predicate, xStr, x ); } void TestTracker::failedAssertRelation( const char *file, unsigned line, const char *relation, const char *xStr, const char *yStr, const char *x, const char *y ) { countFailure(); _l->failedAssertRelation( file, line, relation, xStr, yStr, x, y ); } void TestTracker::failedAssertThrows( const char *file, unsigned line, const char *expression, const char *type, bool otherThrown ) { countFailure(); _l->failedAssertThrows( file, line, expression, type, otherThrown ); } void TestTracker::failedAssertThrowsNot( const char *file, unsigned line, const char *expression ) { countFailure(); _l->failedAssertThrowsNot( file, line, expression ); } void TestTracker::setWorld( const WorldDescription *w ) { _world = fixWorld( w ); setSuite( 0 ); } void TestTracker::setSuite( const SuiteDescription *s ) { _suite = fixSuite( s ); setTest( 0 ); } void TestTracker::setTest( const TestDescription *t ) { _test = fixTest( t ); } void TestTracker::countWarning() { ++ _warnings; } void TestTracker::countFailure() { if ( ++ _testFailedAsserts == 1 ) { ++ _failedTests; if ( ++ _suiteFailedTests == 1 ) ++ _failedSuites; } } }; #endif // __cxxtest__TestTracker_cpp__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/Root.cpp0000644000175000017500000000075012320456500023241 0ustar mathieumathieu#ifndef __cxxtest__Root_cpp__ #define __cxxtest__Root_cpp__ // // This file holds the "root" of CxxTest, i.e. // the parts that must be in a source file file. // #include #include #include #include #include #include #include #include #endif // __cxxtest__Root_cpp__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/RealDescriptions.h0000644000175000017500000001563412320456500025244 0ustar mathieumathieu#ifndef __cxxtest__RealDescriptions_h__ #define __cxxtest__RealDescriptions_h__ // // The "real" description classes // #include #include #include namespace CxxTest { class RealTestDescription : public TestDescription { public: RealTestDescription(); RealTestDescription( List &argList, SuiteDescription &argSuite, unsigned argLine, const char *argTestName ); void initialize( List &argList, SuiteDescription &argSuite, unsigned argLine, const char *argTestName ); const char *file() const; unsigned line() const; const char *testName() const; const char *suiteName() const; TestDescription *next(); const TestDescription *next() const; TestSuite *suite() const; bool setUp(); void run(); bool tearDown(); private: RealTestDescription( const RealTestDescription & ); RealTestDescription &operator=( const RealTestDescription & ); virtual void runTest() = 0; SuiteDescription *_suite; unsigned _line; const char *_testName; }; class RealSuiteDescription : public SuiteDescription { public: RealSuiteDescription(); RealSuiteDescription( const char *argFile, unsigned argLine, const char *argSuiteName, List &argTests ); void initialize( const char *argFile, unsigned argLine, const char *argSuiteName, List &argTests ); const char *file() const; unsigned line() const; const char *suiteName() const; TestDescription *firstTest(); const TestDescription *firstTest() const; SuiteDescription *next(); const SuiteDescription *next() const; unsigned numTests() const; const TestDescription &testDescription( unsigned i ) const; void activateAllTests(); bool leaveOnly( const char *testName ); private: RealSuiteDescription( const RealSuiteDescription & ); RealSuiteDescription &operator=( const RealSuiteDescription & ); const char *_file; unsigned _line; const char *_suiteName; List *_tests; static List _suites; friend class RealWorldDescription; }; class StaticSuiteDescription : public RealSuiteDescription { public: StaticSuiteDescription(); StaticSuiteDescription( const char *argFile, unsigned argLine, const char *argSuiteName, TestSuite &argSuite, List &argTests ); void initialize( const char *argFile, unsigned argLine, const char *argSuiteName, TestSuite &argSuite, List &argTests ); TestSuite *suite() const; bool setUp(); bool tearDown(); private: StaticSuiteDescription( const StaticSuiteDescription & ); StaticSuiteDescription &operator=( const StaticSuiteDescription & ); void doInitialize( TestSuite &argSuite ); TestSuite *_suite; }; class CommonDynamicSuiteDescription : public RealSuiteDescription { public: CommonDynamicSuiteDescription(); CommonDynamicSuiteDescription( const char *argFile, unsigned argLine, const char *argSuiteName, List &argTests, unsigned argCreateLine, unsigned argDestroyLine ); void initialize( const char *argFile, unsigned argLine, const char *argSuiteName, List &argTests, unsigned argCreateLine, unsigned argDestroyLine ); protected: unsigned _createLine, _destroyLine; private: void doInitialize( unsigned argCreateLine, unsigned argDestroyLine ); }; template class DynamicSuiteDescription : public CommonDynamicSuiteDescription { public: DynamicSuiteDescription() {} DynamicSuiteDescription( const char *argFile, unsigned argLine, const char *argSuiteName, List &argTests, S *&argSuite, unsigned argCreateLine, unsigned argDestroyLine ) : CommonDynamicSuiteDescription( argFile, argLine, argSuiteName, argTests, argCreateLine, argDestroyLine ) { _suite = &argSuite; } void initialize( const char *argFile, unsigned argLine, const char *argSuiteName, List &argTests, S *&argSuite, unsigned argCreateLine, unsigned argDestroyLine ) { CommonDynamicSuiteDescription::initialize( argFile, argLine, argSuiteName, argTests, argCreateLine, argDestroyLine ); _suite = &argSuite; } TestSuite *suite() const { return realSuite(); } bool setUp(); bool tearDown(); private: S *realSuite() const { return *_suite; } void setSuite( S *s ) { *_suite = s; } void createSuite() { setSuite( S::createSuite() ); } void destroySuite() { S *s = realSuite(); setSuite( 0 ); S::destroySuite( s ); } S **_suite; }; template bool DynamicSuiteDescription::setUp() { _TS_TRY { _TSM_ASSERT_THROWS_NOTHING( file(), _createLine, "Exception thrown from createSuite()", createSuite() ); _TSM_ASSERT( file(), _createLine, "createSuite() failed", suite() != 0 ); } _TS_CATCH_ABORT( { return false; } ); return (suite() != 0); } template bool DynamicSuiteDescription::tearDown() { if ( !_suite ) return true; _TS_TRY { _TSM_ASSERT_THROWS_NOTHING( file(), _destroyLine, "destroySuite() failed", destroySuite() ); } _TS_CATCH_ABORT( { return false; } ); return true; } class RealWorldDescription : public WorldDescription { public: static List &suites(); unsigned numSuites( void ) const; unsigned numTotalTests( void ) const; SuiteDescription *firstSuite(); const SuiteDescription *firstSuite() const; const SuiteDescription &suiteDescription( unsigned i ) const; void activateAllTests(); bool leaveOnly( const char *suiteName, const char *testName = 0 ); bool setUp(); bool tearDown(); static void reportError( const char *message ); }; void activateAllTests(); bool leaveOnly( const char *suiteName, const char *testName = 0 ); } #endif // __cxxtest__RealDescriptions_h__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/SelfTest.h0000644000175000017500000000023212320456500023507 0ustar mathieumathieu#ifndef __cxxtest_SelfTest_h__ #define __cxxtest_SelfTest_h__ #define CXXTEST_SUITE(name) #define CXXTEST_CODE(member) #endif // __cxxtest_SelfTest_h__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/TestSuite.cpp0000644000175000017500000000671612320456500024257 0ustar mathieumathieu#ifndef __cxxtest__TestSuite_cpp__ #define __cxxtest__TestSuite_cpp__ #include namespace CxxTest { // // TestSuite members // TestSuite::~TestSuite() {} void TestSuite::setUp() {} void TestSuite::tearDown() {} // // Test-aborting stuff // static bool currentAbortTestOnFail = false; bool abortTestOnFail() { return currentAbortTestOnFail; } void setAbortTestOnFail( bool value ) { currentAbortTestOnFail = value; } void doAbortTest() { # if defined(_CXXTEST_HAVE_EH) if ( currentAbortTestOnFail ) throw AbortTest(); # endif // _CXXTEST_HAVE_EH } // // Max dump size // static unsigned currentMaxDumpSize = CXXTEST_MAX_DUMP_SIZE; unsigned maxDumpSize() { return currentMaxDumpSize; } void setMaxDumpSize( unsigned value ) { currentMaxDumpSize = value; } // // Some non-template functions // void doTrace( const char *file, unsigned line, const char *message ) { tracker().trace( file, line, message ); } void doWarn( const char *file, unsigned line, const char *message ) { tracker().warning( file, line, message ); } void doFailTest( const char *file, unsigned line, const char *message ) { tracker().failedTest( file, line, message ); TS_ABORT(); } void doFailAssert( const char *file, unsigned line, const char *expression, const char *message ) { if ( message ) tracker().failedTest( file, line, message ); tracker().failedAssert( file, line, expression ); TS_ABORT(); } bool sameData( const void *x, const void *y, unsigned size ) { if ( size == 0 ) return true; if ( x == y ) return true; if ( !x || !y ) return false; const char *cx = (const char *)x; const char *cy = (const char *)y; while ( size -- ) if ( *cx++ != *cy++ ) return false; return true; } void doAssertSameData( const char *file, unsigned line, const char *xExpr, const void *x, const char *yExpr, const void *y, const char *sizeExpr, unsigned size, const char *message ) { if ( !sameData( x, y, size ) ) { if ( message ) tracker().failedTest( file, line, message ); tracker().failedAssertSameData( file, line, xExpr, yExpr, sizeExpr, x, y, size ); TS_ABORT(); } } void doFailAssertThrows( const char *file, unsigned line, const char *expr, const char *type, bool otherThrown, const char *message ) { if ( message ) tracker().failedTest( file, line, message ); tracker().failedAssertThrows( file, line, expr, type, otherThrown ); TS_ABORT(); } void doFailAssertThrowsNot( const char *file, unsigned line, const char *expression, const char *message ) { if ( message ) tracker().failedTest( file, line, message ); tracker().failedAssertThrowsNot( file, line, expression ); TS_ABORT(); } }; #endif // __cxxtest__TestSuite_cpp__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/DummyDescriptions.h0000644000175000017500000000373312320456500025451 0ustar mathieumathieu#ifndef __cxxtest__DummyDescriptions_h__ #define __cxxtest__DummyDescriptions_h__ // // DummyTestDescription, DummySuiteDescription and DummyWorldDescription // #include namespace CxxTest { class DummyTestDescription : public TestDescription { public: DummyTestDescription(); const char *file() const; unsigned line() const; const char *testName() const; const char *suiteName() const; bool setUp(); void run(); bool tearDown(); TestDescription *next(); const TestDescription *next() const; }; class DummySuiteDescription : public SuiteDescription { public: DummySuiteDescription(); const char *file() const; unsigned line() const; const char *suiteName() const; TestSuite *suite() const; unsigned numTests() const; const TestDescription &testDescription( unsigned ) const; SuiteDescription *next(); TestDescription *firstTest(); const SuiteDescription *next() const; const TestDescription *firstTest() const; void activateAllTests(); bool leaveOnly( const char * /*testName*/ ); bool setUp(); bool tearDown(); private: DummyTestDescription _test; }; class DummyWorldDescription : public WorldDescription { public: DummyWorldDescription(); unsigned numSuites( void ) const; unsigned numTotalTests( void ) const; const SuiteDescription &suiteDescription( unsigned ) const; SuiteDescription *firstSuite(); const SuiteDescription *firstSuite() const; void activateAllTests(); bool leaveOnly( const char * /*suiteName*/, const char * /*testName*/ = 0 ); bool setUp(); bool tearDown(); private: DummySuiteDescription _suite; }; } #endif // __cxxtest__DummyDescriptions_h__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/LinkedList.h0000644000175000017500000000225312320456500024025 0ustar mathieumathieu#ifndef __cxxtest__LinkedList_h__ #define __cxxtest__LinkedList_h__ #include namespace CxxTest { struct List; class Link; struct List { Link *_head; Link *_tail; void initialize(); Link *head(); const Link *head() const; Link *tail(); const Link *tail() const; bool empty() const; unsigned size() const; Link *nth( unsigned n ); void activateAll(); void leaveOnly( const Link &link ); }; class Link { public: Link(); virtual ~Link(); bool active() const; void setActive( bool value = true ); Link *justNext(); Link *justPrev(); Link *next(); Link *prev(); const Link *next() const; const Link *prev() const; virtual bool setUp() = 0; virtual bool tearDown() = 0; void attach( List &l ); void detach( List &l ); private: Link *_next; Link *_prev; bool _active; Link( const Link & ); Link &operator=( const Link & ); }; } #endif // __cxxtest__LinkedList_h__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/ValueTraits.h0000644000175000017500000002622012320456500024226 0ustar mathieumathieu#ifndef __cxxtest__ValueTraits_h__ #define __cxxtest__ValueTraits_h__ // // ValueTraits are used by CxxTest to convert arbitrary // values used in TS_ASSERT_EQUALS() to a string representation. // // This header file contains value traits for builtin integral types. // To declare value traits for new types you should instantiate the class // ValueTraits. // #include #ifdef _CXXTEST_OLD_TEMPLATE_SYNTAX # define CXXTEST_TEMPLATE_INSTANTIATION #else // !_CXXTEST_OLD_TEMPLATE_SYNTAX # define CXXTEST_TEMPLATE_INSTANTIATION template<> #endif // _CXXTEST_OLD_TEMPLATE_SYNTAX namespace CxxTest { // // This is how we use the value traits // # define TS_AS_STRING(x) CxxTest::traits(x).asString() // // Char representation of a digit // char digitToChar( unsigned digit ); // // Convert byte value to hex digits // Returns pointer to internal buffer // const char *byteToHex( unsigned char byte ); // // Convert byte values to string // Returns one past the copied data // char *bytesToString( const unsigned char *bytes, unsigned numBytes, unsigned maxBytes, char *s ); // // Copy a string. // Returns one past the end of the destination string // Remember -- we can't use the standard library! // char *copyString( char *dst, const char *src ); // // Compare two strings. // Remember -- we can't use the standard library! // bool stringsEqual( const char *s1, const char *s2 ); // // Represent a character value as a string // Returns one past the end of the string // This will be the actual char if printable or '\xXXXX' otherwise // char *charToString( unsigned long c, char *s ); // // Prevent problems with negative (signed char)s // char *charToString( char c, char *s ); // // The default ValueTraits class dumps up to 8 bytes as hex values // template class ValueTraits { enum { MAX_BYTES = 8 }; char _asString[sizeof("{ ") + sizeof("XX ") * MAX_BYTES + sizeof("... }")]; public: ValueTraits( const T &t ) { bytesToString( (const unsigned char *)&t, sizeof(T), MAX_BYTES, _asString ); } const char *asString( void ) const { return _asString; } }; // // traits( T t ) // Creates an object of type ValueTraits // template inline ValueTraits traits( T t ) { return ValueTraits( t ); } // // You can duplicate the implementation of an existing ValueTraits // # define CXXTEST_COPY_TRAITS(CXXTEST_NEW_CLASS, CXXTEST_OLD_CLASS) \ CXXTEST_TEMPLATE_INSTANTIATION \ class ValueTraits< CXXTEST_NEW_CLASS > \ { \ ValueTraits< CXXTEST_OLD_CLASS > _old; \ public: \ ValueTraits( CXXTEST_NEW_CLASS n ) : _old( (CXXTEST_OLD_CLASS)n ) {} \ const char *asString( void ) const { return _old.asString(); } \ } // // Certain compilers need separate declarations for T and const T // # ifdef _CXXTEST_NO_COPY_CONST # define CXXTEST_COPY_CONST_TRAITS(CXXTEST_CLASS) # else // !_CXXTEST_NO_COPY_CONST # define CXXTEST_COPY_CONST_TRAITS(CXXTEST_CLASS) CXXTEST_COPY_TRAITS(CXXTEST_CLASS, const CXXTEST_CLASS) # endif // _CXXTEST_NO_COPY_CONST // // Avoid compiler warnings about unsigned types always >= 0 // template inline bool negative( N n ) { return n < 0; } template inline N abs( N n ) { return negative(n) ? -n : n; } # define CXXTEST_NON_NEGATIVE(Type) \ CXXTEST_TEMPLATE_INSTANTIATION \ inline bool negative( Type ) { return false; } \ CXXTEST_TEMPLATE_INSTANTIATION \ inline Type abs( Type value ) { return value; } CXXTEST_NON_NEGATIVE( bool ) CXXTEST_NON_NEGATIVE( unsigned char ) CXXTEST_NON_NEGATIVE( unsigned short int ) CXXTEST_NON_NEGATIVE( unsigned int ) CXXTEST_NON_NEGATIVE( unsigned long int ) # ifdef _CXXTEST_LONGLONG CXXTEST_NON_NEGATIVE( unsigned _CXXTEST_LONGLONG ) # endif // _CXXTEST_LONGLONG // // Represent (integral) number as a string // Returns one past the end of the string // Remember -- we can't use the standard library! // template char *numberToString( N n, char *s, N base = 10, unsigned skipDigits = 0, unsigned maxDigits = (unsigned)-1 ) { if ( negative(n) ) { *s++ = '-'; n = abs(n); } N digit = 1; while ( digit <= (n / base) ) digit *= base; N digitValue; for ( ; digit >= 1 && skipDigits; n -= digit * digitValue, digit /= base, -- skipDigits ) digitValue = (unsigned)(n / digit); for ( ; digit >= 1 && maxDigits; n -= digit * digitValue, digit /= base, -- maxDigits ) *s++ = digitToChar( (unsigned)(digitValue = (unsigned)(n / digit)) ); *s = '\0'; return s; } // // All the specific ValueTraits follow. // You can #define CXXTEST_USER_VALUE_TRAITS if you don't want them // #ifndef CXXTEST_USER_VALUE_TRAITS // // ValueTraits: const char * const & // This is used for printing strings, as in TS_FAIL( "Message" ) // CXXTEST_TEMPLATE_INSTANTIATION class ValueTraits { ValueTraits &operator=( const ValueTraits & ); const char *_asString; public: ValueTraits( const char * const &value ) : _asString( value ) {} ValueTraits( const ValueTraits &other ) : _asString( other._asString ) {} const char *asString( void ) const { return _asString; } }; CXXTEST_COPY_TRAITS( const char *, const char * const & ); CXXTEST_COPY_TRAITS( char *, const char * const & ); // // ValueTraits: bool // CXXTEST_TEMPLATE_INSTANTIATION class ValueTraits { bool _value; public: ValueTraits( const bool value ) : _value( value ) {} const char *asString( void ) const { return _value ? "true" : "false"; } }; CXXTEST_COPY_CONST_TRAITS( bool ); # ifdef _CXXTEST_LONGLONG // // ValueTraits: signed long long // CXXTEST_TEMPLATE_INSTANTIATION class ValueTraits { typedef _CXXTEST_LONGLONG T; char _asString[2 + 3 * sizeof(T)]; public: ValueTraits( T t ) { numberToString( t, _asString ); } const char *asString( void ) const { return _asString; } }; CXXTEST_COPY_CONST_TRAITS( signed _CXXTEST_LONGLONG ); // // ValueTraits: unsigned long long // CXXTEST_TEMPLATE_INSTANTIATION class ValueTraits { typedef unsigned _CXXTEST_LONGLONG T; char _asString[1 + 3 * sizeof(T)]; public: ValueTraits( T t ) { numberToString( t, _asString ); } const char *asString( void ) const { return _asString; } }; CXXTEST_COPY_CONST_TRAITS( unsigned _CXXTEST_LONGLONG ); # endif // _CXXTEST_LONGLONG // // ValueTraits: signed long // CXXTEST_TEMPLATE_INSTANTIATION class ValueTraits { typedef signed long int T; char _asString[2 + 3 * sizeof(T)]; public: ValueTraits( T t ) { numberToString( t, _asString ); } const char *asString( void ) const { return _asString; } }; CXXTEST_COPY_CONST_TRAITS( signed long int ); // // ValueTraits: unsigned long // CXXTEST_TEMPLATE_INSTANTIATION class ValueTraits { typedef unsigned long int T; char _asString[1 + 3 * sizeof(T)]; public: ValueTraits( T t ) { numberToString( t, _asString ); } const char *asString( void ) const { return _asString; } }; CXXTEST_COPY_CONST_TRAITS( unsigned long int ); // // All decimals are the same as the long version // CXXTEST_COPY_TRAITS( const signed int, const signed long int ); CXXTEST_COPY_TRAITS( const unsigned int, const unsigned long int ); CXXTEST_COPY_TRAITS( const signed short int, const signed long int ); CXXTEST_COPY_TRAITS( const unsigned short int, const unsigned long int ); CXXTEST_COPY_TRAITS( const unsigned char, const unsigned long int ); CXXTEST_COPY_CONST_TRAITS( signed int ); CXXTEST_COPY_CONST_TRAITS( unsigned int ); CXXTEST_COPY_CONST_TRAITS( signed short int ); CXXTEST_COPY_CONST_TRAITS( unsigned short int ); CXXTEST_COPY_CONST_TRAITS( unsigned char ); // // ValueTraits: char // Returns 'x' for printable chars, '\x??' for others // CXXTEST_TEMPLATE_INSTANTIATION class ValueTraits { char _asString[sizeof("'\\xXX'")]; public: ValueTraits( char c ) { copyString( charToString( c, copyString( _asString, "'" ) ), "'" ); } const char *asString( void ) const { return _asString; } }; CXXTEST_COPY_CONST_TRAITS( char ); // // ValueTraits: signed char // Same as char, some compilers need it // CXXTEST_COPY_TRAITS( const signed char, const char ); CXXTEST_COPY_CONST_TRAITS( signed char ); // // ValueTraits: double // CXXTEST_TEMPLATE_INSTANTIATION class ValueTraits { public: ValueTraits( double t ) { ( requiredDigitsOnLeft( t ) > MAX_DIGITS_ON_LEFT ) ? hugeNumber( t ) : normalNumber( t ); } const char *asString( void ) const { return _asString; } private: enum { MAX_DIGITS_ON_LEFT = 24, DIGITS_ON_RIGHT = 4, BASE = 10 }; char _asString[1 + MAX_DIGITS_ON_LEFT + 1 + DIGITS_ON_RIGHT + 1]; static unsigned requiredDigitsOnLeft( double t ); char *doNegative( double &t ); void hugeNumber( double t ); void normalNumber( double t ); char *doubleToString( double t, char *s, unsigned skip = 0, unsigned max = (unsigned)-1 ); }; CXXTEST_COPY_CONST_TRAITS( double ); // // ValueTraits: float // CXXTEST_COPY_TRAITS( const float, const double ); CXXTEST_COPY_CONST_TRAITS( float ); #endif // !CXXTEST_USER_VALUE_TRAITS }; #ifdef _CXXTEST_HAVE_STD # include #endif // _CXXTEST_HAVE_STD // // CXXTEST_ENUM_TRAITS // #define CXXTEST_ENUM_TRAITS( TYPE, VALUES ) \ namespace CxxTest \ { \ CXXTEST_TEMPLATE_INSTANTIATION \ class ValueTraits \ { \ TYPE _value; \ char _fallback[sizeof("(" #TYPE ")") + 3 * sizeof(TYPE)]; \ public: \ ValueTraits( TYPE value ) { \ _value = value; \ numberToString( _value, copyString( _fallback, "(" #TYPE ")" ) ); \ } \ const char *asString( void ) const \ { \ switch ( _value ) \ { \ VALUES \ default: return _fallback; \ } \ } \ }; \ } #define CXXTEST_ENUM_MEMBER( MEMBER ) \ case MEMBER: return #MEMBER; #endif // __cxxtest__ValueTraits_h__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/ValueTraits.cpp0000644000175000017500000000751112320456500024563 0ustar mathieumathieu#ifndef __cxxtest__ValueTraits_cpp__ #define __cxxtest__ValueTraits_cpp__ #include namespace CxxTest { // // Non-inline functions from ValueTraits.h // char digitToChar( unsigned digit ) { if ( digit < 10 ) return (char)('0' + digit); if ( digit <= 10 + 'Z' - 'A' ) return (char)('A' + digit - 10); return '?'; } const char *byteToHex( unsigned char byte ) { static char asHex[3]; asHex[0] = digitToChar( byte >> 4 ); asHex[1] = digitToChar( byte & 0x0F ); asHex[2] = '\0'; return asHex; } char *copyString( char *dst, const char *src ) { while ( (*dst = *src) != '\0' ) { ++ dst; ++ src; } return dst; } bool stringsEqual( const char *s1, const char *s2 ) { char c; while ( (c = *s1++) == *s2++ ) if ( c == '\0' ) return true; return false; } char *charToString( unsigned long c, char *s ) { switch( c ) { case '\\': return copyString( s, "\\\\" ); case '\"': return copyString( s, "\\\"" ); case '\'': return copyString( s, "\\\'" ); case '\0': return copyString( s, "\\0" ); case '\a': return copyString( s, "\\a" ); case '\b': return copyString( s, "\\b" ); case '\n': return copyString( s, "\\n" ); case '\r': return copyString( s, "\\r" ); case '\t': return copyString( s, "\\t" ); } if ( c >= 32 && c <= 127 ) { s[0] = (char)c; s[1] = '\0'; return s + 1; } else { s[0] = '\\'; s[1] = 'x'; if ( c < 0x10 ) { s[2] = '0'; ++ s; } return numberToString( c, s + 2, 16UL ); } } char *charToString( char c, char *s ) { return charToString( (unsigned long)(unsigned char)c, s ); } char *bytesToString( const unsigned char *bytes, unsigned numBytes, unsigned maxBytes, char *s ) { bool truncate = (numBytes > maxBytes); if ( truncate ) numBytes = maxBytes; s = copyString( s, "{ " ); for ( unsigned i = 0; i < numBytes; ++ i, ++ bytes ) s = copyString( copyString( s, byteToHex( *bytes ) ), " " ); if ( truncate ) s = copyString( s, "..." ); return copyString( s, " }" ); } #ifndef CXXTEST_USER_VALUE_TRAITS unsigned ValueTraits::requiredDigitsOnLeft( double t ) { unsigned digits = 1; for ( t = (t < 0.0) ? -t : t; t > 1.0; t /= BASE ) ++ digits; return digits; } char *ValueTraits::doNegative( double &t ) { if ( t >= 0 ) return _asString; _asString[0] = '-'; t = -t; return _asString + 1; } void ValueTraits::hugeNumber( double t ) { char *s = doNegative( t ); s = doubleToString( t, s, 0, 1 ); s = copyString( s, "." ); s = doubleToString( t, s, 1, DIGITS_ON_RIGHT ); s = copyString( s, "E" ); s = numberToString( requiredDigitsOnLeft( t ) - 1, s ); } void ValueTraits::normalNumber( double t ) { char *s = doNegative( t ); s = doubleToString( t, s ); s = copyString( s, "." ); for ( unsigned i = 0; i < DIGITS_ON_RIGHT; ++ i ) s = numberToString( (unsigned)(t *= BASE) % BASE, s ); } char *ValueTraits::doubleToString( double t, char *s, unsigned skip, unsigned max ) { return numberToString( t, s, BASE, skip, max ); } #endif // !CXXTEST_USER_VALUE_TRAITS }; #endif // __cxxtest__ValueTraits_cpp__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/ErrorFormatter.h0000644000175000017500000002253212320456500024742 0ustar mathieumathieu#ifndef __cxxtest__ErrorFormatter_h__ #define __cxxtest__ErrorFormatter_h__ // // The ErrorFormatter is a TestListener that // prints reports of the errors to an output // stream. Since we cannot rely ou the standard // iostreams, this header defines a base class // analogout to std::ostream. // #include #include #include #include namespace CxxTest { class OutputStream { public: virtual ~OutputStream() {} virtual void flush() {}; virtual OutputStream &operator<<( unsigned /*number*/ ) { return *this; } virtual OutputStream &operator<<( const char * /*string*/ ) { return *this; } typedef void (*Manipulator)( OutputStream & ); virtual OutputStream &operator<<( Manipulator m ) { m( *this ); return *this; } static void endl( OutputStream &o ) { (o << "\n").flush(); } }; class ErrorFormatter : public TestListener { public: ErrorFormatter( OutputStream *o, const char *preLine = ":", const char *postLine = "" ) : _dotting( true ), _reported( false ), _o(o), _preLine(preLine), _postLine(postLine) { } int run() { TestRunner::runAllTests( *this ); return tracker().failedTests(); } void enterWorld( const WorldDescription & /*desc*/ ) { (*_o) << "Running " << totalTests; _o->flush(); _dotting = true; _reported = false; } static void totalTests( OutputStream &o ) { char s[WorldDescription::MAX_STRLEN_TOTAL_TESTS]; const WorldDescription &wd = tracker().world(); o << wd.strTotalTests( s ) << (wd.numTotalTests() == 1 ? " test" : " tests"); } void enterSuite( const SuiteDescription & ) { _reported = false; } void enterTest( const TestDescription & ) { _reported = false; } void leaveTest( const TestDescription & ) { if ( !tracker().testFailed() ) { ((*_o) << ".").flush(); _dotting = true; } } void leaveWorld( const WorldDescription &desc ) { if ( !tracker().failedTests() ) { (*_o) << "OK!" << endl; return; } newLine(); (*_o) << "Failed " << tracker().failedTests() << " of " << totalTests << endl; unsigned numPassed = desc.numTotalTests() - tracker().failedTests(); (*_o) << "Success rate: " << (numPassed * 100 / desc.numTotalTests()) << "%" << endl; } void trace( const char *file, unsigned line, const char *expression ) { stop( file, line ) << "Trace: " << expression << endl; } void warning( const char *file, unsigned line, const char *expression ) { stop( file, line ) << "Warning: " << expression << endl; } void failedTest( const char *file, unsigned line, const char *expression ) { stop( file, line ) << "Error: Test failed: " << expression << endl; } void failedAssert( const char *file, unsigned line, const char *expression ) { stop( file, line ) << "Error: Assertion failed: " << expression << endl; } void failedAssertEquals( const char *file, unsigned line, const char *xStr, const char *yStr, const char *x, const char *y ) { stop( file, line ) << "Error: Expected (" << xStr << " == " << yStr << "), found (" << x << " != " << y << ")" << endl; } void failedAssertSameData( const char *file, unsigned line, const char *xStr, const char *yStr, const char *sizeStr, const void *x, const void *y, unsigned size ) { stop( file, line ) << "Error: Expected " << sizeStr << " (" << size << ") bytes to be equal at (" << xStr << ") and (" << yStr << "), found:" << endl; dump( x, size ); (*_o) << " differs from" << endl; dump( y, size ); } void failedAssertDelta( const char *file, unsigned line, const char *xStr, const char *yStr, const char *dStr, const char *x, const char *y, const char *d ) { stop( file, line ) << "Error: Expected (" << xStr << " == " << yStr << ") up to " << dStr << " (" << d << "), found (" << x << " != " << y << ")" << endl; } void failedAssertDiffers( const char *file, unsigned line, const char *xStr, const char *yStr, const char *value ) { stop( file, line ) << "Error: Expected (" << xStr << " != " << yStr << "), found (" << value << ")" << endl; } void failedAssertLessThan( const char *file, unsigned line, const char *xStr, const char *yStr, const char *x, const char *y ) { stop( file, line ) << "Error: Expected (" << xStr << " < " << yStr << "), found (" << x << " >= " << y << ")" << endl; } void failedAssertLessThanEquals( const char *file, unsigned line, const char *xStr, const char *yStr, const char *x, const char *y ) { stop( file, line ) << "Error: Expected (" << xStr << " <= " << yStr << "), found (" << x << " > " << y << ")" << endl; } void failedAssertRelation( const char *file, unsigned line, const char *relation, const char *xStr, const char *yStr, const char *x, const char *y ) { stop( file, line ) << "Error: Expected " << relation << "( " << xStr << ", " << yStr << " ), found !" << relation << "( " << x << ", " << y << " )" << endl; } void failedAssertPredicate( const char *file, unsigned line, const char *predicate, const char *xStr, const char *x ) { stop( file, line ) << "Error: Expected " << predicate << "( " << xStr << " ), found !" << predicate << "( " << x << " )" << endl; } void failedAssertThrows( const char *file, unsigned line, const char *expression, const char *type, bool otherThrown ) { stop( file, line ) << "Error: Expected (" << expression << ") to throw (" << type << ") but it " << (otherThrown ? "threw something else" : "didn't throw") << endl; } void failedAssertThrowsNot( const char *file, unsigned line, const char *expression ) { stop( file, line ) << "Error: Expected (" << expression << ") not to throw, but it did" << endl; } protected: OutputStream *outputStream() const { return _o; } private: ErrorFormatter( const ErrorFormatter & ); ErrorFormatter &operator=( const ErrorFormatter & ); OutputStream &stop( const char *file, unsigned line ) { newLine(); reportTest(); return (*_o) << file << _preLine << line << _postLine << ": "; } void newLine( void ) { if ( _dotting ) { (*_o) << endl; _dotting = false; } } void reportTest( void ) { if( _reported ) return; (*_o) << "In " << tracker().suite().suiteName() << "::" << tracker().test().testName() << ":" << endl; _reported = true; } void dump( const void *buffer, unsigned size ) { if ( !buffer ) dumpNull(); else dumpBuffer( buffer, size ); } void dumpNull() { (*_o) << " (null)" << endl; } void dumpBuffer( const void *buffer, unsigned size ) { unsigned dumpSize = size; if ( maxDumpSize() && dumpSize > maxDumpSize() ) dumpSize = maxDumpSize(); const unsigned char *p = (const unsigned char *)buffer; (*_o) << " { "; for ( unsigned i = 0; i < dumpSize; ++ i ) (*_o) << byteToHex( *p++ ) << " "; if ( dumpSize < size ) (*_o) << "... "; (*_o) << "}" << endl; } static void endl( OutputStream &o ) { OutputStream::endl( o ); } bool _dotting; bool _reported; OutputStream *_o; const char *_preLine; const char *_postLine; }; }; #endif // __cxxtest__ErrorFormatter_h__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/TestListener.h0000644000175000017500000001001612320456500024404 0ustar mathieumathieu#ifndef __cxxtest__TestListener_h__ #define __cxxtest__TestListener_h__ // // TestListener is the base class for all "listeners", // i.e. classes that receive notifications of the // testing process. // // The names of the parameters are in comments to avoid // "unused parameter" warnings. // #include namespace CxxTest { class TestListener { public: TestListener() {} virtual ~TestListener() {} virtual void enterWorld( const WorldDescription & /*desc*/ ) {} virtual void enterSuite( const SuiteDescription & /*desc*/ ) {} virtual void enterTest( const TestDescription & /*desc*/ ) {} virtual void trace( const char * /*file*/, unsigned /*line*/, const char * /*expression*/ ) {} virtual void warning( const char * /*file*/, unsigned /*line*/, const char * /*expression*/ ) {} virtual void failedTest( const char * /*file*/, unsigned /*line*/, const char * /*expression*/ ) {} virtual void failedAssert( const char * /*file*/, unsigned /*line*/, const char * /*expression*/ ) {} virtual void failedAssertEquals( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*x*/, const char * /*y*/ ) {} virtual void failedAssertSameData( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*sizeStr*/, const void * /*x*/, const void * /*y*/, unsigned /*size*/ ) {} virtual void failedAssertDelta( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*dStr*/, const char * /*x*/, const char * /*y*/, const char * /*d*/ ) {} virtual void failedAssertDiffers( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*value*/ ) {} virtual void failedAssertLessThan( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*x*/, const char * /*y*/ ) {} virtual void failedAssertLessThanEquals( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*x*/, const char * /*y*/ ) {} virtual void failedAssertPredicate( const char * /*file*/, unsigned /*line*/, const char * /*predicate*/, const char * /*xStr*/, const char * /*x*/ ) {} virtual void failedAssertRelation( const char * /*file*/, unsigned /*line*/, const char * /*relation*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*x*/, const char * /*y*/ ) {} virtual void failedAssertThrows( const char * /*file*/, unsigned /*line*/, const char * /*expression*/, const char * /*type*/, bool /*otherThrown*/ ) {} virtual void failedAssertThrowsNot( const char * /*file*/, unsigned /*line*/, const char * /*expression*/ ) {} virtual void leaveTest( const TestDescription & /*desc*/ ) {} virtual void leaveSuite( const SuiteDescription & /*desc*/ ) {} virtual void leaveWorld( const WorldDescription & /*desc*/ ) {} }; } #endif // __cxxtest__TestListener_h__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/TestTracker.h0000644000175000017500000001221512320456500024215 0ustar mathieumathieu#ifndef __cxxtest__TestTracker_h__ #define __cxxtest__TestTracker_h__ // // The TestTracker tracks running tests // The actual work is done in CountingListenerProxy, // but this way avoids cyclic references TestListener<->CountingListenerProxy // #include #include namespace CxxTest { class TestListener; class TestTracker : public TestListener { public: virtual ~TestTracker(); static TestTracker &tracker(); const TestDescription *fixTest( const TestDescription *d ) const; const SuiteDescription *fixSuite( const SuiteDescription *d ) const; const WorldDescription *fixWorld( const WorldDescription *d ) const; const TestDescription &test() const { return *_test; } const SuiteDescription &suite() const { return *_suite; } const WorldDescription &world() const { return *_world; } bool testFailed() const { return (testFailedAsserts() > 0); } bool suiteFailed() const { return (suiteFailedTests() > 0); } bool worldFailed() const { return (failedSuites() > 0); } unsigned warnings() const { return _warnings; } unsigned failedTests() const { return _failedTests; } unsigned testFailedAsserts() const { return _testFailedAsserts; } unsigned suiteFailedTests() const { return _suiteFailedTests; } unsigned failedSuites() const { return _failedSuites; } void enterWorld( const WorldDescription &wd ); void enterSuite( const SuiteDescription &sd ); void enterTest( const TestDescription &td ); void leaveTest( const TestDescription &td ); void leaveSuite( const SuiteDescription &sd ); void leaveWorld( const WorldDescription &wd ); void trace( const char *file, unsigned line, const char *expression ); void warning( const char *file, unsigned line, const char *expression ); void failedTest( const char *file, unsigned line, const char *expression ); void failedAssert( const char *file, unsigned line, const char *expression ); void failedAssertEquals( const char *file, unsigned line, const char *xStr, const char *yStr, const char *x, const char *y ); void failedAssertSameData( const char *file, unsigned line, const char *xStr, const char *yStr, const char *sizeStr, const void *x, const void *y, unsigned size ); void failedAssertDelta( const char *file, unsigned line, const char *xStr, const char *yStr, const char *dStr, const char *x, const char *y, const char *d ); void failedAssertDiffers( const char *file, unsigned line, const char *xStr, const char *yStr, const char *value ); void failedAssertLessThan( const char *file, unsigned line, const char *xStr, const char *yStr, const char *x, const char *y ); void failedAssertLessThanEquals( const char *file, unsigned line, const char *xStr, const char *yStr, const char *x, const char *y ); void failedAssertPredicate( const char *file, unsigned line, const char *predicate, const char *xStr, const char *x ); void failedAssertRelation( const char *file, unsigned line, const char *relation, const char *xStr, const char *yStr, const char *x, const char *y ); void failedAssertThrows( const char *file, unsigned line, const char *expression, const char *type, bool otherThrown ); void failedAssertThrowsNot( const char *file, unsigned line, const char *expression ); private: TestTracker( const TestTracker & ); TestTracker &operator=( const TestTracker & ); static bool _created; TestListener _dummyListener; DummyWorldDescription _dummyWorld; unsigned _warnings, _failedTests, _testFailedAsserts, _suiteFailedTests, _failedSuites; TestListener *_l; const WorldDescription *_world; const SuiteDescription *_suite; const TestDescription *_test; const TestDescription &dummyTest() const; const SuiteDescription &dummySuite() const; const WorldDescription &dummyWorld() const; void setWorld( const WorldDescription *w ); void setSuite( const SuiteDescription *s ); void setTest( const TestDescription *t ); void countWarning(); void countFailure(); friend class TestRunner; TestTracker(); void initialize(); void setListener( TestListener *l ); }; inline TestTracker &tracker() { return TestTracker::tracker(); } }; #endif // __cxxtest__TestTracker_h__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/ParenPrinter.h0000644000175000017500000000076112320456500024376 0ustar mathieumathieu#ifndef __cxxtest__ParenPrinter_h__ #define __cxxtest__ParenPrinter_h__ // // The ParenPrinter is identical to the ErrorPrinter, except it // prints the line number in a format expected by some compilers // (notably, MSVC). // #include namespace CxxTest { class ParenPrinter : public ErrorPrinter { public: ParenPrinter( CXXTEST_STD(ostream) &o = CXXTEST_STD(cout) ) : ErrorPrinter( o, "(", ")" ) {} }; } #endif // __cxxtest__ParenPrinter_h__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/DummyDescriptions.cpp0000644000175000017500000000505012320456500025776 0ustar mathieumathieu#include namespace CxxTest { DummyTestDescription::DummyTestDescription() {} const char *DummyTestDescription::file() const { return ""; } unsigned DummyTestDescription::line() const { return 0; } const char *DummyTestDescription::testName() const { return ""; } const char *DummyTestDescription::suiteName() const { return ""; } bool DummyTestDescription::setUp() { return true;} void DummyTestDescription::run() {} bool DummyTestDescription::tearDown() { return true;} TestDescription *DummyTestDescription::next() { return 0; } const TestDescription *DummyTestDescription::next() const { return 0; } DummySuiteDescription::DummySuiteDescription() : _test() {} const char *DummySuiteDescription::file() const { return ""; } unsigned DummySuiteDescription::line() const { return 0; } const char *DummySuiteDescription::suiteName() const { return ""; } TestSuite *DummySuiteDescription::suite() const { return 0; } unsigned DummySuiteDescription::numTests() const { return 0; } const TestDescription &DummySuiteDescription::testDescription( unsigned ) const { return _test; } SuiteDescription *DummySuiteDescription::next() { return 0; } TestDescription *DummySuiteDescription::firstTest() { return 0; } const SuiteDescription *DummySuiteDescription::next() const { return 0; } const TestDescription *DummySuiteDescription::firstTest() const { return 0; } void DummySuiteDescription::activateAllTests() {} bool DummySuiteDescription::leaveOnly( const char * /*testName*/ ) { return false; } bool DummySuiteDescription::setUp() { return true;} bool DummySuiteDescription::tearDown() { return true;} DummyWorldDescription::DummyWorldDescription() : _suite() {} unsigned DummyWorldDescription::numSuites( void ) const { return 0; } unsigned DummyWorldDescription::numTotalTests( void ) const { return 0; } const SuiteDescription &DummyWorldDescription::suiteDescription( unsigned ) const { return _suite; } SuiteDescription *DummyWorldDescription::firstSuite() { return 0; } const SuiteDescription *DummyWorldDescription::firstSuite() const { return 0; } void DummyWorldDescription::activateAllTests() {} bool DummyWorldDescription::leaveOnly( const char * /*suiteName*/, const char * /*testName*/ ) { return false; } bool DummyWorldDescription::setUp() { return true;} bool DummyWorldDescription::tearDown() { return true;} } ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/ErrorPrinter.h0000644000175000017500000000310612320456500024416 0ustar mathieumathieu#ifndef __cxxtest__ErrorPrinter_h__ #define __cxxtest__ErrorPrinter_h__ // // The ErrorPrinter is a simple TestListener that // just prints "OK" if everything goes well, otherwise // reports the error in the format of compiler messages. // The ErrorPrinter uses std::cout // #include #ifndef _CXXTEST_HAVE_STD # define _CXXTEST_HAVE_STD #endif // _CXXTEST_HAVE_STD #include #include #ifdef _CXXTEST_OLD_STD # include #else // !_CXXTEST_OLD_STD # include #endif // _CXXTEST_OLD_STD namespace CxxTest { class ErrorPrinter : public ErrorFormatter { public: ErrorPrinter( CXXTEST_STD(ostream) &o = CXXTEST_STD(cout), const char *preLine = ":", const char *postLine = "" ) : ErrorFormatter( new Adapter(o), preLine, postLine ) {} virtual ~ErrorPrinter() { delete outputStream(); } private: class Adapter : public OutputStream { CXXTEST_STD(ostream) &_o; public: Adapter( CXXTEST_STD(ostream) &o ) : _o(o) {} void flush() { _o.flush(); } OutputStream &operator<<( const char *s ) { _o << s; return *this; } OutputStream &operator<<( Manipulator m ) { return OutputStream::operator<<( m ); } OutputStream &operator<<( unsigned i ) { char s[1 + 3 * sizeof(unsigned)]; numberToString( i, s ); _o << s; return *this; } }; }; } #endif // __cxxtest__ErrorPrinter_h__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/Mock.h0000644000175000017500000002627012320456500022661 0ustar mathieumathieu#ifndef __cxxtest__Mock_h__ #define __cxxtest__Mock_h__ // // The default namespace is T:: // #ifndef CXXTEST_MOCK_NAMESPACE # define CXXTEST_MOCK_NAMESPACE T #endif // CXXTEST_MOCK_NAMESPACE // // MockTraits: What to return when no mock object has been created // #define __CXXTEST_MOCK__TRAITS \ namespace CXXTEST_MOCK_NAMESPACE \ { \ template \ class MockTraits \ { \ public: \ static T defaultValue() { return 0; } \ }; \ }; // // extern "C" when needed // #ifdef __cplusplus # define CXXTEST_EXTERN_C extern "C" #else # define CXXTEST_EXTERN_C #endif // __cplusplus // // Prototypes: For "normal" headers // #define __CXXTEST_MOCK__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ namespace CXXTEST_MOCK_NAMESPACE { TYPE NAME ARGS; } #define __CXXTEST_MOCK_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \ __CXXTEST_MOCK__PROTOTYPE( MOCK, void, NAME, ARGS, REAL, CALL ) #define __CXXTEST_SUPPLY__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ TYPE REAL ARGS; #define __CXXTEST_SUPPLY_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \ __CXXTEST_SUPPLY__PROTOTYPE( MOCK, void, NAME, ARGS, REAL, CALL ) // // Class declarations: For test files // #define __CXXTEST_MOCK__CLASS_DECLARATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ namespace CXXTEST_MOCK_NAMESPACE { \ class Base_##MOCK : public CxxTest::Link \ { \ public: \ Base_##MOCK(); \ ~Base_##MOCK(); \ bool setUp(); \ bool tearDown(); \ \ static Base_##MOCK ¤t(); \ \ virtual TYPE NAME ARGS = 0; \ \ private: \ static CxxTest::List _list; \ }; \ \ class Real_##MOCK : public Base_##MOCK \ { \ public: \ TYPE NAME ARGS; \ }; \ \ class _Unimplemented_##MOCK : public Base_##MOCK \ { \ public: \ TYPE NAME ARGS; \ }; \ } #define __CXXTEST_MOCK_VOID__CLASS_DECLARATION( MOCK, NAME, ARGS, REAL, CALL ) \ __CXXTEST_MOCK__CLASS_DECLARATION( MOCK, void, NAME, ARGS, REAL, CALL ) #define __CXXTEST_SUPPLY__CLASS_DECLARATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ namespace CXXTEST_MOCK_NAMESPACE { \ class Base_##MOCK : public CxxTest::Link \ { \ public: \ Base_##MOCK(); \ ~Base_##MOCK(); \ bool setUp(); \ bool tearDown(); \ \ static Base_##MOCK ¤t(); \ \ virtual TYPE NAME ARGS = 0; \ \ private: \ static CxxTest::List _list; \ }; \ \ class _Unimplemented_##MOCK : public Base_##MOCK \ { \ public: \ TYPE NAME ARGS; \ }; \ } #define __CXXTEST_SUPPLY_VOID__CLASS_DECLARATION( MOCK, NAME, ARGS, REAL, CALL ) \ __CXXTEST_SUPPLY__CLASS_DECLARATION( MOCK, void, NAME, ARGS, REAL, CALL ) // // Class implementation: For test source files // #define __CXXTEST_MOCK__COMMON_CLASS_IMPLEMENTATION( MOCK, NAME ) \ namespace CXXTEST_MOCK_NAMESPACE { \ \ CxxTest::List Base_##MOCK::_list = { 0, 0 }; \ \ Base_##MOCK::Base_##MOCK() { attach( _list ); } \ Base_##MOCK::~Base_##MOCK() { detach( _list ); } \ bool Base_##MOCK::setUp() { return true; } \ bool Base_##MOCK::tearDown() { return true; } \ \ Base_##MOCK &Base_##MOCK::current() \ { \ if ( _list.empty() ) \ static _Unimplemented_##MOCK unimplemented; \ return *(Base_##MOCK *)_list.tail(); \ } \ } #define __CXXTEST_MOCK__CLASS_IMPLEMENTATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ __CXXTEST_MOCK__COMMON_CLASS_IMPLEMENTATION( MOCK, NAME ) \ namespace CXXTEST_MOCK_NAMESPACE { \ TYPE Real_##MOCK::NAME ARGS \ { \ return REAL CALL; \ } \ \ TYPE _Unimplemented_##MOCK::NAME ARGS \ { \ while ( false ) \ return NAME CALL; \ __CXXTEST_MOCK_UNIMPLEMENTED( NAME, ARGS ); \ return MockTraits::defaultValue(); \ } \ \ TYPE NAME ARGS \ { \ return Base_##MOCK::current().NAME CALL; \ } \ } #define __CXXTEST_MOCK_VOID__CLASS_IMPLEMENTATION( MOCK, NAME, ARGS, REAL, CALL ) \ __CXXTEST_MOCK__COMMON_CLASS_IMPLEMENTATION( MOCK, NAME ) \ namespace CXXTEST_MOCK_NAMESPACE { \ void Real_##MOCK::NAME ARGS \ { \ REAL CALL; \ } \ \ void _Unimplemented_##MOCK::NAME ARGS \ { \ while ( false ) \ NAME CALL; \ __CXXTEST_MOCK_UNIMPLEMENTED( NAME, ARGS ); \ } \ \ void NAME ARGS \ { \ Base_##MOCK::current().NAME CALL; \ } \ } #define __CXXTEST_SUPPLY__CLASS_IMPLEMENTATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ __CXXTEST_MOCK__COMMON_CLASS_IMPLEMENTATION( MOCK, NAME ) \ namespace CXXTEST_MOCK_NAMESPACE { \ TYPE _Unimplemented_##MOCK::NAME ARGS \ { \ while ( false ) \ return NAME CALL; \ __CXXTEST_MOCK_UNIMPLEMENTED( NAME, ARGS ); \ return MockTraits::defaultValue(); \ } \ } \ \ TYPE REAL ARGS \ { \ return CXXTEST_MOCK_NAMESPACE::Base_##MOCK::current().NAME CALL; \ } #define __CXXTEST_SUPPLY_VOID__CLASS_IMPLEMENTATION( MOCK, NAME, ARGS, REAL, CALL ) \ __CXXTEST_MOCK__COMMON_CLASS_IMPLEMENTATION( MOCK, NAME ) \ namespace CXXTEST_MOCK_NAMESPACE { \ void _Unimplemented_##MOCK::NAME ARGS \ { \ while ( false ) \ NAME CALL; \ __CXXTEST_MOCK_UNIMPLEMENTED( NAME, ARGS ); \ } \ } \ \ void REAL ARGS \ { \ CXXTEST_MOCK_NAMESPACE::Base_##MOCK::current().NAME CALL; \ } \ // // Error for calling mock function w/o object // #define __CXXTEST_MOCK_UNIMPLEMENTED( NAME, ARGS ) \ TS_FAIL( CXXTEST_MOCK_NAMESPACE_STR #NAME #ARGS " called with no " \ CXXTEST_MOCK_NAMESPACE_STR "Base_" #NAME " object" ); \ #define CXXTEST_MOCK_NAMESPACE_STR __CXXTEST_STR(CXXTEST_MOCK_NAMESPACE) "::" #define __CXXTEST_STR(X) __CXXTEST_XSTR(X) #define __CXXTEST_XSTR(X) #X #if defined(CXXTEST_MOCK_TEST_SOURCE_FILE) // // Test source file: Prototypes, class declarations and implementation // #include __CXXTEST_MOCK__TRAITS; #define CXXTEST_MOCK( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ __CXXTEST_MOCK__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ __CXXTEST_MOCK__CLASS_DECLARATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ __CXXTEST_MOCK__CLASS_IMPLEMENTATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) #define CXXTEST_MOCK_VOID( MOCK, NAME, ARGS, REAL, CALL ) \ __CXXTEST_MOCK_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \ __CXXTEST_MOCK_VOID__CLASS_DECLARATION( MOCK, NAME, ARGS, REAL, CALL ) \ __CXXTEST_MOCK_VOID__CLASS_IMPLEMENTATION( MOCK, NAME, ARGS, REAL, CALL ) #define CXXTEST_SUPPLY( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ __CXXTEST_SUPPLY__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ __CXXTEST_SUPPLY__CLASS_DECLARATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ __CXXTEST_SUPPLY__CLASS_IMPLEMENTATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) #define CXXTEST_SUPPLY_VOID( MOCK, NAME, ARGS, REAL, CALL ) \ __CXXTEST_SUPPLY_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \ __CXXTEST_SUPPLY_VOID__CLASS_DECLARATION( MOCK, NAME, ARGS, REAL, CALL ) \ __CXXTEST_SUPPLY_VOID__CLASS_IMPLEMENTATION( MOCK, NAME, ARGS, REAL, CALL ) #elif defined(CXXTEST_FLAGS) || defined(CXXTEST_RUNNING) // // Test file other than source: Prototypes and class declarations // #include __CXXTEST_MOCK__TRAITS; #define CXXTEST_MOCK( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ __CXXTEST_MOCK__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ __CXXTEST_MOCK__CLASS_DECLARATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) #define CXXTEST_MOCK_VOID( MOCK, NAME, ARGS, REAL, CALL ) \ __CXXTEST_MOCK_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \ __CXXTEST_MOCK_VOID__CLASS_DECLARATION( MOCK, NAME, ARGS, REAL, CALL ) #define CXXTEST_SUPPLY( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ __CXXTEST_SUPPLY__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ __CXXTEST_SUPPLY__CLASS_DECLARATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) #define CXXTEST_SUPPLY_VOID( MOCK, NAME, ARGS, REAL, CALL ) \ __CXXTEST_SUPPLY_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \ __CXXTEST_SUPPLY_VOID__CLASS_DECLARATION( MOCK, NAME, ARGS, REAL, CALL ) #elif defined(CXXTEST_MOCK_REAL_SOURCE_FILE) // // Real source file: "Real" implementations // #define CXXTEST_MOCK( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ namespace CXXTEST_MOCK_NAMESPACE { TYPE NAME ARGS { return REAL CALL; } } #define CXXTEST_MOCK_VOID( MOCK, NAME, ARGS, REAL, CALL ) \ namespace CXXTEST_MOCK_NAMESPACE { void NAME ARGS { REAL CALL; } } #else // // Ordinary header file: Just prototypes // #define CXXTEST_MOCK( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ __CXXTEST_MOCK__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) #define CXXTEST_MOCK_VOID( MOCK, NAME, ARGS, REAL, CALL ) \ __CXXTEST_MOCK_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) #define CXXTEST_SUPPLY( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ __CXXTEST_SUPPLY__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) #define CXXTEST_SUPPLY_VOID( MOCK, NAME, ARGS, REAL, CALL ) \ __CXXTEST_SUPPLY_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) #endif // Ordinary header file // // How to supply extern "C" functions // #define CXXTEST_SUPPLY_C( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ CXXTEST_EXTERN_C __CXXTEST_SUPPLY__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ CXXTEST_SUPPLY( MOCK, TYPE, NAME, ARGS, REAL, CALL ) #define CXXTEST_SUPPLY_VOID_C( MOCK, NAME, ARGS, REAL, CALL ) \ CXXTEST_EXTERN_C __CXXTEST_SUPPLY_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \ CXXTEST_SUPPLY_VOID( MOCK, NAME, ARGS, REAL, CALL ) // // Usually we mean the global namespace // #define CXXTEST_MOCK_GLOBAL( TYPE, NAME, ARGS, CALL ) \ CXXTEST_MOCK( NAME, TYPE, NAME, ARGS, ::NAME, CALL ) #define CXXTEST_MOCK_VOID_GLOBAL( NAME, ARGS, CALL ) \ CXXTEST_MOCK_VOID( NAME, NAME, ARGS, ::NAME, CALL ) #define CXXTEST_SUPPLY_GLOBAL( TYPE, NAME, ARGS, CALL ) \ CXXTEST_SUPPLY( NAME, TYPE, NAME, ARGS, NAME, CALL ) #define CXXTEST_SUPPLY_VOID_GLOBAL( NAME, ARGS, CALL ) \ CXXTEST_SUPPLY_VOID( NAME, NAME, ARGS, NAME, CALL ) #define CXXTEST_SUPPLY_GLOBAL_C( TYPE, NAME, ARGS, CALL ) \ CXXTEST_SUPPLY_C( NAME, TYPE, NAME, ARGS, NAME, CALL ) #define CXXTEST_SUPPLY_VOID_GLOBAL_C( NAME, ARGS, CALL ) \ CXXTEST_SUPPLY_VOID_C( NAME, NAME, ARGS, NAME, CALL ) // // What to return when no mock object has been created. // The default value of 0 usually works, but some cases may need this. // #define CXXTEST_MOCK_DEFAULT_VALUE( TYPE, VALUE ) \ namespace CXXTEST_MOCK_NAMESPACE \ { \ template<> \ class MockTraits \ { \ public: \ static TYPE defaultValue() { return VALUE; } \ }; \ } #endif // __cxxtest__Mock_h__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/TestSuite.h0000644000175000017500000005514112320456500023720 0ustar mathieumathieu#ifndef __cxxtest__TestSuite_h__ #define __cxxtest__TestSuite_h__ // // class TestSuite is the base class for all test suites. // To define a test suite, derive from this class and add // member functions called void test*(); // #include #include #include #include #ifdef _CXXTEST_HAVE_STD # include #endif // _CXXTEST_HAVE_STD namespace CxxTest { class TestSuite { public: virtual ~TestSuite(); virtual void setUp(); virtual void tearDown(); }; class AbortTest {}; void doAbortTest(); # define TS_ABORT() CxxTest::doAbortTest() bool abortTestOnFail(); void setAbortTestOnFail( bool value = CXXTEST_DEFAULT_ABORT ); unsigned maxDumpSize(); void setMaxDumpSize( unsigned value = CXXTEST_MAX_DUMP_SIZE ); void doTrace( const char *file, unsigned line, const char *message ); void doWarn( const char *file, unsigned line, const char *message ); void doFailTest( const char *file, unsigned line, const char *message ); void doFailAssert( const char *file, unsigned line, const char *expression, const char *message ); template bool equals( X x, Y y ) { return (x == y); } template void doAssertEquals( const char *file, unsigned line, const char *xExpr, X x, const char *yExpr, Y y, const char *message ) { if ( !equals( x, y ) ) { if ( message ) tracker().failedTest( file, line, message ); tracker().failedAssertEquals( file, line, xExpr, yExpr, TS_AS_STRING(x), TS_AS_STRING(y) ); TS_ABORT(); } } void doAssertSameData( const char *file, unsigned line, const char *xExpr, const void *x, const char *yExpr, const void *y, const char *sizeExpr, unsigned size, const char *message ); template bool differs( X x, Y y ) { return !(x == y); } template void doAssertDiffers( const char *file, unsigned line, const char *xExpr, X x, const char *yExpr, Y y, const char *message ) { if ( !differs( x, y ) ) { if ( message ) tracker().failedTest( file, line, message ); tracker().failedAssertDiffers( file, line, xExpr, yExpr, TS_AS_STRING(x) ); TS_ABORT(); } } template bool lessThan( X x, Y y ) { return (x < y); } template void doAssertLessThan( const char *file, unsigned line, const char *xExpr, X x, const char *yExpr, Y y, const char *message ) { if ( !lessThan(x, y) ) { if ( message ) tracker().failedTest( file, line, message ); tracker().failedAssertLessThan( file, line, xExpr, yExpr, TS_AS_STRING(x), TS_AS_STRING(y) ); TS_ABORT(); } } template bool lessThanEquals( X x, Y y ) { return (x <= y); } template void doAssertLessThanEquals( const char *file, unsigned line, const char *xExpr, X x, const char *yExpr, Y y, const char *message ) { if ( !lessThanEquals( x, y ) ) { if ( message ) tracker().failedTest( file, line, message ); tracker().failedAssertLessThanEquals( file, line, xExpr, yExpr, TS_AS_STRING(x), TS_AS_STRING(y) ); TS_ABORT(); } } template void doAssertPredicate( const char *file, unsigned line, const char *pExpr, const P &p, const char *xExpr, X x, const char *message ) { if ( !p( x ) ) { if ( message ) tracker().failedTest( file, line, message ); tracker().failedAssertPredicate( file, line, pExpr, xExpr, TS_AS_STRING(x) ); TS_ABORT(); } } template void doAssertRelation( const char *file, unsigned line, const char *rExpr, const R &r, const char *xExpr, X x, const char *yExpr, Y y, const char *message ) { if ( !r( x, y ) ) { if ( message ) tracker().failedTest( file, line, message ); tracker().failedAssertRelation( file, line, rExpr, xExpr, yExpr, TS_AS_STRING(x), TS_AS_STRING(y) ); TS_ABORT(); } } template bool delta( X x, Y y, D d ) { return ((y >= x - d) && (y <= x + d)); } template void doAssertDelta( const char *file, unsigned line, const char *xExpr, X x, const char *yExpr, Y y, const char *dExpr, D d, const char *message ) { if ( !delta( x, y, d ) ) { if ( message ) tracker().failedTest( file, line, message ); tracker().failedAssertDelta( file, line, xExpr, yExpr, dExpr, TS_AS_STRING(x), TS_AS_STRING(y), TS_AS_STRING(d) ); TS_ABORT(); } } void doFailAssertThrows( const char *file, unsigned line, const char *expr, const char *type, bool otherThrown, const char *message ); void doFailAssertThrowsNot( const char *file, unsigned line, const char *expression, const char *message ); # ifdef _CXXTEST_HAVE_EH # define _TS_TRY try # define _TS_CATCH_TYPE(t, b) catch t b # define _TS_CATCH_ABORT(b) _TS_CATCH_TYPE( (const CxxTest::AbortTest &), b ) # define _TS_LAST_CATCH(b) _TS_CATCH_TYPE( (...), b ) # define _TSM_LAST_CATCH(f,l,m) _TS_LAST_CATCH( { (CxxTest::tracker()).failedTest(f,l,m); } ) # ifdef _CXXTEST_HAVE_STD # define ___TSM_CATCH(f,l,m) \ catch(const std::exception &e) { (CxxTest::tracker()).failedTest(f,l,e.what()); } \ _TSM_LAST_CATCH(f,l,m) # else // !_CXXTEST_HAVE_STD # define ___TSM_CATCH(f,l,m) _TSM_LAST_CATCH(f,l,m) # endif // _CXXTEST_HAVE_STD # define __TSM_CATCH(f,l,m) \ _TS_CATCH_ABORT( { throw; } ) \ ___TSM_CATCH(f,l,m) # define __TS_CATCH(f,l) __TSM_CATCH(f,l,"Unhandled exception") # define _TS_CATCH __TS_CATCH(__FILE__,__LINE__) # else // !_CXXTEST_HAVE_EH # define _TS_TRY # define ___TSM_CATCH(f,l,m) # define __TSM_CATCH(f,l,m) # define __TS_CATCH(f,l) # define _TS_CATCH # define _TS_CATCH_TYPE(t, b) # define _TS_LAST_CATCH(b) # define _TS_CATCH_ABORT(b) # endif // _CXXTEST_HAVE_EH // TS_TRACE # define _TS_TRACE(f,l,e) CxxTest::doTrace( (f), (l), TS_AS_STRING(e) ) # define TS_TRACE(e) _TS_TRACE( __FILE__, __LINE__, e ) // TS_WARN # define _TS_WARN(f,l,e) CxxTest::doWarn( (f), (l), TS_AS_STRING(e) ) # define TS_WARN(e) _TS_WARN( __FILE__, __LINE__, e ) // TS_FAIL # define _TS_FAIL(f,l,e) CxxTest::doFailTest( (f), (l), TS_AS_STRING(e) ) # define TS_FAIL(e) _TS_FAIL( __FILE__, __LINE__, e ) // TS_ASSERT # define ___ETS_ASSERT(f,l,e,m) { if ( !(e) ) CxxTest::doFailAssert( (f), (l), #e, (m) ); } # define ___TS_ASSERT(f,l,e,m) { _TS_TRY { ___ETS_ASSERT(f,l,e,m); } __TS_CATCH(f,l) } # define _ETS_ASSERT(f,l,e) ___ETS_ASSERT(f,l,e,0) # define _TS_ASSERT(f,l,e) ___TS_ASSERT(f,l,e,0) # define ETS_ASSERT(e) _ETS_ASSERT(__FILE__,__LINE__,e) # define TS_ASSERT(e) _TS_ASSERT(__FILE__,__LINE__,e) # define _ETSM_ASSERT(f,l,m,e) ___ETS_ASSERT(f,l,e,TS_AS_STRING(m) ) # define _TSM_ASSERT(f,l,m,e) ___TS_ASSERT(f,l,e,TS_AS_STRING(m) ) # define ETSM_ASSERT(m,e) _ETSM_ASSERT(__FILE__,__LINE__,m,e) # define TSM_ASSERT(m,e) _TSM_ASSERT(__FILE__,__LINE__,m,e) // TS_ASSERT_EQUALS # define ___ETS_ASSERT_EQUALS(f,l,x,y,m) CxxTest::doAssertEquals( (f), (l), #x, (x), #y, (y), (m) ) # define ___TS_ASSERT_EQUALS(f,l,x,y,m) { _TS_TRY { ___ETS_ASSERT_EQUALS(f,l,x,y,m); } __TS_CATCH(f,l) } # define _ETS_ASSERT_EQUALS(f,l,x,y) ___ETS_ASSERT_EQUALS(f,l,x,y,0) # define _TS_ASSERT_EQUALS(f,l,x,y) ___TS_ASSERT_EQUALS(f,l,x,y,0) # define ETS_ASSERT_EQUALS(x,y) _ETS_ASSERT_EQUALS(__FILE__,__LINE__,x,y) # define TS_ASSERT_EQUALS(x,y) _TS_ASSERT_EQUALS(__FILE__,__LINE__,x,y) # define _ETSM_ASSERT_EQUALS(f,l,m,x,y) ___ETS_ASSERT_EQUALS(f,l,x,y,TS_AS_STRING(m)) # define _TSM_ASSERT_EQUALS(f,l,m,x,y) ___TS_ASSERT_EQUALS(f,l,x,y,TS_AS_STRING(m)) # define ETSM_ASSERT_EQUALS(m,x,y) _ETSM_ASSERT_EQUALS(__FILE__,__LINE__,m,x,y) # define TSM_ASSERT_EQUALS(m,x,y) _TSM_ASSERT_EQUALS(__FILE__,__LINE__,m,x,y) // TS_ASSERT_SAME_DATA # define ___ETS_ASSERT_SAME_DATA(f,l,x,y,s,m) CxxTest::doAssertSameData( (f), (l), #x, (x), #y, (y), #s, (s), (m) ) # define ___TS_ASSERT_SAME_DATA(f,l,x,y,s,m) { _TS_TRY { ___ETS_ASSERT_SAME_DATA(f,l,x,y,s,m); } __TS_CATCH(f,l) } # define _ETS_ASSERT_SAME_DATA(f,l,x,y,s) ___ETS_ASSERT_SAME_DATA(f,l,x,y,s,0) # define _TS_ASSERT_SAME_DATA(f,l,x,y,s) ___TS_ASSERT_SAME_DATA(f,l,x,y,s,0) # define ETS_ASSERT_SAME_DATA(x,y,s) _ETS_ASSERT_SAME_DATA(__FILE__,__LINE__,x,y,s) # define TS_ASSERT_SAME_DATA(x,y,s) _TS_ASSERT_SAME_DATA(__FILE__,__LINE__,x,y,s) # define _ETSM_ASSERT_SAME_DATA(f,l,m,x,y,s) ___ETS_ASSERT_SAME_DATA(f,l,x,y,s,TS_AS_STRING(m)) # define _TSM_ASSERT_SAME_DATA(f,l,m,x,y,s) ___TS_ASSERT_SAME_DATA(f,l,x,y,s,TS_AS_STRING(m)) # define ETSM_ASSERT_SAME_DATA(m,x,y,s) _ETSM_ASSERT_SAME_DATA(__FILE__,__LINE__,m,x,y,s) # define TSM_ASSERT_SAME_DATA(m,x,y,s) _TSM_ASSERT_SAME_DATA(__FILE__,__LINE__,m,x,y,s) // TS_ASSERT_DIFFERS # define ___ETS_ASSERT_DIFFERS(f,l,x,y,m) CxxTest::doAssertDiffers( (f), (l), #x, (x), #y, (y), (m) ) # define ___TS_ASSERT_DIFFERS(f,l,x,y,m) { _TS_TRY { ___ETS_ASSERT_DIFFERS(f,l,x,y,m); } __TS_CATCH(f,l) } # define _ETS_ASSERT_DIFFERS(f,l,x,y) ___ETS_ASSERT_DIFFERS(f,l,x,y,0) # define _TS_ASSERT_DIFFERS(f,l,x,y) ___TS_ASSERT_DIFFERS(f,l,x,y,0) # define ETS_ASSERT_DIFFERS(x,y) _ETS_ASSERT_DIFFERS(__FILE__,__LINE__,x,y) # define TS_ASSERT_DIFFERS(x,y) _TS_ASSERT_DIFFERS(__FILE__,__LINE__,x,y) # define _ETSM_ASSERT_DIFFERS(f,l,m,x,y) ___ETS_ASSERT_DIFFERS(f,l,x,y,TS_AS_STRING(m)) # define _TSM_ASSERT_DIFFERS(f,l,m,x,y) ___TS_ASSERT_DIFFERS(f,l,x,y,TS_AS_STRING(m)) # define ETSM_ASSERT_DIFFERS(m,x,y) _ETSM_ASSERT_DIFFERS(__FILE__,__LINE__,m,x,y) # define TSM_ASSERT_DIFFERS(m,x,y) _TSM_ASSERT_DIFFERS(__FILE__,__LINE__,m,x,y) // TS_ASSERT_LESS_THAN # define ___ETS_ASSERT_LESS_THAN(f,l,x,y,m) CxxTest::doAssertLessThan( (f), (l), #x, (x), #y, (y), (m) ) # define ___TS_ASSERT_LESS_THAN(f,l,x,y,m) { _TS_TRY { ___ETS_ASSERT_LESS_THAN(f,l,x,y,m); } __TS_CATCH(f,l) } # define _ETS_ASSERT_LESS_THAN(f,l,x,y) ___ETS_ASSERT_LESS_THAN(f,l,x,y,0) # define _TS_ASSERT_LESS_THAN(f,l,x,y) ___TS_ASSERT_LESS_THAN(f,l,x,y,0) # define ETS_ASSERT_LESS_THAN(x,y) _ETS_ASSERT_LESS_THAN(__FILE__,__LINE__,x,y) # define TS_ASSERT_LESS_THAN(x,y) _TS_ASSERT_LESS_THAN(__FILE__,__LINE__,x,y) # define _ETSM_ASSERT_LESS_THAN(f,l,m,x,y) ___ETS_ASSERT_LESS_THAN(f,l,x,y,TS_AS_STRING(m)) # define _TSM_ASSERT_LESS_THAN(f,l,m,x,y) ___TS_ASSERT_LESS_THAN(f,l,x,y,TS_AS_STRING(m)) # define ETSM_ASSERT_LESS_THAN(m,x,y) _ETSM_ASSERT_LESS_THAN(__FILE__,__LINE__,m,x,y) # define TSM_ASSERT_LESS_THAN(m,x,y) _TSM_ASSERT_LESS_THAN(__FILE__,__LINE__,m,x,y) // TS_ASSERT_LESS_THAN_EQUALS # define ___ETS_ASSERT_LESS_THAN_EQUALS(f,l,x,y,m) \ CxxTest::doAssertLessThanEquals( (f), (l), #x, (x), #y, (y), (m) ) # define ___TS_ASSERT_LESS_THAN_EQUALS(f,l,x,y,m) \ { _TS_TRY { ___ETS_ASSERT_LESS_THAN_EQUALS(f,l,x,y,m); } __TS_CATCH(f,l) } # define _ETS_ASSERT_LESS_THAN_EQUALS(f,l,x,y) ___ETS_ASSERT_LESS_THAN_EQUALS(f,l,x,y,0) # define _TS_ASSERT_LESS_THAN_EQUALS(f,l,x,y) ___TS_ASSERT_LESS_THAN_EQUALS(f,l,x,y,0) # define ETS_ASSERT_LESS_THAN_EQUALS(x,y) _ETS_ASSERT_LESS_THAN_EQUALS(__FILE__,__LINE__,x,y) # define TS_ASSERT_LESS_THAN_EQUALS(x,y) _TS_ASSERT_LESS_THAN_EQUALS(__FILE__,__LINE__,x,y) # define _ETSM_ASSERT_LESS_THAN_EQUALS(f,l,m,x,y) ___ETS_ASSERT_LESS_THAN_EQUALS(f,l,x,y,TS_AS_STRING(m)) # define _TSM_ASSERT_LESS_THAN_EQUALS(f,l,m,x,y) ___TS_ASSERT_LESS_THAN_EQUALS(f,l,x,y,TS_AS_STRING(m)) # define ETSM_ASSERT_LESS_THAN_EQUALS(m,x,y) _ETSM_ASSERT_LESS_THAN_EQUALS(__FILE__,__LINE__,m,x,y) # define TSM_ASSERT_LESS_THAN_EQUALS(m,x,y) _TSM_ASSERT_LESS_THAN_EQUALS(__FILE__,__LINE__,m,x,y) // TS_ASSERT_PREDICATE # define ___ETS_ASSERT_PREDICATE(f,l,p,x,m) \ CxxTest::doAssertPredicate( (f), (l), #p, p(), #x, (x), (m) ) # define ___TS_ASSERT_PREDICATE(f,l,p,x,m) \ { _TS_TRY { ___ETS_ASSERT_PREDICATE(f,l,p,x,m); } __TS_CATCH(f,l) } # define _ETS_ASSERT_PREDICATE(f,l,p,x) ___ETS_ASSERT_PREDICATE(f,l,p,x,0) # define _TS_ASSERT_PREDICATE(f,l,p,x) ___TS_ASSERT_PREDICATE(f,l,p,x,0) # define ETS_ASSERT_PREDICATE(p,x) _ETS_ASSERT_PREDICATE(__FILE__,__LINE__,p,x) # define TS_ASSERT_PREDICATE(p,x) _TS_ASSERT_PREDICATE(__FILE__,__LINE__,p,x) # define _ETSM_ASSERT_PREDICATE(f,l,m,p,x) ___ETS_ASSERT_PREDICATE(f,l,p,x,TS_AS_STRING(m)) # define _TSM_ASSERT_PREDICATE(f,l,m,p,x) ___TS_ASSERT_PREDICATE(f,l,p,x,TS_AS_STRING(m)) # define ETSM_ASSERT_PREDICATE(m,p,x) _ETSM_ASSERT_PREDICATE(__FILE__,__LINE__,m,p,x) # define TSM_ASSERT_PREDICATE(m,p,x) _TSM_ASSERT_PREDICATE(__FILE__,__LINE__,m,p,x) // TS_ASSERT_RELATION # define ___ETS_ASSERT_RELATION(f,l,r,x,y,m) \ CxxTest::doAssertRelation( (f), (l), #r, r(), #x, (x), #y, (y), (m) ) # define ___TS_ASSERT_RELATION(f,l,r,x,y,m) \ { _TS_TRY { ___ETS_ASSERT_RELATION(f,l,r,x,y,m); } __TS_CATCH(f,l) } # define _ETS_ASSERT_RELATION(f,l,r,x,y) ___ETS_ASSERT_RELATION(f,l,r,x,y,0) # define _TS_ASSERT_RELATION(f,l,r,x,y) ___TS_ASSERT_RELATION(f,l,r,x,y,0) # define ETS_ASSERT_RELATION(r,x,y) _ETS_ASSERT_RELATION(__FILE__,__LINE__,r,x,y) # define TS_ASSERT_RELATION(r,x,y) _TS_ASSERT_RELATION(__FILE__,__LINE__,r,x,y) # define _ETSM_ASSERT_RELATION(f,l,m,r,x,y) ___ETS_ASSERT_RELATION(f,l,r,x,y,TS_AS_STRING(m)) # define _TSM_ASSERT_RELATION(f,l,m,r,x,y) ___TS_ASSERT_RELATION(f,l,r,x,y,TS_AS_STRING(m)) # define ETSM_ASSERT_RELATION(m,r,x,y) _ETSM_ASSERT_RELATION(__FILE__,__LINE__,m,r,x,y) # define TSM_ASSERT_RELATION(m,r,x,y) _TSM_ASSERT_RELATION(__FILE__,__LINE__,m,r,x,y) // TS_ASSERT_DELTA # define ___ETS_ASSERT_DELTA(f,l,x,y,d,m) CxxTest::doAssertDelta( (f), (l), #x, (x), #y, (y), #d, (d), (m) ) # define ___TS_ASSERT_DELTA(f,l,x,y,d,m) { _TS_TRY { ___ETS_ASSERT_DELTA(f,l,x,y,d,m); } __TS_CATCH(f,l) } # define _ETS_ASSERT_DELTA(f,l,x,y,d) ___ETS_ASSERT_DELTA(f,l,x,y,d,0) # define _TS_ASSERT_DELTA(f,l,x,y,d) ___TS_ASSERT_DELTA(f,l,x,y,d,0) # define ETS_ASSERT_DELTA(x,y,d) _ETS_ASSERT_DELTA(__FILE__,__LINE__,x,y,d) # define TS_ASSERT_DELTA(x,y,d) _TS_ASSERT_DELTA(__FILE__,__LINE__,x,y,d) # define _ETSM_ASSERT_DELTA(f,l,m,x,y,d) ___ETS_ASSERT_DELTA(f,l,x,y,d,TS_AS_STRING(m)) # define _TSM_ASSERT_DELTA(f,l,m,x,y,d) ___TS_ASSERT_DELTA(f,l,x,y,d,TS_AS_STRING(m)) # define ETSM_ASSERT_DELTA(m,x,y,d) _ETSM_ASSERT_DELTA(__FILE__,__LINE__,m,x,y,d) # define TSM_ASSERT_DELTA(m,x,y,d) _TSM_ASSERT_DELTA(__FILE__,__LINE__,m,x,y,d) // TS_ASSERT_THROWS # define ___TS_ASSERT_THROWS(f,l,e,t,m) { \ bool _ts_threw_expected = false, _ts_threw_else = false; \ _TS_TRY { e; } \ _TS_CATCH_TYPE( (t), { _ts_threw_expected = true; } ) \ _TS_CATCH_ABORT( { throw; } ) \ _TS_LAST_CATCH( { _ts_threw_else = true; } ) \ if ( !_ts_threw_expected ) { CxxTest::doFailAssertThrows( (f), (l), #e, #t, _ts_threw_else, (m) ); } } # define _TS_ASSERT_THROWS(f,l,e,t) ___TS_ASSERT_THROWS(f,l,e,t,0) # define TS_ASSERT_THROWS(e,t) _TS_ASSERT_THROWS(__FILE__,__LINE__,e,t) # define _TSM_ASSERT_THROWS(f,l,m,e,t) ___TS_ASSERT_THROWS(f,l,e,t,TS_AS_STRING(m)) # define TSM_ASSERT_THROWS(m,e,t) _TSM_ASSERT_THROWS(__FILE__,__LINE__,m,e,t) // TS_ASSERT_THROWS_ASSERT # define ___TS_ASSERT_THROWS_ASSERT(f,l,e,t,a,m) { \ bool _ts_threw_expected = false, _ts_threw_else = false; \ _TS_TRY { e; } \ _TS_CATCH_TYPE( (t), { a; _ts_threw_expected = true; } ) \ _TS_CATCH_ABORT( { throw; } ) \ _TS_LAST_CATCH( { _ts_threw_else = true; } ) \ if ( !_ts_threw_expected ) { CxxTest::doFailAssertThrows( (f), (l), #e, #t, _ts_threw_else, (m) ); } } # define _TS_ASSERT_THROWS_ASSERT(f,l,e,t,a) ___TS_ASSERT_THROWS_ASSERT(f,l,e,t,a,0) # define TS_ASSERT_THROWS_ASSERT(e,t,a) _TS_ASSERT_THROWS_ASSERT(__FILE__,__LINE__,e,t,a) # define _TSM_ASSERT_THROWS_ASSERT(f,l,m,e,t,a) ___TS_ASSERT_THROWS_ASSERT(f,l,e,t,a,TS_AS_STRING(m)) # define TSM_ASSERT_THROWS_ASSERT(m,e,t,a) _TSM_ASSERT_THROWS_ASSERT(__FILE__,__LINE__,m,e,t,a) // TS_ASSERT_THROWS_EQUALS # define TS_ASSERT_THROWS_EQUALS(e,t,x,y) TS_ASSERT_THROWS_ASSERT(e,t,TS_ASSERT_EQUALS(x,y)) # define TSM_ASSERT_THROWS_EQUALS(m,e,t,x,y) TSM_ASSERT_THROWS_ASSERT(m,e,t,TSM_ASSERT_EQUALS(m,x,y)) // TS_ASSERT_THROWS_DIFFERS # define TS_ASSERT_THROWS_DIFFERS(e,t,x,y) TS_ASSERT_THROWS_ASSERT(e,t,TS_ASSERT_DIFFERS(x,y)) # define TSM_ASSERT_THROWS_DIFFERS(m,e,t,x,y) TSM_ASSERT_THROWS_ASSERT(m,e,t,TSM_ASSERT_DIFFERS(m,x,y)) // TS_ASSERT_THROWS_DELTA # define TS_ASSERT_THROWS_DELTA(e,t,x,y,d) TS_ASSERT_THROWS_ASSERT(e,t,TS_ASSERT_DELTA(x,y,d)) # define TSM_ASSERT_THROWS_DELTA(m,e,t,x,y,d) TSM_ASSERT_THROWS_ASSERT(m,e,t,TSM_ASSERT_DELTA(m,x,y,d)) // TS_ASSERT_THROWS_SAME_DATA # define TS_ASSERT_THROWS_SAME_DATA(e,t,x,y,s) TS_ASSERT_THROWS_ASSERT(e,t,TS_ASSERT_SAME_DATA(x,y,s)) # define TSM_ASSERT_THROWS_SAME_DATA(m,e,t,x,y,s) TSM_ASSERT_THROWS_ASSERT(m,e,t,TSM_ASSERT_SAME_DATA(m,x,y,s)) // TS_ASSERT_THROWS_LESS_THAN # define TS_ASSERT_THROWS_LESS_THAN(e,t,x,y) TS_ASSERT_THROWS_ASSERT(e,t,TS_ASSERT_LESS_THAN(x,y)) # define TSM_ASSERT_THROWS_LESS_THAN(m,e,t,x,y) TSM_ASSERT_THROWS_ASSERT(m,e,t,TSM_ASSERT_LESS_THAN(m,x,y)) // TS_ASSERT_THROWS_LESS_THAN_EQUALS # define TS_ASSERT_THROWS_LESS_THAN_EQUALS(e,t,x,y) TS_ASSERT_THROWS_ASSERT(e,t,TS_ASSERT_LESS_THAN_EQUALS(x,y)) # define TSM_ASSERT_THROWS_LESS_THAN_EQUALS(m,e,t,x,y) TSM_ASSERT_THROWS_ASSERT(m,e,t,TSM_ASSERT_LESS_THAN_EQUALS(m,x,y)) // TS_ASSERT_THROWS_PREDICATE # define TS_ASSERT_THROWS_PREDICATE(e,t,p,v) TS_ASSERT_THROWS_ASSERT(e,t,TS_ASSERT_PREDICATE(p,v)) # define TSM_ASSERT_THROWS_PREDICATE(m,e,t,p,v) TSM_ASSERT_THROWS_ASSERT(m,e,t,TSM_ASSERT_PREDICATE(m,p,v)) // TS_ASSERT_THROWS_RELATION # define TS_ASSERT_THROWS_RELATION(e,t,r,x,y) TS_ASSERT_THROWS_ASSERT(e,t,TS_ASSERT_RELATION(r,x,y)) # define TSM_ASSERT_THROWS_RELATION(m,e,t,r,x,y) TSM_ASSERT_THROWS_ASSERT(m,e,t,TSM_ASSERT_RELATION(m,r,x,y)) // TS_ASSERT_THROWS_ANYTHING # define ___TS_ASSERT_THROWS_ANYTHING(f,l,e,m) { \ bool _ts_threw = false; \ _TS_TRY { e; } \ _TS_LAST_CATCH( { _ts_threw = true; } ) \ if ( !_ts_threw ) { CxxTest::doFailAssertThrows( (f), (l), #e, "...", false, (m) ); } } # define _TS_ASSERT_THROWS_ANYTHING(f,l,e) ___TS_ASSERT_THROWS_ANYTHING(f,l,e,0) # define TS_ASSERT_THROWS_ANYTHING(e) _TS_ASSERT_THROWS_ANYTHING(__FILE__, __LINE__, e) # define _TSM_ASSERT_THROWS_ANYTHING(f,l,m,e) ___TS_ASSERT_THROWS_ANYTHING(f,l,e,TS_AS_STRING(m)) # define TSM_ASSERT_THROWS_ANYTHING(m,e) _TSM_ASSERT_THROWS_ANYTHING(__FILE__,__LINE__,m,e) // TS_ASSERT_THROWS_NOTHING # define ___TS_ASSERT_THROWS_NOTHING(f,l,e,m) { \ _TS_TRY { e; } \ _TS_CATCH_ABORT( { throw; } ) \ _TS_LAST_CATCH( { CxxTest::doFailAssertThrowsNot( (f), (l), #e, (m) ); } ) } # define _TS_ASSERT_THROWS_NOTHING(f,l,e) ___TS_ASSERT_THROWS_NOTHING(f,l,e,0) # define TS_ASSERT_THROWS_NOTHING(e) _TS_ASSERT_THROWS_NOTHING(__FILE__,__LINE__,e) # define _TSM_ASSERT_THROWS_NOTHING(f,l,m,e) ___TS_ASSERT_THROWS_NOTHING(f,l,e,TS_AS_STRING(m)) # define TSM_ASSERT_THROWS_NOTHING(m,e) _TSM_ASSERT_THROWS_NOTHING(__FILE__,__LINE__,m,e) // // This takes care of "signed <-> unsigned" warnings // # define CXXTEST_COMPARISONS(CXXTEST_X, CXXTEST_Y, CXXTEST_T) \ inline bool equals( CXXTEST_X x, CXXTEST_Y y ) { return (((CXXTEST_T)x) == ((CXXTEST_T)y)); } \ inline bool equals( CXXTEST_Y y, CXXTEST_X x ) { return (((CXXTEST_T)y) == ((CXXTEST_T)x)); } \ inline bool differs( CXXTEST_X x, CXXTEST_Y y ) { return (((CXXTEST_T)x) != ((CXXTEST_T)y)); } \ inline bool differs( CXXTEST_Y y, CXXTEST_X x ) { return (((CXXTEST_T)y) != ((CXXTEST_T)x)); } \ inline bool lessThan( CXXTEST_X x, CXXTEST_Y y ) { return (((CXXTEST_T)x) < ((CXXTEST_T)y)); } \ inline bool lessThan( CXXTEST_Y y, CXXTEST_X x ) { return (((CXXTEST_T)y) < ((CXXTEST_T)x)); } \ inline bool lessThanEquals( CXXTEST_X x, CXXTEST_Y y ) { return (((CXXTEST_T)x) <= ((CXXTEST_T)y)); } \ inline bool lessThanEquals( CXXTEST_Y y, CXXTEST_X x ) { return (((CXXTEST_T)y) <= ((CXXTEST_T)x)); } # define CXXTEST_INTEGRAL(CXXTEST_T) \ CXXTEST_COMPARISONS( signed CXXTEST_T, unsigned CXXTEST_T, unsigned CXXTEST_T ) CXXTEST_INTEGRAL( char ) CXXTEST_INTEGRAL( short ) CXXTEST_INTEGRAL( int ) CXXTEST_INTEGRAL( long ) # ifdef _CXXTEST_LONGLONG CXXTEST_INTEGRAL( _CXXTEST_LONGLONG ) # endif // _CXXTEST_LONGLONG # define CXXTEST_SMALL_BIG(CXXTEST_SMALL, CXXTEST_BIG) \ CXXTEST_COMPARISONS( signed CXXTEST_SMALL, unsigned CXXTEST_BIG, unsigned CXXTEST_BIG ) \ CXXTEST_COMPARISONS( signed CXXTEST_BIG, unsigned CXXTEST_SMALL, unsigned CXXTEST_BIG ) CXXTEST_SMALL_BIG( char, short ) CXXTEST_SMALL_BIG( char, int ) CXXTEST_SMALL_BIG( short, int ) CXXTEST_SMALL_BIG( char, long ) CXXTEST_SMALL_BIG( short, long ) CXXTEST_SMALL_BIG( int, long ) # ifdef _CXXTEST_LONGLONG CXXTEST_SMALL_BIG( char, _CXXTEST_LONGLONG ) CXXTEST_SMALL_BIG( short, _CXXTEST_LONGLONG ) CXXTEST_SMALL_BIG( int, _CXXTEST_LONGLONG ) CXXTEST_SMALL_BIG( long, _CXXTEST_LONGLONG ) # endif // _CXXTEST_LONGLONG } #endif // __cxxtest__TestSuite_h__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/QtGui.h0000644000175000017500000001724712320456500023025 0ustar mathieumathieu#ifndef __cxxtest__QtGui_h__ #define __cxxtest__QtGui_h__ // // The QtGui displays a simple progress bar using the Qt Toolkit. It // has been tested with versions 2.x and 3.x. // // Apart from normal Qt command-line arguments, it accepts the following options: // -minimized Start minimized, pop up on error // -keep Don't close the window at the end // -title TITLE Set the window caption // // If both are -minimized and -keep specified, GUI will only keep the // window if it's in focus. // #include #include #include #include #include #include #include #include #include namespace CxxTest { class QtGui : public GuiListener { public: void enterGui( int &argc, char **argv ) { parseCommandLine( argc, argv ); createApplication( argc, argv ); } void enterWorld( const WorldDescription &wd ) { createWindow( wd ); processEvents(); } void guiEnterSuite( const char *suiteName ) { showSuiteName( suiteName ); } void guiEnterTest( const char *suiteName, const char *testName ) { setCaption( suiteName, testName ); advanceProgressBar(); showTestName( testName ); showTestsDone( _progressBar->progress() ); processEvents(); } void yellowBar() { setColor( 255, 255, 0 ); setIcon( QMessageBox::Warning ); getTotalTests(); processEvents(); } void redBar() { if ( _startMinimized && _mainWindow->isMinimized() ) showNormal(); setColor( 255, 0, 0 ); setIcon( QMessageBox::Critical ); getTotalTests(); processEvents(); } void leaveGui() { if ( keep() ) { showSummary(); _application->exec(); } else _mainWindow->close( true ); } private: QString _title; bool _startMinimized, _keep; unsigned _numTotalTests; QString _strTotalTests; QApplication *_application; QWidget *_mainWindow; QVBoxLayout *_layout; QProgressBar *_progressBar; QStatusBar *_statusBar; QLabel *_suiteName, *_testName, *_testsDone; void parseCommandLine( int argc, char **argv ) { _startMinimized = _keep = false; _title = argv[0]; for ( int i = 1; i < argc; ++ i ) { QString arg( argv[i] ); if ( arg == "-minimized" ) _startMinimized = true; else if ( arg == "-keep" ) _keep = true; else if ( arg == "-title" && (i + 1 < argc) ) _title = argv[++i]; } } void createApplication( int &argc, char **argv ) { _application = new QApplication( argc, argv ); } void createWindow( const WorldDescription &wd ) { getTotalTests( wd ); createMainWindow(); createProgressBar(); createStatusBar(); setMainWidget(); if ( _startMinimized ) showMinimized(); else showNormal(); } void getTotalTests() { getTotalTests( tracker().world() ); } void getTotalTests( const WorldDescription &wd ) { _numTotalTests = wd.numTotalTests(); char s[WorldDescription::MAX_STRLEN_TOTAL_TESTS]; _strTotalTests = wd.strTotalTests( s ); } void createMainWindow() { _mainWindow = new QWidget(); _layout = new QVBoxLayout( _mainWindow ); } void createProgressBar() { _layout->addWidget( _progressBar = new QProgressBar( _numTotalTests, _mainWindow ) ); _progressBar->setProgress( 0 ); setColor( 0, 255, 0 ); setIcon( QMessageBox::Information ); } void createStatusBar() { _layout->addWidget( _statusBar = new QStatusBar( _mainWindow ) ); _statusBar->addWidget( _suiteName = new QLabel( _statusBar ), 2 ); _statusBar->addWidget( _testName = new QLabel( _statusBar ), 4 ); _statusBar->addWidget( _testsDone = new QLabel( _statusBar ), 1 ); } void setMainWidget() { _application->setMainWidget( _mainWindow ); } void showMinimized() { _mainWindow->showMinimized(); } void showNormal() { _mainWindow->showNormal(); centerWindow(); } void setCaption( const QString &suiteName, const QString &testName ) { _mainWindow->setCaption( _title + " - " + suiteName + "::" + testName + "()" ); } void showSuiteName( const QString &suiteName ) { _suiteName->setText( "class " + suiteName ); } void advanceProgressBar() { _progressBar->setProgress( _progressBar->progress() + 1 ); } void showTestName( const QString &testName ) { _testName->setText( testName + "()" ); } void showTestsDone( unsigned testsDone ) { _testsDone->setText( asString( testsDone ) + " of " + _strTotalTests ); } static QString asString( unsigned n ) { return QString::number( n ); } void setColor( int r, int g, int b ) { QPalette palette = _progressBar->palette(); palette.setColor( QColorGroup::Highlight, QColor( r, g, b ) ); _progressBar->setPalette( palette ); } void setIcon( QMessageBox::Icon icon ) { #if QT_VERSION >= 0x030000 _mainWindow->setIcon( QMessageBox::standardIcon( icon ) ); #else // Qt version < 3.0.0 _mainWindow->setIcon( QMessageBox::standardIcon( icon, QApplication::style().guiStyle() ) ); #endif // QT_VERSION } void processEvents() { _application->processEvents(); } void centerWindow() { QWidget *desktop = QApplication::desktop(); int xCenter = desktop->x() + (desktop->width() / 2); int yCenter = desktop->y() + (desktop->height() / 2); int windowWidth = (desktop->width() * 4) / 5; int windowHeight = _mainWindow->height(); _mainWindow->setGeometry( xCenter - (windowWidth / 2), yCenter - (windowHeight / 2), windowWidth, windowHeight ); } bool keep() { if ( !_keep ) return false; if ( !_startMinimized ) return true; return (_mainWindow == _application->activeWindow()); } void showSummary() { QString summary = _strTotalTests + (_numTotalTests == 1 ? " test" : " tests"); if ( tracker().failedTests() ) summary = "Failed " + asString( tracker().failedTests() ) + " of " + summary; else summary = summary + " passed"; _mainWindow->setCaption( _title + " - " + summary ); _statusBar->removeWidget( _suiteName ); _statusBar->removeWidget( _testName ); _testsDone->setText( summary ); } }; }; #endif // __cxxtest__QtGui_h__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/GlobalFixture.cpp0000644000175000017500000000160112320456500025061 0ustar mathieumathieu#ifndef __cxxtest__GlobalFixture_cpp__ #define __cxxtest__GlobalFixture_cpp__ #include namespace CxxTest { bool GlobalFixture::setUpWorld() { return true; } bool GlobalFixture::tearDownWorld() { return true; } bool GlobalFixture::setUp() { return true; } bool GlobalFixture::tearDown() { return true; } GlobalFixture::GlobalFixture() { attach( _list ); } GlobalFixture::~GlobalFixture() { detach( _list ); } GlobalFixture *GlobalFixture::firstGlobalFixture() { return (GlobalFixture *)_list.head(); } GlobalFixture *GlobalFixture::lastGlobalFixture() { return (GlobalFixture *)_list.tail(); } GlobalFixture *GlobalFixture::nextGlobalFixture() { return (GlobalFixture *)next(); } GlobalFixture *GlobalFixture::prevGlobalFixture() { return (GlobalFixture *)prev(); } } #endif // __cxxtest__GlobalFixture_cpp__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/GlobalFixture.h0000644000175000017500000000124012320456500024525 0ustar mathieumathieu#ifndef __cxxtest__GlobalFixture_h__ #define __cxxtest__GlobalFixture_h__ #include namespace CxxTest { class GlobalFixture : public Link { public: virtual bool setUpWorld(); virtual bool tearDownWorld(); virtual bool setUp(); virtual bool tearDown(); GlobalFixture(); ~GlobalFixture(); static GlobalFixture *firstGlobalFixture(); static GlobalFixture *lastGlobalFixture(); GlobalFixture *nextGlobalFixture(); GlobalFixture *prevGlobalFixture(); private: static List _list; }; } #endif // __cxxtest__GlobalFixture_h__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/RealDescriptions.cpp0000644000175000017500000002466412320456500025602 0ustar mathieumathieu#ifndef __cxxtest__RealDescriptions_cpp__ #define __cxxtest__RealDescriptions_cpp__ // // NOTE: If an error occur during world construction/deletion, CxxTest cannot // know where the error originated. // #include namespace CxxTest { RealTestDescription::RealTestDescription() { } RealTestDescription::RealTestDescription( List &argList, SuiteDescription &argSuite, unsigned argLine, const char *argTestName ) { initialize( argList, argSuite, argLine, argTestName ); } void RealTestDescription::initialize( List &argList, SuiteDescription &argSuite, unsigned argLine, const char *argTestName ) { _suite = &argSuite; _line = argLine; _testName = argTestName; attach( argList ); } bool RealTestDescription::setUp() { if ( !suite() ) return false; for ( GlobalFixture *gf = GlobalFixture::firstGlobalFixture(); gf != 0; gf = gf->nextGlobalFixture() ) { bool ok; _TS_TRY { ok = gf->setUp(); } _TS_LAST_CATCH( { ok = false; } ); if ( !ok ) { doFailTest( file(), line(), "Error in GlobalFixture::setUp()" ); return false; } } _TS_TRY { _TSM_ASSERT_THROWS_NOTHING( file(), line(), "Exception thrown from setUp()", suite()->setUp() ); } _TS_CATCH_ABORT( { return false; } ); return true; } bool RealTestDescription::tearDown() { if ( !suite() ) return false; _TS_TRY { _TSM_ASSERT_THROWS_NOTHING( file(), line(), "Exception thrown from tearDown()", suite()->tearDown() ); } _TS_CATCH_ABORT( { return false; } ); for ( GlobalFixture *gf = GlobalFixture::lastGlobalFixture(); gf != 0; gf = gf->prevGlobalFixture() ) { bool ok; _TS_TRY { ok = gf->tearDown(); } _TS_LAST_CATCH( { ok = false; } ); if ( !ok ) { doFailTest( file(), line(), "Error in GlobalFixture::tearDown()" ); return false; } } return true; } const char *RealTestDescription::file() const { return _suite->file(); } unsigned RealTestDescription::line() const { return _line; } const char *RealTestDescription::testName() const { return _testName; } const char *RealTestDescription::suiteName() const { return _suite->suiteName(); } TestDescription *RealTestDescription::next() { return (RealTestDescription *)Link::next(); } const TestDescription *RealTestDescription::next() const { return (const RealTestDescription *)Link::next(); } TestSuite *RealTestDescription::suite() const { return _suite->suite(); } void RealTestDescription::run() { _TS_TRY { runTest(); } _TS_CATCH_ABORT( {} ) ___TSM_CATCH( file(), line(), "Exception thrown from test" ); } RealSuiteDescription::RealSuiteDescription() {} RealSuiteDescription::RealSuiteDescription( const char *argFile, unsigned argLine, const char *argSuiteName, List &argTests ) { initialize( argFile, argLine, argSuiteName, argTests ); } void RealSuiteDescription::initialize( const char *argFile, unsigned argLine, const char *argSuiteName, List &argTests ) { _file = argFile; _line = argLine; _suiteName = argSuiteName; _tests = &argTests; attach( _suites ); } const char *RealSuiteDescription::file() const { return _file; } unsigned RealSuiteDescription::line() const { return _line; } const char *RealSuiteDescription::suiteName() const { return _suiteName; } TestDescription *RealSuiteDescription::firstTest() { return (RealTestDescription *)_tests->head(); } const TestDescription *RealSuiteDescription::firstTest() const { return (const RealTestDescription *)_tests->head(); } SuiteDescription *RealSuiteDescription::next() { return (RealSuiteDescription *)Link::next(); } const SuiteDescription *RealSuiteDescription::next() const { return (const RealSuiteDescription *)Link::next(); } unsigned RealSuiteDescription::numTests() const { return _tests->size(); } const TestDescription &RealSuiteDescription::testDescription( unsigned i ) const { return *(RealTestDescription *)_tests->nth( i ); } void RealSuiteDescription::activateAllTests() { _tests->activateAll(); } bool RealSuiteDescription::leaveOnly( const char *testName ) { for ( TestDescription *td = firstTest(); td != 0; td = td->next() ) { if ( stringsEqual( td->testName(), testName ) ) { _tests->leaveOnly( *td ); return true; } } return false; } StaticSuiteDescription::StaticSuiteDescription() {} StaticSuiteDescription::StaticSuiteDescription( const char *argFile, unsigned argLine, const char *argSuiteName, TestSuite &argSuite, List &argTests ) : RealSuiteDescription( argFile, argLine, argSuiteName, argTests ) { doInitialize( argSuite ); } void StaticSuiteDescription::initialize( const char *argFile, unsigned argLine, const char *argSuiteName, TestSuite &argSuite, List &argTests ) { RealSuiteDescription::initialize( argFile, argLine, argSuiteName, argTests ); doInitialize( argSuite ); } void StaticSuiteDescription::doInitialize( TestSuite &argSuite ) { _suite = &argSuite; } TestSuite *StaticSuiteDescription::suite() const { return _suite; } bool StaticSuiteDescription::setUp() { return true; } bool StaticSuiteDescription::tearDown() { return true; } CommonDynamicSuiteDescription::CommonDynamicSuiteDescription() {} CommonDynamicSuiteDescription::CommonDynamicSuiteDescription( const char *argFile, unsigned argLine, const char *argSuiteName, List &argTests, unsigned argCreateLine, unsigned argDestroyLine ) : RealSuiteDescription( argFile, argLine, argSuiteName, argTests ) { doInitialize( argCreateLine, argDestroyLine ); } void CommonDynamicSuiteDescription::initialize( const char *argFile, unsigned argLine, const char *argSuiteName, List &argTests, unsigned argCreateLine, unsigned argDestroyLine ) { RealSuiteDescription::initialize( argFile, argLine, argSuiteName, argTests ); doInitialize( argCreateLine, argDestroyLine ); } void CommonDynamicSuiteDescription::doInitialize( unsigned argCreateLine, unsigned argDestroyLine ) { _createLine = argCreateLine; _destroyLine = argDestroyLine; } List &RealWorldDescription::suites() { return RealSuiteDescription::_suites; } unsigned RealWorldDescription::numSuites( void ) const { return suites().size(); } unsigned RealWorldDescription::numTotalTests( void ) const { unsigned count = 0; for ( const SuiteDescription *sd = firstSuite(); sd != 0; sd = sd->next() ) count += sd->numTests(); return count; } SuiteDescription *RealWorldDescription::firstSuite() { return (RealSuiteDescription *)suites().head(); } const SuiteDescription *RealWorldDescription::firstSuite() const { return (const RealSuiteDescription *)suites().head(); } const SuiteDescription &RealWorldDescription::suiteDescription( unsigned i ) const { return *(const RealSuiteDescription *)suites().nth( i ); } void RealWorldDescription::activateAllTests() { suites().activateAll(); for ( SuiteDescription *sd = firstSuite(); sd != 0; sd = sd->next() ) sd->activateAllTests(); } bool RealWorldDescription::leaveOnly( const char *suiteName, const char *testName ) { for ( SuiteDescription *sd = firstSuite(); sd != 0; sd = sd->next() ) { if ( stringsEqual( sd->suiteName(), suiteName ) ) { if ( testName ) if ( !sd->leaveOnly( testName ) ) return false; suites().leaveOnly( *sd ); return true; } } return false; } bool RealWorldDescription::setUp() { for ( GlobalFixture *gf = GlobalFixture::firstGlobalFixture(); gf != 0; gf = gf->nextGlobalFixture() ) { bool ok; _TS_TRY { ok = gf->setUpWorld(); } _TS_LAST_CATCH( { ok = false; } ); if ( !ok ) { reportError( "Error setting up world" ); return false; } } return true; } bool RealWorldDescription::tearDown() { for ( GlobalFixture *gf = GlobalFixture::lastGlobalFixture(); gf != 0; gf = gf->prevGlobalFixture() ) { bool ok; _TS_TRY { ok = gf->tearDownWorld(); } _TS_LAST_CATCH( { ok = false; } ); if ( !ok ) { reportError( "Error tearing down world" ); return false; } } return true; } void RealWorldDescription::reportError( const char *message ) { doWarn( __FILE__, 5, message ); } void activateAllTests() { RealWorldDescription().activateAllTests(); } bool leaveOnly( const char *suiteName, const char *testName ) { return RealWorldDescription().leaveOnly( suiteName, testName ); } } #endif // __cxxtest__RealDescriptions_cpp__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/StdioPrinter.h0000644000175000017500000000110512320456500024404 0ustar mathieumathieu#ifndef __cxxtest__StdioPrinter_h__ #define __cxxtest__StdioPrinter_h__ // // The StdioPrinter is an StdioFilePrinter which defaults to stdout. // This should have been called StdOutPrinter or something, but the name // has been historically used. // #include namespace CxxTest { class StdioPrinter : public StdioFilePrinter { public: StdioPrinter( FILE *o = stdout, const char *preLine = ":", const char *postLine = "" ) : StdioFilePrinter( o, preLine, postLine ) {} }; } #endif // __cxxtest__StdioPrinter_h__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/Descriptions.cpp0000644000175000017500000000307112320456500024763 0ustar mathieumathieu#ifndef __cxxtest__Descriptions_cpp__ #define __cxxtest__Descriptions_cpp__ #include namespace CxxTest { TestDescription::~TestDescription() {} SuiteDescription::~SuiteDescription() {} WorldDescription::~WorldDescription() {} // // Convert total tests to string // #ifndef _CXXTEST_FACTOR char *WorldDescription::strTotalTests( char *s ) const { numberToString( numTotalTests(), s ); return s; } #else // _CXXTEST_FACTOR char *WorldDescription::strTotalTests( char *s ) const { char *p = numberToString( numTotalTests(), s ); if ( numTotalTests() <= 1 ) return s; unsigned n = numTotalTests(); unsigned numFactors = 0; for ( unsigned factor = 2; (factor * factor) <= n; factor += (factor == 2) ? 1 : 2 ) { unsigned power; for ( power = 0; (n % factor) == 0; n /= factor ) ++ power; if ( !power ) continue; p = numberToString( factor, copyString( p, (numFactors == 0) ? " = " : " * " ) ); if ( power > 1 ) p = numberToString( power, copyString( p, "^" ) ); ++ numFactors; } if ( n > 1 ) { if ( !numFactors ) copyString( p, tracker().failedTests() ? " :(" : tracker().warnings() ? " :|" : " :)" ); else numberToString( n, copyString( p, " * " ) ); } return s; } #endif // _CXXTEST_FACTOR }; #endif // __cxxtest__Descriptions_cpp__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/Win32Gui.h0000644000175000017500000004020412320456500023330 0ustar mathieumathieu#ifndef __cxxtest__Win32Gui_h__ #define __cxxtest__Win32Gui_h__ // // The Win32Gui displays a simple progress bar using the Win32 API. // // It accepts the following command line options: // -minimized Start minimized, pop up on error // -keep Don't close the window at the end // -title TITLE Set the window caption // // If both -minimized and -keep are specified, GUI will only keep the // window if it's in focus. // // N.B. If you're wondering why this class doesn't use any standard // library or STL ( would have been nice) it's because it only // uses "straight" Win32 API. // #include #include #include namespace CxxTest { class Win32Gui : public GuiListener { public: void enterGui( int &argc, char **argv ) { parseCommandLine( argc, argv ); } void enterWorld( const WorldDescription &wd ) { getTotalTests( wd ); _testsDone = 0; startGuiThread(); } void guiEnterSuite( const char *suiteName ) { showSuiteName( suiteName ); reset( _suiteStart ); } void guiEnterTest( const char *suiteName, const char *testName ) { ++ _testsDone; setTestCaption( suiteName, testName ); showTestName( testName ); showTestsDone(); progressBarMessage( PBM_STEPIT ); reset( _testStart ); } void yellowBar() { setColor( 255, 255, 0 ); setIcon( IDI_WARNING ); getTotalTests(); } void redBar() { if ( _startMinimized ) showMainWindow( SW_SHOWNORMAL ); setColor( 255, 0, 0 ); setIcon( IDI_ERROR ); getTotalTests(); } void leaveGui() { if ( keep() ) { showSummary(); WaitForSingleObject( _gui, INFINITE ); } DestroyWindow( _mainWindow ); } private: const char *_title; bool _startMinimized, _keep; HANDLE _gui; WNDCLASSEX _windowClass; HWND _mainWindow, _progressBar, _statusBar; HANDLE _canStartTests; unsigned _numTotalTests, _testsDone; char _strTotalTests[WorldDescription::MAX_STRLEN_TOTAL_TESTS]; enum { STATUS_SUITE_NAME, STATUS_SUITE_TIME, STATUS_TEST_NAME, STATUS_TEST_TIME, STATUS_TESTS_DONE, STATUS_WORLD_TIME, STATUS_TOTAL_PARTS }; int _statusWidths[STATUS_TOTAL_PARTS]; unsigned _statusOffsets[STATUS_TOTAL_PARTS]; unsigned _statusTotal; char _statusTestsDone[sizeof("1000000000 of (100%)") + WorldDescription::MAX_STRLEN_TOTAL_TESTS]; DWORD _worldStart, _suiteStart, _testStart; char _timeString[sizeof("00:00:00")]; void parseCommandLine( int argc, char **argv ) { _startMinimized = _keep = false; _title = argv[0]; for ( int i = 1; i < argc; ++ i ) { if ( !lstrcmpA( argv[i], "-minimized" ) ) _startMinimized = true; else if ( !lstrcmpA( argv[i], "-keep" ) ) _keep = true; else if ( !lstrcmpA( argv[i], "-title" ) && (i + 1 < argc) ) _title = argv[++i]; } } void getTotalTests() { getTotalTests( tracker().world() ); } void getTotalTests( const WorldDescription &wd ) { _numTotalTests = wd.numTotalTests(); wd.strTotalTests( _strTotalTests ); } void startGuiThread() { _canStartTests = CreateEvent( NULL, TRUE, FALSE, NULL ); DWORD threadId; _gui = CreateThread( NULL, 0, &(Win32Gui::guiThread), (LPVOID)this, 0, &threadId ); WaitForSingleObject( _canStartTests, INFINITE ); } static DWORD WINAPI guiThread( LPVOID parameter ) { ((Win32Gui *)parameter)->gui(); return 0; } void gui() { registerWindowClass(); createMainWindow(); initCommonControls(); createProgressBar(); createStatusBar(); centerMainWindow(); showMainWindow(); startTimer(); startTests(); messageLoop(); } void registerWindowClass() { _windowClass.cbSize = sizeof(_windowClass); _windowClass.style = CS_HREDRAW | CS_VREDRAW; _windowClass.lpfnWndProc = &(Win32Gui::windowProcedure); _windowClass.cbClsExtra = 0; _windowClass.cbWndExtra = sizeof(LONG); _windowClass.hInstance = (HINSTANCE)NULL; _windowClass.hIcon = (HICON)NULL; _windowClass.hCursor = (HCURSOR)NULL; _windowClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); _windowClass.lpszMenuName = NULL; _windowClass.lpszClassName = TEXT("CxxTest Window Class"); _windowClass.hIconSm = (HICON)NULL; RegisterClassEx( &_windowClass ); } void createMainWindow() { _mainWindow = createWindow( _windowClass.lpszClassName, WS_OVERLAPPEDWINDOW ); } void initCommonControls() { HMODULE dll = LoadLibraryA( "comctl32.dll" ); if ( !dll ) return; typedef void (WINAPI *FUNC)( void ); FUNC func = (FUNC)GetProcAddress( dll, "InitCommonControls" ); if ( !func ) return; func(); } void createProgressBar() { _progressBar = createWindow( PROGRESS_CLASS, WS_CHILD | WS_VISIBLE | PBS_SMOOTH, _mainWindow ); #ifdef PBM_SETRANGE32 progressBarMessage( PBM_SETRANGE32, 0, _numTotalTests ); #else // No PBM_SETRANGE32, use PBM_SETRANGE progressBarMessage( PBM_SETRANGE, 0, MAKELPARAM( 0, (WORD)_numTotalTests ) ); #endif // PBM_SETRANGE32 progressBarMessage( PBM_SETPOS, 0 ); progressBarMessage( PBM_SETSTEP, 1 ); greenBar(); UpdateWindow( _progressBar ); } void createStatusBar() { _statusBar = createWindow( STATUSCLASSNAME, WS_CHILD | WS_VISIBLE, _mainWindow ); setRatios( 4, 1, 3, 1, 3, 1 ); } void setRatios( unsigned suiteNameRatio, unsigned suiteTimeRatio, unsigned testNameRatio, unsigned testTimeRatio, unsigned testsDoneRatio, unsigned worldTimeRatio ) { _statusTotal = 0; _statusOffsets[STATUS_SUITE_NAME] = (_statusTotal += suiteNameRatio); _statusOffsets[STATUS_SUITE_TIME] = (_statusTotal += suiteTimeRatio); _statusOffsets[STATUS_TEST_NAME] = (_statusTotal += testNameRatio); _statusOffsets[STATUS_TEST_TIME] = (_statusTotal += testTimeRatio); _statusOffsets[STATUS_TESTS_DONE] = (_statusTotal += testsDoneRatio); _statusOffsets[STATUS_WORLD_TIME] = (_statusTotal += worldTimeRatio); } HWND createWindow( LPCTSTR className, DWORD style, HWND parent = (HWND)NULL ) { return CreateWindow( className, NULL, style, 0, 0, 0, 0, parent, (HMENU)NULL, (HINSTANCE)NULL, (LPVOID)this ); } void progressBarMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 ) { SendMessage( _progressBar, message, wParam, lParam ); } void centerMainWindow() { RECT screen; getScreenArea( screen ); LONG screenWidth = screen.right - screen.left; LONG screenHeight = screen.bottom - screen.top; LONG xCenter = (screen.right + screen.left) / 2; LONG yCenter = (screen.bottom + screen.top) / 2; LONG windowWidth = (screenWidth * 4) / 5; LONG windowHeight = screenHeight / 10; LONG minimumHeight = 2 * (GetSystemMetrics( SM_CYCAPTION ) + GetSystemMetrics( SM_CYFRAME )); if ( windowHeight < minimumHeight ) windowHeight = minimumHeight; SetWindowPos( _mainWindow, HWND_TOP, xCenter - (windowWidth / 2), yCenter - (windowHeight / 2), windowWidth, windowHeight, 0 ); } void getScreenArea( RECT &area ) { if ( !getScreenAreaWithoutTaskbar( area ) ) getWholeScreenArea( area ); } bool getScreenAreaWithoutTaskbar( RECT &area ) { return (SystemParametersInfo( SPI_GETWORKAREA, sizeof(RECT), &area, 0 ) != 0); } void getWholeScreenArea( RECT &area ) { area.left = area.top = 0; area.right = GetSystemMetrics( SM_CXSCREEN ); area.bottom = GetSystemMetrics( SM_CYSCREEN ); } void showMainWindow() { showMainWindow( _startMinimized ? SW_MINIMIZE : SW_SHOWNORMAL ); UpdateWindow( _mainWindow ); } void showMainWindow( int mode ) { ShowWindow( _mainWindow, mode ); } enum { TIMER_ID = 1, TIMER_DELAY = 1000 }; void startTimer() { reset( _worldStart ); reset( _suiteStart ); reset( _testStart ); SetTimer( _mainWindow, TIMER_ID, TIMER_DELAY, 0 ); } void reset( DWORD &tick ) { tick = GetTickCount(); } void startTests() { SetEvent( _canStartTests ); } void messageLoop() { MSG message; while ( BOOL haveMessage = GetMessage( &message, NULL, 0, 0 ) ) if ( haveMessage != -1 ) DispatchMessage( &message ); } static LRESULT CALLBACK windowProcedure( HWND window, UINT message, WPARAM wParam, LPARAM lParam ) { if ( message == WM_CREATE ) setUp( window, (LPCREATESTRUCT)lParam ); Win32Gui *that = (Win32Gui *)GetWindowLong( window, GWL_USERDATA ); return that->handle( window, message, wParam, lParam ); } static void setUp( HWND window, LPCREATESTRUCT create ) { SetWindowLong( window, GWL_USERDATA, (LONG)create->lpCreateParams ); } LRESULT handle( HWND window, UINT message, WPARAM wParam, LPARAM lParam ) { switch ( message ) { case WM_SIZE: resizeControls(); break; case WM_TIMER: updateTime(); break; case WM_CLOSE: case WM_DESTROY: case WM_QUIT: ExitProcess( 0 ); default: return DefWindowProc( window, message, wParam, lParam ); } return 0; } void resizeControls() { RECT r; GetClientRect( _mainWindow, &r ); LONG width = r.right - r.left; LONG height = r.bottom - r.top; GetClientRect( _statusBar, &r ); LONG statusHeight = r.bottom - r.top; LONG resizeGripWidth = statusHeight; LONG progressHeight = height - statusHeight; SetWindowPos( _progressBar, HWND_TOP, 0, 0, width, progressHeight, 0 ); SetWindowPos( _statusBar, HWND_TOP, 0, progressHeight, width, statusHeight, 0 ); setStatusParts( width - resizeGripWidth ); } void setStatusParts( LONG width ) { for ( unsigned i = 0; i < STATUS_TOTAL_PARTS; ++ i ) _statusWidths[i] = (width * _statusOffsets[i]) / _statusTotal; statusBarMessage( SB_SETPARTS, STATUS_TOTAL_PARTS, _statusWidths ); } void statusBarMessage( UINT message, WPARAM wParam = 0, const void *lParam = 0 ) { SendMessage( _statusBar, message, wParam, (LPARAM)lParam ); } void greenBar() { setColor( 0, 255, 0 ); setIcon( IDI_INFORMATION ); } #ifdef PBM_SETBARCOLOR void setColor( BYTE red, BYTE green, BYTE blue ) { progressBarMessage( PBM_SETBARCOLOR, 0, RGB( red, green, blue ) ); } #else // !PBM_SETBARCOLOR void setColor( BYTE, BYTE, BYTE ) { } #endif // PBM_SETBARCOLOR void setIcon( LPCTSTR icon ) { SendMessage( _mainWindow, WM_SETICON, ICON_BIG, (LPARAM)loadStandardIcon( icon ) ); } HICON loadStandardIcon( LPCTSTR icon ) { return LoadIcon( (HINSTANCE)NULL, icon ); } void setTestCaption( const char *suiteName, const char *testName ) { setCaption( suiteName, "::", testName, "()" ); } void setCaption( const char *a = "", const char *b = "", const char *c = "", const char *d = "" ) { unsigned length = lstrlenA( _title ) + sizeof( " - " ) + lstrlenA( a ) + lstrlenA( b ) + lstrlenA( c ) + lstrlenA( d ); char *name = allocate( length ); lstrcpyA( name, _title ); lstrcatA( name, " - " ); lstrcatA( name, a ); lstrcatA( name, b ); lstrcatA( name, c ); lstrcatA( name, d ); SetWindowTextA( _mainWindow, name ); deallocate( name ); } void showSuiteName( const char *suiteName ) { setStatusPart( STATUS_SUITE_NAME, suiteName ); } void showTestName( const char *testName ) { setStatusPart( STATUS_TEST_NAME, testName ); } void showTestsDone() { wsprintfA( _statusTestsDone, "%u of %s (%u%%)", _testsDone, _strTotalTests, (_testsDone * 100) / _numTotalTests ); setStatusPart( STATUS_TESTS_DONE, _statusTestsDone ); } void updateTime() { setStatusTime( STATUS_WORLD_TIME, _worldStart ); setStatusTime( STATUS_SUITE_TIME, _suiteStart ); setStatusTime( STATUS_TEST_TIME, _testStart ); } void setStatusTime( unsigned part, DWORD start ) { unsigned total = (GetTickCount() - start) / 1000; unsigned hours = total / 3600; unsigned minutes = (total / 60) % 60; unsigned seconds = total % 60; if ( hours ) wsprintfA( _timeString, "%u:%02u:%02u", hours, minutes, seconds ); else wsprintfA( _timeString, "%02u:%02u", minutes, seconds ); setStatusPart( part, _timeString ); } bool keep() { if ( !_keep ) return false; if ( !_startMinimized ) return true; return (_mainWindow == GetForegroundWindow()); } void showSummary() { stopTimer(); setSummaryStatusBar(); setSummaryCaption(); } void setStatusPart( unsigned part, const char *text ) { statusBarMessage( SB_SETTEXTA, part, text ); } void stopTimer() { KillTimer( _mainWindow, TIMER_ID ); setStatusTime( STATUS_WORLD_TIME, _worldStart ); } void setSummaryStatusBar() { setRatios( 0, 0, 0, 0, 1, 1 ); resizeControls(); const char *tests = (_numTotalTests == 1) ? "test" : "tests"; if ( tracker().failedTests() ) wsprintfA( _statusTestsDone, "Failed %u of %s %s", tracker().failedTests(), _strTotalTests, tests ); else wsprintfA( _statusTestsDone, "%s %s passed", _strTotalTests, tests ); setStatusPart( STATUS_TESTS_DONE, _statusTestsDone ); } void setSummaryCaption() { setCaption( _statusTestsDone ); } char *allocate( unsigned length ) { return (char *)HeapAlloc( GetProcessHeap(), 0, length ); } void deallocate( char *data ) { HeapFree( GetProcessHeap(), 0, data ); } }; }; #endif // __cxxtest__Win32Gui_h__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/Descriptions.h0000644000175000017500000000424612320456500024435 0ustar mathieumathieu#ifndef __cxxtest__Descriptions_h__ #define __cxxtest__Descriptions_h__ // // TestDescription, SuiteDescription and WorldDescription // hold information about tests so they can be run and reported. // #include namespace CxxTest { class TestSuite; class TestDescription : public Link { public: virtual ~TestDescription(); virtual const char *file() const = 0; virtual unsigned line() const = 0; virtual const char *testName() const = 0; virtual const char *suiteName() const = 0; virtual void run() = 0; virtual const TestDescription *next() const = 0; virtual TestDescription *next() = 0; }; class SuiteDescription : public Link { public: virtual ~SuiteDescription(); virtual const char *file() const = 0; virtual unsigned line() const = 0; virtual const char *suiteName() const = 0; virtual TestSuite *suite() const = 0; virtual unsigned numTests() const = 0; virtual const TestDescription &testDescription( unsigned /*i*/ ) const = 0; virtual TestDescription *firstTest() = 0; virtual const TestDescription *firstTest() const = 0; virtual SuiteDescription *next() = 0; virtual const SuiteDescription *next() const = 0; virtual void activateAllTests() = 0; virtual bool leaveOnly( const char * /*testName*/ ) = 0; }; class WorldDescription : public Link { public: virtual ~WorldDescription(); virtual unsigned numSuites( void ) const = 0; virtual unsigned numTotalTests( void ) const = 0; virtual const SuiteDescription &suiteDescription( unsigned /*i*/ ) const = 0; enum { MAX_STRLEN_TOTAL_TESTS = 32 }; char *strTotalTests( char * /*buffer*/ ) const; virtual SuiteDescription *firstSuite() = 0; virtual const SuiteDescription *firstSuite() const = 0; virtual void activateAllTests() = 0; virtual bool leaveOnly( const char * /*suiteName*/, const char * /*testName*/ = 0 ) = 0; }; } #endif // __cxxtest__Descriptions_h__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/StdValueTraits.h0000644000175000017500000001325112320456500024701 0ustar mathieumathieu#ifndef __cxxtest_StdValueTraits_h__ #define __cxxtest_StdValueTraits_h__ // // This file defines ValueTraits for std:: stuff. // It is #included by if you // define CXXTEST_HAVE_STD // #include #include #ifdef _CXXTEST_OLD_STD # define CXXTEST_STD(x) x #else // !_CXXTEST_OLD_STD # define CXXTEST_STD(x) std::x #endif // _CXXTEST_OLD_STD #ifndef CXXTEST_USER_VALUE_TRAITS namespace CxxTest { // // NOTE: This should have been // template // class ValueTraits< std::basic_string > {}; // But MSVC doesn't support it (yet). // // // If we have std::string, we might as well use it // class StdTraitsBase { public: StdTraitsBase &operator<<( const CXXTEST_STD(string) &s ) { _s += s; return *this; } const char *asString() const { return _s.c_str(); } private: CXXTEST_STD(string) _s; }; // // std::string // CXXTEST_TEMPLATE_INSTANTIATION class ValueTraits : public StdTraitsBase { public: ValueTraits( const CXXTEST_STD(string) &s ) { *this << "\""; for ( unsigned i = 0; i < s.length(); ++ i ) { char c[sizeof("\\xXX")]; charToString( s[i], c ); *this << c; } *this << "\""; } }; CXXTEST_COPY_CONST_TRAITS( CXXTEST_STD(string) ); #ifndef _CXXTEST_OLD_STD // // std::wstring // CXXTEST_TEMPLATE_INSTANTIATION class ValueTraits)> : public StdTraitsBase { public: ValueTraits( const CXXTEST_STD(basic_string) &s ) { *this << "L\""; for ( unsigned i = 0; i < s.length(); ++ i ) { char c[sizeof("\\x12345678")]; charToString( (unsigned long)s[i], c ); *this << c; } *this << "\""; } }; CXXTEST_COPY_CONST_TRAITS( CXXTEST_STD(basic_string) ); #endif // _CXXTEST_OLD_STD // // Convert a range defined by iterators to a string // This is useful for almost all STL containers // template void dumpRange( Stream &s, Iterator first, Iterator last ) { s << "{ "; while ( first != last ) { s << TS_AS_STRING(*first); ++ first; s << ((first == last) ? " }" : ", "); } } #ifdef _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION // // std::pair // template class ValueTraits< CXXTEST_STD(pair) > : public StdTraitsBase { public: ValueTraits( const CXXTEST_STD(pair) &p ) { *this << "<" << TS_AS_STRING( p.first ) << ", " << TS_AS_STRING( p.second ) << ">"; } }; // // std::vector // template class ValueTraits< CXXTEST_STD(vector) > : public StdTraitsBase { public: ValueTraits( const CXXTEST_STD(vector) &v ) { dumpRange( *this, v.begin(), v.end() ); } }; // // std::list // template class ValueTraits< CXXTEST_STD(list) > : public StdTraitsBase { public: ValueTraits( const CXXTEST_STD(list) &l ) { dumpRange( *this, l.begin(), l.end() ); } }; // // std::set // template class ValueTraits< CXXTEST_STD(set) > : public StdTraitsBase { public: ValueTraits( const CXXTEST_STD(set) &s ) { dumpRange( *this, s.begin(), s.end() ); } }; // // std::map // template class ValueTraits< CXXTEST_STD(map) > : public StdTraitsBase { public: ValueTraits( const CXXTEST_STD(map) &m ) { dumpRange( *this, m.begin(), m.end() ); } }; // // std::deque // template class ValueTraits< CXXTEST_STD(deque) > : public StdTraitsBase { public: ValueTraits( const CXXTEST_STD(deque) &d ) { dumpRange( *this, d.begin(), d.end() ); } }; // // std::multiset // template class ValueTraits< CXXTEST_STD(multiset) > : public StdTraitsBase { public: ValueTraits( const CXXTEST_STD(multiset) &ms ) { dumpRange( *this, ms.begin(), ms.end() ); } }; // // std::multimap // template class ValueTraits< CXXTEST_STD(multimap) > : public StdTraitsBase { public: ValueTraits( const CXXTEST_STD(multimap) &mm ) { dumpRange( *this, mm.begin(), mm.end() ); } }; // // std::complex // template class ValueTraits< CXXTEST_STD(complex) > : public StdTraitsBase { public: ValueTraits( const CXXTEST_STD(complex) &c ) { if ( !c.imag() ) *this << TS_AS_STRING(c.real()); else if ( !c.real() ) *this << "(" << TS_AS_STRING(c.imag()) << " * i)"; else *this << "(" << TS_AS_STRING(c.real()) << " + " << TS_AS_STRING(c.imag()) << " * i)"; } }; #endif // _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION }; #endif // CXXTEST_USER_VALUE_TRAITS #endif // __cxxtest_StdValueTraits_h__ ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/X11Gui.h0000644000175000017500000002251412320456500023003 0ustar mathieumathieu#ifndef __cxxtest__X11Gui_h__ #define __cxxtest__X11Gui_h__ // // X11Gui displays a simple progress bar using X11 // // It accepts the following command-line arguments: // -title - Sets the application title // -fn or -font <font> - Sets the font // -bg or -background <color> - Sets the background color (default=Grey) // -fg or -foreground <color> - Sets the text color (default=Black) // -green/-yellow/-red <color> - Sets the colors of the bar // #include <cxxtest/Gui.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <stdio.h> #include <stdlib.h> #include <string.h> namespace CxxTest { class X11Gui : public GuiListener { public: void enterGui( int &argc, char **argv ) { parseCommandLine( argc, argv ); } void enterWorld( const WorldDescription &wd ) { openDisplay(); if ( _display ) { createColors(); createWindow(); createGc(); createFont(); centerWindow(); initializeEvents(); initializeBar( wd ); processEvents(); } } void guiEnterTest( const char *suiteName, const char *testName ) { if ( _display ) { ++ _testsDone; setWindowName( suiteName, testName ); redraw(); } } void yellowBar() { if ( _display ) { _barColor = getColor( _yellowName ); getTotalTests(); processEvents(); } } void redBar() { if ( _display ) { _barColor = getColor( _redName ); getTotalTests(); processEvents(); } } void leaveGui() { if ( _display ) { freeFontInfo(); destroyGc(); destroyWindow(); closeDisplay(); } } private: const char *_programName; Display *_display; Window _window; unsigned _numTotalTests, _testsDone; char _strTotalTests[WorldDescription::MAX_STRLEN_TOTAL_TESTS]; const char *_foregroundName, *_backgroundName; const char *_greenName, *_yellowName, *_redName; unsigned long _foreground, _background, _barColor; int _width, _height; GC _gc; const char *_fontName; XID _fontId; XFontStruct *_fontInfo; int _textHeight, _textDescent; long _eventMask; Colormap _colormap; void parseCommandLine( int &argc, char **argv ) { _programName = argv[0]; _fontName = 0; _foregroundName = "Black"; _backgroundName = "Grey"; _greenName = "Green"; _yellowName = "Yellow"; _redName = "Red"; for ( int i = 1; i + 1 < argc; ++ i ) { if ( !strcmp( argv[i], "-title" ) ) _programName = argv[++ i]; else if ( !strcmp( argv[i], "-fn" ) || !strcmp( argv[i], "-font" ) ) _fontName = argv[++ i]; else if ( !strcmp( argv[i], "-fg" ) || !strcmp( argv[i], "-foreground" ) ) _foregroundName = argv[++ i]; else if ( !strcmp( argv[i], "-bg" ) || !strcmp( argv[i], "-background" ) ) _backgroundName = argv[++ i]; else if ( !strcmp( argv[i], "-green" ) ) _greenName = argv[++ i]; else if ( !strcmp( argv[i], "-yellow" ) ) _yellowName = argv[++ i]; else if ( !strcmp( argv[i], "-red" ) ) _redName = argv[++ i]; } } void openDisplay() { _display = XOpenDisplay( NULL ); } void createColors() { _colormap = DefaultColormap( _display, 0 ); _foreground = getColor( _foregroundName ); _background = getColor( _backgroundName ); } unsigned long getColor( const char *colorName ) { XColor color; XParseColor( _display, _colormap, colorName, &color ); XAllocColor( _display, _colormap, &color ); return color.pixel; } void createWindow() { _window = XCreateSimpleWindow( _display, RootWindow( _display, 0 ), 0, 0, 1, 1, 0, 0, _background ); } void createGc() { _gc = XCreateGC( _display, _window, 0, 0 ); } void createFont() { if ( !loadFont() ) useDefaultFont(); getFontInfo(); _textHeight = _fontInfo->ascent + _fontInfo->descent; _textDescent = _fontInfo->descent; } bool loadFont() { if ( !_fontName ) return false; _fontId = XLoadFont( _display, _fontName ); return (XSetFont( _display, _gc, _fontId ) == Success); } void useDefaultFont() { _fontId = XGContextFromGC( _gc ); } void getFontInfo() { _fontInfo = XQueryFont( _display, _fontId ); } void freeFontInfo() { XFreeFontInfo( NULL, _fontInfo, 1 ); } void initializeEvents() { _eventMask = ExposureMask; XSelectInput( _display, _window, _eventMask ); } void initializeBar( const WorldDescription &wd ) { getTotalTests( wd ); _testsDone = 0; _barColor = getColor( _greenName ); } void getTotalTests() { getTotalTests( tracker().world() ); } void getTotalTests( const WorldDescription &wd ) { _numTotalTests = wd.numTotalTests(); wd.strTotalTests( _strTotalTests ); } void centerWindow() { XMapWindow( _display, _window ); Screen *screen = XDefaultScreenOfDisplay( _display ); int screenWidth = WidthOfScreen( screen ); int screenHeight = HeightOfScreen( screen ); int xCenter = screenWidth / 2; int yCenter = screenHeight / 2; _width = (screenWidth * 4) / 5; _height = screenHeight / 14; XMoveResizeWindow( _display, _window, xCenter - (_width / 2), yCenter - (_height / 2), _width, _height ); } void processEvents() { redraw(); XEvent event; while( XCheckMaskEvent( _display, _eventMask, &event ) ) redraw(); } void setWindowName( const char *suiteName, const char *testName ) { unsigned length = strlen( _programName ) + strlen( suiteName ) + strlen( testName ) + sizeof( " - ::()" ); char *name = (char *)malloc( length ); sprintf( name, "%s - %s::%s()", _programName, suiteName, testName ); XSetStandardProperties( _display, _window, name, 0, 0, 0, 0, 0 ); free( name ); } void redraw() { getWindowSize(); drawSolidBar(); drawDividers(); drawPercentage(); flush(); } void getWindowSize() { XWindowAttributes attributes; XGetWindowAttributes( _display, _window, &attributes ); _width = attributes.width; _height = attributes.height; } void drawSolidBar() { unsigned barWidth = (_width * _testsDone) / _numTotalTests; XSetForeground( _display, _gc, _barColor ); XFillRectangle( _display, _window, _gc, 0, 0, barWidth, _height ); XSetForeground( _display, _gc, _background ); XFillRectangle( _display, _window, _gc, barWidth, 0, _width + 1 - barWidth, _height ); } void drawDividers() { if(_width / _numTotalTests < 5) return; for ( unsigned i = 1; i < _testsDone; ++ i ) { int x = (_width * i) / _numTotalTests; XDrawLine( _display, _window, _gc, x, 0, x, _height); } } void drawPercentage() { XSetForeground( _display, _gc, _foreground ); char str[sizeof("1000000000 of ") + sizeof(_strTotalTests) + sizeof(" (100%)")]; sprintf( str, "%u of %s (%u%%)", _testsDone, _strTotalTests, (_testsDone * 100) / _numTotalTests ); unsigned len = strlen( str ); int textWidth = XTextWidth( _fontInfo, str, len ); XDrawString( _display, _window, _gc, (_width - textWidth) / 2, ((_height + _textHeight) / 2) - _textDescent, str, len ); } void flush() { XFlush( _display ); } void destroyGc() { XFreeGC( _display, _gc ); } void destroyWindow() { XDestroyWindow( _display, _window ); } void closeDisplay() { XCloseDisplay( _display ); } }; }; #endif //__cxxtest__X11Gui_h__ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/TeeListener.h������������������������������������0000644�0001750�0001750�00000014502�12320456500�024206� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef __cxxtest__TeeListener_h__ #define __cxxtest__TeeListener_h__ // // A TeeListener notifies two "reular" TestListeners // #include <cxxtest/TestListener.h> #include <cxxtest/TestListener.h> namespace CxxTest { class TeeListener : public TestListener { public: TeeListener() { setFirst( _dummy ); setSecond( _dummy ); } virtual ~TeeListener() { } void setFirst( TestListener &first ) { _first = &first; } void setSecond( TestListener &second ) { _second = &second; } void enterWorld( const WorldDescription &d ) { _first->enterWorld( d ); _second->enterWorld( d ); } void enterSuite( const SuiteDescription &d ) { _first->enterSuite( d ); _second->enterSuite( d ); } void enterTest( const TestDescription &d ) { _first->enterTest( d ); _second->enterTest( d ); } void trace( const char *file, unsigned line, const char *expression ) { _first->trace( file, line, expression ); _second->trace( file, line, expression ); } void warning( const char *file, unsigned line, const char *expression ) { _first->warning( file, line, expression ); _second->warning( file, line, expression ); } void failedTest( const char *file, unsigned line, const char *expression ) { _first->failedTest( file, line, expression ); _second->failedTest( file, line, expression ); } void failedAssert( const char *file, unsigned line, const char *expression ) { _first->failedAssert( file, line, expression ); _second->failedAssert( file, line, expression ); } void failedAssertEquals( const char *file, unsigned line, const char *xStr, const char *yStr, const char *x, const char *y ) { _first->failedAssertEquals( file, line, xStr, yStr, x, y ); _second->failedAssertEquals( file, line, xStr, yStr, x, y ); } void failedAssertSameData( const char *file, unsigned line, const char *xStr, const char *yStr, const char *sizeStr, const void *x, const void *y, unsigned size ) { _first->failedAssertSameData( file, line, xStr, yStr, sizeStr, x, y, size ); _second->failedAssertSameData( file, line, xStr, yStr, sizeStr, x, y, size ); } void failedAssertDelta( const char *file, unsigned line, const char *xStr, const char *yStr, const char *dStr, const char *x, const char *y, const char *d ) { _first->failedAssertDelta( file, line, xStr, yStr, dStr, x, y, d ); _second->failedAssertDelta( file, line, xStr, yStr, dStr, x, y, d ); } void failedAssertDiffers( const char *file, unsigned line, const char *xStr, const char *yStr, const char *value ) { _first->failedAssertDiffers( file, line, xStr, yStr, value ); _second->failedAssertDiffers( file, line, xStr, yStr, value ); } void failedAssertLessThan( const char *file, unsigned line, const char *xStr, const char *yStr, const char *x, const char *y ) { _first->failedAssertLessThan( file, line, xStr, yStr, x, y ); _second->failedAssertLessThan( file, line, xStr, yStr, x, y ); } void failedAssertLessThanEquals( const char *file, unsigned line, const char *xStr, const char *yStr, const char *x, const char *y ) { _first->failedAssertLessThanEquals( file, line, xStr, yStr, x, y ); _second->failedAssertLessThanEquals( file, line, xStr, yStr, x, y ); } void failedAssertPredicate( const char *file, unsigned line, const char *predicate, const char *xStr, const char *x ) { _first->failedAssertPredicate( file, line, predicate, xStr, x ); _second->failedAssertPredicate( file, line, predicate, xStr, x ); } void failedAssertRelation( const char *file, unsigned line, const char *relation, const char *xStr, const char *yStr, const char *x, const char *y ) { _first->failedAssertRelation( file, line, relation, xStr, yStr, x, y ); _second->failedAssertRelation( file, line, relation, xStr, yStr, x, y ); } void failedAssertThrows( const char *file, unsigned line, const char *expression, const char *type, bool otherThrown ) { _first->failedAssertThrows( file, line, expression, type, otherThrown ); _second->failedAssertThrows( file, line, expression, type, otherThrown ); } void failedAssertThrowsNot( const char *file, unsigned line, const char *expression ) { _first->failedAssertThrowsNot( file, line, expression ); _second->failedAssertThrowsNot( file, line, expression ); } void leaveTest( const TestDescription &d ) { _first->leaveTest(d); _second->leaveTest(d); } void leaveSuite( const SuiteDescription &d ) { _first->leaveSuite(d); _second->leaveSuite(d); } void leaveWorld( const WorldDescription &d ) { _first->leaveWorld(d); _second->leaveWorld(d); } private: TestListener *_first, *_second; TestListener _dummy; }; }; #endif // __cxxtest__TeeListener_h__ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/StdioFilePrinter.h�������������������������������0000644�0001750�0001750�00000002457�12320456500�025217� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef __cxxtest__StdioFilePrinter_h__ #define __cxxtest__StdioFilePrinter_h__ // // The StdioFilePrinter is a simple TestListener that // just prints "OK" if everything goes well, otherwise // reports the error in the format of compiler messages. // This class uses <stdio.h>, i.e. FILE * and fprintf(). // #include <cxxtest/ErrorFormatter.h> #include <stdio.h> namespace CxxTest { class StdioFilePrinter : public ErrorFormatter { public: StdioFilePrinter( FILE *o, const char *preLine = ":", const char *postLine = "" ) : ErrorFormatter( new Adapter(o), preLine, postLine ) {} virtual ~StdioFilePrinter() { delete outputStream(); } private: class Adapter : public OutputStream { Adapter( const Adapter & ); Adapter &operator=( const Adapter & ); FILE *_o; public: Adapter( FILE *o ) : _o(o) {} void flush() { fflush( _o ); } OutputStream &operator<<( unsigned i ) { fprintf( _o, "%u", i ); return *this; } OutputStream &operator<<( const char *s ) { fputs( s, _o ); return *this; } OutputStream &operator<<( Manipulator m ) { return OutputStream::operator<<( m ); } }; }; } #endif // __cxxtest__StdioFilePrinter_h__ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtest/StdHeaders.h�������������������������������������0000644�0001750�0001750�00000000714�12320456500�024011� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef __cxxtest_StdHeaders_h__ #define __cxxtest_StdHeaders_h__ // // This file basically #includes the STL headers. // It exists to support warning level 4 in Visual C++ // #ifdef _MSC_VER # pragma warning( push, 1 ) #endif // _MSC_VER #include <complex> #include <deque> #include <list> #include <map> #include <set> #include <string> #include <vector> #ifdef _MSC_VER # pragma warning( pop ) #endif // _MSC_VER #endif // __cxxtest_StdHeaders_h__ ����������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/TUVOK-README���������������������������������������������0000644�0001750�0001750�00000000555�12320456500�021701� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������This is CxxTest 3.10.1, sans some extra things which aren't needed for Tuvok and related projects. CxxTest is licensed under the LGPL; see the file COPYING for more information. CxxTest has a homepage at: http://cxxtest.com/ If you want to use CxxTest in your own project[s], it's recommend you download the version available there instead of using this one. ���������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtestgen.pl��������������������������������������������0000755�0001750�0001750�00000034174�12320456500�022653� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/perl -w use strict; use Getopt::Long; sub usage() { print STDERR "Usage: $0 [OPTIONS] <input file(s)>\n"; print STDERR "Generate test source file for CxxTest.\n"; print STDERR "\n"; print STDERR " -v, --version Write CxxTest version\n"; print STDERR " -o, --output=NAME Write output to file NAME\n"; print STDERR " --runner=CLASS Create a main() function that runs CxxTest::CLASS\n"; print STDERR " --gui=CLASS Like --runner, with GUI component\n"; print STDERR " --error-printer Same as --runner=ErrorPrinter\n"; print STDERR " --abort-on-fail Abort tests on failed asserts (like xUnit)\n"; print STDERR " --have-std Use standard library (even if not found in tests)\n"; print STDERR " --no-std Don't use standard library (even if found in tests)\n"; print STDERR " --have-eh Use exception handling (even if not found in tests)\n"; print STDERR " --no-eh Don't use exception handling (even if found in tests)\n"; print STDERR " --longlong=[TYPE] Use TYPE as `long long' (defaut = long long)\n"; print STDERR " --template=TEMPLATE Use TEMPLATE file to generate the test runner\n"; print STDERR " --include=HEADER Include \"HEADER\" in test runner before other headers\n"; print STDERR " --root Write CxxTest globals\n"; print STDERR " --part Don't write CxxTest globals\n"; print STDERR " --no-static-init Don't rely on static initialization\n"; exit -1; } main(); sub main { parseCommandline(); scanInputFiles(); writeOutput(); } # # Handling the command line # my ($output, $runner, $gui, $template, $abortOnFail, $haveEh, $noEh, $haveStd, $noStd); my ($root, $part, $noStaticInit, $longlong, $factor); my @headers = (); sub parseCommandline() { @ARGV = expandWildcards(@ARGV); GetOptions( 'version' => \&printVersion, 'output=s' => \$output, 'template=s' => \$template, 'runner=s' => \$runner, 'gui=s', => \$gui, 'error-printer' => sub { $runner = 'ErrorPrinter'; $haveStd = 1; }, 'abort-on-fail' => \$abortOnFail, 'have-eh' => \$haveEh, 'no-eh' => \$noEh, 'have-std' => \$haveStd, 'no-std' => \$noStd, 'include=s' => \@headers, 'root' => \$root, 'part' => \$part, 'no-static-init' => \$noStaticInit, 'factor' => \$factor, 'longlong:s' => \$longlong ) or usage(); scalar @ARGV or $root or usage(); if ( defined($noStaticInit) && (defined($root) || defined($part)) ) { die "--no-static-init cannot be used with --root/--part\n"; } if ( $gui && !$runner ) { $runner = 'StdioPrinter'; } if ( defined($longlong) && !$longlong ) { $longlong = 'long long'; } foreach my $header (@headers) { if ( !($header =~ m/^["<].*[>"]$/) ) { $header = "\"$header\""; } } } sub printVersion() { print "This is CxxTest version 3.10.1.\n"; exit 0; } sub expandWildcards() { my @result = (); while( my $fn = shift @_ ) { push @result, glob($fn); } return @result; } # # Reading the input files and scanning for test cases # my (@suites, $suite, $test, $inBlock); my $numTotalTests = 0; sub scanInputFiles() { foreach my $file (@ARGV) { scanInputFile( $file ); } scalar @suites or $root or die("No tests defined\n"); } sub scanInputFile($) { my ($file) = @_; open FILE, "<$file" or die("Cannot open input file \"$file\"\n"); my $line; while (defined($line = <FILE>)) { scanLineForExceptionHandling( $line ); scanLineForStandardLibrary( $line ); scanLineForSuiteStart( $file, $., $line ); if ( $suite ) { if ( lineBelongsToSuite( $suite, $., $line ) ) { scanLineForTest( $., $line ); scanLineForCreate( $., $line ); scanLineForDestroy( $., $line ); } } } closeSuite(); close FILE; } sub lineBelongsToSuite($$$) { my ($suite, $lineNo, $line) = @_; if ( !$suite->{'generated'} ) { return 1; } if ( !$inBlock ) { $inBlock = lineStartsBlock( $line ); } if ( $inBlock ) { addLineToBlock( $suite->{'file'}, $lineNo, $line ); } return $inBlock; } sub scanLineForExceptionHandling($) { my ($line) = @_; if ( $line =~ m/\b(try|throw|catch|TSM?_ASSERT_THROWS[A-Z_]*)\b/ ) { addExceptionHandling(); } } sub scanLineForStandardLibrary($) { my ($line) = @_; if ( $line =~ m/\b(std\s*::|CXXTEST_STD|using\s+namespace\s+std\b|^\s*\#\s*include\s+<[a-z0-9]+>)/ ) { addStandardLibrary(); } } sub scanLineForSuiteStart($$$) { my ($fileName, $lineNo, $line) = @_; if ( $line =~ m/\bclass\s+(\w+)\s*:\s*public\s+((::)?\s*CxxTest\s*::\s*)?TestSuite\b/ ) { startSuite( $1, $fileName, $lineNo, 0 ); } if ( $line =~ m/\bCXXTEST_SUITE\s*\(\s*(\w*)\s*\)/ ) { print "$fileName:$lineNo: Warning: Inline test suites are deprecated.\n"; startSuite( $1, $fileName, $lineNo, 1 ); } } sub startSuite($$$$) { my ($name, $file, $line, $generated) = @_; closeSuite(); $suite = { 'name' => $name, 'file' => $file, 'line' => $line, 'generated' => $generated, 'create' => 0, 'destroy' => 0, 'tests' => [], 'lines' => [] }; } sub lineStartsBlock($) { my ($line) = @_; return $line =~ m/\bCXXTEST_CODE\s*\(/; } sub scanLineForTest($$) { my ($lineNo, $line) = @_; if ( $line =~ m/^([^\/]|\/[^\/])*\bvoid\s+([Tt]est\w+)\s*\(\s*(void)?\s*\)/ ) { addTest( $2, $lineNo ); } } sub addTest($$$) { my ($name, $line) = @_; $test = { 'name' => $name, 'line' => $line }; push @{suiteTests()}, $test; } sub addLineToBlock($$$) { my ($fileName, $lineNo, $line) = @_; $line = fixBlockLine( $fileName, $lineNo, $line ); $line =~ s/^.*\{\{//; my $end = ($line =~ s/\}\}.*//s); push @{$suite->{'lines'}}, $line; if ( $end ) { $inBlock = 0; } } sub fixBlockLine($$$) { my ($fileName, $lineNo, $line) = @_; my $fileLine = cstr($fileName) . "," . $lineNo; $line =~ s/\b(E?TSM?_(ASSERT[A-Z_]*|FAIL))\s*\(/_$1($fileLine,/g; return $line; } sub scanLineForCreate($$) { my ($lineNo, $line) = @_; if ( $line =~ m/\bstatic\s+\w+\s*\*\s*createSuite\s*\(\s*(void)?\s*\)/ ) { addCreateSuite( $lineNo ); } } sub scanLineForDestroy($$) { my ($lineNo, $line) = @_; if ( $line =~ m/\bstatic\s+void\s+destroySuite\s*\(\s*\w+\s*\*\s*\w*\s*\)/ ) { addDestroySuite( $lineNo ); } } sub closeSuite() { if ( $suite && scalar @{suiteTests()} ) { verifySuite(); rememberSuite(); } undef $suite; } sub addCreateSuite($) { $suite->{'createSuite'} = $_[0]; } sub addDestroySuite($) { $suite->{'destroySuite'} = $_[0]; } sub addExceptionHandling() { $haveEh = 1 unless defined($noEh); } sub addStandardLibrary() { $haveStd = 1 unless defined($noStd); } sub verifySuite() { if (suiteCreateLine() || suiteDestroyLine()) { die("Suite ", suiteName(), " must have both createSuite() and destroySuite()\n") unless (suiteCreateLine() && suiteDestroyLine()); } } sub rememberSuite() { push @suites, $suite; $numTotalTests += scalar @{$suite->{'tests'}}; } sub suiteName() { return $suite->{'name'}; } sub suiteTests() { return $suite->{'tests'}; } sub suiteCreateLine() { return $suite->{'createSuite'}; } sub suiteDestroyLine() { return $suite->{'destroySuite'}; } sub fileName() { return $suite->{'file'}; } sub fileString() { return cstr(fileName()); } sub testName() { return $test->{'name'}; } sub testLine() { return $test->{'line'}; } sub suiteObject() { return "suite_".suiteName(); } sub cstr($) { my $file = $_[0]; $file =~ s/\\/\\\\/g; return "\"".$file."\""; } # # Writing the test source file # sub writeOutput() { $template ? writeTemplateOutput() : writeSimpleOutput(); } sub startOutputFile() { if ( !standardOutput() ) { open OUTPUT_FILE,">$output" or die("Cannot create output file \"$output\"\n"); select OUTPUT_FILE; } print "/* Generated file, do not edit */\n\n"; } sub standardOutput() { return !$output; } sub writeSimpleOutput() { startOutputFile(); writePreamble(); writeMain(); writeWorld(); } my ($didPreamble, $didWorld); sub writeTemplateOutput() { openTemplateFile(); startOutputFile(); my $line; while (defined($line = <TEMPLATE_FILE>)) { if ( $line =~ m/^\s*\#\s*include\s*<cxxtest\// ) { writePreamble(); print $line; } elsif ( $line =~ m/^\s*<CxxTest\s+preamble>\s*$/ ) { writePreamble(); } elsif ( $line =~ m/^\s*<CxxTest\s+world>\s*$/ ) { writeWorld(); } else { print $line; } } } sub openTemplateFile() { open TEMPLATE_FILE, "<$template" or die("Cannot open template file \"$template\"\n"); } sub writePreamble() { return if $didPreamble; print "#ifndef CXXTEST_RUNNING\n"; print "#define CXXTEST_RUNNING\n"; print "#endif\n"; print "\n"; if ( $haveStd ) { print "#define _CXXTEST_HAVE_STD\n"; } if ( $haveEh ) { print "#define _CXXTEST_HAVE_EH\n"; } if ( $abortOnFail ) { print "#define _CXXTEST_ABORT_TEST_ON_FAIL\n"; } if ( $longlong ) { print "#define _CXXTEST_LONGLONG $longlong\n"; } if ( $factor ) { print "#define _CXXTEST_FACTOR\n"; } foreach my $header (@headers) { print "#include $header\n"; } print "#include <cxxtest/TestListener.h>\n"; print "#include <cxxtest/TestTracker.h>\n"; print "#include <cxxtest/TestRunner.h>\n"; print "#include <cxxtest/RealDescriptions.h>\n"; print "#include <cxxtest/$runner.h>\n" if $runner; print "#include <cxxtest/$gui.h>\n" if $gui; print "\n"; $didPreamble = 1; } sub writeWorld() { return if $didWorld; writePreamble(); writeSuites(); ($root or !$part) and writeRoot(); $noStaticInit and writeInitialize(); $didWorld = 1; } sub writeSuites() { foreach (@suites) { $suite = $_; writeInclude(fileName()); if ( $suite->{'generated'} ) { generateSuite(); } dynamicSuite() ? writeSuitePointer() : writeSuiteObject(); writeTestList(); writeSuiteDescription(); writeTestDescriptions(); } } sub dynamicSuite() { return suiteCreateLine(); } my $lastIncluded; sub writeInclude($) { my $file = $_[0]; return if $lastIncluded && ($file eq $lastIncluded); print "#include \"$file\"\n\n"; $lastIncluded = $file; } sub generateSuite() { print "class ", suiteName(), " : public CxxTest::TestSuite {\n"; print "public:\n"; foreach my $line (@{$suite->{'lines'}}) { print $line; } print "};\n\n"; } sub writeTestDescriptionsBase() { my $class = "TestDescriptionBase_" . suiteName(); print "class $class : public CxxTest::TestDescription {\n"; print "public:\n"; print " const char *file() const { return ", fileString(), "; }\n"; print " const char *suiteName() const { return \"", suiteName(), "\"; }\n"; print "};\n\n"; } sub writeSuitePointer() { if ( $noStaticInit ) { print "static ", suiteName(), " *", suiteObject(), ";\n\n"; } else { print "static ", suiteName(), " *", suiteObject(), " = 0;\n\n"; } } sub writeSuiteObject() { print "static ", suiteName(), " ", suiteObject(), ";\n\n"; } sub testList() { return "Tests_" . suiteName(); } sub writeTestList() { if ( $noStaticInit ) { printf "static CxxTest::List %s;\n", testList(); } else { printf "static CxxTest::List %s = { 0, 0 };\n", testList(); } } sub writeTestDescriptions() { foreach (@{suiteTests()}) { $test = $_; writeTestDescription(); } } sub suiteDescription() { return "suiteDescription_" . suiteName(); } sub writeTestDescription() { my $class = "TestDescription_" . suiteName() . "_" . testName(); printf "static class $class : public CxxTest::RealTestDescription {\n"; printf "public:\n"; $noStaticInit or printf " $class() : CxxTest::RealTestDescription( %s, %s, %s, \"%s\" ) {}\n", testList(), suiteDescription(), testLine(), testName(); printf " void runTest() { %s }\n", dynamicSuite() ? dynamicRun() : staticRun(); printf "} testDescription_%s_%s;\n\n", suiteName(), testName(); } sub dynamicRun() { return sprintf( "if ( %s ) %s->%s();", suiteObject(), suiteObject(), testName() ); } sub staticRun() { return sprintf( "%s.%s();", suiteObject(), testName() ); } sub writeSuiteDescription() { dynamicSuite() ? writeDynamicDescription() : writeStaticDescription(); } sub writeDynamicDescription() { printf "CxxTest::DynamicSuiteDescription<%s> %s", suiteName(), suiteDescription(); if ( !$noStaticInit ) { printf "( %s, %s, \"%s\", %s, %s, %s, %s )", fileString(), $suite->{'line'}, suiteName(), testList(), suiteObject(), suiteCreateLine(), suiteDestroyLine(); } print ";\n\n"; } sub writeStaticDescription() { printf "CxxTest::StaticSuiteDescription %s", suiteDescription(); if ( !$noStaticInit ) { printf "( %s, %s, \"%s\", %s, %s )", fileString(), $suite->{'line'}, suiteName(), suiteObject(), testList(); } print ";\n\n"; } sub writeRoot() { print "#include <cxxtest/Root.cpp>\n"; } sub writeInitialize() { print "namespace CxxTest {\n"; print " void initialize()\n"; print " {\n"; foreach (@suites) { $suite = $_; printf " %s.initialize();\n", testList(); if ( dynamicSuite() ) { printf " %s = 0;\n", suiteObject(); printf " %s.initialize( %s, %s, \"%s\", %s, %s, %s, %s );\n", suiteDescription(), fileString(), $suite->{'line'}, suiteName(), testList(), suiteObject(), suiteCreateLine(), suiteDestroyLine(); } else { printf " %s.initialize( %s, %s, \"%s\", %s, %s );\n", suiteDescription(), fileString(), $suite->{'line'}, suiteName(), suiteObject(), testList(); } foreach (@{suiteTests()}) { $test = $_; printf " testDescription_%s_%s.initialize( %s, %s, %s, \"%s\" );\n", suiteName(), testName(), testList(), suiteDescription(), testLine(), testName(); } } print " }\n"; print "}\n"; } sub writeMain() { if ( $gui ) { print "int main( int argc, char *argv[] ) {\n"; $noStaticInit && print " CxxTest::initialize();\n"; print " return CxxTest::GuiTuiRunner<CxxTest::$gui, CxxTest::$runner>( argc, argv ).run();\n"; print "}\n"; } elsif ( $runner ) { print "int main() {\n"; $noStaticInit && print " CxxTest::initialize();\n"; print " return CxxTest::$runner().run();\n"; print "}\n"; } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/Versions�������������������������������������������������0000644�0001750�0001750�00000011055�12320456500�021643� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������CxxTest Releases ================ Version 3.10.1 (2004-12-01): ---------------------------- - Improved support for VC7 - Fixed clash with some versions of STL Version 3.10.0 (2004-11-20): ---------------------------- - Added mock framework for global functions - Added TS_ASSERT_THROWS_ASSERT and TS_ASSERT_THROWS_EQUALS - Added CXXTEST_ENUM_TRAITS - Improved support for STL classes (vector, map etc.) - Added support for Digital Mars compiler - Reduced root/part compilation time and binary size - Support C++-style commenting of tests Version 3.9.1 (2004-01-19): --------------------------- - Fixed small bug with runner exit code - Embedded test suites are now deprecated Version 3.9.0 (2004-01-17): --------------------------- - Added TS_TRACE - Added --no-static-init - CxxTest::setAbortTestOnFail() works even without --abort-on-fail Version 3.8.5 (2004-01-08): --------------------------- - Added --no-eh - Added CxxTest::setAbortTestOnFail() and CXXTEST_DEFAULT_ABORT - Added CxxTest::setMaxDumpSize() - Added StdioFilePrinter Version 3.8.4 (2003-12-31): --------------------------- - Split distribution into cxxtest and cxxtest-selftest - Added `sample/msvc/FixFiles.bat' Version 3.8.3 (2003-12-24): --------------------------- - Added TS_ASSERT_PREDICATE - Template files can now specify where to insert the preamble - Added a sample Visual Studio workspace in `sample/msvc' - Can compile in MSVC with warning level 4 - Changed output format slightly Version 3.8.1 (2003-12-21): --------------------------- - Fixed small bug when using multiple --part files. - Fixed X11 GUI crash when there's no X server. - Added GlobalFixture::setUpWorld()/tearDownWorld() - Added leaveOnly(), activateAllTests() and `sample/only.tpl' - Should now run without warnings on Sun compiler. Version 3.8.0 (2003-12-13): --------------------------- - Fixed bug where `Root.cpp' needed exception handling - Added TS_ASSERT_RELATION - TSM_ macros now also tell you what went wrong - Renamed Win32Gui::free() to avoid clashes - Now compatible with more versions of Borland compiler - Improved the documentation Version 3.7.1 (2003-09-29): --------------------------- - Added --version - Compiles with even more exotic g++ warnings - Win32 Gui compiles with UNICODE - Should compile on some more platforms (Sun Forte, HP aCC) Version 3.7.0 (2003-09-20): --------------------------- - Added TS_ASSERT_LESS_THAN_EQUALS - Minor cleanups Version 3.6.1 (2003-09-15): --------------------------- - Improved QT GUI - Improved portability some more Version 3.6.0 (2003-09-04): --------------------------- - Added --longlong - Some portability improvements Version 3.5.1 (2003-09-03): --------------------------- - Major internal rewrite of macros - Added TS_ASSERT_SAME_DATA - Added --include option - Added --part and --root to enable splitting the test runner - Added global fixtures - Enhanced Win32 GUI with timers, -keep and -title - Now compiles with strict warnings Version 3.1.1 (2003-08-27): --------------------------- - Fixed small bug in TS_ASSERT_THROWS_*() Version 3.1.0 (2003-08-23): --------------------------- - Default ValueTraits now dumps value as hex bytes - Fixed double invocation bug (e.g. TS_FAIL(functionWithSideEffects())) - TS_ASSERT_THROWS*() are now "abort on fail"-friendly - Win32 GUI now supports Windows 98 and doesn't need comctl32.lib Version 3.0.1 (2003-08-07): --------------------------- - Added simple GUI for X11, Win32 and Qt - Added TS_WARN() macro - Removed --exit-code - Improved samples - Improved support for older (pre-std::) compilers - Made a PDF version of the User's Guide Version 2.8.4 (2003-07-21): --------------------------- - Now supports g++-3.3 - Added --have-eh - Fixed bug in numberToString() Version 2.8.3 (2003-06-30): --------------------------- - Fixed bugs in cxxtestgen.pl - Fixed warning for some compilers in ErrorPrinter/StdioPrinter - Thanks Martin Jost for pointing out these problems! Version 2.8.2 (2003-06-10): --------------------------- - Fixed bug when using CXXTEST_ABORT_TEST_ON_FAIL without standard library - Added CXXTEST_USER_TRAITS - Added --abort-on-fail Version 2.8.1 (2003-01-16): --------------------------- - Fixed charToString() for negative chars Version 2.8.0 (2003-01-13): --------------------------- - Added CXXTEST_ABORT_TEST_ON_FAIL for xUnit-like behaviour - Added `sample/winddk' - Improved ValueTraits - Improved output formatter - Started version history Version 2.7.0 (2002-09-29): --------------------------- - Added embedded test suites - Major internal improvements �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/cxxtestgen.py��������������������������������������������0000755�0001750�0001750�00000051254�12320456500�022666� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/python '''Usage: %s [OPTIONS] <input file(s)> Generate test source file for CxxTest. -v, --version Write CxxTest version -o, --output=NAME Write output to file NAME --runner=CLASS Create a main() function that runs CxxTest::CLASS --gui=CLASS Like --runner, with GUI component --error-printer Same as --runner=ErrorPrinter --abort-on-fail Abort tests on failed asserts (like xUnit) --have-std Use standard library (even if not found in tests) --no-std Don\'t use standard library (even if found in tests) --have-eh Use exception handling (even if not found in tests) --no-eh Don\'t use exception handling (even if found in tests) --longlong=[TYPE] Use TYPE (default: long long) as long long --template=TEMPLATE Use TEMPLATE file to generate the test runner --include=HEADER Include HEADER in test runner before other headers --root Write CxxTest globals --part Don\'t write CxxTest globals --no-static-init Don\'t rely on static initialization ''' import re import sys import getopt import glob import string # Global variables suites = [] suite = None inBlock = 0 outputFileName = None runner = None gui = None root = None part = None noStaticInit = None templateFileName = None headers = [] haveExceptionHandling = 0 noExceptionHandling = 0 haveStandardLibrary = 0 noStandardLibrary = 0 abortOnFail = 0 factor = 0 longlong = 0 def main(): '''The main program''' files = parseCommandline() scanInputFiles( files ) writeOutput() def usage( problem = None ): '''Print usage info and exit''' if problem is None: print usageString() sys.exit(0) else: sys.stderr.write( usageString() ) abort( problem ) def usageString(): '''Construct program usage string''' return __doc__ % sys.argv[0] def abort( problem ): '''Print error message and exit''' sys.stderr.write( '\n' ) sys.stderr.write( problem ) sys.stderr.write( '\n\n' ) sys.exit(2) def parseCommandline(): '''Analyze command line arguments''' try: options, patterns = getopt.getopt( sys.argv[1:], 'o:r:', ['version', 'output=', 'runner=', 'gui=', 'error-printer', 'abort-on-fail', 'have-std', 'no-std', 'have-eh', 'no-eh', 'template=', 'include=', 'root', 'part', 'no-static-init', 'factor', 'longlong='] ) except getopt.error, problem: usage( problem ) setOptions( options ) return setFiles( patterns ) def setOptions( options ): '''Set options specified on command line''' global outputFileName, templateFileName, runner, gui, haveStandardLibrary, factor, longlong global haveExceptionHandling, noExceptionHandling, abortOnFail, headers, root, part, noStaticInit for o, a in options: if o in ('-v', '--version'): printVersion() elif o in ('-o', '--output'): outputFileName = a elif o == '--template': templateFileName = a elif o == '--runner': runner = a elif o == '--gui': gui = a elif o == '--include': if not re.match( r'^["<].*[>"]$', a ): a = ('"%s"' % a) headers.append( a ) elif o == '--error-printer': runner = 'ErrorPrinter' haveStandardLibrary = 1 elif o == '--abort-on-fail': abortOnFail = 1 elif o == '--have-std': haveStandardLibrary = 1 elif o == '--no-std': noStandardLibrary = 1 elif o == '--have-eh': haveExceptionHandling = 1 elif o == '--no-eh': noExceptionHandling = 1 elif o == '--root': root = 1 elif o == '--part': part = 1 elif o == '--no-static-init': noStaticInit = 1 elif o == '--factor': factor = 1 elif o == '--longlong': if a: longlong = a else: longlong = 'long long' if noStaticInit and (root or part): abort( '--no-static-init cannot be used with --root/--part' ) if gui and not runner: runner = 'StdioPrinter' def printVersion(): '''Print CxxTest version and exit''' sys.stdout.write( "This is CxxTest version 3.10.1.\n" ) sys.exit(0) def setFiles( patterns ): '''Set input files specified on command line''' files = expandWildcards( patterns ) if len(files) is 0 and not root: usage( "No input files found" ) return files def expandWildcards( patterns ): '''Expand all wildcards in an array (glob)''' fileNames = [] for pathName in patterns: patternFiles = glob.glob( pathName ) for fileName in patternFiles: fileNames.append( fixBackslashes( fileName ) ) return fileNames def fixBackslashes( fileName ): '''Convert backslashes to slashes in file name''' return re.sub( r'\\', '/', fileName, 0 ) def scanInputFiles(files): '''Scan all input files for test suites''' for file in files: scanInputFile(file) global suites if len(suites) is 0 and not root: abort( 'No tests defined' ) def scanInputFile(fileName): '''Scan single input file for test suites''' file = open(fileName) lineNo = 0 while 1: line = file.readline() if not line: break lineNo = lineNo + 1 scanInputLine( fileName, lineNo, line ) closeSuite() file.close() def scanInputLine( fileName, lineNo, line ): '''Scan single input line for interesting stuff''' scanLineForExceptionHandling( line ) scanLineForStandardLibrary( line ) scanLineForSuiteStart( fileName, lineNo, line ) global suite if suite: scanLineInsideSuite( suite, lineNo, line ) def scanLineInsideSuite( suite, lineNo, line ): '''Analyze line which is part of a suite''' global inBlock if lineBelongsToSuite( suite, lineNo, line ): scanLineForTest( suite, lineNo, line ) scanLineForCreate( suite, lineNo, line ) scanLineForDestroy( suite, lineNo, line ) def lineBelongsToSuite( suite, lineNo, line ): '''Returns whether current line is part of the current suite. This can be false when we are in a generated suite outside of CXXTEST_CODE() blocks If the suite is generated, adds the line to the list of lines''' if not suite['generated']: return 1 global inBlock if not inBlock: inBlock = lineStartsBlock( line ) if inBlock: inBlock = addLineToBlock( suite, lineNo, line ) return inBlock std_re = re.compile( r"\b(std\s*::|CXXTEST_STD|using\s+namespace\s+std\b|^\s*\#\s*include\s+<[a-z0-9]+>)" ) def scanLineForStandardLibrary( line ): '''Check if current line uses standard library''' global haveStandardLibrary, noStandardLibrary if not haveStandardLibrary and std_re.search(line): if not noStandardLibrary: haveStandardLibrary = 1 exception_re = re.compile( r"\b(throw|try|catch|TSM?_ASSERT_THROWS[A-Z_]*)\b" ) def scanLineForExceptionHandling( line ): '''Check if current line uses exception handling''' global haveExceptionHandling, noExceptionHandling if not haveExceptionHandling and exception_re.search(line): if not noExceptionHandling: haveExceptionHandling = 1 suite_re = re.compile( r'\bclass\s+(\w+)\s*:\s*public\s+((::)?\s*CxxTest\s*::\s*)?TestSuite\b' ) generatedSuite_re = re.compile( r'\bCXXTEST_SUITE\s*\(\s*(\w*)\s*\)' ) def scanLineForSuiteStart( fileName, lineNo, line ): '''Check if current line starts a new test suite''' m = suite_re.search( line ) if m: startSuite( m.group(1), fileName, lineNo, 0 ) m = generatedSuite_re.search( line ) if m: sys.stdout.write( "%s:%s: Warning: Inline test suites are deprecated.\n" % (fileName, lineNo) ) startSuite( m.group(1), fileName, lineNo, 1 ) def startSuite( name, file, line, generated ): '''Start scanning a new suite''' global suite closeSuite() suite = { 'name' : name, 'file' : file, 'cfile' : cstr(file), 'line' : line, 'generated' : generated, 'object' : 'suite_%s' % name, 'dobject' : 'suiteDescription_%s' % name, 'tlist' : 'Tests_%s' % name, 'tests' : [], 'lines' : [] } def lineStartsBlock( line ): '''Check if current line starts a new CXXTEST_CODE() block''' return re.search( r'\bCXXTEST_CODE\s*\(', line ) is not None test_re = re.compile( r'^([^/]|/[^/])*\bvoid\s+([Tt]est\w+)\s*\(\s*(void)?\s*\)' ) def scanLineForTest( suite, lineNo, line ): '''Check if current line starts a test''' m = test_re.search( line ) if m: addTest( suite, m.group(2), lineNo ) def addTest( suite, name, line ): '''Add a test function to the current suite''' test = { 'name' : name, 'suite' : suite, 'class' : 'TestDescription_%s_%s' % (suite['name'], name), 'object' : 'testDescription_%s_%s' % (suite['name'], name), 'line' : line, } suite['tests'].append( test ) def addLineToBlock( suite, lineNo, line ): '''Append the line to the current CXXTEST_CODE() block''' line = fixBlockLine( suite, lineNo, line ) line = re.sub( r'^.*\{\{', '', line ) e = re.search( r'\}\}', line ) if e: line = line[:e.start()] suite['lines'].append( line ) return e is None def fixBlockLine( suite, lineNo, line): '''Change all [E]TS_ macros used in a line to _[E]TS_ macros with the correct file/line''' return re.sub( r'\b(E?TSM?_(ASSERT[A-Z_]*|FAIL))\s*\(', r'_\1(%s,%s,' % (suite['cfile'], lineNo), line, 0 ) create_re = re.compile( r'\bstatic\s+\w+\s*\*\s*createSuite\s*\(\s*(void)?\s*\)' ) def scanLineForCreate( suite, lineNo, line ): '''Check if current line defines a createSuite() function''' if create_re.search( line ): addSuiteCreateDestroy( suite, 'create', lineNo ) destroy_re = re.compile( r'\bstatic\s+void\s+destroySuite\s*\(\s*\w+\s*\*\s*\w*\s*\)' ) def scanLineForDestroy( suite, lineNo, line ): '''Check if current line defines a destroySuite() function''' if destroy_re.search( line ): addSuiteCreateDestroy( suite, 'destroy', lineNo ) def cstr( str ): '''Convert a string to its C representation''' return '"' + string.replace( str, '\\', '\\\\' ) + '"' def addSuiteCreateDestroy( suite, which, line ): '''Add createSuite()/destroySuite() to current suite''' if suite.has_key(which): abort( '%s:%s: %sSuite() already declared' % ( suite['file'], str(line), which ) ) suite[which] = line def closeSuite(): '''Close current suite and add it to the list if valid''' global suite if suite is not None: if len(suite['tests']) is not 0: verifySuite(suite) rememberSuite(suite) suite = None def verifySuite(suite): '''Verify current suite is legal''' if suite.has_key('create') and not suite.has_key('destroy'): abort( '%s:%s: Suite %s has createSuite() but no destroySuite()' % (suite['file'], suite['create'], suite['name']) ) if suite.has_key('destroy') and not suite.has_key('create'): abort( '%s:%s: Suite %s has destroySuite() but no createSuite()' % (suite['file'], suite['destroy'], suite['name']) ) def rememberSuite(suite): '''Add current suite to list''' global suites suites.append( suite ) def writeOutput(): '''Create output file''' if templateFileName: writeTemplateOutput() else: writeSimpleOutput() def writeSimpleOutput(): '''Create output not based on template''' output = startOutputFile() writePreamble( output ) writeMain( output ) writeWorld( output ) output.close() include_re = re.compile( r"\s*\#\s*include\s+<cxxtest/" ) preamble_re = re.compile( r"^\s*<CxxTest\s+preamble>\s*$" ) world_re = re.compile( r"^\s*<CxxTest\s+world>\s*$" ) def writeTemplateOutput(): '''Create output based on template file''' template = open(templateFileName) output = startOutputFile() while 1: line = template.readline() if not line: break; if include_re.search( line ): writePreamble( output ) output.write( line ) elif preamble_re.search( line ): writePreamble( output ) elif world_re.search( line ): writeWorld( output ) else: output.write( line ) template.close() output.close() def startOutputFile(): '''Create output file and write header''' if outputFileName is not None: output = open( outputFileName, 'w' ) else: output = sys.stdout output.write( "/* Generated file, do not edit */\n\n" ) return output wrotePreamble = 0 def writePreamble( output ): '''Write the CxxTest header (#includes and #defines)''' global wrotePreamble, headers, longlong if wrotePreamble: return output.write( "#ifndef CXXTEST_RUNNING\n" ) output.write( "#define CXXTEST_RUNNING\n" ) output.write( "#endif\n" ) output.write( "\n" ) if haveStandardLibrary: output.write( "#define _CXXTEST_HAVE_STD\n" ) if haveExceptionHandling: output.write( "#define _CXXTEST_HAVE_EH\n" ) if abortOnFail: output.write( "#define _CXXTEST_ABORT_TEST_ON_FAIL\n" ) if longlong: output.write( "#define _CXXTEST_LONGLONG %s\n" % longlong ) if factor: output.write( "#define _CXXTEST_FACTOR\n" ) for header in headers: output.write( "#include %s\n" % header ) output.write( "#include <cxxtest/TestListener.h>\n" ) output.write( "#include <cxxtest/TestTracker.h>\n" ) output.write( "#include <cxxtest/TestRunner.h>\n" ) output.write( "#include <cxxtest/RealDescriptions.h>\n" ) if runner: output.write( "#include <cxxtest/%s.h>\n" % runner ) if gui: output.write( "#include <cxxtest/%s.h>\n" % gui ) output.write( "\n" ) wrotePreamble = 1 def writeMain( output ): '''Write the main() function for the test runner''' if gui: output.write( 'int main( int argc, char *argv[] ) {\n' ) if noStaticInit: output.write( ' CxxTest::initialize();\n' ) output.write( ' return CxxTest::GuiTuiRunner<CxxTest::%s, CxxTest::%s>( argc, argv ).run();\n' % (gui, runner) ) output.write( '}\n' ) elif runner: output.write( 'int main() {\n' ) if noStaticInit: output.write( ' CxxTest::initialize();\n' ) output.write( ' return CxxTest::%s().run();\n' % runner ) output.write( '}\n' ) wroteWorld = 0 def writeWorld( output ): '''Write the world definitions''' global wroteWorld, part if wroteWorld: return writePreamble( output ) writeSuites( output ) if root or not part: writeRoot( output ) if noStaticInit: writeInitialize( output ) wroteWorld = 1 def writeSuites(output): '''Write all TestDescriptions and SuiteDescriptions''' for suite in suites: writeInclude( output, suite['file'] ) if isGenerated(suite): generateSuite( output, suite ) if isDynamic(suite): writeSuitePointer( output, suite ) else: writeSuiteObject( output, suite ) writeTestList( output, suite ) writeSuiteDescription( output, suite ) writeTestDescriptions( output, suite ) def isGenerated(suite): '''Checks whether a suite class should be created''' return suite['generated'] def isDynamic(suite): '''Checks whether a suite is dynamic''' return suite.has_key('create') lastIncluded = '' def writeInclude(output, file): '''Add #include "file" statement''' global lastIncluded if file == lastIncluded: return output.writelines( [ '#include "', file, '"\n\n' ] ) lastIncluded = file def generateSuite( output, suite ): '''Write a suite declared with CXXTEST_SUITE()''' output.write( 'class %s : public CxxTest::TestSuite {\n' % suite['name'] ) output.write( 'public:\n' ) for line in suite['lines']: output.write(line) output.write( '};\n\n' ) def writeSuitePointer( output, suite ): '''Create static suite pointer object for dynamic suites''' if noStaticInit: output.write( 'static %s *%s;\n\n' % (suite['name'], suite['object']) ) else: output.write( 'static %s *%s = 0;\n\n' % (suite['name'], suite['object']) ) def writeSuiteObject( output, suite ): '''Create static suite object for non-dynamic suites''' output.writelines( [ "static ", suite['name'], " ", suite['object'], ";\n\n" ] ) def writeTestList( output, suite ): '''Write the head of the test linked list for a suite''' if noStaticInit: output.write( 'static CxxTest::List %s;\n' % suite['tlist'] ) else: output.write( 'static CxxTest::List %s = { 0, 0 };\n' % suite['tlist'] ) def writeTestDescriptions( output, suite ): '''Write all test descriptions for a suite''' for test in suite['tests']: writeTestDescription( output, suite, test ) def writeTestDescription( output, suite, test ): '''Write test description object''' output.write( 'static class %s : public CxxTest::RealTestDescription {\n' % test['class'] ) output.write( 'public:\n' ) if not noStaticInit: output.write( ' %s() : CxxTest::RealTestDescription( %s, %s, %s, "%s" ) {}\n' % (test['class'], suite['tlist'], suite['dobject'], test['line'], test['name']) ) output.write( ' void runTest() { %s }\n' % runBody( suite, test ) ) output.write( '} %s;\n\n' % test['object'] ) def runBody( suite, test ): '''Body of TestDescription::run()''' if isDynamic(suite): return dynamicRun( suite, test ) else: return staticRun( suite, test ) def dynamicRun( suite, test ): '''Body of TestDescription::run() for test in a dynamic suite''' return 'if ( ' + suite['object'] + ' ) ' + suite['object'] + '->' + test['name'] + '();' def staticRun( suite, test ): '''Body of TestDescription::run() for test in a non-dynamic suite''' return suite['object'] + '.' + test['name'] + '();' def writeSuiteDescription( output, suite ): '''Write SuiteDescription object''' if isDynamic( suite ): writeDynamicDescription( output, suite ) else: writeStaticDescription( output, suite ) def writeDynamicDescription( output, suite ): '''Write SuiteDescription for a dynamic suite''' output.write( 'CxxTest::DynamicSuiteDescription<%s> %s' % (suite['name'], suite['dobject']) ) if not noStaticInit: output.write( '( %s, %s, "%s", %s, %s, %s, %s )' % (suite['cfile'], suite['line'], suite['name'], suite['tlist'], suite['object'], suite['create'], suite['destroy']) ) output.write( ';\n\n' ) def writeStaticDescription( output, suite ): '''Write SuiteDescription for a static suite''' output.write( 'CxxTest::StaticSuiteDescription %s' % suite['dobject'] ) if not noStaticInit: output.write( '( %s, %s, "%s", %s, %s )' % (suite['cfile'], suite['line'], suite['name'], suite['object'], suite['tlist']) ) output.write( ';\n\n' ) def writeRoot(output): '''Write static members of CxxTest classes''' output.write( '#include <cxxtest/Root.cpp>\n' ) def writeInitialize(output): '''Write CxxTest::initialize(), which replaces static initialization''' output.write( 'namespace CxxTest {\n' ) output.write( ' void initialize()\n' ) output.write( ' {\n' ) for suite in suites: output.write( ' %s.initialize();\n' % suite['tlist'] ) if isDynamic(suite): output.write( ' %s = 0;\n' % suite['object'] ) output.write( ' %s.initialize( %s, %s, "%s", %s, %s, %s, %s );\n' % (suite['dobject'], suite['cfile'], suite['line'], suite['name'], suite['tlist'], suite['object'], suite['create'], suite['destroy']) ) else: output.write( ' %s.initialize( %s, %s, "%s", %s, %s );\n' % (suite['dobject'], suite['cfile'], suite['line'], suite['name'], suite['object'], suite['tlist']) ) for test in suite['tests']: output.write( ' %s.initialize( %s, %s, %s, "%s" );\n' % (test['object'], suite['tlist'], suite['dobject'], test['line'], test['name']) ) output.write( ' }\n' ) output.write( '}\n' ) main() ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/COPYING��������������������������������������������������0000644�0001750�0001750�00000063476�12320456500�021161� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the library's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. <signature of Ty Coon>, 1 April 1990 Ty Coon, President of Vice That's all there is to it! ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/cxxtest/README���������������������������������������������������0000644�0001750�0001750�00000002371�12320456500�020771� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Introduction ------------ CxxTest is a JUnit/CppUnit/xUnit-like framework for C++. Its advantages over existing alternatives are that it: - Doesn't require RTTI - Doesn't require member template functions - Doesn't require exception handling - Doesn't require any external libraries (including memory management, file/console I/O, graphics libraries) This makes it extremely portable and usable. CxxTest is available under the GNU Lesser General Public Licence (LGPL). See http://www.gnu.org/copyleft/lesser.html for the license. Simple user's guide ------------------- 1. Create a test suite header file: MyTest.h: #include <cxxtest/TestSuite.h> class MyTestSuite : public CxxTest::TestSuite { public: void testAddition( void ) { TS_ASSERT( 1 + 1 > 1 ); TS_ASSERT_EQUALS( 1 + 1, 2 ); } }; 2. Generate the tests file: # cxxtestgen.pl -o tests.cpp MyTestSuite.h 3. Create a main function that runs the tests main.cpp: #include <cxxtest/ErrorPrinter.h> int main( void ) { CxxText::ErrorPrinter::runAllTests(); return 0; } 4. Compile and run! # g++ -o main main.cpp tests.cpp # ./main Running 1 test(s).OK! Advanced User's Guide --------------------- See docs/guide.html. �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/�����������������������������������������������������������0000755�0001750�0001750�00000000000�12320456500�017517� 5����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_lzdecompbase.cpp�������������������������������������0000644�0001750�0001750�00000002427�12320456500�024073� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_lzdecompbase.cpp // See Copyright Notice and license at the end of include/lzham.h #include "lzham_core.h" #include "lzham_lzdecompbase.h" namespace lzham { void CLZDecompBase::init_position_slots(uint dict_size_log2) { m_dict_size_log2 = dict_size_log2; m_dict_size = 1U << dict_size_log2; int i, j; for (i = 0, j = 0; i < cLZXMaxPositionSlots; i += 2) { m_lzx_position_extra_bits[i] = (uint8)j; m_lzx_position_extra_bits[i + 1] = (uint8)j; if ((i != 0) && (j < 25)) j++; } for (i = 0, j = 0; i < cLZXMaxPositionSlots; i++) { m_lzx_position_base[i] = j; m_lzx_position_extra_mask[i] = (1 << m_lzx_position_extra_bits[i]) - 1; j += (1 << m_lzx_position_extra_bits[i]); } m_num_lzx_slots = 0; const uint largest_dist = m_dict_size - 1; for (i = 0; i < cLZXMaxPositionSlots; i++) { if ( (largest_dist >= m_lzx_position_base[i]) && (largest_dist < (m_lzx_position_base[i] + (1 << m_lzx_position_extra_bits[i])) ) ) { m_num_lzx_slots = i + 1; break; } } LZHAM_VERIFY(m_num_lzx_slots); } } //namespace lzham �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_prefix_coding.cpp������������������������������������0000644�0001750�0001750�00000026041�12320456500�024241� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_prefix_coding.cpp // See Copyright Notice and license at the end of include/lzham.h #include "lzham_core.h" #include "lzham_prefix_coding.h" #ifdef LZHAM_BUILD_DEBUG //#define TEST_DECODER_TABLES #endif namespace lzham { namespace prefix_coding { bool limit_max_code_size(uint num_syms, uint8* pCodesizes, uint max_code_size) { const uint cMaxEverCodeSize = 34; if ((!num_syms) || (num_syms > cMaxSupportedSyms) || (max_code_size < 1) || (max_code_size > cMaxEverCodeSize)) return false; uint num_codes[cMaxEverCodeSize + 1]; utils::zero_object(num_codes); bool should_limit = false; for (uint i = 0; i < num_syms; i++) { uint c = pCodesizes[i]; LZHAM_ASSERT(c <= cMaxEverCodeSize); // "% (cMaxEverCodeSize + 1)" seems to fix a GCC compiler bug // throwing an "array subscript is above array bounds" warning at us // when compiling this file with -O2 code optimization num_codes[c % (cMaxEverCodeSize + 1)]++; if (c > max_code_size) should_limit = true; } if (!should_limit) return true; uint ofs = 0; uint next_sorted_ofs[cMaxEverCodeSize + 1]; for (uint i = 1; i <= cMaxEverCodeSize; i++) { next_sorted_ofs[i] = ofs; ofs += num_codes[i]; } if ((ofs < 2) || (ofs > cMaxSupportedSyms)) return true; if (ofs > (1U << max_code_size)) return false; for (uint i = max_code_size + 1; i <= cMaxEverCodeSize; i++) num_codes[max_code_size] += num_codes[i]; // Technique of adjusting tree to enforce maximum code size from LHArc. uint total = 0; for (uint i = max_code_size; i; --i) total += (num_codes[i] << (max_code_size - i)); if (total == (1U << max_code_size)) return true; do { num_codes[max_code_size]--; uint i; for (i = max_code_size - 1; i; --i) { if (!num_codes[i]) continue; num_codes[i]--; num_codes[i + 1] += 2; break; } if (!i) return false; total--; } while (total != (1U << max_code_size)); uint8 new_codesizes[cMaxSupportedSyms]; uint8* p = new_codesizes; for (uint i = 1; i <= max_code_size; i++) { uint n = num_codes[i]; if (n) { memset(p, i, n); p += n; } } for (uint i = 0; i < num_syms; i++) { const uint c = pCodesizes[i]; if (c) { uint next_ofs = next_sorted_ofs[c]; next_sorted_ofs[c] = next_ofs + 1; pCodesizes[i] = static_cast<uint8>(new_codesizes[next_ofs]); } } return true; } bool generate_codes(uint num_syms, const uint8* pCodesizes, uint16* pCodes) { uint num_codes[cMaxExpectedCodeSize + 1]; utils::zero_object(num_codes); for (uint i = 0; i < num_syms; i++) { uint c = pCodesizes[i]; LZHAM_ASSERT(c <= cMaxExpectedCodeSize); num_codes[c]++; } uint code = 0; uint next_code[cMaxExpectedCodeSize + 1]; next_code[0] = 0; for (uint i = 1; i <= cMaxExpectedCodeSize; i++) { next_code[i] = code; code = (code + num_codes[i]) << 1; } if (code != (1 << (cMaxExpectedCodeSize + 1))) { uint t = 0; for (uint i = 1; i <= cMaxExpectedCodeSize; i++) { t += num_codes[i]; if (t > 1) return false; } } for (uint i = 0; i < num_syms; i++) { uint c = pCodesizes[i]; LZHAM_ASSERT(!c || (next_code[c] <= LZHAM_UINT16_MAX)); pCodes[i] = static_cast<uint16>(next_code[c]++); LZHAM_ASSERT(!c || (math::total_bits(pCodes[i]) <= pCodesizes[i])); } return true; } bool generate_decoder_tables(uint num_syms, const uint8* pCodesizes, decoder_tables* pTables, uint table_bits) { uint min_codes[cMaxExpectedCodeSize]; if ((!num_syms) || (table_bits > cMaxTableBits)) return false; pTables->m_num_syms = num_syms; uint num_codes[cMaxExpectedCodeSize + 1]; utils::zero_object(num_codes); for (uint i = 0; i < num_syms; i++) { uint c = pCodesizes[i]; num_codes[c]++; } uint sorted_positions[cMaxExpectedCodeSize + 1]; uint next_code = 0; uint total_used_syms = 0; uint max_code_size = 0; uint min_code_size = UINT_MAX; for (uint i = 1; i <= cMaxExpectedCodeSize; i++) { const uint n = num_codes[i]; if (!n) pTables->m_max_codes[i - 1] = 0;//UINT_MAX; else { min_code_size = math::minimum(min_code_size, i); max_code_size = math::maximum(max_code_size, i); min_codes[i - 1] = next_code; pTables->m_max_codes[i - 1] = next_code + n - 1; pTables->m_max_codes[i - 1] = 1 + ((pTables->m_max_codes[i - 1] << (16 - i)) | ((1 << (16 - i)) - 1)); pTables->m_val_ptrs[i - 1] = total_used_syms; sorted_positions[i] = total_used_syms; next_code += n; total_used_syms += n; } next_code <<= 1; } pTables->m_total_used_syms = total_used_syms; if (total_used_syms > pTables->m_cur_sorted_symbol_order_size) { pTables->m_cur_sorted_symbol_order_size = total_used_syms; if (!math::is_power_of_2(total_used_syms)) pTables->m_cur_sorted_symbol_order_size = math::minimum<uint>(num_syms, math::next_pow2_32(total_used_syms)); if (pTables->m_sorted_symbol_order) { lzham_delete_array(pTables->m_sorted_symbol_order); pTables->m_sorted_symbol_order = NULL; } pTables->m_sorted_symbol_order = lzham_new_array<uint16>(pTables->m_cur_sorted_symbol_order_size); if (!pTables->m_sorted_symbol_order) return false; } pTables->m_min_code_size = static_cast<uint8>(min_code_size); pTables->m_max_code_size = static_cast<uint8>(max_code_size); for (uint i = 0; i < num_syms; i++) { uint c = pCodesizes[i]; if (c) { LZHAM_ASSERT(num_codes[c]); uint sorted_pos = sorted_positions[c]++; LZHAM_ASSERT(sorted_pos < total_used_syms); pTables->m_sorted_symbol_order[sorted_pos] = static_cast<uint16>(i); } } if (table_bits <= pTables->m_min_code_size) table_bits = 0; pTables->m_table_bits = table_bits; if (table_bits) { uint table_size = 1 << table_bits; if (table_size > pTables->m_cur_lookup_size) { pTables->m_cur_lookup_size = table_size; if (pTables->m_lookup) { lzham_delete_array(pTables->m_lookup); pTables->m_lookup = NULL; } pTables->m_lookup = lzham_new_array<uint32>(table_size); if (!pTables->m_lookup) return false; } memset(pTables->m_lookup, 0xFF, static_cast<uint>(sizeof(pTables->m_lookup[0])) * (1UL << table_bits)); for (uint codesize = 1; codesize <= table_bits; codesize++) { if (!num_codes[codesize]) continue; const uint fillsize = table_bits - codesize; const uint fillnum = 1 << fillsize; const uint min_code = min_codes[codesize - 1]; const uint max_code = pTables->get_unshifted_max_code(codesize); const uint val_ptr = pTables->m_val_ptrs[codesize - 1]; for (uint code = min_code; code <= max_code; code++) { const uint sym_index = pTables->m_sorted_symbol_order[ val_ptr + code - min_code ]; LZHAM_ASSERT( pCodesizes[sym_index] == codesize ); for (uint j = 0; j < fillnum; j++) { const uint t = j + (code << fillsize); LZHAM_ASSERT(t < (1U << table_bits)); LZHAM_ASSERT(pTables->m_lookup[t] == LZHAM_UINT32_MAX); pTables->m_lookup[t] = sym_index | (codesize << 16U); } } } } for (uint i = 0; i < cMaxExpectedCodeSize; i++) pTables->m_val_ptrs[i] -= min_codes[i]; pTables->m_table_max_code = 0; pTables->m_decode_start_code_size = pTables->m_min_code_size; if (table_bits) { uint i; for (i = table_bits; i >= 1; i--) { if (num_codes[i]) { pTables->m_table_max_code = pTables->m_max_codes[i - 1]; break; } } if (i >= 1) { pTables->m_decode_start_code_size = table_bits + 1; for (i = table_bits + 1; i <= max_code_size; i++) { if (num_codes[i]) { pTables->m_decode_start_code_size = i; break; } } } } // sentinels pTables->m_max_codes[cMaxExpectedCodeSize] = UINT_MAX; pTables->m_val_ptrs[cMaxExpectedCodeSize] = 0xFFFFF; pTables->m_table_shift = 32 - pTables->m_table_bits; return true; } } // namespace prefix_codig } // namespace lzham �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham.h����������������������������������������������������0000644�0001750�0001750�00000123615�12320456500�021013� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham.h - Copyright (c) 2009-2012 Richard Geldreich, Jr. <richgel99@gmail.com> // LZHAM uses the MIT License. See Copyright Notice and license at the end of this file. // // This is the main header file, includable from C or C++ files, which defines all the publically available API's, structs, and types used by the LZHAM codec. // // Notes: // // As of LZHAM alpha8, there are now two sets of API's: // - The first (oldest) API directly exposes all of the codec's functionality. See lzham_compress_init(), lzham_decompress_init(), etc. This API has the lowest overhead // and is the most tested. // - The new API implements the most useful/popular subset of the zlib API, but doesn't expose all of the codec's functionality yet. See the lzham_z* functions. // This functionality is provided because most users of compression libraries are already very familiar with the nuts and bolts of the zlib API. // For the most common zlib usage cases LZHAM is an almost drop-in replacement for zlib. To make switching from zlib even easier, you can define the LZHAM_DEFINE_ZLIB_API macro, // which causes this header to #define most zlib symbols to their LZHAM equivalents. // Note that LZHAM does not actually implement the deflate/inflate algorithm, so it cannot decompress streams created by standard zlib yet (and of course, zlib cannot decompress // streams created by LZHAM). Internally, this API is mostly implemented via the older low-level LZHAM API. #ifndef __LZHAM_H__ #define __LZHAM_H__ #ifdef _MSC_VER #pragma once #endif #include <stdlib.h> // Upper byte = major version // Lower byte = minor version #define LZHAM_DLL_VERSION 0x1008 #if defined(_MSC_VER) #define LZHAM_CDECL __cdecl #else #define LZHAM_CDECL #endif #ifdef LZHAM_EXPORTS #define LZHAM_DLL_EXPORT __declspec(dllexport) #else #define LZHAM_DLL_EXPORT #endif #ifdef __cplusplus extern "C" { #endif typedef unsigned char lzham_uint8; typedef signed int lzham_int32; typedef unsigned int lzham_uint32; typedef unsigned int lzham_bool; // Returns DLL version (LZHAM_DLL_VERSION). LZHAM_DLL_EXPORT lzham_uint32 LZHAM_CDECL lzham_get_version(void); // User provided memory allocation // Custom allocation function must return pointers with LZHAM_MIN_ALLOC_ALIGNMENT (or better). #define LZHAM_MIN_ALLOC_ALIGNMENT sizeof(size_t) * 2 typedef void* (LZHAM_CDECL *lzham_realloc_func)(void* p, size_t size, size_t* pActual_size, lzham_bool movable, void* pUser_data); typedef size_t (LZHAM_CDECL *lzham_msize_func)(void* p, void* pUser_data); // Call this function to force LZHAM to use custom memory malloc(), realloc(), free() and msize functions. LZHAM_DLL_EXPORT void LZHAM_CDECL lzham_set_memory_callbacks(lzham_realloc_func pRealloc, lzham_msize_func pMSize, void* pUser_data); // lzham_flush_t must map directly to the zlib-style API flush types (LZHAM_Z_NO_FLUSH, etc.) typedef enum { LZHAM_NO_FLUSH = 0, LZHAM_SYNC_FLUSH = 2, LZHAM_FULL_FLUSH = 3, LZHAM_FINISH = 4, LZHAM_TABLE_FLUSH = 10 } lzham_flush_t; // Compression #define LZHAM_MIN_DICT_SIZE_LOG2 15 #define LZHAM_MAX_DICT_SIZE_LOG2_X86 26 #define LZHAM_MAX_DICT_SIZE_LOG2_X64 29 #define LZHAM_MAX_HELPER_THREADS 16 typedef enum { LZHAM_COMP_STATUS_NOT_FINISHED = 0, LZHAM_COMP_STATUS_NEEDS_MORE_INPUT, LZHAM_COMP_STATUS_HAS_MORE_OUTPUT, // All the following enums must indicate failure/success. LZHAM_COMP_STATUS_FIRST_SUCCESS_OR_FAILURE_CODE, LZHAM_COMP_STATUS_SUCCESS = LZHAM_COMP_STATUS_FIRST_SUCCESS_OR_FAILURE_CODE, LZHAM_COMP_STATUS_FIRST_FAILURE_CODE, LZHAM_COMP_STATUS_FAILED = LZHAM_COMP_STATUS_FIRST_FAILURE_CODE, LZHAM_COMP_STATUS_FAILED_INITIALIZING, LZHAM_COMP_STATUS_INVALID_PARAMETER, LZHAM_COMP_STATUS_OUTPUT_BUF_TOO_SMALL, LZHAM_COMP_STATUS_FORCE_DWORD = 0xFFFFFFFF } lzham_compress_status_t; typedef enum { LZHAM_COMP_LEVEL_FASTEST = 0, LZHAM_COMP_LEVEL_FASTER, LZHAM_COMP_LEVEL_DEFAULT, LZHAM_COMP_LEVEL_BETTER, LZHAM_COMP_LEVEL_UBER, LZHAM_TOTAL_COMP_LEVELS, LZHAM_COMP_LEVEL_FORCE_DWORD = 0xFFFFFFFF } lzham_compress_level; // Streaming compression typedef void *lzham_compress_state_ptr; typedef enum { LZHAM_COMP_FLAG_FORCE_POLAR_CODING = 1, // Forces Polar codes vs. Huffman, for a slight increase in decompression speed. LZHAM_COMP_FLAG_EXTREME_PARSING = 2, // Improves ratio by allowing the compressor's parse graph to grow "higher" (up to 4 parent nodes per output node), but is much slower. LZHAM_COMP_FLAG_DETERMINISTIC_PARSING = 4, // Guarantees that the compressed output will always be the same given the same input and parameters (no variation between runs due to kernel threading scheduling). // If enabled, the compressor is free to use any optimizations which could lower the decompression rate (such // as adaptively resetting the Huffman table update rate to maximum frequency, which is costly for the decompressor). LZHAM_COMP_FLAG_TRADEOFF_DECOMPRESSION_RATE_FOR_COMP_RATIO = 16, LZHAM_COMP_FLAG_WRITE_ZLIB_STREAM = 32, } lzham_compress_flags; typedef struct { lzham_uint32 m_struct_size; // set to sizeof(lzham_compress_params) lzham_uint32 m_dict_size_log2; // set to the log2(dictionary_size), must range between [LZHAM_MIN_DICT_SIZE_LOG2, LZHAM_MAX_DICT_SIZE_LOG2_X86] for x86 LZHAM_MAX_DICT_SIZE_LOG2_X64 for x64 lzham_compress_level m_level; // set to LZHAM_COMP_LEVEL_FASTEST, etc. lzham_int32 m_max_helper_threads; // max # of additional "helper" threads to create, must range between [-1,LZHAM_MAX_HELPER_THREADS], where -1=max practical lzham_uint32 m_cpucache_total_lines; // set to 0 (optimize compressed stream to avoid L1/L2 cache misses - not currently supported) lzham_uint32 m_cpucache_line_size; // set to 0 lzham_uint32 m_compress_flags; // optional compression flags (see lzham_compress_flags enum) lzham_uint32 m_num_seed_bytes; // for delta compression (optional) - number of seed bytes pointed to by m_pSeed_bytes const void *m_pSeed_bytes; // for delta compression (optional) - pointer to seed bytes buffer, must be at least m_num_seed_bytes long } lzham_compress_params; // Initializes a compressor. Returns a pointer to the compressor's internal state, or NULL on failure. // pParams cannot be NULL. Be sure to initialize the pParams->m_struct_size member to sizeof(lzham_compress_params) (along with the other members to reasonable values) before calling this function. // TODO: With large dictionaries this function could take a while (due to memory allocation). I need to add a reinit() API for compression (decompression already has one). LZHAM_DLL_EXPORT lzham_compress_state_ptr LZHAM_CDECL lzham_compress_init(const lzham_compress_params *pParams); LZHAM_DLL_EXPORT lzham_compress_state_ptr LZHAM_CDECL lzham_compress_reinit(lzham_compress_state_ptr pState); // Deinitializes a compressor, releasing all allocated memory. // returns adler32 of source data (valid only on success). LZHAM_DLL_EXPORT lzham_uint32 LZHAM_CDECL lzham_compress_deinit(lzham_compress_state_ptr pState); // Compresses an arbitrarily sized block of data, writing as much available compressed data as possible to the output buffer. // This method may be called as many times as needed, but for best perf. try not to call it with tiny buffers. // pState - Pointer to internal compression state, created by lzham_compress_init. // pIn_buf, pIn_buf_size - Pointer to input data buffer, and pointer to a size_t containing the number of bytes available in this buffer. // On return, *pIn_buf_size will be set to the number of bytes read from the buffer. // pOut_buf, pOut_buf_size - Pointer to the output data buffer, and a pointer to a size_t containing the max number of bytes that can be written to this buffer. // On return, *pOut_buf_size will be set to the number of bytes written to this buffer. // no_more_input_bytes_flag - Set to true to indicate that no more input bytes are available to compress (EOF). Once you call this function with this param set to true, it must stay set to true in all future calls. // // Normal return status codes: // LZHAM_COMP_STATUS_NOT_FINISHED - Compression can continue, but the compressor needs more input, or it needs more room in the output buffer. // LZHAM_COMP_STATUS_NEEDS_MORE_INPUT - Compression can contintue, but the compressor has no more output, and has no input but we're not at EOF. Supply more input to continue. // Success/failure return status codes: // LZHAM_COMP_STATUS_SUCCESS - Compression has completed successfully. // LZHAM_COMP_STATUS_FAILED, LZHAM_COMP_STATUS_FAILED_INITIALIZING, LZHAM_COMP_STATUS_INVALID_PARAMETER - Something went wrong. LZHAM_DLL_EXPORT lzham_compress_status_t LZHAM_CDECL lzham_compress( lzham_compress_state_ptr pState, const lzham_uint8 *pIn_buf, size_t *pIn_buf_size, lzham_uint8 *pOut_buf, size_t *pOut_buf_size, lzham_bool no_more_input_bytes_flag); LZHAM_DLL_EXPORT lzham_compress_status_t LZHAM_CDECL lzham_compress2( lzham_compress_state_ptr pState, const lzham_uint8 *pIn_buf, size_t *pIn_buf_size, lzham_uint8 *pOut_buf, size_t *pOut_buf_size, lzham_flush_t flush_type); // Single function call compression interface. // Same return codes as lzham_compress, except this function can also return LZHAM_COMP_STATUS_OUTPUT_BUF_TOO_SMALL. LZHAM_DLL_EXPORT lzham_compress_status_t LZHAM_CDECL lzham_compress_memory( const lzham_compress_params *pParams, lzham_uint8* pDst_buf, size_t *pDst_len, const lzham_uint8* pSrc_buf, size_t src_len, lzham_uint32 *pAdler32); // Decompression typedef enum { // LZHAM_DECOMP_STATUS_NOT_FINISHED indicates that the decompressor is flushing its internal buffer to the caller's output buffer. // There may be more bytes available to decompress on the next call, but there is no guarantee. LZHAM_DECOMP_STATUS_NOT_FINISHED = 0, // LZHAM_DECOMP_STATUS_HAS_MORE_OUTPUT indicates that the decompressor is trying to flush its internal buffer to the caller's output buffer, // but the caller hasn't provided any space to copy this data to the caller's output buffer. Call the lzham_decompress() again with a non-empty sized output buffer. LZHAM_DECOMP_STATUS_HAS_MORE_OUTPUT, // LZHAM_DECOMP_STATUS_NEEDS_MORE_INPUT indicates that the decompressor has consumed all input bytes, has not encountered an "end of stream" code, // and the caller hasn't set no_more_input_bytes_flag to true, so it's expecting more input to proceed. LZHAM_DECOMP_STATUS_NEEDS_MORE_INPUT, // All the following enums always (and MUST) indicate failure/success. LZHAM_DECOMP_STATUS_FIRST_SUCCESS_OR_FAILURE_CODE, // LZHAM_DECOMP_STATUS_SUCCESS indicates decompression has successfully completed. LZHAM_DECOMP_STATUS_SUCCESS = LZHAM_DECOMP_STATUS_FIRST_SUCCESS_OR_FAILURE_CODE, // The remaining status codes indicate a failure of some sort. Most failures are unrecoverable. TODO: Document which codes are recoverable. LZHAM_DECOMP_STATUS_FIRST_FAILURE_CODE, LZHAM_DECOMP_STATUS_FAILED_INITIALIZING = LZHAM_DECOMP_STATUS_FIRST_FAILURE_CODE, LZHAM_DECOMP_STATUS_FAILED_DEST_BUF_TOO_SMALL, LZHAM_DECOMP_STATUS_FAILED_EXPECTED_MORE_RAW_BYTES, LZHAM_DECOMP_STATUS_FAILED_BAD_CODE, LZHAM_DECOMP_STATUS_FAILED_ADLER32, LZHAM_DECOMP_STATUS_FAILED_BAD_RAW_BLOCK, LZHAM_DECOMP_STATUS_FAILED_BAD_COMP_BLOCK_SYNC_CHECK, LZHAM_DECOMP_STATUS_FAILED_BAD_ZLIB_HEADER, LZHAM_DECOMP_STATUS_FAILED_NEED_SEED_BYTES, LZHAM_DECOMP_STATUS_FAILED_BAD_SEED_BYTES, LZHAM_DECOMP_STATUS_FAILED_BAD_SYNC_BLOCK, LZHAM_DECOMP_STATUS_INVALID_PARAMETER, } lzham_decompress_status_t; typedef void *lzham_decompress_state_ptr; typedef enum { LZHAM_DECOMP_FLAG_OUTPUT_UNBUFFERED = 1, LZHAM_DECOMP_FLAG_COMPUTE_ADLER32 = 2, LZHAM_DECOMP_FLAG_READ_ZLIB_STREAM = 4, } lzham_decompress_flags; // Decompression parameters structure. // Notes: // m_dict_size_log2 MUST match the value used during compression! // If m_num_seed_bytes != 0, LZHAM_DECOMP_FLAG_OUTPUT_UNBUFFERED must not be set (i.e. static "seed" dictionaries are not compatible with unbuffered decompression). // The seed buffer's contents and size must match the seed buffer used during compression. typedef struct { lzham_uint32 m_struct_size; // set to sizeof(lzham_decompress_params) lzham_uint32 m_dict_size_log2; // set to the log2(dictionary_size), must range between [LZHAM_MIN_DICT_SIZE_LOG2, LZHAM_MAX_DICT_SIZE_LOG2_X86] for x86 LZHAM_MAX_DICT_SIZE_LOG2_X64 for x64 lzham_uint32 m_decompress_flags; // optional decompression flags (see lzham_decompress_flags enum) lzham_uint32 m_num_seed_bytes; // for delta compression (optional) - number of seed bytes pointed to by m_pSeed_bytes const void *m_pSeed_bytes; // for delta compression (optional) - pointer to seed bytes buffer, must be at least m_num_seed_bytes long } lzham_decompress_params; // Initializes a decompressor. // pParams cannot be NULL. Be sure to initialize the pParams->m_struct_size member to sizeof(lzham_decompress_params) (along with the other members to reasonable values) before calling this function. // Note: With large dictionaries this function could take a while (due to memory allocation). To serially decompress multiple streams, it's faster to init a compressor once and // reuse it using by calling lzham_decompress_reinit(). LZHAM_DLL_EXPORT lzham_decompress_state_ptr LZHAM_CDECL lzham_decompress_init(const lzham_decompress_params *pParams); // Quickly re-initializes the decompressor to its initial state given an already allocated/initialized state (doesn't do any memory alloc unless necessary). LZHAM_DLL_EXPORT lzham_decompress_state_ptr LZHAM_CDECL lzham_decompress_reinit(lzham_decompress_state_ptr pState, const lzham_decompress_params *pParams); // Deinitializes a decompressor. // returns adler32 of decompressed data if compute_adler32 was true, otherwise it returns the adler32 from the compressed stream. LZHAM_DLL_EXPORT lzham_uint32 LZHAM_CDECL lzham_decompress_deinit(lzham_decompress_state_ptr pState); // Decompresses an arbitrarily sized block of compressed data, writing as much available decompressed data as possible to the output buffer. // This method is implemented as a coroutine so it may be called as many times as needed. However, for best perf. try not to call it with tiny buffers. // pState - Pointer to internal decompression state, originally created by lzham_decompress_init. // pIn_buf, pIn_buf_size - Pointer to input data buffer, and pointer to a size_t containing the number of bytes available in this buffer. // On return, *pIn_buf_size will be set to the number of bytes read from the buffer. // pOut_buf, pOut_buf_size - Pointer to the output data buffer, and a pointer to a size_t containing the max number of bytes that can be written to this buffer. // On return, *pOut_buf_size will be set to the number of bytes written to this buffer. // no_more_input_bytes_flag - Set to true to indicate that no more input bytes are available to compress (EOF). Once you call this function with this param set to true, it must stay set to true in all future calls. // Notes: // In unbuffered mode, the output buffer MUST be large enough to hold the entire decompressed stream. Otherwise, you'll receive the // LZHAM_DECOMP_STATUS_FAILED_DEST_BUF_TOO_SMALL error (which is currently unrecoverable during unbuffered decompression). // In buffered mode, if the output buffer's size is 0 bytes, the caller is indicating that no more output bytes are expected from the // decompressor. In this case, if the decompressor actually has more bytes you'll receive the LZHAM_DECOMP_STATUS_HAS_MORE_OUTPUT // error (which is recoverable in the buffered case - just call lzham_decompress() again with a non-zero size output buffer). LZHAM_DLL_EXPORT lzham_decompress_status_t LZHAM_CDECL lzham_decompress( lzham_decompress_state_ptr pState, const lzham_uint8 *pIn_buf, size_t *pIn_buf_size, lzham_uint8 *pOut_buf, size_t *pOut_buf_size, lzham_bool no_more_input_bytes_flag); // Single function call interface. LZHAM_DLL_EXPORT lzham_decompress_status_t LZHAM_CDECL lzham_decompress_memory( const lzham_decompress_params *pParams, lzham_uint8* pDst_buf, size_t *pDst_len, const lzham_uint8* pSrc_buf, size_t src_len, lzham_uint32 *pAdler32); // ------------------- zlib-style API Definitions. // Important note: LZHAM doesn't internally support the Deflate algorithm, but for API compatibility the "Deflate" and "Inflate" names are retained here. typedef unsigned long lzham_z_ulong; // Heap allocation callbacks. // Note that lzham_alloc_func parameter types purposely differ from zlib's: items/size is size_t, not unsigned long. typedef void *(*lzham_z_alloc_func)(void *opaque, size_t items, size_t size); typedef void (*lzham_z_free_func)(void *opaque, void *address); typedef void *(*lzham_z_realloc_func)(void *opaque, void *address, size_t items, size_t size); #define LZHAM_Z_ADLER32_INIT (1) // lzham_adler32() returns the initial adler-32 value to use when called with ptr==NULL. LZHAM_DLL_EXPORT lzham_z_ulong lzham_z_adler32(lzham_z_ulong adler, const unsigned char *ptr, size_t buf_len); #define LZHAM_Z_CRC32_INIT (0) // lzham_crc32() returns the initial CRC-32 value to use when called with ptr==NULL. LZHAM_DLL_EXPORT lzham_z_ulong lzham_z_crc32(lzham_z_ulong crc, const unsigned char *ptr, size_t buf_len); // Compression strategies. enum { LZHAM_Z_DEFAULT_STRATEGY = 0, LZHAM_Z_FILTERED = 1, LZHAM_Z_HUFFMAN_ONLY = 2, LZHAM_Z_RLE = 3, LZHAM_Z_FIXED = 4 }; // Method #define LZHAM_Z_DEFLATED 8 #define LZHAM_Z_LZHAM 14 #define LZHAM_Z_VERSION "10.8.1" #define LZHAM_Z_VERNUM 0xA810 #define LZHAM_Z_VER_MAJOR 10 #define LZHAM_Z_VER_MINOR 8 #define LZHAM_Z_VER_REVISION 1 #define LZHAM_Z_VER_SUBREVISION 0 // Flush values. // For compression, you typically only need to use LZHAM_NO_FLUSH and LZHAM_FINISH. // LZHAM_Z_SYNC_FLUSH and LZHAM_Z_FULL_FLUSH during compression forces compression of all buffered input. // // For decompression, you typically only need to use LZHAM_Z_SYNC_FLUSH or LZHAM_Z_FINISH. // LZHAM_Z_FINISH during decompression guarantees that the output buffer is large enough to hold all remaining data to decompress. // See http://www.bolet.org/~pornin/deflate-flush.html // Must directly map to lzham_flush_t enum { LZHAM_Z_NO_FLUSH = 0, // compression/decompression LZHAM_Z_PARTIAL_FLUSH = 1, // compression/decompression, same as LZHAM_Z_SYNC_FLUSH LZHAM_Z_SYNC_FLUSH = 2, // compression/decompression, when compressing: flush current block (if any), always outputs sync block (aligns output to byte boundary, a 0xFFFF0000 marker will appear in the output stream) LZHAM_Z_FULL_FLUSH = 3, // compression/decompression, when compressing: same as LZHAM_Z_SYNC_FLUSH but also forces a full state flush (LZ dictionary, all symbol statistics) LZHAM_Z_FINISH = 4, // compression/decompression LZHAM_Z_BLOCK = 5, // not supported LZHAM_Z_TABLE_FLUSH = 10 // compression only, resets all symbol table update rates to maximum frequency (LZHAM extension) }; // Return status codes. LZHAM_Z_PARAM_ERROR is non-standard. enum { LZHAM_Z_OK = 0, LZHAM_Z_STREAM_END = 1, LZHAM_Z_NEED_DICT = 2, LZHAM_Z_ERRNO = -1, LZHAM_Z_STREAM_ERROR = -2, LZHAM_Z_DATA_ERROR = -3, LZHAM_Z_MEM_ERROR = -4, LZHAM_Z_BUF_ERROR = -5, LZHAM_Z_VERSION_ERROR = -6, LZHAM_Z_PARAM_ERROR = -10000 }; // Compression levels. enum { LZHAM_Z_NO_COMPRESSION = 0, LZHAM_Z_BEST_SPEED = 1, LZHAM_Z_BEST_COMPRESSION = 9, LZHAM_Z_UBER_COMPRESSION = 10, // uber = best with extreme parsing (can be very slow) LZHAM_Z_DEFAULT_COMPRESSION = -1 }; // Window bits // Important note: The zlib-style API's default to 32KB dictionary for API compatibility. For improved compression, be sure to call deflateInit2/inflateInit2 and specify larger custom window_bits values! // If changing the calling code isn't practical, unremark LZHAM_Z_API_FORCE_WINDOW_BITS. #define LZHAM_Z_DEFAULT_WINDOW_BITS 15 // Define LZHAM_Z_API_FORCE_WINDOW_BITS to force the entire library to use a constant value for window_bits (helps with porting) in all zlib API's. // TODO: Might be useful to provide an API to control this at runtime. //#define LZHAM_Z_API_FORCE_WINDOW_BITS 23 // Data types #define LZHAM_Z_BINARY 0 #define LZHAM_Z_TEXT 1 #define LZHAM_Z_ASCII 1 #define LZHAM_Z_UNKNOWN 2 struct lzham_z_internal_state; // Compression/decompression stream struct. typedef struct { const unsigned char *next_in; // pointer to next byte to read unsigned int avail_in; // number of bytes available at next_in lzham_z_ulong total_in; // total number of bytes consumed so far unsigned char *next_out; // pointer to next byte to write unsigned int avail_out; // number of bytes that can be written to next_out lzham_z_ulong total_out; // total number of bytes produced so far char *msg; // error msg (unused) struct lzham_z_internal_state *state; // internal state, allocated by zalloc/zfree // LZHAM does not support per-stream heap callbacks. Use lzham_set_memory_callbacks() instead. // These members are ignored - they are here for backwards compatibility with zlib. lzham_z_alloc_func zalloc; // optional heap allocation function (defaults to malloc) lzham_z_free_func zfree; // optional heap free function (defaults to free) void *opaque; // heap alloc function user pointer int data_type; // data_type (unused) lzham_z_ulong adler; // adler32 of the source or uncompressed data lzham_z_ulong reserved; // not used } lzham_z_stream; typedef lzham_z_stream *lzham_z_streamp; LZHAM_DLL_EXPORT const char *lzham_z_version(void); // lzham_deflateInit() initializes a compressor with default options: // Parameters: // pStream must point to an initialized lzham_stream struct. // level must be between [LZHAM_NO_COMPRESSION, LZHAM_BEST_COMPRESSION]. // level 1 enables a specially optimized compression function that's been optimized purely for performance, not ratio. // Return values: // LZHAM_OK on success. // LZHAM_STREAM_ERROR if the stream is bogus. // LZHAM_PARAM_ERROR if the input parameters are bogus. // LZHAM_MEM_ERROR on out of memory. LZHAM_DLL_EXPORT int lzham_z_deflateInit(lzham_z_streamp pStream, int level); // lzham_deflateInit2() is like lzham_deflate(), except with more control: // Additional parameters: // method must be LZHAM_Z_DEFLATED or LZHAM_Z_LZHAM (LZHAM_Z_DEFLATED will be internally converted to LZHAM_Z_LZHAM with a windowsize of LZHAM_Z_DEFAULT_WINDOW_BITS) // window_bits must be LZHAM_DEFAULT_WINDOW_BITS (to wrap the deflate stream with zlib header/adler-32 footer) or -LZHAM_Z_DEFAULT_WINDOW_BITS (raw deflate/no header or footer) // mem_level must be between [1, 9] (it's checked but ignored by lzham) LZHAM_DLL_EXPORT int lzham_z_deflateInit2(lzham_z_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy); // Quickly resets a compressor without having to reallocate anything. Same as calling lzham_z_deflateEnd() followed by lzham_z_deflateInit()/lzham_z_deflateInit2(). LZHAM_DLL_EXPORT int lzham_z_deflateReset(lzham_z_streamp pStream); // lzham_deflate() compresses the input to output, consuming as much of the input and producing as much output as possible. // Parameters: // pStream is the stream to read from and write to. You must initialize/update the next_in, avail_in, next_out, and avail_out members. // flush may be LZHAM_Z_NO_FLUSH, LZHAM_Z_PARTIAL_FLUSH/LZHAM_Z_SYNC_FLUSH, LZHAM_Z_FULL_FLUSH, or LZHAM_Z_FINISH. // Return values: // LZHAM_Z_OK on success (when flushing, or if more input is needed but not available, and/or there's more output to be written but the output buffer is full). // LZHAM_Z_STREAM_END if all input has been consumed and all output bytes have been written. Don't call lzham_z_deflate() on the stream anymore. // LZHAM_Z_STREAM_ERROR if the stream is bogus. // LZHAM_Z_PARAM_ERROR if one of the parameters is invalid. // LZHAM_Z_BUF_ERROR if no forward progress is possible because the input and/or output buffers are empty. (Fill up the input buffer or free up some output space and try again.) LZHAM_DLL_EXPORT int lzham_z_deflate(lzham_z_streamp pStream, int flush); // lzham_deflateEnd() deinitializes a compressor: // Return values: // LZHAM_Z_OK on success. // LZHAM_Z_STREAM_ERROR if the stream is bogus. LZHAM_DLL_EXPORT int lzham_z_deflateEnd(lzham_z_streamp pStream); // lzham_deflateBound() returns a (very) conservative upper bound on the amount of data that could be generated by lzham_z_deflate(), assuming flush is set to only LZHAM_Z_NO_FLUSH or LZHAM_Z_FINISH. LZHAM_DLL_EXPORT lzham_z_ulong lzham_z_deflateBound(lzham_z_streamp pStream, lzham_z_ulong source_len); // Single-call compression functions lzham_z_compress() and lzham_z_compress2(): // Returns LZHAM_Z_OK on success, or one of the error codes from lzham_z_deflate() on failure. LZHAM_DLL_EXPORT int lzham_z_compress(unsigned char *pDest, lzham_z_ulong *pDest_len, const unsigned char *pSource, lzham_z_ulong source_len); LZHAM_DLL_EXPORT int lzham_z_compress2(unsigned char *pDest, lzham_z_ulong *pDest_len, const unsigned char *pSource, lzham_z_ulong source_len, int level); // lzham_z_compressBound() returns a (very) conservative upper bound on the amount of data that could be generated by calling lzham_z_compress(). LZHAM_DLL_EXPORT lzham_z_ulong lzham_z_compressBound(lzham_z_ulong source_len); // Initializes a decompressor. LZHAM_DLL_EXPORT int lzham_z_inflateInit(lzham_z_streamp pStream); // lzham_z_inflateInit2() is like lzham_z_inflateInit() with an additional option that controls the window size and whether or not the stream has been wrapped with a zlib header/footer: // window_bits must be LZHAM_Z_DEFAULT_WINDOW_BITS (to parse zlib header/footer) or -LZHAM_Z_DEFAULT_WINDOW_BITS (raw stream with no zlib header/footer). LZHAM_DLL_EXPORT int lzham_z_inflateInit2(lzham_z_streamp pStream, int window_bits); LZHAM_DLL_EXPORT int lzham_z_inflateReset(lzham_z_streamp pStream); // Decompresses the input stream to the output, consuming only as much of the input as needed, and writing as much to the output as possible. // Parameters: // pStream is the stream to read from and write to. You must initialize/update the next_in, avail_in, next_out, and avail_out members. // flush may be LZHAM_Z_NO_FLUSH, LZHAM_Z_SYNC_FLUSH, or LZHAM_Z_FINISH. // On the first call, if flush is LZHAM_Z_FINISH it's assumed the input and output buffers are both sized large enough to decompress the entire stream in a single call (this is slightly faster). // LZHAM_Z_FINISH implies that there are no more source bytes available beside what's already in the input buffer, and that the output buffer is large enough to hold the rest of the decompressed data. // Return values: // LZHAM_Z_OK on success. Either more input is needed but not available, and/or there's more output to be written but the output buffer is full. // LZHAM_Z_STREAM_END if all needed input has been consumed and all output bytes have been written. For zlib streams, the adler-32 of the decompressed data has also been verified. // LZHAM_Z_STREAM_ERROR if the stream is bogus. // LZHAM_Z_DATA_ERROR if the deflate stream is invalid. // LZHAM_Z_PARAM_ERROR if one of the parameters is invalid. // LZHAM_Z_BUF_ERROR if no forward progress is possible because the input buffer is empty but the inflater needs more input to continue, or if the output buffer is not large enough. Call lzham_inflate() again // with more input data, or with more room in the output buffer (except when using single call decompression, described above). LZHAM_DLL_EXPORT int lzham_z_inflate(lzham_z_streamp pStream, int flush); // Deinitializes a decompressor. LZHAM_DLL_EXPORT int lzham_z_inflateEnd(lzham_z_streamp pStream); // Single-call decompression. // Returns LZHAM_OK on success, or one of the error codes from lzham_inflate() on failure. LZHAM_DLL_EXPORT int lzham_z_uncompress(unsigned char *pDest, lzham_z_ulong *pDest_len, const unsigned char *pSource, lzham_z_ulong source_len); // Returns a string description of the specified error code, or NULL if the error code is invalid. LZHAM_DLL_EXPORT const char *lzham_z_error(int err); // Redefine zlib-compatible names to lzham equivalents, so lzham can be used as a more or less drop-in replacement for the subset of zlib that lzham supports. // Define LZHAM_NO_ZLIB_COMPATIBLE_NAMES to disable zlib-compatibility if you use zlib in the same project. #ifdef LZHAM_DEFINE_ZLIB_API typedef unsigned char Byte; typedef unsigned int uInt; typedef lzham_z_ulong uLong; typedef Byte Bytef; typedef uInt uIntf; typedef char charf; typedef int intf; typedef void *voidpf; typedef uLong uLongf; typedef void *voidp; typedef void *const voidpc; #define Z_NULL 0 #define Z_NO_FLUSH LZHAM_Z_NO_FLUSH #define Z_PARTIAL_FLUSH LZHAM_Z_PARTIAL_FLUSH #define Z_SYNC_FLUSH LZHAM_Z_SYNC_FLUSH #define Z_FULL_FLUSH LZHAM_Z_FULL_FLUSH #define Z_FINISH LZHAM_Z_FINISH #define Z_BLOCK LZHAM_Z_BLOCK #define Z_OK LZHAM_Z_OK #define Z_STREAM_END LZHAM_Z_STREAM_END #define Z_NEED_DICT LZHAM_Z_NEED_DICT #define Z_ERRNO LZHAM_Z_ERRNO #define Z_STREAM_ERROR LZHAM_Z_STREAM_ERROR #define Z_DATA_ERROR LZHAM_Z_DATA_ERROR #define Z_MEM_ERROR LZHAM_Z_MEM_ERROR #define Z_BUF_ERROR LZHAM_Z_BUF_ERROR #define Z_VERSION_ERROR LZHAM_Z_VERSION_ERROR #define Z_PARAM_ERROR LZHAM_Z_PARAM_ERROR #define Z_NO_COMPRESSION LZHAM_Z_NO_COMPRESSION #define Z_BEST_SPEED LZHAM_Z_BEST_SPEED #define Z_BEST_COMPRESSION LZHAM_Z_BEST_COMPRESSION #define Z_DEFAULT_COMPRESSION LZHAM_Z_DEFAULT_COMPRESSION #define Z_DEFAULT_STRATEGY LZHAM_Z_DEFAULT_STRATEGY #define Z_FILTERED LZHAM_Z_FILTERED #define Z_HUFFMAN_ONLY LZHAM_Z_HUFFMAN_ONLY #define Z_RLE LZHAM_Z_RLE #define Z_FIXED LZHAM_Z_FIXED #define Z_DEFLATED LZHAM_Z_DEFLATED #define Z_DEFAULT_WINDOW_BITS LZHAM_Z_DEFAULT_WINDOW_BITS #define alloc_func lzham_z_alloc_func #define free_func lzham_z_free_func #define internal_state lzham_z_internal_state #define z_stream lzham_z_stream #define deflateInit lzham_z_deflateInit #define deflateInit2 lzham_z_deflateInit2 #define deflateReset lzham_z_deflateReset #define deflate lzham_z_deflate #define deflateEnd lzham_z_deflateEnd #define deflateBound lzham_z_deflateBound #define compress lzham_z_compress #define compress2 lzham_z_compress2 #define compressBound lzham_z_compressBound #define inflateInit lzham_z_inflateInit #define inflateInit2 lzham_z_inflateInit2 #define inflateReset lzham_z_inflateReset #define inflate lzham_z_inflate #define inflateEnd lzham_z_inflateEnd #define uncompress lzham_z_uncompress #define crc32 lzham_z_crc32 #define adler32 lzham_z_adler32 #define MAX_WBITS 26 #define MAX_MEM_LEVEL 9 #define zError lzham_z_error #define ZLIB_VERSION LZHAM_Z_VERSION #define ZLIB_VERNUM LZHAM_Z_VERNUM #define ZLIB_VER_MAJOR LZHAM_Z_VER_MAJOR #define ZLIB_VER_MINOR LZHAM_Z_VER_MINOR #define ZLIB_VER_REVISION LZHAM_Z_VER_REVISION #define ZLIB_VER_SUBREVISION LZHAM_Z_VER_SUBREVISION #define zlibVersion lzham_z_version #define zlib_version lzham_z_version() #define Z_BINARY LZHAM_Z_BINARY #define Z_TEXT LZHAM_Z_TEST #define Z_ASCII LZHAM_Z_ASCII #define Z_UNKNOWN LZHAM_Z_UNKNOWN #endif // #ifdef LZHAM_DEFINE_ZLIB_API // Exported function typedefs, to simplify loading the LZHAM DLL dynamically. typedef lzham_uint32 (LZHAM_CDECL *lzham_get_version_func)(void); typedef void (LZHAM_CDECL *lzham_set_memory_callbacks_func)(lzham_realloc_func pRealloc, lzham_msize_func pMSize, void* pUser_data); typedef lzham_compress_state_ptr (LZHAM_CDECL *lzham_compress_init_func)(const lzham_compress_params *pParams); typedef lzham_compress_state_ptr (LZHAM_CDECL *lzham_compress_reinit_func)(lzham_compress_state_ptr pState); typedef lzham_uint32 (LZHAM_CDECL *lzham_compress_deinit_func)(lzham_compress_state_ptr pState); typedef lzham_compress_status_t (LZHAM_CDECL *lzham_compress_func)(lzham_compress_state_ptr pState, const lzham_uint8 *pIn_buf, size_t *pIn_buf_size, lzham_uint8 *pOut_buf, size_t *pOut_buf_size, lzham_bool no_more_input_bytes_flag); typedef lzham_compress_status_t (LZHAM_CDECL *lzham_compress2_func)(lzham_compress_state_ptr pState, const lzham_uint8 *pIn_buf, size_t *pIn_buf_size, lzham_uint8 *pOut_buf, size_t *pOut_buf_size, lzham_flush_t flush_type); typedef lzham_compress_status_t (LZHAM_CDECL *lzham_compress_memory_func)(const lzham_compress_params *pParams, lzham_uint8* pDst_buf, size_t *pDst_len, const lzham_uint8* pSrc_buf, size_t src_len, lzham_uint32 *pAdler32); typedef lzham_decompress_state_ptr (LZHAM_CDECL *lzham_decompress_init_func)(const lzham_decompress_params *pParams); typedef lzham_decompress_state_ptr (LZHAM_CDECL *lzham_decompress_reinit_func)(lzham_compress_state_ptr pState, const lzham_decompress_params *pParams); typedef lzham_uint32 (LZHAM_CDECL *lzham_decompress_deinit_func)(lzham_decompress_state_ptr pState); typedef lzham_decompress_status_t (LZHAM_CDECL *lzham_decompress_func)(lzham_decompress_state_ptr pState, const lzham_uint8 *pIn_buf, size_t *pIn_buf_size, lzham_uint8 *pOut_buf, size_t *pOut_buf_size, lzham_bool no_more_input_bytes_flag); typedef lzham_decompress_status_t (LZHAM_CDECL *lzham_decompress_memory_func)(const lzham_decompress_params *pParams, lzham_uint8* pDst_buf, size_t *pDst_len, const lzham_uint8* pSrc_buf, size_t src_len, lzham_uint32 *pAdler32); typedef const char *(LZHAM_CDECL *lzham_z_version_func)(void); typedef int (LZHAM_CDECL *lzham_z_deflateInit_func)(lzham_z_streamp pStream, int level); typedef int (LZHAM_CDECL *lzham_z_deflateInit2_func)(lzham_z_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy); typedef int (LZHAM_CDECL *lzham_z_deflateReset_func)(lzham_z_streamp pStream); typedef int (LZHAM_CDECL *lzham_z_deflate_func)(lzham_z_streamp pStream, int flush); typedef int (LZHAM_CDECL *lzham_z_deflateEnd_func)(lzham_z_streamp pStream); typedef lzham_z_ulong (LZHAM_CDECL *lzham_z_deflateBound_func)(lzham_z_streamp pStream, lzham_z_ulong source_len); typedef int (LZHAM_CDECL *lzham_z_compress_func)(unsigned char *pDest, lzham_z_ulong *pDest_len, const unsigned char *pSource, lzham_z_ulong source_len); typedef int (LZHAM_CDECL *lzham_z_compress2_func)(unsigned char *pDest, lzham_z_ulong *pDest_len, const unsigned char *pSource, lzham_z_ulong source_len, int level); typedef lzham_z_ulong (LZHAM_CDECL *lzham_z_compressBound_func)(lzham_z_ulong source_len); typedef int (LZHAM_CDECL *lzham_z_inflateInit_func)(lzham_z_streamp pStream); typedef int (LZHAM_CDECL *lzham_z_inflateInit2_func)(lzham_z_streamp pStream, int window_bits); typedef int (LZHAM_CDECL *lzham_z_inflateReset_func)(lzham_z_streamp pStream); typedef int (LZHAM_CDECL *lzham_z_inflate_func)(lzham_z_streamp pStream, int flush); typedef int (LZHAM_CDECL *lzham_z_inflateEnd_func)(lzham_z_streamp pStream); typedef int (LZHAM_CDECL *lzham_z_uncompress_func)(unsigned char *pDest, lzham_z_ulong *pDest_len, const unsigned char *pSource, lzham_z_ulong source_len); typedef const char *(LZHAM_CDECL *lzham_z_error_func)(int err); #ifdef __cplusplus } #endif #ifdef __cplusplus // This optional interface is used by the dynamic/static link helpers defined in lzham_dynamic_lib.h and lzham_static_lib.h. // It allows code to always call LZHAM the same way, independent of how it was linked into the app (statically or dynamically). class ilzham { ilzham(const ilzham &other); ilzham& operator= (const ilzham &rhs); public: ilzham() { clear(); } virtual ~ilzham() { } virtual bool load() = 0; virtual void unload() = 0; virtual bool is_loaded() = 0; void clear() { this->lzham_get_version = NULL; this->lzham_set_memory_callbacks = NULL; this->lzham_compress_init = NULL; this->lzham_compress_reinit = NULL; this->lzham_compress_deinit = NULL; this->lzham_compress = NULL; this->lzham_compress2 = NULL; this->lzham_compress_memory = NULL; this->lzham_decompress_init = NULL; this->lzham_decompress_reinit = NULL; this->lzham_decompress_deinit = NULL; this->lzham_decompress = NULL; this->lzham_decompress_memory = NULL; this->lzham_z_version = NULL; this->lzham_z_deflateInit = NULL; this->lzham_z_deflateInit2 = NULL; this->lzham_z_deflateReset = NULL; this->lzham_z_deflate = NULL; this->lzham_z_deflateEnd = NULL; this->lzham_z_deflateBound = NULL; this->lzham_z_compress = NULL; this->lzham_z_compress2 = NULL; this->lzham_z_compressBound = NULL; this->lzham_z_inflateInit = NULL; this->lzham_z_inflateInit2 = NULL; this->lzham_z_inflate = NULL; this->lzham_z_inflateEnd = NULL; this->lzham_z_uncompress = NULL; this->lzham_z_error = NULL; } lzham_get_version_func lzham_get_version; lzham_set_memory_callbacks_func lzham_set_memory_callbacks; lzham_compress_init_func lzham_compress_init; lzham_compress_reinit_func lzham_compress_reinit; lzham_compress_deinit_func lzham_compress_deinit; lzham_compress_func lzham_compress; lzham_compress2_func lzham_compress2; lzham_compress_memory_func lzham_compress_memory; lzham_decompress_init_func lzham_decompress_init; lzham_decompress_reinit_func lzham_decompress_reinit; lzham_decompress_deinit_func lzham_decompress_deinit; lzham_decompress_func lzham_decompress; lzham_decompress_memory_func lzham_decompress_memory; lzham_z_version_func lzham_z_version; lzham_z_deflateInit_func lzham_z_deflateInit; lzham_z_deflateInit2_func lzham_z_deflateInit2; lzham_z_deflateReset_func lzham_z_deflateReset; lzham_z_deflate_func lzham_z_deflate; lzham_z_deflateEnd_func lzham_z_deflateEnd; lzham_z_deflateBound_func lzham_z_deflateBound; lzham_z_compress_func lzham_z_compress; lzham_z_compress2_func lzham_z_compress2; lzham_z_compressBound_func lzham_z_compressBound; lzham_z_inflateInit_func lzham_z_inflateInit; lzham_z_inflateInit2_func lzham_z_inflateInit2; lzham_z_inflateReset_func lzham_z_inflateReset; lzham_z_inflate_func lzham_z_inflate; lzham_z_inflateEnd_func lzham_z_inflateEnd; lzham_z_uncompress_func lzham_z_uncompress; lzham_z_error_func lzham_z_error; }; #endif // #ifdef __cplusplus #endif // #ifndef __LZHAM_H__ // Copyright (c) 2009-2012 Richard Geldreich, Jr. <richgel99@gmail.com> // // LZHAM uses the MIT License: // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. �������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_lzbase.h���������������������������������������������0000644�0001750�0001750�00000002336�12320456500�022347� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_lzbase.h // See Copyright Notice and license at the end of include/lzham.h #pragma once #include "lzham_lzdecompbase.h" //#define LZHAM_LZVERIFY //#define LZHAM_DISABLE_RAW_BLOCKS namespace lzham { struct CLZBase : CLZDecompBase { uint8 m_slot_tab0[4096]; uint8 m_slot_tab1[512]; uint8 m_slot_tab2[256]; void init_slot_tabs(); inline void compute_lzx_position_slot(uint dist, uint& slot, uint& ofs) { uint s; if (dist < 0x1000) s = m_slot_tab0[dist]; else if (dist < 0x100000) s = m_slot_tab1[dist >> 11]; else if (dist < 0x1000000) s = m_slot_tab2[dist >> 16]; else if (dist < 0x2000000) s = 48 + ((dist - 0x1000000) >> 23); else if (dist < 0x4000000) s = 50 + ((dist - 0x2000000) >> 24); else s = 52 + ((dist - 0x4000000) >> 25); ofs = (dist - m_lzx_position_base[s]) & m_lzx_position_extra_mask[s]; slot = s; LZHAM_ASSERT(s < m_num_lzx_slots); LZHAM_ASSERT((m_lzx_position_base[slot] + ofs) == dist); LZHAM_ASSERT(ofs < (1U << m_lzx_position_extra_bits[slot])); } }; } // namespace lzham ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_vector.h���������������������������������������������0000644�0001750�0001750�00000036046�12320456500�022376� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_vector.h // See Copyright Notice and license at the end of include/lzham.h #pragma once namespace lzham { struct elemental_vector { void* m_p; uint m_size; uint m_capacity; typedef void (*object_mover)(void* pDst, void* pSrc, uint num); bool increase_capacity(uint min_new_capacity, bool grow_hint, uint element_size, object_mover pRelocate, bool nofail); }; template<typename T> class vector : public helpers::rel_ops< vector<T> > { public: typedef T* iterator; typedef const T* const_iterator; typedef T value_type; typedef T& reference; typedef const T& const_reference; typedef T* pointer; typedef const T* const_pointer; inline vector() : m_p(NULL), m_size(0), m_capacity(0) { } inline vector(uint n, const T& init) : m_p(NULL), m_size(0), m_capacity(0) { increase_capacity(n, false); helpers::construct_array(m_p, n, init); m_size = n; } inline vector(const vector& other) : m_p(NULL), m_size(0), m_capacity(0) { increase_capacity(other.m_size, false); m_size = other.m_size; if (LZHAM_IS_BITWISE_COPYABLE(T)) memcpy(m_p, other.m_p, m_size * sizeof(T)); else { T* pDst = m_p; const T* pSrc = other.m_p; for (uint i = m_size; i > 0; i--) helpers::construct(pDst++, *pSrc++); } } inline explicit vector(uint size) : m_p(NULL), m_size(0), m_capacity(0) { try_resize(size); } inline ~vector() { if (m_p) { scalar_type<T>::destruct_array(m_p, m_size); lzham_free(m_p); } } inline vector& operator= (const vector& other) { if (this == &other) return *this; if (m_capacity >= other.m_size) try_resize(0); else { clear(); if (!increase_capacity(other.m_size, false)) { LZHAM_FAIL("lzham::vector operator=: Out of memory!"); return *this; } } if (LZHAM_IS_BITWISE_COPYABLE(T)) memcpy(m_p, other.m_p, other.m_size * sizeof(T)); else { T* pDst = m_p; const T* pSrc = other.m_p; for (uint i = other.m_size; i > 0; i--) helpers::construct(pDst++, *pSrc++); } m_size = other.m_size; return *this; } inline const T* begin() const { return m_p; } T* begin() { return m_p; } inline const T* end() const { return m_p + m_size; } T* end() { return m_p + m_size; } inline bool empty() const { return !m_size; } inline uint size() const { return m_size; } inline uint size_in_bytes() const { return m_size * sizeof(T); } inline uint capacity() const { return m_capacity; } // operator[] will assert on out of range indices, but in final builds there is (and will never be) any range checking on this method. inline const T& operator[] (uint i) const { LZHAM_ASSERT(i < m_size); return m_p[i]; } inline T& operator[] (uint i) { LZHAM_ASSERT(i < m_size); return m_p[i]; } // at() always includes range checking, even in final builds, unlike operator []. // The first element is returned if the index is out of range. inline const T& at(uint i) const { LZHAM_ASSERT(i < m_size); return (i >= m_size) ? m_p[0] : m_p[i]; } inline T& at(uint i) { LZHAM_ASSERT(i < m_size); return (i >= m_size) ? m_p[0] : m_p[i]; } inline const T& front() const { LZHAM_ASSERT(m_size); return m_p[0]; } inline T& front() { LZHAM_ASSERT(m_size); return m_p[0]; } inline const T& back() const { LZHAM_ASSERT(m_size); return m_p[m_size - 1]; } inline T& back() { LZHAM_ASSERT(m_size); return m_p[m_size - 1]; } inline const T* get_ptr() const { return m_p; } inline T* get_ptr() { return m_p; } inline void clear() { if (m_p) { scalar_type<T>::destruct_array(m_p, m_size); lzham_free(m_p); m_p = NULL; m_size = 0; m_capacity = 0; } } inline void clear_no_destruction() { if (m_p) { lzham_free(m_p); m_p = NULL; m_size = 0; m_capacity = 0; } } inline bool try_reserve(uint new_capacity) { return increase_capacity(new_capacity, true, true); } inline bool try_resize(uint new_size, bool grow_hint = false) { if (m_size != new_size) { if (new_size < m_size) scalar_type<T>::destruct_array(m_p + new_size, m_size - new_size); else { if (new_size > m_capacity) { if (!increase_capacity(new_size, (new_size == (m_size + 1)) || grow_hint, true)) return false; } scalar_type<T>::construct_array(m_p + m_size, new_size - m_size); } m_size = new_size; } return true; } inline bool try_resize_no_construct(uint new_size, bool grow_hint = false) { if (new_size > m_capacity) { if (!increase_capacity(new_size, (new_size == (m_size + 1)) || grow_hint, true)) return false; } m_size = new_size; return true; } inline T* try_enlarge(uint i) { uint cur_size = m_size; if (!try_resize(cur_size + i, true)) return NULL; return get_ptr() + cur_size; } inline bool try_push_back(const T& obj) { LZHAM_ASSERT(!m_p || (&obj < m_p) || (&obj >= (m_p + m_size))); if (m_size >= m_capacity) { if (!increase_capacity(m_size + 1, true, true)) return false; } scalar_type<T>::construct(m_p + m_size, obj); m_size++; return true; } inline void pop_back() { LZHAM_ASSERT(m_size); if (m_size) { m_size--; scalar_type<T>::destruct(&m_p[m_size]); } } inline bool insert(uint index, const T* p, uint n) { LZHAM_ASSERT(index <= m_size); if (!n) return true; const uint orig_size = m_size; if (!try_resize(m_size + n, true)) return false; const uint num_to_move = orig_size - index; if (num_to_move) { if (LZHAM_IS_BITWISE_COPYABLE(T)) memmove(m_p + index + n, m_p + index, sizeof(T) * num_to_move); else { const T* pSrc = m_p + orig_size - 1; T* pDst = const_cast<T*>(pSrc) + n; for (uint i = 0; i < num_to_move; i++) { LZHAM_ASSERT((pDst - m_p) < (int)m_size); *pDst-- = *pSrc--; } } } T* pDst = m_p + index; if (LZHAM_IS_BITWISE_COPYABLE(T)) memcpy(pDst, p, sizeof(T) * n); else { for (uint i = 0; i < n; i++) { LZHAM_ASSERT((pDst - m_p) < (int)m_size); *pDst++ = *p++; } } return true; } // push_front() isn't going to be very fast - it's only here for usability. inline bool try_push_front(const T& obj) { return insert(0, &obj, 1); } bool append(const vector& other) { if (other.m_size) return insert(m_size, &other[0], other.m_size); return true; } bool append(const T* p, uint n) { if (n) return insert(m_size, p, n); return true; } inline void erase(uint start, uint n) { LZHAM_ASSERT((start + n) <= m_size); if ((start + n) > m_size) return; if (!n) return; const uint num_to_move = m_size - (start + n); T* pDst = m_p + start; const T* pSrc = m_p + start + n; if (LZHAM_IS_BITWISE_COPYABLE(T)) memmove(pDst, pSrc, num_to_move * sizeof(T)); else { T* pDst_end = pDst + num_to_move; while (pDst != pDst_end) *pDst++ = *pSrc++; scalar_type<T>::destruct_array(pDst_end, n); } m_size -= n; } inline void erase(uint index) { erase(index, 1); } inline void erase(T* p) { LZHAM_ASSERT((p >= m_p) && (p < (m_p + m_size))); erase(static_cast<uint>(p - m_p)); } void erase_unordered(uint index) { LZHAM_ASSERT(index < m_size); if ((index + 1) < m_size) (*this)[index] = back(); pop_back(); } inline bool operator== (const vector& rhs) const { if (m_size != rhs.m_size) return false; else if (m_size) { if (scalar_type<T>::cFlag) return memcmp(m_p, rhs.m_p, sizeof(T) * m_size) == 0; else { const T* pSrc = m_p; const T* pDst = rhs.m_p; for (uint i = m_size; i; i--) if (!(*pSrc++ == *pDst++)) return false; } } return true; } inline bool operator< (const vector& rhs) const { const uint min_size = math::minimum(m_size, rhs.m_size); const T* pSrc = m_p; const T* pSrc_end = m_p + min_size; const T* pDst = rhs.m_p; while ((pSrc < pSrc_end) && (*pSrc == *pDst)) { pSrc++; pDst++; } if (pSrc < pSrc_end) return *pSrc < *pDst; return m_size < rhs.m_size; } inline void swap(vector& other) { utils::swap(m_p, other.m_p); utils::swap(m_size, other.m_size); utils::swap(m_capacity, other.m_capacity); } inline void sort() { std::sort(begin(), end()); } inline void unique() { if (!empty()) { sort(); resize(std::unique(begin(), end()) - begin()); } } inline void reverse() { uint j = m_size >> 1; for (uint i = 0; i < j; i++) utils::swap(m_p[i], m_p[m_size - 1 - i]); } inline int find(const T& key) const { const T* p = m_p; const T* p_end = m_p + m_size; uint index = 0; while (p != p_end) { if (key == *p) return index; p++; index++; } return cInvalidIndex; } inline int find_sorted(const T& key) const { if (m_size) { // Uniform binary search - Knuth Algorithm 6.2.1 U, unrolled twice. int i = ((m_size + 1) >> 1) - 1; int m = m_size; for ( ; ; ) { LZHAM_ASSERT_OPEN_RANGE(i, 0, (int)m_size); const T* pKey_i = m_p + i; int cmp = key < *pKey_i; if ((!cmp) && (key == *pKey_i)) return i; m >>= 1; if (!m) break; cmp = -cmp; i += (((m + 1) >> 1) ^ cmp) - cmp; LZHAM_ASSERT_OPEN_RANGE(i, 0, (int)m_size); pKey_i = m_p + i; cmp = key < *pKey_i; if ((!cmp) && (key == *pKey_i)) return i; m >>= 1; if (!m) break; cmp = -cmp; i += (((m + 1) >> 1) ^ cmp) - cmp; } } return cInvalidIndex; } template<typename Q> inline int find_sorted(const T& key, Q less_than) const { if (m_size) { // Uniform binary search - Knuth Algorithm 6.2.1 U, unrolled twice. int i = ((m_size + 1) >> 1) - 1; int m = m_size; for ( ; ; ) { LZHAM_ASSERT_OPEN_RANGE(i, 0, (int)m_size); const T* pKey_i = m_p + i; int cmp = less_than(key, *pKey_i); if ((!cmp) && (!less_than(*pKey_i, key))) return i; m >>= 1; if (!m) break; cmp = -cmp; i += (((m + 1) >> 1) ^ cmp) - cmp; LZHAM_ASSERT_OPEN_RANGE(i, 0, (int)m_size); pKey_i = m_p + i; cmp = less_than(key, *pKey_i); if ((!cmp) && (!less_than(*pKey_i, key))) return i; m >>= 1; if (!m) break; cmp = -cmp; i += (((m + 1) >> 1) ^ cmp) - cmp; } } return cInvalidIndex; } inline uint count_occurences(const T& key) const { uint c = 0; const T* p = m_p; const T* p_end = m_p + m_size; while (p != p_end) { if (key == *p) c++; p++; } return c; } inline void set_all(const T& o) { if ((sizeof(T) == 1) && (scalar_type<T>::cFlag)) memset(m_p, *reinterpret_cast<const uint8*>(&o), m_size); else { T* pDst = m_p; T* pDst_end = pDst + m_size; while (pDst != pDst_end) *pDst++ = o; } } private: T* m_p; uint m_size; uint m_capacity; template<typename Q> struct is_vector { enum { cFlag = false }; }; template<typename Q> struct is_vector< vector<Q> > { enum { cFlag = true }; }; static void object_mover(void* pDst_void, void* pSrc_void, uint num) { T* pSrc = static_cast<T*>(pSrc_void); T* const pSrc_end = pSrc + num; T* pDst = static_cast<T*>(pDst_void); while (pSrc != pSrc_end) { new (static_cast<void*>(pDst)) T(*pSrc); pSrc->~T(); pSrc++; pDst++; } } inline bool increase_capacity(uint min_new_capacity, bool grow_hint, bool nofail = false) { return reinterpret_cast<elemental_vector*>(this)->increase_capacity( min_new_capacity, grow_hint, sizeof(T), (LZHAM_IS_BITWISE_MOVABLE(T) || (is_vector<T>::cFlag)) ? NULL : object_mover, nofail); } }; template<typename T> struct bitwise_movable< vector<T> > { enum { cFlag = true }; }; extern void vector_test(); template<typename T> inline void swap(vector<T>& a, vector<T>& b) { a.swap(b); } } // namespace lzham ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_math.h�����������������������������������������������0000644�0001750�0001750�00000006714�12320456500�022024� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_math.h // See Copyright Notice and license at the end of include/lzham.h #pragma once #if defined(LZHAM_USE_MSVC_INTRINSICS) && !defined(__MINGW32__) #include <intrin.h> #if defined(_MSC_VER) #pragma intrinsic(_BitScanReverse) #endif #endif namespace lzham { namespace math { // Yes I know these should probably be pass by ref, not val: // http://www.stepanovpapers.com/notes.pdf // Just don't use them on non-simple (non built-in) types! template<typename T> inline T minimum(T a, T b) { return (a < b) ? a : b; } template<typename T> inline T minimum(T a, T b, T c) { return minimum(minimum(a, b), c); } template<typename T> inline T maximum(T a, T b) { return (a > b) ? a : b; } template<typename T> inline T maximum(T a, T b, T c) { return maximum(maximum(a, b), c); } template<typename T> inline T clamp(T value, T low, T high) { return (value < low) ? low : ((value > high) ? high : value); } template<typename T> inline bool is_power_of_2(T x) { return x && ((x & (x - 1U)) == 0U); } template<typename T> inline T align_up_pointer(T p, uint alignment) { LZHAM_ASSERT(is_power_of_2(alignment)); ptr_bits_t q = reinterpret_cast<ptr_bits_t>(p); q = (q + alignment - 1) & (~((uint_ptr)alignment - 1)); return reinterpret_cast<T>(q); } template<typename T> T next_pow2(T val) { static_assert(sizeof(val) != sizeof(val), "template requires specialization"); return 0; } // From "Hackers Delight" // val remains unchanged if it is already a power of 2. inline uint32 next_pow2_32(uint32 val) { val--; val |= val >> 16; val |= val >> 8; val |= val >> 4; val |= val >> 2; val |= val >> 1; return val + 1; } // val remains unchanged if it is already a power of 2. inline uint64 next_pow2_64(uint64 val) { val--; val |= val >> 32; val |= val >> 16; val |= val >> 8; val |= val >> 4; val |= val >> 2; val |= val >> 1; return val + 1; } template<> inline size_t next_pow2<size_t>(size_t val) { if (sizeof(size_t) == 4) return next_pow2_32(static_cast<uint32>(val)); else if (sizeof(size_t) == 8) return next_pow2_64(static_cast<uint64>(val)); else static_assert(sizeof(size_t) == 4 || sizeof(size_t) == 8, "strange size_t"); return 0; } inline uint floor_log2i(uint v) { uint l = 0; while (v > 1U) { v >>= 1; l++; } return l; } inline uint ceil_log2i(uint v) { uint l = floor_log2i(v); if ((l != cIntBits) && (v > (1U << l))) l++; return l; } // Returns the total number of bits needed to encode v. // This needs to be fast - it's used heavily when determining Polar codelengths. inline uint total_bits(uint v) { unsigned long l = 0; #if defined(__MINGW32__) if (v) { l = 32 -__builtin_clz(v); } #elif defined(LZHAM_USE_MSVC_INTRINSICS) if (_BitScanReverse(&l, v)) { l++; } #else while (v > 0U) { v >>= 1; l++; } #endif return l; } } } // namespace lzham ����������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_timer.h����������������������������������������������0000644�0001750�0001750�00000005767�12320456500�022222� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_timer.h // See Copyright Notice and license at the end of include/lzham.h #pragma once namespace lzham { typedef unsigned long long timer_ticks; class lzham_timer { public: lzham_timer(); lzham_timer(timer_ticks start_ticks); void start(); void start(timer_ticks start_ticks); void stop(); double get_elapsed_secs() const; inline double get_elapsed_ms() const { return get_elapsed_secs() * 1000.0f; } timer_ticks get_elapsed_us() const; static void init(); static inline timer_ticks get_ticks_per_sec() { return g_freq; } static timer_ticks get_init_ticks(); static timer_ticks get_ticks(); static double ticks_to_secs(timer_ticks ticks); static inline double ticks_to_ms(timer_ticks ticks) { return ticks_to_secs(ticks) * 1000.0f; } static inline double get_secs() { return ticks_to_secs(get_ticks()); } static inline double get_ms() { return ticks_to_ms(get_ticks()); } private: static timer_ticks g_init_ticks; static timer_ticks g_freq; static double g_inv_freq; timer_ticks m_start_time; timer_ticks m_stop_time; bool m_started : 1; bool m_stopped : 1; }; enum var_args_t { cVarArgs }; #if LZHAM_PERF_SECTIONS class scoped_perf_section { public: inline scoped_perf_section() : m_start_ticks(lzham_timer::get_ticks()) { m_name[0] = '?'; m_name[1] = '\0'; } inline scoped_perf_section(const char *pName) : m_start_ticks(lzham_timer::get_ticks()) { strcpy_s(m_name, pName); lzham_buffered_printf("Thread: 0x%08X, BEGIN Time: %3.3fms, Section: %s\n", GetCurrentThreadId(), lzham_timer::ticks_to_ms(m_start_ticks), m_name); } inline scoped_perf_section(var_args_t, const char *pName, ...) : m_start_ticks(lzham_timer::get_ticks()) { va_list args; va_start(args, pName); vsprintf_s(m_name, sizeof(m_name), pName, args); va_end(args); lzham_buffered_printf("Thread: 0x%08X, BEGIN Time: %3.3fms, Section: %s\n", GetCurrentThreadId(), lzham_timer::ticks_to_ms(m_start_ticks), m_name); } inline ~scoped_perf_section() { double end_ms = lzham_timer::get_ms(); double start_ms = lzham_timer::ticks_to_ms(m_start_ticks); lzham_buffered_printf("Thread: 0x%08X, END Time: %3.3fms, Total: %3.3fms, Section: %s\n", GetCurrentThreadId(), end_ms, end_ms - start_ms, m_name); } private: char m_name[64]; timer_ticks m_start_ticks; }; #else class scoped_perf_section { public: inline scoped_perf_section() { } inline scoped_perf_section(const char *pName) { (void)pName; } inline scoped_perf_section(var_args_t, const char *pName, ...) { (void)pName; } }; #endif // LZHAM_PERF_SECTIONS } // namespace lzham ���������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_decomp.h���������������������������������������������0000644�0001750�0001750�00000003602�12320456500�022333� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_decomp.h // See Copyright Notice and license at the end of include/lzham.h #pragma once #include "lzham.h" namespace lzham { void LZHAM_CDECL lzham_lib_set_memory_callbacks(lzham_realloc_func pRealloc, lzham_msize_func pMSize, void* pUser_data); lzham_decompress_state_ptr LZHAM_CDECL lzham_lib_decompress_init(const lzham_decompress_params *pParams); lzham_decompress_state_ptr LZHAM_CDECL lzham_lib_decompress_reinit(lzham_decompress_state_ptr pState, const lzham_decompress_params *pParams); lzham_uint32 LZHAM_CDECL lzham_lib_decompress_deinit(lzham_decompress_state_ptr pState); lzham_decompress_status_t LZHAM_CDECL lzham_lib_decompress( lzham_decompress_state_ptr pState, const lzham_uint8 *pIn_buf, size_t *pIn_buf_size, lzham_uint8 *pOut_buf, size_t *pOut_buf_size, lzham_bool no_more_input_bytes_flag); lzham_decompress_status_t LZHAM_CDECL lzham_lib_decompress_memory(const lzham_decompress_params *pParams, lzham_uint8* pDst_buf, size_t *pDst_len, const lzham_uint8* pSrc_buf, size_t src_len, lzham_uint32 *pAdler32); int LZHAM_CDECL lzham_lib_z_inflateInit2(lzham_z_streamp pStream, int window_bits); int LZHAM_CDECL lzham_lib_z_inflateInit(lzham_z_streamp pStream); int LZHAM_CDECL lzham_lib_z_inflateReset(lzham_z_streamp pStream); int LZHAM_CDECL lzham_lib_z_inflate(lzham_z_streamp pStream, int flush); int LZHAM_CDECL lzham_lib_z_inflateEnd(lzham_z_streamp pStream); int LZHAM_CDECL lzham_lib_z_uncompress(unsigned char *pDest, lzham_z_ulong *pDest_len, const unsigned char *pSource, lzham_z_ulong source_len); const char * LZHAM_CDECL lzham_lib_z_error(int err); lzham_z_ulong lzham_lib_z_adler32(lzham_z_ulong adler, const unsigned char *ptr, size_t buf_len); lzham_z_ulong LZHAM_CDECL lzham_lib_z_crc32(lzham_z_ulong crc, const lzham_uint8 *ptr, size_t buf_len); } // namespace lzham ������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_checksum.h�������������������������������������������0000644�0001750�0001750�00000000552�12320456500�022667� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_checksum.h // See Copyright Notice and license at the end of include/lzham.h #pragma once namespace lzham { const uint cInitAdler32 = 1U; uint adler32(const void* pBuf, size_t buflen, uint adler32 = cInitAdler32); const uint cInitCRC32 = 0U; uint crc32(uint crc, const lzham_uint8 *ptr, size_t buf_len); } // namespace lzham ������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_null_threading.h�������������������������������������0000644�0001750�0001750�00000005111�12320456500�024060� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_task_pool_null.h // See Copyright Notice and license at the end of include/lzham.h #pragma once namespace lzham { class semaphore { LZHAM_NO_COPY_OR_ASSIGNMENT_OP(semaphore); public: inline semaphore(long initialCount = 0, long maximumCount = 1, const char* pName = NULL) { if (initialCount) {} if (maximumCount) {} if (pName) {} } inline ~semaphore() { } inline void release(long releaseCount = 1, long *pPreviousCount = NULL) { if (releaseCount) {} if (pPreviousCount) {} } inline bool wait(uint32 milliseconds = LZHAM_UINT32_MAX) { if (milliseconds) {} return true; } }; class task_pool { public: inline task_pool() { } inline task_pool(uint num_threads) { if (num_threads) {} } inline ~task_pool() { } inline bool init(uint num_threads) { if (num_threads) {} return true; } inline void deinit(); inline uint get_num_threads() const { return 0; } inline uint get_num_outstanding_tasks() const { return 0; } // C-style task callback typedef void (*task_callback_func)(uint64 data, void* pData_ptr); inline bool queue_task(task_callback_func pFunc, uint64 data = 0, void* pData_ptr = NULL) { pFunc(data, pData_ptr); return true; } class executable_task { public: virtual void execute_task(uint64 data, void* pData_ptr) = 0; }; // It's the caller's responsibility to delete pObj within the execute_task() method, if needed! inline bool queue_task(executable_task* pObj, uint64 data = 0, void* pData_ptr = NULL) { pObj->execute_task(data, pData_ptr); return true; } template<typename S, typename T> inline bool queue_object_task(S* pObject, T pObject_method, uint64 data = 0, void* pData_ptr = NULL) { (pObject->*pObject_method)(data, pData_ptr); return true; } template<typename S, typename T> inline bool queue_multiple_object_tasks(S* pObject, T pObject_method, uint64 first_data, uint num_tasks, void* pData_ptr = NULL) { for (uint i = 0; i < num_tasks; i++) { (pObject->*pObject_method)(first_data + i, pData_ptr); } return true; } void join() { } }; inline void lzham_sleep(unsigned int milliseconds) { if (milliseconds) {} } inline uint lzham_get_max_helper_threads() { return 0; } } // namespace lzham �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_platform.cpp�����������������������������������������0000644�0001750�0001750�00000005744�12320456500�023254� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: platform.cpp // See Copyright Notice and license at the end of include/lzham.h #include "lzham_core.h" #include "lzham_timer.h" #if LZHAM_PLATFORM_X360 #include <xbdm.h> #endif #ifndef _MSC_VER int sprintf_s(char *buffer, size_t sizeOfBuffer, const char *format, ...) { if (!sizeOfBuffer) return 0; va_list args; va_start(args, format); int c = vsnprintf(buffer, sizeOfBuffer, format, args); va_end(args); buffer[sizeOfBuffer - 1] = '\0'; if (c < 0) return sizeOfBuffer - 1; return LZHAM_MIN(c, (int)sizeOfBuffer - 1); } int vsprintf_s(char *buffer, size_t sizeOfBuffer, const char *format, va_list args) { if (!sizeOfBuffer) return 0; int c = vsnprintf(buffer, sizeOfBuffer, format, args); buffer[sizeOfBuffer - 1] = '\0'; if (c < 0) return sizeOfBuffer - 1; return LZHAM_MIN(c, (int)sizeOfBuffer - 1); } #endif // __GNUC__ bool lzham_is_debugger_present(void) { #if LZHAM_PLATFORM_X360 return DmIsDebuggerPresent() != 0; #elif LZHAM_USE_WIN32_API return IsDebuggerPresent() != 0; #else return false; #endif } void lzham_debug_break(void) { #if LZHAM_USE_WIN32_API DebugBreak(); #endif } void lzham_output_debug_string(const char* p) { if (p) {} #if LZHAM_USE_WIN32_API OutputDebugStringA(p); #endif } #if LZHAM_BUFFERED_PRINTF // This stuff was a quick hack only intended for debugging/development. namespace lzham { struct buffered_str { enum { cBufSize = 256 }; char m_buf[cBufSize]; }; static lzham::vector<buffered_str> g_buffered_strings; static volatile long g_buffered_string_locked; static void lock_buffered_strings() { while (atomic_exchange32(&g_buffered_string_locked, 1) == 1) { lzham_yield_processor(); lzham_yield_processor(); lzham_yield_processor(); lzham_yield_processor(); } LZHAM_MEMORY_IMPORT_BARRIER } static void unlock_buffered_strings() { LZHAM_MEMORY_EXPORT_BARRIER atomic_exchange32(&g_buffered_string_locked, 0); } } // namespace lzham void lzham_buffered_printf(const char *format, ...) { format; char buf[lzham::buffered_str::cBufSize]; va_list args; va_start(args, format); vsnprintf_s(buf, sizeof(buf), sizeof(buf), format, args); va_end(args); buf[sizeof(buf) - 1] = '\0'; lzham::lock_buffered_strings(); if (!lzham::g_buffered_strings.capacity()) { lzham::g_buffered_strings.try_reserve(2048); } if (lzham::g_buffered_strings.try_resize(lzham::g_buffered_strings.size() + 1)) { memcpy(lzham::g_buffered_strings.back().m_buf, buf, sizeof(buf)); } lzham::unlock_buffered_strings(); } void lzham_flush_buffered_printf() { lzham::lock_buffered_strings(); for (lzham::uint i = 0; i < lzham::g_buffered_strings.size(); i++) { printf("%s", lzham::g_buffered_strings[i].m_buf); } lzham::g_buffered_strings.try_resize(0); lzham::unlock_buffered_strings(); } #endif ����������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_platform.h�������������������������������������������0000644�0001750�0001750�00000022415�12320456500�022713� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_platform.h // See Copyright Notice and license at the end of include/lzham.h #pragma once bool lzham_is_debugger_present(void); void lzham_debug_break(void); void lzham_output_debug_string(const char* p); // actually in lzham_assert.cpp void lzham_assert(const char* pExp, const char* pFile, unsigned line); void lzham_fail(const char* pExp, const char* pFile, unsigned line); #ifdef WIN32 #define LZHAM_BREAKPOINT DebuggerBreak(); #define LZHAM_BUILTIN_EXPECT(c, v) c #elif defined(__GNUC__) #define LZHAM_BREAKPOINT asm("int $3"); #define LZHAM_BUILTIN_EXPECT(c, v) __builtin_expect(c, v) #else #define LZHAM_BREAKPOINT #define LZHAM_BUILTIN_EXPECT(c, v) c #endif #if defined(__GNUC__) && LZHAM_PLATFORM_PC extern __inline__ __attribute__((__always_inline__,__gnu_inline__)) void lzham_yield_processor() { __asm__ __volatile__("pause"); } #elif LZHAM_PLATFORM_X360 #define lzham_yield_processor() \ YieldProcessor(); \ __asm { or r0, r0, r0 } \ YieldProcessor(); \ __asm { or r1, r1, r1 } \ YieldProcessor(); \ __asm { or r0, r0, r0 } \ YieldProcessor(); \ __asm { or r1, r1, r1 } \ YieldProcessor(); \ __asm { or r0, r0, r0 } \ YieldProcessor(); \ __asm { or r1, r1, r1 } \ YieldProcessor(); \ __asm { or r0, r0, r0 } \ YieldProcessor(); \ __asm { or r1, r1, r1 } #else LZHAM_FORCE_INLINE void lzham_yield_processor() { #if LZHAM_USE_MSVC_INTRINSICS #if LZHAM_PLATFORM_PC_X64 _mm_pause(); #else YieldProcessor(); #endif #else // No implementation #endif } #endif #ifndef _MSC_VER int sprintf_s(char *buffer, size_t sizeOfBuffer, const char *format, ...); int vsprintf_s(char *buffer, size_t sizeOfBuffer, const char *format, va_list args); #endif #if LZHAM_PLATFORM_X360 #define LZHAM_MEMORY_EXPORT_BARRIER MemoryBarrier(); #else // Barriers shouldn't be necessary on x86/x64. // TODO: Should use __sync_synchronize() on other platforms that support GCC. #define LZHAM_MEMORY_EXPORT_BARRIER #endif #if LZHAM_PLATFORM_X360 #define LZHAM_MEMORY_IMPORT_BARRIER MemoryBarrier(); #else // Barriers shouldn't be necessary on x86/x64. // TODO: Should use __sync_synchronize() on other platforms that support GCC. #define LZHAM_MEMORY_IMPORT_BARRIER #endif // Note: It's very important that LZHAM_READ_BIG_ENDIAN_UINT32() is fast on the target platform. // This is used to read every DWORD from the input stream. #if LZHAM_USE_UNALIGNED_INT_LOADS #if LZHAM_BIG_ENDIAN_CPU #define LZHAM_READ_BIG_ENDIAN_UINT32(p) *reinterpret_cast<const uint32*>(p) #else #if defined(LZHAM_USE_MSVC_INTRINSICS) #define LZHAM_READ_BIG_ENDIAN_UINT32(p) _byteswap_ulong(*reinterpret_cast<const uint32*>(p)) #elif defined(__GNUC__) #define LZHAM_READ_BIG_ENDIAN_UINT32(p) __builtin_bswap32(*reinterpret_cast<const uint32*>(p)) #else #define LZHAM_READ_BIG_ENDIAN_UINT32(p) utils::swap32(*reinterpret_cast<const uint32*>(p)) #endif #endif #else #define LZHAM_READ_BIG_ENDIAN_UINT32(p) ((reinterpret_cast<const uint8*>(p)[0] << 24) | (reinterpret_cast<const uint8*>(p)[1] << 16) | (reinterpret_cast<const uint8*>(p)[2] << 8) | (reinterpret_cast<const uint8*>(p)[3])) #endif #if LZHAM_USE_WIN32_ATOMIC_FUNCTIONS extern "C" __int64 _InterlockedCompareExchange64(__int64 volatile * Destination, __int64 Exchange, __int64 Comperand); #if defined(_MSC_VER) #pragma intrinsic(_InterlockedCompareExchange64) #endif #endif // LZHAM_USE_WIN32_ATOMIC_FUNCTIONS namespace lzham { #if LZHAM_USE_WIN32_ATOMIC_FUNCTIONS typedef LONG atomic32_t; typedef LONGLONG atomic64_t; // Returns the original value. inline atomic32_t atomic_compare_exchange32(atomic32_t volatile *pDest, atomic32_t exchange, atomic32_t comparand) { LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0); return InterlockedCompareExchange(pDest, exchange, comparand); } // Returns the original value. inline atomic64_t atomic_compare_exchange64(atomic64_t volatile *pDest, atomic64_t exchange, atomic64_t comparand) { LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 7) == 0); return _InterlockedCompareExchange64(pDest, exchange, comparand); } // Returns the resulting incremented value. inline atomic32_t atomic_increment32(atomic32_t volatile *pDest) { LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0); return InterlockedIncrement(pDest); } // Returns the resulting decremented value. inline atomic32_t atomic_decrement32(atomic32_t volatile *pDest) { LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0); return InterlockedDecrement(pDest); } // Returns the original value. inline atomic32_t atomic_exchange32(atomic32_t volatile *pDest, atomic32_t val) { LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0); return InterlockedExchange(pDest, val); } // Returns the resulting value. inline atomic32_t atomic_add32(atomic32_t volatile *pDest, atomic32_t val) { LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0); return InterlockedExchangeAdd(pDest, val) + val; } // Returns the original value. inline atomic32_t atomic_exchange_add(atomic32_t volatile *pDest, atomic32_t val) { LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0); return InterlockedExchangeAdd(pDest, val); } #elif LZHAM_USE_GCC_ATOMIC_BUILTINS typedef long atomic32_t; typedef long long atomic64_t; // Returns the original value. inline atomic32_t atomic_compare_exchange32(atomic32_t volatile *pDest, atomic32_t exchange, atomic32_t comparand) { LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0); return __sync_val_compare_and_swap(pDest, comparand, exchange); } // Returns the original value. inline atomic64_t atomic_compare_exchange64(atomic64_t volatile *pDest, atomic64_t exchange, atomic64_t comparand) { LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 7) == 0); return __sync_val_compare_and_swap(pDest, comparand, exchange); } // Returns the resulting incremented value. inline atomic32_t atomic_increment32(atomic32_t volatile *pDest) { LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0); return __sync_add_and_fetch(pDest, 1); } // Returns the resulting decremented value. inline atomic32_t atomic_decrement32(atomic32_t volatile *pDest) { LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0); return __sync_sub_and_fetch(pDest, 1); } // Returns the original value. inline atomic32_t atomic_exchange32(atomic32_t volatile *pDest, atomic32_t val) { LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0); return __sync_lock_test_and_set(pDest, val); } // Returns the resulting value. inline atomic32_t atomic_add32(atomic32_t volatile *pDest, atomic32_t val) { LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0); return __sync_add_and_fetch(pDest, val); } // Returns the original value. inline atomic32_t atomic_exchange_add(atomic32_t volatile *pDest, atomic32_t val) { LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0); return __sync_fetch_and_add(pDest, val); } #else #define LZHAM_NO_ATOMICS 1 // Atomic ops not supported - but try to do something reasonable. Assumes no threading at all. typedef long atomic32_t; typedef long long atomic64_t; inline atomic32_t atomic_compare_exchange32(atomic32_t volatile *pDest, atomic32_t exchange, atomic32_t comparand) { LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0); atomic32_t cur = *pDest; if (cur == comparand) *pDest = exchange; return cur; } inline atomic64_t atomic_compare_exchange64(atomic64_t volatile *pDest, atomic64_t exchange, atomic64_t comparand) { LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 7) == 0); atomic64_t cur = *pDest; if (cur == comparand) *pDest = exchange; return cur; } inline atomic32_t atomic_increment32(atomic32_t volatile *pDest) { LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0); return (*pDest += 1); } inline atomic32_t atomic_decrement32(atomic32_t volatile *pDest) { LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0); return (*pDest -= 1); } inline atomic32_t atomic_exchange32(atomic32_t volatile *pDest, atomic32_t val) { LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0); atomic32_t cur = *pDest; *pDest = val; return cur; } inline atomic32_t atomic_add32(atomic32_t volatile *pDest, atomic32_t val) { LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0); return (*pDest += val); } inline atomic32_t atomic_exchange_add(atomic32_t volatile *pDest, atomic32_t val) { LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0); atomic32_t cur = *pDest; *pDest += val; return cur; } #endif #if LZHAM_BUFFERED_PRINTF void lzham_buffered_printf(const char *format, ...); void lzham_flush_buffered_printf(); #else inline void lzham_buffered_printf(const char *format, ...) { (void)format; } inline void lzham_flush_buffered_printf() { } #endif } // namespace lzham ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_polar_codes.h����������������������������������������0000644�0001750�0001750�00000000661�12320456500�023360� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_polar_codes.h // See Copyright Notice and license at the end of include/lzham.h #pragma once namespace lzham { //const uint cPolarMaxSupportedSyms = 600; const uint cPolarMaxSupportedSyms = 1024; uint get_generate_polar_codes_table_size(); bool generate_polar_codes(void* pContext, uint num_syms, const uint16* pFreq, uint8* pCodesizes, uint& max_code_size, uint& total_freq_ret); } // namespace lzham �������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_huffman_codes.h��������������������������������������0000644�0001750�0001750�00000000701�12320456500�023662� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_huffman_codes.h // See Copyright Notice and license at the end of include/lzham.h #pragma once namespace lzham { //const uint cHuffmanMaxSupportedSyms = 600; const uint cHuffmanMaxSupportedSyms = 1024; uint get_generate_huffman_codes_table_size(); bool generate_huffman_codes(void* pContext, uint num_syms, const uint16* pFreq, uint8* pCodesizes, uint& max_code_size, uint& total_freq_ret); } // namespace lzham ���������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_prefix_coding.h��������������������������������������0000644�0001750�0001750�00000011507�12320456500�023707� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_prefix_coding.h // See Copyright Notice and license at the end of include/lzham.h #pragma once namespace lzham { namespace prefix_coding { const uint cMaxExpectedCodeSize = 16; const uint cMaxSupportedSyms = 1024; const uint cMaxTableBits = 11; bool limit_max_code_size(uint num_syms, uint8* pCodesizes, uint max_code_size); bool generate_codes(uint num_syms, const uint8* pCodesizes, uint16* pCodes); class decoder_tables { public: inline decoder_tables() : m_table_shift(0), m_table_max_code(0), m_decode_start_code_size(0), m_cur_lookup_size(0), m_lookup(NULL), m_cur_sorted_symbol_order_size(0), m_sorted_symbol_order(NULL) { } inline decoder_tables(const decoder_tables& other) : m_table_shift(0), m_table_max_code(0), m_decode_start_code_size(0), m_cur_lookup_size(0), m_lookup(NULL), m_cur_sorted_symbol_order_size(0), m_sorted_symbol_order(NULL) { *this = other; } inline decoder_tables& operator= (const decoder_tables& rhs) { assign(rhs); return *this; } inline bool assign(const decoder_tables& rhs) { if (this == &rhs) return true; uint32* pCur_lookup = m_lookup; uint16* pCur_sorted_symbol_order = m_sorted_symbol_order; memcpy(this, &rhs, sizeof(*this)); if ((pCur_lookup) && (pCur_sorted_symbol_order) && (rhs.m_cur_lookup_size == m_cur_lookup_size) && (rhs.m_cur_sorted_symbol_order_size == m_cur_sorted_symbol_order_size)) { m_lookup = pCur_lookup; m_sorted_symbol_order = pCur_sorted_symbol_order; memcpy(m_lookup, rhs.m_lookup, sizeof(m_lookup[0]) * m_cur_lookup_size); memcpy(m_sorted_symbol_order, rhs.m_sorted_symbol_order, sizeof(m_sorted_symbol_order[0]) * m_cur_sorted_symbol_order_size); } else { lzham_delete_array(pCur_lookup); m_lookup = NULL; if (rhs.m_lookup) { m_lookup = lzham_new_array<uint32>(m_cur_lookup_size); if (!m_lookup) return false; memcpy(m_lookup, rhs.m_lookup, sizeof(m_lookup[0]) * m_cur_lookup_size); } lzham_delete_array(pCur_sorted_symbol_order); m_sorted_symbol_order = NULL; if (rhs.m_sorted_symbol_order) { m_sorted_symbol_order = lzham_new_array<uint16>(m_cur_sorted_symbol_order_size); if (!m_sorted_symbol_order) return false; memcpy(m_sorted_symbol_order, rhs.m_sorted_symbol_order, sizeof(m_sorted_symbol_order[0]) * m_cur_sorted_symbol_order_size); } } return true; } inline void clear() { if (m_lookup) { lzham_delete_array(m_lookup); m_lookup = 0; m_cur_lookup_size = 0; } if (m_sorted_symbol_order) { lzham_delete_array(m_sorted_symbol_order); m_sorted_symbol_order = NULL; m_cur_sorted_symbol_order_size = 0; } } inline ~decoder_tables() { if (m_lookup) lzham_delete_array(m_lookup); if (m_sorted_symbol_order) lzham_delete_array(m_sorted_symbol_order); } // DO NOT use any complex classes here - it is bitwise copied. uint m_num_syms; uint m_total_used_syms; uint m_table_bits; uint m_table_shift; uint m_table_max_code; uint m_decode_start_code_size; uint8 m_min_code_size; uint8 m_max_code_size; uint m_max_codes[cMaxExpectedCodeSize + 1]; int m_val_ptrs[cMaxExpectedCodeSize + 1]; uint m_cur_lookup_size; uint32* m_lookup; uint m_cur_sorted_symbol_order_size; uint16* m_sorted_symbol_order; inline uint get_unshifted_max_code(uint len) const { LZHAM_ASSERT( (len >= 1) && (len <= cMaxExpectedCodeSize) ); uint k = m_max_codes[len - 1]; if (!k) return UINT_MAX; return (k - 1) >> (16 - len); } }; bool generate_decoder_tables(uint num_syms, const uint8* pCodesizes, decoder_tables* pTables, uint table_bits); } // namespace prefix_coding } // namespace lzham �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_helpers.h��������������������������������������������0000644�0001750�0001750�00000002667�12320456500�022540� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_helpers.h // See Copyright Notice and license at the end of include/lzham.h #pragma once #define LZHAM_NO_COPY_OR_ASSIGNMENT_OP(c) c(const c&); c& operator= (const c&); namespace lzham { namespace helpers { template<typename T> struct rel_ops { friend inline bool operator!=(const T& x, const T& y) { return (!(x == y)); } friend inline bool operator> (const T& x, const T& y) { return (y < x); } friend inline bool operator<=(const T& x, const T& y) { return (!(y < x)); } friend inline bool operator>=(const T& x, const T& y) { return (!(x < y)); } }; template <typename T> inline T* construct(T* p) { return new (static_cast<void*>(p)) T; } template <typename T, typename U> inline T* construct(T* p, const U& init) { return new (static_cast<void*>(p)) T(init); } template <typename T> inline void construct_array(T* p, uint n); template <typename T, typename U> inline void construct_array(T* p, uint n, const U& init) { T* q = p + n; for ( ; p != q; ++p) new (static_cast<void*>(p)) T(init); } template <typename T> inline void destruct(T* p) { if (p) {} p->~T(); } template <typename T> inline void destruct_array(T* p, uint n); } // namespace helpers } // namespace lzham �������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_lzdecompbase.h���������������������������������������0000644�0001750�0001750�00000004157�12320456500�023542� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_lzdecompbase.h // See Copyright Notice and license at the end of include/lzham.h #pragma once //#define LZHAM_LZDEBUG #define LZHAM_IS_MATCH_MODEL_INDEX(prev_char, cur_state) ((prev_char) >> (8 - CLZDecompBase::cNumIsMatchContextBits)) + ((cur_state) << CLZDecompBase::cNumIsMatchContextBits) #define LZHAM_USE_ALL_ARITHMETIC_CODING 0 #define LZHAM_RND_CONG(jcong) (69069U * jcong + 1234567U) namespace lzham { struct CLZDecompBase { enum { cMinMatchLen = 2U, cMaxMatchLen = 257U, cMaxHugeMatchLen = 65536, cMinDictSizeLog2 = 15, cMaxDictSizeLog2 = 29, cMatchHistSize = 4, cMaxLen2MatchDist = 2047 }; enum { cLZXNumSecondaryLengths = 249, cNumHugeMatchCodes = 1, cMaxHugeMatchCodeBits = 16, cLZXNumSpecialLengths = 2, cLZXLowestUsableMatchSlot = 1, cLZXMaxPositionSlots = 128 }; enum { cLZXSpecialCodeEndOfBlockCode = 0, cLZXSpecialCodePartialStateReset = 1 }; enum { cLZHAMDebugSyncMarkerValue = 666, cLZHAMDebugSyncMarkerBits = 12 }; enum { cBlockHeaderBits = 2, cBlockCheckBits = 4, cBlockFlushTypeBits = 2, cSyncBlock = 0, cCompBlock = 1, cRawBlock = 2, cEOFBlock = 3 }; enum { cNumStates = 12, cNumLitStates = 7, cNumLitPredBits = 6, // must be even cNumDeltaLitPredBits = 6, // must be even cNumIsMatchContextBits = 6 }; uint m_dict_size_log2; uint m_dict_size; uint m_num_lzx_slots; uint m_lzx_position_base[cLZXMaxPositionSlots]; uint m_lzx_position_extra_mask[cLZXMaxPositionSlots]; uint8 m_lzx_position_extra_bits[cLZXMaxPositionSlots]; void init_position_slots(uint dict_size_log2); }; } // namespace lzham �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_match_accel.h����������������������������������������0000644�0001750�0001750�00000012150�12320456500�023305� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_match_accel.h // See Copyright Notice and license at the end of include/lzham.h #pragma once #include "lzham_lzbase.h" #include "lzham_threading.h" namespace lzham { const uint cMatchAccelMaxSupportedProbes = 128; struct node { uint m_left; uint m_right; }; LZHAM_DEFINE_BITWISE_MOVABLE(node); #pragma pack(push, 1) struct dict_match { uint m_dist; uint16 m_len; inline uint get_dist() const { return m_dist & 0x7FFFFFFF; } inline uint get_len() const { return m_len + 2; } inline bool is_last() const { return (int)m_dist < 0; } }; #pragma pack(pop) LZHAM_DEFINE_BITWISE_MOVABLE(dict_match); class search_accelerator { public: search_accelerator(); // If all_matches is true, the match finder returns all found matches with no filtering. // Otherwise, the finder will tend to return lists of matches with mostly unique lengths. // For each length, it will discard matches with worse distances (in the coding sense). bool init(CLZBase* pLZBase, task_pool* pPool, uint max_helper_threads, uint max_dict_size, uint max_matches, bool all_matches, uint max_probes); void reset(); void flush(); inline uint get_max_dict_size() const { return m_max_dict_size; } inline uint get_max_dict_size_mask() const { return m_max_dict_size_mask; } inline uint get_cur_dict_size() const { return m_cur_dict_size; } inline uint get_lookahead_pos() const { return m_lookahead_pos; } inline uint get_lookahead_size() const { return m_lookahead_size; } inline uint get_char(int delta_pos) const { return m_dict[(m_lookahead_pos + delta_pos) & m_max_dict_size_mask]; } inline uint get_char(uint cur_dict_pos, int delta_pos) const { return m_dict[(cur_dict_pos + delta_pos) & m_max_dict_size_mask]; } inline const uint8* get_ptr(uint pos) const { return &m_dict[pos]; } uint get_max_helper_threads() const { return m_max_helper_threads; } inline uint operator[](uint pos) const { return m_dict[pos]; } uint get_max_add_bytes() const; bool add_bytes_begin(uint num_bytes, const uint8* pBytes); inline atomic32_t get_num_completed_helper_threads() const { return m_num_completed_helper_threads; } void add_bytes_end(); // Returns the lookahead's raw position/size/dict_size at the time add_bytes_begin() is called. inline uint get_fill_lookahead_pos() const { return m_fill_lookahead_pos; } inline uint get_fill_lookahead_size() const { return m_fill_lookahead_size; } inline uint get_fill_dict_size() const { return m_fill_dict_size; } uint get_len2_match(uint lookahead_ofs); dict_match* find_matches(uint lookahead_ofs, bool spin = true); void advance_bytes(uint num_bytes); LZHAM_FORCE_INLINE uint get_match_len(uint lookahead_ofs, int dist, uint max_match_len, uint start_match_len = 0) const { LZHAM_ASSERT(lookahead_ofs < m_lookahead_size); LZHAM_ASSERT(start_match_len <= max_match_len); LZHAM_ASSERT(max_match_len <= (get_lookahead_size() - lookahead_ofs)); const int find_dict_size = m_cur_dict_size + lookahead_ofs; if (dist > find_dict_size) return 0; const uint comp_pos = static_cast<uint>((m_lookahead_pos + lookahead_ofs - dist) & m_max_dict_size_mask); const uint lookahead_pos = (m_lookahead_pos + lookahead_ofs) & m_max_dict_size_mask; const uint8* pComp = &m_dict[comp_pos]; const uint8* pLookahead = &m_dict[lookahead_pos]; uint match_len; for (match_len = start_match_len; match_len < max_match_len; match_len++) if (pComp[match_len] != pLookahead[match_len]) break; return match_len; } public: CLZBase* m_pLZBase; task_pool* m_pTask_pool; uint m_max_helper_threads; uint m_max_dict_size; uint m_max_dict_size_mask; uint m_lookahead_pos; uint m_lookahead_size; uint m_cur_dict_size; lzham::vector<uint8> m_dict; enum { cHashSize = 65536 }; lzham::vector<uint> m_hash; lzham::vector<node> m_nodes; lzham::vector<dict_match> m_matches; lzham::vector<atomic32_t> m_match_refs; lzham::vector<uint8> m_hash_thread_index; enum { cDigramHashSize = 4096 }; lzham::vector<uint> m_digram_hash; lzham::vector<uint> m_digram_next; uint m_fill_lookahead_pos; uint m_fill_lookahead_size; uint m_fill_dict_size; uint m_max_probes; uint m_max_matches; bool m_all_matches; volatile atomic32_t m_next_match_ref; volatile atomic32_t m_num_completed_helper_threads; void find_all_matches_callback(uint64 data, void* pData_ptr); bool find_all_matches(uint num_bytes); bool find_len2_matches(); }; } // namespace lzham ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_symbol_codec.h���������������������������������������0000644�0001750�0001750�00000047263�12320456500�023541� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_symbol_codec.h // See Copyright Notice and license at the end of include/lzham.h #pragma once #include "lzham_prefix_coding.h" namespace lzham { class symbol_codec; class adaptive_arith_data_model; const uint cSymbolCodecArithMinLen = 0x01000000U; const uint cSymbolCodecArithMaxLen = 0xFFFFFFFFU; const uint cSymbolCodecArithProbBits = 11; const uint cSymbolCodecArithProbScale = 1 << cSymbolCodecArithProbBits; const uint cSymbolCodecArithProbHalfScale = 1 << (cSymbolCodecArithProbBits - 1); const uint cSymbolCodecArithProbMoveBits = 5; typedef uint64 bit_cost_t; const uint32 cBitCostScaleShift = 24; const uint32 cBitCostScale = (1U << cBitCostScaleShift); const bit_cost_t cBitCostMax = LZHAM_UINT64_MAX; inline bit_cost_t convert_to_scaled_bitcost(uint bits) { LZHAM_ASSERT(bits <= 255); uint32 scaled_bits = bits << cBitCostScaleShift; return static_cast<bit_cost_t>(scaled_bits); } extern uint32 g_prob_cost[cSymbolCodecArithProbScale]; class raw_quasi_adaptive_huffman_data_model { public: raw_quasi_adaptive_huffman_data_model(bool encoding = true, uint total_syms = 0, bool fast_encoding = false, bool use_polar_codes = false); raw_quasi_adaptive_huffman_data_model(const raw_quasi_adaptive_huffman_data_model& other); ~raw_quasi_adaptive_huffman_data_model(); bool assign(const raw_quasi_adaptive_huffman_data_model& rhs); raw_quasi_adaptive_huffman_data_model& operator= (const raw_quasi_adaptive_huffman_data_model& rhs); void clear(); bool init(bool encoding, uint total_syms, bool fast_encoding, bool use_polar_codes, const uint16 *pInitial_sym_freq = NULL); bool reset(); inline uint get_total_syms() const { return m_total_syms; } void rescale(); void reset_update_rate(); bool update(uint sym); inline bit_cost_t get_cost(uint sym) const { return convert_to_scaled_bitcost(m_code_sizes[sym]); } public: lzham::vector<uint16> m_initial_sym_freq; lzham::vector<uint16> m_sym_freq; lzham::vector<uint16> m_codes; lzham::vector<uint8> m_code_sizes; prefix_coding::decoder_tables* m_pDecode_tables; uint m_total_syms; uint m_max_cycle; uint m_update_cycle; uint m_symbols_until_update; uint m_total_count; uint8 m_decoder_table_bits; bool m_encoding; bool m_fast_updating; bool m_use_polar_codes; bool update(); friend class symbol_codec; }; struct quasi_adaptive_huffman_data_model : public raw_quasi_adaptive_huffman_data_model { #if LZHAM_64BIT_POINTERS // Ensures sizeof(quasi_adaptive_huffman_data_model) is 128 bytes on x64 (it's 64 on x86). char m_unused_alignment[128 - sizeof(raw_quasi_adaptive_huffman_data_model)]; #endif }; class adaptive_bit_model { public: adaptive_bit_model(); adaptive_bit_model(float prob0); adaptive_bit_model(const adaptive_bit_model& other); inline adaptive_bit_model& operator= (const adaptive_bit_model& rhs) { m_bit_0_prob = rhs.m_bit_0_prob; return *this; } inline void clear() { m_bit_0_prob = 1U << (cSymbolCodecArithProbBits - 1); } void set_probability_0(float prob0); inline void update(uint bit) { if (!bit) m_bit_0_prob += ((cSymbolCodecArithProbScale - m_bit_0_prob) >> cSymbolCodecArithProbMoveBits); else m_bit_0_prob -= (m_bit_0_prob >> cSymbolCodecArithProbMoveBits); LZHAM_ASSERT(m_bit_0_prob >= 1); LZHAM_ASSERT(m_bit_0_prob < cSymbolCodecArithProbScale); } inline bit_cost_t get_cost(uint bit) const { return g_prob_cost[bit ? (cSymbolCodecArithProbScale - m_bit_0_prob) : m_bit_0_prob]; } public: uint16 m_bit_0_prob; friend class symbol_codec; friend class adaptive_arith_data_model; }; // This class is not actually used by LZHAM - it's only here for comparison/experimental purposes. class adaptive_arith_data_model { public: adaptive_arith_data_model(bool encoding = true, uint total_syms = 0); adaptive_arith_data_model(const adaptive_arith_data_model& other); ~adaptive_arith_data_model(); adaptive_arith_data_model& operator= (const adaptive_arith_data_model& rhs); void clear(); bool init(bool encoding, uint total_syms); bool init(bool encoding, uint total_syms, bool fast_encoding, bool use_polar_codes = false) { if (fast_encoding) {} if (use_polar_codes) {} return init(encoding, total_syms); } void reset(); void reset_update_rate(); bool update(uint sym); uint get_total_syms() const { return m_total_syms; } bit_cost_t get_cost(uint sym) const; public: uint m_total_syms; typedef lzham::vector<adaptive_bit_model> adaptive_bit_model_vector; adaptive_bit_model_vector m_probs; friend class symbol_codec; }; #if LZHAM_CPU_HAS_64BIT_REGISTERS #define LZHAM_SYMBOL_CODEC_USE_64_BIT_BUFFER 1 #else #define LZHAM_SYMBOL_CODEC_USE_64_BIT_BUFFER 0 #endif class symbol_codec { public: symbol_codec(); void reset(); // clear() is like reset(), except it also frees all memory. void clear(); // Encoding bool start_encoding(uint expected_file_size); bool encode_bits(uint bits, uint num_bits); bool encode_arith_init(); bool encode_align_to_byte(); bool encode(uint sym, quasi_adaptive_huffman_data_model& model); bool encode(uint bit, adaptive_bit_model& model, bool update_model = true); bool encode(uint sym, adaptive_arith_data_model& model); inline uint encode_get_total_bits_written() const { return m_total_bits_written; } bool stop_encoding(bool support_arith); const lzham::vector<uint8>& get_encoding_buf() const { return m_output_buf; } lzham::vector<uint8>& get_encoding_buf() { return m_output_buf; } // Decoding typedef void (*need_bytes_func_ptr)(size_t num_bytes_consumed, void *pPrivate_data, const uint8* &pBuf, size_t &buf_size, bool &eof_flag); bool start_decoding(const uint8* pBuf, size_t buf_size, bool eof_flag = true, need_bytes_func_ptr pNeed_bytes_func = NULL, void *pPrivate_data = NULL); inline void decode_set_input_buffer(const uint8* pBuf, size_t buf_size, const uint8* pBuf_next, bool eof_flag) { m_pDecode_buf = pBuf; m_pDecode_buf_next = pBuf_next; m_decode_buf_size = buf_size; m_pDecode_buf_end = pBuf + buf_size; m_decode_buf_eof = eof_flag; } inline uint64 decode_get_bytes_consumed() const { return m_pDecode_buf_next - m_pDecode_buf; } inline uint64 decode_get_bits_remaining() const { return ((m_pDecode_buf_end - m_pDecode_buf_next) << 3) + m_bit_count; } void start_arith_decoding(); uint decode_bits(uint num_bits); uint decode_peek_bits(uint num_bits); void decode_remove_bits(uint num_bits); void decode_align_to_byte(); int decode_remove_byte_from_bit_buf(); uint decode(quasi_adaptive_huffman_data_model& model); uint decode(adaptive_bit_model& model, bool update_model = true); uint decode(adaptive_arith_data_model& model); uint64 stop_decoding(); uint get_total_model_updates() const { return m_total_model_updates; } public: const uint8* m_pDecode_buf; const uint8* m_pDecode_buf_next; const uint8* m_pDecode_buf_end; size_t m_decode_buf_size; bool m_decode_buf_eof; need_bytes_func_ptr m_pDecode_need_bytes_func; void* m_pDecode_private_data; #if LZHAM_SYMBOL_CODEC_USE_64_BIT_BUFFER typedef uint64 bit_buf_t; enum { cBitBufSize = 64 }; #else typedef uint32 bit_buf_t; enum { cBitBufSize = 32 }; #endif bit_buf_t m_bit_buf; int m_bit_count; uint m_total_model_updates; lzham::vector<uint8> m_output_buf; lzham::vector<uint8> m_arith_output_buf; struct output_symbol { uint m_bits; enum { cArithSym = -1, cAlignToByteSym = -2, cArithInit = -3 }; int16 m_num_bits; uint16 m_arith_prob0; }; lzham::vector<output_symbol> m_output_syms; uint m_total_bits_written; uint m_arith_base; uint m_arith_value; uint m_arith_length; uint m_arith_total_bits; quasi_adaptive_huffman_data_model* m_pSaved_huff_model; void* m_pSaved_model; uint m_saved_node_index; bool put_bits_init(uint expected_size); bool record_put_bits(uint bits, uint num_bits); void arith_propagate_carry(); bool arith_renorm_enc_interval(); void arith_start_encoding(); bool arith_stop_encoding(); bool put_bits(uint bits, uint num_bits); bool put_bits_align_to_byte(); bool flush_bits(); bool assemble_output_buf(); uint get_bits(uint num_bits); void remove_bits(uint num_bits); void decode_need_bytes(); enum { cNull, cEncoding, cDecoding } m_mode; }; // Optional macros for faster decompression. These macros implement the symbol_codec class's decode functionality. // This is hard to debug (and just plain ugly), but using these macros eliminate function calls, and they place the most important // member variables on the stack so they're hopefully put in registers (avoiding horrible load hit stores on some CPU's). // The user must define the LZHAM_DECODE_NEEDS_BYTES macro, which is invoked when the decode buffer is exhausted. #define LZHAM_SYMBOL_CODEC_DECODE_DECLARE(codec) \ uint arith_value = 0; \ uint arith_length = 0; \ symbol_codec::bit_buf_t bit_buf = 0; \ int bit_count = 0; \ const uint8* pDecode_buf_next = NULL; #define LZHAM_SYMBOL_CODEC_DECODE_BEGIN(codec) \ arith_value = codec.m_arith_value; \ arith_length = codec.m_arith_length; \ bit_buf = codec.m_bit_buf; \ bit_count = codec.m_bit_count; \ pDecode_buf_next = codec.m_pDecode_buf_next; #define LZHAM_SYMBOL_CODEC_DECODE_END(codec) \ codec.m_arith_value = arith_value; \ codec.m_arith_length = arith_length; \ codec.m_bit_buf = bit_buf; \ codec.m_bit_count = bit_count; \ codec.m_pDecode_buf_next = pDecode_buf_next; // The user must declare the LZHAM_DECODE_NEEDS_BYTES macro. #define LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, result, num_bits) \ { \ while (LZHAM_BUILTIN_EXPECT(bit_count < (int)(num_bits), 0)) \ { \ uint r; \ if (LZHAM_BUILTIN_EXPECT(pDecode_buf_next == codec.m_pDecode_buf_end, 0)) \ { \ if (LZHAM_BUILTIN_EXPECT(!codec.m_decode_buf_eof, 1)) \ { \ LZHAM_SYMBOL_CODEC_DECODE_END(codec) \ LZHAM_DECODE_NEEDS_BYTES \ LZHAM_SYMBOL_CODEC_DECODE_BEGIN(codec) \ } \ r = 0; \ if (LZHAM_BUILTIN_EXPECT(pDecode_buf_next < codec.m_pDecode_buf_end, 1)) r = *pDecode_buf_next++; \ } \ else \ r = *pDecode_buf_next++; \ bit_count += 8; \ bit_buf |= (static_cast<symbol_codec::bit_buf_t>(r) << (symbol_codec::cBitBufSize - bit_count)); \ } \ result = (num_bits) ? static_cast<uint>(bit_buf >> (symbol_codec::cBitBufSize - (num_bits))) : 0; \ bit_buf <<= (num_bits); \ bit_count -= (num_bits); \ } #define LZHAM_SYMBOL_CODEC_DECODE_ARITH_BIT(codec, result, model) \ { \ adaptive_bit_model *pModel; \ pModel = &model; \ while (LZHAM_BUILTIN_EXPECT(arith_length < cSymbolCodecArithMinLen, 0)) \ { \ uint c; codec.m_pSaved_model = pModel; \ LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, c, 8); \ pModel = static_cast<adaptive_bit_model*>(codec.m_pSaved_model); \ arith_value = (arith_value << 8) | c; \ arith_length <<= 8; \ } \ uint x = pModel->m_bit_0_prob * (arith_length >> cSymbolCodecArithProbBits); \ result = (arith_value >= x); \ if (!result) \ { \ pModel->m_bit_0_prob += ((cSymbolCodecArithProbScale - pModel->m_bit_0_prob) >> cSymbolCodecArithProbMoveBits); \ arith_length = x; \ } \ else \ { \ pModel->m_bit_0_prob -= (pModel->m_bit_0_prob >> cSymbolCodecArithProbMoveBits); \ arith_value -= x; \ arith_length -= x; \ } \ } #define LZHAM_SYMBOL_CODEC_DECODE_ADAPTIVE_ARITHMETIC(codec, result, model) \ { \ adaptive_arith_data_model *pArith_data_model; \ pArith_data_model = &model; \ uint node_index; \ node_index = 1; \ do \ { \ while (LZHAM_BUILTIN_EXPECT(arith_length < cSymbolCodecArithMinLen, 0)) \ { \ uint c; codec.m_saved_node_index = node_index; codec.m_pSaved_model = pArith_data_model; \ LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, c, 8); \ node_index = codec.m_saved_node_index; pArith_data_model = static_cast<adaptive_arith_data_model *>(codec.m_pSaved_model); \ arith_value = (arith_value << 8) | c; \ arith_length <<= 8; \ } \ adaptive_bit_model *pBit_model; pBit_model = &pArith_data_model->m_probs[node_index]; \ uint x = pBit_model->m_bit_0_prob * (arith_length >> cSymbolCodecArithProbBits); \ uint bit; bit = (arith_value >= x); \ if (!bit) \ { \ pBit_model->m_bit_0_prob += ((cSymbolCodecArithProbScale - pBit_model->m_bit_0_prob) >> cSymbolCodecArithProbMoveBits); \ arith_length = x; \ } \ else \ { \ pBit_model->m_bit_0_prob -= (pBit_model->m_bit_0_prob >> cSymbolCodecArithProbMoveBits); \ arith_value -= x; \ arith_length -= x; \ } \ node_index = (node_index << 1) + bit; \ } while (node_index < pArith_data_model->m_total_syms); \ result = node_index - pArith_data_model->m_total_syms; \ } #if LZHAM_SYMBOL_CODEC_USE_64_BIT_BUFFER #define LZHAM_SYMBOL_CODEC_DECODE_ADAPTIVE_HUFFMAN(codec, result, model) \ { \ quasi_adaptive_huffman_data_model* pModel; const prefix_coding::decoder_tables* pTables; \ pModel = &model; pTables = model.m_pDecode_tables; \ if (LZHAM_BUILTIN_EXPECT(bit_count < 24, 0)) \ { \ uint c; \ pDecode_buf_next += sizeof(uint32); \ if (LZHAM_BUILTIN_EXPECT(pDecode_buf_next >= codec.m_pDecode_buf_end, 0)) \ { \ pDecode_buf_next -= sizeof(uint32); \ while (bit_count < 24) \ { \ if (!codec.m_decode_buf_eof) \ { \ codec.m_pSaved_huff_model = pModel; \ LZHAM_SYMBOL_CODEC_DECODE_END(codec) \ LZHAM_DECODE_NEEDS_BYTES \ LZHAM_SYMBOL_CODEC_DECODE_BEGIN(codec) \ pModel = codec.m_pSaved_huff_model; pTables = pModel->m_pDecode_tables; \ } \ c = 0; if (pDecode_buf_next < codec.m_pDecode_buf_end) c = *pDecode_buf_next++; \ bit_count += 8; \ bit_buf |= (static_cast<symbol_codec::bit_buf_t>(c) << (symbol_codec::cBitBufSize - bit_count)); \ } \ } \ else \ { \ c = LZHAM_READ_BIG_ENDIAN_UINT32(pDecode_buf_next - sizeof(uint32)); \ bit_count += 32; \ bit_buf |= (static_cast<symbol_codec::bit_buf_t>(c) << (symbol_codec::cBitBufSize - bit_count)); \ } \ } \ uint k = static_cast<uint>((bit_buf >> (symbol_codec::cBitBufSize - 16)) + 1); \ uint len; \ if (LZHAM_BUILTIN_EXPECT(k <= pTables->m_table_max_code, 1)) \ { \ uint32 t = pTables->m_lookup[bit_buf >> (symbol_codec::cBitBufSize - pTables->m_table_bits)]; \ result = t & LZHAM_UINT16_MAX; \ len = t >> 16; \ } \ else \ { \ len = pTables->m_decode_start_code_size; \ for ( ; ; ) \ { \ if (LZHAM_BUILTIN_EXPECT(k <= pTables->m_max_codes[len - 1], 0)) \ break; \ len++; \ } \ int val_ptr = pTables->m_val_ptrs[len - 1] + static_cast<int>(bit_buf >> (symbol_codec::cBitBufSize - len)); \ if (((uint)val_ptr >= pModel->m_total_syms)) val_ptr = 0; \ result = pTables->m_sorted_symbol_order[val_ptr]; \ } \ bit_buf <<= len; \ bit_count -= len; \ uint freq = pModel->m_sym_freq[result]; \ freq++; \ pModel->m_sym_freq[result] = static_cast<uint16>(freq); \ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); \ if (LZHAM_BUILTIN_EXPECT(--pModel->m_symbols_until_update == 0, 0)) \ { \ pModel->update(); \ } \ } #else #define LZHAM_SYMBOL_CODEC_DECODE_ADAPTIVE_HUFFMAN(codec, result, model) \ { \ quasi_adaptive_huffman_data_model* pModel; const prefix_coding::decoder_tables* pTables; \ pModel = &model; pTables = model.m_pDecode_tables; \ while (LZHAM_BUILTIN_EXPECT(bit_count < (symbol_codec::cBitBufSize - 8), 1)) \ { \ uint c; \ if (LZHAM_BUILTIN_EXPECT(pDecode_buf_next == codec.m_pDecode_buf_end, 0)) \ { \ if (LZHAM_BUILTIN_EXPECT(!codec.m_decode_buf_eof, 1)) \ { \ codec.m_pSaved_huff_model = pModel; \ LZHAM_SYMBOL_CODEC_DECODE_END(codec) \ LZHAM_DECODE_NEEDS_BYTES \ LZHAM_SYMBOL_CODEC_DECODE_BEGIN(codec) \ pModel = codec.m_pSaved_huff_model; pTables = pModel->m_pDecode_tables; \ } \ c = 0; if (LZHAM_BUILTIN_EXPECT(pDecode_buf_next < codec.m_pDecode_buf_end, 1)) c = *pDecode_buf_next++; \ } \ else \ c = *pDecode_buf_next++; \ bit_count += 8; \ bit_buf |= (static_cast<symbol_codec::bit_buf_t>(c) << (symbol_codec::cBitBufSize - bit_count)); \ } \ uint k = static_cast<uint>((bit_buf >> (symbol_codec::cBitBufSize - 16)) + 1); \ uint len; \ if (LZHAM_BUILTIN_EXPECT(k <= pTables->m_table_max_code, 1)) \ { \ uint32 t = pTables->m_lookup[bit_buf >> (symbol_codec::cBitBufSize - pTables->m_table_bits)]; \ result = t & LZHAM_UINT16_MAX; \ len = t >> 16; \ } \ else \ { \ len = pTables->m_decode_start_code_size; \ for ( ; ; ) \ { \ if (LZHAM_BUILTIN_EXPECT(k <= pTables->m_max_codes[len - 1], 0)) \ break; \ len++; \ } \ int val_ptr = pTables->m_val_ptrs[len - 1] + static_cast<int>(bit_buf >> (symbol_codec::cBitBufSize - len)); \ if (LZHAM_BUILTIN_EXPECT(((uint)val_ptr >= pModel->m_total_syms), 0)) val_ptr = 0; \ result = pTables->m_sorted_symbol_order[val_ptr]; \ } \ bit_buf <<= len; \ bit_count -= len; \ uint freq = pModel->m_sym_freq[result]; \ freq++; \ pModel->m_sym_freq[result] = static_cast<uint16>(freq); \ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); \ if (LZHAM_BUILTIN_EXPECT(--pModel->m_symbols_until_update == 0, 0)) \ { \ pModel->update(); \ } \ } #endif #define LZHAM_SYMBOL_CODEC_DECODE_ALIGN_TO_BYTE(codec) if (bit_count & 7) { int dummy_result; LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, dummy_result, bit_count & 7); if (dummy_result) {} } #define LZHAM_SYMBOL_CODEC_DECODE_REMOVE_BYTE_FROM_BIT_BUF(codec, result) \ { \ result = -1; \ if (bit_count >= 8) \ { \ result = static_cast<int>(bit_buf >> (symbol_codec::cBitBufSize - 8)); \ bit_buf <<= 8; \ bit_count -= 8; \ } \ } #define LZHAM_SYMBOL_CODEC_DECODE_ARITH_START(codec) \ { \ for ( arith_value = 0, arith_length = 0; arith_length < 4; ++arith_length ) \ { \ uint val; LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, val, 8); \ arith_value = (arith_value << 8) | val; \ } \ arith_length = cSymbolCodecArithMaxLen; \ } } // namespace lzham ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_lzcomp_internal.cpp����������������������������������0000644�0001750�0001750�00000211545�12320456500�024626� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_lzcomp_internal.cpp // See Copyright Notice and license at the end of include/lzham.h #include "lzham_core.h" #include "lzham_lzcomp_internal.h" #include "lzham_checksum.h" #include "lzham_timer.h" #include "lzham_lzbase.h" #include <string.h> // Update and print high-level coding statistics if set to 1. // TODO: Add match distance coding statistics. #define LZHAM_UPDATE_STATS 0 // Only parse on the main thread, for easier debugging. #define LZHAM_FORCE_SINGLE_THREADED_PARSING 0 // Verify all computed match costs against the generic/slow state::get_cost() method. #define LZHAM_VERIFY_MATCH_COSTS 0 // Set to 1 to force all blocks to be uncompressed (raw). #define LZHAM_FORCE_ALL_RAW_BLOCKS 0 namespace lzham { static comp_settings s_level_settings[cCompressionLevelCount] = { // cCompressionLevelFastest { 8, // m_fast_bytes true, // m_fast_adaptive_huffman_updating true, // m_use_polar_codes 1, // m_match_accel_max_matches_per_probe 2, // m_match_accel_max_probes }, // cCompressionLevelFaster { 24, // m_fast_bytes true, // m_fast_adaptive_huffman_updating true, // m_use_polar_codes 6, // m_match_accel_max_matches_per_probe 12, // m_match_accel_max_probes }, // cCompressionLevelDefault { 32, // m_fast_bytes false, // m_fast_adaptive_huffman_updating true, // m_use_polar_codes UINT_MAX, // m_match_accel_max_matches_per_probe 16, // m_match_accel_max_probes }, // cCompressionLevelBetter { 48, // m_fast_bytes false, // m_fast_adaptive_huffman_updating false, // m_use_polar_codes UINT_MAX, // m_match_accel_max_matches_per_probe 32, // m_match_accel_max_probes }, // cCompressionLevelUber { 64, // m_fast_bytes false, // m_fast_adaptive_huffman_updating false, // m_use_polar_codes UINT_MAX, // m_match_accel_max_matches_per_probe cMatchAccelMaxSupportedProbes, // m_match_accel_max_probes } }; lzcompressor::lzcompressor() : m_src_size(-1), m_src_adler32(0), m_step(0), m_block_start_dict_ofs(0), m_block_index(0), m_finished(false), m_num_parse_threads(0), m_parse_jobs_remaining(0), m_block_history_size(0), m_block_history_next(0) { LZHAM_VERIFY( ((uint32_ptr)this & (LZHAM_GET_ALIGNMENT(lzcompressor) - 1)) == 0); } bool lzcompressor::init_seed_bytes() { uint cur_seed_ofs = 0; while (cur_seed_ofs < m_params.m_num_seed_bytes) { uint total_bytes_remaining = m_params.m_num_seed_bytes - cur_seed_ofs; uint num_bytes_to_add = math::minimum(total_bytes_remaining, m_params.m_block_size); if (!m_accel.add_bytes_begin(num_bytes_to_add, static_cast<const uint8*>(m_params.m_pSeed_bytes) + cur_seed_ofs)) return false; m_accel.add_bytes_end(); m_accel.advance_bytes(num_bytes_to_add); cur_seed_ofs += num_bytes_to_add; } return true; } bool lzcompressor::init(const init_params& params) { clear(); if ((params.m_dict_size_log2 < CLZBase::cMinDictSizeLog2) || (params.m_dict_size_log2 > CLZBase::cMaxDictSizeLog2)) return false; if ((params.m_compression_level < 0) || (params.m_compression_level > cCompressionLevelCount)) return false; m_params = params; m_use_task_pool = (m_params.m_pTask_pool) && (m_params.m_pTask_pool->get_num_threads() != 0) && (m_params.m_max_helper_threads > 0); if ((m_params.m_max_helper_threads) && (!m_use_task_pool)) return false; m_settings = s_level_settings[params.m_compression_level]; const uint dict_size = 1U << m_params.m_dict_size_log2; if (params.m_num_seed_bytes) { if (!params.m_pSeed_bytes) return false; if (params.m_num_seed_bytes > dict_size) return false; } if (m_params.m_lzham_compress_flags & LZHAM_COMP_FLAG_FORCE_POLAR_CODING) m_settings.m_use_polar_codes = true; uint max_block_size = dict_size / 8; if (m_params.m_block_size > max_block_size) { m_params.m_block_size = max_block_size; } m_num_parse_threads = 1; #if !LZHAM_FORCE_SINGLE_THREADED_PARSING if (params.m_max_helper_threads > 0) { LZHAM_ASSUME(cMaxParseThreads >= 4); if (m_params.m_block_size < 16384) { m_num_parse_threads = LZHAM_MIN(cMaxParseThreads, params.m_max_helper_threads + 1); } else { if ((params.m_max_helper_threads == 1) || (m_params.m_compression_level == cCompressionLevelFastest)) { m_num_parse_threads = 1; } else if (params.m_max_helper_threads <= 3) { m_num_parse_threads = 2; } else if (params.m_max_helper_threads <= 7) { if ((m_params.m_lzham_compress_flags & LZHAM_COMP_FLAG_EXTREME_PARSING) && (m_params.m_compression_level == cCompressionLevelUber)) m_num_parse_threads = 4; else m_num_parse_threads = 2; } else { // 8-16 m_num_parse_threads = 4; } } } #endif int num_parse_jobs = m_num_parse_threads - 1; uint match_accel_helper_threads = LZHAM_MAX(0, (int)params.m_max_helper_threads - num_parse_jobs); LZHAM_ASSERT(m_num_parse_threads >= 1); LZHAM_ASSERT(m_num_parse_threads <= cMaxParseThreads); if (!m_use_task_pool) { LZHAM_ASSERT(!match_accel_helper_threads && (m_num_parse_threads == 1)); } else { LZHAM_ASSERT((match_accel_helper_threads + (m_num_parse_threads - 1)) <= params.m_max_helper_threads); } if (!m_accel.init(this, params.m_pTask_pool, match_accel_helper_threads, dict_size, m_settings.m_match_accel_max_matches_per_probe, false, m_settings.m_match_accel_max_probes)) return false; init_position_slots(params.m_dict_size_log2); init_slot_tabs(); if (!m_state.init(*this, m_settings.m_fast_adaptive_huffman_updating, m_settings.m_use_polar_codes)) return false; if (!m_block_buf.try_reserve(m_params.m_block_size)) return false; if (!m_comp_buf.try_reserve(m_params.m_block_size*2)) return false; for (uint i = 0; i < m_num_parse_threads; i++) { if (!m_parse_thread_state[i].m_initial_state.init(*this, m_settings.m_fast_adaptive_huffman_updating, m_settings.m_use_polar_codes)) return false; } m_block_history_size = 0; m_block_history_next = 0; if (params.m_num_seed_bytes) { if (!init_seed_bytes()) return false; } if (!send_zlib_header()) return false; m_src_size = 0; return true; } // See http://www.gzip.org/zlib/rfc-zlib.html // Method is set to 14 (LZHAM) and CINFO is (window_size - 15). bool lzcompressor::send_zlib_header() { if ((m_params.m_lzham_compress_flags & LZHAM_COMP_FLAG_WRITE_ZLIB_STREAM) == 0) return true; // set CM (method) and CINFO (dictionary size) fields int cmf = LZHAM_Z_LZHAM | ((m_params.m_dict_size_log2 - 15) << 4); // set FLEVEL by mapping LZHAM's compression level to zlib's int flg = 0; switch (m_params.m_compression_level) { case LZHAM_COMP_LEVEL_FASTEST: { flg = 0 << 6; break; } case LZHAM_COMP_LEVEL_FASTER: { flg = 1 << 6; break; } case LZHAM_COMP_LEVEL_DEFAULT: case LZHAM_COMP_LEVEL_BETTER: { flg = 2 << 6; break; } default: { flg = 3 << 6; break; } } // set FDICT flag if (m_params.m_pSeed_bytes) flg |= 32; int check = ((cmf << 8) + flg) % 31; if (check) flg += (31 - check); LZHAM_ASSERT(0 == (((cmf << 8) + flg) % 31)); if (!m_comp_buf.try_push_back(static_cast<uint8>(cmf))) return false; if (!m_comp_buf.try_push_back(static_cast<uint8>(flg))) return false; if (m_params.m_pSeed_bytes) { // send adler32 of DICT uint dict_adler32 = adler32(m_params.m_pSeed_bytes, m_params.m_num_seed_bytes); for (uint i = 0; i < 4; i++) { if (!m_comp_buf.try_push_back(static_cast<uint8>(dict_adler32 >> 24))) return false; dict_adler32 <<= 8; } } return true; } void lzcompressor::clear() { m_codec.clear(); m_src_size = -1; m_src_adler32 = cInitAdler32; m_block_buf.clear(); m_comp_buf.clear(); m_step = 0; m_finished = false; m_use_task_pool = false; m_block_start_dict_ofs = 0; m_block_index = 0; m_state.clear(); m_num_parse_threads = 0; m_parse_jobs_remaining = 0; for (uint i = 0; i < cMaxParseThreads; i++) { parse_thread_state &parse_state = m_parse_thread_state[i]; parse_state.m_initial_state.clear(); for (uint j = 0; j <= cMaxParseGraphNodes; j++) parse_state.m_nodes[j].clear(); parse_state.m_start_ofs = 0; parse_state.m_bytes_to_match = 0; parse_state.m_best_decisions.clear(); parse_state.m_issue_reset_state_partial = false; parse_state.m_emit_decisions_backwards = false; parse_state.m_failed = false; } m_block_history_size = 0; m_block_history_next = 0; } bool lzcompressor::reset() { if (m_src_size < 0) return false; m_accel.reset(); m_codec.reset(); m_stats.clear(); m_src_size = 0; m_src_adler32 = cInitAdler32; m_block_buf.try_resize(0); m_comp_buf.try_resize(0); m_step = 0; m_finished = false; m_block_start_dict_ofs = 0; m_block_index = 0; m_state.reset(); m_block_history_size = 0; m_block_history_next = 0; if (m_params.m_num_seed_bytes) { if (!init_seed_bytes()) return false; } return send_zlib_header(); } bool lzcompressor::code_decision(lzdecision lzdec, uint& cur_ofs, uint& bytes_to_match) { #ifdef LZHAM_LZDEBUG if (!m_codec.encode_bits(CLZBase::cLZHAMDebugSyncMarkerValue, CLZBase::cLZHAMDebugSyncMarkerBits)) return false; if (!m_codec.encode_bits(lzdec.is_match(), 1)) return false; if (!m_codec.encode_bits(lzdec.get_len(), 17)) return false; if (!m_codec.encode_bits(m_state.m_cur_state, 4)) return false; #endif #ifdef LZHAM_LZVERIFY if (lzdec.is_match()) { uint match_dist = lzdec.get_match_dist(m_state); LZHAM_VERIFY(m_accel[cur_ofs] == m_accel[(cur_ofs - match_dist) & (m_accel.get_max_dict_size() - 1)]); } #endif const uint len = lzdec.get_len(); if (!m_state.encode(m_codec, *this, m_accel, lzdec)) return false; cur_ofs += len; LZHAM_ASSERT(bytes_to_match >= len); bytes_to_match -= len; m_accel.advance_bytes(len); m_step++; return true; } bool lzcompressor::send_sync_block(lzham_flush_t flush_type) { m_codec.reset(); if (!m_codec.start_encoding(128)) return false; #ifdef LZHAM_LZDEBUG if (!m_codec.encode_bits(166, 12)) return false; #endif if (!m_codec.encode_bits(cSyncBlock, cBlockHeaderBits)) return false; int flush_code = 0; switch (flush_type) { case LZHAM_FULL_FLUSH: flush_code = 2; break; case LZHAM_TABLE_FLUSH: flush_code = 1; break; case LZHAM_SYNC_FLUSH: case LZHAM_NO_FLUSH: case LZHAM_FINISH: flush_code = 0; break; } if (!m_codec.encode_bits(flush_code, cBlockFlushTypeBits)) return false; if (!m_codec.encode_align_to_byte()) return false; if (!m_codec.encode_bits(0x0000, 16)) return false; if (!m_codec.encode_bits(0xFFFF, 16)) return false; if (!m_codec.stop_encoding(true)) return false; if (!m_comp_buf.append(m_codec.get_encoding_buf())) return false; m_block_index++; return true; } bool lzcompressor::flush(lzham_flush_t flush_type) { LZHAM_ASSERT(!m_finished); if (m_finished) return false; bool status = true; if (m_block_buf.size()) { status = compress_block(m_block_buf.get_ptr(), m_block_buf.size()); m_block_buf.try_resize(0); } if (status) { status = send_sync_block(flush_type); if (LZHAM_FULL_FLUSH == flush_type) { m_accel.flush(); m_state.reset(); } } lzham_flush_buffered_printf(); return status; } bool lzcompressor::put_bytes(const void* pBuf, uint buf_len) { LZHAM_ASSERT(!m_finished); if (m_finished) return false; bool status = true; if (!pBuf) { // Last block - flush whatever's left and send the final block. if (m_block_buf.size()) { status = compress_block(m_block_buf.get_ptr(), m_block_buf.size()); m_block_buf.try_resize(0); } if (status) { if (!send_final_block()) { status = false; } } m_finished = true; } else { // Compress blocks. const uint8 *pSrcBuf = static_cast<const uint8*>(pBuf); uint num_src_bytes_remaining = buf_len; while (num_src_bytes_remaining) { const uint num_bytes_to_copy = LZHAM_MIN(num_src_bytes_remaining, m_params.m_block_size - m_block_buf.size()); if (num_bytes_to_copy == m_params.m_block_size) { LZHAM_ASSERT(!m_block_buf.size()); // Full-block available - compress in-place. status = compress_block(pSrcBuf, num_bytes_to_copy); } else { // Less than a full block available - append to already accumulated bytes. if (!m_block_buf.append(static_cast<const uint8 *>(pSrcBuf), num_bytes_to_copy)) return false; LZHAM_ASSERT(m_block_buf.size() <= m_params.m_block_size); if (m_block_buf.size() == m_params.m_block_size) { status = compress_block(m_block_buf.get_ptr(), m_block_buf.size()); m_block_buf.try_resize(0); } } if (!status) return false; pSrcBuf += num_bytes_to_copy; num_src_bytes_remaining -= num_bytes_to_copy; } } lzham_flush_buffered_printf(); return status; } bool lzcompressor::send_final_block() { if (!m_codec.start_encoding(16)) return false; #ifdef LZHAM_LZDEBUG if (!m_codec.encode_bits(166, 12)) return false; #endif if (!m_block_index) { if (!send_configuration()) return false; } if (!m_codec.encode_bits(cEOFBlock, cBlockHeaderBits)) return false; if (!m_codec.encode_align_to_byte()) return false; if (!m_codec.encode_bits(m_src_adler32, 32)) return false; if (!m_codec.stop_encoding(true)) return false; if (m_comp_buf.empty()) { m_comp_buf.swap(m_codec.get_encoding_buf()); } else { if (!m_comp_buf.append(m_codec.get_encoding_buf())) return false; } m_block_index++; #if LZHAM_UPDATE_STATS m_stats.print(); #endif return true; } bool lzcompressor::send_configuration() { if (!m_codec.encode_bits(m_settings.m_fast_adaptive_huffman_updating, 1)) return false; if (!m_codec.encode_bits(m_settings.m_use_polar_codes, 1)) return false; return true; } void lzcompressor::node::add_state( int parent_index, int parent_state_index, const lzdecision &lzdec, state &parent_state, bit_cost_t total_cost, uint total_complexity) { state_base trial_state; parent_state.save_partial_state(trial_state); trial_state.partial_advance(lzdec); for (int i = m_num_node_states - 1; i >= 0; i--) { node_state &cur_node_state = m_node_states[i]; if (cur_node_state.m_saved_state == trial_state) { if ( (total_cost < cur_node_state.m_total_cost) || ((total_cost == cur_node_state.m_total_cost) && (total_complexity < cur_node_state.m_total_complexity)) ) { cur_node_state.m_parent_index = static_cast<int16>(parent_index); cur_node_state.m_parent_state_index = static_cast<int8>(parent_state_index); cur_node_state.m_lzdec = lzdec; cur_node_state.m_total_cost = total_cost; cur_node_state.m_total_complexity = total_complexity; while (i > 0) { if ((m_node_states[i].m_total_cost < m_node_states[i - 1].m_total_cost) || ((m_node_states[i].m_total_cost == m_node_states[i - 1].m_total_cost) && (m_node_states[i].m_total_complexity < m_node_states[i - 1].m_total_complexity))) { std::swap(m_node_states[i], m_node_states[i - 1]); i--; } else break; } } return; } } int insert_index; for (insert_index = m_num_node_states; insert_index > 0; insert_index--) { node_state &cur_node_state = m_node_states[insert_index - 1]; if ( (total_cost > cur_node_state.m_total_cost) || ((total_cost == cur_node_state.m_total_cost) && (total_complexity >= cur_node_state.m_total_complexity)) ) { break; } } if (insert_index == cMaxNodeStates) return; uint num_behind = m_num_node_states - insert_index; uint num_to_move = (m_num_node_states < cMaxNodeStates) ? num_behind : (num_behind - 1); if (num_to_move) { LZHAM_ASSERT((insert_index + 1 + num_to_move) <= cMaxNodeStates); memmove( &m_node_states[insert_index + 1], &m_node_states[insert_index], sizeof(node_state) * num_to_move); } node_state *pNew_node_state = &m_node_states[insert_index]; pNew_node_state->m_parent_index = static_cast<int16>(parent_index); pNew_node_state->m_parent_state_index = static_cast<uint8>(parent_state_index); pNew_node_state->m_lzdec = lzdec; pNew_node_state->m_total_cost = total_cost; pNew_node_state->m_total_complexity = total_complexity; pNew_node_state->m_saved_state = trial_state; m_num_node_states = LZHAM_MIN(m_num_node_states + 1, static_cast<uint>(cMaxNodeStates)); #ifdef LZHAM_LZVERIFY for (uint i = 0; i < (m_num_node_states - 1); ++i) { node_state &a = m_node_states[i]; node_state &b = m_node_states[i + 1]; LZHAM_VERIFY( (a.m_total_cost < b.m_total_cost) || ((a.m_total_cost == b.m_total_cost) && (a.m_total_complexity <= b.m_total_complexity)) ); } #endif } // The "extreme" parser tracks the best node::cMaxNodeStates (4) candidate LZ decisions per lookahead character. // This allows the compressor to make locally suboptimal decisions that ultimately result in a better parse. // It assumes the input statistics are locally stationary over the input block to parse. bool lzcompressor::extreme_parse(parse_thread_state &parse_state) { LZHAM_ASSERT(parse_state.m_bytes_to_match <= cMaxParseGraphNodes); parse_state.m_failed = false; parse_state.m_emit_decisions_backwards = true; node *pNodes = parse_state.m_nodes; for (uint i = 0; i <= cMaxParseGraphNodes; i++) { pNodes[i].clear(); } state &approx_state = parse_state.m_initial_state; pNodes[0].m_num_node_states = 1; node_state &first_node_state = pNodes[0].m_node_states[0]; approx_state.save_partial_state(first_node_state.m_saved_state); first_node_state.m_parent_index = -1; first_node_state.m_parent_state_index = -1; first_node_state.m_total_cost = 0; first_node_state.m_total_complexity = 0; const uint bytes_to_parse = parse_state.m_bytes_to_match; const uint lookahead_start_ofs = m_accel.get_lookahead_pos() & m_accel.get_max_dict_size_mask(); uint cur_dict_ofs = parse_state.m_start_ofs; uint cur_lookahead_ofs = cur_dict_ofs - lookahead_start_ofs; uint cur_node_index = 0; enum { cMaxFullMatches = cMatchAccelMaxSupportedProbes }; uint match_lens[cMaxFullMatches]; uint match_distances[cMaxFullMatches]; bit_cost_t lzdec_bitcosts[cMaxMatchLen + 1]; node prev_lit_node; prev_lit_node.clear(); while (cur_node_index < bytes_to_parse) { node* pCur_node = &pNodes[cur_node_index]; const uint max_admissable_match_len = LZHAM_MIN(static_cast<uint>(CLZBase::cMaxMatchLen), bytes_to_parse - cur_node_index); const uint find_dict_size = m_accel.get_cur_dict_size() + cur_lookahead_ofs; const uint lit_pred0 = approx_state.get_pred_char(m_accel, cur_dict_ofs, 1); const uint8* pLookahead = &m_accel.m_dict[cur_dict_ofs]; // full matches uint max_full_match_len = 0; uint num_full_matches = 0; uint len2_match_dist = 0; if (max_admissable_match_len >= CLZBase::cMinMatchLen) { const dict_match* pMatches = m_accel.find_matches(cur_lookahead_ofs); if (pMatches) { for ( ; ; ) { uint match_len = pMatches->get_len(); LZHAM_ASSERT((pMatches->get_dist() > 0) && (pMatches->get_dist() <= m_dict_size)); match_len = LZHAM_MIN(match_len, max_admissable_match_len); if (match_len > max_full_match_len) { max_full_match_len = match_len; match_lens[num_full_matches] = match_len; match_distances[num_full_matches] = pMatches->get_dist(); num_full_matches++; } if (pMatches->is_last()) break; pMatches++; } } len2_match_dist = m_accel.get_len2_match(cur_lookahead_ofs); } for (uint cur_node_state_index = 0; cur_node_state_index < pCur_node->m_num_node_states; cur_node_state_index++) { node_state &cur_node_state = pCur_node->m_node_states[cur_node_state_index]; if (cur_node_index) { LZHAM_ASSERT(cur_node_state.m_parent_index >= 0); approx_state.restore_partial_state(cur_node_state.m_saved_state); } uint is_match_model_index = LZHAM_IS_MATCH_MODEL_INDEX(lit_pred0, approx_state.m_cur_state); const bit_cost_t cur_node_total_cost = cur_node_state.m_total_cost; const uint cur_node_total_complexity = cur_node_state.m_total_complexity; // rep matches uint match_hist_max_len = 0; uint match_hist_min_match_len = 1; for (uint rep_match_index = 0; rep_match_index < cMatchHistSize; rep_match_index++) { uint hist_match_len = 0; uint dist = approx_state.m_match_hist[rep_match_index]; if (dist <= find_dict_size) { const uint comp_pos = static_cast<uint>((m_accel.m_lookahead_pos + cur_lookahead_ofs - dist) & m_accel.m_max_dict_size_mask); const uint8* pComp = &m_accel.m_dict[comp_pos]; for (hist_match_len = 0; hist_match_len < max_admissable_match_len; hist_match_len++) if (pComp[hist_match_len] != pLookahead[hist_match_len]) break; } if (hist_match_len >= match_hist_min_match_len) { match_hist_max_len = math::maximum(match_hist_max_len, hist_match_len); approx_state.get_rep_match_costs(cur_dict_ofs, lzdec_bitcosts, rep_match_index, match_hist_min_match_len, hist_match_len, is_match_model_index); uint rep_match_total_complexity = cur_node_total_complexity + (cRep0Complexity + rep_match_index); for (uint l = match_hist_min_match_len; l <= hist_match_len; l++) { #if LZHAM_VERIFY_MATCH_COSTS { lzdecision actual_dec(cur_dict_ofs, l, -((int)rep_match_index + 1)); bit_cost_t actual_cost = approx_state.get_cost(*this, m_accel, actual_dec); LZHAM_ASSERT(actual_cost == lzdec_bitcosts[l]); } #endif node& dst_node = pCur_node[l]; bit_cost_t rep_match_total_cost = cur_node_total_cost + lzdec_bitcosts[l]; dst_node.add_state(cur_node_index, cur_node_state_index, lzdecision(cur_dict_ofs, l, -((int)rep_match_index + 1)), approx_state, rep_match_total_cost, rep_match_total_complexity); } } match_hist_min_match_len = CLZBase::cMinMatchLen; } uint min_truncate_match_len = match_hist_max_len; // nearest len2 match if (len2_match_dist) { lzdecision lzdec(cur_dict_ofs, 2, len2_match_dist); bit_cost_t actual_cost = approx_state.get_cost(*this, m_accel, lzdec); pCur_node[2].add_state(cur_node_index, cur_node_state_index, lzdec, approx_state, cur_node_total_cost + actual_cost, cur_node_total_complexity + cShortMatchComplexity); min_truncate_match_len = LZHAM_MAX(min_truncate_match_len, 2); } // full matches if (max_full_match_len > min_truncate_match_len) { uint prev_max_match_len = LZHAM_MAX(1, min_truncate_match_len); for (uint full_match_index = 0; full_match_index < num_full_matches; full_match_index++) { uint end_len = match_lens[full_match_index]; if (end_len <= min_truncate_match_len) continue; uint start_len = prev_max_match_len + 1; uint match_dist = match_distances[full_match_index]; LZHAM_ASSERT(start_len <= end_len); approx_state.get_full_match_costs(*this, cur_dict_ofs, lzdec_bitcosts, match_dist, start_len, end_len, is_match_model_index); for (uint l = start_len; l <= end_len; l++) { uint match_complexity = (l >= cLongMatchComplexityLenThresh) ? cLongMatchComplexity : cShortMatchComplexity; #if LZHAM_VERIFY_MATCH_COSTS { lzdecision actual_dec(cur_dict_ofs, l, match_dist); bit_cost_t actual_cost = approx_state.get_cost(*this, m_accel, actual_dec); LZHAM_ASSERT(actual_cost == lzdec_bitcosts[l]); } #endif node& dst_node = pCur_node[l]; bit_cost_t match_total_cost = cur_node_total_cost + lzdec_bitcosts[l]; uint match_total_complexity = cur_node_total_complexity + match_complexity; dst_node.add_state( cur_node_index, cur_node_state_index, lzdecision(cur_dict_ofs, l, match_dist), approx_state, match_total_cost, match_total_complexity); } prev_max_match_len = end_len; } } // literal bit_cost_t lit_cost = approx_state.get_lit_cost(m_accel, cur_dict_ofs, lit_pred0, is_match_model_index); bit_cost_t lit_total_cost = cur_node_total_cost + lit_cost; uint lit_total_complexity = cur_node_total_complexity + cLitComplexity; #if LZHAM_VERIFY_MATCH_COSTS { lzdecision actual_dec(cur_dict_ofs, 0, 0); bit_cost_t actual_cost = approx_state.get_cost(*this, m_accel, actual_dec); LZHAM_ASSERT(actual_cost == lit_cost); } #endif pCur_node[1].add_state( cur_node_index, cur_node_state_index, lzdecision(cur_dict_ofs, 0, 0), approx_state, lit_total_cost, lit_total_complexity); } // cur_node_state_index cur_dict_ofs++; cur_lookahead_ofs++; cur_node_index++; } // Now get the optimal decisions by starting from the goal node. // m_best_decisions is filled backwards. if (!parse_state.m_best_decisions.try_reserve(bytes_to_parse)) { parse_state.m_failed = true; return false; } bit_cost_t lowest_final_cost = cBitCostMax; //math::cNearlyInfinite; int node_state_index = 0; node_state *pLast_node_states = pNodes[bytes_to_parse].m_node_states; for (uint i = 0; i < pNodes[bytes_to_parse].m_num_node_states; i++) { if (pLast_node_states[i].m_total_cost < lowest_final_cost) { lowest_final_cost = pLast_node_states[i].m_total_cost; node_state_index = i; } } int node_index = bytes_to_parse; lzdecision *pDst_dec = parse_state.m_best_decisions.get_ptr(); do { LZHAM_ASSERT((node_index >= 0) && (node_index <= (int)cMaxParseGraphNodes)); node& cur_node = pNodes[node_index]; const node_state &cur_node_state = cur_node.m_node_states[node_state_index]; *pDst_dec++ = cur_node_state.m_lzdec; node_index = cur_node_state.m_parent_index; node_state_index = cur_node_state.m_parent_state_index; } while (node_index > 0); parse_state.m_best_decisions.try_resize(static_cast<uint>(pDst_dec - parse_state.m_best_decisions.get_ptr())); return true; } // Parsing notes: // The regular "optimal" parser only tracks the single cheapest candidate LZ decision per lookahead character. // This function finds the shortest path through an extremely dense node graph using a streamlined/simplified Dijkstra's algorithm with some coding heuristics. // Graph edges are LZ "decisions", cost is measured in fractional bits needed to code each graph edge, and graph nodes are lookahead characters. // There is no need to track visited/unvisted nodes, or find the next cheapest unvisted node in each iteration. The search always proceeds sequentially, visiting each lookahead character in turn from left/right. // The major CPU expense of this function is the complexity of LZ decision cost evaluation, so a lot of implementation effort is spent here reducing this overhead. // To simplify the problem, it assumes the input statistics are locally stationary over the input block to parse. (Otherwise, it would need to store, track, and update // unique symbol statistics for each lookahead character, which would be very costly.) // This function always sequentially pushes "forward" the unvisited node horizon. This horizon frequently collapses to a single node, which guarantees that the shortest path through the // graph must pass through this node. LZMA tracks cumulative bitprices relative to this node, while LZHAM currently always tracks cumulative bitprices relative to the first node in the lookahead buffer. // In very early versions of LZHAM the parse was much more understandable (straight Dijkstra with almost no bit price optimizations or coding heuristics). bool lzcompressor::optimal_parse(parse_thread_state &parse_state) { LZHAM_ASSERT(parse_state.m_bytes_to_match <= cMaxParseGraphNodes); parse_state.m_failed = false; parse_state.m_emit_decisions_backwards = true; node_state *pNodes = reinterpret_cast<node_state*>(parse_state.m_nodes); pNodes[0].m_parent_index = -1; pNodes[0].m_total_cost = 0; pNodes[0].m_total_complexity = 0; #if 0 for (uint i = 1; i <= cMaxParseGraphNodes; i++) { pNodes[i].clear(); } #else memset( &pNodes[1], 0xFF, cMaxParseGraphNodes * sizeof(node_state)); #endif state &approx_state = parse_state.m_initial_state; const uint bytes_to_parse = parse_state.m_bytes_to_match; const uint lookahead_start_ofs = m_accel.get_lookahead_pos() & m_accel.get_max_dict_size_mask(); uint cur_dict_ofs = parse_state.m_start_ofs; uint cur_lookahead_ofs = cur_dict_ofs - lookahead_start_ofs; uint cur_node_index = 0; enum { cMaxFullMatches = cMatchAccelMaxSupportedProbes }; uint match_lens[cMaxFullMatches]; uint match_distances[cMaxFullMatches]; bit_cost_t lzdec_bitcosts[cMaxMatchLen + 1]; while (cur_node_index < bytes_to_parse) { node_state* pCur_node = &pNodes[cur_node_index]; const uint max_admissable_match_len = LZHAM_MIN(static_cast<uint>(CLZBase::cMaxMatchLen), bytes_to_parse - cur_node_index); const uint find_dict_size = m_accel.m_cur_dict_size + cur_lookahead_ofs; if (cur_node_index) { LZHAM_ASSERT(pCur_node->m_parent_index >= 0); // Move to this node's state using the lowest cost LZ decision found. approx_state.restore_partial_state(pCur_node->m_saved_state); approx_state.partial_advance(pCur_node->m_lzdec); } const bit_cost_t cur_node_total_cost = pCur_node->m_total_cost; // This assert includes a fudge factor - make sure we don't overflow our scaled costs. LZHAM_ASSERT((cBitCostMax - cur_node_total_cost) > (cBitCostScale * 64)); const uint cur_node_total_complexity = pCur_node->m_total_complexity; const uint lit_pred0 = approx_state.get_pred_char(m_accel, cur_dict_ofs, 1); uint is_match_model_index = LZHAM_IS_MATCH_MODEL_INDEX(lit_pred0, approx_state.m_cur_state); const uint8* pLookahead = &m_accel.m_dict[cur_dict_ofs]; // rep matches uint match_hist_max_len = 0; uint match_hist_min_match_len = 1; for (uint rep_match_index = 0; rep_match_index < cMatchHistSize; rep_match_index++) { uint hist_match_len = 0; uint dist = approx_state.m_match_hist[rep_match_index]; if (dist <= find_dict_size) { const uint comp_pos = static_cast<uint>((m_accel.m_lookahead_pos + cur_lookahead_ofs - dist) & m_accel.m_max_dict_size_mask); const uint8* pComp = &m_accel.m_dict[comp_pos]; for (hist_match_len = 0; hist_match_len < max_admissable_match_len; hist_match_len++) if (pComp[hist_match_len] != pLookahead[hist_match_len]) break; } if (hist_match_len >= match_hist_min_match_len) { match_hist_max_len = math::maximum(match_hist_max_len, hist_match_len); approx_state.get_rep_match_costs(cur_dict_ofs, lzdec_bitcosts, rep_match_index, match_hist_min_match_len, hist_match_len, is_match_model_index); uint rep_match_total_complexity = cur_node_total_complexity + (cRep0Complexity + rep_match_index); for (uint l = match_hist_min_match_len; l <= hist_match_len; l++) { #if LZHAM_VERIFY_MATCH_COSTS { lzdecision actual_dec(cur_dict_ofs, l, -((int)rep_match_index + 1)); bit_cost_t actual_cost = approx_state.get_cost(*this, m_accel, actual_dec); LZHAM_ASSERT(actual_cost == lzdec_bitcosts[l]); } #endif node_state& dst_node = pCur_node[l]; bit_cost_t rep_match_total_cost = cur_node_total_cost + lzdec_bitcosts[l]; if ((rep_match_total_cost > dst_node.m_total_cost) || ((rep_match_total_cost == dst_node.m_total_cost) && (rep_match_total_complexity >= dst_node.m_total_complexity))) continue; dst_node.m_total_cost = rep_match_total_cost; dst_node.m_total_complexity = rep_match_total_complexity; dst_node.m_parent_index = (uint16)cur_node_index; approx_state.save_partial_state(dst_node.m_saved_state); dst_node.m_lzdec.init(cur_dict_ofs, l, -((int)rep_match_index + 1)); dst_node.m_lzdec.m_len = l; } } match_hist_min_match_len = CLZBase::cMinMatchLen; } uint max_match_len = match_hist_max_len; if (max_match_len >= m_settings.m_fast_bytes) { cur_dict_ofs += max_match_len; cur_lookahead_ofs += max_match_len; cur_node_index += max_match_len; continue; } // full matches if (max_admissable_match_len >= CLZBase::cMinMatchLen) { uint num_full_matches = 0; if (match_hist_max_len < 2) { // Get the nearest len2 match if we didn't find a rep len2. uint len2_match_dist = m_accel.get_len2_match(cur_lookahead_ofs); if (len2_match_dist) { bit_cost_t cost = approx_state.get_len2_match_cost(*this, cur_dict_ofs, len2_match_dist, is_match_model_index); #if LZHAM_VERIFY_MATCH_COSTS { lzdecision actual_dec(cur_dict_ofs, 2, len2_match_dist); bit_cost_t actual_cost = approx_state.get_cost(*this, m_accel, actual_dec); LZHAM_ASSERT(actual_cost == cost); } #endif node_state& dst_node = pCur_node[2]; bit_cost_t match_total_cost = cur_node_total_cost + cost; uint match_total_complexity = cur_node_total_complexity + cShortMatchComplexity; if ((match_total_cost < dst_node.m_total_cost) || ((match_total_cost == dst_node.m_total_cost) && (match_total_complexity < dst_node.m_total_complexity))) { dst_node.m_total_cost = match_total_cost; dst_node.m_total_complexity = match_total_complexity; dst_node.m_parent_index = (uint16)cur_node_index; approx_state.save_partial_state(dst_node.m_saved_state); dst_node.m_lzdec.init(cur_dict_ofs, 2, len2_match_dist); } max_match_len = 2; } } const uint min_truncate_match_len = max_match_len; // Now get all full matches: the nearest matches at each match length. (Actually, we don't // always get the nearest match. The match finder favors those matches which have the lowest value // in the nibble of each match distance, all other things being equal, to help exploit how the lowest // nibble of match distances is separately coded.) const dict_match* pMatches = m_accel.find_matches(cur_lookahead_ofs); if (pMatches) { for ( ; ; ) { uint match_len = pMatches->get_len(); LZHAM_ASSERT((pMatches->get_dist() > 0) && (pMatches->get_dist() <= m_dict_size)); match_len = LZHAM_MIN(match_len, max_admissable_match_len); if (match_len > max_match_len) { max_match_len = match_len; match_lens[num_full_matches] = match_len; match_distances[num_full_matches] = pMatches->get_dist(); num_full_matches++; } if (pMatches->is_last()) break; pMatches++; } } if (num_full_matches) { uint prev_max_match_len = LZHAM_MAX(1, min_truncate_match_len); for (uint full_match_index = 0; full_match_index < num_full_matches; full_match_index++) { uint start_len = prev_max_match_len + 1; uint end_len = match_lens[full_match_index]; uint match_dist = match_distances[full_match_index]; LZHAM_ASSERT(start_len <= end_len); approx_state.get_full_match_costs(*this, cur_dict_ofs, lzdec_bitcosts, match_dist, start_len, end_len, is_match_model_index); for (uint l = start_len; l <= end_len; l++) { uint match_complexity = (l >= cLongMatchComplexityLenThresh) ? cLongMatchComplexity : cShortMatchComplexity; #if LZHAM_VERIFY_MATCH_COSTS { lzdecision actual_dec(cur_dict_ofs, l, match_dist); bit_cost_t actual_cost = approx_state.get_cost(*this, m_accel, actual_dec); LZHAM_ASSERT(actual_cost == lzdec_bitcosts[l]); } #endif node_state& dst_node = pCur_node[l]; bit_cost_t match_total_cost = cur_node_total_cost + lzdec_bitcosts[l]; uint match_total_complexity = cur_node_total_complexity + match_complexity; if ((match_total_cost > dst_node.m_total_cost) || ((match_total_cost == dst_node.m_total_cost) && (match_total_complexity >= dst_node.m_total_complexity))) continue; dst_node.m_total_cost = match_total_cost; dst_node.m_total_complexity = match_total_complexity; dst_node.m_parent_index = (uint16)cur_node_index; approx_state.save_partial_state(dst_node.m_saved_state); dst_node.m_lzdec.init(cur_dict_ofs, l, match_dist); } prev_max_match_len = end_len; } } } if (max_match_len >= m_settings.m_fast_bytes) { cur_dict_ofs += max_match_len; cur_lookahead_ofs += max_match_len; cur_node_index += max_match_len; continue; } // literal bit_cost_t lit_cost = approx_state.get_lit_cost(m_accel, cur_dict_ofs, lit_pred0, is_match_model_index); bit_cost_t lit_total_cost = cur_node_total_cost + lit_cost; uint lit_total_complexity = cur_node_total_complexity + cLitComplexity; #if LZHAM_VERIFY_MATCH_COSTS { lzdecision actual_dec(cur_dict_ofs, 0, 0); bit_cost_t actual_cost = approx_state.get_cost(*this, m_accel, actual_dec); LZHAM_ASSERT(actual_cost == lit_cost); } #endif if ((lit_total_cost < pCur_node[1].m_total_cost) || ((lit_total_cost == pCur_node[1].m_total_cost) && (lit_total_complexity < pCur_node[1].m_total_complexity))) { pCur_node[1].m_total_cost = lit_total_cost; pCur_node[1].m_total_complexity = lit_total_complexity; pCur_node[1].m_parent_index = (int16)cur_node_index; approx_state.save_partial_state(pCur_node[1].m_saved_state); pCur_node[1].m_lzdec.init(cur_dict_ofs, 0, 0); } cur_dict_ofs++; cur_lookahead_ofs++; cur_node_index++; } // graph search // Now get the optimal decisions by starting from the goal node. // m_best_decisions is filled backwards. if (!parse_state.m_best_decisions.try_reserve(bytes_to_parse)) { parse_state.m_failed = true; return false; } int node_index = bytes_to_parse; lzdecision *pDst_dec = parse_state.m_best_decisions.get_ptr(); do { LZHAM_ASSERT((node_index >= 0) && (node_index <= (int)cMaxParseGraphNodes)); node_state& cur_node = pNodes[node_index]; *pDst_dec++ = cur_node.m_lzdec; node_index = cur_node.m_parent_index; } while (node_index > 0); parse_state.m_best_decisions.try_resize(static_cast<uint>(pDst_dec - parse_state.m_best_decisions.get_ptr())); return true; } void lzcompressor::parse_job_callback(uint64 data, void* pData_ptr) { const uint parse_job_index = (uint)data; scoped_perf_section parse_job_timer(cVarArgs, "parse_job_callback %u", parse_job_index); (void)pData_ptr; parse_thread_state &parse_state = m_parse_thread_state[parse_job_index]; if ((m_params.m_lzham_compress_flags & LZHAM_COMP_FLAG_EXTREME_PARSING) && (m_params.m_compression_level == cCompressionLevelUber)) extreme_parse(parse_state); else optimal_parse(parse_state); LZHAM_MEMORY_EXPORT_BARRIER if (atomic_decrement32(&m_parse_jobs_remaining) == 0) { m_parse_jobs_complete.release(); } } // ofs is the absolute dictionary offset, must be >= the lookahead offset. // TODO: Doesn't find len2 matches int lzcompressor::enumerate_lz_decisions(uint ofs, const state& cur_state, lzham::vector<lzpriced_decision>& decisions, uint min_match_len, uint max_match_len) { LZHAM_ASSERT(min_match_len >= 1); uint start_ofs = m_accel.get_lookahead_pos() & m_accel.get_max_dict_size_mask(); LZHAM_ASSERT(ofs >= start_ofs); const uint lookahead_ofs = ofs - start_ofs; uint largest_index = 0; uint largest_len; bit_cost_t largest_cost; if (min_match_len <= 1) { if (!decisions.try_resize(1)) return -1; lzpriced_decision& lit_dec = decisions[0]; lit_dec.init(ofs, 0, 0, 0); lit_dec.m_cost = cur_state.get_cost(*this, m_accel, lit_dec); largest_cost = lit_dec.m_cost; largest_len = 1; } else { if (!decisions.try_resize(0)) return -1; largest_len = 0; largest_cost = cBitCostMax; } uint match_hist_max_len = 0; // Add rep matches. for (uint i = 0; i < cMatchHistSize; i++) { uint hist_match_len = m_accel.get_match_len(lookahead_ofs, cur_state.m_match_hist[i], max_match_len); if (hist_match_len < min_match_len) continue; if ( ((hist_match_len == 1) && (i == 0)) || (hist_match_len >= CLZBase::cMinMatchLen) ) { match_hist_max_len = math::maximum(match_hist_max_len, hist_match_len); lzpriced_decision dec(ofs, hist_match_len, -((int)i + 1)); dec.m_cost = cur_state.get_cost(*this, m_accel, dec); if (!decisions.try_push_back(dec)) return -1; if ( (hist_match_len > largest_len) || ((hist_match_len == largest_len) && (dec.m_cost < largest_cost)) ) { largest_index = decisions.size() - 1; largest_len = hist_match_len; largest_cost = dec.m_cost; } } } // Now add full matches. if ((max_match_len >= CLZBase::cMinMatchLen) && (match_hist_max_len < m_settings.m_fast_bytes)) { const dict_match* pMatches = m_accel.find_matches(lookahead_ofs); if (pMatches) { for ( ; ; ) { uint match_len = math::minimum(pMatches->get_len(), max_match_len); LZHAM_ASSERT((pMatches->get_dist() > 0) && (pMatches->get_dist() <= m_dict_size)); // Full matches are very likely to be more expensive than rep matches of the same length, so don't bother evaluating them. if ((match_len >= min_match_len) && (match_len > match_hist_max_len)) { if ((max_match_len > CLZBase::cMaxMatchLen) && (match_len == CLZBase::cMaxMatchLen)) { match_len = m_accel.get_match_len(lookahead_ofs, pMatches->get_dist(), max_match_len, CLZBase::cMaxMatchLen); } lzpriced_decision dec(ofs, match_len, pMatches->get_dist()); dec.m_cost = cur_state.get_cost(*this, m_accel, dec); if (!decisions.try_push_back(dec)) return -1; if ( (match_len > largest_len) || ((match_len == largest_len) && (dec.get_cost() < largest_cost)) ) { largest_index = decisions.size() - 1; largest_len = match_len; largest_cost = dec.get_cost(); } } if (pMatches->is_last()) break; pMatches++; } } } return largest_index; } bool lzcompressor::greedy_parse(parse_thread_state &parse_state) { parse_state.m_failed = true; parse_state.m_emit_decisions_backwards = false; const uint bytes_to_parse = parse_state.m_bytes_to_match; const uint lookahead_start_ofs = m_accel.get_lookahead_pos() & m_accel.get_max_dict_size_mask(); uint cur_dict_ofs = parse_state.m_start_ofs; uint cur_lookahead_ofs = cur_dict_ofs - lookahead_start_ofs; uint cur_ofs = 0; state &approx_state = parse_state.m_initial_state; lzham::vector<lzpriced_decision> &decisions = parse_state.m_temp_decisions; if (!decisions.try_reserve(384)) return false; if (!parse_state.m_best_decisions.try_resize(0)) return false; while (cur_ofs < bytes_to_parse) { const uint max_admissable_match_len = LZHAM_MIN(static_cast<uint>(CLZBase::cMaxHugeMatchLen), bytes_to_parse - cur_ofs); int largest_dec_index = enumerate_lz_decisions(cur_dict_ofs, approx_state, decisions, 1, max_admissable_match_len); if (largest_dec_index < 0) return false; const lzpriced_decision &dec = decisions[largest_dec_index]; if (!parse_state.m_best_decisions.try_push_back(dec)) return false; approx_state.partial_advance(dec); uint match_len = dec.get_len(); LZHAM_ASSERT(match_len <= max_admissable_match_len); cur_dict_ofs += match_len; cur_lookahead_ofs += match_len; cur_ofs += match_len; if (parse_state.m_best_decisions.size() >= parse_state.m_max_greedy_decisions) { parse_state.m_greedy_parse_total_bytes_coded = cur_ofs; parse_state.m_greedy_parse_gave_up = true; return false; } } parse_state.m_greedy_parse_total_bytes_coded = cur_ofs; LZHAM_ASSERT(cur_ofs == bytes_to_parse); parse_state.m_failed = false; return true; } bool lzcompressor::compress_block(const void* pBuf, uint buf_len) { uint cur_ofs = 0; uint bytes_remaining = buf_len; while (bytes_remaining) { uint bytes_to_compress = math::minimum(m_accel.get_max_add_bytes(), bytes_remaining); if (!compress_block_internal(static_cast<const uint8*>(pBuf) + cur_ofs, bytes_to_compress)) return false; cur_ofs += bytes_to_compress; bytes_remaining -= bytes_to_compress; } return true; } void lzcompressor::update_block_history(uint comp_size, uint src_size, uint ratio, bool raw_block, bool reset_update_rate) { block_history& cur_block_history = m_block_history[m_block_history_next]; m_block_history_next++; m_block_history_next %= cMaxBlockHistorySize; cur_block_history.m_comp_size = comp_size; cur_block_history.m_src_size = src_size; cur_block_history.m_ratio = ratio; cur_block_history.m_raw_block = raw_block; cur_block_history.m_reset_update_rate = reset_update_rate; m_block_history_size = LZHAM_MIN(m_block_history_size + 1, static_cast<uint>(cMaxBlockHistorySize)); } uint lzcompressor::get_recent_block_ratio() { if (!m_block_history_size) return 0; uint64 total_scaled_ratio = 0; for (uint i = 0; i < m_block_history_size; i++) total_scaled_ratio += m_block_history[i].m_ratio; total_scaled_ratio /= m_block_history_size; return static_cast<uint>(total_scaled_ratio); } uint lzcompressor::get_min_block_ratio() { if (!m_block_history_size) return 0; uint min_scaled_ratio = UINT_MAX; for (uint i = 0; i < m_block_history_size; i++) min_scaled_ratio = LZHAM_MIN(m_block_history[i].m_ratio, min_scaled_ratio); return min_scaled_ratio; } uint lzcompressor::get_max_block_ratio() { if (!m_block_history_size) return 0; uint max_scaled_ratio = 0; for (uint i = 0; i < m_block_history_size; i++) max_scaled_ratio = LZHAM_MAX(m_block_history[i].m_ratio, max_scaled_ratio); return max_scaled_ratio; } uint lzcompressor::get_total_recent_reset_update_rate() { uint total_resets = 0; for (uint i = 0; i < m_block_history_size; i++) total_resets += m_block_history[i].m_reset_update_rate; return total_resets; } bool lzcompressor::compress_block_internal(const void* pBuf, uint buf_len) { scoped_perf_section compress_block_timer(cVarArgs, "****** compress_block %u", m_block_index); LZHAM_ASSERT(pBuf); LZHAM_ASSERT(buf_len <= m_params.m_block_size); LZHAM_ASSERT(m_src_size >= 0); if (m_src_size < 0) return false; m_src_size += buf_len; // Important: Don't do any expensive work until after add_bytes_begin() is called, to increase parallelism. if (!m_accel.add_bytes_begin(buf_len, static_cast<const uint8*>(pBuf))) return false; m_start_of_block_state = m_state; m_src_adler32 = adler32(pBuf, buf_len, m_src_adler32); m_block_start_dict_ofs = m_accel.get_lookahead_pos() & (m_accel.get_max_dict_size() - 1); uint cur_dict_ofs = m_block_start_dict_ofs; uint bytes_to_match = buf_len; if (!m_codec.start_encoding((buf_len * 9) / 8)) return false; if (!m_block_index) { if (!send_configuration()) return false; } #ifdef LZHAM_LZDEBUG m_codec.encode_bits(166, 12); #endif if (!m_codec.encode_bits(cCompBlock, cBlockHeaderBits)) return false; if (!m_codec.encode_arith_init()) return false; m_state.start_of_block(m_accel, cur_dict_ofs, m_block_index); bool emit_reset_update_rate_command = false; // Determine if it makes sense to reset the Huffman table update frequency back to their initial (maximum) rates. if ((m_block_history_size) && (m_params.m_lzham_compress_flags & LZHAM_COMP_FLAG_TRADEOFF_DECOMPRESSION_RATE_FOR_COMP_RATIO)) { const block_history& prev_block_history = m_block_history[m_block_history_next ? (m_block_history_next - 1) : (cMaxBlockHistorySize - 1)]; if (prev_block_history.m_raw_block) emit_reset_update_rate_command = true; else if (get_total_recent_reset_update_rate() == 0) { if (get_recent_block_ratio() > (cBlockHistoryCompRatioScale * 95U / 100U)) emit_reset_update_rate_command = true; else { uint recent_min_block_ratio = get_min_block_ratio(); //uint recent_max_block_ratio = get_max_block_ratio(); // Compression ratio has recently dropped quite a bit - slam the table update rates back up. if (prev_block_history.m_ratio > (recent_min_block_ratio * 3U) / 2U) { //printf("Emitting reset: %u %u\n", prev_block_history.m_ratio, recent_min_block_ratio); emit_reset_update_rate_command = true; } } } } if (emit_reset_update_rate_command) m_state.reset_update_rate(); m_codec.encode_bits(emit_reset_update_rate_command ? 1 : 0, cBlockFlushTypeBits); coding_stats initial_stats(m_stats); uint initial_step = m_step; while (bytes_to_match) { const uint cAvgAcceptableGreedyMatchLen = 384; if ((m_params.m_pSeed_bytes) && (bytes_to_match >= cAvgAcceptableGreedyMatchLen)) { parse_thread_state &greedy_parse_state = m_parse_thread_state[cMaxParseThreads]; greedy_parse_state.m_initial_state = m_state; greedy_parse_state.m_initial_state.m_cur_ofs = cur_dict_ofs; greedy_parse_state.m_issue_reset_state_partial = false; greedy_parse_state.m_start_ofs = cur_dict_ofs; greedy_parse_state.m_bytes_to_match = LZHAM_MIN(bytes_to_match, static_cast<uint>(CLZBase::cMaxHugeMatchLen)); greedy_parse_state.m_max_greedy_decisions = LZHAM_MAX((bytes_to_match / cAvgAcceptableGreedyMatchLen), 2); greedy_parse_state.m_greedy_parse_gave_up = false; greedy_parse_state.m_greedy_parse_total_bytes_coded = 0; if (!greedy_parse(greedy_parse_state)) { if (!greedy_parse_state.m_greedy_parse_gave_up) return false; } uint num_greedy_decisions_to_code = 0; const lzham::vector<lzdecision> &best_decisions = greedy_parse_state.m_best_decisions; if (!greedy_parse_state.m_greedy_parse_gave_up) num_greedy_decisions_to_code = best_decisions.size(); else { uint num_small_decisions = 0; uint total_match_len = 0; uint max_match_len = 0; uint i; for (i = 0; i < best_decisions.size(); i++) { const lzdecision &dec = best_decisions[i]; if (dec.get_len() <= CLZBase::cMaxMatchLen) { num_small_decisions++; if (num_small_decisions > 16) break; } total_match_len += dec.get_len(); max_match_len = LZHAM_MAX(max_match_len, dec.get_len()); } if (max_match_len > CLZBase::cMaxMatchLen) { if ((total_match_len / i) >= cAvgAcceptableGreedyMatchLen) { num_greedy_decisions_to_code = i; } } } if (num_greedy_decisions_to_code) { for (uint i = 0; i < num_greedy_decisions_to_code; i++) { LZHAM_ASSERT(i < (uint)best_decisions.size()); LZHAM_ASSERT(best_decisions[i].m_pos == (int)cur_dict_ofs); #if LZHAM_UPDATE_STATS bit_cost_t cost = m_state.get_cost(*this, m_accel, best_decisions[i]); m_stats.update(best_decisions[i], m_state, m_accel, cost); #endif if (!code_decision(best_decisions[i], cur_dict_ofs, bytes_to_match)) return false; } if ((!greedy_parse_state.m_greedy_parse_gave_up) || (!bytes_to_match)) continue; } } uint num_parse_jobs = LZHAM_MIN(m_num_parse_threads, (bytes_to_match + cMaxParseGraphNodes - 1) / cMaxParseGraphNodes); if ((m_params.m_lzham_compress_flags & LZHAM_COMP_FLAG_DETERMINISTIC_PARSING) == 0) { if (m_use_task_pool && m_accel.get_max_helper_threads()) { // Increase the number of active parse jobs as the match finder finishes up to keep CPU utilization up. num_parse_jobs += m_accel.get_num_completed_helper_threads(); num_parse_jobs = LZHAM_MIN(num_parse_jobs, cMaxParseThreads); } } if (bytes_to_match < 1536) num_parse_jobs = 1; // Reduce block size near the beginning of the file so statistical models get going a bit faster. bool force_small_block = false; if ((!m_block_index) && ((cur_dict_ofs - m_block_start_dict_ofs) < cMaxParseGraphNodes)) { num_parse_jobs = 1; force_small_block = true; } uint parse_thread_start_ofs = cur_dict_ofs; uint parse_thread_total_size = LZHAM_MIN(bytes_to_match, cMaxParseGraphNodes * num_parse_jobs); if (force_small_block) { parse_thread_total_size = LZHAM_MIN(parse_thread_total_size, 1536); } uint parse_thread_remaining = parse_thread_total_size; for (uint parse_thread_index = 0; parse_thread_index < num_parse_jobs; parse_thread_index++) { parse_thread_state &parse_thread = m_parse_thread_state[parse_thread_index]; parse_thread.m_initial_state = m_state; parse_thread.m_initial_state.m_cur_ofs = parse_thread_start_ofs; if (parse_thread_index > 0) { parse_thread.m_initial_state.reset_state_partial(); parse_thread.m_issue_reset_state_partial = true; } else { parse_thread.m_issue_reset_state_partial = false; } parse_thread.m_start_ofs = parse_thread_start_ofs; if (parse_thread_index == (num_parse_jobs - 1)) parse_thread.m_bytes_to_match = parse_thread_remaining; else parse_thread.m_bytes_to_match = parse_thread_total_size / num_parse_jobs; parse_thread.m_bytes_to_match = LZHAM_MIN(parse_thread.m_bytes_to_match, cMaxParseGraphNodes); LZHAM_ASSERT(parse_thread.m_bytes_to_match > 0); parse_thread.m_max_greedy_decisions = UINT_MAX; parse_thread.m_greedy_parse_gave_up = false; parse_thread_start_ofs += parse_thread.m_bytes_to_match; parse_thread_remaining -= parse_thread.m_bytes_to_match; } { scoped_perf_section parse_timer("parsing"); if ((m_use_task_pool) && (num_parse_jobs > 1)) { m_parse_jobs_remaining = num_parse_jobs; { scoped_perf_section queue_task_timer("queuing parse tasks"); if (!m_params.m_pTask_pool->queue_multiple_object_tasks(this, &lzcompressor::parse_job_callback, 1, num_parse_jobs - 1)) return false; } parse_job_callback(0, NULL); { scoped_perf_section wait_timer("waiting for jobs"); m_parse_jobs_complete.wait(); } } else { m_parse_jobs_remaining = INT_MAX; for (uint parse_thread_index = 0; parse_thread_index < num_parse_jobs; parse_thread_index++) { parse_job_callback(parse_thread_index, NULL); } } } { scoped_perf_section coding_timer("coding"); for (uint parse_thread_index = 0; parse_thread_index < num_parse_jobs; parse_thread_index++) { parse_thread_state &parse_thread = m_parse_thread_state[parse_thread_index]; if (parse_thread.m_failed) return false; const lzham::vector<lzdecision> &best_decisions = parse_thread.m_best_decisions; if (parse_thread.m_issue_reset_state_partial) { if (!m_state.encode_reset_state_partial(m_codec, m_accel, cur_dict_ofs)) return false; m_step++; } if (best_decisions.size()) { int i = 0; int end_dec_index = static_cast<int>(best_decisions.size()) - 1; int dec_step = 1; if (parse_thread.m_emit_decisions_backwards) { i = static_cast<int>(best_decisions.size()) - 1; end_dec_index = 0; dec_step = -1; LZHAM_ASSERT(best_decisions.back().m_pos == (int)parse_thread.m_start_ofs); } else { LZHAM_ASSERT(best_decisions.front().m_pos == (int)parse_thread.m_start_ofs); } // Loop rearranged to avoid bad x64 codegen problem with MSVC2008. for ( ; ; ) { LZHAM_ASSERT(best_decisions[i].m_pos == (int)cur_dict_ofs); LZHAM_ASSERT(i >= 0); LZHAM_ASSERT(i < (int)best_decisions.size()); #if LZHAM_UPDATE_STATS bit_cost_t cost = m_state.get_cost(*this, m_accel, best_decisions[i]); m_stats.update(best_decisions[i], m_state, m_accel, cost); //m_state.print(m_codec, *this, m_accel, best_decisions[i]); #endif if (!code_decision(best_decisions[i], cur_dict_ofs, bytes_to_match)) return false; if (i == end_dec_index) break; i += dec_step; } /*i;*/ } LZHAM_ASSERT(cur_dict_ofs == parse_thread.m_start_ofs + parse_thread.m_bytes_to_match); } // parse_thread_index } } { scoped_perf_section add_bytes_timer("add_bytes_end"); m_accel.add_bytes_end(); } if (!m_state.encode_eob(m_codec, m_accel, cur_dict_ofs)) return false; #ifdef LZHAM_LZDEBUG if (!m_codec.encode_bits(366, 12)) return false; #endif { scoped_perf_section stop_encoding_timer("stop_encoding"); if (!m_codec.stop_encoding(true)) return false; } // Coded the entire block - now see if it makes more sense to just send a raw/uncompressed block. uint compressed_size = m_codec.get_encoding_buf().size(); if (compressed_size) {} bool used_raw_block = false; #if !LZHAM_FORCE_ALL_RAW_BLOCKS #if (defined(LZHAM_DISABLE_RAW_BLOCKS) || defined(LZHAM_LZDEBUG)) if (0) #else if (compressed_size >= buf_len) #endif #endif { // Failed to compress the block, so go back to our original state and just code a raw block. m_state = m_start_of_block_state; m_step = initial_step; //m_stats = initial_stats; m_codec.reset(); if (!m_codec.start_encoding(buf_len + 16)) return false; if (!m_block_index) { if (!send_configuration()) return false; } #ifdef LZHAM_LZDEBUG if (!m_codec.encode_bits(166, 12)) return false; #endif if (!m_codec.encode_bits(cRawBlock, cBlockHeaderBits)) return false; LZHAM_ASSERT(buf_len <= 0x1000000); if (!m_codec.encode_bits(buf_len - 1, 24)) return false; // Write buf len check bits, to help increase the probability of detecting corrupted data more early. uint buf_len0 = (buf_len - 1) & 0xFF; uint buf_len1 = ((buf_len - 1) >> 8) & 0xFF; uint buf_len2 = ((buf_len - 1) >> 16) & 0xFF; if (!m_codec.encode_bits((buf_len0 ^ buf_len1) ^ buf_len2, 8)) return false; if (!m_codec.encode_align_to_byte()) return false; const uint8* pSrc = m_accel.get_ptr(m_block_start_dict_ofs); for (uint i = 0; i < buf_len; i++) { if (!m_codec.encode_bits(*pSrc++, 8)) return false; } if (!m_codec.stop_encoding(true)) return false; used_raw_block = true; emit_reset_update_rate_command = false; } uint comp_size = m_codec.get_encoding_buf().size(); uint scaled_ratio = (comp_size * cBlockHistoryCompRatioScale) / buf_len; update_block_history(comp_size, buf_len, scaled_ratio, used_raw_block, emit_reset_update_rate_command); //printf("\n%u, %u, %u, %u\n", m_block_index, 500*emit_reset_update_rate_command, scaled_ratio, get_recent_block_ratio()); { scoped_perf_section append_timer("append"); if (m_comp_buf.empty()) { m_comp_buf.swap(m_codec.get_encoding_buf()); } else { if (!m_comp_buf.append(m_codec.get_encoding_buf())) return false; } } #if LZHAM_UPDATE_STATS LZHAM_VERIFY(m_stats.m_total_bytes == m_src_size); if (emit_reset_update_rate_command) m_stats.m_total_update_rate_resets++; #endif m_block_index++; return true; } } // namespace lzham �����������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_pthreads_threading.h���������������������������������0000644�0001750�0001750�00000021501�12320456500�024721� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_task_pool_pthreads.h // See Copyright Notice and license at the end of include/lzham.h #pragma once #if LZHAM_USE_PTHREADS_API #if LZHAM_NO_ATOMICS #error No atomic operations defined in lzham_platform.h! #endif #include <pthread.h> #include <semaphore.h> #include <unistd.h> namespace lzham { class semaphore { LZHAM_NO_COPY_OR_ASSIGNMENT_OP(semaphore); public: inline semaphore(long initialCount = 0, long maximumCount = 1, const char* pName = NULL) { if (maximumCount) {} if (pName) {}; LZHAM_ASSERT(maximumCount >= initialCount); if (sem_init(&m_sem, 0, initialCount)) { LZHAM_FAIL("semaphore: sem_init() failed"); } } inline ~semaphore() { sem_destroy(&m_sem); } inline void release(long releaseCount = 1) { LZHAM_ASSERT(releaseCount >= 1); int status = 0; #ifdef WIN32 if (1 == releaseCount) status = sem_post(&m_sem); else status = sem_post_multiple(&m_sem, releaseCount); #else while (releaseCount > 0) { status = sem_post(&m_sem); if (status) break; releaseCount--; } #endif if (status) { LZHAM_FAIL("semaphore: sem_post() or sem_post_multiple() failed"); } } inline bool wait(uint32 milliseconds = LZHAM_UINT32_MAX) { int status; if (milliseconds == LZHAM_UINT32_MAX) { status = sem_wait(&m_sem); } else { struct timespec interval; interval.tv_sec = milliseconds / 1000; interval.tv_nsec = (milliseconds % 1000) * 1000000L; status = sem_timedwait(&m_sem, &interval); } if (status) { if (errno != ETIMEDOUT) { LZHAM_FAIL("semaphore: sem_wait() or sem_timedwait() failed"); } return false; } return true; } private: sem_t m_sem; }; class spinlock { public: inline spinlock() { if (pthread_spin_init(&m_spinlock, 0)) { LZHAM_FAIL("spinlock: pthread_spin_init() failed"); } } inline ~spinlock() { pthread_spin_destroy(&m_spinlock); } inline void lock() { if (pthread_spin_lock(&m_spinlock)) { LZHAM_FAIL("spinlock: pthread_spin_lock() failed"); } } inline void unlock() { if (pthread_spin_unlock(&m_spinlock)) { LZHAM_FAIL("spinlock: pthread_spin_unlock() failed"); } } private: pthread_spinlock_t m_spinlock; }; template<typename T, uint cMaxSize> class tsstack { public: inline tsstack() : m_top(0) { } inline ~tsstack() { } inline void clear() { m_spinlock.lock(); m_top = 0; m_spinlock.unlock(); } inline bool try_push(const T& obj) { bool result = false; m_spinlock.lock(); if (m_top < (int)cMaxSize) { m_stack[m_top++] = obj; result = true; } m_spinlock.unlock(); return result; } inline bool pop(T& obj) { bool result = false; m_spinlock.lock(); if (m_top > 0) { obj = m_stack[--m_top]; result = true; } m_spinlock.unlock(); return result; } private: spinlock m_spinlock; T m_stack[cMaxSize]; int m_top; }; class task_pool { public: task_pool(); task_pool(uint num_threads); ~task_pool(); enum { cMaxThreads = 16 }; bool init(uint num_threads); void deinit(); inline uint get_num_threads() const { return m_num_threads; } inline uint get_num_outstanding_tasks() const { return m_num_outstanding_tasks; } // C-style task callback typedef void (*task_callback_func)(uint64 data, void* pData_ptr); bool queue_task(task_callback_func pFunc, uint64 data = 0, void* pData_ptr = NULL); class executable_task { public: virtual void execute_task(uint64 data, void* pData_ptr) = 0; }; // It's the caller's responsibility to delete pObj within the execute_task() method, if needed! bool queue_task(executable_task* pObj, uint64 data = 0, void* pData_ptr = NULL); template<typename S, typename T> inline bool queue_object_task(S* pObject, T pObject_method, uint64 data = 0, void* pData_ptr = NULL); template<typename S, typename T> inline bool queue_multiple_object_tasks(S* pObject, T pObject_method, uint64 first_data, uint num_tasks, void* pData_ptr = NULL); void join(); private: struct task { inline task() : m_data(0), m_pData_ptr(NULL), m_pObj(NULL), m_flags(0) { } uint64 m_data; void* m_pData_ptr; union { task_callback_func m_callback; executable_task* m_pObj; }; uint m_flags; }; tsstack<task, cMaxThreads> m_task_stack; uint m_num_threads; pthread_t m_threads[cMaxThreads]; semaphore m_tasks_available; enum task_flags { cTaskFlagObject = 1 }; volatile atomic32_t m_num_outstanding_tasks; volatile atomic32_t m_exit_flag; void process_task(task& tsk); static void* thread_func(void *pContext); }; enum object_task_flags { cObjectTaskFlagDefault = 0, cObjectTaskFlagDeleteAfterExecution = 1 }; template<typename T> class object_task : public task_pool::executable_task { public: object_task(uint flags = cObjectTaskFlagDefault) : m_pObject(NULL), m_pMethod(NULL), m_flags(flags) { } typedef void (T::*object_method_ptr)(uint64 data, void* pData_ptr); object_task(T* pObject, object_method_ptr pMethod, uint flags = cObjectTaskFlagDefault) : m_pObject(pObject), m_pMethod(pMethod), m_flags(flags) { LZHAM_ASSERT(pObject && pMethod); } void init(T* pObject, object_method_ptr pMethod, uint flags = cObjectTaskFlagDefault) { LZHAM_ASSERT(pObject && pMethod); m_pObject = pObject; m_pMethod = pMethod; m_flags = flags; } T* get_object() const { return m_pObject; } object_method_ptr get_method() const { return m_pMethod; } virtual void execute_task(uint64 data, void* pData_ptr) { (m_pObject->*m_pMethod)(data, pData_ptr); if (m_flags & cObjectTaskFlagDeleteAfterExecution) lzham_delete(this); } protected: T* m_pObject; object_method_ptr m_pMethod; uint m_flags; }; template<typename S, typename T> inline bool task_pool::queue_object_task(S* pObject, T pObject_method, uint64 data, void* pData_ptr) { object_task<S> *pTask = lzham_new< object_task<S> >(pObject, pObject_method, cObjectTaskFlagDeleteAfterExecution); if (!pTask) return false; return queue_task(pTask, data, pData_ptr); } template<typename S, typename T> inline bool task_pool::queue_multiple_object_tasks(S* pObject, T pObject_method, uint64 first_data, uint num_tasks, void* pData_ptr) { LZHAM_ASSERT(m_num_threads); LZHAM_ASSERT(pObject); LZHAM_ASSERT(num_tasks); if (!num_tasks) return true; bool status = true; uint i; for (i = 0; i < num_tasks; i++) { task tsk; tsk.m_pObj = lzham_new< object_task<S> >(pObject, pObject_method, cObjectTaskFlagDeleteAfterExecution); if (!tsk.m_pObj) { status = false; break; } tsk.m_data = first_data + i; tsk.m_pData_ptr = pData_ptr; tsk.m_flags = cTaskFlagObject; if (!m_task_stack.try_push(tsk)) { status = false; break; } } if (i) { atomic_add32(&m_num_outstanding_tasks, i); m_tasks_available.release(i); } return status; } inline void lzham_sleep(unsigned int milliseconds) { #ifdef WIN32 struct timespec interval; interval.tv_sec = milliseconds / 1000; interval.tv_nsec = (milliseconds % 1000) * 1000000L; pthread_delay_np(&interval); #else while (milliseconds) { int msecs_to_sleep = LZHAM_MIN(milliseconds, 1000); usleep(msecs_to_sleep * 1000); milliseconds -= msecs_to_sleep; } #endif } // TODO: Implement uint lzham_get_max_helper_threads(); } // namespace lzham #endif // LZHAM_USE_PTHREADS_API �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_utils.h����������������������������������������������0000644�0001750�0001750�00000002641�12320456500�022226� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_utils.h // See Copyright Notice and license at the end of include/lzham.h #pragma once #define LZHAM_GET_ALIGNMENT(v) ((!sizeof(v)) ? 1 : (__alignof(v) ? __alignof(v) : sizeof(uint32))) #define LZHAM_MIN(a, b) (((a) < (b)) ? (a) : (b)) #define LZHAM_MAX(a, b) (((a) < (b)) ? (b) : (a)) template<class T, size_t N> T decay_array_to_subtype(T (&a)[N]); #define LZHAM_ARRAY_SIZE(X) (sizeof(X) / sizeof(decay_array_to_subtype(X))) namespace lzham { namespace utils { template<typename T> inline void swap(T& l, T& r) { T temp(l); l = r; r = temp; } template<typename T> inline void zero_object(T& obj) { memset(&obj, 0, sizeof(obj)); } static inline uint32 swap32(uint32 x) { return ((x << 24U) | ((x << 8U) & 0x00FF0000U) | ((x >> 8U) & 0x0000FF00U) | (x >> 24U)); } inline uint count_leading_zeros16(uint v) { LZHAM_ASSERT(v < 0x10000); uint temp; uint n = 16; temp = v >> 8; if (temp) { n -= 8; v = temp; } temp = v >> 4; if (temp) { n -= 4; v = temp; } temp = v >> 2; if (temp) { n -= 2; v = temp; } temp = v >> 1; if (temp) { n -= 1; v = temp; } if (v & 1) n--; return n; } } // namespace utils } // namespace lzham �����������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_polar_codes.cpp��������������������������������������0000644�0001750�0001750�00000031131�12320456500�023707� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: polar_codes.cpp // See Copyright Notice and license at the end of include/lzham.h // // Andrew Polar's prefix code algorithm: // http://ezcodesample.com/prefixer/prefixer_article.html // // Also implements Fyffe's approximate codelength generation method, which is // very similar but operates directly on codelengths vs. symbol frequencies: // Fyffe Codes for Fast Codelength Approximation, Graham Fyffe, 1999 // http://code.google.com/p/lzham/wiki/FyffeCodes #include "lzham_core.h" #include "lzham_polar_codes.h" #define LZHAM_USE_SHANNON_FANO_CODES 0 #define LZHAM_USE_FYFFE_CODES 0 namespace lzham { struct sym_freq { uint16 m_freq; uint16 m_sym; }; static inline sym_freq* radix_sort_syms(uint num_syms, sym_freq* syms0, sym_freq* syms1) { const uint cMaxPasses = 2; uint hist[256 * cMaxPasses]; memset(hist, 0, sizeof(hist[0]) * 256 * cMaxPasses); { sym_freq* p = syms0; sym_freq* q = syms0 + (num_syms >> 1) * 2; for ( ; p != q; p += 2) { const uint freq0 = p[0].m_freq; const uint freq1 = p[1].m_freq; hist[ freq0 & 0xFF]++; hist[256 + ((freq0 >> 8) & 0xFF)]++; hist[ freq1 & 0xFF]++; hist[256 + ((freq1 >> 8) & 0xFF)]++; } if (num_syms & 1) { const uint freq = p->m_freq; hist[ freq & 0xFF]++; hist[256 + ((freq >> 8) & 0xFF)]++; } } sym_freq* pCur_syms = syms0; sym_freq* pNew_syms = syms1; const uint total_passes = (hist[256] == num_syms) ? 1 : cMaxPasses; for (uint pass = 0; pass < total_passes; pass++) { const uint* pHist = &hist[pass << 8]; uint offsets[256]; uint cur_ofs = 0; for (uint i = 0; i < 256; i += 2) { offsets[i] = cur_ofs; cur_ofs += pHist[i]; offsets[i+1] = cur_ofs; cur_ofs += pHist[i+1]; } const uint pass_shift = pass << 3; sym_freq* p = pCur_syms; sym_freq* q = pCur_syms + (num_syms >> 1) * 2; for ( ; p != q; p += 2) { uint c0 = p[0].m_freq; uint c1 = p[1].m_freq; if (pass) { c0 >>= 8; c1 >>= 8; } c0 &= 0xFF; c1 &= 0xFF; // Cut down on LHS's on console platforms by processing two at a time. if (c0 == c1) { uint dst_offset0 = offsets[c0]; offsets[c0] = dst_offset0 + 2; pNew_syms[dst_offset0] = p[0]; pNew_syms[dst_offset0 + 1] = p[1]; } else { uint dst_offset0 = offsets[c0]++; uint dst_offset1 = offsets[c1]++; pNew_syms[dst_offset0] = p[0]; pNew_syms[dst_offset1] = p[1]; } } if (num_syms & 1) { uint c = ((p->m_freq) >> pass_shift) & 0xFF; uint dst_offset = offsets[c]; offsets[c] = dst_offset + 1; pNew_syms[dst_offset] = *p; } sym_freq* t = pCur_syms; pCur_syms = pNew_syms; pNew_syms = t; } #if LZHAM_ASSERTS_ENABLED uint prev_freq = 0; for (uint i = 0; i < num_syms; i++) { LZHAM_ASSERT(!(pCur_syms[i].m_freq < prev_freq)); prev_freq = pCur_syms[i].m_freq; } #endif return pCur_syms; } struct polar_work_tables { sym_freq syms0[cPolarMaxSupportedSyms]; sym_freq syms1[cPolarMaxSupportedSyms]; }; uint get_generate_polar_codes_table_size() { return sizeof(polar_work_tables); } void generate_polar_codes(uint num_syms, sym_freq* pSF, uint8* pCodesizes, uint& max_code_size_ret) { int tmp_freq[cPolarMaxSupportedSyms]; uint orig_total_freq = 0; uint cur_total = 0; for (uint i = 0; i < num_syms; i++) { uint sym_freq = pSF[num_syms - 1 - i].m_freq; orig_total_freq += sym_freq; uint sym_len = math::total_bits(sym_freq); uint adjusted_sym_freq = 1 << (sym_len - 1); tmp_freq[i] = adjusted_sym_freq; cur_total += adjusted_sym_freq; } uint tree_total = 1 << (math::total_bits(orig_total_freq) - 1); if (tree_total < orig_total_freq) tree_total <<= 1; uint start_index = 0; while ((cur_total < tree_total) && (start_index < num_syms)) { for (uint i = start_index; i < num_syms; i++) { uint freq = tmp_freq[i]; if ((cur_total + freq) <= tree_total) { tmp_freq[i] += freq; if ((cur_total += freq) == tree_total) break; } else { start_index = i + 1; } } } LZHAM_ASSERT(cur_total == tree_total); uint max_code_size = 0; const uint tree_total_bits = math::total_bits(tree_total); for (uint i = 0; i < num_syms; i++) { uint codesize = (tree_total_bits - math::total_bits(tmp_freq[i])); max_code_size = LZHAM_MAX(codesize, max_code_size); pCodesizes[pSF[num_syms-1-i].m_sym] = static_cast<uint8>(codesize); } max_code_size_ret = max_code_size; } #if LZHAM_USE_FYFFE_CODES void generate_fyffe_codes(uint num_syms, sym_freq* pSF, uint8* pCodesizes, uint& max_code_size_ret) { int tmp_codesizes[cPolarMaxSupportedSyms]; uint cur_total = 0; uint orig_total = 0; for (uint i = 0; i < num_syms; i++) { uint sym_freq = pSF[i].m_freq; orig_total += sym_freq; // Compute the nearest power of 2 lower or equal to the symbol's frequency. // This is equivalent to codesize=ceil(-log2(sym_prob)). uint floor_sym_freq = sym_freq; if (!math::is_power_of_2(floor_sym_freq)) { uint sym_freq_bits = math::total_bits(sym_freq); floor_sym_freq = 1 << (sym_freq_bits - 1); } // Compute preliminary codesizes. tmp_freq's will always be <= the input frequencies. tmp_codesizes[i] = math::total_bits(floor_sym_freq); cur_total += floor_sym_freq; } // Desired_total is a power of 2, and will always be >= the adjusted frequency total. uint desired_total = cur_total; if (!math::is_power_of_2(desired_total)) desired_total = math::next_pow2(desired_total); LZHAM_ASSERT(cur_total <= desired_total); // Compute residual and initial symbol codesizes. uint desired_total_bits = math::total_bits(desired_total); int r = desired_total; for (uint i = 0; i < num_syms; i++) { uint codesize = desired_total_bits - tmp_codesizes[i]; tmp_codesizes[i] = static_cast<uint8>(codesize); r -= (desired_total >> codesize); } LZHAM_ASSERT(r >= 0); int sym_freq_scale = (desired_total << 7) / orig_total; // Promote codesizes from most probable to lowest, as needed. bool force_unhappiness = false; while (r > 0) { for (int i = num_syms - 1; i >= 0; i--) { uint codesize = tmp_codesizes[i]; if (codesize == 1) continue; int sym_freq = pSF[i].m_freq; int f = desired_total >> codesize; if (f > r) continue; // A code is "unhappy" when it is assigned more bits than -log2(sym_prob). // It's too expensive to compute -log2(sym_freq/total_freq), so instead this directly compares the symbol's original // frequency vs. the effective/adjusted frequency. sym_freq >= f is an approximation. //bool unhappy = force_unhappiness || (sym_freq >= f); // Compare the symbol's original probability vs. its effective probability at its current codelength. //bool unhappy = force_unhappiness || ((sym_freq * ((float)desired_total / orig_total)) > f); bool unhappy = force_unhappiness || ((sym_freq * sym_freq_scale) > (f << 7)); if (unhappy) { tmp_codesizes[i]--; r -= f; if (r <= 0) break; } } // Occasionally, a second pass is required to reduce the residual to 0. // Subsequent passes ignore unhappiness. This is not discussed in Fyffe's original article. force_unhappiness = true; } LZHAM_ASSERT(!r); uint max_code_size = 0; for (uint i = 0; i < num_syms; i++) { uint codesize = tmp_codesizes[i]; max_code_size = LZHAM_MAX(codesize, max_code_size); pCodesizes[pSF[i].m_sym] = static_cast<uint8>(codesize); } max_code_size_ret = max_code_size; } #endif //LZHAM_USE_FYFFE_CODES #if LZHAM_USE_SHANNON_FANO_CODES // Straightforward recursive Shannon-Fano implementation, for comparison purposes. static void generate_shannon_fano_codes_internal(uint num_syms, sym_freq* pSF, uint8* pCodesizes, int l, int h, uint total_freq) { LZHAM_ASSERT((h - l) >= 2); uint left_total = total_freq; uint right_total = 0; int best_diff = INT_MAX; int best_split_index = 0; for (int i = h - 1; i > l; i--) { uint freq = pSF[i].m_freq; uint next_left_total = left_total - freq; uint next_right_total = right_total + freq; LZHAM_ASSERT((next_left_total + next_right_total) == total_freq); int diff = labs(next_left_total - next_right_total); if (diff >= best_diff) break; left_total = next_left_total; right_total = next_right_total; best_split_index = i; best_diff = diff; if (!best_diff) break; } for (int i = l; i < h; i++) pCodesizes[i]++; if ((best_split_index - l) > 1) generate_shannon_fano_codes_internal(num_syms, pSF, pCodesizes, l, best_split_index, left_total); if ((h - best_split_index) > 1) generate_shannon_fano_codes_internal(num_syms, pSF, pCodesizes, best_split_index, h, right_total); } void generate_shannon_fano_codes(uint num_syms, sym_freq* pSF, uint total_freq, uint8* pCodesizes, uint& max_code_size_ret) { LZHAM_ASSERT(num_syms >= 2); uint8 tmp_codesizes[cPolarMaxSupportedSyms]; memset(tmp_codesizes, 0, num_syms); generate_shannon_fano_codes_internal(num_syms, pSF, tmp_codesizes, 0, num_syms, total_freq); uint max_code_size = 0; for (uint i = 0; i < num_syms; i++) { uint codesize = tmp_codesizes[i]; max_code_size = LZHAM_MAX(codesize, max_code_size); pCodesizes[pSF[i].m_sym] = static_cast<uint8>(codesize); } max_code_size_ret = max_code_size; } #endif // LZHAM_USE_SHANNON_FANO_CODES bool generate_polar_codes(void* pContext, uint num_syms, const uint16* pFreq, uint8* pCodesizes, uint& max_code_size, uint& total_freq_ret) { if ((!num_syms) || (num_syms > cPolarMaxSupportedSyms)) return false; polar_work_tables& state = *static_cast<polar_work_tables*>(pContext);; uint max_freq = 0; uint total_freq = 0; uint num_used_syms = 0; for (uint i = 0; i < num_syms; i++) { uint freq = pFreq[i]; if (!freq) pCodesizes[i] = 0; else { total_freq += freq; max_freq = math::maximum(max_freq, freq); sym_freq& sf = state.syms0[num_used_syms]; sf.m_sym = static_cast<uint16>(i); sf.m_freq = static_cast<uint16>(freq); num_used_syms++; } } total_freq_ret = total_freq; if (num_used_syms == 1) { pCodesizes[state.syms0[0].m_sym] = 1; } else { sym_freq* syms = radix_sort_syms(num_used_syms, state.syms0, state.syms1); #if LZHAM_USE_SHANNON_FANO_CODES generate_shannon_fano_codes(num_syms, syms, total_freq, pCodesizes, max_code_size); #elif LZHAM_USE_FYFFE_CODES generate_fyffe_codes(num_syms, syms, pCodesizes, max_code_size); #else generate_polar_codes(num_syms, syms, pCodesizes, max_code_size); #endif } return true; } } // namespace lzham ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_comp.h�����������������������������������������������0000644�0001750�0001750�00000003663�12320456500�022031� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_comp.h // See Copyright Notice and license at the end of include/lzham.h #pragma once #include "lzham.h" namespace lzham { lzham_compress_state_ptr LZHAM_CDECL lzham_lib_compress_init(const lzham_compress_params *pParams); lzham_compress_state_ptr LZHAM_CDECL lzham_lib_compress_reinit(lzham_compress_state_ptr p); lzham_uint32 LZHAM_CDECL lzham_lib_compress_deinit(lzham_compress_state_ptr p); lzham_compress_status_t LZHAM_CDECL lzham_lib_compress( lzham_compress_state_ptr p, const lzham_uint8 *pIn_buf, size_t *pIn_buf_size, lzham_uint8 *pOut_buf, size_t *pOut_buf_size, lzham_bool no_more_input_bytes_flag); lzham_compress_status_t LZHAM_CDECL lzham_lib_compress2( lzham_compress_state_ptr p, const lzham_uint8 *pIn_buf, size_t *pIn_buf_size, lzham_uint8 *pOut_buf, size_t *pOut_buf_size, lzham_flush_t flush_type); lzham_compress_status_t LZHAM_CDECL lzham_lib_compress_memory(const lzham_compress_params *pParams, lzham_uint8* pDst_buf, size_t *pDst_len, const lzham_uint8* pSrc_buf, size_t src_len, lzham_uint32 *pAdler32); int lzham_lib_z_deflateInit(lzham_z_streamp pStream, int level); int lzham_lib_z_deflateInit2(lzham_z_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy); int lzham_lib_z_deflateReset(lzham_z_streamp pStream); int lzham_lib_z_deflate(lzham_z_streamp pStream, int flush); int lzham_lib_z_deflateEnd(lzham_z_streamp pStream); lzham_z_ulong lzham_lib_z_deflateBound(lzham_z_streamp pStream, lzham_z_ulong source_len); int lzham_lib_z_compress2(unsigned char *pDest, lzham_z_ulong *pDest_len, const unsigned char *pSource, lzham_z_ulong source_len, int level); int lzham_lib_z_compress(unsigned char *pDest, lzham_z_ulong *pDest_len, const unsigned char *pSource, lzham_z_ulong source_len); lzham_z_ulong lzham_lib_z_compressBound(lzham_z_ulong source_len); } // namespace lzham �����������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzhamVersion.h���������������������������������������������0000644�0001750�0001750�00000000120�12320456500�022342� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// URL: http://lzham.googlecode.com/svn/trunk // Revision: 96, candidate alpha8 ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_mem.h������������������������������������������������0000644�0001750�0001750�00000005765�12320456500�021656� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_mem.h // See Copyright Notice and license at the end of include/lzham.h #pragma once namespace lzham { void lzham_mem_init(); void* lzham_malloc(size_t size, size_t* pActual_size = NULL); void* lzham_realloc(void* p, size_t size, size_t* pActual_size = NULL, bool movable = true); void lzham_free(void* p); size_t lzham_msize(void* p); template<typename T> inline T* lzham_new() { T* p = static_cast<T*>(lzham_malloc(sizeof(T))); if (!p) return NULL; if (LZHAM_IS_SCALAR_TYPE(T)) return p; return helpers::construct(p); } template<typename T, typename A> inline T* lzham_new(const A& init0) { T* p = static_cast<T*>(lzham_malloc(sizeof(T))); if (!p) return NULL; return new (static_cast<void*>(p)) T(init0); } template<typename T, typename A, typename B> inline T* lzham_new(const A& init0, const B& init1) { T* p = static_cast<T*>(lzham_malloc(sizeof(T))); if (!p) return NULL; return new (static_cast<void*>(p)) T(init0, init1); } template<typename T, typename A, typename B, typename C> inline T* lzham_new(const A& init0, const B& init1, const C& init2) { T* p = static_cast<T*>(lzham_malloc(sizeof(T))); if (!p) return NULL; return new (static_cast<void*>(p)) T(init0, init1, init2); } template<typename T, typename A, typename B, typename C, typename D> inline T* lzham_new(const A& init0, const B& init1, const C& init2, const D& init3) { T* p = static_cast<T*>(lzham_malloc(sizeof(T))); if (!p) return NULL; return new (static_cast<void*>(p)) T(init0, init1, init2, init3); } template<typename T> inline T* lzham_new_array(uint32 num) { if (!num) num = 1; uint8* q = static_cast<uint8*>(lzham_malloc(LZHAM_MIN_ALLOC_ALIGNMENT + sizeof(T) * num)); if (!q) return NULL; T* p = reinterpret_cast<T*>(q + LZHAM_MIN_ALLOC_ALIGNMENT); reinterpret_cast<uint32*>(p)[-1] = num; reinterpret_cast<uint32*>(p)[-2] = ~num; if (!LZHAM_IS_SCALAR_TYPE(T)) { helpers::construct_array(p, num); } return p; } template<typename T> inline void lzham_delete(T* p) { if (p) { if (!LZHAM_IS_SCALAR_TYPE(T)) { helpers::destruct(p); } lzham_free(p); } } template<typename T> inline void lzham_delete_array(T* p) { if (p) { const uint32 num = reinterpret_cast<uint32*>(p)[-1]; const uint32 num_check = reinterpret_cast<uint32*>(p)[-2]; LZHAM_ASSERT(num && (num == ~num_check)); if (num == ~num_check) { if (!LZHAM_IS_SCALAR_TYPE(T)) { helpers::destruct_array(p, num); } lzham_free(reinterpret_cast<uint8*>(p) - LZHAM_MIN_ALLOC_ALIGNMENT); } } } void lzham_print_mem_stats(); } // namespace lzham �����������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_checksum.cpp�����������������������������������������0000644�0001750�0001750�00000004004�12320456500�023216� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_checksum.cpp #include "lzham_core.h" #include "lzham_checksum.h" namespace lzham { // Originally from the public domain stb.h header. uint adler32(const void* pBuf, size_t buflen, uint adler32) { if (!pBuf) return cInitAdler32; const uint8* buffer = static_cast<const uint8*>(pBuf); const unsigned long ADLER_MOD = 65521; unsigned long s1 = adler32 & 0xffff, s2 = adler32 >> 16; size_t blocklen; unsigned long i; blocklen = buflen % 5552; while (buflen) { for (i=0; i + 7 < blocklen; i += 8) { s1 += buffer[0], s2 += s1; s1 += buffer[1], s2 += s1; s1 += buffer[2], s2 += s1; s1 += buffer[3], s2 += s1; s1 += buffer[4], s2 += s1; s1 += buffer[5], s2 += s1; s1 += buffer[6], s2 += s1; s1 += buffer[7], s2 += s1; buffer += 8; } for (; i < blocklen; ++i) s1 += *buffer++, s2 += s1; s1 %= ADLER_MOD, s2 %= ADLER_MOD; buflen -= blocklen; blocklen = 5552; } return (s2 << 16) + s1; } // Karl Malbrain's compact CRC-32, with pre and post conditioning. // See "A compact CCITT crc16 and crc32 C implementation that balances processor cache usage against speed": // http://www.geocities.com/malbrain/ static const lzham_uint32 s_crc32[16] = { 0x00000000, 0x1db71064, 0x3b6e20c8, 0x26d930ac, 0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c, 0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c, 0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c }; uint crc32(uint crc, const lzham_uint8 *ptr, size_t buf_len) { if (!ptr) return cInitCRC32; crc = ~crc; while (buf_len--) { lzham_uint8 b = *ptr++; crc = (crc >> 4) ^ s_crc32[(crc & 0xF) ^ (b & 0xF)]; crc = (crc >> 4) ^ s_crc32[(crc & 0xF) ^ (b >> 4)]; } return ~crc; } } // namespace lzham ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_assert.h���������������������������������������������0000644�0001750�0001750�00000002577�12320456500�022377� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_assert.h // See Copyright Notice and license at the end of include/lzham.h #pragma once const unsigned int LZHAM_FAIL_EXCEPTION_CODE = 256U; void lzham_enable_fail_exceptions(bool enabled); void lzham_assert(const char* pExp, const char* pFile, unsigned line); void lzham_fail(const char* pExp, const char* pFile, unsigned line); #ifdef NDEBUG #define LZHAM_ASSERT(x) ((void)0) #else #define LZHAM_ASSERT(_exp) (void)( (!!(_exp)) || (lzham_assert(#_exp, __FILE__, __LINE__), 0) ) #define LZHAM_ASSERTS_ENABLED 1 #endif #define LZHAM_VERIFY(_exp) (void)( (!!(_exp)) || (lzham_assert(#_exp, __FILE__, __LINE__), 0) ) #define LZHAM_FAIL(msg) do { lzham_fail(#msg, __FILE__, __LINE__); } while(0) #define LZHAM_ASSERT_OPEN_RANGE(x, l, h) LZHAM_ASSERT((x >= l) && (x < h)) #define LZHAM_ASSERT_CLOSED_RANGE(x, l, h) LZHAM_ASSERT((x >= l) && (x <= h)) void lzham_trace(const char* pFmt, va_list args); void lzham_trace(const char* pFmt, ...); // Borrowed from boost libraries. template <bool x> struct assume_failure; template <> struct assume_failure<true> { enum { blah = 1 }; }; template<int x> struct assume_try { }; #define LZHAM_JOINER_FINAL(a, b) a##b #define LZHAM_JOINER(a, b) LZHAM_JOINER_FINAL(a, b) #define LZHAM_JOIN(a, b) LZHAM_JOINER(a, b) #define LZHAM_ASSUME(p) typedef assume_try < sizeof(assume_failure< (bool)(p) > ) > LZHAM_JOIN(assume_typedef, __COUNTER__) ���������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/license.txt������������������������������������������������0000644�0001750�0001750�00000002130�12320456500�021676� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Copyright (c) 2009-2011 Richard Geldreich, Jr. <richgel99@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_pthreads_threading.cpp�������������������������������0000644�0001750�0001750�00000012012�12320456500�025251� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_task_pool_pthreads.cpp // // Copyright (c) 2009-2010 Richard Geldreich, Jr. <richgel99@gmail.com> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #include "lzham_core.h" #include "lzham_pthreads_threading.h" #include "lzham_timer.h" #ifdef WIN32 #include <process.h> #endif #if LZHAM_USE_PTHREADS_API #ifdef WIN32 #pragma comment(lib, "../ext/libpthread/lib/pthreadVC2.lib") #endif namespace lzham { task_pool::task_pool() : m_num_threads(0), m_tasks_available(0, 32767), m_num_outstanding_tasks(0), m_exit_flag(false) { utils::zero_object(m_threads); } task_pool::task_pool(uint num_threads) : m_num_threads(0), m_tasks_available(0, 32767), m_num_outstanding_tasks(0), m_exit_flag(false) { utils::zero_object(m_threads); bool status = init(num_threads); LZHAM_VERIFY(status); } task_pool::~task_pool() { deinit(); } bool task_pool::init(uint num_threads) { LZHAM_ASSERT(num_threads <= cMaxThreads); num_threads = math::minimum<uint>(num_threads, cMaxThreads); deinit(); bool succeeded = true; m_num_threads = 0; while (m_num_threads < num_threads) { int status = pthread_create(&m_threads[m_num_threads], NULL, thread_func, this); if (status) { succeeded = false; break; } m_num_threads++; } if (!succeeded) { deinit(); return false; } return true; } void task_pool::deinit() { if (m_num_threads) { join(); atomic_exchange32(&m_exit_flag, true); m_tasks_available.release(m_num_threads); for (uint i = 0; i < m_num_threads; i++) pthread_join(m_threads[i], NULL); m_num_threads = 0; atomic_exchange32(&m_exit_flag, false); } m_task_stack.clear(); m_num_outstanding_tasks = 0; } bool task_pool::queue_task(task_callback_func pFunc, uint64 data, void* pData_ptr) { LZHAM_ASSERT(m_num_threads); LZHAM_ASSERT(pFunc); task tsk; tsk.m_callback = pFunc; tsk.m_data = data; tsk.m_pData_ptr = pData_ptr; tsk.m_flags = 0; if (!m_task_stack.try_push(tsk)) return false; atomic_increment32(&m_num_outstanding_tasks); m_tasks_available.release(1); return true; } // It's the object's responsibility to delete pObj within the execute_task() method, if needed! bool task_pool::queue_task(executable_task* pObj, uint64 data, void* pData_ptr) { LZHAM_ASSERT(m_num_threads); LZHAM_ASSERT(pObj); task tsk; tsk.m_pObj = pObj; tsk.m_data = data; tsk.m_pData_ptr = pData_ptr; tsk.m_flags = cTaskFlagObject; if (!m_task_stack.try_push(tsk)) return false; atomic_increment32(&m_num_outstanding_tasks); m_tasks_available.release(1); return true; } void task_pool::process_task(task& tsk) { if (tsk.m_flags & cTaskFlagObject) tsk.m_pObj->execute_task(tsk.m_data, tsk.m_pData_ptr); else tsk.m_callback(tsk.m_data, tsk.m_pData_ptr); atomic_decrement32(&m_num_outstanding_tasks); } void task_pool::join() { task tsk; while (atomic_add32(&m_num_outstanding_tasks, 0) > 0) { if (m_task_stack.pop(tsk)) { process_task(tsk); } else { lzham_sleep(1); } } } void * task_pool::thread_func(void *pContext) { task_pool* pPool = static_cast<task_pool*>(pContext); task tsk; for ( ; ; ) { if (!pPool->m_tasks_available.wait()) break; if (pPool->m_exit_flag) break; if (pPool->m_task_stack.pop(tsk)) { pPool->process_task(tsk); } } return NULL; } uint lzham_get_max_helper_threads() { return 0; } } // namespace lzham #endif // LZHAM_USE_PTHREADS_API ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_lzdecomp.cpp�����������������������������������������0000644�0001750�0001750�00000171652�12320456500�023247� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_lzdecomp.cpp // See Copyright Notice and license at the end of include/lzham.h // // See "Coroutines in C": // http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html // Also see "Protothreads - Lightweight, Stackless Threads in C": // http://www.sics.se/~adam/pt/ #include "lzham_core.h" #include "lzham_decomp.h" #include "lzham_symbol_codec.h" #include "lzham_checksum.h" #include "lzham_lzdecompbase.h" using namespace lzham; namespace lzham { static const uint8 s_literal_next_state[24] = { 0, 0, 0, 0, 1, 2, 3, // 0-6: literal states 4, 5, 6, 4, 5, // 7-11: match states 7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10 // 12-23: unused }; static const uint s_huge_match_base_len[4] = { CLZDecompBase::cMaxMatchLen + 1, CLZDecompBase::cMaxMatchLen + 1 + 256, CLZDecompBase::cMaxMatchLen + 1 + 256 + 1024, CLZDecompBase::cMaxMatchLen + 1 + 256 + 1024 + 4096 }; static const uint8 s_huge_match_code_len[4] = { 8, 10, 12, 16 }; struct lzham_decompressor { void init(); template<bool unbuffered> lzham_decompress_status_t decompress(); void reset_all_tables(); void reset_huffman_table_update_rates(); int m_state; CLZDecompBase m_lzBase; symbol_codec m_codec; uint32 m_raw_decomp_buf_size; uint8 *m_pRaw_decomp_buf; uint8 *m_pDecomp_buf; uint32 m_decomp_adler32; const uint8 *m_pIn_buf; size_t *m_pIn_buf_size; uint8 *m_pOut_buf; size_t *m_pOut_buf_size; bool m_no_more_input_bytes_flag; uint8 *m_pOrig_out_buf; size_t m_orig_out_buf_size; lzham_decompress_params m_params; lzham_decompress_status_t m_status; #if LZHAM_USE_ALL_ARITHMETIC_CODING typedef adaptive_arith_data_model sym_data_model; #else typedef quasi_adaptive_huffman_data_model sym_data_model; #endif sym_data_model m_lit_table[1 << CLZDecompBase::cNumLitPredBits]; sym_data_model m_delta_lit_table[1 << CLZDecompBase::cNumDeltaLitPredBits]; sym_data_model m_main_table; sym_data_model m_rep_len_table[2]; sym_data_model m_large_len_table[2]; sym_data_model m_dist_lsb_table; adaptive_bit_model m_is_match_model[CLZDecompBase::cNumStates * (1 << CLZDecompBase::cNumIsMatchContextBits)]; adaptive_bit_model m_is_rep_model[CLZDecompBase::cNumStates]; adaptive_bit_model m_is_rep0_model[CLZDecompBase::cNumStates]; adaptive_bit_model m_is_rep0_single_byte_model[CLZDecompBase::cNumStates]; adaptive_bit_model m_is_rep1_model[CLZDecompBase::cNumStates]; adaptive_bit_model m_is_rep2_model[CLZDecompBase::cNumStates]; uint m_dst_ofs; uint m_step; uint m_block_step; uint m_initial_step; uint m_block_index; int m_match_hist0; int m_match_hist1; int m_match_hist2; int m_match_hist3; uint m_cur_state; uint m_start_block_dst_ofs; uint m_prev_char; uint m_prev_prev_char; uint m_block_type; const uint8 *m_pFlush_src; size_t m_flush_num_bytes_remaining; size_t m_flush_n; uint m_seed_bytes_to_ignore_when_flushing; uint m_file_src_file_adler32; uint m_rep_lit0; uint m_match_len; uint m_match_slot; uint m_extra_bits; uint m_num_extra_bits; uint m_src_ofs; const uint8* m_pCopy_src; uint m_num_raw_bytes_remaining; uint m_debug_is_match; uint m_debug_match_len; uint m_debug_match_dist; uint m_debug_lit; lzham_decompress_status_t m_z_last_status; uint m_z_first_call; uint m_z_has_flushed; uint m_z_cmf; uint m_z_flg; uint m_z_dict_adler32; uint m_tmp; }; // Ordinarily I dislike macros like this, but in this case I think using them makes the decompression function easier to follow. // Coroutine helpers. #define LZHAM_CR_INITIAL_STATE 0 #define LZHAM_CR_BEGIN(state) switch( state ) { case LZHAM_CR_INITIAL_STATE: #define LZHAM_CR_RETURN(state, result) do { state = __LINE__; return (result); case __LINE__:; } while (0) #define LZHAM_CR_FINISH } // Helpers to save/restore local variables (hopefully CPU registers) to memory. #define LZHAM_RESTORE_STATE LZHAM_RESTORE_LOCAL_STATE \ match_hist0 = m_match_hist0; match_hist1 = m_match_hist1; match_hist2 = m_match_hist2; match_hist3 = m_match_hist3; \ cur_state = m_cur_state; prev_char = m_prev_char; prev_prev_char = m_prev_prev_char; dst_ofs = m_dst_ofs; #define LZHAM_SAVE_STATE LZHAM_SAVE_LOCAL_STATE \ m_match_hist0 = match_hist0; m_match_hist1 = match_hist1; m_match_hist2 = match_hist2; m_match_hist3 = match_hist3; \ m_cur_state = cur_state; m_prev_char = prev_char; m_prev_prev_char = prev_prev_char; m_dst_ofs = dst_ofs; // Helper that coroutine returns to the caller with a request for more input bytes. #define LZHAM_DECODE_NEEDS_BYTES \ LZHAM_SAVE_STATE \ for ( ; ; ) \ { \ *m_pIn_buf_size = static_cast<size_t>(m_codec.decode_get_bytes_consumed()); \ *m_pOut_buf_size = 0; \ LZHAM_CR_RETURN(m_state, LZHAM_DECOMP_STATUS_NEEDS_MORE_INPUT); \ m_codec.decode_set_input_buffer(m_pIn_buf, *m_pIn_buf_size, m_pIn_buf, m_no_more_input_bytes_flag); \ if ((m_codec.m_decode_buf_eof) || (m_codec.m_decode_buf_size)) break; \ } \ LZHAM_RESTORE_STATE #if LZHAM_PLATFORM_X360 #define LZHAM_BULK_MEMCPY XMemCpy #define LZHAM_MEMCPY memcpy #else #define LZHAM_BULK_MEMCPY memcpy #define LZHAM_MEMCPY memcpy #endif // Flush the output buffer/dictionary by doing a coroutine return to the caller. // The caller must permit the decompressor to flush total_bytes from the dictionary, or (in the // case of corrupted data, or a bug) we must report a DEST_BUF_TOO_SMALL error. #define LZHAM_FLUSH_OUTPUT_BUFFER(total_bytes) \ LZHAM_SAVE_STATE \ m_pFlush_src = m_pDecomp_buf + m_seed_bytes_to_ignore_when_flushing; \ m_flush_num_bytes_remaining = total_bytes - m_seed_bytes_to_ignore_when_flushing; \ m_seed_bytes_to_ignore_when_flushing = 0; \ while (m_flush_num_bytes_remaining) \ { \ m_flush_n = LZHAM_MIN(m_flush_num_bytes_remaining, *m_pOut_buf_size); \ if (0 == (m_params.m_decompress_flags & LZHAM_DECOMP_FLAG_COMPUTE_ADLER32)) \ { \ LZHAM_BULK_MEMCPY(m_pOut_buf, m_pFlush_src, m_flush_n); \ } \ else \ { \ size_t copy_ofs = 0; \ while (copy_ofs < m_flush_n) \ { \ const uint cBytesToMemCpyPerIteration = 8192U; \ size_t bytes_to_copy = LZHAM_MIN((size_t)(m_flush_n - copy_ofs), cBytesToMemCpyPerIteration); \ LZHAM_MEMCPY(m_pOut_buf + copy_ofs, m_pFlush_src + copy_ofs, bytes_to_copy); \ m_decomp_adler32 = adler32(m_pFlush_src + copy_ofs, bytes_to_copy, m_decomp_adler32); \ copy_ofs += bytes_to_copy; \ } \ } \ *m_pIn_buf_size = static_cast<size_t>(m_codec.decode_get_bytes_consumed()); \ *m_pOut_buf_size = m_flush_n; \ LZHAM_CR_RETURN(m_state, m_flush_n ? LZHAM_DECOMP_STATUS_NOT_FINISHED : LZHAM_DECOMP_STATUS_HAS_MORE_OUTPUT); \ m_codec.decode_set_input_buffer(m_pIn_buf, *m_pIn_buf_size, m_pIn_buf, m_no_more_input_bytes_flag); \ m_pFlush_src += m_flush_n; \ m_flush_num_bytes_remaining -= m_flush_n; \ } \ LZHAM_RESTORE_STATE \ #if LZHAM_USE_ALL_ARITHMETIC_CODING #define LZHAM_DECOMPRESS_DECODE_ADAPTIVE_SYMBOL(codec, result, model) LZHAM_SYMBOL_CODEC_DECODE_ADAPTIVE_ARITHMETIC(codec, result, model) #else #define LZHAM_DECOMPRESS_DECODE_ADAPTIVE_SYMBOL(codec, result, model) LZHAM_SYMBOL_CODEC_DECODE_ADAPTIVE_HUFFMAN(codec, result, model) #endif //------------------------------------------------------------------------------------------------------------------ void lzham_decompressor::init() { m_lzBase.init_position_slots(m_params.m_dict_size_log2); #ifdef LZHAM_LZDEBUG if (m_pDecomp_buf) memset(m_pDecomp_buf, 0xCE, 1U << m_params.m_dict_size_log2); #endif m_state = LZHAM_CR_INITIAL_STATE; m_step = 0; m_block_step = 0; m_block_index = 0; m_initial_step = 0; m_dst_ofs = 0; m_pIn_buf = NULL; m_pIn_buf_size = NULL; m_pOut_buf = NULL; m_pOut_buf_size = NULL; m_no_more_input_bytes_flag = false; m_status = LZHAM_DECOMP_STATUS_NOT_FINISHED; m_pOrig_out_buf = NULL; m_orig_out_buf_size = 0; m_decomp_adler32 = cInitAdler32; m_seed_bytes_to_ignore_when_flushing = 0; m_z_last_status = LZHAM_DECOMP_STATUS_NOT_FINISHED; m_z_first_call = 1; m_z_has_flushed = 0; m_z_cmf = 0; m_z_flg = 0; m_z_dict_adler32 = 0; m_tmp = 0; } void lzham_decompressor::reset_all_tables() { m_lit_table[0].reset(); for (uint i = 1; i < LZHAM_ARRAY_SIZE(m_lit_table); i++) m_lit_table[i] = m_lit_table[0]; m_delta_lit_table[0].reset(); for (uint i = 1; i < LZHAM_ARRAY_SIZE(m_delta_lit_table); i++) m_delta_lit_table[i] = m_delta_lit_table[0]; m_main_table.reset(); for (uint i = 0; i < LZHAM_ARRAY_SIZE(m_rep_len_table); i++) m_rep_len_table[i].reset(); for (uint i = 0; i < LZHAM_ARRAY_SIZE(m_large_len_table); i++) m_large_len_table[i].reset(); m_dist_lsb_table.reset(); for (uint i = 0; i < LZHAM_ARRAY_SIZE(m_is_match_model); i++) m_is_match_model[i].clear(); for (uint i = 0; i < CLZDecompBase::cNumStates; i++) { m_is_rep_model[i].clear(); m_is_rep0_model[i].clear(); m_is_rep0_single_byte_model[i].clear(); m_is_rep1_model[i].clear(); m_is_rep2_model[i].clear(); } } void lzham_decompressor::reset_huffman_table_update_rates() { for (uint i = 0; i < LZHAM_ARRAY_SIZE(m_lit_table); i++) m_lit_table[i].reset_update_rate(); for (uint i = 0; i < LZHAM_ARRAY_SIZE(m_delta_lit_table); i++) m_delta_lit_table[i].reset_update_rate(); m_main_table.reset_update_rate(); for (uint i = 0; i < LZHAM_ARRAY_SIZE(m_rep_len_table); i++) m_rep_len_table[i].reset_update_rate(); for (uint i = 0; i < LZHAM_ARRAY_SIZE(m_large_len_table); i++) m_large_len_table[i].reset_update_rate(); m_dist_lsb_table.reset_update_rate(); } //------------------------------------------------------------------------------------------------------------------ // Decompression method. Implemented as a coroutine so it can be paused and resumed to support streaming. //------------------------------------------------------------------------------------------------------------------ template<bool unbuffered> lzham_decompress_status_t lzham_decompressor::decompress() { // Important: This function is a coroutine. ANY locals variables that need to be preserved across coroutine // returns must be either be a member variable, or a local which is saved/restored to a member variable at // the right times. (This makes this function difficult to follow and freaking ugly due to the macros of doom - but hey it works.) // The most often used variables are in locals so the compiler hopefully puts them into CPU registers. symbol_codec &codec = m_codec; const uint dict_size = 1U << m_params.m_dict_size_log2; const uint dict_size_mask = unbuffered ? UINT_MAX : (dict_size - 1); int match_hist0 = 0, match_hist1 = 0, match_hist2 = 0, match_hist3 = 0; uint cur_state = 0, prev_char = 0, prev_prev_char = 0, dst_ofs = 0; const size_t out_buf_size = *m_pOut_buf_size; uint8* pDst = unbuffered ? reinterpret_cast<uint8*>(m_pOut_buf) : reinterpret_cast<uint8*>(m_pDecomp_buf); uint8* pDst_end = unbuffered ? (reinterpret_cast<uint8*>(m_pOut_buf) + out_buf_size) : (reinterpret_cast<uint8*>(m_pDecomp_buf) + dict_size); LZHAM_SYMBOL_CODEC_DECODE_DECLARE(codec); #define LZHAM_SAVE_LOCAL_STATE #define LZHAM_RESTORE_LOCAL_STATE // Important: Do not use any switch() statements below here. LZHAM_CR_BEGIN(m_state) if ((!unbuffered) && (m_params.m_num_seed_bytes)) { LZHAM_BULK_MEMCPY(pDst, m_params.m_pSeed_bytes, m_params.m_num_seed_bytes); dst_ofs += m_params.m_num_seed_bytes; if (dst_ofs >= dict_size) dst_ofs = 0; else m_seed_bytes_to_ignore_when_flushing = dst_ofs; } if (!m_codec.start_decoding(m_pIn_buf, *m_pIn_buf_size, m_no_more_input_bytes_flag, NULL, NULL)) return LZHAM_DECOMP_STATUS_FAILED_INITIALIZING; LZHAM_SYMBOL_CODEC_DECODE_BEGIN(codec); { bool fast_table_updating, use_polar_codes; if (m_params.m_decompress_flags & LZHAM_DECOMP_FLAG_READ_ZLIB_STREAM) { uint check; LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, m_z_cmf, 8); LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, m_z_flg, 8); check = ((m_z_cmf << 8) + m_z_flg) % 31; if ((check != 0) || ((m_z_cmf & 15) != LZHAM_Z_LZHAM)) return LZHAM_DECOMP_STATUS_FAILED_BAD_ZLIB_HEADER; if (m_z_flg & 32) { if ((!m_params.m_pSeed_bytes) || (unbuffered)) return LZHAM_DECOMP_STATUS_FAILED_NEED_SEED_BYTES; m_z_dict_adler32 = 0; for (m_tmp = 0; m_tmp < 4; ++m_tmp) { uint n; LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, n, 8); m_z_dict_adler32 = (m_z_dict_adler32 << 8) | n; } if (adler32(m_params.m_pSeed_bytes, m_params.m_num_seed_bytes) != m_z_dict_adler32) return LZHAM_DECOMP_STATUS_FAILED_BAD_SEED_BYTES; } } { uint tmp; LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, tmp, 2); fast_table_updating = (tmp & 2) != 0; use_polar_codes = (tmp & 1) != 0; } bool succeeded = m_lit_table[0].init(false, 256, fast_table_updating, use_polar_codes); for (uint i = 1; i < LZHAM_ARRAY_SIZE(m_lit_table); i++) succeeded = succeeded && m_lit_table[i].assign(m_lit_table[0]); succeeded = succeeded && m_delta_lit_table[0].init(false, 256, fast_table_updating, use_polar_codes); for (uint i = 1; i < LZHAM_ARRAY_SIZE(m_delta_lit_table); i++) succeeded = succeeded && m_delta_lit_table[i].assign(m_delta_lit_table[0]); succeeded = succeeded && m_main_table.init(false, CLZDecompBase::cLZXNumSpecialLengths + (m_lzBase.m_num_lzx_slots - CLZDecompBase::cLZXLowestUsableMatchSlot) * 8, fast_table_updating, use_polar_codes); for (uint i = 0; i < 2; i++) { succeeded = succeeded && m_rep_len_table[i].init(false, CLZDecompBase::cNumHugeMatchCodes + (CLZDecompBase::cMaxMatchLen - CLZDecompBase::cMinMatchLen + 1), fast_table_updating, use_polar_codes); succeeded = succeeded && m_large_len_table[i].init(false, CLZDecompBase::cNumHugeMatchCodes + CLZDecompBase::cLZXNumSecondaryLengths, fast_table_updating, use_polar_codes); } succeeded = succeeded && m_dist_lsb_table.init(false, 16, fast_table_updating, use_polar_codes); if (!succeeded) return LZHAM_DECOMP_STATUS_FAILED_INITIALIZING; for (uint i = 0; i < LZHAM_ARRAY_SIZE(m_is_match_model); i++) m_is_match_model[i].clear(); for (uint i = 0; i < CLZDecompBase::cNumStates; i++) { m_is_rep_model[i].clear(); m_is_rep0_model[i].clear(); m_is_rep0_single_byte_model[i].clear(); m_is_rep1_model[i].clear(); m_is_rep2_model[i].clear(); } } // Output block loop. do { #ifdef LZHAM_LZDEBUG uint outer_sync_marker; LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, k, 12); LZHAM_VERIFY(outer_sync_marker == 166); #endif // Decode block type. LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, m_block_type, CLZDecompBase::cBlockHeaderBits); if (m_block_type == CLZDecompBase::cSyncBlock) { // Sync block // Reset either the symbol table update rates, or all statistics, then force a coroutine return to give the caller a chance to handle the output right now. LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, m_tmp, CLZDecompBase::cBlockFlushTypeBits); if (m_tmp == 1) reset_huffman_table_update_rates(); else if (m_tmp == 2) reset_all_tables(); LZHAM_SYMBOL_CODEC_DECODE_ALIGN_TO_BYTE(codec); uint n; LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, n, 16); if (n != 0) { LZHAM_SYMBOL_CODEC_DECODE_END(codec); *m_pIn_buf_size = static_cast<size_t>(codec.decode_get_bytes_consumed()); *m_pOut_buf_size = 0; for ( ; ; ) { LZHAM_CR_RETURN(m_state, LZHAM_DECOMP_STATUS_FAILED_BAD_SYNC_BLOCK); } } LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, n, 16); if (n != 0xFFFF) { LZHAM_SYMBOL_CODEC_DECODE_END(codec); *m_pIn_buf_size = static_cast<size_t>(codec.decode_get_bytes_consumed()); *m_pOut_buf_size = 0; for ( ; ; ) { LZHAM_CR_RETURN(m_state, LZHAM_DECOMP_STATUS_FAILED_BAD_SYNC_BLOCK); } } if (m_tmp == 2) { // It's a full flush, so immediately give caller whatever output we have. Also gives the caller a chance to reposition the input stream ptr somewhere else before continuing. // It would be nice to do this with partial flushes too, but the current way the output buffer is flushed makes this tricky. LZHAM_SYMBOL_CODEC_DECODE_END(codec); if ((!unbuffered) && (dst_ofs)) { LZHAM_FLUSH_OUTPUT_BUFFER(dst_ofs); } else { *m_pIn_buf_size = static_cast<size_t>(codec.decode_get_bytes_consumed()); *m_pOut_buf_size = dst_ofs; LZHAM_SAVE_STATE LZHAM_CR_RETURN(m_state, LZHAM_DECOMP_STATUS_NOT_FINISHED); LZHAM_RESTORE_STATE m_codec.decode_set_input_buffer(m_pIn_buf, *m_pIn_buf_size, m_pIn_buf, m_no_more_input_bytes_flag); } LZHAM_SYMBOL_CODEC_DECODE_BEGIN(codec); dst_ofs = 0; } } else if (m_block_type == CLZDecompBase::cRawBlock) { // Raw block handling is complex because we ultimately want to (safely) handle as many bytes as possible using a small number of memcpy()'s. uint num_raw_bytes_remaining; num_raw_bytes_remaining = 0; #undef LZHAM_SAVE_LOCAL_STATE #undef LZHAM_RESTORE_LOCAL_STATE #define LZHAM_SAVE_LOCAL_STATE m_num_raw_bytes_remaining = num_raw_bytes_remaining; #define LZHAM_RESTORE_LOCAL_STATE num_raw_bytes_remaining = m_num_raw_bytes_remaining; // Determine how large this raw block is. LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, num_raw_bytes_remaining, 24); // Get and verify raw block length check bits. uint num_raw_bytes_check_bits; LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, num_raw_bytes_check_bits, 8); uint raw_bytes_remaining0, raw_bytes_remaining1, raw_bytes_remaining2; raw_bytes_remaining0 = num_raw_bytes_remaining & 0xFF; raw_bytes_remaining1 = (num_raw_bytes_remaining >> 8) & 0xFF; raw_bytes_remaining2 = (num_raw_bytes_remaining >> 16) & 0xFF; if (num_raw_bytes_check_bits != ((raw_bytes_remaining0 ^ raw_bytes_remaining1) ^ raw_bytes_remaining2)) { LZHAM_SYMBOL_CODEC_DECODE_END(codec); *m_pIn_buf_size = static_cast<size_t>(codec.decode_get_bytes_consumed()); *m_pOut_buf_size = 0; for ( ; ; ) { LZHAM_CR_RETURN(m_state, LZHAM_DECOMP_STATUS_FAILED_BAD_RAW_BLOCK); } } num_raw_bytes_remaining++; // Discard any partial bytes from the bit buffer (align up to the next byte). LZHAM_SYMBOL_CODEC_DECODE_ALIGN_TO_BYTE(codec); // Flush any full bytes from the bit buffer. do { int b; LZHAM_SYMBOL_CODEC_DECODE_REMOVE_BYTE_FROM_BIT_BUF(codec, b); if (b < 0) break; if ((unbuffered) && (dst_ofs >= out_buf_size)) { LZHAM_SYMBOL_CODEC_DECODE_END(codec); *m_pIn_buf_size = static_cast<size_t>(codec.decode_get_bytes_consumed()); *m_pOut_buf_size = 0; for ( ; ; ) { LZHAM_CR_RETURN(m_state, LZHAM_DECOMP_STATUS_FAILED_DEST_BUF_TOO_SMALL); } } pDst[dst_ofs++] = static_cast<uint8>(b); if ((!unbuffered) && (dst_ofs > dict_size_mask)) { LZHAM_SYMBOL_CODEC_DECODE_END(codec); LZHAM_FLUSH_OUTPUT_BUFFER(dict_size); LZHAM_SYMBOL_CODEC_DECODE_BEGIN(codec); dst_ofs = 0; } num_raw_bytes_remaining--; } while (num_raw_bytes_remaining); LZHAM_SYMBOL_CODEC_DECODE_END(codec); // Now handle the bulk of the raw data with memcpy(). while (num_raw_bytes_remaining) { uint64 in_buf_ofs, in_buf_remaining; in_buf_ofs = codec.decode_get_bytes_consumed(); in_buf_remaining = *m_pIn_buf_size - in_buf_ofs; while (!in_buf_remaining) { // We need more bytes from the caller. *m_pIn_buf_size = static_cast<size_t>(in_buf_ofs); *m_pOut_buf_size = 0; if (m_no_more_input_bytes_flag) { for ( ; ; ) { LZHAM_CR_RETURN(m_state, LZHAM_DECOMP_STATUS_FAILED_EXPECTED_MORE_RAW_BYTES); } } LZHAM_SAVE_STATE LZHAM_CR_RETURN(m_state, LZHAM_DECOMP_STATUS_NEEDS_MORE_INPUT); LZHAM_RESTORE_STATE m_codec.decode_set_input_buffer(m_pIn_buf, *m_pIn_buf_size, m_pIn_buf, m_no_more_input_bytes_flag); in_buf_ofs = 0; in_buf_remaining = *m_pIn_buf_size; } // Determine how many bytes we can safely memcpy() in a single call. uint num_bytes_to_copy; num_bytes_to_copy = static_cast<uint>(LZHAM_MIN(num_raw_bytes_remaining, in_buf_remaining)); if (!unbuffered) num_bytes_to_copy = LZHAM_MIN(num_bytes_to_copy, dict_size - dst_ofs); if ((unbuffered) && ((dst_ofs + num_bytes_to_copy) > out_buf_size)) { // Output buffer is not large enough. *m_pIn_buf_size = static_cast<size_t>(in_buf_ofs); *m_pOut_buf_size = 0; for ( ; ; ) { LZHAM_CR_RETURN(m_state, LZHAM_DECOMP_STATUS_FAILED_DEST_BUF_TOO_SMALL); } } // Copy the raw bytes. LZHAM_BULK_MEMCPY(pDst + dst_ofs, m_pIn_buf + in_buf_ofs, num_bytes_to_copy); in_buf_ofs += num_bytes_to_copy; num_raw_bytes_remaining -= num_bytes_to_copy; codec.decode_set_input_buffer(m_pIn_buf, *m_pIn_buf_size, m_pIn_buf + in_buf_ofs, m_no_more_input_bytes_flag); dst_ofs += num_bytes_to_copy; if ((!unbuffered) && (dst_ofs > dict_size_mask)) { LZHAM_ASSERT(dst_ofs == dict_size); LZHAM_FLUSH_OUTPUT_BUFFER(dict_size); dst_ofs = 0; } } LZHAM_SYMBOL_CODEC_DECODE_BEGIN(codec); #undef LZHAM_SAVE_LOCAL_STATE #undef LZHAM_RESTORE_LOCAL_STATE #define LZHAM_SAVE_LOCAL_STATE #define LZHAM_RESTORE_LOCAL_STATE } else if (m_block_type == CLZDecompBase::cCompBlock) { LZHAM_SYMBOL_CODEC_DECODE_ARITH_START(codec) match_hist0 = 1; match_hist1 = 1; match_hist2 = 1; match_hist3 = 1; cur_state = 0; prev_char = 0; prev_prev_char = 0; m_start_block_dst_ofs = dst_ofs; { uint block_flush_type; LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, block_flush_type, CLZDecompBase::cBlockFlushTypeBits); if (block_flush_type == 1) reset_huffman_table_update_rates(); else if (block_flush_type == 2) reset_all_tables(); } #ifdef LZHAM_LZDEBUG m_initial_step = m_step; m_block_step = 0; for ( ; ; m_step++, m_block_step++) #else for ( ; ; ) #endif { #ifdef LZHAM_LZDEBUG uint sync_marker; LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, x, CLZDecompBase::cLZHAMDebugSyncMarkerBits); LZHAM_VERIFY(sync_marker == CLZDecompBase::cLZHAMDebugSyncMarkerValue); LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, m_debug_is_match, 1); LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, m_debug_match_len, 17); uint debug_cur_state; LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, debug_cur_state, 4); LZHAM_VERIFY(cur_state == debug_cur_state); #endif #ifdef _DEBUG { uint total_block_bytes = ((dst_ofs - m_start_block_dst_ofs) & dict_size_mask); if (total_block_bytes > 0) { LZHAM_ASSERT(prev_char == pDst[(dst_ofs - 1) & dict_size_mask]); } else { LZHAM_ASSERT(prev_char == 0); } if (total_block_bytes > 1) { LZHAM_ASSERT(prev_prev_char == pDst[(dst_ofs - 2) & dict_size_mask]); } else { LZHAM_ASSERT(prev_prev_char == 0); } } #endif // Read "is match" bit. uint match_model_index; match_model_index = LZHAM_IS_MATCH_MODEL_INDEX(prev_char, cur_state); LZHAM_ASSERT(match_model_index < LZHAM_ARRAY_SIZE(m_is_match_model)); uint is_match_bit; LZHAM_SYMBOL_CODEC_DECODE_ARITH_BIT(codec, is_match_bit, m_is_match_model[match_model_index]); #ifdef LZHAM_LZDEBUG LZHAM_VERIFY(is_match_bit == m_debug_is_match); #endif if (LZHAM_BUILTIN_EXPECT(!is_match_bit, 0)) { // Handle literal. #ifdef LZHAM_LZDEBUG LZHAM_VERIFY(m_debug_match_len == 1); #endif #ifdef LZHAM_LZDEBUG LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, m_debug_lit, 8); #endif if ((unbuffered) && (LZHAM_BUILTIN_EXPECT(dst_ofs >= out_buf_size, 0))) { LZHAM_SYMBOL_CODEC_DECODE_END(codec); *m_pIn_buf_size = static_cast<size_t>(codec.decode_get_bytes_consumed()); *m_pOut_buf_size = 0; for ( ; ; ) { LZHAM_CR_RETURN(m_state, LZHAM_DECOMP_STATUS_FAILED_DEST_BUF_TOO_SMALL); } } if (LZHAM_BUILTIN_EXPECT(cur_state < CLZDecompBase::cNumLitStates, 1)) { // Regular literal uint lit_pred; lit_pred = (prev_char >> (8 - CLZDecompBase::cNumLitPredBits / 2)) | (prev_prev_char >> (8 - CLZDecompBase::cNumLitPredBits / 2)) << (CLZDecompBase::cNumLitPredBits / 2); uint r; LZHAM_DECOMPRESS_DECODE_ADAPTIVE_SYMBOL(codec, r, m_lit_table[lit_pred]); pDst[dst_ofs] = static_cast<uint8>(r); prev_prev_char = prev_char; prev_char = r; #ifdef LZHAM_LZDEBUG LZHAM_VERIFY(pDst[dst_ofs] == m_debug_lit); #endif } else { // Delta literal uint match_hist0_ofs, rep_lit0, rep_lit1; // Determine delta literal's partial context. match_hist0_ofs = dst_ofs - match_hist0; rep_lit0 = pDst[match_hist0_ofs & dict_size_mask]; rep_lit1 = pDst[(match_hist0_ofs - 1) & dict_size_mask]; uint lit_pred; lit_pred = (rep_lit0 >> (8 - CLZDecompBase::cNumDeltaLitPredBits / 2)) | ((rep_lit1 >> (8 - CLZDecompBase::cNumDeltaLitPredBits / 2)) << CLZDecompBase::cNumDeltaLitPredBits / 2); #undef LZHAM_SAVE_LOCAL_STATE #undef LZHAM_RESTORE_LOCAL_STATE #define LZHAM_SAVE_LOCAL_STATE m_rep_lit0 = rep_lit0; #define LZHAM_RESTORE_LOCAL_STATE rep_lit0 = m_rep_lit0; #ifdef LZHAM_LZDEBUG uint debug_rep_lit0; LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, debug_rep_lit0, 8); LZHAM_VERIFY(debug_rep_lit0 == rep_lit0); #endif uint r; LZHAM_DECOMPRESS_DECODE_ADAPTIVE_SYMBOL(codec, r, m_delta_lit_table[lit_pred]); r ^= rep_lit0; pDst[dst_ofs] = static_cast<uint8>(r); prev_prev_char = prev_char; prev_char = r; #ifdef LZHAM_LZDEBUG LZHAM_VERIFY(pDst[dst_ofs] == m_debug_lit); #endif #undef LZHAM_SAVE_LOCAL_STATE #undef LZHAM_RESTORE_LOCAL_STATE #define LZHAM_SAVE_LOCAL_STATE #define LZHAM_RESTORE_LOCAL_STATE } cur_state = s_literal_next_state[cur_state]; dst_ofs++; if ((!unbuffered) && (LZHAM_BUILTIN_EXPECT(dst_ofs > dict_size_mask, 0))) { LZHAM_SYMBOL_CODEC_DECODE_END(codec); LZHAM_FLUSH_OUTPUT_BUFFER(dict_size); LZHAM_SYMBOL_CODEC_DECODE_BEGIN(codec); dst_ofs = 0; } } else { // Handle match. uint match_len; match_len = 1; #undef LZHAM_SAVE_LOCAL_STATE #undef LZHAM_RESTORE_LOCAL_STATE #define LZHAM_SAVE_LOCAL_STATE m_match_len = match_len; #define LZHAM_RESTORE_LOCAL_STATE match_len = m_match_len; // Determine if match is a rep_match, and if so what type. uint is_rep; LZHAM_SYMBOL_CODEC_DECODE_ARITH_BIT(codec, is_rep, m_is_rep_model[cur_state]); if (LZHAM_BUILTIN_EXPECT(is_rep, 1)) { uint is_rep0; LZHAM_SYMBOL_CODEC_DECODE_ARITH_BIT(codec, is_rep0, m_is_rep0_model[cur_state]); if (LZHAM_BUILTIN_EXPECT(is_rep0, 1)) { uint is_rep0_len1; LZHAM_SYMBOL_CODEC_DECODE_ARITH_BIT(codec, is_rep0_len1, m_is_rep0_single_byte_model[cur_state]); if (LZHAM_BUILTIN_EXPECT(is_rep0_len1, 1)) { cur_state = (cur_state < CLZDecompBase::cNumLitStates) ? 9 : 11; } else { LZHAM_DECOMPRESS_DECODE_ADAPTIVE_SYMBOL(codec, match_len, m_rep_len_table[cur_state >= CLZDecompBase::cNumLitStates]); match_len += CLZDecompBase::cMinMatchLen; if (match_len == (CLZDecompBase::cMaxMatchLen + 1)) { // Decode "huge" match length. match_len = 0; do { uint b; LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, b, 1); if (!b) break; match_len++; } while (match_len < 3); uint k; LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, k, s_huge_match_code_len[match_len]); match_len = s_huge_match_base_len[match_len] + k; } cur_state = (cur_state < CLZDecompBase::cNumLitStates) ? 8 : 11; } } else { LZHAM_DECOMPRESS_DECODE_ADAPTIVE_SYMBOL(codec, match_len, m_rep_len_table[cur_state >= CLZDecompBase::cNumLitStates]); match_len += CLZDecompBase::cMinMatchLen; if (match_len == (CLZDecompBase::cMaxMatchLen + 1)) { // Decode "huge" match length. match_len = 0; do { uint b; LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, b, 1); if (!b) break; match_len++; } while (match_len < 3); uint k; LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, k, s_huge_match_code_len[match_len]); match_len = s_huge_match_base_len[match_len] + k; } uint is_rep1; LZHAM_SYMBOL_CODEC_DECODE_ARITH_BIT(codec, is_rep1, m_is_rep1_model[cur_state]); if (LZHAM_BUILTIN_EXPECT(is_rep1, 1)) { uint temp = match_hist1; match_hist1 = match_hist0; match_hist0 = temp; } else { uint is_rep2; LZHAM_SYMBOL_CODEC_DECODE_ARITH_BIT(codec, is_rep2, m_is_rep2_model[cur_state]); if (LZHAM_BUILTIN_EXPECT(is_rep2, 1)) { // rep2 uint temp = match_hist2; match_hist2 = match_hist1; match_hist1 = match_hist0; match_hist0 = temp; } else { // rep3 uint temp = match_hist3; match_hist3 = match_hist2; match_hist2 = match_hist1; match_hist1 = match_hist0; match_hist0 = temp; } } cur_state = (cur_state < CLZDecompBase::cNumLitStates) ? 8 : 11; } } else { // Handle normal/full match. uint sym; LZHAM_DECOMPRESS_DECODE_ADAPTIVE_SYMBOL(codec, sym, m_main_table); sym -= CLZDecompBase::cLZXNumSpecialLengths; if (LZHAM_BUILTIN_EXPECT(static_cast<int>(sym) < 0, 0)) { // Handle special symbols. if (static_cast<int>(sym) == (CLZDecompBase::cLZXSpecialCodeEndOfBlockCode - CLZDecompBase::cLZXNumSpecialLengths)) break; else { // Must be cLZXSpecialCodePartialStateReset. match_hist0 = 1; match_hist1 = 1; match_hist2 = 1; match_hist3 = 1; cur_state = 0; continue; } } // Low 3 bits of symbol = match length category, higher bits = distance category. match_len = (sym & 7) + 2; uint match_slot; match_slot = (sym >> 3) + CLZDecompBase::cLZXLowestUsableMatchSlot; #undef LZHAM_SAVE_LOCAL_STATE #undef LZHAM_RESTORE_LOCAL_STATE #define LZHAM_SAVE_LOCAL_STATE m_match_len = match_len; m_match_slot = match_slot; #define LZHAM_RESTORE_LOCAL_STATE match_len = m_match_len; match_slot = m_match_slot; if (LZHAM_BUILTIN_EXPECT(match_len == 9, 0)) { // Match is >= 9 bytes, decode the actual length. uint e; LZHAM_DECOMPRESS_DECODE_ADAPTIVE_SYMBOL(codec, e, m_large_len_table[cur_state >= CLZDecompBase::cNumLitStates]); match_len += e; if (match_len == (CLZDecompBase::cMaxMatchLen + 1)) { // Decode "huge" match length. match_len = 0; do { uint b; LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, b, 1); if (!b) break; match_len++; } while (match_len < 3); uint k; LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, k, s_huge_match_code_len[match_len]); match_len = s_huge_match_base_len[match_len] + k; } } uint num_extra_bits; num_extra_bits = m_lzBase.m_lzx_position_extra_bits[match_slot]; uint extra_bits; #undef LZHAM_SAVE_LOCAL_STATE #undef LZHAM_RESTORE_LOCAL_STATE #define LZHAM_SAVE_LOCAL_STATE m_match_len = match_len; m_match_slot = match_slot; m_num_extra_bits = num_extra_bits; #define LZHAM_RESTORE_LOCAL_STATE match_len = m_match_len; match_slot = m_match_slot; num_extra_bits = m_num_extra_bits; if (LZHAM_BUILTIN_EXPECT(num_extra_bits < 3, 0)) { LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, extra_bits, num_extra_bits); } else { extra_bits = 0; if (LZHAM_BUILTIN_EXPECT(num_extra_bits > 4, 1)) { LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, extra_bits, num_extra_bits - 4); extra_bits <<= 4; } #undef LZHAM_SAVE_LOCAL_STATE #undef LZHAM_RESTORE_LOCAL_STATE #define LZHAM_SAVE_LOCAL_STATE m_match_len = match_len; m_match_slot = match_slot; m_extra_bits = extra_bits; #define LZHAM_RESTORE_LOCAL_STATE match_len = m_match_len; match_slot = m_match_slot; extra_bits = m_extra_bits; uint j; LZHAM_DECOMPRESS_DECODE_ADAPTIVE_SYMBOL(codec, j, m_dist_lsb_table); extra_bits += j; } match_hist3 = match_hist2; match_hist2 = match_hist1; match_hist1 = match_hist0; match_hist0 = m_lzBase.m_lzx_position_base[match_slot] + extra_bits; cur_state = (cur_state < CLZDecompBase::cNumLitStates) ? CLZDecompBase::cNumLitStates : CLZDecompBase::cNumLitStates + 3; #undef LZHAM_SAVE_LOCAL_STATE #undef LZHAM_RESTORE_LOCAL_STATE #define LZHAM_SAVE_LOCAL_STATE m_match_len = match_len; #define LZHAM_RESTORE_LOCAL_STATE match_len = m_match_len; } // We have the match's length and distance, now do the copy. #ifdef LZHAM_LZDEBUG LZHAM_VERIFY(match_len == m_debug_match_len); LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, m_debug_match_dist, 25); uint d; LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, d, 4); m_debug_match_dist = (m_debug_match_dist << 4) | d; LZHAM_VERIFY((uint)match_hist0 == m_debug_match_dist); #endif if ( (unbuffered) && LZHAM_BUILTIN_EXPECT((((size_t)match_hist0 > dst_ofs) || ((dst_ofs + match_len) > out_buf_size)), 0) ) { LZHAM_SYMBOL_CODEC_DECODE_END(codec); *m_pIn_buf_size = static_cast<size_t>(codec.decode_get_bytes_consumed()); *m_pOut_buf_size = 0; for ( ; ; ) { LZHAM_CR_RETURN(m_state, LZHAM_DECOMP_STATUS_FAILED_BAD_CODE); } } uint src_ofs; const uint8* pCopy_src; src_ofs = (dst_ofs - match_hist0) & dict_size_mask; pCopy_src = pDst + src_ofs; #undef LZHAM_SAVE_LOCAL_STATE #undef LZHAM_RESTORE_LOCAL_STATE #define LZHAM_SAVE_LOCAL_STATE m_match_len = match_len; m_src_ofs = src_ofs; m_pCopy_src = pCopy_src; #define LZHAM_RESTORE_LOCAL_STATE match_len = m_match_len; src_ofs = m_src_ofs; pCopy_src = m_pCopy_src; if ( (!unbuffered) && LZHAM_BUILTIN_EXPECT( ((LZHAM_MAX(src_ofs, dst_ofs) + match_len) > dict_size_mask), 0) ) { // Match source or destination wraps around the end of the dictionary to the beginning, so handle the copy one byte at a time. do { uint8 c; c = *pCopy_src++; prev_prev_char = prev_char; prev_char = c; pDst[dst_ofs++] = c; if (LZHAM_BUILTIN_EXPECT(pCopy_src == pDst_end, 0)) pCopy_src = pDst; if (LZHAM_BUILTIN_EXPECT(dst_ofs > dict_size_mask, 0)) { LZHAM_SYMBOL_CODEC_DECODE_END(codec); LZHAM_FLUSH_OUTPUT_BUFFER(dict_size); LZHAM_SYMBOL_CODEC_DECODE_BEGIN(codec); dst_ofs = 0; } match_len--; } while (LZHAM_BUILTIN_EXPECT(match_len > 0, 1)); } else { uint8* pCopy_dst = pDst + dst_ofs; if (LZHAM_BUILTIN_EXPECT(match_hist0 == 1, 0)) { // Handle byte runs. uint8 c = *pCopy_src; if (LZHAM_BUILTIN_EXPECT(match_len < 8, 1)) { for (int i = match_len; i > 0; i--) *pCopy_dst++ = c; if (LZHAM_BUILTIN_EXPECT(match_len == 1, 1)) prev_prev_char = prev_char; else prev_prev_char = c; } else { memset(pCopy_dst, c, match_len); prev_prev_char = c; } prev_char = c; } else if (LZHAM_BUILTIN_EXPECT(match_len == 1, 1)) { // Handle single byte matches. prev_prev_char = prev_char; prev_char = *pCopy_src; *pCopy_dst = static_cast<uint8>(prev_char); } else { // Handle matches of length 2 or higher. uint bytes_to_copy = match_len - 2; if (LZHAM_BUILTIN_EXPECT(((bytes_to_copy < 8) || ((int)bytes_to_copy > match_hist0)), 1)) { for (int i = bytes_to_copy; i > 0; i--) *pCopy_dst++ = *pCopy_src++; } else { LZHAM_MEMCPY(pCopy_dst, pCopy_src, bytes_to_copy); pCopy_dst += bytes_to_copy; pCopy_src += bytes_to_copy; } // Handle final 2 bytes of match specially, because we always track the last 2 bytes output in // local variables (needed for computing context) to avoid load hit stores on some CPU's. prev_prev_char = *pCopy_src++; *pCopy_dst++ = static_cast<uint8>(prev_prev_char); prev_char = *pCopy_src++; *pCopy_dst++ = static_cast<uint8>(prev_char); } dst_ofs += match_len; } } // lit or match #undef LZHAM_SAVE_LOCAL_STATE #undef LZHAM_RESTORE_LOCAL_STATE #define LZHAM_SAVE_LOCAL_STATE #define LZHAM_RESTORE_LOCAL_STATE } // for ( ; ; ) #ifdef LZHAM_LZDEBUG uint end_sync_marker; LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, end_sync_marker, 12); LZHAM_VERIFY(end_sync_marker == 366); #endif LZHAM_SYMBOL_CODEC_DECODE_ALIGN_TO_BYTE(codec); } else if (m_block_type == CLZDecompBase::cEOFBlock) { // Received EOF. m_status = LZHAM_DECOMP_STATUS_SUCCESS; } else { // This block type is currently undefined. m_status = LZHAM_DECOMP_STATUS_FAILED_BAD_CODE; } m_block_index++; } while (m_status == LZHAM_DECOMP_STATUS_NOT_FINISHED); if ((!unbuffered) && (dst_ofs)) { LZHAM_SYMBOL_CODEC_DECODE_END(codec); LZHAM_FLUSH_OUTPUT_BUFFER(dst_ofs); LZHAM_SYMBOL_CODEC_DECODE_BEGIN(codec); } if (m_status == LZHAM_DECOMP_STATUS_SUCCESS) { LZHAM_SYMBOL_CODEC_DECODE_ALIGN_TO_BYTE(codec); LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, m_file_src_file_adler32, 16); uint l; LZHAM_SYMBOL_CODEC_DECODE_GET_BITS(codec, l, 16); m_file_src_file_adler32 = (m_file_src_file_adler32 << 16) | l; if (m_params.m_decompress_flags & LZHAM_DECOMP_FLAG_COMPUTE_ADLER32) { if (unbuffered) { m_decomp_adler32 = adler32(pDst, dst_ofs, cInitAdler32); } if (m_file_src_file_adler32 != m_decomp_adler32) { m_status = LZHAM_DECOMP_STATUS_FAILED_ADLER32; } } else { m_decomp_adler32 = m_file_src_file_adler32; } } LZHAM_SYMBOL_CODEC_DECODE_END(codec); *m_pIn_buf_size = static_cast<size_t>(codec.stop_decoding()); *m_pOut_buf_size = unbuffered ? dst_ofs : 0; LZHAM_CR_RETURN(m_state, m_status); for ( ; ; ) { *m_pIn_buf_size = 0; *m_pOut_buf_size = 0; LZHAM_CR_RETURN(m_state, m_status); } LZHAM_CR_FINISH return m_status; } static bool check_params(const lzham_decompress_params *pParams) { if ((!pParams) || (pParams->m_struct_size != sizeof(lzham_decompress_params))) return false; if ((pParams->m_dict_size_log2 < CLZDecompBase::cMinDictSizeLog2) || (pParams->m_dict_size_log2 > CLZDecompBase::cMaxDictSizeLog2)) return false; if (pParams->m_num_seed_bytes) { if (((pParams->m_decompress_flags & LZHAM_DECOMP_FLAG_OUTPUT_UNBUFFERED) != 0) || (!pParams->m_pSeed_bytes)) return false; if (pParams->m_num_seed_bytes > (1U << pParams->m_dict_size_log2)) return false; } return true; } lzham_decompress_state_ptr LZHAM_CDECL lzham_lib_decompress_init(const lzham_decompress_params *pParams) { LZHAM_ASSUME(CLZDecompBase::cMinDictSizeLog2 == LZHAM_MIN_DICT_SIZE_LOG2); LZHAM_ASSUME(CLZDecompBase::cMaxDictSizeLog2 == LZHAM_MAX_DICT_SIZE_LOG2_X64); if (!check_params(pParams)) return NULL; lzham_decompressor *pState = lzham_new<lzham_decompressor>(); if (!pState) return NULL; pState->m_params = *pParams; if (pState->m_params.m_decompress_flags & LZHAM_DECOMP_FLAG_OUTPUT_UNBUFFERED) { pState->m_pRaw_decomp_buf = NULL; pState->m_raw_decomp_buf_size = 0; pState->m_pDecomp_buf = NULL; } else { uint32 decomp_buf_size = 1U << pState->m_params.m_dict_size_log2; pState->m_pRaw_decomp_buf = static_cast<uint8*>(lzham_malloc(decomp_buf_size + 15)); if (!pState->m_pRaw_decomp_buf) { lzham_delete(pState); return NULL; } pState->m_raw_decomp_buf_size = decomp_buf_size; pState->m_pDecomp_buf = math::align_up_pointer(pState->m_pRaw_decomp_buf, 16); } pState->init(); return pState; } lzham_decompress_state_ptr LZHAM_CDECL lzham_lib_decompress_reinit(lzham_decompress_state_ptr p, const lzham_decompress_params *pParams) { if (!p) return lzham_lib_decompress_init(pParams); lzham_decompressor *pState = static_cast<lzham_decompressor *>(p); if (!check_params(pParams)) return NULL; if (pState->m_params.m_decompress_flags & LZHAM_DECOMP_FLAG_OUTPUT_UNBUFFERED) { lzham_free(pState->m_pRaw_decomp_buf); pState->m_pRaw_decomp_buf = NULL; pState->m_raw_decomp_buf_size = 0; pState->m_pDecomp_buf = NULL; } else { uint32 new_dict_size = 1U << pState->m_params.m_dict_size_log2; if ((!pState->m_pRaw_decomp_buf) || (pState->m_raw_decomp_buf_size < new_dict_size)) { uint8 *pNew_dict = static_cast<uint8*>(lzham_realloc(pState->m_pRaw_decomp_buf, new_dict_size + 15)); if (!pNew_dict) return NULL; pState->m_pRaw_decomp_buf = pNew_dict; pState->m_raw_decomp_buf_size = new_dict_size; pState->m_pDecomp_buf = math::align_up_pointer(pState->m_pRaw_decomp_buf, 16); } } pState->m_params = *pParams; pState->init(); return pState; } uint32 LZHAM_CDECL lzham_lib_decompress_deinit(lzham_decompress_state_ptr p) { lzham_decompressor *pState = static_cast<lzham_decompressor *>(p); if (!pState) return 0; uint32 adler32 = pState->m_decomp_adler32; lzham_free(pState->m_pRaw_decomp_buf); lzham_delete(pState); return adler32; } lzham_decompress_status_t LZHAM_CDECL lzham_lib_decompress( lzham_decompress_state_ptr p, const lzham_uint8 *pIn_buf, size_t *pIn_buf_size, lzham_uint8 *pOut_buf, size_t *pOut_buf_size, lzham_bool no_more_input_bytes_flag) { lzham_decompressor *pState = static_cast<lzham_decompressor *>(p); if ((!pState) || (!pState->m_params.m_dict_size_log2) || (!pIn_buf_size) || (!pOut_buf_size)) { return LZHAM_DECOMP_STATUS_INVALID_PARAMETER; } if ((*pIn_buf_size) && (!pIn_buf)) { return LZHAM_DECOMP_STATUS_INVALID_PARAMETER; } if ((*pOut_buf_size) && (!pOut_buf)) { return LZHAM_DECOMP_STATUS_INVALID_PARAMETER; } pState->m_pIn_buf = pIn_buf; pState->m_pIn_buf_size = pIn_buf_size; pState->m_pOut_buf = pOut_buf; pState->m_pOut_buf_size = pOut_buf_size; pState->m_no_more_input_bytes_flag = (no_more_input_bytes_flag != 0); if (pState->m_params.m_decompress_flags & LZHAM_DECOMP_FLAG_OUTPUT_UNBUFFERED) { if (!pState->m_pOrig_out_buf) { pState->m_pOrig_out_buf = pOut_buf; pState->m_orig_out_buf_size = *pOut_buf_size; } else { if ((pState->m_pOrig_out_buf != pOut_buf) || (pState->m_orig_out_buf_size != *pOut_buf_size)) { return LZHAM_DECOMP_STATUS_INVALID_PARAMETER; } } } lzham_decompress_status_t status; if (pState->m_params.m_decompress_flags & LZHAM_DECOMP_FLAG_OUTPUT_UNBUFFERED) status = pState->decompress<true>(); else status = pState->decompress<false>(); return status; } lzham_decompress_status_t LZHAM_CDECL lzham_lib_decompress_memory(const lzham_decompress_params *pParams, lzham_uint8* pDst_buf, size_t *pDst_len, const lzham_uint8* pSrc_buf, size_t src_len, lzham_uint32 *pAdler32) { if (!pParams) return LZHAM_DECOMP_STATUS_INVALID_PARAMETER; lzham_decompress_params params(*pParams); params.m_decompress_flags |= LZHAM_DECOMP_FLAG_OUTPUT_UNBUFFERED; lzham_decompress_state_ptr pState = lzham_lib_decompress_init(¶ms); if (!pState) return LZHAM_DECOMP_STATUS_FAILED_INITIALIZING; lzham_decompress_status_t status = lzham_lib_decompress(pState, pSrc_buf, &src_len, pDst_buf, pDst_len, true); uint32 adler32 = lzham_lib_decompress_deinit(pState); if (pAdler32) *pAdler32 = adler32; return status; } // ----------------- zlib-style API's int LZHAM_CDECL lzham_lib_z_inflateInit(lzham_z_streamp pStream) { return lzham_lib_z_inflateInit2(pStream, LZHAM_Z_DEFAULT_WINDOW_BITS); } int LZHAM_CDECL lzham_lib_z_inflateInit2(lzham_z_streamp pStream, int window_bits) { if (!pStream) return LZHAM_Z_STREAM_ERROR; #ifdef LZHAM_Z_API_FORCE_WINDOW_BITS window_bits = LZHAM_Z_API_FORCE_WINDOW_BITS; #endif int max_window_bits = LZHAM_64BIT_POINTERS ? LZHAM_MAX_DICT_SIZE_LOG2_X64 : LZHAM_MAX_DICT_SIZE_LOG2_X86; if (labs(window_bits) > max_window_bits) return LZHAM_Z_PARAM_ERROR; if (labs(window_bits) < LZHAM_MIN_DICT_SIZE_LOG2) window_bits = (window_bits < 0) ? -LZHAM_MIN_DICT_SIZE_LOG2 : LZHAM_MIN_DICT_SIZE_LOG2; lzham_decompress_params params; utils::zero_object(params); params.m_struct_size = sizeof(lzham_decompress_params); params.m_dict_size_log2 = labs(window_bits); params.m_decompress_flags = LZHAM_DECOMP_FLAG_COMPUTE_ADLER32; if (window_bits > 0) params.m_decompress_flags |= LZHAM_DECOMP_FLAG_READ_ZLIB_STREAM; lzham_decompress_state_ptr pState = lzham_lib_decompress_init(¶ms); if (!pState) return LZHAM_Z_MEM_ERROR; pStream->state = static_cast<lzham_z_internal_state *>(pState); pStream->data_type = 0; pStream->adler = LZHAM_Z_ADLER32_INIT; pStream->msg = NULL; pStream->total_in = 0; pStream->total_out = 0; pStream->reserved = 0; return LZHAM_Z_OK; } int LZHAM_CDECL lzham_lib_z_inflateReset(lzham_z_streamp pStream) { if ((!pStream) || (!pStream->state)) return LZHAM_Z_STREAM_ERROR; lzham_decompress_state_ptr pState = static_cast<lzham_decompress_state_ptr>(pStream->state); lzham_decompressor *pDecomp = static_cast<lzham_decompressor *>(pState); lzham_decompress_params params(pDecomp->m_params); if (!lzham_lib_decompress_reinit(pState, ¶ms)) return LZHAM_Z_STREAM_ERROR; return LZHAM_Z_OK; } int LZHAM_CDECL lzham_lib_z_inflate(lzham_z_streamp pStream, int flush) { if ((!pStream) || (!pStream->state)) return LZHAM_Z_STREAM_ERROR; if ((flush == LZHAM_Z_PARTIAL_FLUSH) || (flush == LZHAM_Z_FULL_FLUSH)) flush = LZHAM_Z_SYNC_FLUSH; if (flush) { if ((flush != LZHAM_Z_SYNC_FLUSH) && (flush != LZHAM_Z_FINISH)) return LZHAM_Z_STREAM_ERROR; } size_t orig_avail_in = pStream->avail_in; lzham_decompress_state_ptr pState = static_cast<lzham_decompress_state_ptr>(pStream->state); lzham_decompressor *pDecomp = static_cast<lzham_decompressor *>(pState); if (pDecomp->m_z_last_status >= LZHAM_DECOMP_STATUS_FIRST_SUCCESS_OR_FAILURE_CODE) return LZHAM_Z_DATA_ERROR; if (pDecomp->m_z_has_flushed && (flush != LZHAM_Z_FINISH)) return LZHAM_Z_STREAM_ERROR; pDecomp->m_z_has_flushed |= (flush == LZHAM_Z_FINISH); lzham_decompress_status_t status; for ( ; ; ) { size_t in_bytes = pStream->avail_in; size_t out_bytes = pStream->avail_out; lzham_bool no_more_input_bytes_flag = (flush == LZHAM_Z_FINISH); status = lzham_lib_decompress(pState, pStream->next_in, &in_bytes, pStream->next_out, &out_bytes, no_more_input_bytes_flag); pDecomp->m_z_last_status = status; pStream->next_in += (uint)in_bytes; pStream->avail_in -= (uint)in_bytes; pStream->total_in += (uint)in_bytes; pStream->adler = pDecomp->m_decomp_adler32; pStream->next_out += (uint)out_bytes; pStream->avail_out -= (uint)out_bytes; pStream->total_out += (uint)out_bytes; if (status >= LZHAM_DECOMP_STATUS_FIRST_FAILURE_CODE) { if (status == LZHAM_DECOMP_STATUS_FAILED_NEED_SEED_BYTES) return LZHAM_Z_NEED_DICT; else return LZHAM_Z_DATA_ERROR; // Stream is corrupted (there could be some uncompressed data left in the output dictionary - oh well). } if ((status == LZHAM_DECOMP_STATUS_NEEDS_MORE_INPUT) && (!orig_avail_in)) return LZHAM_Z_BUF_ERROR; // Signal caller that we can't make forward progress without supplying more input, or by setting flush to LZHAM_Z_FINISH. else if (flush == LZHAM_Z_FINISH) { // Caller has indicated that all remaining input was at next_in, and all remaining output will fit entirely in next_out. // (The output buffer at next_out MUST be large to hold the remaining uncompressed data when flush==LZHAM_Z_FINISH). if (status == LZHAM_DECOMP_STATUS_SUCCESS) return LZHAM_Z_STREAM_END; // If status is LZHAM_DECOMP_STATUS_HAS_MORE_OUTPUT, there must be at least 1 more byte on the way but the caller to lzham_decompress() supplied an empty output buffer. // Something is wrong because the caller's output buffer should be large enough to hold the entire decompressed stream when flush==LZHAM_Z_FINISH. else if (status == LZHAM_DECOMP_STATUS_HAS_MORE_OUTPUT) return LZHAM_Z_BUF_ERROR; } else if ((status == LZHAM_DECOMP_STATUS_SUCCESS) || (!pStream->avail_in) || (!pStream->avail_out)) break; } return (status == LZHAM_DECOMP_STATUS_SUCCESS) ? LZHAM_Z_STREAM_END : LZHAM_Z_OK; } int LZHAM_CDECL lzham_lib_z_inflateEnd(lzham_z_streamp pStream) { if (!pStream) return LZHAM_Z_STREAM_ERROR; lzham_decompress_state_ptr pState = static_cast<lzham_decompress_state_ptr>(pStream->state); if (pState) { pStream->adler = lzham_lib_decompress_deinit(pState); pStream->state = NULL; } return LZHAM_Z_OK; } int LZHAM_CDECL lzham_lib_z_uncompress(unsigned char *pDest, lzham_z_ulong *pDest_len, const unsigned char *pSource, lzham_z_ulong source_len) { lzham_z_stream stream; int status; memset(&stream, 0, sizeof(stream)); // In case lzham_z_ulong is 64-bits (argh I hate longs). if ((source_len | *pDest_len) > 0xFFFFFFFFU) return LZHAM_Z_PARAM_ERROR; stream.next_in = pSource; stream.avail_in = (uint)source_len; stream.next_out = pDest; stream.avail_out = (uint)*pDest_len; status = lzham_lib_z_inflateInit(&stream); if (status != LZHAM_Z_OK) return status; status = lzham_lib_z_inflate(&stream, LZHAM_Z_FINISH); if (status != LZHAM_Z_STREAM_END) { lzham_lib_z_inflateEnd(&stream); return ((status == LZHAM_Z_BUF_ERROR) && (!stream.avail_in)) ? LZHAM_Z_DATA_ERROR : status; } *pDest_len = stream.total_out; return lzham_lib_z_inflateEnd(&stream); } const char * LZHAM_CDECL lzham_lib_z_error(int err) { static struct { int m_err; const char *m_pDesc; } s_error_descs[] = { { LZHAM_Z_OK, "" }, { LZHAM_Z_STREAM_END, "stream end" }, { LZHAM_Z_NEED_DICT, "need dictionary" }, { LZHAM_Z_ERRNO, "file error" }, { LZHAM_Z_STREAM_ERROR, "stream error" }, { LZHAM_Z_DATA_ERROR, "data error" }, { LZHAM_Z_MEM_ERROR, "out of memory" }, { LZHAM_Z_BUF_ERROR, "buf error" }, { LZHAM_Z_VERSION_ERROR, "version error" }, { LZHAM_Z_PARAM_ERROR, "parameter error" } }; for (uint i = 0; i < sizeof(s_error_descs) / sizeof(s_error_descs[0]); ++i) if (s_error_descs[i].m_err == err) return s_error_descs[i].m_pDesc; return NULL; } lzham_z_ulong lzham_lib_z_adler32(lzham_z_ulong adler, const unsigned char *ptr, size_t buf_len) { return adler32(ptr, buf_len, adler); } lzham_z_ulong LZHAM_CDECL lzham_lib_z_crc32(lzham_z_ulong crc, const lzham_uint8 *ptr, size_t buf_len) { return crc32(crc, ptr, buf_len); } } // namespace lzham ��������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_assert.cpp�������������������������������������������0000644�0001750�0001750�00000002561�12320456500�022723� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_assert.cpp // See Copyright Notice and license at the end of include/lzham.h #include "lzham_core.h" static bool g_fail_exceptions; static bool g_exit_on_failure = true; void lzham_enable_fail_exceptions(bool enabled) { g_fail_exceptions = enabled; } void lzham_assert(const char* pExp, const char* pFile, unsigned line) { char buf[512]; sprintf_s(buf, sizeof(buf), "%s(%u): Assertion failed: \"%s\"\n", pFile, line, pExp); lzham_output_debug_string(buf); printf("%s", buf); if (lzham_is_debugger_present()) lzham_debug_break(); } void lzham_fail(const char* pExp, const char* pFile, unsigned line) { char buf[512]; sprintf_s(buf, sizeof(buf), "%s(%u): Failure: \"%s\"\n", pFile, line, pExp); lzham_output_debug_string(buf); printf("%s", buf); if (lzham_is_debugger_present()) lzham_debug_break(); #if LZHAM_USE_WIN32_API if (g_fail_exceptions) RaiseException(LZHAM_FAIL_EXCEPTION_CODE, 0, 0, NULL); else #endif if (g_exit_on_failure) exit(EXIT_FAILURE); } void lzham_trace(const char* pFmt, va_list args) { if (lzham_is_debugger_present()) { char buf[512]; vsprintf_s(buf, sizeof(buf), pFmt, args); lzham_output_debug_string(buf); } }; void lzham_trace(const char* pFmt, ...) { va_list args; va_start(args, pFmt); lzham_trace(pFmt, args); va_end(args); }; �����������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_symbol_codec.cpp�������������������������������������0000644�0001750�0001750�00000150025�12320456500�024063� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_symbol_codec.cpp // See Copyright Notice and license at the end of include/lzham.h #include "lzham_core.h" #include "lzham_symbol_codec.h" #include "lzham_huffman_codes.h" #include "lzham_polar_codes.h" // Set to 1 to enable ~2x more frequent Huffman table updating (at slower decompression). #define LZHAM_MORE_FREQUENT_TABLE_UPDATING 1 namespace lzham { // Using a fixed table to convert from scaled probability to scaled bits for determinism across compilers/run-time libs/platforms. uint32 g_prob_cost[cSymbolCodecArithProbScale] = { 0x0,0xB000000,0xA000000,0x96A3FE6,0x9000000,0x8AD961F,0x86A3FE6,0x8315130,0x8000000,0x7D47FCC,0x7AD961F, 0x78A62B0,0x76A3FE6,0x74CAFFC,0x7315130,0x717D605,0x7000000,0x6E99C09,0x6D47FCC,0x6C087D3,0x6AD961F,0x69B9116, 0x68A62B0,0x679F7D8,0x66A3FE6,0x65B2C3E,0x64CAFFC,0x63EBFB1,0x6315130,0x6245B5C,0x617D605,0x60BB9CA,0x6000000, 0x5F4A296,0x5E99C09,0x5DEE74F,0x5D47FCC,0x5CA6144,0x5C087D3,0x5B6EFE1,0x5AD961F,0x5A47779,0x59B9116,0x592E050, 0x58A62B0,0x58215EA,0x579F7D8,0x5720677,0x56A3FE6,0x562A260,0x55B2C3E,0x553DBEF,0x54CAFFC,0x545A701,0x53EBFB1, 0x537F8CF,0x5315130,0x52AC7B8,0x5245B5C,0x51E0B1B,0x517D605,0x511BB33,0x50BB9CA,0x505D0FC,0x5000000,0x4FA461A, 0x4F4A296,0x4EF14C7,0x4E99C09,0x4E437BE,0x4DEE74F,0x4D9AA2C,0x4D47FCC,0x4CF67A8,0x4CA6144,0x4C56C23,0x4C087D3, 0x4BBB3E1,0x4B6EFE1,0x4B23B6D,0x4AD961F,0x4A8FF97,0x4A47779,0x49FFD6A,0x49B9116,0x4973228,0x492E050,0x48E9B41, 0x48A62B0,0x4863655,0x48215EA,0x47E012C,0x479F7D8,0x475F9B0,0x4720677,0x46E1DF1,0x46A3FE6,0x4666C1D,0x462A260, 0x45EE27C,0x45B2C3E,0x4577F74,0x453DBEF,0x4504180,0x44CAFFC,0x4492735,0x445A701,0x4422F38,0x43EBFB1,0x43B5846, 0x437F8CF,0x434A129,0x4315130,0x42E08C0,0x42AC7B8,0x4278DF7,0x4245B5C,0x4212FC7,0x41E0B1B,0x41AED39,0x417D605, 0x414C561,0x411BB33,0x40EB75F,0x40BB9CA,0x408C25C,0x405D0FC,0x402E58F,0x4000000,0x3FD2036,0x3FA461A,0x3F77197, 0x3F4A296,0x3F1D903,0x3EF14C7,0x3EC55D0,0x3E99C09,0x3E6E75F,0x3E437BE,0x3E18D14,0x3DEE74F,0x3DC465D,0x3D9AA2C, 0x3D712AC,0x3D47FCC,0x3D1F17A,0x3CF67A8,0x3CCE246,0x3CA6144,0x3C7E492,0x3C56C23,0x3C2F7E8,0x3C087D3,0x3BE1BD5, 0x3BBB3E1,0x3B94FE9,0x3B6EFE1,0x3B493BC,0x3B23B6D,0x3AFE6E7,0x3AD961F,0x3AB4908,0x3A8FF97,0x3A6B9C0,0x3A47779, 0x3A238B5,0x39FFD6A,0x39DC58E,0x39B9116,0x3995FF7,0x3973228,0x395079E,0x392E050,0x390BC34,0x38E9B41,0x38C7D6E, 0x38A62B0,0x3884B01,0x3863655,0x38424A6,0x38215EA,0x3800A1A,0x37E012C,0x37BFB18,0x379F7D8,0x377F762,0x375F9B0, 0x373FEBA,0x3720677,0x37010E1,0x36E1DF1,0x36C2DA0,0x36A3FE6,0x36854BC,0x3666C1D,0x3648600,0x362A260,0x360C136, 0x35EE27C,0x35D062B,0x35B2C3E,0x35954AD,0x3577F74,0x355AC8C,0x353DBEF,0x3520D98,0x3504180,0x34E77A4,0x34CAFFC, 0x34AEA83,0x3492735,0x347660B,0x345A701,0x343EA12,0x3422F38,0x340766F,0x33EBFB1,0x33D0AFA,0x33B5846,0x339A78E, 0x337F8CF,0x3364C05,0x334A129,0x332F839,0x3315130,0x32FAC09,0x32E08C0,0x32C6751,0x32AC7B8,0x32929F1,0x3278DF7, 0x325F3C6,0x3245B5C,0x322C4B2,0x3212FC7,0x31F9C96,0x31E0B1B,0x31C7B53,0x31AED39,0x31960CB,0x317D605,0x3164CE2, 0x314C561,0x3133F7D,0x311BB33,0x310387F,0x30EB75F,0x30D37CE,0x30BB9CA,0x30A3D50,0x308C25C,0x30748EC,0x305D0FC, 0x3045A88,0x302E58F,0x301720E,0x3000000,0x2FE8F64,0x2FD2036,0x2FBB274,0x2FA461A,0x2F8DB27,0x2F77197,0x2F60968, 0x2F4A296,0x2F33D20,0x2F1D903,0x2F0763B,0x2EF14C7,0x2EDB4A5,0x2EC55D0,0x2EAF848,0x2E99C09,0x2E84111,0x2E6E75F, 0x2E58EEE,0x2E437BE,0x2E2E1CB,0x2E18D14,0x2E03996,0x2DEE74F,0x2DD963D,0x2DC465D,0x2DAF7AD,0x2D9AA2C,0x2D85DD7, 0x2D712AC,0x2D5C8A9,0x2D47FCC,0x2D33812,0x2D1F17A,0x2D0AC02,0x2CF67A8,0x2CE246A,0x2CCE246,0x2CBA13A,0x2CA6144, 0x2C92262,0x2C7E492,0x2C6A7D4,0x2C56C23,0x2C43180,0x2C2F7E8,0x2C1BF5A,0x2C087D3,0x2BF5151,0x2BE1BD5,0x2BCE75A, 0x2BBB3E1,0x2BA8166,0x2B94FE9,0x2B81F68,0x2B6EFE1,0x2B5C153,0x2B493BC,0x2B3671A,0x2B23B6D,0x2B110B1,0x2AFE6E7, 0x2AEBE0C,0x2AD961F,0x2AC6F1E,0x2AB4908,0x2AA23DC,0x2A8FF97,0x2A7DC39,0x2A6B9C0,0x2A5982B,0x2A47779,0x2A357A7, 0x2A238B5,0x2A11AA1,0x29FFD6A,0x29EE10F,0x29DC58E,0x29CAAE6,0x29B9116,0x29A781C,0x2995FF7,0x29848A6,0x2973228, 0x2961C7B,0x295079E,0x293F390,0x292E050,0x291CDDD,0x290BC34,0x28FAB56,0x28E9B41,0x28D8BF4,0x28C7D6E,0x28B6FAD, 0x28A62B0,0x2895677,0x2884B01,0x287404B,0x2863655,0x2852D1F,0x28424A6,0x2831CEA,0x28215EA,0x2810FA5,0x2800A1A, 0x27F0547,0x27E012C,0x27CFDC7,0x27BFB18,0x27AF91E,0x279F7D8,0x278F744,0x277F762,0x276F831,0x275F9B0,0x274FBDE, 0x273FEBA,0x2730242,0x2720677,0x2710B57,0x27010E1,0x26F1715,0x26E1DF1,0x26D2575,0x26C2DA0,0x26B3670,0x26A3FE6, 0x26949FF,0x26854BC,0x267601C,0x2666C1D,0x26578BE,0x2648600,0x26393E1,0x262A260,0x261B17D,0x260C136,0x25FD18C, 0x25EE27C,0x25DF407,0x25D062B,0x25C18E8,0x25B2C3E,0x25A402A,0x25954AD,0x25869C6,0x2577F74,0x25695B6,0x255AC8C, 0x254C3F4,0x253DBEF,0x252F47B,0x2520D98,0x2512744,0x2504180,0x24F5C4B,0x24E77A4,0x24D9389,0x24CAFFC,0x24BCCFA, 0x24AEA83,0x24A0897,0x2492735,0x248465C,0x247660B,0x2468643,0x245A701,0x244C847,0x243EA12,0x2430C63,0x2422F38, 0x2415292,0x240766F,0x23F9ACF,0x23EBFB1,0x23DE515,0x23D0AFA,0x23C3160,0x23B5846,0x23A7FAB,0x239A78E,0x238CFF0, 0x237F8CF,0x237222C,0x2364C05,0x2357659,0x234A129,0x233CC74,0x232F839,0x2322478,0x2315130,0x2307E61,0x22FAC09, 0x22EDA29,0x22E08C0,0x22D37CE,0x22C6751,0x22B974A,0x22AC7B8,0x229F89B,0x22929F1,0x2285BBA,0x2278DF7,0x226C0A6, 0x225F3C6,0x2252758,0x2245B5C,0x2238FCF,0x222C4B2,0x221FA05,0x2212FC7,0x22065F7,0x21F9C96,0x21ED3A2,0x21E0B1B, 0x21D4301,0x21C7B53,0x21BB410,0x21AED39,0x21A26CD,0x21960CB,0x2189B33,0x217D605,0x217113F,0x2164CE2,0x21588EE, 0x214C561,0x214023B,0x2133F7D,0x2127D25,0x211BB33,0x210F9A6,0x210387F,0x20F77BD,0x20EB75F,0x20DF765,0x20D37CE, 0x20C789B,0x20BB9CA,0x20AFB5C,0x20A3D50,0x2097FA6,0x208C25C,0x2080574,0x20748EC,0x2068CC4,0x205D0FC,0x2051593, 0x2045A88,0x2039FDD,0x202E58F,0x2022BA0,0x201720E,0x200B8D8,0x2000000,0x1FF4784,0x1FE8F64,0x1FDD79F,0x1FD2036, 0x1FC6928,0x1FBB274,0x1FAFC1A,0x1FA461A,0x1F99074,0x1F8DB27,0x1F82633,0x1F77197,0x1F6BD53,0x1F60968,0x1F555D3, 0x1F4A296,0x1F3EFB0,0x1F33D20,0x1F28AE6,0x1F1D903,0x1F12774,0x1F0763B,0x1EFC557,0x1EF14C7,0x1EE648C,0x1EDB4A5, 0x1ED0511,0x1EC55D0,0x1EBA6E3,0x1EAF848,0x1EA49FF,0x1E99C09,0x1E8EE64,0x1E84111,0x1E79410,0x1E6E75F,0x1E63AFE, 0x1E58EEE,0x1E4E32E,0x1E437BE,0x1E38C9D,0x1E2E1CB,0x1E23748,0x1E18D14,0x1E0E32E,0x1E03996,0x1DF904C,0x1DEE74F, 0x1DE3E9F,0x1DD963D,0x1DCEE27,0x1DC465D,0x1DB9EDF,0x1DAF7AD,0x1DA50C7,0x1D9AA2C,0x1D903DC,0x1D85DD7,0x1D7B81C, 0x1D712AC,0x1D66D86,0x1D5C8A9,0x1D52416,0x1D47FCC,0x1D3DBCA,0x1D33812,0x1D294A2,0x1D1F17A,0x1D14E9B,0x1D0AC02, 0x1D009B2,0x1CF67A8,0x1CEC5E6,0x1CE246A,0x1CD8335,0x1CCE246,0x1CC419D,0x1CBA13A,0x1CB011C,0x1CA6144,0x1C9C1B0, 0x1C92262,0x1C88358,0x1C7E492,0x1C74611,0x1C6A7D4,0x1C609DA,0x1C56C23,0x1C4CEB0,0x1C43180,0x1C39493,0x1C2F7E8, 0x1C25B80,0x1C1BF5A,0x1C12375,0x1C087D3,0x1BFEC71,0x1BF5151,0x1BEB673,0x1BE1BD5,0x1BD8177,0x1BCE75A,0x1BC4D7D, 0x1BBB3E1,0x1BB1A84,0x1BA8166,0x1B9E888,0x1B94FE9,0x1B8B789,0x1B81F68,0x1B78786,0x1B6EFE1,0x1B6587B,0x1B5C153, 0x1B52A69,0x1B493BC,0x1B3FD4D,0x1B3671A,0x1B2D125,0x1B23B6D,0x1B1A5F1,0x1B110B1,0x1B07BAE,0x1AFE6E7,0x1AF525C, 0x1AEBE0C,0x1AE29F8,0x1AD961F,0x1AD0281,0x1AC6F1E,0x1ABDBF6,0x1AB4908,0x1AAB655,0x1AA23DC,0x1A9919C,0x1A8FF97, 0x1A86DCB,0x1A7DC39,0x1A74AE0,0x1A6B9C0,0x1A628DA,0x1A5982B,0x1A507B6,0x1A47779,0x1A3E774,0x1A357A7,0x1A2C812, 0x1A238B5,0x1A1A98F,0x1A11AA1,0x1A08BEA,0x19FFD6A,0x19F6F21,0x19EE10F,0x19E5333,0x19DC58E,0x19D381F,0x19CAAE6, 0x19C1DE3,0x19B9116,0x19B047E,0x19A781C,0x199EBEF,0x1995FF7,0x198D434,0x19848A6,0x197BD4D,0x1973228,0x196A737, 0x1961C7B,0x19591F3,0x195079E,0x1947D7D,0x193F390,0x19369D7,0x192E050,0x19256FD,0x191CDDD,0x19144EF,0x190BC34, 0x19033AC,0x18FAB56,0x18F2333,0x18E9B41,0x18E1382,0x18D8BF4,0x18D0498,0x18C7D6E,0x18BF675,0x18B6FAD,0x18AE916, 0x18A62B0,0x189DC7C,0x1895677,0x188D0A4,0x1884B01,0x187C58E,0x187404B,0x186BB38,0x1863655,0x185B1A2,0x1852D1F, 0x184A8CB,0x18424A6,0x183A0B1,0x1831CEA,0x1829953,0x18215EA,0x18192B0,0x1810FA5,0x1808CC8,0x1800A1A,0x17F8799, 0x17F0547,0x17E8322,0x17E012C,0x17D7F63,0x17CFDC7,0x17C7C59,0x17BFB18,0x17B7A05,0x17AF91E,0x17A7865,0x179F7D8, 0x1797778,0x178F744,0x178773D,0x177F762,0x17777B4,0x176F831,0x17678DB,0x175F9B0,0x1757AB1,0x174FBDE,0x1747D36, 0x173FEBA,0x1738068,0x1730242,0x1728447,0x1720677,0x17188D2,0x1710B57,0x1708E07,0x17010E1,0x16F93E6,0x16F1715, 0x16E9A6E,0x16E1DF1,0x16DA19E,0x16D2575,0x16CA976,0x16C2DA0,0x16BB1F3,0x16B3670,0x16ABB16,0x16A3FE6,0x169C4DE, 0x16949FF,0x168CF49,0x16854BC,0x167DA58,0x167601C,0x166E608,0x1666C1D,0x165F25A,0x16578BE,0x164FF4B,0x1648600, 0x1640CDD,0x16393E1,0x1631B0D,0x162A260,0x16229DB,0x161B17D,0x1613946,0x160C136,0x160494D,0x15FD18C,0x15F59F0, 0x15EE27C,0x15E6B2E,0x15DF407,0x15D7D06,0x15D062B,0x15C8F77,0x15C18E8,0x15BA280,0x15B2C3E,0x15AB621,0x15A402A, 0x159CA59,0x15954AD,0x158DF27,0x15869C6,0x157F48A,0x1577F74,0x1570A82,0x15695B6,0x156210E,0x155AC8C,0x155382E, 0x154C3F4,0x1544FDF,0x153DBEF,0x1536823,0x152F47B,0x15280F7,0x1520D98,0x1519A5C,0x1512744,0x150B450,0x1504180, 0x14FCED4,0x14F5C4B,0x14EE9E6,0x14E77A4,0x14E0585,0x14D9389,0x14D21B1,0x14CAFFC,0x14C3E69,0x14BCCFA,0x14B5BAD, 0x14AEA83,0x14A797C,0x14A0897,0x14997D5,0x1492735,0x148B6B7,0x148465C,0x147D622,0x147660B,0x146F616,0x1468643, 0x1461691,0x145A701,0x1453793,0x144C847,0x144591C,0x143EA12,0x1437B2A,0x1430C63,0x1429DBD,0x1422F38,0x141C0D5, 0x1415292,0x140E470,0x140766F,0x140088F,0x13F9ACF,0x13F2D30,0x13EBFB1,0x13E5253,0x13DE515,0x13D77F8,0x13D0AFA, 0x13C9E1D,0x13C3160,0x13BC4C3,0x13B5846,0x13AEBE8,0x13A7FAB,0x13A138D,0x139A78E,0x1393BAF,0x138CFF0,0x1386450, 0x137F8CF,0x1378D6E,0x137222C,0x136B709,0x1364C05,0x135E11F,0x1357659,0x1350BB2,0x134A129,0x13436C0,0x133CC74, 0x1336248,0x132F839,0x1328E4A,0x1322478,0x131BAC5,0x1315130,0x130E7B9,0x1307E61,0x1301526,0x12FAC09,0x12F430A, 0x12EDA29,0x12E7166,0x12E08C0,0x12DA038,0x12D37CE,0x12CCF81,0x12C6751,0x12BFF3F,0x12B974A,0x12B2F73,0x12AC7B8, 0x12A601B,0x129F89B,0x1299137,0x12929F1,0x128C2C7,0x1285BBA,0x127F4CA,0x1278DF7,0x1272740,0x126C0A6,0x1265A28, 0x125F3C6,0x1258D81,0x1252758,0x124C14C,0x1245B5C,0x123F587,0x1238FCF,0x1232A33,0x122C4B2,0x1225F4E,0x121FA05, 0x12194D8,0x1212FC7,0x120CAD1,0x12065F7,0x1200139,0x11F9C96,0x11F380E,0x11ED3A2,0x11E6F51,0x11E0B1B,0x11DA700, 0x11D4301,0x11CDF1C,0x11C7B53,0x11C17A4,0x11BB410,0x11B5097,0x11AED39,0x11A89F6,0x11A26CD,0x119C3BF,0x11960CB, 0x118FDF2,0x1189B33,0x118388F,0x117D605,0x1177395,0x117113F,0x116AF04,0x1164CE2,0x115EADB,0x11588EE,0x115271A, 0x114C561,0x11463C1,0x114023B,0x113A0CF,0x1133F7D,0x112DE44,0x1127D25,0x1121C1F,0x111BB33,0x1115A60,0x110F9A6, 0x1109906,0x110387F,0x10FD811,0x10F77BD,0x10F1781,0x10EB75F,0x10E5755,0x10DF765,0x10D978D,0x10D37CE,0x10CD828, 0x10C789B,0x10C1926,0x10BB9CA,0x10B5A87,0x10AFB5C,0x10A9C4A,0x10A3D50,0x109DE6F,0x1097FA6,0x10920F5,0x108C25C, 0x10863DC,0x1080574,0x107A724,0x10748EC,0x106EACC,0x1068CC4,0x1062ED4,0x105D0FC,0x105733B,0x1051593,0x104B802, 0x1045A88,0x103FD27,0x1039FDD,0x10342AA,0x102E58F,0x102888C,0x1022BA0,0x101CECB,0x101720E,0x1011567,0x100B8D8, 0x1005C61,0x1000000,0xFFA3B6,0xFF4784,0xFEEB68,0xFE8F64,0xFE3376,0xFDD79F,0xFD7BDF,0xFD2036,0xFCC4A3, 0xFC6928,0xFC0DC2,0xFBB274,0xFB573C,0xFAFC1A,0xFAA10F,0xFA461A,0xF9EB3C,0xF99074,0xF935C2,0xF8DB27, 0xF880A2,0xF82633,0xF7CBDA,0xF77197,0xF7176A,0xF6BD53,0xF66353,0xF60968,0xF5AF93,0xF555D3,0xF4FC2A, 0xF4A296,0xF44918,0xF3EFB0,0xF3965D,0xF33D20,0xF2E3F9,0xF28AE6,0xF231EA,0xF1D903,0xF18031,0xF12774, 0xF0CECD,0xF0763B,0xF01DBF,0xEFC557,0xEF6D05,0xEF14C7,0xEEBC9F,0xEE648C,0xEE0C8E,0xEDB4A5,0xED5CD0, 0xED0511,0xECAD66,0xEC55D0,0xEBFE4F,0xEBA6E3,0xEB4F8B,0xEAF848,0xEAA119,0xEA49FF,0xE9F2FA,0xE99C09, 0xE9452D,0xE8EE64,0xE897B1,0xE84111,0xE7EA86,0xE79410,0xE73DAD,0xE6E75F,0xE69124,0xE63AFE,0xE5E4EC, 0xE58EEE,0xE53904,0xE4E32E,0xE48D6C,0xE437BE,0xE3E223,0xE38C9D,0xE3372A,0xE2E1CB,0xE28C80,0xE23748, 0xE1E224,0xE18D14,0xE13817,0xE0E32E,0xE08E58,0xE03996,0xDFE4E7,0xDF904C,0xDF3BC4,0xDEE74F,0xDE92ED, 0xDE3E9F,0xDDEA64,0xDD963D,0xDD4228,0xDCEE27,0xDC9A38,0xDC465D,0xDBF295,0xDB9EDF,0xDB4B3D,0xDAF7AD, 0xDAA431,0xDA50C7,0xD9FD70,0xD9AA2C,0xD956FB,0xD903DC,0xD8B0D0,0xD85DD7,0xD80AF1,0xD7B81C,0xD7655B, 0xD712AC,0xD6C010,0xD66D86,0xD61B0E,0xD5C8A9,0xD57656,0xD52416,0xD4D1E7,0xD47FCC,0xD42DC2,0xD3DBCA, 0xD389E5,0xD33812,0xD2E651,0xD294A2,0xD24305,0xD1F17A,0xD1A001,0xD14E9B,0xD0FD46,0xD0AC02,0xD05AD1, 0xD009B2,0xCFB8A4,0xCF67A8,0xCF16BE,0xCEC5E6,0xCE751F,0xCE246A,0xCDD3C7,0xCD8335,0xCD32B5,0xCCE246, 0xCC91E9,0xCC419D,0xCBF163,0xCBA13A,0xCB5122,0xCB011C,0xCAB127,0xCA6144,0xCA1171,0xC9C1B0,0xC97200, 0xC92262,0xC8D2D4,0xC88358,0xC833ED,0xC7E492,0xC79549,0xC74611,0xC6F6EA,0xC6A7D4,0xC658CE,0xC609DA, 0xC5BAF6,0xC56C23,0xC51D61,0xC4CEB0,0xC48010,0xC43180,0xC3E301,0xC39493,0xC34635,0xC2F7E8,0xC2A9AC, 0xC25B80,0xC20D64,0xC1BF5A,0xC1715F,0xC12375,0xC0D59C,0xC087D3,0xC03A1A,0xBFEC71,0xBF9ED9,0xBF5151, 0xBF03DA,0xBEB673,0xBE691B,0xBE1BD5,0xBDCE9E,0xBD8177,0xBD3461,0xBCE75A,0xBC9A64,0xBC4D7D,0xBC00A7, 0xBBB3E1,0xBB672A,0xBB1A84,0xBACDED,0xBA8166,0xBA34EF,0xB9E888,0xB99C31,0xB94FE9,0xB903B1,0xB8B789, 0xB86B71,0xB81F68,0xB7D36F,0xB78786,0xB73BAC,0xB6EFE1,0xB6A427,0xB6587B,0xB60CDF,0xB5C153,0xB575D6, 0xB52A69,0xB4DF0B,0xB493BC,0xB4487D,0xB3FD4D,0xB3B22C,0xB3671A,0xB31C18,0xB2D125,0xB28641,0xB23B6D, 0xB1F0A7,0xB1A5F1,0xB15B4A,0xB110B1,0xB0C628,0xB07BAE,0xB03143,0xAFE6E7,0xAF9C9A,0xAF525C,0xAF082C, 0xAEBE0C,0xAE73FA,0xAE29F8,0xADE004,0xAD961F,0xAD4C49,0xAD0281,0xACB8C8,0xAC6F1E,0xAC2583,0xABDBF6, 0xAB9278,0xAB4908,0xAAFFA7,0xAAB655,0xAA6D11,0xAA23DC,0xA9DAB5,0xA9919C,0xA94893,0xA8FF97,0xA8B6AA, 0xA86DCB,0xA824FB,0xA7DC39,0xA79386,0xA74AE0,0xA70249,0xA6B9C0,0xA67146,0xA628DA,0xA5E07B,0xA5982B, 0xA54FEA,0xA507B6,0xA4BF90,0xA47779,0xA42F6F,0xA3E774,0xA39F87,0xA357A7,0xA30FD6,0xA2C812,0xA2805D, 0xA238B5,0xA1F11B,0xA1A98F,0xA16211,0xA11AA1,0xA0D33F,0xA08BEA,0xA044A4,0x9FFD6A,0x9FB63F,0x9F6F21, 0x9F2811,0x9EE10F,0x9E9A1B,0x9E5333,0x9E0C5A,0x9DC58E,0x9D7ED0,0x9D381F,0x9CF17C,0x9CAAE6,0x9C645E, 0x9C1DE3,0x9BD776,0x9B9116,0x9B4AC3,0x9B047E,0x9ABE46,0x9A781C,0x9A31FF,0x99EBEF,0x99A5EC,0x995FF7, 0x991A0F,0x98D434,0x988E67,0x9848A6,0x9802F3,0x97BD4D,0x9777B4,0x973228,0x96ECA9,0x96A737,0x9661D3, 0x961C7B,0x95D730,0x9591F3,0x954CC2,0x95079E,0x94C287,0x947D7D,0x943880,0x93F390,0x93AEAD,0x9369D7, 0x93250D,0x92E050,0x929BA0,0x9256FD,0x921266,0x91CDDD,0x91895F,0x9144EF,0x91008B,0x90BC34,0x9077EA, 0x9033AC,0x8FEF7B,0x8FAB56,0x8F673E,0x8F2333,0x8EDF34,0x8E9B41,0x8E575B,0x8E1382,0x8DCFB5,0x8D8BF4, 0x8D4840,0x8D0498,0x8CC0FD,0x8C7D6E,0x8C39EB,0x8BF675,0x8BB30B,0x8B6FAD,0x8B2C5B,0x8AE916,0x8AA5DD, 0x8A62B0,0x8A1F90,0x89DC7C,0x899973,0x895677,0x891388,0x88D0A4,0x888DCC,0x884B01,0x880841,0x87C58E, 0x8782E6,0x87404B,0x86FDBC,0x86BB38,0x8678C1,0x863655,0x85F3F6,0x85B1A2,0x856F5B,0x852D1F,0x84EAEF, 0x84A8CB,0x8466B3,0x8424A6,0x83E2A6,0x83A0B1,0x835EC8,0x831CEA,0x82DB19,0x829953,0x825799,0x8215EA, 0x81D448,0x8192B0,0x815125,0x810FA5,0x80CE31,0x808CC8,0x804B6B,0x800A1A,0x7FC8D4,0x7F8799,0x7F466A, 0x7F0547,0x7EC42F,0x7E8322,0x7E4221,0x7E012C,0x7DC041,0x7D7F63,0x7D3E8F,0x7CFDC7,0x7CBD0B,0x7C7C59, 0x7C3BB3,0x7BFB18,0x7BBA89,0x7B7A05,0x7B398C,0x7AF91E,0x7AB8BC,0x7A7865,0x7A3819,0x79F7D8,0x79B7A2, 0x797778,0x793759,0x78F744,0x78B73B,0x78773D,0x78374A,0x77F762,0x77B786,0x7777B4,0x7737ED,0x76F831, 0x76B881,0x7678DB,0x763940,0x75F9B0,0x75BA2B,0x757AB1,0x753B42,0x74FBDE,0x74BC84,0x747D36,0x743DF2, 0x73FEBA,0x73BF8C,0x738068,0x734150,0x730242,0x72C33F,0x728447,0x72455A,0x720677,0x71C79F,0x7188D2, 0x714A0F,0x710B57,0x70CCAA,0x708E07,0x704F6F,0x7010E1,0x6FD25E,0x6F93E6,0x6F5578,0x6F1715,0x6ED8BC, 0x6E9A6E,0x6E5C2B,0x6E1DF1,0x6DDFC3,0x6DA19E,0x6D6385,0x6D2575,0x6CE770,0x6CA976,0x6C6B86,0x6C2DA0, 0x6BEFC4,0x6BB1F3,0x6B742D,0x6B3670,0x6AF8BE,0x6ABB16,0x6A7D79,0x6A3FE6,0x6A025D,0x69C4DE,0x69876A, 0x6949FF,0x690C9F,0x68CF49,0x6891FE,0x6854BC,0x681785,0x67DA58,0x679D35,0x67601C,0x67230D,0x66E608, 0x66A90D,0x666C1D,0x662F36,0x65F25A,0x65B587,0x6578BE,0x653C00,0x64FF4B,0x64C2A1,0x648600,0x644969, 0x640CDD,0x63D05A,0x6393E1,0x635772,0x631B0D,0x62DEB2,0x62A260,0x626619,0x6229DB,0x61EDA7,0x61B17D, 0x61755D,0x613946,0x60FD39,0x60C136,0x60853D,0x60494D,0x600D68,0x5FD18C,0x5F95B9,0x5F59F0,0x5F1E31, 0x5EE27C,0x5EA6D0,0x5E6B2E,0x5E2F96,0x5DF407,0x5DB882,0x5D7D06,0x5D4194,0x5D062B,0x5CCACC,0x5C8F77, 0x5C542B,0x5C18E8,0x5BDDAF,0x5BA280,0x5B675A,0x5B2C3E,0x5AF12B,0x5AB621,0x5A7B21,0x5A402A,0x5A053D, 0x59CA59,0x598F7E,0x5954AD,0x5919E5,0x58DF27,0x58A472,0x5869C6,0x582F23,0x57F48A,0x57B9FA,0x577F74, 0x5744F6,0x570A82,0x56D018,0x5695B6,0x565B5E,0x56210E,0x55E6C8,0x55AC8C,0x557258,0x55382E,0x54FE0C, 0x54C3F4,0x5489E5,0x544FDF,0x5415E2,0x53DBEF,0x53A204,0x536823,0x532E4A,0x52F47B,0x52BAB5,0x5280F7, 0x524743,0x520D98,0x51D3F5,0x519A5C,0x5160CC,0x512744,0x50EDC6,0x50B450,0x507AE4,0x504180,0x500826, 0x4FCED4,0x4F958B,0x4F5C4B,0x4F2314,0x4EE9E6,0x4EB0C0,0x4E77A4,0x4E3E90,0x4E0585,0x4DCC83,0x4D9389, 0x4D5A99,0x4D21B1,0x4CE8D2,0x4CAFFC,0x4C772E,0x4C3E69,0x4C05AD,0x4BCCFA,0x4B944F,0x4B5BAD,0x4B2314, 0x4AEA83,0x4AB1FB,0x4A797C,0x4A4105,0x4A0897,0x49D031,0x4997D5,0x495F80,0x492735,0x48EEF2,0x48B6B7, 0x487E85,0x48465C,0x480E3B,0x47D622,0x479E13,0x47660B,0x472E0C,0x46F616,0x46BE28,0x468643,0x464E66, 0x461691,0x45DEC5,0x45A701,0x456F46,0x453793,0x44FFE9,0x44C847,0x4490AD,0x44591C,0x442193,0x43EA12, 0x43B29A,0x437B2A,0x4343C2,0x430C63,0x42D50C,0x429DBD,0x426676,0x422F38,0x41F802,0x41C0D5,0x4189AF, 0x415292,0x411B7D,0x40E470,0x40AD6B,0x40766F,0x403F7B,0x40088F,0x3FD1AB,0x3F9ACF,0x3F63FB,0x3F2D30, 0x3EF66D,0x3EBFB1,0x3E88FE,0x3E5253,0x3E1BB0,0x3DE515,0x3DAE83,0x3D77F8,0x3D4175,0x3D0AFA,0x3CD488, 0x3C9E1D,0x3C67BB,0x3C3160,0x3BFB0E,0x3BC4C3,0x3B8E80,0x3B5846,0x3B2213,0x3AEBE8,0x3AB5C5,0x3A7FAB, 0x3A4998,0x3A138D,0x39DD89,0x39A78E,0x39719B,0x393BAF,0x3905CC,0x38CFF0,0x389A1C,0x386450,0x382E8C, 0x37F8CF,0x37C31B,0x378D6E,0x3757C9,0x37222C,0x36EC96,0x36B709,0x368183,0x364C05,0x36168E,0x35E11F, 0x35ABB9,0x357659,0x354102,0x350BB2,0x34D66A,0x34A129,0x346BF1,0x3436C0,0x340196,0x33CC74,0x33975A, 0x336248,0x332D3D,0x32F839,0x32C33E,0x328E4A,0x32595D,0x322478,0x31EF9B,0x31BAC5,0x3185F7,0x315130, 0x311C71,0x30E7B9,0x30B309,0x307E61,0x3049C0,0x301526,0x2FE094,0x2FAC09,0x2F7786,0x2F430A,0x2F0E96, 0x2EDA29,0x2EA5C4,0x2E7166,0x2E3D0F,0x2E08C0,0x2DD479,0x2DA038,0x2D6BFF,0x2D37CE,0x2D03A4,0x2CCF81, 0x2C9B66,0x2C6751,0x2C3345,0x2BFF3F,0x2BCB41,0x2B974A,0x2B635B,0x2B2F73,0x2AFB92,0x2AC7B8,0x2A93E6, 0x2A601B,0x2A2C57,0x29F89B,0x29C4E5,0x299137,0x295D90,0x2929F1,0x28F658,0x28C2C7,0x288F3D,0x285BBA, 0x28283F,0x27F4CA,0x27C15D,0x278DF7,0x275A98,0x272740,0x26F3EF,0x26C0A6,0x268D63,0x265A28,0x2626F4, 0x25F3C6,0x25C0A0,0x258D81,0x255A69,0x252758,0x24F44F,0x24C14C,0x248E50,0x245B5C,0x24286E,0x23F587, 0x23C2A8,0x238FCF,0x235CFD,0x232A33,0x22F76F,0x22C4B2,0x2291FD,0x225F4E,0x222CA6,0x21FA05,0x21C76B, 0x2194D8,0x21624C,0x212FC7,0x20FD49,0x20CAD1,0x209861,0x2065F7,0x203395,0x200139,0x1FCEE4,0x1F9C96, 0x1F6A4F,0x1F380E,0x1F05D5,0x1ED3A2,0x1EA176,0x1E6F51,0x1E3D32,0x1E0B1B,0x1DD90A,0x1DA700,0x1D74FD, 0x1D4301,0x1D110B,0x1CDF1C,0x1CAD34,0x1C7B53,0x1C4978,0x1C17A4,0x1BE5D7,0x1BB410,0x1B8250,0x1B5097, 0x1B1EE5,0x1AED39,0x1ABB94,0x1A89F6,0x1A585E,0x1A26CD,0x19F542,0x19C3BF,0x199241,0x1960CB,0x192F5B, 0x18FDF2,0x18CC8F,0x189B33,0x1869DE,0x18388F,0x180746,0x17D605,0x17A4C9,0x177395,0x174267,0x17113F, 0x16E01E,0x16AF04,0x167DF0,0x164CE2,0x161BDC,0x15EADB,0x15B9E1,0x1588EE,0x155801,0x15271A,0x14F63A, 0x14C561,0x14948E,0x1463C1,0x1432FB,0x14023B,0x13D182,0x13A0CF,0x137023,0x133F7D,0x130EDD,0x12DE44, 0x12ADB1,0x127D25,0x124C9F,0x121C1F,0x11EBA6,0x11BB33,0x118AC6,0x115A60,0x112A00,0x10F9A6,0x10C953, 0x109906,0x1068BF,0x10387F,0x100845,0xFD811,0xFA7E4,0xF77BD,0xF479C,0xF1781,0xEE76D,0xEB75F, 0xE8757,0xE5755,0xE275A,0xDF765,0xDC776,0xD978D,0xD67AA,0xD37CE,0xD07F8,0xCD828,0xCA85E, 0xC789B,0xC48DD,0xC1926,0xBE975,0xBB9CA,0xB8A26,0xB5A87,0xB2AEF,0xAFB5C,0xACBD0,0xA9C4A, 0xA6CCA,0xA3D50,0xA0DDC,0x9DE6F,0x9AF07,0x97FA6,0x9504A,0x920F5,0x8F1A6,0x8C25C,0x89319, 0x863DC,0x834A5,0x80574,0x7D649,0x7A724,0x77805,0x748EC,0x719D9,0x6EACC,0x6BBC5,0x68CC4, 0x65DC9,0x62ED4,0x5FFE5,0x5D0FC,0x5A218,0x5733B,0x54464,0x51593,0x4E6C7,0x4B802,0x48942, 0x45A88,0x42BD5,0x3FD27,0x3CE7F,0x39FDD,0x37141,0x342AA,0x3141A,0x2E58F,0x2B70B,0x2888C, 0x25A13,0x22BA0,0x1FD33,0x1CECB,0x1A069,0x1720E,0x143B8,0x11567,0xE71D,0xB8D8,0x8A9A, 0x5C61,0x2E2D }; #define LZHAM_CREATE_PROB_COST_TABLE 0 #if LZHAM_CREATE_PROB_COST_TABLE class arith_prob_cost_initializer { public: arith_prob_cost_initializer() { const double cInvLn2 = 1.4426950408889634073599246810019; // 1.0/ln(2) for (uint i = 0; i < cSymbolCodecArithProbScale; i++) { double flBits = i ? (-log(i * (1.0 / cSymbolCodecArithProbScale)) * cInvLn2) : 0; g_prob_cost[i] = static_cast<uint32>(floor(.5f + flBits * cBitCostScale)); printf("0x%X,", g_prob_cost[i]); if ((i % 11) == 10) printf("\n"); } printf("\n"); } }; static arith_prob_cost_initializer g_prob_cost_initializer; #endif raw_quasi_adaptive_huffman_data_model::raw_quasi_adaptive_huffman_data_model(bool encoding, uint total_syms, bool fast_updating, bool use_polar_codes) : m_pDecode_tables(NULL), m_total_syms(0), m_max_cycle(0), m_update_cycle(0), m_symbols_until_update(0), m_total_count(0), m_decoder_table_bits(0), m_encoding(encoding), m_fast_updating(false), m_use_polar_codes(false) { if (total_syms) { init(encoding, total_syms, fast_updating, use_polar_codes); } } raw_quasi_adaptive_huffman_data_model::raw_quasi_adaptive_huffman_data_model(const raw_quasi_adaptive_huffman_data_model& other) : m_pDecode_tables(NULL), m_total_syms(0), m_max_cycle(0), m_update_cycle(0), m_symbols_until_update(0), m_total_count(0), m_decoder_table_bits(0), m_encoding(false), m_fast_updating(false), m_use_polar_codes(false) { *this = other; } raw_quasi_adaptive_huffman_data_model::~raw_quasi_adaptive_huffman_data_model() { if (m_pDecode_tables) lzham_delete(m_pDecode_tables); } bool raw_quasi_adaptive_huffman_data_model::assign(const raw_quasi_adaptive_huffman_data_model& rhs) { if (this == &rhs) return true; m_total_syms = rhs.m_total_syms; m_max_cycle = rhs.m_max_cycle; m_update_cycle = rhs.m_update_cycle; m_symbols_until_update = rhs.m_symbols_until_update; m_total_count = rhs.m_total_count; m_sym_freq = rhs.m_sym_freq; m_initial_sym_freq = rhs.m_initial_sym_freq; m_codes = rhs.m_codes; m_code_sizes = rhs.m_code_sizes; if (rhs.m_pDecode_tables) { if (m_pDecode_tables) { if (!m_pDecode_tables->assign(*rhs.m_pDecode_tables)) { clear(); return false; } } else { m_pDecode_tables = lzham_new<prefix_coding::decoder_tables>(*rhs.m_pDecode_tables); if (!m_pDecode_tables) { clear(); return false; } } } else if (m_pDecode_tables) { lzham_delete(m_pDecode_tables); m_pDecode_tables = NULL; } m_decoder_table_bits = rhs.m_decoder_table_bits; m_encoding = rhs.m_encoding; m_fast_updating = rhs.m_fast_updating; m_use_polar_codes = rhs.m_use_polar_codes; return true; } raw_quasi_adaptive_huffman_data_model& raw_quasi_adaptive_huffman_data_model::operator= (const raw_quasi_adaptive_huffman_data_model& rhs) { assign(rhs); return *this; } void raw_quasi_adaptive_huffman_data_model::clear() { m_sym_freq.clear(); m_initial_sym_freq.clear(); m_codes.clear(); m_code_sizes.clear(); m_max_cycle = 0; m_total_syms = 0; m_update_cycle = 0; m_symbols_until_update = 0; m_decoder_table_bits = 0; m_total_count = 0; if (m_pDecode_tables) { lzham_delete(m_pDecode_tables); m_pDecode_tables = NULL; } m_fast_updating = false; m_use_polar_codes = false; } bool raw_quasi_adaptive_huffman_data_model::init(bool encoding, uint total_syms, bool fast_updating, bool use_polar_codes, const uint16 *pInitial_sym_freq) { m_encoding = encoding; m_fast_updating = fast_updating; m_use_polar_codes = use_polar_codes; m_symbols_until_update = 0; if (!m_sym_freq.try_resize(total_syms)) { clear(); return false; } if (pInitial_sym_freq) { if (!m_initial_sym_freq.try_resize(total_syms)) { clear(); return false; } memcpy(m_initial_sym_freq.begin(), pInitial_sym_freq, total_syms * m_initial_sym_freq.size_in_bytes()); } if (!m_code_sizes.try_resize(total_syms)) { clear(); return false; } m_total_syms = total_syms; if (m_total_syms <= 16) m_decoder_table_bits = 0; else m_decoder_table_bits = static_cast<uint8>(math::minimum(1 + math::ceil_log2i(m_total_syms), prefix_coding::cMaxTableBits)); if (m_encoding) { lzham_delete(m_pDecode_tables); m_pDecode_tables = NULL; if (!m_codes.try_resize(total_syms)) { clear(); return false; } } else if (!m_pDecode_tables) { m_pDecode_tables = lzham_new<prefix_coding::decoder_tables>(); if (!m_pDecode_tables) { clear(); return false; } } // TODO: Make this setting a user controllable parameter? if (m_fast_updating) m_max_cycle = (LZHAM_MAX(64, m_total_syms) + 6) << 5; else { #if LZHAM_MORE_FREQUENT_TABLE_UPDATING m_max_cycle = (LZHAM_MAX(24, m_total_syms) + 6) * 12; #else m_max_cycle = (LZHAM_MAX(32, m_total_syms) + 6) * 16; #endif } m_max_cycle = LZHAM_MIN(m_max_cycle, 32767); reset(); return true; } bool raw_quasi_adaptive_huffman_data_model::reset() { if (!m_total_syms) return true; if (m_initial_sym_freq.size()) { m_update_cycle = 0; for (uint i = 0; i < m_total_syms; i++) { uint sym_freq = m_initial_sym_freq[i]; m_sym_freq[i] = static_cast<uint16>(sym_freq); m_update_cycle += sym_freq; } } else { for (uint i = 0; i < m_total_syms; i++) m_sym_freq[i] = 1; m_update_cycle = m_total_syms; } m_total_count = 0; m_symbols_until_update = 0; if (!update()) return false; m_symbols_until_update = m_update_cycle = 8; return true; } void raw_quasi_adaptive_huffman_data_model::rescale() { uint total_freq = 0; for (uint i = 0; i < m_total_syms; i++) { uint freq = (m_sym_freq[i] + 1) >> 1; total_freq += freq; m_sym_freq[i] = static_cast<uint16>(freq); } m_total_count = total_freq; } void raw_quasi_adaptive_huffman_data_model::reset_update_rate() { m_total_count += (m_update_cycle - m_symbols_until_update); #ifdef _DEBUG uint actual_total = 0; for (uint i = 0; i < m_sym_freq.size(); i++) actual_total += m_sym_freq[i]; LZHAM_ASSERT(actual_total == m_total_count); #endif if (m_total_count > m_total_syms) rescale(); m_symbols_until_update = m_update_cycle = LZHAM_MIN(8, m_update_cycle); } bool raw_quasi_adaptive_huffman_data_model::update() { LZHAM_ASSERT(!m_symbols_until_update); m_total_count += m_update_cycle; LZHAM_ASSERT(m_total_count <= 65535); while (m_total_count >= 32768) rescale(); uint table_size = m_use_polar_codes ? get_generate_polar_codes_table_size() : get_generate_huffman_codes_table_size(); void *pTables = alloca(table_size); uint max_code_size, total_freq; bool status; if (m_use_polar_codes) status = generate_polar_codes(pTables, m_total_syms, &m_sym_freq[0], &m_code_sizes[0], max_code_size, total_freq); else status = generate_huffman_codes(pTables, m_total_syms, &m_sym_freq[0], &m_code_sizes[0], max_code_size, total_freq); LZHAM_ASSERT(status); LZHAM_ASSERT(total_freq == m_total_count); if ((!status) || (total_freq != m_total_count)) return false; if (max_code_size > prefix_coding::cMaxExpectedCodeSize) { status = prefix_coding::limit_max_code_size(m_total_syms, &m_code_sizes[0], prefix_coding::cMaxExpectedCodeSize); LZHAM_ASSERT(status); if (!status) return false; } if (m_encoding) status = prefix_coding::generate_codes(m_total_syms, &m_code_sizes[0], &m_codes[0]); else status = prefix_coding::generate_decoder_tables(m_total_syms, &m_code_sizes[0], m_pDecode_tables, m_decoder_table_bits); LZHAM_ASSERT(status); if (!status) return false; if (m_fast_updating) m_update_cycle = 2 * m_update_cycle; else m_update_cycle = (5 * m_update_cycle) >> 2; if (m_update_cycle > m_max_cycle) m_update_cycle = m_max_cycle; m_symbols_until_update = m_update_cycle; return true; } bool raw_quasi_adaptive_huffman_data_model::update(uint sym) { uint freq = m_sym_freq[sym]; freq++; m_sym_freq[sym] = static_cast<uint16>(freq); LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); if (--m_symbols_until_update == 0) { if (!update()) return false; } return true; } adaptive_bit_model::adaptive_bit_model() { clear(); } adaptive_bit_model::adaptive_bit_model(float prob0) { set_probability_0(prob0); } adaptive_bit_model::adaptive_bit_model(const adaptive_bit_model& other) : m_bit_0_prob(other.m_bit_0_prob) { } void adaptive_bit_model::set_probability_0(float prob0) { m_bit_0_prob = static_cast<uint16>(math::clamp<uint>((uint)(prob0 * cSymbolCodecArithProbScale), 1, cSymbolCodecArithProbScale - 1)); } adaptive_arith_data_model::adaptive_arith_data_model(bool encoding, uint total_syms) { init(encoding, total_syms); } adaptive_arith_data_model::adaptive_arith_data_model(const adaptive_arith_data_model& other) { m_total_syms = other.m_total_syms; m_probs = other.m_probs; } adaptive_arith_data_model::~adaptive_arith_data_model() { } adaptive_arith_data_model& adaptive_arith_data_model::operator= (const adaptive_arith_data_model& rhs) { m_total_syms = rhs.m_total_syms; m_probs = rhs.m_probs; return *this; } void adaptive_arith_data_model::clear() { m_total_syms = 0; m_probs.clear(); } bool adaptive_arith_data_model::init(bool /*encoding*/, uint total_syms) { //encoding; if (!total_syms) { clear(); return true; } if ((total_syms < 2) || (!math::is_power_of_2(total_syms))) total_syms = math::next_pow2_32(total_syms); m_total_syms = total_syms; if (!m_probs.try_resize(m_total_syms)) return false; return true; } void adaptive_arith_data_model::reset() { for (uint i = 0; i < m_probs.size(); i++) m_probs[i].clear(); } void adaptive_arith_data_model::reset_update_rate() { } bool adaptive_arith_data_model::update(uint sym) { uint node = 1; uint bitmask = m_total_syms; do { bitmask >>= 1; uint bit = (sym & bitmask) ? 1 : 0; m_probs[node].update(bit); node = (node << 1) + bit; } while (bitmask > 1); return true; } bit_cost_t adaptive_arith_data_model::get_cost(uint sym) const { uint node = 1; uint bitmask = m_total_syms; bit_cost_t cost = 0; do { bitmask >>= 1; uint bit = (sym & bitmask) ? 1 : 0; cost += m_probs[node].get_cost(bit); node = (node << 1) + bit; } while (bitmask > 1); return cost; } symbol_codec::symbol_codec() { clear(); } void symbol_codec::reset() { m_pDecode_buf = NULL; m_pDecode_buf_next = NULL; m_pDecode_buf_end = NULL; m_decode_buf_size = 0; m_bit_buf = 0; m_bit_count = 0; m_total_model_updates = 0; m_mode = cNull; m_total_bits_written = 0; m_arith_base = 0; m_arith_value = 0; m_arith_length = 0; m_arith_total_bits = 0; m_output_buf.try_resize(0); m_arith_output_buf.try_resize(0); m_output_syms.try_resize(0); m_pDecode_need_bytes_func = NULL; m_pDecode_private_data = NULL; m_pSaved_huff_model = NULL; m_pSaved_model = NULL; m_saved_node_index = 0; } void symbol_codec::clear() { reset(); m_output_buf.clear(); m_arith_output_buf.clear(); m_output_syms.clear(); } bool symbol_codec::start_encoding(uint expected_file_size) { m_mode = cEncoding; m_total_model_updates = 0; m_total_bits_written = 0; if (!put_bits_init(expected_file_size)) return false; m_output_syms.try_resize(0); arith_start_encoding(); return true; } bool symbol_codec::encode_bits(uint bits, uint num_bits) { LZHAM_ASSERT(m_mode == cEncoding); if (!num_bits) return true; LZHAM_ASSERT((num_bits == 32) || (bits <= ((1U << num_bits) - 1))); if (num_bits > 16) { if (!record_put_bits(bits >> 16, num_bits - 16)) return false; if (!record_put_bits(bits & 0xFFFF, 16)) return false; } else { if (!record_put_bits(bits, num_bits)) return false; } return true; } bool symbol_codec::encode_arith_init() { LZHAM_ASSERT(m_mode == cEncoding); output_symbol sym; sym.m_bits = 0; sym.m_num_bits = output_symbol::cArithInit; sym.m_arith_prob0 = 0; if (!m_output_syms.try_push_back(sym)) return false; return true; } bool symbol_codec::encode_align_to_byte() { LZHAM_ASSERT(m_mode == cEncoding); output_symbol sym; sym.m_bits = 0; sym.m_num_bits = output_symbol::cAlignToByteSym; sym.m_arith_prob0 = 0; if (!m_output_syms.try_push_back(sym)) return false; return true; } bool symbol_codec::encode(uint sym, quasi_adaptive_huffman_data_model& model) { LZHAM_ASSERT(m_mode == cEncoding); LZHAM_ASSERT(model.m_encoding); if (!record_put_bits(model.m_codes[sym], model.m_code_sizes[sym])) return false; uint freq = model.m_sym_freq[sym]; freq++; model.m_sym_freq[sym] = static_cast<uint16>(freq); LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); if (--model.m_symbols_until_update == 0) { m_total_model_updates++; if (!model.update()) return false; } return true; } void symbol_codec::arith_propagate_carry() { int index = m_arith_output_buf.size() - 1; while (index >= 0) { uint c = m_arith_output_buf[index]; if (c == 0xFF) m_arith_output_buf[index] = 0; else { m_arith_output_buf[index]++; break; } index--; } } bool symbol_codec::arith_renorm_enc_interval() { do { if (!m_arith_output_buf.try_push_back((m_arith_base >> 24) & 0xFF)) return false; m_total_bits_written += 8; m_arith_base <<= 8; } while ((m_arith_length <<= 8) < cSymbolCodecArithMinLen); return true; } void symbol_codec::arith_start_encoding() { m_arith_output_buf.try_resize(0); m_arith_base = 0; m_arith_value = 0; m_arith_length = cSymbolCodecArithMaxLen; m_arith_total_bits = 0; } bool symbol_codec::encode(uint bit, adaptive_bit_model& model, bool update_model) { LZHAM_ASSERT(m_mode == cEncoding); m_arith_total_bits++; output_symbol sym; sym.m_bits = bit; sym.m_num_bits = -1; sym.m_arith_prob0 = model.m_bit_0_prob; if (!m_output_syms.try_push_back(sym)) return false; uint x = model.m_bit_0_prob * (m_arith_length >> cSymbolCodecArithProbBits); if (!bit) { if (update_model) model.m_bit_0_prob += ((cSymbolCodecArithProbScale - model.m_bit_0_prob) >> cSymbolCodecArithProbMoveBits); m_arith_length = x; } else { if (update_model) model.m_bit_0_prob -= (model.m_bit_0_prob >> cSymbolCodecArithProbMoveBits); uint orig_base = m_arith_base; m_arith_base += x; m_arith_length -= x; if (orig_base > m_arith_base) arith_propagate_carry(); } if (m_arith_length < cSymbolCodecArithMinLen) { if (!arith_renorm_enc_interval()) return false; } return true; } bool symbol_codec::encode(uint sym, adaptive_arith_data_model& model) { uint node = 1; uint bitmask = model.m_total_syms; do { bitmask >>= 1; uint bit = (sym & bitmask) ? 1 : 0; if (!encode(bit, model.m_probs[node])) return false; node = (node << 1) + bit; } while (bitmask > 1); return true; } bool symbol_codec::arith_stop_encoding() { uint orig_base = m_arith_base; if (m_arith_length > 2 * cSymbolCodecArithMinLen) { m_arith_base += cSymbolCodecArithMinLen; m_arith_length = (cSymbolCodecArithMinLen >> 1); } else { m_arith_base += (cSymbolCodecArithMinLen >> 1); m_arith_length = (cSymbolCodecArithMinLen >> 9); } if (orig_base > m_arith_base) arith_propagate_carry(); if (!arith_renorm_enc_interval()) return false; while (m_arith_output_buf.size() < 4) { if (!m_arith_output_buf.try_push_back(0)) return false; m_total_bits_written += 8; } return true; } bool symbol_codec::stop_encoding(bool support_arith) { LZHAM_ASSERT(m_mode == cEncoding); if (support_arith) { if (!arith_stop_encoding()) return false; } if (!assemble_output_buf()) return false; m_mode = cNull; return true; } bool symbol_codec::record_put_bits(uint bits, uint num_bits) { LZHAM_ASSERT(m_mode == cEncoding); LZHAM_ASSERT(num_bits <= 25); LZHAM_ASSERT(m_bit_count >= 25); if (!num_bits) return true; m_total_bits_written += num_bits; output_symbol sym; sym.m_bits = bits; sym.m_num_bits = (uint16)num_bits; sym.m_arith_prob0 = 0; if (!m_output_syms.try_push_back(sym)) return false; return true; } bool symbol_codec::put_bits_init(uint expected_size) { m_bit_buf = 0; m_bit_count = cBitBufSize; m_output_buf.try_resize(0); if (!m_output_buf.try_reserve(expected_size)) return false; return true; } bool symbol_codec::put_bits(uint bits, uint num_bits) { LZHAM_ASSERT(num_bits <= 25); LZHAM_ASSERT(m_bit_count >= 25); if (!num_bits) return true; m_bit_count -= num_bits; m_bit_buf |= (static_cast<bit_buf_t>(bits) << m_bit_count); m_total_bits_written += num_bits; while (m_bit_count <= (cBitBufSize - 8)) { if (!m_output_buf.try_push_back(static_cast<uint8>(m_bit_buf >> (cBitBufSize - 8)))) return false; m_bit_buf <<= 8; m_bit_count += 8; } return true; } bool symbol_codec::put_bits_align_to_byte() { uint num_bits_in = cBitBufSize - m_bit_count; if (num_bits_in & 7) { if (!put_bits(0, 8 - (num_bits_in & 7))) return false; } return true; } bool symbol_codec::flush_bits() { return put_bits(0, 7); // to ensure the last bits are flushed } bool symbol_codec::assemble_output_buf() { m_total_bits_written = 0; uint arith_buf_ofs = 0; // Intermix the final Arithmetic, Huffman, or plain bits to a single combined bitstream. // All bits from each source must be output in exactly the same order that the decompressor will read them. for (uint sym_index = 0; sym_index < m_output_syms.size(); sym_index++) { const output_symbol& sym = m_output_syms[sym_index]; if (sym.m_num_bits == output_symbol::cAlignToByteSym) { if (!put_bits_align_to_byte()) return false; } else if (sym.m_num_bits == output_symbol::cArithInit) { LZHAM_ASSERT(m_arith_output_buf.size()); if (m_arith_output_buf.size()) { m_arith_length = cSymbolCodecArithMaxLen; m_arith_value = 0; for (uint i = 0; i < 4; i++) { const uint c = m_arith_output_buf[arith_buf_ofs++]; m_arith_value = (m_arith_value << 8) | c; if (!put_bits(c, 8)) return false; } } } else if (sym.m_num_bits == output_symbol::cArithSym) { // This renorm logic must match the logic used in the arithmetic decoder. if (m_arith_length < cSymbolCodecArithMinLen) { do { const uint c = (arith_buf_ofs < m_arith_output_buf.size()) ? m_arith_output_buf[arith_buf_ofs++] : 0; if (!put_bits(c, 8)) return false; m_arith_value = (m_arith_value << 8) | c; } while ((m_arith_length <<= 8) < cSymbolCodecArithMinLen); } uint x = sym.m_arith_prob0 * (m_arith_length >> cSymbolCodecArithProbBits); uint bit = (m_arith_value >= x); if (bit == 0) { m_arith_length = x; } else { m_arith_value -= x; m_arith_length -= x; } LZHAM_VERIFY(bit == sym.m_bits); } else { // Huffman or plain bits if (!put_bits(sym.m_bits, sym.m_num_bits)) return false; } } return flush_bits(); } //------------------------------------------------------------------------------------------------------------------ // Decoding //------------------------------------------------------------------------------------------------------------------ bool symbol_codec::start_decoding(const uint8* pBuf, size_t buf_size, bool eof_flag, need_bytes_func_ptr pNeed_bytes_func, void *pPrivate_data) { if (!buf_size) return false; m_total_model_updates = 0; m_pDecode_buf = pBuf; m_pDecode_buf_next = pBuf; m_decode_buf_size = buf_size; m_pDecode_buf_end = pBuf + buf_size; m_pDecode_need_bytes_func = pNeed_bytes_func; m_pDecode_private_data = pPrivate_data; m_decode_buf_eof = eof_flag; m_bit_buf = 0; m_bit_count = 0; m_mode = cDecoding; return true; } uint symbol_codec::decode_bits(uint num_bits) { LZHAM_ASSERT(m_mode == cDecoding); if (!num_bits) return 0; if (num_bits > 16) { uint a = get_bits(num_bits - 16); uint b = get_bits(16); return (a << 16) | b; } else return get_bits(num_bits); } void symbol_codec::decode_remove_bits(uint num_bits) { LZHAM_ASSERT(m_mode == cDecoding); while (num_bits > 16) { remove_bits(16); num_bits -= 16; } remove_bits(num_bits); } uint symbol_codec::decode_peek_bits(uint num_bits) { LZHAM_ASSERT(m_mode == cDecoding); LZHAM_ASSERT(num_bits <= 25); if (!num_bits) return 0; while (m_bit_count < (int)num_bits) { uint c = 0; if (m_pDecode_buf_next == m_pDecode_buf_end) { if (!m_decode_buf_eof) { m_pDecode_need_bytes_func(m_pDecode_buf_next - m_pDecode_buf, m_pDecode_private_data, m_pDecode_buf, m_decode_buf_size, m_decode_buf_eof); m_pDecode_buf_end = m_pDecode_buf + m_decode_buf_size; m_pDecode_buf_next = m_pDecode_buf; if (m_pDecode_buf_next < m_pDecode_buf_end) c = *m_pDecode_buf_next++; } } else c = *m_pDecode_buf_next++; m_bit_count += 8; LZHAM_ASSERT(m_bit_count <= cBitBufSize); m_bit_buf |= (static_cast<bit_buf_t>(c) << (cBitBufSize - m_bit_count)); } return static_cast<uint>(m_bit_buf >> (cBitBufSize - num_bits)); } uint symbol_codec::decode(quasi_adaptive_huffman_data_model& model) { LZHAM_ASSERT(m_mode == cDecoding); LZHAM_ASSERT(!model.m_encoding); const prefix_coding::decoder_tables* pTables = model.m_pDecode_tables; while (m_bit_count < (cBitBufSize - 8)) { uint c = 0; if (m_pDecode_buf_next == m_pDecode_buf_end) { if (!m_decode_buf_eof) { m_pDecode_need_bytes_func(m_pDecode_buf_next - m_pDecode_buf, m_pDecode_private_data, m_pDecode_buf, m_decode_buf_size, m_decode_buf_eof); m_pDecode_buf_end = m_pDecode_buf + m_decode_buf_size; m_pDecode_buf_next = m_pDecode_buf; if (m_pDecode_buf_next < m_pDecode_buf_end) c = *m_pDecode_buf_next++; } } else c = *m_pDecode_buf_next++; m_bit_count += 8; m_bit_buf |= (static_cast<bit_buf_t>(c) << (cBitBufSize - m_bit_count)); } uint k = static_cast<uint>((m_bit_buf >> (cBitBufSize - 16)) + 1); uint sym, len; if (k <= pTables->m_table_max_code) { uint32 t = pTables->m_lookup[m_bit_buf >> (cBitBufSize - pTables->m_table_bits)]; LZHAM_ASSERT(t != LZHAM_UINT32_MAX); sym = t & LZHAM_UINT16_MAX; len = t >> 16; LZHAM_ASSERT(model.m_code_sizes[sym] == len); } else { len = pTables->m_decode_start_code_size; for ( ; ; ) { if (k <= pTables->m_max_codes[len - 1]) break; len++; } int val_ptr = pTables->m_val_ptrs[len - 1] + static_cast<int>((m_bit_buf >> (cBitBufSize - len))); if (((uint)val_ptr >= model.m_total_syms)) { // corrupted stream, or a bug LZHAM_ASSERT(0); return 0; } sym = pTables->m_sorted_symbol_order[val_ptr]; } m_bit_buf <<= len; m_bit_count -= len; uint freq = model.m_sym_freq[sym]; freq++; model.m_sym_freq[sym] = static_cast<uint16>(freq); LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); if (--model.m_symbols_until_update == 0) { m_total_model_updates++; model.update(); } return sym; } uint64 symbol_codec::stop_decoding() { LZHAM_ASSERT(m_mode == cDecoding); uint64 n = m_pDecode_buf_next - m_pDecode_buf; m_mode = cNull; return n; } uint symbol_codec::get_bits(uint num_bits) { LZHAM_ASSERT(num_bits <= 25); if (!num_bits) return 0; while (m_bit_count < (int)num_bits) { uint c = 0; if (m_pDecode_buf_next == m_pDecode_buf_end) { if (!m_decode_buf_eof) { m_pDecode_need_bytes_func(m_pDecode_buf_next - m_pDecode_buf, m_pDecode_private_data, m_pDecode_buf, m_decode_buf_size, m_decode_buf_eof); m_pDecode_buf_end = m_pDecode_buf + m_decode_buf_size; m_pDecode_buf_next = m_pDecode_buf; if (m_pDecode_buf_next < m_pDecode_buf_end) c = *m_pDecode_buf_next++; } } else c = *m_pDecode_buf_next++; m_bit_count += 8; LZHAM_ASSERT(m_bit_count <= cBitBufSize); m_bit_buf |= (static_cast<bit_buf_t>(c) << (cBitBufSize - m_bit_count)); } uint result = static_cast<uint>(m_bit_buf >> (cBitBufSize - num_bits)); m_bit_buf <<= num_bits; m_bit_count -= num_bits; return result; } void symbol_codec::remove_bits(uint num_bits) { LZHAM_ASSERT(num_bits <= 25); if (!num_bits) return; while (m_bit_count < (int)num_bits) { uint c = 0; if (m_pDecode_buf_next == m_pDecode_buf_end) { if (!m_decode_buf_eof) { m_pDecode_need_bytes_func(m_pDecode_buf_next - m_pDecode_buf, m_pDecode_private_data, m_pDecode_buf, m_decode_buf_size, m_decode_buf_eof); m_pDecode_buf_end = m_pDecode_buf + m_decode_buf_size; m_pDecode_buf_next = m_pDecode_buf; if (m_pDecode_buf_next < m_pDecode_buf_end) c = *m_pDecode_buf_next++; } } else c = *m_pDecode_buf_next++; m_bit_count += 8; LZHAM_ASSERT(m_bit_count <= cBitBufSize); m_bit_buf |= (static_cast<bit_buf_t>(c) << (cBitBufSize - m_bit_count)); } m_bit_buf <<= num_bits; m_bit_count -= num_bits; } void symbol_codec::decode_align_to_byte() { LZHAM_ASSERT(m_mode == cDecoding); if (m_bit_count & 7) { remove_bits(m_bit_count & 7); } } int symbol_codec::decode_remove_byte_from_bit_buf() { if (m_bit_count < 8) return -1; int result = static_cast<int>(m_bit_buf >> (cBitBufSize - 8)); m_bit_buf <<= 8; m_bit_count -= 8; return result; } uint symbol_codec::decode(adaptive_bit_model& model, bool update_model) { while (m_arith_length < cSymbolCodecArithMinLen) { uint c = get_bits(8); m_arith_value = (m_arith_value << 8) | c; m_arith_length <<= 8; } uint x = model.m_bit_0_prob * (m_arith_length >> cSymbolCodecArithProbBits); uint bit = (m_arith_value >= x); if (!bit) { if (update_model) model.m_bit_0_prob += ((cSymbolCodecArithProbScale - model.m_bit_0_prob) >> cSymbolCodecArithProbMoveBits); m_arith_length = x; } else { if (update_model) model.m_bit_0_prob -= (model.m_bit_0_prob >> cSymbolCodecArithProbMoveBits); m_arith_value -= x; m_arith_length -= x; } return bit; } uint symbol_codec::decode(adaptive_arith_data_model& model) { uint node = 1; do { uint bit = decode(model.m_probs[node]); node = (node << 1) + bit; } while (node < model.m_total_syms); return node - model.m_total_syms; } void symbol_codec::start_arith_decoding() { LZHAM_ASSERT(m_mode == cDecoding); m_arith_length = cSymbolCodecArithMaxLen; m_arith_value = 0; m_arith_value = (get_bits(8) << 24); m_arith_value |= (get_bits(8) << 16); m_arith_value |= (get_bits(8) << 8); m_arith_value |= get_bits(8); } void symbol_codec::decode_need_bytes() { if (!m_decode_buf_eof) { m_pDecode_need_bytes_func(m_pDecode_buf_next - m_pDecode_buf, m_pDecode_private_data, m_pDecode_buf, m_decode_buf_size, m_decode_buf_eof); m_pDecode_buf_end = m_pDecode_buf + m_decode_buf_size; m_pDecode_buf_next = m_pDecode_buf; } } } // namespace lzham �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_traits.h���������������������������������������������0000644�0001750�0001750�00000010374�12320456500�022376� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_traits.h // See Copyright Notice and license at the end of include/lzham.h #pragma once namespace lzham { template<typename T> struct scalar_type { enum { cFlag = false }; static inline void construct(T* p) { helpers::construct(p); } static inline void construct(T* p, const T& init) { helpers::construct(p, init); } static inline void construct_array(T* p, uint n) { helpers::construct_array(p, n); } static inline void destruct(T* p) { helpers::destruct(p); } static inline void destruct_array(T* p, uint n) { helpers::destruct_array(p, n); } }; template<typename T> struct scalar_type<T*> { enum { cFlag = true }; static inline void construct(T** p) { memset(p, 0, sizeof(T*)); } static inline void construct(T** p, T* init) { *p = init; } static inline void construct_array(T** p, uint n) { memset(p, 0, sizeof(T*) * n); } static inline void destruct(T** p) { p; } static inline void destruct_array(T** p, uint n) { p, n; } }; #define LZHAM_DEFINE_BUILT_IN_TYPE(X) \ template<> struct scalar_type<X> { \ enum { cFlag = true }; \ static inline void construct(X* p) { memset(p, 0, sizeof(X)); } \ static inline void construct(X* p, const X& init) { memcpy(p, &init, sizeof(X)); } \ static inline void construct_array(X* p, uint n) { memset(p, 0, sizeof(X) * n); } \ static inline void destruct(X* /*p*/) { /*p;*/ } \ static inline void destruct_array(X* /*p*/, uint /*n*/) { /*p, n;*/ } }; LZHAM_DEFINE_BUILT_IN_TYPE(bool) LZHAM_DEFINE_BUILT_IN_TYPE(char) LZHAM_DEFINE_BUILT_IN_TYPE(unsigned char) LZHAM_DEFINE_BUILT_IN_TYPE(short) LZHAM_DEFINE_BUILT_IN_TYPE(unsigned short) LZHAM_DEFINE_BUILT_IN_TYPE(int) LZHAM_DEFINE_BUILT_IN_TYPE(unsigned int) LZHAM_DEFINE_BUILT_IN_TYPE(long) LZHAM_DEFINE_BUILT_IN_TYPE(unsigned long) LZHAM_DEFINE_BUILT_IN_TYPE(float) LZHAM_DEFINE_BUILT_IN_TYPE(double) LZHAM_DEFINE_BUILT_IN_TYPE(long double) #if defined(WIN32) LZHAM_DEFINE_BUILT_IN_TYPE(__int64) LZHAM_DEFINE_BUILT_IN_TYPE(unsigned __int64) #endif #undef LZHAM_DEFINE_BUILT_IN_TYPE // See: http://erdani.org/publications/cuj-2004-06.pdf template<typename T> struct bitwise_movable { enum { cFlag = false }; }; // Defines type Q as bitwise movable. #define LZHAM_DEFINE_BITWISE_MOVABLE(Q) template<> struct bitwise_movable<Q> { enum { cFlag = true }; }; template<typename T> struct bitwise_copyable { enum { cFlag = false }; }; // Defines type Q as bitwise copyable. #define LZHAM_DEFINE_BITWISE_COPYABLE(Q) template<> struct bitwise_copyable<Q> { enum { cFlag = true }; }; #define LZHAM_IS_POD(T) __is_pod(T) #define LZHAM_IS_SCALAR_TYPE(T) (scalar_type<T>::cFlag) #define LZHAM_IS_BITWISE_COPYABLE(T) ((scalar_type<T>::cFlag) || (bitwise_copyable<T>::cFlag) || LZHAM_IS_POD(T)) #define LZHAM_IS_BITWISE_MOVABLE(T) (LZHAM_IS_BITWISE_COPYABLE(T) || (bitwise_movable<T>::cFlag)) #define LZHAM_HAS_DESTRUCTOR(T) ((!scalar_type<T>::cFlag) && (!__is_pod(T))) // From yasli_traits.h: // Credit goes to Boost; // also found in the C++ Templates book by Vandevoorde and Josuttis typedef char (&yes_t)[1]; typedef char (&no_t)[2]; template <class U> yes_t class_test(int U::*); template <class U> no_t class_test(...); template <class T> struct is_class { enum { value = (sizeof(class_test<T>(0)) == sizeof(yes_t)) }; }; template <typename T> struct is_pointer { enum { value = false }; }; template <typename T> struct is_pointer<T*> { enum { value = true }; }; LZHAM_DEFINE_BITWISE_COPYABLE(empty_type); LZHAM_DEFINE_BITWISE_MOVABLE(empty_type); namespace helpers { template <typename T> inline void construct_array(T* p, uint n) { if (LZHAM_IS_SCALAR_TYPE(T)) { memset(p, 0, sizeof(T) * n); } else { T* q = p + n; for ( ; p != q; ++p) new (static_cast<void*>(p)) T; } } template <typename T> inline void destruct_array(T* p, uint n) { if ( LZHAM_HAS_DESTRUCTOR(T) ) { T* q = p + n; for ( ; p != q; ++p) p->~T(); } } } } // namespace lzham ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_config.h���������������������������������������������0000644�0001750�0001750�00000000676�12320456500�022341� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_config.h // See Copyright Notice and license at the end of include/lzham.h #pragma once #ifdef _DEBUG #define LZHAM_BUILD_DEBUG #ifndef DEBUG #define DEBUG #endif #else #define LZHAM_BUILD_RELEASE #ifndef NDEBUG #define NDEBUG #endif #ifdef DEBUG #error DEBUG cannot be defined in LZHAM_BUILD_RELEASE #endif #endif #define LZHAM_BUFFERED_PRINTF 0 #define LZHAM_PERF_SECTIONS 0������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_timer.cpp��������������������������������������������0000644�0001750�0001750�00000006075�12320456500�022546� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_timer.cpp // See Copyright Notice and license at the end of include/lzham.h #include "lzham_core.h" #include "lzham_timer.h" #ifndef LZHAM_USE_WIN32_API #include <time.h> #endif namespace lzham { unsigned long long lzham_timer::g_init_ticks; unsigned long long lzham_timer::g_freq; double lzham_timer::g_inv_freq; #if LZHAM_USE_WIN32_API inline void query_counter(timer_ticks *pTicks) { QueryPerformanceCounter(reinterpret_cast<LARGE_INTEGER*>(pTicks)); } inline void query_counter_frequency(timer_ticks *pTicks) { QueryPerformanceFrequency(reinterpret_cast<LARGE_INTEGER*>(pTicks)); } #else inline void query_counter(timer_ticks *pTicks) { *pTicks = clock(); } inline void query_counter_frequency(timer_ticks *pTicks) { *pTicks = CLOCKS_PER_SEC; } #endif lzham_timer::lzham_timer() : m_start_time(0), m_stop_time(0), m_started(false), m_stopped(false) { if (!g_inv_freq) init(); } lzham_timer::lzham_timer(timer_ticks start_ticks) { if (!g_inv_freq) init(); m_start_time = start_ticks; m_started = true; m_stopped = false; } void lzham_timer::start(timer_ticks start_ticks) { m_start_time = start_ticks; m_started = true; m_stopped = false; } void lzham_timer::start() { query_counter(&m_start_time); m_started = true; m_stopped = false; } void lzham_timer::stop() { LZHAM_ASSERT(m_started); query_counter(&m_stop_time); m_stopped = true; } double lzham_timer::get_elapsed_secs() const { LZHAM_ASSERT(m_started); if (!m_started) return 0; timer_ticks stop_time = m_stop_time; if (!m_stopped) query_counter(&stop_time); timer_ticks delta = stop_time - m_start_time; return delta * g_inv_freq; } timer_ticks lzham_timer::get_elapsed_us() const { LZHAM_ASSERT(m_started); if (!m_started) return 0; timer_ticks stop_time = m_stop_time; if (!m_stopped) query_counter(&stop_time); timer_ticks delta = stop_time - m_start_time; return (delta * 1000000ULL + (g_freq >> 1U)) / g_freq; } void lzham_timer::init() { if (!g_inv_freq) { query_counter_frequency(&g_freq); g_inv_freq = 1.0f / g_freq; query_counter(&g_init_ticks); } } timer_ticks lzham_timer::get_init_ticks() { if (!g_inv_freq) init(); return g_init_ticks; } timer_ticks lzham_timer::get_ticks() { if (!g_inv_freq) init(); timer_ticks ticks; query_counter(&ticks); return ticks - g_init_ticks; } double lzham_timer::ticks_to_secs(timer_ticks ticks) { if (!g_inv_freq) init(); return ticks * g_inv_freq; } } // namespace lzham�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_static_lib.h�����������������������������������������0000644�0001750�0001750�00000004242�12320456500�023202� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#pragma once #define LZHAM_STATIC_LIB 1 #include "lzham.h" #ifdef __cplusplus // Like lzham_dynamic_lib, except it sets the function pointer members to point directly to the C functions in lzhamlib class lzham_static_lib : public ilzham { lzham_static_lib(const lzham_static_lib &other); lzham_static_lib& operator= (const lzham_static_lib &rhs); public: lzham_static_lib() : ilzham() { } virtual ~lzham_static_lib() { } virtual bool load() { this->lzham_get_version = ::lzham_get_version; this->lzham_set_memory_callbacks = ::lzham_set_memory_callbacks; this->lzham_compress_init = ::lzham_compress_init; this->lzham_compress_deinit = ::lzham_compress_deinit; this->lzham_compress = ::lzham_compress; this->lzham_compress2 = ::lzham_compress2; this->lzham_compress_memory = ::lzham_compress_memory; this->lzham_decompress_init = ::lzham_decompress_init; this->lzham_decompress_reinit = ::lzham_decompress_reinit; this->lzham_decompress_deinit = ::lzham_decompress_deinit; this->lzham_decompress = ::lzham_decompress; this->lzham_decompress_memory = ::lzham_decompress_memory; this->lzham_z_version = ::lzham_z_version; this->lzham_z_deflateInit = ::lzham_z_deflateInit; this->lzham_z_deflateInit2 = ::lzham_z_deflateInit2; this->lzham_z_deflateReset = ::lzham_z_deflateReset; this->lzham_z_deflate = ::lzham_z_deflate; this->lzham_z_deflateEnd = ::lzham_z_deflateEnd; this->lzham_z_deflateBound = ::lzham_z_deflateBound; this->lzham_z_compress = ::lzham_z_compress; this->lzham_z_compress2 = ::lzham_z_compress2; this->lzham_z_compressBound = ::lzham_z_compressBound; this->lzham_z_inflateInit = ::lzham_z_inflateInit; this->lzham_z_inflateInit2 = ::lzham_z_inflateInit2; this->lzham_z_inflate = ::lzham_z_inflate; this->lzham_z_inflateEnd = ::lzham_z_inflateEnd; this->lzham_z_uncompress = ::lzham_z_uncompress; this->lzham_z_error = ::lzham_z_error; return true; } virtual void unload() { clear(); } virtual bool is_loaded() { return lzham_get_version != NULL; } }; #endif // __cplusplus ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_mem.cpp����������������������������������������������0000644�0001750�0001750�00000016470�12320456500�022204� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_mem.cpp // See Copyright Notice and license at the end of include/lzham.h #include "lzham_core.h" #if !defined(__APPLE__) #include <malloc.h> #else #include <malloc/malloc.h> #endif using namespace lzham; #define LZHAM_MEM_STATS 0 #ifndef LZHAM_USE_WIN32_API #if !defined(__APPLE__) #define _msize malloc_usable_size #else #define _msize malloc_size #endif #endif namespace lzham { #if LZHAM_64BIT_POINTERS const uint64 MAX_POSSIBLE_BLOCK_SIZE = 0x400000000ULL; #else const uint32 MAX_POSSIBLE_BLOCK_SIZE = 0x7FFF0000U; #endif #if LZHAM_MEM_STATS #if LZHAM_64BIT_POINTERS typedef atomic64_t mem_stat_t; #define LZHAM_MEM_COMPARE_EXCHANGE atomic_compare_exchange64 #else typedef atomic32_t mem_stat_t; #define LZHAM_MEM_COMPARE_EXCHANGE atomic_compare_exchange32 #endif static volatile atomic32_t g_total_blocks; static volatile mem_stat_t g_total_allocated; static volatile mem_stat_t g_max_allocated; static mem_stat_t update_total_allocated(int block_delta, mem_stat_t byte_delta) { atomic32_t cur_total_blocks; for ( ; ; ) { cur_total_blocks = g_total_blocks; atomic32_t new_total_blocks = static_cast<atomic32_t>(cur_total_blocks + block_delta); LZHAM_ASSERT(new_total_blocks >= 0); if (atomic_compare_exchange32(&g_total_blocks, new_total_blocks, cur_total_blocks) == cur_total_blocks) break; } mem_stat_t cur_total_allocated, new_total_allocated; for ( ; ; ) { cur_total_allocated = g_total_allocated; new_total_allocated = static_cast<mem_stat_t>(cur_total_allocated + byte_delta); LZHAM_ASSERT(new_total_allocated >= 0); if (LZHAM_MEM_COMPARE_EXCHANGE(&g_total_allocated, new_total_allocated, cur_total_allocated) == cur_total_allocated) break; } for ( ; ; ) { mem_stat_t cur_max_allocated = g_max_allocated; mem_stat_t new_max_allocated = LZHAM_MAX(new_total_allocated, cur_max_allocated); if (LZHAM_MEM_COMPARE_EXCHANGE(&g_max_allocated, new_max_allocated, cur_max_allocated) == cur_max_allocated) break; } return new_total_allocated; } #endif // LZHAM_MEM_STATS static void* lzham_default_realloc(void* p, size_t size, size_t* pActual_size, lzham_bool movable, void* /*pUser_data*/) { //pUser_data; void* p_new; if (!p) { p_new = malloc(size); LZHAM_ASSERT( (reinterpret_cast<ptr_bits_t>(p_new) & (LZHAM_MIN_ALLOC_ALIGNMENT - 1)) == 0 ); if (pActual_size) *pActual_size = p_new ? _msize(p_new) : 0; } else if (!size) { free(p); p_new = NULL; if (pActual_size) *pActual_size = 0; } else { void* p_final_block = p; #ifdef WIN32 p_new = _expand(p, size); #else p_new = NULL; #endif if (p_new) { LZHAM_ASSERT( (reinterpret_cast<ptr_bits_t>(p_new) & (LZHAM_MIN_ALLOC_ALIGNMENT - 1)) == 0 ); p_final_block = p_new; } else if (movable) { p_new = realloc(p, size); if (p_new) { LZHAM_ASSERT( (reinterpret_cast<ptr_bits_t>(p_new) & (LZHAM_MIN_ALLOC_ALIGNMENT - 1)) == 0 ); p_final_block = p_new; } } if (pActual_size) *pActual_size = _msize(p_final_block); } return p_new; } static size_t lzham_default_msize(void* p, void* /*pUser_data*/) { //pUser_data; return p ? _msize(p) : 0; } static lzham_realloc_func g_pRealloc = lzham_default_realloc; static lzham_msize_func g_pMSize = lzham_default_msize; static void* g_pUser_data; static inline void lzham_mem_error(const char* p_msg) { lzham_assert(p_msg, __FILE__, __LINE__); } void* lzham_malloc(size_t size, size_t* pActual_size) { size = (size + sizeof(uint32) - 1U) & ~(sizeof(uint32) - 1U); if (!size) size = sizeof(uint32); if (size > MAX_POSSIBLE_BLOCK_SIZE) { lzham_mem_error("lzham_malloc: size too big"); return NULL; } size_t actual_size = size; uint8* p_new = static_cast<uint8*>((*g_pRealloc)(NULL, size, &actual_size, true, g_pUser_data)); if (pActual_size) *pActual_size = actual_size; if ((!p_new) || (actual_size < size)) { lzham_mem_error("lzham_malloc: out of memory"); return NULL; } LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(p_new) & (LZHAM_MIN_ALLOC_ALIGNMENT - 1)) == 0); #if LZHAM_MEM_STATS update_total_allocated(1, static_cast<mem_stat_t>(actual_size)); #endif return p_new; } void* lzham_realloc(void* p, size_t size, size_t* pActual_size, bool movable) { if ((ptr_bits_t)p & (LZHAM_MIN_ALLOC_ALIGNMENT - 1)) { lzham_mem_error("lzham_realloc: bad ptr"); return NULL; } if (size > MAX_POSSIBLE_BLOCK_SIZE) { lzham_mem_error("lzham_malloc: size too big"); return NULL; } #if LZHAM_MEM_STATS size_t cur_size = p ? (*g_pMSize)(p, g_pUser_data) : 0; #endif size_t actual_size = size; void* p_new = (*g_pRealloc)(p, size, &actual_size, movable, g_pUser_data); if (pActual_size) *pActual_size = actual_size; LZHAM_ASSERT((reinterpret_cast<ptr_bits_t>(p_new) & (LZHAM_MIN_ALLOC_ALIGNMENT - 1)) == 0); #if LZHAM_MEM_STATS int num_new_blocks = 0; if (p) { if (!p_new) num_new_blocks = -1; } else if (p_new) { num_new_blocks = 1; } update_total_allocated(num_new_blocks, static_cast<mem_stat_t>(actual_size) - static_cast<mem_stat_t>(cur_size)); #endif return p_new; } void lzham_free(void* p) { if (!p) return; if (reinterpret_cast<ptr_bits_t>(p) & (LZHAM_MIN_ALLOC_ALIGNMENT - 1)) { lzham_mem_error("lzham_free: bad ptr"); return; } #if LZHAM_MEM_STATS size_t cur_size = (*g_pMSize)(p, g_pUser_data); update_total_allocated(-1, -static_cast<mem_stat_t>(cur_size)); #endif (*g_pRealloc)(p, 0, NULL, true, g_pUser_data); } size_t lzham_msize(void* p) { if (!p) return 0; if (reinterpret_cast<ptr_bits_t>(p) & (LZHAM_MIN_ALLOC_ALIGNMENT - 1)) { lzham_mem_error("lzham_msize: bad ptr"); return 0; } return (*g_pMSize)(p, g_pUser_data); } void LZHAM_CDECL lzham_lib_set_memory_callbacks(lzham_realloc_func pRealloc, lzham_msize_func pMSize, void* pUser_data) { if ((!pRealloc) || (!pMSize)) { g_pRealloc = lzham_default_realloc; g_pMSize = lzham_default_msize; g_pUser_data = NULL; } else { g_pRealloc = pRealloc; g_pMSize = pMSize; g_pUser_data = pUser_data; } } void lzham_print_mem_stats() { #if LZHAM_MEM_STATS printf("Current blocks: %u, allocated: %I64u, max ever allocated: %I64i\n", g_total_blocks, (int64)g_total_allocated, (int64)g_max_allocated); #endif } } // namespace lzham ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_core.h�����������������������������������������������0000644�0001750�0001750�00000010627�12320456500�022021� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_core.h // See Copyright Notice and license at the end of include/lzham.h #pragma once #if defined(_MSC_VER) #pragma warning (disable: 4127) // conditional expression is constant #endif #if defined(_XBOX) && !defined(LZHAM_ANSI_CPLUSPLUS) // X360 #include <xtl.h> #define _HAS_EXCEPTIONS 0 #define NOMINMAX #define LZHAM_PLATFORM_X360 1 #define LZHAM_USE_WIN32_API 1 #define LZHAM_USE_WIN32_ATOMIC_FUNCTIONS 1 #define LZHAM_64BIT_POINTERS 0 #define LZHAM_CPU_HAS_64BIT_REGISTERS 1 #define LZHAM_BIG_ENDIAN_CPU 1 #define LZHAM_USE_UNALIGNED_INT_LOADS 1 #define LZHAM_RESTRICT __restrict #define LZHAM_FORCE_INLINE __forceinline #elif defined(WIN32) && !defined(LZHAM_ANSI_CPLUSPLUS) // MSVC or MinGW, x86 or x64, Win32 API's for threading and Win32 Interlocked API's or GCC built-ins for atomic ops. #ifdef NDEBUG // Ensure checked iterators are disabled. #define _SECURE_SCL 0 #define _HAS_ITERATOR_DEBUGGING 0 #endif #ifndef _DLL // If we're using the DLL form of the run-time libs, we're also going to be enabling exceptions because we'll be building CLR apps. // Otherwise, we disable exceptions for a small speed boost. #define _HAS_EXCEPTIONS 0 #endif #define NOMINMAX #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x500 #endif #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #include <windows.h> #define LZHAM_USE_WIN32_API 1 #if defined(__MINGW32__) || defined(__MINGW64__) #define LZHAM_USE_GCC_ATOMIC_BUILTINS 1 #else #define LZHAM_USE_WIN32_ATOMIC_FUNCTIONS 1 #endif #define LZHAM_PLATFORM_PC 1 #ifdef _WIN64 #define LZHAM_PLATFORM_PC_X64 1 #define LZHAM_64BIT_POINTERS 1 #define LZHAM_CPU_HAS_64BIT_REGISTERS 1 #define LZHAM_LITTLE_ENDIAN_CPU 1 #else #define LZHAM_PLATFORM_PC_X86 1 #define LZHAM_64BIT_POINTERS 0 #define LZHAM_CPU_HAS_64BIT_REGISTERS 0 #define LZHAM_LITTLE_ENDIAN_CPU 1 #endif #define LZHAM_USE_UNALIGNED_INT_LOADS 1 #define LZHAM_RESTRICT __restrict #define LZHAM_FORCE_INLINE __forceinline #if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__) #define LZHAM_USE_MSVC_INTRINSICS 1 #endif #elif defined(__GNUC__) && !defined(LZHAM_ANSI_CPLUSPLUS) // GCC x86 or x64, pthreads for threading and GCC built-ins for atomic ops. #define LZHAM_PLATFORM_PC 1 #if defined(_WIN64) || defined(__MINGW64__) || defined(_LP64) || defined(__LP64__) #define LZHAM_PLATFORM_PC_X64 1 #define LZHAM_64BIT_POINTERS 1 #define LZHAM_CPU_HAS_64BIT_REGISTERS 1 #else #define LZHAM_PLATFORM_PC_X86 1 #define LZHAM_64BIT_POINTERS 0 #define LZHAM_CPU_HAS_64BIT_REGISTERS 0 #endif #define LZHAM_USE_UNALIGNED_INT_LOADS 1 #define LZHAM_LITTLE_ENDIAN_CPU 1 #define LZHAM_USE_PTHREADS_API 1 #define LZHAM_USE_GCC_ATOMIC_BUILTINS 1 #define LZHAM_RESTRICT #define LZHAM_FORCE_INLINE inline __attribute__((__always_inline__,__gnu_inline__)) #else // Vanilla ANSI-C/C++ // No threading support, unaligned loads are NOT okay. #if defined(_WIN64) || defined(__MINGW64__) || defined(_LP64) || defined(__LP64__) #define LZHAM_64BIT_POINTERS 1 #define LZHAM_CPU_HAS_64BIT_REGISTERS 1 #else #define LZHAM_64BIT_POINTERS 0 #define LZHAM_CPU_HAS_64BIT_REGISTERS 0 #endif #define LZHAM_USE_UNALIGNED_INT_LOADS 0 #if __BIG_ENDIAN__ #define LZHAM_BIG_ENDIAN_CPU 1 #else #define LZHAM_LITTLE_ENDIAN_CPU 1 #endif #define LZHAM_USE_GCC_ATOMIC_BUILTINS 0 #define LZHAM_USE_WIN32_ATOMIC_FUNCTIONS 0 #define LZHAM_RESTRICT #define LZHAM_FORCE_INLINE inline #endif #if LZHAM_LITTLE_ENDIAN_CPU const bool c_lzham_little_endian_platform = true; #else const bool c_lzham_little_endian_platform = false; #endif const bool c_lzham_big_endian_platform = !c_lzham_little_endian_platform; #include <stdlib.h> #include <stdio.h> #include <math.h> //#include <malloc.h> // #include <stdlib.h> should get us malloc #include <stdarg.h> #include <memory.h> #include <limits.h> #include <algorithm> #include <errno.h> #include "lzham.h" #include "lzham_config.h" #include "lzham_types.h" #include "lzham_assert.h" #include "lzham_platform.h" #include "lzham_helpers.h" #include "lzham_traits.h" #include "lzham_mem.h" #include "lzham_math.h" #include "lzham_utils.h" #include "lzham_vector.h" ���������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_threading.h������������������������������������������0000644�0001750�0001750�00000000426�12320456500�023032� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_threading.h // See Copyright Notice and license at the end of include/lzham.h #if LZHAM_USE_WIN32_API #include "lzham_win32_threading.h" #elif LZHAM_USE_PTHREADS_API #include "lzham_pthreads_threading.h" #else #include "lzham_null_threading.h" #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_vector.cpp�������������������������������������������0000644�0001750�0001750�00000004212�12320456500�022717� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_vector.cpp // See Copyright Notice and license at the end of include/lzham.h #include "lzham_core.h" #include "lzham_vector.h" namespace lzham { bool elemental_vector::increase_capacity(uint min_new_capacity, bool grow_hint, uint element_size, object_mover pMover, bool nofail) { LZHAM_ASSERT(m_size <= m_capacity); #if LZHAM_64BIT_POINTERS LZHAM_ASSUME(sizeof(void*) == sizeof(uint64)); LZHAM_ASSERT(min_new_capacity < (0x400000000ULL / element_size)); #else LZHAM_ASSUME(sizeof(void*) == sizeof(uint32)); LZHAM_ASSERT(min_new_capacity < (0x7FFF0000U / element_size)); #endif if (m_capacity >= min_new_capacity) return true; size_t new_capacity = min_new_capacity; if ((grow_hint) && (!math::is_power_of_2(new_capacity))) new_capacity = math::next_pow2(new_capacity); LZHAM_ASSERT(new_capacity && (new_capacity > m_capacity)); const size_t desired_size = element_size * new_capacity; size_t actual_size; if (!pMover) { void* new_p = lzham_realloc(m_p, desired_size, &actual_size, true); if (!new_p) { if (nofail) return false; char buf[256]; sprintf_s(buf, sizeof(buf), "vector: lzham_realloc() failed allocating %u bytes", desired_size); LZHAM_FAIL(buf); } m_p = new_p; } else { void* new_p = lzham_malloc(desired_size, &actual_size); if (!new_p) { if (nofail) return false; char buf[256]; sprintf_s(buf, sizeof(buf), "vector: lzham_malloc() failed allocating %u bytes", desired_size); LZHAM_FAIL(buf); } (*pMover)(new_p, m_p, m_size); if (m_p) lzham_free(m_p); m_p = new_p; } if (actual_size > desired_size) m_capacity = static_cast<uint>(actual_size / element_size); else m_capacity = static_cast<uint>(new_capacity); return true; } } // namespace lzham ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_win32_threading.h������������������������������������0000644�0001750�0001750�00000021037�12320456500�024055� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_task_pool_win32.h // See Copyright Notice and license at the end of include/lzham.h #pragma once #if LZHAM_USE_WIN32_API #if LZHAM_NO_ATOMICS #error No atomic operations defined in lzham_platform.h! #endif namespace lzham { class semaphore { LZHAM_NO_COPY_OR_ASSIGNMENT_OP(semaphore); public: semaphore(long initialCount = 0, long maximumCount = 1, const char* pName = NULL) { m_handle = CreateSemaphoreA(NULL, initialCount, maximumCount, pName); if (NULL == m_handle) { LZHAM_FAIL("semaphore: CreateSemaphore() failed"); } } ~semaphore() { if (m_handle) { CloseHandle(m_handle); m_handle = NULL; } } inline HANDLE get_handle(void) const { return m_handle; } void release(long releaseCount = 1) { if (0 == ReleaseSemaphore(m_handle, releaseCount, NULL)) { LZHAM_FAIL("semaphore: ReleaseSemaphore() failed"); } } bool wait(uint32 milliseconds = LZHAM_UINT32_MAX) { LZHAM_ASSUME(INFINITE == LZHAM_UINT32_MAX); DWORD result = WaitForSingleObject(m_handle, milliseconds); if (WAIT_FAILED == result) { LZHAM_FAIL("semaphore: WaitForSingleObject() failed"); } return WAIT_OBJECT_0 == result; } private: HANDLE m_handle; }; template<typename T> class tsstack { public: inline tsstack(bool use_freelist = true) : m_use_freelist(use_freelist) { LZHAM_VERIFY(((ptr_bits_t)this & (LZHAM_GET_ALIGNMENT(tsstack) - 1)) == 0); InitializeSListHead(&m_stack_head); InitializeSListHead(&m_freelist_head); } inline ~tsstack() { clear(); } inline void clear() { for ( ; ; ) { node* pNode = (node*)InterlockedPopEntrySList(&m_stack_head); if (!pNode) break; LZHAM_MEMORY_IMPORT_BARRIER helpers::destruct(&pNode->m_obj); lzham_free(pNode); } flush_freelist(); } inline void flush_freelist() { if (!m_use_freelist) return; for ( ; ; ) { node* pNode = (node*)InterlockedPopEntrySList(&m_freelist_head); if (!pNode) break; LZHAM_MEMORY_IMPORT_BARRIER lzham_free(pNode); } } inline bool try_push(const T& obj) { node* pNode = alloc_node(); if (!pNode) return false; helpers::construct(&pNode->m_obj, obj); LZHAM_MEMORY_EXPORT_BARRIER InterlockedPushEntrySList(&m_stack_head, &pNode->m_slist_entry); return true; } inline bool pop(T& obj) { node* pNode = (node*)InterlockedPopEntrySList(&m_stack_head); if (!pNode) return false; LZHAM_MEMORY_IMPORT_BARRIER obj = pNode->m_obj; helpers::destruct(&pNode->m_obj); free_node(pNode); return true; } private: SLIST_HEADER m_stack_head; SLIST_HEADER m_freelist_head; struct node { SLIST_ENTRY m_slist_entry; T m_obj; }; bool m_use_freelist; inline node* alloc_node() { node* pNode = m_use_freelist ? (node*)InterlockedPopEntrySList(&m_freelist_head) : NULL; if (!pNode) pNode = (node*)lzham_malloc(sizeof(node)); return pNode; } inline void free_node(node* pNode) { if (m_use_freelist) InterlockedPushEntrySList(&m_freelist_head, &pNode->m_slist_entry); else lzham_free(pNode); } }; class task_pool { public: task_pool(); task_pool(uint num_threads); ~task_pool(); enum { cMaxThreads = 16 }; bool init(uint num_threads); void deinit(); inline uint get_num_threads() const { return m_num_threads; } inline uint get_num_outstanding_tasks() const { return m_num_outstanding_tasks; } // C-style task callback typedef void (*task_callback_func)(uint64 data, void* pData_ptr); bool queue_task(task_callback_func pFunc, uint64 data = 0, void* pData_ptr = NULL); class executable_task { public: virtual void execute_task(uint64 data, void* pData_ptr) = 0; }; // It's the caller's responsibility to delete pObj within the execute_task() method, if needed! bool queue_task(executable_task* pObj, uint64 data = 0, void* pData_ptr = NULL); template<typename S, typename T> inline bool queue_object_task(S* pObject, T pObject_method, uint64 data = 0, void* pData_ptr = NULL); template<typename S, typename T> inline bool queue_multiple_object_tasks(S* pObject, T pObject_method, uint64 first_data, uint num_tasks, void* pData_ptr = NULL); void join(); private: struct task { //inline task() : m_data(0), m_pData_ptr(NULL), m_pObj(NULL), m_flags(0) { } uint64 m_data; void* m_pData_ptr; union { task_callback_func m_callback; executable_task* m_pObj; }; uint m_flags; }; tsstack<task> m_task_stack; uint m_num_threads; HANDLE m_threads[cMaxThreads]; semaphore m_tasks_available; enum task_flags { cTaskFlagObject = 1 }; volatile atomic32_t m_num_outstanding_tasks; volatile atomic32_t m_exit_flag; void process_task(task& tsk); static unsigned __stdcall thread_func(void* pContext); }; enum object_task_flags { cObjectTaskFlagDefault = 0, cObjectTaskFlagDeleteAfterExecution = 1 }; template<typename T> class object_task : public task_pool::executable_task { public: object_task(uint flags = cObjectTaskFlagDefault) : m_pObject(NULL), m_pMethod(NULL), m_flags(flags) { } typedef void (T::*object_method_ptr)(uint64 data, void* pData_ptr); object_task(T* pObject, object_method_ptr pMethod, uint flags = cObjectTaskFlagDefault) : m_pObject(pObject), m_pMethod(pMethod), m_flags(flags) { LZHAM_ASSERT(pObject && pMethod); } void init(T* pObject, object_method_ptr pMethod, uint flags = cObjectTaskFlagDefault) { LZHAM_ASSERT(pObject && pMethod); m_pObject = pObject; m_pMethod = pMethod; m_flags = flags; } T* get_object() const { return m_pObject; } object_method_ptr get_method() const { return m_pMethod; } virtual void execute_task(uint64 data, void* pData_ptr) { (m_pObject->*m_pMethod)(data, pData_ptr); if (m_flags & cObjectTaskFlagDeleteAfterExecution) lzham_delete(this); } protected: T* m_pObject; object_method_ptr m_pMethod; uint m_flags; }; template<typename S, typename T> inline bool task_pool::queue_object_task(S* pObject, T pObject_method, uint64 data, void* pData_ptr) { object_task<S> *pTask = lzham_new< object_task<S> >(pObject, pObject_method, cObjectTaskFlagDeleteAfterExecution); if (!pTask) return false; return queue_task(pTask, data, pData_ptr); } template<typename S, typename T> inline bool task_pool::queue_multiple_object_tasks(S* pObject, T pObject_method, uint64 first_data, uint num_tasks, void* pData_ptr) { LZHAM_ASSERT(m_num_threads); LZHAM_ASSERT(pObject); LZHAM_ASSERT(num_tasks); if (!num_tasks) return true; bool status = true; uint i; for (i = 0; i < num_tasks; i++) { task tsk; tsk.m_pObj = lzham_new< object_task<S> >(pObject, pObject_method, cObjectTaskFlagDeleteAfterExecution); if (!tsk.m_pObj) { status = false; break; } tsk.m_data = first_data + i; tsk.m_pData_ptr = pData_ptr; tsk.m_flags = cTaskFlagObject; if (!m_task_stack.try_push(tsk)) { status = false; break; } } if (i) { atomic_add32(&m_num_outstanding_tasks, i); m_tasks_available.release(i); } return status; } inline void lzham_sleep(unsigned int milliseconds) { Sleep(milliseconds); } uint lzham_get_max_helper_threads(); } // namespace lzham #endif // LZHAM_USE_WIN32_API �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_match_accel.cpp��������������������������������������0000644�0001750�0001750�00000045012�12320456500�023643� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_match_accel.cpp // See Copyright Notice and license at the end of include/lzham.h #include "lzham_core.h" #include "lzham_match_accel.h" #include "lzham_timer.h" namespace lzham { static inline uint32 hash2_to_12(uint c0, uint c1) { return c0 ^ (c1 << 4); } static inline uint32 hash3_to_16(uint c0, uint c1, uint c2) { return (c0 | (c1 << 8)) ^ (c2 << 4); } search_accelerator::search_accelerator() : m_pLZBase(NULL), m_pTask_pool(NULL), m_max_helper_threads(0), m_max_dict_size(0), m_max_dict_size_mask(0), m_lookahead_pos(0), m_lookahead_size(0), m_cur_dict_size(0), m_fill_lookahead_pos(0), m_fill_lookahead_size(0), m_fill_dict_size(0), m_max_probes(0), m_max_matches(0), m_all_matches(false), m_next_match_ref(0), m_num_completed_helper_threads(0) { } bool search_accelerator::init(CLZBase* pLZBase, task_pool* pPool, uint max_helper_threads, uint max_dict_size, uint max_matches, bool all_matches, uint max_probes) { LZHAM_ASSERT(pLZBase); LZHAM_ASSERT(max_dict_size && math::is_power_of_2(max_dict_size)); LZHAM_ASSERT(max_probes); m_max_probes = LZHAM_MIN(cMatchAccelMaxSupportedProbes, max_probes); m_pLZBase = pLZBase; m_pTask_pool = max_helper_threads ? pPool : NULL; m_max_helper_threads = m_pTask_pool ? max_helper_threads : 0; m_max_matches = LZHAM_MIN(m_max_probes, max_matches); m_all_matches = all_matches; m_max_dict_size = max_dict_size; m_max_dict_size_mask = m_max_dict_size - 1; m_cur_dict_size = 0; m_lookahead_size = 0; m_lookahead_pos = 0; m_fill_lookahead_pos = 0; m_fill_lookahead_size = 0; m_fill_dict_size = 0; m_num_completed_helper_threads = 0; if (!m_dict.try_resize_no_construct(max_dict_size + LZHAM_MIN(m_max_dict_size, static_cast<uint>(CLZBase::cMaxHugeMatchLen)))) return false; if (!m_hash.try_resize_no_construct(cHashSize)) return false; if (!m_nodes.try_resize_no_construct(max_dict_size)) return false; memset(m_hash.get_ptr(), 0, m_hash.size_in_bytes()); return true; } void search_accelerator::reset() { m_cur_dict_size = 0; m_lookahead_size = 0; m_lookahead_pos = 0; m_fill_lookahead_pos = 0; m_fill_lookahead_size = 0; m_fill_dict_size = 0; m_num_completed_helper_threads = 0; // Clearing the hash tables is only necessary for determinism (otherwise, it's possible the matches returned after a reset will depend on the data processes before the reset). if (m_hash.size()) memset(m_hash.get_ptr(), 0, m_hash.size_in_bytes()); if (m_digram_hash.size()) memset(m_digram_hash.get_ptr(), 0, m_digram_hash.size_in_bytes()); } void search_accelerator::flush() { m_cur_dict_size = 0; } uint search_accelerator::get_max_add_bytes() const { uint add_pos = static_cast<uint>(m_lookahead_pos & (m_max_dict_size - 1)); return m_max_dict_size - add_pos; } static uint8 g_hamming_dist[256] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8 }; void search_accelerator::find_all_matches_callback(uint64 data, void* /*pData_ptr*/) { scoped_perf_section find_all_matches_timer("find_all_matches_callback"); //pData_ptr; const uint thread_index = (uint)data; dict_match temp_matches[cMatchAccelMaxSupportedProbes * 2]; uint fill_lookahead_pos = m_fill_lookahead_pos; uint fill_dict_size = m_fill_dict_size; uint fill_lookahead_size = m_fill_lookahead_size; uint c0 = 0, c1 = 0; if (fill_lookahead_size >= 2) { c0 = m_dict[fill_lookahead_pos & m_max_dict_size_mask]; c1 = m_dict[(fill_lookahead_pos & m_max_dict_size_mask) + 1]; } const uint8* pDict = m_dict.get_ptr(); while (fill_lookahead_size >= 3) { uint insert_pos = fill_lookahead_pos & m_max_dict_size_mask; uint c2 = pDict[insert_pos + 2]; uint h = hash3_to_16(c0, c1, c2); c0 = c1; c1 = c2; LZHAM_ASSERT(!m_hash_thread_index.size() || (m_hash_thread_index[h] != LZHAM_UINT8_MAX)); // Only process those strings that this worker thread was assigned to - this allows us to manipulate multiple trees in parallel with no worries about synchronization. if (m_hash_thread_index.size() && (m_hash_thread_index[h] != thread_index)) { fill_lookahead_pos++; fill_lookahead_size--; fill_dict_size++; continue; } dict_match* pDstMatch = temp_matches; uint cur_pos = m_hash[h]; m_hash[h] = static_cast<uint>(fill_lookahead_pos); uint *pLeft = &m_nodes[insert_pos].m_left; uint *pRight = &m_nodes[insert_pos].m_right; const uint max_match_len = LZHAM_MIN(static_cast<uint>(CLZBase::cMaxMatchLen), fill_lookahead_size); uint best_match_len = 2; const uint8* pIns = &pDict[insert_pos]; uint n = m_max_probes; for ( ; ; ) { uint delta_pos = fill_lookahead_pos - cur_pos; if ((n-- == 0) || (!delta_pos) || (delta_pos >= fill_dict_size)) { *pLeft = 0; *pRight = 0; break; } uint pos = cur_pos & m_max_dict_size_mask; node *pNode = &m_nodes[pos]; // Unfortunately, the initial compare match_len must be 0 because of the way we hash and truncate matches at the end of each block. uint match_len = 0; const uint8* pComp = &pDict[pos]; #if LZHAM_PLATFORM_X360 for ( ; match_len < max_match_len; match_len++) if (pComp[match_len] != pIns[match_len]) break; #else // Compare a qword at a time for a bit more efficiency. const uint64* pComp_end = reinterpret_cast<const uint64*>(pComp + max_match_len - 7); const uint64* pComp_cur = reinterpret_cast<const uint64*>(pComp); const uint64* pIns_cur = reinterpret_cast<const uint64*>(pIns); while (pComp_cur < pComp_end) { if (*pComp_cur != *pIns_cur) break; pComp_cur++; pIns_cur++; } uint alt_match_len = static_cast<uint>(reinterpret_cast<const uint8*>(pComp_cur) - reinterpret_cast<const uint8*>(pComp)); for ( ; alt_match_len < max_match_len; alt_match_len++) if (pComp[alt_match_len] != pIns[alt_match_len]) break; #ifdef LZVERIFY for ( ; match_len < max_match_len; match_len++) if (pComp[match_len] != pIns[match_len]) break; LZHAM_VERIFY(alt_match_len == match_len); #endif match_len = alt_match_len; #endif if (match_len > best_match_len) { pDstMatch->m_len = static_cast<uint16>(match_len - CLZBase::cMinMatchLen); pDstMatch->m_dist = delta_pos; pDstMatch++; best_match_len = match_len; if (match_len == max_match_len) { *pLeft = pNode->m_left; *pRight = pNode->m_right; break; } } else if (m_all_matches) { pDstMatch->m_len = static_cast<uint16>(match_len - CLZBase::cMinMatchLen); pDstMatch->m_dist = delta_pos; pDstMatch++; } else if ((best_match_len > 2) && (best_match_len == match_len)) { uint bestMatchDist = pDstMatch[-1].m_dist; uint compMatchDist = delta_pos; uint bestMatchSlot, bestMatchSlotOfs; m_pLZBase->compute_lzx_position_slot(bestMatchDist, bestMatchSlot, bestMatchSlotOfs); uint compMatchSlot, compMatchOfs; m_pLZBase->compute_lzx_position_slot(compMatchDist, compMatchSlot, compMatchOfs); // If both matches uses the same match slot, choose the one with the offset containing the lowest nibble as these bits separately entropy coded. // This could choose a match which is further away in the absolute sense, but closer in a coding sense. if ( (compMatchSlot < bestMatchSlot) || ((compMatchSlot >= 8) && (compMatchSlot == bestMatchSlot) && ((compMatchOfs & 15) < (bestMatchSlotOfs & 15))) ) { LZHAM_ASSERT((pDstMatch[-1].m_len + (uint)CLZBase::cMinMatchLen) == best_match_len); pDstMatch[-1].m_dist = delta_pos; } else if ((match_len < max_match_len) && (compMatchSlot <= bestMatchSlot)) { // Choose the match which has lowest hamming distance in the mismatch byte for a tiny win on binary files. // TODO: This competes against the prev. optimization. uint desired_mismatch_byte = pIns[match_len]; uint cur_mismatch_byte = pDict[(insert_pos - bestMatchDist + match_len) & m_max_dict_size_mask]; uint cur_mismatch_dist = g_hamming_dist[cur_mismatch_byte ^ desired_mismatch_byte]; uint new_mismatch_byte = pComp[match_len]; uint new_mismatch_dist = g_hamming_dist[new_mismatch_byte ^ desired_mismatch_byte]; if (new_mismatch_dist < cur_mismatch_dist) { LZHAM_ASSERT((pDstMatch[-1].m_len + (uint)CLZBase::cMinMatchLen) == best_match_len); pDstMatch[-1].m_dist = delta_pos; } } } uint new_pos; if (pComp[match_len] < pIns[match_len]) { *pLeft = cur_pos; pLeft = &pNode->m_right; new_pos = pNode->m_right; } else { *pRight = cur_pos; pRight = &pNode->m_left; new_pos = pNode->m_left; } if (new_pos == cur_pos) break; cur_pos = new_pos; } const uint num_matches = (uint)(pDstMatch - temp_matches); if (num_matches) { pDstMatch[-1].m_dist |= 0x80000000; const uint num_matches_to_write = LZHAM_MIN(num_matches, m_max_matches); const uint match_ref_ofs = atomic_exchange_add(&m_next_match_ref, num_matches_to_write); memcpy(&m_matches[match_ref_ofs], temp_matches + (num_matches - num_matches_to_write), sizeof(temp_matches[0]) * num_matches_to_write); // FIXME: This is going to really hurt on platforms requiring export barriers. LZHAM_MEMORY_EXPORT_BARRIER atomic_exchange32((atomic32_t*)&m_match_refs[static_cast<uint>(fill_lookahead_pos - m_fill_lookahead_pos)], match_ref_ofs); } else { atomic_exchange32((atomic32_t*)&m_match_refs[static_cast<uint>(fill_lookahead_pos - m_fill_lookahead_pos)], -2); } fill_lookahead_pos++; fill_lookahead_size--; fill_dict_size++; } while (fill_lookahead_size) { uint insert_pos = fill_lookahead_pos & m_max_dict_size_mask; m_nodes[insert_pos].m_left = 0; m_nodes[insert_pos].m_right = 0; atomic_exchange32((atomic32_t*)&m_match_refs[static_cast<uint>(fill_lookahead_pos - m_fill_lookahead_pos)], -2); fill_lookahead_pos++; fill_lookahead_size--; fill_dict_size++; } atomic_increment32(&m_num_completed_helper_threads); } bool search_accelerator::find_len2_matches() { if (!m_digram_hash.size()) { if (!m_digram_hash.try_resize(cDigramHashSize)) return false; } if (m_digram_next.size() < m_lookahead_size) { if (!m_digram_next.try_resize(m_lookahead_size)) return false; } uint lookahead_dict_pos = m_lookahead_pos & m_max_dict_size_mask; for (int lookahead_ofs = 0; lookahead_ofs < ((int)m_lookahead_size - 1); ++lookahead_ofs, ++lookahead_dict_pos) { uint c0 = m_dict[lookahead_dict_pos]; uint c1 = m_dict[lookahead_dict_pos + 1]; uint h = hash2_to_12(c0, c1) & (cDigramHashSize - 1); m_digram_next[lookahead_ofs] = m_digram_hash[h]; m_digram_hash[h] = m_lookahead_pos + lookahead_ofs; } m_digram_next[m_lookahead_size - 1] = 0; return true; } uint search_accelerator::get_len2_match(uint lookahead_ofs) { if ((m_fill_lookahead_size - lookahead_ofs) < 2) return 0; uint cur_pos = m_lookahead_pos + lookahead_ofs; uint next_match_pos = m_digram_next[cur_pos - m_fill_lookahead_pos]; uint match_dist = cur_pos - next_match_pos; if ((!match_dist) || (match_dist > CLZBase::cMaxLen2MatchDist) || (match_dist > (m_cur_dict_size + lookahead_ofs))) return 0; const uint8* pCur = &m_dict[cur_pos & m_max_dict_size_mask]; const uint8* pMatch = &m_dict[next_match_pos & m_max_dict_size_mask]; if ((pCur[0] == pMatch[0]) && (pCur[1] == pMatch[1])) return match_dist; return 0; } bool search_accelerator::find_all_matches(uint num_bytes) { if (!m_matches.try_resize_no_construct(m_max_probes * num_bytes)) return false; if (!m_match_refs.try_resize_no_construct(num_bytes)) return false; memset(m_match_refs.get_ptr(), 0xFF, m_match_refs.size_in_bytes()); m_fill_lookahead_pos = m_lookahead_pos; m_fill_lookahead_size = num_bytes; m_fill_dict_size = m_cur_dict_size; m_next_match_ref = 0; if (!m_pTask_pool) { find_all_matches_callback(0, NULL); m_num_completed_helper_threads = 0; } else { if (!m_hash_thread_index.try_resize_no_construct(0x10000)) return false; memset(m_hash_thread_index.get_ptr(), 0xFF, m_hash_thread_index.size_in_bytes()); uint next_thread_index = 0; const uint8* pDict = &m_dict[m_lookahead_pos & m_max_dict_size_mask]; uint num_unique_trigrams = 0; if (num_bytes >= 3) { uint c0 = pDict[0]; uint c1 = pDict[1]; const int limit = ((int)num_bytes - 2); for (int i = 0; i < limit; i++) { uint c2 = pDict[2]; uint t = hash3_to_16(c0, c1, c2); c0 = c1; c1 = c2; pDict++; if (m_hash_thread_index[t] == LZHAM_UINT8_MAX) { num_unique_trigrams++; m_hash_thread_index[t] = static_cast<uint8>(next_thread_index); if (++next_thread_index == m_max_helper_threads) next_thread_index = 0; } } } m_num_completed_helper_threads = 0; if (!m_pTask_pool->queue_multiple_object_tasks(this, &search_accelerator::find_all_matches_callback, 0, m_max_helper_threads)) return false; } return find_len2_matches(); } bool search_accelerator::add_bytes_begin(uint num_bytes, const uint8* pBytes) { LZHAM_ASSERT(num_bytes <= m_max_dict_size); LZHAM_ASSERT(!m_lookahead_size); uint add_pos = m_lookahead_pos & m_max_dict_size_mask; LZHAM_ASSERT((add_pos + num_bytes) <= m_max_dict_size); memcpy(&m_dict[add_pos], pBytes, num_bytes); uint dict_bytes_to_mirror = LZHAM_MIN(static_cast<uint>(CLZBase::cMaxHugeMatchLen), m_max_dict_size); if (add_pos < dict_bytes_to_mirror) memcpy(&m_dict[m_max_dict_size], &m_dict[0], dict_bytes_to_mirror); m_lookahead_size = num_bytes; uint max_possible_dict_size = m_max_dict_size - num_bytes; m_cur_dict_size = LZHAM_MIN(m_cur_dict_size, max_possible_dict_size); m_next_match_ref = 0; return find_all_matches(num_bytes); } void search_accelerator::add_bytes_end() { if (m_pTask_pool) { m_pTask_pool->join(); } LZHAM_ASSERT((uint)m_next_match_ref <= m_matches.size()); } dict_match* search_accelerator::find_matches(uint lookahead_ofs, bool spin) { LZHAM_ASSERT(lookahead_ofs < m_lookahead_size); const uint match_ref_ofs = static_cast<uint>(m_lookahead_pos - m_fill_lookahead_pos + lookahead_ofs); int match_ref; uint spin_count = 0; // This may spin until the match finder job(s) catch up to the caller's lookahead position. for ( ; ; ) { match_ref = m_match_refs[match_ref_ofs]; if (match_ref == -2) return NULL; else if (match_ref != -1) break; spin_count++; const uint cMaxSpinCount = 1000; if ((spin) && (spin_count < cMaxSpinCount)) { lzham_yield_processor(); lzham_yield_processor(); lzham_yield_processor(); lzham_yield_processor(); lzham_yield_processor(); lzham_yield_processor(); lzham_yield_processor(); lzham_yield_processor(); LZHAM_MEMORY_IMPORT_BARRIER } else { spin_count = cMaxSpinCount; lzham_sleep(1); } } LZHAM_MEMORY_IMPORT_BARRIER return &m_matches[match_ref]; } void search_accelerator::advance_bytes(uint num_bytes) { LZHAM_ASSERT(num_bytes <= m_lookahead_size); m_lookahead_pos += num_bytes; m_lookahead_size -= num_bytes; m_cur_dict_size += num_bytes; LZHAM_ASSERT(m_cur_dict_size <= m_max_dict_size); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_win32_threading.cpp����������������������������������0000644�0001750�0001750�00000011261�12320456500�024406� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_task_pool_win32.cpp // See Copyright Notice and license at the end of include/lzham.h #include "lzham_core.h" #include "lzham_win32_threading.h" #include "lzham_timer.h" #if LZHAM_USE_WIN32_API #include <process.h> namespace lzham { task_pool::task_pool() : m_num_threads(0), m_tasks_available(0, 32767), m_num_outstanding_tasks(0), m_exit_flag(false) { utils::zero_object(m_threads); } task_pool::task_pool(uint num_threads) : m_num_threads(0), m_tasks_available(0, 32767), m_num_outstanding_tasks(0), m_exit_flag(false) { utils::zero_object(m_threads); bool status = init(num_threads); LZHAM_VERIFY(status); } task_pool::~task_pool() { deinit(); } bool task_pool::init(uint num_threads) { LZHAM_ASSERT(num_threads <= cMaxThreads); num_threads = math::minimum<uint>(num_threads, cMaxThreads); deinit(); bool succeeded = true; m_num_threads = 0; while (m_num_threads < num_threads) { m_threads[m_num_threads] = (HANDLE)_beginthreadex(NULL, 32768, thread_func, this, 0, NULL); LZHAM_ASSERT(m_threads[m_num_threads] != 0); if (!m_threads[m_num_threads]) { succeeded = false; break; } m_num_threads++; } if (!succeeded) { deinit(); return false; } return true; } void task_pool::deinit() { if (m_num_threads) { join(); atomic_exchange32(&m_exit_flag, true); m_tasks_available.release(m_num_threads); for (uint i = 0; i < m_num_threads; i++) { if (m_threads[i]) { for ( ; ; ) { DWORD result = WaitForSingleObject(m_threads[i], 30000); if ((result == WAIT_OBJECT_0) || (result == WAIT_ABANDONED)) break; } CloseHandle(m_threads[i]); m_threads[i] = NULL; } } m_num_threads = 0; atomic_exchange32(&m_exit_flag, false); } m_task_stack.clear(); m_num_outstanding_tasks = 0; } bool task_pool::queue_task(task_callback_func pFunc, uint64 data, void* pData_ptr) { LZHAM_ASSERT(m_num_threads); LZHAM_ASSERT(pFunc); task tsk; tsk.m_callback = pFunc; tsk.m_data = data; tsk.m_pData_ptr = pData_ptr; tsk.m_flags = 0; if (!m_task_stack.try_push(tsk)) return false; atomic_increment32(&m_num_outstanding_tasks); m_tasks_available.release(1); return true; } // It's the object's responsibility to delete pObj within the execute_task() method, if needed! bool task_pool::queue_task(executable_task* pObj, uint64 data, void* pData_ptr) { LZHAM_ASSERT(m_num_threads); LZHAM_ASSERT(pObj); task tsk; tsk.m_pObj = pObj; tsk.m_data = data; tsk.m_pData_ptr = pData_ptr; tsk.m_flags = cTaskFlagObject; if (!m_task_stack.try_push(tsk)) return false; atomic_increment32(&m_num_outstanding_tasks); m_tasks_available.release(1); return true; } void task_pool::process_task(task& tsk) { if (tsk.m_flags & cTaskFlagObject) tsk.m_pObj->execute_task(tsk.m_data, tsk.m_pData_ptr); else tsk.m_callback(tsk.m_data, tsk.m_pData_ptr); atomic_decrement32(&m_num_outstanding_tasks); } void task_pool::join() { while (atomic_add32(&m_num_outstanding_tasks, 0) > 0) { task tsk; if (m_task_stack.pop(tsk)) { process_task(tsk); } else { lzham_sleep(1); } } } unsigned __stdcall task_pool::thread_func(void* pContext) { task_pool* pPool = static_cast<task_pool*>(pContext); for ( ; ; ) { if (!pPool->m_tasks_available.wait()) break; if (pPool->m_exit_flag) break; task tsk; if (pPool->m_task_stack.pop(tsk)) { pPool->process_task(tsk); } } _endthreadex(0); return 0; } static uint g_num_processors; uint lzham_get_max_helper_threads() { if (!g_num_processors) { SYSTEM_INFO system_info; GetSystemInfo(&system_info); g_num_processors = system_info.dwNumberOfProcessors; } if (g_num_processors > 1) { // use all CPU's return LZHAM_MIN(task_pool::cMaxThreads, g_num_processors - 1); } return 0; } } // namespace lzham #endif // LZHAM_USE_WIN32_API �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_api.cpp����������������������������������������������0000644�0001750�0001750�00000014436�12320456500�022177� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_api.cpp - Dynamic DLL entrypoints. // See Copyright Notice and license at the end of include/lzham.h #include "lzham_core.h" #include "lzham_decomp.h" #include "lzham_comp.h" extern "C" LZHAM_DLL_EXPORT lzham_uint32 lzham_get_version(void) { return LZHAM_DLL_VERSION; } extern "C" LZHAM_DLL_EXPORT void lzham_set_memory_callbacks(lzham_realloc_func pRealloc, lzham_msize_func pMSize, void* pUser_data) { lzham::lzham_lib_set_memory_callbacks(pRealloc, pMSize, pUser_data); } extern "C" LZHAM_DLL_EXPORT lzham_decompress_state_ptr lzham_decompress_init(const lzham_decompress_params *pParams) { return lzham::lzham_lib_decompress_init(pParams); } extern "C" LZHAM_DLL_EXPORT lzham_decompress_state_ptr lzham_decompress_reinit(lzham_decompress_state_ptr p, const lzham_decompress_params *pParams) { return lzham::lzham_lib_decompress_reinit(p, pParams); } extern "C" LZHAM_DLL_EXPORT lzham_uint32 lzham_decompress_deinit(lzham_decompress_state_ptr p) { return lzham::lzham_lib_decompress_deinit(p); } extern "C" LZHAM_DLL_EXPORT lzham_decompress_status_t lzham_decompress( lzham_decompress_state_ptr p, const lzham_uint8 *pIn_buf, size_t *pIn_buf_size, lzham_uint8 *pOut_buf, size_t *pOut_buf_size, lzham_bool no_more_input_bytes_flag) { return lzham::lzham_lib_decompress(p, pIn_buf, pIn_buf_size, pOut_buf, pOut_buf_size, no_more_input_bytes_flag); } extern "C" LZHAM_DLL_EXPORT lzham_decompress_status_t lzham_decompress_memory(const lzham_decompress_params *pParams, lzham_uint8* pDst_buf, size_t *pDst_len, const lzham_uint8* pSrc_buf, size_t src_len, lzham_uint32 *pAdler32) { return lzham::lzham_lib_decompress_memory(pParams, pDst_buf, pDst_len, pSrc_buf, src_len, pAdler32); } extern "C" LZHAM_DLL_EXPORT lzham_compress_state_ptr lzham_compress_init(const lzham_compress_params *pParams) { return lzham::lzham_lib_compress_init(pParams); } extern "C" LZHAM_DLL_EXPORT lzham_compress_state_ptr lzham_compress_reinit(lzham_compress_state_ptr p) { return lzham::lzham_lib_compress_reinit(p); } extern "C" LZHAM_DLL_EXPORT lzham_uint32 lzham_compress_deinit(lzham_compress_state_ptr p) { return lzham::lzham_lib_compress_deinit(p); } extern "C" LZHAM_DLL_EXPORT lzham_compress_status_t lzham_compress( lzham_compress_state_ptr p, const lzham_uint8 *pIn_buf, size_t *pIn_buf_size, lzham_uint8 *pOut_buf, size_t *pOut_buf_size, lzham_bool no_more_input_bytes_flag) { return lzham::lzham_lib_compress(p, pIn_buf, pIn_buf_size, pOut_buf, pOut_buf_size, no_more_input_bytes_flag); } extern "C" LZHAM_DLL_EXPORT lzham_compress_status_t lzham_compress2( lzham_compress_state_ptr p, const lzham_uint8 *pIn_buf, size_t *pIn_buf_size, lzham_uint8 *pOut_buf, size_t *pOut_buf_size, lzham_flush_t flush_type) { return lzham::lzham_lib_compress2(p, pIn_buf, pIn_buf_size, pOut_buf, pOut_buf_size, flush_type); } extern "C" LZHAM_DLL_EXPORT lzham_compress_status_t lzham_compress_memory(const lzham_compress_params *pParams, lzham_uint8* pDst_buf, size_t *pDst_len, const lzham_uint8* pSrc_buf, size_t src_len, lzham_uint32 *pAdler32) { return lzham::lzham_lib_compress_memory(pParams, pDst_buf, pDst_len, pSrc_buf, src_len, pAdler32); } // ----------------- zlib-style API's extern "C" LZHAM_DLL_EXPORT const char *lzham_z_version(void) { return LZHAM_Z_VERSION; } extern "C" lzham_z_ulong LZHAM_DLL_EXPORT lzham_z_adler32(lzham_z_ulong adler, const unsigned char *ptr, size_t buf_len) { return lzham::lzham_lib_z_adler32(adler, ptr, buf_len); } extern "C" lzham_z_ulong LZHAM_DLL_EXPORT lzham_z_crc32(lzham_z_ulong crc, const lzham_uint8 *ptr, size_t buf_len) { return lzham::lzham_lib_z_crc32(crc, ptr, buf_len); } extern "C" LZHAM_DLL_EXPORT int lzham_z_deflateInit(lzham_z_streamp pStream, int level) { return lzham::lzham_lib_z_deflateInit(pStream, level); } extern "C" LZHAM_DLL_EXPORT int lzham_z_deflateInit2(lzham_z_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy) { return lzham::lzham_lib_z_deflateInit2(pStream, level, method, window_bits, mem_level, strategy); } extern "C" LZHAM_DLL_EXPORT int lzham_z_deflateReset(lzham_z_streamp pStream) { return lzham::lzham_lib_z_deflateReset(pStream); } extern "C" LZHAM_DLL_EXPORT int lzham_z_deflate(lzham_z_streamp pStream, int flush) { return lzham::lzham_lib_z_deflate(pStream, flush); } extern "C" LZHAM_DLL_EXPORT int lzham_z_deflateEnd(lzham_z_streamp pStream) { return lzham::lzham_lib_z_deflateEnd(pStream); } extern "C" LZHAM_DLL_EXPORT lzham_z_ulong lzham_z_deflateBound(lzham_z_streamp pStream, lzham_z_ulong source_len) { return lzham::lzham_lib_z_deflateBound(pStream, source_len); } extern "C" LZHAM_DLL_EXPORT int lzham_z_compress(unsigned char *pDest, lzham_z_ulong *pDest_len, const unsigned char *pSource, lzham_z_ulong source_len) { return lzham::lzham_lib_z_compress(pDest, pDest_len, pSource, source_len); } extern "C" LZHAM_DLL_EXPORT int lzham_z_compress2(unsigned char *pDest, lzham_z_ulong *pDest_len, const unsigned char *pSource, lzham_z_ulong source_len, int level) { return lzham::lzham_lib_z_compress2(pDest, pDest_len, pSource, source_len, level); } extern "C" LZHAM_DLL_EXPORT lzham_z_ulong lzham_z_compressBound(lzham_z_ulong source_len) { return lzham::lzham_lib_z_compressBound(source_len); } extern "C" LZHAM_DLL_EXPORT int lzham_z_inflateInit(lzham_z_streamp pStream) { return lzham::lzham_lib_z_inflateInit(pStream); } extern "C" LZHAM_DLL_EXPORT int lzham_z_inflateInit2(lzham_z_streamp pStream, int window_bits) { return lzham::lzham_lib_z_inflateInit2(pStream, window_bits); } extern "C" LZHAM_DLL_EXPORT int lzham_z_inflateReset(lzham_z_streamp pStream) { return lzham::lzham_lib_z_inflateReset(pStream); } extern "C" LZHAM_DLL_EXPORT int lzham_z_inflate(lzham_z_streamp pStream, int flush) { return lzham::lzham_lib_z_inflate(pStream, flush); } extern "C" LZHAM_DLL_EXPORT int lzham_z_inflateEnd(lzham_z_streamp pStream) { return lzham::lzham_lib_z_inflateEnd(pStream); } extern "C" LZHAM_DLL_EXPORT int lzham_z_uncompress(unsigned char *pDest, lzham_z_ulong *pDest_len, const unsigned char *pSource, lzham_z_ulong source_len) { return lzham::lzham_lib_z_uncompress(pDest, pDest_len, pSource, source_len); } extern "C" LZHAM_DLL_EXPORT const char *lzham_z_error(int err) { return lzham::lzham_lib_z_error(err); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_lzcomp.cpp�������������������������������������������0000644�0001750�0001750�00000046744�12320456500�022741� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_lzcomp.cpp // See Copyright Notice and license at the end of include/lzham.h #include "lzham_core.h" #include "lzham.h" #include "lzham_comp.h" #include "lzham_lzcomp_internal.h" using namespace lzham; namespace lzham { struct lzham_compress_state { // task_pool requires 8 or 16 alignment task_pool m_tp; lzcompressor m_compressor; uint m_dict_size_log2; const uint8 *m_pIn_buf; size_t *m_pIn_buf_size; uint8 *m_pOut_buf; size_t *m_pOut_buf_size; size_t m_comp_data_ofs; bool m_finished_compression; lzham_compress_params m_params; lzham_compress_status_t m_status; }; static lzham_compress_status_t create_internal_init_params(lzcompressor::init_params &internal_params, const lzham_compress_params *pParams) { if ((pParams->m_dict_size_log2 < CLZBase::cMinDictSizeLog2) || (pParams->m_dict_size_log2 > CLZBase::cMaxDictSizeLog2)) return LZHAM_COMP_STATUS_INVALID_PARAMETER; if (pParams->m_cpucache_total_lines) { if (!math::is_power_of_2(pParams->m_cpucache_line_size)) return LZHAM_COMP_STATUS_INVALID_PARAMETER; } internal_params.m_dict_size_log2 = pParams->m_dict_size_log2; if (pParams->m_max_helper_threads < 0) internal_params.m_max_helper_threads = lzham_get_max_helper_threads(); else internal_params.m_max_helper_threads = pParams->m_max_helper_threads; internal_params.m_max_helper_threads = LZHAM_MIN(LZHAM_MAX_HELPER_THREADS, internal_params.m_max_helper_threads); internal_params.m_num_cachelines = pParams->m_cpucache_total_lines; internal_params.m_cacheline_size = pParams->m_cpucache_line_size; internal_params.m_lzham_compress_flags = pParams->m_compress_flags; if (pParams->m_num_seed_bytes) { if ((!pParams->m_pSeed_bytes) || (pParams->m_num_seed_bytes > (1U << pParams->m_dict_size_log2))) return LZHAM_COMP_STATUS_INVALID_PARAMETER; internal_params.m_num_seed_bytes = pParams->m_num_seed_bytes; internal_params.m_pSeed_bytes = pParams->m_pSeed_bytes; } switch (pParams->m_level) { case LZHAM_COMP_LEVEL_FASTEST: internal_params.m_compression_level = cCompressionLevelFastest; break; case LZHAM_COMP_LEVEL_FASTER: internal_params.m_compression_level = cCompressionLevelFaster; break; case LZHAM_COMP_LEVEL_DEFAULT: internal_params.m_compression_level = cCompressionLevelDefault; break; case LZHAM_COMP_LEVEL_BETTER: internal_params.m_compression_level = cCompressionLevelBetter; break; case LZHAM_COMP_LEVEL_UBER: internal_params.m_compression_level = cCompressionLevelUber; break; default: return LZHAM_COMP_STATUS_INVALID_PARAMETER; }; return LZHAM_COMP_STATUS_SUCCESS; } lzham_compress_state_ptr LZHAM_CDECL lzham_lib_compress_init(const lzham_compress_params *pParams) { if ((!pParams) || (pParams->m_struct_size != sizeof(lzham_compress_params))) return NULL; if ((pParams->m_dict_size_log2 < CLZBase::cMinDictSizeLog2) || (pParams->m_dict_size_log2 > CLZBase::cMaxDictSizeLog2)) return NULL; lzcompressor::init_params internal_params; lzham_compress_status_t status = create_internal_init_params(internal_params, pParams); if (status != LZHAM_COMP_STATUS_SUCCESS) return NULL; lzham_compress_state *pState = lzham_new<lzham_compress_state>(); if (!pState) return NULL; pState->m_params = *pParams; pState->m_pIn_buf = NULL; pState->m_pIn_buf_size = NULL; pState->m_pOut_buf = NULL; pState->m_pOut_buf_size = NULL; pState->m_status = LZHAM_COMP_STATUS_NOT_FINISHED; pState->m_comp_data_ofs = 0; pState->m_finished_compression = false; if (internal_params.m_max_helper_threads) { if (!pState->m_tp.init(internal_params.m_max_helper_threads)) { lzham_delete(pState); return NULL; } if (pState->m_tp.get_num_threads() >= internal_params.m_max_helper_threads) { internal_params.m_pTask_pool = &pState->m_tp; } else { internal_params.m_max_helper_threads = 0; } } if (!pState->m_compressor.init(internal_params)) { lzham_delete(pState); return NULL; } return pState; } lzham_compress_state_ptr LZHAM_CDECL lzham_lib_compress_reinit(lzham_compress_state_ptr p) { lzham_compress_state *pState = static_cast<lzham_compress_state*>(p); if (pState) { if (!pState->m_compressor.reset()) return NULL; pState->m_pIn_buf = NULL; pState->m_pIn_buf_size = NULL; pState->m_pOut_buf = NULL; pState->m_pOut_buf_size = NULL; pState->m_status = LZHAM_COMP_STATUS_NOT_FINISHED; pState->m_comp_data_ofs = 0; pState->m_finished_compression = false; } return pState; } lzham_uint32 LZHAM_CDECL lzham_lib_compress_deinit(lzham_compress_state_ptr p) { lzham_compress_state *pState = static_cast<lzham_compress_state *>(p); if (!pState) return 0; uint32 adler32 = pState->m_compressor.get_src_adler32(); lzham_delete(pState); return adler32; } lzham_compress_status_t LZHAM_CDECL lzham_lib_compress( lzham_compress_state_ptr p, const lzham_uint8 *pIn_buf, size_t *pIn_buf_size, lzham_uint8 *pOut_buf, size_t *pOut_buf_size, lzham_bool no_more_input_bytes_flag) { return lzham_lib_compress2(p, pIn_buf, pIn_buf_size, pOut_buf, pOut_buf_size, no_more_input_bytes_flag ? LZHAM_FINISH : LZHAM_NO_FLUSH); } lzham_compress_status_t LZHAM_CDECL lzham_lib_compress2( lzham_compress_state_ptr p, const lzham_uint8 *pIn_buf, size_t *pIn_buf_size, lzham_uint8 *pOut_buf, size_t *pOut_buf_size, lzham_flush_t flush_type) { lzham_compress_state *pState = static_cast<lzham_compress_state*>(p); if ((!pState) || (!pState->m_params.m_dict_size_log2) || (pState->m_status >= LZHAM_COMP_STATUS_FIRST_SUCCESS_OR_FAILURE_CODE) || (!pIn_buf_size) || (!pOut_buf_size)) return LZHAM_COMP_STATUS_INVALID_PARAMETER; if ((*pIn_buf_size) && (!pIn_buf)) return LZHAM_COMP_STATUS_INVALID_PARAMETER; if ((!*pOut_buf_size) || (!pOut_buf)) return LZHAM_COMP_STATUS_INVALID_PARAMETER; byte_vec &comp_data = pState->m_compressor.get_compressed_data(); size_t num_bytes_written_to_out_buf = 0; if (pState->m_comp_data_ofs < comp_data.size()) { size_t n = LZHAM_MIN(comp_data.size() - pState->m_comp_data_ofs, *pOut_buf_size); memcpy(pOut_buf, comp_data.get_ptr() + pState->m_comp_data_ofs, n); pState->m_comp_data_ofs += n; const bool has_no_more_output = (pState->m_comp_data_ofs >= comp_data.size()); if (has_no_more_output) { pOut_buf += n; *pOut_buf_size -= n; num_bytes_written_to_out_buf += n; } else { *pIn_buf_size = 0; *pOut_buf_size = n; pState->m_status = LZHAM_COMP_STATUS_HAS_MORE_OUTPUT; return pState->m_status; } } comp_data.try_resize(0); pState->m_comp_data_ofs = 0; if (pState->m_finished_compression) { if ((*pIn_buf_size) || (flush_type != LZHAM_FINISH)) { pState->m_status = LZHAM_COMP_STATUS_INVALID_PARAMETER; return pState->m_status; } *pIn_buf_size = 0; *pOut_buf_size = num_bytes_written_to_out_buf; pState->m_status = LZHAM_COMP_STATUS_SUCCESS; return pState->m_status; } const size_t cMaxBytesToPutPerIteration = 4*1024*1024; size_t bytes_to_put = LZHAM_MIN(cMaxBytesToPutPerIteration, *pIn_buf_size); const bool consumed_entire_input_buf = (bytes_to_put == *pIn_buf_size); if (bytes_to_put) { if (!pState->m_compressor.put_bytes(pIn_buf, (uint)bytes_to_put)) { *pIn_buf_size = 0; *pOut_buf_size = num_bytes_written_to_out_buf; pState->m_status = LZHAM_COMP_STATUS_FAILED; return pState->m_status; } } if ((consumed_entire_input_buf) && (flush_type != LZHAM_NO_FLUSH)) { if ((flush_type == LZHAM_SYNC_FLUSH) || (flush_type == LZHAM_FULL_FLUSH) || (flush_type == LZHAM_TABLE_FLUSH)) { if (!pState->m_compressor.flush(flush_type)) { *pIn_buf_size = 0; *pOut_buf_size = num_bytes_written_to_out_buf; pState->m_status = LZHAM_COMP_STATUS_FAILED; return pState->m_status; } } else if (!pState->m_finished_compression) { if (!pState->m_compressor.put_bytes(NULL, 0)) { *pIn_buf_size = 0; *pOut_buf_size = num_bytes_written_to_out_buf; pState->m_status = LZHAM_COMP_STATUS_FAILED; return pState->m_status; } pState->m_finished_compression = true; } } size_t num_comp_bytes_to_output = LZHAM_MIN(comp_data.size() - pState->m_comp_data_ofs, *pOut_buf_size); if (num_comp_bytes_to_output) { memcpy(pOut_buf, comp_data.get_ptr() + pState->m_comp_data_ofs, num_comp_bytes_to_output); pState->m_comp_data_ofs += num_comp_bytes_to_output; } *pIn_buf_size = bytes_to_put; *pOut_buf_size = num_bytes_written_to_out_buf + num_comp_bytes_to_output; const bool has_no_more_output = (pState->m_comp_data_ofs >= comp_data.size()); if ((has_no_more_output) && (flush_type == LZHAM_FINISH) && (pState->m_finished_compression)) pState->m_status = LZHAM_COMP_STATUS_SUCCESS; else if ((has_no_more_output) && (consumed_entire_input_buf) && (flush_type == LZHAM_NO_FLUSH)) pState->m_status = LZHAM_COMP_STATUS_NEEDS_MORE_INPUT; else pState->m_status = has_no_more_output ? LZHAM_COMP_STATUS_NOT_FINISHED : LZHAM_COMP_STATUS_HAS_MORE_OUTPUT; return pState->m_status; } lzham_compress_status_t LZHAM_CDECL lzham_lib_compress_memory(const lzham_compress_params *pParams, lzham_uint8* pDst_buf, size_t *pDst_len, const lzham_uint8* pSrc_buf, size_t src_len, lzham_uint32 *pAdler32) { if ((!pParams) || (!pDst_len)) return LZHAM_COMP_STATUS_INVALID_PARAMETER; if (src_len) { if (!pSrc_buf) return LZHAM_COMP_STATUS_INVALID_PARAMETER; } if (sizeof(size_t) > sizeof(uint32)) { if (src_len > LZHAM_UINT32_MAX) return LZHAM_COMP_STATUS_INVALID_PARAMETER; } lzcompressor::init_params internal_params; lzham_compress_status_t status = create_internal_init_params(internal_params, pParams); if (status != LZHAM_COMP_STATUS_SUCCESS) return status; task_pool *pTP = NULL; if (internal_params.m_max_helper_threads) { pTP = lzham_new<task_pool>(); if (!pTP->init(internal_params.m_max_helper_threads)) return LZHAM_COMP_STATUS_FAILED; internal_params.m_pTask_pool = pTP; } lzcompressor *pCompressor = lzham_new<lzcompressor>(); if (!pCompressor) { lzham_delete(pTP); return LZHAM_COMP_STATUS_FAILED; } if (!pCompressor->init(internal_params)) { lzham_delete(pTP); lzham_delete(pCompressor); return LZHAM_COMP_STATUS_INVALID_PARAMETER; } if (src_len) { if (!pCompressor->put_bytes(pSrc_buf, static_cast<uint32>(src_len))) { *pDst_len = 0; lzham_delete(pTP); lzham_delete(pCompressor); return LZHAM_COMP_STATUS_FAILED; } } if (!pCompressor->put_bytes(NULL, 0)) { *pDst_len = 0; lzham_delete(pTP); lzham_delete(pCompressor); return LZHAM_COMP_STATUS_FAILED; } const byte_vec &comp_data = pCompressor->get_compressed_data(); size_t dst_buf_size = *pDst_len; *pDst_len = comp_data.size(); if (pAdler32) *pAdler32 = pCompressor->get_src_adler32(); if (comp_data.size() > dst_buf_size) { lzham_delete(pTP); lzham_delete(pCompressor); return LZHAM_COMP_STATUS_OUTPUT_BUF_TOO_SMALL; } memcpy(pDst_buf, comp_data.get_ptr(), comp_data.size()); lzham_delete(pTP); lzham_delete(pCompressor); return LZHAM_COMP_STATUS_SUCCESS; } // ----------------- zlib-style API's int lzham_lib_z_deflateInit(lzham_z_streamp pStream, int level) { return lzham_lib_z_deflateInit2(pStream, level, LZHAM_Z_LZHAM, LZHAM_Z_DEFAULT_WINDOW_BITS, 9, LZHAM_Z_DEFAULT_STRATEGY); } int lzham_lib_z_deflateInit2(lzham_z_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy) { if (strategy) {} if (!pStream) return LZHAM_Z_STREAM_ERROR; if ((mem_level < 1) || (mem_level > 9)) return LZHAM_Z_PARAM_ERROR; if ((method != LZHAM_Z_DEFLATED) && (method != LZHAM_Z_LZHAM)) return LZHAM_Z_PARAM_ERROR; if (level == LZHAM_Z_DEFAULT_COMPRESSION) level = 9; if (method == LZHAM_Z_DEFLATED) { // Force Deflate to LZHAM with default window_bits. method = LZHAM_Z_LZHAM; window_bits = LZHAM_Z_DEFAULT_WINDOW_BITS; } #ifdef LZHAM_Z_API_FORCE_WINDOW_BITS window_bits = LZHAM_Z_API_FORCE_WINDOW_BITS; #endif int max_window_bits = LZHAM_64BIT_POINTERS ? LZHAM_MAX_DICT_SIZE_LOG2_X64 : LZHAM_MAX_DICT_SIZE_LOG2_X86; if ((labs(window_bits) < LZHAM_MIN_DICT_SIZE_LOG2) || (labs(window_bits) > max_window_bits)) return LZHAM_Z_PARAM_ERROR; lzham_compress_params comp_params; utils::zero_object(comp_params); comp_params.m_struct_size = sizeof(lzham_compress_params); comp_params.m_level = LZHAM_COMP_LEVEL_UBER; if (level <= 1) comp_params.m_level = LZHAM_COMP_LEVEL_FASTEST; else if (level <= 3) comp_params.m_level = LZHAM_COMP_LEVEL_FASTER; else if (level <= 5) comp_params.m_level = LZHAM_COMP_LEVEL_DEFAULT; else if (level <= 7) comp_params.m_level = LZHAM_COMP_LEVEL_BETTER; if (level == 10) comp_params.m_compress_flags |= LZHAM_COMP_FLAG_EXTREME_PARSING; // Use all CPU's. TODO: This is not always the best idea depending on the dictionary size and the # of bytes to compress. comp_params.m_max_helper_threads = -1; comp_params.m_dict_size_log2 = labs(window_bits); if (window_bits > 0) comp_params.m_compress_flags |= LZHAM_COMP_FLAG_WRITE_ZLIB_STREAM; pStream->data_type = 0; pStream->adler = LZHAM_Z_ADLER32_INIT; pStream->msg = NULL; pStream->reserved = 0; pStream->total_in = 0; pStream->total_out = 0; lzham_compress_state_ptr pComp = lzham_lib_compress_init(&comp_params); if (!pComp) return LZHAM_Z_PARAM_ERROR; pStream->state = (struct lzham_z_internal_state *)pComp; return LZHAM_Z_OK; } int lzham_lib_z_deflateReset(lzham_z_streamp pStream) { if (!pStream) return LZHAM_Z_STREAM_ERROR; lzham_compress_state_ptr pComp = (lzham_compress_state_ptr)pStream->state; if (!pComp) return LZHAM_Z_STREAM_ERROR; pComp = lzham_lib_compress_reinit(pComp); if (!pComp) return LZHAM_Z_STREAM_ERROR; pStream->state = (struct lzham_z_internal_state *)pComp; return LZHAM_Z_OK; } int lzham_lib_z_deflate(lzham_z_streamp pStream, int flush) { if ((!pStream) || (!pStream->state) || (flush < 0) || (flush > LZHAM_Z_FINISH) || (!pStream->next_out)) return LZHAM_Z_STREAM_ERROR; if (!pStream->avail_out) return LZHAM_Z_BUF_ERROR; if (flush == LZHAM_Z_PARTIAL_FLUSH) flush = LZHAM_Z_SYNC_FLUSH; int lzham_status = LZHAM_Z_OK; lzham_z_ulong orig_total_in = pStream->total_in, orig_total_out = pStream->total_out; for ( ; ; ) { size_t in_bytes = pStream->avail_in, out_bytes = pStream->avail_out; lzham_compress_state_ptr pComp = (lzham_compress_state_ptr)pStream->state; lzham_compress_state *pState = static_cast<lzham_compress_state*>(pComp); lzham_compress_status_t status = lzham_lib_compress2( pComp, pStream->next_in, &in_bytes, pStream->next_out, &out_bytes, (lzham_flush_t)flush); pStream->next_in += (uint)in_bytes; pStream->avail_in -= (uint)in_bytes; pStream->total_in += (uint)in_bytes; pStream->next_out += (uint)out_bytes; pStream->avail_out -= (uint)out_bytes; pStream->total_out += (uint)out_bytes; pStream->adler = pState->m_compressor.get_src_adler32(); if (status >= LZHAM_COMP_STATUS_FIRST_FAILURE_CODE) { lzham_status = LZHAM_Z_STREAM_ERROR; break; } else if (status == LZHAM_COMP_STATUS_SUCCESS) { lzham_status = LZHAM_Z_STREAM_END; break; } else if (!pStream->avail_out) break; else if ((!pStream->avail_in) && (flush != LZHAM_Z_FINISH)) { if ((flush) || (pStream->total_in != orig_total_in) || (pStream->total_out != orig_total_out)) break; return LZHAM_Z_BUF_ERROR; // Can't make forward progress without some input. } } return lzham_status; } int lzham_lib_z_deflateEnd(lzham_z_streamp pStream) { if (!pStream) return LZHAM_Z_STREAM_ERROR; lzham_compress_state_ptr pComp = (lzham_compress_state_ptr)pStream->state; if (pComp) { pStream->adler = lzham_lib_compress_deinit(pComp); pStream->state = NULL; } return LZHAM_Z_OK; } lzham_z_ulong lzham_lib_z_deflateBound(lzham_z_streamp /*pStream*/, lzham_z_ulong source_len) { /*pStream;*/ return 64 + source_len + ((source_len + 4095) / 4096) * 4; } int lzham_lib_z_compress2(unsigned char *pDest, lzham_z_ulong *pDest_len, const unsigned char *pSource, lzham_z_ulong source_len, int level) { int status; lzham_z_stream stream; memset(&stream, 0, sizeof(stream)); // In case lzham_z_ulong is 64-bits (argh I hate longs). if ((source_len | *pDest_len) > 0xFFFFFFFFU) return LZHAM_Z_PARAM_ERROR; stream.next_in = pSource; stream.avail_in = (uint)source_len; stream.next_out = pDest; stream.avail_out = (uint)*pDest_len; status = lzham_lib_z_deflateInit(&stream, level); if (status != LZHAM_Z_OK) return status; status = lzham_lib_z_deflate(&stream, LZHAM_Z_FINISH); if (status != LZHAM_Z_STREAM_END) { lzham_lib_z_deflateEnd(&stream); return (status == LZHAM_Z_OK) ? LZHAM_Z_BUF_ERROR : status; } *pDest_len = stream.total_out; return lzham_lib_z_deflateEnd(&stream); } int lzham_lib_z_compress(unsigned char *pDest, lzham_z_ulong *pDest_len, const unsigned char *pSource, lzham_z_ulong source_len) { return lzham_lib_z_compress2(pDest, pDest_len, pSource, source_len, (int)LZHAM_Z_DEFAULT_COMPRESSION); } lzham_z_ulong lzham_lib_z_compressBound(lzham_z_ulong source_len) { return lzham_lib_z_deflateBound(NULL, source_len); } } // namespace lzham ����������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_lzcomp_internal.h������������������������������������0000644�0001750�0001750�00000037343�12320456500�024275� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_lzcomp_internal.h // See Copyright Notice and license at the end of include/lzham.h #pragma once #include "lzham_match_accel.h" #include "lzham_symbol_codec.h" #include "lzham_lzbase.h" namespace lzham { typedef lzham::vector<uint8> byte_vec; const uint cMaxParseGraphNodes = 3072; const uint cMaxParseThreads = 8; enum compression_level { cCompressionLevelFastest, cCompressionLevelFaster, cCompressionLevelDefault, cCompressionLevelBetter, cCompressionLevelUber, cCompressionLevelCount }; struct comp_settings { uint m_fast_bytes; bool m_fast_adaptive_huffman_updating; bool m_use_polar_codes; uint m_match_accel_max_matches_per_probe; uint m_match_accel_max_probes; }; class lzcompressor : public CLZBase { public: lzcompressor(); struct init_params { enum { cMinDictSizeLog2 = CLZBase::cMinDictSizeLog2, cMaxDictSizeLog2 = CLZBase::cMaxDictSizeLog2, cDefaultBlockSize = 1024U*512U }; init_params() : m_pTask_pool(NULL), m_max_helper_threads(0), m_compression_level(cCompressionLevelDefault), m_dict_size_log2(22), m_block_size(cDefaultBlockSize), m_num_cachelines(0), m_cacheline_size(0), m_lzham_compress_flags(0), m_pSeed_bytes(0), m_num_seed_bytes(0) { } task_pool* m_pTask_pool; uint m_max_helper_threads; compression_level m_compression_level; uint m_dict_size_log2; uint m_block_size; uint m_num_cachelines; uint m_cacheline_size; uint m_lzham_compress_flags; const void *m_pSeed_bytes; uint m_num_seed_bytes; }; bool init(const init_params& params); void clear(); // sync, or sync+dictionary flush bool flush(lzham_flush_t flush_type); bool reset(); bool put_bytes(const void* pBuf, uint buf_len); const byte_vec& get_compressed_data() const { return m_comp_buf; } byte_vec& get_compressed_data() { return m_comp_buf; } uint32 get_src_adler32() const { return m_src_adler32; } private: class state; enum { cLitComplexity = 1, cRep0Complexity = 2, cRep3Complexity = 5, cLongMatchComplexity = 6, cLongMatchComplexityLenThresh = 9, cShortMatchComplexity = 7 }; struct lzdecision { int m_pos; // dict position where decision was evaluated int m_len; // 0 if literal, 1+ if match int m_dist; // <0 if match rep, else >=1 is match dist inline lzdecision() { } inline lzdecision(int pos, int len, int dist) : m_pos(pos), m_len(len), m_dist(dist) { } inline void init(int pos, int len, int dist) { m_pos = pos; m_len = len; m_dist = dist; } inline bool is_lit() const { return !m_len; } inline bool is_match() const { return m_len > 0; } // may be a rep or full match inline bool is_full_match() const { return (m_len > 0) && (m_dist >= 1); } inline uint get_len() const { return math::maximum<uint>(m_len, 1); } inline bool is_rep() const { return m_dist < 0; } inline bool is_rep0() const { return m_dist == -1; } uint get_match_dist(const state& s) const; inline uint get_complexity() const { if (is_lit()) return cLitComplexity; else if (is_rep()) { LZHAM_ASSUME(cRep0Complexity == 2); return 1 + -m_dist; // 2, 3, 4, or 5 } else if (get_len() >= cLongMatchComplexityLenThresh) return cLongMatchComplexity; else return cShortMatchComplexity; } inline uint get_min_codable_len() const { if (is_lit() || is_rep0()) return 1; else return CLZBase::cMinMatchLen; } }; struct lzpriced_decision : lzdecision { lzpriced_decision() { } inline lzpriced_decision(int pos, int len, int dist) : lzdecision(pos, len, dist) { } inline lzpriced_decision(int pos, int len, int dist, bit_cost_t cost) : lzdecision(pos, len, dist), m_cost(cost) { } inline void init(int pos, int len, int dist, bit_cost_t cost) { lzdecision::init(pos, len, dist); m_cost = cost; } inline bit_cost_t get_cost() const { return m_cost; } bit_cost_t m_cost; }; struct state_base { uint m_cur_ofs; uint m_cur_state; uint m_match_hist[CLZBase::cMatchHistSize]; inline bool operator== (const state_base &rhs) const { if (m_cur_state != rhs.m_cur_state) return false; for (uint i = 0; i < CLZBase::cMatchHistSize; i++) if (m_match_hist[i] != rhs.m_match_hist[i]) return false; return true; } void partial_advance(const lzdecision& lzdec); inline void save_partial_state(state_base& dst) { dst.m_cur_ofs = m_cur_ofs; dst.m_cur_state = m_cur_state; memcpy(dst.m_match_hist, m_match_hist, sizeof(m_match_hist)); } inline void restore_partial_state(const state_base& src) { m_cur_ofs = src.m_cur_ofs; m_cur_state = src.m_cur_state; memcpy(m_match_hist, src.m_match_hist, sizeof(m_match_hist)); } }; class state : public state_base { public: state(); void clear(); bool init(CLZBase& lzbase, bool fast_adaptive_huffman_updating, bool use_polar_codes); void reset(); bit_cost_t get_cost(CLZBase& lzbase, const search_accelerator& dict, const lzdecision& lzdec) const; bit_cost_t get_len2_match_cost(CLZBase& lzbase, uint dict_pos, uint len2_match_dist, uint is_match_model_index); bit_cost_t get_lit_cost(const search_accelerator& dict, uint dict_pos, uint lit_pred0, uint is_match_model_index) const; // Returns actual cost. void get_rep_match_costs(uint dict_pos, bit_cost_t *pBitcosts, uint match_hist_index, int min_len, int max_len, uint is_match_model_index) const; void get_full_match_costs(CLZBase& lzbase, uint dict_pos, bit_cost_t *pBitcosts, uint match_dist, int min_len, int max_len, uint is_match_model_index) const; bit_cost_t update_stats(CLZBase& lzbase, const search_accelerator& dict, const lzdecision& lzdec); bool advance(CLZBase& lzbase, const search_accelerator& dict, const lzdecision& lzdec); bool encode(symbol_codec& codec, CLZBase& lzbase, const search_accelerator& dict, const lzdecision& lzdec); void print(symbol_codec& codec, CLZBase& lzbase, const search_accelerator& dict, const lzdecision& lzdec); bool encode_eob(symbol_codec& codec, const search_accelerator& dict, uint dict_pos); bool encode_reset_state_partial(symbol_codec& codec, const search_accelerator& dict, uint dict_pos); void update_match_hist(uint match_dist); int find_match_dist(uint match_hist) const; void reset_state_partial(); void start_of_block(const search_accelerator& dict, uint cur_ofs, uint block_index); void reset_update_rate(); uint get_pred_char(const search_accelerator& dict, int pos, int backward_ofs) const; inline bool will_reference_last_match(const lzdecision& lzdec) const { return (!lzdec.is_match()) && (m_cur_state >= CLZBase::cNumLitStates); } uint m_block_start_dict_ofs; adaptive_bit_model m_is_match_model[CLZBase::cNumStates * (1 << CLZBase::cNumIsMatchContextBits)]; adaptive_bit_model m_is_rep_model[CLZBase::cNumStates]; adaptive_bit_model m_is_rep0_model[CLZBase::cNumStates]; adaptive_bit_model m_is_rep0_single_byte_model[CLZBase::cNumStates]; adaptive_bit_model m_is_rep1_model[CLZBase::cNumStates]; adaptive_bit_model m_is_rep2_model[CLZBase::cNumStates]; #if LZHAM_USE_ALL_ARITHMETIC_CODING typedef adaptive_arith_data_model sym_data_model; #else typedef quasi_adaptive_huffman_data_model sym_data_model; #endif sym_data_model m_lit_table[1 << CLZBase::cNumLitPredBits]; sym_data_model m_delta_lit_table[1 << CLZBase::cNumDeltaLitPredBits]; sym_data_model m_main_table; sym_data_model m_rep_len_table[2]; sym_data_model m_large_len_table[2]; sym_data_model m_dist_lsb_table; }; class tracked_stat { public: tracked_stat() { clear(); } void clear() { m_num = 0; m_total = 0.0f; m_total2 = 0.0f; m_min_val = 9e+99; m_max_val = -9e+99; } void update(double val) { m_num++; m_total += val; m_total2 += val * val; m_min_val = LZHAM_MIN(m_min_val, val); m_max_val = LZHAM_MAX(m_max_val, val); } tracked_stat &operator += (double val) { update(val); return *this; } operator double() const { return m_total; } uint64 get_number_of_values() { return m_num; } uint32 get_number_of_values32() { return static_cast<uint32>(LZHAM_MIN(UINT_MAX, m_num)); } double get_total() const { return m_total; } double get_average() const { return m_num ? m_total / m_num : 0.0f; }; double get_std_dev() const { return m_num ? sqrt( m_num * m_total2 - m_total * m_total ) / m_num: 0.0f; } double get_min_val() const { return m_num ? m_min_val : 0.0f; } double get_max_val() const { return m_num ? m_max_val : 0.0f; } private: uint64 m_num; double m_total; double m_total2; double m_min_val; double m_max_val; }; struct coding_stats { coding_stats() { clear(); } void clear(); void update(const lzdecision& lzdec, const state& cur_state, const search_accelerator& dict, bit_cost_t cost); void print(); uint m_total_bytes; uint m_total_contexts; double m_total_cost; tracked_stat m_context_stats; double m_total_match_bits_cost; double m_worst_match_bits_cost; double m_total_is_match0_bits_cost; double m_total_is_match1_bits_cost; uint m_total_truncated_matches; uint m_match_truncation_len_hist[CLZBase::cMaxMatchLen + 1]; uint m_match_truncation_hist[CLZBase::cMaxMatchLen + 1]; uint m_match_type_truncation_hist[CLZBase::cNumStates][5]; uint m_match_type_was_not_truncated_hist[CLZBase::cNumStates][5]; uint m_total_nonmatches; uint m_total_matches; tracked_stat m_lit_stats; tracked_stat m_delta_lit_stats; tracked_stat m_rep_stats[CLZBase::cMatchHistSize]; tracked_stat m_rep0_len1_stats; tracked_stat m_rep0_len2_plus_stats; tracked_stat m_full_match_stats[cMaxMatchLen + 1]; uint m_total_far_len2_matches; uint m_total_near_len2_matches; uint m_total_update_rate_resets; uint m_max_len2_dist; }; init_params m_params; comp_settings m_settings; int64 m_src_size; uint32 m_src_adler32; search_accelerator m_accel; symbol_codec m_codec; coding_stats m_stats; byte_vec m_block_buf; byte_vec m_comp_buf; uint m_step; uint m_block_start_dict_ofs; uint m_block_index; bool m_finished; bool m_use_task_pool; struct node_state { LZHAM_FORCE_INLINE void clear() { m_total_cost = cBitCostMax; //math::cNearlyInfinite; m_total_complexity = UINT_MAX; } // the lzdecision that led from parent to this node_state lzdecision m_lzdec; // This is either the state of the parent node (optimal parsing), or the state of the child node (extreme parsing). state::state_base m_saved_state; // Total cost to arrive at this node state. bit_cost_t m_total_cost; uint m_total_complexity; // Parent node index. int16 m_parent_index; // Parent node state index (only valid when extreme parsing). int8 m_parent_state_index; }; struct node { LZHAM_FORCE_INLINE void clear() { m_num_node_states = 0; } uint m_num_node_states; enum { cMaxNodeStates = 4 }; node_state m_node_states[cMaxNodeStates]; void add_state(int parent_index, int parent_state_index, const lzdecision &lzdec, state &parent_state, bit_cost_t total_cost, uint total_complexity); }; state m_start_of_block_state; // state at start of block state m_state; // main thread's current coding state struct raw_parse_thread_state { uint m_start_ofs; uint m_bytes_to_match; state m_initial_state; node m_nodes[cMaxParseGraphNodes + 1]; lzham::vector<lzdecision> m_best_decisions; bool m_emit_decisions_backwards; lzham::vector<lzpriced_decision> m_temp_decisions; uint m_max_greedy_decisions; uint m_greedy_parse_total_bytes_coded; bool m_greedy_parse_gave_up; bool m_issue_reset_state_partial; bool m_failed; }; struct parse_thread_state : raw_parse_thread_state { uint8 m_unused_alignment_array[128 - (sizeof(raw_parse_thread_state) & 127)]; }; uint m_num_parse_threads; parse_thread_state m_parse_thread_state[cMaxParseThreads + 1]; // +1 extra for the greedy parser thread (only used for delta compression) volatile atomic32_t m_parse_jobs_remaining; semaphore m_parse_jobs_complete; enum { cMaxBlockHistorySize = 6, cBlockHistoryCompRatioScale = 1000U }; struct block_history { uint m_comp_size; uint m_src_size; uint m_ratio; bool m_raw_block; bool m_reset_update_rate; }; block_history m_block_history[cMaxBlockHistorySize]; uint m_block_history_size; uint m_block_history_next; void update_block_history(uint comp_size, uint src_size, uint ratio, bool raw_block, bool reset_update_rate); uint get_recent_block_ratio(); uint get_min_block_ratio(); uint get_max_block_ratio(); uint get_total_recent_reset_update_rate(); bool send_zlib_header(); bool init_seed_bytes(); bool send_final_block(); bool send_configuration(); bool extreme_parse(parse_thread_state &parse_state); bool optimal_parse(parse_thread_state &parse_state); int enumerate_lz_decisions(uint ofs, const state& cur_state, lzham::vector<lzpriced_decision>& decisions, uint min_match_len, uint max_match_len); bool greedy_parse(parse_thread_state &parse_state); void parse_job_callback(uint64 data, void* pData_ptr); bool compress_block(const void* pBuf, uint buf_len); bool compress_block_internal(const void* pBuf, uint buf_len); bool code_decision(lzdecision lzdec, uint& cur_ofs, uint& bytes_to_match); bool send_sync_block(lzham_flush_t flush_type); }; } // namespace lzham ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_lib.cpp����������������������������������������������0000644�0001750�0001750�00000014203�12320456500�022164� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_lib.cpp - Static library entrypoints. // See Copyright Notice and license at the end of include/lzham.h #include "lzham_core.h" #include "lzham_decomp.h" #include "lzham_comp.h" extern "C" lzham_uint32 LZHAM_CDECL lzham_get_version(void) { return LZHAM_DLL_VERSION; } extern "C" void LZHAM_CDECL lzham_set_memory_callbacks(lzham_realloc_func pRealloc, lzham_msize_func pMSize, void* pUser_data) { lzham::lzham_lib_set_memory_callbacks(pRealloc, pMSize, pUser_data); } extern "C" lzham_decompress_state_ptr LZHAM_CDECL lzham_decompress_init(const lzham_decompress_params *pParams) { return lzham::lzham_lib_decompress_init(pParams); } extern "C" lzham_decompress_state_ptr LZHAM_CDECL lzham_decompress_reinit(lzham_decompress_state_ptr p, const lzham_decompress_params *pParams) { return lzham::lzham_lib_decompress_reinit(p, pParams); } extern "C" lzham_uint32 LZHAM_CDECL lzham_decompress_deinit(lzham_decompress_state_ptr p) { return lzham::lzham_lib_decompress_deinit(p); } extern "C" lzham_decompress_status_t LZHAM_CDECL lzham_decompress( lzham_decompress_state_ptr p, const lzham_uint8 *pIn_buf, size_t *pIn_buf_size, lzham_uint8 *pOut_buf, size_t *pOut_buf_size, lzham_bool no_more_input_bytes_flag) { return lzham::lzham_lib_decompress(p, pIn_buf, pIn_buf_size, pOut_buf, pOut_buf_size, no_more_input_bytes_flag); } extern "C" lzham_decompress_status_t LZHAM_CDECL lzham_decompress_memory(const lzham_decompress_params *pParams, lzham_uint8* pDst_buf, size_t *pDst_len, const lzham_uint8* pSrc_buf, size_t src_len, lzham_uint32 *pAdler32) { return lzham::lzham_lib_decompress_memory(pParams, pDst_buf, pDst_len, pSrc_buf, src_len, pAdler32); } extern "C" lzham_compress_state_ptr LZHAM_CDECL lzham_compress_init(const lzham_compress_params *pParams) { return lzham::lzham_lib_compress_init(pParams); } extern "C" lzham_compress_state_ptr LZHAM_CDECL lzham_compress_reinit(lzham_compress_state_ptr p) { return lzham::lzham_lib_compress_reinit(p); } extern "C" lzham_uint32 LZHAM_CDECL lzham_compress_deinit(lzham_compress_state_ptr p) { return lzham::lzham_lib_compress_deinit(p); } extern "C" lzham_compress_status_t LZHAM_CDECL lzham_compress( lzham_compress_state_ptr p, const lzham_uint8 *pIn_buf, size_t *pIn_buf_size, lzham_uint8 *pOut_buf, size_t *pOut_buf_size, lzham_bool no_more_input_bytes_flag) { return lzham::lzham_lib_compress(p, pIn_buf, pIn_buf_size, pOut_buf, pOut_buf_size, no_more_input_bytes_flag); } extern "C" lzham_compress_status_t LZHAM_CDECL lzham_compress2( lzham_compress_state_ptr p, const lzham_uint8 *pIn_buf, size_t *pIn_buf_size, lzham_uint8 *pOut_buf, size_t *pOut_buf_size, lzham_flush_t flush_type) { return lzham::lzham_lib_compress2(p, pIn_buf, pIn_buf_size, pOut_buf, pOut_buf_size, flush_type); } extern "C" lzham_compress_status_t LZHAM_CDECL lzham_compress_memory(const lzham_compress_params *pParams, lzham_uint8* pDst_buf, size_t *pDst_len, const lzham_uint8* pSrc_buf, size_t src_len, lzham_uint32 *pAdler32) { return lzham::lzham_lib_compress_memory(pParams, pDst_buf, pDst_len, pSrc_buf, src_len, pAdler32); } // ----------------- zlib-style API's extern "C" const char * LZHAM_CDECL lzham_z_version(void) { return LZHAM_Z_VERSION; } extern "C" lzham_z_ulong LZHAM_CDECL lzham_z_adler32(lzham_z_ulong adler, const unsigned char *ptr, size_t buf_len) { return lzham::lzham_lib_z_adler32(adler, ptr, buf_len); } extern "C" lzham_z_ulong LZHAM_CDECL lzham_z_crc32(lzham_z_ulong crc, const lzham_uint8 *ptr, size_t buf_len) { return lzham::lzham_lib_z_crc32(crc, ptr, buf_len); } extern "C" int LZHAM_CDECL lzham_z_deflateInit(lzham_z_streamp pStream, int level) { return lzham::lzham_lib_z_deflateInit(pStream, level); } extern "C" int LZHAM_CDECL lzham_z_deflateInit2(lzham_z_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy) { return lzham::lzham_lib_z_deflateInit2(pStream, level, method, window_bits, mem_level, strategy); } extern "C" int LZHAM_CDECL lzham_z_deflateReset(lzham_z_streamp pStream) { return lzham::lzham_lib_z_deflateReset(pStream); } extern "C" int LZHAM_CDECL lzham_z_deflate(lzham_z_streamp pStream, int flush) { return lzham::lzham_lib_z_deflate(pStream, flush); } extern "C" int LZHAM_CDECL lzham_z_deflateEnd(lzham_z_streamp pStream) { return lzham::lzham_lib_z_deflateEnd(pStream); } extern "C" lzham_z_ulong LZHAM_CDECL lzham_z_deflateBound(lzham_z_streamp pStream, lzham_z_ulong source_len) { return lzham::lzham_lib_z_deflateBound(pStream, source_len); } extern "C" int LZHAM_CDECL lzham_z_compress(unsigned char *pDest, lzham_z_ulong *pDest_len, const unsigned char *pSource, lzham_z_ulong source_len) { return lzham::lzham_lib_z_compress(pDest, pDest_len, pSource, source_len); } extern "C" int LZHAM_CDECL lzham_z_compress2(unsigned char *pDest, lzham_z_ulong *pDest_len, const unsigned char *pSource, lzham_z_ulong source_len, int level) { return lzham::lzham_lib_z_compress2(pDest, pDest_len, pSource, source_len, level); } extern "C" lzham_z_ulong LZHAM_CDECL lzham_z_compressBound(lzham_z_ulong source_len) { return lzham::lzham_lib_z_compressBound(source_len); } extern "C" int LZHAM_CDECL lzham_z_inflateInit(lzham_z_streamp pStream) { return lzham::lzham_lib_z_inflateInit(pStream); } extern "C" int LZHAM_CDECL lzham_z_inflateInit2(lzham_z_streamp pStream, int window_bits) { return lzham::lzham_lib_z_inflateInit2(pStream, window_bits); } extern "C" int LZHAM_CDECL lzham_z_inflateReset(lzham_z_streamp pStream) { return lzham::lzham_lib_z_inflateReset(pStream); } extern "C" int LZHAM_CDECL lzham_z_inflate(lzham_z_streamp pStream, int flush) { return lzham::lzham_lib_z_inflate(pStream, flush); } extern "C" int LZHAM_CDECL lzham_z_inflateEnd(lzham_z_streamp pStream) { return lzham::lzham_lib_z_inflateEnd(pStream); } extern "C" int LZHAM_CDECL lzham_z_uncompress(unsigned char *pDest, lzham_z_ulong *pDest_len, const unsigned char *pSource, lzham_z_ulong source_len) { return lzham::lzham_lib_z_uncompress(pDest, pDest_len, pSource, source_len); } extern "C" const char * LZHAM_CDECL lzham_z_error(int err) { return lzham::lzham_lib_z_error(err); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_lzcomp_state.cpp�������������������������������������0000644�0001750�0001750�00000150242�12320456500�024126� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_lzcomp_state.cpp // See Copyright Notice and license at the end of include/lzham.h #include "lzham_core.h" #include "lzham_lzcomp_internal.h" namespace lzham { static uint get_huge_match_code_len(uint len) { LZHAM_ASSERT((len > CLZBase::cMaxMatchLen) && (len <= CLZBase::cMaxHugeMatchLen)); len -= (CLZBase::cMaxMatchLen + 1); if (len < 256) return 1 + 8; else if (len < (256 + 1024)) return 2 + 10; else if (len < (256 + 1024 + 4096)) return 3 + 12; else return 3 + 16; } static uint get_huge_match_code_bits(uint len) { LZHAM_ASSERT((len > CLZBase::cMaxMatchLen) && (len <= CLZBase::cMaxHugeMatchLen)); len -= (CLZBase::cMaxMatchLen + 1); uint c; if (len < 256) c = len; else if (len < (256 + 1024)) { uint r = (len - 256); LZHAM_ASSERT(r <= 1023); c = r | (2 << 10); } else if (len < (256 + 1024 + 4096)) { uint r = (len - (256 + 1024)); LZHAM_ASSERT(r <= 4095); c = r | (6 << 12); } else { uint r = (len - (256 + 1024 + 4096)); LZHAM_ASSERT(r <= 65535); c = r | (7 << 16); } return c; } uint lzcompressor::lzdecision::get_match_dist(const state& cur_state) const { if (!is_match()) return 0; else if (is_rep()) { int index = -m_dist - 1; LZHAM_ASSERT(index < CLZBase::cMatchHistSize); return cur_state.m_match_hist[index]; } else return m_dist; } lzcompressor::state::state() { clear(); } void lzcompressor::state::clear() { m_cur_ofs = 0; m_cur_state = 0; m_block_start_dict_ofs = 0; for (uint i = 0; i < 2; i++) { m_rep_len_table[i].clear(); m_large_len_table[i].clear(); } m_main_table.clear(); m_dist_lsb_table.clear(); for (uint i = 0; i < (1 << CLZBase::cNumLitPredBits); i++) m_lit_table[i].clear(); for (uint i = 0; i < (1 << CLZBase::cNumDeltaLitPredBits); i++) m_delta_lit_table[i].clear(); m_match_hist[0] = 1; m_match_hist[1] = 1; m_match_hist[2] = 1; m_match_hist[3] = 1; } void lzcompressor::state::reset() { m_cur_ofs = 0; m_cur_state = 0; m_block_start_dict_ofs = 0; for (uint i = 0; i < LZHAM_ARRAY_SIZE(m_is_match_model); i++) m_is_match_model[i].clear(); for (uint i = 0; i < LZHAM_ARRAY_SIZE(m_is_rep_model); i++) m_is_rep_model[i].clear(); for (uint i = 0; i < LZHAM_ARRAY_SIZE(m_is_rep0_model); i++) m_is_rep0_model[i].clear(); for (uint i = 0; i < LZHAM_ARRAY_SIZE(m_is_rep0_single_byte_model); i++) m_is_rep0_single_byte_model[i].clear(); for (uint i = 0; i < LZHAM_ARRAY_SIZE(m_is_rep1_model); i++) m_is_rep1_model[i].clear(); for (uint i = 0; i < LZHAM_ARRAY_SIZE(m_is_rep2_model); i++) m_is_rep2_model[i].clear(); for (uint i = 0; i < 2; i++) { m_rep_len_table[i].reset(); m_large_len_table[i].reset(); } m_main_table.reset(); m_dist_lsb_table.reset(); // Only reset the first table in the array, then just clone it to the others because they're all the same when reset. (This is ~9x faster than resetting each one.) m_lit_table[0].reset(); for (uint i = 1; i < LZHAM_ARRAY_SIZE(m_lit_table); i++) m_lit_table[i] = m_lit_table[0]; m_delta_lit_table[0].reset(); for (uint i = 1; i < LZHAM_ARRAY_SIZE(m_delta_lit_table); i++) m_delta_lit_table[i] = m_delta_lit_table[0]; m_match_hist[0] = 1; m_match_hist[1] = 1; m_match_hist[2] = 1; m_match_hist[3] = 1; } bool lzcompressor::state::init(CLZBase& lzbase, bool fast_adaptive_huffman_updating, bool use_polar_codes) { m_cur_ofs = 0; m_cur_state = 0; if (!m_rep_len_table[0].init(true, CLZBase::cNumHugeMatchCodes + (CLZBase::cMaxMatchLen - CLZBase::cMinMatchLen + 1), fast_adaptive_huffman_updating, use_polar_codes)) return false; if (!m_rep_len_table[1].assign(m_rep_len_table[0])) return false; if (!m_large_len_table[0].init(true, CLZBase::cNumHugeMatchCodes + CLZBase::cLZXNumSecondaryLengths, fast_adaptive_huffman_updating, use_polar_codes)) return false; if (!m_large_len_table[1].assign(m_large_len_table[0])) return false; if (!m_main_table.init(true, CLZBase::cLZXNumSpecialLengths + (lzbase.m_num_lzx_slots - CLZBase::cLZXLowestUsableMatchSlot) * 8, fast_adaptive_huffman_updating, use_polar_codes)) return false; if (!m_dist_lsb_table.init(true, 16, fast_adaptive_huffman_updating, use_polar_codes)) return false; if (!m_lit_table[0].init(true, 256, fast_adaptive_huffman_updating, use_polar_codes)) return false; for (uint i = 1; i < (1 << CLZBase::cNumLitPredBits); i++) if (!m_lit_table[i].assign(m_lit_table[0])) return false; if (!m_delta_lit_table[0].init(true, 256, fast_adaptive_huffman_updating, use_polar_codes)) return false; for (uint i = 1; i < (1 << CLZBase::cNumDeltaLitPredBits); i++) if (!m_delta_lit_table[i].assign(m_delta_lit_table[0])) return false; m_match_hist[0] = 1; m_match_hist[1] = 1; m_match_hist[2] = 1; m_match_hist[3] = 1; return true; } void lzcompressor::state_base::partial_advance(const lzdecision& lzdec) { if (lzdec.m_len == 0) { if (m_cur_state < 4) m_cur_state = 0; else if (m_cur_state < 10) m_cur_state -= 3; else m_cur_state -= 6; } else { if (lzdec.m_dist < 0) { int match_hist_index = -lzdec.m_dist - 1; if (!match_hist_index) { if (lzdec.m_len == 1) { m_cur_state = (m_cur_state < CLZBase::cNumLitStates) ? 9 : 11; } else { m_cur_state = (m_cur_state < CLZBase::cNumLitStates) ? 8 : 11; } } else { if (match_hist_index == 1) { std::swap(m_match_hist[0], m_match_hist[1]); } else if (match_hist_index == 2) { int dist = m_match_hist[2]; m_match_hist[2] = m_match_hist[1]; m_match_hist[1] = m_match_hist[0]; m_match_hist[0] = dist; } else { LZHAM_ASSERT(match_hist_index == 3); int dist = m_match_hist[3]; m_match_hist[3] = m_match_hist[2]; m_match_hist[2] = m_match_hist[1]; m_match_hist[1] = m_match_hist[0]; m_match_hist[0] = dist; } m_cur_state = (m_cur_state < CLZBase::cNumLitStates) ? 8 : 11; } } else { // full LZHAM_ASSUME(CLZBase::cMatchHistSize == 4); m_match_hist[3] = m_match_hist[2]; m_match_hist[2] = m_match_hist[1]; m_match_hist[1] = m_match_hist[0]; m_match_hist[0] = lzdec.m_dist; m_cur_state = (m_cur_state < CLZBase::cNumLitStates) ? CLZBase::cNumLitStates : CLZBase::cNumLitStates + 3; } } m_cur_ofs = lzdec.m_pos + lzdec.get_len(); } uint lzcompressor::state::get_pred_char(const search_accelerator& dict, int pos, int backward_ofs) const { LZHAM_ASSERT(pos >= (int)m_block_start_dict_ofs); int limit = pos - m_block_start_dict_ofs; if (backward_ofs > limit) return 0; return dict[pos - backward_ofs]; } bit_cost_t lzcompressor::state::get_cost(CLZBase& lzbase, const search_accelerator& dict, const lzdecision& lzdec) const { const uint lit_pred0 = get_pred_char(dict, lzdec.m_pos, 1); uint is_match_model_index = LZHAM_IS_MATCH_MODEL_INDEX(lit_pred0, m_cur_state); LZHAM_ASSERT(is_match_model_index < LZHAM_ARRAY_SIZE(m_is_match_model)); bit_cost_t cost = m_is_match_model[is_match_model_index].get_cost(lzdec.is_match()); if (!lzdec.is_match()) { const uint lit = dict[lzdec.m_pos]; if (m_cur_state < CLZBase::cNumLitStates) { const uint lit_pred1 = get_pred_char(dict, lzdec.m_pos, 2); uint lit_pred = (lit_pred0 >> (8 - CLZBase::cNumLitPredBits/2)) | (((lit_pred1 >> (8 - CLZBase::cNumLitPredBits/2)) << CLZBase::cNumLitPredBits/2)); // literal cost += m_lit_table[lit_pred].get_cost(lit); } else { // delta literal const uint rep_lit0 = dict[(lzdec.m_pos - m_match_hist[0]) & dict.m_max_dict_size_mask]; const uint rep_lit1 = dict[(lzdec.m_pos - m_match_hist[0] - 1) & dict.m_max_dict_size_mask]; uint delta_lit = rep_lit0 ^ lit; uint lit_pred = (rep_lit0 >> (8 - CLZBase::cNumDeltaLitPredBits/2)) | ((rep_lit1 >> (8 - CLZBase::cNumDeltaLitPredBits/2)) << CLZBase::cNumDeltaLitPredBits/2); cost += m_delta_lit_table[lit_pred].get_cost(delta_lit); } } else { // match if (lzdec.m_dist < 0) { // rep match cost += m_is_rep_model[m_cur_state].get_cost(1); int match_hist_index = -lzdec.m_dist - 1; if (!match_hist_index) { // rep0 match cost += m_is_rep0_model[m_cur_state].get_cost(1); if (lzdec.m_len == 1) { // single byte rep0 cost += m_is_rep0_single_byte_model[m_cur_state].get_cost(1); } else { // normal rep0 cost += m_is_rep0_single_byte_model[m_cur_state].get_cost(0); if (lzdec.m_len > CLZBase::cMaxMatchLen) { cost += get_huge_match_code_len(lzdec.m_len) + m_rep_len_table[m_cur_state >= CLZBase::cNumLitStates].get_cost((CLZBase::cMaxMatchLen + 1) - CLZBase::cMinMatchLen); } else { cost += m_rep_len_table[m_cur_state >= CLZBase::cNumLitStates].get_cost(lzdec.m_len - CLZBase::cMinMatchLen); } } } else { if (lzdec.m_len > CLZBase::cMaxMatchLen) { cost += get_huge_match_code_len(lzdec.m_len) + m_rep_len_table[m_cur_state >= CLZBase::cNumLitStates].get_cost((CLZBase::cMaxMatchLen + 1) - CLZBase::cMinMatchLen); } else { cost += m_rep_len_table[m_cur_state >= CLZBase::cNumLitStates].get_cost(lzdec.m_len - CLZBase::cMinMatchLen); } // rep1-rep3 match cost += m_is_rep0_model[m_cur_state].get_cost(0); if (match_hist_index == 1) { // rep1 cost += m_is_rep1_model[m_cur_state].get_cost(1); } else { cost += m_is_rep1_model[m_cur_state].get_cost(0); if (match_hist_index == 2) { // rep2 cost += m_is_rep2_model[m_cur_state].get_cost(1); } else { LZHAM_ASSERT(match_hist_index == 3); // rep3 cost += m_is_rep2_model[m_cur_state].get_cost(0); } } } } else { cost += m_is_rep_model[m_cur_state].get_cost(0); LZHAM_ASSERT(lzdec.m_len >= CLZBase::cMinMatchLen); // full match uint match_slot, match_extra; lzbase.compute_lzx_position_slot(lzdec.m_dist, match_slot, match_extra); uint match_low_sym = 0; if (lzdec.m_len >= 9) { match_low_sym = 7; if (lzdec.m_len > CLZBase::cMaxMatchLen) { cost += get_huge_match_code_len(lzdec.m_len) + m_large_len_table[m_cur_state >= CLZBase::cNumLitStates].get_cost((CLZBase::cMaxMatchLen + 1) - 9); } else { cost += m_large_len_table[m_cur_state >= CLZBase::cNumLitStates].get_cost(lzdec.m_len - 9); } } else match_low_sym = lzdec.m_len - 2; uint match_high_sym = 0; LZHAM_ASSERT(match_slot >= CLZBase::cLZXLowestUsableMatchSlot && (match_slot < lzbase.m_num_lzx_slots)); match_high_sym = match_slot - CLZBase::cLZXLowestUsableMatchSlot; uint main_sym = match_low_sym | (match_high_sym << 3); cost += m_main_table.get_cost(CLZBase::cLZXNumSpecialLengths + main_sym); uint num_extra_bits = lzbase.m_lzx_position_extra_bits[match_slot]; if (num_extra_bits < 3) cost += convert_to_scaled_bitcost(num_extra_bits); else { if (num_extra_bits > 4) cost += convert_to_scaled_bitcost(num_extra_bits - 4); cost += m_dist_lsb_table.get_cost(match_extra & 15); } } } return cost; } bit_cost_t lzcompressor::state::get_len2_match_cost(CLZBase& lzbase, uint /*dict_pos*/, uint len2_match_dist, uint is_match_model_index) { /*dict_pos;*/ bit_cost_t cost = m_is_match_model[is_match_model_index].get_cost(1); cost += m_is_rep_model[m_cur_state].get_cost(0); // full match uint match_slot, match_extra; lzbase.compute_lzx_position_slot(len2_match_dist, match_slot, match_extra); const uint match_len = 2; uint match_low_sym = match_len - 2; uint match_high_sym = 0; LZHAM_ASSERT(match_slot >= CLZBase::cLZXLowestUsableMatchSlot && (match_slot < lzbase.m_num_lzx_slots)); match_high_sym = match_slot - CLZBase::cLZXLowestUsableMatchSlot; uint main_sym = match_low_sym | (match_high_sym << 3); cost += m_main_table.get_cost(CLZBase::cLZXNumSpecialLengths + main_sym); uint num_extra_bits = lzbase.m_lzx_position_extra_bits[match_slot]; if (num_extra_bits < 3) cost += convert_to_scaled_bitcost(num_extra_bits); else { if (num_extra_bits > 4) cost += convert_to_scaled_bitcost(num_extra_bits - 4); cost += m_dist_lsb_table.get_cost(match_extra & 15); } return cost; } bit_cost_t lzcompressor::state::get_lit_cost(const search_accelerator& dict, uint dict_pos, uint lit_pred0, uint is_match_model_index) const { bit_cost_t cost = m_is_match_model[is_match_model_index].get_cost(0); const uint lit = dict[dict_pos]; if (m_cur_state < CLZBase::cNumLitStates) { // literal const uint lit_pred1 = get_pred_char(dict, dict_pos, 2); uint lit_pred = (lit_pred0 >> (8 - CLZBase::cNumLitPredBits/2)) | (((lit_pred1 >> (8 - CLZBase::cNumLitPredBits/2)) << CLZBase::cNumLitPredBits/2)); cost += m_lit_table[lit_pred].get_cost(lit); } else { // delta literal const uint rep_lit0 = dict[(dict_pos - m_match_hist[0]) & dict.m_max_dict_size_mask]; const uint rep_lit1 = dict[(dict_pos - m_match_hist[0] - 1) & dict.m_max_dict_size_mask]; uint delta_lit = rep_lit0 ^ lit; uint lit_pred = (rep_lit0 >> (8 - CLZBase::cNumDeltaLitPredBits/2)) | ((rep_lit1 >> (8 - CLZBase::cNumDeltaLitPredBits/2)) << CLZBase::cNumDeltaLitPredBits/2); cost += m_delta_lit_table[lit_pred].get_cost(delta_lit); } return cost; } void lzcompressor::state::get_rep_match_costs(uint /*dict_pos*/, bit_cost_t *pBitcosts, uint match_hist_index, int min_len, int max_len, uint is_match_model_index) const { /*dict_pos*/; // match const sym_data_model &rep_len_table = m_rep_len_table[m_cur_state >= CLZBase::cNumLitStates]; bit_cost_t base_cost = m_is_match_model[is_match_model_index].get_cost(1); base_cost += m_is_rep_model[m_cur_state].get_cost(1); if (!match_hist_index) { // rep0 match base_cost += m_is_rep0_model[m_cur_state].get_cost(1); } else { // rep1-rep3 matches base_cost += m_is_rep0_model[m_cur_state].get_cost(0); if (match_hist_index == 1) { // rep1 base_cost += m_is_rep1_model[m_cur_state].get_cost(1); } else { base_cost += m_is_rep1_model[m_cur_state].get_cost(0); if (match_hist_index == 2) { // rep2 base_cost += m_is_rep2_model[m_cur_state].get_cost(1); } else { // rep3 base_cost += m_is_rep2_model[m_cur_state].get_cost(0); } } } // rep match if (!match_hist_index) { if (min_len == 1) { // single byte rep0 pBitcosts[1] = base_cost + m_is_rep0_single_byte_model[m_cur_state].get_cost(1); min_len++; } bit_cost_t rep0_match_base_cost = base_cost + m_is_rep0_single_byte_model[m_cur_state].get_cost(0); for (int match_len = min_len; match_len <= max_len; match_len++) { // normal rep0 if (match_len > CLZBase::cMaxMatchLen) { pBitcosts[match_len] = get_huge_match_code_len(match_len) + rep0_match_base_cost + rep_len_table.get_cost((CLZBase::cMaxMatchLen + 1) - CLZBase::cMinMatchLen); } else { pBitcosts[match_len] = rep0_match_base_cost + rep_len_table.get_cost(match_len - CLZBase::cMinMatchLen); } } } else { for (int match_len = min_len; match_len <= max_len; match_len++) { if (match_len > CLZBase::cMaxMatchLen) { pBitcosts[match_len] = get_huge_match_code_len(match_len) + base_cost + rep_len_table.get_cost((CLZBase::cMaxMatchLen + 1) - CLZBase::cMinMatchLen); } else { pBitcosts[match_len] = base_cost + rep_len_table.get_cost(match_len - CLZBase::cMinMatchLen); } } } } void lzcompressor::state::get_full_match_costs(CLZBase& lzbase, uint /*dict_pos*/, bit_cost_t *pBitcosts, uint match_dist, int min_len, int max_len, uint is_match_model_index) const { /*dict_pos;*/ LZHAM_ASSERT(min_len >= CLZBase::cMinMatchLen); bit_cost_t cost = m_is_match_model[is_match_model_index].get_cost(1); cost += m_is_rep_model[m_cur_state].get_cost(0); uint match_slot, match_extra; lzbase.compute_lzx_position_slot(match_dist, match_slot, match_extra); LZHAM_ASSERT(match_slot >= CLZBase::cLZXLowestUsableMatchSlot && (match_slot < lzbase.m_num_lzx_slots)); uint num_extra_bits = lzbase.m_lzx_position_extra_bits[match_slot]; if (num_extra_bits < 3) cost += convert_to_scaled_bitcost(num_extra_bits); else { if (num_extra_bits > 4) cost += convert_to_scaled_bitcost(num_extra_bits - 4); cost += m_dist_lsb_table.get_cost(match_extra & 15); } uint match_high_sym = match_slot - CLZBase::cLZXLowestUsableMatchSlot; const sym_data_model &large_len_table = m_large_len_table[m_cur_state >= CLZBase::cNumLitStates]; for (int match_len = min_len; match_len <= max_len; match_len++) { bit_cost_t len_cost = cost; uint match_low_sym = 0; if (match_len >= 9) { match_low_sym = 7; if (match_len > CLZBase::cMaxMatchLen) { len_cost += get_huge_match_code_len(match_len) + large_len_table.get_cost((CLZBase::cMaxMatchLen + 1) - 9); } else { len_cost += large_len_table.get_cost(match_len - 9); } } else match_low_sym = match_len - 2; uint main_sym = match_low_sym | (match_high_sym << 3); pBitcosts[match_len] = len_cost + m_main_table.get_cost(CLZBase::cLZXNumSpecialLengths + main_sym); } } bool lzcompressor::state::advance(CLZBase& lzbase, const search_accelerator& dict, const lzdecision& lzdec) { const uint lit_pred0 = get_pred_char(dict, lzdec.m_pos, 1); uint is_match_model_index = LZHAM_IS_MATCH_MODEL_INDEX(lit_pred0, m_cur_state); m_is_match_model[is_match_model_index].update(lzdec.is_match()); if (!lzdec.is_match()) { const uint lit = dict[lzdec.m_pos]; if (m_cur_state < CLZBase::cNumLitStates) { const uint lit_pred1 = get_pred_char(dict, lzdec.m_pos, 2); uint lit_pred = (lit_pred0 >> (8 - CLZBase::cNumLitPredBits/2)) | (((lit_pred1 >> (8 - CLZBase::cNumLitPredBits/2)) << CLZBase::cNumLitPredBits/2)); // literal if (!m_lit_table[lit_pred].update(lit)) return false; } else { // delta literal const uint rep_lit0 = dict[(lzdec.m_pos - m_match_hist[0]) & dict.m_max_dict_size_mask]; const uint rep_lit1 = dict[(lzdec.m_pos - m_match_hist[0] - 1) & dict.m_max_dict_size_mask]; uint delta_lit = rep_lit0 ^ lit; uint lit_pred = (rep_lit0 >> (8 - CLZBase::cNumDeltaLitPredBits/2)) | ((rep_lit1 >> (8 - CLZBase::cNumDeltaLitPredBits/2)) << CLZBase::cNumDeltaLitPredBits/2); if (!m_delta_lit_table[lit_pred].update(delta_lit)) return false; } if (m_cur_state < 4) m_cur_state = 0; else if (m_cur_state < 10) m_cur_state -= 3; else m_cur_state -= 6; } else { // match if (lzdec.m_dist < 0) { // rep match m_is_rep_model[m_cur_state].update(1); int match_hist_index = -lzdec.m_dist - 1; if (!match_hist_index) { // rep0 match m_is_rep0_model[m_cur_state].update(1); if (lzdec.m_len == 1) { // single byte rep0 m_is_rep0_single_byte_model[m_cur_state].update(1); m_cur_state = (m_cur_state < CLZBase::cNumLitStates) ? 9 : 11; } else { // normal rep0 m_is_rep0_single_byte_model[m_cur_state].update(0); if (lzdec.m_len > CLZBase::cMaxMatchLen) { if (!m_rep_len_table[m_cur_state >= CLZBase::cNumLitStates].update((CLZBase::cMaxMatchLen + 1) - CLZBase::cMinMatchLen)) return false; } else { if (!m_rep_len_table[m_cur_state >= CLZBase::cNumLitStates].update(lzdec.m_len - CLZBase::cMinMatchLen)) return false; } m_cur_state = (m_cur_state < CLZBase::cNumLitStates) ? 8 : 11; } } else { // rep1-rep3 match m_is_rep0_model[m_cur_state].update(0); if (lzdec.m_len > CLZBase::cMaxMatchLen) { if (!m_rep_len_table[m_cur_state >= CLZBase::cNumLitStates].update((CLZBase::cMaxMatchLen + 1) - CLZBase::cMinMatchLen)) return false; } else { if (!m_rep_len_table[m_cur_state >= CLZBase::cNumLitStates].update(lzdec.m_len - CLZBase::cMinMatchLen)) return false; } if (match_hist_index == 1) { // rep1 m_is_rep1_model[m_cur_state].update(1); std::swap(m_match_hist[0], m_match_hist[1]); } else { m_is_rep1_model[m_cur_state].update(0); if (match_hist_index == 2) { // rep2 m_is_rep2_model[m_cur_state].update(1); int dist = m_match_hist[2]; m_match_hist[2] = m_match_hist[1]; m_match_hist[1] = m_match_hist[0]; m_match_hist[0] = dist; } else { // rep3 m_is_rep2_model[m_cur_state].update(0); int dist = m_match_hist[3]; m_match_hist[3] = m_match_hist[2]; m_match_hist[2] = m_match_hist[1]; m_match_hist[1] = m_match_hist[0]; m_match_hist[0] = dist; } } m_cur_state = (m_cur_state < CLZBase::cNumLitStates) ? 8 : 11; } } else { m_is_rep_model[m_cur_state].update(0); LZHAM_ASSERT(lzdec.m_len >= CLZBase::cMinMatchLen); // full match uint match_slot, match_extra; lzbase.compute_lzx_position_slot(lzdec.m_dist, match_slot, match_extra); uint match_low_sym = 0; int large_len_sym = -1; if (lzdec.m_len >= 9) { match_low_sym = 7; large_len_sym = lzdec.m_len - 9; } else match_low_sym = lzdec.m_len - 2; uint match_high_sym = 0; LZHAM_ASSERT(match_slot >= CLZBase::cLZXLowestUsableMatchSlot && (match_slot < lzbase.m_num_lzx_slots)); match_high_sym = match_slot - CLZBase::cLZXLowestUsableMatchSlot; uint main_sym = match_low_sym | (match_high_sym << 3); if (!m_main_table.update(CLZBase::cLZXNumSpecialLengths + main_sym)) return false; if (large_len_sym >= 0) { if (lzdec.m_len > CLZBase::cMaxMatchLen) { if (!m_large_len_table[m_cur_state >= CLZBase::cNumLitStates].update((CLZBase::cMaxMatchLen + 1) - 9)) return false; } else { if (!m_large_len_table[m_cur_state >= CLZBase::cNumLitStates].update(large_len_sym)) return false; } } uint num_extra_bits = lzbase.m_lzx_position_extra_bits[match_slot]; if (num_extra_bits >= 3) { if (!m_dist_lsb_table.update(match_extra & 15)) return false; } update_match_hist(lzdec.m_dist); m_cur_state = (m_cur_state < CLZBase::cNumLitStates) ? CLZBase::cNumLitStates : CLZBase::cNumLitStates + 3; } } m_cur_ofs = lzdec.m_pos + lzdec.get_len(); return true; } bool lzcompressor::state::encode(symbol_codec& codec, CLZBase& lzbase, const search_accelerator& dict, const lzdecision& lzdec) { const uint lit_pred0 = get_pred_char(dict, lzdec.m_pos, 1); uint is_match_model_index = LZHAM_IS_MATCH_MODEL_INDEX(lit_pred0, m_cur_state); if (!codec.encode(lzdec.is_match(), m_is_match_model[is_match_model_index])) return false; if (!lzdec.is_match()) { const uint lit = dict[lzdec.m_pos]; #ifdef LZHAM_LZDEBUG if (!codec.encode_bits(lit, 8)) return false; #endif if (m_cur_state < CLZBase::cNumLitStates) { const uint lit_pred1 = get_pred_char(dict, lzdec.m_pos, 2); uint lit_pred = (lit_pred0 >> (8 - CLZBase::cNumLitPredBits/2)) | (((lit_pred1 >> (8 - CLZBase::cNumLitPredBits/2)) << CLZBase::cNumLitPredBits/2)); // literal if (!codec.encode(lit, m_lit_table[lit_pred])) return false; } else { // delta literal const uint rep_lit0 = dict[(lzdec.m_pos - m_match_hist[0]) & dict.m_max_dict_size_mask]; const uint rep_lit1 = dict[(lzdec.m_pos - m_match_hist[0] - 1) & dict.m_max_dict_size_mask]; uint delta_lit = rep_lit0 ^ lit; uint lit_pred = (rep_lit0 >> (8 - CLZBase::cNumDeltaLitPredBits/2)) | ((rep_lit1 >> (8 - CLZBase::cNumDeltaLitPredBits/2)) << CLZBase::cNumDeltaLitPredBits/2); #ifdef LZHAM_LZDEBUG if (!codec.encode_bits(rep_lit0, 8)) return false; #endif if (!codec.encode(delta_lit, m_delta_lit_table[lit_pred])) return false; } if (m_cur_state < 4) m_cur_state = 0; else if (m_cur_state < 10) m_cur_state -= 3; else m_cur_state -= 6; } else { // match if (lzdec.m_dist < 0) { // rep match if (!codec.encode(1, m_is_rep_model[m_cur_state])) return false; int match_hist_index = -lzdec.m_dist - 1; if (!match_hist_index) { // rep0 match if (!codec.encode(1, m_is_rep0_model[m_cur_state])) return false; if (lzdec.m_len == 1) { // single byte rep0 if (!codec.encode(1, m_is_rep0_single_byte_model[m_cur_state])) return false; m_cur_state = (m_cur_state < CLZBase::cNumLitStates) ? 9 : 11; } else { // normal rep0 if (!codec.encode(0, m_is_rep0_single_byte_model[m_cur_state])) return false; if (lzdec.m_len > CLZBase::cMaxMatchLen) { if (!codec.encode((CLZBase::cMaxMatchLen + 1) - CLZBase::cMinMatchLen, m_rep_len_table[m_cur_state >= CLZBase::cNumLitStates])) return false; if (!codec.encode_bits(get_huge_match_code_bits(lzdec.m_len), get_huge_match_code_len(lzdec.m_len))) return false; } else { if (!codec.encode(lzdec.m_len - CLZBase::cMinMatchLen, m_rep_len_table[m_cur_state >= CLZBase::cNumLitStates])) return false; } m_cur_state = (m_cur_state < CLZBase::cNumLitStates) ? 8 : 11; } } else { // rep1-rep3 match if (!codec.encode(0, m_is_rep0_model[m_cur_state])) return false; if (lzdec.m_len > CLZBase::cMaxMatchLen) { if (!codec.encode((CLZBase::cMaxMatchLen + 1) - CLZBase::cMinMatchLen, m_rep_len_table[m_cur_state >= CLZBase::cNumLitStates])) return false; if (!codec.encode_bits(get_huge_match_code_bits(lzdec.m_len), get_huge_match_code_len(lzdec.m_len))) return false; } else { if (!codec.encode(lzdec.m_len - CLZBase::cMinMatchLen, m_rep_len_table[m_cur_state >= CLZBase::cNumLitStates])) return false; } if (match_hist_index == 1) { // rep1 if (!codec.encode(1, m_is_rep1_model[m_cur_state])) return false; std::swap(m_match_hist[0], m_match_hist[1]); } else { if (!codec.encode(0, m_is_rep1_model[m_cur_state])) return false; if (match_hist_index == 2) { // rep2 if (!codec.encode(1, m_is_rep2_model[m_cur_state])) return false; int dist = m_match_hist[2]; m_match_hist[2] = m_match_hist[1]; m_match_hist[1] = m_match_hist[0]; m_match_hist[0] = dist; } else { // rep3 if (!codec.encode(0, m_is_rep2_model[m_cur_state])) return false; int dist = m_match_hist[3]; m_match_hist[3] = m_match_hist[2]; m_match_hist[2] = m_match_hist[1]; m_match_hist[1] = m_match_hist[0]; m_match_hist[0] = dist; } } m_cur_state = (m_cur_state < CLZBase::cNumLitStates) ? 8 : 11; } } else { if (!codec.encode(0, m_is_rep_model[m_cur_state])) return false; LZHAM_ASSERT(lzdec.m_len >= CLZBase::cMinMatchLen); // full match uint match_slot, match_extra; lzbase.compute_lzx_position_slot(lzdec.m_dist, match_slot, match_extra); uint match_low_sym = 0; int large_len_sym = -1; if (lzdec.m_len >= 9) { match_low_sym = 7; large_len_sym = lzdec.m_len - 9; } else match_low_sym = lzdec.m_len - 2; uint match_high_sym = 0; LZHAM_ASSERT(match_slot >= CLZBase::cLZXLowestUsableMatchSlot && (match_slot < lzbase.m_num_lzx_slots)); match_high_sym = match_slot - CLZBase::cLZXLowestUsableMatchSlot; uint main_sym = match_low_sym | (match_high_sym << 3); if (!codec.encode(CLZBase::cLZXNumSpecialLengths + main_sym, m_main_table)) return false; if (large_len_sym >= 0) { if (lzdec.m_len > CLZBase::cMaxMatchLen) { if (!codec.encode((CLZBase::cMaxMatchLen + 1) - 9, m_large_len_table[m_cur_state >= CLZBase::cNumLitStates])) return false; if (!codec.encode_bits(get_huge_match_code_bits(lzdec.m_len), get_huge_match_code_len(lzdec.m_len))) return false; } else { if (!codec.encode(large_len_sym, m_large_len_table[m_cur_state >= CLZBase::cNumLitStates])) return false; } } uint num_extra_bits = lzbase.m_lzx_position_extra_bits[match_slot]; if (num_extra_bits < 3) { if (!codec.encode_bits(match_extra, num_extra_bits)) return false; } else { if (num_extra_bits > 4) { if (!codec.encode_bits((match_extra >> 4), num_extra_bits - 4)) return false; } if (!codec.encode(match_extra & 15, m_dist_lsb_table)) return false; } update_match_hist(lzdec.m_dist); m_cur_state = (m_cur_state < CLZBase::cNumLitStates) ? CLZBase::cNumLitStates : CLZBase::cNumLitStates + 3; } #ifdef LZHAM_LZDEBUG if (!codec.encode_bits(m_match_hist[0], 29)) return false; #endif } m_cur_ofs = lzdec.m_pos + lzdec.get_len(); return true; } void lzcompressor::state::print(symbol_codec& /*codec*/, CLZBase& lzbase, const search_accelerator& dict, const lzdecision& lzdec) { //codec, lzbase, dict; const uint lit_pred0 = get_pred_char(dict, lzdec.m_pos, 1); uint is_match_model_index = LZHAM_IS_MATCH_MODEL_INDEX(lit_pred0, m_cur_state); printf(" pos: %u, state: %u, match_pred: %u, is_match_model_index: %u, is_match: %u, cost: %f\n", lzdec.m_pos, m_cur_state, lit_pred0, is_match_model_index, lzdec.is_match(), get_cost(lzbase, dict, lzdec) / (float)cBitCostScale); if (!lzdec.is_match()) { const uint lit = dict[lzdec.m_pos]; if (m_cur_state < CLZBase::cNumLitStates) { const uint lit_pred1 = get_pred_char(dict, lzdec.m_pos, 2); uint lit_pred = (lit_pred0 >> (8 - CLZBase::cNumLitPredBits/2)) | (((lit_pred1 >> (8 - CLZBase::cNumLitPredBits/2)) << CLZBase::cNumLitPredBits/2)); printf("---Regular lit: %u '%c', lit_pred: %u '%c'\n", lit, ((lit >= 32) && (lit <= 127)) ? lit : '.', lit_pred, ((lit_pred >= 32) && (lit_pred <= 127)) ? lit_pred : '.'); } else { // delta literal const uint rep_lit0 = dict[(lzdec.m_pos - m_match_hist[0]) & dict.m_max_dict_size_mask]; const uint rep_lit1 = dict[(lzdec.m_pos - m_match_hist[0] - 1) & dict.m_max_dict_size_mask]; uint delta_lit = rep_lit0 ^ lit; uint lit_pred = (rep_lit0 >> (8 - CLZBase::cNumDeltaLitPredBits/2)) | ((rep_lit1 >> (8 - CLZBase::cNumDeltaLitPredBits/2)) << CLZBase::cNumDeltaLitPredBits/2); printf("***Delta lit: %u '%c', Mismatch: %u '%c', Delta: 0x%02X, lit_pred: %u\n", lit, ((lit >= 32) && (lit <= 127)) ? lit : '.', rep_lit0, ((rep_lit0 >= 32) && (rep_lit0 <= 127)) ? rep_lit0 : '.', delta_lit, lit_pred); } } else { uint actual_match_len = dict.get_match_len(0, lzdec.get_match_dist(*this), CLZBase::cMaxMatchLen); LZHAM_ASSERT(actual_match_len >= lzdec.get_len()); // match if (lzdec.m_dist < 0) { int match_hist_index = -lzdec.m_dist - 1; if (!match_hist_index) { if (lzdec.m_len == 1) { printf("!!!Rep 0 len1\n"); } else { printf("!!!Rep 0 full len %u\n", lzdec.m_len); } } else { printf("!!!Rep %u full len %u\n", match_hist_index, lzdec.m_len); } } else { LZHAM_ASSERT(lzdec.m_len >= CLZBase::cMinMatchLen); // full match uint match_slot, match_extra; lzbase.compute_lzx_position_slot(lzdec.m_dist, match_slot, match_extra); uint match_low_sym = 0; int large_len_sym = -1; if (lzdec.m_len >= 9) { match_low_sym = 7; large_len_sym = lzdec.m_len - 9; } else match_low_sym = lzdec.m_len - 2; uint match_high_sym = 0; LZHAM_ASSERT(match_slot >= CLZBase::cLZXLowestUsableMatchSlot && (match_slot < lzbase.m_num_lzx_slots)); match_high_sym = match_slot - CLZBase::cLZXLowestUsableMatchSlot; if (match_low_sym) {} if (large_len_sym) {} if (match_high_sym) {} //uint main_sym = match_low_sym | (match_high_sym << 3); uint num_extra_bits = lzbase.m_lzx_position_extra_bits[match_slot]; printf("^^^Full match Len %u Dist %u, Slot %u, ExtraBits: %u", lzdec.m_len, lzdec.m_dist, match_slot, num_extra_bits); if (num_extra_bits < 3) { } else { printf(" (Low 4 bits: %u vs. %u)", lzdec.m_dist & 15, match_extra & 15); } printf("\n"); } if (actual_match_len > lzdec.get_len()) { printf(" TRUNCATED match, actual len is %u, shortened by %u\n", actual_match_len, actual_match_len - lzdec.get_len()); } } } bool lzcompressor::state::encode_eob(symbol_codec& codec, const search_accelerator& dict, uint dict_pos) { #ifdef LZHAM_LZDEBUG if (!codec.encode_bits(CLZBase::cLZHAMDebugSyncMarkerValue, CLZBase::cLZHAMDebugSyncMarkerBits)) return false; if (!codec.encode_bits(1, 1)) return false; if (!codec.encode_bits(0, 17)) return false; if (!codec.encode_bits(m_cur_state, 4)) return false; #endif const uint match_pred = get_pred_char(dict, dict_pos, 1); uint is_match_model_index = LZHAM_IS_MATCH_MODEL_INDEX(match_pred, m_cur_state); if (!codec.encode(1, m_is_match_model[is_match_model_index])) return false; // full match if (!codec.encode(0, m_is_rep_model[m_cur_state])) return false; return codec.encode(CLZBase::cLZXSpecialCodeEndOfBlockCode, m_main_table); } bool lzcompressor::state::encode_reset_state_partial(symbol_codec& codec, const search_accelerator& dict, uint dict_pos) { #ifdef LZHAM_LZDEBUG if (!codec.encode_bits(CLZBase::cLZHAMDebugSyncMarkerValue, CLZBase::cLZHAMDebugSyncMarkerBits)) return false; if (!codec.encode_bits(1, 1)) return false; if (!codec.encode_bits(0, 17)) return false; if (!codec.encode_bits(m_cur_state, 4)) return false; #endif const uint match_pred = get_pred_char(dict, dict_pos, 1); uint is_match_model_index = LZHAM_IS_MATCH_MODEL_INDEX(match_pred, m_cur_state); if (!codec.encode(1, m_is_match_model[is_match_model_index])) return false; // full match if (!codec.encode(0, m_is_rep_model[m_cur_state])) return false; if (!codec.encode(CLZBase::cLZXSpecialCodePartialStateReset, m_main_table)) return false; reset_state_partial(); return true; } void lzcompressor::state::update_match_hist(uint match_dist) { LZHAM_ASSUME(CLZBase::cMatchHistSize == 4); m_match_hist[3] = m_match_hist[2]; m_match_hist[2] = m_match_hist[1]; m_match_hist[1] = m_match_hist[0]; m_match_hist[0] = match_dist; } int lzcompressor::state::find_match_dist(uint match_dist) const { for (uint match_hist_index = 0; match_hist_index < CLZBase::cMatchHistSize; match_hist_index++) if (match_dist == m_match_hist[match_hist_index]) return match_hist_index; return -1; } void lzcompressor::state::reset_state_partial() { LZHAM_ASSUME(CLZBase::cMatchHistSize == 4); m_match_hist[0] = 1; m_match_hist[1] = 1; m_match_hist[2] = 1; m_match_hist[3] = 1; m_cur_state = 0; } void lzcompressor::state::start_of_block(const search_accelerator& /*dict*/, uint cur_ofs, uint /*block_index*/) { //dict, block_index; reset_state_partial(); m_cur_ofs = cur_ofs; m_block_start_dict_ofs = cur_ofs; } void lzcompressor::state::reset_update_rate() { for (uint i = 0; i < LZHAM_ARRAY_SIZE(m_lit_table); i++) m_lit_table[i].reset_update_rate(); for (uint i = 0; i < LZHAM_ARRAY_SIZE(m_delta_lit_table); i++) m_delta_lit_table[i].reset_update_rate(); m_main_table.reset_update_rate(); for (uint i = 0; i < LZHAM_ARRAY_SIZE(m_rep_len_table); i++) m_rep_len_table[i].reset_update_rate(); for (uint i = 0; i < LZHAM_ARRAY_SIZE(m_large_len_table); i++) m_large_len_table[i].reset_update_rate(); m_dist_lsb_table.reset_update_rate(); } void lzcompressor::coding_stats::clear() { m_total_bytes = 0; m_total_contexts = 0; m_total_match_bits_cost = 0; m_worst_match_bits_cost = 0; m_total_is_match0_bits_cost = 0; m_total_is_match1_bits_cost = 0; m_context_stats.clear(); m_total_nonmatches = 0; m_total_matches = 0; m_total_cost = 0.0f; m_lit_stats.clear(); m_delta_lit_stats.clear(); m_rep0_len1_stats.clear(); for (uint i = 0; i < CLZBase::cMatchHistSize; i++) m_rep_stats[i].clear(); m_rep0_len1_stats.clear(); m_rep0_len2_plus_stats.clear(); for (uint i = 0; i <= CLZBase::cMaxMatchLen; i++) m_full_match_stats[i].clear(); m_total_far_len2_matches = 0; m_total_near_len2_matches = 0; m_total_truncated_matches = 0; utils::zero_object(m_match_truncation_len_hist); utils::zero_object(m_match_truncation_hist); utils::zero_object(m_match_type_truncation_hist); utils::zero_object(m_match_type_was_not_truncated_hist); m_total_update_rate_resets = 0; m_max_len2_dist = 0; } void lzcompressor::coding_stats::print() { if (!m_total_contexts) return; printf("-----------\n"); printf("Coding statistics:\n"); printf("Total update rate resets: %u\n", m_total_update_rate_resets); printf("Total Bytes: %u, Total Contexts: %u, Total Cost: %f bits (%f bytes)\nContext ave cost: %f StdDev: %f Min: %f Max: %f\n", m_total_bytes, m_total_contexts, m_total_cost, m_total_cost / 8.0f, m_context_stats.get_average(), m_context_stats.get_std_dev(), m_context_stats.get_min_val(), m_context_stats.get_max_val()); printf("Ave bytes per context: %f\n", m_total_bytes / (float)m_total_contexts); printf("IsMatch:\n"); printf(" Total: %u, Cost: %f (%f bytes), Ave. Cost: %f, Worst Cost: %f\n", m_total_contexts, m_total_match_bits_cost, m_total_match_bits_cost / 8.0f, m_total_match_bits_cost / math::maximum<uint>(1, m_total_contexts), m_worst_match_bits_cost); printf(" IsMatch(0): %u, Cost: %f (%f bytes), Ave. Cost: %f\n", m_total_nonmatches, m_total_is_match0_bits_cost, m_total_is_match0_bits_cost / 8.0f, m_total_is_match0_bits_cost / math::maximum<uint>(1, m_total_nonmatches)); printf(" IsMatch(1): %u, Cost: %f (%f bytes), Ave. Cost: %f\n", m_total_matches, m_total_is_match1_bits_cost, m_total_is_match1_bits_cost / 8.0f, m_total_is_match1_bits_cost / math::maximum<uint>(1, m_total_matches)); printf("Literal stats:\n"); printf(" Count: %u, Cost: %f (%f bytes), Ave: %f StdDev: %f Min: %f Max: %f\n", m_lit_stats.get_number_of_values32(), m_lit_stats.get_total(), m_lit_stats.get_total() / 8.0f, m_lit_stats.get_average(), m_lit_stats.get_std_dev(), m_lit_stats.get_min_val(), m_lit_stats.get_max_val()); printf("Delta literal stats:\n"); printf(" Count: %u, Cost: %f (%f bytes), Ave: %f StdDev: %f Min: %f Max: %f\n", m_delta_lit_stats.get_number_of_values32(), m_delta_lit_stats.get_total(), m_delta_lit_stats.get_total() / 8.0f, m_delta_lit_stats.get_average(), m_delta_lit_stats.get_std_dev(), m_delta_lit_stats.get_min_val(), m_delta_lit_stats.get_max_val()); printf("Rep0 Len1 stats:\n"); printf(" Count: %u, Cost: %f (%f bytes), Ave. Cost: %f StdDev: %f Min: %f Max: %f\n", m_rep0_len1_stats.get_number_of_values32(), m_rep0_len1_stats.get_total(), m_rep0_len1_stats.get_total() / 8.0f, m_rep0_len1_stats.get_average(), m_rep0_len1_stats.get_std_dev(), m_rep0_len1_stats.get_min_val(), m_rep0_len1_stats.get_max_val()); printf("Rep0 Len2+ stats:\n"); printf(" Count: %u, Cost: %f (%f bytes), Ave. Cost: %f StdDev: %f Min: %f Max: %f\n", m_rep0_len2_plus_stats.get_number_of_values32(), m_rep0_len2_plus_stats.get_total(), m_rep0_len2_plus_stats.get_total() / 8.0f, m_rep0_len2_plus_stats.get_average(), m_rep0_len2_plus_stats.get_std_dev(), m_rep0_len2_plus_stats.get_min_val(), m_rep0_len2_plus_stats.get_max_val()); for (uint i = 0; i < CLZBase::cMatchHistSize; i++) { printf("Rep %u stats:\n", i); printf(" Count: %u, Cost: %f (%f bytes), Ave. Cost: %f StdDev: %f Min: %f Max: %f\n", m_rep_stats[i].get_number_of_values32(), m_rep_stats[i].get_total(), m_rep_stats[i].get_total() / 8.0f, m_rep_stats[i].get_average(), m_rep_stats[i].get_std_dev(), m_rep_stats[i].get_min_val(), m_rep_stats[i].get_max_val()); } for (uint i = CLZBase::cMinMatchLen; i <= CLZBase::cMaxMatchLen; i++) { printf("Match %u: Total: %u, Cost: %f (%f bytes), Ave: %f StdDev: %f Min: %f Max: %f\n", i, m_full_match_stats[i].get_number_of_values32(), m_full_match_stats[i].get_total(), m_full_match_stats[i].get_total() / 8.0f, m_full_match_stats[i].get_average(), m_full_match_stats[i].get_std_dev(), m_full_match_stats[i].get_min_val(), m_full_match_stats[i].get_max_val()); } printf("Total near len2 matches: %u, total far len2 matches: %u\n", m_total_near_len2_matches, m_total_far_len2_matches); printf("Total matches: %u, truncated matches: %u\n", m_total_matches, m_total_truncated_matches); printf("Max full match len2 distance: %u\n", m_max_len2_dist); #if 0 printf("Size of truncation histogram:\n"); for (uint i = 0; i <= CLZBase::cMaxMatchLen; i++) { printf("%05u ", m_match_truncation_len_hist[i]); if ((i & 15) == 15) printf("\n"); } printf("\n"); printf("Number of truncations per encoded match length histogram:\n"); for (uint i = 0; i <= CLZBase::cMaxMatchLen; i++) { printf("%05u ", m_match_truncation_hist[i]); if ((i & 15) == 15) printf("\n"); } printf("\n"); for (uint s = 0; s < CLZBase::cNumStates; s++) { printf("-- Match type truncation hist for state %u:\n", s); for (uint i = 0; i < LZHAM_ARRAY_SIZE(m_match_type_truncation_hist[s]); i++) { printf("%u truncated (%3.1f%%), %u not truncated\n", m_match_type_truncation_hist[s][i], 100.0f * (float)m_match_type_truncation_hist[s][i] / (m_match_type_truncation_hist[s][i] + m_match_type_was_not_truncated_hist[s][i]), m_match_type_was_not_truncated_hist[s][i]); } } #endif } void lzcompressor::coding_stats::update(const lzdecision& lzdec, const state& cur_state, const search_accelerator& dict, bit_cost_t cost) { m_total_bytes += lzdec.get_len(); m_total_contexts++; float cost_in_bits = cost / (float)cBitCostScale; LZHAM_ASSERT(cost_in_bits > 0.0f); m_total_cost += cost_in_bits; m_context_stats.update(cost_in_bits); uint match_pred = cur_state.get_pred_char(dict, lzdec.m_pos, 1); uint is_match_model_index = LZHAM_IS_MATCH_MODEL_INDEX(match_pred, cur_state.m_cur_state); if (lzdec.m_len == 0) { float match_bit_cost = cur_state.m_is_match_model[is_match_model_index].get_cost(0) / (float)cBitCostScale; m_total_is_match0_bits_cost += match_bit_cost; m_total_match_bits_cost += match_bit_cost; m_worst_match_bits_cost = math::maximum<double>(m_worst_match_bits_cost, static_cast<double>(match_bit_cost)); m_total_nonmatches++; if (cur_state.m_cur_state < CLZBase::cNumLitStates) { m_lit_stats.update(cost_in_bits); } else { m_delta_lit_stats.update(cost_in_bits); } } else if (lzdec.m_len <= CLZBase::cMaxMatchLen) { const uint match_len = lzdec.get_len(); { uint match_dist = lzdec.get_match_dist(cur_state); uint cur_lookahead_size = dict.get_lookahead_size(); uint actual_match_len = dict.get_match_len(0, match_dist, LZHAM_MIN(cur_lookahead_size, static_cast<uint>(CLZBase::cMaxMatchLen))); LZHAM_VERIFY(match_len <= actual_match_len); m_total_truncated_matches += match_len < actual_match_len; m_match_truncation_len_hist[math::maximum<int>(0, actual_match_len - match_len)]++; uint type_index = 4; if (!lzdec.is_full_match()) { LZHAM_ASSUME(CLZBase::cMatchHistSize == 4); type_index = -lzdec.m_dist - 1; } if (actual_match_len > match_len) { m_match_truncation_hist[match_len]++; m_match_type_truncation_hist[cur_state.m_cur_state][type_index]++; } else { m_match_type_was_not_truncated_hist[cur_state.m_cur_state][type_index]++; } } float match_bit_cost = cur_state.m_is_match_model[is_match_model_index].get_cost(1) / (float)cBitCostScale; m_total_is_match1_bits_cost += match_bit_cost; m_total_match_bits_cost += match_bit_cost; m_worst_match_bits_cost = math::maximum<double>(m_worst_match_bits_cost, static_cast<double>(match_bit_cost)); m_total_matches++; if (lzdec.m_dist < 0) { // rep match int match_hist_index = -lzdec.m_dist - 1; LZHAM_ASSERT(match_hist_index < CLZBase::cMatchHistSize); m_rep_stats[match_hist_index].update(cost_in_bits); if (!match_hist_index) { // rep0 match if (lzdec.m_len == 1) { m_rep0_len1_stats.update(cost_in_bits); } else { m_rep0_len2_plus_stats.update(cost_in_bits); } } } else { m_full_match_stats[math::minimum<int>(cMaxMatchLen, match_len)].update(cost_in_bits); if (match_len == 2) { if (lzdec.m_dist <= 512) m_total_near_len2_matches++; else m_total_far_len2_matches++; m_max_len2_dist = LZHAM_MAX((int)m_max_len2_dist, lzdec.m_dist); } } } else { // TODO: Handle huge matches. } } } // namespace lzham ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_types.h����������������������������������������������0000644�0001750�0001750�00000005136�12320456500�022234� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: types.h // See Copyright Notice and license at the end of include/lzham.h #pragma once #include <stdint.h> namespace lzham { typedef unsigned char uint8; typedef signed char int8; typedef unsigned char uint8; typedef unsigned short uint16; typedef signed short int16; typedef unsigned int uint32; typedef uint32 uint; typedef signed int int32; typedef uint64_t uint64; typedef int64_t int64; const uint8 LZHAM_UINT8_MIN = 0; const uint8 LZHAM_UINT8_MAX = 0xFFU; const uint16 LZHAM_UINT16_MIN = 0; const uint16 LZHAM_UINT16_MAX = 0xFFFFU; const uint32 LZHAM_UINT32_MIN = 0; const uint32 LZHAM_UINT32_MAX = 0xFFFFFFFFU; const uint64 LZHAM_UINT64_MIN = 0; const uint64 LZHAM_UINT64_MAX = 0xFFFFFFFFFFFFFFFFULL; //0xFFFFFFFFFFFFFFFFui64; const int8 LZHAM_INT8_MIN = -128; const int8 LZHAM_INT8_MAX = 127; const int16 LZHAM_INT16_MIN = -32768; const int16 LZHAM_INT16_MAX = 32767; const int32 LZHAM_INT32_MIN = (-2147483647 - 1); const int32 LZHAM_INT32_MAX = 2147483647; const int64 LZHAM_INT64_MIN = (int64)0x8000000000000000ULL; //(-9223372036854775807i64 - 1); const int64 LZHAM_INT64_MAX = (int64)0x7FFFFFFFFFFFFFFFULL; //9223372036854775807i64; #if LZHAM_64BIT_POINTERS typedef uint64_t uint_ptr; typedef uint64_t uint32_ptr; typedef int64_t signed_size_t; typedef uint64 ptr_bits_t; const ptr_bits_t PTR_BITS_XOR = 0xDB0DD4415C87DCF7ULL; #else typedef unsigned int uint_ptr; typedef unsigned int uint32_ptr; typedef signed int signed_size_t; typedef uint32 ptr_bits_t; const ptr_bits_t PTR_BITS_XOR = 0x5C87DCF7UL; #endif enum { cInvalidIndex = -1 }; const uint cIntBits = sizeof(uint) * CHAR_BIT; template<typename T> struct int_traits { enum { cMin = INT_MIN, cMax = INT_MAX, cSigned = true }; }; template<> struct int_traits<int8> { enum { cMin = LZHAM_INT8_MIN, cMax = LZHAM_INT8_MAX, cSigned = true }; }; template<> struct int_traits<int16> { enum { cMin = LZHAM_INT16_MIN, cMax = LZHAM_INT16_MAX, cSigned = true }; }; template<> struct int_traits<int32> { enum { cMin = LZHAM_INT32_MIN, cMax = LZHAM_INT32_MAX, cSigned = true }; }; template<> struct int_traits<uint> { enum { cMin = 0, cMax = UINT_MAX, cSigned = false }; }; template<> struct int_traits<uint8> { enum { cMin = 0, cMax = LZHAM_UINT8_MAX, cSigned = false }; }; template<> struct int_traits<uint16> { enum { cMin = 0, cMax = LZHAM_UINT16_MAX, cSigned = false }; }; struct empty_type { }; } // namespace lzham ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_lzbase.cpp�������������������������������������������0000644�0001750�0001750�00000003626�12320456500�022705� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: lzham_lzbase.cpp // See Copyright Notice and license at the end of include/lzham.h #include "lzham_core.h" #include "lzham_lzbase.h" namespace lzham { void CLZBase::init_slot_tabs() { for (uint i = 0; i < m_num_lzx_slots; i++) { //printf("%u: 0x%08X - 0x%08X, %u\n", i, m_lzx_position_base[i], m_lzx_position_base[i] + (1 << m_lzx_position_extra_bits[i]) - 1, m_lzx_position_extra_bits[i]); uint lo = m_lzx_position_base[i]; uint hi = lo + m_lzx_position_extra_mask[i]; uint8* pTab; uint shift; uint n; if (hi < 0x1000) { pTab = m_slot_tab0; shift = 0; n = sizeof(m_slot_tab0); } else if (hi < 0x100000) { pTab = m_slot_tab1; shift = 11; n = sizeof(m_slot_tab1); } else if (hi < 0x1000000) { pTab = m_slot_tab2; shift = 16; n = sizeof(m_slot_tab2); } else break; lo >>= shift; hi >>= shift; if (n) {} LZHAM_ASSERT(hi < n); memset(pTab + lo, (uint8)i, hi - lo + 1); } #ifdef LZHAM_BUILD_DEBUG uint slot, ofs; for (uint i = 1; i < m_num_lzx_slots; i++) { compute_lzx_position_slot(m_lzx_position_base[i], slot, ofs); LZHAM_ASSERT(slot == i); compute_lzx_position_slot(m_lzx_position_base[i] + m_lzx_position_extra_mask[i], slot, ofs); LZHAM_ASSERT(slot == i); } for (uint i = 1; i <= (m_dict_size-1); i += 512U*1024U) { compute_lzx_position_slot(i, slot, ofs); LZHAM_ASSERT(i == m_lzx_position_base[slot] + ofs); } compute_lzx_position_slot(m_dict_size - 1, slot, ofs); LZHAM_ASSERT((m_dict_size - 1) == m_lzx_position_base[slot] + ofs); #endif } } //namespace lzham ����������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lzham/lzham_huffman_codes.cpp������������������������������������0000644�0001750�0001750�00000026324�12320456500�024226� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File: huffman_codes.cpp // See Copyright Notice and license at the end of include/lzham.h #include "lzham_core.h" #include "lzham_huffman_codes.h" namespace lzham { struct sym_freq { uint m_freq; uint16 m_left; uint16 m_right; inline bool operator< (const sym_freq& other) const { return m_freq > other.m_freq; } }; static inline sym_freq* radix_sort_syms(uint num_syms, sym_freq* syms0, sym_freq* syms1) { const uint cMaxPasses = 2; uint hist[256 * cMaxPasses]; memset(hist, 0, sizeof(hist[0]) * 256 * cMaxPasses); { sym_freq* p = syms0; sym_freq* q = syms0 + (num_syms >> 1) * 2; for ( ; p != q; p += 2) { const uint freq0 = p[0].m_freq; const uint freq1 = p[1].m_freq; hist[ freq0 & 0xFF]++; hist[256 + ((freq0 >> 8) & 0xFF)]++; hist[ freq1 & 0xFF]++; hist[256 + ((freq1 >> 8) & 0xFF)]++; } if (num_syms & 1) { const uint freq = p->m_freq; hist[ freq & 0xFF]++; hist[256 + ((freq >> 8) & 0xFF)]++; } } sym_freq* pCur_syms = syms0; sym_freq* pNew_syms = syms1; const uint total_passes = (hist[256] == num_syms) ? 1 : cMaxPasses; for (uint pass = 0; pass < total_passes; pass++) { const uint* pHist = &hist[pass << 8]; uint offsets[256]; uint cur_ofs = 0; for (uint i = 0; i < 256; i += 2) { offsets[i] = cur_ofs; cur_ofs += pHist[i]; offsets[i+1] = cur_ofs; cur_ofs += pHist[i+1]; } const uint pass_shift = pass << 3; sym_freq* p = pCur_syms; sym_freq* q = pCur_syms + (num_syms >> 1) * 2; for ( ; p != q; p += 2) { uint c0 = p[0].m_freq; uint c1 = p[1].m_freq; if (pass) { c0 >>= 8; c1 >>= 8; } c0 &= 0xFF; c1 &= 0xFF; if (c0 == c1) { uint dst_offset0 = offsets[c0]; offsets[c0] = dst_offset0 + 2; pNew_syms[dst_offset0] = p[0]; pNew_syms[dst_offset0 + 1] = p[1]; } else { uint dst_offset0 = offsets[c0]++; uint dst_offset1 = offsets[c1]++; pNew_syms[dst_offset0] = p[0]; pNew_syms[dst_offset1] = p[1]; } } if (num_syms & 1) { uint c = ((p->m_freq) >> pass_shift) & 0xFF; uint dst_offset = offsets[c]; offsets[c] = dst_offset + 1; pNew_syms[dst_offset] = *p; } sym_freq* t = pCur_syms; pCur_syms = pNew_syms; pNew_syms = t; } #if LZHAM_ASSERTS_ENABLED uint prev_freq = 0; for (uint i = 0; i < num_syms; i++) { LZHAM_ASSERT(!(pCur_syms[i].m_freq < prev_freq)); prev_freq = pCur_syms[i].m_freq; } #endif return pCur_syms; } struct huffman_work_tables { enum { cMaxInternalNodes = cHuffmanMaxSupportedSyms }; sym_freq syms0[cHuffmanMaxSupportedSyms + 1 + cMaxInternalNodes]; sym_freq syms1[cHuffmanMaxSupportedSyms + 1 + cMaxInternalNodes]; #if !USE_CALCULATE_MINIMUM_REDUNDANCY uint16 queue[cMaxInternalNodes]; #endif }; uint get_generate_huffman_codes_table_size() { return sizeof(huffman_work_tables); } #define USE_CALCULATE_MINIMUM_REDUNDANCY 1 #if USE_CALCULATE_MINIMUM_REDUNDANCY /* calculate_minimum_redundancy() written by Alistair Moffat, alistair@cs.mu.oz.au, Jyrki Katajainen, jyrki@diku.dk November 1996. */ static void calculate_minimum_redundancy(int A[], int n) { int root; /* next root node to be used */ int leaf; /* next leaf to be used */ int next; /* next value to be assigned */ int avbl; /* number of available nodes */ int used; /* number of internal nodes */ int dpth; /* current depth of leaves */ /* check for pathological cases */ if (n==0) { return; } if (n==1) { A[0] = 0; return; } /* first pass, left to right, setting parent pointers */ A[0] += A[1]; root = 0; leaf = 2; for (next=1; next < n-1; next++) { /* select first item for a pairing */ if (leaf>=n || A[root]<A[leaf]) { A[next] = A[root]; A[root++] = next; } else A[next] = A[leaf++]; /* add on the second item */ if (leaf>=n || (root<next && A[root]<A[leaf])) { A[next] += A[root]; A[root++] = next; } else A[next] += A[leaf++]; } /* second pass, right to left, setting internal depths */ A[n-2] = 0; for (next=n-3; next>=0; next--) A[next] = A[A[next]]+1; /* third pass, right to left, setting leaf depths */ avbl = 1; used = dpth = 0; root = n-2; next = n-1; while (avbl>0) { while (root>=0 && A[root]==dpth) { used++; root--; } while (avbl>used) { A[next--] = dpth; avbl--; } avbl = 2*used; dpth++; used = 0; } } #endif bool generate_huffman_codes(void* pContext, uint num_syms, const uint16* pFreq, uint8* pCodesizes, uint& max_code_size, uint& total_freq_ret) { if ((!num_syms) || (num_syms > cHuffmanMaxSupportedSyms)) return false; huffman_work_tables& state = *static_cast<huffman_work_tables*>(pContext);; uint max_freq = 0; uint total_freq = 0; uint num_used_syms = 0; for (uint i = 0; i < num_syms; i++) { uint freq = pFreq[i]; if (!freq) pCodesizes[i] = 0; else { total_freq += freq; max_freq = math::maximum(max_freq, freq); sym_freq& sf = state.syms0[num_used_syms]; sf.m_left = (uint16)i; sf.m_right = LZHAM_UINT16_MAX; sf.m_freq = freq; num_used_syms++; } } total_freq_ret = total_freq; if (num_used_syms == 1) { pCodesizes[state.syms0[0].m_left] = 1; return true; } sym_freq* syms = radix_sort_syms(num_used_syms, state.syms0, state.syms1); #if USE_CALCULATE_MINIMUM_REDUNDANCY int x[cHuffmanMaxSupportedSyms]; for (uint i = 0; i < num_used_syms; i++) x[i] = syms[i].m_freq; calculate_minimum_redundancy(x, num_used_syms); uint max_len = 0; for (uint i = 0; i < num_used_syms; i++) { uint len = x[i]; max_len = math::maximum(len, max_len); pCodesizes[syms[i].m_left] = static_cast<uint8>(len); } max_code_size = max_len; #else // Computes Huffman codelengths in linear time. More readable than calculate_minimum_redundancy(), and approximately the same speed, but not in-place. // Dummy node sym_freq& sf = state.syms0[num_used_syms]; sf.m_left = LZHAM_UINT16_MAX; sf.m_right = LZHAM_UINT16_MAX; sf.m_freq = UINT_MAX; uint next_internal_node = num_used_syms + 1; uint queue_front = 0; uint queue_end = 0; uint next_lowest_sym = 0; uint num_nodes_remaining = num_used_syms; do { uint left_freq = syms[next_lowest_sym].m_freq; uint left_child = next_lowest_sym; if ((queue_end > queue_front) && (syms[state.queue[queue_front]].m_freq < left_freq)) { left_child = state.queue[queue_front]; left_freq = syms[left_child].m_freq; queue_front++; } else next_lowest_sym++; uint right_freq = syms[next_lowest_sym].m_freq; uint right_child = next_lowest_sym; if ((queue_end > queue_front) && (syms[state.queue[queue_front]].m_freq < right_freq)) { right_child = state.queue[queue_front]; right_freq = syms[right_child].m_freq; queue_front++; } else next_lowest_sym++; LZHAM_ASSERT(next_internal_node < huffman_work_tables::cMaxInternalNodes); const uint internal_node_index = next_internal_node; next_internal_node++; syms[internal_node_index].m_freq = left_freq + right_freq; syms[internal_node_index].m_left = static_cast<uint16>(left_child); syms[internal_node_index].m_right = static_cast<uint16>(right_child); LZHAM_ASSERT(queue_end < huffman_work_tables::cMaxInternalNodes); state.queue[queue_end] = static_cast<uint16>(internal_node_index); queue_end++; num_nodes_remaining--; } while (num_nodes_remaining > 1); LZHAM_ASSERT(next_lowest_sym == num_used_syms); LZHAM_ASSERT((queue_end - queue_front) == 1); uint cur_node_index = state.queue[queue_front]; uint32* pStack = (syms == state.syms0) ? (uint32*)state.syms1 : (uint32*)state.syms0; uint32* pStack_top = pStack; uint max_level = 0; for ( ; ; ) { uint level = cur_node_index >> 16; uint node_index = cur_node_index & 0xFFFF; uint left_child = syms[node_index].m_left; uint right_child = syms[node_index].m_right; uint next_level = (cur_node_index + 0x10000) & 0xFFFF0000; if (left_child < num_used_syms) { max_level = math::maximum(max_level, level); pCodesizes[syms[left_child].m_left] = static_cast<uint8>(level + 1); if (right_child < num_used_syms) { pCodesizes[syms[right_child].m_left] = static_cast<uint8>(level + 1); if (pStack == pStack_top) break; cur_node_index = *--pStack; } else { cur_node_index = next_level | right_child; } } else { if (right_child < num_used_syms) { max_level = math::maximum(max_level, level); pCodesizes[syms[right_child].m_left] = static_cast<uint8>(level + 1); cur_node_index = next_level | left_child; } else { *pStack++ = next_level | left_child; cur_node_index = next_level | right_child; } } } max_code_size = max_level + 1; #endif return true; } } // namespace lzham ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/zlib/������������������������������������������������������������0000755�0001750�0001750�00000000000�12320456500�017344� 5����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/zlib/zconf.h�����������������������������������������������������0000644�0001750�0001750�00000022521�12320456500�020636� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* zconf.h -- configuration of the zlib compression library * Copyright (C) 1995-2005 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ #ifndef ZCONF_H #define ZCONF_H /* * If you *really* need a unique prefix for all types and library functions, * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. */ #ifdef Z_PREFIX # define deflateInit_ z_deflateInit_ # define deflate z_deflate # define deflateEnd z_deflateEnd # define inflateInit_ z_inflateInit_ # define inflate z_inflate # define inflateEnd z_inflateEnd # define deflateInit2_ z_deflateInit2_ # define deflateSetDictionary z_deflateSetDictionary # define deflateCopy z_deflateCopy # define deflateReset z_deflateReset # define deflateParams z_deflateParams # define deflateBound z_deflateBound # define deflatePrime z_deflatePrime # define inflateInit2_ z_inflateInit2_ # define inflateSetDictionary z_inflateSetDictionary # define inflateSync z_inflateSync # define inflateSyncPoint z_inflateSyncPoint # define inflateCopy z_inflateCopy # define inflateReset z_inflateReset # define inflateBack z_inflateBack # define inflateBackEnd z_inflateBackEnd # define compress z_compress # define compress2 z_compress2 # define compressBound z_compressBound # define uncompress z_uncompress # define adler32 z_adler32 # define crc32 z_crc32 # define get_crc_table z_get_crc_table # define zError z_zError # define alloc_func z_alloc_func # define free_func z_free_func # define in_func z_in_func # define out_func z_out_func # define Byte z_Byte # define uInt z_uInt # define uLong z_uLong # define Bytef z_Bytef # define charf z_charf # define intf z_intf # define uIntf z_uIntf # define uLongf z_uLongf # define voidpf z_voidpf # define voidp z_voidp #endif #if defined(__MSDOS__) && !defined(MSDOS) # define MSDOS #endif #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) # define OS2 #endif #if defined(_WINDOWS) && !defined(WINDOWS) # define WINDOWS #endif #if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) # ifndef WIN32 # define WIN32 # endif #endif #if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) # if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) # ifndef SYS16BIT # define SYS16BIT # endif # endif #endif /* * Compile with -DMAXSEG_64K if the alloc function cannot allocate more * than 64k bytes at a time (needed on systems with 16-bit int). */ #ifdef SYS16BIT # define MAXSEG_64K #endif #ifdef MSDOS # define UNALIGNED_OK #endif #ifdef __STDC_VERSION__ # ifndef STDC # define STDC # endif # if __STDC_VERSION__ >= 199901L # ifndef STDC99 # define STDC99 # endif # endif #endif #if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) # define STDC #endif #if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) # define STDC #endif #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) # define STDC #endif #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) # define STDC #endif #if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ # define STDC #endif #ifndef STDC # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ # define const /* note: need a more gentle solution here */ # endif #endif /* Some Mac compilers merge all .h files incorrectly: */ #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) # define NO_DUMMY_DECL #endif /* Maximum value for memLevel in deflateInit2 */ #ifndef MAX_MEM_LEVEL # ifdef MAXSEG_64K # define MAX_MEM_LEVEL 8 # else # define MAX_MEM_LEVEL 9 # endif #endif /* Maximum value for windowBits in deflateInit2 and inflateInit2. * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files * created by gzip. (Files created by minigzip can still be extracted by * gzip.) */ #ifndef MAX_WBITS # define MAX_WBITS 15 /* 32K LZ77 window */ #endif /* The memory requirements for deflate are (in bytes): (1 << (windowBits+2)) + (1 << (memLevel+9)) that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) plus a few kilobytes for small objects. For example, if you want to reduce the default memory requirements from 256K to 128K, compile with make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" Of course this will generally degrade compression (there's no free lunch). The memory requirements for inflate are (in bytes) 1 << windowBits that is, 32K for windowBits=15 (default value) plus a few kilobytes for small objects. */ /* Type declarations */ #ifndef OF /* function prototypes */ # ifdef STDC # define OF(args) args # else # define OF(args) () # endif #endif /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, * just define FAR to be empty. */ #ifdef SYS16BIT # if defined(M_I86SM) || defined(M_I86MM) /* MSC small or medium model */ # define SMALL_MEDIUM # ifdef _MSC_VER # define FAR _far # else # define FAR far # endif # endif # if (defined(__SMALL__) || defined(__MEDIUM__)) /* Turbo C small or medium model */ # define SMALL_MEDIUM # ifdef __BORLANDC__ # define FAR _far # else # define FAR far # endif # endif #endif #if defined(WINDOWS) || defined(WIN32) /* If building or using zlib as a DLL, define ZLIB_DLL. * This is not mandatory, but it offers a little performance increase. */ # ifdef ZLIB_DLL # if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) # ifdef ZLIB_INTERNAL # define ZEXTERN extern __declspec(dllexport) # else # define ZEXTERN extern __declspec(dllimport) # endif # endif # endif /* ZLIB_DLL */ /* If building or using zlib with the WINAPI/WINAPIV calling convention, * define ZLIB_WINAPI. * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. */ # ifdef ZLIB_WINAPI # ifdef FAR # undef FAR # endif # include <windows.h> /* No need for _export, use ZLIB.DEF instead. */ /* For complete Windows compatibility, use WINAPI, not __stdcall. */ # define ZEXPORT WINAPI # ifdef WIN32 # define ZEXPORTVA WINAPIV # else # define ZEXPORTVA FAR CDECL # endif # endif #endif #if defined (__BEOS__) # ifdef ZLIB_DLL # ifdef ZLIB_INTERNAL # define ZEXPORT __declspec(dllexport) # define ZEXPORTVA __declspec(dllexport) # else # define ZEXPORT __declspec(dllimport) # define ZEXPORTVA __declspec(dllimport) # endif # endif #endif #ifndef ZEXTERN # define ZEXTERN extern #endif #ifndef ZEXPORT # define ZEXPORT #endif #ifndef ZEXPORTVA # define ZEXPORTVA #endif #ifndef FAR # define FAR #endif #if !defined(__MACTYPES__) typedef unsigned char Byte; /* 8 bits */ #endif typedef unsigned int uInt; /* 16 bits or more */ typedef unsigned long uLong; /* 32 bits or more */ #ifdef SMALL_MEDIUM /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ # define Bytef Byte FAR #else typedef Byte FAR Bytef; #endif typedef char FAR charf; typedef int FAR intf; typedef uInt FAR uIntf; typedef uLong FAR uLongf; #ifdef STDC typedef void const *voidpc; typedef void FAR *voidpf; typedef void *voidp; #else typedef Byte const *voidpc; typedef Byte FAR *voidpf; typedef Byte *voidp; #endif #ifndef _WIN32 /* HAVE_UNISTD_H -- this line is updated by ./configure */ # include <sys/types.h> /* for off_t */ # include <unistd.h> /* for SEEK_* and off_t */ # ifdef VMS # include <unixio.h> /* for off_t */ # endif # define z_off_t off_t #endif #ifndef SEEK_SET # define SEEK_SET 0 /* Seek from beginning of file. */ # define SEEK_CUR 1 /* Seek from current position. */ # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ #endif #ifndef z_off_t # define z_off_t long #endif #if defined(__OS400__) # define NO_vsnprintf #endif #if defined(__MVS__) # define NO_vsnprintf # ifdef FAR # undef FAR # endif #endif /* MVS linker does not support external names larger than 8 bytes */ #if defined(__MVS__) # pragma map(deflateInit_,"DEIN") # pragma map(deflateInit2_,"DEIN2") # pragma map(deflateEnd,"DEEND") # pragma map(deflateBound,"DEBND") # pragma map(inflateInit_,"ININ") # pragma map(inflateInit2_,"ININ2") # pragma map(inflateEnd,"INEND") # pragma map(inflateSync,"INSY") # pragma map(inflateSetDictionary,"INSEDI") # pragma map(compressBound,"CMBND") # pragma map(inflate_table,"INTABL") # pragma map(inflate_fast,"INFA") # pragma map(inflate_copyright,"INCOPY") #endif #endif /* ZCONF_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/zlib/zlib.h������������������������������������������������������0000644�0001750�0001750�00000201214�12320456500�020455� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* zlib.h -- interface of the 'zlib' general purpose compression library version 1.2.3, July 18th, 2005 Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Jean-loup Gailly Mark Adler jloup@gzip.org madler@alumni.caltech.edu The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). */ #ifndef ZLIB_H #define ZLIB_H #include "zconf.h" #ifdef __cplusplus extern "C" { #endif #define ZLIB_VERSION "1.2.3" #define ZLIB_VERNUM 0x1230 /* The 'zlib' compression library provides in-memory compression and decompression functions, including integrity checks of the uncompressed data. This version of the library supports only one compression method (deflation) but other algorithms will be added later and will have the same stream interface. Compression can be done in a single step if the buffers are large enough (for example if an input file is mmap'ed), or can be done by repeated calls of the compression function. In the latter case, the application must provide more input and/or consume the output (providing more output space) before each call. The compressed data format used by default by the in-memory functions is the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped around a deflate stream, which is itself documented in RFC 1951. The library also supports reading and writing files in gzip (.gz) format with an interface similar to that of stdio using the functions that start with "gz". The gzip format is different from the zlib format. gzip is a gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. This library can optionally read and write gzip streams in memory as well. The zlib format was designed to be compact and fast for use in memory and on communications channels. The gzip format was designed for single- file compression on file systems, has a larger header than zlib to maintain directory information, and uses a different, slower check method than zlib. The library does not install any signal handler. The decoder checks the consistency of the compressed data, so the library should never crash even in case of corrupted input. */ typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); typedef void (*free_func) OF((voidpf opaque, voidpf address)); struct internal_state; typedef struct z_stream_s { Bytef *next_in; /* next input byte */ uInt avail_in; /* number of bytes available at next_in */ uLong total_in; /* total nb of input bytes read so far */ Bytef *next_out; /* next output byte should be put there */ uInt avail_out; /* remaining free space at next_out */ uLong total_out; /* total nb of bytes output so far */ char *msg; /* last error message, NULL if no error */ struct internal_state FAR *state; /* not visible by applications */ alloc_func zalloc; /* used to allocate the internal state */ free_func zfree; /* used to free the internal state */ voidpf opaque; /* private data object passed to zalloc and zfree */ int data_type; /* best guess about the data type: binary or text */ uLong adler; /* adler32 value of the uncompressed data */ uLong reserved; /* reserved for future use */ } z_stream; typedef z_stream FAR *z_streamp; /* gzip header information passed to and from zlib routines. See RFC 1952 for more details on the meanings of these fields. */ typedef struct gz_header_s { int text; /* true if compressed data believed to be text */ uLong time; /* modification time */ int xflags; /* extra flags (not used when writing a gzip file) */ int os; /* operating system */ Bytef *extra; /* pointer to extra field or Z_NULL if none */ uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ uInt extra_max; /* space at extra (only when reading header) */ Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ uInt name_max; /* space at name (only when reading header) */ Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ uInt comm_max; /* space at comment (only when reading header) */ int hcrc; /* true if there was or will be a header crc */ int done; /* true when done reading gzip header (not used when writing a gzip file) */ } gz_header; typedef gz_header FAR *gz_headerp; /* The application must update next_in and avail_in when avail_in has dropped to zero. It must update next_out and avail_out when avail_out has dropped to zero. The application must initialize zalloc, zfree and opaque before calling the init function. All other fields are set by the compression library and must not be updated by the application. The opaque value provided by the application will be passed as the first parameter for calls of zalloc and zfree. This can be useful for custom memory management. The compression library attaches no meaning to the opaque value. zalloc must return Z_NULL if there is not enough memory for the object. If zlib is used in a multi-threaded application, zalloc and zfree must be thread safe. On 16-bit systems, the functions zalloc and zfree must be able to allocate exactly 65536 bytes, but will not be required to allocate more than this if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers returned by zalloc for objects of exactly 65536 bytes *must* have their offset normalized to zero. The default allocation function provided by this library ensures this (see zutil.c). To reduce memory requirements and avoid any allocation of 64K objects, at the expense of compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). The fields total_in and total_out can be used for statistics or progress reports. After compression, total_in holds the total size of the uncompressed data and may be saved for use in the decompressor (particularly if the decompressor wants to decompress everything in a single step). */ /* constants */ #define Z_NO_FLUSH 0 #define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ #define Z_SYNC_FLUSH 2 #define Z_FULL_FLUSH 3 #define Z_FINISH 4 #define Z_BLOCK 5 /* Allowed flush values; see deflate() and inflate() below for details */ #define Z_OK 0 #define Z_STREAM_END 1 #define Z_NEED_DICT 2 #define Z_ERRNO (-1) #define Z_STREAM_ERROR (-2) #define Z_DATA_ERROR (-3) #define Z_MEM_ERROR (-4) #define Z_BUF_ERROR (-5) #define Z_VERSION_ERROR (-6) /* Return codes for the compression/decompression functions. Negative * values are errors, positive values are used for special but normal events. */ #define Z_NO_COMPRESSION 0 #define Z_BEST_SPEED 1 #define Z_BEST_COMPRESSION 9 #define Z_DEFAULT_COMPRESSION (-1) /* compression levels */ #define Z_FILTERED 1 #define Z_HUFFMAN_ONLY 2 #define Z_RLE 3 #define Z_FIXED 4 #define Z_DEFAULT_STRATEGY 0 /* compression strategy; see deflateInit2() below for details */ #define Z_BINARY 0 #define Z_TEXT 1 #define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ #define Z_UNKNOWN 2 /* Possible values of the data_type field (though see inflate()) */ #define Z_DEFLATED 8 /* The deflate compression method (the only one supported in this version) */ #define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ #define zlib_version zlibVersion() /* for compatibility with versions < 1.0.2 */ /* basic functions */ ZEXTERN const char * ZEXPORT zlibVersion OF((void)); /* The application can compare zlibVersion and ZLIB_VERSION for consistency. If the first character differs, the library code actually used is not compatible with the zlib.h header file used by the application. This check is automatically made by deflateInit and inflateInit. */ /* ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); Initializes the internal stream state for compression. The fields zalloc, zfree and opaque must be initialized before by the caller. If zalloc and zfree are set to Z_NULL, deflateInit updates them to use default allocation functions. The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: 1 gives best speed, 9 gives best compression, 0 gives no compression at all (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION requests a default compromise between speed and compression (currently equivalent to level 6). deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if level is not a valid compression level, Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible with the version assumed by the caller (ZLIB_VERSION). msg is set to null if there is no error message. deflateInit does not perform any compression: this will be done by deflate(). */ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); /* deflate compresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce some output latency (reading input without producing any output) except when forced to flush. The detailed semantics are as follows. deflate performs one or both of the following actions: - Compress more input starting at next_in and update next_in and avail_in accordingly. If not all input can be processed (because there is not enough room in the output buffer), next_in and avail_in are updated and processing will resume at this point for the next call of deflate(). - Provide more output starting at next_out and update next_out and avail_out accordingly. This action is forced if the parameter flush is non zero. Forcing flush frequently degrades the compression ratio, so this parameter should be set only when necessary (in interactive applications). Some output may be provided even if flush is not set. Before the call of deflate(), the application should ensure that at least one of the actions is possible, by providing more input and/or consuming more output, and updating avail_in or avail_out accordingly; avail_out should never be zero before the call. The application can consume the compressed output when it wants, for example when the output buffer is full (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to decide how much data to accumualte before producing output, in order to maximize compression. If the parameter flush is set to Z_SYNC_FLUSH, all pending output is flushed to the output buffer and the output is aligned on a byte boundary, so that the decompressor can get all input data available so far. (In particular avail_in is zero after the call if enough output space has been provided before the call.) Flushing may degrade compression for some compression algorithms and so it should be used only when necessary. If flush is set to Z_FULL_FLUSH, all output is flushed as with Z_SYNC_FLUSH, and the compression state is reset so that decompression can restart from this point if previous compressed data has been damaged or if random access is desired. Using Z_FULL_FLUSH too often can seriously degrade compression. If deflate returns with avail_out == 0, this function must be called again with the same value of the flush parameter and more output space (updated avail_out), until the flush is complete (deflate returns with non-zero avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that avail_out is greater than six to avoid repeated flush markers due to avail_out == 0 on return. If the parameter flush is set to Z_FINISH, pending input is processed, pending output is flushed and deflate returns with Z_STREAM_END if there was enough output space; if deflate returns with Z_OK, this function must be called again with Z_FINISH and more output space (updated avail_out) but no more input data, until it returns with Z_STREAM_END or an error. After deflate has returned Z_STREAM_END, the only possible operations on the stream are deflateReset or deflateEnd. Z_FINISH can be used immediately after deflateInit if all the compression is to be done in a single step. In this case, avail_out must be at least the value returned by deflateBound (see below). If deflate does not return Z_STREAM_END, then it must be called again as described above. deflate() sets strm->adler to the adler32 checksum of all input read so far (that is, total_in bytes). deflate() may update strm->data_type if it can make a good guess about the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered binary. This field is only for information purposes and does not affect the compression algorithm in any manner. deflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if all input has been consumed and all output has been produced (only when flush is set to Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and deflate() can be called again with more input and more output space to continue compressing. */ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); /* All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending output. deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state was inconsistent, Z_DATA_ERROR if the stream was freed prematurely (some input or output was discarded). In the error case, msg may be set but then points to a static string (which must not be deallocated). */ /* ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); Initializes the internal stream state for decompression. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by the caller. If next_in is not Z_NULL and avail_in is large enough (the exact value depends on the compression method), inflateInit determines the compression method from the zlib header and allocates all data structures accordingly; otherwise the allocation will be deferred to the first call of inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to use default allocation functions. inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the version assumed by the caller. msg is set to null if there is no error message. inflateInit does not perform any decompression apart from reading the zlib header if present: this will be done by inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unchanged.) */ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); /* inflate decompresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce some output latency (reading input without producing any output) except when forced to flush. The detailed semantics are as follows. inflate performs one or both of the following actions: - Decompress more input starting at next_in and update next_in and avail_in accordingly. If not all input can be processed (because there is not enough room in the output buffer), next_in is updated and processing will resume at this point for the next call of inflate(). - Provide more output starting at next_out and update next_out and avail_out accordingly. inflate() provides as much output as possible, until there is no more input data or no more space in the output buffer (see below about the flush parameter). Before the call of inflate(), the application should ensure that at least one of the actions is possible, by providing more input and/or consuming more output, and updating the next_* and avail_* values accordingly. The application can consume the uncompressed output when it wants, for example when the output buffer is full (avail_out == 0), or after each call of inflate(). If inflate returns Z_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much output as possible to the output buffer. Z_BLOCK requests that inflate() stop if and when it gets to the next deflate block boundary. When decoding the zlib or gzip format, this will cause inflate() to return immediately after the header and before the first block. When doing a raw inflate, inflate() will go ahead and process the first block, and will return when it gets to the end of that block, or when it runs out of data. The Z_BLOCK option assists in appending to or combining deflate streams. Also to assist in this, on return inflate() will set strm->data_type to the number of unused bits in the last byte taken from strm->next_in, plus 64 if inflate() is currently decoding the last block in the deflate stream, plus 128 if inflate() returned immediately after decoding an end-of-block code or decoding the complete header up to just before the first byte of the deflate stream. The end-of-block will not be indicated until all of the uncompressed data from that block has been written to strm->next_out. The number of unused bits may in general be greater than seven, except when bit 7 of data_type is set, in which case the number of unused bits will be less than eight. inflate() should normally be called until it returns Z_STREAM_END or an error. However if all decompression is to be performed in a single step (a single call of inflate), the parameter flush should be set to Z_FINISH. In this case all pending input is processed and all pending output is flushed; avail_out must be large enough to hold all the uncompressed data. (The size of the uncompressed data may have been saved by the compressor for this purpose.) The next operation on this stream must be inflateEnd to deallocate the decompression state. The use of Z_FINISH is never required, but can be used to inform inflate that a faster approach may be used for the single inflate() call. In this implementation, inflate() always flushes as much output as possible to the output buffer, and always uses the faster approach on the first call. So the only effect of the flush parameter in this implementation is on the return value of inflate(), as noted below, or when it returns early because Z_BLOCK is used. If a preset dictionary is needed after this call (see inflateSetDictionary below), inflate sets strm->adler to the adler32 checksum of the dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise it sets strm->adler to the adler32 checksum of all output produced so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described below. At the end of the stream, inflate() checks that its computed adler32 checksum is equal to that saved by the compressor and returns Z_STREAM_END only if the checksum is correct. inflate() will decompress and check either zlib-wrapped or gzip-wrapped deflate data. The header type is detected automatically. Any information contained in the gzip header is not retained, so applications that need that information should instead use raw inflate, see inflateInit2() below, or inflateBack() and perform their own processing of the gzip header and trailer. inflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if the end of the compressed data has been reached and all uncompressed output has been produced, Z_NEED_DICT if a preset dictionary is needed at this point, Z_DATA_ERROR if the input data was corrupted (input stream not conforming to the zlib format or incorrect check value), Z_STREAM_ERROR if the stream structure was inconsistent (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if no progress is possible or if there was not enough room in the output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and inflate() can be called again with more input and more output space to continue decompressing. If Z_DATA_ERROR is returned, the application may then call inflateSync() to look for a good compression block if a partial recovery of the data is desired. */ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); /* All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending output. inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state was inconsistent. In the error case, msg may be set but then points to a static string (which must not be deallocated). */ /* Advanced functions */ /* The following functions are needed only in some special applications. */ /* ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy)); This is another version of deflateInit with more compression options. The fields next_in, zalloc, zfree and opaque must be initialized before by the caller. The method parameter is the compression method. It must be Z_DEFLATED in this version of the library. The windowBits parameter is the base two logarithm of the window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. Larger values of this parameter result in better compression at the expense of memory usage. The default value is 15 if deflateInit is used instead. windowBits can also be -8..-15 for raw deflate. In this case, -windowBits determines the window size. deflate() will then generate raw deflate data with no zlib header or trailer, and will not compute an adler32 check value. windowBits can also be greater than 15 for optional gzip encoding. Add 16 to windowBits to write a simple gzip header and trailer around the compressed data instead of a zlib wrapper. The gzip header will have no file name, no extra data, no comment, no modification time (set to zero), no header crc, and the operating system will be set to 255 (unknown). If a gzip stream is being written, strm->adler is a crc32 instead of an adler32. The memLevel parameter specifies how much memory should be allocated for the internal compression state. memLevel=1 uses minimum memory but is slow and reduces compression ratio; memLevel=9 uses maximum memory for optimal speed. The default value is 8. See zconf.h for total memory usage as a function of windowBits and memLevel. The strategy parameter is used to tune the compression algorithm. Use the value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no string match), or Z_RLE to limit match distances to one (run-length encoding). Filtered data consists mostly of small values with a somewhat random distribution. In this case, the compression algorithm is tuned to compress them better. The effect of Z_FILTERED is to force more Huffman coding and less string matching; it is somewhat intermediate between Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately. Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications. deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid method). msg is set to null if there is no error message. deflateInit2 does not perform any compression: this will be done by deflate(). */ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, const Bytef *dictionary, uInt dictLength)); /* Initializes the compression dictionary from the given byte sequence without producing any compressed output. This function must be called immediately after deflateInit, deflateInit2 or deflateReset, before any call of deflate. The compressor and decompressor must use exactly the same dictionary (see inflateSetDictionary). The dictionary should consist of strings (byte sequences) that are likely to be encountered later in the data to be compressed, with the most commonly used strings preferably put towards the end of the dictionary. Using a dictionary is most useful when the data to be compressed is short and can be predicted with good accuracy; the data can then be compressed better than with the default empty dictionary. Depending on the size of the compression data structures selected by deflateInit or deflateInit2, a part of the dictionary may in effect be discarded, for example if the dictionary is larger than the window size in deflate or deflate2. Thus the strings most likely to be useful should be put at the end of the dictionary, not at the front. In addition, the current implementation of deflate will use at most the window size minus 262 bytes of the provided dictionary. Upon return of this function, strm->adler is set to the adler32 value of the dictionary; the decompressor may later use this value to determine which dictionary has been used by the compressor. (The adler32 value applies to the whole dictionary even if only a subset of the dictionary is actually used by the compressor.) If a raw deflate was requested, then the adler32 value is not computed and strm->adler is not set. deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a parameter is invalid (such as NULL dictionary) or the stream state is inconsistent (for example if deflate has already been called for this stream or if the compression method is bsort). deflateSetDictionary does not perform any compression: this will be done by deflate(). */ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, z_streamp source)); /* Sets the destination stream as a complete copy of the source stream. This function can be useful when several compression strategies will be tried, for example when there are several ways of pre-processing the input data with a filter. The streams that will be discarded should then be freed by calling deflateEnd. Note that deflateCopy duplicates the internal compression state which can be quite large, so this strategy is slow and can consume lots of memory. deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc being NULL). msg is left unchanged in both source and destination. */ ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); /* This function is equivalent to deflateEnd followed by deflateInit, but does not free and reallocate all the internal compression state. The stream will keep the same compression level and any other attributes that may have been set by deflateInit2. deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being NULL). */ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, int level, int strategy)); /* Dynamically update the compression level and compression strategy. The interpretation of level and strategy is as in deflateInit2. This can be used to switch between compression and straight copy of the input data, or to switch to a different kind of input data requiring a different strategy. If the compression level is changed, the input available so far is compressed with the old level (and may be flushed); the new level will take effect only at the next call of deflate(). Before the call of deflateParams, the stream state must be set as for a call of deflate(), since the currently available input may have to be compressed and flushed. In particular, strm->avail_out must be non-zero. deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if strm->avail_out was zero. */ ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, int good_length, int max_lazy, int nice_length, int max_chain)); /* Fine tune deflate's internal compression parameters. This should only be used by someone who understands the algorithm used by zlib's deflate for searching for the best matching string, and even then only by the most fanatic optimizer trying to squeeze out the last compressed bit for their specific input data. Read the deflate.c source code for the meaning of the max_lazy, good_length, nice_length, and max_chain parameters. deflateTune() can be called after deflateInit() or deflateInit2(), and returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. */ ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, uLong sourceLen)); /* deflateBound() returns an upper bound on the compressed size after deflation of sourceLen bytes. It must be called after deflateInit() or deflateInit2(). This would be used to allocate an output buffer for deflation in a single pass, and so would be called before deflate(). */ ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, int bits, int value)); /* deflatePrime() inserts bits in the deflate output stream. The intent is that this function is used to start off the deflate output with the bits leftover from a previous deflate stream when appending to it. As such, this function can only be used for raw deflate, and must be used before the first deflate() call after a deflateInit2() or deflateReset(). bits must be less than or equal to 16, and that many of the least significant bits of value will be inserted in the output. deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, gz_headerp head)); /* deflateSetHeader() provides gzip header information for when a gzip stream is requested by deflateInit2(). deflateSetHeader() may be called after deflateInit2() or deflateReset() and before the first call of deflate(). The text, time, os, extra field, name, and comment information in the provided gz_header structure are written to the gzip header (xflag is ignored -- the extra flags are set according to the compression level). The caller must assure that, if not Z_NULL, name and comment are terminated with a zero byte, and that if extra is not Z_NULL, that extra_len bytes are available there. If hcrc is true, a gzip header crc is included. Note that the current versions of the command-line version of gzip (up through version 1.3.x) do not support header crc's, and will report that it is a "multi-part gzip file" and give up. If deflateSetHeader is not used, the default gzip header has text false, the time set to zero, and os set to 255, with no extra, name, or comment fields. The gzip header is returned to the default state by deflateReset(). deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ /* ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, int windowBits)); This is another version of inflateInit with an extra parameter. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by the caller. The windowBits parameter is the base two logarithm of the maximum window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. The default value is 15 if inflateInit is used instead. windowBits must be greater than or equal to the windowBits value provided to deflateInit2() while compressing, or it must be equal to 15 if deflateInit2() was not used. If a compressed stream with a larger window size is given as input, inflate() will return with the error code Z_DATA_ERROR instead of trying to allocate a larger window. windowBits can also be -8..-15 for raw inflate. In this case, -windowBits determines the window size. inflate() will then process raw deflate data, not looking for a zlib or gzip header, not generating a check value, and not looking for any check values for comparison at the end of the stream. This is for use with other formats that use the deflate compressed data format such as zip. Those formats provide their own check values. If a custom format is developed using the raw deflate format for compressed data, it is recommended that a check value such as an adler32 or a crc32 be applied to the uncompressed data as is done in the zlib, gzip, and zip formats. For most applications, the zlib format should be used as is. Note that comments above on the use in deflateInit2() applies to the magnitude of windowBits. windowBits can also be greater than 15 for optional gzip decoding. Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection, or add 16 to decode only the gzip format (the zlib format will return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a crc32 instead of an adler32. inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg is set to null if there is no error message. inflateInit2 does not perform any decompression apart from reading the zlib header if present: this will be done by inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unchanged.) */ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, const Bytef *dictionary, uInt dictLength)); /* Initializes the decompression dictionary from the given uncompressed byte sequence. This function must be called immediately after a call of inflate, if that call returned Z_NEED_DICT. The dictionary chosen by the compressor can be determined from the adler32 value returned by that call of inflate. The compressor and decompressor must use exactly the same dictionary (see deflateSetDictionary). For raw inflate, this function can be called immediately after inflateInit2() or inflateReset() and before any call of inflate() to set the dictionary. The application must insure that the dictionary that was used for compression is provided. inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a parameter is invalid (such as NULL dictionary) or the stream state is inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the expected one (incorrect adler32 value). inflateSetDictionary does not perform any decompression: this will be done by subsequent calls of inflate(). */ ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); /* Skips invalid compressed data until a full flush point (see above the description of deflate with Z_FULL_FLUSH) can be found, or until all available input is skipped. No output is provided. inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the success case, the application may save the current current value of total_in which indicates where valid compressed data was found. In the error case, the application may repeatedly call inflateSync, providing more input each time, until success or end of the input data. */ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, z_streamp source)); /* Sets the destination stream as a complete copy of the source stream. This function can be useful when randomly accessing a large stream. The first pass through the stream can periodically record the inflate state, allowing restarting inflate at those points when randomly accessing the stream. inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc being NULL). msg is left unchanged in both source and destination. */ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); /* This function is equivalent to inflateEnd followed by inflateInit, but does not free and reallocate all the internal decompression state. The stream will keep attributes that may have been set by inflateInit2. inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being NULL). */ ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, int bits, int value)); /* This function inserts bits in the inflate input stream. The intent is that this function is used to start inflating at a bit position in the middle of a byte. The provided bits will be used before any bytes are used from next_in. This function should only be used with raw inflate, and should be used before the first inflate() call after inflateInit2() or inflateReset(). bits must be less than or equal to 16, and that many of the least significant bits of value will be inserted in the input. inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, gz_headerp head)); /* inflateGetHeader() requests that gzip header information be stored in the provided gz_header structure. inflateGetHeader() may be called after inflateInit2() or inflateReset(), and before the first call of inflate(). As inflate() processes the gzip stream, head->done is zero until the header is completed, at which time head->done is set to one. If a zlib stream is being decoded, then head->done is set to -1 to indicate that there will be no gzip header information forthcoming. Note that Z_BLOCK can be used to force inflate() to return immediately after header processing is complete and before any actual data is decompressed. The text, time, xflags, and os fields are filled in with the gzip header contents. hcrc is set to true if there is a header CRC. (The header CRC was valid if done is set to one.) If extra is not Z_NULL, then extra_max contains the maximum number of bytes to write to extra. Once done is true, extra_len contains the actual extra field length, and extra contains the extra field, or that field truncated if extra_max is less than extra_len. If name is not Z_NULL, then up to name_max characters are written there, terminated with a zero unless the length is greater than name_max. If comment is not Z_NULL, then up to comm_max characters are written there, terminated with a zero unless the length is greater than comm_max. When any of extra, name, or comment are not Z_NULL and the respective field is not present in the header, then that field is set to Z_NULL to signal its absence. This allows the use of deflateSetHeader() with the returned structure to duplicate the header. However if those fields are set to allocated memory, then the application will need to save those pointers elsewhere so that they can be eventually freed. If inflateGetHeader is not used, then the header information is simply discarded. The header is always checked for validity, including the header CRC if present. inflateReset() will reset the process to discard the header information. The application would need to call inflateGetHeader() again to retrieve the header from the next gzip stream. inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ /* ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, unsigned char FAR *window)); Initialize the internal stream state for decompression using inflateBack() calls. The fields zalloc, zfree and opaque in strm must be initialized before the call. If zalloc and zfree are Z_NULL, then the default library- derived memory allocation routines are used. windowBits is the base two logarithm of the window size, in the range 8..15. window is a caller supplied buffer of that size. Except for special applications where it is assured that deflate was used with small window sizes, windowBits must be 15 and a 32K byte window must be supplied to be able to decompress general deflate streams. See inflateBack() for the usage of these routines. inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of the paramaters are invalid, Z_MEM_ERROR if the internal state could not be allocated, or Z_VERSION_ERROR if the version of the library does not match the version of the header file. */ typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, in_func in, void FAR *in_desc, out_func out, void FAR *out_desc)); /* inflateBack() does a raw inflate with a single call using a call-back interface for input and output. This is more efficient than inflate() for file i/o applications in that it avoids copying between the output and the sliding window by simply making the window itself the output buffer. This function trusts the application to not change the output buffer passed by the output function, at least until inflateBack() returns. inflateBackInit() must be called first to allocate the internal state and to initialize the state with the user-provided window buffer. inflateBack() may then be used multiple times to inflate a complete, raw deflate stream with each call. inflateBackEnd() is then called to free the allocated state. A raw deflate stream is one with no zlib or gzip header or trailer. This routine would normally be used in a utility that reads zip or gzip files and writes out uncompressed files. The utility would decode the header and process the trailer on its own, hence this routine expects only the raw deflate stream to decompress. This is different from the normal behavior of inflate(), which expects either a zlib or gzip header and trailer around the deflate stream. inflateBack() uses two subroutines supplied by the caller that are then called by inflateBack() for input and output. inflateBack() calls those routines until it reads a complete deflate stream and writes out all of the uncompressed data, or until it encounters an error. The function's parameters and return types are defined above in the in_func and out_func typedefs. inflateBack() will call in(in_desc, &buf) which should return the number of bytes of provided input, and a pointer to that input in buf. If there is no input available, in() must return zero--buf is ignored in that case--and inflateBack() will return a buffer error. inflateBack() will call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() should return zero on success, or non-zero on failure. If out() returns non-zero, inflateBack() will return with an error. Neither in() nor out() are permitted to change the contents of the window provided to inflateBackInit(), which is also the buffer that out() uses to write from. The length written by out() will be at most the window size. Any non-zero amount of input may be provided by in(). For convenience, inflateBack() can be provided input on the first call by setting strm->next_in and strm->avail_in. If that input is exhausted, then in() will be called. Therefore strm->next_in must be initialized before calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in must also be initialized, and then if strm->avail_in is not zero, input will initially be taken from strm->next_in[0 .. strm->avail_in - 1]. The in_desc and out_desc parameters of inflateBack() is passed as the first parameter of in() and out() respectively when they are called. These descriptors can be optionally used to pass any information that the caller- supplied in() and out() functions need to do their job. On return, inflateBack() will set strm->next_in and strm->avail_in to pass back any unused input that was provided by the last in() call. The return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR if in() or out() returned an error, Z_DATA_ERROR if there was a format error in the deflate stream (in which case strm->msg is set to indicate the nature of the error), or Z_STREAM_ERROR if the stream was not properly initialized. In the case of Z_BUF_ERROR, an input or output error can be distinguished using strm->next_in which will be Z_NULL only if in() returned an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to out() returning non-zero. (in() will always be called before out(), so strm->next_in is assured to be defined if out() returns non-zero.) Note that inflateBack() cannot return Z_OK. */ ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); /* All memory allocated by inflateBackInit() is freed. inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream state was inconsistent. */ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); /* Return flags indicating compile-time options. Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: 1.0: size of uInt 3.2: size of uLong 5.4: size of voidpf (pointer) 7.6: size of z_off_t Compiler, assembler, and debug options: 8: DEBUG 9: ASMV or ASMINF -- use ASM code 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention 11: 0 (reserved) One-time table building (smaller code, but not thread-safe if true): 12: BUILDFIXED -- build static block decoding tables when needed 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed 14,15: 0 (reserved) Library content (indicates missing functionality): 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking deflate code when not needed) 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect and decode gzip streams (to avoid linking crc code) 18-19: 0 (reserved) Operation variations (changes in library functionality): 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate 21: FASTEST -- deflate algorithm with only one, lowest compression level 22,23: 0 (reserved) The sprintf variant used by gzprintf (zero is best): 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! 26: 0 = returns value, 1 = void -- 1 means inferred string length returned Remainder: 27-31: 0 (reserved) */ /* utility functions */ /* The following utility functions are implemented on top of the basic stream-oriented functions. To simplify the interface, some default options are assumed (compression level and memory usage, standard memory allocation functions). The source code of these utility functions can easily be modified if you need special options. */ ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)); /* Compresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be at least the value returned by compressBound(sourceLen). Upon exit, destLen is the actual size of the compressed buffer. This function can be used to compress a whole file at once if the input file is mmap'ed. compress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer. */ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level)); /* Compresses the source buffer into the destination buffer. The level parameter has the same meaning as in deflateInit. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be at least the value returned by compressBound(sourceLen). Upon exit, destLen is the actual size of the compressed buffer. compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, Z_STREAM_ERROR if the level parameter is invalid. */ ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); /* compressBound() returns an upper bound on the compressed size after compress() or compress2() on sourceLen bytes. It would be used before a compress() or compress2() call to allocate the destination buffer. */ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)); /* Decompresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be large enough to hold the entire uncompressed data. (The size of the uncompressed data must have been saved previously by the compressor and transmitted to the decompressor by some mechanism outside the scope of this compression library.) Upon exit, destLen is the actual size of the compressed buffer. This function can be used to decompress a whole file at once if the input file is mmap'ed. uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. */ typedef voidp gzFile; ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); /* Opens a gzip (.gz) file for reading or writing. The mode parameter is as in fopen ("rb" or "wb") but can also include a compression level ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman only compression as in "wb1h", or 'R' for run-length encoding as in "wb1R". (See the description of deflateInit2 for more information about the strategy parameter.) gzopen can be used to read a file which is not in gzip format; in this case gzread will directly read from the file without decompression. gzopen returns NULL if the file could not be opened or if there was insufficient memory to allocate the (de)compression state; errno can be checked to distinguish the two cases (if errno is zero, the zlib error is Z_MEM_ERROR). */ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); /* gzdopen() associates a gzFile with the file descriptor fd. File descriptors are obtained from calls like open, dup, creat, pipe or fileno (in the file has been previously opened with fopen). The mode parameter is as in gzopen. The next call of gzclose on the returned gzFile will also close the file descriptor fd, just like fclose(fdopen(fd), mode) closes the file descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). gzdopen returns NULL if there was insufficient memory to allocate the (de)compression state. */ ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); /* Dynamically update the compression level or strategy. See the description of deflateInit2 for the meaning of these parameters. gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not opened for writing. */ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); /* Reads the given number of uncompressed bytes from the compressed file. If the input file was not in gzip format, gzread copies the given number of bytes into the buffer. gzread returns the number of uncompressed bytes actually read (0 for end of file, -1 for error). */ ZEXTERN int ZEXPORT gzwrite OF((gzFile file, voidpc buf, unsigned len)); /* Writes the given number of uncompressed bytes into the compressed file. gzwrite returns the number of uncompressed bytes actually written (0 in case of error). */ ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); /* Converts, formats, and writes the args to the compressed file under control of the format string, as in fprintf. gzprintf returns the number of uncompressed bytes actually written (0 in case of error). The number of uncompressed bytes written is limited to 4095. The caller should assure that this limit is not exceeded. If it is exceeded, then gzprintf() will return return an error (0) with nothing written. In this case, there may also be a buffer overflow with unpredictable consequences, which is possible only if zlib was compiled with the insecure functions sprintf() or vsprintf() because the secure snprintf() or vsnprintf() functions were not available. */ ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); /* Writes the given null-terminated string to the compressed file, excluding the terminating null character. gzputs returns the number of characters written, or -1 in case of error. */ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); /* Reads bytes from the compressed file until len-1 characters are read, or a newline character is read and transferred to buf, or an end-of-file condition is encountered. The string is then terminated with a null character. gzgets returns buf, or Z_NULL in case of error. */ ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); /* Writes c, converted to an unsigned char, into the compressed file. gzputc returns the value that was written, or -1 in case of error. */ ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); /* Reads one byte from the compressed file. gzgetc returns this byte or -1 in case of end of file or error. */ ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); /* Push one character back onto the stream to be read again later. Only one character of push-back is allowed. gzungetc() returns the character pushed, or -1 on failure. gzungetc() will fail if a character has been pushed but not read yet, or if c is -1. The pushed character will be discarded if the stream is repositioned with gzseek() or gzrewind(). */ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); /* Flushes all pending output into the compressed file. The parameter flush is as in the deflate() function. The return value is the zlib error number (see function gzerror below). gzflush returns Z_OK if the flush parameter is Z_FINISH and all output could be flushed. gzflush should be called only when strictly necessary because it can degrade compression. */ ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, z_off_t offset, int whence)); /* Sets the starting position for the next gzread or gzwrite on the given compressed file. The offset represents a number of bytes in the uncompressed data stream. The whence parameter is defined as in lseek(2); the value SEEK_END is not supported. If the file is opened for reading, this function is emulated but can be extremely slow. If the file is opened for writing, only forward seeks are supported; gzseek then compresses a sequence of zeroes up to the new starting position. gzseek returns the resulting offset location as measured in bytes from the beginning of the uncompressed stream, or -1 in case of error, in particular if the file is opened for writing and the new starting position would be before the current position. */ ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); /* Rewinds the given file. This function is supported only for reading. gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) */ ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); /* Returns the starting position for the next gzread or gzwrite on the given compressed file. This position represents a number of bytes in the uncompressed data stream. gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) */ ZEXTERN int ZEXPORT gzeof OF((gzFile file)); /* Returns 1 when EOF has previously been detected reading the given input stream, otherwise zero. */ ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); /* Returns 1 if file is being read directly without decompression, otherwise zero. */ ZEXTERN int ZEXPORT gzclose OF((gzFile file)); /* Flushes all pending output if necessary, closes the compressed file and deallocates all the (de)compression state. The return value is the zlib error number (see function gzerror below). */ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); /* Returns the error message for the last error which occurred on the given compressed file. errnum is set to zlib error number. If an error occurred in the file system and not in the compression library, errnum is set to Z_ERRNO and the application may consult errno to get the exact error code. */ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); /* Clears the error and end-of-file flags for file. This is analogous to the clearerr() function in stdio. This is useful for continuing to read a gzip file that is being written concurrently. */ /* checksum functions */ /* These functions are not related to compression but are exported anyway because they might be useful in applications using the compression library. */ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); /* Update a running Adler-32 checksum with the bytes buf[0..len-1] and return the updated checksum. If buf is NULL, this function returns the required initial value for the checksum. An Adler-32 checksum is almost as reliable as a CRC32 but can be computed much faster. Usage example: uLong adler = adler32(0L, Z_NULL, 0); while (read_buffer(buffer, length) != EOF) { adler = adler32(adler, buffer, length); } if (adler != original_adler) error(); */ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, z_off_t len2)); /* Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. */ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); /* Update a running CRC-32 with the bytes buf[0..len-1] and return the updated CRC-32. If buf is NULL, this function returns the required initial value for the for the crc. Pre- and post-conditioning (one's complement) is performed within this function so it shouldn't be done by the application. Usage example: uLong crc = crc32(0L, Z_NULL, 0); while (read_buffer(buffer, length) != EOF) { crc = crc32(crc, buffer, length); } if (crc != original_crc) error(); */ ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); /* Combine two CRC-32 check values into one. For two sequences of bytes, seq1 and seq2 with lengths len1 and len2, CRC-32 check values were calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and len2. */ /* various hacks, don't look :) */ /* deflateInit and inflateInit are macros to allow checking the zlib version * and the compiler's view of z_stream: */ ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, const char *version, int stream_size)); ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, const char *version, int stream_size)); ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, const char *version, int stream_size)); ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, const char *version, int stream_size)); ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, unsigned char FAR *window, const char *version, int stream_size)); #define deflateInit(strm, level) \ deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) #define inflateInit(strm) \ inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ (strategy), ZLIB_VERSION, sizeof(z_stream)) #define inflateInit2(strm, windowBits) \ inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) #define inflateBackInit(strm, windowBits, window) \ inflateBackInit_((strm), (windowBits), (window), \ ZLIB_VERSION, sizeof(z_stream)) #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) struct internal_state {int dummy;}; /* hack for buggy compilers */ #endif ZEXTERN const char * ZEXPORT zError OF((int)); ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); #ifdef __cplusplus } #endif #endif /* ZLIB_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lz4/�������������������������������������������������������������0000755�0001750�0001750�00000000000�12320456500�017115� 5����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lz4/lz4.h��������������������������������������������������������0000644�0001750�0001750�00000012433�12320456500�020002� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* LZ4 - Fast LZ compression algorithm Header File Copyright (C) 2011-2012, Yann Collet. BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. You can contact the author at : - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html - LZ4 source repository : http://code.google.com/p/lz4/ */ #pragma once #if defined (__cplusplus) extern "C" { #endif //************************************** // Compiler Options //************************************** #ifdef _MSC_VER // Visual Studio # define inline __inline // Visual is not C99, but supports some kind of inline #endif //**************************** // Simple Functions //**************************** int LZ4_compress (const char* source, char* dest, int isize); int LZ4_uncompress (const char* source, char* dest, int osize); /* LZ4_compress() : Compresses 'isize' bytes from 'source' into 'dest'. Destination buffer must be already allocated, and must be sized to handle worst cases situations (input data not compressible) Worst case size evaluation is provided by function LZ4_compressBound() isize : is the input size. Max supported value is ~1.9GB return : the number of bytes written in buffer dest LZ4_uncompress() : osize : is the output size, therefore the original size return : the number of bytes read in the source buffer If the source stream is malformed, the function will stop decoding and return a negative result, indicating the byte position of the faulty instruction This function never writes outside of provided buffers, and never modifies input buffer. note : destination buffer must be already allocated. its size must be a minimum of 'osize' bytes. */ //**************************** // Advanced Functions //**************************** static inline int LZ4_compressBound(int isize) { return ((isize) + ((isize)/255) + 16); } #define LZ4_COMPRESSBOUND( isize) ((isize) + ((isize)/255) + 16) /* LZ4_compressBound() : Provides the maximum size that LZ4 may output in a "worst case" scenario (input data not compressible) primarily useful for memory allocation of output buffer. inline function is recommended for the general case, but macro is also provided when results need to be evaluated at compile time (such as table size allocation). isize : is the input size. Max supported value is ~1.9GB return : maximum output size in a "worst case" scenario note : this function is limited by "int" range (2^31-1) */ int LZ4_compress_limitedOutput (const char* source, char* dest, int isize, int maxOutputSize); /* LZ4_compress_limitedOutput() : Compress 'isize' bytes from 'source' into an output buffer 'dest' of maximum size 'maxOutputSize'. If it cannot achieve it, compression will stop, and result of the function will be zero. This function never writes outside of provided output buffer. isize : is the input size. Max supported value is ~1.9GB maxOutputSize : is the size of the destination buffer (which must be already allocated) return : the number of bytes written in buffer 'dest' or 0 if the compression fails */ int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize); /* LZ4_uncompress_unknownOutputSize() : isize : is the input size, therefore the compressed size maxOutputSize : is the size of the destination buffer (which must be already allocated) return : the number of bytes decoded in the destination buffer (necessarily <= maxOutputSize) If the source stream is malformed, the function will stop decoding and return a negative result, indicating the byte position of the faulty instruction This function never writes beyond dest + maxOutputSize, and is therefore protected against malicious data packets note : Destination buffer must be already allocated. This version is slightly slower than LZ4_uncompress() */ #if defined (__cplusplus) } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lz4/lz4Version.h�������������������������������������������������0000644�0001750�0001750�00000000321�12320456500�021341� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// URL: http://lz4.googlecode.com/svn/trunk // Revision: 88 // // Note: This revision seems to cause some bad memory accesses when using LZ4_compressHC. // See our wrapper Lz4Compression.cpp for details.���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lz4/lz4.c��������������������������������������������������������0000644�0001750�0001750�00000071406�12320456500�020002� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* LZ4 - Fast LZ compression algorithm Copyright (C) 2011-2012, Yann Collet. BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. You can contact the author at : - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html - LZ4 source repository : http://code.google.com/p/lz4/ */ //************************************** // Tuning parameters //************************************** // MEMORY_USAGE : // Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; etc.) // Increasing memory usage improves compression ratio // Reduced memory usage can improve speed, due to cache effect // Default value is 14, for 16KB, which nicely fits into Intel x86 L1 cache #define MEMORY_USAGE 14 // NOTCOMPRESSIBLE_DETECTIONLEVEL : // Decreasing this value will make the algorithm skip faster data segments considered "incompressible" // This may decrease compression ratio dramatically, but will be faster on incompressible data // Increasing this value will make the algorithm search more before declaring a segment "incompressible" // This could improve compression a bit, but will be slower on incompressible data // The default value (6) is recommended #define NOTCOMPRESSIBLE_DETECTIONLEVEL 6 // BIG_ENDIAN_NATIVE_BUT_INCOMPATIBLE : // This will provide a small boost to performance for big endian cpu, but the resulting compressed stream will be incompatible with little-endian CPU. // You can set this option to 1 in situations where data will remain within closed environment // This option is useless on Little_Endian CPU (such as x86) //#define BIG_ENDIAN_NATIVE_BUT_INCOMPATIBLE 1 //************************************** // CPU Feature Detection //************************************** // 32 or 64 bits ? #if (defined(__x86_64__) || defined(__x86_64) || defined(__amd64__) || defined(__amd64) || defined(__ppc64__) || defined(_WIN64) || defined(__LP64__) || defined(_LP64) ) // Detects 64 bits mode # define LZ4_ARCH64 1 #else # define LZ4_ARCH64 0 #endif // Little Endian or Big Endian ? // Overwrite the #define below if you know your architecture endianess #if defined (__GLIBC__) # include <endian.h> # if (__BYTE_ORDER == __BIG_ENDIAN) # define LZ4_BIG_ENDIAN 1 # endif #elif (defined(__BIG_ENDIAN__) || defined(__BIG_ENDIAN) || defined(_BIG_ENDIAN)) && !(defined(__LITTLE_ENDIAN__) || defined(__LITTLE_ENDIAN) || defined(_LITTLE_ENDIAN)) # define LZ4_BIG_ENDIAN 1 #elif defined(__sparc) || defined(__sparc__) \ || defined(__ppc__) || defined(_POWER) || defined(__powerpc__) || defined(_ARCH_PPC) || defined(__PPC__) || defined(__PPC) || defined(PPC) || defined(__powerpc__) || defined(__powerpc) || defined(powerpc) \ || defined(__hpux) || defined(__hppa) \ || defined(_MIPSEB) || defined(__s390__) # define LZ4_BIG_ENDIAN 1 #else // Little Endian assumed. PDP Endian and other very rare endian format are unsupported. #endif // Unaligned memory access is automatically enabled for "common" CPU, such as x86. // For others CPU, the compiler will be more cautious, and insert extra code to ensure aligned access is respected // If you know your target CPU supports unaligned memory access, you want to force this option manually to improve performance #if defined(__ARM_FEATURE_UNALIGNED) # define LZ4_FORCE_UNALIGNED_ACCESS 1 #endif // Define this parameter if your target system or compiler does not support hardware bit count #if defined(_MSC_VER) && defined(_WIN32_WCE) // Visual Studio for Windows CE does not support Hardware bit count # define LZ4_FORCE_SW_BITCOUNT #endif //************************************** // Compiler Options //************************************** #if __STDC_VERSION__ >= 199901L // C99 /* "restrict" is a known keyword */ #else # define restrict // Disable restrict #endif #define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) #ifdef _MSC_VER // Visual Studio # include <intrin.h> // For Visual 2005 # if LZ4_ARCH64 // 64-bit # pragma intrinsic(_BitScanForward64) // For Visual 2005 # pragma intrinsic(_BitScanReverse64) // For Visual 2005 # else # pragma intrinsic(_BitScanForward) // For Visual 2005 # pragma intrinsic(_BitScanReverse) // For Visual 2005 # endif #endif #ifdef _MSC_VER # define lz4_bswap16(x) _byteswap_ushort(x) #else # define lz4_bswap16(x) ((unsigned short int) ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8))) #endif #if (GCC_VERSION >= 302) || (__INTEL_COMPILER >= 800) || defined(__clang__) # define expect(expr,value) (__builtin_expect ((expr),(value)) ) #else # define expect(expr,value) (expr) #endif #define likely(expr) expect((expr) != 0, 1) #define unlikely(expr) expect((expr) != 0, 0) //************************************** // Includes //************************************** #include <stdlib.h> // for malloc #include <string.h> // for memset #include "lz4.h" //************************************** // Basic Types //************************************** #if defined(_MSC_VER) // Visual Studio does not support 'stdint' natively # define BYTE unsigned __int8 # define U16 unsigned __int16 # define U32 unsigned __int32 # define S32 __int32 # define U64 unsigned __int64 #else # include <stdint.h> # define BYTE uint8_t # define U16 uint16_t # define U32 uint32_t # define S32 int32_t # define U64 uint64_t #endif #ifndef LZ4_FORCE_UNALIGNED_ACCESS # pragma pack(push, 1) #endif typedef struct _U16_S { U16 v; } U16_S; typedef struct _U32_S { U32 v; } U32_S; typedef struct _U64_S { U64 v; } U64_S; #ifndef LZ4_FORCE_UNALIGNED_ACCESS # pragma pack(pop) #endif #define A64(x) (((U64_S *)(x))->v) #define A32(x) (((U32_S *)(x))->v) #define A16(x) (((U16_S *)(x))->v) //************************************** // Constants //************************************** #define MINMATCH 4 #define HASH_LOG (MEMORY_USAGE-2) #define HASHTABLESIZE (1 << HASH_LOG) #define HASH_MASK (HASHTABLESIZE - 1) #define SKIPSTRENGTH (NOTCOMPRESSIBLE_DETECTIONLEVEL>2?NOTCOMPRESSIBLE_DETECTIONLEVEL:2) #define STACKLIMIT 13 #define HEAPMODE (HASH_LOG>STACKLIMIT) // Defines if memory is allocated into the stack (local variable), or into the heap (malloc()). #define COPYLENGTH 8 #define LASTLITERALS 5 #define MFLIMIT (COPYLENGTH+MINMATCH) #define MINLENGTH (MFLIMIT+1) #define MAXD_LOG 16 #define MAX_DISTANCE ((1 << MAXD_LOG) - 1) #define ML_BITS 4 #define ML_MASK ((1U<<ML_BITS)-1) #define RUN_BITS (8-ML_BITS) #define RUN_MASK ((1U<<RUN_BITS)-1) //************************************** // Architecture-specific macros //************************************** #if LZ4_ARCH64 // 64-bit # define STEPSIZE 8 # define UARCH U64 # define AARCH A64 # define LZ4_COPYSTEP(s,d) A64(d) = A64(s); d+=8; s+=8; # define LZ4_COPYPACKET(s,d) LZ4_COPYSTEP(s,d) # define LZ4_SECURECOPY(s,d,e) if (d<e) LZ4_WILDCOPY(s,d,e) # define HTYPE U32 # define INITBASE(base) const BYTE* const base = ip #else // 32-bit # define STEPSIZE 4 # define UARCH U32 # define AARCH A32 # define LZ4_COPYSTEP(s,d) A32(d) = A32(s); d+=4; s+=4; # define LZ4_COPYPACKET(s,d) LZ4_COPYSTEP(s,d); LZ4_COPYSTEP(s,d); # define LZ4_SECURECOPY LZ4_WILDCOPY # define HTYPE const BYTE* # define INITBASE(base) const int base = 0 #endif #if (defined(LZ4_BIG_ENDIAN) && !defined(BIG_ENDIAN_NATIVE_BUT_INCOMPATIBLE)) # define LZ4_READ_LITTLEENDIAN_16(d,s,p) { U16 v = A16(p); v = lz4_bswap16(v); d = (s) - v; } # define LZ4_WRITE_LITTLEENDIAN_16(p,i) { U16 v = (U16)(i); v = lz4_bswap16(v); A16(p) = v; p+=2; } #else // Little Endian # define LZ4_READ_LITTLEENDIAN_16(d,s,p) { d = (s) - A16(p); } # define LZ4_WRITE_LITTLEENDIAN_16(p,v) { A16(p) = v; p+=2; } #endif //************************************** // Local structures //************************************** struct refTables { HTYPE hashTable[HASHTABLESIZE]; }; //************************************** // Macros //************************************** #define LZ4_HASH_FUNCTION(i) (((i) * 2654435761U) >> ((MINMATCH*8)-HASH_LOG)) #define LZ4_HASH_VALUE(p) LZ4_HASH_FUNCTION(A32(p)) #define LZ4_WILDCOPY(s,d,e) do { LZ4_COPYPACKET(s,d) } while (d<e); #define LZ4_BLINDCOPY(s,d,l) { BYTE* e=(d)+l; LZ4_WILDCOPY(s,d,e); d=e; } //**************************** // Private functions //**************************** #if LZ4_ARCH64 static inline int LZ4_NbCommonBytes (register U64 val) { #if defined(LZ4_BIG_ENDIAN) #if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) unsigned long r = 0; _BitScanReverse64( &r, val ); return (int)(r>>3); #elif defined(__GNUC__) && (GCC_VERSION >= 304) && !defined(LZ4_FORCE_SW_BITCOUNT) return (__builtin_clzll(val) >> 3); #else int r; if (!(val>>32)) { r=4; } else { r=0; val>>=32; } if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; } r += (!val); return r; #endif #else #if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) unsigned long r = 0; _BitScanForward64( &r, val ); return (int)(r>>3); #elif defined(__GNUC__) && (GCC_VERSION >= 304) && !defined(LZ4_FORCE_SW_BITCOUNT) return (__builtin_ctzll(val) >> 3); #else static const int DeBruijnBytePos[64] = { 0, 0, 0, 0, 0, 1, 1, 2, 0, 3, 1, 3, 1, 4, 2, 7, 0, 2, 3, 6, 1, 5, 3, 5, 1, 3, 4, 4, 2, 5, 6, 7, 7, 0, 1, 2, 3, 3, 4, 6, 2, 6, 5, 5, 3, 4, 5, 6, 7, 1, 2, 4, 6, 4, 4, 5, 7, 2, 6, 5, 7, 6, 7, 7 }; return DeBruijnBytePos[((U64)((val & -val) * 0x0218A392CDABBD3F)) >> 58]; #endif #endif } #else static inline int LZ4_NbCommonBytes (register U32 val) { #if defined(LZ4_BIG_ENDIAN) #if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) unsigned long r = 0; _BitScanReverse( &r, val ); return (int)(r>>3); #elif defined(__GNUC__) && (GCC_VERSION >= 304) && !defined(LZ4_FORCE_SW_BITCOUNT) return (__builtin_clz(val) >> 3); #else int r; if (!(val>>16)) { r=2; val>>=8; } else { r=0; val>>=24; } r += (!val); return r; #endif #else #if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) unsigned long r = 0; _BitScanForward( &r, val ); return (int)(r>>3); #elif defined(__GNUC__) && (GCC_VERSION >= 304) && !defined(LZ4_FORCE_SW_BITCOUNT) return (__builtin_ctz(val) >> 3); #else static const int DeBruijnBytePos[32] = { 0, 0, 3, 0, 3, 1, 3, 0, 3, 2, 2, 1, 3, 2, 0, 1, 3, 3, 1, 2, 2, 2, 2, 0, 3, 1, 2, 0, 1, 0, 1, 1 }; return DeBruijnBytePos[((U32)((val & -(S32)val) * 0x077CB531U)) >> 27]; #endif #endif } #endif //****************************** // Compression functions //****************************** // LZ4_compressCtx : // ----------------- // Compress 'isize' bytes from 'source' into an output buffer 'dest' of maximum size 'maxOutputSize'. // If it cannot achieve it, compression will stop, and result of the function will be zero. // return : the number of bytes written in buffer 'dest', or 0 if the compression fails static inline int LZ4_compressCtx(void** ctx, const char* source, char* dest, int isize, int maxOutputSize) { #if HEAPMODE struct refTables *srt = (struct refTables *) (*ctx); HTYPE* HashTable; #else HTYPE HashTable[HASHTABLESIZE] = {0}; #endif const BYTE* ip = (BYTE*) source; INITBASE(base); const BYTE* anchor = ip; const BYTE* const iend = ip + isize; const BYTE* const mflimit = iend - MFLIMIT; #define matchlimit (iend - LASTLITERALS) BYTE* op = (BYTE*) dest; BYTE* const oend = op + maxOutputSize; int len, length; const int skipStrength = SKIPSTRENGTH; U32 forwardH; // Init if (isize<MINLENGTH) goto _last_literals; #if HEAPMODE if (*ctx == NULL) { srt = (struct refTables *) malloc ( sizeof(struct refTables) ); *ctx = (void*) srt; } HashTable = (HTYPE*)(srt->hashTable); memset((void*)HashTable, 0, sizeof(srt->hashTable)); #else (void) ctx; #endif // First Byte HashTable[LZ4_HASH_VALUE(ip)] = ip - base; ip++; forwardH = LZ4_HASH_VALUE(ip); // Main Loop for ( ; ; ) { int findMatchAttempts = (1U << skipStrength) + 3; const BYTE* forwardIp = ip; const BYTE* ref; BYTE* token; // Find a match do { U32 h = forwardH; int step = findMatchAttempts++ >> skipStrength; ip = forwardIp; forwardIp = ip + step; if unlikely(forwardIp > mflimit) { goto _last_literals; } forwardH = LZ4_HASH_VALUE(forwardIp); ref = base + HashTable[h]; HashTable[h] = ip - base; } while ((ref < ip - MAX_DISTANCE) || (A32(ref) != A32(ip))); // Catch up while ((ip>anchor) && (ref>(BYTE*)source) && unlikely(ip[-1]==ref[-1])) { ip--; ref--; } // Encode Literal length length = (int)(ip - anchor); token = op++; if unlikely(op + length + (2 + 1 + LASTLITERALS) + (length>>8) > oend) return 0; // Check output limit #ifdef _MSC_VER if (length>=(int)RUN_MASK) { int len = length-RUN_MASK; *token=(RUN_MASK<<ML_BITS); if (len>254) { do { *op++ = 255; len -= 255; } while (len>254); *op++ = (BYTE)len; memcpy(op, anchor, length); op += length; goto _next_match; } else *op++ = (BYTE)len; } else *token = (length<<ML_BITS); #else if (length>=(int)RUN_MASK) { *token=(RUN_MASK<<ML_BITS); len = length-RUN_MASK; for(; len > 254 ; len-=255) *op++ = 255; *op++ = (BYTE)len; } else *token = (length<<ML_BITS); #endif // Copy Literals LZ4_BLINDCOPY(anchor, op, length); _next_match: // Encode Offset LZ4_WRITE_LITTLEENDIAN_16(op,(U16)(ip-ref)); // Start Counting ip+=MINMATCH; ref+=MINMATCH; // MinMatch verified anchor = ip; while likely(ip<matchlimit-(STEPSIZE-1)) { UARCH diff = AARCH(ref) ^ AARCH(ip); if (!diff) { ip+=STEPSIZE; ref+=STEPSIZE; continue; } ip += LZ4_NbCommonBytes(diff); goto _endCount; } if (LZ4_ARCH64) if ((ip<(matchlimit-3)) && (A32(ref) == A32(ip))) { ip+=4; ref+=4; } if ((ip<(matchlimit-1)) && (A16(ref) == A16(ip))) { ip+=2; ref+=2; } if ((ip<matchlimit) && (*ref == *ip)) ip++; _endCount: // Encode MatchLength len = (int)(ip - anchor); if unlikely(op + (1 + LASTLITERALS) + (len>>8) > oend) return 0; // Check output limit if (len>=(int)ML_MASK) { *token+=ML_MASK; len-=ML_MASK; for(; len > 509 ; len-=510) { *op++ = 255; *op++ = 255; } if (len > 254) { len-=255; *op++ = 255; } *op++ = (BYTE)len; } else *token += len; // Test end of chunk if (ip > mflimit) { anchor = ip; break; } // Fill table HashTable[LZ4_HASH_VALUE(ip-2)] = ip - 2 - base; // Test next position ref = base + HashTable[LZ4_HASH_VALUE(ip)]; HashTable[LZ4_HASH_VALUE(ip)] = ip - base; if ((ref > ip - (MAX_DISTANCE + 1)) && (A32(ref) == A32(ip))) { token = op++; *token=0; goto _next_match; } // Prepare next loop anchor = ip++; forwardH = LZ4_HASH_VALUE(ip); } _last_literals: // Encode Last Literals { int lastRun = (int)(iend - anchor); if (((char*)op - dest) + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > (U32)maxOutputSize) return 0; if (lastRun>=(int)RUN_MASK) { *op++=(RUN_MASK<<ML_BITS); lastRun-=RUN_MASK; for(; lastRun > 254 ; lastRun-=255) *op++ = 255; *op++ = (BYTE) lastRun; } else *op++ = (lastRun<<ML_BITS); memcpy(op, anchor, iend - anchor); op += iend-anchor; } // End return (int) (((char*)op)-dest); } // Note : this function is valid only if isize < LZ4_64KLIMIT #define LZ4_64KLIMIT ((1<<16) + (MFLIMIT-1)) #define HASHLOG64K (HASH_LOG+1) #define HASH64KTABLESIZE (1U<<HASHLOG64K) #define LZ4_HASH64K_FUNCTION(i) (((i) * 2654435761U) >> ((MINMATCH*8)-HASHLOG64K)) #define LZ4_HASH64K_VALUE(p) LZ4_HASH64K_FUNCTION(A32(p)) static inline int LZ4_compress64kCtx(void** ctx, const char* source, char* dest, int isize, int maxOutputSize) { #if HEAPMODE struct refTables *srt = (struct refTables *) (*ctx); U16* HashTable; #else U16 HashTable[HASH64KTABLESIZE] = {0}; #endif const BYTE* ip = (BYTE*) source; const BYTE* anchor = ip; const BYTE* const base = ip; const BYTE* const iend = ip + isize; const BYTE* const mflimit = iend - MFLIMIT; #define matchlimit (iend - LASTLITERALS) BYTE* op = (BYTE*) dest; BYTE* const oend = op + maxOutputSize; int len, length; const int skipStrength = SKIPSTRENGTH; U32 forwardH; // Init if (isize<MINLENGTH) goto _last_literals; #if HEAPMODE if (*ctx == NULL) { srt = (struct refTables *) malloc ( sizeof(struct refTables) ); *ctx = (void*) srt; } HashTable = (U16*)(srt->hashTable); memset((void*)HashTable, 0, sizeof(srt->hashTable)); #else (void) ctx; #endif // First Byte ip++; forwardH = LZ4_HASH64K_VALUE(ip); // Main Loop for ( ; ; ) { int findMatchAttempts = (1U << skipStrength) + 3; const BYTE* forwardIp = ip; const BYTE* ref; BYTE* token; // Find a match do { U32 h = forwardH; int step = findMatchAttempts++ >> skipStrength; ip = forwardIp; forwardIp = ip + step; if (forwardIp > mflimit) { goto _last_literals; } forwardH = LZ4_HASH64K_VALUE(forwardIp); ref = base + HashTable[h]; HashTable[h] = (U16)(ip - base); } while (A32(ref) != A32(ip)); // Catch up while ((ip>anchor) && (ref>(BYTE*)source) && (ip[-1]==ref[-1])) { ip--; ref--; } // Encode Literal length length = (int)(ip - anchor); token = op++; if unlikely(op + length + (2 + 1 + LASTLITERALS) + (length>>8) > oend) return 0; // Check output limit #ifdef _MSC_VER if (length>=(int)RUN_MASK) { int len = length-RUN_MASK; *token=(RUN_MASK<<ML_BITS); if (len>254) { do { *op++ = 255; len -= 255; } while (len>254); *op++ = (BYTE)len; memcpy(op, anchor, length); op += length; goto _next_match; } else *op++ = (BYTE)len; } else *token = (length<<ML_BITS); #else if (length>=(int)RUN_MASK) { *token=(RUN_MASK<<ML_BITS); len = length-RUN_MASK; for(; len > 254 ; len-=255) *op++ = 255; *op++ = (BYTE)len; } else *token = (length<<ML_BITS); #endif // Copy Literals LZ4_BLINDCOPY(anchor, op, length); _next_match: // Encode Offset LZ4_WRITE_LITTLEENDIAN_16(op,(U16)(ip-ref)); // Start Counting ip+=MINMATCH; ref+=MINMATCH; // MinMatch verified anchor = ip; while (ip<matchlimit-(STEPSIZE-1)) { UARCH diff = AARCH(ref) ^ AARCH(ip); if (!diff) { ip+=STEPSIZE; ref+=STEPSIZE; continue; } ip += LZ4_NbCommonBytes(diff); goto _endCount; } if (LZ4_ARCH64) if ((ip<(matchlimit-3)) && (A32(ref) == A32(ip))) { ip+=4; ref+=4; } if ((ip<(matchlimit-1)) && (A16(ref) == A16(ip))) { ip+=2; ref+=2; } if ((ip<matchlimit) && (*ref == *ip)) ip++; _endCount: // Encode MatchLength len = (int)(ip - anchor); if unlikely(op + (1 + LASTLITERALS) + (len>>8) > oend) return 0; // Check output limit if (len>=(int)ML_MASK) { *token+=ML_MASK; len-=ML_MASK; for(; len > 509 ; len-=510) { *op++ = 255; *op++ = 255; } if (len > 254) { len-=255; *op++ = 255; } *op++ = (BYTE)len; } else *token += len; // Test end of chunk if (ip > mflimit) { anchor = ip; break; } // Fill table HashTable[LZ4_HASH64K_VALUE(ip-2)] = (U16)(ip - 2 - base); // Test next position ref = base + HashTable[LZ4_HASH64K_VALUE(ip)]; HashTable[LZ4_HASH64K_VALUE(ip)] = (U16)(ip - base); if (A32(ref) == A32(ip)) { token = op++; *token=0; goto _next_match; } // Prepare next loop anchor = ip++; forwardH = LZ4_HASH64K_VALUE(ip); } _last_literals: // Encode Last Literals { int lastRun = (int)(iend - anchor); if (op + lastRun + 1 + (lastRun-RUN_MASK+255)/255 > oend) return 0; if (lastRun>=(int)RUN_MASK) { *op++=(RUN_MASK<<ML_BITS); lastRun-=RUN_MASK; for(; lastRun > 254 ; lastRun-=255) *op++ = 255; *op++ = (BYTE) lastRun; } else *op++ = (lastRun<<ML_BITS); memcpy(op, anchor, iend - anchor); op += iend-anchor; } // End return (int) (((char*)op)-dest); } int LZ4_compress_limitedOutput(const char* source, char* dest, int isize, int maxOutputSize) { #if HEAPMODE void* ctx = malloc(sizeof(struct refTables)); int result; if (isize < LZ4_64KLIMIT) result = LZ4_compress64kCtx(&ctx, source, dest, isize, maxOutputSize); else result = LZ4_compressCtx(&ctx, source, dest, isize, maxOutputSize); free(ctx); return result; #else if (isize < (int)LZ4_64KLIMIT) return LZ4_compress64kCtx(NULL, source, dest, isize, maxOutputSize); return LZ4_compressCtx(NULL, source, dest, isize, maxOutputSize); #endif } int LZ4_compress(const char* source, char* dest, int isize) { return LZ4_compress_limitedOutput(source, dest, isize, LZ4_compressBound(isize)); } //**************************** // Decompression functions //**************************** // Note : The decoding functions LZ4_uncompress() and LZ4_uncompress_unknownOutputSize() // are safe against "buffer overflow" attack type. // They will never write nor read outside of the provided output buffers. // LZ4_uncompress_unknownOutputSize() also insures that it will never read outside of the input buffer. // A corrupted input will produce an error result, a negative int, indicating the position of the error within input stream. int LZ4_uncompress(const char* source, char* dest, int osize) { // Local Variables const BYTE* restrict ip = (const BYTE*) source; const BYTE* ref; BYTE* op = (BYTE*) dest; BYTE* const oend = op + osize; BYTE* cpy; unsigned token; size_t length; size_t dec32table[] = {0, 3, 2, 3, 0, 0, 0, 0}; #if LZ4_ARCH64 size_t dec64table[] = {0, 0, 0, -1, 0, 1, 2, 3}; #endif // Main Loop while (1) { // get runlength token = *ip++; if ((length=(token>>ML_BITS)) == RUN_MASK) { size_t len; for (;(len=*ip++)==255;length+=255){} length += len; } // copy literals cpy = op+length; if unlikely(cpy>oend-COPYLENGTH) { if (cpy != oend) goto _output_error; // Error : not enough place for another match (min 4) + 5 literals memcpy(op, ip, length); ip += length; break; // EOF } LZ4_WILDCOPY(ip, op, cpy); ip -= (op-cpy); op = cpy; // get offset LZ4_READ_LITTLEENDIAN_16(ref,cpy,ip); ip+=2; if unlikely(ref < (BYTE* const)dest) goto _output_error; // Error : offset create reference outside destination buffer // get matchlength if ((length=(token&ML_MASK)) == ML_MASK) { for (;*ip==255;length+=255) {ip++;} length += *ip++; } // copy repeated sequence if unlikely((op-ref)<STEPSIZE) { #if LZ4_ARCH64 size_t dec64 = dec64table[op-ref]; #else const int dec64 = 0; #endif op[0] = ref[0]; op[1] = ref[1]; op[2] = ref[2]; op[3] = ref[3]; op += 4, ref += 4; ref -= dec32table[op-ref]; A32(op) = A32(ref); op += STEPSIZE-4; ref -= dec64; } else { LZ4_COPYSTEP(ref,op); } cpy = op + length - (STEPSIZE-4); if (cpy>oend-COPYLENGTH) { if (cpy > oend) goto _output_error; // Error : request to write beyond destination buffer LZ4_SECURECOPY(ref, op, (oend-COPYLENGTH)); while(op<cpy) *op++=*ref++; op=cpy; if (op == oend) goto _output_error; // Check EOF (should never happen, since last 5 bytes are supposed to be literals) continue; } LZ4_SECURECOPY(ref, op, cpy); op=cpy; // correction } // end of decoding return (int) (((char*)ip)-source); // write overflow error detected _output_error: return (int) (-(((char*)ip)-source)); } int LZ4_uncompress_unknownOutputSize( const char* source, char* dest, int isize, int maxOutputSize) { // Local Variables const BYTE* restrict ip = (const BYTE*) source; const BYTE* const iend = ip + isize; const BYTE* ref; BYTE* op = (BYTE*) dest; BYTE* const oend = op + maxOutputSize; BYTE* cpy; size_t dec32table[] = {0, 3, 2, 3, 0, 0, 0, 0}; #if LZ4_ARCH64 size_t dec64table[] = {0, 0, 0, -1, 0, 1, 2, 3}; #endif // Main Loop while (ip<iend) { unsigned token; size_t length; // get runlength token = *ip++; if ((length=(token>>ML_BITS)) == RUN_MASK) { int s=255; while ((ip<iend) && (s==255)) { s=*ip++; length += s; } } // copy literals cpy = op+length; if ((cpy>oend-COPYLENGTH) || (ip+length>iend-COPYLENGTH)) { if (cpy > oend) goto _output_error; // Error : writes beyond output buffer if (ip+length != iend) goto _output_error; // Error : LZ4 format requires to consume all input at this stage memcpy(op, ip, length); op += length; break; // Necessarily EOF, due to parsing restrictions } LZ4_WILDCOPY(ip, op, cpy); ip -= (op-cpy); op = cpy; // get offset LZ4_READ_LITTLEENDIAN_16(ref,cpy,ip); ip+=2; if (ref < (BYTE* const)dest) goto _output_error; // Error : offset creates reference outside of destination buffer // get matchlength if ((length=(token&ML_MASK)) == ML_MASK) { while (ip<iend) { int s = *ip++; length +=s; if (s==255) continue; break; } } // copy repeated sequence if unlikely(op-ref<STEPSIZE) { #if LZ4_ARCH64 size_t dec64 = dec64table[op-ref]; #else const int dec64 = 0; #endif op[0] = ref[0]; op[1] = ref[1]; op[2] = ref[2]; op[3] = ref[3]; op += 4, ref += 4; ref -= dec32table[op-ref]; A32(op) = A32(ref); op += STEPSIZE-4; ref -= dec64; } else { LZ4_COPYSTEP(ref,op); } cpy = op + length - (STEPSIZE-4); if (cpy>oend-COPYLENGTH) { if (cpy > oend) goto _output_error; // Error : request to write outside of destination buffer LZ4_SECURECOPY(ref, op, (oend-COPYLENGTH)); while(op<cpy) *op++=*ref++; op=cpy; if (op == oend) goto _output_error; // Check EOF (should never happen, since last 5 bytes are supposed to be literals) continue; } LZ4_SECURECOPY(ref, op, cpy); op=cpy; // correction } // end of decoding return (int) (((char*)op)-dest); // write overflow error detected _output_error: return (int) (-(((char*)ip)-source)); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lz4/lz4hc.c������������������������������������������������������0000644�0001750�0001750�00000055376�12320456500�020325� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* LZ4 HC - High Compression Mode of LZ4 Copyright (C) 2011-2012, Yann Collet. BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. You can contact the author at : - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html - LZ4 source repository : http://code.google.com/p/lz4/ */ //************************************** // CPU Feature Detection //************************************** // 32 or 64 bits ? #if (defined(__x86_64__) || defined(__x86_64) || defined(__amd64__) || defined(__amd64) || defined(__ppc64__) || defined(_WIN64) || defined(__LP64__) || defined(_LP64) ) // Detects 64 bits mode # define LZ4_ARCH64 1 #else # define LZ4_ARCH64 0 #endif // Little Endian or Big Endian ? // Overwrite the #define below if you know your architecture endianess #if defined (__GLIBC__) # include <endian.h> # if (__BYTE_ORDER == __BIG_ENDIAN) # define LZ4_BIG_ENDIAN 1 # endif #elif (defined(__BIG_ENDIAN__) || defined(__BIG_ENDIAN) || defined(_BIG_ENDIAN)) && !(defined(__LITTLE_ENDIAN__) || defined(__LITTLE_ENDIAN) || defined(_LITTLE_ENDIAN)) # define LZ4_BIG_ENDIAN 1 #elif defined(__sparc) || defined(__sparc__) \ || defined(__ppc__) || defined(_POWER) || defined(__powerpc__) || defined(_ARCH_PPC) || defined(__PPC__) || defined(__PPC) || defined(PPC) || defined(__powerpc__) || defined(__powerpc) || defined(powerpc) \ || defined(__hpux) || defined(__hppa) \ || defined(_MIPSEB) || defined(__s390__) # define LZ4_BIG_ENDIAN 1 #else // Little Endian assumed. PDP Endian and other very rare endian format are unsupported. #endif // Unaligned memory access is automatically enabled for "common" CPU, such as x86. // For others CPU, the compiler will be more cautious, and insert extra code to ensure aligned access is respected // If you know your target CPU supports unaligned memory access, you want to force this option manually to improve performance #if defined(__ARM_FEATURE_UNALIGNED) # define LZ4_FORCE_UNALIGNED_ACCESS 1 #endif // Define this parameter if your target system or compiler does not support hardware bit count #if defined(_MSC_VER) && defined(_WIN32_WCE) // Visual Studio for Windows CE does not support Hardware bit count # define LZ4_FORCE_SW_BITCOUNT #endif //************************************** // Compiler Options //************************************** #if __STDC_VERSION__ >= 199901L // C99 /* "restrict" is a known keyword */ #else # define restrict // Disable restrict #endif #ifdef _MSC_VER # define inline __inline // Visual is not C99, but supports some kind of inline # define forceinline __forceinline # include <intrin.h> // For Visual 2005 # if LZ4_ARCH64 // 64-bit # pragma intrinsic(_BitScanForward64) // For Visual 2005 # pragma intrinsic(_BitScanReverse64) // For Visual 2005 # else # pragma intrinsic(_BitScanForward) // For Visual 2005 # pragma intrinsic(_BitScanReverse) // For Visual 2005 # endif #else # ifdef __GNUC__ # define forceinline inline __attribute__((always_inline)) # else # define forceinline inline # endif #endif #ifdef _MSC_VER // Visual Studio #define lz4_bswap16(x) _byteswap_ushort(x) #else #define lz4_bswap16(x) ((unsigned short int) ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8))) #endif //************************************** // Includes //************************************** #include <stdlib.h> // calloc, free #include <string.h> // memset, memcpy #include "lz4hc.h" #define ALLOCATOR(s) calloc(1,s) #define FREEMEM free #define MEM_INIT memset //************************************** // Basic Types //************************************** #if defined(_MSC_VER) // Visual Studio does not support 'stdint' natively #define BYTE unsigned __int8 #define U16 unsigned __int16 #define U32 unsigned __int32 #define S32 __int32 #define U64 unsigned __int64 #else #include <stdint.h> #define BYTE uint8_t #define U16 uint16_t #define U32 uint32_t #define S32 int32_t #define U64 uint64_t #endif #ifndef LZ4_FORCE_UNALIGNED_ACCESS #pragma pack(push, 1) #endif typedef struct _U16_S { U16 v; } U16_S; typedef struct _U32_S { U32 v; } U32_S; typedef struct _U64_S { U64 v; } U64_S; #ifndef LZ4_FORCE_UNALIGNED_ACCESS #pragma pack(pop) #endif #define A64(x) (((U64_S *)(x))->v) #define A32(x) (((U32_S *)(x))->v) #define A16(x) (((U16_S *)(x))->v) //************************************** // Constants //************************************** #define MINMATCH 4 #define DICTIONARY_LOGSIZE 16 #define MAXD (1<<DICTIONARY_LOGSIZE) #define MAXD_MASK ((U32)(MAXD - 1)) #define MAX_DISTANCE (MAXD - 1) #define HASH_LOG (DICTIONARY_LOGSIZE-1) #define HASHTABLESIZE (1 << HASH_LOG) #define HASH_MASK (HASHTABLESIZE - 1) #define MAX_NB_ATTEMPTS 256 #define ML_BITS 4 #define ML_MASK (size_t)((1U<<ML_BITS)-1) #define RUN_BITS (8-ML_BITS) #define RUN_MASK ((1U<<RUN_BITS)-1) #define COPYLENGTH 8 #define LASTLITERALS 5 #define MFLIMIT (COPYLENGTH+MINMATCH) #define MINLENGTH (MFLIMIT+1) #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH) //************************************** // Architecture-specific macros //************************************** #if LZ4_ARCH64 // 64-bit #define STEPSIZE 8 #define LZ4_COPYSTEP(s,d) A64(d) = A64(s); d+=8; s+=8; #define LZ4_COPYPACKET(s,d) LZ4_COPYSTEP(s,d) #define UARCH U64 #define AARCH A64 #define HTYPE U32 #define INITBASE(b,s) const BYTE* const b = s #else // 32-bit #define STEPSIZE 4 #define LZ4_COPYSTEP(s,d) A32(d) = A32(s); d+=4; s+=4; #define LZ4_COPYPACKET(s,d) LZ4_COPYSTEP(s,d); LZ4_COPYSTEP(s,d); #define UARCH U32 #define AARCH A32 #define HTYPE const BYTE* #define INITBASE(b,s) const int b = 0 #endif #if defined(LZ4_BIG_ENDIAN) #define LZ4_READ_LITTLEENDIAN_16(d,s,p) { U16 v = A16(p); v = lz4_bswap16(v); d = (s) - v; } #define LZ4_WRITE_LITTLEENDIAN_16(p,i) { U16 v = (U16)(i); v = lz4_bswap16(v); A16(p) = v; p+=2; } #else // Little Endian #define LZ4_READ_LITTLEENDIAN_16(d,s,p) { d = (s) - A16(p); } #define LZ4_WRITE_LITTLEENDIAN_16(p,v) { A16(p) = v; p+=2; } #endif //************************************************************ // Local Types //************************************************************ typedef struct { const BYTE* base; HTYPE hashTable[HASHTABLESIZE]; U16 chainTable[MAXD]; const BYTE* nextToUpdate; } LZ4HC_Data_Structure; //************************************** // Macros //************************************** #define LZ4_WILDCOPY(s,d,e) do { LZ4_COPYPACKET(s,d) } while (d<e); #define LZ4_BLINDCOPY(s,d,l) { BYTE* e=d+l; LZ4_WILDCOPY(s,d,e); d=e; } #define HASH_FUNCTION(i) (((i) * 2654435761U) >> ((MINMATCH*8)-HASH_LOG)) #define HASH_VALUE(p) HASH_FUNCTION(A32(p)) #define HASH_POINTER(p) (HashTable[HASH_VALUE(p)] + base) #define DELTANEXT(p) chainTable[(size_t)(p) & MAXD_MASK] #define GETNEXT(p) ((p) - (size_t)DELTANEXT(p)) //************************************** // Private functions //************************************** #if LZ4_ARCH64 inline static int LZ4_NbCommonBytes (register U64 val) { #if defined(LZ4_BIG_ENDIAN) #if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) unsigned long r = 0; _BitScanReverse64( &r, val ); return (int)(r>>3); #elif defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304) && !defined(LZ4_FORCE_SW_BITCOUNT) return (__builtin_clzll(val) >> 3); #else int r; if (!(val>>32)) { r=4; } else { r=0; val>>=32; } if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; } r += (!val); return r; #endif #else #if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) unsigned long r = 0; _BitScanForward64( &r, val ); return (int)(r>>3); #elif defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304) && !defined(LZ4_FORCE_SW_BITCOUNT) return (__builtin_ctzll(val) >> 3); #else static const int DeBruijnBytePos[64] = { 0, 0, 0, 0, 0, 1, 1, 2, 0, 3, 1, 3, 1, 4, 2, 7, 0, 2, 3, 6, 1, 5, 3, 5, 1, 3, 4, 4, 2, 5, 6, 7, 7, 0, 1, 2, 3, 3, 4, 6, 2, 6, 5, 5, 3, 4, 5, 6, 7, 1, 2, 4, 6, 4, 4, 5, 7, 2, 6, 5, 7, 6, 7, 7 }; return DeBruijnBytePos[((U64)((val & -val) * 0x0218A392CDABBD3F)) >> 58]; #endif #endif } #else inline static int LZ4_NbCommonBytes (register U32 val) { #if defined(LZ4_BIG_ENDIAN) #if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) unsigned long r; _BitScanReverse( &r, val ); return (int)(r>>3); #elif defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304) && !defined(LZ4_FORCE_SW_BITCOUNT) return (__builtin_clz(val) >> 3); #else int r; if (!(val>>16)) { r=2; val>>=8; } else { r=0; val>>=24; } r += (!val); return r; #endif #else #if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) unsigned long r; _BitScanForward( &r, val ); return (int)(r>>3); #elif defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304) && !defined(LZ4_FORCE_SW_BITCOUNT) return (__builtin_ctz(val) >> 3); #else static const int DeBruijnBytePos[32] = { 0, 0, 3, 0, 3, 1, 3, 0, 3, 2, 2, 1, 3, 2, 0, 1, 3, 3, 1, 2, 2, 2, 2, 0, 3, 1, 2, 0, 1, 0, 1, 1 }; return DeBruijnBytePos[((U32)((val & -(S32)val) * 0x077CB531U)) >> 27]; #endif #endif } #endif inline static int LZ4HC_Init (LZ4HC_Data_Structure* hc4, const BYTE* base) { MEM_INIT((void*)hc4->hashTable, 0, sizeof(hc4->hashTable)); MEM_INIT(hc4->chainTable, 0xFF, sizeof(hc4->chainTable)); hc4->nextToUpdate = base + LZ4_ARCH64; hc4->base = base; return 1; } inline static void* LZ4HC_Create (const BYTE* base) { void* hc4 = ALLOCATOR(sizeof(LZ4HC_Data_Structure)); LZ4HC_Init ((LZ4HC_Data_Structure*)hc4, base); return hc4; } inline static int LZ4HC_Free (void** LZ4HC_Data) { FREEMEM(*LZ4HC_Data); *LZ4HC_Data = NULL; return (1); } // Update chains up to ip (excluded) forceinline static void LZ4HC_Insert (LZ4HC_Data_Structure* hc4, const BYTE* ip) { U16* chainTable = hc4->chainTable; HTYPE* HashTable = hc4->hashTable; INITBASE(base,hc4->base); while(hc4->nextToUpdate < ip) { const BYTE* p = hc4->nextToUpdate; size_t delta = (p) - HASH_POINTER(p); if (delta>MAX_DISTANCE) delta = MAX_DISTANCE; DELTANEXT(p) = (U16)delta; HashTable[HASH_VALUE(p)] = (p) - base; hc4->nextToUpdate++; } } forceinline static size_t LZ4HC_CommonLength (const BYTE* p1, const BYTE* p2, const BYTE* const matchlimit) { const BYTE* p1t = p1; while (p1t<matchlimit-(STEPSIZE-1)) { UARCH diff = AARCH(p2) ^ AARCH(p1t); if (!diff) { p1t+=STEPSIZE; p2+=STEPSIZE; continue; } p1t += LZ4_NbCommonBytes(diff); return (p1t - p1); } if (LZ4_ARCH64) if ((p1t<(matchlimit-3)) && (A32(p2) == A32(p1t))) { p1t+=4; p2+=4; } if ((p1t<(matchlimit-1)) && (A16(p2) == A16(p1t))) { p1t+=2; p2+=2; } if ((p1t<matchlimit) && (*p2 == *p1t)) p1t++; return (p1t - p1); } forceinline static int LZ4HC_InsertAndFindBestMatch (LZ4HC_Data_Structure* hc4, const BYTE* ip, const BYTE* const matchlimit, const BYTE** matchpos) { U16* const chainTable = hc4->chainTable; HTYPE* const HashTable = hc4->hashTable; const BYTE* ref; INITBASE(base,hc4->base); int nbAttempts=MAX_NB_ATTEMPTS; size_t ml=0; // HC4 match finder LZ4HC_Insert(hc4, ip); ref = HASH_POINTER(ip); #if 1 if (ref >= ip-4) // potential repetition { if (A32(ref) == A32(ip)) // confirmed { const U16 delta = (U16)(ip-ref); const BYTE* ptr = ip; const BYTE* end; ml = LZ4HC_CommonLength(ip+MINMATCH, ref+MINMATCH, matchlimit) + MINMATCH; end = ip + ml - (MINMATCH-1); while(ptr < end-delta) { DELTANEXT(ptr) = delta; // Pre-Load ptr++; } do { DELTANEXT(ptr) = delta; HashTable[HASH_VALUE(ptr)] = (ptr) - base; // Head of chain ptr++; } while(ptr < end); hc4->nextToUpdate = end; *matchpos = ref; } ref = GETNEXT(ref); } #endif while ((ref >= (ip-MAX_DISTANCE)) && (nbAttempts)) { nbAttempts--; if (*(ref+ml) == *(ip+ml)) if (A32(ref) == A32(ip)) { size_t mlt = LZ4HC_CommonLength(ip+MINMATCH, ref+MINMATCH, matchlimit) + MINMATCH; if (mlt > ml) { ml = mlt; *matchpos = ref; } } ref = GETNEXT(ref); } return (int)ml; } forceinline static int LZ4HC_InsertAndGetWiderMatch (LZ4HC_Data_Structure* hc4, const BYTE* ip, const BYTE* startLimit, const BYTE* matchlimit, int longest, const BYTE** matchpos, const BYTE** startpos) { U16* const chainTable = hc4->chainTable; HTYPE* const HashTable = hc4->hashTable; INITBASE(base,hc4->base); const BYTE* ref; int nbAttempts = MAX_NB_ATTEMPTS; int delta = (int)(ip-startLimit); // First Match LZ4HC_Insert(hc4, ip); ref = HASH_POINTER(ip); while ((ref >= ip-MAX_DISTANCE) && (ref >= hc4->base) && (nbAttempts)) { nbAttempts--; if (*(startLimit + longest) == *(ref - delta + longest)) if (A32(ref) == A32(ip)) { #if 1 const BYTE* reft = ref+MINMATCH; const BYTE* ipt = ip+MINMATCH; const BYTE* startt = ip; while (ipt<matchlimit-(STEPSIZE-1)) { UARCH diff = AARCH(reft) ^ AARCH(ipt); if (!diff) { ipt+=STEPSIZE; reft+=STEPSIZE; continue; } ipt += LZ4_NbCommonBytes(diff); goto _endCount; } if (LZ4_ARCH64) if ((ipt<(matchlimit-3)) && (A32(reft) == A32(ipt))) { ipt+=4; reft+=4; } if ((ipt<(matchlimit-1)) && (A16(reft) == A16(ipt))) { ipt+=2; reft+=2; } if ((ipt<matchlimit) && (*reft == *ipt)) ipt++; _endCount: reft = ref; #else // Easier for code maintenance, but unfortunately slower too const BYTE* startt = ip; const BYTE* reft = ref; const BYTE* ipt = ip + MINMATCH + LZ4HC_CommonLength(ip+MINMATCH, ref+MINMATCH, matchlimit); #endif while ((startt>startLimit) && (reft > hc4->base) && (startt[-1] == reft[-1])) {startt--; reft--;} if ((ipt-startt) > longest) { longest = (int)(ipt-startt); *matchpos = reft; *startpos = startt; } } ref = GETNEXT(ref); } return longest; } forceinline static int LZ4_encodeSequence(const BYTE** ip, BYTE** op, const BYTE** anchor, int ml, const BYTE* ref) { int length, len; BYTE* token; // Encode Literal length length = (int)(*ip - *anchor); token = (*op)++; if (length>=(int)RUN_MASK) { *token=(RUN_MASK<<ML_BITS); len = length-RUN_MASK; for(; len > 254 ; len-=255) *(*op)++ = 255; *(*op)++ = (BYTE)len; } else *token = (length<<ML_BITS); // Copy Literals LZ4_BLINDCOPY(*anchor, *op, length); // Encode Offset LZ4_WRITE_LITTLEENDIAN_16(*op,(U16)(*ip-ref)); // Encode MatchLength len = (int)(ml-MINMATCH); if (len>=(int)ML_MASK) { *token+=ML_MASK; len-=ML_MASK; for(; len > 509 ; len-=510) { *(*op)++ = 255; *(*op)++ = 255; } if (len > 254) { len-=255; *(*op)++ = 255; } *(*op)++ = (BYTE)len; } else *token += len; // Prepare next loop *ip += ml; *anchor = *ip; return 0; } //**************************** // Compression CODE //**************************** int LZ4_compressHCCtx(LZ4HC_Data_Structure* ctx, const char* source, char* dest, int isize) { const BYTE* ip = (const BYTE*) source; const BYTE* anchor = ip; const BYTE* const iend = ip + isize; const BYTE* const mflimit = iend - MFLIMIT; const BYTE* const matchlimit = (iend - LASTLITERALS); BYTE* op = (BYTE*) dest; int ml, ml2, ml3, ml0; const BYTE* ref=NULL; const BYTE* start2=NULL; const BYTE* ref2=NULL; const BYTE* start3=NULL; const BYTE* ref3=NULL; const BYTE* start0; const BYTE* ref0; ip++; // Main Loop while (ip < mflimit) { ml = LZ4HC_InsertAndFindBestMatch (ctx, ip, matchlimit, (&ref)); if (!ml) { ip++; continue; } // saved, in case we would skip too much start0 = ip; ref0 = ref; ml0 = ml; _Search2: if (ip+ml < mflimit) ml2 = LZ4HC_InsertAndGetWiderMatch(ctx, ip + ml - 2, ip + 1, matchlimit, ml, &ref2, &start2); else ml2=ml; if (ml2 == ml) // No better match { LZ4_encodeSequence(&ip, &op, &anchor, ml, ref); continue; } if (start0 < ip) { if (start2 < ip + ml0) // empirical { ip = start0; ref = ref0; ml = ml0; } } // Here, start0==ip if ((start2 - ip) < 3) // First Match too small : removed { ml = ml2; ip = start2; ref =ref2; goto _Search2; } _Search3: // Currently we have : // ml2 > ml1, and // ip1+3 <= ip2 (usually < ip1+ml1) if ((start2 - ip) < OPTIMAL_ML) { int correction; int new_ml = ml; if (new_ml > OPTIMAL_ML) new_ml = OPTIMAL_ML; if (ip+new_ml > start2 + ml2 - MINMATCH) new_ml = (int)(start2 - ip) + ml2 - MINMATCH; correction = new_ml - (int)(start2 - ip); if (correction > 0) { start2 += correction; ref2 += correction; ml2 -= correction; } } // Now, we have start2 = ip+new_ml, with new_ml=min(ml, OPTIMAL_ML=18) if (start2 + ml2 < mflimit) ml3 = LZ4HC_InsertAndGetWiderMatch(ctx, start2 + ml2 - 3, start2, matchlimit, ml2, &ref3, &start3); else ml3=ml2; if (ml3 == ml2) // No better match : 2 sequences to encode { // ip & ref are known; Now for ml if (start2 < ip+ml) { if ((start2 - ip) < OPTIMAL_ML) { int correction; if (ml > OPTIMAL_ML) ml = OPTIMAL_ML; if (ip+ml > start2 + ml2 - MINMATCH) ml = (int)(start2 - ip) + ml2 - MINMATCH; correction = ml - (int)(start2 - ip); if (correction > 0) { start2 += correction; ref2 += correction; ml2 -= correction; } } else { ml = (int)(start2 - ip); } } // Now, encode 2 sequences LZ4_encodeSequence(&ip, &op, &anchor, ml, ref); ip = start2; LZ4_encodeSequence(&ip, &op, &anchor, ml2, ref2); continue; } if (start3 < ip+ml+3) // Not enough space for match 2 : remove it { if (start3 >= (ip+ml)) // can write Seq1 immediately ==> Seq2 is removed, so Seq3 becomes Seq1 { if (start2 < ip+ml) { int correction = (int)(ip+ml - start2); start2 += correction; ref2 += correction; ml2 -= correction; if (ml2 < MINMATCH) { start2 = start3; ref2 = ref3; ml2 = ml3; } } LZ4_encodeSequence(&ip, &op, &anchor, ml, ref); ip = start3; ref = ref3; ml = ml3; start0 = start2; ref0 = ref2; ml0 = ml2; goto _Search2; } start2 = start3; ref2 = ref3; ml2 = ml3; goto _Search3; } // OK, now we have 3 ascending matches; let's write at least the first one // ip & ref are known; Now for ml if (start2 < ip+ml) { if ((start2 - ip) < (int)ML_MASK) { int correction; if (ml > OPTIMAL_ML) ml = OPTIMAL_ML; if (ip + ml > start2 + ml2 - MINMATCH) ml = (int)(start2 - ip) + ml2 - MINMATCH; correction = ml - (int)(start2 - ip); if (correction > 0) { start2 += correction; ref2 += correction; ml2 -= correction; } } else { ml = (int)(start2 - ip); } } LZ4_encodeSequence(&ip, &op, &anchor, ml, ref); ip = start2; ref = ref2; ml = ml2; start2 = start3; ref2 = ref3; ml2 = ml3; goto _Search3; } // Encode Last Literals { int lastRun = (int)(iend - anchor); if (lastRun>=(int)RUN_MASK) { *op++=(RUN_MASK<<ML_BITS); lastRun-=RUN_MASK; for(; lastRun > 254 ; lastRun-=255) *op++ = 255; *op++ = (BYTE) lastRun; } else *op++ = (lastRun<<ML_BITS); memcpy(op, anchor, iend - anchor); op += iend-anchor; } // End return (int) (((char*)op)-dest); } int LZ4_compressHC(const char* source, char* dest, int isize) { void* ctx = LZ4HC_Create((const BYTE*)source); int result = LZ4_compressHCCtx(ctx, source, dest, isize); LZ4HC_Free (&ctx); return result; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/lz4/lz4hc.h������������������������������������������������������0000644�0001750�0001750�00000004273�12320456500�020320� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* LZ4 HC - High Compression Mode of LZ4 Header File Copyright (C) 2011-2012, Yann Collet. BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. You can contact the author at : - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html - LZ4 source repository : http://code.google.com/p/lz4/ */ #pragma once #if defined (__cplusplus) extern "C" { #endif int LZ4_compressHC (const char* source, char* dest, int isize); /* LZ4_compressHC : return : the number of bytes in compressed buffer dest note : destination buffer must be already allocated. To avoid any problem, size it to handle worst cases situations (input data not compressible) Worst case size evaluation is provided by function LZ4_compressBound() (see "lz4.h") */ /* Note : Decompression functions are provided within regular LZ4 source code (see "lz4.h") (BSD license) */ #if defined (__cplusplus) } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/�����������������������������������������������������������0000755�0001750�0001750�00000000000�12320456500�017532� 5����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/TUVOK_README�����������������������������������������������0000644�0001750�0001750�00000001107�12320456500�021401� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������This is a small and relatively arbitrary subset of the Boost libraries which we have found useful in developing Tuvok. The full Boost distribution is available online: http://www.boost.org/ If you want to use any of this code in your own software, we strongly discourage you from using this version of the source. Tuvok and Boost are distributed under different but compatible license; for more details, visit http://www.boost.org/users/license.html for more information. Please report issues with this code to the Tuvok development team, NOT the Boost library maintainers! ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/�����������������������������������������������������0000755�0001750�0001750�00000000000�12320456500�020660� 5����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config.hpp�������������������������������������������0000644�0001750�0001750�00000004002�12320456500�022632� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Boost config.hpp configuration header file ------------------------------// // (C) Copyright John Maddock 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/config for most recent version. // Boost config.hpp policy and rationale documentation has been moved to // http://www.boost.org/libs/config // // CAUTION: This file is intended to be completely stable - // DO NOT MODIFY THIS FILE! // #ifndef BOOST_CONFIG_HPP #define BOOST_CONFIG_HPP // if we don't have a user config, then use the default location: #if !defined(BOOST_USER_CONFIG) && !defined(BOOST_NO_USER_CONFIG) # define BOOST_USER_CONFIG <boost/config/user.hpp> #endif // include it first: #ifdef BOOST_USER_CONFIG # include BOOST_USER_CONFIG #endif // if we don't have a compiler config set, try and find one: #if !defined(BOOST_COMPILER_CONFIG) && !defined(BOOST_NO_COMPILER_CONFIG) && !defined(BOOST_NO_CONFIG) # include <boost/config/select_compiler_config.hpp> #endif // if we have a compiler config, include it now: #ifdef BOOST_COMPILER_CONFIG # include BOOST_COMPILER_CONFIG #endif // if we don't have a std library config set, try and find one: #if !defined(BOOST_STDLIB_CONFIG) && !defined(BOOST_NO_STDLIB_CONFIG) && !defined(BOOST_NO_CONFIG) # include <boost/config/select_stdlib_config.hpp> #endif // if we have a std library config, include it now: #ifdef BOOST_STDLIB_CONFIG # include BOOST_STDLIB_CONFIG #endif // if we don't have a platform config set, try and find one: #if !defined(BOOST_PLATFORM_CONFIG) && !defined(BOOST_NO_PLATFORM_CONFIG) && !defined(BOOST_NO_CONFIG) # include <boost/config/select_platform_config.hpp> #endif // if we have a platform config, include it now: #ifdef BOOST_PLATFORM_CONFIG # include BOOST_PLATFORM_CONFIG #endif // get config suffix code: #include <boost/config/suffix.hpp> #endif // BOOST_CONFIG_HPP ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/type.hpp���������������������������������������������0000644�0001750�0001750�00000000741�12320456500�022354� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright David Abrahams 2001. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_TYPE_DWA20010120_HPP # define BOOST_TYPE_DWA20010120_HPP namespace boost { // Just a simple "type envelope". Useful in various contexts, mostly to work // around some MSVC deficiencies. template <class T> struct type {}; } #endif // BOOST_TYPE_DWA20010120_HPP �������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/limits.hpp�������������������������������������������0000644�0001750�0001750�00000013747�12320456500�022706� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� // (C) Copyright John maddock 1999. // (C) David Abrahams 2002. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // use this header as a workaround for missing <limits> // See http://www.boost.org/libs/compatibility/index.html for documentation. #ifndef BOOST_LIMITS #define BOOST_LIMITS #include <boost/config.hpp> #ifdef BOOST_NO_LIMITS # include <boost/detail/limits.hpp> #else # include <limits> #endif #if (defined(BOOST_HAS_LONG_LONG) && defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS)) \ || (defined(BOOST_HAS_MS_INT64) && defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS)) // Add missing specializations for numeric_limits: #ifdef BOOST_HAS_MS_INT64 # define BOOST_LLT __int64 # define BOOST_ULLT unsigned __int64 #else # define BOOST_LLT ::boost::long_long_type # define BOOST_ULLT ::boost::ulong_long_type #endif #include <climits> // for CHAR_BIT namespace std { template<> class numeric_limits<BOOST_LLT> { public: BOOST_STATIC_CONSTANT(bool, is_specialized = true); #ifdef BOOST_HAS_MS_INT64 static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0x8000000000000000i64; } static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0x7FFFFFFFFFFFFFFFi64; } #elif defined(LLONG_MAX) static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LLONG_MIN; } static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LLONG_MAX; } #elif defined(LONGLONG_MAX) static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LONGLONG_MIN; } static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LONGLONG_MAX; } #else static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 1LL << (sizeof(BOOST_LLT) * CHAR_BIT - 1); } static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ~(min)(); } #endif BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT -1); BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT) - 1) * 301L / 1000); BOOST_STATIC_CONSTANT(bool, is_signed = true); BOOST_STATIC_CONSTANT(bool, is_integer = true); BOOST_STATIC_CONSTANT(bool, is_exact = true); BOOST_STATIC_CONSTANT(int, radix = 2); static BOOST_LLT epsilon() throw() { return 0; }; static BOOST_LLT round_error() throw() { return 0; }; BOOST_STATIC_CONSTANT(int, min_exponent = 0); BOOST_STATIC_CONSTANT(int, min_exponent10 = 0); BOOST_STATIC_CONSTANT(int, max_exponent = 0); BOOST_STATIC_CONSTANT(int, max_exponent10 = 0); BOOST_STATIC_CONSTANT(bool, has_infinity = false); BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false); BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false); BOOST_STATIC_CONSTANT(bool, has_denorm = false); BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false); static BOOST_LLT infinity() throw() { return 0; }; static BOOST_LLT quiet_NaN() throw() { return 0; }; static BOOST_LLT signaling_NaN() throw() { return 0; }; static BOOST_LLT denorm_min() throw() { return 0; }; BOOST_STATIC_CONSTANT(bool, is_iec559 = false); BOOST_STATIC_CONSTANT(bool, is_bounded = true); BOOST_STATIC_CONSTANT(bool, is_modulo = true); BOOST_STATIC_CONSTANT(bool, traps = false); BOOST_STATIC_CONSTANT(bool, tinyness_before = false); BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero); }; template<> class numeric_limits<BOOST_ULLT> { public: BOOST_STATIC_CONSTANT(bool, is_specialized = true); #ifdef BOOST_HAS_MS_INT64 static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0ui64; } static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0xFFFFFFFFFFFFFFFFui64; } #elif defined(ULLONG_MAX) && defined(ULLONG_MIN) static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULLONG_MIN; } static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULLONG_MAX; } #elif defined(ULONGLONG_MAX) && defined(ULONGLONG_MIN) static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULONGLONG_MIN; } static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULONGLONG_MAX; } #else static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0uLL; } static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ~0uLL; } #endif BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT); BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT)) * 301L / 1000); BOOST_STATIC_CONSTANT(bool, is_signed = false); BOOST_STATIC_CONSTANT(bool, is_integer = true); BOOST_STATIC_CONSTANT(bool, is_exact = true); BOOST_STATIC_CONSTANT(int, radix = 2); static BOOST_ULLT epsilon() throw() { return 0; }; static BOOST_ULLT round_error() throw() { return 0; }; BOOST_STATIC_CONSTANT(int, min_exponent = 0); BOOST_STATIC_CONSTANT(int, min_exponent10 = 0); BOOST_STATIC_CONSTANT(int, max_exponent = 0); BOOST_STATIC_CONSTANT(int, max_exponent10 = 0); BOOST_STATIC_CONSTANT(bool, has_infinity = false); BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false); BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false); BOOST_STATIC_CONSTANT(bool, has_denorm = false); BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false); static BOOST_ULLT infinity() throw() { return 0; }; static BOOST_ULLT quiet_NaN() throw() { return 0; }; static BOOST_ULLT signaling_NaN() throw() { return 0; }; static BOOST_ULLT denorm_min() throw() { return 0; }; BOOST_STATIC_CONSTANT(bool, is_iec559 = false); BOOST_STATIC_CONSTANT(bool, is_bounded = true); BOOST_STATIC_CONSTANT(bool, is_modulo = true); BOOST_STATIC_CONSTANT(bool, traps = false); BOOST_STATIC_CONSTANT(bool, tinyness_before = false); BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero); }; } #endif #endif �������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/non_type.hpp�����������������������������������������0000644�0001750�0001750�00000001153�12320456500�023224� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// ------------------------------------- // // (C) Copyright Gennaro Prota 2003. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // ------------------------------------------------------ #ifndef BOOST_NON_TYPE_HPP_GP_20030417 #define BOOST_NON_TYPE_HPP_GP_20030417 namespace boost { // Just a simple "envelope" for non-type template parameters. Useful // to work around some MSVC deficiencies. template <typename T, T n> struct non_type { }; } #endif // include guard ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/serialization/���������������������������������������0000755�0001750�0001750�00000000000�12320456500�023535� 5����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/serialization/singleton.hpp��������������������������0000644�0001750�0001750�00000010647�12320456500�026260� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef BOOST_SERIALIZATION_SINGLETON_HPP #define BOOST_SERIALIZATION_SINGLETON_HPP /////////1/////////2///////// 3/////////4/////////5/////////6/////////7/////////8 // singleton.hpp // // Copyright David Abrahams 2006. Original version // // Copyright Robert Ramey 2007. Changes made to permit // application throughout the serialization library. // // Distributed under the Boost // Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // The intention here is to define a template which will convert // any class into a singleton with the following features: // // a) initialized before first use. // b) thread-safe for const access to the class // c) non-locking // // In order to do this, // a) Initialize dynamically when used. // b) Require that all singletons be initialized before main // is called or any entry point into the shared library is invoked. // This guarentees no race condition for initialization. // In debug mode, we assert that no non-const functions are called // after main is invoked. // // MS compatible compilers support #pragma once #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif #include <cassert> #include <boost/noncopyable.hpp> #include <boost/serialization/force_include.hpp> namespace boost { namespace serialization { ////////////////////////////////////////////////////////////////////// // Provides a dynamically-initialized (singleton) instance of T in a // way that avoids LNK1179 on vc6. See http://tinyurl.com/ljdp8 or // http://lists.boost.org/Archives/boost/2006/05/105286.php for // details. // // singletons created by this code are guarenteed to be unique // within the executable or shared library which creates them. // This is sufficient and in fact ideal for the serialization library. // The singleton is created when the module is loaded and destroyed // when the module is unloaded. // This base class has two functions. // First it provides a module handle for each singleton indicating // the executable or shared library in which it was created. This // turns out to be necessary and sufficient to implement the tables // used by serialization library. // Second, it provides a mechanism to detect when a non-const function // is called after initialization. // make a singleton to lock/unlock all singletons for alteration. // The intent is that all singletons created/used by this code // are to be initialized before main is called. A test program // can lock all the singletons when main is entereed. This any // attempt to retieve a mutable instances while locked will // generate a assertion if compiled for debug. class singleton_module : public boost::noncopyable { private: static bool & get_lock(){ static bool lock = false; return lock; } public: // static const void * get_module_handle(){ // return static_cast<const void *>(get_module_handle); // } static void lock(){ get_lock() = true; } static void unlock(){ get_lock() = false; } static bool is_locked() { return get_lock(); } }; namespace detail { template<class T> class singleton_wrapper : public T { public: static bool m_is_destroyed; ~singleton_wrapper(){ m_is_destroyed = true; } }; template<class T> bool detail::singleton_wrapper<T>::m_is_destroyed = false; } // detail template <class T> class singleton : public singleton_module { private: BOOST_DLLEXPORT static T & instance; // include this to provoke instantiation at pre-execution time static void use(T const &) {} BOOST_DLLEXPORT static T & get_instance() { static detail::singleton_wrapper<T> t; // refer to instance, causing it to be instantiated (and // initialized at startup on working compilers) assert(! detail::singleton_wrapper<T>::m_is_destroyed); use(instance); return static_cast<T &>(t); } public: BOOST_DLLEXPORT static T & get_mutable_instance(){ assert(! is_locked()); return get_instance(); } BOOST_DLLEXPORT static const T & get_const_instance(){ return get_instance(); } BOOST_DLLEXPORT static bool is_destroyed(){ return detail::singleton_wrapper<T>::m_is_destroyed; } }; template<class T> BOOST_DLLEXPORT T & singleton<T>::instance = singleton<T>::get_instance(); } // namespace serialization } // namespace boost #endif // BOOST_SERIALIZATION_SINGLETON_HPP �����������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/serialization/force_include.hpp����������������������0000644�0001750�0001750�00000004032�12320456500�027046� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef BOOST_SERIALIZATION_FORCE_INCLUDE_HPP #define BOOST_SERIALIZATION_FORCE_INCLUDE_HPP // MS compatible compilers support #pragma once #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 // force_include.hpp: // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for updates, documentation, and revision history. #include <boost/config.hpp> // the following help macro is to guarentee that certain coded // is not removed by over-eager linker optimiser. In certain cases // we create static objects must be created but are actually never // referenced - creation has a side-effect such as global registration // which is important to us. We make an effort to refer these objects // so that a smart linker won't remove them as being unreferenced. // In microsoft compilers, inlining the code that does the referring // means the code gets lost and the static object is not included // in the library and hence never registered. This manifests itself // in an ungraceful crash at runtime when (and only when) built in // release mode. #if defined(BOOST_HAS_DECLSPEC) && !defined(__COMO__) # if defined(__BORLANDC__) # define BOOST_DLLEXPORT __export # else # define BOOST_DLLEXPORT __declspec(dllexport) # endif #elif ! defined(_WIN32) && ! defined(_WIN64) # if defined(__MWERKS__) # define BOOST_DLLEXPORT __declspec(dllexport) # elif defined(__GNUC__) && (__GNUC__ >= 3) # define BOOST_USED __attribute__ ((used)) # elif defined(__INTEL_COMPILER) && (BOOST_INTEL_CXX_VERSION >= 800) # define BOOST_USED __attribute__ ((used)) # endif #endif #ifndef BOOST_USED # define BOOST_USED #endif #ifndef BOOST_DLLEXPORT # define BOOST_DLLEXPORT #endif #endif // BOOST_SERIALIZATION_FORCE_INCLUDE_HPP ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/detail/����������������������������������������������0000755�0001750�0001750�00000000000�12320456500�022122� 5����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/detail/endian.hpp������������������������������������0000644�0001750�0001750�00000004636�12320456500�024102� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Copyright 2005 Caleb Epstein // Copyright 2006 John Maddock // Distributed under the Boost Software License, Version 1.0. (See accompany- // ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) /* * Copyright (c) 1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /* * Copyright notice reproduced from <boost/detail/limits.hpp>, from * which this code was originally taken. * * Modified by Caleb Epstein to use <endian.h> with GNU libc and to * defined the BOOST_ENDIAN macro. */ #ifndef BOOST_DETAIL_ENDIAN_HPP #define BOOST_DETAIL_ENDIAN_HPP // GNU libc offers the helpful header <endian.h> which defines // __BYTE_ORDER #if defined (__GLIBC__) # include <endian.h> # if (__BYTE_ORDER == __LITTLE_ENDIAN) # define BOOST_LITTLE_ENDIAN # elif (__BYTE_ORDER == __BIG_ENDIAN) # define BOOST_BIG_ENDIAN # elif (__BYTE_ORDER == __PDP_ENDIAN) # define BOOST_PDP_ENDIAN # else # error Unknown machine endianness detected. # endif # define BOOST_BYTE_ORDER __BYTE_ORDER #elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) # define BOOST_BIG_ENDIAN # define BOOST_BYTE_ORDER 4321 #elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) # define BOOST_LITTLE_ENDIAN # define BOOST_BYTE_ORDER 1234 #elif defined(__sparc) || defined(__sparc__) \ || defined(_POWER) || defined(__powerpc__) \ || defined(__ppc__) || defined(__hpux) \ || defined(_MIPSEB) || defined(_POWER) \ || defined(__s390__) # define BOOST_BIG_ENDIAN # define BOOST_BYTE_ORDER 4321 #elif defined(__i386__) || defined(__alpha__) \ || defined(__ia64) || defined(__ia64__) \ || defined(_M_IX86) || defined(_M_IA64) \ || defined(_M_ALPHA) || defined(__amd64) \ || defined(__amd64__) || defined(_M_AMD64) \ || defined(__x86_64) || defined(__x86_64__) \ || defined(_M_X64) || defined(__bfin__) # define BOOST_LITTLE_ENDIAN # define BOOST_BYTE_ORDER 1234 #else # error The file boost/detail/endian.hpp needs to be set up for your CPU type. #endif #endif ��������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/detail/limits.hpp������������������������������������0000644�0001750�0001750�00000040306�12320456500�024137� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Copyright 2001 John Maddock // Distributed under the Boost Software License, Version 1.0. (See accompany- // ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) /* * Copyright (c) 1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /* NOTE: This is not portable code. Parts of numeric_limits<> are * inherently machine-dependent, and this file is written for the MIPS * architecture and the SGI MIPSpro C++ compiler. Parts of it (in * particular, some of the characteristics of floating-point types) * are almost certainly incorrect for any other platform. */ /* The above comment is almost certainly out of date. This file works * on systems other than SGI MIPSpro C++ now. */ /* * Revision history: * 21 Sep 2001: * Only include <cwchar> if BOOST_NO_CWCHAR is defined. (Darin Adler) * 10 Aug 2001: * Added MIPS (big endian) to the big endian family. (Jens Maurer) * 13 Apr 2001: * Added powerpc to the big endian family. (Jeremy Siek) * 5 Apr 2001: * Added sparc (big endian) processor support (John Maddock). * Initial sub: * Modified by Jens Maurer for gcc 2.95 on x86. */ #ifndef BOOST_SGI_CPP_LIMITS #define BOOST_SGI_CPP_LIMITS #include <climits> #include <cfloat> #include <boost/config.hpp> #include <boost/detail/endian.hpp> #ifndef BOOST_NO_CWCHAR #include <cwchar> // for WCHAR_MIN and WCHAR_MAX #endif namespace std { enum float_round_style { round_indeterminate = -1, round_toward_zero = 0, round_to_nearest = 1, round_toward_infinity = 2, round_toward_neg_infinity = 3 }; enum float_denorm_style { denorm_indeterminate = -1, denorm_absent = 0, denorm_present = 1 }; // The C++ standard (section 18.2.1) requires that some of the members of // numeric_limits be static const data members that are given constant- // initializers within the class declaration. On compilers where the // BOOST_NO_INCLASS_MEMBER_INITIALIZATION macro is defined, it is impossible to write // a standard-conforming numeric_limits class. // // There are two possible workarounds: either initialize the data // members outside the class, or change them from data members to // enums. Neither workaround is satisfactory: the former makes it // impossible to use the data members in constant-expressions, and the // latter means they have the wrong type and that it is impossible to // take their addresses. We choose the former workaround. #ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION # define BOOST_STL_DECLARE_LIMITS_MEMBER(__mem_type, __mem_name, __mem_value) \ enum { __mem_name = __mem_value } #else /* BOOST_NO_INCLASS_MEMBER_INITIALIZATION */ # define BOOST_STL_DECLARE_LIMITS_MEMBER(__mem_type, __mem_name, __mem_value) \ static const __mem_type __mem_name = __mem_value #endif /* BOOST_NO_INCLASS_MEMBER_INITIALIZATION */ // Base class for all specializations of numeric_limits. template <class __number> class _Numeric_limits_base { public: BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, false); static __number min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __number(); } static __number max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __number(); } BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits, 0); BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, 0); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_signed, false); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_integer, false); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_exact, false); BOOST_STL_DECLARE_LIMITS_MEMBER(int, radix, 0); static __number epsilon() throw() { return __number(); } static __number round_error() throw() { return __number(); } BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent, 0); BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent10, 0); BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent, 0); BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent10, 0); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_infinity, false); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_quiet_NaN, false); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_signaling_NaN, false); BOOST_STL_DECLARE_LIMITS_MEMBER(float_denorm_style, has_denorm, denorm_absent); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_denorm_loss, false); static __number infinity() throw() { return __number(); } static __number quiet_NaN() throw() { return __number(); } static __number signaling_NaN() throw() { return __number(); } static __number denorm_min() throw() { return __number(); } BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_iec559, false); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, false); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_modulo, false); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, traps, false); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, tinyness_before, false); BOOST_STL_DECLARE_LIMITS_MEMBER(float_round_style, round_style, round_toward_zero); }; // Base class for integers. template <class _Int, _Int __imin, _Int __imax, int __idigits = -1> class _Integer_limits : public _Numeric_limits_base<_Int> { public: BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, true); static _Int min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __imin; } static _Int max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __imax; } BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits, (__idigits < 0) ? (int)(sizeof(_Int) * CHAR_BIT) - (__imin == 0 ? 0 : 1) : __idigits); BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, (digits * 301) / 1000); // log 2 = 0.301029995664... BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_signed, __imin != 0); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_integer, true); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_exact, true); BOOST_STL_DECLARE_LIMITS_MEMBER(int, radix, 2); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, true); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_modulo, true); }; #if defined(BOOST_BIG_ENDIAN) template<class Number, unsigned int Word> struct float_helper{ static Number get_word() throw() { // sizeof(long double) == 16 const unsigned int _S_word[4] = { Word, 0, 0, 0 }; return *reinterpret_cast<const Number*>(&_S_word); } }; #else template<class Number, unsigned int Word> struct float_helper{ static Number get_word() throw() { // sizeof(long double) == 12, but only 10 bytes significant const unsigned int _S_word[4] = { 0, 0, 0, Word }; return *reinterpret_cast<const Number*>( reinterpret_cast<const char *>(&_S_word)+16- (sizeof(Number) == 12 ? 10 : sizeof(Number))); } }; #endif // Base class for floating-point numbers. template <class __number, int __Digits, int __Digits10, int __MinExp, int __MaxExp, int __MinExp10, int __MaxExp10, unsigned int __InfinityWord, unsigned int __QNaNWord, unsigned int __SNaNWord, bool __IsIEC559, float_round_style __RoundStyle> class _Floating_limits : public _Numeric_limits_base<__number> { public: BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, true); BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits, __Digits); BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, __Digits10); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_signed, true); BOOST_STL_DECLARE_LIMITS_MEMBER(int, radix, 2); BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent, __MinExp); BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent, __MaxExp); BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent10, __MinExp10); BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent10, __MaxExp10); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_infinity, true); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_quiet_NaN, true); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_signaling_NaN, true); BOOST_STL_DECLARE_LIMITS_MEMBER(float_denorm_style, has_denorm, denorm_indeterminate); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_denorm_loss, false); static __number infinity() throw() { return float_helper<__number, __InfinityWord>::get_word(); } static __number quiet_NaN() throw() { return float_helper<__number,__QNaNWord>::get_word(); } static __number signaling_NaN() throw() { return float_helper<__number,__SNaNWord>::get_word(); } BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_iec559, __IsIEC559); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, true); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, traps, false /* was: true */ ); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, tinyness_before, false); BOOST_STL_DECLARE_LIMITS_MEMBER(float_round_style, round_style, __RoundStyle); }; // Class numeric_limits // The unspecialized class. template<class T> class numeric_limits : public _Numeric_limits_base<T> {}; // Specializations for all built-in integral types. template<> class numeric_limits<bool> : public _Integer_limits<bool, false, true, 0> {}; template<> class numeric_limits<char> : public _Integer_limits<char, CHAR_MIN, CHAR_MAX> {}; template<> class numeric_limits<signed char> : public _Integer_limits<signed char, SCHAR_MIN, SCHAR_MAX> {}; template<> class numeric_limits<unsigned char> : public _Integer_limits<unsigned char, 0, UCHAR_MAX> {}; #ifndef BOOST_NO_INTRINSIC_WCHAR_T template<> class numeric_limits<wchar_t> #if !defined(WCHAR_MAX) || !defined(WCHAR_MIN) #if defined(_WIN32) || defined(__CYGWIN__) : public _Integer_limits<wchar_t, 0, USHRT_MAX> #elif defined(__hppa) // wchar_t has "unsigned int" as the underlying type : public _Integer_limits<wchar_t, 0, UINT_MAX> #else // assume that wchar_t has "int" as the underlying type : public _Integer_limits<wchar_t, INT_MIN, INT_MAX> #endif #else // we have WCHAR_MIN and WCHAR_MAX defined, so use it : public _Integer_limits<wchar_t, WCHAR_MIN, WCHAR_MAX> #endif {}; #endif template<> class numeric_limits<short> : public _Integer_limits<short, SHRT_MIN, SHRT_MAX> {}; template<> class numeric_limits<unsigned short> : public _Integer_limits<unsigned short, 0, USHRT_MAX> {}; template<> class numeric_limits<int> : public _Integer_limits<int, INT_MIN, INT_MAX> {}; template<> class numeric_limits<unsigned int> : public _Integer_limits<unsigned int, 0, UINT_MAX> {}; template<> class numeric_limits<long> : public _Integer_limits<long, LONG_MIN, LONG_MAX> {}; template<> class numeric_limits<unsigned long> : public _Integer_limits<unsigned long, 0, ULONG_MAX> {}; #ifdef __GNUC__ // Some compilers have long long, but don't define the // LONGLONG_MIN and LONGLONG_MAX macros in limits.h. This // assumes that long long is 64 bits. #if !defined(LONGLONG_MAX) && !defined(ULONGLONG_MAX) # define ULONGLONG_MAX 0xffffffffffffffffLLU # define LONGLONG_MAX 0x7fffffffffffffffLL #endif #if !defined(LONGLONG_MIN) # define LONGLONG_MIN (-LONGLONG_MAX - 1) #endif #if !defined(ULONGLONG_MIN) # define ULONGLONG_MIN 0 #endif #endif /* __GNUC__ */ // Specializations for all built-in floating-point type. template<> class numeric_limits<float> : public _Floating_limits<float, FLT_MANT_DIG, // Binary digits of precision FLT_DIG, // Decimal digits of precision FLT_MIN_EXP, // Minimum exponent FLT_MAX_EXP, // Maximum exponent FLT_MIN_10_EXP, // Minimum base 10 exponent FLT_MAX_10_EXP, // Maximum base 10 exponent #if defined(BOOST_BIG_ENDIAN) 0x7f80 << (sizeof(int)*CHAR_BIT-16), // Last word of +infinity 0x7f81 << (sizeof(int)*CHAR_BIT-16), // Last word of quiet NaN 0x7fc1 << (sizeof(int)*CHAR_BIT-16), // Last word of signaling NaN #else 0x7f800000u, // Last word of +infinity 0x7f810000u, // Last word of quiet NaN 0x7fc10000u, // Last word of signaling NaN #endif true, // conforms to iec559 round_to_nearest> { public: static float min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return FLT_MIN; } static float denorm_min() throw() { return FLT_MIN; } static float max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return FLT_MAX; } static float epsilon() throw() { return FLT_EPSILON; } static float round_error() throw() { return 0.5f; } // Units: ulps. }; template<> class numeric_limits<double> : public _Floating_limits<double, DBL_MANT_DIG, // Binary digits of precision DBL_DIG, // Decimal digits of precision DBL_MIN_EXP, // Minimum exponent DBL_MAX_EXP, // Maximum exponent DBL_MIN_10_EXP, // Minimum base 10 exponent DBL_MAX_10_EXP, // Maximum base 10 exponent #if defined(BOOST_BIG_ENDIAN) 0x7ff0 << (sizeof(int)*CHAR_BIT-16), // Last word of +infinity 0x7ff1 << (sizeof(int)*CHAR_BIT-16), // Last word of quiet NaN 0x7ff9 << (sizeof(int)*CHAR_BIT-16), // Last word of signaling NaN #else 0x7ff00000u, // Last word of +infinity 0x7ff10000u, // Last word of quiet NaN 0x7ff90000u, // Last word of signaling NaN #endif true, // conforms to iec559 round_to_nearest> { public: static double min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return DBL_MIN; } static double denorm_min() throw() { return DBL_MIN; } static double max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return DBL_MAX; } static double epsilon() throw() { return DBL_EPSILON; } static double round_error() throw() { return 0.5; } // Units: ulps. }; template<> class numeric_limits<long double> : public _Floating_limits<long double, LDBL_MANT_DIG, // Binary digits of precision LDBL_DIG, // Decimal digits of precision LDBL_MIN_EXP, // Minimum exponent LDBL_MAX_EXP, // Maximum exponent LDBL_MIN_10_EXP,// Minimum base 10 exponent LDBL_MAX_10_EXP,// Maximum base 10 exponent #if defined(BOOST_BIG_ENDIAN) 0x7ff0 << (sizeof(int)*CHAR_BIT-16), // Last word of +infinity 0x7ff1 << (sizeof(int)*CHAR_BIT-16), // Last word of quiet NaN 0x7ff9 << (sizeof(int)*CHAR_BIT-16), // Last word of signaling NaN #else 0x7fff8000u, // Last word of +infinity 0x7fffc000u, // Last word of quiet NaN 0x7fff9000u, // Last word of signaling NaN #endif false, // Doesn't conform to iec559 round_to_nearest> { public: static long double min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return LDBL_MIN; } static long double denorm_min() throw() { return LDBL_MIN; } static long double max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return LDBL_MAX; } static long double epsilon() throw() { return LDBL_EPSILON; } static long double round_error() throw() { return 4; } // Units: ulps. }; } // namespace std #endif /* BOOST_SGI_CPP_LIMITS */ // Local Variables: // mode:C++ // End: ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/����������������������������������������������0000755�0001750�0001750�00000000000�12320456500�022125� 5����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/platform/�������������������������������������0000755�0001750�0001750�00000000000�12320456500�023751� 5����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/platform/beos.hpp�����������������������������0000644�0001750�0001750�00000001121�12320456500�025405� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // BeOS specific config options: #define BOOST_PLATFORM "BeOS" #define BOOST_NO_CWCHAR #define BOOST_NO_CWCTYPE #define BOOST_HAS_UNISTD_H #define BOOST_HAS_BETHREADS #ifndef BOOST_DISABLE_THREADS # define BOOST_HAS_THREADS #endif // boilerplate code: #include <boost/config/posix_features.hpp> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/platform/linux.hpp����������������������������0000644�0001750�0001750�00000004650�12320456500�025626� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Jens Maurer 2001 - 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // linux specific config options: #define BOOST_PLATFORM "linux" // make sure we have __GLIBC_PREREQ if available at all #include <cstdlib> // // <stdint.h> added to glibc 2.1.1 // We can only test for 2.1 though: // #if defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))) // <stdint.h> defines int64_t unconditionally, but <sys/types.h> defines // int64_t only if __GNUC__. Thus, assume a fully usable <stdint.h> // only when using GCC. # if defined __GNUC__ # define BOOST_HAS_STDINT_H # endif #endif #if defined(__LIBCOMO__) // // como on linux doesn't have std:: c functions: // NOTE: versions of libcomo prior to beta28 have octal version numbering, // e.g. version 25 is 21 (dec) // # if __LIBCOMO_VERSION__ <= 20 # define BOOST_NO_STDC_NAMESPACE # endif # if __LIBCOMO_VERSION__ <= 21 # define BOOST_NO_SWPRINTF # endif #endif // // If glibc is past version 2 then we definitely have // gettimeofday, earlier versions may or may not have it: // #if defined(__GLIBC__) && (__GLIBC__ >= 2) # define BOOST_HAS_GETTIMEOFDAY #endif #ifdef __USE_POSIX199309 # define BOOST_HAS_NANOSLEEP #endif #if defined(__GLIBC__) && defined(__GLIBC_PREREQ) // __GLIBC_PREREQ is available since 2.1.2 // swprintf is available since glibc 2.2.0 # if !__GLIBC_PREREQ(2,2) || (!defined(__USE_ISOC99) && !defined(__USE_UNIX98)) # define BOOST_NO_SWPRINTF # endif #else # define BOOST_NO_SWPRINTF #endif // boilerplate code: #define BOOST_HAS_UNISTD_H #include <boost/config/posix_features.hpp> #ifndef __GNUC__ // // if the compiler is not gcc we still need to be able to parse // the GNU system headers, some of which (mainly <stdint.h>) // use GNU specific extensions: // # ifndef __extension__ # define __extension__ # endif # ifndef __const__ # define __const__ const # endif # ifndef __volatile__ # define __volatile__ volatile # endif # ifndef __signed__ # define __signed__ signed # endif # ifndef __typeof__ # define __typeof__ typeof # endif # ifndef __inline__ # define __inline__ inline # endif #endif ����������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/platform/cygwin.hpp���������������������������0000644�0001750�0001750�00000002403�12320456500�025761� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // cygwin specific config options: #define BOOST_PLATFORM "Cygwin" #define BOOST_NO_CWCTYPE #define BOOST_NO_CWCHAR #define BOOST_NO_SWPRINTF #define BOOST_HAS_DIRENT_H #define BOOST_HAS_LOG1P #define BOOST_HAS_EXPM1 // // Threading API: // See if we have POSIX threads, if we do use them, otherwise // revert to native Win threads. #define BOOST_HAS_UNISTD_H #include <unistd.h> #if defined(_POSIX_THREADS) && (_POSIX_THREADS+0 >= 0) && !defined(BOOST_HAS_WINTHREADS) # define BOOST_HAS_PTHREADS # define BOOST_HAS_SCHED_YIELD # define BOOST_HAS_GETTIMEOFDAY # define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE # define BOOST_HAS_SIGACTION #else # if !defined(BOOST_HAS_WINTHREADS) # define BOOST_HAS_WINTHREADS # endif # define BOOST_HAS_FTIME #endif // // find out if we have a stdint.h, there should be a better way to do this: // #include <sys/types.h> #ifdef _STDINT_H #define BOOST_HAS_STDINT_H #endif // boilerplate code: #include <boost/config/posix_features.hpp> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/platform/bsd.hpp������������������������������0000644�0001750�0001750�00000004645�12320456500�025243� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Darin Adler 2001. // (C) Copyright Douglas Gregor 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // generic BSD config options: #if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__) #error "This platform is not BSD" #endif #ifdef __FreeBSD__ #define BOOST_PLATFORM "FreeBSD " BOOST_STRINGIZE(__FreeBSD__) #elif defined(__NetBSD__) #define BOOST_PLATFORM "NetBSD " BOOST_STRINGIZE(__NetBSD__) #elif defined(__OpenBSD__) #define BOOST_PLATFORM "OpenBSD " BOOST_STRINGIZE(__OpenBSD__) #elif defined(__DragonFly__) #define BOOST_PLATFORM "DragonFly " BOOST_STRINGIZE(__DragonFly__) #endif // // is this the correct version check? // FreeBSD has <nl_types.h> but does not // advertise the fact in <unistd.h>: // #if (defined(__FreeBSD__) && (__FreeBSD__ >= 3)) || defined(__DragonFly__) # define BOOST_HAS_NL_TYPES_H #endif // // FreeBSD 3.x has pthreads support, but defines _POSIX_THREADS in <pthread.h> // and not in <unistd.h> // #if (defined(__FreeBSD__) && (__FreeBSD__ <= 3))\ || defined(__OpenBSD__) || defined(__DragonFly__) # define BOOST_HAS_PTHREADS #endif // // No wide character support in the BSD header files: // #if defined(__NetBSD__) #define __NetBSD_GCC__ (__GNUC__ * 1000000 \ + __GNUC_MINOR__ * 1000 \ + __GNUC_PATCHLEVEL__) // XXX - the following is required until c++config.h // defines _GLIBCXX_HAVE_SWPRINTF and friends // or the preprocessor conditionals are removed // from the cwchar header. #define _GLIBCXX_HAVE_SWPRINTF 1 #endif #if !((defined(__FreeBSD__) && (__FreeBSD__ >= 5)) \ || (__NetBSD_GCC__ >= 2095003) || defined(__DragonFly__)) # define BOOST_NO_CWCHAR #endif // // The BSD <ctype.h> has macros only, no functions: // #if !defined(__OpenBSD__) || defined(__DragonFly__) # define BOOST_NO_CTYPE_FUNCTIONS #endif // // thread API's not auto detected: // #define BOOST_HAS_SCHED_YIELD #define BOOST_HAS_NANOSLEEP #define BOOST_HAS_GETTIMEOFDAY #define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE #define BOOST_HAS_SIGACTION // boilerplate code: #define BOOST_HAS_UNISTD_H #include <boost/config/posix_features.hpp> �������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/platform/macos.hpp����������������������������0000644�0001750�0001750�00000004526�12320456500�025573� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Darin Adler 2001 - 2002. // (C) Copyright Bill Kempf 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Mac OS specific config options: #define BOOST_PLATFORM "Mac OS" #if __MACH__ && !defined(_MSL_USING_MSL_C) // Using the Mac OS X system BSD-style C library. # ifndef BOOST_HAS_UNISTD_H # define BOOST_HAS_UNISTD_H # endif // // Begin by including our boilerplate code for POSIX // feature detection, this is safe even when using // the MSL as Metrowerks supply their own <unistd.h> // to replace the platform-native BSD one. G++ users // should also always be able to do this on MaxOS X. // # include <boost/config/posix_features.hpp> # ifndef BOOST_HAS_STDINT_H # define BOOST_HAS_STDINT_H # endif // // BSD runtime has pthreads, sigaction, sched_yield and gettimeofday, // of these only pthreads are advertised in <unistd.h>, so set the // other options explicitly: // # define BOOST_HAS_SCHED_YIELD # define BOOST_HAS_GETTIMEOFDAY # define BOOST_HAS_SIGACTION # if (__GNUC__ < 3) && !defined( __APPLE_CC__) // GCC strange "ignore std" mode works better if you pretend everything // is in the std namespace, for the most part. # define BOOST_NO_STDC_NAMESPACE # endif # if (__GNUC__ == 4) // Both gcc and intel require these. # define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE # define BOOST_HAS_NANOSLEEP # endif #else // Using the MSL C library. // We will eventually support threads in non-Carbon builds, but we do // not support this yet. # if ( defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON ) || ( defined(TARGET_CARBON) && TARGET_CARBON ) # if !defined(BOOST_HAS_PTHREADS) # define BOOST_HAS_MPTASKS # elif ( __dest_os == __mac_os_x ) // We are doing a Carbon/Mach-O/MSL build which has pthreads, but only the // gettimeofday and no posix. # define BOOST_HAS_GETTIMEOFDAY # endif // The MP task implementation of Boost Threads aims to replace MP-unsafe // parts of the MSL, so we turn on threads unconditionally. # define BOOST_HAS_THREADS // The remote call manager depends on this. # define BOOST_BIND_ENABLE_PASCAL # endif #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/platform/win32.hpp����������������������������0000644�0001750�0001750�00000003163�12320456500�025427� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Bill Kempf 2001. // (C) Copyright Aleksey Gurtovoy 2003. // (C) Copyright Rene Rivera 2005. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Win32 specific config options: #define BOOST_PLATFORM "Win32" // Get the information about the MinGW runtime, i.e. __MINGW32_*VERSION. #if defined(__MINGW32__) # include <_mingw.h> #endif #if defined(__GNUC__) && !defined(BOOST_NO_SWPRINTF) # define BOOST_NO_SWPRINTF #endif #if !defined(__GNUC__) && !defined(BOOST_HAS_DECLSPEC) # define BOOST_HAS_DECLSPEC #endif #if defined(__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 2) || ((__MINGW32_MAJOR_VERSION == 2) && (__MINGW32_MINOR_VERSION >= 0))) # define BOOST_HAS_STDINT_H # define __STDC_LIMIT_MACROS # define BOOST_HAS_DIRENT_H # define BOOST_HAS_UNISTD_H #endif // // Win32 will normally be using native Win32 threads, // but there is a pthread library avaliable as an option, // we used to disable this when BOOST_DISABLE_WIN32 was // defined but no longer - this should allow some // files to be compiled in strict mode - while maintaining // a consistent setting of BOOST_HAS_THREADS across // all translation units (needed for shared_ptr etc). // #ifdef _WIN32_WCE # define BOOST_NO_ANSI_APIS #endif #ifndef BOOST_HAS_PTHREADS # define BOOST_HAS_WINTHREADS #endif #ifndef BOOST_DISABLE_WIN32 // WEK: Added #define BOOST_HAS_FTIME #define BOOST_WINDOWS 1 #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/platform/solaris.hpp��������������������������0000644�0001750�0001750�00000001311�12320456500�026132� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Jens Maurer 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // sun specific config options: #define BOOST_PLATFORM "Sun Solaris" #define BOOST_HAS_GETTIMEOFDAY // boilerplate code: #define BOOST_HAS_UNISTD_H #include <boost/config/posix_features.hpp> // // pthreads don't actually work with gcc unless _PTHREADS is defined: // #if defined(__GNUC__) && defined(_POSIX_THREADS) && !defined(_PTHREADS) # undef BOOST_HAS_PTHREADS #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/platform/hpux.hpp�����������������������������0000644�0001750�0001750�00000004655�12320456500�025460� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Jens Maurer 2001 - 2003. // (C) Copyright David Abrahams 2002. // (C) Copyright Toon Knapen 2003. // (C) Copyright Boris Gubenko 2006 - 2007. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // hpux specific config options: #define BOOST_PLATFORM "HP-UX" // In principle, HP-UX has a nice <stdint.h> under the name <inttypes.h> // However, it has the following problem: // Use of UINT32_C(0) results in "0u l" for the preprocessed source // (verifyable with gcc 2.95.3) #if (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__HP_aCC) # define BOOST_HAS_STDINT_H #endif #if !(defined(__HP_aCC) || !defined(_INCLUDE__STDC_A1_SOURCE)) # define BOOST_NO_SWPRINTF #endif #if defined(__HP_aCC) && !defined(_INCLUDE__STDC_A1_SOURCE) # define BOOST_NO_CWCTYPE #endif #if defined(__GNUC__) # if (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3)) // GNU C on HP-UX does not support threads (checked up to gcc 3.3) # define BOOST_DISABLE_THREADS # elif !defined(BOOST_DISABLE_THREADS) // threads supported from gcc-3.3 onwards: # define BOOST_HAS_THREADS # define BOOST_HAS_PTHREADS # endif #elif defined(__HP_aCC) && !defined(BOOST_DISABLE_THREADS) # define BOOST_HAS_PTHREADS #endif // boilerplate code: #define BOOST_HAS_UNISTD_H #include <boost/config/posix_features.hpp> // the following are always available: #ifndef BOOST_HAS_GETTIMEOFDAY # define BOOST_HAS_GETTIMEOFDAY #endif #ifndef BOOST_HAS_SCHED_YIELD # define BOOST_HAS_SCHED_YIELD #endif #ifndef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE # define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE #endif #ifndef BOOST_HAS_NL_TYPES_H # define BOOST_HAS_NL_TYPES_H #endif #ifndef BOOST_HAS_NANOSLEEP # define BOOST_HAS_NANOSLEEP #endif #ifndef BOOST_HAS_GETTIMEOFDAY # define BOOST_HAS_GETTIMEOFDAY #endif #ifndef BOOST_HAS_DIRENT_H # define BOOST_HAS_DIRENT_H #endif #ifndef BOOST_HAS_CLOCK_GETTIME # define BOOST_HAS_CLOCK_GETTIME #endif #ifndef BOOST_HAS_SIGACTION # define BOOST_HAS_SIGACTION #endif #ifndef BOOST_HAS_NRVO # ifndef __parisc # define BOOST_HAS_NRVO # endif #endif #ifndef BOOST_HAS_LOG1P # define BOOST_HAS_LOG1P #endif #ifndef BOOST_HAS_EXPM1 # define BOOST_HAS_EXPM1 #endif �����������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/platform/irix.hpp�����������������������������0000644�0001750�0001750�00000001425�12320456500�025437� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Jens Maurer 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // SGI Irix specific config options: #define BOOST_PLATFORM "SGI Irix" #define BOOST_NO_SWPRINTF // // these are not auto detected by POSIX feature tests: // #define BOOST_HAS_GETTIMEOFDAY #define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE #ifdef __GNUC__ // GNU C on IRIX does not support threads (checked up to gcc 3.3) # define BOOST_DISABLE_THREADS #endif // boilerplate code: #define BOOST_HAS_UNISTD_H #include <boost/config/posix_features.hpp> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/platform/qnxnto.hpp���������������������������0000644�0001750�0001750�00000001376�12320456500�026020� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright Jim Douglas 2005. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // QNX specific config options: #define BOOST_PLATFORM "QNX" #define BOOST_HAS_UNISTD_H #include <boost/config/posix_features.hpp> // QNX claims XOpen version 5 compatibility, but doesn't have an nl_types.h // or log1p and expm1: #undef BOOST_HAS_NL_TYPES_H #undef BOOST_HAS_LOG1P #undef BOOST_HAS_EXPM1 #define BOOST_HAS_PTHREADS #define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE #define BOOST_HAS_GETTIMEOFDAY #define BOOST_HAS_CLOCK_GETTIME #define BOOST_HAS_NANOSLEEP ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/platform/amigaos.hpp��������������������������0000644�0001750�0001750�00000000672�12320456500�026107� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. #define BOOST_PLATFORM "AmigaOS" #define BOOST_DISABLE_THREADS #define BOOST_NO_CWCHAR #define BOOST_NO_STD_WSTRING #define BOOST_NO_INTRINSIC_WCHAR_T ����������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/platform/aix.hpp������������������������������0000644�0001750�0001750�00000001561�12320456500�025246� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // IBM/Aix specific config options: #define BOOST_PLATFORM "IBM Aix" #define BOOST_HAS_UNISTD_H #define BOOST_HAS_NL_TYPES_H #define BOOST_HAS_NANOSLEEP #define BOOST_HAS_CLOCK_GETTIME // This needs support in "boost/cstdint.hpp" exactly like FreeBSD. // This platform has header named <inttypes.h> which includes all // the things needed. #define BOOST_HAS_STDINT_H // Threading API's: #define BOOST_HAS_PTHREADS #define BOOST_HAS_PTHREAD_DELAY_NP #define BOOST_HAS_SCHED_YIELD //#define BOOST_HAS_PTHREAD_YIELD // boilerplate code: #include <boost/config/posix_features.hpp> �����������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/select_compiler_config.hpp��������������������0000644�0001750�0001750�00000007232�12320456500�027340� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Boost compiler configuration selection header file // (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Martin Wille 2003. // (C) Copyright Guillaume Melquiond 2003. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/ for most recent version. // one identification macro for each of the // compilers we support: # define BOOST_CXX_GCCXML 0 # define BOOST_CXX_COMO 0 # define BOOST_CXX_DMC 0 # define BOOST_CXX_INTEL 0 # define BOOST_CXX_GNUC 0 # define BOOST_CXX_KCC 0 # define BOOST_CXX_SGI 0 # define BOOST_CXX_TRU64 0 # define BOOST_CXX_GHS 0 # define BOOST_CXX_BORLAND 0 # define BOOST_CXX_CW 0 # define BOOST_CXX_SUNPRO 0 # define BOOST_CXX_HPACC 0 # define BOOST_CXX_MPW 0 # define BOOST_CXX_IBMCPP 0 # define BOOST_CXX_MSVC 0 # define BOOST_CXX_PGI 0 // locate which compiler we are using and define // BOOST_COMPILER_CONFIG as needed: #if defined(__GCCXML__) // GCC-XML emulates other compilers, it has to appear first here! # define BOOST_COMPILER_CONFIG "boost/config/compiler/gcc_xml.hpp" #elif defined __COMO__ // Comeau C++ # define BOOST_COMPILER_CONFIG "boost/config/compiler/comeau.hpp" #elif defined __DMC__ // Digital Mars C++ # define BOOST_COMPILER_CONFIG "boost/config/compiler/digitalmars.hpp" #elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC) // Intel # define BOOST_COMPILER_CONFIG "boost/config/compiler/intel.hpp" # elif defined __GNUC__ // GNU C++: # define BOOST_COMPILER_CONFIG "boost/config/compiler/gcc.hpp" #elif defined __KCC // Kai C++ # define BOOST_COMPILER_CONFIG "boost/config/compiler/kai.hpp" #elif defined __sgi // SGI MIPSpro C++ # define BOOST_COMPILER_CONFIG "boost/config/compiler/sgi_mipspro.hpp" #elif defined __DECCXX // Compaq Tru64 Unix cxx # define BOOST_COMPILER_CONFIG "boost/config/compiler/compaq_cxx.hpp" #elif defined __ghs // Greenhills C++ # define BOOST_COMPILER_CONFIG "boost/config/compiler/greenhills.hpp" #elif defined __CODEGEARC__ // CodeGear - must be checked for before Borland # define BOOST_COMPILER_CONFIG "boost/config/compiler/codegear.hpp" #elif defined __BORLANDC__ // Borland # define BOOST_COMPILER_CONFIG "boost/config/compiler/borland.hpp" #elif defined __MWERKS__ // Metrowerks CodeWarrior # define BOOST_COMPILER_CONFIG "boost/config/compiler/metrowerks.hpp" #elif defined __SUNPRO_CC // Sun Workshop Compiler C++ # define BOOST_COMPILER_CONFIG "boost/config/compiler/sunpro_cc.hpp" #elif defined __HP_aCC // HP aCC # define BOOST_COMPILER_CONFIG "boost/config/compiler/hp_acc.hpp" #elif defined(__MRC__) || defined(__SC__) // MPW MrCpp or SCpp # define BOOST_COMPILER_CONFIG "boost/config/compiler/mpw.hpp" #elif defined(__IBMCPP__) // IBM Visual Age # define BOOST_COMPILER_CONFIG "boost/config/compiler/vacpp.hpp" #elif defined(__PGI) // Portland Group Inc. # define BOOST_COMPILER_CONFIG "boost/config/compiler/pgi.hpp" #elif defined _MSC_VER // Microsoft Visual C++ // // Must remain the last #elif since some other vendors (Metrowerks, for // example) also #define _MSC_VER # define BOOST_COMPILER_CONFIG "boost/config/compiler/visualc.hpp" #elif defined (BOOST_ASSERT_CONFIG) // this must come last - generate an error if we don't // recognise the compiler: # error "Unknown compiler - please configure (http://www.boost.org/libs/config/config.htm#configuring) and report the results to the main boost mailing list (http://www.boost.org/more/mailing_lists.htm#main)" #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/abi/������������������������������������������0000755�0001750�0001750�00000000000�12320456500�022660� 5����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/abi/borland_suffix.hpp������������������������0000644�0001750�0001750�00000000430�12320456500�026373� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) # pragma option pop #pragma nopushoptwarn ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/abi/msvc_suffix.hpp���������������������������0000644�0001750�0001750�00000000374�12320456500�025731� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #pragma pack(pop) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/abi/borland_prefix.hpp������������������������0000644�0001750�0001750�00000001747�12320456500�026400� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // for C++ Builder the following options effect the ABI: // // -b (on or off - effect emum sizes) // -Vx (on or off - empty members) // -Ve (on or off - empty base classes) // -aX (alignment - 5 options). // -pX (Calling convention - 4 options) // -VmX (member pointer size and layout - 5 options) // -VC (on or off, changes name mangling) // -Vl (on or off, changes struct layout). // In addition the following warnings are sufficiently annoying (and // unfixable) to have them turned off by default: // // 8027 - functions containing [for|while] loops are not expanded inline // 8026 - functions taking class by value arguments are not expanded inline #pragma nopushoptwarn # pragma option push -Vx -Ve -a8 -b -pc -Vmv -VC- -Vl- -w-8027 -w-8026 �������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/abi/msvc_prefix.hpp���������������������������0000644�0001750�0001750�00000001463�12320456500�025722� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Boost binaries are built with the compiler's default ABI settings, // if the user changes their default alignment in the VS IDE then their // code will no longer be binary compatible with the bjam built binaries // unless this header is included to force Boost code into a consistent ABI. // // Note that inclusion of this header is only necessary for libraries with // separate source, header only libraries DO NOT need this as long as all // translation units are built with the same options. // #if defined(_M_X64) # pragma pack(push,16) #else # pragma pack(push,8) #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/requires_threads.hpp��������������������������0000644�0001750�0001750�00000006663�12320456500�026222� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_CONFIG_REQUIRES_THREADS_HPP #define BOOST_CONFIG_REQUIRES_THREADS_HPP #ifndef BOOST_CONFIG_HPP # include <boost/config.hpp> #endif #if defined(BOOST_DISABLE_THREADS) // // special case to handle versions of gcc which don't currently support threads: // #if defined(__GNUC__) && ((__GNUC__ < 3) || (__GNUC_MINOR__ <= 3) || !defined(BOOST_STRICT_CONFIG)) // // this is checked up to gcc 3.3: // #if defined(__sgi) || defined(__hpux) # error "Multi-threaded programs are not supported by gcc on HPUX or Irix (last checked with gcc 3.3)" #endif #endif # error "Threading support unavaliable: it has been explicitly disabled with BOOST_DISABLE_THREADS" #elif !defined(BOOST_HAS_THREADS) # if defined __COMO__ // Comeau C++ # error "Compiler threading support is not turned on. Please set the correct command line options for threading: -D_MT (Windows) or -D_REENTRANT (Unix)" #elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC) // Intel #ifdef _WIN32 # error "Compiler threading support is not turned on. Please set the correct command line options for threading: either /MT /MTd /MD or /MDd" #else # error "Compiler threading support is not turned on. Please set the correct command line options for threading: -openmp" #endif # elif defined __GNUC__ // GNU C++: # error "Compiler threading support is not turned on. Please set the correct command line options for threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)" #elif defined __sgi // SGI MIPSpro C++ # error "Compiler threading support is not turned on. Please set the correct command line options for threading: -D_SGI_MP_SOURCE" #elif defined __DECCXX // Compaq Tru64 Unix cxx # error "Compiler threading support is not turned on. Please set the correct command line options for threading: -pthread" #elif defined __BORLANDC__ // Borland # error "Compiler threading support is not turned on. Please set the correct command line options for threading: -tWM" #elif defined __MWERKS__ // Metrowerks CodeWarrior # error "Compiler threading support is not turned on. Please set the correct command line options for threading: either -runtime sm, -runtime smd, -runtime dm, or -runtime dmd" #elif defined __SUNPRO_CC // Sun Workshop Compiler C++ # error "Compiler threading support is not turned on. Please set the correct command line options for threading: -mt" #elif defined __HP_aCC // HP aCC # error "Compiler threading support is not turned on. Please set the correct command line options for threading: -mt" #elif defined(__IBMCPP__) // IBM Visual Age # error "Compiler threading support is not turned on. Please compile the code with the xlC_r compiler" #elif defined _MSC_VER // Microsoft Visual C++ // // Must remain the last #elif since some other vendors (Metrowerks, for // example) also #define _MSC_VER # error "Compiler threading support is not turned on. Please set the correct command line options for threading: either /MT /MTd /MD or /MDd" #else # error "Compiler threading support is not turned on. Please consult your compiler's documentation for the appropriate options to use" #endif // compilers #endif // BOOST_HAS_THREADS #endif // BOOST_CONFIG_REQUIRES_THREADS_HPP �����������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/select_stdlib_config.hpp����������������������0000644�0001750�0001750�00000004552�12320456500�027011� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Boost compiler configuration selection header file // (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Jens Maurer 2001 - 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // locate which std lib we are using and define BOOST_STDLIB_CONFIG as needed: // we need to include a std lib header here in order to detect which // library is in use, use <utility> as it's about the smallest // of the std lib headers - do not rely on this header being included - // users can short-circuit this header if they know whose std lib // they are using. #include <boost/config/no_tr1/utility.hpp> #if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) // STLPort library; this _must_ come first, otherwise since // STLport typically sits on top of some other library, we // can end up detecting that first rather than STLport: # define BOOST_STDLIB_CONFIG "boost/config/stdlib/stlport.hpp" #elif defined(__LIBCOMO__) // Comeau STL: #define BOOST_STDLIB_CONFIG "boost/config/stdlib/libcomo.hpp" #elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER) // Rogue Wave library: # define BOOST_STDLIB_CONFIG "boost/config/stdlib/roguewave.hpp" #elif defined(__GLIBCPP__) || defined(__GLIBCXX__) // GNU libstdc++ 3 # define BOOST_STDLIB_CONFIG "boost/config/stdlib/libstdcpp3.hpp" #elif defined(__STL_CONFIG_H) // generic SGI STL # define BOOST_STDLIB_CONFIG "boost/config/stdlib/sgi.hpp" #elif defined(__MSL_CPP__) // MSL standard lib: # define BOOST_STDLIB_CONFIG "boost/config/stdlib/msl.hpp" #elif defined(__IBMCPP__) // take the default VACPP std lib # define BOOST_STDLIB_CONFIG "boost/config/stdlib/vacpp.hpp" #elif defined(MSIPL_COMPILE_H) // Modena C++ standard library # define BOOST_STDLIB_CONFIG "boost/config/stdlib/modena.hpp" #elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER) // Dinkumware Library (this has to appear after any possible replacement libraries): # define BOOST_STDLIB_CONFIG "boost/config/stdlib/dinkumware.hpp" #elif defined (BOOST_ASSERT_CONFIG) // this must come last - generate an error if we don't // recognise the library: # error "Unknown standard library - please configure and report the results to boost.org" #endif ������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/abi_prefix.hpp��������������������������������0000644�0001750�0001750�00000001272�12320456500�024750� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// abi_prefix header -------------------------------------------------------// // (c) Copyright John Maddock 2003 // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt). #ifndef BOOST_CONFIG_ABI_PREFIX_HPP # define BOOST_CONFIG_ABI_PREFIX_HPP #else # error double inclusion of header boost/config/abi_prefix.hpp is an error #endif #include <boost/config.hpp> // this must occur after all other includes and before any code appears: #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif #if defined( __BORLANDC__ ) #pragma nopushoptwarn #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/warning_disable.hpp���������������������������0000644�0001750�0001750�00000003434�12320456500�025772� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Copyright John Maddock 2008 // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // This file exists to turn off some overly-pedantic warning emitted // by certain compilers. You should include this header only in: // // * A test case, before any other headers, or, // * A library source file before any other headers. // // IT SHOULD NOT BE INCLUDED BY ANY BOOST HEADER. // // YOU SHOULD NOT INCLUDE IT IF YOU CAN REASONABLY FIX THE WARNING. // // The only warnings disabled here are those that are: // // * Quite unreasonably pedantic. // * Generally only emitted by a single compiler. // * Can't easily be fixed: for example if the vendors own std lib // code emits these warnings! // // Note that THIS HEADER MUST NOT INCLUDE ANY OTHER HEADERS: // not even std library ones! Doing so may turn the warning // off too late to be of any use. For example the VC++ C4996 // warning can be omitted from <iosfwd> if that header is included // before or by this one :-( // #ifndef BOOST_CONFIG_WARNING_DISABLE_HPP #define BOOST_CONFIG_WARNING_DISABLE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1400) // Error 'function': was declared deprecated // http://msdn2.microsoft.com/en-us/library/ttcz0bys(VS.80).aspx // This error is emitted when you use some perfectly conforming // std lib functions in a perfectly correct way, and also by // some of Microsoft's own std lib code ! # pragma warning(disable:4996) #endif #if defined(__INTEL_COMPILER) || defined(__ICL) // As above: gives warning when a "deprecated" // std library function is encountered. # pragma warning(disable:1786) #endif #endif // BOOST_CONFIG_WARNING_DISABLE_HPP ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/select_platform_config.hpp��������������������0000644�0001750�0001750�00000005344�12320456500�027354� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Boost compiler configuration selection header file // (C) Copyright John Maddock 2001 - 2002. // (C) Copyright Jens Maurer 2001. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // locate which platform we are on and define BOOST_PLATFORM_CONFIG as needed. // Note that we define the headers to include using "header_name" not // <header_name> in order to prevent macro expansion within the header // name (for example "linux" is a macro on linux systems). #if defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) // linux, also other platforms (Hurd etc) that use GLIBC, should these really have their own config headers though? # define BOOST_PLATFORM_CONFIG "boost/config/platform/linux.hpp" #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) // BSD: # define BOOST_PLATFORM_CONFIG "boost/config/platform/bsd.hpp" #elif defined(sun) || defined(__sun) // solaris: # define BOOST_PLATFORM_CONFIG "boost/config/platform/solaris.hpp" #elif defined(__sgi) // SGI Irix: # define BOOST_PLATFORM_CONFIG "boost/config/platform/irix.hpp" #elif defined(__hpux) // hp unix: # define BOOST_PLATFORM_CONFIG "boost/config/platform/hpux.hpp" #elif defined(__CYGWIN__) // cygwin is not win32: # define BOOST_PLATFORM_CONFIG "boost/config/platform/cygwin.hpp" #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) // win32: # define BOOST_PLATFORM_CONFIG "boost/config/platform/win32.hpp" #elif defined(__BEOS__) // BeOS # define BOOST_PLATFORM_CONFIG "boost/config/platform/beos.hpp" #elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) // MacOS # define BOOST_PLATFORM_CONFIG "boost/config/platform/macos.hpp" #elif defined(__IBMCPP__) || defined(_AIX) // IBM # define BOOST_PLATFORM_CONFIG "boost/config/platform/aix.hpp" #elif defined(__amigaos__) // AmigaOS # define BOOST_PLATFORM_CONFIG "boost/config/platform/amigaos.hpp" #elif defined(__QNXNTO__) // QNX: # define BOOST_PLATFORM_CONFIG "boost/config/platform/qnxnto.hpp" #else # if defined(unix) \ || defined(__unix) \ || defined(_XOPEN_SOURCE) \ || defined(_POSIX_SOURCE) // generic unix platform: # ifndef BOOST_HAS_UNISTD_H # define BOOST_HAS_UNISTD_H # endif # include <boost/config/posix_features.hpp> # endif # if defined (BOOST_ASSERT_CONFIG) // this must come last - generate an error if we don't // recognise the platform: # error "Unknown platform - please configure and report the results to boost.org" # endif #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/posix_features.hpp����������������������������0000644�0001750�0001750�00000007230�12320456500�025700� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // All POSIX feature tests go in this file, // Note that we test _POSIX_C_SOURCE and _XOPEN_SOURCE as well // _POSIX_VERSION and _XOPEN_VERSION: on some systems POSIX API's // may be present but none-functional unless _POSIX_C_SOURCE and // _XOPEN_SOURCE have been defined to the right value (it's up // to the user to do this *before* including any header, although // in most cases the compiler will do this for you). # if defined(BOOST_HAS_UNISTD_H) # include <unistd.h> // XOpen has <nl_types.h>, but is this the correct version check? # if defined(_XOPEN_VERSION) && (_XOPEN_VERSION >= 3) # define BOOST_HAS_NL_TYPES_H # endif // POSIX version 6 requires <stdint.h> # if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 200100) # define BOOST_HAS_STDINT_H # endif // POSIX version 2 requires <dirent.h> # if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199009L) # define BOOST_HAS_DIRENT_H # endif // POSIX version 3 requires <signal.h> to have sigaction: # if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199506L) # define BOOST_HAS_SIGACTION # endif // POSIX defines _POSIX_THREADS > 0 for pthread support, // however some platforms define _POSIX_THREADS without // a value, hence the (_POSIX_THREADS+0 >= 0) check. // Strictly speaking this may catch platforms with a // non-functioning stub <pthreads.h>, but such occurrences should // occur very rarely if at all. # if defined(_POSIX_THREADS) && (_POSIX_THREADS+0 >= 0) && !defined(BOOST_HAS_WINTHREADS) && !defined(BOOST_HAS_MPTASKS) # define BOOST_HAS_PTHREADS # endif // BOOST_HAS_NANOSLEEP: // This is predicated on _POSIX_TIMERS or _XOPEN_REALTIME: # if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS+0 >= 0)) \ || (defined(_XOPEN_REALTIME) && (_XOPEN_REALTIME+0 >= 0)) # define BOOST_HAS_NANOSLEEP # endif // BOOST_HAS_CLOCK_GETTIME: // This is predicated on _POSIX_TIMERS (also on _XOPEN_REALTIME // but at least one platform - linux - defines that flag without // defining clock_gettime): # if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS+0 >= 0)) # define BOOST_HAS_CLOCK_GETTIME # endif // BOOST_HAS_SCHED_YIELD: // This is predicated on _POSIX_PRIORITY_SCHEDULING or // on _POSIX_THREAD_PRIORITY_SCHEDULING or on _XOPEN_REALTIME. # if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING+0 > 0)\ || (defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING+0 > 0))\ || (defined(_XOPEN_REALTIME) && (_XOPEN_REALTIME+0 >= 0)) # define BOOST_HAS_SCHED_YIELD # endif // BOOST_HAS_GETTIMEOFDAY: // BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE: // These are predicated on _XOPEN_VERSION, and appears to be first released // in issue 4, version 2 (_XOPEN_VERSION > 500). // Likewise for the functions log1p and expm1. # if defined(_XOPEN_VERSION) && (_XOPEN_VERSION+0 >= 500) # define BOOST_HAS_GETTIMEOFDAY # if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE+0 >= 500) # define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE # endif # ifndef BOOST_HAS_LOG1P # define BOOST_HAS_LOG1P # endif # ifndef BOOST_HAS_EXPM1 # define BOOST_HAS_EXPM1 # endif # endif # endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/compiler/�������������������������������������0000755�0001750�0001750�00000000000�12320456500�023737� 5����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/compiler/intel.hpp����������������������������0000644�0001750�0001750�00000015277�12320456500�025577� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001-8. // (C) Copyright Peter Dimov 2001. // (C) Copyright Jens Maurer 2001. // (C) Copyright David Abrahams 2002 - 2003. // (C) Copyright Aleksey Gurtovoy 2002 - 2003. // (C) Copyright Guillaume Melquiond 2002 - 2003. // (C) Copyright Beman Dawes 2003. // (C) Copyright Martin Wille 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Intel compiler setup: #include "boost/config/compiler/common_edg.hpp" #if defined(__INTEL_COMPILER) # define BOOST_INTEL_CXX_VERSION __INTEL_COMPILER #elif defined(__ICL) # define BOOST_INTEL_CXX_VERSION __ICL #elif defined(__ICC) # define BOOST_INTEL_CXX_VERSION __ICC #elif defined(__ECC) # define BOOST_INTEL_CXX_VERSION __ECC #endif #define BOOST_COMPILER "Intel C++ version " BOOST_STRINGIZE(BOOST_INTEL_CXX_VERSION) #define BOOST_INTEL BOOST_INTEL_CXX_VERSION #if defined(_WIN32) || defined(_WIN64) # define BOOST_INTEL_WIN BOOST_INTEL #else # define BOOST_INTEL_LINUX BOOST_INTEL #endif #if (BOOST_INTEL_CXX_VERSION <= 500) && defined(_MSC_VER) # define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS # define BOOST_NO_TEMPLATE_TEMPLATES #endif #if (BOOST_INTEL_CXX_VERSION <= 600) # if defined(_MSC_VER) && (_MSC_VER <= 1300) // added check for <= VC 7 (Peter Dimov) // Boost libraries assume strong standard conformance unless otherwise // indicated by a config macro. As configured by Intel, the EDG front-end // requires certain compiler options be set to achieve that strong conformance. // Particularly /Qoption,c,--arg_dep_lookup (reported by Kirk Klobe & Thomas Witt) // and /Zc:wchar_t,forScope. See boost-root/tools/build/intel-win32-tools.jam for // details as they apply to particular versions of the compiler. When the // compiler does not predefine a macro indicating if an option has been set, // this config file simply assumes the option has been set. // Thus BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP will not be defined, even if // the compiler option is not enabled. # define BOOST_NO_SWPRINTF # endif // Void returns, 64 bit integrals don't work when emulating VC 6 (Peter Dimov) # if defined(_MSC_VER) && (_MSC_VER <= 1200) # define BOOST_NO_VOID_RETURNS # define BOOST_NO_INTEGRAL_INT64_T # endif #endif #if (BOOST_INTEL_CXX_VERSION <= 710) && defined(_WIN32) # define BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS #endif // See http://aspn.activestate.com/ASPN/Mail/Message/boost/1614864 #if BOOST_INTEL_CXX_VERSION < 600 # define BOOST_NO_INTRINSIC_WCHAR_T #else // We should test the macro _WCHAR_T_DEFINED to check if the compiler // supports wchar_t natively. *BUT* there is a problem here: the standard // headers define this macro if they typedef wchar_t. Anyway, we're lucky // because they define it without a value, while Intel C++ defines it // to 1. So we can check its value to see if the macro was defined natively // or not. // Under UNIX, the situation is exactly the same, but the macro _WCHAR_T // is used instead. # if ((_WCHAR_T_DEFINED + 0) == 0) && ((_WCHAR_T + 0) == 0) # define BOOST_NO_INTRINSIC_WCHAR_T # endif #endif #if defined(__GNUC__) && !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) // // Figure out when Intel is emulating this gcc bug // (All Intel versions prior to 9.0.26, and versions // later than that if they are set up to emulate gcc 3.2 // or earlier): // # if ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)) || (BOOST_INTEL < 900) || (__INTEL_COMPILER_BUILD_DATE < 20050912) # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # endif #endif #if (defined(__GNUC__) && (__GNUC__ < 4)) || defined(_WIN32) || (BOOST_INTEL_CXX_VERSION <= 1100) // GCC or VC emulation: #define BOOST_NO_TWO_PHASE_NAME_LOOKUP #endif // // Verify that we have actually got BOOST_NO_INTRINSIC_WCHAR_T // set correctly, if we don't do this now, we will get errors later // in type_traits code among other things, getting this correct // for the Intel compiler is actually remarkably fragile and tricky: // #if defined(BOOST_NO_INTRINSIC_WCHAR_T) #include <cwchar> template< typename T > struct assert_no_intrinsic_wchar_t; template<> struct assert_no_intrinsic_wchar_t<wchar_t> { typedef void type; }; // if you see an error here then you need to unset BOOST_NO_INTRINSIC_WCHAR_T // where it is defined above: typedef assert_no_intrinsic_wchar_t<unsigned short>::type assert_no_intrinsic_wchar_t_; #else template< typename T > struct assert_intrinsic_wchar_t; template<> struct assert_intrinsic_wchar_t<wchar_t> {}; // if you see an error here then define BOOST_NO_INTRINSIC_WCHAR_T on the command line: template<> struct assert_intrinsic_wchar_t<unsigned short> {}; #endif #if _MSC_VER+0 >= 1000 # if _MSC_VER >= 1200 # define BOOST_HAS_MS_INT64 # endif # define BOOST_NO_SWPRINTF # define BOOST_NO_TWO_PHASE_NAME_LOOKUP #elif defined(_WIN32) # define BOOST_DISABLE_WIN32 #endif // I checked version 6.0 build 020312Z, it implements the NRVO. // Correct this as you find out which version of the compiler // implemented the NRVO first. (Daniel Frey) #if (BOOST_INTEL_CXX_VERSION >= 600) # define BOOST_HAS_NRVO #endif // // versions check: // we don't support Intel prior to version 5.0: #if BOOST_INTEL_CXX_VERSION < 500 # error "Compiler not supported or configured - please reconfigure" #endif // Intel on MacOS requires #if defined(__APPLE__) && defined(__INTEL_COMPILER) # define BOOST_NO_TWO_PHASE_NAME_LOOKUP #endif // Intel on Altix Itanium #if defined(__itanium__) && defined(__INTEL_COMPILER) # define BOOST_NO_TWO_PHASE_NAME_LOOKUP #endif // // C++0x features // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS // // last known and checked version: #if (BOOST_INTEL_CXX_VERSION > 1100) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # elif defined(_MSC_VER) // // We don't emit this warning any more, since we have so few // defect macros set anyway (just the one). // //# pragma message("Unknown compiler version - please run the configure tests and report the results") # endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/compiler/digitalmars.hpp����������������������0000644�0001750�0001750�00000004667�12320456500�026765� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Copyright (C) Christof Meerwald 2003 // Copyright (C) Dan Watkins 2003 // // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // Digital Mars C++ compiler setup: #define BOOST_COMPILER __DMC_VERSION_STRING__ #define BOOST_HAS_LONG_LONG #define BOOST_HAS_PRAGMA_ONCE #if (__DMC__ <= 0x833) #define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL #define BOOST_NO_TEMPLATE_TEMPLATES #define BOOST_NEEDS_TOKEN_PASTING_OP_FOR_TOKENS_JUXTAPOSING #define BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS #define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS #endif #if (__DMC__ <= 0x840) || !defined(BOOST_STRICT_CONFIG) #define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS #define BOOST_NO_MEMBER_TEMPLATE_FRIENDS #define BOOST_NO_OPERATORS_IN_NAMESPACE #define BOOST_NO_UNREACHABLE_RETURN_DETECTION #define BOOST_NO_SFINAE #define BOOST_NO_USING_TEMPLATE #define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL #define BOOST_NO_INITIALIZER_LISTS #endif // // has macros: #if (__DMC__ >= 0x840) #define BOOST_HAS_DIRENT_H #define BOOST_HAS_STDINT_H #define BOOST_HAS_WINTHREADS #endif #if (__DMC__ >= 0x847) #define BOOST_HAS_EXPM1 #define BOOST_HAS_LOG1P #endif // // Is this really the best way to detect whether the std lib is in namespace std? // #include <cstddef> #if !defined(__STL_IMPORT_VENDOR_CSTD) && !defined(_STLP_IMPORT_VENDOR_CSTD) # define BOOST_NO_STDC_NAMESPACE #endif // check for exception handling support: #ifndef _CPPUNWIND # define BOOST_NO_EXCEPTIONS #endif // // C++0x features // #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS #if __DMC__ < 0x800 #error "Compiler not supported or configured - please reconfigure" #endif // // last known and checked version is ...: #if (__DMC__ > 0x848) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif #endif �������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/compiler/vacpp.hpp����������������������������0000644�0001750�0001750�00000004744�12320456500�025572� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Toon Knapen 2001 - 2003. // (C) Copyright Lie-Quan Lee 2001. // (C) Copyright Markus Schoepflin 2002 - 2003. // (C) Copyright Beman Dawes 2002 - 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Visual Age (IBM) C++ compiler setup: #if __IBMCPP__ <= 501 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS #endif #if (__IBMCPP__ <= 502) // Actually the compiler supports inclass member initialization but it // requires a definition for the class member and it doesn't recognize // it as an integral constant expression when used as a template argument. # define BOOST_NO_INCLASS_MEMBER_INITIALIZATION # define BOOST_NO_INTEGRAL_INT64_T # define BOOST_NO_MEMBER_TEMPLATE_KEYWORD #endif #if (__IBMCPP__ <= 600) || !defined(BOOST_STRICT_CONFIG) # define BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS # define BOOST_NO_INITIALIZER_LISTS #endif // // On AIX thread support seems to be indicated by _THREAD_SAFE: // #ifdef _THREAD_SAFE # define BOOST_HAS_THREADS #endif #define BOOST_COMPILER "IBM Visual Age version " BOOST_STRINGIZE(__IBMCPP__) // // versions check: // we don't support Visual age prior to version 5: #if __IBMCPP__ < 500 #error "Compiler not supported or configured - please reconfigure" #endif // // last known and checked version is 600: #if (__IBMCPP__ > 600) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif #endif // Some versions of the compiler have issues with default arguments on partial specializations #define BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS // // C++0x features // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS ����������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/compiler/mpw.hpp������������������������������0000644�0001750�0001750�00000004330�12320456500�025253� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2002. // (C) Copyright Aleksey Gurtovoy 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // MPW C++ compilers setup: # if defined(__SC__) # define BOOST_COMPILER "MPW SCpp version " BOOST_STRINGIZE(__SC__) # elif defined(__MRC__) # define BOOST_COMPILER "MPW MrCpp version " BOOST_STRINGIZE(__MRC__) # else # error "Using MPW compiler configuration by mistake. Please update." # endif // // MPW 8.90: // #if (MPW_CPLUS <= 0x890) || !defined(BOOST_STRICT_CONFIG) # define BOOST_NO_CV_SPECIALIZATIONS # define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS # define BOOST_NO_INCLASS_MEMBER_INITIALIZATION # define BOOST_NO_INTRINSIC_WCHAR_T # define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION # define BOOST_NO_USING_TEMPLATE # define BOOST_NO_CWCHAR # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS # define BOOST_NO_STD_ALLOCATOR /* actually a bug with const reference overloading */ # define BOOST_NO_INITIALIZER_LISTS #endif // // C++0x features // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS // // versions check: // we don't support MPW prior to version 8.9: #if MPW_CPLUS < 0x890 # error "Compiler not supported or configured - please reconfigure" #endif // // last known and checked version is 0x890: #if (MPW_CPLUS > 0x890) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/compiler/metrowerks.hpp�����������������������0000644�0001750�0001750�00000007304�12320456500�026656� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001. // (C) Copyright Darin Adler 2001. // (C) Copyright Peter Dimov 2001. // (C) Copyright David Abrahams 2001 - 2002. // (C) Copyright Beman Dawes 2001 - 2003. // (C) Copyright Stefan Slapeta 2004. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Metrowerks C++ compiler setup: // locale support is disabled when linking with the dynamic runtime # ifdef _MSL_NO_LOCALE # define BOOST_NO_STD_LOCALE # endif # if __MWERKS__ <= 0x2301 // 5.3 # define BOOST_NO_FUNCTION_TEMPLATE_ORDERING # define BOOST_NO_POINTER_TO_MEMBER_CONST # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS # define BOOST_NO_MEMBER_TEMPLATE_KEYWORD # endif # if __MWERKS__ <= 0x2401 // 6.2 //# define BOOST_NO_FUNCTION_TEMPLATE_ORDERING # endif # if(__MWERKS__ <= 0x2407) // 7.x # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS # define BOOST_NO_UNREACHABLE_RETURN_DETECTION # endif # if(__MWERKS__ <= 0x3003) // 8.x # define BOOST_NO_SFINAE # endif // the "|| !defined(BOOST_STRICT_CONFIG)" part should apply to the last // tested version *only*: # if(__MWERKS__ <= 0x3206) || !defined(BOOST_STRICT_CONFIG) // 9.5 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # define BOOST_NO_IS_ABSTRACT # define BOOST_NO_INITIALIZER_LISTS # endif #if !__option(wchar_type) # define BOOST_NO_INTRINSIC_WCHAR_T #endif #if !__option(exceptions) # define BOOST_NO_EXCEPTIONS #endif #if (__INTEL__ && _WIN32) || (__POWERPC__ && macintosh) # if __MWERKS__ == 0x3000 # define BOOST_COMPILER_VERSION 8.0 # elif __MWERKS__ == 0x3001 # define BOOST_COMPILER_VERSION 8.1 # elif __MWERKS__ == 0x3002 # define BOOST_COMPILER_VERSION 8.2 # elif __MWERKS__ == 0x3003 # define BOOST_COMPILER_VERSION 8.3 # elif __MWERKS__ == 0x3200 # define BOOST_COMPILER_VERSION 9.0 # elif __MWERKS__ == 0x3201 # define BOOST_COMPILER_VERSION 9.1 # elif __MWERKS__ == 0x3202 # define BOOST_COMPILER_VERSION 9.2 # elif __MWERKS__ == 0x3204 # define BOOST_COMPILER_VERSION 9.3 # elif __MWERKS__ == 0x3205 # define BOOST_COMPILER_VERSION 9.4 # elif __MWERKS__ == 0x3206 # define BOOST_COMPILER_VERSION 9.5 # else # define BOOST_COMPILER_VERSION __MWERKS__ # endif #else # define BOOST_COMPILER_VERSION __MWERKS__ #endif // // C++0x features // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // #if __MWERKS__ > 0x3206 && __option(rvalue_refs) # define BOOST_HAS_RVALUE_REFS #else # define BOOST_NO_RVALUE_REFERENCES #endif #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_RAW_LITERALS #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) // // versions check: // we don't support Metrowerks prior to version 5.3: #if __MWERKS__ < 0x2301 # error "Compiler not supported or configured - please reconfigure" #endif // // last known and checked version: #if (__MWERKS__ > 0x3205) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/compiler/common_edg.hpp�����������������������0000644�0001750�0001750�00000004731�12320456500�026564� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2002. // (C) Copyright Jens Maurer 2001. // (C) Copyright David Abrahams 2002. // (C) Copyright Aleksey Gurtovoy 2002. // (C) Copyright Markus Schoepflin 2005. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // // Options common to all edg based compilers. // // This is included from within the individual compiler mini-configs. #ifndef __EDG_VERSION__ # error This file requires that __EDG_VERSION__ be defined. #endif #if (__EDG_VERSION__ <= 238) # define BOOST_NO_INTEGRAL_INT64_T # define BOOST_NO_SFINAE #endif #if (__EDG_VERSION__ <= 240) # define BOOST_NO_VOID_RETURNS #endif #if (__EDG_VERSION__ <= 241) && !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) # define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP #endif #if (__EDG_VERSION__ <= 244) && !defined(BOOST_NO_TEMPLATE_TEMPLATES) # define BOOST_NO_TEMPLATE_TEMPLATES #endif #if (__EDG_VERSION__ < 300) && !defined(BOOST_NO_IS_ABSTRACT) # define BOOST_NO_IS_ABSTRACT #endif #if (__EDG_VERSION__ <= 303) && !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL #endif #if (__EDG_VERSION__ <= 310) || !defined(BOOST_STRICT_CONFIG) // No support for initializer lists # define BOOST_NO_INITIALIZER_LISTS #endif // See also kai.hpp which checks a Kai-specific symbol for EH # if !defined(__KCC) && !defined(__EXCEPTIONS) # define BOOST_NO_EXCEPTIONS # endif # if !defined(__NO_LONG_LONG) # define BOOST_HAS_LONG_LONG # else # define BOOST_NO_LONG_LONG # endif // // C++0x features // // See above for BOOST_NO_LONG_LONG // #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS #ifdef c_plusplus // EDG has "long long" in non-strict mode // However, some libraries have insufficient "long long" support // #define BOOST_HAS_LONG_LONG #endif ���������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/compiler/sunpro_cc.hpp������������������������0000644�0001750�0001750�00000007554�12320456500�026456� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001. // (C) Copyright Jens Maurer 2001 - 2003. // (C) Copyright Peter Dimov 2002. // (C) Copyright Aleksey Gurtovoy 2002 - 2003. // (C) Copyright David Abrahams 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Sun C++ compiler setup: # if __SUNPRO_CC <= 0x500 # define BOOST_NO_MEMBER_TEMPLATES # define BOOST_NO_FUNCTION_TEMPLATE_ORDERING # endif # if (__SUNPRO_CC <= 0x520) // // Sunpro 5.2 and earler: // // although sunpro 5.2 supports the syntax for // inline initialization it often gets the value // wrong, especially where the value is computed // from other constants (J Maddock 6th May 2001) # define BOOST_NO_INCLASS_MEMBER_INITIALIZATION // Although sunpro 5.2 supports the syntax for // partial specialization, it often seems to // bind to the wrong specialization. Better // to disable it until suppport becomes more stable // (J Maddock 6th May 2001). # define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION # endif # if (__SUNPRO_CC <= 0x530) // Requesting debug info (-g) with Boost.Python results // in an internal compiler error for "static const" // initialized in-class. // >> Assertion: (../links/dbg_cstabs.cc, line 611) // while processing ../test.cpp at line 0. // (Jens Maurer according to Gottfried Ganssauge 04 Mar 2002) # define BOOST_NO_INCLASS_MEMBER_INITIALIZATION // SunPro 5.3 has better support for partial specialization, // but breaks when compiling std::less<shared_ptr<T> > // (Jens Maurer 4 Nov 2001). // std::less specialization fixed as reported by George // Heintzelman; partial specialization re-enabled // (Peter Dimov 17 Jan 2002) //# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // integral constant expressions with 64 bit numbers fail # define BOOST_NO_INTEGRAL_INT64_T # endif # if (__SUNPRO_CC < 0x570) # define BOOST_NO_TEMPLATE_TEMPLATES // see http://lists.boost.org/MailArchives/boost/msg47184.php // and http://lists.boost.org/MailArchives/boost/msg47220.php # define BOOST_NO_INCLASS_MEMBER_INITIALIZATION # define BOOST_NO_SFINAE # define BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS # endif # if (__SUNPRO_CC <= 0x580) # define BOOST_NO_IS_ABSTRACT # endif // // Issues that effect all known versions: // #define BOOST_NO_TWO_PHASE_NAME_LOOKUP #define BOOST_NO_ADL_BARRIER #define BOOST_NO_INITIALIZER_LISTS // // C++0x features // #if(__SUNPRO_CC >= 0x590) # define BOOST_HAS_LONG_LONG #else # define BOOST_NO_LONG_LONG #endif #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS // // Version // #define BOOST_COMPILER "Sun compiler version " BOOST_STRINGIZE(__SUNPRO_CC) // // versions check: // we don't support sunpro prior to version 4: #if __SUNPRO_CC < 0x400 #error "Compiler not supported or configured - please reconfigure" #endif // // last known and checked version is 0x590: #if (__SUNPRO_CC > 0x590) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif #endif ����������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/compiler/pgi.hpp������������������������������0000644�0001750�0001750�00000002753�12320456500�025236� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright Noel Belcourt 2007. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // PGI C++ compiler setup: #define BOOST_COMPILER_VERSION __PGIC__##__PGIC_MINOR__ #define BOOST_COMPILER "PGI compiler version " BOOST_STRINGIZE(_COMPILER_VERSION) // // Threading support: // Turn this on unconditionally here, it will get turned off again later // if no threading API is detected. // #if (__PGIC__ >= 7) #define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL #define BOOST_NO_TWO_PHASE_NAME_LOOKUP #define BOOST_NO_SWPRINTF #define BOOST_NO_INITIALIZER_LISTS #else # error "Pgi compiler not configured - please reconfigure" #endif // // C++0x features // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS // // version check: // probably nothing to do here? ���������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/compiler/gcc_xml.hpp��������������������������0000644�0001750�0001750�00000001621�12320456500�026064� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2006. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // GCC-XML C++ compiler setup: # if !defined(__GCCXML_GNUC__) || ((__GCCXML_GNUC__ <= 3) && (__GCCXML_GNUC_MINOR__ <= 3)) # define BOOST_NO_IS_ABSTRACT # endif // // Threading support: Turn this on unconditionally here (except for // those platforms where we can know for sure). It will get turned off again // later if no threading API is detected. // #if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(linux) && !defined(__linux) && !defined(__linux__) # define BOOST_HAS_THREADS #endif // // gcc has "long long" // #define BOOST_HAS_LONG_LONG #define BOOST_COMPILER "GCC-XML C++ version " __GCCXML__ ���������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/compiler/greenhills.hpp�����������������������0000644�0001750�0001750�00000001457�12320456500�026613� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Greenhills C++ compiler setup: #define BOOST_COMPILER "Greenhills C++ version " BOOST_STRINGIZE(__ghs) #include "boost/config/compiler/common_edg.hpp" // // versions check: // we don't support Greenhills prior to version 0: #if __ghs < 0 # error "Compiler not supported or configured - please reconfigure" #endif // // last known and checked version is 0: #if (__ghs > 0) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/compiler/visualc.hpp��������������������������0000644�0001750�0001750�00000016452�12320456500�026126� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Darin Adler 2001 - 2002. // (C) Copyright Peter Dimov 2001. // (C) Copyright Aleksey Gurtovoy 2002. // (C) Copyright David Abrahams 2002 - 2003. // (C) Copyright Beman Dawes 2002 - 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Microsoft Visual C++ compiler setup: #define BOOST_MSVC _MSC_VER // turn off the warnings before we #include anything #pragma warning( disable : 4503 ) // warning: decorated name length exceeded #if _MSC_VER < 1300 // 1200 == VC++ 6.0, 1200-1202 == eVC++4 # pragma warning( disable : 4786 ) // ident trunc to '255' chars in debug info # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS # define BOOST_NO_VOID_RETURNS # define BOOST_NO_EXCEPTION_STD_NAMESPACE # if BOOST_MSVC == 1202 # define BOOST_NO_STD_TYPEINFO # endif // disable min/max macro defines on vc6: // #endif #if (_MSC_VER <= 1300) // 1300 == VC++ 7.0 # if !defined(_MSC_EXTENSIONS) && !defined(BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS) // VC7 bug with /Za # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS # endif # define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS # define BOOST_NO_INCLASS_MEMBER_INITIALIZATION # define BOOST_NO_PRIVATE_IN_AGGREGATE # define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP # define BOOST_NO_INTEGRAL_INT64_T # define BOOST_NO_DEDUCED_TYPENAME # define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE // VC++ 6/7 has member templates but they have numerous problems including // cases of silent failure, so for safety we define: # define BOOST_NO_MEMBER_TEMPLATES // For VC++ experts wishing to attempt workarounds, we define: # define BOOST_MSVC6_MEMBER_TEMPLATES # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION # define BOOST_NO_CV_VOID_SPECIALIZATIONS # define BOOST_NO_FUNCTION_TEMPLATE_ORDERING # define BOOST_NO_USING_TEMPLATE # define BOOST_NO_SWPRINTF # define BOOST_NO_TEMPLATE_TEMPLATES # define BOOST_NO_SFINAE # define BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS # define BOOST_NO_IS_ABSTRACT # define BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS // TODO: what version is meant here? Have there really been any fixes in cl 12.01 (as e.g. shipped with eVC4)? # if (_MSC_VER > 1200) # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS # endif #endif #if _MSC_VER < 1400 // although a conforming signature for swprint exists in VC7.1 // it appears not to actually work: # define BOOST_NO_SWPRINTF #endif #if defined(UNDER_CE) // Windows CE does not have a conforming signature for swprintf # define BOOST_NO_SWPRINTF #endif #if _MSC_VER <= 1400 // 1400 == VC++ 8.0 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS #endif #if _MSC_VER <= 1600 // 1600 == VC++ 10.0 # define BOOST_NO_TWO_PHASE_NAME_LOOKUP #endif #if _MSC_VER == 1500 // 1500 == VC++ 9.0 // A bug in VC9: # define BOOST_NO_ADL_BARRIER #endif #if _MSC_VER <= 1500 || !defined(BOOST_STRICT_CONFIG) // 1500 == VC++ 9.0 # define BOOST_NO_INITIALIZER_LISTS #endif #ifndef _NATIVE_WCHAR_T_DEFINED # define BOOST_NO_INTRINSIC_WCHAR_T #endif #if defined(_WIN32_WCE) || defined(UNDER_CE) # define BOOST_NO_THREADEX # define BOOST_NO_GETSYSTEMTIMEASFILETIME # define BOOST_NO_SWPRINTF #endif // // check for exception handling support: #ifndef _CPPUNWIND # define BOOST_NO_EXCEPTIONS #endif // // __int64 support: // #if (_MSC_VER >= 1200) # define BOOST_HAS_MS_INT64 #endif #if (_MSC_VER >= 1310) && defined(_MSC_EXTENSIONS) # define BOOST_HAS_LONG_LONG #else # define BOOST_NO_LONG_LONG #endif #if (_MSC_VER >= 1400) && !defined(_DEBUG) # define BOOST_HAS_NRVO #endif // // disable Win32 API's if compiler extentions are // turned off: // #ifndef _MSC_EXTENSIONS # define BOOST_DISABLE_WIN32 #endif #ifndef _CPPRTTI # define BOOST_NO_RTTI #endif // // all versions support __declspec: // #define BOOST_HAS_DECLSPEC // // C++0x features // // See above for BOOST_NO_LONG_LONG #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_RAW_LITERALS #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES // MSVC 2010 CTP has some support for C++0x, but we still disable it until the compiler release // #if _MSC_VER < 1600 #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS // #endif // _MSC_VER < 1600 // // prefix and suffix headers: // #ifndef BOOST_ABI_PREFIX # define BOOST_ABI_PREFIX "boost/config/abi/msvc_prefix.hpp" #endif #ifndef BOOST_ABI_SUFFIX # define BOOST_ABI_SUFFIX "boost/config/abi/msvc_suffix.hpp" #endif // TODO: // these things are mostly bogus. 1200 means version 12.0 of the compiler. The // artificial versions assigned to them only refer to the versions of some IDE // these compilers have been shipped with, and even that is not all of it. Some // were shipped with freely downloadable SDKs, others as crosscompilers in eVC. // IOW, you can't use these 'versions' in any sensible way. Sorry. # if defined(UNDER_CE) # if _MSC_VER < 1200 // Note: these are so far off, they are not really supported # elif _MSC_VER < 1300 // eVC++ 4 comes with 1200-1202 # define BOOST_COMPILER_VERSION evc4.0 # elif _MSC_VER == 1400 # define BOOST_COMPILER_VERSION evc8 # elif _MSC_VER == 1500 # define BOOST_COMPILER_VERSION evc9 # elif _MSC_VER == 1600 # define BOOST_COMPILER_VERSION evc10 # else # if defined(BOOST_ASSERT_CONFIG) # error "Unknown EVC++ compiler version - please run the configure tests and report the results" # else # pragma message("Unknown EVC++ compiler version - please run the configure tests and report the results") # endif # endif # else # if _MSC_VER < 1200 // Note: these are so far off, they are not really supported # define BOOST_COMPILER_VERSION 5.0 # elif _MSC_VER < 1300 # define BOOST_COMPILER_VERSION 6.0 # elif _MSC_VER == 1300 # define BOOST_COMPILER_VERSION 7.0 # elif _MSC_VER == 1310 # define BOOST_COMPILER_VERSION 7.1 # elif _MSC_VER == 1400 # define BOOST_COMPILER_VERSION 8.0 # elif _MSC_VER == 1500 # define BOOST_COMPILER_VERSION 9.0 # elif _MSC_VER == 1600 # define BOOST_COMPILER_VERSION 10.0 # else # define BOOST_COMPILER_VERSION _MSC_VER # endif # endif #define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) // // versions check: // we don't support Visual C++ prior to version 6: #if _MSC_VER < 1200 #error "Compiler not supported or configured - please reconfigure" #endif // // last known and checked version is 1500 (VC9): #if (_MSC_VER > 1600) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # else # pragma message("Unknown compiler version - please run the configure tests and report the results") # endif #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/compiler/codegear.hpp�������������������������0000644�0001750�0001750�00000010614�12320456500�026223� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright David Abrahams 2002 - 2003. // (C) Copyright Aleksey Gurtovoy 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // CodeGear C++ compiler setup: #if !defined( BOOST_WITH_CODEGEAR_WARNINGS ) // these warnings occur frequently in optimized template code # pragma warn -8004 // var assigned value, but never used # pragma warn -8008 // condition always true/false # pragma warn -8066 // dead code can never execute # pragma warn -8104 // static members with ctors not threadsafe # pragma warn -8105 // reference member in class without ctors #endif // // versions check: // last known and checked version is 0x610 #if (__CODEGEARC__ > 0x610) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # else # pragma message( "Unknown compiler version - please run the configure tests and report the results") # endif #endif // CodeGear C++ Builder 2009 #if (__CODEGEARC__ <= 0x610) # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # define BOOST_NO_PRIVATE_IN_AGGREGATE # define BOOST_NO_TWO_PHASE_NAME_LOOKUP # define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE # define BOOST_NO_USING_TEMPLATE // we shouldn't really need this - but too many things choke // without it, this needs more investigation: # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS # define BOOST_NO_TYPENAME_WITH_CTOR // Cannot use typename keyword when making temporaries of a dependant type # define BOOST_NO_NESTED_FRIENDSHIP // TC1 gives nested classes access rights as any other member // Temporary hack, until specific MPL preprocessed headers are generated # define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS # ifdef NDEBUG // fix broken <cstring> so that Boost.test works: # include <cstring> # undef strcmp # endif // fix broken errno declaration: # include <errno.h> # ifndef errno # define errno errno # endif #endif // // C++0x macros: // #define BOOST_HAS_CHAR16_T #define BOOST_HAS_CHAR32_T #define BOOST_HAS_LONG_LONG // #define BOOST_HAS_ALIGNOF #define BOOST_HAS_DECLTYPE #define BOOST_HAS_EXPLICIT_CONVERSION_OPS // #define BOOST_HAS_RVALUE_REFS #define BOOST_HAS_SCOPED_ENUM // #define BOOST_HAS_STATIC_ASSERT #define BOOST_HAS_STD_TYPE_TRAITS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_VARIADIC_TEMPLATES #define BOOST_NO_CONSTEXPR #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_RAW_LITERALS #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS // // TR1 macros: // #define BOOST_HAS_TR1_HASH #define BOOST_HAS_TR1_TYPE_TRAITS #define BOOST_HAS_TR1_UNORDERED_MAP #define BOOST_HAS_TR1_UNORDERED_SET #define BOOST_HAS_MACRO_USE_FACET #define BOOST_NO_INITIALIZER_LISTS // On non-Win32 platforms let the platform config figure this out: #ifdef _WIN32 # define BOOST_HAS_STDINT_H #endif // // __int64: // #if !defined(__STRICT_ANSI__) # define BOOST_HAS_MS_INT64 #endif // // check for exception handling support: // #if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif // // all versions have a <dirent.h>: // #if !defined(__STRICT_ANSI__) # define BOOST_HAS_DIRENT_H #endif // // all versions support __declspec: // #if !defined(__STRICT_ANSI__) # define BOOST_HAS_DECLSPEC #endif // // ABI fixing headers: // #ifndef BOOST_ABI_PREFIX # define BOOST_ABI_PREFIX "boost/config/abi/borland_prefix.hpp" #endif #ifndef BOOST_ABI_SUFFIX # define BOOST_ABI_SUFFIX "boost/config/abi/borland_suffix.hpp" #endif // // Disable Win32 support in ANSI mode: // # pragma defineonoption BOOST_DISABLE_WIN32 -A // // MSVC compatibility mode does some nasty things: // TODO: look up if this doesn't apply to the whole 12xx range // #if defined(_MSC_VER) && (_MSC_VER <= 1200) # define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP # define BOOST_NO_VOID_RETURNS #endif #define BOOST_COMPILER "CodeGear C++ version " BOOST_STRINGIZE(__CODEGEARC__) ��������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/compiler/compaq_cxx.hpp�����������������������0000644�0001750�0001750�00000000765�12320456500�026622� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Tru64 C++ compiler setup (now HP): #define BOOST_COMPILER "HP Tru64 C++ " BOOST_STRINGIZE(__DECCXX_VER) #include "boost/config/compiler/common_edg.hpp" // // versions check: // Nothing to do here? �����������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/compiler/hp_acc.hpp���������������������������0000644�0001750�0001750�00000007417�12320456500�025676� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Jens Maurer 2001 - 2003. // (C) Copyright Aleksey Gurtovoy 2002. // (C) Copyright David Abrahams 2002 - 2003. // (C) Copyright Toon Knapen 2003. // (C) Copyright Boris Gubenko 2006 - 2007. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // HP aCC C++ compiler setup: #if defined(__EDG__) #include "boost/config/compiler/common_edg.hpp" #endif #if (__HP_aCC <= 33100) # define BOOST_NO_INTEGRAL_INT64_T # define BOOST_NO_OPERATORS_IN_NAMESPACE # if !defined(_NAMESPACE_STD) # define BOOST_NO_STD_LOCALE # define BOOST_NO_STRINGSTREAM # endif #endif #if (__HP_aCC <= 33300) // member templates are sufficiently broken that we disable them for now # define BOOST_NO_MEMBER_TEMPLATES # define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS # define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE #endif #if (__HP_aCC <= 38000) # define BOOST_NO_TWO_PHASE_NAME_LOOKUP #endif #if (__HP_aCC > 50000) && (__HP_aCC < 60000) # define BOOST_NO_UNREACHABLE_RETURN_DETECTION # define BOOST_NO_TEMPLATE_TEMPLATES # define BOOST_NO_SWPRINTF # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS # define BOOST_NO_IS_ABSTRACT # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS #endif // optional features rather than defects: #if (__HP_aCC >= 33900) # define BOOST_HAS_LONG_LONG # define BOOST_HAS_PARTIAL_STD_ALLOCATOR #endif #if (__HP_aCC >= 50000 ) && (__HP_aCC <= 53800 ) || (__HP_aCC < 31300 ) # define BOOST_NO_MEMBER_TEMPLATE_KEYWORD #endif // This macro should not be defined when compiling in strict ansi // mode, but, currently, we don't have the ability to determine // what standard mode we are compiling with. Some future version // of aCC6 compiler will provide predefined macros reflecting the // compilation options, including the standard mode. #if (__HP_aCC >= 60000) || ((__HP_aCC > 38000) && defined(__hpxstd98)) # define BOOST_NO_TWO_PHASE_NAME_LOOKUP #endif #define BOOST_COMPILER "HP aCC version " BOOST_STRINGIZE(__HP_aCC) // // versions check: // we don't support HP aCC prior to version 33000: #if __HP_aCC < 33000 # error "Compiler not supported or configured - please reconfigure" #endif // // Extended checks for supporting aCC on PA-RISC #if __HP_aCC > 30000 && __HP_aCC < 50000 # if __HP_aCC < 38000 // versions prior to version A.03.80 not supported # error "Compiler version not supported - version A.03.80 or higher is required" # elif !defined(__hpxstd98) // must compile using the option +hpxstd98 with version A.03.80 and above # error "Compiler option '+hpxstd98' is required for proper support" # endif //PA-RISC #endif // // C++0x features // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS // // last known and checked version for HP-UX/ia64 is 61300 // last known and checked version for PA-RISC is 38000 #if ((__HP_aCC > 61300) || ((__HP_aCC > 38000) && defined(__hpxstd98))) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/compiler/kai.hpp������������������������������0000644�0001750�0001750�00000002050�12320456500�025211� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001. // (C) Copyright David Abrahams 2002. // (C) Copyright Aleksey Gurtovoy 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Kai C++ compiler setup: #include "boost/config/compiler/common_edg.hpp" # if (__KCC_VERSION <= 4001) || !defined(BOOST_STRICT_CONFIG) // at least on Sun, the contents of <cwchar> is not in namespace std # define BOOST_NO_STDC_NAMESPACE # endif // see also common_edg.hpp which needs a special check for __KCC # if !defined(_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS # endif #define BOOST_COMPILER "Kai C++ version " BOOST_STRINGIZE(__KCC_VERSION) // // last known and checked version is 4001: #if (__KCC_VERSION > 4001) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/compiler/borland.hpp��������������������������0000644�0001750�0001750�00000016675�12320456500�026110� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright David Abrahams 2002 - 2003. // (C) Copyright Aleksey Gurtovoy 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Borland C++ compiler setup: // // versions check: // we don't support Borland prior to version 5.4: #if __BORLANDC__ < 0x540 # error "Compiler not supported or configured - please reconfigure" #endif // last known compiler version: #if (__BORLANDC__ > 0x610) //# if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" //# else //# pragma message( "Unknown compiler version - please run the configure tests and report the results") //# endif #elif (__BORLANDC__ == 0x600) # error "CBuilderX preview compiler is no longer supported" #endif // // Support macros to help with standard library detection #if (__BORLANDC__ < 0x560) || defined(_USE_OLD_RW_STL) # define BOOST_BCB_WITH_ROGUE_WAVE #elif __BORLANDC__ < 0x570 # define BOOST_BCB_WITH_STLPORT #else # define BOOST_BCB_WITH_DINKUMWARE #endif // // Version 5.0 and below: # if __BORLANDC__ <= 0x0550 // Borland C++Builder 4 and 5: # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # if __BORLANDC__ == 0x0550 // Borland C++Builder 5, command-line compiler 5.5: # define BOOST_NO_OPERATORS_IN_NAMESPACE # endif # endif // Version 5.51 and below: #if (__BORLANDC__ <= 0x551) # define BOOST_NO_CV_SPECIALIZATIONS # define BOOST_NO_CV_VOID_SPECIALIZATIONS # define BOOST_NO_DEDUCED_TYPENAME // workaround for missing WCHAR_MAX/WCHAR_MIN: #include <climits> #include <cwchar> #ifndef WCHAR_MAX # define WCHAR_MAX 0xffff #endif #ifndef WCHAR_MIN # define WCHAR_MIN 0 #endif #endif // Borland C++ Builder 6 and below: #if (__BORLANDC__ <= 0x564) # define BOOST_NO_INTEGRAL_INT64_T # ifdef NDEBUG // fix broken <cstring> so that Boost.test works: # include <cstring> # undef strcmp # endif // fix broken errno declaration: # include <errno.h> # ifndef errno # define errno errno # endif #endif // // new bug in 5.61: #if (__BORLANDC__ >= 0x561) && (__BORLANDC__ <= 0x580) // this seems to be needed by the command line compiler, but not the IDE: # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS #endif // Borland C++ Builder 2006 Update 2 and below: #if (__BORLANDC__ <= 0x582) # define BOOST_NO_SFINAE # define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG # define BOOST_NO_TEMPLATE_TEMPLATES # define BOOST_NO_PRIVATE_IN_AGGREGATE # ifdef _WIN32 # define BOOST_NO_SWPRINTF # elif defined(linux) || defined(__linux__) || defined(__linux) // we should really be able to do without this // but the wcs* functions aren't imported into std:: # define BOOST_NO_STDC_NAMESPACE // _CPPUNWIND doesn't get automatically set for some reason: # pragma defineonoption BOOST_CPPUNWIND -x # endif #endif // Borland C++ Builder 2007 December 2007 Update and below: //#if (__BORLANDC__ <= 0x593) #if (__BORLANDC__ <= 0x610) // Beman has asked Alisdair for more info // we shouldn't really need this - but too many things choke // without it, this needs more investigation: # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS # define BOOST_NO_IS_ABSTRACT # define BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS // Temporary workaround #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS #endif // Borland C++ Builder 2008 and below: #if (__BORLANDC__ <= 0x601) # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # define BOOST_ILLEGAL_CV_REFERENCES # define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # define BOOST_NO_TWO_PHASE_NAME_LOOKUP # define BOOST_NO_USING_TEMPLATE # define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE #endif // // Positive Feature detection // // Borland C++ Builder 2008 and below: #if (__BORLANDC__ >= 0x599) # pragma defineonoption BOOST_CODEGEAR_0X_SUPPORT -Ax #endif // // C++0x Macros: // #if defined( BOOST_CODEGEAR_0X_SUPPORT ) && (__BORLANDC__ >= 0x610) # define BOOST_HAS_ALIGNOF # define BOOST_HAS_CHAR16_T # define BOOST_HAS_CHAR32_T # define BOOST_HAS_DECLTYPE # define BOOST_HAS_EXPLICIT_CONVERSION_OPS # define BOOST_HAS_REF_QUALIFIER # define BOOST_HAS_RVALUE_REFS # define BOOST_HAS_STATIC_ASSERT # define BOOST_NO_EXTERN_TEMPLATE # define BOOST_NO_SCOPED_ENUMS # define BOOST_NO_VARIADIC_TEMPLATES # define BOOST_NO_CONSTEXPR # define BOOST_NO_DEFAULTED_FUNCTIONS # define BOOST_NO_DELETED_FUNCTIONS # define BOOST_NO_RAW_LITERALS # define BOOST_NO_UNICODE_LITERALS // UTF-8 still not supported #else # define BOOST_NO_CHAR16_T # define BOOST_NO_CHAR32_T # define BOOST_NO_DECLTYPE # define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS # define BOOST_NO_EXTERN_TEMPLATE # define BOOST_NO_SCOPED_ENUMS # define BOOST_NO_STATIC_ASSERT # define BOOST_NO_RVALUE_REFERENCES # define BOOST_NO_VARIADIC_TEMPLATES # define BOOST_NO_CONSTEXPR # define BOOST_NO_DEFAULTED_FUNCTIONS # define BOOST_NO_DELETED_FUNCTIONS # define BOOST_NO_RAW_LITERALS # define BOOST_NO_UNICODE_LITERALS #endif #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_NO_INITIALIZER_LISTS #if __BORLANDC__ >= 0x590 # define BOOST_HAS_TR1_HASH # define BOOST_HAS_MACRO_USE_FACET #endif // // Post 0x561 we have long long and stdint.h: #if __BORLANDC__ >= 0x561 # ifndef __NO_LONG_LONG # define BOOST_HAS_LONG_LONG # else # define BOOST_NO_LONG_LONG # endif // On non-Win32 platforms let the platform config figure this out: # ifdef _WIN32 # define BOOST_HAS_STDINT_H # endif #endif // Borland C++Builder 6 defaults to using STLPort. If _USE_OLD_RW_STL is // defined, then we have 0x560 or greater with the Rogue Wave implementation // which presumably has the std::DBL_MAX bug. #if defined( BOOST_BCB_WITH_ROGUE_WAVE ) // <climits> is partly broken, some macros define symbols that are really in // namespace std, so you end up having to use illegal constructs like // std::DBL_MAX, as a fix we'll just include float.h and have done with: #include <float.h> #endif // // __int64: // #if (__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__) # define BOOST_HAS_MS_INT64 #endif // // check for exception handling support: // #if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif // // all versions have a <dirent.h>: // #ifndef __STRICT_ANSI__ # define BOOST_HAS_DIRENT_H #endif // // all versions support __declspec: // #ifndef __STRICT_ANSI__ # define BOOST_HAS_DECLSPEC #endif // // ABI fixing headers: // #if __BORLANDC__ < 0x600 // not implemented for version 6 compiler yet #ifndef BOOST_ABI_PREFIX # define BOOST_ABI_PREFIX "boost/config/abi/borland_prefix.hpp" #endif #ifndef BOOST_ABI_SUFFIX # define BOOST_ABI_SUFFIX "boost/config/abi/borland_suffix.hpp" #endif #endif // // Disable Win32 support in ANSI mode: // #if __BORLANDC__ < 0x600 # pragma defineonoption BOOST_DISABLE_WIN32 -A #elif defined(__STRICT_ANSI__) # define BOOST_DISABLE_WIN32 #endif // // MSVC compatibility mode does some nasty things: // TODO: look up if this doesn't apply to the whole 12xx range // #if defined(_MSC_VER) && (_MSC_VER <= 1200) # define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP # define BOOST_NO_VOID_RETURNS #endif #define BOOST_COMPILER "Borland C++ version " BOOST_STRINGIZE(__BORLANDC__) �������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/compiler/comeau.hpp���������������������������0000644�0001750�0001750�00000003137�12320456500�025725� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001. // (C) Copyright Douglas Gregor 2001. // (C) Copyright Peter Dimov 2001. // (C) Copyright Aleksey Gurtovoy 2003. // (C) Copyright Beman Dawes 2003. // (C) Copyright Jens Maurer 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Comeau C++ compiler setup: #include "boost/config/compiler/common_edg.hpp" #if (__COMO_VERSION__ <= 4245) # if defined(_MSC_VER) && _MSC_VER <= 1300 # if _MSC_VER > 100 // only set this in non-strict mode: # define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP # endif # endif // Void returns don't work when emulating VC 6 (Peter Dimov) // TODO: look up if this doesn't apply to the whole 12xx range # if defined(_MSC_VER) && (_MSC_VER < 1300) # define BOOST_NO_VOID_RETURNS # endif #endif // version 4245 // // enable __int64 support in VC emulation mode // # if defined(_MSC_VER) && (_MSC_VER >= 1200) # define BOOST_HAS_MS_INT64 # endif #define BOOST_COMPILER "Comeau compiler version " BOOST_STRINGIZE(__COMO_VERSION__) // // versions check: // we don't know Comeau prior to version 4245: #if __COMO_VERSION__ < 4245 # error "Compiler not configured - please reconfigure" #endif // // last known and checked version is 4245: #if (__COMO_VERSION__ > 4245) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/compiler/sgi_mipspro.hpp����������������������0000644�0001750�0001750�00000002615�12320456500�027007� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // SGI C++ compiler setup: #define BOOST_COMPILER "SGI Irix compiler version " BOOST_STRINGIZE(_COMPILER_VERSION) #include "boost/config/compiler/common_edg.hpp" // // Threading support: // Turn this on unconditionally here, it will get turned off again later // if no threading API is detected. // #define BOOST_HAS_THREADS #define BOOST_NO_TWO_PHASE_NAME_LOOKUP #undef BOOST_NO_SWPRINTF #undef BOOST_DEDUCED_TYPENAME #define BOOST_NO_INITIALIZER_LISTS // // C++0x features // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_STATIC_ASSERT #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS // // version check: // probably nothing to do here? �������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/compiler/gcc.hpp������������������������������0000644�0001750�0001750�00000011745�12320456500�025214� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Darin Adler 2001 - 2002. // (C) Copyright Jens Maurer 2001 - 2002. // (C) Copyright Beman Dawes 2001 - 2003. // (C) Copyright Douglas Gregor 2002. // (C) Copyright David Abrahams 2002 - 2003. // (C) Copyright Synge Todo 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // GNU C++ compiler setup: #if __GNUC__ < 3 # if __GNUC_MINOR__ == 91 // egcs 1.1 won't parse shared_ptr.hpp without this: # define BOOST_NO_AUTO_PTR # endif # if __GNUC_MINOR__ < 95 // // Prior to gcc 2.95 member templates only partly // work - define BOOST_MSVC6_MEMBER_TEMPLATES // instead since inline member templates mostly work. // # define BOOST_NO_MEMBER_TEMPLATES # if __GNUC_MINOR__ >= 9 # define BOOST_MSVC6_MEMBER_TEMPLATES # endif # endif # if __GNUC_MINOR__ < 96 # define BOOST_NO_SFINAE # endif # if __GNUC_MINOR__ <= 97 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # define BOOST_NO_OPERATORS_IN_NAMESPACE # endif # define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # define BOOST_NO_IS_ABSTRACT #elif __GNUC__ == 3 # if defined (__PATHSCALE__) # define BOOST_NO_TWO_PHASE_NAME_LOOKUP # define BOOST_NO_IS_ABSTRACT # endif // // gcc-3.x problems: // // Bug specific to gcc 3.1 and 3.2: // # if ((__GNUC_MINOR__ == 1) || (__GNUC_MINOR__ == 2)) # define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS # endif # if __GNUC_MINOR__ < 4 # define BOOST_NO_IS_ABSTRACT # endif #endif #if __GNUC__ < 4 // // All problems to gcc-3.x and earlier here: // #define BOOST_NO_TWO_PHASE_NAME_LOOKUP #endif #ifndef __EXCEPTIONS # define BOOST_NO_EXCEPTIONS #endif // // Threading support: Turn this on unconditionally here (except for // those platforms where we can know for sure). It will get turned off again // later if no threading API is detected. // #if !defined(__MINGW32__) && !defined(linux) && !defined(__linux) && !defined(__linux__) # define BOOST_HAS_THREADS #endif // // gcc has "long long" // #define BOOST_HAS_LONG_LONG // // gcc implements the named return value optimization since version 3.1 // #if __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 ) #define BOOST_HAS_NRVO #endif // // RTTI and typeinfo detection is possible post gcc-4.3: // #if __GNUC__ * 100 + __GNUC_MINOR__ >= 403 # ifndef __GXX_RTTI # define BOOST_NO_TYPEID # define BOOST_NO_RTTI # endif #endif // // C++0x features // #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T #define BOOST_NO_CONSTEXPR #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_RAW_LITERALS #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_UNICODE_LITERALS // See below for BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) && defined(__GXX_EXPERIMENTAL_CXX0X__) // C++0x features are only enabled when -std=c++0x or -std=gnu++0x are // passed on the command line, which in turn defines // __GXX_EXPERIMENTAL_CXX0X__. # define BOOST_HAS_DECLTYPE # define BOOST_HAS_RVALUE_REFS # define BOOST_HAS_STATIC_ASSERT # define BOOST_HAS_VARIADIC_TMPL #else # define BOOST_NO_DECLTYPE # define BOOST_NO_RVALUE_REFERENCES # define BOOST_NO_STATIC_ASSERT // Variadic templates compiler: // http://www.generic-programming.org/~dgregor/cpp/variadic-templates.html # ifdef __VARIADIC_TEMPLATES # define BOOST_HAS_VARIADIC_TMPL # else # define BOOST_NO_VARIADIC_TEMPLATES # endif #endif #if !defined(__GXX_EXPERIMENTAL_CXX0X__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) # define BOOST_NO_INITIALIZER_LISTS # define BOOST_NO_AUTO_DECLARATIONS #endif // ConceptGCC compiler: // http://www.generic-programming.org/software/ConceptGCC/ #ifdef __GXX_CONCEPTS__ # define BOOST_HAS_CONCEPTS # define BOOST_COMPILER "ConceptGCC version " __VERSION__ #endif #ifndef BOOST_COMPILER # define BOOST_COMPILER "GNU C++ version " __VERSION__ #endif // // versions check: // we don't know gcc prior to version 2.90: #if (__GNUC__ == 2) && (__GNUC_MINOR__ < 90) # error "Compiler not configured - please reconfigure" #endif // // last known and checked version is 4.3 (Pre-release): #if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 3)) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # else // we don't emit warnings here anymore since there are no defect macros defined for // gcc post 3.4, so any failures are gcc regressions... //# warning "Unknown compiler version - please run the configure tests and report the results" # endif #endif ���������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/suffix.hpp������������������������������������0000644�0001750�0001750�00000044544�12320456500�024155� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Boost config.hpp configuration header file ------------------------------// // Copyright (c) 2001-2003 John Maddock // Copyright (c) 2001 Darin Adler // Copyright (c) 2001 Peter Dimov // Copyright (c) 2002 Bill Kempf // Copyright (c) 2002 Jens Maurer // Copyright (c) 2002-2003 David Abrahams // Copyright (c) 2003 Gennaro Prota // Copyright (c) 2003 Eric Friedman // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/ for most recent version. // Boost config.hpp policy and rationale documentation has been moved to // http://www.boost.org/libs/config/ // // This file is intended to be stable, and relatively unchanging. // It should contain boilerplate code only - no compiler specific // code unless it is unavoidable - no changes unless unavoidable. #ifndef BOOST_CONFIG_SUFFIX_HPP #define BOOST_CONFIG_SUFFIX_HPP // // look for long long by looking for the appropriate macros in <limits.h>. // Note that we use limits.h rather than climits for maximal portability, // remember that since these just declare a bunch of macros, there should be // no namespace issues from this. // #if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_LONG_LONG) \ && !defined(BOOST_MSVC) && !defined(__BORLANDC__) # include <limits.h> # if (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX)) # define BOOST_HAS_LONG_LONG # else # define BOOST_NO_LONG_LONG # endif #endif // GCC 3.x will clean up all of those nasty macro definitions that // BOOST_NO_CTYPE_FUNCTIONS is intended to help work around, so undefine // it under GCC 3.x. #if defined(__GNUC__) && (__GNUC__ >= 3) && defined(BOOST_NO_CTYPE_FUNCTIONS) # undef BOOST_NO_CTYPE_FUNCTIONS #endif // // Assume any extensions are in namespace std:: unless stated otherwise: // # ifndef BOOST_STD_EXTENSION_NAMESPACE # define BOOST_STD_EXTENSION_NAMESPACE std # endif // // If cv-qualified specializations are not allowed, then neither are cv-void ones: // # if defined(BOOST_NO_CV_SPECIALIZATIONS) \ && !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) # define BOOST_NO_CV_VOID_SPECIALIZATIONS # endif // // If there is no numeric_limits template, then it can't have any compile time // constants either! // # if defined(BOOST_NO_LIMITS) \ && !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS # define BOOST_NO_MS_INT64_NUMERIC_LIMITS # define BOOST_NO_LONG_LONG_NUMERIC_LIMITS # endif // // if there is no long long then there is no specialisation // for numeric_limits<long long> either: // #if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS) # define BOOST_NO_LONG_LONG_NUMERIC_LIMITS #endif // // if there is no __int64 then there is no specialisation // for numeric_limits<__int64> either: // #if !defined(BOOST_HAS_MS_INT64) && !defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS) # define BOOST_NO_MS_INT64_NUMERIC_LIMITS #endif // // if member templates are supported then so is the // VC6 subset of member templates: // # if !defined(BOOST_NO_MEMBER_TEMPLATES) \ && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) # define BOOST_MSVC6_MEMBER_TEMPLATES # endif // // Without partial specialization, can't test for partial specialisation bugs: // # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ && !defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) # define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG # endif // // Without partial specialization, we can't have array-type partial specialisations: // # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ && !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) # define BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS # endif // // Without partial specialization, std::iterator_traits can't work: // # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ && !defined(BOOST_NO_STD_ITERATOR_TRAITS) # define BOOST_NO_STD_ITERATOR_TRAITS # endif // // Without partial specialization, partial // specialization with default args won't work either: // # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ && !defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS) # define BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS # endif // // Without member template support, we can't have template constructors // in the standard library either: // # if defined(BOOST_NO_MEMBER_TEMPLATES) \ && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \ && !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) # define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS # endif // // Without member template support, we can't have a conforming // std::allocator template either: // # if defined(BOOST_NO_MEMBER_TEMPLATES) \ && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \ && !defined(BOOST_NO_STD_ALLOCATOR) # define BOOST_NO_STD_ALLOCATOR # endif // // without ADL support then using declarations will break ADL as well: // #if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) && !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL #endif // // Without typeid support we have no dynamic RTTI either: // #if defined(BOOST_NO_TYPEID) && !defined(BOOST_NO_RTTI) # define BOOST_NO_RTTI #endif // // If we have a standard allocator, then we have a partial one as well: // #if !defined(BOOST_NO_STD_ALLOCATOR) # define BOOST_HAS_PARTIAL_STD_ALLOCATOR #endif // // We can't have a working std::use_facet if there is no std::locale: // # if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_USE_FACET) # define BOOST_NO_STD_USE_FACET # endif // // We can't have a std::messages facet if there is no std::locale: // # if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_MESSAGES) # define BOOST_NO_STD_MESSAGES # endif // // We can't have a working std::wstreambuf if there is no std::locale: // # if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_WSTREAMBUF) # define BOOST_NO_STD_WSTREAMBUF # endif // // We can't have a <cwctype> if there is no <cwchar>: // # if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_CWCTYPE) # define BOOST_NO_CWCTYPE # endif // // We can't have a swprintf if there is no <cwchar>: // # if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_SWPRINTF) # define BOOST_NO_SWPRINTF # endif // // If Win32 support is turned off, then we must turn off // threading support also, unless there is some other // thread API enabled: // #if defined(BOOST_DISABLE_WIN32) && defined(_WIN32) \ && !defined(BOOST_DISABLE_THREADS) && !defined(BOOST_HAS_PTHREADS) # define BOOST_DISABLE_THREADS #endif // // Turn on threading support if the compiler thinks that it's in // multithreaded mode. We put this here because there are only a // limited number of macros that identify this (if there's any missing // from here then add to the appropriate compiler section): // #if (defined(__MT__) || defined(_MT) || defined(_REENTRANT) \ || defined(_PTHREADS) || defined(__APPLE__) || defined(__DragonFly__)) \ && !defined(BOOST_HAS_THREADS) # define BOOST_HAS_THREADS #endif // // Turn threading support off if BOOST_DISABLE_THREADS is defined: // #if defined(BOOST_DISABLE_THREADS) && defined(BOOST_HAS_THREADS) # undef BOOST_HAS_THREADS #endif // // Turn threading support off if we don't recognise the threading API: // #if defined(BOOST_HAS_THREADS) && !defined(BOOST_HAS_PTHREADS)\ && !defined(BOOST_HAS_WINTHREADS) && !defined(BOOST_HAS_BETHREADS)\ && !defined(BOOST_HAS_MPTASKS) # undef BOOST_HAS_THREADS #endif // // Turn threading detail macros off if we don't (want to) use threading // #ifndef BOOST_HAS_THREADS # undef BOOST_HAS_PTHREADS # undef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE # undef BOOST_HAS_PTHREAD_YIELD # undef BOOST_HAS_PTHREAD_DELAY_NP # undef BOOST_HAS_WINTHREADS # undef BOOST_HAS_BETHREADS # undef BOOST_HAS_MPTASKS #endif // // If the compiler claims to be C99 conformant, then it had better // have a <stdint.h>: // # if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) # define BOOST_HAS_STDINT_H # ifndef BOOST_HAS_LOG1P # define BOOST_HAS_LOG1P # endif # ifndef BOOST_HAS_EXPM1 # define BOOST_HAS_EXPM1 # endif # endif // // Define BOOST_NO_SLIST and BOOST_NO_HASH if required. // Note that this is for backwards compatibility only. // # if !defined(BOOST_HAS_SLIST) && !defined(BOOST_NO_SLIST) # define BOOST_NO_SLIST # endif # if !defined(BOOST_HAS_HASH) && !defined(BOOST_NO_HASH) # define BOOST_NO_HASH # endif // // Set BOOST_SLIST_HEADER if not set already: // #if defined(BOOST_HAS_SLIST) && !defined(BOOST_SLIST_HEADER) # define BOOST_SLIST_HEADER <slist> #endif // // Set BOOST_HASH_SET_HEADER if not set already: // #if defined(BOOST_HAS_HASH) && !defined(BOOST_HASH_SET_HEADER) # define BOOST_HASH_SET_HEADER <hash_set> #endif // // Set BOOST_HASH_MAP_HEADER if not set already: // #if defined(BOOST_HAS_HASH) && !defined(BOOST_HASH_MAP_HEADER) # define BOOST_HASH_MAP_HEADER <hash_map> #endif // BOOST_HAS_ABI_HEADERS // This macro gets set if we have headers that fix the ABI, // and prevent ODR violations when linking to external libraries: #if defined(BOOST_ABI_PREFIX) && defined(BOOST_ABI_SUFFIX) && !defined(BOOST_HAS_ABI_HEADERS) # define BOOST_HAS_ABI_HEADERS #endif #if defined(BOOST_HAS_ABI_HEADERS) && defined(BOOST_DISABLE_ABI_HEADERS) # undef BOOST_HAS_ABI_HEADERS #endif // BOOST_NO_STDC_NAMESPACE workaround --------------------------------------// // Because std::size_t usage is so common, even in boost headers which do not // otherwise use the C library, the <cstddef> workaround is included here so // that ugly workaround code need not appear in many other boost headers. // NOTE WELL: This is a workaround for non-conforming compilers; <cstddef> // must still be #included in the usual places so that <cstddef> inclusion // works as expected with standard conforming compilers. The resulting // double inclusion of <cstddef> is harmless. # ifdef BOOST_NO_STDC_NAMESPACE # include <cstddef> namespace std { using ::ptrdiff_t; using ::size_t; } # endif // Workaround for the unfortunate min/max macros defined by some platform headers #define BOOST_PREVENT_MACRO_SUBSTITUTION #ifndef BOOST_USING_STD_MIN # define BOOST_USING_STD_MIN() using std::min #endif #ifndef BOOST_USING_STD_MAX # define BOOST_USING_STD_MAX() using std::max #endif // BOOST_NO_STD_MIN_MAX workaround -----------------------------------------// # ifdef BOOST_NO_STD_MIN_MAX namespace std { template <class _Tp> inline const _Tp& min BOOST_PREVENT_MACRO_SUBSTITUTION (const _Tp& __a, const _Tp& __b) { return __b < __a ? __b : __a; } template <class _Tp> inline const _Tp& max BOOST_PREVENT_MACRO_SUBSTITUTION (const _Tp& __a, const _Tp& __b) { return __a < __b ? __b : __a; } } # endif // BOOST_STATIC_CONSTANT workaround --------------------------------------- // // On compilers which don't allow in-class initialization of static integral // constant members, we must use enums as a workaround if we want the constants // to be available at compile-time. This macro gives us a convenient way to // declare such constants. # ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION # define BOOST_STATIC_CONSTANT(type, assignment) enum { assignment } # else # define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment # endif // BOOST_USE_FACET / HAS_FACET workaround ----------------------------------// // When the standard library does not have a conforming std::use_facet there // are various workarounds available, but they differ from library to library. // The same problem occurs with has_facet. // These macros provide a consistent way to access a locale's facets. // Usage: // replace // std::use_facet<Type>(loc); // with // BOOST_USE_FACET(Type, loc); // Note do not add a std:: prefix to the front of BOOST_USE_FACET! // Use for BOOST_HAS_FACET is analogous. #if defined(BOOST_NO_STD_USE_FACET) # ifdef BOOST_HAS_TWO_ARG_USE_FACET # define BOOST_USE_FACET(Type, loc) std::use_facet(loc, static_cast<Type*>(0)) # define BOOST_HAS_FACET(Type, loc) std::has_facet(loc, static_cast<Type*>(0)) # elif defined(BOOST_HAS_MACRO_USE_FACET) # define BOOST_USE_FACET(Type, loc) std::_USE(loc, Type) # define BOOST_HAS_FACET(Type, loc) std::_HAS(loc, Type) # elif defined(BOOST_HAS_STLP_USE_FACET) # define BOOST_USE_FACET(Type, loc) (*std::_Use_facet<Type >(loc)) # define BOOST_HAS_FACET(Type, loc) std::has_facet< Type >(loc) # endif #else # define BOOST_USE_FACET(Type, loc) std::use_facet< Type >(loc) # define BOOST_HAS_FACET(Type, loc) std::has_facet< Type >(loc) #endif // BOOST_NESTED_TEMPLATE workaround ------------------------------------------// // Member templates are supported by some compilers even though they can't use // the A::template member<U> syntax, as a workaround replace: // // typedef typename A::template rebind<U> binder; // // with: // // typedef typename A::BOOST_NESTED_TEMPLATE rebind<U> binder; #ifndef BOOST_NO_MEMBER_TEMPLATE_KEYWORD # define BOOST_NESTED_TEMPLATE template #else # define BOOST_NESTED_TEMPLATE #endif // BOOST_UNREACHABLE_RETURN(x) workaround -------------------------------------// // Normally evaluates to nothing, unless BOOST_NO_UNREACHABLE_RETURN_DETECTION // is defined, in which case it evaluates to return x; Use when you have a return // statement that can never be reached. #ifdef BOOST_NO_UNREACHABLE_RETURN_DETECTION # define BOOST_UNREACHABLE_RETURN(x) return x; #else # define BOOST_UNREACHABLE_RETURN(x) #endif // BOOST_DEDUCED_TYPENAME workaround ------------------------------------------// // // Some compilers don't support the use of `typename' for dependent // types in deduced contexts, e.g. // // template <class T> void f(T, typename T::type); // ^^^^^^^^ // Replace these declarations with: // // template <class T> void f(T, BOOST_DEDUCED_TYPENAME T::type); #ifndef BOOST_NO_DEDUCED_TYPENAME # define BOOST_DEDUCED_TYPENAME typename #else # define BOOST_DEDUCED_TYPENAME #endif #ifndef BOOST_NO_TYPENAME_WITH_CTOR # define BOOST_CTOR_TYPENAME typename #else # define BOOST_CTOR_TYPENAME #endif // long long workaround ------------------------------------------// // On gcc (and maybe other compilers?) long long is alway supported // but it's use may generate either warnings (with -ansi), or errors // (with -pedantic -ansi) unless it's use is prefixed by __extension__ // #if defined(BOOST_HAS_LONG_LONG) namespace boost{ # ifdef __GNUC__ __extension__ typedef long long long_long_type; __extension__ typedef unsigned long long ulong_long_type; # else typedef long long long_long_type; typedef unsigned long long ulong_long_type; # endif } #endif // BOOST_[APPEND_]EXPLICIT_TEMPLATE_[NON_]TYPE macros --------------------------// // // Some compilers have problems with function templates whose template // parameters don't appear in the function parameter list (basically // they just link one instantiation of the template in the final // executable). These macros provide a uniform way to cope with the // problem with no effects on the calling syntax. // Example: // // #include <iostream> // #include <ostream> // #include <typeinfo> // // template <int n> // void f() { std::cout << n << ' '; } // // template <typename T> // void g() { std::cout << typeid(T).name() << ' '; } // // int main() { // f<1>(); // f<2>(); // // g<int>(); // g<double>(); // } // // With VC++ 6.0 the output is: // // 2 2 double double // // To fix it, write // // template <int n> // void f(BOOST_EXPLICIT_TEMPLATE_NON_TYPE(int, n)) { ... } // // template <typename T> // void g(BOOST_EXPLICIT_TEMPLATE_TYPE(T)) { ... } // #if defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS # include "boost/type.hpp" # include "boost/non_type.hpp" # define BOOST_EXPLICIT_TEMPLATE_TYPE(t) boost::type<t>* = 0 # define BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) boost::type<t>* # define BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) boost::non_type<t, v>* = 0 # define BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) boost::non_type<t, v>* # define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t) \ , BOOST_EXPLICIT_TEMPLATE_TYPE(t) # define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) \ , BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) # define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) \ , BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) # define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) \ , BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) #else // no workaround needed: expand to nothing # define BOOST_EXPLICIT_TEMPLATE_TYPE(t) # define BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) # define BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) # define BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) # define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t) # define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) # define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) # define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) #endif // defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS // ---------------------------------------------------------------------------// // // Helper macro BOOST_STRINGIZE: // Converts the parameter X to a string after macro replacement // on X has been performed. // #define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X) #define BOOST_DO_STRINGIZE(X) #X // // Helper macro BOOST_JOIN: // The following piece of macro magic joins the two // arguments together, even when one of the arguments is // itself a macro (see 16.3.1 in C++ standard). The key // is that macro expansion of macro arguments does not // occur in BOOST_DO_JOIN2 but does in BOOST_DO_JOIN. // #define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y ) #define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y) #define BOOST_DO_JOIN2( X, Y ) X##Y // // Set some default values for compiler/library/platform names. // These are for debugging config setup only: // # ifndef BOOST_COMPILER # define BOOST_COMPILER "Unknown ISO C++ Compiler" # endif # ifndef BOOST_STDLIB # define BOOST_STDLIB "Unknown ISO standard library" # endif # ifndef BOOST_PLATFORM # if defined(unix) || defined(__unix) || defined(_XOPEN_SOURCE) \ || defined(_POSIX_SOURCE) # define BOOST_PLATFORM "Generic Unix" # else # define BOOST_PLATFORM "Unknown" # endif # endif #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/stdlib/���������������������������������������0000755�0001750�0001750�00000000000�12320456500�023406� 5����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/stdlib/vacpp.hpp������������������������������0000644�0001750�0001750�00000001003�12320456500�025222� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2002. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. #if __IBMCPP__ <= 501 # define BOOST_NO_STD_ALLOCATOR #endif #define BOOST_HAS_MACRO_USE_FACET #define BOOST_NO_STD_MESSAGES #define BOOST_NO_STD_UNORDERED #define BOOST_STDLIB "Visual Age default standard library" �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/stdlib/libstdcpp3.hpp�������������������������0000644�0001750�0001750�00000005465�12320456500�026200� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001. // (C) Copyright Jens Maurer 2001. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // config for libstdc++ v3 // not much to go in here: #ifdef __GLIBCXX__ #define BOOST_STDLIB "GNU libstdc++ version " BOOST_STRINGIZE(__GLIBCXX__) #else #define BOOST_STDLIB "GNU libstdc++ version " BOOST_STRINGIZE(__GLIBCPP__) #endif #if !defined(_GLIBCPP_USE_WCHAR_T) && !defined(_GLIBCXX_USE_WCHAR_T) # define BOOST_NO_CWCHAR # define BOOST_NO_CWCTYPE # define BOOST_NO_STD_WSTRING # define BOOST_NO_STD_WSTREAMBUF #endif #if defined(__osf__) && !defined(_REENTRANT) \ && ( defined(_GLIBCXX_HAVE_GTHR_DEFAULT) || defined(_GLIBCPP_HAVE_GTHR_DEFAULT) ) // GCC 3 on Tru64 forces the definition of _REENTRANT when any std lib header // file is included, therefore for consistency we define it here as well. # define _REENTRANT #endif #ifdef __GLIBCXX__ // gcc 3.4 and greater: # if defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \ || defined(_GLIBCXX__PTHREADS) // // If the std lib has thread support turned on, then turn it on in Boost // as well. We do this because some gcc-3.4 std lib headers define _REENTANT // while others do not... // # define BOOST_HAS_THREADS # else # define BOOST_DISABLE_THREADS # endif #elif defined(__GLIBCPP__) \ && !defined(_GLIBCPP_HAVE_GTHR_DEFAULT) \ && !defined(_GLIBCPP__PTHREADS) // disable thread support if the std lib was built single threaded: # define BOOST_DISABLE_THREADS #endif #if (defined(linux) || defined(__linux) || defined(__linux__)) && defined(__arm__) && defined(_GLIBCPP_HAVE_GTHR_DEFAULT) // linux on arm apparently doesn't define _REENTRANT // so just turn on threading support whenever the std lib is thread safe: # define BOOST_HAS_THREADS #endif #if !defined(_GLIBCPP_USE_LONG_LONG) \ && !defined(_GLIBCXX_USE_LONG_LONG)\ && defined(BOOST_HAS_LONG_LONG) // May have been set by compiler/*.hpp, but "long long" without library // support is useless. # undef BOOST_HAS_LONG_LONG #endif #if defined(__GLIBCXX__) || (defined(__GLIBCPP__) && __GLIBCPP__>=20020514) // GCC >= 3.1.0 # define BOOST_STD_EXTENSION_NAMESPACE __gnu_cxx # define BOOST_HAS_SLIST # define BOOST_HAS_HASH # define BOOST_SLIST_HEADER <ext/slist> # if !defined(__GNUC__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) # define BOOST_HASH_SET_HEADER <ext/hash_set> # define BOOST_HASH_MAP_HEADER <ext/hash_map> # else # define BOOST_HASH_SET_HEADER <backward/hash_set> # define BOOST_HASH_MAP_HEADER <backward/hash_map> # endif #endif #ifndef __GXX_EXPERIMENTAL_CXX0X__ # define BOOST_NO_STD_UNORDERED #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/stdlib/dinkumware.hpp�������������������������0000644�0001750�0001750�00000007152�12320456500�026272� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Jens Maurer 2001. // (C) Copyright Peter Dimov 2001. // (C) Copyright David Abrahams 2002. // (C) Copyright Guillaume Melquiond 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Dinkumware standard library config: #if !defined(_YVALS) && !defined(_CPPLIB_VER) #include <boost/config/no_tr1/utility.hpp> #if !defined(_YVALS) && !defined(_CPPLIB_VER) #error This is not the Dinkumware lib! #endif #endif #if defined(_CPPLIB_VER) && (_CPPLIB_VER >= 306) // full dinkumware 3.06 and above // fully conforming provided the compiler supports it: # if !(defined(_GLOBAL_USING) && (_GLOBAL_USING+0 > 0)) && !defined(__BORLANDC__) && !defined(_STD) && !(defined(__ICC) && (__ICC >= 700)) // can be defined in yvals.h # define BOOST_NO_STDC_NAMESPACE # endif # if !(defined(_HAS_MEMBER_TEMPLATES_REBIND) && (_HAS_MEMBER_TEMPLATES_REBIND+0 > 0)) && !(defined(_MSC_VER) && (_MSC_VER > 1300)) && defined(BOOST_MSVC) # define BOOST_NO_STD_ALLOCATOR # endif # define BOOST_HAS_PARTIAL_STD_ALLOCATOR # if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) // if this lib version is set up for vc6 then there is no std::use_facet: # define BOOST_NO_STD_USE_FACET # define BOOST_HAS_TWO_ARG_USE_FACET // C lib functions aren't in namespace std either: # define BOOST_NO_STDC_NAMESPACE // and nor is <exception> # define BOOST_NO_EXCEPTION_STD_NAMESPACE # endif // There's no numeric_limits<long long> support unless _LONGLONG is defined: # if !defined(_LONGLONG) && (_CPPLIB_VER <= 310) # define BOOST_NO_MS_INT64_NUMERIC_LIMITS # endif // 3.06 appears to have (non-sgi versions of) <hash_set> & <hash_map>, // and no <slist> at all #else # define BOOST_MSVC_STD_ITERATOR 1 # define BOOST_NO_STD_ITERATOR # define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS # define BOOST_NO_STD_ALLOCATOR # define BOOST_NO_STDC_NAMESPACE # define BOOST_NO_STD_USE_FACET # define BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN # define BOOST_HAS_MACRO_USE_FACET # ifndef _CPPLIB_VER // Updated Dinkum library defines this, and provides // its own min and max definitions. # define BOOST_NO_STD_MIN_MAX # define BOOST_NO_MS_INT64_NUMERIC_LIMITS # endif #endif // // std extension namespace is stdext for vc7.1 and later, // the same applies to other compilers that sit on top // of vc7.1 (Intel and Comeau): // #if defined(_MSC_VER) && (_MSC_VER >= 1310) && !defined(__BORLANDC__) # define BOOST_STD_EXTENSION_NAMESPACE stdext #endif #if (defined(_MSC_VER) && (_MSC_VER <= 1300) && !defined(__BORLANDC__)) || !defined(_CPPLIB_VER) || (_CPPLIB_VER < 306) // if we're using a dinkum lib that's // been configured for VC6/7 then there is // no iterator traits (true even for icl) # define BOOST_NO_STD_ITERATOR_TRAITS #endif // // No std::unordered_* containers yet: // #define BOOST_NO_STD_UNORDERED #if defined(__ICL) && (__ICL < 800) && defined(_CPPLIB_VER) && (_CPPLIB_VER <= 310) // Intel C++ chokes over any non-trivial use of <locale> // this may be an overly restrictive define, but regex fails without it: # define BOOST_NO_STD_LOCALE #endif #ifdef _CPPLIB_VER # define BOOST_DINKUMWARE_STDLIB _CPPLIB_VER #else # define BOOST_DINKUMWARE_STDLIB 1 #endif #ifdef _CPPLIB_VER # define BOOST_STDLIB "Dinkumware standard library version " BOOST_STRINGIZE(_CPPLIB_VER) #else # define BOOST_STDLIB "Dinkumware standard library version 1.x" #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/stdlib/stlport.hpp����������������������������0000644�0001750�0001750�00000014736�12320456500�025641� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2002. // (C) Copyright Darin Adler 2001. // (C) Copyright Jens Maurer 2001. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // STLPort standard library config: #if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) # include <cstddef> # if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) # error "This is not STLPort!" # endif #endif // // __STL_STATIC_CONST_INIT_BUG implies BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS // for versions prior to 4.1(beta) // #if (defined(__STL_STATIC_CONST_INIT_BUG) || defined(_STLP_STATIC_CONST_INIT_BUG)) && (__SGI_STL_PORT <= 0x400) # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS #endif // // If STLport thinks that there is no partial specialisation, then there is no // std::iterator traits: // #if !(defined(_STLP_CLASS_PARTIAL_SPECIALIZATION) || defined(__STL_CLASS_PARTIAL_SPECIALIZATION)) # define BOOST_NO_STD_ITERATOR_TRAITS #endif // // No new style iostreams on GCC without STLport's iostreams enabled: // #if (defined(__GNUC__) && (__GNUC__ < 3)) && !(defined(__SGI_STL_OWN_IOSTREAMS) || defined(_STLP_OWN_IOSTREAMS)) # define BOOST_NO_STRINGSTREAM #endif // // No new iostreams implies no std::locale, and no std::stringstream: // #if defined(__STL_NO_IOSTREAMS) || defined(__STL_NO_NEW_IOSTREAMS) || defined(_STLP_NO_IOSTREAMS) || defined(_STLP_NO_NEW_IOSTREAMS) # define BOOST_NO_STD_LOCALE # define BOOST_NO_STRINGSTREAM #endif // // If the streams are not native, and we have a "using ::x" compiler bug // then the io stream facets are not available in namespace std:: // #ifdef _STLPORT_VERSION # if !(_STLPORT_VERSION >= 0x500) && !defined(_STLP_OWN_IOSTREAMS) && defined(_STLP_USE_NAMESPACES) && defined(BOOST_NO_USING_TEMPLATE) && !defined(__BORLANDC__) # define BOOST_NO_STD_LOCALE # endif #else # if !defined(__SGI_STL_OWN_IOSTREAMS) && defined(__STL_USE_NAMESPACES) && defined(BOOST_NO_USING_TEMPLATE) && !defined(__BORLANDC__) # define BOOST_NO_STD_LOCALE # endif #endif #if defined(_STLPORT_VERSION) && (_STLPORT_VERSION < 0x500) # define BOOST_NO_STD_UNORDERED #endif // // Without member template support enabled, their are no template // iterate constructors, and no std::allocator: // #if !(defined(__STL_MEMBER_TEMPLATES) || defined(_STLP_MEMBER_TEMPLATES)) # define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS # define BOOST_NO_STD_ALLOCATOR #endif // // however we always have at least a partial allocator: // #define BOOST_HAS_PARTIAL_STD_ALLOCATOR #if !defined(_STLP_MEMBER_TEMPLATE_CLASSES) || defined(_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) # define BOOST_NO_STD_ALLOCATOR #endif #if defined(_STLP_NO_MEMBER_TEMPLATE_KEYWORD) && defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) # define BOOST_NO_STD_ALLOCATOR #endif // // If STLport thinks there is no wchar_t at all, then we have to disable // the support for the relevant specilazations of std:: templates. // #if !defined(_STLP_HAS_WCHAR_T) && !defined(_STLP_WCHAR_T_IS_USHORT) # ifndef BOOST_NO_STD_WSTRING # define BOOST_NO_STD_WSTRING # endif # ifndef BOOST_NO_STD_WSTREAMBUF # define BOOST_NO_STD_WSTREAMBUF # endif #endif // // We always have SGI style hash_set, hash_map, and slist: // #ifndef _STLP_NO_EXTENSIONS #define BOOST_HAS_HASH #define BOOST_HAS_SLIST #endif // // STLport does a good job of importing names into namespace std::, // but doesn't always get them all, define BOOST_NO_STDC_NAMESPACE, since our // workaround does not conflict with STLports: // // // Harold Howe says: // Borland switched to STLport in BCB6. Defining BOOST_NO_STDC_NAMESPACE with // BCB6 does cause problems. If we detect C++ Builder, then don't define // BOOST_NO_STDC_NAMESPACE // #if !defined(__BORLANDC__) && !defined(__DMC__) // // If STLport is using it's own namespace, and the real names are in // the global namespace, then we duplicate STLport's using declarations // (by defining BOOST_NO_STDC_NAMESPACE), we do this because STLport doesn't // necessarily import all the names we need into namespace std:: // # if (defined(__STL_IMPORT_VENDOR_CSTD) \ || defined(__STL_USE_OWN_NAMESPACE) \ || defined(_STLP_IMPORT_VENDOR_CSTD) \ || defined(_STLP_USE_OWN_NAMESPACE)) \ && (defined(__STL_VENDOR_GLOBAL_CSTD) || defined (_STLP_VENDOR_GLOBAL_CSTD)) # define BOOST_NO_STDC_NAMESPACE # define BOOST_NO_EXCEPTION_STD_NAMESPACE # endif #elif defined(__BORLANDC__) && __BORLANDC__ < 0x560 // STLport doesn't import std::abs correctly: #include <stdlib.h> namespace std { using ::abs; } // and strcmp/strcpy don't get imported either ('cos they are macros) #include <string.h> #ifdef strcpy # undef strcpy #endif #ifdef strcmp # undef strcmp #endif #ifdef _STLP_VENDOR_CSTD namespace std{ using _STLP_VENDOR_CSTD::strcmp; using _STLP_VENDOR_CSTD::strcpy; } #endif #endif // // std::use_facet may be non-standard, uses a class instead: // #if defined(__STL_NO_EXPLICIT_FUNCTION_TMPL_ARGS) || defined(_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS) # define BOOST_NO_STD_USE_FACET # define BOOST_HAS_STLP_USE_FACET #endif // // If STLport thinks there are no wide functions, <cwchar> etc. is not working; but // only if BOOST_NO_STDC_NAMESPACE is not defined (if it is then we do the import // into std:: ourselves). // #if defined(_STLP_NO_NATIVE_WIDE_FUNCTIONS) && !defined(BOOST_NO_STDC_NAMESPACE) # define BOOST_NO_CWCHAR # define BOOST_NO_CWCTYPE #endif // // If STLport for some reason was configured so that it thinks that wchar_t // is not an intrinsic type, then we have to disable the support for it as // well (we would be missing required specializations otherwise). // #if !defined( _STLP_HAS_WCHAR_T) || defined(_STLP_WCHAR_T_IS_USHORT) # undef BOOST_NO_INTRINSIC_WCHAR_T # define BOOST_NO_INTRINSIC_WCHAR_T #endif // // Borland ships a version of STLport with C++ Builder 6 that lacks // hashtables and the like: // #if defined(__BORLANDC__) && (__BORLANDC__ == 0x560) # undef BOOST_HAS_HASH #endif // // gcc-2.95.3/STLPort does not like the using declarations we use to get ADL with std::min/max // #if defined(__GNUC__) && (__GNUC__ < 3) # include <algorithm> // for std::min and std::max # define BOOST_USING_STD_MIN() ((void)0) # define BOOST_USING_STD_MAX() ((void)0) namespace boost { using std::min; using std::max; } #endif #define BOOST_STDLIB "STLPort standard library version " BOOST_STRINGIZE(__SGI_STL_PORT) ����������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/stdlib/libcomo.hpp����������������������������0000644�0001750�0001750�00000002543�12320456500�025547� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2002 - 2003. // (C) Copyright Jens Maurer 2002 - 2003. // (C) Copyright Beman Dawes 2002 - 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Comeau STL: #if !defined(__LIBCOMO__) # include <boost/config/no_tr1/utility.hpp> # if !defined(__LIBCOMO__) # error "This is not the Comeau STL!" # endif #endif // // std::streambuf<wchar_t> is non-standard // NOTE: versions of libcomo prior to beta28 have octal version numbering, // e.g. version 25 is 21 (dec) #if __LIBCOMO_VERSION__ <= 22 # define BOOST_NO_STD_WSTREAMBUF #endif #if (__LIBCOMO_VERSION__ <= 31) && defined(_WIN32) #define BOOST_NO_SWPRINTF #endif #if __LIBCOMO_VERSION__ >= 31 # define BOOST_HAS_HASH # define BOOST_HAS_SLIST #endif // // We never have the new C++0x unordered containers: // #define BOOST_NO_STD_UNORDERED // // Intrinsic type_traits support. // The SGI STL has it's own __type_traits class, which // has intrinsic compiler support with SGI's compilers. // Whatever map SGI style type traits to boost equivalents: // #define BOOST_HAS_SGI_TYPE_TRAITS #define BOOST_STDLIB "Comeau standard library " BOOST_STRINGIZE(__LIBCOMO_VERSION__) �������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/stdlib/roguewave.hpp��������������������������0000644�0001750�0001750�00000011140�12320456500�026120� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Jens Maurer 2001. // (C) Copyright David Abrahams 2003. // (C) Copyright Boris Gubenko 2007. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Rogue Wave std lib: #if !defined(__STD_RWCOMPILER_H__) && !defined(_RWSTD_VER) # include <boost/config/no_tr1/utility.hpp> # if !defined(__STD_RWCOMPILER_H__) && !defined(_RWSTD_VER) # error This is not the Rogue Wave standard library # endif #endif // // figure out a consistent version number: // #ifndef _RWSTD_VER # define BOOST_RWSTD_VER 0x010000 #elif _RWSTD_VER < 0x010000 # define BOOST_RWSTD_VER (_RWSTD_VER << 8) #else # define BOOST_RWSTD_VER _RWSTD_VER #endif #ifndef _RWSTD_VER # define BOOST_STDLIB "Rogue Wave standard library version (Unknown version)" #elif _RWSTD_VER < 0x04010200 # define BOOST_STDLIB "Rogue Wave standard library version " BOOST_STRINGIZE(_RWSTD_VER) #else # ifdef _RWSTD_VER_STR # define BOOST_STDLIB "Apache STDCXX standard library version " _RWSTD_VER_STR # else # define BOOST_STDLIB "Apache STDCXX standard library version " BOOST_STRINGIZE(_RWSTD_VER) # endif #endif // // Prior to version 2.2.0 the primary template for std::numeric_limits // does not have compile time constants, even though specializations of that // template do: // #if BOOST_RWSTD_VER < 0x020200 # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS #endif // Sun CC 5.5 patch 113817-07 adds long long specialization, but does not change the // library version number (http://sunsolve6.sun.com/search/document.do?assetkey=1-21-113817): #if BOOST_RWSTD_VER <= 0x020101 && (!defined(__SUNPRO_CC) || (__SUNPRO_CC < 0x550)) # define BOOST_NO_LONG_LONG_NUMERIC_LIMITS # endif // // Borland version of numeric_limits lacks __int64 specialisation: // #ifdef __BORLANDC__ # define BOOST_NO_MS_INT64_NUMERIC_LIMITS #endif // // No std::iterator if it can't figure out default template args: // #if defined(_RWSTD_NO_SIMPLE_DEFAULT_TEMPLATES) || defined(RWSTD_NO_SIMPLE_DEFAULT_TEMPLATES) || (BOOST_RWSTD_VER < 0x020000) # define BOOST_NO_STD_ITERATOR #endif // // No iterator traits without partial specialization: // #if defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) || defined(RWSTD_NO_CLASS_PARTIAL_SPEC) # define BOOST_NO_STD_ITERATOR_TRAITS #endif // // Prior to version 2.0, std::auto_ptr was buggy, and there were no // new-style iostreams, and no conformant std::allocator: // #if (BOOST_RWSTD_VER < 0x020000) # define BOOST_NO_AUTO_PTR # define BOOST_NO_STRINGSTREAM # define BOOST_NO_STD_ALLOCATOR # define BOOST_NO_STD_LOCALE #endif // // No template iterator constructors without member template support: // #if defined(RWSTD_NO_MEMBER_TEMPLATES) || defined(_RWSTD_NO_MEMBER_TEMPLATES) # define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS #endif // // RW defines _RWSTD_ALLOCATOR if the allocator is conformant and in use // (the or _HPACC_ part is a hack - the library seems to define _RWSTD_ALLOCATOR // on HP aCC systems even though the allocator is in fact broken): // #if !defined(_RWSTD_ALLOCATOR) || (defined(__HP_aCC) && __HP_aCC <= 33100) # define BOOST_NO_STD_ALLOCATOR #endif // // If we have a std::locale, we still may not have std::use_facet: // #if defined(_RWSTD_NO_TEMPLATE_ON_RETURN_TYPE) && !defined(BOOST_NO_STD_LOCALE) # define BOOST_NO_STD_USE_FACET # define BOOST_HAS_TWO_ARG_USE_FACET #endif // // There's no std::distance prior to version 2, or without // partial specialization support: // #if (BOOST_RWSTD_VER < 0x020000) || defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) #define BOOST_NO_STD_DISTANCE #endif // // Some versions of the rogue wave library don't have assignable // OutputIterators: // #if BOOST_RWSTD_VER < 0x020100 # define BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN #endif // // Disable BOOST_HAS_LONG_LONG when the library has no support for it. // #if !defined(_RWSTD_LONG_LONG) && defined(BOOST_HAS_LONG_LONG) # undef BOOST_HAS_LONG_LONG #endif // // check that on HP-UX, the proper RW library is used // #if defined(__HP_aCC) && !defined(_HP_NAMESPACE_STD) # error "Boost requires Standard RW library. Please compile and link with -AA" #endif // // Define macros specific to RW V2.2 on HP-UX // #if defined(__HP_aCC) && (BOOST_RWSTD_VER == 0x02020100) # ifndef __HP_TC1_MAKE_PAIR # define __HP_TC1_MAKE_PAIR # endif # ifndef _HP_INSTANTIATE_STD2_VL # define _HP_INSTANTIATE_STD2_VL # endif #endif // // We never have the new C++0x unordered containers: // #define BOOST_NO_STD_UNORDERED ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/stdlib/msl.hpp��������������������������������0000644�0001750�0001750�00000002552�12320456500�024716� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001. // (C) Copyright Darin Adler 2001. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Metrowerks standard library: #ifndef __MSL_CPP__ # include <boost/config/no_tr1/utility.hpp> # ifndef __MSL_CPP__ # error This is not the MSL standard library! # endif #endif #if __MSL_CPP__ >= 0x6000 // Pro 6 # define BOOST_HAS_HASH # define BOOST_STD_EXTENSION_NAMESPACE Metrowerks #endif #define BOOST_HAS_SLIST #if __MSL_CPP__ < 0x6209 # define BOOST_NO_STD_MESSAGES #endif // check C lib version for <stdint.h> #include <cstddef> #if defined(__MSL__) && (__MSL__ >= 0x5000) # define BOOST_HAS_STDINT_H # if !defined(__PALMOS_TRAPS__) # define BOOST_HAS_UNISTD_H # endif // boilerplate code: # include <boost/config/posix_features.hpp> #endif #if defined(_MWMT) || _MSL_THREADSAFE # define BOOST_HAS_THREADS #endif #ifdef _MSL_NO_EXPLICIT_FUNC_TEMPLATE_ARG # define BOOST_NO_STD_USE_FACET # define BOOST_HAS_TWO_ARG_USE_FACET #endif // // We never have the new C++0x unordered containers: // #define BOOST_NO_STD_UNORDERED #define BOOST_STDLIB "Metrowerks Standard Library version " BOOST_STRINGIZE(__MSL_CPP__) ������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/stdlib/sgi.hpp��������������������������������0000644�0001750�0001750�00000006155�12320456500�024710� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Darin Adler 2001. // (C) Copyright Jens Maurer 2001 - 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // generic SGI STL: #if !defined(__STL_CONFIG_H) # include <boost/config/no_tr1/utility.hpp> # if !defined(__STL_CONFIG_H) # error "This is not the SGI STL!" # endif #endif // // No std::iterator traits without partial specialisation: // #if !defined(__STL_CLASS_PARTIAL_SPECIALIZATION) # define BOOST_NO_STD_ITERATOR_TRAITS #endif // // No std::stringstream with gcc < 3 // #if defined(__GNUC__) && (__GNUC__ < 3) && \ ((__GNUC_MINOR__ < 95) || (__GNUC_MINOR__ == 96)) && \ !defined(__STL_USE_NEW_IOSTREAMS) || \ defined(__APPLE_CC__) // Note that we only set this for GNU C++ prior to 2.95 since the // latest patches for that release do contain a minimal <sstream> // If you are running a 2.95 release prior to 2.95.3 then this will need // setting, but there is no way to detect that automatically (other // than by running the configure script). // Also, the unofficial GNU C++ 2.96 included in RedHat 7.1 doesn't // have <sstream>. # define BOOST_NO_STRINGSTREAM #endif // // Assume no std::locale without own iostreams (this may be an // incorrect assumption in some cases): // #if !defined(__SGI_STL_OWN_IOSTREAMS) && !defined(__STL_USE_NEW_IOSTREAMS) # define BOOST_NO_STD_LOCALE #endif // // Original native SGI streams have non-standard std::messages facet: // #if defined(__sgi) && (_COMPILER_VERSION <= 650) && !defined(__SGI_STL_OWN_IOSTREAMS) # define BOOST_NO_STD_LOCALE #endif // // SGI's new iostreams have missing "const" in messages<>::open // #if defined(__sgi) && (_COMPILER_VERSION <= 740) && defined(__STL_USE_NEW_IOSTREAMS) # define BOOST_NO_STD_MESSAGES #endif // // No template iterator constructors, or std::allocator // without member templates: // #if !defined(__STL_MEMBER_TEMPLATES) # define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS # define BOOST_NO_STD_ALLOCATOR #endif // // We always have SGI style hash_set, hash_map, and slist: // #define BOOST_HAS_HASH #define BOOST_HAS_SLIST #define BOOST_NO_STD_UNORDERED // // If this is GNU libstdc++2, then no <limits> and no std::wstring: // #if (defined(__GNUC__) && (__GNUC__ < 3)) # include <string> # if defined(__BASTRING__) # define BOOST_NO_LIMITS // Note: <boost/limits.hpp> will provide compile-time constants # undef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS # define BOOST_NO_STD_WSTRING # endif #endif // // There is no standard iterator unless we have namespace support: // #if !defined(__STL_USE_NAMESPACES) # define BOOST_NO_STD_ITERATOR #endif // // Intrinsic type_traits support. // The SGI STL has it's own __type_traits class, which // has intrinsic compiler support with SGI's compilers. // Whatever map SGI style type traits to boost equivalents: // #define BOOST_HAS_SGI_TYPE_TRAITS #define BOOST_STDLIB "SGI standard library" �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/stdlib/modena.hpp�����������������������������0000644�0001750�0001750�00000001416�12320456500�025364� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright Jens Maurer 2001. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Modena C++ standard library (comes with KAI C++) #if !defined(MSIPL_COMPILE_H) # include <boost/config/no_tr1/utility.hpp> # if !defined(__MSIPL_COMPILE_H) # error "This is not the Modena C++ library!" # endif #endif #ifndef MSIPL_NL_TYPES #define BOOST_NO_STD_MESSAGES #endif #ifndef MSIPL_WCHART #define BOOST_NO_STD_WSTRING #endif // // We never have the new C++0x unordered containers: // #define BOOST_NO_STD_UNORDERED #define BOOST_STDLIB "Modena C++ standard library" ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/auto_link.hpp���������������������������������0000644�0001750�0001750�00000024201�12320456500�024622� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) /* * LOCATION: see http://www.boost.org for most recent version. * FILE auto_link.hpp * VERSION see <boost/version.hpp> * DESCRIPTION: Automatic library inclusion for Borland/Microsoft compilers. */ /************************************************************************* USAGE: ~~~~~~ Before including this header you must define one or more of define the following macros: BOOST_LIB_NAME: Required: A string containing the basename of the library, for example boost_regex. BOOST_LIB_TOOLSET: Optional: the base name of the toolset. BOOST_DYN_LINK: Optional: when set link to dll rather than static library. BOOST_LIB_DIAGNOSTIC: Optional: when set the header will print out the name of the library selected (useful for debugging). BOOST_AUTO_LINK_NOMANGLE: Specifies that we should link to BOOST_LIB_NAME.lib, rather than a mangled-name version. These macros will be undef'ed at the end of the header, further this header has no include guards - so be sure to include it only once from your library! Algorithm: ~~~~~~~~~~ Libraries for Borland and Microsoft compilers are automatically selected here, the name of the lib is selected according to the following formula: BOOST_LIB_PREFIX + BOOST_LIB_NAME + "_" + BOOST_LIB_TOOLSET + BOOST_LIB_THREAD_OPT + BOOST_LIB_RT_OPT "-" + BOOST_LIB_VERSION These are defined as: BOOST_LIB_PREFIX: "lib" for static libraries otherwise "". BOOST_LIB_NAME: The base name of the lib ( for example boost_regex). BOOST_LIB_TOOLSET: The compiler toolset name (vc6, vc7, bcb5 etc). BOOST_LIB_THREAD_OPT: "-mt" for multithread builds, otherwise nothing. BOOST_LIB_RT_OPT: A suffix that indicates the runtime library used, contains one or more of the following letters after a hiphen: s static runtime (dynamic if not present). d debug build (release if not present). g debug/diagnostic runtime (release if not present). p STLPort Build. BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. ***************************************************************************/ #ifdef __cplusplus # ifndef BOOST_CONFIG_HPP # include <boost/config.hpp> # endif #elif defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__EDG_VERSION__) // // C language compatability (no, honestly) // # define BOOST_MSVC _MSC_VER # define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X) # define BOOST_DO_STRINGIZE(X) #X #endif // // Only include what follows for known and supported compilers: // #if defined(BOOST_MSVC) \ || defined(__BORLANDC__) \ || (defined(__MWERKS__) && defined(_WIN32) && (__MWERKS__ >= 0x3000)) \ || (defined(__ICL) && defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200)) #ifndef BOOST_VERSION_HPP # include <boost/version.hpp> #endif #ifndef BOOST_LIB_NAME # error "Macro BOOST_LIB_NAME not set (internal error)" #endif // // error check: // #if defined(__MSVC_RUNTIME_CHECKS) && !defined(_DEBUG) # pragma message("Using the /RTC option without specifying a debug runtime will lead to linker errors") # pragma message("Hint: go to the code generation options and switch to one of the debugging runtimes") # error "Incompatible build options" #endif // // select toolset if not defined already: // #ifndef BOOST_LIB_TOOLSET // Note: no compilers before 1200 are supported #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) # ifdef UNDER_CE // vc6: # define BOOST_LIB_TOOLSET "evc4" # else // vc6: # define BOOST_LIB_TOOLSET "vc6" # endif #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300) // vc7: # define BOOST_LIB_TOOLSET "vc7" #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1310) // vc71: # define BOOST_LIB_TOOLSET "vc71" #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1400) // vc80: # define BOOST_LIB_TOOLSET "vc80" #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1500) // vc90: # define BOOST_LIB_TOOLSET "vc90" #elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1600) // vc10: # define BOOST_LIB_TOOLSET "vc100" #elif defined(__BORLANDC__) // CBuilder 6: # define BOOST_LIB_TOOLSET "bcb" #elif defined(__ICL) // Intel C++, no version number: # define BOOST_LIB_TOOLSET "iw" #elif defined(__MWERKS__) && (__MWERKS__ <= 0x31FF ) // Metrowerks CodeWarrior 8.x # define BOOST_LIB_TOOLSET "cw8" #elif defined(__MWERKS__) && (__MWERKS__ <= 0x32FF ) // Metrowerks CodeWarrior 9.x # define BOOST_LIB_TOOLSET "cw9" #endif #endif // BOOST_LIB_TOOLSET // // select thread opt: // #if defined(_MT) || defined(__MT__) # define BOOST_LIB_THREAD_OPT "-mt" #else # define BOOST_LIB_THREAD_OPT #endif #if defined(_MSC_VER) || defined(__MWERKS__) # ifdef _DLL # if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS)) # if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) # define BOOST_LIB_RT_OPT "-gdp" # elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-gdp" # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") # error "Build options aren't compatible with pre-built libraries" # else # define BOOST_LIB_RT_OPT "-p" # endif # elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) # if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) # define BOOST_LIB_RT_OPT "-gdpn" # elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-gdpn" # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") # error "Build options aren't compatible with pre-built libraries" # else # define BOOST_LIB_RT_OPT "-pn" # endif # else # if defined(_DEBUG) # define BOOST_LIB_RT_OPT "-gd" # else # define BOOST_LIB_RT_OPT # endif # endif # else # if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS)) # if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) # define BOOST_LIB_RT_OPT "-sgdp" # elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-sgdp" # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") # error "Build options aren't compatible with pre-built libraries" # else # define BOOST_LIB_RT_OPT "-sp" # endif # elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) # if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) # define BOOST_LIB_RT_OPT "-sgdpn" # elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-sgdpn" # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") # error "Build options aren't compatible with pre-built libraries" # else # define BOOST_LIB_RT_OPT "-spn" # endif # else # if defined(_DEBUG) # define BOOST_LIB_RT_OPT "-sgd" # else # define BOOST_LIB_RT_OPT "-s" # endif # endif # endif #elif defined(__BORLANDC__) // // figure out whether we want the debug builds or not: // #if __BORLANDC__ > 0x561 #pragma defineonoption BOOST_BORLAND_DEBUG -v #endif // // sanity check: // #if defined(__STL_DEBUG) || defined(_STLP_DEBUG) #error "Pre-built versions of the Boost libraries are not provided in STLPort-debug form" #endif # ifdef _RTLDLL # ifdef BOOST_BORLAND_DEBUG # define BOOST_LIB_RT_OPT "-d" # else # define BOOST_LIB_RT_OPT # endif # else # ifdef BOOST_BORLAND_DEBUG # define BOOST_LIB_RT_OPT "-sd" # else # define BOOST_LIB_RT_OPT "-s" # endif # endif #endif // // select linkage opt: // #if (defined(_DLL) || defined(_RTLDLL)) && defined(BOOST_DYN_LINK) # define BOOST_LIB_PREFIX #elif defined(BOOST_DYN_LINK) # error "Mixing a dll boost library with a static runtime is a really bad idea..." #else # define BOOST_LIB_PREFIX "lib" #endif // // now include the lib: // #if defined(BOOST_LIB_NAME) \ && defined(BOOST_LIB_PREFIX) \ && defined(BOOST_LIB_TOOLSET) \ && defined(BOOST_LIB_THREAD_OPT) \ && defined(BOOST_LIB_RT_OPT) \ && defined(BOOST_LIB_VERSION) #ifndef BOOST_AUTO_LINK_NOMANGLE # pragma comment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib") # ifdef BOOST_LIB_DIAGNOSTIC # pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib") # endif #else # pragma comment(lib, BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib") # ifdef BOOST_LIB_DIAGNOSTIC # pragma message ("Linking to lib file: " BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib") # endif #endif #else # error "some required macros where not defined (internal logic error)." #endif #endif // _MSC_VER || __BORLANDC__ // // finally undef any macros we may have set: // #ifdef BOOST_LIB_PREFIX # undef BOOST_LIB_PREFIX #endif #if defined(BOOST_LIB_NAME) # undef BOOST_LIB_NAME #endif // Don't undef this one: it can be set by the user and should be the // same for all libraries: //#if defined(BOOST_LIB_TOOLSET) //# undef BOOST_LIB_TOOLSET //#endif #if defined(BOOST_LIB_THREAD_OPT) # undef BOOST_LIB_THREAD_OPT #endif #if defined(BOOST_LIB_RT_OPT) # undef BOOST_LIB_RT_OPT #endif #if defined(BOOST_LIB_LINK_OPT) # undef BOOST_LIB_LINK_OPT #endif #if defined(BOOST_LIB_DEBUG_OPT) # undef BOOST_LIB_DEBUG_OPT #endif #if defined(BOOST_DYN_LINK) # undef BOOST_DYN_LINK #endif #if defined(BOOST_AUTO_LINK_NOMANGLE) # undef BOOST_AUTO_LINK_NOMANGLE #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/user.hpp��������������������������������������0000644�0001750�0001750�00000012045�12320456500�023616� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// boost/config/user.hpp ---------------------------------------------------// // (C) Copyright John Maddock 2001. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // Do not check in modified versions of this file, // This file may be customized by the end user, but not by boost. // // Use this file to define a site and compiler specific // configuration policy: // // define this to locate a compiler config file: // #define BOOST_COMPILER_CONFIG <myheader> // define this to locate a stdlib config file: // #define BOOST_STDLIB_CONFIG <myheader> // define this to locate a platform config file: // #define BOOST_PLATFORM_CONFIG <myheader> // define this to disable compiler config, // use if your compiler config has nothing to set: // #define BOOST_NO_COMPILER_CONFIG // define this to disable stdlib config, // use if your stdlib config has nothing to set: // #define BOOST_NO_STDLIB_CONFIG // define this to disable platform config, // use if your platform config has nothing to set: // #define BOOST_NO_PLATFORM_CONFIG // define this to disable all config options, // excluding the user config. Use if your // setup is fully ISO compliant, and has no // useful extensions, or for autoconf generated // setups: // #define BOOST_NO_CONFIG // define this to make the config "optimistic" // about unknown compiler versions. Normally // unknown compiler versions are assumed to have // all the defects of the last known version, however // setting this flag, causes the config to assume // that unknown compiler versions are fully conformant // with the standard: // #define BOOST_STRICT_CONFIG // define this to cause the config to halt compilation // with an #error if it encounters anything unknown -- // either an unknown compiler version or an unknown // compiler/platform/library: // #define BOOST_ASSERT_CONFIG // define if you want to disable threading support, even // when available: // #define BOOST_DISABLE_THREADS // define when you want to disable Win32 specific features // even when available: // #define BOOST_DISABLE_WIN32 // BOOST_DISABLE_ABI_HEADERS: Stops boost headers from including any // prefix/suffix headers that normally control things like struct // packing and alignment. // #define BOOST_DISABLE_ABI_HEADERS // BOOST_ABI_PREFIX: A prefix header to include in place of whatever // boost.config would normally select, any replacement should set up // struct packing and alignment options as required. // #define BOOST_ABI_PREFIX my-header-name // BOOST_ABI_SUFFIX: A suffix header to include in place of whatever // boost.config would normally select, any replacement should undo // the effects of the prefix header. // #define BOOST_ABI_SUFFIX my-header-name // BOOST_ALL_DYN_LINK: Forces all libraries that have separate source, // to be linked as dll's rather than static libraries on Microsoft Windows // (this macro is used to turn on __declspec(dllimport) modifiers, so that // the compiler knows which symbols to look for in a dll rather than in a // static library). Note that there may be some libraries that can only // be statically linked (Boost.Test for example) and others which may only // be dynamically linked (Boost.Threads for example), in these cases this // macro has no effect. // #define BOOST_ALL_DYN_LINK // BOOST_WHATEVER_DYN_LINK: Forces library "whatever" to be linked as a dll // rather than a static library on Microsoft Windows: replace the WHATEVER // part of the macro name with the name of the library that you want to // dynamically link to, for example use BOOST_DATE_TIME_DYN_LINK or // BOOST_REGEX_DYN_LINK etc (this macro is used to turn on __declspec(dllimport) // modifiers, so that the compiler knows which symbols to look for in a dll // rather than in a static library). // Note that there may be some libraries that can only be statically linked // (Boost.Test for example) and others which may only be dynamically linked // (Boost.Threads for example), in these cases this macro is unsupported. // #define BOOST_WHATEVER_DYN_LINK // BOOST_ALL_NO_LIB: Tells the config system not to automatically select // which libraries to link against. // Normally if a compiler supports #pragma lib, then the correct library // build variant will be automatically selected and linked against, // simply by the act of including one of that library's headers. // This macro turns that feature off. // #define BOOST_ALL_NO_LIB // BOOST_WHATEVER_NO_LIB: Tells the config system not to automatically // select which library to link against for library "whatever", // replace WHATEVER in the macro name with the name of the library; // for example BOOST_DATE_TIME_NO_LIB or BOOST_REGEX_NO_LIB. // Normally if a compiler supports #pragma lib, then the correct library // build variant will be automatically selected and linked against, simply // by the act of including one of that library's headers. This macro turns // that feature off. // #define BOOST_WHATEVER_NO_LIB �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/abi_suffix.hpp��������������������������������0000644�0001750�0001750�00000001415�12320456500�024756� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// abi_sufffix header -------------------------------------------------------// // (c) Copyright John Maddock 2003 // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt). // This header should be #included AFTER code that was preceded by a #include // <boost/config/abi_prefix.hpp>. #ifndef BOOST_CONFIG_ABI_PREFIX_HPP # error Header boost/config/abi_suffix.hpp must only be used after boost/config/abi_prefix.hpp #else # undef BOOST_CONFIG_ABI_PREFIX_HPP #endif // the suffix header occurs after all of our code: #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif #if defined( __BORLANDC__ ) #pragma nopushoptwarn #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/no_tr1/���������������������������������������0000755�0001750�0001750�00000000000�12320456500�023327� 5����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/no_tr1/utility.hpp����������������������������0000644�0001750�0001750�00000001526�12320456500�025547� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2005. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // The aim of this header is just to include <utility> but to do // so in a way that does not result in recursive inclusion of // the Boost TR1 components if boost/tr1/tr1/utility is in the // include search path. We have to do this to avoid circular // dependencies: // #ifndef BOOST_CONFIG_UTILITY # define BOOST_CONFIG_UTILITY # ifndef BOOST_TR1_NO_RECURSION # define BOOST_TR1_NO_RECURSION # define BOOST_CONFIG_NO_UTILITY_RECURSION # endif # include <utility> # ifdef BOOST_CONFIG_NO_UTILITY_RECURSION # undef BOOST_TR1_NO_RECURSION # undef BOOST_CONFIG_NO_UTILITY_RECURSION # endif #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/no_tr1/complex.hpp����������������������������0000644�0001750�0001750�00000001526�12320456500�025513� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2005. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // The aim of this header is just to include <complex> but to do // so in a way that does not result in recursive inclusion of // the Boost TR1 components if boost/tr1/tr1/complex is in the // include search path. We have to do this to avoid circular // dependencies: // #ifndef BOOST_CONFIG_COMPLEX # define BOOST_CONFIG_COMPLEX # ifndef BOOST_TR1_NO_RECURSION # define BOOST_TR1_NO_RECURSION # define BOOST_CONFIG_NO_COMPLEX_RECURSION # endif # include <complex> # ifdef BOOST_CONFIG_NO_COMPLEX_RECURSION # undef BOOST_TR1_NO_RECURSION # undef BOOST_CONFIG_NO_COMPLEX_RECURSION # endif #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/no_tr1/memory.hpp�����������������������������0000644�0001750�0001750�00000001516�12320456500�025353� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2005. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // The aim of this header is just to include <memory> but to do // so in a way that does not result in recursive inclusion of // the Boost TR1 components if boost/tr1/tr1/memory is in the // include search path. We have to do this to avoid circular // dependencies: // #ifndef BOOST_CONFIG_MEMORY # define BOOST_CONFIG_MEMORY # ifndef BOOST_TR1_NO_RECURSION # define BOOST_TR1_NO_RECURSION # define BOOST_CONFIG_NO_MEMORY_RECURSION # endif # include <memory> # ifdef BOOST_CONFIG_NO_MEMORY_RECURSION # undef BOOST_TR1_NO_RECURSION # undef BOOST_CONFIG_NO_MEMORY_RECURSION # endif #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/no_tr1/functional.hpp�������������������������0000644�0001750�0001750�00000001556�12320456500�026211� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2005. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // The aim of this header is just to include <functional> but to do // so in a way that does not result in recursive inclusion of // the Boost TR1 components if boost/tr1/tr1/functional is in the // include search path. We have to do this to avoid circular // dependencies: // #ifndef BOOST_CONFIG_FUNCTIONAL # define BOOST_CONFIG_FUNCTIONAL # ifndef BOOST_TR1_NO_RECURSION # define BOOST_TR1_NO_RECURSION # define BOOST_CONFIG_NO_FUNCTIONAL_RECURSION # endif # include <functional> # ifdef BOOST_CONFIG_NO_FUNCTIONAL_RECURSION # undef BOOST_TR1_NO_RECURSION # undef BOOST_CONFIG_NO_FUNCTIONAL_RECURSION # endif #endif ��������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/config/no_tr1/cmath.hpp������������������������������0000644�0001750�0001750�00000001506�12320456500�025136� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// (C) Copyright John Maddock 2008. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // The aim of this header is just to include <cmath> but to do // so in a way that does not result in recursive inclusion of // the Boost TR1 components if boost/tr1/tr1/cmath is in the // include search path. We have to do this to avoid circular // dependencies: // #ifndef BOOST_CONFIG_CMATH # define BOOST_CONFIG_CMATH # ifndef BOOST_TR1_NO_RECURSION # define BOOST_TR1_NO_RECURSION # define BOOST_CONFIG_NO_CMATH_RECURSION # endif # include <cmath> # ifdef BOOST_CONFIG_NO_CMATH_RECURSION # undef BOOST_TR1_NO_RECURSION # undef BOOST_CONFIG_NO_CMATH_RECURSION # endif #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/noncopyable.hpp��������������������������������������0000644�0001750�0001750�00000001766�12320456500�023714� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Boost noncopyable.hpp header file --------------------------------------// // (C) Copyright Beman Dawes 1999-2003. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/utility for documentation. #ifndef BOOST_NONCOPYABLE_HPP_INCLUDED #define BOOST_NONCOPYABLE_HPP_INCLUDED namespace boost { // Private copy constructor and copy assignment ensure classes derived from // class noncopyable cannot be copied. // Contributed by Dave Abrahams namespace noncopyable_ // protection from unintended ADL { class noncopyable { protected: noncopyable() {} ~noncopyable() {} private: // emphasize the following members are private noncopyable( const noncopyable& ); const noncopyable& operator=( const noncopyable& ); }; } typedef noncopyable_::noncopyable noncopyable; } // namespace boost #endif // BOOST_NONCOPYABLE_HPP_INCLUDED ����������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/boost/boost/version.hpp������������������������������������������0000644�0001750�0001750�00000002144�12320456500�023057� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Boost version.hpp configuration header file ------------------------------// // (C) Copyright John maddock 1999. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/config for documentation #ifndef BOOST_VERSION_HPP #define BOOST_VERSION_HPP // // Caution, this is the only boost header that is guarenteed // to change with every boost release, including this header // will cause a recompile every time a new boost version is // released. // // BOOST_VERSION % 100 is the patch level // BOOST_VERSION / 100 % 1000 is the minor version // BOOST_VERSION / 100000 is the major version #define BOOST_VERSION 103900 // // BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION // but as a *string* in the form "x_y[_z]" where x is the major version // number, y is the minor version number, and z is the patch level if not 0. // This is used by <config/auto_link.hpp> to select which library version to link to. #define BOOST_LIB_VERSION "1_39" #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/���������������������������������������������������������0000755�0001750�0001750�00000000000�12320456500�020020� 5����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jconfig.cfg����������������������������������������������0000644�0001750�0001750�00000002307�12320456500�022122� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* jconfig.cfg --- source file edited by configure script */ /* see jconfig.doc for explanations */ #undef HAVE_PROTOTYPES #undef HAVE_UNSIGNED_CHAR #undef HAVE_UNSIGNED_SHORT #undef void #undef const #undef CHAR_IS_UNSIGNED #undef HAVE_STDDEF_H #undef HAVE_STDLIB_H #undef NEED_BSD_STRINGS #undef NEED_SYS_TYPES_H #undef NEED_FAR_POINTERS #undef NEED_SHORT_EXTERNAL_NAMES /* Define this if you get warnings about undefined structures. */ #undef INCOMPLETE_TYPES_BROKEN #ifdef JPEG_INTERNALS #undef RIGHT_SHIFT_IS_UNSIGNED #undef INLINE /* These are for configuring the JPEG memory manager. */ #undef DEFAULT_MAX_MEM #undef NO_MKTEMP #endif /* JPEG_INTERNALS */ #ifdef JPEG_CJPEG_DJPEG #define BMP_SUPPORTED /* BMP image file format */ #define GIF_SUPPORTED /* GIF image file format */ #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ #undef RLE_SUPPORTED /* Utah RLE image file format */ #define TARGA_SUPPORTED /* Targa image file format */ #undef TWO_FILE_COMMANDLINE #undef NEED_SIGNAL_CATCHER #undef DONT_USE_B_MODE /* Define this if you want percent-done progress reports from cjpeg/djpeg. */ #undef PROGRESS_REPORT #endif /* JPEG_CJPEG_DJPEG */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/transupp.h�����������������������������������������������0000644�0001750�0001750�00000013340�12320456500�022046� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * transupp.h * * Copyright (C) 1997, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains declarations for image transformation routines and * other utility code used by the jpegtran sample application. These are * NOT part of the core JPEG library. But we keep these routines separate * from jpegtran.c to ease the task of maintaining jpegtran-like programs * that have other user interfaces. * * NOTE: all the routines declared here have very specific requirements * about when they are to be executed during the reading and writing of the * source and destination files. See the comments in transupp.c, or see * jpegtran.c for an example of correct usage. */ /* If you happen not to want the image transform support, disable it here */ #ifndef TRANSFORMS_SUPPORTED #define TRANSFORMS_SUPPORTED 1 /* 0 disables transform code */ #endif #ifdef __cplusplus extern "C" { #endif // cplusplus /* Short forms of external names for systems with brain-damaged linkers. */ #ifdef NEED_SHORT_EXTERNAL_NAMES #define jtransform_request_workspace jTrRequest #define jtransform_adjust_parameters jTrAdjust #define jtransform_execute_transformation jTrExec #define jcopy_markers_setup jCMrkSetup #define jcopy_markers_execute jCMrkExec #endif /* NEED_SHORT_EXTERNAL_NAMES */ /* * Codes for supported types of image transformations. */ typedef enum { JXFORM_NONE, /* no transformation */ JXFORM_FLIP_H, /* horizontal flip */ JXFORM_FLIP_V, /* vertical flip */ JXFORM_TRANSPOSE, /* transpose across UL-to-LR axis */ JXFORM_TRANSVERSE, /* transpose across UR-to-LL axis */ JXFORM_ROT_90, /* 90-degree clockwise rotation */ JXFORM_ROT_180, /* 180-degree rotation */ JXFORM_ROT_270 /* 270-degree clockwise (or 90 ccw) */ } JXFORM_CODE; /* * Although rotating and flipping data expressed as DCT coefficients is not * hard, there is an asymmetry in the JPEG format specification for images * whose dimensions aren't multiples of the iMCU size. The right and bottom * image edges are padded out to the next iMCU boundary with junk data; but * no padding is possible at the top and left edges. If we were to flip * the whole image including the pad data, then pad garbage would become * visible at the top and/or left, and real pixels would disappear into the * pad margins --- perhaps permanently, since encoders & decoders may not * bother to preserve DCT blocks that appear to be completely outside the * nominal image area. So, we have to exclude any partial iMCUs from the * basic transformation. * * Transpose is the only transformation that can handle partial iMCUs at the * right and bottom edges completely cleanly. flip_h can flip partial iMCUs * at the bottom, but leaves any partial iMCUs at the right edge untouched. * Similarly flip_v leaves any partial iMCUs at the bottom edge untouched. * The other transforms are defined as combinations of these basic transforms * and process edge blocks in a way that preserves the equivalence. * * The "trim" option causes untransformable partial iMCUs to be dropped; * this is not strictly lossless, but it usually gives the best-looking * result for odd-size images. Note that when this option is active, * the expected mathematical equivalences between the transforms may not hold. * (For example, -rot 270 -trim trims only the bottom edge, but -rot 90 -trim * followed by -rot 180 -trim trims both edges.) * * We also offer a "force to grayscale" option, which simply discards the * chrominance channels of a YCbCr image. This is lossless in the sense that * the luminance channel is preserved exactly. It's not the same kind of * thing as the rotate/flip transformations, but it's convenient to handle it * as part of this package, mainly because the transformation routines have to * be aware of the option to know how many components to work on. */ typedef struct { /* Options: set by caller */ JXFORM_CODE transform; /* image transform operator */ boolean trim; /* if TRUE, trim partial MCUs as needed */ boolean force_grayscale; /* if TRUE, convert color image to grayscale */ /* Internal workspace: caller should not touch these */ int num_components; /* # of components in workspace */ jvirt_barray_ptr * workspace_coef_arrays; /* workspace for transformations */ } jpeg_transform_info; #if TRANSFORMS_SUPPORTED /* Request any required workspace */ EXTERN(void) jtransform_request_workspace JPP((j_decompress_ptr srcinfo, jpeg_transform_info *info)); /* Adjust output image parameters */ EXTERN(jvirt_barray_ptr *) jtransform_adjust_parameters JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, jvirt_barray_ptr *src_coef_arrays, jpeg_transform_info *info)); /* Execute the actual transformation, if any */ EXTERN(void) jtransform_execute_transformation JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, jvirt_barray_ptr *src_coef_arrays, jpeg_transform_info *info)); #endif /* TRANSFORMS_SUPPORTED */ /* * Support for copying optional markers from source to destination file. */ typedef enum { JCOPYOPT_NONE, /* copy no optional markers */ JCOPYOPT_COMMENTS, /* copy only comment (COM) markers */ JCOPYOPT_ALL /* copy all optional markers */ } JCOPY_OPTION; #define JCOPYOPT_DEFAULT JCOPYOPT_COMMENTS /* recommended default */ /* Setup decompression object to save desired markers in memory */ EXTERN(void) jcopy_markers_setup JPP((j_decompress_ptr srcinfo, JCOPY_OPTION option)); /* Copy markers saved in the given source object to the destination object */ EXTERN(void) jcopy_markers_execute JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, JCOPY_OPTION option)); #ifdef __cplusplus } #endif // cplusplus ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jutils.c�������������������������������������������������0000644�0001750�0001750�00000012170�12320456500�021477� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jutils.c * * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains tables and miscellaneous utility routines needed * for both compression and decompression. * Note we prefix all global names with "j" to minimize conflicts with * a surrounding application. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" /* * jpeg_zigzag_order[i] is the zigzag-order position of the i'th element * of a DCT block read in natural order (left to right, top to bottom). */ #if 0 /* This table is not actually needed in v6a */ const int jpeg_zigzag_order[DCTSIZE2] = { 0, 1, 5, 6, 14, 15, 27, 28, 2, 4, 7, 13, 16, 26, 29, 42, 3, 8, 12, 17, 25, 30, 41, 43, 9, 11, 18, 24, 31, 40, 44, 53, 10, 19, 23, 32, 39, 45, 52, 54, 20, 22, 33, 38, 46, 51, 55, 60, 21, 34, 37, 47, 50, 56, 59, 61, 35, 36, 48, 49, 57, 58, 62, 63 }; #endif /* * jpeg_natural_order[i] is the natural-order position of the i'th element * of zigzag order. * * When reading corrupted data, the Huffman decoders could attempt * to reference an entry beyond the end of this array (if the decoded * zero run length reaches past the end of the block). To prevent * wild stores without adding an inner-loop test, we put some extra * "63"s after the real entries. This will cause the extra coefficient * to be stored in location 63 of the block, not somewhere random. * The worst case would be a run-length of 15, which means we need 16 * fake entries. */ const int jpeg_natural_order[DCTSIZE2+16] = { 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, /* extra entries for safety in decoder */ 63, 63, 63, 63, 63, 63, 63, 63 }; /* * Arithmetic utilities */ GLOBAL(long) jdiv_round_up (long a, long b) /* Compute a/b rounded up to next integer, ie, ceil(a/b) */ /* Assumes a >= 0, b > 0 */ { return (a + b - 1L) / b; } GLOBAL(long) jround_up (long a, long b) /* Compute a rounded up to next multiple of b, ie, ceil(a/b)*b */ /* Assumes a >= 0, b > 0 */ { a += b - 1L; return a - (a % b); } /* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays * and coefficient-block arrays. This won't work on 80x86 because the arrays * are FAR and we're assuming a small-pointer memory model. However, some * DOS compilers provide far-pointer versions of memcpy() and memset() even * in the small-model libraries. These will be used if USE_FMEM is defined. * Otherwise, the routines below do it the hard way. (The performance cost * is not all that great, because these routines aren't very heavily used.) */ #ifndef NEED_FAR_POINTERS /* normal case, same as regular macros */ #define FMEMCOPY(dest,src,size) MEMCOPY(dest,src,size) #define FMEMZERO(target,size) MEMZERO(target,size) #else /* 80x86 case, define if we can */ #ifdef USE_FMEM #define FMEMCOPY(dest,src,size) _fmemcpy((void FAR *)(dest), (const void FAR *)(src), (size_t)(size)) #define FMEMZERO(target,size) _fmemset((void FAR *)(target), 0, (size_t)(size)) #endif #endif GLOBAL(void) jcopy_sample_rows (JSAMPARRAY input_array, int source_row, JSAMPARRAY output_array, int dest_row, int num_rows, JDIMENSION num_cols) /* Copy some rows of samples from one place to another. * num_rows rows are copied from input_array[source_row++] * to output_array[dest_row++]; these areas may overlap for duplication. * The source and destination arrays must be at least as wide as num_cols. */ { register JSAMPROW inptr, outptr; #ifdef FMEMCOPY register size_t count = (size_t) (num_cols * SIZEOF(JSAMPLE)); #else register JDIMENSION count; #endif register int row; input_array += source_row; output_array += dest_row; for (row = num_rows; row > 0; row--) { inptr = *input_array++; outptr = *output_array++; #ifdef FMEMCOPY FMEMCOPY(outptr, inptr, count); #else for (count = num_cols; count > 0; count--) *outptr++ = *inptr++; /* needn't bother with GETJSAMPLE() here */ #endif } } GLOBAL(void) jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row, JDIMENSION num_blocks) /* Copy a row of coefficient blocks from one place to another. */ { #ifdef FMEMCOPY FMEMCOPY(output_row, input_row, num_blocks * (DCTSIZE2 * SIZEOF(JCOEF))); #else register JCOEFPTR inptr, outptr; register long count; inptr = (JCOEFPTR) input_row; outptr = (JCOEFPTR) output_row; for (count = (long) num_blocks * DCTSIZE2; count > 0; count--) { *outptr++ = *inptr++; } #endif } GLOBAL(void) jzero_far (void FAR * target, size_t bytestozero) /* Zero out a chunk of FAR memory. */ /* This might be sample-array data, block-array data, or alloc_large data. */ { #ifdef FMEMZERO FMEMZERO(target, bytestozero); #else register char FAR * ptr = (char FAR *) target; register size_t count; for (count = bytestozero; count > 0; count--) { *ptr++ = 0; } #endif } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jmemsrc.c������������������������������������������������0000644�0001750�0001750�00000012216�12320456500�021626� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jmemsrc.c * * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains decompression data source routines for the case of * reading JPEG data from a memory buffer that is preloaded with the entire * JPEG file. This would not seem especially useful at first sight, but * a number of people have asked for it. * This is really just a stripped-down version of jdatasrc.c. Comparison * of this code with jdatasrc.c may be helpful in seeing how to make * custom source managers for other purposes. */ /* code was taken from: * [How to read JPEG resource using JpegLib ?] * http://www.smalleranimals.com/vforum/archive/index.php?t-1922.html */ /* this is not a core library module, so it doesn't define JPEG_INTERNALS */ #include "jinclude.h" #include "jpeglib.h" #include "jerror.h" /* Expanded data source object for memory input */ /** * \brief very low level C 'structure', used to decode jpeg file * Should not appear in the Doxygen supplied documentation */ typedef struct { struct jpeg_source_mgr pub; /* public fields */ JOCTET eoi_buffer[2]; /* a place to put a dummy EOI */ } my_source_mgr; typedef my_source_mgr * my_src_ptr; /* * Initialize source --- called by jpeg_read_header * before any data is actually read. */ METHODDEF(void) init_source (j_decompress_ptr cinfo) { /* No work, since jpeg_memory_src set up the buffer pointer and count. * Indeed, if we want to read multiple JPEG images from one buffer, * this *must* not do anything to the pointer. */ (void)cinfo; } /* * Fill the input buffer --- called whenever buffer is emptied. * * In this application, this routine should never be called; if it is called, * the decompressor has overrun the end of the input buffer, implying we * supplied an incomplete or corrupt JPEG datastream. A simple error exit * might be the most appropriate response. * * But what we choose to do in this code is to supply dummy EOI markers * in order to force the decompressor to finish processing and supply * some sort of output image, no matter how corrupted. */ METHODDEF(boolean) fill_input_buffer (j_decompress_ptr cinfo) { my_src_ptr src = (my_src_ptr) cinfo->src; WARNMS(cinfo, JWRN_JPEG_EOF); /* Create a fake EOI marker */ src->eoi_buffer[0] = (JOCTET) 0xFF; src->eoi_buffer[1] = (JOCTET) JPEG_EOI; src->pub.next_input_byte = src->eoi_buffer; src->pub.bytes_in_buffer = 2; return TRUE; } /* * Skip data --- used to skip over a potentially large amount of * uninteresting data (such as an APPn marker). * * If we overrun the end of the buffer, we let fill_input_buffer deal with * it. An extremely large skip could cause some time-wasting here, but * it really isn't supposed to happen ... and the decompressor will never * skip more than 64K anyway. */ METHODDEF(void) skip_input_data (j_decompress_ptr cinfo, long num_bytes) { my_src_ptr src = (my_src_ptr) cinfo->src; if (num_bytes > 0) { while (num_bytes > (long) src->pub.bytes_in_buffer) { num_bytes -= (long) src->pub.bytes_in_buffer; (void) fill_input_buffer(cinfo); /* note we assume that fill_input_buffer will never return FALSE, * so suspension need not be handled. */ } src->pub.next_input_byte += (size_t) num_bytes; src->pub.bytes_in_buffer -= (size_t) num_bytes; } } /* * An additional method that can be provided by data source modules is the * resync_to_restart method for error recovery in the presence of RST markers. * For the moment, this source module just uses the default resync method * provided by the JPEG library. That method assumes that no backtracking * is possible. */ /* * Terminate source --- called by jpeg_finish_decompress * after all data has been read. Often a no-op. * * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding * application must deal with any cleanup that should happen even * for error exit. */ METHODDEF(void) term_source (j_decompress_ptr cinfo) { /* no work necessary here */ (void)cinfo; } /* * Prepare for input from a memory buffer. */ GLOBAL(void) jpeg_memory_src (j_decompress_ptr cinfo, const JOCTET * buffer, size_t bufsize) { my_src_ptr src; /* The source object is made permanent so that a series of JPEG images * can be read from a single buffer by calling jpeg_memory_src * only before the first one. * This makes it unsafe to use this manager and a different source * manager serially with the same JPEG object. Caveat programmer. */ if (cinfo->src == NULL) { /* first time for this JPEG object? */ cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, SIZEOF(my_source_mgr)); } src = (my_src_ptr) cinfo->src; src->pub.init_source = init_source; src->pub.fill_input_buffer = fill_input_buffer; src->pub.skip_input_data = skip_input_data; src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */ src->pub.term_source = term_source; src->pub.next_input_byte = buffer; src->pub.bytes_in_buffer = bufsize; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdtrans.c������������������������������������������������0000644�0001750�0001750�00000011536�12320456500�021637� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdtrans.c * * Copyright (C) 1995-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains library routines for transcoding decompression, * that is, reading raw DCT coefficient arrays from an input JPEG file. * The routines in jdapimin.c will also be needed by a transcoder. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossy.h" /* Forward declarations */ LOCAL(void) transdecode_master_selection JPP((j_decompress_ptr cinfo)); /* * Read the coefficient arrays from a JPEG file. * jpeg_read_header must be completed before calling this. * * The entire image is read into a set of virtual coefficient-block arrays, * one per component. The return value is a pointer to the array of * virtual-array descriptors. These can be manipulated directly via the * JPEG memory manager, or handed off to jpeg_write_coefficients(). * To release the memory occupied by the virtual arrays, call * jpeg_finish_decompress() when done with the data. * * An alternative usage is to simply obtain access to the coefficient arrays * during a buffered-image-mode decompression operation. This is allowed * after any jpeg_finish_output() call. The arrays can be accessed until * jpeg_finish_decompress() is called. (Note that any call to the library * may reposition the arrays, so don't rely on access_virt_barray() results * to stay valid across library calls.) * * Returns NULL if suspended. This case need be checked only if * a suspending data source is used. */ GLOBAL(jvirt_barray_ptr *) jpeg_read_coefficients (j_decompress_ptr cinfo) { /* j_lossy_d_ptr decomp; */ /* Can't read coefficients from lossless streams */ if (cinfo->process == JPROC_LOSSLESS) { ERREXIT(cinfo, JERR_CANT_TRANSCODE); return NULL; } if (cinfo->global_state == DSTATE_READY) { /* First call: initialize active modules */ transdecode_master_selection(cinfo); cinfo->global_state = DSTATE_RDCOEFS; } if (cinfo->global_state == DSTATE_RDCOEFS) { /* Absorb whole file into the coef buffer */ for (;;) { int retcode; /* Call progress monitor hook if present */ if (cinfo->progress != NULL) (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); /* Absorb some more input */ retcode = (*cinfo->inputctl->consume_input) (cinfo); if (retcode == JPEG_SUSPENDED) return NULL; if (retcode == JPEG_REACHED_EOI) break; /* Advance progress counter if appropriate */ if (cinfo->progress != NULL && (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) { if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) { /* startup underestimated number of scans; ratchet up one scan */ cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows; } } } /* Set state so that jpeg_finish_decompress does the right thing */ cinfo->global_state = DSTATE_STOPPING; } /* At this point we should be in state DSTATE_STOPPING if being used * standalone, or in state DSTATE_BUFIMAGE if being invoked to get access * to the coefficients during a full buffered-image-mode decompression. */ if ((cinfo->global_state == DSTATE_STOPPING || cinfo->global_state == DSTATE_BUFIMAGE) && cinfo->buffered_image) { return ((j_lossy_d_ptr) cinfo->codec)->coef_arrays; } /* Oops, improper usage */ ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); return NULL; /* keep compiler happy */ } /* * Master selection of decompression modules for transcoding. * This substitutes for jdmaster.c's initialization of the full decompressor. */ LOCAL(void) transdecode_master_selection (j_decompress_ptr cinfo) { /* This is effectively a buffered-image operation. */ cinfo->buffered_image = TRUE; /* Initialize decompression codec */ jinit_d_codec(cinfo); /* We can now tell the memory manager to allocate virtual arrays. */ (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); /* Initialize input side of decompressor to consume first scan. */ (*cinfo->inputctl->start_input_pass) (cinfo); /* Initialize progress monitoring. */ if (cinfo->progress != NULL) { int nscans; /* Estimate number of scans to set pass_limit. */ if (cinfo->process == JPROC_PROGRESSIVE) { /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */ nscans = 2 + 3 * cinfo->num_components; } else if (cinfo->inputctl->has_multiple_scans) { /* For a nonprogressive multiscan file, estimate 1 scan per component. */ nscans = cinfo->num_components; } else { nscans = 1; } cinfo->progress->pass_counter = 0L; cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans; cinfo->progress->completed_passes = 0; cinfo->progress->total_passes = 1; } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jcapimin.c�����������������������������������������������0000644�0001750�0001750�00000021642�12320456500�021763� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jcapimin.c * * Copyright (C) 1994-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains application interface code for the compression half * of the JPEG library. These are the "minimum" API routines that may be * needed in either the normal full-compression case or the transcoding-only * case. * * Most of the routines intended to be called directly by an application * are in this file or in jcapistd.c. But also see jcparam.c for * parameter-setup helper routines, jcomapi.c for routines shared by * compression and decompression, and jctrans.c for the transcoding case. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" /* * Initialization of a JPEG compression object. * The error manager must already be set up (in case memory manager fails). */ GLOBAL(void) jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize) { int i; /* Guard against version mismatches between library and caller. */ cinfo->mem = NULL; /* so jpeg_destroy knows mem mgr not called */ if (version != JPEG_LIB_VERSION) ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version); if (structsize != SIZEOF(struct jpeg_compress_struct)) ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, (int) SIZEOF(struct jpeg_compress_struct), (int) structsize); /* For debugging purposes, we zero the whole master structure. * But the application has already set the err pointer, and may have set * client_data, so we have to save and restore those fields. * Note: if application hasn't set client_data, tools like Purify may * complain here. */ { struct jpeg_error_mgr * err = cinfo->err; void * client_data = cinfo->client_data; /* ignore Purify complaint here */ MEMZERO(cinfo, SIZEOF(struct jpeg_compress_struct)); cinfo->err = err; cinfo->client_data = client_data; } cinfo->is_decompressor = FALSE; /* Initialize a memory manager instance for this object */ jinit_memory_mgr((j_common_ptr) cinfo); /* Zero out pointers to permanent structures. */ cinfo->progress = NULL; cinfo->dest = NULL; cinfo->comp_info = NULL; for (i = 0; i < NUM_QUANT_TBLS; i++) cinfo->quant_tbl_ptrs[i] = NULL; for (i = 0; i < NUM_HUFF_TBLS; i++) { cinfo->dc_huff_tbl_ptrs[i] = NULL; cinfo->ac_huff_tbl_ptrs[i] = NULL; } cinfo->script_space = NULL; cinfo->input_gamma = 1.0; /* in case application forgets */ /* OK, I'm ready */ cinfo->global_state = CSTATE_START; } /* * Destruction of a JPEG compression object */ GLOBAL(void) jpeg_destroy_compress (j_compress_ptr cinfo) { jpeg_destroy((j_common_ptr) cinfo); /* use common routine */ } /* * Abort processing of a JPEG compression operation, * but don't destroy the object itself. */ GLOBAL(void) jpeg_abort_compress (j_compress_ptr cinfo) { jpeg_abort((j_common_ptr) cinfo); /* use common routine */ } /* * Forcibly suppress or un-suppress all quantization and Huffman tables. * Marks all currently defined tables as already written (if suppress) * or not written (if !suppress). This will control whether they get emitted * by a subsequent jpeg_start_compress call. * * This routine is exported for use by applications that want to produce * abbreviated JPEG datastreams. It logically belongs in jcparam.c, but * since it is called by jpeg_start_compress, we put it here --- otherwise * jcparam.o would be linked whether the application used it or not. */ GLOBAL(void) jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress) { int i; JQUANT_TBL * qtbl; JHUFF_TBL * htbl; for (i = 0; i < NUM_QUANT_TBLS; i++) { if ((qtbl = cinfo->quant_tbl_ptrs[i]) != NULL) qtbl->sent_table = suppress; } for (i = 0; i < NUM_HUFF_TBLS; i++) { if ((htbl = cinfo->dc_huff_tbl_ptrs[i]) != NULL) htbl->sent_table = suppress; if ((htbl = cinfo->ac_huff_tbl_ptrs[i]) != NULL) htbl->sent_table = suppress; } } /* * Finish JPEG compression. * * If a multipass operating mode was selected, this may do a great deal of * work including most of the actual output. */ GLOBAL(void) jpeg_finish_compress (j_compress_ptr cinfo) { JDIMENSION iMCU_row; if (cinfo->global_state == CSTATE_SCANNING || cinfo->global_state == CSTATE_RAW_OK) { /* Terminate first pass */ if (cinfo->next_scanline < cinfo->image_height) ERREXIT(cinfo, JERR_TOO_LITTLE_DATA); (*cinfo->master->finish_pass) (cinfo); } else if (cinfo->global_state != CSTATE_WRCOEFS) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); /* Perform any remaining passes */ while (! cinfo->master->is_last_pass) { (*cinfo->master->prepare_for_pass) (cinfo); for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) { if (cinfo->progress != NULL) { cinfo->progress->pass_counter = (long) iMCU_row; cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows; (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); } /* We bypass the main controller and invoke coef controller directly; * all work is being done from the coefficient buffer. */ if (! (*cinfo->codec->compress_data) (cinfo, (JSAMPIMAGE) NULL)) ERREXIT(cinfo, JERR_CANT_SUSPEND); } (*cinfo->master->finish_pass) (cinfo); } /* Write EOI, do final cleanup */ (*cinfo->marker->write_file_trailer) (cinfo); (*cinfo->dest->term_destination) (cinfo); /* We can use jpeg_abort to release memory and reset global_state */ jpeg_abort((j_common_ptr) cinfo); } /* * Write a special marker. * This is only recommended for writing COM or APPn markers. * Must be called after jpeg_start_compress() and before * first call to jpeg_write_scanlines() or jpeg_write_raw_data(). */ GLOBAL(void) jpeg_write_marker (j_compress_ptr cinfo, int marker, const JOCTET *dataptr, unsigned int datalen) { JMETHOD(void, write_marker_byte, (j_compress_ptr info, int val)); if (cinfo->next_scanline != 0 || (cinfo->global_state != CSTATE_SCANNING && cinfo->global_state != CSTATE_RAW_OK && cinfo->global_state != CSTATE_WRCOEFS)) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); (*cinfo->marker->write_marker_header) (cinfo, marker, datalen); write_marker_byte = cinfo->marker->write_marker_byte; /* copy for speed */ while (datalen--) { (*write_marker_byte) (cinfo, *dataptr); dataptr++; } } /* Same, but piecemeal. */ GLOBAL(void) jpeg_write_m_header (j_compress_ptr cinfo, int marker, unsigned int datalen) { if (cinfo->next_scanline != 0 || (cinfo->global_state != CSTATE_SCANNING && cinfo->global_state != CSTATE_RAW_OK && cinfo->global_state != CSTATE_WRCOEFS)) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); (*cinfo->marker->write_marker_header) (cinfo, marker, datalen); } GLOBAL(void) jpeg_write_m_byte (j_compress_ptr cinfo, int val) { (*cinfo->marker->write_marker_byte) (cinfo, val); } /* * Alternate compression function: just write an abbreviated table file. * Before calling this, all parameters and a data destination must be set up. * * To produce a pair of files containing abbreviated tables and abbreviated * image data, one would proceed as follows: * * initialize JPEG object * set JPEG parameters * set destination to table file * jpeg_write_tables(cinfo); * set destination to image file * jpeg_start_compress(cinfo, FALSE); * write data... * jpeg_finish_compress(cinfo); * * jpeg_write_tables has the side effect of marking all tables written * (same as jpeg_suppress_tables(..., TRUE)). Thus a subsequent start_compress * will not re-emit the tables unless it is passed write_all_tables=TRUE. */ GLOBAL(void) jpeg_write_tables (j_compress_ptr cinfo) { if (cinfo->global_state != CSTATE_START) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); /* (Re)initialize error mgr and destination modules */ (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo); (*cinfo->dest->init_destination) (cinfo); /* Initialize the marker writer ... bit of a crock to do it here. */ jinit_marker_writer(cinfo); /* Write them tables! */ (*cinfo->marker->write_tables_only) (cinfo); /* And clean up. */ (*cinfo->dest->term_destination) (cinfo); /* * In library releases up through v6a, we called jpeg_abort() here to free * any working memory allocated by the destination manager and marker * writer. Some applications had a problem with that: they allocated space * of their own from the library memory manager, and didn't want it to go * away during write_tables. So now we do nothing. This will cause a * memory leak if an app calls write_tables repeatedly without doing a full * compression cycle or otherwise resetting the JPEG object. However, that * seems less bad than unexpectedly freeing memory in the normal case. * An app that prefers the old behavior can call jpeg_abort for itself after * each call to jpeg_write_tables(). */ } ����������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jfdctfst.c�����������������������������������������������0000644�0001750�0001750�00000016632�12320456500�022003� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jfdctfst.c * * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains a fast, not so accurate integer implementation of the * forward DCT (Discrete Cosine Transform). * * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT * on each column. Direct algorithms are also available, but they are * much more complex and seem not to be any faster when reduced to code. * * This implementation is based on Arai, Agui, and Nakajima's algorithm for * scaled DCT. Their original paper (Trans. IEICE E-71(11):1095) is in * Japanese, but the algorithm is described in the Pennebaker & Mitchell * JPEG textbook (see REFERENCES section in file README). The following code * is based directly on figure 4-8 in P&M. * While an 8-point DCT cannot be done in less than 11 multiplies, it is * possible to arrange the computation so that many of the multiplies are * simple scalings of the final outputs. These multiplies can then be * folded into the multiplications or divisions by the JPEG quantization * table entries. The AA&N method leaves only 5 multiplies and 29 adds * to be done in the DCT itself. * The primary disadvantage of this method is that with fixed-point math, * accuracy is lost due to imprecise representation of the scaled * quantization values. The smaller the quantization table entry, the less * precise the scaled value, so this implementation does worse with high- * quality-setting files than with low-quality ones. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jdct.h" /* Private declarations for DCT subsystem */ #ifdef DCT_IFAST_SUPPORTED /* * This module is specialized to the case DCTSIZE = 8. */ #if DCTSIZE != 8 Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ #endif /* Scaling decisions are generally the same as in the LL&M algorithm; * see jfdctint.c for more details. However, we choose to descale * (right shift) multiplication products as soon as they are formed, * rather than carrying additional fractional bits into subsequent additions. * This compromises accuracy slightly, but it lets us save a few shifts. * More importantly, 16-bit arithmetic is then adequate (for 8-bit samples) * everywhere except in the multiplications proper; this saves a good deal * of work on 16-bit-int machines. * * Again to save a few shifts, the intermediate results between pass 1 and * pass 2 are not upscaled, but are represented only to integral precision. * * A final compromise is to represent the multiplicative constants to only * 8 fractional bits, rather than 13. This saves some shifting work on some * machines, and may also reduce the cost of multiplication (since there * are fewer one-bits in the constants). */ #define CONST_BITS 8 /* Some C compilers fail to reduce "FIX(constant)" at compile time, thus * causing a lot of useless floating-point operations at run time. * To get around this we use the following pre-calculated constants. * If you change CONST_BITS you may want to add appropriate values. * (With a reasonable C compiler, you can just rely on the FIX() macro...) */ #if CONST_BITS == 8 #define FIX_0_382683433 ((INT32) 98) /* FIX(0.382683433) */ #define FIX_0_541196100 ((INT32) 139) /* FIX(0.541196100) */ #define FIX_0_707106781 ((INT32) 181) /* FIX(0.707106781) */ #define FIX_1_306562965 ((INT32) 334) /* FIX(1.306562965) */ #else #define FIX_0_382683433 FIX(0.382683433) #define FIX_0_541196100 FIX(0.541196100) #define FIX_0_707106781 FIX(0.707106781) #define FIX_1_306562965 FIX(1.306562965) #endif /* We can gain a little more speed, with a further compromise in accuracy, * by omitting the addition in a descaling shift. This yields an incorrectly * rounded result half the time... */ #ifndef USE_ACCURATE_ROUNDING #undef DESCALE #define DESCALE(x,n) RIGHT_SHIFT(x, n) #endif /* Multiply a DCTELEM variable by an INT32 constant, and immediately * descale to yield a DCTELEM result. */ #define MULTIPLY(var,const) ((DCTELEM) DESCALE((var) * (const), CONST_BITS)) /* * Perform the forward DCT on one block of samples. */ GLOBAL(void) jpeg_fdct_ifast (DCTELEM * data) { DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; DCTELEM tmp10, tmp11, tmp12, tmp13; DCTELEM z1, z2, z3, z4, z5, z11, z13; DCTELEM *dataptr; int ctr; SHIFT_TEMPS /* Pass 1: process rows. */ dataptr = data; for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { tmp0 = dataptr[0] + dataptr[7]; tmp7 = dataptr[0] - dataptr[7]; tmp1 = dataptr[1] + dataptr[6]; tmp6 = dataptr[1] - dataptr[6]; tmp2 = dataptr[2] + dataptr[5]; tmp5 = dataptr[2] - dataptr[5]; tmp3 = dataptr[3] + dataptr[4]; tmp4 = dataptr[3] - dataptr[4]; /* Even part */ tmp10 = tmp0 + tmp3; /* phase 2 */ tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; dataptr[0] = tmp10 + tmp11; /* phase 3 */ dataptr[4] = tmp10 - tmp11; z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */ dataptr[2] = tmp13 + z1; /* phase 5 */ dataptr[6] = tmp13 - z1; /* Odd part */ tmp10 = tmp4 + tmp5; /* phase 2 */ tmp11 = tmp5 + tmp6; tmp12 = tmp6 + tmp7; /* The rotator is modified from fig 4-8 to avoid extra negations. */ z5 = MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */ z2 = MULTIPLY(tmp10, FIX_0_541196100) + z5; /* c2-c6 */ z4 = MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */ z3 = MULTIPLY(tmp11, FIX_0_707106781); /* c4 */ z11 = tmp7 + z3; /* phase 5 */ z13 = tmp7 - z3; dataptr[5] = z13 + z2; /* phase 6 */ dataptr[3] = z13 - z2; dataptr[1] = z11 + z4; dataptr[7] = z11 - z4; dataptr += DCTSIZE; /* advance pointer to next row */ } /* Pass 2: process columns. */ dataptr = data; for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7]; tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7]; tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6]; tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6]; tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5]; tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; /* Even part */ tmp10 = tmp0 + tmp3; /* phase 2 */ tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */ dataptr[DCTSIZE*4] = tmp10 - tmp11; z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */ dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */ dataptr[DCTSIZE*6] = tmp13 - z1; /* Odd part */ tmp10 = tmp4 + tmp5; /* phase 2 */ tmp11 = tmp5 + tmp6; tmp12 = tmp6 + tmp7; /* The rotator is modified from fig 4-8 to avoid extra negations. */ z5 = MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */ z2 = MULTIPLY(tmp10, FIX_0_541196100) + z5; /* c2-c6 */ z4 = MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */ z3 = MULTIPLY(tmp11, FIX_0_707106781); /* c4 */ z11 = tmp7 + z3; /* phase 5 */ z13 = tmp7 - z3; dataptr[DCTSIZE*5] = z13 + z2; /* phase 6 */ dataptr[DCTSIZE*3] = z13 - z2; dataptr[DCTSIZE*1] = z11 + z4; dataptr[DCTSIZE*7] = z11 - z4; dataptr++; /* advance pointer to next column */ } } #endif /* DCT_IFAST_SUPPORTED */ ������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdmarker.c�����������������������������������������������0000644�0001750�0001750�00000121061�12320456500�021764� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdmarker.c * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains routines to decode JPEG datastream markers. * Most of the complexity arises from our desire to support input * suspension: if not all of the data for a marker is available, * we must exit back to the application. On resumption, we reprocess * the marker. */ #include <stdlib.h> #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" typedef enum { /* JPEG marker codes */ M_SOF0 = 0xc0, M_SOF1 = 0xc1, M_SOF2 = 0xc2, M_SOF3 = 0xc3, M_SOF5 = 0xc5, M_SOF6 = 0xc6, M_SOF7 = 0xc7, M_JPG = 0xc8, M_SOF9 = 0xc9, M_SOF10 = 0xca, M_SOF11 = 0xcb, M_SOF13 = 0xcd, M_SOF14 = 0xce, M_SOF15 = 0xcf, M_DHT = 0xc4, M_DAC = 0xcc, M_RST0 = 0xd0, M_RST1 = 0xd1, M_RST2 = 0xd2, M_RST3 = 0xd3, M_RST4 = 0xd4, M_RST5 = 0xd5, M_RST6 = 0xd6, M_RST7 = 0xd7, M_SOI = 0xd8, M_EOI = 0xd9, M_SOS = 0xda, M_DQT = 0xdb, M_DNL = 0xdc, M_DRI = 0xdd, M_DHP = 0xde, M_EXP = 0xdf, M_APP0 = 0xe0, M_APP1 = 0xe1, M_APP2 = 0xe2, M_APP3 = 0xe3, M_APP4 = 0xe4, M_APP5 = 0xe5, M_APP6 = 0xe6, M_APP7 = 0xe7, M_APP8 = 0xe8, M_APP9 = 0xe9, M_APP10 = 0xea, M_APP11 = 0xeb, M_APP12 = 0xec, M_APP13 = 0xed, M_APP14 = 0xee, M_APP15 = 0xef, M_JPG0 = 0xf0, M_JPG13 = 0xfd, M_COM = 0xfe, M_TEM = 0x01, M_ERROR = 0x100 } JPEG_MARKER; /* Private state */ typedef struct { struct jpeg_marker_reader pub; /* public fields */ /* Application-overridable marker processing methods */ jpeg_marker_parser_method process_COM; jpeg_marker_parser_method process_APPn[16]; /* Limit on marker data length to save for each marker type */ unsigned int length_limit_COM; unsigned int length_limit_APPn[16]; /* Status of COM/APPn marker saving */ jpeg_saved_marker_ptr cur_marker; /* NULL if not processing a marker */ unsigned int bytes_read; /* data bytes read so far in marker */ /* Note: cur_marker is not linked into marker_list until it's all read. */ } my_marker_reader; typedef my_marker_reader * my_marker_ptr; /* * Macros for fetching data from the data source module. * * At all times, cinfo->src->next_input_byte and ->bytes_in_buffer reflect * the current restart point; we update them only when we have reached a * suitable place to restart if a suspension occurs. */ /* Declare and initialize local copies of input pointer/count */ #define INPUT_VARS(cinfo) \ struct jpeg_source_mgr * datasrc = (cinfo)->src; \ const JOCTET * next_input_byte = datasrc->next_input_byte; \ size_t bytes_in_buffer = datasrc->bytes_in_buffer /* Unload the local copies --- do this only at a restart boundary */ #define INPUT_SYNC(cinfo) \ ( datasrc->next_input_byte = next_input_byte, \ datasrc->bytes_in_buffer = bytes_in_buffer ) /* Reload the local copies --- used only in MAKE_BYTE_AVAIL */ #define INPUT_RELOAD(cinfo) \ ( next_input_byte = datasrc->next_input_byte, \ bytes_in_buffer = datasrc->bytes_in_buffer ) /* Internal macro for INPUT_BYTE and INPUT_2BYTES: make a byte available. * Note we do *not* do INPUT_SYNC before calling fill_input_buffer, * but we must reload the local copies after a successful fill. */ #define MAKE_BYTE_AVAIL(cinfo,action) \ if (bytes_in_buffer == 0) { \ printf("filling...\n"); abort(); \ if (! (*datasrc->fill_input_buffer) (cinfo)) \ { action; } \ INPUT_RELOAD(cinfo); \ } /* Read a byte into variable V. * If must suspend, take the specified action (typically "return FALSE"). */ #define INPUT_BYTE(cinfo,V,action) \ MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \ bytes_in_buffer--; \ V = GETJOCTET(*next_input_byte++); ) /* As above, but read two bytes interpreted as an unsigned 16-bit integer. * V should be declared unsigned int or perhaps INT32. */ #define INPUT_2BYTES(cinfo,V,action) \ MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \ bytes_in_buffer--; \ V = ((unsigned int) GETJOCTET(*next_input_byte++)) << 8; \ MAKE_BYTE_AVAIL(cinfo,action); \ bytes_in_buffer--; \ V += GETJOCTET(*next_input_byte++); ) /* * Routines to process JPEG markers. * * Entry condition: JPEG marker itself has been read and its code saved * in cinfo->unread_marker; input restart point is just after the marker. * * Exit: if return TRUE, have read and processed any parameters, and have * updated the restart point to point after the parameters. * If return FALSE, was forced to suspend before reaching end of * marker parameters; restart point has not been moved. Same routine * will be called again after application supplies more input data. * * This approach to suspension assumes that all of a marker's parameters * can fit into a single input bufferload. This should hold for "normal" * markers. Some COM/APPn markers might have large parameter segments * that might not fit. If we are simply dropping such a marker, we use * skip_input_data to get past it, and thereby put the problem on the * source manager's shoulders. If we are saving the marker's contents * into memory, we use a slightly different convention: when forced to * suspend, the marker processor updates the restart point to the end of * what it's consumed (ie, the end of the buffer) before returning FALSE. * On resumption, cinfo->unread_marker still contains the marker code, * but the data source will point to the next chunk of marker data. * The marker processor must retain internal state to deal with this. * * Note that we don't bother to avoid duplicate trace messages if a * suspension occurs within marker parameters. Other side effects * require more care. */ LOCAL(boolean) get_soi (j_decompress_ptr cinfo) /* Process an SOI marker */ { int i; TRACEMS(cinfo, 1, JTRC_SOI); if (cinfo->marker->saw_SOI) ERREXIT(cinfo, JERR_SOI_DUPLICATE); /* Reset all parameters that are defined to be reset by SOI */ for (i = 0; i < NUM_ARITH_TBLS; i++) { cinfo->arith_dc_L[i] = 0; cinfo->arith_dc_U[i] = 1; cinfo->arith_ac_K[i] = 5; } cinfo->restart_interval = 0; /* Set initial assumptions for colorspace etc */ cinfo->jpeg_color_space = JCS_UNKNOWN; cinfo->CCIR601_sampling = FALSE; /* Assume non-CCIR sampling??? */ cinfo->saw_JFIF_marker = FALSE; cinfo->JFIF_major_version = 1; /* set default JFIF APP0 values */ cinfo->JFIF_minor_version = 1; cinfo->density_unit = 0; cinfo->X_density = 1; cinfo->Y_density = 1; cinfo->saw_Adobe_marker = FALSE; cinfo->Adobe_transform = 0; cinfo->marker->saw_SOI = TRUE; return TRUE; } LOCAL(boolean) get_sof (j_decompress_ptr cinfo, J_CODEC_PROCESS process, boolean is_arith, int data_unit) /* Process a SOFn marker */ { INT32 length; int c, ci; jpeg_component_info * compptr; INPUT_VARS(cinfo); cinfo->data_unit = data_unit; cinfo->process = process; cinfo->arith_code = is_arith; INPUT_2BYTES(cinfo, length, return FALSE); INPUT_BYTE(cinfo, cinfo->data_precision, return FALSE); INPUT_2BYTES(cinfo, cinfo->image_height, return FALSE); INPUT_2BYTES(cinfo, cinfo->image_width, return FALSE); INPUT_BYTE(cinfo, cinfo->num_components, return FALSE); length -= 8; TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker, (int) cinfo->image_width, (int) cinfo->image_height, cinfo->num_components); if (cinfo->marker->saw_SOF) ERREXIT(cinfo, JERR_SOF_DUPLICATE); /* We don't support files in which the image height is initially specified */ /* as 0 and is later redefined by DNL. As long as we have to check that, */ /* might as well have a general sanity check. */ if (cinfo->image_height <= 0 || cinfo->image_width <= 0 || cinfo->num_components <= 0) ERREXIT(cinfo, JERR_EMPTY_IMAGE); if (length != (cinfo->num_components * 3)) ERREXIT(cinfo, JERR_BAD_LENGTH); if (cinfo->comp_info == NULL) /* do only once, even if suspend */ cinfo->comp_info = (jpeg_component_info *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, cinfo->num_components * SIZEOF(jpeg_component_info)); for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { compptr->component_index = ci; INPUT_BYTE(cinfo, compptr->component_id, return FALSE); INPUT_BYTE(cinfo, c, return FALSE); compptr->h_samp_factor = (c >> 4) & 15; compptr->v_samp_factor = (c ) & 15; INPUT_BYTE(cinfo, compptr->quant_tbl_no, return FALSE); TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT, compptr->component_id, compptr->h_samp_factor, compptr->v_samp_factor, compptr->quant_tbl_no); } cinfo->marker->saw_SOF = TRUE; INPUT_SYNC(cinfo); return TRUE; } LOCAL(boolean) get_sos (j_decompress_ptr cinfo) /* Process a SOS marker */ { INT32 length; int i, ci, n, c, cc; jpeg_component_info * compptr; INPUT_VARS(cinfo); if (! cinfo->marker->saw_SOF) ERREXIT(cinfo, JERR_SOS_NO_SOF); INPUT_2BYTES(cinfo, length, return FALSE); INPUT_BYTE(cinfo, n, return FALSE); /* Number of components */ TRACEMS1(cinfo, 1, JTRC_SOS, n); if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN) ERREXIT(cinfo, JERR_BAD_LENGTH); cinfo->comps_in_scan = n; /* Collect the component-spec parameters */ for (i = 0; i < n; i++) { INPUT_BYTE(cinfo, cc, return FALSE); INPUT_BYTE(cinfo, c, return FALSE); for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { if (cc == compptr->component_id) goto id_found; } ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc); id_found: cinfo->cur_comp_info[i] = compptr; compptr->dc_tbl_no = (c >> 4) & 15; compptr->ac_tbl_no = (c ) & 15; TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc, compptr->dc_tbl_no, compptr->ac_tbl_no); } /* Collect the additional scan parameters Ss, Se, Ah/Al. */ INPUT_BYTE(cinfo, c, return FALSE); cinfo->Ss = c; INPUT_BYTE(cinfo, c, return FALSE); cinfo->Se = c; INPUT_BYTE(cinfo, c, return FALSE); cinfo->Ah = (c >> 4) & 15; cinfo->Al = (c ) & 15; TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al); /* Prepare to scan data & restart markers */ cinfo->marker->next_restart_num = 0; /* Count another SOS marker */ cinfo->input_scan_number++; INPUT_SYNC(cinfo); return TRUE; } #ifdef D_ARITH_CODING_SUPPORTED LOCAL(boolean) get_dac (j_decompress_ptr cinfo) /* Process a DAC marker */ { INT32 length; int index, val; INPUT_VARS(cinfo); INPUT_2BYTES(cinfo, length, return FALSE); length -= 2; while (length > 0) { INPUT_BYTE(cinfo, index, return FALSE); INPUT_BYTE(cinfo, val, return FALSE); length -= 2; TRACEMS2(cinfo, 1, JTRC_DAC, index, val); if (index < 0 || index >= (2*NUM_ARITH_TBLS)) ERREXIT1(cinfo, JERR_DAC_INDEX, index); if (index >= NUM_ARITH_TBLS) { /* define AC table */ cinfo->arith_ac_K[index-NUM_ARITH_TBLS] = (UINT8) val; } else { /* define DC table */ cinfo->arith_dc_L[index] = (UINT8) (val & 0x0F); cinfo->arith_dc_U[index] = (UINT8) (val >> 4); if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index]) ERREXIT1(cinfo, JERR_DAC_VALUE, val); } } if (length != 0) ERREXIT(cinfo, JERR_BAD_LENGTH); INPUT_SYNC(cinfo); return TRUE; } #else /* ! D_ARITH_CODING_SUPPORTED */ #define get_dac(cinfo) skip_variable(cinfo) #endif /* D_ARITH_CODING_SUPPORTED */ LOCAL(boolean) get_dht (j_decompress_ptr cinfo) /* Process a DHT marker */ { INT32 length; UINT8 bits[17]; UINT8 huffval[256]; int i, index, count; JHUFF_TBL **htblptr; INPUT_VARS(cinfo); INPUT_2BYTES(cinfo, length, return FALSE); length -= 2; while (length > 16) { INPUT_BYTE(cinfo, index, return FALSE); TRACEMS1(cinfo, 1, JTRC_DHT, index); bits[0] = 0; count = 0; for (i = 1; i <= 16; i++) { INPUT_BYTE(cinfo, bits[i], return FALSE); count += bits[i]; } length -= 1 + 16; TRACEMS8(cinfo, 2, JTRC_HUFFBITS, bits[1], bits[2], bits[3], bits[4], bits[5], bits[6], bits[7], bits[8]); TRACEMS8(cinfo, 2, JTRC_HUFFBITS, bits[9], bits[10], bits[11], bits[12], bits[13], bits[14], bits[15], bits[16]); /* Here we just do minimal validation of the counts to avoid walking * off the end of our table space. jdhuff.c will check more carefully. */ if (count > 256 || ((INT32) count) > length) ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); for (i = 0; i < count; i++) INPUT_BYTE(cinfo, huffval[i], return FALSE); length -= count; if (index & 0x10) { /* AC table definition */ index -= 0x10; htblptr = &cinfo->ac_huff_tbl_ptrs[index]; } else { /* DC table definition */ htblptr = &cinfo->dc_huff_tbl_ptrs[index]; } if (index < 0 || index >= NUM_HUFF_TBLS) ERREXIT1(cinfo, JERR_DHT_INDEX, index); if (*htblptr == NULL) *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits)); MEMCOPY((*htblptr)->huffval, huffval, SIZEOF((*htblptr)->huffval)); } if (length != 0) ERREXIT(cinfo, JERR_BAD_LENGTH); INPUT_SYNC(cinfo); return TRUE; } LOCAL(boolean) get_dqt (j_decompress_ptr cinfo) /* Process a DQT marker */ { INT32 length; int n, i, prec; unsigned int tmp; JQUANT_TBL *quant_ptr; INPUT_VARS(cinfo); INPUT_2BYTES(cinfo, length, return FALSE); length -= 2; while (length > 0) { INPUT_BYTE(cinfo, n, return FALSE); prec = n >> 4; n &= 0x0F; TRACEMS2(cinfo, 1, JTRC_DQT, n, prec); if (n >= NUM_QUANT_TBLS) ERREXIT1(cinfo, JERR_DQT_INDEX, n); if (cinfo->quant_tbl_ptrs[n] == NULL) cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr) cinfo); quant_ptr = cinfo->quant_tbl_ptrs[n]; for (i = 0; i < DCTSIZE2; i++) { if (prec) INPUT_2BYTES(cinfo, tmp, return FALSE); else INPUT_BYTE(cinfo, tmp, return FALSE); /* We convert the zigzag-order table to natural array order. */ quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16) tmp; } if (cinfo->err->trace_level >= 2) { for (i = 0; i < DCTSIZE2; i += 8) { TRACEMS8(cinfo, 2, JTRC_QUANTVALS, quant_ptr->quantval[i], quant_ptr->quantval[i+1], quant_ptr->quantval[i+2], quant_ptr->quantval[i+3], quant_ptr->quantval[i+4], quant_ptr->quantval[i+5], quant_ptr->quantval[i+6], quant_ptr->quantval[i+7]); } } length -= DCTSIZE2+1; if (prec) length -= DCTSIZE2; } if (length != 0) ERREXIT(cinfo, JERR_BAD_LENGTH); INPUT_SYNC(cinfo); return TRUE; } LOCAL(boolean) get_dri (j_decompress_ptr cinfo) /* Process a DRI marker */ { INT32 length; unsigned int tmp; INPUT_VARS(cinfo); INPUT_2BYTES(cinfo, length, return FALSE); if (length != 4) ERREXIT(cinfo, JERR_BAD_LENGTH); INPUT_2BYTES(cinfo, tmp, return FALSE); TRACEMS1(cinfo, 1, JTRC_DRI, tmp); cinfo->restart_interval = tmp; INPUT_SYNC(cinfo); return TRUE; } /* * Routines for processing APPn and COM markers. * These are either saved in memory or discarded, per application request. * APP0 and APP14 are specially checked to see if they are * JFIF and Adobe markers, respectively. */ #define APP0_DATA_LEN 14 /* Length of interesting data in APP0 */ #define APP14_DATA_LEN 12 /* Length of interesting data in APP14 */ #define APPN_DATA_LEN 14 /* Must be the largest of the above!! */ LOCAL(void) examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data, unsigned int datalen, INT32 remaining) /* Examine first few bytes from an APP0. * Take appropriate action if it is a JFIF marker. * datalen is # of bytes at data[], remaining is length of rest of marker data. */ { INT32 totallen = (INT32) datalen + remaining; if (datalen >= APP0_DATA_LEN && GETJOCTET(data[0]) == 0x4A && GETJOCTET(data[1]) == 0x46 && GETJOCTET(data[2]) == 0x49 && GETJOCTET(data[3]) == 0x46 && GETJOCTET(data[4]) == 0) { /* Found JFIF APP0 marker: save info */ cinfo->saw_JFIF_marker = TRUE; cinfo->JFIF_major_version = GETJOCTET(data[5]); cinfo->JFIF_minor_version = GETJOCTET(data[6]); cinfo->density_unit = GETJOCTET(data[7]); cinfo->X_density = (GETJOCTET(data[8]) << 8) + GETJOCTET(data[9]); cinfo->Y_density = (GETJOCTET(data[10]) << 8) + GETJOCTET(data[11]); /* Check version. * Major version must be 1, anything else signals an incompatible change. * (We used to treat this as an error, but now it's a nonfatal warning, * because some bozo at Hijaak couldn't read the spec.) * Minor version should be 0..2, but process anyway if newer. */ if (cinfo->JFIF_major_version != 1) WARNMS2(cinfo, JWRN_JFIF_MAJOR, cinfo->JFIF_major_version, cinfo->JFIF_minor_version); /* Generate trace messages */ TRACEMS5(cinfo, 1, JTRC_JFIF, cinfo->JFIF_major_version, cinfo->JFIF_minor_version, cinfo->X_density, cinfo->Y_density, cinfo->density_unit); /* Validate thumbnail dimensions and issue appropriate messages */ if (GETJOCTET(data[12]) | GETJOCTET(data[13])) TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, GETJOCTET(data[12]), GETJOCTET(data[13])); totallen -= APP0_DATA_LEN; if (totallen != ((INT32)GETJOCTET(data[12]) * (INT32)GETJOCTET(data[13]) * (INT32) 3)) TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int) totallen); } else if (datalen >= 6 && GETJOCTET(data[0]) == 0x4A && GETJOCTET(data[1]) == 0x46 && GETJOCTET(data[2]) == 0x58 && GETJOCTET(data[3]) == 0x58 && GETJOCTET(data[4]) == 0) { /* Found JFIF "JFXX" extension APP0 marker */ /* The library doesn't actually do anything with these, * but we try to produce a helpful trace message. */ switch (GETJOCTET(data[5])) { case 0x10: TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, (int) totallen); break; case 0x11: TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, (int) totallen); break; case 0x13: TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, (int) totallen); break; default: TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION, GETJOCTET(data[5]), (int) totallen); break; } } else { /* Start of APP0 does not match "JFIF" or "JFXX", or too short */ TRACEMS1(cinfo, 1, JTRC_APP0, (int) totallen); } } LOCAL(void) examine_app14 (j_decompress_ptr cinfo, JOCTET FAR * data, unsigned int datalen, INT32 remaining) /* Examine first few bytes from an APP14. * Take appropriate action if it is an Adobe marker. * datalen is # of bytes at data[], remaining is length of rest of marker data. */ { unsigned int version, flags0, flags1, transform; if (datalen >= APP14_DATA_LEN && GETJOCTET(data[0]) == 0x41 && GETJOCTET(data[1]) == 0x64 && GETJOCTET(data[2]) == 0x6F && GETJOCTET(data[3]) == 0x62 && GETJOCTET(data[4]) == 0x65) { /* Found Adobe APP14 marker */ version = (GETJOCTET(data[5]) << 8) + GETJOCTET(data[6]); flags0 = (GETJOCTET(data[7]) << 8) + GETJOCTET(data[8]); flags1 = (GETJOCTET(data[9]) << 8) + GETJOCTET(data[10]); transform = GETJOCTET(data[11]); TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform); cinfo->saw_Adobe_marker = TRUE; cinfo->Adobe_transform = (UINT8) transform; } else { /* Start of APP14 does not match "Adobe", or too short */ TRACEMS1(cinfo, 1, JTRC_APP14, (int) (datalen + remaining)); } } METHODDEF(boolean) get_interesting_appn (j_decompress_ptr cinfo) /* Process an APP0 or APP14 marker without saving it */ { INT32 length; JOCTET b[APPN_DATA_LEN]; unsigned int i, numtoread; INPUT_VARS(cinfo); INPUT_2BYTES(cinfo, length, return FALSE); length -= 2; /* get the interesting part of the marker data */ if (length >= APPN_DATA_LEN) numtoread = APPN_DATA_LEN; else if (length > 0) numtoread = (unsigned int) length; else numtoread = 0; for (i = 0; i < numtoread; i++) INPUT_BYTE(cinfo, b[i], return FALSE); length -= numtoread; /* process it */ switch (cinfo->unread_marker) { case M_APP0: examine_app0(cinfo, (JOCTET FAR *) b, numtoread, length); break; case M_APP14: examine_app14(cinfo, (JOCTET FAR *) b, numtoread, length); break; default: /* can't get here unless jpeg_save_markers chooses wrong processor */ ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker); break; } /* skip any remaining data -- could be lots */ INPUT_SYNC(cinfo); if (length > 0) (*cinfo->src->skip_input_data) (cinfo, (long) length); return TRUE; } #ifdef SAVE_MARKERS_SUPPORTED METHODDEF(boolean) save_marker (j_decompress_ptr cinfo) /* Save an APPn or COM marker into the marker list */ { my_marker_ptr marker = (my_marker_ptr) cinfo->marker; jpeg_saved_marker_ptr cur_marker = marker->cur_marker; unsigned int bytes_read, data_length; JOCTET FAR * data; INT32 length = 0; INPUT_VARS(cinfo); if (cur_marker == NULL) { /* begin reading a marker */ INPUT_2BYTES(cinfo, length, return FALSE); length -= 2; if (length >= 0) { /* watch out for bogus length word */ /* figure out how much we want to save */ unsigned int limit; if (cinfo->unread_marker == (int) M_COM) limit = marker->length_limit_COM; else limit = marker->length_limit_APPn[cinfo->unread_marker - (int) M_APP0]; if ((unsigned int) length < limit) limit = (unsigned int) length; /* allocate and initialize the marker item */ cur_marker = (jpeg_saved_marker_ptr) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(struct jpeg_marker_struct) + limit); cur_marker->next = NULL; cur_marker->marker = (UINT8) cinfo->unread_marker; cur_marker->original_length = (unsigned int) length; cur_marker->data_length = limit; /* data area is just beyond the jpeg_marker_struct */ data = cur_marker->data = (JOCTET FAR *) (cur_marker + 1); marker->cur_marker = cur_marker; marker->bytes_read = 0; bytes_read = 0; data_length = limit; } else { /* deal with bogus length word */ bytes_read = data_length = 0; data = NULL; } } else { /* resume reading a marker */ bytes_read = marker->bytes_read; data_length = cur_marker->data_length; data = cur_marker->data + bytes_read; } while (bytes_read < data_length) { INPUT_SYNC(cinfo); /* move the restart point to here */ marker->bytes_read = bytes_read; /* If there's not at least one byte in buffer, suspend */ MAKE_BYTE_AVAIL(cinfo, return FALSE); /* Copy bytes with reasonable rapidity */ while (bytes_read < data_length && bytes_in_buffer > 0) { *data++ = *next_input_byte++; bytes_in_buffer--; bytes_read++; } } /* Done reading what we want to read */ if (cur_marker != NULL) { /* will be NULL if bogus length word */ /* Add new marker to end of list */ if (cinfo->marker_list == NULL) { cinfo->marker_list = cur_marker; } else { jpeg_saved_marker_ptr prev = cinfo->marker_list; while (prev->next != NULL) prev = prev->next; prev->next = cur_marker; } /* Reset pointer & calc remaining data length */ data = cur_marker->data; length = cur_marker->original_length - data_length; } /* Reset to initial state for next marker */ marker->cur_marker = NULL; /* Process the marker if interesting; else just make a generic trace msg */ switch (cinfo->unread_marker) { case M_APP0: examine_app0(cinfo, data, data_length, length); break; case M_APP14: examine_app14(cinfo, data, data_length, length); break; default: TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int) (data_length + length)); break; } /* skip any remaining data -- could be lots */ INPUT_SYNC(cinfo); /* do before skip_input_data */ if (length > 0) (*cinfo->src->skip_input_data) (cinfo, (long) length); return TRUE; } #endif /* SAVE_MARKERS_SUPPORTED */ METHODDEF(boolean) skip_variable (j_decompress_ptr cinfo) /* Skip over an unknown or uninteresting variable-length marker */ { INT32 length; INPUT_VARS(cinfo); INPUT_2BYTES(cinfo, length, return FALSE); length -= 2; TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int) length); INPUT_SYNC(cinfo); /* do before skip_input_data */ if (length > 0) (*cinfo->src->skip_input_data) (cinfo, (long) length); return TRUE; } /* * Find the next JPEG marker, save it in cinfo->unread_marker. * Returns FALSE if had to suspend before reaching a marker; * in that case cinfo->unread_marker is unchanged. * * Note that the result might not be a valid marker code, * but it will never be 0 or FF. */ LOCAL(boolean) next_marker (j_decompress_ptr cinfo) { int c; INPUT_VARS(cinfo); for (;;) { INPUT_BYTE(cinfo, c, return FALSE); /* Skip any non-FF bytes. * This may look a bit inefficient, but it will not occur in a valid file. * We sync after each discarded byte so that a suspending data source * can discard the byte from its buffer. */ while (c != 0xFF) { cinfo->marker->discarded_bytes++; INPUT_SYNC(cinfo); INPUT_BYTE(cinfo, c, return FALSE); } /* This loop swallows any duplicate FF bytes. Extra FFs are legal as * pad bytes, so don't count them in discarded_bytes. We assume there * will not be so many consecutive FF bytes as to overflow a suspending * data source's input buffer. */ do { INPUT_BYTE(cinfo, c, return FALSE); } while (c == 0xFF); if (c != 0) break; /* found a valid marker, exit loop */ /* Reach here if we found a stuffed-zero data sequence (FF/00). * Discard it and loop back to try again. */ cinfo->marker->discarded_bytes += 2; INPUT_SYNC(cinfo); } if (cinfo->marker->discarded_bytes != 0) { WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c); cinfo->marker->discarded_bytes = 0; } cinfo->unread_marker = c; INPUT_SYNC(cinfo); return TRUE; } LOCAL(boolean) first_marker (j_decompress_ptr cinfo) /* Like next_marker, but used to obtain the initial SOI marker. */ /* For this marker, we do not allow preceding garbage or fill; otherwise, * we might well scan an entire input file before realizing it ain't JPEG. * If an application wants to process non-JFIF files, it must seek to the * SOI before calling the JPEG library. */ { int c=-1, c2=-1; INPUT_VARS(cinfo); INPUT_BYTE(cinfo, c, return FALSE); INPUT_BYTE(cinfo, c2, return FALSE); if (c != 0xFF || c2 != (int) M_SOI) { ERREXIT2(cinfo, JERR_NO_SOI, c, c2); return FALSE; } cinfo->unread_marker = c2; INPUT_SYNC(cinfo); return TRUE; } /* * Read markers until SOS or EOI. * * Returns same codes as are defined for jpeg_consume_input: * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI. */ METHODDEF(int) read_markers (j_decompress_ptr cinfo) { /* Outer loop repeats once for each marker. */ for (;;) { /* Collect the marker proper, unless we already did. */ /* NB: first_marker() enforces the requirement that SOI appear first. */ if (cinfo->unread_marker == 0) { if (! cinfo->marker->saw_SOI) { if (! first_marker(cinfo)) return JPEG_SUSPENDED; } else { if (! next_marker(cinfo)) return JPEG_SUSPENDED; } } /* At this point cinfo->unread_marker contains the marker code and the * input point is just past the marker proper, but before any parameters. * A suspension will cause us to return with this state still true. */ switch (cinfo->unread_marker) { case M_SOI: if (! get_soi(cinfo)) return JPEG_SUSPENDED; break; case M_SOF0: /* Baseline */ case M_SOF1: /* Extended sequential, Huffman */ if (! get_sof(cinfo, JPROC_SEQUENTIAL, FALSE, DCTSIZE)) return JPEG_SUSPENDED; break; case M_SOF2: /* Progressive, Huffman */ if (! get_sof(cinfo, JPROC_PROGRESSIVE, FALSE, DCTSIZE)) return JPEG_SUSPENDED; break; case M_SOF3: /* Lossless, Huffman */ if (! get_sof(cinfo, JPROC_LOSSLESS, FALSE, 1)) return JPEG_SUSPENDED; break; case M_SOF9: /* Extended sequential, arithmetic */ if (! get_sof(cinfo, JPROC_SEQUENTIAL, TRUE, DCTSIZE)) return JPEG_SUSPENDED; break; case M_SOF10: /* Progressive, arithmetic */ if (! get_sof(cinfo, JPROC_PROGRESSIVE, TRUE, DCTSIZE)) return JPEG_SUSPENDED; break; case M_SOF11: /* Lossless, arithmetic */ if (! get_sof(cinfo, JPROC_LOSSLESS, TRUE, 1)) return JPEG_SUSPENDED; break; /* Currently unsupported SOFn types */ case M_SOF5: /* Differential sequential, Huffman */ case M_SOF6: /* Differential progressive, Huffman */ case M_SOF7: /* Differential lossless, Huffman */ case M_JPG: /* Reserved for JPEG extensions */ case M_SOF13: /* Differential sequential, arithmetic */ case M_SOF14: /* Differential progressive, arithmetic */ case M_SOF15: /* Differential lossless, arithmetic */ ERREXIT1(cinfo, JERR_SOF_UNSUPPORTED, cinfo->unread_marker); break; case M_SOS: if (! get_sos(cinfo)) return JPEG_SUSPENDED; cinfo->unread_marker = 0; /* processed the marker */ return JPEG_REACHED_SOS; case M_EOI: TRACEMS(cinfo, 1, JTRC_EOI); cinfo->unread_marker = 0; /* processed the marker */ return JPEG_REACHED_EOI; case M_DAC: if (! get_dac(cinfo)) return JPEG_SUSPENDED; break; case M_DHT: if (! get_dht(cinfo)) return JPEG_SUSPENDED; break; case M_DQT: if (! get_dqt(cinfo)) return JPEG_SUSPENDED; break; case M_DRI: if (! get_dri(cinfo)) return JPEG_SUSPENDED; break; case M_APP0: case M_APP1: case M_APP2: case M_APP3: case M_APP4: case M_APP5: case M_APP6: case M_APP7: case M_APP8: case M_APP9: case M_APP10: case M_APP11: case M_APP12: case M_APP13: case M_APP14: case M_APP15: if (! (*((my_marker_ptr) cinfo->marker)->process_APPn[ cinfo->unread_marker - (int) M_APP0]) (cinfo)) return JPEG_SUSPENDED; break; case M_COM: if (! (*((my_marker_ptr) cinfo->marker)->process_COM) (cinfo)) return JPEG_SUSPENDED; break; case M_RST0: /* these are all parameterless */ case M_RST1: case M_RST2: case M_RST3: case M_RST4: case M_RST5: case M_RST6: case M_RST7: case M_TEM: TRACEMS1(cinfo, 1, JTRC_PARMLESS_MARKER, cinfo->unread_marker); break; case M_DNL: /* Ignore DNL ... perhaps the wrong thing */ if (! skip_variable(cinfo)) return JPEG_SUSPENDED; break; default: /* must be DHP, EXP, JPGn, or RESn */ /* For now, we treat the reserved markers as fatal errors since they are * likely to be used to signal incompatible JPEG Part 3 extensions. * Once the JPEG 3 version-number marker is well defined, this code * ought to change! */ ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker); break; } /* Successfully processed marker, so reset state variable */ cinfo->unread_marker = 0; } /* end loop */ } /* * Read a restart marker, which is expected to appear next in the datastream; * if the marker is not there, take appropriate recovery action. * Returns FALSE if suspension is required. * * This is called by the entropy decoder after it has read an appropriate * number of MCUs. cinfo->unread_marker may be nonzero if the entropy decoder * has already read a marker from the data source. Under normal conditions * cinfo->unread_marker will be reset to 0 before returning; if not reset, * it holds a marker which the decoder will be unable to read past. */ METHODDEF(boolean) read_restart_marker (j_decompress_ptr cinfo) { /* Obtain a marker unless we already did. */ /* Note that next_marker will complain if it skips any data. */ if (cinfo->unread_marker == 0) { if (! next_marker(cinfo)) return FALSE; } if (cinfo->unread_marker == ((int) M_RST0 + cinfo->marker->next_restart_num)) { /* Normal case --- swallow the marker and let entropy decoder continue */ TRACEMS1(cinfo, 3, JTRC_RST, cinfo->marker->next_restart_num); cinfo->unread_marker = 0; } else { /* Uh-oh, the restart markers have been messed up. */ /* Let the data source manager determine how to resync. */ if (! (*cinfo->src->resync_to_restart) (cinfo, cinfo->marker->next_restart_num)) return FALSE; } /* Update next-restart state */ cinfo->marker->next_restart_num = (cinfo->marker->next_restart_num + 1) & 7; return TRUE; } /* * This is the default resync_to_restart method for data source managers * to use if they don't have any better approach. Some data source managers * may be able to back up, or may have additional knowledge about the data * which permits a more intelligent recovery strategy; such managers would * presumably supply their own resync method. * * read_restart_marker calls resync_to_restart if it finds a marker other than * the restart marker it was expecting. (This code is *not* used unless * a nonzero restart interval has been declared.) cinfo->unread_marker is * the marker code actually found (might be anything, except 0 or FF). * The desired restart marker number (0..7) is passed as a parameter. * This routine is supposed to apply whatever error recovery strategy seems * appropriate in order to position the input stream to the next data segment. * Note that cinfo->unread_marker is treated as a marker appearing before * the current data-source input point; usually it should be reset to zero * before returning. * Returns FALSE if suspension is required. * * This implementation is substantially constrained by wanting to treat the * input as a data stream; this means we can't back up. Therefore, we have * only the following actions to work with: * 1. Simply discard the marker and let the entropy decoder resume at next * byte of file. * 2. Read forward until we find another marker, discarding intervening * data. (In theory we could look ahead within the current bufferload, * without having to discard data if we don't find the desired marker. * This idea is not implemented here, in part because it makes behavior * dependent on buffer size and chance buffer-boundary positions.) * 3. Leave the marker unread (by failing to zero cinfo->unread_marker). * This will cause the entropy decoder to process an empty data segment, * inserting dummy zeroes, and then we will reprocess the marker. * * #2 is appropriate if we think the desired marker lies ahead, while #3 is * appropriate if the found marker is a future restart marker (indicating * that we have missed the desired restart marker, probably because it got * corrupted). * We apply #2 or #3 if the found marker is a restart marker no more than * two counts behind or ahead of the expected one. We also apply #2 if the * found marker is not a legal JPEG marker code (it's certainly bogus data). * If the found marker is a restart marker more than 2 counts away, we do #1 * (too much risk that the marker is erroneous; with luck we will be able to * resync at some future point). * For any valid non-restart JPEG marker, we apply #3. This keeps us from * overrunning the end of a scan. An implementation limited to single-scan * files might find it better to apply #2 for markers other than EOI, since * any other marker would have to be bogus data in that case. */ GLOBAL(boolean) jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired) { int marker = cinfo->unread_marker; int action = 1; /* Always put up a warning. */ WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired); /* Outer loop handles repeated decision after scanning forward. */ for (;;) { if (marker < (int) M_SOF0) action = 2; /* invalid marker */ else if (marker < (int) M_RST0 || marker > (int) M_RST7) action = 3; /* valid non-restart marker */ else { if (marker == ((int) M_RST0 + ((desired+1) & 7)) || marker == ((int) M_RST0 + ((desired+2) & 7))) action = 3; /* one of the next two expected restarts */ else if (marker == ((int) M_RST0 + ((desired-1) & 7)) || marker == ((int) M_RST0 + ((desired-2) & 7))) action = 2; /* a prior restart, so advance */ else action = 1; /* desired restart or too far away */ } TRACEMS2(cinfo, 4, JTRC_RECOVERY_ACTION, marker, action); switch (action) { case 1: /* Discard marker and let entropy decoder resume processing. */ cinfo->unread_marker = 0; return TRUE; case 2: /* Scan to the next marker, and repeat the decision loop. */ if (! next_marker(cinfo)) return FALSE; marker = cinfo->unread_marker; break; case 3: /* Return without advancing past this marker. */ /* Entropy decoder will be forced to process an empty segment. */ return TRUE; } } /* end loop */ } /* * Reset marker processing state to begin a fresh datastream. */ METHODDEF(void) reset_marker_reader (j_decompress_ptr cinfo) { my_marker_ptr marker = (my_marker_ptr) cinfo->marker; cinfo->comp_info = NULL; /* until allocated by get_sof */ cinfo->input_scan_number = 0; /* no SOS seen yet */ cinfo->unread_marker = 0; /* no pending marker */ marker->pub.saw_SOI = FALSE; /* set internal state too */ marker->pub.saw_SOF = FALSE; marker->pub.discarded_bytes = 0; marker->cur_marker = NULL; } /* * Initialize the marker reader module. * This is called only once, when the decompression object is created. */ GLOBAL(void) jinit_marker_reader (j_decompress_ptr cinfo) { my_marker_ptr marker; int i; /* Create subobject in permanent pool */ marker = (my_marker_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, SIZEOF(my_marker_reader)); cinfo->marker = (struct jpeg_marker_reader *) marker; /* Initialize public method pointers */ marker->pub.reset_marker_reader = reset_marker_reader; marker->pub.read_markers = read_markers; marker->pub.read_restart_marker = read_restart_marker; /* Initialize COM/APPn processing. * By default, we examine and then discard APP0 and APP14, * but simply discard COM and all other APPn. */ marker->process_COM = skip_variable; marker->length_limit_COM = 0; for (i = 0; i < 16; i++) { marker->process_APPn[i] = skip_variable; marker->length_limit_APPn[i] = 0; } marker->process_APPn[0] = get_interesting_appn; marker->process_APPn[14] = get_interesting_appn; /* Reset marker processing state */ reset_marker_reader(cinfo); } /* * Control saving of COM and APPn markers into marker_list. */ #ifdef SAVE_MARKERS_SUPPORTED GLOBAL(void) jpeg_save_markers (j_decompress_ptr cinfo, int marker_code, unsigned int length_limit) { my_marker_ptr marker = (my_marker_ptr) cinfo->marker; long maxlength; jpeg_marker_parser_method processor; /* Length limit mustn't be larger than what we can allocate * (should only be a concern in a 16-bit environment). */ maxlength = cinfo->mem->max_alloc_chunk - SIZEOF(struct jpeg_marker_struct); if (((long) length_limit) > maxlength) length_limit = (unsigned int) maxlength; /* Choose processor routine to use. * APP0/APP14 have special requirements. */ if (length_limit) { processor = save_marker; /* If saving APP0/APP14, save at least enough for our internal use. */ if (marker_code == (int) M_APP0 && length_limit < APP0_DATA_LEN) length_limit = APP0_DATA_LEN; else if (marker_code == (int) M_APP14 && length_limit < APP14_DATA_LEN) length_limit = APP14_DATA_LEN; } else { processor = skip_variable; /* If discarding APP0/APP14, use our regular on-the-fly processor. */ if (marker_code == (int) M_APP0 || marker_code == (int) M_APP14) processor = get_interesting_appn; } if (marker_code == (int) M_COM) { marker->process_COM = processor; marker->length_limit_COM = length_limit; } else if (marker_code >= (int) M_APP0 && marker_code <= (int) M_APP15) { marker->process_APPn[marker_code - (int) M_APP0] = processor; marker->length_limit_APPn[marker_code - (int) M_APP0] = length_limit; } else ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, marker_code); } #endif /* SAVE_MARKERS_SUPPORTED */ /* * Install a special processing method for COM or APPn markers. */ GLOBAL(void) jpeg_set_marker_processor (j_decompress_ptr cinfo, int marker_code, jpeg_marker_parser_method routine) { my_marker_ptr marker = (my_marker_ptr) cinfo->marker; if (marker_code == (int) M_COM) marker->process_COM = routine; else if (marker_code >= (int) M_APP0 && marker_code <= (int) M_APP15) marker->process_APPn[marker_code - (int) M_APP0] = routine; else ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, marker_code); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jfdctflt.c�����������������������������������������������0000644�0001750�0001750�00000012556�12320456500�021775� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jfdctflt.c * * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains a floating-point implementation of the * forward DCT (Discrete Cosine Transform). * * This implementation should be more accurate than either of the integer * DCT implementations. However, it may not give the same results on all * machines because of differences in roundoff behavior. Speed will depend * on the hardware's floating point capacity. * * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT * on each column. Direct algorithms are also available, but they are * much more complex and seem not to be any faster when reduced to code. * * This implementation is based on Arai, Agui, and Nakajima's algorithm for * scaled DCT. Their original paper (Trans. IEICE E-71(11):1095) is in * Japanese, but the algorithm is described in the Pennebaker & Mitchell * JPEG textbook (see REFERENCES section in file README). The following code * is based directly on figure 4-8 in P&M. * While an 8-point DCT cannot be done in less than 11 multiplies, it is * possible to arrange the computation so that many of the multiplies are * simple scalings of the final outputs. These multiplies can then be * folded into the multiplications or divisions by the JPEG quantization * table entries. The AA&N method leaves only 5 multiplies and 29 adds * to be done in the DCT itself. * The primary disadvantage of this method is that with a fixed-point * implementation, accuracy is lost due to imprecise representation of the * scaled quantization values. However, that problem does not arise if * we use floating point arithmetic. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jdct.h" /* Private declarations for DCT subsystem */ #ifdef DCT_FLOAT_SUPPORTED /* * This module is specialized to the case DCTSIZE = 8. */ #if DCTSIZE != 8 Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ #endif /* * Perform the forward DCT on one block of samples. */ GLOBAL(void) jpeg_fdct_float (FAST_FLOAT * data) { FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; FAST_FLOAT tmp10, tmp11, tmp12, tmp13; FAST_FLOAT z1, z2, z3, z4, z5, z11, z13; FAST_FLOAT *dataptr; int ctr; /* Pass 1: process rows. */ dataptr = data; for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { tmp0 = dataptr[0] + dataptr[7]; tmp7 = dataptr[0] - dataptr[7]; tmp1 = dataptr[1] + dataptr[6]; tmp6 = dataptr[1] - dataptr[6]; tmp2 = dataptr[2] + dataptr[5]; tmp5 = dataptr[2] - dataptr[5]; tmp3 = dataptr[3] + dataptr[4]; tmp4 = dataptr[3] - dataptr[4]; /* Even part */ tmp10 = tmp0 + tmp3; /* phase 2 */ tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; dataptr[0] = tmp10 + tmp11; /* phase 3 */ dataptr[4] = tmp10 - tmp11; z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */ dataptr[2] = tmp13 + z1; /* phase 5 */ dataptr[6] = tmp13 - z1; /* Odd part */ tmp10 = tmp4 + tmp5; /* phase 2 */ tmp11 = tmp5 + tmp6; tmp12 = tmp6 + tmp7; /* The rotator is modified from fig 4-8 to avoid extra negations. */ z5 = (tmp10 - tmp12) * ((FAST_FLOAT) 0.382683433); /* c6 */ z2 = ((FAST_FLOAT) 0.541196100) * tmp10 + z5; /* c2-c6 */ z4 = ((FAST_FLOAT) 1.306562965) * tmp12 + z5; /* c2+c6 */ z3 = tmp11 * ((FAST_FLOAT) 0.707106781); /* c4 */ z11 = tmp7 + z3; /* phase 5 */ z13 = tmp7 - z3; dataptr[5] = z13 + z2; /* phase 6 */ dataptr[3] = z13 - z2; dataptr[1] = z11 + z4; dataptr[7] = z11 - z4; dataptr += DCTSIZE; /* advance pointer to next row */ } /* Pass 2: process columns. */ dataptr = data; for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7]; tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7]; tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6]; tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6]; tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5]; tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; /* Even part */ tmp10 = tmp0 + tmp3; /* phase 2 */ tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */ dataptr[DCTSIZE*4] = tmp10 - tmp11; z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */ dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */ dataptr[DCTSIZE*6] = tmp13 - z1; /* Odd part */ tmp10 = tmp4 + tmp5; /* phase 2 */ tmp11 = tmp5 + tmp6; tmp12 = tmp6 + tmp7; /* The rotator is modified from fig 4-8 to avoid extra negations. */ z5 = (tmp10 - tmp12) * ((FAST_FLOAT) 0.382683433); /* c6 */ z2 = ((FAST_FLOAT) 0.541196100) * tmp10 + z5; /* c2-c6 */ z4 = ((FAST_FLOAT) 1.306562965) * tmp12 + z5; /* c2+c6 */ z3 = tmp11 * ((FAST_FLOAT) 0.707106781); /* c4 */ z11 = tmp7 + z3; /* phase 5 */ z13 = tmp7 - z3; dataptr[DCTSIZE*5] = z13 + z2; /* phase 6 */ dataptr[DCTSIZE*3] = z13 - z2; dataptr[DCTSIZE*1] = z11 + z4; dataptr[DCTSIZE*7] = z11 - z4; dataptr++; /* advance pointer to next column */ } } #endif /* DCT_FLOAT_SUPPORTED */ ��������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jctrans.c������������������������������������������������0000644�0001750�0001750�00000035355�12320456500�021643� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jctrans.c * * Copyright (C) 1995-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains library routines for transcoding compression, * that is, writing raw DCT coefficient arrays to an output JPEG file. * The routines in jcapimin.c will also be needed by a transcoder. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossy.h" /* Private declarations for lossy codec */ /* Forward declarations */ LOCAL(void) transencode_master_selection JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)); LOCAL(void) transencode_codec JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)); LOCAL(void) transencode_coef_controller JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)); /* * Compression initialization for writing raw-coefficient data. * Before calling this, all parameters and a data destination must be set up. * Call jpeg_finish_compress() to actually write the data. * * The number of passed virtual arrays must match cinfo->num_components. * Note that the virtual arrays need not be filled or even realized at * the time write_coefficients is called; indeed, if the virtual arrays * were requested from this compression object's memory manager, they * typically will be realized during this routine and filled afterwards. */ GLOBAL(void) jpeg_write_coefficients (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays) { if (cinfo->global_state != CSTATE_START) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); /* Mark all tables to be written */ jpeg_suppress_tables(cinfo, FALSE); /* (Re)initialize error mgr and destination modules */ (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo); (*cinfo->dest->init_destination) (cinfo); /* Perform master selection of active modules */ transencode_master_selection(cinfo, coef_arrays); /* Wait for jpeg_finish_compress() call */ cinfo->next_scanline = 0; /* so jpeg_write_marker works */ cinfo->global_state = CSTATE_WRCOEFS; } /* * Initialize the compression object with default parameters, * then copy from the source object all parameters needed for lossless * transcoding. Parameters that can be varied without loss (such as * scan script and Huffman optimization) are left in their default states. */ GLOBAL(void) jpeg_copy_critical_parameters (j_decompress_ptr srcinfo, j_compress_ptr dstinfo) { JQUANT_TBL ** qtblptr; jpeg_component_info *incomp, *outcomp; JQUANT_TBL *c_quant, *slot_quant; int tblno, ci, coefi; /* Safety check to ensure start_compress not called yet. */ if (dstinfo->global_state != CSTATE_START) ERREXIT1(dstinfo, JERR_BAD_STATE, dstinfo->global_state); /* Copy fundamental image dimensions */ dstinfo->image_width = srcinfo->image_width; dstinfo->image_height = srcinfo->image_height; dstinfo->input_components = srcinfo->num_components; dstinfo->in_color_space = srcinfo->jpeg_color_space; /* Initialize all parameters to default values */ jpeg_set_defaults(dstinfo); /* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB. * Fix it to get the right header markers for the image colorspace. */ jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space); dstinfo->data_precision = srcinfo->data_precision; dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling; /* Copy the source's quantization tables. */ for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) { if (srcinfo->quant_tbl_ptrs[tblno] != NULL) { qtblptr = & dstinfo->quant_tbl_ptrs[tblno]; if (*qtblptr == NULL) *qtblptr = jpeg_alloc_quant_table((j_common_ptr) dstinfo); MEMCOPY((*qtblptr)->quantval, srcinfo->quant_tbl_ptrs[tblno]->quantval, SIZEOF((*qtblptr)->quantval)); (*qtblptr)->sent_table = FALSE; } } /* Copy the source's per-component info. * Note we assume jpeg_set_defaults has allocated the dest comp_info array. */ dstinfo->num_components = srcinfo->num_components; if (dstinfo->num_components < 1 || dstinfo->num_components > MAX_COMPONENTS) ERREXIT2(dstinfo, JERR_COMPONENT_COUNT, dstinfo->num_components, MAX_COMPONENTS); for (ci = 0, incomp = srcinfo->comp_info, outcomp = dstinfo->comp_info; ci < dstinfo->num_components; ci++, incomp++, outcomp++) { outcomp->component_id = incomp->component_id; outcomp->h_samp_factor = incomp->h_samp_factor; outcomp->v_samp_factor = incomp->v_samp_factor; outcomp->quant_tbl_no = incomp->quant_tbl_no; /* Make sure saved quantization table for component matches the qtable * slot. If not, the input file re-used this qtable slot. * IJG encoder currently cannot duplicate this. */ tblno = outcomp->quant_tbl_no; if (tblno < 0 || tblno >= NUM_QUANT_TBLS || srcinfo->quant_tbl_ptrs[tblno] == NULL) ERREXIT1(dstinfo, JERR_NO_QUANT_TABLE, tblno); slot_quant = srcinfo->quant_tbl_ptrs[tblno]; c_quant = incomp->quant_table; if (c_quant != NULL) { for (coefi = 0; coefi < DCTSIZE2; coefi++) { if (c_quant->quantval[coefi] != slot_quant->quantval[coefi]) ERREXIT1(dstinfo, JERR_MISMATCHED_QUANT_TABLE, tblno); } } /* Note: we do not copy the source's Huffman table assignments; * instead we rely on jpeg_set_colorspace to have made a suitable choice. */ } /* Also copy JFIF version and resolution information, if available. * Strictly speaking this isn't "critical" info, but it's nearly * always appropriate to copy it if available. In particular, * if the application chooses to copy JFIF 1.02 extension markers from * the source file, we need to copy the version to make sure we don't * emit a file that has 1.02 extensions but a claimed version of 1.01. * We will *not*, however, copy version info from mislabeled "2.01" files. */ if (srcinfo->saw_JFIF_marker) { if (srcinfo->JFIF_major_version == 1) { dstinfo->JFIF_major_version = srcinfo->JFIF_major_version; dstinfo->JFIF_minor_version = srcinfo->JFIF_minor_version; } dstinfo->density_unit = srcinfo->density_unit; dstinfo->X_density = srcinfo->X_density; dstinfo->Y_density = srcinfo->Y_density; } } /* * Master selection of compression modules for transcoding. * This substitutes for jcinit.c's initialization of the full compressor. */ LOCAL(void) transencode_master_selection (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays) { cinfo->data_unit = DCTSIZE; /* Although we don't actually use input_components for transcoding, * jcmaster.c's initial_setup will complain if input_components is 0. */ cinfo->input_components = 1; /* Initialize master control (includes parameter checking/processing) */ jinit_c_master_control(cinfo, TRUE /* transcode only */); /* We need a special compression codec. */ transencode_codec(cinfo, coef_arrays); jinit_marker_writer(cinfo); /* We can now tell the memory manager to allocate virtual arrays. */ (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); /* Write the datastream header (SOI, JFIF) immediately. * Frame and scan headers are postponed till later. * This lets application insert special markers after the SOI. */ (*cinfo->marker->write_file_header) (cinfo); } /* * The rest of this file is a special implementation of the coefficient * buffer controller. This is similar to jccoefct.c, but it handles only * output from presupplied virtual arrays. Furthermore, we generate any * dummy padding blocks on-the-fly rather than expecting them to be present * in the arrays. */ /* Private buffer controller object */ typedef struct { JDIMENSION iMCU_row_num; /* iMCU row # within image */ JDIMENSION mcu_ctr; /* counts MCUs processed in current row */ int MCU_vert_offset; /* counts MCU rows within iMCU row */ int MCU_rows_per_iMCU_row; /* number of such rows needed */ /* Virtual block array for each component. */ jvirt_barray_ptr * whole_image; /* Workspace for constructing dummy blocks at right/bottom edges. */ JBLOCKROW dummy_buffer[C_MAX_DATA_UNITS_IN_MCU]; } c_coef_controller; typedef c_coef_controller * c_coef_ptr; LOCAL(void) start_iMCU_row (j_compress_ptr cinfo) /* Reset within-iMCU-row counters for a new row */ { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; c_coef_ptr coef = (c_coef_ptr) lossyc->coef_private; /* In an interleaved scan, an MCU row is the same as an iMCU row. * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows. * But at the bottom of the image, process only what's left. */ if (cinfo->comps_in_scan > 1) { coef->MCU_rows_per_iMCU_row = 1; } else { if (coef->iMCU_row_num < (cinfo->total_iMCU_rows-1)) coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor; else coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height; } coef->mcu_ctr = 0; coef->MCU_vert_offset = 0; } /* * Initialize for a processing pass. */ METHODDEF(void) start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; c_coef_ptr coef = (c_coef_ptr) lossyc->coef_private; if (pass_mode != JBUF_CRANK_DEST) ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); coef->iMCU_row_num = 0; start_iMCU_row(cinfo); } /* * Process some data. * We process the equivalent of one fully interleaved MCU row ("iMCU" row) * per call, ie, v_samp_factor block rows for each component in the scan. * The data is obtained from the virtual arrays and fed to the entropy coder. * Returns TRUE if the iMCU row is completed, FALSE if suspended. * * NB: input_buf is ignored; it is likely to be a NULL pointer. */ METHODDEF(boolean) compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; c_coef_ptr coef = (c_coef_ptr) lossyc->coef_private; JDIMENSION MCU_col_num; /* index of current MCU within row */ JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1; JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; int blkn, ci, xindex, yindex, yoffset, blockcnt; JDIMENSION start_col; JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN]; JBLOCKROW MCU_buffer[C_MAX_DATA_UNITS_IN_MCU]; JBLOCKROW buffer_ptr; jpeg_component_info *compptr; (void)input_buf; /* Align the virtual buffers for the components used in this scan. */ for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; buffer[ci] = (*cinfo->mem->access_virt_barray) ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index], coef->iMCU_row_num * compptr->v_samp_factor, (JDIMENSION) compptr->v_samp_factor, FALSE); } /* Loop to process one whole iMCU row */ for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; yoffset++) { for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row; MCU_col_num++) { /* Construct list of pointers to DCT blocks belonging to this MCU */ blkn = 0; /* index of current DCT block within MCU */ for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; start_col = MCU_col_num * compptr->MCU_width; blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width : compptr->last_col_width; for (yindex = 0; yindex < compptr->MCU_height; yindex++) { if (coef->iMCU_row_num < last_iMCU_row || yindex+yoffset < compptr->last_row_height) { /* Fill in pointers to real blocks in this row */ buffer_ptr = buffer[ci][yindex+yoffset] + start_col; for (xindex = 0; xindex < blockcnt; xindex++) MCU_buffer[blkn++] = buffer_ptr++; } else { /* At bottom of image, need a whole row of dummy blocks */ xindex = 0; } /* Fill in any dummy blocks needed in this row. * Dummy blocks are filled in the same way as in jccoefct.c: * all zeroes in the AC entries, DC entries equal to previous * block's DC value. The init routine has already zeroed the * AC entries, so we need only set the DC entries correctly. */ for (; xindex < compptr->MCU_width; xindex++) { MCU_buffer[blkn] = coef->dummy_buffer[blkn]; MCU_buffer[blkn][0][0] = MCU_buffer[blkn-1][0][0]; blkn++; } } } /* Try to write the MCU. */ if (! (*lossyc->entropy_encode_mcu) (cinfo, MCU_buffer)) { /* Suspension forced; update state counters and exit */ coef->MCU_vert_offset = yoffset; coef->mcu_ctr = MCU_col_num; return FALSE; } } /* Completed an MCU row, but perhaps not an iMCU row */ coef->mcu_ctr = 0; } /* Completed the iMCU row, advance counters for next one */ coef->iMCU_row_num++; start_iMCU_row(cinfo); return TRUE; } /* * Initialize coefficient buffer controller. * * Each passed coefficient array must be the right size for that * coefficient: width_in_data_units wide and height_in_data_units high, * with unitheight at least v_samp_factor. */ LOCAL(void) transencode_coef_controller (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; c_coef_ptr coef; JBLOCKROW buffer; int i; coef = (c_coef_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(c_coef_controller)); lossyc->coef_private = (struct jpeg_c_coef_controller *) coef; /* Save pointer to virtual arrays */ coef->whole_image = coef_arrays; /* Allocate and pre-zero space for dummy DCT blocks. */ buffer = (JBLOCKROW) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, C_MAX_DATA_UNITS_IN_MCU * SIZEOF(JBLOCK)); jzero_far((void FAR *) buffer, C_MAX_DATA_UNITS_IN_MCU * SIZEOF(JBLOCK)); for (i = 0; i < C_MAX_DATA_UNITS_IN_MCU; i++) { coef->dummy_buffer[i] = buffer + i; } } /* * Initialize the transencoer codec. * This is called only once, during master selection. */ LOCAL(void) transencode_codec (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays) { j_lossy_c_ptr lossyc; /* Create subobject in permanent pool */ lossyc = (j_lossy_c_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, SIZEOF(jpeg_lossy_c_codec)); cinfo->codec = (struct jpeg_c_codec *) lossyc; /* Initialize sub-modules */ /* Entropy encoding: either Huffman or arithmetic coding. */ if (cinfo->arith_code) { #ifdef WITH_ARITHMETIC_PATCH jinit_arith_encoder(cinfo); #else ERREXIT(cinfo, JERR_ARITH_NOTIMPL); #endif } else { if (cinfo->process == JPROC_PROGRESSIVE) { #ifdef C_PROGRESSIVE_SUPPORTED jinit_phuff_encoder(cinfo); #else ERREXIT(cinfo, JERR_NOT_COMPILED); #endif } else jinit_shuff_encoder(cinfo); } /* We need a special coefficient buffer controller. */ transencode_coef_controller(cinfo, coef_arrays); /* Initialize method pointers */ lossyc->pub.start_pass = start_pass_coef; lossyc->pub.compress_data = compress_output; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jcscale.c������������������������������������������������0000644�0001750�0001750�00000002717�12320456500�021577� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jcscale.c * * Copyright (C) 1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains sample downscaling by 2^Pt for lossless JPEG. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossls.h" /* Private declarations for lossless codec */ #ifdef C_LOSSLESS_SUPPORTED METHODDEF(void) simple_downscale(j_compress_ptr cinfo, JSAMPROW input_buf, JSAMPROW output_buf, JDIMENSION width) { /* j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; */ unsigned int xindex; SHIFT_TEMPS for (xindex = 0; xindex < width; xindex++) output_buf[xindex] = (JSAMPLE) RIGHT_SHIFT(GETJSAMPLE(input_buf[xindex]), cinfo->Al); } METHODDEF(void) noscale(j_compress_ptr cinfo, JSAMPROW input_buf, JSAMPROW output_buf, JDIMENSION width) { (void)cinfo; MEMCOPY(output_buf, input_buf, width * SIZEOF(JSAMPLE)); return; } METHODDEF(void) scaler_start_pass (j_compress_ptr cinfo) { j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; /* Set scaler function based on Pt */ if (cinfo->Al) losslsc->scaler_scale = simple_downscale; else losslsc->scaler_scale = noscale; } GLOBAL(void) jinit_c_scaler (j_compress_ptr cinfo) { j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; losslsc->scaler_start_pass = scaler_start_pass; } #endif /* C_LOSSLESS_SUPPORTED */ �������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jclhuff.c������������������������������������������������0000644�0001750�0001750�00000044564�12320456500�021622� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jclhuff.c * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains Huffman entropy encoding routines for lossless JPEG. * * Much of the complexity here has to do with supporting output suspension. * If the data destination module demands suspension, we want to be able to * back up to the start of the current MCU. To do this, we copy state * variables into local working storage, and update them back to the * permanent JPEG objects only upon successful completion of an MCU. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossls.h" /* Private declarations for lossless codec */ #include "jchuff.h" /* Declarations shared with jc*huff.c */ /* Expanded entropy encoder object for Huffman encoding. * * The savable_state subrecord contains fields that change within an MCU, * but must not be updated permanently until we complete the MCU. */ typedef struct { INT32 put_buffer; /* current bit-accumulation buffer */ int put_bits; /* # of bits now in it */ } savable_state; /* This macro is to work around compilers with missing or broken * structure assignment. You'll need to fix this code if you have * such a compiler and you change MAX_COMPS_IN_SCAN. */ #ifndef NO_STRUCT_ASSIGN #define ASSIGN_STATE(dest,src) ((dest) = (src)) #else #define ASSIGN_STATE(dest,src) \ ((dest).put_buffer = (src).put_buffer, \ (dest).put_bits = (src).put_bits) #endif typedef struct { int ci, yoffset, MCU_width; } lhe_input_ptr_info; typedef struct { savable_state saved; /* Bit buffer at start of MCU */ /* These fields are NOT loaded into local working state. */ unsigned int restarts_to_go; /* MCUs left in this restart interval */ int next_restart_num; /* next restart number to write (0-7) */ /* Pointers to derived tables (these workspaces have image lifespan) */ c_derived_tbl * derived_tbls[NUM_HUFF_TBLS]; /* Pointers to derived tables to be used for each data unit within an MCU */ c_derived_tbl * cur_tbls[C_MAX_DATA_UNITS_IN_MCU]; #ifdef ENTROPY_OPT_SUPPORTED /* Statistics tables for optimization */ long * count_ptrs[NUM_HUFF_TBLS]; /* Pointers to stats tables to be used for each data unit within an MCU */ long * cur_counts[C_MAX_DATA_UNITS_IN_MCU]; #endif /* Pointers to the proper input difference row for each group of data units * within an MCU. For each component, there are Vi groups of Hi data units. */ JDIFFROW input_ptr[C_MAX_DATA_UNITS_IN_MCU]; /* Number of input pointers in use for the current MCU. This is the sum * of all Vi in the MCU. */ int num_input_ptrs; /* Information used for positioning the input pointers within the input * difference rows. */ lhe_input_ptr_info input_ptr_info[C_MAX_DATA_UNITS_IN_MCU]; /* Index of the proper input pointer for each data unit within an MCU */ int input_ptr_index[C_MAX_DATA_UNITS_IN_MCU]; } lhuff_entropy_encoder; typedef lhuff_entropy_encoder * lhuff_entropy_ptr; /* Working state while writing an MCU. * This struct contains all the fields that are needed by subroutines. */ typedef struct { JOCTET * next_output_byte; /* => next byte to write in buffer */ size_t free_in_buffer; /* # of byte spaces remaining in buffer */ savable_state cur; /* Current bit buffer & DC state */ j_compress_ptr cinfo; /* dump_buffer needs access to this */ } working_state; /* Forward declarations */ METHODDEF(JDIMENSION) encode_mcus_huff (j_compress_ptr cinfo, JDIFFIMAGE diff_buf, JDIMENSION MCU_row_num, JDIMENSION MCU_col_num, JDIMENSION nMCU); METHODDEF(void) finish_pass_huff JPP((j_compress_ptr cinfo)); #ifdef ENTROPY_OPT_SUPPORTED METHODDEF(JDIMENSION) encode_mcus_gather (j_compress_ptr cinfo, JDIFFIMAGE diff_buf, JDIMENSION MCU_row_num, JDIMENSION MCU_col_num, JDIMENSION nMCU); METHODDEF(void) finish_pass_gather JPP((j_compress_ptr cinfo)); #endif /* * Initialize for a Huffman-compressed scan. * If gather_statistics is TRUE, we do not output anything during the scan, * just count the Huffman symbols used and generate Huffman code tables. */ METHODDEF(void) start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics) { j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; lhuff_entropy_ptr entropy = (lhuff_entropy_ptr) losslsc->entropy_private; int ci, dctbl, sampn, ptrn, yoffset, xoffset; jpeg_component_info * compptr; if (gather_statistics) { #ifdef ENTROPY_OPT_SUPPORTED losslsc->entropy_encode_mcus = encode_mcus_gather; losslsc->pub.entropy_finish_pass = finish_pass_gather; #else ERREXIT(cinfo, JERR_NOT_COMPILED); #endif } else { losslsc->entropy_encode_mcus = encode_mcus_huff; losslsc->pub.entropy_finish_pass = finish_pass_huff; } for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; dctbl = compptr->dc_tbl_no; if (gather_statistics) { #ifdef ENTROPY_OPT_SUPPORTED /* Check for invalid table indexes */ /* (make_c_derived_tbl does this in the other path) */ if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS) ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl); /* Allocate and zero the statistics tables */ /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */ if (entropy->count_ptrs[dctbl] == NULL) entropy->count_ptrs[dctbl] = (long *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, 257 * SIZEOF(long)); MEMZERO(entropy->count_ptrs[dctbl], 257 * SIZEOF(long)); #endif } else { /* Compute derived values for Huffman tables */ /* We may do this more than once for a table, but it's not expensive */ jpeg_make_c_derived_tbl(cinfo, TRUE, dctbl, & entropy->derived_tbls[dctbl]); } } /* Precalculate encoding info for each sample in an MCU of this scan */ for (sampn = 0, ptrn = 0; sampn < cinfo->data_units_in_MCU;) { compptr = cinfo->cur_comp_info[cinfo->MCU_membership[sampn]]; ci = compptr->component_index; /* ci = cinfo->MCU_membership[sampn]; compptr = cinfo->cur_comp_info[ci];*/ for (yoffset = 0; yoffset < compptr->MCU_height; yoffset++, ptrn++) { /* Precalculate the setup info for each input pointer */ entropy->input_ptr_info[ptrn].ci = ci; entropy->input_ptr_info[ptrn].yoffset = yoffset; entropy->input_ptr_info[ptrn].MCU_width = compptr->MCU_width; for (xoffset = 0; xoffset < compptr->MCU_width; xoffset++, sampn++) { /* Precalculate the input pointer index for each sample */ entropy->input_ptr_index[sampn] = ptrn; /* Precalculate which tables to use for each sample */ entropy->cur_tbls[sampn] = entropy->derived_tbls[compptr->dc_tbl_no]; entropy->cur_counts[sampn] = entropy->count_ptrs[compptr->dc_tbl_no]; } } } entropy->num_input_ptrs = ptrn; /* Initialize bit buffer to empty */ entropy->saved.put_buffer = 0; entropy->saved.put_bits = 0; /* Initialize restart stuff */ entropy->restarts_to_go = cinfo->restart_interval; entropy->next_restart_num = 0; } /* Outputting bytes to the file */ /* Emit a byte, taking 'action' if must suspend. */ #define emit_byte(state,val,action) \ { *(state)->next_output_byte++ = (JOCTET) (val); \ if (--(state)->free_in_buffer == 0) \ if (! dump_buffer(state)) \ { action; } } LOCAL(boolean) dump_buffer (working_state * state) /* Empty the output buffer; return TRUE if successful, FALSE if must suspend */ { struct jpeg_destination_mgr * dest = state->cinfo->dest; if (! (*dest->empty_output_buffer) (state->cinfo)) return FALSE; /* After a successful buffer dump, must reset buffer pointers */ state->next_output_byte = dest->next_output_byte; state->free_in_buffer = dest->free_in_buffer; return TRUE; } /* Outputting bits to the file */ /* Only the right 24 bits of put_buffer are used; the valid bits are * left-justified in this part. At most 16 bits can be passed to emit_bits * in one call, and we never retain more than 7 bits in put_buffer * between calls, so 24 bits are sufficient. */ INLINE LOCAL(boolean) emit_bits (working_state * state, unsigned int code, int size) /* Emit some bits; return TRUE if successful, FALSE if must suspend */ { /* This routine is heavily used, so it's worth coding tightly. */ register INT32 put_buffer = (INT32) code; register int put_bits = state->cur.put_bits; /* if size is 0, caller used an invalid Huffman table entry */ if (size == 0) ERREXIT(state->cinfo, JERR_HUFF_MISSING_CODE); put_buffer &= (((INT32) 1)<<size) - 1; /* mask off any extra bits in code */ put_bits += size; /* new number of bits in buffer */ put_buffer <<= 24 - put_bits; /* align incoming bits */ put_buffer |= state->cur.put_buffer; /* and merge with old buffer contents */ while (put_bits >= 8) { int c = (int) ((put_buffer >> 16) & 0xFF); emit_byte(state, c, return FALSE); if (c == 0xFF) { /* need to stuff a zero byte? */ emit_byte(state, 0, return FALSE); } put_buffer <<= 8; put_bits -= 8; } state->cur.put_buffer = put_buffer; /* update state variables */ state->cur.put_bits = put_bits; return TRUE; } LOCAL(boolean) flush_bits (working_state * state) { if (! emit_bits(state, 0x7F, 7)) /* fill any partial byte with ones */ return FALSE; state->cur.put_buffer = 0; /* and reset bit-buffer to empty */ state->cur.put_bits = 0; return TRUE; } /* * Emit a restart marker & resynchronize predictions. */ LOCAL(boolean) emit_restart (working_state * state, int restart_num) { /* int ci; */ if (! flush_bits(state)) return FALSE; emit_byte(state, 0xFF, return FALSE); emit_byte(state, JPEG_RST0 + restart_num, return FALSE); /* The restart counter is not updated until we successfully write the MCU. */ return TRUE; } /* * Encode and output one nMCU's worth of Huffman-compressed differences. */ METHODDEF(JDIMENSION) encode_mcus_huff (j_compress_ptr cinfo, JDIFFIMAGE diff_buf, JDIMENSION MCU_row_num, JDIMENSION MCU_col_num, JDIMENSION nMCU) { j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; lhuff_entropy_ptr entropy = (lhuff_entropy_ptr) losslsc->entropy_private; working_state state; unsigned int mcu_num; int sampn, ci, yoffset, MCU_width, ptrn; /* jpeg_component_info * compptr; */ /* Load up working state */ state.next_output_byte = cinfo->dest->next_output_byte; state.free_in_buffer = cinfo->dest->free_in_buffer; ASSIGN_STATE(state.cur, entropy->saved); state.cinfo = cinfo; /* Emit restart marker if needed */ if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) if (! emit_restart(&state, entropy->next_restart_num)) return 0; } /* Set input pointer locations based on MCU_col_num */ for (ptrn = 0; ptrn < entropy->num_input_ptrs; ptrn++) { ci = entropy->input_ptr_info[ptrn].ci; yoffset = entropy->input_ptr_info[ptrn].yoffset; MCU_width = entropy->input_ptr_info[ptrn].MCU_width; entropy->input_ptr[ptrn] = diff_buf[ci][MCU_row_num + yoffset] + (MCU_col_num * MCU_width); } for (mcu_num = 0; mcu_num < nMCU; mcu_num++) { /* Inner loop handles the samples in the MCU */ for (sampn = 0; sampn < cinfo->data_units_in_MCU; sampn++) { register int temp, temp2 /* , temp3 */ ; register int nbits; c_derived_tbl *dctbl = entropy->cur_tbls[sampn]; /* Encode the difference per section H.1.2.2 */ /* Input the sample difference */ temp = *entropy->input_ptr[entropy->input_ptr_index[sampn]]++; if (temp & 0x8000) { /* instead of temp < 0 */ temp = (-temp) & 0x7FFF; /* absolute value, mod 2^16 */ if (temp == 0) /* special case: magnitude = 32768 */ temp2 = temp = 0x8000; temp2 = ~ temp; /* one's complement of magnitude */ } else { temp &= 0x7FFF; /* abs value mod 2^16 */ temp2 = temp; /* magnitude */ } /* Find the number of bits needed for the magnitude of the difference */ nbits = 0; while (temp) { nbits++; temp >>= 1; } /* Check for out-of-range difference values. */ if (nbits > MAX_DIFF_BITS) ERREXIT(cinfo, JERR_BAD_DIFF); /* Emit the Huffman-coded symbol for the number of bits */ if (! emit_bits(&state, dctbl->ehufco[nbits], dctbl->ehufsi[nbits])) return mcu_num; /* Emit that number of bits of the value, if positive, */ /* or the complement of its magnitude, if negative. */ if (nbits && /* emit_bits rejects calls with size 0 */ nbits != 16) /* special case: no bits should be emitted */ if (! emit_bits(&state, (unsigned int) temp2, nbits)) return mcu_num; } /* Completed MCU, so update state */ cinfo->dest->next_output_byte = state.next_output_byte; cinfo->dest->free_in_buffer = state.free_in_buffer; ASSIGN_STATE(entropy->saved, state.cur); /* Update restart-interval state too */ if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) { entropy->restarts_to_go = cinfo->restart_interval; entropy->next_restart_num++; entropy->next_restart_num &= 7; } entropy->restarts_to_go--; } } return nMCU; } /* * Finish up at the end of a Huffman-compressed scan. */ METHODDEF(void) finish_pass_huff (j_compress_ptr cinfo) { j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; lhuff_entropy_ptr entropy = (lhuff_entropy_ptr) losslsc->entropy_private; working_state state; /* Load up working state ... flush_bits needs it */ state.next_output_byte = cinfo->dest->next_output_byte; state.free_in_buffer = cinfo->dest->free_in_buffer; ASSIGN_STATE(state.cur, entropy->saved); state.cinfo = cinfo; /* Flush out the last data */ if (! flush_bits(&state)) ERREXIT(cinfo, JERR_CANT_SUSPEND); /* Update state */ cinfo->dest->next_output_byte = state.next_output_byte; cinfo->dest->free_in_buffer = state.free_in_buffer; ASSIGN_STATE(entropy->saved, state.cur); } /* * Huffman coding optimization. * * We first scan the supplied data and count the number of uses of each symbol * that is to be Huffman-coded. (This process MUST agree with the code above.) * Then we build a Huffman coding tree for the observed counts. * Symbols which are not needed at all for the particular image are not * assigned any code, which saves space in the DHT marker as well as in * the compressed data. */ #ifdef ENTROPY_OPT_SUPPORTED /* * Trial-encode one nMCU's worth of Huffman-compressed differences. * No data is actually output, so no suspension return is possible. */ METHODDEF(JDIMENSION) encode_mcus_gather (j_compress_ptr cinfo, JDIFFIMAGE diff_buf, JDIMENSION MCU_row_num, JDIMENSION MCU_col_num, JDIMENSION nMCU) { j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; lhuff_entropy_ptr entropy = (lhuff_entropy_ptr) losslsc->entropy_private; unsigned int mcu_num; int sampn, ci, yoffset, MCU_width, ptrn; /* jpeg_component_info * compptr; */ /* Take care of restart intervals if needed */ if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) { /* Update restart state */ entropy->restarts_to_go = cinfo->restart_interval; } entropy->restarts_to_go--; } /* Set input pointer locations based on MCU_col_num */ for (ptrn = 0; ptrn < entropy->num_input_ptrs; ptrn++) { ci = entropy->input_ptr_info[ptrn].ci; yoffset = entropy->input_ptr_info[ptrn].yoffset; MCU_width = entropy->input_ptr_info[ptrn].MCU_width; entropy->input_ptr[ptrn] = diff_buf[ci][MCU_row_num + yoffset] + (MCU_col_num * MCU_width); } for (mcu_num = 0; mcu_num < nMCU; mcu_num++) { /* Inner loop handles the samples in the MCU */ for (sampn = 0; sampn < cinfo->data_units_in_MCU; sampn++) { register int temp; register int nbits; /* c_derived_tbl *dctbl = entropy->cur_tbls[sampn]; */ long * counts = entropy->cur_counts[sampn]; /* Encode the difference per section H.1.2.2 */ /* Input the sample difference */ temp = *entropy->input_ptr[entropy->input_ptr_index[sampn]]++; if (temp & 0x8000) { /* instead of temp < 0 */ temp = (-temp) & 0x7FFF; /* absolute value, mod 2^16 */ if (temp == 0) /* special case: magnitude = 32768 */ temp = 0x8000; } else temp &= 0x7FFF; /* abs value mod 2^16 */ /* Find the number of bits needed for the magnitude of the difference */ nbits = 0; while (temp) { nbits++; temp >>= 1; } /* Check for out-of-range difference values. */ if (nbits > MAX_DIFF_BITS) ERREXIT(cinfo, JERR_BAD_DIFF); /* Count the Huffman symbol for the number of bits */ counts[nbits]++; } } return nMCU; } /* * Finish up a statistics-gathering pass and create the new Huffman tables. */ METHODDEF(void) finish_pass_gather (j_compress_ptr cinfo) { j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; lhuff_entropy_ptr entropy = (lhuff_entropy_ptr) losslsc->entropy_private; int ci, dctbl; jpeg_component_info * compptr; JHUFF_TBL **htblptr; boolean did_dc[NUM_HUFF_TBLS]; /* It's important not to apply jpeg_gen_optimal_table more than once * per table, because it clobbers the input frequency counts! */ MEMZERO(did_dc, SIZEOF(did_dc)); for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; dctbl = compptr->dc_tbl_no; if (! did_dc[dctbl]) { htblptr = & cinfo->dc_huff_tbl_ptrs[dctbl]; if (*htblptr == NULL) *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); jpeg_gen_optimal_table(cinfo, *htblptr, entropy->count_ptrs[dctbl]); did_dc[dctbl] = TRUE; } } } #endif /* ENTROPY_OPT_SUPPORTED */ METHODDEF(boolean) need_optimization_pass (j_compress_ptr cinfo) { (void)cinfo; return TRUE; } /* * Module initialization routine for Huffman entropy encoding. */ GLOBAL(void) jinit_lhuff_encoder (j_compress_ptr cinfo) { j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; lhuff_entropy_ptr entropy; int i; entropy = (lhuff_entropy_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(lhuff_entropy_encoder)); losslsc->entropy_private = (struct jpeg_entropy_encoder *) entropy; losslsc->pub.entropy_start_pass = start_pass_huff; losslsc->pub.need_optimization_pass = need_optimization_pass; /* Mark tables unallocated */ for (i = 0; i < NUM_HUFF_TBLS; i++) { entropy->derived_tbls[i] = NULL; #ifdef ENTROPY_OPT_SUPPORTED entropy->count_ptrs[i] = NULL; #endif } } ��������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jmemsys.h������������������������������������������������0000644�0001750�0001750�00000020204�12320456500�021656� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jmemsys.h * * Copyright (C) 1992-1997, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This include file defines the interface between the system-independent * and system-dependent portions of the JPEG memory manager. No other * modules need include it. (The system-independent portion is jmemmgr.c; * there are several different versions of the system-dependent portion.) * * This file works as-is for the system-dependent memory managers supplied * in the IJG distribution. You may need to modify it if you write a * custom memory manager. If system-dependent changes are needed in * this file, the best method is to #ifdef them based on a configuration * symbol supplied in jconfig.h, as we have done with USE_MSDOS_MEMMGR * and USE_MAC_MEMMGR. */ #ifdef __cplusplus extern "C" { #endif // cplusplus /* Short forms of external names for systems with brain-damaged linkers. */ #ifdef NEED_SHORT_EXTERNAL_NAMES #define jpeg_get_small jGetSmall #define jpeg_free_small jFreeSmall #define jpeg_get_large jGetLarge #define jpeg_free_large jFreeLarge #define jpeg_mem_available jMemAvail #define jpeg_open_backing_store jOpenBackStore #define jpeg_mem_init jMemInit #define jpeg_mem_term jMemTerm #endif /* NEED_SHORT_EXTERNAL_NAMES */ /* * These two functions are used to allocate and release small chunks of * memory. (Typically the total amount requested through jpeg_get_small is * no more than 20K or so; this will be requested in chunks of a few K each.) * Behavior should be the same as for the standard library functions malloc * and free; in particular, jpeg_get_small must return NULL on failure. * On most systems, these ARE malloc and free. jpeg_free_small is passed the * size of the object being freed, just in case it's needed. * On an 80x86 machine using small-data memory model, these manage near heap. */ EXTERN(void *) jpeg_get_small JPP((j_common_ptr cinfo, size_t sizeofobject)); EXTERN(void) jpeg_free_small JPP((j_common_ptr cinfo, void * object, size_t sizeofobject)); /* * These two functions are used to allocate and release large chunks of * memory (up to the total free space designated by jpeg_mem_available). * The interface is the same as above, except that on an 80x86 machine, * far pointers are used. On most other machines these are identical to * the jpeg_get/free_small routines; but we keep them separate anyway, * in case a different allocation strategy is desirable for large chunks. */ EXTERN(void FAR *) jpeg_get_large JPP((j_common_ptr cinfo, size_t sizeofobject)); EXTERN(void) jpeg_free_large JPP((j_common_ptr cinfo, void FAR * object, size_t sizeofobject)); /* * The macro MAX_ALLOC_CHUNK designates the maximum number of bytes that may * be requested in a single call to jpeg_get_large (and jpeg_get_small for that * matter, but that case should never come into play). This macro is needed * to model the 64Kb-segment-size limit of far addressing on 80x86 machines. * On those machines, we expect that jconfig.h will provide a proper value. * On machines with 32-bit flat address spaces, any large constant may be used. * * NB: jmemmgr.c expects that MAX_ALLOC_CHUNK will be representable as type * size_t and will be a multiple of sizeof(align_type). */ #ifndef MAX_ALLOC_CHUNK /* may be overridden in jconfig.h */ #define MAX_ALLOC_CHUNK 1000000000L #endif /* * This routine computes the total space still available for allocation by * jpeg_get_large. If more space than this is needed, backing store will be * used. NOTE: any memory already allocated must not be counted. * * There is a minimum space requirement, corresponding to the minimum * feasible buffer sizes; jmemmgr.c will request that much space even if * jpeg_mem_available returns zero. The maximum space needed, enough to hold * all working storage in memory, is also passed in case it is useful. * Finally, the total space already allocated is passed. If no better * method is available, cinfo->mem->max_memory_to_use - already_allocated * is often a suitable calculation. * * It is OK for jpeg_mem_available to underestimate the space available * (that'll just lead to more backing-store access than is really necessary). * However, an overestimate will lead to failure. Hence it's wise to subtract * a slop factor from the true available space. 5% should be enough. * * On machines with lots of virtual memory, any large constant may be returned. * Conversely, zero may be returned to always use the minimum amount of memory. */ EXTERN(long) jpeg_mem_available JPP((j_common_ptr cinfo, long min_bytes_needed, long max_bytes_needed, long already_allocated)); /* * This structure holds whatever state is needed to access a single * backing-store object. The read/write/close method pointers are called * by jmemmgr.c to manipulate the backing-store object; all other fields * are private to the system-dependent backing store routines. */ #define TEMP_NAME_LENGTH 64 /* max length of a temporary file's name */ #ifdef USE_MSDOS_MEMMGR /* DOS-specific junk */ typedef unsigned short XMSH; /* type of extended-memory handles */ typedef unsigned short EMSH; /* type of expanded-memory handles */ typedef union { short file_handle; /* DOS file handle if it's a temp file */ XMSH xms_handle; /* handle if it's a chunk of XMS */ EMSH ems_handle; /* handle if it's a chunk of EMS */ } handle_union; #endif /* USE_MSDOS_MEMMGR */ #ifdef USE_MAC_MEMMGR /* Mac-specific junk */ #include <Files.h> #endif /* USE_MAC_MEMMGR */ typedef struct backing_store_struct * backing_store_ptr; typedef struct backing_store_struct { /* Methods for reading/writing/closing this backing-store object */ JMETHOD(void, read_backing_store, (j_common_ptr cinfo, backing_store_ptr info, void FAR * buffer_address, long file_offset, long byte_count)); JMETHOD(void, write_backing_store, (j_common_ptr cinfo, backing_store_ptr info, void FAR * buffer_address, long file_offset, long byte_count)); JMETHOD(void, close_backing_store, (j_common_ptr cinfo, backing_store_ptr info)); /* Private fields for system-dependent backing-store management */ #ifdef USE_MSDOS_MEMMGR /* For the MS-DOS manager (jmemdos.c), we need: */ handle_union handle; /* reference to backing-store storage object */ char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */ #else #ifdef USE_MAC_MEMMGR /* For the Mac manager (jmemmac.c), we need: */ short temp_file; /* file reference number to temp file */ FSSpec tempSpec; /* the FSSpec for the temp file */ char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */ #else /* For a typical implementation with temp files, we need: */ FILE * temp_file; /* stdio reference to temp file */ char temp_name[TEMP_NAME_LENGTH]; /* name of temp file */ #endif #endif } backing_store_info; /* * Initial opening of a backing-store object. This must fill in the * read/write/close pointers in the object. The read/write routines * may take an error exit if the specified maximum file size is exceeded. * (If jpeg_mem_available always returns a large value, this routine can * just take an error exit.) */ EXTERN(void) jpeg_open_backing_store JPP((j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed)); /* * These routines take care of any system-dependent initialization and * cleanup required. jpeg_mem_init will be called before anything is * allocated (and, therefore, nothing in cinfo is of use except the error * manager pointer). It should return a suitable default value for * max_memory_to_use; this may subsequently be overridden by the surrounding * application. (Note that max_memory_to_use is only important if * jpeg_mem_available chooses to consult it ... no one else will.) * jpeg_mem_term may assume that all requested memory has been freed and that * all opened backing-store objects have been closed. */ EXTERN(long) jpeg_mem_init JPP((j_common_ptr cinfo)); EXTERN(void) jpeg_mem_term JPP((j_common_ptr cinfo)); #ifdef __cplusplus } #endif // cplusplus ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jcprepct.c�����������������������������������������������0000644�0001750�0001750�00000027520�12320456500�022004� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jcprepct.c * * Copyright (C) 1994-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains the compression preprocessing controller. * This controller manages the color conversion, downsampling, * and edge expansion steps. * * Most of the complexity here is associated with buffering input rows * as required by the downsampler. See the comments at the head of * jcsample.c for the downsampler's needs. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" /* At present, jcsample.c can request context rows only for smoothing. * In the future, we might also need context rows for CCIR601 sampling * or other more-complex downsampling procedures. The code to support * context rows should be compiled only if needed. */ #ifdef INPUT_SMOOTHING_SUPPORTED #define CONTEXT_ROWS_SUPPORTED #endif /* * For the simple (no-context-row) case, we just need to buffer one * row group's worth of pixels for the downsampling step. At the bottom of * the image, we pad to a full row group by replicating the last pixel row. * The downsampler's last output row is then replicated if needed to pad * out to a full iMCU row. * * When providing context rows, we must buffer three row groups' worth of * pixels. Three row groups are physically allocated, but the row pointer * arrays are made five row groups high, with the extra pointers above and * below "wrapping around" to point to the last and first real row groups. * This allows the downsampler to access the proper context rows. * At the top and bottom of the image, we create dummy context rows by * copying the first or last real pixel row. This copying could be avoided * by pointer hacking as is done in jdmainct.c, but it doesn't seem worth the * trouble on the compression side. */ /* Private buffer controller object */ typedef struct { struct jpeg_c_prep_controller pub; /* public fields */ /* Downsampling input buffer. This buffer holds color-converted data * until we have enough to do a downsample step. */ JSAMPARRAY color_buf[MAX_COMPONENTS]; JDIMENSION rows_to_go; /* counts rows remaining in source image */ int next_buf_row; /* index of next row to store in color_buf */ #ifdef CONTEXT_ROWS_SUPPORTED /* only needed for context case */ int this_row_group; /* starting row index of group to process */ int next_buf_stop; /* downsample when we reach this index */ #endif } my_prep_controller; typedef my_prep_controller * my_prep_ptr; /* * Initialize for a processing pass. */ METHODDEF(void) start_pass_prep (j_compress_ptr cinfo, J_BUF_MODE pass_mode) { my_prep_ptr prep = (my_prep_ptr) cinfo->prep; if (pass_mode != JBUF_PASS_THRU) ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); /* Initialize total-height counter for detecting bottom of image */ prep->rows_to_go = cinfo->image_height; /* Mark the conversion buffer empty */ prep->next_buf_row = 0; #ifdef CONTEXT_ROWS_SUPPORTED /* Preset additional state variables for context mode. * These aren't used in non-context mode, so we needn't test which mode. */ prep->this_row_group = 0; /* Set next_buf_stop to stop after two row groups have been read in. */ prep->next_buf_stop = 2 * cinfo->max_v_samp_factor; #endif } /* * Expand an image vertically from height input_rows to height output_rows, * by duplicating the bottom row. */ LOCAL(void) expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols, int input_rows, int output_rows) { register int row; for (row = input_rows; row < output_rows; row++) { jcopy_sample_rows(image_data, input_rows-1, image_data, row, 1, num_cols); } } /* * Process some data in the simple no-context case. * * Preprocessor output data is counted in "row groups". A row group * is defined to be v_samp_factor sample rows of each component. * Downsampling will produce this much data from each max_v_samp_factor * input rows. */ METHODDEF(void) pre_process_data (j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail, JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr, JDIMENSION out_row_groups_avail) { my_prep_ptr prep = (my_prep_ptr) cinfo->prep; int numrows, ci; JDIMENSION inrows; jpeg_component_info * compptr; while (*in_row_ctr < in_rows_avail && *out_row_group_ctr < out_row_groups_avail) { /* Do color conversion to fill the conversion buffer. */ inrows = in_rows_avail - *in_row_ctr; numrows = cinfo->max_v_samp_factor - prep->next_buf_row; numrows = (int) MIN((JDIMENSION) numrows, inrows); (*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr, prep->color_buf, (JDIMENSION) prep->next_buf_row, numrows); *in_row_ctr += numrows; prep->next_buf_row += numrows; prep->rows_to_go -= numrows; /* If at bottom of image, pad to fill the conversion buffer. */ if (prep->rows_to_go == 0 && prep->next_buf_row < cinfo->max_v_samp_factor) { for (ci = 0; ci < cinfo->num_components; ci++) { expand_bottom_edge(prep->color_buf[ci], cinfo->image_width, prep->next_buf_row, cinfo->max_v_samp_factor); } prep->next_buf_row = cinfo->max_v_samp_factor; } /* If we've filled the conversion buffer, empty it. */ if (prep->next_buf_row == cinfo->max_v_samp_factor) { (*cinfo->downsample->downsample) (cinfo, prep->color_buf, (JDIMENSION) 0, output_buf, *out_row_group_ctr); prep->next_buf_row = 0; (*out_row_group_ctr)++; } /* If at bottom of image, pad the output to a full iMCU height. * Note we assume the caller is providing a one-iMCU-height output buffer! */ if (prep->rows_to_go == 0 && *out_row_group_ctr < out_row_groups_avail) { for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { expand_bottom_edge(output_buf[ci], compptr->width_in_data_units * cinfo->data_unit, (int) (*out_row_group_ctr * compptr->v_samp_factor), (int) (out_row_groups_avail * compptr->v_samp_factor)); } *out_row_group_ctr = out_row_groups_avail; break; /* can exit outer loop without test */ } } } #ifdef CONTEXT_ROWS_SUPPORTED /* * Process some data in the context case. */ METHODDEF(void) pre_process_context (j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail, JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr, JDIMENSION out_row_groups_avail) { my_prep_ptr prep = (my_prep_ptr) cinfo->prep; int numrows, ci; int buf_height = cinfo->max_v_samp_factor * 3; JDIMENSION inrows; while (*out_row_group_ctr < out_row_groups_avail) { if (*in_row_ctr < in_rows_avail) { /* Do color conversion to fill the conversion buffer. */ inrows = in_rows_avail - *in_row_ctr; numrows = prep->next_buf_stop - prep->next_buf_row; numrows = (int) MIN((JDIMENSION) numrows, inrows); (*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr, prep->color_buf, (JDIMENSION) prep->next_buf_row, numrows); /* Pad at top of image, if first time through */ if (prep->rows_to_go == cinfo->image_height) { for (ci = 0; ci < cinfo->num_components; ci++) { int row; for (row = 1; row <= cinfo->max_v_samp_factor; row++) { jcopy_sample_rows(prep->color_buf[ci], 0, prep->color_buf[ci], -row, 1, cinfo->image_width); } } } *in_row_ctr += numrows; prep->next_buf_row += numrows; prep->rows_to_go -= numrows; } else { /* Return for more data, unless we are at the bottom of the image. */ if (prep->rows_to_go != 0) break; /* When at bottom of image, pad to fill the conversion buffer. */ if (prep->next_buf_row < prep->next_buf_stop) { for (ci = 0; ci < cinfo->num_components; ci++) { expand_bottom_edge(prep->color_buf[ci], cinfo->image_width, prep->next_buf_row, prep->next_buf_stop); } prep->next_buf_row = prep->next_buf_stop; } } /* If we've gotten enough data, downsample a row group. */ if (prep->next_buf_row == prep->next_buf_stop) { (*cinfo->downsample->downsample) (cinfo, prep->color_buf, (JDIMENSION) prep->this_row_group, output_buf, *out_row_group_ctr); (*out_row_group_ctr)++; /* Advance pointers with wraparound as necessary. */ prep->this_row_group += cinfo->max_v_samp_factor; if (prep->this_row_group >= buf_height) prep->this_row_group = 0; if (prep->next_buf_row >= buf_height) prep->next_buf_row = 0; prep->next_buf_stop = prep->next_buf_row + cinfo->max_v_samp_factor; } } } /* * Create the wrapped-around downsampling input buffer needed for context mode. */ LOCAL(void) create_context_buffer (j_compress_ptr cinfo) { my_prep_ptr prep = (my_prep_ptr) cinfo->prep; int rgroup_height = cinfo->max_v_samp_factor; int ci, i; jpeg_component_info * compptr; JSAMPARRAY true_buffer, fake_buffer; /* Grab enough space for fake row pointers for all the components; * we need five row groups' worth of pointers for each component. */ fake_buffer = (JSAMPARRAY) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (cinfo->num_components * 5 * rgroup_height) * SIZEOF(JSAMPROW)); for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { /* Allocate the actual buffer space (3 row groups) for this component. * We make the buffer wide enough to allow the downsampler to edge-expand * horizontally within the buffer, if it so chooses. */ true_buffer = (*cinfo->mem->alloc_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, (JDIMENSION) (((long) compptr->width_in_data_units * cinfo->data_unit * cinfo->max_h_samp_factor) / compptr->h_samp_factor), (JDIMENSION) (3 * rgroup_height)); /* Copy true buffer row pointers into the middle of the fake row array */ MEMCOPY(fake_buffer + rgroup_height, true_buffer, 3 * rgroup_height * SIZEOF(JSAMPROW)); /* Fill in the above and below wraparound pointers */ for (i = 0; i < rgroup_height; i++) { fake_buffer[i] = true_buffer[2 * rgroup_height + i]; fake_buffer[4 * rgroup_height + i] = true_buffer[i]; } prep->color_buf[ci] = fake_buffer + rgroup_height; fake_buffer += 5 * rgroup_height; /* point to space for next component */ } } #endif /* CONTEXT_ROWS_SUPPORTED */ /* * Initialize preprocessing controller. */ GLOBAL(void) jinit_c_prep_controller (j_compress_ptr cinfo, boolean need_full_buffer) { my_prep_ptr prep; int ci; jpeg_component_info * compptr; if (need_full_buffer) /* safety check */ ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); prep = (my_prep_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_prep_controller)); cinfo->prep = (struct jpeg_c_prep_controller *) prep; prep->pub.start_pass = start_pass_prep; /* Allocate the color conversion buffer. * We make the buffer wide enough to allow the downsampler to edge-expand * horizontally within the buffer, if it so chooses. */ if (cinfo->downsample->need_context_rows) { /* Set up to provide context rows */ #ifdef CONTEXT_ROWS_SUPPORTED prep->pub.pre_process_data = pre_process_context; create_context_buffer(cinfo); #else ERREXIT(cinfo, JERR_NOT_COMPILED); #endif } else { /* No context, just make it tall enough for one row group */ prep->pub.pre_process_data = pre_process_data; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { prep->color_buf[ci] = (*cinfo->mem->alloc_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, (JDIMENSION) (((long) compptr->width_in_data_units * cinfo->data_unit * cinfo->max_h_samp_factor) / compptr->h_samp_factor), (JDIMENSION) cinfo->max_v_samp_factor); } } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdshuff.c������������������������������������������������0000644�0001750�0001750�00000026472�12320456500�021630� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdshuff.c * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains Huffman entropy decoding routines for sequential JPEG. * * Much of the complexity here has to do with supporting input suspension. * If the data source module demands suspension, we want to be able to back * up to the start of the current MCU. To do this, we copy state variables * into local working storage, and update them back to the permanent * storage only upon successful completion of an MCU. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossy.h" /* Private declarations for lossy codec */ #include "jdhuff.h" /* Declarations shared with jd*huff.c */ /* * Private entropy decoder object for Huffman decoding. * * The savable_state subrecord contains fields that change within an MCU, * but must not be updated permanently until we complete the MCU. */ typedef struct { int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ } savable_state; /* This macro is to work around compilers with missing or broken * structure assignment. You'll need to fix this code if you have * such a compiler and you change MAX_COMPS_IN_SCAN. */ #ifndef NO_STRUCT_ASSIGN #define ASSIGN_STATE(dest,src) ((dest) = (src)) #else #if MAX_COMPS_IN_SCAN == 4 #define ASSIGN_STATE(dest,src) \ ((dest).last_dc_val[0] = (src).last_dc_val[0], \ (dest).last_dc_val[1] = (src).last_dc_val[1], \ (dest).last_dc_val[2] = (src).last_dc_val[2], \ (dest).last_dc_val[3] = (src).last_dc_val[3]) #endif #endif typedef struct { huffd_common_fields; /* Fields shared with other entropy decoders */ /* These fields are loaded into local variables at start of each MCU. * In case of suspension, we exit WITHOUT updating them. */ savable_state saved; /* Other state at start of MCU */ /* These fields are NOT loaded into local working state. */ unsigned int restarts_to_go; /* MCUs left in this restart interval */ /* Pointers to derived tables (these workspaces have image lifespan) */ d_derived_tbl * dc_derived_tbls[NUM_HUFF_TBLS]; d_derived_tbl * ac_derived_tbls[NUM_HUFF_TBLS]; /* Precalculated info set up by start_pass for use in decode_mcu: */ /* Pointers to derived tables to be used for each block within an MCU */ d_derived_tbl * dc_cur_tbls[D_MAX_DATA_UNITS_IN_MCU]; d_derived_tbl * ac_cur_tbls[D_MAX_DATA_UNITS_IN_MCU]; /* Whether we care about the DC and AC coefficient values for each block */ boolean dc_needed[D_MAX_DATA_UNITS_IN_MCU]; boolean ac_needed[D_MAX_DATA_UNITS_IN_MCU]; } shuff_entropy_decoder; typedef shuff_entropy_decoder * shuff_entropy_ptr; /* * Initialize for a Huffman-compressed scan. */ METHODDEF(void) start_pass_huff_decoder (j_decompress_ptr cinfo) { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; shuff_entropy_ptr entropy = (shuff_entropy_ptr) lossyd->entropy_private; int ci, blkn, dctbl, actbl; jpeg_component_info * compptr; /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG. * This ought to be an error condition, but we make it a warning because * there are some baseline files out there with all zeroes in these bytes. */ if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2-1 || cinfo->Ah != 0 || cinfo->Al != 0) WARNMS(cinfo, JWRN_NOT_SEQUENTIAL); for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; dctbl = compptr->dc_tbl_no; actbl = compptr->ac_tbl_no; /* Compute derived values for Huffman tables */ /* We may do this more than once for a table, but it's not expensive */ jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl, & entropy->dc_derived_tbls[dctbl]); jpeg_make_d_derived_tbl(cinfo, FALSE, actbl, & entropy->ac_derived_tbls[actbl]); /* Initialize DC predictions to 0 */ entropy->saved.last_dc_val[ci] = 0; } /* Precalculate decoding info for each block in an MCU of this scan */ for (blkn = 0; blkn < cinfo->data_units_in_MCU; blkn++) { ci = cinfo->MCU_membership[blkn]; compptr = cinfo->cur_comp_info[ci]; /* Precalculate which table to use for each block */ entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no]; entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no]; /* Decide whether we really care about the coefficient values */ if (compptr->component_needed) { entropy->dc_needed[blkn] = TRUE; /* we don't need the ACs if producing a 1/8th-size image */ entropy->ac_needed[blkn] = (compptr->codec_data_unit > 1); } else { entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE; } } /* Initialize bitread state variables */ entropy->bitstate.bits_left = 0; entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */ entropy->insufficient_data = FALSE; /* Initialize restart counter */ entropy->restarts_to_go = cinfo->restart_interval; } /* * Figure F.12: extend sign bit. * On some machines, a shift and add will be faster than a table lookup. */ #ifdef AVOID_TABLES #define HUFF_EXTEND(x,s) ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x)) #else #define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x)) static const int extend_test[16] = /* entry n is 2**(n-1) */ { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 }; static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 }; #endif /* AVOID_TABLES */ /* * Check for a restart marker & resynchronize decoder. * Returns FALSE if must suspend. */ LOCAL(boolean) process_restart (j_decompress_ptr cinfo) { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; shuff_entropy_ptr entropy = (shuff_entropy_ptr) lossyd->entropy_private; int ci; /* Throw away any unused bits remaining in bit buffer; */ /* include any full bytes in next_marker's count of discarded bytes */ cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8; entropy->bitstate.bits_left = 0; /* Advance past the RSTn marker */ if (! (*cinfo->marker->read_restart_marker) (cinfo)) return FALSE; /* Re-initialize DC predictions to 0 */ for (ci = 0; ci < cinfo->comps_in_scan; ci++) entropy->saved.last_dc_val[ci] = 0; /* Reset restart counter */ entropy->restarts_to_go = cinfo->restart_interval; /* Reset out-of-data flag, unless read_restart_marker left us smack up * against a marker. In that case we will end up treating the next data * segment as empty, and we can avoid producing bogus output pixels by * leaving the flag set. */ if (cinfo->unread_marker == 0) entropy->insufficient_data = FALSE; return TRUE; } /* * Decode and return one MCU's worth of Huffman-compressed coefficients. * The coefficients are reordered from zigzag order into natural array order, * but are not dequantized. * * The i'th block of the MCU is stored into the block pointed to by * MCU_data[i]. WE ASSUME THIS AREA HAS BEEN ZEROED BY THE CALLER. * (Wholesale zeroing is usually a little faster than retail...) * * Returns FALSE if data source requested suspension. In that case no * changes have been made to permanent state. (Exception: some output * coefficients may already have been assigned. This is harmless for * this module, since we'll just re-assign them on the next call.) */ METHODDEF(boolean) decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; shuff_entropy_ptr entropy = (shuff_entropy_ptr) lossyd->entropy_private; int blkn; BITREAD_STATE_VARS; savable_state state; /* Process restart marker if needed; may have to suspend */ if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) if (! process_restart(cinfo)) return FALSE; } /* If we've run out of data, just leave the MCU set to zeroes. * This way, we return uniform gray for the remainder of the segment. */ if (! entropy->insufficient_data) { /* Load up working state */ BITREAD_LOAD_STATE(cinfo,entropy->bitstate); ASSIGN_STATE(state, entropy->saved); /* Outer loop handles each block in the MCU */ for (blkn = 0; blkn < cinfo->data_units_in_MCU; blkn++) { JBLOCKROW block = MCU_data[blkn]; d_derived_tbl * dctbl = entropy->dc_cur_tbls[blkn]; d_derived_tbl * actbl = entropy->ac_cur_tbls[blkn]; register int s, k, r; /* Decode a single block's worth of coefficients */ /* Section F.2.2.1: decode the DC coefficient difference */ HUFF_DECODE(s, br_state, dctbl, return FALSE, label1); if (s) { CHECK_BIT_BUFFER(br_state, s, return FALSE); r = GET_BITS(s); s = HUFF_EXTEND(r, s); } if (entropy->dc_needed[blkn]) { /* Convert DC difference to actual value, update last_dc_val */ int ci = cinfo->MCU_membership[blkn]; s += state.last_dc_val[ci]; state.last_dc_val[ci] = s; /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */ (*block)[0] = (JCOEF) s; } if (entropy->ac_needed[blkn]) { /* Section F.2.2.2: decode the AC coefficients */ /* Since zeroes are skipped, output area must be cleared beforehand */ for (k = 1; k < DCTSIZE2; k++) { HUFF_DECODE(s, br_state, actbl, return FALSE, label2); r = s >> 4; s &= 15; if (s) { k += r; CHECK_BIT_BUFFER(br_state, s, return FALSE); r = GET_BITS(s); s = HUFF_EXTEND(r, s); /* Output coefficient in natural (dezigzagged) order. * Note: the extra entries in jpeg_natural_order[] will save us * if k >= DCTSIZE2, which could happen if the data is corrupted. */ (*block)[jpeg_natural_order[k]] = (JCOEF) s; } else { if (r != 15) break; k += 15; } } } else { /* Section F.2.2.2: decode the AC coefficients */ /* In this path we just discard the values */ for (k = 1; k < DCTSIZE2; k++) { HUFF_DECODE(s, br_state, actbl, return FALSE, label3); r = s >> 4; s &= 15; if (s) { k += r; CHECK_BIT_BUFFER(br_state, s, return FALSE); DROP_BITS(s); } else { if (r != 15) break; k += 15; } } } } /* Completed MCU, so update state */ BITREAD_SAVE_STATE(cinfo,entropy->bitstate); ASSIGN_STATE(entropy->saved, state); } /* Account for restart interval (no-op if not using restarts) */ entropy->restarts_to_go--; return TRUE; } /* * Module initialization routine for Huffman entropy decoding. */ GLOBAL(void) jinit_shuff_decoder (j_decompress_ptr cinfo) { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; shuff_entropy_ptr entropy; int i; entropy = (shuff_entropy_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(shuff_entropy_decoder)); lossyd->entropy_private = (void *) entropy; lossyd->entropy_start_pass = start_pass_huff_decoder; lossyd->entropy_decode_mcu = decode_mcu; /* Mark tables unallocated */ for (i = 0; i < NUM_HUFF_TBLS; i++) { entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL; } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/TUVOK-README���������������������������������������������0000644�0001750�0001750�00000002027�12320456500�021607� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������This is a subset of the IJG's JPEG library, version 6, with some additional patches for reading lossless JPEGs, and some other modifications taken from the GDCM library. The IJG library can be found at: ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz The applied patch can be found at: ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/delegates/ljpeg-6b.tar.gz The GDCM homepage is: http://gdcm.sourceforge.net/ We strongly discourage you from using the version that exists here in your own software. You probably want to download the full IJG source distribution and use that. If you have a particular need to read losslessly-encoded JPEGs, the aforementioned patch or GDCM's version of the library would be of use to you. Do note that (so far) we have only encountered such images in evil DICOM files, so if you're wondering whether or not you need the patch in your application, you probably don't. Tuvok and IJG are distributed under different but compatible licenses. See the README document in this directory for details. ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jcphuff.c������������������������������������������������0000644�0001750�0001750�00000062400�12320456500�021613� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jcphuff.c * * Copyright (C) 1995-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains Huffman entropy encoding routines for progressive JPEG. * * We do not support output suspension in this module, since the library * currently does not allow multiple-scan files to be written with output * suspension. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossy.h" /* Private declarations for lossy codec */ #include "jchuff.h" /* Declarations shared with jc*huff.c */ #ifdef C_PROGRESSIVE_SUPPORTED /* Expanded entropy encoder object for progressive Huffman encoding. */ typedef struct { /* Mode flag: TRUE for optimization, FALSE for actual data output */ boolean gather_statistics; /* Bit-level coding status. * next_output_byte/free_in_buffer are local copies of cinfo->dest fields. */ JOCTET * next_output_byte; /* => next byte to write in buffer */ size_t free_in_buffer; /* # of byte spaces remaining in buffer */ INT32 put_buffer; /* current bit-accumulation buffer */ int put_bits; /* # of bits now in it */ j_compress_ptr cinfo; /* link to cinfo (needed for dump_buffer) */ /* Coding status for DC components */ int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ /* Coding status for AC components */ int ac_tbl_no; /* the table number of the single component */ unsigned int EOBRUN; /* run length of EOBs */ unsigned int BE; /* # of buffered correction bits before MCU */ char * bit_buffer; /* buffer for correction bits (1 per char) */ /* packing correction bits tightly would save some space but cost time... */ unsigned int restarts_to_go; /* MCUs left in this restart interval */ int next_restart_num; /* next restart number to write (0-7) */ /* Pointers to derived tables (these workspaces have image lifespan). * Since any one scan codes only DC or only AC, we only need one set * of tables, not one for DC and one for AC. */ c_derived_tbl * derived_tbls[NUM_HUFF_TBLS]; /* Statistics tables for optimization; again, one set is enough */ long * count_ptrs[NUM_HUFF_TBLS]; } phuff_entropy_encoder; typedef phuff_entropy_encoder * phuff_entropy_ptr; /* MAX_CORR_BITS is the number of bits the AC refinement correction-bit * buffer can hold. Larger sizes may slightly improve compression, but * 1000 is already well into the realm of overkill. * The minimum safe size is 64 bits. */ #define MAX_CORR_BITS 1000 /* Max # of correction bits I can buffer */ /* IRIGHT_SHIFT is like RIGHT_SHIFT, but works on int rather than INT32. * We assume that int right shift is unsigned if INT32 right shift is, * which should be safe. */ #ifdef RIGHT_SHIFT_IS_UNSIGNED #define ISHIFT_TEMPS int ishift_temp; #define IRIGHT_SHIFT(x,shft) \ ((ishift_temp = (x)) < 0 ? \ (ishift_temp >> (shft)) | ((~0) << (16-(shft))) : \ (ishift_temp >> (shft))) #else #define ISHIFT_TEMPS #define IRIGHT_SHIFT(x,shft) ((x) >> (shft)) #endif /* Forward declarations */ METHODDEF(boolean) encode_mcu_DC_first JPP((j_compress_ptr cinfo, JBLOCKROW *MCU_data)); METHODDEF(boolean) encode_mcu_AC_first JPP((j_compress_ptr cinfo, JBLOCKROW *MCU_data)); METHODDEF(boolean) encode_mcu_DC_refine JPP((j_compress_ptr cinfo, JBLOCKROW *MCU_data)); METHODDEF(boolean) encode_mcu_AC_refine JPP((j_compress_ptr cinfo, JBLOCKROW *MCU_data)); METHODDEF(void) finish_pass_phuff JPP((j_compress_ptr cinfo)); METHODDEF(void) finish_pass_gather_phuff JPP((j_compress_ptr cinfo)); /* * Initialize for a Huffman-compressed scan using progressive JPEG. */ METHODDEF(void) start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; phuff_entropy_ptr entropy = (phuff_entropy_ptr) lossyc->entropy_private; boolean is_DC_band; int ci, tbl; jpeg_component_info * compptr; entropy->cinfo = cinfo; entropy->gather_statistics = gather_statistics; is_DC_band = (cinfo->Ss == 0); /* We assume jcmaster.c already validated the scan parameters. */ /* Select execution routines */ if (cinfo->Ah == 0) { if (is_DC_band) lossyc->entropy_encode_mcu = encode_mcu_DC_first; else lossyc->entropy_encode_mcu = encode_mcu_AC_first; } else { if (is_DC_band) lossyc->entropy_encode_mcu = encode_mcu_DC_refine; else { lossyc->entropy_encode_mcu = encode_mcu_AC_refine; /* AC refinement needs a correction bit buffer */ if (entropy->bit_buffer == NULL) entropy->bit_buffer = (char *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, MAX_CORR_BITS * SIZEOF(char)); } } if (gather_statistics) lossyc->pub.entropy_finish_pass = finish_pass_gather_phuff; else lossyc->pub.entropy_finish_pass = finish_pass_phuff; /* Only DC coefficients may be interleaved, so cinfo->comps_in_scan = 1 * for AC coefficients. */ for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; /* Initialize DC predictions to 0 */ entropy->last_dc_val[ci] = 0; /* Get table index */ if (is_DC_band) { if (cinfo->Ah != 0) /* DC refinement needs no table */ continue; tbl = compptr->dc_tbl_no; } else { entropy->ac_tbl_no = tbl = compptr->ac_tbl_no; } if (gather_statistics) { /* Check for invalid table index */ /* (make_c_derived_tbl does this in the other path) */ if (tbl < 0 || tbl >= NUM_HUFF_TBLS) ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tbl); /* Allocate and zero the statistics tables */ /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */ if (entropy->count_ptrs[tbl] == NULL) entropy->count_ptrs[tbl] = (long *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, 257 * SIZEOF(long)); MEMZERO(entropy->count_ptrs[tbl], 257 * SIZEOF(long)); } else { /* Compute derived values for Huffman table */ /* We may do this more than once for a table, but it's not expensive */ jpeg_make_c_derived_tbl(cinfo, is_DC_band, tbl, & entropy->derived_tbls[tbl]); } } /* Initialize AC stuff */ entropy->EOBRUN = 0; entropy->BE = 0; /* Initialize bit buffer to empty */ entropy->put_buffer = 0; entropy->put_bits = 0; /* Initialize restart stuff */ entropy->restarts_to_go = cinfo->restart_interval; entropy->next_restart_num = 0; } /* Outputting bytes to the file. * NB: these must be called only when actually outputting, * that is, entropy->gather_statistics == FALSE. */ /* Emit a byte */ #define emit_byte(entropy,val) \ { *(entropy)->next_output_byte++ = (JOCTET) (val); \ if (--(entropy)->free_in_buffer == 0) \ dump_buffer(entropy); } LOCAL(void) dump_buffer (phuff_entropy_ptr entropy) /* Empty the output buffer; we do not support suspension in this module. */ { struct jpeg_destination_mgr * dest = entropy->cinfo->dest; if (! (*dest->empty_output_buffer) (entropy->cinfo)) ERREXIT(entropy->cinfo, JERR_CANT_SUSPEND); /* After a successful buffer dump, must reset buffer pointers */ entropy->next_output_byte = dest->next_output_byte; entropy->free_in_buffer = dest->free_in_buffer; } /* Outputting bits to the file */ /* Only the right 24 bits of put_buffer are used; the valid bits are * left-justified in this part. At most 16 bits can be passed to emit_bits * in one call, and we never retain more than 7 bits in put_buffer * between calls, so 24 bits are sufficient. */ INLINE LOCAL(void) emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size) /* Emit some bits, unless we are in gather mode */ { /* This routine is heavily used, so it's worth coding tightly. */ register INT32 put_buffer = (INT32) code; register int put_bits = entropy->put_bits; /* if size is 0, caller used an invalid Huffman table entry */ if (size == 0) ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE); if (entropy->gather_statistics) return; /* do nothing if we're only getting stats */ put_buffer &= (((INT32) 1)<<size) - 1; /* mask off any extra bits in code */ put_bits += size; /* new number of bits in buffer */ put_buffer <<= 24 - put_bits; /* align incoming bits */ put_buffer |= entropy->put_buffer; /* and merge with old buffer contents */ while (put_bits >= 8) { int c = (int) ((put_buffer >> 16) & 0xFF); emit_byte(entropy, c); if (c == 0xFF) { /* need to stuff a zero byte? */ emit_byte(entropy, 0); } put_buffer <<= 8; put_bits -= 8; } entropy->put_buffer = put_buffer; /* update variables */ entropy->put_bits = put_bits; } LOCAL(void) flush_bits (phuff_entropy_ptr entropy) { emit_bits(entropy, 0x7F, 7); /* fill any partial byte with ones */ entropy->put_buffer = 0; /* and reset bit-buffer to empty */ entropy->put_bits = 0; } /* * Emit (or just count) a Huffman symbol. */ INLINE LOCAL(void) emit_symbol (phuff_entropy_ptr entropy, int tbl_no, int symbol) { if (entropy->gather_statistics) entropy->count_ptrs[tbl_no][symbol]++; else { c_derived_tbl * tbl = entropy->derived_tbls[tbl_no]; emit_bits(entropy, tbl->ehufco[symbol], tbl->ehufsi[symbol]); } } /* * Emit bits from a correction bit buffer. */ LOCAL(void) emit_buffered_bits (phuff_entropy_ptr entropy, char * bufstart, unsigned int nbits) { if (entropy->gather_statistics) return; /* no real work */ while (nbits > 0) { emit_bits(entropy, (unsigned int) (*bufstart), 1); bufstart++; nbits--; } } /* * Emit any pending EOBRUN symbol. */ LOCAL(void) emit_eobrun (phuff_entropy_ptr entropy) { register int temp, nbits; if (entropy->EOBRUN > 0) { /* if there is any pending EOBRUN */ temp = entropy->EOBRUN; nbits = 0; while ((temp >>= 1)) nbits++; /* safety check: shouldn't happen given limited correction-bit buffer */ if (nbits > 14) ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE); emit_symbol(entropy, entropy->ac_tbl_no, nbits << 4); if (nbits) emit_bits(entropy, entropy->EOBRUN, nbits); entropy->EOBRUN = 0; /* Emit any buffered correction bits */ emit_buffered_bits(entropy, entropy->bit_buffer, entropy->BE); entropy->BE = 0; } } /* * Emit a restart marker & resynchronize predictions. */ LOCAL(void) emit_restart (phuff_entropy_ptr entropy, int restart_num) { int ci; emit_eobrun(entropy); if (! entropy->gather_statistics) { flush_bits(entropy); emit_byte(entropy, 0xFF); emit_byte(entropy, JPEG_RST0 + restart_num); } if (entropy->cinfo->Ss == 0) { /* Re-initialize DC predictions to 0 */ for (ci = 0; ci < entropy->cinfo->comps_in_scan; ci++) entropy->last_dc_val[ci] = 0; } else { /* Re-initialize all AC-related fields to 0 */ entropy->EOBRUN = 0; entropy->BE = 0; } } /* * MCU encoding for DC initial scan (either spectral selection, * or first pass of successive approximation). */ METHODDEF(boolean) encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; phuff_entropy_ptr entropy = (phuff_entropy_ptr) lossyc->entropy_private; register int temp, temp2; register int nbits; int blkn, ci; int Al = cinfo->Al; JBLOCKROW block; jpeg_component_info * compptr; ISHIFT_TEMPS entropy->next_output_byte = cinfo->dest->next_output_byte; entropy->free_in_buffer = cinfo->dest->free_in_buffer; /* Emit restart marker if needed */ if (cinfo->restart_interval) if (entropy->restarts_to_go == 0) emit_restart(entropy, entropy->next_restart_num); /* Encode the MCU data blocks */ for (blkn = 0; blkn < cinfo->data_units_in_MCU; blkn++) { block = MCU_data[blkn]; ci = cinfo->MCU_membership[blkn]; compptr = cinfo->cur_comp_info[ci]; /* Compute the DC value after the required point transform by Al. * This is simply an arithmetic right shift. */ temp2 = IRIGHT_SHIFT((int) ((*block)[0]), Al); /* DC differences are figured on the point-transformed values. */ temp = temp2 - entropy->last_dc_val[ci]; entropy->last_dc_val[ci] = temp2; /* Encode the DC coefficient difference per section G.1.2.1 */ temp2 = temp; if (temp < 0) { temp = -temp; /* temp is abs value of input */ /* For a negative input, want temp2 = bitwise complement of abs(input) */ /* This code assumes we are on a two's complement machine */ temp2--; } /* Find the number of bits needed for the magnitude of the coefficient */ nbits = 0; while (temp) { nbits++; temp >>= 1; } /* Check for out-of-range coefficient values. * Since we're encoding a difference, the range limit is twice as much. */ if (nbits > MAX_COEF_BITS+1) ERREXIT(cinfo, JERR_BAD_DCT_COEF); /* Count/emit the Huffman-coded symbol for the number of bits */ emit_symbol(entropy, compptr->dc_tbl_no, nbits); /* Emit that number of bits of the value, if positive, */ /* or the complement of its magnitude, if negative. */ if (nbits) /* emit_bits rejects calls with size 0 */ emit_bits(entropy, (unsigned int) temp2, nbits); } cinfo->dest->next_output_byte = entropy->next_output_byte; cinfo->dest->free_in_buffer = entropy->free_in_buffer; /* Update restart-interval state too */ if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) { entropy->restarts_to_go = cinfo->restart_interval; entropy->next_restart_num++; entropy->next_restart_num &= 7; } entropy->restarts_to_go--; } return TRUE; } /* * MCU encoding for AC initial scan (either spectral selection, * or first pass of successive approximation). */ METHODDEF(boolean) encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; phuff_entropy_ptr entropy = (phuff_entropy_ptr) lossyc->entropy_private; register int temp, temp2; register int nbits; register int r, k; int Se = cinfo->Se; int Al = cinfo->Al; JBLOCKROW block; entropy->next_output_byte = cinfo->dest->next_output_byte; entropy->free_in_buffer = cinfo->dest->free_in_buffer; /* Emit restart marker if needed */ if (cinfo->restart_interval) if (entropy->restarts_to_go == 0) emit_restart(entropy, entropy->next_restart_num); /* Encode the MCU data block */ block = MCU_data[0]; /* Encode the AC coefficients per section G.1.2.2, fig. G.3 */ r = 0; /* r = run length of zeros */ for (k = cinfo->Ss; k <= Se; k++) { if ((temp = (*block)[jpeg_natural_order[k]]) == 0) { r++; continue; } /* We must apply the point transform by Al. For AC coefficients this * is an integer division with rounding towards 0. To do this portably * in C, we shift after obtaining the absolute value; so the code is * interwoven with finding the abs value (temp) and output bits (temp2). */ if (temp < 0) { temp = -temp; /* temp is abs value of input */ temp >>= Al; /* apply the point transform */ /* For a negative coef, want temp2 = bitwise complement of abs(coef) */ temp2 = ~temp; } else { temp >>= Al; /* apply the point transform */ temp2 = temp; } /* Watch out for case that nonzero coef is zero after point transform */ if (temp == 0) { r++; continue; } /* Emit any pending EOBRUN */ if (entropy->EOBRUN > 0) emit_eobrun(entropy); /* if run length > 15, must emit special run-length-16 codes (0xF0) */ while (r > 15) { emit_symbol(entropy, entropy->ac_tbl_no, 0xF0); r -= 16; } /* Find the number of bits needed for the magnitude of the coefficient */ nbits = 1; /* there must be at least one 1 bit */ while ((temp >>= 1)) nbits++; /* Check for out-of-range coefficient values */ if (nbits > MAX_COEF_BITS) ERREXIT(cinfo, JERR_BAD_DCT_COEF); /* Count/emit Huffman symbol for run length / number of bits */ emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + nbits); /* Emit that number of bits of the value, if positive, */ /* or the complement of its magnitude, if negative. */ emit_bits(entropy, (unsigned int) temp2, nbits); r = 0; /* reset zero run length */ } if (r > 0) { /* If there are trailing zeroes, */ entropy->EOBRUN++; /* count an EOB */ if (entropy->EOBRUN == 0x7FFF) emit_eobrun(entropy); /* force it out to avoid overflow */ } cinfo->dest->next_output_byte = entropy->next_output_byte; cinfo->dest->free_in_buffer = entropy->free_in_buffer; /* Update restart-interval state too */ if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) { entropy->restarts_to_go = cinfo->restart_interval; entropy->next_restart_num++; entropy->next_restart_num &= 7; } entropy->restarts_to_go--; } return TRUE; } /* * MCU encoding for DC successive approximation refinement scan. * Note: we assume such scans can be multi-component, although the spec * is not very clear on the point. */ METHODDEF(boolean) encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; phuff_entropy_ptr entropy = (phuff_entropy_ptr) lossyc->entropy_private; register int temp; int blkn; int Al = cinfo->Al; JBLOCKROW block; entropy->next_output_byte = cinfo->dest->next_output_byte; entropy->free_in_buffer = cinfo->dest->free_in_buffer; /* Emit restart marker if needed */ if (cinfo->restart_interval) if (entropy->restarts_to_go == 0) emit_restart(entropy, entropy->next_restart_num); /* Encode the MCU data blocks */ for (blkn = 0; blkn < cinfo->data_units_in_MCU; blkn++) { block = MCU_data[blkn]; /* We simply emit the Al'th bit of the DC coefficient value. */ temp = (*block)[0]; emit_bits(entropy, (unsigned int) (temp >> Al), 1); } cinfo->dest->next_output_byte = entropy->next_output_byte; cinfo->dest->free_in_buffer = entropy->free_in_buffer; /* Update restart-interval state too */ if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) { entropy->restarts_to_go = cinfo->restart_interval; entropy->next_restart_num++; entropy->next_restart_num &= 7; } entropy->restarts_to_go--; } return TRUE; } /* * MCU encoding for AC successive approximation refinement scan. */ METHODDEF(boolean) encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; phuff_entropy_ptr entropy = (phuff_entropy_ptr) lossyc->entropy_private; register int temp; register int r, k; int EOB; char *BR_buffer; unsigned int BR; int Se = cinfo->Se; int Al = cinfo->Al; JBLOCKROW block; int absvalues[DCTSIZE2]; entropy->next_output_byte = cinfo->dest->next_output_byte; entropy->free_in_buffer = cinfo->dest->free_in_buffer; /* Emit restart marker if needed */ if (cinfo->restart_interval) if (entropy->restarts_to_go == 0) emit_restart(entropy, entropy->next_restart_num); /* Encode the MCU data block */ block = MCU_data[0]; /* It is convenient to make a pre-pass to determine the transformed * coefficients' absolute values and the EOB position. */ EOB = 0; for (k = cinfo->Ss; k <= Se; k++) { temp = (*block)[jpeg_natural_order[k]]; /* We must apply the point transform by Al. For AC coefficients this * is an integer division with rounding towards 0. To do this portably * in C, we shift after obtaining the absolute value. */ if (temp < 0) temp = -temp; /* temp is abs value of input */ temp >>= Al; /* apply the point transform */ absvalues[k] = temp; /* save abs value for main pass */ if (temp == 1) EOB = k; /* EOB = index of last newly-nonzero coef */ } /* Encode the AC coefficients per section G.1.2.3, fig. G.7 */ r = 0; /* r = run length of zeros */ BR = 0; /* BR = count of buffered bits added now */ BR_buffer = entropy->bit_buffer + entropy->BE; /* Append bits to buffer */ for (k = cinfo->Ss; k <= Se; k++) { if ((temp = absvalues[k]) == 0) { r++; continue; } /* Emit any required ZRLs, but not if they can be folded into EOB */ while (r > 15 && k <= EOB) { /* emit any pending EOBRUN and the BE correction bits */ emit_eobrun(entropy); /* Emit ZRL */ emit_symbol(entropy, entropy->ac_tbl_no, 0xF0); r -= 16; /* Emit buffered correction bits that must be associated with ZRL */ emit_buffered_bits(entropy, BR_buffer, BR); BR_buffer = entropy->bit_buffer; /* BE bits are gone now */ BR = 0; } /* If the coef was previously nonzero, it only needs a correction bit. * NOTE: a straight translation of the spec's figure G.7 would suggest * that we also need to test r > 15. But if r > 15, we can only get here * if k > EOB, which implies that this coefficient is not 1. */ if (temp > 1) { /* The correction bit is the next bit of the absolute value. */ BR_buffer[BR++] = (char) (temp & 1); continue; } /* Emit any pending EOBRUN and the BE correction bits */ emit_eobrun(entropy); /* Count/emit Huffman symbol for run length / number of bits */ emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + 1); /* Emit output bit for newly-nonzero coef */ temp = ((*block)[jpeg_natural_order[k]] < 0) ? 0 : 1; emit_bits(entropy, (unsigned int) temp, 1); /* Emit buffered correction bits that must be associated with this code */ emit_buffered_bits(entropy, BR_buffer, BR); BR_buffer = entropy->bit_buffer; /* BE bits are gone now */ BR = 0; r = 0; /* reset zero run length */ } if (r > 0 || BR > 0) { /* If there are trailing zeroes, */ entropy->EOBRUN++; /* count an EOB */ entropy->BE += BR; /* concat my correction bits to older ones */ /* We force out the EOB if we risk either: * 1. overflow of the EOB counter; * 2. overflow of the correction bit buffer during the next MCU. */ if (entropy->EOBRUN == 0x7FFF || entropy->BE > (MAX_CORR_BITS-DCTSIZE2+1)) emit_eobrun(entropy); } cinfo->dest->next_output_byte = entropy->next_output_byte; cinfo->dest->free_in_buffer = entropy->free_in_buffer; /* Update restart-interval state too */ if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) { entropy->restarts_to_go = cinfo->restart_interval; entropy->next_restart_num++; entropy->next_restart_num &= 7; } entropy->restarts_to_go--; } return TRUE; } /* * Finish up at the end of a Huffman-compressed progressive scan. */ METHODDEF(void) finish_pass_phuff (j_compress_ptr cinfo) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; phuff_entropy_ptr entropy = (phuff_entropy_ptr) lossyc->entropy_private; entropy->next_output_byte = cinfo->dest->next_output_byte; entropy->free_in_buffer = cinfo->dest->free_in_buffer; /* Flush out any buffered data */ emit_eobrun(entropy); flush_bits(entropy); cinfo->dest->next_output_byte = entropy->next_output_byte; cinfo->dest->free_in_buffer = entropy->free_in_buffer; } /* * Finish up a statistics-gathering pass and create the new Huffman tables. */ METHODDEF(void) finish_pass_gather_phuff (j_compress_ptr cinfo) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; phuff_entropy_ptr entropy = (phuff_entropy_ptr) lossyc->entropy_private; boolean is_DC_band; int ci, tbl; jpeg_component_info * compptr; JHUFF_TBL **htblptr; boolean did[NUM_HUFF_TBLS]; /* Flush out buffered data (all we care about is counting the EOB symbol) */ emit_eobrun(entropy); is_DC_band = (cinfo->Ss == 0); /* It's important not to apply jpeg_gen_optimal_table more than once * per table, because it clobbers the input frequency counts! */ MEMZERO(did, SIZEOF(did)); for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; if (is_DC_band) { if (cinfo->Ah != 0) /* DC refinement needs no table */ continue; tbl = compptr->dc_tbl_no; } else { tbl = compptr->ac_tbl_no; } if (! did[tbl]) { if (is_DC_band) htblptr = & cinfo->dc_huff_tbl_ptrs[tbl]; else htblptr = & cinfo->ac_huff_tbl_ptrs[tbl]; if (*htblptr == NULL) *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); jpeg_gen_optimal_table(cinfo, *htblptr, entropy->count_ptrs[tbl]); did[tbl] = TRUE; } } } METHODDEF(boolean) need_optimization_pass (j_compress_ptr cinfo) { return (cinfo->Ss != 0 || cinfo->Ah == 0); } /* * Module initialization routine for progressive Huffman entropy encoding. */ GLOBAL(void) jinit_phuff_encoder (j_compress_ptr cinfo) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; phuff_entropy_ptr entropy; int i; entropy = (phuff_entropy_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(phuff_entropy_encoder)); lossyc->entropy_private = (struct jpeg_entropy_encoder *) entropy; lossyc->pub.entropy_start_pass = start_pass_phuff; lossyc->pub.need_optimization_pass = need_optimization_pass; /* Mark tables unallocated */ for (i = 0; i < NUM_HUFF_TBLS; i++) { entropy->derived_tbls[i] = NULL; entropy->count_ptrs[i] = NULL; } entropy->bit_buffer = NULL; /* needed only in AC refinement scan */ } #endif /* C_PROGRESSIVE_SUPPORTED */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdatasrc.c�����������������������������������������������0000644�0001750�0001750�00000016703�12320456500�021766� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdatasrc.c * * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains decompression data source routines for the case of * reading JPEG data from a file (or any stdio stream). While these routines * are sufficient for most applications, some will want to use a different * source manager. * IMPORTANT: we assume that fread() will correctly transcribe an array of * JOCTETs from 8-bit-wide elements on external storage. If char is wider * than 8 bits on your machine, you may need to do some tweaking. */ /* this is not a core library module, so it doesn't define JPEG_INTERNALS */ #include "jinclude.h" #include "jpeglib.h" #include "jerror.h" /* Expanded data source object for stdio input */ typedef struct { struct jpeg_source_mgr pub; /* public fields */ FILE * infile; /* source stream */ JOCTET * buffer; /* start of buffer */ boolean start_of_file; /* have we gotten any data yet? */ } my_source_mgr; typedef my_source_mgr * my_src_ptr; #define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */ /* * Initialize source --- called by jpeg_read_header * before any data is actually read. */ METHODDEF(void) init_source (j_decompress_ptr cinfo) { my_src_ptr src = (my_src_ptr) cinfo->src; /* We reset the empty-input-file flag for each image, * but we don't clear the input buffer. * This is correct behavior for reading a series of images from one source. */ src->start_of_file = TRUE; } /* * Fill the input buffer --- called whenever buffer is emptied. * * In typical applications, this should read fresh data into the buffer * (ignoring the current state of next_input_byte & bytes_in_buffer), * reset the pointer & count to the start of the buffer, and return TRUE * indicating that the buffer has been reloaded. It is not necessary to * fill the buffer entirely, only to obtain at least one more byte. * * There is no such thing as an EOF return. If the end of the file has been * reached, the routine has a choice of ERREXIT() or inserting fake data into * the buffer. In most cases, generating a warning message and inserting a * fake EOI marker is the best course of action --- this will allow the * decompressor to output however much of the image is there. However, * the resulting error message is misleading if the real problem is an empty * input file, so we handle that case specially. * * In applications that need to be able to suspend compression due to input * not being available yet, a FALSE return indicates that no more data can be * obtained right now, but more may be forthcoming later. In this situation, * the decompressor will return to its caller (with an indication of the * number of scanlines it has read, if any). The application should resume * decompression after it has loaded more data into the input buffer. Note * that there are substantial restrictions on the use of suspension --- see * the documentation. * * When suspending, the decompressor will back up to a convenient restart point * (typically the start of the current MCU). next_input_byte & bytes_in_buffer * indicate where the restart point will be if the current call returns FALSE. * Data beyond this point must be rescanned after resumption, so move it to * the front of the buffer rather than discarding it. */ METHODDEF(boolean) fill_input_buffer (j_decompress_ptr cinfo) { my_src_ptr src = (my_src_ptr) cinfo->src; size_t nbytes; nbytes = JFREAD(src->infile, src->buffer, INPUT_BUF_SIZE); if (nbytes <= 0) { if (src->start_of_file) /* Treat empty input file as fatal error */ ERREXIT(cinfo, JERR_INPUT_EMPTY); WARNMS(cinfo, JWRN_JPEG_EOF); /* Insert a fake EOI marker */ src->buffer[0] = (JOCTET) 0xFF; src->buffer[1] = (JOCTET) JPEG_EOI; nbytes = 2; } src->pub.next_input_byte = src->buffer; src->pub.bytes_in_buffer = nbytes; src->start_of_file = FALSE; return TRUE; } /* * Skip data --- used to skip over a potentially large amount of * uninteresting data (such as an APPn marker). * * Writers of suspendable-input applications must note that skip_input_data * is not granted the right to give a suspension return. If the skip extends * beyond the data currently in the buffer, the buffer can be marked empty so * that the next read will cause a fill_input_buffer call that can suspend. * Arranging for additional bytes to be discarded before reloading the input * buffer is the application writer's problem. */ METHODDEF(void) skip_input_data (j_decompress_ptr cinfo, long num_bytes) { my_src_ptr src = (my_src_ptr) cinfo->src; /* Just a dumb implementation for now. Could use fseek() except * it doesn't work on pipes. Not clear that being smart is worth * any trouble anyway --- large skips are infrequent. */ if (num_bytes > 0) { while (num_bytes > (long) src->pub.bytes_in_buffer) { num_bytes -= (long) src->pub.bytes_in_buffer; (void) fill_input_buffer(cinfo); /* note we assume that fill_input_buffer will never return FALSE, * so suspension need not be handled. */ } src->pub.next_input_byte += (size_t) num_bytes; src->pub.bytes_in_buffer -= (size_t) num_bytes; } } /* * An additional method that can be provided by data source modules is the * resync_to_restart method for error recovery in the presence of RST markers. * For the moment, this source module just uses the default resync method * provided by the JPEG library. That method assumes that no backtracking * is possible. */ /* * Terminate source --- called by jpeg_finish_decompress * after all data has been read. Often a no-op. * * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding * application must deal with any cleanup that should happen even * for error exit. */ METHODDEF(void) term_source (j_decompress_ptr cinfo) { (void)cinfo; /* no work necessary here */ } /* * Prepare for input from a stdio stream. * The caller must have already opened the stream, and is responsible * for closing it after finishing decompression. */ GLOBAL(void) jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile) { my_src_ptr src; /* The source object and input buffer are made permanent so that a series * of JPEG images can be read from the same file by calling jpeg_stdio_src * only before the first one. (If we discarded the buffer at the end of * one image, we'd likely lose the start of the next one.) * This makes it unsafe to use this manager and a different source * manager serially with the same JPEG object. Caveat programmer. */ if (cinfo->src == NULL) { /* first time for this JPEG object? */ cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, SIZEOF(my_source_mgr)); src = (my_src_ptr) cinfo->src; src->buffer = (JOCTET *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, INPUT_BUF_SIZE * SIZEOF(JOCTET)); } src = (my_src_ptr) cinfo->src; src->pub.init_source = init_source; src->pub.fill_input_buffer = fill_input_buffer; src->pub.skip_input_data = skip_input_data; src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */ src->pub.term_source = term_source; src->infile = infile; src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */ src->pub.next_input_byte = NULL; /* until buffer loaded */ } �������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jcpred.c�������������������������������������������������0000644�0001750�0001750�00000020140�12320456500�021430� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jcpred.c * * Copyright (C) 1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains sample differencing for lossless JPEG. * * In order to avoid paying the performance penalty of having to check the * predictor being used and the row being processed for each call of the * undifferencer, and to promote optimization, we have separate differencing * functions for each case. * * We are able to avoid duplicating source code by implementing the predictors * and differencers as macros. Each of the differencing functions are * simply wrappers around a DIFFERENCE macro with the appropriate PREDICTOR * macro passed as an argument. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossls.h" /* Private declarations for lossless codec */ #ifdef C_LOSSLESS_SUPPORTED /* Private predictor object */ typedef struct { /* MCU-rows left in the restart interval for each component */ unsigned int restart_rows_to_go[MAX_COMPONENTS]; } c_predictor; typedef c_predictor * c_pred_ptr; /* Forward declarations */ LOCAL(void) reset_predictor JPP((j_compress_ptr cinfo, int ci)); METHODDEF(void) start_pass JPP((j_compress_ptr cinfo)); /* Predictor for the first column of the first row: 2^(P-Pt-1) */ #define INITIAL_PREDICTORx (1 << (cinfo->data_precision - cinfo->Al - 1)) /* Predictor for the first column of the remaining rows: Rb */ #define INITIAL_PREDICTOR2 GETJSAMPLE(prev_row[0]) /* * 1-Dimensional differencer routine. * * This macro implements the 1-D horizontal predictor (1). INITIAL_PREDICTOR * is used as the special case predictor for the first column, which must be * either INITIAL_PREDICTOR2 or INITIAL_PREDICTORx. The remaining samples * use PREDICTOR1. */ #define DIFFERENCE_1D(INITIAL_PREDICTOR) \ j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; \ c_pred_ptr pred = (c_pred_ptr) losslsc->pred_private; \ boolean restart = FALSE; \ unsigned int xindex; \ int samp, Ra; \ \ samp = GETJSAMPLE(input_buf[0]); \ diff_buf[0] = samp - INITIAL_PREDICTOR; \ \ for (xindex = 1; xindex < width; xindex++) { \ Ra = samp; \ samp = GETJSAMPLE(input_buf[xindex]); \ diff_buf[xindex] = samp - PREDICTOR1; \ } \ \ /* Account for restart interval (no-op if not using restarts) */ \ if (cinfo->restart_interval) { \ if (--(pred->restart_rows_to_go[ci]) == 0) { \ reset_predictor(cinfo, ci); \ restart = TRUE; \ } \ } /* * 2-Dimensional differencer routine. * * This macro implements the 2-D horizontal predictors (#2-7). PREDICTOR2 is * used as the special case predictor for the first column. The remaining * samples use PREDICTOR, which is a function of Ra, Rb, Rc. * * Because prev_row and output_buf may point to the same storage area (in an * interleaved image with Vi=1, for example), we must take care to buffer Rb/Rc * before writing the current reconstructed sample value into output_buf. */ #define DIFFERENCE_2D(PREDICTOR) \ j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; \ c_pred_ptr pred = (c_pred_ptr) losslsc->pred_private; \ unsigned int xindex; \ int samp, Ra, Rb, Rc; \ \ Rb = GETJSAMPLE(prev_row[0]); \ samp = GETJSAMPLE(input_buf[0]); \ diff_buf[0] = samp - PREDICTOR2; \ \ for (xindex = 1; xindex < width; xindex++) { \ Rc = Rb; \ Rb = GETJSAMPLE(prev_row[xindex]); \ Ra = samp; \ samp = GETJSAMPLE(input_buf[xindex]); \ diff_buf[xindex] = samp - PREDICTOR; \ } \ \ /* Account for restart interval (no-op if not using restarts) */ \ if (cinfo->restart_interval) { \ if (--pred->restart_rows_to_go[ci] == 0) \ reset_predictor(cinfo, ci); \ } /* * Differencers for the all rows but the first in a scan or restart interval. * The first sample in the row is differenced using the vertical * predictor (2). The rest of the samples are differenced using the * predictor specified in the scan header. */ METHODDEF(void) jpeg_difference1(j_compress_ptr cinfo, int ci, JSAMPROW input_buf, JSAMPROW prev_row, JDIFFROW diff_buf, JDIMENSION width) { DIFFERENCE_1D(INITIAL_PREDICTOR2); } METHODDEF(void) jpeg_difference2(j_compress_ptr cinfo, int ci, JSAMPROW input_buf, JSAMPROW prev_row, JDIFFROW diff_buf, JDIMENSION width) { DIFFERENCE_2D(PREDICTOR2); } METHODDEF(void) jpeg_difference3(j_compress_ptr cinfo, int ci, JSAMPROW input_buf, JSAMPROW prev_row, JDIFFROW diff_buf, JDIMENSION width) { DIFFERENCE_2D(PREDICTOR3); } METHODDEF(void) jpeg_difference4(j_compress_ptr cinfo, int ci, JSAMPROW input_buf, JSAMPROW prev_row, JDIFFROW diff_buf, JDIMENSION width) { DIFFERENCE_2D(PREDICTOR4); } METHODDEF(void) jpeg_difference5(j_compress_ptr cinfo, int ci, JSAMPROW input_buf, JSAMPROW prev_row, JDIFFROW diff_buf, JDIMENSION width) { SHIFT_TEMPS DIFFERENCE_2D(PREDICTOR5); } METHODDEF(void) jpeg_difference6(j_compress_ptr cinfo, int ci, JSAMPROW input_buf, JSAMPROW prev_row, JDIFFROW diff_buf, JDIMENSION width) { SHIFT_TEMPS DIFFERENCE_2D(PREDICTOR6); } METHODDEF(void) jpeg_difference7(j_compress_ptr cinfo, int ci, JSAMPROW input_buf, JSAMPROW prev_row, JDIFFROW diff_buf, JDIMENSION width) { SHIFT_TEMPS DIFFERENCE_2D(PREDICTOR7); } /* * Differencer for the first row in a scan or restart interval. The first * sample in the row is differenced using the special predictor constant * x=2^(P-Pt-1). The rest of the samples are differenced using the * 1-D horizontal predictor (1). */ METHODDEF(void) jpeg_difference_first_row(j_compress_ptr cinfo, int ci, JSAMPROW input_buf, JSAMPROW prev_row, JDIFFROW diff_buf, JDIMENSION width) { DIFFERENCE_1D(INITIAL_PREDICTORx); (void)prev_row; /* * Now that we have differenced the first row, we want to use the * differencer which corresponds to the predictor specified in the * scan header. * * Note that we don't to do this if we have just reset the predictor * for a new restart interval. */ if (!restart) { switch (cinfo->Ss) { case 1: losslsc->predict_difference[ci] = jpeg_difference1; break; case 2: losslsc->predict_difference[ci] = jpeg_difference2; break; case 3: losslsc->predict_difference[ci] = jpeg_difference3; break; case 4: losslsc->predict_difference[ci] = jpeg_difference4; break; case 5: losslsc->predict_difference[ci] = jpeg_difference5; break; case 6: losslsc->predict_difference[ci] = jpeg_difference6; break; case 7: losslsc->predict_difference[ci] = jpeg_difference7; break; } } } /* * Reset predictor at the start of a pass or restart interval. */ LOCAL(void) reset_predictor (j_compress_ptr cinfo, int ci) { j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; c_pred_ptr pred = (c_pred_ptr) losslsc->pred_private; /* Initialize restart counter */ pred->restart_rows_to_go[ci] = cinfo->restart_interval / cinfo->MCUs_per_row; /* Set difference function to first row function */ losslsc->predict_difference[ci] = jpeg_difference_first_row; } /* * Initialize for an input processing pass. */ METHODDEF(void) start_pass (j_compress_ptr cinfo) { /* j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; */ /* c_pred_ptr pred = (c_pred_ptr) losslsc->pred_private; */ int ci; /* Check that the restart interval is an integer multiple of the number * of MCU in an MCU-row. */ if (cinfo->restart_interval % cinfo->MCUs_per_row != 0) ERREXIT2(cinfo, JERR_BAD_RESTART, cinfo->restart_interval, cinfo->MCUs_per_row); /* Set predictors for start of pass */ for (ci = 0; ci < cinfo->num_components; ci++) reset_predictor(cinfo, ci); } /* * Module initialization routine for the differencer. */ GLOBAL(void) jinit_differencer (j_compress_ptr cinfo) { j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; c_pred_ptr pred; pred = (c_pred_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(c_predictor)); losslsc->pred_private = (void *) pred; losslsc->predict_start_pass = start_pass; } #endif /* C_LOSSLESS_SUPPORTED */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdmainct.c�����������������������������������������������0000644�0001750�0001750�00000050173�12320456500�021763� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdmainct.c * * Copyright (C) 1994-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains the main buffer controller for decompression. * The main buffer lies between the JPEG decompressor proper and the * post-processor; it holds downsampled data in the JPEG colorspace. * * Note that this code is bypassed in raw-data mode, since the application * supplies the equivalent of the main buffer in that case. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" /* * In the current system design, the main buffer need never be a full-image * buffer; any full-height buffers will be found inside the coefficient or * postprocessing controllers. Nonetheless, the main controller is not * trivial. Its responsibility is to provide context rows for upsampling/ * rescaling, and doing this in an efficient fashion is a bit tricky. * * Postprocessor input data is counted in "row groups". A row group * is defined to be (v_samp_factor * codec_data_unit / min_codec_data_unit) * sample rows of each component. (We require codec_data_unit values to be * chosen such that these numbers are integers. In practice codec_data_unit * values will likely be powers of two, so we actually have the stronger * condition that codec_data_unit / min_codec_data_unit is an integer.) * Upsampling will typically produce max_v_samp_factor pixel rows from each * row group (times any additional scale factor that the upsampler is * applying). * * The decompression codec will deliver data to us one iMCU row at a time; * each iMCU row contains v_samp_factor * codec_data_unit sample rows, or * exactly min_codec_data_unit row groups. (This amount of data corresponds * to one row of MCUs when the image is fully interleaved.) Note that the * number of sample rows varies across components, but the number of row * groups does not. Some garbage sample rows may be included in the last iMCU * row at the bottom of the image. * * Depending on the vertical scaling algorithm used, the upsampler may need * access to the sample row(s) above and below its current input row group. * The upsampler is required to set need_context_rows TRUE at global selection * time if so. When need_context_rows is FALSE, this controller can simply * obtain one iMCU row at a time from the coefficient controller and dole it * out as row groups to the postprocessor. * * When need_context_rows is TRUE, this controller guarantees that the buffer * passed to postprocessing contains at least one row group's worth of samples * above and below the row group(s) being processed. Note that the context * rows "above" the first passed row group appear at negative row offsets in * the passed buffer. At the top and bottom of the image, the required * context rows are manufactured by duplicating the first or last real sample * row; this avoids having special cases in the upsampling inner loops. * * The amount of context is fixed at one row group just because that's a * convenient number for this controller to work with. The existing * upsamplers really only need one sample row of context. An upsampler * supporting arbitrary output rescaling might wish for more than one row * group of context when shrinking the image; tough, we don't handle that. * (This is justified by the assumption that downsizing will be handled mostly * by adjusting the codec_data_unit values, so that the actual scale factor at * the upsample step needn't be much less than one.) * * To provide the desired context, we have to retain the last two row groups * of one iMCU row while reading in the next iMCU row. (The last row group * can't be processed until we have another row group for its below-context, * and so we have to save the next-to-last group too for its above-context.) * We could do this most simply by copying data around in our buffer, but * that'd be very slow. We can avoid copying any data by creating a rather * strange pointer structure. Here's how it works. We allocate a workspace * consisting of M+2 row groups (where M = min_codec_data_unit is the number * of row groups per iMCU row). We create two sets of redundant pointers to * the workspace. Labeling the physical row groups 0 to M+1, the synthesized * pointer lists look like this: * M+1 M-1 * master pointer --> 0 master pointer --> 0 * 1 1 * ... ... * M-3 M-3 * M-2 M * M-1 M+1 * M M-2 * M+1 M-1 * 0 0 * We read alternate iMCU rows using each master pointer; thus the last two * row groups of the previous iMCU row remain un-overwritten in the workspace. * The pointer lists are set up so that the required context rows appear to * be adjacent to the proper places when we pass the pointer lists to the * upsampler. * * The above pictures describe the normal state of the pointer lists. * At top and bottom of the image, we diddle the pointer lists to duplicate * the first or last sample row as necessary (this is cheaper than copying * sample rows around). * * This scheme breaks down if M < 2, ie, min_codec_data_unit is 1. In that * situation each iMCU row provides only one row group so the buffering logic * must be different (eg, we must read two iMCU rows before we can emit the * first row group). For now, we simply do not support providing context * rows when min_codec_data_unit is 1. That combination seems unlikely to * be worth providing --- if someone wants a 1/8th-size preview, they probably * want it quick and dirty, so a context-free upsampler is sufficient. */ /* Private buffer controller object */ typedef struct { struct jpeg_d_main_controller pub; /* public fields */ /* Pointer to allocated workspace (M or M+2 row groups). */ JSAMPARRAY buffer[MAX_COMPONENTS]; boolean buffer_full; /* Have we gotten an iMCU row from decoder? */ JDIMENSION rowgroup_ctr; /* counts row groups output to postprocessor */ /* Remaining fields are only used in the context case. */ /* These are the master pointers to the funny-order pointer lists. */ JSAMPIMAGE xbuffer[2]; /* pointers to weird pointer lists */ int whichptr; /* indicates which pointer set is now in use */ int context_state; /* process_data state machine status */ JDIMENSION rowgroups_avail; /* row groups available to postprocessor */ JDIMENSION iMCU_row_ctr; /* counts iMCU rows to detect image top/bot */ } my_main_controller; typedef my_main_controller * my_main_ptr; /* context_state values: */ #define CTX_PREPARE_FOR_IMCU 0 /* need to prepare for MCU row */ #define CTX_PROCESS_IMCU 1 /* feeding iMCU to postprocessor */ #define CTX_POSTPONED_ROW 2 /* feeding postponed row group */ /* Forward declarations */ METHODDEF(void) process_data_simple_main JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); METHODDEF(void) process_data_context_main JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); #ifdef QUANT_2PASS_SUPPORTED METHODDEF(void) process_data_crank_post JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); #endif LOCAL(void) alloc_funny_pointers (j_decompress_ptr cinfo) /* Allocate space for the funny pointer lists. * This is done only once, not once per pass. */ { my_main_ptr mainPtr = (my_main_ptr) cinfo->main; int ci, rgroup; int M = cinfo->min_codec_data_unit; jpeg_component_info *compptr; JSAMPARRAY xbuf; /* Get top-level space for component array pointers. * We alloc both arrays with one call to save a few cycles. */ mainPtr->xbuffer[0] = (JSAMPIMAGE) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, cinfo->num_components * 2 * SIZEOF(JSAMPARRAY)); mainPtr->xbuffer[1] = mainPtr->xbuffer[0] + cinfo->num_components; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { rgroup = (compptr->v_samp_factor * compptr->codec_data_unit) / cinfo->min_codec_data_unit; /* height of a row group of component */ /* Get space for pointer lists --- M+4 row groups in each list. * We alloc both pointer lists with one call to save a few cycles. */ xbuf = (JSAMPARRAY) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, 2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW)); xbuf += rgroup; /* want one row group at negative offsets */ mainPtr->xbuffer[0][ci] = xbuf; xbuf += rgroup * (M + 4); mainPtr->xbuffer[1][ci] = xbuf; } } LOCAL(void) make_funny_pointers (j_decompress_ptr cinfo) /* Create the funny pointer lists discussed in the comments above. * The actual workspace is already allocated (in mainPtr->buffer), * and the space for the pointer lists is allocated too. * This routine just fills in the curiously ordered lists. * This will be repeated at the beginning of each pass. */ { my_main_ptr mainPtr = (my_main_ptr) cinfo->main; int ci, i, rgroup; int M = cinfo->min_codec_data_unit; jpeg_component_info *compptr; JSAMPARRAY buf, xbuf0, xbuf1; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { rgroup = (compptr->v_samp_factor * compptr->codec_data_unit) / cinfo->min_codec_data_unit; /* height of a row group of component */ xbuf0 = mainPtr->xbuffer[0][ci]; xbuf1 = mainPtr->xbuffer[1][ci]; /* First copy the workspace pointers as-is */ buf = mainPtr->buffer[ci]; for (i = 0; i < rgroup * (M + 2); i++) { xbuf0[i] = xbuf1[i] = buf[i]; } /* In the second list, put the last four row groups in swapped order */ for (i = 0; i < rgroup * 2; i++) { xbuf1[rgroup*(M-2) + i] = buf[rgroup*M + i]; xbuf1[rgroup*M + i] = buf[rgroup*(M-2) + i]; } /* The wraparound pointers at top and bottom will be filled later * (see set_wraparound_pointers, below). Initially we want the "above" * pointers to duplicate the first actual data line. This only needs * to happen in xbuffer[0]. */ for (i = 0; i < rgroup; i++) { xbuf0[i - rgroup] = xbuf0[0]; } } } LOCAL(void) set_wraparound_pointers (j_decompress_ptr cinfo) /* Set up the "wraparound" pointers at top and bottom of the pointer lists. * This changes the pointer list state from top-of-image to the normal state. */ { my_main_ptr mainPtr = (my_main_ptr) cinfo->main; int ci, i, rgroup; int M = cinfo->min_codec_data_unit; jpeg_component_info *compptr; JSAMPARRAY xbuf0, xbuf1; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { rgroup = (compptr->v_samp_factor * compptr->codec_data_unit) / cinfo->min_codec_data_unit; /* height of a row group of component */ xbuf0 = mainPtr->xbuffer[0][ci]; xbuf1 = mainPtr->xbuffer[1][ci]; for (i = 0; i < rgroup; i++) { xbuf0[i - rgroup] = xbuf0[rgroup*(M+1) + i]; xbuf1[i - rgroup] = xbuf1[rgroup*(M+1) + i]; xbuf0[rgroup*(M+2) + i] = xbuf0[i]; xbuf1[rgroup*(M+2) + i] = xbuf1[i]; } } } LOCAL(void) set_bottom_pointers (j_decompress_ptr cinfo) /* Change the pointer lists to duplicate the last sample row at the bottom * of the image. whichptr indicates which xbuffer holds the final iMCU row. * Also sets rowgroups_avail to indicate number of nondummy row groups in row. */ { my_main_ptr mainPtr = (my_main_ptr) cinfo->main; int ci, i, rgroup, iMCUheight, rows_left; jpeg_component_info *compptr; JSAMPARRAY xbuf; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { /* Count sample rows in one iMCU row and in one row group */ iMCUheight = compptr->v_samp_factor * compptr->codec_data_unit; rgroup = iMCUheight / cinfo->min_codec_data_unit; /* Count nondummy sample rows remaining for this component */ rows_left = (int) (compptr->downsampled_height % (JDIMENSION) iMCUheight); if (rows_left == 0) rows_left = iMCUheight; /* Count nondummy row groups. Should get same answer for each component, * so we need only do it once. */ if (ci == 0) { mainPtr->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1); } /* Duplicate the last real sample row rgroup*2 times; this pads out the * last partial rowgroup and ensures at least one full rowgroup of context. */ xbuf = mainPtr->xbuffer[mainPtr->whichptr][ci]; for (i = 0; i < rgroup * 2; i++) { xbuf[rows_left + i] = xbuf[rows_left-1]; } } } /* * Initialize for a processing pass. */ METHODDEF(void) start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) { my_main_ptr mainPtr = (my_main_ptr) cinfo->main; switch (pass_mode) { case JBUF_PASS_THRU: if (cinfo->upsample->need_context_rows) { mainPtr->pub.process_data = process_data_context_main; make_funny_pointers(cinfo); /* Create the xbuffer[] lists */ mainPtr->whichptr = 0; /* Read first iMCU row into xbuffer[0] */ mainPtr->context_state = CTX_PREPARE_FOR_IMCU; mainPtr->iMCU_row_ctr = 0; } else { /* Simple case with no context needed */ mainPtr->pub.process_data = process_data_simple_main; } mainPtr->buffer_full = FALSE; /* Mark buffer empty */ mainPtr->rowgroup_ctr = 0; break; #ifdef QUANT_2PASS_SUPPORTED case JBUF_CRANK_DEST: /* For last pass of 2-pass quantization, just crank the postprocessor */ mainPtr->pub.process_data = process_data_crank_post; break; #endif default: ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); break; } } /* * Process some data. * This handles the simple case where no context is required. */ METHODDEF(void) process_data_simple_main (j_decompress_ptr cinfo, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail) { my_main_ptr mainPtr = (my_main_ptr) cinfo->main; JDIMENSION rowgroups_avail; /* Read input data if we haven't filled the main buffer yet */ if (! mainPtr->buffer_full) { if (! (*cinfo->codec->decompress_data) (cinfo, mainPtr->buffer)) return; /* suspension forced, can do nothing more */ mainPtr->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ } /* There are always min_codec_data_unit row groups in an iMCU row. */ rowgroups_avail = (JDIMENSION) cinfo->min_codec_data_unit; /* Note: at the bottom of the image, we may pass extra garbage row groups * to the postprocessor. The postprocessor has to check for bottom * of image anyway (at row resolution), so no point in us doing it too. */ /* Feed the postprocessor */ (*cinfo->post->post_process_data) (cinfo, mainPtr->buffer, &mainPtr->rowgroup_ctr, rowgroups_avail, output_buf, out_row_ctr, out_rows_avail); /* Has postprocessor consumed all the data yet? If so, mark buffer empty */ if (mainPtr->rowgroup_ctr >= rowgroups_avail) { mainPtr->buffer_full = FALSE; mainPtr->rowgroup_ctr = 0; } } /* * Process some data. * This handles the case where context rows must be provided. */ METHODDEF(void) process_data_context_main (j_decompress_ptr cinfo, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail) { my_main_ptr mainPtr = (my_main_ptr) cinfo->main; /* Read input data if we haven't filled the main buffer yet */ if (! mainPtr->buffer_full) { if (! (*cinfo->codec->decompress_data) (cinfo, mainPtr->xbuffer[mainPtr->whichptr])) return; /* suspension forced, can do nothing more */ mainPtr->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ mainPtr->iMCU_row_ctr++; /* count rows received */ } /* Postprocessor typically will not swallow all the input data it is handed * in one call (due to filling the output buffer first). Must be prepared * to exit and restart. This switch lets us keep track of how far we got. * Note that each case falls through to the next on successful completion. */ switch (mainPtr->context_state) { case CTX_POSTPONED_ROW: /* Call postprocessor using previously set pointers for postponed row */ (*cinfo->post->post_process_data) (cinfo, mainPtr->xbuffer[mainPtr->whichptr], &mainPtr->rowgroup_ctr, mainPtr->rowgroups_avail, output_buf, out_row_ctr, out_rows_avail); if (mainPtr->rowgroup_ctr < mainPtr->rowgroups_avail) return; /* Need to suspend */ mainPtr->context_state = CTX_PREPARE_FOR_IMCU; if (*out_row_ctr >= out_rows_avail) return; /* Postprocessor exactly filled output buf */ /*FALLTHROUGH*/ case CTX_PREPARE_FOR_IMCU: /* Prepare to process first M-1 row groups of this iMCU row */ mainPtr->rowgroup_ctr = 0; mainPtr->rowgroups_avail = (JDIMENSION) (cinfo->min_codec_data_unit - 1); /* Check for bottom of image: if so, tweak pointers to "duplicate" * the last sample row, and adjust rowgroups_avail to ignore padding rows. */ if (mainPtr->iMCU_row_ctr == cinfo->total_iMCU_rows) set_bottom_pointers(cinfo); mainPtr->context_state = CTX_PROCESS_IMCU; /*FALLTHROUGH*/ case CTX_PROCESS_IMCU: /* Call postprocessor using previously set pointers */ (*cinfo->post->post_process_data) (cinfo, mainPtr->xbuffer[mainPtr->whichptr], &mainPtr->rowgroup_ctr, mainPtr->rowgroups_avail, output_buf, out_row_ctr, out_rows_avail); if (mainPtr->rowgroup_ctr < mainPtr->rowgroups_avail) return; /* Need to suspend */ /* After the first iMCU, change wraparound pointers to normal state */ if (mainPtr->iMCU_row_ctr == 1) set_wraparound_pointers(cinfo); /* Prepare to load new iMCU row using other xbuffer list */ mainPtr->whichptr ^= 1; /* 0=>1 or 1=>0 */ mainPtr->buffer_full = FALSE; /* Still need to process last row group of this iMCU row, */ /* which is saved at index M+1 of the other xbuffer */ mainPtr->rowgroup_ctr = (JDIMENSION) (cinfo->min_codec_data_unit + 1); mainPtr->rowgroups_avail = (JDIMENSION) (cinfo->min_codec_data_unit + 2); mainPtr->context_state = CTX_POSTPONED_ROW; } } /* * Process some data. * Final pass of two-pass quantization: just call the postprocessor. * Source data will be the postprocessor controller's internal buffer. */ #ifdef QUANT_2PASS_SUPPORTED METHODDEF(void) process_data_crank_post (j_decompress_ptr cinfo, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail) { (*cinfo->post->post_process_data) (cinfo, (JSAMPIMAGE) NULL, (JDIMENSION *) NULL, (JDIMENSION) 0, output_buf, out_row_ctr, out_rows_avail); } #endif /* QUANT_2PASS_SUPPORTED */ /* * Initialize main buffer controller. */ GLOBAL(void) jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer) { my_main_ptr mainPtr; int ci, rgroup, ngroups; jpeg_component_info *compptr; mainPtr = (my_main_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_main_controller)); cinfo->main = (struct jpeg_d_main_controller *) mainPtr; mainPtr->pub.start_pass = start_pass_main; if (need_full_buffer) /* shouldn't happen */ ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); /* Allocate the workspace. * ngroups is the number of row groups we need. */ if (cinfo->upsample->need_context_rows) { if (cinfo->min_codec_data_unit < 2) /* unsupported, see comments above */ ERREXIT(cinfo, JERR_NOTIMPL); alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */ ngroups = cinfo->min_codec_data_unit + 2; } else { ngroups = cinfo->min_codec_data_unit; } for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { rgroup = (compptr->v_samp_factor * compptr->codec_data_unit) / cinfo->min_codec_data_unit; /* height of a row group of component */ mainPtr->buffer[ci] = (*cinfo->mem->alloc_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, compptr->width_in_data_units * compptr->codec_data_unit, (JDIMENSION) (rgroup * ngroups)); } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jcmarker.c�����������������������������������������������0000644�0001750�0001750�00000043102�12320456500�021762� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jcmarker.c * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains routines to write JPEG datastream markers. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" typedef enum { /* JPEG marker codes */ M_SOF0 = 0xc0, M_SOF1 = 0xc1, M_SOF2 = 0xc2, M_SOF3 = 0xc3, M_SOF5 = 0xc5, M_SOF6 = 0xc6, M_SOF7 = 0xc7, M_JPG = 0xc8, M_SOF9 = 0xc9, M_SOF10 = 0xca, M_SOF11 = 0xcb, M_SOF13 = 0xcd, M_SOF14 = 0xce, M_SOF15 = 0xcf, M_DHT = 0xc4, M_DAC = 0xcc, M_RST0 = 0xd0, M_RST1 = 0xd1, M_RST2 = 0xd2, M_RST3 = 0xd3, M_RST4 = 0xd4, M_RST5 = 0xd5, M_RST6 = 0xd6, M_RST7 = 0xd7, M_SOI = 0xd8, M_EOI = 0xd9, M_SOS = 0xda, M_DQT = 0xdb, M_DNL = 0xdc, M_DRI = 0xdd, M_DHP = 0xde, M_EXP = 0xdf, M_APP0 = 0xe0, M_APP1 = 0xe1, M_APP2 = 0xe2, M_APP3 = 0xe3, M_APP4 = 0xe4, M_APP5 = 0xe5, M_APP6 = 0xe6, M_APP7 = 0xe7, M_APP8 = 0xe8, M_APP9 = 0xe9, M_APP10 = 0xea, M_APP11 = 0xeb, M_APP12 = 0xec, M_APP13 = 0xed, M_APP14 = 0xee, M_APP15 = 0xef, M_JPG0 = 0xf0, M_JPG13 = 0xfd, M_COM = 0xfe, M_TEM = 0x01, M_ERROR = 0x100 } JPEG_MARKER; /* Private state */ typedef struct { struct jpeg_marker_writer pub; /* public fields */ unsigned int last_restart_interval; /* last DRI value emitted; 0 after SOI */ } my_marker_writer; typedef my_marker_writer * my_marker_ptr; /* * Basic output routines. * * Note that we do not support suspension while writing a marker. * Therefore, an application using suspension must ensure that there is * enough buffer space for the initial markers (typ. 600-700 bytes) before * calling jpeg_start_compress, and enough space to write the trailing EOI * (a few bytes) before calling jpeg_finish_compress. Multipass compression * modes are not supported at all with suspension, so those two are the only * points where markers will be written. */ LOCAL(void) emit_byte (j_compress_ptr cinfo, int val) /* Emit a byte */ { struct jpeg_destination_mgr * dest = cinfo->dest; *(dest->next_output_byte)++ = (JOCTET) val; if (--dest->free_in_buffer == 0) { if (! (*dest->empty_output_buffer) (cinfo)) ERREXIT(cinfo, JERR_CANT_SUSPEND); } } LOCAL(void) emit_marker (j_compress_ptr cinfo, JPEG_MARKER mark) /* Emit a marker code */ { emit_byte(cinfo, 0xFF); emit_byte(cinfo, (int) mark); } LOCAL(void) emit_2bytes (j_compress_ptr cinfo, int value) /* Emit a 2-byte integer; these are always MSB first in JPEG files */ { emit_byte(cinfo, (value >> 8) & 0xFF); emit_byte(cinfo, value & 0xFF); } /* * Routines to write specific marker types. */ LOCAL(int) emit_dqt (j_compress_ptr cinfo, int index) /* Emit a DQT marker */ /* Returns the precision used (0 = 8bits, 1 = 16bits) for baseline checking */ { JQUANT_TBL * qtbl = cinfo->quant_tbl_ptrs[index]; int prec; int i; if (qtbl == NULL) ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, index); prec = 0; for (i = 0; i < DCTSIZE2; i++) { if (qtbl->quantval[i] > 255) prec = 1; } if (! qtbl->sent_table) { emit_marker(cinfo, M_DQT); emit_2bytes(cinfo, prec ? DCTSIZE2*2 + 1 + 2 : DCTSIZE2 + 1 + 2); emit_byte(cinfo, index + (prec<<4)); for (i = 0; i < DCTSIZE2; i++) { /* The table entries must be emitted in zigzag order. */ unsigned int qval = qtbl->quantval[jpeg_natural_order[i]]; if (prec) emit_byte(cinfo, (int) (qval >> 8)); emit_byte(cinfo, (int) (qval & 0xFF)); } qtbl->sent_table = TRUE; } return prec; } LOCAL(void) emit_dht (j_compress_ptr cinfo, int index, boolean is_ac) /* Emit a DHT marker */ { JHUFF_TBL * htbl; int length, i; if (is_ac) { htbl = cinfo->ac_huff_tbl_ptrs[index]; index += 0x10; /* output index has AC bit set */ } else { htbl = cinfo->dc_huff_tbl_ptrs[index]; } if (htbl == NULL) ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index); if (! htbl->sent_table) { emit_marker(cinfo, M_DHT); length = 0; for (i = 1; i <= 16; i++) length += htbl->bits[i]; emit_2bytes(cinfo, length + 2 + 1 + 16); emit_byte(cinfo, index); for (i = 1; i <= 16; i++) emit_byte(cinfo, htbl->bits[i]); for (i = 0; i < length; i++) emit_byte(cinfo, htbl->huffval[i]); htbl->sent_table = TRUE; } } LOCAL(void) emit_dac (j_compress_ptr cinfo) /* Emit a DAC marker */ /* Since the useful info is so small, we want to emit all the tables in */ /* one DAC marker. Therefore this routine does its own scan of the table. */ { #ifdef C_ARITH_CODING_SUPPORTED char dc_in_use[NUM_ARITH_TBLS]; char ac_in_use[NUM_ARITH_TBLS]; int length, i; jpeg_component_info *compptr; for (i = 0; i < NUM_ARITH_TBLS; i++) dc_in_use[i] = ac_in_use[i] = 0; for (i = 0; i < cinfo->comps_in_scan; i++) { compptr = cinfo->cur_comp_info[i]; dc_in_use[compptr->dc_tbl_no] = 1; ac_in_use[compptr->ac_tbl_no] = 1; } length = 0; for (i = 0; i < NUM_ARITH_TBLS; i++) length += dc_in_use[i] + ac_in_use[i]; emit_marker(cinfo, M_DAC); emit_2bytes(cinfo, length*2 + 2); for (i = 0; i < NUM_ARITH_TBLS; i++) { if (dc_in_use[i]) { emit_byte(cinfo, i); emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i]<<4)); } if (ac_in_use[i]) { emit_byte(cinfo, i + 0x10); emit_byte(cinfo, cinfo->arith_ac_K[i]); } } #else (void)cinfo; #endif /* C_ARITH_CODING_SUPPORTED */ } LOCAL(void) emit_dri (j_compress_ptr cinfo) /* Emit a DRI marker */ { emit_marker(cinfo, M_DRI); emit_2bytes(cinfo, 4); /* fixed length */ emit_2bytes(cinfo, (int) cinfo->restart_interval); } LOCAL(void) emit_sof (j_compress_ptr cinfo, JPEG_MARKER code) /* Emit a SOF marker */ { int ci; jpeg_component_info *compptr; emit_marker(cinfo, code); emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */ /* Make sure image isn't bigger than SOF field can handle */ if ((long) cinfo->image_height > 65535L || (long) cinfo->image_width > 65535L) ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) 65535); emit_byte(cinfo, cinfo->data_precision); emit_2bytes(cinfo, (int) cinfo->image_height); emit_2bytes(cinfo, (int) cinfo->image_width); emit_byte(cinfo, cinfo->num_components); for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { emit_byte(cinfo, compptr->component_id); emit_byte(cinfo, (compptr->h_samp_factor << 4) + compptr->v_samp_factor); emit_byte(cinfo, compptr->quant_tbl_no); } } LOCAL(void) emit_sos (j_compress_ptr cinfo) /* Emit a SOS marker */ { int i, td, ta; jpeg_component_info *compptr; emit_marker(cinfo, M_SOS); emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */ emit_byte(cinfo, cinfo->comps_in_scan); for (i = 0; i < cinfo->comps_in_scan; i++) { compptr = cinfo->cur_comp_info[i]; emit_byte(cinfo, compptr->component_id); td = compptr->dc_tbl_no; ta = compptr->ac_tbl_no; if (cinfo->process == JPROC_PROGRESSIVE) { /* Progressive mode: only DC or only AC tables are used in one scan; * furthermore, Huffman coding of DC refinement uses no table at all. * We emit 0 for unused field(s); this is recommended by the P&M text * but does not seem to be specified in the standard. */ if (cinfo->Ss == 0) { ta = 0; /* DC scan */ if (cinfo->Ah != 0 && !cinfo->arith_code) td = 0; /* no DC table either */ } else { td = 0; /* AC scan */ } } emit_byte(cinfo, (td << 4) + ta); } emit_byte(cinfo, cinfo->Ss); emit_byte(cinfo, cinfo->Se); emit_byte(cinfo, (cinfo->Ah << 4) + cinfo->Al); } LOCAL(void) emit_jfif_app0 (j_compress_ptr cinfo) /* Emit a JFIF-compliant APP0 marker */ { /* * Length of APP0 block (2 bytes) * Block ID (4 bytes - ASCII "JFIF") * Zero byte (1 byte to terminate the ID string) * Version Major, Minor (2 bytes - major first) * Units (1 byte - 0x00 = none, 0x01 = inch, 0x02 = cm) * Xdpu (2 bytes - dots per unit horizontal) * Ydpu (2 bytes - dots per unit vertical) * Thumbnail X size (1 byte) * Thumbnail Y size (1 byte) */ emit_marker(cinfo, M_APP0); emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */ emit_byte(cinfo, 0x4A); /* Identifier: ASCII "JFIF" */ emit_byte(cinfo, 0x46); emit_byte(cinfo, 0x49); emit_byte(cinfo, 0x46); emit_byte(cinfo, 0); emit_byte(cinfo, cinfo->JFIF_major_version); /* Version fields */ emit_byte(cinfo, cinfo->JFIF_minor_version); emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */ emit_2bytes(cinfo, (int) cinfo->X_density); emit_2bytes(cinfo, (int) cinfo->Y_density); emit_byte(cinfo, 0); /* No thumbnail image */ emit_byte(cinfo, 0); } LOCAL(void) emit_adobe_app14 (j_compress_ptr cinfo) /* Emit an Adobe APP14 marker */ { /* * Length of APP14 block (2 bytes) * Block ID (5 bytes - ASCII "Adobe") * Version Number (2 bytes - currently 100) * Flags0 (2 bytes - currently 0) * Flags1 (2 bytes - currently 0) * Color transform (1 byte) * * Although Adobe TN 5116 mentions Version = 101, all the Adobe files * now in circulation seem to use Version = 100, so that's what we write. * * We write the color transform byte as 1 if the JPEG color space is * YCbCr, 2 if it's YCCK, 0 otherwise. Adobe's definition has to do with * whether the encoder performed a transformation, which is pretty useless. */ emit_marker(cinfo, M_APP14); emit_2bytes(cinfo, 2 + 5 + 2 + 2 + 2 + 1); /* length */ emit_byte(cinfo, 0x41); /* Identifier: ASCII "Adobe" */ emit_byte(cinfo, 0x64); emit_byte(cinfo, 0x6F); emit_byte(cinfo, 0x62); emit_byte(cinfo, 0x65); emit_2bytes(cinfo, 100); /* Version */ emit_2bytes(cinfo, 0); /* Flags0 */ emit_2bytes(cinfo, 0); /* Flags1 */ switch (cinfo->jpeg_color_space) { case JCS_YCbCr: emit_byte(cinfo, 1); /* Color transform = 1 */ break; case JCS_YCCK: emit_byte(cinfo, 2); /* Color transform = 2 */ break; default: emit_byte(cinfo, 0); /* Color transform = 0 */ break; } } /* * These routines allow writing an arbitrary marker with parameters. * The only intended use is to emit COM or APPn markers after calling * write_file_header and before calling write_frame_header. * Other uses are not guaranteed to produce desirable results. * Counting the parameter bytes properly is the caller's responsibility. */ METHODDEF(void) write_marker_header (j_compress_ptr cinfo, int marker, unsigned int datalen) /* Emit an arbitrary marker header */ { if (datalen > (unsigned int) 65533) /* safety check */ ERREXIT(cinfo, JERR_BAD_LENGTH); emit_marker(cinfo, (JPEG_MARKER) marker); emit_2bytes(cinfo, (int) (datalen + 2)); /* total length */ } METHODDEF(void) write_marker_byte (j_compress_ptr cinfo, int val) /* Emit one byte of marker parameters following write_marker_header */ { emit_byte(cinfo, val); } /* * Write datastream header. * This consists of an SOI and optional APPn markers. * We recommend use of the JFIF marker, but not the Adobe marker, * when using YCbCr or grayscale data. The JFIF marker should NOT * be used for any other JPEG colorspace. The Adobe marker is helpful * to distinguish RGB, CMYK, and YCCK colorspaces. * Note that an application can write additional header markers after * jpeg_start_compress returns. */ METHODDEF(void) write_file_header (j_compress_ptr cinfo) { my_marker_ptr marker = (my_marker_ptr) cinfo->marker; emit_marker(cinfo, M_SOI); /* first the SOI */ /* SOI is defined to reset restart interval to 0 */ marker->last_restart_interval = 0; if (cinfo->write_JFIF_header) /* next an optional JFIF APP0 */ emit_jfif_app0(cinfo); if (cinfo->write_Adobe_marker) /* next an optional Adobe APP14 */ emit_adobe_app14(cinfo); } /* * Write frame header. * This consists of DQT and SOFn markers. * Note that we do not emit the SOF until we have emitted the DQT(s). * This avoids compatibility problems with incorrect implementations that * try to error-check the quant table numbers as soon as they see the SOF. */ METHODDEF(void) write_frame_header (j_compress_ptr cinfo) { int ci, prec; boolean is_baseline; jpeg_component_info *compptr; prec = 0; if (cinfo->process != JPROC_LOSSLESS) { /* Emit DQT for each quantization table. * Note that emit_dqt() suppresses any duplicate tables. */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { prec += emit_dqt(cinfo, compptr->quant_tbl_no); } /* now prec is nonzero iff there are any 16-bit quant tables. */ } /* Check for a non-baseline specification. * Note we assume that Huffman table numbers won't be changed later. */ if (cinfo->arith_code || cinfo->process != JPROC_SEQUENTIAL || cinfo->data_precision != 8) { is_baseline = FALSE; } else { is_baseline = TRUE; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { if (compptr->dc_tbl_no > 1 || compptr->ac_tbl_no > 1) is_baseline = FALSE; } if (prec && is_baseline) { is_baseline = FALSE; /* If it's baseline except for quantizer size, warn the user */ TRACEMS(cinfo, 0, JTRC_16BIT_TABLES); } } /* Emit the proper SOF marker */ if (cinfo->arith_code) { #ifdef WITH_ARITHMETIC_PATCH if (cinfo->process == JPROC_PROGRESSIVE) emit_sof(cinfo, M_SOF10); /* SOF code for progressive arithmetic */ else if (cinfo->process == JPROC_LOSSLESS) emit_sof(cinfo, M_SOF11); /* SOF code for lossless arithmetic */ else emit_sof(cinfo, M_SOF9); /* SOF code for sequential arithmetic */ #else emit_sof(cinfo, M_SOF9); /* SOF code for arithmetic coding */ #endif } else { if (cinfo->process == JPROC_PROGRESSIVE) emit_sof(cinfo, M_SOF2); /* SOF code for progressive Huffman */ else if (cinfo->process == JPROC_LOSSLESS) emit_sof(cinfo, M_SOF3); /* SOF code for lossless Huffman */ else if (is_baseline) emit_sof(cinfo, M_SOF0); /* SOF code for baseline implementation */ else emit_sof(cinfo, M_SOF1); /* SOF code for non-baseline Huffman file */ } } /* * Write scan header. * This consists of DHT or DAC markers, optional DRI, and SOS. * Compressed data will be written following the SOS. */ METHODDEF(void) write_scan_header (j_compress_ptr cinfo) { my_marker_ptr marker = (my_marker_ptr) cinfo->marker; int i; jpeg_component_info *compptr; if (cinfo->arith_code) { /* Emit arith conditioning info. We may have some duplication * if the file has multiple scans, but it's so small it's hardly * worth worrying about. */ emit_dac(cinfo); } else { /* Emit Huffman tables. * Note that emit_dht() suppresses any duplicate tables. */ for (i = 0; i < cinfo->comps_in_scan; i++) { compptr = cinfo->cur_comp_info[i]; if (cinfo->process == JPROC_PROGRESSIVE) { /* Progressive mode: only DC or only AC tables are used in one scan */ if (cinfo->Ss == 0) { if (cinfo->Ah == 0) /* DC needs no table for refinement scan */ emit_dht(cinfo, compptr->dc_tbl_no, FALSE); } else { emit_dht(cinfo, compptr->ac_tbl_no, TRUE); } } else if (cinfo->process == JPROC_LOSSLESS) { /* Lossless mode: only DC tables are used */ emit_dht(cinfo, compptr->dc_tbl_no, FALSE); } else { /* Sequential mode: need both DC and AC tables */ emit_dht(cinfo, compptr->dc_tbl_no, FALSE); emit_dht(cinfo, compptr->ac_tbl_no, TRUE); } } } /* Emit DRI if required --- note that DRI value could change for each scan. * We avoid wasting space with unnecessary DRIs, however. */ if (cinfo->restart_interval != marker->last_restart_interval) { emit_dri(cinfo); marker->last_restart_interval = cinfo->restart_interval; } emit_sos(cinfo); } /* * Write datastream trailer. */ METHODDEF(void) write_file_trailer (j_compress_ptr cinfo) { emit_marker(cinfo, M_EOI); } /* * Write an abbreviated table-specification datastream. * This consists of SOI, DQT and DHT tables, and EOI. * Any table that is defined and not marked sent_table = TRUE will be * emitted. Note that all tables will be marked sent_table = TRUE at exit. */ METHODDEF(void) write_tables_only (j_compress_ptr cinfo) { int i; emit_marker(cinfo, M_SOI); for (i = 0; i < NUM_QUANT_TBLS; i++) { if (cinfo->quant_tbl_ptrs[i] != NULL) (void) emit_dqt(cinfo, i); } if (! cinfo->arith_code) { for (i = 0; i < NUM_HUFF_TBLS; i++) { if (cinfo->dc_huff_tbl_ptrs[i] != NULL) emit_dht(cinfo, i, FALSE); if (cinfo->ac_huff_tbl_ptrs[i] != NULL) emit_dht(cinfo, i, TRUE); } } emit_marker(cinfo, M_EOI); } /* * Initialize the marker writer module. */ GLOBAL(void) jinit_marker_writer (j_compress_ptr cinfo) { my_marker_ptr marker; /* Create the subobject */ marker = (my_marker_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_marker_writer)); cinfo->marker = (struct jpeg_marker_writer *) marker; /* Initialize method pointers */ marker->pub.write_file_header = write_file_header; marker->pub.write_frame_header = write_frame_header; marker->pub.write_scan_header = write_scan_header; marker->pub.write_file_trailer = write_file_trailer; marker->pub.write_tables_only = write_tables_only; marker->pub.write_marker_header = write_marker_header; marker->pub.write_marker_byte = write_marker_byte; /* Initialize private state */ marker->last_restart_interval = 0; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jmemnobs.c�����������������������������������������������0000644�0001750�0001750�00000005671�12320456500�022007� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jmemnobs.c * * Copyright (C) 1992-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file provides a really simple implementation of the system- * dependent portion of the JPEG memory manager. This implementation * assumes that no backing-store files are needed: all required space * can be obtained from malloc(). * This is very portable in the sense that it'll compile on almost anything, * but you'd better have lots of main memory (or virtual memory) if you want * to process big images. * Note that the max_memory_to_use option is ignored by this implementation. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jmemsys.h" /* import the system-dependent declarations */ #ifndef HAVE_STDLIB_H /* <stdlib.h> should declare malloc(),free() */ extern void * malloc JPP((size_t size)); extern void free JPP((void *ptr)); #endif /* * Memory allocation and freeing are controlled by the regular library * routines malloc() and free(). */ GLOBAL(void *) jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) { (void)cinfo; return (void *) malloc(sizeofobject); } GLOBAL(void) jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) { (void)cinfo;(void)sizeofobject; free(object); } /* * "Large" objects are treated the same as "small" ones. * NB: although we include FAR keywords in the routine declarations, * this file won't actually work in 80x86 small/medium model; at least, * you probably won't be able to process useful-size images in only 64KB. */ GLOBAL(void FAR *) jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) { (void)cinfo; return (void FAR *) malloc(sizeofobject); } GLOBAL(void) jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) { (void)cinfo;(void)sizeofobject; free(object); } /* * This routine computes the total memory space available for allocation. * Here we always say, "we got all you want bud!" */ GLOBAL(long) jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, long max_bytes_needed, long already_allocated) { (void)cinfo;(void)min_bytes_needed;(void)already_allocated; return max_bytes_needed; } /* * Backing store (temporary file) management. * Since jpeg_mem_available always promised the moon, * this should never be called and we can just error out. */ GLOBAL(void) jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed) { (void)info;(void)total_bytes_needed; ERREXIT(cinfo, JERR_NO_BACKING_STORE); } /* * These routines take care of any system-dependent initialization and * cleanup required. Here, there isn't any. */ GLOBAL(long) jpeg_mem_init (j_common_ptr cinfo) { (void)cinfo; return 0; /* just set max_memory_to_use to 0 */ } GLOBAL(void) jpeg_mem_term (j_common_ptr cinfo) { (void)cinfo; /* no work */ } �����������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdmerge.c������������������������������������������������0000644�0001750�0001750�00000033253�12320456500�021607� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdmerge.c * * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains code for merged upsampling/color conversion. * * This file combines functions from jdsample.c and jdcolor.c; * read those files first to understand what's going on. * * When the chroma components are to be upsampled by simple replication * (ie, box filtering), we can save some work in color conversion by * calculating all the output pixels corresponding to a pair of chroma * samples at one time. In the conversion equations * R = Y + K1 * Cr * G = Y + K2 * Cb + K3 * Cr * B = Y + K4 * Cb * only the Y term varies among the group of pixels corresponding to a pair * of chroma samples, so the rest of the terms can be calculated just once. * At typical sampling ratios, this eliminates half or three-quarters of the * multiplications needed for color conversion. * * This file currently provides implementations for the following cases: * YCbCr => RGB color conversion only. * Sampling ratios of 2h1v or 2h2v. * No scaling needed at upsample time. * Corner-aligned (non-CCIR601) sampling alignment. * Other special cases could be added, but in most applications these are * the only common cases. (For uncommon cases we fall back on the more * general code in jdsample.c and jdcolor.c.) */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #ifdef UPSAMPLE_MERGING_SUPPORTED /* Private subobject */ typedef struct { struct jpeg_upsampler pub; /* public fields */ /* Pointer to routine to do actual upsampling/conversion of one row group */ JMETHOD(void, upmethod, (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); /* Private state for YCC->RGB conversion */ int * Cr_r_tab; /* => table for Cr to R conversion */ int * Cb_b_tab; /* => table for Cb to B conversion */ INT32 * Cr_g_tab; /* => table for Cr to G conversion */ INT32 * Cb_g_tab; /* => table for Cb to G conversion */ /* For 2:1 vertical sampling, we produce two output rows at a time. * We need a "spare" row buffer to hold the second output row if the * application provides just a one-row buffer; we also use the spare * to discard the dummy last row if the image height is odd. */ JSAMPROW spare_row; boolean spare_full; /* T if spare buffer is occupied */ JDIMENSION out_row_width; /* samples per output row */ JDIMENSION rows_to_go; /* counts rows remaining in image */ } my_upsampler; typedef my_upsampler * my_upsample_ptr; #define SCALEBITS 16 /* speediest right-shift on some machines */ #define ONE_HALF ((INT32) 1 << (SCALEBITS-1)) #define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5)) /* * Initialize tables for YCC->RGB colorspace conversion. * This is taken directly from jdcolor.c; see that file for more info. */ LOCAL(void) build_ycc_rgb_table (j_decompress_ptr cinfo) { my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; int i; INT32 x; SHIFT_TEMPS upsample->Cr_r_tab = (int *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int)); upsample->Cb_b_tab = (int *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int)); upsample->Cr_g_tab = (INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(INT32)); upsample->Cb_g_tab = (INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(INT32)); for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) { /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */ /* Cr=>R value is nearest int to 1.40200 * x */ upsample->Cr_r_tab[i] = (int) RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS); /* Cb=>B value is nearest int to 1.77200 * x */ upsample->Cb_b_tab[i] = (int) RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS); /* Cr=>G value is scaled-up -0.71414 * x */ upsample->Cr_g_tab[i] = (- FIX(0.71414)) * x; /* Cb=>G value is scaled-up -0.34414 * x */ /* We also add in ONE_HALF so that need not do it in inner loop */ upsample->Cb_g_tab[i] = (- FIX(0.34414)) * x + ONE_HALF; } } /* * Initialize for an upsampling pass. */ METHODDEF(void) start_pass_merged_upsample (j_decompress_ptr cinfo) { my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; /* Mark the spare buffer empty */ upsample->spare_full = FALSE; /* Initialize total-height counter for detecting bottom of image */ upsample->rows_to_go = cinfo->output_height; } /* * Control routine to do upsampling (and color conversion). * * The control routine just handles the row buffering considerations. */ METHODDEF(void) merged_2v_upsample (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail) /* 2:1 vertical sampling case: may need a spare row. */ { my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; JSAMPROW work_ptrs[2]; JDIMENSION num_rows; /* number of rows returned to caller */ (void)in_row_groups_avail; if (upsample->spare_full) { /* If we have a spare row saved from a previous cycle, just return it. */ jcopy_sample_rows(& upsample->spare_row, 0, output_buf + *out_row_ctr, 0, 1, upsample->out_row_width); num_rows = 1; upsample->spare_full = FALSE; } else { /* Figure number of rows to return to caller. */ num_rows = 2; /* Not more than the distance to the end of the image. */ if (num_rows > upsample->rows_to_go) num_rows = upsample->rows_to_go; /* And not more than what the client can accept: */ out_rows_avail -= *out_row_ctr; if (num_rows > out_rows_avail) num_rows = out_rows_avail; /* Create output pointer array for upsampler. */ work_ptrs[0] = output_buf[*out_row_ctr]; if (num_rows > 1) { work_ptrs[1] = output_buf[*out_row_ctr + 1]; } else { work_ptrs[1] = upsample->spare_row; upsample->spare_full = TRUE; } /* Now do the upsampling. */ (*upsample->upmethod) (cinfo, input_buf, *in_row_group_ctr, work_ptrs); } /* Adjust counts */ *out_row_ctr += num_rows; upsample->rows_to_go -= num_rows; /* When the buffer is emptied, declare this input row group consumed */ if (! upsample->spare_full) (*in_row_group_ctr)++; } METHODDEF(void) merged_1v_upsample (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail) /* 1:1 vertical sampling case: much easier, never need a spare row. */ { my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; (void)in_row_groups_avail;(void)out_rows_avail; /* Just do the upsampling. */ (*upsample->upmethod) (cinfo, input_buf, *in_row_group_ctr, output_buf + *out_row_ctr); /* Adjust counts */ (*out_row_ctr)++; (*in_row_group_ctr)++; } /* * These are the routines invoked by the control routines to do * the actual upsampling/conversion. One row group is processed per call. * * Note: since we may be writing directly into application-supplied buffers, * we have to be honest about the output width; we can't assume the buffer * has been rounded up to an even width. */ /* * Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. */ METHODDEF(void) h2v1_merged_upsample (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf) { my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; register int y, cred, cgreen, cblue; int cb, cr; register JSAMPROW outptr; JSAMPROW inptr0, inptr1, inptr2; JDIMENSION col; /* copy these pointers into registers if possible */ register JSAMPLE * range_limit = cinfo->sample_range_limit; int * Crrtab = upsample->Cr_r_tab; int * Cbbtab = upsample->Cb_b_tab; INT32 * Crgtab = upsample->Cr_g_tab; INT32 * Cbgtab = upsample->Cb_g_tab; SHIFT_TEMPS inptr0 = input_buf[0][in_row_group_ctr]; inptr1 = input_buf[1][in_row_group_ctr]; inptr2 = input_buf[2][in_row_group_ctr]; outptr = output_buf[0]; /* Loop for each pair of output pixels */ for (col = cinfo->output_width >> 1; col > 0; col--) { /* Do the chroma part of the calculation */ cb = GETJSAMPLE(*inptr1++); cr = GETJSAMPLE(*inptr2++); cred = Crrtab[cr]; cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); cblue = Cbbtab[cb]; /* Fetch 2 Y values and emit 2 pixels */ y = GETJSAMPLE(*inptr0++); outptr[RGB_RED] = range_limit[y + cred]; outptr[RGB_GREEN] = range_limit[y + cgreen]; outptr[RGB_BLUE] = range_limit[y + cblue]; outptr += RGB_PIXELSIZE; y = GETJSAMPLE(*inptr0++); outptr[RGB_RED] = range_limit[y + cred]; outptr[RGB_GREEN] = range_limit[y + cgreen]; outptr[RGB_BLUE] = range_limit[y + cblue]; outptr += RGB_PIXELSIZE; } /* If image width is odd, do the last output column separately */ if (cinfo->output_width & 1) { cb = GETJSAMPLE(*inptr1); cr = GETJSAMPLE(*inptr2); cred = Crrtab[cr]; cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); cblue = Cbbtab[cb]; y = GETJSAMPLE(*inptr0); outptr[RGB_RED] = range_limit[y + cred]; outptr[RGB_GREEN] = range_limit[y + cgreen]; outptr[RGB_BLUE] = range_limit[y + cblue]; } } /* * Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical. */ METHODDEF(void) h2v2_merged_upsample (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf) { my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; register int y, cred, cgreen, cblue; int cb, cr; register JSAMPROW outptr0, outptr1; JSAMPROW inptr00, inptr01, inptr1, inptr2; JDIMENSION col; /* copy these pointers into registers if possible */ register JSAMPLE * range_limit = cinfo->sample_range_limit; int * Crrtab = upsample->Cr_r_tab; int * Cbbtab = upsample->Cb_b_tab; INT32 * Crgtab = upsample->Cr_g_tab; INT32 * Cbgtab = upsample->Cb_g_tab; SHIFT_TEMPS inptr00 = input_buf[0][in_row_group_ctr*2]; inptr01 = input_buf[0][in_row_group_ctr*2 + 1]; inptr1 = input_buf[1][in_row_group_ctr]; inptr2 = input_buf[2][in_row_group_ctr]; outptr0 = output_buf[0]; outptr1 = output_buf[1]; /* Loop for each group of output pixels */ for (col = cinfo->output_width >> 1; col > 0; col--) { /* Do the chroma part of the calculation */ cb = GETJSAMPLE(*inptr1++); cr = GETJSAMPLE(*inptr2++); cred = Crrtab[cr]; cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); cblue = Cbbtab[cb]; /* Fetch 4 Y values and emit 4 pixels */ y = GETJSAMPLE(*inptr00++); outptr0[RGB_RED] = range_limit[y + cred]; outptr0[RGB_GREEN] = range_limit[y + cgreen]; outptr0[RGB_BLUE] = range_limit[y + cblue]; outptr0 += RGB_PIXELSIZE; y = GETJSAMPLE(*inptr00++); outptr0[RGB_RED] = range_limit[y + cred]; outptr0[RGB_GREEN] = range_limit[y + cgreen]; outptr0[RGB_BLUE] = range_limit[y + cblue]; outptr0 += RGB_PIXELSIZE; y = GETJSAMPLE(*inptr01++); outptr1[RGB_RED] = range_limit[y + cred]; outptr1[RGB_GREEN] = range_limit[y + cgreen]; outptr1[RGB_BLUE] = range_limit[y + cblue]; outptr1 += RGB_PIXELSIZE; y = GETJSAMPLE(*inptr01++); outptr1[RGB_RED] = range_limit[y + cred]; outptr1[RGB_GREEN] = range_limit[y + cgreen]; outptr1[RGB_BLUE] = range_limit[y + cblue]; outptr1 += RGB_PIXELSIZE; } /* If image width is odd, do the last output column separately */ if (cinfo->output_width & 1) { cb = GETJSAMPLE(*inptr1); cr = GETJSAMPLE(*inptr2); cred = Crrtab[cr]; cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); cblue = Cbbtab[cb]; y = GETJSAMPLE(*inptr00); outptr0[RGB_RED] = range_limit[y + cred]; outptr0[RGB_GREEN] = range_limit[y + cgreen]; outptr0[RGB_BLUE] = range_limit[y + cblue]; y = GETJSAMPLE(*inptr01); outptr1[RGB_RED] = range_limit[y + cred]; outptr1[RGB_GREEN] = range_limit[y + cgreen]; outptr1[RGB_BLUE] = range_limit[y + cblue]; } } /* * Module initialization routine for merged upsampling/color conversion. * * NB: this is called under the conditions determined by use_merged_upsample() * in jdmaster.c. That routine MUST correspond to the actual capabilities * of this module; no safety checks are made here. */ GLOBAL(void) jinit_merged_upsampler (j_decompress_ptr cinfo) { my_upsample_ptr upsample; upsample = (my_upsample_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_upsampler)); cinfo->upsample = (struct jpeg_upsampler *) upsample; upsample->pub.start_pass = start_pass_merged_upsample; upsample->pub.need_context_rows = FALSE; upsample->out_row_width = cinfo->output_width * cinfo->out_color_components; if (cinfo->max_v_samp_factor == 2) { upsample->pub.upsample = merged_2v_upsample; upsample->upmethod = h2v2_merged_upsample; /* Allocate a spare row buffer */ upsample->spare_row = (JSAMPROW) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, (size_t) (upsample->out_row_width * SIZEOF(JSAMPLE))); } else { upsample->pub.upsample = merged_1v_upsample; upsample->upmethod = h2v1_merged_upsample; /* No spare row needed */ upsample->spare_row = NULL; } build_ycc_rgb_table(cinfo); } #endif /* UPSAMPLE_MERGING_SUPPORTED */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdapimin.c�����������������������������������������������0000644�0001750�0001750�00000031065�12320456500�021764� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdapimin.c * * Copyright (C) 1994-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains application interface code for the decompression half * of the JPEG library. These are the "minimum" API routines that may be * needed in either the normal full-decompression case or the * transcoding-only case. * * Most of the routines intended to be called directly by an application * are in this file or in jdapistd.c. But also see jcomapi.c for routines * shared by compression and decompression, and jdtrans.c for the transcoding * case. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" /* * Initialization of a JPEG decompression object. * The error manager must already be set up (in case memory manager fails). */ GLOBAL(void) jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize) { int i; /* Guard against version mismatches between library and caller. */ cinfo->mem = NULL; /* so jpeg_destroy knows mem mgr not called */ if (version != JPEG_LIB_VERSION) ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version); if (structsize != SIZEOF(struct jpeg_decompress_struct)) ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, (int) SIZEOF(struct jpeg_decompress_struct), (int) structsize); /* For debugging purposes, we zero the whole master structure. * But the application has already set the err pointer, and may have set * client_data, so we have to save and restore those fields. * Note: if application hasn't set client_data, tools like Purify may * complain here. */ { struct jpeg_error_mgr * err = cinfo->err; void * client_data = cinfo->client_data; /* ignore Purify complaint here */ MEMZERO(cinfo, SIZEOF(struct jpeg_decompress_struct)); cinfo->err = err; cinfo->client_data = client_data; } cinfo->is_decompressor = TRUE; /* Initialize a memory manager instance for this object */ jinit_memory_mgr((j_common_ptr) cinfo); /* Zero out pointers to permanent structures. */ cinfo->progress = NULL; cinfo->src = NULL; for (i = 0; i < NUM_QUANT_TBLS; i++) cinfo->quant_tbl_ptrs[i] = NULL; for (i = 0; i < NUM_HUFF_TBLS; i++) { cinfo->dc_huff_tbl_ptrs[i] = NULL; cinfo->ac_huff_tbl_ptrs[i] = NULL; } /* Initialize marker processor so application can override methods * for COM, APPn markers before calling jpeg_read_header. */ cinfo->marker_list = NULL; jinit_marker_reader(cinfo); /* And initialize the overall input controller. */ jinit_input_controller(cinfo); /* OK, I'm ready */ cinfo->global_state = DSTATE_START; } /* * Destruction of a JPEG decompression object */ GLOBAL(void) jpeg_destroy_decompress (j_decompress_ptr cinfo) { jpeg_destroy((j_common_ptr) cinfo); /* use common routine */ } /* * Abort processing of a JPEG decompression operation, * but don't destroy the object itself. */ GLOBAL(void) jpeg_abort_decompress (j_decompress_ptr cinfo) { jpeg_abort((j_common_ptr) cinfo); /* use common routine */ } /* * Set default decompression parameters. */ LOCAL(void) default_decompress_parms (j_decompress_ptr cinfo) { /* Guess the input colorspace, and set output colorspace accordingly. */ /* (Wish JPEG committee had provided a real way to specify this...) */ /* Note application may override our guesses. */ switch (cinfo->num_components) { case 1: cinfo->jpeg_color_space = JCS_GRAYSCALE; cinfo->out_color_space = JCS_GRAYSCALE; break; case 3: if (cinfo->saw_JFIF_marker) { cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */ } else if (cinfo->saw_Adobe_marker) { switch (cinfo->Adobe_transform) { case 0: cinfo->jpeg_color_space = JCS_RGB; break; case 1: cinfo->jpeg_color_space = JCS_YCbCr; break; default: WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform); cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */ break; } } else { /* Saw no special markers, try to guess from the component IDs */ int cid0 = cinfo->comp_info[0].component_id; int cid1 = cinfo->comp_info[1].component_id; int cid2 = cinfo->comp_info[2].component_id; if (cid0 == 1 && cid1 == 2 && cid2 == 3) cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */ else if (cid0 == 82 && cid1 == 71 && cid2 == 66) cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */ else { if (cinfo->process == JPROC_LOSSLESS) { TRACEMS3(cinfo, 1, JTRC_UNKNOWN_LOSSLESS_IDS, cid0, cid1, cid2); cinfo->jpeg_color_space = JCS_RGB; /* assume it's RGB */ } else { /* Lossy processes */ TRACEMS3(cinfo, 1, JTRC_UNKNOWN_LOSSY_IDS, cid0, cid1, cid2); cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */ } } } /* Always guess RGB is proper output colorspace. */ cinfo->out_color_space = JCS_RGB; break; case 4: if (cinfo->saw_Adobe_marker) { switch (cinfo->Adobe_transform) { case 0: cinfo->jpeg_color_space = JCS_CMYK; break; case 2: cinfo->jpeg_color_space = JCS_YCCK; break; default: WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform); cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */ break; } } else { /* No special markers, assume straight CMYK. */ cinfo->jpeg_color_space = JCS_CMYK; } cinfo->out_color_space = JCS_CMYK; break; default: cinfo->jpeg_color_space = JCS_UNKNOWN; cinfo->out_color_space = JCS_UNKNOWN; break; } /* Set defaults for other decompression parameters. */ cinfo->scale_num = 1; /* 1:1 scaling */ cinfo->scale_denom = 1; cinfo->output_gamma = 1.0; cinfo->buffered_image = FALSE; cinfo->raw_data_out = FALSE; cinfo->dct_method = JDCT_DEFAULT; cinfo->do_fancy_upsampling = TRUE; cinfo->do_block_smoothing = TRUE; cinfo->quantize_colors = FALSE; /* We set these in case application only sets quantize_colors. */ cinfo->dither_mode = JDITHER_FS; #ifdef QUANT_2PASS_SUPPORTED cinfo->two_pass_quantize = TRUE; #else cinfo->two_pass_quantize = FALSE; #endif cinfo->desired_number_of_colors = 256; cinfo->colormap = NULL; /* Initialize for no mode change in buffered-image mode. */ cinfo->enable_1pass_quant = FALSE; cinfo->enable_external_quant = FALSE; cinfo->enable_2pass_quant = FALSE; } /* * Decompression startup: read start of JPEG datastream to see what's there. * Need only initialize JPEG object and supply a data source before calling. * * This routine will read as far as the first SOS marker (ie, actual start of * compressed data), and will save all tables and parameters in the JPEG * object. It will also initialize the decompression parameters to default * values, and finally return JPEG_HEADER_OK. On return, the application may * adjust the decompression parameters and then call jpeg_start_decompress. * (Or, if the application only wanted to determine the image parameters, * the data need not be decompressed. In that case, call jpeg_abort or * jpeg_destroy to release any temporary space.) * If an abbreviated (tables only) datastream is presented, the routine will * return JPEG_HEADER_TABLES_ONLY upon reaching EOI. The application may then * re-use the JPEG object to read the abbreviated image datastream(s). * It is unnecessary (but OK) to call jpeg_abort in this case. * The JPEG_SUSPENDED return code only occurs if the data source module * requests suspension of the decompressor. In this case the application * should load more source data and then re-call jpeg_read_header to resume * processing. * If a non-suspending data source is used and require_image is TRUE, then the * return code need not be inspected since only JPEG_HEADER_OK is possible. * * This routine is now just a front end to jpeg_consume_input, with some * extra error checking. */ GLOBAL(int) jpeg_read_header (j_decompress_ptr cinfo, boolean require_image) { int retcode; if (cinfo->global_state != DSTATE_START && cinfo->global_state != DSTATE_INHEADER) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); retcode = jpeg_consume_input(cinfo); switch (retcode) { case JPEG_REACHED_SOS: retcode = JPEG_HEADER_OK; break; case JPEG_REACHED_EOI: if (require_image) /* Complain if application wanted an image */ ERREXIT(cinfo, JERR_NO_IMAGE); /* Reset to start state; it would be safer to require the application to * call jpeg_abort, but we can't change it now for compatibility reasons. * A side effect is to free any temporary memory (there shouldn't be any). */ jpeg_abort((j_common_ptr) cinfo); /* sets state = DSTATE_START */ retcode = JPEG_HEADER_TABLES_ONLY; break; case JPEG_SUSPENDED: /* no work */ break; } return retcode; } /* * Consume data in advance of what the decompressor requires. * This can be called at any time once the decompressor object has * been created and a data source has been set up. * * This routine is essentially a state machine that handles a couple * of critical state-transition actions, namely initial setup and * transition from header scanning to ready-for-start_decompress. * All the actual input is done via the input controller's consume_input * method. */ GLOBAL(int) jpeg_consume_input (j_decompress_ptr cinfo) { int retcode = JPEG_SUSPENDED; /* NB: every possible DSTATE value should be listed in this switch */ switch (cinfo->global_state) { case DSTATE_START: /* Start-of-datastream actions: reset appropriate modules */ (*cinfo->inputctl->reset_input_controller) (cinfo); /* Initialize application's data source module */ (*cinfo->src->init_source) (cinfo); cinfo->global_state = DSTATE_INHEADER; /*FALLTHROUGH*/ case DSTATE_INHEADER: retcode = (*cinfo->inputctl->consume_input) (cinfo); if (retcode == JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */ /* Set up default parameters based on header data */ default_decompress_parms(cinfo); /* Set global state: ready for start_decompress */ cinfo->global_state = DSTATE_READY; } break; case DSTATE_READY: /* Can't advance past first SOS until start_decompress is called */ retcode = JPEG_REACHED_SOS; break; case DSTATE_PRELOAD: case DSTATE_PRESCAN: case DSTATE_SCANNING: case DSTATE_RAW_OK: case DSTATE_BUFIMAGE: case DSTATE_BUFPOST: case DSTATE_STOPPING: retcode = (*cinfo->inputctl->consume_input) (cinfo); break; default: ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); } return retcode; } /* * Have we finished reading the input file? */ GLOBAL(boolean) jpeg_input_complete (j_decompress_ptr cinfo) { /* Check for valid jpeg object */ if (cinfo->global_state < DSTATE_START || cinfo->global_state > DSTATE_STOPPING) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); return cinfo->inputctl->eoi_reached; } /* * Is there more than one scan? */ GLOBAL(boolean) jpeg_has_multiple_scans (j_decompress_ptr cinfo) { /* Only valid after jpeg_read_header completes */ if (cinfo->global_state < DSTATE_READY || cinfo->global_state > DSTATE_STOPPING) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); return cinfo->inputctl->has_multiple_scans; } /* * Finish JPEG decompression. * * This will normally just verify the file trailer and release temp storage. * * Returns FALSE if suspended. The return value need be inspected only if * a suspending data source is used. */ GLOBAL(boolean) jpeg_finish_decompress (j_decompress_ptr cinfo) { if ((cinfo->global_state == DSTATE_SCANNING || cinfo->global_state == DSTATE_RAW_OK) && ! cinfo->buffered_image) { /* Terminate final pass of non-buffered mode */ if (cinfo->output_scanline < cinfo->output_height) ERREXIT(cinfo, JERR_TOO_LITTLE_DATA); (*cinfo->master->finish_output_pass) (cinfo); cinfo->global_state = DSTATE_STOPPING; } else if (cinfo->global_state == DSTATE_BUFIMAGE) { /* Finishing after a buffered-image operation */ cinfo->global_state = DSTATE_STOPPING; } else if (cinfo->global_state != DSTATE_STOPPING) { /* STOPPING = repeat call after a suspension, anything else is error */ ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); } /* Read until EOI */ while (! cinfo->inputctl->eoi_reached) { if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED) return FALSE; /* Suspend, come back later */ } /* Do final cleanup */ (*cinfo->src->term_source) (cinfo); /* We can use jpeg_abort to release memory and reset global_state */ jpeg_abort((j_common_ptr) cinfo); return TRUE; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdsample.c�����������������������������������������������0000644�0001750�0001750�00000040207�12320456500�021766� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdsample.c * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains upsampling routines. * * Upsampling input data is counted in "row groups". A row group * is defined to be (v_samp_factor * codec_data_unit / min_codec_data_unit) * sample rows of each component. Upsampling will normally produce * max_v_samp_factor pixel rows from each row group (but this could vary * if the upsampler is applying a scale factor of its own). * * An excellent reference for image resampling is * Digital Image Warping, George Wolberg, 1990. * Pub. by IEEE Computer Society Press, Los Alamitos, CA. ISBN 0-8186-8944-7. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" /* Pointer to routine to upsample a single component */ typedef JMETHOD(void, upsample1_ptr, (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); /* Private subobject */ typedef struct { struct jpeg_upsampler pub; /* public fields */ /* Color conversion buffer. When using separate upsampling and color * conversion steps, this buffer holds one upsampled row group until it * has been color converted and output. * Note: we do not allocate any storage for component(s) which are full-size, * ie do not need rescaling. The corresponding entry of color_buf[] is * simply set to point to the input data array, thereby avoiding copying. */ JSAMPARRAY color_buf[MAX_COMPONENTS]; /* Per-component upsampling method pointers */ upsample1_ptr methods[MAX_COMPONENTS]; int next_row_out; /* counts rows emitted from color_buf */ JDIMENSION rows_to_go; /* counts rows remaining in image */ /* Height of an input row group for each component. */ int rowgroup_height[MAX_COMPONENTS]; /* These arrays save pixel expansion factors so that int_expand need not * recompute them each time. They are unused for other upsampling methods. */ UINT8 h_expand[MAX_COMPONENTS]; UINT8 v_expand[MAX_COMPONENTS]; } my_upsampler; typedef my_upsampler * my_upsample_ptr; /* * Initialize for an upsampling pass. */ METHODDEF(void) start_pass_upsample (j_decompress_ptr cinfo) { my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; /* Mark the conversion buffer empty */ upsample->next_row_out = cinfo->max_v_samp_factor; /* Initialize total-height counter for detecting bottom of image */ upsample->rows_to_go = cinfo->output_height; } /* * Control routine to do upsampling (and color conversion). * * In this version we upsample each component independently. * We upsample one row group into the conversion buffer, then apply * color conversion a row at a time. */ METHODDEF(void) sep_upsample (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail) { my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; int ci; jpeg_component_info * compptr; JDIMENSION num_rows; (void)in_row_groups_avail; /* Fill the conversion buffer, if it's empty */ if (upsample->next_row_out >= cinfo->max_v_samp_factor) { for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { /* Invoke per-component upsample method. Notice we pass a POINTER * to color_buf[ci], so that fullsize_upsample can change it. */ (*upsample->methods[ci]) (cinfo, compptr, input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]), upsample->color_buf + ci); } upsample->next_row_out = 0; } /* Color-convert and emit rows */ /* How many we have in the buffer: */ num_rows = (JDIMENSION) (cinfo->max_v_samp_factor - upsample->next_row_out); /* Not more than the distance to the end of the image. Need this test * in case the image height is not a multiple of max_v_samp_factor: */ if (num_rows > upsample->rows_to_go) num_rows = upsample->rows_to_go; /* And not more than what the client can accept: */ out_rows_avail -= *out_row_ctr; if (num_rows > out_rows_avail) num_rows = out_rows_avail; (*cinfo->cconvert->color_convert) (cinfo, upsample->color_buf, (JDIMENSION) upsample->next_row_out, output_buf + *out_row_ctr, (int) num_rows); /* Adjust counts */ *out_row_ctr += num_rows; upsample->rows_to_go -= num_rows; upsample->next_row_out += num_rows; /* When the buffer is emptied, declare this input row group consumed */ if (upsample->next_row_out >= cinfo->max_v_samp_factor) (*in_row_group_ctr)++; } /* * These are the routines invoked by sep_upsample to upsample pixel values * of a single component. One row group is processed per call. */ /* * For full-size components, we just make color_buf[ci] point at the * input buffer, and thus avoid copying any data. Note that this is * safe only because sep_upsample doesn't declare the input row group * "consumed" until we are done color converting and emitting it. */ METHODDEF(void) fullsize_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { (void)cinfo;(void)compptr; *output_data_ptr = input_data; } /* * This is a no-op version used for "uninteresting" components. * These components will not be referenced by color conversion. */ METHODDEF(void) noop_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { (void)cinfo;(void)compptr;(void)input_data; *output_data_ptr = NULL; /* safety check */ } /* * This version handles any integral sampling ratios. * This is not used for typical JPEG files, so it need not be fast. * Nor, for that matter, is it particularly accurate: the algorithm is * simple replication of the input pixel onto the corresponding output * pixels. The hi-falutin sampling literature refers to this as a * "box filter". A box filter tends to introduce visible artifacts, * so if you are actually going to use 3:1 or 4:1 sampling ratios * you would be well advised to improve this code. */ METHODDEF(void) int_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; JSAMPARRAY output_data = *output_data_ptr; register JSAMPROW inptr, outptr; register JSAMPLE invalue; register int h; JSAMPROW outend; int h_expand, v_expand; int inrow, outrow; h_expand = upsample->h_expand[compptr->component_index]; v_expand = upsample->v_expand[compptr->component_index]; inrow = outrow = 0; while (outrow < cinfo->max_v_samp_factor) { /* Generate one output row with proper horizontal expansion */ inptr = input_data[inrow]; outptr = output_data[outrow]; outend = outptr + cinfo->output_width; while (outptr < outend) { invalue = *inptr++; /* don't need GETJSAMPLE() here */ for (h = h_expand; h > 0; h--) { *outptr++ = invalue; } } /* Generate any additional output rows by duplicating the first one */ if (v_expand > 1) { jcopy_sample_rows(output_data, outrow, output_data, outrow+1, v_expand-1, cinfo->output_width); } inrow++; outrow += v_expand; } } /* * Fast processing for the common case of 2:1 horizontal and 1:1 vertical. * It's still a box filter. */ METHODDEF(void) h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { JSAMPARRAY output_data = *output_data_ptr; register JSAMPROW inptr, outptr; register JSAMPLE invalue; JSAMPROW outend; int inrow; (void)compptr; for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) { inptr = input_data[inrow]; outptr = output_data[inrow]; outend = outptr + cinfo->output_width; while (outptr < outend) { invalue = *inptr++; /* don't need GETJSAMPLE() here */ *outptr++ = invalue; *outptr++ = invalue; } } } /* * Fast processing for the common case of 2:1 horizontal and 2:1 vertical. * It's still a box filter. */ METHODDEF(void) h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { JSAMPARRAY output_data = *output_data_ptr; register JSAMPROW inptr, outptr; register JSAMPLE invalue; JSAMPROW outend; int inrow, outrow; (void)compptr; inrow = outrow = 0; while (outrow < cinfo->max_v_samp_factor) { inptr = input_data[inrow]; outptr = output_data[outrow]; outend = outptr + cinfo->output_width; while (outptr < outend) { invalue = *inptr++; /* don't need GETJSAMPLE() here */ *outptr++ = invalue; *outptr++ = invalue; } jcopy_sample_rows(output_data, outrow, output_data, outrow+1, 1, cinfo->output_width); inrow++; outrow += 2; } } /* * Fancy processing for the common case of 2:1 horizontal and 1:1 vertical. * * The upsampling algorithm is linear interpolation between pixel centers, * also known as a "triangle filter". This is a good compromise between * speed and visual quality. The centers of the output pixels are 1/4 and 3/4 * of the way between input pixel centers. * * A note about the "bias" calculations: when rounding fractional values to * integer, we do not want to always round 0.5 up to the next integer. * If we did that, we'd introduce a noticeable bias towards larger values. * Instead, this code is arranged so that 0.5 will be rounded up or down at * alternate pixel locations (a simple ordered dither pattern). */ METHODDEF(void) h2v1_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { JSAMPARRAY output_data = *output_data_ptr; register JSAMPROW inptr, outptr; register int invalue; register JDIMENSION colctr; int inrow; for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) { inptr = input_data[inrow]; outptr = output_data[inrow]; /* Special case for first column */ invalue = GETJSAMPLE(*inptr++); *outptr++ = (JSAMPLE) invalue; *outptr++ = (JSAMPLE) ((invalue * 3 + GETJSAMPLE(*inptr) + 2) >> 2); for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) { /* General case: 3/4 * nearer pixel + 1/4 * further pixel */ invalue = GETJSAMPLE(*inptr++) * 3; *outptr++ = (JSAMPLE) ((invalue + GETJSAMPLE(inptr[-2]) + 1) >> 2); *outptr++ = (JSAMPLE) ((invalue + GETJSAMPLE(*inptr) + 2) >> 2); } /* Special case for last column */ invalue = GETJSAMPLE(*inptr); *outptr++ = (JSAMPLE) ((invalue * 3 + GETJSAMPLE(inptr[-1]) + 1) >> 2); *outptr++ = (JSAMPLE) invalue; } } /* * Fancy processing for the common case of 2:1 horizontal and 2:1 vertical. * Again a triangle filter; see comments for h2v1 case, above. * * It is OK for us to reference the adjacent input rows because we demanded * context from the main buffer controller (see initialization code). */ METHODDEF(void) h2v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { JSAMPARRAY output_data = *output_data_ptr; register JSAMPROW inptr0, inptr1, outptr; #if BITS_IN_JSAMPLE == 8 register int thiscolsum, lastcolsum, nextcolsum; #else register INT32 thiscolsum, lastcolsum, nextcolsum; #endif register JDIMENSION colctr; int inrow, outrow, v; inrow = outrow = 0; while (outrow < cinfo->max_v_samp_factor) { for (v = 0; v < 2; v++) { /* inptr0 points to nearest input row, inptr1 points to next nearest */ inptr0 = input_data[inrow]; if (v == 0) /* next nearest is row above */ inptr1 = input_data[inrow-1]; else /* next nearest is row below */ inptr1 = input_data[inrow+1]; outptr = output_data[outrow++]; /* Special case for first column */ thiscolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++); nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++); *outptr++ = (JSAMPLE) ((thiscolsum * 4 + 8) >> 4); *outptr++ = (JSAMPLE) ((thiscolsum * 3 + nextcolsum + 7) >> 4); lastcolsum = thiscolsum; thiscolsum = nextcolsum; for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) { /* General case: 3/4 * nearer pixel + 1/4 * further pixel in each */ /* dimension, thus 9/16, 3/16, 3/16, 1/16 overall */ nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++); *outptr++ = (JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4); *outptr++ = (JSAMPLE) ((thiscolsum * 3 + nextcolsum + 7) >> 4); lastcolsum = thiscolsum; thiscolsum = nextcolsum; } /* Special case for last column */ *outptr++ = (JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4); *outptr++ = (JSAMPLE) ((thiscolsum * 4 + 7) >> 4); } inrow++; } } /* * Module initialization routine for upsampling. */ GLOBAL(void) jinit_upsampler (j_decompress_ptr cinfo) { my_upsample_ptr upsample; int ci; jpeg_component_info * compptr; boolean need_buffer, do_fancy; int h_in_group, v_in_group, h_out_group, v_out_group; upsample = (my_upsample_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_upsampler)); cinfo->upsample = (struct jpeg_upsampler *) upsample; upsample->pub.start_pass = start_pass_upsample; upsample->pub.upsample = sep_upsample; upsample->pub.need_context_rows = FALSE; /* until we find out differently */ if (cinfo->CCIR601_sampling) /* this isn't supported */ ERREXIT(cinfo, JERR_CCIR601_NOTIMPL); /* jdmainct.c doesn't support context rows when min_codec_data_unit = 1, * so don't ask for it. */ do_fancy = cinfo->do_fancy_upsampling && cinfo->min_codec_data_unit > 1; /* Verify we can handle the sampling factors, select per-component methods, * and create storage as needed. */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { /* Compute size of an "input group" after IDCT scaling. This many samples * are to be converted to max_h_samp_factor * max_v_samp_factor pixels. */ h_in_group = (compptr->h_samp_factor * compptr->codec_data_unit) / cinfo->min_codec_data_unit; v_in_group = (compptr->v_samp_factor * compptr->codec_data_unit) / cinfo->min_codec_data_unit; h_out_group = cinfo->max_h_samp_factor; v_out_group = cinfo->max_v_samp_factor; upsample->rowgroup_height[ci] = v_in_group; /* save for use later */ need_buffer = TRUE; if (! compptr->component_needed) { /* Don't bother to upsample an uninteresting component. */ upsample->methods[ci] = noop_upsample; need_buffer = FALSE; } else if (h_in_group == h_out_group && v_in_group == v_out_group) { /* Fullsize components can be processed without any work. */ upsample->methods[ci] = fullsize_upsample; need_buffer = FALSE; } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) { /* Special cases for 2h1v upsampling */ if (do_fancy && compptr->downsampled_width > 2) upsample->methods[ci] = h2v1_fancy_upsample; else upsample->methods[ci] = h2v1_upsample; } else if (h_in_group * 2 == h_out_group && v_in_group * 2 == v_out_group) { /* Special cases for 2h2v upsampling */ if (do_fancy && compptr->downsampled_width > 2) { upsample->methods[ci] = h2v2_fancy_upsample; upsample->pub.need_context_rows = TRUE; } else upsample->methods[ci] = h2v2_upsample; } else if ((h_out_group % h_in_group) == 0 && (v_out_group % v_in_group) == 0) { /* Generic integral-factors upsampling method */ upsample->methods[ci] = int_upsample; upsample->h_expand[ci] = (UINT8) (h_out_group / h_in_group); upsample->v_expand[ci] = (UINT8) (v_out_group / v_in_group); } else ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL); if (need_buffer) { upsample->color_buf[ci] = (*cinfo->mem->alloc_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, (JDIMENSION) jround_up((long) cinfo->output_width, (long) cinfo->max_h_samp_factor), (JDIMENSION) cinfo->max_v_samp_factor); } } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jmemmgr.c������������������������������������������������0000644�0001750�0001750�00000122737�12320456500�021636� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jmemmgr.c * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains the JPEG system-independent memory management * routines. This code is usable across a wide variety of machines; most * of the system dependencies have been isolated in a separate file. * The major functions provided here are: * * pool-based allocation and freeing of memory; * * policy decisions about how to divide available memory among the * virtual arrays; * * control logic for swapping virtual arrays between main memory and * backing storage. * The separate system-dependent file provides the actual backing-storage * access code, and it contains the policy decision about how much total * main memory to use. * This file is system-dependent in the sense that some of its functions * are unnecessary in some systems. For example, if there is enough virtual * memory so that backing storage will never be used, much of the virtual * array control logic could be removed. (Of course, if you have that much * memory then you shouldn't care about a little bit of unused code...) */ #define JPEG_INTERNALS #define AM_MEMORY_MANAGER /* we define jvirt_Xarray_control structs */ #include "jinclude.h" #include "jpeglib.h" #include "jmemsys.h" /* import the system-dependent declarations */ #ifndef NO_GETENV #ifndef HAVE_STDLIB_H /* <stdlib.h> should declare getenv() */ extern char * getenv JPP((const char * name)); #endif #endif /* * Some important notes: * The allocation routines provided here must never return NULL. * They should exit to error_exit if unsuccessful. * * It's not a good idea to try to merge the sarray, barray and darray * routines, even though they are textually almost the same, because * samples are usually stored as bytes while coefficients and differenced * are shorts or ints. Thus, in machines where byte pointers have a * different representation from word pointers, the resulting machine * code could not be the same. */ /* * Many machines require storage alignment: longs must start on 4-byte * boundaries, doubles on 8-byte boundaries, etc. On such machines, malloc() * always returns pointers that are multiples of the worst-case alignment * requirement, and we had better do so too. * There isn't any really portable way to determine the worst-case alignment * requirement. This module assumes that the alignment requirement is * multiples of sizeof(ALIGN_TYPE). * By default, we define ALIGN_TYPE as double. This is necessary on some * workstations (where doubles really do need 8-byte alignment) and will work * fine on nearly everything. If your machine has lesser alignment needs, * you can save a few bytes by making ALIGN_TYPE smaller. * The only place I know of where this will NOT work is certain Macintosh * 680x0 compilers that define double as a 10-byte IEEE extended float. * Doing 10-byte alignment is counterproductive because longwords won't be * aligned well. Put "#define ALIGN_TYPE long" in jconfig.h if you have * such a compiler. */ #ifndef ALIGN_TYPE /* so can override from jconfig.h */ #define ALIGN_TYPE double #endif /* * We allocate objects from "pools", where each pool is gotten with a single * request to jpeg_get_small() or jpeg_get_large(). There is no per-object * overhead within a pool, except for alignment padding. Each pool has a * header with a link to the next pool of the same class. * Small and large pool headers are identical except that the latter's * link pointer must be FAR on 80x86 machines. * Notice that the "real" header fields are union'ed with a dummy ALIGN_TYPE * field. This forces the compiler to make SIZEOF(small_pool_hdr) a multiple * of the alignment requirement of ALIGN_TYPE. */ typedef union small_pool_struct * small_pool_ptr; typedef union small_pool_struct { struct { small_pool_ptr next; /* next in list of pools */ size_t bytes_used; /* how many bytes already used within pool */ size_t bytes_left; /* bytes still available in this pool */ } hdr; ALIGN_TYPE dummy; /* included in union to ensure alignment */ } small_pool_hdr; typedef union large_pool_struct FAR * large_pool_ptr; typedef union large_pool_struct { struct { large_pool_ptr next; /* next in list of pools */ size_t bytes_used; /* how many bytes already used within pool */ size_t bytes_left; /* bytes still available in this pool */ } hdr; ALIGN_TYPE dummy; /* included in union to ensure alignment */ } large_pool_hdr; /* * Here is the full definition of a memory manager object. */ typedef struct { struct jpeg_memory_mgr pub; /* public fields */ /* Each pool identifier (lifetime class) names a linked list of pools. */ small_pool_ptr small_list[JPOOL_NUMPOOLS]; large_pool_ptr large_list[JPOOL_NUMPOOLS]; /* Since we only have one lifetime class of virtual arrays, only one * linked list is necessary (for each datatype). Note that the virtual * array control blocks being linked together are actually stored somewhere * in the small-pool list. */ jvirt_sarray_ptr virt_sarray_list; jvirt_barray_ptr virt_barray_list; /* This counts total space obtained from jpeg_get_small/large */ long total_space_allocated; /* alloc_sarray and alloc_barray set this value for use by virtual * array routines. */ JDIMENSION last_rowsperchunk; /* from most recent alloc_sarray/barray */ } my_memory_mgr; typedef my_memory_mgr * my_mem_ptr; /* * The control blocks for virtual arrays. * Note that these blocks are allocated in the "small" pool area. * System-dependent info for the associated backing store (if any) is hidden * inside the backing_store_info struct. */ struct jvirt_sarray_control { JSAMPARRAY mem_buffer; /* => the in-memory buffer */ JDIMENSION rows_in_array; /* total virtual array height */ JDIMENSION samplesperrow; /* width of array (and of memory buffer) */ JDIMENSION maxaccess; /* max rows accessed by access_virt_sarray */ JDIMENSION rows_in_mem; /* height of memory buffer */ JDIMENSION rowsperchunk; /* allocation chunk size in mem_buffer */ JDIMENSION cur_start_row; /* first logical row # in the buffer */ JDIMENSION first_undef_row; /* row # of first uninitialized row */ boolean pre_zero; /* pre-zero mode requested? */ boolean dirty; /* do current buffer contents need written? */ boolean b_s_open; /* is backing-store data valid? */ jvirt_sarray_ptr next; /* link to next virtual sarray control block */ backing_store_info b_s_info; /* System-dependent control info */ }; struct jvirt_barray_control { JBLOCKARRAY mem_buffer; /* => the in-memory buffer */ JDIMENSION rows_in_array; /* total virtual array height */ JDIMENSION blocksperrow; /* width of array (and of memory buffer) */ JDIMENSION maxaccess; /* max rows accessed by access_virt_barray */ JDIMENSION rows_in_mem; /* height of memory buffer */ JDIMENSION rowsperchunk; /* allocation chunk size in mem_buffer */ JDIMENSION cur_start_row; /* first logical row # in the buffer */ JDIMENSION first_undef_row; /* row # of first uninitialized row */ boolean pre_zero; /* pre-zero mode requested? */ boolean dirty; /* do current buffer contents need written? */ boolean b_s_open; /* is backing-store data valid? */ jvirt_barray_ptr next; /* link to next virtual barray control block */ backing_store_info b_s_info; /* System-dependent control info */ }; #ifdef MEM_STATS /* optional extra stuff for statistics */ LOCAL(void) print_mem_stats (j_common_ptr cinfo, int pool_id) { my_mem_ptr mem = (my_mem_ptr) cinfo->mem; small_pool_ptr shdr_ptr; large_pool_ptr lhdr_ptr; /* Since this is only a debugging stub, we can cheat a little by using * fprintf directly rather than going through the trace message code. * This is helpful because message parm array can't handle longs. */ fprintf(stderr, "Freeing pool %d, total space = %ld\n", pool_id, mem->total_space_allocated); for (lhdr_ptr = mem->large_list[pool_id]; lhdr_ptr != NULL; lhdr_ptr = lhdr_ptr->hdr.next) { fprintf(stderr, " Large chunk used %ld\n", (long) lhdr_ptr->hdr.bytes_used); } for (shdr_ptr = mem->small_list[pool_id]; shdr_ptr != NULL; shdr_ptr = shdr_ptr->hdr.next) { fprintf(stderr, " Small chunk used %ld free %ld\n", (long) shdr_ptr->hdr.bytes_used, (long) shdr_ptr->hdr.bytes_left); } } #endif /* MEM_STATS */ LOCAL(void) out_of_memory (j_common_ptr cinfo, int which) /* Report an out-of-memory error and stop execution */ /* If we compiled MEM_STATS support, report alloc requests before dying */ { #ifdef MEM_STATS cinfo->err->trace_level = 2; /* force self_destruct to report stats */ #endif ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, which); } /* * Allocation of "small" objects. * * For these, we use pooled storage. When a new pool must be created, * we try to get enough space for the current request plus a "slop" factor, * where the slop will be the amount of leftover space in the new pool. * The speed vs. space tradeoff is largely determined by the slop values. * A different slop value is provided for each pool class (lifetime), * and we also distinguish the first pool of a class from later ones. * NOTE: the values given work fairly well on both 16- and 32-bit-int * machines, but may be too small if longs are 64 bits or more. */ static const size_t first_pool_slop[JPOOL_NUMPOOLS] = { 1600, /* first PERMANENT pool */ 16000 /* first IMAGE pool */ }; static const size_t extra_pool_slop[JPOOL_NUMPOOLS] = { 0, /* additional PERMANENT pools */ 5000 /* additional IMAGE pools */ }; #define MIN_SLOP 50 /* greater than 0 to avoid futile looping */ METHODDEF(void *) alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject) /* Allocate a "small" object */ { my_mem_ptr mem = (my_mem_ptr) cinfo->mem; small_pool_ptr hdr_ptr, prev_hdr_ptr; char * data_ptr; size_t odd_bytes, min_request, slop; /* Check for unsatisfiable request (do now to ensure no overflow below) */ if (sizeofobject > (size_t) (MAX_ALLOC_CHUNK-SIZEOF(small_pool_hdr))) out_of_memory(cinfo, 1); /* request exceeds malloc's ability */ /* Round up the requested size to a multiple of SIZEOF(ALIGN_TYPE) */ odd_bytes = sizeofobject % SIZEOF(ALIGN_TYPE); if (odd_bytes > 0) sizeofobject += SIZEOF(ALIGN_TYPE) - odd_bytes; /* See if space is available in any existing pool */ if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS) ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ prev_hdr_ptr = NULL; hdr_ptr = mem->small_list[pool_id]; while (hdr_ptr != NULL) { if (hdr_ptr->hdr.bytes_left >= sizeofobject) break; /* found pool with enough space */ prev_hdr_ptr = hdr_ptr; hdr_ptr = hdr_ptr->hdr.next; } /* Time to make a new pool? */ if (hdr_ptr == NULL) { /* min_request is what we need now, slop is what will be leftover */ min_request = sizeofobject + SIZEOF(small_pool_hdr); if (prev_hdr_ptr == NULL) /* first pool in class? */ slop = first_pool_slop[pool_id]; else slop = extra_pool_slop[pool_id]; /* Don't ask for more than MAX_ALLOC_CHUNK */ if (slop > (size_t) (MAX_ALLOC_CHUNK-min_request)) slop = (size_t) (MAX_ALLOC_CHUNK-min_request); /* Try to get space, if fail reduce slop and try again */ for (;;) { hdr_ptr = (small_pool_ptr) jpeg_get_small(cinfo, min_request + slop); if (hdr_ptr != NULL) break; slop /= 2; if (slop < MIN_SLOP) /* give up when it gets real small */ out_of_memory(cinfo, 2); /* jpeg_get_small failed */ } mem->total_space_allocated += min_request + slop; /* Success, initialize the new pool header and add to end of list */ hdr_ptr->hdr.next = NULL; hdr_ptr->hdr.bytes_used = 0; hdr_ptr->hdr.bytes_left = sizeofobject + slop; if (prev_hdr_ptr == NULL) /* first pool in class? */ mem->small_list[pool_id] = hdr_ptr; else prev_hdr_ptr->hdr.next = hdr_ptr; } /* OK, allocate the object from the current pool */ data_ptr = (char *) (hdr_ptr + 1); /* point to first data byte in pool */ data_ptr += hdr_ptr->hdr.bytes_used; /* point to place for object */ hdr_ptr->hdr.bytes_used += sizeofobject; hdr_ptr->hdr.bytes_left -= sizeofobject; return (void *) data_ptr; } /* * Allocation of "large" objects. * * The external semantics of these are the same as "small" objects, * except that FAR pointers are used on 80x86. However the pool * management heuristics are quite different. We assume that each * request is large enough that it may as well be passed directly to * jpeg_get_large; the pool management just links everything together * so that we can free it all on demand. * Note: the major use of "large" objects is in JSAMPARRAY and JBLOCKARRAY * structures. The routines that create these structures (see below) * deliberately bunch rows together to ensure a large request size. */ METHODDEF(void FAR *) alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject) /* Allocate a "large" object */ { my_mem_ptr mem = (my_mem_ptr) cinfo->mem; large_pool_ptr hdr_ptr; size_t odd_bytes; /* Check for unsatisfiable request (do now to ensure no overflow below) */ if (sizeofobject > (size_t) (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr))) out_of_memory(cinfo, 3); /* request exceeds malloc's ability */ /* Round up the requested size to a multiple of SIZEOF(ALIGN_TYPE) */ odd_bytes = sizeofobject % SIZEOF(ALIGN_TYPE); if (odd_bytes > 0) sizeofobject += SIZEOF(ALIGN_TYPE) - odd_bytes; /* Always make a new pool */ if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS) ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ hdr_ptr = (large_pool_ptr) jpeg_get_large(cinfo, sizeofobject + SIZEOF(large_pool_hdr)); if (hdr_ptr == NULL) out_of_memory(cinfo, 4); /* jpeg_get_large failed */ mem->total_space_allocated += sizeofobject + SIZEOF(large_pool_hdr); /* Success, initialize the new pool header and add to list */ hdr_ptr->hdr.next = mem->large_list[pool_id]; /* We maintain space counts in each pool header for statistical purposes, * even though they are not needed for allocation. */ hdr_ptr->hdr.bytes_used = sizeofobject; hdr_ptr->hdr.bytes_left = 0; mem->large_list[pool_id] = hdr_ptr; return (void FAR *) (hdr_ptr + 1); /* point to first data byte in pool */ } /* * Creation of 2-D sample arrays. * The pointers are in near heap, the samples themselves in FAR heap. * * To minimize allocation overhead and to allow I/O of large contiguous * blocks, we allocate the sample rows in groups of as many rows as possible * without exceeding MAX_ALLOC_CHUNK total bytes per allocation request. * NB: the virtual array control routines, later in this file, know about * this chunking of rows. The rowsperchunk value is left in the mem manager * object so that it can be saved away if this sarray is the workspace for * a virtual array. */ METHODDEF(JSAMPARRAY) alloc_sarray (j_common_ptr cinfo, int pool_id, JDIMENSION samplesperrow, JDIMENSION numrows) /* Allocate a 2-D sample array */ { my_mem_ptr mem = (my_mem_ptr) cinfo->mem; JSAMPARRAY result; JSAMPROW workspace; JDIMENSION rowsperchunk, currow, i; long ltemp; /* Calculate max # of rows allowed in one allocation chunk */ ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) / ((long) samplesperrow * SIZEOF(JSAMPLE)); if (ltemp <= 0) ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); if (ltemp < (long) numrows) rowsperchunk = (JDIMENSION) ltemp; else rowsperchunk = numrows; mem->last_rowsperchunk = rowsperchunk; /* Get space for row pointers (small object) */ result = (JSAMPARRAY) alloc_small(cinfo, pool_id, (size_t) (numrows * SIZEOF(JSAMPROW))); /* Get the rows themselves (large objects) */ currow = 0; while (currow < numrows) { rowsperchunk = MIN(rowsperchunk, numrows - currow); workspace = (JSAMPROW) alloc_large(cinfo, pool_id, (size_t) ((size_t) rowsperchunk * (size_t) samplesperrow * SIZEOF(JSAMPLE))); for (i = rowsperchunk; i > 0; i--) { result[currow++] = workspace; workspace += samplesperrow; } } return result; } /* * Creation of 2-D coefficient-block arrays. * This is essentially the same as the code for sample arrays, above. */ METHODDEF(JBLOCKARRAY) alloc_barray (j_common_ptr cinfo, int pool_id, JDIMENSION blocksperrow, JDIMENSION numrows) /* Allocate a 2-D coefficient-block array */ { my_mem_ptr mem = (my_mem_ptr) cinfo->mem; JBLOCKARRAY result; JBLOCKROW workspace; JDIMENSION rowsperchunk, currow, i; long ltemp; /* Calculate max # of rows allowed in one allocation chunk */ ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) / ((long) blocksperrow * SIZEOF(JBLOCK)); if (ltemp <= 0) ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); if (ltemp < (long) numrows) rowsperchunk = (JDIMENSION) ltemp; else rowsperchunk = numrows; mem->last_rowsperchunk = rowsperchunk; /* Get space for row pointers (small object) */ result = (JBLOCKARRAY) alloc_small(cinfo, pool_id, (size_t) (numrows * SIZEOF(JBLOCKROW))); /* Get the rows themselves (large objects) */ currow = 0; while (currow < numrows) { rowsperchunk = MIN(rowsperchunk, numrows - currow); workspace = (JBLOCKROW) alloc_large(cinfo, pool_id, (size_t) ((size_t) rowsperchunk * (size_t) blocksperrow * SIZEOF(JBLOCK))); for (i = rowsperchunk; i > 0; i--) { result[currow++] = workspace; workspace += blocksperrow; } } return result; } #ifdef NEED_DARRAY /* * Creation of 2-D difference arrays. * This is essentially the same as the code for sample arrays, above. */ METHODDEF(JDIFFARRAY) alloc_darray (j_common_ptr cinfo, int pool_id, JDIMENSION diffsperrow, JDIMENSION numrows) /* Allocate a 2-D difference array */ { my_mem_ptr mem = (my_mem_ptr) cinfo->mem; JDIFFARRAY result; JDIFFROW workspace; JDIMENSION rowsperchunk, currow, i; long ltemp; /* Calculate max # of rows allowed in one allocation chunk */ ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) / ((long) diffsperrow * SIZEOF(JDIFF)); if (ltemp <= 0) ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); if (ltemp < (long) numrows) rowsperchunk = (JDIMENSION) ltemp; else rowsperchunk = numrows; mem->last_rowsperchunk = rowsperchunk; /* Get space for row pointers (small object) */ result = (JDIFFARRAY) alloc_small(cinfo, pool_id, (size_t) (numrows * SIZEOF(JDIFFROW))); /* Get the rows themselves (large objects) */ currow = 0; while (currow < numrows) { rowsperchunk = MIN(rowsperchunk, numrows - currow); workspace = (JDIFFROW) alloc_large(cinfo, pool_id, (size_t) ((size_t) rowsperchunk * (size_t) diffsperrow * SIZEOF(JDIFF))); for (i = rowsperchunk; i > 0; i--) { result[currow++] = workspace; workspace += diffsperrow; } } return result; } #endif /* * About virtual array management: * * The above "normal" array routines are only used to allocate strip buffers * (as wide as the image, but just a few rows high). Full-image-sized buffers * are handled as "virtual" arrays. The array is still accessed a strip at a * time, but the memory manager must save the whole array for repeated * accesses. The intended implementation is that there is a strip buffer in * memory (as high as is possible given the desired memory limit), plus a * backing file that holds the rest of the array. * * The request_virt_array routines are told the total size of the image and * the maximum number of rows that will be accessed at once. The in-memory * buffer must be at least as large as the maxaccess value. * * The request routines create control blocks but not the in-memory buffers. * That is postponed until realize_virt_arrays is called. At that time the * total amount of space needed is known (approximately, anyway), so free * memory can be divided up fairly. * * The access_virt_array routines are responsible for making a specific strip * area accessible (after reading or writing the backing file, if necessary). * Note that the access routines are told whether the caller intends to modify * the accessed strip; during a read-only pass this saves having to rewrite * data to disk. The access routines are also responsible for pre-zeroing * any newly accessed rows, if pre-zeroing was requested. * * In current usage, the access requests are usually for nonoverlapping * strips; that is, successive access start_row numbers differ by exactly * num_rows = maxaccess. This means we can get good performance with simple * buffer dump/reload logic, by making the in-memory buffer be a multiple * of the access height; then there will never be accesses across bufferload * boundaries. The code will still work with overlapping access requests, * but it doesn't handle bufferload overlaps very efficiently. */ METHODDEF(jvirt_sarray_ptr) request_virt_sarray (j_common_ptr cinfo, int pool_id, boolean pre_zero, JDIMENSION samplesperrow, JDIMENSION numrows, JDIMENSION maxaccess) /* Request a virtual 2-D sample array */ { my_mem_ptr mem = (my_mem_ptr) cinfo->mem; jvirt_sarray_ptr result; /* Only IMAGE-lifetime virtual arrays are currently supported */ if (pool_id != JPOOL_IMAGE) ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ /* get control block */ result = (jvirt_sarray_ptr) alloc_small(cinfo, pool_id, SIZEOF(struct jvirt_sarray_control)); result->mem_buffer = NULL; /* marks array not yet realized */ result->rows_in_array = numrows; result->samplesperrow = samplesperrow; result->maxaccess = maxaccess; result->pre_zero = pre_zero; result->b_s_open = FALSE; /* no associated backing-store object */ result->next = mem->virt_sarray_list; /* add to list of virtual arrays */ mem->virt_sarray_list = result; return result; } METHODDEF(jvirt_barray_ptr) request_virt_barray (j_common_ptr cinfo, int pool_id, boolean pre_zero, JDIMENSION blocksperrow, JDIMENSION numrows, JDIMENSION maxaccess) /* Request a virtual 2-D coefficient-block array */ { my_mem_ptr mem = (my_mem_ptr) cinfo->mem; jvirt_barray_ptr result; /* Only IMAGE-lifetime virtual arrays are currently supported */ if (pool_id != JPOOL_IMAGE) ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ /* get control block */ result = (jvirt_barray_ptr) alloc_small(cinfo, pool_id, SIZEOF(struct jvirt_barray_control)); result->mem_buffer = NULL; /* marks array not yet realized */ result->rows_in_array = numrows; result->blocksperrow = blocksperrow; result->maxaccess = maxaccess; result->pre_zero = pre_zero; result->b_s_open = FALSE; /* no associated backing-store object */ result->next = mem->virt_barray_list; /* add to list of virtual arrays */ mem->virt_barray_list = result; return result; } METHODDEF(void) realize_virt_arrays (j_common_ptr cinfo) /* Allocate the in-memory buffers for any unrealized virtual arrays */ { my_mem_ptr mem = (my_mem_ptr) cinfo->mem; long space_per_minheight, maximum_space, avail_mem; long minheights, max_minheights; jvirt_sarray_ptr sptr; jvirt_barray_ptr bptr; /* Compute the minimum space needed (maxaccess rows in each buffer) * and the maximum space needed (full image height in each buffer). * These may be of use to the system-dependent jpeg_mem_available routine. */ space_per_minheight = 0; maximum_space = 0; for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) { if (sptr->mem_buffer == NULL) { /* if not realized yet */ space_per_minheight += (long) sptr->maxaccess * (long) sptr->samplesperrow * SIZEOF(JSAMPLE); maximum_space += (long) sptr->rows_in_array * (long) sptr->samplesperrow * SIZEOF(JSAMPLE); } } for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) { if (bptr->mem_buffer == NULL) { /* if not realized yet */ space_per_minheight += (long) bptr->maxaccess * (long) bptr->blocksperrow * SIZEOF(JBLOCK); maximum_space += (long) bptr->rows_in_array * (long) bptr->blocksperrow * SIZEOF(JBLOCK); } } if (space_per_minheight <= 0) return; /* no unrealized arrays, no work */ /* Determine amount of memory to actually use; this is system-dependent. */ avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space, mem->total_space_allocated); /* If the maximum space needed is available, make all the buffers full * height; otherwise parcel it out with the same number of minheights * in each buffer. */ if (avail_mem >= maximum_space) max_minheights = 1000000000L; else { max_minheights = avail_mem / space_per_minheight; /* If there doesn't seem to be enough space, try to get the minimum * anyway. This allows a "stub" implementation of jpeg_mem_available(). */ if (max_minheights <= 0) max_minheights = 1; } /* Allocate the in-memory buffers and initialize backing store as needed. */ for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) { if (sptr->mem_buffer == NULL) { /* if not realized yet */ minheights = ((long) sptr->rows_in_array - 1L) / sptr->maxaccess + 1L; if (minheights <= max_minheights) { /* This buffer fits in memory */ sptr->rows_in_mem = sptr->rows_in_array; } else { /* It doesn't fit in memory, create backing store. */ sptr->rows_in_mem = (JDIMENSION) (max_minheights * sptr->maxaccess); jpeg_open_backing_store(cinfo, & sptr->b_s_info, (long) sptr->rows_in_array * (long) sptr->samplesperrow * (long) SIZEOF(JSAMPLE)); sptr->b_s_open = TRUE; } sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE, sptr->samplesperrow, sptr->rows_in_mem); sptr->rowsperchunk = mem->last_rowsperchunk; sptr->cur_start_row = 0; sptr->first_undef_row = 0; sptr->dirty = FALSE; } } for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) { if (bptr->mem_buffer == NULL) { /* if not realized yet */ minheights = ((long) bptr->rows_in_array - 1L) / bptr->maxaccess + 1L; if (minheights <= max_minheights) { /* This buffer fits in memory */ bptr->rows_in_mem = bptr->rows_in_array; } else { /* It doesn't fit in memory, create backing store. */ bptr->rows_in_mem = (JDIMENSION) (max_minheights * bptr->maxaccess); jpeg_open_backing_store(cinfo, & bptr->b_s_info, (long) bptr->rows_in_array * (long) bptr->blocksperrow * (long) SIZEOF(JBLOCK)); bptr->b_s_open = TRUE; } bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE, bptr->blocksperrow, bptr->rows_in_mem); bptr->rowsperchunk = mem->last_rowsperchunk; bptr->cur_start_row = 0; bptr->first_undef_row = 0; bptr->dirty = FALSE; } } } LOCAL(void) do_sarray_io (j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing) /* Do backing store read or write of a virtual sample array */ { long bytesperrow, file_offset, byte_count, rows, thisrow, i; bytesperrow = (long) ptr->samplesperrow * SIZEOF(JSAMPLE); file_offset = ptr->cur_start_row * bytesperrow; /* Loop to read or write each allocation chunk in mem_buffer */ for (i = 0; i < (long) ptr->rows_in_mem; i += ptr->rowsperchunk) { /* One chunk, but check for short chunk at end of buffer */ rows = MIN((long) ptr->rowsperchunk, (long) ptr->rows_in_mem - i); /* Transfer no more than is currently defined */ thisrow = (long) ptr->cur_start_row + i; rows = MIN(rows, (long) ptr->first_undef_row - thisrow); /* Transfer no more than fits in file */ rows = MIN(rows, (long) ptr->rows_in_array - thisrow); if (rows <= 0) /* this chunk might be past end of file! */ break; byte_count = rows * bytesperrow; if (writing) (*ptr->b_s_info.write_backing_store) (cinfo, & ptr->b_s_info, (void FAR *) ptr->mem_buffer[i], file_offset, byte_count); else (*ptr->b_s_info.read_backing_store) (cinfo, & ptr->b_s_info, (void FAR *) ptr->mem_buffer[i], file_offset, byte_count); file_offset += byte_count; } } LOCAL(void) do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing) /* Do backing store read or write of a virtual coefficient-block array */ { long bytesperrow, file_offset, byte_count, rows, thisrow, i; bytesperrow = (long) ptr->blocksperrow * SIZEOF(JBLOCK); file_offset = ptr->cur_start_row * bytesperrow; /* Loop to read or write each allocation chunk in mem_buffer */ for (i = 0; i < (long) ptr->rows_in_mem; i += ptr->rowsperchunk) { /* One chunk, but check for short chunk at end of buffer */ rows = MIN((long) ptr->rowsperchunk, (long) ptr->rows_in_mem - i); /* Transfer no more than is currently defined */ thisrow = (long) ptr->cur_start_row + i; rows = MIN(rows, (long) ptr->first_undef_row - thisrow); /* Transfer no more than fits in file */ rows = MIN(rows, (long) ptr->rows_in_array - thisrow); if (rows <= 0) /* this chunk might be past end of file! */ break; byte_count = rows * bytesperrow; if (writing) (*ptr->b_s_info.write_backing_store) (cinfo, & ptr->b_s_info, (void FAR *) ptr->mem_buffer[i], file_offset, byte_count); else (*ptr->b_s_info.read_backing_store) (cinfo, & ptr->b_s_info, (void FAR *) ptr->mem_buffer[i], file_offset, byte_count); file_offset += byte_count; } } METHODDEF(JSAMPARRAY) access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr, JDIMENSION start_row, JDIMENSION num_rows, boolean writable) /* Access the part of a virtual sample array starting at start_row */ /* and extending for num_rows rows. writable is true if */ /* caller intends to modify the accessed area. */ { JDIMENSION end_row = start_row + num_rows; JDIMENSION undef_row; /* debugging check */ if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess || ptr->mem_buffer == NULL) ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); /* Make the desired part of the virtual array accessible */ if (start_row < ptr->cur_start_row || end_row > ptr->cur_start_row+ptr->rows_in_mem) { if (! ptr->b_s_open) ERREXIT(cinfo, JERR_VIRTUAL_BUG); /* Flush old buffer contents if necessary */ if (ptr->dirty) { do_sarray_io(cinfo, ptr, TRUE); ptr->dirty = FALSE; } /* Decide what part of virtual array to access. * Algorithm: if target address > current window, assume forward scan, * load starting at target address. If target address < current window, * assume backward scan, load so that target area is top of window. * Note that when switching from forward write to forward read, will have * start_row = 0, so the limiting case applies and we load from 0 anyway. */ if (start_row > ptr->cur_start_row) { ptr->cur_start_row = start_row; } else { /* use long arithmetic here to avoid overflow & unsigned problems */ long ltemp; ltemp = (long) end_row - (long) ptr->rows_in_mem; if (ltemp < 0) ltemp = 0; /* don't fall off front end of file */ ptr->cur_start_row = (JDIMENSION) ltemp; } /* Read in the selected part of the array. * During the initial write pass, we will do no actual read * because the selected part is all undefined. */ do_sarray_io(cinfo, ptr, FALSE); } /* Ensure the accessed part of the array is defined; prezero if needed. * To improve locality of access, we only prezero the part of the array * that the caller is about to access, not the entire in-memory array. */ if (ptr->first_undef_row < end_row) { if (ptr->first_undef_row < start_row) { if (writable) /* writer skipped over a section of array */ ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); undef_row = start_row; /* but reader is allowed to read ahead */ } else { undef_row = ptr->first_undef_row; } if (writable) ptr->first_undef_row = end_row; if (ptr->pre_zero) { size_t bytesperrow = (size_t) ptr->samplesperrow * SIZEOF(JSAMPLE); undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */ end_row -= ptr->cur_start_row; while (undef_row < end_row) { jzero_far((void FAR *) ptr->mem_buffer[undef_row], bytesperrow); undef_row++; } } else { if (! writable) /* reader looking at undefined data */ ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); } } /* Flag the buffer dirty if caller will write in it */ if (writable) ptr->dirty = TRUE; /* Return address of proper part of the buffer */ return ptr->mem_buffer + (start_row - ptr->cur_start_row); } METHODDEF(JBLOCKARRAY) access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr, JDIMENSION start_row, JDIMENSION num_rows, boolean writable) /* Access the part of a virtual block array starting at start_row */ /* and extending for num_rows rows. writable is true if */ /* caller intends to modify the accessed area. */ { JDIMENSION end_row = start_row + num_rows; JDIMENSION undef_row; /* debugging check */ if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess || ptr->mem_buffer == NULL) ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); /* Make the desired part of the virtual array accessible */ if (start_row < ptr->cur_start_row || end_row > ptr->cur_start_row+ptr->rows_in_mem) { if (! ptr->b_s_open) ERREXIT(cinfo, JERR_VIRTUAL_BUG); /* Flush old buffer contents if necessary */ if (ptr->dirty) { do_barray_io(cinfo, ptr, TRUE); ptr->dirty = FALSE; } /* Decide what part of virtual array to access. * Algorithm: if target address > current window, assume forward scan, * load starting at target address. If target address < current window, * assume backward scan, load so that target area is top of window. * Note that when switching from forward write to forward read, will have * start_row = 0, so the limiting case applies and we load from 0 anyway. */ if (start_row > ptr->cur_start_row) { ptr->cur_start_row = start_row; } else { /* use long arithmetic here to avoid overflow & unsigned problems */ long ltemp; ltemp = (long) end_row - (long) ptr->rows_in_mem; if (ltemp < 0) ltemp = 0; /* don't fall off front end of file */ ptr->cur_start_row = (JDIMENSION) ltemp; } /* Read in the selected part of the array. * During the initial write pass, we will do no actual read * because the selected part is all undefined. */ do_barray_io(cinfo, ptr, FALSE); } /* Ensure the accessed part of the array is defined; prezero if needed. * To improve locality of access, we only prezero the part of the array * that the caller is about to access, not the entire in-memory array. */ if (ptr->first_undef_row < end_row) { if (ptr->first_undef_row < start_row) { if (writable) /* writer skipped over a section of array */ ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); undef_row = start_row; /* but reader is allowed to read ahead */ } else { undef_row = ptr->first_undef_row; } if (writable) ptr->first_undef_row = end_row; if (ptr->pre_zero) { size_t bytesperrow = (size_t) ptr->blocksperrow * SIZEOF(JBLOCK); undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */ end_row -= ptr->cur_start_row; while (undef_row < end_row) { jzero_far((void FAR *) ptr->mem_buffer[undef_row], bytesperrow); undef_row++; } } else { if (! writable) /* reader looking at undefined data */ ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); } } /* Flag the buffer dirty if caller will write in it */ if (writable) ptr->dirty = TRUE; /* Return address of proper part of the buffer */ return ptr->mem_buffer + (start_row - ptr->cur_start_row); } /* * Release all objects belonging to a specified pool. */ METHODDEF(void) free_pool (j_common_ptr cinfo, int pool_id) { my_mem_ptr mem = (my_mem_ptr) cinfo->mem; small_pool_ptr shdr_ptr; large_pool_ptr lhdr_ptr; size_t space_freed; if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS) ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ #ifdef MEM_STATS if (cinfo->err->trace_level > 1) print_mem_stats(cinfo, pool_id); /* print pool's memory usage statistics */ #endif /* If freeing IMAGE pool, close any virtual arrays first */ if (pool_id == JPOOL_IMAGE) { jvirt_sarray_ptr sptr; jvirt_barray_ptr bptr; for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) { if (sptr->b_s_open) { /* there may be no backing store */ sptr->b_s_open = FALSE; /* prevent recursive close if error */ (*sptr->b_s_info.close_backing_store) (cinfo, & sptr->b_s_info); } } mem->virt_sarray_list = NULL; for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) { if (bptr->b_s_open) { /* there may be no backing store */ bptr->b_s_open = FALSE; /* prevent recursive close if error */ (*bptr->b_s_info.close_backing_store) (cinfo, & bptr->b_s_info); } } mem->virt_barray_list = NULL; } /* Release large objects */ lhdr_ptr = mem->large_list[pool_id]; mem->large_list[pool_id] = NULL; while (lhdr_ptr != NULL) { large_pool_ptr next_lhdr_ptr = lhdr_ptr->hdr.next; space_freed = lhdr_ptr->hdr.bytes_used + lhdr_ptr->hdr.bytes_left + SIZEOF(large_pool_hdr); jpeg_free_large(cinfo, (void FAR *) lhdr_ptr, space_freed); mem->total_space_allocated -= space_freed; lhdr_ptr = next_lhdr_ptr; } /* Release small objects */ shdr_ptr = mem->small_list[pool_id]; mem->small_list[pool_id] = NULL; while (shdr_ptr != NULL) { small_pool_ptr next_shdr_ptr = shdr_ptr->hdr.next; space_freed = shdr_ptr->hdr.bytes_used + shdr_ptr->hdr.bytes_left + SIZEOF(small_pool_hdr); jpeg_free_small(cinfo, (void *) shdr_ptr, space_freed); mem->total_space_allocated -= space_freed; shdr_ptr = next_shdr_ptr; } } /* * Close up shop entirely. * Note that this cannot be called unless cinfo->mem is non-NULL. */ METHODDEF(void) self_destruct (j_common_ptr cinfo) { int pool; /* Close all backing store, release all memory. * Releasing pools in reverse order might help avoid fragmentation * with some (brain-damaged) malloc libraries. */ for (pool = JPOOL_NUMPOOLS-1; pool >= JPOOL_PERMANENT; pool--) { free_pool(cinfo, pool); } /* Release the memory manager control block too. */ jpeg_free_small(cinfo, (void *) cinfo->mem, SIZEOF(my_memory_mgr)); cinfo->mem = NULL; /* ensures I will be called only once */ jpeg_mem_term(cinfo); /* system-dependent cleanup */ } /* * Memory manager initialization. * When this is called, only the error manager pointer is valid in cinfo! */ GLOBAL(void) jinit_memory_mgr (j_common_ptr cinfo) { my_mem_ptr mem; long max_to_use; int pool; size_t test_mac; cinfo->mem = NULL; /* for safety if init fails */ /* Check for configuration errors. * SIZEOF(ALIGN_TYPE) should be a power of 2; otherwise, it probably * doesn't reflect any real hardware alignment requirement. * The test is a little tricky: for X>0, X and X-1 have no one-bits * in common if and only if X is a power of 2, ie has only one one-bit. * Some compilers may give an "unreachable code" warning here; ignore it. */ if ((SIZEOF(ALIGN_TYPE) & (SIZEOF(ALIGN_TYPE)-1)) != 0) ERREXIT(cinfo, JERR_BAD_ALIGN_TYPE); /* MAX_ALLOC_CHUNK must be representable as type size_t, and must be * a multiple of SIZEOF(ALIGN_TYPE). * Again, an "unreachable code" warning may be ignored here. * But a "constant too large" warning means you need to fix MAX_ALLOC_CHUNK. */ test_mac = (size_t) MAX_ALLOC_CHUNK; if ((long) test_mac != MAX_ALLOC_CHUNK || (MAX_ALLOC_CHUNK % SIZEOF(ALIGN_TYPE)) != 0) ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK); max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */ /* Attempt to allocate memory manager's control block */ mem = (my_mem_ptr) jpeg_get_small(cinfo, SIZEOF(my_memory_mgr)); if (mem == NULL) { jpeg_mem_term(cinfo); /* system-dependent cleanup */ ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 0); } /* OK, fill in the method pointers */ mem->pub.alloc_small = alloc_small; mem->pub.alloc_large = alloc_large; mem->pub.alloc_sarray = alloc_sarray; mem->pub.alloc_barray = alloc_barray; #ifdef NEED_DARRAY mem->pub.alloc_darray = alloc_darray; #endif mem->pub.request_virt_sarray = request_virt_sarray; mem->pub.request_virt_barray = request_virt_barray; mem->pub.realize_virt_arrays = realize_virt_arrays; mem->pub.access_virt_sarray = access_virt_sarray; mem->pub.access_virt_barray = access_virt_barray; mem->pub.free_pool = free_pool; mem->pub.self_destruct = self_destruct; /* Make MAX_ALLOC_CHUNK accessible to other modules */ mem->pub.max_alloc_chunk = MAX_ALLOC_CHUNK; /* Initialize working state */ mem->pub.max_memory_to_use = max_to_use; for (pool = JPOOL_NUMPOOLS-1; pool >= JPOOL_PERMANENT; pool--) { mem->small_list[pool] = NULL; mem->large_list[pool] = NULL; } mem->virt_sarray_list = NULL; mem->virt_barray_list = NULL; mem->total_space_allocated = SIZEOF(my_memory_mgr); /* Declare ourselves open for business */ cinfo->mem = & mem->pub; /* Check for an environment variable JPEGMEM; if found, override the * default max_memory setting from jpeg_mem_init. Note that the * surrounding application may again override this value. * If your system doesn't support getenv(), define NO_GETENV to disable * this feature. */ #ifndef NO_GETENV { char * memenv; if ((memenv = getenv("JPEGMEM")) != NULL) { char ch = 'x'; if (sscanf(memenv, "%ld%c", &max_to_use, &ch) > 0) { if (ch == 'm' || ch == 'M') max_to_use *= 1000L; mem->pub.max_memory_to_use = max_to_use * 1000L; } } } #endif } ���������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jclossls.c�����������������������������������������������0000644�0001750�0001750�00000003636�12320456500�022030� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jclossls.c * * Copyright (C) 1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains the control logic for the lossless JPEG compressor. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossls.h" #ifdef C_LOSSLESS_SUPPORTED /* * Initialize for a processing pass. */ METHODDEF(void) start_pass (j_compress_ptr cinfo, J_BUF_MODE pass_mode) { j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; (*losslsc->scaler_start_pass) (cinfo); (*losslsc->predict_start_pass) (cinfo); (*losslsc->diff_start_pass) (cinfo, pass_mode); } /* * Initialize the lossless compression codec. * This is called only once, during master selection. */ GLOBAL(void) jinit_lossless_c_codec(j_compress_ptr cinfo) { j_lossless_c_ptr losslsc; /* Create subobject in permanent pool */ losslsc = (j_lossless_c_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, SIZEOF(jpeg_lossless_c_codec)); cinfo->codec = (struct jpeg_c_codec *) losslsc; /* Initialize sub-modules */ /* Scaler */ jinit_c_scaler(cinfo); /* Differencer */ jinit_differencer(cinfo); /* Entropy encoding: either Huffman or arithmetic coding. */ if (cinfo->arith_code) { #ifdef WITH_ARITHMETIC_PATCH jinit_arith_encoder(cinfo); #else ERREXIT(cinfo, JERR_ARITH_NOTIMPL); #endif } else { jinit_lhuff_encoder(cinfo); } /* Need a full-image difference buffer in any multi-pass mode. */ jinit_c_diff_controller(cinfo, (boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding)); /* Initialize method pointers. * * Note: entropy_start_pass and entropy_finish_pass are assigned in * jclhuff.c and compress_data is assigned in jcdiffct.c. */ losslsc->pub.start_pass = start_pass; } #endif /* C_LOSSLESS_SUPPORTED */ ��������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdlossy.c������������������������������������������������0000644�0001750�0001750�00000016371�12320456500�021663� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdlossy.c * * Copyright (C) 1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains the control logic for the lossy JPEG decompressor. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossy.h" /* * Compute output image dimensions and related values. */ METHODDEF(void) calc_output_dimensions (j_decompress_ptr cinfo) { #ifdef IDCT_SCALING_SUPPORTED int ci; jpeg_component_info *compptr; /* Compute actual output image dimensions and DCT scaling choices. */ if (cinfo->scale_num * 8 <= cinfo->scale_denom) { /* Provide 1/8 scaling */ cinfo->output_width = (JDIMENSION) jdiv_round_up((long) cinfo->image_width, 8L); cinfo->output_height = (JDIMENSION) jdiv_round_up((long) cinfo->image_height, 8L); cinfo->min_codec_data_unit = 1; } else if (cinfo->scale_num * 4 <= cinfo->scale_denom) { /* Provide 1/4 scaling */ cinfo->output_width = (JDIMENSION) jdiv_round_up((long) cinfo->image_width, 4L); cinfo->output_height = (JDIMENSION) jdiv_round_up((long) cinfo->image_height, 4L); cinfo->min_codec_data_unit = 2; } else if (cinfo->scale_num * 2 <= cinfo->scale_denom) { /* Provide 1/2 scaling */ cinfo->output_width = (JDIMENSION) jdiv_round_up((long) cinfo->image_width, 2L); cinfo->output_height = (JDIMENSION) jdiv_round_up((long) cinfo->image_height, 2L); cinfo->min_codec_data_unit = 4; } else { /* Provide 1/1 scaling */ cinfo->output_width = cinfo->image_width; cinfo->output_height = cinfo->image_height; cinfo->min_codec_data_unit = DCTSIZE; } /* In selecting the actual DCT scaling for each component, we try to * scale up the chroma components via IDCT scaling rather than upsampling. * This saves time if the upsampler gets to use 1:1 scaling. * Note this code assumes that the supported DCT scalings are powers of 2. */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { int ssize = cinfo->min_codec_data_unit; while (ssize < DCTSIZE && (compptr->h_samp_factor * ssize * 2 <= cinfo->max_h_samp_factor * cinfo->min_codec_data_unit) && (compptr->v_samp_factor * ssize * 2 <= cinfo->max_v_samp_factor * cinfo->min_codec_data_unit)) { ssize = ssize * 2; } compptr->codec_data_unit = ssize; } /* Recompute downsampled dimensions of components; * application needs to know these if using raw downsampled data. */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { /* Size in samples, after IDCT scaling */ compptr->downsampled_width = (JDIMENSION) jdiv_round_up((long) cinfo->image_width * (long) (compptr->h_samp_factor * compptr->codec_data_unit), (long) (cinfo->max_h_samp_factor * DCTSIZE)); compptr->downsampled_height = (JDIMENSION) jdiv_round_up((long) cinfo->image_height * (long) (compptr->v_samp_factor * compptr->codec_data_unit), (long) (cinfo->max_v_samp_factor * DCTSIZE)); } #else /* !IDCT_SCALING_SUPPORTED */ /* Hardwire it to "no scaling" */ cinfo->output_width = cinfo->image_width; cinfo->output_height = cinfo->image_height; /* jdinput.c has already initialized codec_data_unit to DCTSIZE, * and has computed unscaled downsampled_width and downsampled_height. */ #endif /* IDCT_SCALING_SUPPORTED */ } /* * Save away a copy of the Q-table referenced by each component present * in the current scan, unless already saved during a prior scan. * * In a multiple-scan JPEG file, the encoder could assign different components * the same Q-table slot number, but change table definitions between scans * so that each component uses a different Q-table. (The IJG encoder is not * currently capable of doing this, but other encoders might.) Since we want * to be able to dequantize all the components at the end of the file, this * means that we have to save away the table actually used for each component. * We do this by copying the table at the start of the first scan containing * the component. * The JPEG spec prohibits the encoder from changing the contents of a Q-table * slot between scans of a component using that slot. If the encoder does so * anyway, this decoder will simply use the Q-table values that were current * at the start of the first scan for the component. * * The decompressor output side looks only at the saved quant tables, * not at the current Q-table slots. */ LOCAL(void) latch_quant_tables (j_decompress_ptr cinfo) { int ci, qtblno; jpeg_component_info *compptr; JQUANT_TBL * qtbl; for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; /* No work if we already saved Q-table for this component */ if (compptr->quant_table != NULL) continue; /* Make sure specified quantization table is present */ qtblno = compptr->quant_tbl_no; if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS || cinfo->quant_tbl_ptrs[qtblno] == NULL) ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno); /* OK, save away the quantization table */ qtbl = (JQUANT_TBL *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(JQUANT_TBL)); MEMCOPY(qtbl, cinfo->quant_tbl_ptrs[qtblno], SIZEOF(JQUANT_TBL)); compptr->quant_table = qtbl; } } /* * Initialize for an input processing pass. */ METHODDEF(void) start_input_pass (j_decompress_ptr cinfo) { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; latch_quant_tables(cinfo); (*lossyd->entropy_start_pass) (cinfo); (*lossyd->coef_start_input_pass) (cinfo); } /* * Initialize for an output processing pass. */ METHODDEF(void) start_output_pass (j_decompress_ptr cinfo) { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; (*lossyd->idct_start_pass) (cinfo); (*lossyd->coef_start_output_pass) (cinfo); } /* * Initialize the lossy decompression codec. * This is called only once, during master selection. */ GLOBAL(void) jinit_lossy_d_codec (j_decompress_ptr cinfo) { j_lossy_d_ptr lossyd; boolean use_c_buffer; /* Create subobject in permanent pool */ lossyd = (j_lossy_d_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, SIZEOF(jpeg_lossy_d_codec)); cinfo->codec = (struct jpeg_d_codec *) lossyd; /* Initialize sub-modules */ /* Inverse DCT */ jinit_inverse_dct(cinfo); /* Entropy decoding: either Huffman or arithmetic coding. */ if (cinfo->arith_code) { #ifdef WITH_ARITHMETIC_PATCH jinit_arith_decoder(cinfo); #else ERREXIT(cinfo, JERR_ARITH_NOTIMPL); #endif } else { if (cinfo->process == JPROC_PROGRESSIVE) { #ifdef D_PROGRESSIVE_SUPPORTED jinit_phuff_decoder(cinfo); #else ERREXIT(cinfo, JERR_NOT_COMPILED); #endif } else jinit_shuff_decoder(cinfo); } use_c_buffer = cinfo->inputctl->has_multiple_scans || cinfo->buffered_image; jinit_d_coef_controller(cinfo, use_c_buffer); /* Initialize method pointers. * * Note: consume_data and decompress_data are assigned in jdcoefct.c. */ lossyd->pub.calc_output_dimensions = calc_output_dimensions; lossyd->pub.start_input_pass = start_input_pass; lossyd->pub.start_output_pass = start_output_pass; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdinput.c������������������������������������������������0000644�0001750�0001750�00000027614�12320456500�021653� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdinput.c * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains input control logic for the JPEG decompressor. * These routines are concerned with controlling the decompressor's input * processing (marker reading and coefficient/difference decoding). * The actual input reading is done in jdmarker.c, jdhuff.c, jdphuff.c, * and jdlhuff.c. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" /* Private state */ typedef struct { struct jpeg_input_controller pub; /* public fields */ boolean inheaders; /* TRUE until first SOS is reached */ } my_input_controller; typedef my_input_controller * my_inputctl_ptr; /* Forward declarations */ METHODDEF(int) consume_markers JPP((j_decompress_ptr cinfo)); /* * Routines to calculate various quantities related to the size of the image. */ LOCAL(void) initial_setup (j_decompress_ptr cinfo) /* Called once, when first SOS marker is reached */ { int ci; jpeg_component_info *compptr; /* Make sure image isn't bigger than I can handle */ if ((long) cinfo->image_height > (long) JPEG_MAX_DIMENSION || (long) cinfo->image_width > (long) JPEG_MAX_DIMENSION) ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION); if (cinfo->process == JPROC_LOSSLESS) { /* If precision > compiled-in value, we must downscale */ if (cinfo->data_precision > BITS_IN_JSAMPLE) WARNMS2(cinfo, JWRN_MUST_DOWNSCALE, cinfo->data_precision, BITS_IN_JSAMPLE); } else { /* Lossy processes */ /* For now, precision must match compiled-in value... */ if (cinfo->data_precision != BITS_IN_JSAMPLE) ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision); } /* Check that number of components won't exceed internal array sizes */ if (cinfo->num_components > MAX_COMPONENTS) ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, MAX_COMPONENTS); /* Compute maximum sampling factors; check factor validity */ cinfo->max_h_samp_factor = 1; cinfo->max_v_samp_factor = 1; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR || compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR) ERREXIT(cinfo, JERR_BAD_SAMPLING); cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor, compptr->h_samp_factor); cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor, compptr->v_samp_factor); } /* We initialize codec_data_unit and min_codec_data_unit to data_unit. * In the full decompressor, this will be overridden by jdmaster.c; * but in the transcoder, jdmaster.c is not used, so we must do it here. */ cinfo->min_codec_data_unit = cinfo->data_unit; /* Compute dimensions of components */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { compptr->codec_data_unit = cinfo->data_unit; /* Size in data units */ compptr->width_in_data_units = (JDIMENSION) jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor, (long) (cinfo->max_h_samp_factor * cinfo->data_unit)); compptr->height_in_data_units = (JDIMENSION) jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor, (long) (cinfo->max_v_samp_factor * cinfo->data_unit)); /* downsampled_width and downsampled_height will also be overridden by * jdmaster.c if we are doing full decompression. The transcoder library * doesn't use these values, but the calling application might. */ /* Size in samples */ compptr->downsampled_width = (JDIMENSION) jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor, (long) cinfo->max_h_samp_factor); compptr->downsampled_height = (JDIMENSION) jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor, (long) cinfo->max_v_samp_factor); /* Mark component needed, until color conversion says otherwise */ compptr->component_needed = TRUE; /* Mark no quantization table yet saved for component */ compptr->quant_table = NULL; } /* Compute number of fully interleaved MCU rows. */ cinfo->total_iMCU_rows = (JDIMENSION) jdiv_round_up((long) cinfo->image_height, (long) (cinfo->max_v_samp_factor*cinfo->data_unit)); /* Decide whether file contains multiple scans */ if (cinfo->comps_in_scan < cinfo->num_components || cinfo->process == JPROC_PROGRESSIVE) cinfo->inputctl->has_multiple_scans = TRUE; else cinfo->inputctl->has_multiple_scans = FALSE; } LOCAL(void) per_scan_setup (j_decompress_ptr cinfo) /* Do computations that are needed before processing a JPEG scan */ /* cinfo->comps_in_scan and cinfo->cur_comp_info[] were set from SOS marker */ { int ci, mcublks, tmp; jpeg_component_info *compptr; if (cinfo->comps_in_scan == 1) { /* Noninterleaved (single-component) scan */ compptr = cinfo->cur_comp_info[0]; /* Overall image size in MCUs */ cinfo->MCUs_per_row = compptr->width_in_data_units; cinfo->MCU_rows_in_scan = compptr->height_in_data_units; /* For noninterleaved scan, always one data unit per MCU */ compptr->MCU_width = 1; compptr->MCU_height = 1; compptr->MCU_data_units = 1; compptr->MCU_sample_width = compptr->codec_data_unit; compptr->last_col_width = 1; /* For noninterleaved scans, it is convenient to define last_row_height * as the number of data unit rows present in the last iMCU row. */ tmp = (int) (compptr->height_in_data_units % compptr->v_samp_factor); if (tmp == 0) tmp = compptr->v_samp_factor; compptr->last_row_height = tmp; /* Prepare array describing MCU composition */ cinfo->data_units_in_MCU = 1; cinfo->MCU_membership[0] = 0; } else { /* Interleaved (multi-component) scan */ if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN) ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan, MAX_COMPS_IN_SCAN); /* Overall image size in MCUs */ cinfo->MCUs_per_row = (JDIMENSION) jdiv_round_up((long) cinfo->image_width, (long) (cinfo->max_h_samp_factor*cinfo->data_unit)); cinfo->MCU_rows_in_scan = (JDIMENSION) jdiv_round_up((long) cinfo->image_height, (long) (cinfo->max_v_samp_factor*cinfo->data_unit)); cinfo->data_units_in_MCU = 0; for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; /* Sampling factors give # of data units of component in each MCU */ compptr->MCU_width = compptr->h_samp_factor; compptr->MCU_height = compptr->v_samp_factor; compptr->MCU_data_units = compptr->MCU_width * compptr->MCU_height; compptr->MCU_sample_width = compptr->MCU_width * compptr->codec_data_unit; /* Figure number of non-dummy data units in last MCU column & row */ tmp = (int) (compptr->width_in_data_units % compptr->MCU_width); if (tmp == 0) tmp = compptr->MCU_width; compptr->last_col_width = tmp; tmp = (int) (compptr->height_in_data_units % compptr->MCU_height); if (tmp == 0) tmp = compptr->MCU_height; compptr->last_row_height = tmp; /* Prepare array describing MCU composition */ mcublks = compptr->MCU_data_units; if (cinfo->data_units_in_MCU + mcublks > D_MAX_DATA_UNITS_IN_MCU) ERREXIT(cinfo, JERR_BAD_MCU_SIZE); while (mcublks-- > 0) { cinfo->MCU_membership[cinfo->data_units_in_MCU++] = ci; } } } } /* * Initialize the input modules to read a scan of compressed data. * The first call to this is done by jdmaster.c after initializing * the entire decompressor (during jpeg_start_decompress). * Subsequent calls come from consume_markers, below. */ METHODDEF(void) start_input_pass (j_decompress_ptr cinfo) { per_scan_setup(cinfo); (*cinfo->codec->start_input_pass) (cinfo); cinfo->inputctl->consume_input = cinfo->codec->consume_data; } /* * Finish up after inputting a compressed-data scan. * This is called by the coefficient controller after it's read all * the expected data of the scan. */ METHODDEF(void) finish_input_pass (j_decompress_ptr cinfo) { cinfo->inputctl->consume_input = consume_markers; } /* * Read JPEG markers before, between, or after compressed-data scans. * Change state as necessary when a new scan is reached. * Return value is JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI. * * The consume_input method pointer points either here or to the * coefficient controller's consume_data routine, depending on whether * we are reading a compressed data segment or inter-segment markers. */ METHODDEF(int) consume_markers (j_decompress_ptr cinfo) { my_inputctl_ptr inputctl = (my_inputctl_ptr) cinfo->inputctl; int val; if (inputctl->pub.eoi_reached) /* After hitting EOI, read no further */ return JPEG_REACHED_EOI; val = (*cinfo->marker->read_markers) (cinfo); switch (val) { case JPEG_REACHED_SOS: /* Found SOS */ if (inputctl->inheaders) { /* 1st SOS */ initial_setup(cinfo); /* * Initialize the decompression codec. We need to do this here so that * any codec-specific fields and function pointers are available to * the rest of the library. */ jinit_d_codec(cinfo); inputctl->inheaders = FALSE; /* Note: start_input_pass must be called by jdmaster.c * before any more input can be consumed. jdapimin.c is * responsible for enforcing this sequencing. */ } else { /* 2nd or later SOS marker */ if (! inputctl->pub.has_multiple_scans) ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */ start_input_pass(cinfo); } break; case JPEG_REACHED_EOI: /* Found EOI */ inputctl->pub.eoi_reached = TRUE; if (inputctl->inheaders) { /* Tables-only datastream, apparently */ if (cinfo->marker->saw_SOF) ERREXIT(cinfo, JERR_SOF_NO_SOS); } else { /* Prevent infinite loop in coef ctlr's decompress_data routine * if user set output_scan_number larger than number of scans. */ if (cinfo->output_scan_number > cinfo->input_scan_number) cinfo->output_scan_number = cinfo->input_scan_number; } break; case JPEG_SUSPENDED: break; } return val; } /* * Reset state to begin a fresh datastream. */ METHODDEF(void) reset_input_controller (j_decompress_ptr cinfo) { my_inputctl_ptr inputctl = (my_inputctl_ptr) cinfo->inputctl; inputctl->pub.consume_input = consume_markers; inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */ inputctl->pub.eoi_reached = FALSE; inputctl->inheaders = TRUE; /* Reset other modules */ (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo); (*cinfo->marker->reset_marker_reader) (cinfo); /* Reset progression state -- would be cleaner if entropy decoder did this */ cinfo->coef_bits = NULL; } /* * Initialize the input controller module. * This is called only once, when the decompression object is created. */ GLOBAL(void) jinit_input_controller (j_decompress_ptr cinfo) { my_inputctl_ptr inputctl; /* Create subobject in permanent pool */ inputctl = (my_inputctl_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, SIZEOF(my_input_controller)); cinfo->inputctl = (struct jpeg_input_controller *) inputctl; /* Initialize method pointers */ inputctl->pub.consume_input = consume_markers; inputctl->pub.reset_input_controller = reset_input_controller; inputctl->pub.start_input_pass = start_input_pass; inputctl->pub.finish_input_pass = finish_input_pass; /* Initialize state: can't use reset_input_controller since we don't * want to try to reset other modules yet. */ inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */ inputctl->pub.eoi_reached = FALSE; inputctl->inheaders = TRUE; } ��������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jconfig.mac����������������������������������������������0000644�0001750�0001750�00000002332�12320456500�022121� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* jconfig.mac --- jconfig.h for CodeWarrior on Apple Macintosh */ /* see jconfig.doc for explanations */ #define HAVE_PROTOTYPES #define HAVE_UNSIGNED_CHAR #define HAVE_UNSIGNED_SHORT /* #define void char */ /* #define const */ #undef CHAR_IS_UNSIGNED #define HAVE_STDDEF_H #define HAVE_STDLIB_H #undef NEED_BSD_STRINGS #undef NEED_SYS_TYPES_H #undef NEED_FAR_POINTERS #undef NEED_SHORT_EXTERNAL_NAMES #undef INCOMPLETE_TYPES_BROKEN #ifdef JPEG_INTERNALS #undef RIGHT_SHIFT_IS_UNSIGNED #define USE_MAC_MEMMGR /* Define this if you use jmemmac.c */ #define ALIGN_TYPE long /* Needed for 680x0 Macs */ #endif /* JPEG_INTERNALS */ #ifdef JPEG_CJPEG_DJPEG #define BMP_SUPPORTED /* BMP image file format */ #define GIF_SUPPORTED /* GIF image file format */ #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ #undef RLE_SUPPORTED /* Utah RLE image file format */ #define TARGA_SUPPORTED /* Targa image file format */ #define USE_CCOMMAND /* Command line reader for Macintosh */ #define TWO_FILE_COMMANDLINE /* Binary I/O thru stdin/stdout doesn't work */ #undef NEED_SIGNAL_CATCHER #undef DONT_USE_B_MODE #undef PROGRESS_REPORT /* optional */ #endif /* JPEG_CJPEG_DJPEG */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdscale.c������������������������������������������������0000644�0001750�0001750�00000006064�12320456500�021577� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdscale.c * * Copyright (C) 1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains sample scaling for lossless JPEG. This is a * combination of upscaling the undifferenced sample by 2^Pt and downscaling * the sample to fit into JSAMPLE. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossls.h" /* Private declarations for lossless codec */ #ifdef D_LOSSLESS_SUPPORTED /* * Private scaler object for lossless decoding. */ typedef struct { int scale_factor; } scaler; typedef scaler * scaler_ptr; /* * Scalers for packing sample differences into JSAMPLEs. */ METHODDEF(void) simple_upscale(j_decompress_ptr cinfo, JDIFFROW diff_buf, JSAMPROW output_buf, JDIMENSION width) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; scaler_ptr scaler = (scaler_ptr) losslsd->scaler_private; int scale_factor = scaler->scale_factor; unsigned int xindex; for (xindex = 0; xindex < width; xindex++) output_buf[xindex] = (JSAMPLE) (diff_buf[xindex] << scale_factor); } METHODDEF(void) simple_downscale(j_decompress_ptr cinfo, JDIFFROW diff_buf, JSAMPROW output_buf, JDIMENSION width) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; scaler_ptr scaler = (scaler_ptr) losslsd->scaler_private; int scale_factor = scaler->scale_factor; unsigned int xindex; SHIFT_TEMPS for (xindex = 0; xindex < width; xindex++) output_buf[xindex] = (JSAMPLE) RIGHT_SHIFT(diff_buf[xindex], scale_factor); } METHODDEF(void) noscale(j_decompress_ptr cinfo, JDIFFROW diff_buf, JSAMPROW output_buf, JDIMENSION width) { unsigned int xindex; (void)cinfo; for (xindex = 0; xindex < width; xindex++) output_buf[xindex] = (JSAMPLE) diff_buf[xindex]; } METHODDEF(void) scaler_start_pass (j_decompress_ptr cinfo) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; scaler_ptr scaler = (scaler_ptr) losslsd->scaler_private; int downscale; /* * Downscale by the difference in the input vs. output precision. If the * output precision >= input precision, then do not downscale. */ downscale = BITS_IN_JSAMPLE < cinfo->data_precision ? cinfo->data_precision - BITS_IN_JSAMPLE : 0; scaler->scale_factor = cinfo->Al - downscale; /* Set scaler functions based on scale_factor (positive = left shift) */ if (scaler->scale_factor > 0) losslsd->scaler_scale = simple_upscale; else if (scaler->scale_factor < 0) { scaler->scale_factor = -scaler->scale_factor; losslsd->scaler_scale = simple_downscale; } else losslsd->scaler_scale = noscale; } GLOBAL(void) jinit_d_scaler (j_decompress_ptr cinfo) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; scaler_ptr scaler; scaler = (scaler_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(scaler)); losslsd->scaler_private = (void *) scaler; losslsd->scaler_start_pass = scaler_start_pass; } #endif /* D_LOSSLESS_SUPPORTED */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdcoefct.c�����������������������������������������������0000644�0001750�0001750�00000062120�12320456500�021746� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdcoefct.c * * Copyright (C) 1994-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains the coefficient buffer controller for decompression. * This controller is the top level of the lossy JPEG decompressor proper. * The coefficient buffer lies between entropy decoding and inverse-DCT steps. * * In buffered-image mode, this controller is the interface between * input-oriented processing and output-oriented processing. * Also, the input side (only) is used when reading a file for transcoding. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossy.h" /* Block smoothing is only applicable for progressive JPEG, so: */ #ifndef D_PROGRESSIVE_SUPPORTED #undef BLOCK_SMOOTHING_SUPPORTED #endif /* Private buffer controller object */ typedef struct { /* These variables keep track of the current location of the input side. */ /* cinfo->input_iMCU_row is also used for this. */ JDIMENSION MCU_ctr; /* counts MCUs processed in current row */ int MCU_vert_offset; /* counts MCU rows within iMCU row */ int MCU_rows_per_iMCU_row; /* number of such rows needed */ /* The output side's location is represented by cinfo->output_iMCU_row. */ /* In single-pass modes, it's sufficient to buffer just one MCU. * We allocate a workspace of D_MAX_DATA_UNITS_IN_MCU coefficient blocks, * and let the entropy decoder write into that workspace each time. * (On 80x86, the workspace is FAR even though it's not really very big; * this is to keep the module interfaces unchanged when a large coefficient * buffer is necessary.) * In multi-pass modes, this array points to the current MCU's blocks * within the virtual arrays; it is used only by the input side. */ JBLOCKROW MCU_buffer[D_MAX_DATA_UNITS_IN_MCU]; #ifdef D_MULTISCAN_FILES_SUPPORTED /* In multi-pass modes, we need a virtual block array for each component. */ jvirt_barray_ptr whole_image[MAX_COMPONENTS]; #endif #ifdef BLOCK_SMOOTHING_SUPPORTED /* When doing block smoothing, we latch coefficient Al values here */ int * coef_bits_latch; #define SAVED_COEFS 6 /* we save coef_bits[0..5] */ #endif } d_coef_controller; typedef d_coef_controller * d_coef_ptr; /* Forward declarations */ METHODDEF(int) decompress_onepass JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); #ifdef D_MULTISCAN_FILES_SUPPORTED METHODDEF(int) decompress_data JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); #endif #ifdef BLOCK_SMOOTHING_SUPPORTED LOCAL(boolean) smoothing_ok JPP((j_decompress_ptr cinfo)); METHODDEF(int) decompress_smooth_data JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); #endif LOCAL(void) start_iMCU_row (j_decompress_ptr cinfo) /* Reset within-iMCU-row counters for a new row (input side) */ { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; d_coef_ptr coef = (d_coef_ptr) lossyd->coef_private; /* In an interleaved scan, an MCU row is the same as an iMCU row. * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows. * But at the bottom of the image, process only what's left. */ if (cinfo->comps_in_scan > 1) { coef->MCU_rows_per_iMCU_row = 1; } else { if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1)) coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor; else coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height; } coef->MCU_ctr = 0; coef->MCU_vert_offset = 0; } /* * Initialize for an input processing pass. */ METHODDEF(void) start_input_pass (j_decompress_ptr cinfo) { cinfo->input_iMCU_row = 0; start_iMCU_row(cinfo); } /* * Initialize for an output processing pass. */ METHODDEF(void) start_output_pass (j_decompress_ptr cinfo) { #ifdef BLOCK_SMOOTHING_SUPPORTED j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; /* d_coef_ptr coef = (d_coef_ptr) lossyd->coef_private; */ /* If multipass, check to see whether to use block smoothing on this pass */ if (lossyd->coef_arrays != NULL) { if (cinfo->do_block_smoothing && smoothing_ok(cinfo)) lossyd->pub.decompress_data = decompress_smooth_data; else lossyd->pub.decompress_data = decompress_data; } #endif cinfo->output_iMCU_row = 0; } /* * Decompress and return some data in the single-pass case. * Always attempts to emit one fully interleaved MCU row ("iMCU" row). * Input and output must run in lockstep since we have only a one-MCU buffer. * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. * * NB: output_buf contains a plane for each component in image, * which we index according to the component's SOF position. */ METHODDEF(int) decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; d_coef_ptr coef = (d_coef_ptr) lossyd->coef_private; JDIMENSION MCU_col_num; /* index of current MCU within row */ JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1; JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; int blkn, ci, xindex, yindex, yoffset, useful_width; JSAMPARRAY output_ptr; JDIMENSION start_col, output_col; jpeg_component_info *compptr; inverse_DCT_method_ptr inverse_DCT; /* Loop to process as much as one whole iMCU row */ for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; yoffset++) { for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col; MCU_col_num++) { /* Try to fetch an MCU. Entropy decoder expects buffer to be zeroed. */ jzero_far((void FAR *) coef->MCU_buffer[0], (size_t) (cinfo->data_units_in_MCU * SIZEOF(JBLOCK))); if (! (*lossyd->entropy_decode_mcu) (cinfo, coef->MCU_buffer)) { /* Suspension forced; update state counters and exit */ coef->MCU_vert_offset = yoffset; coef->MCU_ctr = MCU_col_num; return JPEG_SUSPENDED; } /* Determine where data should go in output_buf and do the IDCT thing. * We skip dummy blocks at the right and bottom edges (but blkn gets * incremented past them!). Note the inner loop relies on having * allocated the MCU_buffer[] blocks sequentially. */ blkn = 0; /* index of current DCT block within MCU */ for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; /* Don't bother to IDCT an uninteresting component. */ if (! compptr->component_needed) { blkn += compptr->MCU_data_units; continue; } inverse_DCT = lossyd->inverse_DCT[compptr->component_index]; useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width : compptr->last_col_width; output_ptr = output_buf[compptr->component_index] + yoffset * compptr->codec_data_unit; start_col = MCU_col_num * compptr->MCU_sample_width; for (yindex = 0; yindex < compptr->MCU_height; yindex++) { if (cinfo->input_iMCU_row < last_iMCU_row || yoffset+yindex < compptr->last_row_height) { output_col = start_col; for (xindex = 0; xindex < useful_width; xindex++) { (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) coef->MCU_buffer[blkn+xindex], output_ptr, output_col); output_col += compptr->codec_data_unit; } } blkn += compptr->MCU_width; output_ptr += compptr->codec_data_unit; } } } /* Completed an MCU row, but perhaps not an iMCU row */ coef->MCU_ctr = 0; } /* Completed the iMCU row, advance counters for next one */ cinfo->output_iMCU_row++; if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) { start_iMCU_row(cinfo); return JPEG_ROW_COMPLETED; } /* Completed the scan */ (*cinfo->inputctl->finish_input_pass) (cinfo); return JPEG_SCAN_COMPLETED; } /* * Dummy consume-input routine for single-pass operation. */ METHODDEF(int) dummy_consume_data (j_decompress_ptr cinfo) { (void)cinfo; return JPEG_SUSPENDED; /* Always indicate nothing was done */ } #ifdef D_MULTISCAN_FILES_SUPPORTED /* * Consume input data and store it in the full-image coefficient buffer. * We read as much as one fully interleaved MCU row ("iMCU" row) per call, * ie, v_samp_factor block rows for each component in the scan. * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. */ METHODDEF(int) consume_data (j_decompress_ptr cinfo) { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; d_coef_ptr coef = (d_coef_ptr) lossyd->coef_private; JDIMENSION MCU_col_num; /* index of current MCU within row */ int blkn, ci, xindex, yindex, yoffset; JDIMENSION start_col; JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN]; JBLOCKROW buffer_ptr; jpeg_component_info *compptr; /* Align the virtual buffers for the components used in this scan. */ for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; buffer[ci] = (*cinfo->mem->access_virt_barray) ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index], cinfo->input_iMCU_row * compptr->v_samp_factor, (JDIMENSION) compptr->v_samp_factor, TRUE); /* Note: entropy decoder expects buffer to be zeroed, * but this is handled automatically by the memory manager * because we requested a pre-zeroed array. */ } /* Loop to process one whole iMCU row */ for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; yoffset++) { for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row; MCU_col_num++) { /* Construct list of pointers to DCT blocks belonging to this MCU */ blkn = 0; /* index of current DCT block within MCU */ for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; start_col = MCU_col_num * compptr->MCU_width; for (yindex = 0; yindex < compptr->MCU_height; yindex++) { buffer_ptr = buffer[ci][yindex+yoffset] + start_col; for (xindex = 0; xindex < compptr->MCU_width; xindex++) { coef->MCU_buffer[blkn++] = buffer_ptr++; } } } /* Try to fetch the MCU. */ if (! (*lossyd->entropy_decode_mcu) (cinfo, coef->MCU_buffer)) { /* Suspension forced; update state counters and exit */ coef->MCU_vert_offset = yoffset; coef->MCU_ctr = MCU_col_num; return JPEG_SUSPENDED; } } /* Completed an MCU row, but perhaps not an iMCU row */ coef->MCU_ctr = 0; } /* Completed the iMCU row, advance counters for next one */ if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) { start_iMCU_row(cinfo); return JPEG_ROW_COMPLETED; } /* Completed the scan */ (*cinfo->inputctl->finish_input_pass) (cinfo); return JPEG_SCAN_COMPLETED; } /* * Decompress and return some data in the multi-pass case. * Always attempts to emit one fully interleaved MCU row ("iMCU" row). * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. * * NB: output_buf contains a plane for each component in image. */ METHODDEF(int) decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; d_coef_ptr coef = (d_coef_ptr) lossyd->coef_private; JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; JDIMENSION block_num; int ci, block_row, block_rows; JBLOCKARRAY buffer; JBLOCKROW buffer_ptr; JSAMPARRAY output_ptr; JDIMENSION output_col; jpeg_component_info *compptr; inverse_DCT_method_ptr inverse_DCT; /* Force some input to be done if we are getting ahead of the input. */ while (cinfo->input_scan_number < cinfo->output_scan_number || (cinfo->input_scan_number == cinfo->output_scan_number && cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) { if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED) return JPEG_SUSPENDED; } /* OK, output from the virtual arrays. */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { /* Don't bother to IDCT an uninteresting component. */ if (! compptr->component_needed) continue; /* Align the virtual buffer for this component. */ buffer = (*cinfo->mem->access_virt_barray) ((j_common_ptr) cinfo, coef->whole_image[ci], cinfo->output_iMCU_row * compptr->v_samp_factor, (JDIMENSION) compptr->v_samp_factor, FALSE); /* Count non-dummy DCT block rows in this iMCU row. */ if (cinfo->output_iMCU_row < last_iMCU_row) block_rows = compptr->v_samp_factor; else { /* NB: can't use last_row_height here; it is input-side-dependent! */ block_rows = (int) (compptr->height_in_data_units % compptr->v_samp_factor); if (block_rows == 0) block_rows = compptr->v_samp_factor; } inverse_DCT = lossyd->inverse_DCT[ci]; output_ptr = output_buf[ci]; /* Loop over all DCT blocks to be processed. */ for (block_row = 0; block_row < block_rows; block_row++) { buffer_ptr = buffer[block_row]; output_col = 0; for (block_num = 0; block_num < compptr->width_in_data_units; block_num++) { (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) buffer_ptr, output_ptr, output_col); buffer_ptr++; output_col += compptr->codec_data_unit; } output_ptr += compptr->codec_data_unit; } } if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows) return JPEG_ROW_COMPLETED; return JPEG_SCAN_COMPLETED; } #endif /* D_MULTISCAN_FILES_SUPPORTED */ #ifdef BLOCK_SMOOTHING_SUPPORTED /* * This code applies interblock smoothing as described by section K.8 * of the JPEG standard: the first 5 AC coefficients are estimated from * the DC values of a DCT block and its 8 neighboring blocks. * We apply smoothing only for progressive JPEG decoding, and only if * the coefficients it can estimate are not yet known to full precision. */ /* Natural-order array positions of the first 5 zigzag-order coefficients */ #define Q01_POS 1 #define Q10_POS 8 #define Q20_POS 16 #define Q11_POS 9 #define Q02_POS 2 /* * Determine whether block smoothing is applicable and safe. * We also latch the current states of the coef_bits[] entries for the * AC coefficients; otherwise, if the input side of the decompressor * advances into a new scan, we might think the coefficients are known * more accurately than they really are. */ LOCAL(boolean) smoothing_ok (j_decompress_ptr cinfo) { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; d_coef_ptr coef = (d_coef_ptr) lossyd->coef_private; boolean smoothing_useful = FALSE; int ci, coefi; jpeg_component_info *compptr; JQUANT_TBL * qtable; int * coef_bits; int * coef_bits_latch; if (! cinfo->process == JPROC_PROGRESSIVE || cinfo->coef_bits == NULL) return FALSE; /* Allocate latch area if not already done */ if (coef->coef_bits_latch == NULL) coef->coef_bits_latch = (int *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, cinfo->num_components * (SAVED_COEFS * SIZEOF(int))); coef_bits_latch = coef->coef_bits_latch; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { /* All components' quantization values must already be latched. */ if ((qtable = compptr->quant_table) == NULL) return FALSE; /* Verify DC & first 5 AC quantizers are nonzero to avoid zero-divide. */ if (qtable->quantval[0] == 0 || qtable->quantval[Q01_POS] == 0 || qtable->quantval[Q10_POS] == 0 || qtable->quantval[Q20_POS] == 0 || qtable->quantval[Q11_POS] == 0 || qtable->quantval[Q02_POS] == 0) return FALSE; /* DC values must be at least partly known for all components. */ coef_bits = cinfo->coef_bits[ci]; if (coef_bits[0] < 0) return FALSE; /* Block smoothing is helpful if some AC coefficients remain inaccurate. */ for (coefi = 1; coefi <= 5; coefi++) { coef_bits_latch[coefi] = coef_bits[coefi]; if (coef_bits[coefi] != 0) smoothing_useful = TRUE; } coef_bits_latch += SAVED_COEFS; } return smoothing_useful; } /* * Variant of decompress_data for use when doing block smoothing. */ METHODDEF(int) decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; d_coef_ptr coef = (d_coef_ptr) lossyd->coef_private; JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; JDIMENSION block_num, last_block_column; int ci, block_row, block_rows, access_rows; JBLOCKARRAY buffer; JBLOCKROW buffer_ptr, prev_block_row, next_block_row; JSAMPARRAY output_ptr; JDIMENSION output_col; jpeg_component_info *compptr; inverse_DCT_method_ptr inverse_DCT; boolean first_row, last_row; JBLOCK workspace; int *coef_bits; JQUANT_TBL *quanttbl; INT32 Q00,Q01,Q02,Q10,Q11,Q20, num; int DC1,DC2,DC3,DC4,DC5,DC6,DC7,DC8,DC9; int Al, pred; /* Force some input to be done if we are getting ahead of the input. */ while (cinfo->input_scan_number <= cinfo->output_scan_number && ! cinfo->inputctl->eoi_reached) { if (cinfo->input_scan_number == cinfo->output_scan_number) { /* If input is working on current scan, we ordinarily want it to * have completed the current row. But if input scan is DC, * we want it to keep one row ahead so that next block row's DC * values are up to date. */ JDIMENSION delta = (cinfo->Ss == 0) ? 1 : 0; if (cinfo->input_iMCU_row > cinfo->output_iMCU_row+delta) break; } if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED) return JPEG_SUSPENDED; } /* OK, output from the virtual arrays. */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { /* Don't bother to IDCT an uninteresting component. */ if (! compptr->component_needed) continue; /* Count non-dummy DCT block rows in this iMCU row. */ if (cinfo->output_iMCU_row < last_iMCU_row) { block_rows = compptr->v_samp_factor; access_rows = block_rows * 2; /* this and next iMCU row */ last_row = FALSE; } else { /* NB: can't use last_row_height here; it is input-side-dependent! */ block_rows = (int) (compptr->height_in_data_units % compptr->v_samp_factor); if (block_rows == 0) block_rows = compptr->v_samp_factor; access_rows = block_rows; /* this iMCU row only */ last_row = TRUE; } /* Align the virtual buffer for this component. */ if (cinfo->output_iMCU_row > 0) { access_rows += compptr->v_samp_factor; /* prior iMCU row too */ buffer = (*cinfo->mem->access_virt_barray) ((j_common_ptr) cinfo, coef->whole_image[ci], (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor, (JDIMENSION) access_rows, FALSE); buffer += compptr->v_samp_factor; /* point to current iMCU row */ first_row = FALSE; } else { buffer = (*cinfo->mem->access_virt_barray) ((j_common_ptr) cinfo, coef->whole_image[ci], (JDIMENSION) 0, (JDIMENSION) access_rows, FALSE); first_row = TRUE; } /* Fetch component-dependent info */ coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS); quanttbl = compptr->quant_table; Q00 = quanttbl->quantval[0]; Q01 = quanttbl->quantval[Q01_POS]; Q10 = quanttbl->quantval[Q10_POS]; Q20 = quanttbl->quantval[Q20_POS]; Q11 = quanttbl->quantval[Q11_POS]; Q02 = quanttbl->quantval[Q02_POS]; inverse_DCT = lossyd->inverse_DCT[ci]; output_ptr = output_buf[ci]; /* Loop over all DCT blocks to be processed. */ for (block_row = 0; block_row < block_rows; block_row++) { buffer_ptr = buffer[block_row]; if (first_row && block_row == 0) prev_block_row = buffer_ptr; else prev_block_row = buffer[block_row-1]; if (last_row && block_row == block_rows-1) next_block_row = buffer_ptr; else next_block_row = buffer[block_row+1]; /* We fetch the surrounding DC values using a sliding-register approach. * Initialize all nine here so as to do the right thing on narrow pics. */ DC1 = DC2 = DC3 = (int) prev_block_row[0][0]; DC4 = DC5 = DC6 = (int) buffer_ptr[0][0]; DC7 = DC8 = DC9 = (int) next_block_row[0][0]; output_col = 0; last_block_column = compptr->width_in_data_units - 1; for (block_num = 0; block_num <= last_block_column; block_num++) { /* Fetch current DCT block into workspace so we can modify it. */ jcopy_block_row(buffer_ptr, (JBLOCKROW) workspace, (JDIMENSION) 1); /* Update DC values */ if (block_num < last_block_column) { DC3 = (int) prev_block_row[1][0]; DC6 = (int) buffer_ptr[1][0]; DC9 = (int) next_block_row[1][0]; } /* Compute coefficient estimates per K.8. * An estimate is applied only if coefficient is still zero, * and is not known to be fully accurate. */ /* AC01 */ if ((Al=coef_bits[1]) != 0 && workspace[1] == 0) { num = 36 * Q00 * (DC4 - DC6); if (num >= 0) { pred = (int) (((Q01<<7) + num) / (Q01<<8)); if (Al > 0 && pred >= (1<<Al)) pred = (1<<Al)-1; } else { pred = (int) (((Q01<<7) - num) / (Q01<<8)); if (Al > 0 && pred >= (1<<Al)) pred = (1<<Al)-1; pred = -pred; } workspace[1] = (JCOEF) pred; } /* AC10 */ if ((Al=coef_bits[2]) != 0 && workspace[8] == 0) { num = 36 * Q00 * (DC2 - DC8); if (num >= 0) { pred = (int) (((Q10<<7) + num) / (Q10<<8)); if (Al > 0 && pred >= (1<<Al)) pred = (1<<Al)-1; } else { pred = (int) (((Q10<<7) - num) / (Q10<<8)); if (Al > 0 && pred >= (1<<Al)) pred = (1<<Al)-1; pred = -pred; } workspace[8] = (JCOEF) pred; } /* AC20 */ if ((Al=coef_bits[3]) != 0 && workspace[16] == 0) { num = 9 * Q00 * (DC2 + DC8 - 2*DC5); if (num >= 0) { pred = (int) (((Q20<<7) + num) / (Q20<<8)); if (Al > 0 && pred >= (1<<Al)) pred = (1<<Al)-1; } else { pred = (int) (((Q20<<7) - num) / (Q20<<8)); if (Al > 0 && pred >= (1<<Al)) pred = (1<<Al)-1; pred = -pred; } workspace[16] = (JCOEF) pred; } /* AC11 */ if ((Al=coef_bits[4]) != 0 && workspace[9] == 0) { num = 5 * Q00 * (DC1 - DC3 - DC7 + DC9); if (num >= 0) { pred = (int) (((Q11<<7) + num) / (Q11<<8)); if (Al > 0 && pred >= (1<<Al)) pred = (1<<Al)-1; } else { pred = (int) (((Q11<<7) - num) / (Q11<<8)); if (Al > 0 && pred >= (1<<Al)) pred = (1<<Al)-1; pred = -pred; } workspace[9] = (JCOEF) pred; } /* AC02 */ if ((Al=coef_bits[5]) != 0 && workspace[2] == 0) { num = 9 * Q00 * (DC4 + DC6 - 2*DC5); if (num >= 0) { pred = (int) (((Q02<<7) + num) / (Q02<<8)); if (Al > 0 && pred >= (1<<Al)) pred = (1<<Al)-1; } else { pred = (int) (((Q02<<7) - num) / (Q02<<8)); if (Al > 0 && pred >= (1<<Al)) pred = (1<<Al)-1; pred = -pred; } workspace[2] = (JCOEF) pred; } /* OK, do the IDCT */ (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) workspace, output_ptr, output_col); /* Advance for next column */ DC1 = DC2; DC2 = DC3; DC4 = DC5; DC5 = DC6; DC7 = DC8; DC8 = DC9; buffer_ptr++, prev_block_row++, next_block_row++; output_col += compptr->codec_data_unit; } output_ptr += compptr->codec_data_unit; } } if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows) return JPEG_ROW_COMPLETED; return JPEG_SCAN_COMPLETED; } #endif /* BLOCK_SMOOTHING_SUPPORTED */ /* * Initialize coefficient buffer controller. */ GLOBAL(void) jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer) { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; d_coef_ptr coef; coef = (d_coef_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(d_coef_controller)); lossyd->coef_private = (void *) coef; lossyd->coef_start_input_pass = start_input_pass; lossyd->coef_start_output_pass = start_output_pass; #ifdef BLOCK_SMOOTHING_SUPPORTED coef->coef_bits_latch = NULL; #endif /* Create the coefficient buffer. */ if (need_full_buffer) { #ifdef D_MULTISCAN_FILES_SUPPORTED /* Allocate a full-image virtual array for each component, */ /* padded to a multiple of samp_factor DCT blocks in each direction. */ /* Note we ask for a pre-zeroed array. */ int ci, access_rows; jpeg_component_info *compptr; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { access_rows = compptr->v_samp_factor; #ifdef BLOCK_SMOOTHING_SUPPORTED /* If block smoothing could be used, need a bigger window */ if (cinfo->process == JPROC_PROGRESSIVE) access_rows *= 3; #endif coef->whole_image[ci] = (*cinfo->mem->request_virt_barray) ((j_common_ptr) cinfo, JPOOL_IMAGE, TRUE, (JDIMENSION) jround_up((long) compptr->width_in_data_units, (long) compptr->h_samp_factor), (JDIMENSION) jround_up((long) compptr->height_in_data_units, (long) compptr->v_samp_factor), (JDIMENSION) access_rows); } lossyd->pub.consume_data = consume_data; lossyd->pub.decompress_data = decompress_data; lossyd->coef_arrays = coef->whole_image; /* link to virtual arrays */ #else ERREXIT(cinfo, JERR_NOT_COMPILED); #endif } else { /* We only need a single-MCU buffer. */ JBLOCKROW buffer; int i; buffer = (JBLOCKROW) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, D_MAX_DATA_UNITS_IN_MCU * SIZEOF(JBLOCK)); for (i = 0; i < D_MAX_DATA_UNITS_IN_MCU; i++) { coef->MCU_buffer[i] = buffer + i; } lossyd->pub.consume_data = dummy_consume_data; lossyd->pub.decompress_data = decompress_onepass; lossyd->coef_arrays = NULL; /* flag for no virtual arrays */ } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jcmainct.c�����������������������������������������������0000644�0001750�0001750�00000022464�12320456500�021764� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jcmainct.c * * Copyright (C) 1994-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains the main buffer controller for compression. * The main buffer lies between the pre-processor and the JPEG * compressor proper; it holds downsampled data in the JPEG colorspace. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" /* Note: currently, there is no operating mode in which a full-image buffer * is needed at this step. If there were, that mode could not be used with * "raw data" input, since this module is bypassed in that case. However, * we've left the code here for possible use in special applications. */ #undef FULL_MAIN_BUFFER_SUPPORTED /* Private buffer controller object */ typedef struct { struct jpeg_c_main_controller pub; /* public fields */ JDIMENSION cur_iMCU_row; /* number of current iMCU row */ JDIMENSION rowgroup_ctr; /* counts row groups received in iMCU row */ boolean suspended; /* remember if we suspended output */ J_BUF_MODE pass_mode; /* current operating mode */ /* If using just a strip buffer, this points to the entire set of buffers * (we allocate one for each component). In the full-image case, this * points to the currently accessible strips of the virtual arrays. */ JSAMPARRAY buffer[MAX_COMPONENTS]; #ifdef FULL_MAIN_BUFFER_SUPPORTED /* If using full-image storage, this array holds pointers to virtual-array * control blocks for each component. Unused if not full-image storage. */ jvirt_sarray_ptr whole_image[MAX_COMPONENTS]; #endif } my_main_controller; typedef my_main_controller * my_main_ptr; /* Forward declarations */ METHODDEF(void) process_data_simple_main JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail)); #ifdef FULL_MAIN_BUFFER_SUPPORTED METHODDEF(void) process_data_buffer_main JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail)); #endif /* * Initialize for a processing pass. */ METHODDEF(void) start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode) { my_main_ptr mainPtr = (my_main_ptr) cinfo->main; /* Do nothing in raw-data mode. */ if (cinfo->raw_data_in) return; mainPtr->cur_iMCU_row = 0; /* initialize counters */ mainPtr->rowgroup_ctr = 0; mainPtr->suspended = FALSE; mainPtr->pass_mode = pass_mode; /* save mode for use by process_data */ switch (pass_mode) { case JBUF_PASS_THRU: #ifdef FULL_MAIN_BUFFER_SUPPORTED if (mainPtr->whole_image[0] != NULL) ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); #endif mainPtr->pub.process_data = process_data_simple_main; break; #ifdef FULL_MAIN_BUFFER_SUPPORTED case JBUF_SAVE_SOURCE: case JBUF_CRANK_DEST: case JBUF_SAVE_AND_PASS: if (mainPtr->whole_image[0] == NULL) ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); mainPtr->pub.process_data = process_data_buffer_main; break; #endif default: ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); break; } } /* * Process some data. * This routine handles the simple pass-through mode, * where we have only a strip buffer. */ METHODDEF(void) process_data_simple_main (j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail) { my_main_ptr mainPtr = (my_main_ptr) cinfo->main; JDIMENSION data_unit = (JDIMENSION)(cinfo->data_unit); while (mainPtr->cur_iMCU_row < cinfo->total_iMCU_rows) { /* Read input data if we haven't filled the main buffer yet */ if (mainPtr->rowgroup_ctr < data_unit) (*cinfo->prep->pre_process_data) (cinfo, input_buf, in_row_ctr, in_rows_avail, mainPtr->buffer, &mainPtr->rowgroup_ctr, (JDIMENSION) data_unit); /* If we don't have a full iMCU row buffered, return to application for * more data. Note that preprocessor will always pad to fill the iMCU row * at the bottom of the image. */ if (mainPtr->rowgroup_ctr != data_unit) return; /* Send the completed row to the compressor */ if (! (*cinfo->codec->compress_data) (cinfo, mainPtr->buffer)) { /* If compressor did not consume the whole row, then we must need to * suspend processing and return to the application. In this situation * we pretend we didn't yet consume the last input row; otherwise, if * it happened to be the last row of the image, the application would * think we were done. */ if (! mainPtr->suspended) { (*in_row_ctr)--; mainPtr->suspended = TRUE; } return; } /* We did finish the row. Undo our little suspension hack if a previous * call suspended; then mark the main buffer empty. */ if (mainPtr->suspended) { (*in_row_ctr)++; mainPtr->suspended = FALSE; } mainPtr->rowgroup_ctr = 0; mainPtr->cur_iMCU_row++; } } #ifdef FULL_MAIN_BUFFER_SUPPORTED /* * Process some data. * This routine handles all of the modes that use a full-size buffer. */ METHODDEF(void) process_data_buffer_main (j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail) { my_main_ptr mainPtr = (my_main_ptr) cinfo->main; int ci; jpeg_component_info *compptr; boolean writing = (mainPtr->pass_mode != JBUF_CRANK_DEST); JDIMENSION data_unit = (JDIMENSION)(cinfo->data_unit); while (mainPtr->cur_iMCU_row < cinfo->total_iMCU_rows) { /* Realign the virtual buffers if at the start of an iMCU row. */ if (mainPtr->rowgroup_ctr == 0) { for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { mainPtr->buffer[ci] = (*cinfo->mem->access_virt_sarray) ((j_common_ptr) cinfo, mainPtr->whole_image[ci], mainPtr->cur_iMCU_row * (compptr->v_samp_factor * data_unit), (JDIMENSION) (compptr->v_samp_factor * data_unit), writing); } /* In a read pass, pretend we just read some source data. */ if (! writing) { *in_row_ctr += cinfo->max_v_samp_factor * data_unit; mainPtr->rowgroup_ctr = data_unit; } } /* If a write pass, read input data until the current iMCU row is full. */ /* Note: preprocessor will pad if necessary to fill the last iMCU row. */ if (writing) { (*cinfo->prep->pre_process_data) (cinfo, input_buf, in_row_ctr, in_rows_avail, mainPtr->buffer, &mainPtr->rowgroup_ctr, (JDIMENSION) data_unit); /* Return to application if we need more data to fill the iMCU row. */ if (mainPtr->rowgroup_ctr < data_unit) return; } /* Emit data, unless this is a sink-only pass. */ if (mainPtr->pass_mode != JBUF_SAVE_SOURCE) { if (! (*cinfo->codec->compress_data) (cinfo, mainPtr->buffer)) { /* If compressor did not consume the whole row, then we must need to * suspend processing and return to the application. In this situation * we pretend we didn't yet consume the last input row; otherwise, if * it happened to be the last row of the image, the application would * think we were done. */ if (! mainPtr->suspended) { (*in_row_ctr)--; mainPtr->suspended = TRUE; } return; } /* We did finish the row. Undo our little suspension hack if a previous * call suspended; then mark the main buffer empty. */ if (mainPtr->suspended) { (*in_row_ctr)++; mainPtr->suspended = FALSE; } } /* If get here, we are done with this iMCU row. Mark buffer empty. */ mainPtr->rowgroup_ctr = 0; mainPtr->cur_iMCU_row++; } } #endif /* FULL_MAIN_BUFFER_SUPPORTED */ /* * Initialize main buffer controller. */ GLOBAL(void) jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer) { my_main_ptr mainPtr; int ci; jpeg_component_info *compptr; int data_unit = cinfo->data_unit; mainPtr = (my_main_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_main_controller)); cinfo->main = (struct jpeg_c_main_controller *) mainPtr; mainPtr->pub.start_pass = start_pass_main; /* We don't need to create a buffer in raw-data mode. */ if (cinfo->raw_data_in) return; /* Create the buffer. It holds downsampled data, so each component * may be of a different size. */ if (need_full_buffer) { #ifdef FULL_MAIN_BUFFER_SUPPORTED /* Allocate a full-image virtual array for each component */ /* Note we pad the bottom to a multiple of the iMCU height */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { mainPtr->whole_image[ci] = (*cinfo->mem->request_virt_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, compptr->width_in_data_units * data_unit, (JDIMENSION) jround_up((long) compptr->height_in_data_units, (long) compptr->v_samp_factor) * data_unit, (JDIMENSION) (compptr->v_samp_factor * data_unit)); } #else ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); #endif } else { #ifdef FULL_MAIN_BUFFER_SUPPORTED mainPtr->whole_image[0] = NULL; /* flag for no virtual arrays */ #endif /* Allocate a strip buffer for each component */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { mainPtr->buffer[ci] = (*cinfo->mem->alloc_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, compptr->width_in_data_units * data_unit, (JDIMENSION) (compptr->v_samp_factor * data_unit)); } } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdapistd.c�����������������������������������������������0000644�0001750�0001750�00000022205�12320456500�021767� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdapistd.c * * Copyright (C) 1994-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains application interface code for the decompression half * of the JPEG library. These are the "standard" API routines that are * used in the normal full-decompression case. They are not used by a * transcoding-only application. Note that if an application links in * jpeg_start_decompress, it will end up linking in the entire decompressor. * We thus must separate this file from jdapimin.c to avoid linking the * whole decompression library into a transcoder. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" /* Forward declarations */ LOCAL(boolean) output_pass_setup JPP((j_decompress_ptr cinfo)); /* * Decompression initialization. * jpeg_read_header must be completed before calling this. * * If a multipass operating mode was selected, this will do all but the * last pass, and thus may take a great deal of time. * * Returns FALSE if suspended. The return value need be inspected only if * a suspending data source is used. */ GLOBAL(boolean) jpeg_start_decompress (j_decompress_ptr cinfo) { if (cinfo->global_state == DSTATE_READY) { /* First call: initialize master control, select active modules */ jinit_master_decompress(cinfo); if (cinfo->buffered_image) { /* No more work here; expecting jpeg_start_output next */ cinfo->global_state = DSTATE_BUFIMAGE; return TRUE; } cinfo->global_state = DSTATE_PRELOAD; } if (cinfo->global_state == DSTATE_PRELOAD) { /* If file has multiple scans, absorb them all into the coef buffer */ if (cinfo->inputctl->has_multiple_scans) { #ifdef D_MULTISCAN_FILES_SUPPORTED for (;;) { int retcode; /* Call progress monitor hook if present */ if (cinfo->progress != NULL) (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); /* Absorb some more input */ retcode = (*cinfo->inputctl->consume_input) (cinfo); if (retcode == JPEG_SUSPENDED) return FALSE; if (retcode == JPEG_REACHED_EOI) break; /* Advance progress counter if appropriate */ if (cinfo->progress != NULL && (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) { if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) { /* jdmaster underestimated number of scans; ratchet up one scan */ cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows; } } } #else ERREXIT(cinfo, JERR_NOT_COMPILED); #endif /* D_MULTISCAN_FILES_SUPPORTED */ } cinfo->output_scan_number = cinfo->input_scan_number; } else if (cinfo->global_state != DSTATE_PRESCAN) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); /* Perform any dummy output passes, and set up for the final pass */ return output_pass_setup(cinfo); } /* * Set up for an output pass, and perform any dummy pass(es) needed. * Common subroutine for jpeg_start_decompress and jpeg_start_output. * Entry: global_state = DSTATE_PRESCAN only if previously suspended. * Exit: If done, returns TRUE and sets global_state for proper output mode. * If suspended, returns FALSE and sets global_state = DSTATE_PRESCAN. */ LOCAL(boolean) output_pass_setup (j_decompress_ptr cinfo) { if (cinfo->global_state != DSTATE_PRESCAN) { /* First call: do pass setup */ (*cinfo->master->prepare_for_output_pass) (cinfo); cinfo->output_scanline = 0; cinfo->global_state = DSTATE_PRESCAN; } /* Loop over any required dummy passes */ while (cinfo->master->is_dummy_pass) { #ifdef QUANT_2PASS_SUPPORTED /* Crank through the dummy pass */ while (cinfo->output_scanline < cinfo->output_height) { JDIMENSION last_scanline; /* Call progress monitor hook if present */ if (cinfo->progress != NULL) { cinfo->progress->pass_counter = (long) cinfo->output_scanline; cinfo->progress->pass_limit = (long) cinfo->output_height; (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); } /* Process some data */ last_scanline = cinfo->output_scanline; (*cinfo->main->process_data) (cinfo, (JSAMPARRAY) NULL, &cinfo->output_scanline, (JDIMENSION) 0); if (cinfo->output_scanline == last_scanline) return FALSE; /* No progress made, must suspend */ } /* Finish up dummy pass, and set up for another one */ (*cinfo->master->finish_output_pass) (cinfo); (*cinfo->master->prepare_for_output_pass) (cinfo); cinfo->output_scanline = 0; #else ERREXIT(cinfo, JERR_NOT_COMPILED); #endif /* QUANT_2PASS_SUPPORTED */ } /* Ready for application to drive output pass through * jpeg_read_scanlines or jpeg_read_raw_data. */ cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING; return TRUE; } /* * Read some scanlines of data from the JPEG decompressor. * * The return value will be the number of lines actually read. * This may be less than the number requested in several cases, * including bottom of image, data source suspension, and operating * modes that emit multiple scanlines at a time. * * Note: we warn about excess calls to jpeg_read_scanlines() since * this likely signals an application programmer error. However, * an oversize buffer (max_lines > scanlines remaining) is not an error. */ GLOBAL(JDIMENSION) jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION max_lines) { JDIMENSION row_ctr; if (cinfo->global_state != DSTATE_SCANNING) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); if (cinfo->output_scanline >= cinfo->output_height) { WARNMS(cinfo, JWRN_TOO_MUCH_DATA); return 0; } /* Call progress monitor hook if present */ if (cinfo->progress != NULL) { cinfo->progress->pass_counter = (long) cinfo->output_scanline; cinfo->progress->pass_limit = (long) cinfo->output_height; (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); } /* Process some data */ row_ctr = 0; (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, max_lines); cinfo->output_scanline += row_ctr; return row_ctr; } /* * Alternate entry point to read raw data. * Processes exactly one iMCU row per call, unless suspended. */ GLOBAL(JDIMENSION) jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data, JDIMENSION max_lines) { JDIMENSION lines_per_iMCU_row; if (cinfo->global_state != DSTATE_RAW_OK) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); if (cinfo->output_scanline >= cinfo->output_height) { WARNMS(cinfo, JWRN_TOO_MUCH_DATA); return 0; } /* Call progress monitor hook if present */ if (cinfo->progress != NULL) { cinfo->progress->pass_counter = (long) cinfo->output_scanline; cinfo->progress->pass_limit = (long) cinfo->output_height; (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); } /* Verify that at least one iMCU row can be returned. */ lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->min_codec_data_unit; if (max_lines < lines_per_iMCU_row) ERREXIT(cinfo, JERR_BUFFER_SIZE); /* Decompress directly into user's buffer. */ if (! (*cinfo->codec->decompress_data) (cinfo, data)) return 0; /* suspension forced, can do nothing more */ /* OK, we processed one iMCU row. */ cinfo->output_scanline += lines_per_iMCU_row; return lines_per_iMCU_row; } /* Additional entry points for buffered-image mode. */ #ifdef D_MULTISCAN_FILES_SUPPORTED /* * Initialize for an output pass in buffered-image mode. */ GLOBAL(boolean) jpeg_start_output (j_decompress_ptr cinfo, int scan_number) { if (cinfo->global_state != DSTATE_BUFIMAGE && cinfo->global_state != DSTATE_PRESCAN) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); /* Limit scan number to valid range */ if (scan_number <= 0) scan_number = 1; if (cinfo->inputctl->eoi_reached && scan_number > cinfo->input_scan_number) scan_number = cinfo->input_scan_number; cinfo->output_scan_number = scan_number; /* Perform any dummy output passes, and set up for the real pass */ return output_pass_setup(cinfo); } /* * Finish up after an output pass in buffered-image mode. * * Returns FALSE if suspended. The return value need be inspected only if * a suspending data source is used. */ GLOBAL(boolean) jpeg_finish_output (j_decompress_ptr cinfo) { if ((cinfo->global_state == DSTATE_SCANNING || cinfo->global_state == DSTATE_RAW_OK) && cinfo->buffered_image) { /* Terminate this pass. */ /* We do not require the whole pass to have been completed. */ (*cinfo->master->finish_output_pass) (cinfo); cinfo->global_state = DSTATE_BUFPOST; } else if (cinfo->global_state != DSTATE_BUFPOST) { /* BUFPOST = repeat call after a suspension, anything else is error */ ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); } /* Read markers looking for SOS or EOI */ while (cinfo->input_scan_number <= cinfo->output_scan_number && ! cinfo->inputctl->eoi_reached) { if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED) return FALSE; /* Suspend, come back later */ } cinfo->global_state = DSTATE_BUFIMAGE; return TRUE; } #endif /* D_MULTISCAN_FILES_SUPPORTED */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jidctfst.c�����������������������������������������������0000644�0001750�0001750�00000031562�12320456500�022005� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jidctfst.c * * Copyright (C) 1994-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains a fast, not so accurate integer implementation of the * inverse DCT (Discrete Cosine Transform). In the IJG code, this routine * must also perform dequantization of the input coefficients. * * A 2-D IDCT can be done by 1-D IDCT on each column followed by 1-D IDCT * on each row (or vice versa, but it's more convenient to emit a row at * a time). Direct algorithms are also available, but they are much more * complex and seem not to be any faster when reduced to code. * * This implementation is based on Arai, Agui, and Nakajima's algorithm for * scaled DCT. Their original paper (Trans. IEICE E-71(11):1095) is in * Japanese, but the algorithm is described in the Pennebaker & Mitchell * JPEG textbook (see REFERENCES section in file README). The following code * is based directly on figure 4-8 in P&M. * While an 8-point DCT cannot be done in less than 11 multiplies, it is * possible to arrange the computation so that many of the multiplies are * simple scalings of the final outputs. These multiplies can then be * folded into the multiplications or divisions by the JPEG quantization * table entries. The AA&N method leaves only 5 multiplies and 29 adds * to be done in the DCT itself. * The primary disadvantage of this method is that with fixed-point math, * accuracy is lost due to imprecise representation of the scaled * quantization values. The smaller the quantization table entry, the less * precise the scaled value, so this implementation does worse with high- * quality-setting files than with low-quality ones. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jdct.h" /* Private declarations for DCT subsystem */ #ifdef DCT_IFAST_SUPPORTED /* * This module is specialized to the case DCTSIZE = 8. */ #if DCTSIZE != 8 Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ #endif /* Scaling decisions are generally the same as in the LL&M algorithm; * see jidctint.c for more details. However, we choose to descale * (right shift) multiplication products as soon as they are formed, * rather than carrying additional fractional bits into subsequent additions. * This compromises accuracy slightly, but it lets us save a few shifts. * More importantly, 16-bit arithmetic is then adequate (for 8-bit samples) * everywhere except in the multiplications proper; this saves a good deal * of work on 16-bit-int machines. * * The dequantized coefficients are not integers because the AA&N scaling * factors have been incorporated. We represent them scaled up by PASS1_BITS, * so that the first and second IDCT rounds have the same input scaling. * For 8-bit JSAMPLEs, we choose IFAST_SCALE_BITS = PASS1_BITS so as to * avoid a descaling shift; this compromises accuracy rather drastically * for small quantization table entries, but it saves a lot of shifts. * For 12-bit JSAMPLEs, there's no hope of using 16x16 multiplies anyway, * so we use a much larger scaling factor to preserve accuracy. * * A final compromise is to represent the multiplicative constants to only * 8 fractional bits, rather than 13. This saves some shifting work on some * machines, and may also reduce the cost of multiplication (since there * are fewer one-bits in the constants). */ #if BITS_IN_JSAMPLE == 8 #define CONST_BITS 8 #define PASS1_BITS 2 #else #define CONST_BITS 8 #define PASS1_BITS 1 /* lose a little precision to avoid overflow */ #endif /* Some C compilers fail to reduce "FIX(constant)" at compile time, thus * causing a lot of useless floating-point operations at run time. * To get around this we use the following pre-calculated constants. * If you change CONST_BITS you may want to add appropriate values. * (With a reasonable C compiler, you can just rely on the FIX() macro...) */ #if CONST_BITS == 8 #define FIX_1_082392200 ((INT32) 277) /* FIX(1.082392200) */ #define FIX_1_414213562 ((INT32) 362) /* FIX(1.414213562) */ #define FIX_1_847759065 ((INT32) 473) /* FIX(1.847759065) */ #define FIX_2_613125930 ((INT32) 669) /* FIX(2.613125930) */ #else #define FIX_1_082392200 FIX(1.082392200) #define FIX_1_414213562 FIX(1.414213562) #define FIX_1_847759065 FIX(1.847759065) #define FIX_2_613125930 FIX(2.613125930) #endif /* We can gain a little more speed, with a further compromise in accuracy, * by omitting the addition in a descaling shift. This yields an incorrectly * rounded result half the time... */ #ifndef USE_ACCURATE_ROUNDING #undef DESCALE #define DESCALE(x,n) RIGHT_SHIFT(x, n) #endif /* Multiply a DCTELEM variable by an INT32 constant, and immediately * descale to yield a DCTELEM result. */ #define MULTIPLY(var,const) ((DCTELEM) DESCALE((var) * (const), CONST_BITS)) /* Dequantize a coefficient by multiplying it by the multiplier-table * entry; produce a DCTELEM result. For 8-bit data a 16x16->16 * multiplication will do. For 12-bit data, the multiplier table is * declared INT32, so a 32-bit multiply will be used. */ #if BITS_IN_JSAMPLE == 8 #define DEQUANTIZE(coef,quantval) (((IFAST_MULT_TYPE) (coef)) * (quantval)) #else #define DEQUANTIZE(coef,quantval) \ DESCALE((coef)*(quantval), IFAST_SCALE_BITS-PASS1_BITS) #endif /* Like DESCALE, but applies to a DCTELEM and produces an int. * We assume that int right shift is unsigned if INT32 right shift is. */ #ifdef RIGHT_SHIFT_IS_UNSIGNED #define ISHIFT_TEMPS DCTELEM ishift_temp; #if BITS_IN_JSAMPLE == 8 #define DCTELEMBITS 16 /* DCTELEM may be 16 or 32 bits */ #else #define DCTELEMBITS 32 /* DCTELEM must be 32 bits */ #endif #define IRIGHT_SHIFT(x,shft) \ ((ishift_temp = (x)) < 0 ? \ (ishift_temp >> (shft)) | ((~((DCTELEM) 0)) << (DCTELEMBITS-(shft))) : \ (ishift_temp >> (shft))) #else #define ISHIFT_TEMPS #define IRIGHT_SHIFT(x,shft) ((x) >> (shft)) #endif #ifdef USE_ACCURATE_ROUNDING #define IDESCALE(x,n) ((int) IRIGHT_SHIFT((x) + (1 << ((n)-1)), n)) #else #define IDESCALE(x,n) ((int) IRIGHT_SHIFT(x, n)) #endif /* * Perform dequantization and inverse DCT on one block of coefficients. */ GLOBAL(void) jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; DCTELEM tmp10, tmp11, tmp12, tmp13; DCTELEM z5, z10, z11, z12, z13; JCOEFPTR inptr; IFAST_MULT_TYPE * quantptr; int * wsptr; JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; int workspace[DCTSIZE2]; /* buffers data between passes */ SHIFT_TEMPS /* for DESCALE */ ISHIFT_TEMPS /* for IDESCALE */ /* Pass 1: process columns from input, store into work array. */ inptr = coef_block; quantptr = (IFAST_MULT_TYPE *) compptr->dct_table; wsptr = workspace; for (ctr = DCTSIZE; ctr > 0; ctr--) { /* Due to quantization, we will usually find that many of the input * coefficients are zero, especially the AC terms. We can exploit this * by short-circuiting the IDCT calculation for any column in which all * the AC terms are zero. In that case each output is equal to the * DC coefficient (with scale factor as needed). * With typical images and quantization tables, half or more of the * column DCT calculations can be simplified this way. */ if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*7] == 0) { /* AC terms all zero */ int dcval = (int) DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); wsptr[DCTSIZE*0] = dcval; wsptr[DCTSIZE*1] = dcval; wsptr[DCTSIZE*2] = dcval; wsptr[DCTSIZE*3] = dcval; wsptr[DCTSIZE*4] = dcval; wsptr[DCTSIZE*5] = dcval; wsptr[DCTSIZE*6] = dcval; wsptr[DCTSIZE*7] = dcval; inptr++; /* advance pointers to next column */ quantptr++; wsptr++; continue; } /* Even part */ tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); tmp1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); tmp3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); tmp10 = tmp0 + tmp2; /* phase 3 */ tmp11 = tmp0 - tmp2; tmp13 = tmp1 + tmp3; /* phases 5-3 */ tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; /* 2*c4 */ tmp0 = tmp10 + tmp13; /* phase 2 */ tmp3 = tmp10 - tmp13; tmp1 = tmp11 + tmp12; tmp2 = tmp11 - tmp12; /* Odd part */ tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); tmp5 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); tmp6 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); z13 = tmp6 + tmp5; /* phase 6 */ z10 = tmp6 - tmp5; z11 = tmp4 + tmp7; z12 = tmp4 - tmp7; tmp7 = z11 + z13; /* phase 5 */ tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */ z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */ tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */ tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */ tmp6 = tmp12 - tmp7; /* phase 2 */ tmp5 = tmp11 - tmp6; tmp4 = tmp10 + tmp5; wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7); wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7); wsptr[DCTSIZE*1] = (int) (tmp1 + tmp6); wsptr[DCTSIZE*6] = (int) (tmp1 - tmp6); wsptr[DCTSIZE*2] = (int) (tmp2 + tmp5); wsptr[DCTSIZE*5] = (int) (tmp2 - tmp5); wsptr[DCTSIZE*4] = (int) (tmp3 + tmp4); wsptr[DCTSIZE*3] = (int) (tmp3 - tmp4); inptr++; /* advance pointers to next column */ quantptr++; wsptr++; } /* Pass 2: process rows from work array, store into output array. */ /* Note that we must descale the results by a factor of 8 == 2**3, */ /* and also undo the PASS1_BITS scaling. */ wsptr = workspace; for (ctr = 0; ctr < DCTSIZE; ctr++) { outptr = output_buf[ctr] + output_col; /* Rows of zeroes can be exploited in the same way as we did with columns. * However, the column calculation has created many nonzero AC terms, so * the simplification applies less often (typically 5% to 10% of the time). * On machines with very fast multiplication, it's possible that the * test takes more time than it's worth. In that case this section * may be commented out. */ #ifndef NO_ZERO_ROW_TEST if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { /* AC terms all zero */ JSAMPLE dcval = range_limit[IDESCALE(wsptr[0], PASS1_BITS+3) & RANGE_MASK]; outptr[0] = dcval; outptr[1] = dcval; outptr[2] = dcval; outptr[3] = dcval; outptr[4] = dcval; outptr[5] = dcval; outptr[6] = dcval; outptr[7] = dcval; wsptr += DCTSIZE; /* advance pointer to next row */ continue; } #endif /* Even part */ tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]); tmp11 = ((DCTELEM) wsptr[0] - (DCTELEM) wsptr[4]); tmp13 = ((DCTELEM) wsptr[2] + (DCTELEM) wsptr[6]); tmp12 = MULTIPLY((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6], FIX_1_414213562) - tmp13; tmp0 = tmp10 + tmp13; tmp3 = tmp10 - tmp13; tmp1 = tmp11 + tmp12; tmp2 = tmp11 - tmp12; /* Odd part */ z13 = (DCTELEM) wsptr[5] + (DCTELEM) wsptr[3]; z10 = (DCTELEM) wsptr[5] - (DCTELEM) wsptr[3]; z11 = (DCTELEM) wsptr[1] + (DCTELEM) wsptr[7]; z12 = (DCTELEM) wsptr[1] - (DCTELEM) wsptr[7]; tmp7 = z11 + z13; /* phase 5 */ tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */ z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */ tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */ tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */ tmp6 = tmp12 - tmp7; /* phase 2 */ tmp5 = tmp11 - tmp6; tmp4 = tmp10 + tmp5; /* Final output stage: scale down by a factor of 8 and range-limit */ outptr[0] = range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS+3) & RANGE_MASK]; outptr[7] = range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS+3) & RANGE_MASK]; outptr[1] = range_limit[IDESCALE(tmp1 + tmp6, PASS1_BITS+3) & RANGE_MASK]; outptr[6] = range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS+3) & RANGE_MASK]; outptr[2] = range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS+3) & RANGE_MASK]; outptr[5] = range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS+3) & RANGE_MASK]; outptr[4] = range_limit[IDESCALE(tmp3 + tmp4, PASS1_BITS+3) & RANGE_MASK]; outptr[3] = range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS+3) & RANGE_MASK]; wsptr += DCTSIZE; /* advance pointer to next row */ } } #endif /* DCT_IFAST_SUPPORTED */ ����������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jddctmgr.c�����������������������������������������������0000644�0001750�0001750�00000020313�12320456500�021761� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jddctmgr.c * * Copyright (C) 1994-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains the inverse-DCT management logic. * This code selects a particular IDCT implementation to be used, * and it performs related housekeeping chores. No code in this file * is executed per IDCT step, only during output pass setup. * * Note that the IDCT routines are responsible for performing coefficient * dequantization as well as the IDCT proper. This module sets up the * dequantization multiplier table needed by the IDCT routine. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossy.h" /* Private declarations for lossy subsystem */ #include "jdct.h" /* Private declarations for DCT subsystem */ /* * The decompressor input side (jdinput.c) saves away the appropriate * quantization table for each component at the start of the first scan * involving that component. (This is necessary in order to correctly * decode files that reuse Q-table slots.) * When we are ready to make an output pass, the saved Q-table is converted * to a multiplier table that will actually be used by the IDCT routine. * The multiplier table contents are IDCT-method-dependent. To support * application changes in IDCT method between scans, we can remake the * multiplier tables if necessary. * In buffered-image mode, the first output pass may occur before any data * has been seen for some components, and thus before their Q-tables have * been saved away. To handle this case, multiplier tables are preset * to zeroes; the result of the IDCT will be a neutral gray level. */ /* Private subobject for this module */ typedef struct { /* This array contains the IDCT method code that each multiplier table * is currently set up for, or -1 if it's not yet set up. * The actual multiplier tables are pointed to by dct_table in the * per-component comp_info structures. */ int cur_method[MAX_COMPONENTS]; } idct_controller; typedef idct_controller * idct_ptr; /* Allocated multiplier tables: big enough for any supported variant */ typedef union { ISLOW_MULT_TYPE islow_array[DCTSIZE2]; #ifdef DCT_IFAST_SUPPORTED IFAST_MULT_TYPE ifast_array[DCTSIZE2]; #endif #ifdef DCT_FLOAT_SUPPORTED FLOAT_MULT_TYPE float_array[DCTSIZE2]; #endif } multiplier_table; /* The current scaled-IDCT routines require ISLOW-style multiplier tables, * so be sure to compile that code if either ISLOW or SCALING is requested. */ #ifdef DCT_ISLOW_SUPPORTED #define PROVIDE_ISLOW_TABLES #else #ifdef IDCT_SCALING_SUPPORTED #define PROVIDE_ISLOW_TABLES #endif #endif /* * Prepare for an output pass. * Here we select the proper IDCT routine for each component and build * a matching multiplier table. */ METHODDEF(void) start_pass (j_decompress_ptr cinfo) { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; idct_ptr idct = (idct_ptr) lossyd->idct_private; int ci, i; jpeg_component_info *compptr; int method = 0; inverse_DCT_method_ptr method_ptr = NULL; JQUANT_TBL * qtbl; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { /* Select the proper IDCT routine for this component's scaling */ switch (compptr->codec_data_unit) { #ifdef IDCT_SCALING_SUPPORTED case 1: method_ptr = jpeg_idct_1x1; method = JDCT_ISLOW; /* jidctred uses islow-style table */ break; case 2: method_ptr = jpeg_idct_2x2; method = JDCT_ISLOW; /* jidctred uses islow-style table */ break; case 4: method_ptr = jpeg_idct_4x4; method = JDCT_ISLOW; /* jidctred uses islow-style table */ break; #endif case DCTSIZE: switch (cinfo->dct_method) { #ifdef DCT_ISLOW_SUPPORTED case JDCT_ISLOW: method_ptr = jpeg_idct_islow; method = JDCT_ISLOW; break; #endif #ifdef DCT_IFAST_SUPPORTED case JDCT_IFAST: method_ptr = jpeg_idct_ifast; method = JDCT_IFAST; break; #endif #ifdef DCT_FLOAT_SUPPORTED case JDCT_FLOAT: method_ptr = jpeg_idct_float; method = JDCT_FLOAT; break; #endif default: ERREXIT(cinfo, JERR_NOT_COMPILED); break; } break; default: ERREXIT1(cinfo, JERR_BAD_DCTSIZE, compptr->codec_data_unit); break; } lossyd->inverse_DCT[ci] = method_ptr; /* Create multiplier table from quant table. * However, we can skip this if the component is uninteresting * or if we already built the table. Also, if no quant table * has yet been saved for the component, we leave the * multiplier table all-zero; we'll be reading zeroes from the * coefficient controller's buffer anyway. */ if (! compptr->component_needed || idct->cur_method[ci] == method) continue; qtbl = compptr->quant_table; if (qtbl == NULL) /* happens if no data yet for component */ continue; idct->cur_method[ci] = method; switch (method) { #ifdef PROVIDE_ISLOW_TABLES case JDCT_ISLOW: { /* For LL&M IDCT method, multipliers are equal to raw quantization * coefficients, but are stored as ints to ensure access efficiency. */ ISLOW_MULT_TYPE * ismtbl = (ISLOW_MULT_TYPE *) compptr->dct_table; for (i = 0; i < DCTSIZE2; i++) { ismtbl[i] = (ISLOW_MULT_TYPE) qtbl->quantval[i]; } } break; #endif #ifdef DCT_IFAST_SUPPORTED case JDCT_IFAST: { /* For AA&N IDCT method, multipliers are equal to quantization * coefficients scaled by scalefactor[row]*scalefactor[col], where * scalefactor[0] = 1 * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 * For integer operation, the multiplier table is to be scaled by * IFAST_SCALE_BITS. */ IFAST_MULT_TYPE * ifmtbl = (IFAST_MULT_TYPE *) compptr->dct_table; #define CONST_BITS 14 static const INT16 aanscales[DCTSIZE2] = { /* precomputed values scaled up by 14 bits */ 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, 22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270, 21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906, 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315, 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, 12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552, 8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446, 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247 }; SHIFT_TEMPS for (i = 0; i < DCTSIZE2; i++) { ifmtbl[i] = (IFAST_MULT_TYPE) DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i], (INT32) aanscales[i]), CONST_BITS-IFAST_SCALE_BITS); } } break; #endif #ifdef DCT_FLOAT_SUPPORTED case JDCT_FLOAT: { /* For float AA&N IDCT method, multipliers are equal to quantization * coefficients scaled by scalefactor[row]*scalefactor[col], where * scalefactor[0] = 1 * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 */ FLOAT_MULT_TYPE * fmtbl = (FLOAT_MULT_TYPE *) compptr->dct_table; int row, col; static const double aanscalefactor[DCTSIZE] = { 1.0, 1.387039845, 1.306562965, 1.175875602, 1.0, 0.785694958, 0.541196100, 0.275899379 }; i = 0; for (row = 0; row < DCTSIZE; row++) { for (col = 0; col < DCTSIZE; col++) { fmtbl[i] = (FLOAT_MULT_TYPE) ((double) qtbl->quantval[i] * aanscalefactor[row] * aanscalefactor[col]); i++; } } } break; #endif default: ERREXIT(cinfo, JERR_NOT_COMPILED); break; } } } /* * Initialize IDCT manager. */ GLOBAL(void) jinit_inverse_dct (j_decompress_ptr cinfo) { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; idct_ptr idct; int ci; jpeg_component_info *compptr; idct = (idct_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(idct_controller)); lossyd->idct_private = (void *) idct; lossyd->idct_start_pass = start_pass; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { /* Allocate and pre-zero a multiplier table for each component */ compptr->dct_table = (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(multiplier_table)); MEMZERO(compptr->dct_table, SIZEOF(multiplier_table)); /* Mark multiplier table not yet set up for any method */ idct->cur_method[ci] = -1; } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jclossy.c������������������������������������������������0000644�0001750�0001750�00000003650�12320456500�021656� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jclossy.c * * Copyright (C) 1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains the control logic for the lossy JPEG compressor. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossy.h" /* * Initialize for a processing pass. */ METHODDEF(void) start_pass (j_compress_ptr cinfo, J_BUF_MODE pass_mode) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; (*lossyc->fdct_start_pass) (cinfo); (*lossyc->coef_start_pass) (cinfo, pass_mode); } /* * Initialize the lossy compression codec. * This is called only once, during master selection. */ GLOBAL(void) jinit_lossy_c_codec (j_compress_ptr cinfo) { j_lossy_c_ptr lossyc; /* Create subobject in permanent pool */ lossyc = (j_lossy_c_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, SIZEOF(jpeg_lossy_c_codec)); cinfo->codec = (struct jpeg_c_codec *) lossyc; /* Initialize sub-modules */ /* Forward DCT */ jinit_forward_dct(cinfo); /* Entropy encoding: either Huffman or arithmetic coding. */ if (cinfo->arith_code) { #ifdef WITH_ARITHMETIC_PATCH jinit_arith_encoder(cinfo); #else ERREXIT(cinfo, JERR_ARITH_NOTIMPL); #endif } else { if (cinfo->process == JPROC_PROGRESSIVE) { #ifdef C_PROGRESSIVE_SUPPORTED jinit_phuff_encoder(cinfo); #else ERREXIT(cinfo, JERR_NOT_COMPILED); #endif } else jinit_shuff_encoder(cinfo); } /* Need a full-image coefficient buffer in any multi-pass mode. */ jinit_c_coef_controller(cinfo, (boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding)); /* Initialize method pointers. * * Note: entropy_start_pass and entropy_finish_pass are assigned in * jcshuff.c or jcphuff.c and compress_data is assigned in jccoefct.c. */ lossyc->pub.start_pass = start_pass; } ����������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jcparam.c������������������������������������������������0000644�0001750�0001750�00000056071�12320456500�021612� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jcparam.c * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains optional default-setting code for the JPEG compressor. * Applications do not have to use this file, but those that don't use it * must know a lot more about the innards of the JPEG code. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" /* * Quantization table setup routines */ GLOBAL(void) jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl, const unsigned int *basic_table, int scale_factor, boolean force_baseline) /* Define a quantization table equal to the basic_table times * a scale factor (given as a percentage). * If force_baseline is TRUE, the computed quantization table entries * are limited to 1..255 for JPEG baseline compatibility. */ { JQUANT_TBL ** qtblptr; int i; long temp; /* Safety check to ensure start_compress not called yet. */ if (cinfo->global_state != CSTATE_START) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); if (which_tbl < 0 || which_tbl >= NUM_QUANT_TBLS) ERREXIT1(cinfo, JERR_DQT_INDEX, which_tbl); qtblptr = & cinfo->quant_tbl_ptrs[which_tbl]; if (*qtblptr == NULL) *qtblptr = jpeg_alloc_quant_table((j_common_ptr) cinfo); for (i = 0; i < DCTSIZE2; i++) { temp = ((long) basic_table[i] * scale_factor + 50L) / 100L; /* limit the values to the valid range */ if (temp <= 0L) temp = 1L; if (temp > 32767L) temp = 32767L; /* max quantizer needed for 12 bits */ if (force_baseline && temp > 255L) temp = 255L; /* limit to baseline range if requested */ (*qtblptr)->quantval[i] = (UINT16) temp; } /* Initialize sent_table FALSE so table will be written to JPEG file. */ (*qtblptr)->sent_table = FALSE; } GLOBAL(void) jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor, boolean force_baseline) /* Set or change the 'quality' (quantization) setting, using default tables * and a straight percentage-scaling quality scale. In most cases it's better * to use jpeg_set_quality (below); this entry point is provided for * applications that insist on a linear percentage scaling. */ { /* These are the sample quantization tables given in JPEG spec section K.1. * The spec says that the values given produce "good" quality, and * when divided by 2, "very good" quality. */ static const unsigned int std_luminance_quant_tbl[DCTSIZE2] = { 16, 11, 10, 16, 24, 40, 51, 61, 12, 12, 14, 19, 26, 58, 60, 55, 14, 13, 16, 24, 40, 57, 69, 56, 14, 17, 22, 29, 51, 87, 80, 62, 18, 22, 37, 56, 68, 109, 103, 77, 24, 35, 55, 64, 81, 104, 113, 92, 49, 64, 78, 87, 103, 121, 120, 101, 72, 92, 95, 98, 112, 100, 103, 99 }; static const unsigned int std_chrominance_quant_tbl[DCTSIZE2] = { 17, 18, 24, 47, 99, 99, 99, 99, 18, 21, 26, 66, 99, 99, 99, 99, 24, 26, 56, 99, 99, 99, 99, 99, 47, 66, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }; /* Set up two quantization tables using the specified scaling */ jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl, scale_factor, force_baseline); jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl, scale_factor, force_baseline); } GLOBAL(int) jpeg_quality_scaling (int quality) /* Convert a user-specified quality rating to a percentage scaling factor * for an underlying quantization table, using our recommended scaling curve. * The input 'quality' factor should be 0 (terrible) to 100 (very good). */ { /* Safety limit on quality factor. Convert 0 to 1 to avoid zero divide. */ if (quality <= 0) quality = 1; if (quality > 100) quality = 100; /* The basic table is used as-is (scaling 100) for a quality of 50. * Qualities 50..100 are converted to scaling percentage 200 - 2*Q; * note that at Q=100 the scaling is 0, which will cause jpeg_add_quant_table * to make all the table entries 1 (hence, minimum quantization loss). * Qualities 1..50 are converted to scaling percentage 5000/Q. */ if (quality < 50) quality = 5000 / quality; else quality = 200 - quality*2; return quality; } GLOBAL(void) jpeg_set_quality (j_compress_ptr cinfo, int quality, boolean force_baseline) /* Set or change the 'quality' (quantization) setting, using default tables. * This is the standard quality-adjusting entry point for typical user * interfaces; only those who want detailed control over quantization tables * would use the preceding three routines directly. */ { /* Convert user 0-100 rating to percentage scaling */ quality = jpeg_quality_scaling(quality); /* Set up standard quality tables */ jpeg_set_linear_quality(cinfo, quality, force_baseline); } /* * Huffman table setup routines */ LOCAL(void) add_huff_table (j_compress_ptr cinfo, JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val) /* Define a Huffman table */ { int nsymbols, len; if (*htblptr == NULL) *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); /* Copy the number-of-symbols-of-each-code-length counts */ MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits)); /* Validate the counts. We do this here mainly so we can copy the right * number of symbols from the val[] array, without risking marching off * the end of memory. jchuff.c will do a more thorough test later. */ nsymbols = 0; for (len = 1; len <= 16; len++) nsymbols += bits[len]; if (nsymbols < 1 || nsymbols > 256) ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); MEMCOPY((*htblptr)->huffval, val, nsymbols * SIZEOF(UINT8)); /* Initialize sent_table FALSE so table will be written to JPEG file. */ (*htblptr)->sent_table = FALSE; } LOCAL(void) std_huff_tables (j_compress_ptr cinfo) /* Set up the standard Huffman tables (cf. JPEG standard section K.3) */ /* IMPORTANT: these are only valid for 8-bit data precision! */ { static const UINT8 bits_dc_luminance[17] = { /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; static const UINT8 val_dc_luminance[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; static const UINT8 bits_dc_chrominance[17] = { /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; static const UINT8 val_dc_chrominance[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; static const UINT8 bits_ac_luminance[17] = { /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d }; static const UINT8 val_ac_luminance[] = { 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0, 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa }; static const UINT8 bits_ac_chrominance[17] = { /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 }; static const UINT8 val_ac_chrominance[] = { 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0, 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34, 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa }; add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[0], bits_dc_luminance, val_dc_luminance); add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[0], bits_ac_luminance, val_ac_luminance); add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[1], bits_dc_chrominance, val_dc_chrominance); add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[1], bits_ac_chrominance, val_ac_chrominance); } /* * Default parameter setup for compression. * * Applications that don't choose to use this routine must do their * own setup of all these parameters. Alternately, you can call this * to establish defaults and then alter parameters selectively. This * is the recommended approach since, if we add any new parameters, * your code will still work (they'll be set to reasonable defaults). */ GLOBAL(void) jpeg_set_defaults (j_compress_ptr cinfo) { int i; /* Safety check to ensure start_compress not called yet. */ if (cinfo->global_state != CSTATE_START) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); /* Allocate comp_info array large enough for maximum component count. * Array is made permanent in case application wants to compress * multiple images at same param settings. */ if (cinfo->comp_info == NULL) cinfo->comp_info = (jpeg_component_info *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, MAX_COMPONENTS * SIZEOF(jpeg_component_info)); /* Initialize everything not dependent on the color space */ cinfo->lossless = FALSE; cinfo->data_precision = BITS_IN_JSAMPLE; /* Set up two quantization tables using default quality of 75 */ jpeg_set_quality(cinfo, 75, TRUE); /* Set up two Huffman tables */ std_huff_tables(cinfo); /* Initialize default arithmetic coding conditioning */ for (i = 0; i < NUM_ARITH_TBLS; i++) { cinfo->arith_dc_L[i] = 0; cinfo->arith_dc_U[i] = 1; cinfo->arith_ac_K[i] = 5; } /* Default is no multiple-scan output */ cinfo->scan_info = NULL; cinfo->num_scans = 0; /* Expect normal source image, not raw downsampled data */ cinfo->raw_data_in = FALSE; /* Use Huffman coding, not arithmetic coding, by default */ cinfo->arith_code = FALSE; /* By default, don't do extra passes to optimize entropy coding */ cinfo->optimize_coding = FALSE; /* The standard Huffman tables are only valid for 8-bit data precision. * If the precision is higher, force optimization on so that usable * tables will be computed. This test can be removed if default tables * are supplied that are valid for the desired precision. */ if (cinfo->data_precision > 8) cinfo->optimize_coding = TRUE; /* By default, use the simpler non-cosited sampling alignment */ cinfo->CCIR601_sampling = FALSE; /* No input smoothing */ cinfo->smoothing_factor = 0; /* DCT algorithm preference */ cinfo->dct_method = JDCT_DEFAULT; /* No restart markers */ cinfo->restart_interval = 0; cinfo->restart_in_rows = 0; /* Fill in default JFIF marker parameters. Note that whether the marker * will actually be written is determined by jpeg_set_colorspace. * * By default, the library emits JFIF version code 1.01. * An application that wants to emit JFIF 1.02 extension markers should set * JFIF_minor_version to 2. We could probably get away with just defaulting * to 1.02, but there may still be some decoders in use that will complain * about that; saying 1.01 should minimize compatibility problems. */ cinfo->JFIF_major_version = 1; /* Default JFIF version = 1.01 */ cinfo->JFIF_minor_version = 1; cinfo->density_unit = 0; /* Pixel size is unknown by default */ cinfo->X_density = 1; /* Pixel aspect ratio is square by default */ cinfo->Y_density = 1; /* Choose JPEG colorspace based on input space, set defaults accordingly */ jpeg_default_colorspace(cinfo); } /* * Select an appropriate JPEG colorspace for in_color_space. */ GLOBAL(void) jpeg_default_colorspace (j_compress_ptr cinfo) { if (cinfo->lossless) jpeg_set_colorspace(cinfo, cinfo->in_color_space); else { /* lossy */ switch (cinfo->in_color_space) { case JCS_GRAYSCALE: jpeg_set_colorspace(cinfo, JCS_GRAYSCALE); break; case JCS_RGB: jpeg_set_colorspace(cinfo, JCS_YCbCr); break; case JCS_YCbCr: jpeg_set_colorspace(cinfo, JCS_YCbCr); break; case JCS_CMYK: jpeg_set_colorspace(cinfo, JCS_CMYK); /* By default, no translation */ break; case JCS_YCCK: jpeg_set_colorspace(cinfo, JCS_YCCK); break; case JCS_UNKNOWN: jpeg_set_colorspace(cinfo, JCS_UNKNOWN); break; default: ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); } } } /* * Set the JPEG colorspace, and choose colorspace-dependent default values. */ GLOBAL(void) jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace) { jpeg_component_info * compptr; int ci; #define SET_COMP(index,id,hsamp,vsamp,quant,dctbl,actbl) \ (compptr = &cinfo->comp_info[index], \ compptr->component_id = (id), \ compptr->h_samp_factor = (hsamp), \ compptr->v_samp_factor = (vsamp), \ compptr->quant_tbl_no = (quant), \ compptr->dc_tbl_no = (dctbl), \ compptr->ac_tbl_no = (actbl) ) /* Safety check to ensure start_compress not called yet. */ if (cinfo->global_state != CSTATE_START) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); /* For all colorspaces, we use Q and Huff tables 0 for luminance components, * tables 1 for chrominance components. */ cinfo->jpeg_color_space = colorspace; cinfo->write_JFIF_header = FALSE; /* No marker for non-JFIF colorspaces */ cinfo->write_Adobe_marker = FALSE; /* write no Adobe marker by default */ switch (colorspace) { case JCS_GRAYSCALE: cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */ cinfo->num_components = 1; /* JFIF specifies component ID 1 */ SET_COMP(0, 1, 1,1, 0, 0,0); break; case JCS_RGB: cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag RGB */ cinfo->num_components = 3; SET_COMP(0, 0x52 /* 'R' */, 1,1, 0, 0,0); SET_COMP(1, 0x47 /* 'G' */, 1,1, 0, 0,0); SET_COMP(2, 0x42 /* 'B' */, 1,1, 0, 0,0); break; case JCS_YCbCr: cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */ cinfo->num_components = 3; /* JFIF specifies component IDs 1,2,3 */ if (cinfo->lossless) { SET_COMP(0, 1, 1,1, 0, 0,0); SET_COMP(1, 2, 1,1, 1, 1,1); SET_COMP(2, 3, 1,1, 1, 1,1); } else { /* lossy */ /* We default to 2x2 subsamples of chrominance */ SET_COMP(0, 1, 2,2, 0, 0,0); SET_COMP(1, 2, 1,1, 1, 1,1); SET_COMP(2, 3, 1,1, 1, 1,1); } break; case JCS_CMYK: cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag CMYK */ cinfo->num_components = 4; SET_COMP(0, 0x43 /* 'C' */, 1,1, 0, 0,0); SET_COMP(1, 0x4D /* 'M' */, 1,1, 0, 0,0); SET_COMP(2, 0x59 /* 'Y' */, 1,1, 0, 0,0); SET_COMP(3, 0x4B /* 'K' */, 1,1, 0, 0,0); break; case JCS_YCCK: cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag YCCK */ cinfo->num_components = 4; if (cinfo->lossless) { SET_COMP(0, 1, 1,1, 0, 0,0); SET_COMP(1, 2, 1,1, 1, 1,1); SET_COMP(2, 3, 1,1, 1, 1,1); SET_COMP(3, 4, 1,1, 0, 0,0); } else { /* lossy */ SET_COMP(0, 1, 2,2, 0, 0,0); SET_COMP(1, 2, 1,1, 1, 1,1); SET_COMP(2, 3, 1,1, 1, 1,1); SET_COMP(3, 4, 2,2, 0, 0,0); } break; case JCS_UNKNOWN: cinfo->num_components = cinfo->input_components; if (cinfo->num_components < 1 || cinfo->num_components > MAX_COMPONENTS) ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, MAX_COMPONENTS); for (ci = 0; ci < cinfo->num_components; ci++) { SET_COMP(ci, ci, 1,1, 0, 0,0); } break; default: ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); } } #ifdef C_PROGRESSIVE_SUPPORTED LOCAL(jpeg_scan_info *) fill_scans (jpeg_scan_info * scanptr, int ncomps, int Ss, int Se, int Ah, int Al) /* Support routine: generate one scan for each component */ { int ci; for (ci = 0; ci < ncomps; ci++) { scanptr->comps_in_scan = 1; scanptr->component_index[0] = ci; scanptr->Ss = Ss; scanptr->Se = Se; scanptr->Ah = Ah; scanptr->Al = Al; scanptr++; } return scanptr; } LOCAL(jpeg_scan_info *) fill_a_scan (jpeg_scan_info * scanptr, int ci, int Ss, int Se, int Ah, int Al) /* Support routine: generate one scan for specified component */ { scanptr->comps_in_scan = 1; scanptr->component_index[0] = ci; scanptr->Ss = Ss; scanptr->Se = Se; scanptr->Ah = Ah; scanptr->Al = Al; scanptr++; return scanptr; } LOCAL(jpeg_scan_info *) fill_dc_scans (jpeg_scan_info * scanptr, int ncomps, int Ah, int Al) /* Support routine: generate interleaved DC scan if possible, else N scans */ { int ci; if (ncomps <= MAX_COMPS_IN_SCAN) { /* Single interleaved DC scan */ scanptr->comps_in_scan = ncomps; for (ci = 0; ci < ncomps; ci++) scanptr->component_index[ci] = ci; scanptr->Ss = scanptr->Se = 0; scanptr->Ah = Ah; scanptr->Al = Al; scanptr++; } else { /* Noninterleaved DC scan for each component */ scanptr = fill_scans(scanptr, ncomps, 0, 0, Ah, Al); } return scanptr; } /* * Create a recommended progressive-JPEG script. * cinfo->num_components and cinfo->jpeg_color_space must be correct. */ GLOBAL(void) jpeg_simple_progression (j_compress_ptr cinfo) { int ncomps = cinfo->num_components; int nscans; jpeg_scan_info * scanptr; /* Safety check to ensure start_compress not called yet. */ if (cinfo->global_state != CSTATE_START) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); /* Figure space needed for script. Calculation must match code below! */ if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) { /* Custom script for YCbCr color images. */ nscans = 10; } else { /* All-purpose script for other color spaces. */ if (ncomps > MAX_COMPS_IN_SCAN) nscans = 6 * ncomps; /* 2 DC + 4 AC scans per component */ else nscans = 2 + 4 * ncomps; /* 2 DC scans; 4 AC scans per component */ } /* Allocate space for script. * We need to put it in the permanent pool in case the application performs * multiple compressions without changing the settings. To avoid a memory * leak if jpeg_simple_progression is called repeatedly for the same JPEG * object, we try to re-use previously allocated space, and we allocate * enough space to handle YCbCr even if initially asked for grayscale. */ if (cinfo->script_space == NULL || cinfo->script_space_size < nscans) { cinfo->script_space_size = MAX(nscans, 10); cinfo->script_space = (jpeg_scan_info *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, cinfo->script_space_size * SIZEOF(jpeg_scan_info)); } scanptr = cinfo->script_space; cinfo->scan_info = scanptr; cinfo->num_scans = nscans; if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) { /* Custom script for YCbCr color images. */ /* Initial DC scan */ scanptr = fill_dc_scans(scanptr, ncomps, 0, 1); /* Initial AC scan: get some luma data out in a hurry */ scanptr = fill_a_scan(scanptr, 0, 1, 5, 0, 2); /* Chroma data is too small to be worth expending many scans on */ scanptr = fill_a_scan(scanptr, 2, 1, 63, 0, 1); scanptr = fill_a_scan(scanptr, 1, 1, 63, 0, 1); /* Complete spectral selection for luma AC */ scanptr = fill_a_scan(scanptr, 0, 6, 63, 0, 2); /* Refine next bit of luma AC */ scanptr = fill_a_scan(scanptr, 0, 1, 63, 2, 1); /* Finish DC successive approximation */ scanptr = fill_dc_scans(scanptr, ncomps, 1, 0); /* Finish AC successive approximation */ scanptr = fill_a_scan(scanptr, 2, 1, 63, 1, 0); scanptr = fill_a_scan(scanptr, 1, 1, 63, 1, 0); /* Luma bottom bit comes last since it's usually largest scan */ scanptr = fill_a_scan(scanptr, 0, 1, 63, 1, 0); } else { /* All-purpose script for other color spaces. */ /* Successive approximation first pass */ scanptr = fill_dc_scans(scanptr, ncomps, 0, 1); scanptr = fill_scans(scanptr, ncomps, 1, 5, 0, 2); scanptr = fill_scans(scanptr, ncomps, 6, 63, 0, 2); /* Successive approximation second pass */ scanptr = fill_scans(scanptr, ncomps, 1, 63, 2, 1); /* Successive approximation final pass */ scanptr = fill_dc_scans(scanptr, ncomps, 1, 0); scanptr = fill_scans(scanptr, ncomps, 1, 63, 1, 0); } } #endif /* C_PROGRESSIVE_SUPPORTED */ #ifdef C_LOSSLESS_SUPPORTED /* * Create a single-entry lossless-JPEG script containing all components. * cinfo->num_components must be correct. */ GLOBAL(void) jpeg_simple_lossless (j_compress_ptr cinfo, int predictor, int point_transform) { int ncomps = cinfo->num_components; int nscans = 1; int ci; jpeg_scan_info * scanptr; /* Safety check to ensure start_compress not called yet. */ if (cinfo->global_state != CSTATE_START) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); cinfo->lossless = TRUE; /* Set jpeg_color_space. */ jpeg_default_colorspace(cinfo); /* Check to ensure that all components will fit in one scan. */ if (cinfo->num_components > MAX_COMPS_IN_SCAN) ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, MAX_COMPS_IN_SCAN); /* Allocate space for script. * We need to put it in the permanent pool in case the application performs * multiple compressions without changing the settings. To avoid a memory * leak if jpeg_simple_lossless is called repeatedly for the same JPEG * object, we try to re-use previously allocated space. */ if (cinfo->script_space == NULL || cinfo->script_space_size < nscans) { cinfo->script_space_size = nscans; cinfo->script_space = (jpeg_scan_info *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, cinfo->script_space_size * SIZEOF(jpeg_scan_info)); } scanptr = cinfo->script_space; cinfo->scan_info = scanptr; cinfo->num_scans = nscans; /* Fill the script. */ scanptr->comps_in_scan = ncomps; for (ci = 0; ci < ncomps; ci++) scanptr->component_index[ci] = ci; scanptr->Ss = predictor; scanptr->Se = 0; scanptr->Ah = 0; scanptr->Al = point_transform; } #endif /* C_LOSSLESS_SUPPORTED */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdmaster.c�����������������������������������������������0000644�0001750�0001750�00000037375�12320456500�022014� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdmaster.c * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains master control logic for the JPEG decompressor. * These routines are concerned with selecting the modules to be executed * and with determining the number of passes and the work to be done in each * pass. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" /* Private state */ typedef struct { struct jpeg_decomp_master pub; /* public fields */ int pass_number; /* # of passes completed */ boolean using_merged_upsample; /* TRUE if using merged upsample/cconvert */ /* Saved references to initialized quantizer modules, * in case we need to switch modes. */ struct jpeg_color_quantizer * quantizer_1pass; struct jpeg_color_quantizer * quantizer_2pass; } my_decomp_master; typedef my_decomp_master * my_master_ptr; /* * Determine whether merged upsample/color conversion should be used. * CRUCIAL: this must match the actual capabilities of jdmerge.c! */ LOCAL(boolean) use_merged_upsample (j_decompress_ptr cinfo) { #ifdef UPSAMPLE_MERGING_SUPPORTED /* Merging is the equivalent of plain box-filter upsampling */ if (cinfo->do_fancy_upsampling || cinfo->CCIR601_sampling) return FALSE; /* jdmerge.c only supports YCC=>RGB color conversion */ if (cinfo->jpeg_color_space != JCS_YCbCr || cinfo->num_components != 3 || cinfo->out_color_space != JCS_RGB || cinfo->out_color_components != RGB_PIXELSIZE) return FALSE; /* and it only handles 2h1v or 2h2v sampling ratios */ if (cinfo->comp_info[0].h_samp_factor != 2 || cinfo->comp_info[1].h_samp_factor != 1 || cinfo->comp_info[2].h_samp_factor != 1 || cinfo->comp_info[0].v_samp_factor > 2 || cinfo->comp_info[1].v_samp_factor != 1 || cinfo->comp_info[2].v_samp_factor != 1) return FALSE; /* furthermore, it doesn't work if each component has been processed differently */ if (cinfo->comp_info[0].codec_data_unit != cinfo->min_codec_data_unit || cinfo->comp_info[1].codec_data_unit != cinfo->min_codec_data_unit || cinfo->comp_info[2].codec_data_unit != cinfo->min_codec_data_unit) return FALSE; /* ??? also need to test for upsample-time rescaling, when & if supported */ return TRUE; /* by golly, it'll work... */ #else return FALSE; #endif } /* * Compute output image dimensions and related values. * NOTE: this is exported for possible use by application. * Hence it mustn't do anything that can't be done twice. * Also note that it may be called before the master module is initialized! */ GLOBAL(void) jpeg_calc_output_dimensions (j_decompress_ptr cinfo) /* Do computations that are needed before master selection phase */ { /* Prevent application from calling me at wrong times */ if (cinfo->global_state != DSTATE_READY) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); (*cinfo->codec->calc_output_dimensions) (cinfo); /* Report number of components in selected colorspace. */ /* Probably this should be in the color conversion module... */ switch (cinfo->out_color_space) { case JCS_GRAYSCALE: cinfo->out_color_components = 1; break; case JCS_RGB: #if RGB_PIXELSIZE != 3 cinfo->out_color_components = RGB_PIXELSIZE; break; #endif /* else share code with YCbCr */ case JCS_YCbCr: cinfo->out_color_components = 3; break; case JCS_CMYK: case JCS_YCCK: cinfo->out_color_components = 4; break; default: /* else must be same colorspace as in file */ cinfo->out_color_components = cinfo->num_components; break; } cinfo->output_components = (cinfo->quantize_colors ? 1 : cinfo->out_color_components); /* See if upsampler will want to emit more than one row at a time */ if (use_merged_upsample(cinfo)) cinfo->rec_outbuf_height = cinfo->max_v_samp_factor; else cinfo->rec_outbuf_height = 1; } /* * Several decompression processes need to range-limit values to the range * 0..MAXJSAMPLE; the input value may fall somewhat outside this range * due to noise introduced by quantization, roundoff error, etc. These * processes are inner loops and need to be as fast as possible. On most * machines, particularly CPUs with pipelines or instruction prefetch, * a (subscript-check-less) C table lookup * x = sample_range_limit[x]; * is faster than explicit tests * if (x < 0) x = 0; * else if (x > MAXJSAMPLE) x = MAXJSAMPLE; * These processes all use a common table prepared by the routine below. * * For most steps we can mathematically guarantee that the initial value * of x is within MAXJSAMPLE+1 of the legal range, so a table running from * -(MAXJSAMPLE+1) to 2*MAXJSAMPLE+1 is sufficient. But for the initial * limiting step (just after the IDCT), a wildly out-of-range value is * possible if the input data is corrupt. To avoid any chance of indexing * off the end of memory and getting a bad-pointer trap, we perform the * post-IDCT limiting thus: * x = range_limit[x & MASK]; * where MASK is 2 bits wider than legal sample data, ie 10 bits for 8-bit * samples. Under normal circumstances this is more than enough range and * a correct output will be generated; with bogus input data the mask will * cause wraparound, and we will safely generate a bogus-but-in-range output. * For the post-IDCT step, we want to convert the data from signed to unsigned * representation by adding CENTERJSAMPLE at the same time that we limit it. * So the post-IDCT limiting table ends up looking like this: * CENTERJSAMPLE,CENTERJSAMPLE+1,...,MAXJSAMPLE, * MAXJSAMPLE (repeat 2*(MAXJSAMPLE+1)-CENTERJSAMPLE times), * 0 (repeat 2*(MAXJSAMPLE+1)-CENTERJSAMPLE times), * 0,1,...,CENTERJSAMPLE-1 * Negative inputs select values from the upper half of the table after * masking. * * We can save some space by overlapping the start of the post-IDCT table * with the simpler range limiting table. The post-IDCT table begins at * sample_range_limit + CENTERJSAMPLE. * * Note that the table is allocated in near data space on PCs; it's small * enough and used often enough to justify this. */ LOCAL(void) prepare_range_limit_table (j_decompress_ptr cinfo) /* Allocate and fill in the sample_range_limit table */ { JSAMPLE * table; int i; table = (JSAMPLE *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (5 * (MAXJSAMPLE+1) + CENTERJSAMPLE) * SIZEOF(JSAMPLE)); table += (MAXJSAMPLE+1); /* allow negative subscripts of simple table */ cinfo->sample_range_limit = table; /* First segment of "simple" table: limit[x] = 0 for x < 0 */ MEMZERO(table - (MAXJSAMPLE+1), (MAXJSAMPLE+1) * SIZEOF(JSAMPLE)); /* Main part of "simple" table: limit[x] = x */ for (i = 0; i <= MAXJSAMPLE; i++) table[i] = (JSAMPLE) i; table += CENTERJSAMPLE; /* Point to where post-IDCT table starts */ /* End of simple table, rest of first half of post-IDCT table */ for (i = CENTERJSAMPLE; i < 2*(MAXJSAMPLE+1); i++) table[i] = MAXJSAMPLE; /* Second half of post-IDCT table */ MEMZERO(table + (2 * (MAXJSAMPLE+1)), (2 * (MAXJSAMPLE+1) - CENTERJSAMPLE) * SIZEOF(JSAMPLE)); MEMCOPY(table + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE), cinfo->sample_range_limit, CENTERJSAMPLE * SIZEOF(JSAMPLE)); } /* * Master selection of decompression modules. * This is done once at jpeg_start_decompress time. We determine * which modules will be used and give them appropriate initialization calls. * We also initialize the decompressor input side to begin consuming data. * * Since jpeg_read_header has finished, we know what is in the SOF * and (first) SOS markers. We also have all the application parameter * settings. */ LOCAL(void) master_selection (j_decompress_ptr cinfo) { my_master_ptr master = (my_master_ptr) cinfo->master; long samplesperrow; JDIMENSION jd_samplesperrow; /* Initialize dimensions and other stuff */ jpeg_calc_output_dimensions(cinfo); prepare_range_limit_table(cinfo); /* Width of an output scanline must be representable as JDIMENSION. */ samplesperrow = (long) cinfo->output_width * (long) cinfo->out_color_components; jd_samplesperrow = (JDIMENSION) samplesperrow; if ((long) jd_samplesperrow != samplesperrow) ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); /* Initialize my private state */ master->pass_number = 0; master->using_merged_upsample = use_merged_upsample(cinfo); /* Color quantizer selection */ master->quantizer_1pass = NULL; master->quantizer_2pass = NULL; /* No mode changes if not using buffered-image mode. */ if (! cinfo->quantize_colors || ! cinfo->buffered_image) { cinfo->enable_1pass_quant = FALSE; cinfo->enable_external_quant = FALSE; cinfo->enable_2pass_quant = FALSE; } if (cinfo->quantize_colors) { if (cinfo->raw_data_out) ERREXIT(cinfo, JERR_NOTIMPL); /* 2-pass quantizer only works in 3-component color space. */ if (cinfo->out_color_components != 3) { cinfo->enable_1pass_quant = TRUE; cinfo->enable_external_quant = FALSE; cinfo->enable_2pass_quant = FALSE; cinfo->colormap = NULL; } else if (cinfo->colormap != NULL) { cinfo->enable_external_quant = TRUE; } else if (cinfo->two_pass_quantize) { cinfo->enable_2pass_quant = TRUE; } else { cinfo->enable_1pass_quant = TRUE; } if (cinfo->enable_1pass_quant) { #ifdef QUANT_1PASS_SUPPORTED jinit_1pass_quantizer(cinfo); master->quantizer_1pass = cinfo->cquantize; #else ERREXIT(cinfo, JERR_NOT_COMPILED); #endif } /* We use the 2-pass code to map to external colormaps. */ if (cinfo->enable_2pass_quant || cinfo->enable_external_quant) { #ifdef QUANT_2PASS_SUPPORTED jinit_2pass_quantizer(cinfo); master->quantizer_2pass = cinfo->cquantize; #else ERREXIT(cinfo, JERR_NOT_COMPILED); #endif } /* If both quantizers are initialized, the 2-pass one is left active; * this is necessary for starting with quantization to an external map. */ } /* Post-processing: in particular, color conversion first */ if (! cinfo->raw_data_out) { if (master->using_merged_upsample) { #ifdef UPSAMPLE_MERGING_SUPPORTED jinit_merged_upsampler(cinfo); /* does color conversion too */ #else ERREXIT(cinfo, JERR_NOT_COMPILED); #endif } else { jinit_color_deconverter(cinfo); jinit_upsampler(cinfo); } jinit_d_post_controller(cinfo, cinfo->enable_2pass_quant); } /* Initialize principal buffer controllers. */ if (! cinfo->raw_data_out) jinit_d_main_controller(cinfo, FALSE /* never need full buffer here */); /* We can now tell the memory manager to allocate virtual arrays. */ (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); /* Initialize input side of decompressor to consume first scan. */ (*cinfo->inputctl->start_input_pass) (cinfo); #ifdef D_MULTISCAN_FILES_SUPPORTED /* If jpeg_start_decompress will read the whole file, initialize * progress monitoring appropriately. The input step is counted * as one pass. */ if (cinfo->progress != NULL && ! cinfo->buffered_image && cinfo->inputctl->has_multiple_scans) { int nscans; /* Estimate number of scans to set pass_limit. */ if (cinfo->process == JPROC_PROGRESSIVE) { /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */ nscans = 2 + 3 * cinfo->num_components; } else { /* For a nonprogressive multiscan file, estimate 1 scan per component. */ nscans = cinfo->num_components; } cinfo->progress->pass_counter = 0L; cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans; cinfo->progress->completed_passes = 0; cinfo->progress->total_passes = (cinfo->enable_2pass_quant ? 3 : 2); /* Count the input pass as done */ master->pass_number++; } #endif /* D_MULTISCAN_FILES_SUPPORTED */ } /* * Per-pass setup. * This is called at the beginning of each output pass. We determine which * modules will be active during this pass and give them appropriate * start_pass calls. We also set is_dummy_pass to indicate whether this * is a "real" output pass or a dummy pass for color quantization. * (In the latter case, jdapistd.c will crank the pass to completion.) */ METHODDEF(void) prepare_for_output_pass (j_decompress_ptr cinfo) { my_master_ptr master = (my_master_ptr) cinfo->master; if (master->pub.is_dummy_pass) { #ifdef QUANT_2PASS_SUPPORTED /* Final pass of 2-pass quantization */ master->pub.is_dummy_pass = FALSE; (*cinfo->cquantize->start_pass) (cinfo, FALSE); (*cinfo->post->start_pass) (cinfo, JBUF_CRANK_DEST); (*cinfo->main->start_pass) (cinfo, JBUF_CRANK_DEST); #else ERREXIT(cinfo, JERR_NOT_COMPILED); #endif /* QUANT_2PASS_SUPPORTED */ } else { if (cinfo->quantize_colors && cinfo->colormap == NULL) { /* Select new quantization method */ if (cinfo->two_pass_quantize && cinfo->enable_2pass_quant) { cinfo->cquantize = master->quantizer_2pass; master->pub.is_dummy_pass = TRUE; } else if (cinfo->enable_1pass_quant) { cinfo->cquantize = master->quantizer_1pass; } else { ERREXIT(cinfo, JERR_MODE_CHANGE); } } (*cinfo->codec->start_output_pass) (cinfo); if (! cinfo->raw_data_out) { if (! master->using_merged_upsample) (*cinfo->cconvert->start_pass) (cinfo); (*cinfo->upsample->start_pass) (cinfo); if (cinfo->quantize_colors) (*cinfo->cquantize->start_pass) (cinfo, master->pub.is_dummy_pass); (*cinfo->post->start_pass) (cinfo, (master->pub.is_dummy_pass ? JBUF_SAVE_AND_PASS : JBUF_PASS_THRU)); (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU); } } /* Set up progress monitor's pass info if present */ if (cinfo->progress != NULL) { cinfo->progress->completed_passes = master->pass_number; cinfo->progress->total_passes = master->pass_number + (master->pub.is_dummy_pass ? 2 : 1); /* In buffered-image mode, we assume one more output pass if EOI not * yet reached, but no more passes if EOI has been reached. */ if (cinfo->buffered_image && ! cinfo->inputctl->eoi_reached) { cinfo->progress->total_passes += (cinfo->enable_2pass_quant ? 2 : 1); } } } /* * Finish up at end of an output pass. */ METHODDEF(void) finish_output_pass (j_decompress_ptr cinfo) { my_master_ptr master = (my_master_ptr) cinfo->master; if (cinfo->quantize_colors) (*cinfo->cquantize->finish_pass) (cinfo); master->pass_number++; } #ifdef D_MULTISCAN_FILES_SUPPORTED /* * Switch to a new external colormap between output passes. */ GLOBAL(void) jpeg_new_colormap (j_decompress_ptr cinfo) { my_master_ptr master = (my_master_ptr) cinfo->master; /* Prevent application from calling me at wrong times */ if (cinfo->global_state != DSTATE_BUFIMAGE) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); if (cinfo->quantize_colors && cinfo->enable_external_quant && cinfo->colormap != NULL) { /* Select 2-pass quantizer for external colormap use */ cinfo->cquantize = master->quantizer_2pass; /* Notify quantizer of colormap change */ (*cinfo->cquantize->new_color_map) (cinfo); master->pub.is_dummy_pass = FALSE; /* just in case */ } else ERREXIT(cinfo, JERR_MODE_CHANGE); } #endif /* D_MULTISCAN_FILES_SUPPORTED */ /* * Initialize master decompression control and select active modules. * This is performed at the start of jpeg_start_decompress. */ GLOBAL(void) jinit_master_decompress (j_decompress_ptr cinfo) { my_master_ptr master; master = (my_master_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_decomp_master)); cinfo->master = (struct jpeg_decomp_master *) master; master->pub.prepare_for_output_pass = prepare_for_output_pass; master->pub.finish_output_pass = finish_output_pass; master->pub.is_dummy_pass = FALSE; master_selection(cinfo); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jchuff.h�������������������������������������������������0000644�0001750�0001750�00000003435�12320456500�021443� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jchuff.h * * Copyright (C) 1991-1997, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains declarations for Huffman entropy encoding routines * that are shared between the sequential encoder (jchuff.c) and the * progressive encoder (jcphuff.c). No other modules need to see these. */ /* The legal range of a DCT coefficient is * -1024 .. +1023 for 8-bit data; * -16384 .. +16383 for 12-bit data. * Hence the magnitude should always fit in 10 or 14 bits respectively. */ #ifdef __cplusplus extern "C" { #endif // cplusplus #if BITS_IN_JSAMPLE == 8 #define MAX_COEF_BITS 10 #else #define MAX_COEF_BITS 14 #endif /* The legal range of a spatial difference is * -32767 .. +32768. * Hence the magnitude should always fit in 16 bits. */ #define MAX_DIFF_BITS 16 /* Derived data constructed for each Huffman table */ typedef struct { unsigned int ehufco[256]; /* code for each symbol */ char ehufsi[256]; /* length of code for each symbol */ /* If no code has been allocated for a symbol S, ehufsi[S] contains 0 */ } c_derived_tbl; /* Short forms of external names for systems with brain-damaged linkers. */ #ifdef NEED_SHORT_EXTERNAL_NAMES #define jpeg_make_c_derived_tbl jMkCDerived #define jpeg_gen_optimal_table jGenOptTbl #endif /* NEED_SHORT_EXTERNAL_NAMES */ /* Expand a Huffman table definition into the derived format */ EXTERN(void) jpeg_make_c_derived_tbl JPP((j_compress_ptr cinfo, boolean isDC, int tblno, c_derived_tbl ** pdtbl)); /* Generate an optimal table definition given the specified counts */ EXTERN(void) jpeg_gen_optimal_table JPP((j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])); #ifdef __cplusplus } #endif // cplusplus �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jmorecfg.h�����������������������������������������������0000644�0001750�0001750�00000033500�12320456500�021766� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jmorecfg.h * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains additional configuration options that customize the * JPEG software for special applications or support machine-dependent * optimizations. Most users will not need to touch this file. */ #ifdef __cplusplus extern "C" { #endif // cplusplus // Force static build. #define JPEGSTATIC /* * Define BITS_IN_JSAMPLE as either * 8 for 8-bit sample values (the usual setting) * 12 for 12-bit sample values * Only 8 and 12 are legal data precisions for lossy JPEG according to the * JPEG standard, and the IJG code does not support anything else! * We do not support run-time selection of data precision, sorry. */ /*#define BITS_IN_JSAMPLE 8*//* use 8 or 12 (or 16 only for lossless) */ #ifndef BITS_IN_JSAMPLE #error You need to define BITS_IN_JSAMPLE #endif /* * Maximum number of components (color channels) allowed in JPEG image. * To meet the letter of the JPEG spec, set this to 255. However, darn * few applications need more than 4 channels (maybe 5 for CMYK + alpha * mask). We recommend 10 as a reasonable compromise; use 4 if you are * really short on memory. (Each allowed component costs a hundred or so * bytes of storage, whether actually used in an image or not.) */ #define MAX_COMPONENTS 10 /* maximum number of image components */ /* * Basic data types. * You may need to change these if you have a machine with unusual data * type sizes; for example, "char" not 8 bits, "short" not 16 bits, * or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits, * but it had better be at least 16. */ /* Representation of a single sample (pixel element value). * We frequently allocate large arrays of these, so it's important to keep * them small. But if you have memory to burn and access to char or short * arrays is very slow on your hardware, you might want to change these. */ #if BITS_IN_JSAMPLE == 8 /* JSAMPLE should be the smallest type that will hold the values 0..255. * You can use a signed char by having GETJSAMPLE mask it with 0xFF. */ #ifdef HAVE_UNSIGNED_CHAR typedef unsigned char JSAMPLE; #define GETJSAMPLE(value) ((int) (value)) #else /* not HAVE_UNSIGNED_CHAR */ typedef char JSAMPLE; #ifdef CHAR_IS_UNSIGNED #define GETJSAMPLE(value) ((int) (value)) #else #define GETJSAMPLE(value) ((int) (value) & 0xFF) #endif /* CHAR_IS_UNSIGNED */ #endif /* HAVE_UNSIGNED_CHAR */ #define MAXJSAMPLE 255 #define CENTERJSAMPLE 128 #endif /* BITS_IN_JSAMPLE == 8 */ #if BITS_IN_JSAMPLE == 12 /* JSAMPLE should be the smallest type that will hold the values 0..4095. * On nearly all machines "short" will do nicely. */ typedef short JSAMPLE; #define GETJSAMPLE(value) ((int) (value)) #define MAXJSAMPLE 4095 #define CENTERJSAMPLE 2048 #endif /* BITS_IN_JSAMPLE == 12 */ #if BITS_IN_JSAMPLE == 16 /* JSAMPLE should be the smallest type that will hold the values 0..65535. * You can use a signed short by having GETJSAMPLE mask it with 0xFFFF. */ #ifdef HAVE_UNSIGNED_SHORT typedef unsigned short JSAMPLE; #define GETJSAMPLE(value) ((int) (value)) #else /* not HAVE_UNSIGNED_SHORT */ typedef short JSAMPLE; #ifdef SHORT_IS_UNSIGNED #define GETJSAMPLE(value) ((int) (value)) #else #define GETJSAMPLE(value) ((int) (value) & 0xFFFF) #endif /* SHORT_IS_UNSIGNED */ #endif /* HAVE_UNSIGNED_SHORT */ #define MAXJSAMPLE 65535 #define CENTERJSAMPLE 32768 #endif /* BITS_IN_JSAMPLE == 16 */ /* Representation of a DCT frequency coefficient. * This should be a signed value of at least 16 bits; "short" is usually OK. * Again, we allocate large arrays of these, but you can change to int * if you have memory to burn and "short" is really slow. */ typedef short JCOEF; /* Representation of a spatial difference value. * This should be a signed value of at least 16 bits; int is usually OK. */ typedef int JDIFF; /* Compressed datastreams are represented as arrays of JOCTET. * These must be EXACTLY 8 bits wide, at least once they are written to * external storage. Note that when using the stdio data source/destination * managers, this is also the data type passed to fread/fwrite. */ #ifdef HAVE_UNSIGNED_CHAR typedef unsigned char JOCTET; #define GETJOCTET(value) (value) #else /* not HAVE_UNSIGNED_CHAR */ typedef char JOCTET; #ifdef CHAR_IS_UNSIGNED #define GETJOCTET(value) (value) #else #define GETJOCTET(value) ((value) & 0xFF) #endif /* CHAR_IS_UNSIGNED */ #endif /* HAVE_UNSIGNED_CHAR */ /* These typedefs are used for various table entries and so forth. * They must be at least as wide as specified; but making them too big * won't cost a huge amount of memory, so we don't provide special * extraction code like we did for JSAMPLE. (In other words, these * typedefs live at a different point on the speed/space tradeoff curve.) */ /* UINT8 must hold at least the values 0..255. */ #ifdef HAVE_UNSIGNED_CHAR typedef unsigned char UINT8; #else /* not HAVE_UNSIGNED_CHAR */ #ifdef CHAR_IS_UNSIGNED typedef char UINT8; #else /* not CHAR_IS_UNSIGNED */ typedef short UINT8; #endif /* CHAR_IS_UNSIGNED */ #endif /* HAVE_UNSIGNED_CHAR */ /* UINT16 must hold at least the values 0..65535. */ #ifdef HAVE_UNSIGNED_SHORT typedef unsigned short UINT16; #else /* not HAVE_UNSIGNED_SHORT */ typedef unsigned int UINT16; #endif /* HAVE_UNSIGNED_SHORT */ /* INT16 must hold at least the values -32768..32767. */ #ifndef XMD_H /* X11/xmd.h correctly defines INT16 */ typedef short INT16; #endif /* INT32 must hold at least signed 32-bit values. */ /* X11/xmd.h and basetsd.h correctly defines INT32 */ #if !defined(XMD_H) && !defined(_BASETSD_H_) typedef int INT32; #endif /* Datatype used for image dimensions. The JPEG standard only supports * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore * "unsigned int" is sufficient on all machines. However, if you need to * handle larger images and you don't mind deviating from the spec, you * can change this datatype. */ typedef unsigned int JDIMENSION; #define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */ /* These macros are used in all function definitions and extern declarations. * You could modify them if you need to change function linkage conventions; * in particular, you'll need to do that to make the library a Windows DLL. * Another application is to make all functions global for use with debuggers * or code profilers that require it. */ /* a function called through method pointers: */ #define METHODDEF(type) static type /* a function used only in its module: */ #define LOCAL(type) static type /* a function referenced thru EXTERNs: */ #if defined( _WIN32 ) && defined (JPEGDLL) #define GLOBAL(type) __declspec(dllexport) type #else #define GLOBAL(type) type #endif /* a reference to a GLOBAL function: */ #if defined(_WIN32) && !defined(JPEGSTATIC) #ifdef JPEGDLL /* Win32, building a dll */ #define EXTERN(type) __declspec(dllexport) type #else /* Win32, not building a dll but using the dll */ #define EXTERN(type) __declspec(dllimport) type #endif #else /* not a Win32 system or building a static Win32 lib */ #define EXTERN(type) extern type #endif /* This macro is used to declare a "method", that is, a function pointer. * We want to supply prototype parameters if the compiler can cope. * Note that the arglist parameter must be parenthesized! * Again, you can customize this if you need special linkage keywords. */ #ifdef HAVE_PROTOTYPES #define JMETHOD(type,methodname,arglist) type (*methodname) arglist #else #define JMETHOD(type,methodname,arglist) type (*methodname) () #endif /* Here is the pseudo-keyword for declaring pointers that must be "far" * on 80x86 machines. Most of the specialized coding for 80x86 is handled * by just saying "FAR *" where such a pointer is needed. In a few places * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol. */ #ifndef FAR #ifdef NEED_FAR_POINTERS #define FAR far #else #define FAR #endif #endif /* * On a few systems, type boolean and/or its values FALSE, TRUE may appear * in standard header files. Or you may have conflicts with application- * specific header files that you want to include together with these files. * Defining HAVE_BOOLEAN before including jpeglib.h should make it work. */ #ifndef HAVE_BOOLEAN typedef int boolean; #endif #ifndef FALSE /* in case these macros already exist */ #define FALSE 0 /* values of boolean */ #endif #ifndef TRUE #define TRUE 1 #endif /* * The remaining options affect code selection within the JPEG library, * but they don't need to be visible to most applications using the library. * To minimize application namespace pollution, the symbols won't be * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined. */ #ifdef JPEG_INTERNALS #define JPEG_INTERNAL_OPTIONS #endif #ifdef JPEG_INTERNAL_OPTIONS /* * These defines indicate whether to include various optional functions. * Undefining some of these symbols will produce a smaller but less capable * library. Note that you can leave certain source files out of the * compilation/linking process if you've #undef'd the corresponding symbols. * (You may HAVE to do that if your compiler doesn't like null source files.) */ /* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */ /* Capability options common to encoder and decoder: */ #define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */ #define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */ #define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */ /* Encoder capability options: */ #undef C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ #define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ #define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ #define C_LOSSLESS_SUPPORTED /* Lossless JPEG? */ #define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */ /* Note: if you selected 12-bit data precision, it is dangerous to turn off * ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit * precision, so jcshuff.c normally uses entropy optimization to compute * usable tables for higher precision. If you don't want to do optimization, * you'll have to supply different default Huffman tables. * The exact same statements apply for progressive and lossless JPEG: * the default tables don't work for progressive mode or lossless mode. * (This may get fixed, however.) */ #define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */ /* Decoder capability options: */ #undef D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ #define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ #define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ #define D_LOSSLESS_SUPPORTED /* Lossless JPEG? */ #define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */ #define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */ #define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */ #undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */ #define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */ #define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */ #define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */ /* more capability options later, no doubt */ /* * Ordering of RGB data in scanlines passed to or from the application. * If your application wants to deal with data in the order B,G,R, just * change these macros. You can also deal with formats such as R,G,B,X * (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing * the offsets will also change the order in which colormap data is organized. * RESTRICTIONS: * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats. * 2. These macros only affect RGB<=>YCbCr color conversion, so they are not * useful if you are using JPEG color spaces other than YCbCr or grayscale. * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE * is not 3 (they don't understand about dummy color components!). So you * can't use color quantization if you change that value. */ #define RGB_RED 0 /* Offset of Red in an RGB scanline element */ #define RGB_GREEN 1 /* Offset of Green */ #define RGB_BLUE 2 /* Offset of Blue */ #define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */ /* Definitions for speed-related optimizations. */ /* If your compiler supports inline functions, define INLINE * as the inline keyword; otherwise define it as empty. */ #ifndef INLINE #ifdef __GNUC__ /* for instance, GNU C knows about inline */ #define INLINE __inline__ #endif #ifndef INLINE #define INLINE /* default is to define it as empty */ #endif #endif /* On some machines (notably 68000 series) "int" is 32 bits, but multiplying * two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER * as short on such a machine. MULTIPLIER must be at least 16 bits wide. */ #ifndef MULTIPLIER #define MULTIPLIER int /* type for fastest integer multiply */ #endif /* FAST_FLOAT should be either float or double, whichever is done faster * by your compiler. (Note that this type is only used in the floating point * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.) * Typically, float is faster in ANSI C compilers, while double is faster in * pre-ANSI compilers (because they insist on converting to double anyway). * The code below therefore chooses float if we have ANSI-style prototypes. */ #ifndef FAST_FLOAT #ifdef HAVE_PROTOTYPES #define FAST_FLOAT float #else #define FAST_FLOAT double #endif #endif #endif /* JPEG_INTERNAL_OPTIONS */ #ifdef __cplusplus } #endif // cplusplus ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdcolor.c������������������������������������������������0000644�0001750�0001750�00000032273�12320456500�021627� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdcolor.c * * Copyright (C) 1991-1997, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains output colorspace conversion routines. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" /* Private subobject */ typedef struct { struct jpeg_color_deconverter pub; /* public fields */ /* Private state for YCC->RGB conversion */ int * Cr_r_tab; /* => table for Cr to R conversion */ int * Cb_b_tab; /* => table for Cb to B conversion */ INT32 * Cr_g_tab; /* => table for Cr to G conversion */ INT32 * Cb_g_tab; /* => table for Cb to G conversion */ } my_color_deconverter; typedef my_color_deconverter * my_cconvert_ptr; /**************** YCbCr -> RGB conversion: most common case **************/ /* * YCbCr is defined per CCIR 601-1, except that Cb and Cr are * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5. * The conversion equations to be implemented are therefore * R = Y + 1.40200 * Cr * G = Y - 0.34414 * Cb - 0.71414 * Cr * B = Y + 1.77200 * Cb * where Cb and Cr represent the incoming values less CENTERJSAMPLE. * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.) * * To avoid floating-point arithmetic, we represent the fractional constants * as integers scaled up by 2^16 (about 4 digits precision); we have to divide * the products by 2^16, with appropriate rounding, to get the correct answer. * Notice that Y, being an integral input, does not contribute any fraction * so it need not participate in the rounding. * * For even more speed, we avoid doing any multiplications in the inner loop * by precalculating the constants times Cb and Cr for all possible values. * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table); * for 12-bit samples it is still acceptable. It's not very reasonable for * 16-bit samples, but if you want lossless storage you shouldn't be changing * colorspace anyway. * The Cr=>R and Cb=>B values can be rounded to integers in advance; the * values for the G calculation are left scaled up, since we must add them * together before rounding. */ #define SCALEBITS 16 /* speediest right-shift on some machines */ #define ONE_HALF ((INT32) 1 << (SCALEBITS-1)) #define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5)) /* * Initialize tables for YCC->RGB colorspace conversion. */ LOCAL(void) build_ycc_rgb_table (j_decompress_ptr cinfo) { my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; int i; INT32 x; #if BITS_IN_JSAMPLE == 16 /* no need for temporaries */ #else SHIFT_TEMPS #endif cconvert->Cr_r_tab = (int *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int)); cconvert->Cb_b_tab = (int *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int)); cconvert->Cr_g_tab = (INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(INT32)); cconvert->Cb_g_tab = (INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(INT32)); for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) { /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */ #if BITS_IN_JSAMPLE == 16 /* Bug fix 2001-11-06 by Eichelberg: The integer routines below produce an overflow when used with MAXJSAMPLE == 65535. Use floating point calculation instead. */ /* Cr=>R value is nearest int to 1.40200 * x */ cconvert->Cr_r_tab[i] = (int)(1.40200 * (double)x + 0.5); /* Cb=>B value is nearest int to 1.77200 * x */ cconvert->Cb_b_tab[i] = (int)(1.77200 * (double)x + 0.5); #else /* Cr=>R value is nearest int to 1.40200 * x */ cconvert->Cr_r_tab[i] = (int) RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS); /* Cb=>B value is nearest int to 1.77200 * x */ cconvert->Cb_b_tab[i] = (int) RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS); #endif /* Cr=>G value is scaled-up -0.71414 * x */ cconvert->Cr_g_tab[i] = (- FIX(0.71414)) * x; /* Cb=>G value is scaled-up -0.34414 * x */ /* We also add in ONE_HALF so that need not do it in inner loop */ cconvert->Cb_g_tab[i] = (- FIX(0.34414)) * x + ONE_HALF; } } /* * Convert some rows of samples to the output colorspace. * * Note that we change from noninterleaved, one-plane-per-component format * to interleaved-pixel format. The output buffer is therefore three times * as wide as the input buffer. * A starting row offset is provided only for the input buffer. The caller * can easily adjust the passed output_buf value to accommodate any row * offset required on that side. */ METHODDEF(void) ycc_rgb_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows) { my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; register int y, cb, cr; register JSAMPROW outptr; register JSAMPROW inptr0, inptr1, inptr2; register JDIMENSION col; JDIMENSION num_cols = cinfo->output_width; /* copy these pointers into registers if possible */ register JSAMPLE * range_limit = cinfo->sample_range_limit; register int * Crrtab = cconvert->Cr_r_tab; register int * Cbbtab = cconvert->Cb_b_tab; register INT32 * Crgtab = cconvert->Cr_g_tab; register INT32 * Cbgtab = cconvert->Cb_g_tab; SHIFT_TEMPS while (--num_rows >= 0) { inptr0 = input_buf[0][input_row]; inptr1 = input_buf[1][input_row]; inptr2 = input_buf[2][input_row]; input_row++; outptr = *output_buf++; for (col = 0; col < num_cols; col++) { y = GETJSAMPLE(inptr0[col]); cb = GETJSAMPLE(inptr1[col]); cr = GETJSAMPLE(inptr2[col]); /* Range-limiting is essential due to noise introduced by DCT losses. */ outptr[RGB_RED] = range_limit[y + Crrtab[cr]]; outptr[RGB_GREEN] = range_limit[y + ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS))]; outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]]; outptr += RGB_PIXELSIZE; } } } /**************** Cases other than YCbCr -> RGB **************/ /* * Color conversion for no colorspace change: just copy the data, * converting from separate-planes to interleaved representation. */ METHODDEF(void) null_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows) { register JSAMPROW inptr, outptr; register JDIMENSION count; register int num_components = cinfo->num_components; JDIMENSION num_cols = cinfo->output_width; int ci; while (--num_rows >= 0) { for (ci = 0; ci < num_components; ci++) { inptr = input_buf[ci][input_row]; outptr = output_buf[0] + ci; for (count = num_cols; count > 0; count--) { *outptr = *inptr++; /* needn't bother with GETJSAMPLE() here */ outptr += num_components; } } input_row++; output_buf++; } } /* * Color conversion for grayscale: just copy the data. * This also works for YCbCr -> grayscale conversion, in which * we just copy the Y (luminance) component and ignore chrominance. */ METHODDEF(void) grayscale_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows) { jcopy_sample_rows(input_buf[0], (int) input_row, output_buf, 0, num_rows, cinfo->output_width); } /* * Convert grayscale to RGB: just duplicate the graylevel three times. * This is provided to support applications that don't want to cope * with grayscale as a separate case. */ METHODDEF(void) gray_rgb_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows) { register JSAMPROW inptr, outptr; register JDIMENSION col; JDIMENSION num_cols = cinfo->output_width; while (--num_rows >= 0) { inptr = input_buf[0][input_row++]; outptr = *output_buf++; for (col = 0; col < num_cols; col++) { /* We can dispense with GETJSAMPLE() here */ outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col]; outptr += RGB_PIXELSIZE; } } } /* * Adobe-style YCCK->CMYK conversion. * We convert YCbCr to R=1-C, G=1-M, and B=1-Y using the same * conversion as above, while passing K (black) unchanged. * We assume build_ycc_rgb_table has been called. */ METHODDEF(void) ycck_cmyk_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows) { my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; register int y, cb, cr; register JSAMPROW outptr; register JSAMPROW inptr0, inptr1, inptr2, inptr3; register JDIMENSION col; JDIMENSION num_cols = cinfo->output_width; /* copy these pointers into registers if possible */ register JSAMPLE * range_limit = cinfo->sample_range_limit; register int * Crrtab = cconvert->Cr_r_tab; register int * Cbbtab = cconvert->Cb_b_tab; register INT32 * Crgtab = cconvert->Cr_g_tab; register INT32 * Cbgtab = cconvert->Cb_g_tab; SHIFT_TEMPS while (--num_rows >= 0) { inptr0 = input_buf[0][input_row]; inptr1 = input_buf[1][input_row]; inptr2 = input_buf[2][input_row]; inptr3 = input_buf[3][input_row]; input_row++; outptr = *output_buf++; for (col = 0; col < num_cols; col++) { y = GETJSAMPLE(inptr0[col]); cb = GETJSAMPLE(inptr1[col]); cr = GETJSAMPLE(inptr2[col]); /* Range-limiting is essential due to noise introduced by DCT losses. */ outptr[0] = range_limit[MAXJSAMPLE - (y + Crrtab[cr])]; /* red */ outptr[1] = range_limit[MAXJSAMPLE - (y + /* green */ ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS)))]; outptr[2] = range_limit[MAXJSAMPLE - (y + Cbbtab[cb])]; /* blue */ /* K passes through unchanged */ outptr[3] = inptr3[col]; /* don't need GETJSAMPLE here */ outptr += 4; } } } /* * Empty method for start_pass. */ METHODDEF(void) start_pass_dcolor (j_decompress_ptr cinfo) { (void)cinfo; /* no work needed */ } /* * Module initialization routine for output colorspace conversion. */ GLOBAL(void) jinit_color_deconverter (j_decompress_ptr cinfo) { my_cconvert_ptr cconvert; int ci; cconvert = (my_cconvert_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_color_deconverter)); cinfo->cconvert = (struct jpeg_color_deconverter *) cconvert; cconvert->pub.start_pass = start_pass_dcolor; /* Make sure num_components agrees with jpeg_color_space */ switch (cinfo->jpeg_color_space) { case JCS_GRAYSCALE: if (cinfo->num_components != 1) ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); break; case JCS_RGB: case JCS_YCbCr: if (cinfo->num_components != 3) ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); break; case JCS_CMYK: case JCS_YCCK: if (cinfo->num_components != 4) ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); break; default: /* JCS_UNKNOWN can be anything */ if (cinfo->num_components < 1) ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); break; } /* Set out_color_components and conversion method based on requested space. * Also clear the component_needed flags for any unused components, * so that earlier pipeline stages can avoid useless computation. */ switch (cinfo->out_color_space) { case JCS_GRAYSCALE: cinfo->out_color_components = 1; if (cinfo->jpeg_color_space == JCS_GRAYSCALE || cinfo->jpeg_color_space == JCS_YCbCr) { cconvert->pub.color_convert = grayscale_convert; /* For color->grayscale conversion, only the Y (0) component is needed */ for (ci = 1; ci < cinfo->num_components; ci++) cinfo->comp_info[ci].component_needed = FALSE; } else ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); break; case JCS_RGB: cinfo->out_color_components = RGB_PIXELSIZE; if (cinfo->jpeg_color_space == JCS_YCbCr) { cconvert->pub.color_convert = ycc_rgb_convert; build_ycc_rgb_table(cinfo); } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) { cconvert->pub.color_convert = gray_rgb_convert; } else if (cinfo->jpeg_color_space == JCS_RGB && RGB_PIXELSIZE == 3) { cconvert->pub.color_convert = null_convert; } else ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); break; case JCS_CMYK: cinfo->out_color_components = 4; if (cinfo->jpeg_color_space == JCS_YCCK) { cconvert->pub.color_convert = ycck_cmyk_convert; build_ycc_rgb_table(cinfo); } else if (cinfo->jpeg_color_space == JCS_CMYK) { cconvert->pub.color_convert = null_convert; } else ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); break; default: /* Permit null conversion to same output space */ if (cinfo->out_color_space == cinfo->jpeg_color_space) { cinfo->out_color_components = cinfo->num_components; cconvert->pub.color_convert = null_convert; } else /* unsupported non-null conversion */ ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); break; } if (cinfo->quantize_colors) cinfo->output_components = 1; /* single colormapped output component */ else cinfo->output_components = cinfo->out_color_components; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jpegint.h������������������������������������������������0000644�0001750�0001750�00000035153�12320456500�021640� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jpegint.h * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file provides common declarations for the various JPEG modules. * These declarations are considered internal to the JPEG library; most * applications using the library shouldn't need to include this file. */ #ifdef __cplusplus extern "C" { #endif // cplusplus /* Declarations for both compression & decompression */ typedef enum { /* Operating modes for buffer controllers */ JBUF_PASS_THRU, /* Plain stripwise operation */ /* Remaining modes require a full-image buffer to have been created */ JBUF_SAVE_SOURCE, /* Run source subobject only, save output */ JBUF_CRANK_DEST, /* Run dest subobject only, using saved data */ JBUF_SAVE_AND_PASS /* Run both subobjects, save output */ } J_BUF_MODE; /* Values of global_state field (jdapi.c has some dependencies on ordering!) */ #define CSTATE_START 100 /* after create_compress */ #define CSTATE_SCANNING 101 /* start_compress done, write_scanlines OK */ #define CSTATE_RAW_OK 102 /* start_compress done, write_raw_data OK */ #define CSTATE_WRCOEFS 103 /* jpeg_write_coefficients done */ #define DSTATE_START 200 /* after create_decompress */ #define DSTATE_INHEADER 201 /* reading header markers, no SOS yet */ #define DSTATE_READY 202 /* found SOS, ready for start_decompress */ #define DSTATE_PRELOAD 203 /* reading multiscan file in start_decompress*/ #define DSTATE_PRESCAN 204 /* performing dummy pass for 2-pass quant */ #define DSTATE_SCANNING 205 /* start_decompress done, read_scanlines OK */ #define DSTATE_RAW_OK 206 /* start_decompress done, read_raw_data OK */ #define DSTATE_BUFIMAGE 207 /* expecting jpeg_start_output */ #define DSTATE_BUFPOST 208 /* looking for SOS/EOI in jpeg_finish_output */ #define DSTATE_RDCOEFS 209 /* reading file in jpeg_read_coefficients */ #define DSTATE_STOPPING 210 /* looking for EOI in jpeg_finish_decompress */ /* Declarations for compression modules */ /* Master control module */ struct jpeg_comp_master { JMETHOD(void, prepare_for_pass, (j_compress_ptr cinfo)); JMETHOD(void, pass_startup, (j_compress_ptr cinfo)); JMETHOD(void, finish_pass, (j_compress_ptr cinfo)); /* State variables made visible to other modules */ boolean call_pass_startup; /* True if pass_startup must be called */ boolean is_last_pass; /* True during last pass */ }; /* Main buffer control (downsampled-data buffer) */ struct jpeg_c_main_controller { JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); JMETHOD(void, process_data, (j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail)); }; /* Compression preprocessing (downsampling input buffer control) */ struct jpeg_c_prep_controller { JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); JMETHOD(void, pre_process_data, (j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail, JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr, JDIMENSION out_row_groups_avail)); }; /* Compression codec (compressor proper) */ struct jpeg_c_codec { JMETHOD(void, entropy_start_pass, (j_compress_ptr cinfo, boolean gather_statistics)); JMETHOD(void, entropy_finish_pass, (j_compress_ptr cinfo)); JMETHOD(boolean, need_optimization_pass, (j_compress_ptr cinfo)); JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); JMETHOD(boolean, compress_data, (j_compress_ptr cinfo, JSAMPIMAGE input_buf)); }; /* Colorspace conversion */ struct jpeg_color_converter { JMETHOD(void, start_pass, (j_compress_ptr cinfo)); JMETHOD(void, color_convert, (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)); }; /* Downsampling */ struct jpeg_downsampler { JMETHOD(void, start_pass, (j_compress_ptr cinfo)); JMETHOD(void, downsample, (j_compress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_index, JSAMPIMAGE output_buf, JDIMENSION out_row_group_index)); boolean need_context_rows; /* TRUE if need rows above & below */ }; /* Marker writing */ struct jpeg_marker_writer { JMETHOD(void, write_file_header, (j_compress_ptr cinfo)); JMETHOD(void, write_frame_header, (j_compress_ptr cinfo)); JMETHOD(void, write_scan_header, (j_compress_ptr cinfo)); JMETHOD(void, write_file_trailer, (j_compress_ptr cinfo)); JMETHOD(void, write_tables_only, (j_compress_ptr cinfo)); /* These routines are exported to allow insertion of extra markers */ /* Probably only COM and APPn markers should be written this way */ JMETHOD(void, write_marker_header, (j_compress_ptr cinfo, int marker, unsigned int datalen)); JMETHOD(void, write_marker_byte, (j_compress_ptr cinfo, int val)); }; /* Declarations for decompression modules */ /* Master control module */ struct jpeg_decomp_master { JMETHOD(void, prepare_for_output_pass, (j_decompress_ptr cinfo)); JMETHOD(void, finish_output_pass, (j_decompress_ptr cinfo)); /* State variables made visible to other modules */ boolean is_dummy_pass; /* True during 1st pass for 2-pass quant */ }; /* Input control module */ struct jpeg_input_controller { JMETHOD(int, consume_input, (j_decompress_ptr cinfo)); JMETHOD(void, reset_input_controller, (j_decompress_ptr cinfo)); JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo)); JMETHOD(void, finish_input_pass, (j_decompress_ptr cinfo)); /* State variables made visible to other modules */ boolean has_multiple_scans; /* True if file has multiple scans */ boolean eoi_reached; /* True when EOI has been consumed */ }; /* Main buffer control (downsampled-data buffer) */ struct jpeg_d_main_controller { JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)); JMETHOD(void, process_data, (j_decompress_ptr cinfo, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); }; /* Decompression codec (decompressor proper) */ struct jpeg_d_codec { JMETHOD(void, calc_output_dimensions, (j_decompress_ptr cinfo)); JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo)); JMETHOD(int, consume_data, (j_decompress_ptr cinfo)); JMETHOD(void, start_output_pass, (j_decompress_ptr cinfo)); JMETHOD(int, decompress_data, (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); }; /* Decompression postprocessing (color quantization buffer control) */ struct jpeg_d_post_controller { JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)); JMETHOD(void, post_process_data, (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); }; /* Marker reading & parsing */ struct jpeg_marker_reader { JMETHOD(void, reset_marker_reader, (j_decompress_ptr cinfo)); /* Read markers until SOS or EOI. * Returns same codes as are defined for jpeg_consume_input: * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI. */ JMETHOD(int, read_markers, (j_decompress_ptr cinfo)); /* Read a restart marker --- exported for use by entropy decoder only */ jpeg_marker_parser_method read_restart_marker; /* State of marker reader --- nominally internal, but applications * supplying COM or APPn handlers might like to know the state. */ boolean saw_SOI; /* found SOI? */ boolean saw_SOF; /* found SOF? */ int next_restart_num; /* next restart number expected (0-7) */ unsigned int discarded_bytes; /* # of bytes skipped looking for a marker */ }; /* Upsampling (note that upsampler must also call color converter) */ struct jpeg_upsampler { JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); JMETHOD(void, upsample, (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); boolean need_context_rows; /* TRUE if need rows above & below */ }; /* Colorspace conversion */ struct jpeg_color_deconverter { JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); JMETHOD(void, color_convert, (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)); }; /* Color quantization or color precision reduction */ struct jpeg_color_quantizer { JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan)); JMETHOD(void, color_quantize, (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)); JMETHOD(void, finish_pass, (j_decompress_ptr cinfo)); JMETHOD(void, new_color_map, (j_decompress_ptr cinfo)); }; /* Miscellaneous useful macros */ #undef MAX #define MAX(a,b) ((a) > (b) ? (a) : (b)) #undef MIN #define MIN(a,b) ((a) < (b) ? (a) : (b)) /* We assume that right shift corresponds to signed division by 2 with * rounding towards minus infinity. This is correct for typical "arithmetic * shift" instructions that shift in copies of the sign bit. But some * C compilers implement >> with an unsigned shift. For these machines you * must define RIGHT_SHIFT_IS_UNSIGNED. * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity. * It is only applied with constant shift counts. SHIFT_TEMPS must be * included in the variables of any routine using RIGHT_SHIFT. */ #ifdef RIGHT_SHIFT_IS_UNSIGNED #define SHIFT_TEMPS INT32 shift_temp; #define RIGHT_SHIFT(x,shft) \ ((shift_temp = (x)) < 0 ? \ (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \ (shift_temp >> (shft))) #else #define SHIFT_TEMPS #define RIGHT_SHIFT(x,shft) ((x) >> (shft)) #endif /* Short forms of external names for systems with brain-damaged linkers. */ #ifdef NEED_SHORT_EXTERNAL_NAMES #define jinit_c_codec jICCodec #define jinit_c_diff_controller jICDiffC #define jinit_lossy_c_codec jILossyC #define jinit_lossless_c_codec jILosslessC #define jinit_compress_master jICompress #define jinit_c_master_control jICMaster #define jinit_c_main_controller jICMainC #define jinit_c_prep_controller jICPrepC #define jinit_c_coef_controller jICCoefC #define jinit_color_converter jICColor #define jinit_downsampler jIDownsampler #define jinit_forward_dct jIFDCT #define jinit_shuff_encoder jISHEncoder #define jinit_phuff_encoder jIPHEncoder #define jinit_arith_encoder jIAEncoder #define jinit_marker_writer jIMWriter #define jinit_d_codec jIDCodec #define jinit_lossy_d_codec jILossyD #define jinit_lossless_d_codec jILosslsD #define jinit_master_decompress jIDMaster #define jinit_d_main_controller jIDMainC #define jinit_d_coef_controller jIDCoefC #define jinit_d_diff_controller jIDDiffC #define jinit_d_post_controller jIDPostC #define jinit_input_controller jIInCtlr #define jinit_marker_reader jIMReader #define jinit_shuff_decoder jISHDecoder #define jinit_phuff_decoder jIPHDecoder #define jinit_arith_decoder jIADecoder #define jinit_lhuff_decoder jILHDecoder #define jinit_undifferencer jIUndiff #define jinit_d_scaler jIDScaler #define jinit_inverse_dct jIIDCT #define jinit_upsampler jIUpsampler #define jinit_color_deconverter jIDColor #define jinit_1pass_quantizer jI1Quant #define jinit_2pass_quantizer jI2Quant #define jinit_merged_upsampler jIMUpsampler #define jinit_memory_mgr jIMemMgr #define jdiv_round_up jDivRound #define jround_up jRound #define jcopy_sample_rows jCopySamples #define jcopy_block_row jCopyBlocks #define jzero_far jZeroFar #define jpeg_zigzag_order jZIGTable #define jpeg_natural_order jZAGTable #endif /* NEED_SHORT_EXTERNAL_NAMES */ /* Compression module initialization routines */ EXTERN(void) jinit_c_codec JPP((j_compress_ptr cinfo)); EXTERN(void) jinit_c_diff_controller JPP((j_compress_ptr cinfo, boolean need_full_buffer)); EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo)); EXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo, boolean transcode_only)); EXTERN(void) jinit_c_main_controller JPP((j_compress_ptr cinfo, boolean need_full_buffer)); EXTERN(void) jinit_c_prep_controller JPP((j_compress_ptr cinfo, boolean need_full_buffer)); EXTERN(void) jinit_compressor JPP((j_compress_ptr cinfo)); EXTERN(void) jinit_color_converter JPP((j_compress_ptr cinfo)); EXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo)); EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo)); EXTERN(void) jinit_arith_encoder JPP((j_compress_ptr cinfo)); /* Decompression module initialization routines */ EXTERN(void) jinit_d_codec JPP((j_decompress_ptr cinfo)); EXTERN(void) jinit_d_diff_controller JPP((j_decompress_ptr cinfo, boolean need_full_buffer)); EXTERN(void) jinit_master_decompress JPP((j_decompress_ptr cinfo)); EXTERN(void) jinit_d_main_controller JPP((j_decompress_ptr cinfo, boolean need_full_buffer)); EXTERN(void) jinit_decompressor JPP((j_decompress_ptr cinfo)); EXTERN(void) jinit_d_post_controller JPP((j_decompress_ptr cinfo, boolean need_full_buffer)); EXTERN(void) jinit_input_controller JPP((j_decompress_ptr cinfo)); EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo)); EXTERN(void) jinit_arith_decoder JPP((j_decompress_ptr cinfo)); EXTERN(void) jinit_upsampler JPP((j_decompress_ptr cinfo)); EXTERN(void) jinit_color_deconverter JPP((j_decompress_ptr cinfo)); EXTERN(void) jinit_1pass_quantizer JPP((j_decompress_ptr cinfo)); EXTERN(void) jinit_2pass_quantizer JPP((j_decompress_ptr cinfo)); EXTERN(void) jinit_merged_upsampler JPP((j_decompress_ptr cinfo)); /* Memory manager initialization */ EXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo)); /* Utility routines in jutils.c */ EXTERN(long) jdiv_round_up JPP((long a, long b)); EXTERN(long) jround_up JPP((long a, long b)); EXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row, JSAMPARRAY output_array, int dest_row, int num_rows, JDIMENSION num_cols)); EXTERN(void) jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row, JDIMENSION num_blocks)); EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero)); /* Constant tables in jutils.c */ #if 0 /* This table is not actually needed in v6a */ extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */ #endif extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */ /* Suppress undefined-structure complaints if necessary. */ #ifdef INCOMPLETE_TYPES_BROKEN #ifndef AM_MEMORY_MANAGER /* only jmemmgr.c defines these */ struct jvirt_sarray_control { long dummy; }; struct jvirt_barray_control { long dummy; }; #endif #endif /* INCOMPLETE_TYPES_BROKEN */ #ifdef __cplusplus } #endif // cplusplus ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jcomapi.c������������������������������������������������0000644�0001750�0001750�00000006046�12320456500�021614� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jcomapi.c * * Copyright (C) 1994-1997, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains application interface routines that are used for both * compression and decompression. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" /* * Abort processing of a JPEG compression or decompression operation, * but don't destroy the object itself. * * For this, we merely clean up all the nonpermanent memory pools. * Note that temp files (virtual arrays) are not allowed to belong to * the permanent pool, so we will be able to close all temp files here. * Closing a data source or destination, if necessary, is the application's * responsibility. */ GLOBAL(void) jpeg_abort (j_common_ptr cinfo) { int pool; /* Do nothing if called on a not-initialized or destroyed JPEG object. */ if (cinfo->mem == NULL) return; /* Releasing pools in reverse order might help avoid fragmentation * with some (brain-damaged) malloc libraries. */ for (pool = JPOOL_NUMPOOLS-1; pool > JPOOL_PERMANENT; pool--) { (*cinfo->mem->free_pool) (cinfo, pool); } /* Reset overall state for possible reuse of object */ if (cinfo->is_decompressor) { cinfo->global_state = DSTATE_START; /* Try to keep application from accessing now-deleted marker list. * A bit kludgy to do it here, but this is the most central place. */ ((j_decompress_ptr) cinfo)->marker_list = NULL; } else { cinfo->global_state = CSTATE_START; } } /* * Destruction of a JPEG object. * * Everything gets deallocated except the master jpeg_compress_struct itself * and the error manager struct. Both of these are supplied by the application * and must be freed, if necessary, by the application. (Often they are on * the stack and so don't need to be freed anyway.) * Closing a data source or destination, if necessary, is the application's * responsibility. */ GLOBAL(void) jpeg_destroy (j_common_ptr cinfo) { /* We need only tell the memory manager to release everything. */ /* NB: mem pointer is NULL if memory mgr failed to initialize. */ if (cinfo->mem != NULL) (*cinfo->mem->self_destruct) (cinfo); cinfo->mem = NULL; /* be safe if jpeg_destroy is called twice */ cinfo->global_state = 0; /* mark it destroyed */ } /* * Convenience routines for allocating quantization and Huffman tables. * (Would jutils.c be a more reasonable place to put these?) */ GLOBAL(JQUANT_TBL *) jpeg_alloc_quant_table (j_common_ptr cinfo) { JQUANT_TBL *tbl; tbl = (JQUANT_TBL *) (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JQUANT_TBL)); tbl->sent_table = FALSE; /* make sure this is false in any new table */ return tbl; } GLOBAL(JHUFF_TBL *) jpeg_alloc_huff_table (j_common_ptr cinfo) { JHUFF_TBL *tbl; tbl = (JHUFF_TBL *) (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JHUFF_TBL)); tbl->sent_table = FALSE; /* make sure this is false in any new table */ return tbl; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jddiffct.c�����������������������������������������������0000644�0001750�0001750�00000031453�12320456500�021747� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jddiffct.c * * Copyright (C) 1994-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains the [un]difference buffer controller for decompression. * This controller is the top level of the lossless JPEG decompressor proper. * The difference buffer lies between the entropy decoding and * prediction/undifferencing steps. The undifference buffer lies between the * prediction/undifferencing and scaling steps. * * In buffered-image mode, this controller is the interface between * input-oriented processing and output-oriented processing. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossls.h" #ifdef D_LOSSLESS_SUPPORTED /* Private buffer controller object */ typedef struct { /* These variables keep track of the current location of the input side. */ /* cinfo->input_iMCU_row is also used for this. */ JDIMENSION MCU_ctr; /* counts MCUs processed in current row */ unsigned int restart_rows_to_go; /* MCU-rows left in this restart interval */ unsigned int MCU_vert_offset; /* counts MCU rows within iMCU row */ unsigned int MCU_rows_per_iMCU_row; /* number of such rows needed */ /* The output side's location is represented by cinfo->output_iMCU_row. */ JDIFFARRAY diff_buf[MAX_COMPONENTS]; /* iMCU row of differences */ JDIFFARRAY undiff_buf[MAX_COMPONENTS]; /* iMCU row of undiff'd samples */ #ifdef D_MULTISCAN_FILES_SUPPORTED /* In multi-pass modes, we need a virtual sample array for each component. */ jvirt_sarray_ptr whole_image[MAX_COMPONENTS]; #endif } d_diff_controller; typedef d_diff_controller * d_diff_ptr; /* Forward declarations */ METHODDEF(int) decompress_data JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); #ifdef D_MULTISCAN_FILES_SUPPORTED METHODDEF(int) output_data JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); #endif LOCAL(void) start_iMCU_row (j_decompress_ptr cinfo) /* Reset within-iMCU-row counters for a new row (input side) */ { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; d_diff_ptr diff = (d_diff_ptr) losslsd->diff_private; /* In an interleaved scan, an MCU row is the same as an iMCU row. * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows. * But at the bottom of the image, process only what's left. */ if (cinfo->comps_in_scan > 1) { diff->MCU_rows_per_iMCU_row = 1; } else { if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1)) diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor; else diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height; } diff->MCU_ctr = 0; diff->MCU_vert_offset = 0; } /* * Initialize for an input processing pass. */ METHODDEF(void) start_input_pass (j_decompress_ptr cinfo) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; d_diff_ptr diff = (d_diff_ptr) losslsd->diff_private; /* Check that the restart interval is an integer multiple of the number * of MCU in an MCU-row. */ if (cinfo->restart_interval % cinfo->MCUs_per_row != 0) ERREXIT2(cinfo, JERR_BAD_RESTART, cinfo->restart_interval, cinfo->MCUs_per_row); /* Initialize restart counter */ diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row; cinfo->input_iMCU_row = 0; start_iMCU_row(cinfo); } /* * Check for a restart marker & resynchronize decoder, undifferencer. * Returns FALSE if must suspend. */ METHODDEF(boolean) process_restart (j_decompress_ptr cinfo) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; d_diff_ptr diff = (d_diff_ptr) losslsd->diff_private; if (! (*losslsd->entropy_process_restart) (cinfo)) return FALSE; (*losslsd->predict_process_restart) (cinfo); /* Reset restart counter */ diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row; return TRUE; } /* * Initialize for an output processing pass. */ METHODDEF(void) start_output_pass (j_decompress_ptr cinfo) { cinfo->output_iMCU_row = 0; } /* * Decompress and return some data in the supplied buffer. * Always attempts to emit one fully interleaved MCU row ("iMCU" row). * Input and output must run in lockstep since we have only a one-MCU buffer. * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. * * NB: output_buf contains a plane for each component in image, * which we index according to the component's SOF position. */ METHODDEF(int) decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; d_diff_ptr diff = (d_diff_ptr) losslsd->diff_private; JDIMENSION MCU_col_num; /* index of current MCU within row */ JDIMENSION MCU_count; /* number of MCUs decoded */ JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; int comp, ci, row, prev_row; unsigned int yoffset; jpeg_component_info *compptr; /* Loop to process as much as one whole iMCU row */ for (yoffset = diff->MCU_vert_offset; yoffset < diff->MCU_rows_per_iMCU_row; yoffset++) { /* Process restart marker if needed; may have to suspend */ if (cinfo->restart_interval) { if (diff->restart_rows_to_go == 0) if (! process_restart(cinfo)) return JPEG_SUSPENDED; } MCU_col_num = diff->MCU_ctr; /* Try to fetch an MCU-row (or remaining portion of suspended MCU-row). */ MCU_count = (*losslsd->entropy_decode_mcus) (cinfo, diff->diff_buf, yoffset, MCU_col_num, cinfo->MCUs_per_row - MCU_col_num); if (MCU_count != cinfo->MCUs_per_row - MCU_col_num) { /* Suspension forced; update state counters and exit */ diff->MCU_vert_offset = yoffset; diff->MCU_ctr += MCU_count; return JPEG_SUSPENDED; } /* Account for restart interval (no-op if not using restarts) */ diff->restart_rows_to_go--; /* Completed an MCU row, but perhaps not an iMCU row */ diff->MCU_ctr = 0; } /* * Undifference and scale each scanline of the disassembled MCU-row * separately. We do not process dummy samples at the end of a scanline * or dummy rows at the end of the image. */ for (comp = 0; comp < cinfo->comps_in_scan; comp++) { compptr = cinfo->cur_comp_info[comp]; ci = compptr->component_index; for (row = 0, prev_row = compptr->v_samp_factor - 1; row < (cinfo->input_iMCU_row == last_iMCU_row ? compptr->last_row_height : compptr->v_samp_factor); prev_row = row, row++) { (*losslsd->predict_undifference[ci]) (cinfo, ci, diff->diff_buf[ci][row], diff->undiff_buf[ci][prev_row], diff->undiff_buf[ci][row], compptr->width_in_data_units); (*losslsd->scaler_scale) (cinfo, diff->undiff_buf[ci][row], output_buf[ci][row], compptr->width_in_data_units); } } /* Completed the iMCU row, advance counters for next one. * * NB: output_data will increment output_iMCU_row. * This counter is not needed for the single-pass case * or the input side of the multi-pass case. */ if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) { start_iMCU_row(cinfo); return JPEG_ROW_COMPLETED; } /* Completed the scan */ (*cinfo->inputctl->finish_input_pass) (cinfo); return JPEG_SCAN_COMPLETED; } /* * Dummy consume-input routine for single-pass operation. */ METHODDEF(int) dummy_consume_data (j_decompress_ptr cinfo) { (void)cinfo; return JPEG_SUSPENDED; /* Always indicate nothing was done */ } #ifdef D_MULTISCAN_FILES_SUPPORTED /* * Consume input data and store it in the full-image sample buffer. * We read as much as one fully interleaved MCU row ("iMCU" row) per call, * ie, v_samp_factor rows for each component in the scan. * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. */ METHODDEF(int) consume_data (j_decompress_ptr cinfo) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; d_diff_ptr diff = (d_diff_ptr) losslsd->diff_private; /* JDIMENSION MCU_col_num; */ /* index of current MCU within row */ /* JDIMENSION MCU_count; */ /* number of MCUs decoded */ /* JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; */ int comp, ci /* , yoffset, row, prev_row */; JSAMPARRAY buffer[MAX_COMPS_IN_SCAN]; jpeg_component_info *compptr; /* Align the virtual buffers for the components used in this scan. */ for (comp = 0; comp < cinfo->comps_in_scan; comp++) { compptr = cinfo->cur_comp_info[comp]; ci = compptr->component_index; buffer[ci] = (*cinfo->mem->access_virt_sarray) ((j_common_ptr) cinfo, diff->whole_image[ci], cinfo->input_iMCU_row * compptr->v_samp_factor, (JDIMENSION) compptr->v_samp_factor, TRUE); } return decompress_data(cinfo, buffer); } /* * Output some data from the full-image buffer sample in the multi-pass case. * Always attempts to emit one fully interleaved MCU row ("iMCU" row). * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. * * NB: output_buf contains a plane for each component in image. */ METHODDEF(int) output_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; d_diff_ptr diff = (d_diff_ptr) losslsd->diff_private; JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; int ci, samp_rows, row; JSAMPARRAY buffer; jpeg_component_info *compptr; /* Force some input to be done if we are getting ahead of the input. */ while (cinfo->input_scan_number < cinfo->output_scan_number || (cinfo->input_scan_number == cinfo->output_scan_number && cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) { if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED) return JPEG_SUSPENDED; } /* OK, output from the virtual arrays. */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { /* Align the virtual buffer for this component. */ buffer = (*cinfo->mem->access_virt_sarray) ((j_common_ptr) cinfo, diff->whole_image[ci], cinfo->output_iMCU_row * compptr->v_samp_factor, (JDIMENSION) compptr->v_samp_factor, FALSE); if (cinfo->output_iMCU_row < last_iMCU_row) samp_rows = compptr->v_samp_factor; else { /* NB: can't use last_row_height here; it is input-side-dependent! */ samp_rows = (int) (compptr->height_in_data_units % compptr->v_samp_factor); if (samp_rows == 0) samp_rows = compptr->v_samp_factor; } for (row = 0; row < samp_rows; row++) { MEMCOPY(output_buf[ci][row], buffer[row], compptr->width_in_data_units * SIZEOF(JSAMPLE)); } } if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows) return JPEG_ROW_COMPLETED; return JPEG_SCAN_COMPLETED; } #endif /* D_MULTISCAN_FILES_SUPPORTED */ /* * Initialize difference buffer controller. */ GLOBAL(void) jinit_d_diff_controller (j_decompress_ptr cinfo, boolean need_full_buffer) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; d_diff_ptr diff; int ci; jpeg_component_info *compptr; diff = (d_diff_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(d_diff_controller)); losslsd->diff_private = (void *) diff; losslsd->diff_start_input_pass = start_input_pass; losslsd->pub.start_output_pass = start_output_pass; /* Create the [un]difference buffers. */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { diff->diff_buf[ci] = (*cinfo->mem->alloc_darray) ((j_common_ptr) cinfo, JPOOL_IMAGE, (JDIMENSION) jround_up((long) compptr->width_in_data_units, (long) compptr->h_samp_factor), (JDIMENSION) compptr->v_samp_factor); diff->undiff_buf[ci] = (*cinfo->mem->alloc_darray) ((j_common_ptr) cinfo, JPOOL_IMAGE, (JDIMENSION) jround_up((long) compptr->width_in_data_units, (long) compptr->h_samp_factor), (JDIMENSION) compptr->v_samp_factor); } if (need_full_buffer) { #ifdef D_MULTISCAN_FILES_SUPPORTED /* Allocate a full-image virtual array for each component. */ int access_rows; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { access_rows = compptr->v_samp_factor; diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, (JDIMENSION) jround_up((long) compptr->width_in_data_units, (long) compptr->h_samp_factor), (JDIMENSION) jround_up((long) compptr->height_in_data_units, (long) compptr->v_samp_factor), (JDIMENSION) access_rows); } losslsd->pub.consume_data = consume_data; losslsd->pub.decompress_data = output_data; #else ERREXIT(cinfo, JERR_NOT_COMPILED); #endif } else { losslsd->pub.consume_data = dummy_consume_data; losslsd->pub.decompress_data = decompress_data; diff->whole_image[0] = NULL; /* flag for no virtual arrays */ } } #endif /* D_LOSSLESS_SUPPORTED */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jcsample.c�����������������������������������������������0000644�0001750�0001750�00000045010�12320456500�021762� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jcsample.c * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains downsampling routines. * * Downsampling input data is counted in "row groups". A row group * is defined to be max_v_samp_factor pixel rows of each component, * from which the downsampler produces v_samp_factor sample rows. * A single row group is processed in each call to the downsampler module. * * The downsampler is responsible for edge-expansion of its output data * to fill an integral number of DCT blocks horizontally. The source buffer * may be modified if it is helpful for this purpose (the source buffer is * allocated wide enough to correspond to the desired output width). * The caller (the prep controller) is responsible for vertical padding. * * The downsampler may request "context rows" by setting need_context_rows * during startup. In this case, the input arrays will contain at least * one row group's worth of pixels above and below the passed-in data; * the caller will create dummy rows at image top and bottom by replicating * the first or last real pixel row. * * An excellent reference for image resampling is * Digital Image Warping, George Wolberg, 1990. * Pub. by IEEE Computer Society Press, Los Alamitos, CA. ISBN 0-8186-8944-7. * * The downsampling algorithm used here is a simple average of the source * pixels covered by the output pixel. The hi-falutin sampling literature * refers to this as a "box filter". In general the characteristics of a box * filter are not very good, but for the specific cases we normally use (1:1 * and 2:1 ratios) the box is equivalent to a "triangle filter" which is not * nearly so bad. If you intend to use other sampling ratios, you'd be well * advised to improve this code. * * A simple input-smoothing capability is provided. This is mainly intended * for cleaning up color-dithered GIF input files (if you find it inadequate, * we suggest using an external filtering program such as pnmconvol). When * enabled, each input pixel P is replaced by a weighted sum of itself and its * eight neighbors. P's weight is 1-8*SF and each neighbor's weight is SF, * where SF = (smoothing_factor / 1024). * Currently, smoothing is only supported for 2h2v sampling factors. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" /* Pointer to routine to downsample a single component */ typedef JMETHOD(void, downsample1_ptr, (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)); /* Private subobject */ typedef struct { struct jpeg_downsampler pub; /* public fields */ /* Downsampling method pointers, one per component */ downsample1_ptr methods[MAX_COMPONENTS]; } my_downsampler; typedef my_downsampler * my_downsample_ptr; /* * Initialize for a downsampling pass. */ METHODDEF(void) start_pass_downsample (j_compress_ptr cinfo) { (void)cinfo; /* no work for now */ } /* * Expand a component horizontally from width input_cols to width output_cols, * by duplicating the rightmost samples. */ LOCAL(void) expand_right_edge (JSAMPARRAY image_data, int num_rows, JDIMENSION input_cols, JDIMENSION output_cols) { register JSAMPROW ptr; register JSAMPLE pixval; register int count; int row; int numcols = (int) (output_cols - input_cols); if (numcols > 0) { for (row = 0; row < num_rows; row++) { ptr = image_data[row] + input_cols; pixval = ptr[-1]; /* don't need GETJSAMPLE() here */ for (count = numcols; count > 0; count--) *ptr++ = pixval; } } } /* * Do downsampling for a whole row group (all components). * * In this version we simply downsample each component independently. */ METHODDEF(void) sep_downsample (j_compress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_index, JSAMPIMAGE output_buf, JDIMENSION out_row_group_index) { my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample; int ci; jpeg_component_info * compptr; JSAMPARRAY in_ptr, out_ptr; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { in_ptr = input_buf[ci] + in_row_index; out_ptr = output_buf[ci] + (out_row_group_index * compptr->v_samp_factor); (*downsample->methods[ci]) (cinfo, compptr, in_ptr, out_ptr); } } /* * Downsample pixel values of a single component. * One row group is processed per call. * This version handles arbitrary integral sampling ratios, without smoothing. * Note that this version is not actually used for customary sampling ratios. */ METHODDEF(void) int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v; JDIMENSION outcol, outcol_h; /* outcol_h == outcol*h_expand */ JDIMENSION output_cols = compptr->width_in_data_units * cinfo->data_unit; JSAMPROW inptr, outptr; INT32 outvalue; h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor; v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor; numpix = h_expand * v_expand; numpix2 = numpix/2; /* Expand input data enough to let all the output samples be generated * by the standard loop. Special-casing padded output would be more * efficient. */ expand_right_edge(input_data, cinfo->max_v_samp_factor, cinfo->image_width, output_cols * h_expand); inrow = 0; for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { outptr = output_data[outrow]; for (outcol = 0, outcol_h = 0; outcol < output_cols; outcol++, outcol_h += h_expand) { outvalue = 0; for (v = 0; v < v_expand; v++) { inptr = input_data[inrow+v] + outcol_h; for (h = 0; h < h_expand; h++) { outvalue += (INT32) GETJSAMPLE(*inptr++); } } *outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix); } inrow += v_expand; } } /* * Downsample pixel values of a single component. * This version handles the special case of a full-size component, * without smoothing. */ METHODDEF(void) fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { /* Copy the data */ jcopy_sample_rows(input_data, 0, output_data, 0, cinfo->max_v_samp_factor, cinfo->image_width); /* Edge-expand */ expand_right_edge(output_data, cinfo->max_v_samp_factor, cinfo->image_width, compptr->width_in_data_units * cinfo->data_unit); } /* * Downsample pixel values of a single component. * This version handles the common case of 2:1 horizontal and 1:1 vertical, * without smoothing. * * A note about the "bias" calculations: when rounding fractional values to * integer, we do not want to always round 0.5 up to the next integer. * If we did that, we'd introduce a noticeable bias towards larger values. * Instead, this code is arranged so that 0.5 will be rounded up or down at * alternate pixel locations (a simple ordered dither pattern). */ METHODDEF(void) h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { int outrow; JDIMENSION outcol; JDIMENSION output_cols = compptr->width_in_data_units * cinfo->data_unit; register JSAMPROW inptr, outptr; register int bias; /* Expand input data enough to let all the output samples be generated * by the standard loop. Special-casing padded output would be more * efficient. */ expand_right_edge(input_data, cinfo->max_v_samp_factor, cinfo->image_width, output_cols * 2); for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { outptr = output_data[outrow]; inptr = input_data[outrow]; bias = 0; /* bias = 0,1,0,1,... for successive samples */ for (outcol = 0; outcol < output_cols; outcol++) { *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1]) + bias) >> 1); bias ^= 1; /* 0=>1, 1=>0 */ inptr += 2; } } } /* * Downsample pixel values of a single component. * This version handles the standard case of 2:1 horizontal and 2:1 vertical, * without smoothing. */ METHODDEF(void) h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { int inrow, outrow; JDIMENSION outcol; JDIMENSION output_cols = compptr->width_in_data_units * cinfo->data_unit; register JSAMPROW inptr0, inptr1, outptr; register int bias; /* Expand input data enough to let all the output samples be generated * by the standard loop. Special-casing padded output would be more * efficient. */ expand_right_edge(input_data, cinfo->max_v_samp_factor, cinfo->image_width, output_cols * 2); inrow = 0; for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { outptr = output_data[outrow]; inptr0 = input_data[inrow]; inptr1 = input_data[inrow+1]; bias = 1; /* bias = 1,2,1,2,... for successive samples */ for (outcol = 0; outcol < output_cols; outcol++) { *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]) + bias) >> 2); bias ^= 3; /* 1=>2, 2=>1 */ inptr0 += 2; inptr1 += 2; } inrow += 2; } } #ifdef INPUT_SMOOTHING_SUPPORTED /* * Downsample pixel values of a single component. * This version handles the standard case of 2:1 horizontal and 2:1 vertical, * with smoothing. One row of context is required. */ METHODDEF(void) h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { int inrow, outrow; JDIMENSION colctr; JDIMENSION output_cols = compptr->width_in_data_units * cinfo->data_unit; register JSAMPROW inptr0, inptr1, above_ptr, below_ptr, outptr; INT32 membersum, neighsum, memberscale, neighscale; /* Expand input data enough to let all the output samples be generated * by the standard loop. Special-casing padded output would be more * efficient. */ expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2, cinfo->image_width, output_cols * 2); /* We don't bother to form the individual "smoothed" input pixel values; * we can directly compute the output which is the average of the four * smoothed values. Each of the four member pixels contributes a fraction * (1-8*SF) to its own smoothed image and a fraction SF to each of the three * other smoothed pixels, therefore a total fraction (1-5*SF)/4 to the final * output. The four corner-adjacent neighbor pixels contribute a fraction * SF to just one smoothed pixel, or SF/4 to the final output; while the * eight edge-adjacent neighbors contribute SF to each of two smoothed * pixels, or SF/2 overall. In order to use integer arithmetic, these * factors are scaled by 2^16 = 65536. * Also recall that SF = smoothing_factor / 1024. */ memberscale = 16384 - cinfo->smoothing_factor * 80; /* scaled (1-5*SF)/4 */ neighscale = cinfo->smoothing_factor * 16; /* scaled SF/4 */ inrow = 0; for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { outptr = output_data[outrow]; inptr0 = input_data[inrow]; inptr1 = input_data[inrow+1]; above_ptr = input_data[inrow-1]; below_ptr = input_data[inrow+2]; /* Special case for first column: pretend column -1 is same as column 0 */ membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) + GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[2]) + GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[2]); neighsum += neighsum; neighsum += GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[2]) + GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[2]); membersum = membersum * memberscale + neighsum * neighscale; *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2; for (colctr = output_cols - 2; colctr > 0; colctr--) { /* sum of pixels directly mapped to this output element */ membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); /* sum of edge-neighbor pixels */ neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) + GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[2]) + GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[2]); /* The edge-neighbors count twice as much as corner-neighbors */ neighsum += neighsum; /* Add in the corner-neighbors */ neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[2]) + GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[2]); /* form final output scaled up by 2^16 */ membersum = membersum * memberscale + neighsum * neighscale; /* round, descale and output it */ *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2; } /* Special case for last column */ membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) + GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[1]) + GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[1]); neighsum += neighsum; neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[1]) + GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[1]); membersum = membersum * memberscale + neighsum * neighscale; *outptr = (JSAMPLE) ((membersum + 32768) >> 16); inrow += 2; } } /* * Downsample pixel values of a single component. * This version handles the special case of a full-size component, * with smoothing. One row of context is required. */ METHODDEF(void) fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { int outrow; JDIMENSION colctr; JDIMENSION output_cols = compptr->width_in_data_units * cinfo->data_unit; register JSAMPROW inptr, above_ptr, below_ptr, outptr; INT32 membersum, neighsum, memberscale, neighscale; int colsum, lastcolsum, nextcolsum; /* Expand input data enough to let all the output samples be generated * by the standard loop. Special-casing padded output would be more * efficient. */ expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2, cinfo->image_width, output_cols); /* Each of the eight neighbor pixels contributes a fraction SF to the * smoothed pixel, while the main pixel contributes (1-8*SF). In order * to use integer arithmetic, these factors are multiplied by 2^16 = 65536. * Also recall that SF = smoothing_factor / 1024. */ memberscale = 65536L - cinfo->smoothing_factor * 512L; /* scaled 1-8*SF */ neighscale = cinfo->smoothing_factor * 64; /* scaled SF */ for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { outptr = output_data[outrow]; inptr = input_data[outrow]; above_ptr = input_data[outrow-1]; below_ptr = input_data[outrow+1]; /* Special case for first column */ colsum = GETJSAMPLE(*above_ptr++) + GETJSAMPLE(*below_ptr++) + GETJSAMPLE(*inptr); membersum = GETJSAMPLE(*inptr++); nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) + GETJSAMPLE(*inptr); neighsum = colsum + (colsum - membersum) + nextcolsum; membersum = membersum * memberscale + neighsum * neighscale; *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); lastcolsum = colsum; colsum = nextcolsum; for (colctr = output_cols - 2; colctr > 0; colctr--) { membersum = GETJSAMPLE(*inptr++); above_ptr++; below_ptr++; nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) + GETJSAMPLE(*inptr); neighsum = lastcolsum + (colsum - membersum) + nextcolsum; membersum = membersum * memberscale + neighsum * neighscale; *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); lastcolsum = colsum; colsum = nextcolsum; } /* Special case for last column */ membersum = GETJSAMPLE(*inptr); neighsum = lastcolsum + (colsum - membersum) + colsum; membersum = membersum * memberscale + neighsum * neighscale; *outptr = (JSAMPLE) ((membersum + 32768) >> 16); } } #endif /* INPUT_SMOOTHING_SUPPORTED */ /* * Module initialization routine for downsampling. * Note that we must select a routine for each component. */ GLOBAL(void) jinit_downsampler (j_compress_ptr cinfo) { my_downsample_ptr downsample; int ci; jpeg_component_info * compptr; boolean smoothok = TRUE; downsample = (my_downsample_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_downsampler)); cinfo->downsample = (struct jpeg_downsampler *) downsample; downsample->pub.start_pass = start_pass_downsample; downsample->pub.downsample = sep_downsample; downsample->pub.need_context_rows = FALSE; if (cinfo->CCIR601_sampling) ERREXIT(cinfo, JERR_CCIR601_NOTIMPL); /* Verify we can handle the sampling factors, and set up method pointers */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { if (compptr->h_samp_factor == cinfo->max_h_samp_factor && compptr->v_samp_factor == cinfo->max_v_samp_factor) { #ifdef INPUT_SMOOTHING_SUPPORTED if (cinfo->smoothing_factor) { downsample->methods[ci] = fullsize_smooth_downsample; downsample->pub.need_context_rows = TRUE; } else #endif downsample->methods[ci] = fullsize_downsample; } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor && compptr->v_samp_factor == cinfo->max_v_samp_factor) { smoothok = FALSE; downsample->methods[ci] = h2v1_downsample; } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor && compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor) { #ifdef INPUT_SMOOTHING_SUPPORTED if (cinfo->smoothing_factor) { downsample->methods[ci] = h2v2_smooth_downsample; downsample->pub.need_context_rows = TRUE; } else #endif downsample->methods[ci] = h2v2_downsample; } else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 && (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) { smoothok = FALSE; downsample->methods[ci] = int_downsample; } else ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL); } #ifdef INPUT_SMOOTHING_SUPPORTED if (cinfo->smoothing_factor && !smoothok) TRACEMS(cinfo, 0, JTRC_SMOOTH_NOTIMPL); #endif } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jcodec.c�������������������������������������������������0000644�0001750�0001750�00000002075�12320456500�021417� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jcodec.c * * Copyright (C) 1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains utility functions for the JPEG codec(s). */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossy.h" #include "jlossls.h" /* * Initialize the compression codec. * This is called only once, during master selection. */ GLOBAL(void) jinit_c_codec (j_compress_ptr cinfo) { if (cinfo->process == JPROC_LOSSLESS) { #ifdef C_LOSSLESS_SUPPORTED jinit_lossless_c_codec(cinfo); #else ERREXIT(cinfo, JERR_NOT_COMPILED); #endif } else jinit_lossy_c_codec(cinfo); } /* * Initialize the decompression codec. * This is called only once, during master selection. */ GLOBAL(void) jinit_d_codec (j_decompress_ptr cinfo) { if (cinfo->process == JPROC_LOSSLESS) { #ifdef D_LOSSLESS_SUPPORTED jinit_lossless_d_codec(cinfo); #else ERREXIT(cinfo, JERR_NOT_COMPILED); #endif } else jinit_lossy_d_codec(cinfo); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jconfig.wat����������������������������������������������0000644�0001750�0001750�00000002231�12320456500�022152� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* jconfig.wat --- jconfig.h for Watcom C/C++ on MS-DOS or OS/2. */ /* see jconfig.doc for explanations */ #define HAVE_PROTOTYPES #define HAVE_UNSIGNED_CHAR #define HAVE_UNSIGNED_SHORT /* #define void char */ /* #define const */ #define CHAR_IS_UNSIGNED #define HAVE_STDDEF_H #define HAVE_STDLIB_H #undef NEED_BSD_STRINGS #undef NEED_SYS_TYPES_H #undef NEED_FAR_POINTERS /* Watcom uses flat 32-bit addressing */ #undef NEED_SHORT_EXTERNAL_NAMES #undef INCOMPLETE_TYPES_BROKEN #ifdef JPEG_INTERNALS #undef RIGHT_SHIFT_IS_UNSIGNED #endif /* JPEG_INTERNALS */ #ifdef JPEG_CJPEG_DJPEG #define BMP_SUPPORTED /* BMP image file format */ #define GIF_SUPPORTED /* GIF image file format */ #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ #undef RLE_SUPPORTED /* Utah RLE image file format */ #define TARGA_SUPPORTED /* Targa image file format */ #undef TWO_FILE_COMMANDLINE /* optional */ #define USE_SETMODE /* Needed to make one-file style work in Watcom */ #undef NEED_SIGNAL_CATCHER /* Define this if you use jmemname.c */ #undef DONT_USE_B_MODE #undef PROGRESS_REPORT /* optional */ #endif /* JPEG_CJPEG_DJPEG */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/mangle_jpeg.h��������������������������������������������0000644�0001750�0001750�00000017566�12320456500�022460� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef tuvok_internal_mangle_h8 #define tuvok_internal_mangle_h8 /* * This header file mangles all symbols exported from the jpeg library. * It is included in all files while building the jpeg library. * * This idea/implementation was taken from GDCM. */ #define jcopy_block_row tuvok_internal_jcopy_block_row8 #define jcopy_sample_rows tuvok_internal_jcopy_sample_rows8 #define jdiv_round_up tuvok_internal_jdiv_round_up8 #define jinit_1pass_quantizer tuvok_internal_jinit_1pass_quantizer8 #define jinit_2pass_quantizer tuvok_internal_jinit_2pass_quantizer8 #define jinit_arith_decoder tuvok_internal_jinit_arith_decoder8 #define jinit_arith_encoder tuvok_internal_jinit_arith_encoder8 #define jinit_c_codec tuvok_internal_jinit_c_codec8 #define jinit_c_coef_controller tuvok_internal_jinit_c_coef_controller8 #define jinit_c_diff_controller tuvok_internal_jinit_c_diff_controller8 #define jinit_c_main_controller tuvok_internal_jinit_c_main_controller8 #define jinit_c_master_control tuvok_internal_jinit_c_master_control8 #define jinit_c_prep_controller tuvok_internal_jinit_c_prep_controller8 #define jinit_c_scaler tuvok_internal_jinit_c_scaler8 #define jinit_color_converter tuvok_internal_jinit_color_converter8 #define jinit_color_deconverter tuvok_internal_jinit_color_deconverter8 #define jinit_compress_master tuvok_internal_jinit_compress_master8 #define jinit_d_codec tuvok_internal_jinit_d_codec8 #define jinit_d_coef_controller tuvok_internal_jinit_d_coef_controller8 #define jinit_d_diff_controller tuvok_internal_jinit_d_diff_controller8 #define jinit_d_main_controller tuvok_internal_jinit_d_main_controller8 #define jinit_d_post_controller tuvok_internal_jinit_d_post_controller8 #define jinit_d_scaler tuvok_internal_jinit_d_scaler8 #define jinit_differencer tuvok_internal_jinit_differencer8 #define jinit_downsampler tuvok_internal_jinit_downsampler8 #define jinit_forward_dct tuvok_internal_jinit_forward_dct8 #define jinit_input_controller tuvok_internal_jinit_input_controller8 #define jinit_inverse_dct tuvok_internal_jinit_inverse_dct8 #define jinit_lhuff_decoder tuvok_internal_jinit_lhuff_decoder8 #define jinit_lhuff_encoder tuvok_internal_jinit_lhuff_encoder8 #define jinit_lossless_c_codec tuvok_internal_jinit_lossless_c_codec8 #define jinit_lossless_d_codec tuvok_internal_jinit_lossless_d_codec8 #define jinit_lossy_c_codec tuvok_internal_jinit_lossy_c_codec8 #define jinit_lossy_d_codec tuvok_internal_jinit_lossy_d_codec8 #define jinit_marker_reader tuvok_internal_jinit_marker_reader8 #define jinit_marker_writer tuvok_internal_jinit_marker_writer8 #define jinit_master_decompress tuvok_internal_jinit_master_decompress8 #define jinit_memory_mgr tuvok_internal_jinit_memory_mgr8 #define jinit_merged_upsampler tuvok_internal_jinit_merged_upsampler8 #define jinit_phuff_decoder tuvok_internal_jinit_phuff_decoder8 #define jinit_phuff_encoder tuvok_internal_jinit_phuff_encoder8 #define jinit_shuff_decoder tuvok_internal_jinit_shuff_decoder8 #define jinit_shuff_encoder tuvok_internal_jinit_shuff_encoder8 #define jinit_undifferencer tuvok_internal_jinit_undifferencer8 #define jinit_upsampler tuvok_internal_jinit_upsampler8 #define jpeg_CreateCompress tuvok_internal_jpeg_CreateCompress8 #define jpeg_CreateDecompress tuvok_internal_jpeg_CreateDecompress8 #define jpeg_abort tuvok_internal_jpeg_abort8 #define jpeg_abort_compress tuvok_internal_jpeg_abort_compress8 #define jpeg_abort_decompress tuvok_internal_jpeg_abort_decompress8 #define jpeg_add_quant_table tuvok_internal_jpeg_add_quant_table8 #define jpeg_alloc_huff_table tuvok_internal_jpeg_alloc_huff_table8 #define jpeg_alloc_quant_table tuvok_internal_jpeg_alloc_quant_table8 #define jpeg_calc_output_dimensions tuvok_internal_jpeg_calc_output_dimensions8 #define jpeg_consume_input tuvok_internal_jpeg_consume_input8 #define jpeg_copy_critical_parameters tuvok_internal_jpeg_copy_critical_parameters8 #define jpeg_default_colorspace tuvok_internal_jpeg_default_colorspace8 #define jpeg_destroy tuvok_internal_jpeg_destroy8 #define jpeg_destroy_compress tuvok_internal_jpeg_destroy_compress8 #define jpeg_destroy_decompress tuvok_internal_jpeg_destroy_decompress8 #define jpeg_fdct_float tuvok_internal_jpeg_fdct_float8 #define jpeg_fdct_ifast tuvok_internal_jpeg_fdct_ifast8 #define jpeg_fdct_islow tuvok_internal_jpeg_fdct_islow8 #define jpeg_fill_bit_buffer tuvok_internal_jpeg_fill_bit_buffer8 #define jpeg_finish_compress tuvok_internal_jpeg_finish_compress8 #define jpeg_finish_decompress tuvok_internal_jpeg_finish_decompress8 #define jpeg_finish_output tuvok_internal_jpeg_finish_output8 #define jpeg_free_large tuvok_internal_jpeg_free_large8 #define jpeg_free_small tuvok_internal_jpeg_free_small8 #define jpeg_gen_optimal_table tuvok_internal_jpeg_gen_optimal_table8 #define jpeg_get_large tuvok_internal_jpeg_get_large8 #define jpeg_get_small tuvok_internal_jpeg_get_small8 #define jpeg_has_multiple_scans tuvok_internal_jpeg_has_multiple_scans8 #define jpeg_huff_decode tuvok_internal_jpeg_huff_decode8 #define jpeg_idct_1x1 tuvok_internal_jpeg_idct_1x18 #define jpeg_idct_2x2 tuvok_internal_jpeg_idct_2x28 #define jpeg_idct_4x4 tuvok_internal_jpeg_idct_4x48 #define jpeg_idct_float tuvok_internal_jpeg_idct_float8 #define jpeg_idct_ifast tuvok_internal_jpeg_idct_ifast8 #define jpeg_idct_islow tuvok_internal_jpeg_idct_islow8 #define jpeg_input_complete tuvok_internal_jpeg_input_complete8 #define jpeg_make_c_derived_tbl tuvok_internal_jpeg_make_c_derived_tbl8 #define jpeg_make_d_derived_tbl tuvok_internal_jpeg_make_d_derived_tbl8 #define jpeg_mem_available tuvok_internal_jpeg_mem_available8 #define jpeg_mem_init tuvok_internal_jpeg_mem_init8 #define jpeg_mem_term tuvok_internal_jpeg_mem_term8 #define jpeg_natural_order tuvok_internal_jpeg_natural_order8 #define jpeg_new_colormap tuvok_internal_jpeg_new_colormap8 #define jpeg_open_backing_store tuvok_internal_jpeg_open_backing_store8 #define jpeg_quality_scaling tuvok_internal_jpeg_quality_scaling8 #define jpeg_read_coefficients tuvok_internal_jpeg_read_coefficients8 #define jpeg_read_header tuvok_internal_jpeg_read_header8 #define jpeg_read_raw_data tuvok_internal_jpeg_read_raw_data8 #define jpeg_read_scanlines tuvok_internal_jpeg_read_scanlines8 #define jpeg_resync_to_restart tuvok_internal_jpeg_resync_to_restart8 #define jpeg_save_markers tuvok_internal_jpeg_save_markers8 #define jpeg_set_colorspace tuvok_internal_jpeg_set_colorspace8 #define jpeg_set_defaults tuvok_internal_jpeg_set_defaults8 #define jpeg_set_linear_quality tuvok_internal_jpeg_set_linear_quality8 #define jpeg_set_marker_processor tuvok_internal_jpeg_set_marker_processor8 #define jpeg_set_quality tuvok_internal_jpeg_set_quality8 #define jpeg_simple_lossless tuvok_internal_jpeg_simple_lossless8 #define jpeg_simple_progression tuvok_internal_jpeg_simple_progression8 #define jpeg_start_compress tuvok_internal_jpeg_start_compress8 #define jpeg_start_decompress tuvok_internal_jpeg_start_decompress8 #define jpeg_start_output tuvok_internal_jpeg_start_output8 #define jpeg_std_error tuvok_internal_jpeg_std_error8 #define jpeg_std_message_table tuvok_internal_jpeg_std_message_table8 #define jpeg_stdio_dest tuvok_internal_jpeg_stdio_dest8 #define jpeg_stdio_src tuvok_internal_jpeg_stdio_src8 #define jpeg_suppress_tables tuvok_internal_jpeg_suppress_tables8 #define jpeg_write_coefficients tuvok_internal_jpeg_write_coefficients8 #define jpeg_write_m_byte tuvok_internal_jpeg_write_m_byte8 #define jpeg_write_m_header tuvok_internal_jpeg_write_m_header8 #define jpeg_write_marker tuvok_internal_jpeg_write_marker8 #define jpeg_write_raw_data tuvok_internal_jpeg_write_raw_data8 #define jpeg_write_scanlines tuvok_internal_jpeg_write_scanlines8 #define jpeg_write_tables tuvok_internal_jpeg_write_tables8 #define jround_up tuvok_internal_jround_up8 #define jzero_far tuvok_internal_jzero_far8 #define first_marker tuvok_internal_first_marker8 #define read_markers tuvok_internal_read_markers8 #define consume_markers tuvok_internal_consume_markers8 #endif // tuvok_internal_mangle_h8 ������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jquant2.c������������������������������������������������0000644�0001750�0001750�00000136520�12320456500�021557� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jquant2.c * * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains 2-pass color quantization (color mapping) routines. * These routines provide selection of a custom color map for an image, * followed by mapping of the image to that color map, with optional * Floyd-Steinberg dithering. * It is also possible to use just the second pass to map to an arbitrary * externally-given color map. * * Note: ordered dithering is not supported, since there isn't any fast * way to compute intercolor distances; it's unclear that ordered dither's * fundamental assumptions even hold with an irregularly spaced color map. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #ifdef QUANT_2PASS_SUPPORTED /* * This module implements the well-known Heckbert paradigm for color * quantization. Most of the ideas used here can be traced back to * Heckbert's seminal paper * Heckbert, Paul. "Color Image Quantization for Frame Buffer Display", * Proc. SIGGRAPH '82, Computer Graphics v.16 #3 (July 1982), pp 297-304. * * In the first pass over the image, we accumulate a histogram showing the * usage count of each possible color. To keep the histogram to a reasonable * size, we reduce the precision of the input; typical practice is to retain * 5 or 6 bits per color, so that 8 or 4 different input values are counted * in the same histogram cell. * * Next, the color-selection step begins with a box representing the whole * color space, and repeatedly splits the "largest" remaining box until we * have as many boxes as desired colors. Then the mean color in each * remaining box becomes one of the possible output colors. * * The second pass over the image maps each input pixel to the closest output * color (optionally after applying a Floyd-Steinberg dithering correction). * This mapping is logically trivial, but making it go fast enough requires * considerable care. * * Heckbert-style quantizers vary a good deal in their policies for choosing * the "largest" box and deciding where to cut it. The particular policies * used here have proved out well in experimental comparisons, but better ones * may yet be found. * * In earlier versions of the IJG code, this module quantized in YCbCr color * space, processing the raw upsampled data without a color conversion step. * This allowed the color conversion math to be done only once per colormap * entry, not once per pixel. However, that optimization precluded other * useful optimizations (such as merging color conversion with upsampling) * and it also interfered with desired capabilities such as quantizing to an * externally-supplied colormap. We have therefore abandoned that approach. * The present code works in the post-conversion color space, typically RGB. * * To improve the visual quality of the results, we actually work in scaled * RGB space, giving G distances more weight than R, and R in turn more than * B. To do everything in integer math, we must use integer scale factors. * The 2/3/1 scale factors used here correspond loosely to the relative * weights of the colors in the NTSC grayscale equation. * If you want to use this code to quantize a non-RGB color space, you'll * probably need to change these scale factors. */ #define R_SCALE 2 /* scale R distances by this much */ #define G_SCALE 3 /* scale G distances by this much */ #define B_SCALE 1 /* and B by this much */ /* Relabel R/G/B as components 0/1/2, respecting the RGB ordering defined * in jmorecfg.h. As the code stands, it will do the right thing for R,G,B * and B,G,R orders. If you define some other weird order in jmorecfg.h, * you'll get compile errors until you extend this logic. In that case * you'll probably want to tweak the histogram sizes too. */ #if RGB_RED == 0 #define C0_SCALE R_SCALE #endif #if RGB_BLUE == 0 #define C0_SCALE B_SCALE #endif #if RGB_GREEN == 1 #define C1_SCALE G_SCALE #endif #if RGB_RED == 2 #define C2_SCALE R_SCALE #endif #if RGB_BLUE == 2 #define C2_SCALE B_SCALE #endif /* * First we have the histogram data structure and routines for creating it. * * The number of bits of precision can be adjusted by changing these symbols. * We recommend keeping 6 bits for G and 5 each for R and B. * If you have plenty of memory and cycles, 6 bits all around gives marginally * better results; if you are short of memory, 5 bits all around will save * some space but degrade the results. * To maintain a fully accurate histogram, we'd need to allocate a "long" * (preferably unsigned long) for each cell. In practice this is overkill; * we can get by with 16 bits per cell. Few of the cell counts will overflow, * and clamping those that do overflow to the maximum value will give close- * enough results. This reduces the recommended histogram size from 256Kb * to 128Kb, which is a useful savings on PC-class machines. * (In the second pass the histogram space is re-used for pixel mapping data; * in that capacity, each cell must be able to store zero to the number of * desired colors. 16 bits/cell is plenty for that too.) * Since the JPEG code is intended to run in small memory model on 80x86 * machines, we can't just allocate the histogram in one chunk. Instead * of a true 3-D array, we use a row of pointers to 2-D arrays. Each * pointer corresponds to a C0 value (typically 2^5 = 32 pointers) and * each 2-D array has 2^6*2^5 = 2048 or 2^6*2^6 = 4096 entries. Note that * on 80x86 machines, the pointer row is in near memory but the actual * arrays are in far memory (same arrangement as we use for image arrays). */ #define MAXNUMCOLORS (MAXJSAMPLE+1) /* maximum size of colormap */ /* These will do the right thing for either R,G,B or B,G,R color order, * but you may not like the results for other color orders. */ #define HIST_C0_BITS 5 /* bits of precision in R/B histogram */ #define HIST_C1_BITS 6 /* bits of precision in G histogram */ #define HIST_C2_BITS 5 /* bits of precision in B/R histogram */ /* Number of elements along histogram axes. */ #define HIST_C0_ELEMS (1<<HIST_C0_BITS) #define HIST_C1_ELEMS (1<<HIST_C1_BITS) #define HIST_C2_ELEMS (1<<HIST_C2_BITS) /* These are the amounts to shift an input value to get a histogram index. */ #define C0_SHIFT (BITS_IN_JSAMPLE-HIST_C0_BITS) #define C1_SHIFT (BITS_IN_JSAMPLE-HIST_C1_BITS) #define C2_SHIFT (BITS_IN_JSAMPLE-HIST_C2_BITS) typedef UINT16 histcell; /* histogram cell; prefer an unsigned type */ typedef histcell FAR * histptr; /* for pointers to histogram cells */ typedef histcell hist1d[HIST_C2_ELEMS]; /* typedefs for the array */ typedef hist1d FAR * hist2d; /* type for the 2nd-level pointers */ typedef hist2d * hist3d; /* type for top-level pointer */ /* Declarations for Floyd-Steinberg dithering. * * Errors are accumulated into the array fserrors[], at a resolution of * 1/16th of a pixel count. The error at a given pixel is propagated * to its not-yet-processed neighbors using the standard F-S fractions, * ... (here) 7/16 * 3/16 5/16 1/16 * We work left-to-right on even rows, right-to-left on odd rows. * * We can get away with a single array (holding one row's worth of errors) * by using it to store the current row's errors at pixel columns not yet * processed, but the next row's errors at columns already processed. We * need only a few extra variables to hold the errors immediately around the * current column. (If we are lucky, those variables are in registers, but * even if not, they're probably cheaper to access than array elements are.) * * The fserrors[] array has (#columns + 2) entries; the extra entry at * each end saves us from special-casing the first and last pixels. * Each entry is three values long, one value for each color component. * * Note: on a wide image, we might not have enough room in a PC's near data * segment to hold the error array; so it is allocated with alloc_large. */ #if BITS_IN_JSAMPLE == 8 typedef INT16 FSERROR; /* 16 bits should be enough */ typedef int LOCFSERROR; /* use 'int' for calculation temps */ #else typedef INT32 FSERROR; /* may need more than 16 bits */ typedef INT32 LOCFSERROR; /* be sure calculation temps are big enough */ #endif typedef FSERROR FAR *FSERRPTR; /* pointer to error array (in FAR storage!) */ /* Private subobject */ typedef struct { struct jpeg_color_quantizer pub; /* public fields */ /* Space for the eventually created colormap is stashed here */ JSAMPARRAY sv_colormap; /* colormap allocated at init time */ int desired; /* desired # of colors = size of colormap */ /* Variables for accumulating image statistics */ hist3d histogram; /* pointer to the histogram */ boolean needs_zeroed; /* TRUE if next pass must zero histogram */ /* Variables for Floyd-Steinberg dithering */ FSERRPTR fserrors; /* accumulated errors */ boolean on_odd_row; /* flag to remember which row we are on */ int * error_limiter; /* table for clamping the applied error */ } my_cquantizer; typedef my_cquantizer * my_cquantize_ptr; /* * Prescan some rows of pixels. * In this module the prescan simply updates the histogram, which has been * initialized to zeroes by start_pass. * An output_buf parameter is required by the method signature, but no data * is actually output (in fact the buffer controller is probably passing a * NULL pointer). */ METHODDEF(void) prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; register JSAMPROW ptr; register histptr histp; register hist3d histogram = cquantize->histogram; int row; JDIMENSION col; JDIMENSION width = cinfo->output_width; (void)output_buf; for (row = 0; row < num_rows; row++) { ptr = input_buf[row]; for (col = width; col > 0; col--) { /* get pixel value and index into the histogram */ histp = & histogram[GETJSAMPLE(ptr[0]) >> C0_SHIFT] [GETJSAMPLE(ptr[1]) >> C1_SHIFT] [GETJSAMPLE(ptr[2]) >> C2_SHIFT]; /* increment, check for overflow and undo increment if so. */ if (++(*histp) <= 0) (*histp)--; ptr += 3; } } } /* * Next we have the really interesting routines: selection of a colormap * given the completed histogram. * These routines work with a list of "boxes", each representing a rectangular * subset of the input color space (to histogram precision). */ typedef struct { /* The bounds of the box (inclusive); expressed as histogram indexes */ int c0min, c0max; int c1min, c1max; int c2min, c2max; /* The volume (actually 2-norm) of the box */ INT32 volume; /* The number of nonzero histogram cells within this box */ long colorcount; } box; typedef box * boxptr; LOCAL(boxptr) find_biggest_color_pop (boxptr boxlist, int numboxes) /* Find the splittable box with the largest color population */ /* Returns NULL if no splittable boxes remain */ { register boxptr boxp; register int i; register long maxc = 0; boxptr which = NULL; for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) { if (boxp->colorcount > maxc && boxp->volume > 0) { which = boxp; maxc = boxp->colorcount; } } return which; } LOCAL(boxptr) find_biggest_volume (boxptr boxlist, int numboxes) /* Find the splittable box with the largest (scaled) volume */ /* Returns NULL if no splittable boxes remain */ { register boxptr boxp; register int i; register INT32 maxv = 0; boxptr which = NULL; for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) { if (boxp->volume > maxv) { which = boxp; maxv = boxp->volume; } } return which; } LOCAL(void) update_box (j_decompress_ptr cinfo, boxptr boxp) /* Shrink the min/max bounds of a box to enclose only nonzero elements, */ /* and recompute its volume and population */ { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; hist3d histogram = cquantize->histogram; histptr histp; int c0,c1,c2; int c0min,c0max,c1min,c1max,c2min,c2max; INT32 dist0,dist1,dist2; long ccount; c0min = boxp->c0min; c0max = boxp->c0max; c1min = boxp->c1min; c1max = boxp->c1max; c2min = boxp->c2min; c2max = boxp->c2max; if (c0max > c0min) for (c0 = c0min; c0 <= c0max; c0++) for (c1 = c1min; c1 <= c1max; c1++) { histp = & histogram[c0][c1][c2min]; for (c2 = c2min; c2 <= c2max; c2++) if (*histp++ != 0) { boxp->c0min = c0min = c0; goto have_c0min; } } have_c0min: if (c0max > c0min) for (c0 = c0max; c0 >= c0min; c0--) for (c1 = c1min; c1 <= c1max; c1++) { histp = & histogram[c0][c1][c2min]; for (c2 = c2min; c2 <= c2max; c2++) if (*histp++ != 0) { boxp->c0max = c0max = c0; goto have_c0max; } } have_c0max: if (c1max > c1min) for (c1 = c1min; c1 <= c1max; c1++) for (c0 = c0min; c0 <= c0max; c0++) { histp = & histogram[c0][c1][c2min]; for (c2 = c2min; c2 <= c2max; c2++) if (*histp++ != 0) { boxp->c1min = c1min = c1; goto have_c1min; } } have_c1min: if (c1max > c1min) for (c1 = c1max; c1 >= c1min; c1--) for (c0 = c0min; c0 <= c0max; c0++) { histp = & histogram[c0][c1][c2min]; for (c2 = c2min; c2 <= c2max; c2++) if (*histp++ != 0) { boxp->c1max = c1max = c1; goto have_c1max; } } have_c1max: if (c2max > c2min) for (c2 = c2min; c2 <= c2max; c2++) for (c0 = c0min; c0 <= c0max; c0++) { histp = & histogram[c0][c1min][c2]; for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS) if (*histp != 0) { boxp->c2min = c2min = c2; goto have_c2min; } } have_c2min: if (c2max > c2min) for (c2 = c2max; c2 >= c2min; c2--) for (c0 = c0min; c0 <= c0max; c0++) { histp = & histogram[c0][c1min][c2]; for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS) if (*histp != 0) { boxp->c2max = c2max = c2; goto have_c2max; } } have_c2max: /* Update box volume. * We use 2-norm rather than real volume here; this biases the method * against making long narrow boxes, and it has the side benefit that * a box is splittable iff norm > 0. * Since the differences are expressed in histogram-cell units, * we have to shift back to JSAMPLE units to get consistent distances; * after which, we scale according to the selected distance scale factors. */ dist0 = ((c0max - c0min) << C0_SHIFT) * C0_SCALE; dist1 = ((c1max - c1min) << C1_SHIFT) * C1_SCALE; dist2 = ((c2max - c2min) << C2_SHIFT) * C2_SCALE; boxp->volume = dist0*dist0 + dist1*dist1 + dist2*dist2; /* Now scan remaining volume of box and compute population */ ccount = 0; for (c0 = c0min; c0 <= c0max; c0++) for (c1 = c1min; c1 <= c1max; c1++) { histp = & histogram[c0][c1][c2min]; for (c2 = c2min; c2 <= c2max; c2++, histp++) if (*histp != 0) { ccount++; } } boxp->colorcount = ccount; } LOCAL(int) median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes, int desired_colors) /* Repeatedly select and split the largest box until we have enough boxes */ { int n,lb; int c0,c1,c2,cmax; register boxptr b1,b2; while (numboxes < desired_colors) { /* Select box to split. * Current algorithm: by population for first half, then by volume. */ if (numboxes*2 <= desired_colors) { b1 = find_biggest_color_pop(boxlist, numboxes); } else { b1 = find_biggest_volume(boxlist, numboxes); } if (b1 == NULL) /* no splittable boxes left! */ break; b2 = &boxlist[numboxes]; /* where new box will go */ /* Copy the color bounds to the new box. */ b2->c0max = b1->c0max; b2->c1max = b1->c1max; b2->c2max = b1->c2max; b2->c0min = b1->c0min; b2->c1min = b1->c1min; b2->c2min = b1->c2min; /* Choose which axis to split the box on. * Current algorithm: longest scaled axis. * See notes in update_box about scaling distances. */ c0 = ((b1->c0max - b1->c0min) << C0_SHIFT) * C0_SCALE; c1 = ((b1->c1max - b1->c1min) << C1_SHIFT) * C1_SCALE; c2 = ((b1->c2max - b1->c2min) << C2_SHIFT) * C2_SCALE; /* We want to break any ties in favor of green, then red, blue last. * This code does the right thing for R,G,B or B,G,R color orders only. */ #if RGB_RED == 0 cmax = c1; n = 1; if (c0 > cmax) { cmax = c0; n = 0; } if (c2 > cmax) { n = 2; } #else cmax = c1; n = 1; if (c2 > cmax) { cmax = c2; n = 2; } if (c0 > cmax) { n = 0; } #endif /* Choose split point along selected axis, and update box bounds. * Current algorithm: split at halfway point. * (Since the box has been shrunk to minimum volume, * any split will produce two nonempty subboxes.) * Note that lb value is max for lower box, so must be < old max. */ switch (n) { case 0: lb = (b1->c0max + b1->c0min) / 2; b1->c0max = lb; b2->c0min = lb+1; break; case 1: lb = (b1->c1max + b1->c1min) / 2; b1->c1max = lb; b2->c1min = lb+1; break; case 2: lb = (b1->c2max + b1->c2min) / 2; b1->c2max = lb; b2->c2min = lb+1; break; } /* Update stats for boxes */ update_box(cinfo, b1); update_box(cinfo, b2); numboxes++; } return numboxes; } LOCAL(void) compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor) /* Compute representative color for a box, put it in colormap[icolor] */ { /* Current algorithm: mean weighted by pixels (not colors) */ /* Note it is important to get the rounding correct! */ my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; hist3d histogram = cquantize->histogram; histptr histp; int c0,c1,c2; int c0min,c0max,c1min,c1max,c2min,c2max; long count; long total = 0; long c0total = 0; long c1total = 0; long c2total = 0; c0min = boxp->c0min; c0max = boxp->c0max; c1min = boxp->c1min; c1max = boxp->c1max; c2min = boxp->c2min; c2max = boxp->c2max; for (c0 = c0min; c0 <= c0max; c0++) for (c1 = c1min; c1 <= c1max; c1++) { histp = & histogram[c0][c1][c2min]; for (c2 = c2min; c2 <= c2max; c2++) { if ((count = *histp++) != 0) { total += count; c0total += ((c0 << C0_SHIFT) + ((1<<C0_SHIFT)>>1)) * count; c1total += ((c1 << C1_SHIFT) + ((1<<C1_SHIFT)>>1)) * count; c2total += ((c2 << C2_SHIFT) + ((1<<C2_SHIFT)>>1)) * count; } } } cinfo->colormap[0][icolor] = (JSAMPLE) ((c0total + (total>>1)) / total); cinfo->colormap[1][icolor] = (JSAMPLE) ((c1total + (total>>1)) / total); cinfo->colormap[2][icolor] = (JSAMPLE) ((c2total + (total>>1)) / total); } LOCAL(void) select_colors (j_decompress_ptr cinfo, int desired_colors) /* Master routine for color selection */ { boxptr boxlist; int numboxes; int i; /* Allocate workspace for box list */ boxlist = (boxptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, desired_colors * SIZEOF(box)); /* Initialize one box containing whole space */ numboxes = 1; boxlist[0].c0min = 0; boxlist[0].c0max = MAXJSAMPLE >> C0_SHIFT; boxlist[0].c1min = 0; boxlist[0].c1max = MAXJSAMPLE >> C1_SHIFT; boxlist[0].c2min = 0; boxlist[0].c2max = MAXJSAMPLE >> C2_SHIFT; /* Shrink it to actually-used volume and set its statistics */ update_box(cinfo, & boxlist[0]); /* Perform median-cut to produce final box list */ numboxes = median_cut(cinfo, boxlist, numboxes, desired_colors); /* Compute the representative color for each box, fill colormap */ for (i = 0; i < numboxes; i++) compute_color(cinfo, & boxlist[i], i); cinfo->actual_number_of_colors = numboxes; TRACEMS1(cinfo, 1, JTRC_QUANT_SELECTED, numboxes); } /* * These routines are concerned with the time-critical task of mapping input * colors to the nearest color in the selected colormap. * * We re-use the histogram space as an "inverse color map", essentially a * cache for the results of nearest-color searches. All colors within a * histogram cell will be mapped to the same colormap entry, namely the one * closest to the cell's center. This may not be quite the closest entry to * the actual input color, but it's almost as good. A zero in the cache * indicates we haven't found the nearest color for that cell yet; the array * is cleared to zeroes before starting the mapping pass. When we find the * nearest color for a cell, its colormap index plus one is recorded in the * cache for future use. The pass2 scanning routines call fill_inverse_cmap * when they need to use an unfilled entry in the cache. * * Our method of efficiently finding nearest colors is based on the "locally * sorted search" idea described by Heckbert and on the incremental distance * calculation described by Spencer W. Thomas in chapter III.1 of Graphics * Gems II (James Arvo, ed. Academic Press, 1991). Thomas points out that * the distances from a given colormap entry to each cell of the histogram can * be computed quickly using an incremental method: the differences between * distances to adjacent cells themselves differ by a constant. This allows a * fairly fast implementation of the "brute force" approach of computing the * distance from every colormap entry to every histogram cell. Unfortunately, * it needs a work array to hold the best-distance-so-far for each histogram * cell (because the inner loop has to be over cells, not colormap entries). * The work array elements have to be INT32s, so the work array would need * 256Kb at our recommended precision. This is not feasible in DOS machines. * * To get around these problems, we apply Thomas' method to compute the * nearest colors for only the cells within a small subbox of the histogram. * The work array need be only as big as the subbox, so the memory usage * problem is solved. Furthermore, we need not fill subboxes that are never * referenced in pass2; many images use only part of the color gamut, so a * fair amount of work is saved. An additional advantage of this * approach is that we can apply Heckbert's locality criterion to quickly * eliminate colormap entries that are far away from the subbox; typically * three-fourths of the colormap entries are rejected by Heckbert's criterion, * and we need not compute their distances to individual cells in the subbox. * The speed of this approach is heavily influenced by the subbox size: too * small means too much overhead, too big loses because Heckbert's criterion * can't eliminate as many colormap entries. Empirically the best subbox * size seems to be about 1/512th of the histogram (1/8th in each direction). * * Thomas' article also describes a refined method which is asymptotically * faster than the brute-force method, but it is also far more complex and * cannot efficiently be applied to small subboxes. It is therefore not * useful for programs intended to be portable to DOS machines. On machines * with plenty of memory, filling the whole histogram in one shot with Thomas' * refined method might be faster than the present code --- but then again, * it might not be any faster, and it's certainly more complicated. */ /* log2(histogram cells in update box) for each axis; this can be adjusted */ #define BOX_C0_LOG (HIST_C0_BITS-3) #define BOX_C1_LOG (HIST_C1_BITS-3) #define BOX_C2_LOG (HIST_C2_BITS-3) #define BOX_C0_ELEMS (1<<BOX_C0_LOG) /* # of hist cells in update box */ #define BOX_C1_ELEMS (1<<BOX_C1_LOG) #define BOX_C2_ELEMS (1<<BOX_C2_LOG) #define BOX_C0_SHIFT (C0_SHIFT + BOX_C0_LOG) #define BOX_C1_SHIFT (C1_SHIFT + BOX_C1_LOG) #define BOX_C2_SHIFT (C2_SHIFT + BOX_C2_LOG) /* * The next three routines implement inverse colormap filling. They could * all be folded into one big routine, but splitting them up this way saves * some stack space (the mindist[] and bestdist[] arrays need not coexist) * and may allow some compilers to produce better code by registerizing more * inner-loop variables. */ LOCAL(int) find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, JSAMPLE colorlist[]) /* Locate the colormap entries close enough to an update box to be candidates * for the nearest entry to some cell(s) in the update box. The update box * is specified by the center coordinates of its first cell. The number of * candidate colormap entries is returned, and their colormap indexes are * placed in colorlist[]. * This routine uses Heckbert's "locally sorted search" criterion to select * the colors that need further consideration. */ { int numcolors = cinfo->actual_number_of_colors; int maxc0, maxc1, maxc2; int centerc0, centerc1, centerc2; int i, x, ncolors; INT32 minmaxdist, min_dist, max_dist, tdist; INT32 mindist[MAXNUMCOLORS]; /* min distance to colormap entry i */ /* Compute true coordinates of update box's upper corner and center. * Actually we compute the coordinates of the center of the upper-corner * histogram cell, which are the upper bounds of the volume we care about. * Note that since ">>" rounds down, the "center" values may be closer to * min than to max; hence comparisons to them must be "<=", not "<". */ maxc0 = minc0 + ((1 << BOX_C0_SHIFT) - (1 << C0_SHIFT)); centerc0 = (minc0 + maxc0) >> 1; maxc1 = minc1 + ((1 << BOX_C1_SHIFT) - (1 << C1_SHIFT)); centerc1 = (minc1 + maxc1) >> 1; maxc2 = minc2 + ((1 << BOX_C2_SHIFT) - (1 << C2_SHIFT)); centerc2 = (minc2 + maxc2) >> 1; /* For each color in colormap, find: * 1. its minimum squared-distance to any point in the update box * (zero if color is within update box); * 2. its maximum squared-distance to any point in the update box. * Both of these can be found by considering only the corners of the box. * We save the minimum distance for each color in mindist[]; * only the smallest maximum distance is of interest. */ minmaxdist = 0x7FFFFFFFL; for (i = 0; i < numcolors; i++) { /* We compute the squared-c0-distance term, then add in the other two. */ x = GETJSAMPLE(cinfo->colormap[0][i]); if (x < minc0) { tdist = (x - minc0) * C0_SCALE; min_dist = tdist*tdist; tdist = (x - maxc0) * C0_SCALE; max_dist = tdist*tdist; } else if (x > maxc0) { tdist = (x - maxc0) * C0_SCALE; min_dist = tdist*tdist; tdist = (x - minc0) * C0_SCALE; max_dist = tdist*tdist; } else { /* within cell range so no contribution to min_dist */ min_dist = 0; if (x <= centerc0) { tdist = (x - maxc0) * C0_SCALE; max_dist = tdist*tdist; } else { tdist = (x - minc0) * C0_SCALE; max_dist = tdist*tdist; } } x = GETJSAMPLE(cinfo->colormap[1][i]); if (x < minc1) { tdist = (x - minc1) * C1_SCALE; min_dist += tdist*tdist; tdist = (x - maxc1) * C1_SCALE; max_dist += tdist*tdist; } else if (x > maxc1) { tdist = (x - maxc1) * C1_SCALE; min_dist += tdist*tdist; tdist = (x - minc1) * C1_SCALE; max_dist += tdist*tdist; } else { /* within cell range so no contribution to min_dist */ if (x <= centerc1) { tdist = (x - maxc1) * C1_SCALE; max_dist += tdist*tdist; } else { tdist = (x - minc1) * C1_SCALE; max_dist += tdist*tdist; } } x = GETJSAMPLE(cinfo->colormap[2][i]); if (x < minc2) { tdist = (x - minc2) * C2_SCALE; min_dist += tdist*tdist; tdist = (x - maxc2) * C2_SCALE; max_dist += tdist*tdist; } else if (x > maxc2) { tdist = (x - maxc2) * C2_SCALE; min_dist += tdist*tdist; tdist = (x - minc2) * C2_SCALE; max_dist += tdist*tdist; } else { /* within cell range so no contribution to min_dist */ if (x <= centerc2) { tdist = (x - maxc2) * C2_SCALE; max_dist += tdist*tdist; } else { tdist = (x - minc2) * C2_SCALE; max_dist += tdist*tdist; } } mindist[i] = min_dist; /* save away the results */ if (max_dist < minmaxdist) minmaxdist = max_dist; } /* Now we know that no cell in the update box is more than minmaxdist * away from some colormap entry. Therefore, only colors that are * within minmaxdist of some part of the box need be considered. */ ncolors = 0; for (i = 0; i < numcolors; i++) { if (mindist[i] <= minmaxdist) colorlist[ncolors++] = (JSAMPLE) i; } return ncolors; } LOCAL(void) find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, int numcolors, JSAMPLE colorlist[], JSAMPLE bestcolor[]) /* Find the closest colormap entry for each cell in the update box, * given the list of candidate colors prepared by find_nearby_colors. * Return the indexes of the closest entries in the bestcolor[] array. * This routine uses Thomas' incremental distance calculation method to * find the distance from a colormap entry to successive cells in the box. */ { int ic0, ic1, ic2; int i, icolor; register INT32 * bptr; /* pointer into bestdist[] array */ JSAMPLE * cptr; /* pointer into bestcolor[] array */ INT32 dist0, dist1; /* initial distance values */ register INT32 dist2; /* current distance in inner loop */ INT32 xx0, xx1; /* distance increments */ register INT32 xx2; INT32 inc0, inc1, inc2; /* initial values for increments */ /* This array holds the distance to the nearest-so-far color for each cell */ INT32 bestdist[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS]; /* Initialize best-distance for each cell of the update box */ bptr = bestdist; for (i = BOX_C0_ELEMS*BOX_C1_ELEMS*BOX_C2_ELEMS-1; i >= 0; i--) *bptr++ = 0x7FFFFFFFL; /* For each color selected by find_nearby_colors, * compute its distance to the center of each cell in the box. * If that's less than best-so-far, update best distance and color number. */ /* Nominal steps between cell centers ("x" in Thomas article) */ #define STEP_C0 ((1 << C0_SHIFT) * C0_SCALE) #define STEP_C1 ((1 << C1_SHIFT) * C1_SCALE) #define STEP_C2 ((1 << C2_SHIFT) * C2_SCALE) for (i = 0; i < numcolors; i++) { icolor = GETJSAMPLE(colorlist[i]); /* Compute (square of) distance from minc0/c1/c2 to this color */ inc0 = (minc0 - GETJSAMPLE(cinfo->colormap[0][icolor])) * C0_SCALE; dist0 = inc0*inc0; inc1 = (minc1 - GETJSAMPLE(cinfo->colormap[1][icolor])) * C1_SCALE; dist0 += inc1*inc1; inc2 = (minc2 - GETJSAMPLE(cinfo->colormap[2][icolor])) * C2_SCALE; dist0 += inc2*inc2; /* Form the initial difference increments */ inc0 = inc0 * (2 * STEP_C0) + STEP_C0 * STEP_C0; inc1 = inc1 * (2 * STEP_C1) + STEP_C1 * STEP_C1; inc2 = inc2 * (2 * STEP_C2) + STEP_C2 * STEP_C2; /* Now loop over all cells in box, updating distance per Thomas method */ bptr = bestdist; cptr = bestcolor; xx0 = inc0; for (ic0 = BOX_C0_ELEMS-1; ic0 >= 0; ic0--) { dist1 = dist0; xx1 = inc1; for (ic1 = BOX_C1_ELEMS-1; ic1 >= 0; ic1--) { dist2 = dist1; xx2 = inc2; for (ic2 = BOX_C2_ELEMS-1; ic2 >= 0; ic2--) { if (dist2 < *bptr) { *bptr = dist2; *cptr = (JSAMPLE) icolor; } dist2 += xx2; xx2 += 2 * STEP_C2 * STEP_C2; bptr++; cptr++; } dist1 += xx1; xx1 += 2 * STEP_C1 * STEP_C1; } dist0 += xx0; xx0 += 2 * STEP_C0 * STEP_C0; } } } LOCAL(void) fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2) /* Fill the inverse-colormap entries in the update box that contains */ /* histogram cell c0/c1/c2. (Only that one cell MUST be filled, but */ /* we can fill as many others as we wish.) */ { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; hist3d histogram = cquantize->histogram; int minc0, minc1, minc2; /* lower left corner of update box */ int ic0, ic1, ic2; register JSAMPLE * cptr; /* pointer into bestcolor[] array */ register histptr cachep; /* pointer into main cache array */ /* This array lists the candidate colormap indexes. */ JSAMPLE colorlist[MAXNUMCOLORS]; int numcolors; /* number of candidate colors */ /* This array holds the actually closest colormap index for each cell. */ JSAMPLE bestcolor[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS]; /* Convert cell coordinates to update box ID */ c0 >>= BOX_C0_LOG; c1 >>= BOX_C1_LOG; c2 >>= BOX_C2_LOG; /* Compute true coordinates of update box's origin corner. * Actually we compute the coordinates of the center of the corner * histogram cell, which are the lower bounds of the volume we care about. */ minc0 = (c0 << BOX_C0_SHIFT) + ((1 << C0_SHIFT) >> 1); minc1 = (c1 << BOX_C1_SHIFT) + ((1 << C1_SHIFT) >> 1); minc2 = (c2 << BOX_C2_SHIFT) + ((1 << C2_SHIFT) >> 1); /* Determine which colormap entries are close enough to be candidates * for the nearest entry to some cell in the update box. */ numcolors = find_nearby_colors(cinfo, minc0, minc1, minc2, colorlist); /* Determine the actually nearest colors. */ find_best_colors(cinfo, minc0, minc1, minc2, numcolors, colorlist, bestcolor); /* Save the best color numbers (plus 1) in the main cache array */ c0 <<= BOX_C0_LOG; /* convert ID back to base cell indexes */ c1 <<= BOX_C1_LOG; c2 <<= BOX_C2_LOG; cptr = bestcolor; for (ic0 = 0; ic0 < BOX_C0_ELEMS; ic0++) { for (ic1 = 0; ic1 < BOX_C1_ELEMS; ic1++) { cachep = & histogram[c0+ic0][c1+ic1][c2]; for (ic2 = 0; ic2 < BOX_C2_ELEMS; ic2++) { *cachep++ = (histcell) (GETJSAMPLE(*cptr++) + 1); } } } } /* * Map some rows of pixels to the output colormapped representation. */ METHODDEF(void) pass2_no_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) /* This version performs no dithering */ { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; hist3d histogram = cquantize->histogram; register JSAMPROW inptr, outptr; register histptr cachep; register int c0, c1, c2; int row; JDIMENSION col; JDIMENSION width = cinfo->output_width; for (row = 0; row < num_rows; row++) { inptr = input_buf[row]; outptr = output_buf[row]; for (col = width; col > 0; col--) { /* get pixel value and index into the cache */ c0 = GETJSAMPLE(*inptr++) >> C0_SHIFT; c1 = GETJSAMPLE(*inptr++) >> C1_SHIFT; c2 = GETJSAMPLE(*inptr++) >> C2_SHIFT; cachep = & histogram[c0][c1][c2]; /* If we have not seen this color before, find nearest colormap entry */ /* and update the cache */ if (*cachep == 0) fill_inverse_cmap(cinfo, c0,c1,c2); /* Now emit the colormap index for this cell */ *outptr++ = (JSAMPLE) (*cachep - 1); } } } METHODDEF(void) pass2_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) /* This version performs Floyd-Steinberg dithering */ { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; hist3d histogram = cquantize->histogram; register LOCFSERROR cur0, cur1, cur2; /* current error or pixel value */ LOCFSERROR belowerr0, belowerr1, belowerr2; /* error for pixel below cur */ LOCFSERROR bpreverr0, bpreverr1, bpreverr2; /* error for below/prev col */ register FSERRPTR errorptr; /* => fserrors[] at column before current */ JSAMPROW inptr; /* => current input pixel */ JSAMPROW outptr; /* => current output pixel */ histptr cachep; int dir; /* +1 or -1 depending on direction */ int dir3; /* 3*dir, for advancing inptr & errorptr */ int row; JDIMENSION col; JDIMENSION width = cinfo->output_width; JSAMPLE *range_limit = cinfo->sample_range_limit; int *error_limit = cquantize->error_limiter; JSAMPROW colormap0 = cinfo->colormap[0]; JSAMPROW colormap1 = cinfo->colormap[1]; JSAMPROW colormap2 = cinfo->colormap[2]; SHIFT_TEMPS for (row = 0; row < num_rows; row++) { inptr = input_buf[row]; outptr = output_buf[row]; if (cquantize->on_odd_row) { /* work right to left in this row */ inptr += (width-1) * 3; /* so point to rightmost pixel */ outptr += width-1; dir = -1; dir3 = -3; errorptr = cquantize->fserrors + (width+1)*3; /* => entry after last column */ cquantize->on_odd_row = FALSE; /* flip for next time */ } else { /* work left to right in this row */ dir = 1; dir3 = 3; errorptr = cquantize->fserrors; /* => entry before first real column */ cquantize->on_odd_row = TRUE; /* flip for next time */ } /* Preset error values: no error propagated to first pixel from left */ cur0 = cur1 = cur2 = 0; /* and no error propagated to row below yet */ belowerr0 = belowerr1 = belowerr2 = 0; bpreverr0 = bpreverr1 = bpreverr2 = 0; for (col = width; col > 0; col--) { /* curN holds the error propagated from the previous pixel on the * current line. Add the error propagated from the previous line * to form the complete error correction term for this pixel, and * round the error term (which is expressed * 16) to an integer. * RIGHT_SHIFT rounds towards minus infinity, so adding 8 is correct * for either sign of the error value. * Note: errorptr points to *previous* column's array entry. */ cur0 = RIGHT_SHIFT(cur0 + errorptr[dir3+0] + 8, 4); cur1 = RIGHT_SHIFT(cur1 + errorptr[dir3+1] + 8, 4); cur2 = RIGHT_SHIFT(cur2 + errorptr[dir3+2] + 8, 4); /* Limit the error using transfer function set by init_error_limit. * See comments with init_error_limit for rationale. */ cur0 = error_limit[cur0]; cur1 = error_limit[cur1]; cur2 = error_limit[cur2]; /* Form pixel value + error, and range-limit to 0..MAXJSAMPLE. * The maximum error is +- MAXJSAMPLE (or less with error limiting); * this sets the required size of the range_limit array. */ cur0 += GETJSAMPLE(inptr[0]); cur1 += GETJSAMPLE(inptr[1]); cur2 += GETJSAMPLE(inptr[2]); cur0 = GETJSAMPLE(range_limit[cur0]); cur1 = GETJSAMPLE(range_limit[cur1]); cur2 = GETJSAMPLE(range_limit[cur2]); /* Index into the cache with adjusted pixel value */ cachep = & histogram[cur0>>C0_SHIFT][cur1>>C1_SHIFT][cur2>>C2_SHIFT]; /* If we have not seen this color before, find nearest colormap */ /* entry and update the cache */ if (*cachep == 0) fill_inverse_cmap(cinfo, cur0>>C0_SHIFT,cur1>>C1_SHIFT,cur2>>C2_SHIFT); /* Now emit the colormap index for this cell */ { register int pixcode = *cachep - 1; *outptr = (JSAMPLE) pixcode; /* Compute representation error for this pixel */ cur0 -= GETJSAMPLE(colormap0[pixcode]); cur1 -= GETJSAMPLE(colormap1[pixcode]); cur2 -= GETJSAMPLE(colormap2[pixcode]); } /* Compute error fractions to be propagated to adjacent pixels. * Add these into the running sums, and simultaneously shift the * next-line error sums left by 1 column. */ { register LOCFSERROR bnexterr, delta; bnexterr = cur0; /* Process component 0 */ delta = cur0 * 2; cur0 += delta; /* form error * 3 */ errorptr[0] = (FSERROR) (bpreverr0 + cur0); cur0 += delta; /* form error * 5 */ bpreverr0 = belowerr0 + cur0; belowerr0 = bnexterr; cur0 += delta; /* form error * 7 */ bnexterr = cur1; /* Process component 1 */ delta = cur1 * 2; cur1 += delta; /* form error * 3 */ errorptr[1] = (FSERROR) (bpreverr1 + cur1); cur1 += delta; /* form error * 5 */ bpreverr1 = belowerr1 + cur1; belowerr1 = bnexterr; cur1 += delta; /* form error * 7 */ bnexterr = cur2; /* Process component 2 */ delta = cur2 * 2; cur2 += delta; /* form error * 3 */ errorptr[2] = (FSERROR) (bpreverr2 + cur2); cur2 += delta; /* form error * 5 */ bpreverr2 = belowerr2 + cur2; belowerr2 = bnexterr; cur2 += delta; /* form error * 7 */ } /* At this point curN contains the 7/16 error value to be propagated * to the next pixel on the current line, and all the errors for the * next line have been shifted over. We are therefore ready to move on. */ inptr += dir3; /* Advance pixel pointers to next column */ outptr += dir; errorptr += dir3; /* advance errorptr to current column */ } /* Post-loop cleanup: we must unload the final error values into the * final fserrors[] entry. Note we need not unload belowerrN because * it is for the dummy column before or after the actual array. */ errorptr[0] = (FSERROR) bpreverr0; /* unload prev errs into array */ errorptr[1] = (FSERROR) bpreverr1; errorptr[2] = (FSERROR) bpreverr2; } } /* * Initialize the error-limiting transfer function (lookup table). * The raw F-S error computation can potentially compute error values of up to * +- MAXJSAMPLE. But we want the maximum correction applied to a pixel to be * much less, otherwise obviously wrong pixels will be created. (Typical * effects include weird fringes at color-area boundaries, isolated bright * pixels in a dark area, etc.) The standard advice for avoiding this problem * is to ensure that the "corners" of the color cube are allocated as output * colors; then repeated errors in the same direction cannot cause cascading * error buildup. However, that only prevents the error from getting * completely out of hand; Aaron Giles reports that error limiting improves * the results even with corner colors allocated. * A simple clamping of the error values to about +- MAXJSAMPLE/8 works pretty * well, but the smoother transfer function used below is even better. Thanks * to Aaron Giles for this idea. */ LOCAL(void) init_error_limit (j_decompress_ptr cinfo) /* Allocate and fill in the error_limiter table */ { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; int * table; int in, out; table = (int *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE*2+1) * SIZEOF(int)); table += MAXJSAMPLE; /* so can index -MAXJSAMPLE .. +MAXJSAMPLE */ cquantize->error_limiter = table; #define STEPSIZE ((MAXJSAMPLE+1)/16) /* Map errors 1:1 up to +- MAXJSAMPLE/16 */ out = 0; for (in = 0; in < STEPSIZE; in++, out++) { table[in] = out; table[-in] = -out; } /* Map errors 1:2 up to +- 3*MAXJSAMPLE/16 */ for (; in < STEPSIZE*3; in++, out += (in&1) ? 0 : 1) { table[in] = out; table[-in] = -out; } /* Clamp the rest to final out value (which is (MAXJSAMPLE+1)/8) */ for (; in <= MAXJSAMPLE; in++) { table[in] = out; table[-in] = -out; } #undef STEPSIZE } /* * Finish up at the end of each pass. */ METHODDEF(void) finish_pass1 (j_decompress_ptr cinfo) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; /* Select the representative colors and fill in cinfo->colormap */ cinfo->colormap = cquantize->sv_colormap; select_colors(cinfo, cquantize->desired); /* Force next pass to zero the color index table */ cquantize->needs_zeroed = TRUE; } METHODDEF(void) finish_pass2 (j_decompress_ptr cinfo) { (void)cinfo; /* no work */ } /* * Initialize for each processing pass. */ METHODDEF(void) start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; hist3d histogram = cquantize->histogram; int i; /* Only F-S dithering or no dithering is supported. */ /* If user asks for ordered dither, give him F-S. */ if (cinfo->dither_mode != JDITHER_NONE) cinfo->dither_mode = JDITHER_FS; if (is_pre_scan) { /* Set up method pointers */ cquantize->pub.color_quantize = prescan_quantize; cquantize->pub.finish_pass = finish_pass1; cquantize->needs_zeroed = TRUE; /* Always zero histogram */ } else { /* Set up method pointers */ if (cinfo->dither_mode == JDITHER_FS) cquantize->pub.color_quantize = pass2_fs_dither; else cquantize->pub.color_quantize = pass2_no_dither; cquantize->pub.finish_pass = finish_pass2; /* Make sure color count is acceptable */ i = cinfo->actual_number_of_colors; if (i < 1) ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, 1); if (i > MAXNUMCOLORS) ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS); if (cinfo->dither_mode == JDITHER_FS) { size_t arraysize = (size_t) ((cinfo->output_width + 2) * (3 * SIZEOF(FSERROR))); /* Allocate Floyd-Steinberg workspace if we didn't already. */ if (cquantize->fserrors == NULL) cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, arraysize); /* Initialize the propagated errors to zero. */ jzero_far((void FAR *) cquantize->fserrors, arraysize); /* Make the error-limit table if we didn't already. */ if (cquantize->error_limiter == NULL) init_error_limit(cinfo); cquantize->on_odd_row = FALSE; } } /* Zero the histogram or inverse color map, if necessary */ if (cquantize->needs_zeroed) { for (i = 0; i < HIST_C0_ELEMS; i++) { jzero_far((void FAR *) histogram[i], HIST_C1_ELEMS*HIST_C2_ELEMS * SIZEOF(histcell)); } cquantize->needs_zeroed = FALSE; } } /* * Switch to a new external colormap between output passes. */ METHODDEF(void) new_color_map_2_quant (j_decompress_ptr cinfo) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; /* Reset the inverse color map */ cquantize->needs_zeroed = TRUE; } /* * Module initialization routine for 2-pass color quantization. */ GLOBAL(void) jinit_2pass_quantizer (j_decompress_ptr cinfo) { my_cquantize_ptr cquantize; int i; cquantize = (my_cquantize_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_cquantizer)); cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize; cquantize->pub.start_pass = start_pass_2_quant; cquantize->pub.new_color_map = new_color_map_2_quant; cquantize->fserrors = NULL; /* flag optional arrays not allocated */ cquantize->error_limiter = NULL; /* Make sure jdmaster didn't give me a case I can't handle */ if (cinfo->out_color_components != 3) ERREXIT(cinfo, JERR_NOTIMPL); /* Allocate the histogram/inverse colormap storage */ cquantize->histogram = (hist3d) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, HIST_C0_ELEMS * SIZEOF(hist2d)); for (i = 0; i < HIST_C0_ELEMS; i++) { cquantize->histogram[i] = (hist2d) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, HIST_C1_ELEMS*HIST_C2_ELEMS * SIZEOF(histcell)); } cquantize->needs_zeroed = TRUE; /* histogram is garbage now */ /* Allocate storage for the completed colormap, if required. * We do this now since it is FAR storage and may affect * the memory manager's space calculations. */ if (cinfo->enable_2pass_quant) { /* Make sure color count is acceptable */ int desired = cinfo->desired_number_of_colors; /* Lower bound on # of colors ... somewhat arbitrary as long as > 0 */ if (desired < 8) ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, 8); /* Make sure colormap indexes can be represented by JSAMPLEs */ if (desired > MAXNUMCOLORS) ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS); cquantize->sv_colormap = (*cinfo->mem->alloc_sarray) ((j_common_ptr) cinfo,JPOOL_IMAGE, (JDIMENSION) desired, (JDIMENSION) 3); cquantize->desired = desired; } else cquantize->sv_colormap = NULL; /* Only F-S dithering or no dithering is supported. */ /* If user asks for ordered dither, give him F-S. */ if (cinfo->dither_mode != JDITHER_NONE) cinfo->dither_mode = JDITHER_FS; /* Allocate Floyd-Steinberg workspace if necessary. * This isn't really needed until pass 2, but again it is FAR storage. * Although we will cope with a later change in dither_mode, * we do not promise to honor max_memory_to_use if dither_mode changes. */ if (cinfo->dither_mode == JDITHER_FS) { cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, (size_t) ((cinfo->output_width + 2) * (3 * SIZEOF(FSERROR)))); /* Might as well create the error-limiting table too. */ init_error_limit(cinfo); } } #endif /* QUANT_2PASS_SUPPORTED */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jcmaster.c�����������������������������������������������0000644�0001750�0001750�00000053267�12320456500�022011� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jcmaster.c * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains master control logic for the JPEG compressor. * These routines are concerned with parameter validation, initial setup, * and inter-pass control (determining the number of passes and the work * to be done in each pass). */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossy.h" /* Private declarations for lossy codec */ /* Private state */ typedef enum { main_pass, /* input data, also do first output step */ huff_opt_pass, /* Huffman code optimization pass */ output_pass /* data output pass */ } c_pass_type; typedef struct { struct jpeg_comp_master pub; /* public fields */ c_pass_type pass_type; /* the type of the current pass */ int pass_number; /* # of passes completed */ int total_passes; /* total # of passes needed */ int scan_number; /* current index in scan_info[] */ } my_comp_master; typedef my_comp_master * my_master_ptr; /* * Support routines that do various essential calculations. */ LOCAL(void) initial_setup (j_compress_ptr cinfo) /* Do computations that are needed before master selection phase */ { int ci; jpeg_component_info *compptr; long samplesperrow; JDIMENSION jd_samplesperrow; int data_unit = cinfo->data_unit; /* Sanity check on image dimensions */ if (cinfo->image_height <= 0 || cinfo->image_width <= 0 || cinfo->num_components <= 0 || cinfo->input_components <= 0) ERREXIT(cinfo, JERR_EMPTY_IMAGE); /* Make sure image isn't bigger than I can handle */ if ((long) cinfo->image_height > (long) JPEG_MAX_DIMENSION || (long) cinfo->image_width > (long) JPEG_MAX_DIMENSION) ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION); /* Width of an input scanline must be representable as JDIMENSION. */ samplesperrow = (long) cinfo->image_width * (long) cinfo->input_components; jd_samplesperrow = (JDIMENSION) samplesperrow; if ((long) jd_samplesperrow != samplesperrow) ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); /* For now, precision must match compiled-in value... */ if (cinfo->data_precision != BITS_IN_JSAMPLE) ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision); /* Check that number of components won't exceed internal array sizes */ if (cinfo->num_components > MAX_COMPONENTS) ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, MAX_COMPONENTS); /* Compute maximum sampling factors; check factor validity */ cinfo->max_h_samp_factor = 1; cinfo->max_v_samp_factor = 1; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR || compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR) ERREXIT(cinfo, JERR_BAD_SAMPLING); cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor, compptr->h_samp_factor); cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor, compptr->v_samp_factor); } /* Compute dimensions of components */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { /* Fill in the correct component_index value; don't rely on application */ compptr->component_index = ci; /* For compression, we never do any codec-based processing. */ compptr->codec_data_unit = data_unit; /* Size in data units */ compptr->width_in_data_units = (JDIMENSION) jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor, (long) (cinfo->max_h_samp_factor * data_unit)); compptr->height_in_data_units = (JDIMENSION) jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor, (long) (cinfo->max_v_samp_factor * data_unit)); /* Size in samples */ compptr->downsampled_width = (JDIMENSION) jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor, (long) cinfo->max_h_samp_factor); compptr->downsampled_height = (JDIMENSION) jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor, (long) cinfo->max_v_samp_factor); /* Mark component needed (this flag isn't actually used for compression) */ compptr->component_needed = TRUE; } /* Compute number of fully interleaved MCU rows (number of times that * main controller will call coefficient controller). */ cinfo->total_iMCU_rows = (JDIMENSION) jdiv_round_up((long) cinfo->image_height, (long) (cinfo->max_v_samp_factor*data_unit)); } #ifdef C_MULTISCAN_FILES_SUPPORTED #define NEED_SCAN_SCRIPT #else #ifdef C_LOSSLESS_SUPPORTED #define NEED_SCAN_SCRIPT #endif #endif #ifdef NEED_SCAN_SCRIPT LOCAL(void) validate_script (j_compress_ptr cinfo) /* Verify that the scan script in cinfo->scan_info[] is valid; also * determine whether it uses progressive JPEG, and set cinfo->process. */ { const jpeg_scan_info * scanptr; int scanno, ncomps, ci, coefi, thisi; int Ss, Se, Ah, Al; boolean component_sent[MAX_COMPONENTS]; #ifdef C_PROGRESSIVE_SUPPORTED int * last_bitpos_ptr; int last_bitpos[MAX_COMPONENTS][DCTSIZE2]; /* -1 until that coefficient has been seen; then last Al for it */ #endif if (cinfo->num_scans <= 0) ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, 0); #ifndef C_MULTISCAN_FILES_SUPPORTED if (cinfo->num_scans > 1) ERREXIT(cinfo, JERR_NOT_COMPILED); #endif scanptr = cinfo->scan_info; if (cinfo->lossless) { #ifdef C_LOSSLESS_SUPPORTED cinfo->process = JPROC_LOSSLESS; for (ci = 0; ci < cinfo->num_components; ci++) component_sent[ci] = FALSE; #else ERREXIT(cinfo, JERR_NOT_COMPILED); #endif } /* For sequential JPEG, all scans must have Ss=0, Se=DCTSIZE2-1; * for progressive JPEG, no scan can have this. */ else if (scanptr->Ss != 0 || scanptr->Se != DCTSIZE2-1) { #ifdef C_PROGRESSIVE_SUPPORTED cinfo->process = JPROC_PROGRESSIVE; last_bitpos_ptr = & last_bitpos[0][0]; for (ci = 0; ci < cinfo->num_components; ci++) for (coefi = 0; coefi < DCTSIZE2; coefi++) *last_bitpos_ptr++ = -1; #else ERREXIT(cinfo, JERR_NOT_COMPILED); #endif } else { cinfo->process = JPROC_SEQUENTIAL; for (ci = 0; ci < cinfo->num_components; ci++) component_sent[ci] = FALSE; } for (scanno = 1; scanno <= cinfo->num_scans; scanptr++, scanno++) { /* Validate component indexes */ ncomps = scanptr->comps_in_scan; if (ncomps <= 0 || ncomps > MAX_COMPS_IN_SCAN) ERREXIT2(cinfo, JERR_COMPONENT_COUNT, ncomps, MAX_COMPS_IN_SCAN); for (ci = 0; ci < ncomps; ci++) { thisi = scanptr->component_index[ci]; if (thisi < 0 || thisi >= cinfo->num_components) ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); /* Components must appear in SOF order within each scan */ if (ci > 0 && thisi <= scanptr->component_index[ci-1]) ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); } /* Validate progression parameters */ Ss = scanptr->Ss; Se = scanptr->Se; Ah = scanptr->Ah; Al = scanptr->Al; if (cinfo->process == JPROC_LOSSLESS) { #ifdef C_LOSSLESS_SUPPORTED /* The JPEG spec simply gives the range 0..15 for Al (Pt), but that * seems wrong: the upper bound ought to depend on data precision. * Perhaps they really meant 0..N-1 for N-bit precision, which is what * we allow here. */ if (Ss < 1 || Ss > 7 || /* predictor selector */ Se != 0 || Ah != 0 || Al < 0 || Al >= cinfo->data_precision) /* point transform */ ERREXIT1(cinfo, JERR_BAD_LOSSLESS_SCRIPT, scanno); /* Make sure components are not sent twice */ for (ci = 0; ci < ncomps; ci++) { thisi = scanptr->component_index[ci]; if (component_sent[thisi]) ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); component_sent[thisi] = TRUE; } #endif } else if (cinfo->process == JPROC_PROGRESSIVE) { #ifdef C_PROGRESSIVE_SUPPORTED /* The JPEG spec simply gives the ranges 0..13 for Ah and Al, but that * seems wrong: the upper bound ought to depend on data precision. * Perhaps they really meant 0..N+1 for N-bit precision. * Here we allow 0..10 for 8-bit data; Al larger than 10 results in * out-of-range reconstructed DC values during the first DC scan, * which might cause problems for some decoders. */ #if BITS_IN_JSAMPLE == 8 #define MAX_AH_AL 10 #else #define MAX_AH_AL 13 #endif if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 || Ah < 0 || Ah > MAX_AH_AL || Al < 0 || Al > MAX_AH_AL) ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); if (Ss == 0) { if (Se != 0) /* DC and AC together not OK */ ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); } else { if (ncomps != 1) /* AC scans must be for only one component */ ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); } for (ci = 0; ci < ncomps; ci++) { last_bitpos_ptr = & last_bitpos[scanptr->component_index[ci]][0]; if (Ss != 0 && last_bitpos_ptr[0] < 0) /* AC without prior DC scan */ ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); for (coefi = Ss; coefi <= Se; coefi++) { if (last_bitpos_ptr[coefi] < 0) { /* first scan of this coefficient */ if (Ah != 0) ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); } else { /* not first scan */ if (Ah != last_bitpos_ptr[coefi] || Al != Ah-1) ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); } last_bitpos_ptr[coefi] = Al; } } #endif } else { /* For sequential JPEG, all progression parameters must be these: */ if (Ss != 0 || Se != DCTSIZE2-1 || Ah != 0 || Al != 0) ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); /* Make sure components are not sent twice */ for (ci = 0; ci < ncomps; ci++) { thisi = scanptr->component_index[ci]; if (component_sent[thisi]) ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); component_sent[thisi] = TRUE; } } } /* Now verify that everything got sent. */ if (cinfo->process == JPROC_PROGRESSIVE) { #ifdef C_PROGRESSIVE_SUPPORTED /* For progressive mode, we only check that at least some DC data * got sent for each component; the spec does not require that all bits * of all coefficients be transmitted. Would it be wiser to enforce * transmission of all coefficient bits?? */ for (ci = 0; ci < cinfo->num_components; ci++) { if (last_bitpos[ci][0] < 0) ERREXIT(cinfo, JERR_MISSING_DATA); } #endif } else { for (ci = 0; ci < cinfo->num_components; ci++) { if (! component_sent[ci]) ERREXIT(cinfo, JERR_MISSING_DATA); } } } #endif /* NEED_SCAN_SCRIPT */ LOCAL(void) select_scan_parameters (j_compress_ptr cinfo) /* Set up the scan parameters for the current scan */ { int ci; #ifdef NEED_SCAN_SCRIPT if (cinfo->scan_info != NULL) { /* Prepare for current scan --- the script is already validated */ my_master_ptr master = (my_master_ptr) cinfo->master; const jpeg_scan_info * scanptr = cinfo->scan_info + master->scan_number; cinfo->comps_in_scan = scanptr->comps_in_scan; for (ci = 0; ci < scanptr->comps_in_scan; ci++) { cinfo->cur_comp_info[ci] = &cinfo->comp_info[scanptr->component_index[ci]]; } cinfo->Ss = scanptr->Ss; cinfo->Se = scanptr->Se; cinfo->Ah = scanptr->Ah; cinfo->Al = scanptr->Al; } else #endif { /* Prepare for single sequential-JPEG scan containing all components */ if (cinfo->num_components > MAX_COMPS_IN_SCAN) ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, MAX_COMPS_IN_SCAN); cinfo->comps_in_scan = cinfo->num_components; for (ci = 0; ci < cinfo->num_components; ci++) { cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci]; } if (cinfo->lossless) { #ifdef C_LOSSLESS_SUPPORTED /* If we fall through to here, the user specified lossless, but did not * provide a scan script. */ ERREXIT(cinfo, JERR_NO_LOSSLESS_SCRIPT); #endif } else { cinfo->process = JPROC_SEQUENTIAL; cinfo->Ss = 0; cinfo->Se = DCTSIZE2-1; cinfo->Ah = 0; cinfo->Al = 0; } } } LOCAL(void) per_scan_setup (j_compress_ptr cinfo) /* Do computations that are needed before processing a JPEG scan */ /* cinfo->comps_in_scan and cinfo->cur_comp_info[] are already set */ { int ci, mcublks, tmp; jpeg_component_info *compptr; int data_unit = cinfo->data_unit; if (cinfo->comps_in_scan == 1) { /* Noninterleaved (single-component) scan */ compptr = cinfo->cur_comp_info[0]; /* Overall image size in MCUs */ cinfo->MCUs_per_row = compptr->width_in_data_units; cinfo->MCU_rows_in_scan = compptr->height_in_data_units; /* For noninterleaved scan, always one block per MCU */ compptr->MCU_width = 1; compptr->MCU_height = 1; compptr->MCU_data_units = 1; compptr->MCU_sample_width = data_unit; compptr->last_col_width = 1; /* For noninterleaved scans, it is convenient to define last_row_height * as the number of block rows present in the last iMCU row. */ tmp = (int) (compptr->height_in_data_units % compptr->v_samp_factor); if (tmp == 0) tmp = compptr->v_samp_factor; compptr->last_row_height = tmp; /* Prepare array describing MCU composition */ cinfo->data_units_in_MCU = 1; cinfo->MCU_membership[0] = 0; } else { /* Interleaved (multi-component) scan */ if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN) ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan, MAX_COMPS_IN_SCAN); /* Overall image size in MCUs */ cinfo->MCUs_per_row = (JDIMENSION) jdiv_round_up((long) cinfo->image_width, (long) (cinfo->max_h_samp_factor*data_unit)); cinfo->MCU_rows_in_scan = (JDIMENSION) jdiv_round_up((long) cinfo->image_height, (long) (cinfo->max_v_samp_factor*data_unit)); cinfo->data_units_in_MCU = 0; for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; /* Sampling factors give # of blocks of component in each MCU */ compptr->MCU_width = compptr->h_samp_factor; compptr->MCU_height = compptr->v_samp_factor; compptr->MCU_data_units = compptr->MCU_width * compptr->MCU_height; compptr->MCU_sample_width = compptr->MCU_width * data_unit; /* Figure number of non-dummy blocks in last MCU column & row */ tmp = (int) (compptr->width_in_data_units % compptr->MCU_width); if (tmp == 0) tmp = compptr->MCU_width; compptr->last_col_width = tmp; tmp = (int) (compptr->height_in_data_units % compptr->MCU_height); if (tmp == 0) tmp = compptr->MCU_height; compptr->last_row_height = tmp; /* Prepare array describing MCU composition */ mcublks = compptr->MCU_data_units; if (cinfo->data_units_in_MCU + mcublks > C_MAX_DATA_UNITS_IN_MCU) ERREXIT(cinfo, JERR_BAD_MCU_SIZE); while (mcublks-- > 0) { cinfo->MCU_membership[cinfo->data_units_in_MCU++] = ci; } } } /* Convert restart specified in rows to actual MCU count. */ /* Note that count must fit in 16 bits, so we provide limiting. */ if (cinfo->restart_in_rows > 0) { long nominal = (long) cinfo->restart_in_rows * (long) cinfo->MCUs_per_row; cinfo->restart_interval = (unsigned int) MIN(nominal, 65535L); } } /* * Per-pass setup. * This is called at the beginning of each pass. We determine which modules * will be active during this pass and give them appropriate start_pass calls. * We also set is_last_pass to indicate whether any more passes will be * required. */ METHODDEF(void) prepare_for_pass (j_compress_ptr cinfo) { /* j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; */ my_master_ptr master = (my_master_ptr) cinfo->master; switch (master->pass_type) { case main_pass: /* Initial pass: will collect input data, and do either Huffman * optimization or data output for the first scan. */ select_scan_parameters(cinfo); per_scan_setup(cinfo); if (! cinfo->raw_data_in) { (*cinfo->cconvert->start_pass) (cinfo); (*cinfo->downsample->start_pass) (cinfo); (*cinfo->prep->start_pass) (cinfo, JBUF_PASS_THRU); } (*cinfo->codec->entropy_start_pass) (cinfo, cinfo->optimize_coding); (*cinfo->codec->start_pass) (cinfo, (master->total_passes > 1 ? JBUF_SAVE_AND_PASS : JBUF_PASS_THRU)); (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU); if (cinfo->optimize_coding) { /* No immediate data output; postpone writing frame/scan headers */ master->pub.call_pass_startup = FALSE; } else { /* Will write frame/scan headers at first jpeg_write_scanlines call */ master->pub.call_pass_startup = TRUE; } break; #ifdef ENTROPY_OPT_SUPPORTED case huff_opt_pass: /* Do Huffman optimization for a scan after the first one. */ select_scan_parameters(cinfo); per_scan_setup(cinfo); #ifdef WITH_ARITHMETIC_PATCH if ((*cinfo->codec->need_optimization_pass) (cinfo)) { #else if ((*cinfo->codec->need_optimization_pass) (cinfo) || cinfo->arith_code) { #endif (*cinfo->codec->entropy_start_pass) (cinfo, TRUE); (*cinfo->codec->start_pass) (cinfo, JBUF_CRANK_DEST); master->pub.call_pass_startup = FALSE; break; } /* Special case: Huffman DC refinement scans need no Huffman table * and therefore we can skip the optimization pass for them. */ master->pass_type = output_pass; master->pass_number++; /*FALLTHROUGH*/ #endif case output_pass: /* Do a data-output pass. */ /* We need not repeat per-scan setup if prior optimization pass did it. */ if (! cinfo->optimize_coding) { select_scan_parameters(cinfo); per_scan_setup(cinfo); } (*cinfo->codec->entropy_start_pass) (cinfo, FALSE); (*cinfo->codec->start_pass) (cinfo, JBUF_CRANK_DEST); /* We emit frame/scan headers now */ if (master->scan_number == 0) (*cinfo->marker->write_frame_header) (cinfo); (*cinfo->marker->write_scan_header) (cinfo); master->pub.call_pass_startup = FALSE; break; default: ERREXIT(cinfo, JERR_NOT_COMPILED); } master->pub.is_last_pass = (master->pass_number == master->total_passes-1); /* Set up progress monitor's pass info if present */ if (cinfo->progress != NULL) { cinfo->progress->completed_passes = master->pass_number; cinfo->progress->total_passes = master->total_passes; } } /* * Special start-of-pass hook. * This is called by jpeg_write_scanlines if call_pass_startup is TRUE. * In single-pass processing, we need this hook because we don't want to * write frame/scan headers during jpeg_start_compress; we want to let the * application write COM markers etc. between jpeg_start_compress and the * jpeg_write_scanlines loop. * In multi-pass processing, this routine is not used. */ METHODDEF(void) pass_startup (j_compress_ptr cinfo) { cinfo->master->call_pass_startup = FALSE; /* reset flag so call only once */ (*cinfo->marker->write_frame_header) (cinfo); (*cinfo->marker->write_scan_header) (cinfo); } /* * Finish up at end of pass. */ METHODDEF(void) finish_pass_master (j_compress_ptr cinfo) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; my_master_ptr master = (my_master_ptr) cinfo->master; /* The entropy coder always needs an end-of-pass call, * either to analyze statistics or to flush its output buffer. */ (*lossyc->pub.entropy_finish_pass) (cinfo); /* Update state for next pass */ switch (master->pass_type) { case main_pass: /* next pass is either output of scan 0 (after optimization) * or output of scan 1 (if no optimization). */ master->pass_type = output_pass; if (! cinfo->optimize_coding) master->scan_number++; break; case huff_opt_pass: /* next pass is always output of current scan */ master->pass_type = output_pass; break; case output_pass: /* next pass is either optimization or output of next scan */ if (cinfo->optimize_coding) master->pass_type = huff_opt_pass; master->scan_number++; break; } master->pass_number++; } /* * Initialize master compression control. */ GLOBAL(void) jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only) { my_master_ptr master; master = (my_master_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_comp_master)); cinfo->master = (struct jpeg_comp_master *) master; master->pub.prepare_for_pass = prepare_for_pass; master->pub.pass_startup = pass_startup; master->pub.finish_pass = finish_pass_master; master->pub.is_last_pass = FALSE; cinfo->data_unit = cinfo->lossless ? 1 : DCTSIZE; /* Validate parameters, determine derived values */ initial_setup(cinfo); if (cinfo->scan_info != NULL) { #ifdef NEED_SCAN_SCRIPT validate_script(cinfo); #else ERREXIT(cinfo, JERR_NOT_COMPILED); #endif } else { cinfo->process = JPROC_SEQUENTIAL; cinfo->num_scans = 1; } #ifdef WITH_ARITHMETIC_PATCH if ((cinfo->arith_code == 0) && (cinfo->process == JPROC_PROGRESSIVE || /* TEMPORARY HACK ??? */ cinfo->process == JPROC_LOSSLESS)) #else if (cinfo->process == JPROC_PROGRESSIVE || /* TEMPORARY HACK ??? */ cinfo->process == JPROC_LOSSLESS) #endif cinfo->optimize_coding = TRUE; /* assume default tables no good for * progressive mode or lossless mode */ /* Initialize my private state */ if (transcode_only) { /* no main pass in transcoding */ if (cinfo->optimize_coding) master->pass_type = huff_opt_pass; else master->pass_type = output_pass; } else { /* for normal compression, first pass is always this type: */ master->pass_type = main_pass; } master->scan_number = 0; master->pass_number = 0; if (cinfo->optimize_coding) master->total_passes = cinfo->num_scans * 2; else master->total_passes = cinfo->num_scans; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jcdiffct.c�����������������������������������������������0000644�0001750�0001750�00000033632�12320456500�021747� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jcdiffct.c * * Copyright (C) 1994-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains the difference buffer controller for compression. * This controller is the top level of the lossless JPEG compressor proper. * The difference buffer lies between prediction/differencing and entropy * encoding. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossls.h" /* Private declarations for lossless codec */ #ifdef C_LOSSLESS_SUPPORTED /* We use a full-image sample buffer when doing Huffman optimization, * and also for writing multiple-scan JPEG files. In all cases, the * full-image buffer is filled during the first pass, and the scaling, * prediction and differencing steps are run during subsequent passes. */ #ifdef ENTROPY_OPT_SUPPORTED #define FULL_SAMP_BUFFER_SUPPORTED #else #ifdef C_MULTISCAN_FILES_SUPPORTED #define FULL_SAMP_BUFFER_SUPPORTED #endif #endif /* Private buffer controller object */ typedef struct { JDIMENSION iMCU_row_num; /* iMCU row # within image */ JDIMENSION mcu_ctr; /* counts MCUs processed in current row */ int MCU_vert_offset; /* counts MCU rows within iMCU row */ int MCU_rows_per_iMCU_row; /* number of such rows needed */ JSAMPROW cur_row[MAX_COMPONENTS]; /* row of point transformed samples */ JSAMPROW prev_row[MAX_COMPONENTS]; /* previous row of Pt'd samples */ JDIFFARRAY diff_buf[MAX_COMPONENTS]; /* iMCU row of differences */ /* In multi-pass modes, we need a virtual sample array for each component. */ jvirt_sarray_ptr whole_image[MAX_COMPONENTS]; } c_diff_controller; typedef c_diff_controller * c_diff_ptr; /* Forward declarations */ METHODDEF(boolean) compress_data JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf)); #ifdef FULL_SAMP_BUFFER_SUPPORTED METHODDEF(boolean) compress_first_pass JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf)); METHODDEF(boolean) compress_output JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf)); #endif LOCAL(void) start_iMCU_row (j_compress_ptr cinfo) /* Reset within-iMCU-row counters for a new row */ { j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; c_diff_ptr diff = (c_diff_ptr) losslsc->diff_private; /* In an interleaved scan, an MCU row is the same as an iMCU row. * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows. * But at the bottom of the image, process only what's left. */ if (cinfo->comps_in_scan > 1) { diff->MCU_rows_per_iMCU_row = 1; } else { if (diff->iMCU_row_num < (cinfo->total_iMCU_rows-1)) diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor; else diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height; } diff->mcu_ctr = 0; diff->MCU_vert_offset = 0; } /* * Initialize for a processing pass. */ METHODDEF(void) start_pass_diff (j_compress_ptr cinfo, J_BUF_MODE pass_mode) { j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; c_diff_ptr diff = (c_diff_ptr) losslsc->diff_private; diff->iMCU_row_num = 0; start_iMCU_row(cinfo); switch (pass_mode) { case JBUF_PASS_THRU: if (diff->whole_image[0] != NULL) ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); losslsc->pub.compress_data = compress_data; break; #ifdef FULL_SAMP_BUFFER_SUPPORTED case JBUF_SAVE_AND_PASS: if (diff->whole_image[0] == NULL) ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); losslsc->pub.compress_data = compress_first_pass; break; case JBUF_CRANK_DEST: if (diff->whole_image[0] == NULL) ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); losslsc->pub.compress_data = compress_output; break; #endif default: ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); break; } } #define SWAP_ROWS(rowa,rowb) {JSAMPROW temp; temp=rowa; rowa=rowb; rowb=temp;} /* * Process some data in the single-pass case. * We process the equivalent of one fully interleaved MCU row ("iMCU" row) * per call, ie, v_samp_factor rows for each component in the image. * Returns TRUE if the iMCU row is completed, FALSE if suspended. * * NB: input_buf contains a plane for each component in image, * which we index according to the component's SOF position. */ METHODDEF(boolean) compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf) { j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; c_diff_ptr diff = (c_diff_ptr) losslsc->diff_private; JDIMENSION MCU_col_num; /* index of current MCU within row */ JDIMENSION MCU_count; /* number of MCUs encoded */ /* JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1; */ JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; int comp, ci, yoffset, samp_row, samp_rows, samps_across; jpeg_component_info *compptr; /* Loop to write as much as one whole iMCU row */ for (yoffset = diff->MCU_vert_offset; yoffset < diff->MCU_rows_per_iMCU_row; yoffset++) { MCU_col_num = diff->mcu_ctr; /* Scale and predict each scanline of the MCU-row separately. * * Note: We only do this if we are at the start of a MCU-row, ie, * we don't want to reprocess a row suspended by the output. */ if (MCU_col_num == 0) { for (comp = 0; comp < cinfo->comps_in_scan; comp++) { compptr = cinfo->cur_comp_info[comp]; ci = compptr->component_index; if (diff->iMCU_row_num < last_iMCU_row) samp_rows = compptr->v_samp_factor; else { /* NB: can't use last_row_height here, since may not be set! */ samp_rows = (int) (compptr->height_in_data_units % compptr->v_samp_factor); if (samp_rows == 0) samp_rows = compptr->v_samp_factor; else { /* Fill dummy difference rows at the bottom edge with zeros, which * will encode to the smallest amount of data. */ for (samp_row = samp_rows; samp_row < compptr->v_samp_factor; samp_row++) MEMZERO(diff->diff_buf[ci][samp_row], jround_up((long) compptr->width_in_data_units, (long) compptr->h_samp_factor) * SIZEOF(JDIFF)); } } samps_across = compptr->width_in_data_units; for (samp_row = 0; samp_row < samp_rows; samp_row++) { (*losslsc->scaler_scale) (cinfo, input_buf[ci][samp_row], diff->cur_row[ci], samps_across); (*losslsc->predict_difference[ci]) (cinfo, ci, diff->cur_row[ci], diff->prev_row[ci], diff->diff_buf[ci][samp_row], samps_across); SWAP_ROWS(diff->cur_row[ci], diff->prev_row[ci]); } } } /* Try to write the MCU-row (or remaining portion of suspended MCU-row). */ MCU_count = (*losslsc->entropy_encode_mcus) (cinfo, diff->diff_buf, yoffset, MCU_col_num, cinfo->MCUs_per_row - MCU_col_num); if (MCU_count != cinfo->MCUs_per_row - MCU_col_num) { /* Suspension forced; update state counters and exit */ diff->MCU_vert_offset = yoffset; diff->mcu_ctr += MCU_col_num; return FALSE; } /* Completed an MCU row, but perhaps not an iMCU row */ diff->mcu_ctr = 0; } /* Completed the iMCU row, advance counters for next one */ diff->iMCU_row_num++; start_iMCU_row(cinfo); return TRUE; } #ifdef FULL_SAMP_BUFFER_SUPPORTED /* * Process some data in the first pass of a multi-pass case. * We process the equivalent of one fully interleaved MCU row ("iMCU" row) * per call, ie, v_samp_factor rows for each component in the image. * This amount of data is read from the source buffer and saved into the * virtual arrays. * * We must also emit the data to the compressor. This is conveniently * done by calling compress_output() after we've loaded the current strip * of the virtual arrays. * * NB: input_buf contains a plane for each component in image. All components * are loaded into the virtual arrays in this pass. However, it may be that * only a subset of the components are emitted to the compressor during * this first pass; be careful about looking at the scan-dependent variables * (MCU dimensions, etc). */ METHODDEF(boolean) compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf) { j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; c_diff_ptr diff = (c_diff_ptr) losslsc->diff_private; JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; JDIMENSION samps_across; int ci, samp_row, samp_rows; JSAMPARRAY buffer[MAX_COMPONENTS]; jpeg_component_info *compptr; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { /* Align the virtual buffers for this component. */ buffer[ci] = (*cinfo->mem->access_virt_sarray) ((j_common_ptr) cinfo, diff->whole_image[ci], diff->iMCU_row_num * compptr->v_samp_factor, (JDIMENSION) compptr->v_samp_factor, TRUE); /* Count non-dummy sample rows in this iMCU row. */ if (diff->iMCU_row_num < last_iMCU_row) samp_rows = compptr->v_samp_factor; else { /* NB: can't use last_row_height here, since may not be set! */ samp_rows = (int) (compptr->height_in_data_units % compptr->v_samp_factor); if (samp_rows == 0) samp_rows = compptr->v_samp_factor; } samps_across = compptr->width_in_data_units; /* Perform point transform scaling and prediction/differencing for all * non-dummy rows in this iMCU row. Each call on these functions * process a complete row of samples. */ for (samp_row = 0; samp_row < samp_rows; samp_row++) { MEMCOPY(buffer[ci][samp_row], input_buf[ci][samp_row], samps_across * SIZEOF(JSAMPLE)); } } /* NB: compress_output will increment iMCU_row_num if successful. * A suspension return will result in redoing all the work above next time. */ /* Emit data to the compressor, sharing code with subsequent passes */ return compress_output(cinfo, input_buf); } /* * Process some data in subsequent passes of a multi-pass case. * We process the equivalent of one fully interleaved MCU row ("iMCU" row) * per call, ie, v_samp_factor rows for each component in the scan. * The data is obtained from the virtual arrays and fed to the compressor. * Returns TRUE if the iMCU row is completed, FALSE if suspended. * * NB: input_buf is ignored; it is likely to be a NULL pointer. */ METHODDEF(boolean) compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) { j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; c_diff_ptr diff = (c_diff_ptr) losslsc->diff_private; /* JDIMENSION MCU_col_num; */ /* index of current MCU within row */ /* JDIMENSION MCU_count; */ /* number of MCUs encoded */ int comp, ci /* , yoffset */ ; JSAMPARRAY buffer[MAX_COMPONENTS]; jpeg_component_info *compptr; (void)input_buf; /* Align the virtual buffers for the components used in this scan. * NB: during first pass, this is safe only because the buffers will * already be aligned properly, so jmemmgr.c won't need to do any I/O. */ for (comp = 0; comp < cinfo->comps_in_scan; comp++) { compptr = cinfo->cur_comp_info[comp]; ci = compptr->component_index; buffer[ci] = (*cinfo->mem->access_virt_sarray) ((j_common_ptr) cinfo, diff->whole_image[ci], diff->iMCU_row_num * compptr->v_samp_factor, (JDIMENSION) compptr->v_samp_factor, FALSE); } return compress_data(cinfo, buffer); } #endif /* FULL_SAMP_BUFFER_SUPPORTED */ /* * Initialize difference buffer controller. */ GLOBAL(void) jinit_c_diff_controller (j_compress_ptr cinfo, boolean need_full_buffer) { j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; c_diff_ptr diff; int ci, row; jpeg_component_info *compptr; diff = (c_diff_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(c_diff_controller)); losslsc->diff_private = (void *) diff; losslsc->diff_start_pass = start_pass_diff; /* Create the prediction row buffers. */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { diff->cur_row[ci] = *(*cinfo->mem->alloc_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, (JDIMENSION) jround_up((long) compptr->width_in_data_units, (long) compptr->h_samp_factor), (JDIMENSION) 1); diff->prev_row[ci] = *(*cinfo->mem->alloc_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, (JDIMENSION) jround_up((long) compptr->width_in_data_units, (long) compptr->h_samp_factor), (JDIMENSION) 1); } /* Create the difference buffer. */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { diff->diff_buf[ci] = (*cinfo->mem->alloc_darray) ((j_common_ptr) cinfo, JPOOL_IMAGE, (JDIMENSION) jround_up((long) compptr->width_in_data_units, (long) compptr->h_samp_factor), (JDIMENSION) compptr->v_samp_factor); /* Prefill difference rows with zeros. We do this because only actual * data is placed in the buffers during prediction/differencing, leaving * any dummy differences at the right edge as zeros, which will encode * to the smallest amount of data. */ for (row = 0; row < compptr->v_samp_factor; row++) MEMZERO(diff->diff_buf[ci][row], jround_up((long) compptr->width_in_data_units, (long) compptr->h_samp_factor) * SIZEOF(JDIFF)); } /* Create the sample buffer. */ if (need_full_buffer) { #ifdef FULL_SAMP_BUFFER_SUPPORTED /* Allocate a full-image virtual array for each component, */ /* padded to a multiple of samp_factor differences in each direction. */ int ci; jpeg_component_info *compptr; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, (JDIMENSION) jround_up((long) compptr->width_in_data_units, (long) compptr->h_samp_factor), (JDIMENSION) jround_up((long) compptr->height_in_data_units, (long) compptr->v_samp_factor), (JDIMENSION) compptr->v_samp_factor); } #else ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); #endif } else diff->whole_image[0] = NULL; /* flag for no virtual arrays */ } #endif /* C_LOSSLESS_SUPPORTED */ ������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jidctflt.c�����������������������������������������������0000644�0001750�0001750�00000020403�12320456500�021766� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jidctflt.c * * Copyright (C) 1994-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains a floating-point implementation of the * inverse DCT (Discrete Cosine Transform). In the IJG code, this routine * must also perform dequantization of the input coefficients. * * This implementation should be more accurate than either of the integer * IDCT implementations. However, it may not give the same results on all * machines because of differences in roundoff behavior. Speed will depend * on the hardware's floating point capacity. * * A 2-D IDCT can be done by 1-D IDCT on each column followed by 1-D IDCT * on each row (or vice versa, but it's more convenient to emit a row at * a time). Direct algorithms are also available, but they are much more * complex and seem not to be any faster when reduced to code. * * This implementation is based on Arai, Agui, and Nakajima's algorithm for * scaled DCT. Their original paper (Trans. IEICE E-71(11):1095) is in * Japanese, but the algorithm is described in the Pennebaker & Mitchell * JPEG textbook (see REFERENCES section in file README). The following code * is based directly on figure 4-8 in P&M. * While an 8-point DCT cannot be done in less than 11 multiplies, it is * possible to arrange the computation so that many of the multiplies are * simple scalings of the final outputs. These multiplies can then be * folded into the multiplications or divisions by the JPEG quantization * table entries. The AA&N method leaves only 5 multiplies and 29 adds * to be done in the DCT itself. * The primary disadvantage of this method is that with a fixed-point * implementation, accuracy is lost due to imprecise representation of the * scaled quantization values. However, that problem does not arise if * we use floating point arithmetic. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jdct.h" /* Private declarations for DCT subsystem */ #ifdef DCT_FLOAT_SUPPORTED /* * This module is specialized to the case DCTSIZE = 8. */ #if DCTSIZE != 8 Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ #endif /* Dequantize a coefficient by multiplying it by the multiplier-table * entry; produce a float result. */ #define DEQUANTIZE(coef,quantval) (((FAST_FLOAT) (coef)) * (quantval)) /* * Perform dequantization and inverse DCT on one block of coefficients. */ GLOBAL(void) jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; FAST_FLOAT tmp10, tmp11, tmp12, tmp13; FAST_FLOAT z5, z10, z11, z12, z13; JCOEFPTR inptr; FLOAT_MULT_TYPE * quantptr; FAST_FLOAT * wsptr; JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; FAST_FLOAT workspace[DCTSIZE2]; /* buffers data between passes */ SHIFT_TEMPS /* Pass 1: process columns from input, store into work array. */ inptr = coef_block; quantptr = (FLOAT_MULT_TYPE *) compptr->dct_table; wsptr = workspace; for (ctr = DCTSIZE; ctr > 0; ctr--) { /* Due to quantization, we will usually find that many of the input * coefficients are zero, especially the AC terms. We can exploit this * by short-circuiting the IDCT calculation for any column in which all * the AC terms are zero. In that case each output is equal to the * DC coefficient (with scale factor as needed). * With typical images and quantization tables, half or more of the * column DCT calculations can be simplified this way. */ if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*7] == 0) { /* AC terms all zero */ FAST_FLOAT dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); wsptr[DCTSIZE*0] = dcval; wsptr[DCTSIZE*1] = dcval; wsptr[DCTSIZE*2] = dcval; wsptr[DCTSIZE*3] = dcval; wsptr[DCTSIZE*4] = dcval; wsptr[DCTSIZE*5] = dcval; wsptr[DCTSIZE*6] = dcval; wsptr[DCTSIZE*7] = dcval; inptr++; /* advance pointers to next column */ quantptr++; wsptr++; continue; } /* Even part */ tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); tmp1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); tmp3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); tmp10 = tmp0 + tmp2; /* phase 3 */ tmp11 = tmp0 - tmp2; tmp13 = tmp1 + tmp3; /* phases 5-3 */ tmp12 = (tmp1 - tmp3) * ((FAST_FLOAT) 1.414213562) - tmp13; /* 2*c4 */ tmp0 = tmp10 + tmp13; /* phase 2 */ tmp3 = tmp10 - tmp13; tmp1 = tmp11 + tmp12; tmp2 = tmp11 - tmp12; /* Odd part */ tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); tmp5 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); tmp6 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); z13 = tmp6 + tmp5; /* phase 6 */ z10 = tmp6 - tmp5; z11 = tmp4 + tmp7; z12 = tmp4 - tmp7; tmp7 = z11 + z13; /* phase 5 */ tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562); /* 2*c4 */ z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */ tmp10 = ((FAST_FLOAT) 1.082392200) * z12 - z5; /* 2*(c2-c6) */ tmp12 = ((FAST_FLOAT) -2.613125930) * z10 + z5; /* -2*(c2+c6) */ tmp6 = tmp12 - tmp7; /* phase 2 */ tmp5 = tmp11 - tmp6; tmp4 = tmp10 + tmp5; wsptr[DCTSIZE*0] = tmp0 + tmp7; wsptr[DCTSIZE*7] = tmp0 - tmp7; wsptr[DCTSIZE*1] = tmp1 + tmp6; wsptr[DCTSIZE*6] = tmp1 - tmp6; wsptr[DCTSIZE*2] = tmp2 + tmp5; wsptr[DCTSIZE*5] = tmp2 - tmp5; wsptr[DCTSIZE*4] = tmp3 + tmp4; wsptr[DCTSIZE*3] = tmp3 - tmp4; inptr++; /* advance pointers to next column */ quantptr++; wsptr++; } /* Pass 2: process rows from work array, store into output array. */ /* Note that we must descale the results by a factor of 8 == 2**3. */ wsptr = workspace; for (ctr = 0; ctr < DCTSIZE; ctr++) { outptr = output_buf[ctr] + output_col; /* Rows of zeroes can be exploited in the same way as we did with columns. * However, the column calculation has created many nonzero AC terms, so * the simplification applies less often (typically 5% to 10% of the time). * And testing floats for zero is relatively expensive, so we don't bother. */ /* Even part */ tmp10 = wsptr[0] + wsptr[4]; tmp11 = wsptr[0] - wsptr[4]; tmp13 = wsptr[2] + wsptr[6]; tmp12 = (wsptr[2] - wsptr[6]) * ((FAST_FLOAT) 1.414213562) - tmp13; tmp0 = tmp10 + tmp13; tmp3 = tmp10 - tmp13; tmp1 = tmp11 + tmp12; tmp2 = tmp11 - tmp12; /* Odd part */ z13 = wsptr[5] + wsptr[3]; z10 = wsptr[5] - wsptr[3]; z11 = wsptr[1] + wsptr[7]; z12 = wsptr[1] - wsptr[7]; tmp7 = z11 + z13; tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562); z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */ tmp10 = ((FAST_FLOAT) 1.082392200) * z12 - z5; /* 2*(c2-c6) */ tmp12 = ((FAST_FLOAT) -2.613125930) * z10 + z5; /* -2*(c2+c6) */ tmp6 = tmp12 - tmp7; tmp5 = tmp11 - tmp6; tmp4 = tmp10 + tmp5; /* Final output stage: scale down by a factor of 8 and range-limit */ outptr[0] = range_limit[(int) DESCALE((INT32) (tmp0 + tmp7), 3) & RANGE_MASK]; outptr[7] = range_limit[(int) DESCALE((INT32) (tmp0 - tmp7), 3) & RANGE_MASK]; outptr[1] = range_limit[(int) DESCALE((INT32) (tmp1 + tmp6), 3) & RANGE_MASK]; outptr[6] = range_limit[(int) DESCALE((INT32) (tmp1 - tmp6), 3) & RANGE_MASK]; outptr[2] = range_limit[(int) DESCALE((INT32) (tmp2 + tmp5), 3) & RANGE_MASK]; outptr[5] = range_limit[(int) DESCALE((INT32) (tmp2 - tmp5), 3) & RANGE_MASK]; outptr[4] = range_limit[(int) DESCALE((INT32) (tmp3 + tmp4), 3) & RANGE_MASK]; outptr[3] = range_limit[(int) DESCALE((INT32) (tmp3 - tmp4), 3) & RANGE_MASK]; wsptr += DCTSIZE; /* advance pointer to next row */ } } #endif /* DCT_FLOAT_SUPPORTED */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jconfig.mc6����������������������������������������������0000644�0001750�0001750�00000003270�12320456500�022050� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* jconfig.mc6 --- jconfig.h for Microsoft C on MS-DOS, version 6.00A & up. */ /* see jconfig.doc for explanations */ #define HAVE_PROTOTYPES #define HAVE_UNSIGNED_CHAR #define HAVE_UNSIGNED_SHORT /* #define void char */ /* #define const */ #undef CHAR_IS_UNSIGNED #define HAVE_STDDEF_H #define HAVE_STDLIB_H #undef NEED_BSD_STRINGS #undef NEED_SYS_TYPES_H #define NEED_FAR_POINTERS /* for small or medium memory model */ #undef NEED_SHORT_EXTERNAL_NAMES #undef INCOMPLETE_TYPES_BROKEN #ifdef JPEG_INTERNALS #undef RIGHT_SHIFT_IS_UNSIGNED #define USE_MSDOS_MEMMGR /* Define this if you use jmemdos.c */ #define MAX_ALLOC_CHUNK 65520L /* Maximum request to malloc() */ #define USE_FMEM /* Microsoft has _fmemcpy() and _fmemset() */ #define NEED_FHEAPMIN /* far heap management routines are broken */ #define SHORTxLCONST_32 /* enable compiler-specific DCT optimization */ /* Note: the above define is known to improve the code with Microsoft C 6.00A. * I do not know whether it is good for later compiler versions. * Please report any info on this point to jpeg-info@uunet.uu.net. */ #endif /* JPEG_INTERNALS */ #ifdef JPEG_CJPEG_DJPEG #define BMP_SUPPORTED /* BMP image file format */ #define GIF_SUPPORTED /* GIF image file format */ #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ #undef RLE_SUPPORTED /* Utah RLE image file format */ #define TARGA_SUPPORTED /* Targa image file format */ #define TWO_FILE_COMMANDLINE #define USE_SETMODE /* Microsoft has setmode() */ #define NEED_SIGNAL_CATCHER /* Define this if you use jmemdos.c */ #undef DONT_USE_B_MODE #undef PROGRESS_REPORT /* optional */ #endif /* JPEG_CJPEG_DJPEG */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jconfig.h������������������������������������������������0000644�0001750�0001750�00000003400�12320456500�021605� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* jconfig.h --- source file edited by configure script */ /* see jconfig.doc for explanations */ #ifdef __cplusplus extern "C" { #endif // cplusplus #undef HAVE_PROTOTYPES #undef HAVE_UNSIGNED_CHAR #undef HAVE_UNSIGNED_SHORT #undef void #undef const #undef CHAR_IS_UNSIGNED #undef HAVE_STDDEF_H #undef HAVE_STDLIB_H #undef NEED_BSD_STRINGS #undef NEED_SYS_TYPES_H #undef NEED_FAR_POINTERS #undef NEED_SHORT_EXTERNAL_NAMES /* Define this if you get warnings about undefined structures. */ #undef INCOMPLETE_TYPES_BROKEN #if defined(_WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__)) /* Define "boolean" as unsigned char, not int, per Windows custom */ /* don't conflict if rpcndr.h already read; Note that the w32api headers used by Cygwin and Mingw do not define "boolean", so jmorecfg.h handles it later. */ #ifndef __RPCNDR_H__ typedef unsigned char boolean; #endif #define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ #endif #ifdef JPEG_INTERNALS #undef RIGHT_SHIFT_IS_UNSIGNED #undef INLINE /* These are for configuring the JPEG memory manager. */ #undef DEFAULT_MAX_MEM #undef NO_MKTEMP #endif /* JPEG_INTERNALS */ #ifdef JPEG_CJPEG_DJPEG #undef BMP_SUPPORTED /* BMP image file format */ #define GIF_SUPPORTED /* GIF image file format */ #undef PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ #undef RLE_SUPPORTED /* Utah RLE image file format */ #undef TARGA_SUPPORTED /* Targa image file format */ #undef TWO_FILE_COMMANDLINE #undef NEED_SIGNAL_CATCHER #undef DONT_USE_B_MODE /* Define this if you want percent-done progress reports from cjpeg/djpeg. */ #undef PROGRESS_REPORT #endif /* JPEG_CJPEG_DJPEG */ #ifdef __cplusplus } #endif // cplusplus #define BITS_IN_JSAMPLE 8 #define HAVE_PROTOTYPES #include "mangle_jpeg.h" ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jpeglib.h������������������������������������������������0000644�0001750�0001750�00000134550�12320456500�021615� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jpeglib.h * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file defines the application interface for the JPEG library. * Most applications using the library need only include this file, * and perhaps jerror.h if they want to know the exact error codes. */ #ifndef JPEGLIB_H #define JPEGLIB_H #include "mangle_jpeg.h" /* * First we include the configuration files that record how this * installation of the JPEG library is set up. jconfig.h can be * generated automatically for many systems. jmorecfg.h contains * manual configuration options that most people need not worry about. */ #ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */ #include "jconfig.h" /* widely used configuration options */ #endif #include "jmorecfg.h" /* seldom changed options */ /* Version ID for the JPEG library. * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60". */ #define JPEG_LIB_VERSION 62 /* Version 6b */ #ifdef __cplusplus extern "C" { #endif // cplusplus /* Various constants determining the sizes of things. * All of these are specified by the JPEG standard, so don't change them * if you want to be compatible. */ #define DCTSIZE 8 /* The basic DCT block is 8x8 samples */ #define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */ #define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */ #define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */ #define NUM_ARITH_TBLS 16 /* Arith-coding tables are numbered 0..15 */ #define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one scan */ #define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */ /* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard; * the PostScript DCT filter can emit files with many more than 10 data units * per MCU. * If you happen to run across such a file, you can up D_MAX_DATA_UNITS_IN_MCU * to handle it. We even let you do this from the jconfig.h file. However, * we strongly discourage changing C_MAX_DATA_UNITS_IN_MCU; just because Adobe * sometimes emits noncompliant files doesn't mean you should too. */ #define C_MAX_DATA_UNITS_IN_MCU 10 /* compressor's limit on data units/MCU */ #ifndef D_MAX_DATA_UNITS_IN_MCU #define D_MAX_DATA_UNITS_IN_MCU 10 /* decompressor's limit on data units/MCU */ #endif /* Data structures for images (arrays of samples and of DCT coefficients). * On 80x86 machines, the image arrays are too big for near pointers, * but the pointer arrays can fit in near memory. */ typedef JSAMPLE FAR *JSAMPROW; /* ptr to one image row of pixel samples. */ typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */ typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */ typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */ typedef JBLOCK FAR *JBLOCKROW; /* pointer to one row of coefficient blocks */ typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficient blocks */ typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks */ typedef JCOEF FAR *JCOEFPTR; /* useful in a couple of places */ typedef JDIFF FAR *JDIFFROW; /* pointer to one row of difference values */ typedef JDIFFROW *JDIFFARRAY; /* ptr to some rows (a 2-D diff array) */ typedef JDIFFARRAY *JDIFFIMAGE; /* a 3-D diff array: top index is color */ /* Types for JPEG compression parameters and working tables. */ /* DCT coefficient quantization tables. */ typedef struct { /* This array gives the coefficient quantizers in natural array order * (not the zigzag order in which they are stored in a JPEG DQT marker). * CAUTION: IJG versions prior to v6a kept this array in zigzag order. */ UINT16 quantval[DCTSIZE2]; /* quantization step for each coefficient */ /* This field is used only during compression. It's initialized FALSE when * the table is created, and set TRUE when it's been output to the file. * You could suppress output of a table by setting this to TRUE. * (See jpeg_suppress_tables for an example.) */ boolean sent_table; /* TRUE when table has been output */ } JQUANT_TBL; /* Huffman coding tables. */ typedef struct { /* These two fields directly represent the contents of a JPEG DHT marker */ UINT8 bits[17]; /* bits[k] = # of symbols with codes of */ /* length k bits; bits[0] is unused */ UINT8 huffval[256]; /* The symbols, in order of incr code length */ /* This field is used only during compression. It's initialized FALSE when * the table is created, and set TRUE when it's been output to the file. * You could suppress output of a table by setting this to TRUE. * (See jpeg_suppress_tables for an example.) */ boolean sent_table; /* TRUE when table has been output */ } JHUFF_TBL; /* Basic info about one component (color channel). */ typedef struct { /* These values are fixed over the whole image. */ /* For compression, they must be supplied by parameter setup; */ /* for decompression, they are read from the SOF marker. */ int component_id; /* identifier for this component (0..255) */ int component_index; /* its index in SOF or cinfo->comp_info[] */ int h_samp_factor; /* horizontal sampling factor (1..4) */ int v_samp_factor; /* vertical sampling factor (1..4) */ int quant_tbl_no; /* quantization table selector (0..3) */ /* These values may vary between scans. */ /* For compression, they must be supplied by parameter setup; */ /* for decompression, they are read from the SOS marker. */ /* The decompressor output side may not use these variables. */ int dc_tbl_no; /* DC entropy table selector (0..3) */ int ac_tbl_no; /* AC entropy table selector (0..3) */ /* Remaining fields should be treated as private by applications. */ /* These values are computed during compression or decompression startup: */ /* Component's size in data units. * Any dummy data units added to complete an MCU are not counted; therefore * these values do not depend on whether a scan is interleaved or not. */ JDIMENSION width_in_data_units; JDIMENSION height_in_data_units; /* Size of a data unit in/output by the codec (in samples). Always * data_unit for compression. For decompression this is the size of the * output from one data_unit, reflecting any processing performed by the * codec. For example, in the DCT-based codec, scaling may be applied * during the IDCT step. Values of 1,2,4,8 are likely to be supported. * Note that different components may have different codec_data_unit sizes. */ int codec_data_unit; /* The downsampled dimensions are the component's actual, unpadded number * of samples at the main buffer (preprocessing/compression interface), thus * downsampled_width = ceil(image_width * Hi/Hmax) * and similarly for height. For decompression, codec-based processing is * included (ie, IDCT scaling), so * downsampled_width = ceil(image_width * Hi/Hmax * codec_data_unit/data_unit) */ JDIMENSION downsampled_width; /* actual width in samples */ JDIMENSION downsampled_height; /* actual height in samples */ /* This flag is used only for decompression. In cases where some of the * components will be ignored (eg grayscale output from YCbCr image), * we can skip most computations for the unused components. */ boolean component_needed; /* do we need the value of this component? */ /* These values are computed before starting a scan of the component. */ /* The decompressor output side may not use these variables. */ int MCU_width; /* number of data units per MCU, horizontally */ int MCU_height; /* number of data units per MCU, vertically */ int MCU_data_units; /* MCU_width * MCU_height */ int MCU_sample_width; /* MCU width in samples, MCU_width*codec_data_unit */ int last_col_width; /* # of non-dummy data_units across in last MCU */ int last_row_height; /* # of non-dummy data_units down in last MCU */ /* Saved quantization table for component; NULL if none yet saved. * See jdinput.c comments about the need for this information. * This field is currently used only for decompression. */ JQUANT_TBL * quant_table; /* Private per-component storage for DCT or IDCT subsystem. */ void * dct_table; } jpeg_component_info; /* The script for encoding a multiple-scan file is an array of these: */ typedef struct { int comps_in_scan; /* number of components encoded in this scan */ int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */ int Ss, Se; /* progressive JPEG spectral selection parms lossless JPEG predictor select parm (Ss) */ int Ah, Al; /* progressive JPEG successive approx. parms lossless JPEG point transform parm (Al) */ } jpeg_scan_info; /* The decompressor can save APPn and COM markers in a list of these: */ typedef struct jpeg_marker_struct FAR * jpeg_saved_marker_ptr; struct jpeg_marker_struct { jpeg_saved_marker_ptr next; /* next in list, or NULL */ UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */ unsigned int original_length; /* # bytes of data in the file */ unsigned int data_length; /* # bytes of data saved at data[] */ JOCTET FAR * data; /* the data contained in the marker */ /* the marker length word is not counted in data_length or original_length */ }; /* Known codec processes. */ typedef enum { JPROC_SEQUENTIAL, /* baseline/extended sequential DCT */ JPROC_PROGRESSIVE, /* progressive DCT */ JPROC_LOSSLESS /* lossless (sequential) */ } J_CODEC_PROCESS; /* Known color spaces. */ typedef enum { JCS_UNKNOWN, /* error/unspecified */ JCS_GRAYSCALE, /* monochrome */ JCS_RGB, /* red/green/blue */ JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */ JCS_CMYK, /* C/M/Y/K */ JCS_YCCK /* Y/Cb/Cr/K */ } J_COLOR_SPACE; /* DCT/IDCT algorithm options. */ typedef enum { JDCT_ISLOW, /* slow but accurate integer algorithm */ JDCT_IFAST, /* faster, less accurate integer method */ JDCT_FLOAT /* floating-point: accurate, fast on fast HW */ } J_DCT_METHOD; #ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */ #define JDCT_DEFAULT JDCT_ISLOW #endif #ifndef JDCT_FASTEST /* may be overridden in jconfig.h */ #define JDCT_FASTEST JDCT_IFAST #endif /* Dithering options for decompression. */ typedef enum { JDITHER_NONE, /* no dithering */ JDITHER_ORDERED, /* simple ordered dither */ JDITHER_FS /* Floyd-Steinberg error diffusion dither */ } J_DITHER_MODE; /* Common fields between JPEG compression and decompression master structs. */ #define jpeg_common_fields \ struct jpeg_error_mgr * err; /* Error handler module */\ struct jpeg_memory_mgr * mem; /* Memory manager module */\ struct jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\ void * client_data; /* Available for use by application */\ boolean is_decompressor; /* So common code can tell which is which */\ int global_state /* For checking call sequence validity */ /* Routines that are to be used by both halves of the library are declared * to receive a pointer to this structure. There are no actual instances of * jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct. */ struct jpeg_common_struct { jpeg_common_fields; /* Fields common to both master struct types */ /* Additional fields follow in an actual jpeg_compress_struct or * jpeg_decompress_struct. All three structs must agree on these * initial fields! (This would be a lot cleaner in C++.) */ }; typedef struct jpeg_common_struct * j_common_ptr; typedef struct jpeg_compress_struct * j_compress_ptr; typedef struct jpeg_decompress_struct * j_decompress_ptr; /* Master record for a compression instance */ struct jpeg_compress_struct { jpeg_common_fields; /* Fields shared with jpeg_decompress_struct */ /* Destination for compressed data */ struct jpeg_destination_mgr * dest; /* Description of source image --- these fields must be filled in by * outer application before starting compression. in_color_space must * be correct before you can even call jpeg_set_defaults(). */ JDIMENSION image_width; /* input image width */ JDIMENSION image_height; /* input image height */ int input_components; /* # of color components in input image */ J_COLOR_SPACE in_color_space; /* colorspace of input image */ double input_gamma; /* image gamma of input image */ /* Compression parameters --- these fields must be set before calling * jpeg_start_compress(). We recommend calling jpeg_set_defaults() to * initialize everything to reasonable defaults, then changing anything * the application specifically wants to change. That way you won't get * burnt when new parameters are added. Also note that there are several * helper routines to simplify changing parameters. */ boolean lossless; /* TRUE=lossless encoding, FALSE=lossy */ int data_precision; /* bits of precision in image data */ int num_components; /* # of color components in JPEG image */ J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ jpeg_component_info * comp_info; /* comp_info[i] describes component that appears i'th in SOF */ JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]; /* ptrs to coefficient quantization tables, or NULL if not defined */ JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; /* ptrs to Huffman coding tables, or NULL if not defined */ UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ int num_scans; /* # of entries in scan_info array */ const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */ /* The default value of scan_info is NULL, which causes a single-scan * sequential JPEG file to be emitted. To create a multi-scan file, * set num_scans and scan_info to point to an array of scan definitions. */ boolean raw_data_in; /* TRUE=caller supplies downsampled data */ boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ boolean optimize_coding; /* TRUE=optimize entropy encoding parms */ boolean CCIR601_sampling; /* TRUE=first samples are cosited */ int smoothing_factor; /* 1..100, or 0 for no input smoothing */ J_DCT_METHOD dct_method; /* DCT algorithm selector */ /* The restart interval can be specified in absolute MCUs by setting * restart_interval, or in MCU rows by setting restart_in_rows * (in which case the correct restart_interval will be figured * for each scan). */ unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */ int restart_in_rows; /* if > 0, MCU rows per restart interval */ /* Parameters controlling emission of special markers. */ boolean write_JFIF_header; /* should a JFIF marker be written? */ UINT8 JFIF_major_version; /* What to write for the JFIF version number */ UINT8 JFIF_minor_version; /* These three values are not used by the JPEG code, merely copied */ /* into the JFIF APP0 marker. density_unit can be 0 for unknown, */ /* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */ /* ratio is defined by X_density/Y_density even when density_unit=0. */ UINT8 density_unit; /* JFIF code for pixel size units */ UINT16 X_density; /* Horizontal pixel density */ UINT16 Y_density; /* Vertical pixel density */ boolean write_Adobe_marker; /* should an Adobe marker be written? */ /* State variable: index of next scanline to be written to * jpeg_write_scanlines(). Application may use this to control its * processing loop, e.g., "while (next_scanline < image_height)". */ JDIMENSION next_scanline; /* 0 .. image_height-1 */ /* Remaining fields are known throughout compressor, but generally * should not be touched by a surrounding application. */ /* * These fields are computed during compression startup */ int data_unit; /* size of data unit in samples */ J_CODEC_PROCESS process; /* encoding process of JPEG image */ int max_h_samp_factor; /* largest h_samp_factor */ int max_v_samp_factor; /* largest v_samp_factor */ JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to codec */ /* The codec receives data in units of MCU rows as defined for fully * interleaved scans (whether the JPEG file is interleaved or not). * There are v_samp_factor * data_unit sample rows of each component in an * "iMCU" (interleaved MCU) row. */ /* * These fields are valid during any one scan. * They describe the components and MCUs actually appearing in the scan. */ int comps_in_scan; /* # of JPEG components in this scan */ jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; /* *cur_comp_info[i] describes component that appears i'th in SOS */ JDIMENSION MCUs_per_row; /* # of MCUs across the image */ JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ int data_units_in_MCU; /* # of data units per MCU */ int MCU_membership[C_MAX_DATA_UNITS_IN_MCU]; /* MCU_membership[i] is index in cur_comp_info of component owning */ /* i'th block in an MCU */ int Ss, Se, Ah, Al; /* progressive/lossless JPEG parameters for scan */ /* * Links to compression subobjects (methods and private variables of modules) */ struct jpeg_comp_master * master; struct jpeg_c_main_controller * main; struct jpeg_c_prep_controller * prep; struct jpeg_c_codec * codec; struct jpeg_marker_writer * marker; struct jpeg_color_converter * cconvert; struct jpeg_downsampler * downsample; jpeg_scan_info * script_space; /* workspace for jpeg_simple_progression */ int script_space_size; }; /* Master record for a decompression instance */ struct jpeg_decompress_struct { jpeg_common_fields; /* Fields shared with jpeg_compress_struct */ /* Source of compressed data */ struct jpeg_source_mgr * src; /* Basic description of image --- filled in by jpeg_read_header(). */ /* Application may inspect these values to decide how to process image. */ JDIMENSION image_width; /* nominal image width (from SOF marker) */ JDIMENSION image_height; /* nominal image height */ int num_components; /* # of color components in JPEG image */ J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ /* Decompression processing parameters --- these fields must be set before * calling jpeg_start_decompress(). Note that jpeg_read_header() initializes * them to default values. */ J_COLOR_SPACE out_color_space; /* colorspace for output */ unsigned int scale_num, scale_denom; /* fraction by which to scale image */ double output_gamma; /* image gamma wanted in output */ boolean buffered_image; /* TRUE=multiple output passes */ boolean raw_data_out; /* TRUE=downsampled data wanted */ J_DCT_METHOD dct_method; /* IDCT algorithm selector */ boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */ boolean do_block_smoothing; /* TRUE=apply interblock smoothing */ boolean quantize_colors; /* TRUE=colormapped output wanted */ /* the following are ignored if not quantize_colors: */ J_DITHER_MODE dither_mode; /* type of color dithering to use */ boolean two_pass_quantize; /* TRUE=use two-pass color quantization */ int desired_number_of_colors; /* max # colors to use in created colormap */ /* these are significant only in buffered-image mode: */ boolean enable_1pass_quant; /* enable future use of 1-pass quantizer */ boolean enable_external_quant;/* enable future use of external colormap */ boolean enable_2pass_quant; /* enable future use of 2-pass quantizer */ /* Description of actual output image that will be returned to application. * These fields are computed by jpeg_start_decompress(). * You can also use jpeg_calc_output_dimensions() to determine these values * in advance of calling jpeg_start_decompress(). */ JDIMENSION output_width; /* scaled image width */ JDIMENSION output_height; /* scaled image height */ int out_color_components; /* # of color components in out_color_space */ int output_components; /* # of color components returned */ /* output_components is 1 (a colormap index) when quantizing colors; * otherwise it equals out_color_components. */ int rec_outbuf_height; /* min recommended height of scanline buffer */ /* If the buffer passed to jpeg_read_scanlines() is less than this many rows * high, space and time will be wasted due to unnecessary data copying. * Usually rec_outbuf_height will be 1 or 2, at most 4. */ /* When quantizing colors, the output colormap is described by these fields. * The application can supply a colormap by setting colormap non-NULL before * calling jpeg_start_decompress; otherwise a colormap is created during * jpeg_start_decompress or jpeg_start_output. * The map has out_color_components rows and actual_number_of_colors columns. */ int actual_number_of_colors; /* number of entries in use */ JSAMPARRAY colormap; /* The color map as a 2-D pixel array */ /* State variables: these variables indicate the progress of decompression. * The application may examine these but must not modify them. */ /* Row index of next scanline to be read from jpeg_read_scanlines(). * Application may use this to control its processing loop, e.g., * "while (output_scanline < output_height)". */ JDIMENSION output_scanline; /* 0 .. output_height-1 */ /* Current input scan number and number of iMCU rows completed in scan. * These indicate the progress of the decompressor input side. */ int input_scan_number; /* Number of SOS markers seen so far */ JDIMENSION input_iMCU_row; /* Number of iMCU rows completed */ /* The "output scan number" is the notional scan being displayed by the * output side. The decompressor will not allow output scan/row number * to get ahead of input scan/row, but it can fall arbitrarily far behind. */ int output_scan_number; /* Nominal scan number being displayed */ JDIMENSION output_iMCU_row; /* Number of iMCU rows read */ /* Current progression status. coef_bits[c][i] indicates the precision * with which component c's DCT coefficient i (in zigzag order) is known. * It is -1 when no data has yet been received, otherwise it is the point * transform (shift) value for the most recent scan of the coefficient * (thus, 0 at completion of the progression). * This pointer is NULL when reading a non-progressive file. */ int (*coef_bits)[DCTSIZE2]; /* -1 or current Al value for each coef */ /* Internal JPEG parameters --- the application usually need not look at * these fields. Note that the decompressor output side may not use * any parameters that can change between scans. */ /* Quantization and Huffman tables are carried forward across input * datastreams when processing abbreviated JPEG datastreams. */ JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]; /* ptrs to coefficient quantization tables, or NULL if not defined */ JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; /* ptrs to Huffman coding tables, or NULL if not defined */ /* These parameters are never carried across datastreams, since they * are given in SOF/SOS markers or defined to be reset by SOI. */ int data_precision; /* bits of precision in image data */ jpeg_component_info * comp_info; /* comp_info[i] describes component that appears i'th in SOF */ boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */ /* These fields record data obtained from optional markers recognized by * the JPEG library. */ boolean saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */ /* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */ UINT8 JFIF_major_version; /* JFIF version number */ UINT8 JFIF_minor_version; UINT8 density_unit; /* JFIF code for pixel size units */ UINT16 X_density; /* Horizontal pixel density */ UINT16 Y_density; /* Vertical pixel density */ boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */ UINT8 Adobe_transform; /* Color transform code from Adobe marker */ boolean CCIR601_sampling; /* TRUE=first samples are cosited */ /* Aside from the specific data retained from APPn markers known to the * library, the uninterpreted contents of any or all APPn and COM markers * can be saved in a list for examination by the application. */ jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */ /* Remaining fields are known throughout decompressor, but generally * should not be touched by a surrounding application. */ /* * These fields are computed during decompression startup */ int data_unit; /* size of data unit in samples */ J_CODEC_PROCESS process; /* decoding process of JPEG image */ int max_h_samp_factor; /* largest h_samp_factor */ int max_v_samp_factor; /* largest v_samp_factor */ int min_codec_data_unit; /* smallest codec_data_unit of any component */ JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */ /* The codec's input and output progress is measured in units of "iMCU" * (interleaved MCU) rows. These are the same as MCU rows in fully * interleaved JPEG scans, but are used whether the scan is interleaved * or not. We define an iMCU row as v_samp_factor data_unit rows of each * component. Therefore, the codec output contains * v_samp_factor*codec_data_unit sample rows of a component per iMCU row. */ JSAMPLE * sample_range_limit; /* table for fast range-limiting */ /* * These fields are valid during any one scan. * They describe the components and MCUs actually appearing in the scan. * Note that the decompressor output side must not use these fields. */ int comps_in_scan; /* # of JPEG components in this scan */ jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; /* *cur_comp_info[i] describes component that appears i'th in SOS */ JDIMENSION MCUs_per_row; /* # of MCUs across the image */ JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ int data_units_in_MCU; /* # of data _units per MCU */ int MCU_membership[D_MAX_DATA_UNITS_IN_MCU]; /* MCU_membership[i] is index in cur_comp_info of component owning */ /* i'th data unit in an MCU */ int Ss, Se, Ah, Al; /* progressive/lossless JPEG parms for scan */ /* This field is shared between entropy decoder and marker parser. * It is either zero or the code of a JPEG marker that has been * read from the data source, but has not yet been processed. */ int unread_marker; /* * Links to decompression subobjects (methods, private variables of modules) */ struct jpeg_decomp_master * master; struct jpeg_d_main_controller * main; struct jpeg_d_codec * codec; struct jpeg_d_post_controller * post; struct jpeg_input_controller * inputctl; struct jpeg_marker_reader * marker; struct jpeg_upsampler * upsample; struct jpeg_color_deconverter * cconvert; struct jpeg_color_quantizer * cquantize; }; /* "Object" declarations for JPEG modules that may be supplied or called * directly by the surrounding application. * As with all objects in the JPEG library, these structs only define the * publicly visible methods and state variables of a module. Additional * private fields may exist after the public ones. */ /* Error handler object */ struct jpeg_error_mgr { /* Error exit handler: does not return to caller */ JMETHOD(void, error_exit, (j_common_ptr cinfo)); /* Conditionally emit a trace or warning message */ JMETHOD(void, emit_message, (j_common_ptr cinfo, int msg_level)); /* Routine that actually outputs a trace or error message */ JMETHOD(void, output_message, (j_common_ptr cinfo)); /* Format a message string for the most recent JPEG error or message */ JMETHOD(void, format_message, (j_common_ptr cinfo, char * buffer)); #define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */ /* Reset error state variables at start of a new image */ JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo)); /* The message ID code and any parameters are saved here. * A message can have one string parameter or up to 8 int parameters. */ int msg_code; #define JMSG_STR_PARM_MAX 80 union { int i[8]; char s[JMSG_STR_PARM_MAX]; } msg_parm; /* Standard state variables for error facility */ int trace_level; /* max msg_level that will be displayed */ /* For recoverable corrupt-data errors, we emit a warning message, * but keep going unless emit_message chooses to abort. emit_message * should count warnings in num_warnings. The surrounding application * can check for bad data by seeing if num_warnings is nonzero at the * end of processing. */ long num_warnings; /* number of corrupt-data warnings */ /* These fields point to the table(s) of error message strings. * An application can change the table pointer to switch to a different * message list (typically, to change the language in which errors are * reported). Some applications may wish to add additional error codes * that will be handled by the JPEG library error mechanism; the second * table pointer is used for this purpose. * * First table includes all errors generated by JPEG library itself. * Error code 0 is reserved for a "no such error string" message. */ const char * const * jpeg_message_table; /* Library errors */ int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */ /* Second table can be added by application (see cjpeg/djpeg for example). * It contains strings numbered first_addon_message..last_addon_message. */ const char * const * addon_message_table; /* Non-library errors */ int first_addon_message; /* code for first string in addon table */ int last_addon_message; /* code for last string in addon table */ }; /* Progress monitor object */ struct jpeg_progress_mgr { JMETHOD(void, progress_monitor, (j_common_ptr cinfo)); long pass_counter; /* work units completed in this pass */ long pass_limit; /* total number of work units in this pass */ int completed_passes; /* passes completed so far */ int total_passes; /* total number of passes expected */ }; /* Data destination object for compression */ struct jpeg_destination_mgr { JOCTET * next_output_byte; /* => next byte to write in buffer */ size_t free_in_buffer; /* # of byte spaces remaining in buffer */ JMETHOD(void, init_destination, (j_compress_ptr cinfo)); JMETHOD(boolean, empty_output_buffer, (j_compress_ptr cinfo)); JMETHOD(void, term_destination, (j_compress_ptr cinfo)); }; /* Data source object for decompression */ struct jpeg_source_mgr { const JOCTET * next_input_byte; /* => next byte to read from buffer */ size_t bytes_in_buffer; /* # of bytes remaining in buffer */ JMETHOD(void, init_source, (j_decompress_ptr cinfo)); JMETHOD(boolean, fill_input_buffer, (j_decompress_ptr cinfo)); JMETHOD(void, skip_input_data, (j_decompress_ptr cinfo, long num_bytes)); JMETHOD(boolean, resync_to_restart, (j_decompress_ptr cinfo, int desired)); JMETHOD(void, term_source, (j_decompress_ptr cinfo)); }; /* Memory manager object. * Allocates "small" objects (a few K total), "large" objects (tens of K), * and "really big" objects (virtual arrays with backing store if needed). * The memory manager does not allow individual objects to be freed; rather, * each created object is assigned to a pool, and whole pools can be freed * at once. This is faster and more convenient than remembering exactly what * to free, especially where malloc()/free() are not too speedy. * NB: alloc routines never return NULL. They exit to error_exit if not * successful. */ #define JPOOL_PERMANENT 0 /* lasts until master record is destroyed */ #define JPOOL_IMAGE 1 /* lasts until done with image/datastream */ #define JPOOL_NUMPOOLS 2 typedef struct jvirt_sarray_control * jvirt_sarray_ptr; typedef struct jvirt_barray_control * jvirt_barray_ptr; #ifdef C_LOSSLESS_SUPPORTED #define NEED_DARRAY #else #ifdef D_LOSSLESS_SUPPORTED #define NEED_DARRAY #endif #endif struct jpeg_memory_mgr { /* Method pointers */ JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id, size_t sizeofobject)); JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id, size_t sizeofobject)); JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id, JDIMENSION samplesperrow, JDIMENSION numrows)); JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id, JDIMENSION blocksperrow, JDIMENSION numrows)); #ifdef NEED_DARRAY JMETHOD(JDIFFARRAY, alloc_darray, (j_common_ptr cinfo, int pool_id, JDIMENSION diffsperrow, JDIMENSION numrows)); #endif JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo, int pool_id, boolean pre_zero, JDIMENSION samplesperrow, JDIMENSION numrows, JDIMENSION maxaccess)); JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo, int pool_id, boolean pre_zero, JDIMENSION blocksperrow, JDIMENSION numrows, JDIMENSION maxaccess)); JMETHOD(void, realize_virt_arrays, (j_common_ptr cinfo)); JMETHOD(JSAMPARRAY, access_virt_sarray, (j_common_ptr cinfo, jvirt_sarray_ptr ptr, JDIMENSION start_row, JDIMENSION num_rows, boolean writable)); JMETHOD(JBLOCKARRAY, access_virt_barray, (j_common_ptr cinfo, jvirt_barray_ptr ptr, JDIMENSION start_row, JDIMENSION num_rows, boolean writable)); JMETHOD(void, free_pool, (j_common_ptr cinfo, int pool_id)); JMETHOD(void, self_destruct, (j_common_ptr cinfo)); /* Limit on memory allocation for this JPEG object. (Note that this is * merely advisory, not a guaranteed maximum; it only affects the space * used for virtual-array buffers.) May be changed by outer application * after creating the JPEG object. */ long max_memory_to_use; /* Maximum allocation request accepted by alloc_large. */ long max_alloc_chunk; }; /* Routine signature for application-supplied marker processing methods. * Need not pass marker code since it is stored in cinfo->unread_marker. */ typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo)); /* Declarations for routines called by application. * The JPP macro hides prototype parameters from compilers that can't cope. * Note JPP requires double parentheses. */ #ifdef HAVE_PROTOTYPES #define JPP(arglist) arglist #else #define JPP(arglist) () #endif /* Short forms of external names for systems with brain-damaged linkers. * We shorten external names to be unique in the first six letters, which * is good enough for all known systems. * (If your compiler itself needs names to be unique in less than 15 * characters, you are out of luck. Get a better compiler.) */ #ifdef NEED_SHORT_EXTERNAL_NAMES #define jpeg_std_error jStdError #define jpeg_CreateCompress jCreaCompress #define jpeg_CreateDecompress jCreaDecompress #define jpeg_destroy_compress jDestCompress #define jpeg_destroy_decompress jDestDecompress #define jpeg_stdio_dest jStdDest #define jpeg_stdio_src jStdSrc #define jpeg_set_defaults jSetDefaults #define jpeg_set_colorspace jSetColorspace #define jpeg_default_colorspace jDefColorspace #define jpeg_set_quality jSetQuality #define jpeg_set_linear_quality jSetLQuality #define jpeg_add_quant_table jAddQuantTable #define jpeg_quality_scaling jQualityScaling #define jpeg_simple_lossless jSimLossless #define jpeg_simple_progression jSimProgress #define jpeg_suppress_tables jSuppressTables #define jpeg_alloc_quant_table jAlcQTable #define jpeg_alloc_huff_table jAlcHTable #define jpeg_start_compress jStrtCompress #define jpeg_write_scanlines jWrtScanlines #define jpeg_finish_compress jFinCompress #define jpeg_write_raw_data jWrtRawData #define jpeg_write_marker jWrtMarker #define jpeg_write_m_header jWrtMHeader #define jpeg_write_m_byte jWrtMByte #define jpeg_write_tables jWrtTables #define jpeg_read_header jReadHeader #define jpeg_start_decompress jStrtDecompress #define jpeg_read_scanlines jReadScanlines #define jpeg_finish_decompress jFinDecompress #define jpeg_read_raw_data jReadRawData #define jpeg_has_multiple_scans jHasMultScn #define jpeg_start_output jStrtOutput #define jpeg_finish_output jFinOutput #define jpeg_input_complete jInComplete #define jpeg_new_colormap jNewCMap #define jpeg_consume_input jConsumeInput #define jpeg_calc_output_dimensions jCalcDimensions #define jpeg_save_markers jSaveMarkers #define jpeg_set_marker_processor jSetMarker #define jpeg_read_coefficients jReadCoefs #define jpeg_write_coefficients jWrtCoefs #define jpeg_copy_critical_parameters jCopyCrit #define jpeg_abort_compress jAbrtCompress #define jpeg_abort_decompress jAbrtDecompress #define jpeg_abort jAbort #define jpeg_destroy jDestroy #define jpeg_resync_to_restart jResyncRestart #endif /* NEED_SHORT_EXTERNAL_NAMES */ /* Default error-management setup */ EXTERN(struct jpeg_error_mgr *) jpeg_std_error JPP((struct jpeg_error_mgr * err)); /* Initialization of JPEG compression objects. * jpeg_create_compress() and jpeg_create_decompress() are the exported * names that applications should call. These expand to calls on * jpeg_CreateCompress and jpeg_CreateDecompress with additional information * passed for version mismatch checking. * NB: you must set up the error-manager BEFORE calling jpeg_create_xxx. */ #define jpeg_create_compress(cinfo) \ jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \ (size_t) sizeof(struct jpeg_compress_struct)) #define jpeg_create_decompress(cinfo) \ jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \ (size_t) sizeof(struct jpeg_decompress_struct)) EXTERN(void) jpeg_CreateCompress JPP((j_compress_ptr cinfo, int version, size_t structsize)); EXTERN(void) jpeg_CreateDecompress JPP((j_decompress_ptr cinfo, int version, size_t structsize)); /* Destruction of JPEG compression objects */ EXTERN(void) jpeg_destroy_compress JPP((j_compress_ptr cinfo)); EXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo)); /* Standard data source and destination managers: stdio streams. */ /* Caller is responsible for opening the file before and closing after. */ EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile)); EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile)); /* Default parameter setup for compression */ EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo)); /* Compression parameter setup aids */ EXTERN(void) jpeg_set_colorspace JPP((j_compress_ptr cinfo, J_COLOR_SPACE colorspace)); EXTERN(void) jpeg_default_colorspace JPP((j_compress_ptr cinfo)); EXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality, boolean force_baseline)); EXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo, int scale_factor, boolean force_baseline)); EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl, const unsigned int *basic_table, int scale_factor, boolean force_baseline)); EXTERN(int) jpeg_quality_scaling JPP((int quality)); EXTERN(void) jpeg_simple_lossless JPP((j_compress_ptr cinfo, int predictor, int point_transform)); EXTERN(void) jpeg_simple_progression JPP((j_compress_ptr cinfo)); EXTERN(void) jpeg_suppress_tables JPP((j_compress_ptr cinfo, boolean suppress)); EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table JPP((j_common_ptr cinfo)); EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table JPP((j_common_ptr cinfo)); /* Main entry points for compression */ EXTERN(void) jpeg_start_compress JPP((j_compress_ptr cinfo, boolean write_all_tables)); EXTERN(JDIMENSION) jpeg_write_scanlines JPP((j_compress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION num_lines)); EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo)); /* Replaces jpeg_write_scanlines when writing raw downsampled data. */ EXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo, JSAMPIMAGE data, JDIMENSION num_lines)); /* Write a special marker. See libjpeg.doc concerning safe usage. */ EXTERN(void) jpeg_write_marker JPP((j_compress_ptr cinfo, int marker, const JOCTET * dataptr, unsigned int datalen)); /* Same, but piecemeal. */ EXTERN(void) jpeg_write_m_header JPP((j_compress_ptr cinfo, int marker, unsigned int datalen)); EXTERN(void) jpeg_write_m_byte JPP((j_compress_ptr cinfo, int val)); /* Alternate compression function: just write an abbreviated table file */ EXTERN(void) jpeg_write_tables JPP((j_compress_ptr cinfo)); /* Decompression startup: read start of JPEG datastream to see what's there */ EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo, boolean require_image)); /* Return value is one of: */ #define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */ #define JPEG_HEADER_OK 1 /* Found valid image datastream */ #define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */ /* If you pass require_image = TRUE (normal case), you need not check for * a TABLES_ONLY return code; an abbreviated file will cause an error exit. * JPEG_SUSPENDED is only possible if you use a data source module that can * give a suspension return (the stdio source module doesn't). */ /* Main entry points for decompression */ EXTERN(boolean) jpeg_start_decompress JPP((j_decompress_ptr cinfo)); EXTERN(JDIMENSION) jpeg_read_scanlines JPP((j_decompress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION max_lines)); EXTERN(boolean) jpeg_finish_decompress JPP((j_decompress_ptr cinfo)); /* Replaces jpeg_read_scanlines when reading raw downsampled data. */ EXTERN(JDIMENSION) jpeg_read_raw_data JPP((j_decompress_ptr cinfo, JSAMPIMAGE data, JDIMENSION max_lines)); /* Additional entry points for buffered-image mode. */ EXTERN(boolean) jpeg_has_multiple_scans JPP((j_decompress_ptr cinfo)); EXTERN(boolean) jpeg_start_output JPP((j_decompress_ptr cinfo, int scan_number)); EXTERN(boolean) jpeg_finish_output JPP((j_decompress_ptr cinfo)); EXTERN(boolean) jpeg_input_complete JPP((j_decompress_ptr cinfo)); EXTERN(void) jpeg_new_colormap JPP((j_decompress_ptr cinfo)); EXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo)); /* Return value is one of: */ /* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */ #define JPEG_REACHED_SOS 1 /* Reached start of new scan */ #define JPEG_REACHED_EOI 2 /* Reached end of image */ #define JPEG_ROW_COMPLETED 3 /* Completed one iMCU row */ #define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */ /* Precalculate output dimensions for current decompression parameters. */ EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo)); /* Control saving of COM and APPn markers into marker_list. */ EXTERN(void) jpeg_save_markers JPP((j_decompress_ptr cinfo, int marker_code, unsigned int length_limit)); /* Install a special processing method for COM or APPn markers. */ EXTERN(void) jpeg_set_marker_processor JPP((j_decompress_ptr cinfo, int marker_code, jpeg_marker_parser_method routine)); /* Read or write raw DCT coefficients --- useful for lossless transcoding. */ EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients JPP((j_decompress_ptr cinfo)); EXTERN(void) jpeg_write_coefficients JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)); EXTERN(void) jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo)); /* If you choose to abort compression or decompression before completing * jpeg_finish_(de)compress, then you need to clean up to release memory, * temporary files, etc. You can just call jpeg_destroy_(de)compress * if you're done with the JPEG object, but if you want to clean it up and * reuse it, call this: */ EXTERN(void) jpeg_abort_compress JPP((j_compress_ptr cinfo)); EXTERN(void) jpeg_abort_decompress JPP((j_decompress_ptr cinfo)); /* Generic versions of jpeg_abort and jpeg_destroy that work on either * flavor of JPEG object. These may be more convenient in some places. */ EXTERN(void) jpeg_abort JPP((j_common_ptr cinfo)); EXTERN(void) jpeg_destroy JPP((j_common_ptr cinfo)); /* Default restart-marker-resync procedure for use by data source modules */ EXTERN(boolean) jpeg_resync_to_restart JPP((j_decompress_ptr cinfo, int desired)); /* These marker codes are exported since applications and data source modules * are likely to want to use them. */ #define JPEG_RST0 0xD0 /* RST0 marker code */ #define JPEG_EOI 0xD9 /* EOI marker code */ #define JPEG_APP0 0xE0 /* APP0 marker code */ #define JPEG_COM 0xFE /* COM marker code */ /* If we have a brain-damaged compiler that emits warnings (or worse, errors) * for structure definitions that are never filled in, keep it quiet by * supplying dummy definitions for the various substructures. */ #ifdef INCOMPLETE_TYPES_BROKEN #ifndef JPEG_INTERNALS /* will be defined in jpegint.h */ struct jvirt_sarray_control { long dummy; }; struct jvirt_barray_control { long dummy; }; struct jpeg_comp_master { long dummy; }; struct jpeg_c_main_controller { long dummy; }; struct jpeg_c_prep_controller { long dummy; }; struct jpeg_c_coef_controller { long dummy; }; struct jpeg_marker_writer { long dummy; }; struct jpeg_color_converter { long dummy; }; struct jpeg_downsampler { long dummy; }; struct jpeg_forward_dct { long dummy; }; struct jpeg_entropy_encoder { long dummy; }; struct jpeg_decomp_master { long dummy; }; struct jpeg_d_main_controller { long dummy; }; struct jpeg_d_coef_controller { long dummy; }; struct jpeg_d_post_controller { long dummy; }; struct jpeg_input_controller { long dummy; }; struct jpeg_marker_reader { long dummy; }; struct jpeg_entropy_decoder { long dummy; }; struct jpeg_inverse_dct { long dummy; }; struct jpeg_upsampler { long dummy; }; struct jpeg_color_deconverter { long dummy; }; struct jpeg_color_quantizer { long dummy; }; #endif /* JPEG_INTERNALS */ #endif /* INCOMPLETE_TYPES_BROKEN */ #ifdef __cplusplus } #endif // cplusplus /* * The JPEG library modules define JPEG_INTERNALS before including this file. * The internal structure declarations are read only when that is true. * Applications using the library should not include jpegint.h, but may wish * to include jerror.h. */ #ifdef JPEG_INTERNALS #include "jpegint.h" /* fetch private declarations */ #include "jerror.h" /* fetch error codes too */ #endif #endif /* JPEGLIB_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/cderror.h������������������������������������������������0000644�0001750�0001750�00000012344�12320456500�021635� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * cderror.h * * Copyright (C) 1994-1997, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file defines the error and message codes for the cjpeg/djpeg * applications. These strings are not needed as part of the JPEG library * proper. * Edit this file to add new codes, or to translate the message strings to * some other language. */ /* * To define the enum list of message codes, include this file without * defining macro JMESSAGE. To create a message string table, include it * again with a suitable JMESSAGE definition (see jerror.c for an example). */ #ifndef JMESSAGE #ifndef CDERROR_H #define CDERROR_H /* First time through, define the enum list */ #define JMAKE_ENUM_LIST #else /* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */ #define JMESSAGE(code,string) #endif /* CDERROR_H */ #endif /* JMESSAGE */ #ifdef __cplusplus extern "C" { #endif // __cplusplus #ifdef JMAKE_ENUM_LIST typedef enum { #define JMESSAGE(code,string) code , #endif /* JMAKE_ENUM_LIST */ JMESSAGE(JMSG_FIRSTADDONCODE=1000, NULL) /* Must be first entry! */ #ifdef BMP_SUPPORTED JMESSAGE(JERR_BMP_BADCMAP, "Unsupported BMP colormap format") JMESSAGE(JERR_BMP_BADDEPTH, "Only 8- and 24-bit BMP files are supported") JMESSAGE(JERR_BMP_BADHEADER, "Invalid BMP file: bad header length") JMESSAGE(JERR_BMP_BADPLANES, "Invalid BMP file: biPlanes not equal to 1") JMESSAGE(JERR_BMP_COLORSPACE, "BMP output must be grayscale or RGB") JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported") JMESSAGE(JERR_BMP_NOT, "Not a BMP file - does not start with BM") JMESSAGE(JTRC_BMP, "%ux%u 24-bit BMP image") JMESSAGE(JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image") JMESSAGE(JTRC_BMP_OS2, "%ux%u 24-bit OS2 BMP image") JMESSAGE(JTRC_BMP_OS2_MAPPED, "%ux%u 8-bit colormapped OS2 BMP image") #endif /* BMP_SUPPORTED */ #ifdef GIF_SUPPORTED JMESSAGE(JERR_GIF_BUG, "GIF output got confused") JMESSAGE(JERR_GIF_CODESIZE, "Bogus GIF codesize %d") JMESSAGE(JERR_GIF_COLORSPACE, "GIF output must be grayscale or RGB") JMESSAGE(JERR_GIF_IMAGENOTFOUND, "Too few images in GIF file") JMESSAGE(JERR_GIF_NOT, "Not a GIF file") JMESSAGE(JTRC_GIF, "%ux%ux%d GIF image") JMESSAGE(JTRC_GIF_BADVERSION, "Warning: unexpected GIF version number '%c%c%c'") JMESSAGE(JTRC_GIF_EXTENSION, "Ignoring GIF extension block of type 0x%02x") JMESSAGE(JTRC_GIF_NONSQUARE, "Caution: nonsquare pixels in input") JMESSAGE(JWRN_GIF_BADDATA, "Corrupt data in GIF file") JMESSAGE(JWRN_GIF_CHAR, "Bogus char 0x%02x in GIF file, ignoring") JMESSAGE(JWRN_GIF_ENDCODE, "Premature end of GIF image") JMESSAGE(JWRN_GIF_NOMOREDATA, "Ran out of GIF bits") #endif /* GIF_SUPPORTED */ #ifdef PPM_SUPPORTED JMESSAGE(JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB") JMESSAGE(JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file") JMESSAGE(JERR_PPM_NOT, "Not a PPM/PGM file") JMESSAGE(JTRC_PGM, "%ux%u PGM image") JMESSAGE(JTRC_PGM_TEXT, "%ux%u text PGM image") JMESSAGE(JTRC_PPM, "%ux%u PPM image") JMESSAGE(JTRC_PPM_TEXT, "%ux%u text PPM image") #endif /* PPM_SUPPORTED */ #ifdef RLE_SUPPORTED JMESSAGE(JERR_RLE_BADERROR, "Bogus error code from RLE library") JMESSAGE(JERR_RLE_COLORSPACE, "RLE output must be grayscale or RGB") JMESSAGE(JERR_RLE_DIMENSIONS, "Image dimensions (%ux%u) too large for RLE") JMESSAGE(JERR_RLE_EMPTY, "Empty RLE file") JMESSAGE(JERR_RLE_EOF, "Premature EOF in RLE header") JMESSAGE(JERR_RLE_MEM, "Insufficient memory for RLE header") JMESSAGE(JERR_RLE_NOT, "Not an RLE file") JMESSAGE(JERR_RLE_TOOMANYCHANNELS, "Cannot handle %d output channels for RLE") JMESSAGE(JERR_RLE_UNSUPPORTED, "Cannot handle this RLE setup") JMESSAGE(JTRC_RLE, "%ux%u full-color RLE file") JMESSAGE(JTRC_RLE_FULLMAP, "%ux%u full-color RLE file with map of length %d") JMESSAGE(JTRC_RLE_GRAY, "%ux%u grayscale RLE file") JMESSAGE(JTRC_RLE_MAPGRAY, "%ux%u grayscale RLE file with map of length %d") JMESSAGE(JTRC_RLE_MAPPED, "%ux%u colormapped RLE file with map of length %d") #endif /* RLE_SUPPORTED */ #ifdef TARGA_SUPPORTED JMESSAGE(JERR_TGA_BADCMAP, "Unsupported Targa colormap format") JMESSAGE(JERR_TGA_BADPARMS, "Invalid or unsupported Targa file") JMESSAGE(JERR_TGA_COLORSPACE, "Targa output must be grayscale or RGB") JMESSAGE(JTRC_TGA, "%ux%u RGB Targa image") JMESSAGE(JTRC_TGA_GRAY, "%ux%u grayscale Targa image") JMESSAGE(JTRC_TGA_MAPPED, "%ux%u colormapped Targa image") #else JMESSAGE(JERR_TGA_NOTCOMP, "Targa support was not compiled") #endif /* TARGA_SUPPORTED */ JMESSAGE(JERR_BAD_CMAP_FILE, "Color map file is invalid or of unsupported format") JMESSAGE(JERR_TOO_MANY_COLORS, "Output file format cannot handle %d colormap entries") JMESSAGE(JERR_UNGETC_FAILED, "ungetc failed") #ifdef TARGA_SUPPORTED JMESSAGE(JERR_UNKNOWN_FORMAT, "Unrecognized input file format --- perhaps you need -targa") #else JMESSAGE(JERR_UNKNOWN_FORMAT, "Unrecognized input file format") #endif JMESSAGE(JERR_UNSUPPORTED_FORMAT, "Unsupported output file format") #ifdef JMAKE_ENUM_LIST JMSG_LASTADDONCODE } ADDON_MESSAGE_CODE; #undef JMAKE_ENUM_LIST #endif /* JMAKE_ENUM_LIST */ #ifdef __cplusplus } #endif // __cplusplus /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ #undef JMESSAGE ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jerror.h�������������������������������������������������0000644�0001750�0001750�00000035112�12320456500�021476� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jerror.h * * Copyright (C) 1994-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file defines the error and message codes for the JPEG library. * Edit this file to add new codes, or to translate the message strings to * some other language. * A set of error-reporting macros are defined too. Some applications using * the JPEG library may wish to include this file to get the error codes * and/or the macros. */ #ifdef __cplusplus extern "C" { #endif // cplusplus /* * To define the enum list of message codes, include this file without * defining macro JMESSAGE. To create a message string table, include it * again with a suitable JMESSAGE definition (see jerror.c for an example). */ #ifndef JMESSAGE #ifndef JERROR_H /* First time through, define the enum list */ #define JMAKE_ENUM_LIST #else /* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */ #define JMESSAGE(code,string) #endif /* JERROR_H */ #endif /* JMESSAGE */ #ifdef JMAKE_ENUM_LIST typedef enum { #define JMESSAGE(code,string) code , #endif /* JMAKE_ENUM_LIST */ JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */ /* For maintenance convenience, list is alphabetical by message code name */ JMESSAGE(JERR_ARITH_NOTIMPL, "Sorry, there are legal restrictions on arithmetic coding") JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix") JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix") JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode") JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS") JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range") JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported") JMESSAGE(JERR_BAD_DIFF, "spatial difference out of range") JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition") JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace") JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace") JMESSAGE(JERR_BAD_LENGTH, "Bogus marker length") JMESSAGE(JERR_BAD_LIB_VERSION, "Wrong JPEG library version: library is %d, caller expects %d") JMESSAGE(JERR_BAD_LOSSLESS, "Invalid lossless parameters Ss=%d Se=%d Ah=%d Al=%d") JMESSAGE(JERR_BAD_LOSSLESS_SCRIPT, "Invalid lossless parameters at scan script entry %d") JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved scan") JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code %d") JMESSAGE(JERR_BAD_PRECISION, "Unsupported JPEG data precision %d") JMESSAGE(JERR_BAD_PROGRESSION, "Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d") JMESSAGE(JERR_BAD_PROG_SCRIPT, "Invalid progressive parameters at scan script entry %d") JMESSAGE(JERR_BAD_RESTART, "Invalid restart interval: %d, must be an integer multiple of the number of MCUs in an MCU_row (%d)") JMESSAGE(JERR_BAD_SAMPLING, "Bogus sampling factors") JMESSAGE(JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d") JMESSAGE(JERR_BAD_STATE, "Improper call to JPEG library in state %d") JMESSAGE(JERR_BAD_STRUCT_SIZE, "JPEG parameter struct mismatch: library thinks size is %u, caller expects %u") JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access") JMESSAGE(JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small") JMESSAGE(JERR_CANT_SUSPEND, "Suspension not allowed here") JMESSAGE(JERR_CANT_TRANSCODE, "Cannot transcode to/from lossless JPEG datastreams") JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet") JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d") JMESSAGE(JERR_CONVERSION_NOTIMPL, "Unsupported color conversion request") JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d") JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x") JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d") JMESSAGE(JERR_DQT_INDEX, "Bogus DQT index %d") JMESSAGE(JERR_EMPTY_IMAGE, "Empty JPEG image (DNL not supported)") JMESSAGE(JERR_EMS_READ, "Read from EMS failed") JMESSAGE(JERR_EMS_WRITE, "Write to EMS failed") JMESSAGE(JERR_EOI_EXPECTED, "Didn't expect more than one scan") JMESSAGE(JERR_FILE_READ, "Input file read error") JMESSAGE(JERR_FILE_WRITE, "Output file write error --- out of disk space?") JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented yet") JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow") JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry") JMESSAGE(JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixels") JMESSAGE(JERR_INPUT_EMPTY, "Empty input file") JMESSAGE(JERR_INPUT_EOF, "Premature end of input file") JMESSAGE(JERR_MISMATCHED_QUANT_TABLE, "Cannot transcode due to multiple use of quantization table %d") JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data") JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change") JMESSAGE(JERR_NOTIMPL, "Not implemented yet") JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time") JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported") JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined") JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image") JMESSAGE(JERR_NO_LOSSLESS_SCRIPT, "Lossless encoding was requested but no scan script was supplied") JMESSAGE(JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined") JMESSAGE(JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x") JMESSAGE(JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)") JMESSAGE(JERR_QUANT_COMPONENTS, "Cannot quantize more than %d color components") JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors") JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors") JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers") JMESSAGE(JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker") JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x") JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers") JMESSAGE(JERR_SOS_NO_SOF, "Invalid JPEG file structure: SOS before SOF") JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s") JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file") JMESSAGE(JERR_TFILE_SEEK, "Seek failed on temporary file") JMESSAGE(JERR_TFILE_WRITE, "Write failed on temporary file --- out of disk space?") JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines") JMESSAGE(JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x") JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up") JMESSAGE(JERR_WIDTH_OVERFLOW, "Image too wide for this implementation") JMESSAGE(JERR_XMS_READ, "Read from XMS failed") JMESSAGE(JERR_XMS_WRITE, "Write to XMS failed") JMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT) JMESSAGE(JMSG_VERSION, JVERSION) JMESSAGE(JTRC_16BIT_TABLES, "Caution: quantization tables are too coarse for baseline JPEG") JMESSAGE(JTRC_ADOBE, "Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d") JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u") JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u") JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x") JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x") JMESSAGE(JTRC_DQT, "Define Quantization Table %d precision %d") JMESSAGE(JTRC_DRI, "Define Restart Interval %u") JMESSAGE(JTRC_EMS_CLOSE, "Freed EMS handle %u") JMESSAGE(JTRC_EMS_OPEN, "Obtained EMS handle %u") JMESSAGE(JTRC_EOI, "End Of Image") JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d") JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d") JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE, "Warning: thumbnail image size does not match data length %u") JMESSAGE(JTRC_JFIF_EXTENSION, "JFIF extension marker: type 0x%02x, length %u") JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image") JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u") JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x") JMESSAGE(JTRC_QUANTVALS, " %4u %4u %4u %4u %4u %4u %4u %4u") JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors") JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors") JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization") JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d") JMESSAGE(JTRC_RST, "RST%d") JMESSAGE(JTRC_SMOOTH_NOTIMPL, "Smoothing not supported with nonstandard sampling ratios") JMESSAGE(JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components=%d") JMESSAGE(JTRC_SOF_COMPONENT, " Component %d: %dhx%dv q=%d") JMESSAGE(JTRC_SOI, "Start of Image") JMESSAGE(JTRC_SOS, "Start Of Scan: %d components") JMESSAGE(JTRC_SOS_COMPONENT, " Component %d: dc=%d ac=%d") JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d") JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s") JMESSAGE(JTRC_TFILE_OPEN, "Opened temporary file %s") JMESSAGE(JTRC_THUMB_JPEG, "JFIF extension marker: JPEG-compressed thumbnail image, length %u") JMESSAGE(JTRC_THUMB_PALETTE, "JFIF extension marker: palette thumbnail image, length %u") JMESSAGE(JTRC_THUMB_RGB, "JFIF extension marker: RGB thumbnail image, length %u") JMESSAGE(JTRC_UNKNOWN_LOSSLESS_IDS, "Unrecognized component IDs %d %d %d, assuming RGB") JMESSAGE(JTRC_UNKNOWN_LOSSY_IDS, "Unrecognized component IDs %d %d %d, assuming YCbCr") JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u") JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u") JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d") JMESSAGE(JWRN_BOGUS_PROGRESSION, "Inconsistent progression sequence for component %d coefficient %d") JMESSAGE(JWRN_EXTRANEOUS_DATA, "Corrupt JPEG data: %u extraneous bytes before marker 0x%02x") JMESSAGE(JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment") JMESSAGE(JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code") JMESSAGE(JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d") JMESSAGE(JWRN_JPEG_EOF, "Premature end of JPEG file") JMESSAGE(JWRN_MUST_DOWNSCALE, "Must downscale data from %d bits to %d") JMESSAGE(JWRN_MUST_RESYNC, "Corrupt JPEG data: found marker 0x%02x instead of RST%d") JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG") JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines") /* For more information see: * http://www.medicalconnections.co.uk/html/lossless_bug.html */ JMESSAGE(JWRN_SIGNED_ARITH, "Corrupt JPEG data: using signed arithmetic") #ifdef JMAKE_ENUM_LIST JMSG_LASTMSGCODE } J_MESSAGE_CODE; #undef JMAKE_ENUM_LIST #endif /* JMAKE_ENUM_LIST */ /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ #undef JMESSAGE #ifndef JERROR_H #define JERROR_H /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ #define ERREXIT(cinfo,code) \ ((cinfo)->err->msg_code = (code), \ (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) #define ERREXIT1(cinfo,code,p1) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) #define ERREXIT2(cinfo,code,p1,p2) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ (cinfo)->err->msg_parm.i[1] = (p2), \ (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) #define ERREXIT3(cinfo,code,p1,p2,p3) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ (cinfo)->err->msg_parm.i[1] = (p2), \ (cinfo)->err->msg_parm.i[2] = (p3), \ (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) #define ERREXIT4(cinfo,code,p1,p2,p3,p4) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ (cinfo)->err->msg_parm.i[1] = (p2), \ (cinfo)->err->msg_parm.i[2] = (p3), \ (cinfo)->err->msg_parm.i[3] = (p4), \ (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) #define ERREXITS(cinfo,code,str) \ ((cinfo)->err->msg_code = (code), \ strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \ (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) #define MAKESTMT(stuff) do { stuff } while (0) /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ #define WARNMS(cinfo,code) \ ((cinfo)->err->msg_code = (code), \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1)) #define WARNMS1(cinfo,code,p1) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1)) #define WARNMS2(cinfo,code,p1,p2) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ (cinfo)->err->msg_parm.i[1] = (p2), \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1)) /* Informational/debugging messages */ #define TRACEMS(cinfo,lvl,code) \ ((cinfo)->err->msg_code = (code), \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) #define TRACEMS1(cinfo,lvl,code,p1) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) #define TRACEMS2(cinfo,lvl,code,p1,p2) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ (cinfo)->err->msg_parm.i[1] = (p2), \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) #define TRACEMS3(cinfo,lvl,code,p1,p2,p3) \ MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \ (cinfo)->err->msg_code = (code); \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) #define TRACEMS4(cinfo,lvl,code,p1,p2,p3,p4) \ MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ (cinfo)->err->msg_code = (code); \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) #define TRACEMS5(cinfo,lvl,code,p1,p2,p3,p4,p5) \ MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ _mp[4] = (p5); \ (cinfo)->err->msg_code = (code); \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) #define TRACEMS8(cinfo,lvl,code,p1,p2,p3,p4,p5,p6,p7,p8) \ MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ _mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \ (cinfo)->err->msg_code = (code); \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) #define TRACEMSS(cinfo,lvl,code,str) \ ((cinfo)->err->msg_code = (code), \ strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) #endif /* JERROR_H */ #ifdef __cplusplus } #endif // cplusplus ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jconfig.manx���������������������������������������������0000644�0001750�0001750�00000002330�12320456500�022322� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* jconfig.manx --- jconfig.h for Amiga systems using Manx Aztec C ver 5.x. */ /* see jconfig.doc for explanations */ #define HAVE_PROTOTYPES #define HAVE_UNSIGNED_CHAR #define HAVE_UNSIGNED_SHORT /* #define void char */ /* #define const */ #undef CHAR_IS_UNSIGNED #define HAVE_STDDEF_H #define HAVE_STDLIB_H #undef NEED_BSD_STRINGS #undef NEED_SYS_TYPES_H #undef NEED_FAR_POINTERS #undef NEED_SHORT_EXTERNAL_NAMES #undef INCOMPLETE_TYPES_BROKEN #ifdef JPEG_INTERNALS #undef RIGHT_SHIFT_IS_UNSIGNED #define TEMP_DIRECTORY "JPEGTMP:" /* recommended setting for Amiga */ #define SHORTxSHORT_32 /* produces better DCT code with Aztec C */ #endif /* JPEG_INTERNALS */ #ifdef JPEG_CJPEG_DJPEG #define BMP_SUPPORTED /* BMP image file format */ #define GIF_SUPPORTED /* GIF image file format */ #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ #undef RLE_SUPPORTED /* Utah RLE image file format */ #define TARGA_SUPPORTED /* Targa image file format */ #define TWO_FILE_COMMANDLINE #define NEED_SIGNAL_CATCHER #undef DONT_USE_B_MODE #undef PROGRESS_REPORT /* optional */ #define signal_catcher _abort /* hack for Aztec C naming requirements */ #endif /* JPEG_CJPEG_DJPEG */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jidctred.c�����������������������������������������������0000644�0001750�0001750�00000032330�12320456500�021755� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jidctred.c * * Copyright (C) 1994-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains inverse-DCT routines that produce reduced-size output: * either 4x4, 2x2, or 1x1 pixels from an 8x8 DCT block. * * The implementation is based on the Loeffler, Ligtenberg and Moschytz (LL&M) * algorithm used in jidctint.c. We simply replace each 8-to-8 1-D IDCT step * with an 8-to-4 step that produces the four averages of two adjacent outputs * (or an 8-to-2 step producing two averages of four outputs, for 2x2 output). * These steps were derived by computing the corresponding values at the end * of the normal LL&M code, then simplifying as much as possible. * * 1x1 is trivial: just take the DC coefficient divided by 8. * * See jidctint.c for additional comments. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jdct.h" /* Private declarations for DCT subsystem */ #ifdef IDCT_SCALING_SUPPORTED /* * This module is specialized to the case DCTSIZE = 8. */ #if DCTSIZE != 8 Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ #endif /* Scaling is the same as in jidctint.c. */ #if BITS_IN_JSAMPLE == 8 #define CONST_BITS 13 #define PASS1_BITS 2 #else #define CONST_BITS 13 #define PASS1_BITS 1 /* lose a little precision to avoid overflow */ #endif /* Some C compilers fail to reduce "FIX(constant)" at compile time, thus * causing a lot of useless floating-point operations at run time. * To get around this we use the following pre-calculated constants. * If you change CONST_BITS you may want to add appropriate values. * (With a reasonable C compiler, you can just rely on the FIX() macro...) */ #if CONST_BITS == 13 #define FIX_0_211164243 ((INT32) 1730) /* FIX(0.211164243) */ #define FIX_0_509795579 ((INT32) 4176) /* FIX(0.509795579) */ #define FIX_0_601344887 ((INT32) 4926) /* FIX(0.601344887) */ #define FIX_0_720959822 ((INT32) 5906) /* FIX(0.720959822) */ #define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */ #define FIX_0_850430095 ((INT32) 6967) /* FIX(0.850430095) */ #define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */ #define FIX_1_061594337 ((INT32) 8697) /* FIX(1.061594337) */ #define FIX_1_272758580 ((INT32) 10426) /* FIX(1.272758580) */ #define FIX_1_451774981 ((INT32) 11893) /* FIX(1.451774981) */ #define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */ #define FIX_2_172734803 ((INT32) 17799) /* FIX(2.172734803) */ #define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */ #define FIX_3_624509785 ((INT32) 29692) /* FIX(3.624509785) */ #else #define FIX_0_211164243 FIX(0.211164243) #define FIX_0_509795579 FIX(0.509795579) #define FIX_0_601344887 FIX(0.601344887) #define FIX_0_720959822 FIX(0.720959822) #define FIX_0_765366865 FIX(0.765366865) #define FIX_0_850430095 FIX(0.850430095) #define FIX_0_899976223 FIX(0.899976223) #define FIX_1_061594337 FIX(1.061594337) #define FIX_1_272758580 FIX(1.272758580) #define FIX_1_451774981 FIX(1.451774981) #define FIX_1_847759065 FIX(1.847759065) #define FIX_2_172734803 FIX(2.172734803) #define FIX_2_562915447 FIX(2.562915447) #define FIX_3_624509785 FIX(3.624509785) #endif /* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. * For 8-bit samples with the recommended scaling, all the variable * and constant values involved are no more than 16 bits wide, so a * 16x16->32 bit multiply can be used instead of a full 32x32 multiply. * For 12-bit samples, a full 32-bit multiplication will be needed. */ #if BITS_IN_JSAMPLE == 8 #define MULTIPLY(var,const) MULTIPLY16C16(var,const) #else #define MULTIPLY(var,const) ((var) * (const)) #endif /* Dequantize a coefficient by multiplying it by the multiplier-table * entry; produce an int result. In this module, both inputs and result * are 16 bits or less, so either int or short multiply will work. */ #define DEQUANTIZE(coef,quantval) (((ISLOW_MULT_TYPE) (coef)) * (quantval)) /* * Perform dequantization and inverse DCT on one block of coefficients, * producing a reduced-size 4x4 output block. */ GLOBAL(void) jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { INT32 tmp0, tmp2, tmp10, tmp12; INT32 z1, z2, z3, z4; JCOEFPTR inptr; ISLOW_MULT_TYPE * quantptr; int * wsptr; JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; int workspace[DCTSIZE*4]; /* buffers data between passes */ SHIFT_TEMPS /* Pass 1: process columns from input, store into work array. */ inptr = coef_block; quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; wsptr = workspace; for (ctr = DCTSIZE; ctr > 0; inptr++, quantptr++, wsptr++, ctr--) { /* Don't bother to process column 4, because second pass won't use it */ if (ctr == DCTSIZE-4) continue; if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*7] == 0) { /* AC terms all zero; we need not examine term 4 for 4x4 output */ int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS; wsptr[DCTSIZE*0] = dcval; wsptr[DCTSIZE*1] = dcval; wsptr[DCTSIZE*2] = dcval; wsptr[DCTSIZE*3] = dcval; continue; } /* Even part */ tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); tmp0 <<= (CONST_BITS+1); z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); tmp2 = MULTIPLY(z2, FIX_1_847759065) + MULTIPLY(z3, - FIX_0_765366865); tmp10 = tmp0 + tmp2; tmp12 = tmp0 - tmp2; /* Odd part */ z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); z2 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); z3 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); z4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */ + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */ + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */ + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */ tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */ + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */ + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */ + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */ /* Final output stage */ wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp2, CONST_BITS-PASS1_BITS+1); wsptr[DCTSIZE*3] = (int) DESCALE(tmp10 - tmp2, CONST_BITS-PASS1_BITS+1); wsptr[DCTSIZE*1] = (int) DESCALE(tmp12 + tmp0, CONST_BITS-PASS1_BITS+1); wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 - tmp0, CONST_BITS-PASS1_BITS+1); } /* Pass 2: process 4 rows from work array, store into output array. */ wsptr = workspace; for (ctr = 0; ctr < 4; ctr++) { outptr = output_buf[ctr] + output_col; /* It's not clear whether a zero row test is worthwhile here ... */ #ifndef NO_ZERO_ROW_TEST if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { /* AC terms all zero */ JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3) & RANGE_MASK]; outptr[0] = dcval; outptr[1] = dcval; outptr[2] = dcval; outptr[3] = dcval; wsptr += DCTSIZE; /* advance pointer to next row */ continue; } #endif /* Even part */ tmp0 = ((INT32) wsptr[0]) << (CONST_BITS+1); tmp2 = MULTIPLY((INT32) wsptr[2], FIX_1_847759065) + MULTIPLY((INT32) wsptr[6], - FIX_0_765366865); tmp10 = tmp0 + tmp2; tmp12 = tmp0 - tmp2; /* Odd part */ z1 = (INT32) wsptr[7]; z2 = (INT32) wsptr[5]; z3 = (INT32) wsptr[3]; z4 = (INT32) wsptr[1]; tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */ + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */ + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */ + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */ tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */ + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */ + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */ + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */ /* Final output stage */ outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp2, CONST_BITS+PASS1_BITS+3+1) & RANGE_MASK]; outptr[3] = range_limit[(int) DESCALE(tmp10 - tmp2, CONST_BITS+PASS1_BITS+3+1) & RANGE_MASK]; outptr[1] = range_limit[(int) DESCALE(tmp12 + tmp0, CONST_BITS+PASS1_BITS+3+1) & RANGE_MASK]; outptr[2] = range_limit[(int) DESCALE(tmp12 - tmp0, CONST_BITS+PASS1_BITS+3+1) & RANGE_MASK]; wsptr += DCTSIZE; /* advance pointer to next row */ } } /* * Perform dequantization and inverse DCT on one block of coefficients, * producing a reduced-size 2x2 output block. */ GLOBAL(void) jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { INT32 tmp0, tmp10, z1; JCOEFPTR inptr; ISLOW_MULT_TYPE * quantptr; int * wsptr; JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; int workspace[DCTSIZE*2]; /* buffers data between passes */ SHIFT_TEMPS /* Pass 1: process columns from input, store into work array. */ inptr = coef_block; quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; wsptr = workspace; for (ctr = DCTSIZE; ctr > 0; inptr++, quantptr++, wsptr++, ctr--) { /* Don't bother to process columns 2,4,6 */ if (ctr == DCTSIZE-2 || ctr == DCTSIZE-4 || ctr == DCTSIZE-6) continue; if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*7] == 0) { /* AC terms all zero; we need not examine terms 2,4,6 for 2x2 output */ int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS; wsptr[DCTSIZE*0] = dcval; wsptr[DCTSIZE*1] = dcval; continue; } /* Even part */ z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); tmp10 = z1 << (CONST_BITS+2); /* Odd part */ z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); tmp0 = MULTIPLY(z1, - FIX_0_720959822); /* sqrt(2) * (c7-c5+c3-c1) */ z1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); tmp0 += MULTIPLY(z1, FIX_0_850430095); /* sqrt(2) * (-c1+c3+c5+c7) */ z1 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); tmp0 += MULTIPLY(z1, - FIX_1_272758580); /* sqrt(2) * (-c1+c3-c5-c7) */ z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); tmp0 += MULTIPLY(z1, FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */ /* Final output stage */ wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp0, CONST_BITS-PASS1_BITS+2); wsptr[DCTSIZE*1] = (int) DESCALE(tmp10 - tmp0, CONST_BITS-PASS1_BITS+2); } /* Pass 2: process 2 rows from work array, store into output array. */ wsptr = workspace; for (ctr = 0; ctr < 2; ctr++) { outptr = output_buf[ctr] + output_col; /* It's not clear whether a zero row test is worthwhile here ... */ #ifndef NO_ZERO_ROW_TEST if (wsptr[1] == 0 && wsptr[3] == 0 && wsptr[5] == 0 && wsptr[7] == 0) { /* AC terms all zero */ JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3) & RANGE_MASK]; outptr[0] = dcval; outptr[1] = dcval; wsptr += DCTSIZE; /* advance pointer to next row */ continue; } #endif /* Even part */ tmp10 = ((INT32) wsptr[0]) << (CONST_BITS+2); /* Odd part */ tmp0 = MULTIPLY((INT32) wsptr[7], - FIX_0_720959822) /* sqrt(2) * (c7-c5+c3-c1) */ + MULTIPLY((INT32) wsptr[5], FIX_0_850430095) /* sqrt(2) * (-c1+c3+c5+c7) */ + MULTIPLY((INT32) wsptr[3], - FIX_1_272758580) /* sqrt(2) * (-c1+c3-c5-c7) */ + MULTIPLY((INT32) wsptr[1], FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */ /* Final output stage */ outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp0, CONST_BITS+PASS1_BITS+3+2) & RANGE_MASK]; outptr[1] = range_limit[(int) DESCALE(tmp10 - tmp0, CONST_BITS+PASS1_BITS+3+2) & RANGE_MASK]; wsptr += DCTSIZE; /* advance pointer to next row */ } } /* * Perform dequantization and inverse DCT on one block of coefficients, * producing a reduced-size 1x1 output block. */ GLOBAL(void) jpeg_idct_1x1 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { int dcval; ISLOW_MULT_TYPE * quantptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); SHIFT_TEMPS /* We hardly need an inverse DCT routine for this: just take the * average pixel value, which is one-eighth of the DC coefficient. */ quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; dcval = DEQUANTIZE(coef_block[0], quantptr[0]); dcval = (int) DESCALE((INT32) dcval, 3); output_buf[0][output_col] = range_limit[dcval & RANGE_MASK]; } #endif /* IDCT_SCALING_SUPPORTED */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jcapistd.c�����������������������������������������������0000644�0001750�0001750�00000013403�12320456500�021766� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jcapistd.c * * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains application interface code for the compression half * of the JPEG library. These are the "standard" API routines that are * used in the normal full-compression case. They are not used by a * transcoding-only application. Note that if an application links in * jpeg_start_compress, it will end up linking in the entire compressor. * We thus must separate this file from jcapimin.c to avoid linking the * whole compression library into a transcoder. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" /* * Compression initialization. * Before calling this, all parameters and a data destination must be set up. * * We require a write_all_tables parameter as a failsafe check when writing * multiple datastreams from the same compression object. Since prior runs * will have left all the tables marked sent_table=TRUE, a subsequent run * would emit an abbreviated stream (no tables) by default. This may be what * is wanted, but for safety's sake it should not be the default behavior: * programmers should have to make a deliberate choice to emit abbreviated * images. Therefore the documentation and examples should encourage people * to pass write_all_tables=TRUE; then it will take active thought to do the * wrong thing. */ GLOBAL(void) jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables) { if (cinfo->global_state != CSTATE_START) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); if (write_all_tables) jpeg_suppress_tables(cinfo, FALSE); /* mark all tables to be written */ /* (Re)initialize error mgr and destination modules */ (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo); (*cinfo->dest->init_destination) (cinfo); /* Perform master selection of active modules */ jinit_compress_master(cinfo); /* Set up for the first pass */ (*cinfo->master->prepare_for_pass) (cinfo); /* Ready for application to drive first pass through jpeg_write_scanlines * or jpeg_write_raw_data. */ cinfo->next_scanline = 0; cinfo->global_state = (cinfo->raw_data_in ? CSTATE_RAW_OK : CSTATE_SCANNING); } /* * Write some scanlines of data to the JPEG compressor. * * The return value will be the number of lines actually written. * This should be less than the supplied num_lines only in case that * the data destination module has requested suspension of the compressor, * or if more than image_height scanlines are passed in. * * Note: we warn about excess calls to jpeg_write_scanlines() since * this likely signals an application programmer error. However, * excess scanlines passed in the last valid call are *silently* ignored, * so that the application need not adjust num_lines for end-of-image * when using a multiple-scanline buffer. */ GLOBAL(JDIMENSION) jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION num_lines) { JDIMENSION row_ctr, rows_left; if (cinfo->global_state != CSTATE_SCANNING) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); if (cinfo->next_scanline >= cinfo->image_height) WARNMS(cinfo, JWRN_TOO_MUCH_DATA); /* Call progress monitor hook if present */ if (cinfo->progress != NULL) { cinfo->progress->pass_counter = (long) cinfo->next_scanline; cinfo->progress->pass_limit = (long) cinfo->image_height; (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); } /* Give master control module another chance if this is first call to * jpeg_write_scanlines. This lets output of the frame/scan headers be * delayed so that application can write COM, etc, markers between * jpeg_start_compress and jpeg_write_scanlines. */ if (cinfo->master->call_pass_startup) (*cinfo->master->pass_startup) (cinfo); /* Ignore any extra scanlines at bottom of image. */ rows_left = cinfo->image_height - cinfo->next_scanline; if (num_lines > rows_left) num_lines = rows_left; row_ctr = 0; (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, num_lines); cinfo->next_scanline += row_ctr; return row_ctr; } /* * Alternate entry point to write raw data. * Processes exactly one iMCU row per call, unless suspended. */ GLOBAL(JDIMENSION) jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data, JDIMENSION num_lines) { JDIMENSION lines_per_iMCU_row; if (cinfo->global_state != CSTATE_RAW_OK) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); if (cinfo->next_scanline >= cinfo->image_height) { WARNMS(cinfo, JWRN_TOO_MUCH_DATA); return 0; } /* Call progress monitor hook if present */ if (cinfo->progress != NULL) { cinfo->progress->pass_counter = (long) cinfo->next_scanline; cinfo->progress->pass_limit = (long) cinfo->image_height; (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); } /* Give master control module another chance if this is first call to * jpeg_write_raw_data. This lets output of the frame/scan headers be * delayed so that application can write COM, etc, markers between * jpeg_start_compress and jpeg_write_raw_data. */ if (cinfo->master->call_pass_startup) (*cinfo->master->pass_startup) (cinfo); /* Verify that at least one iMCU row has been passed. */ lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->data_unit; if (num_lines < lines_per_iMCU_row) ERREXIT(cinfo, JERR_BUFFER_SIZE); /* Directly compress the row. */ if (! (*cinfo->codec->compress_data) (cinfo, data)) { /* If compressor did not consume the whole row, suspend processing. */ return 0; } /* OK, we processed one iMCU row. */ cinfo->next_scanline += lines_per_iMCU_row; return lines_per_iMCU_row; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdct.h���������������������������������������������������0000644�0001750�0001750�00000015737�12320456500�021132� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdct.h * * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This include file contains common declarations for the forward and * inverse DCT modules. These declarations are private to the DCT managers * (jcdctmgr.c, jddctmgr.c) and the individual DCT algorithms. * The individual DCT algorithms are kept in separate files to ease * machine-dependent tuning (e.g., assembly coding). */ #ifdef __cplusplus extern "C" { #endif // cplusplus /* * A forward DCT routine is given a pointer to a work area of type DCTELEM[]; * the DCT is to be performed in-place in that buffer. Type DCTELEM is int * for 8-bit samples, INT32 for 12-bit samples. (NOTE: Floating-point DCT * implementations use an array of type FAST_FLOAT, instead.) * The DCT inputs are expected to be signed (range +-CENTERJSAMPLE). * The DCT outputs are returned scaled up by a factor of 8; they therefore * have a range of +-8K for 8-bit data, +-128K for 12-bit data. This * convention improves accuracy in integer implementations and saves some * work in floating-point ones. * Quantization of the output coefficients is done by jcdctmgr.c. */ #if BITS_IN_JSAMPLE == 8 typedef int DCTELEM; /* 16 or 32 bits is fine */ #else typedef INT32 DCTELEM; /* must have 32 bits */ #endif typedef JMETHOD(void, forward_DCT_method_ptr, (DCTELEM * data)); typedef JMETHOD(void, float_DCT_method_ptr, (FAST_FLOAT * data)); /* * An inverse DCT routine is given a pointer to the input JBLOCK and a pointer * to an output sample array. The routine must dequantize the input data as * well as perform the IDCT; for dequantization, it uses the multiplier table * pointed to by compptr->dct_table. The output data is to be placed into the * sample array starting at a specified column. (Any row offset needed will * be applied to the array pointer before it is passed to the IDCT code.) * Note that the number of samples emitted by the IDCT routine is * DCT_scaled_size * DCT_scaled_size. */ /* typedef inverse_DCT_method_ptr is declared in jpegint.h */ /* * Each IDCT routine has its own ideas about the best dct_table element type. */ typedef MULTIPLIER ISLOW_MULT_TYPE; /* short or int, whichever is faster */ #if BITS_IN_JSAMPLE == 8 typedef MULTIPLIER IFAST_MULT_TYPE; /* 16 bits is OK, use short if faster */ #define IFAST_SCALE_BITS 2 /* fractional bits in scale factors */ #else typedef INT32 IFAST_MULT_TYPE; /* need 32 bits for scaled quantizers */ #define IFAST_SCALE_BITS 13 /* fractional bits in scale factors */ #endif typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */ /* * Each IDCT routine is responsible for range-limiting its results and * converting them to unsigned form (0..MAXJSAMPLE). The raw outputs could * be quite far out of range if the input data is corrupt, so a bulletproof * range-limiting step is required. We use a mask-and-table-lookup method * to do the combined operations quickly. See the comments with * prepare_range_limit_table (in jdmaster.c) for more info. */ #define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit + CENTERJSAMPLE) #define RANGE_MASK (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */ /* Short forms of external names for systems with brain-damaged linkers. */ #ifdef NEED_SHORT_EXTERNAL_NAMES #define jpeg_fdct_islow jFDislow #define jpeg_fdct_ifast jFDifast #define jpeg_fdct_float jFDfloat #define jpeg_idct_islow jRDislow #define jpeg_idct_ifast jRDifast #define jpeg_idct_float jRDfloat #define jpeg_idct_4x4 jRD4x4 #define jpeg_idct_2x2 jRD2x2 #define jpeg_idct_1x1 jRD1x1 #endif /* NEED_SHORT_EXTERNAL_NAMES */ /* Extern declarations for the forward and inverse DCT routines. */ EXTERN(void) jpeg_fdct_islow JPP((DCTELEM * data)); EXTERN(void) jpeg_fdct_ifast JPP((DCTELEM * data)); EXTERN(void) jpeg_fdct_float JPP((FAST_FLOAT * data)); EXTERN(void) jpeg_idct_islow JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_ifast JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_float JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_4x4 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_2x2 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_1x1 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); /* * Macros for handling fixed-point arithmetic; these are used by many * but not all of the DCT/IDCT modules. * * All values are expected to be of type INT32. * Fractional constants are scaled left by CONST_BITS bits. * CONST_BITS is defined within each module using these macros, * and may differ from one module to the next. */ #define ONE ((INT32) 1) #define CONST_SCALE (ONE << CONST_BITS) /* Convert a positive real constant to an integer scaled by CONST_SCALE. * Caution: some C compilers fail to reduce "FIX(constant)" at compile time, * thus causing a lot of useless floating-point operations at run time. */ #define FIX(x) ((INT32) ((x) * CONST_SCALE + 0.5)) /* Descale and correctly round an INT32 value that's scaled by N bits. * We assume RIGHT_SHIFT rounds towards minus infinity, so adding * the fudge factor is correct for either sign of X. */ #define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n) /* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. * This macro is used only when the two inputs will actually be no more than * 16 bits wide, so that a 16x16->32 bit multiply can be used instead of a * full 32x32 multiply. This provides a useful speedup on many machines. * Unfortunately there is no way to specify a 16x16->32 multiply portably * in C, but some C compilers will do the right thing if you provide the * correct combination of casts. */ #ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ #define MULTIPLY16C16(var,const) (((INT16) (var)) * ((INT16) (const))) #endif #ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */ #define MULTIPLY16C16(var,const) (((INT16) (var)) * ((INT32) (const))) #endif #ifndef MULTIPLY16C16 /* default definition */ #define MULTIPLY16C16(var,const) ((var) * (const)) #endif /* Same except both inputs are variables. */ #ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ #define MULTIPLY16V16(var1,var2) (((INT16) (var1)) * ((INT16) (var2))) #endif #ifndef MULTIPLY16V16 /* default definition */ #define MULTIPLY16V16(var1,var2) ((var1) * (var2)) #endif #ifdef __cplusplus } #endif // cplusplus ���������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jchuff.c�������������������������������������������������0000644�0001750�0001750�00000022034�12320456500�021432� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jchuff.c * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains Huffman entropy decoding routines which are shared * by the sequential, progressive and lossless decoders. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jchuff.h" /* Declarations shared with jc*huff.c */ /* * Compute the derived values for a Huffman table. * This routine also performs some validation checks on the table. */ GLOBAL(void) jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno, c_derived_tbl ** pdtbl) { JHUFF_TBL *htbl; c_derived_tbl *dtbl; int p, i, l, lastp, si, maxsymbol; char huffsize[257]; unsigned int huffcode[257]; unsigned int code; /* Note that huffsize[] and huffcode[] are filled in code-length order, * paralleling the order of the symbols themselves in htbl->huffval[]. */ /* Find the input Huffman table */ if (tblno < 0 || tblno >= NUM_HUFF_TBLS) ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno); htbl = isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno]; if (htbl == NULL) ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno); /* Allocate a workspace if we haven't already done so. */ if (*pdtbl == NULL) *pdtbl = (c_derived_tbl *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(c_derived_tbl)); dtbl = *pdtbl; /* Figure C.1: make table of Huffman code length for each symbol */ p = 0; for (l = 1; l <= 16; l++) { i = (int) htbl->bits[l]; if (i < 0 || p + i > 256) /* protect against table overrun */ ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); while (i--) huffsize[p++] = (char) l; } huffsize[p] = 0; lastp = p; /* Figure C.2: generate the codes themselves */ /* We also validate that the counts represent a legal Huffman code tree. */ code = 0; si = huffsize[0]; p = 0; while (huffsize[p]) { while (((int) huffsize[p]) == si) { huffcode[p++] = code; code++; } /* code is now 1 more than the last code used for codelength si; but * it must still fit in si bits, since no code is allowed to be all ones. * BUG FIX 2001-09-03: Comparison must be >, not >= */ if (((INT32) code) > (((INT32) 1) << si)) ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); code <<= 1; si++; } /* Figure C.3: generate encoding tables */ /* These are code and size indexed by symbol value */ /* Set all codeless symbols to have code length 0; * this lets us detect duplicate VAL entries here, and later * allows emit_bits to detect any attempt to emit such symbols. */ MEMZERO(dtbl->ehufsi, SIZEOF(dtbl->ehufsi)); /* This is also a convenient place to check for out-of-range * and duplicated VAL entries. We allow 0..255 for AC symbols * but only 0..16 for DC. (We could constrain them further * based on data depth and mode, but this seems enough.) */ maxsymbol = isDC ? 16 : 255; for (p = 0; p < lastp; p++) { i = htbl->huffval[p]; if (i < 0 || i > maxsymbol || dtbl->ehufsi[i]) ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); dtbl->ehufco[i] = huffcode[p]; dtbl->ehufsi[i] = huffsize[p]; } } /* * Generate the best Huffman code table for the given counts, fill htbl. * * The JPEG standard requires that no symbol be assigned a codeword of all * one bits (so that padding bits added at the end of a compressed segment * can't look like a valid code). Because of the canonical ordering of * codewords, this just means that there must be an unused slot in the * longest codeword length category. Section K.2 of the JPEG spec suggests * reserving such a slot by pretending that symbol 256 is a valid symbol * with count 1. In theory that's not optimal; giving it count zero but * including it in the symbol set anyway should give a better Huffman code. * But the theoretically better code actually seems to come out worse in * practice, because it produces more all-ones bytes (which incur stuffed * zero bytes in the final file). In any case the difference is tiny. * * The JPEG standard requires Huffman codes to be no more than 16 bits long. * If some symbols have a very small but nonzero probability, the Huffman tree * must be adjusted to meet the code length restriction. We currently use * the adjustment method suggested in JPEG section K.2. This method is *not* * optimal; it may not choose the best possible limited-length code. But * typically only very-low-frequency symbols will be given less-than-optimal * lengths, so the code is almost optimal. Experimental comparisons against * an optimal limited-length-code algorithm indicate that the difference is * microscopic --- usually less than a hundredth of a percent of total size. * So the extra complexity of an optimal algorithm doesn't seem worthwhile. */ GLOBAL(void) jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]) { #define MAX_CLEN 32 /* assumed maximum initial code length */ UINT8 bits[MAX_CLEN+1]; /* bits[k] = # of symbols with code length k */ int codesize[257]; /* codesize[k] = code length of symbol k */ int others[257]; /* next symbol in current branch of tree */ int c1, c2; int p, i, j; long v; /* This algorithm is explained in section K.2 of the JPEG standard */ MEMZERO(bits, SIZEOF(bits)); MEMZERO(codesize, SIZEOF(codesize)); for (i = 0; i < 257; i++) others[i] = -1; /* init links to empty */ freq[256] = 1; /* make sure 256 has a nonzero count */ /* Including the pseudo-symbol 256 in the Huffman procedure guarantees * that no real symbol is given code-value of all ones, because 256 * will be placed last in the largest codeword category. */ /* Huffman's basic algorithm to assign optimal code lengths to symbols */ for (;;) { /* Find the smallest nonzero frequency, set c1 = its symbol */ /* In case of ties, take the larger symbol number */ c1 = -1; v = 1000000000L; for (i = 0; i <= 256; i++) { if (freq[i] && freq[i] <= v) { v = freq[i]; c1 = i; } } /* Find the next smallest nonzero frequency, set c2 = its symbol */ /* In case of ties, take the larger symbol number */ c2 = -1; v = 1000000000L; for (i = 0; i <= 256; i++) { if (freq[i] && freq[i] <= v && i != c1) { v = freq[i]; c2 = i; } } /* Done if we've merged everything into one frequency */ if (c2 < 0) break; /* Else merge the two counts/trees */ freq[c1] += freq[c2]; freq[c2] = 0; /* Increment the codesize of everything in c1's tree branch */ codesize[c1]++; while (others[c1] >= 0) { c1 = others[c1]; codesize[c1]++; } others[c1] = c2; /* chain c2 onto c1's tree branch */ /* Increment the codesize of everything in c2's tree branch */ codesize[c2]++; while (others[c2] >= 0) { c2 = others[c2]; codesize[c2]++; } } /* Now count the number of symbols of each code length */ for (i = 0; i <= 256; i++) { if (codesize[i]) { /* The JPEG standard seems to think that this can't happen, */ /* but I'm paranoid... */ if (codesize[i] > MAX_CLEN) ERREXIT(cinfo, JERR_HUFF_CLEN_OVERFLOW); bits[codesize[i]]++; } } /* JPEG doesn't allow symbols with code lengths over 16 bits, so if the pure * Huffman procedure assigned any such lengths, we must adjust the coding. * Here is what the JPEG spec says about how this next bit works: * Since symbols are paired for the longest Huffman code, the symbols are * removed from this length category two at a time. The prefix for the pair * (which is one bit shorter) is allocated to one of the pair; then, * skipping the BITS entry for that prefix length, a code word from the next * shortest nonzero BITS entry is converted into a prefix for two code words * one bit longer. */ for (i = MAX_CLEN; i > 16; i--) { while (bits[i] > 0) { j = i - 2; /* find length of new prefix to be used */ while (bits[j] == 0) j--; bits[i] -= 2; /* remove two symbols */ bits[i-1]++; /* one goes in this length */ bits[j+1] += 2; /* two new symbols in this length */ bits[j]--; /* symbol of this length is now a prefix */ } } /* Remove the count for the pseudo-symbol 256 from the largest codelength */ while (bits[i] == 0) /* find largest codelength still in use */ i--; bits[i]--; /* Return final symbol counts (only for lengths 0..16) */ MEMCOPY(htbl->bits, bits, SIZEOF(htbl->bits)); /* Return a list of the symbols sorted by code length */ /* It's not real clear to me why we don't need to consider the codelength * changes made above, but the JPEG spec seems to think this works. */ p = 0; for (i = 1; i <= MAX_CLEN; i++) { for (j = 0; j <= 255; j++) { if (codesize[j] == i) { htbl->huffval[p] = (UINT8) j; p++; } } } /* Set sent_table FALSE so updated table will be written to JPEG file. */ htbl->sent_table = FALSE; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jconfig.bcc����������������������������������������������0000644�0001750�0001750�00000002670�12320456500�022115� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* jconfig.bcc --- jconfig.h for Borland C (Turbo C) on MS-DOS or OS/2. */ /* see jconfig.doc for explanations */ #define HAVE_PROTOTYPES #define HAVE_UNSIGNED_CHAR #define HAVE_UNSIGNED_SHORT /* #define void char */ /* #define const */ #undef CHAR_IS_UNSIGNED #define HAVE_STDDEF_H #define HAVE_STDLIB_H #undef NEED_BSD_STRINGS #undef NEED_SYS_TYPES_H #ifdef __MSDOS__ #define NEED_FAR_POINTERS /* for small or medium memory model */ #endif #undef NEED_SHORT_EXTERNAL_NAMES #undef INCOMPLETE_TYPES_BROKEN /* this assumes you have -w-stu in CFLAGS */ #ifdef JPEG_INTERNALS #undef RIGHT_SHIFT_IS_UNSIGNED #ifdef __MSDOS__ #define USE_MSDOS_MEMMGR /* Define this if you use jmemdos.c */ #define MAX_ALLOC_CHUNK 65520L /* Maximum request to malloc() */ #define USE_FMEM /* Borland has _fmemcpy() and _fmemset() */ #endif #endif /* JPEG_INTERNALS */ #ifdef JPEG_CJPEG_DJPEG #define BMP_SUPPORTED /* BMP image file format */ #define GIF_SUPPORTED /* GIF image file format */ #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ #undef RLE_SUPPORTED /* Utah RLE image file format */ #define TARGA_SUPPORTED /* Targa image file format */ #define TWO_FILE_COMMANDLINE #define USE_SETMODE /* Borland has setmode() */ #ifdef __MSDOS__ #define NEED_SIGNAL_CATCHER /* Define this if you use jmemdos.c */ #endif #undef DONT_USE_B_MODE #undef PROGRESS_REPORT /* optional */ #endif /* JPEG_CJPEG_DJPEG */ ������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/rdcolmap.c�����������������������������������������������0000644�0001750�0001750�00000015303�12320456500�021767� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * rdcolmap.c * * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file implements djpeg's "-map file" switch. It reads a source image * and constructs a colormap to be supplied to the JPEG decompressor. * * Currently, these file formats are supported for the map file: * GIF: the contents of the GIF's global colormap are used. * PPM (either text or raw flavor): the entire file is read and * each unique pixel value is entered in the map. * Note that reading a large PPM file will be horrendously slow. * Typically, a PPM-format map file should contain just one pixel * of each desired color. Such a file can be extracted from an * ordinary image PPM file with ppmtomap(1). * * Rescaling a PPM that has a maxval unequal to MAXJSAMPLE is not * currently implemented. */ #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ #ifdef QUANT_2PASS_SUPPORTED /* otherwise can't quantize to supplied map */ /* Portions of this code are based on the PBMPLUS library, which is: ** ** Copyright (C) 1988 by Jef Poskanzer. ** ** Permission to use, copy, modify, and distribute this software and its ** documentation for any purpose and without fee is hereby granted, provided ** that the above copyright notice appear in all copies and that both that ** copyright notice and this permission notice appear in supporting ** documentation. This software is provided "as is" without express or ** implied warranty. */ /* * Add a (potentially) new color to the color map. */ LOCAL(void) add_map_entry (j_decompress_ptr cinfo, int R, int G, int B) { JSAMPROW colormap0 = cinfo->colormap[0]; JSAMPROW colormap1 = cinfo->colormap[1]; JSAMPROW colormap2 = cinfo->colormap[2]; int ncolors = cinfo->actual_number_of_colors; int index; /* Check for duplicate color. */ for (index = 0; index < ncolors; index++) { if (GETJSAMPLE(colormap0[index]) == R && GETJSAMPLE(colormap1[index]) == G && GETJSAMPLE(colormap2[index]) == B) return; /* color is already in map */ } /* Check for map overflow. */ if (ncolors >= (MAXJSAMPLE+1)) ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, (MAXJSAMPLE+1)); /* OK, add color to map. */ colormap0[ncolors] = (JSAMPLE) R; colormap1[ncolors] = (JSAMPLE) G; colormap2[ncolors] = (JSAMPLE) B; cinfo->actual_number_of_colors++; } /* * Extract color map from a GIF file. */ LOCAL(void) read_gif_map (j_decompress_ptr cinfo, FILE * infile) { int header[13]; int i, colormaplen; int R, G, B; /* Initial 'G' has already been read by read_color_map */ /* Read the rest of the GIF header and logical screen descriptor */ for (i = 1; i < 13; i++) { if ((header[i] = getc(infile)) == EOF) ERREXIT(cinfo, JERR_BAD_CMAP_FILE); } /* Verify GIF Header */ if (header[1] != 'I' || header[2] != 'F') ERREXIT(cinfo, JERR_BAD_CMAP_FILE); /* There must be a global color map. */ if ((header[10] & 0x80) == 0) ERREXIT(cinfo, JERR_BAD_CMAP_FILE); /* OK, fetch it. */ colormaplen = 2 << (header[10] & 0x07); for (i = 0; i < colormaplen; i++) { R = getc(infile); G = getc(infile); B = getc(infile); if (R == EOF || G == EOF || B == EOF) ERREXIT(cinfo, JERR_BAD_CMAP_FILE); add_map_entry(cinfo, R << (BITS_IN_JSAMPLE-8), G << (BITS_IN_JSAMPLE-8), B << (BITS_IN_JSAMPLE-8)); } } /* Support routines for reading PPM */ LOCAL(int) pbm_getc (FILE * infile) /* Read next char, skipping over any comments */ /* A comment/newline sequence is returned as a newline */ { register int ch; ch = getc(infile); if (ch == '#') { do { ch = getc(infile); } while (ch != '\n' && ch != EOF); } return ch; } LOCAL(unsigned int) read_pbm_integer (j_decompress_ptr cinfo, FILE * infile) /* Read an unsigned decimal integer from the PPM file */ /* Swallows one trailing character after the integer */ /* Note that on a 16-bit-int machine, only values up to 64k can be read. */ /* This should not be a problem in practice. */ { register int ch; register unsigned int val; /* Skip any leading whitespace */ do { ch = pbm_getc(infile); if (ch == EOF) ERREXIT(cinfo, JERR_BAD_CMAP_FILE); } while (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r'); if (ch < '0' || ch > '9') ERREXIT(cinfo, JERR_BAD_CMAP_FILE); val = ch - '0'; while ((ch = pbm_getc(infile)) >= '0' && ch <= '9') { val *= 10; val += ch - '0'; } return val; } /* * Extract color map from a PPM file. */ LOCAL(void) read_ppm_map (j_decompress_ptr cinfo, FILE * infile) { int c; unsigned int w, h, maxval, row, col; int R, G, B; /* Initial 'P' has already been read by read_color_map */ c = getc(infile); /* save format discriminator for a sec */ /* while we fetch the remaining header info */ w = read_pbm_integer(cinfo, infile); h = read_pbm_integer(cinfo, infile); maxval = read_pbm_integer(cinfo, infile); if (w <= 0 || h <= 0 || maxval <= 0) /* error check */ ERREXIT(cinfo, JERR_BAD_CMAP_FILE); /* For now, we don't support rescaling from an unusual maxval. */ if (maxval != (unsigned int) MAXJSAMPLE) ERREXIT(cinfo, JERR_BAD_CMAP_FILE); switch (c) { case '3': /* it's a text-format PPM file */ for (row = 0; row < h; row++) { for (col = 0; col < w; col++) { R = read_pbm_integer(cinfo, infile); G = read_pbm_integer(cinfo, infile); B = read_pbm_integer(cinfo, infile); add_map_entry(cinfo, R, G, B); } } break; case '6': /* it's a raw-format PPM file */ for (row = 0; row < h; row++) { for (col = 0; col < w; col++) { R = getc(infile); G = getc(infile); B = getc(infile); if (R == EOF || G == EOF || B == EOF) ERREXIT(cinfo, JERR_BAD_CMAP_FILE); add_map_entry(cinfo, R, G, B); } } break; default: ERREXIT(cinfo, JERR_BAD_CMAP_FILE); break; } } /* * Main entry point from djpeg.c. * Input: opened input file (from file name argument on command line). * Output: colormap and actual_number_of_colors fields are set in cinfo. */ GLOBAL(void) read_color_map (j_decompress_ptr cinfo, FILE * infile) { /* Allocate space for a color map of maximum supported size. */ cinfo->colormap = (*cinfo->mem->alloc_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, (JDIMENSION) (MAXJSAMPLE+1), (JDIMENSION) 3); cinfo->actual_number_of_colors = 0; /* initialize map to empty */ /* Read first byte to determine file format */ switch (getc(infile)) { case 'G': read_gif_map(cinfo, infile); break; case 'P': read_ppm_map(cinfo, infile); break; default: ERREXIT(cinfo, JERR_BAD_CMAP_FILE); break; } } #endif /* QUANT_2PASS_SUPPORTED */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jccolor.c������������������������������������������������0000644�0001750�0001750�00000035017�12320456500�021625� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jccolor.c * * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains input colorspace conversion routines. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" /* Private subobject */ typedef struct { struct jpeg_color_converter pub; /* public fields */ /* Private state for RGB->YCC conversion */ INT32 * rgb_ycc_tab; /* => table for RGB to YCbCr conversion */ } my_color_converter; typedef my_color_converter * my_cconvert_ptr; /**************** RGB -> YCbCr conversion: most common case **************/ /* * YCbCr is defined per CCIR 601-1, except that Cb and Cr are * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5. * The conversion equations to be implemented are therefore * Y = 0.29900 * R + 0.58700 * G + 0.11400 * B * Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE * Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.) * Note: older versions of the IJG code used a zero offset of MAXJSAMPLE/2, * rather than CENTERJSAMPLE, for Cb and Cr. This gave equal positive and * negative swings for Cb/Cr, but meant that grayscale values (Cb=Cr=0) * were not represented exactly. Now we sacrifice exact representation of * maximum red and maximum blue in order to get exact grayscales. * * To avoid floating-point arithmetic, we represent the fractional constants * as integers scaled up by 2^16 (about 4 digits precision); we have to divide * the products by 2^16, with appropriate rounding, to get the correct answer. * * For even more speed, we avoid doing any multiplications in the inner loop * by precalculating the constants times R,G,B for all possible values. * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table); * for 12-bit samples it is still acceptable. It's not very reasonable for * 16-bit samples, but if you want lossless storage you shouldn't be changing * colorspace anyway. * The CENTERJSAMPLE offsets and the rounding fudge-factor of 0.5 are included * in the tables to save adding them separately in the inner loop. */ #define SCALEBITS 16 /* speediest right-shift on some machines */ #define CBCR_OFFSET ((INT32) CENTERJSAMPLE << SCALEBITS) #define ONE_HALF ((INT32) 1 << (SCALEBITS-1)) #define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5)) /* We allocate one big table and divide it up into eight parts, instead of * doing eight alloc_small requests. This lets us use a single table base * address, which can be held in a register in the inner loops on many * machines (more than can hold all eight addresses, anyway). */ #define R_Y_OFF 0 /* offset to R => Y section */ #define G_Y_OFF (1*(MAXJSAMPLE+1)) /* offset to G => Y section */ #define B_Y_OFF (2*(MAXJSAMPLE+1)) /* etc. */ #define R_CB_OFF (3*(MAXJSAMPLE+1)) #define G_CB_OFF (4*(MAXJSAMPLE+1)) #define B_CB_OFF (5*(MAXJSAMPLE+1)) #define R_CR_OFF B_CB_OFF /* B=>Cb, R=>Cr are the same */ #define G_CR_OFF (6*(MAXJSAMPLE+1)) #define B_CR_OFF (7*(MAXJSAMPLE+1)) #define TABLE_SIZE (8*(MAXJSAMPLE+1)) /* * Initialize for RGB->YCC colorspace conversion. */ METHODDEF(void) rgb_ycc_start (j_compress_ptr cinfo) { my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; INT32 * rgb_ycc_tab; INT32 i; /* Allocate and fill in the conversion tables. */ cconvert->rgb_ycc_tab = rgb_ycc_tab = (INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (TABLE_SIZE * SIZEOF(INT32))); for (i = 0; i <= MAXJSAMPLE; i++) { rgb_ycc_tab[i+R_Y_OFF] = FIX(0.29900) * i; rgb_ycc_tab[i+G_Y_OFF] = FIX(0.58700) * i; rgb_ycc_tab[i+B_Y_OFF] = FIX(0.11400) * i + ONE_HALF; rgb_ycc_tab[i+R_CB_OFF] = (-FIX(0.16874)) * i; rgb_ycc_tab[i+G_CB_OFF] = (-FIX(0.33126)) * i; /* We use a rounding fudge-factor of 0.5-epsilon for Cb and Cr. * This ensures that the maximum output will round to MAXJSAMPLE * not MAXJSAMPLE+1, and thus that we don't have to range-limit. */ rgb_ycc_tab[i+B_CB_OFF] = FIX(0.50000) * i + CBCR_OFFSET + ONE_HALF-1; /* B=>Cb and R=>Cr tables are the same rgb_ycc_tab[i+R_CR_OFF] = FIX(0.50000) * i + CBCR_OFFSET + ONE_HALF-1; */ rgb_ycc_tab[i+G_CR_OFF] = (-FIX(0.41869)) * i; rgb_ycc_tab[i+B_CR_OFF] = (-FIX(0.08131)) * i; } } /* * Convert some rows of samples to the JPEG colorspace. * * Note that we change from the application's interleaved-pixel format * to our internal noninterleaved, one-plane-per-component format. * The input buffer is therefore three times as wide as the output buffer. * * A starting row offset is provided only for the output buffer. The caller * can easily adjust the passed input_buf value to accommodate any row * offset required on that side. */ METHODDEF(void) rgb_ycc_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows) { my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; register int r, g, b; register INT32 * ctab = cconvert->rgb_ycc_tab; register JSAMPROW inptr; register JSAMPROW outptr0, outptr1, outptr2; register JDIMENSION col; JDIMENSION num_cols = cinfo->image_width; while (--num_rows >= 0) { inptr = *input_buf++; outptr0 = output_buf[0][output_row]; outptr1 = output_buf[1][output_row]; outptr2 = output_buf[2][output_row]; output_row++; for (col = 0; col < num_cols; col++) { r = GETJSAMPLE(inptr[RGB_RED]); g = GETJSAMPLE(inptr[RGB_GREEN]); b = GETJSAMPLE(inptr[RGB_BLUE]); inptr += RGB_PIXELSIZE; /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations * must be too; we do not need an explicit range-limiting operation. * Hence the value being shifted is never negative, and we don't * need the general RIGHT_SHIFT macro. */ /* Y */ outptr0[col] = (JSAMPLE) ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) >> SCALEBITS); /* Cb */ outptr1[col] = (JSAMPLE) ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF]) >> SCALEBITS); /* Cr */ outptr2[col] = (JSAMPLE) ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF]) >> SCALEBITS); } } } /**************** Cases other than RGB -> YCbCr **************/ /* * Convert some rows of samples to the JPEG colorspace. * This version handles RGB->grayscale conversion, which is the same * as the RGB->Y portion of RGB->YCbCr. * We assume rgb_ycc_start has been called (we only use the Y tables). */ METHODDEF(void) rgb_gray_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows) { my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; register int r, g, b; register INT32 * ctab = cconvert->rgb_ycc_tab; register JSAMPROW inptr; register JSAMPROW outptr; register JDIMENSION col; JDIMENSION num_cols = cinfo->image_width; while (--num_rows >= 0) { inptr = *input_buf++; outptr = output_buf[0][output_row]; output_row++; for (col = 0; col < num_cols; col++) { r = GETJSAMPLE(inptr[RGB_RED]); g = GETJSAMPLE(inptr[RGB_GREEN]); b = GETJSAMPLE(inptr[RGB_BLUE]); inptr += RGB_PIXELSIZE; /* Y */ outptr[col] = (JSAMPLE) ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) >> SCALEBITS); } } } /* * Convert some rows of samples to the JPEG colorspace. * This version handles Adobe-style CMYK->YCCK conversion, * where we convert R=1-C, G=1-M, and B=1-Y to YCbCr using the same * conversion as above, while passing K (black) unchanged. * We assume rgb_ycc_start has been called. */ METHODDEF(void) cmyk_ycck_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows) { my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; register int r, g, b; register INT32 * ctab = cconvert->rgb_ycc_tab; register JSAMPROW inptr; register JSAMPROW outptr0, outptr1, outptr2, outptr3; register JDIMENSION col; JDIMENSION num_cols = cinfo->image_width; while (--num_rows >= 0) { inptr = *input_buf++; outptr0 = output_buf[0][output_row]; outptr1 = output_buf[1][output_row]; outptr2 = output_buf[2][output_row]; outptr3 = output_buf[3][output_row]; output_row++; for (col = 0; col < num_cols; col++) { r = MAXJSAMPLE - GETJSAMPLE(inptr[0]); g = MAXJSAMPLE - GETJSAMPLE(inptr[1]); b = MAXJSAMPLE - GETJSAMPLE(inptr[2]); /* K passes through as-is */ outptr3[col] = inptr[3]; /* don't need GETJSAMPLE here */ inptr += 4; /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations * must be too; we do not need an explicit range-limiting operation. * Hence the value being shifted is never negative, and we don't * need the general RIGHT_SHIFT macro. */ /* Y */ outptr0[col] = (JSAMPLE) ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) >> SCALEBITS); /* Cb */ outptr1[col] = (JSAMPLE) ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF]) >> SCALEBITS); /* Cr */ outptr2[col] = (JSAMPLE) ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF]) >> SCALEBITS); } } } /* * Convert some rows of samples to the JPEG colorspace. * This version handles grayscale output with no conversion. * The source can be either plain grayscale or YCbCr (since Y == gray). */ METHODDEF(void) grayscale_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows) { register JSAMPROW inptr; register JSAMPROW outptr; register JDIMENSION col; JDIMENSION num_cols = cinfo->image_width; int instride = cinfo->input_components; while (--num_rows >= 0) { inptr = *input_buf++; outptr = output_buf[0][output_row]; output_row++; for (col = 0; col < num_cols; col++) { outptr[col] = inptr[0]; /* don't need GETJSAMPLE() here */ inptr += instride; } } } /* * Convert some rows of samples to the JPEG colorspace. * This version handles multi-component colorspaces without conversion. * We assume input_components == num_components. */ METHODDEF(void) null_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows) { register JSAMPROW inptr; register JSAMPROW outptr; register JDIMENSION col; register int ci; int nc = cinfo->num_components; JDIMENSION num_cols = cinfo->image_width; while (--num_rows >= 0) { /* It seems fastest to make a separate pass for each component. */ for (ci = 0; ci < nc; ci++) { inptr = *input_buf; outptr = output_buf[ci][output_row]; for (col = 0; col < num_cols; col++) { outptr[col] = inptr[ci]; /* don't need GETJSAMPLE() here */ inptr += nc; } } input_buf++; output_row++; } } /* * Empty method for start_pass. */ METHODDEF(void) null_method (j_compress_ptr cinfo) { (void)cinfo; /* no work needed */ } /* * Module initialization routine for input colorspace conversion. */ GLOBAL(void) jinit_color_converter (j_compress_ptr cinfo) { my_cconvert_ptr cconvert; cconvert = (my_cconvert_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_color_converter)); cinfo->cconvert = (struct jpeg_color_converter *) cconvert; /* set start_pass to null method until we find out differently */ cconvert->pub.start_pass = null_method; /* Make sure input_components agrees with in_color_space */ switch (cinfo->in_color_space) { case JCS_GRAYSCALE: if (cinfo->input_components != 1) ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); break; case JCS_RGB: #if RGB_PIXELSIZE != 3 if (cinfo->input_components != RGB_PIXELSIZE) ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); break; #endif /* else share code with YCbCr */ case JCS_YCbCr: if (cinfo->input_components != 3) ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); break; case JCS_CMYK: case JCS_YCCK: if (cinfo->input_components != 4) ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); break; default: /* JCS_UNKNOWN can be anything */ if (cinfo->input_components < 1) ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); break; } /* Check num_components, set conversion method based on requested space */ switch (cinfo->jpeg_color_space) { case JCS_GRAYSCALE: if (cinfo->num_components != 1) ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); if (cinfo->in_color_space == JCS_GRAYSCALE) cconvert->pub.color_convert = grayscale_convert; else if (cinfo->in_color_space == JCS_RGB) { cconvert->pub.start_pass = rgb_ycc_start; cconvert->pub.color_convert = rgb_gray_convert; } else if (cinfo->in_color_space == JCS_YCbCr) cconvert->pub.color_convert = grayscale_convert; else ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); break; case JCS_RGB: if (cinfo->num_components != 3) ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); if (cinfo->in_color_space == JCS_RGB && RGB_PIXELSIZE == 3) cconvert->pub.color_convert = null_convert; else ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); break; case JCS_YCbCr: if (cinfo->num_components != 3) ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); if (cinfo->in_color_space == JCS_RGB) { cconvert->pub.start_pass = rgb_ycc_start; cconvert->pub.color_convert = rgb_ycc_convert; } else if (cinfo->in_color_space == JCS_YCbCr) cconvert->pub.color_convert = null_convert; else ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); break; case JCS_CMYK: if (cinfo->num_components != 4) ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); if (cinfo->in_color_space == JCS_CMYK) cconvert->pub.color_convert = null_convert; else ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); break; case JCS_YCCK: if (cinfo->num_components != 4) ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); if (cinfo->in_color_space == JCS_CMYK) { cconvert->pub.start_pass = rgb_ycc_start; cconvert->pub.color_convert = cmyk_ycck_convert; } else if (cinfo->in_color_space == JCS_YCCK) cconvert->pub.color_convert = null_convert; else ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); break; default: /* allow null conversion of JCS_UNKNOWN */ if (cinfo->jpeg_color_space != cinfo->in_color_space || cinfo->num_components != cinfo->input_components) ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); cconvert->pub.color_convert = null_convert; break; } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jidctint.c�����������������������������������������������0000644�0001750�0001750�00000034737�12320456500�022012� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jidctint.c * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains a slow-but-accurate integer implementation of the * inverse DCT (Discrete Cosine Transform). In the IJG code, this routine * must also perform dequantization of the input coefficients. * * A 2-D IDCT can be done by 1-D IDCT on each column followed by 1-D IDCT * on each row (or vice versa, but it's more convenient to emit a row at * a time). Direct algorithms are also available, but they are much more * complex and seem not to be any faster when reduced to code. * * This implementation is based on an algorithm described in * C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT * Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics, * Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991. * The primary algorithm described there uses 11 multiplies and 29 adds. * We use their alternate method with 12 multiplies and 32 adds. * The advantage of this method is that no data path contains more than one * multiplication; this allows a very simple and accurate implementation in * scaled fixed-point arithmetic, with a minimal number of shifts. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jdct.h" /* Private declarations for DCT subsystem */ #ifdef DCT_ISLOW_SUPPORTED /* * This module is specialized to the case DCTSIZE = 8. */ #if DCTSIZE != 8 Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ #endif /* * The poop on this scaling stuff is as follows: * * Each 1-D IDCT step produces outputs which are a factor of sqrt(N) * larger than the true IDCT outputs. The final outputs are therefore * a factor of N larger than desired; since N=8 this can be cured by * a simple right shift at the end of the algorithm. The advantage of * this arrangement is that we save two multiplications per 1-D IDCT, * because the y0 and y4 inputs need not be divided by sqrt(N). * * We have to do addition and subtraction of the integer inputs, which * is no problem, and multiplication by fractional constants, which is * a problem to do in integer arithmetic. We multiply all the constants * by CONST_SCALE and convert them to integer constants (thus retaining * CONST_BITS bits of precision in the constants). After doing a * multiplication we have to divide the product by CONST_SCALE, with proper * rounding, to produce the correct output. This division can be done * cheaply as a right shift of CONST_BITS bits. We postpone shifting * as long as possible so that partial sums can be added together with * full fractional precision. * * The outputs of the first pass are scaled up by PASS1_BITS bits so that * they are represented to better-than-integral precision. These outputs * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word * with the recommended scaling. (To scale up 12-bit sample data further, an * intermediate INT32 array would be needed.) * * To avoid overflow of the 32-bit intermediate results in pass 2, we must * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis * shows that the values given below are the most effective. */ #if BITS_IN_JSAMPLE == 8 #define CONST_BITS 13 #define PASS1_BITS 2 #else #define CONST_BITS 13 #define PASS1_BITS 1 /* lose a little precision to avoid overflow */ #endif /* Some C compilers fail to reduce "FIX(constant)" at compile time, thus * causing a lot of useless floating-point operations at run time. * To get around this we use the following pre-calculated constants. * If you change CONST_BITS you may want to add appropriate values. * (With a reasonable C compiler, you can just rely on the FIX() macro...) */ #if CONST_BITS == 13 #define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */ #define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */ #define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */ #define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */ #define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */ #define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */ #define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */ #define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */ #define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */ #define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */ #define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */ #define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */ #else #define FIX_0_298631336 FIX(0.298631336) #define FIX_0_390180644 FIX(0.390180644) #define FIX_0_541196100 FIX(0.541196100) #define FIX_0_765366865 FIX(0.765366865) #define FIX_0_899976223 FIX(0.899976223) #define FIX_1_175875602 FIX(1.175875602) #define FIX_1_501321110 FIX(1.501321110) #define FIX_1_847759065 FIX(1.847759065) #define FIX_1_961570560 FIX(1.961570560) #define FIX_2_053119869 FIX(2.053119869) #define FIX_2_562915447 FIX(2.562915447) #define FIX_3_072711026 FIX(3.072711026) #endif /* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. * For 8-bit samples with the recommended scaling, all the variable * and constant values involved are no more than 16 bits wide, so a * 16x16->32 bit multiply can be used instead of a full 32x32 multiply. * For 12-bit samples, a full 32-bit multiplication will be needed. */ #if BITS_IN_JSAMPLE == 8 #define MULTIPLY(var,const) MULTIPLY16C16(var,const) #else #define MULTIPLY(var,const) ((var) * (const)) #endif /* Dequantize a coefficient by multiplying it by the multiplier-table * entry; produce an int result. In this module, both inputs and result * are 16 bits or less, so either int or short multiply will work. */ #define DEQUANTIZE(coef,quantval) (((ISLOW_MULT_TYPE) (coef)) * (quantval)) /* * Perform dequantization and inverse DCT on one block of coefficients. */ GLOBAL(void) jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { INT32 tmp0, tmp1, tmp2, tmp3; INT32 tmp10, tmp11, tmp12, tmp13; INT32 z1, z2, z3, z4, z5; JCOEFPTR inptr; ISLOW_MULT_TYPE * quantptr; int * wsptr; JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; int workspace[DCTSIZE2]; /* buffers data between passes */ SHIFT_TEMPS /* Pass 1: process columns from input, store into work array. */ /* Note results are scaled up by sqrt(8) compared to a true IDCT; */ /* furthermore, we scale the results by 2**PASS1_BITS. */ inptr = coef_block; quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; wsptr = workspace; for (ctr = DCTSIZE; ctr > 0; ctr--) { /* Due to quantization, we will usually find that many of the input * coefficients are zero, especially the AC terms. We can exploit this * by short-circuiting the IDCT calculation for any column in which all * the AC terms are zero. In that case each output is equal to the * DC coefficient (with scale factor as needed). * With typical images and quantization tables, half or more of the * column DCT calculations can be simplified this way. */ if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*7] == 0) { /* AC terms all zero */ int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS; wsptr[DCTSIZE*0] = dcval; wsptr[DCTSIZE*1] = dcval; wsptr[DCTSIZE*2] = dcval; wsptr[DCTSIZE*3] = dcval; wsptr[DCTSIZE*4] = dcval; wsptr[DCTSIZE*5] = dcval; wsptr[DCTSIZE*6] = dcval; wsptr[DCTSIZE*7] = dcval; inptr++; /* advance pointers to next column */ quantptr++; wsptr++; continue; } /* Even part: reverse the even part of the forward DCT. */ /* The rotator is sqrt(2)*c(-6). */ z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); z1 = MULTIPLY(z2 + z3, FIX_0_541196100); tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065); tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865); z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); tmp0 = (z2 + z3) << CONST_BITS; tmp1 = (z2 - z3) << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; /* Odd part per figure 8; the matrix is unitary and hence its * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. */ tmp0 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); tmp1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); tmp2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); tmp3 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; z3 = tmp0 + tmp2; z4 = tmp1 + tmp3; z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ z3 += z5; z4 += z5; tmp0 += z1 + z3; tmp1 += z2 + z4; tmp2 += z2 + z3; tmp3 += z1 + z4; /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*7] = (int) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*1] = (int) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*6] = (int) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*5] = (int) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*3] = (int) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*4] = (int) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS); inptr++; /* advance pointers to next column */ quantptr++; wsptr++; } /* Pass 2: process rows from work array, store into output array. */ /* Note that we must descale the results by a factor of 8 == 2**3, */ /* and also undo the PASS1_BITS scaling. */ wsptr = workspace; for (ctr = 0; ctr < DCTSIZE; ctr++) { outptr = output_buf[ctr] + output_col; /* Rows of zeroes can be exploited in the same way as we did with columns. * However, the column calculation has created many nonzero AC terms, so * the simplification applies less often (typically 5% to 10% of the time). * On machines with very fast multiplication, it's possible that the * test takes more time than it's worth. In that case this section * may be commented out. */ #ifndef NO_ZERO_ROW_TEST if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { /* AC terms all zero */ JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3) & RANGE_MASK]; outptr[0] = dcval; outptr[1] = dcval; outptr[2] = dcval; outptr[3] = dcval; outptr[4] = dcval; outptr[5] = dcval; outptr[6] = dcval; outptr[7] = dcval; wsptr += DCTSIZE; /* advance pointer to next row */ continue; } #endif /* Even part: reverse the even part of the forward DCT. */ /* The rotator is sqrt(2)*c(-6). */ z2 = (INT32) wsptr[2]; z3 = (INT32) wsptr[6]; z1 = MULTIPLY(z2 + z3, FIX_0_541196100); tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065); tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865); tmp0 = ((INT32) wsptr[0] + (INT32) wsptr[4]) << CONST_BITS; tmp1 = ((INT32) wsptr[0] - (INT32) wsptr[4]) << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; /* Odd part per figure 8; the matrix is unitary and hence its * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. */ tmp0 = (INT32) wsptr[7]; tmp1 = (INT32) wsptr[5]; tmp2 = (INT32) wsptr[3]; tmp3 = (INT32) wsptr[1]; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; z3 = tmp0 + tmp2; z4 = tmp1 + tmp3; z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ z3 += z5; z4 += z5; tmp0 += z1 + z3; tmp1 += z2 + z4; tmp2 += z2 + z3; tmp3 += z1 + z4; /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp3, CONST_BITS+PASS1_BITS+3) & RANGE_MASK]; outptr[7] = range_limit[(int) DESCALE(tmp10 - tmp3, CONST_BITS+PASS1_BITS+3) & RANGE_MASK]; outptr[1] = range_limit[(int) DESCALE(tmp11 + tmp2, CONST_BITS+PASS1_BITS+3) & RANGE_MASK]; outptr[6] = range_limit[(int) DESCALE(tmp11 - tmp2, CONST_BITS+PASS1_BITS+3) & RANGE_MASK]; outptr[2] = range_limit[(int) DESCALE(tmp12 + tmp1, CONST_BITS+PASS1_BITS+3) & RANGE_MASK]; outptr[5] = range_limit[(int) DESCALE(tmp12 - tmp1, CONST_BITS+PASS1_BITS+3) & RANGE_MASK]; outptr[3] = range_limit[(int) DESCALE(tmp13 + tmp0, CONST_BITS+PASS1_BITS+3) & RANGE_MASK]; outptr[4] = range_limit[(int) DESCALE(tmp13 - tmp0, CONST_BITS+PASS1_BITS+3) & RANGE_MASK]; wsptr += DCTSIZE; /* advance pointer to next row */ } } #endif /* DCT_ISLOW_SUPPORTED */ ���������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdlhuff.c������������������������������������������������0000644�0001750�0001750�00000022666�12320456500�021622� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdlhuff.c * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains Huffman entropy decoding routines for lossless JPEG. * * Much of the complexity here has to do with supporting input suspension. * If the data source module demands suspension, we want to be able to back * up to the start of the current MCU. To do this, we copy state variables * into local working storage, and update them back to the permanent * storage only upon successful completion of an MCU. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossls.h" /* Private declarations for lossless codec */ #include "jdhuff.h" /* Declarations shared with jd*huff.c */ #ifdef D_LOSSLESS_SUPPORTED typedef struct { int ci, yoffset, MCU_width; } lhd_output_ptr_info; /* * Private entropy decoder object for lossless Huffman decoding. */ typedef struct { huffd_common_fields; /* Fields shared with other entropy decoders */ /* Pointers to derived tables (these workspaces have image lifespan) */ d_derived_tbl * derived_tbls[NUM_HUFF_TBLS]; /* Precalculated info set up by start_pass for use in decode_mcus: */ /* Pointers to derived tables to be used for each data unit within an MCU */ d_derived_tbl * cur_tbls[D_MAX_DATA_UNITS_IN_MCU]; /* Pointers to the proper output difference row for each group of data units * within an MCU. For each component, there are Vi groups of Hi data units. */ JDIFFROW output_ptr[D_MAX_DATA_UNITS_IN_MCU]; /* Number of output pointers in use for the current MCU. This is the sum * of all Vi in the MCU. */ int num_output_ptrs; /* Information used for positioning the output pointers within the output * difference rows. */ lhd_output_ptr_info output_ptr_info[D_MAX_DATA_UNITS_IN_MCU]; /* Index of the proper output pointer for each data unit within an MCU */ int output_ptr_index[D_MAX_DATA_UNITS_IN_MCU]; } lhuff_entropy_decoder; typedef lhuff_entropy_decoder * lhuff_entropy_ptr; /* * Initialize for a Huffman-compressed scan. */ METHODDEF(void) start_pass_lhuff_decoder (j_decompress_ptr cinfo) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; lhuff_entropy_ptr entropy = (lhuff_entropy_ptr) losslsd->entropy_private; int ci, dctbl, sampn, ptrn, yoffset, xoffset; jpeg_component_info * compptr; for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; dctbl = compptr->dc_tbl_no; /* Make sure requested tables are present */ if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS || cinfo->dc_huff_tbl_ptrs[dctbl] == NULL) ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl); /* Compute derived values for Huffman tables */ /* We may do this more than once for a table, but it's not expensive */ jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl, & entropy->derived_tbls[dctbl]); } /* Precalculate decoding info for each sample in an MCU of this scan */ for (sampn = 0, ptrn = 0; sampn < cinfo->data_units_in_MCU;) { compptr = cinfo->cur_comp_info[cinfo->MCU_membership[sampn]]; ci = compptr->component_index; for (yoffset = 0; yoffset < compptr->MCU_height; yoffset++, ptrn++) { /* Precalculate the setup info for each output pointer */ entropy->output_ptr_info[ptrn].ci = ci; entropy->output_ptr_info[ptrn].yoffset = yoffset; entropy->output_ptr_info[ptrn].MCU_width = compptr->MCU_width; for (xoffset = 0; xoffset < compptr->MCU_width; xoffset++, sampn++) { /* Precalculate the output pointer index for each sample */ entropy->output_ptr_index[sampn] = ptrn; /* Precalculate which table to use for each sample */ entropy->cur_tbls[sampn] = entropy->derived_tbls[compptr->dc_tbl_no]; } } } entropy->num_output_ptrs = ptrn; /* Initialize bitread state variables */ entropy->bitstate.bits_left = 0; entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */ entropy->insufficient_data = FALSE; } /* * Figure F.12: extend sign bit. * On some machines, a shift and add will be faster than a table lookup. */ #ifdef AVOID_TABLES #define HUFF_EXTEND(x,s) ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x)) #else #define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x)) static const int extend_test[16] = /* entry n is 2**(n-1) */ { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 }; static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 }; #endif /* AVOID_TABLES */ /* * Check for a restart marker & resynchronize decoder. * Returns FALSE if must suspend. */ METHODDEF(boolean) process_restart (j_decompress_ptr cinfo) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; lhuff_entropy_ptr entropy = (lhuff_entropy_ptr) losslsd->entropy_private; /* int ci; */ /* Throw away any unused bits remaining in bit buffer; */ /* include any full bytes in next_marker's count of discarded bytes */ cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8; entropy->bitstate.bits_left = 0; /* Advance past the RSTn marker */ if (! (*cinfo->marker->read_restart_marker) (cinfo)) return FALSE; /* Reset out-of-data flag, unless read_restart_marker left us smack up * against a marker. In that case we will end up treating the next data * segment as empty, and we can avoid producing bogus output pixels by * leaving the flag set. */ if (cinfo->unread_marker == 0) entropy->insufficient_data = FALSE; return TRUE; } /* * Decode and return nMCU's worth of Huffman-compressed differences. * Each MCU is also disassembled and placed accordingly in diff_buf. * * MCU_col_num specifies the column of the first MCU being requested within * the MCU-row. This tells us where to position the output row pointers in * diff_buf. * * Returns the number of MCUs decoded. This may be less than nMCU if data * source requested suspension. In that case no changes have been made to * permanent state. (Exception: some output differences may already have * been assigned. This is harmless for this module, since we'll just * re-assign them on the next call.) */ METHODDEF(JDIMENSION) decode_mcus (j_decompress_ptr cinfo, JDIFFIMAGE diff_buf, JDIMENSION MCU_row_num, JDIMENSION MCU_col_num, JDIMENSION nMCU) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; lhuff_entropy_ptr entropy = (lhuff_entropy_ptr) losslsd->entropy_private; unsigned int mcu_num; int sampn, ci, yoffset, MCU_width, ptrn; BITREAD_STATE_VARS; /* Set output pointer locations based on MCU_col_num */ for (ptrn = 0; ptrn < entropy->num_output_ptrs; ptrn++) { ci = entropy->output_ptr_info[ptrn].ci; yoffset = entropy->output_ptr_info[ptrn].yoffset; MCU_width = entropy->output_ptr_info[ptrn].MCU_width; entropy->output_ptr[ptrn] = diff_buf[ci][MCU_row_num + yoffset] + (MCU_col_num * MCU_width); } /* * If we've run out of data, zero out the buffers and return. * By resetting the undifferencer, the output samples will be CENTERJSAMPLE. * * NB: We should find a way to do this without interacting with the * undifferencer module directly. */ if (entropy->insufficient_data) { for (ptrn = 0; ptrn < entropy->num_output_ptrs; ptrn++) jzero_far((void FAR *) entropy->output_ptr[ptrn], nMCU * entropy->output_ptr_info[ptrn].MCU_width * SIZEOF(JDIFF)); (*losslsd->predict_process_restart) (cinfo); } else { /* Load up working state */ BITREAD_LOAD_STATE(cinfo,entropy->bitstate); /* Outer loop handles the number of MCU requested */ for (mcu_num = 0; mcu_num < nMCU; mcu_num++) { /* Inner loop handles the samples in the MCU */ for (sampn = 0; sampn < cinfo->data_units_in_MCU; sampn++) { d_derived_tbl * dctbl = entropy->cur_tbls[sampn]; register int s, r; /* Section H.2.2: decode the sample difference */ HUFF_DECODE(s, br_state, dctbl, return mcu_num, label1); if (s) { if (s == 16) /* special case: always output 32768 */ s = 32768; else { /* normal case: fetch subsequent bits */ CHECK_BIT_BUFFER(br_state, s, return mcu_num); r = GET_BITS(s); s = HUFF_EXTEND(r, s); } } /* Output the sample difference */ *entropy->output_ptr[entropy->output_ptr_index[sampn]]++ = (JDIFF) s; } /* Completed MCU, so update state */ BITREAD_SAVE_STATE(cinfo,entropy->bitstate); } } return nMCU; } /* * Module initialization routine for lossless Huffman entropy decoding. */ GLOBAL(void) jinit_lhuff_decoder (j_decompress_ptr cinfo) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; lhuff_entropy_ptr entropy; int i; entropy = (lhuff_entropy_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(lhuff_entropy_decoder)); losslsd->entropy_private = (void *) entropy; losslsd->entropy_start_pass = start_pass_lhuff_decoder; losslsd->entropy_process_restart = process_restart; losslsd->entropy_decode_mcus = decode_mcus; /* Mark tables unallocated */ for (i = 0; i < NUM_HUFF_TBLS; i++) { entropy->derived_tbls[i] = NULL; } } #endif /* D_LOSSLESS_SUPPORTED */ ��������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdhuff.c�������������������������������������������������0000644�0001750�0001750�00000026342�12320456500�021441� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdhuff.c * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains Huffman entropy decoding routines which are shared * by the sequential, progressive and lossless decoders. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossy.h" /* Private declarations for lossy codec */ #include "jlossls.h" /* Private declarations for lossless codec */ #include "jdhuff.h" /* Declarations shared with jd*huff.c */ /* * Compute the derived values for a Huffman table. * This routine also performs some validation checks on the table. */ GLOBAL(void) jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, d_derived_tbl ** pdtbl) { JHUFF_TBL *htbl; d_derived_tbl *dtbl; int p, i, l, si, numsymbols; int lookbits, ctr; char huffsize[257]; unsigned int huffcode[257]; unsigned int code; /* Note that huffsize[] and huffcode[] are filled in code-length order, * paralleling the order of the symbols themselves in htbl->huffval[]. */ /* Find the input Huffman table */ if (tblno < 0 || tblno >= NUM_HUFF_TBLS) ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno); htbl = isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno]; if (htbl == NULL) ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno); /* Allocate a workspace if we haven't already done so. */ if (*pdtbl == NULL) *pdtbl = (d_derived_tbl *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(d_derived_tbl)); dtbl = *pdtbl; dtbl->pub = htbl; /* fill in back link */ /* Figure C.1: make table of Huffman code length for each symbol */ p = 0; for (l = 1; l <= 16; l++) { i = (int) htbl->bits[l]; if (i < 0 || p + i > 256) /* protect against table overrun */ ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); while (i--) huffsize[p++] = (char) l; } huffsize[p] = 0; numsymbols = p; /* Figure C.2: generate the codes themselves */ /* We also validate that the counts represent a legal Huffman code tree. */ code = 0; si = huffsize[0]; p = 0; while (huffsize[p]) { while (((int) huffsize[p]) == si) { huffcode[p++] = code; code++; } /* code is now 1 more than the last code used for codelength si; but * it must still fit in si bits, since no code is allowed to be all ones. * BUG FIX 2001-09-03: Comparison must be >, not >= */ if (((INT32) code) > (((INT32) 1) << si)) ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); code <<= 1; si++; } /* Figure F.15: generate decoding tables for bit-sequential decoding */ p = 0; for (l = 1; l <= 16; l++) { if (htbl->bits[l]) { /* valoffset[l] = huffval[] index of 1st symbol of code length l, * minus the minimum code of length l */ dtbl->valoffset[l] = (INT32) p - (INT32) huffcode[p]; p += htbl->bits[l]; dtbl->maxcode[l] = huffcode[p-1]; /* maximum code of length l */ } else { dtbl->maxcode[l] = -1; /* -1 if no codes of this length */ } } dtbl->maxcode[17] = 0xFFFFFL; /* ensures jpeg_huff_decode terminates */ /* Compute lookahead tables to speed up decoding. * First we set all the table entries to 0, indicating "too long"; * then we iterate through the Huffman codes that are short enough and * fill in all the entries that correspond to bit sequences starting * with that code. */ MEMZERO(dtbl->look_nbits, SIZEOF(dtbl->look_nbits)); p = 0; for (l = 1; l <= HUFF_LOOKAHEAD; l++) { for (i = 1; i <= (int) htbl->bits[l]; i++, p++) { /* l = current code's length, p = its index in huffcode[] & huffval[]. */ /* Generate left-justified code followed by all possible bit sequences */ lookbits = huffcode[p] << (HUFF_LOOKAHEAD-l); for (ctr = 1 << (HUFF_LOOKAHEAD-l); ctr > 0; ctr--) { dtbl->look_nbits[lookbits] = l; dtbl->look_sym[lookbits] = htbl->huffval[p]; lookbits++; } } } /* Validate symbols as being reasonable. * For AC tables, we make no check, but accept all byte values 0..255. * For DC tables, we require the symbols to be in range 0..16. * (Tighter bounds could be applied depending on the data depth and mode, * but this is sufficient to ensure safe decoding.) */ if (isDC) { for (i = 0; i < numsymbols; i++) { int sym = htbl->huffval[i]; /* The following file contains a value of 17 in the huffman table, which is impossible * according to ISO 10918-1, H.1.2.2 Huffman coding of the modulo difference * and table H.2. * PHILIPS_Gyroscan-12-Jpeg_Extended_Process_2_4.dcm * MM, 2008/08/12 I am breaking backward compatibility and decide not to support this image * anymore. In fact the decompression using another library: PVRG was giving me * another result anyway. * * Steps: * * $ gdcmconv --raw -i PHILIPS_Gyroscan-12-Jpeg_Extended_Process_2_4.dcm -o bla.dcm * $ gdcmraw -i bla.dcm -o bla.raw * $ gdcmraw -i PHILIPS_Gyroscan-12-Jpeg_Extended_Process_2_4.dcm -o philips.jpg * $ pvrgjpeg -d philips * $ dd conv=swab if=philips.jpg.0 of=philips.raw * $ vbindiff bla.raw philips.raw * * $ md5sum bla.raw philips.raw * 4b0021efe5a675f24c82e1ff28a1e2eb bla.raw * d93d2f78d845c7a132489aab92eadd32 philips.raw * * * footnote, I get a much closer result doing: * $ pvrgjpeg -a -y -d philips * after that the number of diff with IJG is getting lower * * 0f2570f5d91ddea5bd9d3825a86eaabe philips.raw */ if (sym < 0 || sym > 16) ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); } } } /* * Out-of-line code for bit fetching. * See jdhuff.h for info about usage. * Note: current values of get_buffer and bits_left are passed as parameters, * but are returned in the corresponding fields of the state struct. * * On most machines MIN_GET_BITS should be 25 to allow the full 32-bit width * of get_buffer to be used. (On machines with wider words, an even larger * buffer could be used.) However, on some machines 32-bit shifts are * quite slow and take time proportional to the number of places shifted. * (This is true with most PC compilers, for instance.) In this case it may * be a win to set MIN_GET_BITS to the minimum value of 15. This reduces the * average shift distance at the cost of more calls to jpeg_fill_bit_buffer. */ #ifdef SLOW_SHIFT_32 #define MIN_GET_BITS 15 /* minimum allowable value */ #else #define MIN_GET_BITS (BIT_BUF_SIZE-7) #endif GLOBAL(boolean) jpeg_fill_bit_buffer (bitread_working_state * state, register bit_buf_type get_buffer, register int bits_left, int nbits) /* Load up the bit buffer to a depth of at least nbits */ { /* Copy heavily used state fields into locals (hopefully registers) */ register const JOCTET * next_input_byte = state->next_input_byte; register size_t bytes_in_buffer = state->bytes_in_buffer; j_decompress_ptr cinfo = state->cinfo; /* Attempt to load at least MIN_GET_BITS bits into get_buffer. */ /* (It is assumed that no request will be for more than that many bits.) */ /* We fail to do so only if we hit a marker or are forced to suspend. */ if (cinfo->unread_marker == 0) { /* cannot advance past a marker */ while (bits_left < MIN_GET_BITS) { register int c; /* Attempt to read a byte */ if (bytes_in_buffer == 0) { if (! (*cinfo->src->fill_input_buffer) (cinfo)) return FALSE; next_input_byte = cinfo->src->next_input_byte; bytes_in_buffer = cinfo->src->bytes_in_buffer; } bytes_in_buffer--; c = GETJOCTET(*next_input_byte++); /* If it's 0xFF, check and discard stuffed zero byte */ if (c == 0xFF) { /* Loop here to discard any padding FF's on terminating marker, * so that we can save a valid unread_marker value. NOTE: we will * accept multiple FF's followed by a 0 as meaning a single FF data * byte. This data pattern is not valid according to the standard. */ do { if (bytes_in_buffer == 0) { if (! (*cinfo->src->fill_input_buffer) (cinfo)) return FALSE; next_input_byte = cinfo->src->next_input_byte; bytes_in_buffer = cinfo->src->bytes_in_buffer; } bytes_in_buffer--; c = GETJOCTET(*next_input_byte++); } while (c == 0xFF); if (c == 0) { /* Found FF/00, which represents an FF data byte */ c = 0xFF; } else { /* Oops, it's actually a marker indicating end of compressed data. * Save the marker code for later use. * Fine point: it might appear that we should save the marker into * bitread working state, not straight into permanent state. But * once we have hit a marker, we cannot need to suspend within the * current MCU, because we will read no more bytes from the data * source. So it is OK to update permanent state right away. */ cinfo->unread_marker = c; /* See if we need to insert some fake zero bits. */ goto no_more_bytes; } } /* OK, load c into get_buffer */ get_buffer = (get_buffer << 8) | c; bits_left += 8; } /* end while */ } else { no_more_bytes: /* We get here if we've read the marker that terminates the compressed * data segment. There should be enough bits in the buffer register * to satisfy the request; if so, no problem. */ if (nbits > bits_left) { /* Uh-oh. Report corrupted data to user and stuff zeroes into * the data stream, so that we can produce some kind of image. * We use a nonvolatile flag to ensure that only one warning message * appears per data segment. */ huffd_common_ptr huffd; if (cinfo->process == JPROC_LOSSLESS) huffd = (huffd_common_ptr) ((j_lossless_d_ptr) cinfo->codec)->entropy_private; else huffd = (huffd_common_ptr) ((j_lossy_d_ptr) cinfo->codec)->entropy_private; if (! huffd->insufficient_data) { WARNMS(cinfo, JWRN_HIT_MARKER); huffd->insufficient_data = TRUE; } /* Fill the buffer with zero bits */ get_buffer <<= MIN_GET_BITS - bits_left; bits_left = MIN_GET_BITS; } } /* Unload the local registers */ state->next_input_byte = next_input_byte; state->bytes_in_buffer = bytes_in_buffer; state->get_buffer = get_buffer; state->bits_left = bits_left; return TRUE; } /* * Out-of-line code for Huffman code decoding. * See jdhuff.h for info about usage. */ GLOBAL(int) jpeg_huff_decode (bitread_working_state * state, register bit_buf_type get_buffer, register int bits_left, d_derived_tbl * htbl, int min_bits) { register int l = min_bits; register INT32 code; /* HUFF_DECODE has determined that the code is at least min_bits */ /* bits long, so fetch that many bits in one swoop. */ CHECK_BIT_BUFFER(*state, l, return -1); code = GET_BITS(l); /* Collect the rest of the Huffman code one bit at a time. */ /* This is per Figure F.16 in the JPEG spec. */ while (code > htbl->maxcode[l]) { code <<= 1; CHECK_BIT_BUFFER(*state, 1, return -1); code |= GET_BITS(1); l++; } /* Unload the local registers */ state->get_buffer = get_buffer; state->bits_left = bits_left; /* With garbage input we may reach the sentinel value l = 17. */ if (l > 16) { WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE); return 0; /* fake a zero as the safest result */ } return htbl->pub->huffval[ (int) (code + htbl->valoffset[l]) ]; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jlossy.h�������������������������������������������������0000644�0001750�0001750�00000007554�12320456500�021527� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jlossy.h * * Copyright (C) 1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This include file contains common declarations for the lossy (DCT-based) * JPEG codec modules. */ #ifndef JLOSSY_H #define JLOSSY_H #ifdef __cplusplus extern "C" { #endif // cplusplus /* Lossy-specific compression codec (compressor proper) */ typedef struct { struct jpeg_c_codec pub; /* public fields */ /* Coefficient buffer control */ JMETHOD(void, coef_start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); /* JMETHOD(boolean, coef_compress_data, (j_compress_ptr cinfo, JSAMPIMAGE input_buf));*/ /* Pointer to data which is private to coef module */ void *coef_private; /* Forward DCT (also controls coefficient quantization) */ JMETHOD(void, fdct_start_pass, (j_compress_ptr cinfo)); /* perhaps this should be an array??? */ JMETHOD(void, fdct_forward_DCT, (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY sample_data, JBLOCKROW coef_blocks, JDIMENSION start_row, JDIMENSION start_col, JDIMENSION num_blocks)); /* Pointer to data which is private to fdct module */ void *fdct_private; /* Entropy encoding */ JMETHOD(boolean, entropy_encode_mcu, (j_compress_ptr cinfo, JBLOCKROW *MCU_data)); /* Pointer to data which is private to entropy module */ void *entropy_private; } jpeg_lossy_c_codec; typedef jpeg_lossy_c_codec * j_lossy_c_ptr; typedef JMETHOD(void, inverse_DCT_method_ptr, (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); /* Lossy-specific decompression codec (decompressor proper) */ typedef struct { struct jpeg_d_codec pub; /* public fields */ /* Coefficient buffer control */ JMETHOD(void, coef_start_input_pass, (j_decompress_ptr cinfo)); JMETHOD(void, coef_start_output_pass, (j_decompress_ptr cinfo)); /* Pointer to array of coefficient virtual arrays, or NULL if none */ jvirt_barray_ptr *coef_arrays; /* Pointer to data which is private to coef module */ void *coef_private; /* Entropy decoding */ JMETHOD(void, entropy_start_pass, (j_decompress_ptr cinfo)); JMETHOD(boolean, entropy_decode_mcu, (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)); /* This is here to share code between baseline and progressive decoders; */ /* other modules probably should not use it */ boolean entropy_insufficient_data; /* set TRUE after emitting warning */ /* Pointer to data which is private to entropy module */ void *entropy_private; /* Inverse DCT (also performs dequantization) */ JMETHOD(void, idct_start_pass, (j_decompress_ptr cinfo)); /* It is useful to allow each component to have a separate IDCT method. */ inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS]; /* Pointer to data which is private to idct module */ void *idct_private; } jpeg_lossy_d_codec; typedef jpeg_lossy_d_codec * j_lossy_d_ptr; /* Compression module initialization routines */ EXTERN(void) jinit_lossy_c_codec JPP((j_compress_ptr cinfo)); EXTERN(void) jinit_c_coef_controller JPP((j_compress_ptr cinfo, boolean need_full_buffer)); EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo)); EXTERN(void) jinit_shuff_encoder JPP((j_compress_ptr cinfo)); EXTERN(void) jinit_phuff_encoder JPP((j_compress_ptr cinfo)); /* Decompression module initialization routines */ EXTERN(void) jinit_lossy_d_codec JPP((j_decompress_ptr cinfo)); EXTERN(void) jinit_d_coef_controller JPP((j_decompress_ptr cinfo, boolean need_full_buffer)); EXTERN(void) jinit_shuff_decoder JPP((j_decompress_ptr cinfo)); EXTERN(void) jinit_phuff_decoder JPP((j_decompress_ptr cinfo)); EXTERN(void) jinit_inverse_dct JPP((j_decompress_ptr cinfo)); #ifdef __cplusplus } #endif // cplusplus #endif /* JLOSSY_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jfdctint.c�����������������������������������������������0000644�0001750�0001750�00000025472�12320456500�022003� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jfdctint.c * * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains a slow-but-accurate integer implementation of the * forward DCT (Discrete Cosine Transform). * * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT * on each column. Direct algorithms are also available, but they are * much more complex and seem not to be any faster when reduced to code. * * This implementation is based on an algorithm described in * C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT * Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics, * Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991. * The primary algorithm described there uses 11 multiplies and 29 adds. * We use their alternate method with 12 multiplies and 32 adds. * The advantage of this method is that no data path contains more than one * multiplication; this allows a very simple and accurate implementation in * scaled fixed-point arithmetic, with a minimal number of shifts. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jdct.h" /* Private declarations for DCT subsystem */ #ifdef DCT_ISLOW_SUPPORTED /* * This module is specialized to the case DCTSIZE = 8. */ #if DCTSIZE != 8 Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ #endif /* * The poop on this scaling stuff is as follows: * * Each 1-D DCT step produces outputs which are a factor of sqrt(N) * larger than the true DCT outputs. The final outputs are therefore * a factor of N larger than desired; since N=8 this can be cured by * a simple right shift at the end of the algorithm. The advantage of * this arrangement is that we save two multiplications per 1-D DCT, * because the y0 and y4 outputs need not be divided by sqrt(N). * In the IJG code, this factor of 8 is removed by the quantization step * (in jcdctmgr.c), NOT in this module. * * We have to do addition and subtraction of the integer inputs, which * is no problem, and multiplication by fractional constants, which is * a problem to do in integer arithmetic. We multiply all the constants * by CONST_SCALE and convert them to integer constants (thus retaining * CONST_BITS bits of precision in the constants). After doing a * multiplication we have to divide the product by CONST_SCALE, with proper * rounding, to produce the correct output. This division can be done * cheaply as a right shift of CONST_BITS bits. We postpone shifting * as long as possible so that partial sums can be added together with * full fractional precision. * * The outputs of the first pass are scaled up by PASS1_BITS bits so that * they are represented to better-than-integral precision. These outputs * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word * with the recommended scaling. (For 12-bit sample data, the intermediate * array is INT32 anyway.) * * To avoid overflow of the 32-bit intermediate results in pass 2, we must * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis * shows that the values given below are the most effective. */ #if BITS_IN_JSAMPLE == 8 #define CONST_BITS 13 #define PASS1_BITS 2 #else #define CONST_BITS 13 #define PASS1_BITS 1 /* lose a little precision to avoid overflow */ #endif /* Some C compilers fail to reduce "FIX(constant)" at compile time, thus * causing a lot of useless floating-point operations at run time. * To get around this we use the following pre-calculated constants. * If you change CONST_BITS you may want to add appropriate values. * (With a reasonable C compiler, you can just rely on the FIX() macro...) */ #if CONST_BITS == 13 #define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */ #define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */ #define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */ #define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */ #define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */ #define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */ #define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */ #define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */ #define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */ #define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */ #define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */ #define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */ #else #define FIX_0_298631336 FIX(0.298631336) #define FIX_0_390180644 FIX(0.390180644) #define FIX_0_541196100 FIX(0.541196100) #define FIX_0_765366865 FIX(0.765366865) #define FIX_0_899976223 FIX(0.899976223) #define FIX_1_175875602 FIX(1.175875602) #define FIX_1_501321110 FIX(1.501321110) #define FIX_1_847759065 FIX(1.847759065) #define FIX_1_961570560 FIX(1.961570560) #define FIX_2_053119869 FIX(2.053119869) #define FIX_2_562915447 FIX(2.562915447) #define FIX_3_072711026 FIX(3.072711026) #endif /* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. * For 8-bit samples with the recommended scaling, all the variable * and constant values involved are no more than 16 bits wide, so a * 16x16->32 bit multiply can be used instead of a full 32x32 multiply. * For 12-bit samples, a full 32-bit multiplication will be needed. */ #if BITS_IN_JSAMPLE == 8 #define MULTIPLY(var,const) MULTIPLY16C16(var,const) #else #define MULTIPLY(var,const) ((var) * (const)) #endif /* * Perform the forward DCT on one block of samples. */ GLOBAL(void) jpeg_fdct_islow (DCTELEM * data) { INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; INT32 tmp10, tmp11, tmp12, tmp13; INT32 z1, z2, z3, z4, z5; DCTELEM *dataptr; int ctr; SHIFT_TEMPS /* Pass 1: process rows. */ /* Note results are scaled up by sqrt(8) compared to a true DCT; */ /* furthermore, we scale the results by 2**PASS1_BITS. */ dataptr = data; for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { tmp0 = dataptr[0] + dataptr[7]; tmp7 = dataptr[0] - dataptr[7]; tmp1 = dataptr[1] + dataptr[6]; tmp6 = dataptr[1] - dataptr[6]; tmp2 = dataptr[2] + dataptr[5]; tmp5 = dataptr[2] - dataptr[5]; tmp3 = dataptr[3] + dataptr[4]; tmp4 = dataptr[3] - dataptr[4]; /* Even part per LL&M figure 1 --- note that published figure is faulty; * rotator "sqrt(2)*c1" should be "sqrt(2)*c6". */ tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; dataptr[0] = (DCTELEM) ((tmp10 + tmp11) << PASS1_BITS); dataptr[4] = (DCTELEM) ((tmp10 - tmp11) << PASS1_BITS); z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100); dataptr[2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865), CONST_BITS-PASS1_BITS); dataptr[6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065), CONST_BITS-PASS1_BITS); /* Odd part per figure 8 --- note paper omits factor of sqrt(2). * cK represents cos(K*pi/16). * i0..i3 in the paper are tmp4..tmp7 here. */ z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; z3 = tmp4 + tmp6; z4 = tmp5 + tmp7; z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ z3 += z5; z4 += z5; dataptr[7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, CONST_BITS-PASS1_BITS); dataptr[5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, CONST_BITS-PASS1_BITS); dataptr[3] = (DCTELEM) DESCALE(tmp6 + z2 + z3, CONST_BITS-PASS1_BITS); dataptr[1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, CONST_BITS-PASS1_BITS); dataptr += DCTSIZE; /* advance pointer to next row */ } /* Pass 2: process columns. * We remove the PASS1_BITS scaling, but leave the results scaled up * by an overall factor of 8. */ dataptr = data; for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7]; tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7]; tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6]; tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6]; tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5]; tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; /* Even part per LL&M figure 1 --- note that published figure is faulty; * rotator "sqrt(2)*c1" should be "sqrt(2)*c6". */ tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp11, PASS1_BITS); dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp10 - tmp11, PASS1_BITS); z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100); dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865), CONST_BITS+PASS1_BITS); dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065), CONST_BITS+PASS1_BITS); /* Odd part per figure 8 --- note paper omits factor of sqrt(2). * cK represents cos(K*pi/16). * i0..i3 in the paper are tmp4..tmp7 here. */ z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; z3 = tmp4 + tmp6; z4 = tmp5 + tmp7; z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ z3 += z5; z4 += z5; dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, CONST_BITS+PASS1_BITS); dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, CONST_BITS+PASS1_BITS); dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp6 + z2 + z3, CONST_BITS+PASS1_BITS); dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, CONST_BITS+PASS1_BITS); dataptr++; /* advance pointer to next column */ } } #endif /* DCT_ISLOW_SUPPORTED */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdhuff.h�������������������������������������������������0000644�0001750�0001750�00000022205�12320456500�021440� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdhuff.h * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains declarations for Huffman entropy decoding routines * that are shared between the sequential decoder (jdhuff.c), the * progressive decoder (jdphuff.c) and the lossless decoder (jdlhuff.c). * No other modules need to see these. */ #ifdef __cplusplus extern "C" { #endif // cplusplus /* Short forms of external names for systems with brain-damaged linkers. */ #ifdef NEED_SHORT_EXTERNAL_NAMES #define jpeg_make_d_derived_tbl jMkDDerived #define jpeg_fill_bit_buffer jFilBitBuf #define jpeg_huff_decode jHufDecode #endif /* NEED_SHORT_EXTERNAL_NAMES */ /* Derived data constructed for each Huffman table */ #define HUFF_LOOKAHEAD 8 /* # of bits of lookahead */ typedef struct { /* Basic tables: (element [0] of each array is unused) */ INT32 maxcode[18]; /* largest code of length k (-1 if none) */ /* (maxcode[17] is a sentinel to ensure jpeg_huff_decode terminates) */ INT32 valoffset[17]; /* huffval[] offset for codes of length k */ /* valoffset[k] = huffval[] index of 1st symbol of code length k, less * the smallest code of length k; so given a code of length k, the * corresponding symbol is huffval[code + valoffset[k]] */ /* Link to public Huffman table (needed only in jpeg_huff_decode) */ JHUFF_TBL *pub; /* Lookahead tables: indexed by the next HUFF_LOOKAHEAD bits of * the input data stream. If the next Huffman code is no more * than HUFF_LOOKAHEAD bits long, we can obtain its length and * the corresponding symbol directly from these tables. */ int look_nbits[1<<HUFF_LOOKAHEAD]; /* # bits, or 0 if too long */ UINT8 look_sym[1<<HUFF_LOOKAHEAD]; /* symbol, or unused */ } d_derived_tbl; /* Expand a Huffman table definition into the derived format */ EXTERN(void) jpeg_make_d_derived_tbl JPP((j_decompress_ptr cinfo, boolean isDC, int tblno, d_derived_tbl ** pdtbl)); /* * Fetching the next N bits from the input stream is a time-critical operation * for the Huffman decoders. We implement it with a combination of inline * macros and out-of-line subroutines. Note that N (the number of bits * demanded at one time) never exceeds 15 for JPEG use. * * We read source bytes into get_buffer and dole out bits as needed. * If get_buffer already contains enough bits, they are fetched in-line * by the macros CHECK_BIT_BUFFER and GET_BITS. When there aren't enough * bits, jpeg_fill_bit_buffer is called; it will attempt to fill get_buffer * as full as possible (not just to the number of bits needed; this * prefetching reduces the overhead cost of calling jpeg_fill_bit_buffer). * Note that jpeg_fill_bit_buffer may return FALSE to indicate suspension. * On TRUE return, jpeg_fill_bit_buffer guarantees that get_buffer contains * at least the requested number of bits --- dummy zeroes are inserted if * necessary. */ typedef INT32 bit_buf_type; /* type of bit-extraction buffer */ #define BIT_BUF_SIZE 32 /* size of buffer in bits */ /* If long is > 32 bits on your machine, and shifting/masking longs is * reasonably fast, making bit_buf_type be long and setting BIT_BUF_SIZE * appropriately should be a win. Unfortunately we can't define the size * with something like #define BIT_BUF_SIZE (sizeof(bit_buf_type)*8) * because not all machines measure sizeof in 8-bit bytes. */ typedef struct { /* Bitreading state saved across MCUs */ bit_buf_type get_buffer; /* current bit-extraction buffer */ int bits_left; /* # of unused bits in it */ } bitread_perm_state; typedef struct { /* Bitreading working state within an MCU */ /* Current data source location */ /* We need a copy, rather than munging the original, in case of suspension */ const JOCTET * next_input_byte; /* => next byte to read from source */ size_t bytes_in_buffer; /* # of bytes remaining in source buffer */ /* Bit input buffer --- note these values are kept in register variables, * not in this struct, inside the inner loops. */ bit_buf_type get_buffer; /* current bit-extraction buffer */ int bits_left; /* # of unused bits in it */ /* Pointer needed by jpeg_fill_bit_buffer. */ j_decompress_ptr cinfo; /* back link to decompress master record */ } bitread_working_state; /* Macros to declare and load/save bitread local variables. */ #define BITREAD_STATE_VARS \ register bit_buf_type get_buffer; \ register int bits_left; \ bitread_working_state br_state #define BITREAD_LOAD_STATE(cinfop,permstate) \ br_state.cinfo = cinfop; \ br_state.next_input_byte = cinfop->src->next_input_byte; \ br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \ get_buffer = permstate.get_buffer; \ bits_left = permstate.bits_left; #define BITREAD_SAVE_STATE(cinfop,permstate) \ cinfop->src->next_input_byte = br_state.next_input_byte; \ cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \ permstate.get_buffer = get_buffer; \ permstate.bits_left = bits_left /* * These macros provide the in-line portion of bit fetching. * Use CHECK_BIT_BUFFER to ensure there are N bits in get_buffer * before using GET_BITS, PEEK_BITS, or DROP_BITS. * The variables get_buffer and bits_left are assumed to be locals, * but the state struct might not be (jpeg_huff_decode needs this). * CHECK_BIT_BUFFER(state,n,action); * Ensure there are N bits in get_buffer; if suspend, take action. * val = GET_BITS(n); * Fetch next N bits. * val = PEEK_BITS(n); * Fetch next N bits without removing them from the buffer. * DROP_BITS(n); * Discard next N bits. * The value N should be a simple variable, not an expression, because it * is evaluated multiple times. */ #define CHECK_BIT_BUFFER(state,nbits,action) \ { if (bits_left < (nbits)) { \ if (! jpeg_fill_bit_buffer(&(state),get_buffer,bits_left,nbits)) \ { action; } \ get_buffer = (state).get_buffer; bits_left = (state).bits_left; } } #define GET_BITS(nbits) \ (((int) (get_buffer >> (bits_left -= (nbits)))) & ((1<<(nbits))-1)) #define PEEK_BITS(nbits) \ (((int) (get_buffer >> (bits_left - (nbits)))) & ((1<<(nbits))-1)) #define DROP_BITS(nbits) \ (bits_left -= (nbits)) /* Load up the bit buffer to a depth of at least nbits */ EXTERN(boolean) jpeg_fill_bit_buffer JPP((bitread_working_state * state, register bit_buf_type get_buffer, register int bits_left, int nbits)); /* * Code for extracting next Huffman-coded symbol from input bit stream. * Again, this is time-critical and we make the main paths be macros. * * We use a lookahead table to process codes of up to HUFF_LOOKAHEAD bits * without looping. Usually, more than 95% of the Huffman codes will be 8 * or fewer bits long. The few overlength codes are handled with a loop, * which need not be inline code. * * Notes about the HUFF_DECODE macro: * 1. Near the end of the data segment, we may fail to get enough bits * for a lookahead. In that case, we do it the hard way. * 2. If the lookahead table contains no entry, the next code must be * more than HUFF_LOOKAHEAD bits long. * 3. jpeg_huff_decode returns -1 if forced to suspend. */ #define HUFF_DECODE(result,state,htbl,failaction,slowlabel) \ { register int nb, look; \ if (bits_left < HUFF_LOOKAHEAD) { \ if (! jpeg_fill_bit_buffer(&state,get_buffer,bits_left, 0)) {failaction;} \ get_buffer = state.get_buffer; bits_left = state.bits_left; \ if (bits_left < HUFF_LOOKAHEAD) { \ nb = 1; goto slowlabel; \ } \ } \ look = PEEK_BITS(HUFF_LOOKAHEAD); \ if ((nb = htbl->look_nbits[look]) != 0) { \ DROP_BITS(nb); \ result = htbl->look_sym[look]; \ } else { \ nb = HUFF_LOOKAHEAD+1; \ slowlabel: \ if ((result=jpeg_huff_decode(&state,get_buffer,bits_left,htbl,nb)) < 0) \ { failaction; } \ get_buffer = state.get_buffer; bits_left = state.bits_left; \ } \ } /* Out-of-line case for Huffman code fetching */ EXTERN(int) jpeg_huff_decode JPP((bitread_working_state * state, register bit_buf_type get_buffer, register int bits_left, d_derived_tbl * htbl, int min_bits)); /* Common fields between sequential, progressive and lossless Huffman entropy * decoder master structs. */ #define huffd_common_fields \ boolean insufficient_data; /* set TRUE after emmitting warning */ \ /* These fields are loaded into local variables at start of each MCU. \ * In case of suspension, we exit WITHOUT updating them. \ */ \ bitread_perm_state bitstate /* Bit buffer at start of MCU */ /* Routines that are to be used by any or all of the entropy decoders are * declared to receive a pointer to this structure. There are no actual * instances of huffd_common_struct, only of shuff_entropy_decoder, * phuff_entropy_decoder and lhuff_entropy_decoder. */ struct huffd_common_struct { huffd_common_fields; /* Fields common to all decoder struct types */ /* Additional fields follow in an actual shuff_entropy_decoder, * phuff_entropy_decoder or lhuff_entropy_decoder struct. All four structs * must agree on these initial fields! (This would be a lot cleaner in C++.) */ }; typedef struct huffd_common_struct * huffd_common_ptr; #ifdef __cplusplus } #endif // cplusplus �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jconfig.sas����������������������������������������������0000644�0001750�0001750�00000002275�12320456500�022155� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* jconfig.sas --- jconfig.h for Amiga systems using SAS C 6.0 and up. */ /* see jconfig.doc for explanations */ #define HAVE_PROTOTYPES #define HAVE_UNSIGNED_CHAR #define HAVE_UNSIGNED_SHORT /* #define void char */ /* #define const */ #undef CHAR_IS_UNSIGNED #define HAVE_STDDEF_H #define HAVE_STDLIB_H #undef NEED_BSD_STRINGS #undef NEED_SYS_TYPES_H #undef NEED_FAR_POINTERS #undef NEED_SHORT_EXTERNAL_NAMES #undef INCOMPLETE_TYPES_BROKEN #ifdef JPEG_INTERNALS #undef RIGHT_SHIFT_IS_UNSIGNED #define TEMP_DIRECTORY "JPEGTMP:" /* recommended setting for Amiga */ #define NO_MKTEMP /* SAS C doesn't have mktemp() */ #define SHORTxSHORT_32 /* produces better DCT code with SAS C */ #endif /* JPEG_INTERNALS */ #ifdef JPEG_CJPEG_DJPEG #define BMP_SUPPORTED /* BMP image file format */ #define GIF_SUPPORTED /* GIF image file format */ #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ #undef RLE_SUPPORTED /* Utah RLE image file format */ #define TARGA_SUPPORTED /* Targa image file format */ #define TWO_FILE_COMMANDLINE #define NEED_SIGNAL_CATCHER #undef DONT_USE_B_MODE #undef PROGRESS_REPORT /* optional */ #endif /* JPEG_CJPEG_DJPEG */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jconfig.vms����������������������������������������������0000644�0001750�0001750�00000001770�12320456500�022173� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* jconfig.vms --- jconfig.h for use on Digital VMS. */ /* see jconfig.doc for explanations */ #define HAVE_PROTOTYPES #define HAVE_UNSIGNED_CHAR #define HAVE_UNSIGNED_SHORT /* #define void char */ /* #define const */ #undef CHAR_IS_UNSIGNED #define HAVE_STDDEF_H #define HAVE_STDLIB_H #undef NEED_BSD_STRINGS #undef NEED_SYS_TYPES_H #undef NEED_FAR_POINTERS #undef NEED_SHORT_EXTERNAL_NAMES #undef INCOMPLETE_TYPES_BROKEN #ifdef JPEG_INTERNALS #undef RIGHT_SHIFT_IS_UNSIGNED #endif /* JPEG_INTERNALS */ #ifdef JPEG_CJPEG_DJPEG #define BMP_SUPPORTED /* BMP image file format */ #define GIF_SUPPORTED /* GIF image file format */ #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ #undef RLE_SUPPORTED /* Utah RLE image file format */ #define TARGA_SUPPORTED /* Targa image file format */ #define TWO_FILE_COMMANDLINE /* Needed on VMS */ #undef NEED_SIGNAL_CATCHER #undef DONT_USE_B_MODE #undef PROGRESS_REPORT /* optional */ #endif /* JPEG_CJPEG_DJPEG */ ��������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jversion.h�����������������������������������������������0000644�0001750�0001750�00000000550�12320456500�022030� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jversion.h * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains software version identification. */ #define JVERSION "6b 27-Mar-1998" #define JCOPYRIGHT "Copyright (C) 1998, Thomas G. Lane" ��������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdatadst.c�����������������������������������������������0000644�0001750�0001750�00000012203�12320456500�021760� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdatadst.c * * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains compression data destination routines for the case of * emitting JPEG data to a file (or any stdio stream). While these routines * are sufficient for most applications, some will want to use a different * destination manager. * IMPORTANT: we assume that fwrite() will correctly transcribe an array of * JOCTETs into 8-bit-wide elements on external storage. If char is wider * than 8 bits on your machine, you may need to do some tweaking. */ /* this is not a core library module, so it doesn't define JPEG_INTERNALS */ #include "jinclude.h" #include "jpeglib.h" #include "jerror.h" /* Expanded data destination object for stdio output */ /** * \brief very low level C 'structure', used to decode jpeg file * Should not appear in the Doxygen supplied documentation */ typedef struct { struct jpeg_destination_mgr pub; /* public fields */ FILE * outfile; /* target stream */ JOCTET * buffer; /* start of buffer */ } my_destination_mgr; typedef my_destination_mgr * my_dest_ptr; #define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */ /* * Initialize destination --- called by jpeg_start_compress * before any data is actually written. */ METHODDEF(void) init_destination (j_compress_ptr cinfo) { my_dest_ptr dest = (my_dest_ptr) cinfo->dest; /* Allocate the output buffer --- it will be released when done with image */ dest->buffer = (JOCTET *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, OUTPUT_BUF_SIZE * SIZEOF(JOCTET)); dest->pub.next_output_byte = dest->buffer; dest->pub.free_in_buffer = OUTPUT_BUF_SIZE; } /* * Empty the output buffer --- called whenever buffer fills up. * * In typical applications, this should write the entire output buffer * (ignoring the current state of next_output_byte & free_in_buffer), * reset the pointer & count to the start of the buffer, and return TRUE * indicating that the buffer has been dumped. * * In applications that need to be able to suspend compression due to output * overrun, a FALSE return indicates that the buffer cannot be emptied now. * In this situation, the compressor will return to its caller (possibly with * an indication that it has not accepted all the supplied scanlines). The * application should resume compression after it has made more room in the * output buffer. Note that there are substantial restrictions on the use of * suspension --- see the documentation. * * When suspending, the compressor will back up to a convenient restart point * (typically the start of the current MCU). next_output_byte & free_in_buffer * indicate where the restart point will be if the current call returns FALSE. * Data beyond this point will be regenerated after resumption, so do not * write it out when emptying the buffer externally. */ METHODDEF(boolean) empty_output_buffer (j_compress_ptr cinfo) { my_dest_ptr dest = (my_dest_ptr) cinfo->dest; if (JFWRITE(dest->outfile, dest->buffer, OUTPUT_BUF_SIZE) != (size_t) OUTPUT_BUF_SIZE) ERREXIT(cinfo, JERR_FILE_WRITE); dest->pub.next_output_byte = dest->buffer; dest->pub.free_in_buffer = OUTPUT_BUF_SIZE; return TRUE; } /* * Terminate destination --- called by jpeg_finish_compress * after all data has been written. Usually needs to flush buffer. * * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding * application must deal with any cleanup that should happen even * for error exit. */ METHODDEF(void) term_destination (j_compress_ptr cinfo) { my_dest_ptr dest = (my_dest_ptr) cinfo->dest; size_t datacount = OUTPUT_BUF_SIZE - dest->pub.free_in_buffer; /* Write any data remaining in the buffer */ if (datacount > 0) { if (JFWRITE(dest->outfile, dest->buffer, datacount) != datacount) ERREXIT(cinfo, JERR_FILE_WRITE); } fflush(dest->outfile); /* Make sure we wrote the output file OK */ if (ferror(dest->outfile)) ERREXIT(cinfo, JERR_FILE_WRITE); } /* * Prepare for output to a stdio stream. * The caller must have already opened the stream, and is responsible * for closing it after finishing compression. */ GLOBAL(void) jpeg_stdio_dest (j_compress_ptr cinfo, FILE * outfile) { my_dest_ptr dest; /* The destination object is made permanent so that multiple JPEG images * can be written to the same file without re-executing jpeg_stdio_dest. * This makes it dangerous to use this manager and a different destination * manager serially with the same JPEG object, because their private object * sizes may be different. Caveat programmer. */ if (cinfo->dest == NULL) { /* first time for this JPEG object? */ cinfo->dest = (struct jpeg_destination_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, SIZEOF(my_destination_mgr)); } dest = (my_dest_ptr) cinfo->dest; dest->pub.init_destination = init_destination; dest->pub.empty_output_buffer = empty_output_buffer; dest->pub.term_destination = term_destination; dest->outfile = outfile; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jinclude.h�����������������������������������������������0000644�0001750�0001750�00000006421�12320456500�021771� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jinclude.h * * Copyright (C) 1991-1994, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file exists to provide a single place to fix any problems with * including the wrong system include files. (Common problems are taken * care of by the standard jconfig symbols, but on really weird systems * you may have to edit this file.) * * NOTE: this file is NOT intended to be included by applications using the * JPEG library. Most applications need only include jpeglib.h. */ /* Include auto-config file to find out which system include files we need. */ #include "jconfig.h" /* auto configuration options */ #define JCONFIG_INCLUDED /* so that jpeglib.h doesn't do it again */ #ifdef __cplusplus extern "C" { #endif // cplusplus /* * We need the NULL macro and size_t typedef. * On an ANSI-conforming system it is sufficient to include <stddef.h>. * Otherwise, we get them from <stdlib.h> or <stdio.h>; we may have to * pull in <sys/types.h> as well. * Note that the core JPEG library does not require <stdio.h>; * only the default error handler and data source/destination modules do. * But we must pull it in because of the references to FILE in jpeglib.h. * You can remove those references if you want to compile without <stdio.h>. */ #ifdef HAVE_STDDEF_H #include <stddef.h> #endif #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif #ifdef NEED_SYS_TYPES_H #include <sys/types.h> #endif #include <stdio.h> /* * We need memory copying and zeroing functions, plus strncpy(). * ANSI and System V implementations declare these in <string.h>. * BSD doesn't have the mem() functions, but it does have bcopy()/bzero(). * Some systems may declare memset and memcpy in <memory.h>. * * NOTE: we assume the size parameters to these functions are of type size_t. * Change the casts in these macros if not! */ #ifdef NEED_BSD_STRINGS #include <strings.h> #define MEMZERO(target,size) bzero((void *)(target), (size_t)(size)) #define MEMCOPY(dest,src,size) bcopy((const void *)(src), (void *)(dest), (size_t)(size)) #else /* not BSD, assume ANSI/SysV string lib */ #include <string.h> #define MEMZERO(target,size) memset((void *)(target), 0, (size_t)(size)) #define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size)) #endif /* * In ANSI C, and indeed any rational implementation, size_t is also the * type returned by sizeof(). However, it seems there are some irrational * implementations out there, in which sizeof() returns an int even though * size_t is defined as long or unsigned long. To ensure consistent results * we always use this SIZEOF() macro in place of using sizeof() directly. */ #define SIZEOF(object) ((size_t) sizeof(object)) /* * The modules that use fread() and fwrite() always invoke them through * these macros. On some systems you may need to twiddle the argument casts. * CAUTION: argument order is different from underlying functions! */ #define JFREAD(file,buf,sizeofbuf) \ ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) #define JFWRITE(file,buf,sizeofbuf) \ ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) #ifdef __cplusplus } #endif // cplusplus �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jlossls.h������������������������������������������������0000644�0001750�0001750�00000011471�12320456500�021666� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jlossls.h * * Copyright (C) 1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This include file contains common declarations for the lossless JPEG * codec modules. */ #ifndef JLOSSLS_H #define JLOSSLS_H #ifdef __cplusplus extern "C" { #endif // cplusplus /* * Table H.1: Predictors for lossless coding. */ #define PREDICTOR1 Ra #define PREDICTOR2 Rb #define PREDICTOR3 Rc #define PREDICTOR4 (int) ((INT32) Ra + (INT32) Rb - (INT32) Rc) #define PREDICTOR5 (int) ((INT32) Ra + RIGHT_SHIFT((INT32) Rb - (INT32) Rc, 1)) #define PREDICTOR6 (int) ((INT32) Rb + RIGHT_SHIFT((INT32) Ra - (INT32) Rc, 1)) #define PREDICTOR6_BUG (int) ((INT16) Rb + RIGHT_SHIFT((INT16) Ra - (INT16) Rc, 1)) #define PREDICTOR7 (int) RIGHT_SHIFT((INT32) Ra + (INT32) Rb, 1) typedef JMETHOD(void, predict_difference_method_ptr, (j_compress_ptr cinfo, int ci, JSAMPROW input_buf, JSAMPROW prev_row, JDIFFROW diff_buf, JDIMENSION width)); typedef JMETHOD(void, scaler_method_ptr, (j_compress_ptr cinfo, int ci, JSAMPROW input_buf, JSAMPROW output_buf, JDIMENSION width)); /* Lossless-specific compression codec (compressor proper) */ typedef struct { struct jpeg_c_codec pub; /* public fields */ /* Difference buffer control */ JMETHOD(void, diff_start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); /* Pointer to data which is private to diff controller */ void *diff_private; /* Entropy encoding */ JMETHOD(JDIMENSION, entropy_encode_mcus, (j_compress_ptr cinfo, JDIFFIMAGE diff_buf, JDIMENSION MCU_row_num, JDIMENSION MCU_col_num, JDIMENSION nMCU)); /* Pointer to data which is private to entropy module */ void *entropy_private; /* Prediction, differencing */ JMETHOD(void, predict_start_pass, (j_compress_ptr cinfo)); /* It is useful to allow each component to have a separate diff method. */ predict_difference_method_ptr predict_difference[MAX_COMPONENTS]; /* Pointer to data which is private to predictor module */ void *pred_private; /* Sample scaling */ JMETHOD(void, scaler_start_pass, (j_compress_ptr cinfo)); JMETHOD(void, scaler_scale, (j_compress_ptr cinfo, JSAMPROW input_buf, JSAMPROW output_buf, JDIMENSION width)); /* Pointer to data which is private to scaler module */ void *scaler_private; } jpeg_lossless_c_codec; typedef jpeg_lossless_c_codec * j_lossless_c_ptr; typedef JMETHOD(void, predict_undifference_method_ptr, (j_decompress_ptr cinfo, int comp_index, JDIFFROW diff_buf, JDIFFROW prev_row, JDIFFROW undiff_buf, JDIMENSION width)); /* Lossless-specific decompression codec (decompressor proper) */ typedef struct { struct jpeg_d_codec pub; /* public fields */ /* Difference buffer control */ JMETHOD(void, diff_start_input_pass, (j_decompress_ptr cinfo)); /* Pointer to data which is private to diff controller */ void *diff_private; /* Entropy decoding */ JMETHOD(void, entropy_start_pass, (j_decompress_ptr cinfo)); JMETHOD(boolean, entropy_process_restart, (j_decompress_ptr cinfo)); JMETHOD(JDIMENSION, entropy_decode_mcus, (j_decompress_ptr cinfo, JDIFFIMAGE diff_buf, JDIMENSION MCU_row_num, JDIMENSION MCU_col_num, JDIMENSION nMCU)); /* Pointer to data which is private to entropy module */ void *entropy_private; /* Prediction, undifferencing */ JMETHOD(void, predict_start_pass, (j_decompress_ptr cinfo)); JMETHOD(void, predict_process_restart, (j_decompress_ptr cinfo)); /* It is useful to allow each component to have a separate undiff method. */ predict_undifference_method_ptr predict_undifference[MAX_COMPONENTS]; /* Pointer to data which is private to predictor module */ void *pred_private; /* Sample scaling */ JMETHOD(void, scaler_start_pass, (j_decompress_ptr cinfo)); JMETHOD(void, scaler_scale, (j_decompress_ptr cinfo, JDIFFROW diff_buf, JSAMPROW output_buf, JDIMENSION width)); /* Pointer to data which is private to scaler module */ void *scaler_private; } jpeg_lossless_d_codec; typedef jpeg_lossless_d_codec * j_lossless_d_ptr; /* Compression module initialization routines */ EXTERN(void) jinit_lossless_c_codec JPP((j_compress_ptr cinfo)); EXTERN(void) jinit_lhuff_encoder JPP((j_compress_ptr cinfo)); EXTERN(void) jinit_differencer JPP((j_compress_ptr cinfo)); EXTERN(void) jinit_c_scaler JPP((j_compress_ptr cinfo)); /* Decompression module initialization routines */ EXTERN(void) jinit_lossless_d_codec JPP((j_decompress_ptr cinfo)); EXTERN(void) jinit_lhuff_decoder JPP((j_decompress_ptr cinfo)); EXTERN(void) jinit_undifferencer JPP((j_decompress_ptr cinfo)); EXTERN(void) jinit_d_scaler JPP((j_decompress_ptr cinfo)); #ifdef __cplusplus } #endif // cplusplus #endif /* JLOSSLS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdpostct.c�����������������������������������������������0000644�0001750�0001750�00000023150�12320456500�022017� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdpostct.c * * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains the decompression postprocessing controller. * This controller manages the upsampling, color conversion, and color * quantization/reduction steps; specifically, it controls the buffering * between upsample/color conversion and color quantization/reduction. * * If no color quantization/reduction is required, then this module has no * work to do, and it just hands off to the upsample/color conversion code. * An integrated upsample/convert/quantize process would replace this module * entirely. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" /* Private buffer controller object */ typedef struct { struct jpeg_d_post_controller pub; /* public fields */ /* Color quantization source buffer: this holds output data from * the upsample/color conversion step to be passed to the quantizer. * For two-pass color quantization, we need a full-image buffer; * for one-pass operation, a strip buffer is sufficient. */ jvirt_sarray_ptr whole_image; /* virtual array, or NULL if one-pass */ JSAMPARRAY buffer; /* strip buffer, or current strip of virtual */ JDIMENSION strip_height; /* buffer size in rows */ /* for two-pass mode only: */ JDIMENSION starting_row; /* row # of first row in current strip */ JDIMENSION next_row; /* index of next row to fill/empty in strip */ } my_post_controller; typedef my_post_controller * my_post_ptr; /* Forward declarations */ METHODDEF(void) post_process_1pass JPP((j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); #ifdef QUANT_2PASS_SUPPORTED METHODDEF(void) post_process_prepass JPP((j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); METHODDEF(void) post_process_2pass JPP((j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); #endif /* * Initialize for a processing pass. */ METHODDEF(void) start_pass_dpost (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) { my_post_ptr post = (my_post_ptr) cinfo->post; switch (pass_mode) { case JBUF_PASS_THRU: if (cinfo->quantize_colors) { /* Single-pass processing with color quantization. */ post->pub.post_process_data = post_process_1pass; /* We could be doing buffered-image output before starting a 2-pass * color quantization; in that case, jinit_d_post_controller did not * allocate a strip buffer. Use the virtual-array buffer as workspace. */ if (post->buffer == NULL) { post->buffer = (*cinfo->mem->access_virt_sarray) ((j_common_ptr) cinfo, post->whole_image, (JDIMENSION) 0, post->strip_height, TRUE); } } else { /* For single-pass processing without color quantization, * I have no work to do; just call the upsampler directly. */ post->pub.post_process_data = cinfo->upsample->upsample; } break; #ifdef QUANT_2PASS_SUPPORTED case JBUF_SAVE_AND_PASS: /* First pass of 2-pass quantization */ if (post->whole_image == NULL) ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); post->pub.post_process_data = post_process_prepass; break; case JBUF_CRANK_DEST: /* Second pass of 2-pass quantization */ if (post->whole_image == NULL) ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); post->pub.post_process_data = post_process_2pass; break; #endif /* QUANT_2PASS_SUPPORTED */ default: ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); break; } post->starting_row = post->next_row = 0; } /* * Process some data in the one-pass (strip buffer) case. * This is used for color precision reduction as well as one-pass quantization. */ METHODDEF(void) post_process_1pass (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail) { my_post_ptr post = (my_post_ptr) cinfo->post; JDIMENSION num_rows, max_rows; /* Fill the buffer, but not more than what we can dump out in one go. */ /* Note we rely on the upsampler to detect bottom of image. */ max_rows = out_rows_avail - *out_row_ctr; if (max_rows > post->strip_height) max_rows = post->strip_height; num_rows = 0; (*cinfo->upsample->upsample) (cinfo, input_buf, in_row_group_ctr, in_row_groups_avail, post->buffer, &num_rows, max_rows); /* Quantize and emit data. */ (*cinfo->cquantize->color_quantize) (cinfo, post->buffer, output_buf + *out_row_ctr, (int) num_rows); *out_row_ctr += num_rows; } #ifdef QUANT_2PASS_SUPPORTED /* * Process some data in the first pass of 2-pass quantization. */ METHODDEF(void) post_process_prepass (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail) { my_post_ptr post = (my_post_ptr) cinfo->post; JDIMENSION old_next_row, num_rows; (void)output_buf;(void)out_rows_avail; /* Reposition virtual buffer if at start of strip. */ if (post->next_row == 0) { post->buffer = (*cinfo->mem->access_virt_sarray) ((j_common_ptr) cinfo, post->whole_image, post->starting_row, post->strip_height, TRUE); } /* Upsample some data (up to a strip height's worth). */ old_next_row = post->next_row; (*cinfo->upsample->upsample) (cinfo, input_buf, in_row_group_ctr, in_row_groups_avail, post->buffer, &post->next_row, post->strip_height); /* Allow quantizer to scan new data. No data is emitted, */ /* but we advance out_row_ctr so outer loop can tell when we're done. */ if (post->next_row > old_next_row) { num_rows = post->next_row - old_next_row; (*cinfo->cquantize->color_quantize) (cinfo, post->buffer + old_next_row, (JSAMPARRAY) NULL, (int) num_rows); *out_row_ctr += num_rows; } /* Advance if we filled the strip. */ if (post->next_row >= post->strip_height) { post->starting_row += post->strip_height; post->next_row = 0; } } /* * Process some data in the second pass of 2-pass quantization. */ METHODDEF(void) post_process_2pass (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail) { my_post_ptr post = (my_post_ptr) cinfo->post; JDIMENSION num_rows, max_rows; (void)input_buf;(void)in_row_group_ctr;(void)in_row_groups_avail; /* Reposition virtual buffer if at start of strip. */ if (post->next_row == 0) { post->buffer = (*cinfo->mem->access_virt_sarray) ((j_common_ptr) cinfo, post->whole_image, post->starting_row, post->strip_height, FALSE); } /* Determine number of rows to emit. */ num_rows = post->strip_height - post->next_row; /* available in strip */ max_rows = out_rows_avail - *out_row_ctr; /* available in output area */ if (num_rows > max_rows) num_rows = max_rows; /* We have to check bottom of image here, can't depend on upsampler. */ max_rows = cinfo->output_height - post->starting_row; if (num_rows > max_rows) num_rows = max_rows; /* Quantize and emit data. */ (*cinfo->cquantize->color_quantize) (cinfo, post->buffer + post->next_row, output_buf + *out_row_ctr, (int) num_rows); *out_row_ctr += num_rows; /* Advance if we filled the strip. */ post->next_row += num_rows; if (post->next_row >= post->strip_height) { post->starting_row += post->strip_height; post->next_row = 0; } } #endif /* QUANT_2PASS_SUPPORTED */ /* * Initialize postprocessing controller. */ GLOBAL(void) jinit_d_post_controller (j_decompress_ptr cinfo, boolean need_full_buffer) { my_post_ptr post; post = (my_post_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_post_controller)); cinfo->post = (struct jpeg_d_post_controller *) post; post->pub.start_pass = start_pass_dpost; post->whole_image = NULL; /* flag for no virtual arrays */ post->buffer = NULL; /* flag for no strip buffer */ /* Create the quantization buffer, if needed */ if (cinfo->quantize_colors) { /* The buffer strip height is max_v_samp_factor, which is typically * an efficient number of rows for upsampling to return. * (In the presence of output rescaling, we might want to be smarter?) */ post->strip_height = (JDIMENSION) cinfo->max_v_samp_factor; if (need_full_buffer) { /* Two-pass color quantization: need full-image storage. */ /* We round up the number of rows to a multiple of the strip height. */ #ifdef QUANT_2PASS_SUPPORTED post->whole_image = (*cinfo->mem->request_virt_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, cinfo->output_width * cinfo->out_color_components, (JDIMENSION) jround_up((long) cinfo->output_height, (long) post->strip_height), post->strip_height); #else ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); #endif /* QUANT_2PASS_SUPPORTED */ } else { /* One-pass color quantization: just make a strip buffer. */ post->buffer = (*cinfo->mem->alloc_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, cinfo->output_width * cinfo->out_color_components, post->strip_height); } } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jcinit.c�������������������������������������������������0000644�0001750�0001750�00000003477�12320456500�021457� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jcinit.c * * Copyright (C) 1991-1997, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains initialization logic for the JPEG compressor. * This routine is in charge of selecting the modules to be executed and * making an initialization call to each one. * * Logically, this code belongs in jcmaster.c. It's split out because * linking this routine implies linking the entire compression library. * For a transcoding-only application, we want to be able to use jcmaster.c * without linking in the whole library. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" /* * Master selection of compression modules. * This is done once at the start of processing an image. We determine * which modules will be used and give them appropriate initialization calls. */ GLOBAL(void) jinit_compress_master (j_compress_ptr cinfo) { /* Initialize master control (includes parameter checking/processing) */ jinit_c_master_control(cinfo, FALSE /* full compression */); /* Initialize compression codec */ jinit_c_codec(cinfo); /* Preprocessing */ if (! cinfo->raw_data_in) { jinit_color_converter(cinfo); jinit_downsampler(cinfo); jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */); } jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */); jinit_marker_writer(cinfo); /* We can now tell the memory manager to allocate virtual arrays. */ (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); /* Write the datastream header (SOI) immediately. * Frame and scan headers are postponed till later. * This lets application insert special markers after the SOI. */ (*cinfo->marker->write_file_header) (cinfo); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/README���������������������������������������������������0000644�0001750�0001750�00000046746�12320456500�020721� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������The Independent JPEG Group's JPEG software ========================================== README for release 6b of 27-Mar-1998 ==================================== This distribution contains the sixth public release of the Independent JPEG Group's free JPEG software. You are welcome to redistribute this software and to use it for any purpose, subject to the conditions under LEGAL ISSUES, below. Serious users of this software (particularly those incorporating it into larger programs) should contact IJG at jpeg-info@uunet.uu.net to be added to our electronic mailing list. Mailing list members are notified of updates and have a chance to participate in technical discussions, etc. This software is the work of Tom Lane, Philip Gladstone, Jim Boucher, Lee Crocker, Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi, Guido Vollbeding, Ge' Weijers, and other members of the Independent JPEG Group. IJG is not affiliated with the official ISO JPEG standards committee. DOCUMENTATION ROADMAP ===================== This file contains the following sections: OVERVIEW General description of JPEG and the IJG software. LEGAL ISSUES Copyright, lack of warranty, terms of distribution. REFERENCES Where to learn more about JPEG. ARCHIVE LOCATIONS Where to find newer versions of this software. RELATED SOFTWARE Other stuff you should get. FILE FORMAT WARS Software *not* to get. TO DO Plans for future IJG releases. Other documentation files in the distribution are: User documentation: install.doc How to configure and install the IJG software. usage.doc Usage instructions for cjpeg, djpeg, jpegtran, rdjpgcom, and wrjpgcom. *.1 Unix-style man pages for programs (same info as usage.doc). wizard.doc Advanced usage instructions for JPEG wizards only. change.log Version-to-version change highlights. Programmer and internal documentation: libjpeg.doc How to use the JPEG library in your own programs. example.c Sample code for calling the JPEG library. structure.doc Overview of the JPEG library's internal structure. filelist.doc Road map of IJG files. coderules.doc Coding style rules --- please read if you contribute code. Please read at least the files install.doc and usage.doc. Useful information can also be found in the JPEG FAQ (Frequently Asked Questions) article. See ARCHIVE LOCATIONS below to find out where to obtain the FAQ article. If you want to understand how the JPEG code works, we suggest reading one or more of the REFERENCES, then looking at the documentation files (in roughly the order listed) before diving into the code. OVERVIEW ======== This package contains C software to implement JPEG image compression and decompression. JPEG (pronounced "jay-peg") is a standardized compression method for full-color and gray-scale images. JPEG is intended for compressing "real-world" scenes; line drawings, cartoons and other non-realistic images are not its strong suit. JPEG is lossy, meaning that the output image is not exactly identical to the input image. Hence you must not use JPEG if you have to have identical output bits. However, on typical photographic images, very good compression levels can be obtained with no visible change, and remarkably high compression levels are possible if you can tolerate a low-quality image. For more details, see the references, or just experiment with various compression settings. This software implements JPEG baseline, extended-sequential, progressive and lossless compression processes. Provision is made for supporting all variants of these processes, although some uncommon parameter settings aren't implemented yet. For legal reasons, we are not distributing code for the arithmetic-coding variants of JPEG; see LEGAL ISSUES. We have made no provision for supporting the hierarchical processes defined in the standard. We provide a set of library routines for reading and writing JPEG image files, plus two sample applications "cjpeg" and "djpeg", which use the library to perform conversion between JPEG and some other popular image file formats. The library is intended to be reused in other applications. In order to support file conversion and viewing software, we have included considerable functionality beyond the bare JPEG coding/decoding capability; for example, the color quantization modules are not strictly part of JPEG decoding, but they are essential for output to colormapped file formats or colormapped displays. These extra functions can be compiled out of the library if not required for a particular application. We have also included "jpegtran", a utility for lossless transcoding between different JPEG processes, and "rdjpgcom" and "wrjpgcom", two simple applications for inserting and extracting textual comments in JFIF files. The emphasis in designing this software has been on achieving portability and flexibility, while also making it fast enough to be useful. In particular, the software is not intended to be read as a tutorial on JPEG. (See the REFERENCES section for introductory material.) Rather, it is intended to be reliable, portable, industrial-strength code. We do not claim to have achieved that goal in every aspect of the software, but we strive for it. We welcome the use of this software as a component of commercial products. No royalty is required, but we do ask for an acknowledgement in product documentation, as described under LEGAL ISSUES. LEGAL ISSUES ============ In plain English: 1. We don't promise that this software works. (But if you find any bugs, please let us know!) 2. You can use this software for whatever you want. You don't have to pay us. 3. You may not pretend that you wrote this software. If you use it in a program, you must acknowledge somewhere in your documentation that you've used the IJG code. In legalese: The authors make NO WARRANTY or representation, either express or implied, with respect to this software, its quality, accuracy, merchantability, or fitness for a particular purpose. This software is provided "AS IS", and you, its user, assume the entire risk as to its quality and accuracy. This software is copyright (C) 1991-1998, Thomas G. Lane. All Rights Reserved except as specified below. Permission is hereby granted to use, copy, modify, and distribute this software (or portions thereof) for any purpose, without fee, subject to these conditions: (1) If any part of the source code for this software is distributed, then this README file must be included, with this copyright and no-warranty notice unaltered; and any additions, deletions, or changes to the original files must be clearly indicated in accompanying documentation. (2) If only executable code is distributed, then the accompanying documentation must state that "this software is based in part on the work of the Independent JPEG Group". (3) Permission for use of this software is granted only if the user accepts full responsibility for any undesirable consequences; the authors accept NO LIABILITY for damages of any kind. These conditions apply to any software derived from or based on the IJG code, not just to the unmodified library. If you use our work, you ought to acknowledge us. Permission is NOT granted for the use of any IJG author's name or company name in advertising or publicity relating to this software or products derived from it. This software may be referred to only as "the Independent JPEG Group's software". We specifically permit and encourage the use of this software as the basis of commercial products, provided that all warranty or liability claims are assumed by the product vendor. ansi2knr.c is included in this distribution by permission of L. Peter Deutsch, sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA. ansi2knr.c is NOT covered by the above copyright and conditions, but instead by the usual distribution terms of the Free Software Foundation; principally, that you must include source code if you redistribute it. (See the file ansi2knr.c for full details.) However, since ansi2knr.c is not needed as part of any program generated from the IJG code, this does not limit you more than the foregoing paragraphs do. The Unix configuration script "configure" was produced with GNU Autoconf. It is copyright by the Free Software Foundation but is freely distributable. The same holds for its supporting scripts (config.guess, config.sub, ltconfig, ltmain.sh). Another support script, install-sh, is copyright by M.I.T. but is also freely distributable. It appears that the arithmetic coding option of the JPEG spec is covered by patents owned by IBM, AT&T, and Mitsubishi. Hence arithmetic coding cannot legally be used without obtaining one or more licenses. For this reason, support for arithmetic coding has been removed from the free JPEG software. (Since arithmetic coding provides only a marginal gain over the unpatented Huffman mode, it is unlikely that very many implementations will support it.) So far as we are aware, there are no patent restrictions on the remaining code. The IJG distribution formerly included code to read and write GIF files. To avoid entanglement with the Unisys LZW patent, GIF reading support has been removed altogether, and the GIF writer has been simplified to produce "uncompressed GIFs". This technique does not use the LZW algorithm; the resulting GIF files are larger than usual, but are readable by all standard GIF decoders. We are required to state that "The Graphics Interchange Format(c) is the Copyright property of CompuServe Incorporated. GIF(sm) is a Service Mark property of CompuServe Incorporated." REFERENCES ========== We highly recommend reading one or more of these references before trying to understand the innards of the JPEG software. The best short technical introduction to the JPEG compression algorithm is Wallace, Gregory K. "The JPEG Still Picture Compression Standard", Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44. (Adjacent articles in that issue discuss MPEG motion picture compression, applications of JPEG, and related topics.) If you don't have the CACM issue handy, a PostScript file containing a revised version of Wallace's article is available at ftp://ftp.uu.net/graphics/jpeg/wallace.ps.gz. The file (actually a preprint for an article that appeared in IEEE Trans. Consumer Electronics) omits the sample images that appeared in CACM, but it includes corrections and some added material. Note: the Wallace article is copyright ACM and IEEE, and it may not be used for commercial purposes. A somewhat less technical, more leisurely introduction to JPEG can be found in "The Data Compression Book" by Mark Nelson and Jean-loup Gailly, published by M&T Books (New York), 2nd ed. 1996, ISBN 1-55851-434-1. This book provides good explanations and example C code for a multitude of compression methods including JPEG. It is an excellent source if you are comfortable reading C code but don't know much about data compression in general. The book's JPEG sample code is far from industrial-strength, but when you are ready to look at a full implementation, you've got one here... The best full description of JPEG is the textbook "JPEG Still Image Data Compression Standard" by William B. Pennebaker and Joan L. Mitchell, published by Van Nostrand Reinhold, 1993, ISBN 0-442-01272-1. Price US$59.95, 638 pp. The book includes the complete text of the ISO JPEG standards (DIS 10918-1 and draft DIS 10918-2). This is by far the most complete exposition of JPEG in existence, and we highly recommend it. The JPEG standard itself is not available electronically; you must order a paper copy through ISO or ITU. (Unless you feel a need to own a certified official copy, we recommend buying the Pennebaker and Mitchell book instead; it's much cheaper and includes a great deal of useful explanatory material.) In the USA, copies of the standard may be ordered from ANSI Sales at (212) 642-4900, or from Global Engineering Documents at (800) 854-7179. (ANSI doesn't take credit card orders, but Global does.) It's not cheap: as of 1992, ANSI was charging $95 for Part 1 and $47 for Part 2, plus 7% shipping/handling. The standard is divided into two parts, Part 1 being the actual specification, while Part 2 covers compliance testing methods. Part 1 is titled "Digital Compression and Coding of Continuous-tone Still Images, Part 1: Requirements and guidelines" and has document numbers ISO/IEC IS 10918-1, ITU-T T.81. Part 2 is titled "Digital Compression and Coding of Continuous-tone Still Images, Part 2: Compliance testing" and has document numbers ISO/IEC IS 10918-2, ITU-T T.83. Some extensions to the original JPEG standard are defined in JPEG Part 3, a newer ISO standard numbered ISO/IEC IS 10918-3 and ITU-T T.84. IJG currently does not support any Part 3 extensions. The JPEG standard does not specify all details of an interchangeable file format. For the omitted details we follow the "JFIF" conventions, revision 1.02. A copy of the JFIF spec is available from: Literature Department C-Cube Microsystems, Inc. 1778 McCarthy Blvd. Milpitas, CA 95035 phone (408) 944-6300, fax (408) 944-6314 A PostScript version of this document is available by FTP at ftp://ftp.uu.net/graphics/jpeg/jfif.ps.gz. There is also a plain text version at ftp://ftp.uu.net/graphics/jpeg/jfif.txt.gz, but it is missing the figures. The TIFF 6.0 file format specification can be obtained by FTP from ftp://ftp.sgi.com/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation scheme found in the TIFF 6.0 spec of 3-June-92 has a number of serious problems. IJG does not recommend use of the TIFF 6.0 design (TIFF Compression tag 6). Instead, we recommend the JPEG design proposed by TIFF Technical Note #2 (Compression tag 7). Copies of this Note can be obtained from ftp.sgi.com or from ftp://ftp.uu.net/graphics/jpeg/. It is expected that the next revision of the TIFF spec will replace the 6.0 JPEG design with the Note's design. Although IJG's own code does not support TIFF/JPEG, the free libtiff library uses our library to implement TIFF/JPEG per the Note. libtiff is available from ftp://ftp.sgi.com/graphics/tiff/. ARCHIVE LOCATIONS ================= The "official" archive site for this software is ftp.uu.net (Internet address 192.48.96.9). The most recent released version can always be found there in directory graphics/jpeg. This particular version will be archived as ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz. If you don't have direct Internet access, UUNET's archives are also available via UUCP; contact help@uunet.uu.net for information on retrieving files that way. Numerous Internet sites maintain copies of the UUNET files. However, only ftp.uu.net is guaranteed to have the latest official version. You can also obtain this software in DOS-compatible "zip" archive format from the SimTel archives (ftp://ftp.simtel.net/pub/simtelnet/msdos/graphics/), or on CompuServe in the Graphics Support forum (GO CIS:GRAPHSUP), library 12 "JPEG Tools". Again, these versions may sometimes lag behind the ftp.uu.net release. The JPEG FAQ (Frequently Asked Questions) article is a useful source of general information about JPEG. It is updated constantly and therefore is not included in this distribution. The FAQ is posted every two weeks to Usenet newsgroups comp.graphics.misc, news.answers, and other groups. It is available on the World Wide Web at http://www.faqs.org/faqs/jpeg-faq/ and other news.answers archive sites, including the official news.answers archive at rtfm.mit.edu: ftp://rtfm.mit.edu/pub/usenet/news.answers/jpeg-faq/. If you don't have Web or FTP access, send e-mail to mail-server@rtfm.mit.edu with body send usenet/news.answers/jpeg-faq/part1 send usenet/news.answers/jpeg-faq/part2 RELATED SOFTWARE ================ Numerous viewing and image manipulation programs now support JPEG. (Quite a few of them use this library to do so.) The JPEG FAQ described above lists some of the more popular free and shareware viewers, and tells where to obtain them on Internet. If you are on a Unix machine, we highly recommend Jef Poskanzer's free PBMPLUS software, which provides many useful operations on PPM-format image files. In particular, it can convert PPM images to and from a wide range of other formats, thus making cjpeg/djpeg considerably more useful. The latest version is distributed by the NetPBM group, and is available from numerous sites, notably ftp://wuarchive.wustl.edu/graphics/graphics/packages/NetPBM/. Unfortunately PBMPLUS/NETPBM is not nearly as portable as the IJG software is; you are likely to have difficulty making it work on any non-Unix machine. A different free JPEG implementation, written by the PVRG group at Stanford, is available from ftp://havefun.stanford.edu/pub/jpeg/. This program is designed for research and experimentation rather than production use; it is slower, harder to use, and less portable than the IJG code, but it is easier to read and modify. Also, the PVRG code supports lossless JPEG, which we do not. (On the other hand, it doesn't do progressive JPEG.) FILE FORMAT WARS ================ Some JPEG programs produce files that are not compatible with our library. The root of the problem is that the ISO JPEG committee failed to specify a concrete file format. Some vendors "filled in the blanks" on their own, creating proprietary formats that no one else could read. (For example, none of the early commercial JPEG implementations for the Macintosh were able to exchange compressed files.) The file format we have adopted is called JFIF (see REFERENCES). This format has been agreed to by a number of major commercial JPEG vendors, and it has become the de facto standard. JFIF is a minimal or "low end" representation. We recommend the use of TIFF/JPEG (TIFF revision 6.0 as modified by TIFF Technical Note #2) for "high end" applications that need to record a lot of additional data about an image. TIFF/JPEG is fairly new and not yet widely supported, unfortunately. The upcoming JPEG Part 3 standard defines a file format called SPIFF. SPIFF is interoperable with JFIF, in the sense that most JFIF decoders should be able to read the most common variant of SPIFF. SPIFF has some technical advantages over JFIF, but its major claim to fame is simply that it is an official standard rather than an informal one. At this point it is unclear whether SPIFF will supersede JFIF or whether JFIF will remain the de-facto standard. IJG intends to support SPIFF once the standard is frozen, but we have not decided whether it should become our default output format or not. (In any case, our decoder will remain capable of reading JFIF indefinitely.) Various proprietary file formats incorporating JPEG compression also exist. We have little or no sympathy for the existence of these formats. Indeed, one of the original reasons for developing this free software was to help force convergence on common, open format standards for JPEG files. Don't use a proprietary file format! TO DO ===== The major thrust for v7 will probably be improvement of visual quality. The current method for scaling the quantization tables is known not to be very good at low Q values. We also intend to investigate block boundary smoothing, "poor man's variable quantization", and other means of improving quality-vs-file-size performance without sacrificing compatibility. In future versions, we are considering supporting some of the upcoming JPEG Part 3 extensions --- principally, variable quantization and the SPIFF file format. As always, speeding things up is of great interest. Please send bug reports, offers of help, etc. to jpeg-info@uunet.uu.net. ��������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/cdjpeg.h�������������������������������������������������0000644�0001750�0001750�00000014111�12320456500�021423� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * cdjpeg.h * * Copyright (C) 1994-1997, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains common declarations for the sample applications * cjpeg and djpeg. It is NOT used by the core JPEG library. */ #define JPEG_CJPEG_DJPEG /* define proper options in jconfig.h */ #define JPEG_INTERNAL_OPTIONS /* cjpeg.c,djpeg.c need to see xxx_SUPPORTED */ #include "jinclude.h" #include "jpeglib.h" #include "jerror.h" /* get library error codes too */ #include "cderror.h" /* get application-specific error codes */ #ifdef __cplusplus extern "C" { #endif // cplusplus /* * Object interface for cjpeg's source file decoding modules */ typedef struct cjpeg_source_struct * cjpeg_source_ptr; struct cjpeg_source_struct { JMETHOD(void, start_input, (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)); JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)); JMETHOD(void, finish_input, (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)); FILE *input_file; JSAMPARRAY buffer; JDIMENSION buffer_height; }; /* * Object interface for djpeg's output file encoding modules */ typedef struct djpeg_dest_struct * djpeg_dest_ptr; struct djpeg_dest_struct { /* start_output is called after jpeg_start_decompress finishes. * The color map will be ready at this time, if one is needed. */ JMETHOD(void, start_output, (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)); /* Emit the specified number of pixel rows from the buffer. */ JMETHOD(void, put_pixel_rows, (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, JDIMENSION rows_supplied)); /* Finish up at the end of the image. */ JMETHOD(void, finish_output, (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)); /* Target file spec; filled in by djpeg.c after object is created. */ FILE * output_file; /* Output pixel-row buffer. Created by module init or start_output. * Width is cinfo->output_width * cinfo->output_components; * height is buffer_height. */ JSAMPARRAY buffer; JDIMENSION buffer_height; }; /* * cjpeg/djpeg may need to perform extra passes to convert to or from * the source/destination file format. The JPEG library does not know * about these passes, but we'd like them to be counted by the progress * monitor. We use an expanded progress monitor object to hold the * additional pass count. */ struct cdjpeg_progress_mgr { struct jpeg_progress_mgr pub; /* fields known to JPEG library */ int completed_extra_passes; /* extra passes completed */ int total_extra_passes; /* total extra */ /* last printed percentage stored here to avoid multiple printouts */ int percent_done; }; typedef struct cdjpeg_progress_mgr * cd_progress_ptr; /* Short forms of external names for systems with brain-damaged linkers. */ #ifdef NEED_SHORT_EXTERNAL_NAMES #define jinit_read_bmp jIRdBMP #define jinit_write_bmp jIWrBMP #define jinit_read_gif jIRdGIF #define jinit_write_gif jIWrGIF #define jinit_read_ppm jIRdPPM #define jinit_write_ppm jIWrPPM #define jinit_read_rle jIRdRLE #define jinit_write_rle jIWrRLE #define jinit_read_targa jIRdTarga #define jinit_write_targa jIWrTarga #define read_quant_tables RdQTables #define read_scan_script RdScnScript #define set_quant_slots SetQSlots #define set_sample_factors SetSFacts #define read_color_map RdCMap #define enable_signal_catcher EnSigCatcher #define start_progress_monitor StProgMon #define end_progress_monitor EnProgMon #define read_stdin RdStdin #define write_stdout WrStdout #endif /* NEED_SHORT_EXTERNAL_NAMES */ /* Module selection routines for I/O modules. */ EXTERN(cjpeg_source_ptr) jinit_read_bmp JPP((j_compress_ptr cinfo)); EXTERN(djpeg_dest_ptr) jinit_write_bmp JPP((j_decompress_ptr cinfo, boolean is_os2)); EXTERN(cjpeg_source_ptr) jinit_read_gif JPP((j_compress_ptr cinfo)); EXTERN(djpeg_dest_ptr) jinit_write_gif JPP((j_decompress_ptr cinfo)); EXTERN(cjpeg_source_ptr) jinit_read_ppm JPP((j_compress_ptr cinfo)); EXTERN(djpeg_dest_ptr) jinit_write_ppm JPP((j_decompress_ptr cinfo)); EXTERN(cjpeg_source_ptr) jinit_read_rle JPP((j_compress_ptr cinfo)); EXTERN(djpeg_dest_ptr) jinit_write_rle JPP((j_decompress_ptr cinfo)); EXTERN(cjpeg_source_ptr) jinit_read_targa JPP((j_compress_ptr cinfo)); EXTERN(djpeg_dest_ptr) jinit_write_targa JPP((j_decompress_ptr cinfo)); /* cjpeg support routines (in rdswitch.c) */ EXTERN(boolean) read_quant_tables JPP((j_compress_ptr cinfo, char * filename, int scale_factor, boolean force_baseline)); EXTERN(boolean) read_scan_script JPP((j_compress_ptr cinfo, char * filename)); EXTERN(boolean) set_quant_slots JPP((j_compress_ptr cinfo, char *arg)); EXTERN(boolean) set_sample_factors JPP((j_compress_ptr cinfo, char *arg)); /* djpeg support routines (in rdcolmap.c) */ EXTERN(void) read_color_map JPP((j_decompress_ptr cinfo, FILE * infile)); /* common support routines (in cdjpeg.c) */ EXTERN(void) enable_signal_catcher JPP((j_common_ptr cinfo)); EXTERN(void) start_progress_monitor JPP((j_common_ptr cinfo, cd_progress_ptr progress)); EXTERN(void) end_progress_monitor JPP((j_common_ptr cinfo)); EXTERN(boolean) keymatch JPP((char * arg, const char * keyword, int minchars)); EXTERN(FILE *) read_stdin JPP((void)); EXTERN(FILE *) write_stdout JPP((void)); /* miscellaneous useful macros */ #ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ #define READ_BINARY "r" #define WRITE_BINARY "w" #else #ifdef VMS /* VMS is very nonstandard */ #define READ_BINARY "rb", "ctx=stm" #define WRITE_BINARY "wb", "ctx=stm" #else /* standard ANSI-compliant case */ #define READ_BINARY "rb" #define WRITE_BINARY "wb" #endif #endif #ifndef EXIT_FAILURE /* define exit() codes if not provided */ #define EXIT_FAILURE 1 #endif #ifndef EXIT_SUCCESS #ifdef VMS #define EXIT_SUCCESS 1 /* VMS is very nonstandard */ #else #define EXIT_SUCCESS 0 #endif #endif #ifndef EXIT_WARNING #ifdef VMS #define EXIT_WARNING 1 /* VMS is very nonstandard */ #else #define EXIT_WARNING 2 #endif #endif #ifdef __cplusplus } #endif // cplusplus �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jcshuff.c������������������������������������������������0000644�0001750�0001750�00000047117�12320456500�021626� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jcshuff.c * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains Huffman entropy encoding routines for sequential JPEG. * * Much of the complexity here has to do with supporting output suspension. * If the data destination module demands suspension, we want to be able to * back up to the start of the current MCU. To do this, we copy state * variables into local working storage, and update them back to the * permanent JPEG objects only upon successful completion of an MCU. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossy.h" /* Private declarations for lossy codec */ #include "jchuff.h" /* Declarations shared with jc*huff.c */ /* Expanded entropy encoder object for Huffman encoding. * * The savable_state subrecord contains fields that change within an MCU, * but must not be updated permanently until we complete the MCU. */ typedef struct { INT32 put_buffer; /* current bit-accumulation buffer */ int put_bits; /* # of bits now in it */ int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ } savable_state; /* This macro is to work around compilers with missing or broken * structure assignment. You'll need to fix this code if you have * such a compiler and you change MAX_COMPS_IN_SCAN. */ #ifndef NO_STRUCT_ASSIGN #define ASSIGN_STATE(dest,src) ((dest) = (src)) #else #if MAX_COMPS_IN_SCAN == 4 #define ASSIGN_STATE(dest,src) \ ((dest).put_buffer = (src).put_buffer, \ (dest).put_bits = (src).put_bits, \ (dest).last_dc_val[0] = (src).last_dc_val[0], \ (dest).last_dc_val[1] = (src).last_dc_val[1], \ (dest).last_dc_val[2] = (src).last_dc_val[2], \ (dest).last_dc_val[3] = (src).last_dc_val[3]) #endif #endif typedef struct { savable_state saved; /* Bit buffer & DC state at start of MCU */ /* These fields are NOT loaded into local working state. */ unsigned int restarts_to_go; /* MCUs left in this restart interval */ int next_restart_num; /* next restart number to write (0-7) */ /* Pointers to derived tables (these workspaces have image lifespan) */ c_derived_tbl * dc_derived_tbls[NUM_HUFF_TBLS]; c_derived_tbl * ac_derived_tbls[NUM_HUFF_TBLS]; #ifdef ENTROPY_OPT_SUPPORTED /* Statistics tables for optimization */ long * dc_count_ptrs[NUM_HUFF_TBLS]; long * ac_count_ptrs[NUM_HUFF_TBLS]; #endif } shuff_entropy_encoder; typedef shuff_entropy_encoder * shuff_entropy_ptr; /* Working state while writing an MCU. * This struct contains all the fields that are needed by subroutines. */ typedef struct { JOCTET * next_output_byte; /* => next byte to write in buffer */ size_t free_in_buffer; /* # of byte spaces remaining in buffer */ savable_state cur; /* Current bit buffer & DC state */ j_compress_ptr cinfo; /* dump_buffer needs access to this */ } working_state; /* Forward declarations */ METHODDEF(boolean) encode_mcu_huff JPP((j_compress_ptr cinfo, JBLOCKROW *MCU_data)); METHODDEF(void) finish_pass_huff JPP((j_compress_ptr cinfo)); #ifdef ENTROPY_OPT_SUPPORTED METHODDEF(boolean) encode_mcu_gather JPP((j_compress_ptr cinfo, JBLOCKROW *MCU_data)); METHODDEF(void) finish_pass_gather JPP((j_compress_ptr cinfo)); #endif /* * Initialize for a Huffman-compressed scan. * If gather_statistics is TRUE, we do not output anything during the scan, * just count the Huffman symbols used and generate Huffman code tables. */ METHODDEF(void) start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; shuff_entropy_ptr entropy = (shuff_entropy_ptr) lossyc->entropy_private; int ci, dctbl, actbl; jpeg_component_info * compptr; if (gather_statistics) { #ifdef ENTROPY_OPT_SUPPORTED lossyc->entropy_encode_mcu = encode_mcu_gather; lossyc->pub.entropy_finish_pass = finish_pass_gather; #else ERREXIT(cinfo, JERR_NOT_COMPILED); #endif } else { lossyc->entropy_encode_mcu = encode_mcu_huff; lossyc->pub.entropy_finish_pass = finish_pass_huff; } for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; dctbl = compptr->dc_tbl_no; actbl = compptr->ac_tbl_no; if (gather_statistics) { #ifdef ENTROPY_OPT_SUPPORTED /* Check for invalid table indexes */ /* (make_c_derived_tbl does this in the other path) */ if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS) ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl); if (actbl < 0 || actbl >= NUM_HUFF_TBLS) ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, actbl); /* Allocate and zero the statistics tables */ /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */ if (entropy->dc_count_ptrs[dctbl] == NULL) entropy->dc_count_ptrs[dctbl] = (long *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, 257 * SIZEOF(long)); MEMZERO(entropy->dc_count_ptrs[dctbl], 257 * SIZEOF(long)); if (entropy->ac_count_ptrs[actbl] == NULL) entropy->ac_count_ptrs[actbl] = (long *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, 257 * SIZEOF(long)); MEMZERO(entropy->ac_count_ptrs[actbl], 257 * SIZEOF(long)); #endif } else { /* Compute derived values for Huffman tables */ /* We may do this more than once for a table, but it's not expensive */ jpeg_make_c_derived_tbl(cinfo, TRUE, dctbl, & entropy->dc_derived_tbls[dctbl]); jpeg_make_c_derived_tbl(cinfo, FALSE, actbl, & entropy->ac_derived_tbls[actbl]); } /* Initialize DC predictions to 0 */ entropy->saved.last_dc_val[ci] = 0; } /* Initialize bit buffer to empty */ entropy->saved.put_buffer = 0; entropy->saved.put_bits = 0; /* Initialize restart stuff */ entropy->restarts_to_go = cinfo->restart_interval; entropy->next_restart_num = 0; } /* Outputting bytes to the file */ /* Emit a byte, taking 'action' if must suspend. */ #define emit_byte(state,val,action) \ { *(state)->next_output_byte++ = (JOCTET) (val); \ if (--(state)->free_in_buffer == 0) \ if (! dump_buffer(state)) \ { action; } } LOCAL(boolean) dump_buffer (working_state * state) /* Empty the output buffer; return TRUE if successful, FALSE if must suspend */ { struct jpeg_destination_mgr * dest = state->cinfo->dest; if (! (*dest->empty_output_buffer) (state->cinfo)) return FALSE; /* After a successful buffer dump, must reset buffer pointers */ state->next_output_byte = dest->next_output_byte; state->free_in_buffer = dest->free_in_buffer; return TRUE; } /* Outputting bits to the file */ /* Only the right 24 bits of put_buffer are used; the valid bits are * left-justified in this part. At most 16 bits can be passed to emit_bits * in one call, and we never retain more than 7 bits in put_buffer * between calls, so 24 bits are sufficient. */ INLINE LOCAL(boolean) emit_bits (working_state * state, unsigned int code, int size) /* Emit some bits; return TRUE if successful, FALSE if must suspend */ { /* This routine is heavily used, so it's worth coding tightly. */ register INT32 put_buffer = (INT32) code; register int put_bits = state->cur.put_bits; /* if size is 0, caller used an invalid Huffman table entry */ if (size == 0) ERREXIT(state->cinfo, JERR_HUFF_MISSING_CODE); put_buffer &= (((INT32) 1)<<size) - 1; /* mask off any extra bits in code */ put_bits += size; /* new number of bits in buffer */ put_buffer <<= 24 - put_bits; /* align incoming bits */ put_buffer |= state->cur.put_buffer; /* and merge with old buffer contents */ while (put_bits >= 8) { int c = (int) ((put_buffer >> 16) & 0xFF); emit_byte(state, c, return FALSE); if (c == 0xFF) { /* need to stuff a zero byte? */ emit_byte(state, 0, return FALSE); } put_buffer <<= 8; put_bits -= 8; } state->cur.put_buffer = put_buffer; /* update state variables */ state->cur.put_bits = put_bits; return TRUE; } LOCAL(boolean) flush_bits (working_state * state) { if (! emit_bits(state, 0x7F, 7)) /* fill any partial byte with ones */ return FALSE; state->cur.put_buffer = 0; /* and reset bit-buffer to empty */ state->cur.put_bits = 0; return TRUE; } /* Encode a single block's worth of coefficients */ LOCAL(boolean) encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, c_derived_tbl *dctbl, c_derived_tbl *actbl) { register int temp, temp2; register int nbits; register int k, r, i; /* Encode the DC coefficient difference per section F.1.2.1 */ temp = temp2 = block[0] - last_dc_val; if (temp < 0) { temp = -temp; /* temp is abs value of input */ /* For a negative input, want temp2 = bitwise complement of abs(input) */ /* This code assumes we are on a two's complement machine */ temp2--; } /* Find the number of bits needed for the magnitude of the coefficient */ nbits = 0; while (temp) { nbits++; temp >>= 1; } /* Check for out-of-range coefficient values. * Since we're encoding a difference, the range limit is twice as much. */ if (nbits > MAX_COEF_BITS+1) ERREXIT(state->cinfo, JERR_BAD_DCT_COEF); /* Emit the Huffman-coded symbol for the number of bits */ if (! emit_bits(state, dctbl->ehufco[nbits], dctbl->ehufsi[nbits])) return FALSE; /* Emit that number of bits of the value, if positive, */ /* or the complement of its magnitude, if negative. */ if (nbits) /* emit_bits rejects calls with size 0 */ if (! emit_bits(state, (unsigned int) temp2, nbits)) return FALSE; /* Encode the AC coefficients per section F.1.2.2 */ r = 0; /* r = run length of zeros */ for (k = 1; k < DCTSIZE2; k++) { if ((temp = block[jpeg_natural_order[k]]) == 0) { r++; } else { /* if run length > 15, must emit special run-length-16 codes (0xF0) */ while (r > 15) { if (! emit_bits(state, actbl->ehufco[0xF0], actbl->ehufsi[0xF0])) return FALSE; r -= 16; } temp2 = temp; if (temp < 0) { temp = -temp; /* temp is abs value of input */ /* This code assumes we are on a two's complement machine */ temp2--; } /* Find the number of bits needed for the magnitude of the coefficient */ nbits = 1; /* there must be at least one 1 bit */ while ((temp >>= 1)) nbits++; /* Check for out-of-range coefficient values */ if (nbits > MAX_COEF_BITS) ERREXIT(state->cinfo, JERR_BAD_DCT_COEF); /* Emit Huffman symbol for run length / number of bits */ i = (r << 4) + nbits; if (! emit_bits(state, actbl->ehufco[i], actbl->ehufsi[i])) return FALSE; /* Emit that number of bits of the value, if positive, */ /* or the complement of its magnitude, if negative. */ if (! emit_bits(state, (unsigned int) temp2, nbits)) return FALSE; r = 0; } } /* If the last coef(s) were zero, emit an end-of-block code */ if (r > 0) if (! emit_bits(state, actbl->ehufco[0], actbl->ehufsi[0])) return FALSE; return TRUE; } /* * Emit a restart marker & resynchronize predictions. */ LOCAL(boolean) emit_restart (working_state * state, int restart_num) { int ci; if (! flush_bits(state)) return FALSE; emit_byte(state, 0xFF, return FALSE); emit_byte(state, JPEG_RST0 + restart_num, return FALSE); /* Re-initialize DC predictions to 0 */ for (ci = 0; ci < state->cinfo->comps_in_scan; ci++) state->cur.last_dc_val[ci] = 0; /* The restart counter is not updated until we successfully write the MCU. */ return TRUE; } /* * Encode and output one MCU's worth of Huffman-compressed coefficients. */ METHODDEF(boolean) encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; shuff_entropy_ptr entropy = (shuff_entropy_ptr) lossyc->entropy_private; working_state state; int blkn, ci; jpeg_component_info * compptr; /* Load up working state */ state.next_output_byte = cinfo->dest->next_output_byte; state.free_in_buffer = cinfo->dest->free_in_buffer; ASSIGN_STATE(state.cur, entropy->saved); state.cinfo = cinfo; /* Emit restart marker if needed */ if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) if (! emit_restart(&state, entropy->next_restart_num)) return FALSE; } /* Encode the MCU data blocks */ for (blkn = 0; blkn < cinfo->data_units_in_MCU; blkn++) { ci = cinfo->MCU_membership[blkn]; compptr = cinfo->cur_comp_info[ci]; if (! encode_one_block(&state, MCU_data[blkn][0], state.cur.last_dc_val[ci], entropy->dc_derived_tbls[compptr->dc_tbl_no], entropy->ac_derived_tbls[compptr->ac_tbl_no])) return FALSE; /* Update last_dc_val */ state.cur.last_dc_val[ci] = MCU_data[blkn][0][0]; } /* Completed MCU, so update state */ cinfo->dest->next_output_byte = state.next_output_byte; cinfo->dest->free_in_buffer = state.free_in_buffer; ASSIGN_STATE(entropy->saved, state.cur); /* Update restart-interval state too */ if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) { entropy->restarts_to_go = cinfo->restart_interval; entropy->next_restart_num++; entropy->next_restart_num &= 7; } entropy->restarts_to_go--; } return TRUE; } /* * Finish up at the end of a Huffman-compressed scan. */ METHODDEF(void) finish_pass_huff (j_compress_ptr cinfo) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; shuff_entropy_ptr entropy = (shuff_entropy_ptr) lossyc->entropy_private; working_state state; /* Load up working state ... flush_bits needs it */ state.next_output_byte = cinfo->dest->next_output_byte; state.free_in_buffer = cinfo->dest->free_in_buffer; ASSIGN_STATE(state.cur, entropy->saved); state.cinfo = cinfo; /* Flush out the last data */ if (! flush_bits(&state)) ERREXIT(cinfo, JERR_CANT_SUSPEND); /* Update state */ cinfo->dest->next_output_byte = state.next_output_byte; cinfo->dest->free_in_buffer = state.free_in_buffer; ASSIGN_STATE(entropy->saved, state.cur); } /* * Huffman coding optimization. * * We first scan the supplied data and count the number of uses of each symbol * that is to be Huffman-coded. (This process MUST agree with the code above.) * Then we build a Huffman coding tree for the observed counts. * Symbols which are not needed at all for the particular image are not * assigned any code, which saves space in the DHT marker as well as in * the compressed data. */ #ifdef ENTROPY_OPT_SUPPORTED /* Process a single block's worth of coefficients */ LOCAL(void) htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val, long dc_counts[], long ac_counts[]) { register int temp; register int nbits; register int k, r; /* Encode the DC coefficient difference per section F.1.2.1 */ temp = block[0] - last_dc_val; if (temp < 0) temp = -temp; /* Find the number of bits needed for the magnitude of the coefficient */ nbits = 0; while (temp) { nbits++; temp >>= 1; } /* Check for out-of-range coefficient values. * Since we're encoding a difference, the range limit is twice as much. */ if (nbits > MAX_COEF_BITS+1) ERREXIT(cinfo, JERR_BAD_DCT_COEF); /* Count the Huffman symbol for the number of bits */ dc_counts[nbits]++; /* Encode the AC coefficients per section F.1.2.2 */ r = 0; /* r = run length of zeros */ for (k = 1; k < DCTSIZE2; k++) { if ((temp = block[jpeg_natural_order[k]]) == 0) { r++; } else { /* if run length > 15, must emit special run-length-16 codes (0xF0) */ while (r > 15) { ac_counts[0xF0]++; r -= 16; } /* Find the number of bits needed for the magnitude of the coefficient */ if (temp < 0) temp = -temp; /* Find the number of bits needed for the magnitude of the coefficient */ nbits = 1; /* there must be at least one 1 bit */ while ((temp >>= 1)) nbits++; /* Check for out-of-range coefficient values */ if (nbits > MAX_COEF_BITS) ERREXIT(cinfo, JERR_BAD_DCT_COEF); /* Count Huffman symbol for run length / number of bits */ ac_counts[(r << 4) + nbits]++; r = 0; } } /* If the last coef(s) were zero, emit an end-of-block code */ if (r > 0) ac_counts[0]++; } /* * Trial-encode one MCU's worth of Huffman-compressed coefficients. * No data is actually output, so no suspension return is possible. */ METHODDEF(boolean) encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; shuff_entropy_ptr entropy = (shuff_entropy_ptr) lossyc->entropy_private; int blkn, ci; jpeg_component_info * compptr; /* Take care of restart intervals if needed */ if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) { /* Re-initialize DC predictions to 0 */ for (ci = 0; ci < cinfo->comps_in_scan; ci++) entropy->saved.last_dc_val[ci] = 0; /* Update restart state */ entropy->restarts_to_go = cinfo->restart_interval; } entropy->restarts_to_go--; } for (blkn = 0; blkn < cinfo->data_units_in_MCU; blkn++) { ci = cinfo->MCU_membership[blkn]; compptr = cinfo->cur_comp_info[ci]; htest_one_block(cinfo, MCU_data[blkn][0], entropy->saved.last_dc_val[ci], entropy->dc_count_ptrs[compptr->dc_tbl_no], entropy->ac_count_ptrs[compptr->ac_tbl_no]); entropy->saved.last_dc_val[ci] = MCU_data[blkn][0][0]; } return TRUE; } /* * Finish up a statistics-gathering pass and create the new Huffman tables. */ METHODDEF(void) finish_pass_gather (j_compress_ptr cinfo) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; shuff_entropy_ptr entropy = (shuff_entropy_ptr) lossyc->entropy_private; int ci, dctbl, actbl; jpeg_component_info * compptr; JHUFF_TBL **htblptr; boolean did_dc[NUM_HUFF_TBLS]; boolean did_ac[NUM_HUFF_TBLS]; /* It's important not to apply jpeg_gen_optimal_table more than once * per table, because it clobbers the input frequency counts! */ MEMZERO(did_dc, SIZEOF(did_dc)); MEMZERO(did_ac, SIZEOF(did_ac)); for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; dctbl = compptr->dc_tbl_no; actbl = compptr->ac_tbl_no; if (! did_dc[dctbl]) { htblptr = & cinfo->dc_huff_tbl_ptrs[dctbl]; if (*htblptr == NULL) *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); jpeg_gen_optimal_table(cinfo, *htblptr, entropy->dc_count_ptrs[dctbl]); did_dc[dctbl] = TRUE; } if (! did_ac[actbl]) { htblptr = & cinfo->ac_huff_tbl_ptrs[actbl]; if (*htblptr == NULL) *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); jpeg_gen_optimal_table(cinfo, *htblptr, entropy->ac_count_ptrs[actbl]); did_ac[actbl] = TRUE; } } } #endif /* ENTROPY_OPT_SUPPORTED */ METHODDEF(boolean) need_optimization_pass (j_compress_ptr cinfo) { (void)cinfo; return TRUE; } /* * Module initialization routine for Huffman entropy encoding. */ GLOBAL(void) jinit_shuff_encoder (j_compress_ptr cinfo) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; shuff_entropy_ptr entropy; int i; entropy = (shuff_entropy_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(shuff_entropy_encoder)); lossyc->entropy_private = (struct jpeg_entropy_encoder *) entropy; lossyc->pub.entropy_start_pass = start_pass_huff; lossyc->pub.need_optimization_pass = need_optimization_pass; /* Mark tables unallocated */ for (i = 0; i < NUM_HUFF_TBLS; i++) { entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL; #ifdef ENTROPY_OPT_SUPPORTED entropy->dc_count_ptrs[i] = entropy->ac_count_ptrs[i] = NULL; #endif } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/cdjpeg.c�������������������������������������������������0000644�0001750�0001750�00000011113�12320456500�021415� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * cdjpeg.c * * Copyright (C) 1991-1997, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains common support routines used by the IJG application * programs (cjpeg, djpeg, jpegtran). */ #include <ctype.h> /* to declare isupper(), tolower() */ #ifdef NEED_SIGNAL_CATCHER #include <signal.h> /* to declare signal() */ #endif #ifdef USE_SETMODE #include <fcntl.h> /* to declare setmode()'s parameter macros */ /* If you have setmode() but not <io.h>, just delete this line: */ #include <io.h> /* to declare setmode() */ #endif #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ /* * Signal catcher to ensure that temporary files are removed before aborting. * NB: for Amiga Manx C this is actually a global routine named _abort(); * we put "#define signal_catcher _abort" in jconfig.h. Talk about bogus... */ #ifdef NEED_SIGNAL_CATCHER static j_common_ptr sig_cinfo; void /* must be global for Manx C */ signal_catcher (int signum) { if (sig_cinfo != NULL) { if (sig_cinfo->err != NULL) /* turn off trace output */ sig_cinfo->err->trace_level = 0; jpeg_destroy(sig_cinfo); /* clean up memory allocation & temp files */ } exit(EXIT_FAILURE); } GLOBAL(void) enable_signal_catcher (j_common_ptr cinfo) { sig_cinfo = cinfo; #ifdef SIGINT /* not all systems have SIGINT */ signal(SIGINT, signal_catcher); #endif #ifdef SIGTERM /* not all systems have SIGTERM */ signal(SIGTERM, signal_catcher); #endif } #endif /* * Optional progress monitor: display a percent-done figure on stderr. */ #ifdef PROGRESS_REPORT METHODDEF(void) progress_monitor (j_common_ptr cinfo) { cd_progress_ptr prog = (cd_progress_ptr) cinfo->progress; int total_passes = prog->pub.total_passes + prog->total_extra_passes; int percent_done = (int) (prog->pub.pass_counter*100L/prog->pub.pass_limit); if (percent_done != prog->percent_done) { prog->percent_done = percent_done; if (total_passes > 1) { fprintf(stderr, "\rPass %d/%d: %3d%% ", prog->pub.completed_passes + prog->completed_extra_passes + 1, total_passes, percent_done); } else { fprintf(stderr, "\r %3d%% ", percent_done); } fflush(stderr); } } GLOBAL(void) start_progress_monitor (j_common_ptr cinfo, cd_progress_ptr progress) { /* Enable progress display, unless trace output is on */ if (cinfo->err->trace_level == 0) { progress->pub.progress_monitor = progress_monitor; progress->completed_extra_passes = 0; progress->total_extra_passes = 0; progress->percent_done = -1; cinfo->progress = &progress->pub; } } GLOBAL(void) end_progress_monitor (j_common_ptr cinfo) { /* Clear away progress display */ if (cinfo->err->trace_level == 0) { fprintf(stderr, "\r \r"); fflush(stderr); } } #endif /* * Case-insensitive matching of possibly-abbreviated keyword switches. * keyword is the constant keyword (must be lower case already), * minchars is length of minimum legal abbreviation. */ GLOBAL(boolean) keymatch (char * arg, const char * keyword, int minchars) { register int ca, ck; register int nmatched = 0; while ((ca = *arg++) != '\0') { if ((ck = *keyword++) == '\0') return FALSE; /* arg longer than keyword, no good */ if (isupper(ca)) /* force arg to lcase (assume ck is already) */ ca = tolower(ca); if (ca != ck) return FALSE; /* no good */ nmatched++; /* count matched characters */ } /* reached end of argument; fail if it's too short for unique abbrev */ if (nmatched < minchars) return FALSE; return TRUE; /* A-OK */ } /* * Routines to establish binary I/O mode for stdin and stdout. * Non-Unix systems often require some hacking to get out of text mode. */ GLOBAL(FILE *) read_stdin (void) { FILE * input_file = stdin; #ifdef USE_SETMODE /* need to hack file mode? */ setmode(fileno(stdin), O_BINARY); #endif #ifdef USE_FDOPEN /* need to re-open in binary mode? */ if ((input_file = fdopen(fileno(stdin), READ_BINARY)) == NULL) { fprintf(stderr, "Cannot reopen stdin\n"); exit(EXIT_FAILURE); } #endif return input_file; } GLOBAL(FILE *) write_stdout (void) { FILE * output_file = stdout; #ifdef USE_SETMODE /* need to hack file mode? */ setmode(fileno(stdout), O_BINARY); #endif #ifdef USE_FDOPEN /* need to re-open in binary mode? */ if ((output_file = fdopen(fileno(stdout), WRITE_BINARY)) == NULL) { fprintf(stderr, "Cannot reopen stdout\n"); exit(EXIT_FAILURE); } #endif return output_file; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/rdswitch.c�����������������������������������������������0000644�0001750�0001750�00000023760�12320456500�022023� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * rdswitch.c * * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains routines to process some of cjpeg's more complicated * command-line switches. Switches processed here are: * -qtables file Read quantization tables from text file * -scans file Read scan script from text file * -qslots N[,N,...] Set component quantization table selectors * -sample HxV[,HxV,...] Set component sampling factors */ #include <ctype.h> /* to declare isdigit(), isspace() */ #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ LOCAL(int) text_getc (FILE * file) /* Read next char, skipping over any comments (# to end of line) */ /* A comment/newline sequence is returned as a newline */ { register int ch; ch = getc(file); if (ch == '#') { do { ch = getc(file); } while (ch != '\n' && ch != EOF); } return ch; } LOCAL(boolean) read_text_integer (FILE * file, long * result, int * termchar) /* Read an unsigned decimal integer from a file, store it in result */ /* Reads one trailing character after the integer; returns it in termchar */ { register int ch; register long val; /* Skip any leading whitespace, detect EOF */ do { ch = text_getc(file); if (ch == EOF) { *termchar = ch; return FALSE; } } while (isspace(ch)); if (! isdigit(ch)) { *termchar = ch; return FALSE; } val = ch - '0'; while ((ch = text_getc(file)) != EOF) { if (! isdigit(ch)) break; val *= 10; val += ch - '0'; } *result = val; *termchar = ch; return TRUE; } GLOBAL(boolean) read_quant_tables (j_compress_ptr cinfo, char * filename, int scale_factor, boolean force_baseline) /* Read a set of quantization tables from the specified file. * The file is plain ASCII text: decimal numbers with whitespace between. * Comments preceded by '#' may be included in the file. * There may be one to NUM_QUANT_TBLS tables in the file, each of 64 values. * The tables are implicitly numbered 0,1,etc. * NOTE: does not affect the qslots mapping, which will default to selecting * table 0 for luminance (or primary) components, 1 for chrominance components. * You must use -qslots if you want a different component->table mapping. */ { FILE * fp; int tblno, i, termchar; long val; unsigned int table[DCTSIZE2]; if ((fp = fopen(filename, "r")) == NULL) { fprintf(stderr, "Can't open table file %s\n", filename); return FALSE; } tblno = 0; while (read_text_integer(fp, &val, &termchar)) { /* read 1st element of table */ if (tblno >= NUM_QUANT_TBLS) { fprintf(stderr, "Too many tables in file %s\n", filename); fclose(fp); return FALSE; } table[0] = (unsigned int) val; for (i = 1; i < DCTSIZE2; i++) { if (! read_text_integer(fp, &val, &termchar)) { fprintf(stderr, "Invalid table data in file %s\n", filename); fclose(fp); return FALSE; } table[i] = (unsigned int) val; } jpeg_add_quant_table(cinfo, tblno, table, scale_factor, force_baseline); tblno++; } if (termchar != EOF) { fprintf(stderr, "Non-numeric data in file %s\n", filename); fclose(fp); return FALSE; } fclose(fp); return TRUE; } #ifdef C_MULTISCAN_FILES_SUPPORTED LOCAL(boolean) read_scan_integer (FILE * file, long * result, int * termchar) /* Variant of read_text_integer that always looks for a non-space termchar; * this simplifies parsing of punctuation in scan scripts. */ { register int ch; if (! read_text_integer(file, result, termchar)) return FALSE; ch = *termchar; while (ch != EOF && isspace(ch)) ch = text_getc(file); if (isdigit(ch)) { /* oops, put it back */ if (ungetc(ch, file) == EOF) return FALSE; ch = ' '; } else { /* Any separators other than ';' and ':' are ignored; * this allows user to insert commas, etc, if desired. */ if (ch != EOF && ch != ';' && ch != ':') ch = ' '; } *termchar = ch; return TRUE; } GLOBAL(boolean) read_scan_script (j_compress_ptr cinfo, char * filename) /* Read a scan script from the specified text file. * Each entry in the file defines one scan to be emitted. * Entries are separated by semicolons ';'. * An entry contains one to four component indexes, * optionally followed by a colon ':' and four progressive-JPEG parameters. * The component indexes denote which component(s) are to be transmitted * in the current scan. The first component has index 0. * Sequential JPEG is used if the progressive-JPEG parameters are omitted. * The file is free format text: any whitespace may appear between numbers * and the ':' and ';' punctuation marks. Also, other punctuation (such * as commas or dashes) can be placed between numbers if desired. * Comments preceded by '#' may be included in the file. * Note: we do very little validity checking here; * jcmaster.c will validate the script parameters. */ { FILE * fp; int scanno, ncomps, termchar; long val; jpeg_scan_info * scanptr; #define MAX_SCANS 100 /* quite arbitrary limit */ jpeg_scan_info scans[MAX_SCANS]; if ((fp = fopen(filename, "r")) == NULL) { fprintf(stderr, "Can't open scan definition file %s\n", filename); return FALSE; } scanptr = scans; scanno = 0; while (read_scan_integer(fp, &val, &termchar)) { if (scanno >= MAX_SCANS) { fprintf(stderr, "Too many scans defined in file %s\n", filename); fclose(fp); return FALSE; } scanptr->component_index[0] = (int) val; ncomps = 1; while (termchar == ' ') { if (ncomps >= MAX_COMPS_IN_SCAN) { fprintf(stderr, "Too many components in one scan in file %s\n", filename); fclose(fp); return FALSE; } if (! read_scan_integer(fp, &val, &termchar)) goto bogus; scanptr->component_index[ncomps] = (int) val; ncomps++; } scanptr->comps_in_scan = ncomps; if (termchar == ':') { if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ') goto bogus; scanptr->Ss = (int) val; if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ') goto bogus; scanptr->Se = (int) val; if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ') goto bogus; scanptr->Ah = (int) val; if (! read_scan_integer(fp, &val, &termchar)) goto bogus; scanptr->Al = (int) val; } else { /* set non-progressive parameters */ scanptr->Ss = 0; scanptr->Se = DCTSIZE2-1; scanptr->Ah = 0; scanptr->Al = 0; } if (termchar != ';' && termchar != EOF) { bogus: fprintf(stderr, "Invalid scan entry format in file %s\n", filename); fclose(fp); return FALSE; } scanptr++, scanno++; } if (termchar != EOF) { fprintf(stderr, "Non-numeric data in file %s\n", filename); fclose(fp); return FALSE; } if (scanno > 0) { /* Stash completed scan list in cinfo structure. * NOTE: for cjpeg's use, JPOOL_IMAGE is the right lifetime for this data, * but if you want to compress multiple images you'd want JPOOL_PERMANENT. */ scanptr = (jpeg_scan_info *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, scanno * SIZEOF(jpeg_scan_info)); MEMCOPY(scanptr, scans, scanno * SIZEOF(jpeg_scan_info)); cinfo->scan_info = scanptr; cinfo->num_scans = scanno; } fclose(fp); return TRUE; } #endif /* C_MULTISCAN_FILES_SUPPORTED */ GLOBAL(boolean) set_quant_slots (j_compress_ptr cinfo, char *arg) /* Process a quantization-table-selectors parameter string, of the form * N[,N,...] * If there are more components than parameters, the last value is replicated. */ { int val = 0; /* default table # */ int ci; char ch; for (ci = 0; ci < MAX_COMPONENTS; ci++) { if (*arg) { ch = ','; /* if not set by sscanf, will be ',' */ if (sscanf(arg, "%d%c", &val, &ch) < 1) return FALSE; if (ch != ',') /* syntax check */ return FALSE; if (val < 0 || val >= NUM_QUANT_TBLS) { fprintf(stderr, "JPEG quantization tables are numbered 0..%d\n", NUM_QUANT_TBLS-1); return FALSE; } cinfo->comp_info[ci].quant_tbl_no = val; while (*arg && *arg++ != ',') /* advance to next segment of arg string */ ; } else { /* reached end of parameter, set remaining components to last table */ cinfo->comp_info[ci].quant_tbl_no = val; } } return TRUE; } GLOBAL(boolean) set_sample_factors (j_compress_ptr cinfo, char *arg) /* Process a sample-factors parameter string, of the form * HxV[,HxV,...] * If there are more components than parameters, "1x1" is assumed for the rest. */ { int ci, val1, val2; char ch1, ch2; for (ci = 0; ci < MAX_COMPONENTS; ci++) { if (*arg) { ch2 = ','; /* if not set by sscanf, will be ',' */ if (sscanf(arg, "%d%c%d%c", &val1, &ch1, &val2, &ch2) < 3) return FALSE; if ((ch1 != 'x' && ch1 != 'X') || ch2 != ',') /* syntax check */ return FALSE; if (val1 <= 0 || val1 > 4 || val2 <= 0 || val2 > 4) { fprintf(stderr, "JPEG sampling factors must be 1..4\n"); return FALSE; } cinfo->comp_info[ci].h_samp_factor = val1; cinfo->comp_info[ci].v_samp_factor = val2; while (*arg && *arg++ != ',') /* advance to next segment of arg string */ ; } else { /* reached end of parameter, set remaining components to 1x1 sampling */ cinfo->comp_info[ci].h_samp_factor = 1; cinfo->comp_info[ci].v_samp_factor = 1; } } return TRUE; } #ifdef C_LOSSLESS_SUPPORTED GLOBAL(boolean) set_simple_lossless (j_compress_ptr cinfo, char *arg) { int pred, pt = 0; char ch; ch = ','; /* if not set by sscanf, will be ',' */ if (sscanf(arg, "%d%c", &pred, &ch) < 1) return FALSE; if (ch != ',') /* syntax check */ return FALSE; while (*arg && *arg++ != ',') /* advance to next segment of arg string */ ; if (*arg) { if (sscanf(arg, "%d", &pt) != 1) pt = 0; } jpeg_simple_lossless(cinfo, pred, pt); return TRUE; } #endif /* C_LOSSLESS_SUPPORTED */ ����������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdphuff.c������������������������������������������������0000644�0001750�0001750�00000051020�12320456500�021610� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdphuff.c * * Copyright (C) 1995-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains Huffman entropy decoding routines for progressive JPEG. * * Much of the complexity here has to do with supporting input suspension. * If the data source module demands suspension, we want to be able to back * up to the start of the current MCU. To do this, we copy state variables * into local working storage, and update them back to the permanent * storage only upon successful completion of an MCU. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossy.h" /* Private declarations for lossy subsystem */ #include "jdhuff.h" /* Declarations shared with jd*huff.c */ #ifdef D_PROGRESSIVE_SUPPORTED /* * Private entropy decoder object for progressive Huffman decoding. * * The savable_state subrecord contains fields that change within an MCU, * but must not be updated permanently until we complete the MCU. */ typedef struct { unsigned int EOBRUN; /* remaining EOBs in EOBRUN */ int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ } savable_state; /* This macro is to work around compilers with missing or broken * structure assignment. You'll need to fix this code if you have * such a compiler and you change MAX_COMPS_IN_SCAN. */ #ifndef NO_STRUCT_ASSIGN #define ASSIGN_STATE(dest,src) ((dest) = (src)) #else #if MAX_COMPS_IN_SCAN == 4 #define ASSIGN_STATE(dest,src) \ ((dest).EOBRUN = (src).EOBRUN, \ (dest).last_dc_val[0] = (src).last_dc_val[0], \ (dest).last_dc_val[1] = (src).last_dc_val[1], \ (dest).last_dc_val[2] = (src).last_dc_val[2], \ (dest).last_dc_val[3] = (src).last_dc_val[3]) #endif #endif typedef struct { huffd_common_fields; /* Fields shared with other entropy decoders */ /* These fields are loaded into local variables at start of each MCU. * In case of suspension, we exit WITHOUT updating them. */ savable_state saved; /* Other state at start of MCU */ /* These fields are NOT loaded into local working state. */ unsigned int restarts_to_go; /* MCUs left in this restart interval */ /* Pointers to derived tables (these workspaces have image lifespan) */ d_derived_tbl * derived_tbls[NUM_HUFF_TBLS]; d_derived_tbl * ac_derived_tbl; /* active table during an AC scan */ } phuff_entropy_decoder; typedef phuff_entropy_decoder * phuff_entropy_ptr; /* Forward declarations */ METHODDEF(boolean) decode_mcu_DC_first JPP((j_decompress_ptr cinfo, JBLOCKROW *MCU_data)); METHODDEF(boolean) decode_mcu_AC_first JPP((j_decompress_ptr cinfo, JBLOCKROW *MCU_data)); METHODDEF(boolean) decode_mcu_DC_refine JPP((j_decompress_ptr cinfo, JBLOCKROW *MCU_data)); METHODDEF(boolean) decode_mcu_AC_refine JPP((j_decompress_ptr cinfo, JBLOCKROW *MCU_data)); /* * Initialize for a Huffman-compressed scan. */ METHODDEF(void) start_pass_phuff_decoder (j_decompress_ptr cinfo) { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; phuff_entropy_ptr entropy = (phuff_entropy_ptr) lossyd->entropy_private; boolean is_DC_band, bad; int ci, coefi, tbl; int *coef_bit_ptr; jpeg_component_info * compptr; is_DC_band = (cinfo->Ss == 0); /* Validate scan parameters */ bad = FALSE; if (is_DC_band) { if (cinfo->Se != 0) bad = TRUE; } else { /* need not check Ss/Se < 0 since they came from unsigned bytes */ if (cinfo->Ss > cinfo->Se || cinfo->Se >= DCTSIZE2) bad = TRUE; /* AC scans may have only one component */ if (cinfo->comps_in_scan != 1) bad = TRUE; } if (cinfo->Ah != 0) { /* Successive approximation refinement scan: must have Al = Ah-1. */ if (cinfo->Al != cinfo->Ah-1) bad = TRUE; } if (cinfo->Al > 13) /* need not check for < 0 */ bad = TRUE; /* Arguably the maximum Al value should be less than 13 for 8-bit precision, * but the spec doesn't say so, and we try to be liberal about what we * accept. Note: large Al values could result in out-of-range DC * coefficients during early scans, leading to bizarre displays due to * overflows in the IDCT math. But we won't crash. */ if (bad) ERREXIT4(cinfo, JERR_BAD_PROGRESSION, cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al); /* Update progression status, and verify that scan order is legal. * Note that inter-scan inconsistencies are treated as warnings * not fatal errors ... not clear if this is right way to behave. */ for (ci = 0; ci < cinfo->comps_in_scan; ci++) { int cindex = cinfo->cur_comp_info[ci]->component_index; coef_bit_ptr = & cinfo->coef_bits[cindex][0]; if (!is_DC_band && coef_bit_ptr[0] < 0) /* AC without prior DC scan */ WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0); for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) { int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi]; if (cinfo->Ah != expected) WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi); coef_bit_ptr[coefi] = cinfo->Al; } } /* Select MCU decoding routine */ if (cinfo->Ah == 0) { if (is_DC_band) lossyd->entropy_decode_mcu = decode_mcu_DC_first; else lossyd->entropy_decode_mcu = decode_mcu_AC_first; } else { if (is_DC_band) lossyd->entropy_decode_mcu = decode_mcu_DC_refine; else lossyd->entropy_decode_mcu = decode_mcu_AC_refine; } for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; /* Make sure requested tables are present, and compute derived tables. * We may build same derived table more than once, but it's not expensive. */ if (is_DC_band) { if (cinfo->Ah == 0) { /* DC refinement needs no table */ tbl = compptr->dc_tbl_no; jpeg_make_d_derived_tbl(cinfo, TRUE, tbl, & entropy->derived_tbls[tbl]); } } else { tbl = compptr->ac_tbl_no; jpeg_make_d_derived_tbl(cinfo, FALSE, tbl, & entropy->derived_tbls[tbl]); /* remember the single active table */ entropy->ac_derived_tbl = entropy->derived_tbls[tbl]; } /* Initialize DC predictions to 0 */ entropy->saved.last_dc_val[ci] = 0; } /* Initialize bitread state variables */ entropy->bitstate.bits_left = 0; entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */ entropy->insufficient_data = FALSE; /* Initialize private state variables */ entropy->saved.EOBRUN = 0; /* Initialize restart counter */ entropy->restarts_to_go = cinfo->restart_interval; } /* * Figure F.12: extend sign bit. * On some machines, a shift and add will be faster than a table lookup. */ #ifdef AVOID_TABLES #define HUFF_EXTEND(x,s) ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x)) #else #define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x)) static const int extend_test[16] = /* entry n is 2**(n-1) */ { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 }; static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 }; #endif /* AVOID_TABLES */ /* * Check for a restart marker & resynchronize decoder. * Returns FALSE if must suspend. */ LOCAL(boolean) process_restart (j_decompress_ptr cinfo) { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; phuff_entropy_ptr entropy = (phuff_entropy_ptr) lossyd->entropy_private; int ci; /* Throw away any unused bits remaining in bit buffer; */ /* include any full bytes in next_marker's count of discarded bytes */ cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8; entropy->bitstate.bits_left = 0; /* Advance past the RSTn marker */ if (! (*cinfo->marker->read_restart_marker) (cinfo)) return FALSE; /* Re-initialize DC predictions to 0 */ for (ci = 0; ci < cinfo->comps_in_scan; ci++) entropy->saved.last_dc_val[ci] = 0; /* Re-init EOB run count, too */ entropy->saved.EOBRUN = 0; /* Reset restart counter */ entropy->restarts_to_go = cinfo->restart_interval; /* Reset out-of-data flag, unless read_restart_marker left us smack up * against a marker. In that case we will end up treating the next data * segment as empty, and we can avoid producing bogus output pixels by * leaving the flag set. */ if (cinfo->unread_marker == 0) entropy->insufficient_data = FALSE; return TRUE; } /* * Huffman MCU decoding. * Each of these routines decodes and returns one MCU's worth of * Huffman-compressed coefficients. * The coefficients are reordered from zigzag order into natural array order, * but are not dequantized. * * The i'th block of the MCU is stored into the block pointed to by * MCU_data[i]. WE ASSUME THIS AREA IS INITIALLY ZEROED BY THE CALLER. * * We return FALSE if data source requested suspension. In that case no * changes have been made to permanent state. (Exception: some output * coefficients may already have been assigned. This is harmless for * spectral selection, since we'll just re-assign them on the next call. * Successive approximation AC refinement has to be more careful, however.) */ /* * MCU decoding for DC initial scan (either spectral selection, * or first pass of successive approximation). */ METHODDEF(boolean) decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; phuff_entropy_ptr entropy = (phuff_entropy_ptr) lossyd->entropy_private; int Al = cinfo->Al; register int s, r; int blkn, ci; JBLOCKROW block; BITREAD_STATE_VARS; savable_state state; d_derived_tbl * tbl; jpeg_component_info * compptr; /* Process restart marker if needed; may have to suspend */ if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) if (! process_restart(cinfo)) return FALSE; } /* If we've run out of data, just leave the MCU set to zeroes. * This way, we return uniform gray for the remainder of the segment. */ if (! entropy->insufficient_data) { /* Load up working state */ BITREAD_LOAD_STATE(cinfo,entropy->bitstate); ASSIGN_STATE(state, entropy->saved); /* Outer loop handles each block in the MCU */ for (blkn = 0; blkn < cinfo->data_units_in_MCU; blkn++) { block = MCU_data[blkn]; ci = cinfo->MCU_membership[blkn]; compptr = cinfo->cur_comp_info[ci]; tbl = entropy->derived_tbls[compptr->dc_tbl_no]; /* Decode a single block's worth of coefficients */ /* Section F.2.2.1: decode the DC coefficient difference */ HUFF_DECODE(s, br_state, tbl, return FALSE, label1); if (s) { CHECK_BIT_BUFFER(br_state, s, return FALSE); r = GET_BITS(s); s = HUFF_EXTEND(r, s); } /* Convert DC difference to actual value, update last_dc_val */ s += state.last_dc_val[ci]; state.last_dc_val[ci] = s; /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */ (*block)[0] = (JCOEF) (s << Al); } /* Completed MCU, so update state */ BITREAD_SAVE_STATE(cinfo,entropy->bitstate); ASSIGN_STATE(entropy->saved, state); } /* Account for restart interval (no-op if not using restarts) */ entropy->restarts_to_go--; return TRUE; } /* * MCU decoding for AC initial scan (either spectral selection, * or first pass of successive approximation). */ METHODDEF(boolean) decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; phuff_entropy_ptr entropy = (phuff_entropy_ptr) lossyd->entropy_private; int Se = cinfo->Se; int Al = cinfo->Al; register int s, k, r; unsigned int EOBRUN; JBLOCKROW block; BITREAD_STATE_VARS; d_derived_tbl * tbl; /* Process restart marker if needed; may have to suspend */ if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) if (! process_restart(cinfo)) return FALSE; } /* If we've run out of data, just leave the MCU set to zeroes. * This way, we return uniform gray for the remainder of the segment. */ if (! entropy->insufficient_data) { /* Load up working state. * We can avoid loading/saving bitread state if in an EOB run. */ EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */ /* There is always only one block per MCU */ if (EOBRUN > 0) /* if it's a band of zeroes... */ EOBRUN--; /* ...process it now (we do nothing) */ else { BITREAD_LOAD_STATE(cinfo,entropy->bitstate); block = MCU_data[0]; tbl = entropy->ac_derived_tbl; for (k = cinfo->Ss; k <= Se; k++) { HUFF_DECODE(s, br_state, tbl, return FALSE, label2); r = s >> 4; s &= 15; if (s) { k += r; CHECK_BIT_BUFFER(br_state, s, return FALSE); r = GET_BITS(s); s = HUFF_EXTEND(r, s); /* Scale and output coefficient in natural (dezigzagged) order */ (*block)[jpeg_natural_order[k]] = (JCOEF) (s << Al); } else { if (r == 15) { /* ZRL */ k += 15; /* skip 15 zeroes in band */ } else { /* EOBr, run length is 2^r + appended bits */ EOBRUN = 1 << r; if (r) { /* EOBr, r > 0 */ CHECK_BIT_BUFFER(br_state, r, return FALSE); r = GET_BITS(r); EOBRUN += r; } EOBRUN--; /* this band is processed at this moment */ break; /* force end-of-band */ } } } BITREAD_SAVE_STATE(cinfo,entropy->bitstate); } /* Completed MCU, so update state */ entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */ } /* Account for restart interval (no-op if not using restarts) */ entropy->restarts_to_go--; return TRUE; } /* * MCU decoding for DC successive approximation refinement scan. * Note: we assume such scans can be multi-component, although the spec * is not very clear on the point. */ METHODDEF(boolean) decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; phuff_entropy_ptr entropy = (phuff_entropy_ptr) lossyd->entropy_private; int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ int blkn; JBLOCKROW block; BITREAD_STATE_VARS; /* Process restart marker if needed; may have to suspend */ if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) if (! process_restart(cinfo)) return FALSE; } /* Not worth the cycles to check insufficient_data here, * since we will not change the data anyway if we read zeroes. */ /* Load up working state */ BITREAD_LOAD_STATE(cinfo,entropy->bitstate); /* Outer loop handles each block in the MCU */ for (blkn = 0; blkn < cinfo->data_units_in_MCU; blkn++) { block = MCU_data[blkn]; /* Encoded data is simply the next bit of the two's-complement DC value */ CHECK_BIT_BUFFER(br_state, 1, return FALSE); if (GET_BITS(1)) (*block)[0] |= p1; /* Note: since we use |=, repeating the assignment later is safe */ } /* Completed MCU, so update state */ BITREAD_SAVE_STATE(cinfo,entropy->bitstate); /* Account for restart interval (no-op if not using restarts) */ entropy->restarts_to_go--; return TRUE; } /* * MCU decoding for AC successive approximation refinement scan. */ METHODDEF(boolean) decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; phuff_entropy_ptr entropy = (phuff_entropy_ptr) lossyd->entropy_private; int Se = cinfo->Se; int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ int m1 = (-1) << cinfo->Al; /* -1 in the bit position being coded */ register int s, k, r; unsigned int EOBRUN; JBLOCKROW block; JCOEFPTR thiscoef; BITREAD_STATE_VARS; d_derived_tbl * tbl; int num_newnz; int newnz_pos[DCTSIZE2]; /* Process restart marker if needed; may have to suspend */ if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) if (! process_restart(cinfo)) return FALSE; } /* If we've run out of data, don't modify the MCU. */ if (! entropy->insufficient_data) { /* Load up working state */ BITREAD_LOAD_STATE(cinfo,entropy->bitstate); EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */ /* There is always only one block per MCU */ block = MCU_data[0]; tbl = entropy->ac_derived_tbl; /* If we are forced to suspend, we must undo the assignments to any newly * nonzero coefficients in the block, because otherwise we'd get confused * next time about which coefficients were already nonzero. * But we need not undo addition of bits to already-nonzero coefficients; * instead, we can test the current bit to see if we already did it. */ num_newnz = 0; /* initialize coefficient loop counter to start of band */ k = cinfo->Ss; if (EOBRUN == 0) { for (; k <= Se; k++) { HUFF_DECODE(s, br_state, tbl, goto undoit, label3); r = s >> 4; s &= 15; if (s) { if (s != 1) /* size of new coef should always be 1 */ WARNMS(cinfo, JWRN_HUFF_BAD_CODE); CHECK_BIT_BUFFER(br_state, 1, goto undoit); if (GET_BITS(1)) s = p1; /* newly nonzero coef is positive */ else s = m1; /* newly nonzero coef is negative */ } else { if (r != 15) { EOBRUN = 1 << r; /* EOBr, run length is 2^r + appended bits */ if (r) { CHECK_BIT_BUFFER(br_state, r, goto undoit); r = GET_BITS(r); EOBRUN += r; } break; /* rest of block is handled by EOB logic */ } /* note s = 0 for processing ZRL */ } /* Advance over already-nonzero coefs and r still-zero coefs, * appending correction bits to the nonzeroes. A correction bit is 1 * if the absolute value of the coefficient must be increased. */ do { thiscoef = *block + jpeg_natural_order[k]; if (*thiscoef != 0) { CHECK_BIT_BUFFER(br_state, 1, goto undoit); if (GET_BITS(1)) { if ((*thiscoef & p1) == 0) { /* do nothing if already set it */ if (*thiscoef >= 0) *thiscoef += p1; else *thiscoef += m1; } } } else { if (--r < 0) break; /* reached target zero coefficient */ } k++; } while (k <= Se); if (s) { int pos = jpeg_natural_order[k]; /* Output newly nonzero coefficient */ (*block)[pos] = (JCOEF) s; /* Remember its position in case we have to suspend */ newnz_pos[num_newnz++] = pos; } } } if (EOBRUN > 0) { /* Scan any remaining coefficient positions after the end-of-band * (the last newly nonzero coefficient, if any). Append a correction * bit to each already-nonzero coefficient. A correction bit is 1 * if the absolute value of the coefficient must be increased. */ for (; k <= Se; k++) { thiscoef = *block + jpeg_natural_order[k]; if (*thiscoef != 0) { CHECK_BIT_BUFFER(br_state, 1, goto undoit); if (GET_BITS(1)) { if ((*thiscoef & p1) == 0) { /* do nothing if already changed it */ if (*thiscoef >= 0) *thiscoef += p1; else *thiscoef += m1; } } } } /* Count one block completed in EOB run */ EOBRUN--; } /* Completed MCU, so update state */ BITREAD_SAVE_STATE(cinfo,entropy->bitstate); entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */ } /* Account for restart interval (no-op if not using restarts) */ entropy->restarts_to_go--; return TRUE; undoit: /* Re-zero any output coefficients that we made newly nonzero */ while (num_newnz > 0) (*block)[newnz_pos[--num_newnz]] = 0; return FALSE; } /* * Module initialization routine for progressive Huffman entropy decoding. */ GLOBAL(void) jinit_phuff_decoder (j_decompress_ptr cinfo) { j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec; phuff_entropy_ptr entropy; int *coef_bit_ptr; int ci, i; entropy = (phuff_entropy_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(phuff_entropy_decoder)); lossyd->entropy_private = (void *) entropy; lossyd->entropy_start_pass = start_pass_phuff_decoder; /* Mark derived tables unallocated */ for (i = 0; i < NUM_HUFF_TBLS; i++) { entropy->derived_tbls[i] = NULL; } /* Create progression status table */ cinfo->coef_bits = (int (*)[DCTSIZE2]) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, cinfo->num_components*DCTSIZE2*SIZEOF(int)); coef_bit_ptr = & cinfo->coef_bits[0][0]; for (ci = 0; ci < cinfo->num_components; ci++) for (i = 0; i < DCTSIZE2; i++) *coef_bit_ptr++ = -1; } #endif /* D_PROGRESSIVE_SUPPORTED */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/transupp.c�����������������������������������������������0000644�0001750�0001750�00000100107�12320456500�022037� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * transupp.c * * Copyright (C) 1997-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains image transformation routines and other utility code * used by the jpegtran sample application. These are NOT part of the core * JPEG library. But we keep these routines separate from jpegtran.c to * ease the task of maintaining jpegtran-like programs that have other user * interfaces. */ /* Although this file really shouldn't have access to the library internals, * it's helpful to let it call jround_up() and jcopy_block_row(). */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "transupp.h" /* My own external interface */ #if TRANSFORMS_SUPPORTED /* * Lossless image transformation routines. These routines work on DCT * coefficient arrays and thus do not require any lossy decompression * or recompression of the image. * Thanks to Guido Vollbeding for the initial design and code of this feature. * * Horizontal flipping is done in-place, using a single top-to-bottom * pass through the virtual source array. It will thus be much the * fastest option for images larger than main memory. * * The other routines require a set of destination virtual arrays, so they * need twice as much memory as jpegtran normally does. The destination * arrays are always written in normal scan order (top to bottom) because * the virtual array manager expects this. The source arrays will be scanned * in the corresponding order, which means multiple passes through the source * arrays for most of the transforms. That could result in much thrashing * if the image is larger than main memory. * * Some notes about the operating environment of the individual transform * routines: * 1. Both the source and destination virtual arrays are allocated from the * source JPEG object, and therefore should be manipulated by calling the * source's memory manager. * 2. The destination's component count should be used. It may be smaller * than the source's when forcing to grayscale. * 3. Likewise the destination's sampling factors should be used. When * forcing to grayscale the destination's sampling factors will be all 1, * and we may as well take that as the effective iMCU size. * 4. When "trim" is in effect, the destination's dimensions will be the * trimmed values but the source's will be untrimmed. * 5. All the routines assume that the source and destination buffers are * padded out to a full iMCU boundary. This is true, although for the * source buffer it is an undocumented property of jdcoefct.c. * Notes 2,3,4 boil down to this: generally we should use the destination's * dimensions and ignore the source's. */ LOCAL(void) do_flip_h (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, jvirt_barray_ptr *src_coef_arrays) /* Horizontal flip; done in-place, so no separate dest array is required */ { JDIMENSION MCU_cols, comp_width, blk_x, blk_y; int ci, k, offset_y; JBLOCKARRAY buffer; JCOEFPTR ptr1, ptr2; JCOEF temp1, temp2; jpeg_component_info *compptr; /* Horizontal mirroring of DCT blocks is accomplished by swapping * pairs of blocks in-place. Within a DCT block, we perform horizontal * mirroring by changing the signs of odd-numbered columns. * Partial iMCUs at the right edge are left untouched. */ MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE); for (ci = 0; ci < dstinfo->num_components; ci++) { compptr = dstinfo->comp_info + ci; comp_width = MCU_cols * compptr->h_samp_factor; for (blk_y = 0; blk_y < compptr->height_in_data_units; blk_y += compptr->v_samp_factor) { buffer = (*srcinfo->mem->access_virt_barray) ((j_common_ptr) srcinfo, src_coef_arrays[ci], blk_y, (JDIMENSION) compptr->v_samp_factor, TRUE); for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { for (blk_x = 0; blk_x * 2 < comp_width; blk_x++) { ptr1 = buffer[offset_y][blk_x]; ptr2 = buffer[offset_y][comp_width - blk_x - 1]; /* this unrolled loop doesn't need to know which row it's on... */ for (k = 0; k < DCTSIZE2; k += 2) { temp1 = *ptr1; /* swap even column */ temp2 = *ptr2; *ptr1++ = temp2; *ptr2++ = temp1; temp1 = *ptr1; /* swap odd column with sign change */ temp2 = *ptr2; *ptr1++ = -temp2; *ptr2++ = -temp1; } } } } } } LOCAL(void) do_flip_v (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, jvirt_barray_ptr *src_coef_arrays, jvirt_barray_ptr *dst_coef_arrays) /* Vertical flip */ { JDIMENSION MCU_rows, comp_height, dst_blk_x, dst_blk_y; int ci, i, j, offset_y; JBLOCKARRAY src_buffer, dst_buffer; JBLOCKROW src_row_ptr, dst_row_ptr; JCOEFPTR src_ptr, dst_ptr; jpeg_component_info *compptr; /* We output into a separate array because we can't touch different * rows of the source virtual array simultaneously. Otherwise, this * is a pretty straightforward analog of horizontal flip. * Within a DCT block, vertical mirroring is done by changing the signs * of odd-numbered rows. * Partial iMCUs at the bottom edge are copied verbatim. */ MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE); for (ci = 0; ci < dstinfo->num_components; ci++) { compptr = dstinfo->comp_info + ci; comp_height = MCU_rows * compptr->v_samp_factor; for (dst_blk_y = 0; dst_blk_y < compptr->height_in_data_units; dst_blk_y += compptr->v_samp_factor) { dst_buffer = (*srcinfo->mem->access_virt_barray) ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, (JDIMENSION) compptr->v_samp_factor, TRUE); if (dst_blk_y < comp_height) { /* Row is within the mirrorable area. */ src_buffer = (*srcinfo->mem->access_virt_barray) ((j_common_ptr) srcinfo, src_coef_arrays[ci], comp_height - dst_blk_y - (JDIMENSION) compptr->v_samp_factor, (JDIMENSION) compptr->v_samp_factor, FALSE); } else { /* Bottom-edge blocks will be copied verbatim. */ src_buffer = (*srcinfo->mem->access_virt_barray) ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_y, (JDIMENSION) compptr->v_samp_factor, FALSE); } for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { if (dst_blk_y < comp_height) { /* Row is within the mirrorable area. */ dst_row_ptr = dst_buffer[offset_y]; src_row_ptr = src_buffer[compptr->v_samp_factor - offset_y - 1]; for (dst_blk_x = 0; dst_blk_x < compptr->width_in_data_units; dst_blk_x++) { dst_ptr = dst_row_ptr[dst_blk_x]; src_ptr = src_row_ptr[dst_blk_x]; for (i = 0; i < DCTSIZE; i += 2) { /* copy even row */ for (j = 0; j < DCTSIZE; j++) *dst_ptr++ = *src_ptr++; /* copy odd row with sign change */ for (j = 0; j < DCTSIZE; j++) *dst_ptr++ = - *src_ptr++; } } } else { /* Just copy row verbatim. */ jcopy_block_row(src_buffer[offset_y], dst_buffer[offset_y], compptr->width_in_data_units); } } } } } LOCAL(void) do_transpose (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, jvirt_barray_ptr *src_coef_arrays, jvirt_barray_ptr *dst_coef_arrays) /* Transpose source into destination */ { JDIMENSION dst_blk_x, dst_blk_y; int ci, i, j, offset_x, offset_y; JBLOCKARRAY src_buffer, dst_buffer; JCOEFPTR src_ptr, dst_ptr; jpeg_component_info *compptr; /* Transposing pixels within a block just requires transposing the * DCT coefficients. * Partial iMCUs at the edges require no special treatment; we simply * process all the available DCT blocks for every component. */ for (ci = 0; ci < dstinfo->num_components; ci++) { compptr = dstinfo->comp_info + ci; for (dst_blk_y = 0; dst_blk_y < compptr->height_in_data_units; dst_blk_y += compptr->v_samp_factor) { dst_buffer = (*srcinfo->mem->access_virt_barray) ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, (JDIMENSION) compptr->v_samp_factor, TRUE); for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { for (dst_blk_x = 0; dst_blk_x < compptr->width_in_data_units; dst_blk_x += compptr->h_samp_factor) { src_buffer = (*srcinfo->mem->access_virt_barray) ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x, (JDIMENSION) compptr->h_samp_factor, FALSE); for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) { src_ptr = src_buffer[offset_x][dst_blk_y + offset_y]; dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; for (i = 0; i < DCTSIZE; i++) for (j = 0; j < DCTSIZE; j++) dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; } } } } } } LOCAL(void) do_rot_90 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, jvirt_barray_ptr *src_coef_arrays, jvirt_barray_ptr *dst_coef_arrays) /* 90 degree rotation is equivalent to * 1. Transposing the image; * 2. Horizontal mirroring. * These two steps are merged into a single processing routine. */ { JDIMENSION MCU_cols, comp_width, dst_blk_x, dst_blk_y; int ci, i, j, offset_x, offset_y; JBLOCKARRAY src_buffer, dst_buffer; JCOEFPTR src_ptr, dst_ptr; jpeg_component_info *compptr; /* Because of the horizontal mirror step, we can't process partial iMCUs * at the (output) right edge properly. They just get transposed and * not mirrored. */ MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE); for (ci = 0; ci < dstinfo->num_components; ci++) { compptr = dstinfo->comp_info + ci; comp_width = MCU_cols * compptr->h_samp_factor; for (dst_blk_y = 0; dst_blk_y < compptr->height_in_data_units; dst_blk_y += compptr->v_samp_factor) { dst_buffer = (*srcinfo->mem->access_virt_barray) ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, (JDIMENSION) compptr->v_samp_factor, TRUE); for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { for (dst_blk_x = 0; dst_blk_x < compptr->width_in_data_units; dst_blk_x += compptr->h_samp_factor) { src_buffer = (*srcinfo->mem->access_virt_barray) ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x, (JDIMENSION) compptr->h_samp_factor, FALSE); for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) { src_ptr = src_buffer[offset_x][dst_blk_y + offset_y]; if (dst_blk_x < comp_width) { /* Block is within the mirrorable area. */ dst_ptr = dst_buffer[offset_y] [comp_width - dst_blk_x - offset_x - 1]; for (i = 0; i < DCTSIZE; i++) { for (j = 0; j < DCTSIZE; j++) dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; i++; for (j = 0; j < DCTSIZE; j++) dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; } } else { /* Edge blocks are transposed but not mirrored. */ dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; for (i = 0; i < DCTSIZE; i++) for (j = 0; j < DCTSIZE; j++) dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; } } } } } } } LOCAL(void) do_rot_270 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, jvirt_barray_ptr *src_coef_arrays, jvirt_barray_ptr *dst_coef_arrays) /* 270 degree rotation is equivalent to * 1. Horizontal mirroring; * 2. Transposing the image. * These two steps are merged into a single processing routine. */ { JDIMENSION MCU_rows, comp_height, dst_blk_x, dst_blk_y; int ci, i, j, offset_x, offset_y; JBLOCKARRAY src_buffer, dst_buffer; JCOEFPTR src_ptr, dst_ptr; jpeg_component_info *compptr; /* Because of the horizontal mirror step, we can't process partial iMCUs * at the (output) bottom edge properly. They just get transposed and * not mirrored. */ MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE); for (ci = 0; ci < dstinfo->num_components; ci++) { compptr = dstinfo->comp_info + ci; comp_height = MCU_rows * compptr->v_samp_factor; for (dst_blk_y = 0; dst_blk_y < compptr->height_in_data_units; dst_blk_y += compptr->v_samp_factor) { dst_buffer = (*srcinfo->mem->access_virt_barray) ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, (JDIMENSION) compptr->v_samp_factor, TRUE); for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { for (dst_blk_x = 0; dst_blk_x < compptr->width_in_data_units; dst_blk_x += compptr->h_samp_factor) { src_buffer = (*srcinfo->mem->access_virt_barray) ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x, (JDIMENSION) compptr->h_samp_factor, FALSE); for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) { dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; if (dst_blk_y < comp_height) { /* Block is within the mirrorable area. */ src_ptr = src_buffer[offset_x] [comp_height - dst_blk_y - offset_y - 1]; for (i = 0; i < DCTSIZE; i++) { for (j = 0; j < DCTSIZE; j++) { dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; j++; dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; } } } else { /* Edge blocks are transposed but not mirrored. */ src_ptr = src_buffer[offset_x][dst_blk_y + offset_y]; for (i = 0; i < DCTSIZE; i++) for (j = 0; j < DCTSIZE; j++) dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; } } } } } } } LOCAL(void) do_rot_180 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, jvirt_barray_ptr *src_coef_arrays, jvirt_barray_ptr *dst_coef_arrays) /* 180 degree rotation is equivalent to * 1. Vertical mirroring; * 2. Horizontal mirroring. * These two steps are merged into a single processing routine. */ { JDIMENSION MCU_cols, MCU_rows, comp_width, comp_height, dst_blk_x, dst_blk_y; int ci, i, j, offset_y; JBLOCKARRAY src_buffer, dst_buffer; JBLOCKROW src_row_ptr, dst_row_ptr; JCOEFPTR src_ptr, dst_ptr; jpeg_component_info *compptr; MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE); MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE); for (ci = 0; ci < dstinfo->num_components; ci++) { compptr = dstinfo->comp_info + ci; comp_width = MCU_cols * compptr->h_samp_factor; comp_height = MCU_rows * compptr->v_samp_factor; for (dst_blk_y = 0; dst_blk_y < compptr->height_in_data_units; dst_blk_y += compptr->v_samp_factor) { dst_buffer = (*srcinfo->mem->access_virt_barray) ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, (JDIMENSION) compptr->v_samp_factor, TRUE); if (dst_blk_y < comp_height) { /* Row is within the vertically mirrorable area. */ src_buffer = (*srcinfo->mem->access_virt_barray) ((j_common_ptr) srcinfo, src_coef_arrays[ci], comp_height - dst_blk_y - (JDIMENSION) compptr->v_samp_factor, (JDIMENSION) compptr->v_samp_factor, FALSE); } else { /* Bottom-edge rows are only mirrored horizontally. */ src_buffer = (*srcinfo->mem->access_virt_barray) ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_y, (JDIMENSION) compptr->v_samp_factor, FALSE); } for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { if (dst_blk_y < comp_height) { /* Row is within the mirrorable area. */ dst_row_ptr = dst_buffer[offset_y]; src_row_ptr = src_buffer[compptr->v_samp_factor - offset_y - 1]; /* Process the blocks that can be mirrored both ways. */ for (dst_blk_x = 0; dst_blk_x < comp_width; dst_blk_x++) { dst_ptr = dst_row_ptr[dst_blk_x]; src_ptr = src_row_ptr[comp_width - dst_blk_x - 1]; for (i = 0; i < DCTSIZE; i += 2) { /* For even row, negate every odd column. */ for (j = 0; j < DCTSIZE; j += 2) { *dst_ptr++ = *src_ptr++; *dst_ptr++ = - *src_ptr++; } /* For odd row, negate every even column. */ for (j = 0; j < DCTSIZE; j += 2) { *dst_ptr++ = - *src_ptr++; *dst_ptr++ = *src_ptr++; } } } /* Any remaining right-edge blocks are only mirrored vertically. */ for (; dst_blk_x < compptr->width_in_data_units; dst_blk_x++) { dst_ptr = dst_row_ptr[dst_blk_x]; src_ptr = src_row_ptr[dst_blk_x]; for (i = 0; i < DCTSIZE; i += 2) { for (j = 0; j < DCTSIZE; j++) *dst_ptr++ = *src_ptr++; for (j = 0; j < DCTSIZE; j++) *dst_ptr++ = - *src_ptr++; } } } else { /* Remaining rows are just mirrored horizontally. */ dst_row_ptr = dst_buffer[offset_y]; src_row_ptr = src_buffer[offset_y]; /* Process the blocks that can be mirrored. */ for (dst_blk_x = 0; dst_blk_x < comp_width; dst_blk_x++) { dst_ptr = dst_row_ptr[dst_blk_x]; src_ptr = src_row_ptr[comp_width - dst_blk_x - 1]; for (i = 0; i < DCTSIZE2; i += 2) { *dst_ptr++ = *src_ptr++; *dst_ptr++ = - *src_ptr++; } } /* Any remaining right-edge blocks are only copied. */ for (; dst_blk_x < compptr->width_in_data_units; dst_blk_x++) { dst_ptr = dst_row_ptr[dst_blk_x]; src_ptr = src_row_ptr[dst_blk_x]; for (i = 0; i < DCTSIZE2; i++) *dst_ptr++ = *src_ptr++; } } } } } } LOCAL(void) do_transverse (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, jvirt_barray_ptr *src_coef_arrays, jvirt_barray_ptr *dst_coef_arrays) /* Transverse transpose is equivalent to * 1. 180 degree rotation; * 2. Transposition; * or * 1. Horizontal mirroring; * 2. Transposition; * 3. Horizontal mirroring. * These steps are merged into a single processing routine. */ { JDIMENSION MCU_cols, MCU_rows, comp_width, comp_height, dst_blk_x, dst_blk_y; int ci, i, j, offset_x, offset_y; JBLOCKARRAY src_buffer, dst_buffer; JCOEFPTR src_ptr, dst_ptr; jpeg_component_info *compptr; MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE); MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE); for (ci = 0; ci < dstinfo->num_components; ci++) { compptr = dstinfo->comp_info + ci; comp_width = MCU_cols * compptr->h_samp_factor; comp_height = MCU_rows * compptr->v_samp_factor; for (dst_blk_y = 0; dst_blk_y < compptr->height_in_data_units; dst_blk_y += compptr->v_samp_factor) { dst_buffer = (*srcinfo->mem->access_virt_barray) ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, (JDIMENSION) compptr->v_samp_factor, TRUE); for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { for (dst_blk_x = 0; dst_blk_x < compptr->width_in_data_units; dst_blk_x += compptr->h_samp_factor) { src_buffer = (*srcinfo->mem->access_virt_barray) ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x, (JDIMENSION) compptr->h_samp_factor, FALSE); for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) { if (dst_blk_y < comp_height) { src_ptr = src_buffer[offset_x] [comp_height - dst_blk_y - offset_y - 1]; if (dst_blk_x < comp_width) { /* Block is within the mirrorable area. */ dst_ptr = dst_buffer[offset_y] [comp_width - dst_blk_x - offset_x - 1]; for (i = 0; i < DCTSIZE; i++) { for (j = 0; j < DCTSIZE; j++) { dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; j++; dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; } i++; for (j = 0; j < DCTSIZE; j++) { dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; j++; dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; } } } else { /* Right-edge blocks are mirrored in y only */ dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; for (i = 0; i < DCTSIZE; i++) { for (j = 0; j < DCTSIZE; j++) { dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; j++; dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; } } } } else { src_ptr = src_buffer[offset_x][dst_blk_y + offset_y]; if (dst_blk_x < comp_width) { /* Bottom-edge blocks are mirrored in x only */ dst_ptr = dst_buffer[offset_y] [comp_width - dst_blk_x - offset_x - 1]; for (i = 0; i < DCTSIZE; i++) { for (j = 0; j < DCTSIZE; j++) dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; i++; for (j = 0; j < DCTSIZE; j++) dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; } } else { /* At lower right corner, just transpose, no mirroring */ dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; for (i = 0; i < DCTSIZE; i++) for (j = 0; j < DCTSIZE; j++) dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; } } } } } } } } /* Request any required workspace. * * We allocate the workspace virtual arrays from the source decompression * object, so that all the arrays (both the original data and the workspace) * will be taken into account while making memory management decisions. * Hence, this routine must be called after jpeg_read_header (which reads * the image dimensions) and before jpeg_read_coefficients (which realizes * the source's virtual arrays). */ GLOBAL(void) jtransform_request_workspace (j_decompress_ptr srcinfo, jpeg_transform_info *info) { jvirt_barray_ptr *coef_arrays = NULL; jpeg_component_info *compptr; int ci; if (info->force_grayscale && srcinfo->jpeg_color_space == JCS_YCbCr && srcinfo->num_components == 3) { /* We'll only process the first component */ info->num_components = 1; } else { /* Process all the components */ info->num_components = srcinfo->num_components; } switch (info->transform) { case JXFORM_NONE: case JXFORM_FLIP_H: /* Don't need a workspace array */ break; case JXFORM_FLIP_V: case JXFORM_ROT_180: /* Need workspace arrays having same dimensions as source image. * Note that we allocate arrays padded out to the next iMCU boundary, * so that transform routines need not worry about missing edge blocks. */ coef_arrays = (jvirt_barray_ptr *) (*srcinfo->mem->alloc_small) ((j_common_ptr) srcinfo, JPOOL_IMAGE, SIZEOF(jvirt_barray_ptr) * info->num_components); for (ci = 0; ci < info->num_components; ci++) { compptr = srcinfo->comp_info + ci; coef_arrays[ci] = (*srcinfo->mem->request_virt_barray) ((j_common_ptr) srcinfo, JPOOL_IMAGE, FALSE, (JDIMENSION) jround_up((long) compptr->width_in_data_units, (long) compptr->h_samp_factor), (JDIMENSION) jround_up((long) compptr->height_in_data_units, (long) compptr->v_samp_factor), (JDIMENSION) compptr->v_samp_factor); } break; case JXFORM_TRANSPOSE: case JXFORM_TRANSVERSE: case JXFORM_ROT_90: case JXFORM_ROT_270: /* Need workspace arrays having transposed dimensions. * Note that we allocate arrays padded out to the next iMCU boundary, * so that transform routines need not worry about missing edge blocks. */ coef_arrays = (jvirt_barray_ptr *) (*srcinfo->mem->alloc_small) ((j_common_ptr) srcinfo, JPOOL_IMAGE, SIZEOF(jvirt_barray_ptr) * info->num_components); for (ci = 0; ci < info->num_components; ci++) { compptr = srcinfo->comp_info + ci; coef_arrays[ci] = (*srcinfo->mem->request_virt_barray) ((j_common_ptr) srcinfo, JPOOL_IMAGE, FALSE, (JDIMENSION) jround_up((long) compptr->height_in_data_units, (long) compptr->v_samp_factor), (JDIMENSION) jround_up((long) compptr->width_in_data_units, (long) compptr->h_samp_factor), (JDIMENSION) compptr->h_samp_factor); } break; } info->workspace_coef_arrays = coef_arrays; } /* Transpose destination image parameters */ LOCAL(void) transpose_critical_parameters (j_compress_ptr dstinfo) { int tblno, i, j, ci, itemp; jpeg_component_info *compptr; JQUANT_TBL *qtblptr; JDIMENSION dtemp; UINT16 qtemp; /* Transpose basic image dimensions */ dtemp = dstinfo->image_width; dstinfo->image_width = dstinfo->image_height; dstinfo->image_height = dtemp; /* Transpose sampling factors */ for (ci = 0; ci < dstinfo->num_components; ci++) { compptr = dstinfo->comp_info + ci; itemp = compptr->h_samp_factor; compptr->h_samp_factor = compptr->v_samp_factor; compptr->v_samp_factor = itemp; } /* Transpose quantization tables */ for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) { qtblptr = dstinfo->quant_tbl_ptrs[tblno]; if (qtblptr != NULL) { for (i = 0; i < DCTSIZE; i++) { for (j = 0; j < i; j++) { qtemp = qtblptr->quantval[i*DCTSIZE+j]; qtblptr->quantval[i*DCTSIZE+j] = qtblptr->quantval[j*DCTSIZE+i]; qtblptr->quantval[j*DCTSIZE+i] = qtemp; } } } } } /* Trim off any partial iMCUs on the indicated destination edge */ LOCAL(void) trim_right_edge (j_compress_ptr dstinfo) { int ci, max_h_samp_factor; JDIMENSION MCU_cols; /* We have to compute max_h_samp_factor ourselves, * because it hasn't been set yet in the destination * (and we don't want to use the source's value). */ max_h_samp_factor = 1; for (ci = 0; ci < dstinfo->num_components; ci++) { int h_samp_factor = dstinfo->comp_info[ci].h_samp_factor; max_h_samp_factor = MAX(max_h_samp_factor, h_samp_factor); } MCU_cols = dstinfo->image_width / (max_h_samp_factor * DCTSIZE); if (MCU_cols > 0) /* can't trim to 0 pixels */ dstinfo->image_width = MCU_cols * (max_h_samp_factor * DCTSIZE); } LOCAL(void) trim_bottom_edge (j_compress_ptr dstinfo) { int ci, max_v_samp_factor; JDIMENSION MCU_rows; /* We have to compute max_v_samp_factor ourselves, * because it hasn't been set yet in the destination * (and we don't want to use the source's value). */ max_v_samp_factor = 1; for (ci = 0; ci < dstinfo->num_components; ci++) { int v_samp_factor = dstinfo->comp_info[ci].v_samp_factor; max_v_samp_factor = MAX(max_v_samp_factor, v_samp_factor); } MCU_rows = dstinfo->image_height / (max_v_samp_factor * DCTSIZE); if (MCU_rows > 0) /* can't trim to 0 pixels */ dstinfo->image_height = MCU_rows * (max_v_samp_factor * DCTSIZE); } /* Adjust output image parameters as needed. * * This must be called after jpeg_copy_critical_parameters() * and before jpeg_write_coefficients(). * * The return value is the set of virtual coefficient arrays to be written * (either the ones allocated by jtransform_request_workspace, or the * original source data arrays). The caller will need to pass this value * to jpeg_write_coefficients(). */ GLOBAL(jvirt_barray_ptr *) jtransform_adjust_parameters (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, jvirt_barray_ptr *src_coef_arrays, jpeg_transform_info *info) { #ifdef __GNUC__ (void)srcinfo; /* silence compiler. */ #endif /* If force-to-grayscale is requested, adjust destination parameters */ if (info->force_grayscale) { /* We use jpeg_set_colorspace to make sure subsidiary settings get fixed * properly. Among other things, the target h_samp_factor & v_samp_factor * will get set to 1, which typically won't match the source. * In fact we do this even if the source is already grayscale; that * provides an easy way of coercing a grayscale JPEG with funny sampling * factors to the customary 1,1. (Some decoders fail on other factors.) */ if ((dstinfo->jpeg_color_space == JCS_YCbCr && dstinfo->num_components == 3) || (dstinfo->jpeg_color_space == JCS_GRAYSCALE && dstinfo->num_components == 1)) { /* We have to preserve the source's quantization table number. */ int sv_quant_tbl_no = dstinfo->comp_info[0].quant_tbl_no; jpeg_set_colorspace(dstinfo, JCS_GRAYSCALE); dstinfo->comp_info[0].quant_tbl_no = sv_quant_tbl_no; } else { /* Sorry, can't do it */ ERREXIT(dstinfo, JERR_CONVERSION_NOTIMPL); } } /* Correct the destination's image dimensions etc if necessary */ switch (info->transform) { case JXFORM_NONE: /* Nothing to do */ break; case JXFORM_FLIP_H: if (info->trim) trim_right_edge(dstinfo); break; case JXFORM_FLIP_V: if (info->trim) trim_bottom_edge(dstinfo); break; case JXFORM_TRANSPOSE: transpose_critical_parameters(dstinfo); /* transpose does NOT have to trim anything */ break; case JXFORM_TRANSVERSE: transpose_critical_parameters(dstinfo); if (info->trim) { trim_right_edge(dstinfo); trim_bottom_edge(dstinfo); } break; case JXFORM_ROT_90: transpose_critical_parameters(dstinfo); if (info->trim) trim_right_edge(dstinfo); break; case JXFORM_ROT_180: if (info->trim) { trim_right_edge(dstinfo); trim_bottom_edge(dstinfo); } break; case JXFORM_ROT_270: transpose_critical_parameters(dstinfo); if (info->trim) trim_bottom_edge(dstinfo); break; } /* Return the appropriate output data set */ if (info->workspace_coef_arrays != NULL) return info->workspace_coef_arrays; return src_coef_arrays; } /* Execute the actual transformation, if any. * * This must be called *after* jpeg_write_coefficients, because it depends * on jpeg_write_coefficients to have computed subsidiary values such as * the per-component width and height fields in the destination object. * * Note that some transformations will modify the source data arrays! */ GLOBAL(void) jtransform_execute_transformation (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, jvirt_barray_ptr *src_coef_arrays, jpeg_transform_info *info) { jvirt_barray_ptr *dst_coef_arrays = info->workspace_coef_arrays; switch (info->transform) { case JXFORM_NONE: break; case JXFORM_FLIP_H: do_flip_h(srcinfo, dstinfo, src_coef_arrays); break; case JXFORM_FLIP_V: do_flip_v(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays); break; case JXFORM_TRANSPOSE: do_transpose(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays); break; case JXFORM_TRANSVERSE: do_transverse(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays); break; case JXFORM_ROT_90: do_rot_90(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays); break; case JXFORM_ROT_180: do_rot_180(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays); break; case JXFORM_ROT_270: do_rot_270(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays); break; } } #endif /* TRANSFORMS_SUPPORTED */ /* Setup decompression object to save desired markers in memory. * This must be called before jpeg_read_header() to have the desired effect. */ GLOBAL(void) jcopy_markers_setup (j_decompress_ptr srcinfo, JCOPY_OPTION option) { #ifdef SAVE_MARKERS_SUPPORTED int m; /* Save comments except under NONE option */ if (option != JCOPYOPT_NONE) { jpeg_save_markers(srcinfo, JPEG_COM, 0xFFFF); } /* Save all types of APPn markers iff ALL option */ if (option == JCOPYOPT_ALL) { for (m = 0; m < 16; m++) jpeg_save_markers(srcinfo, JPEG_APP0 + m, 0xFFFF); } #endif /* SAVE_MARKERS_SUPPORTED */ } /* Copy markers saved in the given source object to the destination object. * This should be called just after jpeg_start_compress() or * jpeg_write_coefficients(). * Note that those routines will have written the SOI, and also the * JFIF APP0 or Adobe APP14 markers if selected. */ GLOBAL(void) jcopy_markers_execute (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, JCOPY_OPTION option) { #ifdef __GNUC__ (void)option; /* silence compiler. */ #endif jpeg_saved_marker_ptr marker; /* In the current implementation, we don't actually need to examine the * option flag here; we just copy everything that got saved. * But to avoid confusion, we do not output JFIF and Adobe APP14 markers * if the encoder library already wrote one. */ for (marker = srcinfo->marker_list; marker != NULL; marker = marker->next) { if (dstinfo->write_JFIF_header && marker->marker == JPEG_APP0 && marker->data_length >= 5 && GETJOCTET(marker->data[0]) == 0x4A && GETJOCTET(marker->data[1]) == 0x46 && GETJOCTET(marker->data[2]) == 0x49 && GETJOCTET(marker->data[3]) == 0x46 && GETJOCTET(marker->data[4]) == 0) continue; /* reject duplicate JFIF */ if (dstinfo->write_Adobe_marker && marker->marker == JPEG_APP0+14 && marker->data_length >= 5 && GETJOCTET(marker->data[0]) == 0x41 && GETJOCTET(marker->data[1]) == 0x64 && GETJOCTET(marker->data[2]) == 0x6F && GETJOCTET(marker->data[3]) == 0x62 && GETJOCTET(marker->data[4]) == 0x65) continue; /* reject duplicate Adobe */ #ifdef NEED_FAR_POINTERS /* We could use jpeg_write_marker if the data weren't FAR... */ { unsigned int i; jpeg_write_m_header(dstinfo, marker->marker, marker->data_length); for (i = 0; i < marker->data_length; i++) jpeg_write_m_byte(dstinfo, marker->data[i]); } #else jpeg_write_marker(dstinfo, marker->marker, marker->data, marker->data_length); #endif } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jquant1.c������������������������������������������������0000644�0001750�0001750�00000075222�12320456500�021557� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jquant1.c * * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains 1-pass color quantization (color mapping) routines. * These routines provide mapping to a fixed color map using equally spaced * color values. Optional Floyd-Steinberg or ordered dithering is available. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #ifdef QUANT_1PASS_SUPPORTED /* * The main purpose of 1-pass quantization is to provide a fast, if not very * high quality, colormapped output capability. A 2-pass quantizer usually * gives better visual quality; however, for quantized grayscale output this * quantizer is perfectly adequate. Dithering is highly recommended with this * quantizer, though you can turn it off if you really want to. * * In 1-pass quantization the colormap must be chosen in advance of seeing the * image. We use a map consisting of all combinations of Ncolors[i] color * values for the i'th component. The Ncolors[] values are chosen so that * their product, the total number of colors, is no more than that requested. * (In most cases, the product will be somewhat less.) * * Since the colormap is orthogonal, the representative value for each color * component can be determined without considering the other components; * then these indexes can be combined into a colormap index by a standard * N-dimensional-array-subscript calculation. Most of the arithmetic involved * can be precalculated and stored in the lookup table colorindex[]. * colorindex[i][j] maps pixel value j in component i to the nearest * representative value (grid plane) for that component; this index is * multiplied by the array stride for component i, so that the * index of the colormap entry closest to a given pixel value is just * sum( colorindex[component-number][pixel-component-value] ) * Aside from being fast, this scheme allows for variable spacing between * representative values with no additional lookup cost. * * If gamma correction has been applied in color conversion, it might be wise * to adjust the color grid spacing so that the representative colors are * equidistant in linear space. At this writing, gamma correction is not * implemented by jdcolor, so nothing is done here. */ /* Declarations for ordered dithering. * * We use a standard 16x16 ordered dither array. The basic concept of ordered * dithering is described in many references, for instance Dale Schumacher's * chapter II.2 of Graphics Gems II (James Arvo, ed. Academic Press, 1991). * In place of Schumacher's comparisons against a "threshold" value, we add a * "dither" value to the input pixel and then round the result to the nearest * output value. The dither value is equivalent to (0.5 - threshold) times * the distance between output values. For ordered dithering, we assume that * the output colors are equally spaced; if not, results will probably be * worse, since the dither may be too much or too little at a given point. * * The normal calculation would be to form pixel value + dither, range-limit * this to 0..MAXJSAMPLE, and then index into the colorindex table as usual. * We can skip the separate range-limiting step by extending the colorindex * table in both directions. */ #define ODITHER_SIZE 16 /* dimension of dither matrix */ /* NB: if ODITHER_SIZE is not a power of 2, ODITHER_MASK uses will break */ #define ODITHER_CELLS (ODITHER_SIZE*ODITHER_SIZE) /* # cells in matrix */ #define ODITHER_MASK (ODITHER_SIZE-1) /* mask for wrapping around counters */ typedef int ODITHER_MATRIX[ODITHER_SIZE][ODITHER_SIZE]; typedef int (*ODITHER_MATRIX_PTR)[ODITHER_SIZE]; static const UINT8 base_dither_matrix[ODITHER_SIZE][ODITHER_SIZE] = { /* Bayer's order-4 dither array. Generated by the code given in * Stephen Hawley's article "Ordered Dithering" in Graphics Gems I. * The values in this array must range from 0 to ODITHER_CELLS-1. */ { 0,192, 48,240, 12,204, 60,252, 3,195, 51,243, 15,207, 63,255 }, { 128, 64,176,112,140, 76,188,124,131, 67,179,115,143, 79,191,127 }, { 32,224, 16,208, 44,236, 28,220, 35,227, 19,211, 47,239, 31,223 }, { 160, 96,144, 80,172,108,156, 92,163, 99,147, 83,175,111,159, 95 }, { 8,200, 56,248, 4,196, 52,244, 11,203, 59,251, 7,199, 55,247 }, { 136, 72,184,120,132, 68,180,116,139, 75,187,123,135, 71,183,119 }, { 40,232, 24,216, 36,228, 20,212, 43,235, 27,219, 39,231, 23,215 }, { 168,104,152, 88,164,100,148, 84,171,107,155, 91,167,103,151, 87 }, { 2,194, 50,242, 14,206, 62,254, 1,193, 49,241, 13,205, 61,253 }, { 130, 66,178,114,142, 78,190,126,129, 65,177,113,141, 77,189,125 }, { 34,226, 18,210, 46,238, 30,222, 33,225, 17,209, 45,237, 29,221 }, { 162, 98,146, 82,174,110,158, 94,161, 97,145, 81,173,109,157, 93 }, { 10,202, 58,250, 6,198, 54,246, 9,201, 57,249, 5,197, 53,245 }, { 138, 74,186,122,134, 70,182,118,137, 73,185,121,133, 69,181,117 }, { 42,234, 26,218, 38,230, 22,214, 41,233, 25,217, 37,229, 21,213 }, { 170,106,154, 90,166,102,150, 86,169,105,153, 89,165,101,149, 85 } }; /* Declarations for Floyd-Steinberg dithering. * * Errors are accumulated into the array fserrors[], at a resolution of * 1/16th of a pixel count. The error at a given pixel is propagated * to its not-yet-processed neighbors using the standard F-S fractions, * ... (here) 7/16 * 3/16 5/16 1/16 * We work left-to-right on even rows, right-to-left on odd rows. * * We can get away with a single array (holding one row's worth of errors) * by using it to store the current row's errors at pixel columns not yet * processed, but the next row's errors at columns already processed. We * need only a few extra variables to hold the errors immediately around the * current column. (If we are lucky, those variables are in registers, but * even if not, they're probably cheaper to access than array elements are.) * * The fserrors[] array is indexed [component#][position]. * We provide (#columns + 2) entries per component; the extra entry at each * end saves us from special-casing the first and last pixels. * * Note: on a wide image, we might not have enough room in a PC's near data * segment to hold the error array; so it is allocated with alloc_large. */ #if BITS_IN_JSAMPLE == 8 typedef INT16 FSERROR; /* 16 bits should be enough */ typedef int LOCFSERROR; /* use 'int' for calculation temps */ #else typedef INT32 FSERROR; /* may need more than 16 bits */ typedef INT32 LOCFSERROR; /* be sure calculation temps are big enough */ #endif typedef FSERROR FAR *FSERRPTR; /* pointer to error array (in FAR storage!) */ /* Private subobject */ #define MAX_Q_COMPS 4 /* max components I can handle */ typedef struct { struct jpeg_color_quantizer pub; /* public fields */ /* Initially allocated colormap is saved here */ JSAMPARRAY sv_colormap; /* The color map as a 2-D pixel array */ int sv_actual; /* number of entries in use */ JSAMPARRAY colorindex; /* Precomputed mapping for speed */ /* colorindex[i][j] = index of color closest to pixel value j in component i, * premultiplied as described above. Since colormap indexes must fit into * JSAMPLEs, the entries of this array will too. */ boolean is_padded; /* is the colorindex padded for odither? */ int Ncolors[MAX_Q_COMPS]; /* # of values alloced to each component */ /* Variables for ordered dithering */ int row_index; /* cur row's vertical index in dither matrix */ ODITHER_MATRIX_PTR odither[MAX_Q_COMPS]; /* one dither array per component */ /* Variables for Floyd-Steinberg dithering */ FSERRPTR fserrors[MAX_Q_COMPS]; /* accumulated errors */ boolean on_odd_row; /* flag to remember which row we are on */ } my_cquantizer; typedef my_cquantizer * my_cquantize_ptr; /* * Policy-making subroutines for create_colormap and create_colorindex. * These routines determine the colormap to be used. The rest of the module * only assumes that the colormap is orthogonal. * * * select_ncolors decides how to divvy up the available colors * among the components. * * output_value defines the set of representative values for a component. * * largest_input_value defines the mapping from input values to * representative values for a component. * Note that the latter two routines may impose different policies for * different components, though this is not currently done. */ LOCAL(int) select_ncolors (j_decompress_ptr cinfo, int Ncolors[]) /* Determine allocation of desired colors to components, */ /* and fill in Ncolors[] array to indicate choice. */ /* Return value is total number of colors (product of Ncolors[] values). */ { int nc = cinfo->out_color_components; /* number of color components */ int max_colors = cinfo->desired_number_of_colors; int total_colors, iroot, i, j; boolean changed; long temp; static const int RGB_order[3] = { RGB_GREEN, RGB_RED, RGB_BLUE }; /* We can allocate at least the nc'th root of max_colors per component. */ /* Compute floor(nc'th root of max_colors). */ iroot = 1; do { iroot++; temp = iroot; /* set temp = iroot ** nc */ for (i = 1; i < nc; i++) temp *= iroot; } while (temp <= (long) max_colors); /* repeat till iroot exceeds root */ iroot--; /* now iroot = floor(root) */ /* Must have at least 2 color values per component */ if (iroot < 2) ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, (int) temp); /* Initialize to iroot color values for each component */ total_colors = 1; for (i = 0; i < nc; i++) { Ncolors[i] = iroot; total_colors *= iroot; } /* We may be able to increment the count for one or more components without * exceeding max_colors, though we know not all can be incremented. * Sometimes, the first component can be incremented more than once! * (Example: for 16 colors, we start at 2*2*2, go to 3*2*2, then 4*2*2.) * In RGB colorspace, try to increment G first, then R, then B. */ do { changed = FALSE; for (i = 0; i < nc; i++) { j = (cinfo->out_color_space == JCS_RGB ? RGB_order[i] : i); /* calculate new total_colors if Ncolors[j] is incremented */ temp = total_colors / Ncolors[j]; temp *= Ncolors[j]+1; /* done in long arith to avoid oflo */ if (temp > (long) max_colors) break; /* won't fit, done with this pass */ Ncolors[j]++; /* OK, apply the increment */ total_colors = (int) temp; changed = TRUE; } } while (changed); return total_colors; } LOCAL(int) output_value (j_decompress_ptr cinfo, int ci, int j, int maxj) /* Return j'th output value, where j will range from 0 to maxj */ /* The output values must fall in 0..MAXJSAMPLE in increasing order */ { (void)cinfo;(void)ci; /* We always provide values 0 and MAXJSAMPLE for each component; * any additional values are equally spaced between these limits. * (Forcing the upper and lower values to the limits ensures that * dithering can't produce a color outside the selected gamut.) */ return (int) (((INT32) j * MAXJSAMPLE + maxj/2) / maxj); } LOCAL(int) largest_input_value (j_decompress_ptr cinfo, int ci, int j, int maxj) /* Return largest input value that should map to j'th output value */ /* Must have largest(j=0) >= 0, and largest(j=maxj) >= MAXJSAMPLE */ { (void)cinfo;(void)ci; /* Breakpoints are halfway between values returned by output_value */ return (int) (((INT32) (2*j + 1) * MAXJSAMPLE + maxj) / (2*maxj)); } /* * Create the colormap. */ LOCAL(void) create_colormap (j_decompress_ptr cinfo) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; JSAMPARRAY colormap; /* Created colormap */ int total_colors; /* Number of distinct output colors */ int i,j,k, nci, blksize, blkdist, ptr, val; /* Select number of colors for each component */ total_colors = select_ncolors(cinfo, cquantize->Ncolors); /* Report selected color counts */ if (cinfo->out_color_components == 3) TRACEMS4(cinfo, 1, JTRC_QUANT_3_NCOLORS, total_colors, cquantize->Ncolors[0], cquantize->Ncolors[1], cquantize->Ncolors[2]); else TRACEMS1(cinfo, 1, JTRC_QUANT_NCOLORS, total_colors); /* Allocate and fill in the colormap. */ /* The colors are ordered in the map in standard row-major order, */ /* i.e. rightmost (highest-indexed) color changes most rapidly. */ colormap = (*cinfo->mem->alloc_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, (JDIMENSION) total_colors, (JDIMENSION) cinfo->out_color_components); /* blksize is number of adjacent repeated entries for a component */ /* blkdist is distance between groups of identical entries for a component */ blkdist = total_colors; for (i = 0; i < cinfo->out_color_components; i++) { /* fill in colormap entries for i'th color component */ nci = cquantize->Ncolors[i]; /* # of distinct values for this color */ blksize = blkdist / nci; for (j = 0; j < nci; j++) { /* Compute j'th output value (out of nci) for component */ val = output_value(cinfo, i, j, nci-1); /* Fill in all colormap entries that have this value of this component */ for (ptr = j * blksize; ptr < total_colors; ptr += blkdist) { /* fill in blksize entries beginning at ptr */ for (k = 0; k < blksize; k++) colormap[i][ptr+k] = (JSAMPLE) val; } } blkdist = blksize; /* blksize of this color is blkdist of next */ } /* Save the colormap in private storage, * where it will survive color quantization mode changes. */ cquantize->sv_colormap = colormap; cquantize->sv_actual = total_colors; } /* * Create the color index table. */ LOCAL(void) create_colorindex (j_decompress_ptr cinfo) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; JSAMPROW indexptr; int i,j,k, nci, blksize, val, pad; /* For ordered dither, we pad the color index tables by MAXJSAMPLE in * each direction (input index values can be -MAXJSAMPLE .. 2*MAXJSAMPLE). * This is not necessary in the other dithering modes. However, we * flag whether it was done in case user changes dithering mode. */ if (cinfo->dither_mode == JDITHER_ORDERED) { pad = MAXJSAMPLE*2; cquantize->is_padded = TRUE; } else { pad = 0; cquantize->is_padded = FALSE; } cquantize->colorindex = (*cinfo->mem->alloc_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, (JDIMENSION) (MAXJSAMPLE+1 + pad), (JDIMENSION) cinfo->out_color_components); /* blksize is number of adjacent repeated entries for a component */ blksize = cquantize->sv_actual; for (i = 0; i < cinfo->out_color_components; i++) { /* fill in colorindex entries for i'th color component */ nci = cquantize->Ncolors[i]; /* # of distinct values for this color */ blksize = blksize / nci; /* adjust colorindex pointers to provide padding at negative indexes. */ if (pad) cquantize->colorindex[i] += MAXJSAMPLE; /* in loop, val = index of current output value, */ /* and k = largest j that maps to current val */ indexptr = cquantize->colorindex[i]; val = 0; k = largest_input_value(cinfo, i, 0, nci-1); for (j = 0; j <= MAXJSAMPLE; j++) { while (j > k) /* advance val if past boundary */ k = largest_input_value(cinfo, i, ++val, nci-1); /* premultiply so that no multiplication needed in main processing */ indexptr[j] = (JSAMPLE) (val * blksize); } /* Pad at both ends if necessary */ if (pad) for (j = 1; j <= MAXJSAMPLE; j++) { indexptr[-j] = indexptr[0]; indexptr[MAXJSAMPLE+j] = indexptr[MAXJSAMPLE]; } } } /* * Create an ordered-dither array for a component having ncolors * distinct output values. */ LOCAL(ODITHER_MATRIX_PTR) make_odither_array (j_decompress_ptr cinfo, int ncolors) { ODITHER_MATRIX_PTR odither; int j,k; INT32 num,den; odither = (ODITHER_MATRIX_PTR) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(ODITHER_MATRIX)); /* The inter-value distance for this color is MAXJSAMPLE/(ncolors-1). * Hence the dither value for the matrix cell with fill order f * (f=0..N-1) should be (N-1-2*f)/(2*N) * MAXJSAMPLE/(ncolors-1). * On 16-bit-int machine, be careful to avoid overflow. */ den = 2 * ODITHER_CELLS * ((INT32) (ncolors - 1)); for (j = 0; j < ODITHER_SIZE; j++) { for (k = 0; k < ODITHER_SIZE; k++) { num = ((INT32) (ODITHER_CELLS-1 - 2*((int)base_dither_matrix[j][k]))) * MAXJSAMPLE; /* Ensure round towards zero despite C's lack of consistency * about rounding negative values in integer division... */ odither[j][k] = (int) (num<0 ? -((-num)/den) : num/den); } } return odither; } /* * Create the ordered-dither tables. * Components having the same number of representative colors may * share a dither table. */ LOCAL(void) create_odither_tables (j_decompress_ptr cinfo) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; ODITHER_MATRIX_PTR odither; int i, j, nci; for (i = 0; i < cinfo->out_color_components; i++) { nci = cquantize->Ncolors[i]; /* # of distinct values for this color */ odither = NULL; /* search for matching prior component */ for (j = 0; j < i; j++) { if (nci == cquantize->Ncolors[j]) { odither = cquantize->odither[j]; break; } } if (odither == NULL) /* need a new table? */ odither = make_odither_array(cinfo, nci); cquantize->odither[i] = odither; } } /* * Map some rows of pixels to the output colormapped representation. */ METHODDEF(void) color_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) /* General case, no dithering */ { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; JSAMPARRAY colorindex = cquantize->colorindex; register int pixcode, ci; register JSAMPROW ptrin, ptrout; int row; JDIMENSION col; JDIMENSION width = cinfo->output_width; register int nc = cinfo->out_color_components; for (row = 0; row < num_rows; row++) { ptrin = input_buf[row]; ptrout = output_buf[row]; for (col = width; col > 0; col--) { pixcode = 0; for (ci = 0; ci < nc; ci++) { pixcode += GETJSAMPLE(colorindex[ci][GETJSAMPLE(*ptrin++)]); } *ptrout++ = (JSAMPLE) pixcode; } } } METHODDEF(void) color_quantize3 (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) /* Fast path for out_color_components==3, no dithering */ { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; register int pixcode; register JSAMPROW ptrin, ptrout; JSAMPROW colorindex0 = cquantize->colorindex[0]; JSAMPROW colorindex1 = cquantize->colorindex[1]; JSAMPROW colorindex2 = cquantize->colorindex[2]; int row; JDIMENSION col; JDIMENSION width = cinfo->output_width; for (row = 0; row < num_rows; row++) { ptrin = input_buf[row]; ptrout = output_buf[row]; for (col = width; col > 0; col--) { pixcode = GETJSAMPLE(colorindex0[GETJSAMPLE(*ptrin++)]); pixcode += GETJSAMPLE(colorindex1[GETJSAMPLE(*ptrin++)]); pixcode += GETJSAMPLE(colorindex2[GETJSAMPLE(*ptrin++)]); *ptrout++ = (JSAMPLE) pixcode; } } } METHODDEF(void) quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) /* General case, with ordered dithering */ { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; register JSAMPROW input_ptr; register JSAMPROW output_ptr; JSAMPROW colorindex_ci; int * dither; /* points to active row of dither matrix */ int row_index, col_index; /* current indexes into dither matrix */ int nc = cinfo->out_color_components; int ci; int row; JDIMENSION col; JDIMENSION width = cinfo->output_width; for (row = 0; row < num_rows; row++) { /* Initialize output values to 0 so can process components separately */ jzero_far((void FAR *) output_buf[row], (size_t) (width * SIZEOF(JSAMPLE))); row_index = cquantize->row_index; for (ci = 0; ci < nc; ci++) { input_ptr = input_buf[row] + ci; output_ptr = output_buf[row]; colorindex_ci = cquantize->colorindex[ci]; dither = cquantize->odither[ci][row_index]; col_index = 0; for (col = width; col > 0; col--) { /* Form pixel value + dither, range-limit to 0..MAXJSAMPLE, * select output value, accumulate into output code for this pixel. * Range-limiting need not be done explicitly, as we have extended * the colorindex table to produce the right answers for out-of-range * inputs. The maximum dither is +- MAXJSAMPLE; this sets the * required amount of padding. */ *output_ptr += colorindex_ci[GETJSAMPLE(*input_ptr)+dither[col_index]]; input_ptr += nc; output_ptr++; col_index = (col_index + 1) & ODITHER_MASK; } } /* Advance row index for next row */ row_index = (row_index + 1) & ODITHER_MASK; cquantize->row_index = row_index; } } METHODDEF(void) quantize3_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) /* Fast path for out_color_components==3, with ordered dithering */ { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; register int pixcode; register JSAMPROW input_ptr; register JSAMPROW output_ptr; JSAMPROW colorindex0 = cquantize->colorindex[0]; JSAMPROW colorindex1 = cquantize->colorindex[1]; JSAMPROW colorindex2 = cquantize->colorindex[2]; int * dither0; /* points to active row of dither matrix */ int * dither1; int * dither2; int row_index, col_index; /* current indexes into dither matrix */ int row; JDIMENSION col; JDIMENSION width = cinfo->output_width; for (row = 0; row < num_rows; row++) { row_index = cquantize->row_index; input_ptr = input_buf[row]; output_ptr = output_buf[row]; dither0 = cquantize->odither[0][row_index]; dither1 = cquantize->odither[1][row_index]; dither2 = cquantize->odither[2][row_index]; col_index = 0; for (col = width; col > 0; col--) { pixcode = GETJSAMPLE(colorindex0[GETJSAMPLE(*input_ptr++) + dither0[col_index]]); pixcode += GETJSAMPLE(colorindex1[GETJSAMPLE(*input_ptr++) + dither1[col_index]]); pixcode += GETJSAMPLE(colorindex2[GETJSAMPLE(*input_ptr++) + dither2[col_index]]); *output_ptr++ = (JSAMPLE) pixcode; col_index = (col_index + 1) & ODITHER_MASK; } row_index = (row_index + 1) & ODITHER_MASK; cquantize->row_index = row_index; } } METHODDEF(void) quantize_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) /* General case, with Floyd-Steinberg dithering */ { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; register LOCFSERROR cur; /* current error or pixel value */ LOCFSERROR belowerr; /* error for pixel below cur */ LOCFSERROR bpreverr; /* error for below/prev col */ LOCFSERROR bnexterr; /* error for below/next col */ LOCFSERROR delta; register FSERRPTR errorptr; /* => fserrors[] at column before current */ register JSAMPROW input_ptr; register JSAMPROW output_ptr; JSAMPROW colorindex_ci; JSAMPROW colormap_ci; int pixcode; int nc = cinfo->out_color_components; int dir; /* 1 for left-to-right, -1 for right-to-left */ int dirnc; /* dir * nc */ int ci; int row; JDIMENSION col; JDIMENSION width = cinfo->output_width; JSAMPLE *range_limit = cinfo->sample_range_limit; SHIFT_TEMPS for (row = 0; row < num_rows; row++) { /* Initialize output values to 0 so can process components separately */ jzero_far((void FAR *) output_buf[row], (size_t) (width * SIZEOF(JSAMPLE))); for (ci = 0; ci < nc; ci++) { input_ptr = input_buf[row] + ci; output_ptr = output_buf[row]; if (cquantize->on_odd_row) { /* work right to left in this row */ input_ptr += (width-1) * nc; /* so point to rightmost pixel */ output_ptr += width-1; dir = -1; dirnc = -nc; errorptr = cquantize->fserrors[ci] + (width+1); /* => entry after last column */ } else { /* work left to right in this row */ dir = 1; dirnc = nc; errorptr = cquantize->fserrors[ci]; /* => entry before first column */ } colorindex_ci = cquantize->colorindex[ci]; colormap_ci = cquantize->sv_colormap[ci]; /* Preset error values: no error propagated to first pixel from left */ cur = 0; /* and no error propagated to row below yet */ belowerr = bpreverr = 0; for (col = width; col > 0; col--) { /* cur holds the error propagated from the previous pixel on the * current line. Add the error propagated from the previous line * to form the complete error correction term for this pixel, and * round the error term (which is expressed * 16) to an integer. * RIGHT_SHIFT rounds towards minus infinity, so adding 8 is correct * for either sign of the error value. * Note: errorptr points to *previous* column's array entry. */ cur = RIGHT_SHIFT(cur + errorptr[dir] + 8, 4); /* Form pixel value + error, and range-limit to 0..MAXJSAMPLE. * The maximum error is +- MAXJSAMPLE; this sets the required size * of the range_limit array. */ cur += GETJSAMPLE(*input_ptr); cur = GETJSAMPLE(range_limit[cur]); /* Select output value, accumulate into output code for this pixel */ pixcode = GETJSAMPLE(colorindex_ci[cur]); *output_ptr += (JSAMPLE) pixcode; /* Compute actual representation error at this pixel */ /* Note: we can do this even though we don't have the final */ /* pixel code, because the colormap is orthogonal. */ cur -= GETJSAMPLE(colormap_ci[pixcode]); /* Compute error fractions to be propagated to adjacent pixels. * Add these into the running sums, and simultaneously shift the * next-line error sums left by 1 column. */ bnexterr = cur; delta = cur * 2; cur += delta; /* form error * 3 */ errorptr[0] = (FSERROR) (bpreverr + cur); cur += delta; /* form error * 5 */ bpreverr = belowerr + cur; belowerr = bnexterr; cur += delta; /* form error * 7 */ /* At this point cur contains the 7/16 error value to be propagated * to the next pixel on the current line, and all the errors for the * next line have been shifted over. We are therefore ready to move on. */ input_ptr += dirnc; /* advance input ptr to next column */ output_ptr += dir; /* advance output ptr to next column */ errorptr += dir; /* advance errorptr to current column */ } /* Post-loop cleanup: we must unload the final error value into the * final fserrors[] entry. Note we need not unload belowerr because * it is for the dummy column before or after the actual array. */ errorptr[0] = (FSERROR) bpreverr; /* unload prev err into array */ } cquantize->on_odd_row = (cquantize->on_odd_row ? FALSE : TRUE); } } /* * Allocate workspace for Floyd-Steinberg errors. */ LOCAL(void) alloc_fs_workspace (j_decompress_ptr cinfo) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; size_t arraysize; int i; arraysize = (size_t) ((cinfo->output_width + 2) * SIZEOF(FSERROR)); for (i = 0; i < cinfo->out_color_components; i++) { cquantize->fserrors[i] = (FSERRPTR) (*cinfo->mem->alloc_large)((j_common_ptr) cinfo, JPOOL_IMAGE, arraysize); } } /* * Initialize for one-pass color quantization. */ METHODDEF(void) start_pass_1_quant (j_decompress_ptr cinfo, boolean is_pre_scan) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; size_t arraysize; int i; (void)is_pre_scan; /* Install my colormap. */ cinfo->colormap = cquantize->sv_colormap; cinfo->actual_number_of_colors = cquantize->sv_actual; /* Initialize for desired dithering mode. */ switch (cinfo->dither_mode) { case JDITHER_NONE: if (cinfo->out_color_components == 3) cquantize->pub.color_quantize = color_quantize3; else cquantize->pub.color_quantize = color_quantize; break; case JDITHER_ORDERED: if (cinfo->out_color_components == 3) cquantize->pub.color_quantize = quantize3_ord_dither; else cquantize->pub.color_quantize = quantize_ord_dither; cquantize->row_index = 0; /* initialize state for ordered dither */ /* If user changed to ordered dither from another mode, * we must recreate the color index table with padding. * This will cost extra space, but probably isn't very likely. */ if (! cquantize->is_padded) create_colorindex(cinfo); /* Create ordered-dither tables if we didn't already. */ if (cquantize->odither[0] == NULL) create_odither_tables(cinfo); break; case JDITHER_FS: cquantize->pub.color_quantize = quantize_fs_dither; cquantize->on_odd_row = FALSE; /* initialize state for F-S dither */ /* Allocate Floyd-Steinberg workspace if didn't already. */ if (cquantize->fserrors[0] == NULL) alloc_fs_workspace(cinfo); /* Initialize the propagated errors to zero. */ arraysize = (size_t) ((cinfo->output_width + 2) * SIZEOF(FSERROR)); for (i = 0; i < cinfo->out_color_components; i++) jzero_far((void FAR *) cquantize->fserrors[i], arraysize); break; default: ERREXIT(cinfo, JERR_NOT_COMPILED); break; } } /* * Finish up at the end of the pass. */ METHODDEF(void) finish_pass_1_quant (j_decompress_ptr cinfo) { (void)cinfo; /* no work in 1-pass case */ } /* * Switch to a new external colormap between output passes. * Shouldn't get to this module! */ METHODDEF(void) new_color_map_1_quant (j_decompress_ptr cinfo) { ERREXIT(cinfo, JERR_MODE_CHANGE); } /* * Module initialization routine for 1-pass color quantization. */ GLOBAL(void) jinit_1pass_quantizer (j_decompress_ptr cinfo) { my_cquantize_ptr cquantize; cquantize = (my_cquantize_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_cquantizer)); cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize; cquantize->pub.start_pass = start_pass_1_quant; cquantize->pub.finish_pass = finish_pass_1_quant; cquantize->pub.new_color_map = new_color_map_1_quant; cquantize->fserrors[0] = NULL; /* Flag FS workspace not allocated */ cquantize->odither[0] = NULL; /* Also flag odither arrays not allocated */ /* Make sure my internal arrays won't overflow */ if (cinfo->out_color_components > MAX_Q_COMPS) ERREXIT1(cinfo, JERR_QUANT_COMPONENTS, MAX_Q_COMPS); /* Make sure colormap indexes can be represented by JSAMPLEs */ if (cinfo->desired_number_of_colors > (MAXJSAMPLE+1)) ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXJSAMPLE+1); /* Create the colormap and color index table. */ create_colormap(cinfo); create_colorindex(cinfo); /* Allocate Floyd-Steinberg workspace now if requested. * We do this now since it is FAR storage and may affect the memory * manager's space calculations. If the user changes to FS dither * mode in a later pass, we will allocate the space then, and will * possibly overrun the max_memory_to_use setting. */ if (cinfo->dither_mode == JDITHER_FS) alloc_fs_workspace(cinfo); } #endif /* QUANT_1PASS_SUPPORTED */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jccoefct.c�����������������������������������������������0000644�0001750�0001750�00000040710�12320456500�021746� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jccoefct.c * * Copyright (C) 1994-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains the coefficient buffer controller for compression. * This controller is the top level of the JPEG compressor proper. * The coefficient buffer lies between forward-DCT and entropy encoding steps. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossy.h" /* Private declarations for lossy codec */ /* We use a full-image coefficient buffer when doing Huffman optimization, * and also for writing multiple-scan JPEG files. In all cases, the DCT * step is run during the first pass, and subsequent passes need only read * the buffered coefficients. */ #ifdef ENTROPY_OPT_SUPPORTED #define FULL_COEF_BUFFER_SUPPORTED #else #ifdef C_MULTISCAN_FILES_SUPPORTED #define FULL_COEF_BUFFER_SUPPORTED #endif #endif /* Private buffer controller object */ typedef struct { JDIMENSION iMCU_row_num; /* iMCU row # within image */ JDIMENSION mcu_ctr; /* counts MCUs processed in current row */ int MCU_vert_offset; /* counts MCU rows within iMCU row */ int MCU_rows_per_iMCU_row; /* number of such rows needed */ /* For single-pass compression, it's sufficient to buffer just one MCU * (although this may prove a bit slow in practice). We allocate a * workspace of C_MAX_DATA_UNITS_IN_MCU coefficient blocks, and reuse it for * each MCU constructed and sent. (On 80x86, the workspace is FAR even * though it's not really very big; this is to keep the module interfaces * unchanged when a large coefficient buffer is necessary.) * In multi-pass modes, this array points to the current MCU's blocks * within the virtual arrays. */ JBLOCKROW MCU_buffer[C_MAX_DATA_UNITS_IN_MCU]; /* In multi-pass modes, we need a virtual block array for each component. */ jvirt_barray_ptr whole_image[MAX_COMPONENTS]; } c_coef_controller; typedef c_coef_controller * c_coef_ptr; /* Forward declarations */ METHODDEF(boolean) compress_data JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf)); #ifdef FULL_COEF_BUFFER_SUPPORTED METHODDEF(boolean) compress_first_pass JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf)); METHODDEF(boolean) compress_output JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf)); #endif LOCAL(void) start_iMCU_row (j_compress_ptr cinfo) /* Reset within-iMCU-row counters for a new row */ { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; c_coef_ptr coef = (c_coef_ptr) lossyc->coef_private; /* In an interleaved scan, an MCU row is the same as an iMCU row. * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows. * But at the bottom of the image, process only what's left. */ if (cinfo->comps_in_scan > 1) { coef->MCU_rows_per_iMCU_row = 1; } else { if (coef->iMCU_row_num < (cinfo->total_iMCU_rows-1)) coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor; else coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height; } coef->mcu_ctr = 0; coef->MCU_vert_offset = 0; } /* * Initialize for a processing pass. */ METHODDEF(void) start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; c_coef_ptr coef = (c_coef_ptr) lossyc->coef_private; coef->iMCU_row_num = 0; start_iMCU_row(cinfo); switch (pass_mode) { case JBUF_PASS_THRU: if (coef->whole_image[0] != NULL) ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); lossyc->pub.compress_data = compress_data; break; #ifdef FULL_COEF_BUFFER_SUPPORTED case JBUF_SAVE_AND_PASS: if (coef->whole_image[0] == NULL) ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); lossyc->pub.compress_data = compress_first_pass; break; case JBUF_CRANK_DEST: if (coef->whole_image[0] == NULL) ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); lossyc->pub.compress_data = compress_output; break; #endif default: ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); break; } } /* * Process some data in the single-pass case. * We process the equivalent of one fully interleaved MCU row ("iMCU" row) * per call, ie, v_samp_factor block rows for each component in the image. * Returns TRUE if the iMCU row is completed, FALSE if suspended. * * NB: input_buf contains a plane for each component in image, * which we index according to the component's SOF position. */ METHODDEF(boolean) compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; c_coef_ptr coef = (c_coef_ptr) lossyc->coef_private; JDIMENSION MCU_col_num; /* index of current MCU within row */ JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1; JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; int blkn, bi, ci, yindex, yoffset, blockcnt; JDIMENSION ypos, xpos; jpeg_component_info *compptr; /* Loop to write as much as one whole iMCU row */ for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; yoffset++) { for (MCU_col_num = coef->mcu_ctr; MCU_col_num <= last_MCU_col; MCU_col_num++) { /* Determine where data comes from in input_buf and do the DCT thing. * Each call on forward_DCT processes a horizontal row of DCT blocks * as wide as an MCU; we rely on having allocated the MCU_buffer[] blocks * sequentially. Dummy blocks at the right or bottom edge are filled in * specially. The data in them does not matter for image reconstruction, * so we fill them with values that will encode to the smallest amount of * data, viz: all zeroes in the AC entries, DC entries equal to previous * block's DC value. (Thanks to Thomas Kinsman for this idea.) */ blkn = 0; for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width : compptr->last_col_width; xpos = MCU_col_num * compptr->MCU_sample_width; ypos = yoffset * DCTSIZE; /* ypos == (yoffset+yindex) * DCTSIZE */ for (yindex = 0; yindex < compptr->MCU_height; yindex++) { if (coef->iMCU_row_num < last_iMCU_row || yoffset+yindex < compptr->last_row_height) { (*lossyc->fdct_forward_DCT) (cinfo, compptr, input_buf[compptr->component_index], coef->MCU_buffer[blkn], ypos, xpos, (JDIMENSION) blockcnt); if (blockcnt < compptr->MCU_width) { /* Create some dummy blocks at the right edge of the image. */ jzero_far((void FAR *) coef->MCU_buffer[blkn + blockcnt], (compptr->MCU_width - blockcnt) * SIZEOF(JBLOCK)); for (bi = blockcnt; bi < compptr->MCU_width; bi++) { coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0]; } } } else { /* Create a row of dummy blocks at the bottom of the image. */ jzero_far((void FAR *) coef->MCU_buffer[blkn], compptr->MCU_width * SIZEOF(JBLOCK)); for (bi = 0; bi < compptr->MCU_width; bi++) { coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0]; } } blkn += compptr->MCU_width; ypos += DCTSIZE; } } /* Try to write the MCU. In event of a suspension failure, we will * re-DCT the MCU on restart (a bit inefficient, could be fixed...) */ if (! (*lossyc->entropy_encode_mcu) (cinfo, coef->MCU_buffer)) { /* Suspension forced; update state counters and exit */ coef->MCU_vert_offset = yoffset; coef->mcu_ctr = MCU_col_num; return FALSE; } } /* Completed an MCU row, but perhaps not an iMCU row */ coef->mcu_ctr = 0; } /* Completed the iMCU row, advance counters for next one */ coef->iMCU_row_num++; start_iMCU_row(cinfo); return TRUE; } #ifdef FULL_COEF_BUFFER_SUPPORTED /* * Process some data in the first pass of a multi-pass case. * We process the equivalent of one fully interleaved MCU row ("iMCU" row) * per call, ie, v_samp_factor block rows for each component in the image. * This amount of data is read from the source buffer, DCT'd and quantized, * and saved into the virtual arrays. We also generate suitable dummy blocks * as needed at the right and lower edges. (The dummy blocks are constructed * in the virtual arrays, which have been padded appropriately.) This makes * it possible for subsequent passes not to worry about real vs. dummy blocks. * * We must also emit the data to the entropy encoder. This is conveniently * done by calling compress_output() after we've loaded the current strip * of the virtual arrays. * * NB: input_buf contains a plane for each component in image. All * components are DCT'd and loaded into the virtual arrays in this pass. * However, it may be that only a subset of the components are emitted to * the entropy encoder during this first pass; be careful about looking * at the scan-dependent variables (MCU dimensions, etc). */ METHODDEF(boolean) compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; c_coef_ptr coef = (c_coef_ptr) lossyc->coef_private; JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; JDIMENSION blocks_across, MCUs_across, MCUindex; int bi, ci, h_samp_factor, block_row, block_rows, ndummy; JCOEF lastDC; jpeg_component_info *compptr; JBLOCKARRAY buffer; JBLOCKROW thisblockrow, lastblockrow; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { /* Align the virtual buffer for this component. */ buffer = (*cinfo->mem->access_virt_barray) ((j_common_ptr) cinfo, coef->whole_image[ci], coef->iMCU_row_num * compptr->v_samp_factor, (JDIMENSION) compptr->v_samp_factor, TRUE); /* Count non-dummy DCT block rows in this iMCU row. */ if (coef->iMCU_row_num < last_iMCU_row) block_rows = compptr->v_samp_factor; else { /* NB: can't use last_row_height here, since may not be set! */ block_rows = (int) (compptr->height_in_data_units % compptr->v_samp_factor); if (block_rows == 0) block_rows = compptr->v_samp_factor; } blocks_across = compptr->width_in_data_units; h_samp_factor = compptr->h_samp_factor; /* Count number of dummy blocks to be added at the right margin. */ ndummy = (int) (blocks_across % h_samp_factor); if (ndummy > 0) ndummy = h_samp_factor - ndummy; /* Perform DCT for all non-dummy blocks in this iMCU row. Each call * on forward_DCT processes a complete horizontal row of DCT blocks. */ for (block_row = 0; block_row < block_rows; block_row++) { thisblockrow = buffer[block_row]; (*lossyc->fdct_forward_DCT) (cinfo, compptr, input_buf[ci], thisblockrow, (JDIMENSION) (block_row * DCTSIZE), (JDIMENSION) 0, blocks_across); if (ndummy > 0) { /* Create dummy blocks at the right edge of the image. */ thisblockrow += blocks_across; /* => first dummy block */ jzero_far((void FAR *) thisblockrow, ndummy * SIZEOF(JBLOCK)); lastDC = thisblockrow[-1][0]; for (bi = 0; bi < ndummy; bi++) { thisblockrow[bi][0] = lastDC; } } } /* If at end of image, create dummy block rows as needed. * The tricky part here is that within each MCU, we want the DC values * of the dummy blocks to match the last real block's DC value. * This squeezes a few more bytes out of the resulting file... */ if (coef->iMCU_row_num == last_iMCU_row) { blocks_across += ndummy; /* include lower right corner */ MCUs_across = blocks_across / h_samp_factor; for (block_row = block_rows; block_row < compptr->v_samp_factor; block_row++) { thisblockrow = buffer[block_row]; lastblockrow = buffer[block_row-1]; jzero_far((void FAR *) thisblockrow, (size_t) (blocks_across * SIZEOF(JBLOCK))); for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) { lastDC = lastblockrow[h_samp_factor-1][0]; for (bi = 0; bi < h_samp_factor; bi++) { thisblockrow[bi][0] = lastDC; } thisblockrow += h_samp_factor; /* advance to next MCU in row */ lastblockrow += h_samp_factor; } } } } /* NB: compress_output will increment iMCU_row_num if successful. * A suspension return will result in redoing all the work above next time. */ /* Emit data to the entropy encoder, sharing code with subsequent passes */ return compress_output(cinfo, input_buf); } /* * Process some data in subsequent passes of a multi-pass case. * We process the equivalent of one fully interleaved MCU row ("iMCU" row) * per call, ie, v_samp_factor block rows for each component in the scan. * The data is obtained from the virtual arrays and fed to the entropy coder. * Returns TRUE if the iMCU row is completed, FALSE if suspended. * * NB: input_buf is ignored; it is likely to be a NULL pointer. */ METHODDEF(boolean) compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; c_coef_ptr coef = (c_coef_ptr) lossyc->coef_private; JDIMENSION MCU_col_num; /* index of current MCU within row */ int blkn, ci, xindex, yindex, yoffset; JDIMENSION start_col; JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN]; JBLOCKROW buffer_ptr; jpeg_component_info *compptr; (void)input_buf; /* Align the virtual buffers for the components used in this scan. * NB: during first pass, this is safe only because the buffers will * already be aligned properly, so jmemmgr.c won't need to do any I/O. */ for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; buffer[ci] = (*cinfo->mem->access_virt_barray) ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index], coef->iMCU_row_num * compptr->v_samp_factor, (JDIMENSION) compptr->v_samp_factor, FALSE); } /* Loop to process one whole iMCU row */ for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; yoffset++) { for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row; MCU_col_num++) { /* Construct list of pointers to DCT blocks belonging to this MCU */ blkn = 0; /* index of current DCT block within MCU */ for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; start_col = MCU_col_num * compptr->MCU_width; for (yindex = 0; yindex < compptr->MCU_height; yindex++) { buffer_ptr = buffer[ci][yindex+yoffset] + start_col; for (xindex = 0; xindex < compptr->MCU_width; xindex++) { coef->MCU_buffer[blkn++] = buffer_ptr++; } } } /* Try to write the MCU. */ if (! (*lossyc->entropy_encode_mcu) (cinfo, coef->MCU_buffer)) { /* Suspension forced; update state counters and exit */ coef->MCU_vert_offset = yoffset; coef->mcu_ctr = MCU_col_num; return FALSE; } } /* Completed an MCU row, but perhaps not an iMCU row */ coef->mcu_ctr = 0; } /* Completed the iMCU row, advance counters for next one */ coef->iMCU_row_num++; start_iMCU_row(cinfo); return TRUE; } #endif /* FULL_COEF_BUFFER_SUPPORTED */ /* * Initialize coefficient buffer controller. */ GLOBAL(void) jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; c_coef_ptr coef; coef = (c_coef_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(c_coef_controller)); lossyc->coef_private = (struct jpeg_c_coef_controller *) coef; lossyc->coef_start_pass = start_pass_coef; /* Create the coefficient buffer. */ if (need_full_buffer) { #ifdef FULL_COEF_BUFFER_SUPPORTED /* Allocate a full-image virtual array for each component, */ /* padded to a multiple of samp_factor DCT blocks in each direction. */ int ci; jpeg_component_info *compptr; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { coef->whole_image[ci] = (*cinfo->mem->request_virt_barray) ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, (JDIMENSION) jround_up((long) compptr->width_in_data_units, (long) compptr->h_samp_factor), (JDIMENSION) jround_up((long) compptr->height_in_data_units, (long) compptr->v_samp_factor), (JDIMENSION) compptr->v_samp_factor); } #else ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); #endif } else { /* We only need a single-MCU buffer. */ JBLOCKROW buffer; int i; buffer = (JBLOCKROW) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, C_MAX_DATA_UNITS_IN_MCU * SIZEOF(JBLOCK)); for (i = 0; i < C_MAX_DATA_UNITS_IN_MCU; i++) { coef->MCU_buffer[i] = buffer + i; } coef->whole_image[0] = NULL; /* flag for no virtual arrays */ } } ��������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jcdctmgr.c�����������������������������������������������0000644�0001750�0001750�00000030651�12320456500�021766� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jcdctmgr.c * * Copyright (C) 1994-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains the forward-DCT management logic. * This code selects a particular DCT implementation to be used, * and it performs related housekeeping chores including coefficient * quantization. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossy.h" /* Private declarations for lossy codec */ #include "jdct.h" /* Private declarations for DCT subsystem */ /* Private subobject for this module */ typedef struct { /* Pointer to the DCT routine actually in use */ forward_DCT_method_ptr do_dct; /* The actual post-DCT divisors --- not identical to the quant table * entries, because of scaling (especially for an unnormalized DCT). * Each table is given in normal array order. */ DCTELEM * divisors[NUM_QUANT_TBLS]; #ifdef DCT_FLOAT_SUPPORTED /* Same as above for the floating-point case. */ float_DCT_method_ptr do_float_dct; FAST_FLOAT * float_divisors[NUM_QUANT_TBLS]; #endif } fdct_controller; typedef fdct_controller * fdct_ptr; /* * Initialize for a processing pass. * Verify that all referenced Q-tables are present, and set up * the divisor table for each one. * In the current implementation, DCT of all components is done during * the first pass, even if only some components will be output in the * first scan. Hence all components should be examined here. */ METHODDEF(void) start_pass_fdctmgr (j_compress_ptr cinfo) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; fdct_ptr fdct = (fdct_ptr) lossyc->fdct_private; int ci, qtblno, i; jpeg_component_info *compptr; JQUANT_TBL * qtbl; DCTELEM * dtbl; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { qtblno = compptr->quant_tbl_no; /* Make sure specified quantization table is present */ if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS || cinfo->quant_tbl_ptrs[qtblno] == NULL) ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno); qtbl = cinfo->quant_tbl_ptrs[qtblno]; /* Compute divisors for this quant table */ /* We may do this more than once for same table, but it's not a big deal */ switch (cinfo->dct_method) { #ifdef DCT_ISLOW_SUPPORTED case JDCT_ISLOW: /* For LL&M IDCT method, divisors are equal to raw quantization * coefficients multiplied by 8 (to counteract scaling). */ if (fdct->divisors[qtblno] == NULL) { fdct->divisors[qtblno] = (DCTELEM *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, DCTSIZE2 * SIZEOF(DCTELEM)); } dtbl = fdct->divisors[qtblno]; for (i = 0; i < DCTSIZE2; i++) { dtbl[i] = ((DCTELEM) qtbl->quantval[i]) << 3; } break; #endif #ifdef DCT_IFAST_SUPPORTED case JDCT_IFAST: { /* For AA&N IDCT method, divisors are equal to quantization * coefficients scaled by scalefactor[row]*scalefactor[col], where * scalefactor[0] = 1 * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 * We apply a further scale factor of 8. */ #define CONST_BITS 14 static const INT16 aanscales[DCTSIZE2] = { /* precomputed values scaled up by 14 bits */ 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, 22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270, 21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906, 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315, 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, 12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552, 8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446, 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247 }; SHIFT_TEMPS if (fdct->divisors[qtblno] == NULL) { fdct->divisors[qtblno] = (DCTELEM *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, DCTSIZE2 * SIZEOF(DCTELEM)); } dtbl = fdct->divisors[qtblno]; for (i = 0; i < DCTSIZE2; i++) { dtbl[i] = (DCTELEM) DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i], (INT32) aanscales[i]), CONST_BITS-3); } } break; #endif #ifdef DCT_FLOAT_SUPPORTED case JDCT_FLOAT: { /* For float AA&N IDCT method, divisors are equal to quantization * coefficients scaled by scalefactor[row]*scalefactor[col], where * scalefactor[0] = 1 * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 * We apply a further scale factor of 8. * What's actually stored is 1/divisor so that the inner loop can * use a multiplication rather than a division. */ FAST_FLOAT * fdtbl; int row, col; static const double aanscalefactor[DCTSIZE] = { 1.0, 1.387039845, 1.306562965, 1.175875602, 1.0, 0.785694958, 0.541196100, 0.275899379 }; if (fdct->float_divisors[qtblno] == NULL) { fdct->float_divisors[qtblno] = (FAST_FLOAT *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, DCTSIZE2 * SIZEOF(FAST_FLOAT)); } fdtbl = fdct->float_divisors[qtblno]; i = 0; for (row = 0; row < DCTSIZE; row++) { for (col = 0; col < DCTSIZE; col++) { fdtbl[i] = (FAST_FLOAT) (1.0 / (((double) qtbl->quantval[i] * aanscalefactor[row] * aanscalefactor[col] * 8.0))); i++; } } } break; #endif default: ERREXIT(cinfo, JERR_NOT_COMPILED); break; } } } /* * Perform forward DCT on one or more blocks of a component. * * The input samples are taken from the sample_data[] array starting at * position start_row/start_col, and moving to the right for any additional * blocks. The quantized coefficients are returned in coef_blocks[]. */ METHODDEF(void) forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY sample_data, JBLOCKROW coef_blocks, JDIMENSION start_row, JDIMENSION start_col, JDIMENSION num_blocks) /* This version is used for integer DCT implementations. */ { /* This routine is heavily used, so it's worth coding it tightly. */ j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; fdct_ptr fdct = (fdct_ptr) lossyc->fdct_private; forward_DCT_method_ptr do_dct = fdct->do_dct; DCTELEM * divisors = fdct->divisors[compptr->quant_tbl_no]; DCTELEM workspace[DCTSIZE2]; /* work area for FDCT subroutine */ JDIMENSION bi; sample_data += start_row; /* fold in the vertical offset once */ for (bi = 0; bi < num_blocks; bi++, start_col += DCTSIZE) { /* Load data into workspace, applying unsigned->signed conversion */ { register DCTELEM *workspaceptr; register JSAMPROW elemptr; register int elemr; workspaceptr = workspace; for (elemr = 0; elemr < DCTSIZE; elemr++) { elemptr = sample_data[elemr] + start_col; #if DCTSIZE == 8 /* unroll the inner loop */ *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; #else { register int elemc; for (elemc = DCTSIZE; elemc > 0; elemc--) { *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; } } #endif } } /* Perform the DCT */ (*do_dct) (workspace); /* Quantize/descale the coefficients, and store into coef_blocks[] */ { register DCTELEM temp, qval; register int i; register JCOEFPTR output_ptr = coef_blocks[bi]; for (i = 0; i < DCTSIZE2; i++) { qval = divisors[i]; temp = workspace[i]; /* Divide the coefficient value by qval, ensuring proper rounding. * Since C does not specify the direction of rounding for negative * quotients, we have to force the dividend positive for portability. * * In most files, at least half of the output values will be zero * (at default quantization settings, more like three-quarters...) * so we should ensure that this case is fast. On many machines, * a comparison is enough cheaper than a divide to make a special test * a win. Since both inputs will be nonnegative, we need only test * for a < b to discover whether a/b is 0. * If your machine's division is fast enough, define FAST_DIVIDE. */ #ifdef FAST_DIVIDE #define DIVIDE_BY(a,b) a /= b #else #define DIVIDE_BY(a,b) if (a >= b) a /= b; else a = 0 #endif if (temp < 0) { temp = -temp; temp += qval>>1; /* for rounding */ DIVIDE_BY(temp, qval); temp = -temp; } else { temp += qval>>1; /* for rounding */ DIVIDE_BY(temp, qval); } output_ptr[i] = (JCOEF) temp; } } } } #ifdef DCT_FLOAT_SUPPORTED METHODDEF(void) forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY sample_data, JBLOCKROW coef_blocks, JDIMENSION start_row, JDIMENSION start_col, JDIMENSION num_blocks) /* This version is used for floating-point DCT implementations. */ { /* This routine is heavily used, so it's worth coding it tightly. */ j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; fdct_ptr fdct = (fdct_ptr) lossyc->fdct_private; float_DCT_method_ptr do_dct = fdct->do_float_dct; FAST_FLOAT * divisors = fdct->float_divisors[compptr->quant_tbl_no]; FAST_FLOAT workspace[DCTSIZE2]; /* work area for FDCT subroutine */ JDIMENSION bi; sample_data += start_row; /* fold in the vertical offset once */ for (bi = 0; bi < num_blocks; bi++, start_col += DCTSIZE) { /* Load data into workspace, applying unsigned->signed conversion */ { register FAST_FLOAT *workspaceptr; register JSAMPROW elemptr; register int elemr; workspaceptr = workspace; for (elemr = 0; elemr < DCTSIZE; elemr++) { elemptr = sample_data[elemr] + start_col; #if DCTSIZE == 8 /* unroll the inner loop */ *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); #else { register int elemc; for (elemc = DCTSIZE; elemc > 0; elemc--) { *workspaceptr++ = (FAST_FLOAT) (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); } } #endif } } /* Perform the DCT */ (*do_dct) (workspace); /* Quantize/descale the coefficients, and store into coef_blocks[] */ { register FAST_FLOAT temp; register int i; register JCOEFPTR output_ptr = coef_blocks[bi]; for (i = 0; i < DCTSIZE2; i++) { /* Apply the quantization and scaling factor */ temp = workspace[i] * divisors[i]; /* Round to nearest integer. * Since C does not specify the direction of rounding for negative * quotients, we have to force the dividend positive for portability. * The maximum coefficient size is +-16K (for 12-bit data), so this * code should work for either 16-bit or 32-bit ints. */ output_ptr[i] = (JCOEF) ((int) (temp + (FAST_FLOAT) 16384.5) - 16384); } } } } #endif /* DCT_FLOAT_SUPPORTED */ /* * Initialize FDCT manager. */ GLOBAL(void) jinit_forward_dct (j_compress_ptr cinfo) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; fdct_ptr fdct; int i; fdct = (fdct_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(fdct_controller)); lossyc->fdct_private = (struct jpeg_forward_dct *) fdct; lossyc->fdct_start_pass = start_pass_fdctmgr; switch (cinfo->dct_method) { #ifdef DCT_ISLOW_SUPPORTED case JDCT_ISLOW: lossyc->fdct_forward_DCT = forward_DCT; fdct->do_dct = jpeg_fdct_islow; break; #endif #ifdef DCT_IFAST_SUPPORTED case JDCT_IFAST: lossyc->fdct_forward_DCT = forward_DCT; fdct->do_dct = jpeg_fdct_ifast; break; #endif #ifdef DCT_FLOAT_SUPPORTED case JDCT_FLOAT: lossyc->fdct_forward_DCT = forward_DCT_float; fdct->do_float_dct = jpeg_fdct_float; break; #endif default: ERREXIT(cinfo, JERR_NOT_COMPILED); break; } /* Mark divisor tables unallocated */ for (i = 0; i < NUM_QUANT_TBLS; i++) { fdct->divisors[i] = NULL; #ifdef DCT_FLOAT_SUPPORTED fdct->float_divisors[i] = NULL; #endif } } ���������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdlossls.c�����������������������������������������������0000644�0001750�0001750�00000004545�12320456500�022031� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdlossls.c * * Copyright (C) 1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains the control logic for the lossless JPEG decompressor. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossls.h" #ifdef D_LOSSLESS_SUPPORTED /* * Compute output image dimensions and related values. */ METHODDEF(void) calc_output_dimensions (j_decompress_ptr cinfo) { /* Hardwire it to "no scaling" */ cinfo->output_width = cinfo->image_width; cinfo->output_height = cinfo->image_height; /* jdinput.c has already initialized codec_data_unit to 1, * and has computed unscaled downsampled_width and downsampled_height. */ } /* * Initialize for an input processing pass. */ METHODDEF(void) start_input_pass (j_decompress_ptr cinfo) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; (*losslsd->entropy_start_pass) (cinfo); (*losslsd->predict_start_pass) (cinfo); (*losslsd->scaler_start_pass) (cinfo); (*losslsd->diff_start_input_pass) (cinfo); } /* * Initialize the lossless decompression codec. * This is called only once, during master selection. */ GLOBAL(void) jinit_lossless_d_codec(j_decompress_ptr cinfo) { j_lossless_d_ptr losslsd; boolean use_c_buffer; /* Create subobject in permanent pool */ losslsd = (j_lossless_d_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, SIZEOF(jpeg_lossless_d_codec)); cinfo->codec = (struct jpeg_d_codec *) losslsd; /* Initialize sub-modules */ /* Entropy decoding: either Huffman or arithmetic coding. */ if (cinfo->arith_code) { #ifdef WITH_ARITHMETIC_PATCH jinit_arith_decoder(cinfo); #else ERREXIT(cinfo, JERR_ARITH_NOTIMPL); #endif } else { jinit_lhuff_decoder(cinfo); } /* Undifferencer */ jinit_undifferencer(cinfo); /* Scaler */ jinit_d_scaler(cinfo); use_c_buffer = cinfo->inputctl->has_multiple_scans || cinfo->buffered_image; jinit_d_diff_controller(cinfo, use_c_buffer); /* Initialize method pointers. * * Note: consume_data, start_output_pass and decompress_data are * assigned in jddiffct.c. */ losslsd->pub.calc_output_dimensions = calc_output_dimensions; losslsd->pub.start_input_pass = start_input_pass; } #endif /* D_LOSSLESS_SUPPORTED */ �����������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jerror.c�������������������������������������������������0000644�0001750�0001750�00000017216�12320456500�021476� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jerror.c * * Copyright (C) 1991-1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains simple error-reporting and trace-message routines. * These are suitable for Unix-like systems and others where writing to * stderr is the right thing to do. Many applications will want to replace * some or all of these routines. * * If you define USE_WINDOWS_MESSAGEBOX in jconfig.h or in the makefile, * you get a Windows-specific hack to display error messages in a dialog box. * It ain't much, but it beats dropping error messages into the bit bucket, * which is what happens to output to stderr under most Windows C compilers. * * These routines are used by both the compression and decompression code. */ /* this is not a core library module, so it doesn't define JPEG_INTERNALS */ #include "jinclude.h" #include "jpeglib.h" #include "jversion.h" #include "jerror.h" #ifdef USE_WINDOWS_MESSAGEBOX #include <windows.h> #endif #include <stdlib.h> #ifndef EXIT_FAILURE /* define exit() codes if not provided */ #define EXIT_FAILURE 1 #endif /* * Create the message string table. * We do this from the master message list in jerror.h by re-reading * jerror.h with a suitable definition for macro JMESSAGE. * The message table is made an external symbol just in case any applications * want to refer to it directly. */ #ifdef NEED_SHORT_EXTERNAL_NAMES #define jpeg_std_message_table jMsgTable #endif #define JMESSAGE(code,string) string , const char * const jpeg_std_message_table[] = { #include "jerror.h" NULL }; /* * Error exit handler: must not return to caller. * * Applications may override this if they want to get control back after * an error. Typically one would longjmp somewhere instead of exiting. * The setjmp buffer can be made a private field within an expanded error * handler object. Note that the info needed to generate an error message * is stored in the error object, so you can generate the message now or * later, at your convenience. * You should make sure that the JPEG object is cleaned up (with jpeg_abort * or jpeg_destroy) at some point. */ METHODDEF(void) error_exit (j_common_ptr cinfo) { /* Always display the message */ (*cinfo->err->output_message) (cinfo); /* Let the memory manager delete any temp files before we die */ jpeg_destroy(cinfo); exit(EXIT_FAILURE); } /* * Actual output of an error or trace message. * Applications may override this method to send JPEG messages somewhere * other than stderr. * * On Windows, printing to stderr is generally completely useless, * so we provide optional code to produce an error-dialog popup. * Most Windows applications will still prefer to override this routine, * but if they don't, it'll do something at least marginally useful. * * NOTE: to use the library in an environment that doesn't support the * C stdio library, you may have to delete the call to fprintf() entirely, * not just not use this routine. */ METHODDEF(void) output_message (j_common_ptr cinfo) { char buffer[JMSG_LENGTH_MAX]; /* Create the message */ (*cinfo->err->format_message) (cinfo, buffer); #ifdef USE_WINDOWS_MESSAGEBOX /* Display it in a message dialog box */ MessageBox(GetActiveWindow(), buffer, "JPEG Library Error", MB_OK | MB_ICONERROR); #else /* Send it to stderr, adding a newline */ fprintf(stderr, "%s\n", buffer); #endif } /* * Decide whether to emit a trace or warning message. * msg_level is one of: * -1: recoverable corrupt-data warning, may want to abort. * 0: important advisory messages (always display to user). * 1: first level of tracing detail. * 2,3,...: successively more detailed tracing messages. * An application might override this method if it wanted to abort on warnings * or change the policy about which messages to display. */ METHODDEF(void) emit_message (j_common_ptr cinfo, int msg_level) { struct jpeg_error_mgr * err = cinfo->err; if (msg_level < 0) { /* It's a warning message. Since corrupt files may generate many warnings, * the policy implemented here is to show only the first warning, * unless trace_level >= 3. */ if (err->num_warnings == 0 || err->trace_level >= 3) (*err->output_message) (cinfo); /* Always count warnings in num_warnings. */ err->num_warnings++; } else { /* It's a trace message. Show it if trace_level >= msg_level. */ if (err->trace_level >= msg_level) (*err->output_message) (cinfo); } } /* * Format a message string for the most recent JPEG error or message. * The message is stored into buffer, which should be at least JMSG_LENGTH_MAX * characters. Note that no '\n' character is added to the string. * Few applications should need to override this method. */ METHODDEF(void) format_message (j_common_ptr cinfo, char * buffer) { struct jpeg_error_mgr * err = cinfo->err; int msg_code = err->msg_code; const char * msgtext = NULL; const char * msgptr; char ch; boolean isstring; /* Look up message string in proper table */ if (msg_code > 0 && msg_code <= err->last_jpeg_message) { msgtext = err->jpeg_message_table[msg_code]; } else if (err->addon_message_table != NULL && msg_code >= err->first_addon_message && msg_code <= err->last_addon_message) { msgtext = err->addon_message_table[msg_code - err->first_addon_message]; } /* Defend against bogus message number */ if (msgtext == NULL) { err->msg_parm.i[0] = msg_code; msgtext = err->jpeg_message_table[0]; } /* Check for string parameter, as indicated by %s in the message text */ isstring = FALSE; msgptr = msgtext; while ((ch = *msgptr++) != '\0') { if (ch == '%') { if (*msgptr == 's') isstring = TRUE; break; } } /* Format the message into the passed buffer */ if (isstring) sprintf(buffer, msgtext, err->msg_parm.s); else sprintf(buffer, msgtext, err->msg_parm.i[0], err->msg_parm.i[1], err->msg_parm.i[2], err->msg_parm.i[3], err->msg_parm.i[4], err->msg_parm.i[5], err->msg_parm.i[6], err->msg_parm.i[7]); } /* * Reset error state variables at start of a new image. * This is called during compression startup to reset trace/error * processing to default state, without losing any application-specific * method pointers. An application might possibly want to override * this method if it has additional error processing state. */ METHODDEF(void) reset_error_mgr (j_common_ptr cinfo) { cinfo->err->num_warnings = 0; /* trace_level is not reset since it is an application-supplied parameter */ cinfo->err->msg_code = 0; /* may be useful as a flag for "no error" */ } /* * Fill in the standard error-handling methods in a jpeg_error_mgr object. * Typical call is: * struct jpeg_compress_struct cinfo; * struct jpeg_error_mgr err; * * cinfo.err = jpeg_std_error(&err); * after which the application may override some of the methods. */ GLOBAL(struct jpeg_error_mgr *) jpeg_std_error (struct jpeg_error_mgr * err) { err->error_exit = error_exit; err->emit_message = emit_message; err->output_message = output_message; err->format_message = format_message; err->reset_error_mgr = reset_error_mgr; err->trace_level = 0; /* default = no tracing */ err->num_warnings = 0; /* no warnings emitted yet */ err->msg_code = 0; /* may be useful as a flag for "no error" */ /* Initialize message table pointers */ err->jpeg_message_table = jpeg_std_message_table; err->last_jpeg_message = (int) JMSG_LASTMSGCODE - 1; err->addon_message_table = NULL; err->first_addon_message = 0; /* for safety */ err->last_addon_message = 0; return err; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jconfig.vc�����������������������������������������������0000644�0001750�0001750�00000002542�12320456500�021774� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */ /* see jconfig.doc for explanations */ #define HAVE_PROTOTYPES #define HAVE_UNSIGNED_CHAR #define HAVE_UNSIGNED_SHORT /* #define void char */ /* #define const */ #undef CHAR_IS_UNSIGNED #define HAVE_STDDEF_H #define HAVE_STDLIB_H #undef NEED_BSD_STRINGS #undef NEED_SYS_TYPES_H #undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */ #undef NEED_SHORT_EXTERNAL_NAMES #undef INCOMPLETE_TYPES_BROKEN /* Define "boolean" as unsigned char, not int, per Windows custom */ #ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ typedef unsigned char boolean; #endif #define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ #ifdef JPEG_INTERNALS #undef RIGHT_SHIFT_IS_UNSIGNED #endif /* JPEG_INTERNALS */ #ifdef JPEG_CJPEG_DJPEG #define BMP_SUPPORTED /* BMP image file format */ #define GIF_SUPPORTED /* GIF image file format */ #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ #undef RLE_SUPPORTED /* Utah RLE image file format */ #define TARGA_SUPPORTED /* Targa image file format */ #define TWO_FILE_COMMANDLINE /* optional */ #define USE_SETMODE /* Microsoft has setmode() */ #undef NEED_SIGNAL_CATCHER #undef DONT_USE_B_MODE #undef PROGRESS_REPORT /* optional */ #endif /* JPEG_CJPEG_DJPEG */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jconfig.dj�����������������������������������������������0000644�0001750�0001750�00000002235�12320456500�021760� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* jconfig.dj --- jconfig.h for DJGPP (Delorie's GNU C port) on MS-DOS. */ /* see jconfig.doc for explanations */ #define HAVE_PROTOTYPES #define HAVE_UNSIGNED_CHAR #define HAVE_UNSIGNED_SHORT /* #define void char */ /* #define const */ #undef CHAR_IS_UNSIGNED #define HAVE_STDDEF_H #define HAVE_STDLIB_H #undef NEED_BSD_STRINGS #undef NEED_SYS_TYPES_H #undef NEED_FAR_POINTERS /* DJGPP uses flat 32-bit addressing */ #undef NEED_SHORT_EXTERNAL_NAMES #undef INCOMPLETE_TYPES_BROKEN #ifdef JPEG_INTERNALS #undef RIGHT_SHIFT_IS_UNSIGNED #endif /* JPEG_INTERNALS */ #ifdef JPEG_CJPEG_DJPEG #define BMP_SUPPORTED /* BMP image file format */ #define GIF_SUPPORTED /* GIF image file format */ #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ #undef RLE_SUPPORTED /* Utah RLE image file format */ #define TARGA_SUPPORTED /* Targa image file format */ #undef TWO_FILE_COMMANDLINE /* optional */ #define USE_SETMODE /* Needed to make one-file style work in DJGPP */ #undef NEED_SIGNAL_CATCHER /* Define this if you use jmemname.c */ #undef DONT_USE_B_MODE #undef PROGRESS_REPORT /* optional */ #endif /* JPEG_CJPEG_DJPEG */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/jpeglib/jdpred.c�������������������������������������������������0000644�0001750�0001750�00000021776�12320456500�021451� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jdpred.c * * Copyright (C) 1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains sample undifferencing (reconstruction) for lossless JPEG. * * In order to avoid paying the performance penalty of having to check the * predictor being used and the row being processed for each call of the * undifferencer, and to promote optimization, we have separate undifferencing * functions for each case. * * We are able to avoid duplicating source code by implementing the predictors * and undifferencers as macros. Each of the undifferencing functions are * simply wrappers around an UNDIFFERENCE macro with the appropriate PREDICTOR * macro passed as an argument. */ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jlossls.h" /* Private declarations for lossless codec */ #ifdef D_LOSSLESS_SUPPORTED /* Predictor for the first column of the first row: 2^(P-Pt-1) */ #define INITIAL_PREDICTORx (1 << (cinfo->data_precision - cinfo->Al - 1)) /* Predictor for the first column of the remaining rows: Rb */ #define INITIAL_PREDICTOR2 GETJSAMPLE(prev_row[0]) /* * 1-Dimensional undifferencer routine. * * This macro implements the 1-D horizontal predictor (1). INITIAL_PREDICTOR * is used as the special case predictor for the first column, which must be * either INITIAL_PREDICTOR2 or INITIAL_PREDICTORx. The remaining samples * use PREDICTOR1. * * The reconstructed sample is supposed to be calculated modulo 2^16, so we * logically AND the result with 0xFFFF. */ #define UNDIFFERENCE_1D(INITIAL_PREDICTOR) \ unsigned int xindex; \ int Ra; \ \ Ra = (diff_buf[0] + INITIAL_PREDICTOR) & 0xFFFF; \ undiff_buf[0] = Ra; \ \ for (xindex = 1; xindex < width; xindex++) { \ Ra = (diff_buf[xindex] + PREDICTOR1) & 0xFFFF; \ undiff_buf[xindex] = Ra; \ } /* * 2-Dimensional undifferencer routine. * * This macro implements the 2-D horizontal predictors (#2-7). PREDICTOR2 is * used as the special case predictor for the first column. The remaining * samples use PREDICTOR, which is a function of Ra, Rb, Rc. * * Because prev_row and output_buf may point to the same storage area (in an * interleaved image with Vi=1, for example), we must take care to buffer Rb/Rc * before writing the current reconstructed sample value into output_buf. * * The reconstructed sample is supposed to be calculated modulo 2^16, so we * logically AND the result with 0xFFFF. */ #define UNDIFFERENCE_2D_BUG(PREDICTOR) \ Rb = GETJSAMPLE(prev_row[0]); \ Ra = (diff_buf[0] + PREDICTOR2) & 0xFFFF; \ undiff_buf[0] = Ra; \ \ for (xindex = 1; xindex < width; xindex++) { \ Rc = Rb; \ Rb = GETJSAMPLE(prev_row[xindex]); \ Ra = (diff_buf[xindex] + PREDICTOR) & 0xFFFF; \ undiff_buf[xindex] = Ra; \ } #define UNDIFFERENCE_2D(PREDICTOR) \ unsigned int xindex; \ int Ra, Rb, Rc; \ \ Rb = GETJSAMPLE(prev_row[0]); \ Ra = (diff_buf[0] + PREDICTOR2) & 0xFFFF; \ undiff_buf[0] = Ra; \ \ for (xindex = 1; xindex < width; xindex++) { \ Rc = Rb; \ Rb = GETJSAMPLE(prev_row[xindex]); \ Ra = (diff_buf[xindex] + PREDICTOR) & 0xFFFF; \ undiff_buf[xindex] = Ra; \ } /* * Undifferencers for the all rows but the first in a scan or restart interval. * The first sample in the row is undifferenced using the vertical * predictor (2). The rest of the samples are undifferenced using the * predictor specified in the scan header. */ METHODDEF(void) jpeg_undifference1(j_decompress_ptr cinfo, int comp_index, JDIFFROW diff_buf, JDIFFROW prev_row, JDIFFROW undiff_buf, JDIMENSION width) { UNDIFFERENCE_1D(INITIAL_PREDICTOR2); (void)cinfo;(void)comp_index;(void)diff_buf;(void)prev_row;(void)undiff_buf;(void)width; } METHODDEF(void) jpeg_undifference2(j_decompress_ptr cinfo, int comp_index, JDIFFROW diff_buf, JDIFFROW prev_row, JDIFFROW undiff_buf, JDIMENSION width) { UNDIFFERENCE_2D(PREDICTOR2); (void)cinfo;(void)comp_index;(void)diff_buf;(void)prev_row;(void)undiff_buf;(void)width; } METHODDEF(void) jpeg_undifference3(j_decompress_ptr cinfo, int comp_index, JDIFFROW diff_buf, JDIFFROW prev_row, JDIFFROW undiff_buf, JDIMENSION width) { UNDIFFERENCE_2D(PREDICTOR3); (void)cinfo;(void)comp_index;(void)diff_buf;(void)prev_row;(void)undiff_buf;(void)width; } METHODDEF(void) jpeg_undifference4(j_decompress_ptr cinfo, int comp_index, JDIFFROW diff_buf, JDIFFROW prev_row, JDIFFROW undiff_buf, JDIMENSION width) { UNDIFFERENCE_2D(PREDICTOR4); (void)cinfo;(void)comp_index;(void)diff_buf;(void)prev_row;(void)undiff_buf;(void)width; } METHODDEF(void) jpeg_undifference5(j_decompress_ptr cinfo, int comp_index, JDIFFROW diff_buf, JDIFFROW prev_row, JDIFFROW undiff_buf, JDIMENSION width) { SHIFT_TEMPS UNDIFFERENCE_2D(PREDICTOR5); (void)cinfo;(void)comp_index;(void)diff_buf;(void)prev_row;(void)undiff_buf;(void)width; } #ifdef SUPPORT_DICOMOBJECTS_BUG /* uninitialized */ static int dicomobjectsbug = -1; /* 0 == nobug, 1 == bug */ #endif METHODDEF(void) jpeg_undifference6(j_decompress_ptr cinfo, int comp_index, JDIFFROW diff_buf, JDIFFROW prev_row, JDIFFROW undiff_buf, JDIMENSION width) { #ifdef SUPPORT_DICOMOBJECTS_BUG unsigned int xindex; int Ra, Rb, Rc; int min, max, temp; SHIFT_TEMPS if( dicomobjectsbug == -1 ) { dicomobjectsbug = 0; /* no bug by default */ Rb = GETJSAMPLE(prev_row[0]); Ra = (diff_buf[0] + PREDICTOR2) & 0xFFFF; undiff_buf[0] = Ra; temp = min = max = undiff_buf[0]; for (xindex = 1; xindex < width; xindex++) { Rc = Rb; Rb = GETJSAMPLE(prev_row[xindex]); Ra = (diff_buf[xindex] + PREDICTOR6) & 0xFFFF; temp = Ra; min = temp < min ? temp : min; max = temp > max ? temp : max; } if( (max - min) > 50000) /* magic number */ { dicomobjectsbug = 1; WARNMS(cinfo, JWRN_SIGNED_ARITH); } } if(dicomobjectsbug) { UNDIFFERENCE_2D_BUG(PREDICTOR6_BUG); } else { UNDIFFERENCE_2D_BUG(PREDICTOR6); } #else SHIFT_TEMPS UNDIFFERENCE_2D(PREDICTOR6); #endif (void)comp_index;(void)cinfo; } METHODDEF(void) jpeg_undifference7(j_decompress_ptr cinfo, int comp_index, JDIFFROW diff_buf, JDIFFROW prev_row, JDIFFROW undiff_buf, JDIMENSION width) { SHIFT_TEMPS UNDIFFERENCE_2D(PREDICTOR7); (void)cinfo;(void)comp_index;(void)diff_buf;(void)prev_row;(void)undiff_buf;(void)width; } /* * Undifferencer for the first row in a scan or restart interval. The first * sample in the row is undifferenced using the special predictor constant * x=2^(P-Pt-1). The rest of the samples are undifferenced using the * 1-D horizontal predictor (1). */ METHODDEF(void) jpeg_undifference_first_row(j_decompress_ptr cinfo, int comp_index, JDIFFROW diff_buf, JDIFFROW prev_row, JDIFFROW undiff_buf, JDIMENSION width) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; UNDIFFERENCE_1D(INITIAL_PREDICTORx); (void)prev_row; /* * Now that we have undifferenced the first row, we want to use the * undifferencer which corresponds to the predictor specified in the * scan header. */ switch (cinfo->Ss) { case 1: losslsd->predict_undifference[comp_index] = jpeg_undifference1; break; case 2: losslsd->predict_undifference[comp_index] = jpeg_undifference2; break; case 3: losslsd->predict_undifference[comp_index] = jpeg_undifference3; break; case 4: losslsd->predict_undifference[comp_index] = jpeg_undifference4; break; case 5: losslsd->predict_undifference[comp_index] = jpeg_undifference5; break; case 6: losslsd->predict_undifference[comp_index] = jpeg_undifference6; break; case 7: losslsd->predict_undifference[comp_index] = jpeg_undifference7; break; } } /* * Initialize for an input processing pass. */ METHODDEF(void) predict_start_pass (j_decompress_ptr cinfo) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; int ci; /* Check that the scan parameters Ss, Se, Ah, Al are OK for lossless JPEG. * * Ss is the predictor selection value (psv). Legal values for sequential * lossless JPEG are: 1 <= psv <= 7. * * Se and Ah are not used and should be zero. * * Al specifies the point transform (Pt). Legal values are: 0 <= Pt <= 15. */ if (cinfo->Ss < 1 || cinfo->Ss > 7 || cinfo->Se != 0 || cinfo->Ah != 0 || cinfo->Al > 15) /* need not check for < 0 */ ERREXIT4(cinfo, JERR_BAD_LOSSLESS, cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al); /* Set undifference functions to first row function */ for (ci = 0; ci < cinfo->num_components; ci++) losslsd->predict_undifference[ci] = jpeg_undifference_first_row; } /* * Module initialization routine for the undifferencer. */ GLOBAL(void) jinit_undifferencer (j_decompress_ptr cinfo) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; losslsd->predict_start_pass = predict_start_pass; losslsd->predict_process_restart = predict_start_pass; } #endif /* D_LOSSLESS_SUPPORTED */ ��ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/������������������������������������������������������������0000755�0001750�0001750�00000000000�12320456500�017334� 5����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/t4.h��������������������������������������������������������0000644�0001750�0001750�00000026031�12320456500�020036� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: t4.h,v 1.1.1.1 1999/07/27 21:50:27 mike Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _T4_ #define _T4_ /* * CCITT T.4 1D Huffman runlength codes and * related definitions. Given the small sizes * of these tables it does not seem * worthwhile to make code & length 8 bits. */ typedef struct tableentry { unsigned short length; /* bit length of g3 code */ unsigned short code; /* g3 code */ short runlen; /* run length in bits */ } tableentry; #define EOL 0x001 /* EOL code value - 0000 0000 0000 1 */ /* status values returned instead of a run length */ #define G3CODE_EOL -1 /* NB: ACT_EOL - ACT_WRUNT */ #define G3CODE_INVALID -2 /* NB: ACT_INVALID - ACT_WRUNT */ #define G3CODE_EOF -3 /* end of input data */ #define G3CODE_INCOMP -4 /* incomplete run code */ /* * Note that these tables are ordered such that the * index into the table is known to be either the * run length, or (run length / 64) + a fixed offset. * * NB: The G3CODE_INVALID entries are only used * during state generation (see mkg3states.c). */ #ifdef G3CODES const tableentry TIFFFaxWhiteCodes[] = { { 8, 0x35, 0 }, /* 0011 0101 */ { 6, 0x7, 1 }, /* 0001 11 */ { 4, 0x7, 2 }, /* 0111 */ { 4, 0x8, 3 }, /* 1000 */ { 4, 0xB, 4 }, /* 1011 */ { 4, 0xC, 5 }, /* 1100 */ { 4, 0xE, 6 }, /* 1110 */ { 4, 0xF, 7 }, /* 1111 */ { 5, 0x13, 8 }, /* 1001 1 */ { 5, 0x14, 9 }, /* 1010 0 */ { 5, 0x7, 10 }, /* 0011 1 */ { 5, 0x8, 11 }, /* 0100 0 */ { 6, 0x8, 12 }, /* 0010 00 */ { 6, 0x3, 13 }, /* 0000 11 */ { 6, 0x34, 14 }, /* 1101 00 */ { 6, 0x35, 15 }, /* 1101 01 */ { 6, 0x2A, 16 }, /* 1010 10 */ { 6, 0x2B, 17 }, /* 1010 11 */ { 7, 0x27, 18 }, /* 0100 111 */ { 7, 0xC, 19 }, /* 0001 100 */ { 7, 0x8, 20 }, /* 0001 000 */ { 7, 0x17, 21 }, /* 0010 111 */ { 7, 0x3, 22 }, /* 0000 011 */ { 7, 0x4, 23 }, /* 0000 100 */ { 7, 0x28, 24 }, /* 0101 000 */ { 7, 0x2B, 25 }, /* 0101 011 */ { 7, 0x13, 26 }, /* 0010 011 */ { 7, 0x24, 27 }, /* 0100 100 */ { 7, 0x18, 28 }, /* 0011 000 */ { 8, 0x2, 29 }, /* 0000 0010 */ { 8, 0x3, 30 }, /* 0000 0011 */ { 8, 0x1A, 31 }, /* 0001 1010 */ { 8, 0x1B, 32 }, /* 0001 1011 */ { 8, 0x12, 33 }, /* 0001 0010 */ { 8, 0x13, 34 }, /* 0001 0011 */ { 8, 0x14, 35 }, /* 0001 0100 */ { 8, 0x15, 36 }, /* 0001 0101 */ { 8, 0x16, 37 }, /* 0001 0110 */ { 8, 0x17, 38 }, /* 0001 0111 */ { 8, 0x28, 39 }, /* 0010 1000 */ { 8, 0x29, 40 }, /* 0010 1001 */ { 8, 0x2A, 41 }, /* 0010 1010 */ { 8, 0x2B, 42 }, /* 0010 1011 */ { 8, 0x2C, 43 }, /* 0010 1100 */ { 8, 0x2D, 44 }, /* 0010 1101 */ { 8, 0x4, 45 }, /* 0000 0100 */ { 8, 0x5, 46 }, /* 0000 0101 */ { 8, 0xA, 47 }, /* 0000 1010 */ { 8, 0xB, 48 }, /* 0000 1011 */ { 8, 0x52, 49 }, /* 0101 0010 */ { 8, 0x53, 50 }, /* 0101 0011 */ { 8, 0x54, 51 }, /* 0101 0100 */ { 8, 0x55, 52 }, /* 0101 0101 */ { 8, 0x24, 53 }, /* 0010 0100 */ { 8, 0x25, 54 }, /* 0010 0101 */ { 8, 0x58, 55 }, /* 0101 1000 */ { 8, 0x59, 56 }, /* 0101 1001 */ { 8, 0x5A, 57 }, /* 0101 1010 */ { 8, 0x5B, 58 }, /* 0101 1011 */ { 8, 0x4A, 59 }, /* 0100 1010 */ { 8, 0x4B, 60 }, /* 0100 1011 */ { 8, 0x32, 61 }, /* 0011 0010 */ { 8, 0x33, 62 }, /* 0011 0011 */ { 8, 0x34, 63 }, /* 0011 0100 */ { 5, 0x1B, 64 }, /* 1101 1 */ { 5, 0x12, 128 }, /* 1001 0 */ { 6, 0x17, 192 }, /* 0101 11 */ { 7, 0x37, 256 }, /* 0110 111 */ { 8, 0x36, 320 }, /* 0011 0110 */ { 8, 0x37, 384 }, /* 0011 0111 */ { 8, 0x64, 448 }, /* 0110 0100 */ { 8, 0x65, 512 }, /* 0110 0101 */ { 8, 0x68, 576 }, /* 0110 1000 */ { 8, 0x67, 640 }, /* 0110 0111 */ { 9, 0xCC, 704 }, /* 0110 0110 0 */ { 9, 0xCD, 768 }, /* 0110 0110 1 */ { 9, 0xD2, 832 }, /* 0110 1001 0 */ { 9, 0xD3, 896 }, /* 0110 1001 1 */ { 9, 0xD4, 960 }, /* 0110 1010 0 */ { 9, 0xD5, 1024 }, /* 0110 1010 1 */ { 9, 0xD6, 1088 }, /* 0110 1011 0 */ { 9, 0xD7, 1152 }, /* 0110 1011 1 */ { 9, 0xD8, 1216 }, /* 0110 1100 0 */ { 9, 0xD9, 1280 }, /* 0110 1100 1 */ { 9, 0xDA, 1344 }, /* 0110 1101 0 */ { 9, 0xDB, 1408 }, /* 0110 1101 1 */ { 9, 0x98, 1472 }, /* 0100 1100 0 */ { 9, 0x99, 1536 }, /* 0100 1100 1 */ { 9, 0x9A, 1600 }, /* 0100 1101 0 */ { 6, 0x18, 1664 }, /* 0110 00 */ { 9, 0x9B, 1728 }, /* 0100 1101 1 */ { 11, 0x8, 1792 }, /* 0000 0001 000 */ { 11, 0xC, 1856 }, /* 0000 0001 100 */ { 11, 0xD, 1920 }, /* 0000 0001 101 */ { 12, 0x12, 1984 }, /* 0000 0001 0010 */ { 12, 0x13, 2048 }, /* 0000 0001 0011 */ { 12, 0x14, 2112 }, /* 0000 0001 0100 */ { 12, 0x15, 2176 }, /* 0000 0001 0101 */ { 12, 0x16, 2240 }, /* 0000 0001 0110 */ { 12, 0x17, 2304 }, /* 0000 0001 0111 */ { 12, 0x1C, 2368 }, /* 0000 0001 1100 */ { 12, 0x1D, 2432 }, /* 0000 0001 1101 */ { 12, 0x1E, 2496 }, /* 0000 0001 1110 */ { 12, 0x1F, 2560 }, /* 0000 0001 1111 */ { 12, 0x1, G3CODE_EOL }, /* 0000 0000 0001 */ { 9, 0x1, G3CODE_INVALID }, /* 0000 0000 1 */ { 10, 0x1, G3CODE_INVALID }, /* 0000 0000 01 */ { 11, 0x1, G3CODE_INVALID }, /* 0000 0000 001 */ { 12, 0x0, G3CODE_INVALID }, /* 0000 0000 0000 */ }; const tableentry TIFFFaxBlackCodes[] = { { 10, 0x37, 0 }, /* 0000 1101 11 */ { 3, 0x2, 1 }, /* 010 */ { 2, 0x3, 2 }, /* 11 */ { 2, 0x2, 3 }, /* 10 */ { 3, 0x3, 4 }, /* 011 */ { 4, 0x3, 5 }, /* 0011 */ { 4, 0x2, 6 }, /* 0010 */ { 5, 0x3, 7 }, /* 0001 1 */ { 6, 0x5, 8 }, /* 0001 01 */ { 6, 0x4, 9 }, /* 0001 00 */ { 7, 0x4, 10 }, /* 0000 100 */ { 7, 0x5, 11 }, /* 0000 101 */ { 7, 0x7, 12 }, /* 0000 111 */ { 8, 0x4, 13 }, /* 0000 0100 */ { 8, 0x7, 14 }, /* 0000 0111 */ { 9, 0x18, 15 }, /* 0000 1100 0 */ { 10, 0x17, 16 }, /* 0000 0101 11 */ { 10, 0x18, 17 }, /* 0000 0110 00 */ { 10, 0x8, 18 }, /* 0000 0010 00 */ { 11, 0x67, 19 }, /* 0000 1100 111 */ { 11, 0x68, 20 }, /* 0000 1101 000 */ { 11, 0x6C, 21 }, /* 0000 1101 100 */ { 11, 0x37, 22 }, /* 0000 0110 111 */ { 11, 0x28, 23 }, /* 0000 0101 000 */ { 11, 0x17, 24 }, /* 0000 0010 111 */ { 11, 0x18, 25 }, /* 0000 0011 000 */ { 12, 0xCA, 26 }, /* 0000 1100 1010 */ { 12, 0xCB, 27 }, /* 0000 1100 1011 */ { 12, 0xCC, 28 }, /* 0000 1100 1100 */ { 12, 0xCD, 29 }, /* 0000 1100 1101 */ { 12, 0x68, 30 }, /* 0000 0110 1000 */ { 12, 0x69, 31 }, /* 0000 0110 1001 */ { 12, 0x6A, 32 }, /* 0000 0110 1010 */ { 12, 0x6B, 33 }, /* 0000 0110 1011 */ { 12, 0xD2, 34 }, /* 0000 1101 0010 */ { 12, 0xD3, 35 }, /* 0000 1101 0011 */ { 12, 0xD4, 36 }, /* 0000 1101 0100 */ { 12, 0xD5, 37 }, /* 0000 1101 0101 */ { 12, 0xD6, 38 }, /* 0000 1101 0110 */ { 12, 0xD7, 39 }, /* 0000 1101 0111 */ { 12, 0x6C, 40 }, /* 0000 0110 1100 */ { 12, 0x6D, 41 }, /* 0000 0110 1101 */ { 12, 0xDA, 42 }, /* 0000 1101 1010 */ { 12, 0xDB, 43 }, /* 0000 1101 1011 */ { 12, 0x54, 44 }, /* 0000 0101 0100 */ { 12, 0x55, 45 }, /* 0000 0101 0101 */ { 12, 0x56, 46 }, /* 0000 0101 0110 */ { 12, 0x57, 47 }, /* 0000 0101 0111 */ { 12, 0x64, 48 }, /* 0000 0110 0100 */ { 12, 0x65, 49 }, /* 0000 0110 0101 */ { 12, 0x52, 50 }, /* 0000 0101 0010 */ { 12, 0x53, 51 }, /* 0000 0101 0011 */ { 12, 0x24, 52 }, /* 0000 0010 0100 */ { 12, 0x37, 53 }, /* 0000 0011 0111 */ { 12, 0x38, 54 }, /* 0000 0011 1000 */ { 12, 0x27, 55 }, /* 0000 0010 0111 */ { 12, 0x28, 56 }, /* 0000 0010 1000 */ { 12, 0x58, 57 }, /* 0000 0101 1000 */ { 12, 0x59, 58 }, /* 0000 0101 1001 */ { 12, 0x2B, 59 }, /* 0000 0010 1011 */ { 12, 0x2C, 60 }, /* 0000 0010 1100 */ { 12, 0x5A, 61 }, /* 0000 0101 1010 */ { 12, 0x66, 62 }, /* 0000 0110 0110 */ { 12, 0x67, 63 }, /* 0000 0110 0111 */ { 10, 0xF, 64 }, /* 0000 0011 11 */ { 12, 0xC8, 128 }, /* 0000 1100 1000 */ { 12, 0xC9, 192 }, /* 0000 1100 1001 */ { 12, 0x5B, 256 }, /* 0000 0101 1011 */ { 12, 0x33, 320 }, /* 0000 0011 0011 */ { 12, 0x34, 384 }, /* 0000 0011 0100 */ { 12, 0x35, 448 }, /* 0000 0011 0101 */ { 13, 0x6C, 512 }, /* 0000 0011 0110 0 */ { 13, 0x6D, 576 }, /* 0000 0011 0110 1 */ { 13, 0x4A, 640 }, /* 0000 0010 0101 0 */ { 13, 0x4B, 704 }, /* 0000 0010 0101 1 */ { 13, 0x4C, 768 }, /* 0000 0010 0110 0 */ { 13, 0x4D, 832 }, /* 0000 0010 0110 1 */ { 13, 0x72, 896 }, /* 0000 0011 1001 0 */ { 13, 0x73, 960 }, /* 0000 0011 1001 1 */ { 13, 0x74, 1024 }, /* 0000 0011 1010 0 */ { 13, 0x75, 1088 }, /* 0000 0011 1010 1 */ { 13, 0x76, 1152 }, /* 0000 0011 1011 0 */ { 13, 0x77, 1216 }, /* 0000 0011 1011 1 */ { 13, 0x52, 1280 }, /* 0000 0010 1001 0 */ { 13, 0x53, 1344 }, /* 0000 0010 1001 1 */ { 13, 0x54, 1408 }, /* 0000 0010 1010 0 */ { 13, 0x55, 1472 }, /* 0000 0010 1010 1 */ { 13, 0x5A, 1536 }, /* 0000 0010 1101 0 */ { 13, 0x5B, 1600 }, /* 0000 0010 1101 1 */ { 13, 0x64, 1664 }, /* 0000 0011 0010 0 */ { 13, 0x65, 1728 }, /* 0000 0011 0010 1 */ { 11, 0x8, 1792 }, /* 0000 0001 000 */ { 11, 0xC, 1856 }, /* 0000 0001 100 */ { 11, 0xD, 1920 }, /* 0000 0001 101 */ { 12, 0x12, 1984 }, /* 0000 0001 0010 */ { 12, 0x13, 2048 }, /* 0000 0001 0011 */ { 12, 0x14, 2112 }, /* 0000 0001 0100 */ { 12, 0x15, 2176 }, /* 0000 0001 0101 */ { 12, 0x16, 2240 }, /* 0000 0001 0110 */ { 12, 0x17, 2304 }, /* 0000 0001 0111 */ { 12, 0x1C, 2368 }, /* 0000 0001 1100 */ { 12, 0x1D, 2432 }, /* 0000 0001 1101 */ { 12, 0x1E, 2496 }, /* 0000 0001 1110 */ { 12, 0x1F, 2560 }, /* 0000 0001 1111 */ { 12, 0x1, G3CODE_EOL }, /* 0000 0000 0001 */ { 9, 0x1, G3CODE_INVALID }, /* 0000 0000 1 */ { 10, 0x1, G3CODE_INVALID }, /* 0000 0000 01 */ { 11, 0x1, G3CODE_INVALID }, /* 0000 0000 001 */ { 12, 0x0, G3CODE_INVALID }, /* 0000 0000 0000 */ }; #else extern const tableentry TIFFFaxWhiteCodes[]; extern const tableentry TIFFFaxBlackCodes[]; #endif #endif /* _T4_ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_packbits.c����������������������������������������������0000644�0001750�0001750�00000017112�12320456500�022144� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_packbits.c,v 1.13.2.1 2009-01-01 00:10:43 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "tiffiop.h" #ifdef PACKBITS_SUPPORT /* * TIFF Library. * * PackBits Compression Algorithm Support */ #include <stdio.h> static int PackBitsPreEncode(TIFF* tif, tsample_t s) { (void) s; if (!(tif->tif_data = (tidata_t)_TIFFmalloc(sizeof(tsize_t)))) return (0); /* * Calculate the scanline/tile-width size in bytes. */ if (isTiled(tif)) *(tsize_t*)tif->tif_data = TIFFTileRowSize(tif); else *(tsize_t*)tif->tif_data = TIFFScanlineSize(tif); return (1); } static int PackBitsPostEncode(TIFF* tif) { if (tif->tif_data) _TIFFfree(tif->tif_data); return (1); } /* * NB: tidata is the type representing *(tidata_t); * if tidata_t is made signed then this type must * be adjusted accordingly. */ typedef unsigned char tidata; /* * Encode a run of pixels. */ static int PackBitsEncode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s) { unsigned char* bp = (unsigned char*) buf; tidata_t op, ep, lastliteral; long n, slop; int b; enum { BASE, LITERAL, RUN, LITERAL_RUN } state; (void) s; op = tif->tif_rawcp; ep = tif->tif_rawdata + tif->tif_rawdatasize; state = BASE; lastliteral = 0; while (cc > 0) { /* * Find the longest string of identical bytes. */ b = *bp++, cc--, n = 1; for (; cc > 0 && b == *bp; cc--, bp++) n++; again: if (op + 2 >= ep) { /* insure space for new data */ /* * Be careful about writing the last * literal. Must write up to that point * and then copy the remainder to the * front of the buffer. */ if (state == LITERAL || state == LITERAL_RUN) { slop = op - lastliteral; tif->tif_rawcc += lastliteral - tif->tif_rawcp; if (!TIFFFlushData1(tif)) return (-1); op = tif->tif_rawcp; while (slop-- > 0) *op++ = *lastliteral++; lastliteral = tif->tif_rawcp; } else { tif->tif_rawcc += op - tif->tif_rawcp; if (!TIFFFlushData1(tif)) return (-1); op = tif->tif_rawcp; } } switch (state) { case BASE: /* initial state, set run/literal */ if (n > 1) { state = RUN; if (n > 128) { *op++ = (tidata) -127; *op++ = (tidataval_t) b; n -= 128; goto again; } *op++ = (tidataval_t)(-(n-1)); *op++ = (tidataval_t) b; } else { lastliteral = op; *op++ = 0; *op++ = (tidataval_t) b; state = LITERAL; } break; case LITERAL: /* last object was literal string */ if (n > 1) { state = LITERAL_RUN; if (n > 128) { *op++ = (tidata) -127; *op++ = (tidataval_t) b; n -= 128; goto again; } *op++ = (tidataval_t)(-(n-1)); /* encode run */ *op++ = (tidataval_t) b; } else { /* extend literal */ if (++(*lastliteral) == 127) state = BASE; *op++ = (tidataval_t) b; } break; case RUN: /* last object was run */ if (n > 1) { if (n > 128) { *op++ = (tidata) -127; *op++ = (tidataval_t) b; n -= 128; goto again; } *op++ = (tidataval_t)(-(n-1)); *op++ = (tidataval_t) b; } else { lastliteral = op; *op++ = 0; *op++ = (tidataval_t) b; state = LITERAL; } break; case LITERAL_RUN: /* literal followed by a run */ /* * Check to see if previous run should * be converted to a literal, in which * case we convert literal-run-literal * to a single literal. */ if (n == 1 && op[-2] == (tidata) -1 && *lastliteral < 126) { state = (((*lastliteral) += 2) == 127 ? BASE : LITERAL); op[-2] = op[-1]; /* replicate */ } else state = RUN; goto again; } } tif->tif_rawcc += op - tif->tif_rawcp; tif->tif_rawcp = op; return (1); } /* * Encode a rectangular chunk of pixels. We break it up * into row-sized pieces to insure that encoded runs do * not span rows. Otherwise, there can be problems with * the decoder if data is read, for example, by scanlines * when it was encoded by strips. */ static int PackBitsEncodeChunk(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) { tsize_t rowsize = *(tsize_t*)tif->tif_data; while ((long)cc > 0) { int chunk = rowsize; if( cc < chunk ) chunk = cc; if (PackBitsEncode(tif, bp, chunk, s) < 0) return (-1); bp += chunk; cc -= chunk; } return (1); } static int PackBitsDecode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s) { char *bp; tsize_t cc; long n; int b; (void) s; bp = (char*) tif->tif_rawcp; cc = tif->tif_rawcc; while (cc > 0 && (long)occ > 0) { n = (long) *bp++, cc--; /* * Watch out for compilers that * don't sign extend chars... */ if (n >= 128) n -= 256; if (n < 0) { /* replicate next byte -n+1 times */ if (n == -128) /* nop */ continue; n = -n + 1; if( occ < n ) { TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "PackBitsDecode: discarding %ld bytes " "to avoid buffer overrun", n - occ); n = occ; } occ -= n; b = *bp++, cc--; while (n-- > 0) *op++ = (tidataval_t) b; } else { /* copy next n+1 bytes literally */ if (occ < n + 1) { TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "PackBitsDecode: discarding %ld bytes " "to avoid buffer overrun", n - occ + 1); n = occ - 1; } _TIFFmemcpy(op, bp, ++n); op += n; occ -= n; bp += n; cc -= n; } } tif->tif_rawcp = (tidata_t) bp; tif->tif_rawcc = cc; if (occ > 0) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "PackBitsDecode: Not enough data for scanline %ld", (long) tif->tif_row); return (0); } return (1); } int TIFFInitPackBits(TIFF* tif, int scheme) { (void) scheme; tif->tif_decoderow = PackBitsDecode; tif->tif_decodestrip = PackBitsDecode; tif->tif_decodetile = PackBitsDecode; tif->tif_preencode = PackBitsPreEncode; tif->tif_postencode = PackBitsPostEncode; tif->tif_encoderow = PackBitsEncode; tif->tif_encodestrip = PackBitsEncodeChunk; tif->tif_encodetile = PackBitsEncodeChunk; return (1); } #endif /* PACKBITS_SUPPORT */ /* vim: set ts=8 sts=8 sw=8 noet: */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_predict.c�����������������������������������������������0000644�0001750�0001750�00000045116�12320456500�022003� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_predict.c,v 1.11.2.3 2009-01-23 15:57:18 fwarmerdam Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * Predictor Tag Support (used by multiple codecs). */ #include "tiffiop.h" #include "tif_predict.h" #define PredictorState(tif) ((TIFFPredictorState*) (tif)->tif_data) static void horAcc8(TIFF*, tidata_t, tsize_t); static void horAcc16(TIFF*, tidata_t, tsize_t); static void horAcc32(TIFF*, tidata_t, tsize_t); static void swabHorAcc16(TIFF*, tidata_t, tsize_t); static void swabHorAcc32(TIFF*, tidata_t, tsize_t); static void horDiff8(TIFF*, tidata_t, tsize_t); static void horDiff16(TIFF*, tidata_t, tsize_t); static void horDiff32(TIFF*, tidata_t, tsize_t); static void fpAcc(TIFF*, tidata_t, tsize_t); static void fpDiff(TIFF*, tidata_t, tsize_t); static int PredictorDecodeRow(TIFF*, tidata_t, tsize_t, tsample_t); static int PredictorDecodeTile(TIFF*, tidata_t, tsize_t, tsample_t); static int PredictorEncodeRow(TIFF*, tidata_t, tsize_t, tsample_t); static int PredictorEncodeTile(TIFF*, tidata_t, tsize_t, tsample_t); static int PredictorSetup(TIFF* tif) { static const char module[] = "PredictorSetup"; TIFFPredictorState* sp = PredictorState(tif); TIFFDirectory* td = &tif->tif_dir; switch (sp->predictor) /* no differencing */ { case PREDICTOR_NONE: return 1; case PREDICTOR_HORIZONTAL: if (td->td_bitspersample != 8 && td->td_bitspersample != 16 && td->td_bitspersample != 32) { TIFFErrorExt(tif->tif_clientdata, module, "Horizontal differencing \"Predictor\" not supported with %d-bit samples", td->td_bitspersample); return 0; } break; case PREDICTOR_FLOATINGPOINT: if (td->td_sampleformat != SAMPLEFORMAT_IEEEFP) { TIFFErrorExt(tif->tif_clientdata, module, "Floating point \"Predictor\" not supported with %d data format", td->td_sampleformat); return 0; } break; default: TIFFErrorExt(tif->tif_clientdata, module, "\"Predictor\" value %d not supported", sp->predictor); return 0; } sp->stride = (td->td_planarconfig == PLANARCONFIG_CONTIG ? td->td_samplesperpixel : 1); /* * Calculate the scanline/tile-width size in bytes. */ if (isTiled(tif)) sp->rowsize = TIFFTileRowSize(tif); else sp->rowsize = TIFFScanlineSize(tif); return 1; } static int PredictorSetupDecode(TIFF* tif) { TIFFPredictorState* sp = PredictorState(tif); TIFFDirectory* td = &tif->tif_dir; if (!(*sp->setupdecode)(tif) || !PredictorSetup(tif)) return 0; if (sp->predictor == 2) { switch (td->td_bitspersample) { case 8: sp->decodepfunc = horAcc8; break; case 16: sp->decodepfunc = horAcc16; break; case 32: sp->decodepfunc = horAcc32; break; } /* * Override default decoding method with one that does the * predictor stuff. */ if( tif->tif_decoderow != PredictorDecodeRow ) { sp->decoderow = tif->tif_decoderow; tif->tif_decoderow = PredictorDecodeRow; sp->decodestrip = tif->tif_decodestrip; tif->tif_decodestrip = PredictorDecodeTile; sp->decodetile = tif->tif_decodetile; tif->tif_decodetile = PredictorDecodeTile; } /* * If the data is horizontally differenced 16-bit data that * requires byte-swapping, then it must be byte swapped before * the accumulation step. We do this with a special-purpose * routine and override the normal post decoding logic that * the library setup when the directory was read. */ if (tif->tif_flags & TIFF_SWAB) { if (sp->decodepfunc == horAcc16) { sp->decodepfunc = swabHorAcc16; tif->tif_postdecode = _TIFFNoPostDecode; } else if (sp->decodepfunc == horAcc32) { sp->decodepfunc = swabHorAcc32; tif->tif_postdecode = _TIFFNoPostDecode; } } } else if (sp->predictor == 3) { sp->decodepfunc = fpAcc; /* * Override default decoding method with one that does the * predictor stuff. */ if( tif->tif_decoderow != PredictorDecodeRow ) { sp->decoderow = tif->tif_decoderow; tif->tif_decoderow = PredictorDecodeRow; sp->decodestrip = tif->tif_decodestrip; tif->tif_decodestrip = PredictorDecodeTile; sp->decodetile = tif->tif_decodetile; tif->tif_decodetile = PredictorDecodeTile; } /* * The data should not be swapped outside of the floating * point predictor, the accumulation routine should return * byres in the native order. */ if (tif->tif_flags & TIFF_SWAB) { tif->tif_postdecode = _TIFFNoPostDecode; } /* * Allocate buffer to keep the decoded bytes before * rearranging in the ight order */ } return 1; } static int PredictorSetupEncode(TIFF* tif) { TIFFPredictorState* sp = PredictorState(tif); TIFFDirectory* td = &tif->tif_dir; if (!(*sp->setupencode)(tif) || !PredictorSetup(tif)) return 0; if (sp->predictor == 2) { switch (td->td_bitspersample) { case 8: sp->encodepfunc = horDiff8; break; case 16: sp->encodepfunc = horDiff16; break; case 32: sp->encodepfunc = horDiff32; break; } /* * Override default encoding method with one that does the * predictor stuff. */ if( tif->tif_encoderow != PredictorEncodeRow ) { sp->encoderow = tif->tif_encoderow; tif->tif_encoderow = PredictorEncodeRow; sp->encodestrip = tif->tif_encodestrip; tif->tif_encodestrip = PredictorEncodeTile; sp->encodetile = tif->tif_encodetile; tif->tif_encodetile = PredictorEncodeTile; } } else if (sp->predictor == 3) { sp->encodepfunc = fpDiff; /* * Override default encoding method with one that does the * predictor stuff. */ if( tif->tif_encoderow != PredictorEncodeRow ) { sp->encoderow = tif->tif_encoderow; tif->tif_encoderow = PredictorEncodeRow; sp->encodestrip = tif->tif_encodestrip; tif->tif_encodestrip = PredictorEncodeTile; sp->encodetile = tif->tif_encodetile; tif->tif_encodetile = PredictorEncodeTile; } } return 1; } #define REPEAT4(n, op) \ switch (n) { \ default: { int i; for (i = n-4; i > 0; i--) { op; } } \ case 4: op; \ case 3: op; \ case 2: op; \ case 1: op; \ case 0: ; \ } static void horAcc8(TIFF* tif, tidata_t cp0, tsize_t cc) { tsize_t stride = PredictorState(tif)->stride; char* cp = (char*) cp0; if (cc > stride) { cc -= stride; /* * Pipeline the most common cases. */ if (stride == 3) { unsigned int cr = cp[0]; unsigned int cg = cp[1]; unsigned int cb = cp[2]; do { cc -= 3, cp += 3; cp[0] = (char) (cr += cp[0]); cp[1] = (char) (cg += cp[1]); cp[2] = (char) (cb += cp[2]); } while ((int32) cc > 0); } else if (stride == 4) { unsigned int cr = cp[0]; unsigned int cg = cp[1]; unsigned int cb = cp[2]; unsigned int ca = cp[3]; do { cc -= 4, cp += 4; cp[0] = (char) (cr += cp[0]); cp[1] = (char) (cg += cp[1]); cp[2] = (char) (cb += cp[2]); cp[3] = (char) (ca += cp[3]); } while ((int32) cc > 0); } else { do { REPEAT4(stride, cp[stride] = (char) (cp[stride] + *cp); cp++) cc -= stride; } while ((int32) cc > 0); } } } static void swabHorAcc16(TIFF* tif, tidata_t cp0, tsize_t cc) { tsize_t stride = PredictorState(tif)->stride; uint16* wp = (uint16*) cp0; tsize_t wc = cc / 2; if (wc > stride) { TIFFSwabArrayOfShort(wp, wc); wc -= stride; do { REPEAT4(stride, wp[stride] += wp[0]; wp++) wc -= stride; } while ((int32) wc > 0); } } static void horAcc16(TIFF* tif, tidata_t cp0, tsize_t cc) { tsize_t stride = PredictorState(tif)->stride; uint16* wp = (uint16*) cp0; tsize_t wc = cc / 2; if (wc > stride) { wc -= stride; do { REPEAT4(stride, wp[stride] += wp[0]; wp++) wc -= stride; } while ((int32) wc > 0); } } static void swabHorAcc32(TIFF* tif, tidata_t cp0, tsize_t cc) { tsize_t stride = PredictorState(tif)->stride; uint32* wp = (uint32*) cp0; tsize_t wc = cc / 4; if (wc > stride) { TIFFSwabArrayOfLong(wp, wc); wc -= stride; do { REPEAT4(stride, wp[stride] += wp[0]; wp++) wc -= stride; } while ((int32) wc > 0); } } static void horAcc32(TIFF* tif, tidata_t cp0, tsize_t cc) { tsize_t stride = PredictorState(tif)->stride; uint32* wp = (uint32*) cp0; tsize_t wc = cc / 4; if (wc > stride) { wc -= stride; do { REPEAT4(stride, wp[stride] += wp[0]; wp++) wc -= stride; } while ((int32) wc > 0); } } /* * Floating point predictor accumulation routine. */ static void fpAcc(TIFF* tif, tidata_t cp0, tsize_t cc) { tsize_t stride = PredictorState(tif)->stride; uint32 bps = tif->tif_dir.td_bitspersample / 8; tsize_t wc = cc / bps; tsize_t count = cc; uint8 *cp = (uint8 *) cp0; uint8 *tmp = (uint8 *)_TIFFmalloc(cc); if (!tmp) return; while (count > stride) { REPEAT4(stride, cp[stride] += cp[0]; cp++) count -= stride; } _TIFFmemcpy(tmp, cp0, cc); cp = (uint8 *) cp0; for (count = 0; count < wc; count++) { uint32 byte; for (byte = 0; byte < bps; byte++) { #if WORDS_BIGENDIAN cp[bps * count + byte] = tmp[byte * wc + count]; #else cp[bps * count + byte] = tmp[(bps - byte - 1) * wc + count]; #endif } } _TIFFfree(tmp); } /* * Decode a scanline and apply the predictor routine. */ static int PredictorDecodeRow(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s) { TIFFPredictorState *sp = PredictorState(tif); assert(sp != NULL); assert(sp->decoderow != NULL); assert(sp->decodepfunc != NULL); if ((*sp->decoderow)(tif, op0, occ0, s)) { (*sp->decodepfunc)(tif, op0, occ0); return 1; } else return 0; } /* * Decode a tile/strip and apply the predictor routine. * Note that horizontal differencing must be done on a * row-by-row basis. The width of a "row" has already * been calculated at pre-decode time according to the * strip/tile dimensions. */ static int PredictorDecodeTile(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s) { TIFFPredictorState *sp = PredictorState(tif); assert(sp != NULL); assert(sp->decodetile != NULL); if ((*sp->decodetile)(tif, op0, occ0, s)) { tsize_t rowsize = sp->rowsize; assert(rowsize > 0); assert(sp->decodepfunc != NULL); while ((long)occ0 > 0) { (*sp->decodepfunc)(tif, op0, (tsize_t) rowsize); occ0 -= rowsize; op0 += rowsize; } return 1; } else return 0; } static void horDiff8(TIFF* tif, tidata_t cp0, tsize_t cc) { TIFFPredictorState* sp = PredictorState(tif); tsize_t stride = sp->stride; char* cp = (char*) cp0; if (cc > stride) { cc -= stride; /* * Pipeline the most common cases. */ if (stride == 3) { int r1, g1, b1; int r2 = cp[0]; int g2 = cp[1]; int b2 = cp[2]; do { r1 = cp[3]; cp[3] = r1-r2; r2 = r1; g1 = cp[4]; cp[4] = g1-g2; g2 = g1; b1 = cp[5]; cp[5] = b1-b2; b2 = b1; cp += 3; } while ((int32)(cc -= 3) > 0); } else if (stride == 4) { int r1, g1, b1, a1; int r2 = cp[0]; int g2 = cp[1]; int b2 = cp[2]; int a2 = cp[3]; do { r1 = cp[4]; cp[4] = r1-r2; r2 = r1; g1 = cp[5]; cp[5] = g1-g2; g2 = g1; b1 = cp[6]; cp[6] = b1-b2; b2 = b1; a1 = cp[7]; cp[7] = a1-a2; a2 = a1; cp += 4; } while ((int32)(cc -= 4) > 0); } else { cp += cc - 1; do { REPEAT4(stride, cp[stride] -= cp[0]; cp--) } while ((int32)(cc -= stride) > 0); } } } static void horDiff16(TIFF* tif, tidata_t cp0, tsize_t cc) { TIFFPredictorState* sp = PredictorState(tif); tsize_t stride = sp->stride; int16 *wp = (int16*) cp0; tsize_t wc = cc/2; if (wc > stride) { wc -= stride; wp += wc - 1; do { REPEAT4(stride, wp[stride] -= wp[0]; wp--) wc -= stride; } while ((int32) wc > 0); } } static void horDiff32(TIFF* tif, tidata_t cp0, tsize_t cc) { TIFFPredictorState* sp = PredictorState(tif); tsize_t stride = sp->stride; int32 *wp = (int32*) cp0; tsize_t wc = cc/4; if (wc > stride) { wc -= stride; wp += wc - 1; do { REPEAT4(stride, wp[stride] -= wp[0]; wp--) wc -= stride; } while ((int32) wc > 0); } } /* * Floating point predictor differencing routine. */ static void fpDiff(TIFF* tif, tidata_t cp0, tsize_t cc) { tsize_t stride = PredictorState(tif)->stride; uint32 bps = tif->tif_dir.td_bitspersample / 8; tsize_t wc = cc / bps; tsize_t count; uint8 *cp = (uint8 *) cp0; uint8 *tmp = (uint8 *)_TIFFmalloc(cc); if (!tmp) return; _TIFFmemcpy(tmp, cp0, cc); for (count = 0; count < wc; count++) { uint32 byte; for (byte = 0; byte < bps; byte++) { #if WORDS_BIGENDIAN cp[byte * wc + count] = tmp[bps * count + byte]; #else cp[(bps - byte - 1) * wc + count] = tmp[bps * count + byte]; #endif } } _TIFFfree(tmp); cp = (uint8 *) cp0; cp += cc - stride - 1; for (count = cc; count > stride; count -= stride) REPEAT4(stride, cp[stride] -= cp[0]; cp--) } static int PredictorEncodeRow(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) { TIFFPredictorState *sp = PredictorState(tif); assert(sp != NULL); assert(sp->encodepfunc != NULL); assert(sp->encoderow != NULL); /* XXX horizontal differencing alters user's data XXX */ (*sp->encodepfunc)(tif, bp, cc); return (*sp->encoderow)(tif, bp, cc, s); } static int PredictorEncodeTile(TIFF* tif, tidata_t bp0, tsize_t cc0, tsample_t s) { static const char module[] = "PredictorEncodeTile"; TIFFPredictorState *sp = PredictorState(tif); uint8 *working_copy; tsize_t cc = cc0, rowsize; unsigned char* bp; int result_code; assert(sp != NULL); assert(sp->encodepfunc != NULL); assert(sp->encodetile != NULL); /* * Do predictor manipulation in a working buffer to avoid altering * the callers buffer. http://trac.osgeo.org/gdal/ticket/1965 */ working_copy = (uint8*) _TIFFmalloc(cc0); if( working_copy == NULL ) { TIFFErrorExt(tif->tif_clientdata, module, "Out of memory allocating %d byte temp buffer.", cc0 ); return 0; } memcpy( working_copy, bp0, cc0 ); bp = working_copy; rowsize = sp->rowsize; assert(rowsize > 0); assert((cc0%rowsize)==0); while (cc > 0) { (*sp->encodepfunc)(tif, bp, rowsize); cc -= rowsize; bp += rowsize; } result_code = (*sp->encodetile)(tif, working_copy, cc0, s); _TIFFfree( working_copy ); return result_code; } #define FIELD_PREDICTOR (FIELD_CODEC+0) /* XXX */ static const TIFFFieldInfo predictFieldInfo[] = { { TIFFTAG_PREDICTOR, 1, 1, TIFF_SHORT, FIELD_PREDICTOR, FALSE, FALSE, "Predictor" }, }; static int PredictorVSetField(TIFF* tif, ttag_t tag, va_list ap) { TIFFPredictorState *sp = PredictorState(tif); assert(sp != NULL); assert(sp->vsetparent != NULL); switch (tag) { case TIFFTAG_PREDICTOR: sp->predictor = (uint16) va_arg(ap, int); TIFFSetFieldBit(tif, FIELD_PREDICTOR); break; default: return (*sp->vsetparent)(tif, tag, ap); } tif->tif_flags |= TIFF_DIRTYDIRECT; return 1; } static int PredictorVGetField(TIFF* tif, ttag_t tag, va_list ap) { TIFFPredictorState *sp = PredictorState(tif); assert(sp != NULL); assert(sp->vgetparent != NULL); switch (tag) { case TIFFTAG_PREDICTOR: *va_arg(ap, uint16*) = sp->predictor; break; default: return (*sp->vgetparent)(tif, tag, ap); } return 1; } static void PredictorPrintDir(TIFF* tif, FILE* fd, long flags) { TIFFPredictorState* sp = PredictorState(tif); (void) flags; if (TIFFFieldSet(tif,FIELD_PREDICTOR)) { fprintf(fd, " Predictor: "); switch (sp->predictor) { case 1: fprintf(fd, "none "); break; case 2: fprintf(fd, "horizontal differencing "); break; case 3: fprintf(fd, "floating point predictor "); break; } fprintf(fd, "%u (0x%x)\n", sp->predictor, sp->predictor); } if (sp->printdir) (*sp->printdir)(tif, fd, flags); } int TIFFPredictorInit(TIFF* tif) { TIFFPredictorState* sp = PredictorState(tif); assert(sp != 0); /* * Merge codec-specific tag information. */ if (!_TIFFMergeFieldInfo(tif, predictFieldInfo, TIFFArrayCount(predictFieldInfo))) { TIFFErrorExt(tif->tif_clientdata, "TIFFPredictorInit", "Merging Predictor codec-specific tags failed"); return 0; } /* * Override parent get/set field methods. */ sp->vgetparent = tif->tif_tagmethods.vgetfield; tif->tif_tagmethods.vgetfield = PredictorVGetField;/* hook for predictor tag */ sp->vsetparent = tif->tif_tagmethods.vsetfield; tif->tif_tagmethods.vsetfield = PredictorVSetField;/* hook for predictor tag */ sp->printdir = tif->tif_tagmethods.printdir; tif->tif_tagmethods.printdir = PredictorPrintDir; /* hook for predictor tag */ sp->setupdecode = tif->tif_setupdecode; tif->tif_setupdecode = PredictorSetupDecode; sp->setupencode = tif->tif_setupencode; tif->tif_setupencode = PredictorSetupEncode; sp->predictor = 1; /* default value */ sp->encodepfunc = NULL; /* no predictor routine */ sp->decodepfunc = NULL; /* no predictor routine */ return 1; } int TIFFPredictorCleanup(TIFF* tif) { TIFFPredictorState* sp = PredictorState(tif); assert(sp != 0); tif->tif_tagmethods.vgetfield = sp->vgetparent; tif->tif_tagmethods.vsetfield = sp->vsetparent; tif->tif_tagmethods.printdir = sp->printdir; tif->tif_setupdecode = sp->setupdecode; tif->tif_setupencode = sp->setupencode; return 1; } /* vim: set ts=8 sts=8 sw=8 noet: */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_dir.h���������������������������������������������������0000644�0001750�0001750�00000016032�12320456500�021127� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_dir.h,v 1.30.2.1 2007/04/07 14:58:30 dron Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _TIFFDIR_ #define _TIFFDIR_ /* * ``Library-private'' Directory-related Definitions. */ /* * Internal format of a TIFF directory entry. */ typedef struct { #define FIELD_SETLONGS 4 /* bit vector of fields that are set */ unsigned long td_fieldsset[FIELD_SETLONGS]; uint32 td_imagewidth, td_imagelength, td_imagedepth; uint32 td_tilewidth, td_tilelength, td_tiledepth; uint32 td_subfiletype; uint16 td_bitspersample; uint16 td_sampleformat; uint16 td_compression; uint16 td_photometric; uint16 td_threshholding; uint16 td_fillorder; uint16 td_orientation; uint16 td_samplesperpixel; uint32 td_rowsperstrip; uint16 td_minsamplevalue, td_maxsamplevalue; double td_sminsamplevalue, td_smaxsamplevalue; float td_xresolution, td_yresolution; uint16 td_resolutionunit; uint16 td_planarconfig; float td_xposition, td_yposition; uint16 td_pagenumber[2]; uint16* td_colormap[3]; uint16 td_halftonehints[2]; uint16 td_extrasamples; uint16* td_sampleinfo; /* even though the name is misleading, td_stripsperimage is the number * of striles (=strips or tiles) per plane, and td_nstrips the total * number of striles */ tstrile_t td_stripsperimage; tstrile_t td_nstrips; /* size of offset & bytecount arrays */ toff_t* td_stripoffset; toff_t* td_stripbytecount; /* FIXME: it should be tsize_t array */ int td_stripbytecountsorted; /* is the bytecount array sorted ascending? */ uint16 td_nsubifd; uint32* td_subifd; /* YCbCr parameters */ uint16 td_ycbcrsubsampling[2]; uint16 td_ycbcrpositioning; /* Colorimetry parameters */ uint16* td_transferfunction[3]; /* CMYK parameters */ int td_inknameslen; char* td_inknames; int td_customValueCount; TIFFTagValue *td_customValues; } TIFFDirectory; /* * Field flags used to indicate fields that have * been set in a directory, and to reference fields * when manipulating a directory. */ /* * FIELD_IGNORE is used to signify tags that are to * be processed but otherwise ignored. This permits * antiquated tags to be quietly read and discarded. * Note that a bit *is* allocated for ignored tags; * this is understood by the directory reading logic * which uses this fact to avoid special-case handling */ #define FIELD_IGNORE 0 /* multi-item fields */ #define FIELD_IMAGEDIMENSIONS 1 #define FIELD_TILEDIMENSIONS 2 #define FIELD_RESOLUTION 3 #define FIELD_POSITION 4 /* single-item fields */ #define FIELD_SUBFILETYPE 5 #define FIELD_BITSPERSAMPLE 6 #define FIELD_COMPRESSION 7 #define FIELD_PHOTOMETRIC 8 #define FIELD_THRESHHOLDING 9 #define FIELD_FILLORDER 10 #define FIELD_ORIENTATION 15 #define FIELD_SAMPLESPERPIXEL 16 #define FIELD_ROWSPERSTRIP 17 #define FIELD_MINSAMPLEVALUE 18 #define FIELD_MAXSAMPLEVALUE 19 #define FIELD_PLANARCONFIG 20 #define FIELD_RESOLUTIONUNIT 22 #define FIELD_PAGENUMBER 23 #define FIELD_STRIPBYTECOUNTS 24 #define FIELD_STRIPOFFSETS 25 #define FIELD_COLORMAP 26 #define FIELD_EXTRASAMPLES 31 #define FIELD_SAMPLEFORMAT 32 #define FIELD_SMINSAMPLEVALUE 33 #define FIELD_SMAXSAMPLEVALUE 34 #define FIELD_IMAGEDEPTH 35 #define FIELD_TILEDEPTH 36 #define FIELD_HALFTONEHINTS 37 #define FIELD_YCBCRSUBSAMPLING 39 #define FIELD_YCBCRPOSITIONING 40 #define FIELD_TRANSFERFUNCTION 44 #define FIELD_INKNAMES 46 #define FIELD_SUBIFD 49 /* FIELD_CUSTOM (see tiffio.h) 65 */ /* end of support for well-known tags; codec-private tags follow */ #define FIELD_CODEC 66 /* base of codec-private tags */ /* * Pseudo-tags don't normally need field bits since they * are not written to an output file (by definition). * The library also has express logic to always query a * codec for a pseudo-tag so allocating a field bit for * one is a waste. If codec wants to promote the notion * of a pseudo-tag being ``set'' or ``unset'' then it can * do using internal state flags without polluting the * field bit space defined for real tags. */ #define FIELD_PSEUDO 0 #define FIELD_LAST (32*FIELD_SETLONGS-1) #define TIFFExtractData(tif, type, v) \ ((uint32) ((tif)->tif_header.tiff_magic == TIFF_BIGENDIAN ? \ ((v) >> (tif)->tif_typeshift[type]) & (tif)->tif_typemask[type] : \ (v) & (tif)->tif_typemask[type])) #define TIFFInsertData(tif, type, v) \ ((uint32) ((tif)->tif_header.tiff_magic == TIFF_BIGENDIAN ? \ ((v) & (tif)->tif_typemask[type]) << (tif)->tif_typeshift[type] : \ (v) & (tif)->tif_typemask[type])) #define BITn(n) (((unsigned long)1L)<<((n)&0x1f)) #define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n)/32]) #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field)) #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field)) #define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field)) #define FieldSet(fields, f) (fields[(f)/32] & BITn(f)) #define ResetFieldBit(fields, f) (fields[(f)/32] &= ~BITn(f)) #if defined(__cplusplus) extern "C" { #endif extern const TIFFFieldInfo *_TIFFGetFieldInfo(size_t *); extern const TIFFFieldInfo *_TIFFGetExifFieldInfo(size_t *); extern void _TIFFSetupFieldInfo(TIFF*, const TIFFFieldInfo[], size_t); extern int _TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], int); extern void _TIFFPrintFieldInfo(TIFF*, FILE*); extern TIFFDataType _TIFFSampleToTagType(TIFF*); extern const TIFFFieldInfo* _TIFFFindOrRegisterFieldInfo( TIFF *tif, ttag_t tag, TIFFDataType dt ); extern TIFFFieldInfo* _TIFFCreateAnonFieldInfo( TIFF *tif, ttag_t tag, TIFFDataType dt ); #define _TIFFFindFieldInfo TIFFFindFieldInfo #define _TIFFFindFieldInfoByName TIFFFindFieldInfoByName #define _TIFFFieldWithTag TIFFFieldWithTag #define _TIFFFieldWithName TIFFFieldWithName #if defined(__cplusplus) } #endif #endif /* _TIFFDIR_ */ /* vim: set ts=8 sts=8 sw=8 noet: */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tiff.h������������������������������������������������������0000644�0001750�0001750�00000101667�12320456500�020450� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tiff.h,v 1.43 2006-10-05 15:20:40 dron Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _TIFF_ #define _TIFF_ #include "tiffconf.h" /* * Tag Image File Format (TIFF) * * Based on Rev 6.0 from: * Developer's Desk * Aldus Corporation * 411 First Ave. South * Suite 200 * Seattle, WA 98104 * 206-622-5500 * * (http://partners.adobe.com/asn/developer/PDFS/TN/TIFF6.pdf) * * For Big TIFF design notes see the following link * http://www.remotesensing.org/libtiff/bigtiffdesign.html */ #define TIFF_VERSION 42 #define TIFF_BIGTIFF_VERSION 43 #define TIFF_BIGENDIAN 0x4d4d #define TIFF_LITTLEENDIAN 0x4949 #define MDI_LITTLEENDIAN 0x5045 #define MDI_BIGENDIAN 0x4550 /* * Intrinsic data types required by the file format: * * 8-bit quantities int8/uint8 * 16-bit quantities int16/uint16 * 32-bit quantities int32/uint32 * strings unsigned char* */ #ifndef HAVE_INT8 typedef signed char int8; /* NB: non-ANSI compilers may not grok */ #endif typedef unsigned char uint8; #ifndef HAVE_INT16 typedef short int16; #endif typedef unsigned short uint16; /* sizeof (uint16) must == 2 */ #if SIZEOF_INT == 4 #ifndef HAVE_INT32 typedef int int32; #endif typedef unsigned int uint32; /* sizeof (uint32) must == 4 */ #elif SIZEOF_LONG == 4 #ifndef HAVE_INT32 typedef long int32; #endif typedef unsigned long uint32; /* sizeof (uint32) must == 4 */ #endif /* For TIFFReassignTagToIgnore */ enum TIFFIgnoreSense /* IGNORE tag table */ { TIS_STORE, TIS_EXTRACT, TIS_EMPTY }; /* * TIFF header. */ typedef struct { uint16 tiff_magic; /* magic number (defines byte order) */ #define TIFF_MAGIC_SIZE 2 uint16 tiff_version; /* TIFF version number */ #define TIFF_VERSION_SIZE 2 uint32 tiff_diroff; /* byte offset to first directory */ #define TIFF_DIROFFSET_SIZE 4 } TIFFHeader; /* * TIFF Image File Directories are comprised of a table of field * descriptors of the form shown below. The table is sorted in * ascending order by tag. The values associated with each entry are * disjoint and may appear anywhere in the file (so long as they are * placed on a word boundary). * * If the value is 4 bytes or less, then it is placed in the offset * field to save space. If the value is less than 4 bytes, it is * left-justified in the offset field. */ typedef struct { uint16 tdir_tag; /* see below */ uint16 tdir_type; /* data type; see below */ uint32 tdir_count; /* number of items; length in spec */ uint32 tdir_offset; /* byte offset to field data */ } TIFFDirEntry; /* * NB: In the comments below, * - items marked with a + are obsoleted by revision 5.0, * - items marked with a ! are introduced in revision 6.0. * - items marked with a % are introduced post revision 6.0. * - items marked with a $ are obsoleted by revision 6.0. * - items marked with a & are introduced by Adobe DNG specification. */ /* * Tag data type information. * * Note: RATIONALs are the ratio of two 32-bit integer values. */ typedef enum { TIFF_NOTYPE = 0, /* placeholder */ TIFF_BYTE = 1, /* 8-bit unsigned integer */ TIFF_ASCII = 2, /* 8-bit bytes w/ last byte null */ TIFF_SHORT = 3, /* 16-bit unsigned integer */ TIFF_LONG = 4, /* 32-bit unsigned integer */ TIFF_RATIONAL = 5, /* 64-bit unsigned fraction */ TIFF_SBYTE = 6, /* !8-bit signed integer */ TIFF_UNDEFINED = 7, /* !8-bit untyped data */ TIFF_SSHORT = 8, /* !16-bit signed integer */ TIFF_SLONG = 9, /* !32-bit signed integer */ TIFF_SRATIONAL = 10, /* !64-bit signed fraction */ TIFF_FLOAT = 11, /* !32-bit IEEE floating point */ TIFF_DOUBLE = 12, /* !64-bit IEEE floating point */ TIFF_IFD = 13 /* %32-bit unsigned integer (offset) */ } TIFFDataType; /* * TIFF Tag Definitions. */ #define TIFFTAG_SUBFILETYPE 254 /* subfile data descriptor */ #define FILETYPE_REDUCEDIMAGE 0x1 /* reduced resolution version */ #define FILETYPE_PAGE 0x2 /* one page of many */ #define FILETYPE_MASK 0x4 /* transparency mask */ #define TIFFTAG_OSUBFILETYPE 255 /* +kind of data in subfile */ #define OFILETYPE_IMAGE 1 /* full resolution image data */ #define OFILETYPE_REDUCEDIMAGE 2 /* reduced size image data */ #define OFILETYPE_PAGE 3 /* one page of many */ #define TIFFTAG_IMAGEWIDTH 256 /* image width in pixels */ #define TIFFTAG_IMAGELENGTH 257 /* image height in pixels */ #define TIFFTAG_BITSPERSAMPLE 258 /* bits per channel (sample) */ #define TIFFTAG_COMPRESSION 259 /* data compression technique */ #define COMPRESSION_NONE 1 /* dump mode */ #define COMPRESSION_CCITTRLE 2 /* CCITT modified Huffman RLE */ #define COMPRESSION_CCITTFAX3 3 /* CCITT Group 3 fax encoding */ #define COMPRESSION_CCITT_T4 3 /* CCITT T.4 (TIFF 6 name) */ #define COMPRESSION_CCITTFAX4 4 /* CCITT Group 4 fax encoding */ #define COMPRESSION_CCITT_T6 4 /* CCITT T.6 (TIFF 6 name) */ #define COMPRESSION_LZW 5 /* Lempel-Ziv & Welch */ #define COMPRESSION_OJPEG 6 /* !6.0 JPEG */ #define COMPRESSION_JPEG 7 /* %JPEG DCT compression */ #define COMPRESSION_NEXT 32766 /* NeXT 2-bit RLE */ #define COMPRESSION_CCITTRLEW 32771 /* #1 w/ word alignment */ #define COMPRESSION_PACKBITS 32773 /* Macintosh RLE */ #define COMPRESSION_THUNDERSCAN 32809 /* ThunderScan RLE */ /* codes 32895-32898 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */ #define COMPRESSION_IT8CTPAD 32895 /* IT8 CT w/padding */ #define COMPRESSION_IT8LW 32896 /* IT8 Linework RLE */ #define COMPRESSION_IT8MP 32897 /* IT8 Monochrome picture */ #define COMPRESSION_IT8BL 32898 /* IT8 Binary line art */ /* compression codes 32908-32911 are reserved for Pixar */ #define COMPRESSION_PIXARFILM 32908 /* Pixar companded 10bit LZW */ #define COMPRESSION_PIXARLOG 32909 /* Pixar companded 11bit ZIP */ #define COMPRESSION_DEFLATE 32946 /* Deflate compression */ #define COMPRESSION_ADOBE_DEFLATE 8 /* Deflate compression, as recognized by Adobe */ /* compression code 32947 is reserved for Oceana Matrix <dev@oceana.com> */ #define COMPRESSION_DCS 32947 /* Kodak DCS encoding */ #define COMPRESSION_JBIG 34661 /* ISO JBIG */ #define COMPRESSION_SGILOG 34676 /* SGI Log Luminance RLE */ #define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */ #define COMPRESSION_JP2000 34712 /* Leadtools JPEG2000 */ #define TIFFTAG_PHOTOMETRIC 262 /* photometric interpretation */ #define PHOTOMETRIC_MINISWHITE 0 /* min value is white */ #define PHOTOMETRIC_MINISBLACK 1 /* min value is black */ #define PHOTOMETRIC_RGB 2 /* RGB color model */ #define PHOTOMETRIC_PALETTE 3 /* color map indexed */ #define PHOTOMETRIC_MASK 4 /* $holdout mask */ #define PHOTOMETRIC_SEPARATED 5 /* !color separations */ #define PHOTOMETRIC_YCBCR 6 /* !CCIR 601 */ #define PHOTOMETRIC_CIELAB 8 /* !1976 CIE L*a*b* */ #define PHOTOMETRIC_ICCLAB 9 /* ICC L*a*b* [Adobe TIFF Technote 4] */ #define PHOTOMETRIC_ITULAB 10 /* ITU L*a*b* */ #define PHOTOMETRIC_LOGL 32844 /* CIE Log2(L) */ #define PHOTOMETRIC_LOGLUV 32845 /* CIE Log2(L) (u',v') */ #define TIFFTAG_THRESHHOLDING 263 /* +thresholding used on data */ #define THRESHHOLD_BILEVEL 1 /* b&w art scan */ #define THRESHHOLD_HALFTONE 2 /* or dithered scan */ #define THRESHHOLD_ERRORDIFFUSE 3 /* usually floyd-steinberg */ #define TIFFTAG_CELLWIDTH 264 /* +dithering matrix width */ #define TIFFTAG_CELLLENGTH 265 /* +dithering matrix height */ #define TIFFTAG_FILLORDER 266 /* data order within a byte */ #define FILLORDER_MSB2LSB 1 /* most significant -> least */ #define FILLORDER_LSB2MSB 2 /* least significant -> most */ #define TIFFTAG_DOCUMENTNAME 269 /* name of doc. image is from */ #define TIFFTAG_IMAGEDESCRIPTION 270 /* info about image */ #define TIFFTAG_MAKE 271 /* scanner manufacturer name */ #define TIFFTAG_MODEL 272 /* scanner model name/number */ #define TIFFTAG_STRIPOFFSETS 273 /* offsets to data strips */ #define TIFFTAG_ORIENTATION 274 /* +image orientation */ #define ORIENTATION_TOPLEFT 1 /* row 0 top, col 0 lhs */ #define ORIENTATION_TOPRIGHT 2 /* row 0 top, col 0 rhs */ #define ORIENTATION_BOTRIGHT 3 /* row 0 bottom, col 0 rhs */ #define ORIENTATION_BOTLEFT 4 /* row 0 bottom, col 0 lhs */ #define ORIENTATION_LEFTTOP 5 /* row 0 lhs, col 0 top */ #define ORIENTATION_RIGHTTOP 6 /* row 0 rhs, col 0 top */ #define ORIENTATION_RIGHTBOT 7 /* row 0 rhs, col 0 bottom */ #define ORIENTATION_LEFTBOT 8 /* row 0 lhs, col 0 bottom */ #define TIFFTAG_SAMPLESPERPIXEL 277 /* samples per pixel */ #define TIFFTAG_ROWSPERSTRIP 278 /* rows per strip of data */ #define TIFFTAG_STRIPBYTECOUNTS 279 /* bytes counts for strips */ #define TIFFTAG_MINSAMPLEVALUE 280 /* +minimum sample value */ #define TIFFTAG_MAXSAMPLEVALUE 281 /* +maximum sample value */ #define TIFFTAG_XRESOLUTION 282 /* pixels/resolution in x */ #define TIFFTAG_YRESOLUTION 283 /* pixels/resolution in y */ #define TIFFTAG_PLANARCONFIG 284 /* storage organization */ #define PLANARCONFIG_CONTIG 1 /* single image plane */ #define PLANARCONFIG_SEPARATE 2 /* separate planes of data */ #define TIFFTAG_PAGENAME 285 /* page name image is from */ #define TIFFTAG_XPOSITION 286 /* x page offset of image lhs */ #define TIFFTAG_YPOSITION 287 /* y page offset of image lhs */ #define TIFFTAG_FREEOFFSETS 288 /* +byte offset to free block */ #define TIFFTAG_FREEBYTECOUNTS 289 /* +sizes of free blocks */ #define TIFFTAG_GRAYRESPONSEUNIT 290 /* $gray scale curve accuracy */ #define GRAYRESPONSEUNIT_10S 1 /* tenths of a unit */ #define GRAYRESPONSEUNIT_100S 2 /* hundredths of a unit */ #define GRAYRESPONSEUNIT_1000S 3 /* thousandths of a unit */ #define GRAYRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */ #define GRAYRESPONSEUNIT_100000S 5 /* hundred-thousandths */ #define TIFFTAG_GRAYRESPONSECURVE 291 /* $gray scale response curve */ #define TIFFTAG_GROUP3OPTIONS 292 /* 32 flag bits */ #define TIFFTAG_T4OPTIONS 292 /* TIFF 6.0 proper name alias */ #define GROUP3OPT_2DENCODING 0x1 /* 2-dimensional coding */ #define GROUP3OPT_UNCOMPRESSED 0x2 /* data not compressed */ #define GROUP3OPT_FILLBITS 0x4 /* fill to byte boundary */ #define TIFFTAG_GROUP4OPTIONS 293 /* 32 flag bits */ #define TIFFTAG_T6OPTIONS 293 /* TIFF 6.0 proper name */ #define GROUP4OPT_UNCOMPRESSED 0x2 /* data not compressed */ #define TIFFTAG_RESOLUTIONUNIT 296 /* units of resolutions */ #define RESUNIT_NONE 1 /* no meaningful units */ #define RESUNIT_INCH 2 /* english */ #define RESUNIT_CENTIMETER 3 /* metric */ #define TIFFTAG_PAGENUMBER 297 /* page numbers of multi-page */ #define TIFFTAG_COLORRESPONSEUNIT 300 /* $color curve accuracy */ #define COLORRESPONSEUNIT_10S 1 /* tenths of a unit */ #define COLORRESPONSEUNIT_100S 2 /* hundredths of a unit */ #define COLORRESPONSEUNIT_1000S 3 /* thousandths of a unit */ #define COLORRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */ #define COLORRESPONSEUNIT_100000S 5 /* hundred-thousandths */ #define TIFFTAG_TRANSFERFUNCTION 301 /* !colorimetry info */ #define TIFFTAG_SOFTWARE 305 /* name & release */ #define TIFFTAG_DATETIME 306 /* creation date and time */ #define TIFFTAG_ARTIST 315 /* creator of image */ #define TIFFTAG_HOSTCOMPUTER 316 /* machine where created */ #define TIFFTAG_PREDICTOR 317 /* prediction scheme w/ LZW */ #define PREDICTOR_NONE 1 /* no prediction scheme used */ #define PREDICTOR_HORIZONTAL 2 /* horizontal differencing */ #define PREDICTOR_FLOATINGPOINT 3 /* floating point predictor */ #define TIFFTAG_WHITEPOINT 318 /* image white point */ #define TIFFTAG_PRIMARYCHROMATICITIES 319 /* !primary chromaticities */ #define TIFFTAG_COLORMAP 320 /* RGB map for pallette image */ #define TIFFTAG_HALFTONEHINTS 321 /* !highlight+shadow info */ #define TIFFTAG_TILEWIDTH 322 /* !tile width in pixels */ #define TIFFTAG_TILELENGTH 323 /* !tile height in pixels */ #define TIFFTAG_TILEOFFSETS 324 /* !offsets to data tiles */ #define TIFFTAG_TILEBYTECOUNTS 325 /* !byte counts for tiles */ #define TIFFTAG_BADFAXLINES 326 /* lines w/ wrong pixel count */ #define TIFFTAG_CLEANFAXDATA 327 /* regenerated line info */ #define CLEANFAXDATA_CLEAN 0 /* no errors detected */ #define CLEANFAXDATA_REGENERATED 1 /* receiver regenerated lines */ #define CLEANFAXDATA_UNCLEAN 2 /* uncorrected errors exist */ #define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */ #define TIFFTAG_SUBIFD 330 /* subimage descriptors */ #define TIFFTAG_INKSET 332 /* !inks in separated image */ #define INKSET_CMYK 1 /* !cyan-magenta-yellow-black color */ #define INKSET_MULTIINK 2 /* !multi-ink or hi-fi color */ #define TIFFTAG_INKNAMES 333 /* !ascii names of inks */ #define TIFFTAG_NUMBEROFINKS 334 /* !number of inks */ #define TIFFTAG_DOTRANGE 336 /* !0% and 100% dot codes */ #define TIFFTAG_TARGETPRINTER 337 /* !separation target */ #define TIFFTAG_EXTRASAMPLES 338 /* !info about extra samples */ #define EXTRASAMPLE_UNSPECIFIED 0 /* !unspecified data */ #define EXTRASAMPLE_ASSOCALPHA 1 /* !associated alpha data */ #define EXTRASAMPLE_UNASSALPHA 2 /* !unassociated alpha data */ #define TIFFTAG_SAMPLEFORMAT 339 /* !data sample format */ #define SAMPLEFORMAT_UINT 1 /* !unsigned integer data */ #define SAMPLEFORMAT_INT 2 /* !signed integer data */ #define SAMPLEFORMAT_IEEEFP 3 /* !IEEE floating point data */ #define SAMPLEFORMAT_VOID 4 /* !untyped data */ #define SAMPLEFORMAT_COMPLEXINT 5 /* !complex signed int */ #define SAMPLEFORMAT_COMPLEXIEEEFP 6 /* !complex ieee floating */ #define TIFFTAG_SMINSAMPLEVALUE 340 /* !variable MinSampleValue */ #define TIFFTAG_SMAXSAMPLEVALUE 341 /* !variable MaxSampleValue */ #define TIFFTAG_CLIPPATH 343 /* %ClipPath [Adobe TIFF technote 2] */ #define TIFFTAG_XCLIPPATHUNITS 344 /* %XClipPathUnits [Adobe TIFF technote 2] */ #define TIFFTAG_YCLIPPATHUNITS 345 /* %YClipPathUnits [Adobe TIFF technote 2] */ #define TIFFTAG_INDEXED 346 /* %Indexed [Adobe TIFF Technote 3] */ #define TIFFTAG_JPEGTABLES 347 /* %JPEG table stream */ #define TIFFTAG_OPIPROXY 351 /* %OPI Proxy [Adobe TIFF technote] */ /* * Tags 512-521 are obsoleted by Technical Note #2 which specifies a * revised JPEG-in-TIFF scheme. */ #define TIFFTAG_JPEGPROC 512 /* !JPEG processing algorithm */ #define JPEGPROC_BASELINE 1 /* !baseline sequential */ #define JPEGPROC_LOSSLESS 14 /* !Huffman coded lossless */ #define TIFFTAG_JPEGIFOFFSET 513 /* !pointer to SOI marker */ #define TIFFTAG_JPEGIFBYTECOUNT 514 /* !JFIF stream length */ #define TIFFTAG_JPEGRESTARTINTERVAL 515 /* !restart interval length */ #define TIFFTAG_JPEGLOSSLESSPREDICTORS 517 /* !lossless proc predictor */ #define TIFFTAG_JPEGPOINTTRANSFORM 518 /* !lossless point transform */ #define TIFFTAG_JPEGQTABLES 519 /* !Q matrice offsets */ #define TIFFTAG_JPEGDCTABLES 520 /* !DCT table offsets */ #define TIFFTAG_JPEGACTABLES 521 /* !AC coefficient offsets */ #define TIFFTAG_YCBCRCOEFFICIENTS 529 /* !RGB -> YCbCr transform */ #define TIFFTAG_YCBCRSUBSAMPLING 530 /* !YCbCr subsampling factors */ #define TIFFTAG_YCBCRPOSITIONING 531 /* !subsample positioning */ #define YCBCRPOSITION_CENTERED 1 /* !as in PostScript Level 2 */ #define YCBCRPOSITION_COSITED 2 /* !as in CCIR 601-1 */ #define TIFFTAG_REFERENCEBLACKWHITE 532 /* !colorimetry info */ #define TIFFTAG_XMLPACKET 700 /* %XML packet [Adobe XMP Specification, January 2004 */ #define TIFFTAG_OPIIMAGEID 32781 /* %OPI ImageID [Adobe TIFF technote] */ /* tags 32952-32956 are private tags registered to Island Graphics */ #define TIFFTAG_REFPTS 32953 /* image reference points */ #define TIFFTAG_REGIONTACKPOINT 32954 /* region-xform tack point */ #define TIFFTAG_REGIONWARPCORNERS 32955 /* warp quadrilateral */ #define TIFFTAG_REGIONAFFINE 32956 /* affine transformation mat */ /* tags 32995-32999 are private tags registered to SGI */ #define TIFFTAG_MATTEING 32995 /* $use ExtraSamples */ #define TIFFTAG_DATATYPE 32996 /* $use SampleFormat */ #define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */ #define TIFFTAG_TILEDEPTH 32998 /* z depth/data tile */ /* tags 33300-33309 are private tags registered to Pixar */ /* * TIFFTAG_PIXAR_IMAGEFULLWIDTH and TIFFTAG_PIXAR_IMAGEFULLLENGTH * are set when an image has been cropped out of a larger image. * They reflect the size of the original uncropped image. * The TIFFTAG_XPOSITION and TIFFTAG_YPOSITION can be used * to determine the position of the smaller image in the larger one. */ #define TIFFTAG_PIXAR_IMAGEFULLWIDTH 33300 /* full image size in x */ #define TIFFTAG_PIXAR_IMAGEFULLLENGTH 33301 /* full image size in y */ /* Tags 33302-33306 are used to identify special image modes and data * used by Pixar's texture formats. */ #define TIFFTAG_PIXAR_TEXTUREFORMAT 33302 /* texture map format */ #define TIFFTAG_PIXAR_WRAPMODES 33303 /* s & t wrap modes */ #define TIFFTAG_PIXAR_FOVCOT 33304 /* cotan(fov) for env. maps */ #define TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN 33305 #define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA 33306 /* tag 33405 is a private tag registered to Eastman Kodak */ #define TIFFTAG_WRITERSERIALNUMBER 33405 /* device serial number */ /* tag 33432 is listed in the 6.0 spec w/ unknown ownership */ #define TIFFTAG_COPYRIGHT 33432 /* copyright string */ /* IPTC TAG from RichTIFF specifications */ #define TIFFTAG_RICHTIFFIPTC 33723 /* 34016-34029 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */ #define TIFFTAG_IT8SITE 34016 /* site name */ #define TIFFTAG_IT8COLORSEQUENCE 34017 /* color seq. [RGB,CMYK,etc] */ #define TIFFTAG_IT8HEADER 34018 /* DDES Header */ #define TIFFTAG_IT8RASTERPADDING 34019 /* raster scanline padding */ #define TIFFTAG_IT8BITSPERRUNLENGTH 34020 /* # of bits in short run */ #define TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH 34021/* # of bits in long run */ #define TIFFTAG_IT8COLORTABLE 34022 /* LW colortable */ #define TIFFTAG_IT8IMAGECOLORINDICATOR 34023 /* BP/BL image color switch */ #define TIFFTAG_IT8BKGCOLORINDICATOR 34024 /* BP/BL bg color switch */ #define TIFFTAG_IT8IMAGECOLORVALUE 34025 /* BP/BL image color value */ #define TIFFTAG_IT8BKGCOLORVALUE 34026 /* BP/BL bg color value */ #define TIFFTAG_IT8PIXELINTENSITYRANGE 34027 /* MP pixel intensity value */ #define TIFFTAG_IT8TRANSPARENCYINDICATOR 34028 /* HC transparency switch */ #define TIFFTAG_IT8COLORCHARACTERIZATION 34029 /* color character. table */ #define TIFFTAG_IT8HCUSAGE 34030 /* HC usage indicator */ #define TIFFTAG_IT8TRAPINDICATOR 34031 /* Trapping indicator (untrapped=0, trapped=1) */ #define TIFFTAG_IT8CMYKEQUIVALENT 34032 /* CMYK color equivalents */ /* tags 34232-34236 are private tags registered to Texas Instruments */ #define TIFFTAG_FRAMECOUNT 34232 /* Sequence Frame Count */ /* tag 34377 is private tag registered to Adobe for PhotoShop */ #define TIFFTAG_PHOTOSHOP 34377 /* tags 34665, 34853 and 40965 are documented in EXIF specification */ #define TIFFTAG_EXIFIFD 34665 /* Pointer to EXIF private directory */ /* tag 34750 is a private tag registered to Adobe? */ #define TIFFTAG_ICCPROFILE 34675 /* ICC profile data */ /* tag 34750 is a private tag registered to Pixel Magic */ #define TIFFTAG_JBIGOPTIONS 34750 /* JBIG options */ #define TIFFTAG_GPSIFD 34853 /* Pointer to GPS private directory */ /* tags 34908-34914 are private tags registered to SGI */ #define TIFFTAG_FAXRECVPARAMS 34908 /* encoded Class 2 ses. parms */ #define TIFFTAG_FAXSUBADDRESS 34909 /* received SubAddr string */ #define TIFFTAG_FAXRECVTIME 34910 /* receive time (secs) */ #define TIFFTAG_FAXDCS 34911 /* encoded fax ses. params, Table 2/T.30 */ /* tags 37439-37443 are registered to SGI <gregl@sgi.com> */ #define TIFFTAG_STONITS 37439 /* Sample value to Nits */ /* tag 34929 is a private tag registered to FedEx */ #define TIFFTAG_FEDEX_EDR 34929 /* unknown use */ #define TIFFTAG_INTEROPERABILITYIFD 40965 /* Pointer to Interoperability private directory */ /* Adobe Digital Negative (DNG) format tags */ #define TIFFTAG_DNGVERSION 50706 /* &DNG version number */ #define TIFFTAG_DNGBACKWARDVERSION 50707 /* &DNG compatibility version */ #define TIFFTAG_UNIQUECAMERAMODEL 50708 /* &name for the camera model */ #define TIFFTAG_LOCALIZEDCAMERAMODEL 50709 /* &localized camera model name */ #define TIFFTAG_CFAPLANECOLOR 50710 /* &CFAPattern->LinearRaw space mapping */ #define TIFFTAG_CFALAYOUT 50711 /* &spatial layout of the CFA */ #define TIFFTAG_LINEARIZATIONTABLE 50712 /* &lookup table description */ #define TIFFTAG_BLACKLEVELREPEATDIM 50713 /* &repeat pattern size for the BlackLevel tag */ #define TIFFTAG_BLACKLEVEL 50714 /* &zero light encoding level */ #define TIFFTAG_BLACKLEVELDELTAH 50715 /* &zero light encoding level differences (columns) */ #define TIFFTAG_BLACKLEVELDELTAV 50716 /* &zero light encoding level differences (rows) */ #define TIFFTAG_WHITELEVEL 50717 /* &fully saturated encoding level */ #define TIFFTAG_DEFAULTSCALE 50718 /* &default scale factors */ #define TIFFTAG_DEFAULTCROPORIGIN 50719 /* &origin of the final image area */ #define TIFFTAG_DEFAULTCROPSIZE 50720 /* &size of the final image area */ #define TIFFTAG_COLORMATRIX1 50721 /* &XYZ->reference color space transformation matrix 1 */ #define TIFFTAG_COLORMATRIX2 50722 /* &XYZ->reference color space transformation matrix 2 */ #define TIFFTAG_CAMERACALIBRATION1 50723 /* &calibration matrix 1 */ #define TIFFTAG_CAMERACALIBRATION2 50724 /* &calibration matrix 2 */ #define TIFFTAG_REDUCTIONMATRIX1 50725 /* &dimensionality reduction matrix 1 */ #define TIFFTAG_REDUCTIONMATRIX2 50726 /* &dimensionality reduction matrix 2 */ #define TIFFTAG_ANALOGBALANCE 50727 /* &gain applied the stored raw values*/ #define TIFFTAG_ASSHOTNEUTRAL 50728 /* &selected white balance in linear reference space */ #define TIFFTAG_ASSHOTWHITEXY 50729 /* &selected white balance in x-y chromaticity coordinates */ #define TIFFTAG_BASELINEEXPOSURE 50730 /* &how much to move the zero point */ #define TIFFTAG_BASELINENOISE 50731 /* &relative noise level */ #define TIFFTAG_BASELINESHARPNESS 50732 /* &relative amount of sharpening */ #define TIFFTAG_BAYERGREENSPLIT 50733 /* &how closely the values of the green pixels in the blue/green rows track the values of the green pixels in the red/green rows */ #define TIFFTAG_LINEARRESPONSELIMIT 50734 /* &non-linear encoding range */ #define TIFFTAG_CAMERASERIALNUMBER 50735 /* &camera's serial number */ #define TIFFTAG_LENSINFO 50736 /* info about the lens */ #define TIFFTAG_CHROMABLURRADIUS 50737 /* &chroma blur radius */ #define TIFFTAG_ANTIALIASSTRENGTH 50738 /* &relative strength of the camera's anti-alias filter */ #define TIFFTAG_SHADOWSCALE 50739 /* &used by Adobe Camera Raw */ #define TIFFTAG_DNGPRIVATEDATA 50740 /* &manufacturer's private data */ #define TIFFTAG_MAKERNOTESAFETY 50741 /* &whether the EXIF MakerNote tag is safe to preserve along with the rest of the EXIF data */ #define TIFFTAG_CALIBRATIONILLUMINANT1 50778 /* &illuminant 1 */ #define TIFFTAG_CALIBRATIONILLUMINANT2 50779 /* &illuminant 2 */ #define TIFFTAG_BESTQUALITYSCALE 50780 /* &best quality multiplier */ #define TIFFTAG_RAWDATAUNIQUEID 50781 /* &unique identifier for the raw image data */ #define TIFFTAG_ORIGINALRAWFILENAME 50827 /* &file name of the original raw file */ #define TIFFTAG_ORIGINALRAWFILEDATA 50828 /* &contents of the original raw file */ #define TIFFTAG_ACTIVEAREA 50829 /* &active (non-masked) pixels of the sensor */ #define TIFFTAG_MASKEDAREAS 50830 /* &list of coordinates of fully masked pixels */ #define TIFFTAG_ASSHOTICCPROFILE 50831 /* &these two tags used to */ #define TIFFTAG_ASSHOTPREPROFILEMATRIX 50832 /* map cameras's color space into ICC profile space */ #define TIFFTAG_CURRENTICCPROFILE 50833 /* & */ #define TIFFTAG_CURRENTPREPROFILEMATRIX 50834 /* & */ /* tag 65535 is an undefined tag used by Eastman Kodak */ #define TIFFTAG_DCSHUESHIFTVALUES 65535 /* hue shift correction data */ /* * The following are ``pseudo tags'' that can be used to control * codec-specific functionality. These tags are not written to file. * Note that these values start at 0xffff+1 so that they'll never * collide with Aldus-assigned tags. * * If you want your private pseudo tags ``registered'' (i.e. added to * this file), please post a bug report via the tracking system at * http://www.remotesensing.org/libtiff/bugs.html with the appropriate * C definitions to add. */ #define TIFFTAG_FAXMODE 65536 /* Group 3/4 format control */ #define FAXMODE_CLASSIC 0x0000 /* default, include RTC */ #define FAXMODE_NORTC 0x0001 /* no RTC at end of data */ #define FAXMODE_NOEOL 0x0002 /* no EOL code at end of row */ #define FAXMODE_BYTEALIGN 0x0004 /* byte align row */ #define FAXMODE_WORDALIGN 0x0008 /* word align row */ #define FAXMODE_CLASSF FAXMODE_NORTC /* TIFF Class F */ #define TIFFTAG_JPEGQUALITY 65537 /* Compression quality level */ /* Note: quality level is on the IJG 0-100 scale. Default value is 75 */ #define TIFFTAG_JPEGCOLORMODE 65538 /* Auto RGB<=>YCbCr convert? */ #define JPEGCOLORMODE_RAW 0x0000 /* no conversion (default) */ #define JPEGCOLORMODE_RGB 0x0001 /* do auto conversion */ #define TIFFTAG_JPEGTABLESMODE 65539 /* What to put in JPEGTables */ #define JPEGTABLESMODE_QUANT 0x0001 /* include quantization tbls */ #define JPEGTABLESMODE_HUFF 0x0002 /* include Huffman tbls */ /* Note: default is JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF */ #define TIFFTAG_FAXFILLFUNC 65540 /* G3/G4 fill function */ #define TIFFTAG_PIXARLOGDATAFMT 65549 /* PixarLogCodec I/O data sz */ #define PIXARLOGDATAFMT_8BIT 0 /* regular u_char samples */ #define PIXARLOGDATAFMT_8BITABGR 1 /* ABGR-order u_chars */ #define PIXARLOGDATAFMT_11BITLOG 2 /* 11-bit log-encoded (raw) */ #define PIXARLOGDATAFMT_12BITPICIO 3 /* as per PICIO (1.0==2048) */ #define PIXARLOGDATAFMT_16BIT 4 /* signed short samples */ #define PIXARLOGDATAFMT_FLOAT 5 /* IEEE float samples */ /* 65550-65556 are allocated to Oceana Matrix <dev@oceana.com> */ #define TIFFTAG_DCSIMAGERTYPE 65550 /* imager model & filter */ #define DCSIMAGERMODEL_M3 0 /* M3 chip (1280 x 1024) */ #define DCSIMAGERMODEL_M5 1 /* M5 chip (1536 x 1024) */ #define DCSIMAGERMODEL_M6 2 /* M6 chip (3072 x 2048) */ #define DCSIMAGERFILTER_IR 0 /* infrared filter */ #define DCSIMAGERFILTER_MONO 1 /* monochrome filter */ #define DCSIMAGERFILTER_CFA 2 /* color filter array */ #define DCSIMAGERFILTER_OTHER 3 /* other filter */ #define TIFFTAG_DCSINTERPMODE 65551 /* interpolation mode */ #define DCSINTERPMODE_NORMAL 0x0 /* whole image, default */ #define DCSINTERPMODE_PREVIEW 0x1 /* preview of image (384x256) */ #define TIFFTAG_DCSBALANCEARRAY 65552 /* color balance values */ #define TIFFTAG_DCSCORRECTMATRIX 65553 /* color correction values */ #define TIFFTAG_DCSGAMMA 65554 /* gamma value */ #define TIFFTAG_DCSTOESHOULDERPTS 65555 /* toe & shoulder points */ #define TIFFTAG_DCSCALIBRATIONFD 65556 /* calibration file desc */ /* Note: quality level is on the ZLIB 1-9 scale. Default value is -1 */ #define TIFFTAG_ZIPQUALITY 65557 /* compression quality level */ #define TIFFTAG_PIXARLOGQUALITY 65558 /* PixarLog uses same scale */ /* 65559 is allocated to Oceana Matrix <dev@oceana.com> */ #define TIFFTAG_DCSCLIPRECTANGLE 65559 /* area of image to acquire */ #define TIFFTAG_SGILOGDATAFMT 65560 /* SGILog user data format */ #define SGILOGDATAFMT_FLOAT 0 /* IEEE float samples */ #define SGILOGDATAFMT_16BIT 1 /* 16-bit samples */ #define SGILOGDATAFMT_RAW 2 /* uninterpreted data */ #define SGILOGDATAFMT_8BIT 3 /* 8-bit RGB monitor values */ #define TIFFTAG_SGILOGENCODE 65561 /* SGILog data encoding control*/ #define SGILOGENCODE_NODITHER 0 /* do not dither encoded values*/ #define SGILOGENCODE_RANDITHER 1 /* randomly dither encd values */ /* * EXIF tags */ #define EXIFTAG_EXPOSURETIME 33434 /* Exposure time */ #define EXIFTAG_FNUMBER 33437 /* F number */ #define EXIFTAG_EXPOSUREPROGRAM 34850 /* Exposure program */ #define EXIFTAG_SPECTRALSENSITIVITY 34852 /* Spectral sensitivity */ #define EXIFTAG_ISOSPEEDRATINGS 34855 /* ISO speed rating */ #define EXIFTAG_OECF 34856 /* Optoelectric conversion factor */ #define EXIFTAG_EXIFVERSION 36864 /* Exif version */ #define EXIFTAG_DATETIMEORIGINAL 36867 /* Date and time of original data generation */ #define EXIFTAG_DATETIMEDIGITIZED 36868 /* Date and time of digital data generation */ #define EXIFTAG_COMPONENTSCONFIGURATION 37121 /* Meaning of each component */ #define EXIFTAG_COMPRESSEDBITSPERPIXEL 37122 /* Image compression mode */ #define EXIFTAG_SHUTTERSPEEDVALUE 37377 /* Shutter speed */ #define EXIFTAG_APERTUREVALUE 37378 /* Aperture */ #define EXIFTAG_BRIGHTNESSVALUE 37379 /* Brightness */ #define EXIFTAG_EXPOSUREBIASVALUE 37380 /* Exposure bias */ #define EXIFTAG_MAXAPERTUREVALUE 37381 /* Maximum lens aperture */ #define EXIFTAG_SUBJECTDISTANCE 37382 /* Subject distance */ #define EXIFTAG_METERINGMODE 37383 /* Metering mode */ #define EXIFTAG_LIGHTSOURCE 37384 /* Light source */ #define EXIFTAG_FLASH 37385 /* Flash */ #define EXIFTAG_FOCALLENGTH 37386 /* Lens focal length */ #define EXIFTAG_SUBJECTAREA 37396 /* Subject area */ #define EXIFTAG_MAKERNOTE 37500 /* Manufacturer notes */ #define EXIFTAG_USERCOMMENT 37510 /* User comments */ #define EXIFTAG_SUBSECTIME 37520 /* DateTime subseconds */ #define EXIFTAG_SUBSECTIMEORIGINAL 37521 /* DateTimeOriginal subseconds */ #define EXIFTAG_SUBSECTIMEDIGITIZED 37522 /* DateTimeDigitized subseconds */ #define EXIFTAG_FLASHPIXVERSION 40960 /* Supported Flashpix version */ #define EXIFTAG_COLORSPACE 40961 /* Color space information */ #define EXIFTAG_PIXELXDIMENSION 40962 /* Valid image width */ #define EXIFTAG_PIXELYDIMENSION 40963 /* Valid image height */ #define EXIFTAG_RELATEDSOUNDFILE 40964 /* Related audio file */ #define EXIFTAG_FLASHENERGY 41483 /* Flash energy */ #define EXIFTAG_SPATIALFREQUENCYRESPONSE 41484 /* Spatial frequency response */ #define EXIFTAG_FOCALPLANEXRESOLUTION 41486 /* Focal plane X resolution */ #define EXIFTAG_FOCALPLANEYRESOLUTION 41487 /* Focal plane Y resolution */ #define EXIFTAG_FOCALPLANERESOLUTIONUNIT 41488 /* Focal plane resolution unit */ #define EXIFTAG_SUBJECTLOCATION 41492 /* Subject location */ #define EXIFTAG_EXPOSUREINDEX 41493 /* Exposure index */ #define EXIFTAG_SENSINGMETHOD 41495 /* Sensing method */ #define EXIFTAG_FILESOURCE 41728 /* File source */ #define EXIFTAG_SCENETYPE 41729 /* Scene type */ #define EXIFTAG_CFAPATTERN 41730 /* CFA pattern */ #define EXIFTAG_CUSTOMRENDERED 41985 /* Custom image processing */ #define EXIFTAG_EXPOSUREMODE 41986 /* Exposure mode */ #define EXIFTAG_WHITEBALANCE 41987 /* White balance */ #define EXIFTAG_DIGITALZOOMRATIO 41988 /* Digital zoom ratio */ #define EXIFTAG_FOCALLENGTHIN35MMFILM 41989 /* Focal length in 35 mm film */ #define EXIFTAG_SCENECAPTURETYPE 41990 /* Scene capture type */ #define EXIFTAG_GAINCONTROL 41991 /* Gain control */ #define EXIFTAG_CONTRAST 41992 /* Contrast */ #define EXIFTAG_SATURATION 41993 /* Saturation */ #define EXIFTAG_SHARPNESS 41994 /* Sharpness */ #define EXIFTAG_DEVICESETTINGDESCRIPTION 41995 /* Device settings description */ #define EXIFTAG_SUBJECTDISTANCERANGE 41996 /* Subject distance range */ #define EXIFTAG_GAINCONTROL 41991 /* Gain control */ #define EXIFTAG_GAINCONTROL 41991 /* Gain control */ #define EXIFTAG_IMAGEUNIQUEID 42016 /* Unique image ID */ #endif /* _TIFF_ */ /* vim: set ts=8 sts=8 sw=8 noet: */ �������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_fax3sm.c������������������������������������������������0000644�0001750�0001750�00000314316�12320456500�021553� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* WARNING, this file was automatically generated by the mkg3states program */ #include "tiff.h" #include "tif_fax3.h" const TIFFFaxTabEnt TIFFFaxMainTable[128] = { {12,7,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{1,4,0},{3,1,0}, {5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{5,6,2},{3,1,0},{5,3,1},{3,1,0}, {2,3,0},{3,1,0},{4,3,1},{3,1,0},{1,4,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0}, {4,3,1},{3,1,0},{5,7,3},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0}, {1,4,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{4,6,2},{3,1,0}, {5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{1,4,0},{3,1,0},{5,3,1},{3,1,0}, {2,3,0},{3,1,0},{4,3,1},{3,1,0},{6,7,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0}, {4,3,1},{3,1,0},{1,4,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0}, {5,6,2},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{1,4,0},{3,1,0}, {5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{4,7,3},{3,1,0},{5,3,1},{3,1,0}, {2,3,0},{3,1,0},{4,3,1},{3,1,0},{1,4,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0}, {4,3,1},{3,1,0},{4,6,2},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0}, {1,4,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0} }; const TIFFFaxTabEnt TIFFFaxWhiteTable[4096] = { {12,11,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128}, {7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5}, {7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6}, {7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7}, {7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,960},{7,4,6},{7,8,31},{7,5,8}, {7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5}, {7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,11,1792},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14}, {7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16}, {9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128}, {7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1600},{7,4,5}, {7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3}, {7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9}, {9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4}, {7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6}, {7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3}, {7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15}, {7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1536},{7,4,5},{7,8,43},{7,6,17}, {9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128}, {7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5}, {7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,768},{7,4,6}, {7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,11,1856},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7}, {7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,896},{7,4,6},{7,7,19},{7,5,8}, {7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5}, {7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5},{7,8,44},{7,6,17},{9,9,1408},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14}, {7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16}, {9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128}, {7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5}, {7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3}, {7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9}, {9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4}, {7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,960},{7,4,6}, {7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3}, {7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15}, {9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17}, {9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {11,12,2112},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128}, {7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5}, {7,8,40},{7,6,16},{9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6}, {7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {9,9,1600},{7,4,5},{7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7}, {7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6},{7,8,32},{7,5,8}, {7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5}, {7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14}, {7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16}, {9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128}, {7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1536},{7,4,5}, {7,8,43},{7,6,17},{9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3}, {7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9}, {9,9,768},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,12,2368},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4}, {7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,896},{7,4,6}, {7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3}, {7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15}, {7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5},{7,8,44},{7,6,17}, {9,9,1408},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128}, {7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5}, {7,8,42},{7,6,16},{9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6}, {7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7}, {7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8}, {7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5}, {7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14}, {7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16}, {9,9,960},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128}, {7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5}, {7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{11,12,1984},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3}, {7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9}, {9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{9,9,1600},{7,4,5},{7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4}, {7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6}, {7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3}, {7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15}, {9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17}, {9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128}, {7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5}, {7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6}, {7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {9,9,1536},{7,4,5},{7,8,43},{7,6,17},{9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7}, {7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8}, {7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5}, {7,7,26},{7,5,9},{9,9,768},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,11,1920},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14}, {7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16}, {9,9,896},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128}, {7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5}, {7,8,44},{7,6,17},{9,9,1408},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3}, {7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9}, {9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4}, {7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6}, {7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3}, {7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15}, {7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1472},{7,4,5},{7,8,43},{7,6,17}, {9,9,1216},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128}, {7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5}, {7,8,41},{7,6,16},{9,9,960},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,704},{7,4,6}, {7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,12,2240},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7}, {7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,832},{7,4,6},{7,7,19},{7,5,8}, {7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5}, {7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1600},{7,4,5},{7,8,44},{7,6,17},{9,9,1344},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14}, {7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16}, {9,9,1088},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128}, {7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5}, {7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3}, {7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9}, {9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{9,9,1536},{7,4,5},{7,8,43},{7,6,17},{9,9,1280},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4}, {7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,1024},{7,4,6}, {7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3}, {7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,768},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15}, {9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17}, {9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {11,12,2496},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128}, {7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5}, {7,8,40},{7,6,16},{9,9,896},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6}, {7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {9,9,1728},{7,4,5},{7,8,44},{7,6,17},{9,9,1408},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7}, {7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1152},{7,4,6},{7,8,32},{7,5,8}, {7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5}, {7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{12,11,0},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14}, {7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16}, {9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128}, {7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1472},{7,4,5}, {7,8,43},{7,6,17},{9,9,1216},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3}, {7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,960},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9}, {9,9,704},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,11,1792},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4}, {7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,832},{7,4,6}, {7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3}, {7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15}, {7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1600},{7,4,5},{7,8,44},{7,6,17}, {9,9,1344},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128}, {7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5}, {7,8,42},{7,6,16},{9,9,1088},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6}, {7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7}, {7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8}, {7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5}, {7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1536},{7,4,5},{7,8,43},{7,6,17},{9,9,1280},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14}, {7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16}, {9,9,1024},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,768},{7,4,6},{7,8,37},{9,5,128}, {7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5}, {7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{11,11,1856},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3}, {7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,896},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9}, {9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{9,9,1728},{7,4,5},{7,8,44},{7,6,17},{9,9,1408},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4}, {7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1152},{7,4,6}, {7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3}, {7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15}, {9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17}, {9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128}, {7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5}, {7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6}, {7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7}, {7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,960},{7,4,6},{7,8,31},{7,5,8}, {7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5}, {7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,12,2176},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14}, {7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16}, {9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128}, {7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1600},{7,4,5}, {7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3}, {7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9}, {9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4}, {7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6}, {7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3}, {7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15}, {7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1536},{7,4,5},{7,8,43},{7,6,17}, {9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128}, {7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5}, {7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,768},{7,4,6}, {7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,12,2432},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7}, {7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,896},{7,4,6},{7,7,19},{7,5,8}, {7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5}, {7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5},{7,8,44},{7,6,17},{9,9,1408},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14}, {7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16}, {9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128}, {7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5}, {7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3}, {7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9}, {9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4}, {7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,960},{7,4,6}, {7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3}, {7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15}, {9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17}, {9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {11,12,2048},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128}, {7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5}, {7,8,40},{7,6,16},{9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6}, {7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {9,9,1600},{7,4,5},{7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7}, {7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6},{7,8,32},{7,5,8}, {7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5}, {7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14}, {7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16}, {9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128}, {7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1536},{7,4,5}, {7,8,43},{7,6,17},{9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3}, {7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9}, {9,9,768},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,11,1920},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4}, {7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,896},{7,4,6}, {7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3}, {7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15}, {7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5},{7,8,44},{7,6,17}, {9,9,1408},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128}, {7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5}, {7,8,42},{7,6,16},{9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6}, {7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7}, {7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8}, {7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5}, {7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14}, {7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16}, {9,9,960},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128}, {7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5}, {7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{11,12,2304},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3}, {7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9}, {9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{9,9,1600},{7,4,5},{7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4}, {7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6}, {7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3}, {7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15}, {9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17}, {9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128}, {7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5}, {7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6}, {7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {9,9,1536},{7,4,5},{7,8,43},{7,6,17},{9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7}, {7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8}, {7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5}, {7,7,26},{7,5,9},{9,9,768},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,12,2560},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14}, {7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16}, {9,9,896},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128}, {7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5}, {7,8,44},{7,6,17},{9,9,1408},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3}, {7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9}, {9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7} }; const TIFFFaxTabEnt TIFFFaxBlackTable[8192] = { {12,11,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,18},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,17},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1792},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,11,23},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,20},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,11,25},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,128},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,56},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,30},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1856},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,57},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,11,21},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,54},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,52},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,48},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {11,12,2112},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,44},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,36},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,384},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,28},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,60},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,40},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2368},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,16},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {10,10,64},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,18},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,10,17},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{11,12,1984},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,50},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,34},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1664},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,26},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1408},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,32},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1920},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,61},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,42},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{10,13,1024},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {10,13,768},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,62},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2240},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,46},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,38},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,512},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,11,19},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,24},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,22},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {11,12,2496},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,10,16},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,0},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,10,64},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{12,11,0},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,10,18},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,17},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1792},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,23},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,20},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,11,25},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{10,12,192},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1280},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,31},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{11,11,1856},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,58},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,11,21},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,896},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,640},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,49},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2176},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,45},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,37},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{10,12,448},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,29},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {10,13,1536},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,41},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2432},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,16},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,10,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,10,64},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,18},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,17},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {11,12,2048},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,51},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,35},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,320},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,27},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,59},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,33},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1920},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,256},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,43},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {10,13,1152},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,55},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,63},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{11,12,2304},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,47},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,39},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,53},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,19},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,24},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,22},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2560},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,10,16},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,0},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{10,10,64},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{12,11,0},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,10,18},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,10,17},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1792},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,23},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,11,20},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,25},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {10,12,128},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,56},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,30},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {11,11,1856},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,57},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,21},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,54},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,52},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,48},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2112},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,44},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,36},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {10,12,384},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,28},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,60},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,40},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{11,12,2368},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,16},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,10,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,10,64},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,18},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,17},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,1984},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,50},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,34},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{10,13,1728},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,26},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {10,13,1472},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,32},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1920},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,61},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,42},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1088},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,832},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,62},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {11,12,2240},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,46},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,38},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,576},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,19},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,11,24},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,22},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2496},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,16},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {10,10,64},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{12,11,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,18},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,10,17},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{11,11,1792},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,23},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,11,20},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,25},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,192},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1344},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,31},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1856},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,58},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,21},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{10,13,960},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {10,13,704},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,49},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2176},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,45},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,37},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,448},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,29},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1600},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,41},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {11,12,2432},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,10,16},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,0},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,10,64},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,10,18},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,17},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2048},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,51},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,35},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {10,12,320},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,27},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,59},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,33},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{11,11,1920},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,256},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,43},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1216},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,55},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,63},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2304},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,47},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,39},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,53},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,19},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,11,24},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,11,22},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2560},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,16},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,10,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,10,64},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2} }; ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tiffiop.h���������������������������������������������������0000644�0001750�0001750�00000031572�12320456500�021155� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tiffiop.h,v 1.51.2.1 2009-01-06 19:08:09 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _TIFFIOP_ #define _TIFFIOP_ /* * ``Library-private'' definitions. */ #include "tif_config.h" #ifdef HAVE_FCNTL_H # include <fcntl.h> #endif #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif #ifdef HAVE_STRING_H # include <string.h> #endif #ifdef HAVE_ASSERT_H # include <assert.h> #else # define assert(x) #endif #ifdef HAVE_SEARCH_H # include <search.h> #else extern void *lfind(const void *, const void *, size_t *, size_t, int (*)(const void *, const void *)); #endif /* Libtiff itself does not require a 64-bit type, but bundled TIFF utilities may use it. */ #if 0 /* Hack for Tuvok! */ typedef TIFF_INT64_T int64; typedef TIFF_UINT64_T uint64; #endif #include "tiffio.h" #include "tif_dir.h" #ifndef STRIP_SIZE_DEFAULT # define STRIP_SIZE_DEFAULT 8192 #endif #define streq(a,b) (strcmp(a,b) == 0) #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif typedef struct client_info { struct client_info *next; void *data; char *name; } TIFFClientInfoLink; /* * Typedefs for ``method pointers'' used internally. */ typedef unsigned char tidataval_t; /* internal image data value type */ typedef tidataval_t* tidata_t; /* reference to internal image data */ typedef void (*TIFFVoidMethod)(TIFF*); typedef int (*TIFFBoolMethod)(TIFF*); typedef int (*TIFFPreMethod)(TIFF*, tsample_t); typedef int (*TIFFCodeMethod)(TIFF*, tidata_t, tsize_t, tsample_t); typedef int (*TIFFSeekMethod)(TIFF*, uint32); typedef void (*TIFFPostMethod)(TIFF*, tidata_t, tsize_t); typedef uint32 (*TIFFStripMethod)(TIFF*, uint32); typedef void (*TIFFTileMethod)(TIFF*, uint32*, uint32*); struct tiff { char* tif_name; /* name of open file */ int tif_fd; /* open file descriptor */ int tif_mode; /* open mode (O_*) */ uint32 tif_flags; #define TIFF_FILLORDER 0x00003 /* natural bit fill order for machine */ #define TIFF_DIRTYHEADER 0x00004 /* header must be written on close */ #define TIFF_DIRTYDIRECT 0x00008 /* current directory must be written */ #define TIFF_BUFFERSETUP 0x00010 /* data buffers setup */ #define TIFF_CODERSETUP 0x00020 /* encoder/decoder setup done */ #define TIFF_BEENWRITING 0x00040 /* written 1+ scanlines to file */ #define TIFF_SWAB 0x00080 /* byte swap file information */ #define TIFF_NOBITREV 0x00100 /* inhibit bit reversal logic */ #define TIFF_MYBUFFER 0x00200 /* my raw data buffer; free on close */ #define TIFF_ISTILED 0x00400 /* file is tile, not strip- based */ #define TIFF_MAPPED 0x00800 /* file is mapped into memory */ #define TIFF_POSTENCODE 0x01000 /* need call to postencode routine */ #define TIFF_INSUBIFD 0x02000 /* currently writing a subifd */ #define TIFF_UPSAMPLED 0x04000 /* library is doing data up-sampling */ #define TIFF_STRIPCHOP 0x08000 /* enable strip chopping support */ #define TIFF_HEADERONLY 0x10000 /* read header only, do not process */ /* the first directory */ #define TIFF_NOREADRAW 0x20000 /* skip reading of raw uncompressed */ /* image data */ #define TIFF_INCUSTOMIFD 0x40000 /* currently writing a custom IFD */ toff_t tif_diroff; /* file offset of current directory */ toff_t tif_nextdiroff; /* file offset of following directory */ toff_t* tif_dirlist; /* list of offsets to already seen */ /* directories to prevent IFD looping */ tsize_t tif_dirlistsize;/* number of entires in offset list */ uint16 tif_dirnumber; /* number of already seen directories */ TIFFDirectory tif_dir; /* internal rep of current directory */ TIFFDirectory tif_customdir; /* custom IFDs are separated from the main ones */ TIFFHeader tif_header; /* file's header block */ const int* tif_typeshift; /* data type shift counts */ const long* tif_typemask; /* data type masks */ uint32 tif_row; /* current scanline */ tdir_t tif_curdir; /* current directory (index) */ tstrip_t tif_curstrip; /* current strip for read/write */ toff_t tif_curoff; /* current offset for read/write */ toff_t tif_dataoff; /* current offset for writing dir */ /* SubIFD support */ uint16 tif_nsubifd; /* remaining subifds to write */ toff_t tif_subifdoff; /* offset for patching SubIFD link */ /* tiling support */ uint32 tif_col; /* current column (offset by row too) */ ttile_t tif_curtile; /* current tile for read/write */ tsize_t tif_tilesize; /* # of bytes in a tile */ /* compression scheme hooks */ int tif_decodestatus; TIFFBoolMethod tif_setupdecode;/* called once before predecode */ TIFFPreMethod tif_predecode; /* pre- row/strip/tile decoding */ TIFFBoolMethod tif_setupencode;/* called once before preencode */ int tif_encodestatus; TIFFPreMethod tif_preencode; /* pre- row/strip/tile encoding */ TIFFBoolMethod tif_postencode; /* post- row/strip/tile encoding */ TIFFCodeMethod tif_decoderow; /* scanline decoding routine */ TIFFCodeMethod tif_encoderow; /* scanline encoding routine */ TIFFCodeMethod tif_decodestrip;/* strip decoding routine */ TIFFCodeMethod tif_encodestrip;/* strip encoding routine */ TIFFCodeMethod tif_decodetile; /* tile decoding routine */ TIFFCodeMethod tif_encodetile; /* tile encoding routine */ TIFFVoidMethod tif_close; /* cleanup-on-close routine */ TIFFSeekMethod tif_seek; /* position within a strip routine */ TIFFVoidMethod tif_cleanup; /* cleanup state routine */ TIFFStripMethod tif_defstripsize;/* calculate/constrain strip size */ TIFFTileMethod tif_deftilesize;/* calculate/constrain tile size */ tidata_t tif_data; /* compression scheme private data */ /* input/output buffering */ tsize_t tif_scanlinesize;/* # of bytes in a scanline */ tsize_t tif_scanlineskew;/* scanline skew for reading strips */ tidata_t tif_rawdata; /* raw data buffer */ tsize_t tif_rawdatasize;/* # of bytes in raw data buffer */ tidata_t tif_rawcp; /* current spot in raw buffer */ tsize_t tif_rawcc; /* bytes unread from raw buffer */ /* memory-mapped file support */ tidata_t tif_base; /* base of mapped file */ toff_t tif_size; /* size of mapped file region (bytes) FIXME: it should be tsize_t */ TIFFMapFileProc tif_mapproc; /* map file method */ TIFFUnmapFileProc tif_unmapproc;/* unmap file method */ /* input/output callback methods */ thandle_t tif_clientdata; /* callback parameter */ TIFFReadWriteProc tif_readproc; /* read method */ TIFFReadWriteProc tif_writeproc;/* write method */ TIFFSeekProc tif_seekproc; /* lseek method */ TIFFCloseProc tif_closeproc; /* close method */ TIFFSizeProc tif_sizeproc; /* filesize method */ /* post-decoding support */ TIFFPostMethod tif_postdecode; /* post decoding routine */ /* tag support */ TIFFFieldInfo** tif_fieldinfo; /* sorted table of registered tags */ size_t tif_nfields; /* # entries in registered tag table */ const TIFFFieldInfo *tif_foundfield;/* cached pointer to already found tag */ TIFFTagMethods tif_tagmethods; /* tag get/set/print routines */ TIFFClientInfoLink *tif_clientinfo; /* extra client information. */ }; #define isPseudoTag(t) (t > 0xffff) /* is tag value normal or pseudo */ #define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0) #define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0) #define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0) #define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0) #define TIFFReadFile(tif, buf, size) \ ((*(tif)->tif_readproc)((tif)->tif_clientdata,buf,size)) #define TIFFWriteFile(tif, buf, size) \ ((*(tif)->tif_writeproc)((tif)->tif_clientdata,buf,size)) #define TIFFSeekFile(tif, off, whence) \ ((*(tif)->tif_seekproc)((tif)->tif_clientdata,(toff_t)(off),whence)) #define TIFFCloseFile(tif) \ ((*(tif)->tif_closeproc)((tif)->tif_clientdata)) #define TIFFGetFileSize(tif) \ ((*(tif)->tif_sizeproc)((tif)->tif_clientdata)) #define TIFFMapFileContents(tif, paddr, psize) \ ((*(tif)->tif_mapproc)((tif)->tif_clientdata,paddr,psize)) #define TIFFUnmapFileContents(tif, addr, size) \ ((*(tif)->tif_unmapproc)((tif)->tif_clientdata,addr,size)) /* * Default Read/Seek/Write definitions. */ #ifndef ReadOK #define ReadOK(tif, buf, size) \ (TIFFReadFile(tif, (tdata_t) buf, (tsize_t)(size)) == (tsize_t)(size)) #endif #ifndef SeekOK #define SeekOK(tif, off) \ (TIFFSeekFile(tif, (toff_t) off, SEEK_SET) == (toff_t) off) #endif #ifndef WriteOK #define WriteOK(tif, buf, size) \ (TIFFWriteFile(tif, (tdata_t) buf, (tsize_t) size) == (tsize_t) size) #endif /* NB: the uint32 casts are to silence certain ANSI-C compilers */ #define TIFFhowmany(x, y) ((((uint32)(x))+(((uint32)(y))-1))/((uint32)(y))) #define TIFFhowmany8(x) (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3) #define TIFFroundup(x, y) (TIFFhowmany(x,y)*(y)) #define TIFFmax(A,B) ((A)>(B)?(A):(B)) #define TIFFmin(A,B) ((A)<(B)?(A):(B)) #define TIFFArrayCount(a) (sizeof (a) / sizeof ((a)[0])) #if defined(__cplusplus) extern "C" { #endif extern int _TIFFgetMode(const char*, const char*); extern int _TIFFNoRowEncode(TIFF*, tidata_t, tsize_t, tsample_t); extern int _TIFFNoStripEncode(TIFF*, tidata_t, tsize_t, tsample_t); extern int _TIFFNoTileEncode(TIFF*, tidata_t, tsize_t, tsample_t); extern int _TIFFNoRowDecode(TIFF*, tidata_t, tsize_t, tsample_t); extern int _TIFFNoStripDecode(TIFF*, tidata_t, tsize_t, tsample_t); extern int _TIFFNoTileDecode(TIFF*, tidata_t, tsize_t, tsample_t); extern void _TIFFNoPostDecode(TIFF*, tidata_t, tsize_t); extern int _TIFFNoPreCode (TIFF*, tsample_t); extern int _TIFFNoSeek(TIFF*, uint32); extern void _TIFFSwab16BitData(TIFF*, tidata_t, tsize_t); extern void _TIFFSwab24BitData(TIFF*, tidata_t, tsize_t); extern void _TIFFSwab32BitData(TIFF*, tidata_t, tsize_t); extern void _TIFFSwab64BitData(TIFF*, tidata_t, tsize_t); extern int TIFFFlushData1(TIFF*); extern int TIFFDefaultDirectory(TIFF*); extern void _TIFFSetDefaultCompressionState(TIFF*); extern int TIFFSetCompressionScheme(TIFF*, int); extern int TIFFSetDefaultCompressionState(TIFF*); extern uint32 _TIFFDefaultStripSize(TIFF*, uint32); extern void _TIFFDefaultTileSize(TIFF*, uint32*, uint32*); extern int _TIFFDataSize(TIFFDataType); extern void _TIFFsetByteArray(void**, void*, uint32); extern void _TIFFsetString(char**, char*); extern void _TIFFsetShortArray(uint16**, uint16*, uint32); extern void _TIFFsetLongArray(uint32**, uint32*, uint32); extern void _TIFFsetFloatArray(float**, float*, uint32); extern void _TIFFsetDoubleArray(double**, double*, uint32); extern void _TIFFprintAscii(FILE*, const char*); extern void _TIFFprintAsciiTag(FILE*, const char*, const char*); extern TIFFErrorHandler _TIFFwarningHandler; extern TIFFErrorHandler _TIFFerrorHandler; extern TIFFErrorHandlerExt _TIFFwarningHandlerExt; extern TIFFErrorHandlerExt _TIFFerrorHandlerExt; extern tdata_t _TIFFCheckMalloc(TIFF*, size_t, size_t, const char*); extern tdata_t _TIFFCheckRealloc(TIFF*, tdata_t, size_t, size_t, const char*); extern int TIFFInitDumpMode(TIFF*, int); #ifdef PACKBITS_SUPPORT extern int TIFFInitPackBits(TIFF*, int); #endif #ifdef CCITT_SUPPORT extern int TIFFInitCCITTRLE(TIFF*, int), TIFFInitCCITTRLEW(TIFF*, int); extern int TIFFInitCCITTFax3(TIFF*, int), TIFFInitCCITTFax4(TIFF*, int); #endif #ifdef THUNDER_SUPPORT extern int TIFFInitThunderScan(TIFF*, int); #endif #ifdef NEXT_SUPPORT extern int TIFFInitNeXT(TIFF*, int); #endif #ifdef LZW_SUPPORT extern int TIFFInitLZW(TIFF*, int); #endif #ifdef OJPEG_SUPPORT extern int TIFFInitOJPEG(TIFF*, int); #endif #ifdef JPEG_SUPPORT extern int TIFFInitJPEG(TIFF*, int); #endif #ifdef JBIG_SUPPORT extern int TIFFInitJBIG(TIFF*, int); #endif #ifdef ZIP_SUPPORT extern int TIFFInitZIP(TIFF*, int); #endif #ifdef PIXARLOG_SUPPORT extern int TIFFInitPixarLog(TIFF*, int); #endif #ifdef LOGLUV_SUPPORT extern int TIFFInitSGILog(TIFF*, int); #endif #ifdef VMS extern const TIFFCodec _TIFFBuiltinCODECS[]; #else extern TIFFCodec _TIFFBuiltinCODECS[]; #endif #if defined(__cplusplus) } #endif #endif /* _TIFFIOP_ */ /* vim: set ts=8 sts=8 sw=8 noet: */ ��������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_print.c�������������������������������������������������0000644�0001750�0001750�00000044630�12320456500�021505� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_print.c,v 1.36.2.2 2009-09-17 18:00:28 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * Directory Printing Support */ #include "tiffiop.h" #include <stdio.h> #include <string.h> #include <ctype.h> static const char *photoNames[] = { "min-is-white", /* PHOTOMETRIC_MINISWHITE */ "min-is-black", /* PHOTOMETRIC_MINISBLACK */ "RGB color", /* PHOTOMETRIC_RGB */ "palette color (RGB from colormap)", /* PHOTOMETRIC_PALETTE */ "transparency mask", /* PHOTOMETRIC_MASK */ "separated", /* PHOTOMETRIC_SEPARATED */ "YCbCr", /* PHOTOMETRIC_YCBCR */ "7 (0x7)", "CIE L*a*b*", /* PHOTOMETRIC_CIELAB */ }; #define NPHOTONAMES (sizeof (photoNames) / sizeof (photoNames[0])) static const char *orientNames[] = { "0 (0x0)", "row 0 top, col 0 lhs", /* ORIENTATION_TOPLEFT */ "row 0 top, col 0 rhs", /* ORIENTATION_TOPRIGHT */ "row 0 bottom, col 0 rhs", /* ORIENTATION_BOTRIGHT */ "row 0 bottom, col 0 lhs", /* ORIENTATION_BOTLEFT */ "row 0 lhs, col 0 top", /* ORIENTATION_LEFTTOP */ "row 0 rhs, col 0 top", /* ORIENTATION_RIGHTTOP */ "row 0 rhs, col 0 bottom", /* ORIENTATION_RIGHTBOT */ "row 0 lhs, col 0 bottom", /* ORIENTATION_LEFTBOT */ }; #define NORIENTNAMES (sizeof (orientNames) / sizeof (orientNames[0])) static void _TIFFPrintField(FILE* fd, const TIFFFieldInfo *fip, uint32 value_count, void *raw_data) { uint32 j; fprintf(fd, " %s: ", fip->field_name); for(j = 0; j < value_count; j++) { if(fip->field_type == TIFF_BYTE) fprintf(fd, "%u", ((uint8 *) raw_data)[j]); else if(fip->field_type == TIFF_UNDEFINED) fprintf(fd, "0x%x", (unsigned int) ((unsigned char *) raw_data)[j]); else if(fip->field_type == TIFF_SBYTE) fprintf(fd, "%d", ((int8 *) raw_data)[j]); else if(fip->field_type == TIFF_SHORT) fprintf(fd, "%u", ((uint16 *) raw_data)[j]); else if(fip->field_type == TIFF_SSHORT) fprintf(fd, "%d", ((int16 *) raw_data)[j]); else if(fip->field_type == TIFF_LONG) fprintf(fd, "%lu", (unsigned long)((uint32 *) raw_data)[j]); else if(fip->field_type == TIFF_SLONG) fprintf(fd, "%ld", (long)((int32 *) raw_data)[j]); else if(fip->field_type == TIFF_RATIONAL || fip->field_type == TIFF_SRATIONAL || fip->field_type == TIFF_FLOAT) fprintf(fd, "%f", ((float *) raw_data)[j]); else if(fip->field_type == TIFF_IFD) fprintf(fd, "0x%ulx", ((uint32 *) raw_data)[j]); else if(fip->field_type == TIFF_ASCII) { fprintf(fd, "%s", (char *) raw_data); break; } else if(fip->field_type == TIFF_DOUBLE) fprintf(fd, "%f", ((double *) raw_data)[j]); else if(fip->field_type == TIFF_FLOAT) fprintf(fd, "%f", ((float *)raw_data)[j]); else { fprintf(fd, "<unsupported data type in TIFFPrint>"); break; } if(j < value_count - 1) fprintf(fd, ","); } fprintf(fd, "\n"); } static int _TIFFPrettyPrintField(TIFF* tif, FILE* fd, ttag_t tag, uint32 value_count, void *raw_data) { TIFFDirectory *td = &tif->tif_dir; switch (tag) { case TIFFTAG_INKSET: fprintf(fd, " Ink Set: "); switch (*((uint16*)raw_data)) { case INKSET_CMYK: fprintf(fd, "CMYK\n"); break; default: fprintf(fd, "%u (0x%x)\n", *((uint16*)raw_data), *((uint16*)raw_data)); break; } return 1; case TIFFTAG_DOTRANGE: fprintf(fd, " Dot Range: %u-%u\n", ((uint16*)raw_data)[0], ((uint16*)raw_data)[1]); return 1; case TIFFTAG_WHITEPOINT: fprintf(fd, " White Point: %g-%g\n", ((float *)raw_data)[0], ((float *)raw_data)[1]); return 1; case TIFFTAG_REFERENCEBLACKWHITE: { uint16 i; fprintf(fd, " Reference Black/White:\n"); for (i = 0; i < td->td_samplesperpixel; i++) fprintf(fd, " %2d: %5g %5g\n", i, ((float *)raw_data)[2*i+0], ((float *)raw_data)[2*i+1]); return 1; } case TIFFTAG_XMLPACKET: { uint32 i; fprintf(fd, " XMLPacket (XMP Metadata):\n" ); for(i = 0; i < value_count; i++) fputc(((char *)raw_data)[i], fd); fprintf( fd, "\n" ); return 1; } case TIFFTAG_RICHTIFFIPTC: /* * XXX: for some weird reason RichTIFFIPTC tag * defined as array of LONG values. */ fprintf(fd, " RichTIFFIPTC Data: <present>, %lu bytes\n", (unsigned long) value_count * 4); return 1; case TIFFTAG_PHOTOSHOP: fprintf(fd, " Photoshop Data: <present>, %lu bytes\n", (unsigned long) value_count); return 1; case TIFFTAG_ICCPROFILE: fprintf(fd, " ICC Profile: <present>, %lu bytes\n", (unsigned long) value_count); return 1; case TIFFTAG_STONITS: fprintf(fd, " Sample to Nits conversion factor: %.4e\n", *((double*)raw_data)); return 1; } return 0; } /* * Print the contents of the current directory * to the specified stdio file stream. */ void TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags) { TIFFDirectory *td = &tif->tif_dir; char *sep; uint16 i; long l, n; fprintf(fd, "TIFF Directory at offset 0x%lx (%lu)\n", (unsigned long)tif->tif_diroff, (unsigned long)tif->tif_diroff); if (TIFFFieldSet(tif,FIELD_SUBFILETYPE)) { fprintf(fd, " Subfile Type:"); sep = " "; if (td->td_subfiletype & FILETYPE_REDUCEDIMAGE) { fprintf(fd, "%sreduced-resolution image", sep); sep = "/"; } if (td->td_subfiletype & FILETYPE_PAGE) { fprintf(fd, "%smulti-page document", sep); sep = "/"; } if (td->td_subfiletype & FILETYPE_MASK) fprintf(fd, "%stransparency mask", sep); fprintf(fd, " (%lu = 0x%lx)\n", (long) td->td_subfiletype, (long) td->td_subfiletype); } if (TIFFFieldSet(tif,FIELD_IMAGEDIMENSIONS)) { fprintf(fd, " Image Width: %lu Image Length: %lu", (unsigned long) td->td_imagewidth, (unsigned long) td->td_imagelength); if (TIFFFieldSet(tif,FIELD_IMAGEDEPTH)) fprintf(fd, " Image Depth: %lu", (unsigned long) td->td_imagedepth); fprintf(fd, "\n"); } if (TIFFFieldSet(tif,FIELD_TILEDIMENSIONS)) { fprintf(fd, " Tile Width: %lu Tile Length: %lu", (unsigned long) td->td_tilewidth, (unsigned long) td->td_tilelength); if (TIFFFieldSet(tif,FIELD_TILEDEPTH)) fprintf(fd, " Tile Depth: %lu", (unsigned long) td->td_tiledepth); fprintf(fd, "\n"); } if (TIFFFieldSet(tif,FIELD_RESOLUTION)) { fprintf(fd, " Resolution: %g, %g", td->td_xresolution, td->td_yresolution); if (TIFFFieldSet(tif,FIELD_RESOLUTIONUNIT)) { switch (td->td_resolutionunit) { case RESUNIT_NONE: fprintf(fd, " (unitless)"); break; case RESUNIT_INCH: fprintf(fd, " pixels/inch"); break; case RESUNIT_CENTIMETER: fprintf(fd, " pixels/cm"); break; default: fprintf(fd, " (unit %u = 0x%x)", td->td_resolutionunit, td->td_resolutionunit); break; } } fprintf(fd, "\n"); } if (TIFFFieldSet(tif,FIELD_POSITION)) fprintf(fd, " Position: %g, %g\n", td->td_xposition, td->td_yposition); if (TIFFFieldSet(tif,FIELD_BITSPERSAMPLE)) fprintf(fd, " Bits/Sample: %u\n", td->td_bitspersample); if (TIFFFieldSet(tif,FIELD_SAMPLEFORMAT)) { fprintf(fd, " Sample Format: "); switch (td->td_sampleformat) { case SAMPLEFORMAT_VOID: fprintf(fd, "void\n"); break; case SAMPLEFORMAT_INT: fprintf(fd, "signed integer\n"); break; case SAMPLEFORMAT_UINT: fprintf(fd, "unsigned integer\n"); break; case SAMPLEFORMAT_IEEEFP: fprintf(fd, "IEEE floating point\n"); break; case SAMPLEFORMAT_COMPLEXINT: fprintf(fd, "complex signed integer\n"); break; case SAMPLEFORMAT_COMPLEXIEEEFP: fprintf(fd, "complex IEEE floating point\n"); break; default: fprintf(fd, "%u (0x%x)\n", td->td_sampleformat, td->td_sampleformat); break; } } if (TIFFFieldSet(tif,FIELD_COMPRESSION)) { const TIFFCodec* c = TIFFFindCODEC(td->td_compression); fprintf(fd, " Compression Scheme: "); if (c) fprintf(fd, "%s\n", c->name); else fprintf(fd, "%u (0x%x)\n", td->td_compression, td->td_compression); } if (TIFFFieldSet(tif,FIELD_PHOTOMETRIC)) { fprintf(fd, " Photometric Interpretation: "); if (td->td_photometric < NPHOTONAMES) fprintf(fd, "%s\n", photoNames[td->td_photometric]); else { switch (td->td_photometric) { case PHOTOMETRIC_LOGL: fprintf(fd, "CIE Log2(L)\n"); break; case PHOTOMETRIC_LOGLUV: fprintf(fd, "CIE Log2(L) (u',v')\n"); break; default: fprintf(fd, "%u (0x%x)\n", td->td_photometric, td->td_photometric); break; } } } if (TIFFFieldSet(tif,FIELD_EXTRASAMPLES) && td->td_extrasamples) { fprintf(fd, " Extra Samples: %u<", td->td_extrasamples); sep = ""; for (i = 0; i < td->td_extrasamples; i++) { switch (td->td_sampleinfo[i]) { case EXTRASAMPLE_UNSPECIFIED: fprintf(fd, "%sunspecified", sep); break; case EXTRASAMPLE_ASSOCALPHA: fprintf(fd, "%sassoc-alpha", sep); break; case EXTRASAMPLE_UNASSALPHA: fprintf(fd, "%sunassoc-alpha", sep); break; default: fprintf(fd, "%s%u (0x%x)", sep, td->td_sampleinfo[i], td->td_sampleinfo[i]); break; } sep = ", "; } fprintf(fd, ">\n"); } if (TIFFFieldSet(tif,FIELD_INKNAMES)) { char* cp; fprintf(fd, " Ink Names: "); i = td->td_samplesperpixel; sep = ""; for (cp = td->td_inknames; i > 0; cp = strchr(cp,'\0')+1, i--) { fputs(sep, fd); _TIFFprintAscii(fd, cp); sep = ", "; } fputs("\n", fd); } if (TIFFFieldSet(tif,FIELD_THRESHHOLDING)) { fprintf(fd, " Thresholding: "); switch (td->td_threshholding) { case THRESHHOLD_BILEVEL: fprintf(fd, "bilevel art scan\n"); break; case THRESHHOLD_HALFTONE: fprintf(fd, "halftone or dithered scan\n"); break; case THRESHHOLD_ERRORDIFFUSE: fprintf(fd, "error diffused\n"); break; default: fprintf(fd, "%u (0x%x)\n", td->td_threshholding, td->td_threshholding); break; } } if (TIFFFieldSet(tif,FIELD_FILLORDER)) { fprintf(fd, " FillOrder: "); switch (td->td_fillorder) { case FILLORDER_MSB2LSB: fprintf(fd, "msb-to-lsb\n"); break; case FILLORDER_LSB2MSB: fprintf(fd, "lsb-to-msb\n"); break; default: fprintf(fd, "%u (0x%x)\n", td->td_fillorder, td->td_fillorder); break; } } if (TIFFFieldSet(tif,FIELD_YCBCRSUBSAMPLING)) { /* * For hacky reasons (see tif_jpeg.c - JPEGFixupTestSubsampling), * we need to fetch this rather than trust what is in our * structures. */ uint16 subsampling[2]; TIFFGetField( tif, TIFFTAG_YCBCRSUBSAMPLING, subsampling + 0, subsampling + 1 ); fprintf(fd, " YCbCr Subsampling: %u, %u\n", subsampling[0], subsampling[1] ); } if (TIFFFieldSet(tif,FIELD_YCBCRPOSITIONING)) { fprintf(fd, " YCbCr Positioning: "); switch (td->td_ycbcrpositioning) { case YCBCRPOSITION_CENTERED: fprintf(fd, "centered\n"); break; case YCBCRPOSITION_COSITED: fprintf(fd, "cosited\n"); break; default: fprintf(fd, "%u (0x%x)\n", td->td_ycbcrpositioning, td->td_ycbcrpositioning); break; } } if (TIFFFieldSet(tif,FIELD_HALFTONEHINTS)) fprintf(fd, " Halftone Hints: light %u dark %u\n", td->td_halftonehints[0], td->td_halftonehints[1]); if (TIFFFieldSet(tif,FIELD_ORIENTATION)) { fprintf(fd, " Orientation: "); if (td->td_orientation < NORIENTNAMES) fprintf(fd, "%s\n", orientNames[td->td_orientation]); else fprintf(fd, "%u (0x%x)\n", td->td_orientation, td->td_orientation); } if (TIFFFieldSet(tif,FIELD_SAMPLESPERPIXEL)) fprintf(fd, " Samples/Pixel: %u\n", td->td_samplesperpixel); if (TIFFFieldSet(tif,FIELD_ROWSPERSTRIP)) { fprintf(fd, " Rows/Strip: "); if (td->td_rowsperstrip == (uint32) -1) fprintf(fd, "(infinite)\n"); else fprintf(fd, "%lu\n", (unsigned long) td->td_rowsperstrip); } if (TIFFFieldSet(tif,FIELD_MINSAMPLEVALUE)) fprintf(fd, " Min Sample Value: %u\n", td->td_minsamplevalue); if (TIFFFieldSet(tif,FIELD_MAXSAMPLEVALUE)) fprintf(fd, " Max Sample Value: %u\n", td->td_maxsamplevalue); if (TIFFFieldSet(tif,FIELD_SMINSAMPLEVALUE)) fprintf(fd, " SMin Sample Value: %g\n", td->td_sminsamplevalue); if (TIFFFieldSet(tif,FIELD_SMAXSAMPLEVALUE)) fprintf(fd, " SMax Sample Value: %g\n", td->td_smaxsamplevalue); if (TIFFFieldSet(tif,FIELD_PLANARCONFIG)) { fprintf(fd, " Planar Configuration: "); switch (td->td_planarconfig) { case PLANARCONFIG_CONTIG: fprintf(fd, "single image plane\n"); break; case PLANARCONFIG_SEPARATE: fprintf(fd, "separate image planes\n"); break; default: fprintf(fd, "%u (0x%x)\n", td->td_planarconfig, td->td_planarconfig); break; } } if (TIFFFieldSet(tif,FIELD_PAGENUMBER)) fprintf(fd, " Page Number: %u-%u\n", td->td_pagenumber[0], td->td_pagenumber[1]); if (TIFFFieldSet(tif,FIELD_COLORMAP)) { fprintf(fd, " Color Map: "); if (flags & TIFFPRINT_COLORMAP) { fprintf(fd, "\n"); n = 1L<<td->td_bitspersample; for (l = 0; l < n; l++) fprintf(fd, " %5lu: %5u %5u %5u\n", l, td->td_colormap[0][l], td->td_colormap[1][l], td->td_colormap[2][l]); } else fprintf(fd, "(present)\n"); } if (TIFFFieldSet(tif,FIELD_TRANSFERFUNCTION)) { fprintf(fd, " Transfer Function: "); if (flags & TIFFPRINT_CURVES) { fprintf(fd, "\n"); n = 1L<<td->td_bitspersample; for (l = 0; l < n; l++) { fprintf(fd, " %2lu: %5u", l, td->td_transferfunction[0][l]); for (i = 1; i < td->td_samplesperpixel; i++) fprintf(fd, " %5u", td->td_transferfunction[i][l]); fputc('\n', fd); } } else fprintf(fd, "(present)\n"); } if (TIFFFieldSet(tif, FIELD_SUBIFD) && (td->td_subifd)) { fprintf(fd, " SubIFD Offsets:"); for (i = 0; i < td->td_nsubifd; i++) fprintf(fd, " %5lu", (long) td->td_subifd[i]); fputc('\n', fd); } /* ** Custom tag support. */ { int i; short count; count = (short) TIFFGetTagListCount(tif); for(i = 0; i < count; i++) { ttag_t tag = TIFFGetTagListEntry(tif, i); const TIFFFieldInfo *fip; uint32 value_count; int mem_alloc = 0; void *raw_data; fip = TIFFFieldWithTag(tif, tag); if(fip == NULL) continue; if(fip->field_passcount) { if(TIFFGetField(tif, tag, &value_count, &raw_data) != 1) continue; } else { if (fip->field_readcount == TIFF_VARIABLE || fip->field_readcount == TIFF_VARIABLE2) value_count = 1; else if (fip->field_readcount == TIFF_SPP) value_count = td->td_samplesperpixel; else value_count = fip->field_readcount; if ((fip->field_type == TIFF_ASCII || fip->field_readcount == TIFF_VARIABLE || fip->field_readcount == TIFF_VARIABLE2 || fip->field_readcount == TIFF_SPP || value_count > 1) && fip->field_tag != TIFFTAG_PAGENUMBER && fip->field_tag != TIFFTAG_HALFTONEHINTS && fip->field_tag != TIFFTAG_YCBCRSUBSAMPLING && fip->field_tag != TIFFTAG_DOTRANGE) { if(TIFFGetField(tif, tag, &raw_data) != 1) continue; } else if (fip->field_tag != TIFFTAG_PAGENUMBER && fip->field_tag != TIFFTAG_HALFTONEHINTS && fip->field_tag != TIFFTAG_YCBCRSUBSAMPLING && fip->field_tag != TIFFTAG_DOTRANGE) { raw_data = _TIFFmalloc( _TIFFDataSize(fip->field_type) * value_count); mem_alloc = 1; if(TIFFGetField(tif, tag, raw_data) != 1) { _TIFFfree(raw_data); continue; } } else { /* * XXX: Should be fixed and removed, see the * notes related to TIFFTAG_PAGENUMBER, * TIFFTAG_HALFTONEHINTS, * TIFFTAG_YCBCRSUBSAMPLING and * TIFFTAG_DOTRANGE tags in tif_dir.c. */ char *tmp; raw_data = _TIFFmalloc( _TIFFDataSize(fip->field_type) * value_count); tmp = raw_data; mem_alloc = 1; if(TIFFGetField(tif, tag, tmp, tmp + _TIFFDataSize(fip->field_type)) != 1) { _TIFFfree(raw_data); continue; } } } /* * Catch the tags which needs to be specially handled and * pretty print them. If tag not handled in * _TIFFPrettyPrintField() fall down and print it as any other * tag. */ if (_TIFFPrettyPrintField(tif, fd, tag, value_count, raw_data)) { if(mem_alloc) _TIFFfree(raw_data); continue; } else _TIFFPrintField(fd, fip, value_count, raw_data); if(mem_alloc) _TIFFfree(raw_data); } } if (tif->tif_tagmethods.printdir) (*tif->tif_tagmethods.printdir)(tif, fd, flags); if ((flags & TIFFPRINT_STRIPS) && TIFFFieldSet(tif,FIELD_STRIPOFFSETS)) { tstrip_t s; fprintf(fd, " %lu %s:\n", (long) td->td_nstrips, isTiled(tif) ? "Tiles" : "Strips"); for (s = 0; s < td->td_nstrips; s++) fprintf(fd, " %3lu: [%8lu, %8lu]\n", (unsigned long) s, (unsigned long) td->td_stripoffset[s], (unsigned long) td->td_stripbytecount[s]); } } void _TIFFprintAscii(FILE* fd, const char* cp) { for (; *cp != '\0'; cp++) { const char* tp; if (isprint((int)*cp)) { fputc(*cp, fd); continue; } for (tp = "\tt\bb\rr\nn\vv"; *tp; tp++) if (*tp++ == *cp) break; if (*tp) fprintf(fd, "\\%c", *tp); else fprintf(fd, "\\%03o", *cp & 0xff); } } void _TIFFprintAsciiTag(FILE* fd, const char* name, const char* value) { fprintf(fd, " %s: \"", name); _TIFFprintAscii(fd, value); fprintf(fd, "\"\n"); } /* vim: set ts=8 sts=8 sw=8 noet: */ ��������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tiffconf.h��������������������������������������������������0000644�0001750�0001750�00000005460�12320456500�021310� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* libtiff/tiffconf.h. Generated by configure. */ /* Configuration defines for installed libtiff. This file maintained for backward compatibility. Do not use definitions from this file in your programs. */ #ifndef _TIFFCONF_ #define _TIFFCONF_ /* Define to 1 if the system has the type `int16'. */ /* #undef HAVE_INT16 */ /* Define to 1 if the system has the type `int32'. */ /* #undef HAVE_INT32 */ /* Define to 1 if the system has the type `int8'. */ /* #undef HAVE_INT8 */ /* The size of a `int', as computed by sizeof. */ #define SIZEOF_INT 4 /* The size of a `long', as computed by sizeof. */ #define SIZEOF_LONG 4 /* Compatibility stuff. */ /* Define as 0 or 1 according to the floating point format suported by the machine */ #define HAVE_IEEEFP 1 /* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */ #define HOST_FILLORDER FILLORDER_LSB2MSB /* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian (Intel) */ #define HOST_BIGENDIAN 0 /* Support CCITT Group 3 & 4 algorithms */ #define CCITT_SUPPORT 1 /* Support JPEG compression (requires IJG JPEG library) */ #undef JPEG_SUPPORT /* Support LogLuv high dynamic range encoding */ #define LOGLUV_SUPPORT 1 /* Support LZW algorithm */ #define LZW_SUPPORT 1 /* Support NeXT 2-bit RLE algorithm */ #define NEXT_SUPPORT 1 /* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation fails with unpatched IJG JPEG library) */ /* #undef OJPEG_SUPPORT */ /* Support Macintosh PackBits algorithm */ #define PACKBITS_SUPPORT 1 /* Support Pixar log-format algorithm (requires Zlib) */ #define PIXARLOG_SUPPORT 1 /* Support ThunderScan 4-bit RLE algorithm */ #define THUNDER_SUPPORT 1 /* Support Deflate compression */ #define ZIP_SUPPORT 1 /* Support strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of ~8Kb to reduce memory usage) */ #define STRIPCHOP_DEFAULT TIFF_STRIPCHOP /* Enable SubIFD tag (330) support */ #define SUBIFD_SUPPORT 1 /* Treat extra sample as alpha (default enabled). The RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don't mark the alpha properly. */ #define DEFAULT_EXTRASAMPLE_AS_ALPHA 1 /* Pick up YCbCr subsampling info from the JPEG data stream to support files lacking the tag (default enabled). */ #define CHECK_JPEG_YCBCR_SUBSAMPLING 1 /* Support MS MDI magic number files as TIFF */ #define MDI_SUPPORT 1 /* * Feature support definitions. * XXX: These macros are obsoleted. Don't use them in your apps! * Macros stays here for backward compatibility and should be always defined. */ #define COLORIMETRY_SUPPORT #define YCBCR_SUPPORT #define CMYK_SUPPORT #define ICC_SUPPORT #define PHOTOSHOP_SUPPORT #define IPTC_SUPPORT #endif /* _TIFFCONF_ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/TUVOK_README������������������������������������������������0000644�0001750�0001750�00000001055�12320456500�021205� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������This is a special version of libtiff. The original version is available from: ftp://ftp.remotesensing.org/pub/libtiff This distribution is missing critical files required to use libtiff. It is meant only for use with the Tuvok volume rendering library. Tuvok and libtiff are distributed under different but compatible licenses. If you want to use libtiff in your own projects, this is not the source you should use: see the above link. Please report issues with this library to the Tuvok developers; do NOT report problems to the libtiff developers! �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_aux.c���������������������������������������������������0000644�0001750�0001750�00000017106�12320456500�021144� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_aux.c,v 1.20 2006/06/08 14:24:13 dron Exp $ */ /* * Copyright (c) 1991-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * Auxiliary Support Routines. */ #include "tiffiop.h" #include "tif_predict.h" #include <math.h> tdata_t _TIFFCheckRealloc(TIFF* tif, tdata_t buffer, size_t nmemb, size_t elem_size, const char* what) { tdata_t cp = NULL; tsize_t bytes = nmemb * elem_size; /* * XXX: Check for integer overflow. */ if (nmemb && elem_size && bytes / elem_size == nmemb) cp = _TIFFrealloc(buffer, bytes); if (cp == NULL) TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "No space %s", what); return cp; } tdata_t _TIFFCheckMalloc(TIFF* tif, size_t nmemb, size_t elem_size, const char* what) { return _TIFFCheckRealloc(tif, NULL, nmemb, elem_size, what); } static int TIFFDefaultTransferFunction(TIFFDirectory* td) { uint16 **tf = td->td_transferfunction; tsize_t i, n, nbytes; tf[0] = tf[1] = tf[2] = 0; if (td->td_bitspersample >= sizeof(tsize_t) * 8 - 2) return 0; n = 1<<td->td_bitspersample; nbytes = n * sizeof (uint16); if (!(tf[0] = (uint16 *)_TIFFmalloc(nbytes))) return 0; tf[0][0] = 0; for (i = 1; i < n; i++) { double t = (double)i/((double) n-1.); tf[0][i] = (uint16)floor(65535.*pow(t, 2.2) + .5); } if (td->td_samplesperpixel - td->td_extrasamples > 1) { if (!(tf[1] = (uint16 *)_TIFFmalloc(nbytes))) goto bad; _TIFFmemcpy(tf[1], tf[0], nbytes); if (!(tf[2] = (uint16 *)_TIFFmalloc(nbytes))) goto bad; _TIFFmemcpy(tf[2], tf[0], nbytes); } return 1; bad: if (tf[0]) _TIFFfree(tf[0]); if (tf[1]) _TIFFfree(tf[1]); if (tf[2]) _TIFFfree(tf[2]); tf[0] = tf[1] = tf[2] = 0; return 0; } /* * Like TIFFGetField, but return any default * value if the tag is not present in the directory. * * NB: We use the value in the directory, rather than * explcit values so that defaults exist only one * place in the library -- in TIFFDefaultDirectory. */ int TIFFVGetFieldDefaulted(TIFF* tif, ttag_t tag, va_list ap) { TIFFDirectory *td = &tif->tif_dir; if (TIFFVGetField(tif, tag, ap)) return (1); switch (tag) { case TIFFTAG_SUBFILETYPE: *va_arg(ap, uint32 *) = td->td_subfiletype; return (1); case TIFFTAG_BITSPERSAMPLE: *va_arg(ap, uint16 *) = td->td_bitspersample; return (1); case TIFFTAG_THRESHHOLDING: *va_arg(ap, uint16 *) = td->td_threshholding; return (1); case TIFFTAG_FILLORDER: *va_arg(ap, uint16 *) = td->td_fillorder; return (1); case TIFFTAG_ORIENTATION: *va_arg(ap, uint16 *) = td->td_orientation; return (1); case TIFFTAG_SAMPLESPERPIXEL: *va_arg(ap, uint16 *) = td->td_samplesperpixel; return (1); case TIFFTAG_ROWSPERSTRIP: *va_arg(ap, uint32 *) = td->td_rowsperstrip; return (1); case TIFFTAG_MINSAMPLEVALUE: *va_arg(ap, uint16 *) = td->td_minsamplevalue; return (1); case TIFFTAG_MAXSAMPLEVALUE: *va_arg(ap, uint16 *) = td->td_maxsamplevalue; return (1); case TIFFTAG_PLANARCONFIG: *va_arg(ap, uint16 *) = td->td_planarconfig; return (1); case TIFFTAG_RESOLUTIONUNIT: *va_arg(ap, uint16 *) = td->td_resolutionunit; return (1); case TIFFTAG_PREDICTOR: { TIFFPredictorState* sp = (TIFFPredictorState*) tif->tif_data; *va_arg(ap, uint16*) = (uint16) sp->predictor; return 1; } case TIFFTAG_DOTRANGE: *va_arg(ap, uint16 *) = 0; *va_arg(ap, uint16 *) = (1<<td->td_bitspersample)-1; return (1); case TIFFTAG_INKSET: *va_arg(ap, uint16 *) = INKSET_CMYK; return 1; case TIFFTAG_NUMBEROFINKS: *va_arg(ap, uint16 *) = 4; return (1); case TIFFTAG_EXTRASAMPLES: *va_arg(ap, uint16 *) = td->td_extrasamples; *va_arg(ap, uint16 **) = td->td_sampleinfo; return (1); case TIFFTAG_MATTEING: *va_arg(ap, uint16 *) = (td->td_extrasamples == 1 && td->td_sampleinfo[0] == EXTRASAMPLE_ASSOCALPHA); return (1); case TIFFTAG_TILEDEPTH: *va_arg(ap, uint32 *) = td->td_tiledepth; return (1); case TIFFTAG_DATATYPE: *va_arg(ap, uint16 *) = td->td_sampleformat-1; return (1); case TIFFTAG_SAMPLEFORMAT: *va_arg(ap, uint16 *) = td->td_sampleformat; return(1); case TIFFTAG_IMAGEDEPTH: *va_arg(ap, uint32 *) = td->td_imagedepth; return (1); case TIFFTAG_YCBCRCOEFFICIENTS: { /* defaults are from CCIR Recommendation 601-1 */ static float ycbcrcoeffs[] = { 0.299f, 0.587f, 0.114f }; *va_arg(ap, float **) = ycbcrcoeffs; return 1; } case TIFFTAG_YCBCRSUBSAMPLING: *va_arg(ap, uint16 *) = td->td_ycbcrsubsampling[0]; *va_arg(ap, uint16 *) = td->td_ycbcrsubsampling[1]; return (1); case TIFFTAG_YCBCRPOSITIONING: *va_arg(ap, uint16 *) = td->td_ycbcrpositioning; return (1); case TIFFTAG_WHITEPOINT: { static float whitepoint[2]; /* TIFF 6.0 specification tells that it is no default value for the WhitePoint, but AdobePhotoshop TIFF Technical Note tells that it should be CIE D50. */ whitepoint[0] = D50_X0 / (D50_X0 + D50_Y0 + D50_Z0); whitepoint[1] = D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0); *va_arg(ap, float **) = whitepoint; return 1; } case TIFFTAG_TRANSFERFUNCTION: if (!td->td_transferfunction[0] && !TIFFDefaultTransferFunction(td)) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "No space for \"TransferFunction\" tag"); return (0); } *va_arg(ap, uint16 **) = td->td_transferfunction[0]; if (td->td_samplesperpixel - td->td_extrasamples > 1) { *va_arg(ap, uint16 **) = td->td_transferfunction[1]; *va_arg(ap, uint16 **) = td->td_transferfunction[2]; } return (1); case TIFFTAG_REFERENCEBLACKWHITE: { int i; static float ycbcr_refblackwhite[] = { 0.0F, 255.0F, 128.0F, 255.0F, 128.0F, 255.0F }; static float rgb_refblackwhite[6]; for (i = 0; i < 3; i++) { rgb_refblackwhite[2 * i + 0] = 0.0F; rgb_refblackwhite[2 * i + 1] = (float)((1L<<td->td_bitspersample)-1L); } if (td->td_photometric == PHOTOMETRIC_YCBCR) { /* * YCbCr (Class Y) images must have the * ReferenceBlackWhite tag set. Fix the * broken images, which lacks that tag. */ *va_arg(ap, float **) = ycbcr_refblackwhite; } else { /* * Assume RGB (Class R) */ *va_arg(ap, float **) = rgb_refblackwhite; } return 1; } } return 0; } /* * Like TIFFGetField, but return any default * value if the tag is not present in the directory. */ int TIFFGetFieldDefaulted(TIFF* tif, ttag_t tag, ...) { int ok; va_list ap; va_start(ap, tag); ok = TIFFVGetFieldDefaulted(tif, tag, ap); va_end(ap); return (ok); } /* vim: set ts=8 sts=8 sw=8 noet: */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_dumpmode.c����������������������������������������������0000644�0001750�0001750�00000006406�12320456500�022162� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dumpmode.c,v 1.5.2.1 2009-01-01 00:10:43 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * "Null" Compression Algorithm Support. */ #include "tiffiop.h" /* * Encode a hunk of pixels. */ static int DumpModeEncode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s) { (void) s; while (cc > 0) { tsize_t n; n = cc; if (tif->tif_rawcc + n > tif->tif_rawdatasize) n = tif->tif_rawdatasize - tif->tif_rawcc; assert( n > 0 ); /* * Avoid copy if client has setup raw * data buffer to avoid extra copy. */ if (tif->tif_rawcp != pp) _TIFFmemcpy(tif->tif_rawcp, pp, n); tif->tif_rawcp += n; tif->tif_rawcc += n; pp += n; cc -= n; if (tif->tif_rawcc >= tif->tif_rawdatasize && !TIFFFlushData1(tif)) return (-1); } return (1); } /* * Decode a hunk of pixels. */ static int DumpModeDecode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s) { (void) s; /* fprintf(stderr,"DumpModeDecode: scanline %ld, expected %ld bytes, got %ld bytes\n", */ /* (long) tif->tif_row, (long) tif->tif_rawcc, (long) cc); */ if (tif->tif_rawcc < cc) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "DumpModeDecode: Not enough data for scanline %d", tif->tif_row); return (0); } /* * Avoid copy if client has setup raw * data buffer to avoid extra copy. */ if (tif->tif_rawcp != buf) _TIFFmemcpy(buf, tif->tif_rawcp, cc); tif->tif_rawcp += cc; tif->tif_rawcc -= cc; return (1); } /* * Seek forwards nrows in the current strip. */ static int DumpModeSeek(TIFF* tif, uint32 nrows) { tif->tif_rawcp += nrows * tif->tif_scanlinesize; tif->tif_rawcc -= nrows * tif->tif_scanlinesize; return (1); } /* * Initialize dump mode. */ int TIFFInitDumpMode(TIFF* tif, int scheme) { (void) scheme; tif->tif_decoderow = DumpModeDecode; tif->tif_decodestrip = DumpModeDecode; tif->tif_decodetile = DumpModeDecode; tif->tif_encoderow = DumpModeEncode; tif->tif_encodestrip = DumpModeEncode; tif->tif_encodetile = DumpModeEncode; tif->tif_seek = DumpModeSeek; return (1); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_swab.c��������������������������������������������������0000644�0001750�0001750�00000016664�12320456500�021313� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_swab.c,v 1.4 2005/04/13 14:06:21 dron Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library Bit & Byte Swapping Support. * * XXX We assume short = 16-bits and long = 32-bits XXX */ #include "tiffiop.h" #ifndef TIFFSwabShort void TIFFSwabShort(uint16* wp) { register unsigned char* cp = (unsigned char*) wp; unsigned char t; t = cp[1]; cp[1] = cp[0]; cp[0] = t; } #endif #ifndef TIFFSwabLong void TIFFSwabLong(uint32* lp) { register unsigned char* cp = (unsigned char*) lp; unsigned char t; t = cp[3]; cp[3] = cp[0]; cp[0] = t; t = cp[2]; cp[2] = cp[1]; cp[1] = t; } #endif #ifndef TIFFSwabArrayOfShort void TIFFSwabArrayOfShort(uint16* wp, register unsigned long n) { register unsigned char* cp; register unsigned char t; /* XXX unroll loop some */ while (n-- > 0) { cp = (unsigned char*) wp; t = cp[1]; cp[1] = cp[0]; cp[0] = t; wp++; } } #endif #ifndef TIFFSwabArrayOfTriples void TIFFSwabArrayOfTriples(uint8* tp, unsigned long n) { unsigned char* cp; unsigned char t; /* XXX unroll loop some */ while (n-- > 0) { cp = (unsigned char*) tp; t = cp[2]; cp[2] = cp[0]; cp[0] = t; tp += 3; } } #endif #ifndef TIFFSwabArrayOfLong void TIFFSwabArrayOfLong(register uint32* lp, register unsigned long n) { register unsigned char *cp; register unsigned char t; /* XXX unroll loop some */ while (n-- > 0) { cp = (unsigned char *)lp; t = cp[3]; cp[3] = cp[0]; cp[0] = t; t = cp[2]; cp[2] = cp[1]; cp[1] = t; lp++; } } #endif #ifndef TIFFSwabDouble void TIFFSwabDouble(double *dp) { register uint32* lp = (uint32*) dp; uint32 t; TIFFSwabArrayOfLong(lp, 2); t = lp[0]; lp[0] = lp[1]; lp[1] = t; } #endif #ifndef TIFFSwabArrayOfDouble void TIFFSwabArrayOfDouble(double* dp, register unsigned long n) { register uint32* lp = (uint32*) dp; register uint32 t; TIFFSwabArrayOfLong(lp, n + n); while (n-- > 0) { t = lp[0]; lp[0] = lp[1]; lp[1] = t; lp += 2; } } #endif /* * Bit reversal tables. TIFFBitRevTable[<byte>] gives * the bit reversed value of <byte>. Used in various * places in the library when the FillOrder requires * bit reversal of byte values (e.g. CCITT Fax 3 * encoding/decoding). TIFFNoBitRevTable is provided * for algorithms that want an equivalent table that * do not reverse bit values. */ static const unsigned char TIFFBitRevTable[256] = { 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff }; static const unsigned char TIFFNoBitRevTable[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, }; const unsigned char* TIFFGetBitRevTable(int reversed) { return (reversed ? TIFFBitRevTable : TIFFNoBitRevTable); } void TIFFReverseBits(register unsigned char* cp, register unsigned long n) { for (; n > 8; n -= 8) { cp[0] = TIFFBitRevTable[cp[0]]; cp[1] = TIFFBitRevTable[cp[1]]; cp[2] = TIFFBitRevTable[cp[2]]; cp[3] = TIFFBitRevTable[cp[3]]; cp[4] = TIFFBitRevTable[cp[4]]; cp[5] = TIFFBitRevTable[cp[5]]; cp[6] = TIFFBitRevTable[cp[6]]; cp[7] = TIFFBitRevTable[cp[7]]; cp += 8; } while (n-- > 0) *cp = TIFFBitRevTable[*cp], cp++; } /* vim: set ts=8 sts=8 sw=8 noet: */ ����������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_predict.h�����������������������������������������������0000644�0001750�0001750�00000005327�12320456500�022010� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_predict.h,v 1.3.2.1 2007/11/22 21:24:51 fwarmerdam Exp $ */ /* * Copyright (c) 1995-1997 Sam Leffler * Copyright (c) 1995-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _TIFFPREDICT_ #define _TIFFPREDICT_ /* * ``Library-private'' Support for the Predictor Tag */ /* * Codecs that want to support the Predictor tag must place * this structure first in their private state block so that * the predictor code can cast tif_data to find its state. */ typedef struct { int predictor; /* predictor tag value */ int stride; /* sample stride over data */ tsize_t rowsize; /* tile/strip row size */ TIFFCodeMethod encoderow; /* parent codec encode/decode row */ TIFFCodeMethod encodestrip; /* parent codec encode/decode strip */ TIFFCodeMethod encodetile; /* parent codec encode/decode tile */ TIFFPostMethod encodepfunc; /* horizontal differencer */ TIFFCodeMethod decoderow; /* parent codec encode/decode row */ TIFFCodeMethod decodestrip; /* parent codec encode/decode strip */ TIFFCodeMethod decodetile; /* parent codec encode/decode tile */ TIFFPostMethod decodepfunc; /* horizontal accumulator */ TIFFVGetMethod vgetparent; /* super-class method */ TIFFVSetMethod vsetparent; /* super-class method */ TIFFPrintMethod printdir; /* super-class method */ TIFFBoolMethod setupdecode; /* super-class method */ TIFFBoolMethod setupencode; /* super-class method */ } TIFFPredictorState; #if defined(__cplusplus) extern "C" { #endif extern int TIFFPredictorInit(TIFF*); extern int TIFFPredictorCleanup(TIFF*); #if defined(__cplusplus) } #endif #endif /* _TIFFPREDICT_ */ /* vim: set ts=8 sts=8 sw=8 noet: */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_dirwrite.c����������������������������������������������0000644�0001750�0001750�00000113163�12320456500�022200� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_dirwrite.c,v 1.37.2.6 2009-10-31 21:51:08 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * Directory Write Support Routines. */ #include "tiffiop.h" #ifdef HAVE_IEEEFP # define TIFFCvtNativeToIEEEFloat(tif, n, fp) # define TIFFCvtNativeToIEEEDouble(tif, n, dp) #else extern void TIFFCvtNativeToIEEEFloat(TIFF*, uint32, float*); extern void TIFFCvtNativeToIEEEDouble(TIFF*, uint32, double*); #endif static int TIFFWriteNormalTag(TIFF*, TIFFDirEntry*, const TIFFFieldInfo*); static void TIFFSetupShortLong(TIFF*, ttag_t, TIFFDirEntry*, uint32); static void TIFFSetupShort(TIFF*, ttag_t, TIFFDirEntry*, uint16); static int TIFFSetupShortPair(TIFF*, ttag_t, TIFFDirEntry*); static int TIFFWritePerSampleShorts(TIFF*, ttag_t, TIFFDirEntry*); static int TIFFWritePerSampleAnys(TIFF*, TIFFDataType, ttag_t, TIFFDirEntry*); static int TIFFWriteShortTable(TIFF*, ttag_t, TIFFDirEntry*, uint32, uint16**); static int TIFFWriteShortArray(TIFF*, TIFFDirEntry*, uint16*); static int TIFFWriteLongArray(TIFF *, TIFFDirEntry*, uint32*); static int TIFFWriteRationalArray(TIFF *, TIFFDirEntry*, float*); static int TIFFWriteFloatArray(TIFF *, TIFFDirEntry*, float*); static int TIFFWriteDoubleArray(TIFF *, TIFFDirEntry*, double*); static int TIFFWriteByteArray(TIFF*, TIFFDirEntry*, char*); static int TIFFWriteAnyArray(TIFF*, TIFFDataType, ttag_t, TIFFDirEntry*, uint32, double*); static int TIFFWriteTransferFunction(TIFF*, TIFFDirEntry*); static int TIFFWriteInkNames(TIFF*, TIFFDirEntry*); static int TIFFWriteData(TIFF*, TIFFDirEntry*, char*); static int TIFFLinkDirectory(TIFF*); #define WriteRationalPair(type, tag1, v1, tag2, v2) { \ TIFFWriteRational((tif), (type), (tag1), (dir), (v1)) \ TIFFWriteRational((tif), (type), (tag2), (dir)+1, (v2)) \ (dir)++; \ } #define TIFFWriteRational(tif, type, tag, dir, v) \ (dir)->tdir_tag = (tag); \ (dir)->tdir_type = (type); \ (dir)->tdir_count = 1; \ if (!TIFFWriteRationalArray((tif), (dir), &(v))) \ goto bad; /* * Write the contents of the current directory * to the specified file. This routine doesn't * handle overwriting a directory with auxiliary * storage that's been changed. */ static int _TIFFWriteDirectory(TIFF* tif, int done) { uint16 dircount; toff_t diroff; ttag_t tag; uint32 nfields; tsize_t dirsize; char* data; TIFFDirEntry* dir; TIFFDirectory* td; unsigned long b, fields[FIELD_SETLONGS]; int fi, nfi; if (tif->tif_mode == O_RDONLY) return (1); /* * Clear write state so that subsequent images with * different characteristics get the right buffers * setup for them. */ if (done) { if (tif->tif_flags & TIFF_POSTENCODE) { tif->tif_flags &= ~TIFF_POSTENCODE; if (!(*tif->tif_postencode)(tif)) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error post-encoding before directory write"); return (0); } } (*tif->tif_close)(tif); /* shutdown encoder */ /* * Flush any data that might have been written * by the compression close+cleanup routines. */ if (tif->tif_rawcc > 0 && (tif->tif_flags & TIFF_BEENWRITING) != 0 && !TIFFFlushData1(tif)) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error flushing data before directory write"); return (0); } if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata) { _TIFFfree(tif->tif_rawdata); tif->tif_rawdata = NULL; tif->tif_rawcc = 0; tif->tif_rawdatasize = 0; } tif->tif_flags &= ~(TIFF_BEENWRITING|TIFF_BUFFERSETUP); } td = &tif->tif_dir; /* * Size the directory so that we can calculate * offsets for the data items that aren't kept * in-place in each field. */ nfields = 0; for (b = 0; b <= FIELD_LAST; b++) if (TIFFFieldSet(tif, b) && b != FIELD_CUSTOM) nfields += (b < FIELD_SUBFILETYPE ? 2 : 1); nfields += td->td_customValueCount; dirsize = nfields * sizeof (TIFFDirEntry); data = (char*) _TIFFmalloc(dirsize); if (data == NULL) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Cannot write directory, out of space"); return (0); } /* * Directory hasn't been placed yet, put * it at the end of the file and link it * into the existing directory structure. */ if (tif->tif_diroff == 0 && !TIFFLinkDirectory(tif)) goto bad; tif->tif_dataoff = (toff_t)( tif->tif_diroff + sizeof (uint16) + dirsize + sizeof (toff_t)); if (tif->tif_dataoff & 1) tif->tif_dataoff++; (void) TIFFSeekFile(tif, tif->tif_dataoff, SEEK_SET); tif->tif_curdir++; dir = (TIFFDirEntry*) data; /* * Setup external form of directory * entries and write data items. */ _TIFFmemcpy(fields, td->td_fieldsset, sizeof (fields)); /* * Write out ExtraSamples tag only if * extra samples are present in the data. */ if (FieldSet(fields, FIELD_EXTRASAMPLES) && !td->td_extrasamples) { ResetFieldBit(fields, FIELD_EXTRASAMPLES); nfields--; dirsize -= sizeof (TIFFDirEntry); } /*XXX*/ for (fi = 0, nfi = tif->tif_nfields; nfi > 0; nfi--, fi++) { const TIFFFieldInfo* fip = tif->tif_fieldinfo[fi]; /* * For custom fields, we test to see if the custom field * is set or not. For normal fields, we just use the * FieldSet test. */ if( fip->field_bit == FIELD_CUSTOM ) { int ci, is_set = FALSE; for( ci = 0; ci < td->td_customValueCount; ci++ ) is_set |= (td->td_customValues[ci].info == fip); if( !is_set ) continue; } else if (!FieldSet(fields, fip->field_bit)) continue; /* * Handle other fields. */ switch (fip->field_bit) { case FIELD_STRIPOFFSETS: /* * We use one field bit for both strip and tile * offsets, and so must be careful in selecting * the appropriate field descriptor (so that tags * are written in sorted order). */ tag = isTiled(tif) ? TIFFTAG_TILEOFFSETS : TIFFTAG_STRIPOFFSETS; if (tag != fip->field_tag) continue; dir->tdir_tag = (uint16) tag; dir->tdir_type = (uint16) TIFF_LONG; dir->tdir_count = (uint32) td->td_nstrips; if (!TIFFWriteLongArray(tif, dir, td->td_stripoffset)) goto bad; break; case FIELD_STRIPBYTECOUNTS: /* * We use one field bit for both strip and tile * byte counts, and so must be careful in selecting * the appropriate field descriptor (so that tags * are written in sorted order). */ tag = isTiled(tif) ? TIFFTAG_TILEBYTECOUNTS : TIFFTAG_STRIPBYTECOUNTS; if (tag != fip->field_tag) continue; dir->tdir_tag = (uint16) tag; dir->tdir_type = (uint16) TIFF_LONG; dir->tdir_count = (uint32) td->td_nstrips; if (!TIFFWriteLongArray(tif, dir, td->td_stripbytecount)) goto bad; break; case FIELD_ROWSPERSTRIP: TIFFSetupShortLong(tif, TIFFTAG_ROWSPERSTRIP, dir, td->td_rowsperstrip); break; case FIELD_COLORMAP: if (!TIFFWriteShortTable(tif, TIFFTAG_COLORMAP, dir, 3, td->td_colormap)) goto bad; break; case FIELD_IMAGEDIMENSIONS: TIFFSetupShortLong(tif, TIFFTAG_IMAGEWIDTH, dir++, td->td_imagewidth); TIFFSetupShortLong(tif, TIFFTAG_IMAGELENGTH, dir, td->td_imagelength); break; case FIELD_TILEDIMENSIONS: TIFFSetupShortLong(tif, TIFFTAG_TILEWIDTH, dir++, td->td_tilewidth); TIFFSetupShortLong(tif, TIFFTAG_TILELENGTH, dir, td->td_tilelength); break; case FIELD_COMPRESSION: TIFFSetupShort(tif, TIFFTAG_COMPRESSION, dir, td->td_compression); break; case FIELD_PHOTOMETRIC: TIFFSetupShort(tif, TIFFTAG_PHOTOMETRIC, dir, td->td_photometric); break; case FIELD_POSITION: WriteRationalPair(TIFF_RATIONAL, TIFFTAG_XPOSITION, td->td_xposition, TIFFTAG_YPOSITION, td->td_yposition); break; case FIELD_RESOLUTION: WriteRationalPair(TIFF_RATIONAL, TIFFTAG_XRESOLUTION, td->td_xresolution, TIFFTAG_YRESOLUTION, td->td_yresolution); break; case FIELD_BITSPERSAMPLE: case FIELD_MINSAMPLEVALUE: case FIELD_MAXSAMPLEVALUE: case FIELD_SAMPLEFORMAT: if (!TIFFWritePerSampleShorts(tif, fip->field_tag, dir)) goto bad; break; case FIELD_SMINSAMPLEVALUE: case FIELD_SMAXSAMPLEVALUE: if (!TIFFWritePerSampleAnys(tif, _TIFFSampleToTagType(tif), fip->field_tag, dir)) goto bad; break; case FIELD_PAGENUMBER: case FIELD_HALFTONEHINTS: case FIELD_YCBCRSUBSAMPLING: if (!TIFFSetupShortPair(tif, fip->field_tag, dir)) goto bad; break; case FIELD_INKNAMES: if (!TIFFWriteInkNames(tif, dir)) goto bad; break; case FIELD_TRANSFERFUNCTION: if (!TIFFWriteTransferFunction(tif, dir)) goto bad; break; case FIELD_SUBIFD: /* * XXX: Always write this field using LONG type * for backward compatibility. */ dir->tdir_tag = (uint16) fip->field_tag; dir->tdir_type = (uint16) TIFF_LONG; dir->tdir_count = (uint32) td->td_nsubifd; if (!TIFFWriteLongArray(tif, dir, td->td_subifd)) goto bad; /* * Total hack: if this directory includes a SubIFD * tag then force the next <n> directories to be * written as ``sub directories'' of this one. This * is used to write things like thumbnails and * image masks that one wants to keep out of the * normal directory linkage access mechanism. */ if (dir->tdir_count > 0) { tif->tif_flags |= TIFF_INSUBIFD; tif->tif_nsubifd = (uint16) dir->tdir_count; if (dir->tdir_count > 1) tif->tif_subifdoff = dir->tdir_offset; else tif->tif_subifdoff = (uint32)( tif->tif_diroff + sizeof (uint16) + ((char*)&dir->tdir_offset-data)); } break; default: /* XXX: Should be fixed and removed. */ if (fip->field_tag == TIFFTAG_DOTRANGE) { if (!TIFFSetupShortPair(tif, fip->field_tag, dir)) goto bad; } else if (!TIFFWriteNormalTag(tif, dir, fip)) goto bad; break; } dir++; if( fip->field_bit != FIELD_CUSTOM ) ResetFieldBit(fields, fip->field_bit); } /* * Write directory. */ dircount = (uint16) nfields; diroff = (uint32) tif->tif_nextdiroff; if (tif->tif_flags & TIFF_SWAB) { /* * The file's byte order is opposite to the * native machine architecture. We overwrite * the directory information with impunity * because it'll be released below after we * write it to the file. Note that all the * other tag construction routines assume that * we do this byte-swapping; i.e. they only * byte-swap indirect data. */ for (dir = (TIFFDirEntry*) data; dircount; dir++, dircount--) { TIFFSwabArrayOfShort(&dir->tdir_tag, 2); TIFFSwabArrayOfLong(&dir->tdir_count, 2); } dircount = (uint16) nfields; TIFFSwabShort(&dircount); TIFFSwabLong(&diroff); } (void) TIFFSeekFile(tif, tif->tif_diroff, SEEK_SET); if (!WriteOK(tif, &dircount, sizeof (dircount))) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing directory count"); goto bad; } if (!WriteOK(tif, data, dirsize)) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing directory contents"); goto bad; } if (!WriteOK(tif, &diroff, sizeof (uint32))) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing directory link"); goto bad; } if (done) { TIFFFreeDirectory(tif); tif->tif_flags &= ~TIFF_DIRTYDIRECT; (*tif->tif_cleanup)(tif); /* * Reset directory-related state for subsequent * directories. */ TIFFCreateDirectory(tif); } _TIFFfree(data); return (1); bad: _TIFFfree(data); return (0); } #undef WriteRationalPair int TIFFWriteDirectory(TIFF* tif) { return _TIFFWriteDirectory(tif, TRUE); } /* * Similar to TIFFWriteDirectory(), writes the directory out * but leaves all data structures in memory so that it can be * written again. This will make a partially written TIFF file * readable before it is successfully completed/closed. */ int TIFFCheckpointDirectory(TIFF* tif) { int rc; /* Setup the strips arrays, if they haven't already been. */ if (tif->tif_dir.td_stripoffset == NULL) (void) TIFFSetupStrips(tif); rc = _TIFFWriteDirectory(tif, FALSE); (void) TIFFSetWriteOffset(tif, TIFFSeekFile(tif, 0, SEEK_END)); return rc; } static int _TIFFWriteCustomDirectory(TIFF* tif, toff_t *pdiroff) { uint16 dircount; uint32 nfields; tsize_t dirsize; char* data; TIFFDirEntry* dir; TIFFDirectory* td; unsigned long b, fields[FIELD_SETLONGS]; int fi, nfi; if (tif->tif_mode == O_RDONLY) return (1); td = &tif->tif_dir; /* * Size the directory so that we can calculate * offsets for the data items that aren't kept * in-place in each field. */ nfields = 0; for (b = 0; b <= FIELD_LAST; b++) if (TIFFFieldSet(tif, b) && b != FIELD_CUSTOM) nfields += (b < FIELD_SUBFILETYPE ? 2 : 1); nfields += td->td_customValueCount; dirsize = nfields * sizeof (TIFFDirEntry); data = (char*) _TIFFmalloc(dirsize); if (data == NULL) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Cannot write directory, out of space"); return (0); } /* * Put the directory at the end of the file. */ tif->tif_diroff = (TIFFSeekFile(tif, (toff_t) 0, SEEK_END)+1) &~ 1; tif->tif_dataoff = (toff_t)( tif->tif_diroff + sizeof (uint16) + dirsize + sizeof (toff_t)); if (tif->tif_dataoff & 1) tif->tif_dataoff++; (void) TIFFSeekFile(tif, tif->tif_dataoff, SEEK_SET); dir = (TIFFDirEntry*) data; /* * Setup external form of directory * entries and write data items. */ _TIFFmemcpy(fields, td->td_fieldsset, sizeof (fields)); for (fi = 0, nfi = tif->tif_nfields; nfi > 0; nfi--, fi++) { const TIFFFieldInfo* fip = tif->tif_fieldinfo[fi]; /* * For custom fields, we test to see if the custom field * is set or not. For normal fields, we just use the * FieldSet test. */ if( fip->field_bit == FIELD_CUSTOM ) { int ci, is_set = FALSE; for( ci = 0; ci < td->td_customValueCount; ci++ ) is_set |= (td->td_customValues[ci].info == fip); if( !is_set ) continue; } else if (!FieldSet(fields, fip->field_bit)) continue; if( fip->field_bit != FIELD_CUSTOM ) ResetFieldBit(fields, fip->field_bit); } /* * Write directory. */ dircount = (uint16) nfields; *pdiroff = (uint32) tif->tif_nextdiroff; if (tif->tif_flags & TIFF_SWAB) { /* * The file's byte order is opposite to the * native machine architecture. We overwrite * the directory information with impunity * because it'll be released below after we * write it to the file. Note that all the * other tag construction routines assume that * we do this byte-swapping; i.e. they only * byte-swap indirect data. */ for (dir = (TIFFDirEntry*) data; dircount; dir++, dircount--) { TIFFSwabArrayOfShort(&dir->tdir_tag, 2); TIFFSwabArrayOfLong(&dir->tdir_count, 2); } dircount = (uint16) nfields; TIFFSwabShort(&dircount); TIFFSwabLong(pdiroff); } (void) TIFFSeekFile(tif, tif->tif_diroff, SEEK_SET); if (!WriteOK(tif, &dircount, sizeof (dircount))) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing directory count"); goto bad; } if (!WriteOK(tif, data, dirsize)) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing directory contents"); goto bad; } if (!WriteOK(tif, pdiroff, sizeof (uint32))) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing directory link"); goto bad; } _TIFFfree(data); return (1); bad: _TIFFfree(data); return (0); } int TIFFWriteCustomDirectory(TIFF* tif, toff_t *pdiroff) { return _TIFFWriteCustomDirectory(tif, pdiroff); } /* * Process tags that are not special cased. */ static int TIFFWriteNormalTag(TIFF* tif, TIFFDirEntry* dir, const TIFFFieldInfo* fip) { uint16 wc = (uint16) fip->field_writecount; uint32 wc2; dir->tdir_tag = (uint16) fip->field_tag; dir->tdir_type = (uint16) fip->field_type; dir->tdir_count = wc; switch (fip->field_type) { case TIFF_SHORT: case TIFF_SSHORT: if (fip->field_passcount) { uint16* wp; if (wc == (uint16) TIFF_VARIABLE2) { TIFFGetField(tif, fip->field_tag, &wc2, &wp); dir->tdir_count = wc2; } else { /* Assume TIFF_VARIABLE */ TIFFGetField(tif, fip->field_tag, &wc, &wp); dir->tdir_count = wc; } if (!TIFFWriteShortArray(tif, dir, wp)) return 0; } else { if (wc == 1) { uint16 sv; TIFFGetField(tif, fip->field_tag, &sv); dir->tdir_offset = TIFFInsertData(tif, dir->tdir_type, sv); } else { uint16* wp; TIFFGetField(tif, fip->field_tag, &wp); if (!TIFFWriteShortArray(tif, dir, wp)) return 0; } } break; case TIFF_LONG: case TIFF_SLONG: case TIFF_IFD: if (fip->field_passcount) { uint32* lp; if (wc == (uint16) TIFF_VARIABLE2) { TIFFGetField(tif, fip->field_tag, &wc2, &lp); dir->tdir_count = wc2; } else { /* Assume TIFF_VARIABLE */ TIFFGetField(tif, fip->field_tag, &wc, &lp); dir->tdir_count = wc; } if (!TIFFWriteLongArray(tif, dir, lp)) return 0; } else { if (wc == 1) { /* XXX handle LONG->SHORT conversion */ TIFFGetField(tif, fip->field_tag, &dir->tdir_offset); } else { uint32* lp; TIFFGetField(tif, fip->field_tag, &lp); if (!TIFFWriteLongArray(tif, dir, lp)) return 0; } } break; case TIFF_RATIONAL: case TIFF_SRATIONAL: if (fip->field_passcount) { float* fp; if (wc == (uint16) TIFF_VARIABLE2) { TIFFGetField(tif, fip->field_tag, &wc2, &fp); dir->tdir_count = wc2; } else { /* Assume TIFF_VARIABLE */ TIFFGetField(tif, fip->field_tag, &wc, &fp); dir->tdir_count = wc; } if (!TIFFWriteRationalArray(tif, dir, fp)) return 0; } else { if (wc == 1) { float fv; TIFFGetField(tif, fip->field_tag, &fv); if (!TIFFWriteRationalArray(tif, dir, &fv)) return 0; } else { float* fp; TIFFGetField(tif, fip->field_tag, &fp); if (!TIFFWriteRationalArray(tif, dir, fp)) return 0; } } break; case TIFF_FLOAT: if (fip->field_passcount) { float* fp; if (wc == (uint16) TIFF_VARIABLE2) { TIFFGetField(tif, fip->field_tag, &wc2, &fp); dir->tdir_count = wc2; } else { /* Assume TIFF_VARIABLE */ TIFFGetField(tif, fip->field_tag, &wc, &fp); dir->tdir_count = wc; } if (!TIFFWriteFloatArray(tif, dir, fp)) return 0; } else { if (wc == 1) { float fv; TIFFGetField(tif, fip->field_tag, &fv); if (!TIFFWriteFloatArray(tif, dir, &fv)) return 0; } else { float* fp; TIFFGetField(tif, fip->field_tag, &fp); if (!TIFFWriteFloatArray(tif, dir, fp)) return 0; } } break; case TIFF_DOUBLE: if (fip->field_passcount) { double* dp; if (wc == (uint16) TIFF_VARIABLE2) { TIFFGetField(tif, fip->field_tag, &wc2, &dp); dir->tdir_count = wc2; } else { /* Assume TIFF_VARIABLE */ TIFFGetField(tif, fip->field_tag, &wc, &dp); dir->tdir_count = wc; } if (!TIFFWriteDoubleArray(tif, dir, dp)) return 0; } else { if (wc == 1) { double dv; TIFFGetField(tif, fip->field_tag, &dv); if (!TIFFWriteDoubleArray(tif, dir, &dv)) return 0; } else { double* dp; TIFFGetField(tif, fip->field_tag, &dp); if (!TIFFWriteDoubleArray(tif, dir, dp)) return 0; } } break; case TIFF_ASCII: { char* cp; if (fip->field_passcount) { if( wc == (uint16) TIFF_VARIABLE2 ) TIFFGetField(tif, fip->field_tag, &wc2, &cp); else TIFFGetField(tif, fip->field_tag, &wc, &cp); } else TIFFGetField(tif, fip->field_tag, &cp); dir->tdir_count = (uint32) (strlen(cp) + 1); if (!TIFFWriteByteArray(tif, dir, cp)) return (0); } break; case TIFF_BYTE: case TIFF_SBYTE: if (fip->field_passcount) { char* cp; if (wc == (uint16) TIFF_VARIABLE2) { TIFFGetField(tif, fip->field_tag, &wc2, &cp); dir->tdir_count = wc2; } else { /* Assume TIFF_VARIABLE */ TIFFGetField(tif, fip->field_tag, &wc, &cp); dir->tdir_count = wc; } if (!TIFFWriteByteArray(tif, dir, cp)) return 0; } else { if (wc == 1) { char cv; TIFFGetField(tif, fip->field_tag, &cv); if (!TIFFWriteByteArray(tif, dir, &cv)) return 0; } else { char* cp; TIFFGetField(tif, fip->field_tag, &cp); if (!TIFFWriteByteArray(tif, dir, cp)) return 0; } } break; case TIFF_UNDEFINED: { char* cp; if (wc == (unsigned short) TIFF_VARIABLE) { TIFFGetField(tif, fip->field_tag, &wc, &cp); dir->tdir_count = wc; } else if (wc == (unsigned short) TIFF_VARIABLE2) { TIFFGetField(tif, fip->field_tag, &wc2, &cp); dir->tdir_count = wc2; } else TIFFGetField(tif, fip->field_tag, &cp); if (!TIFFWriteByteArray(tif, dir, cp)) return (0); } break; case TIFF_NOTYPE: break; } return (1); } /* * Setup a directory entry with either a SHORT * or LONG type according to the value. */ static void TIFFSetupShortLong(TIFF* tif, ttag_t tag, TIFFDirEntry* dir, uint32 v) { dir->tdir_tag = (uint16) tag; dir->tdir_count = 1; if (v > 0xffffL) { dir->tdir_type = (short) TIFF_LONG; dir->tdir_offset = v; } else { dir->tdir_type = (short) TIFF_SHORT; dir->tdir_offset = TIFFInsertData(tif, (int) TIFF_SHORT, v); } } /* * Setup a SHORT directory entry */ static void TIFFSetupShort(TIFF* tif, ttag_t tag, TIFFDirEntry* dir, uint16 v) { dir->tdir_tag = (uint16) tag; dir->tdir_count = 1; dir->tdir_type = (short) TIFF_SHORT; dir->tdir_offset = TIFFInsertData(tif, (int) TIFF_SHORT, v); } #undef MakeShortDirent #define NITEMS(x) (sizeof (x) / sizeof (x[0])) /* * Setup a directory entry that references a * samples/pixel array of SHORT values and * (potentially) write the associated indirect * values. */ static int TIFFWritePerSampleShorts(TIFF* tif, ttag_t tag, TIFFDirEntry* dir) { uint16 buf[10], v; uint16* w = buf; uint16 i, samples = tif->tif_dir.td_samplesperpixel; int status; if (samples > NITEMS(buf)) { w = (uint16*) _TIFFmalloc(samples * sizeof (uint16)); if (w == NULL) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "No space to write per-sample shorts"); return (0); } } TIFFGetField(tif, tag, &v); for (i = 0; i < samples; i++) w[i] = v; dir->tdir_tag = (uint16) tag; dir->tdir_type = (uint16) TIFF_SHORT; dir->tdir_count = samples; status = TIFFWriteShortArray(tif, dir, w); if (w != buf) _TIFFfree((char*) w); return (status); } /* * Setup a directory entry that references a samples/pixel array of ``type'' * values and (potentially) write the associated indirect values. The source * data from TIFFGetField() for the specified tag must be returned as double. */ static int TIFFWritePerSampleAnys(TIFF* tif, TIFFDataType type, ttag_t tag, TIFFDirEntry* dir) { double buf[10], v; double* w = buf; uint16 i, samples = tif->tif_dir.td_samplesperpixel; int status; if (samples > NITEMS(buf)) { w = (double*) _TIFFmalloc(samples * sizeof (double)); if (w == NULL) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "No space to write per-sample values"); return (0); } } TIFFGetField(tif, tag, &v); for (i = 0; i < samples; i++) w[i] = v; status = TIFFWriteAnyArray(tif, type, tag, dir, samples, w); if (w != buf) _TIFFfree(w); return (status); } #undef NITEMS /* * Setup a pair of shorts that are returned by * value, rather than as a reference to an array. */ static int TIFFSetupShortPair(TIFF* tif, ttag_t tag, TIFFDirEntry* dir) { uint16 v[2]; TIFFGetField(tif, tag, &v[0], &v[1]); dir->tdir_tag = (uint16) tag; dir->tdir_type = (uint16) TIFF_SHORT; dir->tdir_count = 2; return (TIFFWriteShortArray(tif, dir, v)); } /* * Setup a directory entry for an NxM table of shorts, * where M is known to be 2**bitspersample, and write * the associated indirect data. */ static int TIFFWriteShortTable(TIFF* tif, ttag_t tag, TIFFDirEntry* dir, uint32 n, uint16** table) { uint32 i, off; dir->tdir_tag = (uint16) tag; dir->tdir_type = (short) TIFF_SHORT; /* XXX -- yech, fool TIFFWriteData */ dir->tdir_count = (uint32) (1L<<tif->tif_dir.td_bitspersample); off = tif->tif_dataoff; for (i = 0; i < n; i++) if (!TIFFWriteData(tif, dir, (char *)table[i])) return (0); dir->tdir_count *= n; dir->tdir_offset = off; return (1); } /* * Write/copy data associated with an ASCII or opaque tag value. */ static int TIFFWriteByteArray(TIFF* tif, TIFFDirEntry* dir, char* cp) { if (dir->tdir_count <= 4) { if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) { dir->tdir_offset = (uint32)cp[0] << 24; if (dir->tdir_count >= 2) dir->tdir_offset |= (uint32)cp[1] << 16; if (dir->tdir_count >= 3) dir->tdir_offset |= (uint32)cp[2] << 8; if (dir->tdir_count == 4) dir->tdir_offset |= cp[3]; } else { dir->tdir_offset = cp[0]; if (dir->tdir_count >= 2) dir->tdir_offset |= (uint32) cp[1] << 8; if (dir->tdir_count >= 3) dir->tdir_offset |= (uint32) cp[2] << 16; if (dir->tdir_count == 4) dir->tdir_offset |= (uint32) cp[3] << 24; } return 1; } else return TIFFWriteData(tif, dir, cp); } /* * Setup a directory entry of an array of SHORT * or SSHORT and write the associated indirect values. */ static int TIFFWriteShortArray(TIFF* tif, TIFFDirEntry* dir, uint16* v) { if (dir->tdir_count <= 2) { if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) { dir->tdir_offset = (uint32) v[0] << 16; if (dir->tdir_count == 2) dir->tdir_offset |= v[1] & 0xffff; } else { dir->tdir_offset = v[0] & 0xffff; if (dir->tdir_count == 2) dir->tdir_offset |= (uint32) v[1] << 16; } return (1); } else return (TIFFWriteData(tif, dir, (char*) v)); } /* * Setup a directory entry of an array of LONG * or SLONG and write the associated indirect values. */ static int TIFFWriteLongArray(TIFF* tif, TIFFDirEntry* dir, uint32* v) { if (dir->tdir_count == 1) { dir->tdir_offset = v[0]; return (1); } else return (TIFFWriteData(tif, dir, (char*) v)); } /* * Setup a directory entry of an array of RATIONAL * or SRATIONAL and write the associated indirect values. */ static int TIFFWriteRationalArray(TIFF* tif, TIFFDirEntry* dir, float* v) { uint32 i; uint32* t; int status; t = (uint32*) _TIFFmalloc(2 * dir->tdir_count * sizeof (uint32)); if (t == NULL) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "No space to write RATIONAL array"); return (0); } for (i = 0; i < dir->tdir_count; i++) { float fv = v[i]; int sign = 1; uint32 den; if (fv < 0) { if (dir->tdir_type == TIFF_RATIONAL) { TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "\"%s\": Information lost writing value (%g) as (unsigned) RATIONAL", _TIFFFieldWithTag(tif,dir->tdir_tag)->field_name, fv); fv = 0; } else fv = -fv, sign = -1; } den = 1L; if (fv > 0) { while (fv < 1L<<(31-3) && den < 1L<<(31-3)) fv *= 1<<3, den *= 1L<<3; } t[2*i+0] = (uint32) (sign * (fv + 0.5)); t[2*i+1] = den; } status = TIFFWriteData(tif, dir, (char *)t); _TIFFfree((char*) t); return (status); } static int TIFFWriteFloatArray(TIFF* tif, TIFFDirEntry* dir, float* v) { TIFFCvtNativeToIEEEFloat(tif, dir->tdir_count, v); if (dir->tdir_count == 1) { dir->tdir_offset = *(uint32*) &v[0]; return (1); } else return (TIFFWriteData(tif, dir, (char*) v)); } static int TIFFWriteDoubleArray(TIFF* tif, TIFFDirEntry* dir, double* v) { TIFFCvtNativeToIEEEDouble(tif, dir->tdir_count, v); return (TIFFWriteData(tif, dir, (char*) v)); } /* * Write an array of ``type'' values for a specified tag (i.e. this is a tag * which is allowed to have different types, e.g. SMaxSampleType). * Internally the data values are represented as double since a double can * hold any of the TIFF tag types (yes, this should really be an abstract * type tany_t for portability). The data is converted into the specified * type in a temporary buffer and then handed off to the appropriate array * writer. */ static int TIFFWriteAnyArray(TIFF* tif, TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, double* v) { char buf[10 * sizeof(double)]; char* w = buf; int i, status = 0; if (n * TIFFDataWidth(type) > sizeof buf) { w = (char*) _TIFFmalloc(n * TIFFDataWidth(type)); if (w == NULL) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "No space to write array"); return (0); } } dir->tdir_tag = (uint16) tag; dir->tdir_type = (uint16) type; dir->tdir_count = n; switch (type) { case TIFF_BYTE: { uint8* bp = (uint8*) w; for (i = 0; i < (int) n; i++) bp[i] = (uint8) v[i]; if (!TIFFWriteByteArray(tif, dir, (char*) bp)) goto out; } break; case TIFF_SBYTE: { int8* bp = (int8*) w; for (i = 0; i < (int) n; i++) bp[i] = (int8) v[i]; if (!TIFFWriteByteArray(tif, dir, (char*) bp)) goto out; } break; case TIFF_SHORT: { uint16* bp = (uint16*) w; for (i = 0; i < (int) n; i++) bp[i] = (uint16) v[i]; if (!TIFFWriteShortArray(tif, dir, (uint16*)bp)) goto out; } break; case TIFF_SSHORT: { int16* bp = (int16*) w; for (i = 0; i < (int) n; i++) bp[i] = (int16) v[i]; if (!TIFFWriteShortArray(tif, dir, (uint16*)bp)) goto out; } break; case TIFF_LONG: { uint32* bp = (uint32*) w; for (i = 0; i < (int) n; i++) bp[i] = (uint32) v[i]; if (!TIFFWriteLongArray(tif, dir, bp)) goto out; } break; case TIFF_SLONG: { int32* bp = (int32*) w; for (i = 0; i < (int) n; i++) bp[i] = (int32) v[i]; if (!TIFFWriteLongArray(tif, dir, (uint32*) bp)) goto out; } break; case TIFF_FLOAT: { float* bp = (float*) w; for (i = 0; i < (int) n; i++) bp[i] = (float) v[i]; if (!TIFFWriteFloatArray(tif, dir, bp)) goto out; } break; case TIFF_DOUBLE: { if( !TIFFWriteDoubleArray(tif, dir, v)) goto out; } break; default: /* TIFF_NOTYPE */ /* TIFF_ASCII */ /* TIFF_UNDEFINED */ /* TIFF_RATIONAL */ /* TIFF_SRATIONAL */ goto out; } status = 1; out: if (w != buf) _TIFFfree(w); return (status); } static int TIFFWriteTransferFunction(TIFF* tif, TIFFDirEntry* dir) { TIFFDirectory* td = &tif->tif_dir; tsize_t n = (1L<<td->td_bitspersample) * sizeof (uint16); uint16** tf = td->td_transferfunction; int ncols; /* * Check if the table can be written as a single column, * or if it must be written as 3 columns. Note that we * write a 3-column tag if there are 2 samples/pixel and * a single column of data won't suffice--hmm. */ switch (td->td_samplesperpixel - td->td_extrasamples) { default: if (_TIFFmemcmp(tf[0], tf[2], n)) { ncols = 3; break; } case 2: if (_TIFFmemcmp(tf[0], tf[1], n)) { ncols = 3; break; } case 1: case 0: ncols = 1; } return (TIFFWriteShortTable(tif, TIFFTAG_TRANSFERFUNCTION, dir, ncols, tf)); } static int TIFFWriteInkNames(TIFF* tif, TIFFDirEntry* dir) { TIFFDirectory* td = &tif->tif_dir; dir->tdir_tag = TIFFTAG_INKNAMES; dir->tdir_type = (short) TIFF_ASCII; dir->tdir_count = td->td_inknameslen; return (TIFFWriteByteArray(tif, dir, td->td_inknames)); } /* * Write a contiguous directory item. */ static int TIFFWriteData(TIFF* tif, TIFFDirEntry* dir, char* cp) { tsize_t cc; if (tif->tif_flags & TIFF_SWAB) { switch (dir->tdir_type) { case TIFF_SHORT: case TIFF_SSHORT: TIFFSwabArrayOfShort((uint16*) cp, dir->tdir_count); break; case TIFF_LONG: case TIFF_SLONG: case TIFF_FLOAT: TIFFSwabArrayOfLong((uint32*) cp, dir->tdir_count); break; case TIFF_RATIONAL: case TIFF_SRATIONAL: TIFFSwabArrayOfLong((uint32*) cp, 2*dir->tdir_count); break; case TIFF_DOUBLE: TIFFSwabArrayOfDouble((double*) cp, dir->tdir_count); break; } } dir->tdir_offset = tif->tif_dataoff; cc = dir->tdir_count * TIFFDataWidth((TIFFDataType) dir->tdir_type); if (SeekOK(tif, dir->tdir_offset) && WriteOK(tif, cp, cc)) { tif->tif_dataoff += (cc + 1) & ~1; return (1); } TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing data for field \"%s\"", _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name); return (0); } /* * Similar to TIFFWriteDirectory(), but if the directory has already * been written once, it is relocated to the end of the file, in case it * has changed in size. Note that this will result in the loss of the * previously used directory space. */ int TIFFRewriteDirectory( TIFF *tif ) { static const char module[] = "TIFFRewriteDirectory"; /* We don't need to do anything special if it hasn't been written. */ if( tif->tif_diroff == 0 ) return TIFFWriteDirectory( tif ); /* ** Find and zero the pointer to this directory, so that TIFFLinkDirectory ** will cause it to be added after this directories current pre-link. */ /* Is it the first directory in the file? */ if (tif->tif_header.tiff_diroff == tif->tif_diroff) { tif->tif_header.tiff_diroff = 0; tif->tif_diroff = 0; TIFFSeekFile(tif, (toff_t)(TIFF_MAGIC_SIZE+TIFF_VERSION_SIZE), SEEK_SET); if (!WriteOK(tif, &(tif->tif_header.tiff_diroff), sizeof (tif->tif_diroff))) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error updating TIFF header"); return (0); } } else { toff_t nextdir, off; nextdir = tif->tif_header.tiff_diroff; do { uint16 dircount; if (!SeekOK(tif, nextdir) || !ReadOK(tif, &dircount, sizeof (dircount))) { TIFFErrorExt(tif->tif_clientdata, module, "Error fetching directory count"); return (0); } if (tif->tif_flags & TIFF_SWAB) TIFFSwabShort(&dircount); (void) TIFFSeekFile(tif, dircount * sizeof (TIFFDirEntry), SEEK_CUR); if (!ReadOK(tif, &nextdir, sizeof (nextdir))) { TIFFErrorExt(tif->tif_clientdata, module, "Error fetching directory link"); return (0); } if (tif->tif_flags & TIFF_SWAB) TIFFSwabLong(&nextdir); } while (nextdir != tif->tif_diroff && nextdir != 0); off = TIFFSeekFile(tif, 0, SEEK_CUR); /* get current offset */ (void) TIFFSeekFile(tif, off - (toff_t)sizeof(nextdir), SEEK_SET); tif->tif_diroff = 0; if (!WriteOK(tif, &(tif->tif_diroff), sizeof (nextdir))) { TIFFErrorExt(tif->tif_clientdata, module, "Error writing directory link"); return (0); } } /* ** Now use TIFFWriteDirectory() normally. */ return TIFFWriteDirectory( tif ); } /* * Link the current directory into the directory chain for the file. */ static int TIFFLinkDirectory(TIFF* tif) { static const char module[] = "TIFFLinkDirectory"; toff_t nextdir; toff_t diroff, off; tif->tif_diroff = (TIFFSeekFile(tif, (toff_t) 0, SEEK_END)+1) &~ 1; diroff = tif->tif_diroff; if (tif->tif_flags & TIFF_SWAB) TIFFSwabLong(&diroff); /* * Handle SubIFDs */ if (tif->tif_flags & TIFF_INSUBIFD) { (void) TIFFSeekFile(tif, tif->tif_subifdoff, SEEK_SET); if (!WriteOK(tif, &diroff, sizeof (diroff))) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Error writing SubIFD directory link", tif->tif_name); return (0); } /* * Advance to the next SubIFD or, if this is * the last one configured, revert back to the * normal directory linkage. */ if (--tif->tif_nsubifd) tif->tif_subifdoff += sizeof (diroff); else tif->tif_flags &= ~TIFF_INSUBIFD; return (1); } if (tif->tif_header.tiff_diroff == 0) { /* * First directory, overwrite offset in header. */ tif->tif_header.tiff_diroff = tif->tif_diroff; (void) TIFFSeekFile(tif, (toff_t)(TIFF_MAGIC_SIZE+TIFF_VERSION_SIZE), SEEK_SET); if (!WriteOK(tif, &diroff, sizeof (diroff))) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing TIFF header"); return (0); } return (1); } /* * Not the first directory, search to the last and append. */ nextdir = tif->tif_header.tiff_diroff; do { uint16 dircount; if (!SeekOK(tif, nextdir) || !ReadOK(tif, &dircount, sizeof (dircount))) { TIFFErrorExt(tif->tif_clientdata, module, "Error fetching directory count"); return (0); } if (tif->tif_flags & TIFF_SWAB) TIFFSwabShort(&dircount); (void) TIFFSeekFile(tif, dircount * sizeof (TIFFDirEntry), SEEK_CUR); if (!ReadOK(tif, &nextdir, sizeof (nextdir))) { TIFFErrorExt(tif->tif_clientdata, module, "Error fetching directory link"); return (0); } if (tif->tif_flags & TIFF_SWAB) TIFFSwabLong(&nextdir); } while (nextdir != 0); off = TIFFSeekFile(tif, 0, SEEK_CUR); /* get current offset */ (void) TIFFSeekFile(tif, off - (toff_t)sizeof(nextdir), SEEK_SET); if (!WriteOK(tif, &diroff, sizeof (diroff))) { TIFFErrorExt(tif->tif_clientdata, module, "Error writing directory link"); return (0); } return (1); } /* vim: set ts=8 sts=8 sw=8 noet: */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_read.c��������������������������������������������������0000644�0001750�0001750�00000052224�12320456500�021262� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_read.c,v 1.16 2007/02/22 11:33:44 dron Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * Scanline-oriented Read Support */ #include "tiffiop.h" #include <stdio.h> int TIFFFillStrip(TIFF*, tstrip_t); int TIFFFillTile(TIFF*, ttile_t); static int TIFFStartStrip(TIFF*, tstrip_t); static int TIFFStartTile(TIFF*, ttile_t); static int TIFFCheckRead(TIFF*, int); #define NOSTRIP ((tstrip_t) -1) /* undefined state */ #define NOTILE ((ttile_t) -1) /* undefined state */ /* * Seek to a random row+sample in a file. */ static int TIFFSeek(TIFF* tif, uint32 row, tsample_t sample) { register TIFFDirectory *td = &tif->tif_dir; tstrip_t strip; if (row >= td->td_imagelength) { /* out of range */ TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Row out of range, max %lu", (unsigned long) row, (unsigned long) td->td_imagelength); return (0); } if (td->td_planarconfig == PLANARCONFIG_SEPARATE) { if (sample >= td->td_samplesperpixel) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Sample out of range, max %lu", (unsigned long) sample, (unsigned long) td->td_samplesperpixel); return (0); } strip = sample*td->td_stripsperimage + row/td->td_rowsperstrip; } else strip = row / td->td_rowsperstrip; if (strip != tif->tif_curstrip) { /* different strip, refill */ if (!TIFFFillStrip(tif, strip)) return (0); } else if (row < tif->tif_row) { /* * Moving backwards within the same strip: backup * to the start and then decode forward (below). * * NB: If you're planning on lots of random access within a * strip, it's better to just read and decode the entire * strip, and then access the decoded data in a random fashion. */ if (!TIFFStartStrip(tif, strip)) return (0); } if (row != tif->tif_row) { /* * Seek forward to the desired row. */ if (!(*tif->tif_seek)(tif, row - tif->tif_row)) return (0); tif->tif_row = row; } return (1); } int TIFFReadScanline(TIFF* tif, tdata_t buf, uint32 row, tsample_t sample) { int e; if (!TIFFCheckRead(tif, 0)) return (-1); if( (e = TIFFSeek(tif, row, sample)) != 0) { /* * Decompress desired row into user buffer. */ e = (*tif->tif_decoderow) (tif, (tidata_t) buf, tif->tif_scanlinesize, sample); /* we are now poised at the beginning of the next row */ tif->tif_row = row + 1; if (e) (*tif->tif_postdecode)(tif, (tidata_t) buf, tif->tif_scanlinesize); } return (e > 0 ? 1 : -1); } /* * Read a strip of data and decompress the specified * amount into the user-supplied buffer. */ tsize_t TIFFReadEncodedStrip(TIFF* tif, tstrip_t strip, tdata_t buf, tsize_t size) { TIFFDirectory *td = &tif->tif_dir; uint32 nrows; tsize_t stripsize; tstrip_t sep_strip, strips_per_sep; if (!TIFFCheckRead(tif, 0)) return (-1); if (strip >= td->td_nstrips) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%ld: Strip out of range, max %ld", (long) strip, (long) td->td_nstrips); return (-1); } /* * Calculate the strip size according to the number of * rows in the strip (check for truncated last strip on any * of the separations). */ if( td->td_rowsperstrip >= td->td_imagelength ) strips_per_sep = 1; else strips_per_sep = (td->td_imagelength+td->td_rowsperstrip-1) / td->td_rowsperstrip; sep_strip = strip % strips_per_sep; if (sep_strip != strips_per_sep-1 || (nrows = td->td_imagelength % td->td_rowsperstrip) == 0) nrows = td->td_rowsperstrip; stripsize = TIFFVStripSize(tif, nrows); if (size == (tsize_t) -1) size = stripsize; else if (size > stripsize) size = stripsize; if (TIFFFillStrip(tif, strip) && (*tif->tif_decodestrip)(tif, (tidata_t) buf, size, (tsample_t)(strip / td->td_stripsperimage)) > 0 ) { (*tif->tif_postdecode)(tif, (tidata_t) buf, size); return (size); } else return ((tsize_t) -1); } static tsize_t TIFFReadRawStrip1(TIFF* tif, tstrip_t strip, tdata_t buf, tsize_t size, const char* module) { TIFFDirectory *td = &tif->tif_dir; assert((tif->tif_flags&TIFF_NOREADRAW)==0); if (!isMapped(tif)) { tsize_t cc; if (!SeekOK(tif, td->td_stripoffset[strip])) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Seek error at scanline %lu, strip %lu", tif->tif_name, (unsigned long) tif->tif_row, (unsigned long) strip); return (-1); } cc = TIFFReadFile(tif, buf, size); if (cc != size) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Read error at scanline %lu; got %lu bytes, expected %lu", tif->tif_name, (unsigned long) tif->tif_row, (unsigned long) cc, (unsigned long) size); return (-1); } } else { if (td->td_stripoffset[strip] + size > tif->tif_size) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Read error at scanline %lu, strip %lu; got %lu bytes, expected %lu", tif->tif_name, (unsigned long) tif->tif_row, (unsigned long) strip, (unsigned long) tif->tif_size - td->td_stripoffset[strip], (unsigned long) size); return (-1); } _TIFFmemcpy(buf, tif->tif_base + td->td_stripoffset[strip], size); } return (size); } /* * Read a strip of data from the file. */ tsize_t TIFFReadRawStrip(TIFF* tif, tstrip_t strip, tdata_t buf, tsize_t size) { static const char module[] = "TIFFReadRawStrip"; TIFFDirectory *td = &tif->tif_dir; /* * FIXME: butecount should have tsize_t type, but for now libtiff * defines tsize_t as a signed 32-bit integer and we are losing * ability to read arrays larger than 2^31 bytes. So we are using * uint32 instead of tsize_t here. */ uint32 bytecount; if (!TIFFCheckRead(tif, 0)) return ((tsize_t) -1); if (strip >= td->td_nstrips) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Strip out of range, max %lu", (unsigned long) strip, (unsigned long) td->td_nstrips); return ((tsize_t) -1); } if (tif->tif_flags&TIFF_NOREADRAW) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Compression scheme does not support access to raw uncompressed data"); return ((tsize_t) -1); } bytecount = td->td_stripbytecount[strip]; if (bytecount <= 0) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Invalid strip byte count, strip %lu", (unsigned long) bytecount, (unsigned long) strip); return ((tsize_t) -1); } if (size != (tsize_t)-1 && (uint32)size < bytecount) bytecount = size; return (TIFFReadRawStrip1(tif, strip, buf, bytecount, module)); } /* * Read the specified strip and setup for decoding. The data buffer is * expanded, as necessary, to hold the strip's data. */ int TIFFFillStrip(TIFF* tif, tstrip_t strip) { static const char module[] = "TIFFFillStrip"; TIFFDirectory *td = &tif->tif_dir; if ((tif->tif_flags&TIFF_NOREADRAW)==0) { /* * FIXME: butecount should have tsize_t type, but for now * libtiff defines tsize_t as a signed 32-bit integer and we * are losing ability to read arrays larger than 2^31 bytes. * So we are using uint32 instead of tsize_t here. */ uint32 bytecount = td->td_stripbytecount[strip]; if (bytecount <= 0) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Invalid strip byte count %lu, strip %lu", tif->tif_name, (unsigned long) bytecount, (unsigned long) strip); return (0); } if (isMapped(tif) && (isFillOrder(tif, td->td_fillorder) || (tif->tif_flags & TIFF_NOBITREV))) { /* * The image is mapped into memory and we either don't * need to flip bits or the compression routine is * going to handle this operation itself. In this * case, avoid copying the raw data and instead just * reference the data from the memory mapped file * image. This assumes that the decompression * routines do not modify the contents of the raw data * buffer (if they try to, the application will get a * fault since the file is mapped read-only). */ if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata) _TIFFfree(tif->tif_rawdata); tif->tif_flags &= ~TIFF_MYBUFFER; /* * We must check for overflow, potentially causing * an OOB read. Instead of simple * * td->td_stripoffset[strip]+bytecount > tif->tif_size * * comparison (which can overflow) we do the following * two comparisons: */ if (bytecount > tif->tif_size || td->td_stripoffset[strip] > tif->tif_size - bytecount) { /* * This error message might seem strange, but * it's what would happen if a read were done * instead. */ TIFFErrorExt(tif->tif_clientdata, module, "%s: Read error on strip %lu; " "got %lu bytes, expected %lu", tif->tif_name, (unsigned long) strip, (unsigned long) tif->tif_size - td->td_stripoffset[strip], (unsigned long) bytecount); tif->tif_curstrip = NOSTRIP; return (0); } tif->tif_rawdatasize = bytecount; tif->tif_rawdata = tif->tif_base + td->td_stripoffset[strip]; } else { /* * Expand raw data buffer, if needed, to hold data * strip coming from file (perhaps should set upper * bound on the size of a buffer we'll use?). */ if (bytecount > (uint32)tif->tif_rawdatasize) { tif->tif_curstrip = NOSTRIP; if ((tif->tif_flags & TIFF_MYBUFFER) == 0) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Data buffer too small to hold strip %lu", tif->tif_name, (unsigned long) strip); return (0); } if (!TIFFReadBufferSetup(tif, 0, TIFFroundup(bytecount, 1024))) return (0); } if ((uint32)TIFFReadRawStrip1(tif, strip, (unsigned char *)tif->tif_rawdata, bytecount, module) != bytecount) return (0); if (!isFillOrder(tif, td->td_fillorder) && (tif->tif_flags & TIFF_NOBITREV) == 0) TIFFReverseBits(tif->tif_rawdata, bytecount); } } return (TIFFStartStrip(tif, strip)); } /* * Tile-oriented Read Support * Contributed by Nancy Cam (Silicon Graphics). */ /* * Read and decompress a tile of data. The * tile is selected by the (x,y,z,s) coordinates. */ tsize_t TIFFReadTile(TIFF* tif, tdata_t buf, uint32 x, uint32 y, uint32 z, tsample_t s) { if (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s)) return (-1); return (TIFFReadEncodedTile(tif, TIFFComputeTile(tif, x, y, z, s), buf, (tsize_t) -1)); } /* * Read a tile of data and decompress the specified * amount into the user-supplied buffer. */ tsize_t TIFFReadEncodedTile(TIFF* tif, ttile_t tile, tdata_t buf, tsize_t size) { TIFFDirectory *td = &tif->tif_dir; tsize_t tilesize = tif->tif_tilesize; if (!TIFFCheckRead(tif, 1)) return (-1); if (tile >= td->td_nstrips) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%ld: Tile out of range, max %ld", (long) tile, (unsigned long) td->td_nstrips); return (-1); } if (size == (tsize_t) -1) size = tilesize; else if (size > tilesize) size = tilesize; if (TIFFFillTile(tif, tile) && (*tif->tif_decodetile)(tif, (tidata_t) buf, size, (tsample_t)(tile/td->td_stripsperimage))) { (*tif->tif_postdecode)(tif, (tidata_t) buf, size); return (size); } else return (-1); } static tsize_t TIFFReadRawTile1(TIFF* tif, ttile_t tile, tdata_t buf, tsize_t size, const char* module) { TIFFDirectory *td = &tif->tif_dir; assert((tif->tif_flags&TIFF_NOREADRAW)==0); if (!isMapped(tif)) { tsize_t cc; if (!SeekOK(tif, td->td_stripoffset[tile])) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Seek error at row %ld, col %ld, tile %ld", tif->tif_name, (long) tif->tif_row, (long) tif->tif_col, (long) tile); return ((tsize_t) -1); } cc = TIFFReadFile(tif, buf, size); if (cc != size) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Read error at row %ld, col %ld; got %lu bytes, expected %lu", tif->tif_name, (long) tif->tif_row, (long) tif->tif_col, (unsigned long) cc, (unsigned long) size); return ((tsize_t) -1); } } else { if (td->td_stripoffset[tile] + size > tif->tif_size) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Read error at row %ld, col %ld, tile %ld; got %lu bytes, expected %lu", tif->tif_name, (long) tif->tif_row, (long) tif->tif_col, (long) tile, (unsigned long) tif->tif_size - td->td_stripoffset[tile], (unsigned long) size); return ((tsize_t) -1); } _TIFFmemcpy(buf, tif->tif_base + td->td_stripoffset[tile], size); } return (size); } /* * Read a tile of data from the file. */ tsize_t TIFFReadRawTile(TIFF* tif, ttile_t tile, tdata_t buf, tsize_t size) { static const char module[] = "TIFFReadRawTile"; TIFFDirectory *td = &tif->tif_dir; /* * FIXME: butecount should have tsize_t type, but for now libtiff * defines tsize_t as a signed 32-bit integer and we are losing * ability to read arrays larger than 2^31 bytes. So we are using * uint32 instead of tsize_t here. */ uint32 bytecount; if (!TIFFCheckRead(tif, 1)) return ((tsize_t) -1); if (tile >= td->td_nstrips) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Tile out of range, max %lu", (unsigned long) tile, (unsigned long) td->td_nstrips); return ((tsize_t) -1); } if (tif->tif_flags&TIFF_NOREADRAW) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Compression scheme does not support access to raw uncompressed data"); return ((tsize_t) -1); } bytecount = td->td_stripbytecount[tile]; if (size != (tsize_t) -1 && (uint32)size < bytecount) bytecount = size; return (TIFFReadRawTile1(tif, tile, buf, bytecount, module)); } /* * Read the specified tile and setup for decoding. The data buffer is * expanded, as necessary, to hold the tile's data. */ int TIFFFillTile(TIFF* tif, ttile_t tile) { static const char module[] = "TIFFFillTile"; TIFFDirectory *td = &tif->tif_dir; if ((tif->tif_flags&TIFF_NOREADRAW)==0) { /* * FIXME: butecount should have tsize_t type, but for now * libtiff defines tsize_t as a signed 32-bit integer and we * are losing ability to read arrays larger than 2^31 bytes. * So we are using uint32 instead of tsize_t here. */ uint32 bytecount = td->td_stripbytecount[tile]; if (bytecount <= 0) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Invalid tile byte count, tile %lu", (unsigned long) bytecount, (unsigned long) tile); return (0); } if (isMapped(tif) && (isFillOrder(tif, td->td_fillorder) || (tif->tif_flags & TIFF_NOBITREV))) { /* * The image is mapped into memory and we either don't * need to flip bits or the compression routine is * going to handle this operation itself. In this * case, avoid copying the raw data and instead just * reference the data from the memory mapped file * image. This assumes that the decompression * routines do not modify the contents of the raw data * buffer (if they try to, the application will get a * fault since the file is mapped read-only). */ if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata) _TIFFfree(tif->tif_rawdata); tif->tif_flags &= ~TIFF_MYBUFFER; /* * We must check for overflow, potentially causing * an OOB read. Instead of simple * * td->td_stripoffset[tile]+bytecount > tif->tif_size * * comparison (which can overflow) we do the following * two comparisons: */ if (bytecount > tif->tif_size || td->td_stripoffset[tile] > tif->tif_size - bytecount) { tif->tif_curtile = NOTILE; return (0); } tif->tif_rawdatasize = bytecount; tif->tif_rawdata = tif->tif_base + td->td_stripoffset[tile]; } else { /* * Expand raw data buffer, if needed, to hold data * tile coming from file (perhaps should set upper * bound on the size of a buffer we'll use?). */ if (bytecount > (uint32)tif->tif_rawdatasize) { tif->tif_curtile = NOTILE; if ((tif->tif_flags & TIFF_MYBUFFER) == 0) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Data buffer too small to hold tile %ld", tif->tif_name, (long) tile); return (0); } if (!TIFFReadBufferSetup(tif, 0, TIFFroundup(bytecount, 1024))) return (0); } if ((uint32)TIFFReadRawTile1(tif, tile, (unsigned char *)tif->tif_rawdata, bytecount, module) != bytecount) return (0); if (!isFillOrder(tif, td->td_fillorder) && (tif->tif_flags & TIFF_NOBITREV) == 0) TIFFReverseBits(tif->tif_rawdata, bytecount); } } return (TIFFStartTile(tif, tile)); } /* * Setup the raw data buffer in preparation for * reading a strip of raw data. If the buffer * is specified as zero, then a buffer of appropriate * size is allocated by the library. Otherwise, * the client must guarantee that the buffer is * large enough to hold any individual strip of * raw data. */ int TIFFReadBufferSetup(TIFF* tif, tdata_t bp, tsize_t size) { static const char module[] = "TIFFReadBufferSetup"; assert((tif->tif_flags&TIFF_NOREADRAW)==0); if (tif->tif_rawdata) { if (tif->tif_flags & TIFF_MYBUFFER) _TIFFfree(tif->tif_rawdata); tif->tif_rawdata = NULL; } if (bp) { tif->tif_rawdatasize = size; tif->tif_rawdata = (tidata_t) bp; tif->tif_flags &= ~TIFF_MYBUFFER; } else { tif->tif_rawdatasize = TIFFroundup(size, 1024); tif->tif_rawdata = (tidata_t) _TIFFmalloc(tif->tif_rawdatasize); tif->tif_flags |= TIFF_MYBUFFER; } if (tif->tif_rawdata == NULL) { TIFFErrorExt(tif->tif_clientdata, module, "%s: No space for data buffer at scanline %ld", tif->tif_name, (long) tif->tif_row); tif->tif_rawdatasize = 0; return (0); } return (1); } /* * Set state to appear as if a * strip has just been read in. */ static int TIFFStartStrip(TIFF* tif, tstrip_t strip) { TIFFDirectory *td = &tif->tif_dir; if ((tif->tif_flags & TIFF_CODERSETUP) == 0) { if (!(*tif->tif_setupdecode)(tif)) return (0); tif->tif_flags |= TIFF_CODERSETUP; } tif->tif_curstrip = strip; tif->tif_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip; if (tif->tif_flags&TIFF_NOREADRAW) { tif->tif_rawcp = NULL; tif->tif_rawcc = 0; } else { tif->tif_rawcp = tif->tif_rawdata; tif->tif_rawcc = td->td_stripbytecount[strip]; } return ((*tif->tif_predecode)(tif, (tsample_t)(strip / td->td_stripsperimage))); } /* * Set state to appear as if a * tile has just been read in. */ static int TIFFStartTile(TIFF* tif, ttile_t tile) { TIFFDirectory *td = &tif->tif_dir; if ((tif->tif_flags & TIFF_CODERSETUP) == 0) { if (!(*tif->tif_setupdecode)(tif)) return (0); tif->tif_flags |= TIFF_CODERSETUP; } tif->tif_curtile = tile; tif->tif_row = (tile % TIFFhowmany(td->td_imagewidth, td->td_tilewidth)) * td->td_tilelength; tif->tif_col = (tile % TIFFhowmany(td->td_imagelength, td->td_tilelength)) * td->td_tilewidth; if (tif->tif_flags&TIFF_NOREADRAW) { tif->tif_rawcp = NULL; tif->tif_rawcc = 0; } else { tif->tif_rawcp = tif->tif_rawdata; tif->tif_rawcc = td->td_stripbytecount[tile]; } return ((*tif->tif_predecode)(tif, (tsample_t)(tile/td->td_stripsperimage))); } static int TIFFCheckRead(TIFF* tif, int tiles) { if (tif->tif_mode == O_WRONLY) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "File not open for reading"); return (0); } if (tiles ^ isTiled(tif)) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, tiles ? "Can not read tiles from a stripped image" : "Can not read scanlines from a tiled image"); return (0); } return (1); } void _TIFFNoPostDecode(TIFF* tif, tidata_t buf, tsize_t cc) { (void) tif; (void) buf; (void) cc; } void _TIFFSwab16BitData(TIFF* tif, tidata_t buf, tsize_t cc) { (void) tif; assert((cc & 1) == 0); TIFFSwabArrayOfShort((uint16*) buf, cc/2); } void _TIFFSwab24BitData(TIFF* tif, tidata_t buf, tsize_t cc) { (void) tif; assert((cc % 3) == 0); TIFFSwabArrayOfTriples((uint8*) buf, cc/3); } void _TIFFSwab32BitData(TIFF* tif, tidata_t buf, tsize_t cc) { (void) tif; assert((cc & 3) == 0); TIFFSwabArrayOfLong((uint32*) buf, cc/4); } void _TIFFSwab64BitData(TIFF* tif, tidata_t buf, tsize_t cc) { (void) tif; assert((cc & 7) == 0); TIFFSwabArrayOfDouble((double*) buf, cc/8); } /* vim: set ts=8 sts=8 sw=8 noet: */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_dirinfo.c�����������������������������������������������0000644�0001750�0001750�00000101063�12320456500�021775� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_dirinfo.c,v 1.65.2.7 2009-09-17 18:00:28 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * Core Directory Tag Support. */ #include "tiffiop.h" #include <stdlib.h> #include <string.h> /* * NB: NB: THIS ARRAY IS ASSUMED TO BE SORTED BY TAG. * If a tag can have both LONG and SHORT types then the LONG must be * placed before the SHORT for writing to work properly. * * NOTE: The second field (field_readcount) and third field (field_writecount) * sometimes use the values TIFF_VARIABLE (-1), TIFF_VARIABLE2 (-3) * and TIFFTAG_SPP (-2). The macros should be used but would throw off * the formatting of the code, so please interprete the -1, -2 and -3 * values accordingly. */ static const TIFFFieldInfo tiffFieldInfo[] = { { TIFFTAG_SUBFILETYPE, 1, 1, TIFF_LONG, FIELD_SUBFILETYPE, 1, 0, "SubfileType" }, /* XXX SHORT for compatibility w/ old versions of the library */ { TIFFTAG_SUBFILETYPE, 1, 1, TIFF_SHORT, FIELD_SUBFILETYPE, 1, 0, "SubfileType" }, { TIFFTAG_OSUBFILETYPE, 1, 1, TIFF_SHORT, FIELD_SUBFILETYPE, 1, 0, "OldSubfileType" }, { TIFFTAG_IMAGEWIDTH, 1, 1, TIFF_LONG, FIELD_IMAGEDIMENSIONS, 0, 0, "ImageWidth" }, { TIFFTAG_IMAGEWIDTH, 1, 1, TIFF_SHORT, FIELD_IMAGEDIMENSIONS, 0, 0, "ImageWidth" }, { TIFFTAG_IMAGELENGTH, 1, 1, TIFF_LONG, FIELD_IMAGEDIMENSIONS, 1, 0, "ImageLength" }, { TIFFTAG_IMAGELENGTH, 1, 1, TIFF_SHORT, FIELD_IMAGEDIMENSIONS, 1, 0, "ImageLength" }, { TIFFTAG_BITSPERSAMPLE, -1,-1, TIFF_SHORT, FIELD_BITSPERSAMPLE, 0, 0, "BitsPerSample" }, /* XXX LONG for compatibility with some broken TIFF writers */ { TIFFTAG_BITSPERSAMPLE, -1,-1, TIFF_LONG, FIELD_BITSPERSAMPLE, 0, 0, "BitsPerSample" }, { TIFFTAG_COMPRESSION, -1, 1, TIFF_SHORT, FIELD_COMPRESSION, 0, 0, "Compression" }, /* XXX LONG for compatibility with some broken TIFF writers */ { TIFFTAG_COMPRESSION, -1, 1, TIFF_LONG, FIELD_COMPRESSION, 0, 0, "Compression" }, { TIFFTAG_PHOTOMETRIC, 1, 1, TIFF_SHORT, FIELD_PHOTOMETRIC, 0, 0, "PhotometricInterpretation" }, /* XXX LONG for compatibility with some broken TIFF writers */ { TIFFTAG_PHOTOMETRIC, 1, 1, TIFF_LONG, FIELD_PHOTOMETRIC, 0, 0, "PhotometricInterpretation" }, { TIFFTAG_THRESHHOLDING, 1, 1, TIFF_SHORT, FIELD_THRESHHOLDING, 1, 0, "Threshholding" }, { TIFFTAG_CELLWIDTH, 1, 1, TIFF_SHORT, FIELD_IGNORE, 1, 0, "CellWidth" }, { TIFFTAG_CELLLENGTH, 1, 1, TIFF_SHORT, FIELD_IGNORE, 1, 0, "CellLength" }, { TIFFTAG_FILLORDER, 1, 1, TIFF_SHORT, FIELD_FILLORDER, 0, 0, "FillOrder" }, { TIFFTAG_DOCUMENTNAME, -1,-1, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "DocumentName" }, { TIFFTAG_IMAGEDESCRIPTION, -1,-1, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "ImageDescription" }, { TIFFTAG_MAKE, -1,-1, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "Make" }, { TIFFTAG_MODEL, -1,-1, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "Model" }, { TIFFTAG_STRIPOFFSETS, -1,-1, TIFF_LONG, FIELD_STRIPOFFSETS, 0, 0, "StripOffsets" }, { TIFFTAG_STRIPOFFSETS, -1,-1, TIFF_SHORT, FIELD_STRIPOFFSETS, 0, 0, "StripOffsets" }, { TIFFTAG_ORIENTATION, 1, 1, TIFF_SHORT, FIELD_ORIENTATION, 0, 0, "Orientation" }, { TIFFTAG_SAMPLESPERPIXEL, 1, 1, TIFF_SHORT, FIELD_SAMPLESPERPIXEL, 0, 0, "SamplesPerPixel" }, { TIFFTAG_ROWSPERSTRIP, 1, 1, TIFF_LONG, FIELD_ROWSPERSTRIP, 0, 0, "RowsPerStrip" }, { TIFFTAG_ROWSPERSTRIP, 1, 1, TIFF_SHORT, FIELD_ROWSPERSTRIP, 0, 0, "RowsPerStrip" }, { TIFFTAG_STRIPBYTECOUNTS, -1,-1, TIFF_LONG, FIELD_STRIPBYTECOUNTS, 0, 0, "StripByteCounts" }, { TIFFTAG_STRIPBYTECOUNTS, -1,-1, TIFF_SHORT, FIELD_STRIPBYTECOUNTS, 0, 0, "StripByteCounts" }, { TIFFTAG_MINSAMPLEVALUE, -2,-1, TIFF_SHORT, FIELD_MINSAMPLEVALUE, 1, 0, "MinSampleValue" }, { TIFFTAG_MAXSAMPLEVALUE, -2,-1, TIFF_SHORT, FIELD_MAXSAMPLEVALUE, 1, 0, "MaxSampleValue" }, { TIFFTAG_XRESOLUTION, 1, 1, TIFF_RATIONAL, FIELD_RESOLUTION, 1, 0, "XResolution" }, { TIFFTAG_YRESOLUTION, 1, 1, TIFF_RATIONAL, FIELD_RESOLUTION, 1, 0, "YResolution" }, { TIFFTAG_PLANARCONFIG, 1, 1, TIFF_SHORT, FIELD_PLANARCONFIG, 0, 0, "PlanarConfiguration" }, { TIFFTAG_PAGENAME, -1,-1, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "PageName" }, { TIFFTAG_XPOSITION, 1, 1, TIFF_RATIONAL, FIELD_POSITION, 1, 0, "XPosition" }, { TIFFTAG_YPOSITION, 1, 1, TIFF_RATIONAL, FIELD_POSITION, 1, 0, "YPosition" }, { TIFFTAG_FREEOFFSETS, -1,-1, TIFF_LONG, FIELD_IGNORE, 0, 0, "FreeOffsets" }, { TIFFTAG_FREEBYTECOUNTS, -1,-1, TIFF_LONG, FIELD_IGNORE, 0, 0, "FreeByteCounts" }, { TIFFTAG_GRAYRESPONSEUNIT, 1, 1, TIFF_SHORT, FIELD_IGNORE, 1, 0, "GrayResponseUnit" }, { TIFFTAG_GRAYRESPONSECURVE,-1,-1, TIFF_SHORT, FIELD_IGNORE, 1, 0, "GrayResponseCurve" }, { TIFFTAG_RESOLUTIONUNIT, 1, 1, TIFF_SHORT, FIELD_RESOLUTIONUNIT, 1, 0, "ResolutionUnit" }, { TIFFTAG_PAGENUMBER, 2, 2, TIFF_SHORT, FIELD_PAGENUMBER, 1, 0, "PageNumber" }, { TIFFTAG_COLORRESPONSEUNIT, 1, 1, TIFF_SHORT, FIELD_IGNORE, 1, 0, "ColorResponseUnit" }, { TIFFTAG_TRANSFERFUNCTION, -1,-1, TIFF_SHORT, FIELD_TRANSFERFUNCTION, 1, 0, "TransferFunction" }, { TIFFTAG_SOFTWARE, -1,-1, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "Software" }, { TIFFTAG_DATETIME, 20,20, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "DateTime" }, { TIFFTAG_ARTIST, -1,-1, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "Artist" }, { TIFFTAG_HOSTCOMPUTER, -1,-1, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "HostComputer" }, { TIFFTAG_WHITEPOINT, 2, 2, TIFF_RATIONAL, FIELD_CUSTOM, 1, 0, "WhitePoint" }, { TIFFTAG_PRIMARYCHROMATICITIES,6,6,TIFF_RATIONAL, FIELD_CUSTOM, 1, 0, "PrimaryChromaticities" }, { TIFFTAG_COLORMAP, -1,-1, TIFF_SHORT, FIELD_COLORMAP, 1, 0, "ColorMap" }, { TIFFTAG_HALFTONEHINTS, 2, 2, TIFF_SHORT, FIELD_HALFTONEHINTS, 1, 0, "HalftoneHints" }, { TIFFTAG_TILEWIDTH, 1, 1, TIFF_LONG, FIELD_TILEDIMENSIONS, 0, 0, "TileWidth" }, { TIFFTAG_TILEWIDTH, 1, 1, TIFF_SHORT, FIELD_TILEDIMENSIONS, 0, 0, "TileWidth" }, { TIFFTAG_TILELENGTH, 1, 1, TIFF_LONG, FIELD_TILEDIMENSIONS, 0, 0, "TileLength" }, { TIFFTAG_TILELENGTH, 1, 1, TIFF_SHORT, FIELD_TILEDIMENSIONS, 0, 0, "TileLength" }, { TIFFTAG_TILEOFFSETS, -1, 1, TIFF_LONG, FIELD_STRIPOFFSETS, 0, 0, "TileOffsets" }, { TIFFTAG_TILEBYTECOUNTS, -1, 1, TIFF_LONG, FIELD_STRIPBYTECOUNTS, 0, 0, "TileByteCounts" }, { TIFFTAG_TILEBYTECOUNTS, -1, 1, TIFF_SHORT, FIELD_STRIPBYTECOUNTS, 0, 0, "TileByteCounts" }, { TIFFTAG_SUBIFD, -1,-1, TIFF_IFD, FIELD_SUBIFD, 1, 1, "SubIFD" }, { TIFFTAG_SUBIFD, -1,-1, TIFF_LONG, FIELD_SUBIFD, 1, 1, "SubIFD" }, { TIFFTAG_INKSET, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 0, 0, "InkSet" }, { TIFFTAG_INKNAMES, -1,-1, TIFF_ASCII, FIELD_INKNAMES, 1, 1, "InkNames" }, { TIFFTAG_NUMBEROFINKS, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 1, 0, "NumberOfInks" }, { TIFFTAG_DOTRANGE, 2, 2, TIFF_SHORT, FIELD_CUSTOM, 0, 0, "DotRange" }, { TIFFTAG_DOTRANGE, 2, 2, TIFF_BYTE, FIELD_CUSTOM, 0, 0, "DotRange" }, { TIFFTAG_TARGETPRINTER, -1,-1, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "TargetPrinter" }, { TIFFTAG_EXTRASAMPLES, -1,-1, TIFF_SHORT, FIELD_EXTRASAMPLES, 0, 1, "ExtraSamples" }, /* XXX for bogus Adobe Photoshop v2.5 files */ { TIFFTAG_EXTRASAMPLES, -1,-1, TIFF_BYTE, FIELD_EXTRASAMPLES, 0, 1, "ExtraSamples" }, { TIFFTAG_SAMPLEFORMAT, -1,-1, TIFF_SHORT, FIELD_SAMPLEFORMAT, 0, 0, "SampleFormat" }, { TIFFTAG_SMINSAMPLEVALUE, -2,-1, TIFF_ANY, FIELD_SMINSAMPLEVALUE, 1, 0, "SMinSampleValue" }, { TIFFTAG_SMAXSAMPLEVALUE, -2,-1, TIFF_ANY, FIELD_SMAXSAMPLEVALUE, 1, 0, "SMaxSampleValue" }, { TIFFTAG_CLIPPATH, -1, -3, TIFF_BYTE, FIELD_CUSTOM, 0, 1, "ClipPath" }, { TIFFTAG_XCLIPPATHUNITS, 1, 1, TIFF_SLONG, FIELD_CUSTOM, 0, 0, "XClipPathUnits" }, { TIFFTAG_XCLIPPATHUNITS, 1, 1, TIFF_SSHORT, FIELD_CUSTOM, 0, 0, "XClipPathUnits" }, { TIFFTAG_XCLIPPATHUNITS, 1, 1, TIFF_SBYTE, FIELD_CUSTOM, 0, 0, "XClipPathUnits" }, { TIFFTAG_YCLIPPATHUNITS, 1, 1, TIFF_SLONG, FIELD_CUSTOM, 0, 0, "YClipPathUnits" }, { TIFFTAG_YCLIPPATHUNITS, 1, 1, TIFF_SSHORT, FIELD_CUSTOM, 0, 0, "YClipPathUnits" }, { TIFFTAG_YCLIPPATHUNITS, 1, 1, TIFF_SBYTE, FIELD_CUSTOM, 0, 0, "YClipPathUnits" }, { TIFFTAG_YCBCRCOEFFICIENTS, 3, 3, TIFF_RATIONAL, FIELD_CUSTOM, 0, 0, "YCbCrCoefficients" }, { TIFFTAG_YCBCRSUBSAMPLING, 2, 2, TIFF_SHORT, FIELD_YCBCRSUBSAMPLING, 0, 0, "YCbCrSubsampling" }, { TIFFTAG_YCBCRPOSITIONING, 1, 1, TIFF_SHORT, FIELD_YCBCRPOSITIONING, 0, 0, "YCbCrPositioning" }, { TIFFTAG_REFERENCEBLACKWHITE, 6, 6, TIFF_RATIONAL, FIELD_CUSTOM, 1, 0, "ReferenceBlackWhite" }, /* XXX temporarily accept LONG for backwards compatibility */ { TIFFTAG_REFERENCEBLACKWHITE, 6, 6, TIFF_LONG, FIELD_CUSTOM, 1, 0, "ReferenceBlackWhite" }, { TIFFTAG_XMLPACKET, -3,-3, TIFF_BYTE, FIELD_CUSTOM, 0, 1, "XMLPacket" }, /* begin SGI tags */ { TIFFTAG_MATTEING, 1, 1, TIFF_SHORT, FIELD_EXTRASAMPLES, 0, 0, "Matteing" }, { TIFFTAG_DATATYPE, -2,-1, TIFF_SHORT, FIELD_SAMPLEFORMAT, 0, 0, "DataType" }, { TIFFTAG_IMAGEDEPTH, 1, 1, TIFF_LONG, FIELD_IMAGEDEPTH, 0, 0, "ImageDepth" }, { TIFFTAG_IMAGEDEPTH, 1, 1, TIFF_SHORT, FIELD_IMAGEDEPTH, 0, 0, "ImageDepth" }, { TIFFTAG_TILEDEPTH, 1, 1, TIFF_LONG, FIELD_TILEDEPTH, 0, 0, "TileDepth" }, { TIFFTAG_TILEDEPTH, 1, 1, TIFF_SHORT, FIELD_TILEDEPTH, 0, 0, "TileDepth" }, /* end SGI tags */ /* begin Pixar tags */ { TIFFTAG_PIXAR_IMAGEFULLWIDTH, 1, 1, TIFF_LONG, FIELD_CUSTOM, 1, 0, "ImageFullWidth" }, { TIFFTAG_PIXAR_IMAGEFULLLENGTH, 1, 1, TIFF_LONG, FIELD_CUSTOM, 1, 0, "ImageFullLength" }, { TIFFTAG_PIXAR_TEXTUREFORMAT, -1, -1, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "TextureFormat" }, { TIFFTAG_PIXAR_WRAPMODES, -1, -1, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "TextureWrapModes" }, { TIFFTAG_PIXAR_FOVCOT, 1, 1, TIFF_FLOAT, FIELD_CUSTOM, 1, 0, "FieldOfViewCotangent" }, { TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN, 16,16, TIFF_FLOAT, FIELD_CUSTOM, 1, 0, "MatrixWorldToScreen" }, { TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA, 16,16, TIFF_FLOAT, FIELD_CUSTOM, 1, 0, "MatrixWorldToCamera" }, { TIFFTAG_COPYRIGHT, -1, -1, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "Copyright" }, /* end Pixar tags */ { TIFFTAG_RICHTIFFIPTC, -3, -3, TIFF_LONG, FIELD_CUSTOM, 0, 1, "RichTIFFIPTC" }, { TIFFTAG_PHOTOSHOP, -3, -3, TIFF_BYTE, FIELD_CUSTOM, 0, 1, "Photoshop" }, { TIFFTAG_EXIFIFD, 1, 1, TIFF_LONG, FIELD_CUSTOM, 0, 0, "EXIFIFDOffset" }, { TIFFTAG_ICCPROFILE, -3, -3, TIFF_UNDEFINED, FIELD_CUSTOM, 0, 1, "ICC Profile" }, { TIFFTAG_GPSIFD, 1, 1, TIFF_LONG, FIELD_CUSTOM, 0, 0, "GPSIFDOffset" }, { TIFFTAG_STONITS, 1, 1, TIFF_DOUBLE, FIELD_CUSTOM, 0, 0, "StoNits" }, { TIFFTAG_INTEROPERABILITYIFD, 1, 1, TIFF_LONG, FIELD_CUSTOM, 0, 0, "InteroperabilityIFDOffset" }, /* begin DNG tags */ { TIFFTAG_DNGVERSION, 4, 4, TIFF_BYTE, FIELD_CUSTOM, 0, 0, "DNGVersion" }, { TIFFTAG_DNGBACKWARDVERSION, 4, 4, TIFF_BYTE, FIELD_CUSTOM, 0, 0, "DNGBackwardVersion" }, { TIFFTAG_UNIQUECAMERAMODEL, -1, -1, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "UniqueCameraModel" }, { TIFFTAG_LOCALIZEDCAMERAMODEL, -1, -1, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "LocalizedCameraModel" }, { TIFFTAG_LOCALIZEDCAMERAMODEL, -1, -1, TIFF_BYTE, FIELD_CUSTOM, 1, 1, "LocalizedCameraModel" }, { TIFFTAG_CFAPLANECOLOR, -1, -1, TIFF_BYTE, FIELD_CUSTOM, 0, 1, "CFAPlaneColor" }, { TIFFTAG_CFALAYOUT, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 0, 0, "CFALayout" }, { TIFFTAG_LINEARIZATIONTABLE, -1, -1, TIFF_SHORT, FIELD_CUSTOM, 0, 1, "LinearizationTable" }, { TIFFTAG_BLACKLEVELREPEATDIM, 2, 2, TIFF_SHORT, FIELD_CUSTOM, 0, 0, "BlackLevelRepeatDim" }, { TIFFTAG_BLACKLEVEL, -1, -1, TIFF_LONG, FIELD_CUSTOM, 0, 1, "BlackLevel" }, { TIFFTAG_BLACKLEVEL, -1, -1, TIFF_SHORT, FIELD_CUSTOM, 0, 1, "BlackLevel" }, { TIFFTAG_BLACKLEVEL, -1, -1, TIFF_RATIONAL, FIELD_CUSTOM, 0, 1, "BlackLevel" }, { TIFFTAG_BLACKLEVELDELTAH, -1, -1, TIFF_SRATIONAL, FIELD_CUSTOM, 0, 1, "BlackLevelDeltaH" }, { TIFFTAG_BLACKLEVELDELTAV, -1, -1, TIFF_SRATIONAL, FIELD_CUSTOM, 0, 1, "BlackLevelDeltaV" }, { TIFFTAG_WHITELEVEL, -2, -2, TIFF_LONG, FIELD_CUSTOM, 0, 0, "WhiteLevel" }, { TIFFTAG_WHITELEVEL, -2, -2, TIFF_SHORT, FIELD_CUSTOM, 0, 0, "WhiteLevel" }, { TIFFTAG_DEFAULTSCALE, 2, 2, TIFF_RATIONAL, FIELD_CUSTOM, 0, 0, "DefaultScale" }, { TIFFTAG_BESTQUALITYSCALE, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM, 0, 0, "BestQualityScale" }, { TIFFTAG_DEFAULTCROPORIGIN, 2, 2, TIFF_LONG, FIELD_CUSTOM, 0, 0, "DefaultCropOrigin" }, { TIFFTAG_DEFAULTCROPORIGIN, 2, 2, TIFF_SHORT, FIELD_CUSTOM, 0, 0, "DefaultCropOrigin" }, { TIFFTAG_DEFAULTCROPORIGIN, 2, 2, TIFF_RATIONAL, FIELD_CUSTOM, 0, 0, "DefaultCropOrigin" }, { TIFFTAG_DEFAULTCROPSIZE, 2, 2, TIFF_LONG, FIELD_CUSTOM, 0, 0, "DefaultCropSize" }, { TIFFTAG_DEFAULTCROPSIZE, 2, 2, TIFF_SHORT, FIELD_CUSTOM, 0, 0, "DefaultCropSize" }, { TIFFTAG_DEFAULTCROPSIZE, 2, 2, TIFF_RATIONAL, FIELD_CUSTOM, 0, 0, "DefaultCropSize" }, { TIFFTAG_COLORMATRIX1, -1, -1, TIFF_SRATIONAL, FIELD_CUSTOM, 0, 1, "ColorMatrix1" }, { TIFFTAG_COLORMATRIX2, -1, -1, TIFF_SRATIONAL, FIELD_CUSTOM, 0, 1, "ColorMatrix2" }, { TIFFTAG_CAMERACALIBRATION1, -1, -1, TIFF_SRATIONAL, FIELD_CUSTOM, 0, 1, "CameraCalibration1" }, { TIFFTAG_CAMERACALIBRATION2, -1, -1, TIFF_SRATIONAL, FIELD_CUSTOM, 0, 1, "CameraCalibration2" }, { TIFFTAG_REDUCTIONMATRIX1, -1, -1, TIFF_SRATIONAL, FIELD_CUSTOM, 0, 1, "ReductionMatrix1" }, { TIFFTAG_REDUCTIONMATRIX2, -1, -1, TIFF_SRATIONAL, FIELD_CUSTOM, 0, 1, "ReductionMatrix2" }, { TIFFTAG_ANALOGBALANCE, -1, -1, TIFF_RATIONAL, FIELD_CUSTOM, 0, 1, "AnalogBalance" }, { TIFFTAG_ASSHOTNEUTRAL, -1, -1, TIFF_SHORT, FIELD_CUSTOM, 0, 1, "AsShotNeutral" }, { TIFFTAG_ASSHOTNEUTRAL, -1, -1, TIFF_RATIONAL, FIELD_CUSTOM, 0, 1, "AsShotNeutral" }, { TIFFTAG_ASSHOTWHITEXY, 2, 2, TIFF_RATIONAL, FIELD_CUSTOM, 0, 0, "AsShotWhiteXY" }, { TIFFTAG_BASELINEEXPOSURE, 1, 1, TIFF_SRATIONAL, FIELD_CUSTOM, 0, 0, "BaselineExposure" }, { TIFFTAG_BASELINENOISE, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM, 0, 0, "BaselineNoise" }, { TIFFTAG_BASELINESHARPNESS, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM, 0, 0, "BaselineSharpness" }, { TIFFTAG_BAYERGREENSPLIT, 1, 1, TIFF_LONG, FIELD_CUSTOM, 0, 0, "BayerGreenSplit" }, { TIFFTAG_LINEARRESPONSELIMIT, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM, 0, 0, "LinearResponseLimit" }, { TIFFTAG_CAMERASERIALNUMBER, -1, -1, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "CameraSerialNumber" }, { TIFFTAG_LENSINFO, 4, 4, TIFF_RATIONAL, FIELD_CUSTOM, 0, 0, "LensInfo" }, { TIFFTAG_CHROMABLURRADIUS, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM, 0, 0, "ChromaBlurRadius" }, { TIFFTAG_ANTIALIASSTRENGTH, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM, 0, 0, "AntiAliasStrength" }, { TIFFTAG_SHADOWSCALE, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM, 0, 0, "ShadowScale" }, { TIFFTAG_DNGPRIVATEDATA, -1, -1, TIFF_BYTE, FIELD_CUSTOM, 0, 1, "DNGPrivateData" }, { TIFFTAG_MAKERNOTESAFETY, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 0, 0, "MakerNoteSafety" }, { TIFFTAG_CALIBRATIONILLUMINANT1, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 0, 0, "CalibrationIlluminant1" }, { TIFFTAG_CALIBRATIONILLUMINANT2, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 0, 0, "CalibrationIlluminant2" }, { TIFFTAG_RAWDATAUNIQUEID, 16, 16, TIFF_BYTE, FIELD_CUSTOM, 0, 0, "RawDataUniqueID" }, { TIFFTAG_ORIGINALRAWFILENAME, -1, -1, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "OriginalRawFileName" }, { TIFFTAG_ORIGINALRAWFILENAME, -1, -1, TIFF_BYTE, FIELD_CUSTOM, 1, 1, "OriginalRawFileName" }, { TIFFTAG_ORIGINALRAWFILEDATA, -1, -1, TIFF_UNDEFINED, FIELD_CUSTOM, 0, 1, "OriginalRawFileData" }, { TIFFTAG_ACTIVEAREA, 4, 4, TIFF_LONG, FIELD_CUSTOM, 0, 0, "ActiveArea" }, { TIFFTAG_ACTIVEAREA, 4, 4, TIFF_SHORT, FIELD_CUSTOM, 0, 0, "ActiveArea" }, { TIFFTAG_MASKEDAREAS, -1, -1, TIFF_LONG, FIELD_CUSTOM, 0, 1, "MaskedAreas" }, { TIFFTAG_ASSHOTICCPROFILE, -1, -1, TIFF_UNDEFINED, FIELD_CUSTOM, 0, 1, "AsShotICCProfile" }, { TIFFTAG_ASSHOTPREPROFILEMATRIX, -1, -1, TIFF_SRATIONAL, FIELD_CUSTOM, 0, 1, "AsShotPreProfileMatrix" }, { TIFFTAG_CURRENTICCPROFILE, -1, -1, TIFF_UNDEFINED, FIELD_CUSTOM, 0, 1, "CurrentICCProfile" }, { TIFFTAG_CURRENTPREPROFILEMATRIX, -1, -1, TIFF_SRATIONAL, FIELD_CUSTOM, 0, 1, "CurrentPreProfileMatrix" }, /* end DNG tags */ }; static const TIFFFieldInfo exifFieldInfo[] = { { EXIFTAG_EXPOSURETIME, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM, 1, 0, "ExposureTime" }, { EXIFTAG_FNUMBER, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM, 1, 0, "FNumber" }, { EXIFTAG_EXPOSUREPROGRAM, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 1, 0, "ExposureProgram" }, { EXIFTAG_SPECTRALSENSITIVITY, -1, -1, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "SpectralSensitivity" }, { EXIFTAG_ISOSPEEDRATINGS, -1, -1, TIFF_SHORT, FIELD_CUSTOM, 1, 1, "ISOSpeedRatings" }, { EXIFTAG_OECF, -1, -1, TIFF_UNDEFINED, FIELD_CUSTOM, 1, 1, "OptoelectricConversionFactor" }, { EXIFTAG_EXIFVERSION, 4, 4, TIFF_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExifVersion" }, { EXIFTAG_DATETIMEORIGINAL, 20, 20, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "DateTimeOriginal" }, { EXIFTAG_DATETIMEDIGITIZED, 20, 20, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "DateTimeDigitized" }, { EXIFTAG_COMPONENTSCONFIGURATION, 4, 4, TIFF_UNDEFINED, FIELD_CUSTOM, 1, 0, "ComponentsConfiguration" }, { EXIFTAG_COMPRESSEDBITSPERPIXEL, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM, 1, 0, "CompressedBitsPerPixel" }, { EXIFTAG_SHUTTERSPEEDVALUE, 1, 1, TIFF_SRATIONAL, FIELD_CUSTOM, 1, 0, "ShutterSpeedValue" }, { EXIFTAG_APERTUREVALUE, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM, 1, 0, "ApertureValue" }, { EXIFTAG_BRIGHTNESSVALUE, 1, 1, TIFF_SRATIONAL, FIELD_CUSTOM, 1, 0, "BrightnessValue" }, { EXIFTAG_EXPOSUREBIASVALUE, 1, 1, TIFF_SRATIONAL, FIELD_CUSTOM, 1, 0, "ExposureBiasValue" }, { EXIFTAG_MAXAPERTUREVALUE, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM, 1, 0, "MaxApertureValue" }, { EXIFTAG_SUBJECTDISTANCE, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM, 1, 0, "SubjectDistance" }, { EXIFTAG_METERINGMODE, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 1, 0, "MeteringMode" }, { EXIFTAG_LIGHTSOURCE, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 1, 0, "LightSource" }, { EXIFTAG_FLASH, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 1, 0, "Flash" }, { EXIFTAG_FOCALLENGTH, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM, 1, 0, "FocalLength" }, { EXIFTAG_SUBJECTAREA, -1, -1, TIFF_SHORT, FIELD_CUSTOM, 1, 1, "SubjectArea" }, { EXIFTAG_MAKERNOTE, -1, -1, TIFF_UNDEFINED, FIELD_CUSTOM, 1, 1, "MakerNote" }, { EXIFTAG_USERCOMMENT, -1, -1, TIFF_UNDEFINED, FIELD_CUSTOM, 1, 1, "UserComment" }, { EXIFTAG_SUBSECTIME, -1, -1, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "SubSecTime" }, { EXIFTAG_SUBSECTIMEORIGINAL, -1, -1, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "SubSecTimeOriginal" }, { EXIFTAG_SUBSECTIMEDIGITIZED,-1, -1, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "SubSecTimeDigitized" }, { EXIFTAG_FLASHPIXVERSION, 4, 4, TIFF_UNDEFINED, FIELD_CUSTOM, 1, 0, "FlashpixVersion" }, { EXIFTAG_COLORSPACE, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 1, 0, "ColorSpace" }, { EXIFTAG_PIXELXDIMENSION, 1, 1, TIFF_LONG, FIELD_CUSTOM, 1, 0, "PixelXDimension" }, { EXIFTAG_PIXELXDIMENSION, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 1, 0, "PixelXDimension" }, { EXIFTAG_PIXELYDIMENSION, 1, 1, TIFF_LONG, FIELD_CUSTOM, 1, 0, "PixelYDimension" }, { EXIFTAG_PIXELYDIMENSION, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 1, 0, "PixelYDimension" }, { EXIFTAG_RELATEDSOUNDFILE, 13, 13, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "RelatedSoundFile" }, { EXIFTAG_FLASHENERGY, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM, 1, 0, "FlashEnergy" }, { EXIFTAG_SPATIALFREQUENCYRESPONSE, -1, -1, TIFF_UNDEFINED, FIELD_CUSTOM, 1, 1, "SpatialFrequencyResponse" }, { EXIFTAG_FOCALPLANEXRESOLUTION, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM, 1, 0, "FocalPlaneXResolution" }, { EXIFTAG_FOCALPLANEYRESOLUTION, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM, 1, 0, "FocalPlaneYResolution" }, { EXIFTAG_FOCALPLANERESOLUTIONUNIT, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 1, 0, "FocalPlaneResolutionUnit" }, { EXIFTAG_SUBJECTLOCATION, 2, 2, TIFF_SHORT, FIELD_CUSTOM, 1, 0, "SubjectLocation" }, { EXIFTAG_EXPOSUREINDEX, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM, 1, 0, "ExposureIndex" }, { EXIFTAG_SENSINGMETHOD, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 1, 0, "SensingMethod" }, { EXIFTAG_FILESOURCE, 1, 1, TIFF_UNDEFINED, FIELD_CUSTOM, 1, 0, "FileSource" }, { EXIFTAG_SCENETYPE, 1, 1, TIFF_UNDEFINED, FIELD_CUSTOM, 1, 0, "SceneType" }, { EXIFTAG_CFAPATTERN, -1, -1, TIFF_UNDEFINED, FIELD_CUSTOM, 1, 1, "CFAPattern" }, { EXIFTAG_CUSTOMRENDERED, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 1, 0, "CustomRendered" }, { EXIFTAG_EXPOSUREMODE, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 1, 0, "ExposureMode" }, { EXIFTAG_WHITEBALANCE, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 1, 0, "WhiteBalance" }, { EXIFTAG_DIGITALZOOMRATIO, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM, 1, 0, "DigitalZoomRatio" }, { EXIFTAG_FOCALLENGTHIN35MMFILM, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 1, 0, "FocalLengthIn35mmFilm" }, { EXIFTAG_SCENECAPTURETYPE, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 1, 0, "SceneCaptureType" }, { EXIFTAG_GAINCONTROL, 1, 1, TIFF_RATIONAL, FIELD_CUSTOM, 1, 0, "GainControl" }, { EXIFTAG_CONTRAST, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 1, 0, "Contrast" }, { EXIFTAG_SATURATION, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 1, 0, "Saturation" }, { EXIFTAG_SHARPNESS, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 1, 0, "Sharpness" }, { EXIFTAG_DEVICESETTINGDESCRIPTION, -1, -1, TIFF_UNDEFINED, FIELD_CUSTOM, 1, 1, "DeviceSettingDescription" }, { EXIFTAG_SUBJECTDISTANCERANGE, 1, 1, TIFF_SHORT, FIELD_CUSTOM, 1, 0, "SubjectDistanceRange" }, { EXIFTAG_IMAGEUNIQUEID, 33, 33, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "ImageUniqueID" } }; const TIFFFieldInfo * _TIFFGetFieldInfo(size_t *size) { *size = TIFFArrayCount(tiffFieldInfo); return tiffFieldInfo; } const TIFFFieldInfo * _TIFFGetExifFieldInfo(size_t *size) { *size = TIFFArrayCount(exifFieldInfo); return exifFieldInfo; } void _TIFFSetupFieldInfo(TIFF* tif, const TIFFFieldInfo info[], size_t n) { if (tif->tif_fieldinfo) { size_t i; for (i = 0; i < tif->tif_nfields; i++) { TIFFFieldInfo *fld = tif->tif_fieldinfo[i]; if (fld->field_bit == FIELD_CUSTOM && strncmp("Tag ", fld->field_name, 4) == 0) { _TIFFfree(fld->field_name); _TIFFfree(fld); } } _TIFFfree(tif->tif_fieldinfo); tif->tif_nfields = 0; } if (!_TIFFMergeFieldInfo(tif, info, n)) { TIFFErrorExt(tif->tif_clientdata, "_TIFFSetupFieldInfo", "Setting up field info failed"); } } static int tagCompare(const void* a, const void* b) { const TIFFFieldInfo* ta = *(const TIFFFieldInfo**) a; const TIFFFieldInfo* tb = *(const TIFFFieldInfo**) b; /* NB: be careful of return values for 16-bit platforms */ if (ta->field_tag != tb->field_tag) return (int)ta->field_tag - (int)tb->field_tag; else return (ta->field_type == TIFF_ANY) ? 0 : ((int)tb->field_type - (int)ta->field_type); } static int tagNameCompare(const void* a, const void* b) { const TIFFFieldInfo* ta = *(const TIFFFieldInfo**) a; const TIFFFieldInfo* tb = *(const TIFFFieldInfo**) b; int ret = strcmp(ta->field_name, tb->field_name); if (ret) return ret; else return (ta->field_type == TIFF_ANY) ? 0 : ((int)tb->field_type - (int)ta->field_type); } void TIFFMergeFieldInfo(TIFF* tif, const TIFFFieldInfo info[], int n) { if (_TIFFMergeFieldInfo(tif, info, n) < 0) { TIFFErrorExt(tif->tif_clientdata, "TIFFMergeFieldInfo", "Merging block of %d fields failed", n); } } int _TIFFMergeFieldInfo(TIFF* tif, const TIFFFieldInfo info[], int n) { static const char module[] = "_TIFFMergeFieldInfo"; static const char reason[] = "for field info array"; TIFFFieldInfo** tp; int i; tif->tif_foundfield = NULL; if (tif->tif_nfields > 0) { tif->tif_fieldinfo = (TIFFFieldInfo**) _TIFFCheckRealloc(tif, tif->tif_fieldinfo, (tif->tif_nfields + n), sizeof (TIFFFieldInfo*), reason); } else { tif->tif_fieldinfo = (TIFFFieldInfo**) _TIFFCheckMalloc(tif, n, sizeof (TIFFFieldInfo*), reason); } if (!tif->tif_fieldinfo) { TIFFErrorExt(tif->tif_clientdata, module, "Failed to allocate field info array"); return 0; } tp = tif->tif_fieldinfo + tif->tif_nfields; for (i = 0; i < n; i++) { const TIFFFieldInfo *fip = _TIFFFindFieldInfo(tif, info[i].field_tag, info[i].field_type); /* only add definitions that aren't already present */ if (!fip) { *tp++ = (TIFFFieldInfo*) (info + i); tif->tif_nfields++; } } /* Sort the field info by tag number */ qsort(tif->tif_fieldinfo, tif->tif_nfields, sizeof (TIFFFieldInfo*), tagCompare); return n; } void _TIFFPrintFieldInfo(TIFF* tif, FILE* fd) { size_t i; fprintf(fd, "%s: \n", tif->tif_name); for (i = 0; i < tif->tif_nfields; i++) { const TIFFFieldInfo* fip = tif->tif_fieldinfo[i]; fprintf(fd, "field[%2d] %5lu, %2d, %2d, %d, %2d, %5s, %5s, %s\n" , (int)i , (unsigned long) fip->field_tag , fip->field_readcount, fip->field_writecount , fip->field_type , fip->field_bit , fip->field_oktochange ? "TRUE" : "FALSE" , fip->field_passcount ? "TRUE" : "FALSE" , fip->field_name ); } } /* * Return size of TIFFDataType in bytes */ int TIFFDataWidth(TIFFDataType type) { switch(type) { case 0: /* nothing */ case 1: /* TIFF_BYTE */ case 2: /* TIFF_ASCII */ case 6: /* TIFF_SBYTE */ case 7: /* TIFF_UNDEFINED */ return 1; case 3: /* TIFF_SHORT */ case 8: /* TIFF_SSHORT */ return 2; case 4: /* TIFF_LONG */ case 9: /* TIFF_SLONG */ case 11: /* TIFF_FLOAT */ case 13: /* TIFF_IFD */ return 4; case 5: /* TIFF_RATIONAL */ case 10: /* TIFF_SRATIONAL */ case 12: /* TIFF_DOUBLE */ return 8; default: return 0; /* will return 0 for unknown types */ } } /* * Return size of TIFFDataType in bytes. * * XXX: We need a separate function to determine the space needed * to store the value. For TIFF_RATIONAL values TIFFDataWidth() returns 8, * but we use 4-byte float to represent rationals. */ int _TIFFDataSize(TIFFDataType type) { switch (type) { case TIFF_BYTE: case TIFF_SBYTE: case TIFF_ASCII: case TIFF_UNDEFINED: return 1; case TIFF_SHORT: case TIFF_SSHORT: return 2; case TIFF_LONG: case TIFF_SLONG: case TIFF_FLOAT: case TIFF_IFD: case TIFF_RATIONAL: case TIFF_SRATIONAL: return 4; case TIFF_DOUBLE: return 8; default: return 0; } } /* * Return nearest TIFFDataType to the sample type of an image. */ TIFFDataType _TIFFSampleToTagType(TIFF* tif) { uint32 bps = TIFFhowmany8(tif->tif_dir.td_bitspersample); switch (tif->tif_dir.td_sampleformat) { case SAMPLEFORMAT_IEEEFP: return (bps == 4 ? TIFF_FLOAT : TIFF_DOUBLE); case SAMPLEFORMAT_INT: return (bps <= 1 ? TIFF_SBYTE : bps <= 2 ? TIFF_SSHORT : TIFF_SLONG); case SAMPLEFORMAT_UINT: return (bps <= 1 ? TIFF_BYTE : bps <= 2 ? TIFF_SHORT : TIFF_LONG); case SAMPLEFORMAT_VOID: return (TIFF_UNDEFINED); } /*NOTREACHED*/ return (TIFF_UNDEFINED); } const TIFFFieldInfo* _TIFFFindFieldInfo(TIFF* tif, ttag_t tag, TIFFDataType dt) { TIFFFieldInfo key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0}; TIFFFieldInfo* pkey = &key; const TIFFFieldInfo **ret; if (tif->tif_foundfield && tif->tif_foundfield->field_tag == tag && (dt == TIFF_ANY || dt == tif->tif_foundfield->field_type)) return tif->tif_foundfield; /* If we are invoked with no field information, then just return. */ if ( !tif->tif_fieldinfo ) { return NULL; } /* NB: use sorted search (e.g. binary search) */ key.field_tag = tag; key.field_type = dt; ret = (const TIFFFieldInfo **) bsearch(&pkey, tif->tif_fieldinfo, tif->tif_nfields, sizeof(TIFFFieldInfo *), tagCompare); return tif->tif_foundfield = (ret ? *ret : NULL); } const TIFFFieldInfo* _TIFFFindFieldInfoByName(TIFF* tif, const char *field_name, TIFFDataType dt) { TIFFFieldInfo key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0}; TIFFFieldInfo* pkey = &key; const TIFFFieldInfo **ret; if (tif->tif_foundfield && streq(tif->tif_foundfield->field_name, field_name) && (dt == TIFF_ANY || dt == tif->tif_foundfield->field_type)) return (tif->tif_foundfield); /* If we are invoked with no field information, then just return. */ if ( !tif->tif_fieldinfo ) { return NULL; } /* NB: use sorted search (e.g. binary search) */ key.field_name = (char *)field_name; key.field_type = dt; ret = (const TIFFFieldInfo **) lfind(&pkey, tif->tif_fieldinfo, &tif->tif_nfields, sizeof(TIFFFieldInfo *), tagNameCompare); return tif->tif_foundfield = (ret ? *ret : NULL); } const TIFFFieldInfo* _TIFFFieldWithTag(TIFF* tif, ttag_t tag) { const TIFFFieldInfo* fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY); if (!fip) { TIFFErrorExt(tif->tif_clientdata, "TIFFFieldWithTag", "Internal error, unknown tag 0x%x", (unsigned int) tag); assert(fip != NULL); /*NOTREACHED*/ } return (fip); } const TIFFFieldInfo* _TIFFFieldWithName(TIFF* tif, const char *field_name) { const TIFFFieldInfo* fip = _TIFFFindFieldInfoByName(tif, field_name, TIFF_ANY); if (!fip) { TIFFErrorExt(tif->tif_clientdata, "TIFFFieldWithName", "Internal error, unknown tag %s", field_name); assert(fip != NULL); /*NOTREACHED*/ } return (fip); } const TIFFFieldInfo* _TIFFFindOrRegisterFieldInfo( TIFF *tif, ttag_t tag, TIFFDataType dt ) { const TIFFFieldInfo *fld; fld = _TIFFFindFieldInfo( tif, tag, dt ); if( fld == NULL ) { fld = _TIFFCreateAnonFieldInfo( tif, tag, dt ); if (!_TIFFMergeFieldInfo(tif, fld, 1)) return NULL; } return fld; } TIFFFieldInfo* _TIFFCreateAnonFieldInfo(TIFF *tif, ttag_t tag, TIFFDataType field_type) { TIFFFieldInfo *fld; (void) tif; fld = (TIFFFieldInfo *) _TIFFmalloc(sizeof (TIFFFieldInfo)); if (fld == NULL) return NULL; _TIFFmemset( fld, 0, sizeof(TIFFFieldInfo) ); fld->field_tag = tag; fld->field_readcount = TIFF_VARIABLE2; fld->field_writecount = TIFF_VARIABLE2; fld->field_type = field_type; fld->field_bit = FIELD_CUSTOM; fld->field_oktochange = TRUE; fld->field_passcount = TRUE; fld->field_name = (char *) _TIFFmalloc(32); if (fld->field_name == NULL) { _TIFFfree(fld); return NULL; } /* * note that this name is a special sign to TIFFClose() and * _TIFFSetupFieldInfo() to free the field */ sprintf(fld->field_name, "Tag %d", (int) tag); return fld; } /* vim: set ts=8 sts=8 sw=8 noet: */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/uvcode.h����������������������������������������������������0000644�0001750�0001750�00000012655�12320456500�021003� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Version 1.0 generated April 7, 1997 by Greg Ward Larson, SGI */ #define UV_SQSIZ (float)0.003500 #define UV_NDIVS 16289 #define UV_VSTART (float)0.016940 #define UV_NVS 163 static struct { float ustart; short nus, ncum; } uv_row[UV_NVS] = { { (float)0.247663, 4, 0 }, { (float)0.243779, 6, 4 }, { (float)0.241684, 7, 10 }, { (float)0.237874, 9, 17 }, { (float)0.235906, 10, 26 }, { (float)0.232153, 12, 36 }, { (float)0.228352, 14, 48 }, { (float)0.226259, 15, 62 }, { (float)0.222371, 17, 77 }, { (float)0.220410, 18, 94 }, { (float)0.214710, 21, 112 }, { (float)0.212714, 22, 133 }, { (float)0.210721, 23, 155 }, { (float)0.204976, 26, 178 }, { (float)0.202986, 27, 204 }, { (float)0.199245, 29, 231 }, { (float)0.195525, 31, 260 }, { (float)0.193560, 32, 291 }, { (float)0.189878, 34, 323 }, { (float)0.186216, 36, 357 }, { (float)0.186216, 36, 393 }, { (float)0.182592, 38, 429 }, { (float)0.179003, 40, 467 }, { (float)0.175466, 42, 507 }, { (float)0.172001, 44, 549 }, { (float)0.172001, 44, 593 }, { (float)0.168612, 46, 637 }, { (float)0.168612, 46, 683 }, { (float)0.163575, 49, 729 }, { (float)0.158642, 52, 778 }, { (float)0.158642, 52, 830 }, { (float)0.158642, 52, 882 }, { (float)0.153815, 55, 934 }, { (float)0.153815, 55, 989 }, { (float)0.149097, 58, 1044 }, { (float)0.149097, 58, 1102 }, { (float)0.142746, 62, 1160 }, { (float)0.142746, 62, 1222 }, { (float)0.142746, 62, 1284 }, { (float)0.138270, 65, 1346 }, { (float)0.138270, 65, 1411 }, { (float)0.138270, 65, 1476 }, { (float)0.132166, 69, 1541 }, { (float)0.132166, 69, 1610 }, { (float)0.126204, 73, 1679 }, { (float)0.126204, 73, 1752 }, { (float)0.126204, 73, 1825 }, { (float)0.120381, 77, 1898 }, { (float)0.120381, 77, 1975 }, { (float)0.120381, 77, 2052 }, { (float)0.120381, 77, 2129 }, { (float)0.112962, 82, 2206 }, { (float)0.112962, 82, 2288 }, { (float)0.112962, 82, 2370 }, { (float)0.107450, 86, 2452 }, { (float)0.107450, 86, 2538 }, { (float)0.107450, 86, 2624 }, { (float)0.107450, 86, 2710 }, { (float)0.100343, 91, 2796 }, { (float)0.100343, 91, 2887 }, { (float)0.100343, 91, 2978 }, { (float)0.095126, 95, 3069 }, { (float)0.095126, 95, 3164 }, { (float)0.095126, 95, 3259 }, { (float)0.095126, 95, 3354 }, { (float)0.088276, 100, 3449 }, { (float)0.088276, 100, 3549 }, { (float)0.088276, 100, 3649 }, { (float)0.088276, 100, 3749 }, { (float)0.081523, 105, 3849 }, { (float)0.081523, 105, 3954 }, { (float)0.081523, 105, 4059 }, { (float)0.081523, 105, 4164 }, { (float)0.074861, 110, 4269 }, { (float)0.074861, 110, 4379 }, { (float)0.074861, 110, 4489 }, { (float)0.074861, 110, 4599 }, { (float)0.068290, 115, 4709 }, { (float)0.068290, 115, 4824 }, { (float)0.068290, 115, 4939 }, { (float)0.068290, 115, 5054 }, { (float)0.063573, 119, 5169 }, { (float)0.063573, 119, 5288 }, { (float)0.063573, 119, 5407 }, { (float)0.063573, 119, 5526 }, { (float)0.057219, 124, 5645 }, { (float)0.057219, 124, 5769 }, { (float)0.057219, 124, 5893 }, { (float)0.057219, 124, 6017 }, { (float)0.050985, 129, 6141 }, { (float)0.050985, 129, 6270 }, { (float)0.050985, 129, 6399 }, { (float)0.050985, 129, 6528 }, { (float)0.050985, 129, 6657 }, { (float)0.044859, 134, 6786 }, { (float)0.044859, 134, 6920 }, { (float)0.044859, 134, 7054 }, { (float)0.044859, 134, 7188 }, { (float)0.040571, 138, 7322 }, { (float)0.040571, 138, 7460 }, { (float)0.040571, 138, 7598 }, { (float)0.040571, 138, 7736 }, { (float)0.036339, 142, 7874 }, { (float)0.036339, 142, 8016 }, { (float)0.036339, 142, 8158 }, { (float)0.036339, 142, 8300 }, { (float)0.032139, 146, 8442 }, { (float)0.032139, 146, 8588 }, { (float)0.032139, 146, 8734 }, { (float)0.032139, 146, 8880 }, { (float)0.027947, 150, 9026 }, { (float)0.027947, 150, 9176 }, { (float)0.027947, 150, 9326 }, { (float)0.023739, 154, 9476 }, { (float)0.023739, 154, 9630 }, { (float)0.023739, 154, 9784 }, { (float)0.023739, 154, 9938 }, { (float)0.019504, 158, 10092 }, { (float)0.019504, 158, 10250 }, { (float)0.019504, 158, 10408 }, { (float)0.016976, 161, 10566 }, { (float)0.016976, 161, 10727 }, { (float)0.016976, 161, 10888 }, { (float)0.016976, 161, 11049 }, { (float)0.012639, 165, 11210 }, { (float)0.012639, 165, 11375 }, { (float)0.012639, 165, 11540 }, { (float)0.009991, 168, 11705 }, { (float)0.009991, 168, 11873 }, { (float)0.009991, 168, 12041 }, { (float)0.009016, 170, 12209 }, { (float)0.009016, 170, 12379 }, { (float)0.009016, 170, 12549 }, { (float)0.006217, 173, 12719 }, { (float)0.006217, 173, 12892 }, { (float)0.005097, 175, 13065 }, { (float)0.005097, 175, 13240 }, { (float)0.005097, 175, 13415 }, { (float)0.003909, 177, 13590 }, { (float)0.003909, 177, 13767 }, { (float)0.002340, 177, 13944 }, { (float)0.002389, 170, 14121 }, { (float)0.001068, 164, 14291 }, { (float)0.001653, 157, 14455 }, { (float)0.000717, 150, 14612 }, { (float)0.001614, 143, 14762 }, { (float)0.000270, 136, 14905 }, { (float)0.000484, 129, 15041 }, { (float)0.001103, 123, 15170 }, { (float)0.001242, 115, 15293 }, { (float)0.001188, 109, 15408 }, { (float)0.001011, 103, 15517 }, { (float)0.000709, 97, 15620 }, { (float)0.000301, 89, 15717 }, { (float)0.002416, 82, 15806 }, { (float)0.003251, 76, 15888 }, { (float)0.003246, 69, 15964 }, { (float)0.004141, 62, 16033 }, { (float)0.005963, 55, 16095 }, { (float)0.008839, 47, 16150 }, { (float)0.010490, 40, 16197 }, { (float)0.016994, 31, 16237 }, { (float)0.023659, 21, 16268 }, }; �����������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_color.c�������������������������������������������������0000644�0001750�0001750�00000021023�12320456500�021456� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_color.c,v 1.12 2006/02/09 15:42:20 dron Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * CIE L*a*b* to CIE XYZ and CIE XYZ to RGB conversion routines are taken * from the VIPS library (http://www.vips.ecs.soton.ac.uk) with * the permission of John Cupitt, the VIPS author. */ /* * TIFF Library. * * Color space conversion routines. */ #include "tiffiop.h" #include <math.h> /* * Convert color value from the CIE L*a*b* 1976 space to CIE XYZ. */ void TIFFCIELabToXYZ(TIFFCIELabToRGB *cielab, uint32 l, int32 a, int32 b, float *X, float *Y, float *Z) { float L = (float)l * 100.0F / 255.0F; float cby, tmp; if( L < 8.856F ) { *Y = (L * cielab->Y0) / 903.292F; cby = 7.787F * (*Y / cielab->Y0) + 16.0F / 116.0F; } else { cby = (L + 16.0F) / 116.0F; *Y = cielab->Y0 * cby * cby * cby; } tmp = (float)a / 500.0F + cby; if( tmp < 0.2069F ) *X = cielab->X0 * (tmp - 0.13793F) / 7.787F; else *X = cielab->X0 * tmp * tmp * tmp; tmp = cby - (float)b / 200.0F; if( tmp < 0.2069F ) *Z = cielab->Z0 * (tmp - 0.13793F) / 7.787F; else *Z = cielab->Z0 * tmp * tmp * tmp; } #define RINT(R) ((uint32)((R)>0?((R)+0.5):((R)-0.5))) /* * Convert color value from the XYZ space to RGB. */ void TIFFXYZToRGB(TIFFCIELabToRGB *cielab, float X, float Y, float Z, uint32 *r, uint32 *g, uint32 *b) { int i; float Yr, Yg, Yb; float *matrix = &cielab->display.d_mat[0][0]; /* Multiply through the matrix to get luminosity values. */ Yr = matrix[0] * X + matrix[1] * Y + matrix[2] * Z; Yg = matrix[3] * X + matrix[4] * Y + matrix[5] * Z; Yb = matrix[6] * X + matrix[7] * Y + matrix[8] * Z; /* Clip input */ Yr = TIFFmax(Yr, cielab->display.d_Y0R); Yg = TIFFmax(Yg, cielab->display.d_Y0G); Yb = TIFFmax(Yb, cielab->display.d_Y0B); /* Avoid overflow in case of wrong input values */ Yr = TIFFmin(Yr, cielab->display.d_YCR); Yg = TIFFmin(Yg, cielab->display.d_YCG); Yb = TIFFmin(Yb, cielab->display.d_YCB); /* Turn luminosity to colour value. */ i = (int)((Yr - cielab->display.d_Y0R) / cielab->rstep); i = TIFFmin(cielab->range, i); *r = RINT(cielab->Yr2r[i]); i = (int)((Yg - cielab->display.d_Y0G) / cielab->gstep); i = TIFFmin(cielab->range, i); *g = RINT(cielab->Yg2g[i]); i = (int)((Yb - cielab->display.d_Y0B) / cielab->bstep); i = TIFFmin(cielab->range, i); *b = RINT(cielab->Yb2b[i]); /* Clip output. */ *r = TIFFmin(*r, cielab->display.d_Vrwr); *g = TIFFmin(*g, cielab->display.d_Vrwg); *b = TIFFmin(*b, cielab->display.d_Vrwb); } #undef RINT /* * Allocate conversion state structures and make look_up tables for * the Yr,Yb,Yg <=> r,g,b conversions. */ int TIFFCIELabToRGBInit(TIFFCIELabToRGB* cielab, TIFFDisplay *display, float *refWhite) { int i; double gamma; cielab->range = CIELABTORGB_TABLE_RANGE; _TIFFmemcpy(&cielab->display, display, sizeof(TIFFDisplay)); /* Red */ gamma = 1.0 / cielab->display.d_gammaR ; cielab->rstep = (cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range; for(i = 0; i <= cielab->range; i++) { cielab->Yr2r[i] = cielab->display.d_Vrwr * ((float)pow((double)i / cielab->range, gamma)); } /* Green */ gamma = 1.0 / cielab->display.d_gammaG ; cielab->gstep = (cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range; for(i = 0; i <= cielab->range; i++) { cielab->Yg2g[i] = cielab->display.d_Vrwg * ((float)pow((double)i / cielab->range, gamma)); } /* Blue */ gamma = 1.0 / cielab->display.d_gammaB ; cielab->bstep = (cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range; for(i = 0; i <= cielab->range; i++) { cielab->Yb2b[i] = cielab->display.d_Vrwb * ((float)pow((double)i / cielab->range, gamma)); } /* Init reference white point */ cielab->X0 = refWhite[0]; cielab->Y0 = refWhite[1]; cielab->Z0 = refWhite[2]; return 0; } /* * Convert color value from the YCbCr space to CIE XYZ. * The colorspace conversion algorithm comes from the IJG v5a code; * see below for more information on how it works. */ #define SHIFT 16 #define FIX(x) ((int32)((x) * (1L<<SHIFT) + 0.5)) #define ONE_HALF ((int32)(1<<(SHIFT-1))) #define Code2V(c, RB, RW, CR) ((((c)-(int32)(RB))*(float)(CR))/(float)(((RW)-(RB)) ? ((RW)-(RB)) : 1)) #define CLAMP(f,min,max) ((f)<(min)?(min):(f)>(max)?(max):(f)) #define HICLAMP(f,max) ((f)>(max)?(max):(f)) void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *ycbcr, uint32 Y, int32 Cb, int32 Cr, uint32 *r, uint32 *g, uint32 *b) { /* XXX: Only 8-bit YCbCr input supported for now */ Y = HICLAMP(Y, 255), Cb = CLAMP(Cb, 0, 255), Cr = CLAMP(Cr, 0, 255); *r = ycbcr->clamptab[ycbcr->Y_tab[Y] + ycbcr->Cr_r_tab[Cr]]; *g = ycbcr->clamptab[ycbcr->Y_tab[Y] + (int)((ycbcr->Cb_g_tab[Cb] + ycbcr->Cr_g_tab[Cr]) >> SHIFT)]; *b = ycbcr->clamptab[ycbcr->Y_tab[Y] + ycbcr->Cb_b_tab[Cb]]; } /* * Initialize the YCbCr->RGB conversion tables. The conversion * is done according to the 6.0 spec: * * R = Y + Cr*(2 - 2*LumaRed) * B = Y + Cb*(2 - 2*LumaBlue) * G = Y * - LumaBlue*Cb*(2-2*LumaBlue)/LumaGreen * - LumaRed*Cr*(2-2*LumaRed)/LumaGreen * * To avoid floating point arithmetic the fractional constants that * come out of the equations are represented as fixed point values * in the range 0...2^16. We also eliminate multiplications by * pre-calculating possible values indexed by Cb and Cr (this code * assumes conversion is being done for 8-bit samples). */ int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB* ycbcr, float *luma, float *refBlackWhite) { TIFFRGBValue* clamptab; int i; #define LumaRed luma[0] #define LumaGreen luma[1] #define LumaBlue luma[2] clamptab = (TIFFRGBValue*)( (tidata_t) ycbcr+TIFFroundup(sizeof (TIFFYCbCrToRGB), sizeof (long))); _TIFFmemset(clamptab, 0, 256); /* v < 0 => 0 */ ycbcr->clamptab = (clamptab += 256); for (i = 0; i < 256; i++) clamptab[i] = (TIFFRGBValue) i; _TIFFmemset(clamptab+256, 255, 2*256); /* v > 255 => 255 */ ycbcr->Cr_r_tab = (int*) (clamptab + 3*256); ycbcr->Cb_b_tab = ycbcr->Cr_r_tab + 256; ycbcr->Cr_g_tab = (int32*) (ycbcr->Cb_b_tab + 256); ycbcr->Cb_g_tab = ycbcr->Cr_g_tab + 256; ycbcr->Y_tab = ycbcr->Cb_g_tab + 256; { float f1 = 2-2*LumaRed; int32 D1 = FIX(f1); float f2 = LumaRed*f1/LumaGreen; int32 D2 = -FIX(f2); float f3 = 2-2*LumaBlue; int32 D3 = FIX(f3); float f4 = LumaBlue*f3/LumaGreen; int32 D4 = -FIX(f4); int x; #undef LumaBlue #undef LumaGreen #undef LumaRed /* * i is the actual input pixel value in the range 0..255 * Cb and Cr values are in the range -128..127 (actually * they are in a range defined by the ReferenceBlackWhite * tag) so there is some range shifting to do here when * constructing tables indexed by the raw pixel data. */ for (i = 0, x = -128; i < 256; i++, x++) { int32 Cr = (int32)Code2V(x, refBlackWhite[4] - 128.0F, refBlackWhite[5] - 128.0F, 127); int32 Cb = (int32)Code2V(x, refBlackWhite[2] - 128.0F, refBlackWhite[3] - 128.0F, 127); ycbcr->Cr_r_tab[i] = (int32)((D1*Cr + ONE_HALF)>>SHIFT); ycbcr->Cb_b_tab[i] = (int32)((D3*Cb + ONE_HALF)>>SHIFT); ycbcr->Cr_g_tab[i] = D2*Cr; ycbcr->Cb_g_tab[i] = D4*Cb + ONE_HALF; ycbcr->Y_tab[i] = (int32)Code2V(x + 128, refBlackWhite[0], refBlackWhite[1], 255); } } return 0; } #undef HICLAMP #undef CLAMP #undef Code2V #undef SHIFT #undef ONE_HALF #undef FIX /* vim: set ts=8 sts=8 sw=8 noet: */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_open.c��������������������������������������������������0000644�0001750�0001750�00000040641�12320456500�021310� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_open.c,v 1.33 2006/06/08 14:27:17 dron Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. */ #include "tiffiop.h" static const long typemask[13] = { (long)0L, /* TIFF_NOTYPE */ (long)0x000000ffL, /* TIFF_BYTE */ (long)0xffffffffL, /* TIFF_ASCII */ (long)0x0000ffffL, /* TIFF_SHORT */ (long)0xffffffffL, /* TIFF_LONG */ (long)0xffffffffL, /* TIFF_RATIONAL */ (long)0x000000ffL, /* TIFF_SBYTE */ (long)0x000000ffL, /* TIFF_UNDEFINED */ (long)0x0000ffffL, /* TIFF_SSHORT */ (long)0xffffffffL, /* TIFF_SLONG */ (long)0xffffffffL, /* TIFF_SRATIONAL */ (long)0xffffffffL, /* TIFF_FLOAT */ (long)0xffffffffL, /* TIFF_DOUBLE */ }; static const int bigTypeshift[13] = { 0, /* TIFF_NOTYPE */ 24, /* TIFF_BYTE */ 0, /* TIFF_ASCII */ 16, /* TIFF_SHORT */ 0, /* TIFF_LONG */ 0, /* TIFF_RATIONAL */ 24, /* TIFF_SBYTE */ 24, /* TIFF_UNDEFINED */ 16, /* TIFF_SSHORT */ 0, /* TIFF_SLONG */ 0, /* TIFF_SRATIONAL */ 0, /* TIFF_FLOAT */ 0, /* TIFF_DOUBLE */ }; static const int litTypeshift[13] = { 0, /* TIFF_NOTYPE */ 0, /* TIFF_BYTE */ 0, /* TIFF_ASCII */ 0, /* TIFF_SHORT */ 0, /* TIFF_LONG */ 0, /* TIFF_RATIONAL */ 0, /* TIFF_SBYTE */ 0, /* TIFF_UNDEFINED */ 0, /* TIFF_SSHORT */ 0, /* TIFF_SLONG */ 0, /* TIFF_SRATIONAL */ 0, /* TIFF_FLOAT */ 0, /* TIFF_DOUBLE */ }; /* * Dummy functions to fill the omitted client procedures. */ static int _tiffDummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize) { (void) fd; (void) pbase; (void) psize; return (0); } static void _tiffDummyUnmapProc(thandle_t fd, tdata_t base, toff_t size) { (void) fd; (void) base; (void) size; } /* * Initialize the shift & mask tables, and the * byte swapping state according to the file * contents and the machine architecture. */ static void TIFFInitOrder(TIFF* tif, int magic) { tif->tif_typemask = typemask; if (magic == TIFF_BIGENDIAN) { tif->tif_typeshift = bigTypeshift; #ifndef WORDS_BIGENDIAN tif->tif_flags |= TIFF_SWAB; #endif } else { tif->tif_typeshift = litTypeshift; #ifdef WORDS_BIGENDIAN tif->tif_flags |= TIFF_SWAB; #endif } } int _TIFFgetMode(const char* mode, const char* module) { int m = -1; switch (mode[0]) { case 'r': m = O_RDONLY; if (mode[1] == '+') m = O_RDWR; break; case 'w': case 'a': m = O_RDWR|O_CREAT; if (mode[0] == 'w') m |= O_TRUNC; break; default: TIFFErrorExt(0, module, "\"%s\": Bad mode", mode); break; } return (m); } TIFF* TIFFClientOpen( const char* name, const char* mode, thandle_t clientdata, TIFFReadWriteProc readproc, TIFFReadWriteProc writeproc, TIFFSeekProc seekproc, TIFFCloseProc closeproc, TIFFSizeProc sizeproc, TIFFMapFileProc mapproc, TIFFUnmapFileProc unmapproc ) { static const char module[] = "TIFFClientOpen"; TIFF *tif; int m; const char* cp; m = _TIFFgetMode(mode, module); if (m == -1) goto bad2; tif = (TIFF *)_TIFFmalloc(sizeof (TIFF) + strlen(name) + 1); if (tif == NULL) { TIFFErrorExt(clientdata, module, "%s: Out of memory (TIFF structure)", name); goto bad2; } _TIFFmemset(tif, 0, sizeof (*tif)); tif->tif_name = (char *)tif + sizeof (TIFF); strcpy(tif->tif_name, name); tif->tif_mode = m &~ (O_CREAT|O_TRUNC); tif->tif_curdir = (tdir_t) -1; /* non-existent directory */ tif->tif_curoff = 0; tif->tif_curstrip = (tstrip_t) -1; /* invalid strip */ tif->tif_row = (uint32) -1; /* read/write pre-increment */ tif->tif_clientdata = clientdata; if (!readproc || !writeproc || !seekproc || !closeproc || !sizeproc) { TIFFErrorExt(clientdata, module, "One of the client procedures is NULL pointer."); goto bad2; } tif->tif_readproc = readproc; tif->tif_writeproc = writeproc; tif->tif_seekproc = seekproc; tif->tif_closeproc = closeproc; tif->tif_sizeproc = sizeproc; if (mapproc) tif->tif_mapproc = mapproc; else tif->tif_mapproc = _tiffDummyMapProc; if (unmapproc) tif->tif_unmapproc = unmapproc; else tif->tif_unmapproc = _tiffDummyUnmapProc; _TIFFSetDefaultCompressionState(tif); /* setup default state */ /* * Default is to return data MSB2LSB and enable the * use of memory-mapped files and strip chopping when * a file is opened read-only. */ tif->tif_flags = FILLORDER_MSB2LSB; if (m == O_RDONLY ) tif->tif_flags |= TIFF_MAPPED; #ifdef STRIPCHOP_DEFAULT if (m == O_RDONLY || m == O_RDWR) tif->tif_flags |= STRIPCHOP_DEFAULT; #endif /* * Process library-specific flags in the open mode string. * The following flags may be used to control intrinsic library * behaviour that may or may not be desirable (usually for * compatibility with some application that claims to support * TIFF but only supports some braindead idea of what the * vendor thinks TIFF is): * * 'l' use little-endian byte order for creating a file * 'b' use big-endian byte order for creating a file * 'L' read/write information using LSB2MSB bit order * 'B' read/write information using MSB2LSB bit order * 'H' read/write information using host bit order * 'M' enable use of memory-mapped files when supported * 'm' disable use of memory-mapped files * 'C' enable strip chopping support when reading * 'c' disable strip chopping support * 'h' read TIFF header only, do not load the first IFD * * The use of the 'l' and 'b' flags is strongly discouraged. * These flags are provided solely because numerous vendors, * typically on the PC, do not correctly support TIFF; they * only support the Intel little-endian byte order. This * support is not configured by default because it supports * the violation of the TIFF spec that says that readers *MUST* * support both byte orders. It is strongly recommended that * you not use this feature except to deal with busted apps * that write invalid TIFF. And even in those cases you should * bang on the vendors to fix their software. * * The 'L', 'B', and 'H' flags are intended for applications * that can optimize operations on data by using a particular * bit order. By default the library returns data in MSB2LSB * bit order for compatibiltiy with older versions of this * library. Returning data in the bit order of the native cpu * makes the most sense but also requires applications to check * the value of the FillOrder tag; something they probably do * not do right now. * * The 'M' and 'm' flags are provided because some virtual memory * systems exhibit poor behaviour when large images are mapped. * These options permit clients to control the use of memory-mapped * files on a per-file basis. * * The 'C' and 'c' flags are provided because the library support * for chopping up large strips into multiple smaller strips is not * application-transparent and as such can cause problems. The 'c' * option permits applications that only want to look at the tags, * for example, to get the unadulterated TIFF tag information. */ for (cp = mode; *cp; cp++) switch (*cp) { case 'b': #ifndef WORDS_BIGENDIAN if (m&O_CREAT) tif->tif_flags |= TIFF_SWAB; #endif break; case 'l': #ifdef WORDS_BIGENDIAN if ((m&O_CREAT)) tif->tif_flags |= TIFF_SWAB; #endif break; case 'B': tif->tif_flags = (tif->tif_flags &~ TIFF_FILLORDER) | FILLORDER_MSB2LSB; break; case 'L': tif->tif_flags = (tif->tif_flags &~ TIFF_FILLORDER) | FILLORDER_LSB2MSB; break; case 'H': tif->tif_flags = (tif->tif_flags &~ TIFF_FILLORDER) | HOST_FILLORDER; break; case 'M': if (m == O_RDONLY) tif->tif_flags |= TIFF_MAPPED; break; case 'm': if (m == O_RDONLY) tif->tif_flags &= ~TIFF_MAPPED; break; case 'C': if (m == O_RDONLY) tif->tif_flags |= TIFF_STRIPCHOP; break; case 'c': if (m == O_RDONLY) tif->tif_flags &= ~TIFF_STRIPCHOP; break; case 'h': tif->tif_flags |= TIFF_HEADERONLY; break; } /* * Read in TIFF header. */ if (tif->tif_mode & O_TRUNC || !ReadOK(tif, &tif->tif_header, sizeof (TIFFHeader))) { if (tif->tif_mode == O_RDONLY) { TIFFErrorExt(tif->tif_clientdata, name, "Cannot read TIFF header"); goto bad; } /* * Setup header and write. */ #ifdef WORDS_BIGENDIAN tif->tif_header.tiff_magic = tif->tif_flags & TIFF_SWAB ? TIFF_LITTLEENDIAN : TIFF_BIGENDIAN; #else tif->tif_header.tiff_magic = tif->tif_flags & TIFF_SWAB ? TIFF_BIGENDIAN : TIFF_LITTLEENDIAN; #endif tif->tif_header.tiff_version = TIFF_VERSION; if (tif->tif_flags & TIFF_SWAB) TIFFSwabShort(&tif->tif_header.tiff_version); tif->tif_header.tiff_diroff = 0; /* filled in later */ /* * The doc for "fopen" for some STD_C_LIBs says that if you * open a file for modify ("+"), then you must fseek (or * fflush?) between any freads and fwrites. This is not * necessary on most systems, but has been shown to be needed * on Solaris. */ TIFFSeekFile( tif, 0, SEEK_SET ); if (!WriteOK(tif, &tif->tif_header, sizeof (TIFFHeader))) { TIFFErrorExt(tif->tif_clientdata, name, "Error writing TIFF header"); goto bad; } /* * Setup the byte order handling. */ TIFFInitOrder(tif, tif->tif_header.tiff_magic); /* * Setup default directory. */ if (!TIFFDefaultDirectory(tif)) goto bad; tif->tif_diroff = 0; tif->tif_dirlist = NULL; tif->tif_dirlistsize = 0; tif->tif_dirnumber = 0; return (tif); } /* * Setup the byte order handling. */ if (tif->tif_header.tiff_magic != TIFF_BIGENDIAN && tif->tif_header.tiff_magic != TIFF_LITTLEENDIAN #if MDI_SUPPORT && #if HOST_BIGENDIAN tif->tif_header.tiff_magic != MDI_BIGENDIAN #else tif->tif_header.tiff_magic != MDI_LITTLEENDIAN #endif ) { TIFFErrorExt(tif->tif_clientdata, name, "Not a TIFF or MDI file, bad magic number %d (0x%x)", #else ) { TIFFErrorExt(tif->tif_clientdata, name, "Not a TIFF file, bad magic number %d (0x%x)", #endif tif->tif_header.tiff_magic, tif->tif_header.tiff_magic); goto bad; } TIFFInitOrder(tif, tif->tif_header.tiff_magic); /* * Swap header if required. */ if (tif->tif_flags & TIFF_SWAB) { TIFFSwabShort(&tif->tif_header.tiff_version); TIFFSwabLong(&tif->tif_header.tiff_diroff); } /* * Now check version (if needed, it's been byte-swapped). * Note that this isn't actually a version number, it's a * magic number that doesn't change (stupid). */ if (tif->tif_header.tiff_version == TIFF_BIGTIFF_VERSION) { TIFFErrorExt(tif->tif_clientdata, name, "This is a BigTIFF file. This format not supported\n" "by this version of libtiff." ); goto bad; } if (tif->tif_header.tiff_version != TIFF_VERSION) { TIFFErrorExt(tif->tif_clientdata, name, "Not a TIFF file, bad version number %d (0x%x)", tif->tif_header.tiff_version, tif->tif_header.tiff_version); goto bad; } tif->tif_flags |= TIFF_MYBUFFER; tif->tif_rawcp = tif->tif_rawdata = 0; tif->tif_rawdatasize = 0; /* * Sometimes we do not want to read the first directory (for example, * it may be broken) and want to proceed to other directories. I this * case we use the TIFF_HEADERONLY flag to open file and return * immediately after reading TIFF header. */ if (tif->tif_flags & TIFF_HEADERONLY) return (tif); /* * Setup initial directory. */ switch (mode[0]) { case 'r': tif->tif_nextdiroff = tif->tif_header.tiff_diroff; /* * Try to use a memory-mapped file if the client * has not explicitly suppressed usage with the * 'm' flag in the open mode (see above). */ if ((tif->tif_flags & TIFF_MAPPED) && !TIFFMapFileContents(tif, (tdata_t*) &tif->tif_base, &tif->tif_size)) tif->tif_flags &= ~TIFF_MAPPED; if (TIFFReadDirectory(tif)) { tif->tif_rawcc = -1; tif->tif_flags |= TIFF_BUFFERSETUP; return (tif); } break; case 'a': /* * New directories are automatically append * to the end of the directory chain when they * are written out (see TIFFWriteDirectory). */ if (!TIFFDefaultDirectory(tif)) goto bad; return (tif); } bad: tif->tif_mode = O_RDONLY; /* XXX avoid flush */ TIFFCleanup(tif); bad2: return ((TIFF*)0); } /* * Query functions to access private data. */ /* * Return open file's name. */ const char * TIFFFileName(TIFF* tif) { return (tif->tif_name); } /* * Set the file name. */ const char * TIFFSetFileName(TIFF* tif, const char *name) { const char* old_name = tif->tif_name; tif->tif_name = (char *)name; return (old_name); } /* * Return open file's I/O descriptor. */ int TIFFFileno(TIFF* tif) { return (tif->tif_fd); } /* * Set open file's I/O descriptor, and return previous value. */ int TIFFSetFileno(TIFF* tif, int fd) { int old_fd = tif->tif_fd; tif->tif_fd = fd; return old_fd; } /* * Return open file's clientdata. */ thandle_t TIFFClientdata(TIFF* tif) { return (tif->tif_clientdata); } /* * Set open file's clientdata, and return previous value. */ thandle_t TIFFSetClientdata(TIFF* tif, thandle_t newvalue) { thandle_t m = tif->tif_clientdata; tif->tif_clientdata = newvalue; return m; } /* * Return read/write mode. */ int TIFFGetMode(TIFF* tif) { return (tif->tif_mode); } /* * Return read/write mode. */ int TIFFSetMode(TIFF* tif, int mode) { int old_mode = tif->tif_mode; tif->tif_mode = mode; return (old_mode); } /* * Return nonzero if file is organized in * tiles; zero if organized as strips. */ int TIFFIsTiled(TIFF* tif) { return (isTiled(tif)); } /* * Return current row being read/written. */ uint32 TIFFCurrentRow(TIFF* tif) { return (tif->tif_row); } /* * Return index of the current directory. */ tdir_t TIFFCurrentDirectory(TIFF* tif) { return (tif->tif_curdir); } /* * Return current strip. */ tstrip_t TIFFCurrentStrip(TIFF* tif) { return (tif->tif_curstrip); } /* * Return current tile. */ ttile_t TIFFCurrentTile(TIFF* tif) { return (tif->tif_curtile); } /* * Return nonzero if the file has byte-swapped data. */ int TIFFIsByteSwapped(TIFF* tif) { return ((tif->tif_flags & TIFF_SWAB) != 0); } /* * Return nonzero if the data is returned up-sampled. */ int TIFFIsUpSampled(TIFF* tif) { return (isUpSampled(tif)); } /* * Return nonzero if the data is returned in MSB-to-LSB bit order. */ int TIFFIsMSB2LSB(TIFF* tif) { return (isFillOrder(tif, FILLORDER_MSB2LSB)); } /* * Return nonzero if given file was written in big-endian order. */ int TIFFIsBigEndian(TIFF* tif) { return (tif->tif_header.tiff_magic == TIFF_BIGENDIAN); } /* * Return pointer to file read method. */ TIFFReadWriteProc TIFFGetReadProc(TIFF* tif) { return (tif->tif_readproc); } /* * Return pointer to file write method. */ TIFFReadWriteProc TIFFGetWriteProc(TIFF* tif) { return (tif->tif_writeproc); } /* * Return pointer to file seek method. */ TIFFSeekProc TIFFGetSeekProc(TIFF* tif) { return (tif->tif_seekproc); } /* * Return pointer to file close method. */ TIFFCloseProc TIFFGetCloseProc(TIFF* tif) { return (tif->tif_closeproc); } /* * Return pointer to file size requesting method. */ TIFFSizeProc TIFFGetSizeProc(TIFF* tif) { return (tif->tif_sizeproc); } /* * Return pointer to memory mapping method. */ TIFFMapFileProc TIFFGetMapFileProc(TIFF* tif) { return (tif->tif_mapproc); } /* * Return pointer to memory unmapping method. */ TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF* tif) { return (tif->tif_unmapproc); } /* vim: set ts=8 sts=8 sw=8 noet: */ �����������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_compress.c����������������������������������������������0000644�0001750�0001750�00000017227�12320456500�022206� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_compress.c,v 1.13 2007/02/24 15:03:50 dron Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library * * Compression Scheme Configuration Support. */ #include "tiffiop.h" static int TIFFNoEncode(TIFF* tif, const char* method) { const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression); if (c) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%s %s encoding is not implemented", c->name, method); } else { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Compression scheme %u %s encoding is not implemented", tif->tif_dir.td_compression, method); } return (-1); } int _TIFFNoRowEncode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s) { (void) pp; (void) cc; (void) s; return (TIFFNoEncode(tif, "scanline")); } int _TIFFNoStripEncode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s) { (void) pp; (void) cc; (void) s; return (TIFFNoEncode(tif, "strip")); } int _TIFFNoTileEncode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s) { (void) pp; (void) cc; (void) s; return (TIFFNoEncode(tif, "tile")); } static int TIFFNoDecode(TIFF* tif, const char* method) { const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression); if (c) TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%s %s decoding is not implemented", c->name, method); else TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Compression scheme %u %s decoding is not implemented", tif->tif_dir.td_compression, method); return (-1); } int _TIFFNoRowDecode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s) { (void) pp; (void) cc; (void) s; return (TIFFNoDecode(tif, "scanline")); } int _TIFFNoStripDecode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s) { (void) pp; (void) cc; (void) s; return (TIFFNoDecode(tif, "strip")); } int _TIFFNoTileDecode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s) { (void) pp; (void) cc; (void) s; return (TIFFNoDecode(tif, "tile")); } int _TIFFNoSeek(TIFF* tif, uint32 off) { (void) off; TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Compression algorithm does not support random access"); return (0); } int _TIFFNoPreCode(TIFF* tif, tsample_t s) { (void) tif; (void) s; return (1); } static int _TIFFtrue(TIFF* tif) { (void) tif; return (1); } static void _TIFFvoid(TIFF* tif) { (void) tif; } void _TIFFSetDefaultCompressionState(TIFF* tif) { tif->tif_decodestatus = TRUE; tif->tif_setupdecode = _TIFFtrue; tif->tif_predecode = _TIFFNoPreCode; tif->tif_decoderow = _TIFFNoRowDecode; tif->tif_decodestrip = _TIFFNoStripDecode; tif->tif_decodetile = _TIFFNoTileDecode; tif->tif_encodestatus = TRUE; tif->tif_setupencode = _TIFFtrue; tif->tif_preencode = _TIFFNoPreCode; tif->tif_postencode = _TIFFtrue; tif->tif_encoderow = _TIFFNoRowEncode; tif->tif_encodestrip = _TIFFNoStripEncode; tif->tif_encodetile = _TIFFNoTileEncode; tif->tif_close = _TIFFvoid; tif->tif_seek = _TIFFNoSeek; tif->tif_cleanup = _TIFFvoid; tif->tif_defstripsize = _TIFFDefaultStripSize; tif->tif_deftilesize = _TIFFDefaultTileSize; tif->tif_flags &= ~(TIFF_NOBITREV|TIFF_NOREADRAW); } int TIFFSetCompressionScheme(TIFF* tif, int scheme) { const TIFFCodec *c = TIFFFindCODEC((uint16) scheme); _TIFFSetDefaultCompressionState(tif); /* * Don't treat an unknown compression scheme as an error. * This permits applications to open files with data that * the library does not have builtin support for, but which * may still be meaningful. */ return (c ? (*c->init)(tif, scheme) : 1); } /* * Other compression schemes may be registered. Registered * schemes can also override the builtin versions provided * by this library. */ typedef struct _codec { struct _codec* next; TIFFCodec* info; } codec_t; static codec_t* registeredCODECS = NULL; const TIFFCodec* TIFFFindCODEC(uint16 scheme) { const TIFFCodec* c; codec_t* cd; for (cd = registeredCODECS; cd; cd = cd->next) if (cd->info->scheme == scheme) return ((const TIFFCodec*) cd->info); for (c = _TIFFBuiltinCODECS; c->name; c++) if (c->scheme == scheme) return (c); return ((const TIFFCodec*) 0); } TIFFCodec* TIFFRegisterCODEC(uint16 scheme, const char* name, TIFFInitMethod init) { codec_t* cd = (codec_t*) _TIFFmalloc(sizeof (codec_t) + sizeof (TIFFCodec) + strlen(name)+1); if (cd != NULL) { cd->info = (TIFFCodec*) ((tidata_t) cd + sizeof (codec_t)); cd->info->name = (char*) ((tidata_t) cd->info + sizeof (TIFFCodec)); strcpy(cd->info->name, name); cd->info->scheme = scheme; cd->info->init = init; cd->next = registeredCODECS; registeredCODECS = cd; } else { TIFFErrorExt(0, "TIFFRegisterCODEC", "No space to register compression scheme %s", name); return NULL; } return (cd->info); } void TIFFUnRegisterCODEC(TIFFCodec* c) { codec_t* cd; codec_t** pcd; for (pcd = ®isteredCODECS; (cd = *pcd); pcd = &cd->next) if (cd->info == c) { *pcd = cd->next; _TIFFfree(cd); return; } TIFFErrorExt(0, "TIFFUnRegisterCODEC", "Cannot remove compression scheme %s; not registered", c->name); } /************************************************************************/ /* TIFFGetConfisuredCODECs() */ /************************************************************************/ /** * Get list of configured codecs, both built-in and registered by user. * Caller is responsible to free this structure. * * @return returns array of TIFFCodec records (the last record should be NULL) * or NULL if function failed. */ TIFFCodec* TIFFGetConfiguredCODECs() { int i = 1; codec_t *cd; const TIFFCodec *c; TIFFCodec *codecs = NULL, *new_codecs; for (cd = registeredCODECS; cd; cd = cd->next) { new_codecs = (TIFFCodec *) _TIFFrealloc(codecs, i * sizeof(TIFFCodec)); if (!new_codecs) { _TIFFfree (codecs); return NULL; } codecs = new_codecs; _TIFFmemcpy(codecs + i - 1, cd, sizeof(TIFFCodec)); i++; } for (c = _TIFFBuiltinCODECS; c->name; c++) { if (TIFFIsCODECConfigured(c->scheme)) { new_codecs = (TIFFCodec *) _TIFFrealloc(codecs, i * sizeof(TIFFCodec)); if (!new_codecs) { _TIFFfree (codecs); return NULL; } codecs = new_codecs; _TIFFmemcpy(codecs + i - 1, (const tdata_t)c, sizeof(TIFFCodec)); i++; } } new_codecs = (TIFFCodec *) _TIFFrealloc(codecs, i * sizeof(TIFFCodec)); if (!new_codecs) { _TIFFfree (codecs); return NULL; } codecs = new_codecs; _TIFFmemset(codecs + i - 1, 0, sizeof(TIFFCodec)); return codecs; } /* vim: set ts=8 sts=8 sw=8 noet: */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_write.c�������������������������������������������������0000644�0001750�0001750�00000053701�12320456500�021502� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_write.c,v 1.22.2.4 2009-08-28 02:23:19 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * Scanline-oriented Write Support */ #include "tiffiop.h" #include <stdio.h> #define STRIPINCR 20 /* expansion factor on strip array */ #define WRITECHECKSTRIPS(tif, module) \ (((tif)->tif_flags&TIFF_BEENWRITING) || TIFFWriteCheck((tif),0,module)) #define WRITECHECKTILES(tif, module) \ (((tif)->tif_flags&TIFF_BEENWRITING) || TIFFWriteCheck((tif),1,module)) #define BUFFERCHECK(tif) \ ((((tif)->tif_flags & TIFF_BUFFERSETUP) && tif->tif_rawdata) || \ TIFFWriteBufferSetup((tif), NULL, (tsize_t) -1)) static int TIFFGrowStrips(TIFF*, int, const char*); static int TIFFAppendToStrip(TIFF*, tstrip_t, tidata_t, tsize_t); int TIFFWriteScanline(TIFF* tif, tdata_t buf, uint32 row, tsample_t sample) { static const char module[] = "TIFFWriteScanline"; register TIFFDirectory *td; int status, imagegrew = 0; tstrip_t strip; if (!WRITECHECKSTRIPS(tif, module)) return (-1); /* * Handle delayed allocation of data buffer. This * permits it to be sized more intelligently (using * directory information). */ if (!BUFFERCHECK(tif)) return (-1); td = &tif->tif_dir; /* * Extend image length if needed * (but only for PlanarConfig=1). */ if (row >= td->td_imagelength) { /* extend image */ if (td->td_planarconfig == PLANARCONFIG_SEPARATE) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Can not change \"ImageLength\" when using separate planes"); return (-1); } td->td_imagelength = row+1; imagegrew = 1; } /* * Calculate strip and check for crossings. */ if (td->td_planarconfig == PLANARCONFIG_SEPARATE) { if (sample >= td->td_samplesperpixel) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%d: Sample out of range, max %d", sample, td->td_samplesperpixel); return (-1); } strip = sample*td->td_stripsperimage + row/td->td_rowsperstrip; } else strip = row / td->td_rowsperstrip; /* * Check strip array to make sure there's space. We don't support * dynamically growing files that have data organized in separate * bitplanes because it's too painful. In that case we require that * the imagelength be set properly before the first write (so that the * strips array will be fully allocated above). */ if (strip >= td->td_nstrips && !TIFFGrowStrips(tif, 1, module)) return (-1); if (strip != tif->tif_curstrip) { /* * Changing strips -- flush any data present. */ if (!TIFFFlushData(tif)) return (-1); tif->tif_curstrip = strip; /* * Watch out for a growing image. The value of strips/image * will initially be 1 (since it can't be deduced until the * imagelength is known). */ if (strip >= td->td_stripsperimage && imagegrew) td->td_stripsperimage = TIFFhowmany(td->td_imagelength,td->td_rowsperstrip); tif->tif_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip; if ((tif->tif_flags & TIFF_CODERSETUP) == 0) { if (!(*tif->tif_setupencode)(tif)) return (-1); tif->tif_flags |= TIFF_CODERSETUP; } tif->tif_rawcc = 0; tif->tif_rawcp = tif->tif_rawdata; if( td->td_stripbytecount[strip] > 0 ) { /* if we are writing over existing tiles, zero length */ td->td_stripbytecount[strip] = 0; /* this forces TIFFAppendToStrip() to do a seek */ tif->tif_curoff = 0; } if (!(*tif->tif_preencode)(tif, sample)) return (-1); tif->tif_flags |= TIFF_POSTENCODE; } /* * Ensure the write is either sequential or at the * beginning of a strip (or that we can randomly * access the data -- i.e. no encoding). */ if (row != tif->tif_row) { if (row < tif->tif_row) { /* * Moving backwards within the same strip: * backup to the start and then decode * forward (below). */ tif->tif_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip; tif->tif_rawcp = tif->tif_rawdata; } /* * Seek forward to the desired row. */ if (!(*tif->tif_seek)(tif, row - tif->tif_row)) return (-1); tif->tif_row = row; } /* swab if needed - note that source buffer will be altered */ tif->tif_postdecode( tif, (tidata_t) buf, tif->tif_scanlinesize ); status = (*tif->tif_encoderow)(tif, (tidata_t) buf, tif->tif_scanlinesize, sample); /* we are now poised at the beginning of the next row */ tif->tif_row = row + 1; return (status); } /* * Encode the supplied data and write it to the * specified strip. * * NB: Image length must be setup before writing. */ tsize_t TIFFWriteEncodedStrip(TIFF* tif, tstrip_t strip, tdata_t data, tsize_t cc) { static const char module[] = "TIFFWriteEncodedStrip"; TIFFDirectory *td = &tif->tif_dir; tsample_t sample; if (!WRITECHECKSTRIPS(tif, module)) return ((tsize_t) -1); /* * Check strip array to make sure there's space. * We don't support dynamically growing files that * have data organized in separate bitplanes because * it's too painful. In that case we require that * the imagelength be set properly before the first * write (so that the strips array will be fully * allocated above). */ if (strip >= td->td_nstrips) { if (td->td_planarconfig == PLANARCONFIG_SEPARATE) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Can not grow image by strips when using separate planes"); return ((tsize_t) -1); } if (!TIFFGrowStrips(tif, 1, module)) return ((tsize_t) -1); td->td_stripsperimage = TIFFhowmany(td->td_imagelength, td->td_rowsperstrip); } /* * Handle delayed allocation of data buffer. This * permits it to be sized according to the directory * info. */ if (!BUFFERCHECK(tif)) return ((tsize_t) -1); tif->tif_curstrip = strip; tif->tif_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip; if ((tif->tif_flags & TIFF_CODERSETUP) == 0) { if (!(*tif->tif_setupencode)(tif)) return ((tsize_t) -1); tif->tif_flags |= TIFF_CODERSETUP; } tif->tif_rawcc = 0; tif->tif_rawcp = tif->tif_rawdata; if( td->td_stripbytecount[strip] > 0 ) { /* Force TIFFAppendToStrip() to consider placing data at end of file. */ tif->tif_curoff = 0; } tif->tif_flags &= ~TIFF_POSTENCODE; sample = (tsample_t)(strip / td->td_stripsperimage); if (!(*tif->tif_preencode)(tif, sample)) return ((tsize_t) -1); /* swab if needed - note that source buffer will be altered */ tif->tif_postdecode( tif, (tidata_t) data, cc ); if (!(*tif->tif_encodestrip)(tif, (tidata_t) data, cc, sample)) return ((tsize_t) 0); if (!(*tif->tif_postencode)(tif)) return ((tsize_t) -1); if (!isFillOrder(tif, td->td_fillorder) && (tif->tif_flags & TIFF_NOBITREV) == 0) TIFFReverseBits(tif->tif_rawdata, tif->tif_rawcc); if (tif->tif_rawcc > 0 && !TIFFAppendToStrip(tif, strip, tif->tif_rawdata, tif->tif_rawcc)) return ((tsize_t) -1); tif->tif_rawcc = 0; tif->tif_rawcp = tif->tif_rawdata; return (cc); } /* * Write the supplied data to the specified strip. * * NB: Image length must be setup before writing. */ tsize_t TIFFWriteRawStrip(TIFF* tif, tstrip_t strip, tdata_t data, tsize_t cc) { static const char module[] = "TIFFWriteRawStrip"; TIFFDirectory *td = &tif->tif_dir; if (!WRITECHECKSTRIPS(tif, module)) return ((tsize_t) -1); /* * Check strip array to make sure there's space. * We don't support dynamically growing files that * have data organized in separate bitplanes because * it's too painful. In that case we require that * the imagelength be set properly before the first * write (so that the strips array will be fully * allocated above). */ if (strip >= td->td_nstrips) { if (td->td_planarconfig == PLANARCONFIG_SEPARATE) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Can not grow image by strips when using separate planes"); return ((tsize_t) -1); } /* * Watch out for a growing image. The value of * strips/image will initially be 1 (since it * can't be deduced until the imagelength is known). */ if (strip >= td->td_stripsperimage) td->td_stripsperimage = TIFFhowmany(td->td_imagelength,td->td_rowsperstrip); if (!TIFFGrowStrips(tif, 1, module)) return ((tsize_t) -1); } tif->tif_curstrip = strip; tif->tif_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip; return (TIFFAppendToStrip(tif, strip, (tidata_t) data, cc) ? cc : (tsize_t) -1); } /* * Write and compress a tile of data. The * tile is selected by the (x,y,z,s) coordinates. */ tsize_t TIFFWriteTile(TIFF* tif, tdata_t buf, uint32 x, uint32 y, uint32 z, tsample_t s) { if (!TIFFCheckTile(tif, x, y, z, s)) return (-1); /* * NB: A tile size of -1 is used instead of tif_tilesize knowing * that TIFFWriteEncodedTile will clamp this to the tile size. * This is done because the tile size may not be defined until * after the output buffer is setup in TIFFWriteBufferSetup. */ return (TIFFWriteEncodedTile(tif, TIFFComputeTile(tif, x, y, z, s), buf, (tsize_t) -1)); } /* * Encode the supplied data and write it to the * specified tile. There must be space for the * data. The function clamps individual writes * to a tile to the tile size, but does not (and * can not) check that multiple writes to the same * tile do not write more than tile size data. * * NB: Image length must be setup before writing; this * interface does not support automatically growing * the image on each write (as TIFFWriteScanline does). */ tsize_t TIFFWriteEncodedTile(TIFF* tif, ttile_t tile, tdata_t data, tsize_t cc) { static const char module[] = "TIFFWriteEncodedTile"; TIFFDirectory *td; tsample_t sample; if (!WRITECHECKTILES(tif, module)) return ((tsize_t) -1); td = &tif->tif_dir; if (tile >= td->td_nstrips) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Tile %lu out of range, max %lu", tif->tif_name, (unsigned long) tile, (unsigned long) td->td_nstrips); return ((tsize_t) -1); } /* * Handle delayed allocation of data buffer. This * permits it to be sized more intelligently (using * directory information). */ if (!BUFFERCHECK(tif)) return ((tsize_t) -1); tif->tif_curtile = tile; tif->tif_rawcc = 0; tif->tif_rawcp = tif->tif_rawdata; if( td->td_stripbytecount[tile] > 0 ) { /* Force TIFFAppendToStrip() to consider placing data at end of file. */ tif->tif_curoff = 0; } /* * Compute tiles per row & per column to compute * current row and column */ tif->tif_row = (tile % TIFFhowmany(td->td_imagelength, td->td_tilelength)) * td->td_tilelength; tif->tif_col = (tile % TIFFhowmany(td->td_imagewidth, td->td_tilewidth)) * td->td_tilewidth; if ((tif->tif_flags & TIFF_CODERSETUP) == 0) { if (!(*tif->tif_setupencode)(tif)) return ((tsize_t) -1); tif->tif_flags |= TIFF_CODERSETUP; } tif->tif_flags &= ~TIFF_POSTENCODE; sample = (tsample_t)(tile/td->td_stripsperimage); if (!(*tif->tif_preencode)(tif, sample)) return ((tsize_t) -1); /* * Clamp write amount to the tile size. This is mostly * done so that callers can pass in some large number * (e.g. -1) and have the tile size used instead. */ if ( cc < 1 || cc > tif->tif_tilesize) cc = tif->tif_tilesize; /* swab if needed - note that source buffer will be altered */ tif->tif_postdecode( tif, (tidata_t) data, cc ); if (!(*tif->tif_encodetile)(tif, (tidata_t) data, cc, sample)) return ((tsize_t) 0); if (!(*tif->tif_postencode)(tif)) return ((tsize_t) -1); if (!isFillOrder(tif, td->td_fillorder) && (tif->tif_flags & TIFF_NOBITREV) == 0) TIFFReverseBits((unsigned char *)tif->tif_rawdata, tif->tif_rawcc); if (tif->tif_rawcc > 0 && !TIFFAppendToStrip(tif, tile, tif->tif_rawdata, tif->tif_rawcc)) return ((tsize_t) -1); tif->tif_rawcc = 0; tif->tif_rawcp = tif->tif_rawdata; return (cc); } /* * Write the supplied data to the specified strip. * There must be space for the data; we don't check * if strips overlap! * * NB: Image length must be setup before writing; this * interface does not support automatically growing * the image on each write (as TIFFWriteScanline does). */ tsize_t TIFFWriteRawTile(TIFF* tif, ttile_t tile, tdata_t data, tsize_t cc) { static const char module[] = "TIFFWriteRawTile"; if (!WRITECHECKTILES(tif, module)) return ((tsize_t) -1); if (tile >= tif->tif_dir.td_nstrips) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Tile %lu out of range, max %lu", tif->tif_name, (unsigned long) tile, (unsigned long) tif->tif_dir.td_nstrips); return ((tsize_t) -1); } return (TIFFAppendToStrip(tif, tile, (tidata_t) data, cc) ? cc : (tsize_t) -1); } #define isUnspecified(tif, f) \ (TIFFFieldSet(tif,f) && (tif)->tif_dir.td_imagelength == 0) int TIFFSetupStrips(TIFF* tif) { TIFFDirectory* td = &tif->tif_dir; if (isTiled(tif)) td->td_stripsperimage = isUnspecified(tif, FIELD_TILEDIMENSIONS) ? td->td_samplesperpixel : TIFFNumberOfTiles(tif); else td->td_stripsperimage = isUnspecified(tif, FIELD_ROWSPERSTRIP) ? td->td_samplesperpixel : TIFFNumberOfStrips(tif); td->td_nstrips = td->td_stripsperimage; if (td->td_planarconfig == PLANARCONFIG_SEPARATE) td->td_stripsperimage /= td->td_samplesperpixel; td->td_stripoffset = (uint32 *) _TIFFmalloc(td->td_nstrips * sizeof (uint32)); td->td_stripbytecount = (uint32 *) _TIFFmalloc(td->td_nstrips * sizeof (uint32)); if (td->td_stripoffset == NULL || td->td_stripbytecount == NULL) return (0); /* * Place data at the end-of-file * (by setting offsets to zero). */ _TIFFmemset(td->td_stripoffset, 0, td->td_nstrips*sizeof (uint32)); _TIFFmemset(td->td_stripbytecount, 0, td->td_nstrips*sizeof (uint32)); TIFFSetFieldBit(tif, FIELD_STRIPOFFSETS); TIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS); return (1); } #undef isUnspecified /* * Verify file is writable and that the directory * information is setup properly. In doing the latter * we also "freeze" the state of the directory so * that important information is not changed. */ int TIFFWriteCheck(TIFF* tif, int tiles, const char* module) { if (tif->tif_mode == O_RDONLY) { TIFFErrorExt(tif->tif_clientdata, module, "%s: File not open for writing", tif->tif_name); return (0); } if (tiles ^ isTiled(tif)) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, tiles ? "Can not write tiles to a stripped image" : "Can not write scanlines to a tiled image"); return (0); } /* * On the first write verify all the required information * has been setup and initialize any data structures that * had to wait until directory information was set. * Note that a lot of our work is assumed to remain valid * because we disallow any of the important parameters * from changing after we start writing (i.e. once * TIFF_BEENWRITING is set, TIFFSetField will only allow * the image's length to be changed). */ if (!TIFFFieldSet(tif, FIELD_IMAGEDIMENSIONS)) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Must set \"ImageWidth\" before writing data", tif->tif_name); return (0); } if (tif->tif_dir.td_samplesperpixel == 1) { /* * Planarconfiguration is irrelevant in case of single band * images and need not be included. We will set it anyway, * because this field is used in other parts of library even * in the single band case. */ if (!TIFFFieldSet(tif, FIELD_PLANARCONFIG)) tif->tif_dir.td_planarconfig = PLANARCONFIG_CONTIG; } else { if (!TIFFFieldSet(tif, FIELD_PLANARCONFIG)) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Must set \"PlanarConfiguration\" before writing data", tif->tif_name); return (0); } } if (tif->tif_dir.td_stripoffset == NULL && !TIFFSetupStrips(tif)) { tif->tif_dir.td_nstrips = 0; TIFFErrorExt(tif->tif_clientdata, module, "%s: No space for %s arrays", tif->tif_name, isTiled(tif) ? "tile" : "strip"); return (0); } tif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tsize_t) -1; tif->tif_scanlinesize = TIFFScanlineSize(tif); tif->tif_flags |= TIFF_BEENWRITING; return (1); } /* * Setup the raw data buffer used for encoding. */ int TIFFWriteBufferSetup(TIFF* tif, tdata_t bp, tsize_t size) { static const char module[] = "TIFFWriteBufferSetup"; if (tif->tif_rawdata) { if (tif->tif_flags & TIFF_MYBUFFER) { _TIFFfree(tif->tif_rawdata); tif->tif_flags &= ~TIFF_MYBUFFER; } tif->tif_rawdata = NULL; } if (size == (tsize_t) -1) { size = (isTiled(tif) ? tif->tif_tilesize : TIFFStripSize(tif)); /* * Make raw data buffer at least 8K */ if (size < 8*1024) size = 8*1024; bp = NULL; /* NB: force malloc */ } if (bp == NULL) { bp = _TIFFmalloc(size); if (bp == NULL) { TIFFErrorExt(tif->tif_clientdata, module, "%s: No space for output buffer", tif->tif_name); return (0); } tif->tif_flags |= TIFF_MYBUFFER; } else tif->tif_flags &= ~TIFF_MYBUFFER; tif->tif_rawdata = (tidata_t) bp; tif->tif_rawdatasize = size; tif->tif_rawcc = 0; tif->tif_rawcp = tif->tif_rawdata; tif->tif_flags |= TIFF_BUFFERSETUP; return (1); } /* * Grow the strip data structures by delta strips. */ static int TIFFGrowStrips(TIFF* tif, int delta, const char* module) { TIFFDirectory *td = &tif->tif_dir; uint32 *new_stripoffset, *new_stripbytecount; assert(td->td_planarconfig == PLANARCONFIG_CONTIG); new_stripoffset = (uint32*)_TIFFrealloc(td->td_stripoffset, (td->td_nstrips + delta) * sizeof (uint32)); new_stripbytecount = (uint32*)_TIFFrealloc(td->td_stripbytecount, (td->td_nstrips + delta) * sizeof (uint32)); if (new_stripoffset == NULL || new_stripbytecount == NULL) { if (new_stripoffset) _TIFFfree(new_stripoffset); if (new_stripbytecount) _TIFFfree(new_stripbytecount); td->td_nstrips = 0; TIFFErrorExt(tif->tif_clientdata, module, "%s: No space to expand strip arrays", tif->tif_name); return (0); } td->td_stripoffset = new_stripoffset; td->td_stripbytecount = new_stripbytecount; _TIFFmemset(td->td_stripoffset + td->td_nstrips, 0, delta*sizeof (uint32)); _TIFFmemset(td->td_stripbytecount + td->td_nstrips, 0, delta*sizeof (uint32)); td->td_nstrips += delta; return (1); } /* * Append the data to the specified strip. */ static int TIFFAppendToStrip(TIFF* tif, tstrip_t strip, tidata_t data, tsize_t cc) { static const char module[] = "TIFFAppendToStrip"; TIFFDirectory *td = &tif->tif_dir; if (td->td_stripoffset[strip] == 0 || tif->tif_curoff == 0) { assert(td->td_nstrips > 0); if( td->td_stripbytecount[strip] != 0 && td->td_stripoffset[strip] != 0 && td->td_stripbytecount[strip] >= cc ) { /* * There is already tile data on disk, and the new tile * data we have to will fit in the same space. The only * aspect of this that is risky is that there could be * more data to append to this strip before we are done * depending on how we are getting called. */ if (!SeekOK(tif, td->td_stripoffset[strip])) { TIFFErrorExt(tif->tif_clientdata, module, "Seek error at scanline %lu", (unsigned long)tif->tif_row); return (0); } } else { /* * Seek to end of file, and set that as our location to * write this strip. */ td->td_stripoffset[strip] = TIFFSeekFile(tif, 0, SEEK_END); } tif->tif_curoff = td->td_stripoffset[strip]; /* * We are starting a fresh strip/tile, so set the size to zero. */ td->td_stripbytecount[strip] = 0; } if (!WriteOK(tif, data, cc)) { TIFFErrorExt(tif->tif_clientdata, module, "Write error at scanline %lu", (unsigned long) tif->tif_row); return (0); } tif->tif_curoff = tif->tif_curoff+cc; td->td_stripbytecount[strip] += cc; return (1); } /* * Internal version of TIFFFlushData that can be * called by ``encodestrip routines'' w/o concern * for infinite recursion. */ int TIFFFlushData1(TIFF* tif) { if (tif->tif_rawcc > 0) { if (!isFillOrder(tif, tif->tif_dir.td_fillorder) && (tif->tif_flags & TIFF_NOBITREV) == 0) TIFFReverseBits((unsigned char *)tif->tif_rawdata, tif->tif_rawcc); if (!TIFFAppendToStrip(tif, isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip, tif->tif_rawdata, tif->tif_rawcc)) return (0); tif->tif_rawcc = 0; tif->tif_rawcp = tif->tif_rawdata; } return (1); } /* * Set the current write offset. This should only be * used to set the offset to a known previous location * (very carefully), or to 0 so that the next write gets * appended to the end of the file. */ void TIFFSetWriteOffset(TIFF* tif, toff_t off) { tif->tif_curoff = off; } /* vim: set ts=8 sts=8 sw=8 noet: */ ���������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_getimage.c����������������������������������������������0000644�0001750�0001750�00000206272�12320456500�022135� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_getimage.c,v 1.63.2.3 2009-08-30 16:21:46 bfriesen Exp $ */ /* * Copyright (c) 1991-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library * * Read and return a packed RGBA image. */ #include "tiffiop.h" #include <stdio.h> static int gtTileContig(TIFFRGBAImage*, uint32*, uint32, uint32); static int gtTileSeparate(TIFFRGBAImage*, uint32*, uint32, uint32); static int gtStripContig(TIFFRGBAImage*, uint32*, uint32, uint32); static int gtStripSeparate(TIFFRGBAImage*, uint32*, uint32, uint32); static int PickContigCase(TIFFRGBAImage*); static int PickSeparateCase(TIFFRGBAImage*); static const char photoTag[] = "PhotometricInterpretation"; /* * Helper constants used in Orientation tag handling */ #define FLIP_VERTICALLY 0x01 #define FLIP_HORIZONTALLY 0x02 /* * Color conversion constants. We will define display types here. */ TIFFDisplay display_sRGB = { { /* XYZ -> luminance matrix */ { 3.2410F, -1.5374F, -0.4986F }, { -0.9692F, 1.8760F, 0.0416F }, { 0.0556F, -0.2040F, 1.0570F } }, 100.0F, 100.0F, 100.0F, /* Light o/p for reference white */ 255, 255, 255, /* Pixel values for ref. white */ 1.0F, 1.0F, 1.0F, /* Residual light o/p for black pixel */ 2.4F, 2.4F, 2.4F, /* Gamma values for the three guns */ }; /* * Check the image to see if TIFFReadRGBAImage can deal with it. * 1/0 is returned according to whether or not the image can * be handled. If 0 is returned, emsg contains the reason * why it is being rejected. */ int TIFFRGBAImageOK(TIFF* tif, char emsg[1024]) { TIFFDirectory* td = &tif->tif_dir; uint16 photometric; int colorchannels; if (!tif->tif_decodestatus) { sprintf(emsg, "Sorry, requested compression method is not configured"); return (0); } switch (td->td_bitspersample) { case 1: case 2: case 4: case 8: case 16: break; default: sprintf(emsg, "Sorry, can not handle images with %d-bit samples", td->td_bitspersample); return (0); } colorchannels = td->td_samplesperpixel - td->td_extrasamples; if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric)) { switch (colorchannels) { case 1: photometric = PHOTOMETRIC_MINISBLACK; break; case 3: photometric = PHOTOMETRIC_RGB; break; default: sprintf(emsg, "Missing needed %s tag", photoTag); return (0); } } switch (photometric) { case PHOTOMETRIC_MINISWHITE: case PHOTOMETRIC_MINISBLACK: case PHOTOMETRIC_PALETTE: if (td->td_planarconfig == PLANARCONFIG_CONTIG && td->td_samplesperpixel != 1 && td->td_bitspersample < 8 ) { sprintf(emsg, "Sorry, can not handle contiguous data with %s=%d, " "and %s=%d and Bits/Sample=%d", photoTag, photometric, "Samples/pixel", td->td_samplesperpixel, td->td_bitspersample); return (0); } /* * We should likely validate that any extra samples are either * to be ignored, or are alpha, and if alpha we should try to use * them. But for now we won't bother with this. */ break; case PHOTOMETRIC_YCBCR: /* * TODO: if at all meaningful and useful, make more complete * support check here, or better still, refactor to let supporting * code decide whether there is support and what meaningfull * error to return */ break; case PHOTOMETRIC_RGB: if (colorchannels < 3) { sprintf(emsg, "Sorry, can not handle RGB image with %s=%d", "Color channels", colorchannels); return (0); } break; case PHOTOMETRIC_SEPARATED: { uint16 inkset; TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset); if (inkset != INKSET_CMYK) { sprintf(emsg, "Sorry, can not handle separated image with %s=%d", "InkSet", inkset); return 0; } if (td->td_samplesperpixel < 4) { sprintf(emsg, "Sorry, can not handle separated image with %s=%d", "Samples/pixel", td->td_samplesperpixel); return 0; } break; } case PHOTOMETRIC_LOGL: if (td->td_compression != COMPRESSION_SGILOG) { sprintf(emsg, "Sorry, LogL data must have %s=%d", "Compression", COMPRESSION_SGILOG); return (0); } break; case PHOTOMETRIC_LOGLUV: if (td->td_compression != COMPRESSION_SGILOG && td->td_compression != COMPRESSION_SGILOG24) { sprintf(emsg, "Sorry, LogLuv data must have %s=%d or %d", "Compression", COMPRESSION_SGILOG, COMPRESSION_SGILOG24); return (0); } if (td->td_planarconfig != PLANARCONFIG_CONTIG) { sprintf(emsg, "Sorry, can not handle LogLuv images with %s=%d", "Planarconfiguration", td->td_planarconfig); return (0); } break; case PHOTOMETRIC_CIELAB: break; default: sprintf(emsg, "Sorry, can not handle image with %s=%d", photoTag, photometric); return (0); } return (1); } void TIFFRGBAImageEnd(TIFFRGBAImage* img) { if (img->Map) _TIFFfree(img->Map), img->Map = NULL; if (img->BWmap) _TIFFfree(img->BWmap), img->BWmap = NULL; if (img->PALmap) _TIFFfree(img->PALmap), img->PALmap = NULL; if (img->ycbcr) _TIFFfree(img->ycbcr), img->ycbcr = NULL; if (img->cielab) _TIFFfree(img->cielab), img->cielab = NULL; if( img->redcmap ) { _TIFFfree( img->redcmap ); _TIFFfree( img->greencmap ); _TIFFfree( img->bluecmap ); } } static int isCCITTCompression(TIFF* tif) { uint16 compress; TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress); return (compress == COMPRESSION_CCITTFAX3 || compress == COMPRESSION_CCITTFAX4 || compress == COMPRESSION_CCITTRLE || compress == COMPRESSION_CCITTRLEW); } int TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024]) { uint16* sampleinfo; uint16 extrasamples; uint16 planarconfig; uint16 compress; int colorchannels; uint16 *red_orig, *green_orig, *blue_orig; int n_color; /* Initialize to normal values */ img->row_offset = 0; img->col_offset = 0; img->redcmap = NULL; img->greencmap = NULL; img->bluecmap = NULL; img->req_orientation = ORIENTATION_BOTLEFT; /* It is the default */ img->tif = tif; img->stoponerr = stop; TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &img->bitspersample); switch (img->bitspersample) { case 1: case 2: case 4: case 8: case 16: break; default: sprintf(emsg, "Sorry, can not handle images with %d-bit samples", img->bitspersample); return (0); } img->alpha = 0; TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &img->samplesperpixel); TIFFGetFieldDefaulted(tif, TIFFTAG_EXTRASAMPLES, &extrasamples, &sampleinfo); if (extrasamples >= 1) { switch (sampleinfo[0]) { case EXTRASAMPLE_UNSPECIFIED: /* Workaround for some images without */ if (img->samplesperpixel > 3) /* correct info about alpha channel */ img->alpha = EXTRASAMPLE_ASSOCALPHA; break; case EXTRASAMPLE_ASSOCALPHA: /* data is pre-multiplied */ case EXTRASAMPLE_UNASSALPHA: /* data is not pre-multiplied */ img->alpha = sampleinfo[0]; break; } } #ifdef DEFAULT_EXTRASAMPLE_AS_ALPHA if( !TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric)) img->photometric = PHOTOMETRIC_MINISWHITE; if( extrasamples == 0 && img->samplesperpixel == 4 && img->photometric == PHOTOMETRIC_RGB ) { img->alpha = EXTRASAMPLE_ASSOCALPHA; extrasamples = 1; } #endif colorchannels = img->samplesperpixel - extrasamples; TIFFGetFieldDefaulted(tif, TIFFTAG_COMPRESSION, &compress); TIFFGetFieldDefaulted(tif, TIFFTAG_PLANARCONFIG, &planarconfig); if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric)) { switch (colorchannels) { case 1: if (isCCITTCompression(tif)) img->photometric = PHOTOMETRIC_MINISWHITE; else img->photometric = PHOTOMETRIC_MINISBLACK; break; case 3: img->photometric = PHOTOMETRIC_RGB; break; default: sprintf(emsg, "Missing needed %s tag", photoTag); return (0); } } switch (img->photometric) { case PHOTOMETRIC_PALETTE: if (!TIFFGetField(tif, TIFFTAG_COLORMAP, &red_orig, &green_orig, &blue_orig)) { sprintf(emsg, "Missing required \"Colormap\" tag"); return (0); } /* copy the colormaps so we can modify them */ n_color = (1L << img->bitspersample); img->redcmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color); img->greencmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color); img->bluecmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color); if( !img->redcmap || !img->greencmap || !img->bluecmap ) { sprintf(emsg, "Out of memory for colormap copy"); return (0); } _TIFFmemcpy( img->redcmap, red_orig, n_color * 2 ); _TIFFmemcpy( img->greencmap, green_orig, n_color * 2 ); _TIFFmemcpy( img->bluecmap, blue_orig, n_color * 2 ); /* fall thru... */ case PHOTOMETRIC_MINISWHITE: case PHOTOMETRIC_MINISBLACK: if (planarconfig == PLANARCONFIG_CONTIG && img->samplesperpixel != 1 && img->bitspersample < 8 ) { sprintf(emsg, "Sorry, can not handle contiguous data with %s=%d, " "and %s=%d and Bits/Sample=%d", photoTag, img->photometric, "Samples/pixel", img->samplesperpixel, img->bitspersample); return (0); } break; case PHOTOMETRIC_YCBCR: /* It would probably be nice to have a reality check here. */ if (planarconfig == PLANARCONFIG_CONTIG) /* can rely on libjpeg to convert to RGB */ /* XXX should restore current state on exit */ switch (compress) { case COMPRESSION_JPEG: /* * TODO: when complete tests verify complete desubsampling * and YCbCr handling, remove use of TIFFTAG_JPEGCOLORMODE in * favor of tif_getimage.c native handling */ TIFFSetField(tif, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB); img->photometric = PHOTOMETRIC_RGB; break; default: /* do nothing */; break; } /* * TODO: if at all meaningful and useful, make more complete * support check here, or better still, refactor to let supporting * code decide whether there is support and what meaningfull * error to return */ break; case PHOTOMETRIC_RGB: if (colorchannels < 3) { sprintf(emsg, "Sorry, can not handle RGB image with %s=%d", "Color channels", colorchannels); return (0); } break; case PHOTOMETRIC_SEPARATED: { uint16 inkset; TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset); if (inkset != INKSET_CMYK) { sprintf(emsg, "Sorry, can not handle separated image with %s=%d", "InkSet", inkset); return (0); } if (img->samplesperpixel < 4) { sprintf(emsg, "Sorry, can not handle separated image with %s=%d", "Samples/pixel", img->samplesperpixel); return (0); } } break; case PHOTOMETRIC_LOGL: if (compress != COMPRESSION_SGILOG) { sprintf(emsg, "Sorry, LogL data must have %s=%d", "Compression", COMPRESSION_SGILOG); return (0); } TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT); img->photometric = PHOTOMETRIC_MINISBLACK; /* little white lie */ img->bitspersample = 8; break; case PHOTOMETRIC_LOGLUV: if (compress != COMPRESSION_SGILOG && compress != COMPRESSION_SGILOG24) { sprintf(emsg, "Sorry, LogLuv data must have %s=%d or %d", "Compression", COMPRESSION_SGILOG, COMPRESSION_SGILOG24); return (0); } if (planarconfig != PLANARCONFIG_CONTIG) { sprintf(emsg, "Sorry, can not handle LogLuv images with %s=%d", "Planarconfiguration", planarconfig); return (0); } TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT); img->photometric = PHOTOMETRIC_RGB; /* little white lie */ img->bitspersample = 8; break; case PHOTOMETRIC_CIELAB: break; default: sprintf(emsg, "Sorry, can not handle image with %s=%d", photoTag, img->photometric); return (0); } img->Map = NULL; img->BWmap = NULL; img->PALmap = NULL; img->ycbcr = NULL; img->cielab = NULL; TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &img->width); TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &img->height); TIFFGetFieldDefaulted(tif, TIFFTAG_ORIENTATION, &img->orientation); img->isContig = !(planarconfig == PLANARCONFIG_SEPARATE && colorchannels > 1); if (img->isContig) { if (!PickContigCase(img)) { sprintf(emsg, "Sorry, can not handle image"); return 0; } } else { if (!PickSeparateCase(img)) { sprintf(emsg, "Sorry, can not handle image"); return 0; } } return 1; } int TIFFRGBAImageGet(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h) { if (img->get == NULL) { TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), "No \"get\" routine setup"); return (0); } if (img->put.any == NULL) { TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), "No \"put\" routine setupl; probably can not handle image format"); return (0); } return (*img->get)(img, raster, w, h); } /* * Read the specified image into an ABGR-format rastertaking in account * specified orientation. */ int TIFFReadRGBAImageOriented(TIFF* tif, uint32 rwidth, uint32 rheight, uint32* raster, int orientation, int stop) { char emsg[1024] = ""; TIFFRGBAImage img; int ok; if (TIFFRGBAImageOK(tif, emsg) && TIFFRGBAImageBegin(&img, tif, stop, emsg)) { img.req_orientation = orientation; /* XXX verify rwidth and rheight against width and height */ ok = TIFFRGBAImageGet(&img, raster+(rheight-img.height)*rwidth, rwidth, img.height); TIFFRGBAImageEnd(&img); } else { TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", emsg); ok = 0; } return (ok); } /* * Read the specified image into an ABGR-format raster. Use bottom left * origin for raster by default. */ int TIFFReadRGBAImage(TIFF* tif, uint32 rwidth, uint32 rheight, uint32* raster, int stop) { return TIFFReadRGBAImageOriented(tif, rwidth, rheight, raster, ORIENTATION_BOTLEFT, stop); } static int setorientation(TIFFRGBAImage* img) { switch (img->orientation) { case ORIENTATION_TOPLEFT: case ORIENTATION_LEFTTOP: if (img->req_orientation == ORIENTATION_TOPRIGHT || img->req_orientation == ORIENTATION_RIGHTTOP) return FLIP_HORIZONTALLY; else if (img->req_orientation == ORIENTATION_BOTRIGHT || img->req_orientation == ORIENTATION_RIGHTBOT) return FLIP_HORIZONTALLY | FLIP_VERTICALLY; else if (img->req_orientation == ORIENTATION_BOTLEFT || img->req_orientation == ORIENTATION_LEFTBOT) return FLIP_VERTICALLY; else return 0; case ORIENTATION_TOPRIGHT: case ORIENTATION_RIGHTTOP: if (img->req_orientation == ORIENTATION_TOPLEFT || img->req_orientation == ORIENTATION_LEFTTOP) return FLIP_HORIZONTALLY; else if (img->req_orientation == ORIENTATION_BOTRIGHT || img->req_orientation == ORIENTATION_RIGHTBOT) return FLIP_VERTICALLY; else if (img->req_orientation == ORIENTATION_BOTLEFT || img->req_orientation == ORIENTATION_LEFTBOT) return FLIP_HORIZONTALLY | FLIP_VERTICALLY; else return 0; case ORIENTATION_BOTRIGHT: case ORIENTATION_RIGHTBOT: if (img->req_orientation == ORIENTATION_TOPLEFT || img->req_orientation == ORIENTATION_LEFTTOP) return FLIP_HORIZONTALLY | FLIP_VERTICALLY; else if (img->req_orientation == ORIENTATION_TOPRIGHT || img->req_orientation == ORIENTATION_RIGHTTOP) return FLIP_VERTICALLY; else if (img->req_orientation == ORIENTATION_BOTLEFT || img->req_orientation == ORIENTATION_LEFTBOT) return FLIP_HORIZONTALLY; else return 0; case ORIENTATION_BOTLEFT: case ORIENTATION_LEFTBOT: if (img->req_orientation == ORIENTATION_TOPLEFT || img->req_orientation == ORIENTATION_LEFTTOP) return FLIP_VERTICALLY; else if (img->req_orientation == ORIENTATION_TOPRIGHT || img->req_orientation == ORIENTATION_RIGHTTOP) return FLIP_HORIZONTALLY | FLIP_VERTICALLY; else if (img->req_orientation == ORIENTATION_BOTRIGHT || img->req_orientation == ORIENTATION_RIGHTBOT) return FLIP_HORIZONTALLY; else return 0; default: /* NOTREACHED */ return 0; } } /* * Get an tile-organized image that has * PlanarConfiguration contiguous if SamplesPerPixel > 1 * or * SamplesPerPixel == 1 */ static int gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h) { TIFF* tif = img->tif; tileContigRoutine put = img->put.contig; uint32 col, row, y, rowstoread; uint32 pos; uint32 tw, th; unsigned char* buf; int32 fromskew, toskew; uint32 nrow; int ret = 1, flip; buf = (unsigned char*) _TIFFmalloc(TIFFTileSize(tif)); if (buf == 0) { TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for tile buffer"); return (0); } _TIFFmemset(buf, 0, TIFFTileSize(tif)); TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw); TIFFGetField(tif, TIFFTAG_TILELENGTH, &th); flip = setorientation(img); if (flip & FLIP_VERTICALLY) { y = h - 1; toskew = -(int32)(tw + w); } else { y = 0; toskew = -(int32)(tw - w); } for (row = 0; row < h; row += nrow) { rowstoread = th - (row + img->row_offset) % th; nrow = (row + rowstoread > h ? h - row : rowstoread); for (col = 0; col < w; col += tw) { if (TIFFReadTile(tif, buf, col+img->col_offset, row+img->row_offset, 0, 0) < 0 && img->stoponerr) { ret = 0; break; } pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif); if (col + tw > w) { /* * Tile is clipped horizontally. Calculate * visible portion and skewing factors. */ uint32 npix = w - col; fromskew = tw - npix; (*put)(img, raster+y*w+col, col, y, npix, nrow, fromskew, toskew + fromskew, buf + pos); } else { (*put)(img, raster+y*w+col, col, y, tw, nrow, 0, toskew, buf + pos); } } y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow); } _TIFFfree(buf); if (flip & FLIP_HORIZONTALLY) { uint32 line; for (line = 0; line < h; line++) { uint32 *left = raster + (line * w); uint32 *right = left + w - 1; while ( left < right ) { uint32 temp = *left; *left = *right; *right = temp; left++, right--; } } } return (ret); } /* * Get an tile-organized image that has * SamplesPerPixel > 1 * PlanarConfiguration separated * We assume that all such images are RGB. */ static int gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h) { TIFF* tif = img->tif; tileSeparateRoutine put = img->put.separate; uint32 col, row, y, rowstoread; uint32 pos; uint32 tw, th; unsigned char* buf; unsigned char* p0; unsigned char* p1; unsigned char* p2; unsigned char* pa; tsize_t tilesize; int32 fromskew, toskew; int alpha = img->alpha; uint32 nrow; int ret = 1, flip; tilesize = TIFFTileSize(tif); buf = (unsigned char*) _TIFFmalloc((alpha?4:3)*tilesize); if (buf == 0) { TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for tile buffer"); return (0); } _TIFFmemset(buf, 0, (alpha?4:3)*tilesize); p0 = buf; p1 = p0 + tilesize; p2 = p1 + tilesize; pa = (alpha?(p2+tilesize):NULL); TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw); TIFFGetField(tif, TIFFTAG_TILELENGTH, &th); flip = setorientation(img); if (flip & FLIP_VERTICALLY) { y = h - 1; toskew = -(int32)(tw + w); } else { y = 0; toskew = -(int32)(tw - w); } for (row = 0; row < h; row += nrow) { rowstoread = th - (row + img->row_offset) % th; nrow = (row + rowstoread > h ? h - row : rowstoread); for (col = 0; col < w; col += tw) { if (TIFFReadTile(tif, p0, col+img->col_offset, row+img->row_offset,0,0) < 0 && img->stoponerr) { ret = 0; break; } if (TIFFReadTile(tif, p1, col+img->col_offset, row+img->row_offset,0,1) < 0 && img->stoponerr) { ret = 0; break; } if (TIFFReadTile(tif, p2, col+img->col_offset, row+img->row_offset,0,2) < 0 && img->stoponerr) { ret = 0; break; } if (alpha) { if (TIFFReadTile(tif,pa,col+img->col_offset, row+img->row_offset,0,3) < 0 && img->stoponerr) { ret = 0; break; } } pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif); if (col + tw > w) { /* * Tile is clipped horizontally. Calculate * visible portion and skewing factors. */ uint32 npix = w - col; fromskew = tw - npix; (*put)(img, raster+y*w+col, col, y, npix, nrow, fromskew, toskew + fromskew, p0 + pos, p1 + pos, p2 + pos, (alpha?(pa+pos):NULL)); } else { (*put)(img, raster+y*w+col, col, y, tw, nrow, 0, toskew, p0 + pos, p1 + pos, p2 + pos, (alpha?(pa+pos):NULL)); } } y += (flip & FLIP_VERTICALLY ?-(int32) nrow : (int32) nrow); } if (flip & FLIP_HORIZONTALLY) { uint32 line; for (line = 0; line < h; line++) { uint32 *left = raster + (line * w); uint32 *right = left + w - 1; while ( left < right ) { uint32 temp = *left; *left = *right; *right = temp; left++, right--; } } } _TIFFfree(buf); return (ret); } /* * Get a strip-organized image that has * PlanarConfiguration contiguous if SamplesPerPixel > 1 * or * SamplesPerPixel == 1 */ static int gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h) { TIFF* tif = img->tif; tileContigRoutine put = img->put.contig; uint32 row, y, nrow, nrowsub, rowstoread; uint32 pos; unsigned char* buf; uint32 rowsperstrip; uint16 subsamplinghor,subsamplingver; uint32 imagewidth = img->width; tsize_t scanline; int32 fromskew, toskew; int ret = 1, flip; buf = (unsigned char*) _TIFFmalloc(TIFFStripSize(tif)); if (buf == 0) { TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for strip buffer"); return (0); } _TIFFmemset(buf, 0, TIFFStripSize(tif)); flip = setorientation(img); if (flip & FLIP_VERTICALLY) { y = h - 1; toskew = -(int32)(w + w); } else { y = 0; toskew = -(int32)(w - w); } TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING, &subsamplinghor, &subsamplingver); scanline = TIFFNewScanlineSize(tif); fromskew = (w < imagewidth ? imagewidth - w : 0); for (row = 0; row < h; row += nrow) { rowstoread = rowsperstrip - (row + img->row_offset) % rowsperstrip; nrow = (row + rowstoread > h ? h - row : rowstoread); nrowsub = nrow; if ((nrowsub%subsamplingver)!=0) nrowsub+=subsamplingver-nrowsub%subsamplingver; if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif,row+img->row_offset, 0), buf, ((row + img->row_offset)%rowsperstrip + nrowsub) * scanline) < 0 && img->stoponerr) { ret = 0; break; } pos = ((row + img->row_offset) % rowsperstrip) * scanline; (*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, buf + pos); y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow); } if (flip & FLIP_HORIZONTALLY) { uint32 line; for (line = 0; line < h; line++) { uint32 *left = raster + (line * w); uint32 *right = left + w - 1; while ( left < right ) { uint32 temp = *left; *left = *right; *right = temp; left++, right--; } } } _TIFFfree(buf); return (ret); } /* * Get a strip-organized image with * SamplesPerPixel > 1 * PlanarConfiguration separated * We assume that all such images are RGB. */ static int gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h) { TIFF* tif = img->tif; tileSeparateRoutine put = img->put.separate; unsigned char *buf; unsigned char *p0, *p1, *p2, *pa; uint32 row, y, nrow, rowstoread; uint32 pos; tsize_t scanline; uint32 rowsperstrip, offset_row; uint32 imagewidth = img->width; tsize_t stripsize; int32 fromskew, toskew; int alpha = img->alpha; int ret = 1, flip; stripsize = TIFFStripSize(tif); p0 = buf = (unsigned char *)_TIFFmalloc((alpha?4:3)*stripsize); if (buf == 0) { TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for tile buffer"); return (0); } _TIFFmemset(buf, 0, (alpha?4:3)*stripsize); p1 = p0 + stripsize; p2 = p1 + stripsize; pa = (alpha?(p2+stripsize):NULL); flip = setorientation(img); if (flip & FLIP_VERTICALLY) { y = h - 1; toskew = -(int32)(w + w); } else { y = 0; toskew = -(int32)(w - w); } TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); scanline = TIFFScanlineSize(tif); fromskew = (w < imagewidth ? imagewidth - w : 0); for (row = 0; row < h; row += nrow) { rowstoread = rowsperstrip - (row + img->row_offset) % rowsperstrip; nrow = (row + rowstoread > h ? h - row : rowstoread); offset_row = row + img->row_offset; if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 0), p0, ((row + img->row_offset)%rowsperstrip + nrow) * scanline) < 0 && img->stoponerr) { ret = 0; break; } if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 1), p1, ((row + img->row_offset)%rowsperstrip + nrow) * scanline) < 0 && img->stoponerr) { ret = 0; break; } if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 2), p2, ((row + img->row_offset)%rowsperstrip + nrow) * scanline) < 0 && img->stoponerr) { ret = 0; break; } if (alpha) { if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 3), pa, ((row + img->row_offset)%rowsperstrip + nrow) * scanline) < 0 && img->stoponerr) { ret = 0; break; } } pos = ((row + img->row_offset) % rowsperstrip) * scanline; (*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, p0 + pos, p1 + pos, p2 + pos, (alpha?(pa+pos):NULL)); y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow); } if (flip & FLIP_HORIZONTALLY) { uint32 line; for (line = 0; line < h; line++) { uint32 *left = raster + (line * w); uint32 *right = left + w - 1; while ( left < right ) { uint32 temp = *left; *left = *right; *right = temp; left++, right--; } } } _TIFFfree(buf); return (ret); } /* * The following routines move decoded data returned * from the TIFF library into rasters filled with packed * ABGR pixels (i.e. suitable for passing to lrecwrite.) * * The routines have been created according to the most * important cases and optimized. PickContigCase and * PickSeparateCase analyze the parameters and select * the appropriate "get" and "put" routine to use. */ #define REPEAT8(op) REPEAT4(op); REPEAT4(op) #define REPEAT4(op) REPEAT2(op); REPEAT2(op) #define REPEAT2(op) op; op #define CASE8(x,op) \ switch (x) { \ case 7: op; case 6: op; case 5: op; \ case 4: op; case 3: op; case 2: op; \ case 1: op; \ } #define CASE4(x,op) switch (x) { case 3: op; case 2: op; case 1: op; } #define NOP #define UNROLL8(w, op1, op2) { \ uint32 _x; \ for (_x = w; _x >= 8; _x -= 8) { \ op1; \ REPEAT8(op2); \ } \ if (_x > 0) { \ op1; \ CASE8(_x,op2); \ } \ } #define UNROLL4(w, op1, op2) { \ uint32 _x; \ for (_x = w; _x >= 4; _x -= 4) { \ op1; \ REPEAT4(op2); \ } \ if (_x > 0) { \ op1; \ CASE4(_x,op2); \ } \ } #define UNROLL2(w, op1, op2) { \ uint32 _x; \ for (_x = w; _x >= 2; _x -= 2) { \ op1; \ REPEAT2(op2); \ } \ if (_x) { \ op1; \ op2; \ } \ } #define SKEW(r,g,b,skew) { r += skew; g += skew; b += skew; } #define SKEW4(r,g,b,a,skew) { r += skew; g += skew; b += skew; a+= skew; } #define A1 (((uint32)0xffL)<<24) #define PACK(r,g,b) \ ((uint32)(r)|((uint32)(g)<<8)|((uint32)(b)<<16)|A1) #define PACK4(r,g,b,a) \ ((uint32)(r)|((uint32)(g)<<8)|((uint32)(b)<<16)|((uint32)(a)<<24)) #define W2B(v) (((v)>>8)&0xff) #define PACKW(r,g,b) \ ((uint32)W2B(r)|((uint32)W2B(g)<<8)|((uint32)W2B(b)<<16)|A1) #define PACKW4(r,g,b,a) \ ((uint32)W2B(r)|((uint32)W2B(g)<<8)|((uint32)W2B(b)<<16)|((uint32)W2B(a)<<24)) #define DECLAREContigPutFunc(name) \ static void name(\ TIFFRGBAImage* img, \ uint32* cp, \ uint32 x, uint32 y, \ uint32 w, uint32 h, \ int32 fromskew, int32 toskew, \ unsigned char* pp \ ) /* * 8-bit palette => colormap/RGB */ DECLAREContigPutFunc(put8bitcmaptile) { uint32** PALmap = img->PALmap; int samplesperpixel = img->samplesperpixel; (void) y; while (h-- > 0) { for (x = w; x-- > 0;) { *cp++ = PALmap[*pp][0]; pp += samplesperpixel; } cp += toskew; pp += fromskew; } } /* * 4-bit palette => colormap/RGB */ DECLAREContigPutFunc(put4bitcmaptile) { uint32** PALmap = img->PALmap; (void) x; (void) y; fromskew /= 2; while (h-- > 0) { uint32* bw; UNROLL2(w, bw = PALmap[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } /* * 2-bit palette => colormap/RGB */ DECLAREContigPutFunc(put2bitcmaptile) { uint32** PALmap = img->PALmap; (void) x; (void) y; fromskew /= 4; while (h-- > 0) { uint32* bw; UNROLL4(w, bw = PALmap[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } /* * 1-bit palette => colormap/RGB */ DECLAREContigPutFunc(put1bitcmaptile) { uint32** PALmap = img->PALmap; (void) x; (void) y; fromskew /= 8; while (h-- > 0) { uint32* bw; UNROLL8(w, bw = PALmap[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } /* * 8-bit greyscale => colormap/RGB */ DECLAREContigPutFunc(putgreytile) { int samplesperpixel = img->samplesperpixel; uint32** BWmap = img->BWmap; (void) y; while (h-- > 0) { for (x = w; x-- > 0;) { *cp++ = BWmap[*pp][0]; pp += samplesperpixel; } cp += toskew; pp += fromskew; } } /* * 16-bit greyscale => colormap/RGB */ DECLAREContigPutFunc(put16bitbwtile) { int samplesperpixel = img->samplesperpixel; uint32** BWmap = img->BWmap; (void) y; while (h-- > 0) { uint16 *wp = (uint16 *) pp; for (x = w; x-- > 0;) { /* use high order byte of 16bit value */ *cp++ = BWmap[*wp >> 8][0]; pp += 2 * samplesperpixel; wp += samplesperpixel; } cp += toskew; pp += fromskew; } } /* * 1-bit bilevel => colormap/RGB */ DECLAREContigPutFunc(put1bitbwtile) { uint32** BWmap = img->BWmap; (void) x; (void) y; fromskew /= 8; while (h-- > 0) { uint32* bw; UNROLL8(w, bw = BWmap[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } /* * 2-bit greyscale => colormap/RGB */ DECLAREContigPutFunc(put2bitbwtile) { uint32** BWmap = img->BWmap; (void) x; (void) y; fromskew /= 4; while (h-- > 0) { uint32* bw; UNROLL4(w, bw = BWmap[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } /* * 4-bit greyscale => colormap/RGB */ DECLAREContigPutFunc(put4bitbwtile) { uint32** BWmap = img->BWmap; (void) x; (void) y; fromskew /= 2; while (h-- > 0) { uint32* bw; UNROLL2(w, bw = BWmap[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } /* * 8-bit packed samples, no Map => RGB */ DECLAREContigPutFunc(putRGBcontig8bittile) { int samplesperpixel = img->samplesperpixel; (void) x; (void) y; fromskew *= samplesperpixel; while (h-- > 0) { UNROLL8(w, NOP, *cp++ = PACK(pp[0], pp[1], pp[2]); pp += samplesperpixel); cp += toskew; pp += fromskew; } } /* * 8-bit packed samples => RGBA w/ associated alpha * (known to have Map == NULL) */ DECLAREContigPutFunc(putRGBAAcontig8bittile) { int samplesperpixel = img->samplesperpixel; (void) x; (void) y; fromskew *= samplesperpixel; while (h-- > 0) { UNROLL8(w, NOP, *cp++ = PACK4(pp[0], pp[1], pp[2], pp[3]); pp += samplesperpixel); cp += toskew; pp += fromskew; } } /* * 8-bit packed samples => RGBA w/ unassociated alpha * (known to have Map == NULL) */ DECLAREContigPutFunc(putRGBUAcontig8bittile) { int samplesperpixel = img->samplesperpixel; (void) y; fromskew *= samplesperpixel; while (h-- > 0) { uint32 r, g, b, a; for (x = w; x-- > 0;) { a = pp[3]; r = (a*pp[0] + 127) / 255; g = (a*pp[1] + 127) / 255; b = (a*pp[2] + 127) / 255; *cp++ = PACK4(r,g,b,a); pp += samplesperpixel; } cp += toskew; pp += fromskew; } } /* * 16-bit packed samples => RGB */ DECLAREContigPutFunc(putRGBcontig16bittile) { int samplesperpixel = img->samplesperpixel; uint16 *wp = (uint16 *)pp; (void) y; fromskew *= samplesperpixel; while (h-- > 0) { for (x = w; x-- > 0;) { *cp++ = PACKW(wp[0],wp[1],wp[2]); wp += samplesperpixel; } cp += toskew; wp += fromskew; } } /* * 16-bit packed samples => RGBA w/ associated alpha * (known to have Map == NULL) */ DECLAREContigPutFunc(putRGBAAcontig16bittile) { int samplesperpixel = img->samplesperpixel; uint16 *wp = (uint16 *)pp; (void) y; fromskew *= samplesperpixel; while (h-- > 0) { for (x = w; x-- > 0;) { *cp++ = PACKW4(wp[0],wp[1],wp[2],wp[3]); wp += samplesperpixel; } cp += toskew; wp += fromskew; } } /* * 16-bit packed samples => RGBA w/ unassociated alpha * (known to have Map == NULL) */ DECLAREContigPutFunc(putRGBUAcontig16bittile) { int samplesperpixel = img->samplesperpixel; uint16 *wp = (uint16 *)pp; (void) y; fromskew *= samplesperpixel; while (h-- > 0) { uint32 r,g,b,a; for (x = w; x-- > 0;) { a = W2B(wp[3]); r = (a*W2B(wp[0]) + 127) / 255; g = (a*W2B(wp[1]) + 127) / 255; b = (a*W2B(wp[2]) + 127) / 255; *cp++ = PACK4(r,g,b,a); wp += samplesperpixel; } cp += toskew; wp += fromskew; } } /* * 8-bit packed CMYK samples w/o Map => RGB * * NB: The conversion of CMYK->RGB is *very* crude. */ DECLAREContigPutFunc(putRGBcontig8bitCMYKtile) { int samplesperpixel = img->samplesperpixel; uint16 r, g, b, k; (void) x; (void) y; fromskew *= samplesperpixel; while (h-- > 0) { UNROLL8(w, NOP, k = 255 - pp[3]; r = (k*(255-pp[0]))/255; g = (k*(255-pp[1]))/255; b = (k*(255-pp[2]))/255; *cp++ = PACK(r, g, b); pp += samplesperpixel); cp += toskew; pp += fromskew; } } /* * 8-bit packed CMYK samples w/Map => RGB * * NB: The conversion of CMYK->RGB is *very* crude. */ DECLAREContigPutFunc(putRGBcontig8bitCMYKMaptile) { int samplesperpixel = img->samplesperpixel; TIFFRGBValue* Map = img->Map; uint16 r, g, b, k; (void) y; fromskew *= samplesperpixel; while (h-- > 0) { for (x = w; x-- > 0;) { k = 255 - pp[3]; r = (k*(255-pp[0]))/255; g = (k*(255-pp[1]))/255; b = (k*(255-pp[2]))/255; *cp++ = PACK(Map[r], Map[g], Map[b]); pp += samplesperpixel; } pp += fromskew; cp += toskew; } } #define DECLARESepPutFunc(name) \ static void name(\ TIFFRGBAImage* img,\ uint32* cp,\ uint32 x, uint32 y, \ uint32 w, uint32 h,\ int32 fromskew, int32 toskew,\ unsigned char* r, unsigned char* g, unsigned char* b, unsigned char* a\ ) /* * 8-bit unpacked samples => RGB */ DECLARESepPutFunc(putRGBseparate8bittile) { (void) img; (void) x; (void) y; (void) a; while (h-- > 0) { UNROLL8(w, NOP, *cp++ = PACK(*r++, *g++, *b++)); SKEW(r, g, b, fromskew); cp += toskew; } } /* * 8-bit unpacked samples => RGBA w/ associated alpha */ DECLARESepPutFunc(putRGBAAseparate8bittile) { (void) img; (void) x; (void) y; while (h-- > 0) { UNROLL8(w, NOP, *cp++ = PACK4(*r++, *g++, *b++, *a++)); SKEW4(r, g, b, a, fromskew); cp += toskew; } } /* * 8-bit unpacked samples => RGBA w/ unassociated alpha */ DECLARESepPutFunc(putRGBUAseparate8bittile) { (void) img; (void) y; while (h-- > 0) { uint32 rv, gv, bv, av; for (x = w; x-- > 0;) { av = *a++; rv = (av* *r++ + 127) / 255; gv = (av* *g++ + 127) / 255; bv = (av* *b++ + 127) / 255; *cp++ = PACK4(rv,gv,bv,av); } SKEW4(r, g, b, a, fromskew); cp += toskew; } } /* * 16-bit unpacked samples => RGB */ DECLARESepPutFunc(putRGBseparate16bittile) { uint16 *wr = (uint16*) r; uint16 *wg = (uint16*) g; uint16 *wb = (uint16*) b; (void) img; (void) y; (void) a; while (h-- > 0) { for (x = 0; x < w; x++) *cp++ = PACKW(*wr++,*wg++,*wb++); SKEW(wr, wg, wb, fromskew); cp += toskew; } } /* * 16-bit unpacked samples => RGBA w/ associated alpha */ DECLARESepPutFunc(putRGBAAseparate16bittile) { uint16 *wr = (uint16*) r; uint16 *wg = (uint16*) g; uint16 *wb = (uint16*) b; uint16 *wa = (uint16*) a; (void) img; (void) y; while (h-- > 0) { for (x = 0; x < w; x++) *cp++ = PACKW4(*wr++,*wg++,*wb++,*wa++); SKEW4(wr, wg, wb, wa, fromskew); cp += toskew; } } /* * 16-bit unpacked samples => RGBA w/ unassociated alpha */ DECLARESepPutFunc(putRGBUAseparate16bittile) { uint16 *wr = (uint16*) r; uint16 *wg = (uint16*) g; uint16 *wb = (uint16*) b; uint16 *wa = (uint16*) a; (void) img; (void) y; while (h-- > 0) { uint32 r,g,b,a; for (x = w; x-- > 0;) { a = W2B(*wa++); r = (a*W2B(*wr++) + 127) / 255; g = (a*W2B(*wg++) + 127) / 255; b = (a*W2B(*wb++) + 127) / 255; *cp++ = PACK4(r,g,b,a); } SKEW4(wr, wg, wb, wa, fromskew); cp += toskew; } } /* * 8-bit packed CIE L*a*b 1976 samples => RGB */ DECLAREContigPutFunc(putcontig8bitCIELab) { float X, Y, Z; uint32 r, g, b; (void) y; fromskew *= 3; while (h-- > 0) { for (x = w; x-- > 0;) { TIFFCIELabToXYZ(img->cielab, (unsigned char)pp[0], (signed char)pp[1], (signed char)pp[2], &X, &Y, &Z); TIFFXYZToRGB(img->cielab, X, Y, Z, &r, &g, &b); *cp++ = PACK(r, g, b); pp += 3; } cp += toskew; pp += fromskew; } } /* * YCbCr -> RGB conversion and packing routines. */ #define YCbCrtoRGB(dst, Y) { \ uint32 r, g, b; \ TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b); \ dst = PACK(r, g, b); \ } /* * 8-bit packed YCbCr samples => RGB * This function is generic for different sampling sizes, * and can handle blocks sizes that aren't multiples of the * sampling size. However, it is substantially less optimized * than the specific sampling cases. It is used as a fallback * for difficult blocks. */ #ifdef notdef static void putcontig8bitYCbCrGenericTile( TIFFRGBAImage* img, uint32* cp, uint32 x, uint32 y, uint32 w, uint32 h, int32 fromskew, int32 toskew, unsigned char* pp, int h_group, int v_group ) { uint32* cp1 = cp+w+toskew; uint32* cp2 = cp1+w+toskew; uint32* cp3 = cp2+w+toskew; int32 incr = 3*w+4*toskew; int32 Cb, Cr; int group_size = v_group * h_group + 2; (void) y; fromskew = (fromskew * group_size) / h_group; for( yy = 0; yy < h; yy++ ) { unsigned char *pp_line; int y_line_group = yy / v_group; int y_remainder = yy - y_line_group * v_group; pp_line = pp + v_line_group * for( xx = 0; xx < w; xx++ ) { Cb = pp } } for (; h >= 4; h -= 4) { x = w>>2; do { Cb = pp[16]; Cr = pp[17]; YCbCrtoRGB(cp [0], pp[ 0]); YCbCrtoRGB(cp [1], pp[ 1]); YCbCrtoRGB(cp [2], pp[ 2]); YCbCrtoRGB(cp [3], pp[ 3]); YCbCrtoRGB(cp1[0], pp[ 4]); YCbCrtoRGB(cp1[1], pp[ 5]); YCbCrtoRGB(cp1[2], pp[ 6]); YCbCrtoRGB(cp1[3], pp[ 7]); YCbCrtoRGB(cp2[0], pp[ 8]); YCbCrtoRGB(cp2[1], pp[ 9]); YCbCrtoRGB(cp2[2], pp[10]); YCbCrtoRGB(cp2[3], pp[11]); YCbCrtoRGB(cp3[0], pp[12]); YCbCrtoRGB(cp3[1], pp[13]); YCbCrtoRGB(cp3[2], pp[14]); YCbCrtoRGB(cp3[3], pp[15]); cp += 4, cp1 += 4, cp2 += 4, cp3 += 4; pp += 18; } while (--x); cp += incr, cp1 += incr, cp2 += incr, cp3 += incr; pp += fromskew; } } #endif /* * 8-bit packed YCbCr samples w/ 4,4 subsampling => RGB */ DECLAREContigPutFunc(putcontig8bitYCbCr44tile) { uint32* cp1 = cp+w+toskew; uint32* cp2 = cp1+w+toskew; uint32* cp3 = cp2+w+toskew; int32 incr = 3*w+4*toskew; (void) y; /* adjust fromskew */ fromskew = (fromskew * 18) / 4; if ((h & 3) == 0 && (w & 3) == 0) { for (; h >= 4; h -= 4) { x = w>>2; do { int32 Cb = pp[16]; int32 Cr = pp[17]; YCbCrtoRGB(cp [0], pp[ 0]); YCbCrtoRGB(cp [1], pp[ 1]); YCbCrtoRGB(cp [2], pp[ 2]); YCbCrtoRGB(cp [3], pp[ 3]); YCbCrtoRGB(cp1[0], pp[ 4]); YCbCrtoRGB(cp1[1], pp[ 5]); YCbCrtoRGB(cp1[2], pp[ 6]); YCbCrtoRGB(cp1[3], pp[ 7]); YCbCrtoRGB(cp2[0], pp[ 8]); YCbCrtoRGB(cp2[1], pp[ 9]); YCbCrtoRGB(cp2[2], pp[10]); YCbCrtoRGB(cp2[3], pp[11]); YCbCrtoRGB(cp3[0], pp[12]); YCbCrtoRGB(cp3[1], pp[13]); YCbCrtoRGB(cp3[2], pp[14]); YCbCrtoRGB(cp3[3], pp[15]); cp += 4, cp1 += 4, cp2 += 4, cp3 += 4; pp += 18; } while (--x); cp += incr, cp1 += incr, cp2 += incr, cp3 += incr; pp += fromskew; } } else { while (h > 0) { for (x = w; x > 0;) { int32 Cb = pp[16]; int32 Cr = pp[17]; switch (x) { default: switch (h) { default: YCbCrtoRGB(cp3[3], pp[15]); /* FALLTHROUGH */ case 3: YCbCrtoRGB(cp2[3], pp[11]); /* FALLTHROUGH */ case 2: YCbCrtoRGB(cp1[3], pp[ 7]); /* FALLTHROUGH */ case 1: YCbCrtoRGB(cp [3], pp[ 3]); /* FALLTHROUGH */ } /* FALLTHROUGH */ case 3: switch (h) { default: YCbCrtoRGB(cp3[2], pp[14]); /* FALLTHROUGH */ case 3: YCbCrtoRGB(cp2[2], pp[10]); /* FALLTHROUGH */ case 2: YCbCrtoRGB(cp1[2], pp[ 6]); /* FALLTHROUGH */ case 1: YCbCrtoRGB(cp [2], pp[ 2]); /* FALLTHROUGH */ } /* FALLTHROUGH */ case 2: switch (h) { default: YCbCrtoRGB(cp3[1], pp[13]); /* FALLTHROUGH */ case 3: YCbCrtoRGB(cp2[1], pp[ 9]); /* FALLTHROUGH */ case 2: YCbCrtoRGB(cp1[1], pp[ 5]); /* FALLTHROUGH */ case 1: YCbCrtoRGB(cp [1], pp[ 1]); /* FALLTHROUGH */ } /* FALLTHROUGH */ case 1: switch (h) { default: YCbCrtoRGB(cp3[0], pp[12]); /* FALLTHROUGH */ case 3: YCbCrtoRGB(cp2[0], pp[ 8]); /* FALLTHROUGH */ case 2: YCbCrtoRGB(cp1[0], pp[ 4]); /* FALLTHROUGH */ case 1: YCbCrtoRGB(cp [0], pp[ 0]); /* FALLTHROUGH */ } /* FALLTHROUGH */ } if (x < 4) { cp += x; cp1 += x; cp2 += x; cp3 += x; x = 0; } else { cp += 4; cp1 += 4; cp2 += 4; cp3 += 4; x -= 4; } pp += 18; } if (h <= 4) break; h -= 4; cp += incr, cp1 += incr, cp2 += incr, cp3 += incr; pp += fromskew; } } } /* * 8-bit packed YCbCr samples w/ 4,2 subsampling => RGB */ DECLAREContigPutFunc(putcontig8bitYCbCr42tile) { uint32* cp1 = cp+w+toskew; int32 incr = 2*toskew+w; (void) y; fromskew = (fromskew * 10) / 4; if ((h & 3) == 0 && (w & 1) == 0) { for (; h >= 2; h -= 2) { x = w>>2; do { int32 Cb = pp[8]; int32 Cr = pp[9]; YCbCrtoRGB(cp [0], pp[0]); YCbCrtoRGB(cp [1], pp[1]); YCbCrtoRGB(cp [2], pp[2]); YCbCrtoRGB(cp [3], pp[3]); YCbCrtoRGB(cp1[0], pp[4]); YCbCrtoRGB(cp1[1], pp[5]); YCbCrtoRGB(cp1[2], pp[6]); YCbCrtoRGB(cp1[3], pp[7]); cp += 4, cp1 += 4; pp += 10; } while (--x); cp += incr, cp1 += incr; pp += fromskew; } } else { while (h > 0) { for (x = w; x > 0;) { int32 Cb = pp[8]; int32 Cr = pp[9]; switch (x) { default: switch (h) { default: YCbCrtoRGB(cp1[3], pp[ 7]); /* FALLTHROUGH */ case 1: YCbCrtoRGB(cp [3], pp[ 3]); /* FALLTHROUGH */ } /* FALLTHROUGH */ case 3: switch (h) { default: YCbCrtoRGB(cp1[2], pp[ 6]); /* FALLTHROUGH */ case 1: YCbCrtoRGB(cp [2], pp[ 2]); /* FALLTHROUGH */ } /* FALLTHROUGH */ case 2: switch (h) { default: YCbCrtoRGB(cp1[1], pp[ 5]); /* FALLTHROUGH */ case 1: YCbCrtoRGB(cp [1], pp[ 1]); /* FALLTHROUGH */ } /* FALLTHROUGH */ case 1: switch (h) { default: YCbCrtoRGB(cp1[0], pp[ 4]); /* FALLTHROUGH */ case 1: YCbCrtoRGB(cp [0], pp[ 0]); /* FALLTHROUGH */ } /* FALLTHROUGH */ } if (x < 4) { cp += x; cp1 += x; x = 0; } else { cp += 4; cp1 += 4; x -= 4; } pp += 10; } if (h <= 2) break; h -= 2; cp += incr, cp1 += incr; pp += fromskew; } } } /* * 8-bit packed YCbCr samples w/ 4,1 subsampling => RGB */ DECLAREContigPutFunc(putcontig8bitYCbCr41tile) { (void) y; /* XXX adjust fromskew */ do { x = w>>2; do { int32 Cb = pp[4]; int32 Cr = pp[5]; YCbCrtoRGB(cp [0], pp[0]); YCbCrtoRGB(cp [1], pp[1]); YCbCrtoRGB(cp [2], pp[2]); YCbCrtoRGB(cp [3], pp[3]); cp += 4; pp += 6; } while (--x); if( (w&3) != 0 ) { int32 Cb = pp[4]; int32 Cr = pp[5]; switch( (w&3) ) { case 3: YCbCrtoRGB(cp [2], pp[2]); case 2: YCbCrtoRGB(cp [1], pp[1]); case 1: YCbCrtoRGB(cp [0], pp[0]); case 0: break; } cp += (w&3); pp += 6; } cp += toskew; pp += fromskew; } while (--h); } /* * 8-bit packed YCbCr samples w/ 2,2 subsampling => RGB */ DECLAREContigPutFunc(putcontig8bitYCbCr22tile) { uint32* cp2; (void) y; fromskew = (fromskew / 2) * 6; cp2 = cp+w+toskew; while (h>=2) { x = w; while (x>=2) { uint32 Cb = pp[4]; uint32 Cr = pp[5]; YCbCrtoRGB(cp[0], pp[0]); YCbCrtoRGB(cp[1], pp[1]); YCbCrtoRGB(cp2[0], pp[2]); YCbCrtoRGB(cp2[1], pp[3]); cp += 2; cp2 += 2; pp += 6; x -= 2; } if (x==1) { uint32 Cb = pp[4]; uint32 Cr = pp[5]; YCbCrtoRGB(cp[0], pp[0]); YCbCrtoRGB(cp2[0], pp[2]); cp ++ ; cp2 ++ ; pp += 6; } cp += toskew*2+w; cp2 += toskew*2+w; pp += fromskew; h-=2; } if (h==1) { x = w; while (x>=2) { uint32 Cb = pp[4]; uint32 Cr = pp[5]; YCbCrtoRGB(cp[0], pp[0]); YCbCrtoRGB(cp[1], pp[1]); cp += 2; cp2 += 2; pp += 6; x -= 2; } if (x==1) { uint32 Cb = pp[4]; uint32 Cr = pp[5]; YCbCrtoRGB(cp[0], pp[0]); } } } /* * 8-bit packed YCbCr samples w/ 2,1 subsampling => RGB */ DECLAREContigPutFunc(putcontig8bitYCbCr21tile) { (void) y; fromskew = (fromskew * 4) / 2; do { x = w>>1; do { int32 Cb = pp[2]; int32 Cr = pp[3]; YCbCrtoRGB(cp[0], pp[0]); YCbCrtoRGB(cp[1], pp[1]); cp += 2; pp += 4; } while (--x); if( (w&1) != 0 ) { int32 Cb = pp[2]; int32 Cr = pp[3]; YCbCrtoRGB(cp[0], pp[0]); cp += 1; pp += 4; } cp += toskew; pp += fromskew; } while (--h); } /* * 8-bit packed YCbCr samples w/ 1,2 subsampling => RGB */ DECLAREContigPutFunc(putcontig8bitYCbCr12tile) { uint32* cp2; (void) y; fromskew = (fromskew / 2) * 4; cp2 = cp+w+toskew; while (h>=2) { x = w; do { uint32 Cb = pp[2]; uint32 Cr = pp[3]; YCbCrtoRGB(cp[0], pp[0]); YCbCrtoRGB(cp2[0], pp[1]); cp ++; cp2 ++; pp += 4; } while (--x); cp += toskew*2+w; cp2 += toskew*2+w; pp += fromskew; h-=2; } if (h==1) { x = w; do { uint32 Cb = pp[2]; uint32 Cr = pp[3]; YCbCrtoRGB(cp[0], pp[0]); cp ++; pp += 4; } while (--x); } } /* * 8-bit packed YCbCr samples w/ no subsampling => RGB */ DECLAREContigPutFunc(putcontig8bitYCbCr11tile) { (void) y; fromskew *= 3; do { x = w; /* was x = w>>1; patched 2000/09/25 warmerda@home.com */ do { int32 Cb = pp[1]; int32 Cr = pp[2]; YCbCrtoRGB(*cp++, pp[0]); pp += 3; } while (--x); cp += toskew; pp += fromskew; } while (--h); } /* * 8-bit packed YCbCr samples w/ no subsampling => RGB */ DECLARESepPutFunc(putseparate8bitYCbCr11tile) { (void) y; (void) a; /* TODO: naming of input vars is still off, change obfuscating declaration inside define, or resolve obfuscation */ while (h-- > 0) { x = w; do { uint32 dr, dg, db; TIFFYCbCrtoRGB(img->ycbcr,*r++,*g++,*b++,&dr,&dg,&db); *cp++ = PACK(dr,dg,db); } while (--x); SKEW(r, g, b, fromskew); cp += toskew; } } #undef YCbCrtoRGB static int initYCbCrConversion(TIFFRGBAImage* img) { static char module[] = "initYCbCrConversion"; float *luma, *refBlackWhite; if (img->ycbcr == NULL) { img->ycbcr = (TIFFYCbCrToRGB*) _TIFFmalloc( TIFFroundup(sizeof (TIFFYCbCrToRGB), sizeof (long)) + 4*256*sizeof (TIFFRGBValue) + 2*256*sizeof (int) + 3*256*sizeof (int32) ); if (img->ycbcr == NULL) { TIFFErrorExt(img->tif->tif_clientdata, module, "No space for YCbCr->RGB conversion state"); return (0); } } TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRCOEFFICIENTS, &luma); TIFFGetFieldDefaulted(img->tif, TIFFTAG_REFERENCEBLACKWHITE, &refBlackWhite); if (TIFFYCbCrToRGBInit(img->ycbcr, luma, refBlackWhite) < 0) return(0); return (1); } static tileContigRoutine initCIELabConversion(TIFFRGBAImage* img) { static char module[] = "initCIELabConversion"; float *whitePoint; float refWhite[3]; if (!img->cielab) { img->cielab = (TIFFCIELabToRGB *) _TIFFmalloc(sizeof(TIFFCIELabToRGB)); if (!img->cielab) { TIFFErrorExt(img->tif->tif_clientdata, module, "No space for CIE L*a*b*->RGB conversion state."); return NULL; } } TIFFGetFieldDefaulted(img->tif, TIFFTAG_WHITEPOINT, &whitePoint); refWhite[1] = 100.0F; refWhite[0] = whitePoint[0] / whitePoint[1] * refWhite[1]; refWhite[2] = (1.0F - whitePoint[0] - whitePoint[1]) / whitePoint[1] * refWhite[1]; if (TIFFCIELabToRGBInit(img->cielab, &display_sRGB, refWhite) < 0) { TIFFErrorExt(img->tif->tif_clientdata, module, "Failed to initialize CIE L*a*b*->RGB conversion state."); _TIFFfree(img->cielab); return NULL; } return putcontig8bitCIELab; } /* * Greyscale images with less than 8 bits/sample are handled * with a table to avoid lots of shifts and masks. The table * is setup so that put*bwtile (below) can retrieve 8/bitspersample * pixel values simply by indexing into the table with one * number. */ static int makebwmap(TIFFRGBAImage* img) { TIFFRGBValue* Map = img->Map; int bitspersample = img->bitspersample; int nsamples = 8 / bitspersample; int i; uint32* p; if( nsamples == 0 ) nsamples = 1; img->BWmap = (uint32**) _TIFFmalloc( 256*sizeof (uint32 *)+(256*nsamples*sizeof(uint32))); if (img->BWmap == NULL) { TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), "No space for B&W mapping table"); return (0); } p = (uint32*)(img->BWmap + 256); for (i = 0; i < 256; i++) { TIFFRGBValue c; img->BWmap[i] = p; switch (bitspersample) { #define GREY(x) c = Map[x]; *p++ = PACK(c,c,c); case 1: GREY(i>>7); GREY((i>>6)&1); GREY((i>>5)&1); GREY((i>>4)&1); GREY((i>>3)&1); GREY((i>>2)&1); GREY((i>>1)&1); GREY(i&1); break; case 2: GREY(i>>6); GREY((i>>4)&3); GREY((i>>2)&3); GREY(i&3); break; case 4: GREY(i>>4); GREY(i&0xf); break; case 8: case 16: GREY(i); break; } #undef GREY } return (1); } /* * Construct a mapping table to convert from the range * of the data samples to [0,255] --for display. This * process also handles inverting B&W images when needed. */ static int setupMap(TIFFRGBAImage* img) { int32 x, range; range = (int32)((1L<<img->bitspersample)-1); /* treat 16 bit the same as eight bit */ if( img->bitspersample == 16 ) range = (int32) 255; img->Map = (TIFFRGBValue*) _TIFFmalloc((range+1) * sizeof (TIFFRGBValue)); if (img->Map == NULL) { TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), "No space for photometric conversion table"); return (0); } if (img->photometric == PHOTOMETRIC_MINISWHITE) { for (x = 0; x <= range; x++) img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range); } else { for (x = 0; x <= range; x++) img->Map[x] = (TIFFRGBValue) ((x * 255) / range); } if (img->bitspersample <= 16 && (img->photometric == PHOTOMETRIC_MINISBLACK || img->photometric == PHOTOMETRIC_MINISWHITE)) { /* * Use photometric mapping table to construct * unpacking tables for samples <= 8 bits. */ if (!makebwmap(img)) return (0); /* no longer need Map, free it */ _TIFFfree(img->Map), img->Map = NULL; } return (1); } static int checkcmap(TIFFRGBAImage* img) { uint16* r = img->redcmap; uint16* g = img->greencmap; uint16* b = img->bluecmap; long n = 1L<<img->bitspersample; while (n-- > 0) if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256) return (16); return (8); } static void cvtcmap(TIFFRGBAImage* img) { uint16* r = img->redcmap; uint16* g = img->greencmap; uint16* b = img->bluecmap; long i; for (i = (1L<<img->bitspersample)-1; i >= 0; i--) { #define CVT(x) ((uint16)((x)>>8)) r[i] = CVT(r[i]); g[i] = CVT(g[i]); b[i] = CVT(b[i]); #undef CVT } } /* * Palette images with <= 8 bits/sample are handled * with a table to avoid lots of shifts and masks. The table * is setup so that put*cmaptile (below) can retrieve 8/bitspersample * pixel values simply by indexing into the table with one * number. */ static int makecmap(TIFFRGBAImage* img) { int bitspersample = img->bitspersample; int nsamples = 8 / bitspersample; uint16* r = img->redcmap; uint16* g = img->greencmap; uint16* b = img->bluecmap; uint32 *p; int i; img->PALmap = (uint32**) _TIFFmalloc( 256*sizeof (uint32 *)+(256*nsamples*sizeof(uint32))); if (img->PALmap == NULL) { TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), "No space for Palette mapping table"); return (0); } p = (uint32*)(img->PALmap + 256); for (i = 0; i < 256; i++) { TIFFRGBValue c; img->PALmap[i] = p; #define CMAP(x) c = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff); switch (bitspersample) { case 1: CMAP(i>>7); CMAP((i>>6)&1); CMAP((i>>5)&1); CMAP((i>>4)&1); CMAP((i>>3)&1); CMAP((i>>2)&1); CMAP((i>>1)&1); CMAP(i&1); break; case 2: CMAP(i>>6); CMAP((i>>4)&3); CMAP((i>>2)&3); CMAP(i&3); break; case 4: CMAP(i>>4); CMAP(i&0xf); break; case 8: CMAP(i); break; } #undef CMAP } return (1); } /* * Construct any mapping table used * by the associated put routine. */ static int buildMap(TIFFRGBAImage* img) { switch (img->photometric) { case PHOTOMETRIC_RGB: case PHOTOMETRIC_YCBCR: case PHOTOMETRIC_SEPARATED: if (img->bitspersample == 8) break; /* fall thru... */ case PHOTOMETRIC_MINISBLACK: case PHOTOMETRIC_MINISWHITE: if (!setupMap(img)) return (0); break; case PHOTOMETRIC_PALETTE: /* * Convert 16-bit colormap to 8-bit (unless it looks * like an old-style 8-bit colormap). */ if (checkcmap(img) == 16) cvtcmap(img); else TIFFWarningExt(img->tif->tif_clientdata, TIFFFileName(img->tif), "Assuming 8-bit colormap"); /* * Use mapping table and colormap to construct * unpacking tables for samples < 8 bits. */ if (img->bitspersample <= 8 && !makecmap(img)) return (0); break; } return (1); } /* * Select the appropriate conversion routine for packed data. */ static int PickContigCase(TIFFRGBAImage* img) { img->get = TIFFIsTiled(img->tif) ? gtTileContig : gtStripContig; img->put.contig = NULL; switch (img->photometric) { case PHOTOMETRIC_RGB: switch (img->bitspersample) { case 8: if (img->alpha == EXTRASAMPLE_ASSOCALPHA) img->put.contig = putRGBAAcontig8bittile; else if (img->alpha == EXTRASAMPLE_UNASSALPHA) { img->put.contig = putRGBUAcontig8bittile; } else img->put.contig = putRGBcontig8bittile; break; case 16: if (img->alpha == EXTRASAMPLE_ASSOCALPHA) { img->put.contig = putRGBAAcontig16bittile; } else if (img->alpha == EXTRASAMPLE_UNASSALPHA) { img->put.contig = putRGBUAcontig16bittile; } else { img->put.contig = putRGBcontig16bittile; } break; } break; case PHOTOMETRIC_SEPARATED: if (buildMap(img)) { if (img->bitspersample == 8) { if (!img->Map) img->put.contig = putRGBcontig8bitCMYKtile; else img->put.contig = putRGBcontig8bitCMYKMaptile; } } break; case PHOTOMETRIC_PALETTE: if (buildMap(img)) { switch (img->bitspersample) { case 8: img->put.contig = put8bitcmaptile; break; case 4: img->put.contig = put4bitcmaptile; break; case 2: img->put.contig = put2bitcmaptile; break; case 1: img->put.contig = put1bitcmaptile; break; } } break; case PHOTOMETRIC_MINISWHITE: case PHOTOMETRIC_MINISBLACK: if (buildMap(img)) { switch (img->bitspersample) { case 16: img->put.contig = put16bitbwtile; break; case 8: img->put.contig = putgreytile; break; case 4: img->put.contig = put4bitbwtile; break; case 2: img->put.contig = put2bitbwtile; break; case 1: img->put.contig = put1bitbwtile; break; } } break; case PHOTOMETRIC_YCBCR: if (img->bitspersample == 8) { if (initYCbCrConversion(img)!=0) { /* * The 6.0 spec says that subsampling must be * one of 1, 2, or 4, and that vertical subsampling * must always be <= horizontal subsampling; so * there are only a few possibilities and we just * enumerate the cases. * Joris: added support for the [1,2] case, nonetheless, to accomodate * some OJPEG files */ uint16 SubsamplingHor; uint16 SubsamplingVer; TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRSUBSAMPLING, &SubsamplingHor, &SubsamplingVer); switch ((SubsamplingHor<<4)|SubsamplingVer) { case 0x44: img->put.contig = putcontig8bitYCbCr44tile; break; case 0x42: img->put.contig = putcontig8bitYCbCr42tile; break; case 0x41: img->put.contig = putcontig8bitYCbCr41tile; break; case 0x22: img->put.contig = putcontig8bitYCbCr22tile; break; case 0x21: img->put.contig = putcontig8bitYCbCr21tile; break; case 0x12: img->put.contig = putcontig8bitYCbCr12tile; break; case 0x11: img->put.contig = putcontig8bitYCbCr11tile; break; } } } break; case PHOTOMETRIC_CIELAB: if (buildMap(img)) { if (img->bitspersample == 8) img->put.contig = initCIELabConversion(img); break; } } return ((img->get!=NULL) && (img->put.contig!=NULL)); } /* * Select the appropriate conversion routine for unpacked data. * * NB: we assume that unpacked single channel data is directed * to the "packed routines. */ static int PickSeparateCase(TIFFRGBAImage* img) { img->get = TIFFIsTiled(img->tif) ? gtTileSeparate : gtStripSeparate; img->put.separate = NULL; switch (img->photometric) { case PHOTOMETRIC_RGB: switch (img->bitspersample) { case 8: if (img->alpha == EXTRASAMPLE_ASSOCALPHA) img->put.separate = putRGBAAseparate8bittile; else if (img->alpha == EXTRASAMPLE_UNASSALPHA) { img->put.separate = putRGBUAseparate8bittile; } else img->put.separate = putRGBseparate8bittile; break; case 16: if (img->alpha == EXTRASAMPLE_ASSOCALPHA) { img->put.separate = putRGBAAseparate16bittile; } else if (img->alpha == EXTRASAMPLE_UNASSALPHA) { img->put.separate = putRGBUAseparate16bittile; } else { img->put.separate = putRGBseparate16bittile; } break; } break; case PHOTOMETRIC_YCBCR: if ((img->bitspersample==8) && (img->samplesperpixel==3)) { if (initYCbCrConversion(img)!=0) { uint16 hs, vs; TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRSUBSAMPLING, &hs, &vs); switch ((hs<<4)|vs) { case 0x11: img->put.separate = putseparate8bitYCbCr11tile; break; /* TODO: add other cases here */ } } } break; } return ((img->get!=NULL) && (img->put.separate!=NULL)); } /* * Read a whole strip off data from the file, and convert to RGBA form. * If this is the last strip, then it will only contain the portion of * the strip that is actually within the image space. The result is * organized in bottom to top form. */ int TIFFReadRGBAStrip(TIFF* tif, uint32 row, uint32 * raster ) { char emsg[1024] = ""; TIFFRGBAImage img; int ok; uint32 rowsperstrip, rows_to_read; if( TIFFIsTiled( tif ) ) { TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Can't use TIFFReadRGBAStrip() with tiled file."); return (0); } TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); if( (row % rowsperstrip) != 0 ) { TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Row passed to TIFFReadRGBAStrip() must be first in a strip."); return (0); } if (TIFFRGBAImageOK(tif, emsg) && TIFFRGBAImageBegin(&img, tif, 0, emsg)) { img.row_offset = row; img.col_offset = 0; if( row + rowsperstrip > img.height ) rows_to_read = img.height - row; else rows_to_read = rowsperstrip; ok = TIFFRGBAImageGet(&img, raster, img.width, rows_to_read ); TIFFRGBAImageEnd(&img); } else { TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", emsg); ok = 0; } return (ok); } /* * Read a whole tile off data from the file, and convert to RGBA form. * The returned RGBA data is organized from bottom to top of tile, * and may include zeroed areas if the tile extends off the image. */ int TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster) { char emsg[1024] = ""; TIFFRGBAImage img; int ok; uint32 tile_xsize, tile_ysize; uint32 read_xsize, read_ysize; uint32 i_row; /* * Verify that our request is legal - on a tile file, and on a * tile boundary. */ if( !TIFFIsTiled( tif ) ) { TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Can't use TIFFReadRGBATile() with stripped file."); return (0); } TIFFGetFieldDefaulted(tif, TIFFTAG_TILEWIDTH, &tile_xsize); TIFFGetFieldDefaulted(tif, TIFFTAG_TILELENGTH, &tile_ysize); if( (col % tile_xsize) != 0 || (row % tile_ysize) != 0 ) { TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Row/col passed to TIFFReadRGBATile() must be top" "left corner of a tile."); return (0); } /* * Setup the RGBA reader. */ if (!TIFFRGBAImageOK(tif, emsg) || !TIFFRGBAImageBegin(&img, tif, 0, emsg)) { TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", emsg); return( 0 ); } /* * The TIFFRGBAImageGet() function doesn't allow us to get off the * edge of the image, even to fill an otherwise valid tile. So we * figure out how much we can read, and fix up the tile buffer to * a full tile configuration afterwards. */ if( row + tile_ysize > img.height ) read_ysize = img.height - row; else read_ysize = tile_ysize; if( col + tile_xsize > img.width ) read_xsize = img.width - col; else read_xsize = tile_xsize; /* * Read the chunk of imagery. */ img.row_offset = row; img.col_offset = col; ok = TIFFRGBAImageGet(&img, raster, read_xsize, read_ysize ); TIFFRGBAImageEnd(&img); /* * If our read was incomplete we will need to fix up the tile by * shifting the data around as if a full tile of data is being returned. * * This is all the more complicated because the image is organized in * bottom to top format. */ if( read_xsize == tile_xsize && read_ysize == tile_ysize ) return( ok ); for( i_row = 0; i_row < read_ysize; i_row++ ) { memmove( raster + (tile_ysize - i_row - 1) * tile_xsize, raster + (read_ysize - i_row - 1) * read_xsize, read_xsize * sizeof(uint32) ); _TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize+read_xsize, 0, sizeof(uint32) * (tile_xsize - read_xsize) ); } for( i_row = read_ysize; i_row < tile_ysize; i_row++ ) { _TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize, 0, sizeof(uint32) * tile_xsize ); } return (ok); } /* vim: set ts=8 sts=8 sw=8 noet: */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/VERSION�����������������������������������������������������0000644�0001750�0001750�00000000006�12320456500�020400� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������3.9.2 ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tiffvers.h��������������������������������������������������0000644�0001750�0001750�00000000632�12320456500�021336� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define TIFFLIB_VERSION_STR "LIBTIFF, Version 3.9.2\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc." /* * This define can be used in code that requires * compilation-related definitions specific to a * version or versions of the library. Runtime * version checking should be done based on the * string returned by TIFFGetVersion. */ #define TIFFLIB_VERSION 20091104 ������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_luv.c���������������������������������������������������0000644�0001750�0001750�00000121027�12320456500�021153� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_luv.c,v 1.17.2.3 2009-06-30 17:06:25 fwarmerdam Exp $ */ /* * Copyright (c) 1997 Greg Ward Larson * Copyright (c) 1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler, Greg Larson and Silicon Graphics may not be used in any * advertising or publicity relating to the software without the specific, * prior written permission of Sam Leffler, Greg Larson and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER, GREG LARSON OR SILICON GRAPHICS BE LIABLE * FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "tiffiop.h" #ifdef LOGLUV_SUPPORT /* * TIFF Library. * LogLuv compression support for high dynamic range images. * * Contributed by Greg Larson. * * LogLuv image support uses the TIFF library to store 16 or 10-bit * log luminance values with 8 bits each of u and v or a 14-bit index. * * The codec can take as input and produce as output 32-bit IEEE float values * as well as 16-bit integer values. A 16-bit luminance is interpreted * as a sign bit followed by a 15-bit integer that is converted * to and from a linear magnitude using the transformation: * * L = 2^( (Le+.5)/256 - 64 ) # real from 15-bit * * Le = floor( 256*(log2(L) + 64) ) # 15-bit from real * * The actual conversion to world luminance units in candelas per sq. meter * requires an additional multiplier, which is stored in the TIFFTAG_STONITS. * This value is usually set such that a reasonable exposure comes from * clamping decoded luminances above 1 to 1 in the displayed image. * * The 16-bit values for u and v may be converted to real values by dividing * each by 32768. (This allows for negative values, which aren't useful as * far as we know, but are left in case of future improvements in human * color vision.) * * Conversion from (u,v), which is actually the CIE (u',v') system for * you color scientists, is accomplished by the following transformation: * * u = 4*x / (-2*x + 12*y + 3) * v = 9*y / (-2*x + 12*y + 3) * * x = 9*u / (6*u - 16*v + 12) * y = 4*v / (6*u - 16*v + 12) * * This process is greatly simplified by passing 32-bit IEEE floats * for each of three CIE XYZ coordinates. The codec then takes care * of conversion to and from LogLuv, though the application is still * responsible for interpreting the TIFFTAG_STONITS calibration factor. * * By definition, a CIE XYZ vector of [1 1 1] corresponds to a neutral white * point of (x,y)=(1/3,1/3). However, most color systems assume some other * white point, such as D65, and an absolute color conversion to XYZ then * to another color space with a different white point may introduce an * unwanted color cast to the image. It is often desirable, therefore, to * perform a white point conversion that maps the input white to [1 1 1] * in XYZ, then record the original white point using the TIFFTAG_WHITEPOINT * tag value. A decoder that demands absolute color calibration may use * this white point tag to get back the original colors, but usually it * will be ignored and the new white point will be used instead that * matches the output color space. * * Pixel information is compressed into one of two basic encodings, depending * on the setting of the compression tag, which is one of COMPRESSION_SGILOG * or COMPRESSION_SGILOG24. For COMPRESSION_SGILOG, greyscale data is * stored as: * * 1 15 * |-+---------------| * * COMPRESSION_SGILOG color data is stored as: * * 1 15 8 8 * |-+---------------|--------+--------| * S Le ue ve * * For the 24-bit COMPRESSION_SGILOG24 color format, the data is stored as: * * 10 14 * |----------|--------------| * Le' Ce * * There is no sign bit in the 24-bit case, and the (u,v) chromaticity is * encoded as an index for optimal color resolution. The 10 log bits are * defined by the following conversions: * * L = 2^((Le'+.5)/64 - 12) # real from 10-bit * * Le' = floor( 64*(log2(L) + 12) ) # 10-bit from real * * The 10 bits of the smaller format may be converted into the 15 bits of * the larger format by multiplying by 4 and adding 13314. Obviously, * a smaller range of magnitudes is covered (about 5 orders of magnitude * instead of 38), and the lack of a sign bit means that negative luminances * are not allowed. (Well, they aren't allowed in the real world, either, * but they are useful for certain types of image processing.) * * The desired user format is controlled by the setting the internal * pseudo tag TIFFTAG_SGILOGDATAFMT to one of: * SGILOGDATAFMT_FLOAT = IEEE 32-bit float XYZ values * SGILOGDATAFMT_16BIT = 16-bit integer encodings of logL, u and v * Raw data i/o is also possible using: * SGILOGDATAFMT_RAW = 32-bit unsigned integer with encoded pixel * In addition, the following decoding is provided for ease of display: * SGILOGDATAFMT_8BIT = 8-bit default RGB gamma-corrected values * * For grayscale images, we provide the following data formats: * SGILOGDATAFMT_FLOAT = IEEE 32-bit float Y values * SGILOGDATAFMT_16BIT = 16-bit integer w/ encoded luminance * SGILOGDATAFMT_8BIT = 8-bit gray monitor values * * Note that the COMPRESSION_SGILOG applies a simple run-length encoding * scheme by separating the logL, u and v bytes for each row and applying * a PackBits type of compression. Since the 24-bit encoding is not * adaptive, the 32-bit color format takes less space in many cases. * * Further control is provided over the conversion from higher-resolution * formats to final encoded values through the pseudo tag * TIFFTAG_SGILOGENCODE: * SGILOGENCODE_NODITHER = do not dither encoded values * SGILOGENCODE_RANDITHER = apply random dithering during encoding * * The default value of this tag is SGILOGENCODE_NODITHER for * COMPRESSION_SGILOG to maximize run-length encoding and * SGILOGENCODE_RANDITHER for COMPRESSION_SGILOG24 to turn * quantization errors into noise. */ #include <stdio.h> #include <stdlib.h> #include <math.h> /* * State block for each open TIFF * file using LogLuv compression/decompression. */ typedef struct logLuvState LogLuvState; struct logLuvState { int user_datafmt; /* user data format */ int encode_meth; /* encoding method */ int pixel_size; /* bytes per pixel */ tidata_t* tbuf; /* translation buffer */ int tbuflen; /* buffer length */ void (*tfunc)(LogLuvState*, tidata_t, int); TIFFVSetMethod vgetparent; /* super-class method */ TIFFVSetMethod vsetparent; /* super-class method */ }; #define DecoderState(tif) ((LogLuvState*) (tif)->tif_data) #define EncoderState(tif) ((LogLuvState*) (tif)->tif_data) #define SGILOGDATAFMT_UNKNOWN -1 #define MINRUN 4 /* minimum run length */ /* * Decode a string of 16-bit gray pixels. */ static int LogL16Decode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s) { LogLuvState* sp = DecoderState(tif); int shft, i, npixels; unsigned char* bp; int16* tp; int16 b; int cc, rc; assert(s == 0); assert(sp != NULL); npixels = occ / sp->pixel_size; if (sp->user_datafmt == SGILOGDATAFMT_16BIT) tp = (int16*) op; else { assert(sp->tbuflen >= npixels); tp = (int16*) sp->tbuf; } _TIFFmemset((tdata_t) tp, 0, npixels*sizeof (tp[0])); bp = (unsigned char*) tif->tif_rawcp; cc = tif->tif_rawcc; /* get each byte string */ for (shft = 2*8; (shft -= 8) >= 0; ) { for (i = 0; i < npixels && cc > 0; ) if (*bp >= 128) { /* run */ rc = *bp++ + (2-128); b = (int16)(*bp++ << shft); cc -= 2; while (rc-- && i < npixels) tp[i++] |= b; } else { /* non-run */ rc = *bp++; /* nul is noop */ while (--cc && rc-- && i < npixels) tp[i++] |= (int16)*bp++ << shft; } if (i != npixels) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "LogL16Decode: Not enough data at row %d (short %d pixels)", tif->tif_row, npixels - i); tif->tif_rawcp = (tidata_t) bp; tif->tif_rawcc = cc; return (0); } } (*sp->tfunc)(sp, op, npixels); tif->tif_rawcp = (tidata_t) bp; tif->tif_rawcc = cc; return (1); } /* * Decode a string of 24-bit pixels. */ static int LogLuvDecode24(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s) { LogLuvState* sp = DecoderState(tif); int cc, i, npixels; unsigned char* bp; uint32* tp; assert(s == 0); assert(sp != NULL); npixels = occ / sp->pixel_size; if (sp->user_datafmt == SGILOGDATAFMT_RAW) tp = (uint32 *)op; else { assert(sp->tbuflen >= npixels); tp = (uint32 *) sp->tbuf; } /* copy to array of uint32 */ bp = (unsigned char*) tif->tif_rawcp; cc = tif->tif_rawcc; for (i = 0; i < npixels && cc > 0; i++) { tp[i] = bp[0] << 16 | bp[1] << 8 | bp[2]; bp += 3; cc -= 3; } tif->tif_rawcp = (tidata_t) bp; tif->tif_rawcc = cc; if (i != npixels) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "LogLuvDecode24: Not enough data at row %d (short %d pixels)", tif->tif_row, npixels - i); return (0); } (*sp->tfunc)(sp, op, npixels); return (1); } /* * Decode a string of 32-bit pixels. */ static int LogLuvDecode32(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s) { LogLuvState* sp; int shft, i, npixels; unsigned char* bp; uint32* tp; uint32 b; int cc, rc; assert(s == 0); sp = DecoderState(tif); assert(sp != NULL); npixels = occ / sp->pixel_size; if (sp->user_datafmt == SGILOGDATAFMT_RAW) tp = (uint32*) op; else { assert(sp->tbuflen >= npixels); tp = (uint32*) sp->tbuf; } _TIFFmemset((tdata_t) tp, 0, npixels*sizeof (tp[0])); bp = (unsigned char*) tif->tif_rawcp; cc = tif->tif_rawcc; /* get each byte string */ for (shft = 4*8; (shft -= 8) >= 0; ) { for (i = 0; i < npixels && cc > 0; ) if (*bp >= 128) { /* run */ rc = *bp++ + (2-128); b = (uint32)*bp++ << shft; cc -= 2; while (rc-- && i < npixels) tp[i++] |= b; } else { /* non-run */ rc = *bp++; /* nul is noop */ while (--cc && rc-- && i < npixels) tp[i++] |= (uint32)*bp++ << shft; } if (i != npixels) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "LogLuvDecode32: Not enough data at row %d (short %d pixels)", tif->tif_row, npixels - i); tif->tif_rawcp = (tidata_t) bp; tif->tif_rawcc = cc; return (0); } } (*sp->tfunc)(sp, op, npixels); tif->tif_rawcp = (tidata_t) bp; tif->tif_rawcc = cc; return (1); } /* * Decode a strip of pixels. We break it into rows to * maintain synchrony with the encode algorithm, which * is row by row. */ static int LogLuvDecodeStrip(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) { tsize_t rowlen = TIFFScanlineSize(tif); assert(cc%rowlen == 0); while (cc && (*tif->tif_decoderow)(tif, bp, rowlen, s)) bp += rowlen, cc -= rowlen; return (cc == 0); } /* * Decode a tile of pixels. We break it into rows to * maintain synchrony with the encode algorithm, which * is row by row. */ static int LogLuvDecodeTile(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) { tsize_t rowlen = TIFFTileRowSize(tif); assert(cc%rowlen == 0); while (cc && (*tif->tif_decoderow)(tif, bp, rowlen, s)) bp += rowlen, cc -= rowlen; return (cc == 0); } /* * Encode a row of 16-bit pixels. */ static int LogL16Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) { LogLuvState* sp = EncoderState(tif); int shft, i, j, npixels; tidata_t op; int16* tp; int16 b; int occ, rc=0, mask, beg; assert(s == 0); assert(sp != NULL); npixels = cc / sp->pixel_size; if (sp->user_datafmt == SGILOGDATAFMT_16BIT) tp = (int16*) bp; else { tp = (int16*) sp->tbuf; assert(sp->tbuflen >= npixels); (*sp->tfunc)(sp, bp, npixels); } /* compress each byte string */ op = tif->tif_rawcp; occ = tif->tif_rawdatasize - tif->tif_rawcc; for (shft = 2*8; (shft -= 8) >= 0; ) for (i = 0; i < npixels; i += rc) { if (occ < 4) { tif->tif_rawcp = op; tif->tif_rawcc = tif->tif_rawdatasize - occ; if (!TIFFFlushData1(tif)) return (-1); op = tif->tif_rawcp; occ = tif->tif_rawdatasize - tif->tif_rawcc; } mask = 0xff << shft; /* find next run */ for (beg = i; beg < npixels; beg += rc) { b = (int16) (tp[beg] & mask); rc = 1; while (rc < 127+2 && beg+rc < npixels && (tp[beg+rc] & mask) == b) rc++; if (rc >= MINRUN) break; /* long enough */ } if (beg-i > 1 && beg-i < MINRUN) { b = (int16) (tp[i] & mask);/*check short run */ j = i+1; while ((tp[j++] & mask) == b) if (j == beg) { *op++ = (tidataval_t)(128-2+j-i); *op++ = (tidataval_t) (b >> shft); occ -= 2; i = beg; break; } } while (i < beg) { /* write out non-run */ if ((j = beg-i) > 127) j = 127; if (occ < j+3) { tif->tif_rawcp = op; tif->tif_rawcc = tif->tif_rawdatasize - occ; if (!TIFFFlushData1(tif)) return (-1); op = tif->tif_rawcp; occ = tif->tif_rawdatasize - tif->tif_rawcc; } *op++ = (tidataval_t) j; occ--; while (j--) { *op++ = (tidataval_t) (tp[i++] >> shft & 0xff); occ--; } } if (rc >= MINRUN) { /* write out run */ *op++ = (tidataval_t) (128-2+rc); *op++ = (tidataval_t) (tp[beg] >> shft & 0xff); occ -= 2; } else rc = 0; } tif->tif_rawcp = op; tif->tif_rawcc = tif->tif_rawdatasize - occ; return (1); } /* * Encode a row of 24-bit pixels. */ static int LogLuvEncode24(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) { LogLuvState* sp = EncoderState(tif); int i, npixels, occ; tidata_t op; uint32* tp; assert(s == 0); assert(sp != NULL); npixels = cc / sp->pixel_size; if (sp->user_datafmt == SGILOGDATAFMT_RAW) tp = (uint32*) bp; else { tp = (uint32*) sp->tbuf; assert(sp->tbuflen >= npixels); (*sp->tfunc)(sp, bp, npixels); } /* write out encoded pixels */ op = tif->tif_rawcp; occ = tif->tif_rawdatasize - tif->tif_rawcc; for (i = npixels; i--; ) { if (occ < 3) { tif->tif_rawcp = op; tif->tif_rawcc = tif->tif_rawdatasize - occ; if (!TIFFFlushData1(tif)) return (-1); op = tif->tif_rawcp; occ = tif->tif_rawdatasize - tif->tif_rawcc; } *op++ = (tidataval_t)(*tp >> 16); *op++ = (tidataval_t)(*tp >> 8 & 0xff); *op++ = (tidataval_t)(*tp++ & 0xff); occ -= 3; } tif->tif_rawcp = op; tif->tif_rawcc = tif->tif_rawdatasize - occ; return (1); } /* * Encode a row of 32-bit pixels. */ static int LogLuvEncode32(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) { LogLuvState* sp = EncoderState(tif); int shft, i, j, npixels; tidata_t op; uint32* tp; uint32 b; int occ, rc=0, mask, beg; assert(s == 0); assert(sp != NULL); npixels = cc / sp->pixel_size; if (sp->user_datafmt == SGILOGDATAFMT_RAW) tp = (uint32*) bp; else { tp = (uint32*) sp->tbuf; assert(sp->tbuflen >= npixels); (*sp->tfunc)(sp, bp, npixels); } /* compress each byte string */ op = tif->tif_rawcp; occ = tif->tif_rawdatasize - tif->tif_rawcc; for (shft = 4*8; (shft -= 8) >= 0; ) for (i = 0; i < npixels; i += rc) { if (occ < 4) { tif->tif_rawcp = op; tif->tif_rawcc = tif->tif_rawdatasize - occ; if (!TIFFFlushData1(tif)) return (-1); op = tif->tif_rawcp; occ = tif->tif_rawdatasize - tif->tif_rawcc; } mask = 0xff << shft; /* find next run */ for (beg = i; beg < npixels; beg += rc) { b = tp[beg] & mask; rc = 1; while (rc < 127+2 && beg+rc < npixels && (tp[beg+rc] & mask) == b) rc++; if (rc >= MINRUN) break; /* long enough */ } if (beg-i > 1 && beg-i < MINRUN) { b = tp[i] & mask; /* check short run */ j = i+1; while ((tp[j++] & mask) == b) if (j == beg) { *op++ = (tidataval_t)(128-2+j-i); *op++ = (tidataval_t)(b >> shft); occ -= 2; i = beg; break; } } while (i < beg) { /* write out non-run */ if ((j = beg-i) > 127) j = 127; if (occ < j+3) { tif->tif_rawcp = op; tif->tif_rawcc = tif->tif_rawdatasize - occ; if (!TIFFFlushData1(tif)) return (-1); op = tif->tif_rawcp; occ = tif->tif_rawdatasize - tif->tif_rawcc; } *op++ = (tidataval_t) j; occ--; while (j--) { *op++ = (tidataval_t)(tp[i++] >> shft & 0xff); occ--; } } if (rc >= MINRUN) { /* write out run */ *op++ = (tidataval_t) (128-2+rc); *op++ = (tidataval_t)(tp[beg] >> shft & 0xff); occ -= 2; } else rc = 0; } tif->tif_rawcp = op; tif->tif_rawcc = tif->tif_rawdatasize - occ; return (1); } /* * Encode a strip of pixels. We break it into rows to * avoid encoding runs across row boundaries. */ static int LogLuvEncodeStrip(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) { tsize_t rowlen = TIFFScanlineSize(tif); assert(cc%rowlen == 0); while (cc && (*tif->tif_encoderow)(tif, bp, rowlen, s) == 1) bp += rowlen, cc -= rowlen; return (cc == 0); } /* * Encode a tile of pixels. We break it into rows to * avoid encoding runs across row boundaries. */ static int LogLuvEncodeTile(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) { tsize_t rowlen = TIFFTileRowSize(tif); assert(cc%rowlen == 0); while (cc && (*tif->tif_encoderow)(tif, bp, rowlen, s) == 1) bp += rowlen, cc -= rowlen; return (cc == 0); } /* * Encode/Decode functions for converting to and from user formats. */ #include "uvcode.h" #ifndef UVSCALE #define U_NEU 0.210526316 #define V_NEU 0.473684211 #define UVSCALE 410. #endif #ifndef M_LN2 #define M_LN2 0.69314718055994530942 #endif #ifndef M_PI #define M_PI 3.14159265358979323846 #endif #define log2(x) ((1./M_LN2)*log(x)) #define exp2(x) exp(M_LN2*(x)) #define itrunc(x,m) ((m)==SGILOGENCODE_NODITHER ? \ (int)(x) : \ (int)((x) + rand()*(1./RAND_MAX) - .5)) #if !LOGLUV_PUBLIC static #endif double LogL16toY(int p16) /* compute luminance from 16-bit LogL */ { int Le = p16 & 0x7fff; double Y; if (!Le) return (0.); Y = exp(M_LN2/256.*(Le+.5) - M_LN2*64.); return (!(p16 & 0x8000) ? Y : -Y); } #if !LOGLUV_PUBLIC static #endif int LogL16fromY(double Y, int em) /* get 16-bit LogL from Y */ { if (Y >= 1.8371976e19) return (0x7fff); if (Y <= -1.8371976e19) return (0xffff); if (Y > 5.4136769e-20) return itrunc(256.*(log2(Y) + 64.), em); if (Y < -5.4136769e-20) return (~0x7fff | itrunc(256.*(log2(-Y) + 64.), em)); return (0); } static void L16toY(LogLuvState* sp, tidata_t op, int n) { int16* l16 = (int16*) sp->tbuf; float* yp = (float*) op; while (n-- > 0) *yp++ = (float)LogL16toY(*l16++); } static void L16toGry(LogLuvState* sp, tidata_t op, int n) { int16* l16 = (int16*) sp->tbuf; uint8* gp = (uint8*) op; while (n-- > 0) { double Y = LogL16toY(*l16++); *gp++ = (uint8) ((Y <= 0.) ? 0 : (Y >= 1.) ? 255 : (int)(256.*sqrt(Y))); } } static void L16fromY(LogLuvState* sp, tidata_t op, int n) { int16* l16 = (int16*) sp->tbuf; float* yp = (float*) op; while (n-- > 0) *l16++ = (int16) (LogL16fromY(*yp++, sp->encode_meth)); } #if !LOGLUV_PUBLIC static #endif void XYZtoRGB24(float xyz[3], uint8 rgb[3]) { double r, g, b; /* assume CCIR-709 primaries */ r = 2.690*xyz[0] + -1.276*xyz[1] + -0.414*xyz[2]; g = -1.022*xyz[0] + 1.978*xyz[1] + 0.044*xyz[2]; b = 0.061*xyz[0] + -0.224*xyz[1] + 1.163*xyz[2]; /* assume 2.0 gamma for speed */ /* could use integer sqrt approx., but this is probably faster */ rgb[0] = (uint8)((r<=0.) ? 0 : (r >= 1.) ? 255 : (int)(256.*sqrt(r))); rgb[1] = (uint8)((g<=0.) ? 0 : (g >= 1.) ? 255 : (int)(256.*sqrt(g))); rgb[2] = (uint8)((b<=0.) ? 0 : (b >= 1.) ? 255 : (int)(256.*sqrt(b))); } #if !LOGLUV_PUBLIC static #endif double LogL10toY(int p10) /* compute luminance from 10-bit LogL */ { if (p10 == 0) return (0.); return (exp(M_LN2/64.*(p10+.5) - M_LN2*12.)); } #if !LOGLUV_PUBLIC static #endif int LogL10fromY(double Y, int em) /* get 10-bit LogL from Y */ { if (Y >= 15.742) return (0x3ff); else if (Y <= .00024283) return (0); else return itrunc(64.*(log2(Y) + 12.), em); } #define NANGLES 100 #define uv2ang(u, v) ( (NANGLES*.499999999/M_PI) \ * atan2((v)-V_NEU,(u)-U_NEU) + .5*NANGLES ) static int oog_encode(double u, double v) /* encode out-of-gamut chroma */ { static int oog_table[NANGLES]; static int initialized = 0; register int i; if (!initialized) { /* set up perimeter table */ double eps[NANGLES], ua, va, ang, epsa; int ui, vi, ustep; for (i = NANGLES; i--; ) eps[i] = 2.; for (vi = UV_NVS; vi--; ) { va = UV_VSTART + (vi+.5)*UV_SQSIZ; ustep = uv_row[vi].nus-1; if (vi == UV_NVS-1 || vi == 0 || ustep <= 0) ustep = 1; for (ui = uv_row[vi].nus-1; ui >= 0; ui -= ustep) { ua = uv_row[vi].ustart + (ui+.5)*UV_SQSIZ; ang = uv2ang(ua, va); i = (int) ang; epsa = fabs(ang - (i+.5)); if (epsa < eps[i]) { oog_table[i] = uv_row[vi].ncum + ui; eps[i] = epsa; } } } for (i = NANGLES; i--; ) /* fill any holes */ if (eps[i] > 1.5) { int i1, i2; for (i1 = 1; i1 < NANGLES/2; i1++) if (eps[(i+i1)%NANGLES] < 1.5) break; for (i2 = 1; i2 < NANGLES/2; i2++) if (eps[(i+NANGLES-i2)%NANGLES] < 1.5) break; if (i1 < i2) oog_table[i] = oog_table[(i+i1)%NANGLES]; else oog_table[i] = oog_table[(i+NANGLES-i2)%NANGLES]; } initialized = 1; } i = (int) uv2ang(u, v); /* look up hue angle */ return (oog_table[i]); } #undef uv2ang #undef NANGLES #if !LOGLUV_PUBLIC static #endif int uv_encode(double u, double v, int em) /* encode (u',v') coordinates */ { register int vi, ui; if (v < UV_VSTART) return oog_encode(u, v); vi = itrunc((v - UV_VSTART)*(1./UV_SQSIZ), em); if (vi >= UV_NVS) return oog_encode(u, v); if (u < uv_row[vi].ustart) return oog_encode(u, v); ui = itrunc((u - uv_row[vi].ustart)*(1./UV_SQSIZ), em); if (ui >= uv_row[vi].nus) return oog_encode(u, v); return (uv_row[vi].ncum + ui); } #if !LOGLUV_PUBLIC static #endif int uv_decode(double *up, double *vp, int c) /* decode (u',v') index */ { int upper, lower; register int ui, vi; if (c < 0 || c >= UV_NDIVS) return (-1); lower = 0; /* binary search */ upper = UV_NVS; while (upper - lower > 1) { vi = (lower + upper) >> 1; ui = c - uv_row[vi].ncum; if (ui > 0) lower = vi; else if (ui < 0) upper = vi; else { lower = vi; break; } } vi = lower; ui = c - uv_row[vi].ncum; *up = uv_row[vi].ustart + (ui+.5)*UV_SQSIZ; *vp = UV_VSTART + (vi+.5)*UV_SQSIZ; return (0); } #if !LOGLUV_PUBLIC static #endif void LogLuv24toXYZ(uint32 p, float XYZ[3]) { int Ce; double L, u, v, s, x, y; /* decode luminance */ L = LogL10toY(p>>14 & 0x3ff); if (L <= 0.) { XYZ[0] = XYZ[1] = XYZ[2] = 0.; return; } /* decode color */ Ce = p & 0x3fff; if (uv_decode(&u, &v, Ce) < 0) { u = U_NEU; v = V_NEU; } s = 1./(6.*u - 16.*v + 12.); x = 9.*u * s; y = 4.*v * s; /* convert to XYZ */ XYZ[0] = (float)(x/y * L); XYZ[1] = (float)L; XYZ[2] = (float)((1.-x-y)/y * L); } #if !LOGLUV_PUBLIC static #endif uint32 LogLuv24fromXYZ(float XYZ[3], int em) { int Le, Ce; double u, v, s; /* encode luminance */ Le = LogL10fromY(XYZ[1], em); /* encode color */ s = XYZ[0] + 15.*XYZ[1] + 3.*XYZ[2]; if (!Le || s <= 0.) { u = U_NEU; v = V_NEU; } else { u = 4.*XYZ[0] / s; v = 9.*XYZ[1] / s; } Ce = uv_encode(u, v, em); if (Ce < 0) /* never happens */ Ce = uv_encode(U_NEU, V_NEU, SGILOGENCODE_NODITHER); /* combine encodings */ return (Le << 14 | Ce); } static void Luv24toXYZ(LogLuvState* sp, tidata_t op, int n) { uint32* luv = (uint32*) sp->tbuf; float* xyz = (float*) op; while (n-- > 0) { LogLuv24toXYZ(*luv, xyz); xyz += 3; luv++; } } static void Luv24toLuv48(LogLuvState* sp, tidata_t op, int n) { uint32* luv = (uint32*) sp->tbuf; int16* luv3 = (int16*) op; while (n-- > 0) { double u, v; *luv3++ = (int16)((*luv >> 12 & 0xffd) + 13314); if (uv_decode(&u, &v, *luv&0x3fff) < 0) { u = U_NEU; v = V_NEU; } *luv3++ = (int16)(u * (1L<<15)); *luv3++ = (int16)(v * (1L<<15)); luv++; } } static void Luv24toRGB(LogLuvState* sp, tidata_t op, int n) { uint32* luv = (uint32*) sp->tbuf; uint8* rgb = (uint8*) op; while (n-- > 0) { float xyz[3]; LogLuv24toXYZ(*luv++, xyz); XYZtoRGB24(xyz, rgb); rgb += 3; } } static void Luv24fromXYZ(LogLuvState* sp, tidata_t op, int n) { uint32* luv = (uint32*) sp->tbuf; float* xyz = (float*) op; while (n-- > 0) { *luv++ = LogLuv24fromXYZ(xyz, sp->encode_meth); xyz += 3; } } static void Luv24fromLuv48(LogLuvState* sp, tidata_t op, int n) { uint32* luv = (uint32*) sp->tbuf; int16* luv3 = (int16*) op; while (n-- > 0) { int Le, Ce; if (luv3[0] <= 0) Le = 0; else if (luv3[0] >= (1<<12)+3314) Le = (1<<10) - 1; else if (sp->encode_meth == SGILOGENCODE_NODITHER) Le = (luv3[0]-3314) >> 2; else Le = itrunc(.25*(luv3[0]-3314.), sp->encode_meth); Ce = uv_encode((luv3[1]+.5)/(1<<15), (luv3[2]+.5)/(1<<15), sp->encode_meth); if (Ce < 0) /* never happens */ Ce = uv_encode(U_NEU, V_NEU, SGILOGENCODE_NODITHER); *luv++ = (uint32)Le << 14 | Ce; luv3 += 3; } } #if !LOGLUV_PUBLIC static #endif void LogLuv32toXYZ(uint32 p, float XYZ[3]) { double L, u, v, s, x, y; /* decode luminance */ L = LogL16toY((int)p >> 16); if (L <= 0.) { XYZ[0] = XYZ[1] = XYZ[2] = 0.; return; } /* decode color */ u = 1./UVSCALE * ((p>>8 & 0xff) + .5); v = 1./UVSCALE * ((p & 0xff) + .5); s = 1./(6.*u - 16.*v + 12.); x = 9.*u * s; y = 4.*v * s; /* convert to XYZ */ XYZ[0] = (float)(x/y * L); XYZ[1] = (float)L; XYZ[2] = (float)((1.-x-y)/y * L); } #if !LOGLUV_PUBLIC static #endif uint32 LogLuv32fromXYZ(float XYZ[3], int em) { unsigned int Le, ue, ve; double u, v, s; /* encode luminance */ Le = (unsigned int)LogL16fromY(XYZ[1], em); /* encode color */ s = XYZ[0] + 15.*XYZ[1] + 3.*XYZ[2]; if (!Le || s <= 0.) { u = U_NEU; v = V_NEU; } else { u = 4.*XYZ[0] / s; v = 9.*XYZ[1] / s; } if (u <= 0.) ue = 0; else ue = itrunc(UVSCALE*u, em); if (ue > 255) ue = 255; if (v <= 0.) ve = 0; else ve = itrunc(UVSCALE*v, em); if (ve > 255) ve = 255; /* combine encodings */ return (Le << 16 | ue << 8 | ve); } static void Luv32toXYZ(LogLuvState* sp, tidata_t op, int n) { uint32* luv = (uint32*) sp->tbuf; float* xyz = (float*) op; while (n-- > 0) { LogLuv32toXYZ(*luv++, xyz); xyz += 3; } } static void Luv32toLuv48(LogLuvState* sp, tidata_t op, int n) { uint32* luv = (uint32*) sp->tbuf; int16* luv3 = (int16*) op; while (n-- > 0) { double u, v; *luv3++ = (int16)(*luv >> 16); u = 1./UVSCALE * ((*luv>>8 & 0xff) + .5); v = 1./UVSCALE * ((*luv & 0xff) + .5); *luv3++ = (int16)(u * (1L<<15)); *luv3++ = (int16)(v * (1L<<15)); luv++; } } static void Luv32toRGB(LogLuvState* sp, tidata_t op, int n) { uint32* luv = (uint32*) sp->tbuf; uint8* rgb = (uint8*) op; while (n-- > 0) { float xyz[3]; LogLuv32toXYZ(*luv++, xyz); XYZtoRGB24(xyz, rgb); rgb += 3; } } static void Luv32fromXYZ(LogLuvState* sp, tidata_t op, int n) { uint32* luv = (uint32*) sp->tbuf; float* xyz = (float*) op; while (n-- > 0) { *luv++ = LogLuv32fromXYZ(xyz, sp->encode_meth); xyz += 3; } } static void Luv32fromLuv48(LogLuvState* sp, tidata_t op, int n) { uint32* luv = (uint32*) sp->tbuf; int16* luv3 = (int16*) op; if (sp->encode_meth == SGILOGENCODE_NODITHER) { while (n-- > 0) { *luv++ = (uint32)luv3[0] << 16 | (luv3[1]*(uint32)(UVSCALE+.5) >> 7 & 0xff00) | (luv3[2]*(uint32)(UVSCALE+.5) >> 15 & 0xff); luv3 += 3; } return; } while (n-- > 0) { *luv++ = (uint32)luv3[0] << 16 | (itrunc(luv3[1]*(UVSCALE/(1<<15)), sp->encode_meth) << 8 & 0xff00) | (itrunc(luv3[2]*(UVSCALE/(1<<15)), sp->encode_meth) & 0xff); luv3 += 3; } } static void _logLuvNop(LogLuvState* sp, tidata_t op, int n) { (void) sp; (void) op; (void) n; } static int LogL16GuessDataFmt(TIFFDirectory *td) { #define PACK(s,b,f) (((b)<<6)|((s)<<3)|(f)) switch (PACK(td->td_samplesperpixel, td->td_bitspersample, td->td_sampleformat)) { case PACK(1, 32, SAMPLEFORMAT_IEEEFP): return (SGILOGDATAFMT_FLOAT); case PACK(1, 16, SAMPLEFORMAT_VOID): case PACK(1, 16, SAMPLEFORMAT_INT): case PACK(1, 16, SAMPLEFORMAT_UINT): return (SGILOGDATAFMT_16BIT); case PACK(1, 8, SAMPLEFORMAT_VOID): case PACK(1, 8, SAMPLEFORMAT_UINT): return (SGILOGDATAFMT_8BIT); } #undef PACK return (SGILOGDATAFMT_UNKNOWN); } static uint32 multiply(size_t m1, size_t m2) { uint32 bytes = m1 * m2; if (m1 && bytes / m1 != m2) bytes = 0; return bytes; } static int LogL16InitState(TIFF* tif) { TIFFDirectory *td = &tif->tif_dir; LogLuvState* sp = DecoderState(tif); static const char module[] = "LogL16InitState"; assert(sp != NULL); assert(td->td_photometric == PHOTOMETRIC_LOGL); /* for some reason, we can't do this in TIFFInitLogL16 */ if (sp->user_datafmt == SGILOGDATAFMT_UNKNOWN) sp->user_datafmt = LogL16GuessDataFmt(td); switch (sp->user_datafmt) { case SGILOGDATAFMT_FLOAT: sp->pixel_size = sizeof (float); break; case SGILOGDATAFMT_16BIT: sp->pixel_size = sizeof (int16); break; case SGILOGDATAFMT_8BIT: sp->pixel_size = sizeof (uint8); break; default: TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "No support for converting user data format to LogL"); return (0); } if( isTiled(tif) ) sp->tbuflen = multiply(td->td_tilewidth, td->td_tilelength); else sp->tbuflen = multiply(td->td_imagewidth, td->td_rowsperstrip); if (multiply(sp->tbuflen, sizeof (int16)) == 0 || (sp->tbuf = (tidata_t*) _TIFFmalloc(sp->tbuflen * sizeof (int16))) == NULL) { TIFFErrorExt(tif->tif_clientdata, module, "%s: No space for SGILog translation buffer", tif->tif_name); return (0); } return (1); } static int LogLuvGuessDataFmt(TIFFDirectory *td) { int guess; /* * If the user didn't tell us their datafmt, * take our best guess from the bitspersample. */ #define PACK(a,b) (((a)<<3)|(b)) switch (PACK(td->td_bitspersample, td->td_sampleformat)) { case PACK(32, SAMPLEFORMAT_IEEEFP): guess = SGILOGDATAFMT_FLOAT; break; case PACK(32, SAMPLEFORMAT_VOID): case PACK(32, SAMPLEFORMAT_UINT): case PACK(32, SAMPLEFORMAT_INT): guess = SGILOGDATAFMT_RAW; break; case PACK(16, SAMPLEFORMAT_VOID): case PACK(16, SAMPLEFORMAT_INT): case PACK(16, SAMPLEFORMAT_UINT): guess = SGILOGDATAFMT_16BIT; break; case PACK( 8, SAMPLEFORMAT_VOID): case PACK( 8, SAMPLEFORMAT_UINT): guess = SGILOGDATAFMT_8BIT; break; default: guess = SGILOGDATAFMT_UNKNOWN; break; #undef PACK } /* * Double-check samples per pixel. */ switch (td->td_samplesperpixel) { case 1: if (guess != SGILOGDATAFMT_RAW) guess = SGILOGDATAFMT_UNKNOWN; break; case 3: if (guess == SGILOGDATAFMT_RAW) guess = SGILOGDATAFMT_UNKNOWN; break; default: guess = SGILOGDATAFMT_UNKNOWN; break; } return (guess); } static int LogLuvInitState(TIFF* tif) { TIFFDirectory* td = &tif->tif_dir; LogLuvState* sp = DecoderState(tif); static const char module[] = "LogLuvInitState"; assert(sp != NULL); assert(td->td_photometric == PHOTOMETRIC_LOGLUV); /* for some reason, we can't do this in TIFFInitLogLuv */ if (td->td_planarconfig != PLANARCONFIG_CONTIG) { TIFFErrorExt(tif->tif_clientdata, module, "SGILog compression cannot handle non-contiguous data"); return (0); } if (sp->user_datafmt == SGILOGDATAFMT_UNKNOWN) sp->user_datafmt = LogLuvGuessDataFmt(td); switch (sp->user_datafmt) { case SGILOGDATAFMT_FLOAT: sp->pixel_size = 3*sizeof (float); break; case SGILOGDATAFMT_16BIT: sp->pixel_size = 3*sizeof (int16); break; case SGILOGDATAFMT_RAW: sp->pixel_size = sizeof (uint32); break; case SGILOGDATAFMT_8BIT: sp->pixel_size = 3*sizeof (uint8); break; default: TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "No support for converting user data format to LogLuv"); return (0); } if( isTiled(tif) ) sp->tbuflen = multiply(td->td_tilewidth, td->td_tilelength); else sp->tbuflen = multiply(td->td_imagewidth, td->td_rowsperstrip); if (multiply(sp->tbuflen, sizeof (uint32)) == 0 || (sp->tbuf = (tidata_t*) _TIFFmalloc(sp->tbuflen * sizeof (uint32))) == NULL) { TIFFErrorExt(tif->tif_clientdata, module, "%s: No space for SGILog translation buffer", tif->tif_name); return (0); } return (1); } static int LogLuvSetupDecode(TIFF* tif) { LogLuvState* sp = DecoderState(tif); TIFFDirectory* td = &tif->tif_dir; tif->tif_postdecode = _TIFFNoPostDecode; switch (td->td_photometric) { case PHOTOMETRIC_LOGLUV: if (!LogLuvInitState(tif)) break; if (td->td_compression == COMPRESSION_SGILOG24) { tif->tif_decoderow = LogLuvDecode24; switch (sp->user_datafmt) { case SGILOGDATAFMT_FLOAT: sp->tfunc = Luv24toXYZ; break; case SGILOGDATAFMT_16BIT: sp->tfunc = Luv24toLuv48; break; case SGILOGDATAFMT_8BIT: sp->tfunc = Luv24toRGB; break; } } else { tif->tif_decoderow = LogLuvDecode32; switch (sp->user_datafmt) { case SGILOGDATAFMT_FLOAT: sp->tfunc = Luv32toXYZ; break; case SGILOGDATAFMT_16BIT: sp->tfunc = Luv32toLuv48; break; case SGILOGDATAFMT_8BIT: sp->tfunc = Luv32toRGB; break; } } return (1); case PHOTOMETRIC_LOGL: if (!LogL16InitState(tif)) break; tif->tif_decoderow = LogL16Decode; switch (sp->user_datafmt) { case SGILOGDATAFMT_FLOAT: sp->tfunc = L16toY; break; case SGILOGDATAFMT_8BIT: sp->tfunc = L16toGry; break; } return (1); default: TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Inappropriate photometric interpretation %d for SGILog compression; %s", td->td_photometric, "must be either LogLUV or LogL"); break; } return (0); } static int LogLuvSetupEncode(TIFF* tif) { LogLuvState* sp = EncoderState(tif); TIFFDirectory* td = &tif->tif_dir; switch (td->td_photometric) { case PHOTOMETRIC_LOGLUV: if (!LogLuvInitState(tif)) break; if (td->td_compression == COMPRESSION_SGILOG24) { tif->tif_encoderow = LogLuvEncode24; switch (sp->user_datafmt) { case SGILOGDATAFMT_FLOAT: sp->tfunc = Luv24fromXYZ; break; case SGILOGDATAFMT_16BIT: sp->tfunc = Luv24fromLuv48; break; case SGILOGDATAFMT_RAW: break; default: goto notsupported; } } else { tif->tif_encoderow = LogLuvEncode32; switch (sp->user_datafmt) { case SGILOGDATAFMT_FLOAT: sp->tfunc = Luv32fromXYZ; break; case SGILOGDATAFMT_16BIT: sp->tfunc = Luv32fromLuv48; break; case SGILOGDATAFMT_RAW: break; default: goto notsupported; } } break; case PHOTOMETRIC_LOGL: if (!LogL16InitState(tif)) break; tif->tif_encoderow = LogL16Encode; switch (sp->user_datafmt) { case SGILOGDATAFMT_FLOAT: sp->tfunc = L16fromY; break; case SGILOGDATAFMT_16BIT: break; default: goto notsupported; } break; default: TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Inappropriate photometric interpretation %d for SGILog compression; %s", td->td_photometric, "must be either LogLUV or LogL"); break; } return (1); notsupported: TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "SGILog compression supported only for %s, or raw data", td->td_photometric == PHOTOMETRIC_LOGL ? "Y, L" : "XYZ, Luv"); return (0); } static void LogLuvClose(TIFF* tif) { TIFFDirectory *td = &tif->tif_dir; /* * For consistency, we always want to write out the same * bitspersample and sampleformat for our TIFF file, * regardless of the data format being used by the application. * Since this routine is called after tags have been set but * before they have been recorded in the file, we reset them here. */ td->td_samplesperpixel = (td->td_photometric == PHOTOMETRIC_LOGL) ? 1 : 3; td->td_bitspersample = 16; td->td_sampleformat = SAMPLEFORMAT_INT; } static void LogLuvCleanup(TIFF* tif) { LogLuvState* sp = (LogLuvState *)tif->tif_data; assert(sp != 0); tif->tif_tagmethods.vgetfield = sp->vgetparent; tif->tif_tagmethods.vsetfield = sp->vsetparent; if (sp->tbuf) _TIFFfree(sp->tbuf); _TIFFfree(sp); tif->tif_data = NULL; _TIFFSetDefaultCompressionState(tif); } static int LogLuvVSetField(TIFF* tif, ttag_t tag, va_list ap) { LogLuvState* sp = DecoderState(tif); int bps, fmt; switch (tag) { case TIFFTAG_SGILOGDATAFMT: sp->user_datafmt = va_arg(ap, int); /* * Tweak the TIFF header so that the rest of libtiff knows what * size of data will be passed between app and library, and * assume that the app knows what it is doing and is not * confused by these header manipulations... */ switch (sp->user_datafmt) { case SGILOGDATAFMT_FLOAT: bps = 32, fmt = SAMPLEFORMAT_IEEEFP; break; case SGILOGDATAFMT_16BIT: bps = 16, fmt = SAMPLEFORMAT_INT; break; case SGILOGDATAFMT_RAW: bps = 32, fmt = SAMPLEFORMAT_UINT; TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1); break; case SGILOGDATAFMT_8BIT: bps = 8, fmt = SAMPLEFORMAT_UINT; break; default: TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Unknown data format %d for LogLuv compression", sp->user_datafmt); return (0); } TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bps); TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, fmt); /* * Must recalculate sizes should bits/sample change. */ tif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tsize_t) -1; tif->tif_scanlinesize = TIFFScanlineSize(tif); return (1); case TIFFTAG_SGILOGENCODE: sp->encode_meth = va_arg(ap, int); if (sp->encode_meth != SGILOGENCODE_NODITHER && sp->encode_meth != SGILOGENCODE_RANDITHER) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Unknown encoding %d for LogLuv compression", sp->encode_meth); return (0); } return (1); default: return (*sp->vsetparent)(tif, tag, ap); } } static int LogLuvVGetField(TIFF* tif, ttag_t tag, va_list ap) { LogLuvState *sp = (LogLuvState *)tif->tif_data; switch (tag) { case TIFFTAG_SGILOGDATAFMT: *va_arg(ap, int*) = sp->user_datafmt; return (1); default: return (*sp->vgetparent)(tif, tag, ap); } } static const TIFFFieldInfo LogLuvFieldInfo[] = { { TIFFTAG_SGILOGDATAFMT, 0, 0, TIFF_SHORT, FIELD_PSEUDO, TRUE, FALSE, "SGILogDataFmt"}, { TIFFTAG_SGILOGENCODE, 0, 0, TIFF_SHORT, FIELD_PSEUDO, TRUE, FALSE, "SGILogEncode"} }; int TIFFInitSGILog(TIFF* tif, int scheme) { static const char module[] = "TIFFInitSGILog"; LogLuvState* sp; assert(scheme == COMPRESSION_SGILOG24 || scheme == COMPRESSION_SGILOG); /* * Merge codec-specific tag information. */ if (!_TIFFMergeFieldInfo(tif, LogLuvFieldInfo, TIFFArrayCount(LogLuvFieldInfo))) { TIFFErrorExt(tif->tif_clientdata, module, "Merging SGILog codec-specific tags failed"); return 0; } /* * Allocate state block so tag methods have storage to record values. */ tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (LogLuvState)); if (tif->tif_data == NULL) goto bad; sp = (LogLuvState*) tif->tif_data; _TIFFmemset((tdata_t)sp, 0, sizeof (*sp)); sp->user_datafmt = SGILOGDATAFMT_UNKNOWN; sp->encode_meth = (scheme == COMPRESSION_SGILOG24) ? SGILOGENCODE_RANDITHER : SGILOGENCODE_NODITHER; sp->tfunc = _logLuvNop; /* * Install codec methods. * NB: tif_decoderow & tif_encoderow are filled * in at setup time. */ tif->tif_setupdecode = LogLuvSetupDecode; tif->tif_decodestrip = LogLuvDecodeStrip; tif->tif_decodetile = LogLuvDecodeTile; tif->tif_setupencode = LogLuvSetupEncode; tif->tif_encodestrip = LogLuvEncodeStrip; tif->tif_encodetile = LogLuvEncodeTile; tif->tif_close = LogLuvClose; tif->tif_cleanup = LogLuvCleanup; /* * Override parent get/set field methods. */ sp->vgetparent = tif->tif_tagmethods.vgetfield; tif->tif_tagmethods.vgetfield = LogLuvVGetField; /* hook for codec tags */ sp->vsetparent = tif->tif_tagmethods.vsetfield; tif->tif_tagmethods.vsetfield = LogLuvVSetField; /* hook for codec tags */ return (1); bad: TIFFErrorExt(tif->tif_clientdata, module, "%s: No space for LogLuv state block", tif->tif_name); return (0); } #endif /* LOGLUV_SUPPORT */ /* vim: set ts=8 sts=8 sw=8 noet: */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/COPYRIGHT���������������������������������������������������0000644�0001750�0001750�00000002172�12320456500�020631� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Copyright (c) 1988-1997 Sam Leffler Copyright (c) 1991-1997 Silicon Graphics, Inc. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that (i) the above copyright notices and this permission notice appear in all copies of the software and related documentation, and (ii) the names of Sam Leffler and Silicon Graphics may not be used in any advertising or publicity relating to the software without the specific, prior written permission of Sam Leffler and Silicon Graphics. THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_dirread.c�����������������������������������������������0000644�0001750�0001750�00000163206�12320456500�021764� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_dirread.c,v 1.92.2.6 2009-10-29 20:04:32 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * Directory Read Support Routines. */ #include "tiffiop.h" #define IGNORE 0 /* tag placeholder used below */ #ifdef HAVE_IEEEFP # define TIFFCvtIEEEFloatToNative(tif, n, fp) # define TIFFCvtIEEEDoubleToNative(tif, n, dp) #else extern void TIFFCvtIEEEFloatToNative(TIFF*, uint32, float*); extern void TIFFCvtIEEEDoubleToNative(TIFF*, uint32, double*); #endif static TIFFDirEntry* TIFFReadDirectoryFind(TIFFDirEntry* dir, uint16 dircount, uint16 tagid); static int EstimateStripByteCounts(TIFF*, TIFFDirEntry*, uint16); static void MissingRequired(TIFF*, const char*); static int TIFFCheckDirOffset(TIFF*, toff_t); static int CheckDirCount(TIFF*, TIFFDirEntry*, uint32); static uint16 TIFFFetchDirectory(TIFF*, toff_t, TIFFDirEntry**, toff_t *); static tsize_t TIFFFetchData(TIFF*, TIFFDirEntry*, char*); static tsize_t TIFFFetchString(TIFF*, TIFFDirEntry*, char*); static float TIFFFetchRational(TIFF*, TIFFDirEntry*); static int TIFFFetchNormalTag(TIFF*, TIFFDirEntry*); static int TIFFFetchPerSampleShorts(TIFF*, TIFFDirEntry*, uint16*); static int TIFFFetchPerSampleLongs(TIFF*, TIFFDirEntry*, uint32*); static int TIFFFetchPerSampleAnys(TIFF*, TIFFDirEntry*, double*); static int TIFFFetchShortArray(TIFF*, TIFFDirEntry*, uint16*); static int TIFFFetchStripThing(TIFF*, TIFFDirEntry*, long, uint32**); static int TIFFFetchRefBlackWhite(TIFF*, TIFFDirEntry*); static int TIFFFetchSubjectDistance(TIFF*, TIFFDirEntry*); static float TIFFFetchFloat(TIFF*, TIFFDirEntry*); static int TIFFFetchFloatArray(TIFF*, TIFFDirEntry*, float*); static int TIFFFetchDoubleArray(TIFF*, TIFFDirEntry*, double*); static int TIFFFetchAnyArray(TIFF*, TIFFDirEntry*, double*); static int TIFFFetchShortPair(TIFF*, TIFFDirEntry*); static void ChopUpSingleUncompressedStrip(TIFF*); /* * Read the next TIFF directory from a file and convert it to the internal * format. We read directories sequentially. */ int TIFFReadDirectory(TIFF* tif) { static const char module[] = "TIFFReadDirectory"; int n; TIFFDirectory* td; TIFFDirEntry *dp, *dir = NULL; uint16 iv; uint32 v; const TIFFFieldInfo* fip; size_t fix; uint16 dircount; int diroutoforderwarning = 0, compressionknown = 0; tif->tif_diroff = tif->tif_nextdiroff; /* * Check whether we have the last offset or bad offset (IFD looping). */ if (!TIFFCheckDirOffset(tif, tif->tif_nextdiroff)) return 0; /* * Cleanup any previous compression state. */ (*tif->tif_cleanup)(tif); tif->tif_curdir++; dircount = TIFFFetchDirectory(tif, tif->tif_nextdiroff, &dir, &tif->tif_nextdiroff); if (!dircount) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Failed to read directory at offset %u", tif->tif_name, tif->tif_nextdiroff); return 0; } tif->tif_flags &= ~TIFF_BEENWRITING; /* reset before new dir */ /* * Setup default value and then make a pass over * the fields to check type and tag information, * and to extract info required to size data * structures. A second pass is made afterwards * to read in everthing not taken in the first pass. */ td = &tif->tif_dir; /* free any old stuff and reinit */ TIFFFreeDirectory(tif); TIFFDefaultDirectory(tif); /* * Electronic Arts writes gray-scale TIFF files * without a PlanarConfiguration directory entry. * Thus we setup a default value here, even though * the TIFF spec says there is no default value. */ TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); /* * Sigh, we must make a separate pass through the * directory for the following reason: * * We must process the Compression tag in the first pass * in order to merge in codec-private tag definitions (otherwise * we may get complaints about unknown tags). However, the * Compression tag may be dependent on the SamplesPerPixel * tag value because older TIFF specs permited Compression * to be written as a SamplesPerPixel-count tag entry. * Thus if we don't first figure out the correct SamplesPerPixel * tag value then we may end up ignoring the Compression tag * value because it has an incorrect count value (if the * true value of SamplesPerPixel is not 1). * * It sure would have been nice if Aldus had really thought * this stuff through carefully. */ for (dp = dir, n = dircount; n > 0; n--, dp++) { if (tif->tif_flags & TIFF_SWAB) { TIFFSwabArrayOfShort(&dp->tdir_tag, 2); TIFFSwabArrayOfLong(&dp->tdir_count, 2); } if (dp->tdir_tag == TIFFTAG_SAMPLESPERPIXEL) { if (!TIFFFetchNormalTag(tif, dp)) goto bad; dp->tdir_tag = IGNORE; } } /* * First real pass over the directory. */ fix = 0; for (dp = dir, n = dircount; n > 0; n--, dp++) { if (fix >= tif->tif_nfields || dp->tdir_tag == IGNORE) continue; /* * Silicon Beach (at least) writes unordered * directory tags (violating the spec). Handle * it here, but be obnoxious (maybe they'll fix it?). */ if (dp->tdir_tag < tif->tif_fieldinfo[fix]->field_tag) { if (!diroutoforderwarning) { TIFFWarningExt(tif->tif_clientdata, module, "%s: invalid TIFF directory; tags are not sorted in ascending order", tif->tif_name); diroutoforderwarning = 1; } fix = 0; /* O(n^2) */ } while (fix < tif->tif_nfields && tif->tif_fieldinfo[fix]->field_tag < dp->tdir_tag) fix++; if (fix >= tif->tif_nfields || tif->tif_fieldinfo[fix]->field_tag != dp->tdir_tag) { TIFFWarningExt(tif->tif_clientdata, module, "%s: unknown field with tag %d (0x%x) encountered", tif->tif_name, dp->tdir_tag, dp->tdir_tag); if (!_TIFFMergeFieldInfo(tif, _TIFFCreateAnonFieldInfo(tif, dp->tdir_tag, (TIFFDataType) dp->tdir_type), 1)) { TIFFWarningExt(tif->tif_clientdata, module, "Registering anonymous field with tag %d (0x%x) failed", dp->tdir_tag, dp->tdir_tag); goto ignore; } fix = 0; while (fix < tif->tif_nfields && tif->tif_fieldinfo[fix]->field_tag < dp->tdir_tag) fix++; } /* * Null out old tags that we ignore. */ if (tif->tif_fieldinfo[fix]->field_bit == FIELD_IGNORE) { ignore: dp->tdir_tag = IGNORE; continue; } /* * Check data type. */ fip = tif->tif_fieldinfo[fix]; while (dp->tdir_type != (unsigned short) fip->field_type && fix < tif->tif_nfields) { if (fip->field_type == TIFF_ANY) /* wildcard */ break; fip = tif->tif_fieldinfo[++fix]; if (fix >= tif->tif_nfields || fip->field_tag != dp->tdir_tag) { TIFFWarningExt(tif->tif_clientdata, module, "%s: wrong data type %d for \"%s\"; tag ignored", tif->tif_name, dp->tdir_type, tif->tif_fieldinfo[fix-1]->field_name); goto ignore; } } /* * Check count if known in advance. */ if (fip->field_readcount != TIFF_VARIABLE && fip->field_readcount != TIFF_VARIABLE2) { uint32 expected = (fip->field_readcount == TIFF_SPP) ? (uint32) td->td_samplesperpixel : (uint32) fip->field_readcount; if (!CheckDirCount(tif, dp, expected)) goto ignore; } switch (dp->tdir_tag) { case TIFFTAG_COMPRESSION: /* * The 5.0 spec says the Compression tag has * one value, while earlier specs say it has * one value per sample. Because of this, we * accept the tag if one value is supplied. */ if (dp->tdir_count == 1) { v = TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset); if (!TIFFSetField(tif, dp->tdir_tag, (uint16)v)) goto bad; else compressionknown = 1; break; /* XXX: workaround for broken TIFFs */ } else if (dp->tdir_type == TIFF_LONG) { if (!TIFFFetchPerSampleLongs(tif, dp, &v) || !TIFFSetField(tif, dp->tdir_tag, (uint16)v)) goto bad; } else { if (!TIFFFetchPerSampleShorts(tif, dp, &iv) || !TIFFSetField(tif, dp->tdir_tag, iv)) goto bad; } dp->tdir_tag = IGNORE; break; case TIFFTAG_STRIPOFFSETS: case TIFFTAG_STRIPBYTECOUNTS: case TIFFTAG_TILEOFFSETS: case TIFFTAG_TILEBYTECOUNTS: TIFFSetFieldBit(tif, fip->field_bit); break; case TIFFTAG_IMAGEWIDTH: case TIFFTAG_IMAGELENGTH: case TIFFTAG_IMAGEDEPTH: case TIFFTAG_TILELENGTH: case TIFFTAG_TILEWIDTH: case TIFFTAG_TILEDEPTH: case TIFFTAG_PLANARCONFIG: case TIFFTAG_ROWSPERSTRIP: case TIFFTAG_EXTRASAMPLES: if (!TIFFFetchNormalTag(tif, dp)) goto bad; dp->tdir_tag = IGNORE; break; } } /* * XXX: OJPEG hack. * If a) compression is OJPEG, b) planarconfig tag says it's separate, * c) strip offsets/bytecounts tag are both present and * d) both contain exactly one value, then we consistently find * that the buggy implementation of the buggy compression scheme * matches contig planarconfig best. So we 'fix-up' the tag here */ if ((td->td_compression==COMPRESSION_OJPEG) && (td->td_planarconfig==PLANARCONFIG_SEPARATE)) { dp = TIFFReadDirectoryFind(dir,dircount,TIFFTAG_STRIPOFFSETS); if ((dp!=0) && (dp->tdir_count==1)) { dp = TIFFReadDirectoryFind(dir, dircount, TIFFTAG_STRIPBYTECOUNTS); if ((dp!=0) && (dp->tdir_count==1)) { td->td_planarconfig=PLANARCONFIG_CONTIG; TIFFWarningExt(tif->tif_clientdata, "TIFFReadDirectory", "Planarconfig tag value assumed incorrect, " "assuming data is contig instead of chunky"); } } } /* * Allocate directory structure and setup defaults. */ if (!TIFFFieldSet(tif, FIELD_IMAGEDIMENSIONS)) { MissingRequired(tif, "ImageLength"); goto bad; } /* * Setup appropriate structures (by strip or by tile) */ if (!TIFFFieldSet(tif, FIELD_TILEDIMENSIONS)) { td->td_nstrips = TIFFNumberOfStrips(tif); td->td_tilewidth = td->td_imagewidth; td->td_tilelength = td->td_rowsperstrip; td->td_tiledepth = td->td_imagedepth; tif->tif_flags &= ~TIFF_ISTILED; } else { td->td_nstrips = TIFFNumberOfTiles(tif); tif->tif_flags |= TIFF_ISTILED; } if (!td->td_nstrips) { TIFFErrorExt(tif->tif_clientdata, module, "%s: cannot handle zero number of %s", tif->tif_name, isTiled(tif) ? "tiles" : "strips"); goto bad; } td->td_stripsperimage = td->td_nstrips; if (td->td_planarconfig == PLANARCONFIG_SEPARATE) td->td_stripsperimage /= td->td_samplesperpixel; if (!TIFFFieldSet(tif, FIELD_STRIPOFFSETS)) { if ((td->td_compression==COMPRESSION_OJPEG) && (isTiled(tif)==0) && (td->td_nstrips==1)) { /* * XXX: OJPEG hack. * If a) compression is OJPEG, b) it's not a tiled TIFF, * and c) the number of strips is 1, * then we tolerate the absence of stripoffsets tag, * because, presumably, all required data is in the * JpegInterchangeFormat stream. */ TIFFSetFieldBit(tif, FIELD_STRIPOFFSETS); } else { MissingRequired(tif, isTiled(tif) ? "TileOffsets" : "StripOffsets"); goto bad; } } /* * Second pass: extract other information. */ for (dp = dir, n = dircount; n > 0; n--, dp++) { if (dp->tdir_tag == IGNORE) continue; switch (dp->tdir_tag) { case TIFFTAG_MINSAMPLEVALUE: case TIFFTAG_MAXSAMPLEVALUE: case TIFFTAG_BITSPERSAMPLE: case TIFFTAG_DATATYPE: case TIFFTAG_SAMPLEFORMAT: /* * The 5.0 spec says the Compression tag has * one value, while earlier specs say it has * one value per sample. Because of this, we * accept the tag if one value is supplied. * * The MinSampleValue, MaxSampleValue, BitsPerSample * DataType and SampleFormat tags are supposed to be * written as one value/sample, but some vendors * incorrectly write one value only -- so we accept * that as well (yech). Other vendors write correct * value for NumberOfSamples, but incorrect one for * BitsPerSample and friends, and we will read this * too. */ if (dp->tdir_count == 1) { v = TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset); if (!TIFFSetField(tif, dp->tdir_tag, (uint16)v)) goto bad; /* XXX: workaround for broken TIFFs */ } else if (dp->tdir_tag == TIFFTAG_BITSPERSAMPLE && dp->tdir_type == TIFF_LONG) { if (!TIFFFetchPerSampleLongs(tif, dp, &v) || !TIFFSetField(tif, dp->tdir_tag, (uint16)v)) goto bad; } else { if (!TIFFFetchPerSampleShorts(tif, dp, &iv) || !TIFFSetField(tif, dp->tdir_tag, iv)) goto bad; } break; case TIFFTAG_SMINSAMPLEVALUE: case TIFFTAG_SMAXSAMPLEVALUE: { double dv = 0.0; if (!TIFFFetchPerSampleAnys(tif, dp, &dv) || !TIFFSetField(tif, dp->tdir_tag, dv)) goto bad; } break; case TIFFTAG_STRIPOFFSETS: case TIFFTAG_TILEOFFSETS: if (!TIFFFetchStripThing(tif, dp, td->td_nstrips, &td->td_stripoffset)) goto bad; break; case TIFFTAG_STRIPBYTECOUNTS: case TIFFTAG_TILEBYTECOUNTS: if (!TIFFFetchStripThing(tif, dp, td->td_nstrips, &td->td_stripbytecount)) goto bad; break; case TIFFTAG_COLORMAP: case TIFFTAG_TRANSFERFUNCTION: { char* cp; /* * TransferFunction can have either 1x or 3x * data values; Colormap can have only 3x * items. */ v = 1L<<td->td_bitspersample; if (dp->tdir_tag == TIFFTAG_COLORMAP || dp->tdir_count != v) { if (!CheckDirCount(tif, dp, 3 * v)) break; } v *= sizeof(uint16); cp = (char *)_TIFFCheckMalloc(tif, dp->tdir_count, sizeof (uint16), "to read \"TransferFunction\" tag"); if (cp != NULL) { if (TIFFFetchData(tif, dp, cp)) { /* * This deals with there being * only one array to apply to * all samples. */ uint32 c = 1L << td->td_bitspersample; if (dp->tdir_count == c) v = 0L; TIFFSetField(tif, dp->tdir_tag, cp, cp+v, cp+2*v); } _TIFFfree(cp); } break; } case TIFFTAG_PAGENUMBER: case TIFFTAG_HALFTONEHINTS: case TIFFTAG_YCBCRSUBSAMPLING: case TIFFTAG_DOTRANGE: (void) TIFFFetchShortPair(tif, dp); break; case TIFFTAG_REFERENCEBLACKWHITE: (void) TIFFFetchRefBlackWhite(tif, dp); break; /* BEGIN REV 4.0 COMPATIBILITY */ case TIFFTAG_OSUBFILETYPE: v = 0L; switch (TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset)) { case OFILETYPE_REDUCEDIMAGE: v = FILETYPE_REDUCEDIMAGE; break; case OFILETYPE_PAGE: v = FILETYPE_PAGE; break; } if (v) TIFFSetField(tif, TIFFTAG_SUBFILETYPE, v); break; /* END REV 4.0 COMPATIBILITY */ default: (void) TIFFFetchNormalTag(tif, dp); break; } } /* * OJPEG hack: * - If a) compression is OJPEG, and b) photometric tag is missing, * then we consistently find that photometric should be YCbCr * - If a) compression is OJPEG, and b) photometric tag says it's RGB, * then we consistently find that the buggy implementation of the * buggy compression scheme matches photometric YCbCr instead. * - If a) compression is OJPEG, and b) bitspersample tag is missing, * then we consistently find bitspersample should be 8. * - If a) compression is OJPEG, b) samplesperpixel tag is missing, * and c) photometric is RGB or YCbCr, then we consistently find * samplesperpixel should be 3 * - If a) compression is OJPEG, b) samplesperpixel tag is missing, * and c) photometric is MINISWHITE or MINISBLACK, then we consistently * find samplesperpixel should be 3 */ if (td->td_compression==COMPRESSION_OJPEG) { if (!TIFFFieldSet(tif,FIELD_PHOTOMETRIC)) { TIFFWarningExt(tif->tif_clientdata, "TIFFReadDirectory", "Photometric tag is missing, assuming data is YCbCr"); if (!TIFFSetField(tif,TIFFTAG_PHOTOMETRIC,PHOTOMETRIC_YCBCR)) goto bad; } else if (td->td_photometric==PHOTOMETRIC_RGB) { td->td_photometric=PHOTOMETRIC_YCBCR; TIFFWarningExt(tif->tif_clientdata, "TIFFReadDirectory", "Photometric tag value assumed incorrect, " "assuming data is YCbCr instead of RGB"); } if (!TIFFFieldSet(tif,FIELD_BITSPERSAMPLE)) { TIFFWarningExt(tif->tif_clientdata,"TIFFReadDirectory", "BitsPerSample tag is missing, assuming 8 bits per sample"); if (!TIFFSetField(tif,TIFFTAG_BITSPERSAMPLE,8)) goto bad; } if (!TIFFFieldSet(tif,FIELD_SAMPLESPERPIXEL)) { if ((td->td_photometric==PHOTOMETRIC_RGB) || (td->td_photometric==PHOTOMETRIC_YCBCR)) { TIFFWarningExt(tif->tif_clientdata, "TIFFReadDirectory", "SamplesPerPixel tag is missing, " "assuming correct SamplesPerPixel value is 3"); if (!TIFFSetField(tif,TIFFTAG_SAMPLESPERPIXEL,3)) goto bad; } else if ((td->td_photometric==PHOTOMETRIC_MINISWHITE) || (td->td_photometric==PHOTOMETRIC_MINISBLACK)) { TIFFWarningExt(tif->tif_clientdata, "TIFFReadDirectory", "SamplesPerPixel tag is missing, " "assuming correct SamplesPerPixel value is 1"); if (!TIFFSetField(tif,TIFFTAG_SAMPLESPERPIXEL,1)) goto bad; } } } /* * Verify Palette image has a Colormap. */ if (td->td_photometric == PHOTOMETRIC_PALETTE && !TIFFFieldSet(tif, FIELD_COLORMAP)) { MissingRequired(tif, "Colormap"); goto bad; } /* * OJPEG hack: * We do no further messing with strip/tile offsets/bytecounts in OJPEG * TIFFs */ if (td->td_compression!=COMPRESSION_OJPEG) { /* * Attempt to deal with a missing StripByteCounts tag. */ if (!TIFFFieldSet(tif, FIELD_STRIPBYTECOUNTS)) { /* * Some manufacturers violate the spec by not giving * the size of the strips. In this case, assume there * is one uncompressed strip of data. */ if ((td->td_planarconfig == PLANARCONFIG_CONTIG && td->td_nstrips > 1) || (td->td_planarconfig == PLANARCONFIG_SEPARATE && td->td_nstrips != td->td_samplesperpixel)) { MissingRequired(tif, "StripByteCounts"); goto bad; } TIFFWarningExt(tif->tif_clientdata, module, "%s: TIFF directory is missing required " "\"%s\" field, calculating from imagelength", tif->tif_name, _TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name); if (EstimateStripByteCounts(tif, dir, dircount) < 0) goto bad; /* * Assume we have wrong StripByteCount value (in case * of single strip) in following cases: * - it is equal to zero along with StripOffset; * - it is larger than file itself (in case of uncompressed * image); * - it is smaller than the size of the bytes per row * multiplied on the number of rows. The last case should * not be checked in the case of writing new image, * because we may do not know the exact strip size * until the whole image will be written and directory * dumped out. */ #define BYTECOUNTLOOKSBAD \ ( (td->td_stripbytecount[0] == 0 && td->td_stripoffset[0] != 0) || \ (td->td_compression == COMPRESSION_NONE && \ td->td_stripbytecount[0] > TIFFGetFileSize(tif) - td->td_stripoffset[0]) || \ (tif->tif_mode == O_RDONLY && \ td->td_compression == COMPRESSION_NONE && \ td->td_stripbytecount[0] < TIFFScanlineSize(tif) * td->td_imagelength) ) } else if (td->td_nstrips == 1 && td->td_stripoffset[0] != 0 && BYTECOUNTLOOKSBAD) { /* * XXX: Plexus (and others) sometimes give a value of * zero for a tag when they don't know what the * correct value is! Try and handle the simple case * of estimating the size of a one strip image. */ TIFFWarningExt(tif->tif_clientdata, module, "%s: Bogus \"%s\" field, ignoring and calculating from imagelength", tif->tif_name, _TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name); if(EstimateStripByteCounts(tif, dir, dircount) < 0) goto bad; } else if (td->td_planarconfig == PLANARCONFIG_CONTIG && td->td_nstrips > 2 && td->td_compression == COMPRESSION_NONE && td->td_stripbytecount[0] != td->td_stripbytecount[1] && td->td_stripbytecount[0] != 0 && td->td_stripbytecount[1] != 0 ) { /* * XXX: Some vendors fill StripByteCount array with * absolutely wrong values (it can be equal to * StripOffset array, for example). Catch this case * here. */ TIFFWarningExt(tif->tif_clientdata, module, "%s: Wrong \"%s\" field, ignoring and calculating from imagelength", tif->tif_name, _TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name); if (EstimateStripByteCounts(tif, dir, dircount) < 0) goto bad; } } if (dir) { _TIFFfree((char *)dir); dir = NULL; } if (!TIFFFieldSet(tif, FIELD_MAXSAMPLEVALUE)) td->td_maxsamplevalue = (uint16)((1L<<td->td_bitspersample)-1); /* * Setup default compression scheme. */ /* * XXX: We can optimize checking for the strip bounds using the sorted * bytecounts array. See also comments for TIFFAppendToStrip() * function in tif_write.c. */ if (td->td_nstrips > 1) { tstrip_t strip; td->td_stripbytecountsorted = 1; for (strip = 1; strip < td->td_nstrips; strip++) { if (td->td_stripoffset[strip - 1] > td->td_stripoffset[strip]) { td->td_stripbytecountsorted = 0; break; } } } if (!TIFFFieldSet(tif, FIELD_COMPRESSION)) TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE); /* * Some manufacturers make life difficult by writing * large amounts of uncompressed data as a single strip. * This is contrary to the recommendations of the spec. * The following makes an attempt at breaking such images * into strips closer to the recommended 8k bytes. A * side effect, however, is that the RowsPerStrip tag * value may be changed. */ if (td->td_nstrips == 1 && td->td_compression == COMPRESSION_NONE && (tif->tif_flags & (TIFF_STRIPCHOP|TIFF_ISTILED)) == TIFF_STRIPCHOP) ChopUpSingleUncompressedStrip(tif); /* * Reinitialize i/o since we are starting on a new directory. */ tif->tif_row = (uint32) -1; tif->tif_curstrip = (tstrip_t) -1; tif->tif_col = (uint32) -1; tif->tif_curtile = (ttile_t) -1; tif->tif_tilesize = (tsize_t) -1; tif->tif_scanlinesize = TIFFScanlineSize(tif); if (!tif->tif_scanlinesize) { TIFFErrorExt(tif->tif_clientdata, module, "%s: cannot handle zero scanline size", tif->tif_name); return (0); } if (isTiled(tif)) { tif->tif_tilesize = TIFFTileSize(tif); if (!tif->tif_tilesize) { TIFFErrorExt(tif->tif_clientdata, module, "%s: cannot handle zero tile size", tif->tif_name); return (0); } } else { if (!TIFFStripSize(tif)) { TIFFErrorExt(tif->tif_clientdata, module, "%s: cannot handle zero strip size", tif->tif_name); return (0); } } return (1); bad: if (dir) _TIFFfree(dir); return (0); } static TIFFDirEntry* TIFFReadDirectoryFind(TIFFDirEntry* dir, uint16 dircount, uint16 tagid) { TIFFDirEntry* m; uint16 n; for (m=dir, n=0; n<dircount; m++, n++) { if (m->tdir_tag==tagid) return(m); } return(0); } /* * Read custom directory from the arbitarry offset. * The code is very similar to TIFFReadDirectory(). */ int TIFFReadCustomDirectory(TIFF* tif, toff_t diroff, const TIFFFieldInfo info[], size_t n) { static const char module[] = "TIFFReadCustomDirectory"; TIFFDirectory* td = &tif->tif_dir; TIFFDirEntry *dp, *dir = NULL; const TIFFFieldInfo* fip; size_t fix; uint16 i, dircount; _TIFFSetupFieldInfo(tif, info, n); dircount = TIFFFetchDirectory(tif, diroff, &dir, NULL); if (!dircount) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Failed to read custom directory at offset %u", tif->tif_name, diroff); return 0; } TIFFFreeDirectory(tif); _TIFFmemset(&tif->tif_dir, 0, sizeof(TIFFDirectory)); fix = 0; for (dp = dir, i = dircount; i > 0; i--, dp++) { if (tif->tif_flags & TIFF_SWAB) { TIFFSwabArrayOfShort(&dp->tdir_tag, 2); TIFFSwabArrayOfLong(&dp->tdir_count, 2); } if (fix >= tif->tif_nfields || dp->tdir_tag == IGNORE) continue; while (fix < tif->tif_nfields && tif->tif_fieldinfo[fix]->field_tag < dp->tdir_tag) fix++; if (fix >= tif->tif_nfields || tif->tif_fieldinfo[fix]->field_tag != dp->tdir_tag) { TIFFWarningExt(tif->tif_clientdata, module, "%s: unknown field with tag %d (0x%x) encountered", tif->tif_name, dp->tdir_tag, dp->tdir_tag); if (!_TIFFMergeFieldInfo(tif, _TIFFCreateAnonFieldInfo(tif, dp->tdir_tag, (TIFFDataType) dp->tdir_type), 1)) { TIFFWarningExt(tif->tif_clientdata, module, "Registering anonymous field with tag %d (0x%x) failed", dp->tdir_tag, dp->tdir_tag); goto ignore; } fix = 0; while (fix < tif->tif_nfields && tif->tif_fieldinfo[fix]->field_tag < dp->tdir_tag) fix++; } /* * Null out old tags that we ignore. */ if (tif->tif_fieldinfo[fix]->field_bit == FIELD_IGNORE) { ignore: dp->tdir_tag = IGNORE; continue; } /* * Check data type. */ fip = tif->tif_fieldinfo[fix]; while (dp->tdir_type != (unsigned short) fip->field_type && fix < tif->tif_nfields) { if (fip->field_type == TIFF_ANY) /* wildcard */ break; fip = tif->tif_fieldinfo[++fix]; if (fix >= tif->tif_nfields || fip->field_tag != dp->tdir_tag) { TIFFWarningExt(tif->tif_clientdata, module, "%s: wrong data type %d for \"%s\"; tag ignored", tif->tif_name, dp->tdir_type, tif->tif_fieldinfo[fix-1]->field_name); goto ignore; } } /* * Check count if known in advance. */ if (fip->field_readcount != TIFF_VARIABLE && fip->field_readcount != TIFF_VARIABLE2) { uint32 expected = (fip->field_readcount == TIFF_SPP) ? (uint32) td->td_samplesperpixel : (uint32) fip->field_readcount; if (!CheckDirCount(tif, dp, expected)) goto ignore; } /* * EXIF tags which need to be specifically processed. */ switch (dp->tdir_tag) { case EXIFTAG_SUBJECTDISTANCE: (void) TIFFFetchSubjectDistance(tif, dp); break; default: (void) TIFFFetchNormalTag(tif, dp); break; } } if (dir) _TIFFfree(dir); return 1; } /* * EXIF is important special case of custom IFD, so we have a special * function to read it. */ int TIFFReadEXIFDirectory(TIFF* tif, toff_t diroff) { size_t exifFieldInfoCount; const TIFFFieldInfo *exifFieldInfo = _TIFFGetExifFieldInfo(&exifFieldInfoCount); return TIFFReadCustomDirectory(tif, diroff, exifFieldInfo, exifFieldInfoCount); } static int EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount) { static const char module[] = "EstimateStripByteCounts"; TIFFDirEntry *dp; TIFFDirectory *td = &tif->tif_dir; uint32 strip; if (td->td_stripbytecount) _TIFFfree(td->td_stripbytecount); td->td_stripbytecount = (uint32*) _TIFFCheckMalloc(tif, td->td_nstrips, sizeof (uint32), "for \"StripByteCounts\" array"); if( td->td_stripbytecount == NULL ) return -1; if (td->td_compression != COMPRESSION_NONE) { uint32 space = (uint32)(sizeof (TIFFHeader) + sizeof (uint16) + (dircount * sizeof (TIFFDirEntry)) + sizeof (uint32)); toff_t filesize = TIFFGetFileSize(tif); uint16 n; /* calculate amount of space used by indirect values */ for (dp = dir, n = dircount; n > 0; n--, dp++) { uint32 cc = TIFFDataWidth((TIFFDataType) dp->tdir_type); if (cc == 0) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Cannot determine size of unknown tag type %d", tif->tif_name, dp->tdir_type); return -1; } cc = cc * dp->tdir_count; if (cc > sizeof (uint32)) space += cc; } space = filesize - space; if (td->td_planarconfig == PLANARCONFIG_SEPARATE) space /= td->td_samplesperpixel; for (strip = 0; strip < td->td_nstrips; strip++) td->td_stripbytecount[strip] = space; /* * This gross hack handles the case were the offset to * the last strip is past the place where we think the strip * should begin. Since a strip of data must be contiguous, * it's safe to assume that we've overestimated the amount * of data in the strip and trim this number back accordingly. */ strip--; if (((toff_t)(td->td_stripoffset[strip]+ td->td_stripbytecount[strip])) > filesize) td->td_stripbytecount[strip] = filesize - td->td_stripoffset[strip]; } else if (isTiled(tif)) { uint32 bytespertile = TIFFTileSize(tif); for (strip = 0; strip < td->td_nstrips; strip++) td->td_stripbytecount[strip] = bytespertile; } else { uint32 rowbytes = TIFFScanlineSize(tif); uint32 rowsperstrip = td->td_imagelength/td->td_stripsperimage; for (strip = 0; strip < td->td_nstrips; strip++) td->td_stripbytecount[strip] = rowbytes * rowsperstrip; } TIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS); if (!TIFFFieldSet(tif, FIELD_ROWSPERSTRIP)) td->td_rowsperstrip = td->td_imagelength; return 1; } static void MissingRequired(TIFF* tif, const char* tagname) { static const char module[] = "MissingRequired"; TIFFErrorExt(tif->tif_clientdata, module, "%s: TIFF directory is missing required \"%s\" field", tif->tif_name, tagname); } /* * Check the directory offset against the list of already seen directory * offsets. This is a trick to prevent IFD looping. The one can create TIFF * file with looped directory pointers. We will maintain a list of already * seen directories and check every IFD offset against that list. */ static int TIFFCheckDirOffset(TIFF* tif, toff_t diroff) { uint16 n; if (diroff == 0) /* no more directories */ return 0; for (n = 0; n < tif->tif_dirnumber && tif->tif_dirlist; n++) { if (tif->tif_dirlist[n] == diroff) return 0; } tif->tif_dirnumber++; if (tif->tif_dirnumber > tif->tif_dirlistsize) { toff_t* new_dirlist; /* * XXX: Reduce memory allocation granularity of the dirlist * array. */ new_dirlist = (toff_t *)_TIFFCheckRealloc(tif, tif->tif_dirlist, tif->tif_dirnumber, 2 * sizeof(toff_t), "for IFD list"); if (!new_dirlist) return 0; tif->tif_dirlistsize = 2 * tif->tif_dirnumber; tif->tif_dirlist = new_dirlist; } tif->tif_dirlist[tif->tif_dirnumber - 1] = diroff; return 1; } /* * Check the count field of a directory entry against a known value. The * caller is expected to skip/ignore the tag if there is a mismatch. */ static int CheckDirCount(TIFF* tif, TIFFDirEntry* dir, uint32 count) { if (count > dir->tdir_count) { TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "incorrect count for field \"%s\" (%u, expecting %u); tag ignored", _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name, dir->tdir_count, count); return (0); } else if (count < dir->tdir_count) { TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "incorrect count for field \"%s\" (%u, expecting %u); tag trimmed", _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name, dir->tdir_count, count); return (1); } return (1); } /* * Read IFD structure from the specified offset. If the pointer to * nextdiroff variable has been specified, read it too. Function returns a * number of fields in the directory or 0 if failed. */ static uint16 TIFFFetchDirectory(TIFF* tif, toff_t diroff, TIFFDirEntry **pdir, toff_t *nextdiroff) { static const char module[] = "TIFFFetchDirectory"; TIFFDirEntry *dir; uint16 dircount; assert(pdir); tif->tif_diroff = diroff; if (nextdiroff) *nextdiroff = 0; if (!isMapped(tif)) { if (!SeekOK(tif, tif->tif_diroff)) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Seek error accessing TIFF directory", tif->tif_name); return 0; } if (!ReadOK(tif, &dircount, sizeof (uint16))) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Can not read TIFF directory count", tif->tif_name); return 0; } if (tif->tif_flags & TIFF_SWAB) TIFFSwabShort(&dircount); dir = (TIFFDirEntry *)_TIFFCheckMalloc(tif, dircount, sizeof (TIFFDirEntry), "to read TIFF directory"); if (dir == NULL) return 0; if (!ReadOK(tif, dir, dircount*sizeof (TIFFDirEntry))) { TIFFErrorExt(tif->tif_clientdata, module, "%.100s: Can not read TIFF directory", tif->tif_name); _TIFFfree(dir); return 0; } /* * Read offset to next directory for sequential scans if * needed. */ if (nextdiroff) (void) ReadOK(tif, nextdiroff, sizeof(uint32)); } else { toff_t off = tif->tif_diroff; /* * Check for integer overflow when validating the dir_off, * otherwise a very high offset may cause an OOB read and * crash the client. Make two comparisons instead of * * off + sizeof(uint16) > tif->tif_size * * to avoid overflow. */ if (tif->tif_size < sizeof (uint16) || off > tif->tif_size - sizeof(uint16)) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Can not read TIFF directory count", tif->tif_name); return 0; } else { _TIFFmemcpy(&dircount, tif->tif_base + off, sizeof(uint16)); } off += sizeof (uint16); if (tif->tif_flags & TIFF_SWAB) TIFFSwabShort(&dircount); dir = (TIFFDirEntry *)_TIFFCheckMalloc(tif, dircount, sizeof(TIFFDirEntry), "to read TIFF directory"); if (dir == NULL) return 0; if (off + dircount * sizeof (TIFFDirEntry) > tif->tif_size) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Can not read TIFF directory", tif->tif_name); _TIFFfree(dir); return 0; } else { _TIFFmemcpy(dir, tif->tif_base + off, dircount * sizeof(TIFFDirEntry)); } if (nextdiroff) { off += dircount * sizeof (TIFFDirEntry); if (off + sizeof (uint32) <= tif->tif_size) { _TIFFmemcpy(nextdiroff, tif->tif_base + off, sizeof (uint32)); } } } if (nextdiroff && tif->tif_flags & TIFF_SWAB) TIFFSwabLong(nextdiroff); *pdir = dir; return dircount; } /* * Fetch a contiguous directory item. */ static tsize_t TIFFFetchData(TIFF* tif, TIFFDirEntry* dir, char* cp) { uint32 w = TIFFDataWidth((TIFFDataType) dir->tdir_type); /* * FIXME: butecount should have tsize_t type, but for now libtiff * defines tsize_t as a signed 32-bit integer and we are losing * ability to read arrays larger than 2^31 bytes. So we are using * uint32 instead of tsize_t here. */ uint32 cc = dir->tdir_count * w; /* Check for overflow. */ if (!dir->tdir_count || !w || cc / w != dir->tdir_count) goto bad; if (!isMapped(tif)) { if (!SeekOK(tif, dir->tdir_offset)) goto bad; if (!ReadOK(tif, cp, cc)) goto bad; } else { /* Check for overflow. */ if (dir->tdir_offset + cc < dir->tdir_offset || dir->tdir_offset + cc < cc || dir->tdir_offset + cc > tif->tif_size) goto bad; _TIFFmemcpy(cp, tif->tif_base + dir->tdir_offset, cc); } if (tif->tif_flags & TIFF_SWAB) { switch (dir->tdir_type) { case TIFF_SHORT: case TIFF_SSHORT: TIFFSwabArrayOfShort((uint16*) cp, dir->tdir_count); break; case TIFF_LONG: case TIFF_SLONG: case TIFF_FLOAT: TIFFSwabArrayOfLong((uint32*) cp, dir->tdir_count); break; case TIFF_RATIONAL: case TIFF_SRATIONAL: TIFFSwabArrayOfLong((uint32*) cp, 2*dir->tdir_count); break; case TIFF_DOUBLE: TIFFSwabArrayOfDouble((double*) cp, dir->tdir_count); break; } } return (cc); bad: TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error fetching data for field \"%s\"", _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name); return (tsize_t) 0; } /* * Fetch an ASCII item from the file. */ static tsize_t TIFFFetchString(TIFF* tif, TIFFDirEntry* dir, char* cp) { if (dir->tdir_count <= 4) { uint32 l = dir->tdir_offset; if (tif->tif_flags & TIFF_SWAB) TIFFSwabLong(&l); _TIFFmemcpy(cp, &l, dir->tdir_count); return (1); } return (TIFFFetchData(tif, dir, cp)); } /* * Convert numerator+denominator to float. */ static int cvtRational(TIFF* tif, TIFFDirEntry* dir, uint32 num, uint32 denom, float* rv) { if (denom == 0) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%s: Rational with zero denominator (num = %u)", _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name, num); return (0); } else { if (dir->tdir_type == TIFF_RATIONAL) *rv = ((float)num / (float)denom); else *rv = ((float)(int32)num / (float)(int32)denom); return (1); } } /* * Fetch a rational item from the file at offset off and return the value as a * floating point number. */ static float TIFFFetchRational(TIFF* tif, TIFFDirEntry* dir) { uint32 l[2]; float v; return (!TIFFFetchData(tif, dir, (char *)l) || !cvtRational(tif, dir, l[0], l[1], &v) ? 1.0f : v); } /* * Fetch a single floating point value from the offset field and return it as * a native float. */ static float TIFFFetchFloat(TIFF* tif, TIFFDirEntry* dir) { float v; int32 l = TIFFExtractData(tif, dir->tdir_type, dir->tdir_offset); _TIFFmemcpy(&v, &l, sizeof(float)); TIFFCvtIEEEFloatToNative(tif, 1, &v); return (v); } /* * Fetch an array of BYTE or SBYTE values. */ static int TIFFFetchByteArray(TIFF* tif, TIFFDirEntry* dir, uint8* v) { if (dir->tdir_count <= 4) { /* * Extract data from offset field. */ if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) { if (dir->tdir_type == TIFF_SBYTE) switch (dir->tdir_count) { case 4: v[3] = dir->tdir_offset & 0xff; case 3: v[2] = (dir->tdir_offset >> 8) & 0xff; case 2: v[1] = (dir->tdir_offset >> 16) & 0xff; case 1: v[0] = dir->tdir_offset >> 24; } else switch (dir->tdir_count) { case 4: v[3] = dir->tdir_offset & 0xff; case 3: v[2] = (dir->tdir_offset >> 8) & 0xff; case 2: v[1] = (dir->tdir_offset >> 16) & 0xff; case 1: v[0] = dir->tdir_offset >> 24; } } else { if (dir->tdir_type == TIFF_SBYTE) switch (dir->tdir_count) { case 4: v[3] = dir->tdir_offset >> 24; case 3: v[2] = (dir->tdir_offset >> 16) & 0xff; case 2: v[1] = (dir->tdir_offset >> 8) & 0xff; case 1: v[0] = dir->tdir_offset & 0xff; } else switch (dir->tdir_count) { case 4: v[3] = dir->tdir_offset >> 24; case 3: v[2] = (dir->tdir_offset >> 16) & 0xff; case 2: v[1] = (dir->tdir_offset >> 8) & 0xff; case 1: v[0] = dir->tdir_offset & 0xff; } } return (1); } else return (TIFFFetchData(tif, dir, (char*) v) != 0); /* XXX */ } /* * Fetch an array of SHORT or SSHORT values. */ static int TIFFFetchShortArray(TIFF* tif, TIFFDirEntry* dir, uint16* v) { if (dir->tdir_count <= 2) { if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) { switch (dir->tdir_count) { case 2: v[1] = (uint16) (dir->tdir_offset & 0xffff); case 1: v[0] = (uint16) (dir->tdir_offset >> 16); } } else { switch (dir->tdir_count) { case 2: v[1] = (uint16) (dir->tdir_offset >> 16); case 1: v[0] = (uint16) (dir->tdir_offset & 0xffff); } } return (1); } else return (TIFFFetchData(tif, dir, (char *)v) != 0); } /* * Fetch a pair of SHORT or BYTE values. Some tags may have either BYTE * or SHORT type and this function works with both ones. */ static int TIFFFetchShortPair(TIFF* tif, TIFFDirEntry* dir) { /* * Prevent overflowing the v stack arrays below by performing a sanity * check on tdir_count, this should never be greater than two. */ if (dir->tdir_count > 2) { TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "unexpected count for field \"%s\", %u, expected 2; ignored", _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name, dir->tdir_count); return 0; } switch (dir->tdir_type) { case TIFF_BYTE: case TIFF_SBYTE: { uint8 v[4]; return TIFFFetchByteArray(tif, dir, v) && TIFFSetField(tif, dir->tdir_tag, v[0], v[1]); } case TIFF_SHORT: case TIFF_SSHORT: { uint16 v[2]; return TIFFFetchShortArray(tif, dir, v) && TIFFSetField(tif, dir->tdir_tag, v[0], v[1]); } default: return 0; } } /* * Fetch an array of LONG or SLONG values. */ static int TIFFFetchLongArray(TIFF* tif, TIFFDirEntry* dir, uint32* v) { if (dir->tdir_count == 1) { v[0] = dir->tdir_offset; return (1); } else return (TIFFFetchData(tif, dir, (char*) v) != 0); } /* * Fetch an array of RATIONAL or SRATIONAL values. */ static int TIFFFetchRationalArray(TIFF* tif, TIFFDirEntry* dir, float* v) { int ok = 0; uint32* l; l = (uint32*)_TIFFCheckMalloc(tif, dir->tdir_count, TIFFDataWidth((TIFFDataType) dir->tdir_type), "to fetch array of rationals"); if (l) { if (TIFFFetchData(tif, dir, (char *)l)) { uint32 i; for (i = 0; i < dir->tdir_count; i++) { ok = cvtRational(tif, dir, l[2*i+0], l[2*i+1], &v[i]); if (!ok) break; } } _TIFFfree((char *)l); } return (ok); } /* * Fetch an array of FLOAT values. */ static int TIFFFetchFloatArray(TIFF* tif, TIFFDirEntry* dir, float* v) { if (dir->tdir_count == 1) { union { float f; uint32 i; } float_union; float_union.i=dir->tdir_offset; v[0]=float_union.f; TIFFCvtIEEEFloatToNative(tif, dir->tdir_count, v); return (1); } else if (TIFFFetchData(tif, dir, (char*) v)) { TIFFCvtIEEEFloatToNative(tif, dir->tdir_count, v); return (1); } else return (0); } /* * Fetch an array of DOUBLE values. */ static int TIFFFetchDoubleArray(TIFF* tif, TIFFDirEntry* dir, double* v) { if (TIFFFetchData(tif, dir, (char*) v)) { TIFFCvtIEEEDoubleToNative(tif, dir->tdir_count, v); return (1); } else return (0); } /* * Fetch an array of ANY values. The actual values are returned as doubles * which should be able hold all the types. Yes, there really should be an * tany_t to avoid this potential non-portability ... Note in particular that * we assume that the double return value vector is large enough to read in * any fundamental type. We use that vector as a buffer to read in the base * type vector and then convert it in place to double (from end to front of * course). */ static int TIFFFetchAnyArray(TIFF* tif, TIFFDirEntry* dir, double* v) { int i; switch (dir->tdir_type) { case TIFF_BYTE: case TIFF_SBYTE: if (!TIFFFetchByteArray(tif, dir, (uint8*) v)) return (0); if (dir->tdir_type == TIFF_BYTE) { uint8* vp = (uint8*) v; for (i = dir->tdir_count-1; i >= 0; i--) v[i] = vp[i]; } else { int8* vp = (int8*) v; for (i = dir->tdir_count-1; i >= 0; i--) v[i] = vp[i]; } break; case TIFF_SHORT: case TIFF_SSHORT: if (!TIFFFetchShortArray(tif, dir, (uint16*) v)) return (0); if (dir->tdir_type == TIFF_SHORT) { uint16* vp = (uint16*) v; for (i = dir->tdir_count-1; i >= 0; i--) v[i] = vp[i]; } else { int16* vp = (int16*) v; for (i = dir->tdir_count-1; i >= 0; i--) v[i] = vp[i]; } break; case TIFF_LONG: case TIFF_SLONG: if (!TIFFFetchLongArray(tif, dir, (uint32*) v)) return (0); if (dir->tdir_type == TIFF_LONG) { uint32* vp = (uint32*) v; for (i = dir->tdir_count-1; i >= 0; i--) v[i] = vp[i]; } else { int32* vp = (int32*) v; for (i = dir->tdir_count-1; i >= 0; i--) v[i] = vp[i]; } break; case TIFF_RATIONAL: case TIFF_SRATIONAL: if (!TIFFFetchRationalArray(tif, dir, (float*) v)) return (0); { float* vp = (float*) v; for (i = dir->tdir_count-1; i >= 0; i--) v[i] = vp[i]; } break; case TIFF_FLOAT: if (!TIFFFetchFloatArray(tif, dir, (float*) v)) return (0); { float* vp = (float*) v; for (i = dir->tdir_count-1; i >= 0; i--) v[i] = vp[i]; } break; case TIFF_DOUBLE: return (TIFFFetchDoubleArray(tif, dir, (double*) v)); default: /* TIFF_NOTYPE */ /* TIFF_ASCII */ /* TIFF_UNDEFINED */ TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "cannot read TIFF_ANY type %d for field \"%s\"", dir->tdir_type, _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name); return (0); } return (1); } /* * Fetch a tag that is not handled by special case code. */ static int TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp) { static const char mesg[] = "to fetch tag value"; int ok = 0; const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, dp->tdir_tag); if (dp->tdir_count > 1) { /* array of values */ char* cp = NULL; switch (dp->tdir_type) { case TIFF_BYTE: case TIFF_SBYTE: cp = (char *)_TIFFCheckMalloc(tif, dp->tdir_count, sizeof (uint8), mesg); ok = cp && TIFFFetchByteArray(tif, dp, (uint8*) cp); break; case TIFF_SHORT: case TIFF_SSHORT: cp = (char *)_TIFFCheckMalloc(tif, dp->tdir_count, sizeof (uint16), mesg); ok = cp && TIFFFetchShortArray(tif, dp, (uint16*) cp); break; case TIFF_LONG: case TIFF_SLONG: cp = (char *)_TIFFCheckMalloc(tif, dp->tdir_count, sizeof (uint32), mesg); ok = cp && TIFFFetchLongArray(tif, dp, (uint32*) cp); break; case TIFF_RATIONAL: case TIFF_SRATIONAL: cp = (char *)_TIFFCheckMalloc(tif, dp->tdir_count, sizeof (float), mesg); ok = cp && TIFFFetchRationalArray(tif, dp, (float*) cp); break; case TIFF_FLOAT: cp = (char *)_TIFFCheckMalloc(tif, dp->tdir_count, sizeof (float), mesg); ok = cp && TIFFFetchFloatArray(tif, dp, (float*) cp); break; case TIFF_DOUBLE: cp = (char *)_TIFFCheckMalloc(tif, dp->tdir_count, sizeof (double), mesg); ok = cp && TIFFFetchDoubleArray(tif, dp, (double*) cp); break; case TIFF_ASCII: case TIFF_UNDEFINED: /* bit of a cheat... */ /* * Some vendors write strings w/o the trailing * NULL byte, so always append one just in case. */ cp = (char *)_TIFFCheckMalloc(tif, dp->tdir_count + 1, 1, mesg); if( (ok = (cp && TIFFFetchString(tif, dp, cp))) != 0 ) cp[dp->tdir_count] = '\0'; /* XXX */ break; } if (ok) { ok = (fip->field_passcount ? TIFFSetField(tif, dp->tdir_tag, dp->tdir_count, cp) : TIFFSetField(tif, dp->tdir_tag, cp)); } if (cp != NULL) _TIFFfree(cp); } else if (CheckDirCount(tif, dp, 1)) { /* singleton value */ switch (dp->tdir_type) { case TIFF_BYTE: case TIFF_SBYTE: case TIFF_SHORT: case TIFF_SSHORT: /* * If the tag is also acceptable as a LONG or SLONG * then TIFFSetField will expect an uint32 parameter * passed to it (through varargs). Thus, for machines * where sizeof (int) != sizeof (uint32) we must do * a careful check here. It's hard to say if this * is worth optimizing. * * NB: We use TIFFFieldWithTag here knowing that * it returns us the first entry in the table * for the tag and that that entry is for the * widest potential data type the tag may have. */ { TIFFDataType type = fip->field_type; if (type != TIFF_LONG && type != TIFF_SLONG) { uint16 v = (uint16) TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset); ok = (fip->field_passcount ? TIFFSetField(tif, dp->tdir_tag, 1, &v) : TIFFSetField(tif, dp->tdir_tag, v)); break; } } /* fall thru... */ case TIFF_LONG: case TIFF_SLONG: { uint32 v32 = TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset); ok = (fip->field_passcount ? TIFFSetField(tif, dp->tdir_tag, 1, &v32) : TIFFSetField(tif, dp->tdir_tag, v32)); } break; case TIFF_RATIONAL: case TIFF_SRATIONAL: case TIFF_FLOAT: { float v = (dp->tdir_type == TIFF_FLOAT ? TIFFFetchFloat(tif, dp) : TIFFFetchRational(tif, dp)); ok = (fip->field_passcount ? TIFFSetField(tif, dp->tdir_tag, 1, &v) : TIFFSetField(tif, dp->tdir_tag, v)); } break; case TIFF_DOUBLE: { double v; ok = (TIFFFetchDoubleArray(tif, dp, &v) && (fip->field_passcount ? TIFFSetField(tif, dp->tdir_tag, 1, &v) : TIFFSetField(tif, dp->tdir_tag, v)) ); } break; case TIFF_ASCII: case TIFF_UNDEFINED: /* bit of a cheat... */ { char c[2]; if( (ok = (TIFFFetchString(tif, dp, c) != 0)) != 0 ) { c[1] = '\0'; /* XXX paranoid */ ok = (fip->field_passcount ? TIFFSetField(tif, dp->tdir_tag, 1, c) : TIFFSetField(tif, dp->tdir_tag, c)); } } break; } } return (ok); } #define NITEMS(x) (sizeof (x) / sizeof (x[0])) /* * Fetch samples/pixel short values for * the specified tag and verify that * all values are the same. */ static int TIFFFetchPerSampleShorts(TIFF* tif, TIFFDirEntry* dir, uint16* pl) { uint16 samples = tif->tif_dir.td_samplesperpixel; int status = 0; if (CheckDirCount(tif, dir, (uint32) samples)) { uint16 buf[10]; uint16* v = buf; if (dir->tdir_count > NITEMS(buf)) v = (uint16*) _TIFFCheckMalloc(tif, dir->tdir_count, sizeof(uint16), "to fetch per-sample values"); if (v && TIFFFetchShortArray(tif, dir, v)) { uint16 i; int check_count = dir->tdir_count; if( samples < check_count ) check_count = samples; for (i = 1; i < check_count; i++) if (v[i] != v[0]) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Cannot handle different per-sample values for field \"%s\"", _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name); goto bad; } *pl = v[0]; status = 1; } bad: if (v && v != buf) _TIFFfree(v); } return (status); } /* * Fetch samples/pixel long values for * the specified tag and verify that * all values are the same. */ static int TIFFFetchPerSampleLongs(TIFF* tif, TIFFDirEntry* dir, uint32* pl) { uint16 samples = tif->tif_dir.td_samplesperpixel; int status = 0; if (CheckDirCount(tif, dir, (uint32) samples)) { uint32 buf[10]; uint32* v = buf; if (dir->tdir_count > NITEMS(buf)) v = (uint32*) _TIFFCheckMalloc(tif, dir->tdir_count, sizeof(uint32), "to fetch per-sample values"); if (v && TIFFFetchLongArray(tif, dir, v)) { uint16 i; int check_count = dir->tdir_count; if( samples < check_count ) check_count = samples; for (i = 1; i < check_count; i++) if (v[i] != v[0]) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Cannot handle different per-sample values for field \"%s\"", _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name); goto bad; } *pl = v[0]; status = 1; } bad: if (v && v != buf) _TIFFfree(v); } return (status); } /* * Fetch samples/pixel ANY values for the specified tag and verify that all * values are the same. */ static int TIFFFetchPerSampleAnys(TIFF* tif, TIFFDirEntry* dir, double* pl) { uint16 samples = tif->tif_dir.td_samplesperpixel; int status = 0; if (CheckDirCount(tif, dir, (uint32) samples)) { double buf[10]; double* v = buf; if (dir->tdir_count > NITEMS(buf)) v = (double*) _TIFFCheckMalloc(tif, dir->tdir_count, sizeof (double), "to fetch per-sample values"); if (v && TIFFFetchAnyArray(tif, dir, v)) { uint16 i; int check_count = dir->tdir_count; if( samples < check_count ) check_count = samples; for (i = 1; i < check_count; i++) if (v[i] != v[0]) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Cannot handle different per-sample values for field \"%s\"", _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name); goto bad; } *pl = v[0]; status = 1; } bad: if (v && v != buf) _TIFFfree(v); } return (status); } #undef NITEMS /* * Fetch a set of offsets or lengths. * While this routine says "strips", in fact it's also used for tiles. */ static int TIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, long nstrips, uint32** lpp) { register uint32* lp; int status; CheckDirCount(tif, dir, (uint32) nstrips); /* * Allocate space for strip information. */ if (*lpp == NULL && (*lpp = (uint32 *)_TIFFCheckMalloc(tif, nstrips, sizeof (uint32), "for strip array")) == NULL) return (0); lp = *lpp; _TIFFmemset( lp, 0, sizeof(uint32) * nstrips ); if (dir->tdir_type == (int)TIFF_SHORT) { /* * Handle uint16->uint32 expansion. */ uint16* dp = (uint16*) _TIFFCheckMalloc(tif, dir->tdir_count, sizeof (uint16), "to fetch strip tag"); if (dp == NULL) return (0); if( (status = TIFFFetchShortArray(tif, dir, dp)) != 0 ) { int i; for( i = 0; i < nstrips && i < (int) dir->tdir_count; i++ ) { lp[i] = dp[i]; } } _TIFFfree((char*) dp); } else if( nstrips != (int) dir->tdir_count ) { /* Special case to correct length */ uint32* dp = (uint32*) _TIFFCheckMalloc(tif, dir->tdir_count, sizeof (uint32), "to fetch strip tag"); if (dp == NULL) return (0); status = TIFFFetchLongArray(tif, dir, dp); if( status != 0 ) { int i; for( i = 0; i < nstrips && i < (int) dir->tdir_count; i++ ) { lp[i] = dp[i]; } } _TIFFfree( (char *) dp ); } else status = TIFFFetchLongArray(tif, dir, lp); return (status); } /* * Fetch and set the RefBlackWhite tag. */ static int TIFFFetchRefBlackWhite(TIFF* tif, TIFFDirEntry* dir) { static const char mesg[] = "for \"ReferenceBlackWhite\" array"; char* cp; int ok; if (dir->tdir_type == TIFF_RATIONAL) return (TIFFFetchNormalTag(tif, dir)); /* * Handle LONG's for backward compatibility. */ cp = (char *)_TIFFCheckMalloc(tif, dir->tdir_count, sizeof (uint32), mesg); if( (ok = (cp && TIFFFetchLongArray(tif, dir, (uint32*) cp))) != 0) { float* fp = (float*) _TIFFCheckMalloc(tif, dir->tdir_count, sizeof (float), mesg); if( (ok = (fp != NULL)) != 0 ) { uint32 i; for (i = 0; i < dir->tdir_count; i++) fp[i] = (float)((uint32*) cp)[i]; ok = TIFFSetField(tif, dir->tdir_tag, fp); _TIFFfree((char*) fp); } } if (cp) _TIFFfree(cp); return (ok); } /* * Fetch and set the SubjectDistance EXIF tag. */ static int TIFFFetchSubjectDistance(TIFF* tif, TIFFDirEntry* dir) { uint32 l[2]; float v; int ok = 0; if (TIFFFetchData(tif, dir, (char *)l) && cvtRational(tif, dir, l[0], l[1], &v)) { /* * XXX: Numerator 0xFFFFFFFF means that we have infinite * distance. Indicate that with a negative floating point * SubjectDistance value. */ ok = TIFFSetField(tif, dir->tdir_tag, (l[0] != 0xFFFFFFFF) ? v : -v); } return ok; } /* * Replace a single strip (tile) of uncompressed data by multiple strips * (tiles), each approximately STRIP_SIZE_DEFAULT bytes. This is useful for * dealing with large images or for dealing with machines with a limited * amount memory. */ static void ChopUpSingleUncompressedStrip(TIFF* tif) { register TIFFDirectory *td = &tif->tif_dir; uint32 bytecount = td->td_stripbytecount[0]; uint32 offset = td->td_stripoffset[0]; tsize_t rowbytes = TIFFVTileSize(tif, 1), stripbytes; tstrip_t strip, nstrips, rowsperstrip; uint32* newcounts; uint32* newoffsets; /* * Make the rows hold at least one scanline, but fill specified amount * of data if possible. */ if (rowbytes > STRIP_SIZE_DEFAULT) { stripbytes = rowbytes; rowsperstrip = 1; } else if (rowbytes > 0 ) { rowsperstrip = STRIP_SIZE_DEFAULT / rowbytes; stripbytes = rowbytes * rowsperstrip; } else return; /* * never increase the number of strips in an image */ if (rowsperstrip >= td->td_rowsperstrip) return; nstrips = (tstrip_t) TIFFhowmany(bytecount, stripbytes); if( nstrips == 0 ) /* something is wonky, do nothing. */ return; newcounts = (uint32*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint32), "for chopped \"StripByteCounts\" array"); newoffsets = (uint32*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint32), "for chopped \"StripOffsets\" array"); if (newcounts == NULL || newoffsets == NULL) { /* * Unable to allocate new strip information, give up and use * the original one strip information. */ if (newcounts != NULL) _TIFFfree(newcounts); if (newoffsets != NULL) _TIFFfree(newoffsets); return; } /* * Fill the strip information arrays with new bytecounts and offsets * that reflect the broken-up format. */ for (strip = 0; strip < nstrips; strip++) { if ((uint32)stripbytes > bytecount) stripbytes = bytecount; newcounts[strip] = stripbytes; newoffsets[strip] = offset; offset += stripbytes; bytecount -= stripbytes; } /* * Replace old single strip info with multi-strip info. */ td->td_stripsperimage = td->td_nstrips = nstrips; TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip); _TIFFfree(td->td_stripbytecount); _TIFFfree(td->td_stripoffset); td->td_stripbytecount = newcounts; td->td_stripoffset = newoffsets; td->td_stripbytecountsorted = 1; } /* vim: set ts=8 sts=8 sw=8 noet: */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_zip.c���������������������������������������������������0000644�0001750�0001750�00000025652�12320456500�021156� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_zip.c,v 1.11.2.3 2007/11/22 21:24:51 fwarmerdam Exp $ */ /* * Copyright (c) 1995-1997 Sam Leffler * Copyright (c) 1995-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "tiffiop.h" #ifdef ZIP_SUPPORT /* * TIFF Library. * * ZIP (aka Deflate) Compression Support * * This file is simply an interface to the zlib library written by * Jean-loup Gailly and Mark Adler. You must use version 1.0 or later * of the library: this code assumes the 1.0 API and also depends on * the ability to write the zlib header multiple times (one per strip) * which was not possible with versions prior to 0.95. Note also that * older versions of this codec avoided this bug by supressing the header * entirely. This means that files written with the old library cannot * be read; they should be converted to a different compression scheme * and then reconverted. * * The data format used by the zlib library is described in the files * zlib-3.1.doc, deflate-1.1.doc and gzip-4.1.doc, available in the * directory ftp://ftp.uu.net/pub/archiving/zip/doc. The library was * last found at ftp://ftp.uu.net/pub/archiving/zip/zlib/zlib-0.99.tar.gz. */ #include "tif_predict.h" #include "zlib.h" #include <stdio.h> /* * Sigh, ZLIB_VERSION is defined as a string so there's no * way to do a proper check here. Instead we guess based * on the presence of #defines that were added between the * 0.95 and 1.0 distributions. */ #if !defined(Z_NO_COMPRESSION) || !defined(Z_DEFLATED) #error "Antiquated ZLIB software; you must use version 1.0 or later" #endif /* * State block for each open TIFF * file using ZIP compression/decompression. */ typedef struct { TIFFPredictorState predict; z_stream stream; int zipquality; /* compression level */ int state; /* state flags */ #define ZSTATE_INIT_DECODE 0x01 #define ZSTATE_INIT_ENCODE 0x02 TIFFVGetMethod vgetparent; /* super-class method */ TIFFVSetMethod vsetparent; /* super-class method */ } ZIPState; #define ZState(tif) ((ZIPState*) (tif)->tif_data) #define DecoderState(tif) ZState(tif) #define EncoderState(tif) ZState(tif) static int ZIPEncode(TIFF*, tidata_t, tsize_t, tsample_t); static int ZIPDecode(TIFF*, tidata_t, tsize_t, tsample_t); static int ZIPSetupDecode(TIFF* tif) { ZIPState* sp = DecoderState(tif); static const char module[] = "ZIPSetupDecode"; assert(sp != NULL); /* if we were last encoding, terminate this mode */ if (sp->state & ZSTATE_INIT_ENCODE) { deflateEnd(&sp->stream); sp->state = 0; } if (inflateInit(&sp->stream) != Z_OK) { TIFFErrorExt(tif->tif_clientdata, module, "%s: %s", tif->tif_name, sp->stream.msg); return (0); } else { sp->state |= ZSTATE_INIT_DECODE; return (1); } } /* * Setup state for decoding a strip. */ static int ZIPPreDecode(TIFF* tif, tsample_t s) { ZIPState* sp = DecoderState(tif); (void) s; assert(sp != NULL); if( (sp->state & ZSTATE_INIT_DECODE) == 0 ) tif->tif_setupdecode( tif ); sp->stream.next_in = tif->tif_rawdata; sp->stream.avail_in = tif->tif_rawcc; return (inflateReset(&sp->stream) == Z_OK); } static int ZIPDecode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s) { ZIPState* sp = DecoderState(tif); static const char module[] = "ZIPDecode"; (void) s; assert(sp != NULL); assert(sp->state == ZSTATE_INIT_DECODE); sp->stream.next_out = op; sp->stream.avail_out = occ; do { int state = inflate(&sp->stream, Z_PARTIAL_FLUSH); if (state == Z_STREAM_END) break; if (state == Z_DATA_ERROR) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Decoding error at scanline %d, %s", tif->tif_name, tif->tif_row, sp->stream.msg); if (inflateSync(&sp->stream) != Z_OK) return (0); continue; } if (state != Z_OK) { TIFFErrorExt(tif->tif_clientdata, module, "%s: zlib error: %s", tif->tif_name, sp->stream.msg); return (0); } } while (sp->stream.avail_out > 0); if (sp->stream.avail_out != 0) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Not enough data at scanline %d (short %d bytes)", tif->tif_name, tif->tif_row, sp->stream.avail_out); return (0); } return (1); } static int ZIPSetupEncode(TIFF* tif) { ZIPState* sp = EncoderState(tif); static const char module[] = "ZIPSetupEncode"; assert(sp != NULL); if (sp->state & ZSTATE_INIT_DECODE) { inflateEnd(&sp->stream); sp->state = 0; } if (deflateInit(&sp->stream, sp->zipquality) != Z_OK) { TIFFErrorExt(tif->tif_clientdata, module, "%s: %s", tif->tif_name, sp->stream.msg); return (0); } else { sp->state |= ZSTATE_INIT_ENCODE; return (1); } } /* * Reset encoding state at the start of a strip. */ static int ZIPPreEncode(TIFF* tif, tsample_t s) { ZIPState *sp = EncoderState(tif); (void) s; assert(sp != NULL); if( sp->state != ZSTATE_INIT_ENCODE ) tif->tif_setupencode( tif ); sp->stream.next_out = tif->tif_rawdata; sp->stream.avail_out = tif->tif_rawdatasize; return (deflateReset(&sp->stream) == Z_OK); } /* * Encode a chunk of pixels. */ static int ZIPEncode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) { ZIPState *sp = EncoderState(tif); static const char module[] = "ZIPEncode"; assert(sp != NULL); assert(sp->state == ZSTATE_INIT_ENCODE); (void) s; sp->stream.next_in = bp; sp->stream.avail_in = cc; do { if (deflate(&sp->stream, Z_NO_FLUSH) != Z_OK) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Encoder error: %s", tif->tif_name, sp->stream.msg); return (0); } if (sp->stream.avail_out == 0) { tif->tif_rawcc = tif->tif_rawdatasize; TIFFFlushData1(tif); sp->stream.next_out = tif->tif_rawdata; sp->stream.avail_out = tif->tif_rawdatasize; } } while (sp->stream.avail_in > 0); return (1); } /* * Finish off an encoded strip by flushing the last * string and tacking on an End Of Information code. */ static int ZIPPostEncode(TIFF* tif) { ZIPState *sp = EncoderState(tif); static const char module[] = "ZIPPostEncode"; int state; sp->stream.avail_in = 0; do { state = deflate(&sp->stream, Z_FINISH); switch (state) { case Z_STREAM_END: case Z_OK: if ((int)sp->stream.avail_out != (int)tif->tif_rawdatasize) { tif->tif_rawcc = tif->tif_rawdatasize - sp->stream.avail_out; TIFFFlushData1(tif); sp->stream.next_out = tif->tif_rawdata; sp->stream.avail_out = tif->tif_rawdatasize; } break; default: TIFFErrorExt(tif->tif_clientdata, module, "%s: zlib error: %s", tif->tif_name, sp->stream.msg); return (0); } } while (state != Z_STREAM_END); return (1); } static void ZIPCleanup(TIFF* tif) { ZIPState* sp = ZState(tif); assert(sp != 0); (void)TIFFPredictorCleanup(tif); tif->tif_tagmethods.vgetfield = sp->vgetparent; tif->tif_tagmethods.vsetfield = sp->vsetparent; if (sp->state & ZSTATE_INIT_ENCODE) { deflateEnd(&sp->stream); sp->state = 0; } else if( sp->state & ZSTATE_INIT_DECODE) { inflateEnd(&sp->stream); sp->state = 0; } _TIFFfree(sp); tif->tif_data = NULL; _TIFFSetDefaultCompressionState(tif); } static int ZIPVSetField(TIFF* tif, ttag_t tag, va_list ap) { ZIPState* sp = ZState(tif); static const char module[] = "ZIPVSetField"; switch (tag) { case TIFFTAG_ZIPQUALITY: sp->zipquality = va_arg(ap, int); if ( sp->state&ZSTATE_INIT_ENCODE ) { if (deflateParams(&sp->stream, sp->zipquality, Z_DEFAULT_STRATEGY) != Z_OK) { TIFFErrorExt(tif->tif_clientdata, module, "%s: zlib error: %s", tif->tif_name, sp->stream.msg); return (0); } } return (1); default: return (*sp->vsetparent)(tif, tag, ap); } /*NOTREACHED*/ } static int ZIPVGetField(TIFF* tif, ttag_t tag, va_list ap) { ZIPState* sp = ZState(tif); switch (tag) { case TIFFTAG_ZIPQUALITY: *va_arg(ap, int*) = sp->zipquality; break; default: return (*sp->vgetparent)(tif, tag, ap); } return (1); } static const TIFFFieldInfo zipFieldInfo[] = { { TIFFTAG_ZIPQUALITY, 0, 0, TIFF_ANY, FIELD_PSEUDO, TRUE, FALSE, "" }, }; int TIFFInitZIP(TIFF* tif, int scheme) { static const char module[] = "TIFFInitZIP"; ZIPState* sp; assert( (scheme == COMPRESSION_DEFLATE) || (scheme == COMPRESSION_ADOBE_DEFLATE)); /* * Merge codec-specific tag information. */ if (!_TIFFMergeFieldInfo(tif, zipFieldInfo, TIFFArrayCount(zipFieldInfo))) { TIFFErrorExt(tif->tif_clientdata, module, "Merging Deflate codec-specific tags failed"); return 0; } /* * Allocate state block so tag methods have storage to record values. */ tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (ZIPState)); if (tif->tif_data == NULL) goto bad; sp = ZState(tif); sp->stream.zalloc = NULL; sp->stream.zfree = NULL; sp->stream.opaque = NULL; sp->stream.data_type = Z_BINARY; /* * Override parent get/set field methods. */ sp->vgetparent = tif->tif_tagmethods.vgetfield; tif->tif_tagmethods.vgetfield = ZIPVGetField; /* hook for codec tags */ sp->vsetparent = tif->tif_tagmethods.vsetfield; tif->tif_tagmethods.vsetfield = ZIPVSetField; /* hook for codec tags */ /* Default values for codec-specific fields */ sp->zipquality = Z_DEFAULT_COMPRESSION; /* default comp. level */ sp->state = 0; /* * Install codec methods. */ tif->tif_setupdecode = ZIPSetupDecode; tif->tif_predecode = ZIPPreDecode; tif->tif_decoderow = ZIPDecode; tif->tif_decodestrip = ZIPDecode; tif->tif_decodetile = ZIPDecode; tif->tif_setupencode = ZIPSetupEncode; tif->tif_preencode = ZIPPreEncode; tif->tif_postencode = ZIPPostEncode; tif->tif_encoderow = ZIPEncode; tif->tif_encodestrip = ZIPEncode; tif->tif_encodetile = ZIPEncode; tif->tif_cleanup = ZIPCleanup; /* * Setup predictor setup. */ (void) TIFFPredictorInit(tif); return (1); bad: TIFFErrorExt(tif->tif_clientdata, module, "No space for ZIP state block"); return (0); } #endif /* ZIP_SUPORT */ /* vim: set ts=8 sts=8 sw=8 noet: */ ��������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_extension.c���������������������������������������������0000644�0001750�0001750�00000006116�12320456500�022362� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_extension.c,v 1.4 2004/10/02 13:29:41 dron Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * Various routines support external extension of the tag set, and other * application extension capabilities. */ #include "tiffiop.h" int TIFFGetTagListCount( TIFF *tif ) { TIFFDirectory* td = &tif->tif_dir; return td->td_customValueCount; } ttag_t TIFFGetTagListEntry( TIFF *tif, int tag_index ) { TIFFDirectory* td = &tif->tif_dir; if( tag_index < 0 || tag_index >= td->td_customValueCount ) return (ttag_t) -1; else return td->td_customValues[tag_index].info->field_tag; } /* ** This provides read/write access to the TIFFTagMethods within the TIFF ** structure to application code without giving access to the private ** TIFF structure. */ TIFFTagMethods *TIFFAccessTagMethods( TIFF *tif ) { return &(tif->tif_tagmethods); } void *TIFFGetClientInfo( TIFF *tif, const char *name ) { TIFFClientInfoLink *link = tif->tif_clientinfo; while( link != NULL && strcmp(link->name,name) != 0 ) link = link->next; if( link != NULL ) return link->data; else return NULL; } void TIFFSetClientInfo( TIFF *tif, void *data, const char *name ) { TIFFClientInfoLink *link = tif->tif_clientinfo; /* ** Do we have an existing link with this name? If so, just ** set it. */ while( link != NULL && strcmp(link->name,name) != 0 ) link = link->next; if( link != NULL ) { link->data = data; return; } /* ** Create a new link. */ link = (TIFFClientInfoLink *) _TIFFmalloc(sizeof(TIFFClientInfoLink)); assert (link != NULL); link->next = tif->tif_clientinfo; link->name = (char *) _TIFFmalloc(strlen(name)+1); assert (link->name != NULL); strcpy(link->name, name); link->data = data; tif->tif_clientinfo = link; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tiffio.h����������������������������������������������������0000644�0001750�0001750�00000047714�12320456500�021002� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tiffio.h,v 1.56.2.3 2009-01-01 00:10:43 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _TIFFIO_ #define _TIFFIO_ /* * TIFF I/O Library Definitions. */ #include "tiff.h" #include "tiffvers.h" /* * TIFF is defined as an incomplete type to hide the * library's internal data structures from clients. */ typedef struct tiff TIFF; /* * The following typedefs define the intrinsic size of * data types used in the *exported* interfaces. These * definitions depend on the proper definition of types * in tiff.h. Note also that the varargs interface used * to pass tag types and values uses the types defined in * tiff.h directly. * * NB: ttag_t is unsigned int and not unsigned short because * ANSI C requires that the type before the ellipsis be a * promoted type (i.e. one of int, unsigned int, pointer, * or double) and because we defined pseudo-tags that are * outside the range of legal Aldus-assigned tags. * NB: tsize_t is int32 and not uint32 because some functions * return -1. * NB: toff_t is not off_t for many reasons; TIFFs max out at * 32-bit file offsets being the most important, and to ensure * that it is unsigned, rather than signed. */ typedef uint32 ttag_t; /* directory tag */ typedef uint16 tdir_t; /* directory index */ typedef uint16 tsample_t; /* sample number */ typedef uint32 tstrile_t; /* strip or tile number */ typedef tstrile_t tstrip_t; /* strip number */ typedef tstrile_t ttile_t; /* tile number */ typedef int32 tsize_t; /* i/o size in bytes */ typedef void* tdata_t; /* image data ref */ typedef uint32 toff_t; /* file offset */ #if !defined(__WIN32__) && (defined(_WIN32) || defined(WIN32)) #define __WIN32__ #endif /* * On windows you should define USE_WIN32_FILEIO if you are using tif_win32.c * or AVOID_WIN32_FILEIO if you are using something else (like tif_unix.c). * * By default tif_unix.c is assumed. */ #if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows) # if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILEIO) # define AVOID_WIN32_FILEIO # endif #endif #if defined(USE_WIN32_FILEIO) # define VC_EXTRALEAN # include <windows.h> # ifdef __WIN32__ DECLARE_HANDLE(thandle_t); /* Win32 file handle */ # else typedef HFILE thandle_t; /* client data handle */ # endif /* __WIN32__ */ #else typedef void* thandle_t; /* client data handle */ #endif /* USE_WIN32_FILEIO */ /* * Flags to pass to TIFFPrintDirectory to control * printing of data structures that are potentially * very large. Bit-or these flags to enable printing * multiple items. */ #define TIFFPRINT_NONE 0x0 /* no extra info */ #define TIFFPRINT_STRIPS 0x1 /* strips/tiles info */ #define TIFFPRINT_CURVES 0x2 /* color/gray response curves */ #define TIFFPRINT_COLORMAP 0x4 /* colormap */ #define TIFFPRINT_JPEGQTABLES 0x100 /* JPEG Q matrices */ #define TIFFPRINT_JPEGACTABLES 0x200 /* JPEG AC tables */ #define TIFFPRINT_JPEGDCTABLES 0x200 /* JPEG DC tables */ /* * Colour conversion stuff */ /* reference white */ #define D65_X0 (95.0470F) #define D65_Y0 (100.0F) #define D65_Z0 (108.8827F) #define D50_X0 (96.4250F) #define D50_Y0 (100.0F) #define D50_Z0 (82.4680F) /* Structure for holding information about a display device. */ typedef unsigned char TIFFRGBValue; /* 8-bit samples */ typedef struct { float d_mat[3][3]; /* XYZ -> luminance matrix */ float d_YCR; /* Light o/p for reference white */ float d_YCG; float d_YCB; uint32 d_Vrwr; /* Pixel values for ref. white */ uint32 d_Vrwg; uint32 d_Vrwb; float d_Y0R; /* Residual light for black pixel */ float d_Y0G; float d_Y0B; float d_gammaR; /* Gamma values for the three guns */ float d_gammaG; float d_gammaB; } TIFFDisplay; typedef struct { /* YCbCr->RGB support */ TIFFRGBValue* clamptab; /* range clamping table */ int* Cr_r_tab; int* Cb_b_tab; int32* Cr_g_tab; int32* Cb_g_tab; int32* Y_tab; } TIFFYCbCrToRGB; typedef struct { /* CIE Lab 1976->RGB support */ int range; /* Size of conversion table */ #define CIELABTORGB_TABLE_RANGE 1500 float rstep, gstep, bstep; float X0, Y0, Z0; /* Reference white point */ TIFFDisplay display; float Yr2r[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yr to r */ float Yg2g[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yg to g */ float Yb2b[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yb to b */ } TIFFCIELabToRGB; /* * RGBA-style image support. */ typedef struct _TIFFRGBAImage TIFFRGBAImage; /* * The image reading and conversion routines invoke * ``put routines'' to copy/image/whatever tiles of * raw image data. A default set of routines are * provided to convert/copy raw image data to 8-bit * packed ABGR format rasters. Applications can supply * alternate routines that unpack the data into a * different format or, for example, unpack the data * and draw the unpacked raster on the display. */ typedef void (*tileContigRoutine) (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32, unsigned char*); typedef void (*tileSeparateRoutine) (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32, unsigned char*, unsigned char*, unsigned char*, unsigned char*); /* * RGBA-reader state. */ struct _TIFFRGBAImage { TIFF* tif; /* image handle */ int stoponerr; /* stop on read error */ int isContig; /* data is packed/separate */ int alpha; /* type of alpha data present */ uint32 width; /* image width */ uint32 height; /* image height */ uint16 bitspersample; /* image bits/sample */ uint16 samplesperpixel; /* image samples/pixel */ uint16 orientation; /* image orientation */ uint16 req_orientation; /* requested orientation */ uint16 photometric; /* image photometric interp */ uint16* redcmap; /* colormap pallete */ uint16* greencmap; uint16* bluecmap; /* get image data routine */ int (*get)(TIFFRGBAImage*, uint32*, uint32, uint32); /* put decoded strip/tile */ union { void (*any)(TIFFRGBAImage*); tileContigRoutine contig; tileSeparateRoutine separate; } put; TIFFRGBValue* Map; /* sample mapping array */ uint32** BWmap; /* black&white map */ uint32** PALmap; /* palette image map */ TIFFYCbCrToRGB* ycbcr; /* YCbCr conversion state */ TIFFCIELabToRGB* cielab; /* CIE L*a*b conversion state */ int row_offset; int col_offset; }; /* * Macros for extracting components from the * packed ABGR form returned by TIFFReadRGBAImage. */ #define TIFFGetR(abgr) ((abgr) & 0xff) #define TIFFGetG(abgr) (((abgr) >> 8) & 0xff) #define TIFFGetB(abgr) (((abgr) >> 16) & 0xff) #define TIFFGetA(abgr) (((abgr) >> 24) & 0xff) /* * A CODEC is a software package that implements decoding, * encoding, or decoding+encoding of a compression algorithm. * The library provides a collection of builtin codecs. * More codecs may be registered through calls to the library * and/or the builtin implementations may be overridden. */ typedef int (*TIFFInitMethod)(TIFF*, int); typedef struct { char* name; uint16 scheme; TIFFInitMethod init; } TIFFCodec; #include <stdio.h> #include <stdarg.h> /* share internal LogLuv conversion routines? */ #ifndef LOGLUV_PUBLIC #define LOGLUV_PUBLIC 1 #endif #if !defined(__GNUC__) && !defined(__attribute__) # define __attribute__(x) /*nothing*/ #endif #if defined(c_plusplus) || defined(__cplusplus) extern "C" { #endif typedef void (*TIFFErrorHandler)(const char*, const char*, va_list); typedef void (*TIFFErrorHandlerExt)(thandle_t, const char*, const char*, va_list); typedef tsize_t (*TIFFReadWriteProc)(thandle_t, tdata_t, tsize_t); typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int); typedef int (*TIFFCloseProc)(thandle_t); typedef toff_t (*TIFFSizeProc)(thandle_t); typedef int (*TIFFMapFileProc)(thandle_t, tdata_t*, toff_t*); typedef void (*TIFFUnmapFileProc)(thandle_t, tdata_t, toff_t); typedef void (*TIFFExtendProc)(TIFF*); extern const char* TIFFGetVersion(void); extern const TIFFCodec* TIFFFindCODEC(uint16); extern TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod); extern void TIFFUnRegisterCODEC(TIFFCodec*); extern int TIFFIsCODECConfigured(uint16); extern TIFFCodec* TIFFGetConfiguredCODECs(void); /* * Auxiliary functions. */ extern tdata_t _TIFFmalloc(tsize_t); extern tdata_t _TIFFrealloc(tdata_t, tsize_t); extern void _TIFFmemset(tdata_t, int, tsize_t); extern void _TIFFmemcpy(tdata_t, const tdata_t, tsize_t); extern int _TIFFmemcmp(const tdata_t, const tdata_t, tsize_t); extern void _TIFFfree(tdata_t); /* ** Stuff, related to tag handling and creating custom tags. */ extern int TIFFGetTagListCount( TIFF * ); extern ttag_t TIFFGetTagListEntry( TIFF *, int tag_index ); #define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */ #define TIFF_VARIABLE -1 /* marker for variable length tags */ #define TIFF_SPP -2 /* marker for SamplesPerPixel tags */ #define TIFF_VARIABLE2 -3 /* marker for uint32 var-length tags */ #define FIELD_CUSTOM 65 typedef struct { ttag_t field_tag; /* field's tag */ short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */ short field_writecount; /* write count/TIFF_VARIABLE */ TIFFDataType field_type; /* type of associated data */ unsigned short field_bit; /* bit in fieldsset bit vector */ unsigned char field_oktochange; /* if true, can change while writing */ unsigned char field_passcount; /* if true, pass dir count on set */ char *field_name; /* ASCII name */ } TIFFFieldInfo; typedef struct _TIFFTagValue { const TIFFFieldInfo *info; int count; void *value; } TIFFTagValue; extern void TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], int); extern const TIFFFieldInfo* TIFFFindFieldInfo(TIFF*, ttag_t, TIFFDataType); extern const TIFFFieldInfo* TIFFFindFieldInfoByName(TIFF* , const char *, TIFFDataType); extern const TIFFFieldInfo* TIFFFieldWithTag(TIFF*, ttag_t); extern const TIFFFieldInfo* TIFFFieldWithName(TIFF*, const char *); typedef int (*TIFFVSetMethod)(TIFF*, ttag_t, va_list); typedef int (*TIFFVGetMethod)(TIFF*, ttag_t, va_list); typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long); typedef struct { TIFFVSetMethod vsetfield; /* tag set routine */ TIFFVGetMethod vgetfield; /* tag get routine */ TIFFPrintMethod printdir; /* directory print routine */ } TIFFTagMethods; extern TIFFTagMethods *TIFFAccessTagMethods( TIFF * ); extern void *TIFFGetClientInfo( TIFF *, const char * ); extern void TIFFSetClientInfo( TIFF *, void *, const char * ); extern void TIFFCleanup(TIFF*); extern void TIFFClose(TIFF*); extern int TIFFFlush(TIFF*); extern int TIFFFlushData(TIFF*); extern int TIFFGetField(TIFF*, ttag_t, ...); extern int TIFFVGetField(TIFF*, ttag_t, va_list); extern int TIFFGetFieldDefaulted(TIFF*, ttag_t, ...); extern int TIFFVGetFieldDefaulted(TIFF*, ttag_t, va_list); extern int TIFFReadDirectory(TIFF*); extern int TIFFReadCustomDirectory(TIFF*, toff_t, const TIFFFieldInfo[], size_t); extern int TIFFReadEXIFDirectory(TIFF*, toff_t); extern tsize_t TIFFScanlineSize(TIFF*); extern tsize_t TIFFOldScanlineSize(TIFF*); extern tsize_t TIFFNewScanlineSize(TIFF*); extern tsize_t TIFFRasterScanlineSize(TIFF*); extern tsize_t TIFFStripSize(TIFF*); extern tsize_t TIFFRawStripSize(TIFF*, tstrip_t); extern tsize_t TIFFVStripSize(TIFF*, uint32); extern tsize_t TIFFTileRowSize(TIFF*); extern tsize_t TIFFTileSize(TIFF*); extern tsize_t TIFFVTileSize(TIFF*, uint32); extern uint32 TIFFDefaultStripSize(TIFF*, uint32); extern void TIFFDefaultTileSize(TIFF*, uint32*, uint32*); extern int TIFFFileno(TIFF*); extern int TIFFSetFileno(TIFF*, int); extern thandle_t TIFFClientdata(TIFF*); extern thandle_t TIFFSetClientdata(TIFF*, thandle_t); extern int TIFFGetMode(TIFF*); extern int TIFFSetMode(TIFF*, int); extern int TIFFIsTiled(TIFF*); extern int TIFFIsByteSwapped(TIFF*); extern int TIFFIsUpSampled(TIFF*); extern int TIFFIsMSB2LSB(TIFF*); extern int TIFFIsBigEndian(TIFF*); extern TIFFReadWriteProc TIFFGetReadProc(TIFF*); extern TIFFReadWriteProc TIFFGetWriteProc(TIFF*); extern TIFFSeekProc TIFFGetSeekProc(TIFF*); extern TIFFCloseProc TIFFGetCloseProc(TIFF*); extern TIFFSizeProc TIFFGetSizeProc(TIFF*); extern TIFFMapFileProc TIFFGetMapFileProc(TIFF*); extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*); extern uint32 TIFFCurrentRow(TIFF*); extern tdir_t TIFFCurrentDirectory(TIFF*); extern tdir_t TIFFNumberOfDirectories(TIFF*); extern uint32 TIFFCurrentDirOffset(TIFF*); extern tstrip_t TIFFCurrentStrip(TIFF*); extern ttile_t TIFFCurrentTile(TIFF*); extern int TIFFReadBufferSetup(TIFF*, tdata_t, tsize_t); extern int TIFFWriteBufferSetup(TIFF*, tdata_t, tsize_t); extern int TIFFSetupStrips(TIFF *); extern int TIFFWriteCheck(TIFF*, int, const char *); extern void TIFFFreeDirectory(TIFF*); extern int TIFFCreateDirectory(TIFF*); extern int TIFFLastDirectory(TIFF*); extern int TIFFSetDirectory(TIFF*, tdir_t); extern int TIFFSetSubDirectory(TIFF*, uint32); extern int TIFFUnlinkDirectory(TIFF*, tdir_t); extern int TIFFSetField(TIFF*, ttag_t, ...); extern int TIFFVSetField(TIFF*, ttag_t, va_list); extern int TIFFWriteDirectory(TIFF *); extern int TIFFCheckpointDirectory(TIFF *); extern int TIFFRewriteDirectory(TIFF *); extern int TIFFReassignTagToIgnore(enum TIFFIgnoreSense, int); #if defined(c_plusplus) || defined(__cplusplus) extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0); extern int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t = 0); extern int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t = 0); extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0); extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int = ORIENTATION_BOTLEFT, int = 0); #else extern void TIFFPrintDirectory(TIFF*, FILE*, long); extern int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t); extern int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t); extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int); extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int); #endif extern int TIFFReadRGBAStrip(TIFF*, tstrip_t, uint32 * ); extern int TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * ); extern int TIFFRGBAImageOK(TIFF*, char [1024]); extern int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]); extern int TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32); extern void TIFFRGBAImageEnd(TIFFRGBAImage*); extern TIFF* TIFFOpen(const char*, const char*); # ifdef __WIN32__ extern TIFF* TIFFOpenW(const wchar_t*, const char*); # endif /* __WIN32__ */ extern TIFF* TIFFFdOpen(int, const char*, const char*); extern TIFF* TIFFClientOpen(const char*, const char*, thandle_t, TIFFReadWriteProc, TIFFReadWriteProc, TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, TIFFMapFileProc, TIFFUnmapFileProc); extern const char* TIFFFileName(TIFF*); extern const char* TIFFSetFileName(TIFF*, const char *); extern void TIFFError(const char*, const char*, ...) __attribute__((format (printf,2,3))); extern void TIFFErrorExt(thandle_t, const char*, const char*, ...) __attribute__((format (printf,3,4))); extern void TIFFWarning(const char*, const char*, ...) __attribute__((format (printf,2,3))); extern void TIFFWarningExt(thandle_t, const char*, const char*, ...) __attribute__((format (printf,3,4))); extern TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler); extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt); extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler); extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt); extern TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc); extern ttile_t TIFFComputeTile(TIFF*, uint32, uint32, uint32, tsample_t); extern int TIFFCheckTile(TIFF*, uint32, uint32, uint32, tsample_t); extern ttile_t TIFFNumberOfTiles(TIFF*); extern tsize_t TIFFReadTile(TIFF*, tdata_t, uint32, uint32, uint32, tsample_t); extern tsize_t TIFFWriteTile(TIFF*, tdata_t, uint32, uint32, uint32, tsample_t); extern tstrip_t TIFFComputeStrip(TIFF*, uint32, tsample_t); extern tstrip_t TIFFNumberOfStrips(TIFF*); extern tsize_t TIFFReadEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t); extern tsize_t TIFFReadRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t); extern tsize_t TIFFReadEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t); extern tsize_t TIFFReadRawTile(TIFF*, ttile_t, tdata_t, tsize_t); extern tsize_t TIFFWriteEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t); extern tsize_t TIFFWriteRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t); extern tsize_t TIFFWriteEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t); extern tsize_t TIFFWriteRawTile(TIFF*, ttile_t, tdata_t, tsize_t); extern int TIFFDataWidth(TIFFDataType); /* table of tag datatype widths */ extern void TIFFSetWriteOffset(TIFF*, toff_t); extern void TIFFSwabShort(uint16*); extern void TIFFSwabLong(uint32*); extern void TIFFSwabDouble(double*); extern void TIFFSwabArrayOfShort(uint16*, unsigned long); extern void TIFFSwabArrayOfTriples(uint8*, unsigned long); extern void TIFFSwabArrayOfLong(uint32*, unsigned long); extern void TIFFSwabArrayOfDouble(double*, unsigned long); extern void TIFFReverseBits(unsigned char *, unsigned long); extern const unsigned char* TIFFGetBitRevTable(int); #ifdef LOGLUV_PUBLIC #define U_NEU 0.210526316 #define V_NEU 0.473684211 #define UVSCALE 410. extern double LogL16toY(int); extern double LogL10toY(int); extern void XYZtoRGB24(float*, uint8*); extern int uv_decode(double*, double*, int); extern void LogLuv24toXYZ(uint32, float*); extern void LogLuv32toXYZ(uint32, float*); #if defined(c_plusplus) || defined(__cplusplus) extern int LogL16fromY(double, int = SGILOGENCODE_NODITHER); extern int LogL10fromY(double, int = SGILOGENCODE_NODITHER); extern int uv_encode(double, double, int = SGILOGENCODE_NODITHER); extern uint32 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER); extern uint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER); #else extern int LogL16fromY(double, int); extern int LogL10fromY(double, int); extern int uv_encode(double, double, int); extern uint32 LogLuv24fromXYZ(float*, int); extern uint32 LogLuv32fromXYZ(float*, int); #endif #endif /* LOGLUV_PUBLIC */ extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, TIFFDisplay *, float*); extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32, float *, float *, float *); extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float, uint32 *, uint32 *, uint32 *); extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*); extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32, uint32 *, uint32 *, uint32 *); #if defined(c_plusplus) || defined(__cplusplus) } #endif #endif /* _TIFFIO_ */ /* vim: set ts=8 sts=8 sw=8 noet: */ ����������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_dir.c���������������������������������������������������0000644�0001750�0001750�00000116034�12320456500�021125� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_dir.c,v 1.75.2.2 2009-01-01 00:10:43 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * Directory Tag Get & Set Routines. * (and also some miscellaneous stuff) */ #include "tiffiop.h" /* * These are used in the backwards compatibility code... */ #define DATATYPE_VOID 0 /* !untyped data */ #define DATATYPE_INT 1 /* !signed integer data */ #define DATATYPE_UINT 2 /* !unsigned integer data */ #define DATATYPE_IEEEFP 3 /* !IEEE floating point data */ static void setByteArray(void** vpp, void* vp, size_t nmemb, size_t elem_size) { if (*vpp) _TIFFfree(*vpp), *vpp = 0; if (vp) { tsize_t bytes = nmemb * elem_size; if (elem_size && bytes / elem_size == nmemb) *vpp = (void*) _TIFFmalloc(bytes); if (*vpp) _TIFFmemcpy(*vpp, vp, bytes); } } void _TIFFsetByteArray(void** vpp, void* vp, uint32 n) { setByteArray(vpp, vp, n, 1); } void _TIFFsetString(char** cpp, char* cp) { setByteArray((void**) cpp, (void*) cp, strlen(cp)+1, 1); } void _TIFFsetNString(char** cpp, char* cp, uint32 n) { setByteArray((void**) cpp, (void*) cp, n, 1); } void _TIFFsetShortArray(uint16** wpp, uint16* wp, uint32 n) { setByteArray((void**) wpp, (void*) wp, n, sizeof (uint16)); } void _TIFFsetLongArray(uint32** lpp, uint32* lp, uint32 n) { setByteArray((void**) lpp, (void*) lp, n, sizeof (uint32)); } void _TIFFsetFloatArray(float** fpp, float* fp, uint32 n) { setByteArray((void**) fpp, (void*) fp, n, sizeof (float)); } void _TIFFsetDoubleArray(double** dpp, double* dp, uint32 n) { setByteArray((void**) dpp, (void*) dp, n, sizeof (double)); } /* * Install extra samples information. */ static int setExtraSamples(TIFFDirectory* td, va_list ap, uint32* v) { /* XXX: Unassociated alpha data == 999 is a known Corel Draw bug, see below */ #define EXTRASAMPLE_COREL_UNASSALPHA 999 uint16* va; uint32 i; *v = va_arg(ap, uint32); if ((uint16) *v > td->td_samplesperpixel) return 0; va = va_arg(ap, uint16*); if (*v > 0 && va == NULL) /* typically missing param */ return 0; for (i = 0; i < *v; i++) { if (va[i] > EXTRASAMPLE_UNASSALPHA) { /* * XXX: Corel Draw is known to produce incorrect * ExtraSamples tags which must be patched here if we * want to be able to open some of the damaged TIFF * files: */ if (va[i] == EXTRASAMPLE_COREL_UNASSALPHA) va[i] = EXTRASAMPLE_UNASSALPHA; else return 0; } } td->td_extrasamples = (uint16) *v; _TIFFsetShortArray(&td->td_sampleinfo, va, td->td_extrasamples); return 1; #undef EXTRASAMPLE_COREL_UNASSALPHA } static uint32 checkInkNamesString(TIFF* tif, uint32 slen, const char* s) { TIFFDirectory* td = &tif->tif_dir; uint16 i = td->td_samplesperpixel; if (slen > 0) { const char* ep = s+slen; const char* cp = s; for (; i > 0; i--) { for (; *cp != '\0'; cp++) if (cp >= ep) goto bad; cp++; /* skip \0 */ } return (cp-s); } bad: TIFFErrorExt(tif->tif_clientdata, "TIFFSetField", "%s: Invalid InkNames value; expecting %d names, found %d", tif->tif_name, td->td_samplesperpixel, td->td_samplesperpixel-i); return (0); } static int _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap) { static const char module[] = "_TIFFVSetField"; TIFFDirectory* td = &tif->tif_dir; int status = 1; uint32 v32, i, v; char* s; switch (tag) { case TIFFTAG_SUBFILETYPE: td->td_subfiletype = va_arg(ap, uint32); break; case TIFFTAG_IMAGEWIDTH: td->td_imagewidth = va_arg(ap, uint32); break; case TIFFTAG_IMAGELENGTH: td->td_imagelength = va_arg(ap, uint32); break; case TIFFTAG_BITSPERSAMPLE: td->td_bitspersample = (uint16) va_arg(ap, int); /* * If the data require post-decoding processing to byte-swap * samples, set it up here. Note that since tags are required * to be ordered, compression code can override this behaviour * in the setup method if it wants to roll the post decoding * work in with its normal work. */ if (tif->tif_flags & TIFF_SWAB) { if (td->td_bitspersample == 16) tif->tif_postdecode = _TIFFSwab16BitData; else if (td->td_bitspersample == 24) tif->tif_postdecode = _TIFFSwab24BitData; else if (td->td_bitspersample == 32) tif->tif_postdecode = _TIFFSwab32BitData; else if (td->td_bitspersample == 64) tif->tif_postdecode = _TIFFSwab64BitData; else if (td->td_bitspersample == 128) /* two 64's */ tif->tif_postdecode = _TIFFSwab64BitData; } break; case TIFFTAG_COMPRESSION: v = va_arg(ap, uint32) & 0xffff; /* * If we're changing the compression scheme, the notify the * previous module so that it can cleanup any state it's * setup. */ if (TIFFFieldSet(tif, FIELD_COMPRESSION)) { if (td->td_compression == v) break; (*tif->tif_cleanup)(tif); tif->tif_flags &= ~TIFF_CODERSETUP; } /* * Setup new compression routine state. */ if( (status = TIFFSetCompressionScheme(tif, v)) != 0 ) td->td_compression = (uint16) v; else status = 0; break; case TIFFTAG_PHOTOMETRIC: td->td_photometric = (uint16) va_arg(ap, int); break; case TIFFTAG_THRESHHOLDING: td->td_threshholding = (uint16) va_arg(ap, int); break; case TIFFTAG_FILLORDER: v = va_arg(ap, uint32); if (v != FILLORDER_LSB2MSB && v != FILLORDER_MSB2LSB) goto badvalue; td->td_fillorder = (uint16) v; break; case TIFFTAG_ORIENTATION: v = va_arg(ap, uint32); if (v < ORIENTATION_TOPLEFT || ORIENTATION_LEFTBOT < v) goto badvalue; else td->td_orientation = (uint16) v; break; case TIFFTAG_SAMPLESPERPIXEL: /* XXX should cross check -- e.g. if pallette, then 1 */ v = va_arg(ap, uint32); if (v == 0) goto badvalue; td->td_samplesperpixel = (uint16) v; break; case TIFFTAG_ROWSPERSTRIP: v32 = va_arg(ap, uint32); if (v32 == 0) goto badvalue32; td->td_rowsperstrip = v32; if (!TIFFFieldSet(tif, FIELD_TILEDIMENSIONS)) { td->td_tilelength = v32; td->td_tilewidth = td->td_imagewidth; } break; case TIFFTAG_MINSAMPLEVALUE: td->td_minsamplevalue = (uint16) va_arg(ap, int); break; case TIFFTAG_MAXSAMPLEVALUE: td->td_maxsamplevalue = (uint16) va_arg(ap, int); break; case TIFFTAG_SMINSAMPLEVALUE: td->td_sminsamplevalue = va_arg(ap, double); break; case TIFFTAG_SMAXSAMPLEVALUE: td->td_smaxsamplevalue = va_arg(ap, double); break; case TIFFTAG_XRESOLUTION: td->td_xresolution = (float) va_arg(ap, double); break; case TIFFTAG_YRESOLUTION: td->td_yresolution = (float) va_arg(ap, double); break; case TIFFTAG_PLANARCONFIG: v = va_arg(ap, uint32); if (v != PLANARCONFIG_CONTIG && v != PLANARCONFIG_SEPARATE) goto badvalue; td->td_planarconfig = (uint16) v; break; case TIFFTAG_XPOSITION: td->td_xposition = (float) va_arg(ap, double); break; case TIFFTAG_YPOSITION: td->td_yposition = (float) va_arg(ap, double); break; case TIFFTAG_RESOLUTIONUNIT: v = va_arg(ap, uint32); if (v < RESUNIT_NONE || RESUNIT_CENTIMETER < v) goto badvalue; td->td_resolutionunit = (uint16) v; break; case TIFFTAG_PAGENUMBER: td->td_pagenumber[0] = (uint16) va_arg(ap, int); td->td_pagenumber[1] = (uint16) va_arg(ap, int); break; case TIFFTAG_HALFTONEHINTS: td->td_halftonehints[0] = (uint16) va_arg(ap, int); td->td_halftonehints[1] = (uint16) va_arg(ap, int); break; case TIFFTAG_COLORMAP: v32 = (uint32)(1L<<td->td_bitspersample); _TIFFsetShortArray(&td->td_colormap[0], va_arg(ap, uint16*), v32); _TIFFsetShortArray(&td->td_colormap[1], va_arg(ap, uint16*), v32); _TIFFsetShortArray(&td->td_colormap[2], va_arg(ap, uint16*), v32); break; case TIFFTAG_EXTRASAMPLES: if (!setExtraSamples(td, ap, &v)) goto badvalue; break; case TIFFTAG_MATTEING: td->td_extrasamples = (uint16) (va_arg(ap, int) != 0); if (td->td_extrasamples) { uint16 sv = EXTRASAMPLE_ASSOCALPHA; _TIFFsetShortArray(&td->td_sampleinfo, &sv, 1); } break; case TIFFTAG_TILEWIDTH: v32 = va_arg(ap, uint32); if (v32 % 16) { if (tif->tif_mode != O_RDONLY) goto badvalue32; TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "Nonstandard tile width %d, convert file", v32); } td->td_tilewidth = v32; tif->tif_flags |= TIFF_ISTILED; break; case TIFFTAG_TILELENGTH: v32 = va_arg(ap, uint32); if (v32 % 16) { if (tif->tif_mode != O_RDONLY) goto badvalue32; TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "Nonstandard tile length %d, convert file", v32); } td->td_tilelength = v32; tif->tif_flags |= TIFF_ISTILED; break; case TIFFTAG_TILEDEPTH: v32 = va_arg(ap, uint32); if (v32 == 0) goto badvalue32; td->td_tiledepth = v32; break; case TIFFTAG_DATATYPE: v = va_arg(ap, uint32); switch (v) { case DATATYPE_VOID: v = SAMPLEFORMAT_VOID; break; case DATATYPE_INT: v = SAMPLEFORMAT_INT; break; case DATATYPE_UINT: v = SAMPLEFORMAT_UINT; break; case DATATYPE_IEEEFP: v = SAMPLEFORMAT_IEEEFP;break; default: goto badvalue; } td->td_sampleformat = (uint16) v; break; case TIFFTAG_SAMPLEFORMAT: v = va_arg(ap, uint32); if (v < SAMPLEFORMAT_UINT || SAMPLEFORMAT_COMPLEXIEEEFP < v) goto badvalue; td->td_sampleformat = (uint16) v; /* Try to fix up the SWAB function for complex data. */ if( td->td_sampleformat == SAMPLEFORMAT_COMPLEXINT && td->td_bitspersample == 32 && tif->tif_postdecode == _TIFFSwab32BitData ) tif->tif_postdecode = _TIFFSwab16BitData; else if( (td->td_sampleformat == SAMPLEFORMAT_COMPLEXINT || td->td_sampleformat == SAMPLEFORMAT_COMPLEXIEEEFP) && td->td_bitspersample == 64 && tif->tif_postdecode == _TIFFSwab64BitData ) tif->tif_postdecode = _TIFFSwab32BitData; break; case TIFFTAG_IMAGEDEPTH: td->td_imagedepth = va_arg(ap, uint32); break; case TIFFTAG_SUBIFD: if ((tif->tif_flags & TIFF_INSUBIFD) == 0) { td->td_nsubifd = (uint16) va_arg(ap, int); _TIFFsetLongArray(&td->td_subifd, va_arg(ap, uint32*), (long) td->td_nsubifd); } else { TIFFErrorExt(tif->tif_clientdata, module, "%s: Sorry, cannot nest SubIFDs", tif->tif_name); status = 0; } break; case TIFFTAG_YCBCRPOSITIONING: td->td_ycbcrpositioning = (uint16) va_arg(ap, int); break; case TIFFTAG_YCBCRSUBSAMPLING: td->td_ycbcrsubsampling[0] = (uint16) va_arg(ap, int); td->td_ycbcrsubsampling[1] = (uint16) va_arg(ap, int); break; case TIFFTAG_TRANSFERFUNCTION: v = (td->td_samplesperpixel - td->td_extrasamples) > 1 ? 3 : 1; for (i = 0; i < v; i++) _TIFFsetShortArray(&td->td_transferfunction[i], va_arg(ap, uint16*), 1L<<td->td_bitspersample); break; case TIFFTAG_INKNAMES: v = va_arg(ap, uint32); s = va_arg(ap, char*); v = checkInkNamesString(tif, v, s); status = v > 0; if( v > 0 ) { _TIFFsetNString(&td->td_inknames, s, v); td->td_inknameslen = v; } break; default: { TIFFTagValue *tv; int tv_size, iCustom; const TIFFFieldInfo* fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY); /* * This can happen if multiple images are open with different * codecs which have private tags. The global tag information * table may then have tags that are valid for one file but not * the other. If the client tries to set a tag that is not valid * for the image's codec then we'll arrive here. This * happens, for example, when tiffcp is used to convert between * compression schemes and codec-specific tags are blindly copied. */ if(fip == NULL || fip->field_bit != FIELD_CUSTOM) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Invalid %stag \"%s\" (not supported by codec)", tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "", fip ? fip->field_name : "Unknown"); status = 0; break; } /* * Find the existing entry for this custom value. */ tv = NULL; for (iCustom = 0; iCustom < td->td_customValueCount; iCustom++) { if (td->td_customValues[iCustom].info->field_tag == tag) { tv = td->td_customValues + iCustom; if (tv->value != NULL) { _TIFFfree(tv->value); tv->value = NULL; } break; } } /* * Grow the custom list if the entry was not found. */ if(tv == NULL) { TIFFTagValue *new_customValues; td->td_customValueCount++; new_customValues = (TIFFTagValue *) _TIFFrealloc(td->td_customValues, sizeof(TIFFTagValue) * td->td_customValueCount); if (!new_customValues) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Failed to allocate space for list of custom values", tif->tif_name); status = 0; goto end; } td->td_customValues = new_customValues; tv = td->td_customValues + (td->td_customValueCount - 1); tv->info = fip; tv->value = NULL; tv->count = 0; } /* * Set custom value ... save a copy of the custom tag value. */ tv_size = _TIFFDataSize(fip->field_type); if (tv_size == 0) { status = 0; TIFFErrorExt(tif->tif_clientdata, module, "%s: Bad field type %d for \"%s\"", tif->tif_name, fip->field_type, fip->field_name); goto end; } if(fip->field_passcount) { if (fip->field_writecount == TIFF_VARIABLE2) tv->count = (uint32) va_arg(ap, uint32); else tv->count = (int) va_arg(ap, int); } else if (fip->field_writecount == TIFF_VARIABLE || fip->field_writecount == TIFF_VARIABLE2) tv->count = 1; else if (fip->field_writecount == TIFF_SPP) tv->count = td->td_samplesperpixel; else tv->count = fip->field_writecount; if (fip->field_type == TIFF_ASCII) _TIFFsetString((char **)&tv->value, va_arg(ap, char *)); else { tv->value = _TIFFCheckMalloc(tif, tv_size, tv->count, "Tag Value"); if (!tv->value) { status = 0; goto end; } if ((fip->field_passcount || fip->field_writecount == TIFF_VARIABLE || fip->field_writecount == TIFF_VARIABLE2 || fip->field_writecount == TIFF_SPP || tv->count > 1) && fip->field_tag != TIFFTAG_PAGENUMBER && fip->field_tag != TIFFTAG_HALFTONEHINTS && fip->field_tag != TIFFTAG_YCBCRSUBSAMPLING && fip->field_tag != TIFFTAG_DOTRANGE) { _TIFFmemcpy(tv->value, va_arg(ap, void *), tv->count * tv_size); } else { /* * XXX: The following loop required to handle * TIFFTAG_PAGENUMBER, TIFFTAG_HALFTONEHINTS, * TIFFTAG_YCBCRSUBSAMPLING and TIFFTAG_DOTRANGE tags. * These tags are actually arrays and should be passed as * array pointers to TIFFSetField() function, but actually * passed as a list of separate values. This behaviour * must be changed in the future! */ int i; char *val = (char *)tv->value; for (i = 0; i < tv->count; i++, val += tv_size) { switch (fip->field_type) { case TIFF_BYTE: case TIFF_UNDEFINED: { uint8 v = (uint8)va_arg(ap, int); _TIFFmemcpy(val, &v, tv_size); } break; case TIFF_SBYTE: { int8 v = (int8)va_arg(ap, int); _TIFFmemcpy(val, &v, tv_size); } break; case TIFF_SHORT: { uint16 v = (uint16)va_arg(ap, int); _TIFFmemcpy(val, &v, tv_size); } break; case TIFF_SSHORT: { int16 v = (int16)va_arg(ap, int); _TIFFmemcpy(val, &v, tv_size); } break; case TIFF_LONG: case TIFF_IFD: { uint32 v = va_arg(ap, uint32); _TIFFmemcpy(val, &v, tv_size); } break; case TIFF_SLONG: { int32 v = va_arg(ap, int32); _TIFFmemcpy(val, &v, tv_size); } break; case TIFF_RATIONAL: case TIFF_SRATIONAL: case TIFF_FLOAT: { float v = (float)va_arg(ap, double); _TIFFmemcpy(val, &v, tv_size); } break; case TIFF_DOUBLE: { double v = va_arg(ap, double); _TIFFmemcpy(val, &v, tv_size); } break; default: _TIFFmemset(val, 0, tv_size); status = 0; break; } } } } } } if (status) { TIFFSetFieldBit(tif, _TIFFFieldWithTag(tif, tag)->field_bit); tif->tif_flags |= TIFF_DIRTYDIRECT; } end: va_end(ap); return (status); badvalue: TIFFErrorExt(tif->tif_clientdata, module, "%s: Bad value %d for \"%s\" tag", tif->tif_name, v, _TIFFFieldWithTag(tif, tag)->field_name); va_end(ap); return (0); badvalue32: TIFFErrorExt(tif->tif_clientdata, module, "%s: Bad value %u for \"%s\" tag", tif->tif_name, v32, _TIFFFieldWithTag(tif, tag)->field_name); va_end(ap); return (0); } /* * Return 1/0 according to whether or not * it is permissible to set the tag's value. * Note that we allow ImageLength to be changed * so that we can append and extend to images. * Any other tag may not be altered once writing * has commenced, unless its value has no effect * on the format of the data that is written. */ static int OkToChangeTag(TIFF* tif, ttag_t tag) { const TIFFFieldInfo* fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY); if (!fip) { /* unknown tag */ TIFFErrorExt(tif->tif_clientdata, "TIFFSetField", "%s: Unknown %stag %u", tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "", tag); return (0); } if (tag != TIFFTAG_IMAGELENGTH && (tif->tif_flags & TIFF_BEENWRITING) && !fip->field_oktochange) { /* * Consult info table to see if tag can be changed * after we've started writing. We only allow changes * to those tags that don't/shouldn't affect the * compression and/or format of the data. */ TIFFErrorExt(tif->tif_clientdata, "TIFFSetField", "%s: Cannot modify tag \"%s\" while writing", tif->tif_name, fip->field_name); return (0); } return (1); } /* * Record the value of a field in the * internal directory structure. The * field will be written to the file * when/if the directory structure is * updated. */ int TIFFSetField(TIFF* tif, ttag_t tag, ...) { va_list ap; int status; va_start(ap, tag); status = TIFFVSetField(tif, tag, ap); va_end(ap); return (status); } /* * Like TIFFSetField, but taking a varargs * parameter list. This routine is useful * for building higher-level interfaces on * top of the library. */ int TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap) { return OkToChangeTag(tif, tag) ? (*tif->tif_tagmethods.vsetfield)(tif, tag, ap) : 0; } static int _TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap) { TIFFDirectory* td = &tif->tif_dir; int ret_val = 1; switch (tag) { case TIFFTAG_SUBFILETYPE: *va_arg(ap, uint32*) = td->td_subfiletype; break; case TIFFTAG_IMAGEWIDTH: *va_arg(ap, uint32*) = td->td_imagewidth; break; case TIFFTAG_IMAGELENGTH: *va_arg(ap, uint32*) = td->td_imagelength; break; case TIFFTAG_BITSPERSAMPLE: *va_arg(ap, uint16*) = td->td_bitspersample; break; case TIFFTAG_COMPRESSION: *va_arg(ap, uint16*) = td->td_compression; break; case TIFFTAG_PHOTOMETRIC: *va_arg(ap, uint16*) = td->td_photometric; break; case TIFFTAG_THRESHHOLDING: *va_arg(ap, uint16*) = td->td_threshholding; break; case TIFFTAG_FILLORDER: *va_arg(ap, uint16*) = td->td_fillorder; break; case TIFFTAG_ORIENTATION: *va_arg(ap, uint16*) = td->td_orientation; break; case TIFFTAG_SAMPLESPERPIXEL: *va_arg(ap, uint16*) = td->td_samplesperpixel; break; case TIFFTAG_ROWSPERSTRIP: *va_arg(ap, uint32*) = td->td_rowsperstrip; break; case TIFFTAG_MINSAMPLEVALUE: *va_arg(ap, uint16*) = td->td_minsamplevalue; break; case TIFFTAG_MAXSAMPLEVALUE: *va_arg(ap, uint16*) = td->td_maxsamplevalue; break; case TIFFTAG_SMINSAMPLEVALUE: *va_arg(ap, double*) = td->td_sminsamplevalue; break; case TIFFTAG_SMAXSAMPLEVALUE: *va_arg(ap, double*) = td->td_smaxsamplevalue; break; case TIFFTAG_XRESOLUTION: *va_arg(ap, float*) = td->td_xresolution; break; case TIFFTAG_YRESOLUTION: *va_arg(ap, float*) = td->td_yresolution; break; case TIFFTAG_PLANARCONFIG: *va_arg(ap, uint16*) = td->td_planarconfig; break; case TIFFTAG_XPOSITION: *va_arg(ap, float*) = td->td_xposition; break; case TIFFTAG_YPOSITION: *va_arg(ap, float*) = td->td_yposition; break; case TIFFTAG_RESOLUTIONUNIT: *va_arg(ap, uint16*) = td->td_resolutionunit; break; case TIFFTAG_PAGENUMBER: *va_arg(ap, uint16*) = td->td_pagenumber[0]; *va_arg(ap, uint16*) = td->td_pagenumber[1]; break; case TIFFTAG_HALFTONEHINTS: *va_arg(ap, uint16*) = td->td_halftonehints[0]; *va_arg(ap, uint16*) = td->td_halftonehints[1]; break; case TIFFTAG_COLORMAP: *va_arg(ap, uint16**) = td->td_colormap[0]; *va_arg(ap, uint16**) = td->td_colormap[1]; *va_arg(ap, uint16**) = td->td_colormap[2]; break; case TIFFTAG_STRIPOFFSETS: case TIFFTAG_TILEOFFSETS: *va_arg(ap, uint32**) = td->td_stripoffset; break; case TIFFTAG_STRIPBYTECOUNTS: case TIFFTAG_TILEBYTECOUNTS: *va_arg(ap, uint32**) = td->td_stripbytecount; break; case TIFFTAG_MATTEING: *va_arg(ap, uint16*) = (td->td_extrasamples == 1 && td->td_sampleinfo[0] == EXTRASAMPLE_ASSOCALPHA); break; case TIFFTAG_EXTRASAMPLES: *va_arg(ap, uint16*) = td->td_extrasamples; *va_arg(ap, uint16**) = td->td_sampleinfo; break; case TIFFTAG_TILEWIDTH: *va_arg(ap, uint32*) = td->td_tilewidth; break; case TIFFTAG_TILELENGTH: *va_arg(ap, uint32*) = td->td_tilelength; break; case TIFFTAG_TILEDEPTH: *va_arg(ap, uint32*) = td->td_tiledepth; break; case TIFFTAG_DATATYPE: switch (td->td_sampleformat) { case SAMPLEFORMAT_UINT: *va_arg(ap, uint16*) = DATATYPE_UINT; break; case SAMPLEFORMAT_INT: *va_arg(ap, uint16*) = DATATYPE_INT; break; case SAMPLEFORMAT_IEEEFP: *va_arg(ap, uint16*) = DATATYPE_IEEEFP; break; case SAMPLEFORMAT_VOID: *va_arg(ap, uint16*) = DATATYPE_VOID; break; } break; case TIFFTAG_SAMPLEFORMAT: *va_arg(ap, uint16*) = td->td_sampleformat; break; case TIFFTAG_IMAGEDEPTH: *va_arg(ap, uint32*) = td->td_imagedepth; break; case TIFFTAG_SUBIFD: *va_arg(ap, uint16*) = td->td_nsubifd; *va_arg(ap, uint32**) = td->td_subifd; break; case TIFFTAG_YCBCRPOSITIONING: *va_arg(ap, uint16*) = td->td_ycbcrpositioning; break; case TIFFTAG_YCBCRSUBSAMPLING: *va_arg(ap, uint16*) = td->td_ycbcrsubsampling[0]; *va_arg(ap, uint16*) = td->td_ycbcrsubsampling[1]; break; case TIFFTAG_TRANSFERFUNCTION: *va_arg(ap, uint16**) = td->td_transferfunction[0]; if (td->td_samplesperpixel - td->td_extrasamples > 1) { *va_arg(ap, uint16**) = td->td_transferfunction[1]; *va_arg(ap, uint16**) = td->td_transferfunction[2]; } break; case TIFFTAG_INKNAMES: *va_arg(ap, char**) = td->td_inknames; break; default: { const TIFFFieldInfo* fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY); int i; /* * This can happen if multiple images are open with different * codecs which have private tags. The global tag information * table may then have tags that are valid for one file but not * the other. If the client tries to get a tag that is not valid * for the image's codec then we'll arrive here. */ if( fip == NULL || fip->field_bit != FIELD_CUSTOM ) { TIFFErrorExt(tif->tif_clientdata, "_TIFFVGetField", "%s: Invalid %stag \"%s\" " "(not supported by codec)", tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "", fip ? fip->field_name : "Unknown"); ret_val = 0; break; } /* * Do we have a custom value? */ ret_val = 0; for (i = 0; i < td->td_customValueCount; i++) { TIFFTagValue *tv = td->td_customValues + i; if (tv->info->field_tag != tag) continue; if (fip->field_passcount) { if (fip->field_readcount == TIFF_VARIABLE2) *va_arg(ap, uint32*) = (uint32)tv->count; else /* Assume TIFF_VARIABLE */ *va_arg(ap, uint16*) = (uint16)tv->count; *va_arg(ap, void **) = tv->value; ret_val = 1; } else { if ((fip->field_type == TIFF_ASCII || fip->field_readcount == TIFF_VARIABLE || fip->field_readcount == TIFF_VARIABLE2 || fip->field_readcount == TIFF_SPP || tv->count > 1) && fip->field_tag != TIFFTAG_PAGENUMBER && fip->field_tag != TIFFTAG_HALFTONEHINTS && fip->field_tag != TIFFTAG_YCBCRSUBSAMPLING && fip->field_tag != TIFFTAG_DOTRANGE) { *va_arg(ap, void **) = tv->value; ret_val = 1; } else { int j; char *val = (char *)tv->value; for (j = 0; j < tv->count; j++, val += _TIFFDataSize(tv->info->field_type)) { switch (fip->field_type) { case TIFF_BYTE: case TIFF_UNDEFINED: *va_arg(ap, uint8*) = *(uint8 *)val; ret_val = 1; break; case TIFF_SBYTE: *va_arg(ap, int8*) = *(int8 *)val; ret_val = 1; break; case TIFF_SHORT: *va_arg(ap, uint16*) = *(uint16 *)val; ret_val = 1; break; case TIFF_SSHORT: *va_arg(ap, int16*) = *(int16 *)val; ret_val = 1; break; case TIFF_LONG: case TIFF_IFD: *va_arg(ap, uint32*) = *(uint32 *)val; ret_val = 1; break; case TIFF_SLONG: *va_arg(ap, int32*) = *(int32 *)val; ret_val = 1; break; case TIFF_RATIONAL: case TIFF_SRATIONAL: case TIFF_FLOAT: *va_arg(ap, float*) = *(float *)val; ret_val = 1; break; case TIFF_DOUBLE: *va_arg(ap, double*) = *(double *)val; ret_val = 1; break; default: ret_val = 0; break; } } } } break; } } } return(ret_val); } /* * Return the value of a field in the * internal directory structure. */ int TIFFGetField(TIFF* tif, ttag_t tag, ...) { int status; va_list ap; va_start(ap, tag); status = TIFFVGetField(tif, tag, ap); va_end(ap); return (status); } /* * Like TIFFGetField, but taking a varargs * parameter list. This routine is useful * for building higher-level interfaces on * top of the library. */ int TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap) { const TIFFFieldInfo* fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY); return (fip && (isPseudoTag(tag) || TIFFFieldSet(tif, fip->field_bit)) ? (*tif->tif_tagmethods.vgetfield)(tif, tag, ap) : 0); } #define CleanupField(member) { \ if (td->member) { \ _TIFFfree(td->member); \ td->member = 0; \ } \ } /* * Release storage associated with a directory. */ void TIFFFreeDirectory(TIFF* tif) { TIFFDirectory *td = &tif->tif_dir; int i; _TIFFmemset(td->td_fieldsset, 0, FIELD_SETLONGS); CleanupField(td_colormap[0]); CleanupField(td_colormap[1]); CleanupField(td_colormap[2]); CleanupField(td_sampleinfo); CleanupField(td_subifd); CleanupField(td_inknames); CleanupField(td_transferfunction[0]); CleanupField(td_transferfunction[1]); CleanupField(td_transferfunction[2]); CleanupField(td_stripoffset); CleanupField(td_stripbytecount); TIFFClrFieldBit(tif, FIELD_YCBCRSUBSAMPLING); TIFFClrFieldBit(tif, FIELD_YCBCRPOSITIONING); /* Cleanup custom tag values */ for( i = 0; i < td->td_customValueCount; i++ ) { if (td->td_customValues[i].value) _TIFFfree(td->td_customValues[i].value); } td->td_customValueCount = 0; CleanupField(td_customValues); } #undef CleanupField /* * Client Tag extension support (from Niles Ritter). */ static TIFFExtendProc _TIFFextender = (TIFFExtendProc) NULL; TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc extender) { TIFFExtendProc prev = _TIFFextender; _TIFFextender = extender; return (prev); } /* * Setup for a new directory. Should we automatically call * TIFFWriteDirectory() if the current one is dirty? * * The newly created directory will not exist on the file till * TIFFWriteDirectory(), TIFFFlush() or TIFFClose() is called. */ int TIFFCreateDirectory(TIFF* tif) { TIFFDefaultDirectory(tif); tif->tif_diroff = 0; tif->tif_nextdiroff = 0; tif->tif_curoff = 0; tif->tif_row = (uint32) -1; tif->tif_curstrip = (tstrip_t) -1; return 0; } /* * Setup a default directory structure. */ int TIFFDefaultDirectory(TIFF* tif) { register TIFFDirectory* td = &tif->tif_dir; size_t tiffFieldInfoCount; const TIFFFieldInfo *tiffFieldInfo = _TIFFGetFieldInfo(&tiffFieldInfoCount); _TIFFSetupFieldInfo(tif, tiffFieldInfo, tiffFieldInfoCount); _TIFFmemset(td, 0, sizeof (*td)); td->td_fillorder = FILLORDER_MSB2LSB; td->td_bitspersample = 1; td->td_threshholding = THRESHHOLD_BILEVEL; td->td_orientation = ORIENTATION_TOPLEFT; td->td_samplesperpixel = 1; td->td_rowsperstrip = (uint32) -1; td->td_tilewidth = 0; td->td_tilelength = 0; td->td_tiledepth = 1; td->td_stripbytecountsorted = 1; /* Our own arrays always sorted. */ td->td_resolutionunit = RESUNIT_INCH; td->td_sampleformat = SAMPLEFORMAT_UINT; td->td_imagedepth = 1; td->td_ycbcrsubsampling[0] = 2; td->td_ycbcrsubsampling[1] = 2; td->td_ycbcrpositioning = YCBCRPOSITION_CENTERED; tif->tif_postdecode = _TIFFNoPostDecode; tif->tif_foundfield = NULL; tif->tif_tagmethods.vsetfield = _TIFFVSetField; tif->tif_tagmethods.vgetfield = _TIFFVGetField; tif->tif_tagmethods.printdir = NULL; /* * Give client code a chance to install their own * tag extensions & methods, prior to compression overloads. */ if (_TIFFextender) (*_TIFFextender)(tif); (void) TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE); /* * NB: The directory is marked dirty as a result of setting * up the default compression scheme. However, this really * isn't correct -- we want TIFF_DIRTYDIRECT to be set only * if the user does something. We could just do the setup * by hand, but it seems better to use the normal mechanism * (i.e. TIFFSetField). */ tif->tif_flags &= ~TIFF_DIRTYDIRECT; /* * As per http://bugzilla.remotesensing.org/show_bug.cgi?id=19 * we clear the ISTILED flag when setting up a new directory. * Should we also be clearing stuff like INSUBIFD? */ tif->tif_flags &= ~TIFF_ISTILED; return (1); } static int TIFFAdvanceDirectory(TIFF* tif, uint32* nextdir, toff_t* off) { static const char module[] = "TIFFAdvanceDirectory"; uint16 dircount; if (isMapped(tif)) { toff_t poff=*nextdir; if (poff+sizeof(uint16) > tif->tif_size) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Error fetching directory count", tif->tif_name); return (0); } _TIFFmemcpy(&dircount, tif->tif_base+poff, sizeof (uint16)); if (tif->tif_flags & TIFF_SWAB) TIFFSwabShort(&dircount); poff+=sizeof (uint16)+dircount*sizeof (TIFFDirEntry); if (off != NULL) *off = poff; if (((toff_t) (poff+sizeof (uint32))) > tif->tif_size) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Error fetching directory link", tif->tif_name); return (0); } _TIFFmemcpy(nextdir, tif->tif_base+poff, sizeof (uint32)); if (tif->tif_flags & TIFF_SWAB) TIFFSwabLong(nextdir); return (1); } else { if (!SeekOK(tif, *nextdir) || !ReadOK(tif, &dircount, sizeof (uint16))) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Error fetching directory count", tif->tif_name); return (0); } if (tif->tif_flags & TIFF_SWAB) TIFFSwabShort(&dircount); if (off != NULL) *off = TIFFSeekFile(tif, dircount*sizeof (TIFFDirEntry), SEEK_CUR); else (void) TIFFSeekFile(tif, dircount*sizeof (TIFFDirEntry), SEEK_CUR); if (!ReadOK(tif, nextdir, sizeof (uint32))) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Error fetching directory link", tif->tif_name); return (0); } if (tif->tif_flags & TIFF_SWAB) TIFFSwabLong(nextdir); return (1); } } /* * Count the number of directories in a file. */ tdir_t TIFFNumberOfDirectories(TIFF* tif) { toff_t nextdir = tif->tif_header.tiff_diroff; tdir_t n = 0; while (nextdir != 0 && TIFFAdvanceDirectory(tif, &nextdir, NULL)) n++; return (n); } /* * Set the n-th directory as the current directory. * NB: Directories are numbered starting at 0. */ int TIFFSetDirectory(TIFF* tif, tdir_t dirn) { toff_t nextdir; tdir_t n; nextdir = tif->tif_header.tiff_diroff; for (n = dirn; n > 0 && nextdir != 0; n--) if (!TIFFAdvanceDirectory(tif, &nextdir, NULL)) return (0); tif->tif_nextdiroff = nextdir; /* * Set curdir to the actual directory index. The * -1 is because TIFFReadDirectory will increment * tif_curdir after successfully reading the directory. */ tif->tif_curdir = (dirn - n) - 1; /* * Reset tif_dirnumber counter and start new list of seen directories. * We need this to prevent IFD loops. */ tif->tif_dirnumber = 0; return (TIFFReadDirectory(tif)); } /* * Set the current directory to be the directory * located at the specified file offset. This interface * is used mainly to access directories linked with * the SubIFD tag (e.g. thumbnail images). */ int TIFFSetSubDirectory(TIFF* tif, uint32 diroff) { tif->tif_nextdiroff = diroff; /* * Reset tif_dirnumber counter and start new list of seen directories. * We need this to prevent IFD loops. */ tif->tif_dirnumber = 0; return (TIFFReadDirectory(tif)); } /* * Return file offset of the current directory. */ uint32 TIFFCurrentDirOffset(TIFF* tif) { return (tif->tif_diroff); } /* * Return an indication of whether or not we are * at the last directory in the file. */ int TIFFLastDirectory(TIFF* tif) { return (tif->tif_nextdiroff == 0); } /* * Unlink the specified directory from the directory chain. */ int TIFFUnlinkDirectory(TIFF* tif, tdir_t dirn) { static const char module[] = "TIFFUnlinkDirectory"; toff_t nextdir; toff_t off; tdir_t n; if (tif->tif_mode == O_RDONLY) { TIFFErrorExt(tif->tif_clientdata, module, "Can not unlink directory in read-only file"); return (0); } /* * Go to the directory before the one we want * to unlink and nab the offset of the link * field we'll need to patch. */ nextdir = tif->tif_header.tiff_diroff; off = sizeof (uint16) + sizeof (uint16); for (n = dirn-1; n > 0; n--) { if (nextdir == 0) { TIFFErrorExt(tif->tif_clientdata, module, "Directory %d does not exist", dirn); return (0); } if (!TIFFAdvanceDirectory(tif, &nextdir, &off)) return (0); } /* * Advance to the directory to be unlinked and fetch * the offset of the directory that follows. */ if (!TIFFAdvanceDirectory(tif, &nextdir, NULL)) return (0); /* * Go back and patch the link field of the preceding * directory to point to the offset of the directory * that follows. */ (void) TIFFSeekFile(tif, off, SEEK_SET); if (tif->tif_flags & TIFF_SWAB) TIFFSwabLong(&nextdir); if (!WriteOK(tif, &nextdir, sizeof (uint32))) { TIFFErrorExt(tif->tif_clientdata, module, "Error writing directory link"); return (0); } /* * Leave directory state setup safely. We don't have * facilities for doing inserting and removing directories, * so it's safest to just invalidate everything. This * means that the caller can only append to the directory * chain. */ (*tif->tif_cleanup)(tif); if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata) { _TIFFfree(tif->tif_rawdata); tif->tif_rawdata = NULL; tif->tif_rawcc = 0; } tif->tif_flags &= ~(TIFF_BEENWRITING|TIFF_BUFFERSETUP|TIFF_POSTENCODE); TIFFFreeDirectory(tif); TIFFDefaultDirectory(tif); tif->tif_diroff = 0; /* force link on next write */ tif->tif_nextdiroff = 0; /* next write must be at end */ tif->tif_curoff = 0; tif->tif_row = (uint32) -1; tif->tif_curstrip = (tstrip_t) -1; return (1); } /* [BFC] * * Author: Bruce Cameron <cameron@petris.com> * * Set a table of tags that are to be replaced during directory process by the * 'IGNORE' state - or return TRUE/FALSE for the requested tag such that * 'ReadDirectory' can use the stored information. * * FIXME: this is never used properly. Should be removed in the future. */ int TIFFReassignTagToIgnore (enum TIFFIgnoreSense task, int TIFFtagID) { static int TIFFignoretags [FIELD_LAST]; static int tagcount = 0 ; int i; /* Loop index */ int j; /* Loop index */ switch (task) { case TIS_STORE: if ( tagcount < (FIELD_LAST - 1) ) { for ( j = 0 ; j < tagcount ; ++j ) { /* Do not add duplicate tag */ if ( TIFFignoretags [j] == TIFFtagID ) return (TRUE) ; } TIFFignoretags [tagcount++] = TIFFtagID ; return (TRUE) ; } break ; case TIS_EXTRACT: for ( i = 0 ; i < tagcount ; ++i ) { if ( TIFFignoretags [i] == TIFFtagID ) return (TRUE) ; } break; case TIS_EMPTY: tagcount = 0 ; /* Clear the list */ return (TRUE) ; default: break; } return (FALSE); } /* vim: set ts=8 sts=8 sw=8 noet: */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_pixarlog.c����������������������������������������������0000644�0001750�0001750�00000111667�12320456500�022203� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_pixarlog.c,v 1.15.2.3 2009-01-01 00:10:43 bfriesen Exp $ */ /* * Copyright (c) 1996-1997 Sam Leffler * Copyright (c) 1996 Pixar * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Pixar, Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Pixar, Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL PIXAR, SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "tiffiop.h" #ifdef PIXARLOG_SUPPORT /* * TIFF Library. * PixarLog Compression Support * * Contributed by Dan McCoy. * * PixarLog film support uses the TIFF library to store companded * 11 bit values into a tiff file, which are compressed using the * zip compressor. * * The codec can take as input and produce as output 32-bit IEEE float values * as well as 16-bit or 8-bit unsigned integer values. * * On writing any of the above are converted into the internal * 11-bit log format. In the case of 8 and 16 bit values, the * input is assumed to be unsigned linear color values that represent * the range 0-1. In the case of IEEE values, the 0-1 range is assumed to * be the normal linear color range, in addition over 1 values are * accepted up to a value of about 25.0 to encode "hot" hightlights and such. * The encoding is lossless for 8-bit values, slightly lossy for the * other bit depths. The actual color precision should be better * than the human eye can perceive with extra room to allow for * error introduced by further image computation. As with any quantized * color format, it is possible to perform image calculations which * expose the quantization error. This format should certainly be less * susceptable to such errors than standard 8-bit encodings, but more * susceptable than straight 16-bit or 32-bit encodings. * * On reading the internal format is converted to the desired output format. * The program can request which format it desires by setting the internal * pseudo tag TIFFTAG_PIXARLOGDATAFMT to one of these possible values: * PIXARLOGDATAFMT_FLOAT = provide IEEE float values. * PIXARLOGDATAFMT_16BIT = provide unsigned 16-bit integer values * PIXARLOGDATAFMT_8BIT = provide unsigned 8-bit integer values * * alternately PIXARLOGDATAFMT_8BITABGR provides unsigned 8-bit integer * values with the difference that if there are exactly three or four channels * (rgb or rgba) it swaps the channel order (bgr or abgr). * * PIXARLOGDATAFMT_11BITLOG provides the internal encoding directly * packed in 16-bit values. However no tools are supplied for interpreting * these values. * * "hot" (over 1.0) areas written in floating point get clamped to * 1.0 in the integer data types. * * When the file is closed after writing, the bit depth and sample format * are set always to appear as if 8-bit data has been written into it. * That way a naive program unaware of the particulars of the encoding * gets the format it is most likely able to handle. * * The codec does it's own horizontal differencing step on the coded * values so the libraries predictor stuff should be turned off. * The codec also handle byte swapping the encoded values as necessary * since the library does not have the information necessary * to know the bit depth of the raw unencoded buffer. * */ #include "tif_predict.h" #include "zlib.h" #include <stdio.h> #include <stdlib.h> #include <math.h> /* Tables for converting to/from 11 bit coded values */ #define TSIZE 2048 /* decode table size (11-bit tokens) */ #define TSIZEP1 2049 /* Plus one for slop */ #define ONE 1250 /* token value of 1.0 exactly */ #define RATIO 1.004 /* nominal ratio for log part */ #define CODE_MASK 0x7ff /* 11 bits. */ static float Fltsize; static float LogK1, LogK2; #define REPEAT(n, op) { int i; i=n; do { i--; op; } while (i>0); } static void horizontalAccumulateF(uint16 *wp, int n, int stride, float *op, float *ToLinearF) { register unsigned int cr, cg, cb, ca, mask; register float t0, t1, t2, t3; if (n >= stride) { mask = CODE_MASK; if (stride == 3) { t0 = ToLinearF[cr = wp[0]]; t1 = ToLinearF[cg = wp[1]]; t2 = ToLinearF[cb = wp[2]]; op[0] = t0; op[1] = t1; op[2] = t2; n -= 3; while (n > 0) { wp += 3; op += 3; n -= 3; t0 = ToLinearF[(cr += wp[0]) & mask]; t1 = ToLinearF[(cg += wp[1]) & mask]; t2 = ToLinearF[(cb += wp[2]) & mask]; op[0] = t0; op[1] = t1; op[2] = t2; } } else if (stride == 4) { t0 = ToLinearF[cr = wp[0]]; t1 = ToLinearF[cg = wp[1]]; t2 = ToLinearF[cb = wp[2]]; t3 = ToLinearF[ca = wp[3]]; op[0] = t0; op[1] = t1; op[2] = t2; op[3] = t3; n -= 4; while (n > 0) { wp += 4; op += 4; n -= 4; t0 = ToLinearF[(cr += wp[0]) & mask]; t1 = ToLinearF[(cg += wp[1]) & mask]; t2 = ToLinearF[(cb += wp[2]) & mask]; t3 = ToLinearF[(ca += wp[3]) & mask]; op[0] = t0; op[1] = t1; op[2] = t2; op[3] = t3; } } else { REPEAT(stride, *op = ToLinearF[*wp&mask]; wp++; op++) n -= stride; while (n > 0) { REPEAT(stride, wp[stride] += *wp; *op = ToLinearF[*wp&mask]; wp++; op++) n -= stride; } } } } static void horizontalAccumulate12(uint16 *wp, int n, int stride, int16 *op, float *ToLinearF) { register unsigned int cr, cg, cb, ca, mask; register float t0, t1, t2, t3; #define SCALE12 2048.0F #define CLAMP12(t) (((t) < 3071) ? (uint16) (t) : 3071) if (n >= stride) { mask = CODE_MASK; if (stride == 3) { t0 = ToLinearF[cr = wp[0]] * SCALE12; t1 = ToLinearF[cg = wp[1]] * SCALE12; t2 = ToLinearF[cb = wp[2]] * SCALE12; op[0] = CLAMP12(t0); op[1] = CLAMP12(t1); op[2] = CLAMP12(t2); n -= 3; while (n > 0) { wp += 3; op += 3; n -= 3; t0 = ToLinearF[(cr += wp[0]) & mask] * SCALE12; t1 = ToLinearF[(cg += wp[1]) & mask] * SCALE12; t2 = ToLinearF[(cb += wp[2]) & mask] * SCALE12; op[0] = CLAMP12(t0); op[1] = CLAMP12(t1); op[2] = CLAMP12(t2); } } else if (stride == 4) { t0 = ToLinearF[cr = wp[0]] * SCALE12; t1 = ToLinearF[cg = wp[1]] * SCALE12; t2 = ToLinearF[cb = wp[2]] * SCALE12; t3 = ToLinearF[ca = wp[3]] * SCALE12; op[0] = CLAMP12(t0); op[1] = CLAMP12(t1); op[2] = CLAMP12(t2); op[3] = CLAMP12(t3); n -= 4; while (n > 0) { wp += 4; op += 4; n -= 4; t0 = ToLinearF[(cr += wp[0]) & mask] * SCALE12; t1 = ToLinearF[(cg += wp[1]) & mask] * SCALE12; t2 = ToLinearF[(cb += wp[2]) & mask] * SCALE12; t3 = ToLinearF[(ca += wp[3]) & mask] * SCALE12; op[0] = CLAMP12(t0); op[1] = CLAMP12(t1); op[2] = CLAMP12(t2); op[3] = CLAMP12(t3); } } else { REPEAT(stride, t0 = ToLinearF[*wp&mask] * SCALE12; *op = CLAMP12(t0); wp++; op++) n -= stride; while (n > 0) { REPEAT(stride, wp[stride] += *wp; t0 = ToLinearF[wp[stride]&mask]*SCALE12; *op = CLAMP12(t0); wp++; op++) n -= stride; } } } } static void horizontalAccumulate16(uint16 *wp, int n, int stride, uint16 *op, uint16 *ToLinear16) { register unsigned int cr, cg, cb, ca, mask; if (n >= stride) { mask = CODE_MASK; if (stride == 3) { op[0] = ToLinear16[cr = wp[0]]; op[1] = ToLinear16[cg = wp[1]]; op[2] = ToLinear16[cb = wp[2]]; n -= 3; while (n > 0) { wp += 3; op += 3; n -= 3; op[0] = ToLinear16[(cr += wp[0]) & mask]; op[1] = ToLinear16[(cg += wp[1]) & mask]; op[2] = ToLinear16[(cb += wp[2]) & mask]; } } else if (stride == 4) { op[0] = ToLinear16[cr = wp[0]]; op[1] = ToLinear16[cg = wp[1]]; op[2] = ToLinear16[cb = wp[2]]; op[3] = ToLinear16[ca = wp[3]]; n -= 4; while (n > 0) { wp += 4; op += 4; n -= 4; op[0] = ToLinear16[(cr += wp[0]) & mask]; op[1] = ToLinear16[(cg += wp[1]) & mask]; op[2] = ToLinear16[(cb += wp[2]) & mask]; op[3] = ToLinear16[(ca += wp[3]) & mask]; } } else { REPEAT(stride, *op = ToLinear16[*wp&mask]; wp++; op++) n -= stride; while (n > 0) { REPEAT(stride, wp[stride] += *wp; *op = ToLinear16[*wp&mask]; wp++; op++) n -= stride; } } } } /* * Returns the log encoded 11-bit values with the horizontal * differencing undone. */ static void horizontalAccumulate11(uint16 *wp, int n, int stride, uint16 *op) { register unsigned int cr, cg, cb, ca, mask; if (n >= stride) { mask = CODE_MASK; if (stride == 3) { op[0] = cr = wp[0]; op[1] = cg = wp[1]; op[2] = cb = wp[2]; n -= 3; while (n > 0) { wp += 3; op += 3; n -= 3; op[0] = (cr += wp[0]) & mask; op[1] = (cg += wp[1]) & mask; op[2] = (cb += wp[2]) & mask; } } else if (stride == 4) { op[0] = cr = wp[0]; op[1] = cg = wp[1]; op[2] = cb = wp[2]; op[3] = ca = wp[3]; n -= 4; while (n > 0) { wp += 4; op += 4; n -= 4; op[0] = (cr += wp[0]) & mask; op[1] = (cg += wp[1]) & mask; op[2] = (cb += wp[2]) & mask; op[3] = (ca += wp[3]) & mask; } } else { REPEAT(stride, *op = *wp&mask; wp++; op++) n -= stride; while (n > 0) { REPEAT(stride, wp[stride] += *wp; *op = *wp&mask; wp++; op++) n -= stride; } } } } static void horizontalAccumulate8(uint16 *wp, int n, int stride, unsigned char *op, unsigned char *ToLinear8) { register unsigned int cr, cg, cb, ca, mask; if (n >= stride) { mask = CODE_MASK; if (stride == 3) { op[0] = ToLinear8[cr = wp[0]]; op[1] = ToLinear8[cg = wp[1]]; op[2] = ToLinear8[cb = wp[2]]; n -= 3; while (n > 0) { n -= 3; wp += 3; op += 3; op[0] = ToLinear8[(cr += wp[0]) & mask]; op[1] = ToLinear8[(cg += wp[1]) & mask]; op[2] = ToLinear8[(cb += wp[2]) & mask]; } } else if (stride == 4) { op[0] = ToLinear8[cr = wp[0]]; op[1] = ToLinear8[cg = wp[1]]; op[2] = ToLinear8[cb = wp[2]]; op[3] = ToLinear8[ca = wp[3]]; n -= 4; while (n > 0) { n -= 4; wp += 4; op += 4; op[0] = ToLinear8[(cr += wp[0]) & mask]; op[1] = ToLinear8[(cg += wp[1]) & mask]; op[2] = ToLinear8[(cb += wp[2]) & mask]; op[3] = ToLinear8[(ca += wp[3]) & mask]; } } else { REPEAT(stride, *op = ToLinear8[*wp&mask]; wp++; op++) n -= stride; while (n > 0) { REPEAT(stride, wp[stride] += *wp; *op = ToLinear8[*wp&mask]; wp++; op++) n -= stride; } } } } static void horizontalAccumulate8abgr(uint16 *wp, int n, int stride, unsigned char *op, unsigned char *ToLinear8) { register unsigned int cr, cg, cb, ca, mask; register unsigned char t0, t1, t2, t3; if (n >= stride) { mask = CODE_MASK; if (stride == 3) { op[0] = 0; t1 = ToLinear8[cb = wp[2]]; t2 = ToLinear8[cg = wp[1]]; t3 = ToLinear8[cr = wp[0]]; op[1] = t1; op[2] = t2; op[3] = t3; n -= 3; while (n > 0) { n -= 3; wp += 3; op += 4; op[0] = 0; t1 = ToLinear8[(cb += wp[2]) & mask]; t2 = ToLinear8[(cg += wp[1]) & mask]; t3 = ToLinear8[(cr += wp[0]) & mask]; op[1] = t1; op[2] = t2; op[3] = t3; } } else if (stride == 4) { t0 = ToLinear8[ca = wp[3]]; t1 = ToLinear8[cb = wp[2]]; t2 = ToLinear8[cg = wp[1]]; t3 = ToLinear8[cr = wp[0]]; op[0] = t0; op[1] = t1; op[2] = t2; op[3] = t3; n -= 4; while (n > 0) { n -= 4; wp += 4; op += 4; t0 = ToLinear8[(ca += wp[3]) & mask]; t1 = ToLinear8[(cb += wp[2]) & mask]; t2 = ToLinear8[(cg += wp[1]) & mask]; t3 = ToLinear8[(cr += wp[0]) & mask]; op[0] = t0; op[1] = t1; op[2] = t2; op[3] = t3; } } else { REPEAT(stride, *op = ToLinear8[*wp&mask]; wp++; op++) n -= stride; while (n > 0) { REPEAT(stride, wp[stride] += *wp; *op = ToLinear8[*wp&mask]; wp++; op++) n -= stride; } } } } /* * State block for each open TIFF * file using PixarLog compression/decompression. */ typedef struct { TIFFPredictorState predict; z_stream stream; uint16 *tbuf; uint16 stride; int state; int user_datafmt; int quality; #define PLSTATE_INIT 1 TIFFVSetMethod vgetparent; /* super-class method */ TIFFVSetMethod vsetparent; /* super-class method */ float *ToLinearF; uint16 *ToLinear16; unsigned char *ToLinear8; uint16 *FromLT2; uint16 *From14; /* Really for 16-bit data, but we shift down 2 */ uint16 *From8; } PixarLogState; static int PixarLogMakeTables(PixarLogState *sp) { /* * We make several tables here to convert between various external * representations (float, 16-bit, and 8-bit) and the internal * 11-bit companded representation. The 11-bit representation has two * distinct regions. A linear bottom end up through .018316 in steps * of about .000073, and a region of constant ratio up to about 25. * These floating point numbers are stored in the main table ToLinearF. * All other tables are derived from this one. The tables (and the * ratios) are continuous at the internal seam. */ int nlin, lt2size; int i, j; double b, c, linstep, v; float *ToLinearF; uint16 *ToLinear16; unsigned char *ToLinear8; uint16 *FromLT2; uint16 *From14; /* Really for 16-bit data, but we shift down 2 */ uint16 *From8; c = log(RATIO); nlin = (int)(1./c); /* nlin must be an integer */ c = 1./nlin; b = exp(-c*ONE); /* multiplicative scale factor [b*exp(c*ONE) = 1] */ linstep = b*c*exp(1.); LogK1 = (float)(1./c); /* if (v >= 2) token = k1*log(v*k2) */ LogK2 = (float)(1./b); lt2size = (int)(2./linstep) + 1; FromLT2 = (uint16 *)_TIFFmalloc(lt2size*sizeof(uint16)); From14 = (uint16 *)_TIFFmalloc(16384*sizeof(uint16)); From8 = (uint16 *)_TIFFmalloc(256*sizeof(uint16)); ToLinearF = (float *)_TIFFmalloc(TSIZEP1 * sizeof(float)); ToLinear16 = (uint16 *)_TIFFmalloc(TSIZEP1 * sizeof(uint16)); ToLinear8 = (unsigned char *)_TIFFmalloc(TSIZEP1 * sizeof(unsigned char)); if (FromLT2 == NULL || From14 == NULL || From8 == NULL || ToLinearF == NULL || ToLinear16 == NULL || ToLinear8 == NULL) { if (FromLT2) _TIFFfree(FromLT2); if (From14) _TIFFfree(From14); if (From8) _TIFFfree(From8); if (ToLinearF) _TIFFfree(ToLinearF); if (ToLinear16) _TIFFfree(ToLinear16); if (ToLinear8) _TIFFfree(ToLinear8); sp->FromLT2 = NULL; sp->From14 = NULL; sp->From8 = NULL; sp->ToLinearF = NULL; sp->ToLinear16 = NULL; sp->ToLinear8 = NULL; return 0; } j = 0; for (i = 0; i < nlin; i++) { v = i * linstep; ToLinearF[j++] = (float)v; } for (i = nlin; i < TSIZE; i++) ToLinearF[j++] = (float)(b*exp(c*i)); ToLinearF[2048] = ToLinearF[2047]; for (i = 0; i < TSIZEP1; i++) { v = ToLinearF[i]*65535.0 + 0.5; ToLinear16[i] = (v > 65535.0) ? 65535 : (uint16)v; v = ToLinearF[i]*255.0 + 0.5; ToLinear8[i] = (v > 255.0) ? 255 : (unsigned char)v; } j = 0; for (i = 0; i < lt2size; i++) { if ((i*linstep)*(i*linstep) > ToLinearF[j]*ToLinearF[j+1]) j++; FromLT2[i] = j; } /* * Since we lose info anyway on 16-bit data, we set up a 14-bit * table and shift 16-bit values down two bits on input. * saves a little table space. */ j = 0; for (i = 0; i < 16384; i++) { while ((i/16383.)*(i/16383.) > ToLinearF[j]*ToLinearF[j+1]) j++; From14[i] = j; } j = 0; for (i = 0; i < 256; i++) { while ((i/255.)*(i/255.) > ToLinearF[j]*ToLinearF[j+1]) j++; From8[i] = j; } Fltsize = (float)(lt2size/2); sp->ToLinearF = ToLinearF; sp->ToLinear16 = ToLinear16; sp->ToLinear8 = ToLinear8; sp->FromLT2 = FromLT2; sp->From14 = From14; sp->From8 = From8; return 1; } #define DecoderState(tif) ((PixarLogState*) (tif)->tif_data) #define EncoderState(tif) ((PixarLogState*) (tif)->tif_data) static int PixarLogEncode(TIFF*, tidata_t, tsize_t, tsample_t); static int PixarLogDecode(TIFF*, tidata_t, tsize_t, tsample_t); #define PIXARLOGDATAFMT_UNKNOWN -1 static int PixarLogGuessDataFmt(TIFFDirectory *td) { int guess = PIXARLOGDATAFMT_UNKNOWN; int format = td->td_sampleformat; /* If the user didn't tell us his datafmt, * take our best guess from the bitspersample. */ switch (td->td_bitspersample) { case 32: if (format == SAMPLEFORMAT_IEEEFP) guess = PIXARLOGDATAFMT_FLOAT; break; case 16: if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT) guess = PIXARLOGDATAFMT_16BIT; break; case 12: if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_INT) guess = PIXARLOGDATAFMT_12BITPICIO; break; case 11: if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT) guess = PIXARLOGDATAFMT_11BITLOG; break; case 8: if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT) guess = PIXARLOGDATAFMT_8BIT; break; } return guess; } static uint32 multiply(size_t m1, size_t m2) { uint32 bytes = m1 * m2; if (m1 && bytes / m1 != m2) bytes = 0; return bytes; } static int PixarLogSetupDecode(TIFF* tif) { TIFFDirectory *td = &tif->tif_dir; PixarLogState* sp = DecoderState(tif); tsize_t tbuf_size; static const char module[] = "PixarLogSetupDecode"; assert(sp != NULL); /* Make sure no byte swapping happens on the data * after decompression. */ tif->tif_postdecode = _TIFFNoPostDecode; /* for some reason, we can't do this in TIFFInitPixarLog */ sp->stride = (td->td_planarconfig == PLANARCONFIG_CONTIG ? td->td_samplesperpixel : 1); tbuf_size = multiply(multiply(multiply(sp->stride, td->td_imagewidth), td->td_rowsperstrip), sizeof(uint16)); if (tbuf_size == 0) return (0); sp->tbuf = (uint16 *) _TIFFmalloc(tbuf_size); if (sp->tbuf == NULL) return (0); if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) sp->user_datafmt = PixarLogGuessDataFmt(td); if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) { TIFFErrorExt(tif->tif_clientdata, module, "PixarLog compression can't handle bits depth/data format combination (depth: %d)", td->td_bitspersample); return (0); } if (inflateInit(&sp->stream) != Z_OK) { TIFFErrorExt(tif->tif_clientdata, module, "%s: %s", tif->tif_name, sp->stream.msg); return (0); } else { sp->state |= PLSTATE_INIT; return (1); } } /* * Setup state for decoding a strip. */ static int PixarLogPreDecode(TIFF* tif, tsample_t s) { PixarLogState* sp = DecoderState(tif); (void) s; assert(sp != NULL); sp->stream.next_in = tif->tif_rawdata; sp->stream.avail_in = tif->tif_rawcc; return (inflateReset(&sp->stream) == Z_OK); } static int PixarLogDecode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s) { TIFFDirectory *td = &tif->tif_dir; PixarLogState* sp = DecoderState(tif); static const char module[] = "PixarLogDecode"; int i, nsamples, llen; uint16 *up; switch (sp->user_datafmt) { case PIXARLOGDATAFMT_FLOAT: nsamples = occ / sizeof(float); /* XXX float == 32 bits */ break; case PIXARLOGDATAFMT_16BIT: case PIXARLOGDATAFMT_12BITPICIO: case PIXARLOGDATAFMT_11BITLOG: nsamples = occ / sizeof(uint16); /* XXX uint16 == 16 bits */ break; case PIXARLOGDATAFMT_8BIT: case PIXARLOGDATAFMT_8BITABGR: nsamples = occ; break; default: TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%d bit input not supported in PixarLog", td->td_bitspersample); return 0; } llen = sp->stride * td->td_imagewidth; (void) s; assert(sp != NULL); sp->stream.next_out = (unsigned char *) sp->tbuf; sp->stream.avail_out = nsamples * sizeof(uint16); do { int state = inflate(&sp->stream, Z_PARTIAL_FLUSH); if (state == Z_STREAM_END) { break; /* XXX */ } if (state == Z_DATA_ERROR) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Decoding error at scanline %d, %s", tif->tif_name, tif->tif_row, sp->stream.msg); if (inflateSync(&sp->stream) != Z_OK) return (0); continue; } if (state != Z_OK) { TIFFErrorExt(tif->tif_clientdata, module, "%s: zlib error: %s", tif->tif_name, sp->stream.msg); return (0); } } while (sp->stream.avail_out > 0); /* hopefully, we got all the bytes we needed */ if (sp->stream.avail_out != 0) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Not enough data at scanline %d (short %d bytes)", tif->tif_name, tif->tif_row, sp->stream.avail_out); return (0); } up = sp->tbuf; /* Swap bytes in the data if from a different endian machine. */ if (tif->tif_flags & TIFF_SWAB) TIFFSwabArrayOfShort(up, nsamples); /* * if llen is not an exact multiple of nsamples, the decode operation * may overflow the output buffer, so truncate it enough to prevent * that but still salvage as much data as possible. */ if (nsamples % llen) { TIFFWarningExt(tif->tif_clientdata, module, "%s: stride %d is not a multiple of sample count, " "%d, data truncated.", tif->tif_name, llen, nsamples); nsamples -= nsamples % llen; } for (i = 0; i < nsamples; i += llen, up += llen) { switch (sp->user_datafmt) { case PIXARLOGDATAFMT_FLOAT: horizontalAccumulateF(up, llen, sp->stride, (float *)op, sp->ToLinearF); op += llen * sizeof(float); break; case PIXARLOGDATAFMT_16BIT: horizontalAccumulate16(up, llen, sp->stride, (uint16 *)op, sp->ToLinear16); op += llen * sizeof(uint16); break; case PIXARLOGDATAFMT_12BITPICIO: horizontalAccumulate12(up, llen, sp->stride, (int16 *)op, sp->ToLinearF); op += llen * sizeof(int16); break; case PIXARLOGDATAFMT_11BITLOG: horizontalAccumulate11(up, llen, sp->stride, (uint16 *)op); op += llen * sizeof(uint16); break; case PIXARLOGDATAFMT_8BIT: horizontalAccumulate8(up, llen, sp->stride, (unsigned char *)op, sp->ToLinear8); op += llen * sizeof(unsigned char); break; case PIXARLOGDATAFMT_8BITABGR: horizontalAccumulate8abgr(up, llen, sp->stride, (unsigned char *)op, sp->ToLinear8); op += llen * sizeof(unsigned char); break; default: TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "PixarLogDecode: unsupported bits/sample: %d", td->td_bitspersample); return (0); } } return (1); } static int PixarLogSetupEncode(TIFF* tif) { TIFFDirectory *td = &tif->tif_dir; PixarLogState* sp = EncoderState(tif); tsize_t tbuf_size; static const char module[] = "PixarLogSetupEncode"; assert(sp != NULL); /* for some reason, we can't do this in TIFFInitPixarLog */ sp->stride = (td->td_planarconfig == PLANARCONFIG_CONTIG ? td->td_samplesperpixel : 1); tbuf_size = multiply(multiply(multiply(sp->stride, td->td_imagewidth), td->td_rowsperstrip), sizeof(uint16)); if (tbuf_size == 0) return (0); sp->tbuf = (uint16 *) _TIFFmalloc(tbuf_size); if (sp->tbuf == NULL) return (0); if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) sp->user_datafmt = PixarLogGuessDataFmt(td); if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) { TIFFErrorExt(tif->tif_clientdata, module, "PixarLog compression can't handle %d bit linear encodings", td->td_bitspersample); return (0); } if (deflateInit(&sp->stream, sp->quality) != Z_OK) { TIFFErrorExt(tif->tif_clientdata, module, "%s: %s", tif->tif_name, sp->stream.msg); return (0); } else { sp->state |= PLSTATE_INIT; return (1); } } /* * Reset encoding state at the start of a strip. */ static int PixarLogPreEncode(TIFF* tif, tsample_t s) { PixarLogState *sp = EncoderState(tif); (void) s; assert(sp != NULL); sp->stream.next_out = tif->tif_rawdata; sp->stream.avail_out = tif->tif_rawdatasize; return (deflateReset(&sp->stream) == Z_OK); } static void horizontalDifferenceF(float *ip, int n, int stride, uint16 *wp, uint16 *FromLT2) { int32 r1, g1, b1, a1, r2, g2, b2, a2, mask; float fltsize = Fltsize; #define CLAMP(v) ( (v<(float)0.) ? 0 \ : (v<(float)2.) ? FromLT2[(int)(v*fltsize)] \ : (v>(float)24.2) ? 2047 \ : LogK1*log(v*LogK2) + 0.5 ) mask = CODE_MASK; if (n >= stride) { if (stride == 3) { r2 = wp[0] = (uint16) CLAMP(ip[0]); g2 = wp[1] = (uint16) CLAMP(ip[1]); b2 = wp[2] = (uint16) CLAMP(ip[2]); n -= 3; while (n > 0) { n -= 3; wp += 3; ip += 3; r1 = (int32) CLAMP(ip[0]); wp[0] = (r1-r2) & mask; r2 = r1; g1 = (int32) CLAMP(ip[1]); wp[1] = (g1-g2) & mask; g2 = g1; b1 = (int32) CLAMP(ip[2]); wp[2] = (b1-b2) & mask; b2 = b1; } } else if (stride == 4) { r2 = wp[0] = (uint16) CLAMP(ip[0]); g2 = wp[1] = (uint16) CLAMP(ip[1]); b2 = wp[2] = (uint16) CLAMP(ip[2]); a2 = wp[3] = (uint16) CLAMP(ip[3]); n -= 4; while (n > 0) { n -= 4; wp += 4; ip += 4; r1 = (int32) CLAMP(ip[0]); wp[0] = (r1-r2) & mask; r2 = r1; g1 = (int32) CLAMP(ip[1]); wp[1] = (g1-g2) & mask; g2 = g1; b1 = (int32) CLAMP(ip[2]); wp[2] = (b1-b2) & mask; b2 = b1; a1 = (int32) CLAMP(ip[3]); wp[3] = (a1-a2) & mask; a2 = a1; } } else { ip += n - 1; /* point to last one */ wp += n - 1; /* point to last one */ n -= stride; while (n > 0) { REPEAT(stride, wp[0] = (uint16) CLAMP(ip[0]); wp[stride] -= wp[0]; wp[stride] &= mask; wp--; ip--) n -= stride; } REPEAT(stride, wp[0] = (uint16) CLAMP(ip[0]); wp--; ip--) } } } static void horizontalDifference16(unsigned short *ip, int n, int stride, unsigned short *wp, uint16 *From14) { register int r1, g1, b1, a1, r2, g2, b2, a2, mask; /* assumption is unsigned pixel values */ #undef CLAMP #define CLAMP(v) From14[(v) >> 2] mask = CODE_MASK; if (n >= stride) { if (stride == 3) { r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]); b2 = wp[2] = CLAMP(ip[2]); n -= 3; while (n > 0) { n -= 3; wp += 3; ip += 3; r1 = CLAMP(ip[0]); wp[0] = (r1-r2) & mask; r2 = r1; g1 = CLAMP(ip[1]); wp[1] = (g1-g2) & mask; g2 = g1; b1 = CLAMP(ip[2]); wp[2] = (b1-b2) & mask; b2 = b1; } } else if (stride == 4) { r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]); b2 = wp[2] = CLAMP(ip[2]); a2 = wp[3] = CLAMP(ip[3]); n -= 4; while (n > 0) { n -= 4; wp += 4; ip += 4; r1 = CLAMP(ip[0]); wp[0] = (r1-r2) & mask; r2 = r1; g1 = CLAMP(ip[1]); wp[1] = (g1-g2) & mask; g2 = g1; b1 = CLAMP(ip[2]); wp[2] = (b1-b2) & mask; b2 = b1; a1 = CLAMP(ip[3]); wp[3] = (a1-a2) & mask; a2 = a1; } } else { ip += n - 1; /* point to last one */ wp += n - 1; /* point to last one */ n -= stride; while (n > 0) { REPEAT(stride, wp[0] = CLAMP(ip[0]); wp[stride] -= wp[0]; wp[stride] &= mask; wp--; ip--) n -= stride; } REPEAT(stride, wp[0] = CLAMP(ip[0]); wp--; ip--) } } } static void horizontalDifference8(unsigned char *ip, int n, int stride, unsigned short *wp, uint16 *From8) { register int r1, g1, b1, a1, r2, g2, b2, a2, mask; #undef CLAMP #define CLAMP(v) (From8[(v)]) mask = CODE_MASK; if (n >= stride) { if (stride == 3) { r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]); b2 = wp[2] = CLAMP(ip[2]); n -= 3; while (n > 0) { n -= 3; r1 = CLAMP(ip[3]); wp[3] = (r1-r2) & mask; r2 = r1; g1 = CLAMP(ip[4]); wp[4] = (g1-g2) & mask; g2 = g1; b1 = CLAMP(ip[5]); wp[5] = (b1-b2) & mask; b2 = b1; wp += 3; ip += 3; } } else if (stride == 4) { r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]); b2 = wp[2] = CLAMP(ip[2]); a2 = wp[3] = CLAMP(ip[3]); n -= 4; while (n > 0) { n -= 4; r1 = CLAMP(ip[4]); wp[4] = (r1-r2) & mask; r2 = r1; g1 = CLAMP(ip[5]); wp[5] = (g1-g2) & mask; g2 = g1; b1 = CLAMP(ip[6]); wp[6] = (b1-b2) & mask; b2 = b1; a1 = CLAMP(ip[7]); wp[7] = (a1-a2) & mask; a2 = a1; wp += 4; ip += 4; } } else { wp += n + stride - 1; /* point to last one */ ip += n + stride - 1; /* point to last one */ n -= stride; while (n > 0) { REPEAT(stride, wp[0] = CLAMP(ip[0]); wp[stride] -= wp[0]; wp[stride] &= mask; wp--; ip--) n -= stride; } REPEAT(stride, wp[0] = CLAMP(ip[0]); wp--; ip--) } } } /* * Encode a chunk of pixels. */ static int PixarLogEncode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) { TIFFDirectory *td = &tif->tif_dir; PixarLogState *sp = EncoderState(tif); static const char module[] = "PixarLogEncode"; int i, n, llen; unsigned short * up; (void) s; switch (sp->user_datafmt) { case PIXARLOGDATAFMT_FLOAT: n = cc / sizeof(float); /* XXX float == 32 bits */ break; case PIXARLOGDATAFMT_16BIT: case PIXARLOGDATAFMT_12BITPICIO: case PIXARLOGDATAFMT_11BITLOG: n = cc / sizeof(uint16); /* XXX uint16 == 16 bits */ break; case PIXARLOGDATAFMT_8BIT: case PIXARLOGDATAFMT_8BITABGR: n = cc; break; default: TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%d bit input not supported in PixarLog", td->td_bitspersample); return 0; } llen = sp->stride * td->td_imagewidth; for (i = 0, up = sp->tbuf; i < n; i += llen, up += llen) { switch (sp->user_datafmt) { case PIXARLOGDATAFMT_FLOAT: horizontalDifferenceF((float *)bp, llen, sp->stride, up, sp->FromLT2); bp += llen * sizeof(float); break; case PIXARLOGDATAFMT_16BIT: horizontalDifference16((uint16 *)bp, llen, sp->stride, up, sp->From14); bp += llen * sizeof(uint16); break; case PIXARLOGDATAFMT_8BIT: horizontalDifference8((unsigned char *)bp, llen, sp->stride, up, sp->From8); bp += llen * sizeof(unsigned char); break; default: TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%d bit input not supported in PixarLog", td->td_bitspersample); return 0; } } sp->stream.next_in = (unsigned char *) sp->tbuf; sp->stream.avail_in = n * sizeof(uint16); do { if (deflate(&sp->stream, Z_NO_FLUSH) != Z_OK) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Encoder error: %s", tif->tif_name, sp->stream.msg); return (0); } if (sp->stream.avail_out == 0) { tif->tif_rawcc = tif->tif_rawdatasize; TIFFFlushData1(tif); sp->stream.next_out = tif->tif_rawdata; sp->stream.avail_out = tif->tif_rawdatasize; } } while (sp->stream.avail_in > 0); return (1); } /* * Finish off an encoded strip by flushing the last * string and tacking on an End Of Information code. */ static int PixarLogPostEncode(TIFF* tif) { PixarLogState *sp = EncoderState(tif); static const char module[] = "PixarLogPostEncode"; int state; sp->stream.avail_in = 0; do { state = deflate(&sp->stream, Z_FINISH); switch (state) { case Z_STREAM_END: case Z_OK: if (sp->stream.avail_out != (uint32)tif->tif_rawdatasize) { tif->tif_rawcc = tif->tif_rawdatasize - sp->stream.avail_out; TIFFFlushData1(tif); sp->stream.next_out = tif->tif_rawdata; sp->stream.avail_out = tif->tif_rawdatasize; } break; default: TIFFErrorExt(tif->tif_clientdata, module, "%s: zlib error: %s", tif->tif_name, sp->stream.msg); return (0); } } while (state != Z_STREAM_END); return (1); } static void PixarLogClose(TIFF* tif) { TIFFDirectory *td = &tif->tif_dir; /* In a really sneaky maneuver, on close, we covertly modify both * bitspersample and sampleformat in the directory to indicate * 8-bit linear. This way, the decode "just works" even for * readers that don't know about PixarLog, or how to set * the PIXARLOGDATFMT pseudo-tag. */ td->td_bitspersample = 8; td->td_sampleformat = SAMPLEFORMAT_UINT; } static void PixarLogCleanup(TIFF* tif) { PixarLogState* sp = (PixarLogState*) tif->tif_data; assert(sp != 0); (void)TIFFPredictorCleanup(tif); tif->tif_tagmethods.vgetfield = sp->vgetparent; tif->tif_tagmethods.vsetfield = sp->vsetparent; if (sp->FromLT2) _TIFFfree(sp->FromLT2); if (sp->From14) _TIFFfree(sp->From14); if (sp->From8) _TIFFfree(sp->From8); if (sp->ToLinearF) _TIFFfree(sp->ToLinearF); if (sp->ToLinear16) _TIFFfree(sp->ToLinear16); if (sp->ToLinear8) _TIFFfree(sp->ToLinear8); if (sp->state&PLSTATE_INIT) { if (tif->tif_mode == O_RDONLY) inflateEnd(&sp->stream); else deflateEnd(&sp->stream); } if (sp->tbuf) _TIFFfree(sp->tbuf); _TIFFfree(sp); tif->tif_data = NULL; _TIFFSetDefaultCompressionState(tif); } static int PixarLogVSetField(TIFF* tif, ttag_t tag, va_list ap) { PixarLogState *sp = (PixarLogState *)tif->tif_data; int result; static const char module[] = "PixarLogVSetField"; switch (tag) { case TIFFTAG_PIXARLOGQUALITY: sp->quality = va_arg(ap, int); if (tif->tif_mode != O_RDONLY && (sp->state&PLSTATE_INIT)) { if (deflateParams(&sp->stream, sp->quality, Z_DEFAULT_STRATEGY) != Z_OK) { TIFFErrorExt(tif->tif_clientdata, module, "%s: zlib error: %s", tif->tif_name, sp->stream.msg); return (0); } } return (1); case TIFFTAG_PIXARLOGDATAFMT: sp->user_datafmt = va_arg(ap, int); /* Tweak the TIFF header so that the rest of libtiff knows what * size of data will be passed between app and library, and * assume that the app knows what it is doing and is not * confused by these header manipulations... */ switch (sp->user_datafmt) { case PIXARLOGDATAFMT_8BIT: case PIXARLOGDATAFMT_8BITABGR: TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8); TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT); break; case PIXARLOGDATAFMT_11BITLOG: TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16); TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT); break; case PIXARLOGDATAFMT_12BITPICIO: TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16); TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_INT); break; case PIXARLOGDATAFMT_16BIT: TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16); TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT); break; case PIXARLOGDATAFMT_FLOAT: TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 32); TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP); break; } /* * Must recalculate sizes should bits/sample change. */ tif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tsize_t) -1; tif->tif_scanlinesize = TIFFScanlineSize(tif); result = 1; /* NB: pseudo tag */ break; default: result = (*sp->vsetparent)(tif, tag, ap); } return (result); } static int PixarLogVGetField(TIFF* tif, ttag_t tag, va_list ap) { PixarLogState *sp = (PixarLogState *)tif->tif_data; switch (tag) { case TIFFTAG_PIXARLOGQUALITY: *va_arg(ap, int*) = sp->quality; break; case TIFFTAG_PIXARLOGDATAFMT: *va_arg(ap, int*) = sp->user_datafmt; break; default: return (*sp->vgetparent)(tif, tag, ap); } return (1); } static const TIFFFieldInfo pixarlogFieldInfo[] = { {TIFFTAG_PIXARLOGDATAFMT,0,0,TIFF_ANY, FIELD_PSEUDO,FALSE,FALSE,""}, {TIFFTAG_PIXARLOGQUALITY,0,0,TIFF_ANY, FIELD_PSEUDO,FALSE,FALSE,""} }; int TIFFInitPixarLog(TIFF* tif, int scheme) { static const char module[] = "TIFFInitPixarLog"; PixarLogState* sp; assert(scheme == COMPRESSION_PIXARLOG); /* * Merge codec-specific tag information. */ if (!_TIFFMergeFieldInfo(tif, pixarlogFieldInfo, TIFFArrayCount(pixarlogFieldInfo))) { TIFFErrorExt(tif->tif_clientdata, module, "Merging PixarLog codec-specific tags failed"); return 0; } /* * Allocate state block so tag methods have storage to record values. */ tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (PixarLogState)); if (tif->tif_data == NULL) goto bad; sp = (PixarLogState*) tif->tif_data; _TIFFmemset(sp, 0, sizeof (*sp)); sp->stream.data_type = Z_BINARY; sp->user_datafmt = PIXARLOGDATAFMT_UNKNOWN; /* * Install codec methods. */ tif->tif_setupdecode = PixarLogSetupDecode; tif->tif_predecode = PixarLogPreDecode; tif->tif_decoderow = PixarLogDecode; tif->tif_decodestrip = PixarLogDecode; tif->tif_decodetile = PixarLogDecode; tif->tif_setupencode = PixarLogSetupEncode; tif->tif_preencode = PixarLogPreEncode; tif->tif_postencode = PixarLogPostEncode; tif->tif_encoderow = PixarLogEncode; tif->tif_encodestrip = PixarLogEncode; tif->tif_encodetile = PixarLogEncode; tif->tif_close = PixarLogClose; tif->tif_cleanup = PixarLogCleanup; /* Override SetField so we can handle our private pseudo-tag */ sp->vgetparent = tif->tif_tagmethods.vgetfield; tif->tif_tagmethods.vgetfield = PixarLogVGetField; /* hook for codec tags */ sp->vsetparent = tif->tif_tagmethods.vsetfield; tif->tif_tagmethods.vsetfield = PixarLogVSetField; /* hook for codec tags */ /* Default values for codec-specific fields */ sp->quality = Z_DEFAULT_COMPRESSION; /* default comp. level */ sp->state = 0; /* we don't wish to use the predictor, * the default is none, which predictor value 1 */ (void) TIFFPredictorInit(tif); /* * build the companding tables */ PixarLogMakeTables(sp); return (1); bad: TIFFErrorExt(tif->tif_clientdata, module, "No space for PixarLog state block"); return (0); } #endif /* PIXARLOG_SUPPORT */ /* vim: set ts=8 sts=8 sw=8 noet: */ �������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_next.c��������������������������������������������������0000644�0001750�0001750�00000007535�12320456500�021332� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_next.c,v 1.8 2006/10/12 15:00:49 dron Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "tiffiop.h" #ifdef NEXT_SUPPORT /* * TIFF Library. * * NeXT 2-bit Grey Scale Compression Algorithm Support */ #define SETPIXEL(op, v) { \ switch (npixels++ & 3) { \ case 0: op[0] = (unsigned char) ((v) << 6); break; \ case 1: op[0] |= (v) << 4; break; \ case 2: op[0] |= (v) << 2; break; \ case 3: *op++ |= (v); break; \ } \ } #define LITERALROW 0x00 #define LITERALSPAN 0x40 #define WHITE ((1<<2)-1) static int NeXTDecode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s) { unsigned char *bp, *op; tsize_t cc; tidata_t row; tsize_t scanline, n; (void) s; /* * Each scanline is assumed to start off as all * white (we assume a PhotometricInterpretation * of ``min-is-black''). */ for (op = buf, cc = occ; cc-- > 0;) *op++ = 0xff; bp = (unsigned char *)tif->tif_rawcp; cc = tif->tif_rawcc; scanline = tif->tif_scanlinesize; for (row = buf; occ > 0; occ -= scanline, row += scanline) { n = *bp++, cc--; switch (n) { case LITERALROW: /* * The entire scanline is given as literal values. */ if (cc < scanline) goto bad; _TIFFmemcpy(row, bp, scanline); bp += scanline; cc -= scanline; break; case LITERALSPAN: { tsize_t off; /* * The scanline has a literal span that begins at some * offset. */ off = (bp[0] * 256) + bp[1]; n = (bp[2] * 256) + bp[3]; if (cc < 4+n || off+n > scanline) goto bad; _TIFFmemcpy(row+off, bp+4, n); bp += 4+n; cc -= 4+n; break; } default: { uint32 npixels = 0, grey; uint32 imagewidth = tif->tif_dir.td_imagewidth; /* * The scanline is composed of a sequence of constant * color ``runs''. We shift into ``run mode'' and * interpret bytes as codes of the form * <color><npixels> until we've filled the scanline. */ op = row; for (;;) { grey = (n>>6) & 0x3; n &= 0x3f; /* * Ensure the run does not exceed the scanline * bounds, potentially resulting in a security * issue. */ while (n-- > 0 && npixels < imagewidth) SETPIXEL(op, grey); if (npixels >= imagewidth) break; if (cc == 0) goto bad; n = *bp++, cc--; } break; } } } tif->tif_rawcp = (tidata_t) bp; tif->tif_rawcc = cc; return (1); bad: TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "NeXTDecode: Not enough data for scanline %ld", (long) tif->tif_row); return (0); } int TIFFInitNeXT(TIFF* tif, int scheme) { (void) scheme; tif->tif_decoderow = NeXTDecode; tif->tif_decodestrip = NeXTDecode; tif->tif_decodetile = NeXTDecode; return (1); } #endif /* NEXT_SUPPORT */ /* vim: set ts=8 sts=8 sw=8 noet: */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_flush.c�������������������������������������������������0000644�0001750�0001750�00000004251�12320456500�021465� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_flush.c,v 1.3 2000/09/15 20:52:42 warmerda Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. */ #include "tiffiop.h" int TIFFFlush(TIFF* tif) { if (tif->tif_mode != O_RDONLY) { if (!TIFFFlushData(tif)) return (0); if ((tif->tif_flags & TIFF_DIRTYDIRECT) && !TIFFWriteDirectory(tif)) return (0); } return (1); } /* * Flush buffered data to the file. * * Frank Warmerdam'2000: I modified this to return 1 if TIFF_BEENWRITING * is not set, so that TIFFFlush() will proceed to write out the directory. * The documentation says returning 1 is an error indicator, but not having * been writing isn't exactly a an error. Hopefully this doesn't cause * problems for other people. */ int TIFFFlushData(TIFF* tif) { if ((tif->tif_flags & TIFF_BEENWRITING) == 0) return (0); if (tif->tif_flags & TIFF_POSTENCODE) { tif->tif_flags &= ~TIFF_POSTENCODE; if (!(*tif->tif_postencode)(tif)) return (0); } return (TIFFFlushData1(tif)); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_tile.c��������������������������������������������������0000644�0001750�0001750�00000017151�12320456500�021304� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_tile.c,v 1.12 2006/02/09 16:15:43 dron Exp $ */ /* * Copyright (c) 1991-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * Tiled Image Support Routines. */ #include "tiffiop.h" static uint32 summarize(TIFF* tif, size_t summand1, size_t summand2, const char* where) { /* * XXX: We are using casting to uint32 here, because sizeof(size_t) * may be larger than sizeof(uint32) on 64-bit architectures. */ uint32 bytes = summand1 + summand2; if (bytes - summand1 != summand2) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Integer overflow in %s", where); bytes = 0; } return (bytes); } static uint32 multiply(TIFF* tif, size_t nmemb, size_t elem_size, const char* where) { uint32 bytes = nmemb * elem_size; if (elem_size && bytes / elem_size != nmemb) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Integer overflow in %s", where); bytes = 0; } return (bytes); } /* * Compute which tile an (x,y,z,s) value is in. */ ttile_t TIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, tsample_t s) { TIFFDirectory *td = &tif->tif_dir; uint32 dx = td->td_tilewidth; uint32 dy = td->td_tilelength; uint32 dz = td->td_tiledepth; ttile_t tile = 1; if (td->td_imagedepth == 1) z = 0; if (dx == (uint32) -1) dx = td->td_imagewidth; if (dy == (uint32) -1) dy = td->td_imagelength; if (dz == (uint32) -1) dz = td->td_imagedepth; if (dx != 0 && dy != 0 && dz != 0) { uint32 xpt = TIFFhowmany(td->td_imagewidth, dx); uint32 ypt = TIFFhowmany(td->td_imagelength, dy); uint32 zpt = TIFFhowmany(td->td_imagedepth, dz); if (td->td_planarconfig == PLANARCONFIG_SEPARATE) tile = (xpt*ypt*zpt)*s + (xpt*ypt)*(z/dz) + xpt*(y/dy) + x/dx; else tile = (xpt*ypt)*(z/dz) + xpt*(y/dy) + x/dx; } return (tile); } /* * Check an (x,y,z,s) coordinate * against the image bounds. */ int TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, tsample_t s) { TIFFDirectory *td = &tif->tif_dir; if (x >= td->td_imagewidth) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Col out of range, max %lu", (unsigned long) x, (unsigned long) (td->td_imagewidth - 1)); return (0); } if (y >= td->td_imagelength) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Row out of range, max %lu", (unsigned long) y, (unsigned long) (td->td_imagelength - 1)); return (0); } if (z >= td->td_imagedepth) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Depth out of range, max %lu", (unsigned long) z, (unsigned long) (td->td_imagedepth - 1)); return (0); } if (td->td_planarconfig == PLANARCONFIG_SEPARATE && s >= td->td_samplesperpixel) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Sample out of range, max %lu", (unsigned long) s, (unsigned long) (td->td_samplesperpixel - 1)); return (0); } return (1); } /* * Compute how many tiles are in an image. */ ttile_t TIFFNumberOfTiles(TIFF* tif) { TIFFDirectory *td = &tif->tif_dir; uint32 dx = td->td_tilewidth; uint32 dy = td->td_tilelength; uint32 dz = td->td_tiledepth; ttile_t ntiles; if (dx == (uint32) -1) dx = td->td_imagewidth; if (dy == (uint32) -1) dy = td->td_imagelength; if (dz == (uint32) -1) dz = td->td_imagedepth; ntiles = (dx == 0 || dy == 0 || dz == 0) ? 0 : multiply(tif, multiply(tif, TIFFhowmany(td->td_imagewidth, dx), TIFFhowmany(td->td_imagelength, dy), "TIFFNumberOfTiles"), TIFFhowmany(td->td_imagedepth, dz), "TIFFNumberOfTiles"); if (td->td_planarconfig == PLANARCONFIG_SEPARATE) ntiles = multiply(tif, ntiles, td->td_samplesperpixel, "TIFFNumberOfTiles"); return (ntiles); } /* * Compute the # bytes in each row of a tile. */ tsize_t TIFFTileRowSize(TIFF* tif) { TIFFDirectory *td = &tif->tif_dir; tsize_t rowsize; if (td->td_tilelength == 0 || td->td_tilewidth == 0) return ((tsize_t) 0); rowsize = multiply(tif, td->td_bitspersample, td->td_tilewidth, "TIFFTileRowSize"); if (td->td_planarconfig == PLANARCONFIG_CONTIG) rowsize = multiply(tif, rowsize, td->td_samplesperpixel, "TIFFTileRowSize"); return ((tsize_t) TIFFhowmany8(rowsize)); } /* * Compute the # bytes in a variable length, row-aligned tile. */ tsize_t TIFFVTileSize(TIFF* tif, uint32 nrows) { TIFFDirectory *td = &tif->tif_dir; tsize_t tilesize; if (td->td_tilelength == 0 || td->td_tilewidth == 0 || td->td_tiledepth == 0) return ((tsize_t) 0); if (td->td_planarconfig == PLANARCONFIG_CONTIG && td->td_photometric == PHOTOMETRIC_YCBCR && !isUpSampled(tif)) { /* * Packed YCbCr data contain one Cb+Cr for every * HorizontalSampling*VerticalSampling Y values. * Must also roundup width and height when calculating * since images that are not a multiple of the * horizontal/vertical subsampling area include * YCbCr data for the extended image. */ tsize_t w = TIFFroundup(td->td_tilewidth, td->td_ycbcrsubsampling[0]); tsize_t rowsize = TIFFhowmany8(multiply(tif, w, td->td_bitspersample, "TIFFVTileSize")); tsize_t samplingarea = td->td_ycbcrsubsampling[0]*td->td_ycbcrsubsampling[1]; if (samplingarea == 0) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Invalid YCbCr subsampling"); return 0; } nrows = TIFFroundup(nrows, td->td_ycbcrsubsampling[1]); /* NB: don't need TIFFhowmany here 'cuz everything is rounded */ tilesize = multiply(tif, nrows, rowsize, "TIFFVTileSize"); tilesize = summarize(tif, tilesize, multiply(tif, 2, tilesize / samplingarea, "TIFFVTileSize"), "TIFFVTileSize"); } else tilesize = multiply(tif, nrows, TIFFTileRowSize(tif), "TIFFVTileSize"); return ((tsize_t) multiply(tif, tilesize, td->td_tiledepth, "TIFFVTileSize")); } /* * Compute the # bytes in a row-aligned tile. */ tsize_t TIFFTileSize(TIFF* tif) { return (TIFFVTileSize(tif, tif->tif_dir.td_tilelength)); } /* * Compute a default tile size based on the image * characteristics and a requested value. If a * request is <1 then we choose a size according * to certain heuristics. */ void TIFFDefaultTileSize(TIFF* tif, uint32* tw, uint32* th) { (*tif->tif_deftilesize)(tif, tw, th); } void _TIFFDefaultTileSize(TIFF* tif, uint32* tw, uint32* th) { (void) tif; if (*(int32*) tw < 1) *tw = 256; if (*(int32*) th < 1) *th = 256; /* roundup to a multiple of 16 per the spec */ if (*tw & 0xf) *tw = TIFFroundup(*tw, 16); if (*th & 0xf) *th = TIFFroundup(*th, 16); } /* vim: set ts=8 sts=8 sw=8 noet: */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_win32.c�������������������������������������������������0000644�0001750�0001750�00000022553�12320456500�021313� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_win32.c,v 1.21 2007/03/07 17:10:31 joris Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library Win32-specific Routines. Adapted from tif_unix.c 4/5/95 by * Scott Wagner (wagner@itek.com), Itek Graphix, Rochester, NY USA */ #include "tiffiop.h" #include <windows.h> static tsize_t _tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size) { DWORD dwSizeRead; if (!ReadFile(fd, buf, size, &dwSizeRead, NULL)) return(0); return ((tsize_t) dwSizeRead); } static tsize_t _tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size) { DWORD dwSizeWritten; if (!WriteFile(fd, buf, size, &dwSizeWritten, NULL)) return(0); return ((tsize_t) dwSizeWritten); } static toff_t _tiffSeekProc(thandle_t fd, toff_t off, int whence) { ULARGE_INTEGER li; DWORD dwMoveMethod; li.QuadPart = off; switch(whence) { case SEEK_SET: dwMoveMethod = FILE_BEGIN; break; case SEEK_CUR: dwMoveMethod = FILE_CURRENT; break; case SEEK_END: dwMoveMethod = FILE_END; break; default: dwMoveMethod = FILE_BEGIN; break; } return ((toff_t)SetFilePointer(fd, (LONG) li.LowPart, (PLONG)&li.HighPart, dwMoveMethod)); } static int _tiffCloseProc(thandle_t fd) { return (CloseHandle(fd) ? 0 : -1); } static toff_t _tiffSizeProc(thandle_t fd) { return ((toff_t)GetFileSize(fd, NULL)); } static int _tiffDummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize) { (void) fd; (void) pbase; (void) psize; return (0); } /* * From "Hermann Josef Hill" <lhill@rhein-zeitung.de>: * * Windows uses both a handle and a pointer for file mapping, * but according to the SDK documentation and Richter's book * "Advanced Windows Programming" it is safe to free the handle * after obtaining the file mapping pointer * * This removes a nasty OS dependency and cures a problem * with Visual C++ 5.0 */ static int _tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize) { toff_t size; HANDLE hMapFile; if ((size = _tiffSizeProc(fd)) == 0xFFFFFFFF) return (0); hMapFile = CreateFileMapping(fd, NULL, PAGE_READONLY, 0, size, NULL); if (hMapFile == NULL) return (0); *pbase = MapViewOfFile(hMapFile, FILE_MAP_READ, 0, 0, 0); CloseHandle(hMapFile); if (*pbase == NULL) return (0); *psize = size; return(1); } static void _tiffDummyUnmapProc(thandle_t fd, tdata_t base, toff_t size) { (void) fd; (void) base; (void) size; } static void _tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size) { UnmapViewOfFile(base); } /* * Open a TIFF file descriptor for read/writing. * Note that TIFFFdOpen and TIFFOpen recognise the character 'u' in the mode * string, which forces the file to be opened unmapped. */ TIFF* TIFFFdOpen(int ifd, const char* name, const char* mode) { TIFF* tif; BOOL fSuppressMap = (mode[1] == 'u' || (mode[1]!=0 && mode[2] == 'u')); tif = TIFFClientOpen(name, mode, (thandle_t)ifd, _tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc, _tiffSizeProc, fSuppressMap ? _tiffDummyMapProc : _tiffMapProc, fSuppressMap ? _tiffDummyUnmapProc : _tiffUnmapProc); if (tif) tif->tif_fd = ifd; return (tif); } #ifndef _WIN32_WCE /* * Open a TIFF file for read/writing. */ TIFF* TIFFOpen(const char* name, const char* mode) { static const char module[] = "TIFFOpen"; thandle_t fd; int m; DWORD dwMode; TIFF* tif; m = _TIFFgetMode(mode, module); switch(m) { case O_RDONLY: dwMode = OPEN_EXISTING; break; case O_RDWR: dwMode = OPEN_ALWAYS; break; case O_RDWR|O_CREAT: dwMode = OPEN_ALWAYS; break; case O_RDWR|O_TRUNC: dwMode = CREATE_ALWAYS; break; case O_RDWR|O_CREAT|O_TRUNC: dwMode = CREATE_ALWAYS; break; default: return ((TIFF*)0); } fd = (thandle_t)CreateFileA(name, (m == O_RDONLY)?GENERIC_READ:(GENERIC_READ | GENERIC_WRITE), FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, dwMode, (m == O_RDONLY)?FILE_ATTRIBUTE_READONLY:FILE_ATTRIBUTE_NORMAL, NULL); if (fd == INVALID_HANDLE_VALUE) { TIFFErrorExt(0, module, "%s: Cannot open", name); return ((TIFF *)0); } tif = TIFFFdOpen((int)fd, name, mode); if(!tif) CloseHandle(fd); return tif; } /* * Open a TIFF file with a Unicode filename, for read/writing. */ TIFF* TIFFOpenW(const wchar_t* name, const char* mode) { static const char module[] = "TIFFOpenW"; thandle_t fd; int m; DWORD dwMode; int mbsize; char *mbname; TIFF *tif; m = _TIFFgetMode(mode, module); switch(m) { case O_RDONLY: dwMode = OPEN_EXISTING; break; case O_RDWR: dwMode = OPEN_ALWAYS; break; case O_RDWR|O_CREAT: dwMode = OPEN_ALWAYS; break; case O_RDWR|O_TRUNC: dwMode = CREATE_ALWAYS; break; case O_RDWR|O_CREAT|O_TRUNC: dwMode = CREATE_ALWAYS; break; default: return ((TIFF*)0); } fd = (thandle_t)CreateFileW(name, (m == O_RDONLY)?GENERIC_READ:(GENERIC_READ|GENERIC_WRITE), FILE_SHARE_READ, NULL, dwMode, (m == O_RDONLY)?FILE_ATTRIBUTE_READONLY:FILE_ATTRIBUTE_NORMAL, NULL); if (fd == INVALID_HANDLE_VALUE) { TIFFErrorExt(0, module, "%S: Cannot open", name); return ((TIFF *)0); } mbname = NULL; mbsize = WideCharToMultiByte(CP_ACP, 0, name, -1, NULL, 0, NULL, NULL); if (mbsize > 0) { mbname = (char *)_TIFFmalloc(mbsize); if (!mbname) { TIFFErrorExt(0, module, "Can't allocate space for filename conversion buffer"); return ((TIFF*)0); } WideCharToMultiByte(CP_ACP, 0, name, -1, mbname, mbsize, NULL, NULL); } tif = TIFFFdOpen((int)fd, (mbname != NULL) ? mbname : "<unknown>", mode); if(!tif) CloseHandle(fd); _TIFFfree(mbname); return tif; } #endif /* ndef _WIN32_WCE */ tdata_t _TIFFmalloc(tsize_t s) { return ((tdata_t)GlobalAlloc(GMEM_FIXED, s)); } void _TIFFfree(tdata_t p) { GlobalFree(p); return; } tdata_t _TIFFrealloc(tdata_t p, tsize_t s) { void* pvTmp; tsize_t old; if(p == NULL) return ((tdata_t)GlobalAlloc(GMEM_FIXED, s)); old = GlobalSize(p); if (old>=s) { if ((pvTmp = GlobalAlloc(GMEM_FIXED, s)) != NULL) { CopyMemory(pvTmp, p, s); GlobalFree(p); } } else { if ((pvTmp = GlobalAlloc(GMEM_FIXED, s)) != NULL) { CopyMemory(pvTmp, p, old); GlobalFree(p); } } return ((tdata_t)pvTmp); } void _TIFFmemset(void* p, int v, tsize_t c) { FillMemory(p, c, (BYTE)v); } void _TIFFmemcpy(void* d, const tdata_t s, tsize_t c) { CopyMemory(d, s, c); } int _TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c) { register const BYTE *pb1 = (const BYTE *) p1; register const BYTE *pb2 = (const BYTE *) p2; register DWORD dwTmp = c; register int iTmp; for (iTmp = 0; dwTmp-- && !iTmp; iTmp = (int)*pb1++ - (int)*pb2++) ; return (iTmp); } #ifndef _WIN32_WCE static void Win32WarningHandler(const char* module, const char* fmt, va_list ap) { #ifndef TIF_PLATFORM_CONSOLE LPTSTR szTitle; LPTSTR szTmp; LPCTSTR szTitleText = "%s Warning"; LPCTSTR szDefaultModule = "LIBTIFF"; LPCTSTR szTmpModule = (module == NULL) ? szDefaultModule : module; if ((szTitle = (LPTSTR)LocalAlloc(LMEM_FIXED, (strlen(szTmpModule) + strlen(szTitleText) + strlen(fmt) + 128)*sizeof(char))) == NULL) return; sprintf(szTitle, szTitleText, szTmpModule); szTmp = szTitle + (strlen(szTitle)+2)*sizeof(char); vsprintf(szTmp, fmt, ap); MessageBoxA(GetFocus(), szTmp, szTitle, MB_OK | MB_ICONINFORMATION); LocalFree(szTitle); return; #else if (module != NULL) fprintf(stderr, "%s: ", module); fprintf(stderr, "Warning, "); vfprintf(stderr, fmt, ap); fprintf(stderr, ".\n"); #endif } TIFFErrorHandler _TIFFwarningHandler = Win32WarningHandler; static void Win32ErrorHandler(const char* module, const char* fmt, va_list ap) { #ifndef TIF_PLATFORM_CONSOLE LPTSTR szTitle; LPTSTR szTmp; LPCTSTR szTitleText = "%s Error"; LPCTSTR szDefaultModule = "LIBTIFF"; LPCTSTR szTmpModule = (module == NULL) ? szDefaultModule : module; if ((szTitle = (LPTSTR)LocalAlloc(LMEM_FIXED, (strlen(szTmpModule) + strlen(szTitleText) + strlen(fmt) + 128)*sizeof(char))) == NULL) return; sprintf(szTitle, szTitleText, szTmpModule); szTmp = szTitle + (strlen(szTitle)+2)*sizeof(char); vsprintf(szTmp, fmt, ap); MessageBoxA(GetFocus(), szTmp, szTitle, MB_OK | MB_ICONEXCLAMATION); LocalFree(szTitle); return; #else if (module != NULL) fprintf(stderr, "%s: ", module); vfprintf(stderr, fmt, ap); fprintf(stderr, ".\n"); #endif } TIFFErrorHandler _TIFFerrorHandler = Win32ErrorHandler; #endif /* ndef _WIN32_WCE */ /* vim: set ts=8 sts=8 sw=8 noet: */ �����������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_thunder.c�����������������������������������������������0000644�0001750�0001750�00000011524�12320456500�022016� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_thunder.c,v 1.5 2005/12/21 12:23:13 joris Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "tiffiop.h" #ifdef THUNDER_SUPPORT /* * TIFF Library. * * ThunderScan 4-bit Compression Algorithm Support */ /* * ThunderScan uses an encoding scheme designed for * 4-bit pixel values. Data is encoded in bytes, with * each byte split into a 2-bit code word and a 6-bit * data value. The encoding gives raw data, runs of * pixels, or pixel values encoded as a delta from the * previous pixel value. For the latter, either 2-bit * or 3-bit delta values are used, with the deltas packed * into a single byte. */ #define THUNDER_DATA 0x3f /* mask for 6-bit data */ #define THUNDER_CODE 0xc0 /* mask for 2-bit code word */ /* code values */ #define THUNDER_RUN 0x00 /* run of pixels w/ encoded count */ #define THUNDER_2BITDELTAS 0x40 /* 3 pixels w/ encoded 2-bit deltas */ #define DELTA2_SKIP 2 /* skip code for 2-bit deltas */ #define THUNDER_3BITDELTAS 0x80 /* 2 pixels w/ encoded 3-bit deltas */ #define DELTA3_SKIP 4 /* skip code for 3-bit deltas */ #define THUNDER_RAW 0xc0 /* raw data encoded */ static const int twobitdeltas[4] = { 0, 1, 0, -1 }; static const int threebitdeltas[8] = { 0, 1, 2, 3, 0, -3, -2, -1 }; #define SETPIXEL(op, v) { \ lastpixel = (v) & 0xf; \ if (npixels++ & 1) \ *op++ |= lastpixel; \ else \ op[0] = (tidataval_t) (lastpixel << 4); \ } static int ThunderDecode(TIFF* tif, tidata_t op, tsize_t maxpixels) { register unsigned char *bp; register tsize_t cc; unsigned int lastpixel; tsize_t npixels; bp = (unsigned char *)tif->tif_rawcp; cc = tif->tif_rawcc; lastpixel = 0; npixels = 0; while (cc > 0 && npixels < maxpixels) { int n, delta; n = *bp++, cc--; switch (n & THUNDER_CODE) { case THUNDER_RUN: /* pixel run */ /* * Replicate the last pixel n times, * where n is the lower-order 6 bits. */ if (npixels & 1) { op[0] |= lastpixel; lastpixel = *op++; npixels++; n--; } else lastpixel |= lastpixel << 4; npixels += n; if (npixels < maxpixels) { for (; n > 0; n -= 2) *op++ = (tidataval_t) lastpixel; } if (n == -1) *--op &= 0xf0; lastpixel &= 0xf; break; case THUNDER_2BITDELTAS: /* 2-bit deltas */ if ((delta = ((n >> 4) & 3)) != DELTA2_SKIP) SETPIXEL(op, lastpixel + twobitdeltas[delta]); if ((delta = ((n >> 2) & 3)) != DELTA2_SKIP) SETPIXEL(op, lastpixel + twobitdeltas[delta]); if ((delta = (n & 3)) != DELTA2_SKIP) SETPIXEL(op, lastpixel + twobitdeltas[delta]); break; case THUNDER_3BITDELTAS: /* 3-bit deltas */ if ((delta = ((n >> 3) & 7)) != DELTA3_SKIP) SETPIXEL(op, lastpixel + threebitdeltas[delta]); if ((delta = (n & 7)) != DELTA3_SKIP) SETPIXEL(op, lastpixel + threebitdeltas[delta]); break; case THUNDER_RAW: /* raw data */ SETPIXEL(op, n); break; } } tif->tif_rawcp = (tidata_t) bp; tif->tif_rawcc = cc; if (npixels != maxpixels) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "ThunderDecode: %s data at scanline %ld (%lu != %lu)", npixels < maxpixels ? "Not enough" : "Too much", (long) tif->tif_row, (long) npixels, (long) maxpixels); return (0); } return (1); } static int ThunderDecodeRow(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s) { tidata_t row = buf; (void) s; while ((long)occ > 0) { if (!ThunderDecode(tif, row, tif->tif_dir.td_imagewidth)) return (0); occ -= tif->tif_scanlinesize; row += tif->tif_scanlinesize; } return (1); } int TIFFInitThunderScan(TIFF* tif, int scheme) { (void) scheme; tif->tif_decoderow = ThunderDecodeRow; tif->tif_decodestrip = ThunderDecodeRow; return (1); } #endif /* THUNDER_SUPPORT */ /* vim: set ts=8 sts=8 sw=8 noet: */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_jpeg.c��������������������������������������������������0000644�0001750�0001750�00000167253�12320456500�021305� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_jpeg.c,v 1.50.2.4 2009-08-30 16:21:46 bfriesen Exp $ */ /* * Copyright (c) 1994-1997 Sam Leffler * Copyright (c) 1994-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #define WIN32_LEAN_AND_MEAN #define VC_EXTRALEAN #include "tiffiop.h" #ifdef JPEG_SUPPORT /* * TIFF Library * * JPEG Compression support per TIFF Technical Note #2 * (*not* per the original TIFF 6.0 spec). * * This file is simply an interface to the libjpeg library written by * the Independent JPEG Group. You need release 5 or later of the IJG * code, which you can find on the Internet at ftp.uu.net:/graphics/jpeg/. * * Contributed by Tom Lane <tgl@sss.pgh.pa.us>. */ #include <setjmp.h> int TIFFFillStrip(TIFF*, tstrip_t); int TIFFFillTile(TIFF*, ttile_t); /* We undefine FAR to avoid conflict with JPEG definition */ #ifdef FAR #undef FAR #endif /* Libjpeg's jmorecfg.h defines INT16 and INT32, but only if XMD_H is not defined. Unfortunately, the MinGW and Borland compilers include a typedef for INT32, which causes a conflict. MSVC does not include a conficting typedef given the headers which are included. */ #if defined(__BORLANDC__) || defined(__MINGW32__) # define XMD_H 1 #endif /* The windows RPCNDR.H file defines boolean, but defines it with the unsigned char size. You should compile JPEG library using appropriate definitions in jconfig.h header, but many users compile library in wrong way. That causes errors of the following type: "JPEGLib: JPEG parameter struct mismatch: library thinks size is 432, caller expects 464" For such users we wil fix the problem here. See install.doc file from the JPEG library distribution for details. */ /* Define "boolean" as unsigned char, not int, per Windows custom. */ #if defined(WIN32) && !defined(__MINGW32__) # ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ typedef unsigned char boolean; # endif # define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ #endif #include "jpeglib.h" #include "jerror.h" /* * We are using width_in_blocks which is supposed to be private to * libjpeg. Unfortunately, the libjpeg delivered with Cygwin has * renamed this member to width_in_data_units. Since the header has * also renamed a define, use that unique define name in order to * detect the problem header and adjust to suit. */ #if defined(D_MAX_DATA_UNITS_IN_MCU) #define width_in_blocks width_in_data_units #endif /* * On some machines it may be worthwhile to use _setjmp or sigsetjmp * in place of plain setjmp. These macros will make it easier. */ #define SETJMP(jbuf) setjmp(jbuf) #define LONGJMP(jbuf,code) longjmp(jbuf,code) #define JMP_BUF jmp_buf typedef struct jpeg_destination_mgr jpeg_destination_mgr; typedef struct jpeg_source_mgr jpeg_source_mgr; typedef struct jpeg_error_mgr jpeg_error_mgr; /* * State block for each open TIFF file using * libjpeg to do JPEG compression/decompression. * * libjpeg's visible state is either a jpeg_compress_struct * or jpeg_decompress_struct depending on which way we * are going. comm can be used to refer to the fields * which are common to both. * * NB: cinfo is required to be the first member of JPEGState, * so we can safely cast JPEGState* -> jpeg_xxx_struct* * and vice versa! */ typedef struct { union { struct jpeg_compress_struct c; struct jpeg_decompress_struct d; struct jpeg_common_struct comm; } cinfo; /* NB: must be first */ int cinfo_initialized; jpeg_error_mgr err; /* libjpeg error manager */ JMP_BUF exit_jmpbuf; /* for catching libjpeg failures */ /* * The following two members could be a union, but * they're small enough that it's not worth the effort. */ jpeg_destination_mgr dest; /* data dest for compression */ jpeg_source_mgr src; /* data source for decompression */ /* private state */ TIFF* tif; /* back link needed by some code */ uint16 photometric; /* copy of PhotometricInterpretation */ uint16 h_sampling; /* luminance sampling factors */ uint16 v_sampling; tsize_t bytesperline; /* decompressed bytes per scanline */ /* pointers to intermediate buffers when processing downsampled data */ JSAMPARRAY ds_buffer[MAX_COMPONENTS]; int scancount; /* number of "scanlines" accumulated */ int samplesperclump; TIFFVGetMethod vgetparent; /* super-class method */ TIFFVSetMethod vsetparent; /* super-class method */ TIFFPrintMethod printdir; /* super-class method */ TIFFStripMethod defsparent; /* super-class method */ TIFFTileMethod deftparent; /* super-class method */ /* pseudo-tag fields */ void* jpegtables; /* JPEGTables tag value, or NULL */ uint32 jpegtables_length; /* number of bytes in same */ int jpegquality; /* Compression quality level */ int jpegcolormode; /* Auto RGB<=>YCbCr convert? */ int jpegtablesmode; /* What to put in JPEGTables */ int ycbcrsampling_fetched; uint32 recvparams; /* encoded Class 2 session params */ char* subaddress; /* subaddress string */ uint32 recvtime; /* time spent receiving (secs) */ char* faxdcs; /* encoded fax parameters (DCS, Table 2/T.30) */ } JPEGState; #define JState(tif) ((JPEGState*)(tif)->tif_data) static int JPEGDecode(TIFF*, tidata_t, tsize_t, tsample_t); static int JPEGDecodeRaw(TIFF*, tidata_t, tsize_t, tsample_t); static int JPEGEncode(TIFF*, tidata_t, tsize_t, tsample_t); static int JPEGEncodeRaw(TIFF*, tidata_t, tsize_t, tsample_t); static int JPEGInitializeLibJPEG( TIFF * tif, int force_encode, int force_decode ); #define FIELD_JPEGTABLES (FIELD_CODEC+0) #define FIELD_RECVPARAMS (FIELD_CODEC+1) #define FIELD_SUBADDRESS (FIELD_CODEC+2) #define FIELD_RECVTIME (FIELD_CODEC+3) #define FIELD_FAXDCS (FIELD_CODEC+4) static const TIFFFieldInfo jpegFieldInfo[] = { { TIFFTAG_JPEGTABLES, -3,-3, TIFF_UNDEFINED, FIELD_JPEGTABLES, FALSE, TRUE, "JPEGTables" }, { TIFFTAG_JPEGQUALITY, 0, 0, TIFF_ANY, FIELD_PSEUDO, TRUE, FALSE, "" }, { TIFFTAG_JPEGCOLORMODE, 0, 0, TIFF_ANY, FIELD_PSEUDO, FALSE, FALSE, "" }, { TIFFTAG_JPEGTABLESMODE, 0, 0, TIFF_ANY, FIELD_PSEUDO, FALSE, FALSE, "" }, /* Specific for JPEG in faxes */ { TIFFTAG_FAXRECVPARAMS, 1, 1, TIFF_LONG, FIELD_RECVPARAMS, TRUE, FALSE, "FaxRecvParams" }, { TIFFTAG_FAXSUBADDRESS, -1,-1, TIFF_ASCII, FIELD_SUBADDRESS, TRUE, FALSE, "FaxSubAddress" }, { TIFFTAG_FAXRECVTIME, 1, 1, TIFF_LONG, FIELD_RECVTIME, TRUE, FALSE, "FaxRecvTime" }, { TIFFTAG_FAXDCS, -1, -1, TIFF_ASCII, FIELD_FAXDCS, TRUE, FALSE, "FaxDcs" }, }; #define N(a) (sizeof (a) / sizeof (a[0])) /* * libjpeg interface layer. * * We use setjmp/longjmp to return control to libtiff * when a fatal error is encountered within the JPEG * library. We also direct libjpeg error and warning * messages through the appropriate libtiff handlers. */ /* * Error handling routines (these replace corresponding * IJG routines from jerror.c). These are used for both * compression and decompression. */ static void TIFFjpeg_error_exit(j_common_ptr cinfo) { JPEGState *sp = (JPEGState *) cinfo; /* NB: cinfo assumed first */ char buffer[JMSG_LENGTH_MAX]; (*cinfo->err->format_message) (cinfo, buffer); TIFFErrorExt(sp->tif->tif_clientdata, "JPEGLib", "%s", buffer); /* display the error message */ jpeg_abort(cinfo); /* clean up libjpeg state */ LONGJMP(sp->exit_jmpbuf, 1); /* return to libtiff caller */ } /* * This routine is invoked only for warning messages, * since error_exit does its own thing and trace_level * is never set > 0. */ static void TIFFjpeg_output_message(j_common_ptr cinfo) { char buffer[JMSG_LENGTH_MAX]; (*cinfo->err->format_message) (cinfo, buffer); TIFFWarningExt(((JPEGState *) cinfo)->tif->tif_clientdata, "JPEGLib", "%s", buffer); } /* * Interface routines. This layer of routines exists * primarily to limit side-effects from using setjmp. * Also, normal/error returns are converted into return * values per libtiff practice. */ #define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op)) #define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op),1)) static int TIFFjpeg_create_compress(JPEGState* sp) { /* initialize JPEG error handling */ sp->cinfo.c.err = jpeg_std_error(&sp->err); sp->err.error_exit = TIFFjpeg_error_exit; sp->err.output_message = TIFFjpeg_output_message; return CALLVJPEG(sp, jpeg_create_compress(&sp->cinfo.c)); } static int TIFFjpeg_create_decompress(JPEGState* sp) { /* initialize JPEG error handling */ sp->cinfo.d.err = jpeg_std_error(&sp->err); sp->err.error_exit = TIFFjpeg_error_exit; sp->err.output_message = TIFFjpeg_output_message; return CALLVJPEG(sp, jpeg_create_decompress(&sp->cinfo.d)); } static int TIFFjpeg_set_defaults(JPEGState* sp) { return CALLVJPEG(sp, jpeg_set_defaults(&sp->cinfo.c)); } static int TIFFjpeg_set_colorspace(JPEGState* sp, J_COLOR_SPACE colorspace) { return CALLVJPEG(sp, jpeg_set_colorspace(&sp->cinfo.c, colorspace)); } static int TIFFjpeg_set_quality(JPEGState* sp, int quality, boolean force_baseline) { return CALLVJPEG(sp, jpeg_set_quality(&sp->cinfo.c, quality, force_baseline)); } static int TIFFjpeg_suppress_tables(JPEGState* sp, boolean suppress) { return CALLVJPEG(sp, jpeg_suppress_tables(&sp->cinfo.c, suppress)); } static int TIFFjpeg_start_compress(JPEGState* sp, boolean write_all_tables) { return CALLVJPEG(sp, jpeg_start_compress(&sp->cinfo.c, write_all_tables)); } static int TIFFjpeg_write_scanlines(JPEGState* sp, JSAMPARRAY scanlines, int num_lines) { return CALLJPEG(sp, -1, (int) jpeg_write_scanlines(&sp->cinfo.c, scanlines, (JDIMENSION) num_lines)); } static int TIFFjpeg_write_raw_data(JPEGState* sp, JSAMPIMAGE data, int num_lines) { return CALLJPEG(sp, -1, (int) jpeg_write_raw_data(&sp->cinfo.c, data, (JDIMENSION) num_lines)); } static int TIFFjpeg_finish_compress(JPEGState* sp) { return CALLVJPEG(sp, jpeg_finish_compress(&sp->cinfo.c)); } static int TIFFjpeg_write_tables(JPEGState* sp) { return CALLVJPEG(sp, jpeg_write_tables(&sp->cinfo.c)); } static int TIFFjpeg_read_header(JPEGState* sp, boolean require_image) { return CALLJPEG(sp, -1, jpeg_read_header(&sp->cinfo.d, require_image)); } static int TIFFjpeg_start_decompress(JPEGState* sp) { return CALLVJPEG(sp, jpeg_start_decompress(&sp->cinfo.d)); } static int TIFFjpeg_read_scanlines(JPEGState* sp, JSAMPARRAY scanlines, int max_lines) { return CALLJPEG(sp, -1, (int) jpeg_read_scanlines(&sp->cinfo.d, scanlines, (JDIMENSION) max_lines)); } static int TIFFjpeg_read_raw_data(JPEGState* sp, JSAMPIMAGE data, int max_lines) { return CALLJPEG(sp, -1, (int) jpeg_read_raw_data(&sp->cinfo.d, data, (JDIMENSION) max_lines)); } static int TIFFjpeg_finish_decompress(JPEGState* sp) { return CALLJPEG(sp, -1, (int) jpeg_finish_decompress(&sp->cinfo.d)); } static int TIFFjpeg_abort(JPEGState* sp) { return CALLVJPEG(sp, jpeg_abort(&sp->cinfo.comm)); } static int TIFFjpeg_destroy(JPEGState* sp) { return CALLVJPEG(sp, jpeg_destroy(&sp->cinfo.comm)); } static JSAMPARRAY TIFFjpeg_alloc_sarray(JPEGState* sp, int pool_id, JDIMENSION samplesperrow, JDIMENSION numrows) { return CALLJPEG(sp, (JSAMPARRAY) NULL, (*sp->cinfo.comm.mem->alloc_sarray) (&sp->cinfo.comm, pool_id, samplesperrow, numrows)); } /* * JPEG library destination data manager. * These routines direct compressed data from libjpeg into the * libtiff output buffer. */ static void std_init_destination(j_compress_ptr cinfo) { JPEGState* sp = (JPEGState*) cinfo; TIFF* tif = sp->tif; sp->dest.next_output_byte = (JOCTET*) tif->tif_rawdata; sp->dest.free_in_buffer = (size_t) tif->tif_rawdatasize; } static boolean std_empty_output_buffer(j_compress_ptr cinfo) { JPEGState* sp = (JPEGState*) cinfo; TIFF* tif = sp->tif; /* the entire buffer has been filled */ tif->tif_rawcc = tif->tif_rawdatasize; TIFFFlushData1(tif); sp->dest.next_output_byte = (JOCTET*) tif->tif_rawdata; sp->dest.free_in_buffer = (size_t) tif->tif_rawdatasize; return (TRUE); } static void std_term_destination(j_compress_ptr cinfo) { JPEGState* sp = (JPEGState*) cinfo; TIFF* tif = sp->tif; tif->tif_rawcp = (tidata_t) sp->dest.next_output_byte; tif->tif_rawcc = tif->tif_rawdatasize - (tsize_t) sp->dest.free_in_buffer; /* NB: libtiff does the final buffer flush */ } static void TIFFjpeg_data_dest(JPEGState* sp, TIFF* tif) { (void) tif; sp->cinfo.c.dest = &sp->dest; sp->dest.init_destination = std_init_destination; sp->dest.empty_output_buffer = std_empty_output_buffer; sp->dest.term_destination = std_term_destination; } /* * Alternate destination manager for outputting to JPEGTables field. */ static void tables_init_destination(j_compress_ptr cinfo) { JPEGState* sp = (JPEGState*) cinfo; /* while building, jpegtables_length is allocated buffer size */ sp->dest.next_output_byte = (JOCTET*) sp->jpegtables; sp->dest.free_in_buffer = (size_t) sp->jpegtables_length; } static boolean tables_empty_output_buffer(j_compress_ptr cinfo) { JPEGState* sp = (JPEGState*) cinfo; void* newbuf; /* the entire buffer has been filled; enlarge it by 1000 bytes */ newbuf = _TIFFrealloc((tdata_t) sp->jpegtables, (tsize_t) (sp->jpegtables_length + 1000)); if (newbuf == NULL) ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 100); sp->dest.next_output_byte = (JOCTET*) newbuf + sp->jpegtables_length; sp->dest.free_in_buffer = (size_t) 1000; sp->jpegtables = newbuf; sp->jpegtables_length += 1000; return (TRUE); } static void tables_term_destination(j_compress_ptr cinfo) { JPEGState* sp = (JPEGState*) cinfo; /* set tables length to number of bytes actually emitted */ sp->jpegtables_length -= sp->dest.free_in_buffer; } static int TIFFjpeg_tables_dest(JPEGState* sp, TIFF* tif) { (void) tif; /* * Allocate a working buffer for building tables. * Initial size is 1000 bytes, which is usually adequate. */ if (sp->jpegtables) _TIFFfree(sp->jpegtables); sp->jpegtables_length = 1000; sp->jpegtables = (void*) _TIFFmalloc((tsize_t) sp->jpegtables_length); if (sp->jpegtables == NULL) { sp->jpegtables_length = 0; TIFFErrorExt(sp->tif->tif_clientdata, "TIFFjpeg_tables_dest", "No space for JPEGTables"); return (0); } sp->cinfo.c.dest = &sp->dest; sp->dest.init_destination = tables_init_destination; sp->dest.empty_output_buffer = tables_empty_output_buffer; sp->dest.term_destination = tables_term_destination; return (1); } /* * JPEG library source data manager. * These routines supply compressed data to libjpeg. */ static void std_init_source(j_decompress_ptr cinfo) { JPEGState* sp = (JPEGState*) cinfo; TIFF* tif = sp->tif; sp->src.next_input_byte = (const JOCTET*) tif->tif_rawdata; sp->src.bytes_in_buffer = (size_t) tif->tif_rawcc; } static boolean std_fill_input_buffer(j_decompress_ptr cinfo) { JPEGState* sp = (JPEGState* ) cinfo; static const JOCTET dummy_EOI[2] = { 0xFF, JPEG_EOI }; /* * Should never get here since entire strip/tile is * read into memory before the decompressor is called, * and thus was supplied by init_source. */ WARNMS(cinfo, JWRN_JPEG_EOF); /* insert a fake EOI marker */ sp->src.next_input_byte = dummy_EOI; sp->src.bytes_in_buffer = 2; return (TRUE); } static void std_skip_input_data(j_decompress_ptr cinfo, long num_bytes) { JPEGState* sp = (JPEGState*) cinfo; if (num_bytes > 0) { if (num_bytes > (long) sp->src.bytes_in_buffer) { /* oops, buffer overrun */ (void) std_fill_input_buffer(cinfo); } else { sp->src.next_input_byte += (size_t) num_bytes; sp->src.bytes_in_buffer -= (size_t) num_bytes; } } } static void std_term_source(j_decompress_ptr cinfo) { /* No work necessary here */ /* Or must we update tif->tif_rawcp, tif->tif_rawcc ??? */ /* (if so, need empty tables_term_source!) */ (void) cinfo; } static void TIFFjpeg_data_src(JPEGState* sp, TIFF* tif) { (void) tif; sp->cinfo.d.src = &sp->src; sp->src.init_source = std_init_source; sp->src.fill_input_buffer = std_fill_input_buffer; sp->src.skip_input_data = std_skip_input_data; sp->src.resync_to_restart = jpeg_resync_to_restart; sp->src.term_source = std_term_source; sp->src.bytes_in_buffer = 0; /* for safety */ sp->src.next_input_byte = NULL; } /* * Alternate source manager for reading from JPEGTables. * We can share all the code except for the init routine. */ static void tables_init_source(j_decompress_ptr cinfo) { JPEGState* sp = (JPEGState*) cinfo; sp->src.next_input_byte = (const JOCTET*) sp->jpegtables; sp->src.bytes_in_buffer = (size_t) sp->jpegtables_length; } static void TIFFjpeg_tables_src(JPEGState* sp, TIFF* tif) { TIFFjpeg_data_src(sp, tif); sp->src.init_source = tables_init_source; } /* * Allocate downsampled-data buffers needed for downsampled I/O. * We use values computed in jpeg_start_compress or jpeg_start_decompress. * We use libjpeg's allocator so that buffers will be released automatically * when done with strip/tile. * This is also a handy place to compute samplesperclump, bytesperline. */ static int alloc_downsampled_buffers(TIFF* tif, jpeg_component_info* comp_info, int num_components) { JPEGState* sp = JState(tif); int ci; jpeg_component_info* compptr; JSAMPARRAY buf; int samples_per_clump = 0; for (ci = 0, compptr = comp_info; ci < num_components; ci++, compptr++) { samples_per_clump += compptr->h_samp_factor * compptr->v_samp_factor; buf = TIFFjpeg_alloc_sarray(sp, JPOOL_IMAGE, compptr->width_in_blocks * DCTSIZE, (JDIMENSION) (compptr->v_samp_factor*DCTSIZE)); if (buf == NULL) return (0); sp->ds_buffer[ci] = buf; } sp->samplesperclump = samples_per_clump; return (1); } /* * JPEG Decoding. */ static int JPEGSetupDecode(TIFF* tif) { JPEGState* sp = JState(tif); TIFFDirectory *td = &tif->tif_dir; JPEGInitializeLibJPEG( tif, 0, 1 ); assert(sp != NULL); assert(sp->cinfo.comm.is_decompressor); /* Read JPEGTables if it is present */ if (TIFFFieldSet(tif,FIELD_JPEGTABLES)) { TIFFjpeg_tables_src(sp, tif); if(TIFFjpeg_read_header(sp,FALSE) != JPEG_HEADER_TABLES_ONLY) { TIFFErrorExt(tif->tif_clientdata, "JPEGSetupDecode", "Bogus JPEGTables field"); return (0); } } /* Grab parameters that are same for all strips/tiles */ sp->photometric = td->td_photometric; switch (sp->photometric) { case PHOTOMETRIC_YCBCR: sp->h_sampling = td->td_ycbcrsubsampling[0]; sp->v_sampling = td->td_ycbcrsubsampling[1]; break; default: /* TIFF 6.0 forbids subsampling of all other color spaces */ sp->h_sampling = 1; sp->v_sampling = 1; break; } /* Set up for reading normal data */ TIFFjpeg_data_src(sp, tif); tif->tif_postdecode = _TIFFNoPostDecode; /* override byte swapping */ return (1); } /* * Set up for decoding a strip or tile. */ static int JPEGPreDecode(TIFF* tif, tsample_t s) { JPEGState *sp = JState(tif); TIFFDirectory *td = &tif->tif_dir; static const char module[] = "JPEGPreDecode"; uint32 segment_width, segment_height; int downsampled_output; int ci; assert(sp != NULL); assert(sp->cinfo.comm.is_decompressor); /* * Reset decoder state from any previous strip/tile, * in case application didn't read the whole strip. */ if (!TIFFjpeg_abort(sp)) return (0); /* * Read the header for this strip/tile. */ if (TIFFjpeg_read_header(sp, TRUE) != JPEG_HEADER_OK) return (0); /* * Check image parameters and set decompression parameters. */ segment_width = td->td_imagewidth; segment_height = td->td_imagelength - tif->tif_row; if (isTiled(tif)) { segment_width = td->td_tilewidth; segment_height = td->td_tilelength; sp->bytesperline = TIFFTileRowSize(tif); } else { if (segment_height > td->td_rowsperstrip) segment_height = td->td_rowsperstrip; sp->bytesperline = TIFFOldScanlineSize(tif); } if (td->td_planarconfig == PLANARCONFIG_SEPARATE && s > 0) { /* * For PC 2, scale down the expected strip/tile size * to match a downsampled component */ segment_width = TIFFhowmany(segment_width, sp->h_sampling); segment_height = TIFFhowmany(segment_height, sp->v_sampling); } if (sp->cinfo.d.image_width < segment_width || sp->cinfo.d.image_height < segment_height) { TIFFWarningExt(tif->tif_clientdata, module, "Improper JPEG strip/tile size, " "expected %dx%d, got %dx%d", segment_width, segment_height, sp->cinfo.d.image_width, sp->cinfo.d.image_height); } if (sp->cinfo.d.image_width > segment_width || sp->cinfo.d.image_height > segment_height) { /* * This case could be dangerous, if the strip or tile size has * been reported as less than the amount of data jpeg will * return, some potential security issues arise. Catch this * case and error out. */ TIFFErrorExt(tif->tif_clientdata, module, "JPEG strip/tile size exceeds expected dimensions," " expected %dx%d, got %dx%d", segment_width, segment_height, sp->cinfo.d.image_width, sp->cinfo.d.image_height); return (0); } if (sp->cinfo.d.num_components != (td->td_planarconfig == PLANARCONFIG_CONTIG ? td->td_samplesperpixel : 1)) { TIFFErrorExt(tif->tif_clientdata, module, "Improper JPEG component count"); return (0); } #ifdef JPEG_LIB_MK1 if (12 != td->td_bitspersample && 8 != td->td_bitspersample) { TIFFErrorExt(tif->tif_clientdata, module, "Improper JPEG data precision"); return (0); } sp->cinfo.d.data_precision = td->td_bitspersample; sp->cinfo.d.bits_in_jsample = td->td_bitspersample; #else if (sp->cinfo.d.data_precision != td->td_bitspersample) { TIFFErrorExt(tif->tif_clientdata, module, "Improper JPEG data precision"); return (0); } #endif if (td->td_planarconfig == PLANARCONFIG_CONTIG) { /* Component 0 should have expected sampling factors */ if (sp->cinfo.d.comp_info[0].h_samp_factor != sp->h_sampling || sp->cinfo.d.comp_info[0].v_samp_factor != sp->v_sampling) { TIFFWarningExt(tif->tif_clientdata, module, "Improper JPEG sampling factors %d,%d\n" "Apparently should be %d,%d.", sp->cinfo.d.comp_info[0].h_samp_factor, sp->cinfo.d.comp_info[0].v_samp_factor, sp->h_sampling, sp->v_sampling); /* * There are potential security issues here * for decoders that have already allocated * buffers based on the expected sampling * factors. Lets check the sampling factors * dont exceed what we were expecting. */ if (sp->cinfo.d.comp_info[0].h_samp_factor > sp->h_sampling || sp->cinfo.d.comp_info[0].v_samp_factor > sp->v_sampling) { TIFFErrorExt(tif->tif_clientdata, module, "Cannot honour JPEG sampling factors" " that exceed those specified."); return (0); } /* * XXX: Files written by the Intergraph software * has different sampling factors stored in the * TIFF tags and in the JPEG structures. We will * try to deduce Intergraph files by the presense * of the tag 33918. */ if (!_TIFFFindFieldInfo(tif, 33918, TIFF_ANY)) { TIFFWarningExt(tif->tif_clientdata, module, "Decompressor will try reading with " "sampling %d,%d.", sp->cinfo.d.comp_info[0].h_samp_factor, sp->cinfo.d.comp_info[0].v_samp_factor); sp->h_sampling = (uint16) sp->cinfo.d.comp_info[0].h_samp_factor; sp->v_sampling = (uint16) sp->cinfo.d.comp_info[0].v_samp_factor; } } /* Rest should have sampling factors 1,1 */ for (ci = 1; ci < sp->cinfo.d.num_components; ci++) { if (sp->cinfo.d.comp_info[ci].h_samp_factor != 1 || sp->cinfo.d.comp_info[ci].v_samp_factor != 1) { TIFFErrorExt(tif->tif_clientdata, module, "Improper JPEG sampling factors"); return (0); } } } else { /* PC 2's single component should have sampling factors 1,1 */ if (sp->cinfo.d.comp_info[0].h_samp_factor != 1 || sp->cinfo.d.comp_info[0].v_samp_factor != 1) { TIFFErrorExt(tif->tif_clientdata, module, "Improper JPEG sampling factors"); return (0); } } downsampled_output = FALSE; if (td->td_planarconfig == PLANARCONFIG_CONTIG && sp->photometric == PHOTOMETRIC_YCBCR && sp->jpegcolormode == JPEGCOLORMODE_RGB) { /* Convert YCbCr to RGB */ sp->cinfo.d.jpeg_color_space = JCS_YCbCr; sp->cinfo.d.out_color_space = JCS_RGB; } else { /* Suppress colorspace handling */ sp->cinfo.d.jpeg_color_space = JCS_UNKNOWN; sp->cinfo.d.out_color_space = JCS_UNKNOWN; if (td->td_planarconfig == PLANARCONFIG_CONTIG && (sp->h_sampling != 1 || sp->v_sampling != 1)) downsampled_output = TRUE; /* XXX what about up-sampling? */ } if (downsampled_output) { /* Need to use raw-data interface to libjpeg */ sp->cinfo.d.raw_data_out = TRUE; tif->tif_decoderow = JPEGDecodeRaw; tif->tif_decodestrip = JPEGDecodeRaw; tif->tif_decodetile = JPEGDecodeRaw; } else { /* Use normal interface to libjpeg */ sp->cinfo.d.raw_data_out = FALSE; tif->tif_decoderow = JPEGDecode; tif->tif_decodestrip = JPEGDecode; tif->tif_decodetile = JPEGDecode; } /* Start JPEG decompressor */ if (!TIFFjpeg_start_decompress(sp)) return (0); /* Allocate downsampled-data buffers if needed */ if (downsampled_output) { if (!alloc_downsampled_buffers(tif, sp->cinfo.d.comp_info, sp->cinfo.d.num_components)) return (0); sp->scancount = DCTSIZE; /* mark buffer empty */ } return (1); } /* * Decode a chunk of pixels. * "Standard" case: returned data is not downsampled. */ /*ARGSUSED*/ static int JPEGDecode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s) { JPEGState *sp = JState(tif); tsize_t nrows; (void) s; nrows = cc / sp->bytesperline; if (cc % sp->bytesperline) TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "fractional scanline not read"); if( nrows > (int) sp->cinfo.d.image_height ) nrows = sp->cinfo.d.image_height; /* data is expected to be read in multiples of a scanline */ if (nrows) { JSAMPROW line_work_buf = NULL; /* ** For 6B, only use temporary buffer for 12 bit imagery. ** For Mk1 always use it. */ #if !defined(JPEG_LIB_MK1) if( sp->cinfo.d.data_precision == 12 ) #endif { line_work_buf = (JSAMPROW) _TIFFmalloc(sizeof(short) * sp->cinfo.d.output_width * sp->cinfo.d.num_components ); } do { if( line_work_buf != NULL ) { /* ** In the MK1 case, we aways read into a 16bit buffer, and then ** pack down to 12bit or 8bit. In 6B case we only read into 16 ** bit buffer for 12bit data, which we need to repack. */ if (TIFFjpeg_read_scanlines(sp, &line_work_buf, 1) != 1) return (0); if( sp->cinfo.d.data_precision == 12 ) { int value_pairs = (sp->cinfo.d.output_width * sp->cinfo.d.num_components) / 2; int iPair; for( iPair = 0; iPair < value_pairs; iPair++ ) { unsigned char *out_ptr = ((unsigned char *) buf) + iPair * 3; JSAMPLE *in_ptr = line_work_buf + iPair * 2; out_ptr[0] = (in_ptr[0] & 0xff0) >> 4; out_ptr[1] = ((in_ptr[0] & 0xf) << 4) | ((in_ptr[1] & 0xf00) >> 8); out_ptr[2] = ((in_ptr[1] & 0xff) >> 0); } } else if( sp->cinfo.d.data_precision == 8 ) { int value_count = (sp->cinfo.d.output_width * sp->cinfo.d.num_components); int iValue; for( iValue = 0; iValue < value_count; iValue++ ) { ((unsigned char *) buf)[iValue] = line_work_buf[iValue] & 0xff; } } } else { /* ** In the libjpeg6b 8bit case. We read directly into the ** TIFF buffer. */ JSAMPROW bufptr = (JSAMPROW)buf; if (TIFFjpeg_read_scanlines(sp, &bufptr, 1) != 1) return (0); } ++tif->tif_row; buf += sp->bytesperline; cc -= sp->bytesperline; } while (--nrows > 0); if( line_work_buf != NULL ) _TIFFfree( line_work_buf ); } /* Close down the decompressor if we've finished the strip or tile. */ return sp->cinfo.d.output_scanline < sp->cinfo.d.output_height || TIFFjpeg_finish_decompress(sp); } /* * Decode a chunk of pixels. * Returned data is downsampled per sampling factors. */ /*ARGSUSED*/ static int JPEGDecodeRaw(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s) { JPEGState *sp = JState(tif); tsize_t nrows; (void) s; /* data is expected to be read in multiples of a scanline */ if ( (nrows = sp->cinfo.d.image_height) ) { /* Cb,Cr both have sampling factors 1, so this is correct */ JDIMENSION clumps_per_line = sp->cinfo.d.comp_info[1].downsampled_width; int samples_per_clump = sp->samplesperclump; #ifdef JPEG_LIB_MK1 unsigned short* tmpbuf = _TIFFmalloc(sizeof(unsigned short) * sp->cinfo.d.output_width * sp->cinfo.d.num_components); #endif do { jpeg_component_info *compptr; int ci, clumpoffset; /* Reload downsampled-data buffer if needed */ if (sp->scancount >= DCTSIZE) { int n = sp->cinfo.d.max_v_samp_factor * DCTSIZE; if (TIFFjpeg_read_raw_data(sp, sp->ds_buffer, n) != n) return (0); sp->scancount = 0; } /* * Fastest way to unseparate data is to make one pass * over the scanline for each row of each component. */ clumpoffset = 0; /* first sample in clump */ for (ci = 0, compptr = sp->cinfo.d.comp_info; ci < sp->cinfo.d.num_components; ci++, compptr++) { int hsamp = compptr->h_samp_factor; int vsamp = compptr->v_samp_factor; int ypos; for (ypos = 0; ypos < vsamp; ypos++) { JSAMPLE *inptr = sp->ds_buffer[ci][sp->scancount*vsamp + ypos]; #ifdef JPEG_LIB_MK1 JSAMPLE *outptr = (JSAMPLE*)tmpbuf + clumpoffset; #else JSAMPLE *outptr = (JSAMPLE*)buf + clumpoffset; #endif JDIMENSION nclump; if (hsamp == 1) { /* fast path for at least Cb and Cr */ for (nclump = clumps_per_line; nclump-- > 0; ) { outptr[0] = *inptr++; outptr += samples_per_clump; } } else { int xpos; /* general case */ for (nclump = clumps_per_line; nclump-- > 0; ) { for (xpos = 0; xpos < hsamp; xpos++) outptr[xpos] = *inptr++; outptr += samples_per_clump; } } clumpoffset += hsamp; } } #ifdef JPEG_LIB_MK1 { if (sp->cinfo.d.data_precision == 8) { int i=0; int len = sp->cinfo.d.output_width * sp->cinfo.d.num_components; for (i=0; i<len; i++) { ((unsigned char*)buf)[i] = tmpbuf[i] & 0xff; } } else { // 12-bit int value_pairs = (sp->cinfo.d.output_width * sp->cinfo.d.num_components) / 2; int iPair; for( iPair = 0; iPair < value_pairs; iPair++ ) { unsigned char *out_ptr = ((unsigned char *) buf) + iPair * 3; JSAMPLE *in_ptr = tmpbuf + iPair * 2; out_ptr[0] = (in_ptr[0] & 0xff0) >> 4; out_ptr[1] = ((in_ptr[0] & 0xf) << 4) | ((in_ptr[1] & 0xf00) >> 8); out_ptr[2] = ((in_ptr[1] & 0xff) >> 0); } } } #endif sp->scancount ++; tif->tif_row += sp->v_sampling; /* increment/decrement of buf and cc is still incorrect, but should not matter * TODO: resolve this */ buf += sp->bytesperline; cc -= sp->bytesperline; nrows -= sp->v_sampling; } while (nrows > 0); #ifdef JPEG_LIB_MK1 _TIFFfree(tmpbuf); #endif } /* Close down the decompressor if done. */ return sp->cinfo.d.output_scanline < sp->cinfo.d.output_height || TIFFjpeg_finish_decompress(sp); } /* * JPEG Encoding. */ static void unsuppress_quant_table (JPEGState* sp, int tblno) { JQUANT_TBL* qtbl; if ((qtbl = sp->cinfo.c.quant_tbl_ptrs[tblno]) != NULL) qtbl->sent_table = FALSE; } static void unsuppress_huff_table (JPEGState* sp, int tblno) { JHUFF_TBL* htbl; if ((htbl = sp->cinfo.c.dc_huff_tbl_ptrs[tblno]) != NULL) htbl->sent_table = FALSE; if ((htbl = sp->cinfo.c.ac_huff_tbl_ptrs[tblno]) != NULL) htbl->sent_table = FALSE; } static int prepare_JPEGTables(TIFF* tif) { JPEGState* sp = JState(tif); JPEGInitializeLibJPEG( tif, 0, 0 ); /* Initialize quant tables for current quality setting */ if (!TIFFjpeg_set_quality(sp, sp->jpegquality, FALSE)) return (0); /* Mark only the tables we want for output */ /* NB: chrominance tables are currently used only with YCbCr */ if (!TIFFjpeg_suppress_tables(sp, TRUE)) return (0); if (sp->jpegtablesmode & JPEGTABLESMODE_QUANT) { unsuppress_quant_table(sp, 0); if (sp->photometric == PHOTOMETRIC_YCBCR) unsuppress_quant_table(sp, 1); } if (sp->jpegtablesmode & JPEGTABLESMODE_HUFF) { unsuppress_huff_table(sp, 0); if (sp->photometric == PHOTOMETRIC_YCBCR) unsuppress_huff_table(sp, 1); } /* Direct libjpeg output into jpegtables */ if (!TIFFjpeg_tables_dest(sp, tif)) return (0); /* Emit tables-only datastream */ if (!TIFFjpeg_write_tables(sp)) return (0); return (1); } static int JPEGSetupEncode(TIFF* tif) { JPEGState* sp = JState(tif); TIFFDirectory *td = &tif->tif_dir; static const char module[] = "JPEGSetupEncode"; JPEGInitializeLibJPEG( tif, 1, 0 ); assert(sp != NULL); assert(!sp->cinfo.comm.is_decompressor); /* * Initialize all JPEG parameters to default values. * Note that jpeg_set_defaults needs legal values for * in_color_space and input_components. */ sp->cinfo.c.in_color_space = JCS_UNKNOWN; sp->cinfo.c.input_components = 1; if (!TIFFjpeg_set_defaults(sp)) return (0); /* Set per-file parameters */ sp->photometric = td->td_photometric; switch (sp->photometric) { case PHOTOMETRIC_YCBCR: sp->h_sampling = td->td_ycbcrsubsampling[0]; sp->v_sampling = td->td_ycbcrsubsampling[1]; /* * A ReferenceBlackWhite field *must* be present since the * default value is inappropriate for YCbCr. Fill in the * proper value if application didn't set it. */ { float *ref; if (!TIFFGetField(tif, TIFFTAG_REFERENCEBLACKWHITE, &ref)) { float refbw[6]; long top = 1L << td->td_bitspersample; refbw[0] = 0; refbw[1] = (float)(top-1L); refbw[2] = (float)(top>>1); refbw[3] = refbw[1]; refbw[4] = refbw[2]; refbw[5] = refbw[1]; TIFFSetField(tif, TIFFTAG_REFERENCEBLACKWHITE, refbw); } } break; case PHOTOMETRIC_PALETTE: /* disallowed by Tech Note */ case PHOTOMETRIC_MASK: TIFFErrorExt(tif->tif_clientdata, module, "PhotometricInterpretation %d not allowed for JPEG", (int) sp->photometric); return (0); default: /* TIFF 6.0 forbids subsampling of all other color spaces */ sp->h_sampling = 1; sp->v_sampling = 1; break; } /* Verify miscellaneous parameters */ /* * This would need work if libtiff ever supports different * depths for different components, or if libjpeg ever supports * run-time selection of depth. Neither is imminent. */ #ifdef JPEG_LIB_MK1 /* BITS_IN_JSAMPLE now permits 8 and 12 --- dgilbert */ if (td->td_bitspersample != 8 && td->td_bitspersample != 12) #else if (td->td_bitspersample != BITS_IN_JSAMPLE ) #endif { TIFFErrorExt(tif->tif_clientdata, module, "BitsPerSample %d not allowed for JPEG", (int) td->td_bitspersample); return (0); } sp->cinfo.c.data_precision = td->td_bitspersample; #ifdef JPEG_LIB_MK1 sp->cinfo.c.bits_in_jsample = td->td_bitspersample; #endif if (isTiled(tif)) { if ((td->td_tilelength % (sp->v_sampling * DCTSIZE)) != 0) { TIFFErrorExt(tif->tif_clientdata, module, "JPEG tile height must be multiple of %d", sp->v_sampling * DCTSIZE); return (0); } if ((td->td_tilewidth % (sp->h_sampling * DCTSIZE)) != 0) { TIFFErrorExt(tif->tif_clientdata, module, "JPEG tile width must be multiple of %d", sp->h_sampling * DCTSIZE); return (0); } } else { if (td->td_rowsperstrip < td->td_imagelength && (td->td_rowsperstrip % (sp->v_sampling * DCTSIZE)) != 0) { TIFFErrorExt(tif->tif_clientdata, module, "RowsPerStrip must be multiple of %d for JPEG", sp->v_sampling * DCTSIZE); return (0); } } /* Create a JPEGTables field if appropriate */ if (sp->jpegtablesmode & (JPEGTABLESMODE_QUANT|JPEGTABLESMODE_HUFF)) { if (!prepare_JPEGTables(tif)) return (0); /* Mark the field present */ /* Can't use TIFFSetField since BEENWRITING is already set! */ TIFFSetFieldBit(tif, FIELD_JPEGTABLES); tif->tif_flags |= TIFF_DIRTYDIRECT; } else { /* We do not support application-supplied JPEGTables, */ /* so mark the field not present */ TIFFClrFieldBit(tif, FIELD_JPEGTABLES); } /* Direct libjpeg output to libtiff's output buffer */ TIFFjpeg_data_dest(sp, tif); return (1); } /* * Set encoding state at the start of a strip or tile. */ static int JPEGPreEncode(TIFF* tif, tsample_t s) { JPEGState *sp = JState(tif); TIFFDirectory *td = &tif->tif_dir; static const char module[] = "JPEGPreEncode"; uint32 segment_width, segment_height; int downsampled_input; assert(sp != NULL); assert(!sp->cinfo.comm.is_decompressor); /* * Set encoding parameters for this strip/tile. */ if (isTiled(tif)) { segment_width = td->td_tilewidth; segment_height = td->td_tilelength; sp->bytesperline = TIFFTileRowSize(tif); } else { segment_width = td->td_imagewidth; segment_height = td->td_imagelength - tif->tif_row; if (segment_height > td->td_rowsperstrip) segment_height = td->td_rowsperstrip; sp->bytesperline = TIFFOldScanlineSize(tif); } if (td->td_planarconfig == PLANARCONFIG_SEPARATE && s > 0) { /* for PC 2, scale down the strip/tile size * to match a downsampled component */ segment_width = TIFFhowmany(segment_width, sp->h_sampling); segment_height = TIFFhowmany(segment_height, sp->v_sampling); } if (segment_width > 65535 || segment_height > 65535) { TIFFErrorExt(tif->tif_clientdata, module, "Strip/tile too large for JPEG"); return (0); } sp->cinfo.c.image_width = segment_width; sp->cinfo.c.image_height = segment_height; downsampled_input = FALSE; if (td->td_planarconfig == PLANARCONFIG_CONTIG) { sp->cinfo.c.input_components = td->td_samplesperpixel; if (sp->photometric == PHOTOMETRIC_YCBCR) { if (sp->jpegcolormode == JPEGCOLORMODE_RGB) { sp->cinfo.c.in_color_space = JCS_RGB; } else { sp->cinfo.c.in_color_space = JCS_YCbCr; if (sp->h_sampling != 1 || sp->v_sampling != 1) downsampled_input = TRUE; } if (!TIFFjpeg_set_colorspace(sp, JCS_YCbCr)) return (0); /* * Set Y sampling factors; * we assume jpeg_set_colorspace() set the rest to 1 */ sp->cinfo.c.comp_info[0].h_samp_factor = sp->h_sampling; sp->cinfo.c.comp_info[0].v_samp_factor = sp->v_sampling; } else { sp->cinfo.c.in_color_space = JCS_UNKNOWN; if (!TIFFjpeg_set_colorspace(sp, JCS_UNKNOWN)) return (0); /* jpeg_set_colorspace set all sampling factors to 1 */ } } else { sp->cinfo.c.input_components = 1; sp->cinfo.c.in_color_space = JCS_UNKNOWN; if (!TIFFjpeg_set_colorspace(sp, JCS_UNKNOWN)) return (0); sp->cinfo.c.comp_info[0].component_id = s; /* jpeg_set_colorspace() set sampling factors to 1 */ if (sp->photometric == PHOTOMETRIC_YCBCR && s > 0) { sp->cinfo.c.comp_info[0].quant_tbl_no = 1; sp->cinfo.c.comp_info[0].dc_tbl_no = 1; sp->cinfo.c.comp_info[0].ac_tbl_no = 1; } } /* ensure libjpeg won't write any extraneous markers */ sp->cinfo.c.write_JFIF_header = FALSE; sp->cinfo.c.write_Adobe_marker = FALSE; /* set up table handling correctly */ if (! (sp->jpegtablesmode & JPEGTABLESMODE_QUANT)) { if (!TIFFjpeg_set_quality(sp, sp->jpegquality, FALSE)) return (0); unsuppress_quant_table(sp, 0); unsuppress_quant_table(sp, 1); } if (sp->jpegtablesmode & JPEGTABLESMODE_HUFF) sp->cinfo.c.optimize_coding = FALSE; else sp->cinfo.c.optimize_coding = TRUE; if (downsampled_input) { /* Need to use raw-data interface to libjpeg */ sp->cinfo.c.raw_data_in = TRUE; tif->tif_encoderow = JPEGEncodeRaw; tif->tif_encodestrip = JPEGEncodeRaw; tif->tif_encodetile = JPEGEncodeRaw; } else { /* Use normal interface to libjpeg */ sp->cinfo.c.raw_data_in = FALSE; tif->tif_encoderow = JPEGEncode; tif->tif_encodestrip = JPEGEncode; tif->tif_encodetile = JPEGEncode; } /* Start JPEG compressor */ if (!TIFFjpeg_start_compress(sp, FALSE)) return (0); /* Allocate downsampled-data buffers if needed */ if (downsampled_input) { if (!alloc_downsampled_buffers(tif, sp->cinfo.c.comp_info, sp->cinfo.c.num_components)) return (0); } sp->scancount = 0; return (1); } /* * Encode a chunk of pixels. * "Standard" case: incoming data is not downsampled. */ static int JPEGEncode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s) { JPEGState *sp = JState(tif); tsize_t nrows; JSAMPROW bufptr[1]; (void) s; assert(sp != NULL); /* data is expected to be supplied in multiples of a scanline */ nrows = cc / sp->bytesperline; if (cc % sp->bytesperline) TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "fractional scanline discarded"); /* The last strip will be limited to image size */ if( !isTiled(tif) && tif->tif_row+nrows > tif->tif_dir.td_imagelength ) nrows = tif->tif_dir.td_imagelength - tif->tif_row; while (nrows-- > 0) { bufptr[0] = (JSAMPROW) buf; if (TIFFjpeg_write_scanlines(sp, bufptr, 1) != 1) return (0); if (nrows > 0) tif->tif_row++; buf += sp->bytesperline; } return (1); } /* * Encode a chunk of pixels. * Incoming data is expected to be downsampled per sampling factors. */ static int JPEGEncodeRaw(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s) { JPEGState *sp = JState(tif); JSAMPLE* inptr; JSAMPLE* outptr; tsize_t nrows; JDIMENSION clumps_per_line, nclump; int clumpoffset, ci, xpos, ypos; jpeg_component_info* compptr; int samples_per_clump = sp->samplesperclump; tsize_t bytesperclumpline; (void) s; assert(sp != NULL); /* data is expected to be supplied in multiples of a clumpline */ /* a clumpline is equivalent to v_sampling desubsampled scanlines */ /* TODO: the following calculation of bytesperclumpline, should substitute calculation of sp->bytesperline, except that it is per v_sampling lines */ bytesperclumpline = (((sp->cinfo.c.image_width+sp->h_sampling-1)/sp->h_sampling) *(sp->h_sampling*sp->v_sampling+2)*sp->cinfo.c.data_precision+7) /8; nrows = ( cc / bytesperclumpline ) * sp->v_sampling; if (cc % bytesperclumpline) TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "fractional scanline discarded"); /* Cb,Cr both have sampling factors 1, so this is correct */ clumps_per_line = sp->cinfo.c.comp_info[1].downsampled_width; while (nrows > 0) { /* * Fastest way to separate the data is to make one pass * over the scanline for each row of each component. */ clumpoffset = 0; /* first sample in clump */ for (ci = 0, compptr = sp->cinfo.c.comp_info; ci < sp->cinfo.c.num_components; ci++, compptr++) { int hsamp = compptr->h_samp_factor; int vsamp = compptr->v_samp_factor; int padding = (int) (compptr->width_in_blocks * DCTSIZE - clumps_per_line * hsamp); for (ypos = 0; ypos < vsamp; ypos++) { inptr = ((JSAMPLE*) buf) + clumpoffset; outptr = sp->ds_buffer[ci][sp->scancount*vsamp + ypos]; if (hsamp == 1) { /* fast path for at least Cb and Cr */ for (nclump = clumps_per_line; nclump-- > 0; ) { *outptr++ = inptr[0]; inptr += samples_per_clump; } } else { /* general case */ for (nclump = clumps_per_line; nclump-- > 0; ) { for (xpos = 0; xpos < hsamp; xpos++) *outptr++ = inptr[xpos]; inptr += samples_per_clump; } } /* pad each scanline as needed */ for (xpos = 0; xpos < padding; xpos++) { *outptr = outptr[-1]; outptr++; } clumpoffset += hsamp; } } sp->scancount++; if (sp->scancount >= DCTSIZE) { int n = sp->cinfo.c.max_v_samp_factor * DCTSIZE; if (TIFFjpeg_write_raw_data(sp, sp->ds_buffer, n) != n) return (0); sp->scancount = 0; } tif->tif_row += sp->v_sampling; buf += sp->bytesperline; nrows -= sp->v_sampling; } return (1); } /* * Finish up at the end of a strip or tile. */ static int JPEGPostEncode(TIFF* tif) { JPEGState *sp = JState(tif); if (sp->scancount > 0) { /* * Need to emit a partial bufferload of downsampled data. * Pad the data vertically. */ int ci, ypos, n; jpeg_component_info* compptr; for (ci = 0, compptr = sp->cinfo.c.comp_info; ci < sp->cinfo.c.num_components; ci++, compptr++) { int vsamp = compptr->v_samp_factor; tsize_t row_width = compptr->width_in_blocks * DCTSIZE * sizeof(JSAMPLE); for (ypos = sp->scancount * vsamp; ypos < DCTSIZE * vsamp; ypos++) { _TIFFmemcpy((tdata_t)sp->ds_buffer[ci][ypos], (tdata_t)sp->ds_buffer[ci][ypos-1], row_width); } } n = sp->cinfo.c.max_v_samp_factor * DCTSIZE; if (TIFFjpeg_write_raw_data(sp, sp->ds_buffer, n) != n) return (0); } return (TIFFjpeg_finish_compress(JState(tif))); } static void JPEGCleanup(TIFF* tif) { JPEGState *sp = JState(tif); assert(sp != 0); tif->tif_tagmethods.vgetfield = sp->vgetparent; tif->tif_tagmethods.vsetfield = sp->vsetparent; tif->tif_tagmethods.printdir = sp->printdir; if( sp->cinfo_initialized ) TIFFjpeg_destroy(sp); /* release libjpeg resources */ if (sp->jpegtables) /* tag value */ _TIFFfree(sp->jpegtables); _TIFFfree(tif->tif_data); /* release local state */ tif->tif_data = NULL; _TIFFSetDefaultCompressionState(tif); } static void JPEGResetUpsampled( TIFF* tif ) { JPEGState* sp = JState(tif); TIFFDirectory* td = &tif->tif_dir; /* * Mark whether returned data is up-sampled or not so TIFFStripSize * and TIFFTileSize return values that reflect the true amount of * data. */ tif->tif_flags &= ~TIFF_UPSAMPLED; if (td->td_planarconfig == PLANARCONFIG_CONTIG) { if (td->td_photometric == PHOTOMETRIC_YCBCR && sp->jpegcolormode == JPEGCOLORMODE_RGB) { tif->tif_flags |= TIFF_UPSAMPLED; } else { #ifdef notdef if (td->td_ycbcrsubsampling[0] != 1 || td->td_ycbcrsubsampling[1] != 1) ; /* XXX what about up-sampling? */ #endif } } /* * Must recalculate cached tile size in case sampling state changed. * Should we really be doing this now if image size isn't set? */ tif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tsize_t) -1; } static int JPEGVSetField(TIFF* tif, ttag_t tag, va_list ap) { JPEGState* sp = JState(tif); const TIFFFieldInfo* fip; uint32 v32; assert(sp != NULL); switch (tag) { case TIFFTAG_JPEGTABLES: v32 = va_arg(ap, uint32); if (v32 == 0) { /* XXX */ return (0); } _TIFFsetByteArray(&sp->jpegtables, va_arg(ap, void*), (long) v32); sp->jpegtables_length = v32; TIFFSetFieldBit(tif, FIELD_JPEGTABLES); break; case TIFFTAG_JPEGQUALITY: sp->jpegquality = va_arg(ap, int); return (1); /* pseudo tag */ case TIFFTAG_JPEGCOLORMODE: sp->jpegcolormode = va_arg(ap, int); JPEGResetUpsampled( tif ); return (1); /* pseudo tag */ case TIFFTAG_PHOTOMETRIC: { int ret_value = (*sp->vsetparent)(tif, tag, ap); JPEGResetUpsampled( tif ); return ret_value; } case TIFFTAG_JPEGTABLESMODE: sp->jpegtablesmode = va_arg(ap, int); return (1); /* pseudo tag */ case TIFFTAG_YCBCRSUBSAMPLING: /* mark the fact that we have a real ycbcrsubsampling! */ sp->ycbcrsampling_fetched = 1; /* should we be recomputing upsampling info here? */ return (*sp->vsetparent)(tif, tag, ap); case TIFFTAG_FAXRECVPARAMS: sp->recvparams = va_arg(ap, uint32); break; case TIFFTAG_FAXSUBADDRESS: _TIFFsetString(&sp->subaddress, va_arg(ap, char*)); break; case TIFFTAG_FAXRECVTIME: sp->recvtime = va_arg(ap, uint32); break; case TIFFTAG_FAXDCS: _TIFFsetString(&sp->faxdcs, va_arg(ap, char*)); break; default: return (*sp->vsetparent)(tif, tag, ap); } if ((fip = _TIFFFieldWithTag(tif, tag))) { TIFFSetFieldBit(tif, fip->field_bit); } else { return (0); } tif->tif_flags |= TIFF_DIRTYDIRECT; return (1); } /* * Some JPEG-in-TIFF produces do not emit the YCBCRSUBSAMPLING values in * the TIFF tags, but still use non-default (2,2) values within the jpeg * data stream itself. In order for TIFF applications to work properly * - for instance to get the strip buffer size right - it is imperative * that the subsampling be available before we start reading the image * data normally. This function will attempt to load the first strip in * order to get the sampling values from the jpeg data stream. Various * hacks are various places are done to ensure this function gets called * before the td_ycbcrsubsampling values are used from the directory structure, * including calling TIFFGetField() for the YCBCRSUBSAMPLING field from * TIFFStripSize(), and the printing code in tif_print.c. * * Note that JPEGPreDeocode() will produce a fairly loud warning when the * discovered sampling does not match the default sampling (2,2) or whatever * was actually in the tiff tags. * * Problems: * o This code will cause one whole strip/tile of compressed data to be * loaded just to get the tags right, even if the imagery is never read. * It would be more efficient to just load a bit of the header, and * initialize things from that. * * See the bug in bugzilla for details: * * http://bugzilla.remotesensing.org/show_bug.cgi?id=168 * * Frank Warmerdam, July 2002 */ static void JPEGFixupTestSubsampling( TIFF * tif ) { #ifdef CHECK_JPEG_YCBCR_SUBSAMPLING JPEGState *sp = JState(tif); TIFFDirectory *td = &tif->tif_dir; JPEGInitializeLibJPEG( tif, 0, 0 ); /* * Some JPEG-in-TIFF files don't provide the ycbcrsampling tags, * and use a sampling schema other than the default 2,2. To handle * this we actually have to scan the header of a strip or tile of * jpeg data to get the sampling. */ if( !sp->cinfo.comm.is_decompressor || sp->ycbcrsampling_fetched || td->td_photometric != PHOTOMETRIC_YCBCR ) return; sp->ycbcrsampling_fetched = 1; if( TIFFIsTiled( tif ) ) { if( !TIFFFillTile( tif, 0 ) ) return; } else { if( !TIFFFillStrip( tif, 0 ) ) return; } TIFFSetField( tif, TIFFTAG_YCBCRSUBSAMPLING, (uint16) sp->h_sampling, (uint16) sp->v_sampling ); #endif /* CHECK_JPEG_YCBCR_SUBSAMPLING */ } static int JPEGVGetField(TIFF* tif, ttag_t tag, va_list ap) { JPEGState* sp = JState(tif); assert(sp != NULL); switch (tag) { case TIFFTAG_JPEGTABLES: *va_arg(ap, uint32*) = sp->jpegtables_length; *va_arg(ap, void**) = sp->jpegtables; break; case TIFFTAG_JPEGQUALITY: *va_arg(ap, int*) = sp->jpegquality; break; case TIFFTAG_JPEGCOLORMODE: *va_arg(ap, int*) = sp->jpegcolormode; break; case TIFFTAG_JPEGTABLESMODE: *va_arg(ap, int*) = sp->jpegtablesmode; break; case TIFFTAG_YCBCRSUBSAMPLING: JPEGFixupTestSubsampling( tif ); return (*sp->vgetparent)(tif, tag, ap); case TIFFTAG_FAXRECVPARAMS: *va_arg(ap, uint32*) = sp->recvparams; break; case TIFFTAG_FAXSUBADDRESS: *va_arg(ap, char**) = sp->subaddress; break; case TIFFTAG_FAXRECVTIME: *va_arg(ap, uint32*) = sp->recvtime; break; case TIFFTAG_FAXDCS: *va_arg(ap, char**) = sp->faxdcs; break; default: return (*sp->vgetparent)(tif, tag, ap); } return (1); } static void JPEGPrintDir(TIFF* tif, FILE* fd, long flags) { JPEGState* sp = JState(tif); assert(sp != NULL); (void) flags; if (TIFFFieldSet(tif,FIELD_JPEGTABLES)) fprintf(fd, " JPEG Tables: (%lu bytes)\n", (unsigned long) sp->jpegtables_length); if (TIFFFieldSet(tif,FIELD_RECVPARAMS)) fprintf(fd, " Fax Receive Parameters: %08lx\n", (unsigned long) sp->recvparams); if (TIFFFieldSet(tif,FIELD_SUBADDRESS)) fprintf(fd, " Fax SubAddress: %s\n", sp->subaddress); if (TIFFFieldSet(tif,FIELD_RECVTIME)) fprintf(fd, " Fax Receive Time: %lu secs\n", (unsigned long) sp->recvtime); if (TIFFFieldSet(tif,FIELD_FAXDCS)) fprintf(fd, " Fax DCS: %s\n", sp->faxdcs); } static uint32 JPEGDefaultStripSize(TIFF* tif, uint32 s) { JPEGState* sp = JState(tif); TIFFDirectory *td = &tif->tif_dir; s = (*sp->defsparent)(tif, s); if (s < td->td_imagelength) s = TIFFroundup(s, td->td_ycbcrsubsampling[1] * DCTSIZE); return (s); } static void JPEGDefaultTileSize(TIFF* tif, uint32* tw, uint32* th) { JPEGState* sp = JState(tif); TIFFDirectory *td = &tif->tif_dir; (*sp->deftparent)(tif, tw, th); *tw = TIFFroundup(*tw, td->td_ycbcrsubsampling[0] * DCTSIZE); *th = TIFFroundup(*th, td->td_ycbcrsubsampling[1] * DCTSIZE); } /* * The JPEG library initialized used to be done in TIFFInitJPEG(), but * now that we allow a TIFF file to be opened in update mode it is necessary * to have some way of deciding whether compression or decompression is * desired other than looking at tif->tif_mode. We accomplish this by * examining {TILE/STRIP}BYTECOUNTS to see if there is a non-zero entry. * If so, we assume decompression is desired. * * This is tricky, because TIFFInitJPEG() is called while the directory is * being read, and generally speaking the BYTECOUNTS tag won't have been read * at that point. So we try to defer jpeg library initialization till we * do have that tag ... basically any access that might require the compressor * or decompressor that occurs after the reading of the directory. * * In an ideal world compressors or decompressors would be setup * at the point where a single tile or strip was accessed (for read or write) * so that stuff like update of missing tiles, or replacement of tiles could * be done. However, we aren't trying to crack that nut just yet ... * * NFW, Feb 3rd, 2003. */ static int JPEGInitializeLibJPEG( TIFF * tif, int force_encode, int force_decode ) { JPEGState* sp = JState(tif); uint32 *byte_counts = NULL; int data_is_empty = TRUE; int decompress; if(sp->cinfo_initialized) { if( force_encode && sp->cinfo.comm.is_decompressor ) TIFFjpeg_destroy( sp ); else if( force_decode && !sp->cinfo.comm.is_decompressor ) TIFFjpeg_destroy( sp ); else return 1; sp->cinfo_initialized = 0; } /* * Do we have tile data already? Make sure we initialize the * the state in decompressor mode if we have tile data, even if we * are not in read-only file access mode. */ if( TIFFIsTiled( tif ) && TIFFGetField( tif, TIFFTAG_TILEBYTECOUNTS, &byte_counts ) && byte_counts != NULL ) { data_is_empty = byte_counts[0] == 0; } if( !TIFFIsTiled( tif ) && TIFFGetField( tif, TIFFTAG_STRIPBYTECOUNTS, &byte_counts) && byte_counts != NULL ) { data_is_empty = byte_counts[0] == 0; } if( force_decode ) decompress = 1; else if( force_encode ) decompress = 0; else if( tif->tif_mode == O_RDONLY ) decompress = 1; else if( data_is_empty ) decompress = 0; else decompress = 1; /* * Initialize libjpeg. */ if ( decompress ) { if (!TIFFjpeg_create_decompress(sp)) return (0); } else { if (!TIFFjpeg_create_compress(sp)) return (0); } sp->cinfo_initialized = TRUE; return 1; } int TIFFInitJPEG(TIFF* tif, int scheme) { JPEGState* sp; assert(scheme == COMPRESSION_JPEG); /* * Merge codec-specific tag information. */ if (!_TIFFMergeFieldInfo(tif, jpegFieldInfo, N(jpegFieldInfo))) { TIFFErrorExt(tif->tif_clientdata, "TIFFInitJPEG", "Merging JPEG codec-specific tags failed"); return 0; } /* * Allocate state block so tag methods have storage to record values. */ tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (JPEGState)); if (tif->tif_data == NULL) { TIFFErrorExt(tif->tif_clientdata, "TIFFInitJPEG", "No space for JPEG state block"); return 0; } _TIFFmemset(tif->tif_data, 0, sizeof(JPEGState)); sp = JState(tif); sp->tif = tif; /* back link */ /* * Override parent get/set field methods. */ sp->vgetparent = tif->tif_tagmethods.vgetfield; tif->tif_tagmethods.vgetfield = JPEGVGetField; /* hook for codec tags */ sp->vsetparent = tif->tif_tagmethods.vsetfield; tif->tif_tagmethods.vsetfield = JPEGVSetField; /* hook for codec tags */ sp->printdir = tif->tif_tagmethods.printdir; tif->tif_tagmethods.printdir = JPEGPrintDir; /* hook for codec tags */ /* Default values for codec-specific fields */ sp->jpegtables = NULL; sp->jpegtables_length = 0; sp->jpegquality = 75; /* Default IJG quality */ sp->jpegcolormode = JPEGCOLORMODE_RAW; sp->jpegtablesmode = JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF; sp->recvparams = 0; sp->subaddress = NULL; sp->faxdcs = NULL; sp->ycbcrsampling_fetched = 0; /* * Install codec methods. */ tif->tif_setupdecode = JPEGSetupDecode; tif->tif_predecode = JPEGPreDecode; tif->tif_decoderow = JPEGDecode; tif->tif_decodestrip = JPEGDecode; tif->tif_decodetile = JPEGDecode; tif->tif_setupencode = JPEGSetupEncode; tif->tif_preencode = JPEGPreEncode; tif->tif_postencode = JPEGPostEncode; tif->tif_encoderow = JPEGEncode; tif->tif_encodestrip = JPEGEncode; tif->tif_encodetile = JPEGEncode; tif->tif_cleanup = JPEGCleanup; sp->defsparent = tif->tif_defstripsize; tif->tif_defstripsize = JPEGDefaultStripSize; sp->deftparent = tif->tif_deftilesize; tif->tif_deftilesize = JPEGDefaultTileSize; tif->tif_flags |= TIFF_NOBITREV; /* no bit reversal, please */ sp->cinfo_initialized = FALSE; /* ** Create a JPEGTables field if no directory has yet been created. ** We do this just to ensure that sufficient space is reserved for ** the JPEGTables field. It will be properly created the right ** size later. */ if( tif->tif_diroff == 0 ) { #define SIZE_OF_JPEGTABLES 2000 TIFFSetFieldBit(tif, FIELD_JPEGTABLES); sp->jpegtables_length = SIZE_OF_JPEGTABLES; sp->jpegtables = (void *) _TIFFmalloc(sp->jpegtables_length); _TIFFmemset(sp->jpegtables, 0, SIZE_OF_JPEGTABLES); #undef SIZE_OF_JPEGTABLES } /* * Mark the TIFFTAG_YCBCRSAMPLES as present even if it is not * see: JPEGFixupTestSubsampling(). */ TIFFSetFieldBit( tif, FIELD_YCBCRSUBSAMPLING ); return 1; } #endif /* JPEG_SUPPORT */ /* vim: set ts=8 sts=8 sw=8 noet: */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_unix.c��������������������������������������������������0000644�0001750�0001750�00000013756�12320456500�021341� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_unix.c,v 1.12 2006/03/21 16:37:51 dron Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library UNIX-specific Routines. These are should also work with the * Windows Common RunTime Library. */ #include "tif_config.h" #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif #include <stdarg.h> #include <stdlib.h> #include <sys/stat.h> #ifdef HAVE_UNISTD_H # include <unistd.h> #endif #ifdef HAVE_FCNTL_H # include <fcntl.h> #endif #ifdef HAVE_IO_H # include <io.h> #endif #include "tiffiop.h" static tsize_t _tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size) { return ((tsize_t) read((int) fd, buf, (size_t) size)); } static tsize_t _tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size) { return ((tsize_t) write((int) fd, buf, (size_t) size)); } static toff_t _tiffSeekProc(thandle_t fd, toff_t off, int whence) { return ((toff_t) lseek((int) fd, (off_t) off, whence)); } static int _tiffCloseProc(thandle_t fd) { return (close((int) fd)); } static toff_t _tiffSizeProc(thandle_t fd) { #ifdef _AM29K long fsize; return ((fsize = lseek((int) fd, 0, SEEK_END)) < 0 ? 0 : fsize); #else struct stat sb; return (toff_t) (fstat((int) fd, &sb) < 0 ? 0 : sb.st_size); #endif } #ifdef HAVE_MMAP #include <sys/mman.h> static int _tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize) { toff_t size = _tiffSizeProc(fd); if (size != (toff_t) -1) { *pbase = (tdata_t) mmap(0, size, PROT_READ, MAP_SHARED, (int) fd, 0); if (*pbase != (tdata_t) -1) { *psize = size; return (1); } } return (0); } static void _tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size) { (void) fd; (void) munmap(base, (off_t) size); } #else /* !HAVE_MMAP */ static int _tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize) { (void) fd; (void) pbase; (void) psize; return (0); } static void _tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size) { (void) fd; (void) base; (void) size; } #endif /* !HAVE_MMAP */ /* * Open a TIFF file descriptor for read/writing. */ TIFF* TIFFFdOpen(int fd, const char* name, const char* mode) { TIFF* tif; tif = TIFFClientOpen(name, mode, (thandle_t) fd, _tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc, _tiffSizeProc, _tiffMapProc, _tiffUnmapProc); if (tif) tif->tif_fd = fd; return (tif); } /* * Open a TIFF file for read/writing. */ TIFF* TIFFOpen(const char* name, const char* mode) { static const char module[] = "TIFFOpen"; int m, fd; TIFF* tif; m = _TIFFgetMode(mode, module); if (m == -1) return ((TIFF*)0); /* for cygwin and mingw */ #ifdef O_BINARY m |= O_BINARY; #endif #ifdef _AM29K fd = open(name, m); #else fd = open(name, m, 0666); #endif if (fd < 0) { TIFFErrorExt(0, module, "%s: Cannot open", name); return ((TIFF *)0); } tif = TIFFFdOpen((int)fd, name, mode); if(!tif) close(fd); return tif; } #ifdef __WIN32__ #include <windows.h> /* * Open a TIFF file with a Unicode filename, for read/writing. */ TIFF* TIFFOpenW(const wchar_t* name, const char* mode) { static const char module[] = "TIFFOpenW"; int m, fd; int mbsize; char *mbname; TIFF* tif; m = _TIFFgetMode(mode, module); if (m == -1) return ((TIFF*)0); /* for cygwin and mingw */ #ifdef O_BINARY m |= O_BINARY; #endif fd = _wopen(name, m, 0666); if (fd < 0) { TIFFErrorExt(0, module, "%s: Cannot open", name); return ((TIFF *)0); } mbname = NULL; mbsize = WideCharToMultiByte(CP_ACP, 0, name, -1, NULL, 0, NULL, NULL); if (mbsize > 0) { mbname = _TIFFmalloc(mbsize); if (!mbname) { TIFFErrorExt(0, module, "Can't allocate space for filename conversion buffer"); return ((TIFF*)0); } WideCharToMultiByte(CP_ACP, 0, name, -1, mbname, mbsize, NULL, NULL); } tif = TIFFFdOpen((int)fd, (mbname != NULL) ? mbname : "<unknown>", mode); _TIFFfree(mbname); if(!tif) close(fd); return tif; } #endif void* _TIFFmalloc(tsize_t s) { return (malloc((size_t) s)); } void _TIFFfree(tdata_t p) { free(p); } void* _TIFFrealloc(tdata_t p, tsize_t s) { return (realloc(p, (size_t) s)); } void _TIFFmemset(tdata_t p, int v, tsize_t c) { memset(p, v, (size_t) c); } void _TIFFmemcpy(tdata_t d, const tdata_t s, tsize_t c) { memcpy(d, s, (size_t) c); } int _TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c) { return (memcmp(p1, p2, (size_t) c)); } static void unixWarningHandler(const char* module, const char* fmt, va_list ap) { if (module != NULL) fprintf(stderr, "%s: ", module); fprintf(stderr, "Warning, "); vfprintf(stderr, fmt, ap); fprintf(stderr, ".\n"); } TIFFErrorHandler _TIFFwarningHandler = unixWarningHandler; static void unixErrorHandler(const char* module, const char* fmt, va_list ap) { if (module != NULL) fprintf(stderr, "%s: ", module); vfprintf(stderr, fmt, ap); fprintf(stderr, ".\n"); } TIFFErrorHandler _TIFFerrorHandler = unixErrorHandler; ������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_lzw.c���������������������������������������������������0000644�0001750�0001750�00000073537�12320456500�021175� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_lzw.c,v 1.29.2.5 2009-06-22 04:57:31 fwarmerdam Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "tiffiop.h" #ifdef LZW_SUPPORT /* * TIFF Library. * Rev 5.0 Lempel-Ziv & Welch Compression Support * * This code is derived from the compress program whose code is * derived from software contributed to Berkeley by James A. Woods, * derived from original work by Spencer Thomas and Joseph Orost. * * The original Berkeley copyright notice appears below in its entirety. */ #include "tif_predict.h" #include <stdio.h> /* * NB: The 5.0 spec describes a different algorithm than Aldus * implements. Specifically, Aldus does code length transitions * one code earlier than should be done (for real LZW). * Earlier versions of this library implemented the correct * LZW algorithm, but emitted codes in a bit order opposite * to the TIFF spec. Thus, to maintain compatibility w/ Aldus * we interpret MSB-LSB ordered codes to be images written w/ * old versions of this library, but otherwise adhere to the * Aldus "off by one" algorithm. * * Future revisions to the TIFF spec are expected to "clarify this issue". */ #define LZW_COMPAT /* include backwards compatibility code */ /* * Each strip of data is supposed to be terminated by a CODE_EOI. * If the following #define is included, the decoder will also * check for end-of-strip w/o seeing this code. This makes the * library more robust, but also slower. */ #define LZW_CHECKEOS /* include checks for strips w/o EOI code */ #define MAXCODE(n) ((1L<<(n))-1) /* * The TIFF spec specifies that encoded bit * strings range from 9 to 12 bits. */ #define BITS_MIN 9 /* start with 9 bits */ #define BITS_MAX 12 /* max of 12 bit strings */ /* predefined codes */ #define CODE_CLEAR 256 /* code to clear string table */ #define CODE_EOI 257 /* end-of-information code */ #define CODE_FIRST 258 /* first free code entry */ #define CODE_MAX MAXCODE(BITS_MAX) #define HSIZE 9001L /* 91% occupancy */ #define HSHIFT (13-8) #ifdef LZW_COMPAT /* NB: +1024 is for compatibility with old files */ #define CSIZE (MAXCODE(BITS_MAX)+1024L) #else #define CSIZE (MAXCODE(BITS_MAX)+1L) #endif /* * State block for each open TIFF file using LZW * compression/decompression. Note that the predictor * state block must be first in this data structure. */ typedef struct { TIFFPredictorState predict; /* predictor super class */ unsigned short nbits; /* # of bits/code */ unsigned short maxcode; /* maximum code for lzw_nbits */ unsigned short free_ent; /* next free entry in hash table */ long nextdata; /* next bits of i/o */ long nextbits; /* # of valid bits in lzw_nextdata */ int rw_mode; /* preserve rw_mode from init */ } LZWBaseState; #define lzw_nbits base.nbits #define lzw_maxcode base.maxcode #define lzw_free_ent base.free_ent #define lzw_nextdata base.nextdata #define lzw_nextbits base.nextbits /* * Encoding-specific state. */ typedef uint16 hcode_t; /* codes fit in 16 bits */ typedef struct { long hash; hcode_t code; } hash_t; /* * Decoding-specific state. */ typedef struct code_ent { struct code_ent *next; unsigned short length; /* string len, including this token */ unsigned char value; /* data value */ unsigned char firstchar; /* first token of string */ } code_t; typedef int (*decodeFunc)(TIFF*, tidata_t, tsize_t, tsample_t); typedef struct { LZWBaseState base; /* Decoding specific data */ long dec_nbitsmask; /* lzw_nbits 1 bits, right adjusted */ long dec_restart; /* restart count */ #ifdef LZW_CHECKEOS long dec_bitsleft; /* available bits in raw data */ #endif decodeFunc dec_decode; /* regular or backwards compatible */ code_t* dec_codep; /* current recognized code */ code_t* dec_oldcodep; /* previously recognized code */ code_t* dec_free_entp; /* next free entry */ code_t* dec_maxcodep; /* max available entry */ code_t* dec_codetab; /* kept separate for small machines */ /* Encoding specific data */ int enc_oldcode; /* last code encountered */ long enc_checkpoint; /* point at which to clear table */ #define CHECK_GAP 10000 /* enc_ratio check interval */ long enc_ratio; /* current compression ratio */ long enc_incount; /* (input) data bytes encoded */ long enc_outcount; /* encoded (output) bytes */ tidata_t enc_rawlimit; /* bound on tif_rawdata buffer */ hash_t* enc_hashtab; /* kept separate for small machines */ } LZWCodecState; #define LZWState(tif) ((LZWBaseState*) (tif)->tif_data) #define DecoderState(tif) ((LZWCodecState*) LZWState(tif)) #define EncoderState(tif) ((LZWCodecState*) LZWState(tif)) static int LZWDecode(TIFF*, tidata_t, tsize_t, tsample_t); #ifdef LZW_COMPAT static int LZWDecodeCompat(TIFF*, tidata_t, tsize_t, tsample_t); #endif static void cl_hash(LZWCodecState*); /* * LZW Decoder. */ #ifdef LZW_CHECKEOS /* * This check shouldn't be necessary because each * strip is suppose to be terminated with CODE_EOI. */ #define NextCode(_tif, _sp, _bp, _code, _get) { \ if ((_sp)->dec_bitsleft < nbits) { \ TIFFWarningExt(_tif->tif_clientdata, _tif->tif_name, \ "LZWDecode: Strip %d not terminated with EOI code", \ _tif->tif_curstrip); \ _code = CODE_EOI; \ } else { \ _get(_sp,_bp,_code); \ (_sp)->dec_bitsleft -= nbits; \ } \ } #else #define NextCode(tif, sp, bp, code, get) get(sp, bp, code) #endif static int LZWSetupDecode(TIFF* tif) { LZWCodecState* sp = DecoderState(tif); static const char module[] = " LZWSetupDecode"; int code; if( sp == NULL ) { /* * Allocate state block so tag methods have storage to record * values. */ tif->tif_data = (tidata_t) _TIFFmalloc(sizeof(LZWCodecState)); if (tif->tif_data == NULL) { TIFFErrorExt(tif->tif_clientdata, "LZWPreDecode", "No space for LZW state block"); return (0); } DecoderState(tif)->dec_codetab = NULL; DecoderState(tif)->dec_decode = NULL; /* * Setup predictor setup. */ (void) TIFFPredictorInit(tif); sp = DecoderState(tif); } assert(sp != NULL); if (sp->dec_codetab == NULL) { sp->dec_codetab = (code_t*)_TIFFmalloc(CSIZE*sizeof (code_t)); if (sp->dec_codetab == NULL) { TIFFErrorExt(tif->tif_clientdata, module, "No space for LZW code table"); return (0); } /* * Pre-load the table. */ code = 255; do { sp->dec_codetab[code].value = code; sp->dec_codetab[code].firstchar = code; sp->dec_codetab[code].length = 1; sp->dec_codetab[code].next = NULL; } while (code--); /* * Zero-out the unused entries */ _TIFFmemset(&sp->dec_codetab[CODE_CLEAR], 0, (CODE_FIRST - CODE_CLEAR) * sizeof (code_t)); } return (1); } /* * Setup state for decoding a strip. */ static int LZWPreDecode(TIFF* tif, tsample_t s) { LZWCodecState *sp = DecoderState(tif); (void) s; assert(sp != NULL); if( sp->dec_codetab == NULL ) { tif->tif_setupdecode( tif ); } /* * Check for old bit-reversed codes. */ if (tif->tif_rawdata[0] == 0 && (tif->tif_rawdata[1] & 0x1)) { #ifdef LZW_COMPAT if (!sp->dec_decode) { TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "Old-style LZW codes, convert file"); /* * Override default decoding methods with * ones that deal with the old coding. * Otherwise the predictor versions set * above will call the compatibility routines * through the dec_decode method. */ tif->tif_decoderow = LZWDecodeCompat; tif->tif_decodestrip = LZWDecodeCompat; tif->tif_decodetile = LZWDecodeCompat; /* * If doing horizontal differencing, must * re-setup the predictor logic since we * switched the basic decoder methods... */ (*tif->tif_setupdecode)(tif); sp->dec_decode = LZWDecodeCompat; } sp->lzw_maxcode = MAXCODE(BITS_MIN); #else /* !LZW_COMPAT */ if (!sp->dec_decode) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Old-style LZW codes not supported"); sp->dec_decode = LZWDecode; } return (0); #endif/* !LZW_COMPAT */ } else { sp->lzw_maxcode = MAXCODE(BITS_MIN)-1; sp->dec_decode = LZWDecode; } sp->lzw_nbits = BITS_MIN; sp->lzw_nextbits = 0; sp->lzw_nextdata = 0; sp->dec_restart = 0; sp->dec_nbitsmask = MAXCODE(BITS_MIN); #ifdef LZW_CHECKEOS sp->dec_bitsleft = tif->tif_rawcc << 3; #endif sp->dec_free_entp = sp->dec_codetab + CODE_FIRST; /* * Zero entries that are not yet filled in. We do * this to guard against bogus input data that causes * us to index into undefined entries. If you can * come up with a way to safely bounds-check input codes * while decoding then you can remove this operation. */ _TIFFmemset(sp->dec_free_entp, 0, (CSIZE-CODE_FIRST)*sizeof (code_t)); sp->dec_oldcodep = &sp->dec_codetab[-1]; sp->dec_maxcodep = &sp->dec_codetab[sp->dec_nbitsmask-1]; return (1); } /* * Decode a "hunk of data". */ #define GetNextCode(sp, bp, code) { \ nextdata = (nextdata<<8) | *(bp)++; \ nextbits += 8; \ if (nextbits < nbits) { \ nextdata = (nextdata<<8) | *(bp)++; \ nextbits += 8; \ } \ code = (hcode_t)((nextdata >> (nextbits-nbits)) & nbitsmask); \ nextbits -= nbits; \ } static void codeLoop(TIFF* tif) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "LZWDecode: Bogus encoding, loop in the code table; scanline %d", tif->tif_row); } static int LZWDecode(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s) { LZWCodecState *sp = DecoderState(tif); char *op = (char*) op0; long occ = (long) occ0; char *tp; unsigned char *bp; hcode_t code; int len; long nbits, nextbits, nextdata, nbitsmask; code_t *codep, *free_entp, *maxcodep, *oldcodep; (void) s; assert(sp != NULL); assert(sp->dec_codetab != NULL); /* * Restart interrupted output operation. */ if (sp->dec_restart) { long residue; codep = sp->dec_codep; residue = codep->length - sp->dec_restart; if (residue > occ) { /* * Residue from previous decode is sufficient * to satisfy decode request. Skip to the * start of the decoded string, place decoded * values in the output buffer, and return. */ sp->dec_restart += occ; do { codep = codep->next; } while (--residue > occ && codep); if (codep) { tp = op + occ; do { *--tp = codep->value; codep = codep->next; } while (--occ && codep); } return (1); } /* * Residue satisfies only part of the decode request. */ op += residue, occ -= residue; tp = op; do { int t; --tp; t = codep->value; codep = codep->next; *tp = t; } while (--residue && codep); sp->dec_restart = 0; } bp = (unsigned char *)tif->tif_rawcp; nbits = sp->lzw_nbits; nextdata = sp->lzw_nextdata; nextbits = sp->lzw_nextbits; nbitsmask = sp->dec_nbitsmask; oldcodep = sp->dec_oldcodep; free_entp = sp->dec_free_entp; maxcodep = sp->dec_maxcodep; while (occ > 0) { NextCode(tif, sp, bp, code, GetNextCode); if (code == CODE_EOI) break; if (code == CODE_CLEAR) { free_entp = sp->dec_codetab + CODE_FIRST; _TIFFmemset(free_entp, 0, (CSIZE - CODE_FIRST) * sizeof (code_t)); nbits = BITS_MIN; nbitsmask = MAXCODE(BITS_MIN); maxcodep = sp->dec_codetab + nbitsmask-1; NextCode(tif, sp, bp, code, GetNextCode); if (code == CODE_EOI) break; if (code == CODE_CLEAR) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "LZWDecode: Corrupted LZW table at scanline %d", tif->tif_row); return (0); } *op++ = (char)code, occ--; oldcodep = sp->dec_codetab + code; continue; } codep = sp->dec_codetab + code; /* * Add the new entry to the code table. */ if (free_entp < &sp->dec_codetab[0] || free_entp >= &sp->dec_codetab[CSIZE]) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "LZWDecode: Corrupted LZW table at scanline %d", tif->tif_row); return (0); } free_entp->next = oldcodep; if (free_entp->next < &sp->dec_codetab[0] || free_entp->next >= &sp->dec_codetab[CSIZE]) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "LZWDecode: Corrupted LZW table at scanline %d", tif->tif_row); return (0); } free_entp->firstchar = free_entp->next->firstchar; free_entp->length = free_entp->next->length+1; free_entp->value = (codep < free_entp) ? codep->firstchar : free_entp->firstchar; if (++free_entp > maxcodep) { if (++nbits > BITS_MAX) /* should not happen */ nbits = BITS_MAX; nbitsmask = MAXCODE(nbits); maxcodep = sp->dec_codetab + nbitsmask-1; } oldcodep = codep; if (code >= 256) { /* * Code maps to a string, copy string * value to output (written in reverse). */ if(codep->length == 0) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "LZWDecode: Wrong length of decoded string: " "data probably corrupted at scanline %d", tif->tif_row); return (0); } if (codep->length > occ) { /* * String is too long for decode buffer, * locate portion that will fit, copy to * the decode buffer, and setup restart * logic for the next decoding call. */ sp->dec_codep = codep; do { codep = codep->next; } while (codep && codep->length > occ); if (codep) { sp->dec_restart = occ; tp = op + occ; do { *--tp = codep->value; codep = codep->next; } while (--occ && codep); if (codep) codeLoop(tif); } break; } len = codep->length; tp = op + len; do { int t; --tp; t = codep->value; codep = codep->next; *tp = t; } while (codep && tp > op); if (codep) { codeLoop(tif); break; } op += len, occ -= len; } else *op++ = (char)code, occ--; } tif->tif_rawcp = (tidata_t) bp; sp->lzw_nbits = (unsigned short) nbits; sp->lzw_nextdata = nextdata; sp->lzw_nextbits = nextbits; sp->dec_nbitsmask = nbitsmask; sp->dec_oldcodep = oldcodep; sp->dec_free_entp = free_entp; sp->dec_maxcodep = maxcodep; if (occ > 0) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "LZWDecode: Not enough data at scanline %d (short %ld bytes)", tif->tif_row, occ); return (0); } return (1); } #ifdef LZW_COMPAT /* * Decode a "hunk of data" for old images. */ #define GetNextCodeCompat(sp, bp, code) { \ nextdata |= (unsigned long) *(bp)++ << nextbits; \ nextbits += 8; \ if (nextbits < nbits) { \ nextdata |= (unsigned long) *(bp)++ << nextbits;\ nextbits += 8; \ } \ code = (hcode_t)(nextdata & nbitsmask); \ nextdata >>= nbits; \ nextbits -= nbits; \ } static int LZWDecodeCompat(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s) { LZWCodecState *sp = DecoderState(tif); char *op = (char*) op0; long occ = (long) occ0; char *tp; unsigned char *bp; int code, nbits; long nextbits, nextdata, nbitsmask; code_t *codep, *free_entp, *maxcodep, *oldcodep; (void) s; assert(sp != NULL); /* * Restart interrupted output operation. */ if (sp->dec_restart) { long residue; codep = sp->dec_codep; residue = codep->length - sp->dec_restart; if (residue > occ) { /* * Residue from previous decode is sufficient * to satisfy decode request. Skip to the * start of the decoded string, place decoded * values in the output buffer, and return. */ sp->dec_restart += occ; do { codep = codep->next; } while (--residue > occ); tp = op + occ; do { *--tp = codep->value; codep = codep->next; } while (--occ); return (1); } /* * Residue satisfies only part of the decode request. */ op += residue, occ -= residue; tp = op; do { *--tp = codep->value; codep = codep->next; } while (--residue); sp->dec_restart = 0; } bp = (unsigned char *)tif->tif_rawcp; nbits = sp->lzw_nbits; nextdata = sp->lzw_nextdata; nextbits = sp->lzw_nextbits; nbitsmask = sp->dec_nbitsmask; oldcodep = sp->dec_oldcodep; free_entp = sp->dec_free_entp; maxcodep = sp->dec_maxcodep; while (occ > 0) { NextCode(tif, sp, bp, code, GetNextCodeCompat); if (code == CODE_EOI) break; if (code == CODE_CLEAR) { free_entp = sp->dec_codetab + CODE_FIRST; _TIFFmemset(free_entp, 0, (CSIZE - CODE_FIRST) * sizeof (code_t)); nbits = BITS_MIN; nbitsmask = MAXCODE(BITS_MIN); maxcodep = sp->dec_codetab + nbitsmask; NextCode(tif, sp, bp, code, GetNextCodeCompat); if (code == CODE_EOI) break; if (code == CODE_CLEAR) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "LZWDecode: Corrupted LZW table at scanline %d", tif->tif_row); return (0); } *op++ = code, occ--; oldcodep = sp->dec_codetab + code; continue; } codep = sp->dec_codetab + code; /* * Add the new entry to the code table. */ if (free_entp < &sp->dec_codetab[0] || free_entp >= &sp->dec_codetab[CSIZE]) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "LZWDecodeCompat: Corrupted LZW table at scanline %d", tif->tif_row); return (0); } free_entp->next = oldcodep; if (free_entp->next < &sp->dec_codetab[0] || free_entp->next >= &sp->dec_codetab[CSIZE]) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "LZWDecodeCompat: Corrupted LZW table at scanline %d", tif->tif_row); return (0); } free_entp->firstchar = free_entp->next->firstchar; free_entp->length = free_entp->next->length+1; free_entp->value = (codep < free_entp) ? codep->firstchar : free_entp->firstchar; if (++free_entp > maxcodep) { if (++nbits > BITS_MAX) /* should not happen */ nbits = BITS_MAX; nbitsmask = MAXCODE(nbits); maxcodep = sp->dec_codetab + nbitsmask; } oldcodep = codep; if (code >= 256) { char *op_orig = op; /* * Code maps to a string, copy string * value to output (written in reverse). */ if(codep->length == 0) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "LZWDecodeCompat: Wrong length of decoded " "string: data probably corrupted at scanline %d", tif->tif_row); return (0); } if (codep->length > occ) { /* * String is too long for decode buffer, * locate portion that will fit, copy to * the decode buffer, and setup restart * logic for the next decoding call. */ sp->dec_codep = codep; do { codep = codep->next; } while (codep->length > occ); sp->dec_restart = occ; tp = op + occ; do { *--tp = codep->value; codep = codep->next; } while (--occ); break; } op += codep->length, occ -= codep->length; tp = op; do { *--tp = codep->value; } while( (codep = codep->next) != NULL && tp > op_orig); } else *op++ = code, occ--; } tif->tif_rawcp = (tidata_t) bp; sp->lzw_nbits = nbits; sp->lzw_nextdata = nextdata; sp->lzw_nextbits = nextbits; sp->dec_nbitsmask = nbitsmask; sp->dec_oldcodep = oldcodep; sp->dec_free_entp = free_entp; sp->dec_maxcodep = maxcodep; if (occ > 0) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "LZWDecodeCompat: Not enough data at scanline %d (short %ld bytes)", tif->tif_row, occ); return (0); } return (1); } #endif /* LZW_COMPAT */ /* * LZW Encoding. */ static int LZWSetupEncode(TIFF* tif) { LZWCodecState* sp = EncoderState(tif); static const char module[] = "LZWSetupEncode"; assert(sp != NULL); sp->enc_hashtab = (hash_t*) _TIFFmalloc(HSIZE*sizeof (hash_t)); if (sp->enc_hashtab == NULL) { TIFFErrorExt(tif->tif_clientdata, module, "No space for LZW hash table"); return (0); } return (1); } /* * Reset encoding state at the start of a strip. */ static int LZWPreEncode(TIFF* tif, tsample_t s) { LZWCodecState *sp = EncoderState(tif); (void) s; assert(sp != NULL); if( sp->enc_hashtab == NULL ) { tif->tif_setupencode( tif ); } sp->lzw_nbits = BITS_MIN; sp->lzw_maxcode = MAXCODE(BITS_MIN); sp->lzw_free_ent = CODE_FIRST; sp->lzw_nextbits = 0; sp->lzw_nextdata = 0; sp->enc_checkpoint = CHECK_GAP; sp->enc_ratio = 0; sp->enc_incount = 0; sp->enc_outcount = 0; /* * The 4 here insures there is space for 2 max-sized * codes in LZWEncode and LZWPostDecode. */ sp->enc_rawlimit = tif->tif_rawdata + tif->tif_rawdatasize-1 - 4; cl_hash(sp); /* clear hash table */ sp->enc_oldcode = (hcode_t) -1; /* generates CODE_CLEAR in LZWEncode */ return (1); } #define CALCRATIO(sp, rat) { \ if (incount > 0x007fffff) { /* NB: shift will overflow */\ rat = outcount >> 8; \ rat = (rat == 0 ? 0x7fffffff : incount/rat); \ } else \ rat = (incount<<8) / outcount; \ } #define PutNextCode(op, c) { \ nextdata = (nextdata << nbits) | c; \ nextbits += nbits; \ *op++ = (unsigned char)(nextdata >> (nextbits-8)); \ nextbits -= 8; \ if (nextbits >= 8) { \ *op++ = (unsigned char)(nextdata >> (nextbits-8)); \ nextbits -= 8; \ } \ outcount += nbits; \ } /* * Encode a chunk of pixels. * * Uses an open addressing double hashing (no chaining) on the * prefix code/next character combination. We do a variant of * Knuth's algorithm D (vol. 3, sec. 6.4) along with G. Knott's * relatively-prime secondary probe. Here, the modular division * first probe is gives way to a faster exclusive-or manipulation. * Also do block compression with an adaptive reset, whereby the * code table is cleared when the compression ratio decreases, * but after the table fills. The variable-length output codes * are re-sized at this point, and a CODE_CLEAR is generated * for the decoder. */ static int LZWEncode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) { register LZWCodecState *sp = EncoderState(tif); register long fcode; register hash_t *hp; register int h, c; hcode_t ent; long disp; long incount, outcount, checkpoint; long nextdata, nextbits; int free_ent, maxcode, nbits; tidata_t op, limit; (void) s; if (sp == NULL) return (0); assert(sp->enc_hashtab != NULL); /* * Load local state. */ incount = sp->enc_incount; outcount = sp->enc_outcount; checkpoint = sp->enc_checkpoint; nextdata = sp->lzw_nextdata; nextbits = sp->lzw_nextbits; free_ent = sp->lzw_free_ent; maxcode = sp->lzw_maxcode; nbits = sp->lzw_nbits; op = tif->tif_rawcp; limit = sp->enc_rawlimit; ent = sp->enc_oldcode; if (ent == (hcode_t) -1 && cc > 0) { /* * NB: This is safe because it can only happen * at the start of a strip where we know there * is space in the data buffer. */ PutNextCode(op, CODE_CLEAR); ent = *bp++; cc--; incount++; } while (cc > 0) { c = *bp++; cc--; incount++; fcode = ((long)c << BITS_MAX) + ent; h = (c << HSHIFT) ^ ent; /* xor hashing */ #ifdef _WINDOWS /* * Check hash index for an overflow. */ if (h >= HSIZE) h -= HSIZE; #endif hp = &sp->enc_hashtab[h]; if (hp->hash == fcode) { ent = hp->code; continue; } if (hp->hash >= 0) { /* * Primary hash failed, check secondary hash. */ disp = HSIZE - h; if (h == 0) disp = 1; do { /* * Avoid pointer arithmetic 'cuz of * wraparound problems with segments. */ if ((h -= disp) < 0) h += HSIZE; hp = &sp->enc_hashtab[h]; if (hp->hash == fcode) { ent = hp->code; goto hit; } } while (hp->hash >= 0); } /* * New entry, emit code and add to table. */ /* * Verify there is space in the buffer for the code * and any potential Clear code that might be emitted * below. The value of limit is setup so that there * are at least 4 bytes free--room for 2 codes. */ if (op > limit) { tif->tif_rawcc = (tsize_t)(op - tif->tif_rawdata); TIFFFlushData1(tif); op = tif->tif_rawdata; } PutNextCode(op, ent); ent = c; hp->code = free_ent++; hp->hash = fcode; if (free_ent == CODE_MAX-1) { /* table is full, emit clear code and reset */ cl_hash(sp); sp->enc_ratio = 0; incount = 0; outcount = 0; free_ent = CODE_FIRST; PutNextCode(op, CODE_CLEAR); nbits = BITS_MIN; maxcode = MAXCODE(BITS_MIN); } else { /* * If the next entry is going to be too big for * the code size, then increase it, if possible. */ if (free_ent > maxcode) { nbits++; assert(nbits <= BITS_MAX); maxcode = (int) MAXCODE(nbits); } else if (incount >= checkpoint) { long rat; /* * Check compression ratio and, if things seem * to be slipping, clear the hash table and * reset state. The compression ratio is a * 24+8-bit fractional number. */ checkpoint = incount+CHECK_GAP; CALCRATIO(sp, rat); if (rat <= sp->enc_ratio) { cl_hash(sp); sp->enc_ratio = 0; incount = 0; outcount = 0; free_ent = CODE_FIRST; PutNextCode(op, CODE_CLEAR); nbits = BITS_MIN; maxcode = MAXCODE(BITS_MIN); } else sp->enc_ratio = rat; } } hit: ; } /* * Restore global state. */ sp->enc_incount = incount; sp->enc_outcount = outcount; sp->enc_checkpoint = checkpoint; sp->enc_oldcode = ent; sp->lzw_nextdata = nextdata; sp->lzw_nextbits = nextbits; sp->lzw_free_ent = free_ent; sp->lzw_maxcode = maxcode; sp->lzw_nbits = nbits; tif->tif_rawcp = op; return (1); } /* * Finish off an encoded strip by flushing the last * string and tacking on an End Of Information code. */ static int LZWPostEncode(TIFF* tif) { register LZWCodecState *sp = EncoderState(tif); tidata_t op = tif->tif_rawcp; long nextbits = sp->lzw_nextbits; long nextdata = sp->lzw_nextdata; long outcount = sp->enc_outcount; int nbits = sp->lzw_nbits; if (op > sp->enc_rawlimit) { tif->tif_rawcc = (tsize_t)(op - tif->tif_rawdata); TIFFFlushData1(tif); op = tif->tif_rawdata; } if (sp->enc_oldcode != (hcode_t) -1) { PutNextCode(op, sp->enc_oldcode); sp->enc_oldcode = (hcode_t) -1; } PutNextCode(op, CODE_EOI); if (nextbits > 0) *op++ = (unsigned char)(nextdata << (8-nextbits)); tif->tif_rawcc = (tsize_t)(op - tif->tif_rawdata); return (1); } /* * Reset encoding hash table. */ static void cl_hash(LZWCodecState* sp) { register hash_t *hp = &sp->enc_hashtab[HSIZE-1]; register long i = HSIZE-8; do { i -= 8; hp[-7].hash = -1; hp[-6].hash = -1; hp[-5].hash = -1; hp[-4].hash = -1; hp[-3].hash = -1; hp[-2].hash = -1; hp[-1].hash = -1; hp[ 0].hash = -1; hp -= 8; } while (i >= 0); for (i += 8; i > 0; i--, hp--) hp->hash = -1; } static void LZWCleanup(TIFF* tif) { (void)TIFFPredictorCleanup(tif); assert(tif->tif_data != 0); if (DecoderState(tif)->dec_codetab) _TIFFfree(DecoderState(tif)->dec_codetab); if (EncoderState(tif)->enc_hashtab) _TIFFfree(EncoderState(tif)->enc_hashtab); _TIFFfree(tif->tif_data); tif->tif_data = NULL; _TIFFSetDefaultCompressionState(tif); } int TIFFInitLZW(TIFF* tif, int scheme) { assert(scheme == COMPRESSION_LZW); /* * Allocate state block so tag methods have storage to record values. */ tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (LZWCodecState)); if (tif->tif_data == NULL) goto bad; DecoderState(tif)->dec_codetab = NULL; DecoderState(tif)->dec_decode = NULL; EncoderState(tif)->enc_hashtab = NULL; LZWState(tif)->rw_mode = tif->tif_mode; /* * Install codec methods. */ tif->tif_setupdecode = LZWSetupDecode; tif->tif_predecode = LZWPreDecode; tif->tif_decoderow = LZWDecode; tif->tif_decodestrip = LZWDecode; tif->tif_decodetile = LZWDecode; tif->tif_setupencode = LZWSetupEncode; tif->tif_preencode = LZWPreEncode; tif->tif_postencode = LZWPostEncode; tif->tif_encoderow = LZWEncode; tif->tif_encodestrip = LZWEncode; tif->tif_encodetile = LZWEncode; tif->tif_cleanup = LZWCleanup; /* * Setup predictor setup. */ (void) TIFFPredictorInit(tif); return (1); bad: TIFFErrorExt(tif->tif_clientdata, "TIFFInitLZW", "No space for LZW state block"); return (0); } /* * Copyright (c) 1985, 1986 The Regents of the University of California. * All rights reserved. * * This code is derived from software contributed to Berkeley by * James A. Woods, derived from original work by Spencer Thomas * and Joseph Orost. * * Redistribution and use in source and binary forms are permitted * provided that the above copyright notice and this paragraph are * duplicated in all such forms and that any documentation, * advertising materials, and other materials related to such * distribution and use acknowledge that the software was developed * by the University of California, Berkeley. The name of the * University may not be used to endorse or promote products derived * from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ #endif /* LZW_SUPPORT */ /* vim: set ts=8 sts=8 sw=8 noet: */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_codec.c�������������������������������������������������0000644�0001750�0001750�00000011363�12320456500�021423� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_codec.c,v 1.10.2.1 2008-12-18 19:50:41 fwarmerdam Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library * * Builtin Compression Scheme Configuration Support. */ #include "tiffiop.h" static int NotConfigured(TIFF*, int); #ifndef LZW_SUPPORT #define TIFFInitLZW NotConfigured #endif #ifndef PACKBITS_SUPPORT #define TIFFInitPackBits NotConfigured #endif #ifndef THUNDER_SUPPORT #define TIFFInitThunderScan NotConfigured #endif #ifndef NEXT_SUPPORT #define TIFFInitNeXT NotConfigured #endif #ifndef JPEG_SUPPORT #define TIFFInitJPEG NotConfigured #endif #ifndef OJPEG_SUPPORT #define TIFFInitOJPEG NotConfigured #endif #ifndef CCITT_SUPPORT #define TIFFInitCCITTRLE NotConfigured #define TIFFInitCCITTRLEW NotConfigured #define TIFFInitCCITTFax3 NotConfigured #define TIFFInitCCITTFax4 NotConfigured #endif #ifndef JBIG_SUPPORT #define TIFFInitJBIG NotConfigured #endif #ifndef ZIP_SUPPORT #define TIFFInitZIP NotConfigured #endif #ifndef PIXARLOG_SUPPORT #define TIFFInitPixarLog NotConfigured #endif #ifndef LOGLUV_SUPPORT #define TIFFInitSGILog NotConfigured #endif /* * Compression schemes statically built into the library. */ #ifdef VMS const TIFFCodec _TIFFBuiltinCODECS[] = { #else TIFFCodec _TIFFBuiltinCODECS[] = { #endif { "None", COMPRESSION_NONE, TIFFInitDumpMode }, { "LZW", COMPRESSION_LZW, TIFFInitLZW }, { "PackBits", COMPRESSION_PACKBITS, TIFFInitPackBits }, { "ThunderScan", COMPRESSION_THUNDERSCAN,TIFFInitThunderScan }, { "NeXT", COMPRESSION_NEXT, TIFFInitNeXT }, { "JPEG", COMPRESSION_JPEG, TIFFInitJPEG }, { "Old-style JPEG", COMPRESSION_OJPEG, TIFFInitOJPEG }, { "CCITT RLE", COMPRESSION_CCITTRLE, TIFFInitCCITTRLE }, { "CCITT RLE/W", COMPRESSION_CCITTRLEW, TIFFInitCCITTRLEW }, { "CCITT Group 3", COMPRESSION_CCITTFAX3, TIFFInitCCITTFax3 }, { "CCITT Group 4", COMPRESSION_CCITTFAX4, TIFFInitCCITTFax4 }, { "ISO JBIG", COMPRESSION_JBIG, TIFFInitJBIG }, { "Deflate", COMPRESSION_DEFLATE, TIFFInitZIP }, { "AdobeDeflate", COMPRESSION_ADOBE_DEFLATE , TIFFInitZIP }, { "PixarLog", COMPRESSION_PIXARLOG, TIFFInitPixarLog }, { "SGILog", COMPRESSION_SGILOG, TIFFInitSGILog }, { "SGILog24", COMPRESSION_SGILOG24, TIFFInitSGILog }, { NULL, 0, NULL } }; static int _notConfigured(TIFF* tif) { const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression); char compression_code[20]; sprintf( compression_code, "%d", tif->tif_dir.td_compression ); TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%s compression support is not configured", c ? c->name : compression_code ); return (0); } static int NotConfigured(TIFF* tif, int scheme) { (void) scheme; tif->tif_decodestatus = FALSE; tif->tif_setupdecode = _notConfigured; tif->tif_encodestatus = FALSE; tif->tif_setupencode = _notConfigured; return (1); } /************************************************************************/ /* TIFFIsCODECConfigured() */ /************************************************************************/ /** * Check whether we have working codec for the specific coding scheme. * * @return returns 1 if the codec is configured and working. Otherwise * 0 will be returned. */ int TIFFIsCODECConfigured(uint16 scheme) { const TIFFCodec* codec = TIFFFindCODEC(scheme); if(codec == NULL) { return 0; } if(codec->init == NULL) { return 0; } if(codec->init != NotConfigured){ return 1; } return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_config.h������������������������������������������������0000644�0001750�0001750�00000015515�12320456500�021623� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* libtiff/tif_config.h. Generated by configure. */ /* libtiff/tif_config.h.in. Generated from configure.ac by autoheader. */ /* Support CCITT Group 3 & 4 algorithms */ #define CCITT_SUPPORT 1 /* Pick up YCbCr subsampling info from the JPEG data stream to support files lacking the tag (default enabled). */ #define CHECK_JPEG_YCBCR_SUBSAMPLING 1 /* Support C++ stream API (requires C++ compiler) */ #define CXX_SUPPORT 0 /* Treat extra sample as alpha (default enabled). The RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don't mark the alpha properly. */ #define DEFAULT_EXTRASAMPLE_AS_ALPHA 1 /* Use the Apple OpenGL framework. */ /* #undef HAVE_APPLE_OPENGL_FRAMEWORK */ /* Define to 1 if you have the <assert.h> header file. */ #define HAVE_ASSERT_H 1 /* Define to 1 if you have the <dlfcn.h> header file. */ #define HAVE_DLFCN_H 1 /* Define to 1 if you have the <fcntl.h> header file. */ #define HAVE_FCNTL_H 1 /* Define to 1 if you have the `floor' function. */ #define HAVE_FLOOR 1 /* Define to 1 if you have the `getopt' function. */ #define HAVE_GETOPT 1 /* Define to 1 if the system has the type `int16'. */ /* #undef HAVE_INT16 */ /* Define to 1 if the system has the type `int32'. */ /* #undef HAVE_INT32 */ /* Define to 1 if the system has the type `int8'. */ /* #undef HAVE_INT8 */ /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the `isascii' function. */ #define HAVE_ISASCII 1 /* Define to 1 if you have the `lfind' function. */ #define HAVE_LFIND 1 /* Define to 1 if you have the `c' library (-lc). */ #define HAVE_LIBC 1 /* Define to 1 if you have the `m' library (-lm). */ /* #undef HAVE_LIBM */ /* Define to 1 if you have the <limits.h> header file. */ #define HAVE_LIMITS_H 1 /* Define to 1 if you have the <malloc.h> header file. */ /* #undef HAVE_MALLOC_H */ /* Define to 1 if you have the `memmove' function. */ #define HAVE_MEMMOVE 1 /* Define to 1 if you have the <memory.h> header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the `memset' function. */ #define HAVE_MEMSET 1 /* Define to 1 if you have the `mmap' function. */ #define HAVE_MMAP 1 /* Define to 1 if you have the `pow' function. */ #define HAVE_POW 1 /* Define if you have POSIX threads libraries and header files. */ #define HAVE_PTHREAD 1 /* Define to 1 if you have the <search.h> header file. */ #define HAVE_SEARCH_H 1 /* Define to 1 if you have the `sqrt' function. */ #define HAVE_SQRT 1 /* Define to 1 if you have the <stdint.h> header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the `strcasecmp' function. */ #define HAVE_STRCASECMP 1 /* Define to 1 if you have the `strchr' function. */ #define HAVE_STRCHR 1 /* Define to 1 if you have the <strings.h> header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strrchr' function. */ #define HAVE_STRRCHR 1 /* Define to 1 if you have the `strstr' function. */ #define HAVE_STRSTR 1 /* Define to 1 if you have the `strtol' function. */ #define HAVE_STRTOL 1 /* Define to 1 if you have the `strtoul' function. */ #define HAVE_STRTOUL 1 /* Define to 1 if you have the <sys/stat.h> header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the <sys/time.h> header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have the <windows.h> header file. */ /* #undef HAVE_WINDOWS_H */ #ifdef _MSC_VER # define HAVE_WINDOWS_H #endif #define LOGLUV_SUPPORT 1 /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" /* Support LZW algorithm */ #define LZW_SUPPORT 1 /* Support Microsoft Document Imaging format */ #define MDI_SUPPORT 1 /* Support NeXT 2-bit RLE algorithm */ #define NEXT_SUPPORT 1 /* Define to 1 if your C compiler doesn't accept -c and -o together. */ /* #undef NO_MINUS_C_MINUS_O */ /* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation fails with unpatched IJG JPEG library) */ /* #undef OJPEG_SUPPORT */ /* Name of package */ #define PACKAGE "tiff" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "tiff@lists.maptools.org" /* Define to the full name of this package. */ #define PACKAGE_NAME "LibTIFF Software" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "LibTIFF Software 3.9.2" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "tiff" /* Define to the version of this package. */ #define PACKAGE_VERSION "3.9.2" /* Support Macintosh PackBits algorithm */ #define PACKBITS_SUPPORT 1 /* Support Pixar log-format algorithm (requires Zlib) */ #define PIXARLOG_SUPPORT 1 /* Define to necessary symbol if this constant uses a non-standard name on your system. */ /* #undef PTHREAD_CREATE_JOINABLE */ /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Support strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of specified size to reduce memory usage) */ #define STRIPCHOP_DEFAULT TIFF_STRIPCHOP /* Default size of the strip in bytes (when strip chopping enabled) */ #define STRIP_SIZE_DEFAULT 8192 /* Enable SubIFD tag (330) support */ #define SUBIFD_SUPPORT 1 /* Support ThunderScan 4-bit RLE algorithm */ #define THUNDER_SUPPORT 1 /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ #define TIME_WITH_SYS_TIME 1 /* Define to 1 if your <sys/time.h> declares `struct tm'. */ /* #undef TM_IN_SYS_TIME */ /* Version number of package */ #define VERSION "3.9.2" /* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ /* #undef WORDS_BIGENDIAN */ /* Define to 1 if the X Window System is missing or not being used. */ /* #undef X_DISPLAY_MISSING */ /* Support Deflate compression */ #define ZIP_SUPPORT 1 /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ /* Define for large files, on AIX-style hosts. */ /* #undef _LARGE_FILES */ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus /* #undef inline */ #endif /* Define to `long' if <sys/types.h> does not define. */ /* #undef off_t */ /* Define to `unsigned' if <sys/types.h> does not define. */ /* #undef size_t */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/README������������������������������������������������������0000644�0001750�0001750�00000004473�12320456500�020224� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������$Header: /cvs/maptools/cvsroot/libtiff/README,v 1.5 2004/10/30 13:44:45 dron Exp $ TIFF Software Distribution -------------------------- This file is just a placeholder; all the documentation is now in HTML in the html directory. To view the documentation point your favorite WWW viewer at html/index.html; e.g. netscape html/index.html If you don't have an HTML viewer then you can read the HTML source or fetch a PostScript version of this documentation from the directory ftp://ftp.remotesensing.org/pub/libtiff/ If you can't hack either of these options then basically what you want to do is: % ./configure % make % su # make install More information, email contacts, and mailing list information can be found online at http://www.remotesensing.org/libtiff/. Use and Copyright ----------------- Silicon Graphics has seen fit to allow us to give this work away. It is free. There is no support or guarantee of any sort as to its operations, correctness, or whatever. If you do anything useful with all or parts of it you need to honor the copyright notices. I would also be interested in knowing about it and, hopefully, be acknowledged. The legal way of saying that is: Copyright (c) 1988-1997 Sam Leffler Copyright (c) 1991-1997 Silicon Graphics, Inc. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that (i) the above copyright notices and this permission notice appear in all copies of the software and related documentation, and (ii) the names of Sam Leffler and Silicon Graphics may not be used in any advertising or publicity relating to the software without the specific, prior written permission of Sam Leffler and Silicon Graphics. THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_close.c�������������������������������������������������0000644�0001750�0001750�00000007013�12320456500�021450� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_close.c,v 1.10 2006/03/25 03:09:24 joris Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. */ #include "tiffiop.h" /************************************************************************/ /* TIFFCleanup() */ /************************************************************************/ /** * Auxiliary function to free the TIFF structure. Given structure will be * completetly freed, so you should save opened file handle and pointer * to the close procedure in external variables before calling * _TIFFCleanup(), if you will need these ones to close the file. * * @param tif A TIFF pointer. */ void TIFFCleanup(TIFF* tif) { if (tif->tif_mode != O_RDONLY) /* * Flush buffered data and directory (if dirty). */ TIFFFlush(tif); (*tif->tif_cleanup)(tif); TIFFFreeDirectory(tif); if (tif->tif_dirlist) _TIFFfree(tif->tif_dirlist); /* Clean up client info links */ while( tif->tif_clientinfo ) { TIFFClientInfoLink *link = tif->tif_clientinfo; tif->tif_clientinfo = link->next; _TIFFfree( link->name ); _TIFFfree( link ); } if (tif->tif_rawdata && (tif->tif_flags&TIFF_MYBUFFER)) _TIFFfree(tif->tif_rawdata); if (isMapped(tif)) TIFFUnmapFileContents(tif, tif->tif_base, tif->tif_size); /* Clean up custom fields */ if (tif->tif_nfields > 0) { size_t i; for (i = 0; i < tif->tif_nfields; i++) { TIFFFieldInfo *fld = tif->tif_fieldinfo[i]; if (fld->field_bit == FIELD_CUSTOM && strncmp("Tag ", fld->field_name, 4) == 0) { _TIFFfree(fld->field_name); _TIFFfree(fld); } } _TIFFfree(tif->tif_fieldinfo); } _TIFFfree(tif); } /************************************************************************/ /* TIFFClose() */ /************************************************************************/ /** * Close a previously opened TIFF file. * * TIFFClose closes a file that was previously opened with TIFFOpen(). * Any buffered data are flushed to the file, including the contents of * the current directory (if modified); and all resources are reclaimed. * * @param tif A TIFF pointer. */ void TIFFClose(TIFF* tif) { TIFFCloseProc closeproc = tif->tif_closeproc; thandle_t fd = tif->tif_clientdata; TIFFCleanup(tif); (void) (*closeproc)(fd); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_warning.c�����������������������������������������������0000644�0001750�0001750�00000004373�12320456500�022016� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_warning.c,v 1.2 2005/12/23 01:18:59 joris Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. */ #include "tiffiop.h" TIFFErrorHandlerExt _TIFFwarningHandlerExt = NULL; TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler handler) { TIFFErrorHandler prev = _TIFFwarningHandler; _TIFFwarningHandler = handler; return (prev); } TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt handler) { TIFFErrorHandlerExt prev = _TIFFwarningHandlerExt; _TIFFwarningHandlerExt = handler; return (prev); } void TIFFWarning(const char* module, const char* fmt, ...) { va_list ap; va_start(ap, fmt); if (_TIFFwarningHandler) (*_TIFFwarningHandler)(module, fmt, ap); if (_TIFFwarningHandlerExt) (*_TIFFwarningHandlerExt)(0, module, fmt, ap); va_end(ap); } void TIFFWarningExt(thandle_t fd, const char* module, const char* fmt, ...) { va_list ap; va_start(ap, fmt); if (_TIFFwarningHandler) (*_TIFFwarningHandler)(module, fmt, ap); if (_TIFFwarningHandlerExt) (*_TIFFwarningHandlerExt)(fd, module, fmt, ap); va_end(ap); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_strip.c�������������������������������������������������0000644�0001750�0001750�00000024361�12320456500�021511� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_strip.c,v 1.19 2006/03/25 18:04:35 joris Exp $ */ /* * Copyright (c) 1991-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * Strip-organized Image Support Routines. */ #include "tiffiop.h" static uint32 summarize(TIFF* tif, size_t summand1, size_t summand2, const char* where) { /* * XXX: We are using casting to uint32 here, bacause sizeof(size_t) * may be larger than sizeof(uint32) on 64-bit architectures. */ uint32 bytes = summand1 + summand2; if (bytes - summand1 != summand2) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Integer overflow in %s", where); bytes = 0; } return (bytes); } static uint32 multiply(TIFF* tif, size_t nmemb, size_t elem_size, const char* where) { uint32 bytes = nmemb * elem_size; if (elem_size && bytes / elem_size != nmemb) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Integer overflow in %s", where); bytes = 0; } return (bytes); } /* * Compute which strip a (row,sample) value is in. */ tstrip_t TIFFComputeStrip(TIFF* tif, uint32 row, tsample_t sample) { TIFFDirectory *td = &tif->tif_dir; tstrip_t strip; strip = row / td->td_rowsperstrip; if (td->td_planarconfig == PLANARCONFIG_SEPARATE) { if (sample >= td->td_samplesperpixel) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Sample out of range, max %lu", (unsigned long) sample, (unsigned long) td->td_samplesperpixel); return ((tstrip_t) 0); } strip += sample*td->td_stripsperimage; } return (strip); } /* * Compute how many strips are in an image. */ tstrip_t TIFFNumberOfStrips(TIFF* tif) { TIFFDirectory *td = &tif->tif_dir; tstrip_t nstrips; nstrips = (td->td_rowsperstrip == (uint32) -1 ? 1 : TIFFhowmany(td->td_imagelength, td->td_rowsperstrip)); if (td->td_planarconfig == PLANARCONFIG_SEPARATE) nstrips = multiply(tif, nstrips, td->td_samplesperpixel, "TIFFNumberOfStrips"); return (nstrips); } /* * Compute the # bytes in a variable height, row-aligned strip. */ tsize_t TIFFVStripSize(TIFF* tif, uint32 nrows) { TIFFDirectory *td = &tif->tif_dir; if (nrows == (uint32) -1) nrows = td->td_imagelength; if (td->td_planarconfig == PLANARCONFIG_CONTIG && td->td_photometric == PHOTOMETRIC_YCBCR && !isUpSampled(tif)) { /* * Packed YCbCr data contain one Cb+Cr for every * HorizontalSampling*VerticalSampling Y values. * Must also roundup width and height when calculating * since images that are not a multiple of the * horizontal/vertical subsampling area include * YCbCr data for the extended image. */ uint16 ycbcrsubsampling[2]; tsize_t w, scanline, samplingarea; TIFFGetField( tif, TIFFTAG_YCBCRSUBSAMPLING, ycbcrsubsampling + 0, ycbcrsubsampling + 1 ); samplingarea = ycbcrsubsampling[0]*ycbcrsubsampling[1]; if (samplingarea == 0) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Invalid YCbCr subsampling"); return 0; } w = TIFFroundup(td->td_imagewidth, ycbcrsubsampling[0]); scanline = TIFFhowmany8(multiply(tif, w, td->td_bitspersample, "TIFFVStripSize")); nrows = TIFFroundup(nrows, ycbcrsubsampling[1]); /* NB: don't need TIFFhowmany here 'cuz everything is rounded */ scanline = multiply(tif, nrows, scanline, "TIFFVStripSize"); return ((tsize_t) summarize(tif, scanline, multiply(tif, 2, scanline / samplingarea, "TIFFVStripSize"), "TIFFVStripSize")); } else return ((tsize_t) multiply(tif, nrows, TIFFScanlineSize(tif), "TIFFVStripSize")); } /* * Compute the # bytes in a raw strip. */ tsize_t TIFFRawStripSize(TIFF* tif, tstrip_t strip) { TIFFDirectory* td = &tif->tif_dir; tsize_t bytecount = td->td_stripbytecount[strip]; if (bytecount <= 0) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Invalid strip byte count, strip %lu", (unsigned long) bytecount, (unsigned long) strip); bytecount = (tsize_t) -1; } return bytecount; } /* * Compute the # bytes in a (row-aligned) strip. * * Note that if RowsPerStrip is larger than the * recorded ImageLength, then the strip size is * truncated to reflect the actual space required * to hold the strip. */ tsize_t TIFFStripSize(TIFF* tif) { TIFFDirectory* td = &tif->tif_dir; uint32 rps = td->td_rowsperstrip; if (rps > td->td_imagelength) rps = td->td_imagelength; return (TIFFVStripSize(tif, rps)); } /* * Compute a default strip size based on the image * characteristics and a requested value. If the * request is <1 then we choose a strip size according * to certain heuristics. */ uint32 TIFFDefaultStripSize(TIFF* tif, uint32 request) { return (*tif->tif_defstripsize)(tif, request); } uint32 _TIFFDefaultStripSize(TIFF* tif, uint32 s) { if ((int32) s < 1) { /* * If RowsPerStrip is unspecified, try to break the * image up into strips that are approximately * STRIP_SIZE_DEFAULT bytes long. */ tsize_t scanline = TIFFScanlineSize(tif); s = (uint32)STRIP_SIZE_DEFAULT / (scanline == 0 ? 1 : scanline); if (s == 0) /* very wide images */ s = 1; } return (s); } /* * Return the number of bytes to read/write in a call to * one of the scanline-oriented i/o routines. Note that * this number may be 1/samples-per-pixel if data is * stored as separate planes. */ tsize_t TIFFScanlineSize(TIFF* tif) { TIFFDirectory *td = &tif->tif_dir; tsize_t scanline; if (td->td_planarconfig == PLANARCONFIG_CONTIG) { if (td->td_photometric == PHOTOMETRIC_YCBCR && !isUpSampled(tif)) { uint16 ycbcrsubsampling[2]; TIFFGetField(tif, TIFFTAG_YCBCRSUBSAMPLING, ycbcrsubsampling + 0, ycbcrsubsampling + 1); if (ycbcrsubsampling[0] == 0) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Invalid YCbCr subsampling"); return 0; } scanline = TIFFroundup(td->td_imagewidth, ycbcrsubsampling[0]); scanline = TIFFhowmany8(multiply(tif, scanline, td->td_bitspersample, "TIFFScanlineSize")); return ((tsize_t) summarize(tif, scanline, multiply(tif, 2, scanline / ycbcrsubsampling[0], "TIFFVStripSize"), "TIFFVStripSize")); } else { scanline = multiply(tif, td->td_imagewidth, td->td_samplesperpixel, "TIFFScanlineSize"); } } else scanline = td->td_imagewidth; return ((tsize_t) TIFFhowmany8(multiply(tif, scanline, td->td_bitspersample, "TIFFScanlineSize"))); } /* * Some stuff depends on this older version of TIFFScanlineSize * TODO: resolve this */ tsize_t TIFFOldScanlineSize(TIFF* tif) { TIFFDirectory *td = &tif->tif_dir; tsize_t scanline; scanline = multiply (tif, td->td_bitspersample, td->td_imagewidth, "TIFFScanlineSize"); if (td->td_planarconfig == PLANARCONFIG_CONTIG) scanline = multiply (tif, scanline, td->td_samplesperpixel, "TIFFScanlineSize"); return ((tsize_t) TIFFhowmany8(scanline)); } /* * Return the number of bytes to read/write in a call to * one of the scanline-oriented i/o routines. Note that * this number may be 1/samples-per-pixel if data is * stored as separate planes. * The ScanlineSize in case of YCbCrSubsampling is defined as the * strip size divided by the strip height, i.e. the size of a pack of vertical * subsampling lines divided by vertical subsampling. It should thus make * sense when multiplied by a multiple of vertical subsampling. * Some stuff depends on this newer version of TIFFScanlineSize * TODO: resolve this */ tsize_t TIFFNewScanlineSize(TIFF* tif) { TIFFDirectory *td = &tif->tif_dir; tsize_t scanline; if (td->td_planarconfig == PLANARCONFIG_CONTIG) { if (td->td_photometric == PHOTOMETRIC_YCBCR && !isUpSampled(tif)) { uint16 ycbcrsubsampling[2]; TIFFGetField(tif, TIFFTAG_YCBCRSUBSAMPLING, ycbcrsubsampling + 0, ycbcrsubsampling + 1); if (ycbcrsubsampling[0]*ycbcrsubsampling[1] == 0) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Invalid YCbCr subsampling"); return 0; } return((tsize_t) ((((td->td_imagewidth+ycbcrsubsampling[0]-1) /ycbcrsubsampling[0]) *(ycbcrsubsampling[0]*ycbcrsubsampling[1]+2) *td->td_bitspersample+7) /8)/ycbcrsubsampling[1]); } else { scanline = multiply(tif, td->td_imagewidth, td->td_samplesperpixel, "TIFFScanlineSize"); } } else scanline = td->td_imagewidth; return ((tsize_t) TIFFhowmany8(multiply(tif, scanline, td->td_bitspersample, "TIFFScanlineSize"))); } /* * Return the number of bytes required to store a complete * decoded and packed raster scanline (as opposed to the * I/O size returned by TIFFScanlineSize which may be less * if data is store as separate planes). */ tsize_t TIFFRasterScanlineSize(TIFF* tif) { TIFFDirectory *td = &tif->tif_dir; tsize_t scanline; scanline = multiply (tif, td->td_bitspersample, td->td_imagewidth, "TIFFRasterScanlineSize"); if (td->td_planarconfig == PLANARCONFIG_CONTIG) { scanline = multiply (tif, scanline, td->td_samplesperpixel, "TIFFRasterScanlineSize"); return ((tsize_t) TIFFhowmany8(scanline)); } else return ((tsize_t) multiply (tif, TIFFhowmany8(scanline), td->td_samplesperpixel, "TIFFRasterScanlineSize")); } /* vim: set ts=8 sts=8 sw=8 noet: */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_fax3.h��������������������������������������������������0000644�0001750�0001750�00000036724�12320456500�021224� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_fax3.h,v 1.5 2005/12/12 09:23:11 dron Exp $ */ /* * Copyright (c) 1990-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _FAX3_ #define _FAX3_ /* * TIFF Library. * * CCITT Group 3 (T.4) and Group 4 (T.6) Decompression Support. * * Decoder support is derived, with permission, from the code * in Frank Cringle's viewfax program; * Copyright (C) 1990, 1995 Frank D. Cringle. */ #include "tiff.h" /* * To override the default routine used to image decoded * spans one can use the pseduo tag TIFFTAG_FAXFILLFUNC. * The routine must have the type signature given below; * for example: * * fillruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx) * * where buf is place to set the bits, runs is the array of b&w run * lengths (white then black), erun is the last run in the array, and * lastx is the width of the row in pixels. Fill routines can assume * the run array has room for at least lastx runs and can overwrite * data in the run array as needed (e.g. to append zero runs to bring * the count up to a nice multiple). */ typedef void (*TIFFFaxFillFunc)(unsigned char*, uint32*, uint32*, uint32); /* * The default run filler; made external for other decoders. */ #if defined(__cplusplus) extern "C" { #endif extern void _TIFFFax3fillruns(unsigned char*, uint32*, uint32*, uint32); #if defined(__cplusplus) } #endif /* finite state machine codes */ #define S_Null 0 #define S_Pass 1 #define S_Horiz 2 #define S_V0 3 #define S_VR 4 #define S_VL 5 #define S_Ext 6 #define S_TermW 7 #define S_TermB 8 #define S_MakeUpW 9 #define S_MakeUpB 10 #define S_MakeUp 11 #define S_EOL 12 typedef struct { /* state table entry */ unsigned char State; /* see above */ unsigned char Width; /* width of code in bits */ uint32 Param; /* unsigned 32-bit run length in bits */ } TIFFFaxTabEnt; extern const TIFFFaxTabEnt TIFFFaxMainTable[]; extern const TIFFFaxTabEnt TIFFFaxWhiteTable[]; extern const TIFFFaxTabEnt TIFFFaxBlackTable[]; /* * The following macros define the majority of the G3/G4 decoder * algorithm using the state tables defined elsewhere. To build * a decoder you need some setup code and some glue code. Note * that you may also need/want to change the way the NeedBits* * macros get input data if, for example, you know the data to be * decoded is properly aligned and oriented (doing so before running * the decoder can be a big performance win). * * Consult the decoder in the TIFF library for an idea of what you * need to define and setup to make use of these definitions. * * NB: to enable a debugging version of these macros define FAX3_DEBUG * before including this file. Trace output goes to stdout. */ #ifndef EndOfData #define EndOfData() (cp >= ep) #endif /* * Need <=8 or <=16 bits of input data. Unlike viewfax we * cannot use/assume a word-aligned, properly bit swizzled * input data set because data may come from an arbitrarily * aligned, read-only source such as a memory-mapped file. * Note also that the viewfax decoder does not check for * running off the end of the input data buffer. This is * possible for G3-encoded data because it prescans the input * data to count EOL markers, but can cause problems for G4 * data. In any event, we don't prescan and must watch for * running out of data since we can't permit the library to * scan past the end of the input data buffer. * * Finally, note that we must handle remaindered data at the end * of a strip specially. The coder asks for a fixed number of * bits when scanning for the next code. This may be more bits * than are actually present in the data stream. If we appear * to run out of data but still have some number of valid bits * remaining then we makeup the requested amount with zeros and * return successfully. If the returned data is incorrect then * we should be called again and get a premature EOF error; * otherwise we should get the right answer. */ #ifndef NeedBits8 #define NeedBits8(n,eoflab) do { \ if (BitsAvail < (n)) { \ if (EndOfData()) { \ if (BitsAvail == 0) /* no valid bits */ \ goto eoflab; \ BitsAvail = (n); /* pad with zeros */ \ } else { \ BitAcc |= ((uint32) bitmap[*cp++])<<BitsAvail; \ BitsAvail += 8; \ } \ } \ } while (0) #endif #ifndef NeedBits16 #define NeedBits16(n,eoflab) do { \ if (BitsAvail < (n)) { \ if (EndOfData()) { \ if (BitsAvail == 0) /* no valid bits */ \ goto eoflab; \ BitsAvail = (n); /* pad with zeros */ \ } else { \ BitAcc |= ((uint32) bitmap[*cp++])<<BitsAvail; \ if ((BitsAvail += 8) < (n)) { \ if (EndOfData()) { \ /* NB: we know BitsAvail is non-zero here */ \ BitsAvail = (n); /* pad with zeros */ \ } else { \ BitAcc |= ((uint32) bitmap[*cp++])<<BitsAvail; \ BitsAvail += 8; \ } \ } \ } \ } \ } while (0) #endif #define GetBits(n) (BitAcc & ((1<<(n))-1)) #define ClrBits(n) do { \ BitsAvail -= (n); \ BitAcc >>= (n); \ } while (0) #ifdef FAX3_DEBUG static const char* StateNames[] = { "Null ", "Pass ", "Horiz ", "V0 ", "VR ", "VL ", "Ext ", "TermW ", "TermB ", "MakeUpW", "MakeUpB", "MakeUp ", "EOL ", }; #define DEBUG_SHOW putchar(BitAcc & (1 << t) ? '1' : '0') #define LOOKUP8(wid,tab,eoflab) do { \ int t; \ NeedBits8(wid,eoflab); \ TabEnt = tab + GetBits(wid); \ printf("%08lX/%d: %s%5d\t", (long) BitAcc, BitsAvail, \ StateNames[TabEnt->State], TabEnt->Param); \ for (t = 0; t < TabEnt->Width; t++) \ DEBUG_SHOW; \ putchar('\n'); \ fflush(stdout); \ ClrBits(TabEnt->Width); \ } while (0) #define LOOKUP16(wid,tab,eoflab) do { \ int t; \ NeedBits16(wid,eoflab); \ TabEnt = tab + GetBits(wid); \ printf("%08lX/%d: %s%5d\t", (long) BitAcc, BitsAvail, \ StateNames[TabEnt->State], TabEnt->Param); \ for (t = 0; t < TabEnt->Width; t++) \ DEBUG_SHOW; \ putchar('\n'); \ fflush(stdout); \ ClrBits(TabEnt->Width); \ } while (0) #define SETVALUE(x) do { \ *pa++ = RunLength + (x); \ printf("SETVALUE: %d\t%d\n", RunLength + (x), a0); \ a0 += x; \ RunLength = 0; \ } while (0) #else #define LOOKUP8(wid,tab,eoflab) do { \ NeedBits8(wid,eoflab); \ TabEnt = tab + GetBits(wid); \ ClrBits(TabEnt->Width); \ } while (0) #define LOOKUP16(wid,tab,eoflab) do { \ NeedBits16(wid,eoflab); \ TabEnt = tab + GetBits(wid); \ ClrBits(TabEnt->Width); \ } while (0) /* * Append a run to the run length array for the * current row and reset decoding state. */ #define SETVALUE(x) do { \ *pa++ = RunLength + (x); \ a0 += (x); \ RunLength = 0; \ } while (0) #endif /* * Synchronize input decoding at the start of each * row by scanning for an EOL (if appropriate) and * skipping any trash data that might be present * after a decoding error. Note that the decoding * done elsewhere that recognizes an EOL only consumes * 11 consecutive zero bits. This means that if EOLcnt * is non-zero then we still need to scan for the final flag * bit that is part of the EOL code. */ #define SYNC_EOL(eoflab) do { \ if (EOLcnt == 0) { \ for (;;) { \ NeedBits16(11,eoflab); \ if (GetBits(11) == 0) \ break; \ ClrBits(1); \ } \ } \ for (;;) { \ NeedBits8(8,eoflab); \ if (GetBits(8)) \ break; \ ClrBits(8); \ } \ while (GetBits(1) == 0) \ ClrBits(1); \ ClrBits(1); /* EOL bit */ \ EOLcnt = 0; /* reset EOL counter/flag */ \ } while (0) /* * Cleanup the array of runs after decoding a row. * We adjust final runs to insure the user buffer is not * overwritten and/or undecoded area is white filled. */ #define CLEANUP_RUNS() do { \ if (RunLength) \ SETVALUE(0); \ if (a0 != lastx) { \ badlength(a0, lastx); \ while (a0 > lastx && pa > thisrun) \ a0 -= *--pa; \ if (a0 < lastx) { \ if (a0 < 0) \ a0 = 0; \ if ((pa-thisrun)&1) \ SETVALUE(0); \ SETVALUE(lastx - a0); \ } else if (a0 > lastx) { \ SETVALUE(lastx); \ SETVALUE(0); \ } \ } \ } while (0) /* * Decode a line of 1D-encoded data. * * The line expanders are written as macros so that they can be reused * but still have direct access to the local variables of the "calling" * function. * * Note that unlike the original version we have to explicitly test for * a0 >= lastx after each black/white run is decoded. This is because * the original code depended on the input data being zero-padded to * insure the decoder recognized an EOL before running out of data. */ #define EXPAND1D(eoflab) do { \ for (;;) { \ for (;;) { \ LOOKUP16(12, TIFFFaxWhiteTable, eof1d); \ switch (TabEnt->State) { \ case S_EOL: \ EOLcnt = 1; \ goto done1d; \ case S_TermW: \ SETVALUE(TabEnt->Param); \ goto doneWhite1d; \ case S_MakeUpW: \ case S_MakeUp: \ a0 += TabEnt->Param; \ RunLength += TabEnt->Param; \ break; \ default: \ unexpected("WhiteTable", a0); \ goto done1d; \ } \ } \ doneWhite1d: \ if (a0 >= lastx) \ goto done1d; \ for (;;) { \ LOOKUP16(13, TIFFFaxBlackTable, eof1d); \ switch (TabEnt->State) { \ case S_EOL: \ EOLcnt = 1; \ goto done1d; \ case S_TermB: \ SETVALUE(TabEnt->Param); \ goto doneBlack1d; \ case S_MakeUpB: \ case S_MakeUp: \ a0 += TabEnt->Param; \ RunLength += TabEnt->Param; \ break; \ default: \ unexpected("BlackTable", a0); \ goto done1d; \ } \ } \ doneBlack1d: \ if (a0 >= lastx) \ goto done1d; \ if( *(pa-1) == 0 && *(pa-2) == 0 ) \ pa -= 2; \ } \ eof1d: \ prematureEOF(a0); \ CLEANUP_RUNS(); \ goto eoflab; \ done1d: \ CLEANUP_RUNS(); \ } while (0) /* * Update the value of b1 using the array * of runs for the reference line. */ #define CHECK_b1 do { \ if (pa != thisrun) while (b1 <= a0 && b1 < lastx) { \ b1 += pb[0] + pb[1]; \ pb += 2; \ } \ } while (0) /* * Expand a row of 2D-encoded data. */ #define EXPAND2D(eoflab) do { \ while (a0 < lastx) { \ LOOKUP8(7, TIFFFaxMainTable, eof2d); \ switch (TabEnt->State) { \ case S_Pass: \ CHECK_b1; \ b1 += *pb++; \ RunLength += b1 - a0; \ a0 = b1; \ b1 += *pb++; \ break; \ case S_Horiz: \ if ((pa-thisrun)&1) { \ for (;;) { /* black first */ \ LOOKUP16(13, TIFFFaxBlackTable, eof2d); \ switch (TabEnt->State) { \ case S_TermB: \ SETVALUE(TabEnt->Param); \ goto doneWhite2da; \ case S_MakeUpB: \ case S_MakeUp: \ a0 += TabEnt->Param; \ RunLength += TabEnt->Param; \ break; \ default: \ goto badBlack2d; \ } \ } \ doneWhite2da:; \ for (;;) { /* then white */ \ LOOKUP16(12, TIFFFaxWhiteTable, eof2d); \ switch (TabEnt->State) { \ case S_TermW: \ SETVALUE(TabEnt->Param); \ goto doneBlack2da; \ case S_MakeUpW: \ case S_MakeUp: \ a0 += TabEnt->Param; \ RunLength += TabEnt->Param; \ break; \ default: \ goto badWhite2d; \ } \ } \ doneBlack2da:; \ } else { \ for (;;) { /* white first */ \ LOOKUP16(12, TIFFFaxWhiteTable, eof2d); \ switch (TabEnt->State) { \ case S_TermW: \ SETVALUE(TabEnt->Param); \ goto doneWhite2db; \ case S_MakeUpW: \ case S_MakeUp: \ a0 += TabEnt->Param; \ RunLength += TabEnt->Param; \ break; \ default: \ goto badWhite2d; \ } \ } \ doneWhite2db:; \ for (;;) { /* then black */ \ LOOKUP16(13, TIFFFaxBlackTable, eof2d); \ switch (TabEnt->State) { \ case S_TermB: \ SETVALUE(TabEnt->Param); \ goto doneBlack2db; \ case S_MakeUpB: \ case S_MakeUp: \ a0 += TabEnt->Param; \ RunLength += TabEnt->Param; \ break; \ default: \ goto badBlack2d; \ } \ } \ doneBlack2db:; \ } \ CHECK_b1; \ break; \ case S_V0: \ CHECK_b1; \ SETVALUE(b1 - a0); \ b1 += *pb++; \ break; \ case S_VR: \ CHECK_b1; \ SETVALUE(b1 - a0 + TabEnt->Param); \ b1 += *pb++; \ break; \ case S_VL: \ CHECK_b1; \ SETVALUE(b1 - a0 - TabEnt->Param); \ b1 -= *--pb; \ break; \ case S_Ext: \ *pa++ = lastx - a0; \ extension(a0); \ goto eol2d; \ case S_EOL: \ *pa++ = lastx - a0; \ NeedBits8(4,eof2d); \ if (GetBits(4)) \ unexpected("EOL", a0); \ ClrBits(4); \ EOLcnt = 1; \ goto eol2d; \ default: \ badMain2d: \ unexpected("MainTable", a0); \ goto eol2d; \ badBlack2d: \ unexpected("BlackTable", a0); \ goto eol2d; \ badWhite2d: \ unexpected("WhiteTable", a0); \ goto eol2d; \ eof2d: \ prematureEOF(a0); \ CLEANUP_RUNS(); \ goto eoflab; \ } \ } \ if (RunLength) { \ if (RunLength + a0 < lastx) { \ /* expect a final V0 */ \ NeedBits8(1,eof2d); \ if (!GetBits(1)) \ goto badMain2d; \ ClrBits(1); \ } \ SETVALUE(0); \ } \ eol2d: \ CLEANUP_RUNS(); \ } while (0) #endif /* _FAX3_ */ ��������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_version.c�����������������������������������������������0000644�0001750�0001750�00000002665�12320456500�022040� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_version.c,v 1.2 2000/11/13 14:42:38 warmerda Exp $ */ /* * Copyright (c) 1992-1997 Sam Leffler * Copyright (c) 1992-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "tiffiop.h" static const char TIFFVersion[] = TIFFLIB_VERSION_STR; const char* TIFFGetVersion(void) { return (TIFFVersion); } ���������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_error.c�������������������������������������������������0000644�0001750�0001750�00000004326�12320456500�021500� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_error.c,v 1.4 2005/12/23 01:18:59 joris Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. */ #include "tiffiop.h" TIFFErrorHandlerExt _TIFFerrorHandlerExt = NULL; TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler handler) { TIFFErrorHandler prev = _TIFFerrorHandler; _TIFFerrorHandler = handler; return (prev); } TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt handler) { TIFFErrorHandlerExt prev = _TIFFerrorHandlerExt; _TIFFerrorHandlerExt = handler; return (prev); } void TIFFError(const char* module, const char* fmt, ...) { va_list ap; va_start(ap, fmt); if (_TIFFerrorHandler) (*_TIFFerrorHandler)(module, fmt, ap); if (_TIFFerrorHandlerExt) (*_TIFFerrorHandlerExt)(0, module, fmt, ap); va_end(ap); } void TIFFErrorExt(thandle_t fd, const char* module, const char* fmt, ...) { va_list ap; va_start(ap, fmt); if (_TIFFerrorHandler) (*_TIFFerrorHandler)(module, fmt, ap); if (_TIFFerrorHandlerExt) (*_TIFFerrorHandlerExt)(fd, module, fmt, ap); va_end(ap); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/tiff/tif_fax3.c��������������������������������������������������0000644�0001750�0001750�00000130013�12320456500�021201� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tif_fax3.c,v 1.43.2.5 2009-01-01 00:10:43 bfriesen Exp $ */ /* * Copyright (c) 1990-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "tiffiop.h" #ifdef CCITT_SUPPORT /* * TIFF Library. * * CCITT Group 3 (T.4) and Group 4 (T.6) Compression Support. * * This file contains support for decoding and encoding TIFF * compression algorithms 2, 3, 4, and 32771. * * Decoder support is derived, with permission, from the code * in Frank Cringle's viewfax program; * Copyright (C) 1990, 1995 Frank D. Cringle. */ #include "tif_fax3.h" #define G3CODES #include "t4.h" #include <stdio.h> /* * Compression+decompression state blocks are * derived from this ``base state'' block. */ typedef struct { int rw_mode; /* O_RDONLY for decode, else encode */ int mode; /* operating mode */ uint32 rowbytes; /* bytes in a decoded scanline */ uint32 rowpixels; /* pixels in a scanline */ uint16 cleanfaxdata; /* CleanFaxData tag */ uint32 badfaxrun; /* BadFaxRun tag */ uint32 badfaxlines; /* BadFaxLines tag */ uint32 groupoptions; /* Group 3/4 options tag */ uint32 recvparams; /* encoded Class 2 session params */ char* subaddress; /* subaddress string */ uint32 recvtime; /* time spent receiving (secs) */ char* faxdcs; /* Table 2/T.30 encoded session params */ TIFFVGetMethod vgetparent; /* super-class method */ TIFFVSetMethod vsetparent; /* super-class method */ TIFFPrintMethod printdir; /* super-class method */ } Fax3BaseState; #define Fax3State(tif) ((Fax3BaseState*) (tif)->tif_data) typedef enum { G3_1D, G3_2D } Ttag; typedef struct { Fax3BaseState b; /* Decoder state info */ const unsigned char* bitmap; /* bit reversal table */ uint32 data; /* current i/o byte/word */ int bit; /* current i/o bit in byte */ int EOLcnt; /* count of EOL codes recognized */ TIFFFaxFillFunc fill; /* fill routine */ uint32* runs; /* b&w runs for current/previous row */ uint32* refruns; /* runs for reference line */ uint32* curruns; /* runs for current line */ /* Encoder state info */ Ttag tag; /* encoding state */ unsigned char* refline; /* reference line for 2d decoding */ int k; /* #rows left that can be 2d encoded */ int maxk; /* max #rows that can be 2d encoded */ int line; } Fax3CodecState; #define DecoderState(tif) ((Fax3CodecState*) Fax3State(tif)) #define EncoderState(tif) ((Fax3CodecState*) Fax3State(tif)) #define is2DEncoding(sp) \ (sp->b.groupoptions & GROUP3OPT_2DENCODING) #define isAligned(p,t) ((((unsigned long)(p)) & (sizeof (t)-1)) == 0) /* * Group 3 and Group 4 Decoding. */ /* * These macros glue the TIFF library state to * the state expected by Frank's decoder. */ #define DECLARE_STATE(tif, sp, mod) \ static const char module[] = mod; \ Fax3CodecState* sp = DecoderState(tif); \ int a0; /* reference element */ \ int lastx = sp->b.rowpixels; /* last element in row */ \ uint32 BitAcc; /* bit accumulator */ \ int BitsAvail; /* # valid bits in BitAcc */ \ int RunLength; /* length of current run */ \ unsigned char* cp; /* next byte of input data */ \ unsigned char* ep; /* end of input data */ \ uint32* pa; /* place to stuff next run */ \ uint32* thisrun; /* current row's run array */ \ int EOLcnt; /* # EOL codes recognized */ \ const unsigned char* bitmap = sp->bitmap; /* input data bit reverser */ \ const TIFFFaxTabEnt* TabEnt #define DECLARE_STATE_2D(tif, sp, mod) \ DECLARE_STATE(tif, sp, mod); \ int b1; /* next change on prev line */ \ uint32* pb /* next run in reference line */\ /* * Load any state that may be changed during decoding. */ #define CACHE_STATE(tif, sp) do { \ BitAcc = sp->data; \ BitsAvail = sp->bit; \ EOLcnt = sp->EOLcnt; \ cp = (unsigned char*) tif->tif_rawcp; \ ep = cp + tif->tif_rawcc; \ } while (0) /* * Save state possibly changed during decoding. */ #define UNCACHE_STATE(tif, sp) do { \ sp->bit = BitsAvail; \ sp->data = BitAcc; \ sp->EOLcnt = EOLcnt; \ tif->tif_rawcc -= (tidata_t) cp - tif->tif_rawcp; \ tif->tif_rawcp = (tidata_t) cp; \ } while (0) /* * Setup state for decoding a strip. */ static int Fax3PreDecode(TIFF* tif, tsample_t s) { Fax3CodecState* sp = DecoderState(tif); (void) s; assert(sp != NULL); sp->bit = 0; /* force initial read */ sp->data = 0; sp->EOLcnt = 0; /* force initial scan for EOL */ /* * Decoder assumes lsb-to-msb bit order. Note that we select * this here rather than in Fax3SetupState so that viewers can * hold the image open, fiddle with the FillOrder tag value, * and then re-decode the image. Otherwise they'd need to close * and open the image to get the state reset. */ sp->bitmap = TIFFGetBitRevTable(tif->tif_dir.td_fillorder != FILLORDER_LSB2MSB); if (sp->refruns) { /* init reference line to white */ sp->refruns[0] = (uint32) sp->b.rowpixels; sp->refruns[1] = 0; } sp->line = 0; return (1); } /* * Routine for handling various errors/conditions. * Note how they are "glued into the decoder" by * overriding the definitions used by the decoder. */ static void Fax3Unexpected(const char* module, TIFF* tif, uint32 line, uint32 a0) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Bad code word at line %u of %s %u (x %u)", tif->tif_name, line, isTiled(tif) ? "tile" : "strip", (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip), a0); } #define unexpected(table, a0) Fax3Unexpected(module, tif, sp->line, a0) static void Fax3Extension(const char* module, TIFF* tif, uint32 line, uint32 a0) { TIFFErrorExt(tif->tif_clientdata, module, "%s: Uncompressed data (not supported) at line %u of %s %u (x %u)", tif->tif_name, line, isTiled(tif) ? "tile" : "strip", (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip), a0); } #define extension(a0) Fax3Extension(module, tif, sp->line, a0) static void Fax3BadLength(const char* module, TIFF* tif, uint32 line, uint32 a0, uint32 lastx) { TIFFWarningExt(tif->tif_clientdata, module, "%s: %s at line %u of %s %u (got %u, expected %u)", tif->tif_name, a0 < lastx ? "Premature EOL" : "Line length mismatch", line, isTiled(tif) ? "tile" : "strip", (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip), a0, lastx); } #define badlength(a0,lastx) Fax3BadLength(module, tif, sp->line, a0, lastx) static void Fax3PrematureEOF(const char* module, TIFF* tif, uint32 line, uint32 a0) { TIFFWarningExt(tif->tif_clientdata, module, "%s: Premature EOF at line %u of %s %u (x %u)", tif->tif_name, line, isTiled(tif) ? "tile" : "strip", (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip), a0); } #define prematureEOF(a0) Fax3PrematureEOF(module, tif, sp->line, a0) #define Nop /* * Decode the requested amount of G3 1D-encoded data. */ static int Fax3Decode1D(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s) { DECLARE_STATE(tif, sp, "Fax3Decode1D"); (void) s; CACHE_STATE(tif, sp); thisrun = sp->curruns; while ((long)occ > 0) { a0 = 0; RunLength = 0; pa = thisrun; #ifdef FAX3_DEBUG printf("\nBitAcc=%08X, BitsAvail = %d\n", BitAcc, BitsAvail); printf("-------------------- %d\n", tif->tif_row); fflush(stdout); #endif SYNC_EOL(EOF1D); EXPAND1D(EOF1Da); (*sp->fill)(buf, thisrun, pa, lastx); buf += sp->b.rowbytes; occ -= sp->b.rowbytes; sp->line++; continue; EOF1D: /* premature EOF */ CLEANUP_RUNS(); EOF1Da: /* premature EOF */ (*sp->fill)(buf, thisrun, pa, lastx); UNCACHE_STATE(tif, sp); return (-1); } UNCACHE_STATE(tif, sp); return (1); } #define SWAP(t,a,b) { t x; x = (a); (a) = (b); (b) = x; } /* * Decode the requested amount of G3 2D-encoded data. */ static int Fax3Decode2D(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s) { DECLARE_STATE_2D(tif, sp, "Fax3Decode2D"); int is1D; /* current line is 1d/2d-encoded */ (void) s; CACHE_STATE(tif, sp); while ((long)occ > 0) { a0 = 0; RunLength = 0; pa = thisrun = sp->curruns; #ifdef FAX3_DEBUG printf("\nBitAcc=%08X, BitsAvail = %d EOLcnt = %d", BitAcc, BitsAvail, EOLcnt); #endif SYNC_EOL(EOF2D); NeedBits8(1, EOF2D); is1D = GetBits(1); /* 1D/2D-encoding tag bit */ ClrBits(1); #ifdef FAX3_DEBUG printf(" %s\n-------------------- %d\n", is1D ? "1D" : "2D", tif->tif_row); fflush(stdout); #endif pb = sp->refruns; b1 = *pb++; if (is1D) EXPAND1D(EOF2Da); else EXPAND2D(EOF2Da); (*sp->fill)(buf, thisrun, pa, lastx); SETVALUE(0); /* imaginary change for reference */ SWAP(uint32*, sp->curruns, sp->refruns); buf += sp->b.rowbytes; occ -= sp->b.rowbytes; sp->line++; continue; EOF2D: /* premature EOF */ CLEANUP_RUNS(); EOF2Da: /* premature EOF */ (*sp->fill)(buf, thisrun, pa, lastx); UNCACHE_STATE(tif, sp); return (-1); } UNCACHE_STATE(tif, sp); return (1); } #undef SWAP /* * The ZERO & FILL macros must handle spans < 2*sizeof(long) bytes. * For machines with 64-bit longs this is <16 bytes; otherwise * this is <8 bytes. We optimize the code here to reflect the * machine characteristics. */ #if SIZEOF_LONG == 8 # define FILL(n, cp) \ switch (n) { \ case 15:(cp)[14] = 0xff; case 14:(cp)[13] = 0xff; case 13: (cp)[12] = 0xff;\ case 12:(cp)[11] = 0xff; case 11:(cp)[10] = 0xff; case 10: (cp)[9] = 0xff;\ case 9: (cp)[8] = 0xff; case 8: (cp)[7] = 0xff; case 7: (cp)[6] = 0xff;\ case 6: (cp)[5] = 0xff; case 5: (cp)[4] = 0xff; case 4: (cp)[3] = 0xff;\ case 3: (cp)[2] = 0xff; case 2: (cp)[1] = 0xff; \ case 1: (cp)[0] = 0xff; (cp) += (n); case 0: ; \ } # define ZERO(n, cp) \ switch (n) { \ case 15:(cp)[14] = 0; case 14:(cp)[13] = 0; case 13: (cp)[12] = 0; \ case 12:(cp)[11] = 0; case 11:(cp)[10] = 0; case 10: (cp)[9] = 0; \ case 9: (cp)[8] = 0; case 8: (cp)[7] = 0; case 7: (cp)[6] = 0; \ case 6: (cp)[5] = 0; case 5: (cp)[4] = 0; case 4: (cp)[3] = 0; \ case 3: (cp)[2] = 0; case 2: (cp)[1] = 0; \ case 1: (cp)[0] = 0; (cp) += (n); case 0: ; \ } #else # define FILL(n, cp) \ switch (n) { \ case 7: (cp)[6] = 0xff; case 6: (cp)[5] = 0xff; case 5: (cp)[4] = 0xff; \ case 4: (cp)[3] = 0xff; case 3: (cp)[2] = 0xff; case 2: (cp)[1] = 0xff; \ case 1: (cp)[0] = 0xff; (cp) += (n); case 0: ; \ } # define ZERO(n, cp) \ switch (n) { \ case 7: (cp)[6] = 0; case 6: (cp)[5] = 0; case 5: (cp)[4] = 0; \ case 4: (cp)[3] = 0; case 3: (cp)[2] = 0; case 2: (cp)[1] = 0; \ case 1: (cp)[0] = 0; (cp) += (n); case 0: ; \ } #endif /* * Bit-fill a row according to the white/black * runs generated during G3/G4 decoding. */ void _TIFFFax3fillruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx) { static const unsigned char _fillmasks[] = { 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff }; unsigned char* cp; uint32 x, bx, run; int32 n, nw; long* lp; if ((erun-runs)&1) *erun++ = 0; x = 0; for (; runs < erun; runs += 2) { run = runs[0]; if (x+run > lastx || run > lastx ) run = runs[0] = (uint32) (lastx - x); if (run) { cp = buf + (x>>3); bx = x&7; if (run > 8-bx) { if (bx) { /* align to byte boundary */ *cp++ &= 0xff << (8-bx); run -= 8-bx; } if( (n = run >> 3) != 0 ) { /* multiple bytes to fill */ if ((n/sizeof (long)) > 1) { /* * Align to longword boundary and fill. */ for (; n && !isAligned(cp, long); n--) *cp++ = 0x00; lp = (long*) cp; nw = (int32)(n / sizeof (long)); n -= nw * sizeof (long); do { *lp++ = 0L; } while (--nw); cp = (unsigned char*) lp; } ZERO(n, cp); run &= 7; } if (run) cp[0] &= 0xff >> run; } else cp[0] &= ~(_fillmasks[run]>>bx); x += runs[0]; } run = runs[1]; if (x+run > lastx || run > lastx ) run = runs[1] = lastx - x; if (run) { cp = buf + (x>>3); bx = x&7; if (run > 8-bx) { if (bx) { /* align to byte boundary */ *cp++ |= 0xff >> bx; run -= 8-bx; } if( (n = run>>3) != 0 ) { /* multiple bytes to fill */ if ((n/sizeof (long)) > 1) { /* * Align to longword boundary and fill. */ for (; n && !isAligned(cp, long); n--) *cp++ = 0xff; lp = (long*) cp; nw = (int32)(n / sizeof (long)); n -= nw * sizeof (long); do { *lp++ = -1L; } while (--nw); cp = (unsigned char*) lp; } FILL(n, cp); run &= 7; } if (run) cp[0] |= 0xff00 >> run; } else cp[0] |= _fillmasks[run]>>bx; x += runs[1]; } } assert(x == lastx); } #undef ZERO #undef FILL /* * Setup G3/G4-related compression/decompression state * before data is processed. This routine is called once * per image -- it sets up different state based on whether * or not decoding or encoding is being done and whether * 1D- or 2D-encoded data is involved. */ static int Fax3SetupState(TIFF* tif) { TIFFDirectory* td = &tif->tif_dir; Fax3BaseState* sp = Fax3State(tif); int needsRefLine; Fax3CodecState* dsp = (Fax3CodecState*) Fax3State(tif); uint32 rowbytes, rowpixels, nruns; if (td->td_bitspersample != 1) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Bits/sample must be 1 for Group 3/4 encoding/decoding"); return (0); } /* * Calculate the scanline/tile widths. */ if (isTiled(tif)) { rowbytes = TIFFTileRowSize(tif); rowpixels = td->td_tilewidth; } else { rowbytes = TIFFScanlineSize(tif); rowpixels = td->td_imagewidth; } sp->rowbytes = (uint32) rowbytes; sp->rowpixels = (uint32) rowpixels; /* * Allocate any additional space required for decoding/encoding. */ needsRefLine = ( (sp->groupoptions & GROUP3OPT_2DENCODING) || td->td_compression == COMPRESSION_CCITTFAX4 ); nruns = needsRefLine ? 2*TIFFroundup(rowpixels,32) : rowpixels; nruns += 3; dsp->runs = (uint32*) _TIFFCheckMalloc(tif, 2*nruns, sizeof (uint32), "for Group 3/4 run arrays"); if (dsp->runs == NULL) return (0); dsp->curruns = dsp->runs; if (needsRefLine) dsp->refruns = dsp->runs + nruns; else dsp->refruns = NULL; if (td->td_compression == COMPRESSION_CCITTFAX3 && is2DEncoding(dsp)) { /* NB: default is 1D routine */ tif->tif_decoderow = Fax3Decode2D; tif->tif_decodestrip = Fax3Decode2D; tif->tif_decodetile = Fax3Decode2D; } if (needsRefLine) { /* 2d encoding */ Fax3CodecState* esp = EncoderState(tif); /* * 2d encoding requires a scanline * buffer for the ``reference line''; the * scanline against which delta encoding * is referenced. The reference line must * be initialized to be ``white'' (done elsewhere). */ esp->refline = (unsigned char*) _TIFFmalloc(rowbytes); if (esp->refline == NULL) { TIFFErrorExt(tif->tif_clientdata, "Fax3SetupState", "%s: No space for Group 3/4 reference line", tif->tif_name); return (0); } } else /* 1d encoding */ EncoderState(tif)->refline = NULL; return (1); } /* * CCITT Group 3 FAX Encoding. */ #define Fax3FlushBits(tif, sp) { \ if ((tif)->tif_rawcc >= (tif)->tif_rawdatasize) \ (void) TIFFFlushData1(tif); \ *(tif)->tif_rawcp++ = (tidataval_t) (sp)->data; \ (tif)->tif_rawcc++; \ (sp)->data = 0, (sp)->bit = 8; \ } #define _FlushBits(tif) { \ if ((tif)->tif_rawcc >= (tif)->tif_rawdatasize) \ (void) TIFFFlushData1(tif); \ *(tif)->tif_rawcp++ = (tidataval_t) data; \ (tif)->tif_rawcc++; \ data = 0, bit = 8; \ } static const int _msbmask[9] = { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff }; #define _PutBits(tif, bits, length) { \ while (length > bit) { \ data |= bits >> (length - bit); \ length -= bit; \ _FlushBits(tif); \ } \ data |= (bits & _msbmask[length]) << (bit - length); \ bit -= length; \ if (bit == 0) \ _FlushBits(tif); \ } /* * Write a variable-length bit-value to * the output stream. Values are * assumed to be at most 16 bits. */ static void Fax3PutBits(TIFF* tif, unsigned int bits, unsigned int length) { Fax3CodecState* sp = EncoderState(tif); unsigned int bit = sp->bit; int data = sp->data; _PutBits(tif, bits, length); sp->data = data; sp->bit = bit; } /* * Write a code to the output stream. */ #define putcode(tif, te) Fax3PutBits(tif, (te)->code, (te)->length) #ifdef FAX3_DEBUG #define DEBUG_COLOR(w) (tab == TIFFFaxWhiteCodes ? w "W" : w "B") #define DEBUG_PRINT(what,len) { \ int t; \ printf("%08X/%-2d: %s%5d\t", data, bit, DEBUG_COLOR(what), len); \ for (t = length-1; t >= 0; t--) \ putchar(code & (1<<t) ? '1' : '0'); \ putchar('\n'); \ } #endif /* * Write the sequence of codes that describes * the specified span of zero's or one's. The * appropriate table that holds the make-up and * terminating codes is supplied. */ static void putspan(TIFF* tif, int32 span, const tableentry* tab) { Fax3CodecState* sp = EncoderState(tif); unsigned int bit = sp->bit; int data = sp->data; unsigned int code, length; while (span >= 2624) { const tableentry* te = &tab[63 + (2560>>6)]; code = te->code, length = te->length; #ifdef FAX3_DEBUG DEBUG_PRINT("MakeUp", te->runlen); #endif _PutBits(tif, code, length); span -= te->runlen; } if (span >= 64) { const tableentry* te = &tab[63 + (span>>6)]; assert(te->runlen == 64*(span>>6)); code = te->code, length = te->length; #ifdef FAX3_DEBUG DEBUG_PRINT("MakeUp", te->runlen); #endif _PutBits(tif, code, length); span -= te->runlen; } code = tab[span].code, length = tab[span].length; #ifdef FAX3_DEBUG DEBUG_PRINT(" Term", tab[span].runlen); #endif _PutBits(tif, code, length); sp->data = data; sp->bit = bit; } /* * Write an EOL code to the output stream. The zero-fill * logic for byte-aligning encoded scanlines is handled * here. We also handle writing the tag bit for the next * scanline when doing 2d encoding. */ static void Fax3PutEOL(TIFF* tif) { Fax3CodecState* sp = EncoderState(tif); unsigned int bit = sp->bit; int data = sp->data; unsigned int code, length, tparm; if (sp->b.groupoptions & GROUP3OPT_FILLBITS) { /* * Force bit alignment so EOL will terminate on * a byte boundary. That is, force the bit alignment * to 16-12 = 4 before putting out the EOL code. */ int align = 8 - 4; if (align != sp->bit) { if (align > sp->bit) align = sp->bit + (8 - align); else align = sp->bit - align; code = 0; tparm=align; _PutBits(tif, 0, tparm); } } code = EOL, length = 12; if (is2DEncoding(sp)) code = (code<<1) | (sp->tag == G3_1D), length++; _PutBits(tif, code, length); sp->data = data; sp->bit = bit; } /* * Reset encoding state at the start of a strip. */ static int Fax3PreEncode(TIFF* tif, tsample_t s) { Fax3CodecState* sp = EncoderState(tif); (void) s; assert(sp != NULL); sp->bit = 8; sp->data = 0; sp->tag = G3_1D; /* * This is necessary for Group 4; otherwise it isn't * needed because the first scanline of each strip ends * up being copied into the refline. */ if (sp->refline) _TIFFmemset(sp->refline, 0x00, sp->b.rowbytes); if (is2DEncoding(sp)) { float res = tif->tif_dir.td_yresolution; /* * The CCITT spec says that when doing 2d encoding, you * should only do it on K consecutive scanlines, where K * depends on the resolution of the image being encoded * (2 for <= 200 lpi, 4 for > 200 lpi). Since the directory * code initializes td_yresolution to 0, this code will * select a K of 2 unless the YResolution tag is set * appropriately. (Note also that we fudge a little here * and use 150 lpi to avoid problems with units conversion.) */ if (tif->tif_dir.td_resolutionunit == RESUNIT_CENTIMETER) res *= 2.54f; /* convert to inches */ sp->maxk = (res > 150 ? 4 : 2); sp->k = sp->maxk-1; } else sp->k = sp->maxk = 0; sp->line = 0; return (1); } static const unsigned char zeroruns[256] = { 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 0x00 - 0x0f */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x10 - 0x1f */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x20 - 0x2f */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x30 - 0x3f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x40 - 0x4f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x50 - 0x5f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x60 - 0x6f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x70 - 0x7f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 - 0x8f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 - 0x9f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0 - 0xaf */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xb0 - 0xbf */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xc0 - 0xcf */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xd0 - 0xdf */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xe0 - 0xef */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xf0 - 0xff */ }; static const unsigned char oneruns[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 - 0x0f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 - 0x1f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 - 0x2f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 - 0x3f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 - 0x4f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 - 0x5f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x6f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 - 0x7f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x80 - 0x8f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x90 - 0x9f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xa0 - 0xaf */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xb0 - 0xbf */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0xc0 - 0xcf */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0xd0 - 0xdf */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xe0 - 0xef */ 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 8, /* 0xf0 - 0xff */ }; /* * On certain systems it pays to inline * the routines that find pixel spans. */ #ifdef VAXC static int32 find0span(unsigned char*, int32, int32); static int32 find1span(unsigned char*, int32, int32); #pragma inline(find0span,find1span) #endif /* * Find a span of ones or zeros using the supplied * table. The ``base'' of the bit string is supplied * along with the start+end bit indices. */ static int32 find0span(unsigned char* bp, int32 bs, int32 be) { int32 bits = be - bs; int32 n, span; bp += bs>>3; /* * Check partial byte on lhs. */ if (bits > 0 && (n = (bs & 7))) { span = zeroruns[(*bp << n) & 0xff]; if (span > 8-n) /* table value too generous */ span = 8-n; if (span > bits) /* constrain span to bit range */ span = bits; if (n+span < 8) /* doesn't extend to edge of byte */ return (span); bits -= span; bp++; } else span = 0; if (bits >= (int32)(2 * 8 * sizeof(long))) { long* lp; /* * Align to longword boundary and check longwords. */ while (!isAligned(bp, long)) { if (*bp != 0x00) return (span + zeroruns[*bp]); span += 8, bits -= 8; bp++; } lp = (long*) bp; while ((bits >= (int32)(8 * sizeof(long))) && (0 == *lp)) { span += 8*sizeof (long), bits -= 8*sizeof (long); lp++; } bp = (unsigned char*) lp; } /* * Scan full bytes for all 0's. */ while (bits >= 8) { if (*bp != 0x00) /* end of run */ return (span + zeroruns[*bp]); span += 8, bits -= 8; bp++; } /* * Check partial byte on rhs. */ if (bits > 0) { n = zeroruns[*bp]; span += (n > bits ? bits : n); } return (span); } static int32 find1span(unsigned char* bp, int32 bs, int32 be) { int32 bits = be - bs; int32 n, span; bp += bs>>3; /* * Check partial byte on lhs. */ if (bits > 0 && (n = (bs & 7))) { span = oneruns[(*bp << n) & 0xff]; if (span > 8-n) /* table value too generous */ span = 8-n; if (span > bits) /* constrain span to bit range */ span = bits; if (n+span < 8) /* doesn't extend to edge of byte */ return (span); bits -= span; bp++; } else span = 0; if (bits >= (int32)(2 * 8 * sizeof(long))) { long* lp; /* * Align to longword boundary and check longwords. */ while (!isAligned(bp, long)) { if (*bp != 0xff) return (span + oneruns[*bp]); span += 8, bits -= 8; bp++; } lp = (long*) bp; while ((bits >= (int32)(8 * sizeof(long))) && (~0 == *lp)) { span += 8*sizeof (long), bits -= 8*sizeof (long); lp++; } bp = (unsigned char*) lp; } /* * Scan full bytes for all 1's. */ while (bits >= 8) { if (*bp != 0xff) /* end of run */ return (span + oneruns[*bp]); span += 8, bits -= 8; bp++; } /* * Check partial byte on rhs. */ if (bits > 0) { n = oneruns[*bp]; span += (n > bits ? bits : n); } return (span); } /* * Return the offset of the next bit in the range * [bs..be] that is different from the specified * color. The end, be, is returned if no such bit * exists. */ #define finddiff(_cp, _bs, _be, _color) \ (_bs + (_color ? find1span(_cp,_bs,_be) : find0span(_cp,_bs,_be))) /* * Like finddiff, but also check the starting bit * against the end in case start > end. */ #define finddiff2(_cp, _bs, _be, _color) \ (_bs < _be ? finddiff(_cp,_bs,_be,_color) : _be) /* * 1d-encode a row of pixels. The encoding is * a sequence of all-white or all-black spans * of pixels encoded with Huffman codes. */ static int Fax3Encode1DRow(TIFF* tif, unsigned char* bp, uint32 bits) { Fax3CodecState* sp = EncoderState(tif); int32 span; uint32 bs = 0; for (;;) { span = find0span(bp, bs, bits); /* white span */ putspan(tif, span, TIFFFaxWhiteCodes); bs += span; if (bs >= bits) break; span = find1span(bp, bs, bits); /* black span */ putspan(tif, span, TIFFFaxBlackCodes); bs += span; if (bs >= bits) break; } if (sp->b.mode & (FAXMODE_BYTEALIGN|FAXMODE_WORDALIGN)) { if (sp->bit != 8) /* byte-align */ Fax3FlushBits(tif, sp); if ((sp->b.mode&FAXMODE_WORDALIGN) && !isAligned(tif->tif_rawcp, uint16)) Fax3FlushBits(tif, sp); } return (1); } static const tableentry horizcode = { 3, 0x1, 0 }; /* 001 */ static const tableentry passcode = { 4, 0x1, 0 }; /* 0001 */ static const tableentry vcodes[7] = { { 7, 0x03, 0 }, /* 0000 011 */ { 6, 0x03, 0 }, /* 0000 11 */ { 3, 0x03, 0 }, /* 011 */ { 1, 0x1, 0 }, /* 1 */ { 3, 0x2, 0 }, /* 010 */ { 6, 0x02, 0 }, /* 0000 10 */ { 7, 0x02, 0 } /* 0000 010 */ }; /* * 2d-encode a row of pixels. Consult the CCITT * documentation for the algorithm. */ static int Fax3Encode2DRow(TIFF* tif, unsigned char* bp, unsigned char* rp, uint32 bits) { #define PIXEL(buf,ix) ((((buf)[(ix)>>3]) >> (7-((ix)&7))) & 1) uint32 a0 = 0; uint32 a1 = (PIXEL(bp, 0) != 0 ? 0 : finddiff(bp, 0, bits, 0)); uint32 b1 = (PIXEL(rp, 0) != 0 ? 0 : finddiff(rp, 0, bits, 0)); uint32 a2, b2; for (;;) { b2 = finddiff2(rp, b1, bits, PIXEL(rp,b1)); if (b2 >= a1) { int32 d = b1 - a1; if (!(-3 <= d && d <= 3)) { /* horizontal mode */ a2 = finddiff2(bp, a1, bits, PIXEL(bp,a1)); putcode(tif, &horizcode); if (a0+a1 == 0 || PIXEL(bp, a0) == 0) { putspan(tif, a1-a0, TIFFFaxWhiteCodes); putspan(tif, a2-a1, TIFFFaxBlackCodes); } else { putspan(tif, a1-a0, TIFFFaxBlackCodes); putspan(tif, a2-a1, TIFFFaxWhiteCodes); } a0 = a2; } else { /* vertical mode */ putcode(tif, &vcodes[d+3]); a0 = a1; } } else { /* pass mode */ putcode(tif, &passcode); a0 = b2; } if (a0 >= bits) break; a1 = finddiff(bp, a0, bits, PIXEL(bp,a0)); b1 = finddiff(rp, a0, bits, !PIXEL(bp,a0)); b1 = finddiff(rp, b1, bits, PIXEL(bp,a0)); } return (1); #undef PIXEL } /* * Encode a buffer of pixels. */ static int Fax3Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) { Fax3CodecState* sp = EncoderState(tif); (void) s; while ((long)cc > 0) { if ((sp->b.mode & FAXMODE_NOEOL) == 0) Fax3PutEOL(tif); if (is2DEncoding(sp)) { if (sp->tag == G3_1D) { if (!Fax3Encode1DRow(tif, bp, sp->b.rowpixels)) return (0); sp->tag = G3_2D; } else { if (!Fax3Encode2DRow(tif, bp, sp->refline, sp->b.rowpixels)) return (0); sp->k--; } if (sp->k == 0) { sp->tag = G3_1D; sp->k = sp->maxk-1; } else _TIFFmemcpy(sp->refline, bp, sp->b.rowbytes); } else { if (!Fax3Encode1DRow(tif, bp, sp->b.rowpixels)) return (0); } bp += sp->b.rowbytes; cc -= sp->b.rowbytes; } return (1); } static int Fax3PostEncode(TIFF* tif) { Fax3CodecState* sp = EncoderState(tif); if (sp->bit != 8) Fax3FlushBits(tif, sp); return (1); } static void Fax3Close(TIFF* tif) { if ((Fax3State(tif)->mode & FAXMODE_NORTC) == 0) { Fax3CodecState* sp = EncoderState(tif); unsigned int code = EOL; unsigned int length = 12; int i; if (is2DEncoding(sp)) code = (code<<1) | (sp->tag == G3_1D), length++; for (i = 0; i < 6; i++) Fax3PutBits(tif, code, length); Fax3FlushBits(tif, sp); } } static void Fax3Cleanup(TIFF* tif) { Fax3CodecState* sp = DecoderState(tif); assert(sp != 0); tif->tif_tagmethods.vgetfield = sp->b.vgetparent; tif->tif_tagmethods.vsetfield = sp->b.vsetparent; tif->tif_tagmethods.printdir = sp->b.printdir; if (sp->runs) _TIFFfree(sp->runs); if (sp->refline) _TIFFfree(sp->refline); if (Fax3State(tif)->subaddress) _TIFFfree(Fax3State(tif)->subaddress); if (Fax3State(tif)->faxdcs) _TIFFfree(Fax3State(tif)->faxdcs); _TIFFfree(tif->tif_data); tif->tif_data = NULL; _TIFFSetDefaultCompressionState(tif); } #define FIELD_BADFAXLINES (FIELD_CODEC+0) #define FIELD_CLEANFAXDATA (FIELD_CODEC+1) #define FIELD_BADFAXRUN (FIELD_CODEC+2) #define FIELD_RECVPARAMS (FIELD_CODEC+3) #define FIELD_SUBADDRESS (FIELD_CODEC+4) #define FIELD_RECVTIME (FIELD_CODEC+5) #define FIELD_FAXDCS (FIELD_CODEC+6) #define FIELD_OPTIONS (FIELD_CODEC+7) static const TIFFFieldInfo faxFieldInfo[] = { { TIFFTAG_FAXMODE, 0, 0, TIFF_ANY, FIELD_PSEUDO, FALSE, FALSE, "FaxMode" }, { TIFFTAG_FAXFILLFUNC, 0, 0, TIFF_ANY, FIELD_PSEUDO, FALSE, FALSE, "FaxFillFunc" }, { TIFFTAG_BADFAXLINES, 1, 1, TIFF_LONG, FIELD_BADFAXLINES, TRUE, FALSE, "BadFaxLines" }, { TIFFTAG_BADFAXLINES, 1, 1, TIFF_SHORT, FIELD_BADFAXLINES, TRUE, FALSE, "BadFaxLines" }, { TIFFTAG_CLEANFAXDATA, 1, 1, TIFF_SHORT, FIELD_CLEANFAXDATA, TRUE, FALSE, "CleanFaxData" }, { TIFFTAG_CONSECUTIVEBADFAXLINES,1,1, TIFF_LONG, FIELD_BADFAXRUN, TRUE, FALSE, "ConsecutiveBadFaxLines" }, { TIFFTAG_CONSECUTIVEBADFAXLINES,1,1, TIFF_SHORT, FIELD_BADFAXRUN, TRUE, FALSE, "ConsecutiveBadFaxLines" }, { TIFFTAG_FAXRECVPARAMS, 1, 1, TIFF_LONG, FIELD_RECVPARAMS, TRUE, FALSE, "FaxRecvParams" }, { TIFFTAG_FAXSUBADDRESS, -1,-1, TIFF_ASCII, FIELD_SUBADDRESS, TRUE, FALSE, "FaxSubAddress" }, { TIFFTAG_FAXRECVTIME, 1, 1, TIFF_LONG, FIELD_RECVTIME, TRUE, FALSE, "FaxRecvTime" }, { TIFFTAG_FAXDCS, -1,-1, TIFF_ASCII, FIELD_FAXDCS, TRUE, FALSE, "FaxDcs" }, }; static const TIFFFieldInfo fax3FieldInfo[] = { { TIFFTAG_GROUP3OPTIONS, 1, 1, TIFF_LONG, FIELD_OPTIONS, FALSE, FALSE, "Group3Options" }, }; static const TIFFFieldInfo fax4FieldInfo[] = { { TIFFTAG_GROUP4OPTIONS, 1, 1, TIFF_LONG, FIELD_OPTIONS, FALSE, FALSE, "Group4Options" }, }; #define N(a) (sizeof (a) / sizeof (a[0])) static int Fax3VSetField(TIFF* tif, ttag_t tag, va_list ap) { Fax3BaseState* sp = Fax3State(tif); const TIFFFieldInfo* fip; assert(sp != 0); assert(sp->vsetparent != 0); switch (tag) { case TIFFTAG_FAXMODE: sp->mode = va_arg(ap, int); return 1; /* NB: pseudo tag */ case TIFFTAG_FAXFILLFUNC: DecoderState(tif)->fill = va_arg(ap, TIFFFaxFillFunc); return 1; /* NB: pseudo tag */ case TIFFTAG_GROUP3OPTIONS: /* XXX: avoid reading options if compression mismatches. */ if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX3) sp->groupoptions = va_arg(ap, uint32); break; case TIFFTAG_GROUP4OPTIONS: /* XXX: avoid reading options if compression mismatches. */ if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX4) sp->groupoptions = va_arg(ap, uint32); break; case TIFFTAG_BADFAXLINES: sp->badfaxlines = va_arg(ap, uint32); break; case TIFFTAG_CLEANFAXDATA: sp->cleanfaxdata = (uint16) va_arg(ap, int); break; case TIFFTAG_CONSECUTIVEBADFAXLINES: sp->badfaxrun = va_arg(ap, uint32); break; case TIFFTAG_FAXRECVPARAMS: sp->recvparams = va_arg(ap, uint32); break; case TIFFTAG_FAXSUBADDRESS: _TIFFsetString(&sp->subaddress, va_arg(ap, char*)); break; case TIFFTAG_FAXRECVTIME: sp->recvtime = va_arg(ap, uint32); break; case TIFFTAG_FAXDCS: _TIFFsetString(&sp->faxdcs, va_arg(ap, char*)); break; default: return (*sp->vsetparent)(tif, tag, ap); } if ((fip = _TIFFFieldWithTag(tif, tag))) TIFFSetFieldBit(tif, fip->field_bit); else return 0; tif->tif_flags |= TIFF_DIRTYDIRECT; return 1; } static int Fax3VGetField(TIFF* tif, ttag_t tag, va_list ap) { Fax3BaseState* sp = Fax3State(tif); assert(sp != 0); switch (tag) { case TIFFTAG_FAXMODE: *va_arg(ap, int*) = sp->mode; break; case TIFFTAG_FAXFILLFUNC: *va_arg(ap, TIFFFaxFillFunc*) = DecoderState(tif)->fill; break; case TIFFTAG_GROUP3OPTIONS: case TIFFTAG_GROUP4OPTIONS: *va_arg(ap, uint32*) = sp->groupoptions; break; case TIFFTAG_BADFAXLINES: *va_arg(ap, uint32*) = sp->badfaxlines; break; case TIFFTAG_CLEANFAXDATA: *va_arg(ap, uint16*) = sp->cleanfaxdata; break; case TIFFTAG_CONSECUTIVEBADFAXLINES: *va_arg(ap, uint32*) = sp->badfaxrun; break; case TIFFTAG_FAXRECVPARAMS: *va_arg(ap, uint32*) = sp->recvparams; break; case TIFFTAG_FAXSUBADDRESS: *va_arg(ap, char**) = sp->subaddress; break; case TIFFTAG_FAXRECVTIME: *va_arg(ap, uint32*) = sp->recvtime; break; case TIFFTAG_FAXDCS: *va_arg(ap, char**) = sp->faxdcs; break; default: return (*sp->vgetparent)(tif, tag, ap); } return (1); } static void Fax3PrintDir(TIFF* tif, FILE* fd, long flags) { Fax3BaseState* sp = Fax3State(tif); assert(sp != 0); (void) flags; if (TIFFFieldSet(tif,FIELD_OPTIONS)) { const char* sep = " "; if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX4) { fprintf(fd, " Group 4 Options:"); if (sp->groupoptions & GROUP4OPT_UNCOMPRESSED) fprintf(fd, "%suncompressed data", sep); } else { fprintf(fd, " Group 3 Options:"); if (sp->groupoptions & GROUP3OPT_2DENCODING) fprintf(fd, "%s2-d encoding", sep), sep = "+"; if (sp->groupoptions & GROUP3OPT_FILLBITS) fprintf(fd, "%sEOL padding", sep), sep = "+"; if (sp->groupoptions & GROUP3OPT_UNCOMPRESSED) fprintf(fd, "%suncompressed data", sep); } fprintf(fd, " (%lu = 0x%lx)\n", (unsigned long) sp->groupoptions, (unsigned long) sp->groupoptions); } if (TIFFFieldSet(tif,FIELD_CLEANFAXDATA)) { fprintf(fd, " Fax Data:"); switch (sp->cleanfaxdata) { case CLEANFAXDATA_CLEAN: fprintf(fd, " clean"); break; case CLEANFAXDATA_REGENERATED: fprintf(fd, " receiver regenerated"); break; case CLEANFAXDATA_UNCLEAN: fprintf(fd, " uncorrected errors"); break; } fprintf(fd, " (%u = 0x%x)\n", sp->cleanfaxdata, sp->cleanfaxdata); } if (TIFFFieldSet(tif,FIELD_BADFAXLINES)) fprintf(fd, " Bad Fax Lines: %lu\n", (unsigned long) sp->badfaxlines); if (TIFFFieldSet(tif,FIELD_BADFAXRUN)) fprintf(fd, " Consecutive Bad Fax Lines: %lu\n", (unsigned long) sp->badfaxrun); if (TIFFFieldSet(tif,FIELD_RECVPARAMS)) fprintf(fd, " Fax Receive Parameters: %08lx\n", (unsigned long) sp->recvparams); if (TIFFFieldSet(tif,FIELD_SUBADDRESS)) fprintf(fd, " Fax SubAddress: %s\n", sp->subaddress); if (TIFFFieldSet(tif,FIELD_RECVTIME)) fprintf(fd, " Fax Receive Time: %lu secs\n", (unsigned long) sp->recvtime); if (TIFFFieldSet(tif,FIELD_FAXDCS)) fprintf(fd, " Fax DCS: %s\n", sp->faxdcs); } static int InitCCITTFax3(TIFF* tif) { Fax3BaseState* sp; /* * Merge codec-specific tag information. */ if (!_TIFFMergeFieldInfo(tif, faxFieldInfo, N(faxFieldInfo))) { TIFFErrorExt(tif->tif_clientdata, "InitCCITTFax3", "Merging common CCITT Fax codec-specific tags failed"); return 0; } /* * Allocate state block so tag methods have storage to record values. */ tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (Fax3CodecState)); if (tif->tif_data == NULL) { TIFFErrorExt(tif->tif_clientdata, "TIFFInitCCITTFax3", "%s: No space for state block", tif->tif_name); return (0); } sp = Fax3State(tif); sp->rw_mode = tif->tif_mode; /* * Override parent get/set field methods. */ sp->vgetparent = tif->tif_tagmethods.vgetfield; tif->tif_tagmethods.vgetfield = Fax3VGetField; /* hook for codec tags */ sp->vsetparent = tif->tif_tagmethods.vsetfield; tif->tif_tagmethods.vsetfield = Fax3VSetField; /* hook for codec tags */ sp->printdir = tif->tif_tagmethods.printdir; tif->tif_tagmethods.printdir = Fax3PrintDir; /* hook for codec tags */ sp->groupoptions = 0; sp->recvparams = 0; sp->subaddress = NULL; sp->faxdcs = NULL; if (sp->rw_mode == O_RDONLY) /* FIXME: improve for in place update */ tif->tif_flags |= TIFF_NOBITREV; /* decoder does bit reversal */ DecoderState(tif)->runs = NULL; TIFFSetField(tif, TIFFTAG_FAXFILLFUNC, _TIFFFax3fillruns); EncoderState(tif)->refline = NULL; /* * Install codec methods. */ tif->tif_setupdecode = Fax3SetupState; tif->tif_predecode = Fax3PreDecode; tif->tif_decoderow = Fax3Decode1D; tif->tif_decodestrip = Fax3Decode1D; tif->tif_decodetile = Fax3Decode1D; tif->tif_setupencode = Fax3SetupState; tif->tif_preencode = Fax3PreEncode; tif->tif_postencode = Fax3PostEncode; tif->tif_encoderow = Fax3Encode; tif->tif_encodestrip = Fax3Encode; tif->tif_encodetile = Fax3Encode; tif->tif_close = Fax3Close; tif->tif_cleanup = Fax3Cleanup; return (1); } int TIFFInitCCITTFax3(TIFF* tif, int scheme) { (void) scheme; if (InitCCITTFax3(tif)) { /* * Merge codec-specific tag information. */ if (!_TIFFMergeFieldInfo(tif, fax3FieldInfo, N(fax3FieldInfo))) { TIFFErrorExt(tif->tif_clientdata, "TIFFInitCCITTFax3", "Merging CCITT Fax 3 codec-specific tags failed"); return 0; } /* * The default format is Class/F-style w/o RTC. */ return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_CLASSF); } else return 01; } /* * CCITT Group 4 (T.6) Facsimile-compatible * Compression Scheme Support. */ #define SWAP(t,a,b) { t x; x = (a); (a) = (b); (b) = x; } /* * Decode the requested amount of G4-encoded data. */ static int Fax4Decode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s) { DECLARE_STATE_2D(tif, sp, "Fax4Decode"); (void) s; CACHE_STATE(tif, sp); while ((long)occ > 0) { a0 = 0; RunLength = 0; pa = thisrun = sp->curruns; pb = sp->refruns; b1 = *pb++; #ifdef FAX3_DEBUG printf("\nBitAcc=%08X, BitsAvail = %d\n", BitAcc, BitsAvail); printf("-------------------- %d\n", tif->tif_row); fflush(stdout); #endif EXPAND2D(EOFG4); if (EOLcnt) goto EOFG4; (*sp->fill)(buf, thisrun, pa, lastx); SETVALUE(0); /* imaginary change for reference */ SWAP(uint32*, sp->curruns, sp->refruns); buf += sp->b.rowbytes; occ -= sp->b.rowbytes; sp->line++; continue; EOFG4: NeedBits16( 13, BADG4 ); BADG4: #ifdef FAX3_DEBUG if( GetBits(13) != 0x1001 ) fputs( "Bad RTC\n", stderr ); #endif ClrBits( 13 ); (*sp->fill)(buf, thisrun, pa, lastx); UNCACHE_STATE(tif, sp); return (-1); } UNCACHE_STATE(tif, sp); return (1); } #undef SWAP /* * Encode the requested amount of data. */ static int Fax4Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) { Fax3CodecState *sp = EncoderState(tif); (void) s; while ((long)cc > 0) { if (!Fax3Encode2DRow(tif, bp, sp->refline, sp->b.rowpixels)) return (0); _TIFFmemcpy(sp->refline, bp, sp->b.rowbytes); bp += sp->b.rowbytes; cc -= sp->b.rowbytes; } return (1); } static int Fax4PostEncode(TIFF* tif) { Fax3CodecState *sp = EncoderState(tif); /* terminate strip w/ EOFB */ Fax3PutBits(tif, EOL, 12); Fax3PutBits(tif, EOL, 12); if (sp->bit != 8) Fax3FlushBits(tif, sp); return (1); } int TIFFInitCCITTFax4(TIFF* tif, int scheme) { (void) scheme; if (InitCCITTFax3(tif)) { /* reuse G3 support */ /* * Merge codec-specific tag information. */ if (!_TIFFMergeFieldInfo(tif, fax4FieldInfo, N(fax4FieldInfo))) { TIFFErrorExt(tif->tif_clientdata, "TIFFInitCCITTFax4", "Merging CCITT Fax 4 codec-specific tags failed"); return 0; } tif->tif_decoderow = Fax4Decode; tif->tif_decodestrip = Fax4Decode; tif->tif_decodetile = Fax4Decode; tif->tif_encoderow = Fax4Encode; tif->tif_encodestrip = Fax4Encode; tif->tif_encodetile = Fax4Encode; tif->tif_postencode = Fax4PostEncode; /* * Suppress RTC at the end of each strip. */ return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_NORTC); } else return (0); } /* * CCITT Group 3 1-D Modified Huffman RLE Compression Support. * (Compression algorithms 2 and 32771) */ /* * Decode the requested amount of RLE-encoded data. */ static int Fax3DecodeRLE(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s) { DECLARE_STATE(tif, sp, "Fax3DecodeRLE"); int mode = sp->b.mode; (void) s; CACHE_STATE(tif, sp); thisrun = sp->curruns; while ((long)occ > 0) { a0 = 0; RunLength = 0; pa = thisrun; #ifdef FAX3_DEBUG printf("\nBitAcc=%08X, BitsAvail = %d\n", BitAcc, BitsAvail); printf("-------------------- %d\n", tif->tif_row); fflush(stdout); #endif EXPAND1D(EOFRLE); (*sp->fill)(buf, thisrun, pa, lastx); /* * Cleanup at the end of the row. */ if (mode & FAXMODE_BYTEALIGN) { int n = BitsAvail - (BitsAvail &~ 7); ClrBits(n); } else if (mode & FAXMODE_WORDALIGN) { int n = BitsAvail - (BitsAvail &~ 15); ClrBits(n); if (BitsAvail == 0 && !isAligned(cp, uint16)) cp++; } buf += sp->b.rowbytes; occ -= sp->b.rowbytes; sp->line++; continue; EOFRLE: /* premature EOF */ (*sp->fill)(buf, thisrun, pa, lastx); UNCACHE_STATE(tif, sp); return (-1); } UNCACHE_STATE(tif, sp); return (1); } int TIFFInitCCITTRLE(TIFF* tif, int scheme) { (void) scheme; if (InitCCITTFax3(tif)) { /* reuse G3 support */ tif->tif_decoderow = Fax3DecodeRLE; tif->tif_decodestrip = Fax3DecodeRLE; tif->tif_decodetile = Fax3DecodeRLE; /* * Suppress RTC+EOLs when encoding and byte-align data. */ return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_NORTC|FAXMODE_NOEOL|FAXMODE_BYTEALIGN); } else return (0); } int TIFFInitCCITTRLEW(TIFF* tif, int scheme) { (void) scheme; if (InitCCITTFax3(tif)) { /* reuse G3 support */ tif->tif_decoderow = Fax3DecodeRLE; tif->tif_decodestrip = Fax3DecodeRLE; tif->tif_decodetile = Fax3DecodeRLE; /* * Suppress RTC+EOLs when encoding and word-align data. */ return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_NORTC|FAXMODE_NOEOL|FAXMODE_WORDALIGN); } else return (0); } #endif /* CCITT_SUPPORT */ /* vim: set ts=8 sts=8 sw=8 noet: */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/bzip2/�����������������������������������������������������������0000755�0001750�0001750�00000000000�12320456500�017432� 5����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/bzip2/compress.c�������������������������������������������������0000644�0001750�0001750�00000050121�12320456500�021430� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /*-------------------------------------------------------------*/ /*--- Compression machinery (not incl block sorting) ---*/ /*--- compress.c ---*/ /*-------------------------------------------------------------*/ /* ------------------------------------------------------------------ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. bzip2/libbzip2 version 1.0.5 of 10 December 2007 Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained in the file LICENSE. ------------------------------------------------------------------ */ /* CHANGES 0.9.0 -- original version. 0.9.0a/b -- no changes in this file. 0.9.0c -- changed setting of nGroups in sendMTFValues() so as to do a bit better on small files */ #include "bzlib_private.h" /*---------------------------------------------------*/ /*--- Bit stream I/O ---*/ /*---------------------------------------------------*/ /*---------------------------------------------------*/ void BZ2_bsInitWrite ( EState* s ) { s->bsLive = 0; s->bsBuff = 0; } /*---------------------------------------------------*/ static void bsFinishWrite ( EState* s ) { while (s->bsLive > 0) { s->zbits[s->numZ] = (UChar)(s->bsBuff >> 24); s->numZ++; s->bsBuff <<= 8; s->bsLive -= 8; } } /*---------------------------------------------------*/ #define bsNEEDW(nz) \ { \ while (s->bsLive >= 8) { \ s->zbits[s->numZ] \ = (UChar)(s->bsBuff >> 24); \ s->numZ++; \ s->bsBuff <<= 8; \ s->bsLive -= 8; \ } \ } /*---------------------------------------------------*/ static __inline__ void bsW ( EState* s, Int32 n, UInt32 v ) { bsNEEDW ( n ); s->bsBuff |= (v << (32 - s->bsLive - n)); s->bsLive += n; } /*---------------------------------------------------*/ static void bsPutUInt32 ( EState* s, UInt32 u ) { bsW ( s, 8, (u >> 24) & 0xffL ); bsW ( s, 8, (u >> 16) & 0xffL ); bsW ( s, 8, (u >> 8) & 0xffL ); bsW ( s, 8, u & 0xffL ); } /*---------------------------------------------------*/ static void bsPutUChar ( EState* s, UChar c ) { bsW( s, 8, (UInt32)c ); } /*---------------------------------------------------*/ /*--- The back end proper ---*/ /*---------------------------------------------------*/ /*---------------------------------------------------*/ static void makeMaps_e ( EState* s ) { Int32 i; s->nInUse = 0; for (i = 0; i < 256; i++) if (s->inUse[i]) { s->unseqToSeq[i] = s->nInUse; s->nInUse++; } } /*---------------------------------------------------*/ static void generateMTFValues ( EState* s ) { UChar yy[256]; Int32 i, j; Int32 zPend; Int32 wr; Int32 EOB; /* After sorting (eg, here), s->arr1 [ 0 .. s->nblock-1 ] holds sorted order, and ((UChar*)s->arr2) [ 0 .. s->nblock-1 ] holds the original block data. The first thing to do is generate the MTF values, and put them in ((UInt16*)s->arr1) [ 0 .. s->nblock-1 ]. Because there are strictly fewer or equal MTF values than block values, ptr values in this area are overwritten with MTF values only when they are no longer needed. The final compressed bitstream is generated into the area starting at (UChar*) (&((UChar*)s->arr2)[s->nblock]) These storage aliases are set up in bzCompressInit(), except for the last one, which is arranged in compressBlock(). */ UInt32* ptr = s->ptr; UChar* block = s->block; UInt16* mtfv = s->mtfv; makeMaps_e ( s ); EOB = s->nInUse+1; for (i = 0; i <= EOB; i++) s->mtfFreq[i] = 0; wr = 0; zPend = 0; for (i = 0; i < s->nInUse; i++) yy[i] = (UChar) i; for (i = 0; i < s->nblock; i++) { UChar ll_i; AssertD ( wr <= i, "generateMTFValues(1)" ); j = ptr[i]-1; if (j < 0) j += s->nblock; ll_i = s->unseqToSeq[block[j]]; AssertD ( ll_i < s->nInUse, "generateMTFValues(2a)" ); if (yy[0] == ll_i) { zPend++; } else { if (zPend > 0) { zPend--; while (True) { if (zPend & 1) { mtfv[wr] = BZ_RUNB; wr++; s->mtfFreq[BZ_RUNB]++; } else { mtfv[wr] = BZ_RUNA; wr++; s->mtfFreq[BZ_RUNA]++; } if (zPend < 2) break; zPend = (zPend - 2) / 2; }; zPend = 0; } { register UChar rtmp; register UChar* ryy_j; register UChar rll_i; rtmp = yy[1]; yy[1] = yy[0]; ryy_j = &(yy[1]); rll_i = ll_i; while ( rll_i != rtmp ) { register UChar rtmp2; ryy_j++; rtmp2 = rtmp; rtmp = *ryy_j; *ryy_j = rtmp2; }; yy[0] = rtmp; j = ryy_j - &(yy[0]); mtfv[wr] = j+1; wr++; s->mtfFreq[j+1]++; } } } if (zPend > 0) { zPend--; while (True) { if (zPend & 1) { mtfv[wr] = BZ_RUNB; wr++; s->mtfFreq[BZ_RUNB]++; } else { mtfv[wr] = BZ_RUNA; wr++; s->mtfFreq[BZ_RUNA]++; } if (zPend < 2) break; zPend = (zPend - 2) / 2; }; zPend = 0; } mtfv[wr] = EOB; wr++; s->mtfFreq[EOB]++; s->nMTF = wr; } /*---------------------------------------------------*/ #define BZ_LESSER_ICOST 0 #define BZ_GREATER_ICOST 15 static void sendMTFValues ( EState* s ) { Int32 v, t, i, j, gs, ge, totc, bt, bc, iter; Int32 nSelectors, alphaSize, minLen, maxLen, selCtr; Int32 nGroups, nBytes; /*-- UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; is a global since the decoder also needs it. Int32 code[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; Int32 rfreq[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; are also globals only used in this proc. Made global to keep stack frame size small. --*/ UInt16 cost[BZ_N_GROUPS]; Int32 fave[BZ_N_GROUPS]; UInt16* mtfv = s->mtfv; if (s->verbosity >= 3) VPrintf3( " %d in block, %d after MTF & 1-2 coding, " "%d+2 syms in use\n", s->nblock, s->nMTF, s->nInUse ); alphaSize = s->nInUse+2; for (t = 0; t < BZ_N_GROUPS; t++) for (v = 0; v < alphaSize; v++) s->len[t][v] = BZ_GREATER_ICOST; /*--- Decide how many coding tables to use ---*/ AssertH ( s->nMTF > 0, 3001 ); if (s->nMTF < 200) nGroups = 2; else if (s->nMTF < 600) nGroups = 3; else if (s->nMTF < 1200) nGroups = 4; else if (s->nMTF < 2400) nGroups = 5; else nGroups = 6; /*--- Generate an initial set of coding tables ---*/ { Int32 nPart, remF, tFreq, aFreq; nPart = nGroups; remF = s->nMTF; gs = 0; while (nPart > 0) { tFreq = remF / nPart; ge = gs-1; aFreq = 0; while (aFreq < tFreq && ge < alphaSize-1) { ge++; aFreq += s->mtfFreq[ge]; } if (ge > gs && nPart != nGroups && nPart != 1 && ((nGroups-nPart) % 2 == 1)) { aFreq -= s->mtfFreq[ge]; ge--; } if (s->verbosity >= 3) VPrintf5( " initial group %d, [%d .. %d], " "has %d syms (%4.1f%%)\n", nPart, gs, ge, aFreq, (100.0 * (float)aFreq) / (float)(s->nMTF) ); for (v = 0; v < alphaSize; v++) if (v >= gs && v <= ge) s->len[nPart-1][v] = BZ_LESSER_ICOST; else s->len[nPart-1][v] = BZ_GREATER_ICOST; nPart--; gs = ge+1; remF -= aFreq; } } /*--- Iterate up to BZ_N_ITERS times to improve the tables. ---*/ for (iter = 0; iter < BZ_N_ITERS; iter++) { for (t = 0; t < nGroups; t++) fave[t] = 0; for (t = 0; t < nGroups; t++) for (v = 0; v < alphaSize; v++) s->rfreq[t][v] = 0; /*--- Set up an auxiliary length table which is used to fast-track the common case (nGroups == 6). ---*/ if (nGroups == 6) { for (v = 0; v < alphaSize; v++) { s->len_pack[v][0] = (s->len[1][v] << 16) | s->len[0][v]; s->len_pack[v][1] = (s->len[3][v] << 16) | s->len[2][v]; s->len_pack[v][2] = (s->len[5][v] << 16) | s->len[4][v]; } } nSelectors = 0; totc = 0; gs = 0; while (True) { /*--- Set group start & end marks. --*/ if (gs >= s->nMTF) break; ge = gs + BZ_G_SIZE - 1; if (ge >= s->nMTF) ge = s->nMTF-1; /*-- Calculate the cost of this group as coded by each of the coding tables. --*/ for (t = 0; t < nGroups; t++) cost[t] = 0; if (nGroups == 6 && 50 == ge-gs+1) { /*--- fast track the common case ---*/ register UInt32 cost01, cost23, cost45; register UInt16 icv; cost01 = cost23 = cost45 = 0; # define BZ_ITER(nn) \ icv = mtfv[gs+(nn)]; \ cost01 += s->len_pack[icv][0]; \ cost23 += s->len_pack[icv][1]; \ cost45 += s->len_pack[icv][2]; \ BZ_ITER(0); BZ_ITER(1); BZ_ITER(2); BZ_ITER(3); BZ_ITER(4); BZ_ITER(5); BZ_ITER(6); BZ_ITER(7); BZ_ITER(8); BZ_ITER(9); BZ_ITER(10); BZ_ITER(11); BZ_ITER(12); BZ_ITER(13); BZ_ITER(14); BZ_ITER(15); BZ_ITER(16); BZ_ITER(17); BZ_ITER(18); BZ_ITER(19); BZ_ITER(20); BZ_ITER(21); BZ_ITER(22); BZ_ITER(23); BZ_ITER(24); BZ_ITER(25); BZ_ITER(26); BZ_ITER(27); BZ_ITER(28); BZ_ITER(29); BZ_ITER(30); BZ_ITER(31); BZ_ITER(32); BZ_ITER(33); BZ_ITER(34); BZ_ITER(35); BZ_ITER(36); BZ_ITER(37); BZ_ITER(38); BZ_ITER(39); BZ_ITER(40); BZ_ITER(41); BZ_ITER(42); BZ_ITER(43); BZ_ITER(44); BZ_ITER(45); BZ_ITER(46); BZ_ITER(47); BZ_ITER(48); BZ_ITER(49); # undef BZ_ITER cost[0] = cost01 & 0xffff; cost[1] = cost01 >> 16; cost[2] = cost23 & 0xffff; cost[3] = cost23 >> 16; cost[4] = cost45 & 0xffff; cost[5] = cost45 >> 16; } else { /*--- slow version which correctly handles all situations ---*/ for (i = gs; i <= ge; i++) { UInt16 icv = mtfv[i]; for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv]; } } /*-- Find the coding table which is best for this group, and record its identity in the selector table. --*/ bc = 999999999; bt = -1; for (t = 0; t < nGroups; t++) if (cost[t] < bc) { bc = cost[t]; bt = t; }; totc += bc; fave[bt]++; s->selector[nSelectors] = bt; nSelectors++; /*-- Increment the symbol frequencies for the selected table. --*/ if (nGroups == 6 && 50 == ge-gs+1) { /*--- fast track the common case ---*/ # define BZ_ITUR(nn) s->rfreq[bt][ mtfv[gs+(nn)] ]++ BZ_ITUR(0); BZ_ITUR(1); BZ_ITUR(2); BZ_ITUR(3); BZ_ITUR(4); BZ_ITUR(5); BZ_ITUR(6); BZ_ITUR(7); BZ_ITUR(8); BZ_ITUR(9); BZ_ITUR(10); BZ_ITUR(11); BZ_ITUR(12); BZ_ITUR(13); BZ_ITUR(14); BZ_ITUR(15); BZ_ITUR(16); BZ_ITUR(17); BZ_ITUR(18); BZ_ITUR(19); BZ_ITUR(20); BZ_ITUR(21); BZ_ITUR(22); BZ_ITUR(23); BZ_ITUR(24); BZ_ITUR(25); BZ_ITUR(26); BZ_ITUR(27); BZ_ITUR(28); BZ_ITUR(29); BZ_ITUR(30); BZ_ITUR(31); BZ_ITUR(32); BZ_ITUR(33); BZ_ITUR(34); BZ_ITUR(35); BZ_ITUR(36); BZ_ITUR(37); BZ_ITUR(38); BZ_ITUR(39); BZ_ITUR(40); BZ_ITUR(41); BZ_ITUR(42); BZ_ITUR(43); BZ_ITUR(44); BZ_ITUR(45); BZ_ITUR(46); BZ_ITUR(47); BZ_ITUR(48); BZ_ITUR(49); # undef BZ_ITUR } else { /*--- slow version which correctly handles all situations ---*/ for (i = gs; i <= ge; i++) s->rfreq[bt][ mtfv[i] ]++; } gs = ge+1; } if (s->verbosity >= 3) { VPrintf2 ( " pass %d: size is %d, grp uses are ", iter+1, totc/8 ); for (t = 0; t < nGroups; t++) VPrintf1 ( "%d ", fave[t] ); VPrintf0 ( "\n" ); } /*-- Recompute the tables based on the accumulated frequencies. --*/ /* maxLen was changed from 20 to 17 in bzip2-1.0.3. See comment in huffman.c for details. */ for (t = 0; t < nGroups; t++) BZ2_hbMakeCodeLengths ( &(s->len[t][0]), &(s->rfreq[t][0]), alphaSize, 17 /*20*/ ); } AssertH( nGroups < 8, 3002 ); AssertH( nSelectors < 32768 && nSelectors <= (2 + (900000 / BZ_G_SIZE)), 3003 ); /*--- Compute MTF values for the selectors. ---*/ { UChar pos[BZ_N_GROUPS], ll_i, tmp2, tmp; for (i = 0; i < nGroups; i++) pos[i] = i; for (i = 0; i < nSelectors; i++) { ll_i = s->selector[i]; j = 0; tmp = pos[j]; while ( ll_i != tmp ) { j++; tmp2 = tmp; tmp = pos[j]; pos[j] = tmp2; }; pos[0] = tmp; s->selectorMtf[i] = j; } }; /*--- Assign actual codes for the tables. --*/ for (t = 0; t < nGroups; t++) { minLen = 32; maxLen = 0; for (i = 0; i < alphaSize; i++) { if (s->len[t][i] > maxLen) maxLen = s->len[t][i]; if (s->len[t][i] < minLen) minLen = s->len[t][i]; } AssertH ( !(maxLen > 17 /*20*/ ), 3004 ); AssertH ( !(minLen < 1), 3005 ); BZ2_hbAssignCodes ( &(s->code[t][0]), &(s->len[t][0]), minLen, maxLen, alphaSize ); } /*--- Transmit the mapping table. ---*/ { Bool inUse16[16]; for (i = 0; i < 16; i++) { inUse16[i] = False; for (j = 0; j < 16; j++) if (s->inUse[i * 16 + j]) inUse16[i] = True; } nBytes = s->numZ; for (i = 0; i < 16; i++) if (inUse16[i]) bsW(s,1,1); else bsW(s,1,0); for (i = 0; i < 16; i++) if (inUse16[i]) for (j = 0; j < 16; j++) { if (s->inUse[i * 16 + j]) bsW(s,1,1); else bsW(s,1,0); } if (s->verbosity >= 3) VPrintf1( " bytes: mapping %d, ", s->numZ-nBytes ); } /*--- Now the selectors. ---*/ nBytes = s->numZ; bsW ( s, 3, nGroups ); bsW ( s, 15, nSelectors ); for (i = 0; i < nSelectors; i++) { for (j = 0; j < s->selectorMtf[i]; j++) bsW(s,1,1); bsW(s,1,0); } if (s->verbosity >= 3) VPrintf1( "selectors %d, ", s->numZ-nBytes ); /*--- Now the coding tables. ---*/ nBytes = s->numZ; for (t = 0; t < nGroups; t++) { Int32 curr = s->len[t][0]; bsW ( s, 5, curr ); for (i = 0; i < alphaSize; i++) { while (curr < s->len[t][i]) { bsW(s,2,2); curr++; /* 10 */ }; while (curr > s->len[t][i]) { bsW(s,2,3); curr--; /* 11 */ }; bsW ( s, 1, 0 ); } } if (s->verbosity >= 3) VPrintf1 ( "code lengths %d, ", s->numZ-nBytes ); /*--- And finally, the block data proper ---*/ nBytes = s->numZ; selCtr = 0; gs = 0; while (True) { if (gs >= s->nMTF) break; ge = gs + BZ_G_SIZE - 1; if (ge >= s->nMTF) ge = s->nMTF-1; AssertH ( s->selector[selCtr] < nGroups, 3006 ); if (nGroups == 6 && 50 == ge-gs+1) { /*--- fast track the common case ---*/ UInt16 mtfv_i; UChar* s_len_sel_selCtr = &(s->len[s->selector[selCtr]][0]); Int32* s_code_sel_selCtr = &(s->code[s->selector[selCtr]][0]); # define BZ_ITAH(nn) \ mtfv_i = mtfv[gs+(nn)]; \ bsW ( s, \ s_len_sel_selCtr[mtfv_i], \ s_code_sel_selCtr[mtfv_i] ) BZ_ITAH(0); BZ_ITAH(1); BZ_ITAH(2); BZ_ITAH(3); BZ_ITAH(4); BZ_ITAH(5); BZ_ITAH(6); BZ_ITAH(7); BZ_ITAH(8); BZ_ITAH(9); BZ_ITAH(10); BZ_ITAH(11); BZ_ITAH(12); BZ_ITAH(13); BZ_ITAH(14); BZ_ITAH(15); BZ_ITAH(16); BZ_ITAH(17); BZ_ITAH(18); BZ_ITAH(19); BZ_ITAH(20); BZ_ITAH(21); BZ_ITAH(22); BZ_ITAH(23); BZ_ITAH(24); BZ_ITAH(25); BZ_ITAH(26); BZ_ITAH(27); BZ_ITAH(28); BZ_ITAH(29); BZ_ITAH(30); BZ_ITAH(31); BZ_ITAH(32); BZ_ITAH(33); BZ_ITAH(34); BZ_ITAH(35); BZ_ITAH(36); BZ_ITAH(37); BZ_ITAH(38); BZ_ITAH(39); BZ_ITAH(40); BZ_ITAH(41); BZ_ITAH(42); BZ_ITAH(43); BZ_ITAH(44); BZ_ITAH(45); BZ_ITAH(46); BZ_ITAH(47); BZ_ITAH(48); BZ_ITAH(49); # undef BZ_ITAH } else { /*--- slow version which correctly handles all situations ---*/ for (i = gs; i <= ge; i++) { bsW ( s, s->len [s->selector[selCtr]] [mtfv[i]], s->code [s->selector[selCtr]] [mtfv[i]] ); } } gs = ge+1; selCtr++; } AssertH( selCtr == nSelectors, 3007 ); if (s->verbosity >= 3) VPrintf1( "codes %d\n", s->numZ-nBytes ); } /*---------------------------------------------------*/ void BZ2_compressBlock ( EState* s, Bool is_last_block ) { if (s->nblock > 0) { BZ_FINALISE_CRC ( s->blockCRC ); s->combinedCRC = (s->combinedCRC << 1) | (s->combinedCRC >> 31); s->combinedCRC ^= s->blockCRC; if (s->blockNo > 1) s->numZ = 0; if (s->verbosity >= 2) VPrintf4( " block %d: crc = 0x%08x, " "combined CRC = 0x%08x, size = %d\n", s->blockNo, s->blockCRC, s->combinedCRC, s->nblock ); BZ2_blockSort ( s ); } s->zbits = (UChar*) (&((UChar*)s->arr2)[s->nblock]); /*-- If this is the first block, create the stream header. --*/ if (s->blockNo == 1) { BZ2_bsInitWrite ( s ); bsPutUChar ( s, BZ_HDR_B ); bsPutUChar ( s, BZ_HDR_Z ); bsPutUChar ( s, BZ_HDR_h ); bsPutUChar ( s, (UChar)(BZ_HDR_0 + s->blockSize100k) ); } if (s->nblock > 0) { bsPutUChar ( s, 0x31 ); bsPutUChar ( s, 0x41 ); bsPutUChar ( s, 0x59 ); bsPutUChar ( s, 0x26 ); bsPutUChar ( s, 0x53 ); bsPutUChar ( s, 0x59 ); /*-- Now the block's CRC, so it is in a known place. --*/ bsPutUInt32 ( s, s->blockCRC ); /*-- Now a single bit indicating (non-)randomisation. As of version 0.9.5, we use a better sorting algorithm which makes randomisation unnecessary. So always set the randomised bit to 'no'. Of course, the decoder still needs to be able to handle randomised blocks so as to maintain backwards compatibility with older versions of bzip2. --*/ bsW(s,1,0); bsW ( s, 24, s->origPtr ); generateMTFValues ( s ); sendMTFValues ( s ); } /*-- If this is the last block, add the stream trailer. --*/ if (is_last_block) { bsPutUChar ( s, 0x17 ); bsPutUChar ( s, 0x72 ); bsPutUChar ( s, 0x45 ); bsPutUChar ( s, 0x38 ); bsPutUChar ( s, 0x50 ); bsPutUChar ( s, 0x90 ); bsPutUInt32 ( s, s->combinedCRC ); if (s->verbosity >= 2) VPrintf1( " final combined CRC = 0x%08x\n ", s->combinedCRC ); bsFinishWrite ( s ); } } /*-------------------------------------------------------------*/ /*--- end compress.c ---*/ /*-------------------------------------------------------------*/ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/bzip2/TUVOK_README�����������������������������������������������0000644�0001750�0001750�00000000545�12320456500�021306� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������This is a special version of bzip2 1.0.5 meant for use only within the Tuvok volume rendering library. Tuvok and bzip2 are distributed under different but compatible licenses; please see the `LICENSE' file in the current directory for details. Please report issues with the library to the Tuvok developers; do NOT report problems to the bzip2 developers! �����������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/bzip2/bzlib_private.h��������������������������������������������0000644�0001750�0001750�00000031674�12320456500�022452� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /*-------------------------------------------------------------*/ /*--- Private header file for the library. ---*/ /*--- bzlib_private.h ---*/ /*-------------------------------------------------------------*/ /* ------------------------------------------------------------------ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. bzip2/libbzip2 version 1.0.5 of 10 December 2007 Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained in the file LICENSE. ------------------------------------------------------------------ */ #ifndef _BZLIB_PRIVATE_H #define _BZLIB_PRIVATE_H #include <stdlib.h> #ifndef BZ_NO_STDIO #include <stdio.h> #include <ctype.h> #include <string.h> #endif #include "bzlib.h" /*-- General stuff. --*/ #define BZ_VERSION "1.0.5, 10-Dec-2007" typedef char Char; typedef unsigned char Bool; typedef unsigned char UChar; typedef int Int32; typedef unsigned int UInt32; typedef short Int16; typedef unsigned short UInt16; #define True ((Bool)1) #define False ((Bool)0) #ifndef __GNUC__ #define __inline__ /* */ #endif #ifndef BZ_NO_STDIO extern void BZ2_bz__AssertH__fail ( int errcode ); #define AssertH(cond,errcode) \ { if (!(cond)) BZ2_bz__AssertH__fail ( errcode ); } #if BZ_DEBUG #define AssertD(cond,msg) \ { if (!(cond)) { \ fprintf ( stderr, \ "\n\nlibbzip2(debug build): internal error\n\t%s\n", msg );\ exit(1); \ }} #else #define AssertD(cond,msg) /* */ #endif #define VPrintf0(zf) \ fprintf(stderr,zf) #define VPrintf1(zf,za1) \ fprintf(stderr,zf,za1) #define VPrintf2(zf,za1,za2) \ fprintf(stderr,zf,za1,za2) #define VPrintf3(zf,za1,za2,za3) \ fprintf(stderr,zf,za1,za2,za3) #define VPrintf4(zf,za1,za2,za3,za4) \ fprintf(stderr,zf,za1,za2,za3,za4) #define VPrintf5(zf,za1,za2,za3,za4,za5) \ fprintf(stderr,zf,za1,za2,za3,za4,za5) #else extern void bz_internal_error ( int errcode ); #define AssertH(cond,errcode) \ { if (!(cond)) bz_internal_error ( errcode ); } #define AssertD(cond,msg) do { } while (0) #define VPrintf0(zf) do { } while (0) #define VPrintf1(zf,za1) do { } while (0) #define VPrintf2(zf,za1,za2) do { } while (0) #define VPrintf3(zf,za1,za2,za3) do { } while (0) #define VPrintf4(zf,za1,za2,za3,za4) do { } while (0) #define VPrintf5(zf,za1,za2,za3,za4,za5) do { } while (0) #endif #define BZALLOC(nnn) (strm->bzalloc)(strm->opaque,(nnn),1) #define BZFREE(ppp) (strm->bzfree)(strm->opaque,(ppp)) /*-- Header bytes. --*/ #define BZ_HDR_B 0x42 /* 'B' */ #define BZ_HDR_Z 0x5a /* 'Z' */ #define BZ_HDR_h 0x68 /* 'h' */ #define BZ_HDR_0 0x30 /* '0' */ /*-- Constants for the back end. --*/ #define BZ_MAX_ALPHA_SIZE 258 #define BZ_MAX_CODE_LEN 23 #define BZ_RUNA 0 #define BZ_RUNB 1 #define BZ_N_GROUPS 6 #define BZ_G_SIZE 50 #define BZ_N_ITERS 4 #define BZ_MAX_SELECTORS (2 + (900000 / BZ_G_SIZE)) /*-- Stuff for randomising repetitive blocks. --*/ extern Int32 BZ2_rNums[512]; #define BZ_RAND_DECLS \ Int32 rNToGo; \ Int32 rTPos \ #define BZ_RAND_INIT_MASK \ s->rNToGo = 0; \ s->rTPos = 0 \ #define BZ_RAND_MASK ((s->rNToGo == 1) ? 1 : 0) #define BZ_RAND_UPD_MASK \ if (s->rNToGo == 0) { \ s->rNToGo = BZ2_rNums[s->rTPos]; \ s->rTPos++; \ if (s->rTPos == 512) s->rTPos = 0; \ } \ s->rNToGo--; /*-- Stuff for doing CRCs. --*/ extern UInt32 BZ2_crc32Table[256]; #define BZ_INITIALISE_CRC(crcVar) \ { \ crcVar = 0xffffffffL; \ } #define BZ_FINALISE_CRC(crcVar) \ { \ crcVar = ~(crcVar); \ } #define BZ_UPDATE_CRC(crcVar,cha) \ { \ crcVar = (crcVar << 8) ^ \ BZ2_crc32Table[(crcVar >> 24) ^ \ ((UChar)cha)]; \ } /*-- States and modes for compression. --*/ #define BZ_M_IDLE 1 #define BZ_M_RUNNING 2 #define BZ_M_FLUSHING 3 #define BZ_M_FINISHING 4 #define BZ_S_OUTPUT 1 #define BZ_S_INPUT 2 #define BZ_N_RADIX 2 #define BZ_N_QSORT 12 #define BZ_N_SHELL 18 #define BZ_N_OVERSHOOT (BZ_N_RADIX + BZ_N_QSORT + BZ_N_SHELL + 2) /*-- Structure holding all the compression-side stuff. --*/ typedef struct { /* pointer back to the struct bz_stream */ bz_stream* strm; /* mode this stream is in, and whether inputting */ /* or outputting data */ Int32 mode; Int32 state; /* remembers avail_in when flush/finish requested */ UInt32 avail_in_expect; /* for doing the block sorting */ UInt32* arr1; UInt32* arr2; UInt32* ftab; Int32 origPtr; /* aliases for arr1 and arr2 */ UInt32* ptr; UChar* block; UInt16* mtfv; UChar* zbits; /* for deciding when to use the fallback sorting algorithm */ Int32 workFactor; /* run-length-encoding of the input */ UInt32 state_in_ch; Int32 state_in_len; BZ_RAND_DECLS; /* input and output limits and current posns */ Int32 nblock; Int32 nblockMAX; Int32 numZ; Int32 state_out_pos; /* map of bytes used in block */ Int32 nInUse; Bool inUse[256]; UChar unseqToSeq[256]; /* the buffer for bit stream creation */ UInt32 bsBuff; Int32 bsLive; /* block and combined CRCs */ UInt32 blockCRC; UInt32 combinedCRC; /* misc administratium */ Int32 verbosity; Int32 blockNo; Int32 blockSize100k; /* stuff for coding the MTF values */ Int32 nMTF; Int32 mtfFreq [BZ_MAX_ALPHA_SIZE]; UChar selector [BZ_MAX_SELECTORS]; UChar selectorMtf[BZ_MAX_SELECTORS]; UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; Int32 code [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; Int32 rfreq [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; /* second dimension: only 3 needed; 4 makes index calculations faster */ UInt32 len_pack[BZ_MAX_ALPHA_SIZE][4]; } EState; /*-- externs for compression. --*/ extern void BZ2_blockSort ( EState* ); extern void BZ2_compressBlock ( EState*, Bool ); extern void BZ2_bsInitWrite ( EState* ); extern void BZ2_hbAssignCodes ( Int32*, UChar*, Int32, Int32, Int32 ); extern void BZ2_hbMakeCodeLengths ( UChar*, Int32*, Int32, Int32 ); /*-- states for decompression. --*/ #define BZ_X_IDLE 1 #define BZ_X_OUTPUT 2 #define BZ_X_MAGIC_1 10 #define BZ_X_MAGIC_2 11 #define BZ_X_MAGIC_3 12 #define BZ_X_MAGIC_4 13 #define BZ_X_BLKHDR_1 14 #define BZ_X_BLKHDR_2 15 #define BZ_X_BLKHDR_3 16 #define BZ_X_BLKHDR_4 17 #define BZ_X_BLKHDR_5 18 #define BZ_X_BLKHDR_6 19 #define BZ_X_BCRC_1 20 #define BZ_X_BCRC_2 21 #define BZ_X_BCRC_3 22 #define BZ_X_BCRC_4 23 #define BZ_X_RANDBIT 24 #define BZ_X_ORIGPTR_1 25 #define BZ_X_ORIGPTR_2 26 #define BZ_X_ORIGPTR_3 27 #define BZ_X_MAPPING_1 28 #define BZ_X_MAPPING_2 29 #define BZ_X_SELECTOR_1 30 #define BZ_X_SELECTOR_2 31 #define BZ_X_SELECTOR_3 32 #define BZ_X_CODING_1 33 #define BZ_X_CODING_2 34 #define BZ_X_CODING_3 35 #define BZ_X_MTF_1 36 #define BZ_X_MTF_2 37 #define BZ_X_MTF_3 38 #define BZ_X_MTF_4 39 #define BZ_X_MTF_5 40 #define BZ_X_MTF_6 41 #define BZ_X_ENDHDR_2 42 #define BZ_X_ENDHDR_3 43 #define BZ_X_ENDHDR_4 44 #define BZ_X_ENDHDR_5 45 #define BZ_X_ENDHDR_6 46 #define BZ_X_CCRC_1 47 #define BZ_X_CCRC_2 48 #define BZ_X_CCRC_3 49 #define BZ_X_CCRC_4 50 /*-- Constants for the fast MTF decoder. --*/ #define MTFA_SIZE 4096 #define MTFL_SIZE 16 /*-- Structure holding all the decompression-side stuff. --*/ typedef struct { /* pointer back to the struct bz_stream */ bz_stream* strm; /* state indicator for this stream */ Int32 state; /* for doing the final run-length decoding */ UChar state_out_ch; Int32 state_out_len; Bool blockRandomised; BZ_RAND_DECLS; /* the buffer for bit stream reading */ UInt32 bsBuff; Int32 bsLive; /* misc administratium */ Int32 blockSize100k; Bool smallDecompress; Int32 currBlockNo; Int32 verbosity; /* for undoing the Burrows-Wheeler transform */ Int32 origPtr; UInt32 tPos; Int32 k0; Int32 unzftab[256]; Int32 nblock_used; Int32 cftab[257]; Int32 cftabCopy[257]; /* for undoing the Burrows-Wheeler transform (FAST) */ UInt32 *tt; /* for undoing the Burrows-Wheeler transform (SMALL) */ UInt16 *ll16; UChar *ll4; /* stored and calculated CRCs */ UInt32 storedBlockCRC; UInt32 storedCombinedCRC; UInt32 calculatedBlockCRC; UInt32 calculatedCombinedCRC; /* map of bytes used in block */ Int32 nInUse; Bool inUse[256]; Bool inUse16[16]; UChar seqToUnseq[256]; /* for decoding the MTF values */ UChar mtfa [MTFA_SIZE]; Int32 mtfbase[256 / MTFL_SIZE]; UChar selector [BZ_MAX_SELECTORS]; UChar selectorMtf[BZ_MAX_SELECTORS]; UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; Int32 limit [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; Int32 base [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; Int32 perm [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; Int32 minLens[BZ_N_GROUPS]; /* save area for scalars in the main decompress code */ Int32 save_i; Int32 save_j; Int32 save_t; Int32 save_alphaSize; Int32 save_nGroups; Int32 save_nSelectors; Int32 save_EOB; Int32 save_groupNo; Int32 save_groupPos; Int32 save_nextSym; Int32 save_nblockMAX; Int32 save_nblock; Int32 save_es; Int32 save_N; Int32 save_curr; Int32 save_zt; Int32 save_zn; Int32 save_zvec; Int32 save_zj; Int32 save_gSel; Int32 save_gMinlen; Int32* save_gLimit; Int32* save_gBase; Int32* save_gPerm; } DState; /*-- Macros for decompression. --*/ #define BZ_GET_FAST(cccc) \ /* c_tPos is unsigned, hence test < 0 is pointless. */ \ if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \ s->tPos = s->tt[s->tPos]; \ cccc = (UChar)(s->tPos & 0xff); \ s->tPos >>= 8; #define BZ_GET_FAST_C(cccc) \ /* c_tPos is unsigned, hence test < 0 is pointless. */ \ if (c_tPos >= (UInt32)100000 * (UInt32)ro_blockSize100k) return True; \ c_tPos = c_tt[c_tPos]; \ cccc = (UChar)(c_tPos & 0xff); \ c_tPos >>= 8; #define SET_LL4(i,n) \ { if (((i) & 0x1) == 0) \ s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0xf0) | (n); else \ s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0x0f) | ((n) << 4); \ } #define GET_LL4(i) \ ((((UInt32)(s->ll4[(i) >> 1])) >> (((i) << 2) & 0x4)) & 0xF) #define SET_LL(i,n) \ { s->ll16[i] = (UInt16)(n & 0x0000ffff); \ SET_LL4(i, n >> 16); \ } #define GET_LL(i) \ (((UInt32)s->ll16[i]) | (GET_LL4(i) << 16)) #define BZ_GET_SMALL(cccc) \ /* c_tPos is unsigned, hence test < 0 is pointless. */ \ if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \ cccc = BZ2_indexIntoF ( s->tPos, s->cftab ); \ s->tPos = GET_LL(s->tPos); /*-- externs for decompression. --*/ extern Int32 BZ2_indexIntoF ( Int32, Int32* ); extern Int32 BZ2_decompress ( DState* ); extern void BZ2_hbCreateDecodeTables ( Int32*, Int32*, Int32*, UChar*, Int32, Int32, Int32 ); #endif /*-- BZ_NO_STDIO seems to make NULL disappear on some platforms. --*/ #ifdef BZ_NO_STDIO #ifndef NULL #define NULL 0 #endif #endif /*-------------------------------------------------------------*/ /*--- end bzlib_private.h ---*/ /*-------------------------------------------------------------*/ ��������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/bzip2/crctable.c�������������������������������������������������0000644�0001750�0001750�00000011322�12320456500�021354� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /*-------------------------------------------------------------*/ /*--- Table for doing CRCs ---*/ /*--- crctable.c ---*/ /*-------------------------------------------------------------*/ /* ------------------------------------------------------------------ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. bzip2/libbzip2 version 1.0.5 of 10 December 2007 Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained in the file LICENSE. ------------------------------------------------------------------ */ #include "bzlib_private.h" /*-- I think this is an implementation of the AUTODIN-II, Ethernet & FDDI 32-bit CRC standard. Vaguely derived from code by Rob Warnock, in Section 51 of the comp.compression FAQ. --*/ UInt32 BZ2_crc32Table[256] = { /*-- Ugly, innit? --*/ 0x00000000L, 0x04c11db7L, 0x09823b6eL, 0x0d4326d9L, 0x130476dcL, 0x17c56b6bL, 0x1a864db2L, 0x1e475005L, 0x2608edb8L, 0x22c9f00fL, 0x2f8ad6d6L, 0x2b4bcb61L, 0x350c9b64L, 0x31cd86d3L, 0x3c8ea00aL, 0x384fbdbdL, 0x4c11db70L, 0x48d0c6c7L, 0x4593e01eL, 0x4152fda9L, 0x5f15adacL, 0x5bd4b01bL, 0x569796c2L, 0x52568b75L, 0x6a1936c8L, 0x6ed82b7fL, 0x639b0da6L, 0x675a1011L, 0x791d4014L, 0x7ddc5da3L, 0x709f7b7aL, 0x745e66cdL, 0x9823b6e0L, 0x9ce2ab57L, 0x91a18d8eL, 0x95609039L, 0x8b27c03cL, 0x8fe6dd8bL, 0x82a5fb52L, 0x8664e6e5L, 0xbe2b5b58L, 0xbaea46efL, 0xb7a96036L, 0xb3687d81L, 0xad2f2d84L, 0xa9ee3033L, 0xa4ad16eaL, 0xa06c0b5dL, 0xd4326d90L, 0xd0f37027L, 0xddb056feL, 0xd9714b49L, 0xc7361b4cL, 0xc3f706fbL, 0xceb42022L, 0xca753d95L, 0xf23a8028L, 0xf6fb9d9fL, 0xfbb8bb46L, 0xff79a6f1L, 0xe13ef6f4L, 0xe5ffeb43L, 0xe8bccd9aL, 0xec7dd02dL, 0x34867077L, 0x30476dc0L, 0x3d044b19L, 0x39c556aeL, 0x278206abL, 0x23431b1cL, 0x2e003dc5L, 0x2ac12072L, 0x128e9dcfL, 0x164f8078L, 0x1b0ca6a1L, 0x1fcdbb16L, 0x018aeb13L, 0x054bf6a4L, 0x0808d07dL, 0x0cc9cdcaL, 0x7897ab07L, 0x7c56b6b0L, 0x71159069L, 0x75d48ddeL, 0x6b93dddbL, 0x6f52c06cL, 0x6211e6b5L, 0x66d0fb02L, 0x5e9f46bfL, 0x5a5e5b08L, 0x571d7dd1L, 0x53dc6066L, 0x4d9b3063L, 0x495a2dd4L, 0x44190b0dL, 0x40d816baL, 0xaca5c697L, 0xa864db20L, 0xa527fdf9L, 0xa1e6e04eL, 0xbfa1b04bL, 0xbb60adfcL, 0xb6238b25L, 0xb2e29692L, 0x8aad2b2fL, 0x8e6c3698L, 0x832f1041L, 0x87ee0df6L, 0x99a95df3L, 0x9d684044L, 0x902b669dL, 0x94ea7b2aL, 0xe0b41de7L, 0xe4750050L, 0xe9362689L, 0xedf73b3eL, 0xf3b06b3bL, 0xf771768cL, 0xfa325055L, 0xfef34de2L, 0xc6bcf05fL, 0xc27dede8L, 0xcf3ecb31L, 0xcbffd686L, 0xd5b88683L, 0xd1799b34L, 0xdc3abdedL, 0xd8fba05aL, 0x690ce0eeL, 0x6dcdfd59L, 0x608edb80L, 0x644fc637L, 0x7a089632L, 0x7ec98b85L, 0x738aad5cL, 0x774bb0ebL, 0x4f040d56L, 0x4bc510e1L, 0x46863638L, 0x42472b8fL, 0x5c007b8aL, 0x58c1663dL, 0x558240e4L, 0x51435d53L, 0x251d3b9eL, 0x21dc2629L, 0x2c9f00f0L, 0x285e1d47L, 0x36194d42L, 0x32d850f5L, 0x3f9b762cL, 0x3b5a6b9bL, 0x0315d626L, 0x07d4cb91L, 0x0a97ed48L, 0x0e56f0ffL, 0x1011a0faL, 0x14d0bd4dL, 0x19939b94L, 0x1d528623L, 0xf12f560eL, 0xf5ee4bb9L, 0xf8ad6d60L, 0xfc6c70d7L, 0xe22b20d2L, 0xe6ea3d65L, 0xeba91bbcL, 0xef68060bL, 0xd727bbb6L, 0xd3e6a601L, 0xdea580d8L, 0xda649d6fL, 0xc423cd6aL, 0xc0e2d0ddL, 0xcda1f604L, 0xc960ebb3L, 0xbd3e8d7eL, 0xb9ff90c9L, 0xb4bcb610L, 0xb07daba7L, 0xae3afba2L, 0xaafbe615L, 0xa7b8c0ccL, 0xa379dd7bL, 0x9b3660c6L, 0x9ff77d71L, 0x92b45ba8L, 0x9675461fL, 0x8832161aL, 0x8cf30badL, 0x81b02d74L, 0x857130c3L, 0x5d8a9099L, 0x594b8d2eL, 0x5408abf7L, 0x50c9b640L, 0x4e8ee645L, 0x4a4ffbf2L, 0x470cdd2bL, 0x43cdc09cL, 0x7b827d21L, 0x7f436096L, 0x7200464fL, 0x76c15bf8L, 0x68860bfdL, 0x6c47164aL, 0x61043093L, 0x65c52d24L, 0x119b4be9L, 0x155a565eL, 0x18197087L, 0x1cd86d30L, 0x029f3d35L, 0x065e2082L, 0x0b1d065bL, 0x0fdc1becL, 0x3793a651L, 0x3352bbe6L, 0x3e119d3fL, 0x3ad08088L, 0x2497d08dL, 0x2056cd3aL, 0x2d15ebe3L, 0x29d4f654L, 0xc5a92679L, 0xc1683bceL, 0xcc2b1d17L, 0xc8ea00a0L, 0xd6ad50a5L, 0xd26c4d12L, 0xdf2f6bcbL, 0xdbee767cL, 0xe3a1cbc1L, 0xe760d676L, 0xea23f0afL, 0xeee2ed18L, 0xf0a5bd1dL, 0xf464a0aaL, 0xf9278673L, 0xfde69bc4L, 0x89b8fd09L, 0x8d79e0beL, 0x803ac667L, 0x84fbdbd0L, 0x9abc8bd5L, 0x9e7d9662L, 0x933eb0bbL, 0x97ffad0cL, 0xafb010b1L, 0xab710d06L, 0xa6322bdfL, 0xa2f33668L, 0xbcb4666dL, 0xb8757bdaL, 0xb5365d03L, 0xb1f740b4L }; /*-------------------------------------------------------------*/ /*--- end crctable.c ---*/ /*-------------------------------------------------------------*/ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/bzip2/randtable.c������������������������������������������������0000644�0001750�0001750�00000007424�12320456500�021541� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /*-------------------------------------------------------------*/ /*--- Table for randomising repetitive blocks ---*/ /*--- randtable.c ---*/ /*-------------------------------------------------------------*/ /* ------------------------------------------------------------------ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. bzip2/libbzip2 version 1.0.5 of 10 December 2007 Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained in the file LICENSE. ------------------------------------------------------------------ */ #include "bzlib_private.h" /*---------------------------------------------*/ Int32 BZ2_rNums[512] = { 619, 720, 127, 481, 931, 816, 813, 233, 566, 247, 985, 724, 205, 454, 863, 491, 741, 242, 949, 214, 733, 859, 335, 708, 621, 574, 73, 654, 730, 472, 419, 436, 278, 496, 867, 210, 399, 680, 480, 51, 878, 465, 811, 169, 869, 675, 611, 697, 867, 561, 862, 687, 507, 283, 482, 129, 807, 591, 733, 623, 150, 238, 59, 379, 684, 877, 625, 169, 643, 105, 170, 607, 520, 932, 727, 476, 693, 425, 174, 647, 73, 122, 335, 530, 442, 853, 695, 249, 445, 515, 909, 545, 703, 919, 874, 474, 882, 500, 594, 612, 641, 801, 220, 162, 819, 984, 589, 513, 495, 799, 161, 604, 958, 533, 221, 400, 386, 867, 600, 782, 382, 596, 414, 171, 516, 375, 682, 485, 911, 276, 98, 553, 163, 354, 666, 933, 424, 341, 533, 870, 227, 730, 475, 186, 263, 647, 537, 686, 600, 224, 469, 68, 770, 919, 190, 373, 294, 822, 808, 206, 184, 943, 795, 384, 383, 461, 404, 758, 839, 887, 715, 67, 618, 276, 204, 918, 873, 777, 604, 560, 951, 160, 578, 722, 79, 804, 96, 409, 713, 940, 652, 934, 970, 447, 318, 353, 859, 672, 112, 785, 645, 863, 803, 350, 139, 93, 354, 99, 820, 908, 609, 772, 154, 274, 580, 184, 79, 626, 630, 742, 653, 282, 762, 623, 680, 81, 927, 626, 789, 125, 411, 521, 938, 300, 821, 78, 343, 175, 128, 250, 170, 774, 972, 275, 999, 639, 495, 78, 352, 126, 857, 956, 358, 619, 580, 124, 737, 594, 701, 612, 669, 112, 134, 694, 363, 992, 809, 743, 168, 974, 944, 375, 748, 52, 600, 747, 642, 182, 862, 81, 344, 805, 988, 739, 511, 655, 814, 334, 249, 515, 897, 955, 664, 981, 649, 113, 974, 459, 893, 228, 433, 837, 553, 268, 926, 240, 102, 654, 459, 51, 686, 754, 806, 760, 493, 403, 415, 394, 687, 700, 946, 670, 656, 610, 738, 392, 760, 799, 887, 653, 978, 321, 576, 617, 626, 502, 894, 679, 243, 440, 680, 879, 194, 572, 640, 724, 926, 56, 204, 700, 707, 151, 457, 449, 797, 195, 791, 558, 945, 679, 297, 59, 87, 824, 713, 663, 412, 693, 342, 606, 134, 108, 571, 364, 631, 212, 174, 643, 304, 329, 343, 97, 430, 751, 497, 314, 983, 374, 822, 928, 140, 206, 73, 263, 980, 736, 876, 478, 430, 305, 170, 514, 364, 692, 829, 82, 855, 953, 676, 246, 369, 970, 294, 750, 807, 827, 150, 790, 288, 923, 804, 378, 215, 828, 592, 281, 565, 555, 710, 82, 896, 831, 547, 261, 524, 462, 293, 465, 502, 56, 661, 821, 976, 991, 658, 869, 905, 758, 745, 193, 768, 550, 608, 933, 378, 286, 215, 979, 792, 961, 61, 688, 793, 644, 986, 403, 106, 366, 905, 644, 372, 567, 466, 434, 645, 210, 389, 550, 919, 135, 780, 773, 635, 389, 707, 100, 626, 958, 165, 504, 920, 176, 193, 713, 857, 265, 203, 50, 668, 108, 645, 990, 626, 197, 510, 357, 358, 850, 858, 364, 936, 638 }; /*-------------------------------------------------------------*/ /*--- end randtable.c ---*/ /*-------------------------------------------------------------*/ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/bzip2/bzlib.c����������������������������������������������������0000644�0001750�0001750�00000132206�12320456500�020704� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /*-------------------------------------------------------------*/ /*--- Library top-level functions. ---*/ /*--- bzlib.c ---*/ /*-------------------------------------------------------------*/ /* ------------------------------------------------------------------ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. bzip2/libbzip2 version 1.0.5 of 10 December 2007 Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained in the file LICENSE. ------------------------------------------------------------------ */ /* CHANGES 0.9.0 -- original version. 0.9.0a/b -- no changes in this file. 0.9.0c -- made zero-length BZ_FLUSH work correctly in bzCompress(). fixed bzWrite/bzRead to ignore zero-length requests. fixed bzread to correctly handle read requests after EOF. wrong parameter order in call to bzDecompressInit in bzBuffToBuffDecompress. Fixed. */ #include "bzlib_private.h" /*---------------------------------------------------*/ /*--- Compression stuff ---*/ /*---------------------------------------------------*/ /*---------------------------------------------------*/ #ifndef BZ_NO_STDIO void BZ2_bz__AssertH__fail ( int errcode ) { fprintf(stderr, "\n\nbzip2/libbzip2: internal error number %d.\n" "This is a bug in bzip2/libbzip2, %s.\n" "Please report it to me at: jseward@bzip.org. If this happened\n" "when you were using some program which uses libbzip2 as a\n" "component, you should also report this bug to the author(s)\n" "of that program. Please make an effort to report this bug;\n" "timely and accurate bug reports eventually lead to higher\n" "quality software. Thanks. Julian Seward, 10 December 2007.\n\n", errcode, BZ2_bzlibVersion() ); if (errcode == 1007) { fprintf(stderr, "\n*** A special note about internal error number 1007 ***\n" "\n" "Experience suggests that a common cause of i.e. 1007\n" "is unreliable memory or other hardware. The 1007 assertion\n" "just happens to cross-check the results of huge numbers of\n" "memory reads/writes, and so acts (unintendedly) as a stress\n" "test of your memory system.\n" "\n" "I suggest the following: try compressing the file again,\n" "possibly monitoring progress in detail with the -vv flag.\n" "\n" "* If the error cannot be reproduced, and/or happens at different\n" " points in compression, you may have a flaky memory system.\n" " Try a memory-test program. I have used Memtest86\n" " (www.memtest86.com). At the time of writing it is free (GPLd).\n" " Memtest86 tests memory much more thorougly than your BIOSs\n" " power-on test, and may find failures that the BIOS doesn't.\n" "\n" "* If the error can be repeatably reproduced, this is a bug in\n" " bzip2, and I would very much like to hear about it. Please\n" " let me know, and, ideally, save a copy of the file causing the\n" " problem -- without which I will be unable to investigate it.\n" "\n" ); } exit(3); } #endif /*---------------------------------------------------*/ static int bz_config_ok ( void ) { if (sizeof(int) != 4) return 0; if (sizeof(short) != 2) return 0; if (sizeof(char) != 1) return 0; return 1; } /*---------------------------------------------------*/ #if defined(__GNUC__) && __GNUC__ > 3 || \ (__GNUC__ == 3 && __GNUC_MINOR_ >= 4) # define GNUC_UNUSED __attribute__((unused)) #else # define GNUC_UNUSED /* nothing */ #endif static void* default_bzalloc ( GNUC_UNUSED void* opaque, Int32 items, Int32 size ) { void* v = malloc ( items * size ); return v; } static void default_bzfree ( GNUC_UNUSED void* opaque, void* addr ) { if (addr != NULL) free ( addr ); } /*---------------------------------------------------*/ static void prepare_new_block ( EState* s ) { Int32 i; s->nblock = 0; s->numZ = 0; s->state_out_pos = 0; BZ_INITIALISE_CRC ( s->blockCRC ); for (i = 0; i < 256; i++) s->inUse[i] = False; s->blockNo++; } /*---------------------------------------------------*/ static void init_RL ( EState* s ) { s->state_in_ch = 256; s->state_in_len = 0; } static Bool isempty_RL ( EState* s ) { if (s->state_in_ch < 256 && s->state_in_len > 0) return False; else return True; } /*---------------------------------------------------*/ int BZ_API(BZ2_bzCompressInit) ( bz_stream* strm, int blockSize100k, int verbosity, int workFactor ) { Int32 n; EState* s; if (!bz_config_ok()) return BZ_CONFIG_ERROR; if (strm == NULL || blockSize100k < 1 || blockSize100k > 9 || workFactor < 0 || workFactor > 250) return BZ_PARAM_ERROR; if (workFactor == 0) workFactor = 30; if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc; if (strm->bzfree == NULL) strm->bzfree = default_bzfree; s = BZALLOC( sizeof(EState) ); if (s == NULL) return BZ_MEM_ERROR; s->strm = strm; s->arr1 = NULL; s->arr2 = NULL; s->ftab = NULL; n = 100000 * blockSize100k; s->arr1 = BZALLOC( n * sizeof(UInt32) ); s->arr2 = BZALLOC( (n+BZ_N_OVERSHOOT) * sizeof(UInt32) ); s->ftab = BZALLOC( 65537 * sizeof(UInt32) ); if (s->arr1 == NULL || s->arr2 == NULL || s->ftab == NULL) { if (s->arr1 != NULL) BZFREE(s->arr1); if (s->arr2 != NULL) BZFREE(s->arr2); if (s->ftab != NULL) BZFREE(s->ftab); if (s != NULL) BZFREE(s); return BZ_MEM_ERROR; } s->blockNo = 0; s->state = BZ_S_INPUT; s->mode = BZ_M_RUNNING; s->combinedCRC = 0; s->blockSize100k = blockSize100k; s->nblockMAX = 100000 * blockSize100k - 19; s->verbosity = verbosity; s->workFactor = workFactor; s->block = (UChar*)s->arr2; s->mtfv = (UInt16*)s->arr1; s->zbits = NULL; s->ptr = (UInt32*)s->arr1; strm->state = s; strm->total_in_lo32 = 0; strm->total_in_hi32 = 0; strm->total_out_lo32 = 0; strm->total_out_hi32 = 0; init_RL ( s ); prepare_new_block ( s ); return BZ_OK; } /*---------------------------------------------------*/ static void add_pair_to_block ( EState* s ) { Int32 i; UChar ch = (UChar)(s->state_in_ch); for (i = 0; i < s->state_in_len; i++) { BZ_UPDATE_CRC( s->blockCRC, ch ); } s->inUse[s->state_in_ch] = True; switch (s->state_in_len) { case 1: s->block[s->nblock] = (UChar)ch; s->nblock++; break; case 2: s->block[s->nblock] = (UChar)ch; s->nblock++; s->block[s->nblock] = (UChar)ch; s->nblock++; break; case 3: s->block[s->nblock] = (UChar)ch; s->nblock++; s->block[s->nblock] = (UChar)ch; s->nblock++; s->block[s->nblock] = (UChar)ch; s->nblock++; break; default: s->inUse[s->state_in_len-4] = True; s->block[s->nblock] = (UChar)ch; s->nblock++; s->block[s->nblock] = (UChar)ch; s->nblock++; s->block[s->nblock] = (UChar)ch; s->nblock++; s->block[s->nblock] = (UChar)ch; s->nblock++; s->block[s->nblock] = ((UChar)(s->state_in_len-4)); s->nblock++; break; } } /*---------------------------------------------------*/ static void flush_RL ( EState* s ) { if (s->state_in_ch < 256) add_pair_to_block ( s ); init_RL ( s ); } /*---------------------------------------------------*/ #define ADD_CHAR_TO_BLOCK(zs,zchh0) \ { \ UInt32 zchh = (UInt32)(zchh0); \ /*-- fast track the common case --*/ \ if (zchh != zs->state_in_ch && \ zs->state_in_len == 1) { \ UChar ch = (UChar)(zs->state_in_ch); \ BZ_UPDATE_CRC( zs->blockCRC, ch ); \ zs->inUse[zs->state_in_ch] = True; \ zs->block[zs->nblock] = (UChar)ch; \ zs->nblock++; \ zs->state_in_ch = zchh; \ } \ else \ /*-- general, uncommon cases --*/ \ if (zchh != zs->state_in_ch || \ zs->state_in_len == 255) { \ if (zs->state_in_ch < 256) \ add_pair_to_block ( zs ); \ zs->state_in_ch = zchh; \ zs->state_in_len = 1; \ } else { \ zs->state_in_len++; \ } \ } /*---------------------------------------------------*/ static Bool copy_input_until_stop ( EState* s ) { Bool progress_in = False; if (s->mode == BZ_M_RUNNING) { /*-- fast track the common case --*/ while (True) { /*-- block full? --*/ if (s->nblock >= s->nblockMAX) break; /*-- no input? --*/ if (s->strm->avail_in == 0) break; progress_in = True; ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); s->strm->next_in++; s->strm->avail_in--; s->strm->total_in_lo32++; if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++; } } else { /*-- general, uncommon case --*/ while (True) { /*-- block full? --*/ if (s->nblock >= s->nblockMAX) break; /*-- no input? --*/ if (s->strm->avail_in == 0) break; /*-- flush/finish end? --*/ if (s->avail_in_expect == 0) break; progress_in = True; ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); s->strm->next_in++; s->strm->avail_in--; s->strm->total_in_lo32++; if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++; s->avail_in_expect--; } } return progress_in; } /*---------------------------------------------------*/ static Bool copy_output_until_stop ( EState* s ) { Bool progress_out = False; while (True) { /*-- no output space? --*/ if (s->strm->avail_out == 0) break; /*-- block done? --*/ if (s->state_out_pos >= s->numZ) break; progress_out = True; *(s->strm->next_out) = s->zbits[s->state_out_pos]; s->state_out_pos++; s->strm->avail_out--; s->strm->next_out++; s->strm->total_out_lo32++; if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; } return progress_out; } /*---------------------------------------------------*/ static Bool handle_compress ( bz_stream* strm ) { Bool progress_in = False; Bool progress_out = False; EState* s = strm->state; while (True) { if (s->state == BZ_S_OUTPUT) { progress_out |= copy_output_until_stop ( s ); if (s->state_out_pos < s->numZ) break; if (s->mode == BZ_M_FINISHING && s->avail_in_expect == 0 && isempty_RL(s)) break; prepare_new_block ( s ); s->state = BZ_S_INPUT; if (s->mode == BZ_M_FLUSHING && s->avail_in_expect == 0 && isempty_RL(s)) break; } if (s->state == BZ_S_INPUT) { progress_in |= copy_input_until_stop ( s ); if (s->mode != BZ_M_RUNNING && s->avail_in_expect == 0) { flush_RL ( s ); BZ2_compressBlock ( s, (Bool)(s->mode == BZ_M_FINISHING) ); s->state = BZ_S_OUTPUT; } else if (s->nblock >= s->nblockMAX) { BZ2_compressBlock ( s, False ); s->state = BZ_S_OUTPUT; } else if (s->strm->avail_in == 0) { break; } } } return progress_in || progress_out; } /*---------------------------------------------------*/ int BZ_API(BZ2_bzCompress) ( bz_stream *strm, int action ) { Bool progress; EState* s; if (strm == NULL) return BZ_PARAM_ERROR; s = strm->state; if (s == NULL) return BZ_PARAM_ERROR; if (s->strm != strm) return BZ_PARAM_ERROR; preswitch: switch (s->mode) { case BZ_M_IDLE: return BZ_SEQUENCE_ERROR; case BZ_M_RUNNING: if (action == BZ_RUN) { progress = handle_compress ( strm ); return progress ? BZ_RUN_OK : BZ_PARAM_ERROR; } else if (action == BZ_FLUSH) { s->avail_in_expect = strm->avail_in; s->mode = BZ_M_FLUSHING; goto preswitch; } else if (action == BZ_FINISH) { s->avail_in_expect = strm->avail_in; s->mode = BZ_M_FINISHING; goto preswitch; } else return BZ_PARAM_ERROR; case BZ_M_FLUSHING: if (action != BZ_FLUSH) return BZ_SEQUENCE_ERROR; if (s->avail_in_expect != s->strm->avail_in) return BZ_SEQUENCE_ERROR; progress = handle_compress ( strm ); if (s->avail_in_expect > 0 || !isempty_RL(s) || s->state_out_pos < s->numZ) return BZ_FLUSH_OK; s->mode = BZ_M_RUNNING; return BZ_RUN_OK; case BZ_M_FINISHING: if (action != BZ_FINISH) return BZ_SEQUENCE_ERROR; if (s->avail_in_expect != s->strm->avail_in) return BZ_SEQUENCE_ERROR; progress = handle_compress ( strm ); if (!progress) return BZ_SEQUENCE_ERROR; if (s->avail_in_expect > 0 || !isempty_RL(s) || s->state_out_pos < s->numZ) return BZ_FINISH_OK; s->mode = BZ_M_IDLE; return BZ_STREAM_END; } return BZ_OK; /*--not reached--*/ } /*---------------------------------------------------*/ int BZ_API(BZ2_bzCompressEnd) ( bz_stream *strm ) { EState* s; if (strm == NULL) return BZ_PARAM_ERROR; s = strm->state; if (s == NULL) return BZ_PARAM_ERROR; if (s->strm != strm) return BZ_PARAM_ERROR; if (s->arr1 != NULL) BZFREE(s->arr1); if (s->arr2 != NULL) BZFREE(s->arr2); if (s->ftab != NULL) BZFREE(s->ftab); BZFREE(strm->state); strm->state = NULL; return BZ_OK; } /*---------------------------------------------------*/ /*--- Decompression stuff ---*/ /*---------------------------------------------------*/ /*---------------------------------------------------*/ int BZ_API(BZ2_bzDecompressInit) ( bz_stream* strm, int verbosity, int small ) { DState* s; if (!bz_config_ok()) return BZ_CONFIG_ERROR; if (strm == NULL) return BZ_PARAM_ERROR; if (small != 0 && small != 1) return BZ_PARAM_ERROR; if (verbosity < 0 || verbosity > 4) return BZ_PARAM_ERROR; if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc; if (strm->bzfree == NULL) strm->bzfree = default_bzfree; s = BZALLOC( sizeof(DState) ); if (s == NULL) return BZ_MEM_ERROR; s->strm = strm; strm->state = s; s->state = BZ_X_MAGIC_1; s->bsLive = 0; s->bsBuff = 0; s->calculatedCombinedCRC = 0; strm->total_in_lo32 = 0; strm->total_in_hi32 = 0; strm->total_out_lo32 = 0; strm->total_out_hi32 = 0; s->smallDecompress = (Bool)small; s->ll4 = NULL; s->ll16 = NULL; s->tt = NULL; s->currBlockNo = 0; s->verbosity = verbosity; return BZ_OK; } /*---------------------------------------------------*/ /* Return True iff data corruption is discovered. Returns False if there is no problem. */ static Bool unRLE_obuf_to_output_FAST ( DState* s ) { UChar k1; if (s->blockRandomised) { while (True) { /* try to finish existing run */ while (True) { if (s->strm->avail_out == 0) return False; if (s->state_out_len == 0) break; *( (UChar*)(s->strm->next_out) ) = s->state_out_ch; BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch ); s->state_out_len--; s->strm->next_out++; s->strm->avail_out--; s->strm->total_out_lo32++; if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; } /* can a new run be started? */ if (s->nblock_used == s->save_nblock+1) return False; /* Only caused by corrupt data stream? */ if (s->nblock_used > s->save_nblock+1) return True; s->state_out_len = 1; s->state_out_ch = s->k0; BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; s->state_out_len = 2; BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; s->state_out_len = 3; BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; s->state_out_len = ((Int32)k1) + 4; BZ_GET_FAST(s->k0); BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; s->nblock_used++; } } else { /* restore */ UInt32 c_calculatedBlockCRC = s->calculatedBlockCRC; UChar c_state_out_ch = s->state_out_ch; Int32 c_state_out_len = s->state_out_len; Int32 c_nblock_used = s->nblock_used; Int32 c_k0 = s->k0; UInt32* c_tt = s->tt; UInt32 c_tPos = s->tPos; char* cs_next_out = s->strm->next_out; unsigned int cs_avail_out = s->strm->avail_out; Int32 ro_blockSize100k = s->blockSize100k; /* end restore */ UInt32 avail_out_INIT = cs_avail_out; Int32 s_save_nblockPP = s->save_nblock+1; unsigned int total_out_lo32_old; while (True) { /* try to finish existing run */ if (c_state_out_len > 0) { while (True) { if (cs_avail_out == 0) goto return_notr; if (c_state_out_len == 1) break; *( (UChar*)(cs_next_out) ) = c_state_out_ch; BZ_UPDATE_CRC ( c_calculatedBlockCRC, c_state_out_ch ); c_state_out_len--; cs_next_out++; cs_avail_out--; } s_state_out_len_eq_one: { if (cs_avail_out == 0) { c_state_out_len = 1; goto return_notr; }; *( (UChar*)(cs_next_out) ) = c_state_out_ch; BZ_UPDATE_CRC ( c_calculatedBlockCRC, c_state_out_ch ); cs_next_out++; cs_avail_out--; } } /* Only caused by corrupt data stream? */ if (c_nblock_used > s_save_nblockPP) return True; /* can a new run be started? */ if (c_nblock_used == s_save_nblockPP) { c_state_out_len = 0; goto return_notr; }; c_state_out_ch = c_k0; BZ_GET_FAST_C(k1); c_nblock_used++; if (k1 != c_k0) { c_k0 = k1; goto s_state_out_len_eq_one; }; if (c_nblock_used == s_save_nblockPP) goto s_state_out_len_eq_one; c_state_out_len = 2; BZ_GET_FAST_C(k1); c_nblock_used++; if (c_nblock_used == s_save_nblockPP) continue; if (k1 != c_k0) { c_k0 = k1; continue; }; c_state_out_len = 3; BZ_GET_FAST_C(k1); c_nblock_used++; if (c_nblock_used == s_save_nblockPP) continue; if (k1 != c_k0) { c_k0 = k1; continue; }; BZ_GET_FAST_C(k1); c_nblock_used++; c_state_out_len = ((Int32)k1) + 4; BZ_GET_FAST_C(c_k0); c_nblock_used++; } return_notr: total_out_lo32_old = s->strm->total_out_lo32; s->strm->total_out_lo32 += (avail_out_INIT - cs_avail_out); if (s->strm->total_out_lo32 < total_out_lo32_old) s->strm->total_out_hi32++; /* save */ s->calculatedBlockCRC = c_calculatedBlockCRC; s->state_out_ch = c_state_out_ch; s->state_out_len = c_state_out_len; s->nblock_used = c_nblock_used; s->k0 = c_k0; s->tt = c_tt; s->tPos = c_tPos; s->strm->next_out = cs_next_out; s->strm->avail_out = cs_avail_out; /* end save */ } return False; } /*---------------------------------------------------*/ __inline__ Int32 BZ2_indexIntoF ( Int32 indx, Int32 *cftab ) { Int32 nb, na, mid; nb = 0; na = 256; do { mid = (nb + na) >> 1; if (indx >= cftab[mid]) nb = mid; else na = mid; } while (na - nb != 1); return nb; } /*---------------------------------------------------*/ /* Return True iff data corruption is discovered. Returns False if there is no problem. */ static Bool unRLE_obuf_to_output_SMALL ( DState* s ) { UChar k1; if (s->blockRandomised) { while (True) { /* try to finish existing run */ while (True) { if (s->strm->avail_out == 0) return False; if (s->state_out_len == 0) break; *( (UChar*)(s->strm->next_out) ) = s->state_out_ch; BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch ); s->state_out_len--; s->strm->next_out++; s->strm->avail_out--; s->strm->total_out_lo32++; if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; } /* can a new run be started? */ if (s->nblock_used == s->save_nblock+1) return False; /* Only caused by corrupt data stream? */ if (s->nblock_used > s->save_nblock+1) return True; s->state_out_len = 1; s->state_out_ch = s->k0; BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; s->state_out_len = 2; BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; s->state_out_len = 3; BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; s->state_out_len = ((Int32)k1) + 4; BZ_GET_SMALL(s->k0); BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; s->nblock_used++; } } else { while (True) { /* try to finish existing run */ while (True) { if (s->strm->avail_out == 0) return False; if (s->state_out_len == 0) break; *( (UChar*)(s->strm->next_out) ) = s->state_out_ch; BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch ); s->state_out_len--; s->strm->next_out++; s->strm->avail_out--; s->strm->total_out_lo32++; if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; } /* can a new run be started? */ if (s->nblock_used == s->save_nblock+1) return False; /* Only caused by corrupt data stream? */ if (s->nblock_used > s->save_nblock+1) return True; s->state_out_len = 1; s->state_out_ch = s->k0; BZ_GET_SMALL(k1); s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; s->state_out_len = 2; BZ_GET_SMALL(k1); s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; s->state_out_len = 3; BZ_GET_SMALL(k1); s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; BZ_GET_SMALL(k1); s->nblock_used++; s->state_out_len = ((Int32)k1) + 4; BZ_GET_SMALL(s->k0); s->nblock_used++; } } } /*---------------------------------------------------*/ int BZ_API(BZ2_bzDecompress) ( bz_stream *strm ) { Bool corrupt; DState* s; if (strm == NULL) return BZ_PARAM_ERROR; s = strm->state; if (s == NULL) return BZ_PARAM_ERROR; if (s->strm != strm) return BZ_PARAM_ERROR; while (True) { if (s->state == BZ_X_IDLE) return BZ_SEQUENCE_ERROR; if (s->state == BZ_X_OUTPUT) { if (s->smallDecompress) corrupt = unRLE_obuf_to_output_SMALL ( s ); else corrupt = unRLE_obuf_to_output_FAST ( s ); if (corrupt) return BZ_DATA_ERROR; if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) { BZ_FINALISE_CRC ( s->calculatedBlockCRC ); if (s->verbosity >= 3) VPrintf2 ( " {0x%08x, 0x%08x}", s->storedBlockCRC, s->calculatedBlockCRC ); if (s->verbosity >= 2) VPrintf0 ( "]" ); if (s->calculatedBlockCRC != s->storedBlockCRC) return BZ_DATA_ERROR; s->calculatedCombinedCRC = (s->calculatedCombinedCRC << 1) | (s->calculatedCombinedCRC >> 31); s->calculatedCombinedCRC ^= s->calculatedBlockCRC; s->state = BZ_X_BLKHDR_1; } else { return BZ_OK; } } if (s->state >= BZ_X_MAGIC_1) { Int32 r = BZ2_decompress ( s ); if (r == BZ_STREAM_END) { if (s->verbosity >= 3) VPrintf2 ( "\n combined CRCs: stored = 0x%08x, computed = 0x%08x", s->storedCombinedCRC, s->calculatedCombinedCRC ); if (s->calculatedCombinedCRC != s->storedCombinedCRC) return BZ_DATA_ERROR; return r; } if (s->state != BZ_X_OUTPUT) return r; } } AssertH ( 0, 6001 ); return 0; /*NOTREACHED*/ } /*---------------------------------------------------*/ int BZ_API(BZ2_bzDecompressEnd) ( bz_stream *strm ) { DState* s; if (strm == NULL) return BZ_PARAM_ERROR; s = strm->state; if (s == NULL) return BZ_PARAM_ERROR; if (s->strm != strm) return BZ_PARAM_ERROR; if (s->tt != NULL) BZFREE(s->tt); if (s->ll16 != NULL) BZFREE(s->ll16); if (s->ll4 != NULL) BZFREE(s->ll4); BZFREE(strm->state); strm->state = NULL; return BZ_OK; } #ifndef BZ_NO_STDIO /*---------------------------------------------------*/ /*--- File I/O stuff ---*/ /*---------------------------------------------------*/ #define BZ_SETERR(eee) \ { \ if (bzerror != NULL) *bzerror = eee; \ if (bzf != NULL) bzf->lastErr = eee; \ } typedef struct { FILE* handle; Char buf[BZ_MAX_UNUSED]; Int32 bufN; Bool writing; bz_stream strm; Int32 lastErr; Bool initialisedOk; } bzFile; /*---------------------------------------------*/ static Bool myfeof ( FILE* f ) { Int32 c = fgetc ( f ); if (c == EOF) return True; ungetc ( c, f ); return False; } /*---------------------------------------------------*/ BZFILE* BZ_API(BZ2_bzWriteOpen) ( int* bzerror, FILE* f, int blockSize100k, int verbosity, int workFactor ) { Int32 ret; bzFile* bzf = NULL; BZ_SETERR(BZ_OK); if (f == NULL || (blockSize100k < 1 || blockSize100k > 9) || (workFactor < 0 || workFactor > 250) || (verbosity < 0 || verbosity > 4)) { BZ_SETERR(BZ_PARAM_ERROR); return NULL; }; if (ferror(f)) { BZ_SETERR(BZ_IO_ERROR); return NULL; }; bzf = malloc ( sizeof(bzFile) ); if (bzf == NULL) { BZ_SETERR(BZ_MEM_ERROR); return NULL; }; BZ_SETERR(BZ_OK); bzf->initialisedOk = False; bzf->bufN = 0; bzf->handle = f; bzf->writing = True; bzf->strm.bzalloc = NULL; bzf->strm.bzfree = NULL; bzf->strm.opaque = NULL; if (workFactor == 0) workFactor = 30; ret = BZ2_bzCompressInit ( &(bzf->strm), blockSize100k, verbosity, workFactor ); if (ret != BZ_OK) { BZ_SETERR(ret); free(bzf); return NULL; }; bzf->strm.avail_in = 0; bzf->initialisedOk = True; return bzf; } /*---------------------------------------------------*/ void BZ_API(BZ2_bzWrite) ( int* bzerror, BZFILE* b, void* buf, int len ) { Int32 n, n2, ret; bzFile* bzf = (bzFile*)b; BZ_SETERR(BZ_OK); if (bzf == NULL || buf == NULL || len < 0) { BZ_SETERR(BZ_PARAM_ERROR); return; }; if (!(bzf->writing)) { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; if (ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return; }; if (len == 0) { BZ_SETERR(BZ_OK); return; }; bzf->strm.avail_in = len; bzf->strm.next_in = buf; while (True) { bzf->strm.avail_out = BZ_MAX_UNUSED; bzf->strm.next_out = bzf->buf; ret = BZ2_bzCompress ( &(bzf->strm), BZ_RUN ); if (ret != BZ_RUN_OK) { BZ_SETERR(ret); return; }; if (bzf->strm.avail_out < BZ_MAX_UNUSED) { n = BZ_MAX_UNUSED - bzf->strm.avail_out; n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), n, bzf->handle ); if (n != n2 || ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return; }; } if (bzf->strm.avail_in == 0) { BZ_SETERR(BZ_OK); return; }; } } /*---------------------------------------------------*/ void BZ_API(BZ2_bzWriteClose) ( int* bzerror, BZFILE* b, int abandon, unsigned int* nbytes_in, unsigned int* nbytes_out ) { BZ2_bzWriteClose64 ( bzerror, b, abandon, nbytes_in, NULL, nbytes_out, NULL ); } void BZ_API(BZ2_bzWriteClose64) ( int* bzerror, BZFILE* b, int abandon, unsigned int* nbytes_in_lo32, unsigned int* nbytes_in_hi32, unsigned int* nbytes_out_lo32, unsigned int* nbytes_out_hi32 ) { Int32 n, n2, ret; bzFile* bzf = (bzFile*)b; if (bzf == NULL) { BZ_SETERR(BZ_OK); return; }; if (!(bzf->writing)) { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; if (ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return; }; if (nbytes_in_lo32 != NULL) *nbytes_in_lo32 = 0; if (nbytes_in_hi32 != NULL) *nbytes_in_hi32 = 0; if (nbytes_out_lo32 != NULL) *nbytes_out_lo32 = 0; if (nbytes_out_hi32 != NULL) *nbytes_out_hi32 = 0; if ((!abandon) && bzf->lastErr == BZ_OK) { while (True) { bzf->strm.avail_out = BZ_MAX_UNUSED; bzf->strm.next_out = bzf->buf; ret = BZ2_bzCompress ( &(bzf->strm), BZ_FINISH ); if (ret != BZ_FINISH_OK && ret != BZ_STREAM_END) { BZ_SETERR(ret); return; }; if (bzf->strm.avail_out < BZ_MAX_UNUSED) { n = BZ_MAX_UNUSED - bzf->strm.avail_out; n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), n, bzf->handle ); if (n != n2 || ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return; }; } if (ret == BZ_STREAM_END) break; } } if ( !abandon && !ferror ( bzf->handle ) ) { fflush ( bzf->handle ); if (ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return; }; } if (nbytes_in_lo32 != NULL) *nbytes_in_lo32 = bzf->strm.total_in_lo32; if (nbytes_in_hi32 != NULL) *nbytes_in_hi32 = bzf->strm.total_in_hi32; if (nbytes_out_lo32 != NULL) *nbytes_out_lo32 = bzf->strm.total_out_lo32; if (nbytes_out_hi32 != NULL) *nbytes_out_hi32 = bzf->strm.total_out_hi32; BZ_SETERR(BZ_OK); BZ2_bzCompressEnd ( &(bzf->strm) ); free ( bzf ); } /*---------------------------------------------------*/ BZFILE* BZ_API(BZ2_bzReadOpen) ( int* bzerror, FILE* f, int verbosity, int small, void* unused, int nUnused ) { bzFile* bzf = NULL; int ret; BZ_SETERR(BZ_OK); if (f == NULL || (small != 0 && small != 1) || (verbosity < 0 || verbosity > 4) || (unused == NULL && nUnused != 0) || (unused != NULL && (nUnused < 0 || nUnused > BZ_MAX_UNUSED))) { BZ_SETERR(BZ_PARAM_ERROR); return NULL; }; if (ferror(f)) { BZ_SETERR(BZ_IO_ERROR); return NULL; }; bzf = malloc ( sizeof(bzFile) ); if (bzf == NULL) { BZ_SETERR(BZ_MEM_ERROR); return NULL; }; BZ_SETERR(BZ_OK); bzf->initialisedOk = False; bzf->handle = f; bzf->bufN = 0; bzf->writing = False; bzf->strm.bzalloc = NULL; bzf->strm.bzfree = NULL; bzf->strm.opaque = NULL; while (nUnused > 0) { bzf->buf[bzf->bufN] = *((UChar*)(unused)); bzf->bufN++; unused = ((void*)( 1 + ((UChar*)(unused)) )); nUnused--; } ret = BZ2_bzDecompressInit ( &(bzf->strm), verbosity, small ); if (ret != BZ_OK) { BZ_SETERR(ret); free(bzf); return NULL; }; bzf->strm.avail_in = bzf->bufN; bzf->strm.next_in = bzf->buf; bzf->initialisedOk = True; return bzf; } /*---------------------------------------------------*/ void BZ_API(BZ2_bzReadClose) ( int *bzerror, BZFILE *b ) { bzFile* bzf = (bzFile*)b; BZ_SETERR(BZ_OK); if (bzf == NULL) { BZ_SETERR(BZ_OK); return; }; if (bzf->writing) { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; if (bzf->initialisedOk) (void)BZ2_bzDecompressEnd ( &(bzf->strm) ); free ( bzf ); } /*---------------------------------------------------*/ int BZ_API(BZ2_bzRead) ( int* bzerror, BZFILE* b, void* buf, int len ) { Int32 n, ret; bzFile* bzf = (bzFile*)b; BZ_SETERR(BZ_OK); if (bzf == NULL || buf == NULL || len < 0) { BZ_SETERR(BZ_PARAM_ERROR); return 0; }; if (bzf->writing) { BZ_SETERR(BZ_SEQUENCE_ERROR); return 0; }; if (len == 0) { BZ_SETERR(BZ_OK); return 0; }; bzf->strm.avail_out = len; bzf->strm.next_out = buf; while (True) { if (ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return 0; }; if (bzf->strm.avail_in == 0 && !myfeof(bzf->handle)) { n = fread ( bzf->buf, sizeof(UChar), BZ_MAX_UNUSED, bzf->handle ); if (ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return 0; }; bzf->bufN = n; bzf->strm.avail_in = bzf->bufN; bzf->strm.next_in = bzf->buf; } ret = BZ2_bzDecompress ( &(bzf->strm) ); if (ret != BZ_OK && ret != BZ_STREAM_END) { BZ_SETERR(ret); return 0; }; if (ret == BZ_OK && myfeof(bzf->handle) && bzf->strm.avail_in == 0 && bzf->strm.avail_out > 0) { BZ_SETERR(BZ_UNEXPECTED_EOF); return 0; }; if (ret == BZ_STREAM_END) { BZ_SETERR(BZ_STREAM_END); return len - bzf->strm.avail_out; }; if (bzf->strm.avail_out == 0) { BZ_SETERR(BZ_OK); return len; }; } return 0; /*not reached*/ } /*---------------------------------------------------*/ void BZ_API(BZ2_bzReadGetUnused) ( int* bzerror, BZFILE* b, void** unused, int* nUnused ) { bzFile* bzf = (bzFile*)b; if (bzf == NULL) { BZ_SETERR(BZ_PARAM_ERROR); return; }; if (bzf->lastErr != BZ_STREAM_END) { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; if (unused == NULL || nUnused == NULL) { BZ_SETERR(BZ_PARAM_ERROR); return; }; BZ_SETERR(BZ_OK); *nUnused = bzf->strm.avail_in; *unused = bzf->strm.next_in; } #endif /*---------------------------------------------------*/ /*--- Misc convenience stuff ---*/ /*---------------------------------------------------*/ /*---------------------------------------------------*/ int BZ_API(BZ2_bzBuffToBuffCompress) ( char* dest, unsigned int* destLen, char* source, unsigned int sourceLen, int blockSize100k, int verbosity, int workFactor ) { bz_stream strm; int ret; if (dest == NULL || destLen == NULL || source == NULL || blockSize100k < 1 || blockSize100k > 9 || verbosity < 0 || verbosity > 4 || workFactor < 0 || workFactor > 250) return BZ_PARAM_ERROR; if (workFactor == 0) workFactor = 30; strm.bzalloc = NULL; strm.bzfree = NULL; strm.opaque = NULL; ret = BZ2_bzCompressInit ( &strm, blockSize100k, verbosity, workFactor ); if (ret != BZ_OK) return ret; strm.next_in = source; strm.next_out = dest; strm.avail_in = sourceLen; strm.avail_out = *destLen; ret = BZ2_bzCompress ( &strm, BZ_FINISH ); if (ret == BZ_FINISH_OK) goto output_overflow; if (ret != BZ_STREAM_END) goto errhandler; /* normal termination */ *destLen -= strm.avail_out; BZ2_bzCompressEnd ( &strm ); return BZ_OK; output_overflow: BZ2_bzCompressEnd ( &strm ); return BZ_OUTBUFF_FULL; errhandler: BZ2_bzCompressEnd ( &strm ); return ret; } /*---------------------------------------------------*/ int BZ_API(BZ2_bzBuffToBuffDecompress) ( char* dest, unsigned int* destLen, char* source, unsigned int sourceLen, int small, int verbosity ) { bz_stream strm; int ret; if (dest == NULL || destLen == NULL || source == NULL || (small != 0 && small != 1) || verbosity < 0 || verbosity > 4) return BZ_PARAM_ERROR; strm.bzalloc = NULL; strm.bzfree = NULL; strm.opaque = NULL; ret = BZ2_bzDecompressInit ( &strm, verbosity, small ); if (ret != BZ_OK) return ret; strm.next_in = source; strm.next_out = dest; strm.avail_in = sourceLen; strm.avail_out = *destLen; ret = BZ2_bzDecompress ( &strm ); if (ret == BZ_OK) goto output_overflow_or_eof; if (ret != BZ_STREAM_END) goto errhandler; /* normal termination */ *destLen -= strm.avail_out; BZ2_bzDecompressEnd ( &strm ); return BZ_OK; output_overflow_or_eof: if (strm.avail_out > 0) { BZ2_bzDecompressEnd ( &strm ); return BZ_UNEXPECTED_EOF; } else { BZ2_bzDecompressEnd ( &strm ); return BZ_OUTBUFF_FULL; }; errhandler: BZ2_bzDecompressEnd ( &strm ); return ret; } /*---------------------------------------------------*/ /*-- Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp) to support better zlib compatibility. This code is not _officially_ part of libbzip2 (yet); I haven't tested it, documented it, or considered the threading-safeness of it. If this code breaks, please contact both Yoshioka and me. --*/ /*---------------------------------------------------*/ /*---------------------------------------------------*/ /*-- return version like "0.9.5d, 4-Sept-1999". --*/ const char * BZ_API(BZ2_bzlibVersion)(void) { return BZ_VERSION; } #ifndef BZ_NO_STDIO /*---------------------------------------------------*/ #if defined(_WIN32) || defined(OS2) || defined(MSDOS) # include <fcntl.h> # include <io.h> # define SET_BINARY_MODE(file) setmode(fileno(file),O_BINARY) #else # define SET_BINARY_MODE(file) #endif static BZFILE * bzopen_or_bzdopen ( const char *path, /* no use when bzdopen */ int fd, /* no use when bzdopen */ const char *mode, int open_mode) /* bzopen: 0, bzdopen:1 */ { int bzerr; char unused[BZ_MAX_UNUSED]; int blockSize100k = 9; int writing = 0; char mode2[10] = ""; FILE *fp = NULL; BZFILE *bzfp = NULL; int verbosity = 0; int workFactor = 30; int smallMode = 0; int nUnused = 0; if (mode == NULL) return NULL; while (*mode) { switch (*mode) { case 'r': writing = 0; break; case 'w': writing = 1; break; case 's': smallMode = 1; break; default: if (isdigit((int)(*mode))) { blockSize100k = *mode-BZ_HDR_0; } } mode++; } strcat(mode2, writing ? "w" : "r" ); strcat(mode2,"b"); /* binary mode */ if (open_mode==0) { if (path==NULL || strcmp(path,"")==0) { fp = (writing ? stdout : stdin); SET_BINARY_MODE(fp); } else { fp = fopen(path,mode2); } } else { #ifdef BZ_STRICT_ANSI fp = NULL; #else fp = fdopen(fd,mode2); #endif } if (fp == NULL) return NULL; if (writing) { /* Guard against total chaos and anarchy -- JRS */ if (blockSize100k < 1) blockSize100k = 1; if (blockSize100k > 9) blockSize100k = 9; bzfp = BZ2_bzWriteOpen(&bzerr,fp,blockSize100k, verbosity,workFactor); } else { bzfp = BZ2_bzReadOpen(&bzerr,fp,verbosity,smallMode, unused,nUnused); } if (bzfp == NULL) { if (fp != stdin && fp != stdout) fclose(fp); return NULL; } return bzfp; } /*---------------------------------------------------*/ /*-- open file for read or write. ex) bzopen("file","w9") case path="" or NULL => use stdin or stdout. --*/ BZFILE * BZ_API(BZ2_bzopen) ( const char *path, const char *mode ) { return bzopen_or_bzdopen(path,-1,mode,/*bzopen*/0); } /*---------------------------------------------------*/ BZFILE * BZ_API(BZ2_bzdopen) ( int fd, const char *mode ) { return bzopen_or_bzdopen(NULL,fd,mode,/*bzdopen*/1); } /*---------------------------------------------------*/ int BZ_API(BZ2_bzread) (BZFILE* b, void* buf, int len ) { int bzerr, nread; if (((bzFile*)b)->lastErr == BZ_STREAM_END) return 0; nread = BZ2_bzRead(&bzerr,b,buf,len); if (bzerr == BZ_OK || bzerr == BZ_STREAM_END) { return nread; } else { return -1; } } /*---------------------------------------------------*/ int BZ_API(BZ2_bzwrite) (BZFILE* b, void* buf, int len ) { int bzerr; BZ2_bzWrite(&bzerr,b,buf,len); if(bzerr == BZ_OK){ return len; }else{ return -1; } } /*---------------------------------------------------*/ int BZ_API(BZ2_bzflush) (GNUC_UNUSED BZFILE *b) { /* do nothing now... */ return 0; } /*---------------------------------------------------*/ void BZ_API(BZ2_bzclose) (BZFILE* b) { int bzerr; FILE *fp; if (b==NULL) {return;} fp = ((bzFile *)b)->handle; if(((bzFile*)b)->writing){ BZ2_bzWriteClose(&bzerr,b,0,NULL,NULL); if(bzerr != BZ_OK){ BZ2_bzWriteClose(NULL,b,1,NULL,NULL); } }else{ BZ2_bzReadClose(&bzerr,b); } if(fp!=stdin && fp!=stdout){ fclose(fp); } } /*---------------------------------------------------*/ /*-- return last error code --*/ static const char *bzerrorstrings[] = { "OK" ,"SEQUENCE_ERROR" ,"PARAM_ERROR" ,"MEM_ERROR" ,"DATA_ERROR" ,"DATA_ERROR_MAGIC" ,"IO_ERROR" ,"UNEXPECTED_EOF" ,"OUTBUFF_FULL" ,"CONFIG_ERROR" ,"???" /* for future */ ,"???" /* for future */ ,"???" /* for future */ ,"???" /* for future */ ,"???" /* for future */ ,"???" /* for future */ }; const char * BZ_API(BZ2_bzerror) (BZFILE *b, int *errnum) { int err = ((bzFile *)b)->lastErr; if(err>0) err = 0; *errnum = err; return bzerrorstrings[err*-1]; } #endif /*-------------------------------------------------------------*/ /*--- end bzlib.c ---*/ /*-------------------------------------------------------------*/ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/bzip2/blocksort.c������������������������������������������������0000644�0001750�0001750�00000073746�12320456500�021621� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /*-------------------------------------------------------------*/ /*--- Block sorting machinery ---*/ /*--- blocksort.c ---*/ /*-------------------------------------------------------------*/ /* ------------------------------------------------------------------ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. bzip2/libbzip2 version 1.0.5 of 10 December 2007 Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained in the file LICENSE. ------------------------------------------------------------------ */ #include "bzlib_private.h" /*---------------------------------------------*/ /*--- Fallback O(N log(N)^2) sorting ---*/ /*--- algorithm, for repetitive blocks ---*/ /*---------------------------------------------*/ /*---------------------------------------------*/ static __inline__ void fallbackSimpleSort ( UInt32* fmap, UInt32* eclass, Int32 lo, Int32 hi ) { Int32 i, j, tmp; UInt32 ec_tmp; if (lo == hi) return; if (hi - lo > 3) { for ( i = hi-4; i >= lo; i-- ) { tmp = fmap[i]; ec_tmp = eclass[tmp]; for ( j = i+4; j <= hi && ec_tmp > eclass[fmap[j]]; j += 4 ) fmap[j-4] = fmap[j]; fmap[j-4] = tmp; } } for ( i = hi-1; i >= lo; i-- ) { tmp = fmap[i]; ec_tmp = eclass[tmp]; for ( j = i+1; j <= hi && ec_tmp > eclass[fmap[j]]; j++ ) fmap[j-1] = fmap[j]; fmap[j-1] = tmp; } } /*---------------------------------------------*/ #define fswap(zz1, zz2) \ { Int32 zztmp = zz1; zz1 = zz2; zz2 = zztmp; } #define fvswap(zzp1, zzp2, zzn) \ { \ Int32 yyp1 = (zzp1); \ Int32 yyp2 = (zzp2); \ Int32 yyn = (zzn); \ while (yyn > 0) { \ fswap(fmap[yyp1], fmap[yyp2]); \ yyp1++; yyp2++; yyn--; \ } \ } #define fmin(a,b) ((a) < (b)) ? (a) : (b) #define fpush(lz,hz) { stackLo[sp] = lz; \ stackHi[sp] = hz; \ sp++; } #define fpop(lz,hz) { sp--; \ lz = stackLo[sp]; \ hz = stackHi[sp]; } #define FALLBACK_QSORT_SMALL_THRESH 10 #define FALLBACK_QSORT_STACK_SIZE 100 static void fallbackQSort3 ( UInt32* fmap, UInt32* eclass, Int32 loSt, Int32 hiSt ) { Int32 unLo, unHi, ltLo, gtHi, n, m; Int32 sp, lo, hi; UInt32 med, r, r3; Int32 stackLo[FALLBACK_QSORT_STACK_SIZE]; Int32 stackHi[FALLBACK_QSORT_STACK_SIZE]; r = 0; sp = 0; fpush ( loSt, hiSt ); while (sp > 0) { AssertH ( sp < FALLBACK_QSORT_STACK_SIZE - 1, 1004 ); fpop ( lo, hi ); if (hi - lo < FALLBACK_QSORT_SMALL_THRESH) { fallbackSimpleSort ( fmap, eclass, lo, hi ); continue; } /* Random partitioning. Median of 3 sometimes fails to avoid bad cases. Median of 9 seems to help but looks rather expensive. This too seems to work but is cheaper. Guidance for the magic constants 7621 and 32768 is taken from Sedgewick's algorithms book, chapter 35. */ r = ((r * 7621) + 1) % 32768; r3 = r % 3; if (r3 == 0) med = eclass[fmap[lo]]; else if (r3 == 1) med = eclass[fmap[(lo+hi)>>1]]; else med = eclass[fmap[hi]]; unLo = ltLo = lo; unHi = gtHi = hi; while (1) { while (1) { if (unLo > unHi) break; n = (Int32)eclass[fmap[unLo]] - (Int32)med; if (n == 0) { fswap(fmap[unLo], fmap[ltLo]); ltLo++; unLo++; continue; }; if (n > 0) break; unLo++; } while (1) { if (unLo > unHi) break; n = (Int32)eclass[fmap[unHi]] - (Int32)med; if (n == 0) { fswap(fmap[unHi], fmap[gtHi]); gtHi--; unHi--; continue; }; if (n < 0) break; unHi--; } if (unLo > unHi) break; fswap(fmap[unLo], fmap[unHi]); unLo++; unHi--; } AssertD ( unHi == unLo-1, "fallbackQSort3(2)" ); if (gtHi < ltLo) continue; n = fmin(ltLo-lo, unLo-ltLo); fvswap(lo, unLo-n, n); m = fmin(hi-gtHi, gtHi-unHi); fvswap(unLo, hi-m+1, m); n = lo + unLo - ltLo - 1; m = hi - (gtHi - unHi) + 1; if (n - lo > hi - m) { fpush ( lo, n ); fpush ( m, hi ); } else { fpush ( m, hi ); fpush ( lo, n ); } } } #undef fmin #undef fpush #undef fpop #undef fswap #undef fvswap #undef FALLBACK_QSORT_SMALL_THRESH #undef FALLBACK_QSORT_STACK_SIZE /*---------------------------------------------*/ /* Pre: nblock > 0 eclass exists for [0 .. nblock-1] ((UChar*)eclass) [0 .. nblock-1] holds block ptr exists for [0 .. nblock-1] Post: ((UChar*)eclass) [0 .. nblock-1] holds block All other areas of eclass destroyed fmap [0 .. nblock-1] holds sorted order bhtab [ 0 .. 2+(nblock/32) ] destroyed */ #define SET_BH(zz) bhtab[(zz) >> 5] |= (1 << ((zz) & 31)) #define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~(1 << ((zz) & 31)) #define ISSET_BH(zz) (bhtab[(zz) >> 5] & (1 << ((zz) & 31))) #define WORD_BH(zz) bhtab[(zz) >> 5] #define UNALIGNED_BH(zz) ((zz) & 0x01f) static void fallbackSort ( UInt32* fmap, UInt32* eclass, UInt32* bhtab, Int32 nblock, Int32 verb ) { Int32 ftab[257]; Int32 ftabCopy[256]; Int32 H, i, j, k, l, r, cc, cc1; Int32 nNotDone; Int32 nBhtab; UChar* eclass8 = (UChar*)eclass; /*-- Initial 1-char radix sort to generate initial fmap and initial BH bits. --*/ if (verb >= 4) VPrintf0 ( " bucket sorting ...\n" ); for (i = 0; i < 257; i++) ftab[i] = 0; for (i = 0; i < nblock; i++) ftab[eclass8[i]]++; for (i = 0; i < 256; i++) ftabCopy[i] = ftab[i]; for (i = 1; i < 257; i++) ftab[i] += ftab[i-1]; for (i = 0; i < nblock; i++) { j = eclass8[i]; k = ftab[j] - 1; ftab[j] = k; fmap[k] = i; } nBhtab = 2 + (nblock / 32); for (i = 0; i < nBhtab; i++) bhtab[i] = 0; for (i = 0; i < 256; i++) SET_BH(ftab[i]); /*-- Inductively refine the buckets. Kind-of an "exponential radix sort" (!), inspired by the Manber-Myers suffix array construction algorithm. --*/ /*-- set sentinel bits for block-end detection --*/ for (i = 0; i < 32; i++) { SET_BH(nblock + 2*i); CLEAR_BH(nblock + 2*i + 1); } /*-- the log(N) loop --*/ H = 1; while (1) { if (verb >= 4) VPrintf1 ( " depth %6d has ", H ); j = 0; for (i = 0; i < nblock; i++) { if (ISSET_BH(i)) j = i; k = fmap[i] - H; if (k < 0) k += nblock; eclass[k] = j; } nNotDone = 0; r = -1; while (1) { /*-- find the next non-singleton bucket --*/ k = r + 1; while (ISSET_BH(k) && UNALIGNED_BH(k)) k++; if (ISSET_BH(k)) { while (WORD_BH(k) == 0xffffffff) k += 32; while (ISSET_BH(k)) k++; } l = k - 1; if (l >= nblock) break; while (!ISSET_BH(k) && UNALIGNED_BH(k)) k++; if (!ISSET_BH(k)) { while (WORD_BH(k) == 0x00000000) k += 32; while (!ISSET_BH(k)) k++; } r = k - 1; if (r >= nblock) break; /*-- now [l, r] bracket current bucket --*/ if (r > l) { nNotDone += (r - l + 1); fallbackQSort3 ( fmap, eclass, l, r ); /*-- scan bucket and generate header bits-- */ cc = -1; for (i = l; i <= r; i++) { cc1 = eclass[fmap[i]]; if (cc != cc1) { SET_BH(i); cc = cc1; }; } } } if (verb >= 4) VPrintf1 ( "%6d unresolved strings\n", nNotDone ); H *= 2; if (H > nblock || nNotDone == 0) break; } /*-- Reconstruct the original block in eclass8 [0 .. nblock-1], since the previous phase destroyed it. --*/ if (verb >= 4) VPrintf0 ( " reconstructing block ...\n" ); j = 0; for (i = 0; i < nblock; i++) { while (ftabCopy[j] == 0) j++; ftabCopy[j]--; eclass8[fmap[i]] = (UChar)j; } AssertH ( j < 256, 1005 ); } #undef SET_BH #undef CLEAR_BH #undef ISSET_BH #undef WORD_BH #undef UNALIGNED_BH /*---------------------------------------------*/ /*--- The main, O(N^2 log(N)) sorting ---*/ /*--- algorithm. Faster for "normal" ---*/ /*--- non-repetitive blocks. ---*/ /*---------------------------------------------*/ /*---------------------------------------------*/ static __inline__ Bool mainGtU ( UInt32 i1, UInt32 i2, UChar* block, UInt16* quadrant, UInt32 nblock, Int32* budget ) { Int32 k; UChar c1, c2; UInt16 s1, s2; AssertD ( i1 != i2, "mainGtU" ); /* 1 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 2 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 3 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 4 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 5 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 6 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 7 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 8 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 9 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 10 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 11 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 12 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; k = nblock + 8; do { /* 1 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); s1 = quadrant[i1]; s2 = quadrant[i2]; if (s1 != s2) return (s1 > s2); i1++; i2++; /* 2 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); s1 = quadrant[i1]; s2 = quadrant[i2]; if (s1 != s2) return (s1 > s2); i1++; i2++; /* 3 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); s1 = quadrant[i1]; s2 = quadrant[i2]; if (s1 != s2) return (s1 > s2); i1++; i2++; /* 4 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); s1 = quadrant[i1]; s2 = quadrant[i2]; if (s1 != s2) return (s1 > s2); i1++; i2++; /* 5 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); s1 = quadrant[i1]; s2 = quadrant[i2]; if (s1 != s2) return (s1 > s2); i1++; i2++; /* 6 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); s1 = quadrant[i1]; s2 = quadrant[i2]; if (s1 != s2) return (s1 > s2); i1++; i2++; /* 7 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); s1 = quadrant[i1]; s2 = quadrant[i2]; if (s1 != s2) return (s1 > s2); i1++; i2++; /* 8 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); s1 = quadrant[i1]; s2 = quadrant[i2]; if (s1 != s2) return (s1 > s2); i1++; i2++; if (i1 >= nblock) i1 -= nblock; if (i2 >= nblock) i2 -= nblock; k -= 8; (*budget)--; } while (k >= 0); return False; } /*---------------------------------------------*/ /*-- Knuth's increments seem to work better than Incerpi-Sedgewick here. Possibly because the number of elems to sort is usually small, typically <= 20. --*/ static Int32 incs[14] = { 1, 4, 13, 40, 121, 364, 1093, 3280, 9841, 29524, 88573, 265720, 797161, 2391484 }; static void mainSimpleSort ( UInt32* ptr, UChar* block, UInt16* quadrant, Int32 nblock, Int32 lo, Int32 hi, Int32 d, Int32* budget ) { Int32 i, j, h, bigN, hp; UInt32 v; bigN = hi - lo + 1; if (bigN < 2) return; hp = 0; while (incs[hp] < bigN) hp++; hp--; for (; hp >= 0; hp--) { h = incs[hp]; i = lo + h; while (True) { /*-- copy 1 --*/ if (i > hi) break; v = ptr[i]; j = i; while ( mainGtU ( ptr[j-h]+d, v+d, block, quadrant, nblock, budget ) ) { ptr[j] = ptr[j-h]; j = j - h; if (j <= (lo + h - 1)) break; } ptr[j] = v; i++; /*-- copy 2 --*/ if (i > hi) break; v = ptr[i]; j = i; while ( mainGtU ( ptr[j-h]+d, v+d, block, quadrant, nblock, budget ) ) { ptr[j] = ptr[j-h]; j = j - h; if (j <= (lo + h - 1)) break; } ptr[j] = v; i++; /*-- copy 3 --*/ if (i > hi) break; v = ptr[i]; j = i; while ( mainGtU ( ptr[j-h]+d, v+d, block, quadrant, nblock, budget ) ) { ptr[j] = ptr[j-h]; j = j - h; if (j <= (lo + h - 1)) break; } ptr[j] = v; i++; if (*budget < 0) return; } } } /*---------------------------------------------*/ /*-- The following is an implementation of an elegant 3-way quicksort for strings, described in a paper "Fast Algorithms for Sorting and Searching Strings", by Robert Sedgewick and Jon L. Bentley. --*/ #define mswap(zz1, zz2) \ { Int32 zztmp = zz1; zz1 = zz2; zz2 = zztmp; } #define mvswap(zzp1, zzp2, zzn) \ { \ Int32 yyp1 = (zzp1); \ Int32 yyp2 = (zzp2); \ Int32 yyn = (zzn); \ while (yyn > 0) { \ mswap(ptr[yyp1], ptr[yyp2]); \ yyp1++; yyp2++; yyn--; \ } \ } static __inline__ UChar mmed3 ( UChar a, UChar b, UChar c ) { UChar t; if (a > b) { t = a; a = b; b = t; }; if (b > c) { b = c; if (a > b) b = a; } return b; } #define mmin(a,b) ((a) < (b)) ? (a) : (b) #define mpush(lz,hz,dz) { stackLo[sp] = lz; \ stackHi[sp] = hz; \ stackD [sp] = dz; \ sp++; } #define mpop(lz,hz,dz) { sp--; \ lz = stackLo[sp]; \ hz = stackHi[sp]; \ dz = stackD [sp]; } #define mnextsize(az) (nextHi[az]-nextLo[az]) #define mnextswap(az,bz) \ { Int32 tz; \ tz = nextLo[az]; nextLo[az] = nextLo[bz]; nextLo[bz] = tz; \ tz = nextHi[az]; nextHi[az] = nextHi[bz]; nextHi[bz] = tz; \ tz = nextD [az]; nextD [az] = nextD [bz]; nextD [bz] = tz; } #define MAIN_QSORT_SMALL_THRESH 20 #define MAIN_QSORT_DEPTH_THRESH (BZ_N_RADIX + BZ_N_QSORT) #define MAIN_QSORT_STACK_SIZE 100 static void mainQSort3 ( UInt32* ptr, UChar* block, UInt16* quadrant, Int32 nblock, Int32 loSt, Int32 hiSt, Int32 dSt, Int32* budget ) { Int32 unLo, unHi, ltLo, gtHi, n, m, med; Int32 sp, lo, hi, d; Int32 stackLo[MAIN_QSORT_STACK_SIZE]; Int32 stackHi[MAIN_QSORT_STACK_SIZE]; Int32 stackD [MAIN_QSORT_STACK_SIZE]; Int32 nextLo[3]; Int32 nextHi[3]; Int32 nextD [3]; sp = 0; mpush ( loSt, hiSt, dSt ); while (sp > 0) { AssertH ( sp < MAIN_QSORT_STACK_SIZE - 2, 1001 ); mpop ( lo, hi, d ); if (hi - lo < MAIN_QSORT_SMALL_THRESH || d > MAIN_QSORT_DEPTH_THRESH) { mainSimpleSort ( ptr, block, quadrant, nblock, lo, hi, d, budget ); if (*budget < 0) return; continue; } med = (Int32) mmed3 ( block[ptr[ lo ]+d], block[ptr[ hi ]+d], block[ptr[ (lo+hi)>>1 ]+d] ); unLo = ltLo = lo; unHi = gtHi = hi; while (True) { while (True) { if (unLo > unHi) break; n = ((Int32)block[ptr[unLo]+d]) - med; if (n == 0) { mswap(ptr[unLo], ptr[ltLo]); ltLo++; unLo++; continue; }; if (n > 0) break; unLo++; } while (True) { if (unLo > unHi) break; n = ((Int32)block[ptr[unHi]+d]) - med; if (n == 0) { mswap(ptr[unHi], ptr[gtHi]); gtHi--; unHi--; continue; }; if (n < 0) break; unHi--; } if (unLo > unHi) break; mswap(ptr[unLo], ptr[unHi]); unLo++; unHi--; } AssertD ( unHi == unLo-1, "mainQSort3(2)" ); if (gtHi < ltLo) { mpush(lo, hi, d+1 ); continue; } n = mmin(ltLo-lo, unLo-ltLo); mvswap(lo, unLo-n, n); m = mmin(hi-gtHi, gtHi-unHi); mvswap(unLo, hi-m+1, m); n = lo + unLo - ltLo - 1; m = hi - (gtHi - unHi) + 1; nextLo[0] = lo; nextHi[0] = n; nextD[0] = d; nextLo[1] = m; nextHi[1] = hi; nextD[1] = d; nextLo[2] = n+1; nextHi[2] = m-1; nextD[2] = d+1; if (mnextsize(0) < mnextsize(1)) mnextswap(0,1); if (mnextsize(1) < mnextsize(2)) mnextswap(1,2); if (mnextsize(0) < mnextsize(1)) mnextswap(0,1); AssertD (mnextsize(0) >= mnextsize(1), "mainQSort3(8)" ); AssertD (mnextsize(1) >= mnextsize(2), "mainQSort3(9)" ); mpush (nextLo[0], nextHi[0], nextD[0]); mpush (nextLo[1], nextHi[1], nextD[1]); mpush (nextLo[2], nextHi[2], nextD[2]); } } #undef mswap #undef mvswap #undef mpush #undef mpop #undef mmin #undef mnextsize #undef mnextswap #undef MAIN_QSORT_SMALL_THRESH #undef MAIN_QSORT_DEPTH_THRESH #undef MAIN_QSORT_STACK_SIZE /*---------------------------------------------*/ /* Pre: nblock > N_OVERSHOOT block32 exists for [0 .. nblock-1 +N_OVERSHOOT] ((UChar*)block32) [0 .. nblock-1] holds block ptr exists for [0 .. nblock-1] Post: ((UChar*)block32) [0 .. nblock-1] holds block All other areas of block32 destroyed ftab [0 .. 65536 ] destroyed ptr [0 .. nblock-1] holds sorted order if (*budget < 0), sorting was abandoned */ #define BIGFREQ(b) (ftab[((b)+1) << 8] - ftab[(b) << 8]) #define SETMASK (1 << 21) #define CLEARMASK (~(SETMASK)) static void mainSort ( UInt32* ptr, UChar* block, UInt16* quadrant, UInt32* ftab, Int32 nblock, Int32 verb, Int32* budget ) { Int32 i, j, k, ss, sb; Int32 runningOrder[256]; Bool bigDone[256]; Int32 copyStart[256]; Int32 copyEnd [256]; UChar c1; Int32 numQSorted; UInt16 s; if (verb >= 4) VPrintf0 ( " main sort initialise ...\n" ); /*-- set up the 2-byte frequency table --*/ for (i = 65536; i >= 0; i--) ftab[i] = 0; j = block[0] << 8; i = nblock-1; for (; i >= 3; i -= 4) { quadrant[i] = 0; j = (j >> 8) | ( ((UInt16)block[i]) << 8); ftab[j]++; quadrant[i-1] = 0; j = (j >> 8) | ( ((UInt16)block[i-1]) << 8); ftab[j]++; quadrant[i-2] = 0; j = (j >> 8) | ( ((UInt16)block[i-2]) << 8); ftab[j]++; quadrant[i-3] = 0; j = (j >> 8) | ( ((UInt16)block[i-3]) << 8); ftab[j]++; } for (; i >= 0; i--) { quadrant[i] = 0; j = (j >> 8) | ( ((UInt16)block[i]) << 8); ftab[j]++; } /*-- (emphasises close relationship of block & quadrant) --*/ for (i = 0; i < BZ_N_OVERSHOOT; i++) { block [nblock+i] = block[i]; quadrant[nblock+i] = 0; } if (verb >= 4) VPrintf0 ( " bucket sorting ...\n" ); /*-- Complete the initial radix sort --*/ for (i = 1; i <= 65536; i++) ftab[i] += ftab[i-1]; s = block[0] << 8; i = nblock-1; for (; i >= 3; i -= 4) { s = (s >> 8) | (block[i] << 8); j = ftab[s] -1; ftab[s] = j; ptr[j] = i; s = (s >> 8) | (block[i-1] << 8); j = ftab[s] -1; ftab[s] = j; ptr[j] = i-1; s = (s >> 8) | (block[i-2] << 8); j = ftab[s] -1; ftab[s] = j; ptr[j] = i-2; s = (s >> 8) | (block[i-3] << 8); j = ftab[s] -1; ftab[s] = j; ptr[j] = i-3; } for (; i >= 0; i--) { s = (s >> 8) | (block[i] << 8); j = ftab[s] -1; ftab[s] = j; ptr[j] = i; } /*-- Now ftab contains the first loc of every small bucket. Calculate the running order, from smallest to largest big bucket. --*/ for (i = 0; i <= 255; i++) { bigDone [i] = False; runningOrder[i] = i; } { Int32 vv; Int32 h = 1; do h = 3 * h + 1; while (h <= 256); do { h = h / 3; for (i = h; i <= 255; i++) { vv = runningOrder[i]; j = i; while ( BIGFREQ(runningOrder[j-h]) > BIGFREQ(vv) ) { runningOrder[j] = runningOrder[j-h]; j = j - h; if (j <= (h - 1)) goto zero; } zero: runningOrder[j] = vv; } } while (h != 1); } /*-- The main sorting loop. --*/ numQSorted = 0; for (i = 0; i <= 255; i++) { /*-- Process big buckets, starting with the least full. Basically this is a 3-step process in which we call mainQSort3 to sort the small buckets [ss, j], but also make a big effort to avoid the calls if we can. --*/ ss = runningOrder[i]; /*-- Step 1: Complete the big bucket [ss] by quicksorting any unsorted small buckets [ss, j], for j != ss. Hopefully previous pointer-scanning phases have already completed many of the small buckets [ss, j], so we don't have to sort them at all. --*/ for (j = 0; j <= 255; j++) { if (j != ss) { sb = (ss << 8) + j; if ( ! (ftab[sb] & SETMASK) ) { Int32 lo = ftab[sb] & CLEARMASK; Int32 hi = (ftab[sb+1] & CLEARMASK) - 1; if (hi > lo) { if (verb >= 4) VPrintf4 ( " qsort [0x%x, 0x%x] " "done %d this %d\n", ss, j, numQSorted, hi - lo + 1 ); mainQSort3 ( ptr, block, quadrant, nblock, lo, hi, BZ_N_RADIX, budget ); numQSorted += (hi - lo + 1); if (*budget < 0) return; } } ftab[sb] |= SETMASK; } } AssertH ( !bigDone[ss], 1006 ); /*-- Step 2: Now scan this big bucket [ss] so as to synthesise the sorted order for small buckets [t, ss] for all t, including, magically, the bucket [ss,ss] too. This will avoid doing Real Work in subsequent Step 1's. --*/ { for (j = 0; j <= 255; j++) { copyStart[j] = ftab[(j << 8) + ss] & CLEARMASK; copyEnd [j] = (ftab[(j << 8) + ss + 1] & CLEARMASK) - 1; } for (j = ftab[ss << 8] & CLEARMASK; j < copyStart[ss]; j++) { k = ptr[j]-1; if (k < 0) k += nblock; c1 = block[k]; if (!bigDone[c1]) ptr[ copyStart[c1]++ ] = k; } for (j = (ftab[(ss+1) << 8] & CLEARMASK) - 1; j > copyEnd[ss]; j--) { k = ptr[j]-1; if (k < 0) k += nblock; c1 = block[k]; if (!bigDone[c1]) ptr[ copyEnd[c1]-- ] = k; } } AssertH ( (copyStart[ss]-1 == copyEnd[ss]) || /* Extremely rare case missing in bzip2-1.0.0 and 1.0.1. Necessity for this case is demonstrated by compressing a sequence of approximately 48.5 million of character 251; 1.0.0/1.0.1 will then die here. */ (copyStart[ss] == 0 && copyEnd[ss] == nblock-1), 1007 ) for (j = 0; j <= 255; j++) ftab[(j << 8) + ss] |= SETMASK; /*-- Step 3: The [ss] big bucket is now done. Record this fact, and update the quadrant descriptors. Remember to update quadrants in the overshoot area too, if necessary. The "if (i < 255)" test merely skips this updating for the last bucket processed, since updating for the last bucket is pointless. The quadrant array provides a way to incrementally cache sort orderings, as they appear, so as to make subsequent comparisons in fullGtU() complete faster. For repetitive blocks this makes a big difference (but not big enough to be able to avoid the fallback sorting mechanism, exponential radix sort). The precise meaning is: at all times: for 0 <= i < nblock and 0 <= j <= nblock if block[i] != block[j], then the relative values of quadrant[i] and quadrant[j] are meaningless. else { if quadrant[i] < quadrant[j] then the string starting at i lexicographically precedes the string starting at j else if quadrant[i] > quadrant[j] then the string starting at j lexicographically precedes the string starting at i else the relative ordering of the strings starting at i and j has not yet been determined. } --*/ bigDone[ss] = True; if (i < 255) { Int32 bbStart = ftab[ss << 8] & CLEARMASK; Int32 bbSize = (ftab[(ss+1) << 8] & CLEARMASK) - bbStart; Int32 shifts = 0; while ((bbSize >> shifts) > 65534) shifts++; for (j = bbSize-1; j >= 0; j--) { Int32 a2update = ptr[bbStart + j]; UInt16 qVal = (UInt16)(j >> shifts); quadrant[a2update] = qVal; if (a2update < BZ_N_OVERSHOOT) quadrant[a2update + nblock] = qVal; } AssertH ( ((bbSize-1) >> shifts) <= 65535, 1002 ); } } if (verb >= 4) VPrintf3 ( " %d pointers, %d sorted, %d scanned\n", nblock, numQSorted, nblock - numQSorted ); } #undef BIGFREQ #undef SETMASK #undef CLEARMASK /*---------------------------------------------*/ /* Pre: nblock > 0 arr2 exists for [0 .. nblock-1 +N_OVERSHOOT] ((UChar*)arr2) [0 .. nblock-1] holds block arr1 exists for [0 .. nblock-1] Post: ((UChar*)arr2) [0 .. nblock-1] holds block All other areas of block destroyed ftab [ 0 .. 65536 ] destroyed arr1 [0 .. nblock-1] holds sorted order */ void BZ2_blockSort ( EState* s ) { UInt32* ptr = s->ptr; UChar* block = s->block; UInt32* ftab = s->ftab; Int32 nblock = s->nblock; Int32 verb = s->verbosity; Int32 wfact = s->workFactor; UInt16* quadrant; Int32 budget; Int32 budgetInit; Int32 i; if (nblock < 10000) { fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb ); } else { /* Calculate the location for quadrant, remembering to get the alignment right. Assumes that &(block[0]) is at least 2-byte aligned -- this should be ok since block is really the first section of arr2. */ i = nblock+BZ_N_OVERSHOOT; if (i & 1) i++; quadrant = (UInt16*)(&(block[i])); /* (wfact-1) / 3 puts the default-factor-30 transition point at very roughly the same place as with v0.1 and v0.9.0. Not that it particularly matters any more, since the resulting compressed stream is now the same regardless of whether or not we use the main sort or fallback sort. */ if (wfact < 1 ) wfact = 1; if (wfact > 100) wfact = 100; budgetInit = nblock * ((wfact-1) / 3); budget = budgetInit; mainSort ( ptr, block, quadrant, ftab, nblock, verb, &budget ); if (verb >= 3) VPrintf3 ( " %d work, %d block, ratio %5.2f\n", budgetInit - budget, nblock, (float)(budgetInit - budget) / (float)(nblock==0 ? 1 : nblock) ); if (budget < 0) { if (verb >= 2) VPrintf0 ( " too repetitive; using fallback" " sorting algorithm\n" ); fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb ); } } s->origPtr = -1; for (i = 0; i < s->nblock; i++) if (ptr[i] == 0) { s->origPtr = i; break; }; AssertH( s->origPtr != -1, 1003 ); } /*-------------------------------------------------------------*/ /*--- end blocksort.c ---*/ /*-------------------------------------------------------------*/ ��������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/bzip2/bzdiff�����������������������������������������������������0000644�0001750�0001750�00000004120�12320456500�020616� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh # Bzcmp/diff wrapped for bzip2, # adapted from zdiff by Philippe Troin <phil@fifi.org> for Debian GNU/Linux. # Bzcmp and bzdiff are used to invoke the cmp or the diff pro- # gram on compressed files. All options specified are passed # directly to cmp or diff. If only 1 file is specified, then # the files compared are file1 and an uncompressed file1.gz. # If two files are specified, then they are uncompressed (if # necessary) and fed to cmp or diff. The exit status from cmp # or diff is preserved. PATH="/usr/bin:/bin:$PATH"; export PATH prog=`echo $0 | sed 's|.*/||'` case "$prog" in *cmp) comp=${CMP-cmp} ;; *) comp=${DIFF-diff} ;; esac OPTIONS= FILES= for ARG do case "$ARG" in -*) OPTIONS="$OPTIONS $ARG";; *) if test -f "$ARG"; then FILES="$FILES $ARG" else echo "${prog}: $ARG not found or not a regular file" exit 1 fi ;; esac done if test -z "$FILES"; then echo "Usage: $prog [${comp}_options] file [file]" exit 1 fi tmp=`mktemp ${TMPDIR:-/tmp}/bzdiff.XXXXXXXXXX` || { echo 'cannot create a temporary file' >&2 exit 1 } set $FILES if test $# -eq 1; then FILE=`echo "$1" | sed 's/.bz2$//'` bzip2 -cd "$FILE.bz2" | $comp $OPTIONS - "$FILE" STAT="$?" elif test $# -eq 2; then case "$1" in *.bz2) case "$2" in *.bz2) F=`echo "$2" | sed 's|.*/||;s|.bz2$||'` bzip2 -cdfq "$2" > $tmp bzip2 -cdfq "$1" | $comp $OPTIONS - $tmp STAT="$?" /bin/rm -f $tmp;; *) bzip2 -cdfq "$1" | $comp $OPTIONS - "$2" STAT="$?";; esac;; *) case "$2" in *.bz2) bzip2 -cdfq "$2" | $comp $OPTIONS "$1" - STAT="$?";; *) $comp $OPTIONS "$1" "$2" STAT="$?";; esac;; esac exit "$STAT" else echo "Usage: $prog [${comp}_options] file [file]" exit 1 fi ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/bzip2/bzlib.h����������������������������������������������������0000644�0001750�0001750�00000014145�12320456500�020712� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /*-------------------------------------------------------------*/ /*--- Public header file for the library. ---*/ /*--- bzlib.h ---*/ /*-------------------------------------------------------------*/ /* ------------------------------------------------------------------ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. bzip2/libbzip2 version 1.0.5 of 10 December 2007 Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained in the file LICENSE. ------------------------------------------------------------------ */ #ifndef _BZLIB_H #define _BZLIB_H #ifdef __cplusplus extern "C" { #endif #define BZ_RUN 0 #define BZ_FLUSH 1 #define BZ_FINISH 2 #define BZ_OK 0 #define BZ_RUN_OK 1 #define BZ_FLUSH_OK 2 #define BZ_FINISH_OK 3 #define BZ_STREAM_END 4 #define BZ_SEQUENCE_ERROR (-1) #define BZ_PARAM_ERROR (-2) #define BZ_MEM_ERROR (-3) #define BZ_DATA_ERROR (-4) #define BZ_DATA_ERROR_MAGIC (-5) #define BZ_IO_ERROR (-6) #define BZ_UNEXPECTED_EOF (-7) #define BZ_OUTBUFF_FULL (-8) #define BZ_CONFIG_ERROR (-9) typedef struct { char *next_in; unsigned int avail_in; unsigned int total_in_lo32; unsigned int total_in_hi32; char *next_out; unsigned int avail_out; unsigned int total_out_lo32; unsigned int total_out_hi32; void *state; void *(*bzalloc)(void *,int,int); void (*bzfree)(void *,void *); void *opaque; } bz_stream; #ifndef BZ_IMPORT #define BZ_EXPORT #endif #ifndef BZ_NO_STDIO /* Need a definitition for FILE */ #include <stdio.h> #endif #ifdef _WIN32 # include <windows.h> # ifdef small /* windows.h define small to char */ # undef small # endif # ifdef BZ_EXPORT # define BZ_API(func) WINAPI func # define BZ_EXTERN extern # else /* import windows dll dynamically */ # define BZ_API(func) (WINAPI * func) # define BZ_EXTERN # endif #else # define BZ_API(func) func # define BZ_EXTERN extern #endif /*-- Core (low-level) library functions --*/ BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( bz_stream* strm, int blockSize100k, int verbosity, int workFactor ); BZ_EXTERN int BZ_API(BZ2_bzCompress) ( bz_stream* strm, int action ); BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( bz_stream* strm ); BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( bz_stream *strm, int verbosity, int small ); BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( bz_stream* strm ); BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( bz_stream *strm ); /*-- High(er) level library functions --*/ #ifndef BZ_NO_STDIO #define BZ_MAX_UNUSED 5000 typedef void BZFILE; BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( int* bzerror, FILE* f, int verbosity, int small, void* unused, int nUnused ); BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( int* bzerror, BZFILE* b ); BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( int* bzerror, BZFILE* b, void** unused, int* nUnused ); BZ_EXTERN int BZ_API(BZ2_bzRead) ( int* bzerror, BZFILE* b, void* buf, int len ); BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( int* bzerror, FILE* f, int blockSize100k, int verbosity, int workFactor ); BZ_EXTERN void BZ_API(BZ2_bzWrite) ( int* bzerror, BZFILE* b, void* buf, int len ); BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( int* bzerror, BZFILE* b, int abandon, unsigned int* nbytes_in, unsigned int* nbytes_out ); BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( int* bzerror, BZFILE* b, int abandon, unsigned int* nbytes_in_lo32, unsigned int* nbytes_in_hi32, unsigned int* nbytes_out_lo32, unsigned int* nbytes_out_hi32 ); #endif /*-- Utility functions --*/ BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( char* dest, unsigned int* destLen, char* source, unsigned int sourceLen, int blockSize100k, int verbosity, int workFactor ); BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( char* dest, unsigned int* destLen, char* source, unsigned int sourceLen, int small, int verbosity ); /*-- Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp) to support better zlib compatibility. This code is not _officially_ part of libbzip2 (yet); I haven't tested it, documented it, or considered the threading-safeness of it. If this code breaks, please contact both Yoshioka and me. --*/ BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) ( void ); #ifndef BZ_NO_STDIO BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) ( const char *path, const char *mode ); BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) ( int fd, const char *mode ); BZ_EXTERN int BZ_API(BZ2_bzread) ( BZFILE* b, void* buf, int len ); BZ_EXTERN int BZ_API(BZ2_bzwrite) ( BZFILE* b, void* buf, int len ); BZ_EXTERN int BZ_API(BZ2_bzflush) ( BZFILE* b ); BZ_EXTERN void BZ_API(BZ2_bzclose) ( BZFILE* b ); BZ_EXTERN const char * BZ_API(BZ2_bzerror) ( BZFILE *b, int *errnum ); #endif #ifdef __cplusplus } #endif #endif /*-------------------------------------------------------------*/ /*--- end bzlib.h ---*/ /*-------------------------------------------------------------*/ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/bzip2/LICENSE����������������������������������������������������0000644�0001750�0001750�00000003555�12320456500�020447� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� -------------------------------------------------------------------------- This program, "bzip2", the associated library "libbzip2", and all documentation, are copyright (C) 1996-2007 Julian R Seward. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 4. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Julian Seward, jseward@bzip.org bzip2/libbzip2 version 1.0.5 of 10 December 2007 -------------------------------------------------------------------------- ���������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/bzip2/huffman.c��������������������������������������������������0000644�0001750�0001750�00000015517�12320456500�021233� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /*-------------------------------------------------------------*/ /*--- Huffman coding low-level stuff ---*/ /*--- huffman.c ---*/ /*-------------------------------------------------------------*/ /* ------------------------------------------------------------------ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. bzip2/libbzip2 version 1.0.5 of 10 December 2007 Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained in the file LICENSE. ------------------------------------------------------------------ */ #include "bzlib_private.h" /*---------------------------------------------------*/ #define WEIGHTOF(zz0) ((zz0) & 0xffffff00) #define DEPTHOF(zz1) ((zz1) & 0x000000ff) #define MYMAX(zz2,zz3) ((zz2) > (zz3) ? (zz2) : (zz3)) #define ADDWEIGHTS(zw1,zw2) \ (WEIGHTOF(zw1)+WEIGHTOF(zw2)) | \ (1 + MYMAX(DEPTHOF(zw1),DEPTHOF(zw2))) #define UPHEAP(z) \ { \ Int32 zz, tmp; \ zz = z; tmp = heap[zz]; \ while (weight[tmp] < weight[heap[zz >> 1]]) { \ heap[zz] = heap[zz >> 1]; \ zz >>= 1; \ } \ heap[zz] = tmp; \ } #define DOWNHEAP(z) \ { \ Int32 zz, yy, tmp; \ zz = z; tmp = heap[zz]; \ while (True) { \ yy = zz << 1; \ if (yy > nHeap) break; \ if (yy < nHeap && \ weight[heap[yy+1]] < weight[heap[yy]]) \ yy++; \ if (weight[tmp] < weight[heap[yy]]) break; \ heap[zz] = heap[yy]; \ zz = yy; \ } \ heap[zz] = tmp; \ } /*---------------------------------------------------*/ void BZ2_hbMakeCodeLengths ( UChar *len, Int32 *freq, Int32 alphaSize, Int32 maxLen ) { /*-- Nodes and heap entries run from 1. Entry 0 for both the heap and nodes is a sentinel. --*/ Int32 nNodes, nHeap, n1, n2, i, j, k; Bool tooLong; Int32 heap [ BZ_MAX_ALPHA_SIZE + 2 ]; Int32 weight [ BZ_MAX_ALPHA_SIZE * 2 ]; Int32 parent [ BZ_MAX_ALPHA_SIZE * 2 ]; for (i = 0; i < alphaSize; i++) weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8; while (True) { nNodes = alphaSize; nHeap = 0; heap[0] = 0; weight[0] = 0; parent[0] = -2; for (i = 1; i <= alphaSize; i++) { parent[i] = -1; nHeap++; heap[nHeap] = i; UPHEAP(nHeap); } AssertH( nHeap < (BZ_MAX_ALPHA_SIZE+2), 2001 ); while (nHeap > 1) { n1 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1); n2 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1); nNodes++; parent[n1] = parent[n2] = nNodes; weight[nNodes] = ADDWEIGHTS(weight[n1], weight[n2]); parent[nNodes] = -1; nHeap++; heap[nHeap] = nNodes; UPHEAP(nHeap); } AssertH( nNodes < (BZ_MAX_ALPHA_SIZE * 2), 2002 ); tooLong = False; for (i = 1; i <= alphaSize; i++) { j = 0; k = i; while (parent[k] >= 0) { k = parent[k]; j++; } len[i-1] = j; if (j > maxLen) tooLong = True; } if (! tooLong) break; /* 17 Oct 04: keep-going condition for the following loop used to be 'i < alphaSize', which missed the last element, theoretically leading to the possibility of the compressor looping. However, this count-scaling step is only needed if one of the generated Huffman code words is longer than maxLen, which up to and including version 1.0.2 was 20 bits, which is extremely unlikely. In version 1.0.3 maxLen was changed to 17 bits, which has minimal effect on compression ratio, but does mean this scaling step is used from time to time, enough to verify that it works. This means that bzip2-1.0.3 and later will only produce Huffman codes with a maximum length of 17 bits. However, in order to preserve backwards compatibility with bitstreams produced by versions pre-1.0.3, the decompressor must still handle lengths of up to 20. */ for (i = 1; i <= alphaSize; i++) { j = weight[i] >> 8; j = 1 + (j / 2); weight[i] = j << 8; } } } /*---------------------------------------------------*/ void BZ2_hbAssignCodes ( Int32 *code, UChar *length, Int32 minLen, Int32 maxLen, Int32 alphaSize ) { Int32 n, vec, i; vec = 0; for (n = minLen; n <= maxLen; n++) { for (i = 0; i < alphaSize; i++) if (length[i] == n) { code[i] = vec; vec++; }; vec <<= 1; } } /*---------------------------------------------------*/ void BZ2_hbCreateDecodeTables ( Int32 *limit, Int32 *base, Int32 *perm, UChar *length, Int32 minLen, Int32 maxLen, Int32 alphaSize ) { Int32 pp, i, j, vec; pp = 0; for (i = minLen; i <= maxLen; i++) for (j = 0; j < alphaSize; j++) if (length[j] == i) { perm[pp] = j; pp++; }; for (i = 0; i < BZ_MAX_CODE_LEN; i++) base[i] = 0; for (i = 0; i < alphaSize; i++) base[length[i]+1]++; for (i = 1; i < BZ_MAX_CODE_LEN; i++) base[i] += base[i-1]; for (i = 0; i < BZ_MAX_CODE_LEN; i++) limit[i] = 0; vec = 0; for (i = minLen; i <= maxLen; i++) { vec += (base[i+1] - base[i]); limit[i] = vec-1; vec <<= 1; } for (i = minLen + 1; i <= maxLen; i++) base[i] = ((limit[i-1] + 1) << 1) - base[i]; } /*-------------------------------------------------------------*/ /*--- end huffman.c ---*/ /*-------------------------------------------------------------*/ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/bzip2/README�����������������������������������������������������0000644�0001750�0001750�00000016765�12320456500�020331� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������This is NOT the original bzip2/libzip2 distribution, though it is based on it. See TUVOK_README for details. ***************************************************************** This is the README for bzip2/libzip2. This version is fully compatible with the previous public releases. ------------------------------------------------------------------ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. bzip2/libbzip2 version 1.0.5 of 10 December 2007 Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in this file. This program is released under the terms of the license contained in the file LICENSE. ------------------------------------------------------------------ Complete documentation is available in Postscript form (manual.ps), PDF (manual.pdf) or html (manual.html). A plain-text version of the manual page is available as bzip2.txt. HOW TO BUILD -- UNIX Type 'make'. This builds the library libbz2.a and then the programs bzip2 and bzip2recover. Six self-tests are run. If the self-tests complete ok, carry on to installation: To install in /usr/local/bin, /usr/local/lib, /usr/local/man and /usr/local/include, type make install To install somewhere else, eg, /xxx/yyy/{bin,lib,man,include}, type make install PREFIX=/xxx/yyy If you are (justifiably) paranoid and want to see what 'make install' is going to do, you can first do make -n install or make -n install PREFIX=/xxx/yyy respectively. The -n instructs make to show the commands it would execute, but not actually execute them. HOW TO BUILD -- UNIX, shared library libbz2.so. Do 'make -f Makefile-libbz2_so'. This Makefile seems to work for Linux-ELF (RedHat 7.2 on an x86 box), with gcc. I make no claims that it works for any other platform, though I suspect it probably will work for most platforms employing both ELF and gcc. bzip2-shared, a client of the shared library, is also built, but not self-tested. So I suggest you also build using the normal Makefile, since that conducts a self-test. A second reason to prefer the version statically linked to the library is that, on x86 platforms, building shared objects makes a valuable register (%ebx) unavailable to gcc, resulting in a slowdown of 10%-20%, at least for bzip2. Important note for people upgrading .so's from 0.9.0/0.9.5 to version 1.0.X. All the functions in the library have been renamed, from (eg) bzCompress to BZ2_bzCompress, to avoid namespace pollution. Unfortunately this means that the libbz2.so created by Makefile-libbz2_so will not work with any program which used an older version of the library. I do encourage library clients to make the effort to upgrade to use version 1.0, since it is both faster and more robust than previous versions. HOW TO BUILD -- Windows 95, NT, DOS, Mac, etc. It's difficult for me to support compilation on all these platforms. My approach is to collect binaries for these platforms, and put them on the master web site (http://www.bzip.org). Look there. However (FWIW), bzip2-1.0.X is very standard ANSI C and should compile unmodified with MS Visual C. If you have difficulties building, you might want to read README.COMPILATION.PROBLEMS. At least using MS Visual C++ 6, you can build from the unmodified sources by issuing, in a command shell: nmake -f makefile.msc (you may need to first run the MSVC-provided script VCVARS32.BAT so as to set up paths to the MSVC tools correctly). VALIDATION Correct operation, in the sense that a compressed file can always be decompressed to reproduce the original, is obviously of paramount importance. To validate bzip2, I used a modified version of Mark Nelson's churn program. Churn is an automated test driver which recursively traverses a directory structure, using bzip2 to compress and then decompress each file it encounters, and checking that the decompressed data is the same as the original. Please read and be aware of the following: WARNING: This program and library (attempts to) compress data by performing several non-trivial transformations on it. Unless you are 100% familiar with *all* the algorithms contained herein, and with the consequences of modifying them, you should NOT meddle with the compression or decompression machinery. Incorrect changes can and very likely *will* lead to disastrous loss of data. DISCLAIMER: I TAKE NO RESPONSIBILITY FOR ANY LOSS OF DATA ARISING FROM THE USE OF THIS PROGRAM/LIBRARY, HOWSOEVER CAUSED. Every compression of a file implies an assumption that the compressed file can be decompressed to reproduce the original. Great efforts in design, coding and testing have been made to ensure that this program works correctly. However, the complexity of the algorithms, and, in particular, the presence of various special cases in the code which occur with very low but non-zero probability make it impossible to rule out the possibility of bugs remaining in the program. DO NOT COMPRESS ANY DATA WITH THIS PROGRAM UNLESS YOU ARE PREPARED TO ACCEPT THE POSSIBILITY, HOWEVER SMALL, THAT THE DATA WILL NOT BE RECOVERABLE. That is not to say this program is inherently unreliable. Indeed, I very much hope the opposite is true. bzip2/libbzip2 has been carefully constructed and extensively tested. PATENTS: To the best of my knowledge, bzip2/libbzip2 does not use any patented algorithms. However, I do not have the resources to carry out a patent search. Therefore I cannot give any guarantee of the above statement. WHAT'S NEW IN 0.9.0 (as compared to 0.1pl2) ? * Approx 10% faster compression, 30% faster decompression * -t (test mode) is a lot quicker * Can decompress concatenated compressed files * Programming interface, so programs can directly read/write .bz2 files * Less restrictive (BSD-style) licensing * Flag handling more compatible with GNU gzip * Much more documentation, i.e., a proper user manual * Hopefully, improved portability (at least of the library) WHAT'S NEW IN 0.9.5 ? * Compression speed is much less sensitive to the input data than in previous versions. Specifically, the very slow performance caused by repetitive data is fixed. * Many small improvements in file and flag handling. * A Y2K statement. WHAT'S NEW IN 1.0.0 ? See the CHANGES file. WHAT'S NEW IN 1.0.2 ? See the CHANGES file. WHAT'S NEW IN 1.0.3 ? See the CHANGES file. WHAT'S NEW IN 1.0.4 ? See the CHANGES file. WHAT'S NEW IN 1.0.5 ? See the CHANGES file. I hope you find bzip2 useful. Feel free to contact me at jseward@bzip.org if you have any suggestions or queries. Many people mailed me with comments, suggestions and patches after the releases of bzip-0.15, bzip-0.21, and bzip2 versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1, 1.0.2 and 1.0.3, and the changes in bzip2 are largely a result of this feedback. I thank you for your comments. bzip2's "home" is http://www.bzip.org/ Julian Seward jseward@bzip.org Cambridge, UK. 18 July 1996 (version 0.15) 25 August 1996 (version 0.21) 7 August 1997 (bzip2, version 0.1) 29 August 1997 (bzip2, version 0.1pl2) 23 August 1998 (bzip2, version 0.9.0) 8 June 1999 (bzip2, version 0.9.5) 4 Sept 1999 (bzip2, version 0.9.5d) 5 May 2000 (bzip2, version 1.0pre8) 30 December 2001 (bzip2, version 1.0.2pre1) 15 February 2005 (bzip2, version 1.0.3) 20 December 2006 (bzip2, version 1.0.4) 10 December 2007 (bzip2, version 1.0.5) �����������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/bzip2/CHANGES����������������������������������������������������0000644�0001750�0001750�00000026254�12320456500�020436� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� ------------------------------------------------------------------ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. bzip2/libbzip2 version 1.0.5 of 10 December 2007 Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained in the file LICENSE. ------------------------------------------------------------------ 0.9.0 ~~~~~ First version. 0.9.0a ~~~~~~ Removed 'ranlib' from Makefile, since most modern Unix-es don't need it, or even know about it. 0.9.0b ~~~~~~ Fixed a problem with error reporting in bzip2.c. This does not effect the library in any way. Problem is: versions 0.9.0 and 0.9.0a (of the program proper) compress and decompress correctly, but give misleading error messages (internal panics) when an I/O error occurs, instead of reporting the problem correctly. This shouldn't give any data loss (as far as I can see), but is confusing. Made the inline declarations disappear for non-GCC compilers. 0.9.0c ~~~~~~ Fixed some problems in the library pertaining to some boundary cases. This makes the library behave more correctly in those situations. The fixes apply only to features (calls and parameters) not used by bzip2.c, so the non-fixedness of them in previous versions has no effect on reliability of bzip2.c. In bzlib.c: * made zero-length BZ_FLUSH work correctly in bzCompress(). * fixed bzWrite/bzRead to ignore zero-length requests. * fixed bzread to correctly handle read requests after EOF. * wrong parameter order in call to bzDecompressInit in bzBuffToBuffDecompress. Fixed. In compress.c: * changed setting of nGroups in sendMTFValues() so as to do a bit better on small files. This _does_ effect bzip2.c. 0.9.5a ~~~~~~ Major change: add a fallback sorting algorithm (blocksort.c) to give reasonable behaviour even for very repetitive inputs. Nuked --repetitive-best and --repetitive-fast since they are no longer useful. Minor changes: mostly a whole bunch of small changes/ bugfixes in the driver (bzip2.c). Changes pertaining to the user interface are: allow decompression of symlink'd files to stdout decompress/test files even without .bz2 extension give more accurate error messages for I/O errors when compressing/decompressing to stdout, don't catch control-C read flags from BZIP2 and BZIP environment variables decline to break hard links to a file unless forced with -f allow -c flag even with no filenames preserve file ownerships as far as possible make -s -1 give the expected block size (100k) add a flag -q --quiet to suppress nonessential warnings stop decoding flags after --, so files beginning in - can be handled resolved inconsistent naming: bzcat or bz2cat ? bzip2 --help now returns 0 Programming-level changes are: fixed syntax error in GET_LL4 for Borland C++ 5.02 let bzBuffToBuffDecompress return BZ_DATA_ERROR{_MAGIC} fix overshoot of mode-string end in bzopen_or_bzdopen wrapped bzlib.h in #ifdef __cplusplus ... extern "C" { ... } close file handles under all error conditions added minor mods so it compiles with DJGPP out of the box fixed Makefile so it doesn't give problems with BSD make fix uninitialised memory reads in dlltest.c 0.9.5b ~~~~~~ Open stdin/stdout in binary mode for DJGPP. 0.9.5c ~~~~~~ Changed BZ_N_OVERSHOOT to be ... + 2 instead of ... + 1. The + 1 version could cause the sorted order to be wrong in some extremely obscure cases. Also changed setting of quadrant in blocksort.c. 0.9.5d ~~~~~~ The only functional change is to make bzlibVersion() in the library return the correct string. This has no effect whatsoever on the functioning of the bzip2 program or library. Added a couple of casts so the library compiles without warnings at level 3 in MS Visual Studio 6.0. Included a Y2K statement in the file Y2K_INFO. All other changes are minor documentation changes. 1.0 ~~~ Several minor bugfixes and enhancements: * Large file support. The library uses 64-bit counters to count the volume of data passing through it. bzip2.c is now compiled with -D_FILE_OFFSET_BITS=64 to get large file support from the C library. -v correctly prints out file sizes greater than 4 gigabytes. All these changes have been made without assuming a 64-bit platform or a C compiler which supports 64-bit ints, so, except for the C library aspect, they are fully portable. * Decompression robustness. The library/program should be robust to any corruption of compressed data, detecting and handling _all_ corruption, instead of merely relying on the CRCs. What this means is that the program should never crash, given corrupted data, and the library should always return BZ_DATA_ERROR. * Fixed an obscure race-condition bug only ever observed on Solaris, in which, if you were very unlucky and issued control-C at exactly the wrong time, both input and output files would be deleted. * Don't run out of file handles on test/decompression when large numbers of files have invalid magic numbers. * Avoid library namespace pollution. Prefix all exported symbols with BZ2_. * Minor sorting enhancements from my DCC2000 paper. * Advance the version number to 1.0, so as to counteract the (false-in-this-case) impression some people have that programs with version numbers less than 1.0 are in some way, experimental, pre-release versions. * Create an initial Makefile-libbz2_so to build a shared library. Yes, I know I should really use libtool et al ... * Make the program exit with 2 instead of 0 when decompression fails due to a bad magic number (ie, an invalid bzip2 header). Also exit with 1 (as the manual claims :-) whenever a diagnostic message would have been printed AND the corresponding operation is aborted, for example bzip2: Output file xx already exists. When a diagnostic message is printed but the operation is not aborted, for example bzip2: Can't guess original name for wurble -- using wurble.out then the exit value 0 is returned, unless some other problem is also detected. I think it corresponds more closely to what the manual claims now. 1.0.1 ~~~~~ * Modified dlltest.c so it uses the new BZ2_ naming scheme. * Modified makefile-msc to fix minor build probs on Win2k. * Updated README.COMPILATION.PROBLEMS. There are no functionality changes or bug fixes relative to version 1.0.0. This is just a documentation update + a fix for minor Win32 build problems. For almost everyone, upgrading from 1.0.0 to 1.0.1 is utterly pointless. Don't bother. 1.0.2 ~~~~~ A bug fix release, addressing various minor issues which have appeared in the 18 or so months since 1.0.1 was released. Most of the fixes are to do with file-handling or documentation bugs. To the best of my knowledge, there have been no data-loss-causing bugs reported in the compression/decompression engine of 1.0.0 or 1.0.1. Note that this release does not improve the rather crude build system for Unix platforms. The general plan here is to autoconfiscate/ libtoolise 1.0.2 soon after release, and release the result as 1.1.0 or perhaps 1.2.0. That, however, is still just a plan at this point. Here are the changes in 1.0.2. Bug-reporters and/or patch-senders in parentheses. * Fix an infinite segfault loop in 1.0.1 when a directory is encountered in -f (force) mode. (Trond Eivind Glomsrod, Nicholas Nethercote, Volker Schmidt) * Avoid double fclose() of output file on certain I/O error paths. (Solar Designer) * Don't fail with internal error 1007 when fed a long stream (> 48MB) of byte 251. Also print useful message suggesting that 1007s may be caused by bad memory. (noticed by Juan Pedro Vallejo, fixed by me) * Fix uninitialised variable silly bug in demo prog dlltest.c. (Jorj Bauer) * Remove 512-MB limitation on recovered file size for bzip2recover on selected platforms which support 64-bit ints. At the moment all GCC supported platforms, and Win32. (me, Alson van der Meulen) * Hard-code header byte values, to give correct operation on platforms using EBCDIC as their native character set (IBM's OS/390). (Leland Lucius) * Copy file access times correctly. (Marty Leisner) * Add distclean and check targets to Makefile. (Michael Carmack) * Parameterise use of ar and ranlib in Makefile. Also add $(LDFLAGS). (Rich Ireland, Bo Thorsen) * Pass -p (create parent dirs as needed) to mkdir during make install. (Jeremy Fusco) * Dereference symlinks when copying file permissions in -f mode. (Volker Schmidt) * Majorly simplify implementation of uInt64_qrm10. (Bo Lindbergh) * Check the input file still exists before deleting the output one, when aborting in cleanUpAndFail(). (Joerg Prante, Robert Linden, Matthias Krings) Also a bunch of patches courtesy of Philippe Troin, the Debian maintainer of bzip2: * Wrapper scripts (with manpages): bzdiff, bzgrep, bzmore. * Spelling changes and minor enhancements in bzip2.1. * Avoid race condition between creating the output file and setting its interim permissions safely, by using fopen_output_safely(). No changes to bzip2recover since there is no issue with file permissions there. * do not print senseless report with -v when compressing an empty file. * bzcat -f works on non-bzip2 files. * do not try to escape shell meta-characters on unix (the shell takes care of these). * added --fast and --best aliases for -1 -9 for gzip compatibility. 1.0.3 (15 Feb 05) ~~~~~~~~~~~~~~~~~ Fixes some minor bugs since the last version, 1.0.2. * Further robustification against corrupted compressed data. There are currently no known bitstreams which can cause the decompressor to crash, loop or access memory which does not belong to it. If you are using bzip2 or the library to decompress bitstreams from untrusted sources, an upgrade to 1.0.3 is recommended. This fixes CAN-2005-1260. * The documentation has been converted to XML, from which html and pdf can be derived. * Various minor bugs in the documentation have been fixed. * Fixes for various compilation warnings with newer versions of gcc, and on 64-bit platforms. * The BZ_NO_STDIO cpp symbol was not properly observed in 1.0.2. This has been fixed. 1.0.4 (20 Dec 06) ~~~~~~~~~~~~~~~~~ Fixes some minor bugs since the last version, 1.0.3. * Fix file permissions race problem (CAN-2005-0953). * Avoid possible segfault in BZ2_bzclose. From Coverity's NetBSD scan. * 'const'/prototype cleanups in the C code. * Change default install location to /usr/local, and handle multiple 'make install's without error. * Sanitise file names more carefully in bzgrep. Fixes CAN-2005-0758 to the extent that applies to bzgrep. * Use 'mktemp' rather than 'tempfile' in bzdiff. * Tighten up a couple of assertions in blocksort.c following automated analysis. * Fix minor doc/comment bugs. 1.0.5 (10 Dec 07) ~~~~~~~~~~~~~~~~~ Security fix only. Fixes CERT-FI 20469 as it applies to bzip2. Tuvok (Mon Dec 29 18:20:12 MST 2008) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Removed many files. Noted in a few places that this is a derived work of the original bzip2 source code. ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/3rdParty/bzip2/decompress.c�����������������������������������������������0000644�0001750�0001750�00000047076�12320456500�021760� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /*-------------------------------------------------------------*/ /*--- Decompression machinery ---*/ /*--- decompress.c ---*/ /*-------------------------------------------------------------*/ /* ------------------------------------------------------------------ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. bzip2/libbzip2 version 1.0.5 of 10 December 2007 Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained in the file LICENSE. ------------------------------------------------------------------ */ #include "bzlib_private.h" /*---------------------------------------------------*/ static void makeMaps_d ( DState* s ) { Int32 i; s->nInUse = 0; for (i = 0; i < 256; i++) if (s->inUse[i]) { s->seqToUnseq[s->nInUse] = i; s->nInUse++; } } /*---------------------------------------------------*/ #define RETURN(rrr) \ { retVal = rrr; goto save_state_and_return; }; #define GET_BITS(lll,vvv,nnn) \ case lll: s->state = lll; \ while (True) { \ if (s->bsLive >= nnn) { \ UInt32 v; \ v = (s->bsBuff >> \ (s->bsLive-nnn)) & ((1 << nnn)-1); \ s->bsLive -= nnn; \ vvv = v; \ break; \ } \ if (s->strm->avail_in == 0) RETURN(BZ_OK); \ s->bsBuff \ = (s->bsBuff << 8) | \ ((UInt32) \ (*((UChar*)(s->strm->next_in)))); \ s->bsLive += 8; \ s->strm->next_in++; \ s->strm->avail_in--; \ s->strm->total_in_lo32++; \ if (s->strm->total_in_lo32 == 0) \ s->strm->total_in_hi32++; \ } #define GET_UCHAR(lll,uuu) \ GET_BITS(lll,uuu,8) #define GET_BIT(lll,uuu) \ GET_BITS(lll,uuu,1) /*---------------------------------------------------*/ #define GET_MTF_VAL(label1,label2,lval) \ { \ if (groupPos == 0) { \ groupNo++; \ if (groupNo >= nSelectors) \ RETURN(BZ_DATA_ERROR); \ groupPos = BZ_G_SIZE; \ gSel = s->selector[groupNo]; \ gMinlen = s->minLens[gSel]; \ gLimit = &(s->limit[gSel][0]); \ gPerm = &(s->perm[gSel][0]); \ gBase = &(s->base[gSel][0]); \ } \ groupPos--; \ zn = gMinlen; \ GET_BITS(label1, zvec, zn); \ while (1) { \ if (zn > 20 /* the longest code */) \ RETURN(BZ_DATA_ERROR); \ if (zvec <= gLimit[zn]) break; \ zn++; \ GET_BIT(label2, zj); \ zvec = (zvec << 1) | zj; \ }; \ if (zvec - gBase[zn] < 0 \ || zvec - gBase[zn] >= BZ_MAX_ALPHA_SIZE) \ RETURN(BZ_DATA_ERROR); \ lval = gPerm[zvec - gBase[zn]]; \ } /*---------------------------------------------------*/ Int32 BZ2_decompress ( DState* s ) { UChar uc; Int32 retVal; Int32 minLen, maxLen; bz_stream* strm = s->strm; /* stuff that needs to be saved/restored */ Int32 i; Int32 j; Int32 t; Int32 alphaSize; Int32 nGroups; Int32 nSelectors; Int32 EOB; Int32 groupNo; Int32 groupPos; Int32 nextSym; Int32 nblockMAX; Int32 nblock; Int32 es; Int32 N; Int32 curr; Int32 zt; Int32 zn; Int32 zvec; Int32 zj; Int32 gSel; Int32 gMinlen; Int32* gLimit; Int32* gBase; Int32* gPerm; if (s->state == BZ_X_MAGIC_1) { /*initialise the save area*/ s->save_i = 0; s->save_j = 0; s->save_t = 0; s->save_alphaSize = 0; s->save_nGroups = 0; s->save_nSelectors = 0; s->save_EOB = 0; s->save_groupNo = 0; s->save_groupPos = 0; s->save_nextSym = 0; s->save_nblockMAX = 0; s->save_nblock = 0; s->save_es = 0; s->save_N = 0; s->save_curr = 0; s->save_zt = 0; s->save_zn = 0; s->save_zvec = 0; s->save_zj = 0; s->save_gSel = 0; s->save_gMinlen = 0; s->save_gLimit = NULL; s->save_gBase = NULL; s->save_gPerm = NULL; } /*restore from the save area*/ i = s->save_i; j = s->save_j; t = s->save_t; alphaSize = s->save_alphaSize; nGroups = s->save_nGroups; nSelectors = s->save_nSelectors; EOB = s->save_EOB; groupNo = s->save_groupNo; groupPos = s->save_groupPos; nextSym = s->save_nextSym; nblockMAX = s->save_nblockMAX; nblock = s->save_nblock; es = s->save_es; N = s->save_N; curr = s->save_curr; zt = s->save_zt; zn = s->save_zn; zvec = s->save_zvec; zj = s->save_zj; gSel = s->save_gSel; gMinlen = s->save_gMinlen; gLimit = s->save_gLimit; gBase = s->save_gBase; gPerm = s->save_gPerm; retVal = BZ_OK; switch (s->state) { GET_UCHAR(BZ_X_MAGIC_1, uc); if (uc != BZ_HDR_B) RETURN(BZ_DATA_ERROR_MAGIC); GET_UCHAR(BZ_X_MAGIC_2, uc); if (uc != BZ_HDR_Z) RETURN(BZ_DATA_ERROR_MAGIC); GET_UCHAR(BZ_X_MAGIC_3, uc) if (uc != BZ_HDR_h) RETURN(BZ_DATA_ERROR_MAGIC); GET_BITS(BZ_X_MAGIC_4, s->blockSize100k, 8) if (s->blockSize100k < (BZ_HDR_0 + 1) || s->blockSize100k > (BZ_HDR_0 + 9)) RETURN(BZ_DATA_ERROR_MAGIC); s->blockSize100k -= BZ_HDR_0; if (s->smallDecompress) { s->ll16 = BZALLOC( s->blockSize100k * 100000 * sizeof(UInt16) ); s->ll4 = BZALLOC( ((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar) ); if (s->ll16 == NULL || s->ll4 == NULL) RETURN(BZ_MEM_ERROR); } else { s->tt = BZALLOC( s->blockSize100k * 100000 * sizeof(Int32) ); if (s->tt == NULL) RETURN(BZ_MEM_ERROR); } GET_UCHAR(BZ_X_BLKHDR_1, uc); if (uc == 0x17) goto endhdr_2; if (uc != 0x31) RETURN(BZ_DATA_ERROR); GET_UCHAR(BZ_X_BLKHDR_2, uc); if (uc != 0x41) RETURN(BZ_DATA_ERROR); GET_UCHAR(BZ_X_BLKHDR_3, uc); if (uc != 0x59) RETURN(BZ_DATA_ERROR); GET_UCHAR(BZ_X_BLKHDR_4, uc); if (uc != 0x26) RETURN(BZ_DATA_ERROR); GET_UCHAR(BZ_X_BLKHDR_5, uc); if (uc != 0x53) RETURN(BZ_DATA_ERROR); GET_UCHAR(BZ_X_BLKHDR_6, uc); if (uc != 0x59) RETURN(BZ_DATA_ERROR); s->currBlockNo++; if (s->verbosity >= 2) VPrintf1 ( "\n [%d: huff+mtf ", s->currBlockNo ); s->storedBlockCRC = 0; GET_UCHAR(BZ_X_BCRC_1, uc); s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); GET_UCHAR(BZ_X_BCRC_2, uc); s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); GET_UCHAR(BZ_X_BCRC_3, uc); s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); GET_UCHAR(BZ_X_BCRC_4, uc); s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); GET_BITS(BZ_X_RANDBIT, s->blockRandomised, 1); s->origPtr = 0; GET_UCHAR(BZ_X_ORIGPTR_1, uc); s->origPtr = (s->origPtr << 8) | ((Int32)uc); GET_UCHAR(BZ_X_ORIGPTR_2, uc); s->origPtr = (s->origPtr << 8) | ((Int32)uc); GET_UCHAR(BZ_X_ORIGPTR_3, uc); s->origPtr = (s->origPtr << 8) | ((Int32)uc); if (s->origPtr < 0) RETURN(BZ_DATA_ERROR); if (s->origPtr > 10 + 100000*s->blockSize100k) RETURN(BZ_DATA_ERROR); /*--- Receive the mapping table ---*/ for (i = 0; i < 16; i++) { GET_BIT(BZ_X_MAPPING_1, uc); if (uc == 1) s->inUse16[i] = True; else s->inUse16[i] = False; } for (i = 0; i < 256; i++) s->inUse[i] = False; for (i = 0; i < 16; i++) if (s->inUse16[i]) for (j = 0; j < 16; j++) { GET_BIT(BZ_X_MAPPING_2, uc); if (uc == 1) s->inUse[i * 16 + j] = True; } makeMaps_d ( s ); if (s->nInUse == 0) RETURN(BZ_DATA_ERROR); alphaSize = s->nInUse+2; /*--- Now the selectors ---*/ GET_BITS(BZ_X_SELECTOR_1, nGroups, 3); if (nGroups < 2 || nGroups > 6) RETURN(BZ_DATA_ERROR); GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15); if (nSelectors < 1) RETURN(BZ_DATA_ERROR); for (i = 0; i < nSelectors; i++) { j = 0; while (True) { GET_BIT(BZ_X_SELECTOR_3, uc); if (uc == 0) break; j++; if (j >= nGroups) RETURN(BZ_DATA_ERROR); } s->selectorMtf[i] = j; } /*--- Undo the MTF values for the selectors. ---*/ { UChar pos[BZ_N_GROUPS], tmp, v; for (v = 0; v < nGroups; v++) pos[v] = v; for (i = 0; i < nSelectors; i++) { v = s->selectorMtf[i]; tmp = pos[v]; while (v > 0) { pos[v] = pos[v-1]; v--; } pos[0] = tmp; s->selector[i] = tmp; } } /*--- Now the coding tables ---*/ for (t = 0; t < nGroups; t++) { GET_BITS(BZ_X_CODING_1, curr, 5); for (i = 0; i < alphaSize; i++) { while (True) { if (curr < 1 || curr > 20) RETURN(BZ_DATA_ERROR); GET_BIT(BZ_X_CODING_2, uc); if (uc == 0) break; GET_BIT(BZ_X_CODING_3, uc); if (uc == 0) curr++; else curr--; } s->len[t][i] = curr; } } /*--- Create the Huffman decoding tables ---*/ for (t = 0; t < nGroups; t++) { minLen = 32; maxLen = 0; for (i = 0; i < alphaSize; i++) { if (s->len[t][i] > maxLen) maxLen = s->len[t][i]; if (s->len[t][i] < minLen) minLen = s->len[t][i]; } BZ2_hbCreateDecodeTables ( &(s->limit[t][0]), &(s->base[t][0]), &(s->perm[t][0]), &(s->len[t][0]), minLen, maxLen, alphaSize ); s->minLens[t] = minLen; } /*--- Now the MTF values ---*/ EOB = s->nInUse+1; nblockMAX = 100000 * s->blockSize100k; groupNo = -1; groupPos = 0; for (i = 0; i <= 255; i++) s->unzftab[i] = 0; /*-- MTF init --*/ { Int32 ii, jj, kk; kk = MTFA_SIZE-1; for (ii = 256 / MTFL_SIZE - 1; ii >= 0; ii--) { for (jj = MTFL_SIZE-1; jj >= 0; jj--) { s->mtfa[kk] = (UChar)(ii * MTFL_SIZE + jj); kk--; } s->mtfbase[ii] = kk + 1; } } /*-- end MTF init --*/ nblock = 0; GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym); while (True) { if (nextSym == EOB) break; if (nextSym == BZ_RUNA || nextSym == BZ_RUNB) { es = -1; N = 1; do { if (nextSym == BZ_RUNA) es = es + (0+1) * N; else if (nextSym == BZ_RUNB) es = es + (1+1) * N; N = N * 2; GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym); } while (nextSym == BZ_RUNA || nextSym == BZ_RUNB); es++; uc = s->seqToUnseq[ s->mtfa[s->mtfbase[0]] ]; s->unzftab[uc] += es; if (s->smallDecompress) while (es > 0) { if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); s->ll16[nblock] = (UInt16)uc; nblock++; es--; } else while (es > 0) { if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); s->tt[nblock] = (UInt32)uc; nblock++; es--; }; continue; } else { if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); /*-- uc = MTF ( nextSym-1 ) --*/ { Int32 ii, jj, kk, pp, lno, off; UInt32 nn; nn = (UInt32)(nextSym - 1); if (nn < MTFL_SIZE) { /* avoid general-case expense */ pp = s->mtfbase[0]; uc = s->mtfa[pp+nn]; while (nn > 3) { Int32 z = pp+nn; s->mtfa[(z) ] = s->mtfa[(z)-1]; s->mtfa[(z)-1] = s->mtfa[(z)-2]; s->mtfa[(z)-2] = s->mtfa[(z)-3]; s->mtfa[(z)-3] = s->mtfa[(z)-4]; nn -= 4; } while (nn > 0) { s->mtfa[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--; }; s->mtfa[pp] = uc; } else { /* general case */ lno = nn / MTFL_SIZE; off = nn % MTFL_SIZE; pp = s->mtfbase[lno] + off; uc = s->mtfa[pp]; while (pp > s->mtfbase[lno]) { s->mtfa[pp] = s->mtfa[pp-1]; pp--; }; s->mtfbase[lno]++; while (lno > 0) { s->mtfbase[lno]--; s->mtfa[s->mtfbase[lno]] = s->mtfa[s->mtfbase[lno-1] + MTFL_SIZE - 1]; lno--; } s->mtfbase[0]--; s->mtfa[s->mtfbase[0]] = uc; if (s->mtfbase[0] == 0) { kk = MTFA_SIZE-1; for (ii = 256 / MTFL_SIZE-1; ii >= 0; ii--) { for (jj = MTFL_SIZE-1; jj >= 0; jj--) { s->mtfa[kk] = s->mtfa[s->mtfbase[ii] + jj]; kk--; } s->mtfbase[ii] = kk + 1; } } } } /*-- end uc = MTF ( nextSym-1 ) --*/ s->unzftab[s->seqToUnseq[uc]]++; if (s->smallDecompress) s->ll16[nblock] = (UInt16)(s->seqToUnseq[uc]); else s->tt[nblock] = (UInt32)(s->seqToUnseq[uc]); nblock++; GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym); continue; } } /* Now we know what nblock is, we can do a better sanity check on s->origPtr. */ if (s->origPtr < 0 || s->origPtr >= nblock) RETURN(BZ_DATA_ERROR); /*-- Set up cftab to facilitate generation of T^(-1) --*/ s->cftab[0] = 0; for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1]; for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1]; for (i = 0; i <= 256; i++) { if (s->cftab[i] < 0 || s->cftab[i] > nblock) { /* s->cftab[i] can legitimately be == nblock */ RETURN(BZ_DATA_ERROR); } } s->state_out_len = 0; s->state_out_ch = 0; BZ_INITIALISE_CRC ( s->calculatedBlockCRC ); s->state = BZ_X_OUTPUT; if (s->verbosity >= 2) VPrintf0 ( "rt+rld" ); if (s->smallDecompress) { /*-- Make a copy of cftab, used in generation of T --*/ for (i = 0; i <= 256; i++) s->cftabCopy[i] = s->cftab[i]; /*-- compute the T vector --*/ for (i = 0; i < nblock; i++) { uc = (UChar)(s->ll16[i]); SET_LL(i, s->cftabCopy[uc]); s->cftabCopy[uc]++; } /*-- Compute T^(-1) by pointer reversal on T --*/ i = s->origPtr; j = GET_LL(i); do { Int32 tmp = GET_LL(j); SET_LL(j, i); i = j; j = tmp; } while (i != s->origPtr); s->tPos = s->origPtr; s->nblock_used = 0; if (s->blockRandomised) { BZ_RAND_INIT_MASK; BZ_GET_SMALL(s->k0); s->nblock_used++; BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; } else { BZ_GET_SMALL(s->k0); s->nblock_used++; } } else { /*-- compute the T^(-1) vector --*/ for (i = 0; i < nblock; i++) { uc = (UChar)(s->tt[i] & 0xff); s->tt[s->cftab[uc]] |= (i << 8); s->cftab[uc]++; } s->tPos = s->tt[s->origPtr] >> 8; s->nblock_used = 0; if (s->blockRandomised) { BZ_RAND_INIT_MASK; BZ_GET_FAST(s->k0); s->nblock_used++; BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; } else { BZ_GET_FAST(s->k0); s->nblock_used++; } } RETURN(BZ_OK); endhdr_2: GET_UCHAR(BZ_X_ENDHDR_2, uc); if (uc != 0x72) RETURN(BZ_DATA_ERROR); GET_UCHAR(BZ_X_ENDHDR_3, uc); if (uc != 0x45) RETURN(BZ_DATA_ERROR); GET_UCHAR(BZ_X_ENDHDR_4, uc); if (uc != 0x38) RETURN(BZ_DATA_ERROR); GET_UCHAR(BZ_X_ENDHDR_5, uc); if (uc != 0x50) RETURN(BZ_DATA_ERROR); GET_UCHAR(BZ_X_ENDHDR_6, uc); if (uc != 0x90) RETURN(BZ_DATA_ERROR); s->storedCombinedCRC = 0; GET_UCHAR(BZ_X_CCRC_1, uc); s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); GET_UCHAR(BZ_X_CCRC_2, uc); s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); GET_UCHAR(BZ_X_CCRC_3, uc); s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); GET_UCHAR(BZ_X_CCRC_4, uc); s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); s->state = BZ_X_IDLE; RETURN(BZ_STREAM_END); default: AssertH ( False, 4001 ); } AssertH ( False, 4002 ); save_state_and_return: s->save_i = i; s->save_j = j; s->save_t = t; s->save_alphaSize = alphaSize; s->save_nGroups = nGroups; s->save_nSelectors = nSelectors; s->save_EOB = EOB; s->save_groupNo = groupNo; s->save_groupPos = groupPos; s->save_nextSym = nextSym; s->save_nblockMAX = nblockMAX; s->save_nblock = nblock; s->save_es = es; s->save_N = N; s->save_curr = curr; s->save_zt = zt; s->save_zn = zn; s->save_zvec = zvec; s->save_zj = zj; s->save_gSel = gSel; s->save_gMinlen = gMinlen; s->save_gLimit = gLimit; s->save_gBase = gBase; s->save_gPerm = gPerm; return retVal; } /*-------------------------------------------------------------*/ /*--- end decompress.c ---*/ /*-------------------------------------------------------------*/ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/NRRDConverter.h�����������������������������������������������������������0000644�0001750�0001750�00000005067�12320456500�017512� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file NRRDConverter.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date December 2008 */ #pragma once #ifndef NRRDCONVERTER_H #define NRRDCONVERTER_H #include "../StdTuvokDefines.h" #include "RAWConverter.h" class NRRDConverter : public RAWConverter { public: NRRDConverter(); virtual ~NRRDConverter() {} virtual bool ConvertToRAW( const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile ); virtual bool ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize,FLOATVECTOR3 vVolumeAspect, bool bNoUserInteraction, const bool bQuantizeTo8Bit); virtual bool CanExportData() const {return true;} virtual bool CanImportData() const { return true; } }; #endif // NRRDCONVERTER_H �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/AbstrConverter.cpp��������������������������������������������������������0000644�0001750�0001750�00000017201�12320456500�020344� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file AbstrConverter.cpp \author Jens Krueger SCI Institute University of Utah \date December 2008 */ #include "StdTuvokDefines.h" #include <algorithm> #include <cctype> #include <iterator> #include <string> #include <vector> #include "AbstrConverter.h" #include "Basics/SysTools.h" #include "Controller/Controller.h" #include "IOManager.h" // for the size defines #include "Quantize.h" #include "TuvokIOError.h" #include "TuvokSizes.h" #include "UVF/Histogram1DDataBlock.h" using namespace tuvok; bool AbstrConverter::CanRead(const std::string& fn, const std::vector<int8_t>&) const { std::string ext = SysTools::GetExt(fn); std::transform(ext.begin(), ext.end(), ext.begin(), (int(*)(int))std::toupper); return SupportedExtension(ext); } /// @param ext the extension for the filename /// @return true if the filename is a supported extension for this converter bool AbstrConverter::SupportedExtension(const std::string& ext) const { return std::find(m_vSupportedExt.begin(), m_vSupportedExt.end(), ext) != m_vSupportedExt.end(); } /// @returns true if we generated 'strTargetFilename'. bool AbstrConverter::Process8Bits(LargeRAWFile& InputData, const std::string& strTargetFilename, uint64_t iSize, bool bSigned, Histogram1DDataBlock* Histogram1D) { size_t iCurrentInCoreSize = GetIncoreSize(); uint64_t iPercent = iSize / 100; if (!InputData.IsOpen()) return false; std::vector<uint64_t> aHist(256); std::fill(aHist.begin(), aHist.end(), 0); bool generated_file = false; if (bSigned) { MESSAGE("Changing signed to unsigned char and computing 1D histogram..."); LargeRAWFile OutputData(strTargetFilename); OutputData.Create(iSize); if (!OutputData.IsOpen()) { T_ERROR("Failed opening/creating '%s'", strTargetFilename.c_str()); InputData.Close(); return false; } signed char* pInData = new signed char[iCurrentInCoreSize]; uint64_t iPos = 0; while (iPos < iSize) { size_t iRead = InputData.ReadRAW((unsigned char*)pInData, iCurrentInCoreSize); if (iRead == 0) break; for (size_t i = 0;i<iRead;i++) { pInData[i] += 128; if (Histogram1D) aHist[(unsigned char)pInData[i]]++; } OutputData.WriteRAW((unsigned char*)pInData, iRead); iPos += uint64_t(iRead); } if (iPos < iSize) { WARNING("Specified size and real datasize mismatch"); } delete [] pInData; generated_file = true; OutputData.Close(); } else { if (Histogram1D) { MESSAGE("Computing 1D Histogram..."); unsigned char* pInData = new unsigned char[iCurrentInCoreSize]; uint64_t iPos = 0; uint64_t iDivLast = 0; while (iPos < iSize) { size_t iRead = InputData.ReadRAW((unsigned char*)pInData, iCurrentInCoreSize); if (iRead == 0) break; std::for_each(pInData, pInData+iRead, [&](unsigned char i) { ++aHist[i]; }); iPos += uint64_t(iRead); if (iPercent > 1 && (100*iPos)/iSize > iDivLast) { MESSAGE("Computing 1D Histogram (%u%% complete)", static_cast<unsigned>((100*iPos)/iSize)); iDivLast = (100*iPos)/iSize; } } if (iPos < iSize) { WARNING("Specified size and real datasize mismatch"); } MESSAGE("1D Histogram complete"); delete [] pInData; } generated_file = false; } if ( Histogram1D ) Histogram1D->SetHistogram(aHist); return generated_file; } size_t AbstrConverter::GetIncoreSize() { if (Controller::Instance().IOMan()) return size_t(Controller::Const().IOMan().GetIncoresize()); else return DEFAULT_INCORESIZE; } bool AbstrConverter::QuantizeTo8Bit(LargeRAWFile& rawfile, const std::string& strTargetFilename, unsigned iComponentSize, uint64_t iSize, bool bSigned, bool bIsFloat, Histogram1DDataBlock* Histogram1D) { bool generated_target = false; if(!rawfile.IsOpen()) { T_ERROR("Could not open '%s' for 8bit quantization.", rawfile.GetFilename().c_str()); return false; } BStreamDescriptor bsd; bsd.components = 1; bsd.width = iComponentSize / 8; bsd.elements = iSize; bsd.is_signed = bSigned; bsd.fp = bIsFloat; // at this point the stream should be in whatever the native form of the // system is. bsd.big_endian = EndianConvert::IsBigEndian(); bsd.timesteps = 1; switch (iComponentSize) { case 8: generated_target = Process8Bits(rawfile, strTargetFilename, iSize, bSigned, Histogram1D); break; case 16 : if(bSigned) { generated_target = Quantize<short, unsigned char>(rawfile, bsd, strTargetFilename, Histogram1D); } else { generated_target = Quantize<unsigned short, unsigned char>( rawfile, bsd, strTargetFilename, Histogram1D ); } break; case 32 : if (bIsFloat) { generated_target = Quantize<float, unsigned char>(rawfile, bsd, strTargetFilename, Histogram1D); } else { if(bSigned) { generated_target = Quantize<int, unsigned char>(rawfile, bsd, strTargetFilename, Histogram1D); } else { generated_target = Quantize<unsigned, unsigned char>(rawfile, bsd, strTargetFilename, Histogram1D); } } break; case 64 : if (bIsFloat) { generated_target = Quantize<double, unsigned char>(rawfile, bsd, strTargetFilename, Histogram1D); } else { if(bSigned) { generated_target = Quantize<int64_t, unsigned char>( rawfile, bsd, strTargetFilename, Histogram1D ); } else { generated_target = Quantize<uint64_t, unsigned char>(rawfile, bsd, strTargetFilename, Histogram1D); } } break; } return generated_target; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/uvfMesh.h�����������������������������������������������������������������0000644�0001750�0001750�00000003234�12320456500�016464� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : uvfMesh.h //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #pragma once #ifndef UVFMESH_H #define UVFMESH_H #include "Mesh.h" class GeometryDataBlock; namespace tuvok { class uvfMesh : public Mesh { public: uvfMesh(const GeometryDataBlock& tsb); }; } #endif // UVFMESH_H ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/I3MConverter.h������������������������������������������������������������0000644�0001750�0001750�00000005546�12320456500�017337� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file I3MConverter.h \author Jens Krueger DFKI Saarbruecken and SCI Institute, University of Utah \version 1.0 \date July 2009 */ #pragma once #ifndef I3MCONVERTER_H #define I3MCONVERTER_H #include "StdTuvokDefines.h" #include "RAWConverter.h" class I3MConverter : public RAWConverter { public: I3MConverter(); virtual ~I3MConverter() {} virtual bool ConvertToRAW( const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile ); virtual bool ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize,FLOATVECTOR3 vVolumeAspect, bool bNoUserInteraction, const bool bQuantizeTo8Bit); virtual bool CanExportData() const {return true;} virtual bool CanImportData() const { return true; } protected: static void Compute8BitGradientVolumeInCore(unsigned char* pSourceData, unsigned char* pTargetData, const UINT64VECTOR3& vVolumeSize); static void DownSample(LargeRAWFile& SourceRAWFile, unsigned char* pDenseData, const UINT64VECTOR3& vVolumeSize, const UINT64VECTOR3& viDownSampleFactor); }; #endif // I3MCONVERTER_H ����������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/VariantArray.h������������������������������������������������������������0000644�0001750�0001750�00000007511�12320456500�017454� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2009 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \author Tom Fogal SCI Institute University of Utah */ #pragma once #ifndef TUVOK_VARIANT_ARRAY_H #define TUVOK_VARIANT_ARRAY_H #include "StdTuvokDefines.h" #include <memory> namespace tuvok { /** A variant array essentially tries to unionize shared_ptrs. Since they are * non-POD types, it is not technically possible to store them in a union. The * natural second choice is to simply utilize the templated nature of * shared_ptr and templatize your container, passing the type down into the * shared_ptr. The downside is that you must templatize and therefore "inline" * a potentially large amount of code. * The implementation here provides a tradeoff: a variant array has additional * constant overhead in both storage and access time, but allows one to avoid * templatizing large bodies of code. Thus it is a good fit when you: * . Want to store a large amount of data * . Grab the pointer once and access large amounts of the data * and a poor choice when your data are small or you frequently only need to * access a small subset of the data. * \note A VariantArray only holds one data type at a time; telling it to hold * a different type will invalidate access to other data. It is * runtime-typed and will give errors if you try to access data in a * manner which is not type safe. */ class VariantArray { public: enum DataType { DT_UBYTE=0, DT_BYTE, DT_USHORT, DT_SHORT, DT_FLOAT, DT_DOUBLE }; public: VariantArray(); VariantArray(const VariantArray &); ~VariantArray(); void set(const std::shared_ptr<uint8_t>, size_t len); void set(const std::shared_ptr<int8_t>, size_t len); void set(const std::shared_ptr<uint16_t>, size_t len); void set(const std::shared_ptr<int16_t>, size_t len); void set(const std::shared_ptr<float>, size_t len); void set(const std::shared_ptr<double>, size_t len); size_t size() const { return length; } const uint8_t* getub() const; const int8_t* getb() const; const uint16_t* getus() const; const int16_t* gets() const; const float* getf() const; const double* getd() const; DataType type() const; VariantArray& operator=(const VariantArray &); private: void reset(); ///< set all internal pointers to null. private: std::shared_ptr<uint8_t> scalar_ub; std::shared_ptr<int8_t> scalar_b; std::shared_ptr<int16_t> scalar_s; std::shared_ptr<uint16_t> scalar_us; std::shared_ptr<float> scalar_f; std::shared_ptr<double> scalar_d; size_t length; enum DataType data_type; }; } // namespace tuvok #endif // TUVOK_VARIANT_ARRAY_H ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/G3D.cpp�������������������������������������������������������������������0000644�0001750�0001750�00000027350�12320456500�015764� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : G3D.cpp //! Author : Georg Tamm //! DFKI, Saarbruecken //! Date : July 2010 // //! Copyright (C) 2010 DFKI Institute #include "G3D.h" void G3D::writeHeader(std::fstream & fs, const GeometryInfo & info, const uint32_t * const vertexType) { fs.write((char*)&info.isOpaque, sizeof(bool)); fs.write((char*)&info.numberPrimitives, sizeof(uint32_t)); fs.write((char*)&info.primitiveType, sizeof(uint32_t)); uint32_t numberSemantics = (uint32_t)info.attributeSemantics.size(); fs.write((char*)&numberSemantics, sizeof(uint32_t)); fs.write((char*)&info.numberIndices, sizeof(uint32_t)); fs.write((char*)&info.indexSize, sizeof(uint32_t)); fs.write((char*)&info.numberVertices, sizeof(uint32_t)); fs.write((char*)&info.vertexSize, sizeof(uint32_t)); fs.write((char*)(vertexType ? vertexType : &info.vertexType), sizeof(uint32_t)); fs.write((char*)&(info.attributeSemantics.at(0)), sizeof(uint32_t) * numberSemantics); } void G3D::writeIndices(std::fstream & fs, const uint32_t * const indices, const GeometryInfo & info) { fs.write((char*)indices, info.numberIndices * info.indexSize); } void G3D::writeVertices(std::fstream & fs, const float * const vertices, const GeometryInfo & info) { fs.write((char*)vertices, info.numberVertices * info.vertexSize); } void G3D::writeContent(std::fstream & fs, const GeometryAoS & geometry) { writeIndices(fs, geometry.indices, geometry.info); writeVertices(fs, geometry.vertices, geometry.info); } void G3D::write(const std::string & file, const GeometryAoS * const geometry, const uint32_t vertexType) { std::fstream fs; fs.open(file.c_str(), std::fstream::out | std::fstream::binary | std::fstream::trunc); if (fs.is_open()) { if (vertexType == AoS) { writeHeader(fs, geometry->info); writeContent(fs, *geometry); } else if (vertexType == SoA) { writeHeader(fs, geometry->info, &vertexType); writeIndices(fs, geometry->indices, geometry->info); std::vector<float*> vertexAttributes; convertVertices(geometry->vertices, vertexAttributes, geometry->info); writeVertices(fs, vertexAttributes, geometry->info); cleanVertices(vertexAttributes); } fs.close(); } } void G3D::writeVertices(std::fstream & fs, const std::vector<float*> & vertexAttributes, const GeometryInfo & info) { uint32_t i = 0; for (std::vector<uint32_t>::const_iterator it=info.attributeSemantics.begin(); it!=info.attributeSemantics.end(); ++it) { fs.write((char*)vertexAttributes.at(i), info.numberVertices * floats(*it) * sizeof(float)); ++i; } } void G3D::writeContent(std::fstream & fs, const GeometrySoA & geometry) { writeIndices(fs, geometry.indices, geometry.info); writeVertices(fs, geometry.vertexAttributes, geometry.info); } void G3D::write(const std::string & file, const GeometrySoA * const geometry, const uint32_t vertexType) { std::fstream fs; fs.open(file.c_str(), std::fstream::out | std::fstream::binary | std::fstream::trunc); if (fs.is_open()) { if (vertexType == SoA) { writeHeader(fs, geometry->info); writeContent(fs, *geometry); } else if (vertexType == AoS) { writeHeader(fs, geometry->info, &vertexType); writeIndices(fs, geometry->indices, geometry->info); float * vertices = NULL; convertVertices(geometry->vertexAttributes, vertices, geometry->info); writeVertices(fs, vertices, geometry->info); cleanVertices(vertices); } fs.close(); } } void G3D::readHeader(std::fstream& fs, GeometryInfo& info) { char* buffer = new char[8 * sizeof(uint32_t) + sizeof(bool)]; fs.read(buffer, 8 * sizeof(uint32_t) + sizeof(bool)); info.isOpaque = ((buffer)[0] == 1); const uint32_t* ibuf = reinterpret_cast<const uint32_t*>(buffer+1); info.numberPrimitives = ibuf[0]; info.primitiveType = ibuf[1]; uint32_t numberSemantics = ibuf[2]; info.numberIndices = ibuf[3]; info.indexSize = ibuf[4]; info.numberVertices = ibuf[5]; info.vertexSize = ibuf[6]; info.vertexType = ibuf[7]; delete[] buffer; char* buf = new char[numberSemantics * sizeof(uint32_t)]; fs.read(buf, numberSemantics * sizeof(uint32_t)); for (uint32_t i=0; i<numberSemantics; ++i) { info.attributeSemantics.push_back(((uint32_t*)buf)[i]); } delete[] buf; } void G3D::readIndices(std::fstream & fs, uint32_t *& indices, const GeometryInfo & info) { indices = (uint32_t*)new char[info.numberIndices * info.indexSize]; fs.read((char*)indices, info.numberIndices * info.indexSize); } void G3D::readVertices(std::fstream & fs, float *& vertices, const GeometryInfo & info) { vertices = (float*)new char[info.numberVertices * info.vertexSize]; fs.read((char*)vertices, info.numberVertices * info.vertexSize); } void G3D::readContent(std::fstream & fs, GeometryAoS & geometry) { readIndices(fs, geometry.indices, geometry.info); readVertices(fs, geometry.vertices, geometry.info); } void G3D::convertVertices(const std::vector<float*> & vertexAttributes, float *& vertices, const GeometryInfo & info) { vertices = (float*)new char[info.numberVertices * info.vertexSize]; uint32_t vertexFloats = info.vertexSize / sizeof(float); for (uint32_t i=0; i<info.numberVertices; ++i) { uint32_t offset = 0; uint32_t attributeIndex = 0; for (std::vector<uint32_t>::const_iterator it=info.attributeSemantics.begin(); it!=info.attributeSemantics.end(); ++it) { uint32_t attributeFloats = floats(*it); for (uint32_t j=0; j<attributeFloats; ++j) vertices[j + offset + (i * vertexFloats)] = vertexAttributes[attributeIndex][j + (i * attributeFloats)]; offset += attributeFloats; ++attributeIndex; } } } void G3D::read(const std::string & file, GeometryAoS * const geometry) { std::fstream fs; fs.open(file.c_str(), std::fstream::in | std::fstream::binary); if (fs.is_open()) { readHeader(fs, geometry->info); if (geometry->info.vertexType == AoS) readContent(fs, *geometry); else if (geometry->info.vertexType == SoA) { geometry->info.vertexType = AoS; readIndices(fs, geometry->indices, geometry->info); std::vector<float*> vertexAttributes; readVertices(fs, vertexAttributes, geometry->info); convertVertices(vertexAttributes, geometry->vertices, geometry->info); cleanVertices(vertexAttributes); } fs.close(); } } void G3D::readVertices(std::fstream & fs, std::vector<float*> & vertexAttributes, const GeometryInfo & info) { for (uint32_t i=0; i<info.attributeSemantics.size(); ++i) { vertexAttributes.push_back(NULL); uint32_t attributeFloats = floats(info.attributeSemantics.at(i)); vertexAttributes.at(i) = new float[info.numberVertices * attributeFloats]; fs.read((char*)vertexAttributes.at(i), info.numberVertices * attributeFloats * sizeof(float)); } } void G3D::readContent(std::fstream & fs, GeometrySoA & geometry) { readIndices(fs, geometry.indices, geometry.info); readVertices(fs, geometry.vertexAttributes, geometry.info); } void G3D::convertVertices(const float * const vertices, std::vector<float*> & vertexAttributes, const GeometryInfo & info) { uint32_t i = 0; for (std::vector<uint32_t>::const_iterator it=info.attributeSemantics.begin(); it!=info.attributeSemantics.end(); ++it) { vertexAttributes.push_back(NULL); uint32_t attributeFloats = floats(*it); vertexAttributes.at(i) = new float[info.numberVertices * attributeFloats]; ++i; } uint32_t vertexFloats = info.vertexSize / sizeof(float); for (uint32_t i=0; i<info.numberVertices; ++i) { uint32_t offset = 0; uint32_t attributeIndex = 0; for (std::vector<uint32_t>::const_iterator it=info.attributeSemantics.begin(); it!=info.attributeSemantics.end(); ++it) { uint32_t attributeFloats = floats(*it); for (uint32_t j=0; j<attributeFloats; ++j) vertexAttributes[attributeIndex][j + (i * attributeFloats)] = vertices[j + offset + (i * vertexFloats)]; offset += attributeFloats; ++attributeIndex; } } } void G3D::read(const std::string & file, GeometrySoA * const geometry) { std::fstream fs; fs.open(file.c_str(), std::fstream::in | std::fstream::binary); if (fs.is_open()) { readHeader(fs, geometry->info); if (geometry->info.vertexType == SoA) readContent(fs, *geometry); else if (geometry->info.vertexType == AoS) { geometry->info.vertexType = SoA; readIndices(fs, geometry->indices, geometry->info); float * vertices = NULL; readVertices(fs, vertices, geometry->info); convertVertices(vertices, geometry->vertexAttributes, geometry->info); cleanVertices(vertices); } fs.close(); } } void G3D::cleanIndices(uint32_t * indices) { delete [] indices; indices = NULL; } void G3D::cleanVertices(float * vertices) { delete [] vertices; vertices = NULL; } void G3D::cleanVertices(std::vector<float*> & vertexAttributes) { for (std::vector<float*>::iterator it=vertexAttributes.begin(); it!=vertexAttributes.end(); ++it) delete [] *it; vertexAttributes.clear(); } void G3D::clean(GeometryAoS * geometry) { cleanIndices(geometry->indices); cleanVertices(geometry->vertices); geometry->info.attributeSemantics.clear(); geometry = NULL; } void G3D::clean(GeometrySoA * geometry) { cleanIndices(geometry->indices); cleanVertices(geometry->vertexAttributes); geometry->info.attributeSemantics.clear(); geometry = NULL; } void G3D::print(const Geometry * const geometry, std::ostream & output) { if (geometry) { output << "Opaque: " << (geometry->info.isOpaque ? "yes" : "no") << std::endl; output << "Number primitives: " << geometry->info.numberPrimitives << std::endl; output << "Primitive type: " << ((geometry->info.primitiveType == Point) ? "Point" : (geometry->info.primitiveType == Line) ? "Line" : (geometry->info.primitiveType == Triangle) ? "Triangle" : (geometry->info.primitiveType == TriangleAdj) ? "Triangle with adjacency" : "Unknown") << std::endl; output << "Number indices: " << geometry->info.numberIndices << std::endl; output << "Index size: " << geometry->info.indexSize << std::endl; output << "Number vertices: " << geometry->info.numberVertices << std::endl; output << "Vertex size: " << geometry->info.vertexSize << std::endl; output << "Vertex type: " << ((geometry->info.vertexType == AoS) ? "Array of Structs" : (geometry->info.vertexType == SoA) ? "Struct of Arrays" : "Unknown") << std::endl; output << "Vertex attribute semantics:" << std::endl; for (std::vector<uint32_t>::const_iterator it=geometry->info.attributeSemantics.begin(); it!=geometry->info.attributeSemantics.end(); ++it) { output << "\t" << (((*it) == Position) ? "Position" : ((*it) == Normal) ? "Normal" : ((*it) == Tangent) ? "Tangent" : ((*it) == Color) ? "Color" : ((*it) == Tex) ? "Tex" : ((*it) == Float) ? "Float" : "Unknown") << " (" << floats(*it) << "f)" << std::endl; } } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/QVISConverter.h�����������������������������������������������������������0000644�0001750�0001750�00000005066�12320456500�017526� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file QVISConverter.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date December 2008 */ #pragma once #ifndef QVISCONVERTER_H #define QVISCONVERTER_H #include "../StdTuvokDefines.h" #include "RAWConverter.h" class QVISConverter : public RAWConverter { public: QVISConverter(); virtual ~QVISConverter() {} virtual bool ConvertToRAW( const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile ); virtual bool ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize,FLOATVECTOR3 vVolumeAspect, bool bNoUserInteraction, const bool bQuantizeTo8Bit); virtual bool CanExportData() const { return true; } virtual bool CanImportData() const { return true; } }; #endif // QVISCONVERTER_H ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/PLYGeoConverter.h���������������������������������������������������������0000644�0001750�0001750�00000007147�12320456500�020045� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : PLYGeoConverter.h //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #pragma once #ifndef PLYGEOCONVERTER_H #define PLYGEOCONVERTER_H #include "../StdTuvokDefines.h" #include <tuple> #include "AbstrGeoConverter.h" namespace tuvok { class PLYGeoConverter : public AbstrGeoConverter { public: PLYGeoConverter(); virtual ~PLYGeoConverter() {} virtual std::shared_ptr<Mesh> ConvertToMesh(const std::string& strFilename); virtual bool ConvertToNative(const Mesh& m, const std::string& strTargetFilename); virtual bool CanExportData() const { return true; } virtual bool CanImportData() const { return true; } private: enum { SEARCHING_MAGIC = 0, PARSING_GENERAL_HEADER, PARSING_VERTEX_HEADER, PARSING_FACE_HEADER, PARSING_EDGE_HEADER, PARSING_VERTEX_DATA, PARSING_FACE_DATA, PARSING_EDGE_DATA, PARSING_DONE, STATE_COUNT }; enum { FORMAT_ASCII = 0, FORMAT_BIN_LITTLE, FORMAT_BIN_BIG, FORMAT_COUNT }; enum propType { PROPT_FLOAT = 0, PROPT_DOUBLE, PROPT_INT8, PROPT_UINT8, PROPT_INT16, PROPT_UINT16, PROPT_INT32, PROPT_UINT32, PROPT_UNKNOWN }; enum vertexProp { VPROP_X = 0, VPROP_Y, VPROP_Z, VPROP_NX, VPROP_NY, VPROP_NZ, VPROP_RED, VPROP_GREEN, VPROP_BLUE, VPROP_OPACITY, VPROP_INTENSITY, VPROP_CONFIDENCE, VPROP_UNKNOWN }; enum faceProp { FPROP_LIST = 0, FPROP_UNKNOWN }; enum edgeProp { EPROP_VERTEX1 = 0, EPROP_VERTEX2, EPROP_RED, EPROP_GREEN, EPROP_BLUE, EPROP_OPACITY, EPROP_INTENSITY, EPROP_UNKNOWN }; std::vector<std::pair<propType, vertexProp>> vertexProps; std::vector<std::tuple<propType, propType, faceProp>> faceProps; std::vector<std::pair<propType, edgeProp>> edgeProps; propType StringToType(const std::string& token); vertexProp StringToVProp(const std::string& token); faceProp StringToFProp(const std::string& token); edgeProp StringToEProp(const std::string& token); }; } #endif // PLYGEOCONVERTER_H �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/VTKConverter.cpp����������������������������������������������������������0000644�0001750�0001750�00000015743�12320456500�017746� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <algorithm> #include <fstream> #include <stdexcept> #include "VTKConverter.h" #include "Basics/BStream.h" #include "Basics/EndianConvert.h" #include "Controller/Controller.h" VTKConverter::VTKConverter() { m_vConverterDesc = "VTK"; m_vSupportedExt.push_back("VTK"); } bool VTKConverter::CanRead(const std::string& fn, const std::vector<int8_t>& start) const { if(!AbstrConverter::CanRead(fn, start)) { MESSAGE("Base class reports we can't read it, bailing."); return false; } // the file should start with: // # vtk DataFile Version 3.0 // if it doesn't than we probably can't read it. auto nl = std::find(start.begin(), start.end(), '\n'); if(nl == start.end()) { const char* comment = "# vtk DataFile Version 3.0"; MESSAGE("missing '%s' at beginning of the file; I probably can't read " "this. Bailing out...", comment); return false; } std::string firstline( static_cast<const signed char*>(&start[0]), static_cast<const signed char*>(&*nl) ); if(firstline.find("vtk") == std::string::npos) { MESSAGE("No 'vtk' in first line; this is not mine."); return false; } if(firstline.find("DataFile") == std::string::npos) { MESSAGE("No 'DataFile' in first line; this is not mine."); return false; } return true; } /// scans through a file until it finds the given line. /// a subsequent read will return data from the beginning of that line. std::istream& scan_for_line(std::istream& is, const std::string& start) { std::streampos loc; std::string temporary; do { loc = is.tellg(); std::getline(is, temporary); std::istringstream iss(temporary); std::string linestart; iss >> linestart; if(linestart == start) { is.seekg(loc); return is; } } while(!is.eof()); return is; } /// vtk gives its types in the files as strings, e.g. "float", etc. /// we need to get this information into type variables; this converts from /// VTK's strings into our variables. /// Note that only the type fields are set as a postcondition; we don't know /// how many elements there will be, for example. struct BStreamDescriptor vtk_to_tuvok_type(const std::string& vtktype) { struct BStreamDescriptor bs; bs.components = 1; bs.big_endian = true; // legacy VTK files are *always* big-endian. if(vtktype == "float") { bs.width = sizeof(float); bs.fp = true; bs.is_signed = true; } else { throw std::logic_error("unhandled vtk type case"); } return bs; } bool VTKConverter::ConvertToRAW( const std::string& strSourceFilename, const std::string& /* tempdir */, bool /* user interaction */, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianness, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile ) { MESSAGE("Converting %s from VTK...", strSourceFilename.c_str()); strTitle = "from VTK converter"; std::ifstream vtk(strSourceFilename.c_str(), std::ios::binary); std::string current, junk; std::getline(vtk, current); // ignore comment line std::getline(vtk, current); // ignore "PsiPhi grid data" vtk >> current; if(current != "BINARY") { T_ERROR("I can only read binary VTK data; this is '%s'", current.c_str()); return false; } vtk >> junk >> current; if(current != "STRUCTURED_POINTS") { T_ERROR("I can only read STRUCTURED_POINTS data; this is '%s'", current.c_str()); return false; } vVolumeSize = UINT64VECTOR3(0,0,0); vtk >> junk >> vVolumeSize[0] >> vVolumeSize[1] >> vVolumeSize[2]; if(vVolumeSize[0] == 0 || vVolumeSize[1] == 0 || vVolumeSize[2] == 0) { T_ERROR("Invalid 0-length volume size!"); return false; } // indices are 1-based!! (cell data) vVolumeSize[0] -= 1; vVolumeSize[1] -= 1; vVolumeSize[2] -= 1; MESSAGE("VTK volume is %llux%llux%llu", vVolumeSize[0], vVolumeSize[1], vVolumeSize[2]); vtk >> junk >> junk >> junk >> junk; // ORIGIN blah blah blah vtk >> junk >> vVolumeAspect[0] >> vVolumeAspect[1] >> vVolumeAspect[2]; MESSAGE("aspect: %5.3fx%5.3fx%5.3f", vVolumeAspect[0], vVolumeAspect[1], vVolumeAspect[2]); // now we now the basics of the data, but we can have multiple fields in the // file. Scan through until we find the first SCALARS. scan_for_line(vtk, "SCALARS"); if(vtk.eof()) { T_ERROR("No scalar data in file!"); return false; } std::string type, one; vtk >> junk >> current >> type >> one; assert(junk == "SCALARS"); // if not, then scan_for_line failed. strTitle = current + " from VTK converter"; MESSAGE("Reading field '%s' from the VTK file...", current.c_str()); assert(one == "1"); // this is always "1" in the files I have... BStreamDescriptor bs = vtk_to_tuvok_type(type); iComponentSize = bs.width * 8; // bytes to bits iComponentCount = bs.components; bSigned = bs.is_signed; bIsFloat = bs.fp; // legacy VTK files are always Big endian, so we need to convert if we're // little endian. bConvertEndianness = EndianConvert::IsLittleEndian(); vtk >> junk >> current; // "LOOKUP_TABLE default" // gotta get rid of a byte before we figure out where we are. char newline; vtk.read(&newline, 1); // we can just skip to the binary data without creating a new file. Do that. iHeaderSkip = static_cast<uint64_t>(vtk.tellg()); { std::ofstream raw("rawdata-from-vtk.data", std::ios::binary); const uint64_t elems = vVolumeSize.volume(); float cur; for(uint64_t i=0; i < elems; ++i) { vtk.read(reinterpret_cast<char*>(&cur), sizeof(float)); raw.write(reinterpret_cast<char*>(&cur), sizeof(float)); } raw.close(); } strIntermediateFile = strSourceFilename; bDeleteIntermediateFile = false; return true; } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2013 IVDA Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ �����������������������������ImageVis3D-3.1.0/Tuvok/IO/IO.pro��������������������������������������������������������������������0000644�0001750�0001750�00000000106�12320456500�015722� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������SUBDIRS = expressions/ scio.pro TEMPLATE = subdirs ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/REKConverter.h������������������������������������������������������������0000644�0001750�0001750�00000006363�12320456500�017366� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* The MIT License Copyright (c) 2009 Institut of Mechanics and Fluid Dynamics, TU Bergakademie Freiberg. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file REKConverter.h \author Andre Liebscher Institut of Mechanics and Fluid Dynamics TU Bergakademie Freiberg \version 1.1 \date March 2009 */ #pragma once #ifndef REKCONVERTER_H #define REKCONVERTER_H #include "../StdTuvokDefines.h" #include "RAWConverter.h" /** A converter for REK volumes used by Frauenhofer EZRT. */ class REKConverter : public RAWConverter { public: REKConverter(); virtual ~REKConverter() {} virtual bool ConvertToRAW(const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile); /// @todo unimplemented! virtual bool ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize, FLOATVECTOR3 vVolumeAspect, bool bNoUserInteraction, const bool bQuantizeTo8Bit); virtual bool CanExportData() const {return false;} virtual bool CanImportData() const { return true; } private: template<typename T, size_t N> T Parse( char data[], bool convertEndianess = false ) { char buffer[N]; for( size_t i = 0; i < N; i++ ) { buffer[i] = convertEndianess ? data[N-i+1] : data[i]; } return *reinterpret_cast<T*>(buffer); } }; #endif // REKCONVERTER_H �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/KitwareConverter.h��������������������������������������������������������0000644�0001750�0001750�00000005113�12320456500�020343� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file KitwareConverter.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date December 2008 */ #pragma once #ifndef KITWARECONVERTER_H #define KITWARECONVERTER_H #include "../StdTuvokDefines.h" #include "RAWConverter.h" class KitwareConverter : public RAWConverter { public: KitwareConverter(); virtual ~KitwareConverter() {} virtual bool ConvertToRAW( const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile ); virtual bool ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize,FLOATVECTOR3 vVolumeAspect, bool bNoUserInteraction, const bool bQuantizeTo8Bit); virtual bool CanExportData() const { return true; } virtual bool CanImportData() const { return true; } }; #endif // KITWARECONVERTER_H �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/G3D.h���������������������������������������������������������������������0000644�0001750�0001750�00000011426�12320456500�015426� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : G3D.h //! Author : Georg Tamm //! DFKI, Saarbruecken //! Date : July 2010 // //! Copyright (C) 2010 DFKI #pragma once #ifndef G3D_H #define G3D_H #include "StdTuvokDefines.h" #include <fstream> #include <vector> class G3D { public: enum AttributeSemantic { Position, Normal, Tangent, Color, Tex, Float }; enum PrimitiveType { Point, Line, Triangle, TriangleAdj }; enum VertexType { SoA, AoS }; struct GeometryInfo { GeometryInfo() : vertexType(AoS), numberPrimitives(0), primitiveType(Triangle), numberIndices(0), numberVertices(0), vertexSize(0), indexSize(0), isOpaque(true) {} uint32_t vertexType; uint32_t numberPrimitives; uint32_t primitiveType; uint32_t numberIndices; uint32_t numberVertices; uint32_t vertexSize; uint32_t indexSize; bool isOpaque; std::vector<uint32_t> attributeSemantics; }; struct Geometry { Geometry() : indices(NULL) {} GeometryInfo info; uint32_t * indices; }; struct GeometryAoS : Geometry { GeometryAoS() : Geometry(), vertices(NULL) { info.vertexType = AoS; } float * vertices; }; struct GeometrySoA : Geometry { GeometrySoA() : Geometry() { info.vertexType = SoA; } std::vector<float*> vertexAttributes; }; static uint32_t floats(uint32_t semantic) { switch (semantic) { case Position: return 3; case Normal: return 3; case Tangent: return 3; case Color: return 4; case Tex: return 2; case Float: return 1; default: return 0; } } static void write(const std::string & file, const GeometryAoS * const geometry, const uint32_t vertexType = AoS); static void write(const std::string & file, const GeometrySoA * const geometry, const uint32_t vertexType = SoA); static void read(const std::string & file, GeometryAoS * const geometry); static void read(const std::string & file, GeometrySoA * const geometry); static void print(const Geometry * const geometry, std::ostream & output); static void clean(GeometryAoS * geometry); static void clean(GeometrySoA * geometry); private: static void writeHeader(std::fstream & fs, const GeometryInfo & info, const uint32_t * const vertexType = NULL); static void writeIndices(std::fstream & fs, const uint32_t * const indices, const GeometryInfo & info); static void writeVertices(std::fstream & fs, const float * const vertices, const GeometryInfo & info); static void writeVertices(std::fstream & fs, const std::vector<float*> & vertexAttributes, const GeometryInfo & info); static void writeContent(std::fstream & fs, const GeometryAoS & geometry); static void writeContent(std::fstream & fs, const GeometrySoA & geometry); static void readHeader(std::fstream & fs, GeometryInfo & info); static void readIndices(std::fstream & fs, uint32_t *& indices, const GeometryInfo & info); static void readVertices(std::fstream & fs, float *& vertices, const GeometryInfo & info); static void readVertices(std::fstream & fs, std::vector<float*> & vertexAttributes, const GeometryInfo & info); static void readContent(std::fstream & fs, GeometryAoS & geometry); static void readContent(std::fstream & fs, GeometrySoA & geometry); static void convertVertices(const std::vector<float*> & vertexAttributes, float *& vertices, const GeometryInfo & info); static void convertVertices(const float * const vertices, std::vector<float*> & vertexAttributes, const GeometryInfo & info); static void cleanIndices(uint32_t * indices); static void cleanVertices(float * vertices); static void cleanVertices(std::vector<float*> & vertexAttributes); }; #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/FileBackedDataset.cpp�����������������������������������������������������0000644�0001750�0001750�00000002751�12320456500�020664� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2009 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file FileBackedDataset.h \author Tom Fogal SCI Institute University of Utah */ #include "FileBackedDataset.h" namespace tuvok { bool FileBackedDataset::Verify(const std::string&) const { return true; } } // namespace tuvok �����������������������ImageVis3D-3.1.0/Tuvok/IO/Dataset.cpp���������������������������������������������������������������0000644�0001750�0001750�00000010353�12320456500�016767� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Dataset.cpp \author Tom Fogal SCI Institute University of Utah */ #include "Dataset.h" #include "Basics/MathTools.h" #include "Basics/Mesh.h" namespace tuvok { Dataset::Dataset(): m_UserScale(1.0,1.0,1.0), m_DomainScale(1.0, 1.0, 1.0) { m_DomainScale = DOUBLEVECTOR3(1.0, 1.0, 1.0); } Dataset::~Dataset() { DeleteMeshes(); } void Dataset::DeleteMeshes() { m_vpMeshList.clear(); } void Dataset::SetRescaleFactors(const DOUBLEVECTOR3& rescale) { m_UserScale = rescale; } DOUBLEVECTOR3 Dataset::GetRescaleFactors() const { return m_UserScale; } std::pair<FLOATVECTOR3, FLOATVECTOR3> Dataset::GetTextCoords(BrickTable::const_iterator brick, bool bUseOnlyPowerOfTwo) const { FLOATVECTOR3 vTexcoordsMin; FLOATVECTOR3 vTexcoordsMax; const UINTVECTOR3 vOverlap = GetBrickOverlapSize(); const bool first_x = BrickIsFirstInDimension(0, brick->first); const bool first_y = BrickIsFirstInDimension(1, brick->first); const bool first_z = BrickIsFirstInDimension(2, brick->first); const bool last_x = BrickIsLastInDimension(0, brick->first); const bool last_y = BrickIsLastInDimension(1, brick->first); const bool last_z = BrickIsLastInDimension(2, brick->first); if (bUseOnlyPowerOfTwo) { UINTVECTOR3 vRealVoxelCount(MathTools::NextPow2(brick->second.n_voxels.x), MathTools::NextPow2(brick->second.n_voxels.y), MathTools::NextPow2(brick->second.n_voxels.z) ); vTexcoordsMin = FLOATVECTOR3( (first_x) ? 0.5f/vRealVoxelCount.x : vOverlap.x*0.5f/vRealVoxelCount.x, (first_y) ? 0.5f/vRealVoxelCount.y : vOverlap.y*0.5f/vRealVoxelCount.y, (first_z) ? 0.5f/vRealVoxelCount.z : vOverlap.z*0.5f/vRealVoxelCount.z ); vTexcoordsMax = FLOATVECTOR3( (last_x) ? 1.0f-0.5f/vRealVoxelCount.x : 1.0f-vOverlap.x*0.5f/vRealVoxelCount.x, (last_y) ? 1.0f-0.5f/vRealVoxelCount.y : 1.0f-vOverlap.y*0.5f/vRealVoxelCount.y, (last_z) ? 1.0f-0.5f/vRealVoxelCount.z : 1.0f-vOverlap.z*0.5f/vRealVoxelCount.z ); vTexcoordsMax -= FLOATVECTOR3(vRealVoxelCount - brick->second.n_voxels) / FLOATVECTOR3(vRealVoxelCount); } else { vTexcoordsMin = FLOATVECTOR3( (first_x) ? 0.5f/brick->second.n_voxels.x : vOverlap.x*0.5f/brick->second.n_voxels.x, (first_y) ? 0.5f/brick->second.n_voxels.y : vOverlap.y*0.5f/brick->second.n_voxels.y, (first_z) ? 0.5f/brick->second.n_voxels.z : vOverlap.z*0.5f/brick->second.n_voxels.z ); // for padded volume adjust texcoords vTexcoordsMax = FLOATVECTOR3( (last_x) ? 1.0f-0.5f/brick->second.n_voxels.x : 1.0f-vOverlap.x*0.5f/brick->second.n_voxels.x, (last_y) ? 1.0f-0.5f/brick->second.n_voxels.y : 1.0f-vOverlap.y*0.5f/brick->second.n_voxels.y, (last_z) ? 1.0f-0.5f/brick->second.n_voxels.z : 1.0f-vOverlap.z*0.5f/brick->second.n_voxels.z ); } return std::make_pair(vTexcoordsMin, vTexcoordsMax); } } // tuvok namespace. �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/BrickedDataset.cpp��������������������������������������������������������0000644�0001750�0001750�00000013154�12320456500�020255� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2009 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file BrickedDataset.h \author Tom Fogal SCI Institute University of Utah */ #include <cassert> #include <stdexcept> #include "BrickedDataset.h" #include "Controller/Controller.h" namespace tuvok { BrickedDataset::BrickedDataset() { } BrickedDataset::~BrickedDataset() { } void BrickedDataset::NBricksHint(size_t n) { // The following line implements bricks.reserve(n); // in a portable way. unordered_map does not define // a reserve function but is seems gcc's tr1 does bricks.rehash(size_t(ceil(float(n) / bricks.max_load_factor()))); } /// Adds a brick to the dataset. void BrickedDataset::AddBrick(const BrickKey& bk, const BrickMD& brick) { #if 0 MESSAGE("adding brick <%u,%u,%u> -> ((%g,%g,%g), (%g,%g,%g), (%u,%u,%u))", static_cast<unsigned>(std::get<0>(bk)), static_cast<unsigned>(std::get<1>(bk)), static_cast<unsigned>(std::get<2>(bk)), brick.center[0], brick.center[1], brick.center[2], brick.extents[0], brick.extents[1], brick.extents[2], static_cast<unsigned>(brick.n_voxels[0]), static_cast<unsigned>(brick.n_voxels[1]), static_cast<unsigned>(brick.n_voxels[2])); #endif this->bricks.insert(std::make_pair(bk, brick)); } /// Looks up the spatial range of a brick. FLOATVECTOR3 BrickedDataset::GetBrickExtents(const BrickKey &bk) const { BrickTable::const_iterator iter = this->bricks.find(bk); if(iter == this->bricks.end()) { T_ERROR("Unknown brick (%u, %u, %u)", static_cast<unsigned>(std::get<0>(bk)), static_cast<unsigned>(std::get<1>(bk)), static_cast<unsigned>(std::get<2>(bk))); return FLOATVECTOR3(0.0f, 0.0f, 0.0f); } return iter->second.extents; } UINTVECTOR3 BrickedDataset::GetBrickVoxelCounts(const BrickKey& bk) const { BrickTable::const_iterator iter = this->bricks.find(bk); if(this->bricks.end() == iter) { throw std::domain_error("unknown brick."); } return iter->second.n_voxels; } /// @return an iterator that can be used to visit every brick in the dataset. BrickTable::const_iterator BrickedDataset::BricksBegin() const { return this->bricks.begin(); } BrickTable::const_iterator BrickedDataset::BricksEnd() const { return this->bricks.end(); } /// @return the number of bricks at the given LOD. BrickTable::size_type BrickedDataset::GetBrickCount(size_t lod, size_t ts) const { BrickTable::size_type count = 0; BrickTable::const_iterator iter = this->bricks.begin(); for(; iter != this->bricks.end(); ++iter) { if(std::get<0>(iter->first) == ts && std::get<1>(iter->first) == lod) { ++count; } } return count; } size_t BrickedDataset::GetLargestSingleBrickLOD(size_t ts) const { const size_t n_lods = this->GetLODLevelCount(); for(size_t lod=0; lod < n_lods; ++lod) { if(this->GetBrickCount(lod, ts) == 1) { return lod; } } assert("not reachable"); return 0; } uint64_t BrickedDataset::GetTotalBrickCount() const { return static_cast<uint64_t>(this->bricks.size()); } const BrickMD& BrickedDataset::GetBrickMetadata(const BrickKey& k) const { return this->bricks.find(k)->second; } // we don't actually know how the user bricked the data set here; only a // derived class would know. so, calculate it instead. UINTVECTOR3 BrickedDataset::GetMaxBrickSize() const { return this->GetMaxUsedBrickSizes(); } UINTVECTOR3 BrickedDataset::GetMaxUsedBrickSizes() const { UINTVECTOR3 bsize(0,0,0); for(auto b=this->bricks.begin(); b != this->bricks.end(); ++b) { bsize.StoreMax(b->second.n_voxels); } return bsize; } bool BrickedDataset::BrickIsFirstInDimension(size_t dim, const BrickKey& k) const { assert(dim <= 3); const BrickMD& md = this->bricks.find(k)->second; for(BrickTable::const_iterator iter = this->BricksBegin(); iter != this->BricksEnd(); ++iter) { if(iter->second.center[dim] < md.center[dim]) { return false; } } return true; } bool BrickedDataset::BrickIsLastInDimension(size_t dim, const BrickKey& k) const { assert(dim <= 3); const BrickMD& md = this->bricks.find(k)->second; for(BrickTable::const_iterator iter = this->BricksBegin(); iter != this->BricksEnd(); ++iter) { if(iter->second.center[dim] > md.center[dim]) { return false; } } return true; } void BrickedDataset::Clear() { MESSAGE("Clearing brick metadata."); bricks.clear(); } } // namespace tuvok ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/StkConverter.cpp����������������������������������������������������������0000644�0001750�0001750�00000015263�12320456500�020040� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file StkConverter.cpp \author Tom Fogal SCI Institute University of Utah */ #ifndef TUVOK_NO_IO # include "3rdParty/tiff/tiffio.h" #else struct TIFF; #endif #include "StkConverter.h" #include "../Basics/SysTools.h" #include "../Controller/Controller.h" using namespace tuvok; struct stk { uint32_t x,y,z; ///< dimensions uint16_t bpp; ///< bits per pixel uint16_t samples; ///< number of components per pixel }; static bool stk_read_metadata(TIFF*, struct stk&); static void stk_read_write_strips(TIFF*, LargeRAWFile&); StkConverter::StkConverter() { m_vConverterDesc = "Stk Volume (Metamorph)"; #ifndef TUVOK_NO_IO m_vSupportedExt.push_back("STK"); #endif } bool StkConverter::ConvertToRAW(const std::string& strSourceFilename, const std::string& strTempDir, bool, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile) { #ifdef TUVOK_NO_IO T_ERROR("Tuvok was not built with IO support!"); return false; #else MESSAGE("Attempting to convert stk file: %s", strSourceFilename.c_str()); TIFF *tif = TIFFOpen(strSourceFilename.c_str(), "r"); if(tif == NULL) { T_ERROR("Could not open %s", strSourceFilename.c_str()); return false; } struct stk metadata; if(!stk_read_metadata(tif, metadata)) { return false; } MESSAGE("%ux%ux%u %s", metadata.x, metadata.y, metadata.z, m_vConverterDesc.c_str()); MESSAGE("%hu bits per component.", metadata.bpp); MESSAGE("%hu component%s.", metadata.samples, (metadata.samples == 1) ? "" : "s"); // copy that metadata into Tuvok variables. iComponentSize = metadata.bpp; iComponentCount = metadata.samples; vVolumeSize[0] = metadata.x; vVolumeSize[1] = metadata.y; vVolumeSize[2] = metadata.z; // IIRC libtiff handles all the endian issues for us. bConvertEndianess = false; // One might consider setting the values below explicitly (as opposed // to reading them from somewhere) to be bugs, but we're not quite // sure where to read these from. In any case, we don't have any // data for which these settings are invalid. bSigned = false; bIsFloat = false; vVolumeAspect[0] = 1; vVolumeAspect[1] = 1; vVolumeAspect[2] = 1; strTitle = "STK Volume"; // Create an intermediate file to hold the data. iHeaderSkip = 0; strIntermediateFile = strTempDir + SysTools::GetFilename(strSourceFilename) + ".binary"; LargeRAWFile binary(strIntermediateFile); binary.Create(iComponentSize/8 * iComponentCount * vVolumeSize.volume()); if(!binary.IsOpen()) { T_ERROR("Could not create binary file %s", strIntermediateFile.c_str()); TIFFClose(tif); return false; } // Populate the intermediate file. We just run through each strip and write // it out; technically, this is not kosher for Tuvok, since a single strip // might exceed INCORESIZE. That said, I've never seen a strip which is // larger than 8192 bytes. stk_read_write_strips(tif, binary); bDeleteIntermediateFile = true; binary.Close(); TIFFClose(tif); return true; #endif } // unimplemented! bool StkConverter::ConvertToNative(const std::string&, const std::string&, uint64_t, unsigned, uint64_t, bool, bool, UINT64VECTOR3, FLOATVECTOR3, bool, bool) { return false; } static bool stk_read_metadata(TIFF* tif, struct stk& metadata) { #ifdef TUVOK_NO_IO return false; #else // read the number of bits per component from the tiff tag. TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &metadata.bpp); TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &metadata.x); TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &metadata.y); // It's common for Stk files not to easily give the depth. if(TIFFGetField(tif, TIFFTAG_IMAGEDEPTH, &metadata.z) == 0) { // Depth not available as a tag; have to read it from the stk metadata. // In particular, we'll look up the UIC3Tag and count the number of values // in there. const ttag_t uic3tag = (ttag_t) 33630; // the tag is private. uint32_t count; void *data; if(TIFFGetField(tif, uic3tag, &count, &data) == 0) { return false; // UIC3 tag does not exist; this is not a stk. } // The data actually gives the per-slice spacing .. but we just ignore // that. All we care about is how many slices there are. metadata.z = count; } metadata.samples = 1; TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &metadata.samples); return true; #endif } static void stk_read_write_strips(TIFF* tif, LargeRAWFile& raw) { #ifndef TUVOK_NO_IO const tstrip_t n_strips = TIFFNumberOfStrips(tif); tdata_t buf = static_cast<tdata_t>(_TIFFmalloc(TIFFStripSize(tif))); for(tstrip_t s=0; s < n_strips; ++s) { /// @todo FIXME: don't assume the strip is raw; could be encoded. /// There's a `compression scheme' tag which probably details this. tsize_t n_bytes = TIFFReadRawStrip(tif, s, buf, static_cast<tsize_t>(-1)); raw.WriteRAW(static_cast<unsigned char*>(buf), n_bytes); } _TIFFfree(buf); #endif } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/MedAlyVisFiberTractGeoConverter.cpp���������������������������������������0000644�0001750�0001750�00000020711�12320456500�023527� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : MedAlyVisFiberTractGeoConverter.cpp //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #include "MedAlyVisFiberTractGeoConverter.h" #include "Controller/Controller.h" #include "SysTools.h" #include "Mesh.h" #include <fstream> #include "TuvokIOError.h" using namespace tuvok; using namespace std; MedAlyVisFiberTractGeoConverter::MedAlyVisFiberTractGeoConverter() : AbstrGeoConverter() { m_vConverterDesc = "MedAlyVis Fiber Tract File"; m_vSupportedExt.push_back("TRK"); } std::shared_ptr<Mesh> MedAlyVisFiberTractGeoConverter::ConvertToMesh(const std::string& strFilename) { VertVec vertices; ColorVec colors; IndexVec VertIndices; IndexVec COLIndices; std::ifstream fs; std::string line; fs.open(strFilename.c_str()); if (fs.fail()) { throw tuvok::io::DSOpenFailed(strFilename.c_str(), __FILE__, __LINE__); } int iReaderState = SEARCHING_DIM; UINTVECTOR3 iDim; FLOATVECTOR3 fScale; FLOATVECTOR3 fTranslation; INTVECTOR4 iMetadata; size_t iElementCounter=0; size_t iElementReadCounter=0; int iLineCounter=-1; // get filesize. fs.seekg(0, std::ios_base::end); std::streampos sz = fs.tellg(); fs.seekg(0, std::ios_base::beg); double prev_progress = 0.0; while (!fs.fail() || iLineCounter == iMetadata[2]) { getline(fs, line); if (fs.fail()) break; // no more lines to read // remove comments size_t cPos = line.find_first_of('#'); if (cPos != std::string::npos) line = line.substr(0,cPos); line = SysTools::TrimStr(line); if (line.length() == 0) continue; // skips empty and comment lines double progress = static_cast<double>(fs.tellg()) / static_cast<double>(sz); if(progress - prev_progress > 0.01 || progress > 0.98) { prev_progress = progress; MESSAGE("Reading mesh... %g%%", progress*100.0); } switch (iReaderState) { case SEARCHING_DIM : { iDim[0] = atoi(line.c_str()); line = TrimToken(line); iDim[1] = atoi(line.c_str()); line = TrimToken(line); iDim[2] = atoi(line.c_str()); iReaderState++; } break; case SEARCHING_SCALE : { fScale[0] = float(atof(line.c_str())); line = TrimToken(line); fScale[1] = float(atof(line.c_str())); line = TrimToken(line); fScale[2] = float(atof(line.c_str())); iReaderState++; } break; case SEARCHING_TRANSLATION : { fTranslation[0] = float(atof(line.c_str())); line = TrimToken(line); fTranslation[1] = float(atof(line.c_str())); line = TrimToken(line); fTranslation[2] = float(atof(line.c_str())); iReaderState++; } break; case SEARCHING_METADATA : { iMetadata[0] = atoi(line.c_str()); line = TrimToken(line); iMetadata[1] = atoi(line.c_str()); line = TrimToken(line); iMetadata[2] = atoi(line.c_str()); line = TrimToken(line); iMetadata[3] = atoi(line.c_str()); iLineCounter = 0; iReaderState++; } break; case PARSING_COUNTER : { iElementCounter = atoi(line.c_str()); iElementReadCounter = 0; iReaderState++; } break; case PARSING_DATA : { FLOATVECTOR3 vec; vec[0] = float(atof(line.c_str())); line = TrimToken(line); vec[1] = float(atof(line.c_str())); line = TrimToken(line); vec[2] = float(atof(line.c_str())); vec = (vec + 0.5f*FLOATVECTOR3(iDim)*fScale) / (FLOATVECTOR3(iDim)*fScale) - 0.5f; vertices.push_back(vec); iElementReadCounter++; if (iElementCounter == iElementReadCounter) { size_t iStartIndex = vertices.size() - iElementCounter; for (size_t i = 0;i<iElementCounter-1;i++) { VertIndices.push_back(uint32_t(iStartIndex)); VertIndices.push_back(uint32_t(iStartIndex+1)); COLIndices.push_back(uint32_t(iStartIndex)); COLIndices.push_back(uint32_t(iStartIndex+1)); if (i == 0) { FLOATVECTOR3 direction = (vertices[iStartIndex+1]-vertices[iStartIndex]).normalized(); colors.push_back((direction).abs()); } else if (i == iElementCounter-2) { FLOATVECTOR3 directionB = (vertices[iStartIndex]-vertices[iStartIndex-1]).normalized(); FLOATVECTOR3 directionF = (vertices[iStartIndex+1]-vertices[iStartIndex]).normalized(); colors.push_back(((directionB+directionF)/2.0f).abs()); colors.push_back((directionF).abs()); } else { FLOATVECTOR3 directionB = (vertices[iStartIndex]-vertices[iStartIndex-1]).normalized(); FLOATVECTOR3 directionF = (vertices[iStartIndex+1]-vertices[iStartIndex]).normalized(); colors.push_back(((directionB+directionF)/2.0f).abs()); } iStartIndex++; } iLineCounter++; iReaderState = PARSING_COUNTER; } } break; default : throw std::runtime_error("unknown parser state"); } } std::string desc = m_vConverterDesc + " data converted from " + SysTools::GetFilename(strFilename); std::shared_ptr<Mesh> m( new Mesh(vertices,NormVec(),TexCoordVec(),colors, VertIndices,IndexVec(),IndexVec(),COLIndices, false,false,desc,Mesh::MT_LINES) ); return m; } �������������������������������������������������������ImageVis3D-3.1.0/Tuvok/IO/XML3DGeoConverter.cpp�����������������������������������������������������0000644�0001750�0001750�00000020256�12320456500�020557� 0����������������������������������������������������������������������������������������������������ustar �mathieu�������������������������mathieu����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : XML3DGeoConverter.cpp //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #include "XML3DGeoConverter.h" #include "Controller/Controller.h" #include "SysTools.h" #include "MathTools.h" #include "Mesh.h" #include <fstream> #include "TuvokIOError.h" using namespace tuvok; XML3DGeoConverter::XML3DGeoConverter() : AbstrGeoConverter() { m_vConverterDesc = "XML3D File"; m_vSupportedExt.push_back("xml"); m_vSupportedExt.push_back("xhtml"); } bool XML3DGeoConverter::ConvertToNative(const Mesh& m, const std::string& strTargetFilename) { MESSAGE("Writing Mesh to file %s",SysTools::GetFilename(strTargetFilename).c_str()); size_t iMaxIBSize = 65536; if (m.HasUniformIndices() && m.GetVertices().size() <= iMaxIBSize) { std::ofstream outStream(strTargetFilename.c_str()); if (outStream.fail()) return false; WriteHeader(outStream); ConvertToNative(m,0,outStream); WriteFooter(outStream, 1); outStream.close(); return true; } MESSAGE("Writing Mesh to file %s (Mesh is to large for single object, partitioning)",SysTools::GetFilename(strTargetFilename).c_str()); std::vector<Mesh*> subMeshes = m.PartitionMesh(iMaxIBSize, false); MESSAGE("Writing Meshes to file %s",SysTools::GetFilename(strTargetFilename).c_str()); std::ofstream outStream(strTargetFilename.c_str()); if (outStream.fail()) return false; WriteHeader(outStream); for (size_t i = 0;i<subMeshes.size();++i) ConvertToNative(*(subMeshes[i]), i, outStream); WriteFooter(outStream, subMeshes.size()); outStream.close(); return true; } void XML3DGeoConverter::WriteHeader(std::ofstream& outStream) { outStream << "<?xml version=\"1.0\" encoding=\"utf-8\"?>" << std::endl; outStream << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">" << std::endl; outStream << "<html xmlns=\"http://www.w3.org/1999/xhtml\"> " << std::endl; outStream << " <head>" << std::endl; outStream << " <title>Mesh exported by ImageVis3D" << std::endl; outStream << " " << std::endl; outStream << " " << std::endl; outStream << " " << std::endl; outStream << " " << std::endl; outStream << " " << std::endl; outStream << " " << std::endl; outStream << " " << std::endl; outStream << " " << std::endl; outStream << " " << std::endl; outStream << " 0.4 0.4 0.4" << std::endl; outStream << " 0.4" << std::endl; outStream << " " << std::endl; outStream << " " << std::endl; outStream << " " << std::endl; outStream << " " << std::endl; outStream << " 1.0 1.0 1.0" << std::endl; outStream << " 1.0 0.01 0.0" << std::endl; outStream << " " << std::endl; } void XML3DGeoConverter::WriteFooter(std::ofstream& outStream, size_t iMeshCount) { outStream << " " << std::endl; outStream << " " << std::endl; outStream << " " << std::endl; outStream << " " << std::endl; outStream << " " << std::endl; outStream << " " << std::endl; outStream << " " << std::endl; outStream << " " << std::endl; for (size_t i = 0;i" << std::endl; outStream << " " << std::endl; outStream << " " << std::endl; } outStream << " " << std::endl; outStream << " " << std::endl; outStream << "" << std::endl; } void XML3DGeoConverter::ConvertToNative(const Mesh& m, size_t iMeshIndex, std::ofstream& outStream) const { bool bHasTexCoords = m.GetTexCoordIndices().size() == m.GetVertexIndices().size(); bool bHasNormals = m.GetNormalIndices().size() == m.GetVertexIndices().size(); bool bHasColors = m.GetColorIndices().size() == m.GetVertexIndices().size(); outStream << " " << std::endl; outStream << " "; size_t iVPP = m.GetVerticesPerPoly(); for (size_t i = 0;i 3) continue; // TODO: triangulate for (size_t j = 0;j" << std::endl; outStream << " "; for (size_t i = 0;i" << std::endl; if (bHasNormals) { outStream << " "; for (size_t i = 0;i" << std::endl; } if (bHasTexCoords) { outStream << " "; for (size_t i = 0;i" << std::endl; } if (bHasColors) { outStream << " "; for (size_t i = 0;i" << std::endl; } outStream << " " << std::endl; } ImageVis3D-3.1.0/Tuvok/IO/UVF/0000755000175000017500000000000012320456500015334 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/IO/UVF/RasterDataBlock.h0000644000175000017500000004606712320456500020527 0ustar mathieumathieu#include #pragma once #ifndef UVF_RASTERDATABLOCK_H #define UVF_RASTERDATABLOCK_H #include #include #include "DataBlock.h" #include "Basics/Vectors.h" class AbstrDebugOut; template void SimpleMaxMin(const void* pIn, size_t iStart, size_t iCount, std::vector& fMinMax) { const T *pDataIn = (T*)pIn; fMinMax.resize(iVecLength); for (size_t i = 0;i::max(); // min gradient fMinMax[i].w = std::numeric_limits::max(); // max gradient } for (size_t i = iStart+iVecLength;i (pDataIn[i*iVecLength+iComponent])); fMinMax[iComponent].y = std::max(fMinMax[iComponent].y, static_cast (pDataIn[i*iVecLength+iComponent])); /// \todo compute gradients } } } template void CombineAverage(const std::vector& vSource, uint64_t iTarget, const void* pIn, void* pOut) { const T *pDataIn = static_cast(pIn); T *pDataOut = static_cast(pOut); double temp = 0; for (size_t i = 0;i void CombineAverage(const std::vector& vSource, uint64_t iTarget, const void* pIn, void* pOut) { const T *pDataIn = static_cast(pIn); T *pDataOut = static_cast(pOut); double temp[iVecLength]; std::fill(temp, temp+iVecLength, 0.0); for (size_t i = 0;i ulDomainSemantics; std::vector dDomainTransformation; std::vector ulDomainSize; std::vector ulBrickSize; std::vector ulBrickOverlap; std::vector ulLODDecFactor; std::vector ulLODGroups; std::vector ulLODLevelCount; uint64_t ulElementDimension; std::vector ulElementDimensionSize; std::vector> ulElementSemantic; std::vector> ulElementBitSize; std::vector> ulElementMantissa; std::vector> bSignedElement; uint64_t ulOffsetToDataBlock; virtual uint64_t ComputeDataSize() const {return ComputeDataSize(NULL);} virtual uint64_t ComputeDataSize(std::string* pstrProblem) const; virtual uint64_t ComputeHeaderSize() const; virtual bool SetBlockSemantic(UVFTables::BlockSemanticTable bs); // CONVENIENCE FUNCTIONS void SetScaleOnlyTransformation(const std::vector& vScale); void SetIdentityTransformation(); void SetTypeToScalar(uint64_t iBitWith, uint64_t iMantissa, bool bSigned, UVFTables::ElementSemanticTable semantic); void SetTypeToVector(uint64_t iBitWith, uint64_t iMantissa, bool bSigned, std::vector semantic); void SetTypeToUByte(UVFTables::ElementSemanticTable semantic); void SetTypeToUShort(UVFTables::ElementSemanticTable semantic); void SetTypeToFloat(UVFTables::ElementSemanticTable semantic); void SetTypeToDouble(UVFTables::ElementSemanticTable semantic); void SetTypeToInt32(UVFTables::ElementSemanticTable semantic); void SetTypeToInt64(UVFTables::ElementSemanticTable semantic); void SetTypeToUInt32(UVFTables::ElementSemanticTable semantic); void SetTypeToUInt64(UVFTables::ElementSemanticTable semantic); bool GetData(std::vector& vData, const std::vector& vLOD, const std::vector& vBrick) const; bool GetData(std::vector& vData, const std::vector& vLOD, const std::vector& vBrick) const; bool GetData(std::vector& vData, const std::vector& vLOD, const std::vector& vBrick) const; bool GetData(std::vector& vData, const std::vector& vLOD, const std::vector& vBrick) const; bool GetData(std::vector& vData, const std::vector& vLOD, const std::vector& vBrick) const; bool GetData(std::vector& vData, const std::vector& vLOD, const std::vector& vBrick) const; bool GetData(std::vector& vData, const std::vector& vLOD, const std::vector& vBrick) const; bool GetData(std::vector& vData, const std::vector& vLOD, const std::vector& vBrick) const; bool SetData(int8_t* pData, const std::vector& vLOD, const std::vector& vBrick); bool SetData(uint8_t* pData, const std::vector& vLOD, const std::vector& vBrick); bool SetData(int16_t*, const std::vector& vLOD, const std::vector& vBrick); bool SetData(uint16_t*, const std::vector& vLOD, const std::vector& vBrick); bool SetData(int32_t*, const std::vector& vLOD, const std::vector& vBrick); bool SetData(uint32_t*, const std::vector& vLOD, const std::vector& vBrick); bool SetData( float*, const std::vector& vLOD, const std::vector& vBrick); bool SetData(double*, const std::vector& vLOD, const std::vector& vBrick); /// Change the file we're reading/writing to. Closes any open /// temporary file. Maintains file position information. /// Useful for writing a raster data block into a new file. /// NOTE: steals pointer; LargeRAWFile must live as long as the RDB. void ResetFile(LargeRAWFile_ptr); const std::vector& GetBrickCount(const std::vector& vLOD) const; const std::vector& GetBrickSize(const std::vector& vLOD, const std::vector& vBrick) const; std::vector GetLODDomainSize(const std::vector& vLOD) const; bool BrickedLODToFlatData(const std::vector& vLOD, const std::string& strTargetFile, bool bAppend = false, AbstrDebugOut* pDebugOut=NULL) const; bool ApplyFunction(const std::vector& vLOD, bool (*brickFunc)(void* pData, const UINT64VECTOR3& vBrickSize, const UINT64VECTOR3& vBrickOffset, void* pUserContext), void* pUserContext = NULL, uint64_t iOverlap=0, AbstrDebugOut* pDebugOut=NULL) const; const std::vector LargestSingleBrickLODBrickIndex() const; const std::vector& LargestSingleBrickLODBrickSize() const; const std::vector GetSmallestBrickIndex() const; const std::vector& GetSmallestBrickSize() const; const std::vector GetLargestBrickSizes() const; bool FlatDataToBrickedLOD( const void* pSourceData, const std::string& strTempFile, void (*combineFunc)(const std::vector &vSource, uint64_t iTarget, const void* pIn, void* pOut), void (*maxminFunc)(const void* pIn, size_t iStart, size_t iCount, std::vector& fMinMax), std::shared_ptr pMaxMinDatBlock = std::shared_ptr(), AbstrDebugOut* pDebugOut=NULL ); bool FlatDataToBrickedLOD( LargeRAWFile_ptr pSourceData, const std::string& strTempFile, void (*combineFunc)(const std::vector &vSource, uint64_t iTarget, const void* pIn, void* pOut), void (*maxminFunc)(const void* pIn, size_t iStart, size_t iCount, std::vector& fMinMax), std::shared_ptr pMaxMinDatBlock = std::shared_ptr(), AbstrDebugOut* pDebugOut=NULL ); void AllocateTemp(const std::string& strTempFile, bool bBuildOffsetTables=false); bool ValidLOD(const std::vector& vLOD) const; bool ValidBrickIndex(const std::vector& vLOD, const std::vector& vBrick) const; protected: LargeRAWFile_ptr m_pTempFile; LargeRAWFile_ptr m_pSourceFile; uint64_t m_iSourcePos; virtual void CopyHeaderToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock); virtual uint64_t GetHeaderFromFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian); virtual uint64_t CopyToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock); virtual DataBlock* Clone() const; virtual uint64_t GetOffsetToNextBlock() const; std::vector> CountToVectors(std::vector vCountVector) const; uint64_t ComputeElementSize() const; virtual uint64_t GetLODSize(std::vector& vLODIndices) const; virtual uint64_t ComputeLODLevelSize(const std::vector& vReducedDomainSize) const; virtual std::vector> ComputeBricks(const std::vector& vDomainSize) const; virtual std::vector> GenerateCartesianProduct( const std::vector>& vElements, uint64_t iIndex=0 ) const; uint64_t RecompLODIndexCount() const; void CleanupTemp(); friend class UVF; friend class Histogram1DDataBlock; friend class Histogram2DDataBlock; // CONVENIENCE FUNCTION HELPERS std::vector m_vLODOffsets; std::vector> m_vBrickCount; std::vector> m_vBrickOffsets; std::vector>> m_vBrickSizes; uint64_t Serialize(const std::vector& vec, const std::vector& vSizes) const; uint64_t GetLocalDataPointerOffset(const std::vector& vLOD, const std::vector& vBrick) const; uint64_t GetLocalDataPointerOffset(const uint64_t iLODIndex, const uint64_t iBrickIndex) const { return m_vLODOffsets[size_t(iLODIndex)] + m_vBrickOffsets[size_t(iLODIndex)][size_t(iBrickIndex)]; } void SubSample(LargeRAWFile_ptr pSourceFile, LargeRAWFile_ptr pTargetFile, std::vector sourceSize, std::vector targetSize, void (*combineFunc)(const std::vector &vSource, uint64_t iTarget, const void* pIn, void* pOut), AbstrDebugOut* pDebugOut=NULL, uint64_t iLODLevel=0, uint64_t iMaxLODLevel=0); uint64_t ComputeDataSizeAndOffsetTables(); uint64_t GetLODSizeAndOffsetTables(std::vector& vLODIndices, uint64_t iLOD); uint64_t ComputeLODLevelSizeAndOffsetTables( const std::vector& vReducedDomainSize, uint64_t iLOD ); bool TraverseBricksToWriteBrickToFile( uint64_t& iBrickCounter, uint64_t iBrickCount, const std::vector& vLOD, const std::vector& vBrickCount, std::vector vCoords, size_t iCurrentDim, uint64_t iTargetOffset, std::vector &vData, LargeRAWFile_ptr pTargetFile, uint64_t iElementSize, const std::vector& vPrefixProd, AbstrDebugOut* pDebugOut ) const; bool TraverseBricksToApplyFunction( uint64_t& iBrickCounter, uint64_t iBrickCount, const std::vector& vLOD, const std::vector& vBrickCount, std::vector vCoords, size_t iCurrentDim, std::vector &vData, uint64_t iElementSize, const std::vector& vPrefixProd, AbstrDebugOut* pDebugOut, bool (*brickFunc)(void* pData, const UINT64VECTOR3& vBrickSize, const UINT64VECTOR3& vBrickOffset, void* pUserContext), void* pUserContext, uint64_t iOverlap ) const; void WriteBrickToFile(size_t iCurrentDim, uint64_t& iSourceOffset, uint64_t& iTargetOffset, const std::vector& vBrickSize, const std::vector& vEffectiveBrickSize, std::vector& vData, LargeRAWFile_ptr pTargetFile, uint64_t iElementSize, const std::vector& vPrefixProd, const std::vector& vPrefixProdBrick, bool bDoSeek) const; void WriteBrickToArray(size_t iCurrentDim, uint64_t& iSourceOffset, uint64_t& iTargetOffset, const std::vector& vBrickSize, const std::vector& vEffectiveBrickSize, std::vector& vData, std::vector& vTarget, uint64_t iElementSize, const std::vector& vPrefixProd, const std::vector& vBrickPrefixProduct) const; private: LargeRAWFile_ptr SeekToBrick(const std::vector& vLOD, const std::vector& vBrick) const; bool GetData(unsigned char*, size_t bytes, const std::vector& vLOD, const std::vector& vBrick) const; size_t GetBrickByteSize(const std::vector& vLOD, const std::vector& vBrick) const; /// @return true if 'SetData' can work given current state. bool Settable() const; }; enum RDBResolution { FINEST_RESOLUTION=-2, COARSEST_RESOLUTION=-1, }; /// An input iterator which iterates over all data in a given LoD. The /// order of bricks is unspecified. Access is done in an out-of-core manner; /// only one brick will ever be loaded at any given time. /// The LoD argument gives the level of detail; higher numbers are coarser /// representations. template class LODBrickIterator : public std::iterator { public: /// Constructs an end-of-stream iterator. LODBrickIterator(): rdb(NULL), brick(0), iter(0), eos(true) {} /// Constructs an iterator which is at the start of the DS. LODBrickIterator(const RasterDataBlock* b) : rdb(b), brick(0), iter(0), eos(false) {} T& operator*() { assert(!this->eos); // can't deref end-of-stream iterator. if(this->buffer.empty()) { NextBrick(); } return this->buffer[this->iter]; } void operator++() { ++iter; if(this->buffer.empty() || this->iter >= this->buffer.size()) { NextBrick(); } } void operator++(int) { LODBrickIterator::operator++(); } /// Two end-of-stream iterators are always equal. /// An end-of-stream iterator is not equal to a non-end-of-stream iterator. /// Two non-EOS iterators are equal when they are constructed from the same /// stream. ///@{ bool operator==(const LODBrickIterator bi) const { return (this->eos && bi.eos) || (this->rdb == bi.rdb && !this->eos && !bi.eos); } bool operator!=(const LODBrickIterator bi) const { return !(*this == bi); } ///@} private: void NextBrick() { this->iter = 0; std::vector vl(1); std::vector b = this->NDBrickIndex(brick); vl[0] = this->LODIndex(); /// FIXME -- this getdata fails when we hit the 10th brick in a 9-brick /// dataset. either fix GetData or test to make sure we're not beyond /// the end of our bricks first! if(!this->rdb->GetData(buffer, vl, b)) { this->eos = true; } this->brick++; } /// RDB doesn't expose a linear counter for bricks. Instead it /// keeps separate counts for each dimension. Thus we need to be /// able to take our linear counter and convert it to RDB indices. std::vector NDBrickIndex(size_t b) { uint64_t brick = static_cast(b); std::vector lod(1); lod[0] = LODIndex(); const std::vector& counts = rdb->GetBrickCount(lod); uint64_t z = static_cast(brick / (counts[0] * counts[1])); brick = brick % (counts[0] * counts[1]); uint64_t y = static_cast(brick / counts[0]); brick = brick % counts[0]; uint64_t x = brick; std::vector vec(3); vec[0] = x; vec[1] = y; vec[2] = z; return vec; } size_t LODIndex() const { switch(LoD) { case FINEST_RESOLUTION: return 0; case COARSEST_RESOLUTION: return static_cast(rdb->ulLODLevelCount[0]); default: return static_cast(LoD); } } private: const RasterDataBlock* rdb; std::vector buffer; size_t brick; size_t iter; bool eos; // end-of-stream. }; #endif // UVF_RASTERDATABLOCK_H ImageVis3D-3.1.0/Tuvok/IO/UVF/ExtendedOctree/0000755000175000017500000000000012320456500020236 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/IO/UVF/ExtendedOctree/LzhamCompression.h0000644000175000017500000000471412320456500023712 0ustar mathieumathieu#ifndef UVF_LZHAM_COMPRESSION_H #define UVF_LZHAM_COMPRESSION_H #include #include /** Decompresses data into 'dst'. @param src the data to decompress @param compressedBytes number of bytes available and valid in 'src' @param dst the output buffer @param uncompressedBytes number of bytes available and expected in 'dst' @throws std::runtime_error if something fails */ void lzhamDecompress(std::shared_ptr src, size_t compressedBytes, std::shared_ptr& dst, size_t uncompressedBytes); /** Compresses data into 'dst' using LZHAM algorithm. @param src the data to compress @param uncompressedBytes number of bytes in 'src' @param dst the output buffer that will be created of the same size as 'src' @param compressionLevel between 0..10 ( 0 - no compression, 1 - best speed, ..., 9 - best compression, 10 - uber compression) @return the number of bytes in the compressed data @throws std::runtime_error if something fails */ size_t lzhamCompress(std::shared_ptr src, size_t uncompressedBytes, std::shared_ptr& dst, uint32_t compressionLevel = 1); #endif /* UVF_LZHAM_COMPRESSION_H */ /* The MIT License Copyright (c) 2011 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/UVF/ExtendedOctree/ZlibCompression.cpp0000644000175000017500000001176412320456500024075 0ustar mathieumathieu#include #include #include #include "zlib.h" #include "Basics/nonstd.h" #include "ZlibCompression.h" /** if you call 'inflateInit' on a stream, you must cause inflateEnd (even if * inflation fails) to cleanup internal zlib memory allocations. */ struct CleanupZlibInStream { void operator()(z_stream* strm) const { inflateEnd(strm); delete strm; } }; void zDecompress(std::shared_ptr src, std::shared_ptr& dst, size_t uncompressedBytes) { if(static_cast(uncompressedBytes) > std::numeric_limits::max()) { /* we'd have to decompress this data in chunks, this mem-based interface * can't work. Just bail for now. */ throw std::runtime_error("expected uncompressed size too large"); } std::shared_ptr strm(new z_stream, CleanupZlibInStream()); strm->zalloc = Z_NULL; strm->zfree = Z_NULL; strm->opaque = Z_NULL; strm->avail_in = 0; strm->next_in = Z_NULL; if(inflateInit(strm.get()) != Z_OK) { assert("zlib initialization failed" && false); throw std::runtime_error("zlib initialization failed"); } strm->avail_in = static_cast(uncompressedBytes); strm->next_in = src.get(); strm->avail_out = static_cast(uncompressedBytes); strm->next_out = dst.get(); int ret; uInt bytes = 0; // processed do { /* until stream ends */ strm->avail_in = static_cast(uncompressedBytes) - bytes; if(strm->avail_in == 0) { break; } strm->next_in = src.get() + bytes; const uInt save = static_cast(uncompressedBytes) - bytes; strm->avail_out = static_cast(uncompressedBytes) - bytes; strm->next_out = dst.get() + bytes; ret = inflate(strm.get(), Z_FINISH); assert(ret != Z_STREAM_ERROR); // only happens w/ invalid params assert(ret != Z_MEM_ERROR); // only happens if 'out' is not big enough assert(ret != Z_BUF_ERROR); // ditto above, for our case (Z_FINISH) assert(ret != Z_NEED_DICT); // we don't set dicts when compressing if(ret == Z_DATA_ERROR) { throw std::runtime_error("Brick compression checksum invalid."); } /* avail_out was set to 'X', and after inflate it is 'Y'. So inflate * consumed X-Y bytes of the output buffer. */ bytes += save - strm->avail_out; } while(ret != Z_STREAM_END); } /** if you call 'deflateInit' on a stream, you must call deflateEnd (even if * deflation fails) to cleanup internal zlib memory allocations. */ struct CleanupZlibStream { void operator()(z_stream* strm) const { deflateEnd(strm); delete strm; } }; size_t zCompress(std::shared_ptr src, size_t uncompressedBytes, std::shared_ptr& dst, uint32_t compressionLevel) { if(static_cast(uncompressedBytes) > std::numeric_limits::max()) { /* we'd have to compress this data in chunks, this mem-based interface * can't work. Just bail for now. */ dst = src; return uncompressedBytes; } if (compressionLevel > 9) compressionLevel = 9; std::shared_ptr strm(new z_stream, CleanupZlibStream()); strm->zalloc = Z_NULL; strm->zfree = Z_NULL; strm->opaque = Z_NULL; if(deflateInit(strm.get(), (int)compressionLevel) != Z_OK) { /* zlib initialization failed, just bail with no compression. */ dst = src; return uncompressedBytes; } strm->avail_in = static_cast(uncompressedBytes); strm->next_in = src.get(); dst.reset(new uint8_t[uncompressedBytes], nonstd::DeleteArray()); strm->avail_out = static_cast(uncompressedBytes); strm->next_out = dst.get(); int ret; do { ret = deflate(strm.get(), Z_FINISH); assert(ret != Z_STREAM_ERROR); if(ret != Z_STREAM_END) { /* compression failed. Bail out. */ dst = src; return uncompressedBytes; } } while(ret != Z_STREAM_END); return uncompressedBytes - strm->avail_out; } /* The MIT License Copyright (c) 2011 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/UVF/ExtendedOctree/Lz4Compression.cpp0000644000175000017500000000642512320456500023644 0ustar mathieumathieu#include #include #include #include "Basics/SysTools.h" #include "Basics/nonstd.h" #include "Lz4Compression.h" extern "C" { #include "lz4.h" #include "lz4hc.h" } size_t lz4Compress(std::shared_ptr src, size_t uncompressedBytes, std::shared_ptr& dst, bool /*highCompression*/) { if (uncompressedBytes > size_t(std::numeric_limits::max())) throw std::runtime_error("Input data too big for LZ4 (max ~1.9GB)"); int const inputSize = static_cast(uncompressedBytes); int const upperBound = LZ4_compressBound(inputSize); if (upperBound < 0) throw std::runtime_error("Input data too big for LZ4 (max ~1.9GB)"); dst.reset(new uint8_t[size_t(upperBound)], nonstd::DeleteArray()); // NOTE: LZ4_compressHC compresses stronger and slower but decompresses // faster. It causes some bad memory accesses that's why we disable it here // for now. (e.g. processing the HeadAneurysm dataset with brick size 256 at // brick index 8) int compressedBytes = 0; //if (!highCompression) compressedBytes = LZ4_compress((const char*)src.get(), (char*)dst.get(), inputSize); /* else compressedBytes = LZ4_compressHC((const char*)src.get(), (char*)dst.get(), inputSize); */ assert(compressedBytes >= 0); return compressedBytes; } void lz4Decompress(std::shared_ptr src, std::shared_ptr& dst, size_t uncompressedBytes) { if (uncompressedBytes > size_t(std::numeric_limits::max())) throw std::runtime_error("Expected output data too big for LZ4 (max ~1.9GB)"); int const outputSize = static_cast(uncompressedBytes); int readBytes = LZ4_uncompress((const char*)src.get(), (char*)dst.get(), outputSize); if (readBytes < 0) throw std::runtime_error(std::string("LZ4_uncompress failed: faulty input " "byte at position ") + SysTools::ToString(-readBytes)); } /* The MIT License Copyright (c) 2011 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/UVF/ExtendedOctree/LzmaCompression.cpp0000644000175000017500000001400612320456500024070 0ustar mathieumathieu#include #include #include #include "Basics/nonstd.h" #include "LzmaCompression.h" extern "C" { #include "LzmaEnc.h" #include "LzmaDec.h" } static void* AllocForLzma(void* /*p*/, size_t size) { return malloc(size); } static void FreeForLzma(void* /*p*/, void* address) { free(address); } static ISzAlloc g_AllocForLzma = { &AllocForLzma, &FreeForLzma }; class LzmaError : public std::runtime_error { public: static char const* ErrorCodeToStr(SRes errorCode); static char const* StatusToStr(ELzmaStatus status); LzmaError(std::string const& msg, int errorCode); LzmaError(std::string const& msg, ELzmaStatus status); }; char const* LzmaError::ErrorCodeToStr(SRes errorCode) { switch (errorCode) { case SZ_ERROR_DATA: return "Data"; case SZ_ERROR_MEM: return "Mem"; case SZ_ERROR_CRC: return "CRC"; case SZ_ERROR_UNSUPPORTED: return "Unsupported"; case SZ_ERROR_PARAM: return "Param"; case SZ_ERROR_INPUT_EOF: return "Input EOF"; case SZ_ERROR_OUTPUT_EOF: return "Output EOF"; case SZ_ERROR_READ: return "Read"; case SZ_ERROR_WRITE: return "Write"; case SZ_ERROR_PROGRESS: return "Progress"; case SZ_ERROR_FAIL: return "Fail"; case SZ_ERROR_THREAD: return "Thread"; case SZ_ERROR_ARCHIVE: return "Archive"; case SZ_ERROR_NO_ARCHIVE: return "No archive"; default: return "Unknown"; } } char const* LzmaError::StatusToStr(ELzmaStatus status) { switch (status) { case LZMA_STATUS_NOT_SPECIFIED: return "Not specified"; case LZMA_STATUS_FINISHED_WITH_MARK: return "Finished with mark"; case LZMA_STATUS_NOT_FINISHED: return "Not finished"; case LZMA_STATUS_NEEDS_MORE_INPUT: return "Needs more input"; case LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK: return "Maybe finished without mark"; default: return "Unknown"; } } LzmaError::LzmaError(std::string const& msg, int errorCode) : std::runtime_error(msg + std::string(ErrorCodeToStr(errorCode))) {} LzmaError::LzmaError(std::string const& msg, ELzmaStatus status) : std::runtime_error(msg + std::string(StatusToStr(status))) {} namespace { void initLzmaProperties(CLzmaEncProps& props, uint32_t compressionLevel) { if (compressionLevel > 9) compressionLevel = 9; LzmaEncProps_Init(&props); props.writeEndMark = 0; props.level = compressionLevel; } } void lzmaProperties(std::array& encodedProps, uint32_t compressionLevel) { CLzmaEncProps props; initLzmaProperties(props, compressionLevel); assert(encodedProps.size() == LZMA_PROPS_SIZE); SizeT encodedPropsSize = LZMA_PROPS_SIZE; // taken from LzmaEncode() but just do not encode CLzmaEncHandle p = LzmaEnc_Create(&g_AllocForLzma); SRes res; if (p == 0) throw LzmaError("LzmaEnc_Create failed: ", SZ_ERROR_MEM); res = LzmaEnc_SetProps(p, &props); if (res != SZ_OK) throw LzmaError("LzmaEnc_SetProps failed: ", res); res = LzmaEnc_WriteProperties(p, &encodedProps[0], &encodedPropsSize); if (res != SZ_OK) throw LzmaError("LzmaEnc_WriteProperties failed: ", res); LzmaEnc_Destroy(p, &g_AllocForLzma, &g_AllocForLzma); } size_t lzmaCompress(std::shared_ptr src, size_t uncompressedBytes, std::shared_ptr& dst, std::array& encodedProps, uint32_t compressionLevel) { CLzmaEncProps props; initLzmaProperties(props, compressionLevel); assert(encodedProps.size() == LZMA_PROPS_SIZE); SizeT encodedPropsSize = LZMA_PROPS_SIZE; dst.reset(new uint8_t[uncompressedBytes], nonstd::DeleteArray()); SizeT compressedBytes = uncompressedBytes; SRes res = LzmaEncode(dst.get(), &compressedBytes, src.get(), uncompressedBytes, &props, &encodedProps[0], &encodedPropsSize, props.writeEndMark, NULL, &g_AllocForLzma, &g_AllocForLzma); assert(encodedPropsSize == LZMA_PROPS_SIZE); if (res != SZ_OK) throw LzmaError("LzmaEncode failed: ", res); return compressedBytes; } void lzmaDecompress(std::shared_ptr src, std::shared_ptr& dst, size_t uncompressedBytes, std::array const& encodedProps) { ELzmaStatus status; SizeT bytes = uncompressedBytes; SRes res = LzmaDecode(dst.get(), &bytes, src.get(), &bytes, &encodedProps[0], LZMA_PROPS_SIZE, LZMA_FINISH_END, &status, &g_AllocForLzma); assert(bytes == uncompressedBytes); if (res != SZ_OK) throw LzmaError("LzmaDecode failed: ", res); if (status != LZMA_STATUS_FINISHED_WITH_MARK && status != LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK) throw LzmaError("LzmaDecode returned invalid status: ", status); } /* The MIT License Copyright (c) 2011 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/UVF/ExtendedOctree/VolumeTools.cpp0000644000175000017500000002426012320456500023236 0ustar mathieumathieu#include #include #include #include #include "VolumeTools.h" #include "Hilbert.h" using namespace VolumeTools; Layout::Layout(UINT64VECTOR3 const& vDomainSize) : m_vDomainSize(vDomainSize) {} bool Layout::ExceedsDomain(UINT64VECTOR3 const& vSpatialPosition) { assert(vSpatialPosition.x < m_vDomainSize.x); assert(vSpatialPosition.y < m_vDomainSize.y); assert(vSpatialPosition.z < m_vDomainSize.z); if (vSpatialPosition.x <= m_vDomainSize.x) return true; if (vSpatialPosition.y <= m_vDomainSize.y) return true; if (vSpatialPosition.z <= m_vDomainSize.z) return true; return false; } ScanlineLayout::ScanlineLayout(UINT64VECTOR3 const& vDomainSize) : Layout(vDomainSize) {} uint64_t ScanlineLayout::GetLinearIndex(UINT64VECTOR3 const& vSpatialPosition) { return vSpatialPosition.x + vSpatialPosition.y * m_vDomainSize.x + vSpatialPosition.z * m_vDomainSize.x * m_vDomainSize.y; } UINT64VECTOR3 ScanlineLayout::GetSpatialPosition(uint64_t iLinearIndex) { UINT64VECTOR3 vPosition(0, 0, 0); vPosition.x = iLinearIndex % m_vDomainSize.x; vPosition.y = (iLinearIndex / m_vDomainSize.x) % m_vDomainSize.y; vPosition.z = iLinearIndex / (m_vDomainSize.x * m_vDomainSize.y); return vPosition; } MortonLayout::MortonLayout(UINT64VECTOR3 const& vDomainSize) : Layout(vDomainSize) {} uint64_t MortonLayout::GetLinearIndex(UINT64VECTOR3 const& vSpatialPosition) { if (ExceedsDomain(vSpatialPosition)) throw std::runtime_error("spatial position out of domain bounds"); // TODO: check index overflow... // we use the z-order curve, so we have to interlace the bits // of the 3d spatial position to obtain a linear 1d index uint64_t const iIterations = (sizeof(uint64_t) * 8) / 3; uint64_t iIndex = 0; for (uint64_t i = 0; i < iIterations; ++i) { uint64_t const bit = 1u << i; iIndex |= (vSpatialPosition.x & bit) << ((i * 2) + 0); iIndex |= (vSpatialPosition.y & bit) << ((i * 2) + 1); iIndex |= (vSpatialPosition.z & bit) << ((i * 2) + 2); } return iIndex; } UINT64VECTOR3 MortonLayout::GetSpatialPosition(uint64_t iLinearIndex) { // TODO: check if index is too large // we use the z-order curve, so we have to deinterlace the bits // of the 1d linear index to obtain the 3d spatial position uint64_t const iIterations = (sizeof(uint64_t) * 8) / 3; UINT64VECTOR3 vPosition(0, 0, 0); for (uint64_t i = 0u; i < iIterations; ++i) { vPosition.x |= (iLinearIndex & 1u) << i; vPosition.y |= (iLinearIndex & 2u) << i; vPosition.z |= (iLinearIndex & 4u) << i; iLinearIndex >>= 3u; } vPosition.y >>= 1u; vPosition.z >>= 2u; return vPosition; } HilbertLayout::HilbertLayout(UINT64VECTOR3 const& vDomainSize) : Layout(vDomainSize) , m_iBits(size_t(ceil(log(double(vDomainSize.maxVal()))/log(2.0)))) {} uint64_t HilbertLayout::GetLinearIndex(UINT64VECTOR3 const& vSpatialPosition) { if (ExceedsDomain(vSpatialPosition)) throw std::runtime_error("spatial position out of domain bounds"); std::array v = {{ vSpatialPosition.x, vSpatialPosition.y, vSpatialPosition.z }}; return Hilbert::Encode(m_iBits, v); } UINT64VECTOR3 HilbertLayout::GetSpatialPosition(uint64_t iLinearIndex) { std::array v = {{0, 0, 0}}; Hilbert::Decode(m_iBits, iLinearIndex, v); return UINT64VECTOR3(v[0], v[1], v[2]); } namespace { template struct UniqueNumber { T number; UniqueNumber() : number(0) {} T operator()() { return number++; } }; } // anonymous namespace RandomLayout::RandomLayout(UINT64VECTOR3 const& vDomainSize) : ScanlineLayout(vDomainSize) , m_vLookUp((size_t)vDomainSize.volume()) { std::generate(m_vLookUp.begin(), m_vLookUp.end(), UniqueNumber()); std::random_shuffle(m_vLookUp.begin(), m_vLookUp.end()); } uint64_t RandomLayout::GetLinearIndex(UINT64VECTOR3 const& vSpatialPosition) { uint64_t const iIndex = ScanlineLayout::GetLinearIndex(vSpatialPosition); assert(iIndex < (uint64_t)m_vLookUp.size()); return m_vLookUp[(size_t)iIndex]; } UINT64VECTOR3 RandomLayout::GetSpatialPosition(uint64_t iLinearIndex) { assert(iLinearIndex < (uint64_t)m_vLookUp.size()); uint64_t const iIndex = m_vLookUp[(size_t)iLinearIndex]; return ScanlineLayout::GetSpatialPosition(iIndex); } UINTVECTOR2 VolumeTools::Fit1DIndexTo2DArray(uint64_t iMax1DIndex, uint32_t iMax2DArraySize) { // check if 1D index exceeds given 2D array if (iMax1DIndex > uint64_t(iMax2DArraySize) * uint64_t(iMax2DArraySize)) { std::stringstream ss; ss << "element count of " << iMax1DIndex << " exceeds the addressable indices " << "of a " << iMax2DArraySize << "x" << iMax2DArraySize << " array"; throw std::runtime_error(ss.str().c_str()); } // 1D index fits into a row if (iMax1DIndex <= uint64_t(iMax2DArraySize)) return UINTVECTOR2(uint32_t(iMax1DIndex), 1); // fit 1D index into the smallest possible rectangle UINTVECTOR2 v2DArraySize; v2DArraySize.x = uint32_t(std::ceil(std::sqrt(double(iMax1DIndex)))); v2DArraySize.y = uint32_t(std::ceil(double(iMax1DIndex)/double(v2DArraySize.x))); return v2DArraySize; } /* RemoveBoundary: This function takes a brick in 3D format and removes iRemove voxels in each dimension. The function changes the given brick in-place. */ void VolumeTools::RemoveBoundary(uint8_t *pBrickData, const UINT64VECTOR3& vBrickSize, size_t iVoxelSize, uint32_t iRemove) { const UINT64VECTOR3 vTargetBrickSize = vBrickSize-iRemove*2; for (uint32_t z = 0;z #include #include #include "Basics/SysTools.h" #include "Basics/nonstd.h" #include "BzlibCompression.h" extern "C" { #include "IO/3rdParty/bzip2/bzlib.h" } namespace { char const* ErrorCodeToStr(int errorCode) { switch (errorCode) { case BZ_CONFIG_ERROR: return "BZ_CONFIG_ERROR"; case BZ_PARAM_ERROR: return "BZ_PARAM_ERROR"; case BZ_MEM_ERROR: return "BZ_MEM_ERROR"; case BZ_OUTBUFF_FULL: return "BZ_OUTBUFF_FULL"; case BZ_DATA_ERROR: return "BZ_DATA_ERROR"; case BZ_DATA_ERROR_MAGIC: return "BZ_DATA_ERROR_MAGIC"; case BZ_UNEXPECTED_EOF: return "BZ_UNEXPECTED_EOF"; default: return "Unknown"; } } } size_t bzCompress(std::shared_ptr src, size_t uncompressedBytes, std::shared_ptr& dst, uint32_t compressionLevel) { // To guarantee that the compressed data will fit in its buffer, allocate an // output buffer of size 1% larger than the uncompressed data, plus six // hundred extra bytes. unsigned int upperBound = static_cast(uncompressedBytes * 1.01) + 600; if (size_t(upperBound) < uncompressedBytes) std::runtime_error("Input data too big for bzip2"); dst.reset(new uint8_t[size_t(upperBound)], nonstd::DeleteArray()); if (compressionLevel > 9) compressionLevel = 9; else if (compressionLevel < 1) compressionLevel = 1; int res = BZ2_bzBuffToBuffCompress((char*)dst.get(), &upperBound, (char*)src.get(), static_cast(uncompressedBytes), int(compressionLevel), 0, 0); if (res != BZ_OK) throw std::runtime_error(std::string("BZ2_bzBuffToBuffCompress failed. ") + std::string(ErrorCodeToStr(res))); else return upperBound; // compressed bytes } void bzDecompress(std::shared_ptr src, size_t compressedBytes, std::shared_ptr& dst, size_t uncompressedBytes) { unsigned int outputSize = static_cast(uncompressedBytes); int res = BZ2_bzBuffToBuffDecompress((char*)dst.get(), &outputSize, (char*)src.get(), static_cast(compressedBytes), 0, 0); if (res != BZ_OK) throw std::runtime_error(std::string("BZ2_bzBuffToBuffDecompress failed. ") + std::string(ErrorCodeToStr(res))); if (uncompressedBytes != size_t(outputSize)) throw std::runtime_error("Bzip2 decompression failed, output size does not " " match expected output size."); } /* The MIT License Copyright (c) 2011 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/UVF/ExtendedOctree/ExtendedOctreeConverter.h0000644000175000017500000006230012320456500025202 0ustar mathieumathieu/* The MIT License Copyright (c) 2011 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifndef EXTENDEDOCTREECONVERTER_H #define EXTENDEDOCTREECONVERTER_H #include #include #include "ExtendedOctree.h" #include "VolumeTools.h" #include "Basics/MathTools.h" /*! \brief Stores brick statistics such as the minimum and maximum values */ template class BrickStats { public: BrickStats() : minScalar( std::numeric_limits::max()), maxScalar(-std::numeric_limits::max()) {} BrickStats(T _minScalar, T _maxScalar) : minScalar(_minScalar), maxScalar(_maxScalar) {} T minScalar; T maxScalar; bool IsValid() const { return minScalar != std::numeric_limits::max() && maxScalar != -std::numeric_limits::max(); } }; class AbstrDebugOut; class ProgressTimer; /// Vector to store statistics of each brick typedef std::vector> BrickStatVec; /*! \brief A class that takes a volume as a 1D array and * turns it into a bricked, hierarchical Extended octree * */ class ExtendedOctreeConverter { public: /** Default constructor, which takes memory management parameters @param vBrickSize the maximum size of a brick (including overlap) @param iOverlap the voxel overlap (must be smaller than half the brick size in all dimensions) @param iMemLimit the amount of memory in bytes the converter is allowed to use for caching @param progress debug channel to use for progress information */ ExtendedOctreeConverter(const UINT64VECTOR3& vBrickSize, uint32_t iOverlap, uint64_t iMemLimit, AbstrDebugOut& progress); virtual ~ExtendedOctreeConverter(); /** This call starts the conversion process of a simple linear file of raw volume data into a bricked hierarchy, metadata us supplied as parameters @param filename the source data file @param iOffset the offset of the raw data in the source file @param eComponentType the type of data stored (e.g. UINT8 for 8bit unsigned char data) @param iComponentCount the vector length of a voxel (e.g. 1 for scalar data or 3 for RGB) @param vVolumeSize the dimensions of the input volume @param vVolumeAspect the aspect ratio of the input volume @param targetFile the target file for the processed data @param iOutOffset bytes to precede the data in the target file @param stats pointer to a vector to store the statistics of each brick, can be set to NULL to disable statistics computation @param compression the desired compression method, defaults to none @param bComputeMedian use median as downsampling filter (uses average otherwise) @param bClampToEdge use outer values to fill border (uses zeros otherwise) @param layout brick ordering on disk @param compressionLevel if compression is used the higher the level the more the compression (e.g. LZMA: 0..9) @return true if the conversion succeeded, the main reason for failure would be a disk I/O issue */ bool Convert(const std::string& filename, uint64_t iOffset, ExtendedOctree::COMPONENT_TYPE eComponentType, uint64_t iComponentCount, const UINT64VECTOR3& vVolumeSize, const DOUBLEVECTOR3& vVolumeAspect, const std::string& targetFile, uint64_t iOutOffset, BrickStatVec* stats, COMPRESSION_TYPE compression, uint32_t iCompressionLevel, bool bComputeMedian, bool bClampToEdge, LAYOUT_TYPE layout); /** This call starts the conversion process of a simple linear file of raw volume data into a bricked hierarchy, metadata us supplied as parameters @param pLargeRAWFile a large raw-file pointer to the source file @param iOffset the offset of the raw data in the source file @param eComponentType the type of data stored (e.g. UINT8 for 8bit unsigned char data) @param iComponentCount the vector length of a voxel (e.g. 1 for scalar data or 3 for RGB) @param vVolumeSize the dimensions of the input volume @param vVolumeAspect the aspect ratio of the input volume @param pLargeRAWOutFile a large raw-file pointer to the target file for the processed data @param iOutOffset bytes to precede the data in the target file @param stats pointer to a vector to store the statistics of each brick, can be set to NULL to disable statistics computation @param compression the desired compression method, defaults to none @param bComputeMedian use median as downsampling filter (uses average otherwise) @param bClampToEdge use outer values to fill border (uses zeros otherwise) @param layout brick ordering on disk @param compressionLevel if compression is used the higher the level the more the compression (e.g. LZMA: 0..9) @return true if the conversion succeeded, the main reason for failure would be a disk I/O issue */ bool Convert(LargeRAWFile_ptr pLargeRAWFile, uint64_t iOffset, ExtendedOctree::COMPONENT_TYPE eComponentType, uint64_t iComponentCount, const UINT64VECTOR3& vVolumeSize, const DOUBLEVECTOR3& vVolumeAspect, LargeRAWFile_ptr pLargeRAWOutFile, uint64_t iOutOffset, BrickStatVec* stats, COMPRESSION_TYPE compression, uint32_t iCompressionLevel, bool bComputeMedian, bool bClampToEdge, LAYOUT_TYPE layout); /** Call this method from a second thread during the conversion to check on the progress of the operation */ float GetProgress() const {return m_fProgress;} /** Exports a specific LoD Level into a continuous raw file @param tree the input octree @param filename the file to be written to, any existing data is overridden @param iLODLevel the level to be exported @param iOffset the bytes to be skipped from the beginning of the file @return true iff the export was successful */ static bool ExportToRAW(const ExtendedOctree &tree, const std::string& filename, uint64_t iLODLevel, uint64_t iOffset); /** Converts a brick into atlantified representation @param tree the input octree @param index the 4D brick coordinates of the brick to be converted @param atlasSize the size of the 2D texture atlas @param pData pointer to mem to hold atlantified data */ static void Atalasify(const ExtendedOctree &tree, const UINT64VECTOR4& vBrickCoords, const UINTVECTOR2& atlasSize, uint8_t* pData); /** Converts a brick into atlantified representation @param tree the input octree @param index the 1D brick index of the brick to be converted @param atlasSize the size of the 2D texture atlas @param pData pointer to mem to hold atlantified data */ static void Atalasify(const ExtendedOctree &tree, size_t index, const UINTVECTOR2& atlasSize, uint8_t* pData); /** Converts all bricks in a tree into atlantified representation this conversion happens in-place and consequently only works for trees that do no use compression on the bricks @param vBrickCoords the brick to be converted @param atlasSize the size of the 2D texture atlas @return true iff the conversion was successful */ static bool Atalasify(ExtendedOctree &tree, const UINTVECTOR2& atlasSize); /** Converts all bricks in a tree into atlantified representation and writes the converted data into the specified file @param vBrickCoords the brick to be converted @param atlasSize the size of the 2D texture atlas @param pLargeRAWFile target file to write the data into @param iOffset offset into the target file @return true iff the conversion was successful */ static bool Atalasify(ExtendedOctree &tree, const UINTVECTOR2& atlasSize, LargeRAWFile_ptr pLargeRAWFile, uint64_t iOffset); /** Converts a brick into simple 3D representation @param tree the input octree @param index the 4D brick coordinates of the brick to be converted @param pData pointer to mem to hold simple 3D data */ static void DeAtalasify(const ExtendedOctree &tree, const UINT64VECTOR4& vBrickCoords, uint8_t* pData); /** Converts a brick into simple 3D representation @param tree the input octree @param index the 1D brick index of the brick to be converted @param pData pointer to mem to hold simple 3D data */ static void DeAtalasify(const ExtendedOctree &tree, size_t index, uint8_t* pData); /** Converts all bricks in a tree into simple 3D representation this conversion happens in-place and consequently only works for trees that do no use compression on the bricks @param vBrickCoords the brick to be converted @return true iff the conversion was successful */ static bool DeAtalasify(ExtendedOctree &tree); /** Converts all bricks in a tree into simple 3D representation and writes the converted data into the specified file @param vBrickCoords the brick to be converted @param pLargeRAWFile target file to write the data into @param iOffset offset into the target file @return true iff the conversion was successful */ static bool DeAtalasify(const ExtendedOctree &tree, LargeRAWFile_ptr pLargeRAWFile, uint64_t iOffset); /** Exports a specific LoD Level into a continuous raw file @param pointer to a LargeRAW file, file needs to be open, any existing data is overridden @param iLODLevel the level to be exported @param iOffset the bytes to be skipped from the beginning of the file @return true iff the export was successful */ static bool ExportToRAW(const ExtendedOctree &tree, LargeRAWFile_ptr pLargeRAWFile, uint64_t iLODLevel, uint64_t iOffset); /** Exports a specific LoD Level brick by brick into a given function @param tree the octree to be processed @param iLODLevel the level to be exported @param brickFunc user function executed in the data @param pUserContext pointer to additional user data which is passed to the user function @param iOverlap number of overlap voxels to e included in the export @return true iff the export was successful */ static bool ApplyFunction(const ExtendedOctree &tree, uint64_t iLODLevel, bool (*brickFunc)(void* pData, const UINT64VECTOR3& vBrickSize, const UINT64VECTOR3& vBrickOffset, void* pUserContext), void* pUserContext, uint32_t iOverlap=0); public: /*! \brief A single brick cache entry * * This class is used in a vector/list etc. like data structure within * the ExtendedOctreeConverter class it mainly stores an array with the * brick data but also contains an access counter for the FIFO implementation, * a dirty bool to indicate that this brick has changed in mem but has not * yet written to disk, and index indicating to which brick the data belongs */ class CacheEntry { public: /** default constructor, flags this CacheEntry as unused */ CacheEntry() : m_pData(NULL), m_bDirty(false), m_index(std::numeric_limits::max()), m_iAccess(0), m_size(0) {} /** cleanup memory if this cache entry was ever active */ ~CacheEntry() { delete [] m_pData; } /** Specify the memory size of this cache block, does not allocate memory yet but may delete memory if previous size is different, shall never be called on a dirty cache entry @param size the size of the block */ void SetSize(size_t size) { if (m_size != size) { assert(!m_bDirty); delete [] m_pData; m_pData = NULL; } m_size = size; } /** Actually allocates the memory specified with the size */ void Allocate() { delete [] m_pData; m_pData = new uint8_t[m_size]; } /// the data pointer uint8_t* m_pData; /// true iff the cache entry has been changed but the changes have not yet been committed bool m_bDirty; /// the ID of the data stored in this cache entry size_t m_index; /// access timestamp for the replacement strategy uint64_t m_iAccess; private: /// the size of the data block size_t m_size; }; /// The brick cache is nothing but a vector of cache elements, we may /// want to change that to a more complex data structure typedef std::vector BrickCache; /// Brick cache iterator typedef BrickCache::iterator BrickCacheIter; private: /// internal data for the progress indicator call float m_fProgress; /// tracks the time since start to produce and estimate how long it will take /// to complete the conversion ProgressTimer* m_pProgressTimer; /// the maximum brick size allowed (including overlap) e.g. the /// usable size is in x is m_vBrickSize.x-2*m_iOverlap UINT64VECTOR3 m_vBrickSize; /// the brick overlap uint32_t m_iOverlap; /// max amount of memory in bytes to be used by the cache uint64_t m_iMemLimit; /// desired compression method for new bricks, may be ignored by the system /// e.g. when a compressed brick would be larger than the uncompressed COMPRESSION_TYPE m_eCompression; /// desired layout method for bricks on disk LAYOUT_TYPE m_eLayout; /// the brick cache collection BrickCache m_vBrickCache; /// last timestamp used to access the brickCache uint64_t m_iCacheAccessCounter; /// if not NULL then the statistics for each brick are stored in this vector BrickStatVec* m_pBrickStatVec; /// where to write progress information AbstrDebugOut& m_Progress; /// Computes max min statistics for each brick and rewrites /// it using compression, if desired. void ComputeStatsAndCompressAll(ExtendedOctree& tree); /// Computes max min statistics for each brick, rewrites it using compression /// and permutes brick ordering on disk, if desired. void ComputeStatsCompressAndPermuteAll(ExtendedOctree& tree); // Could be also named like ComputeStatsAndCompressBrick(). // Is internally used by ComputeStatsCompressAndPermuteAll() to fetch bricks // from disk, run the brick stats and compress it if desired. //@return just the compressed or uncompressed bytes of the brick std::shared_ptr Fetch( ExtendedOctree& tree, uint64_t iIndex, std::shared_ptr const pBuffer = nullptr); /** Copies the outer voxels into the border to implement clamp to border @param vData vector to load and store the brick data @param bCopyXs true iff x-start side is a bounday and the values need to be copied @param bCopyYs true iff y-start side is a bounday and the values need to be copied @param bCopyZs true iff z-start side is a bounday and the values need to be copied @param bCopyXe true iff x-end side is a bounday and the values need to be copied @param bCopyYe true iff y-end side is a bounday and the values need to be copied @param bCopyZe true iff z-end side is a bounday and the values need to be copied @param voxelSize the size (in bytes) of a brick voxel (i.e. component-size*component-count) @param vBrickSize the size (in voxels) of the brick */ void ClampToEdge(std::vector& vData, bool bCopyXs, bool bCopyYs, bool bCopyZs, bool bCopyXe, bool bCopyYe, bool bCopyZe, uint64_t iVoxelSize, const UINT64VECTOR3& vBrickSize); /** Copies (parts) of one brick into another @param vSourceData pointer to the source brick data @param sourceBrickSize the size of the source brick @param vTargetData pointer to the target brick data @param targetBrickSize the size of the target brick @param sourceOffset coordinates in the source brick were to start copying @param targetOffset coordinates in the target brick were to start copying @param regionSize x,y,z extension of the region to be copied @param voxelSize the size (in bytes) of a brick voxel (i.e. component-size*component-count) */ void CopyBrickToBrick(std::vector& vSourceData, const UINT64VECTOR3& sourceBrickSize, std::vector& vTargetData, const UINT64VECTOR3& targetBrickSize, const UINT64VECTOR3& sourceOffset, const UINT64VECTOR3& targetOffset, const UINT64VECTOR3& regionSize, size_t voxelSize); /** Fetches a brick from the raw linear input file @param vData vector to store the brick data @param tree target extended octree (used to extract metadata) @param pLargeRAWFileIn source raw file @param iInOffset offset into the source file @param coords brick coordinates of the brick to be extracted @param bClampToEdge use outer values to fill border (uses zeroes otherwise) */ void GetInputBrick(std::vector& vData, ExtendedOctree &tree, LargeRAWFile_ptr pLargeRAWFileIn, uint64_t iInOffset, const UINT64VECTOR4& coords, bool bClampToEdge); /** This method reorders the large input raw file into smaller bricks of maximum size m_vBrickSize with an overlap of m_iOverlap i.e. it computes LoD level zero @param tree target extended octree @param pLargeRAWFileIn source raw file @param iInOffset offset into the source file @param bClampToEdge use outer values to fill border (uses zeroes otherwise) */ void PermuteInputData(ExtendedOctree &tree, LargeRAWFile_ptr pLargeRAWFileIn, uint64_t iInOffset, bool bClampToEdge); /** This method fills the overlaps between the bricks, it assumes that the "inner" parts of the bricks have been completed already @param tree target extended octree @param iLoD the level of detail to be processed @param bClampToEdge use outer values to fill border (uses zeroes otherwise) */ void FillOverlap(ExtendedOctree &tree, uint64_t iLoD, bool bClampToEdge); /** Loads a specific brick from disk (or cache) into pData @param pData the target buffer of the brick data @param tree target extended octree @param vBrickCoords the coordinates (x,y,z, LoD) of the requested brick */ void GetBrick(uint8_t* pData, ExtendedOctree &tree, const UINT64VECTOR4& vBrickCoords); /** Loads a specific brick from disk (or cache) into pData @param pData the target buffer of the brick data @param tree target extended octree @param index the 1D-index of the brick */ void GetBrick(uint8_t* pData, ExtendedOctree &tree, uint64_t index); /** Stores a specific brick to disk (or cache) from pData @param pData the source buffer of the brick data @param tree target extended octree @param vBrickCoords the coordinates (x,y,z, LoD) of the requested brick @param bForceWrite forces the brick to be flushed to disk. if compression is enabled this performs the compression */ void SetBrick(uint8_t* pData, ExtendedOctree &tree, const UINT64VECTOR4& vBrickCoords, bool bForceWrite=false); /** Stores a specific brick to disk (or cache) from pData @param pData the source buffer of the brick data @param tree target extended octree @param index the 1D-index of the brick @param bForceWrite forces the brick to be flushed to disk, if compression is enabled this performs the compression */ void SetBrick(uint8_t* pData, ExtendedOctree &tree, uint64_t index, bool bForceWritee=false); /** Prepares the cache data structures, effectively resizes the std collection and notifies all elements of the maximum brick size @param tree target extended octree */ void SetupCache(ExtendedOctree &tree); /** Writes all dirty cache elements to disk @param tree target extended octree */ void FlushCache(ExtendedOctree &tree); /// Computes the number of bytes required to store the (uncompressed) brick. static uint64_t BrickSize(const ExtendedOctree&, uint64_t index); /// computes the brick stats for the given brick static void BrickStat( BrickStatVec* bs, uint64_t index, const uint8_t* pData, uint64_t length, size_t components, enum ExtendedOctree::COMPONENT_TYPE ); /** Write a single brick at index i in the ToC to disk and updates the minmax data structure if it is set @param tree target extended octree @param element iterator to the element in the cache to be written to disk */ static void WriteBrickToDisk(ExtendedOctree &tree, BrickCacheIter element); /** Write a single brick at index i in the ToC to disk and updates the minmax data structure if it is set @param tree target extended octree @param pData the data of the brick @param eCompression desired compression method for new bricks, may be ignored by the system @param index index of the brick to be written */ static void WriteBrickToDisk(ExtendedOctree &tree, uint8_t* pData, size_t index); /** This function takes ONE source brick and down-samples this one into the appropriate position into target brick the i.e. this function must be called up to eight times, depending on the position, to complete the down sampling process of one target brick @param tree target extended octree @param pData pointer to the target data @param targetSize size of the target brick @param pSourceData pointer to the source data @param sourceCoords brick coordinates of the source brick @param targetOffset coordinates were to place the down-sampled data in the target brick */ template void DownsampleBricktoBrick(ExtendedOctree &tree, T* pData, const UINT64VECTOR3& targetSize, T* pSourceData, const UINT64VECTOR4& sourceCoords, const UINT64VECTOR3& targetOffset); /** This function down-samples up to eight bricks into a single brick. to avoid new/delete calls this function takes two points to two arrays of sufficient size to hold the largest bricks @param tree target extended octree @param bClampToEdge use outer values to fill border (uses zeroes otherwise) @param vBrickCoords brick coordinates of the target brick of the downsampling @param pData pointer to hold the temp data during the downsampling process @param pSourceData pointer to hold the temp data during the downsampling process */ template void DownsampleBrick(ExtendedOctree &tree, bool bClampToEdge, const UINT64VECTOR4& vBrickCoords, T* pData, T* pSourceData); /** This function computes all the LoD levels on top of the highest resolution (level 0) @param tree target extended octree @param bClampToEdge use outer values to fill border (uses zeroes otherwise) */ template void ComputeHierarchy(ExtendedOctree &tree, bool bClampToEdge); /** Computes the statistics of an array @param pData pointer to the array @param iLength size (IN BYTES) of the array @param iComponentCount number of components per voxel */ template static BrickStatVec ComputeBrickStats( const uint8_t* pData, uint64_t iLength, size_t iComponentCount ); }; #endif // EXTENDEDOCTREECONVERTER_H ImageVis3D-3.1.0/Tuvok/IO/UVF/ExtendedOctree/VolumeTools.h0000644000175000017500000004056312320456500022707 0ustar mathieumathieu#pragma once #ifndef VOLUMETOOLS_H #define VOLUMETOOLS_H #include "Basics/StdDefines.h" // for the small fixed size vectors #include "Basics/Vectors.h" #include namespace VolumeTools { class Layout { public: /** Abstract layout that maps a 3D domain to a linear 1D index @param vDomainSize spatial 3D domain size where a linear 1D index @ should be defined in */ Layout(UINT64VECTOR3 const& vDomainSize); /** Convert spatial 3D brick position to linear index (position) @param vSpatialPosition spatial 3D position @return linear index @throws std::runtime_error if vSpatialPosition exceeds domain boundaries */ virtual uint64_t GetLinearIndex(UINT64VECTOR3 const& vSpatialPosition) = 0; /** Convert linear index (position) to spatial 3D brick position @param iLinearIndex linear index @return spatial 3D position */ virtual UINT64VECTOR3 GetSpatialPosition(uint64_t iLinearIndex) = 0; protected: /** Test if spatial 3D brick position is not part of the domain @param vSpatialPosition spatial 3D position @return true if given spatial position is not part of the domain */ inline bool ExceedsDomain(UINT64VECTOR3 const& vSpatialPosition); UINT64VECTOR3 m_vDomainSize; }; class ScanlineLayout : public Layout { public: ScanlineLayout(UINT64VECTOR3 const& vDomainSize); uint64_t GetLinearIndex(UINT64VECTOR3 const& vSpatialPosition); UINT64VECTOR3 GetSpatialPosition(uint64_t iLinearIndex); }; // NOTICE: The current implementation works for cubic power of two domains. // Using a non cubic domain with non power of two axes will generate // some undefined indices. The host code needs to take care of this! // // TODO: Morton numbers can be applied to non-square domains by simply not // interleaving bits from an axis when they have been exhausted. // SEE: http://blog.gmane.org/gmane.games.devel.algorithms/month=20080801/page=10 // http://comments.gmane.org/gmane.games.devel.algorithms/20013 class MortonLayout : public Layout { public: MortonLayout(UINT64VECTOR3 const& vDomainSize); uint64_t GetLinearIndex(UINT64VECTOR3 const& vSpatialPosition); UINT64VECTOR3 GetSpatialPosition(uint64_t iLinearIndex); }; // NOTICE: The current implementation works for cubic power of two domains. // Using a non cubic domain with non power of two axes will generate // some undefined indices. The host code needs to take care of this! // // TODO: C.H. Hamilton, A. Rau-Chaplin "Compact Hilbert Indices: // Space-filling curves for domains with unequal side lengths." // Information Processing Letters, 105(5), 155--163, February 2008. // SEE: http://web.cs.dal.ca/~chamilto/hilbert/ipl.pdf // http://web.cs.dal.ca/~chamilto/hilbert/index.html class HilbertLayout : public Layout { public: HilbertLayout(UINT64VECTOR3 const& vDomainSize); uint64_t GetLinearIndex(UINT64VECTOR3 const& vSpatialPosition); UINT64VECTOR3 GetSpatialPosition(uint64_t iLinearIndex); private: size_t m_iBits; }; class RandomLayout : public ScanlineLayout { public: RandomLayout(UINT64VECTOR3 const& vDomainSize); uint64_t GetLinearIndex(UINT64VECTOR3 const& vSpatialPosition); UINT64VECTOR3 GetSpatialPosition(uint64_t iLinearIndex); private: std::vector m_vLookUp; }; /** Compute the necessary 2D array size to fit a linear index minimizing wasted indices @param iMax1DIndex number of elements we want to fit into a 2d array @param iMax2DArraySize maximal dimension of a square 2d array @return optimal 2d array size to host at least the given amount of numbers @throws std::runtime_error if 1d index does not fit given array */ UINTVECTOR2 Fit1DIndexTo2DArray(uint64_t iMax1DIndex, uint32_t iMax2DArraySize); /** Converts a brick into atlantified representation @param iSizeInBytes total size of the current brick @param vMaxBrickSize maximum size of a brick @param vCurrBrickSize actual size of current brick @param atlasSize the size of the 2D texture atlas @param pDataSource pointer to mem to hold non-atlantified data @param pDataTarget pointer to mem to hold atlantified data */ void Atalasify(size_t iSizeInBytes, const UINTVECTOR3& vMaxBrickSize, const UINT64VECTOR3& vCurrBrickSize, const UINTVECTOR2& atlasSize, uint8_t* pDataSource, uint8_t* pDataTarget); /** Converts a brick into simple 3D representation @param iSizeInBytes total size of the current brick @param vCurrentAtlasSize the size of the 2D texture atlas @param vMaxBrickSize maximum size of a brick @param vCurrBrickSize actual size of current brick @param pDataSource pointer to mem to hold atlantified data @param pDataTarget pointer to mem to hold non-atlantified data */ void DeAtalasify(size_t iSizeInBytes, const UINTVECTOR2& vCurrentAtlasSize, const UINTVECTOR3& vMaxBrickSize, const UINT64VECTOR3& vCurrBrickSize, uint8_t* pDataSource, uint8_t* pDataTarget); /** This function takes a brick in 3D format and removes iRemove voxels in each dimension. The function changes the given brick in-place. @param pBrickData the voxels of the brick, changes are made to this array in place @param vBrickSize the 3D size of the brick @param iVoxelSize the size (in bytes) of a voxel in the tree @param iRemove the number of voxels to be removed */ void RemoveBoundary(uint8_t *pBrickData, const UINT64VECTOR3& vBrickSize, size_t iVoxelSize, uint32_t iRemove); /** Computes the mean value ( (a+b)/2) of a and b or the median (just picking a) the mean computations is carried out in F (usually double) precision to avoid clamping and-or quantization. This function is used when neighbors in two dimensions are missing @param a value to be filtered @param b value to be filtered @return the Filter/mean of values a and b */ template T Filter(T a, T b) { if (bComputeMedian) return a; else return T((F(a) + F(b)) / F(2)); } template void Order(T& a, T& b) { if (a > b) std::swap(a, b); } /** Computes the mean or the median value of inputs a to d for the mean computation intermediate computations are carried out in F (usually double) precision to avoid clamping and-or quantization. This function is used when neighbors in one dimension are missing @param a value to be filtered @param b value to be filtered @param c value to be filtered @param d value to be filtered @return the Filter/mean of values a to d */ template T Filter(T a, T b, T c, T d) { if (bComputeMedian) { // here we compute the median of a,b,c (ignoring d) which means // that we will either get the second or third smallest value // in the original a,b,c,d sequence Order(a,b); Order(b,c); return std::max(a,b); } else return T((F(a) + F(b) + F(c) + F(d)) / F(4)); } template void InsertIntoQuadruple(T& a, T& b, T& c, T& d, T& p) { if (p > c) { Order(d, p); } else { if (p < b) { d = c; c = b; b = p; Order(a, b); } else { d = c; c = p; } } } /** Computes the mean or median value of inputs a to h for the mean computation intermediate computations are carried out in F (usually double) precision to avoid clamping and-or quantization. This function is used for the majority of values when downsampling the bricks, only when no neighbors are present in one or multiple directions are the other Filter functions (with 4 and 2 parameters) called @param a value to be filtered @param b value to be filtered @param c value to be filtered @param d value to be filtered @param e value to be filtered @param f value to be filtered @param g value to be filtered @param h value to be filtered @return the Filter/mean of values a to h */ template T Filter(T a, T b, T c, T d, T e, T f, T g, T h) { if (bComputeMedian) { /* the std solution should be equivalent to the optimized version below T elems[8] = {a,b,c,d,e,f,g,h}; std::nth_element (elems, elems+3, elems+8); return elems[3]; */ // this version considers only 7 values, the computed median is thus the lower or the upper median for 8 // sort first 4 values Order(a, b); Order(c, d); Order(a, c); Order(b, d); Order(b, c); //find 4 minimum values out of 6 InsertIntoQuadruple(a, b, c, d, e); InsertIntoQuadruple(a, b, c, d, f); // 7th value is only relevant when it is smaller than d and larger than c return std::max(std::min(d, g), c); } else return T((F(a) + F(b) + F(c) + F(d) + F(e) + F(f) + F(g) + F(h)) / F(8)); } template void ComputeGradientVolumeFloat(T* pSourceData, T* pTargetData, const UINT64VECTOR3& vVolumeSize) { for (size_t z = 0;z vScale(0,0,0); // handle borders if (x > 0) {iLeft = iCenter-1; vScale.x++;} if (x < vVolumeSize[0]-1) {iRight = iCenter+1; vScale.x++;} if (y > 0) {iTop = iCenter-size_t(vVolumeSize[0]);vScale.y++;} if (y < vVolumeSize[1]-1) {iBottom = iCenter+size_t(vVolumeSize[0]);vScale.y++;} if (z > 0) {iFront = iCenter-size_t(vVolumeSize[0])*size_t(vVolumeSize[1]);vScale.z++;} if (z < vVolumeSize[2]-1) {iBack = iCenter+size_t(vVolumeSize[0])*size_t(vVolumeSize[1]);vScale.z++;} // compte central differences VECTOR3 vGradient((pSourceData[iLeft] -pSourceData[iRight] )/vScale.x, (pSourceData[iTop] -pSourceData[iBottom])/vScale.y, (pSourceData[iFront]-pSourceData[iBack] )/vScale.z); // safe normalize vGradient.normalize(0); // store in expanded format pTargetData[0+iCenter*4] = vGradient.x; pTargetData[1+iCenter*4] = vGradient.y; pTargetData[2+iCenter*4] = vGradient.z; pTargetData[3+iCenter*4] = pSourceData[iCenter]; } } } } template void ComputeGradientVolumeUInt(T* pSourceData, T* pTargetData, const UINT64VECTOR3& vVolumeSize) { for (size_t z = 0;z 0) {iLeft = iCenter-1; vScale.x++;} if (x < vVolumeSize[0]-1) {iRight = iCenter+1; vScale.x++;} if (y > 0) {iTop = iCenter-size_t(vVolumeSize[0]);vScale.y++;} if (y < vVolumeSize[1]-1) {iBottom = iCenter+size_t(vVolumeSize[0]);vScale.y++;} if (z > 0) {iFront = iCenter-size_t(vVolumeSize[0])*size_t(vVolumeSize[1]);vScale.z++;} if (z < vVolumeSize[2]-1) {iBack = iCenter+size_t(vVolumeSize[0])*size_t(vVolumeSize[1]);vScale.z++;} // compte central differences in double DOUBLEVECTOR3 vGradient((double(pSourceData[iLeft]) -double(pSourceData[iRight]) )/(vScale.x), (double(pSourceData[iTop]) -double(pSourceData[iBottom]))/(vScale.y), (double(pSourceData[iFront])-double(pSourceData[iBack]) )/(vScale.z)); // safe normalize vGradient.normalize(0); // store in expanded unsgined int format T halfMax = std::numeric_limits::max; pTargetData[0+iCenter*4] = T(vGradient.x*halfMax+halfMax); pTargetData[1+iCenter*4] = T(vGradient.y*halfMax+halfMax); pTargetData[2+iCenter*4] = T(vGradient.z*halfMax+halfMax); pTargetData[3+iCenter*4] = pSourceData[iCenter]; } } } } template void ComputeGradientVolumeInt(T* pSourceData, T* pTargetData, const UINT64VECTOR3& vVolumeSize) { for (size_t z = 0;z 0) {iLeft = iCenter-1; vScale.x++;} if (x < vVolumeSize[0]-1) {iRight = iCenter+1; vScale.x++;} if (y > 0) {iTop = iCenter-size_t(vVolumeSize[0]);vScale.y++;} if (y < vVolumeSize[1]-1) {iBottom = iCenter+size_t(vVolumeSize[0]);vScale.y++;} if (z > 0) {iFront = iCenter-size_t(vVolumeSize[0])*size_t(vVolumeSize[1]);vScale.z++;} if (z < vVolumeSize[2]-1) {iBack = iCenter+size_t(vVolumeSize[0])*size_t(vVolumeSize[1]);vScale.z++;} // compute central differences in double DOUBLEVECTOR3 vGradient((double(pSourceData[iLeft]) -double(pSourceData[iRight]) )/(vScale.x), (double(pSourceData[iTop]) -double(pSourceData[iBottom]))/(vScale.y), (double(pSourceData[iFront])-double(pSourceData[iBack]) )/(vScale.z)); // safe normalize vGradient.normalize(0); // store in expanded signed int format T fullMax = std::numeric_limits::max; pTargetData[0+iCenter*4] = T(vGradient.x*fullMax); pTargetData[1+iCenter*4] = T(vGradient.y*fullMax); pTargetData[2+iCenter*4] = T(vGradient.z*fullMax); pTargetData[3+iCenter*4] = pSourceData[iCenter]; } } } } }; #endif // VOLUMETOOLS_H /* The MIT License Copyright (c) 2011 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/UVF/ExtendedOctree/Hilbert.h0000644000175000017500000000712412320456500022004 0ustar mathieumathieu#pragma once #ifndef HILBERT_H #define HILBERT_H #include #include #include #include namespace Hilbert { /** Hilbert code implementation is inspired by: http://web.archive.org/web/20040811200015/http://www.caam.rice.edu/~dougm/twiddle/Hilbert/ Original Hilbert Curve implementation copyright 1998, Rice University. This implementation is only modified by the use of templates to quickly track down bit precision problems and to speed up computations a little. @param nDims number of coordinate axes @param nBits number of bits per axis @param Bitmask type as an unsigned integer of sufficient size @param Halfmask type as an unsigned integer of at least 1/2 the size of Bitmask */ template class Curve { public: typedef Bitmask Index; typedef typename std::array Point; /** Convert an index into a Hilbert curve to a set of coordinates @param index contains nDims*nBits bits @param point list of nDims coordinates, each with nBits bits */ static void Decode(Index index, Point& point); /** Convert coordinates of a point on a Hilbert curve to its index @param point array of n nBits-bit coordinates @return output index value of nDims*nBits bits */ static Index Encode(Point const& point); private: template static Bitmask BitTranspose(Bitmask inCoords); }; // Convenient 2D decode wrapper that takes the number of bits as an argument template void Decode(size_t nBits, T index, typename std::array& point) { static_assert(sizeof(T) != sizeof(T), "template specialization required"); } // Convenient 2D encode wrapper that takes the number of bits as an argument template T Encode(size_t nBits, typename std::array const& point) { static_assert(sizeof(T) != sizeof(T), "template specialization required"); } // Convenient 3D decode wrapper that takes the number of bits as an argument template void Decode(size_t nBits, T index, typename std::array& point) { static_assert(sizeof(T) != sizeof(T), "template specialization required"); } // Convenient 3D encode wrapper that takes the number of bits as an argument template T Encode(size_t nBits, typename std::array const& point) { static_assert(sizeof(T) != sizeof(T), "template specialization required"); } #include "Hilbert.inc" } // namespace Hilbert #endif // HILBERT_H /* The MIT License Copyright (c) 2011 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/UVF/ExtendedOctree/ZlibCompression.h0000644000175000017500000000427212320456500023536 0ustar mathieumathieu#ifndef UVF_ZLIB_COMPRESSION_H #define UVF_ZLIB_COMPRESSION_H #include #include /** Decompresses data into 'dst'. @param src the data to decompress @param dst the output buffer @param uncompressedBytes number of bytes available and expected in 'dst' */ void zDecompress(std::shared_ptr src, std::shared_ptr& dst, size_t uncompressedBytes); /** Compresses data into 'dst' using deflate algorithm (zip). @param src the data to compress @param uncompressedBytes number of bytes in 'src' @param dst the output buffer that will be created of the same size as 'src' @param compressionLevel between 0..9 ( 0 - no compression, 1 - best speed, ..., 9 - best compression) @return the number of bytes in the compressed data */ size_t zCompress(std::shared_ptr src, size_t uncompressedBytes, std::shared_ptr& dst, uint32_t compressionLevel = 1); #endif /* UVF_ZLIB_COMPRESSION_H */ /* The MIT License Copyright (c) 2011 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/UVF/ExtendedOctree/ExtendedOctree.h0000644000175000017500000003651012320456500023316 0ustar mathieumathieu/* The MIT License Copyright (c) 2011 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifndef EXTENDEDOCTREE_H #define EXTENDEDOCTREE_H #include "Basics/StdDefines.h" #include #include #include "Basics/LargeRAWFile.h" // for the small fixed size vectors #include "Basics/Vectors.h" /*! \brief This structure holds information about a specific level in the tree * * This structure holds information about a specific level of the tree, * such as the overall size of the level in pixels and in bricks, * and the aspect ratio (which may vary from level to level if we * downsample anisotropically) */ struct LODInfo { /// the aspect ratio of all bricks in this LoD, does not /// take the overall aspect into account just the aspect /// ratio changes that happen during the downsampling DOUBLEVECTOR3 m_vAspect; /// size of the entire LoD in pixels, i.e. for LoD 0 this /// is equal to the size of the original dataset UINT64VECTOR3 m_iLODPixelSize; /// number of bricks in x, y, and z in this LoD UINT64VECTOR3 m_iLODBrickCount; /// sum of all m_iLODBrickCount.volume() of the all the /// lower LoD, e.g. for LoD with index 2 this would be /// lod[0].m_iLODBrickCount.volume() + lod[1].m_iLODBrickCount.volume() /// it does NOT take the current LoD into account and is /// just the offset uint64_t m_iLoDOffset; }; /// This enum lists the different compression techniques enum COMPRESSION_TYPE { CT_NONE = 0, // brick is not compressed CT_ZLIB, // brick is compressed using ZLIB CT_LZMA, // brick is compressed using LZMA CT_LZ4, // brick is compressed using LZ4 CT_BZLIB, // brick is compressed using BZIP2 CT_LZHAM, // brick is compressed using LZHAM CT_UNKNOWN }; /// This enum lists the different layouts how bricks are ordered on disk enum LAYOUT_TYPE { LT_SCANLINE = 0, // bricks are ordered in x, y, z scanline order where x is the fastest LT_MORTON, // bricks are laid out according to Morton order (Z-order) LT_HILBERT, // bricks are laid out according to Hilbert space-filling curve LT_RANDOM, // bricks are laid out randomly, just to check the worst case LT_UNKNOWN }; /*! \brief This structure holds information about a specific brick in the tree * * This structure holds information about a specific brick in the tree, * such the offset from the header, the length (or size) in bytes of the brick * and the compression method */ struct TOCEntry { /// the offset from the (beginning) of the header to this brick /// i.e. the offset for the very first brick in the file is the /// size of the header uint64_t m_iOffset; /// the length or size of this brick in bytes uint64_t m_iLength; /// the compression scheme of this brick COMPRESSION_TYPE m_eCompression; /// valid bytes in this brick (used for streaming files) /// for a complete brick m_iLength is equal to m_iValidLength uint64_t m_iValidLength; /// if this block is stored in "atlantified" format /// i.e. packed for 2D texture atlas representation /// then this variable holds the size of a 2D texture /// to store the atlas, otherwise at least one component /// is equal to zero UINTVECTOR2 m_iAtlasSize; // Returns the size of this struct it is basically the // the sum of sizeof calls to all members as that may // be different from sizeof(TOCEntry) due to compilers // padding this struct static size_t SizeInFile(uint64_t iVersion) { return (iVersion > 0 ? sizeof(uint64_t /*m_iOffset*/) : 0) + sizeof(uint64_t/*m_iLength*/) + sizeof(uint32_t /*m_eCompression*/) + sizeof(uint64_t /*m_iValidLength*/) + sizeof(UINTVECTOR2 /*m_iAtlasSize*/); } }; // forward to the raw to brick converter, required for the // friend declaration down below class ExtendedOctreeConverter; /*! \brief This class holds the actual octree data * * This class holds the actual octree data */ class ExtendedOctree { public: /// This enum lists the different data types enum COMPONENT_TYPE { CT_UINT8, CT_UINT16, CT_UINT32, CT_UINT64, CT_INT8, CT_INT16, CT_INT32, CT_INT64, CT_FLOAT32, CT_FLOAT64 }; /** does nothing more than set the internal state to fail safe values */ ExtendedOctree(); /** Reads the header information from an already open large raw file skipping iOffset bytes at the beginning @param pLargeRAWFile the file the header is read from, file must be open already @param iOffset the bytes to be skipped from the beginning of the file to get to the octree header @param iUVFFileVersion UVF file version @return returns false if something went wrong trying to read from the file */ bool Open(LargeRAWFile_ptr pLargeRAWFile, uint64_t iOffset, uint64_t iUVFFileVersion); /** Reads the header information from an file skipping iOffset bytes at the beginning @param filename the name of the input file @param iOffset the bytes to be skipped from the beginning of the file to get to the octree header @param iUVFFileVersion UVF file version @return returns false if something went wrong trying to read from the file */ bool Open(std::string filename, uint64_t iOffset, uint64_t iUVFFileVersion); /** Closes the underlying large raw file, after this call the Extended octree should not be used unless another open call is performed */ void Close(); /** Returns the component type enumerator of this octree @return returns the component type enumerator of this octree */ COMPONENT_TYPE GetComponentType() const {return m_eComponentType;} /** Returns the value domain dimension @return the value domain dimension */ uint64_t GetComponentCount() const {return m_iComponentCount;} /** Returns the true iff the dataset contains pre-computed normals @return true iff the dataset contains pre-computed normals */ bool GetContainsPrecomputedNormals() const {return m_bPrecomputedNormals;} /** Returns the level of detail count, i.e. the depth of the tree @return the level of detail count, i.e. the depth of the tree */ uint64_t GetLODCount() const {return m_vLODTable.size();} /** Returns the single sided overhead @return the single sided overhead */ uint32_t GetOverlap() const {return m_iOverlap;} /** Returns the brick size limit @return the brick size limit */ UINTVECTOR3 GetMaxBrickSize() const { return UINTVECTOR3(m_iBrickSize); } /** Returns the number of bricks in a given LoD level. The result of this call is a vector that contains the brick count for each dimension to get the (scalar) number of bricks in this level call .volume() on this @param iLoD index of the level to query (0 is highest resolution) @return the number of bricks in a given LoD level */ UINT64VECTOR3 GetBrickCount(uint64_t iLOD) const; /** Returns the size in voxels of a given LoD level. The result of this call is a vector that contains the size for each dimension @param iLoD index of the level to query (0 is highest resolution) @return the number of voxels in a given LoD level */ UINT64VECTOR3 GetLoDSize(uint64_t iLOD) const; /** Returns the size of a specific brick @param vBrickCoords coordinates of a brick: x,y,z are the spacial coordinates, w is the LoD level @return the size of a specific brick */ UINT64VECTOR3 ComputeBrickSize(const UINT64VECTOR4& vBrickCoords) const; /** Returns the ToC Entry of a brick @param vBrickCoords coordinates of a brick: x,y,z are the spacial coordinates, w is the LoD level @return the ToC Entry of a brick */ const TOCEntry& GetBrickToCData(const UINT64VECTOR4& vBrickCoords) const; /** Returns the ToC Entry of a brick @param index 1D index of the brick @return the ToC Entry of a brick */ const TOCEntry& GetBrickToCData(size_t index) const; /** Returns the aspect ration of a specific brick, this does not include the global aspect ratio @param vBrickCoords coordinates of a brick: x,y,z are the spacial coordinates, w is the LoD level @return the aspect ration of a specific brick */ DOUBLEVECTOR3 GetBrickAspect(const UINT64VECTOR4& vBrickCoords) const; /** use to get the raw (uncompressed) data of a specific brick @param pData the raw (uncompressed) data of a specific brick, the user has to make sure pData is big enough to hold the data @param vBrickCoords coordinates of a brick: x,y,z are the spacial coordinates, w is the LoD level */ void GetBrickData(uint8_t* pData, const UINT64VECTOR4& vBrickCoords) const; /** Returns the global aspect ratio of the volume @return the global aspect ratio of the volume */ DOUBLEVECTOR3 GetGlobalAspect() const {return m_vVolumeAspect;} /** Use to set the global aspect ratio of the volume, will write this into the header @param vVolumeAspect the new aspect ratio of the volume */ bool SetGlobalAspect(const DOUBLEVECTOR3& vVolumeAspect); /** Returns the size (in bytes) of the component type e.g. 4 for CT_INT64 @return the size (in bytes) of the component type */ size_t GetComponentTypeSize() const; /** Returns the size of entire octree in bytes (including the header) @return the size of entire octree in bytes (including the header) */ uint64_t GetSize() const { if (m_vTOC.empty()) return ComputeHeaderSize(); // header only including ToC else return m_iSize; // header + brick data } /** Converts a 4-D brick coordinates into a 1D index, as used by the TOC @param vBrickCoords coordinates of a brick: x,y,z are the spacial coordinates, w is the LoD level @return the 1D index to be used for the ToC */ uint64_t BrickCoordsToIndex(const UINT64VECTOR4& vBrickCoords) const; /** Converts a 1D index into 4-D brick coordinates @param the 1D index as used for the ToC @return vBrickCoords coordinates of a brick: x,y,z are the spacial coordinates, w is the LoD level */ UINT64VECTOR4 IndexToBrickCoords(uint64_t index) const; private: /// type of the volume components (e.g. byte, int, float) stored as a COMPONENT_TYPE enum COMPONENT_TYPE m_eComponentType; /// stores how may components we have per voxel e.g. 4 for color data uint64_t m_iComponentCount; /// true iff the dataset contains pre-computed normals in the YZW components in addition /// to the actual data in the X channel, consequently this value is only true if /// the datasets component count is 4 bool m_bPrecomputedNormals; /// the size (in voxels) of the volume represented by the hierarchy (= the size of LoD level 0) UINT64VECTOR3 m_vVolumeSize; /// aspect ratio of the volume DOUBLEVECTOR3 m_vVolumeAspect; /// maximum brick size i.e. the brick size of a non-boundary brick UINT64VECTOR3 m_iBrickSize; /// brick overlap uint32_t m_iOverlap; /// extended octree file version uint32_t m_iVersion; /// total octree size including header, necessary to allow "random" brick locations uint64_t m_iSize; /// generic compression level uint32_t m_iCompressionLevel; /// offset of the header in the data file uint64_t m_iOffset; /// pointer to the data file LargeRAWFile_ptr m_pLargeRAWFile; /// the table of contents of the file, it holds the metadata for all bricks std::vector m_vTOC; /// table of LoD metadata std::vector m_vLODTable; /** Computes whether a brick is the last brick in a row, column, or slice. @param vBrickCoords coordinates of a brick: x,y,z are the spacial coordinates, w is the LoD level @return whether a brick is the last brick in a row, column, or slice */ VECTOR3 IsLastBrick(const UINT64VECTOR4& vBrickCoords) const; /** Computes the LoD Table from the basic volume information (e.g. size, brick-size, overlap) */ void ComputeMetadata(); /** Computes the size of the header, as the header contains the brick ToC it varies from dataset to dataset @return the size of the header */ uint64_t ComputeHeaderSize() const; /** Computes the number of bricks of all levels together WITHOUT using the brick ToC. This function does not use the brick ToC as it used to construct that very ToC. Once, the ToC exists it#s result is equal to m_vTOC.size() @return the number of bricks of all levels together */ uint64_t ComputeBrickCount() const; /** Writes the Octree header into a file and stores the two parameters pLargeRAWFile and iOffset @param pLargeRAWFile the file the header is written into, the file must be open already @param iOffset the bytes to be skipped from the beginning of the file to get to the octree header */ void WriteHeader(LargeRAWFile_ptr pLargeRAWFile, uint64_t iOffset); /** Static method that returns the size of a type specified as a COMPONENT_TYPE enum @param t the into type for which the size is to be computed @return the size of a type specified as a COMPONENT_TYPE enum */ static uint32_t GetComponentTypeSize(COMPONENT_TYPE t); /** use to get the raw (uncompressed) data of a specific brick @param pData the raw (uncompressed) data of a specific brick, the user has to make sure pData is big enough to hold the data @param index the index of the brick in the LoD table */ void GetBrickData(uint8_t* pData, uint64_t index) const; /** returns true iff the large raw file holding this tree's data is is currently in RW mode */ bool IsInRWMode() const {return m_pLargeRAWFile->IsWritable();} /** close the file and reopen in RW mode does nothing if the file is already open in rw-mode @return if the file could be re-openend in rw-mode */ bool ReOpenRW(); /** close the file if it is in rw mode and reopen in read-only mode does nothing if the file is already open in read-only mode @return if the file could be re-openend in read-only mode */ bool ReOpenR(); /// give the converter access to the internal data friend class ExtendedOctreeConverter; /** initialize LZMA compression/decompression properties based on 'm_iCompressionLevel' */ void InitLzmaCompression(); /** if LZMA compression is used these are the encoded compression (level) properties generated by 'InitLzmaCompression()' used by compression and decompression routines */ std::array m_lzmaProps; }; #endif // EXTENDEDOCTREE_H ImageVis3D-3.1.0/Tuvok/IO/UVF/ExtendedOctree/LzhamCompression.cpp0000644000175000017500000000665112320456500024247 0ustar mathieumathieu#include #include #include #include "Basics/SysTools.h" #include "Basics/nonstd.h" #include "Lz4Compression.h" #include "lzham_static_lib.h" namespace { char const* ErrorCodeToStr(int errorCode) { switch (errorCode) { case LZHAM_Z_STREAM_END: return "LZHAM_Z_STREAM_END"; case LZHAM_Z_STREAM_ERROR: return "LZHAM_Z_STREAM_ERROR"; case LZHAM_Z_PARAM_ERROR: return "LZHAM_Z_PARAM_ERROR"; case LZHAM_Z_BUF_ERROR: return "LZHAM_Z_BUF_ERROR"; default: return "Unknown"; } } } size_t lzhamCompress(std::shared_ptr src, size_t uncompressedBytes, std::shared_ptr& dst, uint32_t compressionLevel) { if (compressionLevel > 10) compressionLevel = 10; lzham_z_ulong const inputBytes = static_cast(uncompressedBytes); lzham_z_ulong upperBound = lzham_z_compressBound(inputBytes); if (static_cast(upperBound) < uncompressedBytes) throw std::runtime_error("Input data too big for LZHAM"); dst.reset(new uint8_t[size_t(upperBound)], nonstd::DeleteArray()); int res = lzham_z_compress2((unsigned char*)dst.get(), &upperBound, (const unsigned char *)src.get(), inputBytes, (int)compressionLevel); if (res != LZHAM_Z_OK) throw std::runtime_error(std::string("lzham_z_compress2 failed. ") + std::string(ErrorCodeToStr(res))); else return upperBound; } void lzhamDecompress(std::shared_ptr src, size_t compressedBytes, std::shared_ptr& dst, size_t uncompressedBytes) { lzham_z_ulong outputSize = static_cast(uncompressedBytes); int res = lzham_z_uncompress((unsigned char*)dst.get(), &outputSize, (const unsigned char*)src.get(), static_cast(compressedBytes)); if (res != LZHAM_Z_OK) throw std::runtime_error(std::string("lzham_z_uncompress failed. ") + std::string(ErrorCodeToStr(res))); else if (uncompressedBytes != size_t(outputSize)) throw std::runtime_error("LZHAM decompression failed, output size does not " " match expected output size."); } /* The MIT License Copyright (c) 2011 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/UVF/ExtendedOctree/Lz4Compression.h0000644000175000017500000000436612320456500023313 0ustar mathieumathieu#ifndef UVF_LZ4_COMPRESSION_H #define UVF_LZ4_COMPRESSION_H #include #include /** Decompresses data into 'dst'. @param src the data to decompress @param dst the output buffer @param uncompressedBytes number of bytes available and expected in 'dst' @throws std::runtime_error if something fails */ void lz4Decompress(std::shared_ptr src, std::shared_ptr& dst, size_t uncompressedBytes); /** Compresses data into 'dst' using LZ4 algorithm. @param src the data to compress @param uncompressedBytes number of bytes in 'src' @param dst the output buffer that will be created of the same size as 'src' @param highCompression high compression mode is disabled for now because it sometimes causes bad memory accesses (see cpp file) @return the number of bytes in the compressed data @throws std::runtime_error if something fails */ size_t lz4Compress(std::shared_ptr src, size_t uncompressedBytes, std::shared_ptr& dst, bool highCompression = false); #endif /* UVF_LZ4_COMPRESSION_H */ /* The MIT License Copyright (c) 2011 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/UVF/ExtendedOctree/LzmaCompression.h0000644000175000017500000000552012320456500023536 0ustar mathieumathieu#ifndef UVF_LZMA_COMPRESSION_H #define UVF_LZMA_COMPRESSION_H #include #include #include /** Generate encoded LZMA properties in 'encodedProps' based on compression level. @param encodedProps dst array where the encoded properties are written @param compressionLevel between 0..9 will be encoded in 'encodedProps' @throws std::runtime_error if something fails */ void lzmaProperties(std::array& encodedProps, uint32_t compressionLevel = 4); /** Decompresses data into 'dst'. @param src the data to decompress @param dst the output buffer @param uncompressedBytes number of bytes available and expected in 'dst' @param encodedProps encoded LZMA properties header @throws std::runtime_error if something fails */ void lzmaDecompress(std::shared_ptr src, std::shared_ptr& dst, size_t uncompressedBytes, std::array const& encodedProps); /** Compresses data into 'dst' using LZMA algorithm (7z). @param src the data to compress @param uncompressedBytes number of bytes in 'src' @param dst the output buffer that will be created of the same size as 'src' @param encodedProps LZMA properties header generated during compression @param compressionLevel between 0..9 that will be encoded in 'encodedProps' @return the number of bytes in the compressed data @throws std::runtime_error if something fails */ size_t lzmaCompress(std::shared_ptr src, size_t uncompressedBytes, std::shared_ptr& dst, std::array& encodedProps, uint32_t compressionLevel = 4); #endif /* UVF_LZMA_COMPRESSION_H */ /* The MIT License Copyright (c) 2011 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/UVF/ExtendedOctree/ExtendedOctreeConverter.cpp0000644000175000017500000021656012320456500025546 0ustar mathieumathieu/* The MIT License Copyright (c) 2011 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ // for find_if #include #include #include #include #include #include "Basics/MathTools.h" #include "Basics/ProgressTimer.h" #include "Basics/Timer.h" #include "Basics/PerfCounter.h" #include "Basics/nonstd.h" #include "Controller/Controller.h" #include "DebugOut/AbstrDebugOut.h" #include "ExtendedOctreeConverter.h" #include "ZlibCompression.h" #include "LzmaCompression.h" #include "Lz4Compression.h" #include "BzlibCompression.h" #include "LzhamCompression.h" // simple/generic progress update message #define PROGRESS \ do { \ m_Progress.Message(_func_, "Generating Hierarchy ... %5.2f%% (%s)", \ m_fProgress * 100.0f,\ m_pProgressTimer->GetProgressMessage(m_fProgress).c_str() \ );\ } while(0) #include "ExtendedOctreeConverter.inc" ExtendedOctreeConverter::ExtendedOctreeConverter( const UINT64VECTOR3& vBrickSize, uint32_t iOverlap, uint64_t iMemLimit, AbstrDebugOut& progress) : m_fProgress(0.0f), m_pProgressTimer(new ProgressTimer()), m_vBrickSize(vBrickSize), m_iOverlap(iOverlap), m_iMemLimit(iMemLimit), m_iCacheAccessCounter(0), m_pBrickStatVec(NULL), m_Progress(progress) { m_pProgressTimer->Start(); } ExtendedOctreeConverter::~ExtendedOctreeConverter() { delete m_pProgressTimer; } /* Convert (string): Convenience function that calls the "Convert" below with a large raw file constructed from the given string */ bool ExtendedOctreeConverter::Convert(const std::string& filename, uint64_t iOffset, ExtendedOctree::COMPONENT_TYPE eComponentType, uint64_t iComponentCount, const UINT64VECTOR3& vVolumeSize, const DOUBLEVECTOR3& vVolumeAspect, const std::string& targetFilename, uint64_t iOutOffset, BrickStatVec* stats, COMPRESSION_TYPE compression, uint32_t iCompressionLevel, bool bComputeMedian, bool bClampToEdge, LAYOUT_TYPE layout) { LargeRAWFile_ptr inFile(new LargeRAWFile(filename)); LargeRAWFile_ptr outFile(new LargeRAWFile(targetFilename)); assert(vVolumeSize.volume() > 0); assert(vVolumeAspect.volume() > 0); if (!inFile->Open()) { return false; } if (!outFile->Create()) { inFile->Close(); return false; } return Convert(inFile, iOffset, eComponentType, iComponentCount, vVolumeSize, vVolumeAspect, outFile, iOutOffset, stats, compression, iCompressionLevel, bComputeMedian, bClampToEdge, layout); } /* Convert: This is the main function where the conversion from a raw file to a bricked octree happens. It starts by creating a new ExtendedOctree object, passes the user's parameters on to that object and computes the header data. It creates LoD zero by permuting/bricking the input data, then it computes the hierarchy. As this hierarchy computation involves averaging we choose an appropriate template at this point. Next, the function writes the header to disk and flushes the write cache. Finally, the file is truncated to the appropriate length as it may have grown bigger than necessary as compression is applied only after an entire level is completed. */ bool ExtendedOctreeConverter::Convert(LargeRAWFile_ptr pLargeRAWFileIn, uint64_t iInOffset, ExtendedOctree::COMPONENT_TYPE eComponentType, const uint64_t iComponentCount, const UINT64VECTOR3& vVolumeSize, const DOUBLEVECTOR3& vVolumeAspect, LargeRAWFile_ptr pLargeRAWFileOut, uint64_t iOutOffset, BrickStatVec* stats, COMPRESSION_TYPE compression, uint32_t iCompressionLevel, bool bComputeMedian, bool bClampToEdge, LAYOUT_TYPE layout) { m_pBrickStatVec = stats; m_fProgress = 0.0f; PROGRESS; assert(iComponentCount > 0); assert(vVolumeSize.volume() > 0); assert(vVolumeAspect.volume() > 0); ExtendedOctree e; // compute metadata e.m_eComponentType = eComponentType; e.m_iComponentCount = iComponentCount; e.m_vVolumeSize = vVolumeSize; e.m_vVolumeAspect = vVolumeAspect; e.m_iBrickSize = m_vBrickSize; e.m_iOverlap = m_iOverlap; e.m_iOffset = iOutOffset; e.m_pLargeRAWFile = pLargeRAWFileOut; e.m_iCompressionLevel = iCompressionLevel; e.ComputeMetadata(); m_eCompression = compression; m_eLayout = layout; SetupCache(e); // brick (permute) the input data PermuteInputData(e, pLargeRAWFileIn, iInOffset, bClampToEdge); // compute hierarchy // now comes the really nasty part where we convert the input arguments // to template parameters, effectively writing out all branches if (bComputeMedian) { switch (e.m_eComponentType) { case ExtendedOctree::CT_UINT8: ComputeHierarchy(e, bClampToEdge); break; case ExtendedOctree::CT_UINT16: ComputeHierarchy(e, bClampToEdge); break; case ExtendedOctree::CT_UINT32: ComputeHierarchy(e, bClampToEdge); break; case ExtendedOctree::CT_UINT64: ComputeHierarchy(e, bClampToEdge); break; case ExtendedOctree::CT_INT8: ComputeHierarchy(e, bClampToEdge); break; case ExtendedOctree::CT_INT16: ComputeHierarchy(e, bClampToEdge); break; case ExtendedOctree::CT_INT32: ComputeHierarchy(e, bClampToEdge); break; case ExtendedOctree::CT_INT64: ComputeHierarchy(e, bClampToEdge); break; case ExtendedOctree::CT_FLOAT32: ComputeHierarchy(e, bClampToEdge); break; case ExtendedOctree::CT_FLOAT64: ComputeHierarchy(e, bClampToEdge); break; } } else { switch (e.m_eComponentType) { case ExtendedOctree::CT_UINT8: ComputeHierarchy(e, bClampToEdge); break; case ExtendedOctree::CT_UINT16: ComputeHierarchy(e, bClampToEdge); break; case ExtendedOctree::CT_UINT32: ComputeHierarchy(e, bClampToEdge); break; case ExtendedOctree::CT_UINT64: ComputeHierarchy(e, bClampToEdge); break; case ExtendedOctree::CT_INT8: ComputeHierarchy(e, bClampToEdge); break; case ExtendedOctree::CT_INT16: ComputeHierarchy(e, bClampToEdge); break; case ExtendedOctree::CT_INT32: ComputeHierarchy(e, bClampToEdge); break; case ExtendedOctree::CT_INT64: ComputeHierarchy(e, bClampToEdge); break; case ExtendedOctree::CT_FLOAT32: ComputeHierarchy(e, bClampToEdge); break; case ExtendedOctree::CT_FLOAT64: ComputeHierarchy(e, bClampToEdge); break; } } // write bricks in the cache to disk FlushCache(e); { // we store the total octree size including header length // we know that the last brick in ToC must be at the end of the octree data // this assumption won't be valid anymore after permuting the brick ordering // that's why we store the total length explicitly TOCEntry const& lastBrickInFile = e.m_vTOC.back(); e.m_iSize = lastBrickInFile.m_iOffset + lastBrickInFile.m_iLength; } if (m_eCompression >= CT_UNKNOWN) { m_Progress.Warning(_func_, "Unknown compression method requested (%d), " "resetting to default zlib compression", m_eCompression); m_eCompression = CT_ZLIB; } if (m_eLayout >= LT_UNKNOWN) { m_Progress.Warning(_func_, "Unknown brick layout requested (%d), resetting " "to default scanline order", m_eLayout); m_eLayout = LT_SCANLINE; } if (m_eLayout != LT_SCANLINE) ComputeStatsCompressAndPermuteAll(e); else ComputeStatsAndCompressAll(e); // add header to file e.WriteHeader(pLargeRAWFileOut, iOutOffset); m_Progress.Message(_func_, "Header written, truncating file..."); // remove part of the file used only for temp calculations pLargeRAWFileOut->Truncate(iOutOffset + e.m_iSize); m_fProgress = 1.0f; return true; } /* GetInputBrick: This function extracts data for a specified brick from the linear raw input file. Index magic is explained in the function. */ void ExtendedOctreeConverter::GetInputBrick(std::vector& vData, ExtendedOctree &tree, LargeRAWFile_ptr pLargeRAWFileIn, uint64_t iInOffset, const UINT64VECTOR4& coords, bool bClampToEdge) { const UINT64VECTOR3 vBrickSize = tree.ComputeBrickSize(coords); const uint64_t iBricksSize = (tree.m_vTOC.end()-1)->m_iLength; if (vData.size() != size_t(iBricksSize)) vData.resize(size_t(iBricksSize)); // zero out the data (this makes sure boundaries are zero) // if we use bClampToEdge then we need to init the borders // here as they are overriden later if (!bClampToEdge) memset (&vData[0],0,size_t(iBricksSize)); const uint64_t iVoxelSize = tree.GetComponentTypeSize() * tree.GetComponentCount(); const uint64_t iMaxLineSize = vBrickSize.x * iVoxelSize; const UINT64VECTOR4 bricksInZeroLevel = tree.GetBrickCount(0); // first we figure out if the requested brick is a boundary brick // for boundary bricks we have to skip the overlap regions const uint64_t xStart = (coords.x == 0) ? m_iOverlap : 0; const uint64_t yStart = (coords.y == 0) ? m_iOverlap : 0; const uint64_t zStart = (coords.z == 0) ? m_iOverlap : 0; const uint64_t yEnd = vBrickSize.y - ((coords.y == bricksInZeroLevel.y-1) ? m_iOverlap : 0); const uint64_t zEnd = vBrickSize.z - ((coords.z == bricksInZeroLevel.z-1) ? m_iOverlap : 0); // now iterate over the x-scanlines (as x is stored continuous in the // input file we only need to loop over y and z) for (uint64_t z = 0;zSeekPos(iCurrentInOffset); pLargeRAWFileIn->ReadRAW((uint8_t*)&vData[iOutOffset], iLineSize); } } if (bClampToEdge) { ClampToEdge(vData, coords.x == 0, coords.y == 0, coords.z == 0, coords.x == bricksInZeroLevel.x-1, coords.y == bricksInZeroLevel.y-1, coords.z == bricksInZeroLevel.z-1, iVoxelSize, vBrickSize); } } void ExtendedOctreeConverter::ClampToEdge(std::vector& vData, bool bCopyXs, bool bCopyYs, bool bCopyZs, bool bCopyXe, bool bCopyYe, bool bCopyZe, uint64_t iVoxelSize, const UINT64VECTOR3& vBrickSize) { // copy left (line-Start) border-plane into left overlap region if (bCopyXs) { for (uint64_t z = 0;z(tree.m_iBrickSize.volume() * iVoxelSize); std::shared_ptr BrickData(new uint8_t[maxbricksize], nonstd::DeleteArray()); std::shared_ptr compressed(new uint8_t[maxbricksize], nonstd::DeleteArray()); size_t iReportInterval = std::max(1, tree.m_vTOC.size()/2000); if(m_eCompression == CT_NONE) { // compression is disabled. That makes our job pretty easy: only compute // the brick stats for(size_t i=0; i < tree.m_vTOC.size(); ++i) { tree.GetBrickData(BrickData.get(), i); BrickStat(m_pBrickStatVec, i, BrickData.get(), BrickSize(tree, i), tree.m_iComponentCount, tree.m_eComponentType); if (i % iReportInterval == 0) { m_fProgress = float(i) / tree.m_vTOC.size(); std::string msg = m_pProgressTimer->GetProgressMessage(m_fProgress); m_Progress.Message(_func_, "Statistic computation ... %5.2f%% (%s)", m_fProgress*100.0f, msg.c_str()); } } } else { std::array lzmaProps; // foreach brick: // load it up // compress it // write compressed payload // update brick metadata based on what compression changed for(size_t i=0; i < tree.m_vTOC.size(); ++i) { tree.GetBrickData(BrickData.get(), i); BrickStat(m_pBrickStatVec, i, BrickData.get(), BrickSize(tree, i), tree.m_iComponentCount, tree.m_eComponentType); uint64_t newlen = 0; switch (m_eCompression) { case CT_ZLIB: newlen = zCompress(BrickData, BrickSize(tree, i), compressed, tree.m_iCompressionLevel); // 0..9 (0 no comp) break; case CT_LZMA: newlen = lzmaCompress(BrickData, BrickSize(tree, i), compressed, lzmaProps, tree.m_iCompressionLevel - 1); // 0..9 assert(lzmaProps == tree.m_lzmaProps); break; case CT_LZ4: newlen = lz4Compress(BrickData, BrickSize(tree, i), compressed, tree.m_iCompressionLevel > 5); // high or normal break; case CT_BZLIB: newlen = bzCompress(BrickData, BrickSize(tree, i), compressed, tree.m_iCompressionLevel); // 1..9 break; case CT_LZHAM: newlen = lzhamCompress(BrickData, BrickSize(tree, i), compressed, tree.m_iCompressionLevel); // 0..10 (0 no comp) break; default: throw std::runtime_error("unknown compression format"); } std::shared_ptr data; if(newlen < BrickSize(tree, i)) { tree.m_vTOC[i].m_iLength = newlen; tree.m_vTOC[i].m_eCompression = m_eCompression; data = compressed; } else { tree.m_vTOC[i].m_iLength = BrickSize(tree, i); tree.m_vTOC[i].m_eCompression = CT_NONE; data = BrickData; } if(i > 0) { tree.m_vTOC[i].m_iOffset = tree.m_vTOC[i-1].m_iOffset + tree.m_vTOC[i-1].m_iLength; } tree.m_pLargeRAWFile->SeekPos(tree.m_vTOC[i].m_iOffset); tree.m_pLargeRAWFile->WriteRAW(data.get(), tree.m_vTOC[i].m_iLength); if (i % iReportInterval == 0) { m_fProgress = float(i) / tree.m_vTOC.size(); std::string msg = m_pProgressTimer->GetProgressMessage(m_fProgress); m_Progress.Message(_func_, "Statistics and compression .. %5.2f%% (%s)", m_fProgress*100.0f, msg.c_str()); } } } // do not forget to set new octree size tree.m_iSize = tree.m_vTOC.back().m_iOffset + tree.m_vTOC.back().m_iLength; } std::shared_ptr ExtendedOctreeConverter::Fetch(ExtendedOctree& tree, uint64_t iIndex, std::shared_ptr const pBuffer) { TOCEntry& record = tree.m_vTOC[(size_t)iIndex]; std::shared_ptr pData = pBuffer; if (!pData) pData.reset(new uint8_t[record.m_iLength], nonstd::DeleteArray()); tree.m_pLargeRAWFile->SeekPos(tree.m_iOffset + record.m_iOffset); tree.m_pLargeRAWFile->ReadRAW(pData.get(), record.m_iLength); // if we are touching the brick the first time compute statistics and compress if ((m_pBrickStatVec->size() < (iIndex+1) * tree.m_iComponentCount) || !m_pBrickStatVec->at(iIndex * tree.m_iComponentCount).IsValid()) { assert(record.m_eCompression == CT_NONE); assert(record.m_iLength == BrickSize(tree, iIndex)); BrickStat(m_pBrickStatVec, iIndex, pData.get(), record.m_iLength, tree.m_iComponentCount, tree.m_eComponentType); // compress if desired if (m_eCompression != CT_NONE) { std::shared_ptr pCompressed; // *Compress will always create a buffer sized like the input data uint64_t iCompressed = 0; switch (m_eCompression) { case CT_ZLIB: iCompressed = zCompress(pData, record.m_iLength, pCompressed, tree.m_iCompressionLevel); // 0..9 (0 no comp) break; case CT_LZMA: { // we only use the encoded props for safety checks // they should be identical for all bricks of the tree std::array props; iCompressed = lzmaCompress(pData, record.m_iLength, pCompressed, props, tree.m_iCompressionLevel - 1); // 0..9 assert(props == tree.m_lzmaProps); break; } case CT_LZ4: iCompressed = lz4Compress(pData, record.m_iLength, pCompressed, tree.m_iCompressionLevel > 5); // high or normal break; case CT_BZLIB: iCompressed = bzCompress(pData, record.m_iLength, pCompressed, tree.m_iCompressionLevel); // 1..9 break; case CT_LZHAM: iCompressed = lzhamCompress(pData, record.m_iLength, pCompressed, tree.m_iCompressionLevel); // 0..10 (0 no comp) break; default: throw std::runtime_error("unknown compression format"); } if (iCompressed < record.m_iLength) { if (!pBuffer) { pData.reset(new uint8_t[iCompressed], nonstd::DeleteArray()); memcpy(pData.get(), pCompressed.get(), iCompressed); } else pData = pCompressed; record.m_iLength = iCompressed; record.m_eCompression = m_eCompression; } } } return pData; } void ExtendedOctreeConverter::ComputeStatsCompressAndPermuteAll(ExtendedOctree& tree) { FlushCache(tree); // be sure we've got everything on disk. m_vBrickCache.clear(); // be double sure we don't use the cache anymore. size_t const iVoxelSize = tree.GetComponentTypeSize() * size_t(tree.m_iComponentCount); size_t const iMaxBrickSize = static_cast(tree.m_iBrickSize.volume() * iVoxelSize); std::shared_ptr const pUncompressed(new uint8_t[iMaxBrickSize], nonstd::DeleteArray()); size_t const iReportInterval = std::max(1, tree.m_vTOC.size()/2000); uint64_t const IN_CORE = std::numeric_limits::max(); uint64_t const treeOffset = tree.ComputeHeaderSize(); uint64_t tempOffset = tree.GetSize(); uint64_t writeOffset = treeOffset; uint64_t emptyLength = 0; typedef std::map Uint64Map; Uint64Map occupiedSpace; // maps offset to brick index Uint64Map emptySpace; // maps offset to empty length typedef std::unordered_map> SimpleCache; SimpleCache cache; uint64_t cacheSize = 0; // build occupied space table, should be very efficient if ToC is ordered for (size_t i = 0; i < tree.m_vTOC.size(); ++i) // NOTICE: We would like to use the map::emplace_hint method here in order // guarantee the right behavior but that's currently not supported // by gcc 4.6 on our open suse test machine. // We use map::insert instead with a insertion position hint that // SHOULD be C++11 conform otherwise this part will be VERY SLOW // because the semantic of the position iterator argument changed // from C++98 to C++11! #ifdef DETECTED_OS_WINDOWS occupiedSpace.emplace_hint(occupiedSpace.cend(), Uint64Map::value_type(tree.m_vTOC[i].m_iOffset, i)); #else occupiedSpace.insert(occupiedSpace.cend(), Uint64Map::value_type(tree.m_vTOC[i].m_iOffset, i)); #endif uint64_t iProgress = 0; // global brick progress counter for (uint64_t lod = 0; lod < tree.GetLODCount(); ++lod) { UINT64VECTOR3 const domain = tree.GetBrickCount(lod); uint64_t const brickCount = domain.volume(); // instantiate the layout we want to use for the current level of detail std::shared_ptr pLayout; switch (m_eLayout) { default: case LT_SCANLINE: pLayout.reset(new VolumeTools::ScanlineLayout(domain)); break; case LT_MORTON: pLayout.reset(new VolumeTools::MortonLayout(domain)); break; case LT_HILBERT: pLayout.reset(new VolumeTools::HilbertLayout(domain)); break; case LT_RANDOM: pLayout.reset(new VolumeTools::RandomLayout(domain)); break; } // follow the layout and permute bricks until we completely filled // the domain of the current level (brickCounter == brickCount) uint64_t brickCounter = 0; uint64_t layoutIndex = 0; while (brickCounter < brickCount) { UINT64VECTOR3 const position = pLayout->GetSpatialPosition(layoutIndex++); if (position.x < domain.x && position.y < domain.y && position.z < domain.z) { // convert valid spatial position to our internal brick index uint64_t const thisIndex = tree.BrickCoordsToIndex(UINT64VECTOR4(position, lod)); TOCEntry& thisRecord = tree.m_vTOC[(size_t)thisIndex]; std::shared_ptr thisData; // retrieve next brick in layout order auto c = cache.find(thisIndex); if (c != cache.cend()) { // found cached (compressed) brick thisData = c->second; assert(thisData && thisData.get()); cache.erase(c); } else { // load (compressed) brick from disk uint64_t const iLength = thisRecord.m_iLength; // disk length before fetch thisData = Fetch(tree, thisIndex, pUncompressed); if (occupiedSpace.begin()->second != thisIndex) { #ifdef DETECTED_OS_WINDOWS emptySpace.emplace(Uint64Map::value_type(thisRecord.m_iOffset, iLength)); #else emptySpace.insert(Uint64Map::value_type(thisRecord.m_iOffset, iLength)); #endif } else { emptyLength += iLength; // we just fetched the next brick in file } size_t iSuccess = occupiedSpace.erase(thisRecord.m_iOffset); assert(iSuccess); if (iSuccess) {} // suppress local variable is initialized but not referenced warning thisRecord.m_iOffset = IN_CORE; } // eat empty space that might have opened up by removing some last occupier { uint64_t emptyOffset = writeOffset + emptyLength; while (!emptySpace.empty() && emptySpace.begin()->first <= emptyOffset) { auto e = emptySpace.begin(); assert(e->first == emptyOffset); // just check to know if e->first < emptyOffset occurs sometimes //emptyLength += e->second - (emptyOffset - e->first); // see above emptyLength += e->second; emptySpace.erase(e); emptyOffset = writeOffset + emptyLength; } } // free up occupied space until the current brick fits while (thisRecord.m_iLength > emptyLength) { // fetch next occupier auto o = occupiedSpace.begin(); uint64_t const pageInIndex = o->second; TOCEntry& pageInRecord = tree.m_vTOC[(size_t)pageInIndex]; assert(pageInRecord.m_iOffset != IN_CORE); assert(o->first == pageInRecord.m_iOffset); assert(writeOffset + emptyLength == pageInRecord.m_iOffset); uint64_t const iLength = pageInRecord.m_iLength; // disk length before fetch std::shared_ptr pageInData = Fetch(tree, pageInIndex); emptyLength += iLength; // we just fetched the next brick in file pageInRecord.m_iOffset = IN_CORE; occupiedSpace.erase(o); // eat empty space that might have opened up by removing the last occupier uint64_t emptyOffset = writeOffset + emptyLength; while (!emptySpace.empty() && emptySpace.begin()->first <= emptyOffset) { auto e = emptySpace.begin(); assert(e->first == emptyOffset); // just check to know if e->first < emptyOffset occurs sometimes //emptyLength += e->second - (emptyOffset - e->first); // see above emptyLength += e->second; emptySpace.erase(e); emptyOffset = writeOffset + emptyLength; } // push paged in brick to cache cacheSize += pageInRecord.m_iLength; bool bSuccess = cache.insert(SimpleCache::value_type(pageInIndex, pageInData)).second; if (bSuccess) {} // suppress local variable is initialized but not referenced warning assert(bSuccess); // check cache limit and page out as much bricks as necessary while (!cache.empty() && cacheSize > m_iMemLimit) { // pop random brick from cache to be paged out auto c = cache.begin(); uint64_t const pageOutIndex = c->first; TOCEntry& pageOutRecord = tree.m_vTOC[(size_t)pageOutIndex]; assert(pageOutRecord.m_iOffset == IN_CORE); std::shared_ptr pageOutData = c->second; assert(pageOutData && pageOutData.get()); cacheSize -= pageOutRecord.m_iLength; cache.erase(c); // 1) try to find next suitable empty space location from the back of the file for (auto e = emptySpace.rbegin(); e != emptySpace.rend(); ++e) { if (pageOutRecord.m_iLength > e->second) { continue; } else if (pageOutRecord.m_iLength < e->second) { // Yay! we found suitable empty space but we need to split empty // space from behind to not change the EST entry e->second -= pageOutRecord.m_iLength; pageOutRecord.m_iOffset = e->first + e->second; } else { // Yay! we found suitable empty space that fits perfectly pageOutRecord.m_iOffset = e->first; emptySpace.erase(--e.base()); // erasing a reverse iterator } break; } // 2) try to use 1st order empty space until we barely fit thisRecord in there if (pageOutRecord.m_iOffset == IN_CORE) { if (emptyLength > thisRecord.m_iLength && emptyLength - thisRecord.m_iLength >= pageOutRecord.m_iLength) { pageOutRecord.m_iOffset = emptyOffset - pageOutRecord.m_iLength; emptyOffset -= pageOutRecord.m_iLength; emptyLength -= pageOutRecord.m_iLength; } } // 3) final chance use tempOffset at the end of the file to page out memory if (pageOutRecord.m_iOffset == IN_CORE) { pageOutRecord.m_iOffset = tempOffset; tempOffset += pageOutRecord.m_iLength; } // add new occupier even if we page out to the temp region at the end of file bool bSuccess = occupiedSpace.insert(Uint64Map::value_type(pageOutRecord.m_iOffset, pageOutIndex)).second; if (bSuccess) {} // suppress local variable is initialized but not referenced warning assert(bSuccess); // write brick to temporary position tree.m_pLargeRAWFile->SeekPos(tree.m_iOffset + pageOutRecord.m_iOffset); tree.m_pLargeRAWFile->WriteRAW(pageOutData.get(), pageOutRecord.m_iLength); } // free up some cache } // free up occupied space // write brick to the correct layout position thisRecord.m_iOffset = writeOffset; tree.m_pLargeRAWFile->SeekPos(tree.m_iOffset + thisRecord.m_iOffset); tree.m_pLargeRAWFile->WriteRAW(thisData.get(), thisRecord.m_iLength); writeOffset += thisRecord.m_iLength; emptyLength -= thisRecord.m_iLength; // increment brick counter for the termination criterion ++brickCounter; // report progress if (iProgress % iReportInterval == 0) { m_fProgress = MathTools::lerp(float(iProgress) / tree.m_vTOC.size(), 0.0f,1.0f, 0.8f,1.0f); PROGRESS; } ++iProgress; } // valid spatial position check } // reordering per level loop } // level loop uint64_t const temporarySpace = tempOffset - tree.m_iSize; uint64_t const compressionGain = tree.m_iSize - writeOffset; m_Progress.Other(_func_, "Temporary disk space required during brick reordering: %.3f MB", (float)temporarySpace / (1024.f*1024.f)); m_Progress.Other(_func_, "Space savings due to data compression: %.2f%%", (100.f - ((float)compressionGain / tree.m_iSize) * 100.f)); // do not forget to set new octree size tree.m_iSize = writeOffset; assert(cache.empty()); assert(occupiedSpace.empty()); assert(emptySpace.empty()); // may be not true } /* SetBrick (vector): Convenience function that takes vector coordinates of a brick turns them into a 1D index and calls the scalar SetBrick */ void ExtendedOctreeConverter::SetBrick(uint8_t* pData, ExtendedOctree &tree, const UINT64VECTOR4& vBrickCoords, bool bForceWrite) { SetBrick(pData, tree, tree.BrickCoordsToIndex(vBrickCoords), bForceWrite); } /* GetBrick (vector): Convenience function that takes vector coordinates of a brick turns them into a 1D index and calls the scalar GetBrick */ void ExtendedOctreeConverter::GetBrick(uint8_t* pData, ExtendedOctree &tree, const UINT64VECTOR4& vBrickCoords) { GetBrick(pData, tree, tree.BrickCoordsToIndex(vBrickCoords)); } /* SetupCache: Computes the size of the cache: simply as available size divided by the size of a cache element */ void ExtendedOctreeConverter::SetupCache(ExtendedOctree &tree) { size_t CacheElementDataSize = size_t(tree.GetComponentTypeSize() * tree.GetComponentCount() * tree.m_iBrickSize.volume()); uint64_t iCacheElemCount = m_iMemLimit / (CacheElementDataSize + sizeof(CacheEntry)); iCacheElemCount = std::min(iCacheElemCount, tree.ComputeBrickCount()); m_vBrickCache.resize(size_t(iCacheElemCount)); for (BrickCacheIter i = m_vBrickCache.begin();i != m_vBrickCache.end();++i) { i->SetSize(CacheElementDataSize); } } /* FlushCache: Write all bricks to disk that have not been committed yet */ void ExtendedOctreeConverter::FlushCache(ExtendedOctree &tree) { for (BrickCacheIter i = m_vBrickCache.begin();i != m_vBrickCache.end();++i) { if (i->m_bDirty) { WriteBrickToDisk(tree, i); m_fProgress = -std::distance(i, m_vBrickCache.begin()) / float(m_vBrickCache.size()); const std::string msg = m_pProgressTimer->GetProgressMessage(m_fProgress); m_Progress.Message(_func_, "Flushing brick cache ... %5.2f%% (%s)", m_fProgress*100.0f, msg.c_str()); } } } // @returns the number of bytes needed to store the (uncompressed) given brick. uint64_t ExtendedOctreeConverter::BrickSize(const ExtendedOctree& tree, uint64_t index) { // if the brick is compressed, then its m_iLength field gives the // length of the compressed brick, not the expanded brick... if(tree.m_vTOC[index].m_eCompression != CT_NONE) { // ... but it's pretty simple to compute how big it'll expand into: return tree.ComputeBrickSize(tree.IndexToBrickCoords(index)).volume() * tree.GetComponentTypeSize() * tree.GetComponentCount(); } return tree.m_vTOC[index].m_iLength; } void ExtendedOctreeConverter::BrickStat( BrickStatVec* bs, uint64_t index, const uint8_t* pData, uint64_t length, size_t components, enum ExtendedOctree::COMPONENT_TYPE type ) { assert(bs); if(bs->size() < (index+1)*components) { bs->resize((index+1)*components); } BrickStatVec elem; switch (type) { case ExtendedOctree::CT_UINT8: elem = ComputeBrickStats(pData, length, components); break; case ExtendedOctree::CT_UINT16: elem = ComputeBrickStats(pData, length, components); break; case ExtendedOctree::CT_UINT32: elem = ComputeBrickStats(pData, length, components); break; case ExtendedOctree::CT_UINT64: elem = ComputeBrickStats(pData, length, components); break; case ExtendedOctree::CT_INT8: elem = ComputeBrickStats(pData, length, components); break; case ExtendedOctree::CT_INT16: elem = ComputeBrickStats(pData, length, components); break; case ExtendedOctree::CT_INT32: elem = ComputeBrickStats(pData, length, components); break; case ExtendedOctree::CT_INT64: elem = ComputeBrickStats(pData, length, components); break; case ExtendedOctree::CT_FLOAT32: elem = ComputeBrickStats(pData, length, components); break; case ExtendedOctree::CT_FLOAT64: elem = ComputeBrickStats(pData, length, components); break; } for (size_t c=0; c < components ;++c) (*bs)[index*components+c] = elem[c]; } void ExtendedOctreeConverter::WriteBrickToDisk(ExtendedOctree &tree, BrickCacheIter element) { WriteBrickToDisk(tree, element->m_pData, element->m_index); element->m_bDirty = false; } void ExtendedOctreeConverter::WriteBrickToDisk(ExtendedOctree &tree, uint8_t* pData, size_t index) { tree.m_pLargeRAWFile->SeekPos(tree.m_iOffset+tree.m_vTOC[index].m_iOffset); const uint64_t length = BrickSize(tree, index); tree.m_vTOC[index].m_iLength = length; tree.m_vTOC[index].m_eCompression = CT_NONE; tree.m_pLargeRAWFile->WriteRAW(pData, tree.m_vTOC[index].m_iLength); } /* HasIndex: Function used for find_if, returns true iff a cache entry has a certain index */ struct HasIndex : public std::binary_function { bool operator()(const ExtendedOctreeConverter::CacheEntry& cacheEntry, uint64_t index) const { return cacheEntry.m_index == index; } }; /* GetBrick: Retrieves a brick from the tree. First we check if the cache is enabled, if not we simply request the brick from the tree. Otherwise we check the cache and, if we have a hit, return the cache copy otherwise we fetch the data from disk and put a copy into the cache, therefore we search for a suitable cache entry (the entry with the oldest access counter). In either case (hit or miss) we update the access counter, i.e. we use true LRU as caching strategy. */ void ExtendedOctreeConverter::GetBrick(uint8_t* pData, ExtendedOctree &tree, uint64_t index) { if (m_vBrickCache.empty()) { tree.GetBrickData(pData, index); return; } BrickCacheIter cacheEntry = std::find_if(m_vBrickCache.begin(), m_vBrickCache.end(), std::bind2nd(HasIndex(), index)); if (cacheEntry == m_vBrickCache.end()) { // cache miss // read data from disk tree.GetBrickData(pData, index); // find cache entry to evict from cache cacheEntry = m_vBrickCache.begin(); for (BrickCacheIter i = m_vBrickCache.begin();i != m_vBrickCache.end();++i) { if (i->m_iAccess < cacheEntry->m_iAccess) cacheEntry = i; } if (cacheEntry->m_iAccess == 0) { // if this is a never before used cache entry allocate memory cacheEntry->Allocate(); } else { // if it's dirty, write to disk if (cacheEntry->m_bDirty) WriteBrickToDisk(tree, cacheEntry); } uint64_t uncompressedLength = BrickSize(tree, index); // put new entry into cache cacheEntry->m_bDirty = false; cacheEntry->m_index = size_t(index); cacheEntry->m_iAccess = ++m_iCacheAccessCounter; memcpy(cacheEntry->m_pData, pData, size_t(uncompressedLength)); } else { // cache hit uint64_t uncompressedLength = BrickSize(tree, cacheEntry->m_index); memcpy(pData, cacheEntry->m_pData, size_t(uncompressedLength)); cacheEntry->m_iAccess = ++m_iCacheAccessCounter; } } /* SetBrick: Writes a brick to the tree. First we check if the cache is enabled, if not we simply write out the brick to disk. Otherwise we check the cache and, if we have a hit, write into the cache copy otherwise we search for a suitable cache entry (the entry with the oldest access counter). In either case (hit or miss) we update the access counter, i.e. we use true LRU as caching strategy. If bForceWrite is enabled we write the data to disk directly bypassing the write cache, if in this case a cache miss occurs we only write to disk and don't update the cache in a cache hit case we update the data and write to disk. */ void ExtendedOctreeConverter::SetBrick(uint8_t* pData, ExtendedOctree &tree, uint64_t index, bool bForceWrite) { if (m_vBrickCache.empty()) { WriteBrickToDisk(tree, pData, size_t(index)); return; } BrickCacheIter cacheEntry = std::find_if(m_vBrickCache.begin(), m_vBrickCache.end(), std::bind2nd(HasIndex(), index)); tree.m_vTOC[size_t(index)].m_iLength = tree.ComputeBrickSize(tree.IndexToBrickCoords(index)).volume() * tree.GetComponentTypeSize() * tree.GetComponentCount(); if (cacheEntry == m_vBrickCache.end()) { // cache miss if (bForceWrite) { WriteBrickToDisk(tree, pData, size_t(index)); return; } // find cache entry to evict from cache cacheEntry = m_vBrickCache.begin(); for (BrickCacheIter i = m_vBrickCache.begin();i != m_vBrickCache.end();++i) { if (i->m_iAccess < cacheEntry->m_iAccess) cacheEntry = i; } if (cacheEntry->m_iAccess == 0) { // if this is a never before used cache entry allocate memory cacheEntry->Allocate(); } else { // if it's dirty, write to disk if (cacheEntry->m_bDirty) WriteBrickToDisk(tree, cacheEntry); } // put new entry into cache cacheEntry->m_bDirty = true; cacheEntry->m_index = size_t(index); cacheEntry->m_iAccess = ++m_iCacheAccessCounter; memcpy(cacheEntry->m_pData, pData, size_t(tree.m_vTOC[cacheEntry->m_index].m_iLength)); } else { // cache hit cacheEntry->m_bDirty = true; cacheEntry->m_iAccess = ++m_iCacheAccessCounter; memcpy(cacheEntry->m_pData, pData, size_t(tree.m_vTOC[size_t(index)].m_iLength)); if (bForceWrite) WriteBrickToDisk(tree, cacheEntry); } } /* CopyBrickToBrick: Copies (parts) of one brick into another. This routine is used to fill the overlap regions. Index Magic explained in the function. */ void ExtendedOctreeConverter::CopyBrickToBrick(std::vector& vSourceData, const UINT64VECTOR3& sourceBrickSize, std::vector& vTargetData, const UINT64VECTOR3& targetBrickSize, const UINT64VECTOR3& sourceOffset, const UINT64VECTOR3& targetOffset, const UINT64VECTOR3& regionSize, size_t voxelSize) { for (uint32_t z = 0;z vTargetData(size_t(tree.m_iBrickSize.volume() * iElementSize)); std::vector vSourceData(size_t(tree.m_iBrickSize.volume() * iElementSize)); for (uint64_t z = 0;z 0; bool bHasBackNeighbour = z < baseBricks.z-1; for (uint64_t y = 0;y 0; bool bHasBottomNeighbour = y < baseBricks.y-1; for (uint64_t x = 0;x 0; bool bHasRightNeighbour = x < baseBricks.x-1; UINT64VECTOR4 coords(x,y,z,iLoD); UINT64VECTOR3 targetBrickSize = tree.ComputeBrickSize(coords); GetBrick(&vTargetData[0], tree, coords); // first the six direct neighbors if (bHasRightNeighbour) { UINT64VECTOR4 sourceCoords(x+1,y,z,iLoD); UINT64VECTOR3 sourceBrickSize = tree.ComputeBrickSize(sourceCoords); GetBrick(&vSourceData[0], tree, sourceCoords); CopyBrickToBrick(vSourceData, sourceBrickSize, vTargetData, targetBrickSize, UINT64VECTOR3(tree.m_iOverlap,0,0), UINT64VECTOR3(targetBrickSize.x-tree.m_iOverlap,0,0), UINT64VECTOR3(tree.m_iOverlap, sourceBrickSize.y, sourceBrickSize.z), iElementSize); } if (bHasBottomNeighbour) { UINT64VECTOR4 sourceCoords(x,y+1,z,iLoD); UINT64VECTOR3 sourceBrickSize = tree.ComputeBrickSize(sourceCoords); GetBrick(&vSourceData[0], tree, sourceCoords); CopyBrickToBrick(vSourceData, sourceBrickSize, vTargetData, targetBrickSize, UINT64VECTOR3(0,tree.m_iOverlap,0), UINT64VECTOR3(0,targetBrickSize.y-tree.m_iOverlap,0), UINT64VECTOR3(sourceBrickSize.x, tree.m_iOverlap, sourceBrickSize.z), iElementSize); } if (bHasBackNeighbour) { UINT64VECTOR4 sourceCoords(x,y,z+1,iLoD); UINT64VECTOR3 sourceBrickSize = tree.ComputeBrickSize(sourceCoords); GetBrick(&vSourceData[0], tree, sourceCoords); CopyBrickToBrick(vSourceData, sourceBrickSize, vTargetData, targetBrickSize, UINT64VECTOR3(0,0,tree.m_iOverlap), UINT64VECTOR3(0,0,targetBrickSize.z-tree.m_iOverlap), UINT64VECTOR3(sourceBrickSize.x, sourceBrickSize.y, tree.m_iOverlap), iElementSize); } if (bHasLeftNeighbour) { UINT64VECTOR4 sourceCoords(x-1,y,z,iLoD); UINT64VECTOR3 sourceBrickSize = tree.ComputeBrickSize(sourceCoords); GetBrick(&vSourceData[0], tree, sourceCoords); CopyBrickToBrick(vSourceData, sourceBrickSize, vTargetData, targetBrickSize, UINT64VECTOR3(sourceBrickSize.x-tree.m_iOverlap*2,0,0), UINT64VECTOR3(0,0,0), UINT64VECTOR3(tree.m_iOverlap, sourceBrickSize.y, sourceBrickSize.z), iElementSize); } if (bHasTopNeighbour) { UINT64VECTOR4 sourceCoords(x,y-1,z,iLoD); UINT64VECTOR3 sourceBrickSize = tree.ComputeBrickSize(sourceCoords); GetBrick(&vSourceData[0], tree, sourceCoords); CopyBrickToBrick(vSourceData, sourceBrickSize, vTargetData, targetBrickSize, UINT64VECTOR3(0,sourceBrickSize.y-tree.m_iOverlap*2,0), UINT64VECTOR3(0,0,0), UINT64VECTOR3(sourceBrickSize.x, tree.m_iOverlap, sourceBrickSize.z), iElementSize); } if (bHasFrontNeighbour) { UINT64VECTOR4 sourceCoords(x,y,z-1,iLoD); UINT64VECTOR3 sourceBrickSize = tree.ComputeBrickSize(sourceCoords); GetBrick(&vSourceData[0], tree, sourceCoords); CopyBrickToBrick(vSourceData, sourceBrickSize, vTargetData, targetBrickSize, UINT64VECTOR3(0,0,sourceBrickSize.z-tree.m_iOverlap*2), UINT64VECTOR3(0,0,0), UINT64VECTOR3(sourceBrickSize.x, sourceBrickSize.y, tree.m_iOverlap), iElementSize); } // then the bottom left neighbor (the other four corners are included in the // previous cases) if (bHasBottomNeighbour && bHasRightNeighbour) { UINT64VECTOR4 sourceCoords(x+1,y+1,z,iLoD); UINT64VECTOR3 sourceBrickSize = tree.ComputeBrickSize(sourceCoords); GetBrick(&vSourceData[0], tree, sourceCoords); CopyBrickToBrick(vSourceData, sourceBrickSize, vTargetData, targetBrickSize, UINT64VECTOR3(tree.m_iOverlap,tree.m_iOverlap,0), UINT64VECTOR3(targetBrickSize.x-tree.m_iOverlap,targetBrickSize.y-tree.m_iOverlap,0), UINT64VECTOR3(tree.m_iOverlap, tree.m_iOverlap, sourceBrickSize.z), iElementSize); } // finally, the three diagonal neighbors in the next brick plane to fill the // bottom right corner if (bHasRightNeighbour && bHasBackNeighbour) { UINT64VECTOR4 sourceCoords(x+1,y,z+1,iLoD); UINT64VECTOR3 sourceBrickSize = tree.ComputeBrickSize(sourceCoords); GetBrick(&vSourceData[0], tree, sourceCoords); CopyBrickToBrick(vSourceData, sourceBrickSize, vTargetData, targetBrickSize, UINT64VECTOR3(tree.m_iOverlap,0,tree.m_iOverlap), UINT64VECTOR3(targetBrickSize.x-tree.m_iOverlap,0,targetBrickSize.z-tree.m_iOverlap), UINT64VECTOR3(tree.m_iOverlap, sourceBrickSize.y, tree.m_iOverlap), iElementSize); } if (bHasBottomNeighbour && bHasBackNeighbour) { UINT64VECTOR4 sourceCoords(x,y+1,z+1,iLoD); UINT64VECTOR3 sourceBrickSize = tree.ComputeBrickSize(sourceCoords); GetBrick(&vSourceData[0], tree, sourceCoords); CopyBrickToBrick(vSourceData, sourceBrickSize, vTargetData, targetBrickSize, UINT64VECTOR3(0,tree.m_iOverlap,tree.m_iOverlap), UINT64VECTOR3(0,targetBrickSize.y-tree.m_iOverlap,targetBrickSize.z-tree.m_iOverlap), UINT64VECTOR3(sourceBrickSize.x, tree.m_iOverlap, tree.m_iOverlap), iElementSize); } if (bHasRightNeighbour && bHasBottomNeighbour && bHasBackNeighbour) { UINT64VECTOR4 sourceCoords(x+1,y+1,z+1,iLoD); UINT64VECTOR3 sourceBrickSize = tree.ComputeBrickSize(sourceCoords); GetBrick(&vSourceData[0], tree, sourceCoords); CopyBrickToBrick(vSourceData, sourceBrickSize, vTargetData, targetBrickSize, UINT64VECTOR3(tree.m_iOverlap,tree.m_iOverlap,tree.m_iOverlap), UINT64VECTOR3(targetBrickSize.x-tree.m_iOverlap,targetBrickSize.y-tree.m_iOverlap,targetBrickSize.z-tree.m_iOverlap), UINT64VECTOR3(tree.m_iOverlap, tree.m_iOverlap, tree.m_iOverlap), iElementSize); } if (bClampToEdge) { ClampToEdge(vTargetData, !bHasLeftNeighbour, !bHasTopNeighbour, !bHasFrontNeighbour, !bHasRightNeighbour, !bHasBottomNeighbour, !bHasBackNeighbour, iElementSize, targetBrickSize); } // now that brick is complete, write it back to the tree SetBrick(&vTargetData[0], tree, coords); } } } } /* This method reorders the large input raw file into smaller bricks of maximum size m_vBrickSize with an overlap of m_iOverlap i.e. it computes LoD level zero. Therefore, it iterates over all bricks to be created and grabs each from the source data. In the process it also fills the tree ToC. */ void ExtendedOctreeConverter::PermuteInputData(ExtendedOctree &tree, LargeRAWFile_ptr pLargeRAWFileIn, uint64_t iInOffset, bool bClampToEdge) { std::vector vData; UINT64VECTOR3 baseBricks = tree.GetBrickCount(0); uint64_t iCurrentOutOffset = tree.ComputeHeaderSize(); for (uint64_t z = 0;zGetProgressMessage(m_fProgress); m_Progress.Message(_func_, "Generating LOD 0 ... %5.2f%% (%s)", m_fProgress*100.0f, msg.c_str()); } } } /* ExportToRAW: Flattens/un-bricks a given LoD level into a file, for example a call with iLODLevel = 0 will recover the exact original data file used tho build this tree. This method is very simple, it iterates over all bricks of the given LoD level (x,y,z for-loops) and for each brick it writes it's non-overlap values into the target file. Index magic is explained inside the function. */ bool ExtendedOctreeConverter::ExportToRAW(const ExtendedOctree &tree, const LargeRAWFile_ptr pLargeRAWFile, uint64_t iLODLevel, uint64_t iOffset) { if (iLODLevel >= tree.GetLODCount()) return false; const size_t iVoxelSize =tree. GetComponentTypeSize() * size_t(tree.m_iComponentCount); uint8_t *pBrickData = new uint8_t[size_t(tree.m_iBrickSize.volume() * iVoxelSize)]; const UINT64VECTOR3 outSize = tree.m_vLODTable[size_t(iLODLevel)].m_iLODPixelSize; UINT64VECTOR3 bricksToExport = tree.GetBrickCount(iLODLevel); for (uint64_t z = 0;zSeekPos(iOutOffset); pLargeRAWFile->WriteRAW(pBrickData + iInOffset, iLineSize); } } } } } delete [] pBrickData; return true; } /* ExportToRAW (string): Convenience function that calls the above method with a large raw file constructed from the given string */ bool ExtendedOctreeConverter::ExportToRAW(const ExtendedOctree &tree, const std::string& filename, uint64_t iLODLevel, uint64_t iOffset) { uint64_t iElementSize = tree.GetComponentTypeSize() * uint64_t(tree.m_iComponentCount); UINT64VECTOR3 outsize = tree.m_vLODTable[size_t(iLODLevel)].m_iLODPixelSize; LargeRAWFile_ptr outFile(new LargeRAWFile(filename)); if (!outFile->Create(iOffset + outsize.volume()*iElementSize)) { return false; } return ExportToRAW(tree, outFile, iLODLevel, iOffset); } /* ApplyFunction: Applies a function to each brick of a given LoD level. This method simply iterates over all bricks of the given LoD level (x,y,z for-loops) and for each brick it writes hands the brick with (possibly modified) overlap to the supplied function. */ bool ExtendedOctreeConverter::ApplyFunction(const ExtendedOctree &tree, uint64_t iLODLevel, bool (*brickFunc)(void* pData, const UINT64VECTOR3& vBrickSize, const UINT64VECTOR3& vBrickOffset, void* pUserContext), void* pUserContext, uint32_t iOverlap) { if (iLODLevel >= tree.GetLODCount() || iOverlap > tree.m_iOverlap) return false; uint32_t skipOverlap = tree.m_iOverlap-iOverlap; const size_t iVoxelSize = tree.GetComponentTypeSize() * size_t(tree.m_iComponentCount); uint8_t *pBrickData = new uint8_t[size_t(tree.m_iBrickSize.volume() * iVoxelSize)]; UINT64VECTOR3 bricksToExport = tree.GetBrickCount(iLODLevel); for (uint64_t z = 0;zm_iLength+(e.m_vTOC.end()-1)->m_iOffset, iUncompressedBrickSize, CT_NONE, iUncompressedBrickSize, atlasSize}; e.m_vTOC.push_back(t); WriteBrickToDisk(e, pData, iBrick); } delete [] pData; // write updated ToC to file e.WriteHeader(pLargeRAWFile, iOffset); return false;} bool ExtendedOctreeConverter::Atalasify(ExtendedOctree &tree, const UINTVECTOR2& atlasSize) { bool bTreeWasInRWModeAlready = tree.IsInRWMode(); if (!bTreeWasInRWModeAlready) if (!tree.ReOpenRW()) return false; size_t CacheElementDataSize = size_t(tree.GetComponentTypeSize() * tree.GetComponentCount() * tree.m_iBrickSize.volume()); unsigned char* pData = new unsigned char[CacheElementDataSize]; // go throught all bricks and convert them to atlantified format for (size_t iBrick = 0;iBrick skip it if (tree.m_vTOC[iBrick].m_iAtlasSize == atlasSize) continue; // this method shall not be called on trees with compressed bricks if (tree.m_vTOC[iBrick].m_eCompression != CT_NONE) { if (!bTreeWasInRWModeAlready) tree.ReOpenR(); return false; } // convert Atalasify(tree, iBrick, atlasSize, pData); // write updated data to disk tree.m_pLargeRAWFile->SeekPos(tree.m_iOffset+tree.m_vTOC[iBrick].m_iOffset); tree.m_vTOC[iBrick].m_iAtlasSize = atlasSize; tree.m_pLargeRAWFile->WriteRAW(pData, tree.m_vTOC[iBrick].m_iLength); } delete [] pData; // write updated ToC to file tree.WriteHeader(tree.m_pLargeRAWFile, tree.m_iOffset); if (!bTreeWasInRWModeAlready) if (!tree.ReOpenR()) return false; return true; } void ExtendedOctreeConverter::DeAtalasify(const ExtendedOctree &tree, const UINT64VECTOR4& vBrickCoords, uint8_t* pData) { DeAtalasify(tree, size_t(tree.BrickCoordsToIndex(vBrickCoords)), pData); } void ExtendedOctreeConverter::DeAtalasify(const ExtendedOctree &tree, size_t index, uint8_t* pData) { const TOCEntry& metaData = tree.GetBrickToCData(index); const UINTVECTOR3 maxBrickSize = tree.GetMaxBrickSize(); const UINT64VECTOR3 currBrickSize = tree.ComputeBrickSize(tree.IndexToBrickCoords(index)); tree.GetBrickData(pData, index); // bail out if brick is atlantified and the size // is correct if (metaData.m_iAtlasSize.area() == 0) return; VolumeTools::DeAtalasify(size_t(currBrickSize.volume()*tree.GetComponentTypeSize()*tree.GetComponentCount()), metaData.m_iAtlasSize, maxBrickSize, currBrickSize, pData, pData); } bool ExtendedOctreeConverter::DeAtalasify(const ExtendedOctree &tree, LargeRAWFile_ptr pLargeRAWFile, uint64_t iOffset) { ExtendedOctree e; // setup target metadata e.m_eComponentType = tree.m_eComponentType; e.m_iComponentCount = tree.m_iComponentCount; e.m_vVolumeSize = tree.m_vVolumeSize; e.m_vVolumeAspect = tree.m_vVolumeAspect; e.m_iBrickSize = tree.m_iBrickSize; e.m_iOverlap = tree.m_iOverlap; e.m_iOffset = iOffset; e.m_pLargeRAWFile = pLargeRAWFile; e.ComputeMetadata(); size_t CacheElementDataSize = size_t(tree.GetComponentTypeSize() * tree.GetComponentCount() * tree.m_iBrickSize.volume()); unsigned char* pData = new unsigned char[CacheElementDataSize]; // go through all bricks and convert them to deatlantified format for (size_t iBrick = 0;iBrickm_iLength+(e.m_vTOC.end()-1)->m_iOffset, iUncompressedBrickSize, CT_NONE, iUncompressedBrickSize, UINTVECTOR2(0,0)}; e.m_vTOC.push_back(t); WriteBrickToDisk(e, pData, iBrick); } delete [] pData; // write updated ToC to file e.WriteHeader(pLargeRAWFile, iOffset); return false; } bool ExtendedOctreeConverter::DeAtalasify(ExtendedOctree &tree) { bool bTreeWasInRWModeAlready = tree.IsInRWMode(); if (!bTreeWasInRWModeAlready) if (!tree.ReOpenRW()) return false; size_t CacheElementDataSize = size_t(tree.GetComponentTypeSize() * tree.GetComponentCount() * tree.m_iBrickSize.volume()); unsigned char* pData = new unsigned char[CacheElementDataSize]; // go throught all bricks and convert them to 3D brick format for (size_t iBrick = 0;iBrick skip it if (tree.m_vTOC[iBrick].m_iAtlasSize.area() == 0) continue; // this method shall not be called on trees with compressed bricks if (tree.m_vTOC[iBrick].m_eCompression != CT_NONE) { if (!bTreeWasInRWModeAlready) tree.ReOpenR(); return false; } // convert DeAtalasify(tree, iBrick, pData); // write updated data to disk tree.m_pLargeRAWFile->SeekPos(tree.m_iOffset+tree.m_vTOC[iBrick].m_iOffset); tree.m_vTOC[iBrick].m_iAtlasSize = UINTVECTOR2(0,0); tree.m_pLargeRAWFile->WriteRAW(pData, tree.m_vTOC[iBrick].m_iLength); } delete [] pData; // write updated ToC to file tree.WriteHeader(tree.m_pLargeRAWFile, tree.m_iOffset); if (!bTreeWasInRWModeAlready) if (!tree.ReOpenR()) return false; return true; } ImageVis3D-3.1.0/Tuvok/IO/UVF/ExtendedOctree/Hilbert.inc0000644000175000017500000005144112320456500022327 0ustar mathieumathieu#ifdef WIN32 #pragma warning(disable:4146) #endif /* Hilbert code implementation is inspired by: http://web.archive.org/web/20040811200015/http://www.caam.rice.edu/~dougm/twiddle/Hilbert/ */ /* implementation of the Hilbert functions */ #define adjustRotation(rotation, nDims, bits)\ do {\ /* rotation = (rotation + 1 + ffs(bits)) % nDims; */\ bits &= -bits & nd1Ones;\ while (bits)\ bits >>= 1, ++rotation;\ if (++rotation >= nDims)\ rotation -= nDims;\ } while (0) #define ones(T, k)\ ((((T)2) << (k-1)) - 1) #define rdbit(w, k)\ (((w) >> (k)) & 1) #define rotateRight(arg, nRots, nDims)\ ((((arg) >> (nRots)) | ((arg) << ((nDims)-(nRots)))) & ones(Bitmask, nDims)) #define rotateLeft(arg, nRots, nDims)\ ((((arg) << (nRots)) | ((arg) >> ((nDims)-(nRots)))) & ones(Bitmask, nDims)) #define DLOGB_BIT_TRANSPOSE template template Bitmask Curve::BitTranspose(Bitmask inCoords) #if defined(DLOGB_BIT_TRANSPOSE) { size_t const nDims1 = iDims-1; size_t inB = iBits; size_t utB; Bitmask inFieldEnds = 1; Bitmask inMask = ones(Bitmask, inB); Bitmask coords = 0; while ((utB = inB / 2) != 0) { size_t const shiftAmt = nDims1 * utB; Bitmask const utFieldEnds = inFieldEnds | (inFieldEnds << (shiftAmt+utB)); Bitmask const utMask = (utFieldEnds << utB) - utFieldEnds; Bitmask utCoords = 0; size_t d; if (inB & 1) { Bitmask const inFieldStarts = inFieldEnds << (inB-1); size_t oddShift = 2*shiftAmt; for (d = 0; d < iDims; ++d) { Bitmask in = inCoords & inMask; inCoords >>= inB; coords |= (in & inFieldStarts) << oddShift++; in &= ~inFieldStarts; in = (in | (in << shiftAmt)) & utMask; utCoords |= in << (d*utB); } } else { for (d = 0; d < iDims; ++d) { Bitmask in = inCoords & inMask; inCoords >>= inB; in = (in | (in << shiftAmt)) & utMask; utCoords |= in << (d*utB); } } inCoords = utCoords; inB = utB; inFieldEnds = utFieldEnds; inMask = utMask; } coords |= inCoords; return coords; } #else { Bitmask coords = 0; size_t d; for (d = 0; d < iDims; ++d) { size_t b; Bitmask in = inCoords & ones(Bitmask, iBits); Bitmask out = 0; inCoords >>= iBits; for (b = iBits; b--;) { out <<= iDims; out |= rdbit(in, b); } coords |= out << d; } return coords; } #endif template void Curve::Decode( typename Curve::Index index, typename Curve::Point& point ) { static_assert(std::is_unsigned::value, "Bitmask must be an unsigned type"); static_assert(std::is_unsigned::value, "Halfmask must be an unsigned type"); static_assert(nDims * nBits <= sizeof(Bitmask) * 8, "Bitmask of insufficient size"); static_assert(sizeof(Bitmask) <= sizeof(Halfmask) * 2, "Halfmask must be at least half the size of Bitmask"); if (nDims > 1) { Bitmask coords; Halfmask const nbOnes = ones(Halfmask, nBits); size_t d; if (nBits > 1) { size_t const nDimsBits = nDims * nBits; Halfmask const ndOnes = ones(Halfmask, nDims); Halfmask const nd1Ones= ndOnes >> 1; /* for adjust_rotation */ size_t b = nDimsBits; size_t rotation = 0; Halfmask flipBit = 0; Bitmask const nthbits = ones(Bitmask, nDimsBits) / ndOnes; index ^= (index ^ nthbits) >> 1; coords = 0; do { Halfmask bits = (index >> (b-=nDims)) & ndOnes; coords <<= nDims; coords |= rotateLeft(bits, rotation, nDims) ^ flipBit; flipBit = (Halfmask)1 << rotation; adjustRotation(rotation, nDims, bits); } while (b); for (b = nDims; b < nDimsBits; b *= 2) coords ^= coords >> b; coords = BitTranspose(coords); // we need to swap nBits and nDims here for decoding! } else coords = index ^ (index >> 1); for (d = 0; d < nDims; ++d) { point[d] = coords & nbOnes; coords >>= nBits; } } else point[0] = index; } template typename Curve::Index Curve::Encode( typename Curve::Point const& point ) { static_assert(std::is_unsigned::value, "Bitmask must be an unsigned type"); static_assert(std::is_unsigned::value, "Halfmask must be an unsigned type"); static_assert(nDims * nBits <= sizeof(Bitmask) * 8, "Bitmask of insufficient size"); static_assert(sizeof(Bitmask) <= sizeof(Halfmask) * 2, "Halfmask must be at least half the size of Bitmask"); if (nDims > 1) { size_t const nDimsBits = nDims * nBits; Bitmask index; size_t d; Bitmask coords = 0; for (d = nDims; d--;) { coords <<= nBits; coords |= point[d]; } if (nBits > 1) { Halfmask const ndOnes = ones(Halfmask, nDims); Halfmask const nd1Ones= ndOnes >> 1; /* for adjust_rotation */ size_t b = nDimsBits; size_t rotation = 0; Halfmask flipBit = 0; Bitmask const nthbits = ones(Bitmask, nDimsBits) / ndOnes; coords = BitTranspose(coords); coords ^= coords >> nDims; index = 0; do { Halfmask bits = (coords >> (b-=nDims)) & ndOnes; bits = rotateRight(flipBit ^ bits, rotation, nDims); index <<= nDims; index |= bits; flipBit = (Halfmask)1 << rotation; adjustRotation(rotation, nDims, bits); } while (b); index ^= nthbits >> 1; } else index = coords; for (d = 1; d < nDimsBits; d *= 2) index ^= index >> d; return index; } else return point[0]; } template<> void Decode(size_t nBits, uint16_t index, std::array& point) { switch (nBits) { case 0: point.fill(0); break; case 1: Curve<2, 1, uint16_t, uint8_t>::Decode(index, point); break; case 2: Curve<2, 2, uint16_t, uint8_t>::Decode(index, point); break; case 3: Curve<2, 3, uint16_t, uint8_t>::Decode(index, point); break; case 4: Curve<2, 4, uint16_t, uint8_t>::Decode(index, point); break; case 5: Curve<2, 5, uint16_t, uint8_t>::Decode(index, point); break; case 6: Curve<2, 6, uint16_t, uint8_t>::Decode(index, point); break; case 7: Curve<2, 7, uint16_t, uint8_t>::Decode(index, point); break; case 8: Curve<2, 8, uint16_t, uint8_t>::Decode(index, point); break; default: assert(false); break; } } template<> uint16_t Encode(size_t nBits, std::array const& point) { switch (nBits) { case 0: return 0; case 1: return Curve<2, 1, uint16_t, uint8_t>::Encode(point); case 2: return Curve<2, 2, uint16_t, uint8_t>::Encode(point); case 3: return Curve<2, 3, uint16_t, uint8_t>::Encode(point); case 4: return Curve<2, 4, uint16_t, uint8_t>::Encode(point); case 5: return Curve<2, 5, uint16_t, uint8_t>::Encode(point); case 6: return Curve<2, 6, uint16_t, uint8_t>::Encode(point); case 7: return Curve<2, 7, uint16_t, uint8_t>::Encode(point); case 8: return Curve<2, 8, uint16_t, uint8_t>::Encode(point); default: assert(false); break; } return 0; } template<> void Decode(size_t nBits, uint32_t index, std::array& point) { switch (nBits) { case 0: point.fill(0); break; case 1: Curve<2, 1, uint32_t, uint16_t>::Decode(index, point); break; case 2: Curve<2, 2, uint32_t, uint16_t>::Decode(index, point); break; case 3: Curve<2, 3, uint32_t, uint16_t>::Decode(index, point); break; case 4: Curve<2, 4, uint32_t, uint16_t>::Decode(index, point); break; case 5: Curve<2, 5, uint32_t, uint16_t>::Decode(index, point); break; case 6: Curve<2, 6, uint32_t, uint16_t>::Decode(index, point); break; case 7: Curve<2, 7, uint32_t, uint16_t>::Decode(index, point); break; case 8: Curve<2, 8, uint32_t, uint16_t>::Decode(index, point); break; case 9: Curve<2, 9, uint32_t, uint16_t>::Decode(index, point); break; case 10: Curve<2, 10, uint32_t, uint16_t>::Decode(index, point); break; case 11: Curve<2, 11, uint32_t, uint16_t>::Decode(index, point); break; case 12: Curve<2, 12, uint32_t, uint16_t>::Decode(index, point); break; case 13: Curve<2, 13, uint32_t, uint16_t>::Decode(index, point); break; case 14: Curve<2, 14, uint32_t, uint16_t>::Decode(index, point); break; case 15: Curve<2, 15, uint32_t, uint16_t>::Decode(index, point); break; case 16: Curve<2, 16, uint32_t, uint16_t>::Decode(index, point); break; default: assert(false); break; } } template<> uint32_t Encode(size_t nBits, std::array const& point) { switch (nBits) { case 0: return 0; case 1: return Curve<2, 1, uint32_t, uint16_t>::Encode(point); case 2: return Curve<2, 2, uint32_t, uint16_t>::Encode(point); case 3: return Curve<2, 3, uint32_t, uint16_t>::Encode(point); case 4: return Curve<2, 4, uint32_t, uint16_t>::Encode(point); case 5: return Curve<2, 5, uint32_t, uint16_t>::Encode(point); case 6: return Curve<2, 6, uint32_t, uint16_t>::Encode(point); case 7: return Curve<2, 7, uint32_t, uint16_t>::Encode(point); case 8: return Curve<2, 8, uint32_t, uint16_t>::Encode(point); case 9: return Curve<2, 9, uint32_t, uint16_t>::Encode(point); case 10: return Curve<2, 10, uint32_t, uint16_t>::Encode(point); case 11: return Curve<2, 11, uint32_t, uint16_t>::Encode(point); case 12: return Curve<2, 12, uint32_t, uint16_t>::Encode(point); case 13: return Curve<2, 13, uint32_t, uint16_t>::Encode(point); case 14: return Curve<2, 14, uint32_t, uint16_t>::Encode(point); case 15: return Curve<2, 15, uint32_t, uint16_t>::Encode(point); case 16: return Curve<2, 16, uint32_t, uint16_t>::Encode(point); default: assert(false); break; } return 0; } template<> void Decode(size_t nBits, uint64_t index, std::array& point) { switch (nBits) { case 0: point.fill(0); break; case 1: Curve<2, 1, uint64_t, uint32_t>::Decode(index, point); break; case 2: Curve<2, 2, uint64_t, uint32_t>::Decode(index, point); break; case 3: Curve<2, 3, uint64_t, uint32_t>::Decode(index, point); break; case 4: Curve<2, 4, uint64_t, uint32_t>::Decode(index, point); break; case 5: Curve<2, 5, uint64_t, uint32_t>::Decode(index, point); break; case 6: Curve<2, 6, uint64_t, uint32_t>::Decode(index, point); break; case 7: Curve<2, 7, uint64_t, uint32_t>::Decode(index, point); break; case 8: Curve<2, 8, uint64_t, uint32_t>::Decode(index, point); break; case 9: Curve<2, 9, uint64_t, uint32_t>::Decode(index, point); break; case 10: Curve<2, 10, uint64_t, uint32_t>::Decode(index, point); break; case 11: Curve<2, 11, uint64_t, uint32_t>::Decode(index, point); break; case 12: Curve<2, 12, uint64_t, uint32_t>::Decode(index, point); break; case 13: Curve<2, 13, uint64_t, uint32_t>::Decode(index, point); break; case 14: Curve<2, 14, uint64_t, uint32_t>::Decode(index, point); break; case 15: Curve<2, 15, uint64_t, uint32_t>::Decode(index, point); break; case 16: Curve<2, 16, uint64_t, uint32_t>::Decode(index, point); break; case 17: Curve<2, 17, uint64_t, uint32_t>::Decode(index, point); break; case 18: Curve<2, 18, uint64_t, uint32_t>::Decode(index, point); break; case 19: Curve<2, 19, uint64_t, uint32_t>::Decode(index, point); break; case 20: Curve<2, 20, uint64_t, uint32_t>::Decode(index, point); break; case 21: Curve<2, 21, uint64_t, uint32_t>::Decode(index, point); break; case 22: Curve<2, 22, uint64_t, uint32_t>::Decode(index, point); break; case 23: Curve<2, 23, uint64_t, uint32_t>::Decode(index, point); break; case 24: Curve<2, 24, uint64_t, uint32_t>::Decode(index, point); break; case 25: Curve<2, 25, uint64_t, uint32_t>::Decode(index, point); break; case 26: Curve<2, 26, uint64_t, uint32_t>::Decode(index, point); break; case 27: Curve<2, 27, uint64_t, uint32_t>::Decode(index, point); break; case 28: Curve<2, 28, uint64_t, uint32_t>::Decode(index, point); break; case 29: Curve<2, 29, uint64_t, uint32_t>::Decode(index, point); break; case 30: Curve<2, 30, uint64_t, uint32_t>::Decode(index, point); break; case 31: Curve<2, 31, uint64_t, uint32_t>::Decode(index, point); break; case 32: Curve<2, 32, uint64_t, uint32_t>::Decode(index, point); break; default: assert(false); break; } } template<> uint64_t Encode(size_t nBits, std::array const& point) { switch (nBits) { case 0: return 0; case 1: return Curve<2, 1, uint64_t, uint32_t>::Encode(point); case 2: return Curve<2, 2, uint64_t, uint32_t>::Encode(point); case 3: return Curve<2, 3, uint64_t, uint32_t>::Encode(point); case 4: return Curve<2, 4, uint64_t, uint32_t>::Encode(point); case 5: return Curve<2, 5, uint64_t, uint32_t>::Encode(point); case 6: return Curve<2, 6, uint64_t, uint32_t>::Encode(point); case 7: return Curve<2, 7, uint64_t, uint32_t>::Encode(point); case 8: return Curve<2, 8, uint64_t, uint32_t>::Encode(point); case 9: return Curve<2, 9, uint64_t, uint32_t>::Encode(point); case 10: return Curve<2, 10, uint64_t, uint32_t>::Encode(point); case 11: return Curve<2, 11, uint64_t, uint32_t>::Encode(point); case 12: return Curve<2, 12, uint64_t, uint32_t>::Encode(point); case 13: return Curve<2, 13, uint64_t, uint32_t>::Encode(point); case 14: return Curve<2, 14, uint64_t, uint32_t>::Encode(point); case 15: return Curve<2, 15, uint64_t, uint32_t>::Encode(point); case 16: return Curve<2, 16, uint64_t, uint32_t>::Encode(point); case 17: return Curve<2, 17, uint64_t, uint32_t>::Encode(point); case 18: return Curve<2, 18, uint64_t, uint32_t>::Encode(point); case 19: return Curve<2, 19, uint64_t, uint32_t>::Encode(point); case 20: return Curve<2, 20, uint64_t, uint32_t>::Encode(point); case 21: return Curve<2, 21, uint64_t, uint32_t>::Encode(point); case 22: return Curve<2, 22, uint64_t, uint32_t>::Encode(point); case 23: return Curve<2, 23, uint64_t, uint32_t>::Encode(point); case 24: return Curve<2, 24, uint64_t, uint32_t>::Encode(point); case 25: return Curve<2, 25, uint64_t, uint32_t>::Encode(point); case 26: return Curve<2, 26, uint64_t, uint32_t>::Encode(point); case 27: return Curve<2, 27, uint64_t, uint32_t>::Encode(point); case 28: return Curve<2, 28, uint64_t, uint32_t>::Encode(point); case 29: return Curve<2, 29, uint64_t, uint32_t>::Encode(point); case 30: return Curve<2, 30, uint64_t, uint32_t>::Encode(point); case 31: return Curve<2, 31, uint64_t, uint32_t>::Encode(point); case 32: return Curve<2, 32, uint64_t, uint32_t>::Encode(point); default: assert(false); break; } return 0; } template<> void Decode(size_t nBits, uint16_t index, std::array& point) { switch (nBits) { case 0: point.fill(0); break; case 1: Curve<3, 1, uint16_t, uint8_t>::Decode(index, point); break; case 2: Curve<3, 2, uint16_t, uint8_t>::Decode(index, point); break; case 3: Curve<3, 3, uint16_t, uint8_t>::Decode(index, point); break; case 4: Curve<3, 4, uint16_t, uint8_t>::Decode(index, point); break; case 5: Curve<3, 5, uint16_t, uint8_t>::Decode(index, point); break; default: assert(false); break; } } template<> uint16_t Encode(size_t nBits, std::array const& point) { switch (nBits) { case 0: return 0; case 1: return Curve<3, 1, uint16_t, uint8_t>::Encode(point); case 2: return Curve<3, 2, uint16_t, uint8_t>::Encode(point); case 3: return Curve<3, 3, uint16_t, uint8_t>::Encode(point); case 4: return Curve<3, 4, uint16_t, uint8_t>::Encode(point); case 5: return Curve<3, 5, uint16_t, uint8_t>::Encode(point); default: assert(false); break; } return 0; } template<> void Decode(size_t nBits, uint32_t index, std::array& point) { switch (nBits) { case 0: point.fill(0); break; case 1: Curve<3, 1, uint32_t, uint16_t>::Decode(index, point); break; case 2: Curve<3, 2, uint32_t, uint16_t>::Decode(index, point); break; case 3: Curve<3, 3, uint32_t, uint16_t>::Decode(index, point); break; case 4: Curve<3, 4, uint32_t, uint16_t>::Decode(index, point); break; case 5: Curve<3, 5, uint32_t, uint16_t>::Decode(index, point); break; case 6: Curve<3, 6, uint32_t, uint16_t>::Decode(index, point); break; case 7: Curve<3, 7, uint32_t, uint16_t>::Decode(index, point); break; case 8: Curve<3, 8, uint32_t, uint16_t>::Decode(index, point); break; case 9: Curve<3, 9, uint32_t, uint16_t>::Decode(index, point); break; case 10: Curve<3, 10, uint32_t, uint16_t>::Decode(index, point); break; default: assert(false); break; } } template<> uint32_t Encode(size_t nBits, std::array const& point) { switch (nBits) { case 0: return 0; case 1: return Curve<3, 1, uint32_t, uint16_t>::Encode(point); case 2: return Curve<3, 2, uint32_t, uint16_t>::Encode(point); case 3: return Curve<3, 3, uint32_t, uint16_t>::Encode(point); case 4: return Curve<3, 4, uint32_t, uint16_t>::Encode(point); case 5: return Curve<3, 5, uint32_t, uint16_t>::Encode(point); case 6: return Curve<3, 6, uint32_t, uint16_t>::Encode(point); case 7: return Curve<3, 7, uint32_t, uint16_t>::Encode(point); case 8: return Curve<3, 8, uint32_t, uint16_t>::Encode(point); case 9: return Curve<3, 9, uint32_t, uint16_t>::Encode(point); case 10: return Curve<3, 10, uint32_t, uint16_t>::Encode(point); default: assert(false); break; } return 0; } template<> void Decode(size_t nBits, uint64_t index, std::array& point) { switch (nBits) { case 0: point.fill(0); break; case 1: Curve<3, 1, uint64_t, uint32_t>::Decode(index, point); break; case 2: Curve<3, 2, uint64_t, uint32_t>::Decode(index, point); break; case 3: Curve<3, 3, uint64_t, uint32_t>::Decode(index, point); break; case 4: Curve<3, 4, uint64_t, uint32_t>::Decode(index, point); break; case 5: Curve<3, 5, uint64_t, uint32_t>::Decode(index, point); break; case 6: Curve<3, 6, uint64_t, uint32_t>::Decode(index, point); break; case 7: Curve<3, 7, uint64_t, uint32_t>::Decode(index, point); break; case 8: Curve<3, 8, uint64_t, uint32_t>::Decode(index, point); break; case 9: Curve<3, 9, uint64_t, uint32_t>::Decode(index, point); break; case 10: Curve<3, 10, uint64_t, uint32_t>::Decode(index, point); break; case 11: Curve<3, 11, uint64_t, uint32_t>::Decode(index, point); break; case 12: Curve<3, 12, uint64_t, uint32_t>::Decode(index, point); break; case 13: Curve<3, 13, uint64_t, uint32_t>::Decode(index, point); break; case 14: Curve<3, 14, uint64_t, uint32_t>::Decode(index, point); break; case 15: Curve<3, 15, uint64_t, uint32_t>::Decode(index, point); break; case 16: Curve<3, 16, uint64_t, uint32_t>::Decode(index, point); break; case 17: Curve<3, 17, uint64_t, uint32_t>::Decode(index, point); break; case 18: Curve<3, 18, uint64_t, uint32_t>::Decode(index, point); break; case 19: Curve<3, 19, uint64_t, uint32_t>::Decode(index, point); break; case 20: Curve<3, 20, uint64_t, uint32_t>::Decode(index, point); break; case 21: Curve<3, 21, uint64_t, uint32_t>::Decode(index, point); break; default: assert(false); break; } } template<> uint64_t Encode(size_t nBits, std::array const& point) { switch (nBits) { case 0: return 0; case 1: return Curve<3, 1, uint64_t, uint32_t>::Encode(point); case 2: return Curve<3, 2, uint64_t, uint32_t>::Encode(point); case 3: return Curve<3, 3, uint64_t, uint32_t>::Encode(point); case 4: return Curve<3, 4, uint64_t, uint32_t>::Encode(point); case 5: return Curve<3, 5, uint64_t, uint32_t>::Encode(point); case 6: return Curve<3, 6, uint64_t, uint32_t>::Encode(point); case 7: return Curve<3, 7, uint64_t, uint32_t>::Encode(point); case 8: return Curve<3, 8, uint64_t, uint32_t>::Encode(point); case 9: return Curve<3, 9, uint64_t, uint32_t>::Encode(point); case 10: return Curve<3, 10, uint64_t, uint32_t>::Encode(point); case 11: return Curve<3, 11, uint64_t, uint32_t>::Encode(point); case 12: return Curve<3, 12, uint64_t, uint32_t>::Encode(point); case 13: return Curve<3, 13, uint64_t, uint32_t>::Encode(point); case 14: return Curve<3, 14, uint64_t, uint32_t>::Encode(point); case 15: return Curve<3, 15, uint64_t, uint32_t>::Encode(point); case 16: return Curve<3, 16, uint64_t, uint32_t>::Encode(point); case 17: return Curve<3, 17, uint64_t, uint32_t>::Encode(point); case 18: return Curve<3, 18, uint64_t, uint32_t>::Encode(point); case 19: return Curve<3, 19, uint64_t, uint32_t>::Encode(point); case 20: return Curve<3, 20, uint64_t, uint32_t>::Encode(point); case 21: return Curve<3, 21, uint64_t, uint32_t>::Encode(point); default: assert(false); break; } return 0; } #ifdef WIN32 #pragma warning(default:4146) #endifImageVis3D-3.1.0/Tuvok/IO/UVF/ExtendedOctree/BzlibCompression.h0000644000175000017500000000433212320456500023675 0ustar mathieumathieu#ifndef UVF_BZLIB_COMPRESSION_H #define UVF_BZLIB_COMPRESSION_H #include #include /** Decompresses data into 'dst'. @param src the data to decompress @param compressedBytes number of bytes available and valid in 'src' @param dst the output buffer @param uncompressedBytes number of bytes available and expected in 'dst' @throws std::runtime_error if something fails */ void bzDecompress(std::shared_ptr src, size_t compressedBytes, std::shared_ptr& dst, size_t uncompressedBytes); /** Compresses data into 'dst' using Bzlib. @param src the data to compress @param uncompressedBytes number of bytes in 'src' @param dst the output buffer that will be created of the same size as 'src' @param compressionLevel between 1..9 @return the number of bytes in the compressed data @throws std::runtime_error if something fails */ size_t bzCompress(std::shared_ptr src, size_t uncompressedBytes, std::shared_ptr& dst, uint32_t compressionLevel = 1); #endif /* UVF_BZLIB_COMPRESSION_H */ /* The MIT License Copyright (c) 2011 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/UVF/ExtendedOctree/ExtendedOctreeConverter.inc0000644000175000017500000004233412320456500025531 0ustar mathieumathieutemplate void ExtendedOctreeConverter::DownsampleBricktoBrick( ExtendedOctree &tree, T* pData, const UINT64VECTOR3& targetSize, T* pSourceData, const UINT64VECTOR4& sourceCoords, const UINT64VECTOR3& targetOffset) { uint64_t iCompCount = tree.m_iComponentCount; const UINT64VECTOR3& sourceSize = tree.ComputeBrickSize(sourceCoords); GetBrick((uint8_t*)pSourceData, tree, sourceCoords); const uint64_t evenSizeX = (sourceSize.x-2*m_iOverlap)/2; const uint64_t evenSizeY = (sourceSize.y-2*m_iOverlap)/2; const uint64_t evenSizeZ = (sourceSize.z-2*m_iOverlap)/2; // process inner even-sized area for (uint64_t z = 0;z( *(p0+c), *(p1+c), *(p2+c), *(p3+c), *(p4+c), *(p5+c), *(p6+c), *(p7+c)); *(pTargetData+c) = filtered; } p0+=2*iCompCount; p1+=2*iCompCount; p2+=2*iCompCount; p3+=2*iCompCount; p4+=2*iCompCount; p5+=2*iCompCount; p6+=2*iCompCount; p7+=2*iCompCount; pTargetData+=iCompCount; } } } // process odd boundaries (if any) // plane at the end of the x-axis if (sourceSize.x%2) { for (uint64_t z = 0;z( *(p0+c), *(p1+c), *(p2+c), *(p3+c) ); *(pTargetData+c) = filtered; } } } } // plane at the end of the y-axis if (sourceSize.y%2) { for (uint64_t z = 0;z( *(p0+c), *(p1+c), *(p4+c), *(p5+c) ); *(pTargetData+c) = filtered; } p0+=2*iCompCount; p1+=2*iCompCount; p4+=2*iCompCount; p5+=2*iCompCount; pTargetData+=iCompCount; } } } // plane at the end of the z-axis if (sourceSize.z%2) { for (uint64_t y = 0;y( *(p0+c), *(p2+c), *(p4+c), *(p6+c) ); *(pTargetData+c) = filtered; } p0+=2*iCompCount; p2+=2*iCompCount; p4+=2*iCompCount; p6+=2*iCompCount; pTargetData+=iCompCount; } } } // line at the end of the x/y-axes if (sourceSize.x%2 && sourceSize.y%2) { for (uint64_t z = 0;z( *(p0+c), *(p1+c) ); *(pTargetData+c) = filtered; } } } // line at the end of the y/z-axes if (sourceSize.y%2 && sourceSize.z%2) { T *p0 = pSourceData + iCompCount* ( (2*0+m_iOverlap) + (2*(evenSizeY)+m_iOverlap)*sourceSize.x + (2*(evenSizeZ)+m_iOverlap)*sourceSize.x*sourceSize.y ); T *p4 = p0+iCompCount; T* pTargetData = pData + iCompCount * ( (0+m_iOverlap + targetOffset.x) + (evenSizeY+m_iOverlap+targetOffset.y)*targetSize.x + (evenSizeZ+m_iOverlap+targetOffset.z)*targetSize.x*targetSize.y ); for (uint64_t x = 0;x( *(p0+c), *(p4+c)); *(pTargetData+c) = filtered; } p0+=2*iCompCount; p4+=2*iCompCount; pTargetData+=iCompCount; } } // line at the end of the x/z-axes if (sourceSize.x%2 && sourceSize.z%2) { for (uint64_t y = 0;y( *(p0+c), *(p2+c) ); *(pTargetData+c) = filtered; } } } // single voxel at the x/y/z corner if (sourceSize.x%2 && sourceSize.y%2 && sourceSize.z%2) { T *p0 = pSourceData + iCompCount* ( (2*(evenSizeX)+m_iOverlap) + (2*(evenSizeY)+m_iOverlap)*sourceSize.x + (2*(evenSizeZ)+m_iOverlap)*sourceSize.x*sourceSize.y ); T* pTargetData = pData + iCompCount * ( (evenSizeX+m_iOverlap + targetOffset.x) + (evenSizeY+m_iOverlap+targetOffset.y)*targetSize.x + (evenSizeZ+m_iOverlap+targetOffset.z)*targetSize.x*targetSize.y ); for (uint32_t c = 0;c void ExtendedOctreeConverter::DownsampleBrick( ExtendedOctree &tree, bool bClampToEdge, const UINT64VECTOR4& vBrickCoords, T* pData, T* pSourceData) { const UINT64VECTOR3& vTargetBricksize = tree.ComputeBrickSize(vBrickCoords); const uint64_t iUncompressedBrickSize = vTargetBricksize.volume() * tree.GetComponentTypeSize() * tree.GetComponentCount(); if (!bClampToEdge) { memset(pData,0,size_t(iUncompressedBrickSize)); } const TOCEntry t = { (tree.m_vTOC.end()-1)->m_iLength + (tree.m_vTOC.end()-1)->m_iOffset, iUncompressedBrickSize, CT_NONE, iUncompressedBrickSize, UINTVECTOR2(0,0) }; tree.m_vTOC.push_back(t); const UINT64VECTOR4 bricksInLowerLevel = tree.GetBrickCount(vBrickCoords.w-1); const bool bHasBrickRight = vBrickCoords.x*2+1 < bricksInLowerLevel.x; const bool bHasBrickBottom = vBrickCoords.y*2+1 < bricksInLowerLevel.y; const bool bHasBrickBack = vBrickCoords.z*2+1 < bricksInLowerLevel.z; const UINT64VECTOR3 splitPos( uint64_t(ceil((tree.m_iBrickSize.x-2*m_iOverlap)/2.0)), uint64_t(ceil((tree.m_iBrickSize.y-2*m_iOverlap)/2.0)), uint64_t(ceil((tree.m_iBrickSize.z-2*m_iOverlap)/2.0)) ); // read up to eight bricks and filter them into the one brick UINT64VECTOR4 sourceIndex(vBrickCoords.x*2, vBrickCoords.y*2, vBrickCoords.z*2, vBrickCoords.w-1); UINT64VECTOR3 targetOffset(0,0,0); DownsampleBricktoBrick(tree, pData, vTargetBricksize, pSourceData, sourceIndex, targetOffset); if (bHasBrickRight) { sourceIndex = UINT64VECTOR4(vBrickCoords.x*2+1, vBrickCoords.y*2, vBrickCoords.z*2, vBrickCoords.w-1); targetOffset = UINT64VECTOR3(splitPos.x,0,0); DownsampleBricktoBrick(tree, pData, vTargetBricksize, pSourceData, sourceIndex, targetOffset); } if (bHasBrickBottom) { sourceIndex = UINT64VECTOR4(vBrickCoords.x*2, vBrickCoords.y*2+1, vBrickCoords.z*2, vBrickCoords.w-1); targetOffset = UINT64VECTOR3(0,splitPos.y,0); DownsampleBricktoBrick(tree, pData, vTargetBricksize, pSourceData, sourceIndex, targetOffset); } if (bHasBrickBack) { sourceIndex = UINT64VECTOR4(vBrickCoords.x*2, vBrickCoords.y*2, vBrickCoords.z*2+1, vBrickCoords.w-1); targetOffset = UINT64VECTOR3(0,0,splitPos.z); DownsampleBricktoBrick(tree, pData, vTargetBricksize, pSourceData, sourceIndex, targetOffset); } if (bHasBrickRight && bHasBrickBottom) { sourceIndex = UINT64VECTOR4(vBrickCoords.x*2+1, vBrickCoords.y*2+1, vBrickCoords.z*2, vBrickCoords.w-1); targetOffset = UINT64VECTOR3(splitPos.x,splitPos.y,0); DownsampleBricktoBrick(tree, pData, vTargetBricksize, pSourceData, sourceIndex, targetOffset); } if (bHasBrickRight && bHasBrickBack) { sourceIndex = UINT64VECTOR4(vBrickCoords.x*2+1, vBrickCoords.y*2, vBrickCoords.z*2+1, vBrickCoords.w-1); targetOffset = UINT64VECTOR3(splitPos.x,0,splitPos.z); DownsampleBricktoBrick(tree, pData, vTargetBricksize, pSourceData, sourceIndex, targetOffset); } if (bHasBrickBottom && bHasBrickBack) { sourceIndex = UINT64VECTOR4(vBrickCoords.x*2, vBrickCoords.y*2+1, vBrickCoords.z*2+1, vBrickCoords.w-1); targetOffset = UINT64VECTOR3(0,splitPos.y,splitPos.z); DownsampleBricktoBrick(tree, pData, vTargetBricksize, pSourceData, sourceIndex, targetOffset); } if (bHasBrickRight && bHasBrickBottom && bHasBrickBack) { sourceIndex = UINT64VECTOR4(vBrickCoords.x*2+1, vBrickCoords.y*2+1, vBrickCoords.z*2+1, vBrickCoords.w-1); targetOffset = splitPos; DownsampleBricktoBrick(tree, pData, vTargetBricksize, pSourceData, sourceIndex, targetOffset); } SetBrick((uint8_t*)pData, tree, vBrickCoords); } template void ExtendedOctreeConverter::ComputeHierarchy(ExtendedOctree &tree, bool bClampToEdge) { // if the conversion to size_t actually clamps things, this code is b0rked. assert(static_cast(static_cast(tree.m_iBrickSize.volume() * tree.m_iComponentCount)) == tree.m_iBrickSize.volume() * tree.m_iComponentCount && "conversion to size_t changes data value; brick too large."); // total number of bricks we'll iterate over. start at 1, not 0, because // we're not going to "compute" the lowest level. uint64_t n_bricks = 0; for(size_t i=1; i < tree.GetLODCount(); ++i) { n_bricks += tree.GetBrickCount(i).volume(); } T* pTempDataSource = new T[size_t(tree.m_iBrickSize.volume() * tree.m_iComponentCount)]; T* pTempDataTarget = new T[size_t(tree.m_iBrickSize.volume() * tree.m_iComponentCount)]; uint64_t bricks_processed = 0; for (size_t LoD = 1;LoD(tree, bClampToEdge, UINT64VECTOR4(x,y,z, LoD), pTempDataSource, pTempDataTarget); ++bricks_processed; } m_fProgress = MathTools::lerp(float(bricks_processed) / n_bricks, 0.0f,1.0f, 0.4f,0.8f); PROGRESS; } } // fill overlaps in this LoD FillOverlap(tree, LoD, bClampToEdge); } delete [] pTempDataSource; delete [] pTempDataTarget; } /// Computes per-brick metadata information. /// @param pData the brick data /// @param iLength number of *bytes* in the brick (not elems!) /// @param iComponentCount components in the brick data /// @returns vector of metadata, one entry per component /// Multiple components are assumed to be tightly packed; if we have two /// components and the first is all 0's, the second all 1's, then the data /// layout should be 01010101 ... etc. template BrickStatVec ExtendedOctreeConverter::ComputeBrickStats(const uint8_t* pData, uint64_t iLength, size_t iComponentCount) { const BrickStats init(std::numeric_limits::max(), -std::numeric_limits::max()); BrickStatVec minmax(iComponentCount, init); const size_t iElemCount = size_t(iLength / sizeof(T)); // if there are fewer elements in the data than there are components, // something is seriously wrong. Short read earlier in the pipeline? assert(iElemCount >= iComponentCount); // crash for devs, if(iElemCount < iComponentCount) { // bail for release builds. return minmax; } const T* pElements = reinterpret_cast(pData); // Here's the actual computation. We iterate over every datum in the brick, // and check to see if it gives us a better min/max than what we already // have. for (size_t i=0 ; i < iElemCount; i += iComponentCount) { // each datum for (size_t c=0; c < iComponentCount; ++c) { // each component // yes, I want this to use std::min/max too, but copious benchmarking // shows this to be faster, and this is an important part of the code. // feel free to re-benchmark and update as you see fit. const double cur = static_cast(*(pElements + i + c)); minmax[c].minScalar = cur < minmax[c].minScalar ? cur : minmax[c].minScalar ; minmax[c].maxScalar = cur > minmax[c].maxScalar ? cur : minmax[c].maxScalar; } } return minmax; } ImageVis3D-3.1.0/Tuvok/IO/UVF/ExtendedOctree/ExtendedOctree.cpp0000644000175000017500000005163212320456500023653 0ustar mathieumathieu/* The MIT License Copyright (c) 2011 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include "ExtendedOctree.h" #include "Basics/nonstd.h" #include "Basics/Timer.h" #include "Controller/Controller.h" #include "Controller/StackTimer.h" #include "ZlibCompression.h" #include "LzmaCompression.h" #include "Lz4Compression.h" #include "BzlibCompression.h" #include "LzhamCompression.h" ExtendedOctree::ExtendedOctree() : m_eComponentType(CT_UINT8), m_iComponentCount(0), m_bPrecomputedNormals(false), m_vVolumeSize(0,0,0), m_vVolumeAspect(0,0,0), m_iBrickSize(0,0,0), m_iOverlap(0), m_iVersion(2), // increment version number here if something changes... m_iSize(0), m_iCompressionLevel(4), // our default level for LZMA, it's fast and still compresses well m_iOffset(0), m_pLargeRAWFile() {} void ExtendedOctree::InitLzmaCompression() { try { lzmaProperties(m_lzmaProps, m_iCompressionLevel); } catch (std::exception const&) { assert("could not init LZMA compression properties" && false); throw; } } /* Open (string): Convenience function that calls the open below with a large raw file constructed from the given string */ bool ExtendedOctree::Open(std::string filename, uint64_t iOffset, uint64_t iUVFFileVersion) { LargeRAWFile_ptr inFile(new LargeRAWFile(filename)); if (!inFile->Open()) { return false; } return Open(inFile, iOffset, iUVFFileVersion); } /* Open (largeRawFile): Reads the header from and computes derived metadata. The header can be split into two sections. First, the basic header with with global such as the size of the original volume, the aspect ratio, the maximum brick size, and overlap. Second, the table of contents (ToC) which contains per brick information about their sizes, compression methods and offsets in the file. After reading the global information about the level of detail, it can be computed. */ bool ExtendedOctree::Open(LargeRAWFile_ptr pLargeRAWFile, uint64_t iOffset, uint64_t iUVFFileVersion) { if (!pLargeRAWFile->IsOpen()) return false; m_pLargeRAWFile = pLargeRAWFile; m_iOffset = iOffset; const bool isBE = EndianConvert::IsBigEndian(); // load global header m_pLargeRAWFile->SeekPos(m_iOffset); uint32_t comp; m_pLargeRAWFile->ReadData(comp, isBE); m_eComponentType = static_cast(comp); m_pLargeRAWFile->ReadData(m_iComponentCount, isBE); m_pLargeRAWFile->ReadData(m_bPrecomputedNormals, isBE); m_pLargeRAWFile->ReadData(m_vVolumeSize.x, isBE); m_pLargeRAWFile->ReadData(m_vVolumeSize.y, isBE); m_pLargeRAWFile->ReadData(m_vVolumeSize.z, isBE); m_pLargeRAWFile->ReadData(m_vVolumeAspect.x, isBE); m_pLargeRAWFile->ReadData(m_vVolumeAspect.y, isBE); m_pLargeRAWFile->ReadData(m_vVolumeAspect.z, isBE); m_pLargeRAWFile->ReadData(m_iBrickSize.x, isBE); m_pLargeRAWFile->ReadData(m_iBrickSize.y, isBE); m_pLargeRAWFile->ReadData(m_iBrickSize.z, isBE); m_pLargeRAWFile->ReadData(m_iOverlap, isBE); // UVF file version 5 introduced the version flag inside ExtendedOctree data if (iUVFFileVersion > 4) { m_pLargeRAWFile->ReadData(m_iVersion, isBE); assert(m_iVersion != 0); // doesn't make sense, probably means corrupt file if (m_iVersion == 0) return false; } else m_iVersion = 0; // version is not stored if (m_iVersion > 0) m_pLargeRAWFile->ReadData(m_iSize, isBE); if (m_iVersion > 1) m_pLargeRAWFile->ReadData(m_iCompressionLevel, isBE); // if any of the above numbers (except for the overlap) // is zero than there must have been an issue reading the file if (m_iComponentCount * m_vVolumeSize.volume() * m_vVolumeAspect.volume() * m_iBrickSize.volume() == 0) return false; // if the dataset is supposed to contain precomputed normals // it must have four components (data + 3D normal) if (m_bPrecomputedNormals && m_iComponentCount != 4) return false; // compute metadata ComputeMetadata(); uint64_t iOverallBrickCount = ComputeBrickCount(); // read brick TOC m_vTOC.resize(size_t(iOverallBrickCount)); if (m_iVersion > 0) { for (size_t i = 0;iReadData(m_vTOC[i].m_iOffset, isBE); m_pLargeRAWFile->ReadData(m_vTOC[i].m_iLength, isBE); uint32_t comp; m_pLargeRAWFile->ReadData(comp, isBE); m_vTOC[i].m_eCompression = static_cast(comp); m_pLargeRAWFile->ReadData(m_vTOC[i].m_iValidLength, isBE); m_pLargeRAWFile->ReadData(m_vTOC[i].m_iAtlasSize.x, isBE); m_pLargeRAWFile->ReadData(m_vTOC[i].m_iAtlasSize.y, isBE); } } else { uint64_t iLoDOffset = ComputeHeaderSize(); for (size_t i = 0;iReadData(m_vTOC[i].m_iLength, isBE); uint32_t comp; m_pLargeRAWFile->ReadData(comp, isBE); m_vTOC[i].m_eCompression = static_cast(comp); iLoDOffset += m_vTOC[i].m_iLength; } } return true; } /* Close: closes the underlying large raw file, after this call the Extended octree should not be used unless another open call is performed */ void ExtendedOctree::Close() { if ( m_pLargeRAWFile != LargeRAWFile_ptr()) m_pLargeRAWFile->Close(); } /* ComputeMetadata: This method computes all the metadata that is not directly stored in the file but can be derived from the global header. This is basically the size of each LoD level (from which we can compute the brick dimensions), the aspect ratio changes of each level, the brick count, and the brick offset. This offset (in bricks, not in bytes) describes were in the bricklist (ToC) the bricks for an LoD level are stored. */ void ExtendedOctree::ComputeMetadata() { // compute LOD metadata (except for the m_iLoDOffsets // which are computed afterwards) UINT64VECTOR3 vVolumeSize = m_vVolumeSize; DOUBLEVECTOR3 vAspect(1.0,1.0,1.0); assert(this->GetMaxBrickSize()[0] > (2*m_iOverlap)); assert(this->GetMaxBrickSize()[1] > (2*m_iOverlap)); assert(this->GetMaxBrickSize()[2] > (2*m_iOverlap)); const UINTVECTOR3 vUsableBrickSize = this->GetMaxBrickSize() - 2*m_iOverlap; do { LODInfo l; l.m_iLODPixelSize = vVolumeSize; // downsample the volume (except for the first LoD) if (!m_vLODTable.empty()) { if (vVolumeSize.x > 1) { l.m_iLODPixelSize.x = uint64_t(ceil(vVolumeSize.x/2.0)); vAspect.x *= (vVolumeSize.x%2) ? float(vVolumeSize.x)/float(l.m_iLODPixelSize.x) : 2; } if (vVolumeSize.y > 1) { l.m_iLODPixelSize.y = uint64_t(ceil(vVolumeSize.y/2.0)); vAspect.y *= (vVolumeSize.y%2) ? float(vVolumeSize.y)/float(l.m_iLODPixelSize.y) : 2; } if (vVolumeSize.z > 1) { l.m_iLODPixelSize.z = uint64_t(ceil(vVolumeSize.z/2.0)); vAspect.z *= (vVolumeSize.z%2) ? float(vVolumeSize.z)/float(l.m_iLODPixelSize.z) : 2; } vAspect /= vAspect.maxVal(); vVolumeSize = l.m_iLODPixelSize; } l.m_vAspect = vAspect; l.m_iLODBrickCount.x = uint64_t(ceil(vVolumeSize.x / double(vUsableBrickSize.x))); l.m_iLODBrickCount.y = uint64_t(ceil(vVolumeSize.y / double(vUsableBrickSize.y))); l.m_iLODBrickCount.z = uint64_t(ceil(vVolumeSize.z / double(vUsableBrickSize.z))); l.m_iLoDOffset = 0; // don't know it yet, but for now quiet a warning. m_vLODTable.push_back(l); } while (vVolumeSize.x > 1 || vVolumeSize.y > 1 || vVolumeSize.z > 1); // fill m_iLoDOffsets m_vLODTable[0].m_iLoDOffset = 0; for (size_t i = 1;i bIsLast = IsLastBrick(vBrickCoords); const UINT64VECTOR3 iPixelSize = m_vLODTable[size_t(vBrickCoords.w)].m_iLODPixelSize; const uint32_t i2Overlap = 2*m_iOverlap; const UINTVECTOR3 iBrickCore = this->GetMaxBrickSize() - i2Overlap; return UINT64VECTOR3(bIsLast.x && (iPixelSize.x % iBrickCore.x) ? (i2Overlap + (iPixelSize.x % iBrickCore.x)) : m_iBrickSize.x, bIsLast.y && (iPixelSize.y % iBrickCore.y) ? (i2Overlap + (iPixelSize.y % iBrickCore.y)) : m_iBrickSize.y, bIsLast.z && (iPixelSize.z % iBrickCore.z) ? (i2Overlap + (iPixelSize.z % iBrickCore.z)) : m_iBrickSize.z); } /* GetBrickAspect: the aspect ratio of the LoD (can be different from 1:1:1 due to anisotropic downsampling) */ DOUBLEVECTOR3 ExtendedOctree::GetBrickAspect(const UINT64VECTOR4& vBrickCoords) const { return m_vLODTable[size_t(vBrickCoords.w)].m_vAspect; } const TOCEntry& ExtendedOctree::GetBrickToCData(const UINT64VECTOR4& vBrickCoords) const { return m_vTOC[size_t(BrickCoordsToIndex(vBrickCoords))]; } const TOCEntry& ExtendedOctree::GetBrickToCData(size_t index) const { return m_vTOC[index]; } /* GetBrickData (scalar): Reads a brick from file and decompresses it if necessary. No magic here it simply seeks to the position in the file, which is the header offset + the brick-offset from the header, and then reads the data. Finally, checks if decompression is required. */ void ExtendedOctree::GetBrickData(uint8_t* pData, uint64_t index) const { tuvok::Controller::Instance().IncrementPerfCounter(PERF_EO_BRICKS, 1.0); if(m_vTOC[size_t(index)].m_eCompression == CT_NONE) { // not compressed, just read it directly into the buffer. tuvok::StackTimer t(PERF_EO_DISK_READ); m_pLargeRAWFile->SeekPos(m_iOffset+m_vTOC[size_t(index)].m_iOffset); m_pLargeRAWFile->ReadRAW(pData, m_vTOC[size_t(index)].m_iLength); return; } // the data are compressed; read them into a temporary buffer and then expand // that buffer into 'pData'. const size_t uncompressedSize = this->ComputeBrickSize(this->IndexToBrickCoords(index)).volume() * this->GetComponentCount() * this->GetComponentTypeSize(); std::shared_ptr buf(new uint8_t[uncompressedSize], nonstd::DeleteArray()); std::shared_ptr out(pData, nonstd::null_deleter()); TimedStatement(PERF_EO_DISK_READ, m_pLargeRAWFile->SeekPos(m_iOffset+m_vTOC[size_t(index)].m_iOffset); m_pLargeRAWFile->ReadRAW(buf.get(), m_vTOC[size_t(index)].m_iLength); ); tuvok::StackTimer decompress(PERF_EO_DECOMPRESSION); switch (m_vTOC[size_t(index)].m_eCompression) { case CT_ZLIB: zDecompress(buf, out, uncompressedSize); break; case CT_LZMA: lzmaDecompress(buf, out, uncompressedSize, m_lzmaProps); break; case CT_LZ4: lz4Decompress(buf, out, uncompressedSize); break; case CT_BZLIB: bzDecompress(buf, size_t(m_vTOC[size_t(index)].m_iLength), out, uncompressedSize); break; case CT_LZHAM: lzhamDecompress(buf, size_t(m_vTOC[size_t(index)].m_iLength), out, uncompressedSize); break; default: throw std::runtime_error("unknown compression format"); } } /* GetBrickData (vector): Convenience function that calls the function above after computing the 1D index from the brick coordinates */ void ExtendedOctree::GetBrickData(uint8_t* pData, const UINT64VECTOR4& vBrickCoords) const { GetBrickData(pData, BrickCoordsToIndex(vBrickCoords)); } /* IsLastBrick: Computes whether a brick is the last brick in a row, column, or slice. To do this we simply fetch the brick count of the brick's LoD and then check if it's index is equal to the max index. */ VECTOR3 ExtendedOctree::IsLastBrick(const UINT64VECTOR4& vBrickCoords) const { const UINT64VECTOR3 vLODSize = m_vLODTable[size_t(vBrickCoords.w)].m_iLODBrickCount; const VECTOR3 res( vBrickCoords.x >= vLODSize.x-1, vBrickCoords.y >= vLODSize.y-1, vBrickCoords.z >= vLODSize.z-1); return res; } /* BrickCoordsToIndex: Computes the 1D index from a coordinate vector this is the offset introduced by the LoD level + the index within that LoD */ uint64_t ExtendedOctree::BrickCoordsToIndex(const UINT64VECTOR4& vBrickCoords) const { const UINT64VECTOR3 vLODSize = m_vLODTable[size_t(vBrickCoords.w)].m_iLODBrickCount; return m_vLODTable[size_t(vBrickCoords.w)].m_iLoDOffset + vBrickCoords.x + vBrickCoords.y * vLODSize.x + vBrickCoords.z * vLODSize.x * vLODSize.y; } /* IndexToBrickCoords: Computes the 4D coordinates for the 1D ToC index */ UINT64VECTOR4 ExtendedOctree::IndexToBrickCoords(uint64_t index) const { UINT64VECTOR4 vBrickCoords(0,0,0,0); for (size_t i = 0;iSeekPos(m_iOffset + sizeof(uint32_t /*m_eComponentType*/) + sizeof(uint64_t /*m_iComponentCount*/) + sizeof(bool /*m_bPrecomputedNormals*/) + 3 * sizeof(uint64_t /*m_vVolumeSize*/)); m_pLargeRAWFile->WriteData(m_vVolumeAspect.x, isBE); m_pLargeRAWFile->WriteData(m_vVolumeAspect.y, isBE); m_pLargeRAWFile->WriteData(m_vVolumeAspect.z, isBE); if (!bTreeWasInRWModeAlready && !ReOpenR()) return false; return true; } /* ComputeBrickCount: "Computes" the total number of bricks in the file, by adding the number of bricks of the last LoD to it's brick offset. This function can be used before a valid brick ToC exists, once that has been constructed the overall brick count can also be computer as m_vTOC.size() */ uint64_t ExtendedOctree::ComputeBrickCount() const { return (m_vLODTable.end()-1)->m_iLoDOffset + (m_vLODTable.end()-1)->m_iLODBrickCount.volume(); } /* ComputeHeaderSize: The size of the header is simply a bunch of sizeof calls of the contents the global header + brickcount times what we store per brick (i.e. it's length in bytes and the compression method) */ uint64_t ExtendedOctree::ComputeHeaderSize() const { return sizeof(uint32_t /*m_eComponentType*/) + sizeof(uint64_t /*m_iComponentCount*/) + (m_iVersion > 0 ? sizeof(bool /*m_bPrecomputedNormals*/) : 0) + 3 * sizeof(uint64_t /*m_vVolumeSize*/) + 3 * sizeof(double /*m_vVolumeAspect*/) + 3 * (m_iVersion > 0 ? sizeof(uint64_t /*m_iBrickSize*/) : sizeof(uint32_t)) + sizeof(uint32_t /*m_iOverlap*/) + (m_iVersion > 0 ? sizeof(uint32_t /*m_iVersion*/) : 0) + (m_iVersion > 0 ? sizeof(uint64_t /*m_iSize*/) : 0) + (m_iVersion > 1 ? sizeof(uint32_t /*m_iCompressionLevel*/) : 0) + ComputeBrickCount() * TOCEntry::SizeInFile(m_iVersion); } /* WriteHeader: Nothing special here, simply stores global header and then the ToC. As the size of the ToC can be computed from the global header info alone (using the ComputeBrickCount method) we don't need to store the length of the ToC */ void ExtendedOctree::WriteHeader(LargeRAWFile_ptr pLargeRAWFile, uint64_t iOffset) { m_pLargeRAWFile = pLargeRAWFile; m_iOffset = iOffset; assert(m_iComponentCount); assert(m_vVolumeSize.volume() > 0); assert(m_vVolumeAspect.volume() > 0); assert(m_iBrickSize.volume() > 0); // write global header const bool isBE = EndianConvert::IsBigEndian(); m_pLargeRAWFile->SeekPos(m_iOffset); m_pLargeRAWFile->WriteData(uint32_t(m_eComponentType), isBE); m_pLargeRAWFile->WriteData(m_iComponentCount, isBE); m_pLargeRAWFile->WriteData(m_bPrecomputedNormals, isBE); m_pLargeRAWFile->WriteData(m_vVolumeSize.x, isBE); m_pLargeRAWFile->WriteData(m_vVolumeSize.y, isBE); m_pLargeRAWFile->WriteData(m_vVolumeSize.z, isBE); m_pLargeRAWFile->WriteData(m_vVolumeAspect.x, isBE); m_pLargeRAWFile->WriteData(m_vVolumeAspect.y, isBE); m_pLargeRAWFile->WriteData(m_vVolumeAspect.z, isBE); m_pLargeRAWFile->WriteData(m_iBrickSize.x, isBE); m_pLargeRAWFile->WriteData(m_iBrickSize.y, isBE); m_pLargeRAWFile->WriteData(m_iBrickSize.z, isBE); m_pLargeRAWFile->WriteData(m_iOverlap, isBE); if (m_iVersion > 0) { m_pLargeRAWFile->WriteData(m_iVersion, isBE); m_pLargeRAWFile->WriteData(m_iSize, isBE); } if (m_iVersion > 1) { m_pLargeRAWFile->WriteData(m_iCompressionLevel, isBE); } // write ToC if (m_iVersion > 0) { for (size_t i = 0;iWriteData(m_vTOC[i].m_iOffset, isBE); m_pLargeRAWFile->WriteData(m_vTOC[i].m_iLength, isBE); m_pLargeRAWFile->WriteData(uint32_t(m_vTOC[i].m_eCompression), isBE); m_pLargeRAWFile->WriteData(m_vTOC[i].m_iValidLength, isBE); m_pLargeRAWFile->WriteData(m_vTOC[i].m_iAtlasSize.x, isBE); m_pLargeRAWFile->WriteData(m_vTOC[i].m_iAtlasSize.y, isBE); } } else { for (size_t i = 0;iWriteData(m_vTOC[i].m_iLength, isBE); m_pLargeRAWFile->WriteData(uint32_t(m_vTOC[i].m_eCompression), isBE); } } } /* GetComponentTypeSize: This is simply a big switch that turns our type enum into it's size semantic. */ uint32_t ExtendedOctree::GetComponentTypeSize(COMPONENT_TYPE t) { switch (t) { case CT_INT8: case CT_UINT8: return 1; case CT_INT16: case CT_UINT16: return 2; case CT_FLOAT32: case CT_INT32: case CT_UINT32: return 4; case CT_FLOAT64: case CT_INT64: case CT_UINT64: return 8; default: return 0; } } /* GetComponentTypeSize: Convenience function that calls the above method with this' tree's data type */ size_t ExtendedOctree::GetComponentTypeSize() const { return GetComponentTypeSize(m_eComponentType); } bool ExtendedOctree::ReOpenRW() { if (IsInRWMode()) return true; // close read-only file m_pLargeRAWFile->Close(); // re-open in read/write mode if (m_pLargeRAWFile->Open(true)) { // if opening in rw failed, return to read only mode m_pLargeRAWFile->Open(false); return false; } return true; } bool ExtendedOctree::ReOpenR() { if (!IsInRWMode()) return true; m_pLargeRAWFile->Close(); return m_pLargeRAWFile->Open(false); } ImageVis3D-3.1.0/Tuvok/IO/UVF/UVF.cpp0000644000175000017500000003465112320456500016511 0ustar mathieumathieu#include #include "UVF.h" #include "Basics/Checksums/crc32.h" #include "Basics/Checksums/MD5.h" #include "Basics/nonstd.h" #include "DataBlock.h" #include "Controller/Controller.h" #include "Basics/ProgressTimer.h" using namespace std; using namespace UVFTables; uint64_t UVF::ms_ulReaderVersion = UVFVERSION; UVF::UVF(std::wstring wstrFilename) : m_bFileIsLoaded(false), m_bFileIsReadWrite(false), m_streamFile(new LargeRAWFile(wstrFilename)), m_iAccumOffsets(0) { } UVF::~UVF(void) { Close(); } bool UVF::CheckMagic(LargeRAWFile_ptr streamFile) { if (!streamFile->Open(false)) { return false; } if (streamFile->GetCurrentSize() < GlobalHeader::GetMinSize() + 8) { return false; } unsigned char pData[8]; streamFile->ReadRAW(pData, 8); if (pData[0] != 'U' || pData[1] != 'V' || pData[2] != 'F' || pData[3] != '-' || pData[4] != 'D' || pData[5] != 'A' || pData[6] != 'T' || pData[7] != 'A') { return false; } return true; } bool UVF::IsUVFFile(const std::wstring& wstrFilename) { LargeRAWFile_ptr streamFile(new LargeRAWFile (wstrFilename)); bool bResult = CheckMagic(streamFile); streamFile->Close(); return bResult; } bool UVF::IsUVFFile(const std::wstring& wstrFilename, bool& bChecksumFail) { LargeRAWFile_ptr streamFile( new LargeRAWFile(wstrFilename)); if (!CheckMagic(streamFile)) { bChecksumFail = false; streamFile->Close(); return false; } GlobalHeader g; g.GetHeaderFromFile(streamFile); bChecksumFail = !VerifyChecksum(streamFile, g); streamFile->Close(); return true; } bool UVF::Open(bool bMustBeSameVersion, bool bVerify, bool bReadWrite, std::string* pstrProblem) { if (m_bFileIsLoaded) return true; m_bFileIsLoaded = m_streamFile->Open(bReadWrite); if (!m_bFileIsLoaded) { if (pstrProblem) (*pstrProblem) = "file not found or access denied"; return false; } m_bFileIsReadWrite = bReadWrite; if (ParseGlobalHeader(bVerify,pstrProblem)) { if (bMustBeSameVersion && ms_ulReaderVersion != m_GlobalHeader.ulFileVersion) { if (pstrProblem) (*pstrProblem) = "wrong UVF file version"; return false; } ParseDataBlocks(); return true; } else { Close(); // file is not a UVF file or checksum is invalid return false; } } void UVF::Close() { if (m_bFileIsLoaded) { if (m_bFileIsReadWrite) { bool dirty = false; for (size_t i = 0;im_bHeaderIsDirty) { m_DataBlocks[i]->m_block->CopyHeaderToFile( m_streamFile, m_DataBlocks[i]->m_iOffsetInFile+m_GlobalHeader.GetDataPos(), m_GlobalHeader.bIsBigEndian, i == m_DataBlocks.size()-1 ); dirty = true; } if (m_DataBlocks[i]->m_bIsDirty) { // for now we only support changes in the datablock that do // not influence its size TODO: will need to extend this to // arbitrary changes once we add more features assert(m_DataBlocks[i]->m_block->GetOffsetToNextBlock() == m_DataBlocks[i]->GetBlockSize()); m_DataBlocks[i]->m_block->CopyToFile( m_streamFile, m_DataBlocks[i]->m_iOffsetInFile+m_GlobalHeader.GetDataPos(), m_GlobalHeader.bIsBigEndian, i == m_DataBlocks.size()-1 ); dirty = true; } } if(dirty) { UpdateChecksum(); } } m_streamFile->Close(); m_bFileIsLoaded = false; } m_DataBlocks.clear(); } bool UVF::ParseGlobalHeader(bool bVerify, std::string* pstrProblem) { if (m_streamFile->GetCurrentSize() < GlobalHeader::GetMinSize() + 8) { if (pstrProblem!=NULL) (*pstrProblem) = "file to small to be a UVF file"; return false; } unsigned char pData[8]; m_streamFile->ReadRAW(pData, 8); if (pData[0] != 'U' || pData[1] != 'V' || pData[2] != 'F' || pData[3] != '-' || pData[4] != 'D' || pData[5] != 'A' || pData[6] != 'T' || pData[7] != 'A') { if (pstrProblem!=NULL) (*pstrProblem) = "file magic not found"; return false; } m_GlobalHeader.GetHeaderFromFile(m_streamFile); return !bVerify || VerifyChecksum(m_streamFile, m_GlobalHeader, pstrProblem); } vector UVF::ComputeChecksum(LargeRAWFile_ptr streamFile, ChecksumSemanticTable eChecksumSemanticsEntry) { vector checkSum; uint64_t iOffset = 33+UVFTables::ChecksumElemLength(eChecksumSemanticsEntry); uint64_t iFileSize = streamFile->GetCurrentSize(); uint64_t iSize = iFileSize-iOffset; streamFile->SeekPos(iOffset); ProgressTimer timer; timer.Start(); unsigned char *ucBlock=new unsigned char[1<<25]; switch (eChecksumSemanticsEntry) { case CS_CRC32 : { CRC32 crc; uint64_t iBlocks=iFileSize>>25; unsigned long dwCRC32=0xFFFFFFFF; for (uint64_t i=0; iReadRAW(ucBlock,1<<25); crc.chunk(ucBlock,1<<25,dwCRC32); float progress = float(i)/float(iBlocks-1); MESSAGE("Computing CRC32 Checksum %5.2f%% (%s)", progress * 100.0f, timer.GetProgressMessage(progress).c_str()); } size_t iLengthLastChunk=size_t(iFileSize-(iBlocks<<25)); streamFile->ReadRAW(ucBlock,iLengthLastChunk); crc.chunk(ucBlock,iLengthLastChunk,dwCRC32); dwCRC32^=0xFFFFFFFF; for (uint64_t i = 0;i<4;i++) { unsigned char c = dwCRC32 & 255; checkSum.push_back(c); dwCRC32 = dwCRC32>>8; } } break; case CS_MD5 : { MD5 md5; int iError=0; uint32_t iBlockSize; while (iSize > 0) { iBlockSize = uint32_t(min(iSize,uint64_t(1<<25))); streamFile->ReadRAW(ucBlock,iBlockSize); md5.Update(ucBlock, iBlockSize, iError); iSize -= iBlockSize; float progress = 1.0f - float(iSize)/float(iFileSize); MESSAGE("Computing MD5 Checksum %5.2f%% (%s)", progress * 100.0f, timer.GetProgressMessage(progress).c_str()); } checkSum = md5.Final(iError); } break; case CS_NONE : default : break; } delete [] ucBlock; streamFile->SeekStart(); return checkSum; } bool UVF::VerifyChecksum(LargeRAWFile_ptr streamFile, GlobalHeader& globalHeader, std::string* pstrProblem) { if (globalHeader.ulChecksumSemanticsEntry == CS_NONE) return true; vector vecActualCheckSum = ComputeChecksum(streamFile, globalHeader.ulChecksumSemanticsEntry); if (vecActualCheckSum.size() != globalHeader.vcChecksum.size()) { if (pstrProblem != NULL) { stringstream s; string strActual = "", strFile = ""; for (size_t i = 0;i d( new DataBlock(m_streamFile, iOffset, m_GlobalHeader.bIsBigEndian) ); // if we recognize the block -> read it completely if (d->ulBlockSemantics > BS_EMPTY && d->ulBlockSemantics < BS_UNKNOWN) { BlockSemanticTable eTableID = d->ulBlockSemantics; d = CreateBlockFromSemanticEntry(eTableID, m_streamFile, iOffset, m_GlobalHeader.bIsBigEndian, m_GlobalHeader.ulFileVersion); } m_DataBlocks.push_back(std::shared_ptr( new DataBlockListElem(d, false, iOffset-m_GlobalHeader.GetDataPos(), d->ulOffsetToNextDataBlock) )); iOffset += d->ulOffsetToNextDataBlock; } while (m_DataBlocks[m_DataBlocks.size()-1]->m_block->ulOffsetToNextDataBlock != 0); } // ********************** file creation routines void UVF::UpdateChecksum() { if (m_GlobalHeader.ulChecksumSemanticsEntry == CS_NONE) return; m_GlobalHeader.UpdateChecksum(ComputeChecksum(m_streamFile, m_GlobalHeader.ulChecksumSemanticsEntry), m_streamFile); } bool UVF::SetGlobalHeader(const GlobalHeader& globalHeader) { if (m_bFileIsLoaded) return false; m_GlobalHeader = globalHeader; // set the canonical data m_GlobalHeader.ulAdditionalHeaderSize = 0; m_GlobalHeader.ulOffsetToFirstDataBlock = 0; m_GlobalHeader.ulFileVersion = ms_ulReaderVersion; if (m_GlobalHeader.ulChecksumSemanticsEntry >= CS_UNKNOWN) m_GlobalHeader.ulChecksumSemanticsEntry = CS_NONE; if (m_GlobalHeader.ulChecksumSemanticsEntry > CS_NONE) { m_GlobalHeader.vcChecksum.resize(size_t(ChecksumElemLength(m_GlobalHeader.ulChecksumSemanticsEntry))); } else m_GlobalHeader.vcChecksum.resize(0); return true; } bool UVF::AddConstDataBlock(std::shared_ptr dataBlock) { const uint64_t iSizeofData = dataBlock->ComputeDataSize(); if (!dataBlock->Verify(iSizeofData)) return false; std::shared_ptr d(dataBlock->Clone()); m_DataBlocks.push_back(std::shared_ptr( new DataBlockListElem(d,true,m_iAccumOffsets, d->GetOffsetToNextBlock()) )); d->ulOffsetToNextDataBlock = d->GetOffsetToNextBlock(); m_iAccumOffsets += d->ulOffsetToNextDataBlock; return true; } bool UVF::AddDataBlock(std::shared_ptr dataBlock) { const uint64_t iSizeofData = dataBlock->ComputeDataSize(); if (!dataBlock->Verify(iSizeofData)) return false; m_DataBlocks.push_back(std::shared_ptr( new DataBlockListElem(dataBlock, true, m_iAccumOffsets, dataBlock->GetOffsetToNextBlock()) )); dataBlock->ulOffsetToNextDataBlock = dataBlock->GetOffsetToNextBlock(); m_iAccumOffsets += dataBlock->ulOffsetToNextDataBlock; return true; } uint64_t UVF::ComputeNewFileSize() { uint64_t iFileSize = m_GlobalHeader.GetDataPos(); for (size_t i = 0;im_block->GetOffsetToNextBlock(); return iFileSize; } bool UVF::Create() { if (m_bFileIsLoaded) return false; m_bFileIsLoaded = m_streamFile->Create(); if (m_bFileIsLoaded) { m_bFileIsReadWrite = true; unsigned char pData[8]; pData[0] = 'U'; pData[1] = 'V'; pData[2] = 'F'; pData[3] = '-'; pData[4] = 'D'; pData[5] = 'A'; pData[6] = 'T'; pData[7] = 'A'; m_streamFile->WriteRAW(pData, 8); m_GlobalHeader.CopyHeaderToFile(m_streamFile); uint64_t iOffset = m_GlobalHeader.GetDataPos(); for (size_t i = 0;im_block->CopyToFile(m_streamFile, iOffset, m_GlobalHeader.bIsBigEndian, i == m_DataBlocks.size()-1); m_DataBlocks[i]->m_bIsDirty = false; } return true; }else { return false; } } const std::shared_ptr UVF::GetDataBlock(uint64_t index) const { return std::shared_ptr(m_DataBlocks[size_t(index)]->m_block.get(), nonstd::null_deleter() /* we own it. */); } DataBlock* UVF::GetDataBlockRW(uint64_t index, bool bOnlyChangeHeader) { if (bOnlyChangeHeader) m_DataBlocks[size_t(index)]->m_bHeaderIsDirty = true; else { m_DataBlocks[size_t(index)]->m_bIsDirty = true; } return m_DataBlocks[size_t(index)]->m_block.get(); } bool UVF::AppendBlockToFile(std::shared_ptr dataBlock) { if (!m_bFileIsReadWrite) return false; // add new block to the datablock vector DataBlockListElem* dble = new DataBlockListElem(dataBlock, false, m_streamFile->GetCurrentSize(), dataBlock->GetOffsetToNextBlock()); m_DataBlocks.push_back(std::shared_ptr(dble)); // the block before the last needs to rewrite offset m_DataBlocks[m_DataBlocks.size()-2]->m_bHeaderIsDirty = true; // and the last block needs to written to file dataBlock->CopyToFile(m_streamFile, m_streamFile->GetCurrentSize(), m_GlobalHeader.bIsBigEndian, true); return true; } bool UVF::DropBlockFromFile(size_t iBlockIndex) { if (!m_bFileIsReadWrite) return false; // create copy buffer std::shared_ptr pBuffer( new unsigned char[BLOCK_COPY_SIZE], nonstd::DeleteArray() ); // remove data from file, by shifting all blocks after the // one to be removed towards the front of the file uint64_t iShiftSize = m_DataBlocks[iBlockIndex]->m_block->GetOffsetToNextBlock(); for (size_t i = iBlockIndex+1;im_iOffsetInFile + m_GlobalHeader.GetDataPos(); uint64_t iTargetPos = iSourcePos-iShiftSize; uint64_t iSize = m_DataBlocks[i]->GetBlockSize(); if (!m_streamFile->CopyRAW(iSize, iSourcePos, iTargetPos, pBuffer.get(), BLOCK_COPY_SIZE)) { return false; } } // if block was last block in file, flag the previous block as last // i.e. set offset to 0 if (iBlockIndex == m_DataBlocks.size()-1) { m_DataBlocks[m_DataBlocks.size()-2]->m_bHeaderIsDirty = true; m_streamFile->SeekPos(m_DataBlocks[iBlockIndex]->m_iOffsetInFile + m_GlobalHeader.GetDataPos()); } // truncate file m_streamFile->Truncate(); // remove data from datablock vector m_DataBlocks.erase(m_DataBlocks.begin()+iBlockIndex); return true; } ImageVis3D-3.1.0/Tuvok/IO/UVF/RasterDataBlock.cpp0000644000175000017500000017172612320456500021063 0ustar mathieumathieu#include #include #include #include "RasterDataBlock.h" #include "MaxMinDataBlock.h" #include "DebugOut/AbstrDebugOut.h" #include #include #include "Controller/Controller.h" #include "Basics/nonstd.h" using namespace boost; using namespace std; using namespace UVFTables; //*************** Raster Data Block ********************** RasterDataBlock::RasterDataBlock() : DataBlock(), ulElementDimension(0), ulOffsetToDataBlock(0), m_pTempFile(LargeRAWFile_ptr()), m_pSourceFile(LargeRAWFile_ptr()), m_iSourcePos(0) { ulBlockSemantics = BS_REG_NDIM_GRID; } RasterDataBlock::RasterDataBlock(const RasterDataBlock &other) : DataBlock(other), ulDomainSemantics(other.ulDomainSemantics), dDomainTransformation(other.dDomainTransformation), ulDomainSize(other.ulDomainSize), ulBrickSize(other.ulBrickSize), ulBrickOverlap(other.ulBrickOverlap), ulLODDecFactor(other.ulLODDecFactor), ulLODGroups(other.ulLODGroups), ulLODLevelCount(other.ulLODLevelCount), ulElementDimension(other.ulElementDimension), ulElementDimensionSize(other.ulElementDimensionSize), ulElementSemantic(other.ulElementSemantic), ulElementBitSize(other.ulElementBitSize), ulElementMantissa(other.ulElementMantissa), bSignedElement(other.bSignedElement), ulOffsetToDataBlock(other.ulOffsetToDataBlock), m_pTempFile(LargeRAWFile_ptr()), m_pSourceFile(LargeRAWFile_ptr()), m_iSourcePos(0) { if (other.m_pTempFile != LargeRAWFile_ptr()) m_pTempFile = LargeRAWFile_ptr(new LargeRAWFile(*(other.m_pTempFile))); else { m_pSourceFile = other.m_pStreamFile; m_iSourcePos = other.m_iOffset + DataBlock::GetOffsetToNextBlock() + other.ComputeHeaderSize(); } m_vLODOffsets = other.m_vLODOffsets; m_vBrickCount = other.m_vBrickCount; m_vBrickOffsets = other.m_vBrickOffsets; m_vBrickSizes = other.m_vBrickSizes; } RasterDataBlock& RasterDataBlock::operator=(const RasterDataBlock& other) { strBlockID = other.strBlockID; ulBlockSemantics = other.ulBlockSemantics; ulCompressionScheme = other.ulCompressionScheme; ulOffsetToNextDataBlock = other.ulOffsetToNextDataBlock; ulDomainSemantics = other.ulDomainSemantics; dDomainTransformation = other.dDomainTransformation; ulDomainSize = other.ulDomainSize; ulBrickSize = other.ulBrickSize; ulBrickOverlap = other.ulBrickOverlap; ulLODDecFactor = other.ulLODDecFactor; ulLODGroups = other.ulLODGroups; ulLODLevelCount = other.ulLODLevelCount; ulElementDimension = other.ulElementDimension; ulElementDimensionSize = other.ulElementDimensionSize; ulElementSemantic = other.ulElementSemantic; ulElementBitSize = other.ulElementBitSize; ulElementMantissa = other.ulElementMantissa; bSignedElement = other.bSignedElement; ulOffsetToDataBlock = other.ulOffsetToDataBlock; m_vLODOffsets = other.m_vLODOffsets; m_vBrickCount = other.m_vBrickCount; m_vBrickOffsets = other.m_vBrickOffsets; m_vBrickSizes = other.m_vBrickSizes; m_pTempFile = LargeRAWFile_ptr(); m_pSourceFile = other.m_pSourceFile; m_iSourcePos = other.m_iSourcePos; return *this; } RasterDataBlock::~RasterDataBlock() { CleanupTemp(); } RasterDataBlock::RasterDataBlock(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian) : DataBlock(), ulElementDimension(0), ulOffsetToDataBlock(0), m_pTempFile(LargeRAWFile_ptr()), m_pSourceFile(LargeRAWFile_ptr()) { GetHeaderFromFile(pStreamFile, iOffset, bIsBigEndian); } DataBlock* RasterDataBlock::Clone() const { return new RasterDataBlock(*this); } uint64_t RasterDataBlock::GetOffsetToNextBlock() const { return DataBlock::GetOffsetToNextBlock() + ComputeHeaderSize() + ComputeDataSize(); } uint64_t RasterDataBlock::ComputeHeaderSize() const { uint64_t ulDomainDimension = ulDomainSemantics.size(); uint64_t ulOverallElementSize=0; for (size_t i = 0;iSeekPos(iStart); uint64_t ulDomainDimension; pStreamFile->ReadData(ulDomainDimension, bIsBigEndian); if (ulDomainDimension > 0) { vector uintVect; pStreamFile->ReadData(uintVect, ulDomainDimension, bIsBigEndian); ulDomainSemantics.resize(size_t(ulDomainDimension)); for (size_t i = 0;iReadData(dDomainTransformation, (ulDomainDimension+1)*(ulDomainDimension+1), bIsBigEndian); pStreamFile->ReadData(ulDomainSize, ulDomainDimension, bIsBigEndian); pStreamFile->ReadData(ulBrickSize, ulDomainDimension, bIsBigEndian); pStreamFile->ReadData(ulBrickOverlap, ulDomainDimension, bIsBigEndian); pStreamFile->ReadData(ulLODDecFactor, ulDomainDimension, bIsBigEndian); pStreamFile->ReadData(ulLODGroups, ulDomainDimension, bIsBigEndian); RecompLODIndexCount(); } uint64_t ulLODIndexCount = RecompLODIndexCount(); pStreamFile->ReadData(ulLODLevelCount, ulLODIndexCount, bIsBigEndian); pStreamFile->ReadData(ulElementDimension, bIsBigEndian); pStreamFile->ReadData(ulElementDimensionSize, ulElementDimension, bIsBigEndian); ulElementSemantic.resize(size_t(ulElementDimension)); ulElementBitSize.resize(size_t(ulElementDimension)); ulElementMantissa.resize(size_t(ulElementDimension)); bSignedElement.resize(size_t(ulElementDimension)); for (size_t i = 0;i uintVect; pStreamFile->ReadData(uintVect, ulElementDimensionSize[i], bIsBigEndian); ulElementSemantic[i].resize(size_t(ulElementDimensionSize[i])); for (size_t j = 0;jReadData(ulElementBitSize[i], ulElementDimensionSize[i], bIsBigEndian); pStreamFile->ReadData(ulElementMantissa[i], ulElementDimensionSize[i], bIsBigEndian); // reading bools failed on windows so we are reading chars vector charVect; pStreamFile->ReadData(charVect, ulElementDimensionSize[i], bIsBigEndian); bSignedElement[i].resize(size_t(ulElementDimensionSize[i])); for (size_t j = 0;jReadData(ulOffsetToDataBlock, bIsBigEndian); ComputeDataSizeAndOffsetTables(); // build the offset table return pStreamFile->GetPos() - iOffset; } void RasterDataBlock::CopyHeaderToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock) { DataBlock::CopyHeaderToFile(pStreamFile, iOffset, bIsBigEndian, bIsLastBlock); // write header uint64_t ulDomainDimension = ulDomainSemantics.size(); pStreamFile->WriteData(ulDomainDimension, bIsBigEndian); if (ulDomainDimension > 0) { vector uintVect; uintVect.resize(size_t(ulDomainDimension)); for (size_t i = 0;iWriteData(uintVect, bIsBigEndian); pStreamFile->WriteData(dDomainTransformation, bIsBigEndian); pStreamFile->WriteData(ulDomainSize, bIsBigEndian); pStreamFile->WriteData(ulBrickSize, bIsBigEndian); pStreamFile->WriteData(ulBrickOverlap, bIsBigEndian); pStreamFile->WriteData(ulLODDecFactor, bIsBigEndian); pStreamFile->WriteData(ulLODGroups, bIsBigEndian); } pStreamFile->WriteData(ulLODLevelCount, bIsBigEndian); pStreamFile->WriteData(ulElementDimension, bIsBigEndian); pStreamFile->WriteData(ulElementDimensionSize, bIsBigEndian); for (size_t i = 0;i uintVect; uintVect.resize(size_t(ulElementDimensionSize[i])); for (size_t j = 0;jWriteData(uintVect, bIsBigEndian); pStreamFile->WriteData(ulElementBitSize[i], bIsBigEndian); pStreamFile->WriteData(ulElementMantissa[i], bIsBigEndian); // writing bools failed on windows so we are writing chars vector charVect; charVect.resize(size_t(ulElementDimensionSize[i])); for (size_t j = 0;jWriteData(charVect, bIsBigEndian); } pStreamFile->WriteData(ulOffsetToDataBlock, bIsBigEndian); } uint64_t RasterDataBlock::CopyToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock) { CopyHeaderToFile(pStreamFile, iOffset, bIsBigEndian, bIsLastBlock); uint64_t iDataSize = ComputeDataSize(); LargeRAWFile_ptr pSourceFile; if (m_pTempFile) { m_pTempFile->SeekStart(); pSourceFile = m_pTempFile; } else { m_pSourceFile->SeekPos(m_iSourcePos); pSourceFile = m_pSourceFile; } pStreamFile->SeekPos( pStreamFile->GetPos() + ulOffsetToDataBlock); unsigned char* pData = new unsigned char[size_t(min(iDataSize, BLOCK_COPY_SIZE))]; for (uint64_t i = 0;iReadRAW(pData, iCopySize); pStreamFile->WriteRAW(pData, iCopySize); } delete [] pData; return pStreamFile->GetPos() - iOffset; } /** * Dumps the input data into a temp file and calls FlatDataToBrickedLOD * \param vElements - the input vectors of vector * \param iIndex - counter used internally to control the recursion, defaults * to 0 and should not be set * \return - the cartesian product of the ordered elements in the input vectors * as a vector of vectors */ vector> RasterDataBlock::GenerateCartesianProduct(const vector>& vElements, uint64_t iIndex) const { vector> vResult; if (iIndex == vElements.size()-1) { for (size_t i = 0;i v; v.push_back(vElements[vElements.size()-1][i]); vResult.push_back(v); } } else { vector> vTmpResult = GenerateCartesianProduct(vElements,iIndex+1); for (size_t j = 0;j v; v.push_back(vElements[size_t(iIndex)][i]); for (size_t k = 0;k> RasterDataBlock::ComputeBricks(const vector& vDomainSize) const { vector> vBrickLayout; for (size_t iDomainDimension = 0;iDomainDimensioniBrickOverlap); // sanity check vector vBricks; if (iSize <= iBrickSize) { vBricks.push_back(iSize); } else { do { if (iSize+iBrickOverlap <= iBrickSize) { vBricks.push_back(iSize); break; } else { vBricks.push_back(iBrickSize); iSize = iSize+iBrickOverlap-iBrickSize; } } while (iSize > iBrickOverlap); } vBrickLayout.push_back(vBricks); } return vBrickLayout; } /** * \return - the size of a single elment in the data IN BITS */ uint64_t RasterDataBlock::ComputeElementSize() const { // compute the size of a single data element uint64_t uiBitsPerElement = 0; for (size_t i = 0;i& vReducedDomainSize, uint64_t iLOD) { uint64_t ulSize = 0; // compute the size of a single data element uint64_t uiBitsPerElement = ComputeElementSize(); // compute brick layout vector> vBricks = ComputeBricks(vReducedDomainSize); vector> vBrickPermutation = GenerateCartesianProduct(vBricks); for (size_t i=0; i < vBricks.size(); i++) { m_vBrickCount[size_t(iLOD)].push_back(vBricks[i].size()); } m_vBrickOffsets[size_t(iLOD)].push_back(0); m_vBrickSizes[size_t(iLOD)] = vBrickPermutation; ulSize = 0; for (size_t i = 0;i& vReducedDomainSize) const { uint64_t ulSize = 0; // compute the size of a single data element uint64_t uiBitsPerElement = ComputeElementSize(); // compute brick layout vector> vBricks = ComputeBricks(vReducedDomainSize); vector> vBrickPermutation = GenerateCartesianProduct(vBricks); ulSize = 0; for (size_t i = 0;i& vLODIndices) const { uint64_t ulSize = 0; vector vReducedDomainSize; vReducedDomainSize.resize(ulDomainSemantics.size()); // compute size of the domain for (size_t i=0;i(1,uint64_t(floor(double(ulDomainSize[i]) / double(MathTools::Pow(ulLODDecFactor[i],vLODIndices[size_t(ulLODGroups[i])]))))); } ulSize = ComputeLODLevelSize(vReducedDomainSize); return ulSize; } uint64_t RasterDataBlock::GetLODSizeAndOffsetTables(vector& vLODIndices, uint64_t iLOD) { uint64_t ulSize = 0; vector vReducedDomainSize; vReducedDomainSize.resize(ulDomainSemantics.size()); // compute size of the domain for (size_t i=0;i(1,uint64_t(floor(double(ulDomainSize[i]) / double(MathTools::Pow(ulLODDecFactor[i],vLODIndices[size_t(ulLODGroups[i])]))))); } ulSize = ComputeLODLevelSizeAndOffsetTables(vReducedDomainSize, iLOD); return ulSize; } vector> RasterDataBlock::CountToVectors(vector vCountVector) const { vector> vResult; vResult.resize(vCountVector.size()); for (size_t i=0;i> vLODCombis = GenerateCartesianProduct(CountToVectors(ulLODLevelCount)); for (size_t i = 0;i> vLODCombis = GenerateCartesianProduct(CountToVectors(ulLODLevelCount)); m_vLODOffsets.resize(vLODCombis.size()); m_vBrickCount.resize(vLODCombis.size()); m_vBrickOffsets.resize(vLODCombis.size()); m_vBrickSizes.resize(vLODCombis.size()); m_vLODOffsets[0] = 0; for (size_t i = 0;i= ulLODIndexCount) ulLODIndexCount = ulLODGroups[i]+1; return ulLODIndexCount; } bool RasterDataBlock::Verify(string* pstrProblem) const { uint64_t ulDomainDimension = ulDomainSemantics.size(); uint64_t ulLODIndexCount = RecompLODIndexCount(); if ( dDomainTransformation.size() != (ulDomainDimension+1)*(ulDomainDimension+1) || ulDomainSize.size() != ulDomainDimension || ulBrickSize.size() != ulDomainDimension || ulBrickOverlap.size() != ulDomainDimension || ulLODDecFactor.size() != ulDomainDimension || ulLODGroups.size() != ulDomainDimension || ulLODDecFactor.size() != ulDomainDimension || ulLODLevelCount.size() != ulLODIndexCount || ulElementDimensionSize.size() != ulElementDimension) { if (pstrProblem != NULL) *pstrProblem = "RasterDataBlock::Verify ulDomainDimension mismatch"; return false; } for (size_t i = 0;i ulBrickOverlap[" << i << "]"; *pstrProblem = s.str(); } return false; } } for (size_t i = 0;i& vScale) { uint64_t ulDomainDimension = ulDomainSemantics.size(); dDomainTransformation.resize(size_t((ulDomainDimension+1)*(ulDomainDimension+1))); for (size_t y = 0;y < size_t(ulDomainDimension+1);y++) for (size_t x = 0;x < size_t(ulDomainDimension+1);x++) dDomainTransformation[x+y*size_t(ulDomainDimension+1)] = (x == y) ? (x < vScale.size() ? vScale[x] : 1.0) : 0.0; } void RasterDataBlock::SetIdentityTransformation() { uint64_t ulDomainDimension = ulDomainSemantics.size(); dDomainTransformation.resize(size_t((ulDomainDimension+1)*(ulDomainDimension+1))); for (size_t y = 0;y < size_t(ulDomainDimension+1);y++) for (size_t x = 0;x < size_t(ulDomainDimension+1);x++) dDomainTransformation[x+y*size_t(ulDomainDimension+1)] = (x == y) ? 1.0 : 0.0; } void RasterDataBlock::SetTypeToScalar(uint64_t iBitWith, uint64_t iMantissa, bool bSigned, ElementSemanticTable semantic) { vector vSemantic; vSemantic.push_back(semantic); SetTypeToVector(iBitWith, iMantissa, bSigned, vSemantic); } void RasterDataBlock::SetTypeToVector(uint64_t iBitWith, uint64_t iMantissa, bool bSigned, vector semantic) { vector vecB; vector vecM; vector vecSi; for (uint64_t i = 0;i& v) { uint64_t s = 1; for (size_t i = 0;i RasterDataBlock::LargestSingleBrickLODBrickIndex() const { std::vector vLargestSingleBrickLODIndex = GetSmallestBrickIndex(); // for this to work we require the smalest level to contain only a single brick assert(Product(GetBrickCount(vLargestSingleBrickLODIndex)) == 1); for (size_t iLODGroups = 0;iLODGroups0; iLOD--) { // being very carefull here as we are decrementing an unsigned value vLargestSingleBrickLODIndex[iLODGroups] = iLOD-1; if (Product(GetBrickCount(vLargestSingleBrickLODIndex)) > 1) { vLargestSingleBrickLODIndex[iLODGroups] = iLOD; break; } } } return vLargestSingleBrickLODIndex; } const std::vector& RasterDataBlock::LargestSingleBrickLODBrickSize() const { std::vector vLargestSingleBrickLOD = LargestSingleBrickLODBrickIndex(); std::vector vFirstBrick(GetBrickCount(vLargestSingleBrickLOD).size()); for (size_t i = 0;i RasterDataBlock::GetSmallestBrickIndex() const { std::vector vSmallestLOD = ulLODLevelCount; for (size_t i = 0;i& RasterDataBlock::GetSmallestBrickSize() const { std::vector vSmallestLOD = GetSmallestBrickIndex(); std::vector vFirstBrick(GetBrickCount(vSmallestLOD).size()); for (size_t i = 0;i RasterDataBlock::GetLargestBrickSizes() const { std::vector vMax(m_vBrickSizes[0][0]); for (size_t i = 0;i& vec, const vector& vSizes) const { uint64_t index = 0; uint64_t iPrefixProd = 1; for (size_t i = 0;i& RasterDataBlock::GetBrickCount(const vector& vLOD) const { return m_vBrickCount[size_t(Serialize(vLOD, ulLODLevelCount))]; } const vector& RasterDataBlock::GetBrickSize(const vector& vLOD, const vector& vBrick) const { const uint64_t iLODIndex = Serialize(vLOD, ulLODLevelCount); const size_t brick_index = static_cast( Serialize(vBrick, m_vBrickCount[size_t(iLODIndex)]) ); return m_vBrickSizes[size_t(iLODIndex)][brick_index]; } uint64_t RasterDataBlock::GetLocalDataPointerOffset(const vector& vLOD, const vector& vBrick) const { assert(!vLOD.empty() && !vBrick.empty()); if (vLOD.size() != ulLODLevelCount.size()) return 0; uint64_t iLODIndex = Serialize(vLOD, ulLODLevelCount); if (iLODIndex > m_vLODOffsets.size()) return 0; if (vBrick.size() != ulBrickSize.size()) return 0; uint64_t iBrickIndex = Serialize(vBrick, m_vBrickCount[size_t(iLODIndex)]); return GetLocalDataPointerOffset(iLODIndex,iBrickIndex); } void RasterDataBlock::SubSample(LargeRAWFile_ptr pSourceFile, LargeRAWFile_ptr pTargetFile, std::vector sourceSize, std::vector targetSize, void (*combineFunc)( const std::vector &vSource, uint64_t iTarget, const void* pIn, void* pOut ), AbstrDebugOut* pDebugOut, uint64_t iLODLevel, uint64_t iMaxLODLevel) { pSourceFile->SeekStart(); pTargetFile->SeekStart(); uint64_t iTargetElementCount = 1; uint64_t iReduction = 1; vector vReduction; for (size_t i = 0;i> vOffsetVectors = GenerateCartesianProduct(CountToVectors(vReduction)); // generate 1D offset coords into serialized source data vector vPrefixProd; vPrefixProd.push_back(1); for (size_t i = 1;i vOffsetVector; vOffsetVector.resize(vOffsetVectors.size()); for (size_t i = 0;i sourceElementsSerialized; sourceElementsSerialized.resize(vOffsetVector.size()); unsigned char* pSourceData = NULL; unsigned char* pTargetData = NULL; uint64_t iSourceMinWindowSize = vOffsetVector[vOffsetVector.size()-1]+1; uint64_t iSourceWindowSize = iSourceMinWindowSize+(sourceSize[0]-vReduction[0]); uint64_t iTargetWindowSize = targetSize[0]; vector vSourcePos; for (size_t i = 0;i= iTargetWindowSize) { if (i==0) { pSourceData = new unsigned char[size_t(iSourceWindowSize*iElementSize)]; pTargetData = new unsigned char[size_t(iTargetWindowSize*iElementSize)]; } else { const uint64_t bytes = iTargetWindowSize * iElementSize; if(pTargetFile->WriteRAW(pTargetData, bytes) != bytes) { pDebugOut->Error(_func_, "short write while subsampling!"); assert(1 == 0); } } if(pDebugOut && (--uCount == 0)) { uCount = uItersPerUpdate; float fCurrentOutput = (100.0f*i)/float(iTargetElementCount); pDebugOut->Message(_func_, "Generating data for lod level %i of %i:" "%6.2f%% completed", int(iLODLevel+1), int(iMaxLODLevel), fCurrentOutput); } const uint64_t bytes = iSourceWindowSize*iElementSize; if (pSourceFile == pTargetFile) { // save and later restore position for in place subsampling uint64_t iFilePos = pSourceFile->GetPos(); pSourceFile->SeekPos(iSourcePos*iElementSize); if(pSourceFile->ReadRAW(pSourceData, bytes) != bytes) { pDebugOut->Error(_func_, "short read from '%s'", pSourceFile->GetFilename().c_str()); } pSourceFile->SeekPos(iFilePos); } else { pSourceFile->SeekPos(iSourcePos*iElementSize); if(pSourceFile->ReadRAW(pSourceData, bytes) != bytes) { pDebugOut->Error(_func_, "short read from data"); } } iWindowSourcePos = 0; iWindowTargetPos = 0; } // gather data in source array and combine into target array for (size_t j = 0;j sourceSize[j-1]) { vSourcePos[j-1] = 0; vSourcePos[j] += vReduction[j-1]; } iSourcePos += vPrefixProd[j-1] * vSourcePos[j-1]; } iSourcePos += vPrefixProd[sourceSize.size()-1] * vSourcePos[sourceSize.size()-1]; } const uint64_t bytes = iTargetWindowSize*iElementSize; if(pTargetFile->WriteRAW(pTargetData, bytes) != bytes) { pDebugOut->Error(_func_, "short write to '%s'", pTargetFile->GetFilename().c_str()); } delete[] pSourceData; delete[] pTargetData; } void RasterDataBlock::AllocateTemp(const string& strTempFile, bool bBuildOffsetTables) { CleanupTemp(); uint64_t iDataSize = (bBuildOffsetTables) ? ComputeDataSizeAndOffsetTables(): ComputeDataSize(); m_pTempFile = LargeRAWFile_ptr(new LargeRAWFile(strTempFile)); if (!m_pTempFile->Create(iDataSize)) { m_pTempFile.reset(); throw "Unable To create Temp File"; } } /** * Dumps the input data into a temp file and calls FlatDataToBrickedLOD * \param pSourceData - void pointer to the flat input data * \param strTempFile - filename of a temp files during the conversion * \param combineFunc - the function used to compute the LOD, this is mostly an * average function * \return void * \see FlatDataToBrickedLOD */ bool RasterDataBlock::FlatDataToBrickedLOD( const void* pSourceData, const string& strTempFile, void (*combineFunc)(const vector& vSource, uint64_t iTarget, const void* pIn, void* pOut), void (*maxminFunc)(const void* pIn, size_t iStart, size_t iCount, std::vector& fMinMax), std::shared_ptr pMaxMinDatBlock, AbstrDebugOut* pDebugOut) { // size of input data uint64_t iInPointerSize = ComputeElementSize()/8; for (size_t i = 0;i(&pSourceFile, nonstd::null_deleter()), strTempFile, combineFunc, maxminFunc, pMaxMinDatBlock, pDebugOut ); // delete tempfile pSourceFile.Delete(); return bResult; } vector RasterDataBlock::GetLODDomainSize(const vector& vLOD) const { vector vReducedDomainSize; vReducedDomainSize.resize(ulDomainSemantics.size()); for (size_t j=0;j(1,uint64_t(floor(double(ulDomainSize[j]) / double((MathTools::Pow(ulLODDecFactor[j],vLOD[size_t(ulLODGroups[j])])))))); return vReducedDomainSize; } /** * Converts data stored in a file to a bricked LODed format * \param pSourceData - pointer to the source data file * \param strTempFile - filename of a temp files during the conversion * \param combineFunc - the function used to compute the LOD, this is mostly an * average function * \return void * \see FlatDataToBrickedLOD */ bool RasterDataBlock::FlatDataToBrickedLOD( LargeRAWFile_ptr pSourceData, const string& strTempFile, void (*combineFunc)(const vector& vSource, uint64_t iTarget, const void* pIn, void* pOut), void (*maxminFunc)(const void* pIn, size_t iStart, size_t iCount, std::vector& fMinMax), std::shared_ptr pMaxMinDatBlock, AbstrDebugOut* pDebugOut) { // parameter sanity checks for (size_t i = 0;iError(_func_, "Invalid parameters: Bricksze is smaler than brick overlap"); return false; } } uint64_t uiBytesPerElement = ComputeElementSize()/8; if (!m_pTempFile) { AllocateTemp(SysTools::AppendFilename(strTempFile,"1"), m_vLODOffsets.empty()); } LargeRAWFile_ptr tempFile; // iterate over all LOD-Group Combinations vector> vLODCombis = GenerateCartesianProduct(CountToVectors(ulLODLevelCount)); vector vLastReducedDomainSize; vLastReducedDomainSize.resize(ulDomainSemantics.size()); vector vReducedDomainSize; for (size_t i = 0;iMessage(_func_, "Generating data for lod level %i of %i", int(i+1), int(vLODCombis.size())); } // compute size of the domain vReducedDomainSize = GetLODDomainSize(vLODCombis[i]); LargeRAWFile_ptr pBrickSource; // in the first iteration 0 (outer else case) do not subsample at all but // brick the input data at fullres // in the second iteration 1 (inner else case) use the input data as source // for the subsampling // in all other cases use the previously subsampled data to generate the // next subsample level if (i > 0) { if (i > 1) { SubSample(tempFile, tempFile, vLastReducedDomainSize, vReducedDomainSize, combineFunc, pDebugOut, i, vLODCombis.size()); } else { tempFile = LargeRAWFile_ptr(new LargeRAWFile(SysTools::AppendFilename(strTempFile,"2"))); if (!tempFile->Create(ComputeDataSize())) { if (pDebugOut) pDebugOut->Error(_func_, "Unable To create Temp File"); return false; } SubSample(pSourceData, tempFile, ulDomainSize, vReducedDomainSize, combineFunc, pDebugOut, i, vLODCombis.size()); } pBrickSource = tempFile; vLastReducedDomainSize = vReducedDomainSize; } else { pBrickSource = pSourceData; } //Console::printf("\n"); //uint64_t j = 0; //for (uint64_t t = 0;t> vBricks = ComputeBricks(vReducedDomainSize); vector< vector> vBrickPermutation = GenerateCartesianProduct(vBricks); // compute positions of bricks in source data vector vBrickLayout; for (size_t j=0;j> vBrickIndices = GenerateCartesianProduct(CountToVectors(vBrickLayout)); vector vPrefixProd; vPrefixProd.push_back(1); for (size_t j = 1;j vBrickOffset; vBrickOffset.resize(vBrickPermutation.size()); vBrickOffset[0] = 0; for (size_t j=1;jMessage(_func_, "Processing brick %i of %i in lod level %i of %i",int(j+1),int(vBrickPermutation.size()),int(i+1), int(vLODCombis.size())); //Console::printf(" Brick %i (",j); //for (uint64_t k=0;k vBrickPrefixProd; vBrickPrefixProd.push_back(1); for (size_t k=1;kStartNewValue(); assert(ulElementDimension <= std::numeric_limits::max()); vector fMinMax(static_cast(ulElementDimension)); for (uint64_t k=0;kSeekPos(iTargetOffset); pBrickSource->SeekPos(iSourceOffset); uint64_t iDataSize = vBrickPermutation[j][0] * uiBytesPerElement; for (uint64_t l = 0;lReadRAW(pData, iCopySize); if(bytes != iCopySize) { T_ERROR("Error reading data from %s!", pBrickSource->GetFilename().c_str()); return false; } m_pTempFile->WriteRAW(pData, iCopySize); if (pMaxMinDatBlock) { maxminFunc(pData, 0, size_t(iCopySize/uiBytesPerElement), fMinMax); pMaxMinDatBlock->MergeData(fMinMax); } } iTargetOffset += vBrickPermutation[j][0] * uiBytesPerElement; iPosTargetArray += vBrickPermutation[j][0]; if (iPosTargetArray % vBrickPrefixProd[1] == 0) iSourceOffset += vReducedDomainSize[0] * uiBytesPerElement; for (size_t l = 2;lDelete(); return true; } void RasterDataBlock::CleanupTemp() { if (m_pTempFile != LargeRAWFile_ptr()) m_pTempFile->Delete(); } namespace { template void size_vector_for_io(std::vector& v, size_t sz) { v.resize(sz / sizeof(T)); } } size_t RasterDataBlock::GetBrickByteSize(const std::vector& vLOD, const std::vector& vBrick) const { vector vSize = GetBrickSize(vLOD,vBrick); uint64_t iSize = ComputeElementSize()/8; for (size_t i = 0;i(iSize); } LargeRAWFile_ptr RasterDataBlock::SeekToBrick(const std::vector& vLOD, const std::vector& vBrick) const { if (m_pTempFile == LargeRAWFile_ptr() && m_pStreamFile == LargeRAWFile_ptr()) return LargeRAWFile_ptr(); if (m_vLODOffsets.empty()) { return LargeRAWFile_ptr(); } LargeRAWFile_ptr pStreamFile; uint64_t iOffset = GetLocalDataPointerOffset(vLOD, vBrick)/8; if (m_pStreamFile) { // add global offset iOffset += m_iOffset; // add size of header iOffset += DataBlock::GetOffsetToNextBlock() + ComputeHeaderSize(); pStreamFile = m_pStreamFile; } else { pStreamFile = m_pTempFile; } pStreamFile->SeekPos(iOffset); return pStreamFile; } bool RasterDataBlock::GetData(uint8_t* vData, size_t bytes, const std::vector& vLOD, const std::vector& vBrick) const { LargeRAWFile_ptr pStreamFile = SeekToBrick(vLOD, vBrick); if(!pStreamFile) { return false; } pStreamFile->ReadRAW(vData, bytes); return true; } bool RasterDataBlock::ValidLOD(const std::vector& vLOD) const { const uint64_t lod = Serialize(vLOD, ulLODLevelCount); const size_t lod_s = static_cast(lod); if(lod_s >= m_vBrickSizes.size()) { return false; } return true; } bool RasterDataBlock::ValidBrickIndex(const std::vector& vLOD, const std::vector& vBrick) const { const uint64_t lod = Serialize(vLOD, ulLODLevelCount); const size_t lod_s = static_cast(lod); if(lod_s >= m_vBrickSizes.size()) { return false; } const uint64_t b_idx = Serialize(vBrick, m_vBrickCount[lod_s]); const size_t b_idx_s = static_cast(b_idx); const uint64_t count = std::accumulate(m_vBrickCount[lod_s].begin(), m_vBrickCount[lod_s].end(), static_cast(1), std::multiplies()); if(b_idx_s >= count) { return false; } return true; } bool RasterDataBlock::GetData(std::vector& vData, const std::vector& vLOD, const std::vector& vBrick) const { if(!ValidBrickIndex(vLOD, vBrick)) { return false; } size_t iSize = GetBrickByteSize(vLOD, vBrick); size_vector_for_io(vData, iSize); return GetData(&vData[0], iSize, vLOD, vBrick); } bool RasterDataBlock::GetData(std::vector& vData, const std::vector& vLOD, const std::vector& vBrick) const { if(!ValidBrickIndex(vLOD, vBrick)) { return false; } const size_t bytes = GetBrickByteSize(vLOD, vBrick); size_vector_for_io(vData, bytes); return GetData(reinterpret_cast(&vData[0]), bytes, vLOD, vBrick); } bool RasterDataBlock::GetData(std::vector& vData, const std::vector& vLOD, const std::vector& vBrick) const { if(!ValidBrickIndex(vLOD, vBrick)) { return false; } const size_t bytes = GetBrickByteSize(vLOD, vBrick); size_vector_for_io(vData, bytes); return GetData(reinterpret_cast(&vData[0]), bytes, vLOD, vBrick); } bool RasterDataBlock::GetData(std::vector& vData, const std::vector& vLOD, const std::vector& vBrick) const { if(!ValidBrickIndex(vLOD, vBrick)) { return false; } const size_t bytes = GetBrickByteSize(vLOD, vBrick); size_vector_for_io(vData, bytes); return GetData(reinterpret_cast(&vData[0]), bytes, vLOD, vBrick); } bool RasterDataBlock::GetData(std::vector& vData, const std::vector& vLOD, const std::vector& vBrick) const { if(!ValidBrickIndex(vLOD, vBrick)) { return false; } const size_t bytes = GetBrickByteSize(vLOD, vBrick); size_vector_for_io(vData, bytes); return GetData(reinterpret_cast(&vData[0]), bytes, vLOD, vBrick); } bool RasterDataBlock::GetData(std::vector& vData, const std::vector& vLOD, const std::vector& vBrick) const { if(!ValidBrickIndex(vLOD, vBrick)) { return false; } const size_t bytes = GetBrickByteSize(vLOD, vBrick); size_vector_for_io(vData, bytes); return GetData(reinterpret_cast(&vData[0]), bytes, vLOD, vBrick); } bool RasterDataBlock::GetData(std::vector& vData, const std::vector& vLOD, const std::vector& vBrick) const { if(!ValidBrickIndex(vLOD, vBrick)) { return false; } const size_t bytes = GetBrickByteSize(vLOD, vBrick); size_vector_for_io(vData, bytes); return GetData(reinterpret_cast(&vData[0]), bytes, vLOD, vBrick); } bool RasterDataBlock::GetData(std::vector& vData, const std::vector& vLOD, const std::vector& vBrick) const { if(!ValidBrickIndex(vLOD, vBrick)) { return false; } const size_t bytes = GetBrickByteSize(vLOD, vBrick); size_vector_for_io(vData, bytes); return GetData(reinterpret_cast(&vData[0]), bytes, vLOD, vBrick); } bool RasterDataBlock::Settable() const { return m_pStreamFile && m_pStreamFile->IsWritable() && !m_vLODOffsets.empty(); } bool RasterDataBlock::SetData( int8_t* pData, const vector& vLOD, const vector& vBrick) { if(!Settable()) { return false; } SeekToBrick(vLOD, vBrick); uint64_t sz = GetBrickByteSize(vLOD, vBrick); return m_pStreamFile->WriteRAW(reinterpret_cast(pData), sz) == sz; } bool RasterDataBlock::SetData(uint8_t* pData, const vector& vLOD, const vector& vBrick) { if(!Settable()) { return false; } SeekToBrick(vLOD, vBrick); uint64_t sz = GetBrickByteSize(vLOD, vBrick); return m_pStreamFile->WriteRAW(pData, sz) == sz;; } bool RasterDataBlock::SetData(int16_t* pData, const std::vector& vLOD, const std::vector& vBrick) { if(!Settable()) { return false; } SeekToBrick(vLOD, vBrick); uint64_t sz = GetBrickByteSize(vLOD, vBrick); return m_pStreamFile->WriteRAW(reinterpret_cast(pData), sz) == sz; } bool RasterDataBlock::SetData(uint16_t* pData, const std::vector& vLOD, const std::vector& vBrick) { if(!Settable()) { return false; } SeekToBrick(vLOD, vBrick); uint64_t sz = GetBrickByteSize(vLOD, vBrick); return m_pStreamFile->WriteRAW(reinterpret_cast(pData), sz) == sz; } bool RasterDataBlock::SetData(int32_t* pData, const std::vector& vLOD, const std::vector& vBrick) { if(!Settable()) { return false; } SeekToBrick(vLOD, vBrick); uint64_t sz = GetBrickByteSize(vLOD, vBrick); return m_pStreamFile->WriteRAW(reinterpret_cast(pData), sz) == sz; } bool RasterDataBlock::SetData(uint32_t* pData, const std::vector& vLOD, const std::vector& vBrick) { if(!Settable()) { return false; } SeekToBrick(vLOD, vBrick); uint64_t sz = GetBrickByteSize(vLOD, vBrick); return m_pStreamFile->WriteRAW(reinterpret_cast(pData), sz) == sz; } bool RasterDataBlock::SetData(float* pData, const std::vector& vLOD, const std::vector& vBrick) { if(!Settable()) { return false; } SeekToBrick(vLOD, vBrick); uint64_t sz = GetBrickByteSize(vLOD, vBrick); return m_pStreamFile->WriteRAW(reinterpret_cast(pData), sz) == sz; } bool RasterDataBlock::SetData(double* pData, const std::vector& vLOD, const std::vector& vBrick) { if(!Settable()) { return false; } SeekToBrick(vLOD, vBrick); uint64_t sz = GetBrickByteSize(vLOD, vBrick); return m_pStreamFile->WriteRAW(reinterpret_cast(pData), sz) == sz; } void RasterDataBlock::ResetFile(LargeRAWFile_ptr raw) { CleanupTemp(); m_pStreamFile = m_pSourceFile = raw; } bool RasterDataBlock::ApplyFunction(const std::vector& vLOD, bool (*brickFunc)(void* pData, const UINT64VECTOR3& vBrickSize, const UINT64VECTOR3& vBrickOffset, void* pUserContext), void* pUserContext, uint64_t iOverlap, AbstrDebugOut* pDebugOut) const { #ifdef _DEBUG for (size_t i = 0;i vBrickCount = GetBrickCount(vLOD); vector vCoords(vBrickCount.size()); std::vector pData; // generate 1D offset coords into serialized target data vector vPrefixProd; vPrefixProd.push_back(1); uint64_t iBrickCount = vBrickCount[0]; vector vLODDomSize = GetLODDomainSize(vLOD); for (size_t i = 1;i& vLOD, const std::string& strTargetFile, bool bAppend, AbstrDebugOut* pDebugOut) const { LargeRAWFile_ptr pTargetFile = LargeRAWFile_ptr(new LargeRAWFile(strTargetFile)); if (bAppend) pTargetFile->Append(); else pTargetFile->Create(); if (!pTargetFile->IsOpen()) { if (pDebugOut) pDebugOut->Error(_func_,"Unable to write to target file %s.", strTargetFile.c_str()); return false; } const vector vBrickCount = GetBrickCount(vLOD); vector vCoords(vBrickCount.size()); std::vector pData; // generate 1D offset coords into serialized target data vector vPrefixProd; vPrefixProd.push_back(1); uint64_t iBrickCount = vBrickCount[0]; vector vLODDomSize = GetLODDomainSize(vLOD); for (size_t i = 1;iGetCurrentSize(); uint64_t iBrickCounter = 0; TraverseBricksToWriteBrickToFile(iBrickCounter, iBrickCount, vLOD, vBrickCount, vCoords, vBrickCount.size()-1, iTargetOffset, pData, pTargetFile, iElementSize/8, vPrefixProd, pDebugOut); pTargetFile->Close(); return true; } bool RasterDataBlock::TraverseBricksToApplyFunction( uint64_t& iBrickCounter, uint64_t iBrickCount, const std::vector& vLOD, const std::vector& vBrickCount, std::vector vCoords, size_t iCurrentDim, std::vector& vData, uint64_t iElementSize, const std::vector& vPrefixProd, AbstrDebugOut* pDebugOut, bool (*brickFunc)(void* pData, const UINT64VECTOR3& vBrickSize, const UINT64VECTOR3& vBrickOffset, void* pUserContext), void* pUserContext, uint64_t iOverlap ) const { if (iCurrentDim>0) { for (size_t i = 0;i vBrickSize = GetBrickSize(vLOD, vCoords); std::vector vEffectiveBrickSize = vBrickSize; for (size_t j = 0;j vDataOverlapFixed(vData.size()); std::vector vBrickPrefixProduct(vCoords); vBrickPrefixProduct[0] = 1; for (size_t j = 1;jMessage(_func_, "Extracting volume data\nProcessing brick %i of %i",int(++iBrickCounter),int(iBrickCount)); WriteBrickToArray(vBrickCount.size()-1, iSourceOffset, iTargetOffset, vBrickSize, vEffectiveBrickSize, vData, vDataOverlapFixed, iElementSize, vPrefixProd, vBrickPrefixProduct); std::vector vAbsCoords(vCoords); for (size_t j = 0;jMessage(_func_, "Processing volume data\nProcessing brick %i of %i",int(iBrickCounter),int(iBrickCount)); if (!brickFunc(&vDataOverlapFixed[0], UINT64VECTOR3(vEffectiveBrickSize), UINT64VECTOR3(vAbsCoords), pUserContext )) return false; } } return true; } bool RasterDataBlock::TraverseBricksToWriteBrickToFile( uint64_t& iBrickCounter, uint64_t iBrickCount, const std::vector& vLOD, const std::vector& vBrickCount, std::vector vCoords, size_t iCurrentDim, uint64_t iTargetOffset, std::vector& vData, LargeRAWFile_ptr pTargetFile, uint64_t iElementSize, const std::vector& vPrefixProd, AbstrDebugOut* pDebugOut ) const { if (iCurrentDim>0) { for (size_t i = 0;i vBrickSize = GetBrickSize(vLOD, vCoords); std::vector vEffectiveBrickSize = vBrickSize; for (size_t j = 0;j vBrickPrefixProduct(vCoords); vBrickPrefixProduct[0] = 1; for (size_t j = 1;jMessage(_func_, "Processing brick %i of %i",int(++iBrickCounter),int(iBrickCount)); WriteBrickToFile(vBrickCount.size()-1, iSourceOffset, iTargetOffset, vBrickSize, vEffectiveBrickSize, vData, pTargetFile, iElementSize, vPrefixProd, vBrickPrefixProduct, true); iTargetOffset += vEffectiveBrickSize[0]; } } return true; } void RasterDataBlock::WriteBrickToFile(size_t iCurrentDim, uint64_t& iSourceOffset, uint64_t& iTargetOffset, const std::vector& vBrickSize, const std::vector& vEffectiveBrickSize, std::vector& vData, LargeRAWFile_ptr pTargetFile, uint64_t iElementSize, const std::vector& vPrefixProd, const std::vector& vBrickPrefixProduct, bool bDoSeek) const { if (iCurrentDim>0) { for (size_t i = 0;iSeekPos(iTargetOffset*iElementSize); pTargetFile->WriteRAW(&(vData.at(size_t(iSourceOffset*iElementSize))), vEffectiveBrickSize[0]*iElementSize); iSourceOffset += vBrickSize[0]; } } void RasterDataBlock::WriteBrickToArray(size_t iCurrentDim, uint64_t& iSourceOffset, uint64_t& iTargetOffset, const std::vector& vBrickSize, const std::vector& vEffectiveBrickSize, std::vector& vData, std::vector& vTarget, uint64_t iElementSize, const std::vector& vPrefixProd, const std::vector& vBrickPrefixProduct) const { if (iCurrentDim>0) { for (size_t i = 0;iSeekPos(iStart); uint64_t ulElementCount; pStreamFile->ReadData(ulElementCount, bIsBigEndian); m_vHistData.resize(size_t(ulElementCount)); pStreamFile->ReadRAW((unsigned char*)&m_vHistData[0], ulElementCount*sizeof(uint64_t)); return pStreamFile->GetPos() - iOffset; } bool Histogram1DDataBlock::Compute(const TOCBlock* source, uint64_t iLevel) { // do not try to compute a histogram for floating point data, // anything beyond 32 bit or more than 1 component data if (source->GetComponentType() == ExtendedOctree::CT_FLOAT32 || source->GetComponentType() == ExtendedOctree::CT_FLOAT64 || source->GetComponentTypeSize() > 4 || source->GetComponentCount() != 1) return false; // resize histogram size_t iValueRange = size_t(MathTools::Pow2(uint64_t(source->GetComponentTypeSize()*8))); m_vHistData.resize(iValueRange); if (m_vHistData.size() != iValueRange) return false; std::fill(m_vHistData.begin(), m_vHistData.end(), 0); // compute histogram switch (source->GetComponentType()) { case ExtendedOctree::CT_UINT8: ComputeTemplate(source, iLevel); break; case ExtendedOctree::CT_UINT16: ComputeTemplate(source, iLevel); break; case ExtendedOctree::CT_UINT32: ComputeTemplate(source, iLevel); break; case ExtendedOctree::CT_UINT64: ComputeTemplate(source, iLevel); break; case ExtendedOctree::CT_INT8: ComputeTemplate(source, iLevel); break; case ExtendedOctree::CT_INT16: ComputeTemplate(source, iLevel); break; case ExtendedOctree::CT_INT32: ComputeTemplate(source, iLevel); break; case ExtendedOctree::CT_INT64: ComputeTemplate(source, iLevel); break; case ExtendedOctree::CT_FLOAT32: ComputeTemplate(source, iLevel); break; case ExtendedOctree::CT_FLOAT64: ComputeTemplate(source, iLevel); break; } // find maximum-index non zero entry and clip histogram data size_t iSize = 0; for (size_t i = 0;istrBlockID; return true; } template void Histogram1DDataBlock::ComputeTemplate(const TOCBlock* source, uint64_t iLevel) { // compute histogram by iterating over all bricks of the given level UINT64VECTOR3 bricksInSourceLevel = source->GetBrickCount(iLevel); size_t iCompcount = size_t(source->GetComponentCount()); T* pTempBrickData = new T[size_t(source->GetMaxBrickSize().volume()) *iCompcount]; uint32_t iOverlap =source->GetOverlap(); ProgressTimer timer; timer.Start(); for (uint64_t bz = 0;bzGetData((uint8_t*)pTempBrickData, brickCoords); UINTVECTOR3 bricksize = UINTVECTOR3(source->GetBrickSize(brickCoords)); for (uint32_t z = iOverlap;z maxTargetSize) { // compute the smallest integer that reduces m_vHistData.size // under the maxTargetSize threshold, we want an integer to // avoid an uneven combination of histogram bins size_t reduction = size_t(ceil( double(m_vHistData.size()) / double(maxTargetSize))); size_t newSize = size_t(ceil(double(m_vHistData.size())/double(reduction))); std::vector tempHist(newSize); for (size_t i = 0;iulElementDimension != 1 || source->ulElementDimensionSize.size() != 1) return false; /// \todo right now compute Histogram assumes that at least the // lowest LOD level consists only of a single brick, this brick is // used for the hist.-computation this should be changed to a more // general approach vector vSmallestLOD = source->GetSmallestBrickIndex(); const vector& vBricks = source->GetBrickCount(vSmallestLOD); for (size_t i = 0;iulElementBitSize[0][0])); m_vHistData.resize(iValueRange); if (m_vHistData.size() != iValueRange) return false; std::fill(m_vHistData.begin(), m_vHistData.end(), 0); // LargestSingleBrickLODBrickIndex is well defined as we tested above // if we have a single brick LOD std::vector vcSourceData; vector vLOD = source->LargestSingleBrickLODBrickIndex(); vector vOneAndOnly; for (size_t i = 0;iGetData(vcSourceData, vLOD, vOneAndOnly)) return false; vector vSize = source->LargestSingleBrickLODBrickSize(); uint64_t iDataSize = 1; for (size_t i = 0;iulElementBitSize[0][0] == 8) { for (uint64_t i = 0;iulElementBitSize[0][0] == 16) { unsigned short *psSourceData = (unsigned short*)(&(vcSourceData.at(0))); for (uint64_t i = 0;istrBlockID; return true; } void Histogram1DDataBlock::CopyHeaderToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock) { DataBlock::CopyHeaderToFile(pStreamFile, iOffset, bIsBigEndian, bIsLastBlock); uint64_t ulElementCount = uint64_t(m_vHistData.size()); pStreamFile->WriteData(ulElementCount, bIsBigEndian); } uint64_t Histogram1DDataBlock::CopyToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock) { CopyHeaderToFile(pStreamFile, iOffset, bIsBigEndian, bIsLastBlock); pStreamFile->WriteRAW((unsigned char*)&m_vHistData[0], m_vHistData.size()*sizeof(uint64_t)); return pStreamFile->GetPos() - iOffset; } uint64_t Histogram1DDataBlock::GetOffsetToNextBlock() const { return DataBlock::GetOffsetToNextBlock() + ComputeDataSize(); } uint64_t Histogram1DDataBlock::ComputeDataSize() const { return sizeof(uint64_t) + // length of the vector m_vHistData.size()*sizeof(uint64_t); // the vector itself } ImageVis3D-3.1.0/Tuvok/IO/UVF/GlobalHeader.cpp0000644000175000017500000000465212320456500020360 0ustar mathieumathieu#include "GlobalHeader.h" using namespace std; using namespace UVFTables; GlobalHeader::GlobalHeader() : bIsBigEndian(false), ulFileVersion(0), ulChecksumSemanticsEntry(CS_NONE), ulAdditionalHeaderSize(0), ulOffsetToFirstDataBlock(0) {} GlobalHeader::GlobalHeader(const GlobalHeader &other) : bIsBigEndian(other.bIsBigEndian), ulFileVersion(other.ulFileVersion), ulChecksumSemanticsEntry(other.ulChecksumSemanticsEntry), vcChecksum(other.vcChecksum), ulAdditionalHeaderSize(other.ulAdditionalHeaderSize), ulOffsetToFirstDataBlock(other.ulOffsetToFirstDataBlock) { } GlobalHeader& GlobalHeader::operator=(const GlobalHeader& other) { bIsBigEndian = other.bIsBigEndian; ulFileVersion = other.ulFileVersion; ulChecksumSemanticsEntry = other.ulChecksumSemanticsEntry; ulAdditionalHeaderSize = other.ulAdditionalHeaderSize; ulOffsetToFirstDataBlock = other.ulOffsetToFirstDataBlock; vcChecksum = other.vcChecksum; return *this; } uint64_t GlobalHeader::GetDataPos() { return 8 + GetSize(); } void GlobalHeader::GetHeaderFromFile(LargeRAWFile_ptr pStreamFile) { pStreamFile->ReadData(bIsBigEndian, false); pStreamFile->ReadData(ulFileVersion, bIsBigEndian); uint64_t uintSem; pStreamFile->ReadData(uintSem, bIsBigEndian); ulChecksumSemanticsEntry = (ChecksumSemanticTable)uintSem; uint64_t ulChecksumLength; pStreamFile->ReadData(ulChecksumLength, bIsBigEndian); pStreamFile->ReadData(vcChecksum, ulChecksumLength, bIsBigEndian); pStreamFile->ReadData(ulOffsetToFirstDataBlock, bIsBigEndian); } void GlobalHeader::CopyHeaderToFile(LargeRAWFile_ptr pStreamFile) { pStreamFile->WriteData(bIsBigEndian, false); pStreamFile->WriteData(ulFileVersion, bIsBigEndian); pStreamFile->WriteData(uint64_t(ulChecksumSemanticsEntry), bIsBigEndian); pStreamFile->WriteData(uint64_t(vcChecksum.size()), bIsBigEndian); pStreamFile->WriteData(vcChecksum, bIsBigEndian); pStreamFile->WriteData(ulOffsetToFirstDataBlock, bIsBigEndian); } uint64_t GlobalHeader::GetSize() { return GetMinSize() + vcChecksum.size() + ulOffsetToFirstDataBlock; } uint64_t GlobalHeader::GetMinSize() { return sizeof(bool) + 4 * sizeof(uint64_t); } void GlobalHeader::UpdateChecksum(vector checksum, LargeRAWFile_ptr pStreamFile) { vcChecksum = checksum; uint64_t ulLastPos = pStreamFile->GetPos(); pStreamFile->SeekPos(33); pStreamFile->WriteData(vcChecksum, bIsBigEndian); pStreamFile->SeekPos(ulLastPos); } ImageVis3D-3.1.0/Tuvok/IO/UVF/MaxMinDataBlock.h0000644000175000017500000000341212320456500020443 0ustar mathieumathieu#pragma once #ifndef MAXMINDATABLOCK_H #define MAXMINDATABLOCK_H #include #include "DataBlock.h" #include "Basics/MinMaxBlock.h" #include "Basics/Vectors.h" #include "ExtendedOctree/ExtendedOctreeConverter.h" typedef std::vector MinMaxComponent; typedef std::vector MaxMinVec; class MaxMinDataBlock : public DataBlock { public: MaxMinDataBlock(size_t iComponentCount); ~MaxMinDataBlock(); MaxMinDataBlock(const MaxMinDataBlock &other); MaxMinDataBlock(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian); virtual MaxMinDataBlock& operator=(const MaxMinDataBlock& other); virtual uint64_t ComputeDataSize() const; const tuvok::MinMaxBlock& GetValue(size_t iIndex, size_t iComponent=0) const; void StartNewValue(); void MergeData(const std::vector& fMaxMinData); void SetDataFromFlatVector(BrickStatVec& source, uint64_t iComponentCount); const tuvok::MinMaxBlock& GetGlobalValue(size_t iComponent=0) const { return m_GlobalMaxMin[iComponent]; } size_t GetComponentCount() const { return m_iComponentCount; } protected: std::vector m_GlobalMaxMin; MaxMinVec m_vfMaxMinData; size_t m_iComponentCount; virtual uint64_t GetHeaderFromFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian); virtual uint64_t CopyToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock); virtual uint64_t GetOffsetToNextBlock() const; virtual DataBlock* Clone() const; void MergeData(const tuvok::MinMaxBlock& data, const size_t iComponent); void ResetGlobal(); void SetComponentCount(size_t iComponentCount); }; #endif // MAXMINDATABLOCK_H ImageVis3D-3.1.0/Tuvok/IO/UVF/UVFTables.cpp0000644000175000017500000001314712320456500017641 0ustar mathieumathieu#include "UVFTables.h" using namespace std; #include "DataBlock.h" #include "RasterDataBlock.h" #include "Histogram1DDataBlock.h" #include "Histogram2DDataBlock.h" #include "KeyValuePairDataBlock.h" #include "MaxMinDataBlock.h" #include "GeometryDataBlock.h" #include "TOCBlock.h" string UVFTables::ChecksumSemanticToCharString(ChecksumSemanticTable uiTable) { switch (uiTable) { case (CS_NONE) : return "none"; case (CS_CRC32) : return "CRC32"; case (CS_MD5) : return "MD5"; default : return "Unknown"; } } wstring UVFTables::ChecksumSemanticToString(ChecksumSemanticTable uiTable) { string charString = ChecksumSemanticToCharString(uiTable); wstring result(charString.begin(), charString.end()); return result; } uint64_t UVFTables::ChecksumElemLength(ChecksumSemanticTable uiTable) { switch (uiTable) { case (CS_NONE) : return 0; case (CS_CRC32) : return 32/8; case (CS_MD5) : return 128/8; default : throw "ChecksumElemLength: Unknown Checksum type"; } } string UVFTables::CompressionSemanticToCharString(CompressionSemanticTable uiTable) { switch (uiTable) { case (COS_NONE) : return "none"; default : return "Unknown"; } } wstring UVFTables::CompressionSemanticToString(CompressionSemanticTable uiTable) { string charString = CompressionSemanticToCharString(uiTable); wstring result(charString.begin(), charString.end()); return result; } string UVFTables::BlockSemanticTableToCharString(BlockSemanticTable uiTable) { switch (uiTable) { case (BS_EMPTY) : return "Empty"; case (BS_REG_NDIM_GRID) : return "Regular N-Dimensional Grid"; case (BS_NDIM_TRANSFER_FUNC) : return "N-Dimensional Transfer function"; case (BS_PREVIEW_IMAGE) : return "Preview Image"; case (BS_KEY_VALUE_PAIRS) : return "8bit String Key/Value Pairs"; case (BS_1D_HISTOGRAM) : return "Histogram (1D)"; case (BS_2D_HISTOGRAM) : return "Histogram (2D)"; case (BS_MAXMIN_VALUES) : return "Brick Max/Min Values"; case (BS_GEOMETRY) : return "Geometry"; default : return "Unknown"; } } wstring UVFTables::BlockSemanticTableToString(BlockSemanticTable uiTable) { string charString = BlockSemanticTableToCharString(uiTable); wstring result(charString.begin(), charString.end()); return result; } std::shared_ptr UVFTables::CreateBlockFromSemanticEntry(BlockSemanticTable uiTable, LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, uint64_t iUVFFileVersion) { DataBlock* d; switch (uiTable) { case BS_EMPTY: d = new DataBlock(pStreamFile, iOffset, bIsBigEndian); break; case BS_REG_NDIM_GRID: /* fall through */ case BS_NDIM_TRANSFER_FUNC: /* fall through */ case BS_PREVIEW_IMAGE: d = new RasterDataBlock(pStreamFile, iOffset, bIsBigEndian); break; case BS_1D_HISTOGRAM: d = new Histogram1DDataBlock(pStreamFile, iOffset, bIsBigEndian); break; case BS_2D_HISTOGRAM: d = new Histogram2DDataBlock(pStreamFile, iOffset, bIsBigEndian); break; case BS_KEY_VALUE_PAIRS: d = new KeyValuePairDataBlock(pStreamFile, iOffset, bIsBigEndian); break; case BS_MAXMIN_VALUES: d = new MaxMinDataBlock(pStreamFile, iOffset, bIsBigEndian); break; case BS_GEOMETRY: d = new GeometryDataBlock(pStreamFile, iOffset, bIsBigEndian); break; case BS_TOC_BLOCK: d = new TOCBlock(pStreamFile, iOffset, bIsBigEndian, iUVFFileVersion); break; default: throw "CreateBlockFromSemanticEntry: Unknown block semantic"; } return std::shared_ptr(d); } string UVFTables::DomainSemanticToCharString(DomainSemanticTable uiTable) { switch (uiTable) { case (DS_NONE) : return "Empty"; case (DS_X) : return "X"; case (DS_Y) : return "Y"; case (DS_Z) : return "Z"; case (DS_TIME) : return "Time"; default : return "Unknown"; } } wstring UVFTables::DomainSemanticToString(DomainSemanticTable uiTable) { string charString = DomainSemanticToCharString(uiTable); wstring result(charString.begin(), charString.end()); return result; } string UVFTables::ElementSemanticTableToCharString(ElementSemanticTable uiTable) { switch (uiTable) { case (ES_UNDEFINED) : return "Undefined"; case (ES_VECTOR) : return "General Vector Value"; case (ES_TENSOR) : return "General Tensor Value"; case (ES_SYM_TENSOR) : return "Symmetric Tensor Value"; case (ES_RED) : return "Color Component Red"; case (ES_GREEN) : return "Color Component Green"; case (ES_BLUE) : return "Color Component Blue"; case (ES_ALPHA) : return "Color Component Alpha"; case (ES_MR) : return "MR"; case (ES_CT) : return "CT"; case (ES_TIME) : return "Time (Second)"; case (ES_MASS) : return "Mass (Kilogram)"; case (ES_ELECTRIC_CURRENT) : return "Electric Current (Ampere)"; case (ES_THERMODYNAMIC_TEMPERATURE) : return "Thermodynamic Temperature (Kelvin)"; case (ES_AMOUNT_OF_SUBSTANCE) : return "Amount of substance (Mole)"; case (ES_LUMINOUS_INTENSITY) : return "Luminous Intensity (Candela)"; default : return "Unknown"; } } wstring UVFTables::ElementSemanticTableToString(ElementSemanticTable uiTable) { string charString = ElementSemanticTableToCharString(uiTable); wstring result(charString.begin(), charString.end()); return result; } ImageVis3D-3.1.0/Tuvok/IO/UVF/KeyValuePairDataBlock.cpp0000644000175000017500000000727212320456500022156 0ustar mathieumathieu#include "KeyValuePairDataBlock.h" using namespace std; using namespace UVFTables; KeyValuePairDataBlock::KeyValuePairDataBlock() { ulBlockSemantics = BS_KEY_VALUE_PAIRS; strBlockID = "KeyValue Pair Block"; } KeyValuePairDataBlock::KeyValuePairDataBlock(const KeyValuePairDataBlock &other) : DataBlock(other), m_KeyValuePairs(other.m_KeyValuePairs) { } KeyValuePairDataBlock::KeyValuePairDataBlock(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian) { GetHeaderFromFile(pStreamFile, iOffset, bIsBigEndian); } KeyValuePairDataBlock& KeyValuePairDataBlock::operator=(const KeyValuePairDataBlock& other) { strBlockID = other.strBlockID; ulBlockSemantics = other.ulBlockSemantics; ulCompressionScheme = other.ulCompressionScheme; ulOffsetToNextDataBlock = other.ulOffsetToNextDataBlock; m_KeyValuePairs = other.m_KeyValuePairs; return *this; } uint64_t KeyValuePairDataBlock::GetHeaderFromFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian) { uint64_t iStart = iOffset + DataBlock::GetHeaderFromFile(pStreamFile, iOffset, bIsBigEndian); pStreamFile->SeekPos(iStart); uint64_t ulElementCount; pStreamFile->ReadData(ulElementCount, bIsBigEndian); for (uint64_t i = 0;iReadData(iStrLength, bIsBigEndian); // Use a damn RasterDataBlock if it doesn't, weirdo. This isn't meant for // storing gigabytes of data. assert(iStrLength <= 4294967296ULL && "value must fit in 32bit address space."); pStreamFile->ReadData(key, iStrLength); pStreamFile->ReadData(iStrLength, bIsBigEndian); assert(iStrLength <= 4294967296ULL && "value must fit in 32bit address space."); pStreamFile->ReadData(value, iStrLength); KeyValuePair p(key, value); m_KeyValuePairs.push_back(p); } return pStreamFile->GetPos() - iOffset; } void KeyValuePairDataBlock::CopyHeaderToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock) { DataBlock::CopyHeaderToFile(pStreamFile, iOffset, bIsBigEndian, bIsLastBlock); pStreamFile->WriteData(uint64_t(m_KeyValuePairs.size()), bIsBigEndian); } uint64_t KeyValuePairDataBlock::CopyToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock) { CopyHeaderToFile(pStreamFile, iOffset, bIsBigEndian, bIsLastBlock); for (size_t i = 0;iWriteData(uint64_t(key.length()), bIsBigEndian); pStreamFile->WriteData(key); pStreamFile->WriteData(uint64_t(value.length()), bIsBigEndian); pStreamFile->WriteData(value); } return pStreamFile->GetPos() - iOffset; } DataBlock* KeyValuePairDataBlock::Clone() const { return new KeyValuePairDataBlock(*this); } uint64_t KeyValuePairDataBlock::GetOffsetToNextBlock() const { return DataBlock::GetOffsetToNextBlock() + ComputeDataSize(); } uint64_t KeyValuePairDataBlock::ComputeDataSize() const { uint64_t iCharCount = 0; for (size_t i = 0;i #include "GeometryDataBlock.h" #include "UVF.h" using namespace std; using namespace UVFTables; GeometryDataBlock::GeometryDataBlock() : DataBlock(), verticesValid(false), normalsValid(false), texcoordsValid(false), colorsValid(false), vertexIValid(false), normalIValid(false), texcoordIValid(false), colorIValid(false), m_n_vertices(0), m_n_normals(0), m_n_texcoords(0), m_n_colors(0), m_n_vertex_indices(0), m_n_normal_indices(0), m_n_texcoord_indices(0), m_n_color_indices(0) { ulBlockSemantics = BS_GEOMETRY; strBlockID = "Geometry Block"; m_DefaultColor.push_back(1); m_DefaultColor.push_back(1); m_DefaultColor.push_back(1); m_DefaultColor.push_back(1); } GeometryDataBlock::GeometryDataBlock(const GeometryDataBlock& other) : DataBlock(other), m_Desc(other.m_Desc), vertices(other.GetVertices()), normals(other.GetNormals()), texcoords(other.GetTexCoords()), colors(other.GetColors()), vIndices(other.GetVertexIndices()), nIndices(other.GetNormalIndices()), tIndices(other.GetTexCoordIndices()), cIndices(other.GetColorIndices()), verticesValid(true), normalsValid(true), texcoordsValid(true), colorsValid(true), vertexIValid(true), normalIValid(true), texcoordIValid(true), colorIValid(true), m_DefaultColor(other.m_DefaultColor), m_PolySize(other.m_PolySize), m_bIsBigEndian(other.m_bIsBigEndian), m_n_vertices(0), m_n_normals(0), m_n_texcoords(0), m_n_colors(0), m_n_vertex_indices(0), m_n_normal_indices(0), m_n_texcoord_indices(0), m_n_color_indices(0) { } GeometryDataBlock::GeometryDataBlock(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian) : DataBlock(pStreamFile, iOffset, bIsBigEndian), verticesValid(false), normalsValid(false), texcoordsValid(false), colorsValid(false), vertexIValid(false), normalIValid(false), texcoordIValid(false), colorIValid(false) { m_DefaultColor.resize(4); GetHeaderFromFile(pStreamFile, iOffset, bIsBigEndian); } GeometryDataBlock::~GeometryDataBlock() { vertices.clear(); normals.clear(); texcoords.clear(); colors.clear(); vIndices.clear(); nIndices.clear(); tIndices.clear(); cIndices.clear(); } GeometryDataBlock& GeometryDataBlock::operator=(const GeometryDataBlock& other) { strBlockID = other.strBlockID; ulBlockSemantics = other.ulBlockSemantics; vertices = other.GetVertices(); normals = other.GetNormals(); texcoords = other.GetTexCoords(); colors = other.GetColors(); vIndices = other.GetVertexIndices(); nIndices = other.GetNormalIndices(); tIndices = other.GetTexCoordIndices(); cIndices = other.GetColorIndices(); verticesValid = true; normalsValid = true; texcoordsValid = true; colorsValid = true; vertexIValid = true; normalIValid = true; texcoordIValid = true; colorIValid = true; m_n_vertices = 0; m_n_normals = 0; m_n_texcoords = 0; m_n_colors = 0; m_n_vertex_indices = 0; m_n_normal_indices = 0; m_n_texcoord_indices = 0; m_n_color_indices = 0; m_PolySize = other.m_PolySize; return *this; } bool GeometryDataBlock::Verify(uint64_t iSizeofData, string* pstrProblem) const { uint64_t iCorrectSize = ComputeDataSize(); bool bResult = iCorrectSize == iSizeofData; if (!bResult && pstrProblem != NULL) { stringstream s; s << "GeometryDataBlock::Verify: size mismatch. Should be " << iCorrectSize << " but parameter was " << iSizeofData << "."; *pstrProblem = s.str(); } return bResult; } uint64_t GeometryDataBlock::ComputeHeaderSize() const { // n_vertices + n_normals + n_texcoords + n_colors + n_vertices_indices + // n_normals_indices + n_texcoords_indices + n_colors_indices + // m_DefaultColor + desc + // polysize return sizeof(uint64_t) * 8 + 4 * sizeof(float) + sizeof(uint64_t) + m_Desc.size() * sizeof(char)+ sizeof(uint64_t); } uint64_t GeometryDataBlock::ComputeDataSize() const { return sizeof(float) * (verticesValid ? vertices.size() : m_n_vertices) + // 3d vertices sizeof(float) * (normalsValid ? normals.size() : m_n_normals) + // 3d normals sizeof(float) * (texcoordsValid ? texcoords.size() : m_n_texcoords) + // 2d texcoords sizeof(float) * (colorsValid ? colors.size() : m_n_colors) + // 4d colors sizeof(uint32_t) * (vertexIValid ? vIndices.size() : m_n_vertex_indices) + // vertex indices sizeof(uint32_t) * (normalIValid ? nIndices.size() : m_n_normal_indices) + // normal indices sizeof(uint32_t) * (texcoordIValid ? tIndices.size() : m_n_texcoord_indices) + // texcoord indices sizeof(uint32_t) * (colorIValid ? cIndices.size() : m_n_color_indices); // color indices } DataBlock* GeometryDataBlock::Clone() const { return new GeometryDataBlock(*this); } uint64_t GeometryDataBlock::GetHeaderFromFile(LargeRAWFile_ptr stream, uint64_t offset, bool big_endian) { uint64_t start = offset + DataBlock::GetHeaderFromFile(stream, offset, big_endian); stream->SeekPos(start); stream->ReadData(m_n_vertices, big_endian); stream->ReadData(m_n_normals, big_endian); stream->ReadData(m_n_texcoords, big_endian); stream->ReadData(m_n_colors, big_endian); stream->ReadData(m_n_vertex_indices, big_endian); stream->ReadData(m_n_normal_indices, big_endian); stream->ReadData(m_n_texcoord_indices, big_endian); stream->ReadData(m_n_color_indices, big_endian); verticesValid = false; normalsValid = false; texcoordsValid = false; colorsValid = false; vertexIValid = false; normalIValid = false; texcoordIValid = false; colorIValid = false; stream->ReadData(m_DefaultColor[0], big_endian); stream->ReadData(m_DefaultColor[1], big_endian); stream->ReadData(m_DefaultColor[2], big_endian); stream->ReadData(m_DefaultColor[3], big_endian); uint64_t ulStringLengthDesc; m_pStreamFile->ReadData(ulStringLengthDesc, big_endian); m_pStreamFile->ReadData(m_Desc, ulStringLengthDesc); stream->ReadData(m_PolySize, big_endian); m_bIsBigEndian = big_endian; return stream->GetPos() - offset; } void GeometryDataBlock::CopyHeaderToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock) { DataBlock::CopyHeaderToFile(pStreamFile, iOffset, bIsBigEndian, bIsLastBlock); if (verticesValid) m_n_vertices = vertices.size(); if (normalsValid) m_n_normals = normals.size(); if (texcoordsValid) m_n_texcoords = texcoords.size(); if (colorsValid) m_n_colors = colors.size(); if (vertexIValid) m_n_vertex_indices = vIndices.size(); if (normalIValid) m_n_normal_indices = nIndices.size(); if (texcoordIValid) m_n_texcoord_indices = tIndices.size(); if (colorIValid) m_n_color_indices = cIndices.size(); pStreamFile->WriteData(m_n_vertices, bIsBigEndian); pStreamFile->WriteData(m_n_normals, bIsBigEndian); pStreamFile->WriteData(m_n_texcoords, bIsBigEndian); pStreamFile->WriteData(m_n_colors, bIsBigEndian); pStreamFile->WriteData(m_n_vertex_indices, bIsBigEndian); pStreamFile->WriteData(m_n_normal_indices, bIsBigEndian); pStreamFile->WriteData(m_n_texcoord_indices, bIsBigEndian); pStreamFile->WriteData(m_n_color_indices, bIsBigEndian); pStreamFile->WriteData(m_DefaultColor[0], bIsBigEndian); pStreamFile->WriteData(m_DefaultColor[1], bIsBigEndian); pStreamFile->WriteData(m_DefaultColor[2], bIsBigEndian); pStreamFile->WriteData(m_DefaultColor[3], bIsBigEndian); pStreamFile->WriteData(uint64_t(m_Desc.size()),bIsBigEndian); pStreamFile->WriteData(m_Desc); pStreamFile->WriteData(m_PolySize , bIsBigEndian); } uint64_t GeometryDataBlock::CopyToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock) { if (!verticesValid) { SetVertices(GetVertices()); } if (!normalsValid) { SetNormals(GetNormals()); } if (!texcoordsValid) { SetTexCoords(GetTexCoords()); } if (!colorsValid) { SetColors(GetColors()); } if (!vertexIValid) { SetVertexIndices(GetVertexIndices()); } if (!normalIValid) { SetNormalIndices(GetNormalIndices()); } if (!texcoordIValid) { SetTexCoordIndices(GetTexCoordIndices()); } if (!colorIValid) { SetColorIndices(GetColorIndices()); } CopyHeaderToFile(pStreamFile, iOffset, bIsBigEndian, bIsLastBlock); pStreamFile->WriteData(vertices, bIsBigEndian); pStreamFile->WriteData(normals, bIsBigEndian); pStreamFile->WriteData(texcoords,bIsBigEndian); pStreamFile->WriteData(colors, bIsBigEndian); pStreamFile->WriteData(vIndices, bIsBigEndian); pStreamFile->WriteData(nIndices, bIsBigEndian); pStreamFile->WriteData(tIndices, bIsBigEndian); pStreamFile->WriteData(cIndices, bIsBigEndian); m_bIsBigEndian = bIsBigEndian; return pStreamFile->GetPos() - iOffset; } uint64_t GeometryDataBlock::GetOffsetToNextBlock() const { return DataBlock::GetOffsetToNextBlock() + ComputeHeaderSize() + ComputeDataSize(); } vector< float > GeometryDataBlock::GetVertices() const { vector< float > v; if (!verticesValid) { m_pStreamFile->SeekPos(m_iOffset+DataBlock::GetOffsetToNextBlock() + ComputeHeaderSize()); m_pStreamFile->ReadData(v, m_n_vertices, m_bIsBigEndian); return v; } return vertices; } vector< float > GeometryDataBlock::GetNormals() const { vector< float > v; if (!normalsValid) { m_pStreamFile->SeekPos(m_iOffset+DataBlock::GetOffsetToNextBlock() + ComputeHeaderSize()+ sizeof(float)*m_n_vertices); m_pStreamFile->ReadData(v, m_n_normals, m_bIsBigEndian); return v; } return normals; } vector< float > GeometryDataBlock::GetTexCoords() const { vector< float > v; if (!texcoordsValid) { m_pStreamFile->SeekPos(m_iOffset+DataBlock::GetOffsetToNextBlock() + ComputeHeaderSize()+ sizeof(float)*m_n_vertices+ sizeof(float)*m_n_normals); m_pStreamFile->ReadData(v, m_n_texcoords, m_bIsBigEndian); return v; } return texcoords; } vector< float > GeometryDataBlock::GetColors() const { vector< float > v; if (!colorsValid) { m_pStreamFile->SeekPos(m_iOffset+DataBlock::GetOffsetToNextBlock() + ComputeHeaderSize()+ sizeof(float)*m_n_vertices+ sizeof(float)*m_n_normals+ sizeof(float)*m_n_texcoords); m_pStreamFile->ReadData(v, m_n_colors, m_bIsBigEndian); return v; } return colors; } vector< uint32_t > GeometryDataBlock::GetVertexIndices() const { vector< uint32_t > v; if (!vertexIValid) { m_pStreamFile->SeekPos(m_iOffset+DataBlock::GetOffsetToNextBlock() + ComputeHeaderSize()+ sizeof(float)*m_n_vertices+ sizeof(float)*m_n_normals+ sizeof(float)*m_n_texcoords+ sizeof(float)*m_n_colors); m_pStreamFile->ReadData(v, m_n_vertex_indices, m_bIsBigEndian); return v; } return vIndices; } vector< uint32_t > GeometryDataBlock::GetNormalIndices() const { vector< uint32_t > v; if (!normalIValid) { m_pStreamFile->SeekPos(m_iOffset+DataBlock::GetOffsetToNextBlock() + ComputeHeaderSize()+ sizeof(float)*m_n_vertices+ sizeof(float)*m_n_normals+ sizeof(float)*m_n_texcoords+ sizeof(float)*m_n_colors+ sizeof(uint32_t)*m_n_vertex_indices); m_pStreamFile->ReadData(v, m_n_normal_indices, m_bIsBigEndian); return v; } return nIndices; } vector< uint32_t > GeometryDataBlock::GetTexCoordIndices() const { vector< uint32_t > v; if (!texcoordIValid) { m_pStreamFile->SeekPos(m_iOffset+DataBlock::GetOffsetToNextBlock() + ComputeHeaderSize()+ sizeof(float)*m_n_vertices+ sizeof(float)*m_n_normals+ sizeof(float)*m_n_texcoords+ sizeof(float)*m_n_colors+ sizeof(uint32_t)*m_n_vertex_indices+ sizeof(uint32_t)*m_n_normal_indices); m_pStreamFile->ReadData(v, m_n_texcoord_indices, m_bIsBigEndian); return v; } return tIndices; } vector< uint32_t > GeometryDataBlock::GetColorIndices() const { vector< uint32_t > v; if (!colorIValid) { m_pStreamFile->SeekPos(m_iOffset+DataBlock::GetOffsetToNextBlock() + ComputeHeaderSize()+ sizeof(float)*m_n_vertices+ sizeof(float)*m_n_normals+ sizeof(float)*m_n_texcoords+ sizeof(float)*m_n_colors+ sizeof(uint32_t)*m_n_vertex_indices+ sizeof(uint32_t)*m_n_normal_indices+ sizeof(uint32_t)*m_n_texcoord_indices); m_pStreamFile->ReadData(v, m_n_color_indices, m_bIsBigEndian); return v; } return cIndices; } void GeometryDataBlock::SetVertices(const std::vector< float >& v) { verticesValid = true; vertices = v; } void GeometryDataBlock::SetNormals(const std::vector< float >& n) { normalsValid = true; normals = n; } void GeometryDataBlock::SetTexCoords(const std::vector< float >& tc){ texcoordsValid = true; texcoords = tc; } void GeometryDataBlock::SetColors(const std::vector< float >& c) { colorsValid = true; colors = c; } void GeometryDataBlock::SetVertexIndices(const std::vector< uint32_t >& vI) { vertexIValid = true; vIndices = vI; } void GeometryDataBlock::SetNormalIndices(const std::vector< uint32_t >& nI) { normalIValid = true; nIndices = nI; } void GeometryDataBlock::SetTexCoordIndices(const std::vector< uint32_t >& tcI) { texcoordIValid = true; tIndices = tcI; } void GeometryDataBlock::SetColorIndices(const std::vector< uint32_t >& cI) { colorIValid = true; cIndices = cI; } ImageVis3D-3.1.0/Tuvok/IO/UVF/TOCBlock.h0000644000175000017500000001214312320456500017106 0ustar mathieumathieu#pragma once #ifndef UVF_TOCBLOCK_H #define UVF_TOCBLOCK_H #include "DataBlock.h" #include "ExtendedOctree/ExtendedOctree.h" class AbstrDebugOut; class MaxMinDataBlock; class TOCBlock : public DataBlock { public: TOCBlock(uint64_t iUVFFileVersion); virtual ~TOCBlock(); TOCBlock(const TOCBlock &other); TOCBlock(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, uint64_t iUVFFileVersion); virtual uint64_t ComputeDataSize() const; uint32_t GetOverlap() const {return m_ExtendedOctree.GetOverlap();} UINTVECTOR3 GetMaxBrickSize() const { return m_ExtendedOctree.GetMaxBrickSize(); } bool FlatDataToBrickedLOD(const std::string& strSourceFile, const std::string& strTempFile, ExtendedOctree::COMPONENT_TYPE eType, uint64_t iComponentCount, const UINT64VECTOR3& vVolumeSize, const DOUBLEVECTOR3& vScale, const UINT64VECTOR3& vMaxBrickSize, uint32_t iOverlap, bool bUseMedian, bool bClampToEdge, size_t iCacheSize, std::shared_ptr pMaxMinDatBlock = std::shared_ptr(), AbstrDebugOut* pDebugOut=NULL, COMPRESSION_TYPE ct=CT_ZLIB, uint32_t iCompressionLevel=4, LAYOUT_TYPE lt=LT_SCANLINE); bool FlatDataToBrickedLOD(LargeRAWFile_ptr pSourceData, const std::string& strTempFile, ExtendedOctree::COMPONENT_TYPE eType, uint64_t iComponentCount, const UINT64VECTOR3& vVolumeSize, const DOUBLEVECTOR3& vScale, const UINT64VECTOR3& vMaxBrickSize, uint32_t iOverlap, bool bUseMedian, bool bClampToEdge, size_t iCacheSize, std::shared_ptr pMaxMinDatBlock = std::shared_ptr(), AbstrDebugOut* pDebugOut=NULL, COMPRESSION_TYPE ct=CT_ZLIB, uint32_t iCompressionLevel=4, LAYOUT_TYPE lt=LT_SCANLINE); bool BrickedLODToFlatData(uint64_t iLoD, const std::string& strTargetFile, bool bAppend = false, AbstrDebugOut* pDebugOut=NULL) const; bool BrickedLODToFlatData(uint64_t iLoD, LargeRAWFile_ptr pTargetFile, bool bAppend = false, AbstrDebugOut* pDebugOut=NULL) const; bool ApplyFunction(uint64_t iLoD, bool (*brickFunc)(void* pData, const UINT64VECTOR3& vBrickSize, const UINT64VECTOR3& vBrickOffset, void* pUserContext) = NULL, void* pUserContext = NULL, uint32_t iOverlap=0, AbstrDebugOut* pDebugOut=NULL) const; void GetData(uint8_t* pData, UINT64VECTOR4 coordinates) const; uint64_t GetLoDCount() const; UINT64VECTOR3 GetBrickCount(uint64_t iLoD) const; UINT64VECTOR3 GetBrickSize(UINT64VECTOR4 coordinates) const; DOUBLEVECTOR3 GetBrickAspect(UINT64VECTOR4 coordinates) const; UINT64VECTOR3 GetLODDomainSize(uint64_t iLoD) const; const TOCEntry& GetBrickInfo(UINT64VECTOR4 coordinates) const; uint64_t GetLinearBrickIndex(UINT64VECTOR4 coordinates) const; uint64_t GetComponentCount() const { return m_ExtendedOctree.GetComponentCount(); } size_t GetComponentTypeSize() const { return m_ExtendedOctree.GetComponentTypeSize(); } ExtendedOctree::COMPONENT_TYPE GetComponentType() const { return m_ExtendedOctree.GetComponentType(); } UINTVECTOR2 GetAtlasSize(UINT64VECTOR4 coordinates) const { return m_ExtendedOctree.GetBrickToCData(coordinates).m_iAtlasSize; } bool GetIsSigned() const; bool GetIsFloat() const; DOUBLEVECTOR3 GetScale() const; void SetScale(const DOUBLEVECTOR3& scale); protected: uint64_t m_iOffsetToOctree; ExtendedOctree m_ExtendedOctree; bool m_bIsBigEndian; uint32_t m_iOverlap; UINT64VECTOR3 m_vMaxBrickSize; std::string m_strDeleteTempFile; uint64_t m_iUVFFileVersion; uint64_t ComputeHeaderSize() const; virtual uint64_t GetHeaderFromFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian); virtual uint64_t CopyToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock); virtual uint64_t GetOffsetToNextBlock() const; virtual DataBlock* Clone() const; friend class UVF; }; #endif // UVF_TOCBLOCK_H ImageVis3D-3.1.0/Tuvok/IO/UVF/UVFBasic.h0000644000175000017500000000050112320456500017103 0ustar mathieumathieu#pragma once #ifndef UVFBASIC_H #define UVFBASIC_H #ifndef UVFVERSION #define UVFVERSION 5 #else #if UVFVERSION != 5 #error [UVFBasic.h] Version mismatch #endif #endif #include "Basics/StdDefines.h" #define UVF_INVALID UINT64_INVALID #include "Basics/LargeRAWFile.h" class DataBlock; #endif // UVFBASIC_H ImageVis3D-3.1.0/Tuvok/IO/UVF/TOCBlock.cpp0000644000175000017500000002315712320456500017450 0ustar mathieumathieu#include #include "TOCBlock.h" #include "MaxMinDataBlock.h" #include "DebugOut/AbstrDebugOut.h" #include "ExtendedOctree/ExtendedOctreeConverter.h" using namespace std; TOCBlock::TOCBlock(uint64_t iUVFFileVersion) : m_iOffsetToOctree(0), m_bIsBigEndian(false), m_iOverlap(2), m_vMaxBrickSize(128,128,128), m_strDeleteTempFile(""), m_iUVFFileVersion(iUVFFileVersion) { ulBlockSemantics = UVFTables::BS_TOC_BLOCK; strBlockID = "Table of Contents Raster Data Block"; } TOCBlock::TOCBlock(const TOCBlock &other) : DataBlock(other), m_bIsBigEndian(other.m_bIsBigEndian), m_iUVFFileVersion(other.m_iUVFFileVersion) { if (!m_pStreamFile->IsOpen()) m_pStreamFile->Open(); GetHeaderFromFile(m_pStreamFile, m_iOffset, m_bIsBigEndian); } TOCBlock::~TOCBlock(){ if (m_pStreamFile) m_pStreamFile->Close(); if (!m_strDeleteTempFile.empty()) { m_ExtendedOctree.Close(); remove(m_strDeleteTempFile.c_str()); } } TOCBlock::TOCBlock(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, uint64_t iUVFFileVersion) : m_iUVFFileVersion(iUVFFileVersion) { GetHeaderFromFile(pStreamFile, iOffset, bIsBigEndian); } uint64_t TOCBlock::GetHeaderFromFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian) { assert(pStreamFile->IsOpen()); m_bIsBigEndian = bIsBigEndian; m_iOffsetToOctree = iOffset + DataBlock::GetHeaderFromFile(pStreamFile, iOffset, bIsBigEndian); if(m_ExtendedOctree.Open(pStreamFile, m_iOffsetToOctree, m_iUVFFileVersion) == false) { throw std::ios_base::failure("opening octree failed."); } return pStreamFile->GetPos() - iOffset; } uint64_t TOCBlock::CopyToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock) { if (!m_pStreamFile->IsOpen()) m_pStreamFile->Open(); // source data assert(pStreamFile->IsOpen()); // destination CopyHeaderToFile(pStreamFile, iOffset, bIsBigEndian, bIsLastBlock); uint64_t iDataSize = ComputeDataSize(); m_pStreamFile->SeekPos(m_iOffsetToOctree); unsigned char* pData = new unsigned char[size_t(min(iDataSize, BLOCK_COPY_SIZE))]; for (uint64_t i = 0;iReadRAW(pData, iCopySize); #ifdef NDEBUG (void)bytes; #endif assert(bytes == iCopySize && "we know the exact file size; a short read " "makes no sense."); bytes = pStreamFile->WriteRAW(pData, iCopySize); assert(bytes == iCopySize); } delete [] pData; return pStreamFile->GetPos() - iOffset; } DataBlock* TOCBlock::Clone() const { return new TOCBlock(*this); } uint64_t TOCBlock::ComputeHeaderSize() const { // currently TOC Block contains no header in addition to the // header info stored in the ExtendedOctree return 0; } uint64_t TOCBlock::GetOffsetToNextBlock() const { return DataBlock::GetOffsetToNextBlock() + ComputeHeaderSize() + ComputeDataSize(); } uint64_t TOCBlock::ComputeDataSize() const { return m_ExtendedOctree.GetSize(); } bool TOCBlock::FlatDataToBrickedLOD( const std::string& strSourceFile, const std::string& strTempFile, ExtendedOctree::COMPONENT_TYPE eType, uint64_t iComponentCount, const UINT64VECTOR3& vVolumeSize, const DOUBLEVECTOR3& vScale, const UINT64VECTOR3& vMaxBrickSize, uint32_t iOverlap, bool bUseMedian, bool bClampToEdge, size_t iCacheSize, std::shared_ptr pMaxMinDatBlock, AbstrDebugOut* debugOut, COMPRESSION_TYPE ct, uint32_t iCompressionLevel, LAYOUT_TYPE lt ) { LargeRAWFile_ptr inFile(new LargeRAWFile(strSourceFile)); if (!inFile->Open()) { debugOut->Error(_func_, "Could not read '%s'!", strSourceFile.c_str()); return false; } return FlatDataToBrickedLOD(inFile, strTempFile, eType, iComponentCount, vVolumeSize, vScale, vMaxBrickSize, iOverlap, bUseMedian, bClampToEdge, iCacheSize, pMaxMinDatBlock, debugOut, ct, iCompressionLevel, lt); } bool TOCBlock::FlatDataToBrickedLOD( LargeRAWFile_ptr pSourceData, const std::string& strTempFile, ExtendedOctree::COMPONENT_TYPE eType, uint64_t iComponentCount, const UINT64VECTOR3& vVolumeSize, const DOUBLEVECTOR3& vScale, const UINT64VECTOR3& vMaxBrickSize, uint32_t iOverlap, bool bUseMedian, bool bClampToEdge, size_t iCacheSize, std::shared_ptr pMaxMinDatBlock, AbstrDebugOut* debugOut, COMPRESSION_TYPE ct, uint32_t iCompressionLevel, LAYOUT_TYPE lt ) { m_vMaxBrickSize = vMaxBrickSize; m_iOverlap = iOverlap; assert(m_vMaxBrickSize[0] > 2*m_iOverlap); assert(m_vMaxBrickSize[1] > 2*m_iOverlap); assert(m_vMaxBrickSize[2] > 2*m_iOverlap); assert(debugOut != NULL); assert(vVolumeSize.volume() > 0); assert(vScale.volume() > 0); LargeRAWFile_ptr outFile(new LargeRAWFile(strTempFile)); if (!outFile->Create()) { debugOut->Error(_func_, "Could not create tempfile '%s'", strTempFile.c_str()); return false; } m_pStreamFile = outFile; m_strDeleteTempFile = strTempFile; ExtendedOctreeConverter c(m_vMaxBrickSize, m_iOverlap, iCacheSize, *debugOut); BrickStatVec statsVec; if (!pSourceData->IsOpen()) pSourceData->Open(); if(!c.Convert(pSourceData, 0, eType, iComponentCount, vVolumeSize, vScale, outFile, 0, &statsVec, ct, iCompressionLevel, bUseMedian, bClampToEdge, lt)) { debugOut->Error(_func_, "ExtOctree reported failed conversion."); return false; } outFile->Close(); // note, needed before the 'Open' below! pMaxMinDatBlock->SetDataFromFlatVector(statsVec, iComponentCount); debugOut->Message(_func_, "opening UVF '%s'", m_strDeleteTempFile.c_str()); return m_ExtendedOctree.Open(m_strDeleteTempFile, 0, m_iUVFFileVersion); } bool TOCBlock::BrickedLODToFlatData( uint64_t iLoD, const std::string& strTargetFile, bool bAppend, AbstrDebugOut* pDebugOut ) const { LargeRAWFile_ptr outFile; outFile = LargeRAWFile_ptr(new LargeRAWFile(strTargetFile)); if (bAppend) { if (!outFile->Append()) { return false; } } else { if (!outFile->Create()) { return false; } } return BrickedLODToFlatData(iLoD, outFile, bAppend, pDebugOut); } bool TOCBlock::BrickedLODToFlatData(uint64_t iLoD, LargeRAWFile_ptr pTargetFile, bool bAppend, AbstrDebugOut*) const { uint64_t iOffset = bAppend ? pTargetFile->GetCurrentSize() : 0; return ExtendedOctreeConverter::ExportToRAW(m_ExtendedOctree, pTargetFile, iLoD, iOffset); } bool TOCBlock::ApplyFunction(uint64_t iLoD, bool (*brickFunc)( void* pData, const UINT64VECTOR3& vBrickSize, const UINT64VECTOR3& vBrickOffset, void* pUserContext ), void* pUserContext, uint32_t iOverlap, AbstrDebugOut*) const { return ExtendedOctreeConverter::ApplyFunction(m_ExtendedOctree, iLoD, brickFunc, pUserContext, iOverlap); } void TOCBlock::GetData(uint8_t* pData, UINT64VECTOR4 coordinates) const { m_ExtendedOctree.GetBrickData(pData, coordinates); } UINT64VECTOR3 TOCBlock::GetBrickCount(uint64_t iLoD) const { return m_ExtendedOctree.GetBrickCount(iLoD); } UINT64VECTOR3 TOCBlock::GetBrickSize(UINT64VECTOR4 coordinates) const { return m_ExtendedOctree.ComputeBrickSize(coordinates); } const TOCEntry& TOCBlock::GetBrickInfo(UINT64VECTOR4 coordinates) const { return m_ExtendedOctree.GetBrickToCData(coordinates); } DOUBLEVECTOR3 TOCBlock::GetBrickAspect(UINT64VECTOR4 coordinates) const { return m_ExtendedOctree.GetBrickAspect(coordinates); } UINT64VECTOR3 TOCBlock::GetLODDomainSize(uint64_t iLoD) const { return m_ExtendedOctree.GetLoDSize(iLoD); } uint64_t TOCBlock::GetLoDCount() const { return m_ExtendedOctree.GetLODCount(); } bool TOCBlock::GetIsSigned() const { const ExtendedOctree::COMPONENT_TYPE t = GetComponentType(); switch (t) { case ExtendedOctree::CT_INT8: case ExtendedOctree::CT_INT16: case ExtendedOctree::CT_INT32: case ExtendedOctree::CT_INT64: case ExtendedOctree::CT_FLOAT32: case ExtendedOctree::CT_FLOAT64: return true; case ExtendedOctree::CT_UINT8: case ExtendedOctree::CT_UINT16: case ExtendedOctree::CT_UINT32: case ExtendedOctree::CT_UINT64: default: return false; } } bool TOCBlock::GetIsFloat() const { const ExtendedOctree::COMPONENT_TYPE t = GetComponentType(); switch (t) { case ExtendedOctree::CT_FLOAT32: case ExtendedOctree::CT_FLOAT64: return true; case ExtendedOctree::CT_INT8: case ExtendedOctree::CT_INT16: case ExtendedOctree::CT_INT32: case ExtendedOctree::CT_INT64: case ExtendedOctree::CT_UINT8: case ExtendedOctree::CT_UINT16: case ExtendedOctree::CT_UINT32: case ExtendedOctree::CT_UINT64: default: return false; } } DOUBLEVECTOR3 TOCBlock::GetScale() const { return m_ExtendedOctree.GetGlobalAspect(); } void TOCBlock::SetScale(const DOUBLEVECTOR3& scale) { m_ExtendedOctree.SetGlobalAspect(scale); } uint64_t TOCBlock::GetLinearBrickIndex(UINT64VECTOR4 coordinates) const { return m_ExtendedOctree.BrickCoordsToIndex(coordinates); } ImageVis3D-3.1.0/Tuvok/IO/UVF/Histogram1DDataBlock.h0000644000175000017500000000310312320456500021371 0ustar mathieumathieu#pragma once #ifndef UVF_HISTOGRAM1DDATABLOCK_H #define UVF_HISTOGRAM1DDATABLOCK_H #include "DataBlock.h" #include "TOCBlock.h" class RasterDataBlock; class Histogram1DDataBlock : public DataBlock { public: Histogram1DDataBlock(); ~Histogram1DDataBlock(); Histogram1DDataBlock(const Histogram1DDataBlock &other); Histogram1DDataBlock(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian); virtual Histogram1DDataBlock& operator=(const Histogram1DDataBlock& other); virtual uint64_t ComputeDataSize() const; bool Compute(const TOCBlock* source, uint64_t iLevel); bool Compute(const RasterDataBlock* source); const std::vector& GetHistogram() const {return m_vHistData;} void SetHistogram(std::vector& vHistData) {m_vHistData = vHistData;} size_t Compress(size_t maxTargetSize); protected: std::vector m_vHistData; virtual void CopyHeaderToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock); virtual uint64_t GetHeaderFromFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian); virtual uint64_t CopyToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock); virtual uint64_t GetOffsetToNextBlock() const; virtual DataBlock* Clone() const; template void ComputeTemplate(const TOCBlock* source, uint64_t iLevel); }; #endif // UVF_HISTOGRAM1DDATABLOCK_H ImageVis3D-3.1.0/Tuvok/IO/UVF/DataBlock.h0000644000175000017500000000261312320456500017333 0ustar mathieumathieu#pragma once #ifndef UVF_DATABLOCK_H #define UVF_DATABLOCK_H #include #include "UVFTables.h" class DataBlock { public: DataBlock(); DataBlock(const DataBlock &other); DataBlock(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian); virtual ~DataBlock(); virtual DataBlock& operator=(const DataBlock& other); virtual bool Verify(uint64_t iSizeofData, std::string* pstrProblem = NULL) const; UVFTables::BlockSemanticTable GetBlockSemantic() const { return ulBlockSemantics; } std::string strBlockID; UVFTables::CompressionSemanticTable ulCompressionScheme; virtual uint64_t ComputeDataSize() const {return 0;} protected: LargeRAWFile_ptr m_pStreamFile; uint64_t m_iOffset; UVFTables::BlockSemanticTable ulBlockSemantics; uint64_t ulOffsetToNextDataBlock; virtual void CopyHeaderToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock); virtual uint64_t GetHeaderFromFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian); virtual uint64_t CopyToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock); virtual uint64_t GetOffsetToNextBlock() const; virtual DataBlock* Clone() const; friend class UVF; }; #endif // UVF_DATABLOCK_H ImageVis3D-3.1.0/Tuvok/IO/UVF/MaxMinDataBlock.cpp0000644000175000017500000001542012320456500021000 0ustar mathieumathieu#define _NOMINMAX #include #include "MaxMinDataBlock.h" using namespace std; using namespace UVFTables; using namespace tuvok; MaxMinDataBlock::MaxMinDataBlock(size_t iComponentCount) : DataBlock() { ulBlockSemantics = BS_MAXMIN_VALUES; strBlockID = "Brick Max/Min Values"; m_vfMaxMinData.clear(); SetComponentCount(iComponentCount); } void MaxMinDataBlock::SetComponentCount(size_t iComponentCount) { m_iComponentCount = iComponentCount; m_GlobalMaxMin.resize(m_iComponentCount); ResetGlobal(); } void MaxMinDataBlock::ResetGlobal() { for (size_t i = 0;i::max(), -std::numeric_limits::max(), std::numeric_limits::max(), -std::numeric_limits::max()); } MaxMinDataBlock::MaxMinDataBlock(const MaxMinDataBlock &other) : DataBlock(other), m_GlobalMaxMin(other.m_GlobalMaxMin), m_vfMaxMinData(other.m_vfMaxMinData), m_iComponentCount(other.m_iComponentCount) { } MaxMinDataBlock& MaxMinDataBlock::operator=(const MaxMinDataBlock& other) { strBlockID = other.strBlockID; ulBlockSemantics = other.ulBlockSemantics; ulCompressionScheme = other.ulCompressionScheme; ulOffsetToNextDataBlock = other.ulOffsetToNextDataBlock; m_iComponentCount = other.m_iComponentCount; m_GlobalMaxMin = other.m_GlobalMaxMin; m_vfMaxMinData = other.m_vfMaxMinData; return *this; } MaxMinDataBlock::MaxMinDataBlock(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian) { GetHeaderFromFile(pStreamFile, iOffset, bIsBigEndian); } MaxMinDataBlock::~MaxMinDataBlock() { } DataBlock* MaxMinDataBlock::Clone() const { return new MaxMinDataBlock(*this); } uint64_t MaxMinDataBlock::GetHeaderFromFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian) { uint64_t iStart = iOffset + DataBlock::GetHeaderFromFile(pStreamFile, iOffset, bIsBigEndian); pStreamFile->SeekPos(iStart); uint64_t ulBrickCount; pStreamFile->ReadData(ulBrickCount, bIsBigEndian); { // Widen component count to 64 bits during the read. uint64_t component_count; pStreamFile->ReadData(component_count, bIsBigEndian); SetComponentCount(static_cast(component_count)); } m_vfMaxMinData.resize(size_t(ulBrickCount)); for(MaxMinVec::iterator i = m_vfMaxMinData.begin(); i != m_vfMaxMinData.end(); ++i) { (*i).resize(m_iComponentCount); for (size_t j = 0;jReadData((*i)[j].minScalar, bIsBigEndian); pStreamFile->ReadData((*i)[j].maxScalar, bIsBigEndian); pStreamFile->ReadData((*i)[j].minGradient, bIsBigEndian); pStreamFile->ReadData((*i)[j].maxGradient, bIsBigEndian); m_GlobalMaxMin[j].Merge((*i)[j]); } } return pStreamFile->GetPos() - iOffset; } uint64_t MaxMinDataBlock::CopyToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock) { CopyHeaderToFile(pStreamFile, iOffset, bIsBigEndian, bIsLastBlock); // for some strange reason throwing in the raw expression (RHS) into // WriteData causes random values to written into the file on windows uint64_t ulBrickCount = uint64_t(m_vfMaxMinData.size()); pStreamFile->WriteData(ulBrickCount, bIsBigEndian); { // Widen to 64bits during the write. uint64_t component_count = m_iComponentCount; pStreamFile->WriteData(component_count, bIsBigEndian); } for (MaxMinVec::const_iterator i = m_vfMaxMinData.begin(); i != m_vfMaxMinData.end(); ++i) { for (size_t j = 0;jWriteData((*i)[j].minScalar, bIsBigEndian); pStreamFile->WriteData((*i)[j].maxScalar, bIsBigEndian); pStreamFile->WriteData((*i)[j].minGradient, bIsBigEndian); pStreamFile->WriteData((*i)[j].maxGradient, bIsBigEndian); } } return pStreamFile->GetPos() - iOffset; } uint64_t MaxMinDataBlock::GetOffsetToNextBlock() const { return DataBlock::GetOffsetToNextBlock() + ComputeDataSize(); } uint64_t MaxMinDataBlock::ComputeDataSize() const { // We're writing 4 values per iteration in CopyToFile. We used to use // sizeof(MinMaxBlock) to compute the size of the data, but that's // a bad idea because the compiler is free to pack the class however it // wants. We'll write out 4 64bit values regardless of the packing of that // class. // Still, if you ever add a new element to that class, you of course need to // add a write for it in CopyToFile, but you also need to come here and // increment the size by 8. Hopefully this assert will clue you in if you // forget to do that. static_assert(sizeof(MinMaxBlock) == 32, "assuming there are 4 values per element/component!"); return sizeof(uint64_t) + // length of the vector sizeof(uint64_t) + // component count 32 * m_vfMaxMinData.size() * m_iComponentCount; // vector of data } const MinMaxBlock& MaxMinDataBlock::GetValue(size_t iIndex, size_t iComponent) const { if(iIndex >= m_vfMaxMinData.size() || iComponent >= m_vfMaxMinData[iIndex].size()) { throw std::length_error("MaxMinDataBlock: Invalid maxmin index."); } return m_vfMaxMinData[iIndex][iComponent]; } void MaxMinDataBlock::StartNewValue() { vector elems; MinMaxBlock elem(std::numeric_limits::max(), -std::numeric_limits::max(), std::numeric_limits::max(), -std::numeric_limits::max()); for (uint64_t i = 0;i& fMaxMinData) { for (size_t i = 0;i::max(), std::numeric_limits::max()); m_vfMaxMinData[i][j] = data; m_GlobalMaxMin[j].Merge(data); } } } ImageVis3D-3.1.0/Tuvok/IO/UVF/KeyValuePairDataBlock.h0000644000175000017500000000363612320456500021623 0ustar mathieumathieu#pragma once #ifndef UVF_KEYVALUEPAIRDATABLOCK_H #define UVF_KEYVALUEPAIRDATABLOCK_H #include "DataBlock.h" class KeyValuePair { public: KeyValuePair() : strKey(""), strValue("") {} KeyValuePair(std::string _strKey, std::string _strValue) : strKey(_strKey), strValue(_strValue) {} std::string strKey; std::string strValue; }; #ifdef max #undef max #endif class KeyValuePairDataBlock : public DataBlock { public: KeyValuePairDataBlock(); KeyValuePairDataBlock(const KeyValuePairDataBlock &other); KeyValuePairDataBlock(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian); virtual KeyValuePairDataBlock& operator=(const KeyValuePairDataBlock& other); size_t GetKeyCount() const {return m_KeyValuePairs.size();} std::string GetKeyByIndex(size_t iIndex) const { return m_KeyValuePairs[size_t(iIndex)].strKey; } std::string GetValueByIndex(size_t iIndex) const { return m_KeyValuePairs[size_t(iIndex)].strValue; } uint64_t GetIndexByKey(std::string strKey) const { for (size_t i = 0;i m_KeyValuePairs; virtual void CopyHeaderToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock); virtual uint64_t GetHeaderFromFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian); virtual uint64_t CopyToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock); virtual uint64_t GetOffsetToNextBlock() const; virtual DataBlock* Clone() const; friend class UVF; }; #endif // UVF_KEYVALUEPAIRDATABLOCK_H ImageVis3D-3.1.0/Tuvok/IO/UVF/GeometryDataBlock.h0000644000175000017500000001116512320456500021051 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : GeometryDataBlock.h //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #pragma once #ifndef UVF_GEOMETRYDATABLOCK_H #define UVF_GEOMETRYDATABLOCK_H #include #include #include "DataBlock.h" class AbstrDebugOut; class GeometryDataBlock : public DataBlock { public: GeometryDataBlock(); GeometryDataBlock(const GeometryDataBlock &other); GeometryDataBlock(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian); virtual GeometryDataBlock& operator=(const GeometryDataBlock& other); virtual ~GeometryDataBlock(); virtual bool Verify(uint64_t iSizeofData, std::string* pstrProblem = NULL) const; virtual uint64_t ComputeDataSize() const; std::vector< float > GetVertices() const; std::vector< float > GetNormals() const; std::vector< float > GetTexCoords() const; std::vector< float > GetColors() const; std::vector< uint32_t > GetVertexIndices() const; std::vector< uint32_t > GetNormalIndices() const; std::vector< uint32_t > GetTexCoordIndices() const; std::vector< uint32_t > GetColorIndices() const; void SetVertices(const std::vector< float >& v); void SetNormals(const std::vector< float >& n); void SetTexCoords(const std::vector< float >& tc); void SetColors(const std::vector< float >& c); void SetVertexIndices(const std::vector< uint32_t >& vI); void SetNormalIndices(const std::vector< uint32_t >& nI); void SetTexCoordIndices(const std::vector< uint32_t >& tcI); void SetColorIndices(const std::vector< uint32_t >& cI); const std::vector< float >& GetDefaultColor() const {return m_DefaultColor;} void SetDefaultColor(const std::vector& color) { m_DefaultColor = color; } std::string m_Desc; uint64_t GetPolySize() const {return m_PolySize;} void SetPolySize(uint64_t polySize) {m_PolySize = polySize;} protected: uint64_t ComputeHeaderSize() const; virtual uint64_t GetHeaderFromFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian); virtual uint64_t CopyToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock); virtual uint64_t GetOffsetToNextBlock() const; virtual void CopyHeaderToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock); virtual DataBlock* Clone() const; friend class UVF; // raw floats std::vector< float > vertices; std::vector< float > normals; std::vector< float > texcoords; std::vector< float > colors; // indices std::vector< uint32_t > vIndices; std::vector< uint32_t > nIndices; std::vector< uint32_t > tIndices; std::vector< uint32_t > cIndices; bool verticesValid; bool normalsValid; bool texcoordsValid; bool colorsValid; bool vertexIValid; bool normalIValid; bool texcoordIValid; bool colorIValid; std::vector< float > m_DefaultColor; uint64_t m_PolySize; private: bool m_bIsBigEndian; uint64_t m_n_vertices; uint64_t m_n_normals; uint64_t m_n_texcoords; uint64_t m_n_colors; uint64_t m_n_vertex_indices; uint64_t m_n_normal_indices; uint64_t m_n_texcoord_indices; uint64_t m_n_color_indices; }; #endif // UVF_GEOMETRYDATABLOCK_H ImageVis3D-3.1.0/Tuvok/IO/UVF/Histogram2DDataBlock.cpp0000644000175000017500000005051412320456500021735 0ustar mathieumathieu#include "Histogram2DDataBlock.h" #include "Basics/Vectors.h" #include "RasterDataBlock.h" #include "TOCBlock.h" #include "../../Controller/Controller.h" #include "../../Basics/ProgressTimer.h" using namespace std; Histogram2DDataBlock::Histogram2DDataBlock() : DataBlock(), m_fMaxGradMagnitude(0) { ulBlockSemantics = UVFTables::BS_2D_HISTOGRAM; strBlockID = "2D Histogram"; } Histogram2DDataBlock::Histogram2DDataBlock(const Histogram2DDataBlock &other) : DataBlock(other), m_vHistData(other.m_vHistData), m_fMaxGradMagnitude(other.m_fMaxGradMagnitude) { } Histogram2DDataBlock& Histogram2DDataBlock::operator=(const Histogram2DDataBlock& other) { strBlockID = other.strBlockID; ulBlockSemantics = other.ulBlockSemantics; ulCompressionScheme = other.ulCompressionScheme; ulOffsetToNextDataBlock = other.ulOffsetToNextDataBlock; m_vHistData = other.m_vHistData; m_fMaxGradMagnitude = other.m_fMaxGradMagnitude; return *this; } Histogram2DDataBlock::Histogram2DDataBlock(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian) { GetHeaderFromFile(pStreamFile, iOffset, bIsBigEndian); } Histogram2DDataBlock::~Histogram2DDataBlock() { } DataBlock* Histogram2DDataBlock::Clone() const { return new Histogram2DDataBlock(*this); } uint64_t Histogram2DDataBlock::GetHeaderFromFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian) { uint64_t iStart = iOffset + DataBlock::GetHeaderFromFile(pStreamFile, iOffset, bIsBigEndian); pStreamFile->SeekPos(iStart); uint64_t ulElementCountX, ulElementCountY; pStreamFile->ReadData(m_fMaxGradMagnitude, bIsBigEndian); pStreamFile->ReadData(ulElementCountX, bIsBigEndian); pStreamFile->ReadData(ulElementCountY, bIsBigEndian); m_vHistData.resize(size_t(ulElementCountX)); vector tmp((size_t)ulElementCountY); for (size_t i = 0;iReadRAW((unsigned char*)&tmp[0], ulElementCountY*sizeof(uint64_t)); m_vHistData[i] = tmp; } return pStreamFile->GetPos() - iOffset; } bool Histogram2DDataBlock::Compute(const TOCBlock* source, uint64_t iLevel, size_t iHistoBinCount, double fMaxNonZeroValue) { // do not try to compute a histogram for floating point data, // anything beyond 32 bit or more than 1 component data if (source->GetComponentType() == ExtendedOctree::CT_FLOAT32 || source->GetComponentType() == ExtendedOctree::CT_FLOAT64 || source->GetComponentTypeSize() > 4 || source->GetComponentCount() != 1) return false; // resize histogram m_vHistData.resize(iHistoBinCount); for (size_t i = 0;iGetComponentType()) { case ExtendedOctree::CT_UINT8: ComputeTemplate(source, double(std::numeric_limits::max()), iLevel, iHistoBinCount, fMaxNonZeroValue); break; case ExtendedOctree::CT_UINT16: ComputeTemplate(source, double(std::numeric_limits::max()), iLevel, iHistoBinCount, fMaxNonZeroValue); break; case ExtendedOctree::CT_UINT32: ComputeTemplate(source, double(std::numeric_limits::max()), iLevel, iHistoBinCount, fMaxNonZeroValue); break; case ExtendedOctree::CT_UINT64: ComputeTemplate(source, double(std::numeric_limits::max()), iLevel, iHistoBinCount, fMaxNonZeroValue); break; case ExtendedOctree::CT_INT8: ComputeTemplate(source, double(std::numeric_limits::max()), iLevel, iHistoBinCount, fMaxNonZeroValue); break; case ExtendedOctree::CT_INT16: ComputeTemplate(source, double(std::numeric_limits::max()), iLevel, iHistoBinCount, fMaxNonZeroValue); break; case ExtendedOctree::CT_INT32: ComputeTemplate(source, double(std::numeric_limits::max()), iLevel, iHistoBinCount, fMaxNonZeroValue); break; case ExtendedOctree::CT_INT64: ComputeTemplate(source, double(std::numeric_limits::max()), iLevel, iHistoBinCount, fMaxNonZeroValue); break; case ExtendedOctree::CT_FLOAT32: ComputeTemplate(source, 1.0, iLevel, iHistoBinCount, fMaxNonZeroValue); break; case ExtendedOctree::CT_FLOAT64: ComputeTemplate(source, 1.0, iLevel, iHistoBinCount, fMaxNonZeroValue); break; } // set data block information strBlockID = "2D Histogram for datablock " + source->strBlockID; return true; } /// \todo right now compute Histogram assumes that the lowest LOD level /// consists only of a single brick, this brick is used for the hist. /// computation // this should be changed to a more general approach bool Histogram2DDataBlock::Compute( const RasterDataBlock* source, size_t iHistoBinCount, double fMaxNonZeroValue ) { /// \todo right now we can only compute Histograms of scalar data this should be changed to a more general approach if (source->ulElementDimension != 1 || source->ulElementDimensionSize.size() != 1) { return false; } /// \todo right now compute Histogram assumes that at least the lowest LOD level consists only // of a single brick, this brick is used for the hist.-computation // this should be changed to a more general approach vector vSmallestLOD = source->GetSmallestBrickIndex(); const vector& vBricks = source->GetBrickCount(vSmallestLOD); for (unsigned int i = 0;iulDomainSize.size() < 3 || source->ulDomainSemantics[0] != UVFTables::DS_X || source->ulDomainSemantics[1] != UVFTables::DS_Y || source->ulDomainSemantics[2] != UVFTables::DS_Z) { return false; } m_vHistData.resize(iHistoBinCount); for (size_t i = 0;i vcSourceData; // LargestSingleBrickLODBrickIndex is well defined as we tested above if we have a single brick LOD vector vLOD = source->LargestSingleBrickLODBrickIndex(); vector vOneAndOnly; for (size_t i = 0;iGetData(vcSourceData, vLOD, vOneAndOnly)) return false; vector vSize = source->LargestSingleBrickLODBrickSize(); uint64_t iDataSize = 1; for (size_t i = 0;iulElementBitSize[0][0] == 8) { for (size_t z = 0;z 0) {iLeft = iCenter-1; vScale.x++;} if (x < vSize[0]-1) {iRight = iCenter+1; vScale.x++;} if (y > 0) {iTop = iCenter-size_t(vSize[0]);vScale.y++;} if (y < vSize[1]-1) {iBottom = iCenter+size_t(vSize[0]);vScale.y++;} if (z > 0) {iFront = iCenter-size_t(vSize[0])*size_t(vSize[1]);vScale.z++;} if (z < vSize[2]-1) {iBack = iCenter+size_t(vSize[0])*size_t(vSize[1]);vScale.z++;} FLOATVECTOR3 vGradient((float(vcSourceData[iLeft])-float(vcSourceData[iRight]))/(255*vScale.x), (float(vcSourceData[iTop])-float(vcSourceData[iBottom]))/(255*vScale.y), (float(vcSourceData[iFront])-float(vcSourceData[iBack]))/(255*vScale.z)); if (vGradient.length() > m_fMaxGradMagnitude) m_fMaxGradMagnitude = vGradient.length(); } } } for (size_t z = 0;z 0) {iLeft = iCenter-1; vScale.x++;} if (x < vSize[0]-1) {iRight = iCenter+1; vScale.x++;} if (y > 0) {iTop = iCenter-size_t(vSize[0]);vScale.y++;} if (y < vSize[1]-1) {iBottom = iCenter+size_t(vSize[0]);vScale.y++;} if (z > 0) {iFront = iCenter-size_t(vSize[0])*size_t(vSize[1]);vScale.z++;} if (z < vSize[2]-1) {iBack = iCenter+size_t(vSize[0])*size_t(vSize[1]);vScale.z++;} FLOATVECTOR3 vGradient((float(vcSourceData[iLeft])-float(vcSourceData[iRight]))/(255*vScale.x), (float(vcSourceData[iTop])-float(vcSourceData[iBottom]))/(255*vScale.y), (float(vcSourceData[iFront])-float(vcSourceData[iBack]))/(255*vScale.z)); unsigned char iGardientMagnitudeIndex = (unsigned char)(min(255,int(vGradient.length()/m_fMaxGradMagnitude*255.0f))); m_vHistData[vcSourceData[iCenter]][iGardientMagnitudeIndex]++; } } } } else { if (source->ulElementBitSize[0][0] == 16) { unsigned short *psSourceData = (unsigned short*)(&(vcSourceData.at(0))); for (size_t z = 0;z 0) {iLeft = iCenter-1; vScale.x++;} if (x < vSize[0]-1) {iRight = iCenter+1; vScale.x++;} if (y > 0) {iTop = iCenter-size_t(vSize[0]);vScale.y++;} if (y < vSize[1]-1) {iBottom = iCenter+size_t(vSize[0]);vScale.y++;} if (z > 0) {iFront = iCenter-size_t(vSize[0])*size_t(vSize[1]);vScale.z++;} if (z < vSize[2]-1) {iBack = iCenter+size_t(vSize[0])*size_t(vSize[1]);vScale.z++;} FLOATVECTOR3 vGradient((float(psSourceData[iLeft])-float(psSourceData[iRight]))/(65535*vScale.x), (float(psSourceData[iTop])-float(psSourceData[iBottom]))/(65535*vScale.y), (float(psSourceData[iFront])-float(psSourceData[iBack]))/(65535*vScale.z)); if (vGradient.length() > m_fMaxGradMagnitude) m_fMaxGradMagnitude = vGradient.length(); } } } for (size_t z = 0;z 0) {iLeft = iCenter-1; vScale.x++;} if (x < vSize[0]-1) {iRight = iCenter+1; vScale.x++;} if (y > 0) {iTop = iCenter-size_t(vSize[0]);vScale.y++;} if (y < vSize[1]-1) {iBottom = iCenter+size_t(vSize[0]);vScale.y++;} if (z > 0) {iFront = iCenter-size_t(vSize[0])*size_t(vSize[1]);vScale.z++;} if (z < vSize[2]-1) {iBack = iCenter+size_t(vSize[0])*size_t(vSize[1]);vScale.z++;} FLOATVECTOR3 vGradient((float(psSourceData[iLeft])-float(psSourceData[iRight]))/(65535*vScale.x), (float(psSourceData[iTop])-float(psSourceData[iBottom]))/(65535*vScale.y), (float(psSourceData[iFront])-float(psSourceData[iBack]))/(65535*vScale.z)); unsigned char iGardientMagnitudeIndex = (unsigned char)(min(255,int(vGradient.length()/m_fMaxGradMagnitude*255.0f))); int iValue = (fMaxNonZeroValue <= double(iHistoBinCount-1)) ? psSourceData[iCenter] : min(int(iHistoBinCount-1),int(float(psSourceData[iCenter] * float(iHistoBinCount-1)/fMaxNonZeroValue))); m_vHistData[iValue][iGardientMagnitudeIndex]++; } } } } else { return false; } } // set data block information strBlockID = "2D Histogram for datablock " + source->strBlockID; return true; } template FUNC_PURE DOUBLEVECTOR3 Histogram2DDataBlock::ComputeGradient(const T* pTempBrickData, double normalizationFactor, size_t iCompcount, const UINTVECTOR3& size, const UINTVECTOR3& coords) { // TODO: think about what todo with multi component data // right now we only pick the first component size_t iCenter = size_t(coords.x+size.x*coords.y+size.x*size.y*coords.z); size_t iLeft = iCenter-1; size_t iRight = iCenter+1; size_t iTop = iCenter-size_t(size.x); size_t iBottom = iCenter+size_t(size.x); size_t iFront = iCenter-size_t(size.x)*size_t(size.y); size_t iBack = iCenter+size_t(size.x)*size_t(size.y); DOUBLEVECTOR3 vGradient((double(pTempBrickData[iCompcount*iLeft]) -double(pTempBrickData[iCompcount*iRight])) /(normalizationFactor*2), (double(pTempBrickData[iCompcount*iTop]) -double(pTempBrickData[iCompcount*iBottom]))/(normalizationFactor*2), (double(pTempBrickData[iCompcount*iFront])-double(pTempBrickData[iCompcount*iBack])) /(normalizationFactor*2)); return vGradient; } template void Histogram2DDataBlock::ComputeTemplate(const TOCBlock* source, double normalizationFactor, uint64_t iLevel, size_t iHistoBinCount, double fMaxNonZeroValue) { // compute histogram by iterating over all bricks of the given level UINT64VECTOR3 bricksInSourceLevel = source->GetBrickCount(iLevel); size_t iCompcount = size_t(source->GetComponentCount()); T* pTempBrickData = new T[size_t(source->GetMaxBrickSize().volume()) * iCompcount]; uint32_t iOverlap =source->GetOverlap(); double fMaxGradMagnitude = 0; ProgressTimer timer; timer.Start(); // find the maximum gradient magnitude for (uint64_t bz = 0;bzGetData((uint8_t*)pTempBrickData, brickCoords); UINTVECTOR3 bricksize = UINTVECTOR3(source->GetBrickSize(brickCoords)); #ifdef _MSC_VER # pragma omp parallel for shared(fMaxGradMagnitude) for (int32_t z = iOverlap;uint32_t(z) fMaxGradMagnitude) #pragma omp critical { if(vGradient.length() > fMaxGradMagnitude) { fMaxGradMagnitude = vGradient.length(); } } } } } } } float progress = 0.5f*float(bz)/float(bricksInSourceLevel.z); MESSAGE("Computing 2D Histogram %5.2f%% (%s)", progress * 100.0f, timer.GetProgressMessage(progress).c_str()); } // fill the histogram the maximum gradient magnitude for (uint64_t bz = 0;bzGetData((uint8_t*)pTempBrickData, brickCoords); UINTVECTOR3 bricksize = UINTVECTOR3(source->GetBrickSize(brickCoords)); #pragma omp parallel for firstprivate(fMaxGradMagnitude) #ifdef _MSC_VER for (int32_t z = iOverlap;uint32_t(z)(255,size_t(vGradient.length()/fMaxGradMagnitude*255.0f)); size_t iValue = (fMaxNonZeroValue <= double(iHistoBinCount-1)) ? size_t(pTempBrickData[iCenter]) : size_t(double(pTempBrickData[iCenter]) * double(iHistoBinCount-1)/fMaxNonZeroValue); // make sure round errors don't cause index to go out of bounds if (iGradientMagnitudeIndex > 255) iGradientMagnitudeIndex = 255; if (iValue > iHistoBinCount-1) iValue = iHistoBinCount-1; #pragma omp atomic m_vHistData[iValue][iGradientMagnitudeIndex]++; } } } } } float progress = 0.5f+0.5f*float(bz)/float(bricksInSourceLevel.z); MESSAGE("Computing 2D Histogram %5.2f%% (%s)", progress * 100.0f, timer.GetProgressMessage(progress).c_str()); } m_fMaxGradMagnitude = float(fMaxGradMagnitude); delete [] pTempBrickData; } void Histogram2DDataBlock::CopyHeaderToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock) { DataBlock::CopyHeaderToFile(pStreamFile, iOffset, bIsBigEndian, bIsLastBlock); uint64_t ulElementCountX = uint64_t(m_vHistData.size()); uint64_t ulElementCountY = uint64_t(m_vHistData[0].size()); pStreamFile->WriteData(m_fMaxGradMagnitude, bIsBigEndian); pStreamFile->WriteData(ulElementCountX, bIsBigEndian); pStreamFile->WriteData(ulElementCountY, bIsBigEndian); } uint64_t Histogram2DDataBlock::CopyToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock) { CopyHeaderToFile(pStreamFile, iOffset, bIsBigEndian, bIsLastBlock); vector tmp; for (size_t i = 0;iWriteRAW((unsigned char*)&tmp[0], tmp.size()*sizeof(uint64_t)); } return pStreamFile->GetPos() - iOffset; } uint64_t Histogram2DDataBlock::GetOffsetToNextBlock() const { return DataBlock::GetOffsetToNextBlock() + ComputeDataSize(); } uint64_t Histogram2DDataBlock::ComputeDataSize() const { uint64_t ulElementCountX = uint64_t(m_vHistData.size()); uint64_t ulElementCountY = uint64_t((ulElementCountX == 0) ? 0 : m_vHistData[0].size()); return 1*sizeof(float) + // the m_fMaxGradMagnitude value 2*sizeof(uint64_t) + // length of the vectors ulElementCountX*ulElementCountY*sizeof(uint64_t); // the vectors themselves } ImageVis3D-3.1.0/Tuvok/IO/UVF/DataBlock.cpp0000644000175000017500000000656312320456500017676 0ustar mathieumathieu#include "DataBlock.h" #include "UVF.h" #include using namespace std; using namespace UVFTables; DataBlock::DataBlock() : strBlockID(""), ulCompressionScheme(COS_NONE), m_pStreamFile(), m_iOffset(0), ulBlockSemantics(BS_EMPTY), ulOffsetToNextDataBlock(0) {} DataBlock::DataBlock(const DataBlock &other) : strBlockID(other.strBlockID), ulCompressionScheme(other.ulCompressionScheme), m_pStreamFile(other.m_pStreamFile), m_iOffset(other.m_iOffset), ulBlockSemantics(other.ulBlockSemantics), ulOffsetToNextDataBlock(other.ulOffsetToNextDataBlock) {} DataBlock::DataBlock(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian) { GetHeaderFromFile(pStreamFile, iOffset, bIsBigEndian); } DataBlock::~DataBlock() { // nothing to do here yet } DataBlock& DataBlock::operator=(const DataBlock& other) { strBlockID = other.strBlockID; ulCompressionScheme = other.ulCompressionScheme; m_pStreamFile = other.m_pStreamFile; m_iOffset = other.m_iOffset; ulBlockSemantics = other.ulBlockSemantics; ulOffsetToNextDataBlock = other.ulOffsetToNextDataBlock; return *this; } DataBlock* DataBlock::Clone() const { return new DataBlock(*this); } uint64_t DataBlock::GetHeaderFromFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian) { m_pStreamFile = pStreamFile; m_iOffset = iOffset; assert(pStreamFile->IsOpen()); m_pStreamFile->SeekPos(iOffset); uint64_t ulStringLengthBlockID; m_pStreamFile->ReadData(ulStringLengthBlockID, bIsBigEndian); // this should be a simple string, i.e. "Block", "RasterData" etc. So if it // doesn't fit in a 32bit uint, that's a bit odd. assert(ulStringLengthBlockID <= 4294967296LL); m_pStreamFile->ReadData(strBlockID, ulStringLengthBlockID); uint64_t uintSem; m_pStreamFile->ReadData(uintSem, bIsBigEndian); ulBlockSemantics = (BlockSemanticTable)uintSem; m_pStreamFile->ReadData(uintSem, bIsBigEndian); ulCompressionScheme = (CompressionSemanticTable)uintSem; m_pStreamFile->ReadData(ulOffsetToNextDataBlock, bIsBigEndian); return m_pStreamFile->GetPos() - iOffset; } void DataBlock::CopyHeaderToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock) { assert(pStreamFile->IsOpen()); pStreamFile->SeekPos(iOffset); pStreamFile->WriteData(uint64_t(strBlockID.size()), bIsBigEndian); pStreamFile->WriteData(strBlockID); pStreamFile->WriteData(uint64_t(ulBlockSemantics), bIsBigEndian); pStreamFile->WriteData(uint64_t(ulCompressionScheme), bIsBigEndian); if (bIsLastBlock) pStreamFile->WriteData(uint64_t(0), bIsBigEndian); else pStreamFile->WriteData(GetOffsetToNextBlock(), bIsBigEndian); } uint64_t DataBlock::CopyToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock) { CopyHeaderToFile(pStreamFile, iOffset, bIsBigEndian, bIsLastBlock); return pStreamFile->GetPos() - iOffset; } uint64_t DataBlock::GetOffsetToNextBlock() const { return strBlockID.size() + 4 * sizeof(uint64_t); } bool DataBlock::Verify(uint64_t iSizeofData, std::string* pstrProblem) const { uint64_t iCorrectSize = ComputeDataSize(); bool bResult = iCorrectSize == iSizeofData; if (pstrProblem != NULL) { stringstream s; s << "DataBlock::Verify: size mismatch. Should be " << iCorrectSize << " but parameter was " << iSizeofData << "."; *pstrProblem = s.str(); } return bResult; } ImageVis3D-3.1.0/Tuvok/IO/UVF/GlobalHeader.h0000644000175000017500000000164312320456500020022 0ustar mathieumathieu#pragma once #ifndef UVF_GLOBALHEADER_H #define UVF_GLOBALHEADER_H #include #include "UVFTables.h" class GlobalHeader { public: GlobalHeader(); GlobalHeader(const GlobalHeader &other); GlobalHeader& operator=(const GlobalHeader& other); bool bIsBigEndian; uint64_t ulFileVersion; UVFTables::ChecksumSemanticTable ulChecksumSemanticsEntry; std::vector vcChecksum; uint64_t ulAdditionalHeaderSize; protected: uint64_t GetDataPos(); void GetHeaderFromFile(LargeRAWFile_ptr pStreamFile); void CopyHeaderToFile(LargeRAWFile_ptr pStreamFile); uint64_t GetSize(); static uint64_t GetMinSize(); uint64_t ulOffsetToFirstDataBlock; void UpdateChecksum(std::vector checksum, LargeRAWFile_ptr pStreamFile); friend class UVF; }; #endif // UVF_GLOBALHEADER_H ImageVis3D-3.1.0/Tuvok/IO/UVF/UVFTables.h0000644000175000017500000000431112320456500017277 0ustar mathieumathieu#pragma once #ifndef UVFTABLES_H #define UVFTABLES_H #include "UVFBasic.h" /************************************************ Tables *************************************************/ namespace UVFTables { enum ChecksumSemanticTable { CS_NONE = 0, CS_CRC32, CS_MD5, CS_UNKNOWN }; enum CompressionSemanticTable { COS_NONE = 0, COS_UNKNOWN }; enum BlockSemanticTable { BS_EMPTY = 0, BS_REG_NDIM_GRID, BS_NDIM_TRANSFER_FUNC, BS_PREVIEW_IMAGE, BS_KEY_VALUE_PAIRS, BS_1D_HISTOGRAM, BS_2D_HISTOGRAM, BS_MAXMIN_VALUES, BS_GEOMETRY, BS_TOC_BLOCK, BS_UNKNOWN }; enum DomainSemanticTable { DS_NONE = 0, DS_X, DS_Y, DS_Z, DS_TIME, DS_UNKNOWN }; enum ElementSemanticTable { ES_UNDEFINED = 0, ES_VECTOR, ES_TENSOR, ES_SYM_TENSOR, ES_RED = 10000, ES_GREEN, ES_BLUE, ES_ALPHA, ES_MR = 20000, ES_CT, ES_TIME = 30000, ES_MASS, ES_ELECTRIC_CURRENT, ES_THERMODYNAMIC_TEMPERATURE, ES_AMOUNT_OF_SUBSTANCE, ES_LUMINOUS_INTENSITY, ES_UNKNOWN }; /************************************************ Calls *************************************************/ std::string ChecksumSemanticToCharString(ChecksumSemanticTable uiTable); std::wstring ChecksumSemanticToString(ChecksumSemanticTable uiTable); uint64_t ChecksumElemLength(ChecksumSemanticTable uiTable); std::string CompressionSemanticToCharString(CompressionSemanticTable uiTable); std::wstring CompressionSemanticToString(CompressionSemanticTable uiTable); std::string BlockSemanticTableToCharString(BlockSemanticTable uiTable); std::wstring BlockSemanticTableToString(BlockSemanticTable uiTable); std::shared_ptr CreateBlockFromSemanticEntry( BlockSemanticTable uiTable, LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, uint64_t iUVFFileVersion ); std::string DomainSemanticToCharString(DomainSemanticTable uiTable); std::wstring DomainSemanticToString(DomainSemanticTable uiTable); std::string ElementSemanticTableToCharString(ElementSemanticTable uiTable); std::wstring ElementSemanticTableToString(ElementSemanticTable uiTable); } #endif // UVFTABLES_H ImageVis3D-3.1.0/Tuvok/IO/UVF/Histogram2DDataBlock.h0000644000175000017500000000447112320456500021403 0ustar mathieumathieu#pragma once #ifndef UVF_HISTOGRAM2DDATABLOCK_H #define UVF_HISTOGRAM2DDATABLOCK_H #include "DataBlock.h" #include "TOCBlock.h" #include "../../Basics/Vectors.h" class RasterDataBlock; class Histogram2DDataBlock : public DataBlock { public: Histogram2DDataBlock(); ~Histogram2DDataBlock(); Histogram2DDataBlock(const Histogram2DDataBlock &other); Histogram2DDataBlock(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian); virtual Histogram2DDataBlock& operator=(const Histogram2DDataBlock& other); virtual uint64_t ComputeDataSize() const; bool Compute(const TOCBlock* source, uint64_t iLevel, size_t iHistoBinCount, double fMaxNonZeroValue); bool Compute(const RasterDataBlock* source, size_t iHistoBinCount, double fMaxNonZeroValue); const std::vector>& GetHistogram() const { return m_vHistData; } void SetHistogram(std::vector>& vHistData, float fMaxGradMagnitude) { m_vHistData = vHistData; m_fMaxGradMagnitude=fMaxGradMagnitude; } float GetMaxGradMagnitude() const {return m_fMaxGradMagnitude;} protected: std::vector> m_vHistData; float m_fMaxGradMagnitude; virtual void CopyHeaderToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock); virtual uint64_t GetHeaderFromFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian); virtual uint64_t CopyToFile(LargeRAWFile_ptr pStreamFile, uint64_t iOffset, bool bIsBigEndian, bool bIsLastBlock); virtual uint64_t GetOffsetToNextBlock() const; virtual DataBlock* Clone() const; template FUNC_PURE DOUBLEVECTOR3 ComputeGradient(const T* pTempBrickData, double normalizationFactor, size_t iCompcount, const UINTVECTOR3& size, const UINTVECTOR3& coords); template void ComputeTemplate(const TOCBlock* source, double normalizationFactor, uint64_t iLevel, size_t iHistoBinCount, double fMaxNonZeroValue); }; #endif // UVF_HISTOGRAM2DDATABLOCK_H ImageVis3D-3.1.0/Tuvok/IO/UVF/UVF.h0000644000175000017500000000534212320456500016151 0ustar mathieumathieu#pragma once #ifndef UVF_H #define UVF_H #include #include "UVFBasic.h" #include "UVFTables.h" #include "GlobalHeader.h" class DataBlock; class DataBlockListElem { public: DataBlockListElem() : m_bIsDirty(false), m_bHeaderIsDirty(false), m_iOffsetInFile(0), m_iBlockSize(0) {} DataBlockListElem(std::shared_ptr block, bool bIsDirty, uint64_t iOffsetInFile, uint64_t iBlockSize) : m_block(block), m_bIsDirty(bIsDirty), m_bHeaderIsDirty(bIsDirty), m_iOffsetInFile(iOffsetInFile), m_iBlockSize(iBlockSize) {} std::shared_ptr m_block; bool m_bIsDirty; bool m_bHeaderIsDirty; uint64_t m_iOffsetInFile; uint64_t GetBlockSize() {return m_iBlockSize;} protected: uint64_t m_iBlockSize; friend class UVF; }; class UVF { public: static uint64_t ms_ulReaderVersion; UVF(std::wstring wstrFilename); virtual ~UVF(void); bool Open(bool bMustBeSameVersion=true, bool bVerify=true, bool bReadWrite=false, std::string* pstrProblem = NULL); void Close(); const GlobalHeader& GetGlobalHeader() const {return m_GlobalHeader;} uint64_t GetDataBlockCount() const {return uint64_t(m_DataBlocks.size());} const std::shared_ptr GetDataBlock(uint64_t index) const; DataBlock* GetDataBlockRW(uint64_t index, bool bOnlyChangeHeader); // file creation routines bool SetGlobalHeader(const GlobalHeader& GlobalHeader); bool AddConstDataBlock(std::shared_ptr dataBlock); bool AddDataBlock(std::shared_ptr dataBlock); bool Create(); // RW access routines bool AppendBlockToFile(std::shared_ptr dataBlock); bool DropBlockFromFile(size_t iBlockIndex); static bool IsUVFFile(const std::wstring& wstrFilename); static bool IsUVFFile(const std::wstring& wstrFilename, bool& bChecksumFail); protected: bool m_bFileIsLoaded; bool m_bFileIsReadWrite; LargeRAWFile_ptr m_streamFile; uint64_t m_iAccumOffsets; GlobalHeader m_GlobalHeader; std::vector> m_DataBlocks; bool ParseGlobalHeader(bool bVerify, std::string* pstrProblem = NULL); void ParseDataBlocks(); static bool VerifyChecksum(LargeRAWFile_ptr streamFile, GlobalHeader& globalHeader, std::string* pstrProblem = NULL); static std::vector ComputeChecksum( LargeRAWFile_ptr streamFile, UVFTables::ChecksumSemanticTable eChecksumSemanticsEntry ); static bool CheckMagic(LargeRAWFile_ptr streamFile); // file creation routines uint64_t ComputeNewFileSize(); void UpdateChecksum(); }; #endif // UVF_H ImageVis3D-3.1.0/Tuvok/IO/TransferFunction2D.h0000644000175000017500000001273412320456500020534 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file TransferFunction2D.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date July 2008 */ #pragma once #ifndef TRANSFERFUNCTION2D #define TRANSFERFUNCTION2D #include "StdTuvokDefines.h" #include #include #include /// @todo FIXME remove this dependency: #ifdef TUVOK_NO_QT typedef void* QImage; typedef void* QPainter; #else # include # include #endif #include "Basics/Vectors.h" #include "Basics/Grids.h" #include "TransferFunction1D.h" typedef Grid2D Histogram2D; typedef Grid2D NormalizedHistogram2D; typedef Grid2D ColorData2D; typedef Grid2D< VECTOR4> ColorData2D8Bit; typedef std::pair< float, FLOATVECTOR4 > GradientStop; class TFPolygon { public: TFPolygon() : bRadial(false) {} bool Load(std::ifstream& file); void Save(std::ofstream& file) const; bool bRadial; std::vector< FLOATVECTOR2 > pPoints; FLOATVECTOR2 pGradientCoords[2]; std::vector< GradientStop > pGradientStops; }; class TransferFunction2D { public: TransferFunction2D(); TransferFunction2D(const VECTOR2& iSize); TransferFunction2D(const std::string& filename); ~TransferFunction2D(void); void Resize(const Histogram2D& hist) {Resize(hist.GetSize());} void Resize(const NormalizedHistogram2D& hist) {Resize(hist.GetSize());} void Resize(const VECTOR2& iSize); void Resample(const VECTOR2& iSize); bool Load(const std::string& filename); bool Load(const std::string& filename, const VECTOR2& vTargetSize); bool Save(const std::string& filename) const; void InvalidateCache() {m_bUseCachedData = false;} void GetByteArray(unsigned char** pcData); void GetByteArray(unsigned char** pcData, unsigned char cUsedRange); void GetShortArray(unsigned short** psData, unsigned short sUsedRange=4095); void GetFloatArray(float** pfData); // Functions bound into Lua. std::shared_ptr> SwatchGet() const; size_t SwatchArrayGetSize() const; void SwatchPushBack(const TFPolygon& swatch); void SwatchErase(size_t swatchIndex); /// Inserts swatch at index 'i' whose value is 'swatch'. void SwatchInsert(size_t i, const TFPolygon& swatch); /// Replaces the swatch at index 'i' with 'swatch'. void SwatchUpdate(size_t i, const TFPolygon& swatch); bool SwatchIsRadial(size_t i) const; void SwatchSetRadial(size_t i, bool radial); size_t SwatchGetGradientCount(size_t i) const; GradientStop SwatchGetGradient(size_t swatch, size_t i) const; void SwatchInsertGradient(size_t swatch, size_t i, GradientStop stop); void SwatchPushBackGradient(size_t swatch, GradientStop stop); void SwatchEraseGradient(size_t swatch, size_t i); void SwatchUpdateGradient(size_t swatch, size_t i, GradientStop stop); void SwatchInsertPoint(size_t swatch, size_t i, FLOATVECTOR2 coord); void SwatchErasePoint(size_t swatch, size_t i); size_t SwatchGetNumPoints(size_t i) const; std::shared_ptr> m_pvSwatches; const VECTOR2 GetSize() const {return m_iSize;} const VECTOR2 GetRenderSize() const { VECTOR2 vSize = m_iSize; vSize.StoreMin(VECTOR2(4096, 4096)); return vSize.x > vSize.y ? VECTOR2(vSize.x, static_cast(vSize.x/2.0)) : VECTOR2(vSize.y*2, vSize.y); } void ComputeNonZeroLimits(); const UINT64VECTOR4& GetNonZeroLimits() { return m_vValueBBox;} const TransferFunction1D* Get1DTrans() {return &m_Trans1D;} const QImage& Get1DTransImage() {return m_Trans1DImage;} void Update1DTrans(const TransferFunction1D* p1DTrans); protected: TransferFunction1D m_Trans1D; QImage m_Trans1DImage; VECTOR2 m_iSize; ColorData2D* RenderTransferFunction(); unsigned char* RenderTransferFunction8Bit(); INTVECTOR2 Normalized2Offscreen(FLOATVECTOR2 vfCoord, VECTOR2 iSize) const; private: ColorData2D* m_pColorData; unsigned char* m_pPixelData; QPainter m_Painter; QImage* m_pRCanvas; UINT64VECTOR4 m_vValueBBox; bool m_bUseCachedData; void DeleteCanvasData(); }; #endif // TRANSFERFUNCTION2D ImageVis3D-3.1.0/Tuvok/IO/const-brick-iterator.h0000644000175000017500000000757012320456500021123 0ustar mathieumathieu#ifndef TUVOK_CONST_BRICK_ITERATOR_H #define TUVOK_CONST_BRICK_ITERATOR_H #include #include #include #include "Brick.h" namespace tuvok { /// Takes a number of voxels and a given brick size, and yields a brick /// whenever it is dereferenced. Continues on to multiple LODs, until we /// create an LOD which is a single brick. /// Note that this is completely ignorant of ghost data! /// Example usage: /// for(auto b=begin({{128,128,128}}, {{16,16,16}}, ...); b != end(); ++b) { /// MESSAGE("working with brick <%u,%u,%u>", /// static_cast(std::get<0>(b.first)), /// static_cast(std::get<1>(b.first)), /// static_cast(std::get<2>(b.first))); /// } class const_brick_iterator : public std::iterator, int> { public: ///@parameter voxels number of voxels in the data set ///@parameter bricksize size of the bricks to use ///@parameter extent low/high of the data in world space explicit const_brick_iterator( const std::array& voxels, const std::array& bricksize, const std::array,2>& extent ); #ifdef _MSC_VER const_brick_iterator() : MaxLODs(0), LOD(0) { #else const_brick_iterator() : bsize({{0,0,0}}), MaxLODs(0), voxels({{0,0,0}}), LOD(0), location({{0,0,0}}), extents({{ {{0.0f,0.0f,0.0f}}, {{1.0f,1.0f,1.0f}} }}) { #endif voxels[0] = voxels[1] = voxels[2] = 0ULL; location[0] = location[1] = location[2] = 0ULL; } const_brick_iterator& advance(); const_brick_iterator& operator++(); const std::pair dereference() const; const std::pair operator*() const; bool equals(const const_brick_iterator& iter) const; bool operator==(const const_brick_iterator& iter) const; bool operator!=(const const_brick_iterator& iter) const; private: const std::array bsize; const size_t MaxLODs; ///< number of LODs we'll have total std::array voxels; ///< in the current LOD size_t LOD; ///< what LOD we're on. 0 is fine. +1 is coarser, ... // current brick, in layout coords (not voxels) std::array location; const std::array,2> extents; }; const_brick_iterator begin(const std::array& voxels, const std::array& bricksize, const std::array,2>& extents); const_brick_iterator end(); } #endif // TUVOK_CONST_BRICK_ITERATOR_H /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012-2013 IVDA Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/DynamicBrickingDS.cpp0000644000175000017500000013754612320456500020704 0ustar mathieumathieu// * can we chain these recursively? e.g.: // DynBrickingDS a(ds, {{128, 128, 128}}); // DynBrickingDS b(a, {{16, 16, 16}}); // * ContainsData: deal with new metadata appropriately #include #include #include #include #include #include #include #include #include "Basics/SysTools.h" #include "Controller/Controller.h" #include "Controller/StackTimer.h" #include "BrickCache.h" #include "DynamicBrickingDS.h" #include "FileBackedDataset.h" #include "IOManager.h" #include "const-brick-iterator.h" #include "uvfDataset.h" // This file deals with some tricky indexing. The convention here is that a // std::array refers to a BRICK index, whereas a // std::array refers to a VOXEL index. We also try to use "source" // in variable names which refer to indices from the data set which actually // exists, and "target" to refer to indices in the faux/rebricked data set. typedef std::array BrickLayout; typedef std::array BrickIndex; typedef std::array VoxelIndex; typedef std::array VoxelLayout; typedef std::array BrickSize; namespace tuvok { #ifndef NDEBUG static bool test(); #endif struct GBPrelim { const BrickKey skey; const BrickSize tgt_bs; const BrickSize src_bs; VoxelIndex src_offset; }; struct DynamicBrickingDS::dbinfo { std::shared_ptr ds; const BrickSize brickSize; BrickCache cache; size_t cacheBytes; std::unordered_map minmax; enum MinMaxMode mmMode; dbinfo(std::shared_ptr d, BrickSize bs, size_t bytes, enum MinMaxMode mm) : ds(d), brickSize(bs), cacheBytes(bytes), mmMode(mm) {} // early, non-type-specific parts of GetBrick. GBPrelim BrickSetup(const BrickKey&, const DynamicBrickingDS& tgt) const; // reads the brick + handles caching template bool Brick(const DynamicBrickingDS& ds, const BrickKey& key, std::vector& data); // given the brick key in the dynamic DS, return the corresponding BrickKey // in the source data. BrickKey SourceBrickKey(const BrickKey&) const; BrickLayout TargetBrickLayout(size_t lod, size_t ts) const; /// since ComputeMinMaxes is soooo absurdly slow, we try to cache the /// results. These load/save all our min/maxes to a stream. ///@{ void LoadMinMax(std::istream&); void SaveMinMax(std::ostream&) const; ///@} /// run through all of the bricks and compute min/max info. void ComputeMinMaxes(BrickedDataset&); // sets the cache size (bytes) void SetCacheSize(size_t bytes); // get the cache size (bytes) size_t GetCacheSize() const; /// @returns true if 'bytes' bytes will fit into the current cache bool FitsInCache(size_t bytes) const; void VerifyBrick(const std::pair& brk) const; /// @returns the size of the brick, minus any ghost voxels. BrickSize BrickSansGhost() const; template bool CopyBrick(std::vector& dest, Iter src, size_t components, const BrickSize tgt_bs, const BrickSize src_bs, VoxelIndex src_offset); }; BrickSize SourceMaxBrickSize(const BrickedDataset&); BrickSize ComputedTargetBrickSize(BrickIndex idx, VoxelLayout voxels, BrickSize bsize); // gives the number of ghost voxels (per dimension) in a brick. must be the // same for both source and target. static unsigned ghost(const Dataset& ds) { assert(ds.GetBrickOverlapSize()[0] == ds.GetBrickOverlapSize()[1] && ds.GetBrickOverlapSize()[1] == ds.GetBrickOverlapSize()[2]); return ds.GetBrickOverlapSize()[0]*2; } /// gives the brick layout for a given decomposition. i.e. the number of bricks /// in each dimension static std::array layout(const std::array voxels, const BrickSize bsize) { std::array tmp = {{ static_cast(ceil(static_cast(voxels[0]) / bsize[0])), static_cast(ceil(static_cast(voxels[1]) / bsize[1])), static_cast(ceil(static_cast(voxels[2]) / bsize[2])), }}; return tmp; } // ditto, but the location is unsigned instead of uint64_t. // remember unsigned is for brick indices, uint64_t is for voxel indices static uint64_t to1d(const std::array& loc, const VoxelLayout& size) { assert(loc[2] < size[2]); assert(loc[1] < size[1]); assert(loc[0] < size[0]); return loc[2]*size[1]*size[0] + loc[1]*size[0] + loc[0]; } DynamicBrickingDS::DynamicBrickingDS(std::shared_ptr ds, BrickSize maxBrickSize, size_t bytes, enum MinMaxMode mm) : di(new DynamicBrickingDS::dbinfo(ds, maxBrickSize, bytes, mm)) { this->Rebrick(); } DynamicBrickingDS::~DynamicBrickingDS() {} // Many of the methods here just forward to the provided 'Dataset' // implementation. This just saves us a bunch of typing. // 'C' is short for 'const' and 'RET' means it returns something. #define CFORWARDRET(type, methodName) \ type DynamicBrickingDS::methodName() const { \ return di->ds->methodName(); \ } #define FORWARDRET(type, methodName) \ type DynamicBrickingDS::methodName() { \ return di->ds->methodName(); \ } CFORWARDRET(float, MaxGradientMagnitude) CFORWARDRET(std::shared_ptr, Get1DHistogram) CFORWARDRET(std::shared_ptr, Get2DHistogram) void DynamicBrickingDS::SetCacheSize(size_t megabytes) { /// they give us megabytes, but our internal class deals with bytes! const size_t bytes = megabytes * 1024 * 1024; this->di->SetCacheSize(bytes); } size_t DynamicBrickingDS::GetCacheSize() const { /// they give us bytes, but we want megabytes! const size_t megabyte = 1024 * 1024; return this->di->GetCacheSize() / megabyte; } // Removes all the cache information we've made so far. void DynamicBrickingDS::Clear() { di->ds->Clear(); while(this->di->cache.size() > 0) { this->di->cache.remove(); } BrickedDataset::Clear(); this->Rebrick(); } // with the layout and 1D index, convert into the 3D index. // we use it to convert 1D brick indices into 3D brick indices static std::array to3d(const std::array dim, uint64_t idx) { assert(dim[0] > 0); assert(dim[1] > 0); assert(dim[2] > 0); assert(idx < (dim[0]*dim[1]*dim[2])); std::array tmp = {{ static_cast(idx % dim[0]), static_cast((idx / dim[0]) % dim[1]), static_cast(idx / (dim[0] * dim[1])) }}; assert(tmp[0] < dim[0]); assert(tmp[1] < dim[1]); assert(tmp[2] < dim[2]); return tmp; } // what is our brick layout (how many bricks in each dimension) in the // given source dataset? BrickLayout SourceBrickLayout(const std::shared_ptr ds, size_t lod, size_t timestep) { const UINTVECTOR3 layout = ds->GetBrickLayout(lod, timestep); const BrickLayout tmp = {{ static_cast(layout[0]), static_cast(layout[1]), static_cast(layout[2]) }}; return tmp; } BrickSize BrickSansGhost(BrickSize bsize) { #if 0 bsize[0] = bsize[0] > ghost() ? bsize[0]-ghost() : bsize[0]; bsize[1] = bsize[1] > ghost() ? bsize[1]-ghost() : bsize[1]; bsize[2] = bsize[2] > ghost() ? bsize[2]-ghost() : bsize[2]; #else bsize[0] = bsize[0] > 4 ? bsize[0]-4 : bsize[0]; bsize[1] = bsize[1] > 4 ? bsize[1]-4 : bsize[1]; bsize[2] = bsize[2] > 4 ? bsize[2]-4 : bsize[2]; #endif return bsize; } BrickSize DynamicBrickingDS::dbinfo::BrickSansGhost() const { const size_t gh = ghost(*this->ds); BrickSize bsize = {{ this->brickSize[0] - gh, this->brickSize[1] - gh, this->brickSize[2] - gh }}; return bsize; } // gives the number of bricks in each dimension. // @param bsize the brick size to use WITHOUT ghost voxels! static const BrickLayout GenericBrickLayout( const VoxelLayout voxels, const BrickSize bsize ) { const BrickLayout blayout = {{ static_cast(layout(voxels, bsize)[0]), static_cast(layout(voxels, bsize)[1]), static_cast(layout(voxels, bsize)[2]) }}; assert(blayout[0] > 0); assert(blayout[1] > 0); assert(blayout[2] > 0); return blayout; } // identifies the number of bricks we have in the target dataset for // each brick in the source dataset. that is, how many bricks we're // stuffing into one brick. // this fits in integer numbers because we enforce that rebricking subdivides // the original volume/bricks nicely. std::array TargetBricksPerSource(BrickSize src, BrickSize tgt) { std::array rv = {{ static_cast(src[0] / tgt[0]), static_cast(src[1] / tgt[1]), static_cast(src[2] / tgt[2]) }}; assert(rv[0] > 0); assert(rv[1] > 0); assert(rv[2] > 0); return rv; } // with a brick identifier from the target dataset, find the 3D brick index in // the source dataset. // basic idea: // 1. how many voxels do we have in this LOD? how big are our bricks? // 2. values in (1) should divide evenly; this lets us convert VOXEL indices // to BRICK indices. // 3. we know how our 3D bricks are layed out via (2); use that to convert // our 1D-brick-index into a 3D-brick-index // 4. identify how many bricks we have in the target data set for each brick // in the source dataset. // 5. divide the computed index (3) by our ratio (4). lop off any remainder. BrickIndex SourceBrickIndex(const BrickKey& k, const BrickedDataset& ds, const BrickSize bsize) { // See the comment Rebrick: we shouldn't have more LODs than the source data. assert(std::get<1>(k) < ds.GetLODLevelCount()); const size_t lod = std::min(std::get<1>(k), static_cast(ds.GetLODLevelCount())); const size_t timestep = std::get<0>(k); // identify how many voxels we've got const VoxelLayout voxels = {{ ds.GetDomainSize(lod, timestep)[0], ds.GetDomainSize(lod, timestep)[1], ds.GetDomainSize(lod, timestep)[2] }}; // now we know how many voxels we've got. we can use that to convert the 1D // index we have back into the 3D index. const size_t idx1d = std::get<2>(k); BrickIndex idx = to3d(layout(voxels, BrickSansGhost(bsize)), idx1d); const BrickSize tgt_bs = BrickSansGhost(bsize); const BrickSize src_bs = SourceMaxBrickSize(ds); const std::array bricks_per_src = TargetBricksPerSource(src_bs, tgt_bs); BrickIndex rv = {{ idx[0] / bricks_per_src[0], idx[1] / bricks_per_src[1], idx[2] / bricks_per_src[2] }}; return rv; } VoxelIndex OffsetIntoSource(const BrickedDataset& src, const BrickKey& tgtkey, const BrickSize bsize /* target */) { // See the comment Rebrick: we shouldn't have more LODs than the source data. assert(std::get<1>(tgtkey) < src.GetLODLevelCount()); const size_t lod = std::min(std::get<1>(tgtkey), static_cast(src.GetLODLevelCount())); const size_t timestep = std::get<0>(tgtkey); // identify how many voxels we've got const VoxelLayout voxels = {{ src.GetDomainSize(lod, timestep)[0], src.GetDomainSize(lod, timestep)[1], src.GetDomainSize(lod, timestep)[2] }}; // now we know how many voxels we've got. we can use that to convert the 1D // index we have back into the 3D index. const size_t idx1d = std::get<2>(tgtkey); BrickIndex idx = to3d(layout(voxels, BrickSansGhost(bsize)), idx1d); const BrickSize tgt_bs = BrickSansGhost(bsize); const BrickSize src_bs = SourceMaxBrickSize(src); const std::array bricks_per_src = TargetBricksPerSource(src_bs, tgt_bs); VoxelIndex rv = {{ (idx[0] % bricks_per_src[0]) * tgt_bs[0], (idx[1] % bricks_per_src[1]) * tgt_bs[1], (idx[2] % bricks_per_src[2]) * tgt_bs[2] }}; return rv; } // @returns the number of voxels in the given level of detail. VoxelLayout VoxelsInLOD(const Dataset& ds, size_t lod) { const size_t timestep = 0; /// @todo properly implement. UINT64VECTOR3 domain = ds.GetDomainSize(lod, timestep); VoxelLayout tmp = {{ domain[0], domain[1], domain[2] }}; return tmp; } // @return the brick size which the given dataset *tries* to use. Of course, // if the bricks don't fit evenly, there will be some bricks on the edge which // are smaller. BrickSize SourceMaxBrickSize(const BrickedDataset& ds) { BrickSize src_bs = {{ static_cast(ds.GetMaxBrickSize()[0])-ghost(ds), static_cast(ds.GetMaxBrickSize()[1])-ghost(ds), static_cast(ds.GetMaxBrickSize()[2])-ghost(ds), }}; assert(src_bs[0] > 0 && src_bs[0] < 65535); // must make sense. assert(src_bs[1] > 0 && src_bs[1] < 65535); assert(src_bs[2] > 0 && src_bs[2] < 65535); return src_bs; } // with the source brick index, give a brick key for the source dataset. BrickKey SourceKey(const BrickIndex brick_idx, size_t lod, const BrickedDataset& ds) { const VoxelLayout src_voxels = VoxelsInLOD(ds, lod); const BrickSize src_bricksize = SourceMaxBrickSize(ds); const size_t timestep = 0; /// @todo properly implement return BrickKey(timestep, lod, to1d(brick_idx, layout(src_voxels, src_bricksize))); } // figure out the voxel index of the upper left corner of a brick static VoxelIndex Index( const Dataset& ds, size_t lod, uint64_t idx1d, const BrickSize bricksize ) { const VoxelLayout voxels = VoxelsInLOD(ds, lod); const BrickIndex idx3d = to3d( layout(voxels, BrickSansGhost(bricksize)), idx1d ); VoxelIndex idx = {{ 0, 0, 0 }}; for(size_t x=0; x < idx3d[0]; ++x) { BrickIndex i = {{ unsigned(x), 0, 0 }}; idx[0] += ComputedTargetBrickSize(i, voxels, bricksize)[0] - ghost(ds); } for(size_t y=0; y < idx3d[1]; ++y) { BrickIndex i = {{ 0, unsigned(y), 0 }}; idx[1] += ComputedTargetBrickSize(i, voxels, bricksize)[1] - ghost(ds); } for(size_t z=0; z < idx3d[2]; ++z) { BrickIndex i = {{ 0, 0, unsigned(z) }}; idx[2] += ComputedTargetBrickSize(i, voxels, bricksize)[2] - ghost(ds); } return idx; } // index of the first voxel of the given brick, among the whole level. VoxelIndex TargetIndex(const BrickKey& k, const Dataset& ds, const BrickSize bricksize) { const size_t idx1d = std::get<2>(k); const size_t lod = std::get<1>(k); return Index(ds, lod, idx1d, bricksize); } // index of the first voxel in the current brick, among the whole level VoxelIndex SourceIndex(const BrickKey& k, const BrickedDataset& ds) { const size_t lod = std::get<1>(k); const size_t idx1d = std::get<2>(k); const BrickSize src_bs = SourceMaxBrickSize(ds); return Index(ds, lod, idx1d, src_bs); } BrickSize ComputedTargetBrickSize(BrickIndex idx, VoxelLayout voxels, BrickSize bsize) { const VoxelIndex bl = layout(voxels, BrickSansGhost(bsize)); std::array last = {{ idx[0] == bl[0]-1, idx[1] == bl[1]-1, idx[2] == bl[2]-1, }}; const BrickSize no_ghost = BrickSansGhost(bsize); const BrickSize rv = {{ last[0] && (voxels[0] % no_ghost[0]) ? 4 + (voxels[0]%no_ghost[0]) : bsize[0], last[1] && (voxels[1] % no_ghost[1]) ? 4 + (voxels[1]%no_ghost[1]) : bsize[1], last[2] && (voxels[2] % no_ghost[2]) ? 4 + (voxels[2]%no_ghost[2]) : bsize[2] }}; return rv; } // gives the size of the given brick from the target DS BrickSize TargetBrickSize(const Dataset& tgt, const BrickKey& k) { const BrickedDataset& b = dynamic_cast(tgt); UINTVECTOR3 sz = b.GetBrickMetadata(k).n_voxels; BrickSize tmp = {{ static_cast(sz[0]), static_cast(sz[1]), static_cast(sz[2]), }}; return tmp; } // gives the size of the given brick from the source DS BrickSize SourceBrickSize(const BrickedDataset& src, const BrickKey& k) { const BrickedDataset& b = dynamic_cast(src); UINTVECTOR3 sz = b.GetBrickMetadata(k).n_voxels; BrickSize tmp = {{ static_cast(sz[0]), static_cast(sz[1]), static_cast(sz[2]) }}; return tmp; } // given the brick key in the dynamic DS, return the corresponding BrickKey // in the source data. BrickKey DynamicBrickingDS::dbinfo::SourceBrickKey(const BrickKey& k) const { const size_t lod = std::get<1>(k); const BrickIndex src_bidx = SourceBrickIndex(k, *this->ds, this->brickSize); BrickKey skey = SourceKey(src_bidx, lod, *(this->ds)); #ifndef NDEBUG // brick key should make sense. std::shared_ptr bds = std::dynamic_pointer_cast(this->ds); assert(std::get<0>(skey) < bds->GetNumberOfTimesteps()); assert(std::get<2>(skey) < bds->GetTotalBrickCount()); #endif MESSAGE("keymap query: <%u,%u,%u> -> <%u,%u,%u>", static_cast(std::get<0>(k)), static_cast(std::get<1>(k)), static_cast(std::get<2>(k)), static_cast(std::get<0>(skey)), static_cast(std::get<1>(skey)), static_cast(std::get<2>(skey))); return skey; } BrickLayout DynamicBrickingDS::dbinfo::TargetBrickLayout(size_t lod, size_t ts) const { const VoxelLayout voxels = {{ this->ds->GetDomainSize(lod, ts)[0], this->ds->GetDomainSize(lod, ts)[1], this->ds->GetDomainSize(lod, ts)[2] }}; BrickLayout tgt_blayout = GenericBrickLayout(voxels, this->BrickSansGhost()); return tgt_blayout; } // This is the type-dependent part of ::GetBrick. Basically, the copying of // the source data into the target brick. template bool DynamicBrickingDS::dbinfo::CopyBrick( std::vector& dest, const Iter srcdata, size_t components, const BrickSize tgt_bs, const BrickSize src_bs, VoxelIndex src_offset ) { assert(tgt_bs[0] <= src_bs[0] && "target can't be larger than source"); assert(tgt_bs[1] <= src_bs[1] && "target can't be larger than source"); assert(tgt_bs[2] <= src_bs[2] && "target can't be larger than source"); // make sure the vector is big enough. //assert(dest.size() >= (tgt_bs[0]*tgt_bs[1]*tgt_bs[2])); // be sure! dest.resize(tgt_bs[0]*tgt_bs[1]*tgt_bs[2]*components); const VoxelIndex orig_offset = src_offset; // our copy size/scanline size is the width of our target brick. const size_t scanline = tgt_bs[0] * components; for(uint64_t z=0; z < tgt_bs[2]; ++z) { for(uint64_t y=0; y < tgt_bs[1]; ++y) { const uint64_t x = 0; const uint64_t tgt_offset = (z*tgt_bs[0]*tgt_bs[1] + y*tgt_bs[0] + x) * components; const uint64_t src_o = (src_offset[2]*src_bs[0]*src_bs[1] + src_offset[1]*src_bs[0] + src_offset[0]) * components; #if 0 // memcpy-based: works fast even in debug. std::copy(srcdata.data()+src_o, srcdata.data()+src_o+scanline, dest.data()+tgt_offset); #else // iterators: gives nice error messages in debug. std::copy(srcdata+src_o, srcdata+src_o+scanline, dest.begin()+tgt_offset); #endif src_offset[1]++; // should follow 'y' increment. } src_offset[1] = orig_offset[1]; src_offset[2]++; // .. and increment z } return true; } // early, non-type-specific parts of GetBrick. // Note that because of how we do the re-bricking, we know that all the target // bricks will fit nicely inside a (single) source brick. This is important, // becuase otherwise we'd have to read a bunch of bricks from the source, and // copy pieces from all of them. GBPrelim DynamicBrickingDS::dbinfo::BrickSetup(const BrickKey& k, const DynamicBrickingDS& tgt) const { assert(tgt.bricks.find(k) != tgt.bricks.end()); const BrickKey skey = this->SourceBrickKey(k); const BrickSize tgt_bs = TargetBrickSize(tgt, k); const BrickSize src_bs = SourceBrickSize(*this->ds, skey); assert(tgt_bs[0] <= src_bs[0] && "target can't be larger than source"); assert(tgt_bs[1] <= src_bs[1] && "target can't be larger than source"); assert(tgt_bs[2] <= src_bs[2] && "target can't be larger than source"); // Unless this (target) brick sits at the bottom corner of the source brick, // we'll need to start reading from the source brick at an offset. What is // that offset? VoxelIndex src_offset = OffsetIntoSource(*this->ds, k, this->brickSize); GBPrelim rv = { skey, tgt_bs, src_bs, src_offset }; return rv; } // Looks for the brick in the cache; if so, uses it. Otherwise, grab the brick template bool DynamicBrickingDS::dbinfo::Brick(const DynamicBrickingDS& ds, const BrickKey& key, std::vector& data) { StackTimer gbrick(PERF_DY_GET_BRICK); GBPrelim pre = this->BrickSetup(key, ds); const void* lookup; { tuvok::Controller::Instance().IncrementPerfCounter(PERF_DY_CACHE_LOOKUPS, 1.0); StackTimer cc(PERF_DY_CACHE_LOOKUP); lookup = this->cache.lookup(pre.skey, T(42)); } // first: check the cache and see if we can get the data easy. if(NULL != lookup) { MESSAGE("found <%u,%u,%u> in the cache!", static_cast(std::get<0>(pre.skey)), static_cast(std::get<1>(pre.skey)), static_cast(std::get<2>(pre.skey))); tuvok::Controller::Instance().IncrementPerfCounter(PERF_DY_BRICK_COPIED, 1.0); StackTimer copies(PERF_DY_BRICK_COPY); const T* srcdata = static_cast(lookup); const size_t components = this->ds->GetComponentCount(); return this->CopyBrick(data, srcdata, components, pre.tgt_bs, pre.src_bs, pre.src_offset); } // nope? oh well. read it. std::vector srcdata; { StackTimer loadBrick(PERF_DY_RESERVE_BRICK); srcdata.resize(this->ds->GetMaxBrickSize().volume()); } { StackTimer loadBrick(PERF_DY_LOAD_BRICK); if(!this->ds->GetBrick(pre.skey, srcdata)) { return false; } } // add it to the cache. const T* sdata = static_cast(srcdata.data()); if(this->cacheBytes > 0) { tuvok::Controller::Instance().IncrementPerfCounter(PERF_DY_CACHE_ADDS, 1.0); StackTimer cc(PERF_DY_CACHE_ADD); // is the cache full? find room. while(!this->FitsInCache(srcdata.size() * sizeof(T))) { this->cache.remove(); } sdata = static_cast(this->cache.add(pre.skey, srcdata)); } const size_t components = this->ds->GetComponentCount(); tuvok::Controller::Instance().IncrementPerfCounter(PERF_DY_BRICK_COPIED, 1.0); StackTimer copies(PERF_DY_BRICK_COPY); return this->CopyBrick(data, sdata, components, pre.tgt_bs, pre.src_bs, pre.src_offset); } namespace { template MinMaxBlock mm(const BrickKey& bk, const BrickedDataset& ds) { std::vector data(ds.GetMaxBrickSize().volume()); ds.GetBrick(bk, data); auto mmax = std::minmax_element(data.begin(), data.end()); return MinMaxBlock(*mmax.first, *mmax.second, DBL_MAX, -FLT_MAX); } } MinMaxBlock minmax_brick(const BrickKey& bk, const BrickedDataset& ds) { // identify type (float, etc) const unsigned size = ds.GetBitWidth() / 8; assert(ds.GetComponentCount() == 1); const bool sign = ds.GetIsSigned(); const bool fp = ds.GetIsFloat(); // giant if-block to simply call the right compile-time function w/ knowledge // we only know at run-time. if(!sign && !fp && size == 1) { return mm(bk, ds); } else if(!sign && !fp && size == 2) { return mm(bk, ds); } else if(!sign && !fp && size == 4) { return mm(bk, ds); } else if(sign && !fp && size == 1) { return mm(bk, ds); } else if(sign && !fp && size == 2) { return mm(bk, ds); } else if(sign && !fp && size == 4) { return mm(bk, ds); } else if(sign && fp && size == 4) { return mm(bk, ds); } else { T_ERROR("unsupported type."); assert(false); } return MinMaxBlock(); } /// we can cache the precomputed brick min/maxes in a file, and then /// just read those. this can be a big win, since the calculation is /// veeeery slow. /// @return the file we would save for this case. static std::string precomputed_filename(const BrickedDataset& ds, const BrickSize bsize) { try { std::ostringstream fname; const FileBackedDataset& fbds = dynamic_cast(ds); fname << "." << bsize[0] << "x" << bsize[1] << "x" << bsize[2] << "-" << SysTools::GetFilename(fbds.Filename()) << ".cached"; return fname.str(); } catch(const std::bad_cast&) { WARNING("Data doesn't come from a file. We can't save minmaxes."); } return ""; } void DynamicBrickingDS::dbinfo::LoadMinMax(std::istream& is) { if(!is) { T_ERROR("could not open min/max cache!"); return; } uint64_t n_elems; is.read(reinterpret_cast(&n_elems), sizeof(uint64_t)); for(uint64_t i=0; i < n_elems; ++i) { uint64_t timestep, lod, brick; is.read(reinterpret_cast(×tep), sizeof(uint64_t)); is.read(reinterpret_cast(&lod), sizeof(uint64_t)); is.read(reinterpret_cast(&brick), sizeof(uint64_t)); const BrickKey key(timestep, lod, brick); MinMaxBlock mm; is.read(reinterpret_cast(&mm.minScalar), sizeof(double)); is.read(reinterpret_cast(&mm.maxScalar), sizeof(double)); if(!is) { T_ERROR("read failed? cache is broken. ignoring it."); this->minmax.clear(); return; } this->minmax.insert(std::make_pair(key, mm)); } } void DynamicBrickingDS::dbinfo::SaveMinMax(std::ostream& os) const { if(!os) { T_ERROR("could not create min/max cache."); return; } const uint64_t n_elems = this->minmax.size(); MESSAGE("Saving %llu brick min/maxes", n_elems); os.write(reinterpret_cast(&n_elems), sizeof(uint64_t)); for(auto b=this->minmax.cbegin(); b != this->minmax.cend(); ++b) { uint64_t timestep, lod, brick; timestep = std::get<0>(b->first); lod = std::get<1>(b->first); brick = std::get<2>(b->first); os.write(reinterpret_cast(×tep), sizeof(uint64_t)); os.write(reinterpret_cast(&lod), sizeof(uint64_t)); os.write(reinterpret_cast(&brick), sizeof(uint64_t)); MinMaxBlock mm = b->second; os.write(reinterpret_cast(&mm.minScalar), sizeof(double)); os.write(reinterpret_cast(&mm.maxScalar), sizeof(double)); } } /// run through all of the bricks and compute min/max info. void DynamicBrickingDS::dbinfo::ComputeMinMaxes(BrickedDataset& ds) { // first, check if we have this cached. const std::string fname = precomputed_filename(ds, this->brickSize); if(SysTools::FileExists(fname)) { MESSAGE("Brick min/maxes are precomputed. Reloading from file..."); std::ifstream mmfile(fname, std::ios::binary); this->LoadMinMax(mmfile); mmfile.close(); return; } { StackTimer precompute(PERF_MM_PRECOMPUTE); unsigned i=0; const unsigned len = static_cast( std::distance(ds.BricksBegin(), ds.BricksEnd()) ); for(auto b=ds.BricksBegin(); b != ds.BricksEnd(); ++b, ++i) { MESSAGE("precomputing brick %u of %u", i, len); MinMaxBlock mm = minmax_brick(b->first, ds); this->minmax.insert(std::make_pair(b->first, mm)); while(this->cache.size() > this->cacheBytes) { this->cache.remove(); } } } // remove all cached bricks while(this->cache.size() > 0) { this->cache.remove(); } // try to cache that data to a file, now. std::ofstream mmcache(fname, std::ios::binary); if(!mmcache) { WARNING("could not open min/max cache file (%s); ignoring cache.", fname.c_str()); return; } this->SaveMinMax(mmcache); mmcache.close(); } void DynamicBrickingDS::dbinfo::SetCacheSize(size_t bytes) { this->cacheBytes = bytes; // shrink the cache to fit. while(this->cache.size() > this->cacheBytes) { this->cache.remove(); } } size_t DynamicBrickingDS::dbinfo::GetCacheSize() const { return this->cacheBytes; } /// @returns true if 'bytes' bytes will fit into the current cache bool DynamicBrickingDS::dbinfo::FitsInCache(size_t bytes) const { return bytes < this->cacheBytes; } bool DynamicBrickingDS::GetBrick(const BrickKey& k, std::vector& data) const { return this->di->Brick(*this, k, data); } bool DynamicBrickingDS::GetBrick(const BrickKey& k, std::vector& data) const { return this->di->Brick(*this, k, data); } bool DynamicBrickingDS::GetBrick(const BrickKey& k, std::vector& data) const { return this->di->Brick(*this, k, data); } bool DynamicBrickingDS::GetBrick(const BrickKey& k, std::vector& data) const { return this->di->Brick(*this, k, data); } bool DynamicBrickingDS::GetBrick(const BrickKey& k, std::vector& data) const { return this->di->Brick(*this, k, data); } bool DynamicBrickingDS::GetBrick(const BrickKey& k, std::vector& data) const { return this->di->Brick(*this, k, data); } bool DynamicBrickingDS::GetBrick(const BrickKey& k, std::vector& data) const { return this->di->Brick(*this, k, data); } bool DynamicBrickingDS::GetBrick(const BrickKey&, std::vector&) const { assert(false && "no support for double with dynamic bricking!"); return false; } void DynamicBrickingDS::SetRescaleFactors(const DOUBLEVECTOR3& scale) { this->di->ds->SetRescaleFactors(scale); } CFORWARDRET(DOUBLEVECTOR3, GetRescaleFactors) /// If the underlying file format supports it, save the current scaling /// factors to the file. The format should implicitly load and apply the /// scaling factors when opening the file. FORWARDRET(bool, SaveRescaleFactors) CFORWARDRET(DOUBLEVECTOR3, GetScale); CFORWARDRET(unsigned, GetLODLevelCount) CFORWARDRET(uint64_t, GetNumberOfTimesteps) UINT64VECTOR3 DynamicBrickingDS::GetDomainSize(const size_t lod, const size_t ts) const { return this->di->ds->GetDomainSize(lod, ts); } CFORWARDRET(UINTVECTOR3, GetBrickOverlapSize) /// @return the number of voxels for the given brick, per dimension, taking /// into account any brick overlaps. UINT64VECTOR3 DynamicBrickingDS::GetEffectiveBrickSize(const BrickKey&) const { assert(false); // unused. return UINT64VECTOR3(0,0,0); } UINTVECTOR3 DynamicBrickingDS::GetMaxBrickSize() const { return UINTVECTOR3(this->di->brickSize[0], this->di->brickSize[1], this->di->brickSize[2]); } UINTVECTOR3 DynamicBrickingDS::GetBrickLayout(size_t lod, size_t ts) const { const BrickLayout lout = this->di->TargetBrickLayout(lod, ts); return UINTVECTOR3(lout[0], lout[1], lout[2]); } CFORWARDRET(unsigned, GetBitWidth) CFORWARDRET(uint64_t, GetComponentCount) CFORWARDRET(bool, GetIsSigned) CFORWARDRET(bool, GetIsFloat) CFORWARDRET(bool, IsSameEndianness) std::pair DynamicBrickingDS::GetRange() const { return di->ds->GetRange(); } /// Acceleration queries. /// Right now, they just forward to the larger data set. We might consider /// recomputing this metadata, to get better performance at the expense of /// memory. ///@{ bool DynamicBrickingDS::ContainsData(const BrickKey& bk, double isoval) const { assert(this->bricks.find(bk) != this->bricks.end()); BrickKey skey = this->di->SourceBrickKey(bk); return di->ds->ContainsData(skey, isoval); } bool DynamicBrickingDS::ContainsData(const BrickKey& bk, double fmin, double fmax) const { assert(this->bricks.find(bk) != this->bricks.end()); BrickKey skey = this->di->SourceBrickKey(bk); return di->ds->ContainsData(skey, fmin, fmax); } bool DynamicBrickingDS::ContainsData(const BrickKey& bk, double fmin, double fmax, double fminGradient, double fmaxGradient) const { assert(this->bricks.find(bk) != this->bricks.end()); BrickKey skey = this->di->SourceBrickKey(bk); return di->ds->ContainsData(skey, fmin,fmax, fminGradient, fmaxGradient); } MinMaxBlock DynamicBrickingDS::MaxMinForKey(const BrickKey& bk) const { switch(this->di->mmMode) { case MM_SOURCE: { BrickKey skey = this->di->SourceBrickKey(bk); return di->ds->MaxMinForKey(skey); } break; case MM_DYNAMIC: return minmax_brick(bk, *this); break; case MM_PRECOMPUTE: { assert(this->di->minmax.find(bk) != this->di->minmax.end()); return this->di->minmax.find(bk)->second; } break; } return MinMaxBlock(); } ///@} bool DynamicBrickingDS::Export(uint64_t lod, const std::string& to, bool append) const { return di->ds->Export(lod, to, append); } bool DynamicBrickingDS::ApplyFunction(uint64_t lod, bool (*brickFunc)(void* pData, const UINT64VECTOR3& vBrickSize, const UINT64VECTOR3& vBrickOffset, void* pUserContext), void *pUserContext, uint64_t iOverlap) const { T_ERROR("This probably doesn't work."); return di->ds->ApplyFunction(lod, brickFunc, pUserContext, iOverlap); } const char* DynamicBrickingDS::Name() const { return "Rebricked Data"; } // Virtual constructor. Hard to make sense of this in the IOManager's // context; this isn't a register-able Dataset type which tuvok can // automatically instantiate to read a dataset. Rather, the user must *have* // such a dataset already and use this as a proxy for it. DynamicBrickingDS* DynamicBrickingDS::Create(const std::string&, uint64_t, bool) const { abort(); return NULL; } std::string DynamicBrickingDS::Filename() const { const FileBackedDataset& f = dynamic_cast( *(this->di->ds.get()) ); return f.Filename(); } bool DynamicBrickingDS::CanRead(const std::string&, const std::vector&) const { return false; } bool DynamicBrickingDS::Verify(const std::string&) const { T_ERROR("you shouldn't use a dynamic bricking DS to verify a file!"); assert(false); return false; } std::list DynamicBrickingDS::Extensions() const { WARNING("You should be calling this on the underlying DS. I'll do that " "for you, I guess..."); std::shared_ptr fbds = std::dynamic_pointer_cast(this->di->ds); return fbds->Extensions(); } // computes the layout when transitioning to a new level. // just convenience for dividing by 2 and checking to make sure a dimension // doesn't go to 0. static UINTVECTOR3 layout_next_level(UINTVECTOR3 layout) { layout = layout / 2; if(layout[0] == 0) { layout[0] = 1; } if(layout[1] == 0) { layout[1] = 1; } if(layout[2] == 0) { layout[2] = 1; } return layout; } // identifies the number of a bricks a data set will have, when divided into // bricks. static uint64_t nbricks(const VoxelLayout& voxels, const BrickSize& bricksize) { assert(voxels[0] > 0); assert(bricksize[0] > 0); assert(voxels[1] > 0); assert(bricksize[1] > 0); assert(voxels[2] > 0); assert(bricksize[2] > 0); UINTVECTOR3 blayout(voxels[0] / bricksize[0], voxels[1] / bricksize[1], voxels[2] / bricksize[2]); // if the brick size is bigger than the number of voxels, we'll end up with 0 // in that dimension! if(blayout[0] == 0) { blayout[0] = 1; } if(blayout[1] == 0) { blayout[1] = 1; } if(blayout[2] == 0) { blayout[2] = 1; } uint64_t nb = 1; while(blayout != UINTVECTOR3(1,1,1)) { nb += blayout.volume(); blayout = layout_next_level(blayout); } return nb; } // @returns true if a is a multiple of b static bool integer_multiple(unsigned a, unsigned b) { // we need to limit it somewhere so that we ensure a*i doesn't overflow. // this is overly conservative, but more than okay for the uses right now. assert(a <= 256); for(size_t i=0; i < 128; ++i) { if(a*i == b) { return true; } } return false; } // what are the low/high points of our data set? Interestingly, we don't have // a way to query this from the Dataset itself. So we find a LOD which is just // one brick, and then see how big that brick is. std::array,2> DatasetExtents(const std::shared_ptr& ds) { std::shared_ptr bds = std::dynamic_pointer_cast(ds); const size_t timestep = 0; const size_t lod = bds->GetLargestSingleBrickLOD(timestep); const BrickKey key(timestep, lod, 0); FLOATVECTOR3 extents = bds->GetBrickExtents(key); std::array,2> rv; typedef std::array vf; vf elow = {{ -(extents[0]/2.0f), -(extents[1]/2.0f), -(extents[2]/2.0f) }}; vf ehigh = {{ (extents[0]/2.0f), (extents[1]/2.0f), (extents[2]/2.0f) }}; rv[0] = elow; rv[1] = ehigh; assert(rv[1][0] >= rv[0][0]); assert(rv[1][1] >= rv[0][1]); assert(rv[1][2] >= rv[0][2]); return rv; } void DynamicBrickingDS::dbinfo::VerifyBrick( #ifndef NDEBUG const std::pair& brk) const #else const std::pair&) const #endif { const BrickSize src_bs = SourceMaxBrickSize(*this->ds); if(this->brickSize[0] == src_bs[0] && this->brickSize[1] == src_bs[1] && this->brickSize[2] == src_bs[2]) { // if we "Re"brick to the same size bricks, then all // the bricks we create should also exist in the source // dataset. assert(brk.first == this->SourceBrickKey(brk.first)); } #ifndef NDEBUG const BrickKey& srckey = this->SourceBrickKey(brk.first); #endif // brick we're creating can't be larger than the brick it reads from. assert(brk.second.n_voxels[0] <= SourceBrickSize(*this->ds, srckey)[0]); assert(brk.second.n_voxels[1] <= SourceBrickSize(*this->ds, srckey)[1]); assert(brk.second.n_voxels[2] <= SourceBrickSize(*this->ds, srckey)[2]); std::array,2> extents = DatasetExtents(this->ds); const FLOATVECTOR3 fullexts( extents[1][0] - extents[0][0], extents[1][1] - extents[0][1], extents[1][2] - extents[0][2] ); assert(brk.second.extents[0] <= fullexts[0]); assert(brk.second.extents[1] <= fullexts[1]); assert(brk.second.extents[2] <= fullexts[2]); } struct ExtCenter { FLOATVECTOR3 exts, center; }; ExtCenter BrickMetadata(size_t x, size_t y, size_t z, const BrickSize& size, const BrickSize& bsize, const VoxelLayout voxels, const std::array,2>& extents) { // lower left coordinate of the brick, in voxels const UINT64VECTOR3 voxlow(x*bsize[0], y*bsize[1], z*bsize[2]); // the high coord is the low coord + the number of voxels in the brick const UINT64VECTOR3 voxhigh(voxlow[0]+size[0], voxlow[1]+size[1], voxlow[2]+size[2]); // where the center of this brick would be, in voxels. note this is FP: // the 'center' could be a half-voxel in, if the brick has an odd number of // voxels. const std::array vox_center = {{ ((voxhigh[0] - voxlow[0]) / 2.0f) + voxlow[0], ((voxhigh[1] - voxlow[1]) / 2.0f) + voxlow[1], ((voxhigh[2] - voxlow[2]) / 2.0f) + voxlow[2], }}; // for interpolation purposes we need the # of voxels in floating point. const FLOATVECTOR3 voxelsf(static_cast(voxels[0]), static_cast(voxels[1]), static_cast(voxels[2])); assert(vox_center[0] < voxelsf[0]); assert(vox_center[1] < voxelsf[1]); assert(vox_center[2] < voxelsf[2]); ExtCenter rv; rv.center = FLOATVECTOR3( MathTools::lerp(vox_center[0], 0.0f,voxelsf[0], extents[0][0], extents[1][0]), MathTools::lerp(vox_center[1], 0.0f,voxelsf[1], extents[0][1], extents[1][1]), MathTools::lerp(vox_center[2], 0.0f,voxelsf[2], extents[0][2], extents[1][2]) ); assert(extents[0][0] <= rv.center[0] && rv.center[0] <= extents[1][0]); assert(extents[0][1] <= rv.center[1] && rv.center[1] <= extents[1][1]); assert(extents[0][2] <= rv.center[2] && rv.center[2] <= extents[1][2]); const uint64_t zero = 0ULL; // for type purposes. const FLOATVECTOR3 wlow( MathTools::lerp(voxlow[0], zero,voxels[0], extents[0][0],extents[1][0]), MathTools::lerp(voxlow[1], zero,voxels[1], extents[0][1],extents[1][1]), MathTools::lerp(voxlow[2], zero,voxels[2], extents[0][2],extents[1][2]) ); const FLOATVECTOR3 whigh( MathTools::lerp(voxhigh[0], zero,voxels[0], extents[0][0],extents[1][0]), MathTools::lerp(voxhigh[1], zero,voxels[1], extents[0][1],extents[1][1]), MathTools::lerp(voxhigh[2], zero,voxels[2], extents[0][2],extents[1][2]) ); rv.exts = whigh - wlow; assert(rv.exts[0] <= (extents[1][0] - extents[0][0])); assert(rv.exts[1] <= (extents[1][1] - extents[0][1])); assert(rv.exts[2] <= (extents[1][2] - extents[0][2])); return rv; } void DynamicBrickingDS::Rebrick() { // first make sure this makes sense. const BrickSize src_bs = SourceMaxBrickSize(*this->di->ds); if(!integer_multiple(this->di->brickSize[0]-ghost(*this), src_bs[0])) { throw std::runtime_error("x dimension is not an integer multiple of " "original brick size."); } if(!integer_multiple(this->di->brickSize[1]-ghost(*this), src_bs[1])) { throw std::runtime_error("y dimension is not an integer multiple of " "original brick size."); } if(!integer_multiple(this->di->brickSize[2]-ghost(*this), src_bs[2])) { throw std::runtime_error("z dimension is not an integer multiple of " "original brick size."); } assert(this->di->brickSize[0] > 0); assert(this->di->brickSize[1] > 0); assert(this->di->brickSize[2] > 0); BrickedDataset::Clear(); const VoxelLayout nvoxels = {{ // does not include ghost voxels. di->ds->GetDomainSize(0,0)[0], di->ds->GetDomainSize(0,0)[1], di->ds->GetDomainSize(0,0)[2] }}; MESSAGE("Rebricking %llux%llux%llu dataset (with %ux%ux%u source bricks) " "with %ux%ux%u bricks.", nvoxels[0], nvoxels[1], nvoxels[2], static_cast(src_bs[0]), static_cast(src_bs[1]), static_cast(src_bs[2]), this->di->brickSize[0] - ghost(*this), this->di->brickSize[1] - ghost(*this), this->di->brickSize[2] - ghost(*this)); assert(nvoxels[0] > 0 && nvoxels[1] > 0 && nvoxels[2] > 0); assert(this->di->brickSize[0] > 0); assert(this->di->brickSize[1] > 0); assert(this->di->brickSize[2] > 0); // give a hint as to how many bricks we'll have total. assert(nbricks(nvoxels, di->brickSize) > 0); this->NBricksHint(nbricks(nvoxels, di->brickSize)); std::array,2> extents = DatasetExtents(this->di->ds); MESSAGE("Extents are: [%g:%g x %g:%g x %g:%g]", extents[0][0],extents[1][0], extents[0][1],extents[1][0], extents[0][2],extents[1][2]); // don't create more LODs than the source data set (otherwise reading // the data is hard, we'd have to subsample on the fly) for(size_t lod=0; lod < di->ds->GetLODLevelCount(); ++lod) { const VoxelLayout voxels = {{ this->di->ds->GetDomainSize(lod, 0)[0], this->di->ds->GetDomainSize(lod, 0)[1], this->di->ds->GetDomainSize(lod, 0)[2] }}; const std::array blayout = GenericBrickLayout(voxels, this->di->BrickSansGhost()); for(size_t x=0; x < blayout[0]; ++x) { for(size_t y=0; y < blayout[1]; ++y) { for(size_t z=0; z < blayout[2]; ++z) { const size_t idx = z*blayout[1]*blayout[0] + y*blayout[0] + x; BrickIndex bidx = {{unsigned(x), unsigned(y), unsigned(z)}}; BrickSize cur_bs = ComputedTargetBrickSize(bidx, VoxelsInLOD(*this->di->ds.get(), lod), this->di->brickSize ); BrickMD bmd; bmd.n_voxels = UINTVECTOR3(cur_bs[0], cur_bs[1], cur_bs[2]); const ExtCenter ec = BrickMetadata(x,y,z, BrickSansGhost(cur_bs), BrickSansGhost(this->di->brickSize), voxels, extents ); bmd.extents = ec.exts; bmd.center = ec.center; const BrickKey key(0, lod, idx); #ifndef NDEBUG this->di->VerifyBrick(std::make_pair(key, bmd)); #endif this->AddBrick(key, bmd); } } } } if(this->di->mmMode == MM_PRECOMPUTE) { this->di->ComputeMinMaxes(*this); } } #if !defined(NDEBUG) && !defined(_MSC_VER) static bool test() { std::array sz = {{192,200,16}}; BrickSize th2 = {{32,32,32}}; assert(layout(sz, th2)[0] == 6); assert(layout(sz, th2)[1] == 7); assert(layout(sz, th2)[2] == 1); assert(layout(VoxelLayout({{th2[0],th2[1],th2[2]}}), th2)[0] == 1); assert(to3d(sz, 0)[0] == 0); assert(to3d(sz, 0)[1] == 0); assert(to3d(sz, 0)[2] == 0); assert(to3d(sz, 191)[0] == 191); assert(to3d(sz, 191)[1] == 0); assert(to3d(sz, 191)[2] == 0); assert(to3d(sz, 192)[0] == 0); assert(to3d(sz, 192)[1] == 1); assert(to3d(sz, 192)[2] == 0); { std::array voxels = {{8,8,1}}; BrickSize bsize = {{4,8,1}}; std::array low = {{ 0.0f, 0.0f, 0.0f }}; std::array high = {{ 10.0f, 5.0f, 19.0f }}; std::array,2> extents = {{ low, high }}; auto beg = begin(voxels, bsize, extents); assert(beg != end()); assert(std::get<0>((*beg).first) == 0); // timestep assert(std::get<1>((*beg).first) == 0); // LOD assert(std::get<2>((*beg).first) == 0); // index assert((*beg).second.n_voxels[0] == 4); assert((*beg).second.n_voxels[1] == 8); assert((*beg).second.n_voxels[2] == 1); ++beg; assert(beg != end()); assert(std::get<0>((*beg).first) == 0); // timestep assert(std::get<1>((*beg).first) == 0); // LOD assert(std::get<2>((*beg).first) == 1); // index assert((*beg).second.n_voxels[0] == 4); assert((*beg).second.n_voxels[1] == 8); assert((*beg).second.n_voxels[2] == 1); ++beg; assert(beg != end()); assert(std::get<0>((*beg).first) == 0); // timestep assert(std::get<1>((*beg).first) == 1); // LOD assert(std::get<2>((*beg).first) == 0); // index assert((*beg).second.n_voxels[0] == 4); assert((*beg).second.n_voxels[1] == 4); assert((*beg).second.n_voxels[2] == 1); ++beg; assert(beg == end()); } return true; } static bool dybr = test(); #endif } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2013 IVDA Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/uvfDataset.cpp0000644000175000017500000017130412320456500017514 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2009 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include "uvfDataset.h" #include "RAWConverter.h" #include "Basics/MathTools.h" #include "Basics/SysTools.h" #include "Controller/Controller.h" #include "TuvokIOError.h" #include "TuvokSizes.h" #include "UVF/UVF.h" #include "UVF/Histogram1DDataBlock.h" #include "UVF/KeyValuePairDataBlock.h" #include "UVF/Histogram2DDataBlock.h" #include "UVF/GeometryDataBlock.h" #include "uvfMesh.h" using namespace boost; using namespace std; namespace tuvok { UVFDataset::UVFDataset(const std::string& strFilename, uint64_t iMaxAcceptableBricksize, bool bVerify, bool bMustBeSameVersion) : m_bToCBlock(false), m_pKVDataBlock(NULL), m_bIsSameEndianness(true), m_pDatasetFile(NULL), m_strFilename(strFilename), m_CachedRange(make_pair(+1,-1)), m_iMaxAcceptableBricksize(iMaxAcceptableBricksize) { Open(bVerify, false, bMustBeSameVersion); } UVFDataset::UVFDataset() : m_bToCBlock(false), m_pKVDataBlock(NULL), m_bIsSameEndianness(true), m_pDatasetFile(NULL), m_strFilename(""), m_CachedRange(make_pair(+1,-1)), m_iMaxAcceptableBricksize(DEFAULT_BRICKSIZE) { } UVFDataset::~UVFDataset() { Close(); } void UVFDataset::Open(bool bVerify, bool bReadWrite, bool bMustBeSameVersion) { // open the file const std::string& fn = Filename(); std::wstring wstrFilename(fn.begin(), fn.end()); m_pDatasetFile = new UVF(wstrFilename); std::string strError; if(!m_pDatasetFile->Open(bMustBeSameVersion, bVerify, bReadWrite, &strError)) { throw Exception("Could not open file", _func_, __LINE__); } if(m_pDatasetFile->ms_ulReaderVersion != m_pDatasetFile->GetGlobalHeader().ulFileVersion) { // bMustBeSameVersion must not be set otherwise Open would have thrown an error assert(!bMustBeSameVersion && "Open should have failed!"); WARNING("Opening UVF file with a version (%u) " "different from this program's (%u)!", unsigned(m_pDatasetFile->GetGlobalHeader().ulFileVersion), unsigned(m_pDatasetFile->ms_ulReaderVersion)); if (m_pDatasetFile->ms_ulReaderVersion < 4) WARNING("Opening UVF file with a version" " older than 4 without TOCBlock support, " "some features may not be available."); } m_timesteps.clear(); size_t n_timesteps = DetermineNumberOfTimesteps(); if (n_timesteps == 0) { T_ERROR("No suitable volume block found in UVF file. Check previous " "messages for rejected blocks."); Close(); throw Exception("No volume data", _func_, __LINE__); } for (size_t i = 0;i(n_timesteps)); MESSAGE("Analyzing data..."); m_bIsSameEndianness = m_pDatasetFile->GetGlobalHeader().bIsBigEndian == EndianConvert::IsBigEndian(); SetRescaleFactors(DOUBLEVECTOR3(1.0,1.0,1.0)); // get the metadata and the histograms for(size_t i=0; i < n_timesteps; ++i) { ComputeMetaData(i); GetHistograms(i); } ComputeRange(); // print out data statistics MESSAGE(" %u timesteps found in the UVF.", static_cast(n_timesteps)); for(size_t tsi=0; tsi < n_timesteps; ++tsi) { ostringstream stats; if (m_bToCBlock) { const TOCTimestep* ts = (TOCTimestep*)m_timesteps[tsi]; stats << "Timestep " << tsi << ":\n" << " Dataset size: " << ts->GetDB()->GetLODDomainSize(0).x << " x " << ts->GetDB()->GetLODDomainSize(0).y << " x " << ts->GetDB()->GetLODDomainSize(0).z << "\n" << " Brick layout of highest resolution level: " << ts->GetDB()->GetBrickCount(0).x << " x " << ts->GetDB()->GetBrickCount(0).y << " x " << ts->GetDB()->GetBrickCount(0).z << "\n " << GetBitWidth() << " bit, " << GetComponentCount() << " components\n" << " LOD down to " << ts->GetDB()->GetBrickCount(ts->GetDB()->GetLoDCount()-1).x << " x " << ts->GetDB()->GetBrickCount(ts->GetDB()->GetLoDCount()-1).y << " x " << ts->GetDB()->GetBrickCount(ts->GetDB()->GetLoDCount()-1).z << " bricks found."; } else { const RDTimestep* ts = (RDTimestep*)m_timesteps[tsi]; stats << "Timestep " << tsi << ":\n" << " Dataset size: " << ts->m_aDomainSize[0].x << " x " << ts->m_aDomainSize[0].y << " x " << ts->m_aDomainSize[0].z << "\n" << " Brick layout of highest resolution level: " << ts->m_vaBrickCount[0].x << " x " << ts->m_vaBrickCount[0].y << " x " << ts->m_vaBrickCount[0].z << "\n " << (ts->GetDB()->bSignedElement[0][0] ? std::string("signed ") : std::string("unsigned ")) << GetBitWidth() << " bit, " << GetComponentCount() << " components\n" << " LOD down to " << ts->m_vaBrickCount[ts->m_vaBrickCount.size()-1].x << " x " << ts->m_vaBrickCount[ts->m_vaBrickCount.size()-1].y << " x " << ts->m_vaBrickCount[ts->m_vaBrickCount.size()-1].z << " bricks found."; } MESSAGE("%s", stats.str().c_str()); } if (m_TriSoupBlocks.size()) { MESSAGE("Extracting Meshes."); for(auto tsb = m_TriSoupBlocks.begin(); tsb != m_TriSoupBlocks.end(); tsb++) { shared_ptr m(new uvfMesh(**tsb)); m_vpMeshList.push_back(m); /* ostringstream stats; stats << "Mesh Statistics:\n" << " Vertex count:" << m->GetVertices().size() << "\n " << " Normal count:" << m->GetNormals().size() << "\n " << " TexCoords count:" << m->GetTexCoords().size() << "\n " << " Color count:" << m->GetColors().size() << "\n " << " Vertex Index count:" << m->GetVertexIndices().size() << "\n " << " Normal Index count:" << m->GetNormalIndices().size() << "\n " << " TexCoords Index count:" << m->GetTexCoordIndices().size() << "\n " << " Color Index count:" << m->GetColorIndices().size(); MESSAGE("%s", stats.str().c_str());*/ } } } void UVFDataset::Close() { delete m_pDatasetFile; for(std::vector::iterator ts = m_timesteps.begin(); ts != m_timesteps.end(); ++ts) { delete *ts; *ts = NULL; } m_timesteps.clear(); m_TriSoupBlocks.clear(); DeleteMeshes(); m_pKVDataBlock= NULL; m_pDatasetFile= NULL; } void UVFDataset::ComputeMetaData(size_t timestep) { if(m_bToCBlock) { this->ComputeMetadataTOC(timestep); } else { this->ComputeMetadataRDB(timestep); } } void UVFDataset::ComputeMetadataTOC(size_t timestep) { TOCTimestep* ts = static_cast(m_timesteps[timestep]); const TOCBlock* pVolumeDataBlock = ts->GetDB(); m_DomainScale = pVolumeDataBlock->GetScale(); size_t n_bricks = 0; for(size_t i=0; i < pVolumeDataBlock->GetLoDCount(); ++i) { n_bricks += pVolumeDataBlock->GetBrickCount(i).volume(); } this->NBricksHint(n_bricks); for (size_t j = 0;jGetLoDCount();j++) { UINT64VECTOR3 bc = pVolumeDataBlock->GetBrickCount(j); BrickMD bmd; FLOATVECTOR3 vBrickCorner(0,0,0); for (uint64_t x=0; x < bc.x; x++) { vBrickCorner.y = 0; for (uint64_t y=0; y < bc.y; y++) { vBrickCorner.z = 0; for (uint64_t z=0; z < bc.z; z++) { const UINT64VECTOR4 coords(x,y,z,j); const BrickKey k = BrickKey(timestep, j, static_cast(z*bc.x*bc.y+y*bc.x + x)); FLOATVECTOR3 vNormalizedDomainSize = FLOATVECTOR3(GetDomainSize(j, timestep)) * FLOATVECTOR3(pVolumeDataBlock->GetBrickAspect(coords)); float maxVal = vNormalizedDomainSize.maxVal(); vNormalizedDomainSize /= maxVal; bmd.extents = FLOATVECTOR3(GetEffectiveBrickSize(k)) * FLOATVECTOR3(pVolumeDataBlock->GetBrickAspect(coords)) / maxVal; bmd.center = FLOATVECTOR3(vBrickCorner + bmd.extents/2.0f) - vNormalizedDomainSize * 0.5f; bmd.n_voxels = UINTVECTOR3(pVolumeDataBlock->GetBrickSize(coords)); AddBrick(k, bmd); vBrickCorner.z += bmd.extents.z; } vBrickCorner.y += bmd.extents.y; } vBrickCorner.x += bmd.extents.x; } } m_aMaxBrickSize = pVolumeDataBlock->GetMaxBrickSize(); } void UVFDataset::ComputeMetadataRDB(size_t timestep) { std::vector vfScale; RDTimestep* ts = static_cast(m_timesteps[timestep]); const RasterDataBlock* pVolumeDataBlock = ts->GetDB(); size_t iSize = pVolumeDataBlock->ulDomainSize.size(); // we require the data to be at least 3D assert(iSize >= 3); // we also assume that x,y,z are in the first 3 components and // we have no anisotropy (i.e. ulLODLevelCount.size=1) size_t iLODLevel = static_cast(pVolumeDataBlock->ulLODLevelCount[0]); for (size_t i=0; i < 3 ; i++) { ts->m_aOverlap[i] = static_cast(pVolumeDataBlock->ulBrickOverlap[i]); /// @todo FIXME badness -- assume domain scaling information is the /// same across all raster data blocks (across all timesteps) m_DomainScale[i] = pVolumeDataBlock->dDomainTransformation[i+(iSize+1)*i]; } m_aMaxBrickSize.StoreMax(UINTVECTOR3( static_cast(pVolumeDataBlock->ulBrickSize[0]), static_cast(pVolumeDataBlock->ulBrickSize[1]), static_cast(pVolumeDataBlock->ulBrickSize[2]) )); ts->m_vvaBrickSize.resize(iLODLevel); if (ts->m_pMaxMinData) { ts->m_vvaMaxMin.resize(iLODLevel); } for (size_t j = 0;j vLOD; vLOD.push_back(j); std::vector vDomSize = pVolumeDataBlock->GetLODDomainSize(vLOD); ts->m_aDomainSize.push_back(UINT64VECTOR3(vDomSize[0], vDomSize[1], vDomSize[2])); std::vector vBrickCount = pVolumeDataBlock->GetBrickCount(vLOD); ts->m_vaBrickCount.push_back(UINT64VECTOR3(vBrickCount[0], vBrickCount[1], vBrickCount[2])); ts->m_vvaBrickSize[j].resize(size_t(ts->m_vaBrickCount[j].x)); if (ts->m_pMaxMinData) { ts->m_vvaMaxMin[j].resize(size_t(ts->m_vaBrickCount[j].x)); } FLOATVECTOR3 vBrickCorner; FLOATVECTOR3 vNormalizedDomainSize = FLOATVECTOR3(GetDomainSize(j, timestep)); vNormalizedDomainSize /= vNormalizedDomainSize.maxVal(); BrickMD bmd; for (uint64_t x=0; x < ts->m_vaBrickCount[j].x; x++) { ts->m_vvaBrickSize[j][size_t(x)].resize(size_t(ts->m_vaBrickCount[j].y)); if (ts->m_pMaxMinData) { ts->m_vvaMaxMin[j][size_t(x)].resize(size_t(ts->m_vaBrickCount[j].y)); } vBrickCorner.y = 0; for (uint64_t y=0; y < ts->m_vaBrickCount[j].y; y++) { if (ts->m_pMaxMinData) { ts->m_vvaMaxMin[j][size_t(x)][size_t(y)].resize(size_t(ts->m_vaBrickCount[j].z)); } vBrickCorner.z = 0; for (uint64_t z=0; z < ts->m_vaBrickCount[j].z; z++) { std::vector vBrick; vBrick.push_back(x); vBrick.push_back(y); vBrick.push_back(z); std::vector vBrickSize = pVolumeDataBlock->GetBrickSize(vLOD, vBrick); ts->m_vvaBrickSize[j][size_t(x)][size_t(y)].push_back( UINT64VECTOR3(vBrickSize[0], vBrickSize[1], vBrickSize[2])); const BrickKey k = BrickKey(timestep, j, static_cast(z*ts->m_vaBrickCount[j].x*ts->m_vaBrickCount[j].y+ y*ts->m_vaBrickCount[j].x + x)); bmd.extents = FLOATVECTOR3(GetEffectiveBrickSize(k)) / float(GetDomainSize(j, timestep).maxVal()); bmd.center = FLOATVECTOR3(vBrickCorner + bmd.extents/2.0f) - vNormalizedDomainSize * 0.5f; bmd.n_voxels = UINTVECTOR3(static_cast(vBrickSize[0]), static_cast(vBrickSize[1]), static_cast(vBrickSize[2])); AddBrick(k, bmd); vBrickCorner.z += bmd.extents.z; } vBrickCorner.y += bmd.extents.y; } vBrickCorner.x += bmd.extents.x; } } size_t iSerializedIndex = 0; if (ts->m_pMaxMinData) { for (size_t lod=0; lod < iLODLevel; lod++) { for (uint64_t z=0; z < ts->m_vaBrickCount[lod].z; z++) { for (uint64_t y=0; y < ts->m_vaBrickCount[lod].y; y++) { for (uint64_t x=0; x < ts->m_vaBrickCount[lod].x; x++) { // for four-component data we use the fourth component // (presumably the alpha channel); for all other data we use // the first component /// \todo we may have to change this if we add support for other /// kinds of multicomponent data. try { ts->m_vvaMaxMin[lod][size_t(x)][size_t(y)][size_t(z)] = ts->m_pMaxMinData->GetValue(iSerializedIndex++, (pVolumeDataBlock->ulElementDimensionSize[0] == 4) ? 3 : 0 ); } catch(const std::length_error&) { MinMaxBlock elem; const std::pair mm = std::make_pair( -std::numeric_limits::max(), std::numeric_limits::max() ); elem.minScalar = elem.minGradient = mm.first; elem.maxScalar = elem.maxGradient = mm.second; ts->m_vvaMaxMin[lod][size_t(x)][size_t(y)][size_t(z)] = elem; } } } } } } } // One dimensional brick shrinking for internal bricks that have some overlap // with neighboring bricks. Assumes overlap is constant per dataset: this // brick's overlap with the brick to its right is the same as the overlap with // the right brick's overlap with the brick to the left. /// @param v original brick size for this dimension /// @param brickIndex index of the brick in this dimension /// @param maxindex number-1 of bricks for this dimension /// @param overlap amount of per-brick overlap. void UVFDataset::FixOverlap(uint64_t& v, uint64_t brickIndex, uint64_t maxindex, uint64_t overlap) const { if(brickIndex > 0) { v -= static_cast(overlap/2.0f); } if(brickIndex < maxindex) { v -= static_cast(overlap/2.0f); } } size_t UVFDataset::DetermineNumberOfTimesteps() { size_t toc=0, raster=0, hist1d=0, hist2d=0, accel=0; bool is_color = false; for(size_t block=0; block < m_pDatasetFile->GetDataBlockCount(); ++block) { switch(m_pDatasetFile->GetDataBlock(block)->GetBlockSemantic()) { case UVFTables::BS_1D_HISTOGRAM: hist1d++; break; case UVFTables::BS_2D_HISTOGRAM: hist2d++; break; case UVFTables::BS_MAXMIN_VALUES: accel++; break; case UVFTables::BS_REG_NDIM_GRID: { const RasterDataBlock *rdb = static_cast (m_pDatasetFile->GetDataBlock(block).get()); if(VerifyRasterDataBlock(rdb)) { ++raster; if (rdb->ulElementDimensionSize[0] == 4 || rdb->ulElementDimensionSize[0] == 3) { is_color = true; } } } break; case UVFTables::BS_TOC_BLOCK: { const TOCBlock *tb = static_cast (m_pDatasetFile->GetDataBlock(block).get()); if(VerifyTOCBlock(tb)) { ++toc; if (tb->GetComponentCount() == 4 || tb->GetComponentCount() == 3) { is_color = true; } } } break; default: break; } } MESSAGE("Block counts (toc, raster, hist1, hist2, accel): (%u, %u, %u, %u, %u)", static_cast(toc), static_cast(raster), static_cast(hist1d), static_cast(hist2d), static_cast(accel)); if (toc > raster) m_bToCBlock = true; // color data is weird; none of our extra blocks are useful. if(is_color) { return std::max(raster,toc); } if(raster+toc == hist1d && hist1d == hist2d && hist2d == accel) { return std::max(raster,toc); } // if the number of blocks don't match, say we have 0 valid timesteps. T_ERROR("UVF Block combinations do not match; " "do not know how to interpret data. " "Block counts (toc, raster, hist1, hist2, accel): (%u, %u, %u, %u, %u)", static_cast(toc), static_cast(raster), static_cast(hist1d), static_cast(hist2d), static_cast(accel)); throw tuvok::io::DSParseFailed("No valid timesteps in UVF!"); } bool UVFDataset::VerifyRasterDataBlock(const RasterDataBlock* rdb) const { if((rdb->ulDomainSize.size() < 3) || (rdb->ulElementDimension != 1) || (rdb->ulLODGroups[0] != rdb->ulLODGroups[1]) || (rdb->ulLODGroups[1] != rdb->ulLODGroups[2])) { return false; } /// \todo: change this if we want to support vector data // check if we have anything other than scalars or color if (rdb->ulElementDimensionSize[0] == 1 || rdb->ulElementDimensionSize[0] == 3 || rdb->ulElementDimensionSize[0] == 4) { // check if the data's coarsest LOD level contains only one brick const vector& vSmallestLODBrickCount = rdb->GetBrickCount(rdb->GetSmallestBrickIndex()); uint64_t iSmallestLODBrickCount = vSmallestLODBrickCount[0]; for (size_t i = 1;i<3;i++) iSmallestLODBrickCount *= vSmallestLODBrickCount[i]; // currently we only care about the first 3 dimensions if (iSmallestLODBrickCount > 1) { return false; } } else { return false; } return true; } bool UVFDataset::VerifyTOCBlock(const TOCBlock* tb) const { /// \todo: change this if we want to support vector data // check if we have anything other than scalars or color if (tb->GetComponentCount() == 1 || tb->GetComponentCount() == 4) { assert(tb->GetLoDCount() > 0); // we should have some data.. // check if the data's coarsest LOD level contains only one brick // this should always be true by design of the TOC-Block but // we check it here in case we allow exceptionsto this in the future const uint64_t vSmallestLODBrickCount = tb->GetBrickCount(tb->GetLoDCount()-1).volume(); return vSmallestLODBrickCount == 1; } else { return false; } } // Gives the size of a brick in real space. UINT64VECTOR3 UVFDataset::GetEffectiveBrickSize(const BrickKey &k) const { if (m_bToCBlock) { const TOCTimestep* ts = static_cast(m_timesteps[std::get<0>(k)]); return UINT64VECTOR3(ts->GetDB()->GetBrickSize(KeyToTOCVector(k)) - 2*ts->GetDB()->GetOverlap()); } else { const NDBrickKey& key = IndexToVectorKey(k); size_t iLOD = static_cast(std::get<1>(k)); const RDTimestep* ts = static_cast(m_timesteps[key.timestep]); UINT64VECTOR3 vBrickSize = ts->m_vvaBrickSize[iLOD] [static_cast(key.brick[0])] [static_cast(key.brick[1])] [static_cast(key.brick[2])]; // If this is an internal brick, the size is a bit smaller based on the // amount of overlap per-brick. if (ts->m_vaBrickCount[iLOD].x > 1) { FixOverlap(vBrickSize.x, key.brick[0], ts->m_vaBrickCount[iLOD].x-1, ts->m_aOverlap.x); } if (ts->m_vaBrickCount[iLOD].y > 1) { FixOverlap(vBrickSize.y, key.brick[1], ts->m_vaBrickCount[iLOD].y-1, ts->m_aOverlap.y); } if (ts->m_vaBrickCount[iLOD].z > 1) { FixOverlap(vBrickSize.z, key.brick[2], ts->m_vaBrickCount[iLOD].z-1, ts->m_aOverlap.z); } return vBrickSize; } } BrickTable::size_type UVFDataset::GetBrickCount(size_t lod, size_t iTs) const { if (m_bToCBlock) { const TOCTimestep* ts = static_cast(m_timesteps[iTs]); return BrickTable::size_type(ts->GetDB()->GetBrickCount(lod).volume()); } else { const RDTimestep* ts = static_cast(m_timesteps[iTs]); return BrickTable::size_type(ts->m_vaBrickCount[lod].volume()); } } size_t UVFDataset::GetLargestSingleBrickLOD(size_t ts) const { for (size_t iLoD = 0;iLoD(m_timesteps[iTs]); return UINTVECTOR3(ts->GetDB()->GetBrickCount(lod)); } else { const RDTimestep* ts = static_cast(m_timesteps[iTs]); return UINTVECTOR3(ts->m_vaBrickCount[lod]); } } UINT64VECTOR3 UVFDataset::GetDomainSize(const size_t lod, const size_t iTs) const { if (m_bToCBlock) { const TOCTimestep* ts = static_cast(m_timesteps[iTs]); return ts->GetDB()->GetLODDomainSize(lod); } else { const RDTimestep* ts = static_cast(m_timesteps[iTs]); return ts->m_aDomainSize[lod]; } } uint64_t UVFDataset::GetNumberOfTimesteps() const { return m_timesteps.size(); } float UVFDataset::MaxGradientMagnitude() const { float mx = -std::numeric_limits::max(); for(std::vector::const_iterator ts = m_timesteps.begin(); ts != m_timesteps.end(); ++ts) { mx = std::max(mx, (*ts)->m_fMaxGradMagnitude); } return mx; } void UVFDataset::FindSuitableDataBlocks() { // keep a count of each type of block. We require that the number of blocks // match, or put another way, that all blocks exist for all timesteps. This // isn't strictly necessary; we could still, technically, work with a // timestep that was missing acceleration structures. size_t data=0, hist1d=0, hist2d=0, accel=0; for (size_t iBlocks = 0; iBlocks < m_pDatasetFile->GetDataBlockCount(); iBlocks++) { switch(m_pDatasetFile->GetDataBlock(iBlocks)->GetBlockSemantic()) { case UVFTables::BS_1D_HISTOGRAM: m_timesteps[hist1d++]->m_pHist1DDataBlock = static_cast (m_pDatasetFile->GetDataBlock(iBlocks).get()); break; case UVFTables::BS_2D_HISTOGRAM: m_timesteps[hist2d++]->m_pHist2DDataBlock = static_cast (m_pDatasetFile->GetDataBlock(iBlocks).get()); break; case UVFTables::BS_KEY_VALUE_PAIRS: if(m_pKVDataBlock != NULL) { WARNING("Multiple Key-Value pair blocks; using first!"); continue; } m_pKVDataBlock = static_cast (m_pDatasetFile->GetDataBlock(iBlocks).get()); break; case UVFTables::BS_MAXMIN_VALUES: m_timesteps[accel++]->m_pMaxMinData = static_cast (m_pDatasetFile->GetDataBlock(iBlocks).get()); break; case UVFTables::BS_TOC_BLOCK: if (m_bToCBlock) { const TOCBlock* pVolumeDataBlock = static_cast (m_pDatasetFile->GetDataBlock(iBlocks).get()); if(!VerifyTOCBlock(pVolumeDataBlock)) { WARNING("A TOCBlock failed verification; skipping it"); continue; } UINTVECTOR3 bsize = pVolumeDataBlock->GetMaxBrickSize(); for(size_t i=0; i < 3; ++i) { if(bsize[i] > m_iMaxAcceptableBricksize) { std::stringstream large; large << "Brick size used in UVF file is too large (" << bsize[i] << " > " << m_iMaxAcceptableBricksize << "); rebricking necessary."; throw tuvok::io::DSBricksOversized( large.str().c_str(), static_cast(m_iMaxAcceptableBricksize), _func_, __LINE__ ); } } m_timesteps[data]->block_number = iBlocks; m_timesteps[data++]->m_pVolumeDataBlock = pVolumeDataBlock; } break; case UVFTables::BS_REG_NDIM_GRID: if (!m_bToCBlock) { const RasterDataBlock* pVolumeDataBlock = static_cast (m_pDatasetFile->GetDataBlock(iBlocks).get()); if(!VerifyRasterDataBlock(pVolumeDataBlock)) { WARNING("A RasterDataBlock failed verification; skipping it"); continue; } // check if the data's biggest brick dimensions are // smaller than m_iMaxAcceptableBricksize std::vector vMaxBrickSizes = pVolumeDataBlock->GetLargestBrickSizes(); // currently we only care about the first 3 dimensions for (size_t i=0; i < 3; i++) { if (vMaxBrickSizes[i] > m_iMaxAcceptableBricksize) { std::stringstream large; large << "Brick size used in UVF file is too large (" << vMaxBrickSizes[i] << " > " << m_iMaxAcceptableBricksize << "); rebricking necessary."; WARNING("%s", large.str().c_str()); throw tuvok::io::DSBricksOversized( large.str().c_str(), static_cast(m_iMaxAcceptableBricksize), _func_, __LINE__ ); } } m_timesteps[data]->block_number = iBlocks; m_timesteps[data++]->m_pVolumeDataBlock = pVolumeDataBlock; } break; case UVFTables::BS_GEOMETRY: { MESSAGE("Found triangle mesh."); m_TriSoupBlocks.push_back( static_cast (m_pDatasetFile->GetDataBlock(iBlocks).get()) ); } default: MESSAGE("Non-volume block found in UVF file, skipping."); break; } } } /// @todo fixme (hack): we only look at the first timestep for the /// histograms. should really set a vector of histograms, one per timestep. void UVFDataset::GetHistograms(size_t) { m_pHist1D.reset(); Timestep* ts = m_timesteps[0]; if (ts->m_pHist1DDataBlock != NULL) { const std::vector& vHist1D = ts->m_pHist1DDataBlock->GetHistogram(); m_pHist1D.reset(new Histogram1D(std::min(vHist1D.size(), std::min(MAX_TRANSFERFUNCTION_SIZE, 1<GetSize() != vHist1D.size()) { MESSAGE("1D Histogram too big to be drawn efficiently, resampling."); // "resample" the histogram float sampleFactor = static_cast(vHist1D.size()) / static_cast(m_pHist1D->GetSize()); float accWeight = 0.0f; float currWeight = 1.0f; float accValue = 0.0f; size_t j = 0; bool bLast = false; for (size_t i = 0;i < vHist1D.size(); i++) { if (bLast) { m_pHist1D->Set(j, uint32_t( accValue )); currWeight = 1.0f - currWeight; j++; i--; bLast = false; accValue = 0; accWeight = 0; } else { if (sampleFactor-accWeight > 1) { currWeight = 1.0f; } else { currWeight = sampleFactor-accWeight; bLast = true; } } accValue += static_cast(vHist1D[i]) * currWeight; accWeight += currWeight; // make sure we are not writing beyond m_pHist1D's end // due to accumulated float errors in the sampling computation above if (j == m_pHist1D->GetSize() - 1) break; } } else { for (size_t i = 0;i < m_pHist1D->GetSize(); i++) { m_pHist1D->Set(i, uint32_t(vHist1D[i])); } } } else { // generate a zero 1D histogram (max 4k) if none is found in the file m_pHist1D.reset(new Histogram1D( std::min(MAX_TRANSFERFUNCTION_SIZE, 1<GetSize();i++) { m_pHist1D->Set(i, 1); } } m_pHist2D.reset(); if (ts->m_pHist2DDataBlock != NULL) { const std::vector>& vHist2D = ts->m_pHist2DDataBlock->GetHistogram(); VECTOR2 vSize(vHist2D.size(),vHist2D[0].size()); vSize.x = min(MAX_TRANSFERFUNCTION_SIZE, vSize.x); vSize.y = min(256, vSize.y); m_pHist2D.reset(new Histogram2D(vSize)); if (vSize.x != vHist2D.size() || vSize.y != vHist2D[0].size() ) { MESSAGE("2D Histogram too big to be drawn efficiently, resampling."); // TODO: implement the same linear resampling as above // for now we just clear the histogram with ones for (size_t y = 0;yGetSize().y;y++) for (size_t x = 0;xGetSize().x;x++) m_pHist2D->Set(x,y,1); } else { for (size_t y = 0;yGetSize().y;y++) for (size_t x = 0;xGetSize().x;x++) m_pHist2D->Set(x,y,uint32_t(vHist2D[x][y])); } ts->m_fMaxGradMagnitude = ts->m_pHist2DDataBlock->GetMaxGradMagnitude(); } else { // generate a zero 2D histogram (max 4k) if none is found in the file VECTOR2 vec(256, std::min(MAX_TRANSFERFUNCTION_SIZE, 1<GetSize().y; y++) { // set all values to one so "getFilledsize" later does not return a // completely empty dataset for (size_t x=0; x < m_pHist2D->GetSize().x; x++) { m_pHist2D->Set(x,y,1); } } ts->m_fMaxGradMagnitude = 0; } } UINTVECTOR3 UVFDataset::GetBrickVoxelCounts(const BrickKey& k) const { if (m_bToCBlock) { const UINT64VECTOR4 coords = KeyToTOCVector(k); const TOCTimestep* ts = static_cast(m_timesteps[std::get<0>(k)]); return UINTVECTOR3(ts->GetDB()->GetBrickSize(coords)); } else { size_t iLOD = static_cast(std::get<1>(k)); const NDBrickKey& key = IndexToVectorKey(k); const RDTimestep* ts = static_cast(m_timesteps[key.timestep]); return UINTVECTOR3(ts->m_vvaBrickSize[iLOD] [static_cast(key.brick[0])] [static_cast(key.brick[1])] [static_cast(key.brick[2])]); } } bool UVFDataset::Export(uint64_t iLODLevel, const std::string& targetFilename, bool bAppend) const { if (m_bToCBlock) { bool okay = true; for(std::vector::const_iterator ts = m_timesteps.begin(); ts != m_timesteps.end(); ++ts) { const TOCTimestep* toc_ts = static_cast(*ts); // Unbrick each timestep. Append the data if the user asks, but we must // always append on second and subsequent timesteps! okay &= toc_ts->GetDB()->BrickedLODToFlatData( iLODLevel, targetFilename, bAppend || ts != m_timesteps.begin(), &Controller::Debug::Out() ); } return okay; } else { std::vector vLOD; vLOD.push_back(iLODLevel); bool okay = true; for(std::vector::const_iterator ts = m_timesteps.begin(); ts != m_timesteps.end(); ++ts) { const RDTimestep* rd_ts = static_cast(*ts); // Unbrick each timestep. Append the data if the user asks, but we must // always append on second and subsequent timesteps! okay &= rd_ts->GetDB()->BrickedLODToFlatData( vLOD, targetFilename, bAppend || ts != m_timesteps.begin(), &Controller::Debug::Out() ); } return okay; } } bool UVFDataset::ApplyFunction(uint64_t iLODLevel, bool (*brickFunc)(void* pData, const UINT64VECTOR3& vBrickSize, const UINT64VECTOR3& vBrickOffset, void* pUserContext), void *pUserContext, uint64_t iOverlap) const { if (m_bToCBlock) { bool okay = true; for(std::vector::const_iterator ts = m_timesteps.begin(); ts != m_timesteps.end(); ++ts) { const TOCTimestep* toc_ts = static_cast(*ts); okay &= toc_ts->GetDB()->ApplyFunction( iLODLevel, brickFunc, pUserContext, uint32_t(iOverlap), &Controller::Debug::Out() ); } return okay; } else { std::vector vLOD; vLOD.push_back(iLODLevel); bool okay = true; for(std::vector::const_iterator ts = m_timesteps.begin(); ts != m_timesteps.end(); ++ts) { const RDTimestep* rd_ts = static_cast(*ts); okay &= rd_ts->GetDB()->ApplyFunction( vLOD, brickFunc, pUserContext, iOverlap, &Controller::Debug::Out() ); } return okay; } } // BrickKey's index is 1D. For UVF's RDB, we've got a 3D index. When // we create the brick index to satisfy the interface, we do so in a // reversible way. This methods reverses the 1D into into UVF's 3D // index. std::vector UVFDataset::IndexToVector(const BrickKey &k) const { std::vector vBrick; if (!m_bToCBlock) { const RDTimestep* ts = static_cast(m_timesteps[std::get<0>(k)]); const size_t lod = std::get<1>(k); uint64_t iIndex = uint64_t(std::get<2>(k)); uint64_t iZIndex = uint64_t(iIndex / (ts->m_vaBrickCount[lod].x * ts->m_vaBrickCount[lod].y)); iIndex = iIndex % (ts->m_vaBrickCount[lod].x * ts->m_vaBrickCount[lod].y); uint64_t iYIndex = uint64_t(iIndex / ts->m_vaBrickCount[lod].x); iIndex = iIndex % ts->m_vaBrickCount[lod].x; uint64_t iXIndex = iIndex; vBrick.push_back(iXIndex); vBrick.push_back(iYIndex); vBrick.push_back(iZIndex); } return vBrick; } UINT64VECTOR4 UVFDataset::KeyToTOCVector(const BrickKey &k) const { if (m_bToCBlock) { const TOCTimestep* ts = static_cast(m_timesteps[std::get<0>(k)]); const uint64_t iLOD = std::get<1>(k); const uint64_t iLinearIndex = std::get<2>(k); const UINT64VECTOR3 iBricks = ts->GetDB()->GetBrickCount(iLOD); const uint64_t x = iLinearIndex % iBricks.x; const uint64_t y = (iLinearIndex % (iBricks.x*iBricks.y)) / iBricks.x; const uint64_t z = iLinearIndex / (iBricks.x*iBricks.y); return UINT64VECTOR4(x,y,z,iLOD); } else { return UINT64VECTOR4(); } } BrickKey UVFDataset::TOCVectorToKey(const UINTVECTOR4& hash, size_t timestep) const { UINTVECTOR3 layout = GetBrickLayout(hash.w, timestep); return BrickKey(timestep, hash.w, hash.x+ hash.y*layout.x+ hash.z*layout.x*layout.y); } NDBrickKey UVFDataset::IndexToVectorKey(const BrickKey &k) const { NDBrickKey ndk; ndk.timestep = std::get<0>(k); ndk.lod.push_back(std::get<1>(k)); ndk.brick = IndexToVector(k); return ndk; } // determines the largest actually used brick dimensions // in the current dataset UINTVECTOR3 UVFDataset::GetMaxUsedBrickSizes() const { UINTVECTOR3 vMaxSize(1,1,1); UINTVECTOR3 vAbsoluteMax(m_aMaxBrickSize); // we can do things differently/more intelligently for TOCBlocks. if (m_bToCBlock) { for(size_t tsi=0; tsi < m_timesteps.size(); ++tsi) { const TOCTimestep* ts = (const TOCTimestep*)m_timesteps[tsi]; // the first brick in the highest LoD is the biggest brick // (usually of size vAbsoluteMax) vMaxSize.StoreMax( UINTVECTOR3(ts->GetDB()->GetBrickSize(UINT64VECTOR4(0,0,0,0))) ); if (vMaxSize == vAbsoluteMax) return vAbsoluteMax; } return vMaxSize; } // our parent has no real info, just calculates this on the fly. return BrickedDataset::GetMaxUsedBrickSizes(); } UINTVECTOR3 UVFDataset::GetMaxBrickSize() const { return m_aMaxBrickSize; } UINTVECTOR3 UVFDataset::GetBrickOverlapSize() const { /// @todo HACK fixme: should take into account the LOD and timestep, probably /// need them as arguments. assert(!m_timesteps.empty() && "no data, haven't analyzed UVF?"); if (m_bToCBlock) { uint32_t overlap = ((TOCTimestep*)(m_timesteps[0]))->GetDB()->GetOverlap(); return UINTVECTOR3(overlap,overlap,overlap); } else return ((RDTimestep*)(m_timesteps[0]))->m_aOverlap; } unsigned UVFDataset::GetLODLevelCount() const { /// @todo HACK fixme: should take into account the timestep, needed as arg assert(!m_timesteps.empty() && "no data, haven't analyzed UVF?"); if (m_bToCBlock) { return (static_cast (m_timesteps[0]))->GetDB()->GetLoDCount(); } else { return (static_cast (m_timesteps[0]))->m_vvaBrickSize.size(); } } /// \todo change this if we want to support data where elements are of // different size unsigned UVFDataset::GetBitWidth() const { assert(!m_timesteps.empty() && "no data, haven't analyzed UVF?"); // All data in the time series should have the same bit width, so any // timestep we choose to query the bit width from should be fine. if (m_bToCBlock) return ((TOCTimestep*)(m_timesteps[0]))->GetDB()->GetComponentTypeSize()*8; else return ((RDTimestep*)(m_timesteps[0]))->GetDB()->ulElementBitSize[0][0]; } uint64_t UVFDataset::GetComponentCount() const { assert(!m_timesteps.empty() && "no data, haven't analyzed UVF?"); // All data in the time series should have the same bit number of // components, so any timestep we choose to query the component count // from should be fine. if (m_bToCBlock) return ((TOCTimestep*)(m_timesteps[0]))->GetDB()->GetComponentCount(); else return ((RDTimestep*)(m_timesteps[0]))->GetDB()->ulElementDimensionSize[0]; } /// \todo change this if we want to support data where elements are of /// different type bool UVFDataset::GetIsSigned() const { assert(!m_timesteps.empty() && "no data, haven't analyzed UVF?"); // All data in the time series should have the same signedness, // so any timestep we choose to query the signedness from should be fine. if (m_bToCBlock) return ((TOCTimestep*)(m_timesteps[0]))->GetDB()->GetIsSigned(); else return ((RDTimestep*)(m_timesteps[0]))->GetDB()->bSignedElement[0][0]; } /// \todo change this if we want to support data where elements are of /// different type bool UVFDataset::GetIsFloat() const { assert(!m_timesteps.empty() && "no data, haven't analyzed UVF?"); // All data in the time series should have the same type, so any timestep // we choose to query the type from should be fine. if (m_bToCBlock) return ((TOCTimestep*)(m_timesteps[0]))->GetDB()->GetIsFloat(); else return GetBitWidth() != ((RDTimestep*)(m_timesteps[0]))->GetDB()->ulElementMantissa[0][0]; } bool UVFDataset::IsSameEndianness() const { return m_bIsSameEndianness; } std::pair UVFDataset::GetRange() const { return m_CachedRange; } void UVFDataset::ComputeRange() { // If we're missing MaxMin data for any timestep, we don't have maxmin data. bool have_maxmin_data = true; for(size_t tsi=0; tsi < m_timesteps.size(); ++tsi) { if(m_timesteps[tsi]->m_pMaxMinData == NULL) { WARNING("Missing acceleration structure for timestep %u", static_cast(tsi)); have_maxmin_data = false; } } // second < first is a convention we use to indicate "haven't figured this // out yet". We might not have MaxMin data though; in some cases, we'll // never figure it out. if (have_maxmin_data && m_CachedRange.second < m_CachedRange.first) { // to find the range of values we simply traverse all the bricks in // LOD level 0 (highest res) and compute the max & min std::pair limits; if (m_bToCBlock) { for(size_t tsi=0; tsi < m_timesteps.size(); ++tsi) { for (size_t i=0; i < GetBrickCount(0, tsi); i++) { const TOCTimestep* ts = static_cast(m_timesteps[tsi]); const MinMaxBlock& maxMinElement = ts->m_pMaxMinData->GetValue(i, ts->GetDB()->GetComponentCount() == 4 ? 3 : 0); if (i>0) { limits.first = min(limits.first, maxMinElement.minScalar); limits.second = max(limits.second, maxMinElement.maxScalar); } else { limits = make_pair(maxMinElement.minScalar, maxMinElement.maxScalar); } } } m_CachedRange = limits; } else { for(size_t tsi=0; tsi < m_timesteps.size(); ++tsi) { const RDTimestep* ts = static_cast(m_timesteps[tsi]); for (size_t i=0; i < GetBrickCount(0, tsi); i++) { BrickKey k(tsi,0,i); const NDBrickKey& key = IndexToVectorKey(k); const MinMaxBlock& maxMinElement = ts->m_vvaMaxMin[0] [static_cast(key.brick[0])] [static_cast(key.brick[1])] [static_cast(key.brick[2])]; if (i>0) { limits.first = min(limits.first, maxMinElement.minScalar); limits.second = max(limits.second, maxMinElement.maxScalar); } else { limits = make_pair(maxMinElement.minScalar, maxMinElement.maxScalar); } } m_CachedRange = limits; } } } } MinMaxBlock UVFDataset::MaxMinForKey(const BrickKey& k) const { MinMaxBlock maxMinElement; if (m_bToCBlock) { const TOCTimestep* ts = dynamic_cast(m_timesteps[std::get<0>(k)]); size_t iLinIndex = size_t(ts->GetDB()->GetLinearBrickIndex(KeyToTOCVector(k))); return ts->m_pMaxMinData->GetValue(iLinIndex, ts->GetDB()->GetComponentCount() == 4 ? 3 : 0 ); } else { const NDBrickKey& key = IndexToVectorKey(k); size_t iLOD = std::get<1>(k); const RDTimestep* ts = dynamic_cast(m_timesteps[key.timestep]); return ts->m_vvaMaxMin[iLOD] [static_cast(key.brick[0])] [static_cast(key.brick[1])] [static_cast(key.brick[2])]; } } bool UVFDataset::ContainsData(const BrickKey &k, double isoval) const { // if we have no max min data we have to assume that every block is visible if(NULL == m_timesteps[std::get<0>(k)]->m_pMaxMinData) {return true;} const MinMaxBlock maxMinElement = MaxMinForKey(k); return (isoval <= maxMinElement.maxScalar); } bool UVFDataset::ContainsData(const BrickKey &k, double fMin,double fMax) const { // if we have no max min data we have to assume that every block is visible if(NULL == m_timesteps[std::get<0>(k)]->m_pMaxMinData) {return true;} const MinMaxBlock maxMinElement = MaxMinForKey(k); return (fMax >= maxMinElement.minScalar && fMin <= maxMinElement.maxScalar); } bool UVFDataset::ContainsData(const BrickKey &k, double fMin,double fMax, double fMinGradient,double fMaxGradient) const { // if we have no max min data we have to assume that every block is visible if(NULL == m_timesteps[std::get<0>(k)]->m_pMaxMinData) {return true;} const MinMaxBlock maxMinElement = MaxMinForKey(k); return (fMax >= maxMinElement.minScalar && fMin <= maxMinElement.maxScalar) && (fMaxGradient >= maxMinElement.minGradient && fMinGradient <= maxMinElement.maxGradient); } const std::vector> UVFDataset::GetMetadata() const { std::vector> v; if (m_pKVDataBlock) { for (size_t i = 0;iGetKeyCount();i++) { v.push_back(std::make_pair(m_pKVDataBlock->GetKeyByIndex(i), m_pKVDataBlock->GetValueByIndex(i))); } } return v; } bool UVFDataset::GeometryTransformToFile(size_t iMeshIndex, const FLOATMATRIX4& m) { Close(); MESSAGE("Attempting to reopen file in readwrite mode."); try { Open(false,true,false); MESSAGE("Successfully reopened file in readwrite mode."); // turn meshindex into block index, those are different as the // uvf file most likely also contains data other than meshes // such as the volume or histograms, etc. size_t iBlockIndex = 0; bool bFound = false; for(size_t block=0; block < m_pDatasetFile->GetDataBlockCount(); ++block) { if (m_pDatasetFile->GetDataBlock(block)->GetBlockSemantic() == UVFTables::BS_GEOMETRY) { if (iMeshIndex == 0) { iBlockIndex = block; bFound = true; break; } iMeshIndex--; } } if (!bFound) { T_ERROR("Unable to locate mesh data block %u", static_cast(iBlockIndex)); return false; } GeometryDataBlock* block = dynamic_cast( m_pDatasetFile->GetDataBlockRW(iBlockIndex,false) ); if (!block) { T_ERROR("Inconsistent UVF block at index %u", static_cast(iBlockIndex)); return false; } MESSAGE("Transforming Vertices ..."); std::vector vertices = block->GetVertices(); if (vertices.size() % 3) { T_ERROR("Inconsistent data vertex in UVF block at index %u", static_cast(iBlockIndex)); return false; } for (size_t i = 0;iSetVertices(vertices); MESSAGE("Transforming Normals ..."); FLOATMATRIX4 invTranspose(m); invTranspose = invTranspose.inverse(); invTranspose = invTranspose.Transpose(); std::vector< float > normals = block->GetNormals(); if (normals.size() % 3) { T_ERROR("Inconsistent normal data in UVF block at index %u", static_cast(iBlockIndex)); return false; } for (size_t i = 0;iSetNormals(normals); MESSAGE("Writing changes to disk"); Close(); MESSAGE("Reopening in read-only mode"); Open(false,false,false); return true; } catch(const tuvok::Exception&) { T_ERROR("Readwrite mode failed, maybe file is write protected?"); Open(false,false,false); return false; } } bool UVFDataset::RemoveMesh(size_t iMeshIndex) { Close(); MESSAGE("Attempting to reopen file in read/write mode."); try { Open(false, true, false); } catch(const Exception&) { T_ERROR("Read/write mode failed, maybe file is write protected?"); Open(false,false,false); return false; } MESSAGE("Successfully reopened file in readwrite mode."); // turn meshindex into block index, those are different as the // uvf file most likely also contains data other than meshes // such as the volume or histograms, etc. size_t iBlockIndex = 0; bool bFound = false; for(size_t block=0; block < m_pDatasetFile->GetDataBlockCount(); ++block) { if (m_pDatasetFile->GetDataBlock(block)->GetBlockSemantic() == UVFTables::BS_GEOMETRY) { if (iMeshIndex == 0) { iBlockIndex = block; bFound = true; break; } iMeshIndex--; } } if (!bFound) { T_ERROR("Unable to locate mesh data block %u", static_cast(iMeshIndex)); return false; } bool bResult = m_pDatasetFile->DropBlockFromFile(iBlockIndex); MESSAGE("Writing changes to disk"); Close(); MESSAGE("Reopening in read-only mode"); Open(false,false,false); return bResult; } bool UVFDataset::AppendMesh(std::shared_ptr meshIn) { const Mesh& m = *meshIn; Close(); MESSAGE("Attempting to reopen file in readwrite mode."); try { Open(false,true,false); } catch(const Exception&) { T_ERROR("Read/write mode failed, maybe file is write protected?"); Open(false,false,false); return false; } MESSAGE("Successfully reopened file in readwrite mode."); // now create a GeometryDataBlock ... std::shared_ptr tsb(new GeometryDataBlock()); // ... and transfer the data from the mesh object // source data const VertVec& v = m.GetVertices(); const NormVec& n = m.GetNormals(); const TexCoordVec& t = m.GetTexCoords(); const ColorVec& c = m.GetColors(); // target data vector fVec; size_t iVerticesPerPoly = m.GetVerticesPerPoly(); tsb->SetPolySize(iVerticesPerPoly); if (v.size()) { fVec.resize(v.size()*3); memcpy(&fVec[0],&v[0],v.size()*3*sizeof(float)); tsb->SetVertices(fVec); } else { // even if the vectors are empty still let the datablock know tsb->SetVertices(vector()); } if (n.size()) { fVec.resize(n.size()*3); memcpy(&fVec[0],&n[0],n.size()*3*sizeof(float)); tsb->SetNormals(fVec); } else { // even if the vectors are empty still let the datablock know tsb->SetNormals(vector()); } if (t.size()) { fVec.resize(t.size()*2); memcpy(&fVec[0],&t[0],t.size()*2*sizeof(float)); tsb->SetTexCoords(fVec); } else { // even if the vectors are empty still let the datablock know tsb->SetTexCoords(vector()); } if (c.size()) { fVec.resize(c.size()*4); memcpy(&fVec[0],&c[0],c.size()*4*sizeof(float)); tsb->SetColors(fVec); } else { // even if the vectors are empty still let the datablock know tsb->SetColors(vector()); } tsb->SetVertexIndices(m.GetVertexIndices()); tsb->SetNormalIndices(m.GetNormalIndices()); tsb->SetTexCoordIndices(m.GetTexCoordIndices()); tsb->SetColorIndices(m.GetColorIndices()); tsb->m_Desc = m.Name(); m_pDatasetFile->AppendBlockToFile(tsb); MESSAGE("Writing changes to disk"); Close(); MESSAGE("Reopening in read-only mode"); Open(false,false,false); return true; } bool UVFDataset::Crop(const PLANE& plane, const std::string& strTempDir, bool bKeepOldData, bool bUseMedianFilter, bool bClampToEdge) { MESSAGE("Flattening dataset"); string strTempRawFilename = SysTools::FindNextSequenceName( strTempDir + "crop-tmp.raw" ); Export(0, strTempRawFilename , false); MESSAGE("Cropping at plane (%g %g %g %g)", plane.x, plane.y, plane.z, plane.w); FLOATMATRIX4 m; m.Scaling(FLOATVECTOR3(GetScale()/GetScale().maxVal()) * FLOATVECTOR3(GetDomainSize()) /float(GetDomainSize().maxVal())); PLANE scaleInvariantPlane = plane; scaleInvariantPlane.transformIT(m); TempFile dataFile(strTempRawFilename); if (!dataFile.Open(true)) { T_ERROR("Unable to open flattened data."); return false; } // crop data bool bCroppingOK = false; switch (GetBitWidth()) { case 8: if(GetIsSigned()) { bCroppingOK = CropData(dataFile, scaleInvariantPlane, GetDomainSize(), GetComponentCount()); } else { bCroppingOK = CropData(dataFile, scaleInvariantPlane, GetDomainSize(), GetComponentCount()); } break; case 16 : if(GetIsSigned()) { bCroppingOK = CropData(dataFile, scaleInvariantPlane, GetDomainSize(), GetComponentCount()); } else { bCroppingOK = CropData(dataFile, scaleInvariantPlane, GetDomainSize(), GetComponentCount()); } break; case 32 : if (GetIsFloat()) { bCroppingOK = CropData(dataFile, scaleInvariantPlane, GetDomainSize(), GetComponentCount()); } else { if(GetIsSigned()) { bCroppingOK = CropData(dataFile, scaleInvariantPlane, GetDomainSize(), GetComponentCount()); } else { bCroppingOK = CropData(dataFile, scaleInvariantPlane, GetDomainSize(), GetComponentCount()); } } break; case 64 : if (GetIsFloat()) { bCroppingOK = CropData(dataFile, scaleInvariantPlane, GetDomainSize(), GetComponentCount()); } else { if(GetIsSigned()) { bCroppingOK = CropData(dataFile, scaleInvariantPlane, GetDomainSize(), GetComponentCount()); } else { bCroppingOK = CropData(dataFile, scaleInvariantPlane, GetDomainSize(), GetComponentCount()); } } break; } if (!bCroppingOK) { return false; } // TODO shrink volume to the largest non-zero aabb dataFile.Close(); MESSAGE("Rebuilding UVF data"); string strTempFilename = SysTools::FindNextSequenceName(Filename()); std::string strDesc = std::string("Cropped ") + std::string(Name()); std::string strSource = SysTools::GetFilename(Filename()); if(!RAWConverter::ConvertRAWDataset( strTempRawFilename, strTempFilename, strTempDir, 0, GetBitWidth(), size_t(GetComponentCount()), 1, !IsSameEndianness(), GetIsSigned(), GetIsFloat(), GetDomainSize(), FLOATVECTOR3(GetScale()), strDesc, strSource, Controller::Instance().IOMan()->GetMaxBrickSize(), Controller::Instance().IOMan()->GetBrickOverlap(), bUseMedianFilter, bClampToEdge, 1 /* compress with zlib*/, 4 /* use default compression level for LZMA*/, 0 /* default scanline layout*/)) { T_ERROR("Unable to convert cropped data back to UVF"); return false; } MESSAGE("Replacing original UVF by the new one"); Close(); if (bKeepOldData) { std::string newFilename = SysTools::AppendFilename(Filename(),"-beforeCropping"); if (SysTools::FileExists(newFilename)) { newFilename = SysTools::FindNextSequenceName(newFilename); } rename(Filename().c_str(), newFilename.c_str()); } else { remove(Filename().c_str()); } if (SysTools::FileExists(Filename())) { T_ERROR("Unable to delete original UVF file, a new file (%s) has been " "created alongside the old.", strTempFilename.c_str()); Open(false,false,false); return false; } rename(strTempFilename.c_str(), Filename().c_str()); MESSAGE("Opening new file"); Open(false,false,false); return true; } bool UVFDataset::SaveRescaleFactors() { DOUBLEVECTOR3 saveUserScale = m_UserScale; Close(); MESSAGE("Attempting to reopen file in readwrite mode."); try { Open(false,true,false); } catch(const Exception&) { T_ERROR("Read/write mode failed, maybe file is write protected?"); Open(false,false,false); return false; } MESSAGE("Successfully reopened file in readwrite mode."); if (m_bToCBlock) { for(size_t tsi=0; tsi < m_timesteps.size(); ++tsi) { TOCBlock* tocb = static_cast( m_pDatasetFile->GetDataBlockRW(m_timesteps[tsi]->block_number, true) ); tocb->SetScale(saveUserScale); } } else { for(size_t tsi=0; tsi < m_timesteps.size(); ++tsi) { RasterDataBlock* rdb = static_cast( m_pDatasetFile->GetDataBlockRW(m_timesteps[tsi]->block_number, true) ); size_t iSize = rdb->ulDomainSize.size(); for (size_t i=0; i < 3; i++) { m_DomainScale[i] = saveUserScale[i]; // matrix multiplication with scale factors rdb->dDomainTransformation[0+(iSize+1)*i] *= saveUserScale[0]; rdb->dDomainTransformation[1+(iSize+1)*i] *= saveUserScale[1]; rdb->dDomainTransformation[2+(iSize+1)*i] *= saveUserScale[2]; } } } MESSAGE("Writing changes to disk"); Close(); MESSAGE("Reopening in read-only mode"); Open(false,false,false); return true; } bool UVFDataset::CanRead(const std::string&, const std::vector& bytes) const { return bytes[0] == 0x55 && // 'U' bytes[1] == 0x56 && // 'V' bytes[2] == 0x46 && // 'F' bytes[3] == 0x2D && // '-' bytes[4] == 0x44 && // 'D' bytes[5] == 0x41 && // 'A' bytes[6] == 0x54 && // 'T' bytes[7] == 0x41; // 'A' } bool UVFDataset::Verify(const std::string& filename) const { std::wstring wstrFilename(filename.begin(), filename.end()); bool checksumFail=false; UVF::IsUVFFile(wstrFilename, checksumFail); // negate it; IsUVFFile sets the argument if the checksum *fails*! return !checksumFail; } Dataset* UVFDataset::Create(const std::string& filename, uint64_t max_brick_size, bool verify) const { return new UVFDataset(filename, max_brick_size, verify, false); } std::list UVFDataset::Extensions() const { std::list retval; retval.push_back("UVF"); return retval; } bool UVFDataset::GetBrick(const BrickKey& k, std::vector& vData) const { return GetBrickTemplate(k,vData); } bool UVFDataset::GetBrick(const BrickKey& k, std::vector& vData) const { return GetBrickTemplate(k,vData); } bool UVFDataset::GetBrick(const BrickKey& k, std::vector& vData) const { return GetBrickTemplate(k,vData); } bool UVFDataset::GetBrick(const BrickKey& k, std::vector& vData) const { return GetBrickTemplate(k,vData); } bool UVFDataset::GetBrick(const BrickKey& k, std::vector& vData) const { return GetBrickTemplate(k,vData); } bool UVFDataset::GetBrick(const BrickKey& k, std::vector& vData) const { return GetBrickTemplate(k,vData); } bool UVFDataset::GetBrick(const BrickKey& k, std::vector& vData) const { return GetBrickTemplate(k,vData); } bool UVFDataset::GetBrick(const BrickKey& k, std::vector& vData) const { return GetBrickTemplate(k,vData); } std::pair UVFDataset::GetTextCoords(BrickTable::const_iterator brick, bool bUseOnlyPowerOfTwo) const { if (m_bToCBlock) { const UINT64VECTOR4 coords = KeyToTOCVector(brick->first); const TOCBlock* tb = static_cast(m_timesteps[std::get<0>(brick->first)])->GetDB(); uint32_t iOverlap = tb->GetOverlap(); FLOATVECTOR3 brickAspect = FLOATVECTOR3(tb->GetBrickAspect(coords)); FLOATVECTOR3 vTexcoordsMin; FLOATVECTOR3 vTexcoordsMax; if (bUseOnlyPowerOfTwo) { UINTVECTOR3 vRealVoxelCount(MathTools::NextPow2(brick->second.n_voxels.x), MathTools::NextPow2(brick->second.n_voxels.y), MathTools::NextPow2(brick->second.n_voxels.z) ); vTexcoordsMin = float(iOverlap) / FLOATVECTOR3(vRealVoxelCount); vTexcoordsMax = 1.0f-vTexcoordsMin; vTexcoordsMax -= FLOATVECTOR3(vRealVoxelCount - brick->second.n_voxels) / FLOATVECTOR3(vRealVoxelCount); } else { vTexcoordsMin = float(iOverlap) / FLOATVECTOR3(brick->second.n_voxels); vTexcoordsMax = 1.0f-vTexcoordsMin; } return std::make_pair(vTexcoordsMin, vTexcoordsMax*brickAspect); } else { return Dataset::GetTextCoords(brick, bUseOnlyPowerOfTwo); } } } // tuvok namespace. ImageVis3D-3.1.0/Tuvok/IO/KeyValueFileParser.h0000644000175000017500000001162012320456500020547 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file KeyValueFileParser.h \author Jens Krueger SCI Institute University of Utah \date September 2008 */ #pragma once #ifndef KEYVALUEFILEPARSER_H #define KEYVALUEFILEPARSER_H #ifdef _WIN32 #pragma warning (disable : 4995) #endif #include #include #include #ifdef _WIN32 #pragma warning (default : 4995) #endif #include "../StdTuvokDefines.h" /** \class KeyValPair * A key value pair used by the KeyValueFileParser class * it stores the key in four formats: * as wide unicode and "normal" 8 bit strings * both in uppercase letters and in the way the were discovered in the file * the values are stored in the same four string formats as well as * as int, unsigned int, float, and vectors in case of list values */ class KeyValPair { public: KeyValPair(); KeyValPair(const std::string& key, const std::string& value); KeyValPair(const std::wstring& key, const std::wstring& value); // keys std::string strKey; std::wstring wstrKey; std::string strKeyUpper; std::wstring wstrKeyUpper; // values std::string strValue; std::wstring wstrValue; std::string strValueUpper; std::wstring wstrValueUpper; int iValue; uint32_t uiValue; float fValue; std::vector viValue; std::vector vuiValue; std::vector vfValue; std::vector vstrValue; std::vector vwstrValue; private: void FillDerivedData(); }; /** \class KeyValueFileParser * KeyValueFileParser parses simple text files strucutured as * key [token] value [newline] */ class KeyValueFileParser { public: KeyValueFileParser(const std::string& strFilename, bool bStopOnEmptyLine=false, const std::string& strToken = ":", const std::string& strEndToken = ""); KeyValueFileParser(const std::wstring& wstrFilename, bool bStopOnEmptyLine=false, const std::wstring& wstrToken = L":", const std::wstring& wstrEndToken = L""); KeyValueFileParser(std::ifstream& fileData, bool bStopOnEmptyLine=false, const std::wstring& wstrToken = L":", const std::wstring& wstrEndToken = L""); KeyValueFileParser(std::ifstream& fileData, bool bStopOnEmptyLine=false, const std::string& strToken = ":", const std::string& strEndToken = ""); ~KeyValueFileParser(void); KeyValPair* GetData(const std::string& strKey, const bool bCaseSensitive=false); KeyValPair* GetData(const std::wstring& wstrKey, const bool bCaseSensitive=false); const KeyValPair* GetData(const std::string& strKey, const bool bCaseSensitive=false) const; bool FileReadable() const {return m_bFileReadable;} size_t GetStopPos() {return m_iStopPos;} protected: KeyValueFileParser() {} std::vector m_vecTokens; bool m_bFileReadable; size_t m_iStopPos; bool ParseFile(const std::string& strFilename, bool bStopOnEmptyLine, const std::string& strToken, const std::string& strEndToken); bool ParseFile(std::ifstream& fileData, bool bStopOnEmptyLine, const std::string& strToken, const std::string& strEndToken); bool ParseKeyValueLine(std::string line, bool bStopOnEmptyLine, bool bStopOnInvalidLine, const std::string& strToken, const std::string& strEndToken); }; #endif // KEYVALUEFILEPARSER_H ImageVis3D-3.1.0/Tuvok/IO/TiffVolumeConverter.h0000644000175000017500000000602412320456500021017 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file TiffVolumeConverter.h \author Tom Fogal SCI Institute University of Utah */ #pragma once #ifndef TIFFVOLUMECONVERTER_H #define TIFFVOLUMECONVERTER_H #include "../StdTuvokDefines.h" #include "RAWConverter.h" /** A converter for TIFF volumes. These are basically just TIFFs which * have multiple images per file. */ class TiffVolumeConverter : public RAWConverter { public: TiffVolumeConverter(); virtual ~TiffVolumeConverter() {} virtual bool ConvertToRAW(const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile); /// unimplemented! virtual bool ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize, FLOATVECTOR3 vVolumeAspect, bool bNoUserInteraction, const bool bQuantizeTo8Bit); virtual bool CanExportData() const { return false; } virtual bool CanImportData() const { return true; } }; #endif // TIFFVOLUMECONVERTER_H ImageVis3D-3.1.0/Tuvok/IO/expressions/0000755000175000017500000000000012320456500017256 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/IO/expressions/.gitignore0000644000175000017500000000015612320456500021250 0ustar mathieumathieuMakefile.debug Makefile.libexpr *.[ao] *.prl tvk-parse.*cpp tvk-parse.*hpp tvk-scan.*cpp tvk-scan.*hpp lexdbg ImageVis3D-3.1.0/Tuvok/IO/expressions/debug.pro0000644000175000017500000000211012320456500021060 0ustar mathieumathieuTEMPLATE = app win32:TEMPLATE = vcapp CONFIG = exceptions largefile rtti static stl warn_on DEFINES += DEBUG_LEX YY_NO_UNPUT macx:DEFINES += QT_MAC_USE_COCOA=1 TARGET = lexdbg DEPENDPATH += . ../../Basics ../ INCLUDEPATH += ../../ ../../Basics ../ ../3rdParty/boost win32:LIBS += shlwapi.lib unix:QMAKE_CXXFLAGS += -std=c++0x unix:QMAKE_CXXFLAGS += -fno-strict-aliasing unix:QMAKE_CFLAGS += -fno-strict-aliasing # On mac we completely disable warnings in this library. flex and bison are not playing nice with clang. macx:QMAKE_CXXFLAGS += -stdlib=libc++ -mmacosx-version-min=10.7 -w macx:QMAKE_CFLAGS += -mmacosx-version-min=10.7 macx:LIBS += -stdlib=libc++ -framework CoreFoundation -mmacosx-version-min=10.7 QTPLUGIN -= qgif qjpeg qtiff include(flex.pri) include(bison.pri) FLEXSOURCES = tvk-scan.lpp BISONSOURCES = tvk-parse.ypp SOURCES += \ binary-expression.cpp \ conditional-expression.cpp \ constant.cpp \ test.cpp \ treenode.cpp \ ../IO/VariantArray.cpp \ volume.cpp ImageVis3D-3.1.0/Tuvok/IO/expressions/parser.h0000644000175000017500000000332012320456500020721 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /// \brief Parser interface. #ifndef TUVOK_EXPRESSION_PARSER_H #define TUVOK_EXPRESSION_PARSER_H namespace tuvok { namespace expression { class Node; }} struct YYLTYPE; union YYSTYPE; extern int yyparse(void); extern void yyerror(YYLTYPE*, const char*); extern int yylex_destroy(); extern int yylex(YYSTYPE*, YYLTYPE*); tuvok::expression::Node* parser_tree_root(); void parser_free(); void parser_set_string(const char*); void parser_free_string(); #endif // TUVOK_EXPRESSION_PARSER_H ImageVis3D-3.1.0/Tuvok/IO/expressions/binary-expression.cpp0000644000175000017500000000567012320456500023453 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include "binary-expression.h" #include "constant.h" namespace tuvok { namespace expression { void BinaryExpression::SetOperator(enum OpType o) { this->oper = o; } void BinaryExpression::Analyze() const throw(semantic::Error) { // If they gave us a divide, check for division by zero. if(this->oper == OP_DIVIDE) { const std::shared_ptr rhs = this->GetChild(1); const std::shared_ptr c = std::dynamic_pointer_cast(rhs); if(c->GetValue() == 0.0) { throw semantic::DivisionByZero("Cannot divide by zero.", __FILE__, __LINE__); } } } void BinaryExpression::Print(std::ostream& os) const { os << "BinaryExpression("; this->GetChild(0)->Print(os); switch(this->oper) { case OP_PLUS: os << " + "; break; case OP_MINUS: os << " - "; break; case OP_DIVIDE: os << " / "; break; case OP_MULTIPLY: os << " * "; break; case OP_GREATER_THAN: os << " > "; break; case OP_LESS_THAN: os << " < "; break; case OP_EQUAL_TO: os << " = "; break; } this->GetChild(1)->Print(os); os << ")"; } static bool fp_equal(double a, double b) { return (fabs(a-b) < 0.001); } double BinaryExpression::Evaluate(size_t i) const { double lhs, rhs; lhs = this->GetChild(0)->Evaluate(i); rhs = this->GetChild(1)->Evaluate(i); switch(this->oper) { case OP_PLUS: return lhs + rhs; case OP_MINUS: return lhs - rhs; case OP_DIVIDE: return lhs / rhs; case OP_MULTIPLY: return lhs * rhs; case OP_GREATER_THAN: return lhs > rhs; case OP_LESS_THAN: return lhs < rhs; case OP_EQUAL_TO: return fp_equal(lhs, rhs); } assert(1 == 0); return 0.0; } }} ImageVis3D-3.1.0/Tuvok/IO/expressions/semantic.h0000644000175000017500000000404012320456500021230 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /// \brief Errors that can happen during semantic analysis #ifndef TUVOK_EXPRESSION_SEMANTIC_H #define TUVOK_EXPRESSION_SEMANTIC_H #include "TuvokException.h" namespace tuvok { namespace expression { namespace semantic { class Error: virtual public tuvok::Exception { public: explicit Error(const char* e, const char* where, size_t ln=0) : tuvok::Exception(e, where, ln) {} }; class NegativeIndex: virtual public Error { public: explicit NegativeIndex(const char* e, const char* where, size_t ln=0) : tuvok::Exception(e, where, ln), Error(e, where, ln) {} }; class DivisionByZero: virtual public Error { public: explicit DivisionByZero(const char* e, const char* where, size_t ln=0) : tuvok::Exception(e, where, ln), Error(e, where, ln) {} }; }}} #endif // TUVOK_EXPRESSION_SEMANTIC_H ImageVis3D-3.1.0/Tuvok/IO/expressions/tvk-scan.lexer.cpp0000644000175000017500000013700212320456500022631 0ustar mathieumathieu#line 2 "./tvk-scan.lexer.cpp" #line 4 "./tvk-scan.lexer.cpp" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! C99 */ #endif /* ! FLEXINT_H */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ #if defined (__STDC__) #define YY_USE_CONST #endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart(yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. * Ditto for the __ia64__ case accordingly. */ #define YY_BUF_SIZE 32768 #else #define YY_BUF_SIZE 16384 #endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart (FILE *input_file ); void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); void yy_delete_buffer (YY_BUFFER_STATE b ); void yy_flush_buffer (YY_BUFFER_STATE b ); void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); void yypop_buffer_state (void ); static void yyensure_buffer_stack (void ); static void yy_load_buffer_state (void ); static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); void *yyalloc (yy_size_t ); void *yyrealloc (void *,yy_size_t ); void yyfree (void * ); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ #define yywrap(n) 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern int yylineno; int yylineno = 1; extern char *yytext; #define yytext_ptr yytext static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ yyleng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 19 #define YY_END_OF_BUFFER 20 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_accept[29] = { 0, 0, 0, 20, 18, 17, 17, 13, 14, 9, 6, 7, 18, 8, 1, 16, 11, 12, 10, 15, 3, 4, 5, 2, 0, 1, 0, 2, 0 } ; static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 4, 5, 6, 7, 1, 8, 9, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 1, 13, 14, 15, 16, 1, 1, 1, 1, 1, 17, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 18, 1, 1, 1, 1, 19, 1, 20, 1, 1, 1, 1, 1, 1, 1, 17, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 21, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst flex_int32_t yy_meta[22] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst flex_int16_t yy_base[29] = { 0, 0, 0, 32, 33, 33, 33, 33, 33, 33, 33, 33, 20, 33, 13, 33, 33, 33, 33, 33, 33, 33, 33, 12, 19, 16, 17, 15, 33 } ; static yyconst flex_int16_t yy_def[29] = { 0, 28, 1, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 0 } ; static yyconst flex_int16_t yy_nxt[55] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 4, 20, 21, 22, 20, 24, 23, 25, 24, 27, 25, 27, 26, 23, 23, 28, 3, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28 } ; static yyconst flex_int16_t yy_chk[55] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 14, 23, 14, 25, 27, 25, 26, 23, 24, 12, 3, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int yy_flex_debug; int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "tvk-scan.lpp" #define YY_NO_UNISTD_H 1 #line 14 "tvk-scan.lpp" /** Scanner for Tuvok expressions. */ #include #include #include "treenode.h" #include "tvk-parse.parser.hpp" #ifdef DEBUG_LEX //extern "C" int yylex(YYSTYPE*,YYLTYPE*); # define token(x) (DisplayToken(# x), x) YYSTYPE yylval; void DisplayToken(const char* s); #else # define token(x) (x) #endif /* DEBUG_LEX */ static double convert_todbl(const char*); /** Keeps track of the current string index, for error reporting. */ /**@{*/ static void count(YYLTYPE* lloc); static size_t column = 0; /**@}*/ static YY_BUFFER_STATE scanning_buf; void parser_set_string(const char*); #line 508 "./tvk-scan.lexer.cpp" #define INITIAL 0 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int yylex_destroy (void ); int yyget_debug (void ); void yyset_debug (int debug_flag ); YY_EXTRA_TYPE yyget_extra (void ); void yyset_extra (YY_EXTRA_TYPE user_defined ); FILE *yyget_in (void ); void yyset_in (FILE * in_str ); FILE *yyget_out (void ); void yyset_out (FILE * out_str ); int yyget_leng (void ); char *yyget_text (void ); int yyget_lineno (void ); void yyset_lineno (int line_number ); YYSTYPE * yyget_lval (void ); void yyset_lval (YYSTYPE * yylval_param ); YYLTYPE *yyget_lloc (void ); void yyset_lloc (YYLTYPE * yylloc_param ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap (void ); #else extern int yywrap (void ); #endif #endif #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void ); #else static int input (void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k */ #define YY_READ_BUF_SIZE 16384 #else #define YY_READ_BUF_SIZE 8192 #endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(yyin); \ } \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int yylex \ (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ); #define YY_DECL int yylex \ (YYSTYPE * yylval_param, YYLTYPE * yylloc_param ) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; YYSTYPE * yylval; YYLTYPE * yylloc; #line 47 "tvk-scan.lpp" #line 710 "./tvk-scan.lexer.cpp" yylval = yylval_param; yylloc = yylloc_param; if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 29 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_current_state != 28 ); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); yy_find_action: yy_act = yy_accept[yy_current_state]; YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP #line 49 "tvk-scan.lpp" { count(yylloc); yylval->y_dbl = convert_todbl(yytext); return token(DOUBLE); } YY_BREAK case 2: YY_RULE_SETUP #line 55 "tvk-scan.lpp" { count(yylloc); yylval->y_dbl = convert_todbl(yytext); return token(DOUBLE); } YY_BREAK case 3: YY_RULE_SETUP #line 61 "tvk-scan.lpp" { count(yylloc); yylval->y_dbl = 0.0; // nullify it. return token(VOLUME); } YY_BREAK case 4: YY_RULE_SETUP #line 66 "tvk-scan.lpp" { count(yylloc); yylval->y_dbl = 0.0; // nullify it. return token(OPEN_BRACKET); } YY_BREAK case 5: YY_RULE_SETUP #line 71 "tvk-scan.lpp" { count(yylloc); yylval->y_dbl = 0.0; // nullify it. return token(CLOSE_BRACKET); } YY_BREAK case 6: YY_RULE_SETUP #line 76 "tvk-scan.lpp" { count(yylloc); yylval->y_dbl = 0.0; return token(PLUS); } YY_BREAK case 7: YY_RULE_SETUP #line 77 "tvk-scan.lpp" { count(yylloc); yylval->y_dbl = 0.0; return token(MINUS); } YY_BREAK case 8: YY_RULE_SETUP #line 78 "tvk-scan.lpp" { count(yylloc); yylval->y_dbl = 0.0; return token(DIVIDE); } YY_BREAK case 9: YY_RULE_SETUP #line 79 "tvk-scan.lpp" { count(yylloc); yylval->y_dbl = 0.0; return token(MULTIPLY); } YY_BREAK case 10: YY_RULE_SETUP #line 80 "tvk-scan.lpp" { count(yylloc); yylval->y_dbl = 0.0; return token(GREATER_THAN); } YY_BREAK case 11: YY_RULE_SETUP #line 81 "tvk-scan.lpp" { count(yylloc); yylval->y_dbl = 0.0; return token(LESS_THAN); } YY_BREAK case 12: YY_RULE_SETUP #line 82 "tvk-scan.lpp" { count(yylloc); yylval->y_dbl = 0.0; return token(EQUAL_TO); } YY_BREAK case 13: YY_RULE_SETUP #line 83 "tvk-scan.lpp" { count(yylloc); yylval->y_dbl = 0.0; return token(OPEN_PAREN); } YY_BREAK case 14: YY_RULE_SETUP #line 84 "tvk-scan.lpp" { count(yylloc); yylval->y_dbl = 0.0; return token(CLOSE_PAREN); } YY_BREAK case 15: YY_RULE_SETUP #line 85 "tvk-scan.lpp" { count(yylloc); yylval->y_dbl = 0.0; return token(QUESTION_MARK); } YY_BREAK case 16: YY_RULE_SETUP #line 86 "tvk-scan.lpp" { count(yylloc); yylval->y_dbl = 0.0; return token(COLON); } YY_BREAK case 17: /* rule 17 can match eol */ YY_RULE_SETUP #line 88 "tvk-scan.lpp" { count(yylloc); } YY_BREAK case 18: YY_RULE_SETUP #line 89 "tvk-scan.lpp" { count(yylloc); return token(BAD); } YY_BREAK case 19: YY_RULE_SETUP #line 91 "tvk-scan.lpp" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK #line 909 "./tvk-scan.lexer.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart(yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 29 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { register int yy_is_jam; register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 29 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 28); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart(yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( yywrap( ) ) return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_init_buffer(YY_CURRENT_BUFFER,input_file ); yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * yypop_buffer_state(); * yypush_buffer_state(new_buffer); */ yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with yy_create_buffer() * */ void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yyfree((void *) b->yy_ch_buf ); yyfree((void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. */ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; yy_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then yy_init_buffer was _probably_ * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; yyensure_buffer_stack(); /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from yy_switch_to_buffer. */ yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void yyensure_buffer_stack (void) { int num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * yy_scan_bytes() instead. */ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) { return yy_scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) yyalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ yytext[yyleng] = (yy_hold_char); \ (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ yyleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int yyget_lineno (void) { return yylineno; } /** Get the input stream. * */ FILE *yyget_in (void) { return yyin; } /** Get the output stream. * */ FILE *yyget_out (void) { return yyout; } /** Get the length of the current token. * */ int yyget_leng (void) { return yyleng; } /** Get the current token. * */ char *yyget_text (void) { return yytext; } /** Set the current line number. * @param line_number * */ void yyset_lineno (int line_number ) { yylineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * * @see yy_switch_to_buffer */ void yyset_in (FILE * in_str ) { yyin = in_str ; } void yyset_out (FILE * out_str ) { yyout = out_str ; } int yyget_debug (void) { return yy_flex_debug; } void yyset_debug (int bdebug ) { yy_flex_debug = bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from yylex_destroy(), so don't allocate here. */ (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = (char *) 0; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT yyin = stdin; yyout = stdout; #else yyin = (FILE *) 0; yyout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * yylex_init() */ return 0; } /* yylex_destroy is for both reentrant and non-reentrant scanners. */ int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; yypop_buffer_state(); } /* Destroy the stack itself. */ yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *yyalloc (yy_size_t size ) { return (void *) malloc( size ); } void *yyrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } void yyfree (void * ptr ) { free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 91 "tvk-scan.lpp" /** keeps track of the # of lines/columns in a couple global variables, * for the purpose of reporting errors. * @todo FIXME should just remove 'column' and rely on yylloc aka lloc */ static void count(YYLTYPE* lloc) { size_t i; for(i=0; yytext[i] != '\0'; ++i) { if(yytext[i] == '\n') { column = 0; } else if(yytext[i] == '\t') { column += 8; } else { ++column; } } lloc->first_column = column; lloc->first_line = yylineno; } static double convert_todbl(const char *s) { std::istringstream input(s); double d; input >> d; if(!input) { // throw exception... } return d; } #ifdef DEBUG_LEX void DisplayToken(const char *p) { printf("%-10.10s is [%s]\n", p, yytext); } # if 0 // simple main to just open the file given by the only argument && lex it. int main(int argc, char *argv[]) { if(argc != 2) { fprintf(stderr, "%s takes one argument: the file to lex.\n", argv[0]); exit(-1); } fprintf(stderr, "scanning [%s]\n", argv[1]); yyin = fopen(argv[1], "r"); if(yyin == NULL) { perror("fopen"); exit(-2); } while(yylex()) {} fclose(yyin); return 0; } # endif #endif /* DEBUG_LEX */ void parser_set_string(const char* s) { scanning_buf = yy_scan_string(s); } void parser_free_string() { yy_delete_buffer(scanning_buf); } ImageVis3D-3.1.0/Tuvok/IO/expressions/conditional-expression.h0000644000175000017500000000327712320456500024140 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /// \brief A ternary expression implementing a conditional. #ifndef TUVOK_CONDITIONAL_EXPRESSION_H #define TUVOK_CONDITIONAL_EXPRESSION_H #include "expression.h" namespace tuvok { namespace expression { class ConditionalExpression: public Expression { public: virtual void Analyze() const throw(semantic::Error); virtual void Print(std::ostream&) const; virtual double Evaluate(size_t idx) const; private: }; }} #endif // TUVOK_CONDITIONAL_EXPRESSION_H ImageVis3D-3.1.0/Tuvok/IO/expressions/expressions.pro0000644000175000017500000000013512320456500022361 0ustar mathieumathieuTEMPLATE = subdirs SUBDIRS = libexpr.pro unix:SUBDIRS += debug.pro CONFIG += ordered ImageVis3D-3.1.0/Tuvok/IO/expressions/constant.h0000644000175000017500000000331512320456500021262 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /// \brief A constant value in the expression. #ifndef TUVOK_CONSTANT_H #define TUVOK_CONSTANT_H #include "expression.h" namespace tuvok { namespace expression { class Constant: public Expression { public: void Analyze() const throw(semantic::Error); void SetValue(double v); double GetValue() const; virtual void Print(std::ostream&) const; double Evaluate(size_t) const { return this->value; } private: double value; }; }} #endif // TUVOK_CONSTANT_H ImageVis3D-3.1.0/Tuvok/IO/expressions/tvk-parse.parser.hpp0000644000175000017500000000506412320456500023203 0ustar mathieumathieu/* A Bison parser, made by GNU Bison 2.5. */ /* Skeleton interface for Bison GLR parsers in C Copyright (C) 2002-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { INTEGER = 258, DOUBLE = 259, VOLUME = 260, OPEN_BRACKET = 261, CLOSE_BRACKET = 262, OPEN_PAREN = 263, CLOSE_PAREN = 264, QUESTION_MARK = 265, COLON = 266, BAD = 267, EQUAL_TO = 268, LESS_THAN = 269, GREATER_THAN = 270, MULTIPLY = 271, DIVIDE = 272, MINUS = 273, PLUS = 274 }; #endif #ifndef YYSTYPE typedef union YYSTYPE { /* Line 2663 of glr.c */ #line 53 "tvk-parse.ypp" double y_dbl; tuvok::expression::Node* y_tree; enum tuvok::expression::OpType y_otype; /* Line 2663 of glr.c */ #line 76 "./tvk-parse.parser.hpp" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 #endif #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED typedef struct YYLTYPE { int first_line; int first_column; int last_line; int last_column; } YYLTYPE; # define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_TRIVIAL 1 #endif ImageVis3D-3.1.0/Tuvok/IO/expressions/constant.cpp0000644000175000017500000000310212320456500021607 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "constant.h" namespace tuvok { namespace expression { void Constant::SetValue(double v) { this->value = v; } double Constant::GetValue() const { return value; } void Constant::Analyze() const throw(semantic::Error) { // Nothing. A constant can never be "wrong". } void Constant::Print(std::ostream& os) const { os << this->value; } }} ImageVis3D-3.1.0/Tuvok/IO/expressions/bison.pri0000644000175000017500000000137712320456500021114 0ustar mathieumathieubison.name = Bison ${QMAKE_FILE_IN} bison.input = BISONSOURCES bison.output = ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.parser.cpp bison.commands = bison -d -o ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.parser.cpp ${QMAKE_FILE_IN} bison.CONFIG += target_predeps bison.variable_out = GENERATED_SOURCES silent:bison.commands = @echo Bison ${QMAKE_FILE_IN} && $$bison.commands QMAKE_EXTRA_COMPILERS += bison bison_header.input = BISONSOURCES bison_header.output = ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.parser.hpp bison_header.commands = bison -d -o ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.parser.cpp ${QMAKE_FILE_IN} bison_header.CONFIG += target_predeps no_link silent:bison_header.commands = @echo Bison ${QMAKE_FILE_IN} && $$bison.commands QMAKE_EXTRA_COMPILERS += bison_header ImageVis3D-3.1.0/Tuvok/IO/expressions/expression.h0000644000175000017500000000274312320456500021634 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /// \brief Base class for a node in an AST. #ifndef TUVOK_EXPRESSION_H #define TUVOK_EXPRESSION_H #include "treenode.h" namespace tuvok { namespace expression { class Expression : public Node { public: private: }; }} #endif // TUVOK_EXPRESSION_H ImageVis3D-3.1.0/Tuvok/IO/expressions/tvk-parse.ypp0000644000175000017500000001016112320456500021723 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ %{ #define YYPARSE_PARAM scanner #define YYLEX_PARAM scanner #include #include #include "treenode.h" #include "binary-expression.h" #include "constant.h" #include "volume.h" %} %glr-parser %locations %pure-parser %defines %glr-parser %error-verbose // expr ? expr : expr produces conflicts after the first expr: // shift the question mark? // reduce the just-parsed expression? // These end up leading to 16 situations where we could either shift or reduce. %expect 16 %union { double y_dbl; tuvok::expression::Node* y_tree; enum tuvok::expression::OpType y_otype; } %{ #include "parser.h" static tuvok::expression::Node* root = NULL; tuvok::expression::Node* parser_tree_root() { return root; } void parser_free() { yylex_destroy(); delete root; root = NULL; } using namespace tuvok::expression; %} %start tuvok_expression %token INTEGER DOUBLE %token VOLUME OPEN_BRACKET CLOSE_BRACKET OPEN_PAREN CLOSE_PAREN %token QUESTION_MARK COLON %token BAD %left PLUS MINUS DIVIDE MULTIPLY GREATER_THAN LESS_THAN EQUAL_TO %type binary_expression expression unary_expression constant %type tuvok_expression conditional_expression %type volume %type PLUS MINUS DIVIDE MULTIPLY GREATER_THAN LESS_THAN EQUAL_TO oper %destructor { delete $$; $$ = NULL; } binary_expression volume constant %% tuvok_expression : expression { $$ = root = $1; } ; expression : unary_expression { $$ = $1; } | conditional_expression { $$ = $1; } %dprec 2 | binary_expression { $$ = $1; } %dprec 1 | OPEN_PAREN expression CLOSE_PAREN { $$ = $2; } ; conditional_expression : expression QUESTION_MARK expression COLON expression { root = $$ = make_node(EXPR_CONDITIONAL, $1, $3, $5, NULL); } ; binary_expression : expression oper expression { root = $$ = make_node(EXPR_BINARY, $1, $3, NULL); BinaryExpression* be = dynamic_cast($$); be->SetOperator($2); } ; unary_expression : constant { $$ = $1; } | volume { $$ = $1; } ; oper : PLUS { $$ = OP_PLUS; } | MINUS { $$ = OP_MINUS; } | DIVIDE { $$ = OP_DIVIDE; } | MULTIPLY { $$ = OP_MULTIPLY; } | GREATER_THAN { $$ = OP_GREATER_THAN; } | LESS_THAN { $$ = OP_LESS_THAN; } | EQUAL_TO { $$ = OP_EQUAL_TO; } ; volume : VOLUME OPEN_BRACKET DOUBLE CLOSE_BRACKET { root = $$ = make_node(EXPR_VOLUME, NULL); Volume* v = dynamic_cast($$); v->SetIndex($3); } ; constant : DOUBLE { root = $$ = make_node(EXPR_CONSTANT, NULL); Constant* c = dynamic_cast($$); c->SetValue($1); } | MINUS DOUBLE { root = $$ = make_node(EXPR_CONSTANT, NULL); Constant* c = dynamic_cast($$); c->SetValue(-$2); } ; %% void yyerror(YYLTYPE* loc, const char* msg) { std::cerr << "error: " << msg << " at: " << loc->first_column << ":" << loc->last_column << "\n"; /* should throw... */ } ImageVis3D-3.1.0/Tuvok/IO/expressions/binary-expression.h0000644000175000017500000000330512320456500023111 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /// \brief A two argument expression. #ifndef TUVOK_BINARY_EXPRESSION_H #define TUVOK_BINARY_EXPRESSION_H #include "expression.h" namespace tuvok { namespace expression { class BinaryExpression : public Expression { public: void SetOperator(enum OpType); void Analyze() const throw(semantic::Error); virtual void Print(std::ostream&) const; virtual double Evaluate(size_t) const; private: enum OpType oper; }; }} #endif // TUVOK_BINARY_EXPRESSION_H ImageVis3D-3.1.0/Tuvok/IO/expressions/treenode.cpp0000644000175000017500000000537012320456500021574 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include "treenode.h" #include "binary-expression.h" #include "conditional-expression.h" #include "constant.h" #include "volume.h" #include namespace tuvok { namespace expression { Node::~Node() { this->children.clear(); } void Node::AddChild(Node* n) { this->children.push_back(std::shared_ptr(n)); } const std::shared_ptr Node::GetChild(size_t index) const { assert(index < this->children.size()); return this->children[index]; } Node::citer Node::begin() const { return this->children.begin(); } Node::citer Node::end() const { return this->children.end(); } void Node::Print(std::ostream& os) const { os << "Node"; } // only 'volume's need this... we just forward it here. void Node::SetVolumes(const std::vector& vols) { for(Node::citer i = this->begin(); i != this->end(); ++i) { (*i)->SetVolumes(vols); } } static Node* node_factory(NodeType); Node* make_node(NodeType nt, ...) { va_list ap; Node* n = node_factory(nt); assert(n); // Now take a null-terminated argument list. Node *iter; va_start(ap, nt); do { iter = va_arg(ap, Node*); if(iter) { n->AddChild(iter); } } while(iter); va_end(ap); return n; } static Node* node_factory(NodeType nt) { switch(nt) { case EXPR_CONSTANT: return new Constant(); case EXPR_VOLUME: return new Volume(); case EXPR_BINARY: return new BinaryExpression(); case EXPR_CONDITIONAL: return new ConditionalExpression(); } return NULL; } }} ImageVis3D-3.1.0/Tuvok/IO/expressions/libexpr.pro0000644000175000017500000000173312320456500021451 0ustar mathieumathieuTEMPLATE = lib win32:TEMPLATE = vclib CONFIG = exceptions largefile rtti static staticlib stl CONFIG += warn_on DEFINES += YY_NO_UNPUT _FILE_OFFSET_BITS=64 TARGET = tuvokexpr DEPENDPATH += . ../../Basics ../ INCLUDEPATH += ../../ ../../Basics ../ ../3rdParty/boost unix:QMAKE_CXXFLAGS += -std=c++0x unix:QMAKE_CXXFLAGS += -fno-strict-aliasing unix:QMAKE_CFLAGS += -fno-strict-aliasing # On mac we completely disable warnings in this library. flex and bison are not playing nice with clang. macx:QMAKE_CXXFLAGS += -stdlib=libc++ -mmacosx-version-min=10.7 -w macx:QMAKE_CFLAGS += -mmacosx-version-min=10.7 macx:LIBS += -stdlib=libc++ -framework CoreFoundation -mmacosx-version-min=10.7 include(flex.pri) include(bison.pri) FLEXSOURCES = tvk-scan.lpp BISONSOURCES = tvk-parse.ypp SOURCES += \ binary-expression.cpp \ conditional-expression.cpp \ constant.cpp \ treenode.cpp \ volume.cpp ImageVis3D-3.1.0/Tuvok/IO/expressions/flex.pri0000644000175000017500000000057112320456500020733 0ustar mathieumathieuflex.name = Flex ${QMAKE_FILE_IN} flex.input = FLEXSOURCES flex.output = ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.lexer.cpp flex.commands = flex -o ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.lexer.cpp ${QMAKE_FILE_IN} flex.CONFIG += target_predeps flex.variable_out = GENERATED_SOURCES silent:flex.commands = @echo Lex ${QMAKE_FILE_IN} && $$flex.commands QMAKE_EXTRA_COMPILERS += flex ImageVis3D-3.1.0/Tuvok/IO/expressions/volume.h0000644000175000017500000000425712320456500020746 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /// \brief Volume access expression, i.e. "v[0]". #ifndef TUVOK_VOLUME_H #define TUVOK_VOLUME_H #include "expression.h" namespace tuvok { namespace expression { class Volume : public Expression { public: /// Sets the index into the array of volumes. void SetIndex(double i); /// Returns the index. We know it'll be usable as a size_t, because we /// would fail semantic analysis otherwise. size_t Index() const; void Analyze() const throw(semantic::Error); void Print(std::ostream&) const; void SetVolumes(const std::vector&); double Evaluate(size_t idx) const; private: // Yes, it makes more sense for this to be some kind of unsigned // integer. However we just want to store what we get from the // lexer at first, so that we can do error detection during // semantic analysis, later. double index; std::vector v; ///< input volumes. }; }} #endif // TUVOK_VOLUME_H ImageVis3D-3.1.0/Tuvok/IO/expressions/tvk-parse.parser.cpp0000644000175000017500000024362012320456500023200 0ustar mathieumathieu/* A Bison parser, made by GNU Bison 2.5. */ /* Skeleton implementation for Bison GLR parsers in C Copyright (C) 2002-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C GLR parser skeleton written by Paul Hilfinger. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.5" /* Skeleton name. */ #define YYSKELETON_NAME "glr.c" /* Pure parsers. */ #define YYPURE 1 /* Using locations. */ #define YYLSP_NEEDED 1 /* Copy the first part of user declarations. */ /* Line 172 of glr.c */ #line 28 "tvk-parse.ypp" #define YYPARSE_PARAM scanner #define YYLEX_PARAM scanner #include #include #include #include "treenode.h" #include "binary-expression.h" #include "constant.h" #include "volume.h" /* Line 172 of glr.c */ #line 73 "./tvk-parse.parser.cpp" #include "tvk-parse.parser.hpp" /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 1 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif /* Default (constant) value used for initialization for null right-hand sides. Unlike the standard yacc.c template, here we set the default value of $$ to a zeroed-out value. Since the default value is undefined, this behavior is technically correct. */ static YYSTYPE yyval_default; /* Copy the second part of user declarations. */ /* Line 243 of glr.c */ #line 59 "tvk-parse.ypp" #include "parser.h" static tuvok::expression::Node* root = NULL; tuvok::expression::Node* parser_tree_root() { return root; } void parser_free() { yylex_destroy(); delete root; root = NULL; } using namespace tuvok::expression; /* Line 243 of glr.c */ #line 119 "./tvk-parse.parser.cpp" #include #include #include #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int i) #else static int YYID (i) int i; #endif { return i; } #endif #ifndef YYFREE # define YYFREE free #endif #ifndef YYMALLOC # define YYMALLOC malloc #endif #ifndef YYREALLOC # define YYREALLOC realloc #endif #define YYSIZEMAX ((size_t) -1) #ifdef __cplusplus typedef bool yybool; #else typedef unsigned char yybool; #endif #define yytrue 1 #define yyfalse 0 #ifndef YYSETJMP # include # define YYJMP_BUF jmp_buf # define YYSETJMP(env) setjmp (env) # define YYLONGJMP(env, val) longjmp (env, val) #endif /*-----------------. | GCC extensions. | `-----------------*/ #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ # if (! defined __GNUC__ || __GNUC__ < 2 \ || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) \ || (defined __STRICT_ANSI__ && __STRICT_ANSI__)) # define __attribute__(Spec) /* empty */ # endif #endif #define YYOPTIONAL_LOC(Name) Name #ifndef YYASSERT # define YYASSERT(condition) ((void) ((condition) || (abort (), 0))) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 15 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 74 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 20 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 9 /* YYNRULES -- Number of rules. */ #define YYNRULES 20 /* YYNRULES -- Number of states. */ #define YYNSTATES 32 /* YYMAXRHS -- Maximum number of symbols on right-hand side of rule. */ #define YYMAXRHS 5 /* YYMAXLEFT -- Maximum number of symbols to the left of a handle accessed by $0, $-1, etc., in any rule. */ #define YYMAXLEFT 0 /* YYTRANSLATE(X) -- Bison symbol number corresponding to X. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 274 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const unsigned char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const unsigned char yyprhs[] = { 0, 0, 3, 5, 7, 9, 11, 15, 21, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 48, 50 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const signed char yyrhs[] = { 21, 0, -1, 22, -1, 25, -1, 23, -1, 24, -1, 8, 22, 9, -1, 22, 10, 22, 11, 22, -1, 22, 26, 22, -1, 28, -1, 27, -1, 19, -1, 18, -1, 17, -1, 16, -1, 15, -1, 14, -1, 13, -1, 5, 6, 4, 7, -1, 4, -1, 18, 4, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned char yyrline[] = { 0, 90, 90, 96, 97, 98, 99, 103, 109, 117, 118, 122, 123, 124, 125, 126, 127, 128, 132, 140, 145 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "INTEGER", "DOUBLE", "VOLUME", "OPEN_BRACKET", "CLOSE_BRACKET", "OPEN_PAREN", "CLOSE_PAREN", "QUESTION_MARK", "COLON", "BAD", "EQUAL_TO", "LESS_THAN", "GREATER_THAN", "MULTIPLY", "DIVIDE", "MINUS", "PLUS", "$accept", "tuvok_expression", "expression", "conditional_expression", "binary_expression", "unary_expression", "oper", "volume", "constant", 0 }; #endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const unsigned char yyr1[] = { 0, 20, 21, 22, 22, 22, 22, 23, 24, 25, 25, 26, 26, 26, 26, 26, 26, 26, 27, 28, 28 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const unsigned char yyr2[] = { 0, 2, 1, 1, 1, 1, 3, 5, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 2 }; /* YYDPREC[RULE-NUM] -- Dynamic precedence of rule #RULE-NUM (0 if none). */ static const unsigned char yydprec[] = { 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* YYMERGER[RULE-NUM] -- Index of merging function for rule #RULE-NUM. */ static const unsigned char yymerger[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* YYDEFACT[S] -- default reduction number in state S. Performed when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const unsigned char yydefact[] = { 0, 19, 0, 0, 0, 0, 2, 4, 5, 3, 10, 9, 0, 0, 20, 1, 0, 17, 16, 15, 14, 13, 12, 11, 0, 0, 6, 0, 8, 18, 0, 7 }; /* YYPDEFGOTO[NTERM-NUM]. */ static const signed char yydefgoto[] = { -1, 5, 6, 7, 8, 9, 24, 10, 11 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -6 static const signed char yypact[] = { -2, -6, -5, -2, 0, 5, 35, -6, -6, -6, -6, -6, 3, 15, -6, -6, -2, -6, -6, -6, -6, -6, -6, -6, -2, 1, -6, 25, 45, -6, -2, 55 }; /* YYPGOTO[NTERM-NUM]. */ static const signed char yypgoto[] = { -6, -6, -3, -6, -6, -6, -6, -6, -6 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const unsigned char yytable[] = { 13, 12, 1, 2, 14, 15, 3, 25, 29, 0, 0, 0, 0, 27, 0, 0, 4, 0, 0, 0, 0, 28, 0, 0, 26, 16, 0, 31, 17, 18, 19, 20, 21, 22, 23, 16, 30, 0, 17, 18, 19, 20, 21, 22, 23, 16, 0, 0, 17, 18, 19, 20, 21, 22, 23, 16, 0, 0, 17, 18, 19, 20, 21, 22, 23, 16, 0, 0, 17, 18, 19, 20, 21, 22, 23 }; /* YYCONFLP[YYPACT[STATE-NUM]] -- Pointer into YYCONFL of start of list of conflicting reductions corresponding to action entry for state STATE-NUM in yytable. 0 means no conflicts. The list in yyconfl is terminated by a rule number of 0. */ static const unsigned char yyconflp[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, 0, 0, 19, 21, 23, 25, 27, 29, 31 }; /* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by 0, pointed into by YYCONFLP. */ static const short int yyconfl[] = { 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0 }; static const signed char yycheck[] = { 3, 6, 4, 5, 4, 0, 8, 4, 7, -1, -1, -1, -1, 16, -1, -1, 18, -1, -1, -1, -1, 24, -1, -1, 9, 10, -1, 30, 13, 14, 15, 16, 17, 18, 19, 10, 11, -1, 13, 14, 15, 16, 17, 18, 19, 10, -1, -1, 13, 14, 15, 16, 17, 18, 19, 10, -1, -1, 13, 14, 15, 16, 17, 18, 19, 10, -1, -1, 13, 14, 15, 16, 17, 18, 19 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const unsigned char yystos[] = { 0, 4, 5, 8, 18, 21, 22, 23, 24, 25, 27, 28, 6, 22, 4, 0, 10, 13, 14, 15, 16, 17, 18, 19, 26, 4, 9, 22, 22, 7, 11, 22 }; /* Prevent warning if -Wmissing-prototypes. */ int yyparse (void); /* Error token number */ #define YYTERROR 1 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) #endif #ifndef YY_LOCATION_PRINT # define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif /* YYLEX -- calling `yylex' with the right arguments. */ #define YYLEX yylex (&yylval, &yylloc) #undef yynerrs #define yynerrs (yystackp->yyerrcnt) #undef yychar #define yychar (yystackp->yyrawchar) #undef yylval #define yylval (yystackp->yyval) #undef yylloc #define yylloc (yystackp->yyloc) static const int YYEOF = 0; static const int YYEMPTY = -2; typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG; #define YYCHK(YYE) \ do { YYRESULTTAG yyflag = YYE; if (yyflag != yyok) return yyflag; } \ while (YYID (0)) #if YYDEBUG # ifndef YYFPRINTF # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) { if (!yyvaluep) return; YYUSE (yylocationp); # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); YY_LOCATION_PRINT (yyoutput, *yylocationp); YYFPRINTF (yyoutput, ": "); yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp); YYFPRINTF (yyoutput, ")"); } # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, Type, \ Value, Location); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if SIZE_MAX < YYMAXDEPTH * sizeof (GLRStackItem) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif /* Minimum number of free items on the stack allowed after an allocation. This is to allow allocation and initialization to be completed by functions that call yyexpandGLRStack before the stack is expanded, thus insuring that all necessary pointers get properly redirected to new data. */ #define YYHEADROOM 2 #ifndef YYSTACKEXPANDABLE # if (! defined __cplusplus \ || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)) # define YYSTACKEXPANDABLE 1 # else # define YYSTACKEXPANDABLE 0 # endif #endif #if YYSTACKEXPANDABLE # define YY_RESERVE_GLRSTACK(Yystack) \ do { \ if (Yystack->yyspaceLeft < YYHEADROOM) \ yyexpandGLRStack (Yystack); \ } while (YYID (0)) #else # define YY_RESERVE_GLRSTACK(Yystack) \ do { \ if (Yystack->yyspaceLeft < YYHEADROOM) \ yyMemoryExhausted (Yystack); \ } while (YYID (0)) #endif #if YYERROR_VERBOSE # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * yystpcpy (char *yydest, const char *yysrc) { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static size_t yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { size_t yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return strlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif #endif /* !YYERROR_VERBOSE */ /** State numbers, as in LALR(1) machine */ typedef int yyStateNum; /** Rule numbers, as in LALR(1) machine */ typedef int yyRuleNum; /** Grammar symbol */ typedef short int yySymbol; /** Item references, as in LALR(1) machine */ typedef short int yyItemNum; typedef struct yyGLRState yyGLRState; typedef struct yyGLRStateSet yyGLRStateSet; typedef struct yySemanticOption yySemanticOption; typedef union yyGLRStackItem yyGLRStackItem; typedef struct yyGLRStack yyGLRStack; struct yyGLRState { /** Type tag: always true. */ yybool yyisState; /** Type tag for yysemantics. If true, yysval applies, otherwise * yyfirstVal applies. */ yybool yyresolved; /** Number of corresponding LALR(1) machine state. */ yyStateNum yylrState; /** Preceding state in this stack */ yyGLRState* yypred; /** Source position of the first token produced by my symbol */ size_t yyposn; union { /** First in a chain of alternative reductions producing the * non-terminal corresponding to this state, threaded through * yynext. */ yySemanticOption* yyfirstVal; /** Semantic value for this state. */ YYSTYPE yysval; } yysemantics; /** Source location for this state. */ YYLTYPE yyloc; }; struct yyGLRStateSet { yyGLRState** yystates; /** During nondeterministic operation, yylookaheadNeeds tracks which * stacks have actually needed the current lookahead. During deterministic * operation, yylookaheadNeeds[0] is not maintained since it would merely * duplicate yychar != YYEMPTY. */ yybool* yylookaheadNeeds; size_t yysize, yycapacity; }; struct yySemanticOption { /** Type tag: always false. */ yybool yyisState; /** Rule number for this reduction */ yyRuleNum yyrule; /** The last RHS state in the list of states to be reduced. */ yyGLRState* yystate; /** The lookahead for this reduction. */ int yyrawchar; YYSTYPE yyval; YYLTYPE yyloc; /** Next sibling in chain of options. To facilitate merging, * options are chained in decreasing order by address. */ yySemanticOption* yynext; }; /** Type of the items in the GLR stack. The yyisState field * indicates which item of the union is valid. */ union yyGLRStackItem { yyGLRState yystate; yySemanticOption yyoption; }; struct yyGLRStack { int yyerrState; /* To compute the location of the error token. */ yyGLRStackItem yyerror_range[3]; int yyerrcnt; int yyrawchar; YYSTYPE yyval; YYLTYPE yyloc; YYJMP_BUF yyexception_buffer; yyGLRStackItem* yyitems; yyGLRStackItem* yynextFree; size_t yyspaceLeft; yyGLRState* yysplitPoint; yyGLRState* yylastDeleted; yyGLRStateSet yytops; }; #if YYSTACKEXPANDABLE static void yyexpandGLRStack (yyGLRStack* yystackp); #endif static void yyFail (yyGLRStack* yystackp, YYLTYPE *yylocp, const char* yymsg) __attribute__ ((__noreturn__)); static void yyFail (yyGLRStack* yystackp, YYLTYPE *yylocp, const char* yymsg) { if (yymsg != NULL) yyerror (yylocp, yymsg); YYLONGJMP (yystackp->yyexception_buffer, 1); } static void yyMemoryExhausted (yyGLRStack* yystackp) __attribute__ ((__noreturn__)); static void yyMemoryExhausted (yyGLRStack* yystackp) { YYLONGJMP (yystackp->yyexception_buffer, 2); } #if YYDEBUG || YYERROR_VERBOSE /** A printable representation of TOKEN. */ static inline const char* yytokenName (yySymbol yytoken) { if (yytoken == YYEMPTY) return ""; return yytname[yytoken]; } #endif /** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting * at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred * containing the pointer to the next state in the chain. */ static void yyfillin (yyGLRStackItem *, int, int) __attribute__ ((__unused__)); static void yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1) { yyGLRState* s; int i; s = yyvsp[yylow0].yystate.yypred; for (i = yylow0-1; i >= yylow1; i -= 1) { YYASSERT (s->yyresolved); yyvsp[i].yystate.yyresolved = yytrue; yyvsp[i].yystate.yysemantics.yysval = s->yysemantics.yysval; yyvsp[i].yystate.yyloc = s->yyloc; s = yyvsp[i].yystate.yypred = s->yypred; } } /* Do nothing if YYNORMAL or if *YYLOW <= YYLOW1. Otherwise, fill in * YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1. * For convenience, always return YYLOW1. */ static inline int yyfill (yyGLRStackItem *, int *, int, yybool) __attribute__ ((__unused__)); static inline int yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal) { if (!yynormal && yylow1 < *yylow) { yyfillin (yyvsp, *yylow, yylow1); *yylow = yylow1; } return yylow1; } /** Perform user action for rule number YYN, with RHS length YYRHSLEN, * and top stack item YYVSP. YYLVALP points to place to put semantic * value ($$), and yylocp points to place for location information * (@$). Returns yyok for normal return, yyaccept for YYACCEPT, * yyerr for YYERROR, yyabort for YYABORT. */ /*ARGSUSED*/ static YYRESULTTAG yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp, YYSTYPE* yyvalp, YYLTYPE* YYOPTIONAL_LOC (yylocp), yyGLRStack* yystackp ) { yybool yynormal __attribute__ ((__unused__)) = (yystackp->yysplitPoint == NULL); int yylow; # undef yyerrok # define yyerrok (yystackp->yyerrState = 0) # undef YYACCEPT # define YYACCEPT return yyaccept # undef YYABORT # define YYABORT return yyabort # undef YYERROR # define YYERROR return yyerrok, yyerr # undef YYRECOVERING # define YYRECOVERING() (yystackp->yyerrState != 0) # undef yyclearin # define yyclearin (yychar = YYEMPTY) # undef YYFILL # define YYFILL(N) yyfill (yyvsp, &yylow, N, yynormal) # undef YYBACKUP # define YYBACKUP(Token, Value) \ return yyerror (yylocp, YY_("syntax error: cannot back up")), \ yyerrok, yyerr yylow = 1; if (yyrhslen == 0) *yyvalp = yyval_default; else *yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval; YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen); yystackp->yyerror_range[1].yystate.yyloc = *yylocp; switch (yyn) { case 2: /* Line 936 of glr.c */ #line 90 "tvk-parse.ypp" { ((*yyvalp).y_tree) = root = (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.y_tree); } break; case 3: /* Line 936 of glr.c */ #line 96 "tvk-parse.ypp" { ((*yyvalp).y_tree) = (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.y_tree); } break; case 4: /* Line 936 of glr.c */ #line 97 "tvk-parse.ypp" { ((*yyvalp).y_tree) = (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.y_tree); } break; case 5: /* Line 936 of glr.c */ #line 98 "tvk-parse.ypp" { ((*yyvalp).y_tree) = (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.y_tree); } break; case 6: /* Line 936 of glr.c */ #line 99 "tvk-parse.ypp" { ((*yyvalp).y_tree) = (((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (3))].yystate.yysemantics.yysval.y_tree); } break; case 7: /* Line 936 of glr.c */ #line 103 "tvk-parse.ypp" { root = ((*yyvalp).y_tree) = make_node(EXPR_CONDITIONAL, (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (5))].yystate.yysemantics.yysval.y_tree), (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (5))].yystate.yysemantics.yysval.y_tree), (((yyGLRStackItem const *)yyvsp)[YYFILL ((5) - (5))].yystate.yysemantics.yysval.y_tree), NULL); } break; case 8: /* Line 936 of glr.c */ #line 109 "tvk-parse.ypp" { root = ((*yyvalp).y_tree) = make_node(EXPR_BINARY, (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (3))].yystate.yysemantics.yysval.y_tree), (((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (3))].yystate.yysemantics.yysval.y_tree), NULL); BinaryExpression* be = dynamic_cast(((*yyvalp).y_tree)); be->SetOperator((((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (3))].yystate.yysemantics.yysval.y_otype)); } break; case 9: /* Line 936 of glr.c */ #line 117 "tvk-parse.ypp" { ((*yyvalp).y_tree) = (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.y_tree); } break; case 10: /* Line 936 of glr.c */ #line 118 "tvk-parse.ypp" { ((*yyvalp).y_tree) = (((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.y_tree); } break; case 11: /* Line 936 of glr.c */ #line 122 "tvk-parse.ypp" { ((*yyvalp).y_otype) = OP_PLUS; } break; case 12: /* Line 936 of glr.c */ #line 123 "tvk-parse.ypp" { ((*yyvalp).y_otype) = OP_MINUS; } break; case 13: /* Line 936 of glr.c */ #line 124 "tvk-parse.ypp" { ((*yyvalp).y_otype) = OP_DIVIDE; } break; case 14: /* Line 936 of glr.c */ #line 125 "tvk-parse.ypp" { ((*yyvalp).y_otype) = OP_MULTIPLY; } break; case 15: /* Line 936 of glr.c */ #line 126 "tvk-parse.ypp" { ((*yyvalp).y_otype) = OP_GREATER_THAN; } break; case 16: /* Line 936 of glr.c */ #line 127 "tvk-parse.ypp" { ((*yyvalp).y_otype) = OP_LESS_THAN; } break; case 17: /* Line 936 of glr.c */ #line 128 "tvk-parse.ypp" { ((*yyvalp).y_otype) = OP_EQUAL_TO; } break; case 18: /* Line 936 of glr.c */ #line 132 "tvk-parse.ypp" { root = ((*yyvalp).y_tree) = make_node(EXPR_VOLUME, NULL); Volume* v = dynamic_cast(((*yyvalp).y_tree)); v->SetIndex((((yyGLRStackItem const *)yyvsp)[YYFILL ((3) - (4))].yystate.yysemantics.yysval.y_dbl)); } break; case 19: /* Line 936 of glr.c */ #line 140 "tvk-parse.ypp" { root = ((*yyvalp).y_tree) = make_node(EXPR_CONSTANT, NULL); Constant* c = dynamic_cast(((*yyvalp).y_tree)); c->SetValue((((yyGLRStackItem const *)yyvsp)[YYFILL ((1) - (1))].yystate.yysemantics.yysval.y_dbl)); } break; case 20: /* Line 936 of glr.c */ #line 145 "tvk-parse.ypp" { root = ((*yyvalp).y_tree) = make_node(EXPR_CONSTANT, NULL); Constant* c = dynamic_cast(((*yyvalp).y_tree)); c->SetValue(-(((yyGLRStackItem const *)yyvsp)[YYFILL ((2) - (2))].yystate.yysemantics.yysval.y_dbl)); } break; /* Line 936 of glr.c */ #line 1074 "./tvk-parse.parser.cpp" default: break; } return yyok; # undef yyerrok # undef YYABORT # undef YYACCEPT # undef YYERROR # undef YYBACKUP # undef yyclearin # undef YYRECOVERING } /*ARGSUSED*/ static void yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1) { YYUSE (yy0); YYUSE (yy1); switch (yyn) { default: break; } } /* Bison grammar-table manipulation. */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) { YYUSE (yyvaluep); YYUSE (yylocationp); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { case 24: /* "binary_expression" */ /* Line 966 of glr.c */ #line 82 "tvk-parse.ypp" { delete (yyvaluep->y_tree); (yyvaluep->y_tree) = NULL; }; /* Line 966 of glr.c */ #line 1131 "./tvk-parse.parser.cpp" break; case 27: /* "volume" */ /* Line 966 of glr.c */ #line 82 "tvk-parse.ypp" { delete (yyvaluep->y_tree); (yyvaluep->y_tree) = NULL; }; /* Line 966 of glr.c */ #line 1143 "./tvk-parse.parser.cpp" break; case 28: /* "constant" */ /* Line 966 of glr.c */ #line 82 "tvk-parse.ypp" { delete (yyvaluep->y_tree); (yyvaluep->y_tree) = NULL; }; /* Line 966 of glr.c */ #line 1155 "./tvk-parse.parser.cpp" break; default: break; } } /** Number of symbols composing the right hand side of rule #RULE. */ static inline int yyrhsLength (yyRuleNum yyrule) { return yyr2[yyrule]; } static void yydestroyGLRState (char const *yymsg, yyGLRState *yys) { if (yys->yyresolved) yydestruct (yymsg, yystos[yys->yylrState], &yys->yysemantics.yysval, &yys->yyloc); else { #if YYDEBUG if (yydebug) { if (yys->yysemantics.yyfirstVal) YYFPRINTF (stderr, "%s unresolved ", yymsg); else YYFPRINTF (stderr, "%s incomplete ", yymsg); yy_symbol_print (stderr, yystos[yys->yylrState], NULL, &yys->yyloc); YYFPRINTF (stderr, "\n"); } #endif if (yys->yysemantics.yyfirstVal) { yySemanticOption *yyoption = yys->yysemantics.yyfirstVal; yyGLRState *yyrh; int yyn; for (yyrh = yyoption->yystate, yyn = yyrhsLength (yyoption->yyrule); yyn > 0; yyrh = yyrh->yypred, yyn -= 1) yydestroyGLRState (yymsg, yyrh); } } } /** Left-hand-side symbol for rule #RULE. */ static inline yySymbol yylhsNonterm (yyRuleNum yyrule) { return yyr1[yyrule]; } #define yypact_value_is_default(yystate) \ ((yystate) == (-6)) /** True iff LR state STATE has only a default reduction (regardless * of token). */ static inline yybool yyisDefaultedState (yyStateNum yystate) { return yypact_value_is_default (yypact[yystate]); } /** The default reduction for STATE, assuming it has one. */ static inline yyRuleNum yydefaultAction (yyStateNum yystate) { return yydefact[yystate]; } #define yytable_value_is_error(yytable_value) \ YYID (0) /** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN. * Result R means * R < 0: Reduce on rule -R. * R = 0: Error. * R > 0: Shift to state R. * Set *CONFLICTS to a pointer into yyconfl to 0-terminated list of * conflicting reductions. */ static inline void yygetLRActions (yyStateNum yystate, int yytoken, int* yyaction, const short int** yyconflicts) { int yyindex = yypact[yystate] + yytoken; if (yypact_value_is_default (yypact[yystate]) || yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken) { *yyaction = -yydefact[yystate]; *yyconflicts = yyconfl; } else if (! yytable_value_is_error (yytable[yyindex])) { *yyaction = yytable[yyindex]; *yyconflicts = yyconfl + yyconflp[yyindex]; } else { *yyaction = 0; *yyconflicts = yyconfl + yyconflp[yyindex]; } } static inline yyStateNum yyLRgotoState (yyStateNum yystate, yySymbol yylhs) { int yyr; yyr = yypgoto[yylhs - YYNTOKENS] + yystate; if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate) return yytable[yyr]; else return yydefgoto[yylhs - YYNTOKENS]; } static inline yybool yyisShiftAction (int yyaction) { return 0 < yyaction; } static inline yybool yyisErrorAction (int yyaction) { return yyaction == 0; } /* GLRStates */ /** Return a fresh GLRStackItem. Callers should call * YY_RESERVE_GLRSTACK afterwards to make sure there is sufficient * headroom. */ static inline yyGLRStackItem* yynewGLRStackItem (yyGLRStack* yystackp, yybool yyisState) { yyGLRStackItem* yynewItem = yystackp->yynextFree; yystackp->yyspaceLeft -= 1; yystackp->yynextFree += 1; yynewItem->yystate.yyisState = yyisState; return yynewItem; } /** Add a new semantic action that will execute the action for rule * RULENUM on the semantic values in RHS to the list of * alternative actions for STATE. Assumes that RHS comes from * stack #K of *STACKP. */ static void yyaddDeferredAction (yyGLRStack* yystackp, size_t yyk, yyGLRState* yystate, yyGLRState* rhs, yyRuleNum yyrule) { yySemanticOption* yynewOption = &yynewGLRStackItem (yystackp, yyfalse)->yyoption; yynewOption->yystate = rhs; yynewOption->yyrule = yyrule; if (yystackp->yytops.yylookaheadNeeds[yyk]) { yynewOption->yyrawchar = yychar; yynewOption->yyval = yylval; yynewOption->yyloc = yylloc; } else yynewOption->yyrawchar = YYEMPTY; yynewOption->yynext = yystate->yysemantics.yyfirstVal; yystate->yysemantics.yyfirstVal = yynewOption; YY_RESERVE_GLRSTACK (yystackp); } /* GLRStacks */ /** Initialize SET to a singleton set containing an empty stack. */ static yybool yyinitStateSet (yyGLRStateSet* yyset) { yyset->yysize = 1; yyset->yycapacity = 16; yyset->yystates = (yyGLRState**) YYMALLOC (16 * sizeof yyset->yystates[0]); if (! yyset->yystates) return yyfalse; yyset->yystates[0] = NULL; yyset->yylookaheadNeeds = (yybool*) YYMALLOC (16 * sizeof yyset->yylookaheadNeeds[0]); if (! yyset->yylookaheadNeeds) { YYFREE (yyset->yystates); return yyfalse; } return yytrue; } static void yyfreeStateSet (yyGLRStateSet* yyset) { YYFREE (yyset->yystates); YYFREE (yyset->yylookaheadNeeds); } /** Initialize STACK to a single empty stack, with total maximum * capacity for all stacks of SIZE. */ static yybool yyinitGLRStack (yyGLRStack* yystackp, size_t yysize) { yystackp->yyerrState = 0; yynerrs = 0; yystackp->yyspaceLeft = yysize; yystackp->yyitems = (yyGLRStackItem*) YYMALLOC (yysize * sizeof yystackp->yynextFree[0]); if (!yystackp->yyitems) return yyfalse; yystackp->yynextFree = yystackp->yyitems; yystackp->yysplitPoint = NULL; yystackp->yylastDeleted = NULL; return yyinitStateSet (&yystackp->yytops); } #if YYSTACKEXPANDABLE # define YYRELOC(YYFROMITEMS,YYTOITEMS,YYX,YYTYPE) \ &((YYTOITEMS) - ((YYFROMITEMS) - (yyGLRStackItem*) (YYX)))->YYTYPE /** If STACK is expandable, extend it. WARNING: Pointers into the stack from outside should be considered invalid after this call. We always expand when there are 1 or fewer items left AFTER an allocation, so that we can avoid having external pointers exist across an allocation. */ static void yyexpandGLRStack (yyGLRStack* yystackp) { yyGLRStackItem* yynewItems; yyGLRStackItem* yyp0, *yyp1; size_t yysize, yynewSize; size_t yyn; yysize = yystackp->yynextFree - yystackp->yyitems; if (YYMAXDEPTH - YYHEADROOM < yysize) yyMemoryExhausted (yystackp); yynewSize = 2*yysize; if (YYMAXDEPTH < yynewSize) yynewSize = YYMAXDEPTH; yynewItems = (yyGLRStackItem*) YYMALLOC (yynewSize * sizeof yynewItems[0]); if (! yynewItems) yyMemoryExhausted (yystackp); for (yyp0 = yystackp->yyitems, yyp1 = yynewItems, yyn = yysize; 0 < yyn; yyn -= 1, yyp0 += 1, yyp1 += 1) { *yyp1 = *yyp0; if (*(yybool *) yyp0) { yyGLRState* yys0 = &yyp0->yystate; yyGLRState* yys1 = &yyp1->yystate; if (yys0->yypred != NULL) yys1->yypred = YYRELOC (yyp0, yyp1, yys0->yypred, yystate); if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != NULL) yys1->yysemantics.yyfirstVal = YYRELOC(yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption); } else { yySemanticOption* yyv0 = &yyp0->yyoption; yySemanticOption* yyv1 = &yyp1->yyoption; if (yyv0->yystate != NULL) yyv1->yystate = YYRELOC (yyp0, yyp1, yyv0->yystate, yystate); if (yyv0->yynext != NULL) yyv1->yynext = YYRELOC (yyp0, yyp1, yyv0->yynext, yyoption); } } if (yystackp->yysplitPoint != NULL) yystackp->yysplitPoint = YYRELOC (yystackp->yyitems, yynewItems, yystackp->yysplitPoint, yystate); for (yyn = 0; yyn < yystackp->yytops.yysize; yyn += 1) if (yystackp->yytops.yystates[yyn] != NULL) yystackp->yytops.yystates[yyn] = YYRELOC (yystackp->yyitems, yynewItems, yystackp->yytops.yystates[yyn], yystate); YYFREE (yystackp->yyitems); yystackp->yyitems = yynewItems; yystackp->yynextFree = yynewItems + yysize; yystackp->yyspaceLeft = yynewSize - yysize; } #endif static void yyfreeGLRStack (yyGLRStack* yystackp) { YYFREE (yystackp->yyitems); yyfreeStateSet (&yystackp->yytops); } /** Assuming that S is a GLRState somewhere on STACK, update the * splitpoint of STACK, if needed, so that it is at least as deep as * S. */ static inline void yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys) { if (yystackp->yysplitPoint != NULL && yystackp->yysplitPoint > yys) yystackp->yysplitPoint = yys; } /** Invalidate stack #K in STACK. */ static inline void yymarkStackDeleted (yyGLRStack* yystackp, size_t yyk) { if (yystackp->yytops.yystates[yyk] != NULL) yystackp->yylastDeleted = yystackp->yytops.yystates[yyk]; yystackp->yytops.yystates[yyk] = NULL; } /** Undelete the last stack that was marked as deleted. Can only be done once after a deletion, and only when all other stacks have been deleted. */ static void yyundeleteLastStack (yyGLRStack* yystackp) { if (yystackp->yylastDeleted == NULL || yystackp->yytops.yysize != 0) return; yystackp->yytops.yystates[0] = yystackp->yylastDeleted; yystackp->yytops.yysize = 1; YYDPRINTF ((stderr, "Restoring last deleted stack as stack #0.\n")); yystackp->yylastDeleted = NULL; } static inline void yyremoveDeletes (yyGLRStack* yystackp) { size_t yyi, yyj; yyi = yyj = 0; while (yyj < yystackp->yytops.yysize) { if (yystackp->yytops.yystates[yyi] == NULL) { if (yyi == yyj) { YYDPRINTF ((stderr, "Removing dead stacks.\n")); } yystackp->yytops.yysize -= 1; } else { yystackp->yytops.yystates[yyj] = yystackp->yytops.yystates[yyi]; /* In the current implementation, it's unnecessary to copy yystackp->yytops.yylookaheadNeeds[yyi] since, after yyremoveDeletes returns, the parser immediately either enters deterministic operation or shifts a token. However, it doesn't hurt, and the code might evolve to need it. */ yystackp->yytops.yylookaheadNeeds[yyj] = yystackp->yytops.yylookaheadNeeds[yyi]; if (yyj != yyi) { YYDPRINTF ((stderr, "Rename stack %lu -> %lu.\n", (unsigned long int) yyi, (unsigned long int) yyj)); } yyj += 1; } yyi += 1; } } /** Shift to a new state on stack #K of STACK, corresponding to LR state * LRSTATE, at input position POSN, with (resolved) semantic value SVAL. */ static inline void yyglrShift (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState, size_t yyposn, YYSTYPE* yyvalp, YYLTYPE* yylocp) { yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate; yynewState->yylrState = yylrState; yynewState->yyposn = yyposn; yynewState->yyresolved = yytrue; yynewState->yypred = yystackp->yytops.yystates[yyk]; yynewState->yysemantics.yysval = *yyvalp; yynewState->yyloc = *yylocp; yystackp->yytops.yystates[yyk] = yynewState; YY_RESERVE_GLRSTACK (yystackp); } /** Shift stack #K of YYSTACK, to a new state corresponding to LR * state YYLRSTATE, at input position YYPOSN, with the (unresolved) * semantic value of YYRHS under the action for YYRULE. */ static inline void yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState, size_t yyposn, yyGLRState* rhs, yyRuleNum yyrule) { yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate; yynewState->yylrState = yylrState; yynewState->yyposn = yyposn; yynewState->yyresolved = yyfalse; yynewState->yypred = yystackp->yytops.yystates[yyk]; yynewState->yysemantics.yyfirstVal = NULL; yystackp->yytops.yystates[yyk] = yynewState; /* Invokes YY_RESERVE_GLRSTACK. */ yyaddDeferredAction (yystackp, yyk, yynewState, rhs, yyrule); } /** Pop the symbols consumed by reduction #RULE from the top of stack * #K of STACK, and perform the appropriate semantic action on their * semantic values. Assumes that all ambiguities in semantic values * have been previously resolved. Set *VALP to the resulting value, * and *LOCP to the computed location (if any). Return value is as * for userAction. */ static inline YYRESULTTAG yydoAction (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, YYSTYPE* yyvalp, YYLTYPE* yylocp) { int yynrhs = yyrhsLength (yyrule); if (yystackp->yysplitPoint == NULL) { /* Standard special case: single stack. */ yyGLRStackItem* rhs = (yyGLRStackItem*) yystackp->yytops.yystates[yyk]; YYASSERT (yyk == 0); yystackp->yynextFree -= yynrhs; yystackp->yyspaceLeft += yynrhs; yystackp->yytops.yystates[0] = & yystackp->yynextFree[-1].yystate; return yyuserAction (yyrule, yynrhs, rhs, yyvalp, yylocp, yystackp); } else { /* At present, doAction is never called in nondeterministic * mode, so this branch is never taken. It is here in * anticipation of a future feature that will allow immediate * evaluation of selected actions in nondeterministic mode. */ int yyi; yyGLRState* yys; yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1]; yys = yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred = yystackp->yytops.yystates[yyk]; if (yynrhs == 0) /* Set default location. */ yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yys->yyloc; for (yyi = 0; yyi < yynrhs; yyi += 1) { yys = yys->yypred; YYASSERT (yys); } yyupdateSplit (yystackp, yys); yystackp->yytops.yystates[yyk] = yys; return yyuserAction (yyrule, yynrhs, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, yyvalp, yylocp, yystackp); } } #if !YYDEBUG # define YY_REDUCE_PRINT(Args) #else # define YY_REDUCE_PRINT(Args) \ do { \ if (yydebug) \ yy_reduce_print Args; \ } while (YYID (0)) /*----------------------------------------------------------. | Report that the RULE is going to be reduced on stack #K. | `----------------------------------------------------------*/ /*ARGSUSED*/ static inline void yy_reduce_print (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, YYSTYPE* yyvalp, YYLTYPE* yylocp) { int yynrhs = yyrhsLength (yyrule); yybool yynormal __attribute__ ((__unused__)) = (yystackp->yysplitPoint == NULL); yyGLRStackItem* yyvsp = (yyGLRStackItem*) yystackp->yytops.yystates[yyk]; int yylow = 1; int yyi; YYUSE (yyvalp); YYUSE (yylocp); YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu):\n", (unsigned long int) yyk, yyrule - 1, (unsigned long int) yyrline[yyrule]); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(((yyGLRStackItem const *)yyvsp)[YYFILL ((yyi + 1) - (yynrhs))].yystate.yysemantics.yysval) , &(((yyGLRStackItem const *)yyvsp)[YYFILL ((yyi + 1) - (yynrhs))].yystate.yyloc) ); YYFPRINTF (stderr, "\n"); } } #endif /** Pop items off stack #K of STACK according to grammar rule RULE, * and push back on the resulting nonterminal symbol. Perform the * semantic action associated with RULE and store its value with the * newly pushed state, if FORCEEVAL or if STACK is currently * unambiguous. Otherwise, store the deferred semantic action with * the new state. If the new state would have an identical input * position, LR state, and predecessor to an existing state on the stack, * it is identified with that existing state, eliminating stack #K from * the STACK. In this case, the (necessarily deferred) semantic value is * added to the options for the existing state's semantic value. */ static inline YYRESULTTAG yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, yybool yyforceEval) { size_t yyposn = yystackp->yytops.yystates[yyk]->yyposn; if (yyforceEval || yystackp->yysplitPoint == NULL) { YYSTYPE yysval; YYLTYPE yyloc; YY_REDUCE_PRINT ((yystackp, yyk, yyrule, &yysval, &yyloc)); YYCHK (yydoAction (yystackp, yyk, yyrule, &yysval, &yyloc)); YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyrule], &yysval, &yyloc); yyglrShift (yystackp, yyk, yyLRgotoState (yystackp->yytops.yystates[yyk]->yylrState, yylhsNonterm (yyrule)), yyposn, &yysval, &yyloc); } else { size_t yyi; int yyn; yyGLRState* yys, *yys0 = yystackp->yytops.yystates[yyk]; yyStateNum yynewLRState; for (yys = yystackp->yytops.yystates[yyk], yyn = yyrhsLength (yyrule); 0 < yyn; yyn -= 1) { yys = yys->yypred; YYASSERT (yys); } yyupdateSplit (yystackp, yys); yynewLRState = yyLRgotoState (yys->yylrState, yylhsNonterm (yyrule)); YYDPRINTF ((stderr, "Reduced stack %lu by rule #%d; action deferred. Now in state %d.\n", (unsigned long int) yyk, yyrule - 1, yynewLRState)); for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1) if (yyi != yyk && yystackp->yytops.yystates[yyi] != NULL) { yyGLRState* yyp, *yysplit = yystackp->yysplitPoint; yyp = yystackp->yytops.yystates[yyi]; while (yyp != yys && yyp != yysplit && yyp->yyposn >= yyposn) { if (yyp->yylrState == yynewLRState && yyp->yypred == yys) { yyaddDeferredAction (yystackp, yyk, yyp, yys0, yyrule); yymarkStackDeleted (yystackp, yyk); YYDPRINTF ((stderr, "Merging stack %lu into stack %lu.\n", (unsigned long int) yyk, (unsigned long int) yyi)); return yyok; } yyp = yyp->yypred; } } yystackp->yytops.yystates[yyk] = yys; yyglrShiftDefer (yystackp, yyk, yynewLRState, yyposn, yys0, yyrule); } return yyok; } static size_t yysplitStack (yyGLRStack* yystackp, size_t yyk) { if (yystackp->yysplitPoint == NULL) { YYASSERT (yyk == 0); yystackp->yysplitPoint = yystackp->yytops.yystates[yyk]; } if (yystackp->yytops.yysize >= yystackp->yytops.yycapacity) { yyGLRState** yynewStates; yybool* yynewLookaheadNeeds; yynewStates = NULL; if (yystackp->yytops.yycapacity > (YYSIZEMAX / (2 * sizeof yynewStates[0]))) yyMemoryExhausted (yystackp); yystackp->yytops.yycapacity *= 2; yynewStates = (yyGLRState**) YYREALLOC (yystackp->yytops.yystates, (yystackp->yytops.yycapacity * sizeof yynewStates[0])); if (yynewStates == NULL) yyMemoryExhausted (yystackp); yystackp->yytops.yystates = yynewStates; yynewLookaheadNeeds = (yybool*) YYREALLOC (yystackp->yytops.yylookaheadNeeds, (yystackp->yytops.yycapacity * sizeof yynewLookaheadNeeds[0])); if (yynewLookaheadNeeds == NULL) yyMemoryExhausted (yystackp); yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds; } yystackp->yytops.yystates[yystackp->yytops.yysize] = yystackp->yytops.yystates[yyk]; yystackp->yytops.yylookaheadNeeds[yystackp->yytops.yysize] = yystackp->yytops.yylookaheadNeeds[yyk]; yystackp->yytops.yysize += 1; return yystackp->yytops.yysize-1; } /** True iff Y0 and Y1 represent identical options at the top level. * That is, they represent the same rule applied to RHS symbols * that produce the same terminal symbols. */ static yybool yyidenticalOptions (yySemanticOption* yyy0, yySemanticOption* yyy1) { if (yyy0->yyrule == yyy1->yyrule) { yyGLRState *yys0, *yys1; int yyn; for (yys0 = yyy0->yystate, yys1 = yyy1->yystate, yyn = yyrhsLength (yyy0->yyrule); yyn > 0; yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1) if (yys0->yyposn != yys1->yyposn) return yyfalse; return yytrue; } else return yyfalse; } /** Assuming identicalOptions (Y0,Y1), destructively merge the * alternative semantic values for the RHS-symbols of Y1 and Y0. */ static void yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1) { yyGLRState *yys0, *yys1; int yyn; for (yys0 = yyy0->yystate, yys1 = yyy1->yystate, yyn = yyrhsLength (yyy0->yyrule); yyn > 0; yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1) { if (yys0 == yys1) break; else if (yys0->yyresolved) { yys1->yyresolved = yytrue; yys1->yysemantics.yysval = yys0->yysemantics.yysval; } else if (yys1->yyresolved) { yys0->yyresolved = yytrue; yys0->yysemantics.yysval = yys1->yysemantics.yysval; } else { yySemanticOption** yyz0p; yySemanticOption* yyz1; yyz0p = &yys0->yysemantics.yyfirstVal; yyz1 = yys1->yysemantics.yyfirstVal; while (YYID (yytrue)) { if (yyz1 == *yyz0p || yyz1 == NULL) break; else if (*yyz0p == NULL) { *yyz0p = yyz1; break; } else if (*yyz0p < yyz1) { yySemanticOption* yyz = *yyz0p; *yyz0p = yyz1; yyz1 = yyz1->yynext; (*yyz0p)->yynext = yyz; } yyz0p = &(*yyz0p)->yynext; } yys1->yysemantics.yyfirstVal = yys0->yysemantics.yyfirstVal; } } } /** Y0 and Y1 represent two possible actions to take in a given * parsing state; return 0 if no combination is possible, * 1 if user-mergeable, 2 if Y0 is preferred, 3 if Y1 is preferred. */ static int yypreference (yySemanticOption* y0, yySemanticOption* y1) { yyRuleNum r0 = y0->yyrule, r1 = y1->yyrule; int p0 = yydprec[r0], p1 = yydprec[r1]; if (p0 == p1) { if (yymerger[r0] == 0 || yymerger[r0] != yymerger[r1]) return 0; else return 1; } if (p0 == 0 || p1 == 0) return 0; if (p0 < p1) return 3; if (p1 < p0) return 2; return 0; } static YYRESULTTAG yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp); /** Resolve the previous N states starting at and including state S. If result * != yyok, some states may have been left unresolved possibly with empty * semantic option chains. Regardless of whether result = yyok, each state * has been left with consistent data so that yydestroyGLRState can be invoked * if necessary. */ static YYRESULTTAG yyresolveStates (yyGLRState* yys, int yyn, yyGLRStack* yystackp) { if (0 < yyn) { YYASSERT (yys->yypred); YYCHK (yyresolveStates (yys->yypred, yyn-1, yystackp)); if (! yys->yyresolved) YYCHK (yyresolveValue (yys, yystackp)); } return yyok; } /** Resolve the states for the RHS of OPT, perform its user action, and return * the semantic value and location. Regardless of whether result = yyok, all * RHS states have been destroyed (assuming the user action destroys all RHS * semantic values if invoked). */ static YYRESULTTAG yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystackp, YYSTYPE* yyvalp, YYLTYPE* yylocp) { yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1]; int yynrhs; int yychar_current; YYSTYPE yylval_current; YYLTYPE yylloc_current; YYRESULTTAG yyflag; yynrhs = yyrhsLength (yyopt->yyrule); yyflag = yyresolveStates (yyopt->yystate, yynrhs, yystackp); if (yyflag != yyok) { yyGLRState *yys; for (yys = yyopt->yystate; yynrhs > 0; yys = yys->yypred, yynrhs -= 1) yydestroyGLRState ("Cleanup: popping", yys); return yyflag; } yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred = yyopt->yystate; if (yynrhs == 0) /* Set default location. */ yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yyopt->yystate->yyloc; yychar_current = yychar; yylval_current = yylval; yylloc_current = yylloc; yychar = yyopt->yyrawchar; yylval = yyopt->yyval; yylloc = yyopt->yyloc; yyflag = yyuserAction (yyopt->yyrule, yynrhs, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, yyvalp, yylocp, yystackp); yychar = yychar_current; yylval = yylval_current; yylloc = yylloc_current; return yyflag; } #if YYDEBUG static void yyreportTree (yySemanticOption* yyx, int yyindent) { int yynrhs = yyrhsLength (yyx->yyrule); int yyi; yyGLRState* yys; yyGLRState* yystates[1 + YYMAXRHS]; yyGLRState yyleftmost_state; for (yyi = yynrhs, yys = yyx->yystate; 0 < yyi; yyi -= 1, yys = yys->yypred) yystates[yyi] = yys; if (yys == NULL) { yyleftmost_state.yyposn = 0; yystates[0] = &yyleftmost_state; } else yystates[0] = yys; if (yyx->yystate->yyposn < yys->yyposn + 1) YYFPRINTF (stderr, "%*s%s -> \n", yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)), yyx->yyrule - 1); else YYFPRINTF (stderr, "%*s%s -> \n", yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)), yyx->yyrule - 1, (unsigned long int) (yys->yyposn + 1), (unsigned long int) yyx->yystate->yyposn); for (yyi = 1; yyi <= yynrhs; yyi += 1) { if (yystates[yyi]->yyresolved) { if (yystates[yyi-1]->yyposn+1 > yystates[yyi]->yyposn) YYFPRINTF (stderr, "%*s%s \n", yyindent+2, "", yytokenName (yyrhs[yyprhs[yyx->yyrule]+yyi-1])); else YYFPRINTF (stderr, "%*s%s \n", yyindent+2, "", yytokenName (yyrhs[yyprhs[yyx->yyrule]+yyi-1]), (unsigned long int) (yystates[yyi - 1]->yyposn + 1), (unsigned long int) yystates[yyi]->yyposn); } else yyreportTree (yystates[yyi]->yysemantics.yyfirstVal, yyindent+2); } } #endif /*ARGSUSED*/ static YYRESULTTAG yyreportAmbiguity (yySemanticOption* yyx0, yySemanticOption* yyx1, YYLTYPE *yylocp) { YYUSE (yyx0); YYUSE (yyx1); #if YYDEBUG YYFPRINTF (stderr, "Ambiguity detected.\n"); YYFPRINTF (stderr, "Option 1,\n"); yyreportTree (yyx0, 2); YYFPRINTF (stderr, "\nOption 2,\n"); yyreportTree (yyx1, 2); YYFPRINTF (stderr, "\n"); #endif yyerror (yylocp, YY_("syntax is ambiguous")); return yyabort; } /** Starting at and including state S1, resolve the location for each of the * previous N1 states that is unresolved. The first semantic option of a state * is always chosen. */ static void yyresolveLocations (yyGLRState* yys1, int yyn1, yyGLRStack *yystackp) { if (0 < yyn1) { yyresolveLocations (yys1->yypred, yyn1 - 1, yystackp); if (!yys1->yyresolved) { yySemanticOption *yyoption; yyGLRStackItem yyrhsloc[1 + YYMAXRHS]; int yynrhs; int yychar_current; YYSTYPE yylval_current; YYLTYPE yylloc_current; yyoption = yys1->yysemantics.yyfirstVal; YYASSERT (yyoption != NULL); yynrhs = yyrhsLength (yyoption->yyrule); if (yynrhs > 0) { yyGLRState *yys; int yyn; yyresolveLocations (yyoption->yystate, yynrhs, yystackp); for (yys = yyoption->yystate, yyn = yynrhs; yyn > 0; yys = yys->yypred, yyn -= 1) yyrhsloc[yyn].yystate.yyloc = yys->yyloc; } else { /* Both yyresolveAction and yyresolveLocations traverse the GSS in reverse rightmost order. It is only necessary to invoke yyresolveLocations on a subforest for which yyresolveAction would have been invoked next had an ambiguity not been detected. Thus the location of the previous state (but not necessarily the previous state itself) is guaranteed to be resolved already. */ yyGLRState *yyprevious = yyoption->yystate; yyrhsloc[0].yystate.yyloc = yyprevious->yyloc; } yychar_current = yychar; yylval_current = yylval; yylloc_current = yylloc; yychar = yyoption->yyrawchar; yylval = yyoption->yyval; yylloc = yyoption->yyloc; YYLLOC_DEFAULT ((yys1->yyloc), yyrhsloc, yynrhs); yychar = yychar_current; yylval = yylval_current; yylloc = yylloc_current; } } } /** Resolve the ambiguity represented in state S, perform the indicated * actions, and set the semantic value of S. If result != yyok, the chain of * semantic options in S has been cleared instead or it has been left * unmodified except that redundant options may have been removed. Regardless * of whether result = yyok, S has been left with consistent data so that * yydestroyGLRState can be invoked if necessary. */ static YYRESULTTAG yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp) { yySemanticOption* yyoptionList = yys->yysemantics.yyfirstVal; yySemanticOption* yybest; yySemanticOption** yypp; yybool yymerge; YYSTYPE yysval; YYRESULTTAG yyflag; YYLTYPE *yylocp = &yys->yyloc; yybest = yyoptionList; yymerge = yyfalse; for (yypp = &yyoptionList->yynext; *yypp != NULL; ) { yySemanticOption* yyp = *yypp; if (yyidenticalOptions (yybest, yyp)) { yymergeOptionSets (yybest, yyp); *yypp = yyp->yynext; } else { switch (yypreference (yybest, yyp)) { case 0: yyresolveLocations (yys, 1, yystackp); return yyreportAmbiguity (yybest, yyp, yylocp); break; case 1: yymerge = yytrue; break; case 2: break; case 3: yybest = yyp; yymerge = yyfalse; break; default: /* This cannot happen so it is not worth a YYASSERT (yyfalse), but some compilers complain if the default case is omitted. */ break; } yypp = &yyp->yynext; } } if (yymerge) { yySemanticOption* yyp; int yyprec = yydprec[yybest->yyrule]; yyflag = yyresolveAction (yybest, yystackp, &yysval, yylocp); if (yyflag == yyok) for (yyp = yybest->yynext; yyp != NULL; yyp = yyp->yynext) { if (yyprec == yydprec[yyp->yyrule]) { YYSTYPE yysval_other; YYLTYPE yydummy; yyflag = yyresolveAction (yyp, yystackp, &yysval_other, &yydummy); if (yyflag != yyok) { yydestruct ("Cleanup: discarding incompletely merged value for", yystos[yys->yylrState], &yysval, yylocp); break; } yyuserMerge (yymerger[yyp->yyrule], &yysval, &yysval_other); } } } else yyflag = yyresolveAction (yybest, yystackp, &yysval, yylocp); if (yyflag == yyok) { yys->yyresolved = yytrue; yys->yysemantics.yysval = yysval; } else yys->yysemantics.yyfirstVal = NULL; return yyflag; } static YYRESULTTAG yyresolveStack (yyGLRStack* yystackp) { if (yystackp->yysplitPoint != NULL) { yyGLRState* yys; int yyn; for (yyn = 0, yys = yystackp->yytops.yystates[0]; yys != yystackp->yysplitPoint; yys = yys->yypred, yyn += 1) continue; YYCHK (yyresolveStates (yystackp->yytops.yystates[0], yyn, yystackp )); } return yyok; } static void yycompressStack (yyGLRStack* yystackp) { yyGLRState* yyp, *yyq, *yyr; if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == NULL) return; for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = NULL; yyp != yystackp->yysplitPoint; yyr = yyp, yyp = yyq, yyq = yyp->yypred) yyp->yypred = yyr; yystackp->yyspaceLeft += yystackp->yynextFree - yystackp->yyitems; yystackp->yynextFree = ((yyGLRStackItem*) yystackp->yysplitPoint) + 1; yystackp->yyspaceLeft -= yystackp->yynextFree - yystackp->yyitems; yystackp->yysplitPoint = NULL; yystackp->yylastDeleted = NULL; while (yyr != NULL) { yystackp->yynextFree->yystate = *yyr; yyr = yyr->yypred; yystackp->yynextFree->yystate.yypred = &yystackp->yynextFree[-1].yystate; yystackp->yytops.yystates[0] = &yystackp->yynextFree->yystate; yystackp->yynextFree += 1; yystackp->yyspaceLeft -= 1; } } static YYRESULTTAG yyprocessOneStack (yyGLRStack* yystackp, size_t yyk, size_t yyposn, YYLTYPE *yylocp) { int yyaction; const short int* yyconflicts; yyRuleNum yyrule; while (yystackp->yytops.yystates[yyk] != NULL) { yyStateNum yystate = yystackp->yytops.yystates[yyk]->yylrState; YYDPRINTF ((stderr, "Stack %lu Entering state %d\n", (unsigned long int) yyk, yystate)); YYASSERT (yystate != YYFINAL); if (yyisDefaultedState (yystate)) { yyrule = yydefaultAction (yystate); if (yyrule == 0) { YYDPRINTF ((stderr, "Stack %lu dies.\n", (unsigned long int) yyk)); yymarkStackDeleted (yystackp, yyk); return yyok; } YYCHK (yyglrReduce (yystackp, yyk, yyrule, yyfalse)); } else { yySymbol yytoken; yystackp->yytops.yylookaheadNeeds[yyk] = yytrue; if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } yygetLRActions (yystate, yytoken, &yyaction, &yyconflicts); while (*yyconflicts != 0) { size_t yynewStack = yysplitStack (yystackp, yyk); YYDPRINTF ((stderr, "Splitting off stack %lu from %lu.\n", (unsigned long int) yynewStack, (unsigned long int) yyk)); YYCHK (yyglrReduce (yystackp, yynewStack, *yyconflicts, yyfalse)); YYCHK (yyprocessOneStack (yystackp, yynewStack, yyposn, yylocp)); yyconflicts += 1; } if (yyisShiftAction (yyaction)) break; else if (yyisErrorAction (yyaction)) { YYDPRINTF ((stderr, "Stack %lu dies.\n", (unsigned long int) yyk)); yymarkStackDeleted (yystackp, yyk); break; } else YYCHK (yyglrReduce (yystackp, yyk, -yyaction, yyfalse)); } } return yyok; } /*ARGSUSED*/ static void yyreportSyntaxError (yyGLRStack* yystackp) { if (yystackp->yyerrState != 0) return; #if ! YYERROR_VERBOSE yyerror (&yylloc, YY_("syntax error")); #else yySymbol yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); size_t yysize0 = yytnamerr (NULL, yytokenName (yytoken)); size_t yysize = yysize0; size_t yysize1; yybool yysize_overflow = yyfalse; char* yymsg = NULL; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = 0; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per "expected"). */ int yycount = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yytoken != YYEMPTY) { int yyn = yypact[yystackp->yytops.yystates[0]->yylrState]; yyarg[yycount++] = yytokenName (yytoken); if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; break; } yyarg[yycount++] = yytokenName (yyx); yysize1 = yysize + yytnamerr (NULL, yytokenName (yyx)); yysize_overflow |= yysize1 < yysize; yysize = yysize1; } } } switch (yycount) { #define YYCASE_(N, S) \ case N: \ yyformat = S; \ break YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); #undef YYCASE_ } yysize1 = yysize + strlen (yyformat); yysize_overflow |= yysize1 < yysize; yysize = yysize1; if (!yysize_overflow) yymsg = (char *) YYMALLOC (yysize); if (yymsg) { char *yyp = yymsg; int yyi = 0; while ((*yyp = *yyformat)) { if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyformat += 2; } else { yyp++; yyformat++; } } yyerror (&yylloc, yymsg); YYFREE (yymsg); } else { yyerror (&yylloc, YY_("syntax error")); yyMemoryExhausted (yystackp); } #endif /* YYERROR_VERBOSE */ yynerrs += 1; } /* Recover from a syntax error on *YYSTACKP, assuming that *YYSTACKP->YYTOKENP, yylval, and yylloc are the syntactic category, semantic value, and location of the lookahead. */ /*ARGSUSED*/ static void yyrecoverSyntaxError (yyGLRStack* yystackp) { size_t yyk; int yyj; if (yystackp->yyerrState == 3) /* We just shifted the error token and (perhaps) took some reductions. Skip tokens until we can proceed. */ while (YYID (yytrue)) { yySymbol yytoken; if (yychar == YYEOF) yyFail (yystackp, &yylloc, NULL); if (yychar != YYEMPTY) { /* We throw away the lookahead, but the error range of the shifted error token must take it into account. */ yyGLRState *yys = yystackp->yytops.yystates[0]; yyGLRStackItem yyerror_range[3]; yyerror_range[1].yystate.yyloc = yys->yyloc; yyerror_range[2].yystate.yyloc = yylloc; YYLLOC_DEFAULT ((yys->yyloc), yyerror_range, 2); yytoken = YYTRANSLATE (yychar); yydestruct ("Error: discarding", yytoken, &yylval, &yylloc); } YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } yyj = yypact[yystackp->yytops.yystates[0]->yylrState]; if (yypact_value_is_default (yyj)) return; yyj += yytoken; if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != yytoken) { if (yydefact[yystackp->yytops.yystates[0]->yylrState] != 0) return; } else if (! yytable_value_is_error (yytable[yyj])) return; } /* Reduce to one stack. */ for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1) if (yystackp->yytops.yystates[yyk] != NULL) break; if (yyk >= yystackp->yytops.yysize) yyFail (yystackp, &yylloc, NULL); for (yyk += 1; yyk < yystackp->yytops.yysize; yyk += 1) yymarkStackDeleted (yystackp, yyk); yyremoveDeletes (yystackp); yycompressStack (yystackp); /* Now pop stack until we find a state that shifts the error token. */ yystackp->yyerrState = 3; while (yystackp->yytops.yystates[0] != NULL) { yyGLRState *yys = yystackp->yytops.yystates[0]; yyj = yypact[yys->yylrState]; if (! yypact_value_is_default (yyj)) { yyj += YYTERROR; if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR && yyisShiftAction (yytable[yyj])) { /* Shift the error token having adjusted its location. */ YYLTYPE yyerrloc; yystackp->yyerror_range[2].yystate.yyloc = yylloc; YYLLOC_DEFAULT (yyerrloc, (yystackp->yyerror_range), 2); YY_SYMBOL_PRINT ("Shifting", yystos[yytable[yyj]], &yylval, &yyerrloc); yyglrShift (yystackp, 0, yytable[yyj], yys->yyposn, &yylval, &yyerrloc); yys = yystackp->yytops.yystates[0]; break; } } yystackp->yyerror_range[1].yystate.yyloc = yys->yyloc; if (yys->yypred != NULL) yydestroyGLRState ("Error: popping", yys); yystackp->yytops.yystates[0] = yys->yypred; yystackp->yynextFree -= 1; yystackp->yyspaceLeft += 1; } if (yystackp->yytops.yystates[0] == NULL) yyFail (yystackp, &yylloc, NULL); } #define YYCHK1(YYE) \ do { \ switch (YYE) { \ case yyok: \ break; \ case yyabort: \ goto yyabortlab; \ case yyaccept: \ goto yyacceptlab; \ case yyerr: \ goto yyuser_error; \ default: \ goto yybuglab; \ } \ } while (YYID (0)) /*----------. | yyparse. | `----------*/ int yyparse (void) { int yyresult; yyGLRStack yystack; yyGLRStack* const yystackp = &yystack; size_t yyposn; YYDPRINTF ((stderr, "Starting parse\n")); yychar = YYEMPTY; yylval = yyval_default; #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL yylloc.first_line = yylloc.last_line = 1; yylloc.first_column = yylloc.last_column = 1; #endif if (! yyinitGLRStack (yystackp, YYINITDEPTH)) goto yyexhaustedlab; switch (YYSETJMP (yystack.yyexception_buffer)) { case 0: break; case 1: goto yyabortlab; case 2: goto yyexhaustedlab; default: goto yybuglab; } yyglrShift (&yystack, 0, 0, 0, &yylval, &yylloc); yyposn = 0; while (YYID (yytrue)) { /* For efficiency, we have two loops, the first of which is specialized to deterministic operation (single stack, no potential ambiguity). */ /* Standard mode */ while (YYID (yytrue)) { yyRuleNum yyrule; int yyaction; const short int* yyconflicts; yyStateNum yystate = yystack.yytops.yystates[0]->yylrState; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) goto yyacceptlab; if (yyisDefaultedState (yystate)) { yyrule = yydefaultAction (yystate); if (yyrule == 0) { yystack.yyerror_range[1].yystate.yyloc = yylloc; yyreportSyntaxError (&yystack); goto yyuser_error; } YYCHK1 (yyglrReduce (&yystack, 0, yyrule, yytrue)); } else { yySymbol yytoken; if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } yygetLRActions (yystate, yytoken, &yyaction, &yyconflicts); if (*yyconflicts != 0) break; if (yyisShiftAction (yyaction)) { YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); yychar = YYEMPTY; yyposn += 1; yyglrShift (&yystack, 0, yyaction, yyposn, &yylval, &yylloc); if (0 < yystack.yyerrState) yystack.yyerrState -= 1; } else if (yyisErrorAction (yyaction)) { yystack.yyerror_range[1].yystate.yyloc = yylloc; yyreportSyntaxError (&yystack); goto yyuser_error; } else YYCHK1 (yyglrReduce (&yystack, 0, -yyaction, yytrue)); } } while (YYID (yytrue)) { yySymbol yytoken_to_shift; size_t yys; for (yys = 0; yys < yystack.yytops.yysize; yys += 1) yystackp->yytops.yylookaheadNeeds[yys] = yychar != YYEMPTY; /* yyprocessOneStack returns one of three things: - An error flag. If the caller is yyprocessOneStack, it immediately returns as well. When the caller is finally yyparse, it jumps to an error label via YYCHK1. - yyok, but yyprocessOneStack has invoked yymarkStackDeleted (&yystack, yys), which sets the top state of yys to NULL. Thus, yyparse's following invocation of yyremoveDeletes will remove the stack. - yyok, when ready to shift a token. Except in the first case, yyparse will invoke yyremoveDeletes and then shift the next token onto all remaining stacks. This synchronization of the shift (that is, after all preceding reductions on all stacks) helps prevent double destructor calls on yylval in the event of memory exhaustion. */ for (yys = 0; yys < yystack.yytops.yysize; yys += 1) YYCHK1 (yyprocessOneStack (&yystack, yys, yyposn, &yylloc)); yyremoveDeletes (&yystack); if (yystack.yytops.yysize == 0) { yyundeleteLastStack (&yystack); if (yystack.yytops.yysize == 0) yyFail (&yystack, &yylloc, YY_("syntax error")); YYCHK1 (yyresolveStack (&yystack)); YYDPRINTF ((stderr, "Returning to deterministic operation.\n")); yystack.yyerror_range[1].yystate.yyloc = yylloc; yyreportSyntaxError (&yystack); goto yyuser_error; } /* If any yyglrShift call fails, it will fail after shifting. Thus, a copy of yylval will already be on stack 0 in the event of a failure in the following loop. Thus, yychar is set to YYEMPTY before the loop to make sure the user destructor for yylval isn't called twice. */ yytoken_to_shift = YYTRANSLATE (yychar); yychar = YYEMPTY; yyposn += 1; for (yys = 0; yys < yystack.yytops.yysize; yys += 1) { int yyaction; const short int* yyconflicts; yyStateNum yystate = yystack.yytops.yystates[yys]->yylrState; yygetLRActions (yystate, yytoken_to_shift, &yyaction, &yyconflicts); /* Note that yyconflicts were handled by yyprocessOneStack. */ YYDPRINTF ((stderr, "On stack %lu, ", (unsigned long int) yys)); YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc); yyglrShift (&yystack, yys, yyaction, yyposn, &yylval, &yylloc); YYDPRINTF ((stderr, "Stack %lu now in state #%d\n", (unsigned long int) yys, yystack.yytops.yystates[yys]->yylrState)); } if (yystack.yytops.yysize == 1) { YYCHK1 (yyresolveStack (&yystack)); YYDPRINTF ((stderr, "Returning to deterministic operation.\n")); yycompressStack (&yystack); break; } } continue; yyuser_error: yyrecoverSyntaxError (&yystack); yyposn = yystack.yytops.yystates[0]->yyposn; } yyacceptlab: yyresult = 0; goto yyreturn; yybuglab: YYASSERT (yyfalse); goto yyabortlab; yyabortlab: yyresult = 1; goto yyreturn; yyexhaustedlab: yyerror (&yylloc, YY_("memory exhausted")); yyresult = 2; goto yyreturn; yyreturn: if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", YYTRANSLATE (yychar), &yylval, &yylloc); /* If the stack is well-formed, pop the stack until it is empty, destroying its entries as we go. But free the stack regardless of whether it is well-formed. */ if (yystack.yyitems) { yyGLRState** yystates = yystack.yytops.yystates; if (yystates) { size_t yysize = yystack.yytops.yysize; size_t yyk; for (yyk = 0; yyk < yysize; yyk += 1) if (yystates[yyk]) { while (yystates[yyk]) { yyGLRState *yys = yystates[yyk]; yystack.yyerror_range[1].yystate.yyloc = yys->yyloc; if (yys->yypred != NULL) yydestroyGLRState ("Cleanup: popping", yys); yystates[yyk] = yys->yypred; yystack.yynextFree -= 1; yystack.yyspaceLeft += 1; } break; } } yyfreeGLRStack (&yystack); } /* Make sure YYID is used. */ return YYID (yyresult); } /* DEBUGGING ONLY */ #if YYDEBUG static void yypstack (yyGLRStack* yystackp, size_t yyk) __attribute__ ((__unused__)); static void yypdumpstack (yyGLRStack* yystackp) __attribute__ ((__unused__)); static void yy_yypstack (yyGLRState* yys) { if (yys->yypred) { yy_yypstack (yys->yypred); YYFPRINTF (stderr, " -> "); } YYFPRINTF (stderr, "%d@%lu", yys->yylrState, (unsigned long int) yys->yyposn); } static void yypstates (yyGLRState* yyst) { if (yyst == NULL) YYFPRINTF (stderr, ""); else yy_yypstack (yyst); YYFPRINTF (stderr, "\n"); } static void yypstack (yyGLRStack* yystackp, size_t yyk) { yypstates (yystackp->yytops.yystates[yyk]); } #define YYINDEX(YYX) \ ((YYX) == NULL ? -1 : (yyGLRStackItem*) (YYX) - yystackp->yyitems) static void yypdumpstack (yyGLRStack* yystackp) { yyGLRStackItem* yyp; size_t yyi; for (yyp = yystackp->yyitems; yyp < yystackp->yynextFree; yyp += 1) { YYFPRINTF (stderr, "%3lu. ", (unsigned long int) (yyp - yystackp->yyitems)); if (*(yybool *) yyp) { YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld", yyp->yystate.yyresolved, yyp->yystate.yylrState, (unsigned long int) yyp->yystate.yyposn, (long int) YYINDEX (yyp->yystate.yypred)); if (! yyp->yystate.yyresolved) YYFPRINTF (stderr, ", firstVal: %ld", (long int) YYINDEX (yyp->yystate .yysemantics.yyfirstVal)); } else { YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld", yyp->yyoption.yyrule - 1, (long int) YYINDEX (yyp->yyoption.yystate), (long int) YYINDEX (yyp->yyoption.yynext)); } YYFPRINTF (stderr, "\n"); } YYFPRINTF (stderr, "Tops:"); for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1) YYFPRINTF (stderr, "%lu: %ld; ", (unsigned long int) yyi, (long int) YYINDEX (yystackp->yytops.yystates[yyi])); YYFPRINTF (stderr, "\n"); } #endif /* Line 2659 of glr.c */ #line 152 "tvk-parse.ypp" void yyerror(YYLTYPE* loc, const char* msg) { std::cerr << "error: " << msg << " at: " << loc->first_column << ":" << loc->last_column << "\n"; /* should throw... */ } ImageVis3D-3.1.0/Tuvok/IO/expressions/treenode.h0000644000175000017500000001041612320456500021236 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /// \brief Base class for a node in an AST. #ifndef TUVOK_TREENODE_H #define TUVOK_TREENODE_H #include #include #include #include #include #include "semantic.h" #include "IO/VariantArray.h" namespace tuvok { namespace expression { class Node { public: virtual ~Node(); void AddChild(Node*); /// For iteration over all children in the tree. Order is /// "leftmost" to "rightmost". ///@{ typedef std::vector>::const_iterator citer; citer begin() const; citer end() const; ///@} /// Performs semantic analysis on the expression AST. virtual void Analyze() const throw(semantic::Error)=0; /// Print out the name of the node type. virtual void Print(std::ostream&) const; /// Gives the input volume to the tree; needed so that e.g. 'v[i]' /// can be pulled from somewhere. virtual void SetVolumes(const std::vector&); virtual double Evaluate(size_t idx) const=0; protected: const std::shared_ptr GetChild(size_t index) const; private: std::vector> children; }; namespace { template void NullDeleter(T*) {} } /// Evaluates the expression. /// @param tree: the AST for the expression /// @param volumes: input volumes /// @param output: the output volume. template void evaluate(Node& tree, std::vector>& volumes, std::vector& output) { // First make sure the volumes make sense. assert(!volumes.empty()); const size_t rootsize = volumes[0].size(); for(size_t i=0; i < volumes.size(); ++i) { // hack, this should throw something instead. assert(volumes[i].size() == rootsize); } // create vec of VariantArrays to set for the tree's volumes. std::vector vols(volumes.size()); for(size_t i=0; i < volumes.size(); ++i) { vols[i].set(std::shared_ptr(&(volumes[i].at(0)), NullDeleter), volumes[i].size()); } tree.SetVolumes(vols); output.resize(rootsize); typedef typename std::vector::iterator oiter; for(oiter o = output.begin(); o != output.end(); ++o) { // iter through each, create expression, eval. // This cast isn't strictly valid. True, we calculated the width of T // before calling this, but we based that purely on the types: a // combination of three uint16_t volumes will give a uint16_t volume, even // though it might need a uint32_t volume to represent that data. A // division would mean we'd probably want to output a floating point // volume, too. // Anyway, we'll want this cast to shut the compiler up even after we fix // type calculation (see IdentifyType). *o = static_cast(tree.Evaluate(std::distance(output.begin(), o))); } } enum OpType { OP_PLUS, OP_MINUS, OP_DIVIDE, OP_MULTIPLY, OP_GREATER_THAN, OP_LESS_THAN, OP_EQUAL_TO }; enum NodeType { EXPR_VOLUME, EXPR_CONSTANT, EXPR_BINARY, EXPR_CONDITIONAL }; Node* make_node(NodeType, ...); }} #endif // TUVOK_TREENODE_H ImageVis3D-3.1.0/Tuvok/IO/expressions/conditional-expression.cpp0000644000175000017500000000371612320456500024471 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "conditional-expression.h" namespace tuvok { namespace expression { void ConditionalExpression::Analyze() const throw(semantic::Error) { } void ConditionalExpression::Print(std::ostream& os) const { os << "ConditionalExpression ("; this->GetChild(0)->Print(os); os << " ? "; this->GetChild(1)->Print(os); os << " : "; this->GetChild(2)->Print(os); os << ")"; } double ConditionalExpression::Evaluate(size_t idx) const { const std::shared_ptr boolean = this->GetChild(0); if(boolean->Evaluate(idx)) { const std::shared_ptr true_path = this->GetChild(1); return true_path->Evaluate(idx); } const std::shared_ptr false_path = this->GetChild(2); return false_path->Evaluate(idx); } }} ImageVis3D-3.1.0/Tuvok/IO/expressions/syntax.h0000644000175000017500000000371712320456500020765 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /// \brief Errors that can happen during syntax analysis #ifndef TUVOK_EXPRESSION_SYNTAX_H #define TUVOK_EXPRESSION_SYNTAX_H #include "TuvokException.h" namespace tuvok { namespace expression { class SyntaxError: virtual public tuvok::Exception { public: explicit SyntaxError(const char* e, size_t col_start, size_t col_end, const char* where, size_t ln=0) : tuvok::Exception(e, where, ln), column_start(col_start), column_end(col_end) {} size_t ColumnStart() const { return this->column_start; } size_t ColumnEnd() const { return this->column_end; } private: const size_t column_start; const size_t column_end; }; }} #endif // TUVOK_EXPRESSION_SYNTAX_H ImageVis3D-3.1.0/Tuvok/IO/expressions/tvk-scan.lpp0000644000175000017500000000673612320456500021535 0ustar mathieumathieu%option case-insensitive %option batch %option 8bit %option nodefault %option never-interactive %option noyywrap %option nounput %option bison-bridge %option bison-locations %option nomain %option nounistd %{ /** Scanner for Tuvok expressions. */ #include #include #include "treenode.h" #include "tvk-parse.parser.hpp" #ifdef DEBUG_LEX //extern "C" int yylex(YYSTYPE*, YYLTYPE*); # define token(x) (DisplayToken(# x), x) YYSTYPE yylval; void DisplayToken(const char* s); #else # define token(x) (x) #endif /* DEBUG_LEX */ static double convert_todbl(const char*); /** Keeps track of the current string index, for error reporting. */ /**@{*/ static void count(YYLTYPE* lloc); static size_t column = 0; /**@}*/ static YY_BUFFER_STATE scanning_buf; void parser_set_string(const char*); %} d ([0-9]) integer ({d}+) dbl ({integer}?"."{integer}+([Ee]{integer})?) volume (v) %% {integer} { count(yylloc); yylval->y_dbl = convert_todbl(yytext); return token(DOUBLE); } {dbl} { count(yylloc); yylval->y_dbl = convert_todbl(yytext); return token(DOUBLE); } {volume} { count(yylloc); yylval->y_dbl = 0.0; // nullify it. return token(VOLUME); } [\[] { count(yylloc); yylval->y_dbl = 0.0; // nullify it. return token(OPEN_BRACKET); } [\]] { count(yylloc); yylval->y_dbl = 0.0; // nullify it. return token(CLOSE_BRACKET); } [+] { count(yylloc); yylval->y_dbl = 0.0; return token(PLUS); } [-] { count(yylloc); yylval->y_dbl = 0.0; return token(MINUS); } [/] { count(yylloc); yylval->y_dbl = 0.0; return token(DIVIDE); } [\*] { count(yylloc); yylval->y_dbl = 0.0; return token(MULTIPLY); } [>] { count(yylloc); yylval->y_dbl = 0.0; return token(GREATER_THAN); } [<] { count(yylloc); yylval->y_dbl = 0.0; return token(LESS_THAN); } [=] { count(yylloc); yylval->y_dbl = 0.0; return token(EQUAL_TO); } [(] { count(yylloc); yylval->y_dbl = 0.0; return token(OPEN_PAREN); } [)] { count(yylloc); yylval->y_dbl = 0.0; return token(CLOSE_PAREN); } [\?] { count(yylloc); yylval->y_dbl = 0.0; return token(QUESTION_MARK); } [:] { count(yylloc); yylval->y_dbl = 0.0; return token(COLON); } [ \t\v\f\n] { count(yylloc); } . { count(yylloc); return token(BAD); } %% /** keeps track of the # of lines/columns in a couple global variables, * for the purpose of reporting errors. * @todo FIXME should just remove 'column' and rely on yylloc aka lloc */ static void count(YYLTYPE* lloc) { size_t i; for(i=0; yytext[i] != '\0'; ++i) { if(yytext[i] == '\n') { column = 0; } else if(yytext[i] == '\t') { column += 8; } else { ++column; } } lloc->first_column = column; lloc->first_line = yylineno; } static double convert_todbl(const char *s) { std::istringstream input(s); double d; input >> d; if(!input) { // throw exception... } return d; } #ifdef DEBUG_LEX void DisplayToken(const char *p) { printf("%-10.10s is [%s]\n", p, yytext); } # if 0 // simple main to just open the file given by the only argument && lex it. int main(int argc, char *argv[]) { if(argc != 2) { fprintf(stderr, "%s takes one argument: the file to lex.\n", argv[0]); exit(-1); } fprintf(stderr, "scanning [%s]\n", argv[1]); yyin = fopen(argv[1], "r"); if(yyin == NULL) { perror("fopen"); exit(-2); } while(yylex()) {} fclose(yyin); return 0; } # endif #endif /* DEBUG_LEX */ void parser_set_string(const char* s) { scanning_buf = yy_scan_string(s); } void parser_free_string() { yy_delete_buffer(scanning_buf); } ImageVis3D-3.1.0/Tuvok/IO/expressions/volume.cpp0000644000175000017500000000535312320456500021277 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include "volume.h" #include "semantic.h" namespace tuvok { namespace expression { void Volume::SetIndex(double i) { this->index = i; } size_t Volume::Index() const { assert(this->index >= 0.0); return static_cast(this->index); } void Volume::Analyze() const throw(semantic::Error) { // We don't know how many volumes we have at present. So, for now, just make // sure we've got a nonnegative index. if(index < 0.0) { throw semantic::NegativeIndex("negative volume index encountered.", __FILE__, __LINE__); } } void Volume::Print(std::ostream& os) const { os << "v[" << this->index << "]"; } void Volume::SetVolumes(const std::vector& vols) { this->v = vols; Node::SetVolumes(vols); } double Volume::Evaluate(size_t idx) const { switch(this->v[this->Index()].type()) { case VariantArray::DT_DOUBLE: return *(this->v[this->Index()].getd()+idx); case VariantArray::DT_FLOAT: return static_cast(*(this->v[this->Index()].getf()+idx)); case VariantArray::DT_UBYTE: return static_cast(*(this->v[this->Index()].getub()+idx)); case VariantArray::DT_BYTE: return static_cast(*(this->v[this->Index()].getb()+idx)); case VariantArray::DT_SHORT: return static_cast(*(this->v[this->Index()].gets()+idx)); case VariantArray::DT_USHORT: return static_cast(*(this->v[this->Index()].getus()+idx)); } assert(1==0); return 0.0; } }} ImageVis3D-3.1.0/Tuvok/IO/expressions/test.cpp0000644000175000017500000000326312320456500020745 0ustar mathieumathieu// Small/hacky test program for expressions. #include #include #include "parser.h" #include "treenode.h" using namespace tuvok::expression; extern Node* parser_tree_root(); extern void parser_free(); // Function pointer for traversals. First argument is the node, second // argument is "user data"; a given traversal function should cast it // to whatever is needed. /// @todo fixme should probably be a std::function or something like that. typedef bool (*TraversalFunc)(const std::shared_ptr n, void* data); bool print_tree(const std::shared_ptr n, void*); void inorder(const std::shared_ptr node, TraversalFunc f, void*); int main() { int x = yyparse(); if(x != 1) { // NullDeleter: "parser" owns that memory; it'll free it with parser_free. std::shared_ptr tree = std::shared_ptr( parser_tree_root(), NullDeleter ); inorder(tree, print_tree, NULL); std::vector> inputs; inputs.resize(1); inputs[0].resize(128); std::vector output; evaluate(*tree, inputs, output); } parser_free(); return 0; } // perform an inorder traversal. The traversal function can return // false to terminate the recursion early. void inorder(const std::shared_ptr node, TraversalFunc f, void* data) { if(f(node, data) == false) { return; } std::cerr << "traversing " << std::distance(node->begin(), node->end()) << " children.\n"; for(Node::citer iter = node->begin(); iter != node->end(); ++iter) { inorder(*iter, f, data); } } bool print_tree(const std::shared_ptr n, void*) { n->Print(std::cout); std::cout << "\n"; return true; } ImageVis3D-3.1.0/Tuvok/IO/scio.pro0000644000175000017500000002147412320456500016363 0ustar mathieumathieuTEMPLATE = lib win32:TEMPLATE = vclib CONFIG = create_prl exceptions largefile rtti static staticlib stl CONFIG += warn_on DEFINES += TUVOK_NO_QT TARGET = tuvokio win32 { DESTDIR = Build } OBJECTS_DIR = Build/objects d = ../Basics ../ 3rdParty/cxxtest 3rdParty/boost 3rdParty exception . DEPENDPATH = $$d INCLUDEPATH = $$d LIBS = -Lexpressions -ltuvokexpr unix:LIBS += -lz win32:LIBS += shlwapi.lib unix:QMAKE_CXXFLAGS += -std=c++0x unix:QMAKE_CXXFLAGS += -fno-strict-aliasing unix:QMAKE_CFLAGS += -fno-strict-aliasing macx:QMAKE_CXXFLAGS += -stdlib=libc++ -mmacosx-version-min=10.7 macx:QMAKE_CFLAGS += -mmacosx-version-min=10.7 macx:LIBS += -stdlib=libc++ -framework CoreFoundation -mmacosx-version-min=10.7 # Find the location of QtGui's prl file, and include it here so we can look at # the QMAKE_PRL_CONFIG variable. TEMP = $$[QT_INSTALL_LIBS] libQtGui.prl PRL = $$[QT_INSTALL_LIBS] QtGui.framework/QtGui.prl TEMP = $$join(TEMP, "/") PRL = $$join(PRL, "/") exists($$TEMP) { include($$TEMP) } exists($$PRL) { include($$PRL) } # Input SOURCES += \ ./3rdParty/bzip2/blocksort.c \ ./3rdParty/bzip2/bzlib.c \ ./3rdParty/bzip2/compress.c \ ./3rdParty/bzip2/crctable.c \ ./3rdParty/bzip2/decompress.c \ ./3rdParty/bzip2/huffman.c \ ./3rdParty/bzip2/randtable.c \ ./3rdParty/jpeglib/cdjpeg.c \ ./3rdParty/jpeglib/jcapimin.c \ ./3rdParty/jpeglib/jcapistd.c \ ./3rdParty/jpeglib/jccoefct.c \ ./3rdParty/jpeglib/jccolor.c \ ./3rdParty/jpeglib/jcdctmgr.c \ ./3rdParty/jpeglib/jcdiffct.c \ ./3rdParty/jpeglib/jchuff.c \ ./3rdParty/jpeglib/jcinit.c \ ./3rdParty/jpeglib/jclhuff.c \ ./3rdParty/jpeglib/jclossls.c \ ./3rdParty/jpeglib/jclossy.c \ ./3rdParty/jpeglib/jcmainct.c \ ./3rdParty/jpeglib/jcmarker.c \ ./3rdParty/jpeglib/jcmaster.c \ ./3rdParty/jpeglib/jcodec.c \ ./3rdParty/jpeglib/jcomapi.c \ ./3rdParty/jpeglib/jcparam.c \ ./3rdParty/jpeglib/jcphuff.c \ ./3rdParty/jpeglib/jcpred.c \ ./3rdParty/jpeglib/jcprepct.c \ ./3rdParty/jpeglib/jcsample.c \ ./3rdParty/jpeglib/jcscale.c \ ./3rdParty/jpeglib/jcshuff.c \ ./3rdParty/jpeglib/jctrans.c \ ./3rdParty/jpeglib/jdapimin.c \ ./3rdParty/jpeglib/jdapistd.c \ ./3rdParty/jpeglib/jdatadst.c \ ./3rdParty/jpeglib/jdatasrc.c \ ./3rdParty/jpeglib/jdcoefct.c \ ./3rdParty/jpeglib/jdcolor.c \ ./3rdParty/jpeglib/jddctmgr.c \ ./3rdParty/jpeglib/jddiffct.c \ ./3rdParty/jpeglib/jdhuff.c \ ./3rdParty/jpeglib/jdinput.c \ ./3rdParty/jpeglib/jdlhuff.c \ ./3rdParty/jpeglib/jdlossls.c \ ./3rdParty/jpeglib/jdlossy.c \ ./3rdParty/jpeglib/jdmainct.c \ ./3rdParty/jpeglib/jdmarker.c \ ./3rdParty/jpeglib/jdmaster.c \ ./3rdParty/jpeglib/jdmerge.c \ ./3rdParty/jpeglib/jdphuff.c \ ./3rdParty/jpeglib/jdpostct.c \ ./3rdParty/jpeglib/jdpred.c \ ./3rdParty/jpeglib/jdsample.c \ ./3rdParty/jpeglib/jdscale.c \ ./3rdParty/jpeglib/jdshuff.c \ ./3rdParty/jpeglib/jdtrans.c \ ./3rdParty/jpeglib/jerror.c \ ./3rdParty/jpeglib/jfdctflt.c \ ./3rdParty/jpeglib/jfdctfst.c \ ./3rdParty/jpeglib/jfdctint.c \ ./3rdParty/jpeglib/jidctflt.c \ ./3rdParty/jpeglib/jidctfst.c \ ./3rdParty/jpeglib/jidctint.c \ ./3rdParty/jpeglib/jidctred.c \ ./3rdParty/jpeglib/jmemmgr.c \ ./3rdParty/jpeglib/jmemnobs.c \ ./3rdParty/jpeglib/jmemsrc.c \ ./3rdParty/jpeglib/jquant1.c \ ./3rdParty/jpeglib/jquant2.c \ ./3rdParty/jpeglib/jutils.c \ ./3rdParty/jpeglib/rdcolmap.c \ ./3rdParty/jpeglib/rdswitch.c \ ./3rdParty/jpeglib/transupp.c \ ./3rdParty/tiff/tif_aux.c \ ./3rdParty/tiff/tif_close.c \ ./3rdParty/tiff/tif_codec.c \ ./3rdParty/tiff/tif_color.c \ ./3rdParty/tiff/tif_compress.c \ ./3rdParty/tiff/tif_dir.c \ ./3rdParty/tiff/tif_dirinfo.c \ ./3rdParty/tiff/tif_dirread.c \ ./3rdParty/tiff/tif_dirwrite.c \ ./3rdParty/tiff/tif_dumpmode.c \ ./3rdParty/tiff/tif_error.c \ ./3rdParty/tiff/tif_extension.c \ ./3rdParty/tiff/tif_fax3.c \ ./3rdParty/tiff/tif_fax3sm.c \ ./3rdParty/tiff/tif_flush.c \ ./3rdParty/tiff/tif_getimage.c \ ./3rdParty/tiff/tif_luv.c \ ./3rdParty/tiff/tif_lzw.c \ ./3rdParty/tiff/tif_next.c \ ./3rdParty/tiff/tif_open.c \ ./3rdParty/tiff/tif_packbits.c \ ./3rdParty/tiff/tif_pixarlog.c \ ./3rdParty/tiff/tif_predict.c \ ./3rdParty/tiff/tif_print.c \ ./3rdParty/tiff/tif_read.c \ ./3rdParty/tiff/tif_strip.c \ ./3rdParty/tiff/tif_swab.c \ ./3rdParty/tiff/tif_thunder.c \ ./3rdParty/tiff/tif_tile.c \ ./3rdParty/tiff/tif_unix.c \ ./3rdParty/tiff/tif_version.c \ ./3rdParty/tiff/tif_warning.c \ ./3rdParty/tiff/tif_write.c \ ./3rdParty/tiff/tif_zip.c \ ./AbstrConverter.cpp \ ./AbstrGeoConverter.cpp \ ./AnalyzeConverter.cpp \ ./BOVConverter.cpp \ ./BrickedDataset.cpp \ ./Dataset.cpp \ ./DICOM/DICOMParser.cpp \ ./DirectoryParser.cpp \ ./DSFactory.cpp \ ./ExternalDataset.cpp \ ./FileBackedDataset.cpp \ ./G3D.cpp \ ./gzio.c \ ./I3MConverter.cpp \ ./IASSConverter.cpp \ ./Images/ImageParser.cpp \ ./Images/StackExporter.cpp \ ./InveonConverter.cpp \ ./IOManager.cpp \ ./KeyValueFileParser.cpp \ ./KitwareConverter.cpp \ ./MedAlyVisFiberTractGeoConverter.cpp \ ./MedAlyVisGeoConverter.cpp \ ./MobileGeoConverter.cpp \ ./NRRDConverter.cpp \ ./OBJGeoConverter.cpp \ ./PLYGeoConverter.cpp \ ./StLGeoConverter.cpp \ ./XML3DGeoConverter.cpp \ ./QVISConverter.cpp \ ./RAWConverter.cpp \ ./REKConverter.cpp \ ./StkConverter.cpp \ ./MRCConverter.cpp \ ./TiffVolumeConverter.cpp \ ./TransferFunction1D.cpp \ ./TransferFunction2D.cpp \ ./TuvokJPEG.cpp \ ./UVF/DataBlock.cpp \ ./uvfDataset.cpp \ ./UVF/GeometryDataBlock.cpp \ ./UVF/GlobalHeader.cpp \ ./UVF/Histogram1DDataBlock.cpp \ ./UVF/Histogram2DDataBlock.cpp \ ./UVF/KeyValuePairDataBlock.cpp \ ./UVF/MaxMinDataBlock.cpp \ ./UVF/ExtendedOctree/ExtendedOctree.cpp ./UVF/ExtendedOctree/ExtendedOctreeConverter.cpp ./UVF/ExtendedOctree/VolumeTools.cpp ./uvfMesh.cpp \ ./UVF/RasterDataBlock.cpp \ ./UVF/UVF.cpp \ ./UVF/UVFTables.cpp \ ./VariantArray.cpp \ ./VFFConverter.cpp \ ./VGIHeaderParser.cpp \ ./VGStudioConverter.cpp HEADERS += \ ./3rdParty/bzip2/bzlib.h \ ./3rdParty/bzip2/bzlib_private.h \ ./3rdParty/jpeglib/cderror.h \ ./3rdParty/jpeglib/cdjpeg.h \ ./3rdParty/jpeglib/jchuff.h \ ./3rdParty/jpeglib/jconfig.h \ ./3rdParty/jpeglib/jdct.h \ ./3rdParty/jpeglib/jdhuff.h \ ./3rdParty/jpeglib/jerror.h \ ./3rdParty/jpeglib/jinclude.h \ ./3rdParty/jpeglib/jlossls.h \ ./3rdParty/jpeglib/jlossy.h \ ./3rdParty/jpeglib/jmemsys.h \ ./3rdParty/jpeglib/jmorecfg.h \ ./3rdParty/jpeglib/jpegint.h \ ./3rdParty/jpeglib/jpeglib.h \ ./3rdParty/jpeglib/jversion.h \ ./3rdParty/jpeglib/mangle_jpeg.h \ ./3rdParty/jpeglib/transupp.h \ ./3rdParty/tiff/t4.h \ ./3rdParty/tiff/tif_config.h \ ./3rdParty/tiff/tif_dir.h \ ./3rdParty/tiff/tif_fax3.h \ ./3rdParty/tiff/tiffconf.h \ ./3rdParty/tiff/tiff.h \ ./3rdParty/tiff/tiffio.h \ ./3rdParty/tiff/tiffiop.h \ ./3rdParty/tiff/tiffvers.h \ ./3rdParty/tiff/tif_predict.h \ ./3rdParty/tiff/uvcode.h \ ./3rdParty/zlib/zconf.h \ ./3rdParty/zlib/zlib.h \ ./AbstrConverter.h \ ./AbstrGeoConverter.h \ ./AnalyzeConverter.h \ ./BOVConverter.h \ ./BrickedDataset.h \ ./Brick.h \ ./Dataset.h \ ./DICOM/DICOMParser.h \ ./DirectoryParser.h \ ./DSFactory.h \ ./exception/FileNotFound.h \ ./exception/IOException.h \ ./exception/ReadTimeout.h \ ./exception/UnmergeableDatasets.h \ ./ExternalDataset.h \ ./FileBackedDataset.h \ ./G3D.h \ ./gzio.h \ ./I3MConverter.h \ ./IASSConverter.h \ ./Images/ImageParser.h \ ./Images/StackExporter.h \ ./InveonConverter.h \ ./IOManager.h \ ./KeyValueFileParser.h \ ./KitwareConverter.h \ ./MedAlyVisFiberTractGeoConverter.h \ ./MedAlyVisGeoConverter.h \ ./MobileGeoConverter.h \ ./NRRDConverter.h \ ./OBJGeoConverter.h \ ./PLYGeoConverter.h \ ./StLGeoConverter.h \ ./XML3DGeoConverter.h \ ./Quantize.h \ ./QVISConverter.h \ ./RAWConverter.h \ ./REKConverter.h \ ./StkConverter.h \ ./MRCConverter.h \ ./test/dicom.h \ ./test/jpeg.h \ ./test/minmax.h \ ./test/multisrc.h \ ./test/quantize.h \ ./test/util-test.h \ ./TiffVolumeConverter.h \ ./TransferFunction1D.h \ ./TransferFunction2D.h \ ./TuvokIOError.h \ ./TuvokJPEG.h \ ./Tuvok_QtPlugins.h \ ./UVF/DataBlock.h \ ./uvfDataset.h \ ./UVF/GeometryDataBlock.h \ ./UVF/GlobalHeader.h \ ./UVF/Histogram1DDataBlock.h \ ./UVF/Histogram2DDataBlock.h \ ./UVF/KeyValuePairDataBlock.h \ ./UVF/MaxMinDataBlock.h \ ./uvfMesh.h \ ./UVF/RasterDataBlock.h \ ./UVF/UVFBasic.h \ ./UVF/UVF.h \ ./UVF/UVFTables.h \ ./UVF/ExtendedOctree/ExtendedOctree.h ./UVF/ExtendedOctree/ExtendedOctreeConverter.h ./UVF/ExtendedOctree/VolumeTools.h ./VariantArray.h \ ./VFFConverter.h \ ./VGIHeaderParser.h \ ./VGStudioConverter.h ImageVis3D-3.1.0/Tuvok/IO/TuvokJPEG.cpp0000644000175000017500000002333712320456500017166 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2009 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file TuvokJPEG.cpp \author Tom Fogal SCI Institute University of Utah \brief Tuvok wrapper for JPEG loading code. */ #include #include #include #include #include #include #include #include "3rdParty/jpeglib/jpeglib.h" #include "TuvokJPEG.h" #include "Controller/Controller.h" /// To read from something with a JPEG embedded, like a DICOM, we need to be /// able to read from an arbitrary buffer. We support a typical file /// interface, but we also need to support the former use case. Thus the file /// interface works by opening the file, slurping in the entire buffer, and /// then reading the data as if it had always been in memory. This unifies our /// code paths, but requires more memory than is strictly necessary. namespace tuvok { // To do JPEG IO which isn't from a file, one has to set up a special object // with a particular set of methods. We'll reuse most of the methods from // what libjpeg thinks is a stdio src, which works because we've pre-populated // the buffer. Thus libjpeg will never make a request to the source manager to // read more data. typedef struct { jpeg_source_mgr pub; /* public fields */ JOCTET *buffer; /* start of buffer */ } incore_src_mgr; // Well, mostly. Just to be sure, we override the `ask for more data' method // to ensure it'll never be called. We'll also install our own error handler, // because libjpeg's default terminates the process. static boolean fill_input_buffer(j_decompress_ptr); static void jpg_error(j_common_ptr); static void fill_buffer_from_file(std::vector& buf, const char *fn, std::streamoff offset); #ifdef TUVOK_NO_IO // If we have no JPEG library, then just use an empty implementation. struct j_implementation : public JPEG::j_impl { // the reference to jpg_error avoids an 'unused function' warning. j_implementation() { (void)jpg_error; } void set_data(const std::vector&) { } virtual ~j_implementation() { } std::vector data; ///< hunk of memory we'll read the jpeg from. bool started; ///< whether we've started decompressing jpeg_error_mgr jerr; ///< how jpeg will report errors jpeg_decompress_struct jinfo; ///< main interface for decompression }; #else /// To avoid including jpeglib in the header, we create an opaque pointer to /// the `jpeg implementation'. This is what we'll actually end up pointing to. struct j_implementation : public JPEG::j_impl { // Constructor just configures the objects we'll use later. j_implementation() : started(false) { struct jpeg_decompress_struct jpg; jpg.err = jpeg_std_error(&(this->jerr)); jpg.err->error_exit = jpg_error; jpeg_create_decompress(&jpg); jpeg_stdio_src(&jpg, NULL); this->jinfo = jpg; }; // Expects to get the entire JPEG buffer, but only reads the header. // After calling this, it is safe to query the JPEG metadata from // this->jinfo. // Copies the data from the argument. void set_data(const std::vector& mem) { this->data = mem; this->jinfo.src->bytes_in_buffer = this->data.size(); this->jinfo.src->next_input_byte = &(this->data.at(0)); if(jpeg_read_header(&(this->jinfo), TRUE) != JPEG_HEADER_OK) { T_ERROR("Could not read JPEG header, bailing..."); return; } if(jpeg_start_decompress(&(this->jinfo))) { started = true; } } virtual ~j_implementation() { // If the client didn't transfer any actual data (i.e. only read // metadata), then this `finish' causes an `Application transferred too few // scanlines' warning. Yet we've called start_decompress, so we must call // finish. Just live with the warning, or fix the issue in libjpeg itself. if(started) { jpeg_finish_decompress(&this->jinfo); } jpeg_destroy_decompress(&this->jinfo); } std::vector data; ///< hunk of memory we'll read the jpeg from. bool started; ///< whether we've started decompressing jpeg_error_mgr jerr; ///< how jpeg will report errors jpeg_decompress_struct jinfo; ///< main interface for decompression }; #endif JPEG::JPEG(const std::string &fn, std::streamoff offset) : w(0), h(0), bpp(0), jpeg_impl(new j_implementation) { fill_buffer_from_file(this->buffer, fn.c_str(), offset); if(this->buffer.empty()) { T_ERROR("No data in %s", fn.c_str()); return; } this->initialize(); } JPEG::JPEG(const std::vector& buf) : w(0), h(0), bpp(0), jpeg_impl(new j_implementation) { this->buffer = buf; this->initialize(); } JPEG::~JPEG() { delete this->jpeg_impl; } bool JPEG::valid() const { return this->w != 0 && this->h != 0 && this->bpp != 0; } size_t JPEG::width() const { return this->w; } size_t JPEG::height() const { return this->h; } size_t JPEG::components() const {return this->bpp; } size_t JPEG::size() const { return this->w * this->h * this->bpp; } // Decode the JPEG data and give back the raw array. const char* JPEG::data() { #ifdef TUVOK_NO_IO T_ERROR("IO library not compiled in; not implemented!"); return NULL; #else // If the JPEG isn't valid, we can't load anything from it; just bail. if(!this->valid()) { return NULL; } // Need a buffer for the image data. this->buffer.resize(this->size()); j_implementation *jimpl = dynamic_cast(this->jpeg_impl); { JSAMPLE *jbuffer = NULL; const size_t row_sz = this->w * this->bpp; jbuffer = new JSAMPLE[row_sz]; assert(this->h == jimpl->jinfo.output_height); assert(this->height() == jimpl->jinfo.output_height); assert(this->width() > 0); assert(this->components() > 0); char *data = &(this->buffer.at(0)); while(jimpl->jinfo.output_scanline < jimpl->jinfo.output_height) { jpeg_read_scanlines(&(jimpl->jinfo), (JSAMPLE**)&jbuffer, 1); // The -1 is because jpeg_read_scanlines implicitly incremented the // output_scanline field, putting the current scanline after the call 1 // in front of the scanline we want to copy. assert(jimpl->jinfo.output_scanline > 0); std::memcpy(data + ((jimpl->jinfo.output_scanline-1)*row_sz), jbuffer, row_sz); } delete[] jbuffer; } // This would happen in our destructor anyway, but we might as clean up ASAP. delete this->jpeg_impl; this->jpeg_impl = NULL; return &this->buffer.at(0); #endif // TUVOK_NO_IO } void JPEG::initialize() { j_implementation *jimpl = dynamic_cast(this->jpeg_impl); jimpl->jinfo.src->fill_input_buffer = fill_input_buffer; jimpl->set_data(this->buffer); this->w = jimpl->jinfo.output_width; this->h = jimpl->jinfo.output_height; this->bpp = jimpl->jinfo.output_components; } /// Overly complex, too much so to be worth explaining. Basically JPEG will /// call this when it runs out of data to process. In our case this should /// never happen, because we read the whole JPEG before giving it to the /// library -- all the data are already resident. boolean fill_input_buffer(j_decompress_ptr) { T_ERROR("unexpected fill_input_buffer"); return TRUE; } // Just output the message and return. We override this method because libjpeg // would kill our process with its default implementation. static void jpg_error(j_common_ptr jinfo) { // Unfortunately it seems pretty difficult to pull the actual error string // out of the library. We'd like this to go to our debug logs, but it'll end // up on stderr. (*jinfo->err->output_message)(jinfo); } /// Exactly what it says; fill the contents of the buffer with the data in the /// given filename. Not a great idea to do this with large files. static void fill_buffer_from_file(std::vector& buf, const char *fn, std::streamoff offset) { std::ifstream ifs(fn, std::ifstream::binary); if(!ifs.is_open()) { T_ERROR("Could not get JPEG data from file %s!", fn); return; } // get filesize. ifs.seekg(0, std::ios::end); std::ifstream::pos_type file_size = ifs.tellg() - offset; ifs.seekg(offset, std::ios::beg); MESSAGE("Reading %u byte file.", static_cast(file_size)); // resize our buffer to be big enough for the file try { buf.resize(size_t(file_size)); } catch(std::bad_alloc &ba) { T_ERROR("Could not allocate JPEG buffer (%s)",ba.what()); WARNING("Retrying with smaller buffer..."); file_size = 256*256*256; buf.resize(size_t(file_size)); } ifs.read(&buf.at(0), size_t(file_size)); assert(ifs.gcount() == file_size); } }; // namespace tuvok ImageVis3D-3.1.0/Tuvok/IO/LinearIndexDataset.h0000644000175000017500000000447212320456500020564 0ustar mathieumathieu#ifndef TUVOK_LINEAR_INDEX_DATASET_H #define TUVOK_LINEAR_INDEX_DATASET_H #include "BrickedDataset.h" namespace tuvok { /// A LinearIndexDataset is simply a bricked dataset with a particular /// algorithm for how the indexing is performed. Namely, the 1D index is /// actually the linearization of a 4D (LOD, z,y,x, from slowest to fasting /// moving dimension) index. /// This necessary implies that there are no 'holes' in the data: if a brick /// <0, 1,0,0> exists, than the brick <0, 0,0,0> must exist as well. class LinearIndexDataset : public BrickedDataset { public: LinearIndexDataset() {} virtual ~LinearIndexDataset() {} /// @returns the brick layout for a given LoD. This is the number of /// bricks which exist (given per-dimension) virtual UINTVECTOR3 GetBrickLayout(size_t LoD, size_t timestep) const=0; /// @returns the brick key (1D brick index) derived from the 4D key. virtual BrickKey IndexFrom4D(const UINTVECTOR4& four, size_t timestep) const; virtual UINTVECTOR4 IndexTo4D(const BrickKey& key) const; }; } #endif /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/VFFConverter.cpp0000644000175000017500000001663212320456500017721 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file VFFConverter.cpp \author Jens Krueger SCI Institute University of Utah \date December 2008 */ #include #include "VFFConverter.h" #include #include using namespace std; VFFConverter::VFFConverter() { m_vConverterDesc = "Visualization File Format"; m_vSupportedExt.push_back("VFF"); } bool VFFConverter::ConvertToRAW( const std::string& strSourceFilename, const std::string&, bool, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile ) { MESSAGE("Attempting to convert VFF dataset %s", strSourceFilename.c_str()); // Check Magic value in VFF File first ifstream fileData(strSourceFilename.c_str()); string strFirstLine; if (fileData.is_open()) { getline (fileData,strFirstLine); if (strFirstLine.substr(0,4) != "ncaa") { WARNING("The file %s is not a VFF file (missing magic)", strSourceFilename.c_str()); return false; } } else { WARNING("Could not open VFF file %s", strSourceFilename.c_str()); return false; } fileData.close(); // init data strIntermediateFile = strSourceFilename; bDeleteIntermediateFile = false; iComponentSize = 8; iComponentCount = 1; vVolumeSize = UINT64VECTOR3(1,1,1); vVolumeAspect = FLOATVECTOR3(1,1,1); bConvertEndianess = EndianConvert::IsLittleEndian(); bSigned = true; bIsFloat = false; /// \todo check if VFF can store float values // read data string strHeaderEnd; strHeaderEnd.push_back(12); // header end char of vffs is ^L = 0C = 12 KeyValueFileParser parser(strSourceFilename, false, "=", strHeaderEnd); if (!parser.FileReadable()) { WARNING("Could not open VFF file %s", strSourceFilename.c_str()); return false; } KeyValPair* kvp = parser.GetData("TYPE"); if (kvp == NULL || kvp->strValue == ";") { T_ERROR("Could not find valid token \"type\" in file %s", strSourceFilename.c_str()); return false; } else { if (kvp->strValueUpper != "RASTER;") { T_ERROR("Only raster VFFs are supported at the moment"); return false; } } int iDim; kvp = parser.GetData("RANK"); if (kvp == NULL || kvp->strValue == ";") { T_ERROR("Could not find valid token \"rank\" in file %s", strSourceFilename.c_str()); return false; } else { iDim = kvp->iValue; } kvp = parser.GetData("BANDS"); if (kvp == NULL || kvp->strValue == ";") { T_ERROR("Could not find valid token \"bands\" in file %s", strSourceFilename.c_str()); return false; } else { if (kvp->iValue != 1) { T_ERROR("Only scalar VFFs are supported at the moment"); return false; } } kvp = parser.GetData("FORMAT"); if (kvp == NULL || kvp->strValue == ";") { T_ERROR("Could not find valid token \"format\" in file %s", strSourceFilename.c_str()); return false; } else { if (kvp->strValueUpper != "SLICE;") { T_ERROR("Only VFFs with slice layout are supported at the moment"); return false; } } kvp = parser.GetData("BITS"); if (kvp == NULL || kvp->strValue == ";") { T_ERROR("Could not find valid token \"bands\" in file %s", strSourceFilename.c_str()); return false; } else { iComponentSize = kvp->iValue; } kvp = parser.GetData("SIZE"); if (kvp == NULL || kvp->strValue == ";") { T_ERROR("Could not find valid token \"size\" in file %s", strSourceFilename.c_str()); return false; } else { vVolumeSize[0] = kvp->viValue[0]; vVolumeSize[1] = kvp->viValue[1]; vVolumeSize[2] = 1; if (iDim == 3) vVolumeSize[2] = kvp->viValue[2]; MESSAGE("%llu x %llu x %llu volume.", vVolumeSize[0], vVolumeSize[1], vVolumeSize[2]); } kvp = parser.GetData("SPACING"); if (kvp == NULL || kvp->strValue == ";") { T_ERROR("Could not find valid token \"size\" in file %s", strSourceFilename.c_str()); return false; } else { vVolumeAspect[0] = kvp->vfValue[0]; vVolumeAspect[1] = kvp->vfValue[1]; if (iDim == 3) vVolumeAspect[2] = kvp->vfValue[2]; } kvp = parser.GetData("TITLE"); if (kvp == NULL || kvp->strValue == ";") { strTitle = "VFF data"; } else { strTitle = kvp->strValue; } iHeaderSkip = parser.GetStopPos(); return true; } bool VFFConverter::ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize,FLOATVECTOR3 vVolumeAspect, bool, bool bQuantizeTo8Bit) { // create header textfile from metadata ofstream fAsciiTarget(strTargetFilename.c_str()); if (!fAsciiTarget.is_open()) { T_ERROR("Unable to open target file %s.", strTargetFilename.c_str()); return false; } if (bFloatingPoint) { T_ERROR("Floating point formats are not avaliable for vff files."); return false; } fAsciiTarget << "ncaa" << endl; fAsciiTarget << "type=raster;" << endl; fAsciiTarget << "rank=3;" << endl; fAsciiTarget << "bands=" << iComponentCount << ";"<< endl; fAsciiTarget << "format=slice;" << endl; fAsciiTarget << "bits=" << iComponentSize << ";" << endl; fAsciiTarget << "size=" << vVolumeSize.x << " " << vVolumeSize.y << " "<< vVolumeSize.z << ";" << endl; fAsciiTarget << "spacing=" << vVolumeAspect.x << " " << vVolumeAspect.y << " "<< vVolumeAspect.z << ";" << endl; // add the ^L header delimiter string strHeaderEnd; strHeaderEnd.push_back(12); // header end char of vffs is ^L = 0C = 12 fAsciiTarget << strHeaderEnd << endl; fAsciiTarget.close(); // append RAW data using the parent's call bool bRAWSuccess = AppendRAW(strRawFilename, iHeaderSkip, strTargetFilename, iComponentSize, !EndianConvert::IsBigEndian(), !bSigned, bQuantizeTo8Bit); if (bRAWSuccess) { return true; } else { T_ERROR("Error appaneding raw data to header file %s.", strTargetFilename.c_str()); remove(strTargetFilename.c_str()); return false; } } ImageVis3D-3.1.0/Tuvok/IO/MRCConverter.h0000644000175000017500000000463612320456500017367 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef TUVOK_MRC_CONVERTER_H #define TUVOK_MRC_CONVERTER_H #include "RAWConverter.h" class MRCConverter : public RAWConverter { public: MRCConverter(); virtual ~MRCConverter() {} virtual bool ConvertToRAW( const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile); virtual bool ConvertToNative( const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize, FLOATVECTOR3 vVolumeAspect, bool bNoUserInteraction, const bool bQuantizeTo8Bit); virtual bool CanExportData() const {return false;} virtual bool CanImportData() const {return true;} virtual bool CanRead(const std::string& fn, const std::vector& start) const; }; #endif ImageVis3D-3.1.0/Tuvok/IO/BOVConverter.h0000644000175000017500000000547712320456500017400 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file BOVConverter.h \author Tom Fogal SCI Institute University of Utah */ #pragma once #ifndef BOVCONVERTER_H #define BOVCONVERTER_H #include "RAWConverter.h" class BOVConverter : public RAWConverter { public: BOVConverter(); virtual ~BOVConverter() {} virtual bool ConvertToRAW(const std::string& strSourceFilename, const std::string& strTempDir, bool bNoUserInteraction, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile); virtual bool ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize, FLOATVECTOR3 vVolumeAspect, bool bNoUserInteraction, const bool bQuantizeTo8Bit); virtual bool CanExportData() const { return true; } virtual bool CanImportData() const { return true; } }; #endif // BOVCONVERTER_H ImageVis3D-3.1.0/Tuvok/IO/IOManager.cpp0000644000175000017500000030750312320456500017212 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file IOManager.cpp \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #include "StdTuvokDefines.h" #include #include #include #include #include #include #include #include #include #include "3rdParty/jpeglib/jconfig.h" #include "IOManager.h" #include "Basics/MC.h" #include "Basics/SysTools.h" #include "Basics/SystemInfo.h" #include "Controller/Controller.h" #include "DSFactory.h" #include "DynamicBrickingDS.h" #include "exception/UnmergeableDatasets.h" #include "expressions/parser.h" #include "expressions/syntax.h" #include "expressions/treenode.h" #include "IO/DICOM/DICOMParser.h" #include "IO/Images/ImageParser.h" #include "IO/Images/StackExporter.h" #include "Quantize.h" #include "TuvokJPEG.h" #include "TransferFunction1D.h" #include "TuvokSizes.h" #include "uvfDataset.h" #include "UVF/UVF.h" #include "UVF/GeometryDataBlock.h" #include "UVF/Histogram1DDataBlock.h" #include "UVF/Histogram2DDataBlock.h" #include "AmiraConverter.h" #include "AnalyzeConverter.h" #include "BOVConverter.h" #include "IASSConverter.h" #include "I3MConverter.h" #include "InveonConverter.h" #include "KitwareConverter.h" #include "MRCConverter.h" #include "NRRDConverter.h" #include "QVISConverter.h" #include "REKConverter.h" #include "StkConverter.h" #include "TiffVolumeConverter.h" #include "VFFConverter.h" #include "VGStudioConverter.h" #include "VTKConverter.h" #include "Mesh.h" #include "AbstrGeoConverter.h" #include "GeomViewConverter.h" #include "LinesGeoConverter.h" #include "MobileGeoConverter.h" #include "MedAlyVisGeoConverter.h" #include "MedAlyVisFiberTractGeoConverter.h" #include "OBJGeoConverter.h" #include "PLYGeoConverter.h" #include "XML3DGeoConverter.h" #include "StLGeoConverter.h" using namespace std; using namespace boost; using namespace tuvok; static void read_first_block(const string& filename, vector& block) { ifstream ifs(filename.c_str(), ifstream::in | ifstream::binary); block.resize(512); ifs.read(reinterpret_cast(&block[0]), 512); ifs.close(); } // Figure out the converters that can convert the given file. // Multiple formats might think they can do as much; we return all of them and // let the higher level figure it out. namespace { template std::set> identify_converters(const std::string& filename, ForwIter cbegin, ForwIter cend) { std::set> converters; vector bytes(512); read_first_block(filename, bytes); while(cbegin != cend) { MESSAGE("Attempting converter '%s'", (*cbegin)->GetDesc().c_str()); if((*cbegin)->CanRead(filename, bytes)) { MESSAGE("Converter '%s' can read '%s'!", (*cbegin)->GetDesc().c_str(), filename.c_str()); converters.insert(*cbegin); } ++cbegin; } return converters; } } IOManager::IOManager() : m_dsFactory(new io::DSFactory()), m_iMaxBrickSize(DEFAULT_BRICKSIZE), m_iBuilderBrickSize(DEFAULT_BUILDER_BRICKSIZE), m_iBrickOverlap(DEFAULT_BRICKOVERLAP), m_iIncoresize(m_iMaxBrickSize*m_iMaxBrickSize*m_iMaxBrickSize), m_bUseMedianFilter(false), m_bClampToEdge(false), m_iCompression(1), // default zlib compression m_iCompressionLevel(1), // default compression level best speed m_iLayout(0), // default scanline layout m_LoadDS(NULL) { m_vpGeoConverters.push_back(new GeomViewConverter()); m_vpGeoConverters.push_back(new LinesGeoConverter()); m_vpGeoConverters.push_back(new MobileGeoConverter()); m_vpGeoConverters.push_back(new MedAlyVisGeoConverter()); m_vpGeoConverters.push_back(new MedAlyVisFiberTractGeoConverter()); m_vpGeoConverters.push_back(new OBJGeoConverter()); m_vpGeoConverters.push_back(new PLYGeoConverter()); m_vpGeoConverters.push_back(new XML3DGeoConverter()); m_vpGeoConverters.push_back(new StLGeoConverter()); m_vpConverters.push_back(std::shared_ptr(new VGStudioConverter())); m_vpConverters.push_back(std::shared_ptr(new QVISConverter())); m_vpConverters.push_back(std::shared_ptr(new NRRDConverter())); m_vpConverters.push_back(std::shared_ptr(new StkConverter())); m_vpConverters.push_back(std::shared_ptr(new TiffVolumeConverter())); m_vpConverters.push_back(std::shared_ptr(new VFFConverter())); m_vpConverters.push_back(std::shared_ptr(new BOVConverter())); m_vpConverters.push_back(std::shared_ptr(new REKConverter())); m_vpConverters.push_back(std::shared_ptr(new IASSConverter())); m_vpConverters.push_back(std::shared_ptr(new I3MConverter())); m_vpConverters.push_back(std::shared_ptr(new KitwareConverter())); m_vpConverters.push_back(std::shared_ptr(new InveonConverter())); m_vpConverters.push_back(std::shared_ptr(new AnalyzeConverter())); m_vpConverters.push_back(std::shared_ptr(new AmiraConverter())); m_vpConverters.push_back(std::shared_ptr(new MRCConverter())); m_vpConverters.push_back(std::shared_ptr(new VTKConverter())); m_dsFactory->AddReader(shared_ptr(new UVFDataset())); } void IOManager::RegisterExternalConverter(shared_ptr pConverter) { m_vpConverters.push_back(pConverter); } void IOManager::RegisterFinalConverter(shared_ptr pConverter) { m_pFinalConverter = pConverter; } namespace { template void Delete(T *t) { delete t; } } IOManager::~IOManager() { std::for_each(m_vpGeoConverters.begin(), m_vpGeoConverters.end(), Delete); m_vpConverters.clear(); m_vpGeoConverters.clear(); m_pFinalConverter.reset(); } vector> IOManager::ScanDirectory(string strDirectory) const { MESSAGE("Scanning directory %s", strDirectory.c_str()); vector> fileStacks; DICOMParser parseDICOM; parseDICOM.GetDirInfo(strDirectory); // Sort out DICOMs with embedded images that we can't read. for (size_t stack=0; stack < parseDICOM.m_FileStacks.size(); ++stack) { std::auto_ptr f = std::auto_ptr( new DICOMStackInfo((DICOMStackInfo*)parseDICOM.m_FileStacks[stack]) ); // if trying to load JPEG files. check if we can handle the JPEG payload if (f->m_bIsJPEGEncoded) { for(size_t i=0; i < f->m_Elements.size(); ++i) { if(!tuvok::JPEG(f->m_Elements[i]->m_strFileName, dynamic_cast (f->m_Elements[i])->GetOffsetToData()).valid()) { WARNING("Can't load JPEG in stack %u, element %u!", static_cast(stack), static_cast(i)); // should probably be using ptr container lib here instead of // trying to explicitly manage this. delete *(parseDICOM.m_FileStacks.begin()+stack); parseDICOM.m_FileStacks.erase(parseDICOM.m_FileStacks.begin()+stack); stack--; break; } } } } if (parseDICOM.m_FileStacks.size() == 1) { MESSAGE(" found a single DICOM stack"); } else { MESSAGE(" found %u DICOM stacks", static_cast(parseDICOM.m_FileStacks.size())); } for (size_t stack=0; stack < parseDICOM.m_FileStacks.size(); ++stack) { std::shared_ptr f = std::shared_ptr(new DICOMStackInfo( static_cast(parseDICOM.m_FileStacks[stack]) )); stringstream s; s << f->m_strFileType << " Stack: " << f->m_strDesc; f->m_strDesc = s.str(); fileStacks.push_back(f); } ImageParser parseImages; parseImages.GetDirInfo(strDirectory); if (parseImages.m_FileStacks.size() == 1) { MESSAGE(" found a single image stack"); } else { MESSAGE(" found %u image stacks", static_cast(parseImages.m_FileStacks.size())); } for (size_t stack=0; stack < parseImages.m_FileStacks.size(); ++stack) { std::shared_ptr f = std::shared_ptr(new ImageStackInfo( dynamic_cast(parseImages.m_FileStacks[stack]) )); stringstream s; s << f->m_strFileType << " Stack: " << f->m_strDesc; f->m_strDesc = s.str(); fileStacks.push_back(f); } // add other image parsers here MESSAGE(" scan complete"); return fileStacks; } #ifdef DETECTED_OS_WINDOWS #pragma warning(disable:4996) #endif bool IOManager::ConvertDataset(FileStackInfo* pStack, const string& strTargetFilename, const string& strTempDir, const uint64_t iMaxBrickSize, uint64_t iBrickOverlap, const bool bQuantizeTo8Bit) const { MESSAGE("Request to convert stack of %s files to %s received", pStack->m_strDesc.c_str(), strTargetFilename.c_str()); if (pStack->m_strFileType == "DICOM") { MESSAGE(" Detected DICOM stack, starting DICOM conversion"); DICOMStackInfo* pDICOMStack = ((DICOMStackInfo*)pStack); MESSAGE(" Stack contains %u files", static_cast(pDICOMStack->m_Elements.size())); MESSAGE(" Series: %u Bits: %u (%u)", pDICOMStack->m_iSeries, pDICOMStack->m_iAllocated, pDICOMStack->m_iStored); MESSAGE(" Date: %s Time: %s", pDICOMStack->m_strAcquDate.c_str(), pDICOMStack->m_strAcquTime.c_str()); MESSAGE(" Modality: %s Description: %s", pDICOMStack->m_strModality.c_str(), pDICOMStack->m_strDesc.c_str()); MESSAGE(" Aspect Ratio: %g %g %g", pDICOMStack->m_fvfAspect.x, pDICOMStack->m_fvfAspect.y, pDICOMStack->m_fvfAspect.z); string strTempMergeFilename = strTempDir + SysTools::GetFilename(strTargetFilename) + "~"; MESSAGE("Creating intermediate file %s", strTempMergeFilename.c_str()); ofstream fs; fs.open(strTempMergeFilename.c_str(), fstream::binary); if (fs.fail()) { T_ERROR("Could not create temp file %s aborted conversion.", strTempMergeFilename.c_str()); return false; } vector vData; for (size_t j=0; j < pDICOMStack->m_Elements.size(); j++) { SimpleDICOMFileInfo* pDICOMFileInfo = dynamic_cast(pDICOMStack->m_Elements[j]); if (!pDICOMFileInfo) continue; uint32_t iDataSize = pDICOMStack->m_Elements[j]->GetDataSize(); vData.resize(iDataSize); if (pDICOMStack->m_bIsJPEGEncoded) { MESSAGE("JPEG is %d bytes, offset %d", iDataSize, pDICOMFileInfo->GetOffsetToData()); tuvok::JPEG jpg(pDICOMStack->m_Elements[j]->m_strFileName, pDICOMFileInfo->GetOffsetToData()); if(!jpg.valid()) { T_ERROR("'%s' reports an embedded JPEG, but the JPEG is invalid.", pDICOMStack->m_Elements[j]->m_strFileName.c_str()); return false; } MESSAGE("jpg is: %u bytes (%ux%u, %u components)", uint32_t(jpg.size()), uint32_t(jpg.width()), uint32_t(jpg.height()), uint32_t(jpg.components())); const char *jpeg_data = jpg.data(); copy(jpeg_data, jpeg_data + jpg.size(), &vData[0]); pDICOMStack->m_iAllocated = BITS_IN_JSAMPLE; } else { pDICOMStack->m_Elements[j]->GetData(vData); MESSAGE("Creating intermediate file %s\n%u%%", strTempMergeFilename.c_str(), static_cast((100*j)/pDICOMStack->m_Elements.size())); } if (pDICOMStack->m_bIsBigEndian != EndianConvert::IsBigEndian()) { MESSAGE("Converting Endianess ..."); switch (pDICOMStack->m_iAllocated) { case 8 : break; case 16 : { short *pData = reinterpret_cast(&vData[0]); for (uint32_t k = 0;k(pData[k]); } break; case 32 : { int *pData = reinterpret_cast(&vData[0]); for (uint32_t k = 0;k(pData[k]); } break; } } // HACK: For now we set bias to 0 for unsigned file as we've // encountered a number of DICOM files files where the bias // parameter would create negative values and so far I don't know // how to interpret this correctly if (!pDICOMStack->m_bSigned) pDICOMFileInfo->m_fBias = 0.0f; if (pDICOMFileInfo->m_fScale != 1.0f || pDICOMFileInfo->m_fBias != 0.0f) { MESSAGE("Applying Scale and Bias ..."); if (pDICOMStack->m_bSigned) { switch (pDICOMStack->m_iAllocated) { case 8 :{ char *pData = reinterpret_cast(&vData[0]); for (uint32_t k = 0;km_fScale + pDICOMFileInfo->m_fBias; pData[k] = (char)(sbValue); }} break; case 16 : { short *pData = reinterpret_cast(&vData[0]); for (uint32_t k = 0;km_fScale + pDICOMFileInfo->m_fBias; pData[k] = (short)(sbValue); }} break; case 32 : { int *pData = reinterpret_cast(&vData[0]); for (uint32_t k = 0;km_fScale + pDICOMFileInfo->m_fBias; pData[k] = (int)(sbValue); }} break; } } else { switch (pDICOMStack->m_iAllocated) { case 8 :{ unsigned char *pData = reinterpret_cast(&vData[0]); for (uint32_t k = 0;km_fScale + pDICOMFileInfo->m_fBias; pData[k] = (unsigned char)(sbValue); }} break; case 16 : { unsigned short *pData = reinterpret_cast(&vData[0]); for (uint32_t k = 0;km_fScale + pDICOMFileInfo->m_fBias; pData[k] = (unsigned short)(sbValue); }} break; case 32 : { unsigned int *pData = reinterpret_cast(&vData[0]); for (uint32_t k = 0;km_fScale + pDICOMFileInfo->m_fBias; pData[k] = (unsigned int)(sbValue); }} break; } } } // TODO: implement proper DICOM Windowing if (pDICOMFileInfo->m_fWindowWidth > 0) { WARNING("DICOM Windowing parameters found!"); } // Create temporary file with the DICOM (image) data. We pretend 3 // component data is 4 component data to simplify processing later. /// @todo FIXME: this code assumes 3 component data is always 3*char if (pDICOMStack->m_iComponentCount == 3) { uint32_t iRGBADataSize = (iDataSize / 3) * 4; // Later we'll tell RAWConverter that this dataset has // m_iComponentCount components. Since we're upping the number of // components here, we update the component count too. pDICOMStack->m_iComponentCount = 4; // Do note that the number of components in the data and the number of // components in our in-memory copy of the data now differ. unsigned char *pRGBAData = new unsigned char[iRGBADataSize]; for (uint32_t k = 0;km_ivSize); iSize.z *= uint32_t(pDICOMStack->m_Elements.size()); /// \todo evaluate pDICOMStack->m_strModality /// \todo read `is floating point' property from DICOM, instead of assuming /// false. const uint64_t timesteps = 1; bool result = RAWConverter::ConvertRAWDataset(strTempMergeFilename, strTargetFilename, strTempDir, 0, pDICOMStack->m_iAllocated, pDICOMStack->m_iComponentCount, timesteps, pDICOMStack->m_bIsBigEndian != EndianConvert::IsBigEndian(), pDICOMStack->m_bSigned, false, iSize, pDICOMStack->m_fvfAspect, "DICOM stack", SysTools::GetFilename( pDICOMStack->m_Elements[0]->m_strFileName) + " to " + SysTools::GetFilename( pDICOMStack->m_Elements[ pDICOMStack->m_Elements.size()-1 ]->m_strFileName ), iMaxBrickSize, iBrickOverlap, m_bUseMedianFilter, m_bClampToEdge, m_iCompression, m_iCompressionLevel, m_iLayout, 0, bQuantizeTo8Bit ); if(remove(strTempMergeFilename.c_str()) != 0) { WARNING("Unable to remove temp file %s", strTempMergeFilename.c_str()); } return result; } else if(pStack->m_strFileType == "IMAGE") { MESSAGE(" Detected Image stack, starting image conversion"); MESSAGE(" Stack contains %u files", static_cast(pStack->m_Elements.size())); string strTempMergeFilename = strTempDir + SysTools::GetFilename(strTargetFilename) + "~"; MESSAGE("Creating intermediate file %s", strTempMergeFilename.c_str()); ofstream fs; fs.open(strTempMergeFilename.c_str(),fstream::binary); if (fs.fail()) { T_ERROR("Could not create temp file %s aborted conversion.", strTempMergeFilename.c_str()); return false; } vector vData; for (size_t j = 0;jm_Elements.size();j++) { pStack->m_Elements[j]->GetData(vData); fs.write(&vData[0], vData.size()); MESSAGE("Creating intermediate file %s\n%u%%", strTempMergeFilename.c_str(), static_cast((100*j)/pStack->m_Elements.size())); } fs.close(); MESSAGE(" done creating intermediate file %s", strTempMergeFilename.c_str()); UINT64VECTOR3 iSize = UINT64VECTOR3(pStack->m_ivSize); iSize.z *= uint32_t(pStack->m_Elements.size()); const string first_fn = SysTools::GetFilename(pStack->m_Elements[0]->m_strFileName); const size_t last_elem = pStack->m_Elements.size()-1; const string last_fn = SysTools::GetFilename(pStack->m_Elements[last_elem]->m_strFileName); const uint64_t timesteps = 1; // grab the number of components from the first file in the set. uint64_t components = pStack->m_Elements[0]->GetComponentCount(); bool result = RAWConverter::ConvertRAWDataset(strTempMergeFilename, strTargetFilename, strTempDir, 0, pStack->m_iAllocated, components, timesteps, pStack->m_bIsBigEndian != EndianConvert::IsBigEndian(), pStack->m_iComponentCount >= 32, false, iSize, pStack->m_fvfAspect, "Image stack", first_fn + " to " + last_fn, iMaxBrickSize, iBrickOverlap, m_bUseMedianFilter, m_bClampToEdge, m_iCompression, m_iCompressionLevel, m_iLayout); if(remove(strTempMergeFilename.c_str()) != 0) { WARNING("Unable to remove temp file %s", strTempMergeFilename.c_str()); } return result; } else { T_ERROR("Unknown source stack type %s", pStack->m_strFileType.c_str()); } return false; } #ifdef DETECTED_OS_WINDOWS #pragma warning(default:4996) #endif class MergeDataset { public: MergeDataset(std::string _strFilename="", uint64_t _iHeaderSkip=0, bool _bDelete=false, double _fScale=1.0, double _fBias=0.0) : strFilename(_strFilename), iHeaderSkip(_iHeaderSkip), bDelete(_bDelete), fScale(_fScale), fBias(_fBias) {} std::string strFilename; uint64_t iHeaderSkip; bool bDelete; double fScale; double fBias; }; template class DataMerger { public: DataMerger(const std::vector& strFiles, const std::string& strTarget, uint64_t iElemCount, tuvok::MasterController* pMasterController, bool bUseMaxMode) : bIsOK(false) { AbstrDebugOut& dbg = *(pMasterController->DebugOut()); dbg.Message(_func_,"Copying first file %s ...", SysTools::GetFilename(strFiles[0].strFilename).c_str()); if (!LargeRAWFile::Copy(strFiles[0].strFilename, strTarget, strFiles[0].iHeaderSkip)) { dbg.Error("Could not copy '%s' to '%s'", strFiles[0].strFilename.c_str(), strTarget.c_str()); bIsOK = false; return; } dbg.Message(_func_,"Merging ..."); LargeRAWFile target(strTarget); target.Open(true); if (!target.IsOpen()) { dbg.Error("Could not open '%s'", strTarget.c_str()); remove(strTarget.c_str()); bIsOK = false; return; } uint64_t iCopySize = std::min(iElemCount,BLOCK_COPY_SIZE/2)/sizeof(T); T* pTargetBuffer = new T[size_t(iCopySize)]; T* pSourceBuffer = new T[size_t(iCopySize)]; for (size_t i = 1;i( T(std::min( strFiles[0].fScale*(pTargetBuffer[j] + strFiles[0].fBias), static_cast(std::numeric_limits::max()) )), T(std::min( strFiles[i].fScale*(pSourceBuffer[j] + strFiles[i].fBias), static_cast(std::numeric_limits::max())) ) ); } } else { for (uint64_t j = 0;j( pTargetBuffer[j], T(std::min(strFiles[i].fScale*(pSourceBuffer[j] + strFiles[i].fBias), static_cast(std::numeric_limits::max()))) ); } } } else { if (i == 1) { for (uint64_t j = 0;j( strFiles[0].fScale*(pTargetBuffer[j] + strFiles[0].fBias), static_cast(std::numeric_limits::max()) )); T b = T(std::min( strFiles[i].fScale*(pSourceBuffer[j] + strFiles[i].fBias), static_cast(std::numeric_limits::max()) )); T val = a + b; if (val < a || val < b) // overflow pTargetBuffer[j] = std::numeric_limits::max(); else pTargetBuffer[j] = val; } } else { for (uint64_t j = 0;j( strFiles[i].fScale*(pSourceBuffer[j] + strFiles[i].fBias), static_cast(std::numeric_limits::max()) )); T val = pTargetBuffer[j] + b; if (val < pTargetBuffer[j] || val < b) // overflow pTargetBuffer[j] = std::numeric_limits::max(); else pTargetBuffer[j] = val; } } } target.SeekPos(iReadSize*sizeof(T)); target.WriteRAW((unsigned char*)pTargetBuffer, iCopySize*sizeof(T)); iReadSize += iCopySize; } while (iReadSize < iElemCount); source.Close(); } delete [] pTargetBuffer; delete [] pSourceBuffer; target.Close(); bIsOK = true; } bool IsOK() const {return bIsOK;} private: bool bIsOK; }; bool IOManager::MergeDatasets(const vector & strFilenames, const vector & vScales, const vector& vBiases, const string& strTargetFilename, const string& strTempDir, bool bUseMaxMode, bool bNoUserInteraction) const { MESSAGE("Request to merge multiple data sets into %s received.", strTargetFilename.c_str()); // convert the input files to RAW unsigned iComponentSizeG=0; uint64_t iComponentCountG=0; bool bConvertEndianessG=false; bool bSignedG=false; bool bIsFloatG=false; UINT64VECTOR3 vVolumeSizeG(0,0,0); FLOATVECTOR3 vVolumeAspectG(0,0,0); string strTitleG = "Merged data from multiple files"; stringstream ss; for (size_t i = 0;i vIntermediateFiles; for (size_t iInputData = 0;iInputData(iLODLevel)); vVolumeAspectG = FLOATVECTOR3(v.GetScale()); } else { #define DATA_TYPE_CHECK(a, b, errmsg) \ do { \ if(a != b) { \ T_ERROR("%s", errmsg); \ bRAWCreated = false; \ } \ } while(0) DATA_TYPE_CHECK(iComponentSizeG, v.GetBitWidth(), "mismatched bit widths."); DATA_TYPE_CHECK(iComponentCountG, v.GetComponentCount(), "different number of components."); DATA_TYPE_CHECK(bConvertEndianessG, !v.IsSameEndianness(), "mismatched endianness."); DATA_TYPE_CHECK(bSignedG, v.GetIsSigned(), "signedness differences"); DATA_TYPE_CHECK(bIsFloatG, v.GetIsFloat(), "some data float, other non-float."); DATA_TYPE_CHECK(vVolumeSizeG, v.GetDomainSize(static_cast(iLODLevel)), "different volume sizes"); #undef DATA_TYPE_CHECK if(bRAWCreated == false) { T_ERROR("Incompatible data types."); break; } if (vVolumeAspectG != FLOATVECTOR3(v.GetScale())) WARNING("Different aspect ratios found."); } IntermediateFile.strFilename = strTempDir + SysTools::GetFilename(strFilenames[iInputData]) + SysTools::ToString(rand()) +".raw"; IntermediateFile.bDelete = true; if (!v.Export(iLODLevel, IntermediateFile.strFilename, false)) { if (SysTools::FileExists(IntermediateFile.strFilename)) remove(IntermediateFile.strFilename.c_str()); break; } else bRAWCreated = true; vIntermediateFiles.push_back(IntermediateFile); } else { unsigned iComponentSize=0; uint64_t iComponentCount=0; bool bConvertEndianess=false; bool bSigned=false; bool bIsFloat=false; UINT64VECTOR3 vVolumeSize(0,0,0); FLOATVECTOR3 vVolumeAspect(0,0,0); string strTitle = ""; string strSource = ""; std::set> converters = identify_converters(strFilenames[iInputData], m_vpConverters.begin(), m_vpConverters.end()); typedef std::set>::const_iterator citer; for(citer conv = converters.begin(); conv != converters.end(); ++conv) { bRAWCreated = (*conv)->ConvertToRAW( strFilenames[iInputData], strTempDir, bNoUserInteraction, IntermediateFile.iHeaderSkip, iComponentSize, iComponentCount, bConvertEndianess, bSigned, bIsFloat, vVolumeSize, vVolumeAspect, strTitle, IntermediateFile.strFilename, IntermediateFile.bDelete ); strSource = SysTools::GetFilename(strFilenames[iInputData]); if(bRAWCreated) { MESSAGE("Conversion using '%s' succeeded!", (*conv)->GetDesc().c_str()); break; } } if (!bRAWCreated && (m_pFinalConverter != 0)) { bRAWCreated = m_pFinalConverter->ConvertToRAW( strFilenames[iInputData], strTempDir, bNoUserInteraction, IntermediateFile.iHeaderSkip, iComponentSize, iComponentCount, bConvertEndianess, bSigned, bIsFloat, vVolumeSize, vVolumeAspect, strTitle, IntermediateFile.strFilename, IntermediateFile.bDelete ); strSource = SysTools::GetFilename(strFilenames[iInputData]); } if (!bRAWCreated) { break; } vIntermediateFiles.push_back(IntermediateFile); if (iInputData == 0) { iComponentSizeG = iComponentSize; iComponentCountG = iComponentCount; bConvertEndianessG = bConvertEndianess; bSignedG = bSigned; bIsFloatG = bIsFloat; vVolumeSizeG = vVolumeSize; vVolumeAspectG = vVolumeAspect; } else { if (iComponentSizeG != iComponentSize || iComponentCountG != iComponentCount || bConvertEndianessG != bConvertEndianess || bSignedG != bSigned || bIsFloatG != bIsFloat || vVolumeSizeG != vVolumeSize) { T_ERROR("Incompatible data types."); bRAWCreated = false; break; } if (vVolumeAspectG != vVolumeAspect) WARNING("Different aspect ratios found."); } } } if (!bRAWCreated) { T_ERROR("No raw files. Deleting temp files..."); for (size_t i = 0;i= 32); switch (iComponentSizeG) { case 32 : { DataMerger d(vIntermediateFiles, strMergedFile, vVolumeSizeG.volume()*iComponentCountG, MCtlr, bUseMaxMode); bIsMerged = d.IsOK(); break; } case 64 : { DataMerger d(vIntermediateFiles, strMergedFile, vVolumeSizeG.volume()*iComponentCountG, MCtlr, bUseMaxMode); bIsMerged = d.IsOK(); break; } } } else { switch (iComponentSizeG) { case 8 : { DataMerger d(vIntermediateFiles, strMergedFile, vVolumeSizeG.volume()*iComponentCountG, MCtlr, bUseMaxMode); bIsMerged = d.IsOK(); break; } case 16 : { DataMerger d(vIntermediateFiles, strMergedFile, vVolumeSizeG.volume()*iComponentCountG, MCtlr, bUseMaxMode); bIsMerged = d.IsOK(); break; } case 32 : { DataMerger d(vIntermediateFiles, strMergedFile, vVolumeSizeG.volume()*iComponentCountG, MCtlr, bUseMaxMode); bIsMerged = d.IsOK(); break; } case 64 : { DataMerger d(vIntermediateFiles, strMergedFile, vVolumeSizeG.volume()*iComponentCountG, MCtlr, bUseMaxMode); bIsMerged = d.IsOK(); break; } } } } else { if (bIsFloatG) { // unsigned float ??? :-) T_ERROR("Don't know how to handle unsigned float data."); return false; } switch (iComponentSizeG) { case 8 : { DataMerger d(vIntermediateFiles, strMergedFile, vVolumeSizeG.volume()*iComponentCountG, MCtlr, bUseMaxMode); bIsMerged = d.IsOK(); break; } case 16 : { DataMerger d(vIntermediateFiles, strMergedFile, vVolumeSizeG.volume()*iComponentCountG, MCtlr, bUseMaxMode); bIsMerged = d.IsOK(); break; } case 32 : { DataMerger d(vIntermediateFiles, strMergedFile, vVolumeSizeG.volume()*iComponentCountG, MCtlr, bUseMaxMode); bIsMerged = d.IsOK(); break; } case 64 : { DataMerger d(vIntermediateFiles, strMergedFile, vVolumeSizeG.volume()*iComponentCountG, MCtlr, bUseMaxMode); bIsMerged = d.IsOK(); break; } } } MESSAGE("Removing temporary files..."); for (size_t i = 0;i& vStrSupportedExtTarget = m_vpConverters[k]->SupportedExt(); for (size_t l = 0;lConvertToNative( strMergedFile, strTargetFilename, 0, iComponentSizeG, iComponentCountG, bSignedG, bIsFloatG, vVolumeSizeG, vVolumeAspectG, bNoUserInteraction, false ); if(!bTargetCreated) { WARNING("%s said it could convert to native, but failed!", m_vpConverters[k]->GetDesc().c_str()); } else { break; } } } if (bTargetCreated) break; } } remove(strMergedFile.c_str()); return bTargetCreated; } bool IOManager::ConvertDataset(const string& strFilename, const string& strTargetFilename, const string& strTempDir, const bool bNoUserInteraction, const uint64_t iMaxBrickSize, const uint64_t iBrickOverlap, const bool bQuantizeTo8Bit) const { list files; files.push_back(strFilename); return ConvertDataset(files, strTargetFilename, strTempDir, bNoUserInteraction, iMaxBrickSize, iBrickOverlap, bQuantizeTo8Bit); } bool IOManager::ConvertDataset(const list& files, const string& strTargetFilename, const string& strTempDir, const bool bNoUserInteraction, const uint64_t iMaxBrickSize, uint64_t iBrickOverlap, bool bQuantizeTo8Bit) const { if(files.empty()) { T_ERROR("No files to convert?!"); return false; } { ostringstream request; request << "Request to convert datasets "; copy(files.begin(), files.end(), ostream_iterator(request, ", ")); request << "to " << strTargetFilename << " received."; MESSAGE("%s", request.str().c_str()); } // this might actually be a valid test case, if you want to compare // performance across brick sizes. However it's completely ridiculous in // actual use, and catches a confusing bug if you forget an argument in the // API call (which still compiles due to default arguments!). assert(iMaxBrickSize >= 8 && "Incredibly small bricks -- are you sure?"); /// @todo verify the list of files is `compatible': /// dimensions are the same /// all from the same file format /// all have equivalent bit depth, or at least something that'll convert to /// the same depth string strExt = SysTools::ToUpperCase(SysTools::GetExt(*files.begin())); string strExtTarget = SysTools::ToUpperCase(SysTools::GetExt(strTargetFilename)); if (strExtTarget == "UVF") { // Iterate through all our converters, stopping when one successfully // converts our data. std::set> converters = identify_converters(*files.begin(), m_vpConverters.begin(), m_vpConverters.end()); typedef std::set>::const_iterator citer; for(citer conv = converters.begin(); conv != converters.end(); ++conv) { if (!(*conv)->CanImportData()) continue; if((*conv)->ConvertToUVF(files, strTargetFilename, strTempDir, bNoUserInteraction, iMaxBrickSize, iBrickOverlap, m_bUseMedianFilter, m_bClampToEdge, m_iCompression, m_iCompressionLevel, m_iLayout, bQuantizeTo8Bit)) { return true; } else { WARNING("Converter %s can read files, but conversion failed!", (*conv)->GetDesc().c_str()); } } MESSAGE("No suitable automatic converter found!"); if (m_pFinalConverter != 0) { MESSAGE("Attempting fallback converter."); return m_pFinalConverter->ConvertToUVF(files, strTargetFilename, strTempDir, bNoUserInteraction, iMaxBrickSize, iBrickOverlap, m_bUseMedianFilter, m_bClampToEdge, m_iCompression, m_iCompressionLevel, m_iLayout, bQuantizeTo8Bit); } else { return false; } } if(files.size() > 1) { T_ERROR("Cannot convert multiple files to anything but UVF."); return false; } // Everything below is for exporting to non-UVF formats. string strFilename = *files.begin(); uint64_t iHeaderSkip=0; unsigned iComponentSize=0; uint64_t iComponentCount=0; bool bConvertEndianess=false; bool bSigned=false; bool bIsFloat=false; UINT64VECTOR3 vVolumeSize(0,0,0); FLOATVECTOR3 vVolumeAspect(0,0,0); string strTitle = ""; string strSource = ""; string strIntermediateFile = ""; bool bDeleteIntermediateFile = false; bool bRAWCreated = false; // source is UVF if (strExt == "UVF") { // max(): disable bricksize check UVFDataset v(strFilename,numeric_limits::max(),false,false); uint64_t iLODLevel = 0; // always extract the highest quality here iHeaderSkip = 0; iComponentSize = v.GetBitWidth(); iComponentCount = v.GetComponentCount(); bConvertEndianess = !v.IsSameEndianness(); bSigned = v.GetIsSigned(); bIsFloat = v.GetIsFloat(); vVolumeSize = v.GetDomainSize(static_cast(iLODLevel)); vVolumeAspect = FLOATVECTOR3(v.GetScale()); strTitle = "UVF data"; /// \todo grab this data from the UVF file strSource = SysTools::GetFilename(strFilename); strIntermediateFile = strTempDir + strSource +".raw"; bDeleteIntermediateFile = true; if (!v.Export(iLODLevel, strIntermediateFile, false)) { if (SysTools::FileExists(strIntermediateFile)) { RAWConverter::Remove(strIntermediateFile.c_str(), Controller::Debug::Out()); } return false; } else bRAWCreated = true; } else { // for non-UVF source data vector bytes(512); read_first_block(strFilename, bytes); std::set> converters = identify_converters(*files.begin(), m_vpConverters.begin(), m_vpConverters.end()); typedef std::set>::const_iterator citer; for(citer conv = converters.begin(); conv != converters.end(); ++conv) { if((*conv)->ConvertToRAW(strFilename, strTempDir, bNoUserInteraction,iHeaderSkip, iComponentSize, iComponentCount, bConvertEndianess, bSigned, bIsFloat, vVolumeSize, vVolumeAspect, strTitle, strIntermediateFile, bDeleteIntermediateFile)) { bRAWCreated = true; break; } } if (!bRAWCreated && (m_pFinalConverter != 0)) { MESSAGE("No converter can read the data. Trying fallback converter."); bRAWCreated = m_pFinalConverter->ConvertToRAW(strFilename, strTempDir, bNoUserInteraction, iHeaderSkip, iComponentSize, iComponentCount, bConvertEndianess, bSigned, bIsFloat, vVolumeSize, vVolumeAspect, strTitle, strIntermediateFile, bDeleteIntermediateFile); } } if (!bRAWCreated) { return false; } bool bTargetCreated = false; for (size_t k = 0;k& vStrSupportedExtTarget = m_vpConverters[k]->SupportedExt(); for (size_t l = 0;lConvertToNative(strIntermediateFile, strTargetFilename, iHeaderSkip, iComponentSize, iComponentCount, bSigned, bIsFloat, vVolumeSize, vVolumeAspect, bNoUserInteraction, bQuantizeTo8Bit); if (bTargetCreated) break; } } if (bTargetCreated) break; } if (bDeleteIntermediateFile) remove(strIntermediateFile.c_str()); if (bTargetCreated) return true; return false; } void IOManager::SetMemManLoadFunction( std::function& f ) { m_LoadDS = f; } Dataset* IOManager::LoadDataset(const string& strFilename, AbstrRenderer* requester) const { if(!m_LoadDS) { // logic error; you should have set this after creating the MemMgr! T_ERROR("Never set the internal LoadDS callback!"); throw tuvok::io::DSOpenFailed("Internal error; callback never set!", __FILE__, __LINE__); } return m_LoadDS(strFilename, requester); } Dataset* IOManager::LoadRebrickedDataset(const std::string& filename, const UINTVECTOR3 bricksize, size_t minmaxType) const { std::shared_ptr ds(this->CreateDataset(filename, 1024, false)); std::shared_ptr lid = std::dynamic_pointer_cast(ds); if(!lid) { T_ERROR("Can only rebrick a LinearIndexDataset, sorry."); return NULL; } if(minmaxType > DynamicBrickingDS::MM_DYNAMIC) { throw std::logic_error("minmaxType too large"); } if(bricksize.volume() == 0) { T_ERROR("null brick size"); return NULL; } // make sure the subdivision works; we need to be able to fit bricks within // the source bricks. but make sure not to include ghost data when we // calculate that! const UINTVECTOR3 overlap = lid->GetBrickOverlapSize() * 2; const UINTVECTOR3 src_bsize = lid->GetMaxBrickSize(); std::array tgt_bsize = {{ std::min(bricksize[0], src_bsize[0]), std::min(bricksize[1], src_bsize[1]), std::min(bricksize[2], src_bsize[2]) }}; for(unsigned i=0; i < 3; ++i) { if(((src_bsize[i]-overlap[i]) % (tgt_bsize[i]-overlap[i])) != 0) { T_ERROR("%u dimension target brick size (%u) is not a multiple of source " "brick size (%u)", i, tgt_bsize[i] - overlap[i], src_bsize[i] - overlap[i]); return NULL; } } const size_t cache_size = static_cast( 0.80f * Controller::ConstInstance().SysInfo().GetMaxUsableCPUMem() ); enum DynamicBrickingDS::MinMaxMode mm = static_cast(minmaxType); return new DynamicBrickingDS(lid, tgt_bsize, cache_size, mm); } Dataset* IOManager::CreateDataset(const string& filename, uint64_t max_brick_size, bool verify) const { MESSAGE("Searching for appropriate DS for '%s'", filename.c_str()); return m_dsFactory->Create(filename, max_brick_size, verify); } void IOManager::AddReader(shared_ptr ds) { m_dsFactory->AddReader(ds); } class MCData { public: MCData(const std::string& strTargetFile) : m_strTargetFile(strTargetFile) {} virtual ~MCData() {} virtual bool PerformMC(void* pData, const UINTVECTOR3& vBrickSize, const UINT64VECTOR3& vBrickOffset) = 0; protected: std::string m_strTargetFile; }; bool MCBrick(void* pData, const UINT64VECTOR3& vBrickSize, const UINT64VECTOR3& vBrickOffset, void* pUserContext) { MCData* pMCData = (MCData*)pUserContext; return pMCData->PerformMC(pData, UINTVECTOR3(vBrickSize), vBrickOffset); } bool IOManager::ExtractImageStack(const tuvok::UVFDataset* pSourceData, const TransferFunction1D* pTrans, uint64_t iLODlevel, const std::string& strTargetFilename, const std::string& strTempDir, bool bAllDirs) const { string strTempFilename = SysTools::FindNextSequenceName(strTempDir + SysTools::GetFilename(strTargetFilename)+".tmp_raw"); if (pSourceData->GetIsFloat() || pSourceData->GetIsSigned()) { T_ERROR("Stack export currently only supported for unsigned integer values."); return false; } if (pSourceData->GetComponentCount() > 4) { T_ERROR("Only up to four component data supported"); return false; } MESSAGE("Extracting Data"); bool bRAWCreated = pSourceData->Export(iLODlevel, strTempFilename, false); if (!bRAWCreated) { T_ERROR("Unable to write temp file %s", strTempFilename.c_str()); return false; } MESSAGE("Writing stacks"); double fMaxActValue = (pSourceData->GetRange().first > pSourceData->GetRange().second) ? pTrans->GetSize() : pSourceData->GetRange().second; bool bTargetCreated = StackExporter::WriteStacks(strTempFilename, strTargetFilename, pTrans, pSourceData->GetBitWidth(), pSourceData->GetComponentCount(), float(pTrans->GetSize() / fMaxActValue), pSourceData->GetDomainSize(static_cast(iLODlevel)), bAllDirs); remove(strTempFilename.c_str()); if (!bTargetCreated) { T_ERROR("Unable to write target file %s", strTargetFilename.c_str()); return false; } MESSAGE("Done!"); return bTargetCreated; } template class MCDataTemplate : public MCData { public: MCDataTemplate(const std::string& strTargetFile, T TIsoValue, const FLOATVECTOR3& vScale, UINT64VECTOR3 vDataSize, tuvok::AbstrGeoConverter* conv, const FLOATVECTOR4& vColor) : MCData(strTargetFile), m_TIsoValue(TIsoValue), m_iIndexoffset(0), m_pMarchingCubes(new MarchingCubes()), m_vDataSize(vDataSize), m_conv(conv), m_vColor(vColor), m_vScale(vScale) { } virtual ~MCDataTemplate() { tuvok::Mesh m = tuvok::Mesh(m_vertices, m_normals, tuvok::TexCoordVec(), tuvok::ColorVec(), m_indices, m_indices, tuvok::IndexVec(),tuvok::IndexVec(), false,false,"Marching Cubes mesh by ImageVis3D", tuvok::Mesh::MT_TRIANGLES); m.SetDefaultColor(m_vColor); m_conv->ConvertToNative(m, m_strTargetFile); } virtual bool PerformMC(void* pData, const UINTVECTOR3& vBrickSize, const UINT64VECTOR3& vBrickOffset) { T* ptData = (T*)pData; // extract isosurface m_pMarchingCubes->SetVolume(vBrickSize.x, vBrickSize.y, vBrickSize.z, ptData); m_pMarchingCubes->Process(m_TIsoValue); // brick scale float fMaxSize = (FLOATVECTOR3(m_vDataSize) * m_vScale).maxVal(); FLOATVECTOR3 vecBrickOffset(vBrickOffset); vecBrickOffset = vecBrickOffset * m_vScale; for (int i = 0;im_Isosurface->iVertices;i++) { m_vertices.push_back((m_pMarchingCubes->m_Isosurface->vfVertices[i]+vecBrickOffset-FLOATVECTOR3(m_vDataSize)/2.0f)/fMaxSize); } for (int i = 0;im_Isosurface->iVertices;i++) { m_normals.push_back(m_pMarchingCubes->m_Isosurface->vfNormals[i]); } for (int i = 0;im_Isosurface->iTriangles;i++) { m_indices.push_back(m_pMarchingCubes->m_Isosurface->viTriangles[i].x+m_iIndexoffset); m_indices.push_back(m_pMarchingCubes->m_Isosurface->viTriangles[i].y+m_iIndexoffset); m_indices.push_back(m_pMarchingCubes->m_Isosurface->viTriangles[i].z+m_iIndexoffset); } m_iIndexoffset += m_pMarchingCubes->m_Isosurface->iVertices; return true; } protected: T m_TIsoValue; uint32_t m_iIndexoffset; std::shared_ptr> m_pMarchingCubes; UINT64VECTOR3 m_vDataSize; tuvok::AbstrGeoConverter* m_conv; FLOATVECTOR4 m_vColor; FLOATVECTOR3 m_vScale; tuvok::VertVec m_vertices; tuvok::NormVec m_normals; tuvok::IndexVec m_indices; }; bool IOManager::ExtractIsosurface(const tuvok::UVFDataset* pSourceData, uint64_t iLODlevel, double fIsovalue, const FLOATVECTOR4& vfColor, const string& strTargetFilename, const string& strTempDir) const { if (pSourceData->GetComponentCount() != 1) { T_ERROR("Isosurface extraction only supported for scalar volumes."); return false; } string strTempFilename = strTempDir + SysTools::GetFilename(strTargetFilename)+".tmp_raw"; std::shared_ptr pMCData; bool bFloatingPoint = pSourceData->GetIsFloat(); bool bSigned = pSourceData->GetIsSigned(); unsigned iComponentSize = pSourceData->GetBitWidth(); FLOATVECTOR3 vScale = FLOATVECTOR3(pSourceData->GetScale()); AbstrGeoConverter* conv = GetGeoConverterForExt(SysTools::ToLowerCase(SysTools::GetExt(strTargetFilename)),true, false); if (conv == NULL) { T_ERROR("Unknown Mesh Format."); return false; } UINT64VECTOR3 vDomainSize = pSourceData->GetDomainSize(size_t(iLODlevel)); if (bFloatingPoint) { if (bSigned) { switch (iComponentSize) { case 32: pMCData.reset(new MCDataTemplate(strTargetFilename, float(fIsovalue), vScale, vDomainSize, conv, vfColor )); break; case 64: pMCData.reset(new MCDataTemplate(strTargetFilename, double(fIsovalue), vScale, vDomainSize, conv, vfColor )); break; } } } else { if (bSigned) { switch (iComponentSize) { case 8: pMCData.reset(new MCDataTemplate(strTargetFilename, char(fIsovalue), vScale, vDomainSize, conv, vfColor )); break; case 16: pMCData.reset(new MCDataTemplate(strTargetFilename, short(fIsovalue), vScale, vDomainSize, conv, vfColor )); break; case 32: pMCData.reset(new MCDataTemplate(strTargetFilename, int(fIsovalue), vScale, vDomainSize, conv, vfColor )); break; case 64: pMCData.reset(new MCDataTemplate(strTargetFilename, int64_t(fIsovalue), vScale, vDomainSize, conv, vfColor )); break; } } else { switch (iComponentSize) { case 8: pMCData.reset(new MCDataTemplate(strTargetFilename, (unsigned char)(fIsovalue), vScale, vDomainSize, conv, vfColor )); break; case 16: pMCData.reset(new MCDataTemplate(strTargetFilename, (unsigned short)(fIsovalue), vScale, vDomainSize, conv, vfColor )); break; case 32: pMCData.reset(new MCDataTemplate(strTargetFilename, uint32_t(fIsovalue), vScale, vDomainSize, conv, vfColor )); break; case 64: pMCData.reset(new MCDataTemplate(strTargetFilename, uint64_t(fIsovalue), vScale, vDomainSize, conv, vfColor )); break; } } } if (!pMCData) { T_ERROR("Unsupported data format."); return false; } bool bResult = pSourceData->ApplyFunction(iLODlevel,&MCBrick, (void*)pMCData.get(), 1); if (SysTools::FileExists(strTempFilename)) remove (strTempFilename.c_str()); if (bResult) return true; else { remove (strTargetFilename.c_str()); T_ERROR("Export call failed."); return false; } } bool IOManager::ExportMesh(const std::shared_ptr mesh, const std::string& strTargetFilename) { AbstrGeoConverter* conv = GetGeoConverterForExt(SysTools::ToLowerCase(SysTools::GetExt(strTargetFilename)),true, false); if (conv == NULL) { T_ERROR("Unknown Mesh Format."); return false; } return conv->ConvertToNative(*mesh, strTargetFilename); } bool IOManager::ExportDataset(const UVFDataset* pSourceData, uint64_t iLODlevel, const string& strTargetFilename, const string& strTempDir) const { // find the right converter to handle the output string strExt = SysTools::ToUpperCase(SysTools::GetExt(strTargetFilename)); std::shared_ptr pExporter; for (size_t i = 0;i& vStrSupportedExt = m_vpConverters[i]->SupportedExt(); for (size_t j = 0;jExport(iLODlevel, strTempFilename, false); if (!bRAWCreated) { T_ERROR("Unable to write temp file %s", strTempFilename.c_str()); return false; } MESSAGE("Writing Target Dataset"); bool bTargetCreated = false; try { bTargetCreated = pExporter->ConvertToNative( strTempFilename, strTargetFilename, 0, pSourceData->GetBitWidth(), pSourceData->GetComponentCount(), pSourceData->GetIsSigned(), pSourceData->GetIsFloat(), pSourceData->GetDomainSize(static_cast(iLODlevel)), FLOATVECTOR3(pSourceData->GetScale()), false, false ); remove(strTempFilename.c_str()); } catch (const tuvok::io::DSOpenFailed& err) { T_ERROR("Unable to write target file %s", err.what()); return false; } if (!bTargetCreated) { T_ERROR("Unable to write target file %s", strTargetFilename.c_str()); return false; } MESSAGE("Done!"); return bTargetCreated; } // Try to find the reader for the filename. If we get back garbage, that must // mean we can't read this. If we can't read it, it needs to be converted. // All your data are belong to us. bool IOManager::NeedsConversion(const string& strFilename) const { const weak_ptr reader = m_dsFactory->Reader(strFilename); return reader.expired(); } // Some readers checksum the data. If they do, this is how the UI will access // that verification method. bool IOManager::Verify(const string& strFilename) const { const weak_ptr reader = m_dsFactory->Reader(strFilename); // I swear I did not purposely choose words so that this text aligned. assert(!reader.expired() && "Impossible; we wouldn't have reached this code " "unless we thought that the format doesn't need " "conversion. But we only think it doesn't need " "conversion when there's a known reader for the " "file."); // Upcast it. Hard to verify a checksum on an abstract entity. const shared_ptr fileds = dynamic_pointer_cast(reader.lock()); return fileds->Verify(strFilename); } using namespace tuvok; using namespace tuvok::io; std::string IOManager::GetImageExportDialogString() const { std::vector> formats = StackExporter::GetSuportedImageFormats(); string strDialog = "All known Files ( "; for(size_t i = 0; i< formats.size(); ++i) { strDialog += "*." + SysTools::ToLowerCase(formats[i].first) + " "; } strDialog += ");;"; for(size_t i = 0; i< formats.size(); ++i) { strDialog += formats[i].second + " (*." + SysTools::ToLowerCase(formats[i].first) + ");;"; } return strDialog; } std::string IOManager::ImageExportDialogFilterToExt(const string& filter) const { std::vector> formats = StackExporter::GetSuportedImageFormats(); for(size_t i = 0; i< formats.size(); ++i) { std::string strDialog = formats[i].second + " (*." + SysTools::ToLowerCase(formats[i].first) + ")"; if ( filter == strDialog ) return SysTools::ToLowerCase(formats[i].first); } return ""; } string IOManager::GetLoadDialogString() const { string strDialog = "All known Files ("; map descPairs; // first create the show all text entry // native formats const DSFactory::DSList& readers = m_dsFactory->Readers(); for(DSFactory::DSList::const_iterator rdr=readers.begin(); rdr != readers.end(); ++rdr) { const shared_ptr fileds = dynamic_pointer_cast(*rdr); const list extensions = fileds->Extensions(); for(list::const_iterator ext = extensions.begin(); ext != extensions.end(); ++ext) { strDialog += "*." + SysTools::ToLowerCase(*ext) + " "; descPairs[*ext] = (*rdr)->Name(); } } // converters for (size_t i = 0;iCanImportData()) { for (size_t j = 0;jSupportedExt().size();j++) { string strExt = SysTools::ToLowerCase(m_vpConverters[i]->SupportedExt()[j]); if (descPairs.count(strExt) == 0) { strDialog = strDialog + "*." + strExt + " "; descPairs[strExt] = m_vpConverters[i]->GetDesc(); } } } } strDialog += ");;"; // now create the separate entries, i.e. just UVFs, just TIFFs, etc. // native formats for(DSFactory::DSList::const_iterator rdr=readers.begin(); rdr != readers.end(); ++rdr) { const shared_ptr fileds = dynamic_pointer_cast(*rdr); const list extensions = fileds->Extensions(); strDialog += string(fileds->Name()) + " ("; for(list::const_iterator ext = extensions.begin(); ext != extensions.end(); ++ext) { strDialog += "*." + SysTools::ToLowerCase(*ext) + " "; descPairs[*ext] = (*rdr)->Name(); } strDialog += ");;"; } // converters for (size_t i=0; i < m_vpConverters.size(); i++) { if (m_vpConverters[i]->CanImportData()) { strDialog += m_vpConverters[i]->GetDesc() + " ("; for (size_t j=0; j < m_vpConverters[i]->SupportedExt().size(); j++) { string strExt = SysTools::ToLowerCase(m_vpConverters[i]->SupportedExt()[j]); strDialog += "*." + strExt; if (jSupportedExt().size()-1) strDialog += " "; } strDialog += ");;"; } } strDialog += "All Files (*)"; return strDialog; } string IOManager::GetExportDialogString() const { string strDialog; // separate entries for (size_t i=0; i < m_vpConverters.size(); i++) { if (m_vpConverters[i]->CanExportData()) { for (size_t j=0; j < m_vpConverters[i]->SupportedExt().size(); j++) { string strExt = SysTools::ToLowerCase(m_vpConverters[i]->SupportedExt()[j]); strDialog += m_vpConverters[i]->GetDesc() + " (*." + strExt + ");;"; } } } return strDialog; } std::string IOManager::ExportDialogFilterToExt(const string& filter) const { std::vector> formats = StackExporter::GetSuportedImageFormats(); for(size_t i = 0; i< formats.size(); ++i) { if (m_vpConverters[i]->CanExportData()) { for (size_t j=0; j < m_vpConverters[i]->SupportedExt().size(); j++) { string strExt = SysTools::ToLowerCase(m_vpConverters[i]->SupportedExt()[j]); std::string strDialog = m_vpConverters[i]->GetDesc() + " (*." + strExt + ")"; if ( filter == strDialog ) return SysTools::ToLowerCase(strExt); } } } return ""; } vector> IOManager::GetExportFormatList() const { vector> v; v.push_back(make_pair("UVF", "Universal Volume Format")); for (size_t i = 0;iCanExportData()) { for (size_t j = 0;jSupportedExt().size();j++) { v.push_back( make_pair(SysTools::ToLowerCase(m_vpConverters[i]->SupportedExt()[j]), m_vpConverters[i]->GetDesc())); } } } return v; } vector> IOManager::GetImportFormatList() const { vector> v; v.push_back(make_pair("UVF", "Universal Volume Format")); for (size_t i = 0;iCanImportData()) { for (size_t j = 0;jSupportedExt().size();j++) { v.push_back( make_pair(SysTools::ToLowerCase(m_vpConverters[i]->SupportedExt()[j]), m_vpConverters[i]->GetDesc())); } } } return v; } vector< tConverterFormat > IOManager::GetFormatList() const { vector< tConverterFormat > v; v.push_back(make_tuple("UVF", "Universal Volume Format", true, true)); for (size_t i = 0;iSupportedExt().size();j++) { v.push_back(make_tuple( SysTools::ToLowerCase( m_vpConverters[i]->SupportedExt()[j] ), m_vpConverters[i]->GetDesc(), m_vpConverters[i]->CanExportData(), m_vpConverters[i]->CanImportData())); } } return v; } std::shared_ptr IOManager::GetConverterForExt(std::string ext, bool bMustSupportExport, bool bMustSupportImport) const { for (size_t i = 0;iCanExportData()) && (!bMustSupportImport || m_vpConverters[i]->CanImportData())) { for (size_t j = 0;jSupportedExt().size();j++) { string convExt = SysTools::ToLowerCase(m_vpConverters[i]->SupportedExt()[j]); if (ext == convExt) return m_vpConverters[i]; } } } return NULL; } AbstrGeoConverter* IOManager::GetGeoConverterForExt(std::string ext, bool bMustSupportExport, bool bMustSupportImport) const { for (size_t i = 0;iCanExportData()) && (!bMustSupportImport || m_vpGeoConverters[i]->CanImportData())) { for (size_t j = 0;jSupportedExt().size();j++) { string convExt = SysTools::ToLowerCase(m_vpGeoConverters[i]->SupportedExt()[j]); if (ext == convExt) return m_vpGeoConverters[i]; } } } return NULL; } string IOManager::GetLoadGeoDialogString() const { string strDialog = "All known Geometry Files ("; map descPairs; // converters for (size_t i = 0;iCanImportData()) { for (size_t j = 0;jSupportedExt().size();j++) { string strExt = SysTools::ToLowerCase(m_vpGeoConverters[i]->SupportedExt()[j]); if (descPairs.count(strExt) == 0) { strDialog = strDialog + "*." + strExt + " "; descPairs[strExt] = m_vpGeoConverters[i]->GetDesc(); } } } } strDialog += ");;"; // now create the separate entries, i.e. just OBJs, TRIs, etc. for (size_t i=0; i < m_vpGeoConverters.size(); i++) { if (m_vpGeoConverters[i]->CanImportData()) { strDialog += m_vpGeoConverters[i]->GetDesc() + " ("; for (size_t j=0; j < m_vpGeoConverters[i]->SupportedExt().size(); j++) { string strExt = SysTools::ToLowerCase(m_vpGeoConverters[i]->SupportedExt()[j]); strDialog += "*." + strExt; if (jSupportedExt().size()-1) strDialog += " "; } strDialog += ");;"; } } strDialog += "All Files (*)"; return strDialog; } string IOManager::GetGeoExportDialogString() const { string strDialog; // separate entries for (size_t i=0; i < m_vpGeoConverters.size(); i++) { if (m_vpGeoConverters[i]->CanExportData()) { for (size_t j=0; j < m_vpGeoConverters[i]->SupportedExt().size(); j++) { string strExt = SysTools::ToLowerCase(m_vpGeoConverters[i]->SupportedExt()[j]); strDialog += m_vpGeoConverters[i]->GetDesc() + " (*." + strExt + ");;"; } } } return strDialog; } vector> IOManager::GetGeoExportFormatList() const { vector> v; for (size_t i = 0;iSupportedExt().size();j++) { if (m_vpGeoConverters[i]->CanExportData()) { v.push_back( make_pair(SysTools::ToLowerCase(m_vpGeoConverters[i]->SupportedExt()[j]), m_vpGeoConverters[i]->GetDesc())); } } } return v; } vector> IOManager::GetGeoImportFormatList() const { vector> v; for (size_t i = 0;iCanImportData()) { for (size_t j = 0;jSupportedExt().size();j++) { v.push_back( make_pair(SysTools::ToLowerCase(m_vpGeoConverters[i]->SupportedExt()[j]), m_vpGeoConverters[i]->GetDesc())); } } } return v; } vector< tConverterFormat > IOManager::GetGeoFormatList() const { vector< tConverterFormat > v; for (size_t i = 0;iSupportedExt().size();j++) { v.push_back(make_tuple( SysTools::ToLowerCase( m_vpGeoConverters[i]->SupportedExt()[j] ), m_vpGeoConverters[i]->GetDesc(), m_vpGeoConverters[i]->CanExportData(), m_vpGeoConverters[i]->CanImportData())); } } return v; } bool IOManager::AnalyzeDataset(const string& strFilename, RangeInfo& info, const string& strTempDir) const { // find the right converter to handle the dataset string strExt = SysTools::ToUpperCase(SysTools::GetExt(strFilename)); if (strExt == "UVF") { UVFDataset v(strFilename,m_iMaxBrickSize,false); uint64_t iComponentCount = v.GetComponentCount(); bool bSigned = v.GetIsSigned(); bool bIsFloat = v.GetIsFloat(); if (iComponentCount != 1) return false; // only scalar data supported at the moment info.m_fRange.first = v.GetRange().first; info.m_fRange.second = v.GetRange().second; // as our UVFs are always quantized to either 8bit or 16bit right now only the // nonfloat + unsigned path is taken, the others are for future extensions if (bIsFloat) { info.m_iValueType = 0; } else { if (bSigned) { info.m_iValueType = 1; } else { info.m_iValueType = 2; } } info.m_vAspect = FLOATVECTOR3(v.GetScale()); info.m_vDomainSize = v.GetDomainSize(); info.m_iComponentSize = v.GetBitWidth(); return true; } else { bool bAnalyzed = false; for (size_t i = 0;i& vStrSupportedExt = m_vpConverters[i]->SupportedExt(); for (size_t j = 0;jAnalyze(strFilename, strTempDir, false, info); if (bAnalyzed) break; } } if (bAnalyzed) break; } if (!bAnalyzed && (m_pFinalConverter != 0)) { bAnalyzed = m_pFinalConverter->Analyze(strFilename, strTempDir, false, info); } return bAnalyzed; } } struct MergeableDatasets : public std::binary_function { bool operator()(const Dataset& a, const Dataset& b) const { if(a.GetComponentCount() != b.GetComponentCount() || a.GetBrickOverlapSize() != b.GetBrickOverlapSize()) { return false; } const uint64_t timesteps = a.GetNumberOfTimesteps(); if(timesteps != b.GetNumberOfTimesteps()) { return false; } const unsigned LoDs = a.GetLODLevelCount(); if(LoDs != b.GetLODLevelCount()) { return false; } for(uint64_t ts=0; ts < timesteps; ++ts) { for(uint64_t level=0; level < LoDs; ++level) { const size_t st_ts = static_cast(ts); const size_t st_level = static_cast(level); if(a.GetDomainSize() != b.GetDomainSize() || a.GetBrickCount(st_level, st_ts) != b.GetBrickCount(st_level, st_ts)) { return false; } } } return true; } }; namespace { // interpolate a chunk of data into a new range. template void interpolate(IForwIter ibeg, IForwIter iend, const std::pair& src_range, OForwIter obeg) { const U max_out = std::numeric_limits::max(); assert(src_range.second >= src_range.first); const double diff = src_range.second - src_range.first; const double ifactor = max_out / diff; while(ibeg != iend) { *obeg = static_cast((*ibeg - src_range.first) * ifactor); ++obeg; ++ibeg; } } } const std::shared_ptr GetFirstRDB(const UVF& uvf) { for(uint64_t i=0; i < uvf.GetDataBlockCount(); ++i) { if(uvf.GetDataBlock(i)->GetBlockSemantic() == UVFTables::BS_REG_NDIM_GRID) { return std::dynamic_pointer_cast (uvf.GetDataBlock(i)); } } return NULL; } namespace { template std::pair mm_init_dispatch(signed_tag) { return std::make_pair( std::numeric_limits::max(), -std::numeric_limits::max()); } template std::pair mm_init_dispatch(unsigned_tag) { return std::make_pair(std::numeric_limits::min(), std::numeric_limits::max()); } template std::pair mm_init() { typedef typename ctti::sign_tag signedness; signedness s; return mm_init_dispatch(s); } // a minmax algorithm that doesn't suck. Namely, it takes an input iterator // instead of a forward iterator, *as it should*. Jesus. // Also it returns 'T's, so you don't have to deref the return value. template std::pair minmax_input(InputIterator begin, InputIterator end) { std::pair retval = mm_init(); while(begin != end) { retval.first = std::min(*begin, retval.first); retval.second = std::max(*begin, retval.second); ++begin; } return retval; } } // converts 1D brick indices into RDB's indices. std::vector NDBrickIndex(const RasterDataBlock* rdb, size_t LoD, size_t b) { uint64_t brick = static_cast(b); std::vector lod(1); lod[0] = LoD; const std::vector& counts = rdb->GetBrickCount(lod); uint64_t z = static_cast(brick / (counts[0] * counts[1])); brick = brick % (counts[0] * counts[1]); uint64_t y = static_cast(brick / counts[0]); brick = brick % counts[0]; uint64_t x = brick; std::vector vec(3); vec[0] = x; vec[1] = y; vec[2] = z; return vec; } namespace { /// Computes the minimum and maximum for a single brick in a raster data block. template DOUBLEVECTOR4 get_brick_minmax(const RasterDataBlock* rdb, const std::vector& vLOD, const std::vector& vBrick) { DOUBLEVECTOR4 mmv; // min/max of gradients not supported... mmv.z = -std::numeric_limits::max(); mmv.w = std::numeric_limits::max(); std::vector data; rdb->GetData(data, vLOD, vBrick); std::pair mm = minmax_input(data.begin(), data.end()); mmv.x = mm.first; mmv.y = mm.second; return mmv; } } /// Calculates the min/max scalar and gradient for every brick in a data set. std::vector MaxMin(const RasterDataBlock* rdb) { const bool is_signed = rdb->bSignedElement[0][0]; const uint64_t bit_width = rdb->ulElementBitSize[0][0]; const bool is_float = bit_width != rdb->ulElementMantissa[0][0]; std::vector mm; // We iterate over each LoD. At each one, we iterate through the bricks. // When a GetData fails for that brick, we know we need to move on to the // next LoD. When a GetData fails and we're at brick 0, we know we're done // with all of the LoDs. std::vector vLOD(1); size_t brick; vLOD[0] = 0; do { brick = 0; size_t st_lod = static_cast(vLOD[0]); do { std::vector b_idx = NDBrickIndex(rdb, st_lod, brick); assert(rdb->ValidBrickIndex(vLOD, b_idx)); /* MESSAGE("%llu,%zu -> %llu,%llu,%llu", vLOD[0], brick, b_idx[0], b_idx[1], b_idx[2]); */ if(is_float && bit_width == 32) { assert(is_signed); mm.push_back(get_brick_minmax(rdb, vLOD, b_idx)); } else if(is_float && bit_width == 64) { assert(is_signed); mm.push_back(get_brick_minmax(rdb, vLOD, b_idx)); } else if( is_signed && 8 == bit_width) { mm.push_back(get_brick_minmax(rdb, vLOD, b_idx)); } else if(!is_signed && 8 == bit_width) { mm.push_back(get_brick_minmax(rdb, vLOD, b_idx)); } else if( is_signed && 16 == bit_width) { mm.push_back(get_brick_minmax(rdb, vLOD, b_idx)); } else if(!is_signed && 16 == bit_width) { mm.push_back(get_brick_minmax(rdb, vLOD, b_idx)); } else if( is_signed && 32 == bit_width) { mm.push_back(get_brick_minmax(rdb, vLOD, b_idx)); } else if(!is_signed && 32 == bit_width) { mm.push_back(get_brick_minmax(rdb, vLOD, b_idx)); } else if( is_signed && 64 == bit_width) { T_ERROR("int64_t unsupported..."); double mn = -std::numeric_limits::max(); double mx = std::numeric_limits::max(); mm.push_back(DOUBLEVECTOR4(mn,mx, mn,mx)); assert(1 == 0); } else if(!is_signed && 64 == bit_width) { T_ERROR("uint64_t unsupported..."); double mn = -std::numeric_limits::max(); double mx = std::numeric_limits::max(); mm.push_back(DOUBLEVECTOR4(mn,mx, mn,mx)); assert(1 == 0); } else { T_ERROR("Unsupported data type!"); assert(1 == 0); } MESSAGE("Finished lod,brick %u,%u", static_cast(vLOD[0]), static_cast(brick)); ++brick; } while(rdb->ValidBrickIndex(vLOD, NDBrickIndex(rdb, st_lod, brick))); vLOD[0]++; st_lod = static_cast(vLOD[0]); } while(rdb->ValidLOD(vLOD)); return mm; } void CreateUVFFromRDB(const std::string& filename, const std::shared_ptr& rdb) { std::wstring wide_fn(filename.begin(), filename.end()); UVF outuvf(wide_fn); outuvf.Create(); GlobalHeader gh; gh.bIsBigEndian = EndianConvert::IsBigEndian(); gh.ulChecksumSemanticsEntry = UVFTables::CS_MD5; outuvf.SetGlobalHeader(gh); outuvf.AddConstDataBlock(rdb); // create maxmin accel structures. We'll need the maximum scalar // later, too, for computation of the 2D histogram. double max_val = DBL_MAX; { const size_t components = static_cast(rdb->ulElementDimensionSize[0]); std::shared_ptr mmdb(new MaxMinDataBlock(components)); std::vector minmax = MaxMin(rdb.get()); MESSAGE("found %u brick min/maxes...", static_cast(minmax.size())); for(std::vector::const_iterator i = minmax.begin(); i != minmax.end(); ++i) { // get the maximum maximum (that makes sense, I swear ;) max_val = std::max(max_val, i->y); // merge in the current brick's minmax. mmdb->StartNewValue(); std::vector tmp(1); tmp[0] = *i; mmdb->MergeData(tmp); } outuvf.AddDataBlock(mmdb); } { // histograms std::shared_ptr hist1d( new Histogram1DDataBlock() ); hist1d->Compute(rdb.get()); outuvf.AddDataBlock(hist1d); { std::shared_ptr hist2d( new Histogram2DDataBlock() ); hist2d->Compute(rdb.get(), hist1d->GetHistogram().size(), max_val); outuvf.AddDataBlock(hist2d); } } outuvf.Close(); } // Identifies the 'widest' type that is utilized in a series of UVFs. // For example, if we've got FP data in one UVF and unsigned bytes in // another, the 'widest' type is FP. void IdentifyType(const std::vector>& uvf, size_t& bit_width, bool& is_float, bool &is_signed) { bit_width = 0; is_float = false; is_signed = false; for(size_t i=0; i < uvf.size(); ++i) { bit_width = std::max(bit_width, static_cast(uvf[i]->GetBitWidth())); is_float = std::max(is_float, uvf[i]->GetIsFloat()); is_signed = std::max(is_signed, uvf[i]->GetIsSigned()); } } // Reads in data of the given type. If data is not stored that way in // the file, it will expand it out to the given type. Assumes it will // always be expanding data, never compressing it! template void TypedRead(std::vector& data, const Dataset& ds, const BrickKey& key) { size_t width = static_cast(ds.GetBitWidth()); bool is_signed = ds.GetIsSigned(); bool is_float = ds.GetIsFloat(); size_t dest_width = sizeof(T) * 8; bool dest_signed = ctti::is_signed; bool dest_float = std::is_floating_point::value; // fp data implies signed data. assert(is_float ? is_signed : true); assert(dest_float ? dest_signed : true); MESSAGE(" [Source Data] Signed: %d Float: %d Width: %u", is_signed, is_float, static_cast(width)); MESSAGE(" [Destination] Signed: %d Float: %d Width: %u", dest_signed, dest_float, static_cast(dest_width)); // If we're lucky, we can just read the data and be done with it. if(dest_width == width && dest_signed == is_signed && dest_float == is_float) { MESSAGE("Data is stored the way we need it! Yay."); ds.GetBrick(key, data); return; } // Otherwise we'll need to read it into a temporary buffer and expand // it into the argument vector. std::pair range = ds.GetRange(); if(is_float && width == 32) { std::vector tmpdata; ds.GetBrick(key, tmpdata); data.resize(tmpdata.size() / (width/8)); interpolate::iterator, T>( &tmpdata[0], (&tmpdata[0]) + tmpdata.size(), range, data.begin() ); } else if(is_float && width == 64) { // Can this happen? What would we expand double into? std::vector tmpdata; ds.GetBrick(key, tmpdata); data.resize(tmpdata.size() / (width/8)); interpolate::iterator, T>( &tmpdata[0], (&tmpdata[0]) + tmpdata.size(), range, data.begin() ); } else if( is_signed && 8 == width) { std::vector tmpdata; ds.GetBrick(key, tmpdata); data.resize(tmpdata.size() / (width/8)); interpolate::iterator, T>( &tmpdata[0], (&tmpdata[0]) + tmpdata.size(), range, data.begin() ); } else if(!is_signed && 8 == width) { std::vector tmpdata; ds.GetBrick(key, tmpdata); data.resize(tmpdata.size() / (width/8)); interpolate::iterator, T>( &tmpdata[0], (&tmpdata[0]) + tmpdata.size(), range, data.begin() ); } else if( is_signed && 16 == width) { std::vector tmpdata; ds.GetBrick(key, tmpdata); data.resize(tmpdata.size() / (width/8)); interpolate::iterator, T>( &tmpdata[0], (&tmpdata[0]) + tmpdata.size(), range, data.begin() ); } else if(!is_signed && 16 == width) { std::vector tmpdata; ds.GetBrick(key, tmpdata); data.resize(tmpdata.size() / (width/8)); interpolate::iterator, T>( &tmpdata[0], (&tmpdata[0]) + tmpdata.size(), range, data.begin() ); } else if( is_signed && 32 == width) { std::vector tmpdata; ds.GetBrick(key, tmpdata); data.resize(tmpdata.size() / (width/8)); interpolate::iterator, T>( &tmpdata[0], (&tmpdata[0]) + tmpdata.size(), range, data.begin() ); } else if(!is_signed && 32 == width) { std::vector tmpdata; ds.GetBrick(key, tmpdata); data.resize(tmpdata.size() / (width/8)); interpolate::iterator, T>( &tmpdata[0], (&tmpdata[0]) + tmpdata.size(), range, data.begin() ); } else { T_ERROR("Unhandled data type! Width: %u, Signed: %d, Float: %d", static_cast(width), is_signed, is_float); } } namespace { template void ReadAndEvalBrick( RasterDataBlock& rdb, const std::vector>& uvfs, const std::vector& iters, tuvok::expression::Node* tree ) { std::vector> involumes(uvfs.size()); std::vector output; for(size_t i=0; i < uvfs.size(); ++i) { MESSAGE("Reading brick from volume %u/%u...", static_cast(i+1), static_cast(uvfs.size())); TypedRead(involumes[i], *uvfs[i], iters[i]->first); } MESSAGE("Evaluating expression ..."); tuvok::expression::evaluate(*tree, involumes, output); MESSAGE("Writing ..."); NDBrickKey nk = uvfs[0]->IndexToVectorKey(iters[0]->first); if(false == rdb.SetData(&output[0], nk.lod, nk.brick)) { T_ERROR("Write failed!"); } } } struct cleanup_parser { ~cleanup_parser() { parser_free(); } }; void IOManager::EvaluateExpression(const std::string& expr, const std::vector& volumes, const std::string& out_fn) const throw(tuvok::Exception) { parser_set_string(expr.c_str()); int parse_err = yyparse(); std::unique_ptr p(new cleanup_parser()); assert(!volumes.empty()); if(parse_err == 1) { throw tuvok::expression::SyntaxError("", 0, 2, __FILE__, __LINE__); } // open all of those files and get UVF datasets for each of them. const bool verify=false; std::vector> uvf; typedef std::vector::const_iterator citer; for(citer f = volumes.begin(); f != volumes.end(); ++f) { uvf.push_back(std::shared_ptr( dynamic_cast( m_dsFactory->Create(*f, 256 /* hack! */, verify) ) )); } // ensure those UVFs are "equal" in some sense (same number of voxels, etc). MergeableDatasets mergeable; typedef std::vector>::const_iterator uiter; for(uiter u = uvf.begin(); u != uvf.end(); ++u) { if(!mergeable(**uvf.begin(), **u)) { throw tuvok::io::UnmergeableDatasets("Incompatible input volumes", __FILE__, __LINE__); } } tuvok::expression::Node* tree = parser_tree_root(); // volume iterators std::vector viters; #ifdef DETECTED_OS_APPLE viters.reserve(uvf.size()); for(size_t i=0; i < uvf.size(); ++i) { viters.push_back(uvf[i]->BricksBegin()); } #else viters.resize(uvf.size()); for(size_t i=0; i < viters.size(); ++i) { // initialize viters[i] = uvf[i]->BricksBegin(); } #endif std::shared_ptr rdb(new RasterDataBlock()); rdb->SetBlockSemantic(UVFTables::BS_REG_NDIM_GRID); rdb->SetIdentityTransformation(); rdb->SetTypeToUShort(UVFTables::ES_RED); { // Copy the other basic info from the first input volume. std::wstring wide_vol(volumes[0].begin(), volumes[0].end()); UVF firstvol(wide_vol); firstvol.Open(false, false, false); const std::shared_ptr rdb1 = GetFirstRDB(firstvol); // Received this exception when using datasets that were converted to the // octree based UVF format (happens with experimental features enabled in // settings -- see RAWConverter::ConvertRAWDataset(...) ). if (rdb1 == NULL) { throw tuvok::io::IOException("No raster data blocks present in the " "first volume.", __FILE__, __LINE__); } *rdb = *rdb1; } std::string tmp_fn = SysTools::RemoveExt(out_fn) + ".rdb"; LargeRAWFile_ptr lout(new TempFile(tmp_fn)); lout->Create(); rdb->ResetFile(lout); // Figure out which what type our output data should be. size_t bit_width; bool is_float, is_signed; IdentifyType(uvf, bit_width, is_float, is_signed); // foreach brick: // load brick into 'involumes' // evaluate(tree, input-bricks-in-a-vector, output) // write output somewhere /// @todo FIXME: we should query bit_width, is_float, is_signed to create /// different 'involumes' based on the type we need... size_t brick = 0; while(viters[0] != uvf[0]->BricksEnd()) { for(size_t i=0; i < uvf.size(); ++i) { MESSAGE("Brick %u (file %03u/%03u)...", static_cast(brick), static_cast(i+1), static_cast(uvf.size())); // Read in the data we need. if(is_float && bit_width == 32) { ReadAndEvalBrick(*rdb, uvf, viters, tree); } else if(is_float && bit_width == 64) { // Not implemented in UVF... T_ERROR("double format data not supported!"); continue; } else if( is_signed && bit_width == 8) { ReadAndEvalBrick< int8_t>(*rdb, uvf, viters, tree); } else if(!is_signed && bit_width == 8) { ReadAndEvalBrick(*rdb, uvf, viters, tree); } else if( is_signed && bit_width == 16) { ReadAndEvalBrick< int16_t>(*rdb, uvf, viters, tree); } else if(!is_signed && bit_width == 16) { ReadAndEvalBrick(*rdb, uvf, viters, tree); // These types aren't yet implemented in UVF/RasterDataBlock. } else if( is_signed && bit_width == 32) { T_ERROR("32bit signed int data not implemented!"); //ReadAndEvalBrick< int32_t>(*rdb, uvf, viters, tree); } else if(!is_signed && bit_width == 32) { T_ERROR("32bit unsigned data not implemented!"); //ReadAndEvalBrick(*rdb, uvf, viters, tree); } else if( is_signed && bit_width == 64) { T_ERROR("64bit signed int data not implemented!"); //ReadAndEvalBrick< int64_t>(*rdb, uvf, viters, tree); } else if(!is_signed && bit_width == 64) { T_ERROR("64bit unsigned data not implemented!"); //ReadAndEvalBrick(*rdb, uvf, viters, tree); } else { T_ERROR("Could not figure out destination data type!"); } } MESSAGE("Brick %u (evaluation)...", static_cast(brick)); using namespace std::placeholders; // advance each brick iterator by one. #ifndef __clang__ std::for_each(viters.begin(), viters.end(), std::bind(std::advance, _1, 1)); #else // Clang uses iterator_traits<_InputIter>::difference_type to deduce // distance template parameter. std::for_each(viters.begin(), viters.end(), std::bind(std::advance, _1, 1)); #endif } CreateUVFFromRDB(out_fn, rdb); } bool IOManager::ReBrickDataset(const string& strSourceFilename, const string& strTargetFilename, const string& strTempDir, const uint64_t iMaxBrickSize, const uint64_t iBrickOverlap, bool bQuantizeTo8Bit) const { MESSAGE("Rebricking (Phase 1/2)..."); string filenameOnly = SysTools::GetFilename(strSourceFilename); string tmpFile = strTempDir+SysTools::ChangeExt(filenameOnly,"nrrd"); /// use some simple format as intermediate file if (!ConvertDataset(strSourceFilename, tmpFile, strTempDir, false, m_iBuilderBrickSize, m_iBrickOverlap, false)) { T_ERROR("Unable to extract raw data from file %s to %s", strSourceFilename.c_str(),tmpFile.c_str()); return false; } MESSAGE("Rebricking (Phase 2/2)..."); if (!ConvertDataset(tmpFile, strTargetFilename, strTempDir, true, iMaxBrickSize, iBrickOverlap,bQuantizeTo8Bit)) { T_ERROR("Unable to convert raw data from file %s into new UVF file %s", tmpFile.c_str(),strTargetFilename.c_str()); if(remove(tmpFile.c_str()) == -1) WARNING("Unable to delete temp file %s", tmpFile.c_str()); return false; } if(remove(tmpFile.c_str()) == -1) WARNING("Unable to delete temp file %s", tmpFile.c_str()); return true; } void IOManager::CopyToTSB(const Mesh& m, GeometryDataBlock* tsb) const { // source data const VertVec& v = m.GetVertices(); const NormVec& n = m.GetNormals(); const TexCoordVec& t = m.GetTexCoords(); const ColorVec& c = m.GetColors(); // target data vector fVec; size_t iVerticesPerPoly = m.GetVerticesPerPoly(); tsb->SetPolySize(iVerticesPerPoly ); if (!v.empty()) {fVec.resize(v.size()*3); memcpy(&fVec[0],&v[0],v.size()*3*sizeof(float)); tsb->SetVertices(fVec);} if (!n.empty()) {fVec.resize(n.size()*3); memcpy(&fVec[0],&n[0],n.size()*3*sizeof(float)); tsb->SetNormals(fVec);} if (!t.empty()) {fVec.resize(t.size()*2); memcpy(&fVec[0],&t[0],t.size()*2*sizeof(float)); tsb->SetTexCoords(fVec);} if (!c.empty()) {fVec.resize(c.size()*4); memcpy(&fVec[0],&c[0],c.size()*4*sizeof(float)); tsb->SetColors(fVec);} tsb->SetVertexIndices(m.GetVertexIndices()); tsb->SetNormalIndices(m.GetNormalIndices()); tsb->SetTexCoordIndices(m.GetTexCoordIndices()); tsb->SetColorIndices(m.GetColorIndices()); tsb->m_Desc = m.Name(); } std::shared_ptr IOManager::LoadMesh(const string& meshfile) const { MESSAGE("Opening Mesh File ..."); // iterate through all our converters, stopping when one successfully // converts our data. std::shared_ptr m; for(vector::const_iterator conv = m_vpGeoConverters.begin(); conv != m_vpGeoConverters.end(); ++conv) { MESSAGE("Attempting converter '%s'", (*conv)->GetDesc().c_str()); if((*conv)->CanRead(meshfile)) { MESSAGE("Converter '%s' can read '%s'!", (*conv)->GetDesc().c_str(), meshfile.c_str()); try { m = (*conv)->ConvertToMesh(meshfile); } catch (const std::exception& err) { WARNING("Converter %s can read files, but conversion failed: %s", (*conv)->GetDesc().c_str(), err.what()); throw; } break; } } return m; } void IOManager::AddMesh(const UVF* sourceDataset, const string& meshfile, const string& uvf_fn) const { std::shared_ptr m = LoadMesh(meshfile); if (!m) { WARNING("No converter for geometry file %s can be found", meshfile.c_str()); throw tuvok::io::DSOpenFailed(meshfile.c_str(), __FILE__, __LINE__); } // make sure we have at least normals if (m->GetNormalIndices().empty()) m->RecomputeNormals(); // now create a GeometryDataBlock ... std::shared_ptr tsb(new GeometryDataBlock()); // ... and transfer the data from the mesh object CopyToTSB(*m, tsb.get()); wstring wuvf(uvf_fn.begin(), uvf_fn.end()); UVF uvfFile(wuvf); GlobalHeader uvfGlobalHeader; uvfGlobalHeader.bIsBigEndian = EndianConvert::IsBigEndian(); uvfGlobalHeader.ulChecksumSemanticsEntry = UVFTables::CS_MD5; uvfFile.SetGlobalHeader(uvfGlobalHeader); for(uint64_t i = 0; iGetDataBlockCount(); i++) { uvfFile.AddConstDataBlock(sourceDataset->GetDataBlock(i)); } MESSAGE("Adding triangle soup block..."); uvfFile.AddDataBlock(tsb); uvfFile.Create(); MESSAGE("Computing checksum..."); uvfFile.Close(); } bool IOManager::SetMaxBrickSize(uint64_t iMaxBrickSize, uint64_t iBuilderBrickSize) { if (iMaxBrickSize > m_iBrickOverlap && iBuilderBrickSize > m_iBrickOverlap) { m_iMaxBrickSize = iMaxBrickSize; m_iBuilderBrickSize = iBuilderBrickSize; return true; } else return false; } bool IOManager::SetBrickOverlap(const uint64_t iBrickOverlap) { if (m_iMaxBrickSize > iBrickOverlap && m_iBuilderBrickSize > m_iBrickOverlap) { m_iBrickOverlap = iBrickOverlap; return true; } else return false; } ImageVis3D-3.1.0/Tuvok/IO/BrickCache.h0000644000175000017500000000605612320456500017032 0ustar mathieumathieu#ifndef TUVOK_BRICK_CACHE_H #define TUVOK_BRICK_CACHE_H #include #include #include "Brick.h" namespace tuvok { // Implements a simple brick cache: associates a chunk of data with the given // brick key. // Lookup of a nonexistent key results in an empty vector: there is no way to // tell whether a key doesn't exist, or whether the data it stores is actually // empty. class BrickCache { public: BrickCache(); ~BrickCache(); /// looks up a value in the cache, and fills the second argument if it /// exists. ///@{ const void* lookup(const BrickKey&, uint8_t); const void* lookup(const BrickKey&, uint16_t); const void* lookup(const BrickKey&, uint32_t); const void* lookup(const BrickKey&, uint64_t); const void* lookup(const BrickKey&, int8_t); const void* lookup(const BrickKey&, int16_t); const void* lookup(const BrickKey&, int32_t); const void* lookup(const BrickKey&, int64_t); const void* lookup(const BrickKey&, float); ///@} /// These return their argument for ease of use. ///@{ const void* add(const BrickKey&, std::vector&); const void* add(const BrickKey&, std::vector&); const void* add(const BrickKey&, std::vector&); const void* add(const BrickKey&, std::vector&); const void* add(const BrickKey&, std::vector&); const void* add(const BrickKey&, std::vector&); const void* add(const BrickKey&, std::vector&); const void* add(const BrickKey&, std::vector&); const void* add(const BrickKey&, std::vector&); ///@} /// removes the most appropriate element. void remove(); /// @returns cache size currently in use (in bytes) size_t size() const; private: struct bcinfo; std::unique_ptr ci; }; } #endif /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2013 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/IO/KitwareConverter.cpp0000644000175000017500000002561612320456500020710 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file KitwareConverter.cpp \author Jens Krueger SCI Institute University of Utah \date December 2008 */ #include #include "KitwareConverter.h" #include #include #include using namespace std; KitwareConverter::KitwareConverter() { m_vConverterDesc = "Kitware MHD Data"; m_vSupportedExt.push_back("MHD"); } bool KitwareConverter::ConvertToRAW( const std::string& strSourceFilename, const std::string&, bool, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile ) { MESSAGE("Attempting to convert Kitware MHD dataset %s", strSourceFilename.c_str()); strTitle = "Kitware MHD data"; KeyValueFileParser parser(strSourceFilename,false,"="); if (parser.FileReadable()) { KeyValPair* dims = parser.GetData("NDIMS"); KeyValPair* dimsize = parser.GetData("DIMSIZE"); KeyValPair* ElementSpacing = parser.GetData("ELEMENTSPACING"); KeyValPair* BigEndianFlag = parser.GetData("ELEMENTBYTEORDERMSB"); if (BigEndianFlag == NULL) BigEndianFlag = parser.GetData("BINARYDATABYTEORDERMSB"); KeyValPair* ElementType = parser.GetData("ELEMENTTYPE"); KeyValPair* CompressedData = parser.GetData("COMPRESSEDDATA"); KeyValPair* BinaryData = parser.GetData("BINARYDATA"); KeyValPair* Position = parser.GetData("POSITION"); KeyValPair* ElementNumberOfChannels = parser.GetData("ELEMENTNUMBEROFCHANNELS"); KeyValPair* ElementDataFile = parser.GetData("ELEMENTDATAFILE"); KeyValPair* HeaderSize = parser.GetData("HEADERSIZE"); KeyValPair* ObjectType = parser.GetData("OBJECTTYPE"); if (ObjectType && ObjectType->strValueUpper != "IMAGE") { T_ERROR("Only image type MHD file are currently supported."); return false; } if (ElementDataFile == NULL) { T_ERROR("Unable to find 'ElementDataFile' tag in file %s.", strSourceFilename.c_str()); return false; } if (dimsize == NULL) { T_ERROR("Unable to find 'DimSize' tag in file %s.", strSourceFilename.c_str()); return false; } if (ElementType == NULL) { T_ERROR("Unable to find 'ElementType' tag in file %s.", strSourceFilename.c_str()); return false; } if (BigEndianFlag == NULL) { MESSAGE("Unable to find 'ElementByteOrderMSB' or 'BinaryDataByteOrderMSB' tags in file %s assuming little endian data.", strSourceFilename.c_str()); bConvertEndianess = EndianConvert::IsBigEndian(); } else { if(BigEndianFlag->strValueUpper == "FALSE") { bConvertEndianess = EndianConvert::IsBigEndian(); } else { bConvertEndianess = EndianConvert::IsLittleEndian(); } } if(ElementType->strValueUpper == "MET_CHAR") { bSigned = true; iComponentSize = 8; bIsFloat = false; } else if (ElementType->strValueUpper == "MET_UCHAR") { bSigned = false; iComponentSize = 8; bIsFloat = false; } else if (ElementType->strValueUpper == "MET_SHORT") { bSigned = true; iComponentSize = 16; bIsFloat = false; }else if (ElementType->strValueUpper == "MET_USHORT") { bSigned = false; iComponentSize = 16; bIsFloat = false; } else if (ElementType->strValueUpper == "MET_INT") { bSigned = true; iComponentSize = 32; bIsFloat = false; } else if (ElementType->strValueUpper == "MET_UINT") { bSigned = false; iComponentSize = 32; bIsFloat = false; } else if (ElementType->strValueUpper == "MET_FLOAT") { bSigned = true; iComponentSize = 32; bIsFloat = true; } else if (ElementType->strValueUpper == "MET_DOUBLE") { bSigned = true; iComponentSize = 64; bIsFloat = true; } if (ElementNumberOfChannels == NULL) { MESSAGE("Unable to find 'ElementNumberOfChannels' tag in file '%s'; " "assuming scalar data.", strSourceFilename.c_str()); iComponentCount = 1; } else { iComponentCount = ElementNumberOfChannels->iValue; } strIntermediateFile = ElementDataFile->strValue; if (strIntermediateFile == "LIST") { T_ERROR("LISTS are currently not supported in MHD files."); return false; } uint32_t iDims = static_cast(dimsize->vuiValue.size()); if (dims == NULL) { WARNING("Unable to find 'NDims' tag in file %s relying on 'DimSize' tag.", strSourceFilename.c_str()); } else { if (iDims != dims->uiValue) { T_ERROR("Tags 'NDims' and 'DimSize' are incosistent in file %s.", strSourceFilename.c_str()); return false; } } if (iDims > 3) { T_ERROR("Currently only up to 3D data supported."); return false; } vVolumeSize = UINT64VECTOR3(dimsize->vuiValue, 1); vVolumeAspect = FLOATVECTOR3(ElementSpacing->vfValue,1.0f); if (Position != NULL) { for (size_t i = 0;ivfValue.size();i++) { if (ElementSpacing->vfValue[i] != 0.0f) { WARNING("Ignoring non zero position."); break; } } } // TODO: find a non binary MHD payload file and figure out its format if (BinaryData != NULL) { if(BinaryData->strValueUpper == "FALSE") { T_ERROR("Currently only binary MHD data supported."); return false; } } // TODO: find a compressed MHD payload file and figure out its format if (CompressedData != NULL) { if(CompressedData->strValueUpper == "TRUE") { T_ERROR("Currently only uncompressed MHD data supported."); return false; } } bDeleteIntermediateFile = false; strIntermediateFile = SysTools::GetPath(strSourceFilename) + strIntermediateFile; if (HeaderSize != NULL) { if (dimsize->iValue != -1 ) { // size -1 means compute header size automatically iHeaderSkip = dimsize->uiValue; } else { LargeRAWFile f(strIntermediateFile); if (f.Open(false)) { uint64_t iFileSize = f.GetCurrentSize(); f.Close(); iHeaderSkip = iFileSize - (iComponentSize/8)*vVolumeSize.volume()*iComponentCount; } else { T_ERROR("Unable to open paload file %s.", strIntermediateFile.c_str()); return false; } } } else { iHeaderSkip = 0; } } else return false; return true; } bool KitwareConverter::ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize,FLOATVECTOR3 vVolumeAspect, bool bNoUserInteraction, const bool bQuantizeTo8Bit) { // compute fromat string string strFormat; if (!bQuantizeTo8Bit) { if (bFloatingPoint && bSigned && iComponentSize == 64) strFormat = "MET_DOUBLE"; else if (bFloatingPoint && bSigned && iComponentSize == 32) strFormat = "MET_FLOAT"; else if (!bFloatingPoint && bSigned && iComponentSize == 32) strFormat = "MET_INT"; else if (!bFloatingPoint && !bSigned && iComponentSize == 32) strFormat = "MET_UINT"; else if (!bFloatingPoint && bSigned && iComponentSize == 8) strFormat = "MET_CHAR"; else if (!bFloatingPoint && !bSigned && iComponentSize == 8) strFormat = "MET_UCHAR"; else if (!bFloatingPoint && bSigned && iComponentSize == 16) strFormat = "MET_SHORT"; else if (!bFloatingPoint && !bSigned && iComponentSize == 16) strFormat = "MET_USHORT"; else { T_ERROR("This data type is not supported by the MHD writer."); return false; } } else { if (bSigned) strFormat = "MET_CHAR"; else strFormat = "MET_UCHAR"; } // create textfile from metadata string strTargetRAWFilename = strTargetFilename+".raw"; ofstream fTarget(strTargetFilename.c_str()); if (!fTarget.is_open()) { T_ERROR("Unable to open target file %s.", strTargetFilename.c_str()); return false; } MESSAGE("Writing MHD File"); fTarget << "ObjectType = Image" << endl; fTarget << "BinaryData = True" << endl; if (EndianConvert::IsBigEndian()) fTarget << "BinaryDataByteOrderMSB = true" << endl; else fTarget << "BinaryDataByteOrderMSB = false" << endl; fTarget << "HeaderSize = 0" << endl; fTarget << "NDims = 3" << endl; fTarget << "DimSize = " << vVolumeSize.x << " " << vVolumeSize.y << " "<< vVolumeSize.z << endl; fTarget << "ElementSpacing = " << vVolumeAspect.x << " " << vVolumeAspect.y << " "<< vVolumeAspect.z << endl; fTarget << "ElementNumberOfChannels = " << iComponentCount << endl; fTarget << "ElementType = " << strFormat << endl; fTarget << "ElementDataFile = " << SysTools::GetFilename(strTargetRAWFilename) << endl; fTarget.close(); MESSAGE("Writing RAW File"); // copy RAW file using the parent's call bool bRAWSuccess = RAWConverter::ConvertToNative(strRawFilename, strTargetRAWFilename, iHeaderSkip, iComponentSize, iComponentCount, bSigned, bFloatingPoint, vVolumeSize, vVolumeAspect, bNoUserInteraction,bQuantizeTo8Bit); if (bRAWSuccess) { return true; } else { T_ERROR("Error creating raw target file %s.", strTargetRAWFilename.c_str()); remove(strTargetFilename.c_str()); return false; } } ImageVis3D-3.1.0/Tuvok/IO/BrickedDataset.h0000644000175000017500000000747112320456500017727 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2009 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file BrickedDataset.h \author Tom Fogal SCI Institute University of Utah */ #pragma once #ifndef TUVOK_BRICKED_DATASET_H #define TUVOK_BRICKED_DATASET_H #include "Basics/MinMaxBlock.h" #include "Dataset.h" namespace tuvok { /// Base for data sets which split their data into blocks. All bricks are kept /// into an internal table; derived classes should add to it via AddBrick. /// This class then handles the query of much meta data. class BrickedDataset : public Dataset { public: BrickedDataset(); virtual ~BrickedDataset(); /// Looks up the spatial range of a brick. virtual FLOATVECTOR3 GetBrickExtents(const BrickKey &) const; /// number of voxels in the given brick. virtual UINTVECTOR3 GetBrickVoxelCounts(const BrickKey&) const; /// @return an iterator that can be used to visit every brick in the dataset. virtual BrickTable::const_iterator BricksBegin() const; virtual BrickTable::const_iterator BricksEnd() const; /// @return the number of bricks at the given LOD + timestep virtual BrickTable::size_type GetBrickCount(size_t lod, size_t ts) const; virtual size_t GetLargestSingleBrickLOD(size_t ts) const; virtual uint64_t GetTotalBrickCount() const; virtual const BrickMD& GetBrickMetadata(const BrickKey&) const; /// @returns the bricking size used for this decomposition virtual UINTVECTOR3 GetMaxBrickSize() const; /// @returns the largest brick which *actually* got used when splitting up /// the data set. This can be smaller than GetMaxBrickSize, when, for /// example, the domain is smaller than the brick size requested. virtual UINTVECTOR3 GetMaxUsedBrickSizes() const; /// @returns the min/max scalar and gradient values for the given brick. virtual tuvok::MinMaxBlock MaxMinForKey(const BrickKey&) const=0; virtual void Clear(); /// It can be important to know whether the given brick is the first or last /// along any particular axis. As an example, there's 0 brick overlap for a /// border brick. ///@{ /// @return true if the brick is the minimum brick in the given dimension. virtual bool BrickIsFirstInDimension(size_t, const BrickKey&) const; /// @return true if the brick is the maximum brick in the given dimension. virtual bool BrickIsLastInDimension(size_t, const BrickKey&) const; ///@} protected: /// gives a hint to this object that we'll have 'n' bricks in the end. virtual void NBricksHint(size_t n); /// Adds a brick to the dataset. virtual void AddBrick(const BrickKey&, const BrickMD&); protected: BrickTable bricks; }; } // namespace tuvok #endif // TUVOK_BRICKED_DATASET_H ImageVis3D-3.1.0/Tuvok/IO/GeomViewConverter.cpp0000644000175000017500000001130112320456500021006 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Scientific Computing and Imaging Institute Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define __STDC_FORMAT_MACROS #include "StdTuvokDefines.h" #include // MSVC 2010 does not include this c99/posix 2001 feature, so we implement it manually for now. #ifndef _MSC_VER # include #else # define PRIu64 "llu" #endif #include #include "GeomViewConverter.h" #include "Basics/Mesh.h" #include "Basics/SysTools.h" #include "Controller/Controller.h" #include "TuvokIOError.h" namespace tuvok { GeomViewConverter::GeomViewConverter() { m_vSupportedExt.push_back("OFF"); m_vConverterDesc = "GeomView OFF"; } using namespace io; std::shared_ptr GeomViewConverter::ConvertToMesh(const std::string& rawFilename) { MESSAGE("Converting %s...", rawFilename.c_str()); std::ifstream off(rawFilename.c_str(), std::ios::in); if(!off) { throw DSOpenFailed(rawFilename.c_str(), "open failed", __FILE__, __LINE__); } std::string magic; off >> magic; if(!off || magic != "OFF") { throw DSOpenFailed(rawFilename.c_str(), "not an OFF file.", __FILE__, __LINE__); } uint64_t n_vertices, n_faces; off >> n_vertices >> n_faces; // always seems to be a 0 after that, not sure what it means yet. { uint64_t zero; off >> zero; } if(!off || n_vertices == 0) { throw DSParseFailed(rawFilename.c_str(), "number of vertices", __FILE__, __LINE__); } MESSAGE("%llu vertices.", n_vertices); MESSAGE("%llu faces.", n_faces); size_t n_vertices_st = static_cast(n_vertices); VertVec vertices(n_vertices_st); const uint64_t steps = (n_vertices / 10000) > 0 ? (n_vertices / 10000) : 1000; for(uint64_t i=0; i < n_vertices; ++i) { FLOATVECTOR3 tmp; off >> tmp[0] >> tmp[1] >> tmp[2]; tmp[0] -= 0.5; tmp[1] -= 0.5; tmp[2] -= 0.5; vertices[static_cast(i)] = tmp; if((i % steps) == 0) { MESSAGE("Processing vertex %" PRIu64 " of %" PRIu64 " (%5.2f%%)", i, n_vertices, static_cast(i)/n_vertices*100.0); } } if(!off) { throw DSParseFailed(rawFilename.c_str(), "vertices list short", __FILE__, __LINE__); } // every line seems to consist of '3', 3 indices, and then a '7'. I guess // the 3 means "a 3-index face is next", but what the hell does the 7 mean? IndexVec VertIndices, NormalIndices, TCIndices, COLIndices; { uint16_t three, seven; const uint64_t fsteps = (n_faces / 10000) > 0 ? (n_faces / 10000) : 1000; for(uint64_t i=0; i < n_faces; ++i) { UINTVECTOR3 face; off >> three >> face[0] >> face[1] >> face[2] >> seven; if(!off) { throw DSParseFailed(rawFilename.c_str(), "short face list?", __FILE__, __LINE__); } if(three != 3) { throw DSParseFailed(rawFilename.c_str(), "unknown face type", __FILE__, __LINE__); } IndexVec v,n,t,c; v.push_back(face[0]); v.push_back(face[1]); v.push_back(face[2]); AddToMesh(vertices,v,n,t,c,VertIndices,NormalIndices,TCIndices,COLIndices); if((i % fsteps) == 0) { MESSAGE("Processing face %" PRIu64 " of %" PRIu64 " (%5.2f%%)", i, n_faces, static_cast(i)/n_faces*100.0); } } } off.close(); return std::shared_ptr(new Mesh( vertices, NormVec(), TexCoordVec(), ColorVec(), VertIndices, NormalIndices, TCIndices, COLIndices, false, false, SysTools::GetFilename(rawFilename), Mesh::MT_TRIANGLES )); } } ImageVis3D-3.1.0/Tuvok/IO/PLYGeoConverter.cpp0000644000175000017500000004677312320456500020410 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : PLYGeoConverter.cpp //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #include "PLYGeoConverter.h" #include "Controller/Controller.h" #include "SysTools.h" #include "Mesh.h" #include #include "TuvokIOError.h" using namespace tuvok; using namespace std; PLYGeoConverter::PLYGeoConverter() : AbstrGeoConverter() { m_vConverterDesc = "Stanford Polygon File Format"; m_vSupportedExt.push_back("PLY"); } std::shared_ptr PLYGeoConverter::ConvertToMesh(const std::string& strFilename) { VertVec vertices; NormVec normals; TexCoordVec texcoords; ColorVec colors; IndexVec VertIndices; IndexVec NormalIndices; IndexVec TCIndices; IndexVec COLIndices; std::ifstream fs; std::string line; fs.open(strFilename.c_str()); if (fs.fail()) { throw tuvok::io::DSOpenFailed(strFilename.c_str(), __FILE__, __LINE__); } int iFormat = FORMAT_ASCII; int iReaderState = SEARCHING_MAGIC; size_t iVertexCount=0; size_t iFaceCount=0; size_t iLineCount=0; bool bNormalsFound = false; bool bTexCoordsFound = false; bool bColorsFound = false; MESSAGE("Reading Header"); fs.seekg(0,std::ios::end); streamoff iFileLength = fs.tellg(); fs.seekg(0,std::ios::beg); size_t iBytesRead = 0; size_t iLine = 0; while (!fs.fail() && iReaderState < PARSING_VERTEX_DATA) { getline(fs, line); if (fs.fail()) break; // no more lines to read iBytesRead += line.size() + 1; iLine++; if (iLine % 5000 == 0) { MESSAGE("Reading Header (Line %u %u/%u kb)", unsigned(iLine), unsigned(iBytesRead/1024),unsigned(iFileLength/1024)); } // remove comments line = SysTools::TrimStr(line); if (line.length() == 0) continue; // skip empty lines // find the linetype string linetype = GetToken(line); if (linetype == "comment") continue; // skip comment lines switch (iReaderState) { case SEARCHING_MAGIC : { if (linetype == "ply") iReaderState = PARSING_GENERAL_HEADER; else continue; } break; case PARSING_FACE_HEADER : case PARSING_VERTEX_HEADER : case PARSING_EDGE_HEADER : case PARSING_GENERAL_HEADER : { if (linetype == "format") { string format = GetToken(line); if (format == "ascii") iFormat = FORMAT_ASCII; else if (format == "binary_little_endian") iFormat = FORMAT_BIN_LITTLE; else if (format == "binary_big_endian") iFormat = FORMAT_BIN_BIG; else { stringstream s; s << "unknown format " << format.c_str(); throw tuvok::io::DSParseFailed(strFilename.c_str(), s.str().c_str(),__FILE__, __LINE__); } string version = GetToken(line); if (version != "1.0") { stringstream s; s << "unknown version " << version.c_str(); throw tuvok::io::DSParseFailed(strFilename.c_str(), s.str().c_str(),__FILE__, __LINE__); } } else if (linetype == "element") { string elemType = GetToken(line); if (elemType == "vertex") { iReaderState = PARSING_VERTEX_HEADER; string strCount = GetToken(line); iVertexCount = atoi(strCount.c_str()); } else if (elemType == "face") { iReaderState = PARSING_FACE_HEADER; string strCount = GetToken(line); iFaceCount = atoi(strCount.c_str()); } else if (elemType == "edge") { iReaderState = PARSING_EDGE_HEADER; string strCount = GetToken(line); iLineCount = atoi(strCount.c_str()); } } else if (linetype == "property") { if (iReaderState == PARSING_VERTEX_HEADER){ propType t = StringToType(GetToken(line)); vertexProp p = StringToVProp(GetToken(line)); vertexProps.push_back(make_pair(t,p)); } else if (iReaderState == PARSING_FACE_HEADER) { faceProp p = StringToFProp(GetToken(line)); propType t1 = StringToType(GetToken(line)); propType t2 = StringToType(GetToken(line)); faceProps.push_back(make_tuple(t1,t2,p)); } else if (iReaderState == PARSING_EDGE_HEADER) { propType t = StringToType(GetToken(line)); edgeProp p = StringToEProp(GetToken(line)); edgeProps.push_back(make_pair(t,p)); } else { WARNING("property outside vertex or face data found"); } } else if (linetype == "end_header") { iReaderState = PARSING_VERTEX_DATA; } } break; default : throw tuvok::io::DSParseFailed(strFilename.c_str(), "unknown parser state header",__FILE__, __LINE__); } } if (iFormat != FORMAT_ASCII) { throw tuvok::io::DSParseFailed(strFilename.c_str(), "Binary PLY files not supported yet.",__FILE__, __LINE__); } if (iFaceCount > 0 && iLineCount > 0) { WARNING("found both, polygons and lines, in the file, ignoring lines"); } MESSAGE("Reading Vertices"); size_t iFacesFound = 0; vertices.reserve(iVertexCount); // parse data body of PLY file while (!fs.fail() && iReaderState != PARSING_DONE) { getline(fs, line); if (fs.fail()) break; // no more lines to read iBytesRead += line.size() + 1; iLine++; if (iLine % 5000 == 0) { if (PARSING_VERTEX_DATA) MESSAGE("Reading Vertices (Line %u %u/%u kb)", unsigned(iLine), unsigned(iBytesRead/1024),unsigned(iFileLength/1024)); else MESSAGE("Reading Indices (Line %u %u/%u kb)", unsigned(iLine), unsigned(iBytesRead/1024),unsigned(iFileLength/1024)); } line = SysTools::TrimStr(line); if (iReaderState == PARSING_VERTEX_DATA) { FLOATVECTOR3 pos; FLOATVECTOR3 normal(0,0,0); FLOATVECTOR4 color(0,0,0,1); for (size_t i = 0;i 0) ? PARSING_FACE_DATA : PARSING_EDGE_DATA; MESSAGE("Reading Faces"); } } else if (iReaderState == PARSING_FACE_DATA) { IndexVec v, n, t, c; for (size_t i = 0;i(faceProps[i]) <= PROPT_DOUBLE) { fValue = atof(strValue.c_str()); iValue = static_cast(fValue); } else { iValue = atoi(strValue.c_str()); fValue = static_cast(iValue); } switch (std::get<2>(faceProps[i])) { case FPROP_LIST : { for (int j = 0;j(faceProps[i]) strValue = GetToken(line); int elem = atoi(strValue.c_str()); v.push_back(elem); if (bNormalsFound) n.push_back(elem); if (bTexCoordsFound) t.push_back(elem); if (bColorsFound) c.push_back(elem); } } break; default: break; } } AddToMesh(vertices,v,n,t,c,VertIndices,NormalIndices,TCIndices,COLIndices); iFacesFound++; if (iFacesFound == iFaceCount) iReaderState = PARSING_DONE; } else if (iReaderState == PARSING_EDGE_DATA) { FLOATVECTOR4 color(0,0,0,1); bool bEdgeColorsFound=false; for (size_t i = 0;i( new Mesh(vertices,normals,texcoords,colors, VertIndices,NormalIndices,TCIndices,COLIndices, false,false,desc, (iFaceCount > 0) ? Mesh::MT_TRIANGLES : Mesh::MT_LINES) ); } PLYGeoConverter::propType PLYGeoConverter::StringToType(const std::string& token) { if (token == "float" || token == "float32") return PROPT_FLOAT; if (token == "double" || token == "float64") return PROPT_DOUBLE; if (token == "char" || token == "int8") return PROPT_INT8; if (token == "uchar" || token == "uint8") return PROPT_UINT8; if (token == "short" || token == "int16") return PROPT_INT16; if (token == "ushort" || token == "uint16") return PROPT_UINT16; if (token == "int" || token == "int32") return PROPT_INT32; if (token == "uint" || token == "uint32") return PROPT_UINT32; return PROPT_UNKNOWN; } PLYGeoConverter::vertexProp PLYGeoConverter::StringToVProp(const std::string& token) { if (token == "x") return VPROP_X; if (token == "y") return VPROP_Y; if (token == "z") return VPROP_Z; if (token == "nx") return VPROP_NX; if (token == "ny") return VPROP_NY; if (token == "nz") return VPROP_NZ; if (token == "red") return VPROP_RED; if (token == "green") return VPROP_GREEN; if (token == "blue") return VPROP_BLUE; if (token == "opacity") return VPROP_OPACITY; if (token == "intensity") return VPROP_INTENSITY; if (token == "confidence") return VPROP_CONFIDENCE; return VPROP_UNKNOWN; } PLYGeoConverter::faceProp PLYGeoConverter::StringToFProp(const std::string& token) { if (token == "list") return FPROP_LIST; return FPROP_UNKNOWN; } PLYGeoConverter::edgeProp PLYGeoConverter::StringToEProp(const std::string& token) { if (token == "vertex1") return EPROP_VERTEX1; if (token == "vertex2") return EPROP_VERTEX2; if (token == "red") return EPROP_RED; if (token == "green") return EPROP_GREEN; if (token == "blue") return EPROP_BLUE; if (token == "opacity") return EPROP_OPACITY; if (token == "intensity") return EPROP_INTENSITY; return EPROP_UNKNOWN; } bool PLYGeoConverter::ConvertToNative(const Mesh& m, const std::string& strTargetFilename) { std::ofstream outStream(strTargetFilename.c_str()); if (outStream.fail()) return false; // write magic outStream << "ply" << std::endl; // format outStream << "format ascii 1.0" << std::endl; // some comments outStream << "comment " << m.Name() << std::endl; outStream << "comment Vertices: " << m.GetVertices().size() << std::endl; outStream << "comment Primitives: " << m.GetVertexIndices().size()/ m.GetVerticesPerPoly() << std::endl; // vertex info outStream << "element vertex " << m.GetVertices().size() << std::endl; outStream << "property float x" << std::endl; outStream << "property float y" << std::endl; outStream << "property float z" << std::endl; if (m.GetVertices().size() == m.GetNormals().size()) { outStream << "property float nx" << std::endl; outStream << "property float ny" << std::endl; outStream << "property float nz" << std::endl; } // face info if (m.GetMeshType() == Mesh::MT_TRIANGLES) { outStream << "element face " << m.GetVertexIndices().size()/ m.GetVerticesPerPoly() << std::endl; outStream << "property list uchar int vertex_indices" << std::endl; } else { outStream << "element edge " << m.GetVertexIndices().size()/ m.GetVerticesPerPoly() << std::endl; outStream << "property int vertex1" << std::endl; outStream << "property int vertex2" << std::endl; if (m.GetVertexIndices().size() == m.GetColorIndices().size()) { outStream << "property float red" << std::endl; outStream << "property float green" << std::endl; outStream << "property float blue" << std::endl; outStream << "property float opacity" << std::endl; } } // end header outStream << "end_header" << std::endl; // vertex data const VertVec& v = m.GetVertices(); const NormVec& n = m.GetNormals(); if (v.size() == n.size()) { for (size_t i = 0;i #include "TuvokIOError.h" using namespace tuvok; OBJGeoConverter::OBJGeoConverter() : AbstrGeoConverter() { m_vConverterDesc = "Wavefront Object File"; m_vSupportedExt.push_back("OBJ"); m_vSupportedExt.push_back("OBJX"); } inline int OBJGeoConverter::CountOccurences(const std::string& str, const std::string& substr) { size_t found = str.find_first_of(substr); int count = 0; while (found!=std::string::npos) { count++; found=str.find_first_of(substr,found+1); } return count; } std::shared_ptr OBJGeoConverter::ConvertToMesh(const std::string& strFilename) { bool bFlipVertices = false; VertVec vertices; NormVec normals; TexCoordVec texcoords; ColorVec colors; IndexVec VertIndices; IndexVec NormalIndices; IndexVec TCIndices; IndexVec COLIndices; std::ifstream fs; std::string line; fs.open(strFilename.c_str()); if (fs.fail()) { // hack, we really want some kind of 'file not found' exception. throw tuvok::io::DSOpenFailed(strFilename.c_str(), __FILE__, __LINE__); } float x,y,z,w; size_t iVerticesPerPoly = 0; fs.seekg(0,std::ios::end); std::streamoff iFileLength = fs.tellg(); fs.seekg(0,std::ios::beg); size_t iBytesRead = 0; size_t iLine = 0; while (!fs.fail()) { getline(fs, line); iBytesRead += line.size() + 1; iLine++; if (fs.fail()) break; // no more lines to read line = SysTools::ToLowerCase(SysTools::TrimStr(line)); // remove comments size_t cPos = line.find_first_of('#'); if (cPos != std::string::npos) line = line.substr(0,cPos); line = SysTools::TrimStr(line); if (line.length() == 0) continue; // skips empty and comment lines // find the linetype size_t off = line.find_first_of(" \r\n\t"); if (off == std::string::npos) continue; std::string linetype = SysTools::TrimStrRight(line.substr(0,off)); line = SysTools::TrimStr(line.substr(linetype.length())); if (linetype == "o") { WARNING("Skipping Object Tag in OBJ file"); } else if (linetype == "mtllib") { WARNING("Skipping Material Library Tag in OBJ file"); } else if (linetype == "v") { // vertex attrib found std::vector< std::string > pos = SysTools::Tokenize(line, SysTools::PM_NONE); if (pos.size() < 3) { WARNING("Found broken v tag (to few coordinates, " "filling with zeroes"); x = (pos.size() > 0) ? SysTools::FromString(pos[0]) : 0.0f; y = (pos.size() > 1) ? SysTools::FromString(pos[1]) : 0.0f; z = 0.0f; } else { x = SysTools::FromString(pos[0]); y = SysTools::FromString(pos[1]); z = SysTools::FromString(pos[2]); if (pos.size() >= 6) { // this is a "meshlab extended" obj file that includes vertex colors float r = SysTools::FromString(pos[3]); float g = SysTools::FromString(pos[4]); float b = SysTools::FromString(pos[5]); float a = (pos.size() > 6) ? SysTools::FromString(pos[6]):1.0f; colors.push_back(FLOATVECTOR4(r,g,b,a)); } else if (pos.size() > 3) { // file specifies homogeneous coordinate float w = SysTools::FromString(pos[3]); if (w != 0) { x /= w; y /= w; z /= w; } } } vertices.push_back(FLOATVECTOR3(x,y,(bFlipVertices) ? -z : z)); } else if (linetype == "vt") { // vertex texcoord found x = float(atof(GetToken(line).c_str())); y = float(atof(GetToken(line).c_str())); texcoords.push_back(FLOATVECTOR2(x,y)); } else if (linetype == "vc") { // vertex color found x = float(atof(GetToken(line).c_str())); y = float(atof(GetToken(line).c_str())); z = float(atof(GetToken(line).c_str())); w = float(atof(GetToken(line).c_str())); colors.push_back(FLOATVECTOR4(x,y,z,w)); } else if (linetype == "vn") { // vertex normal found x = float(atof(GetToken(line).c_str())); y = float(atof(GetToken(line).c_str())); z = float(atof(GetToken(line).c_str())); FLOATVECTOR3 n(x,y,z); n.normalize(); normals.push_back(n); } else if (linetype == "f" || linetype == "l") { // face or line found size_t off = line.find_first_of(" \r\n\t"); if (off == std::string::npos) continue; std::string analysis = SysTools::TrimStrRight(line.substr(0,off)); int count = CountOccurences(analysis,"/"); IndexVec v, n, t, c; while (line.length() > 0) { switch (count) { case 0 : { int vI = atoi(GetToken(line).c_str())-1; v.push_back(vI); break; } case 1 : { int vI = atoi(GetToken(line,"/",true).c_str())-1; v.push_back(vI); int vT = atoi(GetToken(line).c_str())-1; t.push_back(vT); line = TrimToken(line); break; } case 2 : { int vI = atoi(GetToken(line,"/",true).c_str())-1; v.push_back(vI); if (line[0] != '/') { int vT = atoi(GetToken(line,"/",true).c_str())-1; t.push_back(vT); }else line = TrimToken(line,"/",true); int vN = atoi(GetToken(line).c_str())-1; n.push_back(vN); break; } case 3 : { int vI = atoi(GetToken(line,"/",true).c_str())-1; v.push_back(vI); if (line[0] != '/') { int vT = atoi(GetToken(line,"/",true).c_str())-1; t.push_back(vT); }else line = TrimToken(line,"/",true); if (line[0] != '/') { int vN = atoi(GetToken(line,"/",true).c_str())-1; n.push_back(vN); } else line = TrimToken(line,"/",true); int vC = atoi(GetToken(line).c_str())-1; c.push_back(vC); break; } } SysTools::TrimStrLeft(line); } if (v.size() == 1) { WARNING("Skipping points in OBJ file"); continue; } if (iVerticesPerPoly == 0) iVerticesPerPoly = v.size(); if (v.size() == 2) { if ( iVerticesPerPoly != 2 ) { WARNING("Skipping a line in a file that also contains polygons"); continue; } AddToMesh(vertices,v,n,t,c,VertIndices,NormalIndices,TCIndices,COLIndices); } else { if ( iVerticesPerPoly == 2 ) { WARNING("Skipping polygon in file that also contains lines"); continue; } AddToMesh(vertices,v,n,t,c,VertIndices,NormalIndices,TCIndices,COLIndices); } } else { WARNING("Skipping unknown tag %s in OBJ file", linetype.c_str()); } if (iLine % 5000 == 0) { MESSAGE("Reading line %u (%u / %u kb)", unsigned(iLine), unsigned(iBytesRead/1024),unsigned(iFileLength/1024)); } } fs.close(); std::string desc = m_vConverterDesc + " data converted from " + SysTools::GetFilename(strFilename); // generate color indies for "meshlab extended" format if (COLIndices.size() == 0 && vertices.size() == colors.size()) COLIndices = VertIndices; std::shared_ptr m( new Mesh(vertices,normals,texcoords,colors, VertIndices,NormalIndices,TCIndices,COLIndices, false, false, desc, ((iVerticesPerPoly == 2) ? Mesh::MT_LINES : Mesh::MT_TRIANGLES)) ); return m; } bool OBJGeoConverter::ConvertToNative(const Mesh& m, const std::string& strTargetFilename) { bool bUseExtension = SysTools::ToUpperCase( SysTools::GetExt(strTargetFilename) ) == "OBJX"; std::ofstream outStream(strTargetFilename.c_str()); if (outStream.fail()) return false; std::stringstream statLine1, statLine2; statLine1 << "Vertices: " << m.GetVertices().size(); statLine2 << "Primitives: " << m.GetVertexIndices().size()/ m.GetVerticesPerPoly(); size_t iCount = std::max(m.Name().size(), std::max(statLine1.str().size(), statLine2.str().size() )); for (size_t i = 0;i #include "VariantArray.h" namespace tuvok { VariantArray::VariantArray(): length(0) { } VariantArray::VariantArray(const VariantArray &va) : length(va.length), data_type(va.data_type) { this->scalar_ub = va.scalar_ub; this->scalar_b = va.scalar_b; this->scalar_us = va.scalar_us; this->scalar_s = va.scalar_s; this->scalar_f = va.scalar_f; this->scalar_d = va.scalar_d; } VariantArray::~VariantArray() {} void VariantArray::set(const std::shared_ptr data, size_t len) { this->reset(); this->length = len; this->scalar_ub = data; this->data_type = DT_UBYTE; } void VariantArray::set(const std::shared_ptr data, size_t len) { this->reset(); this->length = len; this->scalar_b = data; this->data_type = DT_BYTE; } void VariantArray::set(const std::shared_ptr data, size_t len) { this->reset(); this->length = len; this->scalar_us = data; this->data_type = DT_USHORT; } void VariantArray::set(const std::shared_ptr data, size_t len) { this->reset(); this->length = len; this->scalar_s = data; this->data_type = DT_SHORT; } void VariantArray::set(const std::shared_ptr data, size_t len) { this->reset(); this->length = len; this->scalar_f = data; this->data_type = DT_FLOAT; } void VariantArray::set(const std::shared_ptr data, size_t len) { this->reset(); this->length = len; this->scalar_d = data; this->data_type = DT_DOUBLE; } const uint8_t* VariantArray::getub() const { assert(this->data_type == DT_UBYTE); return this->scalar_ub.get(); } const int8_t* VariantArray::getb() const { assert(this->data_type == DT_BYTE); return this->scalar_b.get(); } const uint16_t* VariantArray::getus() const { assert(this->data_type == DT_USHORT); return this->scalar_us.get(); } const int16_t* VariantArray::gets() const { assert(this->data_type == DT_SHORT); return this->scalar_s.get(); } const float* VariantArray::getf() const { assert(this->data_type == DT_FLOAT); return this->scalar_f.get(); } const double* VariantArray::getd() const { assert(this->data_type == DT_DOUBLE); return this->scalar_d.get(); } VariantArray& VariantArray::operator=(const VariantArray &va) { this->scalar_ub = va.scalar_ub; this->scalar_b = va.scalar_b; this->scalar_us = va.scalar_us; this->scalar_s = va.scalar_s; this->scalar_f = va.scalar_f; this->scalar_d = va.scalar_d; this->length = va.length; this->data_type = va.data_type; return *this; } VariantArray::DataType VariantArray::type() const { return this->data_type; } void VariantArray::reset() { this->scalar_ub.reset(); this->scalar_b.reset(); this->scalar_us.reset(); this->scalar_s.reset(); this->scalar_f.reset(); this->scalar_d.reset(); } }; // namespace tuvok ImageVis3D-3.1.0/Tuvok/IO/uvfDataset.h0000644000175000017500000003125712320456500017163 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2009 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifndef TUVOK_UVF_DATASET_H #define TUVOK_UVF_DATASET_H #include #include "Basics/MinMaxBlock.h" #include "Controller/Controller.h" #include "UVF/RasterDataBlock.h" #include "UVF/MaxMinDataBlock.h" #include "AbstrConverter.h" #include "FileBackedDataset.h" #include "LinearIndexDataset.h" /// For UVF, a brick key has to be a list for the LOD indicators and a /// list of brick indices for the brick itself. struct NDBrickKey { size_t timestep; std::vector lod; std::vector brick; }; class VolumeDatasetInfo; class KeyValuePairDataBlock; class Histogram1DDataBlock; class Histogram2DDataBlock; class MaxMinDataBlock; class GeometryDataBlock; class UVF; namespace tuvok { class Timestep { public: Timestep() : m_fMaxGradMagnitude(0), m_pVolumeDataBlock(NULL), m_pHist1DDataBlock(NULL), m_pHist2DDataBlock(NULL), m_pMaxMinData(NULL) {} virtual ~Timestep() {} float m_fMaxGradMagnitude; const DataBlock* m_pVolumeDataBlock; ///< data const Histogram1DDataBlock* m_pHist1DDataBlock; const Histogram2DDataBlock* m_pHist2DDataBlock; const MaxMinDataBlock* m_pMaxMinData; ///< acceleration info size_t block_number; }; class RDTimestep : public Timestep { public: RDTimestep() : Timestep() {} const RasterDataBlock* GetDB() const {return dynamic_cast(m_pVolumeDataBlock);} /// number of voxels of overlap with neighboring bricks UINTVECTOR3 m_aOverlap; /// size of the domain for this timestep (i.e. n_voxels in finest LOD) std::vector m_aDomainSize; /// max values for logical brick indices; std::vector index gives LOD. std::vector m_vaBrickCount; /// the size of each individual brick. Slowest moving dimension is LOD; /// then x,y,z. std::vector>>> m_vvaBrickSize; /// same layout as m_vvaBrickSize, but gives acceleration min/max info. std::vector>> m_vvaMaxMin; }; class TOCTimestep : public Timestep { public: TOCTimestep() : Timestep() {} const TOCBlock* GetDB() const {return dynamic_cast(m_pVolumeDataBlock);} }; class UVFDataset : public LinearIndexDataset, public FileBackedDataset { public: UVFDataset(const std::string& strFilename, uint64_t iMaxAcceptableBricksize, bool bVerify, bool bMustBeSameVersion = true); UVFDataset(); virtual ~UVFDataset(); // Brick Data virtual UINTVECTOR3 GetBrickVoxelCounts(const BrickKey&) const; virtual UINT64VECTOR3 GetEffectiveBrickSize(const BrickKey &) const; virtual bool GetBrick(const BrickKey&, std::vector&) const; virtual bool GetBrick(const BrickKey&, std::vector&) const; virtual bool GetBrick(const BrickKey&, std::vector&) const; virtual bool GetBrick(const BrickKey&, std::vector&) const; virtual bool GetBrick(const BrickKey&, std::vector&) const; virtual bool GetBrick(const BrickKey&, std::vector&) const; virtual bool GetBrick(const BrickKey&, std::vector&) const; virtual bool GetBrick(const BrickKey&, std::vector&) const; /// Acceleration queries. virtual bool ContainsData(const BrickKey &k, double isoval) const; virtual bool ContainsData(const BrickKey &k, double fMin,double fMax) const; virtual bool ContainsData(const BrickKey &k, double fMin,double fMax, double fMinGradient,double fMaxGradient) const; /// @returns the min/max scalar and gradient values for the given brick tuvok::MinMaxBlock MaxMinForKey(const BrickKey& k) const; // LOD Data /// @todo fixme -- this should take a brick key and just ignore the spatial /// indices. ///@{ virtual BrickTable::size_type GetBrickCount(size_t lod, size_t ts) const; virtual size_t GetLargestSingleBrickLOD(size_t ts) const; virtual UINT64VECTOR3 GetDomainSize(const size_t lod=0, const size_t ts=0) const; ///@} virtual uint64_t GetNumberOfTimesteps() const; UINTVECTOR3 GetBrickLayout(size_t lod, size_t ts) const; // Global Data float MaxGradientMagnitude() const; virtual UINTVECTOR3 GetMaxBrickSize() const; virtual UINTVECTOR3 GetMaxUsedBrickSizes() const; virtual UINTVECTOR3 GetBrickOverlapSize() const; virtual unsigned GetLODLevelCount() const; virtual unsigned GetBitWidth() const; virtual uint64_t GetComponentCount() const; virtual bool GetIsSigned() const; virtual bool GetIsFloat() const; virtual bool IsSameEndianness() const; virtual std::pair GetRange() const; // computes the range and caches it internally for the next call to // 'GetRange'. void ComputeRange(); // Global "Operations" and additional data not from the UVF file virtual bool Export(uint64_t iLODLevel, const std::string& targetFilename, bool bAppend) const; virtual bool ApplyFunction(uint64_t iLODLevel, bool (*brickFunc)(void* pData, const UINT64VECTOR3& vBrickSize, const UINT64VECTOR3& vBrickOffset, void* pUserContext), void *pUserContext= NULL, uint64_t iOverlap=0) const; virtual const std::vector> GetMetadata() const; virtual bool SaveRescaleFactors(); virtual bool Crop( const PLANE& plane, const std::string& strTempDir, bool bKeepOldData, bool bUseMedianFilter, bool bClampToEdge); bool AppendMesh(std::shared_ptr m); bool RemoveMesh(size_t iMeshIndex); bool GeometryTransformToFile(size_t iMeshIndex, const FLOATMATRIX4& m); virtual std::string Filename() const { return m_strFilename; } virtual bool CanRead(const std::string&, const std::vector&) const; virtual bool Verify(const std::string&) const; virtual Dataset* Create(const std::string&, uint64_t, bool) const; virtual std::list Extensions() const; const UVF* GetUVFFile() const {return m_pDatasetFile;} virtual const char* Name() const { if(!m_timesteps.empty()) { return m_timesteps[0]->m_pVolumeDataBlock->strBlockID.c_str(); } else { return "Generic UVF Dataset"; } } NDBrickKey IndexToVectorKey(const BrickKey &k) const; UINT64VECTOR4 KeyToTOCVector(const BrickKey &k) const; BrickKey TOCVectorToKey(const UINTVECTOR4& hash, size_t timestep) const; bool IsTOCBlock() const {return m_bToCBlock;} /// this function computes the texture coordinates for a given brick /// this may be non trivial with power of two padding, overlap handling /// and per brick rescale virtual std::pair GetTextCoords(BrickTable::const_iterator brick, bool bUseOnlyPowerOfTwo) const; private: std::vector IndexToVector(const BrickKey &k) const; /// @throws a tuvok::Exception if the open fails. void Open(bool bVerify, bool bReadWrite, bool bMustBeSameVersion=true); void Close(); void FindSuitableDataBlocks(); void ComputeMetaData(size_t ts); void ComputeMetadataTOC(size_t ts); void ComputeMetadataRDB(size_t ts); void GetHistograms(size_t ts); void FixOverlap(uint64_t& v, uint64_t brickIndex, uint64_t maxindex, uint64_t overlap) const; size_t DetermineNumberOfTimesteps(); bool VerifyRasterDataBlock(const RasterDataBlock*) const; bool VerifyTOCBlock(const TOCBlock* tb) const; template bool GetBrickTemplate(const BrickKey& k, std::vector& vData) const { if (m_bToCBlock) { const UINT64VECTOR4 coords = KeyToTOCVector(k); const TOCTimestep* ts = static_cast(m_timesteps[std::get<0>(k)]); size_t targetSize = size_t(ts->GetDB()->GetComponentTypeSize() * ts->GetDB()->GetComponentCount() * ts->GetDB()->GetBrickSize(coords).volume())/sizeof(T); vData.resize(targetSize); uint8_t* pData = (uint8_t*)&vData[0]; ts->GetDB()->GetData(pData,coords); if (ts->GetDB()->GetAtlasSize(coords).area() != 0) { VolumeTools::DeAtalasify(targetSize, ts->GetDB()->GetAtlasSize(coords), ts->GetDB()->GetMaxBrickSize(), ts->GetDB()->GetBrickSize(coords), pData, pData); } return true; } else { const NDBrickKey& key = this->IndexToVectorKey(k); const RDTimestep* ts = static_cast(m_timesteps[key.timestep]); return ts->GetDB()->GetData(vData, key.lod, key.brick); } } private: bool m_bToCBlock; std::vector m_timesteps; std::vector m_TriSoupBlocks; const KeyValuePairDataBlock* m_pKVDataBlock; UINTVECTOR3 m_aMaxBrickSize; bool m_bIsSameEndianness; UVF* m_pDatasetFile; const std::string m_strFilename; std::pair m_CachedRange; uint64_t m_iMaxAcceptableBricksize; FLOATVECTOR3 GetVolCoord(uint64_t pos, const UINT64VECTOR3& domSize) { UINT64VECTOR3 domCoords; domCoords.x = pos % domSize.x; domCoords.y = (pos / domSize.x) % domSize.y; domCoords.z = pos / (domSize.x*domSize.y); FLOATVECTOR3 normCoords(float(domCoords.x) / float(domSize.x), float(domCoords.y) / float(domSize.y), float(domCoords.z) / float(domSize.z)); normCoords -= FLOATVECTOR3(0.5, 0.5, 0.5); return normCoords; } template bool CropData(LargeRAWFile& dataFile, const PLANE& plane, const UINT64VECTOR3& domSize, const uint64_t iComponentCount) { assert(iComponentCount == size_t(iComponentCount)); size_t iInCoreElemCount = AbstrConverter::GetIncoreSize()/sizeof(T); // make sure iInCoreElemCount is a multiple of iComponentCount to // read only entire tuples iInCoreElemCount = size_t(iComponentCount)*(iInCoreElemCount/size_t(iComponentCount)); uint64_t iFileSize = dataFile.GetCurrentSize(); if (sizeof(T)*iComponentCount*domSize.volume() != iFileSize) { return false; } T* data = new T[iInCoreElemCount]; size_t iElemsRead; uint64_t iFilePos = 0; do { iElemsRead = dataFile.ReadRAW((unsigned char*)data, iInCoreElemCount*sizeof(T))/sizeof(T); // march through the data tuple by tuple // TODO: optimize this by computing the start and end of a scan line and perform block operations for (size_t elem = 0;elem 0); delete [] data; return true; } }; } #endif // TUVOK_UVF_DATASET_H ImageVis3D-3.1.0/Tuvok/IO/I3MConverter.cpp0000644000175000017500000003511112320456500017661 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file I3MConverter.cpp \author Jens Krueger SCI Institute University of Utah \date December 2008 */ #include #include "I3MConverter.h" #include "Basics/SysTools.h" #include "Controller/Controller.h" #include "IO/KeyValueFileParser.h" #include "TuvokIOError.h" using namespace std; // 42 and 69, guess that is "best of both worlds" :-) #define I3M_MAGIC 69426942 #define I3M_VERSION 1 #define MAX_I3M_VOLSIZE 128 I3MConverter::I3MConverter() { m_vConverterDesc = "ImageVis3D Mobile Data"; m_vSupportedExt.push_back("I3M"); } bool I3MConverter::ConvertToRAW(const std::string& strSourceFilename, const std::string& strTempDir, bool, uint64_t& iHeaderSkip, unsigned& iComponentSize, uint64_t& iComponentCount, bool& bConvertEndianess, bool& bSigned, bool& bIsFloat, UINT64VECTOR3& vVolumeSize, FLOATVECTOR3& vVolumeAspect, std::string& strTitle, std::string& strIntermediateFile, bool& bDeleteIntermediateFile) { MESSAGE("Attempting to convert an ImageVis3D mobile dataset %s", strSourceFilename.c_str()); bDeleteIntermediateFile = true; strTitle = "ImageVis3D Mobile data"; iHeaderSkip = 0; // I3M files are always four component 8bit little endian // unsigned, whereas the first 3 component of the vector // are the normalized gradient/normal and the fourth is the // actual data value, so all we need to todo here is parse // the binary header for the size and aspect ratio and then // create an intermediate RAW file taking every fourth byte // after the header while doing so we make sure to write the // file in the endianess of this machine iComponentSize = 8; iComponentCount = 1; bIsFloat = false; bSigned = false; bConvertEndianess = false; LargeRAWFile I3MFile(strSourceFilename, 0); I3MFile.Open(false); if (!I3MFile.IsOpen()) { T_ERROR("Unable to open source file %s", strSourceFilename.c_str()); return false; } // get file size -> used for verification later uint64_t ulFileLength = I3MFile.GetCurrentSize(); // get magic -> should be I3M_MAGIC uint32_t iMagic; I3MFile.ReadData(iMagic, false); if (iMagic != I3M_MAGIC) { I3MFile.Close(); T_ERROR("This is not a valid I3M file %s", strSourceFilename.c_str()); return false; } MESSAGE("I3M Magic OK"); // get version number -> must match I3M_VERSION uint32_t iVersion; I3MFile.ReadData(iVersion, false); if (iVersion != I3M_VERSION) { I3MFile.Close(); T_ERROR("Unsuported I3M version in file %s", strSourceFilename.c_str()); return false; } MESSAGE("I3M Version OK"); // get volume size -> every dimension must be MAX_I3M_VOLSIZE or less uint32_t iSize; I3MFile.ReadData(iSize, false); vVolumeSize.x = iSize; I3MFile.ReadData(iSize, false); vVolumeSize.y = iSize; I3MFile.ReadData(iSize, false); vVolumeSize.z = iSize; if (vVolumeSize.x > MAX_I3M_VOLSIZE || vVolumeSize.y > MAX_I3M_VOLSIZE || vVolumeSize.z > MAX_I3M_VOLSIZE) { I3MFile.Close(); T_ERROR("Invalid volume size detected in I3M file %s", strSourceFilename.c_str()); return false; } MESSAGE("Volume Size (%llu x %llu x %llu) in I3M file OK", vVolumeSize.x, vVolumeSize.y, vVolumeSize.z); // at this point we can check if the file has the correct size if ( 8*4 /* eight 32bit fields in the header */ + 4*vVolumeSize.volume() /* four component 8bit volume */ != ulFileLength) { I3MFile.Close(); T_ERROR("The size of the I3M file %s " "does not match the information in its header.", strSourceFilename.c_str()); return false; } MESSAGE("File Size (%llu) of I3M file OK", ulFileLength); // get volume aspect I3MFile.ReadData(vVolumeAspect.x, false); I3MFile.ReadData(vVolumeAspect.y, false); I3MFile.ReadData(vVolumeAspect.z, false); MESSAGE("Aspect Ratio (%g x %g x %g)", vVolumeAspect.x, vVolumeAspect.y, vVolumeAspect.z); if (vVolumeAspect.x <= 0) { WARNING("aspect ratio in x-direction is zero or less, setting it to 1"); vVolumeAspect.x = 1; } if (vVolumeAspect.y <= 0) { WARNING("aspect ratio in y-direction is zero or less, setting it to 1"); vVolumeAspect.y = 1; } if (vVolumeAspect.z <= 0) { WARNING("aspect ratio in z-direction is zero or less, setting it to 1"); vVolumeAspect.z = 1; } // header is completed all test passed, now we can read the volume, // simply copy every fourth byte to the target file MESSAGE("I3M File header scan completed, converting volume..."); strIntermediateFile = strTempDir + SysTools::GetFilename(strSourceFilename) + ".temp"; LargeRAWFile RAWFile(strIntermediateFile, 0); RAWFile.Create(); if (!RAWFile.IsOpen()) { T_ERROR("Unable to open intermediate file %s", strIntermediateFile.c_str()); I3MFile.Close(); return false; } unsigned char* pData = new unsigned char[4*size_t(vVolumeSize.volume())]; // read the 4D vectors I3MFile.ReadRAW(pData, 4*vVolumeSize.volume()); I3MFile.Close(); // compress in-place for (uint32_t i = 1;i(z+1), vVolumeSize[2], 100.0f*float(z+1)/float(vVolumeSize[2])); for (size_t y = 0;y 0) {iLeft = iCenter-1; vScale.x++;} if (x < vVolumeSize[0]-1) {iRight = iCenter+1; vScale.x++;} if (y > 0) {iTop = iCenter-size_t(vVolumeSize[0]);vScale.y++;} if (y < vVolumeSize[1]-1) {iBottom = iCenter+size_t(vVolumeSize[0]);vScale.y++;} if (z > 0) {iFront = iCenter-size_t(vVolumeSize[0])*size_t(vVolumeSize[1]);vScale.z++;} if (z < vVolumeSize[2]-1) {iBack = iCenter+size_t(vVolumeSize[0])*size_t(vVolumeSize[1]);vScale.z++;} // compte central differences FLOATVECTOR3 vGradient((float(pSourceData[iLeft]) -float(pSourceData[iRight]) )/(255*vScale.x), (float(pSourceData[iTop]) -float(pSourceData[iBottom]))/(255*vScale.y), (float(pSourceData[iFront])-float(pSourceData[iBack]) )/(255*vScale.z)); // safe normalize vGradient.normalize(0); // quantize to 8bit VECTOR4 vUCharGradient = VECTOR3((vGradient * 127)+127); // store in expanded format pTargetData[0+iCenter*4] = vUCharGradient.x; pTargetData[1+iCenter*4] = vUCharGradient.y; pTargetData[2+iCenter*4] = vUCharGradient.z; pTargetData[3+iCenter*4] = pSourceData[iCenter]; } } } } void I3MConverter::DownSample(LargeRAWFile& SourceRAWFile, unsigned char* pDenseData, const UINT64VECTOR3& vVolumeSize, const UINT64VECTOR3& vDSFactor) { UINT64VECTOR3 vSmallSize = vVolumeSize/vDSFactor; uint64_t iNumDownsampledValues = vDSFactor.volume(); size_t iTargetIndex = 0; size_t iSourceIndex = 0; for (size_t z = 0;z(z+1), vSmallSize[2], 100.0f*float(z+1)/float(vSmallSize[2])); for (size_t y = 0;y(&cValue, 1, iSourceIndex, 0); fAccValue += cValue; } } } fAccValue /= iNumDownsampledValues; pDenseData[iTargetIndex++] = (unsigned char)(fAccValue); } } } } bool I3MConverter::ConvertToNative(const std::string& strRawFilename, const std::string& strTargetFilename, uint64_t iHeaderSkip, unsigned iComponentSize, uint64_t iComponentCount, bool bSigned, bool bFloatingPoint, UINT64VECTOR3 vVolumeSize, FLOATVECTOR3 vVolumeAspect, bool , const bool ) { // some fitness checks first if (iComponentCount!=1) { T_ERROR("I3M only supports scalar data"); return false; } // next check the quantization and endianess of the volume // if it is not 8bit unsigned char -> convert it bool bDelete8BitFile = false; string str8BitFilename = strRawFilename; if (iComponentSize!=8 || bSigned) { LargeRAWFile rf(strRawFilename, iHeaderSkip); rf.Open(false); if(!rf.IsOpen()) { using namespace tuvok::io; throw DSOpenFailed(strRawFilename.c_str(), "Could not quantize input.", __FILE__, __LINE__); } const std::string quantizedFilname = strTargetFilename+".tmp"; if (QuantizeTo8Bit(rf,quantizedFilname, iComponentSize, vVolumeSize.volume(), bSigned,bFloatingPoint)) { iHeaderSkip = 0; str8BitFilename = quantizedFilname; bDelete8BitFile = true; iComponentSize = 8; bSigned = false; bFloatingPoint = false; } rf.Close(); } // next check is size of the volume, if a dimension is bigger than // MAX_I3M_VOLSIZE -> downsample the volume, otherwise simply copy LargeRAWFile UCharDataFile(str8BitFilename, iHeaderSkip); UCharDataFile.Open(false); if (!UCharDataFile.IsOpen()) { if (bDelete8BitFile) T_ERROR("Unable to open temp file for reading %s", str8BitFilename.c_str()); else T_ERROR("Unable to open input file for reading %s", str8BitFilename.c_str()); return false; } FLOATVECTOR3 vfDownSampleFactor = FLOATVECTOR3(vVolumeSize)/float(MAX_I3M_VOLSIZE); unsigned char* pDenseData = NULL; UINT64VECTOR3 vI3MVolumeSize; if (vfDownSampleFactor.x <= 1 && vfDownSampleFactor.y <= 1 && vfDownSampleFactor.z <= 1) { // volume is small enougth -> simply read the data into the array vI3MVolumeSize = vVolumeSize; pDenseData = new unsigned char[size_t(vI3MVolumeSize.volume())]; UCharDataFile.ReadRAW(pDenseData, vI3MVolumeSize.volume()); } else { // volume has to be downsampled UINT64VECTOR3 viDownSampleFactor(uint64_t(ceil(vfDownSampleFactor.x)), uint64_t(ceil(vfDownSampleFactor.y)), uint64_t(ceil(vfDownSampleFactor.z))); vI3MVolumeSize = vVolumeSize/viDownSampleFactor; pDenseData = new unsigned char[size_t(vI3MVolumeSize.volume())]; DownSample(UCharDataFile, pDenseData, vVolumeSize, viDownSampleFactor); // adjust aspect ratio vVolumeAspect *= FLOATVECTOR3(vVolumeSize) / FLOATVECTOR3(vI3MVolumeSize); } UCharDataFile.Close(); if (bDelete8BitFile) UCharDataFile.Delete(); // compute the gradients and expand data to vector format unsigned char* pData = new unsigned char[size_t(4*vI3MVolumeSize.volume())]; Compute8BitGradientVolumeInCore(pDenseData, pData, vI3MVolumeSize); delete [] pDenseData; // write data to file LargeRAWFile TargetI3MFile(strTargetFilename, 0); TargetI3MFile.Create(); if (!TargetI3MFile.IsOpen()) { T_ERROR("Unable to open I3M file %s", strTargetFilename.c_str()); delete [] pData; return false; } MESSAGE("Writing header information to disk"); // magic TargetI3MFile.WriteData(I3M_MAGIC, false); // version TargetI3MFile.WriteData(I3M_VERSION, false); // (subsampled) domain size TargetI3MFile.WriteData(uint32_t(vI3MVolumeSize.x), false); TargetI3MFile.WriteData(uint32_t(vI3MVolumeSize.y), false); TargetI3MFile.WriteData(uint32_t(vI3MVolumeSize.z), false); // aspect ratio TargetI3MFile.WriteData(vVolumeAspect.x, false); TargetI3MFile.WriteData(vVolumeAspect.y, false); TargetI3MFile.WriteData(vVolumeAspect.z, false); MESSAGE("Writing volume to disk"); TargetI3MFile.WriteRAW(pData, 4*vI3MVolumeSize.volume()); TargetI3MFile.Close(); delete [] pData; return true; } ImageVis3D-3.1.0/Tuvok/IO/VGIHeaderParser.h0000644000175000017500000000475612320456500017774 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : VGIHeaderParser.h //! Author : Jens Krueger //! DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : June 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #pragma once #ifndef VGIHEADERPARSER_H #define VGIHEADERPARSER_H #include "KeyValueFileParser.h" /** \class VGIHeaderParser * VGIHeaderParser parses VGStudio header file s(*.vgi) * essentailly these are simple text files strucutured as * key = value [newline] * but with sections marked by * {SECTIONNAME} * and with thse subsections marked by * [SUBSECTIONNAME] * for imagevis we are interested in the section * {volumeN} * where N is number starting at 1 (!!!) * and within those sections we are looking for the subsection * [fileN] */ class VGIHeaderParser : public KeyValueFileParser { public: VGIHeaderParser(const std::string& strFilename); VGIHeaderParser(const std::wstring& wstrFilename); VGIHeaderParser(std::ifstream& fileData); ~VGIHeaderParser(void); protected: bool ParseFile(const std::string& strFilename); bool ParseFile(std::ifstream& fileData); void WaitForSection(std::ifstream& fileData, const std::string& match); void ParseUntilInvalid(std::ifstream& fileData); }; #endif // VGIHEADERPARSER_H ImageVis3D-3.1.0/Tuvok/IO/BrickCache.cpp0000644000175000017500000002627312320456500017370 0ustar mathieumathieu#include #include #include #include #include #include "BrickCache.h" #include "Controller/StackTimer.h" namespace tuvok { // This is used to basically get rid of a type. You can do: // std::vector data; // std::vector foo; // std::vector bar; // data.push_back(TypeErase>(foo)); // data.push_back(TypeErase>(bar)); // with 'MyTypeOne' and 'MyTypeTwo' being completely unrelated (they do not // need to have a common base class) struct TypeErase { struct GenericType { virtual ~GenericType() {} virtual size_t elems() const { return 0; } }; template struct TypeEraser : GenericType { TypeEraser(const T& t) : thing(t) {} TypeEraser(T&& t) : thing(std::forward(t)) {} virtual ~TypeEraser() {} T& get() { return thing; } size_t elems() const { return thing.size(); } private: T thing; }; std::shared_ptr gt; size_t width; TypeErase(const TypeErase& other) : gt(other.gt) , width(other.width) {} TypeErase(TypeErase&& other) : gt(std::move(other.gt)) , width(other.width) // width should stay the same right? {} TypeErase& operator=(const TypeErase& other) { if (this != &other) { gt = other.gt; width = other.width; } return *this; } TypeErase& operator=(TypeErase&& other) { if (this != &other) { gt = std::move(other.gt); width = other.width; // width should stay the same right? } return *this; } // this isn't a very good type eraser, because we require that the type has // an internal typedef 'value_type' which we can use to obtain the size of // it. not to mention the '.size()' member function that TypeEraser<> // requires, above. // But that's fine for our usage here; we're really just using this to store // vectors and erase the value_type in there anyway. template TypeErase(const T& t) : gt(new TypeEraser(t)) , width(sizeof(typename T::value_type)) {} template TypeErase(T&& t) : gt(new TypeEraser(std::forward(t))) , width(sizeof(typename std::remove_reference::type::value_type)) {} }; struct BrickInfo { BrickKey key; uint64_t access_time; BrickInfo(const BrickKey& k, time_t t) : key(k), access_time(uint64_t(t)) {} }; struct CacheLRU { typedef std::pair CacheElem; bool operator()(const CacheElem& a, const CacheElem& b) const { return a.first.access_time > b.first.access_time; } }; struct BrickCache::bcinfo { bcinfo(): bytes(0) {} // this is wordy but they all just forward to a real implementation below. const void* lookup(const BrickKey& k, uint8_t) { return this->typed_lookup(k); } const void* lookup(const BrickKey& k, uint16_t) { return this->typed_lookup(k); } const void* lookup(const BrickKey& k, uint32_t) { return this->typed_lookup(k); } const void* lookup(const BrickKey& k, uint64_t) { return this->typed_lookup(k); } const void* lookup(const BrickKey& k, int8_t) { return this->typed_lookup(k); } const void* lookup(const BrickKey& k, int16_t) { return this->typed_lookup(k); } const void* lookup(const BrickKey& k, int32_t) { return this->typed_lookup(k); } const void* lookup(const BrickKey& k, int64_t) { return this->typed_lookup(k); } const void* lookup(const BrickKey& k, float) { return this->typed_lookup(k); } // the erasure means we can just do the insert with the thing we already // have: it'll make a shared_ptr out of it and insert it into the // container. ///@{ const void* add(const BrickKey& k, std::vector& data) { return this->typed_add(k, data); } const void* add(const BrickKey& k, std::vector& data) { return this->typed_add(k, data); } const void* add(const BrickKey& k, std::vector& data) { return this->typed_add(k, data); } const void* add(const BrickKey& k, std::vector& data) { return this->typed_add(k, data); } const void* add(const BrickKey& k, std::vector& data) { return this->typed_add(k, data); } const void* add(const BrickKey& k, std::vector& data) { return this->typed_add(k, data); } const void* add(const BrickKey& k, std::vector& data) { return this->typed_add(k, data); } const void* add(const BrickKey& k, std::vector& data) { return this->typed_add(k, data); } const void* add(const BrickKey& k, std::vector& data) { return this->typed_add(k, data); } ///@} void remove() { if(!cache.empty()) { // libstdc++ complains it's not a heap otherwise.. somehow. bug? std::make_heap(this->cache.begin(), this->cache.end(), CacheLRU()); const CacheElem& entry = this->cache.front(); TypeErase::GenericType& gt = *(entry.second.gt); assert((entry.second.width * gt.elems()) <= this->bytes); this->bytes -= entry.second.width * gt.elems(); std::pop_heap(this->cache.begin(), this->cache.end(), CacheLRU()); this->cache.pop_back(); } assert(this->size() == this->bytes); } size_t size() const { return this->bytes; } private: template const void* typed_lookup(const BrickKey& k); template const void* typed_add(const BrickKey&, std::vector&); private: typedef std::pair CacheElem; std::vector cache; size_t bytes; ///< how much memory we're currently using for data. }; struct KeyMatches { bool operator()(const BrickKey& key, const std::pair& a) const { return key == a.first.key; } }; // if the key doesn't exist, you get an empty vector. template const void* BrickCache::bcinfo::typed_lookup(const BrickKey& k) { using namespace std::placeholders; KeyMatches km; auto func = std::bind(&KeyMatches::operator(), km, k, _1); // gcc can't seem to deduce this with 'auto'. typedef std::vector maptype; maptype::iterator i = std::find_if(this->cache.begin(), this->cache.end(), func); if(i == this->cache.end()) { return NULL; } i->first.access_time = time(NULL); TypeErase::GenericType& gt = *(i->second.gt); assert(this->size() == this->bytes); return dynamic_cast>&>(gt).get().data(); } template const void* BrickCache::bcinfo::typed_add(const BrickKey& k, std::vector& data) { // maybe the case of a general cache allows duplicate insert, but for our uses // there should never be a duplicate entry. #ifndef NDEBUG KeyMatches km; using namespace std::placeholders; auto func = std::bind(&KeyMatches::operator(), km, k, _1); assert(std::find_if(this->cache.begin(), this->cache.end(), func) == this->cache.end()); #endif this->bytes += sizeof(T) * data.size(); this->cache.push_back(std::make_pair(BrickInfo(k, time(NULL)), std::move(data))); assert(this->size() == this->bytes); TypeErase::GenericType& gt = *this->cache.back().second.gt; return dynamic_cast>&>(gt).get().data(); } BrickCache::BrickCache() : ci(new BrickCache::bcinfo) {} BrickCache::~BrickCache() {} const void* BrickCache::lookup(const BrickKey& k, uint8_t value) { return this->ci->lookup(k, value); } const void* BrickCache::lookup(const BrickKey& k, uint16_t value) { return this->ci->lookup(k, value); } const void* BrickCache::lookup(const BrickKey& k, uint32_t value) { return this->ci->lookup(k, value); } const void* BrickCache::lookup(const BrickKey& k, uint64_t value) { return this->ci->lookup(k, value); } const void* BrickCache::lookup(const BrickKey& k, int8_t value) { return this->ci->lookup(k, value); } const void* BrickCache::lookup(const BrickKey& k, int16_t value) { return this->ci->lookup(k, value); } const void* BrickCache::lookup(const BrickKey& k, int32_t value) { return this->ci->lookup(k, value); } const void* BrickCache::lookup(const BrickKey& k, int64_t value) { return this->ci->lookup(k, value); } const void* BrickCache::lookup(const BrickKey& k, float value) { return this->ci->lookup(k, value); } const void* BrickCache::add(const BrickKey& k, std::vector& data) { return this->ci->add(k, data); } const void* BrickCache::add(const BrickKey& k, std::vector& data) { return this->ci->add(k, data); } const void* BrickCache::add(const BrickKey& k, std::vector& data) { return this->ci->add(k, data); } const void* BrickCache::add(const BrickKey& k, std::vector& data) { return this->ci->add(k, data); } const void* BrickCache::add(const BrickKey& k, std::vector& data) { return this->ci->add(k, data); } const void* BrickCache::add(const BrickKey& k, std::vector& data) { return this->ci->add(k, data); } const void* BrickCache::add(const BrickKey& k, std::vector& data) { return this->ci->add(k, data); } const void* BrickCache::add(const BrickKey& k, std::vector& data) { return this->ci->add(k, data); } const void* BrickCache::add(const BrickKey& k, std::vector& data) { return this->ci->add(k, data); } void BrickCache::remove() { this->ci->remove(); } size_t BrickCache::size() const { return this->ci->size(); } } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2013 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/scripts/0000755000175000017500000000000012320456500016054 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/scripts/oneshot-debug.sh0000755000175000017500000000322712320456500021162 0ustar mathieumathieu#!/bin/sh # Script to build everything we can in a single invocation, using # a set of options which is appropriate for creating debug builds. VIS="-fvisibility=hidden" INL="-fvisibility-inlines-hidden" if test `uname -s` != "Darwin"; then COVERAGE="-fprofile-arcs -ftest-coverage" else COVERAGE="" fi CF="-g -Wall -Wextra -O0 -D_DEBUG ${COVERAGE}" CXF="${COVERAGE}" LDFLAGS="${COVERAGE}" MKSPEC="" # Darwin's debug STL support is broken. if test `uname -s` != "Darwin"; then CXF="${CXF} -D_GLIBCXX_DEBUG -D_GLIBCXX_CONCEPT_CHECK -Werror -fopenmp" LDFLAGS="${LDFLAGS} -fopenmp" else MKSPEC="-spec unsupported/macx-clang" fi # Users can set the QT_BIN env var to point at a different Qt implementation. if test -n "${QT_BIN}" ; then echo "Using qmake from '${QT_BIN}' instead of the default from PATH." qm="${QT_BIN}/qmake" else qm="qmake" fi echo "Configuring..." ${qm} \ ${MKSPEC} \ QMAKE_CONFIG+="debug" \ QMAKE_CFLAGS+="${VIS} ${CF}" \ QMAKE_CXXFLAGS+="${VIS} ${INL} ${CF} ${CXF}" \ QMAKE_LFLAGS+="${VIS} ${LDFLAGS}" \ -recursive Tuvok.pro || exit 1 pushd IO/test &> /dev/null || exit 1 ${qm} \ ${MKSPEC} \ QMAKE_CONFIG+="debug" \ QMAKE_CFLAGS+="${VIS} ${CF}" \ QMAKE_CXXFLAGS+="${VIS} ${INL} ${CF} ${CXF}" \ QMAKE_LFLAGS+="${VIS} ${LDFLAGS}" \ -recursive test.pro || exit 1 popd &>/dev/null # Unless the user gave us input as to options to use, default to a small-scale # parallel build. if test -z "${MAKE_OPTIONS}" ; then MAKE_OPTIONS="-j2 -l 2.0" fi for d in . IO/test ; do echo "BUILDING IN ${d}" pushd ${d} &> /dev/null || exit 1 make --no-print-directory ${MAKE_OPTIONS} || exit 1 popd &> /dev/null done ImageVis3D-3.1.0/Tuvok/scripts/oneshot-debug.bat0000644000175000017500000000151412320456500021310 0ustar mathieumathieuREM Script to build everything we can in a single invocation, using REM a set of options which is appropriate for creating debug builds. set w32_cf="-D_CRT_SECURE_NO_WARNINGS=1 -D_SCL_SECURE_NO_WARNINGS=1" qmake -tp vc ^ QMAKE_CFLAGS+=%w32_cf% ^ QMAKE_CXXFLAGS+=%w32_cf% ^ QMAKE_LFLAGS+=%w32_cf% ^ -recursive ^ Tuvok.pro REM hardcoding vs2008 for now =( set bld="C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.COM" %bld% ^ Tuvok.sln ^ /nologo ^ /Rebuild pushd IO\test python ../3rdParty/cxxtest/cxxtestgen.py ^ --no-static-init ^ --error-printer ^ -o alltests.cpp ^ quantize.h ^ jpeg.h qmake -tp vc ^ QMAKE_CFLAGS+=%w32_cf% ^ QMAKE_CXXFLAGS+=%w32_cf% ^ QMAKE_LFLAGS+=%w32_cf% ^ -recursive ^ test.pro %bld% ^ test.sln ^ /nologo ^ /Rebuild popd ImageVis3D-3.1.0/Tuvok/3rdParty/0000755000175000017500000000000012320456500016075 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/3rdParty/GLEW/0000755000175000017500000000000012320456500016633 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/3rdParty/GLEW/GL/0000755000175000017500000000000012320456500017135 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/3rdParty/GLEW/GL/wglew.h0000644000175000017500000016750212320456500020446 0ustar mathieumathieu/* ** The OpenGL Extension Wrangler Library ** Copyright (C) 2002-2008, Milan Ikits ** Copyright (C) 2002-2008, Marcelo E. Magallon ** Copyright (C) 2002, Lev Povalahev ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: ** ** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright notice, ** this list of conditions and the following disclaimer in the documentation ** and/or other materials provided with the distribution. ** * The name of the author may be used to endorse or promote products ** derived from this software without specific prior written permission. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF ** THE POSSIBILITY OF SUCH DAMAGE. */ /* ** Copyright (c) 2007 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including ** without limitation the rights to use, copy, modify, merge, publish, ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are furnished to do so, subject to ** the following conditions: ** ** The above copyright notice and this permission notice shall be included ** in all copies or substantial portions of the Materials. ** ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ #ifndef __wglew_h__ #define __wglew_h__ #define __WGLEW_H__ #ifdef __wglext_h_ #error wglext.h included before wglew.h #endif #define __wglext_h_ #if !defined(WINAPI) # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN 1 # endif #include # undef WIN32_LEAN_AND_MEAN #endif /* * GLEW_STATIC needs to be set when using the static version. * GLEW_BUILD is set when building the DLL version. */ #ifdef GLEW_STATIC # define GLEWAPI extern #else # ifdef GLEW_BUILD # define GLEWAPI extern __declspec(dllexport) # else # define GLEWAPI extern __declspec(dllimport) # endif #endif #ifdef __cplusplus extern "C" { #endif /* -------------------------- WGL_3DFX_multisample ------------------------- */ #ifndef WGL_3DFX_multisample #define WGL_3DFX_multisample 1 #define WGL_SAMPLE_BUFFERS_3DFX 0x2060 #define WGL_SAMPLES_3DFX 0x2061 #define WGLEW_3DFX_multisample WGLEW_GET_VAR(__WGLEW_3DFX_multisample) #endif /* WGL_3DFX_multisample */ /* ------------------------- WGL_3DL_stereo_control ------------------------ */ #ifndef WGL_3DL_stereo_control #define WGL_3DL_stereo_control 1 #define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055 #define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056 #define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057 #define WGL_STEREO_POLARITY_INVERT_3DL 0x2058 typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState); #define wglSetStereoEmitterState3DL WGLEW_GET_FUN(__wglewSetStereoEmitterState3DL) #define WGLEW_3DL_stereo_control WGLEW_GET_VAR(__WGLEW_3DL_stereo_control) #endif /* WGL_3DL_stereo_control */ /* ------------------------ WGL_AMD_gpu_association ------------------------ */ #ifndef WGL_AMD_gpu_association #define WGL_AMD_gpu_association 1 #define WGL_GPU_VENDOR_AMD 0x1F00 #define WGL_GPU_RENDERER_STRING_AMD 0x1F01 #define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02 #define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2 #define WGL_GPU_RAM_AMD 0x21A3 #define WGL_GPU_CLOCK_AMD 0x21A4 #define WGL_GPU_NUM_PIPES_AMD 0x21A5 #define WGL_GPU_NUM_SIMD_AMD 0x21A6 #define WGL_GPU_NUM_RB_AMD 0x21A7 #define WGL_GPU_NUM_SPI_AMD 0x21A8 typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id); typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int* attribList); typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc); typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc); typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void); typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT* ids); typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, INT property, GLenum dataType, UINT size, void* data); typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc); #define wglBlitContextFramebufferAMD WGLEW_GET_FUN(__wglewBlitContextFramebufferAMD) #define wglCreateAssociatedContextAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAMD) #define wglCreateAssociatedContextAttribsAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAttribsAMD) #define wglDeleteAssociatedContextAMD WGLEW_GET_FUN(__wglewDeleteAssociatedContextAMD) #define wglGetContextGPUIDAMD WGLEW_GET_FUN(__wglewGetContextGPUIDAMD) #define wglGetCurrentAssociatedContextAMD WGLEW_GET_FUN(__wglewGetCurrentAssociatedContextAMD) #define wglGetGPUIDsAMD WGLEW_GET_FUN(__wglewGetGPUIDsAMD) #define wglGetGPUInfoAMD WGLEW_GET_FUN(__wglewGetGPUInfoAMD) #define wglMakeAssociatedContextCurrentAMD WGLEW_GET_FUN(__wglewMakeAssociatedContextCurrentAMD) #define WGLEW_AMD_gpu_association WGLEW_GET_VAR(__WGLEW_AMD_gpu_association) #endif /* WGL_AMD_gpu_association */ /* ------------------------- WGL_ARB_buffer_region ------------------------- */ #ifndef WGL_ARB_buffer_region #define WGL_ARB_buffer_region 1 #define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001 #define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002 #define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004 #define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008 typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType); typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion); typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height); #define wglCreateBufferRegionARB WGLEW_GET_FUN(__wglewCreateBufferRegionARB) #define wglDeleteBufferRegionARB WGLEW_GET_FUN(__wglewDeleteBufferRegionARB) #define wglRestoreBufferRegionARB WGLEW_GET_FUN(__wglewRestoreBufferRegionARB) #define wglSaveBufferRegionARB WGLEW_GET_FUN(__wglewSaveBufferRegionARB) #define WGLEW_ARB_buffer_region WGLEW_GET_VAR(__WGLEW_ARB_buffer_region) #endif /* WGL_ARB_buffer_region */ /* ------------------------- WGL_ARB_create_context ------------------------ */ #ifndef WGL_ARB_create_context #define WGL_ARB_create_context 1 #define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 #define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 #define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 #define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 #define WGL_CONTEXT_FLAGS_ARB 0x2094 #define ERROR_INVALID_VERSION_ARB 0x2095 #define ERROR_INVALID_PROFILE_ARB 0x2096 typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int* attribList); #define wglCreateContextAttribsARB WGLEW_GET_FUN(__wglewCreateContextAttribsARB) #define WGLEW_ARB_create_context WGLEW_GET_VAR(__WGLEW_ARB_create_context) #endif /* WGL_ARB_create_context */ /* --------------------- WGL_ARB_create_context_profile -------------------- */ #ifndef WGL_ARB_create_context_profile #define WGL_ARB_create_context_profile 1 #define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 #define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 #define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 #define WGLEW_ARB_create_context_profile WGLEW_GET_VAR(__WGLEW_ARB_create_context_profile) #endif /* WGL_ARB_create_context_profile */ /* ------------------- WGL_ARB_create_context_robustness ------------------- */ #ifndef WGL_ARB_create_context_robustness #define WGL_ARB_create_context_robustness 1 #define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 #define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 #define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 #define WGL_NO_RESET_NOTIFICATION_ARB 0x8261 #define WGLEW_ARB_create_context_robustness WGLEW_GET_VAR(__WGLEW_ARB_create_context_robustness) #endif /* WGL_ARB_create_context_robustness */ /* ----------------------- WGL_ARB_extensions_string ----------------------- */ #ifndef WGL_ARB_extensions_string #define WGL_ARB_extensions_string 1 typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc); #define wglGetExtensionsStringARB WGLEW_GET_FUN(__wglewGetExtensionsStringARB) #define WGLEW_ARB_extensions_string WGLEW_GET_VAR(__WGLEW_ARB_extensions_string) #endif /* WGL_ARB_extensions_string */ /* ------------------------ WGL_ARB_framebuffer_sRGB ----------------------- */ #ifndef WGL_ARB_framebuffer_sRGB #define WGL_ARB_framebuffer_sRGB 1 #define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9 #define WGLEW_ARB_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_ARB_framebuffer_sRGB) #endif /* WGL_ARB_framebuffer_sRGB */ /* ----------------------- WGL_ARB_make_current_read ----------------------- */ #ifndef WGL_ARB_make_current_read #define WGL_ARB_make_current_read 1 #define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043 #define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (VOID); typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); #define wglGetCurrentReadDCARB WGLEW_GET_FUN(__wglewGetCurrentReadDCARB) #define wglMakeContextCurrentARB WGLEW_GET_FUN(__wglewMakeContextCurrentARB) #define WGLEW_ARB_make_current_read WGLEW_GET_VAR(__WGLEW_ARB_make_current_read) #endif /* WGL_ARB_make_current_read */ /* -------------------------- WGL_ARB_multisample -------------------------- */ #ifndef WGL_ARB_multisample #define WGL_ARB_multisample 1 #define WGL_SAMPLE_BUFFERS_ARB 0x2041 #define WGL_SAMPLES_ARB 0x2042 #define WGLEW_ARB_multisample WGLEW_GET_VAR(__WGLEW_ARB_multisample) #endif /* WGL_ARB_multisample */ /* ---------------------------- WGL_ARB_pbuffer ---------------------------- */ #ifndef WGL_ARB_pbuffer #define WGL_ARB_pbuffer 1 #define WGL_DRAW_TO_PBUFFER_ARB 0x202D #define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E #define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F #define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030 #define WGL_PBUFFER_LARGEST_ARB 0x2033 #define WGL_PBUFFER_WIDTH_ARB 0x2034 #define WGL_PBUFFER_HEIGHT_ARB 0x2035 #define WGL_PBUFFER_LOST_ARB 0x2036 DECLARE_HANDLE(HPBUFFERARB); typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList); typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer); typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer); typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int* piValue); typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC); #define wglCreatePbufferARB WGLEW_GET_FUN(__wglewCreatePbufferARB) #define wglDestroyPbufferARB WGLEW_GET_FUN(__wglewDestroyPbufferARB) #define wglGetPbufferDCARB WGLEW_GET_FUN(__wglewGetPbufferDCARB) #define wglQueryPbufferARB WGLEW_GET_FUN(__wglewQueryPbufferARB) #define wglReleasePbufferDCARB WGLEW_GET_FUN(__wglewReleasePbufferDCARB) #define WGLEW_ARB_pbuffer WGLEW_GET_VAR(__WGLEW_ARB_pbuffer) #endif /* WGL_ARB_pbuffer */ /* -------------------------- WGL_ARB_pixel_format ------------------------- */ #ifndef WGL_ARB_pixel_format #define WGL_ARB_pixel_format 1 #define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 #define WGL_DRAW_TO_WINDOW_ARB 0x2001 #define WGL_DRAW_TO_BITMAP_ARB 0x2002 #define WGL_ACCELERATION_ARB 0x2003 #define WGL_NEED_PALETTE_ARB 0x2004 #define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 #define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 #define WGL_SWAP_METHOD_ARB 0x2007 #define WGL_NUMBER_OVERLAYS_ARB 0x2008 #define WGL_NUMBER_UNDERLAYS_ARB 0x2009 #define WGL_TRANSPARENT_ARB 0x200A #define WGL_SHARE_DEPTH_ARB 0x200C #define WGL_SHARE_STENCIL_ARB 0x200D #define WGL_SHARE_ACCUM_ARB 0x200E #define WGL_SUPPORT_GDI_ARB 0x200F #define WGL_SUPPORT_OPENGL_ARB 0x2010 #define WGL_DOUBLE_BUFFER_ARB 0x2011 #define WGL_STEREO_ARB 0x2012 #define WGL_PIXEL_TYPE_ARB 0x2013 #define WGL_COLOR_BITS_ARB 0x2014 #define WGL_RED_BITS_ARB 0x2015 #define WGL_RED_SHIFT_ARB 0x2016 #define WGL_GREEN_BITS_ARB 0x2017 #define WGL_GREEN_SHIFT_ARB 0x2018 #define WGL_BLUE_BITS_ARB 0x2019 #define WGL_BLUE_SHIFT_ARB 0x201A #define WGL_ALPHA_BITS_ARB 0x201B #define WGL_ALPHA_SHIFT_ARB 0x201C #define WGL_ACCUM_BITS_ARB 0x201D #define WGL_ACCUM_RED_BITS_ARB 0x201E #define WGL_ACCUM_GREEN_BITS_ARB 0x201F #define WGL_ACCUM_BLUE_BITS_ARB 0x2020 #define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 #define WGL_DEPTH_BITS_ARB 0x2022 #define WGL_STENCIL_BITS_ARB 0x2023 #define WGL_AUX_BUFFERS_ARB 0x2024 #define WGL_NO_ACCELERATION_ARB 0x2025 #define WGL_GENERIC_ACCELERATION_ARB 0x2026 #define WGL_FULL_ACCELERATION_ARB 0x2027 #define WGL_SWAP_EXCHANGE_ARB 0x2028 #define WGL_SWAP_COPY_ARB 0x2029 #define WGL_SWAP_UNDEFINED_ARB 0x202A #define WGL_TYPE_RGBA_ARB 0x202B #define WGL_TYPE_COLORINDEX_ARB 0x202C #define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 #define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 #define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 #define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A #define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, FLOAT *pfValues); typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, int *piValues); #define wglChoosePixelFormatARB WGLEW_GET_FUN(__wglewChoosePixelFormatARB) #define wglGetPixelFormatAttribfvARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvARB) #define wglGetPixelFormatAttribivARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribivARB) #define WGLEW_ARB_pixel_format WGLEW_GET_VAR(__WGLEW_ARB_pixel_format) #endif /* WGL_ARB_pixel_format */ /* ----------------------- WGL_ARB_pixel_format_float ---------------------- */ #ifndef WGL_ARB_pixel_format_float #define WGL_ARB_pixel_format_float 1 #define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0 #define WGLEW_ARB_pixel_format_float WGLEW_GET_VAR(__WGLEW_ARB_pixel_format_float) #endif /* WGL_ARB_pixel_format_float */ /* ------------------------- WGL_ARB_render_texture ------------------------ */ #ifndef WGL_ARB_render_texture #define WGL_ARB_render_texture 1 #define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070 #define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071 #define WGL_TEXTURE_FORMAT_ARB 0x2072 #define WGL_TEXTURE_TARGET_ARB 0x2073 #define WGL_MIPMAP_TEXTURE_ARB 0x2074 #define WGL_TEXTURE_RGB_ARB 0x2075 #define WGL_TEXTURE_RGBA_ARB 0x2076 #define WGL_NO_TEXTURE_ARB 0x2077 #define WGL_TEXTURE_CUBE_MAP_ARB 0x2078 #define WGL_TEXTURE_1D_ARB 0x2079 #define WGL_TEXTURE_2D_ARB 0x207A #define WGL_MIPMAP_LEVEL_ARB 0x207B #define WGL_CUBE_MAP_FACE_ARB 0x207C #define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D #define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E #define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F #define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080 #define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081 #define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082 #define WGL_FRONT_LEFT_ARB 0x2083 #define WGL_FRONT_RIGHT_ARB 0x2084 #define WGL_BACK_LEFT_ARB 0x2085 #define WGL_BACK_RIGHT_ARB 0x2086 #define WGL_AUX0_ARB 0x2087 #define WGL_AUX1_ARB 0x2088 #define WGL_AUX2_ARB 0x2089 #define WGL_AUX3_ARB 0x208A #define WGL_AUX4_ARB 0x208B #define WGL_AUX5_ARB 0x208C #define WGL_AUX6_ARB 0x208D #define WGL_AUX7_ARB 0x208E #define WGL_AUX8_ARB 0x208F #define WGL_AUX9_ARB 0x2090 typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int* piAttribList); #define wglBindTexImageARB WGLEW_GET_FUN(__wglewBindTexImageARB) #define wglReleaseTexImageARB WGLEW_GET_FUN(__wglewReleaseTexImageARB) #define wglSetPbufferAttribARB WGLEW_GET_FUN(__wglewSetPbufferAttribARB) #define WGLEW_ARB_render_texture WGLEW_GET_VAR(__WGLEW_ARB_render_texture) #endif /* WGL_ARB_render_texture */ /* ----------------------- WGL_ATI_pixel_format_float ---------------------- */ #ifndef WGL_ATI_pixel_format_float #define WGL_ATI_pixel_format_float 1 #define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0 #define GL_RGBA_FLOAT_MODE_ATI 0x8820 #define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 #define WGLEW_ATI_pixel_format_float WGLEW_GET_VAR(__WGLEW_ATI_pixel_format_float) #endif /* WGL_ATI_pixel_format_float */ /* -------------------- WGL_ATI_render_texture_rectangle ------------------- */ #ifndef WGL_ATI_render_texture_rectangle #define WGL_ATI_render_texture_rectangle 1 #define WGL_TEXTURE_RECTANGLE_ATI 0x21A5 #define WGLEW_ATI_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_ATI_render_texture_rectangle) #endif /* WGL_ATI_render_texture_rectangle */ /* ------------------- WGL_EXT_create_context_es2_profile ------------------ */ #ifndef WGL_EXT_create_context_es2_profile #define WGL_EXT_create_context_es2_profile 1 #define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 #define WGLEW_EXT_create_context_es2_profile WGLEW_GET_VAR(__WGLEW_EXT_create_context_es2_profile) #endif /* WGL_EXT_create_context_es2_profile */ /* ------------------- WGL_EXT_create_context_es_profile ------------------- */ #ifndef WGL_EXT_create_context_es_profile #define WGL_EXT_create_context_es_profile 1 #define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004 #define WGLEW_EXT_create_context_es_profile WGLEW_GET_VAR(__WGLEW_EXT_create_context_es_profile) #endif /* WGL_EXT_create_context_es_profile */ /* -------------------------- WGL_EXT_depth_float -------------------------- */ #ifndef WGL_EXT_depth_float #define WGL_EXT_depth_float 1 #define WGL_DEPTH_FLOAT_EXT 0x2040 #define WGLEW_EXT_depth_float WGLEW_GET_VAR(__WGLEW_EXT_depth_float) #endif /* WGL_EXT_depth_float */ /* ---------------------- WGL_EXT_display_color_table ---------------------- */ #ifndef WGL_EXT_display_color_table #define WGL_EXT_display_color_table 1 typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id); typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id); typedef void (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id); typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (GLushort* table, GLuint length); #define wglBindDisplayColorTableEXT WGLEW_GET_FUN(__wglewBindDisplayColorTableEXT) #define wglCreateDisplayColorTableEXT WGLEW_GET_FUN(__wglewCreateDisplayColorTableEXT) #define wglDestroyDisplayColorTableEXT WGLEW_GET_FUN(__wglewDestroyDisplayColorTableEXT) #define wglLoadDisplayColorTableEXT WGLEW_GET_FUN(__wglewLoadDisplayColorTableEXT) #define WGLEW_EXT_display_color_table WGLEW_GET_VAR(__WGLEW_EXT_display_color_table) #endif /* WGL_EXT_display_color_table */ /* ----------------------- WGL_EXT_extensions_string ----------------------- */ #ifndef WGL_EXT_extensions_string #define WGL_EXT_extensions_string 1 typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void); #define wglGetExtensionsStringEXT WGLEW_GET_FUN(__wglewGetExtensionsStringEXT) #define WGLEW_EXT_extensions_string WGLEW_GET_VAR(__WGLEW_EXT_extensions_string) #endif /* WGL_EXT_extensions_string */ /* ------------------------ WGL_EXT_framebuffer_sRGB ----------------------- */ #ifndef WGL_EXT_framebuffer_sRGB #define WGL_EXT_framebuffer_sRGB 1 #define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9 #define WGLEW_EXT_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_EXT_framebuffer_sRGB) #endif /* WGL_EXT_framebuffer_sRGB */ /* ----------------------- WGL_EXT_make_current_read ----------------------- */ #ifndef WGL_EXT_make_current_read #define WGL_EXT_make_current_read 1 #define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043 typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (VOID); typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); #define wglGetCurrentReadDCEXT WGLEW_GET_FUN(__wglewGetCurrentReadDCEXT) #define wglMakeContextCurrentEXT WGLEW_GET_FUN(__wglewMakeContextCurrentEXT) #define WGLEW_EXT_make_current_read WGLEW_GET_VAR(__WGLEW_EXT_make_current_read) #endif /* WGL_EXT_make_current_read */ /* -------------------------- WGL_EXT_multisample -------------------------- */ #ifndef WGL_EXT_multisample #define WGL_EXT_multisample 1 #define WGL_SAMPLE_BUFFERS_EXT 0x2041 #define WGL_SAMPLES_EXT 0x2042 #define WGLEW_EXT_multisample WGLEW_GET_VAR(__WGLEW_EXT_multisample) #endif /* WGL_EXT_multisample */ /* ---------------------------- WGL_EXT_pbuffer ---------------------------- */ #ifndef WGL_EXT_pbuffer #define WGL_EXT_pbuffer 1 #define WGL_DRAW_TO_PBUFFER_EXT 0x202D #define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E #define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F #define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030 #define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031 #define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032 #define WGL_PBUFFER_LARGEST_EXT 0x2033 #define WGL_PBUFFER_WIDTH_EXT 0x2034 #define WGL_PBUFFER_HEIGHT_EXT 0x2035 DECLARE_HANDLE(HPBUFFEREXT); typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList); typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer); typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer); typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int* piValue); typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC); #define wglCreatePbufferEXT WGLEW_GET_FUN(__wglewCreatePbufferEXT) #define wglDestroyPbufferEXT WGLEW_GET_FUN(__wglewDestroyPbufferEXT) #define wglGetPbufferDCEXT WGLEW_GET_FUN(__wglewGetPbufferDCEXT) #define wglQueryPbufferEXT WGLEW_GET_FUN(__wglewQueryPbufferEXT) #define wglReleasePbufferDCEXT WGLEW_GET_FUN(__wglewReleasePbufferDCEXT) #define WGLEW_EXT_pbuffer WGLEW_GET_VAR(__WGLEW_EXT_pbuffer) #endif /* WGL_EXT_pbuffer */ /* -------------------------- WGL_EXT_pixel_format ------------------------- */ #ifndef WGL_EXT_pixel_format #define WGL_EXT_pixel_format 1 #define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000 #define WGL_DRAW_TO_WINDOW_EXT 0x2001 #define WGL_DRAW_TO_BITMAP_EXT 0x2002 #define WGL_ACCELERATION_EXT 0x2003 #define WGL_NEED_PALETTE_EXT 0x2004 #define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005 #define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006 #define WGL_SWAP_METHOD_EXT 0x2007 #define WGL_NUMBER_OVERLAYS_EXT 0x2008 #define WGL_NUMBER_UNDERLAYS_EXT 0x2009 #define WGL_TRANSPARENT_EXT 0x200A #define WGL_TRANSPARENT_VALUE_EXT 0x200B #define WGL_SHARE_DEPTH_EXT 0x200C #define WGL_SHARE_STENCIL_EXT 0x200D #define WGL_SHARE_ACCUM_EXT 0x200E #define WGL_SUPPORT_GDI_EXT 0x200F #define WGL_SUPPORT_OPENGL_EXT 0x2010 #define WGL_DOUBLE_BUFFER_EXT 0x2011 #define WGL_STEREO_EXT 0x2012 #define WGL_PIXEL_TYPE_EXT 0x2013 #define WGL_COLOR_BITS_EXT 0x2014 #define WGL_RED_BITS_EXT 0x2015 #define WGL_RED_SHIFT_EXT 0x2016 #define WGL_GREEN_BITS_EXT 0x2017 #define WGL_GREEN_SHIFT_EXT 0x2018 #define WGL_BLUE_BITS_EXT 0x2019 #define WGL_BLUE_SHIFT_EXT 0x201A #define WGL_ALPHA_BITS_EXT 0x201B #define WGL_ALPHA_SHIFT_EXT 0x201C #define WGL_ACCUM_BITS_EXT 0x201D #define WGL_ACCUM_RED_BITS_EXT 0x201E #define WGL_ACCUM_GREEN_BITS_EXT 0x201F #define WGL_ACCUM_BLUE_BITS_EXT 0x2020 #define WGL_ACCUM_ALPHA_BITS_EXT 0x2021 #define WGL_DEPTH_BITS_EXT 0x2022 #define WGL_STENCIL_BITS_EXT 0x2023 #define WGL_AUX_BUFFERS_EXT 0x2024 #define WGL_NO_ACCELERATION_EXT 0x2025 #define WGL_GENERIC_ACCELERATION_EXT 0x2026 #define WGL_FULL_ACCELERATION_EXT 0x2027 #define WGL_SWAP_EXCHANGE_EXT 0x2028 #define WGL_SWAP_COPY_EXT 0x2029 #define WGL_SWAP_UNDEFINED_EXT 0x202A #define WGL_TYPE_RGBA_EXT 0x202B #define WGL_TYPE_COLORINDEX_EXT 0x202C typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, FLOAT *pfValues); typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, int *piValues); #define wglChoosePixelFormatEXT WGLEW_GET_FUN(__wglewChoosePixelFormatEXT) #define wglGetPixelFormatAttribfvEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvEXT) #define wglGetPixelFormatAttribivEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribivEXT) #define WGLEW_EXT_pixel_format WGLEW_GET_VAR(__WGLEW_EXT_pixel_format) #endif /* WGL_EXT_pixel_format */ /* ------------------- WGL_EXT_pixel_format_packed_float ------------------- */ #ifndef WGL_EXT_pixel_format_packed_float #define WGL_EXT_pixel_format_packed_float 1 #define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8 #define WGLEW_EXT_pixel_format_packed_float WGLEW_GET_VAR(__WGLEW_EXT_pixel_format_packed_float) #endif /* WGL_EXT_pixel_format_packed_float */ /* -------------------------- WGL_EXT_swap_control ------------------------- */ #ifndef WGL_EXT_swap_control #define WGL_EXT_swap_control 1 typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void); typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); #define wglGetSwapIntervalEXT WGLEW_GET_FUN(__wglewGetSwapIntervalEXT) #define wglSwapIntervalEXT WGLEW_GET_FUN(__wglewSwapIntervalEXT) #define WGLEW_EXT_swap_control WGLEW_GET_VAR(__WGLEW_EXT_swap_control) #endif /* WGL_EXT_swap_control */ /* ----------------------- WGL_EXT_swap_control_tear ----------------------- */ #ifndef WGL_EXT_swap_control_tear #define WGL_EXT_swap_control_tear 1 #define WGLEW_EXT_swap_control_tear WGLEW_GET_VAR(__WGLEW_EXT_swap_control_tear) #endif /* WGL_EXT_swap_control_tear */ /* --------------------- WGL_I3D_digital_video_control --------------------- */ #ifndef WGL_I3D_digital_video_control #define WGL_I3D_digital_video_control 1 #define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050 #define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051 #define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052 #define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053 typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue); typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue); #define wglGetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewGetDigitalVideoParametersI3D) #define wglSetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewSetDigitalVideoParametersI3D) #define WGLEW_I3D_digital_video_control WGLEW_GET_VAR(__WGLEW_I3D_digital_video_control) #endif /* WGL_I3D_digital_video_control */ /* ----------------------------- WGL_I3D_gamma ----------------------------- */ #ifndef WGL_I3D_gamma #define WGL_I3D_gamma 1 #define WGL_GAMMA_TABLE_SIZE_I3D 0x204E #define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT* puRed, USHORT *puGreen, USHORT *puBlue); typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue); typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT* puRed, const USHORT *puGreen, const USHORT *puBlue); typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue); #define wglGetGammaTableI3D WGLEW_GET_FUN(__wglewGetGammaTableI3D) #define wglGetGammaTableParametersI3D WGLEW_GET_FUN(__wglewGetGammaTableParametersI3D) #define wglSetGammaTableI3D WGLEW_GET_FUN(__wglewSetGammaTableI3D) #define wglSetGammaTableParametersI3D WGLEW_GET_FUN(__wglewSetGammaTableParametersI3D) #define WGLEW_I3D_gamma WGLEW_GET_VAR(__WGLEW_I3D_gamma) #endif /* WGL_I3D_gamma */ /* ---------------------------- WGL_I3D_genlock ---------------------------- */ #ifndef WGL_I3D_genlock #define WGL_I3D_genlock 1 #define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044 #define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045 #define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046 #define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047 #define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048 #define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049 #define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A #define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B #define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC); typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC); typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate); typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay); typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge); typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource); typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT* uRate); typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT* uDelay); typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT* uEdge); typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT* uSource); typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL* pFlag); typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT* uMaxLineDelay, UINT *uMaxPixelDelay); #define wglDisableGenlockI3D WGLEW_GET_FUN(__wglewDisableGenlockI3D) #define wglEnableGenlockI3D WGLEW_GET_FUN(__wglewEnableGenlockI3D) #define wglGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGenlockSampleRateI3D) #define wglGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGenlockSourceDelayI3D) #define wglGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGenlockSourceEdgeI3D) #define wglGenlockSourceI3D WGLEW_GET_FUN(__wglewGenlockSourceI3D) #define wglGetGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGetGenlockSampleRateI3D) #define wglGetGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGetGenlockSourceDelayI3D) #define wglGetGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGetGenlockSourceEdgeI3D) #define wglGetGenlockSourceI3D WGLEW_GET_FUN(__wglewGetGenlockSourceI3D) #define wglIsEnabledGenlockI3D WGLEW_GET_FUN(__wglewIsEnabledGenlockI3D) #define wglQueryGenlockMaxSourceDelayI3D WGLEW_GET_FUN(__wglewQueryGenlockMaxSourceDelayI3D) #define WGLEW_I3D_genlock WGLEW_GET_VAR(__WGLEW_I3D_genlock) #endif /* WGL_I3D_genlock */ /* -------------------------- WGL_I3D_image_buffer ------------------------- */ #ifndef WGL_I3D_image_buffer #define WGL_I3D_image_buffer 1 #define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001 #define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002 typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, HANDLE* pEvent, LPVOID *pAddress, DWORD *pSize, UINT count); typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags); typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress); typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, LPVOID* pAddress, UINT count); #define wglAssociateImageBufferEventsI3D WGLEW_GET_FUN(__wglewAssociateImageBufferEventsI3D) #define wglCreateImageBufferI3D WGLEW_GET_FUN(__wglewCreateImageBufferI3D) #define wglDestroyImageBufferI3D WGLEW_GET_FUN(__wglewDestroyImageBufferI3D) #define wglReleaseImageBufferEventsI3D WGLEW_GET_FUN(__wglewReleaseImageBufferEventsI3D) #define WGLEW_I3D_image_buffer WGLEW_GET_VAR(__WGLEW_I3D_image_buffer) #endif /* WGL_I3D_image_buffer */ /* ------------------------ WGL_I3D_swap_frame_lock ------------------------ */ #ifndef WGL_I3D_swap_frame_lock #define WGL_I3D_swap_frame_lock 1 typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (VOID); typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (VOID); typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL* pFlag); typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL* pFlag); #define wglDisableFrameLockI3D WGLEW_GET_FUN(__wglewDisableFrameLockI3D) #define wglEnableFrameLockI3D WGLEW_GET_FUN(__wglewEnableFrameLockI3D) #define wglIsEnabledFrameLockI3D WGLEW_GET_FUN(__wglewIsEnabledFrameLockI3D) #define wglQueryFrameLockMasterI3D WGLEW_GET_FUN(__wglewQueryFrameLockMasterI3D) #define WGLEW_I3D_swap_frame_lock WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_lock) #endif /* WGL_I3D_swap_frame_lock */ /* ------------------------ WGL_I3D_swap_frame_usage ----------------------- */ #ifndef WGL_I3D_swap_frame_usage #define WGL_I3D_swap_frame_usage 1 typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void); typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void); typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float* pUsage); typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD* pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); #define wglBeginFrameTrackingI3D WGLEW_GET_FUN(__wglewBeginFrameTrackingI3D) #define wglEndFrameTrackingI3D WGLEW_GET_FUN(__wglewEndFrameTrackingI3D) #define wglGetFrameUsageI3D WGLEW_GET_FUN(__wglewGetFrameUsageI3D) #define wglQueryFrameTrackingI3D WGLEW_GET_FUN(__wglewQueryFrameTrackingI3D) #define WGLEW_I3D_swap_frame_usage WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_usage) #endif /* WGL_I3D_swap_frame_usage */ /* --------------------------- WGL_NV_DX_interop --------------------------- */ #ifndef WGL_NV_DX_interop #define WGL_NV_DX_interop 1 #define WGL_ACCESS_READ_ONLY_NV 0x0000 #define WGL_ACCESS_READ_WRITE_NV 0x0001 #define WGL_ACCESS_WRITE_DISCARD_NV 0x0002 typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice); typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects); typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access); typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void* dxDevice); typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void* dxObject, GLuint name, GLenum type, GLenum access); typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void* dxObject, HANDLE shareHandle); typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects); typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject); #define wglDXCloseDeviceNV WGLEW_GET_FUN(__wglewDXCloseDeviceNV) #define wglDXLockObjectsNV WGLEW_GET_FUN(__wglewDXLockObjectsNV) #define wglDXObjectAccessNV WGLEW_GET_FUN(__wglewDXObjectAccessNV) #define wglDXOpenDeviceNV WGLEW_GET_FUN(__wglewDXOpenDeviceNV) #define wglDXRegisterObjectNV WGLEW_GET_FUN(__wglewDXRegisterObjectNV) #define wglDXSetResourceShareHandleNV WGLEW_GET_FUN(__wglewDXSetResourceShareHandleNV) #define wglDXUnlockObjectsNV WGLEW_GET_FUN(__wglewDXUnlockObjectsNV) #define wglDXUnregisterObjectNV WGLEW_GET_FUN(__wglewDXUnregisterObjectNV) #define WGLEW_NV_DX_interop WGLEW_GET_VAR(__WGLEW_NV_DX_interop) #endif /* WGL_NV_DX_interop */ /* --------------------------- WGL_NV_DX_interop2 -------------------------- */ #ifndef WGL_NV_DX_interop2 #define WGL_NV_DX_interop2 1 #define WGLEW_NV_DX_interop2 WGLEW_GET_VAR(__WGLEW_NV_DX_interop2) #endif /* WGL_NV_DX_interop2 */ /* --------------------------- WGL_NV_copy_image --------------------------- */ #ifndef WGL_NV_copy_image #define WGL_NV_copy_image 1 typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); #define wglCopyImageSubDataNV WGLEW_GET_FUN(__wglewCopyImageSubDataNV) #define WGLEW_NV_copy_image WGLEW_GET_VAR(__WGLEW_NV_copy_image) #endif /* WGL_NV_copy_image */ /* -------------------------- WGL_NV_float_buffer -------------------------- */ #ifndef WGL_NV_float_buffer #define WGL_NV_float_buffer 1 #define WGL_FLOAT_COMPONENTS_NV 0x20B0 #define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1 #define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2 #define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3 #define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4 #define WGL_TEXTURE_FLOAT_R_NV 0x20B5 #define WGL_TEXTURE_FLOAT_RG_NV 0x20B6 #define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7 #define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8 #define WGLEW_NV_float_buffer WGLEW_GET_VAR(__WGLEW_NV_float_buffer) #endif /* WGL_NV_float_buffer */ /* -------------------------- WGL_NV_gpu_affinity -------------------------- */ #ifndef WGL_NV_gpu_affinity #define WGL_NV_gpu_affinity 1 #define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0 #define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1 DECLARE_HANDLE(HGPUNV); typedef struct _GPU_DEVICE { DWORD cb; CHAR DeviceName[32]; CHAR DeviceString[128]; DWORD Flags; RECT rcVirtualScreen; } GPU_DEVICE, *PGPU_DEVICE; typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList); typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc); typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice); typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu); typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu); #define wglCreateAffinityDCNV WGLEW_GET_FUN(__wglewCreateAffinityDCNV) #define wglDeleteDCNV WGLEW_GET_FUN(__wglewDeleteDCNV) #define wglEnumGpuDevicesNV WGLEW_GET_FUN(__wglewEnumGpuDevicesNV) #define wglEnumGpusFromAffinityDCNV WGLEW_GET_FUN(__wglewEnumGpusFromAffinityDCNV) #define wglEnumGpusNV WGLEW_GET_FUN(__wglewEnumGpusNV) #define WGLEW_NV_gpu_affinity WGLEW_GET_VAR(__WGLEW_NV_gpu_affinity) #endif /* WGL_NV_gpu_affinity */ /* ---------------------- WGL_NV_multisample_coverage ---------------------- */ #ifndef WGL_NV_multisample_coverage #define WGL_NV_multisample_coverage 1 #define WGL_COVERAGE_SAMPLES_NV 0x2042 #define WGL_COLOR_SAMPLES_NV 0x20B9 #define WGLEW_NV_multisample_coverage WGLEW_GET_VAR(__WGLEW_NV_multisample_coverage) #endif /* WGL_NV_multisample_coverage */ /* -------------------------- WGL_NV_present_video ------------------------- */ #ifndef WGL_NV_present_video #define WGL_NV_present_video 1 #define WGL_NUM_VIDEO_SLOTS_NV 0x20F0 DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV); typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDc, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int* piAttribList); typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDc, HVIDEOOUTPUTDEVICENV* phDeviceList); typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int* piValue); #define wglBindVideoDeviceNV WGLEW_GET_FUN(__wglewBindVideoDeviceNV) #define wglEnumerateVideoDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoDevicesNV) #define wglQueryCurrentContextNV WGLEW_GET_FUN(__wglewQueryCurrentContextNV) #define WGLEW_NV_present_video WGLEW_GET_VAR(__WGLEW_NV_present_video) #endif /* WGL_NV_present_video */ /* ---------------------- WGL_NV_render_depth_texture ---------------------- */ #ifndef WGL_NV_render_depth_texture #define WGL_NV_render_depth_texture 1 #define WGL_NO_TEXTURE_ARB 0x2077 #define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3 #define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4 #define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5 #define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6 #define WGL_DEPTH_COMPONENT_NV 0x20A7 #define WGLEW_NV_render_depth_texture WGLEW_GET_VAR(__WGLEW_NV_render_depth_texture) #endif /* WGL_NV_render_depth_texture */ /* -------------------- WGL_NV_render_texture_rectangle -------------------- */ #ifndef WGL_NV_render_texture_rectangle #define WGL_NV_render_texture_rectangle 1 #define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0 #define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1 #define WGL_TEXTURE_RECTANGLE_NV 0x20A2 #define WGLEW_NV_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_NV_render_texture_rectangle) #endif /* WGL_NV_render_texture_rectangle */ /* --------------------------- WGL_NV_swap_group --------------------------- */ #ifndef WGL_NV_swap_group #define WGL_NV_swap_group 1 typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier); typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group); typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint* count); typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint* maxGroups, GLuint *maxBarriers); typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint* group, GLuint *barrier); typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC); #define wglBindSwapBarrierNV WGLEW_GET_FUN(__wglewBindSwapBarrierNV) #define wglJoinSwapGroupNV WGLEW_GET_FUN(__wglewJoinSwapGroupNV) #define wglQueryFrameCountNV WGLEW_GET_FUN(__wglewQueryFrameCountNV) #define wglQueryMaxSwapGroupsNV WGLEW_GET_FUN(__wglewQueryMaxSwapGroupsNV) #define wglQuerySwapGroupNV WGLEW_GET_FUN(__wglewQuerySwapGroupNV) #define wglResetFrameCountNV WGLEW_GET_FUN(__wglewResetFrameCountNV) #define WGLEW_NV_swap_group WGLEW_GET_VAR(__WGLEW_NV_swap_group) #endif /* WGL_NV_swap_group */ /* ----------------------- WGL_NV_vertex_array_range ----------------------- */ #ifndef WGL_NV_vertex_array_range #define WGL_NV_vertex_array_range 1 typedef void * (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority); typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer); #define wglAllocateMemoryNV WGLEW_GET_FUN(__wglewAllocateMemoryNV) #define wglFreeMemoryNV WGLEW_GET_FUN(__wglewFreeMemoryNV) #define WGLEW_NV_vertex_array_range WGLEW_GET_VAR(__WGLEW_NV_vertex_array_range) #endif /* WGL_NV_vertex_array_range */ /* -------------------------- WGL_NV_video_capture ------------------------- */ #ifndef WGL_NV_video_capture #define WGL_NV_video_capture 1 #define WGL_UNIQUE_ID_NV 0x20CE #define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF DECLARE_HANDLE(HVIDEOINPUTDEVICENV); typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice); typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV* phDeviceList); typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int* piValue); typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); #define wglBindVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewBindVideoCaptureDeviceNV) #define wglEnumerateVideoCaptureDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoCaptureDevicesNV) #define wglLockVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewLockVideoCaptureDeviceNV) #define wglQueryVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewQueryVideoCaptureDeviceNV) #define wglReleaseVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoCaptureDeviceNV) #define WGLEW_NV_video_capture WGLEW_GET_VAR(__WGLEW_NV_video_capture) #endif /* WGL_NV_video_capture */ /* -------------------------- WGL_NV_video_output -------------------------- */ #ifndef WGL_NV_video_output #define WGL_NV_video_output 1 #define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0 #define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1 #define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2 #define WGL_VIDEO_OUT_COLOR_NV 0x20C3 #define WGL_VIDEO_OUT_ALPHA_NV 0x20C4 #define WGL_VIDEO_OUT_DEPTH_NV 0x20C5 #define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6 #define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7 #define WGL_VIDEO_OUT_FRAME 0x20C8 #define WGL_VIDEO_OUT_FIELD_1 0x20C9 #define WGL_VIDEO_OUT_FIELD_2 0x20CA #define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB #define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC DECLARE_HANDLE(HPVIDEODEV); typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer); typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV* hVideoDevice); typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long* pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice); typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer); typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long* pulCounterPbuffer, BOOL bBlock); #define wglBindVideoImageNV WGLEW_GET_FUN(__wglewBindVideoImageNV) #define wglGetVideoDeviceNV WGLEW_GET_FUN(__wglewGetVideoDeviceNV) #define wglGetVideoInfoNV WGLEW_GET_FUN(__wglewGetVideoInfoNV) #define wglReleaseVideoDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoDeviceNV) #define wglReleaseVideoImageNV WGLEW_GET_FUN(__wglewReleaseVideoImageNV) #define wglSendPbufferToVideoNV WGLEW_GET_FUN(__wglewSendPbufferToVideoNV) #define WGLEW_NV_video_output WGLEW_GET_VAR(__WGLEW_NV_video_output) #endif /* WGL_NV_video_output */ /* -------------------------- WGL_OML_sync_control ------------------------- */ #ifndef WGL_OML_sync_control #define WGL_OML_sync_control 1 typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32* numerator, INT32 *denominator); typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64* ust, INT64 *msc, INT64 *sbc); typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, INT fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64* ust, INT64 *msc, INT64 *sbc); typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64* ust, INT64 *msc, INT64 *sbc); #define wglGetMscRateOML WGLEW_GET_FUN(__wglewGetMscRateOML) #define wglGetSyncValuesOML WGLEW_GET_FUN(__wglewGetSyncValuesOML) #define wglSwapBuffersMscOML WGLEW_GET_FUN(__wglewSwapBuffersMscOML) #define wglSwapLayerBuffersMscOML WGLEW_GET_FUN(__wglewSwapLayerBuffersMscOML) #define wglWaitForMscOML WGLEW_GET_FUN(__wglewWaitForMscOML) #define wglWaitForSbcOML WGLEW_GET_FUN(__wglewWaitForSbcOML) #define WGLEW_OML_sync_control WGLEW_GET_VAR(__WGLEW_OML_sync_control) #endif /* WGL_OML_sync_control */ /* ------------------------------------------------------------------------- */ #ifdef GLEW_MX #define WGLEW_FUN_EXPORT #define WGLEW_VAR_EXPORT #else #define WGLEW_FUN_EXPORT GLEW_FUN_EXPORT #define WGLEW_VAR_EXPORT GLEW_VAR_EXPORT #endif /* GLEW_MX */ #ifdef GLEW_MX struct WGLEWContextStruct { #endif /* GLEW_MX */ WGLEW_FUN_EXPORT PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL; WGLEW_FUN_EXPORT PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC __wglewBlitContextFramebufferAMD; WGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC __wglewCreateAssociatedContextAMD; WGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC __wglewCreateAssociatedContextAttribsAMD; WGLEW_FUN_EXPORT PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC __wglewDeleteAssociatedContextAMD; WGLEW_FUN_EXPORT PFNWGLGETCONTEXTGPUIDAMDPROC __wglewGetContextGPUIDAMD; WGLEW_FUN_EXPORT PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC __wglewGetCurrentAssociatedContextAMD; WGLEW_FUN_EXPORT PFNWGLGETGPUIDSAMDPROC __wglewGetGPUIDsAMD; WGLEW_FUN_EXPORT PFNWGLGETGPUINFOAMDPROC __wglewGetGPUInfoAMD; WGLEW_FUN_EXPORT PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC __wglewMakeAssociatedContextCurrentAMD; WGLEW_FUN_EXPORT PFNWGLCREATEBUFFERREGIONARBPROC __wglewCreateBufferRegionARB; WGLEW_FUN_EXPORT PFNWGLDELETEBUFFERREGIONARBPROC __wglewDeleteBufferRegionARB; WGLEW_FUN_EXPORT PFNWGLRESTOREBUFFERREGIONARBPROC __wglewRestoreBufferRegionARB; WGLEW_FUN_EXPORT PFNWGLSAVEBUFFERREGIONARBPROC __wglewSaveBufferRegionARB; WGLEW_FUN_EXPORT PFNWGLCREATECONTEXTATTRIBSARBPROC __wglewCreateContextAttribsARB; WGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGARBPROC __wglewGetExtensionsStringARB; WGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCARBPROC __wglewGetCurrentReadDCARB; WGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTARBPROC __wglewMakeContextCurrentARB; WGLEW_FUN_EXPORT PFNWGLCREATEPBUFFERARBPROC __wglewCreatePbufferARB; WGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFERARBPROC __wglewDestroyPbufferARB; WGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCARBPROC __wglewGetPbufferDCARB; WGLEW_FUN_EXPORT PFNWGLQUERYPBUFFERARBPROC __wglewQueryPbufferARB; WGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCARBPROC __wglewReleasePbufferDCARB; WGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATARBPROC __wglewChoosePixelFormatARB; WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVARBPROC __wglewGetPixelFormatAttribfvARB; WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVARBPROC __wglewGetPixelFormatAttribivARB; WGLEW_FUN_EXPORT PFNWGLBINDTEXIMAGEARBPROC __wglewBindTexImageARB; WGLEW_FUN_EXPORT PFNWGLRELEASETEXIMAGEARBPROC __wglewReleaseTexImageARB; WGLEW_FUN_EXPORT PFNWGLSETPBUFFERATTRIBARBPROC __wglewSetPbufferAttribARB; WGLEW_FUN_EXPORT PFNWGLBINDDISPLAYCOLORTABLEEXTPROC __wglewBindDisplayColorTableEXT; WGLEW_FUN_EXPORT PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC __wglewCreateDisplayColorTableEXT; WGLEW_FUN_EXPORT PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC __wglewDestroyDisplayColorTableEXT; WGLEW_FUN_EXPORT PFNWGLLOADDISPLAYCOLORTABLEEXTPROC __wglewLoadDisplayColorTableEXT; WGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGEXTPROC __wglewGetExtensionsStringEXT; WGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCEXTPROC __wglewGetCurrentReadDCEXT; WGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTEXTPROC __wglewMakeContextCurrentEXT; WGLEW_FUN_EXPORT PFNWGLCREATEPBUFFEREXTPROC __wglewCreatePbufferEXT; WGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFEREXTPROC __wglewDestroyPbufferEXT; WGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCEXTPROC __wglewGetPbufferDCEXT; WGLEW_FUN_EXPORT PFNWGLQUERYPBUFFEREXTPROC __wglewQueryPbufferEXT; WGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCEXTPROC __wglewReleasePbufferDCEXT; WGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATEXTPROC __wglewChoosePixelFormatEXT; WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVEXTPROC __wglewGetPixelFormatAttribfvEXT; WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVEXTPROC __wglewGetPixelFormatAttribivEXT; WGLEW_FUN_EXPORT PFNWGLGETSWAPINTERVALEXTPROC __wglewGetSwapIntervalEXT; WGLEW_FUN_EXPORT PFNWGLSWAPINTERVALEXTPROC __wglewSwapIntervalEXT; WGLEW_FUN_EXPORT PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC __wglewGetDigitalVideoParametersI3D; WGLEW_FUN_EXPORT PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC __wglewSetDigitalVideoParametersI3D; WGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEI3DPROC __wglewGetGammaTableI3D; WGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEPARAMETERSI3DPROC __wglewGetGammaTableParametersI3D; WGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEI3DPROC __wglewSetGammaTableI3D; WGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEPARAMETERSI3DPROC __wglewSetGammaTableParametersI3D; WGLEW_FUN_EXPORT PFNWGLDISABLEGENLOCKI3DPROC __wglewDisableGenlockI3D; WGLEW_FUN_EXPORT PFNWGLENABLEGENLOCKI3DPROC __wglewEnableGenlockI3D; WGLEW_FUN_EXPORT PFNWGLGENLOCKSAMPLERATEI3DPROC __wglewGenlockSampleRateI3D; WGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEDELAYI3DPROC __wglewGenlockSourceDelayI3D; WGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEEDGEI3DPROC __wglewGenlockSourceEdgeI3D; WGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEI3DPROC __wglewGenlockSourceI3D; WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSAMPLERATEI3DPROC __wglewGetGenlockSampleRateI3D; WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEDELAYI3DPROC __wglewGetGenlockSourceDelayI3D; WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEEDGEI3DPROC __wglewGetGenlockSourceEdgeI3D; WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEI3DPROC __wglewGetGenlockSourceI3D; WGLEW_FUN_EXPORT PFNWGLISENABLEDGENLOCKI3DPROC __wglewIsEnabledGenlockI3D; WGLEW_FUN_EXPORT PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC __wglewQueryGenlockMaxSourceDelayI3D; WGLEW_FUN_EXPORT PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC __wglewAssociateImageBufferEventsI3D; WGLEW_FUN_EXPORT PFNWGLCREATEIMAGEBUFFERI3DPROC __wglewCreateImageBufferI3D; WGLEW_FUN_EXPORT PFNWGLDESTROYIMAGEBUFFERI3DPROC __wglewDestroyImageBufferI3D; WGLEW_FUN_EXPORT PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC __wglewReleaseImageBufferEventsI3D; WGLEW_FUN_EXPORT PFNWGLDISABLEFRAMELOCKI3DPROC __wglewDisableFrameLockI3D; WGLEW_FUN_EXPORT PFNWGLENABLEFRAMELOCKI3DPROC __wglewEnableFrameLockI3D; WGLEW_FUN_EXPORT PFNWGLISENABLEDFRAMELOCKI3DPROC __wglewIsEnabledFrameLockI3D; WGLEW_FUN_EXPORT PFNWGLQUERYFRAMELOCKMASTERI3DPROC __wglewQueryFrameLockMasterI3D; WGLEW_FUN_EXPORT PFNWGLBEGINFRAMETRACKINGI3DPROC __wglewBeginFrameTrackingI3D; WGLEW_FUN_EXPORT PFNWGLENDFRAMETRACKINGI3DPROC __wglewEndFrameTrackingI3D; WGLEW_FUN_EXPORT PFNWGLGETFRAMEUSAGEI3DPROC __wglewGetFrameUsageI3D; WGLEW_FUN_EXPORT PFNWGLQUERYFRAMETRACKINGI3DPROC __wglewQueryFrameTrackingI3D; WGLEW_FUN_EXPORT PFNWGLDXCLOSEDEVICENVPROC __wglewDXCloseDeviceNV; WGLEW_FUN_EXPORT PFNWGLDXLOCKOBJECTSNVPROC __wglewDXLockObjectsNV; WGLEW_FUN_EXPORT PFNWGLDXOBJECTACCESSNVPROC __wglewDXObjectAccessNV; WGLEW_FUN_EXPORT PFNWGLDXOPENDEVICENVPROC __wglewDXOpenDeviceNV; WGLEW_FUN_EXPORT PFNWGLDXREGISTEROBJECTNVPROC __wglewDXRegisterObjectNV; WGLEW_FUN_EXPORT PFNWGLDXSETRESOURCESHAREHANDLENVPROC __wglewDXSetResourceShareHandleNV; WGLEW_FUN_EXPORT PFNWGLDXUNLOCKOBJECTSNVPROC __wglewDXUnlockObjectsNV; WGLEW_FUN_EXPORT PFNWGLDXUNREGISTEROBJECTNVPROC __wglewDXUnregisterObjectNV; WGLEW_FUN_EXPORT PFNWGLCOPYIMAGESUBDATANVPROC __wglewCopyImageSubDataNV; WGLEW_FUN_EXPORT PFNWGLCREATEAFFINITYDCNVPROC __wglewCreateAffinityDCNV; WGLEW_FUN_EXPORT PFNWGLDELETEDCNVPROC __wglewDeleteDCNV; WGLEW_FUN_EXPORT PFNWGLENUMGPUDEVICESNVPROC __wglewEnumGpuDevicesNV; WGLEW_FUN_EXPORT PFNWGLENUMGPUSFROMAFFINITYDCNVPROC __wglewEnumGpusFromAffinityDCNV; WGLEW_FUN_EXPORT PFNWGLENUMGPUSNVPROC __wglewEnumGpusNV; WGLEW_FUN_EXPORT PFNWGLBINDVIDEODEVICENVPROC __wglewBindVideoDeviceNV; WGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEODEVICESNVPROC __wglewEnumerateVideoDevicesNV; WGLEW_FUN_EXPORT PFNWGLQUERYCURRENTCONTEXTNVPROC __wglewQueryCurrentContextNV; WGLEW_FUN_EXPORT PFNWGLBINDSWAPBARRIERNVPROC __wglewBindSwapBarrierNV; WGLEW_FUN_EXPORT PFNWGLJOINSWAPGROUPNVPROC __wglewJoinSwapGroupNV; WGLEW_FUN_EXPORT PFNWGLQUERYFRAMECOUNTNVPROC __wglewQueryFrameCountNV; WGLEW_FUN_EXPORT PFNWGLQUERYMAXSWAPGROUPSNVPROC __wglewQueryMaxSwapGroupsNV; WGLEW_FUN_EXPORT PFNWGLQUERYSWAPGROUPNVPROC __wglewQuerySwapGroupNV; WGLEW_FUN_EXPORT PFNWGLRESETFRAMECOUNTNVPROC __wglewResetFrameCountNV; WGLEW_FUN_EXPORT PFNWGLALLOCATEMEMORYNVPROC __wglewAllocateMemoryNV; WGLEW_FUN_EXPORT PFNWGLFREEMEMORYNVPROC __wglewFreeMemoryNV; WGLEW_FUN_EXPORT PFNWGLBINDVIDEOCAPTUREDEVICENVPROC __wglewBindVideoCaptureDeviceNV; WGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC __wglewEnumerateVideoCaptureDevicesNV; WGLEW_FUN_EXPORT PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC __wglewLockVideoCaptureDeviceNV; WGLEW_FUN_EXPORT PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC __wglewQueryVideoCaptureDeviceNV; WGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC __wglewReleaseVideoCaptureDeviceNV; WGLEW_FUN_EXPORT PFNWGLBINDVIDEOIMAGENVPROC __wglewBindVideoImageNV; WGLEW_FUN_EXPORT PFNWGLGETVIDEODEVICENVPROC __wglewGetVideoDeviceNV; WGLEW_FUN_EXPORT PFNWGLGETVIDEOINFONVPROC __wglewGetVideoInfoNV; WGLEW_FUN_EXPORT PFNWGLRELEASEVIDEODEVICENVPROC __wglewReleaseVideoDeviceNV; WGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOIMAGENVPROC __wglewReleaseVideoImageNV; WGLEW_FUN_EXPORT PFNWGLSENDPBUFFERTOVIDEONVPROC __wglewSendPbufferToVideoNV; WGLEW_FUN_EXPORT PFNWGLGETMSCRATEOMLPROC __wglewGetMscRateOML; WGLEW_FUN_EXPORT PFNWGLGETSYNCVALUESOMLPROC __wglewGetSyncValuesOML; WGLEW_FUN_EXPORT PFNWGLSWAPBUFFERSMSCOMLPROC __wglewSwapBuffersMscOML; WGLEW_FUN_EXPORT PFNWGLSWAPLAYERBUFFERSMSCOMLPROC __wglewSwapLayerBuffersMscOML; WGLEW_FUN_EXPORT PFNWGLWAITFORMSCOMLPROC __wglewWaitForMscOML; WGLEW_FUN_EXPORT PFNWGLWAITFORSBCOMLPROC __wglewWaitForSbcOML; WGLEW_VAR_EXPORT GLboolean __WGLEW_3DFX_multisample; WGLEW_VAR_EXPORT GLboolean __WGLEW_3DL_stereo_control; WGLEW_VAR_EXPORT GLboolean __WGLEW_AMD_gpu_association; WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_buffer_region; WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context; WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_profile; WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_robustness; WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_extensions_string; WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_framebuffer_sRGB; WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_make_current_read; WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_multisample; WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pbuffer; WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format; WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format_float; WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_render_texture; WGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_pixel_format_float; WGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_render_texture_rectangle; WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_create_context_es2_profile; WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_create_context_es_profile; WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_depth_float; WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_display_color_table; WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_extensions_string; WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_framebuffer_sRGB; WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_make_current_read; WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_multisample; WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pbuffer; WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format; WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format_packed_float; WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control; WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control_tear; WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_digital_video_control; WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_gamma; WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_genlock; WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_image_buffer; WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_lock; WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_usage; WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop; WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop2; WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_copy_image; WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_float_buffer; WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_gpu_affinity; WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_multisample_coverage; WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_present_video; WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_depth_texture; WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_texture_rectangle; WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_swap_group; WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_vertex_array_range; WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_capture; WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_output; WGLEW_VAR_EXPORT GLboolean __WGLEW_OML_sync_control; #ifdef GLEW_MX }; /* WGLEWContextStruct */ #endif /* GLEW_MX */ /* ------------------------------------------------------------------------- */ #ifdef GLEW_MX typedef struct WGLEWContextStruct WGLEWContext; GLEWAPI GLenum GLEWAPIENTRY wglewContextInit (WGLEWContext *ctx); GLEWAPI GLboolean GLEWAPIENTRY wglewContextIsSupported (const WGLEWContext *ctx, const char *name); #define wglewInit() wglewContextInit(wglewGetContext()) #define wglewIsSupported(x) wglewContextIsSupported(wglewGetContext(), x) #define WGLEW_GET_VAR(x) (*(const GLboolean*)&(wglewGetContext()->x)) #define WGLEW_GET_FUN(x) wglewGetContext()->x #else /* GLEW_MX */ #define WGLEW_GET_VAR(x) (*(const GLboolean*)&x) #define WGLEW_GET_FUN(x) x GLEWAPI GLboolean GLEWAPIENTRY wglewIsSupported (const char *name); #endif /* GLEW_MX */ GLEWAPI GLboolean GLEWAPIENTRY wglewGetExtension (const char *name); #ifdef __cplusplus } #endif #undef GLEWAPI #endif /* __wglew_h__ */ ImageVis3D-3.1.0/Tuvok/3rdParty/GLEW/GL/glew.h0000644000175000017500000327773312320456500020272 0ustar mathieumathieu/* ** The OpenGL Extension Wrangler Library ** Copyright (C) 2002-2008, Milan Ikits ** Copyright (C) 2002-2008, Marcelo E. Magallon ** Copyright (C) 2002, Lev Povalahev ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: ** ** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright notice, ** this list of conditions and the following disclaimer in the documentation ** and/or other materials provided with the distribution. ** * The name of the author may be used to endorse or promote products ** derived from this software without specific prior written permission. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF ** THE POSSIBILITY OF SUCH DAMAGE. */ /* * Mesa 3-D graphics library * Version: 7.0 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* ** Copyright (c) 2007 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including ** without limitation the rights to use, copy, modify, merge, publish, ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are furnished to do so, subject to ** the following conditions: ** ** The above copyright notice and this permission notice shall be included ** in all copies or substantial portions of the Materials. ** ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ #ifndef __glew_h__ #define __glew_h__ #define __GLEW_H__ #define GLEW_STATIC #if defined(__gl_h_) || defined(__GL_H__) || defined(__X_GL_H) #error gl.h included before glew.h #endif #if defined(__REGAL_H__) #error Regal.h included before glew.h #endif #if defined(__glext_h_) || defined(__GLEXT_H_) #error glext.h included before glew.h #endif #if defined(__gl_ATI_h_) #error glATI.h included before glew.h #endif #define __gl_h_ #define __GL_H__ #define __REGAL_H__ #define __X_GL_H #define __glext_h_ #define __GLEXT_H_ #define __gl_ATI_h_ #if defined(_WIN32) /* * GLEW does not include to avoid name space pollution. * GL needs GLAPI and GLAPIENTRY, GLU needs APIENTRY, CALLBACK, and wchar_t * defined properly. */ /* */ #ifndef APIENTRY #define GLEW_APIENTRY_DEFINED # if defined(__MINGW32__) || defined(__CYGWIN__) # define APIENTRY __stdcall # elif (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) # define APIENTRY __stdcall # else # define APIENTRY # endif #endif #ifndef GLAPI # if defined(__MINGW32__) || defined(__CYGWIN__) # define GLAPI extern # endif #endif /* */ #ifndef CALLBACK #define GLEW_CALLBACK_DEFINED # if defined(__MINGW32__) || defined(__CYGWIN__) # define CALLBACK __attribute__ ((__stdcall__)) # elif (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS) # define CALLBACK __stdcall # else # define CALLBACK # endif #endif /* and */ #ifndef WINGDIAPI #define GLEW_WINGDIAPI_DEFINED #define WINGDIAPI __declspec(dllimport) #endif /* */ #if (defined(_MSC_VER) || defined(__BORLANDC__)) && !defined(_WCHAR_T_DEFINED) typedef unsigned short wchar_t; # define _WCHAR_T_DEFINED #endif /* */ #if !defined(_W64) # if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && defined(_MSC_VER) && _MSC_VER >= 1300 # define _W64 __w64 # else # define _W64 # endif #endif #if !defined(_PTRDIFF_T_DEFINED) && !defined(_PTRDIFF_T_) && !defined(__MINGW64__) # ifdef _WIN64 typedef __int64 ptrdiff_t; # else typedef _W64 int ptrdiff_t; # endif # define _PTRDIFF_T_DEFINED # define _PTRDIFF_T_ #endif #ifndef GLAPI # if defined(__MINGW32__) || defined(__CYGWIN__) # define GLAPI extern # else # define GLAPI WINGDIAPI # endif #endif #ifndef GLAPIENTRY #define GLAPIENTRY APIENTRY #endif #ifndef GLEWAPIENTRY #define GLEWAPIENTRY APIENTRY #endif /* * GLEW_STATIC is defined for static library. * GLEW_BUILD is defined for building the DLL library. */ #ifdef GLEW_STATIC # define GLEWAPI extern #else # ifdef GLEW_BUILD # define GLEWAPI extern __declspec(dllexport) # else # define GLEWAPI extern __declspec(dllimport) # endif #endif #else /* _UNIX */ /* * Needed for ptrdiff_t in turn needed by VBO. This is defined by ISO * C. On my system, this amounts to _3 lines_ of included code, all of * them pretty much harmless. If you know of a way of detecting 32 vs * 64 _targets_ at compile time you are free to replace this with * something that's portable. For now, _this_ is the portable solution. * (mem, 2004-01-04) */ #include /* SGI MIPSPro doesn't like stdint.h in C++ mode */ /* ID: 3376260 Solaris 9 has inttypes.h, but not stdint.h */ #if (defined(__sgi) || defined(__sun)) && !defined(__GNUC__) #include #else #include #endif #define GLEW_APIENTRY_DEFINED #define APIENTRY /* * GLEW_STATIC is defined for static library. */ #ifdef GLEW_STATIC # define GLEWAPI extern #else # if defined(__GNUC__) && __GNUC__>=4 # define GLEWAPI extern __attribute__ ((visibility("default"))) # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) # define GLEWAPI extern __global # else # define GLEWAPI extern # endif #endif /* */ #ifndef GLAPI #define GLAPI extern #endif #ifndef GLAPIENTRY #define GLAPIENTRY #endif #ifndef GLEWAPIENTRY #define GLEWAPIENTRY #endif #endif /* _WIN32 */ #ifdef __cplusplus extern "C" { #endif /* ----------------------------- GL_VERSION_1_1 ---------------------------- */ #ifndef GL_VERSION_1_1 #define GL_VERSION_1_1 1 typedef unsigned int GLenum; typedef unsigned int GLbitfield; typedef unsigned int GLuint; typedef int GLint; typedef int GLsizei; typedef unsigned char GLboolean; typedef signed char GLbyte; typedef short GLshort; typedef unsigned char GLubyte; typedef unsigned short GLushort; typedef unsigned long GLulong; typedef float GLfloat; typedef float GLclampf; typedef double GLdouble; typedef double GLclampd; typedef void GLvoid; #if defined(_MSC_VER) && _MSC_VER < 1400 typedef __int64 GLint64EXT; typedef unsigned __int64 GLuint64EXT; #elif defined(_MSC_VER) || defined(__BORLANDC__) typedef signed long long GLint64EXT; typedef unsigned long long GLuint64EXT; #else # if defined(__MINGW32__) || defined(__CYGWIN__) #include # endif typedef int64_t GLint64EXT; typedef uint64_t GLuint64EXT; #endif typedef GLint64EXT GLint64; typedef GLuint64EXT GLuint64; typedef struct __GLsync *GLsync; typedef char GLchar; #define GL_ZERO 0 #define GL_FALSE 0 #define GL_LOGIC_OP 0x0BF1 #define GL_NONE 0 #define GL_TEXTURE_COMPONENTS 0x1003 #define GL_NO_ERROR 0 #define GL_POINTS 0x0000 #define GL_CURRENT_BIT 0x00000001 #define GL_TRUE 1 #define GL_ONE 1 #define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 #define GL_LINES 0x0001 #define GL_LINE_LOOP 0x0002 #define GL_POINT_BIT 0x00000002 #define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 #define GL_LINE_STRIP 0x0003 #define GL_LINE_BIT 0x00000004 #define GL_TRIANGLES 0x0004 #define GL_TRIANGLE_STRIP 0x0005 #define GL_TRIANGLE_FAN 0x0006 #define GL_QUADS 0x0007 #define GL_QUAD_STRIP 0x0008 #define GL_POLYGON_BIT 0x00000008 #define GL_POLYGON 0x0009 #define GL_POLYGON_STIPPLE_BIT 0x00000010 #define GL_PIXEL_MODE_BIT 0x00000020 #define GL_LIGHTING_BIT 0x00000040 #define GL_FOG_BIT 0x00000080 #define GL_DEPTH_BUFFER_BIT 0x00000100 #define GL_ACCUM 0x0100 #define GL_LOAD 0x0101 #define GL_RETURN 0x0102 #define GL_MULT 0x0103 #define GL_ADD 0x0104 #define GL_NEVER 0x0200 #define GL_ACCUM_BUFFER_BIT 0x00000200 #define GL_LESS 0x0201 #define GL_EQUAL 0x0202 #define GL_LEQUAL 0x0203 #define GL_GREATER 0x0204 #define GL_NOTEQUAL 0x0205 #define GL_GEQUAL 0x0206 #define GL_ALWAYS 0x0207 #define GL_SRC_COLOR 0x0300 #define GL_ONE_MINUS_SRC_COLOR 0x0301 #define GL_SRC_ALPHA 0x0302 #define GL_ONE_MINUS_SRC_ALPHA 0x0303 #define GL_DST_ALPHA 0x0304 #define GL_ONE_MINUS_DST_ALPHA 0x0305 #define GL_DST_COLOR 0x0306 #define GL_ONE_MINUS_DST_COLOR 0x0307 #define GL_SRC_ALPHA_SATURATE 0x0308 #define GL_STENCIL_BUFFER_BIT 0x00000400 #define GL_FRONT_LEFT 0x0400 #define GL_FRONT_RIGHT 0x0401 #define GL_BACK_LEFT 0x0402 #define GL_BACK_RIGHT 0x0403 #define GL_FRONT 0x0404 #define GL_BACK 0x0405 #define GL_LEFT 0x0406 #define GL_RIGHT 0x0407 #define GL_FRONT_AND_BACK 0x0408 #define GL_AUX0 0x0409 #define GL_AUX1 0x040A #define GL_AUX2 0x040B #define GL_AUX3 0x040C #define GL_INVALID_ENUM 0x0500 #define GL_INVALID_VALUE 0x0501 #define GL_INVALID_OPERATION 0x0502 #define GL_STACK_OVERFLOW 0x0503 #define GL_STACK_UNDERFLOW 0x0504 #define GL_OUT_OF_MEMORY 0x0505 #define GL_2D 0x0600 #define GL_3D 0x0601 #define GL_3D_COLOR 0x0602 #define GL_3D_COLOR_TEXTURE 0x0603 #define GL_4D_COLOR_TEXTURE 0x0604 #define GL_PASS_THROUGH_TOKEN 0x0700 #define GL_POINT_TOKEN 0x0701 #define GL_LINE_TOKEN 0x0702 #define GL_POLYGON_TOKEN 0x0703 #define GL_BITMAP_TOKEN 0x0704 #define GL_DRAW_PIXEL_TOKEN 0x0705 #define GL_COPY_PIXEL_TOKEN 0x0706 #define GL_LINE_RESET_TOKEN 0x0707 #define GL_EXP 0x0800 #define GL_VIEWPORT_BIT 0x00000800 #define GL_EXP2 0x0801 #define GL_CW 0x0900 #define GL_CCW 0x0901 #define GL_COEFF 0x0A00 #define GL_ORDER 0x0A01 #define GL_DOMAIN 0x0A02 #define GL_CURRENT_COLOR 0x0B00 #define GL_CURRENT_INDEX 0x0B01 #define GL_CURRENT_NORMAL 0x0B02 #define GL_CURRENT_TEXTURE_COORDS 0x0B03 #define GL_CURRENT_RASTER_COLOR 0x0B04 #define GL_CURRENT_RASTER_INDEX 0x0B05 #define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 #define GL_CURRENT_RASTER_POSITION 0x0B07 #define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 #define GL_CURRENT_RASTER_DISTANCE 0x0B09 #define GL_POINT_SMOOTH 0x0B10 #define GL_POINT_SIZE 0x0B11 #define GL_POINT_SIZE_RANGE 0x0B12 #define GL_POINT_SIZE_GRANULARITY 0x0B13 #define GL_LINE_SMOOTH 0x0B20 #define GL_LINE_WIDTH 0x0B21 #define GL_LINE_WIDTH_RANGE 0x0B22 #define GL_LINE_WIDTH_GRANULARITY 0x0B23 #define GL_LINE_STIPPLE 0x0B24 #define GL_LINE_STIPPLE_PATTERN 0x0B25 #define GL_LINE_STIPPLE_REPEAT 0x0B26 #define GL_LIST_MODE 0x0B30 #define GL_MAX_LIST_NESTING 0x0B31 #define GL_LIST_BASE 0x0B32 #define GL_LIST_INDEX 0x0B33 #define GL_POLYGON_MODE 0x0B40 #define GL_POLYGON_SMOOTH 0x0B41 #define GL_POLYGON_STIPPLE 0x0B42 #define GL_EDGE_FLAG 0x0B43 #define GL_CULL_FACE 0x0B44 #define GL_CULL_FACE_MODE 0x0B45 #define GL_FRONT_FACE 0x0B46 #define GL_LIGHTING 0x0B50 #define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 #define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 #define GL_LIGHT_MODEL_AMBIENT 0x0B53 #define GL_SHADE_MODEL 0x0B54 #define GL_COLOR_MATERIAL_FACE 0x0B55 #define GL_COLOR_MATERIAL_PARAMETER 0x0B56 #define GL_COLOR_MATERIAL 0x0B57 #define GL_FOG 0x0B60 #define GL_FOG_INDEX 0x0B61 #define GL_FOG_DENSITY 0x0B62 #define GL_FOG_START 0x0B63 #define GL_FOG_END 0x0B64 #define GL_FOG_MODE 0x0B65 #define GL_FOG_COLOR 0x0B66 #define GL_DEPTH_RANGE 0x0B70 #define GL_DEPTH_TEST 0x0B71 #define GL_DEPTH_WRITEMASK 0x0B72 #define GL_DEPTH_CLEAR_VALUE 0x0B73 #define GL_DEPTH_FUNC 0x0B74 #define GL_ACCUM_CLEAR_VALUE 0x0B80 #define GL_STENCIL_TEST 0x0B90 #define GL_STENCIL_CLEAR_VALUE 0x0B91 #define GL_STENCIL_FUNC 0x0B92 #define GL_STENCIL_VALUE_MASK 0x0B93 #define GL_STENCIL_FAIL 0x0B94 #define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 #define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 #define GL_STENCIL_REF 0x0B97 #define GL_STENCIL_WRITEMASK 0x0B98 #define GL_MATRIX_MODE 0x0BA0 #define GL_NORMALIZE 0x0BA1 #define GL_VIEWPORT 0x0BA2 #define GL_MODELVIEW_STACK_DEPTH 0x0BA3 #define GL_PROJECTION_STACK_DEPTH 0x0BA4 #define GL_TEXTURE_STACK_DEPTH 0x0BA5 #define GL_MODELVIEW_MATRIX 0x0BA6 #define GL_PROJECTION_MATRIX 0x0BA7 #define GL_TEXTURE_MATRIX 0x0BA8 #define GL_ATTRIB_STACK_DEPTH 0x0BB0 #define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 #define GL_ALPHA_TEST 0x0BC0 #define GL_ALPHA_TEST_FUNC 0x0BC1 #define GL_ALPHA_TEST_REF 0x0BC2 #define GL_DITHER 0x0BD0 #define GL_BLEND_DST 0x0BE0 #define GL_BLEND_SRC 0x0BE1 #define GL_BLEND 0x0BE2 #define GL_LOGIC_OP_MODE 0x0BF0 #define GL_INDEX_LOGIC_OP 0x0BF1 #define GL_COLOR_LOGIC_OP 0x0BF2 #define GL_AUX_BUFFERS 0x0C00 #define GL_DRAW_BUFFER 0x0C01 #define GL_READ_BUFFER 0x0C02 #define GL_SCISSOR_BOX 0x0C10 #define GL_SCISSOR_TEST 0x0C11 #define GL_INDEX_CLEAR_VALUE 0x0C20 #define GL_INDEX_WRITEMASK 0x0C21 #define GL_COLOR_CLEAR_VALUE 0x0C22 #define GL_COLOR_WRITEMASK 0x0C23 #define GL_INDEX_MODE 0x0C30 #define GL_RGBA_MODE 0x0C31 #define GL_DOUBLEBUFFER 0x0C32 #define GL_STEREO 0x0C33 #define GL_RENDER_MODE 0x0C40 #define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 #define GL_POINT_SMOOTH_HINT 0x0C51 #define GL_LINE_SMOOTH_HINT 0x0C52 #define GL_POLYGON_SMOOTH_HINT 0x0C53 #define GL_FOG_HINT 0x0C54 #define GL_TEXTURE_GEN_S 0x0C60 #define GL_TEXTURE_GEN_T 0x0C61 #define GL_TEXTURE_GEN_R 0x0C62 #define GL_TEXTURE_GEN_Q 0x0C63 #define GL_PIXEL_MAP_I_TO_I 0x0C70 #define GL_PIXEL_MAP_S_TO_S 0x0C71 #define GL_PIXEL_MAP_I_TO_R 0x0C72 #define GL_PIXEL_MAP_I_TO_G 0x0C73 #define GL_PIXEL_MAP_I_TO_B 0x0C74 #define GL_PIXEL_MAP_I_TO_A 0x0C75 #define GL_PIXEL_MAP_R_TO_R 0x0C76 #define GL_PIXEL_MAP_G_TO_G 0x0C77 #define GL_PIXEL_MAP_B_TO_B 0x0C78 #define GL_PIXEL_MAP_A_TO_A 0x0C79 #define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 #define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 #define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 #define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 #define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 #define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 #define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 #define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 #define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 #define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 #define GL_UNPACK_SWAP_BYTES 0x0CF0 #define GL_UNPACK_LSB_FIRST 0x0CF1 #define GL_UNPACK_ROW_LENGTH 0x0CF2 #define GL_UNPACK_SKIP_ROWS 0x0CF3 #define GL_UNPACK_SKIP_PIXELS 0x0CF4 #define GL_UNPACK_ALIGNMENT 0x0CF5 #define GL_PACK_SWAP_BYTES 0x0D00 #define GL_PACK_LSB_FIRST 0x0D01 #define GL_PACK_ROW_LENGTH 0x0D02 #define GL_PACK_SKIP_ROWS 0x0D03 #define GL_PACK_SKIP_PIXELS 0x0D04 #define GL_PACK_ALIGNMENT 0x0D05 #define GL_MAP_COLOR 0x0D10 #define GL_MAP_STENCIL 0x0D11 #define GL_INDEX_SHIFT 0x0D12 #define GL_INDEX_OFFSET 0x0D13 #define GL_RED_SCALE 0x0D14 #define GL_RED_BIAS 0x0D15 #define GL_ZOOM_X 0x0D16 #define GL_ZOOM_Y 0x0D17 #define GL_GREEN_SCALE 0x0D18 #define GL_GREEN_BIAS 0x0D19 #define GL_BLUE_SCALE 0x0D1A #define GL_BLUE_BIAS 0x0D1B #define GL_ALPHA_SCALE 0x0D1C #define GL_ALPHA_BIAS 0x0D1D #define GL_DEPTH_SCALE 0x0D1E #define GL_DEPTH_BIAS 0x0D1F #define GL_MAX_EVAL_ORDER 0x0D30 #define GL_MAX_LIGHTS 0x0D31 #define GL_MAX_CLIP_PLANES 0x0D32 #define GL_MAX_TEXTURE_SIZE 0x0D33 #define GL_MAX_PIXEL_MAP_TABLE 0x0D34 #define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 #define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 #define GL_MAX_NAME_STACK_DEPTH 0x0D37 #define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 #define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 #define GL_MAX_VIEWPORT_DIMS 0x0D3A #define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B #define GL_SUBPIXEL_BITS 0x0D50 #define GL_INDEX_BITS 0x0D51 #define GL_RED_BITS 0x0D52 #define GL_GREEN_BITS 0x0D53 #define GL_BLUE_BITS 0x0D54 #define GL_ALPHA_BITS 0x0D55 #define GL_DEPTH_BITS 0x0D56 #define GL_STENCIL_BITS 0x0D57 #define GL_ACCUM_RED_BITS 0x0D58 #define GL_ACCUM_GREEN_BITS 0x0D59 #define GL_ACCUM_BLUE_BITS 0x0D5A #define GL_ACCUM_ALPHA_BITS 0x0D5B #define GL_NAME_STACK_DEPTH 0x0D70 #define GL_AUTO_NORMAL 0x0D80 #define GL_MAP1_COLOR_4 0x0D90 #define GL_MAP1_INDEX 0x0D91 #define GL_MAP1_NORMAL 0x0D92 #define GL_MAP1_TEXTURE_COORD_1 0x0D93 #define GL_MAP1_TEXTURE_COORD_2 0x0D94 #define GL_MAP1_TEXTURE_COORD_3 0x0D95 #define GL_MAP1_TEXTURE_COORD_4 0x0D96 #define GL_MAP1_VERTEX_3 0x0D97 #define GL_MAP1_VERTEX_4 0x0D98 #define GL_MAP2_COLOR_4 0x0DB0 #define GL_MAP2_INDEX 0x0DB1 #define GL_MAP2_NORMAL 0x0DB2 #define GL_MAP2_TEXTURE_COORD_1 0x0DB3 #define GL_MAP2_TEXTURE_COORD_2 0x0DB4 #define GL_MAP2_TEXTURE_COORD_3 0x0DB5 #define GL_MAP2_TEXTURE_COORD_4 0x0DB6 #define GL_MAP2_VERTEX_3 0x0DB7 #define GL_MAP2_VERTEX_4 0x0DB8 #define GL_MAP1_GRID_DOMAIN 0x0DD0 #define GL_MAP1_GRID_SEGMENTS 0x0DD1 #define GL_MAP2_GRID_DOMAIN 0x0DD2 #define GL_MAP2_GRID_SEGMENTS 0x0DD3 #define GL_TEXTURE_1D 0x0DE0 #define GL_TEXTURE_2D 0x0DE1 #define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 #define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 #define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 #define GL_SELECTION_BUFFER_POINTER 0x0DF3 #define GL_SELECTION_BUFFER_SIZE 0x0DF4 #define GL_TEXTURE_WIDTH 0x1000 #define GL_TRANSFORM_BIT 0x00001000 #define GL_TEXTURE_HEIGHT 0x1001 #define GL_TEXTURE_INTERNAL_FORMAT 0x1003 #define GL_TEXTURE_BORDER_COLOR 0x1004 #define GL_TEXTURE_BORDER 0x1005 #define GL_DONT_CARE 0x1100 #define GL_FASTEST 0x1101 #define GL_NICEST 0x1102 #define GL_AMBIENT 0x1200 #define GL_DIFFUSE 0x1201 #define GL_SPECULAR 0x1202 #define GL_POSITION 0x1203 #define GL_SPOT_DIRECTION 0x1204 #define GL_SPOT_EXPONENT 0x1205 #define GL_SPOT_CUTOFF 0x1206 #define GL_CONSTANT_ATTENUATION 0x1207 #define GL_LINEAR_ATTENUATION 0x1208 #define GL_QUADRATIC_ATTENUATION 0x1209 #define GL_COMPILE 0x1300 #define GL_COMPILE_AND_EXECUTE 0x1301 #define GL_BYTE 0x1400 #define GL_UNSIGNED_BYTE 0x1401 #define GL_SHORT 0x1402 #define GL_UNSIGNED_SHORT 0x1403 #define GL_INT 0x1404 #define GL_UNSIGNED_INT 0x1405 #define GL_FLOAT 0x1406 #define GL_2_BYTES 0x1407 #define GL_3_BYTES 0x1408 #define GL_4_BYTES 0x1409 #define GL_DOUBLE 0x140A #define GL_CLEAR 0x1500 #define GL_AND 0x1501 #define GL_AND_REVERSE 0x1502 #define GL_COPY 0x1503 #define GL_AND_INVERTED 0x1504 #define GL_NOOP 0x1505 #define GL_XOR 0x1506 #define GL_OR 0x1507 #define GL_NOR 0x1508 #define GL_EQUIV 0x1509 #define GL_INVERT 0x150A #define GL_OR_REVERSE 0x150B #define GL_COPY_INVERTED 0x150C #define GL_OR_INVERTED 0x150D #define GL_NAND 0x150E #define GL_SET 0x150F #define GL_EMISSION 0x1600 #define GL_SHININESS 0x1601 #define GL_AMBIENT_AND_DIFFUSE 0x1602 #define GL_COLOR_INDEXES 0x1603 #define GL_MODELVIEW 0x1700 #define GL_PROJECTION 0x1701 #define GL_TEXTURE 0x1702 #define GL_COLOR 0x1800 #define GL_DEPTH 0x1801 #define GL_STENCIL 0x1802 #define GL_COLOR_INDEX 0x1900 #define GL_STENCIL_INDEX 0x1901 #define GL_DEPTH_COMPONENT 0x1902 #define GL_RED 0x1903 #define GL_GREEN 0x1904 #define GL_BLUE 0x1905 #define GL_ALPHA 0x1906 #define GL_RGB 0x1907 #define GL_RGBA 0x1908 #define GL_LUMINANCE 0x1909 #define GL_LUMINANCE_ALPHA 0x190A #define GL_BITMAP 0x1A00 #define GL_POINT 0x1B00 #define GL_LINE 0x1B01 #define GL_FILL 0x1B02 #define GL_RENDER 0x1C00 #define GL_FEEDBACK 0x1C01 #define GL_SELECT 0x1C02 #define GL_FLAT 0x1D00 #define GL_SMOOTH 0x1D01 #define GL_KEEP 0x1E00 #define GL_REPLACE 0x1E01 #define GL_INCR 0x1E02 #define GL_DECR 0x1E03 #define GL_VENDOR 0x1F00 #define GL_RENDERER 0x1F01 #define GL_VERSION 0x1F02 #define GL_EXTENSIONS 0x1F03 #define GL_S 0x2000 #define GL_ENABLE_BIT 0x00002000 #define GL_T 0x2001 #define GL_R 0x2002 #define GL_Q 0x2003 #define GL_MODULATE 0x2100 #define GL_DECAL 0x2101 #define GL_TEXTURE_ENV_MODE 0x2200 #define GL_TEXTURE_ENV_COLOR 0x2201 #define GL_TEXTURE_ENV 0x2300 #define GL_EYE_LINEAR 0x2400 #define GL_OBJECT_LINEAR 0x2401 #define GL_SPHERE_MAP 0x2402 #define GL_TEXTURE_GEN_MODE 0x2500 #define GL_OBJECT_PLANE 0x2501 #define GL_EYE_PLANE 0x2502 #define GL_NEAREST 0x2600 #define GL_LINEAR 0x2601 #define GL_NEAREST_MIPMAP_NEAREST 0x2700 #define GL_LINEAR_MIPMAP_NEAREST 0x2701 #define GL_NEAREST_MIPMAP_LINEAR 0x2702 #define GL_LINEAR_MIPMAP_LINEAR 0x2703 #define GL_TEXTURE_MAG_FILTER 0x2800 #define GL_TEXTURE_MIN_FILTER 0x2801 #define GL_TEXTURE_WRAP_S 0x2802 #define GL_TEXTURE_WRAP_T 0x2803 #define GL_CLAMP 0x2900 #define GL_REPEAT 0x2901 #define GL_POLYGON_OFFSET_UNITS 0x2A00 #define GL_POLYGON_OFFSET_POINT 0x2A01 #define GL_POLYGON_OFFSET_LINE 0x2A02 #define GL_R3_G3_B2 0x2A10 #define GL_V2F 0x2A20 #define GL_V3F 0x2A21 #define GL_C4UB_V2F 0x2A22 #define GL_C4UB_V3F 0x2A23 #define GL_C3F_V3F 0x2A24 #define GL_N3F_V3F 0x2A25 #define GL_C4F_N3F_V3F 0x2A26 #define GL_T2F_V3F 0x2A27 #define GL_T4F_V4F 0x2A28 #define GL_T2F_C4UB_V3F 0x2A29 #define GL_T2F_C3F_V3F 0x2A2A #define GL_T2F_N3F_V3F 0x2A2B #define GL_T2F_C4F_N3F_V3F 0x2A2C #define GL_T4F_C4F_N3F_V4F 0x2A2D #define GL_CLIP_PLANE0 0x3000 #define GL_CLIP_PLANE1 0x3001 #define GL_CLIP_PLANE2 0x3002 #define GL_CLIP_PLANE3 0x3003 #define GL_CLIP_PLANE4 0x3004 #define GL_CLIP_PLANE5 0x3005 #define GL_LIGHT0 0x4000 #define GL_COLOR_BUFFER_BIT 0x00004000 #define GL_LIGHT1 0x4001 #define GL_LIGHT2 0x4002 #define GL_LIGHT3 0x4003 #define GL_LIGHT4 0x4004 #define GL_LIGHT5 0x4005 #define GL_LIGHT6 0x4006 #define GL_LIGHT7 0x4007 #define GL_HINT_BIT 0x00008000 #define GL_POLYGON_OFFSET_FILL 0x8037 #define GL_POLYGON_OFFSET_FACTOR 0x8038 #define GL_ALPHA4 0x803B #define GL_ALPHA8 0x803C #define GL_ALPHA12 0x803D #define GL_ALPHA16 0x803E #define GL_LUMINANCE4 0x803F #define GL_LUMINANCE8 0x8040 #define GL_LUMINANCE12 0x8041 #define GL_LUMINANCE16 0x8042 #define GL_LUMINANCE4_ALPHA4 0x8043 #define GL_LUMINANCE6_ALPHA2 0x8044 #define GL_LUMINANCE8_ALPHA8 0x8045 #define GL_LUMINANCE12_ALPHA4 0x8046 #define GL_LUMINANCE12_ALPHA12 0x8047 #define GL_LUMINANCE16_ALPHA16 0x8048 #define GL_INTENSITY 0x8049 #define GL_INTENSITY4 0x804A #define GL_INTENSITY8 0x804B #define GL_INTENSITY12 0x804C #define GL_INTENSITY16 0x804D #define GL_RGB4 0x804F #define GL_RGB5 0x8050 #define GL_RGB8 0x8051 #define GL_RGB10 0x8052 #define GL_RGB12 0x8053 #define GL_RGB16 0x8054 #define GL_RGBA2 0x8055 #define GL_RGBA4 0x8056 #define GL_RGB5_A1 0x8057 #define GL_RGBA8 0x8058 #define GL_RGB10_A2 0x8059 #define GL_RGBA12 0x805A #define GL_RGBA16 0x805B #define GL_TEXTURE_RED_SIZE 0x805C #define GL_TEXTURE_GREEN_SIZE 0x805D #define GL_TEXTURE_BLUE_SIZE 0x805E #define GL_TEXTURE_ALPHA_SIZE 0x805F #define GL_TEXTURE_LUMINANCE_SIZE 0x8060 #define GL_TEXTURE_INTENSITY_SIZE 0x8061 #define GL_PROXY_TEXTURE_1D 0x8063 #define GL_PROXY_TEXTURE_2D 0x8064 #define GL_TEXTURE_PRIORITY 0x8066 #define GL_TEXTURE_RESIDENT 0x8067 #define GL_TEXTURE_BINDING_1D 0x8068 #define GL_TEXTURE_BINDING_2D 0x8069 #define GL_VERTEX_ARRAY 0x8074 #define GL_NORMAL_ARRAY 0x8075 #define GL_COLOR_ARRAY 0x8076 #define GL_INDEX_ARRAY 0x8077 #define GL_TEXTURE_COORD_ARRAY 0x8078 #define GL_EDGE_FLAG_ARRAY 0x8079 #define GL_VERTEX_ARRAY_SIZE 0x807A #define GL_VERTEX_ARRAY_TYPE 0x807B #define GL_VERTEX_ARRAY_STRIDE 0x807C #define GL_NORMAL_ARRAY_TYPE 0x807E #define GL_NORMAL_ARRAY_STRIDE 0x807F #define GL_COLOR_ARRAY_SIZE 0x8081 #define GL_COLOR_ARRAY_TYPE 0x8082 #define GL_COLOR_ARRAY_STRIDE 0x8083 #define GL_INDEX_ARRAY_TYPE 0x8085 #define GL_INDEX_ARRAY_STRIDE 0x8086 #define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 #define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 #define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A #define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C #define GL_VERTEX_ARRAY_POINTER 0x808E #define GL_NORMAL_ARRAY_POINTER 0x808F #define GL_COLOR_ARRAY_POINTER 0x8090 #define GL_INDEX_ARRAY_POINTER 0x8091 #define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 #define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 #define GL_COLOR_INDEX1_EXT 0x80E2 #define GL_COLOR_INDEX2_EXT 0x80E3 #define GL_COLOR_INDEX4_EXT 0x80E4 #define GL_COLOR_INDEX8_EXT 0x80E5 #define GL_COLOR_INDEX12_EXT 0x80E6 #define GL_COLOR_INDEX16_EXT 0x80E7 #define GL_EVAL_BIT 0x00010000 #define GL_LIST_BIT 0x00020000 #define GL_TEXTURE_BIT 0x00040000 #define GL_SCISSOR_BIT 0x00080000 #define GL_ALL_ATTRIB_BITS 0x000fffff #define GL_CLIENT_ALL_ATTRIB_BITS 0xffffffff GLAPI void GLAPIENTRY glAccum (GLenum op, GLfloat value); GLAPI void GLAPIENTRY glAlphaFunc (GLenum func, GLclampf ref); GLAPI GLboolean GLAPIENTRY glAreTexturesResident (GLsizei n, const GLuint *textures, GLboolean *residences); GLAPI void GLAPIENTRY glArrayElement (GLint i); GLAPI void GLAPIENTRY glBegin (GLenum mode); GLAPI void GLAPIENTRY glBindTexture (GLenum target, GLuint texture); GLAPI void GLAPIENTRY glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap); GLAPI void GLAPIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); GLAPI void GLAPIENTRY glCallList (GLuint list); GLAPI void GLAPIENTRY glCallLists (GLsizei n, GLenum type, const GLvoid *lists); GLAPI void GLAPIENTRY glClear (GLbitfield mask); GLAPI void GLAPIENTRY glClearAccum (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); GLAPI void GLAPIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); GLAPI void GLAPIENTRY glClearDepth (GLclampd depth); GLAPI void GLAPIENTRY glClearIndex (GLfloat c); GLAPI void GLAPIENTRY glClearStencil (GLint s); GLAPI void GLAPIENTRY glClipPlane (GLenum plane, const GLdouble *equation); GLAPI void GLAPIENTRY glColor3b (GLbyte red, GLbyte green, GLbyte blue); GLAPI void GLAPIENTRY glColor3bv (const GLbyte *v); GLAPI void GLAPIENTRY glColor3d (GLdouble red, GLdouble green, GLdouble blue); GLAPI void GLAPIENTRY glColor3dv (const GLdouble *v); GLAPI void GLAPIENTRY glColor3f (GLfloat red, GLfloat green, GLfloat blue); GLAPI void GLAPIENTRY glColor3fv (const GLfloat *v); GLAPI void GLAPIENTRY glColor3i (GLint red, GLint green, GLint blue); GLAPI void GLAPIENTRY glColor3iv (const GLint *v); GLAPI void GLAPIENTRY glColor3s (GLshort red, GLshort green, GLshort blue); GLAPI void GLAPIENTRY glColor3sv (const GLshort *v); GLAPI void GLAPIENTRY glColor3ub (GLubyte red, GLubyte green, GLubyte blue); GLAPI void GLAPIENTRY glColor3ubv (const GLubyte *v); GLAPI void GLAPIENTRY glColor3ui (GLuint red, GLuint green, GLuint blue); GLAPI void GLAPIENTRY glColor3uiv (const GLuint *v); GLAPI void GLAPIENTRY glColor3us (GLushort red, GLushort green, GLushort blue); GLAPI void GLAPIENTRY glColor3usv (const GLushort *v); GLAPI void GLAPIENTRY glColor4b (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); GLAPI void GLAPIENTRY glColor4bv (const GLbyte *v); GLAPI void GLAPIENTRY glColor4d (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); GLAPI void GLAPIENTRY glColor4dv (const GLdouble *v); GLAPI void GLAPIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); GLAPI void GLAPIENTRY glColor4fv (const GLfloat *v); GLAPI void GLAPIENTRY glColor4i (GLint red, GLint green, GLint blue, GLint alpha); GLAPI void GLAPIENTRY glColor4iv (const GLint *v); GLAPI void GLAPIENTRY glColor4s (GLshort red, GLshort green, GLshort blue, GLshort alpha); GLAPI void GLAPIENTRY glColor4sv (const GLshort *v); GLAPI void GLAPIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); GLAPI void GLAPIENTRY glColor4ubv (const GLubyte *v); GLAPI void GLAPIENTRY glColor4ui (GLuint red, GLuint green, GLuint blue, GLuint alpha); GLAPI void GLAPIENTRY glColor4uiv (const GLuint *v); GLAPI void GLAPIENTRY glColor4us (GLushort red, GLushort green, GLushort blue, GLushort alpha); GLAPI void GLAPIENTRY glColor4usv (const GLushort *v); GLAPI void GLAPIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); GLAPI void GLAPIENTRY glColorMaterial (GLenum face, GLenum mode); GLAPI void GLAPIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); GLAPI void GLAPIENTRY glCopyPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); GLAPI void GLAPIENTRY glCopyTexImage1D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); GLAPI void GLAPIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); GLAPI void GLAPIENTRY glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); GLAPI void GLAPIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); GLAPI void GLAPIENTRY glCullFace (GLenum mode); GLAPI void GLAPIENTRY glDeleteLists (GLuint list, GLsizei range); GLAPI void GLAPIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); GLAPI void GLAPIENTRY glDepthFunc (GLenum func); GLAPI void GLAPIENTRY glDepthMask (GLboolean flag); GLAPI void GLAPIENTRY glDepthRange (GLclampd zNear, GLclampd zFar); GLAPI void GLAPIENTRY glDisable (GLenum cap); GLAPI void GLAPIENTRY glDisableClientState (GLenum array); GLAPI void GLAPIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); GLAPI void GLAPIENTRY glDrawBuffer (GLenum mode); GLAPI void GLAPIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); GLAPI void GLAPIENTRY glDrawPixels (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); GLAPI void GLAPIENTRY glEdgeFlag (GLboolean flag); GLAPI void GLAPIENTRY glEdgeFlagPointer (GLsizei stride, const GLvoid *pointer); GLAPI void GLAPIENTRY glEdgeFlagv (const GLboolean *flag); GLAPI void GLAPIENTRY glEnable (GLenum cap); GLAPI void GLAPIENTRY glEnableClientState (GLenum array); GLAPI void GLAPIENTRY glEnd (void); GLAPI void GLAPIENTRY glEndList (void); GLAPI void GLAPIENTRY glEvalCoord1d (GLdouble u); GLAPI void GLAPIENTRY glEvalCoord1dv (const GLdouble *u); GLAPI void GLAPIENTRY glEvalCoord1f (GLfloat u); GLAPI void GLAPIENTRY glEvalCoord1fv (const GLfloat *u); GLAPI void GLAPIENTRY glEvalCoord2d (GLdouble u, GLdouble v); GLAPI void GLAPIENTRY glEvalCoord2dv (const GLdouble *u); GLAPI void GLAPIENTRY glEvalCoord2f (GLfloat u, GLfloat v); GLAPI void GLAPIENTRY glEvalCoord2fv (const GLfloat *u); GLAPI void GLAPIENTRY glEvalMesh1 (GLenum mode, GLint i1, GLint i2); GLAPI void GLAPIENTRY glEvalMesh2 (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); GLAPI void GLAPIENTRY glEvalPoint1 (GLint i); GLAPI void GLAPIENTRY glEvalPoint2 (GLint i, GLint j); GLAPI void GLAPIENTRY glFeedbackBuffer (GLsizei size, GLenum type, GLfloat *buffer); GLAPI void GLAPIENTRY glFinish (void); GLAPI void GLAPIENTRY glFlush (void); GLAPI void GLAPIENTRY glFogf (GLenum pname, GLfloat param); GLAPI void GLAPIENTRY glFogfv (GLenum pname, const GLfloat *params); GLAPI void GLAPIENTRY glFogi (GLenum pname, GLint param); GLAPI void GLAPIENTRY glFogiv (GLenum pname, const GLint *params); GLAPI void GLAPIENTRY glFrontFace (GLenum mode); GLAPI void GLAPIENTRY glFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); GLAPI GLuint GLAPIENTRY glGenLists (GLsizei range); GLAPI void GLAPIENTRY glGenTextures (GLsizei n, GLuint *textures); GLAPI void GLAPIENTRY glGetBooleanv (GLenum pname, GLboolean *params); GLAPI void GLAPIENTRY glGetClipPlane (GLenum plane, GLdouble *equation); GLAPI void GLAPIENTRY glGetDoublev (GLenum pname, GLdouble *params); GLAPI GLenum GLAPIENTRY glGetError (void); GLAPI void GLAPIENTRY glGetFloatv (GLenum pname, GLfloat *params); GLAPI void GLAPIENTRY glGetIntegerv (GLenum pname, GLint *params); GLAPI void GLAPIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params); GLAPI void GLAPIENTRY glGetLightiv (GLenum light, GLenum pname, GLint *params); GLAPI void GLAPIENTRY glGetMapdv (GLenum target, GLenum query, GLdouble *v); GLAPI void GLAPIENTRY glGetMapfv (GLenum target, GLenum query, GLfloat *v); GLAPI void GLAPIENTRY glGetMapiv (GLenum target, GLenum query, GLint *v); GLAPI void GLAPIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params); GLAPI void GLAPIENTRY glGetMaterialiv (GLenum face, GLenum pname, GLint *params); GLAPI void GLAPIENTRY glGetPixelMapfv (GLenum map, GLfloat *values); GLAPI void GLAPIENTRY glGetPixelMapuiv (GLenum map, GLuint *values); GLAPI void GLAPIENTRY glGetPixelMapusv (GLenum map, GLushort *values); GLAPI void GLAPIENTRY glGetPointerv (GLenum pname, GLvoid* *params); GLAPI void GLAPIENTRY glGetPolygonStipple (GLubyte *mask); GLAPI const GLubyte * GLAPIENTRY glGetString (GLenum name); GLAPI void GLAPIENTRY glGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params); GLAPI void GLAPIENTRY glGetTexEnviv (GLenum target, GLenum pname, GLint *params); GLAPI void GLAPIENTRY glGetTexGendv (GLenum coord, GLenum pname, GLdouble *params); GLAPI void GLAPIENTRY glGetTexGenfv (GLenum coord, GLenum pname, GLfloat *params); GLAPI void GLAPIENTRY glGetTexGeniv (GLenum coord, GLenum pname, GLint *params); GLAPI void GLAPIENTRY glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); GLAPI void GLAPIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params); GLAPI void GLAPIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params); GLAPI void GLAPIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); GLAPI void GLAPIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); GLAPI void GLAPIENTRY glHint (GLenum target, GLenum mode); GLAPI void GLAPIENTRY glIndexMask (GLuint mask); GLAPI void GLAPIENTRY glIndexPointer (GLenum type, GLsizei stride, const GLvoid *pointer); GLAPI void GLAPIENTRY glIndexd (GLdouble c); GLAPI void GLAPIENTRY glIndexdv (const GLdouble *c); GLAPI void GLAPIENTRY glIndexf (GLfloat c); GLAPI void GLAPIENTRY glIndexfv (const GLfloat *c); GLAPI void GLAPIENTRY glIndexi (GLint c); GLAPI void GLAPIENTRY glIndexiv (const GLint *c); GLAPI void GLAPIENTRY glIndexs (GLshort c); GLAPI void GLAPIENTRY glIndexsv (const GLshort *c); GLAPI void GLAPIENTRY glIndexub (GLubyte c); GLAPI void GLAPIENTRY glIndexubv (const GLubyte *c); GLAPI void GLAPIENTRY glInitNames (void); GLAPI void GLAPIENTRY glInterleavedArrays (GLenum format, GLsizei stride, const GLvoid *pointer); GLAPI GLboolean GLAPIENTRY glIsEnabled (GLenum cap); GLAPI GLboolean GLAPIENTRY glIsList (GLuint list); GLAPI GLboolean GLAPIENTRY glIsTexture (GLuint texture); GLAPI void GLAPIENTRY glLightModelf (GLenum pname, GLfloat param); GLAPI void GLAPIENTRY glLightModelfv (GLenum pname, const GLfloat *params); GLAPI void GLAPIENTRY glLightModeli (GLenum pname, GLint param); GLAPI void GLAPIENTRY glLightModeliv (GLenum pname, const GLint *params); GLAPI void GLAPIENTRY glLightf (GLenum light, GLenum pname, GLfloat param); GLAPI void GLAPIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params); GLAPI void GLAPIENTRY glLighti (GLenum light, GLenum pname, GLint param); GLAPI void GLAPIENTRY glLightiv (GLenum light, GLenum pname, const GLint *params); GLAPI void GLAPIENTRY glLineStipple (GLint factor, GLushort pattern); GLAPI void GLAPIENTRY glLineWidth (GLfloat width); GLAPI void GLAPIENTRY glListBase (GLuint base); GLAPI void GLAPIENTRY glLoadIdentity (void); GLAPI void GLAPIENTRY glLoadMatrixd (const GLdouble *m); GLAPI void GLAPIENTRY glLoadMatrixf (const GLfloat *m); GLAPI void GLAPIENTRY glLoadName (GLuint name); GLAPI void GLAPIENTRY glLogicOp (GLenum opcode); GLAPI void GLAPIENTRY glMap1d (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); GLAPI void GLAPIENTRY glMap1f (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); GLAPI void GLAPIENTRY glMap2d (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); GLAPI void GLAPIENTRY glMap2f (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); GLAPI void GLAPIENTRY glMapGrid1d (GLint un, GLdouble u1, GLdouble u2); GLAPI void GLAPIENTRY glMapGrid1f (GLint un, GLfloat u1, GLfloat u2); GLAPI void GLAPIENTRY glMapGrid2d (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); GLAPI void GLAPIENTRY glMapGrid2f (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); GLAPI void GLAPIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param); GLAPI void GLAPIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params); GLAPI void GLAPIENTRY glMateriali (GLenum face, GLenum pname, GLint param); GLAPI void GLAPIENTRY glMaterialiv (GLenum face, GLenum pname, const GLint *params); GLAPI void GLAPIENTRY glMatrixMode (GLenum mode); GLAPI void GLAPIENTRY glMultMatrixd (const GLdouble *m); GLAPI void GLAPIENTRY glMultMatrixf (const GLfloat *m); GLAPI void GLAPIENTRY glNewList (GLuint list, GLenum mode); GLAPI void GLAPIENTRY glNormal3b (GLbyte nx, GLbyte ny, GLbyte nz); GLAPI void GLAPIENTRY glNormal3bv (const GLbyte *v); GLAPI void GLAPIENTRY glNormal3d (GLdouble nx, GLdouble ny, GLdouble nz); GLAPI void GLAPIENTRY glNormal3dv (const GLdouble *v); GLAPI void GLAPIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz); GLAPI void GLAPIENTRY glNormal3fv (const GLfloat *v); GLAPI void GLAPIENTRY glNormal3i (GLint nx, GLint ny, GLint nz); GLAPI void GLAPIENTRY glNormal3iv (const GLint *v); GLAPI void GLAPIENTRY glNormal3s (GLshort nx, GLshort ny, GLshort nz); GLAPI void GLAPIENTRY glNormal3sv (const GLshort *v); GLAPI void GLAPIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer); GLAPI void GLAPIENTRY glOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); GLAPI void GLAPIENTRY glPassThrough (GLfloat token); GLAPI void GLAPIENTRY glPixelMapfv (GLenum map, GLsizei mapsize, const GLfloat *values); GLAPI void GLAPIENTRY glPixelMapuiv (GLenum map, GLsizei mapsize, const GLuint *values); GLAPI void GLAPIENTRY glPixelMapusv (GLenum map, GLsizei mapsize, const GLushort *values); GLAPI void GLAPIENTRY glPixelStoref (GLenum pname, GLfloat param); GLAPI void GLAPIENTRY glPixelStorei (GLenum pname, GLint param); GLAPI void GLAPIENTRY glPixelTransferf (GLenum pname, GLfloat param); GLAPI void GLAPIENTRY glPixelTransferi (GLenum pname, GLint param); GLAPI void GLAPIENTRY glPixelZoom (GLfloat xfactor, GLfloat yfactor); GLAPI void GLAPIENTRY glPointSize (GLfloat size); GLAPI void GLAPIENTRY glPolygonMode (GLenum face, GLenum mode); GLAPI void GLAPIENTRY glPolygonOffset (GLfloat factor, GLfloat units); GLAPI void GLAPIENTRY glPolygonStipple (const GLubyte *mask); GLAPI void GLAPIENTRY glPopAttrib (void); GLAPI void GLAPIENTRY glPopClientAttrib (void); GLAPI void GLAPIENTRY glPopMatrix (void); GLAPI void GLAPIENTRY glPopName (void); GLAPI void GLAPIENTRY glPrioritizeTextures (GLsizei n, const GLuint *textures, const GLclampf *priorities); GLAPI void GLAPIENTRY glPushAttrib (GLbitfield mask); GLAPI void GLAPIENTRY glPushClientAttrib (GLbitfield mask); GLAPI void GLAPIENTRY glPushMatrix (void); GLAPI void GLAPIENTRY glPushName (GLuint name); GLAPI void GLAPIENTRY glRasterPos2d (GLdouble x, GLdouble y); GLAPI void GLAPIENTRY glRasterPos2dv (const GLdouble *v); GLAPI void GLAPIENTRY glRasterPos2f (GLfloat x, GLfloat y); GLAPI void GLAPIENTRY glRasterPos2fv (const GLfloat *v); GLAPI void GLAPIENTRY glRasterPos2i (GLint x, GLint y); GLAPI void GLAPIENTRY glRasterPos2iv (const GLint *v); GLAPI void GLAPIENTRY glRasterPos2s (GLshort x, GLshort y); GLAPI void GLAPIENTRY glRasterPos2sv (const GLshort *v); GLAPI void GLAPIENTRY glRasterPos3d (GLdouble x, GLdouble y, GLdouble z); GLAPI void GLAPIENTRY glRasterPos3dv (const GLdouble *v); GLAPI void GLAPIENTRY glRasterPos3f (GLfloat x, GLfloat y, GLfloat z); GLAPI void GLAPIENTRY glRasterPos3fv (const GLfloat *v); GLAPI void GLAPIENTRY glRasterPos3i (GLint x, GLint y, GLint z); GLAPI void GLAPIENTRY glRasterPos3iv (const GLint *v); GLAPI void GLAPIENTRY glRasterPos3s (GLshort x, GLshort y, GLshort z); GLAPI void GLAPIENTRY glRasterPos3sv (const GLshort *v); GLAPI void GLAPIENTRY glRasterPos4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w); GLAPI void GLAPIENTRY glRasterPos4dv (const GLdouble *v); GLAPI void GLAPIENTRY glRasterPos4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w); GLAPI void GLAPIENTRY glRasterPos4fv (const GLfloat *v); GLAPI void GLAPIENTRY glRasterPos4i (GLint x, GLint y, GLint z, GLint w); GLAPI void GLAPIENTRY glRasterPos4iv (const GLint *v); GLAPI void GLAPIENTRY glRasterPos4s (GLshort x, GLshort y, GLshort z, GLshort w); GLAPI void GLAPIENTRY glRasterPos4sv (const GLshort *v); GLAPI void GLAPIENTRY glReadBuffer (GLenum mode); GLAPI void GLAPIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); GLAPI void GLAPIENTRY glRectd (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); GLAPI void GLAPIENTRY glRectdv (const GLdouble *v1, const GLdouble *v2); GLAPI void GLAPIENTRY glRectf (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); GLAPI void GLAPIENTRY glRectfv (const GLfloat *v1, const GLfloat *v2); GLAPI void GLAPIENTRY glRecti (GLint x1, GLint y1, GLint x2, GLint y2); GLAPI void GLAPIENTRY glRectiv (const GLint *v1, const GLint *v2); GLAPI void GLAPIENTRY glRects (GLshort x1, GLshort y1, GLshort x2, GLshort y2); GLAPI void GLAPIENTRY glRectsv (const GLshort *v1, const GLshort *v2); GLAPI GLint GLAPIENTRY glRenderMode (GLenum mode); GLAPI void GLAPIENTRY glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z); GLAPI void GLAPIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z); GLAPI void GLAPIENTRY glScaled (GLdouble x, GLdouble y, GLdouble z); GLAPI void GLAPIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z); GLAPI void GLAPIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); GLAPI void GLAPIENTRY glSelectBuffer (GLsizei size, GLuint *buffer); GLAPI void GLAPIENTRY glShadeModel (GLenum mode); GLAPI void GLAPIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); GLAPI void GLAPIENTRY glStencilMask (GLuint mask); GLAPI void GLAPIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); GLAPI void GLAPIENTRY glTexCoord1d (GLdouble s); GLAPI void GLAPIENTRY glTexCoord1dv (const GLdouble *v); GLAPI void GLAPIENTRY glTexCoord1f (GLfloat s); GLAPI void GLAPIENTRY glTexCoord1fv (const GLfloat *v); GLAPI void GLAPIENTRY glTexCoord1i (GLint s); GLAPI void GLAPIENTRY glTexCoord1iv (const GLint *v); GLAPI void GLAPIENTRY glTexCoord1s (GLshort s); GLAPI void GLAPIENTRY glTexCoord1sv (const GLshort *v); GLAPI void GLAPIENTRY glTexCoord2d (GLdouble s, GLdouble t); GLAPI void GLAPIENTRY glTexCoord2dv (const GLdouble *v); GLAPI void GLAPIENTRY glTexCoord2f (GLfloat s, GLfloat t); GLAPI void GLAPIENTRY glTexCoord2fv (const GLfloat *v); GLAPI void GLAPIENTRY glTexCoord2i (GLint s, GLint t); GLAPI void GLAPIENTRY glTexCoord2iv (const GLint *v); GLAPI void GLAPIENTRY glTexCoord2s (GLshort s, GLshort t); GLAPI void GLAPIENTRY glTexCoord2sv (const GLshort *v); GLAPI void GLAPIENTRY glTexCoord3d (GLdouble s, GLdouble t, GLdouble r); GLAPI void GLAPIENTRY glTexCoord3dv (const GLdouble *v); GLAPI void GLAPIENTRY glTexCoord3f (GLfloat s, GLfloat t, GLfloat r); GLAPI void GLAPIENTRY glTexCoord3fv (const GLfloat *v); GLAPI void GLAPIENTRY glTexCoord3i (GLint s, GLint t, GLint r); GLAPI void GLAPIENTRY glTexCoord3iv (const GLint *v); GLAPI void GLAPIENTRY glTexCoord3s (GLshort s, GLshort t, GLshort r); GLAPI void GLAPIENTRY glTexCoord3sv (const GLshort *v); GLAPI void GLAPIENTRY glTexCoord4d (GLdouble s, GLdouble t, GLdouble r, GLdouble q); GLAPI void GLAPIENTRY glTexCoord4dv (const GLdouble *v); GLAPI void GLAPIENTRY glTexCoord4f (GLfloat s, GLfloat t, GLfloat r, GLfloat q); GLAPI void GLAPIENTRY glTexCoord4fv (const GLfloat *v); GLAPI void GLAPIENTRY glTexCoord4i (GLint s, GLint t, GLint r, GLint q); GLAPI void GLAPIENTRY glTexCoord4iv (const GLint *v); GLAPI void GLAPIENTRY glTexCoord4s (GLshort s, GLshort t, GLshort r, GLshort q); GLAPI void GLAPIENTRY glTexCoord4sv (const GLshort *v); GLAPI void GLAPIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); GLAPI void GLAPIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param); GLAPI void GLAPIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params); GLAPI void GLAPIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param); GLAPI void GLAPIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params); GLAPI void GLAPIENTRY glTexGend (GLenum coord, GLenum pname, GLdouble param); GLAPI void GLAPIENTRY glTexGendv (GLenum coord, GLenum pname, const GLdouble *params); GLAPI void GLAPIENTRY glTexGenf (GLenum coord, GLenum pname, GLfloat param); GLAPI void GLAPIENTRY glTexGenfv (GLenum coord, GLenum pname, const GLfloat *params); GLAPI void GLAPIENTRY glTexGeni (GLenum coord, GLenum pname, GLint param); GLAPI void GLAPIENTRY glTexGeniv (GLenum coord, GLenum pname, const GLint *params); GLAPI void GLAPIENTRY glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); GLAPI void GLAPIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); GLAPI void GLAPIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); GLAPI void GLAPIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); GLAPI void GLAPIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); GLAPI void GLAPIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params); GLAPI void GLAPIENTRY glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); GLAPI void GLAPIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); GLAPI void GLAPIENTRY glTranslated (GLdouble x, GLdouble y, GLdouble z); GLAPI void GLAPIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z); GLAPI void GLAPIENTRY glVertex2d (GLdouble x, GLdouble y); GLAPI void GLAPIENTRY glVertex2dv (const GLdouble *v); GLAPI void GLAPIENTRY glVertex2f (GLfloat x, GLfloat y); GLAPI void GLAPIENTRY glVertex2fv (const GLfloat *v); GLAPI void GLAPIENTRY glVertex2i (GLint x, GLint y); GLAPI void GLAPIENTRY glVertex2iv (const GLint *v); GLAPI void GLAPIENTRY glVertex2s (GLshort x, GLshort y); GLAPI void GLAPIENTRY glVertex2sv (const GLshort *v); GLAPI void GLAPIENTRY glVertex3d (GLdouble x, GLdouble y, GLdouble z); GLAPI void GLAPIENTRY glVertex3dv (const GLdouble *v); GLAPI void GLAPIENTRY glVertex3f (GLfloat x, GLfloat y, GLfloat z); GLAPI void GLAPIENTRY glVertex3fv (const GLfloat *v); GLAPI void GLAPIENTRY glVertex3i (GLint x, GLint y, GLint z); GLAPI void GLAPIENTRY glVertex3iv (const GLint *v); GLAPI void GLAPIENTRY glVertex3s (GLshort x, GLshort y, GLshort z); GLAPI void GLAPIENTRY glVertex3sv (const GLshort *v); GLAPI void GLAPIENTRY glVertex4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w); GLAPI void GLAPIENTRY glVertex4dv (const GLdouble *v); GLAPI void GLAPIENTRY glVertex4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w); GLAPI void GLAPIENTRY glVertex4fv (const GLfloat *v); GLAPI void GLAPIENTRY glVertex4i (GLint x, GLint y, GLint z, GLint w); GLAPI void GLAPIENTRY glVertex4iv (const GLint *v); GLAPI void GLAPIENTRY glVertex4s (GLshort x, GLshort y, GLshort z, GLshort w); GLAPI void GLAPIENTRY glVertex4sv (const GLshort *v); GLAPI void GLAPIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); GLAPI void GLAPIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); #define GLEW_VERSION_1_1 GLEW_GET_VAR(__GLEW_VERSION_1_1) #endif /* GL_VERSION_1_1 */ /* ---------------------------------- GLU ---------------------------------- */ #ifndef GLEW_NO_GLU /* this is where we can safely include GLU */ # if defined(__APPLE__) && defined(__MACH__) # include # else # include # endif #endif /* ----------------------------- GL_VERSION_1_2 ---------------------------- */ #ifndef GL_VERSION_1_2 #define GL_VERSION_1_2 1 #define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 #define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 #define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 #define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 #define GL_UNSIGNED_BYTE_3_3_2 0x8032 #define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 #define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 #define GL_UNSIGNED_INT_8_8_8_8 0x8035 #define GL_UNSIGNED_INT_10_10_10_2 0x8036 #define GL_RESCALE_NORMAL 0x803A #define GL_TEXTURE_BINDING_3D 0x806A #define GL_PACK_SKIP_IMAGES 0x806B #define GL_PACK_IMAGE_HEIGHT 0x806C #define GL_UNPACK_SKIP_IMAGES 0x806D #define GL_UNPACK_IMAGE_HEIGHT 0x806E #define GL_TEXTURE_3D 0x806F #define GL_PROXY_TEXTURE_3D 0x8070 #define GL_TEXTURE_DEPTH 0x8071 #define GL_TEXTURE_WRAP_R 0x8072 #define GL_MAX_3D_TEXTURE_SIZE 0x8073 #define GL_BGR 0x80E0 #define GL_BGRA 0x80E1 #define GL_MAX_ELEMENTS_VERTICES 0x80E8 #define GL_MAX_ELEMENTS_INDICES 0x80E9 #define GL_CLAMP_TO_EDGE 0x812F #define GL_TEXTURE_MIN_LOD 0x813A #define GL_TEXTURE_MAX_LOD 0x813B #define GL_TEXTURE_BASE_LEVEL 0x813C #define GL_TEXTURE_MAX_LEVEL 0x813D #define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 #define GL_SINGLE_COLOR 0x81F9 #define GL_SEPARATE_SPECULAR_COLOR 0x81FA #define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 #define GL_UNSIGNED_SHORT_5_6_5 0x8363 #define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 #define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 #define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 #define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 #define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 #define GL_ALIASED_POINT_SIZE_RANGE 0x846D #define GL_ALIASED_LINE_WIDTH_RANGE 0x846E typedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); typedef void (GLAPIENTRY * PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); #define glCopyTexSubImage3D GLEW_GET_FUN(__glewCopyTexSubImage3D) #define glDrawRangeElements GLEW_GET_FUN(__glewDrawRangeElements) #define glTexImage3D GLEW_GET_FUN(__glewTexImage3D) #define glTexSubImage3D GLEW_GET_FUN(__glewTexSubImage3D) #define GLEW_VERSION_1_2 GLEW_GET_VAR(__GLEW_VERSION_1_2) #endif /* GL_VERSION_1_2 */ /* ---------------------------- GL_VERSION_1_2_1 --------------------------- */ #ifndef GL_VERSION_1_2_1 #define GL_VERSION_1_2_1 1 #define GLEW_VERSION_1_2_1 GLEW_GET_VAR(__GLEW_VERSION_1_2_1) #endif /* GL_VERSION_1_2_1 */ /* ----------------------------- GL_VERSION_1_3 ---------------------------- */ #ifndef GL_VERSION_1_3 #define GL_VERSION_1_3 1 #define GL_MULTISAMPLE 0x809D #define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E #define GL_SAMPLE_ALPHA_TO_ONE 0x809F #define GL_SAMPLE_COVERAGE 0x80A0 #define GL_SAMPLE_BUFFERS 0x80A8 #define GL_SAMPLES 0x80A9 #define GL_SAMPLE_COVERAGE_VALUE 0x80AA #define GL_SAMPLE_COVERAGE_INVERT 0x80AB #define GL_CLAMP_TO_BORDER 0x812D #define GL_TEXTURE0 0x84C0 #define GL_TEXTURE1 0x84C1 #define GL_TEXTURE2 0x84C2 #define GL_TEXTURE3 0x84C3 #define GL_TEXTURE4 0x84C4 #define GL_TEXTURE5 0x84C5 #define GL_TEXTURE6 0x84C6 #define GL_TEXTURE7 0x84C7 #define GL_TEXTURE8 0x84C8 #define GL_TEXTURE9 0x84C9 #define GL_TEXTURE10 0x84CA #define GL_TEXTURE11 0x84CB #define GL_TEXTURE12 0x84CC #define GL_TEXTURE13 0x84CD #define GL_TEXTURE14 0x84CE #define GL_TEXTURE15 0x84CF #define GL_TEXTURE16 0x84D0 #define GL_TEXTURE17 0x84D1 #define GL_TEXTURE18 0x84D2 #define GL_TEXTURE19 0x84D3 #define GL_TEXTURE20 0x84D4 #define GL_TEXTURE21 0x84D5 #define GL_TEXTURE22 0x84D6 #define GL_TEXTURE23 0x84D7 #define GL_TEXTURE24 0x84D8 #define GL_TEXTURE25 0x84D9 #define GL_TEXTURE26 0x84DA #define GL_TEXTURE27 0x84DB #define GL_TEXTURE28 0x84DC #define GL_TEXTURE29 0x84DD #define GL_TEXTURE30 0x84DE #define GL_TEXTURE31 0x84DF #define GL_ACTIVE_TEXTURE 0x84E0 #define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 #define GL_MAX_TEXTURE_UNITS 0x84E2 #define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 #define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 #define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 #define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 #define GL_SUBTRACT 0x84E7 #define GL_COMPRESSED_ALPHA 0x84E9 #define GL_COMPRESSED_LUMINANCE 0x84EA #define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB #define GL_COMPRESSED_INTENSITY 0x84EC #define GL_COMPRESSED_RGB 0x84ED #define GL_COMPRESSED_RGBA 0x84EE #define GL_TEXTURE_COMPRESSION_HINT 0x84EF #define GL_NORMAL_MAP 0x8511 #define GL_REFLECTION_MAP 0x8512 #define GL_TEXTURE_CUBE_MAP 0x8513 #define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 #define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A #define GL_PROXY_TEXTURE_CUBE_MAP 0x851B #define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C #define GL_COMBINE 0x8570 #define GL_COMBINE_RGB 0x8571 #define GL_COMBINE_ALPHA 0x8572 #define GL_RGB_SCALE 0x8573 #define GL_ADD_SIGNED 0x8574 #define GL_INTERPOLATE 0x8575 #define GL_CONSTANT 0x8576 #define GL_PRIMARY_COLOR 0x8577 #define GL_PREVIOUS 0x8578 #define GL_SOURCE0_RGB 0x8580 #define GL_SOURCE1_RGB 0x8581 #define GL_SOURCE2_RGB 0x8582 #define GL_SOURCE0_ALPHA 0x8588 #define GL_SOURCE1_ALPHA 0x8589 #define GL_SOURCE2_ALPHA 0x858A #define GL_OPERAND0_RGB 0x8590 #define GL_OPERAND1_RGB 0x8591 #define GL_OPERAND2_RGB 0x8592 #define GL_OPERAND0_ALPHA 0x8598 #define GL_OPERAND1_ALPHA 0x8599 #define GL_OPERAND2_ALPHA 0x859A #define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 #define GL_TEXTURE_COMPRESSED 0x86A1 #define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 #define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 #define GL_DOT3_RGB 0x86AE #define GL_DOT3_RGBA 0x86AF #define GL_MULTISAMPLE_BIT 0x20000000 typedef void (GLAPIENTRY * PFNGLACTIVETEXTUREPROC) (GLenum texture); typedef void (GLAPIENTRY * PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); typedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint lod, GLvoid *img); typedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble m[16]); typedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat m[16]); typedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble m[16]); typedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat m[16]); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); typedef void (GLAPIENTRY * PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); #define glActiveTexture GLEW_GET_FUN(__glewActiveTexture) #define glClientActiveTexture GLEW_GET_FUN(__glewClientActiveTexture) #define glCompressedTexImage1D GLEW_GET_FUN(__glewCompressedTexImage1D) #define glCompressedTexImage2D GLEW_GET_FUN(__glewCompressedTexImage2D) #define glCompressedTexImage3D GLEW_GET_FUN(__glewCompressedTexImage3D) #define glCompressedTexSubImage1D GLEW_GET_FUN(__glewCompressedTexSubImage1D) #define glCompressedTexSubImage2D GLEW_GET_FUN(__glewCompressedTexSubImage2D) #define glCompressedTexSubImage3D GLEW_GET_FUN(__glewCompressedTexSubImage3D) #define glGetCompressedTexImage GLEW_GET_FUN(__glewGetCompressedTexImage) #define glLoadTransposeMatrixd GLEW_GET_FUN(__glewLoadTransposeMatrixd) #define glLoadTransposeMatrixf GLEW_GET_FUN(__glewLoadTransposeMatrixf) #define glMultTransposeMatrixd GLEW_GET_FUN(__glewMultTransposeMatrixd) #define glMultTransposeMatrixf GLEW_GET_FUN(__glewMultTransposeMatrixf) #define glMultiTexCoord1d GLEW_GET_FUN(__glewMultiTexCoord1d) #define glMultiTexCoord1dv GLEW_GET_FUN(__glewMultiTexCoord1dv) #define glMultiTexCoord1f GLEW_GET_FUN(__glewMultiTexCoord1f) #define glMultiTexCoord1fv GLEW_GET_FUN(__glewMultiTexCoord1fv) #define glMultiTexCoord1i GLEW_GET_FUN(__glewMultiTexCoord1i) #define glMultiTexCoord1iv GLEW_GET_FUN(__glewMultiTexCoord1iv) #define glMultiTexCoord1s GLEW_GET_FUN(__glewMultiTexCoord1s) #define glMultiTexCoord1sv GLEW_GET_FUN(__glewMultiTexCoord1sv) #define glMultiTexCoord2d GLEW_GET_FUN(__glewMultiTexCoord2d) #define glMultiTexCoord2dv GLEW_GET_FUN(__glewMultiTexCoord2dv) #define glMultiTexCoord2f GLEW_GET_FUN(__glewMultiTexCoord2f) #define glMultiTexCoord2fv GLEW_GET_FUN(__glewMultiTexCoord2fv) #define glMultiTexCoord2i GLEW_GET_FUN(__glewMultiTexCoord2i) #define glMultiTexCoord2iv GLEW_GET_FUN(__glewMultiTexCoord2iv) #define glMultiTexCoord2s GLEW_GET_FUN(__glewMultiTexCoord2s) #define glMultiTexCoord2sv GLEW_GET_FUN(__glewMultiTexCoord2sv) #define glMultiTexCoord3d GLEW_GET_FUN(__glewMultiTexCoord3d) #define glMultiTexCoord3dv GLEW_GET_FUN(__glewMultiTexCoord3dv) #define glMultiTexCoord3f GLEW_GET_FUN(__glewMultiTexCoord3f) #define glMultiTexCoord3fv GLEW_GET_FUN(__glewMultiTexCoord3fv) #define glMultiTexCoord3i GLEW_GET_FUN(__glewMultiTexCoord3i) #define glMultiTexCoord3iv GLEW_GET_FUN(__glewMultiTexCoord3iv) #define glMultiTexCoord3s GLEW_GET_FUN(__glewMultiTexCoord3s) #define glMultiTexCoord3sv GLEW_GET_FUN(__glewMultiTexCoord3sv) #define glMultiTexCoord4d GLEW_GET_FUN(__glewMultiTexCoord4d) #define glMultiTexCoord4dv GLEW_GET_FUN(__glewMultiTexCoord4dv) #define glMultiTexCoord4f GLEW_GET_FUN(__glewMultiTexCoord4f) #define glMultiTexCoord4fv GLEW_GET_FUN(__glewMultiTexCoord4fv) #define glMultiTexCoord4i GLEW_GET_FUN(__glewMultiTexCoord4i) #define glMultiTexCoord4iv GLEW_GET_FUN(__glewMultiTexCoord4iv) #define glMultiTexCoord4s GLEW_GET_FUN(__glewMultiTexCoord4s) #define glMultiTexCoord4sv GLEW_GET_FUN(__glewMultiTexCoord4sv) #define glSampleCoverage GLEW_GET_FUN(__glewSampleCoverage) #define GLEW_VERSION_1_3 GLEW_GET_VAR(__GLEW_VERSION_1_3) #endif /* GL_VERSION_1_3 */ /* ----------------------------- GL_VERSION_1_4 ---------------------------- */ #ifndef GL_VERSION_1_4 #define GL_VERSION_1_4 1 #define GL_BLEND_DST_RGB 0x80C8 #define GL_BLEND_SRC_RGB 0x80C9 #define GL_BLEND_DST_ALPHA 0x80CA #define GL_BLEND_SRC_ALPHA 0x80CB #define GL_POINT_SIZE_MIN 0x8126 #define GL_POINT_SIZE_MAX 0x8127 #define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 #define GL_POINT_DISTANCE_ATTENUATION 0x8129 #define GL_GENERATE_MIPMAP 0x8191 #define GL_GENERATE_MIPMAP_HINT 0x8192 #define GL_DEPTH_COMPONENT16 0x81A5 #define GL_DEPTH_COMPONENT24 0x81A6 #define GL_DEPTH_COMPONENT32 0x81A7 #define GL_MIRRORED_REPEAT 0x8370 #define GL_FOG_COORDINATE_SOURCE 0x8450 #define GL_FOG_COORDINATE 0x8451 #define GL_FRAGMENT_DEPTH 0x8452 #define GL_CURRENT_FOG_COORDINATE 0x8453 #define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 #define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 #define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 #define GL_FOG_COORDINATE_ARRAY 0x8457 #define GL_COLOR_SUM 0x8458 #define GL_CURRENT_SECONDARY_COLOR 0x8459 #define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A #define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B #define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C #define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D #define GL_SECONDARY_COLOR_ARRAY 0x845E #define GL_MAX_TEXTURE_LOD_BIAS 0x84FD #define GL_TEXTURE_FILTER_CONTROL 0x8500 #define GL_TEXTURE_LOD_BIAS 0x8501 #define GL_INCR_WRAP 0x8507 #define GL_DECR_WRAP 0x8508 #define GL_TEXTURE_DEPTH_SIZE 0x884A #define GL_DEPTH_TEXTURE_MODE 0x884B #define GL_TEXTURE_COMPARE_MODE 0x884C #define GL_TEXTURE_COMPARE_FUNC 0x884D #define GL_COMPARE_R_TO_TEXTURE 0x884E typedef void (GLAPIENTRY * PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONPROC) (GLenum mode); typedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); typedef void (GLAPIENTRY * PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); typedef void (GLAPIENTRY * PFNGLFOGCOORDDPROC) (GLdouble coord); typedef void (GLAPIENTRY * PFNGLFOGCOORDDVPROC) (const GLdouble *coord); typedef void (GLAPIENTRY * PFNGLFOGCOORDFPROC) (GLfloat coord); typedef void (GLAPIENTRY * PFNGLFOGCOORDFVPROC) (const GLfloat *coord); typedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei drawcount); typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DVPROC) (const GLdouble *p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FVPROC) (const GLfloat *p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IPROC) (GLint x, GLint y); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IVPROC) (const GLint *p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SVPROC) (const GLshort *p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DVPROC) (const GLdouble *p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FVPROC) (const GLfloat *p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IVPROC) (const GLint *p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SVPROC) (const GLshort *p); #define glBlendColor GLEW_GET_FUN(__glewBlendColor) #define glBlendEquation GLEW_GET_FUN(__glewBlendEquation) #define glBlendFuncSeparate GLEW_GET_FUN(__glewBlendFuncSeparate) #define glFogCoordPointer GLEW_GET_FUN(__glewFogCoordPointer) #define glFogCoordd GLEW_GET_FUN(__glewFogCoordd) #define glFogCoorddv GLEW_GET_FUN(__glewFogCoorddv) #define glFogCoordf GLEW_GET_FUN(__glewFogCoordf) #define glFogCoordfv GLEW_GET_FUN(__glewFogCoordfv) #define glMultiDrawArrays GLEW_GET_FUN(__glewMultiDrawArrays) #define glMultiDrawElements GLEW_GET_FUN(__glewMultiDrawElements) #define glPointParameterf GLEW_GET_FUN(__glewPointParameterf) #define glPointParameterfv GLEW_GET_FUN(__glewPointParameterfv) #define glPointParameteri GLEW_GET_FUN(__glewPointParameteri) #define glPointParameteriv GLEW_GET_FUN(__glewPointParameteriv) #define glSecondaryColor3b GLEW_GET_FUN(__glewSecondaryColor3b) #define glSecondaryColor3bv GLEW_GET_FUN(__glewSecondaryColor3bv) #define glSecondaryColor3d GLEW_GET_FUN(__glewSecondaryColor3d) #define glSecondaryColor3dv GLEW_GET_FUN(__glewSecondaryColor3dv) #define glSecondaryColor3f GLEW_GET_FUN(__glewSecondaryColor3f) #define glSecondaryColor3fv GLEW_GET_FUN(__glewSecondaryColor3fv) #define glSecondaryColor3i GLEW_GET_FUN(__glewSecondaryColor3i) #define glSecondaryColor3iv GLEW_GET_FUN(__glewSecondaryColor3iv) #define glSecondaryColor3s GLEW_GET_FUN(__glewSecondaryColor3s) #define glSecondaryColor3sv GLEW_GET_FUN(__glewSecondaryColor3sv) #define glSecondaryColor3ub GLEW_GET_FUN(__glewSecondaryColor3ub) #define glSecondaryColor3ubv GLEW_GET_FUN(__glewSecondaryColor3ubv) #define glSecondaryColor3ui GLEW_GET_FUN(__glewSecondaryColor3ui) #define glSecondaryColor3uiv GLEW_GET_FUN(__glewSecondaryColor3uiv) #define glSecondaryColor3us GLEW_GET_FUN(__glewSecondaryColor3us) #define glSecondaryColor3usv GLEW_GET_FUN(__glewSecondaryColor3usv) #define glSecondaryColorPointer GLEW_GET_FUN(__glewSecondaryColorPointer) #define glWindowPos2d GLEW_GET_FUN(__glewWindowPos2d) #define glWindowPos2dv GLEW_GET_FUN(__glewWindowPos2dv) #define glWindowPos2f GLEW_GET_FUN(__glewWindowPos2f) #define glWindowPos2fv GLEW_GET_FUN(__glewWindowPos2fv) #define glWindowPos2i GLEW_GET_FUN(__glewWindowPos2i) #define glWindowPos2iv GLEW_GET_FUN(__glewWindowPos2iv) #define glWindowPos2s GLEW_GET_FUN(__glewWindowPos2s) #define glWindowPos2sv GLEW_GET_FUN(__glewWindowPos2sv) #define glWindowPos3d GLEW_GET_FUN(__glewWindowPos3d) #define glWindowPos3dv GLEW_GET_FUN(__glewWindowPos3dv) #define glWindowPos3f GLEW_GET_FUN(__glewWindowPos3f) #define glWindowPos3fv GLEW_GET_FUN(__glewWindowPos3fv) #define glWindowPos3i GLEW_GET_FUN(__glewWindowPos3i) #define glWindowPos3iv GLEW_GET_FUN(__glewWindowPos3iv) #define glWindowPos3s GLEW_GET_FUN(__glewWindowPos3s) #define glWindowPos3sv GLEW_GET_FUN(__glewWindowPos3sv) #define GLEW_VERSION_1_4 GLEW_GET_VAR(__GLEW_VERSION_1_4) #endif /* GL_VERSION_1_4 */ /* ----------------------------- GL_VERSION_1_5 ---------------------------- */ #ifndef GL_VERSION_1_5 #define GL_VERSION_1_5 1 #define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE #define GL_FOG_COORD GL_FOG_COORDINATE #define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY #define GL_SRC0_RGB GL_SOURCE0_RGB #define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER #define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE #define GL_SRC1_ALPHA GL_SOURCE1_ALPHA #define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE #define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE #define GL_SRC0_ALPHA GL_SOURCE0_ALPHA #define GL_SRC1_RGB GL_SOURCE1_RGB #define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING #define GL_SRC2_ALPHA GL_SOURCE2_ALPHA #define GL_SRC2_RGB GL_SOURCE2_RGB #define GL_BUFFER_SIZE 0x8764 #define GL_BUFFER_USAGE 0x8765 #define GL_QUERY_COUNTER_BITS 0x8864 #define GL_CURRENT_QUERY 0x8865 #define GL_QUERY_RESULT 0x8866 #define GL_QUERY_RESULT_AVAILABLE 0x8867 #define GL_ARRAY_BUFFER 0x8892 #define GL_ELEMENT_ARRAY_BUFFER 0x8893 #define GL_ARRAY_BUFFER_BINDING 0x8894 #define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 #define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 #define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 #define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 #define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 #define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A #define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B #define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C #define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D #define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E #define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F #define GL_READ_ONLY 0x88B8 #define GL_WRITE_ONLY 0x88B9 #define GL_READ_WRITE 0x88BA #define GL_BUFFER_ACCESS 0x88BB #define GL_BUFFER_MAPPED 0x88BC #define GL_BUFFER_MAP_POINTER 0x88BD #define GL_STREAM_DRAW 0x88E0 #define GL_STREAM_READ 0x88E1 #define GL_STREAM_COPY 0x88E2 #define GL_STATIC_DRAW 0x88E4 #define GL_STATIC_READ 0x88E5 #define GL_STATIC_COPY 0x88E6 #define GL_DYNAMIC_DRAW 0x88E8 #define GL_DYNAMIC_READ 0x88E9 #define GL_DYNAMIC_COPY 0x88EA #define GL_SAMPLES_PASSED 0x8914 typedef ptrdiff_t GLintptr; typedef ptrdiff_t GLsizeiptr; typedef void (GLAPIENTRY * PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); typedef void (GLAPIENTRY * PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); typedef void (GLAPIENTRY * PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage); typedef void (GLAPIENTRY * PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data); typedef void (GLAPIENTRY * PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint* buffers); typedef void (GLAPIENTRY * PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint* ids); typedef void (GLAPIENTRY * PFNGLENDQUERYPROC) (GLenum target); typedef void (GLAPIENTRY * PFNGLGENBUFFERSPROC) (GLsizei n, GLuint* buffers); typedef void (GLAPIENTRY * PFNGLGENQUERIESPROC) (GLsizei n, GLuint* ids); typedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid** params); typedef void (GLAPIENTRY * PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid* data); typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint* params); typedef void (GLAPIENTRY * PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint* params); typedef GLboolean (GLAPIENTRY * PFNGLISBUFFERPROC) (GLuint buffer); typedef GLboolean (GLAPIENTRY * PFNGLISQUERYPROC) (GLuint id); typedef GLvoid* (GLAPIENTRY * PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); typedef GLboolean (GLAPIENTRY * PFNGLUNMAPBUFFERPROC) (GLenum target); #define glBeginQuery GLEW_GET_FUN(__glewBeginQuery) #define glBindBuffer GLEW_GET_FUN(__glewBindBuffer) #define glBufferData GLEW_GET_FUN(__glewBufferData) #define glBufferSubData GLEW_GET_FUN(__glewBufferSubData) #define glDeleteBuffers GLEW_GET_FUN(__glewDeleteBuffers) #define glDeleteQueries GLEW_GET_FUN(__glewDeleteQueries) #define glEndQuery GLEW_GET_FUN(__glewEndQuery) #define glGenBuffers GLEW_GET_FUN(__glewGenBuffers) #define glGenQueries GLEW_GET_FUN(__glewGenQueries) #define glGetBufferParameteriv GLEW_GET_FUN(__glewGetBufferParameteriv) #define glGetBufferPointerv GLEW_GET_FUN(__glewGetBufferPointerv) #define glGetBufferSubData GLEW_GET_FUN(__glewGetBufferSubData) #define glGetQueryObjectiv GLEW_GET_FUN(__glewGetQueryObjectiv) #define glGetQueryObjectuiv GLEW_GET_FUN(__glewGetQueryObjectuiv) #define glGetQueryiv GLEW_GET_FUN(__glewGetQueryiv) #define glIsBuffer GLEW_GET_FUN(__glewIsBuffer) #define glIsQuery GLEW_GET_FUN(__glewIsQuery) #define glMapBuffer GLEW_GET_FUN(__glewMapBuffer) #define glUnmapBuffer GLEW_GET_FUN(__glewUnmapBuffer) #define GLEW_VERSION_1_5 GLEW_GET_VAR(__GLEW_VERSION_1_5) #endif /* GL_VERSION_1_5 */ /* ----------------------------- GL_VERSION_2_0 ---------------------------- */ #ifndef GL_VERSION_2_0 #define GL_VERSION_2_0 1 #define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION #define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 #define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 #define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 #define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 #define GL_CURRENT_VERTEX_ATTRIB 0x8626 #define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 #define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 #define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 #define GL_STENCIL_BACK_FUNC 0x8800 #define GL_STENCIL_BACK_FAIL 0x8801 #define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 #define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 #define GL_MAX_DRAW_BUFFERS 0x8824 #define GL_DRAW_BUFFER0 0x8825 #define GL_DRAW_BUFFER1 0x8826 #define GL_DRAW_BUFFER2 0x8827 #define GL_DRAW_BUFFER3 0x8828 #define GL_DRAW_BUFFER4 0x8829 #define GL_DRAW_BUFFER5 0x882A #define GL_DRAW_BUFFER6 0x882B #define GL_DRAW_BUFFER7 0x882C #define GL_DRAW_BUFFER8 0x882D #define GL_DRAW_BUFFER9 0x882E #define GL_DRAW_BUFFER10 0x882F #define GL_DRAW_BUFFER11 0x8830 #define GL_DRAW_BUFFER12 0x8831 #define GL_DRAW_BUFFER13 0x8832 #define GL_DRAW_BUFFER14 0x8833 #define GL_DRAW_BUFFER15 0x8834 #define GL_BLEND_EQUATION_ALPHA 0x883D #define GL_POINT_SPRITE 0x8861 #define GL_COORD_REPLACE 0x8862 #define GL_MAX_VERTEX_ATTRIBS 0x8869 #define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A #define GL_MAX_TEXTURE_COORDS 0x8871 #define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 #define GL_FRAGMENT_SHADER 0x8B30 #define GL_VERTEX_SHADER 0x8B31 #define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 #define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A #define GL_MAX_VARYING_FLOATS 0x8B4B #define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C #define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D #define GL_SHADER_TYPE 0x8B4F #define GL_FLOAT_VEC2 0x8B50 #define GL_FLOAT_VEC3 0x8B51 #define GL_FLOAT_VEC4 0x8B52 #define GL_INT_VEC2 0x8B53 #define GL_INT_VEC3 0x8B54 #define GL_INT_VEC4 0x8B55 #define GL_BOOL 0x8B56 #define GL_BOOL_VEC2 0x8B57 #define GL_BOOL_VEC3 0x8B58 #define GL_BOOL_VEC4 0x8B59 #define GL_FLOAT_MAT2 0x8B5A #define GL_FLOAT_MAT3 0x8B5B #define GL_FLOAT_MAT4 0x8B5C #define GL_SAMPLER_1D 0x8B5D #define GL_SAMPLER_2D 0x8B5E #define GL_SAMPLER_3D 0x8B5F #define GL_SAMPLER_CUBE 0x8B60 #define GL_SAMPLER_1D_SHADOW 0x8B61 #define GL_SAMPLER_2D_SHADOW 0x8B62 #define GL_DELETE_STATUS 0x8B80 #define GL_COMPILE_STATUS 0x8B81 #define GL_LINK_STATUS 0x8B82 #define GL_VALIDATE_STATUS 0x8B83 #define GL_INFO_LOG_LENGTH 0x8B84 #define GL_ATTACHED_SHADERS 0x8B85 #define GL_ACTIVE_UNIFORMS 0x8B86 #define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 #define GL_SHADER_SOURCE_LENGTH 0x8B88 #define GL_ACTIVE_ATTRIBUTES 0x8B89 #define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A #define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B #define GL_SHADING_LANGUAGE_VERSION 0x8B8C #define GL_CURRENT_PROGRAM 0x8B8D #define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 #define GL_LOWER_LEFT 0x8CA1 #define GL_UPPER_LEFT 0x8CA2 #define GL_STENCIL_BACK_REF 0x8CA3 #define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 #define GL_STENCIL_BACK_WRITEMASK 0x8CA5 typedef void (GLAPIENTRY * PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); typedef void (GLAPIENTRY * PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar* name); typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum, GLenum); typedef void (GLAPIENTRY * PFNGLCOMPILESHADERPROC) (GLuint shader); typedef GLuint (GLAPIENTRY * PFNGLCREATEPROGRAMPROC) (void); typedef GLuint (GLAPIENTRY * PFNGLCREATESHADERPROC) (GLenum type); typedef void (GLAPIENTRY * PFNGLDELETEPROGRAMPROC) (GLuint program); typedef void (GLAPIENTRY * PFNGLDELETESHADERPROC) (GLuint shader); typedef void (GLAPIENTRY * PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); typedef void (GLAPIENTRY * PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint); typedef void (GLAPIENTRY * PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum* bufs); typedef void (GLAPIENTRY * PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint); typedef void (GLAPIENTRY * PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name); typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name); typedef void (GLAPIENTRY * PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei* count, GLuint* shaders); typedef GLint (GLAPIENTRY * PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar* name); typedef void (GLAPIENTRY * PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog); typedef void (GLAPIENTRY * PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint* param); typedef void (GLAPIENTRY * PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* infoLog); typedef void (GLAPIENTRY * PFNGLGETSHADERSOURCEPROC) (GLuint obj, GLsizei maxLength, GLsizei* length, GLchar* source); typedef void (GLAPIENTRY * PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint* param); typedef GLint (GLAPIENTRY * PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar* name); typedef void (GLAPIENTRY * PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint* params); typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint, GLenum, GLvoid**); typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBDVPROC) (GLuint, GLenum, GLdouble*); typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVPROC) (GLuint, GLenum, GLfloat*); typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIVPROC) (GLuint, GLenum, GLint*); typedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMPROC) (GLuint program); typedef GLboolean (GLAPIENTRY * PFNGLISSHADERPROC) (GLuint shader); typedef void (GLAPIENTRY * PFNGLLINKPROGRAMPROC) (GLuint program); typedef void (GLAPIENTRY * PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar** strings, const GLint* lengths); typedef void (GLAPIENTRY * PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); typedef void (GLAPIENTRY * PFNGLSTENCILMASKSEPARATEPROC) (GLenum, GLuint); typedef void (GLAPIENTRY * PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); typedef void (GLAPIENTRY * PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); typedef void (GLAPIENTRY * PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLUNIFORM1IPROC) (GLint location, GLint v0); typedef void (GLAPIENTRY * PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint* value); typedef void (GLAPIENTRY * PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); typedef void (GLAPIENTRY * PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); typedef void (GLAPIENTRY * PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint* value); typedef void (GLAPIENTRY * PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); typedef void (GLAPIENTRY * PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); typedef void (GLAPIENTRY * PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint* value); typedef void (GLAPIENTRY * PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); typedef void (GLAPIENTRY * PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); typedef void (GLAPIENTRY * PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint* value); typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLUSEPROGRAMPROC) (GLuint program); typedef void (GLAPIENTRY * PFNGLVALIDATEPROGRAMPROC) (GLuint program); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer); #define glAttachShader GLEW_GET_FUN(__glewAttachShader) #define glBindAttribLocation GLEW_GET_FUN(__glewBindAttribLocation) #define glBlendEquationSeparate GLEW_GET_FUN(__glewBlendEquationSeparate) #define glCompileShader GLEW_GET_FUN(__glewCompileShader) #define glCreateProgram GLEW_GET_FUN(__glewCreateProgram) #define glCreateShader GLEW_GET_FUN(__glewCreateShader) #define glDeleteProgram GLEW_GET_FUN(__glewDeleteProgram) #define glDeleteShader GLEW_GET_FUN(__glewDeleteShader) #define glDetachShader GLEW_GET_FUN(__glewDetachShader) #define glDisableVertexAttribArray GLEW_GET_FUN(__glewDisableVertexAttribArray) #define glDrawBuffers GLEW_GET_FUN(__glewDrawBuffers) #define glEnableVertexAttribArray GLEW_GET_FUN(__glewEnableVertexAttribArray) #define glGetActiveAttrib GLEW_GET_FUN(__glewGetActiveAttrib) #define glGetActiveUniform GLEW_GET_FUN(__glewGetActiveUniform) #define glGetAttachedShaders GLEW_GET_FUN(__glewGetAttachedShaders) #define glGetAttribLocation GLEW_GET_FUN(__glewGetAttribLocation) #define glGetProgramInfoLog GLEW_GET_FUN(__glewGetProgramInfoLog) #define glGetProgramiv GLEW_GET_FUN(__glewGetProgramiv) #define glGetShaderInfoLog GLEW_GET_FUN(__glewGetShaderInfoLog) #define glGetShaderSource GLEW_GET_FUN(__glewGetShaderSource) #define glGetShaderiv GLEW_GET_FUN(__glewGetShaderiv) #define glGetUniformLocation GLEW_GET_FUN(__glewGetUniformLocation) #define glGetUniformfv GLEW_GET_FUN(__glewGetUniformfv) #define glGetUniformiv GLEW_GET_FUN(__glewGetUniformiv) #define glGetVertexAttribPointerv GLEW_GET_FUN(__glewGetVertexAttribPointerv) #define glGetVertexAttribdv GLEW_GET_FUN(__glewGetVertexAttribdv) #define glGetVertexAttribfv GLEW_GET_FUN(__glewGetVertexAttribfv) #define glGetVertexAttribiv GLEW_GET_FUN(__glewGetVertexAttribiv) #define glIsProgram GLEW_GET_FUN(__glewIsProgram) #define glIsShader GLEW_GET_FUN(__glewIsShader) #define glLinkProgram GLEW_GET_FUN(__glewLinkProgram) #define glShaderSource GLEW_GET_FUN(__glewShaderSource) #define glStencilFuncSeparate GLEW_GET_FUN(__glewStencilFuncSeparate) #define glStencilMaskSeparate GLEW_GET_FUN(__glewStencilMaskSeparate) #define glStencilOpSeparate GLEW_GET_FUN(__glewStencilOpSeparate) #define glUniform1f GLEW_GET_FUN(__glewUniform1f) #define glUniform1fv GLEW_GET_FUN(__glewUniform1fv) #define glUniform1i GLEW_GET_FUN(__glewUniform1i) #define glUniform1iv GLEW_GET_FUN(__glewUniform1iv) #define glUniform2f GLEW_GET_FUN(__glewUniform2f) #define glUniform2fv GLEW_GET_FUN(__glewUniform2fv) #define glUniform2i GLEW_GET_FUN(__glewUniform2i) #define glUniform2iv GLEW_GET_FUN(__glewUniform2iv) #define glUniform3f GLEW_GET_FUN(__glewUniform3f) #define glUniform3fv GLEW_GET_FUN(__glewUniform3fv) #define glUniform3i GLEW_GET_FUN(__glewUniform3i) #define glUniform3iv GLEW_GET_FUN(__glewUniform3iv) #define glUniform4f GLEW_GET_FUN(__glewUniform4f) #define glUniform4fv GLEW_GET_FUN(__glewUniform4fv) #define glUniform4i GLEW_GET_FUN(__glewUniform4i) #define glUniform4iv GLEW_GET_FUN(__glewUniform4iv) #define glUniformMatrix2fv GLEW_GET_FUN(__glewUniformMatrix2fv) #define glUniformMatrix3fv GLEW_GET_FUN(__glewUniformMatrix3fv) #define glUniformMatrix4fv GLEW_GET_FUN(__glewUniformMatrix4fv) #define glUseProgram GLEW_GET_FUN(__glewUseProgram) #define glValidateProgram GLEW_GET_FUN(__glewValidateProgram) #define glVertexAttrib1d GLEW_GET_FUN(__glewVertexAttrib1d) #define glVertexAttrib1dv GLEW_GET_FUN(__glewVertexAttrib1dv) #define glVertexAttrib1f GLEW_GET_FUN(__glewVertexAttrib1f) #define glVertexAttrib1fv GLEW_GET_FUN(__glewVertexAttrib1fv) #define glVertexAttrib1s GLEW_GET_FUN(__glewVertexAttrib1s) #define glVertexAttrib1sv GLEW_GET_FUN(__glewVertexAttrib1sv) #define glVertexAttrib2d GLEW_GET_FUN(__glewVertexAttrib2d) #define glVertexAttrib2dv GLEW_GET_FUN(__glewVertexAttrib2dv) #define glVertexAttrib2f GLEW_GET_FUN(__glewVertexAttrib2f) #define glVertexAttrib2fv GLEW_GET_FUN(__glewVertexAttrib2fv) #define glVertexAttrib2s GLEW_GET_FUN(__glewVertexAttrib2s) #define glVertexAttrib2sv GLEW_GET_FUN(__glewVertexAttrib2sv) #define glVertexAttrib3d GLEW_GET_FUN(__glewVertexAttrib3d) #define glVertexAttrib3dv GLEW_GET_FUN(__glewVertexAttrib3dv) #define glVertexAttrib3f GLEW_GET_FUN(__glewVertexAttrib3f) #define glVertexAttrib3fv GLEW_GET_FUN(__glewVertexAttrib3fv) #define glVertexAttrib3s GLEW_GET_FUN(__glewVertexAttrib3s) #define glVertexAttrib3sv GLEW_GET_FUN(__glewVertexAttrib3sv) #define glVertexAttrib4Nbv GLEW_GET_FUN(__glewVertexAttrib4Nbv) #define glVertexAttrib4Niv GLEW_GET_FUN(__glewVertexAttrib4Niv) #define glVertexAttrib4Nsv GLEW_GET_FUN(__glewVertexAttrib4Nsv) #define glVertexAttrib4Nub GLEW_GET_FUN(__glewVertexAttrib4Nub) #define glVertexAttrib4Nubv GLEW_GET_FUN(__glewVertexAttrib4Nubv) #define glVertexAttrib4Nuiv GLEW_GET_FUN(__glewVertexAttrib4Nuiv) #define glVertexAttrib4Nusv GLEW_GET_FUN(__glewVertexAttrib4Nusv) #define glVertexAttrib4bv GLEW_GET_FUN(__glewVertexAttrib4bv) #define glVertexAttrib4d GLEW_GET_FUN(__glewVertexAttrib4d) #define glVertexAttrib4dv GLEW_GET_FUN(__glewVertexAttrib4dv) #define glVertexAttrib4f GLEW_GET_FUN(__glewVertexAttrib4f) #define glVertexAttrib4fv GLEW_GET_FUN(__glewVertexAttrib4fv) #define glVertexAttrib4iv GLEW_GET_FUN(__glewVertexAttrib4iv) #define glVertexAttrib4s GLEW_GET_FUN(__glewVertexAttrib4s) #define glVertexAttrib4sv GLEW_GET_FUN(__glewVertexAttrib4sv) #define glVertexAttrib4ubv GLEW_GET_FUN(__glewVertexAttrib4ubv) #define glVertexAttrib4uiv GLEW_GET_FUN(__glewVertexAttrib4uiv) #define glVertexAttrib4usv GLEW_GET_FUN(__glewVertexAttrib4usv) #define glVertexAttribPointer GLEW_GET_FUN(__glewVertexAttribPointer) #define GLEW_VERSION_2_0 GLEW_GET_VAR(__GLEW_VERSION_2_0) #endif /* GL_VERSION_2_0 */ /* ----------------------------- GL_VERSION_2_1 ---------------------------- */ #ifndef GL_VERSION_2_1 #define GL_VERSION_2_1 1 #define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F #define GL_PIXEL_PACK_BUFFER 0x88EB #define GL_PIXEL_UNPACK_BUFFER 0x88EC #define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED #define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF #define GL_FLOAT_MAT2x3 0x8B65 #define GL_FLOAT_MAT2x4 0x8B66 #define GL_FLOAT_MAT3x2 0x8B67 #define GL_FLOAT_MAT3x4 0x8B68 #define GL_FLOAT_MAT4x2 0x8B69 #define GL_FLOAT_MAT4x3 0x8B6A #define GL_SRGB 0x8C40 #define GL_SRGB8 0x8C41 #define GL_SRGB_ALPHA 0x8C42 #define GL_SRGB8_ALPHA8 0x8C43 #define GL_SLUMINANCE_ALPHA 0x8C44 #define GL_SLUMINANCE8_ALPHA8 0x8C45 #define GL_SLUMINANCE 0x8C46 #define GL_SLUMINANCE8 0x8C47 #define GL_COMPRESSED_SRGB 0x8C48 #define GL_COMPRESSED_SRGB_ALPHA 0x8C49 #define GL_COMPRESSED_SLUMINANCE 0x8C4A #define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); #define glUniformMatrix2x3fv GLEW_GET_FUN(__glewUniformMatrix2x3fv) #define glUniformMatrix2x4fv GLEW_GET_FUN(__glewUniformMatrix2x4fv) #define glUniformMatrix3x2fv GLEW_GET_FUN(__glewUniformMatrix3x2fv) #define glUniformMatrix3x4fv GLEW_GET_FUN(__glewUniformMatrix3x4fv) #define glUniformMatrix4x2fv GLEW_GET_FUN(__glewUniformMatrix4x2fv) #define glUniformMatrix4x3fv GLEW_GET_FUN(__glewUniformMatrix4x3fv) #define GLEW_VERSION_2_1 GLEW_GET_VAR(__GLEW_VERSION_2_1) #endif /* GL_VERSION_2_1 */ /* ----------------------------- GL_VERSION_3_0 ---------------------------- */ #ifndef GL_VERSION_3_0 #define GL_VERSION_3_0 1 #define GL_MAX_CLIP_DISTANCES GL_MAX_CLIP_PLANES #define GL_CLIP_DISTANCE5 GL_CLIP_PLANE5 #define GL_CLIP_DISTANCE1 GL_CLIP_PLANE1 #define GL_CLIP_DISTANCE3 GL_CLIP_PLANE3 #define GL_COMPARE_REF_TO_TEXTURE GL_COMPARE_R_TO_TEXTURE_ARB #define GL_CLIP_DISTANCE0 GL_CLIP_PLANE0 #define GL_CLIP_DISTANCE4 GL_CLIP_PLANE4 #define GL_CLIP_DISTANCE2 GL_CLIP_PLANE2 #define GL_MAX_VARYING_COMPONENTS GL_MAX_VARYING_FLOATS #define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001 #define GL_MAJOR_VERSION 0x821B #define GL_MINOR_VERSION 0x821C #define GL_NUM_EXTENSIONS 0x821D #define GL_CONTEXT_FLAGS 0x821E #define GL_DEPTH_BUFFER 0x8223 #define GL_STENCIL_BUFFER 0x8224 #define GL_COMPRESSED_RED 0x8225 #define GL_COMPRESSED_RG 0x8226 #define GL_RGBA32F 0x8814 #define GL_RGB32F 0x8815 #define GL_RGBA16F 0x881A #define GL_RGB16F 0x881B #define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD #define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF #define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 #define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 #define GL_CLAMP_VERTEX_COLOR 0x891A #define GL_CLAMP_FRAGMENT_COLOR 0x891B #define GL_CLAMP_READ_COLOR 0x891C #define GL_FIXED_ONLY 0x891D #define GL_TEXTURE_RED_TYPE 0x8C10 #define GL_TEXTURE_GREEN_TYPE 0x8C11 #define GL_TEXTURE_BLUE_TYPE 0x8C12 #define GL_TEXTURE_ALPHA_TYPE 0x8C13 #define GL_TEXTURE_LUMINANCE_TYPE 0x8C14 #define GL_TEXTURE_INTENSITY_TYPE 0x8C15 #define GL_TEXTURE_DEPTH_TYPE 0x8C16 #define GL_TEXTURE_1D_ARRAY 0x8C18 #define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19 #define GL_TEXTURE_2D_ARRAY 0x8C1A #define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B #define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C #define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D #define GL_R11F_G11F_B10F 0x8C3A #define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B #define GL_RGB9_E5 0x8C3D #define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E #define GL_TEXTURE_SHARED_SIZE 0x8C3F #define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 #define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F #define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 #define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 #define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 #define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 #define GL_PRIMITIVES_GENERATED 0x8C87 #define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 #define GL_RASTERIZER_DISCARD 0x8C89 #define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A #define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B #define GL_INTERLEAVED_ATTRIBS 0x8C8C #define GL_SEPARATE_ATTRIBS 0x8C8D #define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E #define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F #define GL_RGBA32UI 0x8D70 #define GL_RGB32UI 0x8D71 #define GL_RGBA16UI 0x8D76 #define GL_RGB16UI 0x8D77 #define GL_RGBA8UI 0x8D7C #define GL_RGB8UI 0x8D7D #define GL_RGBA32I 0x8D82 #define GL_RGB32I 0x8D83 #define GL_RGBA16I 0x8D88 #define GL_RGB16I 0x8D89 #define GL_RGBA8I 0x8D8E #define GL_RGB8I 0x8D8F #define GL_RED_INTEGER 0x8D94 #define GL_GREEN_INTEGER 0x8D95 #define GL_BLUE_INTEGER 0x8D96 #define GL_ALPHA_INTEGER 0x8D97 #define GL_RGB_INTEGER 0x8D98 #define GL_RGBA_INTEGER 0x8D99 #define GL_BGR_INTEGER 0x8D9A #define GL_BGRA_INTEGER 0x8D9B #define GL_SAMPLER_1D_ARRAY 0x8DC0 #define GL_SAMPLER_2D_ARRAY 0x8DC1 #define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3 #define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 #define GL_SAMPLER_CUBE_SHADOW 0x8DC5 #define GL_UNSIGNED_INT_VEC2 0x8DC6 #define GL_UNSIGNED_INT_VEC3 0x8DC7 #define GL_UNSIGNED_INT_VEC4 0x8DC8 #define GL_INT_SAMPLER_1D 0x8DC9 #define GL_INT_SAMPLER_2D 0x8DCA #define GL_INT_SAMPLER_3D 0x8DCB #define GL_INT_SAMPLER_CUBE 0x8DCC #define GL_INT_SAMPLER_1D_ARRAY 0x8DCE #define GL_INT_SAMPLER_2D_ARRAY 0x8DCF #define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1 #define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 #define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 #define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 #define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6 #define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 #define GL_QUERY_WAIT 0x8E13 #define GL_QUERY_NO_WAIT 0x8E14 #define GL_QUERY_BY_REGION_WAIT 0x8E15 #define GL_QUERY_BY_REGION_NO_WAIT 0x8E16 typedef void (GLAPIENTRY * PFNGLBEGINCONDITIONALRENDERPROC) (GLuint, GLenum); typedef void (GLAPIENTRY * PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum); typedef void (GLAPIENTRY * PFNGLBINDFRAGDATALOCATIONPROC) (GLuint, GLuint, const GLchar*); typedef void (GLAPIENTRY * PFNGLCLAMPCOLORPROC) (GLenum, GLenum); typedef void (GLAPIENTRY * PFNGLCLEARBUFFERFIPROC) (GLenum, GLint, GLfloat, GLint); typedef void (GLAPIENTRY * PFNGLCLEARBUFFERFVPROC) (GLenum, GLint, const GLfloat*); typedef void (GLAPIENTRY * PFNGLCLEARBUFFERIVPROC) (GLenum, GLint, const GLint*); typedef void (GLAPIENTRY * PFNGLCLEARBUFFERUIVPROC) (GLenum, GLint, const GLuint*); typedef void (GLAPIENTRY * PFNGLCOLORMASKIPROC) (GLuint, GLboolean, GLboolean, GLboolean, GLboolean); typedef void (GLAPIENTRY * PFNGLDISABLEIPROC) (GLenum, GLuint); typedef void (GLAPIENTRY * PFNGLENABLEIPROC) (GLenum, GLuint); typedef void (GLAPIENTRY * PFNGLENDCONDITIONALRENDERPROC) (void); typedef void (GLAPIENTRY * PFNGLENDTRANSFORMFEEDBACKPROC) (void); typedef void (GLAPIENTRY * PFNGLGETBOOLEANI_VPROC) (GLenum, GLuint, GLboolean*); typedef GLint (GLAPIENTRY * PFNGLGETFRAGDATALOCATIONPROC) (GLuint, const GLchar*); typedef const GLubyte* (GLAPIENTRY * PFNGLGETSTRINGIPROC) (GLenum, GLuint); typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIIVPROC) (GLenum, GLenum, GLint*); typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIUIVPROC) (GLenum, GLenum, GLuint*); typedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *); typedef void (GLAPIENTRY * PFNGLGETUNIFORMUIVPROC) (GLuint, GLint, GLuint*); typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIIVPROC) (GLuint, GLenum, GLint*); typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint, GLenum, GLuint*); typedef GLboolean (GLAPIENTRY * PFNGLISENABLEDIPROC) (GLenum, GLuint); typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIIVPROC) (GLenum, GLenum, const GLint*); typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIUIVPROC) (GLenum, GLenum, const GLuint*); typedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint, GLsizei, const GLchar **, GLenum); typedef void (GLAPIENTRY * PFNGLUNIFORM1UIPROC) (GLint, GLuint); typedef void (GLAPIENTRY * PFNGLUNIFORM1UIVPROC) (GLint, GLsizei, const GLuint*); typedef void (GLAPIENTRY * PFNGLUNIFORM2UIPROC) (GLint, GLuint, GLuint); typedef void (GLAPIENTRY * PFNGLUNIFORM2UIVPROC) (GLint, GLsizei, const GLuint*); typedef void (GLAPIENTRY * PFNGLUNIFORM3UIPROC) (GLint, GLuint, GLuint, GLuint); typedef void (GLAPIENTRY * PFNGLUNIFORM3UIVPROC) (GLint, GLsizei, const GLuint*); typedef void (GLAPIENTRY * PFNGLUNIFORM4UIPROC) (GLint, GLuint, GLuint, GLuint, GLuint); typedef void (GLAPIENTRY * PFNGLUNIFORM4UIVPROC) (GLint, GLsizei, const GLuint*); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1IPROC) (GLuint, GLint); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1IVPROC) (GLuint, const GLint*); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1UIPROC) (GLuint, GLuint); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1UIVPROC) (GLuint, const GLuint*); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2IPROC) (GLuint, GLint, GLint); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2IVPROC) (GLuint, const GLint*); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2UIPROC) (GLuint, GLuint, GLuint); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2UIVPROC) (GLuint, const GLuint*); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3IPROC) (GLuint, GLint, GLint, GLint); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3IVPROC) (GLuint, const GLint*); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3UIPROC) (GLuint, GLuint, GLuint, GLuint); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3UIVPROC) (GLuint, const GLuint*); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4BVPROC) (GLuint, const GLbyte*); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IPROC) (GLuint, GLint, GLint, GLint, GLint); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IVPROC) (GLuint, const GLint*); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4SVPROC) (GLuint, const GLshort*); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UBVPROC) (GLuint, const GLubyte*); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIPROC) (GLuint, GLuint, GLuint, GLuint, GLuint); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIVPROC) (GLuint, const GLuint*); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4USVPROC) (GLuint, const GLushort*); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint, GLint, GLenum, GLsizei, const GLvoid*); #define glBeginConditionalRender GLEW_GET_FUN(__glewBeginConditionalRender) #define glBeginTransformFeedback GLEW_GET_FUN(__glewBeginTransformFeedback) #define glBindFragDataLocation GLEW_GET_FUN(__glewBindFragDataLocation) #define glClampColor GLEW_GET_FUN(__glewClampColor) #define glClearBufferfi GLEW_GET_FUN(__glewClearBufferfi) #define glClearBufferfv GLEW_GET_FUN(__glewClearBufferfv) #define glClearBufferiv GLEW_GET_FUN(__glewClearBufferiv) #define glClearBufferuiv GLEW_GET_FUN(__glewClearBufferuiv) #define glColorMaski GLEW_GET_FUN(__glewColorMaski) #define glDisablei GLEW_GET_FUN(__glewDisablei) #define glEnablei GLEW_GET_FUN(__glewEnablei) #define glEndConditionalRender GLEW_GET_FUN(__glewEndConditionalRender) #define glEndTransformFeedback GLEW_GET_FUN(__glewEndTransformFeedback) #define glGetBooleani_v GLEW_GET_FUN(__glewGetBooleani_v) #define glGetFragDataLocation GLEW_GET_FUN(__glewGetFragDataLocation) #define glGetStringi GLEW_GET_FUN(__glewGetStringi) #define glGetTexParameterIiv GLEW_GET_FUN(__glewGetTexParameterIiv) #define glGetTexParameterIuiv GLEW_GET_FUN(__glewGetTexParameterIuiv) #define glGetTransformFeedbackVarying GLEW_GET_FUN(__glewGetTransformFeedbackVarying) #define glGetUniformuiv GLEW_GET_FUN(__glewGetUniformuiv) #define glGetVertexAttribIiv GLEW_GET_FUN(__glewGetVertexAttribIiv) #define glGetVertexAttribIuiv GLEW_GET_FUN(__glewGetVertexAttribIuiv) #define glIsEnabledi GLEW_GET_FUN(__glewIsEnabledi) #define glTexParameterIiv GLEW_GET_FUN(__glewTexParameterIiv) #define glTexParameterIuiv GLEW_GET_FUN(__glewTexParameterIuiv) #define glTransformFeedbackVaryings GLEW_GET_FUN(__glewTransformFeedbackVaryings) #define glUniform1ui GLEW_GET_FUN(__glewUniform1ui) #define glUniform1uiv GLEW_GET_FUN(__glewUniform1uiv) #define glUniform2ui GLEW_GET_FUN(__glewUniform2ui) #define glUniform2uiv GLEW_GET_FUN(__glewUniform2uiv) #define glUniform3ui GLEW_GET_FUN(__glewUniform3ui) #define glUniform3uiv GLEW_GET_FUN(__glewUniform3uiv) #define glUniform4ui GLEW_GET_FUN(__glewUniform4ui) #define glUniform4uiv GLEW_GET_FUN(__glewUniform4uiv) #define glVertexAttribI1i GLEW_GET_FUN(__glewVertexAttribI1i) #define glVertexAttribI1iv GLEW_GET_FUN(__glewVertexAttribI1iv) #define glVertexAttribI1ui GLEW_GET_FUN(__glewVertexAttribI1ui) #define glVertexAttribI1uiv GLEW_GET_FUN(__glewVertexAttribI1uiv) #define glVertexAttribI2i GLEW_GET_FUN(__glewVertexAttribI2i) #define glVertexAttribI2iv GLEW_GET_FUN(__glewVertexAttribI2iv) #define glVertexAttribI2ui GLEW_GET_FUN(__glewVertexAttribI2ui) #define glVertexAttribI2uiv GLEW_GET_FUN(__glewVertexAttribI2uiv) #define glVertexAttribI3i GLEW_GET_FUN(__glewVertexAttribI3i) #define glVertexAttribI3iv GLEW_GET_FUN(__glewVertexAttribI3iv) #define glVertexAttribI3ui GLEW_GET_FUN(__glewVertexAttribI3ui) #define glVertexAttribI3uiv GLEW_GET_FUN(__glewVertexAttribI3uiv) #define glVertexAttribI4bv GLEW_GET_FUN(__glewVertexAttribI4bv) #define glVertexAttribI4i GLEW_GET_FUN(__glewVertexAttribI4i) #define glVertexAttribI4iv GLEW_GET_FUN(__glewVertexAttribI4iv) #define glVertexAttribI4sv GLEW_GET_FUN(__glewVertexAttribI4sv) #define glVertexAttribI4ubv GLEW_GET_FUN(__glewVertexAttribI4ubv) #define glVertexAttribI4ui GLEW_GET_FUN(__glewVertexAttribI4ui) #define glVertexAttribI4uiv GLEW_GET_FUN(__glewVertexAttribI4uiv) #define glVertexAttribI4usv GLEW_GET_FUN(__glewVertexAttribI4usv) #define glVertexAttribIPointer GLEW_GET_FUN(__glewVertexAttribIPointer) #define GLEW_VERSION_3_0 GLEW_GET_VAR(__GLEW_VERSION_3_0) #endif /* GL_VERSION_3_0 */ /* ----------------------------- GL_VERSION_3_1 ---------------------------- */ #ifndef GL_VERSION_3_1 #define GL_VERSION_3_1 1 #define GL_TEXTURE_RECTANGLE 0x84F5 #define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 #define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 #define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 #define GL_SAMPLER_2D_RECT 0x8B63 #define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 #define GL_TEXTURE_BUFFER 0x8C2A #define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B #define GL_TEXTURE_BINDING_BUFFER 0x8C2C #define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D #define GL_TEXTURE_BUFFER_FORMAT 0x8C2E #define GL_SAMPLER_BUFFER 0x8DC2 #define GL_INT_SAMPLER_2D_RECT 0x8DCD #define GL_INT_SAMPLER_BUFFER 0x8DD0 #define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 #define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 #define GL_RED_SNORM 0x8F90 #define GL_RG_SNORM 0x8F91 #define GL_RGB_SNORM 0x8F92 #define GL_RGBA_SNORM 0x8F93 #define GL_R8_SNORM 0x8F94 #define GL_RG8_SNORM 0x8F95 #define GL_RGB8_SNORM 0x8F96 #define GL_RGBA8_SNORM 0x8F97 #define GL_R16_SNORM 0x8F98 #define GL_RG16_SNORM 0x8F99 #define GL_RGB16_SNORM 0x8F9A #define GL_RGBA16_SNORM 0x8F9B #define GL_SIGNED_NORMALIZED 0x8F9C #define GL_PRIMITIVE_RESTART 0x8F9D #define GL_PRIMITIVE_RESTART_INDEX 0x8F9E #define GL_BUFFER_ACCESS_FLAGS 0x911F #define GL_BUFFER_MAP_LENGTH 0x9120 #define GL_BUFFER_MAP_OFFSET 0x9121 typedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum, GLint, GLsizei, GLsizei); typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum, GLsizei, GLenum, const GLvoid*, GLsizei); typedef void (GLAPIENTRY * PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint); typedef void (GLAPIENTRY * PFNGLTEXBUFFERPROC) (GLenum, GLenum, GLuint); #define glDrawArraysInstanced GLEW_GET_FUN(__glewDrawArraysInstanced) #define glDrawElementsInstanced GLEW_GET_FUN(__glewDrawElementsInstanced) #define glPrimitiveRestartIndex GLEW_GET_FUN(__glewPrimitiveRestartIndex) #define glTexBuffer GLEW_GET_FUN(__glewTexBuffer) #define GLEW_VERSION_3_1 GLEW_GET_VAR(__GLEW_VERSION_3_1) #endif /* GL_VERSION_3_1 */ /* ----------------------------- GL_VERSION_3_2 ---------------------------- */ #ifndef GL_VERSION_3_2 #define GL_VERSION_3_2 1 #define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 #define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 #define GL_LINES_ADJACENCY 0x000A #define GL_LINE_STRIP_ADJACENCY 0x000B #define GL_TRIANGLES_ADJACENCY 0x000C #define GL_TRIANGLE_STRIP_ADJACENCY 0x000D #define GL_PROGRAM_POINT_SIZE 0x8642 #define GL_GEOMETRY_VERTICES_OUT 0x8916 #define GL_GEOMETRY_INPUT_TYPE 0x8917 #define GL_GEOMETRY_OUTPUT_TYPE 0x8918 #define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 #define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7 #define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8 #define GL_GEOMETRY_SHADER 0x8DD9 #define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF #define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0 #define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1 #define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 #define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123 #define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124 #define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 #define GL_CONTEXT_PROFILE_MASK 0x9126 typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum, GLenum, GLuint, GLint); typedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum, GLenum, GLint64 *); typedef void (GLAPIENTRY * PFNGLGETINTEGER64I_VPROC) (GLenum, GLuint, GLint64 *); #define glFramebufferTexture GLEW_GET_FUN(__glewFramebufferTexture) #define glGetBufferParameteri64v GLEW_GET_FUN(__glewGetBufferParameteri64v) #define glGetInteger64i_v GLEW_GET_FUN(__glewGetInteger64i_v) #define GLEW_VERSION_3_2 GLEW_GET_VAR(__GLEW_VERSION_3_2) #endif /* GL_VERSION_3_2 */ /* ----------------------------- GL_VERSION_3_3 ---------------------------- */ #ifndef GL_VERSION_3_3 #define GL_VERSION_3_3 1 #define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE #define GL_TEXTURE_SWIZZLE_R 0x8E42 #define GL_TEXTURE_SWIZZLE_G 0x8E43 #define GL_TEXTURE_SWIZZLE_B 0x8E44 #define GL_TEXTURE_SWIZZLE_A 0x8E45 #define GL_TEXTURE_SWIZZLE_RGBA 0x8E46 #define GL_RGB10_A2UI 0x906F typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor); #define glVertexAttribDivisor GLEW_GET_FUN(__glewVertexAttribDivisor) #define GLEW_VERSION_3_3 GLEW_GET_VAR(__GLEW_VERSION_3_3) #endif /* GL_VERSION_3_3 */ /* ----------------------------- GL_VERSION_4_0 ---------------------------- */ #ifndef GL_VERSION_4_0 #define GL_VERSION_4_0 1 #define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F #define GL_SAMPLE_SHADING 0x8C36 #define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37 #define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A #define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B #define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C #define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D #define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E #define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F #define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS 0x8F9F #define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 #define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A #define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B #define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C #define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D #define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E #define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode); typedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); typedef void (GLAPIENTRY * PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst); typedef void (GLAPIENTRY * PFNGLMINSAMPLESHADINGPROC) (GLclampf value); #define glBlendEquationSeparatei GLEW_GET_FUN(__glewBlendEquationSeparatei) #define glBlendEquationi GLEW_GET_FUN(__glewBlendEquationi) #define glBlendFuncSeparatei GLEW_GET_FUN(__glewBlendFuncSeparatei) #define glBlendFunci GLEW_GET_FUN(__glewBlendFunci) #define glMinSampleShading GLEW_GET_FUN(__glewMinSampleShading) #define GLEW_VERSION_4_0 GLEW_GET_VAR(__GLEW_VERSION_4_0) #endif /* GL_VERSION_4_0 */ /* ----------------------------- GL_VERSION_4_1 ---------------------------- */ #ifndef GL_VERSION_4_1 #define GL_VERSION_4_1 1 #define GLEW_VERSION_4_1 GLEW_GET_VAR(__GLEW_VERSION_4_1) #endif /* GL_VERSION_4_1 */ /* ----------------------------- GL_VERSION_4_2 ---------------------------- */ #ifndef GL_VERSION_4_2 #define GL_VERSION_4_2 1 #define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C #define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D #define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E #define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F #define GLEW_VERSION_4_2 GLEW_GET_VAR(__GLEW_VERSION_4_2) #endif /* GL_VERSION_4_2 */ /* ----------------------------- GL_VERSION_4_3 ---------------------------- */ #ifndef GL_VERSION_4_3 #define GL_VERSION_4_3 1 #define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9 #define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E #define GLEW_VERSION_4_3 GLEW_GET_VAR(__GLEW_VERSION_4_3) #endif /* GL_VERSION_4_3 */ /* -------------------------- GL_3DFX_multisample -------------------------- */ #ifndef GL_3DFX_multisample #define GL_3DFX_multisample 1 #define GL_MULTISAMPLE_3DFX 0x86B2 #define GL_SAMPLE_BUFFERS_3DFX 0x86B3 #define GL_SAMPLES_3DFX 0x86B4 #define GL_MULTISAMPLE_BIT_3DFX 0x20000000 #define GLEW_3DFX_multisample GLEW_GET_VAR(__GLEW_3DFX_multisample) #endif /* GL_3DFX_multisample */ /* ---------------------------- GL_3DFX_tbuffer ---------------------------- */ #ifndef GL_3DFX_tbuffer #define GL_3DFX_tbuffer 1 typedef void (GLAPIENTRY * PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); #define glTbufferMask3DFX GLEW_GET_FUN(__glewTbufferMask3DFX) #define GLEW_3DFX_tbuffer GLEW_GET_VAR(__GLEW_3DFX_tbuffer) #endif /* GL_3DFX_tbuffer */ /* -------------------- GL_3DFX_texture_compression_FXT1 ------------------- */ #ifndef GL_3DFX_texture_compression_FXT1 #define GL_3DFX_texture_compression_FXT1 1 #define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 #define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 #define GLEW_3DFX_texture_compression_FXT1 GLEW_GET_VAR(__GLEW_3DFX_texture_compression_FXT1) #endif /* GL_3DFX_texture_compression_FXT1 */ /* ----------------------- GL_AMD_blend_minmax_factor ---------------------- */ #ifndef GL_AMD_blend_minmax_factor #define GL_AMD_blend_minmax_factor 1 #define GL_FACTOR_MIN_AMD 0x901C #define GL_FACTOR_MAX_AMD 0x901D #define GLEW_AMD_blend_minmax_factor GLEW_GET_VAR(__GLEW_AMD_blend_minmax_factor) #endif /* GL_AMD_blend_minmax_factor */ /* ----------------------- GL_AMD_conservative_depth ----------------------- */ #ifndef GL_AMD_conservative_depth #define GL_AMD_conservative_depth 1 #define GLEW_AMD_conservative_depth GLEW_GET_VAR(__GLEW_AMD_conservative_depth) #endif /* GL_AMD_conservative_depth */ /* -------------------------- GL_AMD_debug_output -------------------------- */ #ifndef GL_AMD_debug_output #define GL_AMD_debug_output 1 #define GL_MAX_DEBUG_MESSAGE_LENGTH_AMD 0x9143 #define GL_MAX_DEBUG_LOGGED_MESSAGES_AMD 0x9144 #define GL_DEBUG_LOGGED_MESSAGES_AMD 0x9145 #define GL_DEBUG_SEVERITY_HIGH_AMD 0x9146 #define GL_DEBUG_SEVERITY_MEDIUM_AMD 0x9147 #define GL_DEBUG_SEVERITY_LOW_AMD 0x9148 #define GL_DEBUG_CATEGORY_API_ERROR_AMD 0x9149 #define GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD 0x914A #define GL_DEBUG_CATEGORY_DEPRECATION_AMD 0x914B #define GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD 0x914C #define GL_DEBUG_CATEGORY_PERFORMANCE_AMD 0x914D #define GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD 0x914E #define GL_DEBUG_CATEGORY_APPLICATION_AMD 0x914F #define GL_DEBUG_CATEGORY_OTHER_AMD 0x9150 typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam); typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECALLBACKAMDPROC) (GLDEBUGPROCAMD callback, void* userParam); typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGEENABLEAMDPROC) (GLenum category, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled); typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGEINSERTAMDPROC) (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar* buf); typedef GLuint (GLAPIENTRY * PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufsize, GLenum* categories, GLuint* severities, GLuint* ids, GLsizei* lengths, GLchar* message); #define glDebugMessageCallbackAMD GLEW_GET_FUN(__glewDebugMessageCallbackAMD) #define glDebugMessageEnableAMD GLEW_GET_FUN(__glewDebugMessageEnableAMD) #define glDebugMessageInsertAMD GLEW_GET_FUN(__glewDebugMessageInsertAMD) #define glGetDebugMessageLogAMD GLEW_GET_FUN(__glewGetDebugMessageLogAMD) #define GLEW_AMD_debug_output GLEW_GET_VAR(__GLEW_AMD_debug_output) #endif /* GL_AMD_debug_output */ /* ---------------------- GL_AMD_depth_clamp_separate ---------------------- */ #ifndef GL_AMD_depth_clamp_separate #define GL_AMD_depth_clamp_separate 1 #define GL_DEPTH_CLAMP_NEAR_AMD 0x901E #define GL_DEPTH_CLAMP_FAR_AMD 0x901F #define GLEW_AMD_depth_clamp_separate GLEW_GET_VAR(__GLEW_AMD_depth_clamp_separate) #endif /* GL_AMD_depth_clamp_separate */ /* ----------------------- GL_AMD_draw_buffers_blend ----------------------- */ #ifndef GL_AMD_draw_buffers_blend #define GL_AMD_draw_buffers_blend 1 typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONINDEXEDAMDPROC) (GLuint buf, GLenum mode); typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); typedef void (GLAPIENTRY * PFNGLBLENDFUNCINDEXEDAMDPROC) (GLuint buf, GLenum src, GLenum dst); typedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); #define glBlendEquationIndexedAMD GLEW_GET_FUN(__glewBlendEquationIndexedAMD) #define glBlendEquationSeparateIndexedAMD GLEW_GET_FUN(__glewBlendEquationSeparateIndexedAMD) #define glBlendFuncIndexedAMD GLEW_GET_FUN(__glewBlendFuncIndexedAMD) #define glBlendFuncSeparateIndexedAMD GLEW_GET_FUN(__glewBlendFuncSeparateIndexedAMD) #define GLEW_AMD_draw_buffers_blend GLEW_GET_VAR(__GLEW_AMD_draw_buffers_blend) #endif /* GL_AMD_draw_buffers_blend */ /* ----------------------- GL_AMD_multi_draw_indirect ---------------------- */ #ifndef GL_AMD_multi_draw_indirect #define GL_AMD_multi_draw_indirect 1 typedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC) (GLenum mode, const void* indirect, GLsizei primcount, GLsizei stride); typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC) (GLenum mode, GLenum type, const void* indirect, GLsizei primcount, GLsizei stride); #define glMultiDrawArraysIndirectAMD GLEW_GET_FUN(__glewMultiDrawArraysIndirectAMD) #define glMultiDrawElementsIndirectAMD GLEW_GET_FUN(__glewMultiDrawElementsIndirectAMD) #define GLEW_AMD_multi_draw_indirect GLEW_GET_VAR(__GLEW_AMD_multi_draw_indirect) #endif /* GL_AMD_multi_draw_indirect */ /* ------------------------- GL_AMD_name_gen_delete ------------------------ */ #ifndef GL_AMD_name_gen_delete #define GL_AMD_name_gen_delete 1 #define GL_DATA_BUFFER_AMD 0x9151 #define GL_PERFORMANCE_MONITOR_AMD 0x9152 #define GL_QUERY_OBJECT_AMD 0x9153 #define GL_VERTEX_ARRAY_OBJECT_AMD 0x9154 #define GL_SAMPLER_OBJECT_AMD 0x9155 typedef void (GLAPIENTRY * PFNGLDELETENAMESAMDPROC) (GLenum identifier, GLuint num, const GLuint* names); typedef void (GLAPIENTRY * PFNGLGENNAMESAMDPROC) (GLenum identifier, GLuint num, GLuint* names); typedef GLboolean (GLAPIENTRY * PFNGLISNAMEAMDPROC) (GLenum identifier, GLuint name); #define glDeleteNamesAMD GLEW_GET_FUN(__glewDeleteNamesAMD) #define glGenNamesAMD GLEW_GET_FUN(__glewGenNamesAMD) #define glIsNameAMD GLEW_GET_FUN(__glewIsNameAMD) #define GLEW_AMD_name_gen_delete GLEW_GET_VAR(__GLEW_AMD_name_gen_delete) #endif /* GL_AMD_name_gen_delete */ /* ----------------------- GL_AMD_performance_monitor ---------------------- */ #ifndef GL_AMD_performance_monitor #define GL_AMD_performance_monitor 1 #define GL_COUNTER_TYPE_AMD 0x8BC0 #define GL_COUNTER_RANGE_AMD 0x8BC1 #define GL_UNSIGNED_INT64_AMD 0x8BC2 #define GL_PERCENTAGE_AMD 0x8BC3 #define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 #define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 #define GL_PERFMON_RESULT_AMD 0x8BC6 typedef void (GLAPIENTRY * PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); typedef void (GLAPIENTRY * PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint* monitors); typedef void (GLAPIENTRY * PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); typedef void (GLAPIENTRY * PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint* monitors); typedef void (GLAPIENTRY * PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint* data, GLint *bytesWritten); typedef void (GLAPIENTRY * PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void* data); typedef void (GLAPIENTRY * PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei* length, GLchar *counterString); typedef void (GLAPIENTRY * PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint* numCounters, GLint *maxActiveCounters, GLsizei countersSize, GLuint *counters); typedef void (GLAPIENTRY * PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei* length, GLchar *groupString); typedef void (GLAPIENTRY * PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint* numGroups, GLsizei groupsSize, GLuint *groups); typedef void (GLAPIENTRY * PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint* counterList); #define glBeginPerfMonitorAMD GLEW_GET_FUN(__glewBeginPerfMonitorAMD) #define glDeletePerfMonitorsAMD GLEW_GET_FUN(__glewDeletePerfMonitorsAMD) #define glEndPerfMonitorAMD GLEW_GET_FUN(__glewEndPerfMonitorAMD) #define glGenPerfMonitorsAMD GLEW_GET_FUN(__glewGenPerfMonitorsAMD) #define glGetPerfMonitorCounterDataAMD GLEW_GET_FUN(__glewGetPerfMonitorCounterDataAMD) #define glGetPerfMonitorCounterInfoAMD GLEW_GET_FUN(__glewGetPerfMonitorCounterInfoAMD) #define glGetPerfMonitorCounterStringAMD GLEW_GET_FUN(__glewGetPerfMonitorCounterStringAMD) #define glGetPerfMonitorCountersAMD GLEW_GET_FUN(__glewGetPerfMonitorCountersAMD) #define glGetPerfMonitorGroupStringAMD GLEW_GET_FUN(__glewGetPerfMonitorGroupStringAMD) #define glGetPerfMonitorGroupsAMD GLEW_GET_FUN(__glewGetPerfMonitorGroupsAMD) #define glSelectPerfMonitorCountersAMD GLEW_GET_FUN(__glewSelectPerfMonitorCountersAMD) #define GLEW_AMD_performance_monitor GLEW_GET_VAR(__GLEW_AMD_performance_monitor) #endif /* GL_AMD_performance_monitor */ /* -------------------------- GL_AMD_pinned_memory ------------------------- */ #ifndef GL_AMD_pinned_memory #define GL_AMD_pinned_memory 1 #define GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD 0x9160 #define GLEW_AMD_pinned_memory GLEW_GET_VAR(__GLEW_AMD_pinned_memory) #endif /* GL_AMD_pinned_memory */ /* ----------------------- GL_AMD_query_buffer_object ---------------------- */ #ifndef GL_AMD_query_buffer_object #define GL_AMD_query_buffer_object 1 #define GL_QUERY_BUFFER_AMD 0x9192 #define GL_QUERY_BUFFER_BINDING_AMD 0x9193 #define GL_QUERY_RESULT_NO_WAIT_AMD 0x9194 #define GLEW_AMD_query_buffer_object GLEW_GET_VAR(__GLEW_AMD_query_buffer_object) #endif /* GL_AMD_query_buffer_object */ /* ------------------------ GL_AMD_sample_positions ------------------------ */ #ifndef GL_AMD_sample_positions #define GL_AMD_sample_positions 1 #define GL_SUBSAMPLE_DISTANCE_AMD 0x883F typedef void (GLAPIENTRY * PFNGLSETMULTISAMPLEFVAMDPROC) (GLenum pname, GLuint index, const GLfloat* val); #define glSetMultisamplefvAMD GLEW_GET_FUN(__glewSetMultisamplefvAMD) #define GLEW_AMD_sample_positions GLEW_GET_VAR(__GLEW_AMD_sample_positions) #endif /* GL_AMD_sample_positions */ /* ------------------ GL_AMD_seamless_cubemap_per_texture ------------------ */ #ifndef GL_AMD_seamless_cubemap_per_texture #define GL_AMD_seamless_cubemap_per_texture 1 #define GL_TEXTURE_CUBE_MAP_SEAMLESS_ARB 0x884F #define GLEW_AMD_seamless_cubemap_per_texture GLEW_GET_VAR(__GLEW_AMD_seamless_cubemap_per_texture) #endif /* GL_AMD_seamless_cubemap_per_texture */ /* ---------------------- GL_AMD_shader_stencil_export --------------------- */ #ifndef GL_AMD_shader_stencil_export #define GL_AMD_shader_stencil_export 1 #define GLEW_AMD_shader_stencil_export GLEW_GET_VAR(__GLEW_AMD_shader_stencil_export) #endif /* GL_AMD_shader_stencil_export */ /* ------------------- GL_AMD_stencil_operation_extended ------------------- */ #ifndef GL_AMD_stencil_operation_extended #define GL_AMD_stencil_operation_extended 1 #define GL_SET_AMD 0x874A #define GL_REPLACE_VALUE_AMD 0x874B #define GL_STENCIL_OP_VALUE_AMD 0x874C #define GL_STENCIL_BACK_OP_VALUE_AMD 0x874D typedef void (GLAPIENTRY * PFNGLSTENCILOPVALUEAMDPROC) (GLenum face, GLuint value); #define glStencilOpValueAMD GLEW_GET_FUN(__glewStencilOpValueAMD) #define GLEW_AMD_stencil_operation_extended GLEW_GET_VAR(__GLEW_AMD_stencil_operation_extended) #endif /* GL_AMD_stencil_operation_extended */ /* ------------------------ GL_AMD_texture_texture4 ------------------------ */ #ifndef GL_AMD_texture_texture4 #define GL_AMD_texture_texture4 1 #define GLEW_AMD_texture_texture4 GLEW_GET_VAR(__GLEW_AMD_texture_texture4) #endif /* GL_AMD_texture_texture4 */ /* --------------- GL_AMD_transform_feedback3_lines_triangles -------------- */ #ifndef GL_AMD_transform_feedback3_lines_triangles #define GL_AMD_transform_feedback3_lines_triangles 1 #define GLEW_AMD_transform_feedback3_lines_triangles GLEW_GET_VAR(__GLEW_AMD_transform_feedback3_lines_triangles) #endif /* GL_AMD_transform_feedback3_lines_triangles */ /* ----------------------- GL_AMD_vertex_shader_layer ---------------------- */ #ifndef GL_AMD_vertex_shader_layer #define GL_AMD_vertex_shader_layer 1 #define GLEW_AMD_vertex_shader_layer GLEW_GET_VAR(__GLEW_AMD_vertex_shader_layer) #endif /* GL_AMD_vertex_shader_layer */ /* -------------------- GL_AMD_vertex_shader_tessellator ------------------- */ #ifndef GL_AMD_vertex_shader_tessellator #define GL_AMD_vertex_shader_tessellator 1 #define GL_SAMPLER_BUFFER_AMD 0x9001 #define GL_INT_SAMPLER_BUFFER_AMD 0x9002 #define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003 #define GL_TESSELLATION_MODE_AMD 0x9004 #define GL_TESSELLATION_FACTOR_AMD 0x9005 #define GL_DISCRETE_AMD 0x9006 #define GL_CONTINUOUS_AMD 0x9007 typedef void (GLAPIENTRY * PFNGLTESSELLATIONFACTORAMDPROC) (GLfloat factor); typedef void (GLAPIENTRY * PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode); #define glTessellationFactorAMD GLEW_GET_FUN(__glewTessellationFactorAMD) #define glTessellationModeAMD GLEW_GET_FUN(__glewTessellationModeAMD) #define GLEW_AMD_vertex_shader_tessellator GLEW_GET_VAR(__GLEW_AMD_vertex_shader_tessellator) #endif /* GL_AMD_vertex_shader_tessellator */ /* ------------------ GL_AMD_vertex_shader_viewport_index ------------------ */ #ifndef GL_AMD_vertex_shader_viewport_index #define GL_AMD_vertex_shader_viewport_index 1 #define GLEW_AMD_vertex_shader_viewport_index GLEW_GET_VAR(__GLEW_AMD_vertex_shader_viewport_index) #endif /* GL_AMD_vertex_shader_viewport_index */ /* ----------------------- GL_APPLE_aux_depth_stencil ---------------------- */ #ifndef GL_APPLE_aux_depth_stencil #define GL_APPLE_aux_depth_stencil 1 #define GL_AUX_DEPTH_STENCIL_APPLE 0x8A14 #define GLEW_APPLE_aux_depth_stencil GLEW_GET_VAR(__GLEW_APPLE_aux_depth_stencil) #endif /* GL_APPLE_aux_depth_stencil */ /* ------------------------ GL_APPLE_client_storage ------------------------ */ #ifndef GL_APPLE_client_storage #define GL_APPLE_client_storage 1 #define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 #define GLEW_APPLE_client_storage GLEW_GET_VAR(__GLEW_APPLE_client_storage) #endif /* GL_APPLE_client_storage */ /* ------------------------- GL_APPLE_element_array ------------------------ */ #ifndef GL_APPLE_element_array #define GL_APPLE_element_array 1 #define GL_ELEMENT_ARRAY_APPLE 0x8A0C #define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8A0D #define GL_ELEMENT_ARRAY_POINTER_APPLE 0x8A0E typedef void (GLAPIENTRY * PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count); typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); typedef void (GLAPIENTRY * PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const void* pointer); typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint* first, const GLsizei *count, GLsizei primcount); typedef void (GLAPIENTRY * PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint* first, const GLsizei *count, GLsizei primcount); #define glDrawElementArrayAPPLE GLEW_GET_FUN(__glewDrawElementArrayAPPLE) #define glDrawRangeElementArrayAPPLE GLEW_GET_FUN(__glewDrawRangeElementArrayAPPLE) #define glElementPointerAPPLE GLEW_GET_FUN(__glewElementPointerAPPLE) #define glMultiDrawElementArrayAPPLE GLEW_GET_FUN(__glewMultiDrawElementArrayAPPLE) #define glMultiDrawRangeElementArrayAPPLE GLEW_GET_FUN(__glewMultiDrawRangeElementArrayAPPLE) #define GLEW_APPLE_element_array GLEW_GET_VAR(__GLEW_APPLE_element_array) #endif /* GL_APPLE_element_array */ /* ----------------------------- GL_APPLE_fence ---------------------------- */ #ifndef GL_APPLE_fence #define GL_APPLE_fence 1 #define GL_DRAW_PIXELS_APPLE 0x8A0A #define GL_FENCE_APPLE 0x8A0B typedef void (GLAPIENTRY * PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint* fences); typedef void (GLAPIENTRY * PFNGLFINISHFENCEAPPLEPROC) (GLuint fence); typedef void (GLAPIENTRY * PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name); typedef void (GLAPIENTRY * PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint* fences); typedef GLboolean (GLAPIENTRY * PFNGLISFENCEAPPLEPROC) (GLuint fence); typedef void (GLAPIENTRY * PFNGLSETFENCEAPPLEPROC) (GLuint fence); typedef GLboolean (GLAPIENTRY * PFNGLTESTFENCEAPPLEPROC) (GLuint fence); typedef GLboolean (GLAPIENTRY * PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name); #define glDeleteFencesAPPLE GLEW_GET_FUN(__glewDeleteFencesAPPLE) #define glFinishFenceAPPLE GLEW_GET_FUN(__glewFinishFenceAPPLE) #define glFinishObjectAPPLE GLEW_GET_FUN(__glewFinishObjectAPPLE) #define glGenFencesAPPLE GLEW_GET_FUN(__glewGenFencesAPPLE) #define glIsFenceAPPLE GLEW_GET_FUN(__glewIsFenceAPPLE) #define glSetFenceAPPLE GLEW_GET_FUN(__glewSetFenceAPPLE) #define glTestFenceAPPLE GLEW_GET_FUN(__glewTestFenceAPPLE) #define glTestObjectAPPLE GLEW_GET_FUN(__glewTestObjectAPPLE) #define GLEW_APPLE_fence GLEW_GET_VAR(__GLEW_APPLE_fence) #endif /* GL_APPLE_fence */ /* ------------------------- GL_APPLE_float_pixels ------------------------- */ #ifndef GL_APPLE_float_pixels #define GL_APPLE_float_pixels 1 #define GL_HALF_APPLE 0x140B #define GL_RGBA_FLOAT32_APPLE 0x8814 #define GL_RGB_FLOAT32_APPLE 0x8815 #define GL_ALPHA_FLOAT32_APPLE 0x8816 #define GL_INTENSITY_FLOAT32_APPLE 0x8817 #define GL_LUMINANCE_FLOAT32_APPLE 0x8818 #define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819 #define GL_RGBA_FLOAT16_APPLE 0x881A #define GL_RGB_FLOAT16_APPLE 0x881B #define GL_ALPHA_FLOAT16_APPLE 0x881C #define GL_INTENSITY_FLOAT16_APPLE 0x881D #define GL_LUMINANCE_FLOAT16_APPLE 0x881E #define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F #define GL_COLOR_FLOAT_APPLE 0x8A0F #define GLEW_APPLE_float_pixels GLEW_GET_VAR(__GLEW_APPLE_float_pixels) #endif /* GL_APPLE_float_pixels */ /* ---------------------- GL_APPLE_flush_buffer_range ---------------------- */ #ifndef GL_APPLE_flush_buffer_range #define GL_APPLE_flush_buffer_range 1 #define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12 #define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13 typedef void (GLAPIENTRY * PFNGLBUFFERPARAMETERIAPPLEPROC) (GLenum target, GLenum pname, GLint param); typedef void (GLAPIENTRY * PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC) (GLenum target, GLintptr offset, GLsizeiptr size); #define glBufferParameteriAPPLE GLEW_GET_FUN(__glewBufferParameteriAPPLE) #define glFlushMappedBufferRangeAPPLE GLEW_GET_FUN(__glewFlushMappedBufferRangeAPPLE) #define GLEW_APPLE_flush_buffer_range GLEW_GET_VAR(__GLEW_APPLE_flush_buffer_range) #endif /* GL_APPLE_flush_buffer_range */ /* ----------------------- GL_APPLE_object_purgeable ----------------------- */ #ifndef GL_APPLE_object_purgeable #define GL_APPLE_object_purgeable 1 #define GL_BUFFER_OBJECT_APPLE 0x85B3 #define GL_RELEASED_APPLE 0x8A19 #define GL_VOLATILE_APPLE 0x8A1A #define GL_RETAINED_APPLE 0x8A1B #define GL_UNDEFINED_APPLE 0x8A1C #define GL_PURGEABLE_APPLE 0x8A1D typedef void (GLAPIENTRY * PFNGLGETOBJECTPARAMETERIVAPPLEPROC) (GLenum objectType, GLuint name, GLenum pname, GLint* params); typedef GLenum (GLAPIENTRY * PFNGLOBJECTPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option); typedef GLenum (GLAPIENTRY * PFNGLOBJECTUNPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option); #define glGetObjectParameterivAPPLE GLEW_GET_FUN(__glewGetObjectParameterivAPPLE) #define glObjectPurgeableAPPLE GLEW_GET_FUN(__glewObjectPurgeableAPPLE) #define glObjectUnpurgeableAPPLE GLEW_GET_FUN(__glewObjectUnpurgeableAPPLE) #define GLEW_APPLE_object_purgeable GLEW_GET_VAR(__GLEW_APPLE_object_purgeable) #endif /* GL_APPLE_object_purgeable */ /* ------------------------- GL_APPLE_pixel_buffer ------------------------- */ #ifndef GL_APPLE_pixel_buffer #define GL_APPLE_pixel_buffer 1 #define GL_MIN_PBUFFER_VIEWPORT_DIMS_APPLE 0x8A10 #define GLEW_APPLE_pixel_buffer GLEW_GET_VAR(__GLEW_APPLE_pixel_buffer) #endif /* GL_APPLE_pixel_buffer */ /* ---------------------------- GL_APPLE_rgb_422 --------------------------- */ #ifndef GL_APPLE_rgb_422 #define GL_APPLE_rgb_422 1 #define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA #define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB #define GL_RGB_422_APPLE 0x8A1F #define GLEW_APPLE_rgb_422 GLEW_GET_VAR(__GLEW_APPLE_rgb_422) #endif /* GL_APPLE_rgb_422 */ /* --------------------------- GL_APPLE_row_bytes -------------------------- */ #ifndef GL_APPLE_row_bytes #define GL_APPLE_row_bytes 1 #define GL_PACK_ROW_BYTES_APPLE 0x8A15 #define GL_UNPACK_ROW_BYTES_APPLE 0x8A16 #define GLEW_APPLE_row_bytes GLEW_GET_VAR(__GLEW_APPLE_row_bytes) #endif /* GL_APPLE_row_bytes */ /* ------------------------ GL_APPLE_specular_vector ----------------------- */ #ifndef GL_APPLE_specular_vector #define GL_APPLE_specular_vector 1 #define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 #define GLEW_APPLE_specular_vector GLEW_GET_VAR(__GLEW_APPLE_specular_vector) #endif /* GL_APPLE_specular_vector */ /* ------------------------- GL_APPLE_texture_range ------------------------ */ #ifndef GL_APPLE_texture_range #define GL_APPLE_texture_range 1 #define GL_TEXTURE_RANGE_LENGTH_APPLE 0x85B7 #define GL_TEXTURE_RANGE_POINTER_APPLE 0x85B8 #define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC #define GL_STORAGE_PRIVATE_APPLE 0x85BD #define GL_STORAGE_CACHED_APPLE 0x85BE #define GL_STORAGE_SHARED_APPLE 0x85BF typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC) (GLenum target, GLenum pname, GLvoid **params); typedef void (GLAPIENTRY * PFNGLTEXTURERANGEAPPLEPROC) (GLenum target, GLsizei length, GLvoid *pointer); #define glGetTexParameterPointervAPPLE GLEW_GET_FUN(__glewGetTexParameterPointervAPPLE) #define glTextureRangeAPPLE GLEW_GET_FUN(__glewTextureRangeAPPLE) #define GLEW_APPLE_texture_range GLEW_GET_VAR(__GLEW_APPLE_texture_range) #endif /* GL_APPLE_texture_range */ /* ------------------------ GL_APPLE_transform_hint ------------------------ */ #ifndef GL_APPLE_transform_hint #define GL_APPLE_transform_hint 1 #define GL_TRANSFORM_HINT_APPLE 0x85B1 #define GLEW_APPLE_transform_hint GLEW_GET_VAR(__GLEW_APPLE_transform_hint) #endif /* GL_APPLE_transform_hint */ /* ---------------------- GL_APPLE_vertex_array_object --------------------- */ #ifndef GL_APPLE_vertex_array_object #define GL_APPLE_vertex_array_object 1 #define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 typedef void (GLAPIENTRY * PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array); typedef void (GLAPIENTRY * PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint* arrays); typedef void (GLAPIENTRY * PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint* arrays); typedef GLboolean (GLAPIENTRY * PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array); #define glBindVertexArrayAPPLE GLEW_GET_FUN(__glewBindVertexArrayAPPLE) #define glDeleteVertexArraysAPPLE GLEW_GET_FUN(__glewDeleteVertexArraysAPPLE) #define glGenVertexArraysAPPLE GLEW_GET_FUN(__glewGenVertexArraysAPPLE) #define glIsVertexArrayAPPLE GLEW_GET_FUN(__glewIsVertexArrayAPPLE) #define GLEW_APPLE_vertex_array_object GLEW_GET_VAR(__GLEW_APPLE_vertex_array_object) #endif /* GL_APPLE_vertex_array_object */ /* ---------------------- GL_APPLE_vertex_array_range ---------------------- */ #ifndef GL_APPLE_vertex_array_range #define GL_APPLE_vertex_array_range 1 #define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D #define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E #define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F #define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_APPLE 0x8520 #define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 #define GL_STORAGE_CLIENT_APPLE 0x85B4 #define GL_STORAGE_CACHED_APPLE 0x85BE #define GL_STORAGE_SHARED_APPLE 0x85BF typedef void (GLAPIENTRY * PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void* pointer); typedef void (GLAPIENTRY * PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param); typedef void (GLAPIENTRY * PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void* pointer); #define glFlushVertexArrayRangeAPPLE GLEW_GET_FUN(__glewFlushVertexArrayRangeAPPLE) #define glVertexArrayParameteriAPPLE GLEW_GET_FUN(__glewVertexArrayParameteriAPPLE) #define glVertexArrayRangeAPPLE GLEW_GET_FUN(__glewVertexArrayRangeAPPLE) #define GLEW_APPLE_vertex_array_range GLEW_GET_VAR(__GLEW_APPLE_vertex_array_range) #endif /* GL_APPLE_vertex_array_range */ /* ------------------- GL_APPLE_vertex_program_evaluators ------------------ */ #ifndef GL_APPLE_vertex_program_evaluators #define GL_APPLE_vertex_program_evaluators 1 #define GL_VERTEX_ATTRIB_MAP1_APPLE 0x8A00 #define GL_VERTEX_ATTRIB_MAP2_APPLE 0x8A01 #define GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE 0x8A02 #define GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE 0x8A03 #define GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE 0x8A04 #define GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE 0x8A05 #define GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE 0x8A06 #define GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE 0x8A07 #define GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE 0x8A08 #define GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE 0x8A09 typedef void (GLAPIENTRY * PFNGLDISABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname); typedef void (GLAPIENTRY * PFNGLENABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname); typedef GLboolean (GLAPIENTRY * PFNGLISVERTEXATTRIBENABLEDAPPLEPROC) (GLuint index, GLenum pname); typedef void (GLAPIENTRY * PFNGLMAPVERTEXATTRIB1DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble* points); typedef void (GLAPIENTRY * PFNGLMAPVERTEXATTRIB1FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat* points); typedef void (GLAPIENTRY * PFNGLMAPVERTEXATTRIB2DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble* points); typedef void (GLAPIENTRY * PFNGLMAPVERTEXATTRIB2FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat* points); #define glDisableVertexAttribAPPLE GLEW_GET_FUN(__glewDisableVertexAttribAPPLE) #define glEnableVertexAttribAPPLE GLEW_GET_FUN(__glewEnableVertexAttribAPPLE) #define glIsVertexAttribEnabledAPPLE GLEW_GET_FUN(__glewIsVertexAttribEnabledAPPLE) #define glMapVertexAttrib1dAPPLE GLEW_GET_FUN(__glewMapVertexAttrib1dAPPLE) #define glMapVertexAttrib1fAPPLE GLEW_GET_FUN(__glewMapVertexAttrib1fAPPLE) #define glMapVertexAttrib2dAPPLE GLEW_GET_FUN(__glewMapVertexAttrib2dAPPLE) #define glMapVertexAttrib2fAPPLE GLEW_GET_FUN(__glewMapVertexAttrib2fAPPLE) #define GLEW_APPLE_vertex_program_evaluators GLEW_GET_VAR(__GLEW_APPLE_vertex_program_evaluators) #endif /* GL_APPLE_vertex_program_evaluators */ /* --------------------------- GL_APPLE_ycbcr_422 -------------------------- */ #ifndef GL_APPLE_ycbcr_422 #define GL_APPLE_ycbcr_422 1 #define GL_YCBCR_422_APPLE 0x85B9 #define GLEW_APPLE_ycbcr_422 GLEW_GET_VAR(__GLEW_APPLE_ycbcr_422) #endif /* GL_APPLE_ycbcr_422 */ /* ------------------------ GL_ARB_ES2_compatibility ----------------------- */ #ifndef GL_ARB_ES2_compatibility #define GL_ARB_ES2_compatibility 1 #define GL_FIXED 0x140C #define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A #define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B #define GL_RGB565 0x8D62 #define GL_LOW_FLOAT 0x8DF0 #define GL_MEDIUM_FLOAT 0x8DF1 #define GL_HIGH_FLOAT 0x8DF2 #define GL_LOW_INT 0x8DF3 #define GL_MEDIUM_INT 0x8DF4 #define GL_HIGH_INT 0x8DF5 #define GL_SHADER_BINARY_FORMATS 0x8DF8 #define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 #define GL_SHADER_COMPILER 0x8DFA #define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB #define GL_MAX_VARYING_VECTORS 0x8DFC #define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD typedef void (GLAPIENTRY * PFNGLCLEARDEPTHFPROC) (GLclampf d); typedef void (GLAPIENTRY * PFNGLDEPTHRANGEFPROC) (GLclampf n, GLclampf f); typedef void (GLAPIENTRY * PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint* range, GLint *precision); typedef void (GLAPIENTRY * PFNGLRELEASESHADERCOMPILERPROC) (void); typedef void (GLAPIENTRY * PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint* shaders, GLenum binaryformat, const GLvoid*binary, GLsizei length); #define glClearDepthf GLEW_GET_FUN(__glewClearDepthf) #define glDepthRangef GLEW_GET_FUN(__glewDepthRangef) #define glGetShaderPrecisionFormat GLEW_GET_FUN(__glewGetShaderPrecisionFormat) #define glReleaseShaderCompiler GLEW_GET_FUN(__glewReleaseShaderCompiler) #define glShaderBinary GLEW_GET_FUN(__glewShaderBinary) #define GLEW_ARB_ES2_compatibility GLEW_GET_VAR(__GLEW_ARB_ES2_compatibility) #endif /* GL_ARB_ES2_compatibility */ /* ------------------------ GL_ARB_ES3_compatibility ----------------------- */ #ifndef GL_ARB_ES3_compatibility #define GL_ARB_ES3_compatibility 1 #define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69 #define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A #define GL_MAX_ELEMENT_INDEX 0x8D6B #define GL_COMPRESSED_R11_EAC 0x9270 #define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 #define GL_COMPRESSED_RG11_EAC 0x9272 #define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 #define GL_COMPRESSED_RGB8_ETC2 0x9274 #define GL_COMPRESSED_SRGB8_ETC2 0x9275 #define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 #define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 #define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 #define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 #define GLEW_ARB_ES3_compatibility GLEW_GET_VAR(__GLEW_ARB_ES3_compatibility) #endif /* GL_ARB_ES3_compatibility */ /* ------------------------ GL_ARB_arrays_of_arrays ------------------------ */ #ifndef GL_ARB_arrays_of_arrays #define GL_ARB_arrays_of_arrays 1 #define GLEW_ARB_arrays_of_arrays GLEW_GET_VAR(__GLEW_ARB_arrays_of_arrays) #endif /* GL_ARB_arrays_of_arrays */ /* -------------------------- GL_ARB_base_instance ------------------------- */ #ifndef GL_ARB_base_instance #define GL_ARB_base_instance 1 typedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount, GLuint baseinstance); typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount, GLuint baseinstance); typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount, GLint basevertex, GLuint baseinstance); #define glDrawArraysInstancedBaseInstance GLEW_GET_FUN(__glewDrawArraysInstancedBaseInstance) #define glDrawElementsInstancedBaseInstance GLEW_GET_FUN(__glewDrawElementsInstancedBaseInstance) #define glDrawElementsInstancedBaseVertexBaseInstance GLEW_GET_FUN(__glewDrawElementsInstancedBaseVertexBaseInstance) #define GLEW_ARB_base_instance GLEW_GET_VAR(__GLEW_ARB_base_instance) #endif /* GL_ARB_base_instance */ /* ----------------------- GL_ARB_blend_func_extended ---------------------- */ #ifndef GL_ARB_blend_func_extended #define GL_ARB_blend_func_extended 1 #define GL_SRC1_COLOR 0x88F9 #define GL_ONE_MINUS_SRC1_COLOR 0x88FA #define GL_ONE_MINUS_SRC1_ALPHA 0x88FB #define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC typedef void (GLAPIENTRY * PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar * name); typedef GLint (GLAPIENTRY * PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar * name); #define glBindFragDataLocationIndexed GLEW_GET_FUN(__glewBindFragDataLocationIndexed) #define glGetFragDataIndex GLEW_GET_FUN(__glewGetFragDataIndex) #define GLEW_ARB_blend_func_extended GLEW_GET_VAR(__GLEW_ARB_blend_func_extended) #endif /* GL_ARB_blend_func_extended */ /* ---------------------------- GL_ARB_cl_event ---------------------------- */ #ifndef GL_ARB_cl_event #define GL_ARB_cl_event 1 #define GL_SYNC_CL_EVENT_ARB 0x8240 #define GL_SYNC_CL_EVENT_COMPLETE_ARB 0x8241 typedef struct _cl_context *cl_context; typedef struct _cl_event *cl_event; typedef GLsync (GLAPIENTRY * PFNGLCREATESYNCFROMCLEVENTARBPROC) (cl_context context, cl_event event, GLbitfield flags); #define glCreateSyncFromCLeventARB GLEW_GET_FUN(__glewCreateSyncFromCLeventARB) #define GLEW_ARB_cl_event GLEW_GET_VAR(__GLEW_ARB_cl_event) #endif /* GL_ARB_cl_event */ /* ----------------------- GL_ARB_clear_buffer_object ---------------------- */ #ifndef GL_ARB_clear_buffer_object #define GL_ARB_clear_buffer_object 1 typedef void (GLAPIENTRY * PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const GLvoid* data); typedef void (GLAPIENTRY * PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const GLvoid* data); typedef void (GLAPIENTRY * PFNGLCLEARNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const GLvoid* data); typedef void (GLAPIENTRY * PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const GLvoid* data); #define glClearBufferData GLEW_GET_FUN(__glewClearBufferData) #define glClearBufferSubData GLEW_GET_FUN(__glewClearBufferSubData) #define glClearNamedBufferDataEXT GLEW_GET_FUN(__glewClearNamedBufferDataEXT) #define glClearNamedBufferSubDataEXT GLEW_GET_FUN(__glewClearNamedBufferSubDataEXT) #define GLEW_ARB_clear_buffer_object GLEW_GET_VAR(__GLEW_ARB_clear_buffer_object) #endif /* GL_ARB_clear_buffer_object */ /* ----------------------- GL_ARB_color_buffer_float ----------------------- */ #ifndef GL_ARB_color_buffer_float #define GL_ARB_color_buffer_float 1 #define GL_RGBA_FLOAT_MODE_ARB 0x8820 #define GL_CLAMP_VERTEX_COLOR_ARB 0x891A #define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B #define GL_CLAMP_READ_COLOR_ARB 0x891C #define GL_FIXED_ONLY_ARB 0x891D typedef void (GLAPIENTRY * PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp); #define glClampColorARB GLEW_GET_FUN(__glewClampColorARB) #define GLEW_ARB_color_buffer_float GLEW_GET_VAR(__GLEW_ARB_color_buffer_float) #endif /* GL_ARB_color_buffer_float */ /* -------------------------- GL_ARB_compatibility ------------------------- */ #ifndef GL_ARB_compatibility #define GL_ARB_compatibility 1 #define GLEW_ARB_compatibility GLEW_GET_VAR(__GLEW_ARB_compatibility) #endif /* GL_ARB_compatibility */ /* ---------------- GL_ARB_compressed_texture_pixel_storage ---------------- */ #ifndef GL_ARB_compressed_texture_pixel_storage #define GL_ARB_compressed_texture_pixel_storage 1 #define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127 #define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128 #define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129 #define GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A #define GL_PACK_COMPRESSED_BLOCK_WIDTH 0x912B #define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C #define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D #define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E #define GLEW_ARB_compressed_texture_pixel_storage GLEW_GET_VAR(__GLEW_ARB_compressed_texture_pixel_storage) #endif /* GL_ARB_compressed_texture_pixel_storage */ /* ------------------------- GL_ARB_compute_shader ------------------------- */ #ifndef GL_ARB_compute_shader #define GL_ARB_compute_shader 1 #define GL_COMPUTE_SHADER_BIT 0x00000020 #define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262 #define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263 #define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264 #define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265 #define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266 #define GL_COMPUTE_WORK_GROUP_SIZE 0x8267 #define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB #define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC #define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED #define GL_DISPATCH_INDIRECT_BUFFER 0x90EE #define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF #define GL_COMPUTE_SHADER 0x91B9 #define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB #define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC #define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD #define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE #define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF typedef void (GLAPIENTRY * PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); typedef void (GLAPIENTRY * PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect); #define glDispatchCompute GLEW_GET_FUN(__glewDispatchCompute) #define glDispatchComputeIndirect GLEW_GET_FUN(__glewDispatchComputeIndirect) #define GLEW_ARB_compute_shader GLEW_GET_VAR(__GLEW_ARB_compute_shader) #endif /* GL_ARB_compute_shader */ /* ----------------------- GL_ARB_conservative_depth ----------------------- */ #ifndef GL_ARB_conservative_depth #define GL_ARB_conservative_depth 1 #define GLEW_ARB_conservative_depth GLEW_GET_VAR(__GLEW_ARB_conservative_depth) #endif /* GL_ARB_conservative_depth */ /* --------------------------- GL_ARB_copy_buffer -------------------------- */ #ifndef GL_ARB_copy_buffer #define GL_ARB_copy_buffer 1 #define GL_COPY_READ_BUFFER 0x8F36 #define GL_COPY_WRITE_BUFFER 0x8F37 typedef void (GLAPIENTRY * PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readtarget, GLenum writetarget, GLintptr readoffset, GLintptr writeoffset, GLsizeiptr size); #define glCopyBufferSubData GLEW_GET_FUN(__glewCopyBufferSubData) #define GLEW_ARB_copy_buffer GLEW_GET_VAR(__GLEW_ARB_copy_buffer) #endif /* GL_ARB_copy_buffer */ /* --------------------------- GL_ARB_copy_image --------------------------- */ #ifndef GL_ARB_copy_image #define GL_ARB_copy_image 1 typedef void (GLAPIENTRY * PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); #define glCopyImageSubData GLEW_GET_FUN(__glewCopyImageSubData) #define GLEW_ARB_copy_image GLEW_GET_VAR(__GLEW_ARB_copy_image) #endif /* GL_ARB_copy_image */ /* -------------------------- GL_ARB_debug_output -------------------------- */ #ifndef GL_ARB_debug_output #define GL_ARB_debug_output 1 #define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242 #define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243 #define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244 #define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245 #define GL_DEBUG_SOURCE_API_ARB 0x8246 #define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247 #define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248 #define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249 #define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A #define GL_DEBUG_SOURCE_OTHER_ARB 0x824B #define GL_DEBUG_TYPE_ERROR_ARB 0x824C #define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D #define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E #define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F #define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250 #define GL_DEBUG_TYPE_OTHER_ARB 0x8251 #define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143 #define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144 #define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145 #define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146 #define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147 #define GL_DEBUG_SEVERITY_LOW_ARB 0x9148 typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam); typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, void* userParam); typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled); typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* buf); typedef GLuint (GLAPIENTRY * PFNGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufsize, GLenum* sources, GLenum* types, GLuint* ids, GLenum* severities, GLsizei* lengths, GLchar* messageLog); #define glDebugMessageCallbackARB GLEW_GET_FUN(__glewDebugMessageCallbackARB) #define glDebugMessageControlARB GLEW_GET_FUN(__glewDebugMessageControlARB) #define glDebugMessageInsertARB GLEW_GET_FUN(__glewDebugMessageInsertARB) #define glGetDebugMessageLogARB GLEW_GET_FUN(__glewGetDebugMessageLogARB) #define GLEW_ARB_debug_output GLEW_GET_VAR(__GLEW_ARB_debug_output) #endif /* GL_ARB_debug_output */ /* ----------------------- GL_ARB_depth_buffer_float ----------------------- */ #ifndef GL_ARB_depth_buffer_float #define GL_ARB_depth_buffer_float 1 #define GL_DEPTH_COMPONENT32F 0x8CAC #define GL_DEPTH32F_STENCIL8 0x8CAD #define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD #define GLEW_ARB_depth_buffer_float GLEW_GET_VAR(__GLEW_ARB_depth_buffer_float) #endif /* GL_ARB_depth_buffer_float */ /* --------------------------- GL_ARB_depth_clamp -------------------------- */ #ifndef GL_ARB_depth_clamp #define GL_ARB_depth_clamp 1 #define GL_DEPTH_CLAMP 0x864F #define GLEW_ARB_depth_clamp GLEW_GET_VAR(__GLEW_ARB_depth_clamp) #endif /* GL_ARB_depth_clamp */ /* -------------------------- GL_ARB_depth_texture ------------------------- */ #ifndef GL_ARB_depth_texture #define GL_ARB_depth_texture 1 #define GL_DEPTH_COMPONENT16_ARB 0x81A5 #define GL_DEPTH_COMPONENT24_ARB 0x81A6 #define GL_DEPTH_COMPONENT32_ARB 0x81A7 #define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A #define GL_DEPTH_TEXTURE_MODE_ARB 0x884B #define GLEW_ARB_depth_texture GLEW_GET_VAR(__GLEW_ARB_depth_texture) #endif /* GL_ARB_depth_texture */ /* -------------------------- GL_ARB_draw_buffers -------------------------- */ #ifndef GL_ARB_draw_buffers #define GL_ARB_draw_buffers 1 #define GL_MAX_DRAW_BUFFERS_ARB 0x8824 #define GL_DRAW_BUFFER0_ARB 0x8825 #define GL_DRAW_BUFFER1_ARB 0x8826 #define GL_DRAW_BUFFER2_ARB 0x8827 #define GL_DRAW_BUFFER3_ARB 0x8828 #define GL_DRAW_BUFFER4_ARB 0x8829 #define GL_DRAW_BUFFER5_ARB 0x882A #define GL_DRAW_BUFFER6_ARB 0x882B #define GL_DRAW_BUFFER7_ARB 0x882C #define GL_DRAW_BUFFER8_ARB 0x882D #define GL_DRAW_BUFFER9_ARB 0x882E #define GL_DRAW_BUFFER10_ARB 0x882F #define GL_DRAW_BUFFER11_ARB 0x8830 #define GL_DRAW_BUFFER12_ARB 0x8831 #define GL_DRAW_BUFFER13_ARB 0x8832 #define GL_DRAW_BUFFER14_ARB 0x8833 #define GL_DRAW_BUFFER15_ARB 0x8834 typedef void (GLAPIENTRY * PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum* bufs); #define glDrawBuffersARB GLEW_GET_FUN(__glewDrawBuffersARB) #define GLEW_ARB_draw_buffers GLEW_GET_VAR(__GLEW_ARB_draw_buffers) #endif /* GL_ARB_draw_buffers */ /* ----------------------- GL_ARB_draw_buffers_blend ----------------------- */ #ifndef GL_ARB_draw_buffers_blend #define GL_ARB_draw_buffers_blend 1 typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode); typedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); typedef void (GLAPIENTRY * PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst); #define glBlendEquationSeparateiARB GLEW_GET_FUN(__glewBlendEquationSeparateiARB) #define glBlendEquationiARB GLEW_GET_FUN(__glewBlendEquationiARB) #define glBlendFuncSeparateiARB GLEW_GET_FUN(__glewBlendFuncSeparateiARB) #define glBlendFunciARB GLEW_GET_FUN(__glewBlendFunciARB) #define GLEW_ARB_draw_buffers_blend GLEW_GET_VAR(__GLEW_ARB_draw_buffers_blend) #endif /* GL_ARB_draw_buffers_blend */ /* -------------------- GL_ARB_draw_elements_base_vertex ------------------- */ #ifndef GL_ARB_draw_elements_base_vertex #define GL_ARB_draw_elements_base_vertex 1 typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, void* indices, GLint basevertex); typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount, GLint basevertex); typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, void* indices, GLint basevertex); typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei* count, GLenum type, GLvoid**indices, GLsizei primcount, GLint *basevertex); #define glDrawElementsBaseVertex GLEW_GET_FUN(__glewDrawElementsBaseVertex) #define glDrawElementsInstancedBaseVertex GLEW_GET_FUN(__glewDrawElementsInstancedBaseVertex) #define glDrawRangeElementsBaseVertex GLEW_GET_FUN(__glewDrawRangeElementsBaseVertex) #define glMultiDrawElementsBaseVertex GLEW_GET_FUN(__glewMultiDrawElementsBaseVertex) #define GLEW_ARB_draw_elements_base_vertex GLEW_GET_VAR(__GLEW_ARB_draw_elements_base_vertex) #endif /* GL_ARB_draw_elements_base_vertex */ /* -------------------------- GL_ARB_draw_indirect ------------------------- */ #ifndef GL_ARB_draw_indirect #define GL_ARB_draw_indirect 1 #define GL_DRAW_INDIRECT_BUFFER 0x8F3F #define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43 typedef void (GLAPIENTRY * PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const void* indirect); typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void* indirect); #define glDrawArraysIndirect GLEW_GET_FUN(__glewDrawArraysIndirect) #define glDrawElementsIndirect GLEW_GET_FUN(__glewDrawElementsIndirect) #define GLEW_ARB_draw_indirect GLEW_GET_VAR(__GLEW_ARB_draw_indirect) #endif /* GL_ARB_draw_indirect */ /* ------------------------- GL_ARB_draw_instanced ------------------------- */ #ifndef GL_ARB_draw_instanced #define GL_ARB_draw_instanced 1 #define GLEW_ARB_draw_instanced GLEW_GET_VAR(__GLEW_ARB_draw_instanced) #endif /* GL_ARB_draw_instanced */ /* -------------------- GL_ARB_explicit_attrib_location -------------------- */ #ifndef GL_ARB_explicit_attrib_location #define GL_ARB_explicit_attrib_location 1 #define GLEW_ARB_explicit_attrib_location GLEW_GET_VAR(__GLEW_ARB_explicit_attrib_location) #endif /* GL_ARB_explicit_attrib_location */ /* -------------------- GL_ARB_explicit_uniform_location ------------------- */ #ifndef GL_ARB_explicit_uniform_location #define GL_ARB_explicit_uniform_location 1 #define GL_MAX_UNIFORM_LOCATIONS 0x826E #define GLEW_ARB_explicit_uniform_location GLEW_GET_VAR(__GLEW_ARB_explicit_uniform_location) #endif /* GL_ARB_explicit_uniform_location */ /* ------------------- GL_ARB_fragment_coord_conventions ------------------- */ #ifndef GL_ARB_fragment_coord_conventions #define GL_ARB_fragment_coord_conventions 1 #define GLEW_ARB_fragment_coord_conventions GLEW_GET_VAR(__GLEW_ARB_fragment_coord_conventions) #endif /* GL_ARB_fragment_coord_conventions */ /* --------------------- GL_ARB_fragment_layer_viewport -------------------- */ #ifndef GL_ARB_fragment_layer_viewport #define GL_ARB_fragment_layer_viewport 1 #define GLEW_ARB_fragment_layer_viewport GLEW_GET_VAR(__GLEW_ARB_fragment_layer_viewport) #endif /* GL_ARB_fragment_layer_viewport */ /* ------------------------ GL_ARB_fragment_program ------------------------ */ #ifndef GL_ARB_fragment_program #define GL_ARB_fragment_program 1 #define GL_FRAGMENT_PROGRAM_ARB 0x8804 #define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 #define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 #define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 #define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 #define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 #define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A #define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B #define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C #define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D #define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E #define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F #define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 #define GL_MAX_TEXTURE_COORDS_ARB 0x8871 #define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 #define GLEW_ARB_fragment_program GLEW_GET_VAR(__GLEW_ARB_fragment_program) #endif /* GL_ARB_fragment_program */ /* --------------------- GL_ARB_fragment_program_shadow -------------------- */ #ifndef GL_ARB_fragment_program_shadow #define GL_ARB_fragment_program_shadow 1 #define GLEW_ARB_fragment_program_shadow GLEW_GET_VAR(__GLEW_ARB_fragment_program_shadow) #endif /* GL_ARB_fragment_program_shadow */ /* ------------------------- GL_ARB_fragment_shader ------------------------ */ #ifndef GL_ARB_fragment_shader #define GL_ARB_fragment_shader 1 #define GL_FRAGMENT_SHADER_ARB 0x8B30 #define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 #define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B #define GLEW_ARB_fragment_shader GLEW_GET_VAR(__GLEW_ARB_fragment_shader) #endif /* GL_ARB_fragment_shader */ /* ------------------- GL_ARB_framebuffer_no_attachments ------------------- */ #ifndef GL_ARB_framebuffer_no_attachments #define GL_ARB_framebuffer_no_attachments 1 #define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310 #define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311 #define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312 #define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313 #define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314 #define GL_MAX_FRAMEBUFFER_WIDTH 0x9315 #define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316 #define GL_MAX_FRAMEBUFFER_LAYERS 0x9317 #define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318 typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); typedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC) (GLuint framebuffer, GLenum pname, GLint param); #define glFramebufferParameteri GLEW_GET_FUN(__glewFramebufferParameteri) #define glGetFramebufferParameteriv GLEW_GET_FUN(__glewGetFramebufferParameteriv) #define glGetNamedFramebufferParameterivEXT GLEW_GET_FUN(__glewGetNamedFramebufferParameterivEXT) #define glNamedFramebufferParameteriEXT GLEW_GET_FUN(__glewNamedFramebufferParameteriEXT) #define GLEW_ARB_framebuffer_no_attachments GLEW_GET_VAR(__GLEW_ARB_framebuffer_no_attachments) #endif /* GL_ARB_framebuffer_no_attachments */ /* ----------------------- GL_ARB_framebuffer_object ----------------------- */ #ifndef GL_ARB_framebuffer_object #define GL_ARB_framebuffer_object 1 #define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 #define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 #define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 #define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 #define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 #define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 #define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 #define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 #define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 #define GL_FRAMEBUFFER_DEFAULT 0x8218 #define GL_FRAMEBUFFER_UNDEFINED 0x8219 #define GL_DEPTH_STENCIL_ATTACHMENT 0x821A #define GL_INDEX 0x8222 #define GL_MAX_RENDERBUFFER_SIZE 0x84E8 #define GL_DEPTH_STENCIL 0x84F9 #define GL_UNSIGNED_INT_24_8 0x84FA #define GL_DEPTH24_STENCIL8 0x88F0 #define GL_TEXTURE_STENCIL_SIZE 0x88F1 #define GL_UNSIGNED_NORMALIZED 0x8C17 #define GL_SRGB 0x8C40 #define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6 #define GL_FRAMEBUFFER_BINDING 0x8CA6 #define GL_RENDERBUFFER_BINDING 0x8CA7 #define GL_READ_FRAMEBUFFER 0x8CA8 #define GL_DRAW_FRAMEBUFFER 0x8CA9 #define GL_READ_FRAMEBUFFER_BINDING 0x8CAA #define GL_RENDERBUFFER_SAMPLES 0x8CAB #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 #define GL_FRAMEBUFFER_COMPLETE 0x8CD5 #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 #define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB #define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC #define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD #define GL_MAX_COLOR_ATTACHMENTS 0x8CDF #define GL_COLOR_ATTACHMENT0 0x8CE0 #define GL_COLOR_ATTACHMENT1 0x8CE1 #define GL_COLOR_ATTACHMENT2 0x8CE2 #define GL_COLOR_ATTACHMENT3 0x8CE3 #define GL_COLOR_ATTACHMENT4 0x8CE4 #define GL_COLOR_ATTACHMENT5 0x8CE5 #define GL_COLOR_ATTACHMENT6 0x8CE6 #define GL_COLOR_ATTACHMENT7 0x8CE7 #define GL_COLOR_ATTACHMENT8 0x8CE8 #define GL_COLOR_ATTACHMENT9 0x8CE9 #define GL_COLOR_ATTACHMENT10 0x8CEA #define GL_COLOR_ATTACHMENT11 0x8CEB #define GL_COLOR_ATTACHMENT12 0x8CEC #define GL_COLOR_ATTACHMENT13 0x8CED #define GL_COLOR_ATTACHMENT14 0x8CEE #define GL_COLOR_ATTACHMENT15 0x8CEF #define GL_DEPTH_ATTACHMENT 0x8D00 #define GL_STENCIL_ATTACHMENT 0x8D20 #define GL_FRAMEBUFFER 0x8D40 #define GL_RENDERBUFFER 0x8D41 #define GL_RENDERBUFFER_WIDTH 0x8D42 #define GL_RENDERBUFFER_HEIGHT 0x8D43 #define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 #define GL_STENCIL_INDEX1 0x8D46 #define GL_STENCIL_INDEX4 0x8D47 #define GL_STENCIL_INDEX8 0x8D48 #define GL_STENCIL_INDEX16 0x8D49 #define GL_RENDERBUFFER_RED_SIZE 0x8D50 #define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 #define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 #define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 #define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 #define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 #define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 #define GL_MAX_SAMPLES 0x8D57 typedef void (GLAPIENTRY * PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer); typedef void (GLAPIENTRY * PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer); typedef void (GLAPIENTRY * PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); typedef GLenum (GLAPIENTRY * PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target); typedef void (GLAPIENTRY * PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint* framebuffers); typedef void (GLAPIENTRY * PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint* renderbuffers); typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint layer); typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target,GLenum attachment, GLuint texture,GLint level,GLint layer); typedef void (GLAPIENTRY * PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint* framebuffers); typedef void (GLAPIENTRY * PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint* renderbuffers); typedef void (GLAPIENTRY * PFNGLGENERATEMIPMAPPROC) (GLenum target); typedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint* params); typedef GLboolean (GLAPIENTRY * PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer); typedef GLboolean (GLAPIENTRY * PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer); typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); #define glBindFramebuffer GLEW_GET_FUN(__glewBindFramebuffer) #define glBindRenderbuffer GLEW_GET_FUN(__glewBindRenderbuffer) #define glBlitFramebuffer GLEW_GET_FUN(__glewBlitFramebuffer) #define glCheckFramebufferStatus GLEW_GET_FUN(__glewCheckFramebufferStatus) #define glDeleteFramebuffers GLEW_GET_FUN(__glewDeleteFramebuffers) #define glDeleteRenderbuffers GLEW_GET_FUN(__glewDeleteRenderbuffers) #define glFramebufferRenderbuffer GLEW_GET_FUN(__glewFramebufferRenderbuffer) #define glFramebufferTexture1D GLEW_GET_FUN(__glewFramebufferTexture1D) #define glFramebufferTexture2D GLEW_GET_FUN(__glewFramebufferTexture2D) #define glFramebufferTexture3D GLEW_GET_FUN(__glewFramebufferTexture3D) #define glFramebufferTextureLayer GLEW_GET_FUN(__glewFramebufferTextureLayer) #define glGenFramebuffers GLEW_GET_FUN(__glewGenFramebuffers) #define glGenRenderbuffers GLEW_GET_FUN(__glewGenRenderbuffers) #define glGenerateMipmap GLEW_GET_FUN(__glewGenerateMipmap) #define glGetFramebufferAttachmentParameteriv GLEW_GET_FUN(__glewGetFramebufferAttachmentParameteriv) #define glGetRenderbufferParameteriv GLEW_GET_FUN(__glewGetRenderbufferParameteriv) #define glIsFramebuffer GLEW_GET_FUN(__glewIsFramebuffer) #define glIsRenderbuffer GLEW_GET_FUN(__glewIsRenderbuffer) #define glRenderbufferStorage GLEW_GET_FUN(__glewRenderbufferStorage) #define glRenderbufferStorageMultisample GLEW_GET_FUN(__glewRenderbufferStorageMultisample) #define GLEW_ARB_framebuffer_object GLEW_GET_VAR(__GLEW_ARB_framebuffer_object) #endif /* GL_ARB_framebuffer_object */ /* ------------------------ GL_ARB_framebuffer_sRGB ------------------------ */ #ifndef GL_ARB_framebuffer_sRGB #define GL_ARB_framebuffer_sRGB 1 #define GL_FRAMEBUFFER_SRGB 0x8DB9 #define GLEW_ARB_framebuffer_sRGB GLEW_GET_VAR(__GLEW_ARB_framebuffer_sRGB) #endif /* GL_ARB_framebuffer_sRGB */ /* ------------------------ GL_ARB_geometry_shader4 ------------------------ */ #ifndef GL_ARB_geometry_shader4 #define GL_ARB_geometry_shader4 1 #define GL_LINES_ADJACENCY_ARB 0xA #define GL_LINE_STRIP_ADJACENCY_ARB 0xB #define GL_TRIANGLES_ADJACENCY_ARB 0xC #define GL_TRIANGLE_STRIP_ADJACENCY_ARB 0xD #define GL_PROGRAM_POINT_SIZE_ARB 0x8642 #define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB 0x8C29 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 #define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB 0x8DA7 #define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB 0x8DA8 #define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB 0x8DA9 #define GL_GEOMETRY_SHADER_ARB 0x8DD9 #define GL_GEOMETRY_VERTICES_OUT_ARB 0x8DDA #define GL_GEOMETRY_INPUT_TYPE_ARB 0x8DDB #define GL_GEOMETRY_OUTPUT_TYPE_ARB 0x8DDC #define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB 0x8DDD #define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB 0x8DDE #define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB 0x8DDF #define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB 0x8DE0 #define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB 0x8DE1 typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYERARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERIARBPROC) (GLuint program, GLenum pname, GLint value); #define glFramebufferTextureARB GLEW_GET_FUN(__glewFramebufferTextureARB) #define glFramebufferTextureFaceARB GLEW_GET_FUN(__glewFramebufferTextureFaceARB) #define glFramebufferTextureLayerARB GLEW_GET_FUN(__glewFramebufferTextureLayerARB) #define glProgramParameteriARB GLEW_GET_FUN(__glewProgramParameteriARB) #define GLEW_ARB_geometry_shader4 GLEW_GET_VAR(__GLEW_ARB_geometry_shader4) #endif /* GL_ARB_geometry_shader4 */ /* ----------------------- GL_ARB_get_program_binary ----------------------- */ #ifndef GL_ARB_get_program_binary #define GL_ARB_get_program_binary 1 #define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 #define GL_PROGRAM_BINARY_LENGTH 0x8741 #define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE #define GL_PROGRAM_BINARY_FORMATS 0x87FF typedef void (GLAPIENTRY * PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei* length, GLenum *binaryFormat, GLvoid*binary); typedef void (GLAPIENTRY * PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void* binary, GLsizei length); typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value); #define glGetProgramBinary GLEW_GET_FUN(__glewGetProgramBinary) #define glProgramBinary GLEW_GET_FUN(__glewProgramBinary) #define glProgramParameteri GLEW_GET_FUN(__glewProgramParameteri) #define GLEW_ARB_get_program_binary GLEW_GET_VAR(__GLEW_ARB_get_program_binary) #endif /* GL_ARB_get_program_binary */ /* --------------------------- GL_ARB_gpu_shader5 -------------------------- */ #ifndef GL_ARB_gpu_shader5 #define GL_ARB_gpu_shader5 1 #define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F #define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A #define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B #define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C #define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D #define GL_MAX_VERTEX_STREAMS 0x8E71 #define GLEW_ARB_gpu_shader5 GLEW_GET_VAR(__GLEW_ARB_gpu_shader5) #endif /* GL_ARB_gpu_shader5 */ /* ------------------------- GL_ARB_gpu_shader_fp64 ------------------------ */ #ifndef GL_ARB_gpu_shader_fp64 #define GL_ARB_gpu_shader_fp64 1 #define GL_DOUBLE_MAT2 0x8F46 #define GL_DOUBLE_MAT3 0x8F47 #define GL_DOUBLE_MAT4 0x8F48 #define GL_DOUBLE_MAT2x3 0x8F49 #define GL_DOUBLE_MAT2x4 0x8F4A #define GL_DOUBLE_MAT3x2 0x8F4B #define GL_DOUBLE_MAT3x4 0x8F4C #define GL_DOUBLE_MAT4x2 0x8F4D #define GL_DOUBLE_MAT4x3 0x8F4E #define GL_DOUBLE_VEC2 0x8FFC #define GL_DOUBLE_VEC3 0x8FFD #define GL_DOUBLE_VEC4 0x8FFE typedef void (GLAPIENTRY * PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble* params); typedef void (GLAPIENTRY * PFNGLUNIFORM1DPROC) (GLint location, GLdouble x); typedef void (GLAPIENTRY * PFNGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y); typedef void (GLAPIENTRY * PFNGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z); typedef void (GLAPIENTRY * PFNGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (GLAPIENTRY * PFNGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); #define glGetUniformdv GLEW_GET_FUN(__glewGetUniformdv) #define glUniform1d GLEW_GET_FUN(__glewUniform1d) #define glUniform1dv GLEW_GET_FUN(__glewUniform1dv) #define glUniform2d GLEW_GET_FUN(__glewUniform2d) #define glUniform2dv GLEW_GET_FUN(__glewUniform2dv) #define glUniform3d GLEW_GET_FUN(__glewUniform3d) #define glUniform3dv GLEW_GET_FUN(__glewUniform3dv) #define glUniform4d GLEW_GET_FUN(__glewUniform4d) #define glUniform4dv GLEW_GET_FUN(__glewUniform4dv) #define glUniformMatrix2dv GLEW_GET_FUN(__glewUniformMatrix2dv) #define glUniformMatrix2x3dv GLEW_GET_FUN(__glewUniformMatrix2x3dv) #define glUniformMatrix2x4dv GLEW_GET_FUN(__glewUniformMatrix2x4dv) #define glUniformMatrix3dv GLEW_GET_FUN(__glewUniformMatrix3dv) #define glUniformMatrix3x2dv GLEW_GET_FUN(__glewUniformMatrix3x2dv) #define glUniformMatrix3x4dv GLEW_GET_FUN(__glewUniformMatrix3x4dv) #define glUniformMatrix4dv GLEW_GET_FUN(__glewUniformMatrix4dv) #define glUniformMatrix4x2dv GLEW_GET_FUN(__glewUniformMatrix4x2dv) #define glUniformMatrix4x3dv GLEW_GET_FUN(__glewUniformMatrix4x3dv) #define GLEW_ARB_gpu_shader_fp64 GLEW_GET_VAR(__GLEW_ARB_gpu_shader_fp64) #endif /* GL_ARB_gpu_shader_fp64 */ /* ------------------------ GL_ARB_half_float_pixel ------------------------ */ #ifndef GL_ARB_half_float_pixel #define GL_ARB_half_float_pixel 1 #define GL_HALF_FLOAT_ARB 0x140B #define GLEW_ARB_half_float_pixel GLEW_GET_VAR(__GLEW_ARB_half_float_pixel) #endif /* GL_ARB_half_float_pixel */ /* ------------------------ GL_ARB_half_float_vertex ----------------------- */ #ifndef GL_ARB_half_float_vertex #define GL_ARB_half_float_vertex 1 #define GL_HALF_FLOAT 0x140B #define GLEW_ARB_half_float_vertex GLEW_GET_VAR(__GLEW_ARB_half_float_vertex) #endif /* GL_ARB_half_float_vertex */ /* ----------------------------- GL_ARB_imaging ---------------------------- */ #ifndef GL_ARB_imaging #define GL_ARB_imaging 1 #define GL_CONSTANT_COLOR 0x8001 #define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 #define GL_CONSTANT_ALPHA 0x8003 #define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 #define GL_BLEND_COLOR 0x8005 #define GL_FUNC_ADD 0x8006 #define GL_MIN 0x8007 #define GL_MAX 0x8008 #define GL_BLEND_EQUATION 0x8009 #define GL_FUNC_SUBTRACT 0x800A #define GL_FUNC_REVERSE_SUBTRACT 0x800B #define GL_CONVOLUTION_1D 0x8010 #define GL_CONVOLUTION_2D 0x8011 #define GL_SEPARABLE_2D 0x8012 #define GL_CONVOLUTION_BORDER_MODE 0x8013 #define GL_CONVOLUTION_FILTER_SCALE 0x8014 #define GL_CONVOLUTION_FILTER_BIAS 0x8015 #define GL_REDUCE 0x8016 #define GL_CONVOLUTION_FORMAT 0x8017 #define GL_CONVOLUTION_WIDTH 0x8018 #define GL_CONVOLUTION_HEIGHT 0x8019 #define GL_MAX_CONVOLUTION_WIDTH 0x801A #define GL_MAX_CONVOLUTION_HEIGHT 0x801B #define GL_POST_CONVOLUTION_RED_SCALE 0x801C #define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D #define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E #define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F #define GL_POST_CONVOLUTION_RED_BIAS 0x8020 #define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 #define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 #define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 #define GL_HISTOGRAM 0x8024 #define GL_PROXY_HISTOGRAM 0x8025 #define GL_HISTOGRAM_WIDTH 0x8026 #define GL_HISTOGRAM_FORMAT 0x8027 #define GL_HISTOGRAM_RED_SIZE 0x8028 #define GL_HISTOGRAM_GREEN_SIZE 0x8029 #define GL_HISTOGRAM_BLUE_SIZE 0x802A #define GL_HISTOGRAM_ALPHA_SIZE 0x802B #define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C #define GL_HISTOGRAM_SINK 0x802D #define GL_MINMAX 0x802E #define GL_MINMAX_FORMAT 0x802F #define GL_MINMAX_SINK 0x8030 #define GL_TABLE_TOO_LARGE 0x8031 #define GL_COLOR_MATRIX 0x80B1 #define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 #define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 #define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 #define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 #define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 #define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 #define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 #define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 #define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA #define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB #define GL_COLOR_TABLE 0x80D0 #define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 #define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 #define GL_PROXY_COLOR_TABLE 0x80D3 #define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 #define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 #define GL_COLOR_TABLE_SCALE 0x80D6 #define GL_COLOR_TABLE_BIAS 0x80D7 #define GL_COLOR_TABLE_FORMAT 0x80D8 #define GL_COLOR_TABLE_WIDTH 0x80D9 #define GL_COLOR_TABLE_RED_SIZE 0x80DA #define GL_COLOR_TABLE_GREEN_SIZE 0x80DB #define GL_COLOR_TABLE_BLUE_SIZE 0x80DC #define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD #define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE #define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF #define GL_IGNORE_BORDER 0x8150 #define GL_CONSTANT_BORDER 0x8151 #define GL_WRAP_BORDER 0x8152 #define GL_REPLICATE_BORDER 0x8153 #define GL_CONVOLUTION_BORDER_COLOR 0x8154 typedef void (GLAPIENTRY * PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); typedef void (GLAPIENTRY * PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); typedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); typedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); typedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); typedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); typedef void (GLAPIENTRY * PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); typedef void (GLAPIENTRY * PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); typedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); typedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); typedef void (GLAPIENTRY * PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values); typedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); typedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); typedef void (GLAPIENTRY * PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); typedef void (GLAPIENTRY * PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); typedef void (GLAPIENTRY * PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); typedef void (GLAPIENTRY * PFNGLRESETHISTOGRAMPROC) (GLenum target); typedef void (GLAPIENTRY * PFNGLRESETMINMAXPROC) (GLenum target); typedef void (GLAPIENTRY * PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); #define glColorSubTable GLEW_GET_FUN(__glewColorSubTable) #define glColorTable GLEW_GET_FUN(__glewColorTable) #define glColorTableParameterfv GLEW_GET_FUN(__glewColorTableParameterfv) #define glColorTableParameteriv GLEW_GET_FUN(__glewColorTableParameteriv) #define glConvolutionFilter1D GLEW_GET_FUN(__glewConvolutionFilter1D) #define glConvolutionFilter2D GLEW_GET_FUN(__glewConvolutionFilter2D) #define glConvolutionParameterf GLEW_GET_FUN(__glewConvolutionParameterf) #define glConvolutionParameterfv GLEW_GET_FUN(__glewConvolutionParameterfv) #define glConvolutionParameteri GLEW_GET_FUN(__glewConvolutionParameteri) #define glConvolutionParameteriv GLEW_GET_FUN(__glewConvolutionParameteriv) #define glCopyColorSubTable GLEW_GET_FUN(__glewCopyColorSubTable) #define glCopyColorTable GLEW_GET_FUN(__glewCopyColorTable) #define glCopyConvolutionFilter1D GLEW_GET_FUN(__glewCopyConvolutionFilter1D) #define glCopyConvolutionFilter2D GLEW_GET_FUN(__glewCopyConvolutionFilter2D) #define glGetColorTable GLEW_GET_FUN(__glewGetColorTable) #define glGetColorTableParameterfv GLEW_GET_FUN(__glewGetColorTableParameterfv) #define glGetColorTableParameteriv GLEW_GET_FUN(__glewGetColorTableParameteriv) #define glGetConvolutionFilter GLEW_GET_FUN(__glewGetConvolutionFilter) #define glGetConvolutionParameterfv GLEW_GET_FUN(__glewGetConvolutionParameterfv) #define glGetConvolutionParameteriv GLEW_GET_FUN(__glewGetConvolutionParameteriv) #define glGetHistogram GLEW_GET_FUN(__glewGetHistogram) #define glGetHistogramParameterfv GLEW_GET_FUN(__glewGetHistogramParameterfv) #define glGetHistogramParameteriv GLEW_GET_FUN(__glewGetHistogramParameteriv) #define glGetMinmax GLEW_GET_FUN(__glewGetMinmax) #define glGetMinmaxParameterfv GLEW_GET_FUN(__glewGetMinmaxParameterfv) #define glGetMinmaxParameteriv GLEW_GET_FUN(__glewGetMinmaxParameteriv) #define glGetSeparableFilter GLEW_GET_FUN(__glewGetSeparableFilter) #define glHistogram GLEW_GET_FUN(__glewHistogram) #define glMinmax GLEW_GET_FUN(__glewMinmax) #define glResetHistogram GLEW_GET_FUN(__glewResetHistogram) #define glResetMinmax GLEW_GET_FUN(__glewResetMinmax) #define glSeparableFilter2D GLEW_GET_FUN(__glewSeparableFilter2D) #define GLEW_ARB_imaging GLEW_GET_VAR(__GLEW_ARB_imaging) #endif /* GL_ARB_imaging */ /* ------------------------ GL_ARB_instanced_arrays ------------------------ */ #ifndef GL_ARB_instanced_arrays #define GL_ARB_instanced_arrays 1 #define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE typedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor); #define glDrawArraysInstancedARB GLEW_GET_FUN(__glewDrawArraysInstancedARB) #define glDrawElementsInstancedARB GLEW_GET_FUN(__glewDrawElementsInstancedARB) #define glVertexAttribDivisorARB GLEW_GET_FUN(__glewVertexAttribDivisorARB) #define GLEW_ARB_instanced_arrays GLEW_GET_VAR(__GLEW_ARB_instanced_arrays) #endif /* GL_ARB_instanced_arrays */ /* ---------------------- GL_ARB_internalformat_query ---------------------- */ #ifndef GL_ARB_internalformat_query #define GL_ARB_internalformat_query 1 #define GL_NUM_SAMPLE_COUNTS 0x9380 typedef void (GLAPIENTRY * PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params); #define glGetInternalformativ GLEW_GET_FUN(__glewGetInternalformativ) #define GLEW_ARB_internalformat_query GLEW_GET_VAR(__GLEW_ARB_internalformat_query) #endif /* GL_ARB_internalformat_query */ /* ---------------------- GL_ARB_internalformat_query2 --------------------- */ #ifndef GL_ARB_internalformat_query2 #define GL_ARB_internalformat_query2 1 #define GL_TEXTURE_1D 0x0DE0 #define GL_TEXTURE_2D 0x0DE1 #define GL_TEXTURE_3D 0x806F #define GL_SAMPLES 0x80A9 #define GL_INTERNALFORMAT_SUPPORTED 0x826F #define GL_INTERNALFORMAT_PREFERRED 0x8270 #define GL_INTERNALFORMAT_RED_SIZE 0x8271 #define GL_INTERNALFORMAT_GREEN_SIZE 0x8272 #define GL_INTERNALFORMAT_BLUE_SIZE 0x8273 #define GL_INTERNALFORMAT_ALPHA_SIZE 0x8274 #define GL_INTERNALFORMAT_DEPTH_SIZE 0x8275 #define GL_INTERNALFORMAT_STENCIL_SIZE 0x8276 #define GL_INTERNALFORMAT_SHARED_SIZE 0x8277 #define GL_INTERNALFORMAT_RED_TYPE 0x8278 #define GL_INTERNALFORMAT_GREEN_TYPE 0x8279 #define GL_INTERNALFORMAT_BLUE_TYPE 0x827A #define GL_INTERNALFORMAT_ALPHA_TYPE 0x827B #define GL_INTERNALFORMAT_DEPTH_TYPE 0x827C #define GL_INTERNALFORMAT_STENCIL_TYPE 0x827D #define GL_MAX_WIDTH 0x827E #define GL_MAX_HEIGHT 0x827F #define GL_MAX_DEPTH 0x8280 #define GL_MAX_LAYERS 0x8281 #define GL_MAX_COMBINED_DIMENSIONS 0x8282 #define GL_COLOR_COMPONENTS 0x8283 #define GL_DEPTH_COMPONENTS 0x8284 #define GL_STENCIL_COMPONENTS 0x8285 #define GL_COLOR_RENDERABLE 0x8286 #define GL_DEPTH_RENDERABLE 0x8287 #define GL_STENCIL_RENDERABLE 0x8288 #define GL_FRAMEBUFFER_RENDERABLE 0x8289 #define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A #define GL_FRAMEBUFFER_BLEND 0x828B #define GL_READ_PIXELS 0x828C #define GL_READ_PIXELS_FORMAT 0x828D #define GL_READ_PIXELS_TYPE 0x828E #define GL_TEXTURE_IMAGE_FORMAT 0x828F #define GL_TEXTURE_IMAGE_TYPE 0x8290 #define GL_GET_TEXTURE_IMAGE_FORMAT 0x8291 #define GL_GET_TEXTURE_IMAGE_TYPE 0x8292 #define GL_MIPMAP 0x8293 #define GL_MANUAL_GENERATE_MIPMAP 0x8294 #define GL_AUTO_GENERATE_MIPMAP 0x8295 #define GL_COLOR_ENCODING 0x8296 #define GL_SRGB_READ 0x8297 #define GL_SRGB_WRITE 0x8298 #define GL_SRGB_DECODE_ARB 0x8299 #define GL_FILTER 0x829A #define GL_VERTEX_TEXTURE 0x829B #define GL_TESS_CONTROL_TEXTURE 0x829C #define GL_TESS_EVALUATION_TEXTURE 0x829D #define GL_GEOMETRY_TEXTURE 0x829E #define GL_FRAGMENT_TEXTURE 0x829F #define GL_COMPUTE_TEXTURE 0x82A0 #define GL_TEXTURE_SHADOW 0x82A1 #define GL_TEXTURE_GATHER 0x82A2 #define GL_TEXTURE_GATHER_SHADOW 0x82A3 #define GL_SHADER_IMAGE_LOAD 0x82A4 #define GL_SHADER_IMAGE_STORE 0x82A5 #define GL_SHADER_IMAGE_ATOMIC 0x82A6 #define GL_IMAGE_TEXEL_SIZE 0x82A7 #define GL_IMAGE_COMPATIBILITY_CLASS 0x82A8 #define GL_IMAGE_PIXEL_FORMAT 0x82A9 #define GL_IMAGE_PIXEL_TYPE 0x82AA #define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC #define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD #define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE #define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF #define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1 #define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2 #define GL_TEXTURE_COMPRESSED_BLOCK_SIZE 0x82B3 #define GL_CLEAR_BUFFER 0x82B4 #define GL_TEXTURE_VIEW 0x82B5 #define GL_VIEW_COMPATIBILITY_CLASS 0x82B6 #define GL_FULL_SUPPORT 0x82B7 #define GL_CAVEAT_SUPPORT 0x82B8 #define GL_IMAGE_CLASS_4_X_32 0x82B9 #define GL_IMAGE_CLASS_2_X_32 0x82BA #define GL_IMAGE_CLASS_1_X_32 0x82BB #define GL_IMAGE_CLASS_4_X_16 0x82BC #define GL_IMAGE_CLASS_2_X_16 0x82BD #define GL_IMAGE_CLASS_1_X_16 0x82BE #define GL_IMAGE_CLASS_4_X_8 0x82BF #define GL_IMAGE_CLASS_2_X_8 0x82C0 #define GL_IMAGE_CLASS_1_X_8 0x82C1 #define GL_IMAGE_CLASS_11_11_10 0x82C2 #define GL_IMAGE_CLASS_10_10_10_2 0x82C3 #define GL_VIEW_CLASS_128_BITS 0x82C4 #define GL_VIEW_CLASS_96_BITS 0x82C5 #define GL_VIEW_CLASS_64_BITS 0x82C6 #define GL_VIEW_CLASS_48_BITS 0x82C7 #define GL_VIEW_CLASS_32_BITS 0x82C8 #define GL_VIEW_CLASS_24_BITS 0x82C9 #define GL_VIEW_CLASS_16_BITS 0x82CA #define GL_VIEW_CLASS_8_BITS 0x82CB #define GL_VIEW_CLASS_S3TC_DXT1_RGB 0x82CC #define GL_VIEW_CLASS_S3TC_DXT1_RGBA 0x82CD #define GL_VIEW_CLASS_S3TC_DXT3_RGBA 0x82CE #define GL_VIEW_CLASS_S3TC_DXT5_RGBA 0x82CF #define GL_VIEW_CLASS_RGTC1_RED 0x82D0 #define GL_VIEW_CLASS_RGTC2_RG 0x82D1 #define GL_VIEW_CLASS_BPTC_UNORM 0x82D2 #define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3 #define GL_TEXTURE_RECTANGLE 0x84F5 #define GL_TEXTURE_1D_ARRAY 0x8C18 #define GL_TEXTURE_2D_ARRAY 0x8C1A #define GL_TEXTURE_BUFFER 0x8C2A #define GL_RENDERBUFFER 0x8D41 #define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 #define GL_TEXTURE_2D_MULTISAMPLE 0x9100 #define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 #define GL_NUM_SAMPLE_COUNTS 0x9380 typedef void (GLAPIENTRY * PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64* params); #define glGetInternalformati64v GLEW_GET_FUN(__glewGetInternalformati64v) #define GLEW_ARB_internalformat_query2 GLEW_GET_VAR(__GLEW_ARB_internalformat_query2) #endif /* GL_ARB_internalformat_query2 */ /* ----------------------- GL_ARB_invalidate_subdata ----------------------- */ #ifndef GL_ARB_invalidate_subdata #define GL_ARB_invalidate_subdata 1 typedef void (GLAPIENTRY * PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer); typedef void (GLAPIENTRY * PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); typedef void (GLAPIENTRY * PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum* attachments); typedef void (GLAPIENTRY * PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height); typedef void (GLAPIENTRY * PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level); typedef void (GLAPIENTRY * PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); #define glInvalidateBufferData GLEW_GET_FUN(__glewInvalidateBufferData) #define glInvalidateBufferSubData GLEW_GET_FUN(__glewInvalidateBufferSubData) #define glInvalidateFramebuffer GLEW_GET_FUN(__glewInvalidateFramebuffer) #define glInvalidateSubFramebuffer GLEW_GET_FUN(__glewInvalidateSubFramebuffer) #define glInvalidateTexImage GLEW_GET_FUN(__glewInvalidateTexImage) #define glInvalidateTexSubImage GLEW_GET_FUN(__glewInvalidateTexSubImage) #define GLEW_ARB_invalidate_subdata GLEW_GET_VAR(__GLEW_ARB_invalidate_subdata) #endif /* GL_ARB_invalidate_subdata */ /* ---------------------- GL_ARB_map_buffer_alignment ---------------------- */ #ifndef GL_ARB_map_buffer_alignment #define GL_ARB_map_buffer_alignment 1 #define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC #define GLEW_ARB_map_buffer_alignment GLEW_GET_VAR(__GLEW_ARB_map_buffer_alignment) #endif /* GL_ARB_map_buffer_alignment */ /* ------------------------ GL_ARB_map_buffer_range ------------------------ */ #ifndef GL_ARB_map_buffer_range #define GL_ARB_map_buffer_range 1 #define GL_MAP_READ_BIT 0x0001 #define GL_MAP_WRITE_BIT 0x0002 #define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 #define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 #define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 #define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 typedef void (GLAPIENTRY * PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length); typedef GLvoid * (GLAPIENTRY * PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); #define glFlushMappedBufferRange GLEW_GET_FUN(__glewFlushMappedBufferRange) #define glMapBufferRange GLEW_GET_FUN(__glewMapBufferRange) #define GLEW_ARB_map_buffer_range GLEW_GET_VAR(__GLEW_ARB_map_buffer_range) #endif /* GL_ARB_map_buffer_range */ /* ------------------------- GL_ARB_matrix_palette ------------------------- */ #ifndef GL_ARB_matrix_palette #define GL_ARB_matrix_palette 1 #define GL_MATRIX_PALETTE_ARB 0x8840 #define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 #define GL_MAX_PALETTE_MATRICES_ARB 0x8842 #define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 #define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 #define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 #define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 #define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 #define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 #define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 typedef void (GLAPIENTRY * PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index); typedef void (GLAPIENTRY * PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer); typedef void (GLAPIENTRY * PFNGLMATRIXINDEXUBVARBPROC) (GLint size, GLubyte *indices); typedef void (GLAPIENTRY * PFNGLMATRIXINDEXUIVARBPROC) (GLint size, GLuint *indices); typedef void (GLAPIENTRY * PFNGLMATRIXINDEXUSVARBPROC) (GLint size, GLushort *indices); #define glCurrentPaletteMatrixARB GLEW_GET_FUN(__glewCurrentPaletteMatrixARB) #define glMatrixIndexPointerARB GLEW_GET_FUN(__glewMatrixIndexPointerARB) #define glMatrixIndexubvARB GLEW_GET_FUN(__glewMatrixIndexubvARB) #define glMatrixIndexuivARB GLEW_GET_FUN(__glewMatrixIndexuivARB) #define glMatrixIndexusvARB GLEW_GET_FUN(__glewMatrixIndexusvARB) #define GLEW_ARB_matrix_palette GLEW_GET_VAR(__GLEW_ARB_matrix_palette) #endif /* GL_ARB_matrix_palette */ /* ----------------------- GL_ARB_multi_draw_indirect ---------------------- */ #ifndef GL_ARB_multi_draw_indirect #define GL_ARB_multi_draw_indirect 1 typedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void* indirect, GLsizei primcount, GLsizei stride); typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void* indirect, GLsizei primcount, GLsizei stride); #define glMultiDrawArraysIndirect GLEW_GET_FUN(__glewMultiDrawArraysIndirect) #define glMultiDrawElementsIndirect GLEW_GET_FUN(__glewMultiDrawElementsIndirect) #define GLEW_ARB_multi_draw_indirect GLEW_GET_VAR(__GLEW_ARB_multi_draw_indirect) #endif /* GL_ARB_multi_draw_indirect */ /* --------------------------- GL_ARB_multisample -------------------------- */ #ifndef GL_ARB_multisample #define GL_ARB_multisample 1 #define GL_MULTISAMPLE_ARB 0x809D #define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E #define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F #define GL_SAMPLE_COVERAGE_ARB 0x80A0 #define GL_SAMPLE_BUFFERS_ARB 0x80A8 #define GL_SAMPLES_ARB 0x80A9 #define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA #define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB #define GL_MULTISAMPLE_BIT_ARB 0x20000000 typedef void (GLAPIENTRY * PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert); #define glSampleCoverageARB GLEW_GET_FUN(__glewSampleCoverageARB) #define GLEW_ARB_multisample GLEW_GET_VAR(__GLEW_ARB_multisample) #endif /* GL_ARB_multisample */ /* -------------------------- GL_ARB_multitexture -------------------------- */ #ifndef GL_ARB_multitexture #define GL_ARB_multitexture 1 #define GL_TEXTURE0_ARB 0x84C0 #define GL_TEXTURE1_ARB 0x84C1 #define GL_TEXTURE2_ARB 0x84C2 #define GL_TEXTURE3_ARB 0x84C3 #define GL_TEXTURE4_ARB 0x84C4 #define GL_TEXTURE5_ARB 0x84C5 #define GL_TEXTURE6_ARB 0x84C6 #define GL_TEXTURE7_ARB 0x84C7 #define GL_TEXTURE8_ARB 0x84C8 #define GL_TEXTURE9_ARB 0x84C9 #define GL_TEXTURE10_ARB 0x84CA #define GL_TEXTURE11_ARB 0x84CB #define GL_TEXTURE12_ARB 0x84CC #define GL_TEXTURE13_ARB 0x84CD #define GL_TEXTURE14_ARB 0x84CE #define GL_TEXTURE15_ARB 0x84CF #define GL_TEXTURE16_ARB 0x84D0 #define GL_TEXTURE17_ARB 0x84D1 #define GL_TEXTURE18_ARB 0x84D2 #define GL_TEXTURE19_ARB 0x84D3 #define GL_TEXTURE20_ARB 0x84D4 #define GL_TEXTURE21_ARB 0x84D5 #define GL_TEXTURE22_ARB 0x84D6 #define GL_TEXTURE23_ARB 0x84D7 #define GL_TEXTURE24_ARB 0x84D8 #define GL_TEXTURE25_ARB 0x84D9 #define GL_TEXTURE26_ARB 0x84DA #define GL_TEXTURE27_ARB 0x84DB #define GL_TEXTURE28_ARB 0x84DC #define GL_TEXTURE29_ARB 0x84DD #define GL_TEXTURE30_ARB 0x84DE #define GL_TEXTURE31_ARB 0x84DF #define GL_ACTIVE_TEXTURE_ARB 0x84E0 #define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 #define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 typedef void (GLAPIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum texture); typedef void (GLAPIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); #define glActiveTextureARB GLEW_GET_FUN(__glewActiveTextureARB) #define glClientActiveTextureARB GLEW_GET_FUN(__glewClientActiveTextureARB) #define glMultiTexCoord1dARB GLEW_GET_FUN(__glewMultiTexCoord1dARB) #define glMultiTexCoord1dvARB GLEW_GET_FUN(__glewMultiTexCoord1dvARB) #define glMultiTexCoord1fARB GLEW_GET_FUN(__glewMultiTexCoord1fARB) #define glMultiTexCoord1fvARB GLEW_GET_FUN(__glewMultiTexCoord1fvARB) #define glMultiTexCoord1iARB GLEW_GET_FUN(__glewMultiTexCoord1iARB) #define glMultiTexCoord1ivARB GLEW_GET_FUN(__glewMultiTexCoord1ivARB) #define glMultiTexCoord1sARB GLEW_GET_FUN(__glewMultiTexCoord1sARB) #define glMultiTexCoord1svARB GLEW_GET_FUN(__glewMultiTexCoord1svARB) #define glMultiTexCoord2dARB GLEW_GET_FUN(__glewMultiTexCoord2dARB) #define glMultiTexCoord2dvARB GLEW_GET_FUN(__glewMultiTexCoord2dvARB) #define glMultiTexCoord2fARB GLEW_GET_FUN(__glewMultiTexCoord2fARB) #define glMultiTexCoord2fvARB GLEW_GET_FUN(__glewMultiTexCoord2fvARB) #define glMultiTexCoord2iARB GLEW_GET_FUN(__glewMultiTexCoord2iARB) #define glMultiTexCoord2ivARB GLEW_GET_FUN(__glewMultiTexCoord2ivARB) #define glMultiTexCoord2sARB GLEW_GET_FUN(__glewMultiTexCoord2sARB) #define glMultiTexCoord2svARB GLEW_GET_FUN(__glewMultiTexCoord2svARB) #define glMultiTexCoord3dARB GLEW_GET_FUN(__glewMultiTexCoord3dARB) #define glMultiTexCoord3dvARB GLEW_GET_FUN(__glewMultiTexCoord3dvARB) #define glMultiTexCoord3fARB GLEW_GET_FUN(__glewMultiTexCoord3fARB) #define glMultiTexCoord3fvARB GLEW_GET_FUN(__glewMultiTexCoord3fvARB) #define glMultiTexCoord3iARB GLEW_GET_FUN(__glewMultiTexCoord3iARB) #define glMultiTexCoord3ivARB GLEW_GET_FUN(__glewMultiTexCoord3ivARB) #define glMultiTexCoord3sARB GLEW_GET_FUN(__glewMultiTexCoord3sARB) #define glMultiTexCoord3svARB GLEW_GET_FUN(__glewMultiTexCoord3svARB) #define glMultiTexCoord4dARB GLEW_GET_FUN(__glewMultiTexCoord4dARB) #define glMultiTexCoord4dvARB GLEW_GET_FUN(__glewMultiTexCoord4dvARB) #define glMultiTexCoord4fARB GLEW_GET_FUN(__glewMultiTexCoord4fARB) #define glMultiTexCoord4fvARB GLEW_GET_FUN(__glewMultiTexCoord4fvARB) #define glMultiTexCoord4iARB GLEW_GET_FUN(__glewMultiTexCoord4iARB) #define glMultiTexCoord4ivARB GLEW_GET_FUN(__glewMultiTexCoord4ivARB) #define glMultiTexCoord4sARB GLEW_GET_FUN(__glewMultiTexCoord4sARB) #define glMultiTexCoord4svARB GLEW_GET_FUN(__glewMultiTexCoord4svARB) #define GLEW_ARB_multitexture GLEW_GET_VAR(__GLEW_ARB_multitexture) #endif /* GL_ARB_multitexture */ /* ------------------------- GL_ARB_occlusion_query ------------------------ */ #ifndef GL_ARB_occlusion_query #define GL_ARB_occlusion_query 1 #define GL_QUERY_COUNTER_BITS_ARB 0x8864 #define GL_CURRENT_QUERY_ARB 0x8865 #define GL_QUERY_RESULT_ARB 0x8866 #define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 #define GL_SAMPLES_PASSED_ARB 0x8914 typedef void (GLAPIENTRY * PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id); typedef void (GLAPIENTRY * PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint* ids); typedef void (GLAPIENTRY * PFNGLENDQUERYARBPROC) (GLenum target); typedef void (GLAPIENTRY * PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint* ids); typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint* params); typedef void (GLAPIENTRY * PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint* params); typedef GLboolean (GLAPIENTRY * PFNGLISQUERYARBPROC) (GLuint id); #define glBeginQueryARB GLEW_GET_FUN(__glewBeginQueryARB) #define glDeleteQueriesARB GLEW_GET_FUN(__glewDeleteQueriesARB) #define glEndQueryARB GLEW_GET_FUN(__glewEndQueryARB) #define glGenQueriesARB GLEW_GET_FUN(__glewGenQueriesARB) #define glGetQueryObjectivARB GLEW_GET_FUN(__glewGetQueryObjectivARB) #define glGetQueryObjectuivARB GLEW_GET_FUN(__glewGetQueryObjectuivARB) #define glGetQueryivARB GLEW_GET_FUN(__glewGetQueryivARB) #define glIsQueryARB GLEW_GET_FUN(__glewIsQueryARB) #define GLEW_ARB_occlusion_query GLEW_GET_VAR(__GLEW_ARB_occlusion_query) #endif /* GL_ARB_occlusion_query */ /* ------------------------ GL_ARB_occlusion_query2 ------------------------ */ #ifndef GL_ARB_occlusion_query2 #define GL_ARB_occlusion_query2 1 #define GL_ANY_SAMPLES_PASSED 0x8C2F #define GLEW_ARB_occlusion_query2 GLEW_GET_VAR(__GLEW_ARB_occlusion_query2) #endif /* GL_ARB_occlusion_query2 */ /* ----------------------- GL_ARB_pixel_buffer_object ---------------------- */ #ifndef GL_ARB_pixel_buffer_object #define GL_ARB_pixel_buffer_object 1 #define GL_PIXEL_PACK_BUFFER_ARB 0x88EB #define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC #define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED #define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF #define GLEW_ARB_pixel_buffer_object GLEW_GET_VAR(__GLEW_ARB_pixel_buffer_object) #endif /* GL_ARB_pixel_buffer_object */ /* ------------------------ GL_ARB_point_parameters ------------------------ */ #ifndef GL_ARB_point_parameters #define GL_ARB_point_parameters 1 #define GL_POINT_SIZE_MIN_ARB 0x8126 #define GL_POINT_SIZE_MAX_ARB 0x8127 #define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 #define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param); typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat* params); #define glPointParameterfARB GLEW_GET_FUN(__glewPointParameterfARB) #define glPointParameterfvARB GLEW_GET_FUN(__glewPointParameterfvARB) #define GLEW_ARB_point_parameters GLEW_GET_VAR(__GLEW_ARB_point_parameters) #endif /* GL_ARB_point_parameters */ /* -------------------------- GL_ARB_point_sprite -------------------------- */ #ifndef GL_ARB_point_sprite #define GL_ARB_point_sprite 1 #define GL_POINT_SPRITE_ARB 0x8861 #define GL_COORD_REPLACE_ARB 0x8862 #define GLEW_ARB_point_sprite GLEW_GET_VAR(__GLEW_ARB_point_sprite) #endif /* GL_ARB_point_sprite */ /* --------------------- GL_ARB_program_interface_query -------------------- */ #ifndef GL_ARB_program_interface_query #define GL_ARB_program_interface_query 1 #define GL_UNIFORM 0x92E1 #define GL_UNIFORM_BLOCK 0x92E2 #define GL_PROGRAM_INPUT 0x92E3 #define GL_PROGRAM_OUTPUT 0x92E4 #define GL_BUFFER_VARIABLE 0x92E5 #define GL_SHADER_STORAGE_BLOCK 0x92E6 #define GL_IS_PER_PATCH 0x92E7 #define GL_VERTEX_SUBROUTINE 0x92E8 #define GL_TESS_CONTROL_SUBROUTINE 0x92E9 #define GL_TESS_EVALUATION_SUBROUTINE 0x92EA #define GL_GEOMETRY_SUBROUTINE 0x92EB #define GL_FRAGMENT_SUBROUTINE 0x92EC #define GL_COMPUTE_SUBROUTINE 0x92ED #define GL_VERTEX_SUBROUTINE_UNIFORM 0x92EE #define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF #define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0 #define GL_GEOMETRY_SUBROUTINE_UNIFORM 0x92F1 #define GL_FRAGMENT_SUBROUTINE_UNIFORM 0x92F2 #define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3 #define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4 #define GL_ACTIVE_RESOURCES 0x92F5 #define GL_MAX_NAME_LENGTH 0x92F6 #define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7 #define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8 #define GL_NAME_LENGTH 0x92F9 #define GL_TYPE 0x92FA #define GL_ARRAY_SIZE 0x92FB #define GL_OFFSET 0x92FC #define GL_BLOCK_INDEX 0x92FD #define GL_ARRAY_STRIDE 0x92FE #define GL_MATRIX_STRIDE 0x92FF #define GL_IS_ROW_MAJOR 0x9300 #define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301 #define GL_BUFFER_BINDING 0x9302 #define GL_BUFFER_DATA_SIZE 0x9303 #define GL_NUM_ACTIVE_VARIABLES 0x9304 #define GL_ACTIVE_VARIABLES 0x9305 #define GL_REFERENCED_BY_VERTEX_SHADER 0x9306 #define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307 #define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308 #define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309 #define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A #define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B #define GL_TOP_LEVEL_ARRAY_SIZE 0x930C #define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D #define GL_LOCATION 0x930E #define GL_LOCATION_INDEX 0x930F typedef void (GLAPIENTRY * PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint* params); typedef GLuint (GLAPIENTRY * PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar* name); typedef GLint (GLAPIENTRY * PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar* name); typedef GLint (GLAPIENTRY * PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar* name); typedef void (GLAPIENTRY * PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei* length, GLchar *name); typedef void (GLAPIENTRY * PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum* props, GLsizei bufSize, GLsizei *length, GLint *params); #define glGetProgramInterfaceiv GLEW_GET_FUN(__glewGetProgramInterfaceiv) #define glGetProgramResourceIndex GLEW_GET_FUN(__glewGetProgramResourceIndex) #define glGetProgramResourceLocation GLEW_GET_FUN(__glewGetProgramResourceLocation) #define glGetProgramResourceLocationIndex GLEW_GET_FUN(__glewGetProgramResourceLocationIndex) #define glGetProgramResourceName GLEW_GET_FUN(__glewGetProgramResourceName) #define glGetProgramResourceiv GLEW_GET_FUN(__glewGetProgramResourceiv) #define GLEW_ARB_program_interface_query GLEW_GET_VAR(__GLEW_ARB_program_interface_query) #endif /* GL_ARB_program_interface_query */ /* ------------------------ GL_ARB_provoking_vertex ------------------------ */ #ifndef GL_ARB_provoking_vertex #define GL_ARB_provoking_vertex 1 #define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C #define GL_FIRST_VERTEX_CONVENTION 0x8E4D #define GL_LAST_VERTEX_CONVENTION 0x8E4E #define GL_PROVOKING_VERTEX 0x8E4F typedef void (GLAPIENTRY * PFNGLPROVOKINGVERTEXPROC) (GLenum mode); #define glProvokingVertex GLEW_GET_FUN(__glewProvokingVertex) #define GLEW_ARB_provoking_vertex GLEW_GET_VAR(__GLEW_ARB_provoking_vertex) #endif /* GL_ARB_provoking_vertex */ /* ------------------ GL_ARB_robust_buffer_access_behavior ----------------- */ #ifndef GL_ARB_robust_buffer_access_behavior #define GL_ARB_robust_buffer_access_behavior 1 #define GLEW_ARB_robust_buffer_access_behavior GLEW_GET_VAR(__GLEW_ARB_robust_buffer_access_behavior) #endif /* GL_ARB_robust_buffer_access_behavior */ /* --------------------------- GL_ARB_robustness --------------------------- */ #ifndef GL_ARB_robustness #define GL_ARB_robustness 1 #define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004 #define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 #define GL_GUILTY_CONTEXT_RESET_ARB 0x8253 #define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254 #define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255 #define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 #define GL_NO_RESET_NOTIFICATION_ARB 0x8261 typedef GLenum (GLAPIENTRY * PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void); typedef void (GLAPIENTRY * PFNGLGETNCOLORTABLEARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void* table); typedef void (GLAPIENTRY * PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, void* img); typedef void (GLAPIENTRY * PFNGLGETNCONVOLUTIONFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void* image); typedef void (GLAPIENTRY * PFNGLGETNHISTOGRAMARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void* values); typedef void (GLAPIENTRY * PFNGLGETNMAPDVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble* v); typedef void (GLAPIENTRY * PFNGLGETNMAPFVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat* v); typedef void (GLAPIENTRY * PFNGLGETNMAPIVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint* v); typedef void (GLAPIENTRY * PFNGLGETNMINMAXARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void* values); typedef void (GLAPIENTRY * PFNGLGETNPIXELMAPFVARBPROC) (GLenum map, GLsizei bufSize, GLfloat* values); typedef void (GLAPIENTRY * PFNGLGETNPIXELMAPUIVARBPROC) (GLenum map, GLsizei bufSize, GLuint* values); typedef void (GLAPIENTRY * PFNGLGETNPIXELMAPUSVARBPROC) (GLenum map, GLsizei bufSize, GLushort* values); typedef void (GLAPIENTRY * PFNGLGETNPOLYGONSTIPPLEARBPROC) (GLsizei bufSize, GLubyte* pattern); typedef void (GLAPIENTRY * PFNGLGETNSEPARABLEFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void* row, GLsizei columnBufSize, GLvoid*column, GLvoid*span); typedef void (GLAPIENTRY * PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void* img); typedef void (GLAPIENTRY * PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble* params); typedef void (GLAPIENTRY * PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint* params); typedef void (GLAPIENTRY * PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint* params); typedef void (GLAPIENTRY * PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void* data); #define glGetGraphicsResetStatusARB GLEW_GET_FUN(__glewGetGraphicsResetStatusARB) #define glGetnColorTableARB GLEW_GET_FUN(__glewGetnColorTableARB) #define glGetnCompressedTexImageARB GLEW_GET_FUN(__glewGetnCompressedTexImageARB) #define glGetnConvolutionFilterARB GLEW_GET_FUN(__glewGetnConvolutionFilterARB) #define glGetnHistogramARB GLEW_GET_FUN(__glewGetnHistogramARB) #define glGetnMapdvARB GLEW_GET_FUN(__glewGetnMapdvARB) #define glGetnMapfvARB GLEW_GET_FUN(__glewGetnMapfvARB) #define glGetnMapivARB GLEW_GET_FUN(__glewGetnMapivARB) #define glGetnMinmaxARB GLEW_GET_FUN(__glewGetnMinmaxARB) #define glGetnPixelMapfvARB GLEW_GET_FUN(__glewGetnPixelMapfvARB) #define glGetnPixelMapuivARB GLEW_GET_FUN(__glewGetnPixelMapuivARB) #define glGetnPixelMapusvARB GLEW_GET_FUN(__glewGetnPixelMapusvARB) #define glGetnPolygonStippleARB GLEW_GET_FUN(__glewGetnPolygonStippleARB) #define glGetnSeparableFilterARB GLEW_GET_FUN(__glewGetnSeparableFilterARB) #define glGetnTexImageARB GLEW_GET_FUN(__glewGetnTexImageARB) #define glGetnUniformdvARB GLEW_GET_FUN(__glewGetnUniformdvARB) #define glGetnUniformfvARB GLEW_GET_FUN(__glewGetnUniformfvARB) #define glGetnUniformivARB GLEW_GET_FUN(__glewGetnUniformivARB) #define glGetnUniformuivARB GLEW_GET_FUN(__glewGetnUniformuivARB) #define glReadnPixelsARB GLEW_GET_FUN(__glewReadnPixelsARB) #define GLEW_ARB_robustness GLEW_GET_VAR(__GLEW_ARB_robustness) #endif /* GL_ARB_robustness */ /* ---------------- GL_ARB_robustness_application_isolation ---------------- */ #ifndef GL_ARB_robustness_application_isolation #define GL_ARB_robustness_application_isolation 1 #define GLEW_ARB_robustness_application_isolation GLEW_GET_VAR(__GLEW_ARB_robustness_application_isolation) #endif /* GL_ARB_robustness_application_isolation */ /* ---------------- GL_ARB_robustness_share_group_isolation ---------------- */ #ifndef GL_ARB_robustness_share_group_isolation #define GL_ARB_robustness_share_group_isolation 1 #define GLEW_ARB_robustness_share_group_isolation GLEW_GET_VAR(__GLEW_ARB_robustness_share_group_isolation) #endif /* GL_ARB_robustness_share_group_isolation */ /* ------------------------- GL_ARB_sample_shading ------------------------- */ #ifndef GL_ARB_sample_shading #define GL_ARB_sample_shading 1 #define GL_SAMPLE_SHADING_ARB 0x8C36 #define GL_MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37 typedef void (GLAPIENTRY * PFNGLMINSAMPLESHADINGARBPROC) (GLclampf value); #define glMinSampleShadingARB GLEW_GET_FUN(__glewMinSampleShadingARB) #define GLEW_ARB_sample_shading GLEW_GET_VAR(__GLEW_ARB_sample_shading) #endif /* GL_ARB_sample_shading */ /* ------------------------- GL_ARB_sampler_objects ------------------------ */ #ifndef GL_ARB_sampler_objects #define GL_ARB_sampler_objects 1 #define GL_SAMPLER_BINDING 0x8919 typedef void (GLAPIENTRY * PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler); typedef void (GLAPIENTRY * PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint * samplers); typedef void (GLAPIENTRY * PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint* samplers); typedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint* params); typedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint* params); typedef GLboolean (GLAPIENTRY * PFNGLISSAMPLERPROC) (GLuint sampler); typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint* params); typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint* params); typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param); typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param); typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint* params); #define glBindSampler GLEW_GET_FUN(__glewBindSampler) #define glDeleteSamplers GLEW_GET_FUN(__glewDeleteSamplers) #define glGenSamplers GLEW_GET_FUN(__glewGenSamplers) #define glGetSamplerParameterIiv GLEW_GET_FUN(__glewGetSamplerParameterIiv) #define glGetSamplerParameterIuiv GLEW_GET_FUN(__glewGetSamplerParameterIuiv) #define glGetSamplerParameterfv GLEW_GET_FUN(__glewGetSamplerParameterfv) #define glGetSamplerParameteriv GLEW_GET_FUN(__glewGetSamplerParameteriv) #define glIsSampler GLEW_GET_FUN(__glewIsSampler) #define glSamplerParameterIiv GLEW_GET_FUN(__glewSamplerParameterIiv) #define glSamplerParameterIuiv GLEW_GET_FUN(__glewSamplerParameterIuiv) #define glSamplerParameterf GLEW_GET_FUN(__glewSamplerParameterf) #define glSamplerParameterfv GLEW_GET_FUN(__glewSamplerParameterfv) #define glSamplerParameteri GLEW_GET_FUN(__glewSamplerParameteri) #define glSamplerParameteriv GLEW_GET_FUN(__glewSamplerParameteriv) #define GLEW_ARB_sampler_objects GLEW_GET_VAR(__GLEW_ARB_sampler_objects) #endif /* GL_ARB_sampler_objects */ /* ------------------------ GL_ARB_seamless_cube_map ----------------------- */ #ifndef GL_ARB_seamless_cube_map #define GL_ARB_seamless_cube_map 1 #define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F #define GLEW_ARB_seamless_cube_map GLEW_GET_VAR(__GLEW_ARB_seamless_cube_map) #endif /* GL_ARB_seamless_cube_map */ /* --------------------- GL_ARB_separate_shader_objects -------------------- */ #ifndef GL_ARB_separate_shader_objects #define GL_ARB_separate_shader_objects 1 #define GL_VERTEX_SHADER_BIT 0x00000001 #define GL_FRAGMENT_SHADER_BIT 0x00000002 #define GL_GEOMETRY_SHADER_BIT 0x00000004 #define GL_TESS_CONTROL_SHADER_BIT 0x00000008 #define GL_TESS_EVALUATION_SHADER_BIT 0x00000010 #define GL_PROGRAM_SEPARABLE 0x8258 #define GL_ACTIVE_PROGRAM 0x8259 #define GL_PROGRAM_PIPELINE_BINDING 0x825A #define GL_ALL_SHADER_BITS 0xFFFFFFFF typedef void (GLAPIENTRY * PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program); typedef void (GLAPIENTRY * PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline); typedef GLuint (GLAPIENTRY * PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar ** strings); typedef void (GLAPIENTRY * PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint* pipelines); typedef void (GLAPIENTRY * PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint* pipelines); typedef void (GLAPIENTRY * PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei* length, GLchar *infoLog); typedef void (GLAPIENTRY * PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint* params); typedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble x); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat x); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint x); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint x); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble x, GLdouble y); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat x, GLfloat y); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint x, GLint y); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint x, GLuint y); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint x, GLuint y, GLuint z); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint x, GLuint y, GLuint z, GLuint w); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program); typedef void (GLAPIENTRY * PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline); #define glActiveShaderProgram GLEW_GET_FUN(__glewActiveShaderProgram) #define glBindProgramPipeline GLEW_GET_FUN(__glewBindProgramPipeline) #define glCreateShaderProgramv GLEW_GET_FUN(__glewCreateShaderProgramv) #define glDeleteProgramPipelines GLEW_GET_FUN(__glewDeleteProgramPipelines) #define glGenProgramPipelines GLEW_GET_FUN(__glewGenProgramPipelines) #define glGetProgramPipelineInfoLog GLEW_GET_FUN(__glewGetProgramPipelineInfoLog) #define glGetProgramPipelineiv GLEW_GET_FUN(__glewGetProgramPipelineiv) #define glIsProgramPipeline GLEW_GET_FUN(__glewIsProgramPipeline) #define glProgramUniform1d GLEW_GET_FUN(__glewProgramUniform1d) #define glProgramUniform1dv GLEW_GET_FUN(__glewProgramUniform1dv) #define glProgramUniform1f GLEW_GET_FUN(__glewProgramUniform1f) #define glProgramUniform1fv GLEW_GET_FUN(__glewProgramUniform1fv) #define glProgramUniform1i GLEW_GET_FUN(__glewProgramUniform1i) #define glProgramUniform1iv GLEW_GET_FUN(__glewProgramUniform1iv) #define glProgramUniform1ui GLEW_GET_FUN(__glewProgramUniform1ui) #define glProgramUniform1uiv GLEW_GET_FUN(__glewProgramUniform1uiv) #define glProgramUniform2d GLEW_GET_FUN(__glewProgramUniform2d) #define glProgramUniform2dv GLEW_GET_FUN(__glewProgramUniform2dv) #define glProgramUniform2f GLEW_GET_FUN(__glewProgramUniform2f) #define glProgramUniform2fv GLEW_GET_FUN(__glewProgramUniform2fv) #define glProgramUniform2i GLEW_GET_FUN(__glewProgramUniform2i) #define glProgramUniform2iv GLEW_GET_FUN(__glewProgramUniform2iv) #define glProgramUniform2ui GLEW_GET_FUN(__glewProgramUniform2ui) #define glProgramUniform2uiv GLEW_GET_FUN(__glewProgramUniform2uiv) #define glProgramUniform3d GLEW_GET_FUN(__glewProgramUniform3d) #define glProgramUniform3dv GLEW_GET_FUN(__glewProgramUniform3dv) #define glProgramUniform3f GLEW_GET_FUN(__glewProgramUniform3f) #define glProgramUniform3fv GLEW_GET_FUN(__glewProgramUniform3fv) #define glProgramUniform3i GLEW_GET_FUN(__glewProgramUniform3i) #define glProgramUniform3iv GLEW_GET_FUN(__glewProgramUniform3iv) #define glProgramUniform3ui GLEW_GET_FUN(__glewProgramUniform3ui) #define glProgramUniform3uiv GLEW_GET_FUN(__glewProgramUniform3uiv) #define glProgramUniform4d GLEW_GET_FUN(__glewProgramUniform4d) #define glProgramUniform4dv GLEW_GET_FUN(__glewProgramUniform4dv) #define glProgramUniform4f GLEW_GET_FUN(__glewProgramUniform4f) #define glProgramUniform4fv GLEW_GET_FUN(__glewProgramUniform4fv) #define glProgramUniform4i GLEW_GET_FUN(__glewProgramUniform4i) #define glProgramUniform4iv GLEW_GET_FUN(__glewProgramUniform4iv) #define glProgramUniform4ui GLEW_GET_FUN(__glewProgramUniform4ui) #define glProgramUniform4uiv GLEW_GET_FUN(__glewProgramUniform4uiv) #define glProgramUniformMatrix2dv GLEW_GET_FUN(__glewProgramUniformMatrix2dv) #define glProgramUniformMatrix2fv GLEW_GET_FUN(__glewProgramUniformMatrix2fv) #define glProgramUniformMatrix2x3dv GLEW_GET_FUN(__glewProgramUniformMatrix2x3dv) #define glProgramUniformMatrix2x3fv GLEW_GET_FUN(__glewProgramUniformMatrix2x3fv) #define glProgramUniformMatrix2x4dv GLEW_GET_FUN(__glewProgramUniformMatrix2x4dv) #define glProgramUniformMatrix2x4fv GLEW_GET_FUN(__glewProgramUniformMatrix2x4fv) #define glProgramUniformMatrix3dv GLEW_GET_FUN(__glewProgramUniformMatrix3dv) #define glProgramUniformMatrix3fv GLEW_GET_FUN(__glewProgramUniformMatrix3fv) #define glProgramUniformMatrix3x2dv GLEW_GET_FUN(__glewProgramUniformMatrix3x2dv) #define glProgramUniformMatrix3x2fv GLEW_GET_FUN(__glewProgramUniformMatrix3x2fv) #define glProgramUniformMatrix3x4dv GLEW_GET_FUN(__glewProgramUniformMatrix3x4dv) #define glProgramUniformMatrix3x4fv GLEW_GET_FUN(__glewProgramUniformMatrix3x4fv) #define glProgramUniformMatrix4dv GLEW_GET_FUN(__glewProgramUniformMatrix4dv) #define glProgramUniformMatrix4fv GLEW_GET_FUN(__glewProgramUniformMatrix4fv) #define glProgramUniformMatrix4x2dv GLEW_GET_FUN(__glewProgramUniformMatrix4x2dv) #define glProgramUniformMatrix4x2fv GLEW_GET_FUN(__glewProgramUniformMatrix4x2fv) #define glProgramUniformMatrix4x3dv GLEW_GET_FUN(__glewProgramUniformMatrix4x3dv) #define glProgramUniformMatrix4x3fv GLEW_GET_FUN(__glewProgramUniformMatrix4x3fv) #define glUseProgramStages GLEW_GET_FUN(__glewUseProgramStages) #define glValidateProgramPipeline GLEW_GET_FUN(__glewValidateProgramPipeline) #define GLEW_ARB_separate_shader_objects GLEW_GET_VAR(__GLEW_ARB_separate_shader_objects) #endif /* GL_ARB_separate_shader_objects */ /* --------------------- GL_ARB_shader_atomic_counters --------------------- */ #ifndef GL_ARB_shader_atomic_counters #define GL_ARB_shader_atomic_counters 1 #define GL_ATOMIC_COUNTER_BUFFER 0x92C0 #define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1 #define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2 #define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3 #define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4 #define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5 #define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6 #define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7 #define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8 #define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9 #define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA #define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB #define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC #define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD #define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE #define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF #define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0 #define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1 #define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2 #define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3 #define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4 #define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5 #define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6 #define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7 #define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8 #define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9 #define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA #define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB #define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC typedef void (GLAPIENTRY * PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint* params); #define glGetActiveAtomicCounterBufferiv GLEW_GET_FUN(__glewGetActiveAtomicCounterBufferiv) #define GLEW_ARB_shader_atomic_counters GLEW_GET_VAR(__GLEW_ARB_shader_atomic_counters) #endif /* GL_ARB_shader_atomic_counters */ /* ----------------------- GL_ARB_shader_bit_encoding ---------------------- */ #ifndef GL_ARB_shader_bit_encoding #define GL_ARB_shader_bit_encoding 1 #define GLEW_ARB_shader_bit_encoding GLEW_GET_VAR(__GLEW_ARB_shader_bit_encoding) #endif /* GL_ARB_shader_bit_encoding */ /* --------------------- GL_ARB_shader_image_load_store -------------------- */ #ifndef GL_ARB_shader_image_load_store #define GL_ARB_shader_image_load_store 1 #define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001 #define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002 #define GL_UNIFORM_BARRIER_BIT 0x00000004 #define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008 #define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020 #define GL_COMMAND_BARRIER_BIT 0x00000040 #define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080 #define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100 #define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200 #define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400 #define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800 #define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000 #define GL_MAX_IMAGE_UNITS 0x8F38 #define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39 #define GL_IMAGE_BINDING_NAME 0x8F3A #define GL_IMAGE_BINDING_LEVEL 0x8F3B #define GL_IMAGE_BINDING_LAYERED 0x8F3C #define GL_IMAGE_BINDING_LAYER 0x8F3D #define GL_IMAGE_BINDING_ACCESS 0x8F3E #define GL_IMAGE_1D 0x904C #define GL_IMAGE_2D 0x904D #define GL_IMAGE_3D 0x904E #define GL_IMAGE_2D_RECT 0x904F #define GL_IMAGE_CUBE 0x9050 #define GL_IMAGE_BUFFER 0x9051 #define GL_IMAGE_1D_ARRAY 0x9052 #define GL_IMAGE_2D_ARRAY 0x9053 #define GL_IMAGE_CUBE_MAP_ARRAY 0x9054 #define GL_IMAGE_2D_MULTISAMPLE 0x9055 #define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056 #define GL_INT_IMAGE_1D 0x9057 #define GL_INT_IMAGE_2D 0x9058 #define GL_INT_IMAGE_3D 0x9059 #define GL_INT_IMAGE_2D_RECT 0x905A #define GL_INT_IMAGE_CUBE 0x905B #define GL_INT_IMAGE_BUFFER 0x905C #define GL_INT_IMAGE_1D_ARRAY 0x905D #define GL_INT_IMAGE_2D_ARRAY 0x905E #define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F #define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060 #define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061 #define GL_UNSIGNED_INT_IMAGE_1D 0x9062 #define GL_UNSIGNED_INT_IMAGE_2D 0x9063 #define GL_UNSIGNED_INT_IMAGE_3D 0x9064 #define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065 #define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066 #define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067 #define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068 #define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069 #define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A #define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B #define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C #define GL_MAX_IMAGE_SAMPLES 0x906D #define GL_IMAGE_BINDING_FORMAT 0x906E #define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7 #define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8 #define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9 #define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA #define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB #define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC #define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD #define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE #define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF #define GL_ALL_BARRIER_BITS 0xFFFFFFFF typedef void (GLAPIENTRY * PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); typedef void (GLAPIENTRY * PFNGLMEMORYBARRIERPROC) (GLbitfield barriers); #define glBindImageTexture GLEW_GET_FUN(__glewBindImageTexture) #define glMemoryBarrier GLEW_GET_FUN(__glewMemoryBarrier) #define GLEW_ARB_shader_image_load_store GLEW_GET_VAR(__GLEW_ARB_shader_image_load_store) #endif /* GL_ARB_shader_image_load_store */ /* ------------------------ GL_ARB_shader_image_size ----------------------- */ #ifndef GL_ARB_shader_image_size #define GL_ARB_shader_image_size 1 #define GLEW_ARB_shader_image_size GLEW_GET_VAR(__GLEW_ARB_shader_image_size) #endif /* GL_ARB_shader_image_size */ /* ------------------------- GL_ARB_shader_objects ------------------------- */ #ifndef GL_ARB_shader_objects #define GL_ARB_shader_objects 1 #define GL_PROGRAM_OBJECT_ARB 0x8B40 #define GL_SHADER_OBJECT_ARB 0x8B48 #define GL_OBJECT_TYPE_ARB 0x8B4E #define GL_OBJECT_SUBTYPE_ARB 0x8B4F #define GL_FLOAT_VEC2_ARB 0x8B50 #define GL_FLOAT_VEC3_ARB 0x8B51 #define GL_FLOAT_VEC4_ARB 0x8B52 #define GL_INT_VEC2_ARB 0x8B53 #define GL_INT_VEC3_ARB 0x8B54 #define GL_INT_VEC4_ARB 0x8B55 #define GL_BOOL_ARB 0x8B56 #define GL_BOOL_VEC2_ARB 0x8B57 #define GL_BOOL_VEC3_ARB 0x8B58 #define GL_BOOL_VEC4_ARB 0x8B59 #define GL_FLOAT_MAT2_ARB 0x8B5A #define GL_FLOAT_MAT3_ARB 0x8B5B #define GL_FLOAT_MAT4_ARB 0x8B5C #define GL_SAMPLER_1D_ARB 0x8B5D #define GL_SAMPLER_2D_ARB 0x8B5E #define GL_SAMPLER_3D_ARB 0x8B5F #define GL_SAMPLER_CUBE_ARB 0x8B60 #define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 #define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 #define GL_SAMPLER_2D_RECT_ARB 0x8B63 #define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 #define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 #define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 #define GL_OBJECT_LINK_STATUS_ARB 0x8B82 #define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 #define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 #define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 #define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 #define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 #define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 typedef char GLcharARB; typedef unsigned int GLhandleARB; typedef void (GLAPIENTRY * PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj); typedef void (GLAPIENTRY * PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj); typedef GLhandleARB (GLAPIENTRY * PFNGLCREATEPROGRAMOBJECTARBPROC) (void); typedef GLhandleARB (GLAPIENTRY * PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType); typedef void (GLAPIENTRY * PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj); typedef void (GLAPIENTRY * PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj); typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei* length, GLint *size, GLenum *type, GLcharARB *name); typedef void (GLAPIENTRY * PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei* count, GLhandleARB *obj); typedef GLhandleARB (GLAPIENTRY * PFNGLGETHANDLEARBPROC) (GLenum pname); typedef void (GLAPIENTRY * PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei* length, GLcharARB *infoLog); typedef void (GLAPIENTRY * PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei* length, GLcharARB *source); typedef GLint (GLAPIENTRY * PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB* name); typedef void (GLAPIENTRY * PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint* params); typedef void (GLAPIENTRY * PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj); typedef void (GLAPIENTRY * PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB ** string, const GLint *length); typedef void (GLAPIENTRY * PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0); typedef void (GLAPIENTRY * PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0); typedef void (GLAPIENTRY * PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint* value); typedef void (GLAPIENTRY * PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1); typedef void (GLAPIENTRY * PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1); typedef void (GLAPIENTRY * PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint* value); typedef void (GLAPIENTRY * PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); typedef void (GLAPIENTRY * PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2); typedef void (GLAPIENTRY * PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint* value); typedef void (GLAPIENTRY * PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); typedef void (GLAPIENTRY * PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); typedef void (GLAPIENTRY * PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint* value); typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj); typedef void (GLAPIENTRY * PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj); #define glAttachObjectARB GLEW_GET_FUN(__glewAttachObjectARB) #define glCompileShaderARB GLEW_GET_FUN(__glewCompileShaderARB) #define glCreateProgramObjectARB GLEW_GET_FUN(__glewCreateProgramObjectARB) #define glCreateShaderObjectARB GLEW_GET_FUN(__glewCreateShaderObjectARB) #define glDeleteObjectARB GLEW_GET_FUN(__glewDeleteObjectARB) #define glDetachObjectARB GLEW_GET_FUN(__glewDetachObjectARB) #define glGetActiveUniformARB GLEW_GET_FUN(__glewGetActiveUniformARB) #define glGetAttachedObjectsARB GLEW_GET_FUN(__glewGetAttachedObjectsARB) #define glGetHandleARB GLEW_GET_FUN(__glewGetHandleARB) #define glGetInfoLogARB GLEW_GET_FUN(__glewGetInfoLogARB) #define glGetObjectParameterfvARB GLEW_GET_FUN(__glewGetObjectParameterfvARB) #define glGetObjectParameterivARB GLEW_GET_FUN(__glewGetObjectParameterivARB) #define glGetShaderSourceARB GLEW_GET_FUN(__glewGetShaderSourceARB) #define glGetUniformLocationARB GLEW_GET_FUN(__glewGetUniformLocationARB) #define glGetUniformfvARB GLEW_GET_FUN(__glewGetUniformfvARB) #define glGetUniformivARB GLEW_GET_FUN(__glewGetUniformivARB) #define glLinkProgramARB GLEW_GET_FUN(__glewLinkProgramARB) #define glShaderSourceARB GLEW_GET_FUN(__glewShaderSourceARB) #define glUniform1fARB GLEW_GET_FUN(__glewUniform1fARB) #define glUniform1fvARB GLEW_GET_FUN(__glewUniform1fvARB) #define glUniform1iARB GLEW_GET_FUN(__glewUniform1iARB) #define glUniform1ivARB GLEW_GET_FUN(__glewUniform1ivARB) #define glUniform2fARB GLEW_GET_FUN(__glewUniform2fARB) #define glUniform2fvARB GLEW_GET_FUN(__glewUniform2fvARB) #define glUniform2iARB GLEW_GET_FUN(__glewUniform2iARB) #define glUniform2ivARB GLEW_GET_FUN(__glewUniform2ivARB) #define glUniform3fARB GLEW_GET_FUN(__glewUniform3fARB) #define glUniform3fvARB GLEW_GET_FUN(__glewUniform3fvARB) #define glUniform3iARB GLEW_GET_FUN(__glewUniform3iARB) #define glUniform3ivARB GLEW_GET_FUN(__glewUniform3ivARB) #define glUniform4fARB GLEW_GET_FUN(__glewUniform4fARB) #define glUniform4fvARB GLEW_GET_FUN(__glewUniform4fvARB) #define glUniform4iARB GLEW_GET_FUN(__glewUniform4iARB) #define glUniform4ivARB GLEW_GET_FUN(__glewUniform4ivARB) #define glUniformMatrix2fvARB GLEW_GET_FUN(__glewUniformMatrix2fvARB) #define glUniformMatrix3fvARB GLEW_GET_FUN(__glewUniformMatrix3fvARB) #define glUniformMatrix4fvARB GLEW_GET_FUN(__glewUniformMatrix4fvARB) #define glUseProgramObjectARB GLEW_GET_FUN(__glewUseProgramObjectARB) #define glValidateProgramARB GLEW_GET_FUN(__glewValidateProgramARB) #define GLEW_ARB_shader_objects GLEW_GET_VAR(__GLEW_ARB_shader_objects) #endif /* GL_ARB_shader_objects */ /* ------------------------ GL_ARB_shader_precision ------------------------ */ #ifndef GL_ARB_shader_precision #define GL_ARB_shader_precision 1 #define GLEW_ARB_shader_precision GLEW_GET_VAR(__GLEW_ARB_shader_precision) #endif /* GL_ARB_shader_precision */ /* ---------------------- GL_ARB_shader_stencil_export --------------------- */ #ifndef GL_ARB_shader_stencil_export #define GL_ARB_shader_stencil_export 1 #define GLEW_ARB_shader_stencil_export GLEW_GET_VAR(__GLEW_ARB_shader_stencil_export) #endif /* GL_ARB_shader_stencil_export */ /* ------------------ GL_ARB_shader_storage_buffer_object ------------------ */ #ifndef GL_ARB_shader_storage_buffer_object #define GL_ARB_shader_storage_buffer_object 1 #define GL_SHADER_STORAGE_BARRIER_BIT 0x2000 #define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39 #define GL_SHADER_STORAGE_BUFFER 0x90D2 #define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3 #define GL_SHADER_STORAGE_BUFFER_START 0x90D4 #define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5 #define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6 #define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7 #define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8 #define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9 #define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA #define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB #define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC #define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD #define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE #define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF typedef void (GLAPIENTRY * PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); #define glShaderStorageBlockBinding GLEW_GET_FUN(__glewShaderStorageBlockBinding) #define GLEW_ARB_shader_storage_buffer_object GLEW_GET_VAR(__GLEW_ARB_shader_storage_buffer_object) #endif /* GL_ARB_shader_storage_buffer_object */ /* ------------------------ GL_ARB_shader_subroutine ----------------------- */ #ifndef GL_ARB_shader_subroutine #define GL_ARB_shader_subroutine 1 #define GL_ACTIVE_SUBROUTINES 0x8DE5 #define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6 #define GL_MAX_SUBROUTINES 0x8DE7 #define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8 #define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47 #define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48 #define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49 #define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A #define GL_COMPATIBLE_SUBROUTINES 0x8E4B typedef void (GLAPIENTRY * PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei* length, GLchar *name); typedef void (GLAPIENTRY * PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei* length, GLchar *name); typedef void (GLAPIENTRY * PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint* values); typedef void (GLAPIENTRY * PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint* values); typedef GLuint (GLAPIENTRY * PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar* name); typedef GLint (GLAPIENTRY * PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar* name); typedef void (GLAPIENTRY * PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint* params); typedef void (GLAPIENTRY * PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint* indices); #define glGetActiveSubroutineName GLEW_GET_FUN(__glewGetActiveSubroutineName) #define glGetActiveSubroutineUniformName GLEW_GET_FUN(__glewGetActiveSubroutineUniformName) #define glGetActiveSubroutineUniformiv GLEW_GET_FUN(__glewGetActiveSubroutineUniformiv) #define glGetProgramStageiv GLEW_GET_FUN(__glewGetProgramStageiv) #define glGetSubroutineIndex GLEW_GET_FUN(__glewGetSubroutineIndex) #define glGetSubroutineUniformLocation GLEW_GET_FUN(__glewGetSubroutineUniformLocation) #define glGetUniformSubroutineuiv GLEW_GET_FUN(__glewGetUniformSubroutineuiv) #define glUniformSubroutinesuiv GLEW_GET_FUN(__glewUniformSubroutinesuiv) #define GLEW_ARB_shader_subroutine GLEW_GET_VAR(__GLEW_ARB_shader_subroutine) #endif /* GL_ARB_shader_subroutine */ /* ----------------------- GL_ARB_shader_texture_lod ----------------------- */ #ifndef GL_ARB_shader_texture_lod #define GL_ARB_shader_texture_lod 1 #define GLEW_ARB_shader_texture_lod GLEW_GET_VAR(__GLEW_ARB_shader_texture_lod) #endif /* GL_ARB_shader_texture_lod */ /* ---------------------- GL_ARB_shading_language_100 ---------------------- */ #ifndef GL_ARB_shading_language_100 #define GL_ARB_shading_language_100 1 #define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C #define GLEW_ARB_shading_language_100 GLEW_GET_VAR(__GLEW_ARB_shading_language_100) #endif /* GL_ARB_shading_language_100 */ /* -------------------- GL_ARB_shading_language_420pack -------------------- */ #ifndef GL_ARB_shading_language_420pack #define GL_ARB_shading_language_420pack 1 #define GLEW_ARB_shading_language_420pack GLEW_GET_VAR(__GLEW_ARB_shading_language_420pack) #endif /* GL_ARB_shading_language_420pack */ /* -------------------- GL_ARB_shading_language_include -------------------- */ #ifndef GL_ARB_shading_language_include #define GL_ARB_shading_language_include 1 #define GL_SHADER_INCLUDE_ARB 0x8DAE #define GL_NAMED_STRING_LENGTH_ARB 0x8DE9 #define GL_NAMED_STRING_TYPE_ARB 0x8DEA typedef void (GLAPIENTRY * PFNGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar ** path, const GLint *length); typedef void (GLAPIENTRY * PFNGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar* name); typedef void (GLAPIENTRY * PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar* name, GLsizei bufSize, GLint *stringlen, GLchar *string); typedef void (GLAPIENTRY * PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar* name, GLenum pname, GLint *params); typedef GLboolean (GLAPIENTRY * PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar* name); typedef void (GLAPIENTRY * PFNGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar* name, GLint stringlen, const GLchar *string); #define glCompileShaderIncludeARB GLEW_GET_FUN(__glewCompileShaderIncludeARB) #define glDeleteNamedStringARB GLEW_GET_FUN(__glewDeleteNamedStringARB) #define glGetNamedStringARB GLEW_GET_FUN(__glewGetNamedStringARB) #define glGetNamedStringivARB GLEW_GET_FUN(__glewGetNamedStringivARB) #define glIsNamedStringARB GLEW_GET_FUN(__glewIsNamedStringARB) #define glNamedStringARB GLEW_GET_FUN(__glewNamedStringARB) #define GLEW_ARB_shading_language_include GLEW_GET_VAR(__GLEW_ARB_shading_language_include) #endif /* GL_ARB_shading_language_include */ /* -------------------- GL_ARB_shading_language_packing -------------------- */ #ifndef GL_ARB_shading_language_packing #define GL_ARB_shading_language_packing 1 #define GLEW_ARB_shading_language_packing GLEW_GET_VAR(__GLEW_ARB_shading_language_packing) #endif /* GL_ARB_shading_language_packing */ /* ----------------------------- GL_ARB_shadow ----------------------------- */ #ifndef GL_ARB_shadow #define GL_ARB_shadow 1 #define GL_TEXTURE_COMPARE_MODE_ARB 0x884C #define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D #define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E #define GLEW_ARB_shadow GLEW_GET_VAR(__GLEW_ARB_shadow) #endif /* GL_ARB_shadow */ /* ------------------------- GL_ARB_shadow_ambient ------------------------- */ #ifndef GL_ARB_shadow_ambient #define GL_ARB_shadow_ambient 1 #define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF #define GLEW_ARB_shadow_ambient GLEW_GET_VAR(__GLEW_ARB_shadow_ambient) #endif /* GL_ARB_shadow_ambient */ /* ------------------------ GL_ARB_stencil_texturing ----------------------- */ #ifndef GL_ARB_stencil_texturing #define GL_ARB_stencil_texturing 1 #define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA #define GLEW_ARB_stencil_texturing GLEW_GET_VAR(__GLEW_ARB_stencil_texturing) #endif /* GL_ARB_stencil_texturing */ /* ------------------------------ GL_ARB_sync ------------------------------ */ #ifndef GL_ARB_sync #define GL_ARB_sync 1 #define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 #define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 #define GL_OBJECT_TYPE 0x9112 #define GL_SYNC_CONDITION 0x9113 #define GL_SYNC_STATUS 0x9114 #define GL_SYNC_FLAGS 0x9115 #define GL_SYNC_FENCE 0x9116 #define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 #define GL_UNSIGNALED 0x9118 #define GL_SIGNALED 0x9119 #define GL_ALREADY_SIGNALED 0x911A #define GL_TIMEOUT_EXPIRED 0x911B #define GL_CONDITION_SATISFIED 0x911C #define GL_WAIT_FAILED 0x911D #define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFF typedef GLenum (GLAPIENTRY * PFNGLCLIENTWAITSYNCPROC) (GLsync GLsync,GLbitfield flags,GLuint64 timeout); typedef void (GLAPIENTRY * PFNGLDELETESYNCPROC) (GLsync GLsync); typedef GLsync (GLAPIENTRY * PFNGLFENCESYNCPROC) (GLenum condition,GLbitfield flags); typedef void (GLAPIENTRY * PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64* params); typedef void (GLAPIENTRY * PFNGLGETSYNCIVPROC) (GLsync GLsync,GLenum pname,GLsizei bufSize,GLsizei* length, GLint *values); typedef GLboolean (GLAPIENTRY * PFNGLISSYNCPROC) (GLsync GLsync); typedef void (GLAPIENTRY * PFNGLWAITSYNCPROC) (GLsync GLsync,GLbitfield flags,GLuint64 timeout); #define glClientWaitSync GLEW_GET_FUN(__glewClientWaitSync) #define glDeleteSync GLEW_GET_FUN(__glewDeleteSync) #define glFenceSync GLEW_GET_FUN(__glewFenceSync) #define glGetInteger64v GLEW_GET_FUN(__glewGetInteger64v) #define glGetSynciv GLEW_GET_FUN(__glewGetSynciv) #define glIsSync GLEW_GET_FUN(__glewIsSync) #define glWaitSync GLEW_GET_FUN(__glewWaitSync) #define GLEW_ARB_sync GLEW_GET_VAR(__GLEW_ARB_sync) #endif /* GL_ARB_sync */ /* ----------------------- GL_ARB_tessellation_shader ---------------------- */ #ifndef GL_ARB_tessellation_shader #define GL_ARB_tessellation_shader 1 #define GL_PATCHES 0xE #define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0 #define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1 #define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C #define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D #define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E #define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F #define GL_PATCH_VERTICES 0x8E72 #define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73 #define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74 #define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75 #define GL_TESS_GEN_MODE 0x8E76 #define GL_TESS_GEN_SPACING 0x8E77 #define GL_TESS_GEN_VERTEX_ORDER 0x8E78 #define GL_TESS_GEN_POINT_MODE 0x8E79 #define GL_ISOLINES 0x8E7A #define GL_FRACTIONAL_ODD 0x8E7B #define GL_FRACTIONAL_EVEN 0x8E7C #define GL_MAX_PATCH_VERTICES 0x8E7D #define GL_MAX_TESS_GEN_LEVEL 0x8E7E #define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F #define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80 #define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81 #define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82 #define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83 #define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84 #define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85 #define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86 #define GL_TESS_EVALUATION_SHADER 0x8E87 #define GL_TESS_CONTROL_SHADER 0x8E88 #define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89 #define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A typedef void (GLAPIENTRY * PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat* values); typedef void (GLAPIENTRY * PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value); #define glPatchParameterfv GLEW_GET_FUN(__glewPatchParameterfv) #define glPatchParameteri GLEW_GET_FUN(__glewPatchParameteri) #define GLEW_ARB_tessellation_shader GLEW_GET_VAR(__GLEW_ARB_tessellation_shader) #endif /* GL_ARB_tessellation_shader */ /* ---------------------- GL_ARB_texture_border_clamp ---------------------- */ #ifndef GL_ARB_texture_border_clamp #define GL_ARB_texture_border_clamp 1 #define GL_CLAMP_TO_BORDER_ARB 0x812D #define GLEW_ARB_texture_border_clamp GLEW_GET_VAR(__GLEW_ARB_texture_border_clamp) #endif /* GL_ARB_texture_border_clamp */ /* ---------------------- GL_ARB_texture_buffer_object --------------------- */ #ifndef GL_ARB_texture_buffer_object #define GL_ARB_texture_buffer_object 1 #define GL_TEXTURE_BUFFER_ARB 0x8C2A #define GL_MAX_TEXTURE_BUFFER_SIZE_ARB 0x8C2B #define GL_TEXTURE_BINDING_BUFFER_ARB 0x8C2C #define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB 0x8C2D #define GL_TEXTURE_BUFFER_FORMAT_ARB 0x8C2E typedef void (GLAPIENTRY * PFNGLTEXBUFFERARBPROC) (GLenum target, GLenum internalformat, GLuint buffer); #define glTexBufferARB GLEW_GET_FUN(__glewTexBufferARB) #define GLEW_ARB_texture_buffer_object GLEW_GET_VAR(__GLEW_ARB_texture_buffer_object) #endif /* GL_ARB_texture_buffer_object */ /* ------------------- GL_ARB_texture_buffer_object_rgb32 ------------------ */ #ifndef GL_ARB_texture_buffer_object_rgb32 #define GL_ARB_texture_buffer_object_rgb32 1 #define GLEW_ARB_texture_buffer_object_rgb32 GLEW_GET_VAR(__GLEW_ARB_texture_buffer_object_rgb32) #endif /* GL_ARB_texture_buffer_object_rgb32 */ /* ---------------------- GL_ARB_texture_buffer_range ---------------------- */ #ifndef GL_ARB_texture_buffer_range #define GL_ARB_texture_buffer_range 1 #define GL_TEXTURE_BUFFER_OFFSET 0x919D #define GL_TEXTURE_BUFFER_SIZE 0x919E #define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F typedef void (GLAPIENTRY * PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); typedef void (GLAPIENTRY * PFNGLTEXTUREBUFFERRANGEEXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); #define glTexBufferRange GLEW_GET_FUN(__glewTexBufferRange) #define glTextureBufferRangeEXT GLEW_GET_FUN(__glewTextureBufferRangeEXT) #define GLEW_ARB_texture_buffer_range GLEW_GET_VAR(__GLEW_ARB_texture_buffer_range) #endif /* GL_ARB_texture_buffer_range */ /* ----------------------- GL_ARB_texture_compression ---------------------- */ #ifndef GL_ARB_texture_compression #define GL_ARB_texture_compression 1 #define GL_COMPRESSED_ALPHA_ARB 0x84E9 #define GL_COMPRESSED_LUMINANCE_ARB 0x84EA #define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB #define GL_COMPRESSED_INTENSITY_ARB 0x84EC #define GL_COMPRESSED_RGB_ARB 0x84ED #define GL_COMPRESSED_RGBA_ARB 0x84EE #define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF #define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 #define GL_TEXTURE_COMPRESSED_ARB 0x86A1 #define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 #define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void* data); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void* data); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data); typedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, void* img); #define glCompressedTexImage1DARB GLEW_GET_FUN(__glewCompressedTexImage1DARB) #define glCompressedTexImage2DARB GLEW_GET_FUN(__glewCompressedTexImage2DARB) #define glCompressedTexImage3DARB GLEW_GET_FUN(__glewCompressedTexImage3DARB) #define glCompressedTexSubImage1DARB GLEW_GET_FUN(__glewCompressedTexSubImage1DARB) #define glCompressedTexSubImage2DARB GLEW_GET_FUN(__glewCompressedTexSubImage2DARB) #define glCompressedTexSubImage3DARB GLEW_GET_FUN(__glewCompressedTexSubImage3DARB) #define glGetCompressedTexImageARB GLEW_GET_FUN(__glewGetCompressedTexImageARB) #define GLEW_ARB_texture_compression GLEW_GET_VAR(__GLEW_ARB_texture_compression) #endif /* GL_ARB_texture_compression */ /* -------------------- GL_ARB_texture_compression_bptc -------------------- */ #ifndef GL_ARB_texture_compression_bptc #define GL_ARB_texture_compression_bptc 1 #define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C #define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D #define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E #define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F #define GLEW_ARB_texture_compression_bptc GLEW_GET_VAR(__GLEW_ARB_texture_compression_bptc) #endif /* GL_ARB_texture_compression_bptc */ /* -------------------- GL_ARB_texture_compression_rgtc -------------------- */ #ifndef GL_ARB_texture_compression_rgtc #define GL_ARB_texture_compression_rgtc 1 #define GL_COMPRESSED_RED_RGTC1 0x8DBB #define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC #define GL_COMPRESSED_RG_RGTC2 0x8DBD #define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE #define GLEW_ARB_texture_compression_rgtc GLEW_GET_VAR(__GLEW_ARB_texture_compression_rgtc) #endif /* GL_ARB_texture_compression_rgtc */ /* ------------------------ GL_ARB_texture_cube_map ------------------------ */ #ifndef GL_ARB_texture_cube_map #define GL_ARB_texture_cube_map 1 #define GL_NORMAL_MAP_ARB 0x8511 #define GL_REFLECTION_MAP_ARB 0x8512 #define GL_TEXTURE_CUBE_MAP_ARB 0x8513 #define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 #define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A #define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B #define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C #define GLEW_ARB_texture_cube_map GLEW_GET_VAR(__GLEW_ARB_texture_cube_map) #endif /* GL_ARB_texture_cube_map */ /* --------------------- GL_ARB_texture_cube_map_array --------------------- */ #ifndef GL_ARB_texture_cube_map_array #define GL_ARB_texture_cube_map_array 1 #define GL_TEXTURE_CUBE_MAP_ARRAY_ARB 0x9009 #define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A #define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B #define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C #define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D #define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E #define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F #define GLEW_ARB_texture_cube_map_array GLEW_GET_VAR(__GLEW_ARB_texture_cube_map_array) #endif /* GL_ARB_texture_cube_map_array */ /* ------------------------- GL_ARB_texture_env_add ------------------------ */ #ifndef GL_ARB_texture_env_add #define GL_ARB_texture_env_add 1 #define GLEW_ARB_texture_env_add GLEW_GET_VAR(__GLEW_ARB_texture_env_add) #endif /* GL_ARB_texture_env_add */ /* ----------------------- GL_ARB_texture_env_combine ---------------------- */ #ifndef GL_ARB_texture_env_combine #define GL_ARB_texture_env_combine 1 #define GL_SUBTRACT_ARB 0x84E7 #define GL_COMBINE_ARB 0x8570 #define GL_COMBINE_RGB_ARB 0x8571 #define GL_COMBINE_ALPHA_ARB 0x8572 #define GL_RGB_SCALE_ARB 0x8573 #define GL_ADD_SIGNED_ARB 0x8574 #define GL_INTERPOLATE_ARB 0x8575 #define GL_CONSTANT_ARB 0x8576 #define GL_PRIMARY_COLOR_ARB 0x8577 #define GL_PREVIOUS_ARB 0x8578 #define GL_SOURCE0_RGB_ARB 0x8580 #define GL_SOURCE1_RGB_ARB 0x8581 #define GL_SOURCE2_RGB_ARB 0x8582 #define GL_SOURCE0_ALPHA_ARB 0x8588 #define GL_SOURCE1_ALPHA_ARB 0x8589 #define GL_SOURCE2_ALPHA_ARB 0x858A #define GL_OPERAND0_RGB_ARB 0x8590 #define GL_OPERAND1_RGB_ARB 0x8591 #define GL_OPERAND2_RGB_ARB 0x8592 #define GL_OPERAND0_ALPHA_ARB 0x8598 #define GL_OPERAND1_ALPHA_ARB 0x8599 #define GL_OPERAND2_ALPHA_ARB 0x859A #define GLEW_ARB_texture_env_combine GLEW_GET_VAR(__GLEW_ARB_texture_env_combine) #endif /* GL_ARB_texture_env_combine */ /* ---------------------- GL_ARB_texture_env_crossbar ---------------------- */ #ifndef GL_ARB_texture_env_crossbar #define GL_ARB_texture_env_crossbar 1 #define GLEW_ARB_texture_env_crossbar GLEW_GET_VAR(__GLEW_ARB_texture_env_crossbar) #endif /* GL_ARB_texture_env_crossbar */ /* ------------------------ GL_ARB_texture_env_dot3 ------------------------ */ #ifndef GL_ARB_texture_env_dot3 #define GL_ARB_texture_env_dot3 1 #define GL_DOT3_RGB_ARB 0x86AE #define GL_DOT3_RGBA_ARB 0x86AF #define GLEW_ARB_texture_env_dot3 GLEW_GET_VAR(__GLEW_ARB_texture_env_dot3) #endif /* GL_ARB_texture_env_dot3 */ /* -------------------------- GL_ARB_texture_float ------------------------- */ #ifndef GL_ARB_texture_float #define GL_ARB_texture_float 1 #define GL_RGBA32F_ARB 0x8814 #define GL_RGB32F_ARB 0x8815 #define GL_ALPHA32F_ARB 0x8816 #define GL_INTENSITY32F_ARB 0x8817 #define GL_LUMINANCE32F_ARB 0x8818 #define GL_LUMINANCE_ALPHA32F_ARB 0x8819 #define GL_RGBA16F_ARB 0x881A #define GL_RGB16F_ARB 0x881B #define GL_ALPHA16F_ARB 0x881C #define GL_INTENSITY16F_ARB 0x881D #define GL_LUMINANCE16F_ARB 0x881E #define GL_LUMINANCE_ALPHA16F_ARB 0x881F #define GL_TEXTURE_RED_TYPE_ARB 0x8C10 #define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 #define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 #define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 #define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 #define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 #define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 #define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 #define GLEW_ARB_texture_float GLEW_GET_VAR(__GLEW_ARB_texture_float) #endif /* GL_ARB_texture_float */ /* ------------------------- GL_ARB_texture_gather ------------------------- */ #ifndef GL_ARB_texture_gather #define GL_ARB_texture_gather 1 #define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E #define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F #define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F #define GLEW_ARB_texture_gather GLEW_GET_VAR(__GLEW_ARB_texture_gather) #endif /* GL_ARB_texture_gather */ /* --------------------- GL_ARB_texture_mirrored_repeat -------------------- */ #ifndef GL_ARB_texture_mirrored_repeat #define GL_ARB_texture_mirrored_repeat 1 #define GL_MIRRORED_REPEAT_ARB 0x8370 #define GLEW_ARB_texture_mirrored_repeat GLEW_GET_VAR(__GLEW_ARB_texture_mirrored_repeat) #endif /* GL_ARB_texture_mirrored_repeat */ /* ----------------------- GL_ARB_texture_multisample ---------------------- */ #ifndef GL_ARB_texture_multisample #define GL_ARB_texture_multisample 1 #define GL_SAMPLE_POSITION 0x8E50 #define GL_SAMPLE_MASK 0x8E51 #define GL_SAMPLE_MASK_VALUE 0x8E52 #define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 #define GL_TEXTURE_2D_MULTISAMPLE 0x9100 #define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101 #define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 #define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103 #define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 #define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105 #define GL_TEXTURE_SAMPLES 0x9106 #define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 #define GL_SAMPLER_2D_MULTISAMPLE 0x9108 #define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 #define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A #define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B #define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C #define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D #define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E #define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F #define GL_MAX_INTEGER_SAMPLES 0x9110 typedef void (GLAPIENTRY * PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat* val); typedef void (GLAPIENTRY * PFNGLSAMPLEMASKIPROC) (GLuint index, GLbitfield mask); typedef void (GLAPIENTRY * PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); typedef void (GLAPIENTRY * PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); #define glGetMultisamplefv GLEW_GET_FUN(__glewGetMultisamplefv) #define glSampleMaski GLEW_GET_FUN(__glewSampleMaski) #define glTexImage2DMultisample GLEW_GET_FUN(__glewTexImage2DMultisample) #define glTexImage3DMultisample GLEW_GET_FUN(__glewTexImage3DMultisample) #define GLEW_ARB_texture_multisample GLEW_GET_VAR(__GLEW_ARB_texture_multisample) #endif /* GL_ARB_texture_multisample */ /* -------------------- GL_ARB_texture_non_power_of_two -------------------- */ #ifndef GL_ARB_texture_non_power_of_two #define GL_ARB_texture_non_power_of_two 1 #define GLEW_ARB_texture_non_power_of_two GLEW_GET_VAR(__GLEW_ARB_texture_non_power_of_two) #endif /* GL_ARB_texture_non_power_of_two */ /* ---------------------- GL_ARB_texture_query_levels ---------------------- */ #ifndef GL_ARB_texture_query_levels #define GL_ARB_texture_query_levels 1 #define GLEW_ARB_texture_query_levels GLEW_GET_VAR(__GLEW_ARB_texture_query_levels) #endif /* GL_ARB_texture_query_levels */ /* ------------------------ GL_ARB_texture_query_lod ----------------------- */ #ifndef GL_ARB_texture_query_lod #define GL_ARB_texture_query_lod 1 #define GLEW_ARB_texture_query_lod GLEW_GET_VAR(__GLEW_ARB_texture_query_lod) #endif /* GL_ARB_texture_query_lod */ /* ------------------------ GL_ARB_texture_rectangle ----------------------- */ #ifndef GL_ARB_texture_rectangle #define GL_ARB_texture_rectangle 1 #define GL_TEXTURE_RECTANGLE_ARB 0x84F5 #define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 #define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 #define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 #define GL_SAMPLER_2D_RECT_ARB 0x8B63 #define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 #define GLEW_ARB_texture_rectangle GLEW_GET_VAR(__GLEW_ARB_texture_rectangle) #endif /* GL_ARB_texture_rectangle */ /* --------------------------- GL_ARB_texture_rg --------------------------- */ #ifndef GL_ARB_texture_rg #define GL_ARB_texture_rg 1 #define GL_COMPRESSED_RED 0x8225 #define GL_COMPRESSED_RG 0x8226 #define GL_RG 0x8227 #define GL_RG_INTEGER 0x8228 #define GL_R8 0x8229 #define GL_R16 0x822A #define GL_RG8 0x822B #define GL_RG16 0x822C #define GL_R16F 0x822D #define GL_R32F 0x822E #define GL_RG16F 0x822F #define GL_RG32F 0x8230 #define GL_R8I 0x8231 #define GL_R8UI 0x8232 #define GL_R16I 0x8233 #define GL_R16UI 0x8234 #define GL_R32I 0x8235 #define GL_R32UI 0x8236 #define GL_RG8I 0x8237 #define GL_RG8UI 0x8238 #define GL_RG16I 0x8239 #define GL_RG16UI 0x823A #define GL_RG32I 0x823B #define GL_RG32UI 0x823C #define GLEW_ARB_texture_rg GLEW_GET_VAR(__GLEW_ARB_texture_rg) #endif /* GL_ARB_texture_rg */ /* ----------------------- GL_ARB_texture_rgb10_a2ui ----------------------- */ #ifndef GL_ARB_texture_rgb10_a2ui #define GL_ARB_texture_rgb10_a2ui 1 #define GL_RGB10_A2UI 0x906F #define GLEW_ARB_texture_rgb10_a2ui GLEW_GET_VAR(__GLEW_ARB_texture_rgb10_a2ui) #endif /* GL_ARB_texture_rgb10_a2ui */ /* ------------------------- GL_ARB_texture_storage ------------------------ */ #ifndef GL_ARB_texture_storage #define GL_ARB_texture_storage 1 #define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F typedef void (GLAPIENTRY * PFNGLTEXSTORAGE1DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); typedef void (GLAPIENTRY * PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); typedef void (GLAPIENTRY * PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); #define glTexStorage1D GLEW_GET_FUN(__glewTexStorage1D) #define glTexStorage2D GLEW_GET_FUN(__glewTexStorage2D) #define glTexStorage3D GLEW_GET_FUN(__glewTexStorage3D) #define glTextureStorage1DEXT GLEW_GET_FUN(__glewTextureStorage1DEXT) #define glTextureStorage2DEXT GLEW_GET_FUN(__glewTextureStorage2DEXT) #define glTextureStorage3DEXT GLEW_GET_FUN(__glewTextureStorage3DEXT) #define GLEW_ARB_texture_storage GLEW_GET_VAR(__GLEW_ARB_texture_storage) #endif /* GL_ARB_texture_storage */ /* ------------------- GL_ARB_texture_storage_multisample ------------------ */ #ifndef GL_ARB_texture_storage_multisample #define GL_ARB_texture_storage_multisample 1 typedef void (GLAPIENTRY * PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); typedef void (GLAPIENTRY * PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); #define glTexStorage2DMultisample GLEW_GET_FUN(__glewTexStorage2DMultisample) #define glTexStorage3DMultisample GLEW_GET_FUN(__glewTexStorage3DMultisample) #define glTextureStorage2DMultisampleEXT GLEW_GET_FUN(__glewTextureStorage2DMultisampleEXT) #define glTextureStorage3DMultisampleEXT GLEW_GET_FUN(__glewTextureStorage3DMultisampleEXT) #define GLEW_ARB_texture_storage_multisample GLEW_GET_VAR(__GLEW_ARB_texture_storage_multisample) #endif /* GL_ARB_texture_storage_multisample */ /* ------------------------- GL_ARB_texture_swizzle ------------------------ */ #ifndef GL_ARB_texture_swizzle #define GL_ARB_texture_swizzle 1 #define GL_TEXTURE_SWIZZLE_R 0x8E42 #define GL_TEXTURE_SWIZZLE_G 0x8E43 #define GL_TEXTURE_SWIZZLE_B 0x8E44 #define GL_TEXTURE_SWIZZLE_A 0x8E45 #define GL_TEXTURE_SWIZZLE_RGBA 0x8E46 #define GLEW_ARB_texture_swizzle GLEW_GET_VAR(__GLEW_ARB_texture_swizzle) #endif /* GL_ARB_texture_swizzle */ /* -------------------------- GL_ARB_texture_view -------------------------- */ #ifndef GL_ARB_texture_view #define GL_ARB_texture_view 1 #define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB #define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC #define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD #define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE #define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF typedef void (GLAPIENTRY * PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); #define glTextureView GLEW_GET_FUN(__glewTextureView) #define GLEW_ARB_texture_view GLEW_GET_VAR(__GLEW_ARB_texture_view) #endif /* GL_ARB_texture_view */ /* --------------------------- GL_ARB_timer_query -------------------------- */ #ifndef GL_ARB_timer_query #define GL_ARB_timer_query 1 #define GL_TIME_ELAPSED 0x88BF #define GL_TIMESTAMP 0x8E28 typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64* params); typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64* params); typedef void (GLAPIENTRY * PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target); #define glGetQueryObjecti64v GLEW_GET_FUN(__glewGetQueryObjecti64v) #define glGetQueryObjectui64v GLEW_GET_FUN(__glewGetQueryObjectui64v) #define glQueryCounter GLEW_GET_FUN(__glewQueryCounter) #define GLEW_ARB_timer_query GLEW_GET_VAR(__GLEW_ARB_timer_query) #endif /* GL_ARB_timer_query */ /* ----------------------- GL_ARB_transform_feedback2 ---------------------- */ #ifndef GL_ARB_transform_feedback2 #define GL_ARB_transform_feedback2 1 #define GL_TRANSFORM_FEEDBACK 0x8E22 #define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23 #define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24 #define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25 typedef void (GLAPIENTRY * PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id); typedef void (GLAPIENTRY * PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint* ids); typedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id); typedef void (GLAPIENTRY * PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint* ids); typedef GLboolean (GLAPIENTRY * PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id); typedef void (GLAPIENTRY * PFNGLPAUSETRANSFORMFEEDBACKPROC) (void); typedef void (GLAPIENTRY * PFNGLRESUMETRANSFORMFEEDBACKPROC) (void); #define glBindTransformFeedback GLEW_GET_FUN(__glewBindTransformFeedback) #define glDeleteTransformFeedbacks GLEW_GET_FUN(__glewDeleteTransformFeedbacks) #define glDrawTransformFeedback GLEW_GET_FUN(__glewDrawTransformFeedback) #define glGenTransformFeedbacks GLEW_GET_FUN(__glewGenTransformFeedbacks) #define glIsTransformFeedback GLEW_GET_FUN(__glewIsTransformFeedback) #define glPauseTransformFeedback GLEW_GET_FUN(__glewPauseTransformFeedback) #define glResumeTransformFeedback GLEW_GET_FUN(__glewResumeTransformFeedback) #define GLEW_ARB_transform_feedback2 GLEW_GET_VAR(__GLEW_ARB_transform_feedback2) #endif /* GL_ARB_transform_feedback2 */ /* ----------------------- GL_ARB_transform_feedback3 ---------------------- */ #ifndef GL_ARB_transform_feedback3 #define GL_ARB_transform_feedback3 1 #define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70 #define GL_MAX_VERTEX_STREAMS 0x8E71 typedef void (GLAPIENTRY * PFNGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id); typedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream); typedef void (GLAPIENTRY * PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index); typedef void (GLAPIENTRY * PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint* params); #define glBeginQueryIndexed GLEW_GET_FUN(__glewBeginQueryIndexed) #define glDrawTransformFeedbackStream GLEW_GET_FUN(__glewDrawTransformFeedbackStream) #define glEndQueryIndexed GLEW_GET_FUN(__glewEndQueryIndexed) #define glGetQueryIndexediv GLEW_GET_FUN(__glewGetQueryIndexediv) #define GLEW_ARB_transform_feedback3 GLEW_GET_VAR(__GLEW_ARB_transform_feedback3) #endif /* GL_ARB_transform_feedback3 */ /* ------------------ GL_ARB_transform_feedback_instanced ------------------ */ #ifndef GL_ARB_transform_feedback_instanced #define GL_ARB_transform_feedback_instanced 1 typedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei primcount); typedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei primcount); #define glDrawTransformFeedbackInstanced GLEW_GET_FUN(__glewDrawTransformFeedbackInstanced) #define glDrawTransformFeedbackStreamInstanced GLEW_GET_FUN(__glewDrawTransformFeedbackStreamInstanced) #define GLEW_ARB_transform_feedback_instanced GLEW_GET_VAR(__GLEW_ARB_transform_feedback_instanced) #endif /* GL_ARB_transform_feedback_instanced */ /* ------------------------ GL_ARB_transpose_matrix ------------------------ */ #ifndef GL_ARB_transpose_matrix #define GL_ARB_transpose_matrix 1 #define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 #define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 #define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 #define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 typedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXDARBPROC) (GLdouble m[16]); typedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXFARBPROC) (GLfloat m[16]); typedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXDARBPROC) (GLdouble m[16]); typedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXFARBPROC) (GLfloat m[16]); #define glLoadTransposeMatrixdARB GLEW_GET_FUN(__glewLoadTransposeMatrixdARB) #define glLoadTransposeMatrixfARB GLEW_GET_FUN(__glewLoadTransposeMatrixfARB) #define glMultTransposeMatrixdARB GLEW_GET_FUN(__glewMultTransposeMatrixdARB) #define glMultTransposeMatrixfARB GLEW_GET_FUN(__glewMultTransposeMatrixfARB) #define GLEW_ARB_transpose_matrix GLEW_GET_VAR(__GLEW_ARB_transpose_matrix) #endif /* GL_ARB_transpose_matrix */ /* ---------------------- GL_ARB_uniform_buffer_object --------------------- */ #ifndef GL_ARB_uniform_buffer_object #define GL_ARB_uniform_buffer_object 1 #define GL_UNIFORM_BUFFER 0x8A11 #define GL_UNIFORM_BUFFER_BINDING 0x8A28 #define GL_UNIFORM_BUFFER_START 0x8A29 #define GL_UNIFORM_BUFFER_SIZE 0x8A2A #define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B #define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C #define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D #define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E #define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F #define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 #define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 #define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 #define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 #define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 #define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 #define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 #define GL_UNIFORM_TYPE 0x8A37 #define GL_UNIFORM_SIZE 0x8A38 #define GL_UNIFORM_NAME_LENGTH 0x8A39 #define GL_UNIFORM_BLOCK_INDEX 0x8A3A #define GL_UNIFORM_OFFSET 0x8A3B #define GL_UNIFORM_ARRAY_STRIDE 0x8A3C #define GL_UNIFORM_MATRIX_STRIDE 0x8A3D #define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E #define GL_UNIFORM_BLOCK_BINDING 0x8A3F #define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 #define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 #define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 #define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 #define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 #define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 #define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 #define GL_INVALID_INDEX 0xFFFFFFFF typedef void (GLAPIENTRY * PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer); typedef void (GLAPIENTRY * PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName); typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformName); typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint* data); typedef GLuint (GLAPIENTRY * PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar* uniformBlockName); typedef void (GLAPIENTRY * PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar** uniformNames, GLuint* uniformIndices); typedef void (GLAPIENTRY * PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); #define glBindBufferBase GLEW_GET_FUN(__glewBindBufferBase) #define glBindBufferRange GLEW_GET_FUN(__glewBindBufferRange) #define glGetActiveUniformBlockName GLEW_GET_FUN(__glewGetActiveUniformBlockName) #define glGetActiveUniformBlockiv GLEW_GET_FUN(__glewGetActiveUniformBlockiv) #define glGetActiveUniformName GLEW_GET_FUN(__glewGetActiveUniformName) #define glGetActiveUniformsiv GLEW_GET_FUN(__glewGetActiveUniformsiv) #define glGetIntegeri_v GLEW_GET_FUN(__glewGetIntegeri_v) #define glGetUniformBlockIndex GLEW_GET_FUN(__glewGetUniformBlockIndex) #define glGetUniformIndices GLEW_GET_FUN(__glewGetUniformIndices) #define glUniformBlockBinding GLEW_GET_FUN(__glewUniformBlockBinding) #define GLEW_ARB_uniform_buffer_object GLEW_GET_VAR(__GLEW_ARB_uniform_buffer_object) #endif /* GL_ARB_uniform_buffer_object */ /* ------------------------ GL_ARB_vertex_array_bgra ----------------------- */ #ifndef GL_ARB_vertex_array_bgra #define GL_ARB_vertex_array_bgra 1 #define GL_BGRA 0x80E1 #define GLEW_ARB_vertex_array_bgra GLEW_GET_VAR(__GLEW_ARB_vertex_array_bgra) #endif /* GL_ARB_vertex_array_bgra */ /* ----------------------- GL_ARB_vertex_array_object ---------------------- */ #ifndef GL_ARB_vertex_array_object #define GL_ARB_vertex_array_object 1 #define GL_VERTEX_ARRAY_BINDING 0x85B5 typedef void (GLAPIENTRY * PFNGLBINDVERTEXARRAYPROC) (GLuint array); typedef void (GLAPIENTRY * PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint* arrays); typedef void (GLAPIENTRY * PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint* arrays); typedef GLboolean (GLAPIENTRY * PFNGLISVERTEXARRAYPROC) (GLuint array); #define glBindVertexArray GLEW_GET_FUN(__glewBindVertexArray) #define glDeleteVertexArrays GLEW_GET_FUN(__glewDeleteVertexArrays) #define glGenVertexArrays GLEW_GET_FUN(__glewGenVertexArrays) #define glIsVertexArray GLEW_GET_FUN(__glewIsVertexArray) #define GLEW_ARB_vertex_array_object GLEW_GET_VAR(__GLEW_ARB_vertex_array_object) #endif /* GL_ARB_vertex_array_object */ /* ----------------------- GL_ARB_vertex_attrib_64bit ---------------------- */ #ifndef GL_ARB_vertex_attrib_64bit #define GL_ARB_vertex_attrib_64bit 1 #define GL_DOUBLE_MAT2 0x8F46 #define GL_DOUBLE_MAT3 0x8F47 #define GL_DOUBLE_MAT4 0x8F48 #define GL_DOUBLE_VEC2 0x8FFC #define GL_DOUBLE_VEC3 0x8FFD #define GL_DOUBLE_VEC4 0x8FFE typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble* params); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void* pointer); #define glGetVertexAttribLdv GLEW_GET_FUN(__glewGetVertexAttribLdv) #define glVertexAttribL1d GLEW_GET_FUN(__glewVertexAttribL1d) #define glVertexAttribL1dv GLEW_GET_FUN(__glewVertexAttribL1dv) #define glVertexAttribL2d GLEW_GET_FUN(__glewVertexAttribL2d) #define glVertexAttribL2dv GLEW_GET_FUN(__glewVertexAttribL2dv) #define glVertexAttribL3d GLEW_GET_FUN(__glewVertexAttribL3d) #define glVertexAttribL3dv GLEW_GET_FUN(__glewVertexAttribL3dv) #define glVertexAttribL4d GLEW_GET_FUN(__glewVertexAttribL4d) #define glVertexAttribL4dv GLEW_GET_FUN(__glewVertexAttribL4dv) #define glVertexAttribLPointer GLEW_GET_FUN(__glewVertexAttribLPointer) #define GLEW_ARB_vertex_attrib_64bit GLEW_GET_VAR(__GLEW_ARB_vertex_attrib_64bit) #endif /* GL_ARB_vertex_attrib_64bit */ /* ---------------------- GL_ARB_vertex_attrib_binding --------------------- */ #ifndef GL_ARB_vertex_attrib_binding #define GL_ARB_vertex_attrib_binding 1 #define GL_VERTEX_ATTRIB_BINDING 0x82D4 #define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5 #define GL_VERTEX_BINDING_DIVISOR 0x82D6 #define GL_VERTEX_BINDING_OFFSET 0x82D7 #define GL_VERTEX_BINDING_STRIDE 0x82D8 #define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9 #define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA typedef void (GLAPIENTRY * PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); typedef void (GLAPIENTRY * PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor); #define glBindVertexBuffer GLEW_GET_FUN(__glewBindVertexBuffer) #define glVertexAttribBinding GLEW_GET_FUN(__glewVertexAttribBinding) #define glVertexAttribFormat GLEW_GET_FUN(__glewVertexAttribFormat) #define glVertexAttribIFormat GLEW_GET_FUN(__glewVertexAttribIFormat) #define glVertexAttribLFormat GLEW_GET_FUN(__glewVertexAttribLFormat) #define glVertexBindingDivisor GLEW_GET_FUN(__glewVertexBindingDivisor) #define GLEW_ARB_vertex_attrib_binding GLEW_GET_VAR(__GLEW_ARB_vertex_attrib_binding) #endif /* GL_ARB_vertex_attrib_binding */ /* -------------------------- GL_ARB_vertex_blend -------------------------- */ #ifndef GL_ARB_vertex_blend #define GL_ARB_vertex_blend 1 #define GL_MODELVIEW0_ARB 0x1700 #define GL_MODELVIEW1_ARB 0x850A #define GL_MAX_VERTEX_UNITS_ARB 0x86A4 #define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 #define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 #define GL_VERTEX_BLEND_ARB 0x86A7 #define GL_CURRENT_WEIGHT_ARB 0x86A8 #define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 #define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA #define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB #define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC #define GL_WEIGHT_ARRAY_ARB 0x86AD #define GL_MODELVIEW2_ARB 0x8722 #define GL_MODELVIEW3_ARB 0x8723 #define GL_MODELVIEW4_ARB 0x8724 #define GL_MODELVIEW5_ARB 0x8725 #define GL_MODELVIEW6_ARB 0x8726 #define GL_MODELVIEW7_ARB 0x8727 #define GL_MODELVIEW8_ARB 0x8728 #define GL_MODELVIEW9_ARB 0x8729 #define GL_MODELVIEW10_ARB 0x872A #define GL_MODELVIEW11_ARB 0x872B #define GL_MODELVIEW12_ARB 0x872C #define GL_MODELVIEW13_ARB 0x872D #define GL_MODELVIEW14_ARB 0x872E #define GL_MODELVIEW15_ARB 0x872F #define GL_MODELVIEW16_ARB 0x8730 #define GL_MODELVIEW17_ARB 0x8731 #define GL_MODELVIEW18_ARB 0x8732 #define GL_MODELVIEW19_ARB 0x8733 #define GL_MODELVIEW20_ARB 0x8734 #define GL_MODELVIEW21_ARB 0x8735 #define GL_MODELVIEW22_ARB 0x8736 #define GL_MODELVIEW23_ARB 0x8737 #define GL_MODELVIEW24_ARB 0x8738 #define GL_MODELVIEW25_ARB 0x8739 #define GL_MODELVIEW26_ARB 0x873A #define GL_MODELVIEW27_ARB 0x873B #define GL_MODELVIEW28_ARB 0x873C #define GL_MODELVIEW29_ARB 0x873D #define GL_MODELVIEW30_ARB 0x873E #define GL_MODELVIEW31_ARB 0x873F typedef void (GLAPIENTRY * PFNGLVERTEXBLENDARBPROC) (GLint count); typedef void (GLAPIENTRY * PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer); typedef void (GLAPIENTRY * PFNGLWEIGHTBVARBPROC) (GLint size, GLbyte *weights); typedef void (GLAPIENTRY * PFNGLWEIGHTDVARBPROC) (GLint size, GLdouble *weights); typedef void (GLAPIENTRY * PFNGLWEIGHTFVARBPROC) (GLint size, GLfloat *weights); typedef void (GLAPIENTRY * PFNGLWEIGHTIVARBPROC) (GLint size, GLint *weights); typedef void (GLAPIENTRY * PFNGLWEIGHTSVARBPROC) (GLint size, GLshort *weights); typedef void (GLAPIENTRY * PFNGLWEIGHTUBVARBPROC) (GLint size, GLubyte *weights); typedef void (GLAPIENTRY * PFNGLWEIGHTUIVARBPROC) (GLint size, GLuint *weights); typedef void (GLAPIENTRY * PFNGLWEIGHTUSVARBPROC) (GLint size, GLushort *weights); #define glVertexBlendARB GLEW_GET_FUN(__glewVertexBlendARB) #define glWeightPointerARB GLEW_GET_FUN(__glewWeightPointerARB) #define glWeightbvARB GLEW_GET_FUN(__glewWeightbvARB) #define glWeightdvARB GLEW_GET_FUN(__glewWeightdvARB) #define glWeightfvARB GLEW_GET_FUN(__glewWeightfvARB) #define glWeightivARB GLEW_GET_FUN(__glewWeightivARB) #define glWeightsvARB GLEW_GET_FUN(__glewWeightsvARB) #define glWeightubvARB GLEW_GET_FUN(__glewWeightubvARB) #define glWeightuivARB GLEW_GET_FUN(__glewWeightuivARB) #define glWeightusvARB GLEW_GET_FUN(__glewWeightusvARB) #define GLEW_ARB_vertex_blend GLEW_GET_VAR(__GLEW_ARB_vertex_blend) #endif /* GL_ARB_vertex_blend */ /* ---------------------- GL_ARB_vertex_buffer_object ---------------------- */ #ifndef GL_ARB_vertex_buffer_object #define GL_ARB_vertex_buffer_object 1 #define GL_BUFFER_SIZE_ARB 0x8764 #define GL_BUFFER_USAGE_ARB 0x8765 #define GL_ARRAY_BUFFER_ARB 0x8892 #define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 #define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 #define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 #define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 #define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 #define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 #define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 #define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A #define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B #define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C #define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D #define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E #define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F #define GL_READ_ONLY_ARB 0x88B8 #define GL_WRITE_ONLY_ARB 0x88B9 #define GL_READ_WRITE_ARB 0x88BA #define GL_BUFFER_ACCESS_ARB 0x88BB #define GL_BUFFER_MAPPED_ARB 0x88BC #define GL_BUFFER_MAP_POINTER_ARB 0x88BD #define GL_STREAM_DRAW_ARB 0x88E0 #define GL_STREAM_READ_ARB 0x88E1 #define GL_STREAM_COPY_ARB 0x88E2 #define GL_STATIC_DRAW_ARB 0x88E4 #define GL_STATIC_READ_ARB 0x88E5 #define GL_STATIC_COPY_ARB 0x88E6 #define GL_DYNAMIC_DRAW_ARB 0x88E8 #define GL_DYNAMIC_READ_ARB 0x88E9 #define GL_DYNAMIC_COPY_ARB 0x88EA typedef ptrdiff_t GLintptrARB; typedef ptrdiff_t GLsizeiptrARB; typedef void (GLAPIENTRY * PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); typedef void (GLAPIENTRY * PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid* data, GLenum usage); typedef void (GLAPIENTRY * PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid* data); typedef void (GLAPIENTRY * PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint* buffers); typedef void (GLAPIENTRY * PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint* buffers); typedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid** params); typedef void (GLAPIENTRY * PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid* data); typedef GLboolean (GLAPIENTRY * PFNGLISBUFFERARBPROC) (GLuint buffer); typedef GLvoid * (GLAPIENTRY * PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access); typedef GLboolean (GLAPIENTRY * PFNGLUNMAPBUFFERARBPROC) (GLenum target); #define glBindBufferARB GLEW_GET_FUN(__glewBindBufferARB) #define glBufferDataARB GLEW_GET_FUN(__glewBufferDataARB) #define glBufferSubDataARB GLEW_GET_FUN(__glewBufferSubDataARB) #define glDeleteBuffersARB GLEW_GET_FUN(__glewDeleteBuffersARB) #define glGenBuffersARB GLEW_GET_FUN(__glewGenBuffersARB) #define glGetBufferParameterivARB GLEW_GET_FUN(__glewGetBufferParameterivARB) #define glGetBufferPointervARB GLEW_GET_FUN(__glewGetBufferPointervARB) #define glGetBufferSubDataARB GLEW_GET_FUN(__glewGetBufferSubDataARB) #define glIsBufferARB GLEW_GET_FUN(__glewIsBufferARB) #define glMapBufferARB GLEW_GET_FUN(__glewMapBufferARB) #define glUnmapBufferARB GLEW_GET_FUN(__glewUnmapBufferARB) #define GLEW_ARB_vertex_buffer_object GLEW_GET_VAR(__GLEW_ARB_vertex_buffer_object) #endif /* GL_ARB_vertex_buffer_object */ /* ------------------------- GL_ARB_vertex_program ------------------------- */ #ifndef GL_ARB_vertex_program #define GL_ARB_vertex_program 1 #define GL_COLOR_SUM_ARB 0x8458 #define GL_VERTEX_PROGRAM_ARB 0x8620 #define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 #define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 #define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 #define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 #define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 #define GL_PROGRAM_LENGTH_ARB 0x8627 #define GL_PROGRAM_STRING_ARB 0x8628 #define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E #define GL_MAX_PROGRAM_MATRICES_ARB 0x862F #define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 #define GL_CURRENT_MATRIX_ARB 0x8641 #define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 #define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 #define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 #define GL_PROGRAM_ERROR_POSITION_ARB 0x864B #define GL_PROGRAM_BINDING_ARB 0x8677 #define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 #define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A #define GL_PROGRAM_ERROR_STRING_ARB 0x8874 #define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 #define GL_PROGRAM_FORMAT_ARB 0x8876 #define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 #define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 #define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 #define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 #define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 #define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 #define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 #define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 #define GL_PROGRAM_PARAMETERS_ARB 0x88A8 #define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 #define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA #define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB #define GL_PROGRAM_ATTRIBS_ARB 0x88AC #define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD #define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE #define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF #define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 #define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 #define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 #define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 #define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 #define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 #define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 #define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 #define GL_MATRIX0_ARB 0x88C0 #define GL_MATRIX1_ARB 0x88C1 #define GL_MATRIX2_ARB 0x88C2 #define GL_MATRIX3_ARB 0x88C3 #define GL_MATRIX4_ARB 0x88C4 #define GL_MATRIX5_ARB 0x88C5 #define GL_MATRIX6_ARB 0x88C6 #define GL_MATRIX7_ARB 0x88C7 #define GL_MATRIX8_ARB 0x88C8 #define GL_MATRIX9_ARB 0x88C9 #define GL_MATRIX10_ARB 0x88CA #define GL_MATRIX11_ARB 0x88CB #define GL_MATRIX12_ARB 0x88CC #define GL_MATRIX13_ARB 0x88CD #define GL_MATRIX14_ARB 0x88CE #define GL_MATRIX15_ARB 0x88CF #define GL_MATRIX16_ARB 0x88D0 #define GL_MATRIX17_ARB 0x88D1 #define GL_MATRIX18_ARB 0x88D2 #define GL_MATRIX19_ARB 0x88D3 #define GL_MATRIX20_ARB 0x88D4 #define GL_MATRIX21_ARB 0x88D5 #define GL_MATRIX22_ARB 0x88D6 #define GL_MATRIX23_ARB 0x88D7 #define GL_MATRIX24_ARB 0x88D8 #define GL_MATRIX25_ARB 0x88D9 #define GL_MATRIX26_ARB 0x88DA #define GL_MATRIX27_ARB 0x88DB #define GL_MATRIX28_ARB 0x88DC #define GL_MATRIX29_ARB 0x88DD #define GL_MATRIX30_ARB 0x88DE #define GL_MATRIX31_ARB 0x88DF typedef void (GLAPIENTRY * PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); typedef void (GLAPIENTRY * PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint* programs); typedef void (GLAPIENTRY * PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); typedef void (GLAPIENTRY * PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); typedef void (GLAPIENTRY * PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint* programs); typedef void (GLAPIENTRY * PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble* params); typedef void (GLAPIENTRY * PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble* params); typedef void (GLAPIENTRY * PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, void* string); typedef void (GLAPIENTRY * PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid** pointer); typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble* params); typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint* params); typedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMARBPROC) (GLuint program); typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble* params); typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble* params); typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const void* string); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer); #define glBindProgramARB GLEW_GET_FUN(__glewBindProgramARB) #define glDeleteProgramsARB GLEW_GET_FUN(__glewDeleteProgramsARB) #define glDisableVertexAttribArrayARB GLEW_GET_FUN(__glewDisableVertexAttribArrayARB) #define glEnableVertexAttribArrayARB GLEW_GET_FUN(__glewEnableVertexAttribArrayARB) #define glGenProgramsARB GLEW_GET_FUN(__glewGenProgramsARB) #define glGetProgramEnvParameterdvARB GLEW_GET_FUN(__glewGetProgramEnvParameterdvARB) #define glGetProgramEnvParameterfvARB GLEW_GET_FUN(__glewGetProgramEnvParameterfvARB) #define glGetProgramLocalParameterdvARB GLEW_GET_FUN(__glewGetProgramLocalParameterdvARB) #define glGetProgramLocalParameterfvARB GLEW_GET_FUN(__glewGetProgramLocalParameterfvARB) #define glGetProgramStringARB GLEW_GET_FUN(__glewGetProgramStringARB) #define glGetProgramivARB GLEW_GET_FUN(__glewGetProgramivARB) #define glGetVertexAttribPointervARB GLEW_GET_FUN(__glewGetVertexAttribPointervARB) #define glGetVertexAttribdvARB GLEW_GET_FUN(__glewGetVertexAttribdvARB) #define glGetVertexAttribfvARB GLEW_GET_FUN(__glewGetVertexAttribfvARB) #define glGetVertexAttribivARB GLEW_GET_FUN(__glewGetVertexAttribivARB) #define glIsProgramARB GLEW_GET_FUN(__glewIsProgramARB) #define glProgramEnvParameter4dARB GLEW_GET_FUN(__glewProgramEnvParameter4dARB) #define glProgramEnvParameter4dvARB GLEW_GET_FUN(__glewProgramEnvParameter4dvARB) #define glProgramEnvParameter4fARB GLEW_GET_FUN(__glewProgramEnvParameter4fARB) #define glProgramEnvParameter4fvARB GLEW_GET_FUN(__glewProgramEnvParameter4fvARB) #define glProgramLocalParameter4dARB GLEW_GET_FUN(__glewProgramLocalParameter4dARB) #define glProgramLocalParameter4dvARB GLEW_GET_FUN(__glewProgramLocalParameter4dvARB) #define glProgramLocalParameter4fARB GLEW_GET_FUN(__glewProgramLocalParameter4fARB) #define glProgramLocalParameter4fvARB GLEW_GET_FUN(__glewProgramLocalParameter4fvARB) #define glProgramStringARB GLEW_GET_FUN(__glewProgramStringARB) #define glVertexAttrib1dARB GLEW_GET_FUN(__glewVertexAttrib1dARB) #define glVertexAttrib1dvARB GLEW_GET_FUN(__glewVertexAttrib1dvARB) #define glVertexAttrib1fARB GLEW_GET_FUN(__glewVertexAttrib1fARB) #define glVertexAttrib1fvARB GLEW_GET_FUN(__glewVertexAttrib1fvARB) #define glVertexAttrib1sARB GLEW_GET_FUN(__glewVertexAttrib1sARB) #define glVertexAttrib1svARB GLEW_GET_FUN(__glewVertexAttrib1svARB) #define glVertexAttrib2dARB GLEW_GET_FUN(__glewVertexAttrib2dARB) #define glVertexAttrib2dvARB GLEW_GET_FUN(__glewVertexAttrib2dvARB) #define glVertexAttrib2fARB GLEW_GET_FUN(__glewVertexAttrib2fARB) #define glVertexAttrib2fvARB GLEW_GET_FUN(__glewVertexAttrib2fvARB) #define glVertexAttrib2sARB GLEW_GET_FUN(__glewVertexAttrib2sARB) #define glVertexAttrib2svARB GLEW_GET_FUN(__glewVertexAttrib2svARB) #define glVertexAttrib3dARB GLEW_GET_FUN(__glewVertexAttrib3dARB) #define glVertexAttrib3dvARB GLEW_GET_FUN(__glewVertexAttrib3dvARB) #define glVertexAttrib3fARB GLEW_GET_FUN(__glewVertexAttrib3fARB) #define glVertexAttrib3fvARB GLEW_GET_FUN(__glewVertexAttrib3fvARB) #define glVertexAttrib3sARB GLEW_GET_FUN(__glewVertexAttrib3sARB) #define glVertexAttrib3svARB GLEW_GET_FUN(__glewVertexAttrib3svARB) #define glVertexAttrib4NbvARB GLEW_GET_FUN(__glewVertexAttrib4NbvARB) #define glVertexAttrib4NivARB GLEW_GET_FUN(__glewVertexAttrib4NivARB) #define glVertexAttrib4NsvARB GLEW_GET_FUN(__glewVertexAttrib4NsvARB) #define glVertexAttrib4NubARB GLEW_GET_FUN(__glewVertexAttrib4NubARB) #define glVertexAttrib4NubvARB GLEW_GET_FUN(__glewVertexAttrib4NubvARB) #define glVertexAttrib4NuivARB GLEW_GET_FUN(__glewVertexAttrib4NuivARB) #define glVertexAttrib4NusvARB GLEW_GET_FUN(__glewVertexAttrib4NusvARB) #define glVertexAttrib4bvARB GLEW_GET_FUN(__glewVertexAttrib4bvARB) #define glVertexAttrib4dARB GLEW_GET_FUN(__glewVertexAttrib4dARB) #define glVertexAttrib4dvARB GLEW_GET_FUN(__glewVertexAttrib4dvARB) #define glVertexAttrib4fARB GLEW_GET_FUN(__glewVertexAttrib4fARB) #define glVertexAttrib4fvARB GLEW_GET_FUN(__glewVertexAttrib4fvARB) #define glVertexAttrib4ivARB GLEW_GET_FUN(__glewVertexAttrib4ivARB) #define glVertexAttrib4sARB GLEW_GET_FUN(__glewVertexAttrib4sARB) #define glVertexAttrib4svARB GLEW_GET_FUN(__glewVertexAttrib4svARB) #define glVertexAttrib4ubvARB GLEW_GET_FUN(__glewVertexAttrib4ubvARB) #define glVertexAttrib4uivARB GLEW_GET_FUN(__glewVertexAttrib4uivARB) #define glVertexAttrib4usvARB GLEW_GET_FUN(__glewVertexAttrib4usvARB) #define glVertexAttribPointerARB GLEW_GET_FUN(__glewVertexAttribPointerARB) #define GLEW_ARB_vertex_program GLEW_GET_VAR(__GLEW_ARB_vertex_program) #endif /* GL_ARB_vertex_program */ /* -------------------------- GL_ARB_vertex_shader ------------------------- */ #ifndef GL_ARB_vertex_shader #define GL_ARB_vertex_shader 1 #define GL_VERTEX_SHADER_ARB 0x8B31 #define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A #define GL_MAX_VARYING_FLOATS_ARB 0x8B4B #define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C #define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D #define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 #define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A typedef void (GLAPIENTRY * PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB* name); typedef void (GLAPIENTRY * PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei* length, GLint *size, GLenum *type, GLcharARB *name); typedef GLint (GLAPIENTRY * PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB* name); #define glBindAttribLocationARB GLEW_GET_FUN(__glewBindAttribLocationARB) #define glGetActiveAttribARB GLEW_GET_FUN(__glewGetActiveAttribARB) #define glGetAttribLocationARB GLEW_GET_FUN(__glewGetAttribLocationARB) #define GLEW_ARB_vertex_shader GLEW_GET_VAR(__GLEW_ARB_vertex_shader) #endif /* GL_ARB_vertex_shader */ /* ------------------- GL_ARB_vertex_type_2_10_10_10_rev ------------------- */ #ifndef GL_ARB_vertex_type_2_10_10_10_rev #define GL_ARB_vertex_type_2_10_10_10_rev 1 #define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 #define GL_INT_2_10_10_10_REV 0x8D9F typedef void (GLAPIENTRY * PFNGLCOLORP3UIPROC) (GLenum type, GLuint color); typedef void (GLAPIENTRY * PFNGLCOLORP3UIVPROC) (GLenum type, const GLuint* color); typedef void (GLAPIENTRY * PFNGLCOLORP4UIPROC) (GLenum type, GLuint color); typedef void (GLAPIENTRY * PFNGLCOLORP4UIVPROC) (GLenum type, const GLuint* color); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP1UIPROC) (GLenum texture, GLenum type, GLuint coords); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP1UIVPROC) (GLenum texture, GLenum type, const GLuint* coords); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP2UIPROC) (GLenum texture, GLenum type, GLuint coords); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP2UIVPROC) (GLenum texture, GLenum type, const GLuint* coords); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP3UIPROC) (GLenum texture, GLenum type, GLuint coords); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP3UIVPROC) (GLenum texture, GLenum type, const GLuint* coords); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP4UIPROC) (GLenum texture, GLenum type, GLuint coords); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP4UIVPROC) (GLenum texture, GLenum type, const GLuint* coords); typedef void (GLAPIENTRY * PFNGLNORMALP3UIPROC) (GLenum type, GLuint coords); typedef void (GLAPIENTRY * PFNGLNORMALP3UIVPROC) (GLenum type, const GLuint* coords); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORP3UIPROC) (GLenum type, GLuint color); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORP3UIVPROC) (GLenum type, const GLuint* color); typedef void (GLAPIENTRY * PFNGLTEXCOORDP1UIPROC) (GLenum type, GLuint coords); typedef void (GLAPIENTRY * PFNGLTEXCOORDP1UIVPROC) (GLenum type, const GLuint* coords); typedef void (GLAPIENTRY * PFNGLTEXCOORDP2UIPROC) (GLenum type, GLuint coords); typedef void (GLAPIENTRY * PFNGLTEXCOORDP2UIVPROC) (GLenum type, const GLuint* coords); typedef void (GLAPIENTRY * PFNGLTEXCOORDP3UIPROC) (GLenum type, GLuint coords); typedef void (GLAPIENTRY * PFNGLTEXCOORDP3UIVPROC) (GLenum type, const GLuint* coords); typedef void (GLAPIENTRY * PFNGLTEXCOORDP4UIPROC) (GLenum type, GLuint coords); typedef void (GLAPIENTRY * PFNGLTEXCOORDP4UIVPROC) (GLenum type, const GLuint* coords); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint* value); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint* value); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint* value); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint* value); typedef void (GLAPIENTRY * PFNGLVERTEXP2UIPROC) (GLenum type, GLuint value); typedef void (GLAPIENTRY * PFNGLVERTEXP2UIVPROC) (GLenum type, const GLuint* value); typedef void (GLAPIENTRY * PFNGLVERTEXP3UIPROC) (GLenum type, GLuint value); typedef void (GLAPIENTRY * PFNGLVERTEXP3UIVPROC) (GLenum type, const GLuint* value); typedef void (GLAPIENTRY * PFNGLVERTEXP4UIPROC) (GLenum type, GLuint value); typedef void (GLAPIENTRY * PFNGLVERTEXP4UIVPROC) (GLenum type, const GLuint* value); #define glColorP3ui GLEW_GET_FUN(__glewColorP3ui) #define glColorP3uiv GLEW_GET_FUN(__glewColorP3uiv) #define glColorP4ui GLEW_GET_FUN(__glewColorP4ui) #define glColorP4uiv GLEW_GET_FUN(__glewColorP4uiv) #define glMultiTexCoordP1ui GLEW_GET_FUN(__glewMultiTexCoordP1ui) #define glMultiTexCoordP1uiv GLEW_GET_FUN(__glewMultiTexCoordP1uiv) #define glMultiTexCoordP2ui GLEW_GET_FUN(__glewMultiTexCoordP2ui) #define glMultiTexCoordP2uiv GLEW_GET_FUN(__glewMultiTexCoordP2uiv) #define glMultiTexCoordP3ui GLEW_GET_FUN(__glewMultiTexCoordP3ui) #define glMultiTexCoordP3uiv GLEW_GET_FUN(__glewMultiTexCoordP3uiv) #define glMultiTexCoordP4ui GLEW_GET_FUN(__glewMultiTexCoordP4ui) #define glMultiTexCoordP4uiv GLEW_GET_FUN(__glewMultiTexCoordP4uiv) #define glNormalP3ui GLEW_GET_FUN(__glewNormalP3ui) #define glNormalP3uiv GLEW_GET_FUN(__glewNormalP3uiv) #define glSecondaryColorP3ui GLEW_GET_FUN(__glewSecondaryColorP3ui) #define glSecondaryColorP3uiv GLEW_GET_FUN(__glewSecondaryColorP3uiv) #define glTexCoordP1ui GLEW_GET_FUN(__glewTexCoordP1ui) #define glTexCoordP1uiv GLEW_GET_FUN(__glewTexCoordP1uiv) #define glTexCoordP2ui GLEW_GET_FUN(__glewTexCoordP2ui) #define glTexCoordP2uiv GLEW_GET_FUN(__glewTexCoordP2uiv) #define glTexCoordP3ui GLEW_GET_FUN(__glewTexCoordP3ui) #define glTexCoordP3uiv GLEW_GET_FUN(__glewTexCoordP3uiv) #define glTexCoordP4ui GLEW_GET_FUN(__glewTexCoordP4ui) #define glTexCoordP4uiv GLEW_GET_FUN(__glewTexCoordP4uiv) #define glVertexAttribP1ui GLEW_GET_FUN(__glewVertexAttribP1ui) #define glVertexAttribP1uiv GLEW_GET_FUN(__glewVertexAttribP1uiv) #define glVertexAttribP2ui GLEW_GET_FUN(__glewVertexAttribP2ui) #define glVertexAttribP2uiv GLEW_GET_FUN(__glewVertexAttribP2uiv) #define glVertexAttribP3ui GLEW_GET_FUN(__glewVertexAttribP3ui) #define glVertexAttribP3uiv GLEW_GET_FUN(__glewVertexAttribP3uiv) #define glVertexAttribP4ui GLEW_GET_FUN(__glewVertexAttribP4ui) #define glVertexAttribP4uiv GLEW_GET_FUN(__glewVertexAttribP4uiv) #define glVertexP2ui GLEW_GET_FUN(__glewVertexP2ui) #define glVertexP2uiv GLEW_GET_FUN(__glewVertexP2uiv) #define glVertexP3ui GLEW_GET_FUN(__glewVertexP3ui) #define glVertexP3uiv GLEW_GET_FUN(__glewVertexP3uiv) #define glVertexP4ui GLEW_GET_FUN(__glewVertexP4ui) #define glVertexP4uiv GLEW_GET_FUN(__glewVertexP4uiv) #define GLEW_ARB_vertex_type_2_10_10_10_rev GLEW_GET_VAR(__GLEW_ARB_vertex_type_2_10_10_10_rev) #endif /* GL_ARB_vertex_type_2_10_10_10_rev */ /* ------------------------- GL_ARB_viewport_array ------------------------- */ #ifndef GL_ARB_viewport_array #define GL_ARB_viewport_array 1 #define GL_DEPTH_RANGE 0x0B70 #define GL_VIEWPORT 0x0BA2 #define GL_SCISSOR_BOX 0x0C10 #define GL_SCISSOR_TEST 0x0C11 #define GL_MAX_VIEWPORTS 0x825B #define GL_VIEWPORT_SUBPIXEL_BITS 0x825C #define GL_VIEWPORT_BOUNDS_RANGE 0x825D #define GL_LAYER_PROVOKING_VERTEX 0x825E #define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F #define GL_UNDEFINED_VERTEX 0x8260 #define GL_FIRST_VERTEX_CONVENTION 0x8E4D #define GL_LAST_VERTEX_CONVENTION 0x8E4E #define GL_PROVOKING_VERTEX 0x8E4F typedef void (GLAPIENTRY * PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLclampd * v); typedef void (GLAPIENTRY * PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLclampd n, GLclampd f); typedef void (GLAPIENTRY * PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble* data); typedef void (GLAPIENTRY * PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat* data); typedef void (GLAPIENTRY * PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint * v); typedef void (GLAPIENTRY * PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); typedef void (GLAPIENTRY * PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint * v); typedef void (GLAPIENTRY * PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat * v); typedef void (GLAPIENTRY * PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); typedef void (GLAPIENTRY * PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat * v); #define glDepthRangeArrayv GLEW_GET_FUN(__glewDepthRangeArrayv) #define glDepthRangeIndexed GLEW_GET_FUN(__glewDepthRangeIndexed) #define glGetDoublei_v GLEW_GET_FUN(__glewGetDoublei_v) #define glGetFloati_v GLEW_GET_FUN(__glewGetFloati_v) #define glScissorArrayv GLEW_GET_FUN(__glewScissorArrayv) #define glScissorIndexed GLEW_GET_FUN(__glewScissorIndexed) #define glScissorIndexedv GLEW_GET_FUN(__glewScissorIndexedv) #define glViewportArrayv GLEW_GET_FUN(__glewViewportArrayv) #define glViewportIndexedf GLEW_GET_FUN(__glewViewportIndexedf) #define glViewportIndexedfv GLEW_GET_FUN(__glewViewportIndexedfv) #define GLEW_ARB_viewport_array GLEW_GET_VAR(__GLEW_ARB_viewport_array) #endif /* GL_ARB_viewport_array */ /* --------------------------- GL_ARB_window_pos --------------------------- */ #ifndef GL_ARB_window_pos #define GL_ARB_window_pos 1 typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DVARBPROC) (const GLdouble* p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FVARBPROC) (const GLfloat* p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IVARBPROC) (const GLint* p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SVARBPROC) (const GLshort* p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DVARBPROC) (const GLdouble* p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FVARBPROC) (const GLfloat* p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IVARBPROC) (const GLint* p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SVARBPROC) (const GLshort* p); #define glWindowPos2dARB GLEW_GET_FUN(__glewWindowPos2dARB) #define glWindowPos2dvARB GLEW_GET_FUN(__glewWindowPos2dvARB) #define glWindowPos2fARB GLEW_GET_FUN(__glewWindowPos2fARB) #define glWindowPos2fvARB GLEW_GET_FUN(__glewWindowPos2fvARB) #define glWindowPos2iARB GLEW_GET_FUN(__glewWindowPos2iARB) #define glWindowPos2ivARB GLEW_GET_FUN(__glewWindowPos2ivARB) #define glWindowPos2sARB GLEW_GET_FUN(__glewWindowPos2sARB) #define glWindowPos2svARB GLEW_GET_FUN(__glewWindowPos2svARB) #define glWindowPos3dARB GLEW_GET_FUN(__glewWindowPos3dARB) #define glWindowPos3dvARB GLEW_GET_FUN(__glewWindowPos3dvARB) #define glWindowPos3fARB GLEW_GET_FUN(__glewWindowPos3fARB) #define glWindowPos3fvARB GLEW_GET_FUN(__glewWindowPos3fvARB) #define glWindowPos3iARB GLEW_GET_FUN(__glewWindowPos3iARB) #define glWindowPos3ivARB GLEW_GET_FUN(__glewWindowPos3ivARB) #define glWindowPos3sARB GLEW_GET_FUN(__glewWindowPos3sARB) #define glWindowPos3svARB GLEW_GET_FUN(__glewWindowPos3svARB) #define GLEW_ARB_window_pos GLEW_GET_VAR(__GLEW_ARB_window_pos) #endif /* GL_ARB_window_pos */ /* ------------------------- GL_ATIX_point_sprites ------------------------- */ #ifndef GL_ATIX_point_sprites #define GL_ATIX_point_sprites 1 #define GL_TEXTURE_POINT_MODE_ATIX 0x60B0 #define GL_TEXTURE_POINT_ONE_COORD_ATIX 0x60B1 #define GL_TEXTURE_POINT_SPRITE_ATIX 0x60B2 #define GL_POINT_SPRITE_CULL_MODE_ATIX 0x60B3 #define GL_POINT_SPRITE_CULL_CENTER_ATIX 0x60B4 #define GL_POINT_SPRITE_CULL_CLIP_ATIX 0x60B5 #define GLEW_ATIX_point_sprites GLEW_GET_VAR(__GLEW_ATIX_point_sprites) #endif /* GL_ATIX_point_sprites */ /* ---------------------- GL_ATIX_texture_env_combine3 --------------------- */ #ifndef GL_ATIX_texture_env_combine3 #define GL_ATIX_texture_env_combine3 1 #define GL_MODULATE_ADD_ATIX 0x8744 #define GL_MODULATE_SIGNED_ADD_ATIX 0x8745 #define GL_MODULATE_SUBTRACT_ATIX 0x8746 #define GLEW_ATIX_texture_env_combine3 GLEW_GET_VAR(__GLEW_ATIX_texture_env_combine3) #endif /* GL_ATIX_texture_env_combine3 */ /* ----------------------- GL_ATIX_texture_env_route ----------------------- */ #ifndef GL_ATIX_texture_env_route #define GL_ATIX_texture_env_route 1 #define GL_SECONDARY_COLOR_ATIX 0x8747 #define GL_TEXTURE_OUTPUT_RGB_ATIX 0x8748 #define GL_TEXTURE_OUTPUT_ALPHA_ATIX 0x8749 #define GLEW_ATIX_texture_env_route GLEW_GET_VAR(__GLEW_ATIX_texture_env_route) #endif /* GL_ATIX_texture_env_route */ /* ---------------- GL_ATIX_vertex_shader_output_point_size ---------------- */ #ifndef GL_ATIX_vertex_shader_output_point_size #define GL_ATIX_vertex_shader_output_point_size 1 #define GL_OUTPUT_POINT_SIZE_ATIX 0x610E #define GLEW_ATIX_vertex_shader_output_point_size GLEW_GET_VAR(__GLEW_ATIX_vertex_shader_output_point_size) #endif /* GL_ATIX_vertex_shader_output_point_size */ /* -------------------------- GL_ATI_draw_buffers -------------------------- */ #ifndef GL_ATI_draw_buffers #define GL_ATI_draw_buffers 1 #define GL_MAX_DRAW_BUFFERS_ATI 0x8824 #define GL_DRAW_BUFFER0_ATI 0x8825 #define GL_DRAW_BUFFER1_ATI 0x8826 #define GL_DRAW_BUFFER2_ATI 0x8827 #define GL_DRAW_BUFFER3_ATI 0x8828 #define GL_DRAW_BUFFER4_ATI 0x8829 #define GL_DRAW_BUFFER5_ATI 0x882A #define GL_DRAW_BUFFER6_ATI 0x882B #define GL_DRAW_BUFFER7_ATI 0x882C #define GL_DRAW_BUFFER8_ATI 0x882D #define GL_DRAW_BUFFER9_ATI 0x882E #define GL_DRAW_BUFFER10_ATI 0x882F #define GL_DRAW_BUFFER11_ATI 0x8830 #define GL_DRAW_BUFFER12_ATI 0x8831 #define GL_DRAW_BUFFER13_ATI 0x8832 #define GL_DRAW_BUFFER14_ATI 0x8833 #define GL_DRAW_BUFFER15_ATI 0x8834 typedef void (GLAPIENTRY * PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum* bufs); #define glDrawBuffersATI GLEW_GET_FUN(__glewDrawBuffersATI) #define GLEW_ATI_draw_buffers GLEW_GET_VAR(__GLEW_ATI_draw_buffers) #endif /* GL_ATI_draw_buffers */ /* -------------------------- GL_ATI_element_array ------------------------- */ #ifndef GL_ATI_element_array #define GL_ATI_element_array 1 #define GL_ELEMENT_ARRAY_ATI 0x8768 #define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 #define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A typedef void (GLAPIENTRY * PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count); typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count); typedef void (GLAPIENTRY * PFNGLELEMENTPOINTERATIPROC) (GLenum type, const void* pointer); #define glDrawElementArrayATI GLEW_GET_FUN(__glewDrawElementArrayATI) #define glDrawRangeElementArrayATI GLEW_GET_FUN(__glewDrawRangeElementArrayATI) #define glElementPointerATI GLEW_GET_FUN(__glewElementPointerATI) #define GLEW_ATI_element_array GLEW_GET_VAR(__GLEW_ATI_element_array) #endif /* GL_ATI_element_array */ /* ------------------------- GL_ATI_envmap_bumpmap ------------------------- */ #ifndef GL_ATI_envmap_bumpmap #define GL_ATI_envmap_bumpmap 1 #define GL_BUMP_ROT_MATRIX_ATI 0x8775 #define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 #define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 #define GL_BUMP_TEX_UNITS_ATI 0x8778 #define GL_DUDV_ATI 0x8779 #define GL_DU8DV8_ATI 0x877A #define GL_BUMP_ENVMAP_ATI 0x877B #define GL_BUMP_TARGET_ATI 0x877C typedef void (GLAPIENTRY * PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); typedef void (GLAPIENTRY * PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); typedef void (GLAPIENTRY * PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); typedef void (GLAPIENTRY * PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); #define glGetTexBumpParameterfvATI GLEW_GET_FUN(__glewGetTexBumpParameterfvATI) #define glGetTexBumpParameterivATI GLEW_GET_FUN(__glewGetTexBumpParameterivATI) #define glTexBumpParameterfvATI GLEW_GET_FUN(__glewTexBumpParameterfvATI) #define glTexBumpParameterivATI GLEW_GET_FUN(__glewTexBumpParameterivATI) #define GLEW_ATI_envmap_bumpmap GLEW_GET_VAR(__GLEW_ATI_envmap_bumpmap) #endif /* GL_ATI_envmap_bumpmap */ /* ------------------------- GL_ATI_fragment_shader ------------------------ */ #ifndef GL_ATI_fragment_shader #define GL_ATI_fragment_shader 1 #define GL_RED_BIT_ATI 0x00000001 #define GL_2X_BIT_ATI 0x00000001 #define GL_4X_BIT_ATI 0x00000002 #define GL_GREEN_BIT_ATI 0x00000002 #define GL_COMP_BIT_ATI 0x00000002 #define GL_BLUE_BIT_ATI 0x00000004 #define GL_8X_BIT_ATI 0x00000004 #define GL_NEGATE_BIT_ATI 0x00000004 #define GL_BIAS_BIT_ATI 0x00000008 #define GL_HALF_BIT_ATI 0x00000008 #define GL_QUARTER_BIT_ATI 0x00000010 #define GL_EIGHTH_BIT_ATI 0x00000020 #define GL_SATURATE_BIT_ATI 0x00000040 #define GL_FRAGMENT_SHADER_ATI 0x8920 #define GL_REG_0_ATI 0x8921 #define GL_REG_1_ATI 0x8922 #define GL_REG_2_ATI 0x8923 #define GL_REG_3_ATI 0x8924 #define GL_REG_4_ATI 0x8925 #define GL_REG_5_ATI 0x8926 #define GL_CON_0_ATI 0x8941 #define GL_CON_1_ATI 0x8942 #define GL_CON_2_ATI 0x8943 #define GL_CON_3_ATI 0x8944 #define GL_CON_4_ATI 0x8945 #define GL_CON_5_ATI 0x8946 #define GL_CON_6_ATI 0x8947 #define GL_CON_7_ATI 0x8948 #define GL_MOV_ATI 0x8961 #define GL_ADD_ATI 0x8963 #define GL_MUL_ATI 0x8964 #define GL_SUB_ATI 0x8965 #define GL_DOT3_ATI 0x8966 #define GL_DOT4_ATI 0x8967 #define GL_MAD_ATI 0x8968 #define GL_LERP_ATI 0x8969 #define GL_CND_ATI 0x896A #define GL_CND0_ATI 0x896B #define GL_DOT2_ADD_ATI 0x896C #define GL_SECONDARY_INTERPOLATOR_ATI 0x896D #define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E #define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F #define GL_NUM_PASSES_ATI 0x8970 #define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 #define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 #define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 #define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 #define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 #define GL_SWIZZLE_STR_ATI 0x8976 #define GL_SWIZZLE_STQ_ATI 0x8977 #define GL_SWIZZLE_STR_DR_ATI 0x8978 #define GL_SWIZZLE_STQ_DQ_ATI 0x8979 #define GL_SWIZZLE_STRQ_ATI 0x897A #define GL_SWIZZLE_STRQ_DQ_ATI 0x897B typedef void (GLAPIENTRY * PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); typedef void (GLAPIENTRY * PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); typedef void (GLAPIENTRY * PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); typedef void (GLAPIENTRY * PFNGLBEGINFRAGMENTSHADERATIPROC) (void); typedef void (GLAPIENTRY * PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id); typedef void (GLAPIENTRY * PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); typedef void (GLAPIENTRY * PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); typedef void (GLAPIENTRY * PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); typedef void (GLAPIENTRY * PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id); typedef void (GLAPIENTRY * PFNGLENDFRAGMENTSHADERATIPROC) (void); typedef GLuint (GLAPIENTRY * PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range); typedef void (GLAPIENTRY * PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle); typedef void (GLAPIENTRY * PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle); typedef void (GLAPIENTRY * PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat* value); #define glAlphaFragmentOp1ATI GLEW_GET_FUN(__glewAlphaFragmentOp1ATI) #define glAlphaFragmentOp2ATI GLEW_GET_FUN(__glewAlphaFragmentOp2ATI) #define glAlphaFragmentOp3ATI GLEW_GET_FUN(__glewAlphaFragmentOp3ATI) #define glBeginFragmentShaderATI GLEW_GET_FUN(__glewBeginFragmentShaderATI) #define glBindFragmentShaderATI GLEW_GET_FUN(__glewBindFragmentShaderATI) #define glColorFragmentOp1ATI GLEW_GET_FUN(__glewColorFragmentOp1ATI) #define glColorFragmentOp2ATI GLEW_GET_FUN(__glewColorFragmentOp2ATI) #define glColorFragmentOp3ATI GLEW_GET_FUN(__glewColorFragmentOp3ATI) #define glDeleteFragmentShaderATI GLEW_GET_FUN(__glewDeleteFragmentShaderATI) #define glEndFragmentShaderATI GLEW_GET_FUN(__glewEndFragmentShaderATI) #define glGenFragmentShadersATI GLEW_GET_FUN(__glewGenFragmentShadersATI) #define glPassTexCoordATI GLEW_GET_FUN(__glewPassTexCoordATI) #define glSampleMapATI GLEW_GET_FUN(__glewSampleMapATI) #define glSetFragmentShaderConstantATI GLEW_GET_FUN(__glewSetFragmentShaderConstantATI) #define GLEW_ATI_fragment_shader GLEW_GET_VAR(__GLEW_ATI_fragment_shader) #endif /* GL_ATI_fragment_shader */ /* ------------------------ GL_ATI_map_object_buffer ----------------------- */ #ifndef GL_ATI_map_object_buffer #define GL_ATI_map_object_buffer 1 typedef GLvoid * (GLAPIENTRY * PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer); typedef void (GLAPIENTRY * PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer); #define glMapObjectBufferATI GLEW_GET_FUN(__glewMapObjectBufferATI) #define glUnmapObjectBufferATI GLEW_GET_FUN(__glewUnmapObjectBufferATI) #define GLEW_ATI_map_object_buffer GLEW_GET_VAR(__GLEW_ATI_map_object_buffer) #endif /* GL_ATI_map_object_buffer */ /* ----------------------------- GL_ATI_meminfo ---------------------------- */ #ifndef GL_ATI_meminfo #define GL_ATI_meminfo 1 #define GL_VBO_FREE_MEMORY_ATI 0x87FB #define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC #define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD #define GLEW_ATI_meminfo GLEW_GET_VAR(__GLEW_ATI_meminfo) #endif /* GL_ATI_meminfo */ /* -------------------------- GL_ATI_pn_triangles -------------------------- */ #ifndef GL_ATI_pn_triangles #define GL_ATI_pn_triangles 1 #define GL_PN_TRIANGLES_ATI 0x87F0 #define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 #define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 #define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 #define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 #define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 #define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 #define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 #define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 typedef void (GLAPIENTRY * PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param); typedef void (GLAPIENTRY * PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param); #define glPNTrianglesfATI GLEW_GET_FUN(__glewPNTrianglesfATI) #define glPNTrianglesiATI GLEW_GET_FUN(__glewPNTrianglesiATI) #define GLEW_ATI_pn_triangles GLEW_GET_VAR(__GLEW_ATI_pn_triangles) #endif /* GL_ATI_pn_triangles */ /* ------------------------ GL_ATI_separate_stencil ------------------------ */ #ifndef GL_ATI_separate_stencil #define GL_ATI_separate_stencil 1 #define GL_STENCIL_BACK_FUNC_ATI 0x8800 #define GL_STENCIL_BACK_FAIL_ATI 0x8801 #define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 #define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 typedef void (GLAPIENTRY * PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); typedef void (GLAPIENTRY * PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); #define glStencilFuncSeparateATI GLEW_GET_FUN(__glewStencilFuncSeparateATI) #define glStencilOpSeparateATI GLEW_GET_FUN(__glewStencilOpSeparateATI) #define GLEW_ATI_separate_stencil GLEW_GET_VAR(__GLEW_ATI_separate_stencil) #endif /* GL_ATI_separate_stencil */ /* ----------------------- GL_ATI_shader_texture_lod ----------------------- */ #ifndef GL_ATI_shader_texture_lod #define GL_ATI_shader_texture_lod 1 #define GLEW_ATI_shader_texture_lod GLEW_GET_VAR(__GLEW_ATI_shader_texture_lod) #endif /* GL_ATI_shader_texture_lod */ /* ---------------------- GL_ATI_text_fragment_shader ---------------------- */ #ifndef GL_ATI_text_fragment_shader #define GL_ATI_text_fragment_shader 1 #define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 #define GLEW_ATI_text_fragment_shader GLEW_GET_VAR(__GLEW_ATI_text_fragment_shader) #endif /* GL_ATI_text_fragment_shader */ /* --------------------- GL_ATI_texture_compression_3dc -------------------- */ #ifndef GL_ATI_texture_compression_3dc #define GL_ATI_texture_compression_3dc 1 #define GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI 0x8837 #define GLEW_ATI_texture_compression_3dc GLEW_GET_VAR(__GLEW_ATI_texture_compression_3dc) #endif /* GL_ATI_texture_compression_3dc */ /* ---------------------- GL_ATI_texture_env_combine3 ---------------------- */ #ifndef GL_ATI_texture_env_combine3 #define GL_ATI_texture_env_combine3 1 #define GL_MODULATE_ADD_ATI 0x8744 #define GL_MODULATE_SIGNED_ADD_ATI 0x8745 #define GL_MODULATE_SUBTRACT_ATI 0x8746 #define GLEW_ATI_texture_env_combine3 GLEW_GET_VAR(__GLEW_ATI_texture_env_combine3) #endif /* GL_ATI_texture_env_combine3 */ /* -------------------------- GL_ATI_texture_float ------------------------- */ #ifndef GL_ATI_texture_float #define GL_ATI_texture_float 1 #define GL_RGBA_FLOAT32_ATI 0x8814 #define GL_RGB_FLOAT32_ATI 0x8815 #define GL_ALPHA_FLOAT32_ATI 0x8816 #define GL_INTENSITY_FLOAT32_ATI 0x8817 #define GL_LUMINANCE_FLOAT32_ATI 0x8818 #define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 #define GL_RGBA_FLOAT16_ATI 0x881A #define GL_RGB_FLOAT16_ATI 0x881B #define GL_ALPHA_FLOAT16_ATI 0x881C #define GL_INTENSITY_FLOAT16_ATI 0x881D #define GL_LUMINANCE_FLOAT16_ATI 0x881E #define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F #define GLEW_ATI_texture_float GLEW_GET_VAR(__GLEW_ATI_texture_float) #endif /* GL_ATI_texture_float */ /* ----------------------- GL_ATI_texture_mirror_once ---------------------- */ #ifndef GL_ATI_texture_mirror_once #define GL_ATI_texture_mirror_once 1 #define GL_MIRROR_CLAMP_ATI 0x8742 #define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 #define GLEW_ATI_texture_mirror_once GLEW_GET_VAR(__GLEW_ATI_texture_mirror_once) #endif /* GL_ATI_texture_mirror_once */ /* ----------------------- GL_ATI_vertex_array_object ---------------------- */ #ifndef GL_ATI_vertex_array_object #define GL_ATI_vertex_array_object 1 #define GL_STATIC_ATI 0x8760 #define GL_DYNAMIC_ATI 0x8761 #define GL_PRESERVE_ATI 0x8762 #define GL_DISCARD_ATI 0x8763 #define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 #define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 #define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 #define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 typedef void (GLAPIENTRY * PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); typedef void (GLAPIENTRY * PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer); typedef void (GLAPIENTRY * PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint* params); typedef GLboolean (GLAPIENTRY * PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer); typedef GLuint (GLAPIENTRY * PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const void* pointer, GLenum usage); typedef void (GLAPIENTRY * PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const void* pointer, GLenum preserve); typedef void (GLAPIENTRY * PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); #define glArrayObjectATI GLEW_GET_FUN(__glewArrayObjectATI) #define glFreeObjectBufferATI GLEW_GET_FUN(__glewFreeObjectBufferATI) #define glGetArrayObjectfvATI GLEW_GET_FUN(__glewGetArrayObjectfvATI) #define glGetArrayObjectivATI GLEW_GET_FUN(__glewGetArrayObjectivATI) #define glGetObjectBufferfvATI GLEW_GET_FUN(__glewGetObjectBufferfvATI) #define glGetObjectBufferivATI GLEW_GET_FUN(__glewGetObjectBufferivATI) #define glGetVariantArrayObjectfvATI GLEW_GET_FUN(__glewGetVariantArrayObjectfvATI) #define glGetVariantArrayObjectivATI GLEW_GET_FUN(__glewGetVariantArrayObjectivATI) #define glIsObjectBufferATI GLEW_GET_FUN(__glewIsObjectBufferATI) #define glNewObjectBufferATI GLEW_GET_FUN(__glewNewObjectBufferATI) #define glUpdateObjectBufferATI GLEW_GET_FUN(__glewUpdateObjectBufferATI) #define glVariantArrayObjectATI GLEW_GET_FUN(__glewVariantArrayObjectATI) #define GLEW_ATI_vertex_array_object GLEW_GET_VAR(__GLEW_ATI_vertex_array_object) #endif /* GL_ATI_vertex_array_object */ /* ------------------- GL_ATI_vertex_attrib_array_object ------------------- */ #ifndef GL_ATI_vertex_attrib_array_object #define GL_ATI_vertex_attrib_array_object 1 typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); #define glGetVertexAttribArrayObjectfvATI GLEW_GET_FUN(__glewGetVertexAttribArrayObjectfvATI) #define glGetVertexAttribArrayObjectivATI GLEW_GET_FUN(__glewGetVertexAttribArrayObjectivATI) #define glVertexAttribArrayObjectATI GLEW_GET_FUN(__glewVertexAttribArrayObjectATI) #define GLEW_ATI_vertex_attrib_array_object GLEW_GET_VAR(__GLEW_ATI_vertex_attrib_array_object) #endif /* GL_ATI_vertex_attrib_array_object */ /* ------------------------- GL_ATI_vertex_streams ------------------------- */ #ifndef GL_ATI_vertex_streams #define GL_ATI_vertex_streams 1 #define GL_MAX_VERTEX_STREAMS_ATI 0x876B #define GL_VERTEX_SOURCE_ATI 0x876C #define GL_VERTEX_STREAM0_ATI 0x876D #define GL_VERTEX_STREAM1_ATI 0x876E #define GL_VERTEX_STREAM2_ATI 0x876F #define GL_VERTEX_STREAM3_ATI 0x8770 #define GL_VERTEX_STREAM4_ATI 0x8771 #define GL_VERTEX_STREAM5_ATI 0x8772 #define GL_VERTEX_STREAM6_ATI 0x8773 #define GL_VERTEX_STREAM7_ATI 0x8774 typedef void (GLAPIENTRY * PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream); typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte x, GLbyte y, GLbyte z); typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords); typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); typedef void (GLAPIENTRY * PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param); typedef void (GLAPIENTRY * PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords); #define glClientActiveVertexStreamATI GLEW_GET_FUN(__glewClientActiveVertexStreamATI) #define glNormalStream3bATI GLEW_GET_FUN(__glewNormalStream3bATI) #define glNormalStream3bvATI GLEW_GET_FUN(__glewNormalStream3bvATI) #define glNormalStream3dATI GLEW_GET_FUN(__glewNormalStream3dATI) #define glNormalStream3dvATI GLEW_GET_FUN(__glewNormalStream3dvATI) #define glNormalStream3fATI GLEW_GET_FUN(__glewNormalStream3fATI) #define glNormalStream3fvATI GLEW_GET_FUN(__glewNormalStream3fvATI) #define glNormalStream3iATI GLEW_GET_FUN(__glewNormalStream3iATI) #define glNormalStream3ivATI GLEW_GET_FUN(__glewNormalStream3ivATI) #define glNormalStream3sATI GLEW_GET_FUN(__glewNormalStream3sATI) #define glNormalStream3svATI GLEW_GET_FUN(__glewNormalStream3svATI) #define glVertexBlendEnvfATI GLEW_GET_FUN(__glewVertexBlendEnvfATI) #define glVertexBlendEnviATI GLEW_GET_FUN(__glewVertexBlendEnviATI) #define glVertexStream1dATI GLEW_GET_FUN(__glewVertexStream1dATI) #define glVertexStream1dvATI GLEW_GET_FUN(__glewVertexStream1dvATI) #define glVertexStream1fATI GLEW_GET_FUN(__glewVertexStream1fATI) #define glVertexStream1fvATI GLEW_GET_FUN(__glewVertexStream1fvATI) #define glVertexStream1iATI GLEW_GET_FUN(__glewVertexStream1iATI) #define glVertexStream1ivATI GLEW_GET_FUN(__glewVertexStream1ivATI) #define glVertexStream1sATI GLEW_GET_FUN(__glewVertexStream1sATI) #define glVertexStream1svATI GLEW_GET_FUN(__glewVertexStream1svATI) #define glVertexStream2dATI GLEW_GET_FUN(__glewVertexStream2dATI) #define glVertexStream2dvATI GLEW_GET_FUN(__glewVertexStream2dvATI) #define glVertexStream2fATI GLEW_GET_FUN(__glewVertexStream2fATI) #define glVertexStream2fvATI GLEW_GET_FUN(__glewVertexStream2fvATI) #define glVertexStream2iATI GLEW_GET_FUN(__glewVertexStream2iATI) #define glVertexStream2ivATI GLEW_GET_FUN(__glewVertexStream2ivATI) #define glVertexStream2sATI GLEW_GET_FUN(__glewVertexStream2sATI) #define glVertexStream2svATI GLEW_GET_FUN(__glewVertexStream2svATI) #define glVertexStream3dATI GLEW_GET_FUN(__glewVertexStream3dATI) #define glVertexStream3dvATI GLEW_GET_FUN(__glewVertexStream3dvATI) #define glVertexStream3fATI GLEW_GET_FUN(__glewVertexStream3fATI) #define glVertexStream3fvATI GLEW_GET_FUN(__glewVertexStream3fvATI) #define glVertexStream3iATI GLEW_GET_FUN(__glewVertexStream3iATI) #define glVertexStream3ivATI GLEW_GET_FUN(__glewVertexStream3ivATI) #define glVertexStream3sATI GLEW_GET_FUN(__glewVertexStream3sATI) #define glVertexStream3svATI GLEW_GET_FUN(__glewVertexStream3svATI) #define glVertexStream4dATI GLEW_GET_FUN(__glewVertexStream4dATI) #define glVertexStream4dvATI GLEW_GET_FUN(__glewVertexStream4dvATI) #define glVertexStream4fATI GLEW_GET_FUN(__glewVertexStream4fATI) #define glVertexStream4fvATI GLEW_GET_FUN(__glewVertexStream4fvATI) #define glVertexStream4iATI GLEW_GET_FUN(__glewVertexStream4iATI) #define glVertexStream4ivATI GLEW_GET_FUN(__glewVertexStream4ivATI) #define glVertexStream4sATI GLEW_GET_FUN(__glewVertexStream4sATI) #define glVertexStream4svATI GLEW_GET_FUN(__glewVertexStream4svATI) #define GLEW_ATI_vertex_streams GLEW_GET_VAR(__GLEW_ATI_vertex_streams) #endif /* GL_ATI_vertex_streams */ /* --------------------------- GL_EXT_422_pixels --------------------------- */ #ifndef GL_EXT_422_pixels #define GL_EXT_422_pixels 1 #define GL_422_EXT 0x80CC #define GL_422_REV_EXT 0x80CD #define GL_422_AVERAGE_EXT 0x80CE #define GL_422_REV_AVERAGE_EXT 0x80CF #define GLEW_EXT_422_pixels GLEW_GET_VAR(__GLEW_EXT_422_pixels) #endif /* GL_EXT_422_pixels */ /* ---------------------------- GL_EXT_Cg_shader --------------------------- */ #ifndef GL_EXT_Cg_shader #define GL_EXT_Cg_shader 1 #define GL_CG_VERTEX_SHADER_EXT 0x890E #define GL_CG_FRAGMENT_SHADER_EXT 0x890F #define GLEW_EXT_Cg_shader GLEW_GET_VAR(__GLEW_EXT_Cg_shader) #endif /* GL_EXT_Cg_shader */ /* ------------------------------ GL_EXT_abgr ------------------------------ */ #ifndef GL_EXT_abgr #define GL_EXT_abgr 1 #define GL_ABGR_EXT 0x8000 #define GLEW_EXT_abgr GLEW_GET_VAR(__GLEW_EXT_abgr) #endif /* GL_EXT_abgr */ /* ------------------------------ GL_EXT_bgra ------------------------------ */ #ifndef GL_EXT_bgra #define GL_EXT_bgra 1 #define GL_BGR_EXT 0x80E0 #define GL_BGRA_EXT 0x80E1 #define GLEW_EXT_bgra GLEW_GET_VAR(__GLEW_EXT_bgra) #endif /* GL_EXT_bgra */ /* ------------------------ GL_EXT_bindable_uniform ------------------------ */ #ifndef GL_EXT_bindable_uniform #define GL_EXT_bindable_uniform 1 #define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2 #define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3 #define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4 #define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED #define GL_UNIFORM_BUFFER_EXT 0x8DEE #define GL_UNIFORM_BUFFER_BINDING_EXT 0x8DEF typedef GLint (GLAPIENTRY * PFNGLGETUNIFORMBUFFERSIZEEXTPROC) (GLuint program, GLint location); typedef GLintptr (GLAPIENTRY * PFNGLGETUNIFORMOFFSETEXTPROC) (GLuint program, GLint location); typedef void (GLAPIENTRY * PFNGLUNIFORMBUFFEREXTPROC) (GLuint program, GLint location, GLuint buffer); #define glGetUniformBufferSizeEXT GLEW_GET_FUN(__glewGetUniformBufferSizeEXT) #define glGetUniformOffsetEXT GLEW_GET_FUN(__glewGetUniformOffsetEXT) #define glUniformBufferEXT GLEW_GET_FUN(__glewUniformBufferEXT) #define GLEW_EXT_bindable_uniform GLEW_GET_VAR(__GLEW_EXT_bindable_uniform) #endif /* GL_EXT_bindable_uniform */ /* --------------------------- GL_EXT_blend_color -------------------------- */ #ifndef GL_EXT_blend_color #define GL_EXT_blend_color 1 #define GL_CONSTANT_COLOR_EXT 0x8001 #define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 #define GL_CONSTANT_ALPHA_EXT 0x8003 #define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 #define GL_BLEND_COLOR_EXT 0x8005 typedef void (GLAPIENTRY * PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); #define glBlendColorEXT GLEW_GET_FUN(__glewBlendColorEXT) #define GLEW_EXT_blend_color GLEW_GET_VAR(__GLEW_EXT_blend_color) #endif /* GL_EXT_blend_color */ /* --------------------- GL_EXT_blend_equation_separate -------------------- */ #ifndef GL_EXT_blend_equation_separate #define GL_EXT_blend_equation_separate 1 #define GL_BLEND_EQUATION_RGB_EXT 0x8009 #define GL_BLEND_EQUATION_ALPHA_EXT 0x883D typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha); #define glBlendEquationSeparateEXT GLEW_GET_FUN(__glewBlendEquationSeparateEXT) #define GLEW_EXT_blend_equation_separate GLEW_GET_VAR(__GLEW_EXT_blend_equation_separate) #endif /* GL_EXT_blend_equation_separate */ /* ----------------------- GL_EXT_blend_func_separate ---------------------- */ #ifndef GL_EXT_blend_func_separate #define GL_EXT_blend_func_separate 1 #define GL_BLEND_DST_RGB_EXT 0x80C8 #define GL_BLEND_SRC_RGB_EXT 0x80C9 #define GL_BLEND_DST_ALPHA_EXT 0x80CA #define GL_BLEND_SRC_ALPHA_EXT 0x80CB typedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); #define glBlendFuncSeparateEXT GLEW_GET_FUN(__glewBlendFuncSeparateEXT) #define GLEW_EXT_blend_func_separate GLEW_GET_VAR(__GLEW_EXT_blend_func_separate) #endif /* GL_EXT_blend_func_separate */ /* ------------------------- GL_EXT_blend_logic_op ------------------------- */ #ifndef GL_EXT_blend_logic_op #define GL_EXT_blend_logic_op 1 #define GLEW_EXT_blend_logic_op GLEW_GET_VAR(__GLEW_EXT_blend_logic_op) #endif /* GL_EXT_blend_logic_op */ /* -------------------------- GL_EXT_blend_minmax -------------------------- */ #ifndef GL_EXT_blend_minmax #define GL_EXT_blend_minmax 1 #define GL_FUNC_ADD_EXT 0x8006 #define GL_MIN_EXT 0x8007 #define GL_MAX_EXT 0x8008 #define GL_BLEND_EQUATION_EXT 0x8009 typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); #define glBlendEquationEXT GLEW_GET_FUN(__glewBlendEquationEXT) #define GLEW_EXT_blend_minmax GLEW_GET_VAR(__GLEW_EXT_blend_minmax) #endif /* GL_EXT_blend_minmax */ /* ------------------------- GL_EXT_blend_subtract ------------------------- */ #ifndef GL_EXT_blend_subtract #define GL_EXT_blend_subtract 1 #define GL_FUNC_SUBTRACT_EXT 0x800A #define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B #define GLEW_EXT_blend_subtract GLEW_GET_VAR(__GLEW_EXT_blend_subtract) #endif /* GL_EXT_blend_subtract */ /* ------------------------ GL_EXT_clip_volume_hint ------------------------ */ #ifndef GL_EXT_clip_volume_hint #define GL_EXT_clip_volume_hint 1 #define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 #define GLEW_EXT_clip_volume_hint GLEW_GET_VAR(__GLEW_EXT_clip_volume_hint) #endif /* GL_EXT_clip_volume_hint */ /* ------------------------------ GL_EXT_cmyka ----------------------------- */ #ifndef GL_EXT_cmyka #define GL_EXT_cmyka 1 #define GL_CMYK_EXT 0x800C #define GL_CMYKA_EXT 0x800D #define GL_PACK_CMYK_HINT_EXT 0x800E #define GL_UNPACK_CMYK_HINT_EXT 0x800F #define GLEW_EXT_cmyka GLEW_GET_VAR(__GLEW_EXT_cmyka) #endif /* GL_EXT_cmyka */ /* ------------------------- GL_EXT_color_subtable ------------------------- */ #ifndef GL_EXT_color_subtable #define GL_EXT_color_subtable 1 typedef void (GLAPIENTRY * PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void* data); typedef void (GLAPIENTRY * PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); #define glColorSubTableEXT GLEW_GET_FUN(__glewColorSubTableEXT) #define glCopyColorSubTableEXT GLEW_GET_FUN(__glewCopyColorSubTableEXT) #define GLEW_EXT_color_subtable GLEW_GET_VAR(__GLEW_EXT_color_subtable) #endif /* GL_EXT_color_subtable */ /* ---------------------- GL_EXT_compiled_vertex_array --------------------- */ #ifndef GL_EXT_compiled_vertex_array #define GL_EXT_compiled_vertex_array 1 #define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 #define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 typedef void (GLAPIENTRY * PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); typedef void (GLAPIENTRY * PFNGLUNLOCKARRAYSEXTPROC) (void); #define glLockArraysEXT GLEW_GET_FUN(__glewLockArraysEXT) #define glUnlockArraysEXT GLEW_GET_FUN(__glewUnlockArraysEXT) #define GLEW_EXT_compiled_vertex_array GLEW_GET_VAR(__GLEW_EXT_compiled_vertex_array) #endif /* GL_EXT_compiled_vertex_array */ /* --------------------------- GL_EXT_convolution -------------------------- */ #ifndef GL_EXT_convolution #define GL_EXT_convolution 1 #define GL_CONVOLUTION_1D_EXT 0x8010 #define GL_CONVOLUTION_2D_EXT 0x8011 #define GL_SEPARABLE_2D_EXT 0x8012 #define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 #define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 #define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 #define GL_REDUCE_EXT 0x8016 #define GL_CONVOLUTION_FORMAT_EXT 0x8017 #define GL_CONVOLUTION_WIDTH_EXT 0x8018 #define GL_CONVOLUTION_HEIGHT_EXT 0x8019 #define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A #define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B #define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C #define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D #define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E #define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F #define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 #define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 #define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 #define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 typedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void* image); typedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* image); typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint* params); typedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); typedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void* image); typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void* row, void* column, void* span); typedef void (GLAPIENTRY * PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* row, const void* column); #define glConvolutionFilter1DEXT GLEW_GET_FUN(__glewConvolutionFilter1DEXT) #define glConvolutionFilter2DEXT GLEW_GET_FUN(__glewConvolutionFilter2DEXT) #define glConvolutionParameterfEXT GLEW_GET_FUN(__glewConvolutionParameterfEXT) #define glConvolutionParameterfvEXT GLEW_GET_FUN(__glewConvolutionParameterfvEXT) #define glConvolutionParameteriEXT GLEW_GET_FUN(__glewConvolutionParameteriEXT) #define glConvolutionParameterivEXT GLEW_GET_FUN(__glewConvolutionParameterivEXT) #define glCopyConvolutionFilter1DEXT GLEW_GET_FUN(__glewCopyConvolutionFilter1DEXT) #define glCopyConvolutionFilter2DEXT GLEW_GET_FUN(__glewCopyConvolutionFilter2DEXT) #define glGetConvolutionFilterEXT GLEW_GET_FUN(__glewGetConvolutionFilterEXT) #define glGetConvolutionParameterfvEXT GLEW_GET_FUN(__glewGetConvolutionParameterfvEXT) #define glGetConvolutionParameterivEXT GLEW_GET_FUN(__glewGetConvolutionParameterivEXT) #define glGetSeparableFilterEXT GLEW_GET_FUN(__glewGetSeparableFilterEXT) #define glSeparableFilter2DEXT GLEW_GET_FUN(__glewSeparableFilter2DEXT) #define GLEW_EXT_convolution GLEW_GET_VAR(__GLEW_EXT_convolution) #endif /* GL_EXT_convolution */ /* ------------------------ GL_EXT_coordinate_frame ------------------------ */ #ifndef GL_EXT_coordinate_frame #define GL_EXT_coordinate_frame 1 #define GL_TANGENT_ARRAY_EXT 0x8439 #define GL_BINORMAL_ARRAY_EXT 0x843A #define GL_CURRENT_TANGENT_EXT 0x843B #define GL_CURRENT_BINORMAL_EXT 0x843C #define GL_TANGENT_ARRAY_TYPE_EXT 0x843E #define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F #define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 #define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 #define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 #define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 #define GL_MAP1_TANGENT_EXT 0x8444 #define GL_MAP2_TANGENT_EXT 0x8445 #define GL_MAP1_BINORMAL_EXT 0x8446 #define GL_MAP2_BINORMAL_EXT 0x8447 typedef void (GLAPIENTRY * PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, void* pointer); typedef void (GLAPIENTRY * PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, void* pointer); #define glBinormalPointerEXT GLEW_GET_FUN(__glewBinormalPointerEXT) #define glTangentPointerEXT GLEW_GET_FUN(__glewTangentPointerEXT) #define GLEW_EXT_coordinate_frame GLEW_GET_VAR(__GLEW_EXT_coordinate_frame) #endif /* GL_EXT_coordinate_frame */ /* -------------------------- GL_EXT_copy_texture -------------------------- */ #ifndef GL_EXT_copy_texture #define GL_EXT_copy_texture 1 typedef void (GLAPIENTRY * PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); typedef void (GLAPIENTRY * PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); typedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); typedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); typedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); #define glCopyTexImage1DEXT GLEW_GET_FUN(__glewCopyTexImage1DEXT) #define glCopyTexImage2DEXT GLEW_GET_FUN(__glewCopyTexImage2DEXT) #define glCopyTexSubImage1DEXT GLEW_GET_FUN(__glewCopyTexSubImage1DEXT) #define glCopyTexSubImage2DEXT GLEW_GET_FUN(__glewCopyTexSubImage2DEXT) #define glCopyTexSubImage3DEXT GLEW_GET_FUN(__glewCopyTexSubImage3DEXT) #define GLEW_EXT_copy_texture GLEW_GET_VAR(__GLEW_EXT_copy_texture) #endif /* GL_EXT_copy_texture */ /* --------------------------- GL_EXT_cull_vertex -------------------------- */ #ifndef GL_EXT_cull_vertex #define GL_EXT_cull_vertex 1 #define GL_CULL_VERTEX_EXT 0x81AA #define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB #define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC typedef void (GLAPIENTRY * PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble* params); typedef void (GLAPIENTRY * PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat* params); #define glCullParameterdvEXT GLEW_GET_FUN(__glewCullParameterdvEXT) #define glCullParameterfvEXT GLEW_GET_FUN(__glewCullParameterfvEXT) #define GLEW_EXT_cull_vertex GLEW_GET_VAR(__GLEW_EXT_cull_vertex) #endif /* GL_EXT_cull_vertex */ /* -------------------------- GL_EXT_debug_marker -------------------------- */ #ifndef GL_EXT_debug_marker #define GL_EXT_debug_marker 1 typedef void (GLAPIENTRY * PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar* marker); typedef void (GLAPIENTRY * PFNGLPOPGROUPMARKEREXTPROC) (void); typedef void (GLAPIENTRY * PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar* marker); #define glInsertEventMarkerEXT GLEW_GET_FUN(__glewInsertEventMarkerEXT) #define glPopGroupMarkerEXT GLEW_GET_FUN(__glewPopGroupMarkerEXT) #define glPushGroupMarkerEXT GLEW_GET_FUN(__glewPushGroupMarkerEXT) #define GLEW_EXT_debug_marker GLEW_GET_VAR(__GLEW_EXT_debug_marker) #endif /* GL_EXT_debug_marker */ /* ------------------------ GL_EXT_depth_bounds_test ----------------------- */ #ifndef GL_EXT_depth_bounds_test #define GL_EXT_depth_bounds_test 1 #define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 #define GL_DEPTH_BOUNDS_EXT 0x8891 typedef void (GLAPIENTRY * PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax); #define glDepthBoundsEXT GLEW_GET_FUN(__glewDepthBoundsEXT) #define GLEW_EXT_depth_bounds_test GLEW_GET_VAR(__GLEW_EXT_depth_bounds_test) #endif /* GL_EXT_depth_bounds_test */ /* ----------------------- GL_EXT_direct_state_access ---------------------- */ #ifndef GL_EXT_direct_state_access #define GL_EXT_direct_state_access 1 #define GL_PROGRAM_MATRIX_EXT 0x8E2D #define GL_TRANSPOSE_PROGRAM_MATRIX_EXT 0x8E2E #define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F typedef void (GLAPIENTRY * PFNGLBINDMULTITEXTUREEXTPROC) (GLenum texunit, GLenum target, GLuint texture); typedef GLenum (GLAPIENTRY * PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC) (GLuint framebuffer, GLenum target); typedef void (GLAPIENTRY * PFNGLCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void* data); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void* data); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void* data); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void* data); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data); typedef void (GLAPIENTRY * PFNGLCOPYMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); typedef void (GLAPIENTRY * PFNGLCOPYMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); typedef void (GLAPIENTRY * PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); typedef void (GLAPIENTRY * PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); typedef void (GLAPIENTRY * PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); typedef void (GLAPIENTRY * PFNGLCOPYTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); typedef void (GLAPIENTRY * PFNGLCOPYTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); typedef void (GLAPIENTRY * PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); typedef void (GLAPIENTRY * PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); typedef void (GLAPIENTRY * PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); typedef void (GLAPIENTRY * PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index); typedef void (GLAPIENTRY * PFNGLDISABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index); typedef void (GLAPIENTRY * PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index); typedef void (GLAPIENTRY * PFNGLDISABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array); typedef void (GLAPIENTRY * PFNGLENABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index); typedef void (GLAPIENTRY * PFNGLENABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index); typedef void (GLAPIENTRY * PFNGLENABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index); typedef void (GLAPIENTRY * PFNGLENABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array); typedef void (GLAPIENTRY * PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC) (GLuint framebuffer, GLenum mode); typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC) (GLuint framebuffer, GLsizei n, const GLenum* bufs); typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERREADBUFFEREXTPROC) (GLuint framebuffer, GLenum mode); typedef void (GLAPIENTRY * PFNGLGENERATEMULTITEXMIPMAPEXTPROC) (GLenum texunit, GLenum target); typedef void (GLAPIENTRY * PFNGLGENERATETEXTUREMIPMAPEXTPROC) (GLuint texture, GLenum target); typedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, void* img); typedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, void* img); typedef void (GLAPIENTRY * PFNGLGETDOUBLEINDEXEDVEXTPROC) (GLenum target, GLuint index, GLdouble* params); typedef void (GLAPIENTRY * PFNGLGETDOUBLEI_VEXTPROC) (GLenum pname, GLuint index, GLdouble* params); typedef void (GLAPIENTRY * PFNGLGETFLOATINDEXEDVEXTPROC) (GLenum target, GLuint index, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETFLOATI_VEXTPROC) (GLenum pname, GLuint index, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint* param); typedef void (GLAPIENTRY * PFNGLGETMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble* params); typedef void (GLAPIENTRY * PFNGLGETMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, void* pixels); typedef void (GLAPIENTRY * PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLuint* params); typedef void (GLAPIENTRY * PFNGLGETMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC) (GLuint buffer, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERPOINTERVEXTPROC) (GLuint buffer, GLenum pname, void** params); typedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, void* data); typedef void (GLAPIENTRY * PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLint* params); typedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint* params); typedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble* params); typedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum pname, void* string); typedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMIVEXTPROC) (GLuint program, GLenum target, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC) (GLuint renderbuffer, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETPOINTERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLvoid** params); typedef void (GLAPIENTRY * PFNGLGETPOINTERI_VEXTPROC) (GLenum pname, GLuint index, GLvoid** params); typedef void (GLAPIENTRY * PFNGLGETTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, void* pixels); typedef void (GLAPIENTRY * PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLuint* params); typedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint* param); typedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYINTEGERVEXTPROC) (GLuint vaobj, GLenum pname, GLint* param); typedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, GLvoid** param); typedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYPOINTERVEXTPROC) (GLuint vaobj, GLenum pname, GLvoid** param); typedef GLvoid * (GLAPIENTRY * PFNGLMAPNAMEDBUFFEREXTPROC) (GLuint buffer, GLenum access); typedef GLvoid * (GLAPIENTRY * PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); typedef void (GLAPIENTRY * PFNGLMATRIXFRUSTUMEXTPROC) (GLenum matrixMode, GLdouble l, GLdouble r, GLdouble b, GLdouble t, GLdouble n, GLdouble f); typedef void (GLAPIENTRY * PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum matrixMode); typedef void (GLAPIENTRY * PFNGLMATRIXLOADTRANSPOSEDEXTPROC) (GLenum matrixMode, const GLdouble* m); typedef void (GLAPIENTRY * PFNGLMATRIXLOADTRANSPOSEFEXTPROC) (GLenum matrixMode, const GLfloat* m); typedef void (GLAPIENTRY * PFNGLMATRIXLOADDEXTPROC) (GLenum matrixMode, const GLdouble* m); typedef void (GLAPIENTRY * PFNGLMATRIXLOADFEXTPROC) (GLenum matrixMode, const GLfloat* m); typedef void (GLAPIENTRY * PFNGLMATRIXMULTTRANSPOSEDEXTPROC) (GLenum matrixMode, const GLdouble* m); typedef void (GLAPIENTRY * PFNGLMATRIXMULTTRANSPOSEFEXTPROC) (GLenum matrixMode, const GLfloat* m); typedef void (GLAPIENTRY * PFNGLMATRIXMULTDEXTPROC) (GLenum matrixMode, const GLdouble* m); typedef void (GLAPIENTRY * PFNGLMATRIXMULTFEXTPROC) (GLenum matrixMode, const GLfloat* m); typedef void (GLAPIENTRY * PFNGLMATRIXORTHOEXTPROC) (GLenum matrixMode, GLdouble l, GLdouble r, GLdouble b, GLdouble t, GLdouble n, GLdouble f); typedef void (GLAPIENTRY * PFNGLMATRIXPOPEXTPROC) (GLenum matrixMode); typedef void (GLAPIENTRY * PFNGLMATRIXPUSHEXTPROC) (GLenum matrixMode); typedef void (GLAPIENTRY * PFNGLMATRIXROTATEDEXTPROC) (GLenum matrixMode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z); typedef void (GLAPIENTRY * PFNGLMATRIXROTATEFEXTPROC) (GLenum matrixMode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLMATRIXSCALEDEXTPROC) (GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z); typedef void (GLAPIENTRY * PFNGLMATRIXSCALEFEXTPROC) (GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLMATRIXTRANSLATEDEXTPROC) (GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z); typedef void (GLAPIENTRY * PFNGLMATRIXTRANSLATEFEXTPROC) (GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLMULTITEXBUFFEREXTPROC) (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDPOINTEREXTPROC) (GLenum texunit, GLint size, GLenum type, GLsizei stride, const void* pointer); typedef void (GLAPIENTRY * PFNGLMULTITEXENVFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param); typedef void (GLAPIENTRY * PFNGLMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLMULTITEXENVIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param); typedef void (GLAPIENTRY * PFNGLMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint* params); typedef void (GLAPIENTRY * PFNGLMULTITEXGENDEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble param); typedef void (GLAPIENTRY * PFNGLMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLdouble* params); typedef void (GLAPIENTRY * PFNGLMULTITEXGENFEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat param); typedef void (GLAPIENTRY * PFNGLMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLMULTITEXGENIEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint param); typedef void (GLAPIENTRY * PFNGLMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLint* params); typedef void (GLAPIENTRY * PFNGLMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void* pixels); typedef void (GLAPIENTRY * PFNGLMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels); typedef void (GLAPIENTRY * PFNGLMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void* pixels); typedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint* params); typedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLuint* params); typedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param); typedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat* param); typedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param); typedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint* param); typedef void (GLAPIENTRY * PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenum target, GLuint renderbuffer); typedef void (GLAPIENTRY * PFNGLMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void* pixels); typedef void (GLAPIENTRY * PFNGLMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels); typedef void (GLAPIENTRY * PFNGLMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels); typedef void (GLAPIENTRY * PFNGLNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLsizeiptr size, const void* data, GLenum usage); typedef void (GLAPIENTRY * PFNGLNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const void* data); typedef void (GLAPIENTRY * PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face); typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLdouble* params); typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC) (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLint* params); typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLuint* params); typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint* params); typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint* params); typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum format, GLsizei len, const void* string); typedef void (GLAPIENTRY * PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); typedef void (GLAPIENTRY * PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC) (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); typedef void (GLAPIENTRY * PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1DEXTPROC) (GLuint program, GLint location, GLdouble x); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask); typedef void (GLAPIENTRY * PFNGLTEXTUREBUFFEREXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer); typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void* pixels); typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels); typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void* pixels); typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint* params); typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLuint* params); typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERFEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat param); typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLfloat* param); typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint param); typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint* param); typedef void (GLAPIENTRY * PFNGLTEXTURERENDERBUFFEREXTPROC) (GLuint texture, GLenum target, GLuint renderbuffer); typedef void (GLAPIENTRY * PFNGLTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void* pixels); typedef void (GLAPIENTRY * PFNGLTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels); typedef void (GLAPIENTRY * PFNGLTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels); typedef GLboolean (GLAPIENTRY * PFNGLUNMAPNAMEDBUFFEREXTPROC) (GLuint buffer); typedef void (GLAPIENTRY * PFNGLVERTEXARRAYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); typedef void (GLAPIENTRY * PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLsizei stride, GLintptr offset); typedef void (GLAPIENTRY * PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); typedef void (GLAPIENTRY * PFNGLVERTEXARRAYINDEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); typedef void (GLAPIENTRY * PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum texunit, GLint size, GLenum type, GLsizei stride, GLintptr offset); typedef void (GLAPIENTRY * PFNGLVERTEXARRAYNORMALOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); typedef void (GLAPIENTRY * PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); typedef void (GLAPIENTRY * PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset); typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); #define glBindMultiTextureEXT GLEW_GET_FUN(__glewBindMultiTextureEXT) #define glCheckNamedFramebufferStatusEXT GLEW_GET_FUN(__glewCheckNamedFramebufferStatusEXT) #define glClientAttribDefaultEXT GLEW_GET_FUN(__glewClientAttribDefaultEXT) #define glCompressedMultiTexImage1DEXT GLEW_GET_FUN(__glewCompressedMultiTexImage1DEXT) #define glCompressedMultiTexImage2DEXT GLEW_GET_FUN(__glewCompressedMultiTexImage2DEXT) #define glCompressedMultiTexImage3DEXT GLEW_GET_FUN(__glewCompressedMultiTexImage3DEXT) #define glCompressedMultiTexSubImage1DEXT GLEW_GET_FUN(__glewCompressedMultiTexSubImage1DEXT) #define glCompressedMultiTexSubImage2DEXT GLEW_GET_FUN(__glewCompressedMultiTexSubImage2DEXT) #define glCompressedMultiTexSubImage3DEXT GLEW_GET_FUN(__glewCompressedMultiTexSubImage3DEXT) #define glCompressedTextureImage1DEXT GLEW_GET_FUN(__glewCompressedTextureImage1DEXT) #define glCompressedTextureImage2DEXT GLEW_GET_FUN(__glewCompressedTextureImage2DEXT) #define glCompressedTextureImage3DEXT GLEW_GET_FUN(__glewCompressedTextureImage3DEXT) #define glCompressedTextureSubImage1DEXT GLEW_GET_FUN(__glewCompressedTextureSubImage1DEXT) #define glCompressedTextureSubImage2DEXT GLEW_GET_FUN(__glewCompressedTextureSubImage2DEXT) #define glCompressedTextureSubImage3DEXT GLEW_GET_FUN(__glewCompressedTextureSubImage3DEXT) #define glCopyMultiTexImage1DEXT GLEW_GET_FUN(__glewCopyMultiTexImage1DEXT) #define glCopyMultiTexImage2DEXT GLEW_GET_FUN(__glewCopyMultiTexImage2DEXT) #define glCopyMultiTexSubImage1DEXT GLEW_GET_FUN(__glewCopyMultiTexSubImage1DEXT) #define glCopyMultiTexSubImage2DEXT GLEW_GET_FUN(__glewCopyMultiTexSubImage2DEXT) #define glCopyMultiTexSubImage3DEXT GLEW_GET_FUN(__glewCopyMultiTexSubImage3DEXT) #define glCopyTextureImage1DEXT GLEW_GET_FUN(__glewCopyTextureImage1DEXT) #define glCopyTextureImage2DEXT GLEW_GET_FUN(__glewCopyTextureImage2DEXT) #define glCopyTextureSubImage1DEXT GLEW_GET_FUN(__glewCopyTextureSubImage1DEXT) #define glCopyTextureSubImage2DEXT GLEW_GET_FUN(__glewCopyTextureSubImage2DEXT) #define glCopyTextureSubImage3DEXT GLEW_GET_FUN(__glewCopyTextureSubImage3DEXT) #define glDisableClientStateIndexedEXT GLEW_GET_FUN(__glewDisableClientStateIndexedEXT) #define glDisableClientStateiEXT GLEW_GET_FUN(__glewDisableClientStateiEXT) #define glDisableVertexArrayAttribEXT GLEW_GET_FUN(__glewDisableVertexArrayAttribEXT) #define glDisableVertexArrayEXT GLEW_GET_FUN(__glewDisableVertexArrayEXT) #define glEnableClientStateIndexedEXT GLEW_GET_FUN(__glewEnableClientStateIndexedEXT) #define glEnableClientStateiEXT GLEW_GET_FUN(__glewEnableClientStateiEXT) #define glEnableVertexArrayAttribEXT GLEW_GET_FUN(__glewEnableVertexArrayAttribEXT) #define glEnableVertexArrayEXT GLEW_GET_FUN(__glewEnableVertexArrayEXT) #define glFlushMappedNamedBufferRangeEXT GLEW_GET_FUN(__glewFlushMappedNamedBufferRangeEXT) #define glFramebufferDrawBufferEXT GLEW_GET_FUN(__glewFramebufferDrawBufferEXT) #define glFramebufferDrawBuffersEXT GLEW_GET_FUN(__glewFramebufferDrawBuffersEXT) #define glFramebufferReadBufferEXT GLEW_GET_FUN(__glewFramebufferReadBufferEXT) #define glGenerateMultiTexMipmapEXT GLEW_GET_FUN(__glewGenerateMultiTexMipmapEXT) #define glGenerateTextureMipmapEXT GLEW_GET_FUN(__glewGenerateTextureMipmapEXT) #define glGetCompressedMultiTexImageEXT GLEW_GET_FUN(__glewGetCompressedMultiTexImageEXT) #define glGetCompressedTextureImageEXT GLEW_GET_FUN(__glewGetCompressedTextureImageEXT) #define glGetDoubleIndexedvEXT GLEW_GET_FUN(__glewGetDoubleIndexedvEXT) #define glGetDoublei_vEXT GLEW_GET_FUN(__glewGetDoublei_vEXT) #define glGetFloatIndexedvEXT GLEW_GET_FUN(__glewGetFloatIndexedvEXT) #define glGetFloati_vEXT GLEW_GET_FUN(__glewGetFloati_vEXT) #define glGetFramebufferParameterivEXT GLEW_GET_FUN(__glewGetFramebufferParameterivEXT) #define glGetMultiTexEnvfvEXT GLEW_GET_FUN(__glewGetMultiTexEnvfvEXT) #define glGetMultiTexEnvivEXT GLEW_GET_FUN(__glewGetMultiTexEnvivEXT) #define glGetMultiTexGendvEXT GLEW_GET_FUN(__glewGetMultiTexGendvEXT) #define glGetMultiTexGenfvEXT GLEW_GET_FUN(__glewGetMultiTexGenfvEXT) #define glGetMultiTexGenivEXT GLEW_GET_FUN(__glewGetMultiTexGenivEXT) #define glGetMultiTexImageEXT GLEW_GET_FUN(__glewGetMultiTexImageEXT) #define glGetMultiTexLevelParameterfvEXT GLEW_GET_FUN(__glewGetMultiTexLevelParameterfvEXT) #define glGetMultiTexLevelParameterivEXT GLEW_GET_FUN(__glewGetMultiTexLevelParameterivEXT) #define glGetMultiTexParameterIivEXT GLEW_GET_FUN(__glewGetMultiTexParameterIivEXT) #define glGetMultiTexParameterIuivEXT GLEW_GET_FUN(__glewGetMultiTexParameterIuivEXT) #define glGetMultiTexParameterfvEXT GLEW_GET_FUN(__glewGetMultiTexParameterfvEXT) #define glGetMultiTexParameterivEXT GLEW_GET_FUN(__glewGetMultiTexParameterivEXT) #define glGetNamedBufferParameterivEXT GLEW_GET_FUN(__glewGetNamedBufferParameterivEXT) #define glGetNamedBufferPointervEXT GLEW_GET_FUN(__glewGetNamedBufferPointervEXT) #define glGetNamedBufferSubDataEXT GLEW_GET_FUN(__glewGetNamedBufferSubDataEXT) #define glGetNamedFramebufferAttachmentParameterivEXT GLEW_GET_FUN(__glewGetNamedFramebufferAttachmentParameterivEXT) #define glGetNamedProgramLocalParameterIivEXT GLEW_GET_FUN(__glewGetNamedProgramLocalParameterIivEXT) #define glGetNamedProgramLocalParameterIuivEXT GLEW_GET_FUN(__glewGetNamedProgramLocalParameterIuivEXT) #define glGetNamedProgramLocalParameterdvEXT GLEW_GET_FUN(__glewGetNamedProgramLocalParameterdvEXT) #define glGetNamedProgramLocalParameterfvEXT GLEW_GET_FUN(__glewGetNamedProgramLocalParameterfvEXT) #define glGetNamedProgramStringEXT GLEW_GET_FUN(__glewGetNamedProgramStringEXT) #define glGetNamedProgramivEXT GLEW_GET_FUN(__glewGetNamedProgramivEXT) #define glGetNamedRenderbufferParameterivEXT GLEW_GET_FUN(__glewGetNamedRenderbufferParameterivEXT) #define glGetPointerIndexedvEXT GLEW_GET_FUN(__glewGetPointerIndexedvEXT) #define glGetPointeri_vEXT GLEW_GET_FUN(__glewGetPointeri_vEXT) #define glGetTextureImageEXT GLEW_GET_FUN(__glewGetTextureImageEXT) #define glGetTextureLevelParameterfvEXT GLEW_GET_FUN(__glewGetTextureLevelParameterfvEXT) #define glGetTextureLevelParameterivEXT GLEW_GET_FUN(__glewGetTextureLevelParameterivEXT) #define glGetTextureParameterIivEXT GLEW_GET_FUN(__glewGetTextureParameterIivEXT) #define glGetTextureParameterIuivEXT GLEW_GET_FUN(__glewGetTextureParameterIuivEXT) #define glGetTextureParameterfvEXT GLEW_GET_FUN(__glewGetTextureParameterfvEXT) #define glGetTextureParameterivEXT GLEW_GET_FUN(__glewGetTextureParameterivEXT) #define glGetVertexArrayIntegeri_vEXT GLEW_GET_FUN(__glewGetVertexArrayIntegeri_vEXT) #define glGetVertexArrayIntegervEXT GLEW_GET_FUN(__glewGetVertexArrayIntegervEXT) #define glGetVertexArrayPointeri_vEXT GLEW_GET_FUN(__glewGetVertexArrayPointeri_vEXT) #define glGetVertexArrayPointervEXT GLEW_GET_FUN(__glewGetVertexArrayPointervEXT) #define glMapNamedBufferEXT GLEW_GET_FUN(__glewMapNamedBufferEXT) #define glMapNamedBufferRangeEXT GLEW_GET_FUN(__glewMapNamedBufferRangeEXT) #define glMatrixFrustumEXT GLEW_GET_FUN(__glewMatrixFrustumEXT) #define glMatrixLoadIdentityEXT GLEW_GET_FUN(__glewMatrixLoadIdentityEXT) #define glMatrixLoadTransposedEXT GLEW_GET_FUN(__glewMatrixLoadTransposedEXT) #define glMatrixLoadTransposefEXT GLEW_GET_FUN(__glewMatrixLoadTransposefEXT) #define glMatrixLoaddEXT GLEW_GET_FUN(__glewMatrixLoaddEXT) #define glMatrixLoadfEXT GLEW_GET_FUN(__glewMatrixLoadfEXT) #define glMatrixMultTransposedEXT GLEW_GET_FUN(__glewMatrixMultTransposedEXT) #define glMatrixMultTransposefEXT GLEW_GET_FUN(__glewMatrixMultTransposefEXT) #define glMatrixMultdEXT GLEW_GET_FUN(__glewMatrixMultdEXT) #define glMatrixMultfEXT GLEW_GET_FUN(__glewMatrixMultfEXT) #define glMatrixOrthoEXT GLEW_GET_FUN(__glewMatrixOrthoEXT) #define glMatrixPopEXT GLEW_GET_FUN(__glewMatrixPopEXT) #define glMatrixPushEXT GLEW_GET_FUN(__glewMatrixPushEXT) #define glMatrixRotatedEXT GLEW_GET_FUN(__glewMatrixRotatedEXT) #define glMatrixRotatefEXT GLEW_GET_FUN(__glewMatrixRotatefEXT) #define glMatrixScaledEXT GLEW_GET_FUN(__glewMatrixScaledEXT) #define glMatrixScalefEXT GLEW_GET_FUN(__glewMatrixScalefEXT) #define glMatrixTranslatedEXT GLEW_GET_FUN(__glewMatrixTranslatedEXT) #define glMatrixTranslatefEXT GLEW_GET_FUN(__glewMatrixTranslatefEXT) #define glMultiTexBufferEXT GLEW_GET_FUN(__glewMultiTexBufferEXT) #define glMultiTexCoordPointerEXT GLEW_GET_FUN(__glewMultiTexCoordPointerEXT) #define glMultiTexEnvfEXT GLEW_GET_FUN(__glewMultiTexEnvfEXT) #define glMultiTexEnvfvEXT GLEW_GET_FUN(__glewMultiTexEnvfvEXT) #define glMultiTexEnviEXT GLEW_GET_FUN(__glewMultiTexEnviEXT) #define glMultiTexEnvivEXT GLEW_GET_FUN(__glewMultiTexEnvivEXT) #define glMultiTexGendEXT GLEW_GET_FUN(__glewMultiTexGendEXT) #define glMultiTexGendvEXT GLEW_GET_FUN(__glewMultiTexGendvEXT) #define glMultiTexGenfEXT GLEW_GET_FUN(__glewMultiTexGenfEXT) #define glMultiTexGenfvEXT GLEW_GET_FUN(__glewMultiTexGenfvEXT) #define glMultiTexGeniEXT GLEW_GET_FUN(__glewMultiTexGeniEXT) #define glMultiTexGenivEXT GLEW_GET_FUN(__glewMultiTexGenivEXT) #define glMultiTexImage1DEXT GLEW_GET_FUN(__glewMultiTexImage1DEXT) #define glMultiTexImage2DEXT GLEW_GET_FUN(__glewMultiTexImage2DEXT) #define glMultiTexImage3DEXT GLEW_GET_FUN(__glewMultiTexImage3DEXT) #define glMultiTexParameterIivEXT GLEW_GET_FUN(__glewMultiTexParameterIivEXT) #define glMultiTexParameterIuivEXT GLEW_GET_FUN(__glewMultiTexParameterIuivEXT) #define glMultiTexParameterfEXT GLEW_GET_FUN(__glewMultiTexParameterfEXT) #define glMultiTexParameterfvEXT GLEW_GET_FUN(__glewMultiTexParameterfvEXT) #define glMultiTexParameteriEXT GLEW_GET_FUN(__glewMultiTexParameteriEXT) #define glMultiTexParameterivEXT GLEW_GET_FUN(__glewMultiTexParameterivEXT) #define glMultiTexRenderbufferEXT GLEW_GET_FUN(__glewMultiTexRenderbufferEXT) #define glMultiTexSubImage1DEXT GLEW_GET_FUN(__glewMultiTexSubImage1DEXT) #define glMultiTexSubImage2DEXT GLEW_GET_FUN(__glewMultiTexSubImage2DEXT) #define glMultiTexSubImage3DEXT GLEW_GET_FUN(__glewMultiTexSubImage3DEXT) #define glNamedBufferDataEXT GLEW_GET_FUN(__glewNamedBufferDataEXT) #define glNamedBufferSubDataEXT GLEW_GET_FUN(__glewNamedBufferSubDataEXT) #define glNamedCopyBufferSubDataEXT GLEW_GET_FUN(__glewNamedCopyBufferSubDataEXT) #define glNamedFramebufferRenderbufferEXT GLEW_GET_FUN(__glewNamedFramebufferRenderbufferEXT) #define glNamedFramebufferTexture1DEXT GLEW_GET_FUN(__glewNamedFramebufferTexture1DEXT) #define glNamedFramebufferTexture2DEXT GLEW_GET_FUN(__glewNamedFramebufferTexture2DEXT) #define glNamedFramebufferTexture3DEXT GLEW_GET_FUN(__glewNamedFramebufferTexture3DEXT) #define glNamedFramebufferTextureEXT GLEW_GET_FUN(__glewNamedFramebufferTextureEXT) #define glNamedFramebufferTextureFaceEXT GLEW_GET_FUN(__glewNamedFramebufferTextureFaceEXT) #define glNamedFramebufferTextureLayerEXT GLEW_GET_FUN(__glewNamedFramebufferTextureLayerEXT) #define glNamedProgramLocalParameter4dEXT GLEW_GET_FUN(__glewNamedProgramLocalParameter4dEXT) #define glNamedProgramLocalParameter4dvEXT GLEW_GET_FUN(__glewNamedProgramLocalParameter4dvEXT) #define glNamedProgramLocalParameter4fEXT GLEW_GET_FUN(__glewNamedProgramLocalParameter4fEXT) #define glNamedProgramLocalParameter4fvEXT GLEW_GET_FUN(__glewNamedProgramLocalParameter4fvEXT) #define glNamedProgramLocalParameterI4iEXT GLEW_GET_FUN(__glewNamedProgramLocalParameterI4iEXT) #define glNamedProgramLocalParameterI4ivEXT GLEW_GET_FUN(__glewNamedProgramLocalParameterI4ivEXT) #define glNamedProgramLocalParameterI4uiEXT GLEW_GET_FUN(__glewNamedProgramLocalParameterI4uiEXT) #define glNamedProgramLocalParameterI4uivEXT GLEW_GET_FUN(__glewNamedProgramLocalParameterI4uivEXT) #define glNamedProgramLocalParameters4fvEXT GLEW_GET_FUN(__glewNamedProgramLocalParameters4fvEXT) #define glNamedProgramLocalParametersI4ivEXT GLEW_GET_FUN(__glewNamedProgramLocalParametersI4ivEXT) #define glNamedProgramLocalParametersI4uivEXT GLEW_GET_FUN(__glewNamedProgramLocalParametersI4uivEXT) #define glNamedProgramStringEXT GLEW_GET_FUN(__glewNamedProgramStringEXT) #define glNamedRenderbufferStorageEXT GLEW_GET_FUN(__glewNamedRenderbufferStorageEXT) #define glNamedRenderbufferStorageMultisampleCoverageEXT GLEW_GET_FUN(__glewNamedRenderbufferStorageMultisampleCoverageEXT) #define glNamedRenderbufferStorageMultisampleEXT GLEW_GET_FUN(__glewNamedRenderbufferStorageMultisampleEXT) #define glProgramUniform1dEXT GLEW_GET_FUN(__glewProgramUniform1dEXT) #define glProgramUniform1dvEXT GLEW_GET_FUN(__glewProgramUniform1dvEXT) #define glProgramUniform1fEXT GLEW_GET_FUN(__glewProgramUniform1fEXT) #define glProgramUniform1fvEXT GLEW_GET_FUN(__glewProgramUniform1fvEXT) #define glProgramUniform1iEXT GLEW_GET_FUN(__glewProgramUniform1iEXT) #define glProgramUniform1ivEXT GLEW_GET_FUN(__glewProgramUniform1ivEXT) #define glProgramUniform1uiEXT GLEW_GET_FUN(__glewProgramUniform1uiEXT) #define glProgramUniform1uivEXT GLEW_GET_FUN(__glewProgramUniform1uivEXT) #define glProgramUniform2dEXT GLEW_GET_FUN(__glewProgramUniform2dEXT) #define glProgramUniform2dvEXT GLEW_GET_FUN(__glewProgramUniform2dvEXT) #define glProgramUniform2fEXT GLEW_GET_FUN(__glewProgramUniform2fEXT) #define glProgramUniform2fvEXT GLEW_GET_FUN(__glewProgramUniform2fvEXT) #define glProgramUniform2iEXT GLEW_GET_FUN(__glewProgramUniform2iEXT) #define glProgramUniform2ivEXT GLEW_GET_FUN(__glewProgramUniform2ivEXT) #define glProgramUniform2uiEXT GLEW_GET_FUN(__glewProgramUniform2uiEXT) #define glProgramUniform2uivEXT GLEW_GET_FUN(__glewProgramUniform2uivEXT) #define glProgramUniform3dEXT GLEW_GET_FUN(__glewProgramUniform3dEXT) #define glProgramUniform3dvEXT GLEW_GET_FUN(__glewProgramUniform3dvEXT) #define glProgramUniform3fEXT GLEW_GET_FUN(__glewProgramUniform3fEXT) #define glProgramUniform3fvEXT GLEW_GET_FUN(__glewProgramUniform3fvEXT) #define glProgramUniform3iEXT GLEW_GET_FUN(__glewProgramUniform3iEXT) #define glProgramUniform3ivEXT GLEW_GET_FUN(__glewProgramUniform3ivEXT) #define glProgramUniform3uiEXT GLEW_GET_FUN(__glewProgramUniform3uiEXT) #define glProgramUniform3uivEXT GLEW_GET_FUN(__glewProgramUniform3uivEXT) #define glProgramUniform4dEXT GLEW_GET_FUN(__glewProgramUniform4dEXT) #define glProgramUniform4dvEXT GLEW_GET_FUN(__glewProgramUniform4dvEXT) #define glProgramUniform4fEXT GLEW_GET_FUN(__glewProgramUniform4fEXT) #define glProgramUniform4fvEXT GLEW_GET_FUN(__glewProgramUniform4fvEXT) #define glProgramUniform4iEXT GLEW_GET_FUN(__glewProgramUniform4iEXT) #define glProgramUniform4ivEXT GLEW_GET_FUN(__glewProgramUniform4ivEXT) #define glProgramUniform4uiEXT GLEW_GET_FUN(__glewProgramUniform4uiEXT) #define glProgramUniform4uivEXT GLEW_GET_FUN(__glewProgramUniform4uivEXT) #define glProgramUniformMatrix2dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2dvEXT) #define glProgramUniformMatrix2fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2fvEXT) #define glProgramUniformMatrix2x3dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2x3dvEXT) #define glProgramUniformMatrix2x3fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2x3fvEXT) #define glProgramUniformMatrix2x4dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2x4dvEXT) #define glProgramUniformMatrix2x4fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2x4fvEXT) #define glProgramUniformMatrix3dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3dvEXT) #define glProgramUniformMatrix3fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3fvEXT) #define glProgramUniformMatrix3x2dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3x2dvEXT) #define glProgramUniformMatrix3x2fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3x2fvEXT) #define glProgramUniformMatrix3x4dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3x4dvEXT) #define glProgramUniformMatrix3x4fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3x4fvEXT) #define glProgramUniformMatrix4dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4dvEXT) #define glProgramUniformMatrix4fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4fvEXT) #define glProgramUniformMatrix4x2dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4x2dvEXT) #define glProgramUniformMatrix4x2fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4x2fvEXT) #define glProgramUniformMatrix4x3dvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4x3dvEXT) #define glProgramUniformMatrix4x3fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4x3fvEXT) #define glPushClientAttribDefaultEXT GLEW_GET_FUN(__glewPushClientAttribDefaultEXT) #define glTextureBufferEXT GLEW_GET_FUN(__glewTextureBufferEXT) #define glTextureImage1DEXT GLEW_GET_FUN(__glewTextureImage1DEXT) #define glTextureImage2DEXT GLEW_GET_FUN(__glewTextureImage2DEXT) #define glTextureImage3DEXT GLEW_GET_FUN(__glewTextureImage3DEXT) #define glTextureParameterIivEXT GLEW_GET_FUN(__glewTextureParameterIivEXT) #define glTextureParameterIuivEXT GLEW_GET_FUN(__glewTextureParameterIuivEXT) #define glTextureParameterfEXT GLEW_GET_FUN(__glewTextureParameterfEXT) #define glTextureParameterfvEXT GLEW_GET_FUN(__glewTextureParameterfvEXT) #define glTextureParameteriEXT GLEW_GET_FUN(__glewTextureParameteriEXT) #define glTextureParameterivEXT GLEW_GET_FUN(__glewTextureParameterivEXT) #define glTextureRenderbufferEXT GLEW_GET_FUN(__glewTextureRenderbufferEXT) #define glTextureSubImage1DEXT GLEW_GET_FUN(__glewTextureSubImage1DEXT) #define glTextureSubImage2DEXT GLEW_GET_FUN(__glewTextureSubImage2DEXT) #define glTextureSubImage3DEXT GLEW_GET_FUN(__glewTextureSubImage3DEXT) #define glUnmapNamedBufferEXT GLEW_GET_FUN(__glewUnmapNamedBufferEXT) #define glVertexArrayColorOffsetEXT GLEW_GET_FUN(__glewVertexArrayColorOffsetEXT) #define glVertexArrayEdgeFlagOffsetEXT GLEW_GET_FUN(__glewVertexArrayEdgeFlagOffsetEXT) #define glVertexArrayFogCoordOffsetEXT GLEW_GET_FUN(__glewVertexArrayFogCoordOffsetEXT) #define glVertexArrayIndexOffsetEXT GLEW_GET_FUN(__glewVertexArrayIndexOffsetEXT) #define glVertexArrayMultiTexCoordOffsetEXT GLEW_GET_FUN(__glewVertexArrayMultiTexCoordOffsetEXT) #define glVertexArrayNormalOffsetEXT GLEW_GET_FUN(__glewVertexArrayNormalOffsetEXT) #define glVertexArraySecondaryColorOffsetEXT GLEW_GET_FUN(__glewVertexArraySecondaryColorOffsetEXT) #define glVertexArrayTexCoordOffsetEXT GLEW_GET_FUN(__glewVertexArrayTexCoordOffsetEXT) #define glVertexArrayVertexAttribIOffsetEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribIOffsetEXT) #define glVertexArrayVertexAttribOffsetEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribOffsetEXT) #define glVertexArrayVertexOffsetEXT GLEW_GET_FUN(__glewVertexArrayVertexOffsetEXT) #define GLEW_EXT_direct_state_access GLEW_GET_VAR(__GLEW_EXT_direct_state_access) #endif /* GL_EXT_direct_state_access */ /* -------------------------- GL_EXT_draw_buffers2 ------------------------- */ #ifndef GL_EXT_draw_buffers2 #define GL_EXT_draw_buffers2 1 typedef void (GLAPIENTRY * PFNGLCOLORMASKINDEXEDEXTPROC) (GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a); typedef void (GLAPIENTRY * PFNGLDISABLEINDEXEDEXTPROC) (GLenum target, GLuint index); typedef void (GLAPIENTRY * PFNGLENABLEINDEXEDEXTPROC) (GLenum target, GLuint index); typedef void (GLAPIENTRY * PFNGLGETBOOLEANINDEXEDVEXTPROC) (GLenum value, GLuint index, GLboolean* data); typedef void (GLAPIENTRY * PFNGLGETINTEGERINDEXEDVEXTPROC) (GLenum value, GLuint index, GLint* data); typedef GLboolean (GLAPIENTRY * PFNGLISENABLEDINDEXEDEXTPROC) (GLenum target, GLuint index); #define glColorMaskIndexedEXT GLEW_GET_FUN(__glewColorMaskIndexedEXT) #define glDisableIndexedEXT GLEW_GET_FUN(__glewDisableIndexedEXT) #define glEnableIndexedEXT GLEW_GET_FUN(__glewEnableIndexedEXT) #define glGetBooleanIndexedvEXT GLEW_GET_FUN(__glewGetBooleanIndexedvEXT) #define glGetIntegerIndexedvEXT GLEW_GET_FUN(__glewGetIntegerIndexedvEXT) #define glIsEnabledIndexedEXT GLEW_GET_FUN(__glewIsEnabledIndexedEXT) #define GLEW_EXT_draw_buffers2 GLEW_GET_VAR(__GLEW_EXT_draw_buffers2) #endif /* GL_EXT_draw_buffers2 */ /* ------------------------- GL_EXT_draw_instanced ------------------------- */ #ifndef GL_EXT_draw_instanced #define GL_EXT_draw_instanced 1 typedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount); typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); #define glDrawArraysInstancedEXT GLEW_GET_FUN(__glewDrawArraysInstancedEXT) #define glDrawElementsInstancedEXT GLEW_GET_FUN(__glewDrawElementsInstancedEXT) #define GLEW_EXT_draw_instanced GLEW_GET_VAR(__GLEW_EXT_draw_instanced) #endif /* GL_EXT_draw_instanced */ /* ----------------------- GL_EXT_draw_range_elements ---------------------- */ #ifndef GL_EXT_draw_range_elements #define GL_EXT_draw_range_elements 1 #define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 #define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); #define glDrawRangeElementsEXT GLEW_GET_FUN(__glewDrawRangeElementsEXT) #define GLEW_EXT_draw_range_elements GLEW_GET_VAR(__GLEW_EXT_draw_range_elements) #endif /* GL_EXT_draw_range_elements */ /* ---------------------------- GL_EXT_fog_coord --------------------------- */ #ifndef GL_EXT_fog_coord #define GL_EXT_fog_coord 1 #define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 #define GL_FOG_COORDINATE_EXT 0x8451 #define GL_FRAGMENT_DEPTH_EXT 0x8452 #define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 #define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 #define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 #define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 #define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 typedef void (GLAPIENTRY * PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); typedef void (GLAPIENTRY * PFNGLFOGCOORDDEXTPROC) (GLdouble coord); typedef void (GLAPIENTRY * PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); typedef void (GLAPIENTRY * PFNGLFOGCOORDFEXTPROC) (GLfloat coord); typedef void (GLAPIENTRY * PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); #define glFogCoordPointerEXT GLEW_GET_FUN(__glewFogCoordPointerEXT) #define glFogCoorddEXT GLEW_GET_FUN(__glewFogCoorddEXT) #define glFogCoorddvEXT GLEW_GET_FUN(__glewFogCoorddvEXT) #define glFogCoordfEXT GLEW_GET_FUN(__glewFogCoordfEXT) #define glFogCoordfvEXT GLEW_GET_FUN(__glewFogCoordfvEXT) #define GLEW_EXT_fog_coord GLEW_GET_VAR(__GLEW_EXT_fog_coord) #endif /* GL_EXT_fog_coord */ /* ------------------------ GL_EXT_fragment_lighting ----------------------- */ #ifndef GL_EXT_fragment_lighting #define GL_EXT_fragment_lighting 1 #define GL_FRAGMENT_LIGHTING_EXT 0x8400 #define GL_FRAGMENT_COLOR_MATERIAL_EXT 0x8401 #define GL_FRAGMENT_COLOR_MATERIAL_FACE_EXT 0x8402 #define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_EXT 0x8403 #define GL_MAX_FRAGMENT_LIGHTS_EXT 0x8404 #define GL_MAX_ACTIVE_LIGHTS_EXT 0x8405 #define GL_CURRENT_RASTER_NORMAL_EXT 0x8406 #define GL_LIGHT_ENV_MODE_EXT 0x8407 #define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_EXT 0x8408 #define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_EXT 0x8409 #define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_EXT 0x840A #define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_EXT 0x840B #define GL_FRAGMENT_LIGHT0_EXT 0x840C #define GL_FRAGMENT_LIGHT7_EXT 0x8413 typedef void (GLAPIENTRY * PFNGLFRAGMENTCOLORMATERIALEXTPROC) (GLenum face, GLenum mode); typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFEXTPROC) (GLenum pname, GLfloat param); typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFVEXTPROC) (GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELIEXTPROC) (GLenum pname, GLint param); typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELIVEXTPROC) (GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFEXTPROC) (GLenum light, GLenum pname, GLfloat param); typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFVEXTPROC) (GLenum light, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTIEXTPROC) (GLenum light, GLenum pname, GLint param); typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTIVEXTPROC) (GLenum light, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFEXTPROC) (GLenum face, GLenum pname, const GLfloat param); typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFVEXTPROC) (GLenum face, GLenum pname, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALIEXTPROC) (GLenum face, GLenum pname, const GLint param); typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALIVEXTPROC) (GLenum face, GLenum pname, const GLint* params); typedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTFVEXTPROC) (GLenum light, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTIVEXTPROC) (GLenum light, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALFVEXTPROC) (GLenum face, GLenum pname, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALIVEXTPROC) (GLenum face, GLenum pname, const GLint* params); typedef void (GLAPIENTRY * PFNGLLIGHTENVIEXTPROC) (GLenum pname, GLint param); #define glFragmentColorMaterialEXT GLEW_GET_FUN(__glewFragmentColorMaterialEXT) #define glFragmentLightModelfEXT GLEW_GET_FUN(__glewFragmentLightModelfEXT) #define glFragmentLightModelfvEXT GLEW_GET_FUN(__glewFragmentLightModelfvEXT) #define glFragmentLightModeliEXT GLEW_GET_FUN(__glewFragmentLightModeliEXT) #define glFragmentLightModelivEXT GLEW_GET_FUN(__glewFragmentLightModelivEXT) #define glFragmentLightfEXT GLEW_GET_FUN(__glewFragmentLightfEXT) #define glFragmentLightfvEXT GLEW_GET_FUN(__glewFragmentLightfvEXT) #define glFragmentLightiEXT GLEW_GET_FUN(__glewFragmentLightiEXT) #define glFragmentLightivEXT GLEW_GET_FUN(__glewFragmentLightivEXT) #define glFragmentMaterialfEXT GLEW_GET_FUN(__glewFragmentMaterialfEXT) #define glFragmentMaterialfvEXT GLEW_GET_FUN(__glewFragmentMaterialfvEXT) #define glFragmentMaterialiEXT GLEW_GET_FUN(__glewFragmentMaterialiEXT) #define glFragmentMaterialivEXT GLEW_GET_FUN(__glewFragmentMaterialivEXT) #define glGetFragmentLightfvEXT GLEW_GET_FUN(__glewGetFragmentLightfvEXT) #define glGetFragmentLightivEXT GLEW_GET_FUN(__glewGetFragmentLightivEXT) #define glGetFragmentMaterialfvEXT GLEW_GET_FUN(__glewGetFragmentMaterialfvEXT) #define glGetFragmentMaterialivEXT GLEW_GET_FUN(__glewGetFragmentMaterialivEXT) #define glLightEnviEXT GLEW_GET_FUN(__glewLightEnviEXT) #define GLEW_EXT_fragment_lighting GLEW_GET_VAR(__GLEW_EXT_fragment_lighting) #endif /* GL_EXT_fragment_lighting */ /* ------------------------ GL_EXT_framebuffer_blit ------------------------ */ #ifndef GL_EXT_framebuffer_blit #define GL_EXT_framebuffer_blit 1 #define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6 #define GL_READ_FRAMEBUFFER_EXT 0x8CA8 #define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9 #define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA typedef void (GLAPIENTRY * PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); #define glBlitFramebufferEXT GLEW_GET_FUN(__glewBlitFramebufferEXT) #define GLEW_EXT_framebuffer_blit GLEW_GET_VAR(__GLEW_EXT_framebuffer_blit) #endif /* GL_EXT_framebuffer_blit */ /* --------------------- GL_EXT_framebuffer_multisample -------------------- */ #ifndef GL_EXT_framebuffer_multisample #define GL_EXT_framebuffer_multisample 1 #define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB #define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 #define GL_MAX_SAMPLES_EXT 0x8D57 typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); #define glRenderbufferStorageMultisampleEXT GLEW_GET_FUN(__glewRenderbufferStorageMultisampleEXT) #define GLEW_EXT_framebuffer_multisample GLEW_GET_VAR(__GLEW_EXT_framebuffer_multisample) #endif /* GL_EXT_framebuffer_multisample */ /* --------------- GL_EXT_framebuffer_multisample_blit_scaled -------------- */ #ifndef GL_EXT_framebuffer_multisample_blit_scaled #define GL_EXT_framebuffer_multisample_blit_scaled 1 #define GL_SCALED_RESOLVE_FASTEST_EXT 0x90BA #define GL_SCALED_RESOLVE_NICEST_EXT 0x90BB #define GLEW_EXT_framebuffer_multisample_blit_scaled GLEW_GET_VAR(__GLEW_EXT_framebuffer_multisample_blit_scaled) #endif /* GL_EXT_framebuffer_multisample_blit_scaled */ /* ----------------------- GL_EXT_framebuffer_object ----------------------- */ #ifndef GL_EXT_framebuffer_object #define GL_EXT_framebuffer_object 1 #define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 #define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 #define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 #define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 #define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 #define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 #define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA #define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB #define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC #define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD #define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF #define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 #define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 #define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 #define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 #define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 #define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 #define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 #define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 #define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 #define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 #define GL_COLOR_ATTACHMENT10_EXT 0x8CEA #define GL_COLOR_ATTACHMENT11_EXT 0x8CEB #define GL_COLOR_ATTACHMENT12_EXT 0x8CEC #define GL_COLOR_ATTACHMENT13_EXT 0x8CED #define GL_COLOR_ATTACHMENT14_EXT 0x8CEE #define GL_COLOR_ATTACHMENT15_EXT 0x8CEF #define GL_DEPTH_ATTACHMENT_EXT 0x8D00 #define GL_STENCIL_ATTACHMENT_EXT 0x8D20 #define GL_FRAMEBUFFER_EXT 0x8D40 #define GL_RENDERBUFFER_EXT 0x8D41 #define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 #define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 #define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 #define GL_STENCIL_INDEX1_EXT 0x8D46 #define GL_STENCIL_INDEX4_EXT 0x8D47 #define GL_STENCIL_INDEX8_EXT 0x8D48 #define GL_STENCIL_INDEX16_EXT 0x8D49 #define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 #define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 #define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 #define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 #define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 #define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 typedef void (GLAPIENTRY * PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer); typedef void (GLAPIENTRY * PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer); typedef GLenum (GLAPIENTRY * PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target); typedef void (GLAPIENTRY * PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint* framebuffers); typedef void (GLAPIENTRY * PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint* renderbuffers); typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); typedef void (GLAPIENTRY * PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint* framebuffers); typedef void (GLAPIENTRY * PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint* renderbuffers); typedef void (GLAPIENTRY * PFNGLGENERATEMIPMAPEXTPROC) (GLenum target); typedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params); typedef GLboolean (GLAPIENTRY * PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer); typedef GLboolean (GLAPIENTRY * PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer); typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); #define glBindFramebufferEXT GLEW_GET_FUN(__glewBindFramebufferEXT) #define glBindRenderbufferEXT GLEW_GET_FUN(__glewBindRenderbufferEXT) #define glCheckFramebufferStatusEXT GLEW_GET_FUN(__glewCheckFramebufferStatusEXT) #define glDeleteFramebuffersEXT GLEW_GET_FUN(__glewDeleteFramebuffersEXT) #define glDeleteRenderbuffersEXT GLEW_GET_FUN(__glewDeleteRenderbuffersEXT) #define glFramebufferRenderbufferEXT GLEW_GET_FUN(__glewFramebufferRenderbufferEXT) #define glFramebufferTexture1DEXT GLEW_GET_FUN(__glewFramebufferTexture1DEXT) #define glFramebufferTexture2DEXT GLEW_GET_FUN(__glewFramebufferTexture2DEXT) #define glFramebufferTexture3DEXT GLEW_GET_FUN(__glewFramebufferTexture3DEXT) #define glGenFramebuffersEXT GLEW_GET_FUN(__glewGenFramebuffersEXT) #define glGenRenderbuffersEXT GLEW_GET_FUN(__glewGenRenderbuffersEXT) #define glGenerateMipmapEXT GLEW_GET_FUN(__glewGenerateMipmapEXT) #define glGetFramebufferAttachmentParameterivEXT GLEW_GET_FUN(__glewGetFramebufferAttachmentParameterivEXT) #define glGetRenderbufferParameterivEXT GLEW_GET_FUN(__glewGetRenderbufferParameterivEXT) #define glIsFramebufferEXT GLEW_GET_FUN(__glewIsFramebufferEXT) #define glIsRenderbufferEXT GLEW_GET_FUN(__glewIsRenderbufferEXT) #define glRenderbufferStorageEXT GLEW_GET_FUN(__glewRenderbufferStorageEXT) #define GLEW_EXT_framebuffer_object GLEW_GET_VAR(__GLEW_EXT_framebuffer_object) #endif /* GL_EXT_framebuffer_object */ /* ------------------------ GL_EXT_framebuffer_sRGB ------------------------ */ #ifndef GL_EXT_framebuffer_sRGB #define GL_EXT_framebuffer_sRGB 1 #define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9 #define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA #define GLEW_EXT_framebuffer_sRGB GLEW_GET_VAR(__GLEW_EXT_framebuffer_sRGB) #endif /* GL_EXT_framebuffer_sRGB */ /* ------------------------ GL_EXT_geometry_shader4 ------------------------ */ #ifndef GL_EXT_geometry_shader4 #define GL_EXT_geometry_shader4 1 #define GL_LINES_ADJACENCY_EXT 0xA #define GL_LINE_STRIP_ADJACENCY_EXT 0xB #define GL_TRIANGLES_ADJACENCY_EXT 0xC #define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0xD #define GL_PROGRAM_POINT_SIZE_EXT 0x8642 #define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B #define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4 #define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7 #define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8 #define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9 #define GL_GEOMETRY_SHADER_EXT 0x8DD9 #define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA #define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB #define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC #define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD #define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE #define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF #define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0 #define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1 typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); #define glFramebufferTextureEXT GLEW_GET_FUN(__glewFramebufferTextureEXT) #define glFramebufferTextureFaceEXT GLEW_GET_FUN(__glewFramebufferTextureFaceEXT) #define glProgramParameteriEXT GLEW_GET_FUN(__glewProgramParameteriEXT) #define GLEW_EXT_geometry_shader4 GLEW_GET_VAR(__GLEW_EXT_geometry_shader4) #endif /* GL_EXT_geometry_shader4 */ /* --------------------- GL_EXT_gpu_program_parameters --------------------- */ #ifndef GL_EXT_gpu_program_parameters #define GL_EXT_gpu_program_parameters 1 typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat* params); #define glProgramEnvParameters4fvEXT GLEW_GET_FUN(__glewProgramEnvParameters4fvEXT) #define glProgramLocalParameters4fvEXT GLEW_GET_FUN(__glewProgramLocalParameters4fvEXT) #define GLEW_EXT_gpu_program_parameters GLEW_GET_VAR(__GLEW_EXT_gpu_program_parameters) #endif /* GL_EXT_gpu_program_parameters */ /* --------------------------- GL_EXT_gpu_shader4 -------------------------- */ #ifndef GL_EXT_gpu_shader4 #define GL_EXT_gpu_shader4 1 #define GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT 0x88FD #define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0 #define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1 #define GL_SAMPLER_BUFFER_EXT 0x8DC2 #define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3 #define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4 #define GL_SAMPLER_CUBE_SHADOW_EXT 0x8DC5 #define GL_UNSIGNED_INT_VEC2_EXT 0x8DC6 #define GL_UNSIGNED_INT_VEC3_EXT 0x8DC7 #define GL_UNSIGNED_INT_VEC4_EXT 0x8DC8 #define GL_INT_SAMPLER_1D_EXT 0x8DC9 #define GL_INT_SAMPLER_2D_EXT 0x8DCA #define GL_INT_SAMPLER_3D_EXT 0x8DCB #define GL_INT_SAMPLER_CUBE_EXT 0x8DCC #define GL_INT_SAMPLER_2D_RECT_EXT 0x8DCD #define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8DCE #define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8DCF #define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0 #define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8DD1 #define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8DD2 #define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8DD3 #define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8DD4 #define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5 #define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6 #define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7 #define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 typedef void (GLAPIENTRY * PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name); typedef GLint (GLAPIENTRY * PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name); typedef void (GLAPIENTRY * PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params); typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params); typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params); typedef void (GLAPIENTRY * PFNGLUNIFORM1UIEXTPROC) (GLint location, GLuint v0); typedef void (GLAPIENTRY * PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); typedef void (GLAPIENTRY * PFNGLUNIFORM2UIEXTPROC) (GLint location, GLuint v0, GLuint v1); typedef void (GLAPIENTRY * PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); typedef void (GLAPIENTRY * PFNGLUNIFORM3UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); typedef void (GLAPIENTRY * PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); typedef void (GLAPIENTRY * PFNGLUNIFORM4UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); typedef void (GLAPIENTRY * PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); #define glBindFragDataLocationEXT GLEW_GET_FUN(__glewBindFragDataLocationEXT) #define glGetFragDataLocationEXT GLEW_GET_FUN(__glewGetFragDataLocationEXT) #define glGetUniformuivEXT GLEW_GET_FUN(__glewGetUniformuivEXT) #define glGetVertexAttribIivEXT GLEW_GET_FUN(__glewGetVertexAttribIivEXT) #define glGetVertexAttribIuivEXT GLEW_GET_FUN(__glewGetVertexAttribIuivEXT) #define glUniform1uiEXT GLEW_GET_FUN(__glewUniform1uiEXT) #define glUniform1uivEXT GLEW_GET_FUN(__glewUniform1uivEXT) #define glUniform2uiEXT GLEW_GET_FUN(__glewUniform2uiEXT) #define glUniform2uivEXT GLEW_GET_FUN(__glewUniform2uivEXT) #define glUniform3uiEXT GLEW_GET_FUN(__glewUniform3uiEXT) #define glUniform3uivEXT GLEW_GET_FUN(__glewUniform3uivEXT) #define glUniform4uiEXT GLEW_GET_FUN(__glewUniform4uiEXT) #define glUniform4uivEXT GLEW_GET_FUN(__glewUniform4uivEXT) #define glVertexAttribI1iEXT GLEW_GET_FUN(__glewVertexAttribI1iEXT) #define glVertexAttribI1ivEXT GLEW_GET_FUN(__glewVertexAttribI1ivEXT) #define glVertexAttribI1uiEXT GLEW_GET_FUN(__glewVertexAttribI1uiEXT) #define glVertexAttribI1uivEXT GLEW_GET_FUN(__glewVertexAttribI1uivEXT) #define glVertexAttribI2iEXT GLEW_GET_FUN(__glewVertexAttribI2iEXT) #define glVertexAttribI2ivEXT GLEW_GET_FUN(__glewVertexAttribI2ivEXT) #define glVertexAttribI2uiEXT GLEW_GET_FUN(__glewVertexAttribI2uiEXT) #define glVertexAttribI2uivEXT GLEW_GET_FUN(__glewVertexAttribI2uivEXT) #define glVertexAttribI3iEXT GLEW_GET_FUN(__glewVertexAttribI3iEXT) #define glVertexAttribI3ivEXT GLEW_GET_FUN(__glewVertexAttribI3ivEXT) #define glVertexAttribI3uiEXT GLEW_GET_FUN(__glewVertexAttribI3uiEXT) #define glVertexAttribI3uivEXT GLEW_GET_FUN(__glewVertexAttribI3uivEXT) #define glVertexAttribI4bvEXT GLEW_GET_FUN(__glewVertexAttribI4bvEXT) #define glVertexAttribI4iEXT GLEW_GET_FUN(__glewVertexAttribI4iEXT) #define glVertexAttribI4ivEXT GLEW_GET_FUN(__glewVertexAttribI4ivEXT) #define glVertexAttribI4svEXT GLEW_GET_FUN(__glewVertexAttribI4svEXT) #define glVertexAttribI4ubvEXT GLEW_GET_FUN(__glewVertexAttribI4ubvEXT) #define glVertexAttribI4uiEXT GLEW_GET_FUN(__glewVertexAttribI4uiEXT) #define glVertexAttribI4uivEXT GLEW_GET_FUN(__glewVertexAttribI4uivEXT) #define glVertexAttribI4usvEXT GLEW_GET_FUN(__glewVertexAttribI4usvEXT) #define glVertexAttribIPointerEXT GLEW_GET_FUN(__glewVertexAttribIPointerEXT) #define GLEW_EXT_gpu_shader4 GLEW_GET_VAR(__GLEW_EXT_gpu_shader4) #endif /* GL_EXT_gpu_shader4 */ /* ---------------------------- GL_EXT_histogram --------------------------- */ #ifndef GL_EXT_histogram #define GL_EXT_histogram 1 #define GL_HISTOGRAM_EXT 0x8024 #define GL_PROXY_HISTOGRAM_EXT 0x8025 #define GL_HISTOGRAM_WIDTH_EXT 0x8026 #define GL_HISTOGRAM_FORMAT_EXT 0x8027 #define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 #define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 #define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A #define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B #define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C #define GL_HISTOGRAM_SINK_EXT 0x802D #define GL_MINMAX_EXT 0x802E #define GL_MINMAX_FORMAT_EXT 0x802F #define GL_MINMAX_SINK_EXT 0x8030 typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void* values); typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void* values); typedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); typedef void (GLAPIENTRY * PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink); typedef void (GLAPIENTRY * PFNGLRESETHISTOGRAMEXTPROC) (GLenum target); typedef void (GLAPIENTRY * PFNGLRESETMINMAXEXTPROC) (GLenum target); #define glGetHistogramEXT GLEW_GET_FUN(__glewGetHistogramEXT) #define glGetHistogramParameterfvEXT GLEW_GET_FUN(__glewGetHistogramParameterfvEXT) #define glGetHistogramParameterivEXT GLEW_GET_FUN(__glewGetHistogramParameterivEXT) #define glGetMinmaxEXT GLEW_GET_FUN(__glewGetMinmaxEXT) #define glGetMinmaxParameterfvEXT GLEW_GET_FUN(__glewGetMinmaxParameterfvEXT) #define glGetMinmaxParameterivEXT GLEW_GET_FUN(__glewGetMinmaxParameterivEXT) #define glHistogramEXT GLEW_GET_FUN(__glewHistogramEXT) #define glMinmaxEXT GLEW_GET_FUN(__glewMinmaxEXT) #define glResetHistogramEXT GLEW_GET_FUN(__glewResetHistogramEXT) #define glResetMinmaxEXT GLEW_GET_FUN(__glewResetMinmaxEXT) #define GLEW_EXT_histogram GLEW_GET_VAR(__GLEW_EXT_histogram) #endif /* GL_EXT_histogram */ /* ----------------------- GL_EXT_index_array_formats ---------------------- */ #ifndef GL_EXT_index_array_formats #define GL_EXT_index_array_formats 1 #define GLEW_EXT_index_array_formats GLEW_GET_VAR(__GLEW_EXT_index_array_formats) #endif /* GL_EXT_index_array_formats */ /* --------------------------- GL_EXT_index_func --------------------------- */ #ifndef GL_EXT_index_func #define GL_EXT_index_func 1 typedef void (GLAPIENTRY * PFNGLINDEXFUNCEXTPROC) (GLenum func, GLfloat ref); #define glIndexFuncEXT GLEW_GET_FUN(__glewIndexFuncEXT) #define GLEW_EXT_index_func GLEW_GET_VAR(__GLEW_EXT_index_func) #endif /* GL_EXT_index_func */ /* ------------------------- GL_EXT_index_material ------------------------- */ #ifndef GL_EXT_index_material #define GL_EXT_index_material 1 typedef void (GLAPIENTRY * PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); #define glIndexMaterialEXT GLEW_GET_FUN(__glewIndexMaterialEXT) #define GLEW_EXT_index_material GLEW_GET_VAR(__GLEW_EXT_index_material) #endif /* GL_EXT_index_material */ /* -------------------------- GL_EXT_index_texture ------------------------- */ #ifndef GL_EXT_index_texture #define GL_EXT_index_texture 1 #define GLEW_EXT_index_texture GLEW_GET_VAR(__GLEW_EXT_index_texture) #endif /* GL_EXT_index_texture */ /* -------------------------- GL_EXT_light_texture ------------------------- */ #ifndef GL_EXT_light_texture #define GL_EXT_light_texture 1 #define GL_FRAGMENT_MATERIAL_EXT 0x8349 #define GL_FRAGMENT_NORMAL_EXT 0x834A #define GL_FRAGMENT_COLOR_EXT 0x834C #define GL_ATTENUATION_EXT 0x834D #define GL_SHADOW_ATTENUATION_EXT 0x834E #define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F #define GL_TEXTURE_LIGHT_EXT 0x8350 #define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 #define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 typedef void (GLAPIENTRY * PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); typedef void (GLAPIENTRY * PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); typedef void (GLAPIENTRY * PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); #define glApplyTextureEXT GLEW_GET_FUN(__glewApplyTextureEXT) #define glTextureLightEXT GLEW_GET_FUN(__glewTextureLightEXT) #define glTextureMaterialEXT GLEW_GET_FUN(__glewTextureMaterialEXT) #define GLEW_EXT_light_texture GLEW_GET_VAR(__GLEW_EXT_light_texture) #endif /* GL_EXT_light_texture */ /* ------------------------- GL_EXT_misc_attribute ------------------------- */ #ifndef GL_EXT_misc_attribute #define GL_EXT_misc_attribute 1 #define GLEW_EXT_misc_attribute GLEW_GET_VAR(__GLEW_EXT_misc_attribute) #endif /* GL_EXT_misc_attribute */ /* ------------------------ GL_EXT_multi_draw_arrays ----------------------- */ #ifndef GL_EXT_multi_draw_arrays #define GL_EXT_multi_draw_arrays 1 typedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint* first, const GLsizei *count, GLsizei primcount); typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, GLsizei* count, GLenum type, const GLvoid **indices, GLsizei primcount); #define glMultiDrawArraysEXT GLEW_GET_FUN(__glewMultiDrawArraysEXT) #define glMultiDrawElementsEXT GLEW_GET_FUN(__glewMultiDrawElementsEXT) #define GLEW_EXT_multi_draw_arrays GLEW_GET_VAR(__GLEW_EXT_multi_draw_arrays) #endif /* GL_EXT_multi_draw_arrays */ /* --------------------------- GL_EXT_multisample -------------------------- */ #ifndef GL_EXT_multisample #define GL_EXT_multisample 1 #define GL_MULTISAMPLE_EXT 0x809D #define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E #define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F #define GL_SAMPLE_MASK_EXT 0x80A0 #define GL_1PASS_EXT 0x80A1 #define GL_2PASS_0_EXT 0x80A2 #define GL_2PASS_1_EXT 0x80A3 #define GL_4PASS_0_EXT 0x80A4 #define GL_4PASS_1_EXT 0x80A5 #define GL_4PASS_2_EXT 0x80A6 #define GL_4PASS_3_EXT 0x80A7 #define GL_SAMPLE_BUFFERS_EXT 0x80A8 #define GL_SAMPLES_EXT 0x80A9 #define GL_SAMPLE_MASK_VALUE_EXT 0x80AA #define GL_SAMPLE_MASK_INVERT_EXT 0x80AB #define GL_SAMPLE_PATTERN_EXT 0x80AC #define GL_MULTISAMPLE_BIT_EXT 0x20000000 typedef void (GLAPIENTRY * PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); typedef void (GLAPIENTRY * PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); #define glSampleMaskEXT GLEW_GET_FUN(__glewSampleMaskEXT) #define glSamplePatternEXT GLEW_GET_FUN(__glewSamplePatternEXT) #define GLEW_EXT_multisample GLEW_GET_VAR(__GLEW_EXT_multisample) #endif /* GL_EXT_multisample */ /* ---------------------- GL_EXT_packed_depth_stencil ---------------------- */ #ifndef GL_EXT_packed_depth_stencil #define GL_EXT_packed_depth_stencil 1 #define GL_DEPTH_STENCIL_EXT 0x84F9 #define GL_UNSIGNED_INT_24_8_EXT 0x84FA #define GL_DEPTH24_STENCIL8_EXT 0x88F0 #define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1 #define GLEW_EXT_packed_depth_stencil GLEW_GET_VAR(__GLEW_EXT_packed_depth_stencil) #endif /* GL_EXT_packed_depth_stencil */ /* -------------------------- GL_EXT_packed_float -------------------------- */ #ifndef GL_EXT_packed_float #define GL_EXT_packed_float 1 #define GL_R11F_G11F_B10F_EXT 0x8C3A #define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B #define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C #define GLEW_EXT_packed_float GLEW_GET_VAR(__GLEW_EXT_packed_float) #endif /* GL_EXT_packed_float */ /* -------------------------- GL_EXT_packed_pixels ------------------------- */ #ifndef GL_EXT_packed_pixels #define GL_EXT_packed_pixels 1 #define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 #define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 #define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 #define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 #define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 #define GLEW_EXT_packed_pixels GLEW_GET_VAR(__GLEW_EXT_packed_pixels) #endif /* GL_EXT_packed_pixels */ /* ------------------------ GL_EXT_paletted_texture ------------------------ */ #ifndef GL_EXT_paletted_texture #define GL_EXT_paletted_texture 1 #define GL_TEXTURE_1D 0x0DE0 #define GL_TEXTURE_2D 0x0DE1 #define GL_PROXY_TEXTURE_1D 0x8063 #define GL_PROXY_TEXTURE_2D 0x8064 #define GL_COLOR_TABLE_FORMAT_EXT 0x80D8 #define GL_COLOR_TABLE_WIDTH_EXT 0x80D9 #define GL_COLOR_TABLE_RED_SIZE_EXT 0x80DA #define GL_COLOR_TABLE_GREEN_SIZE_EXT 0x80DB #define GL_COLOR_TABLE_BLUE_SIZE_EXT 0x80DC #define GL_COLOR_TABLE_ALPHA_SIZE_EXT 0x80DD #define GL_COLOR_TABLE_LUMINANCE_SIZE_EXT 0x80DE #define GL_COLOR_TABLE_INTENSITY_SIZE_EXT 0x80DF #define GL_COLOR_INDEX1_EXT 0x80E2 #define GL_COLOR_INDEX2_EXT 0x80E3 #define GL_COLOR_INDEX4_EXT 0x80E4 #define GL_COLOR_INDEX8_EXT 0x80E5 #define GL_COLOR_INDEX12_EXT 0x80E6 #define GL_COLOR_INDEX16_EXT 0x80E7 #define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED #define GL_TEXTURE_CUBE_MAP_ARB 0x8513 #define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B typedef void (GLAPIENTRY * PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const void* data); typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, void* data); typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params); #define glColorTableEXT GLEW_GET_FUN(__glewColorTableEXT) #define glGetColorTableEXT GLEW_GET_FUN(__glewGetColorTableEXT) #define glGetColorTableParameterfvEXT GLEW_GET_FUN(__glewGetColorTableParameterfvEXT) #define glGetColorTableParameterivEXT GLEW_GET_FUN(__glewGetColorTableParameterivEXT) #define GLEW_EXT_paletted_texture GLEW_GET_VAR(__GLEW_EXT_paletted_texture) #endif /* GL_EXT_paletted_texture */ /* ----------------------- GL_EXT_pixel_buffer_object ---------------------- */ #ifndef GL_EXT_pixel_buffer_object #define GL_EXT_pixel_buffer_object 1 #define GL_PIXEL_PACK_BUFFER_EXT 0x88EB #define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC #define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED #define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF #define GLEW_EXT_pixel_buffer_object GLEW_GET_VAR(__GLEW_EXT_pixel_buffer_object) #endif /* GL_EXT_pixel_buffer_object */ /* ------------------------- GL_EXT_pixel_transform ------------------------ */ #ifndef GL_EXT_pixel_transform #define GL_EXT_pixel_transform 1 #define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 #define GL_PIXEL_MAG_FILTER_EXT 0x8331 #define GL_PIXEL_MIN_FILTER_EXT 0x8332 #define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 #define GL_CUBIC_EXT 0x8334 #define GL_AVERAGE_EXT 0x8335 #define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 #define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 #define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 typedef void (GLAPIENTRY * PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint* params); typedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, const GLfloat param); typedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, const GLint param); typedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint* params); #define glGetPixelTransformParameterfvEXT GLEW_GET_FUN(__glewGetPixelTransformParameterfvEXT) #define glGetPixelTransformParameterivEXT GLEW_GET_FUN(__glewGetPixelTransformParameterivEXT) #define glPixelTransformParameterfEXT GLEW_GET_FUN(__glewPixelTransformParameterfEXT) #define glPixelTransformParameterfvEXT GLEW_GET_FUN(__glewPixelTransformParameterfvEXT) #define glPixelTransformParameteriEXT GLEW_GET_FUN(__glewPixelTransformParameteriEXT) #define glPixelTransformParameterivEXT GLEW_GET_FUN(__glewPixelTransformParameterivEXT) #define GLEW_EXT_pixel_transform GLEW_GET_VAR(__GLEW_EXT_pixel_transform) #endif /* GL_EXT_pixel_transform */ /* ------------------- GL_EXT_pixel_transform_color_table ------------------ */ #ifndef GL_EXT_pixel_transform_color_table #define GL_EXT_pixel_transform_color_table 1 #define GLEW_EXT_pixel_transform_color_table GLEW_GET_VAR(__GLEW_EXT_pixel_transform_color_table) #endif /* GL_EXT_pixel_transform_color_table */ /* ------------------------ GL_EXT_point_parameters ------------------------ */ #ifndef GL_EXT_point_parameters #define GL_EXT_point_parameters 1 #define GL_POINT_SIZE_MIN_EXT 0x8126 #define GL_POINT_SIZE_MAX_EXT 0x8127 #define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 #define GL_DISTANCE_ATTENUATION_EXT 0x8129 typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat* params); #define glPointParameterfEXT GLEW_GET_FUN(__glewPointParameterfEXT) #define glPointParameterfvEXT GLEW_GET_FUN(__glewPointParameterfvEXT) #define GLEW_EXT_point_parameters GLEW_GET_VAR(__GLEW_EXT_point_parameters) #endif /* GL_EXT_point_parameters */ /* ------------------------- GL_EXT_polygon_offset ------------------------- */ #ifndef GL_EXT_polygon_offset #define GL_EXT_polygon_offset 1 #define GL_POLYGON_OFFSET_EXT 0x8037 #define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 #define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 typedef void (GLAPIENTRY * PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias); #define glPolygonOffsetEXT GLEW_GET_FUN(__glewPolygonOffsetEXT) #define GLEW_EXT_polygon_offset GLEW_GET_VAR(__GLEW_EXT_polygon_offset) #endif /* GL_EXT_polygon_offset */ /* ------------------------ GL_EXT_provoking_vertex ------------------------ */ #ifndef GL_EXT_provoking_vertex #define GL_EXT_provoking_vertex 1 #define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C #define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D #define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E #define GL_PROVOKING_VERTEX_EXT 0x8E4F typedef void (GLAPIENTRY * PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode); #define glProvokingVertexEXT GLEW_GET_FUN(__glewProvokingVertexEXT) #define GLEW_EXT_provoking_vertex GLEW_GET_VAR(__GLEW_EXT_provoking_vertex) #endif /* GL_EXT_provoking_vertex */ /* ------------------------- GL_EXT_rescale_normal ------------------------- */ #ifndef GL_EXT_rescale_normal #define GL_EXT_rescale_normal 1 #define GL_RESCALE_NORMAL_EXT 0x803A #define GLEW_EXT_rescale_normal GLEW_GET_VAR(__GLEW_EXT_rescale_normal) #endif /* GL_EXT_rescale_normal */ /* -------------------------- GL_EXT_scene_marker -------------------------- */ #ifndef GL_EXT_scene_marker #define GL_EXT_scene_marker 1 typedef void (GLAPIENTRY * PFNGLBEGINSCENEEXTPROC) (void); typedef void (GLAPIENTRY * PFNGLENDSCENEEXTPROC) (void); #define glBeginSceneEXT GLEW_GET_FUN(__glewBeginSceneEXT) #define glEndSceneEXT GLEW_GET_FUN(__glewEndSceneEXT) #define GLEW_EXT_scene_marker GLEW_GET_VAR(__GLEW_EXT_scene_marker) #endif /* GL_EXT_scene_marker */ /* ------------------------- GL_EXT_secondary_color ------------------------ */ #ifndef GL_EXT_secondary_color #define GL_EXT_secondary_color 1 #define GL_COLOR_SUM_EXT 0x8458 #define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 #define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A #define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B #define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C #define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D #define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); #define glSecondaryColor3bEXT GLEW_GET_FUN(__glewSecondaryColor3bEXT) #define glSecondaryColor3bvEXT GLEW_GET_FUN(__glewSecondaryColor3bvEXT) #define glSecondaryColor3dEXT GLEW_GET_FUN(__glewSecondaryColor3dEXT) #define glSecondaryColor3dvEXT GLEW_GET_FUN(__glewSecondaryColor3dvEXT) #define glSecondaryColor3fEXT GLEW_GET_FUN(__glewSecondaryColor3fEXT) #define glSecondaryColor3fvEXT GLEW_GET_FUN(__glewSecondaryColor3fvEXT) #define glSecondaryColor3iEXT GLEW_GET_FUN(__glewSecondaryColor3iEXT) #define glSecondaryColor3ivEXT GLEW_GET_FUN(__glewSecondaryColor3ivEXT) #define glSecondaryColor3sEXT GLEW_GET_FUN(__glewSecondaryColor3sEXT) #define glSecondaryColor3svEXT GLEW_GET_FUN(__glewSecondaryColor3svEXT) #define glSecondaryColor3ubEXT GLEW_GET_FUN(__glewSecondaryColor3ubEXT) #define glSecondaryColor3ubvEXT GLEW_GET_FUN(__glewSecondaryColor3ubvEXT) #define glSecondaryColor3uiEXT GLEW_GET_FUN(__glewSecondaryColor3uiEXT) #define glSecondaryColor3uivEXT GLEW_GET_FUN(__glewSecondaryColor3uivEXT) #define glSecondaryColor3usEXT GLEW_GET_FUN(__glewSecondaryColor3usEXT) #define glSecondaryColor3usvEXT GLEW_GET_FUN(__glewSecondaryColor3usvEXT) #define glSecondaryColorPointerEXT GLEW_GET_FUN(__glewSecondaryColorPointerEXT) #define GLEW_EXT_secondary_color GLEW_GET_VAR(__GLEW_EXT_secondary_color) #endif /* GL_EXT_secondary_color */ /* --------------------- GL_EXT_separate_shader_objects -------------------- */ #ifndef GL_EXT_separate_shader_objects #define GL_EXT_separate_shader_objects 1 #define GL_ACTIVE_PROGRAM_EXT 0x8B8D typedef void (GLAPIENTRY * PFNGLACTIVEPROGRAMEXTPROC) (GLuint program); typedef GLuint (GLAPIENTRY * PFNGLCREATESHADERPROGRAMEXTPROC) (GLenum type, const GLchar* string); typedef void (GLAPIENTRY * PFNGLUSESHADERPROGRAMEXTPROC) (GLenum type, GLuint program); #define glActiveProgramEXT GLEW_GET_FUN(__glewActiveProgramEXT) #define glCreateShaderProgramEXT GLEW_GET_FUN(__glewCreateShaderProgramEXT) #define glUseShaderProgramEXT GLEW_GET_FUN(__glewUseShaderProgramEXT) #define GLEW_EXT_separate_shader_objects GLEW_GET_VAR(__GLEW_EXT_separate_shader_objects) #endif /* GL_EXT_separate_shader_objects */ /* --------------------- GL_EXT_separate_specular_color -------------------- */ #ifndef GL_EXT_separate_specular_color #define GL_EXT_separate_specular_color 1 #define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 #define GL_SINGLE_COLOR_EXT 0x81F9 #define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA #define GLEW_EXT_separate_specular_color GLEW_GET_VAR(__GLEW_EXT_separate_specular_color) #endif /* GL_EXT_separate_specular_color */ /* --------------------- GL_EXT_shader_image_load_store -------------------- */ #ifndef GL_EXT_shader_image_load_store #define GL_EXT_shader_image_load_store 1 #define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT 0x00000001 #define GL_ELEMENT_ARRAY_BARRIER_BIT_EXT 0x00000002 #define GL_UNIFORM_BARRIER_BIT_EXT 0x00000004 #define GL_TEXTURE_FETCH_BARRIER_BIT_EXT 0x00000008 #define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT 0x00000020 #define GL_COMMAND_BARRIER_BIT_EXT 0x00000040 #define GL_PIXEL_BUFFER_BARRIER_BIT_EXT 0x00000080 #define GL_TEXTURE_UPDATE_BARRIER_BIT_EXT 0x00000100 #define GL_BUFFER_UPDATE_BARRIER_BIT_EXT 0x00000200 #define GL_FRAMEBUFFER_BARRIER_BIT_EXT 0x00000400 #define GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT 0x00000800 #define GL_ATOMIC_COUNTER_BARRIER_BIT_EXT 0x00001000 #define GL_MAX_IMAGE_UNITS_EXT 0x8F38 #define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT 0x8F39 #define GL_IMAGE_BINDING_NAME_EXT 0x8F3A #define GL_IMAGE_BINDING_LEVEL_EXT 0x8F3B #define GL_IMAGE_BINDING_LAYERED_EXT 0x8F3C #define GL_IMAGE_BINDING_LAYER_EXT 0x8F3D #define GL_IMAGE_BINDING_ACCESS_EXT 0x8F3E #define GL_IMAGE_1D_EXT 0x904C #define GL_IMAGE_2D_EXT 0x904D #define GL_IMAGE_3D_EXT 0x904E #define GL_IMAGE_2D_RECT_EXT 0x904F #define GL_IMAGE_CUBE_EXT 0x9050 #define GL_IMAGE_BUFFER_EXT 0x9051 #define GL_IMAGE_1D_ARRAY_EXT 0x9052 #define GL_IMAGE_2D_ARRAY_EXT 0x9053 #define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054 #define GL_IMAGE_2D_MULTISAMPLE_EXT 0x9055 #define GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9056 #define GL_INT_IMAGE_1D_EXT 0x9057 #define GL_INT_IMAGE_2D_EXT 0x9058 #define GL_INT_IMAGE_3D_EXT 0x9059 #define GL_INT_IMAGE_2D_RECT_EXT 0x905A #define GL_INT_IMAGE_CUBE_EXT 0x905B #define GL_INT_IMAGE_BUFFER_EXT 0x905C #define GL_INT_IMAGE_1D_ARRAY_EXT 0x905D #define GL_INT_IMAGE_2D_ARRAY_EXT 0x905E #define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F #define GL_INT_IMAGE_2D_MULTISAMPLE_EXT 0x9060 #define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9061 #define GL_UNSIGNED_INT_IMAGE_1D_EXT 0x9062 #define GL_UNSIGNED_INT_IMAGE_2D_EXT 0x9063 #define GL_UNSIGNED_INT_IMAGE_3D_EXT 0x9064 #define GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT 0x9065 #define GL_UNSIGNED_INT_IMAGE_CUBE_EXT 0x9066 #define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067 #define GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT 0x9068 #define GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT 0x9069 #define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A #define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT 0x906B #define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x906C #define GL_MAX_IMAGE_SAMPLES_EXT 0x906D #define GL_IMAGE_BINDING_FORMAT_EXT 0x906E #define GL_ALL_BARRIER_BITS_EXT 0xFFFFFFFF typedef void (GLAPIENTRY * PFNGLBINDIMAGETEXTUREEXTPROC) (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format); typedef void (GLAPIENTRY * PFNGLMEMORYBARRIEREXTPROC) (GLbitfield barriers); #define glBindImageTextureEXT GLEW_GET_FUN(__glewBindImageTextureEXT) #define glMemoryBarrierEXT GLEW_GET_FUN(__glewMemoryBarrierEXT) #define GLEW_EXT_shader_image_load_store GLEW_GET_VAR(__GLEW_EXT_shader_image_load_store) #endif /* GL_EXT_shader_image_load_store */ /* -------------------------- GL_EXT_shadow_funcs -------------------------- */ #ifndef GL_EXT_shadow_funcs #define GL_EXT_shadow_funcs 1 #define GLEW_EXT_shadow_funcs GLEW_GET_VAR(__GLEW_EXT_shadow_funcs) #endif /* GL_EXT_shadow_funcs */ /* --------------------- GL_EXT_shared_texture_palette --------------------- */ #ifndef GL_EXT_shared_texture_palette #define GL_EXT_shared_texture_palette 1 #define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB #define GLEW_EXT_shared_texture_palette GLEW_GET_VAR(__GLEW_EXT_shared_texture_palette) #endif /* GL_EXT_shared_texture_palette */ /* ------------------------ GL_EXT_stencil_clear_tag ----------------------- */ #ifndef GL_EXT_stencil_clear_tag #define GL_EXT_stencil_clear_tag 1 #define GL_STENCIL_TAG_BITS_EXT 0x88F2 #define GL_STENCIL_CLEAR_TAG_VALUE_EXT 0x88F3 #define GLEW_EXT_stencil_clear_tag GLEW_GET_VAR(__GLEW_EXT_stencil_clear_tag) #endif /* GL_EXT_stencil_clear_tag */ /* ------------------------ GL_EXT_stencil_two_side ------------------------ */ #ifndef GL_EXT_stencil_two_side #define GL_EXT_stencil_two_side 1 #define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 #define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 typedef void (GLAPIENTRY * PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face); #define glActiveStencilFaceEXT GLEW_GET_FUN(__glewActiveStencilFaceEXT) #define GLEW_EXT_stencil_two_side GLEW_GET_VAR(__GLEW_EXT_stencil_two_side) #endif /* GL_EXT_stencil_two_side */ /* -------------------------- GL_EXT_stencil_wrap -------------------------- */ #ifndef GL_EXT_stencil_wrap #define GL_EXT_stencil_wrap 1 #define GL_INCR_WRAP_EXT 0x8507 #define GL_DECR_WRAP_EXT 0x8508 #define GLEW_EXT_stencil_wrap GLEW_GET_VAR(__GLEW_EXT_stencil_wrap) #endif /* GL_EXT_stencil_wrap */ /* --------------------------- GL_EXT_subtexture --------------------------- */ #ifndef GL_EXT_subtexture #define GL_EXT_subtexture 1 typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void* pixels); typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels); typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels); #define glTexSubImage1DEXT GLEW_GET_FUN(__glewTexSubImage1DEXT) #define glTexSubImage2DEXT GLEW_GET_FUN(__glewTexSubImage2DEXT) #define glTexSubImage3DEXT GLEW_GET_FUN(__glewTexSubImage3DEXT) #define GLEW_EXT_subtexture GLEW_GET_VAR(__GLEW_EXT_subtexture) #endif /* GL_EXT_subtexture */ /* ----------------------------- GL_EXT_texture ---------------------------- */ #ifndef GL_EXT_texture #define GL_EXT_texture 1 #define GL_ALPHA4_EXT 0x803B #define GL_ALPHA8_EXT 0x803C #define GL_ALPHA12_EXT 0x803D #define GL_ALPHA16_EXT 0x803E #define GL_LUMINANCE4_EXT 0x803F #define GL_LUMINANCE8_EXT 0x8040 #define GL_LUMINANCE12_EXT 0x8041 #define GL_LUMINANCE16_EXT 0x8042 #define GL_LUMINANCE4_ALPHA4_EXT 0x8043 #define GL_LUMINANCE6_ALPHA2_EXT 0x8044 #define GL_LUMINANCE8_ALPHA8_EXT 0x8045 #define GL_LUMINANCE12_ALPHA4_EXT 0x8046 #define GL_LUMINANCE12_ALPHA12_EXT 0x8047 #define GL_LUMINANCE16_ALPHA16_EXT 0x8048 #define GL_INTENSITY_EXT 0x8049 #define GL_INTENSITY4_EXT 0x804A #define GL_INTENSITY8_EXT 0x804B #define GL_INTENSITY12_EXT 0x804C #define GL_INTENSITY16_EXT 0x804D #define GL_RGB2_EXT 0x804E #define GL_RGB4_EXT 0x804F #define GL_RGB5_EXT 0x8050 #define GL_RGB8_EXT 0x8051 #define GL_RGB10_EXT 0x8052 #define GL_RGB12_EXT 0x8053 #define GL_RGB16_EXT 0x8054 #define GL_RGBA2_EXT 0x8055 #define GL_RGBA4_EXT 0x8056 #define GL_RGB5_A1_EXT 0x8057 #define GL_RGBA8_EXT 0x8058 #define GL_RGB10_A2_EXT 0x8059 #define GL_RGBA12_EXT 0x805A #define GL_RGBA16_EXT 0x805B #define GL_TEXTURE_RED_SIZE_EXT 0x805C #define GL_TEXTURE_GREEN_SIZE_EXT 0x805D #define GL_TEXTURE_BLUE_SIZE_EXT 0x805E #define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F #define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 #define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 #define GL_REPLACE_EXT 0x8062 #define GL_PROXY_TEXTURE_1D_EXT 0x8063 #define GL_PROXY_TEXTURE_2D_EXT 0x8064 #define GLEW_EXT_texture GLEW_GET_VAR(__GLEW_EXT_texture) #endif /* GL_EXT_texture */ /* ---------------------------- GL_EXT_texture3D --------------------------- */ #ifndef GL_EXT_texture3D #define GL_EXT_texture3D 1 #define GL_PACK_SKIP_IMAGES_EXT 0x806B #define GL_PACK_IMAGE_HEIGHT_EXT 0x806C #define GL_UNPACK_SKIP_IMAGES_EXT 0x806D #define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E #define GL_TEXTURE_3D_EXT 0x806F #define GL_PROXY_TEXTURE_3D_EXT 0x8070 #define GL_TEXTURE_DEPTH_EXT 0x8071 #define GL_TEXTURE_WRAP_R_EXT 0x8072 #define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 typedef void (GLAPIENTRY * PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void* pixels); #define glTexImage3DEXT GLEW_GET_FUN(__glewTexImage3DEXT) #define GLEW_EXT_texture3D GLEW_GET_VAR(__GLEW_EXT_texture3D) #endif /* GL_EXT_texture3D */ /* -------------------------- GL_EXT_texture_array ------------------------- */ #ifndef GL_EXT_texture_array #define GL_EXT_texture_array 1 #define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E #define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF #define GL_TEXTURE_1D_ARRAY_EXT 0x8C18 #define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19 #define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A #define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B #define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C #define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); #define glFramebufferTextureLayerEXT GLEW_GET_FUN(__glewFramebufferTextureLayerEXT) #define GLEW_EXT_texture_array GLEW_GET_VAR(__GLEW_EXT_texture_array) #endif /* GL_EXT_texture_array */ /* ---------------------- GL_EXT_texture_buffer_object --------------------- */ #ifndef GL_EXT_texture_buffer_object #define GL_EXT_texture_buffer_object 1 #define GL_TEXTURE_BUFFER_EXT 0x8C2A #define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B #define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C #define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D #define GL_TEXTURE_BUFFER_FORMAT_EXT 0x8C2E typedef void (GLAPIENTRY * PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer); #define glTexBufferEXT GLEW_GET_FUN(__glewTexBufferEXT) #define GLEW_EXT_texture_buffer_object GLEW_GET_VAR(__GLEW_EXT_texture_buffer_object) #endif /* GL_EXT_texture_buffer_object */ /* -------------------- GL_EXT_texture_compression_dxt1 -------------------- */ #ifndef GL_EXT_texture_compression_dxt1 #define GL_EXT_texture_compression_dxt1 1 #define GLEW_EXT_texture_compression_dxt1 GLEW_GET_VAR(__GLEW_EXT_texture_compression_dxt1) #endif /* GL_EXT_texture_compression_dxt1 */ /* -------------------- GL_EXT_texture_compression_latc -------------------- */ #ifndef GL_EXT_texture_compression_latc #define GL_EXT_texture_compression_latc 1 #define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70 #define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71 #define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72 #define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73 #define GLEW_EXT_texture_compression_latc GLEW_GET_VAR(__GLEW_EXT_texture_compression_latc) #endif /* GL_EXT_texture_compression_latc */ /* -------------------- GL_EXT_texture_compression_rgtc -------------------- */ #ifndef GL_EXT_texture_compression_rgtc #define GL_EXT_texture_compression_rgtc 1 #define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB #define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC #define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD #define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE #define GLEW_EXT_texture_compression_rgtc GLEW_GET_VAR(__GLEW_EXT_texture_compression_rgtc) #endif /* GL_EXT_texture_compression_rgtc */ /* -------------------- GL_EXT_texture_compression_s3tc -------------------- */ #ifndef GL_EXT_texture_compression_s3tc #define GL_EXT_texture_compression_s3tc 1 #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 #define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 #define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 #define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 #define GLEW_EXT_texture_compression_s3tc GLEW_GET_VAR(__GLEW_EXT_texture_compression_s3tc) #endif /* GL_EXT_texture_compression_s3tc */ /* ------------------------ GL_EXT_texture_cube_map ------------------------ */ #ifndef GL_EXT_texture_cube_map #define GL_EXT_texture_cube_map 1 #define GL_NORMAL_MAP_EXT 0x8511 #define GL_REFLECTION_MAP_EXT 0x8512 #define GL_TEXTURE_CUBE_MAP_EXT 0x8513 #define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 #define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A #define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B #define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C #define GLEW_EXT_texture_cube_map GLEW_GET_VAR(__GLEW_EXT_texture_cube_map) #endif /* GL_EXT_texture_cube_map */ /* ----------------------- GL_EXT_texture_edge_clamp ----------------------- */ #ifndef GL_EXT_texture_edge_clamp #define GL_EXT_texture_edge_clamp 1 #define GL_CLAMP_TO_EDGE_EXT 0x812F #define GLEW_EXT_texture_edge_clamp GLEW_GET_VAR(__GLEW_EXT_texture_edge_clamp) #endif /* GL_EXT_texture_edge_clamp */ /* --------------------------- GL_EXT_texture_env -------------------------- */ #ifndef GL_EXT_texture_env #define GL_EXT_texture_env 1 #define GL_TEXTURE_ENV0_EXT 0 #define GL_ENV_BLEND_EXT 0 #define GL_TEXTURE_ENV_SHIFT_EXT 0 #define GL_ENV_REPLACE_EXT 0 #define GL_ENV_ADD_EXT 0 #define GL_ENV_SUBTRACT_EXT 0 #define GL_TEXTURE_ENV_MODE_ALPHA_EXT 0 #define GL_ENV_REVERSE_SUBTRACT_EXT 0 #define GL_ENV_REVERSE_BLEND_EXT 0 #define GL_ENV_COPY_EXT 0 #define GL_ENV_MODULATE_EXT 0 #define GLEW_EXT_texture_env GLEW_GET_VAR(__GLEW_EXT_texture_env) #endif /* GL_EXT_texture_env */ /* ------------------------- GL_EXT_texture_env_add ------------------------ */ #ifndef GL_EXT_texture_env_add #define GL_EXT_texture_env_add 1 #define GLEW_EXT_texture_env_add GLEW_GET_VAR(__GLEW_EXT_texture_env_add) #endif /* GL_EXT_texture_env_add */ /* ----------------------- GL_EXT_texture_env_combine ---------------------- */ #ifndef GL_EXT_texture_env_combine #define GL_EXT_texture_env_combine 1 #define GL_COMBINE_EXT 0x8570 #define GL_COMBINE_RGB_EXT 0x8571 #define GL_COMBINE_ALPHA_EXT 0x8572 #define GL_RGB_SCALE_EXT 0x8573 #define GL_ADD_SIGNED_EXT 0x8574 #define GL_INTERPOLATE_EXT 0x8575 #define GL_CONSTANT_EXT 0x8576 #define GL_PRIMARY_COLOR_EXT 0x8577 #define GL_PREVIOUS_EXT 0x8578 #define GL_SOURCE0_RGB_EXT 0x8580 #define GL_SOURCE1_RGB_EXT 0x8581 #define GL_SOURCE2_RGB_EXT 0x8582 #define GL_SOURCE0_ALPHA_EXT 0x8588 #define GL_SOURCE1_ALPHA_EXT 0x8589 #define GL_SOURCE2_ALPHA_EXT 0x858A #define GL_OPERAND0_RGB_EXT 0x8590 #define GL_OPERAND1_RGB_EXT 0x8591 #define GL_OPERAND2_RGB_EXT 0x8592 #define GL_OPERAND0_ALPHA_EXT 0x8598 #define GL_OPERAND1_ALPHA_EXT 0x8599 #define GL_OPERAND2_ALPHA_EXT 0x859A #define GLEW_EXT_texture_env_combine GLEW_GET_VAR(__GLEW_EXT_texture_env_combine) #endif /* GL_EXT_texture_env_combine */ /* ------------------------ GL_EXT_texture_env_dot3 ------------------------ */ #ifndef GL_EXT_texture_env_dot3 #define GL_EXT_texture_env_dot3 1 #define GL_DOT3_RGB_EXT 0x8740 #define GL_DOT3_RGBA_EXT 0x8741 #define GLEW_EXT_texture_env_dot3 GLEW_GET_VAR(__GLEW_EXT_texture_env_dot3) #endif /* GL_EXT_texture_env_dot3 */ /* ------------------- GL_EXT_texture_filter_anisotropic ------------------- */ #ifndef GL_EXT_texture_filter_anisotropic #define GL_EXT_texture_filter_anisotropic 1 #define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF #define GLEW_EXT_texture_filter_anisotropic GLEW_GET_VAR(__GLEW_EXT_texture_filter_anisotropic) #endif /* GL_EXT_texture_filter_anisotropic */ /* ------------------------- GL_EXT_texture_integer ------------------------ */ #ifndef GL_EXT_texture_integer #define GL_EXT_texture_integer 1 #define GL_RGBA32UI_EXT 0x8D70 #define GL_RGB32UI_EXT 0x8D71 #define GL_ALPHA32UI_EXT 0x8D72 #define GL_INTENSITY32UI_EXT 0x8D73 #define GL_LUMINANCE32UI_EXT 0x8D74 #define GL_LUMINANCE_ALPHA32UI_EXT 0x8D75 #define GL_RGBA16UI_EXT 0x8D76 #define GL_RGB16UI_EXT 0x8D77 #define GL_ALPHA16UI_EXT 0x8D78 #define GL_INTENSITY16UI_EXT 0x8D79 #define GL_LUMINANCE16UI_EXT 0x8D7A #define GL_LUMINANCE_ALPHA16UI_EXT 0x8D7B #define GL_RGBA8UI_EXT 0x8D7C #define GL_RGB8UI_EXT 0x8D7D #define GL_ALPHA8UI_EXT 0x8D7E #define GL_INTENSITY8UI_EXT 0x8D7F #define GL_LUMINANCE8UI_EXT 0x8D80 #define GL_LUMINANCE_ALPHA8UI_EXT 0x8D81 #define GL_RGBA32I_EXT 0x8D82 #define GL_RGB32I_EXT 0x8D83 #define GL_ALPHA32I_EXT 0x8D84 #define GL_INTENSITY32I_EXT 0x8D85 #define GL_LUMINANCE32I_EXT 0x8D86 #define GL_LUMINANCE_ALPHA32I_EXT 0x8D87 #define GL_RGBA16I_EXT 0x8D88 #define GL_RGB16I_EXT 0x8D89 #define GL_ALPHA16I_EXT 0x8D8A #define GL_INTENSITY16I_EXT 0x8D8B #define GL_LUMINANCE16I_EXT 0x8D8C #define GL_LUMINANCE_ALPHA16I_EXT 0x8D8D #define GL_RGBA8I_EXT 0x8D8E #define GL_RGB8I_EXT 0x8D8F #define GL_ALPHA8I_EXT 0x8D90 #define GL_INTENSITY8I_EXT 0x8D91 #define GL_LUMINANCE8I_EXT 0x8D92 #define GL_LUMINANCE_ALPHA8I_EXT 0x8D93 #define GL_RED_INTEGER_EXT 0x8D94 #define GL_GREEN_INTEGER_EXT 0x8D95 #define GL_BLUE_INTEGER_EXT 0x8D96 #define GL_ALPHA_INTEGER_EXT 0x8D97 #define GL_RGB_INTEGER_EXT 0x8D98 #define GL_RGBA_INTEGER_EXT 0x8D99 #define GL_BGR_INTEGER_EXT 0x8D9A #define GL_BGRA_INTEGER_EXT 0x8D9B #define GL_LUMINANCE_INTEGER_EXT 0x8D9C #define GL_LUMINANCE_ALPHA_INTEGER_EXT 0x8D9D #define GL_RGBA_INTEGER_MODE_EXT 0x8D9E typedef void (GLAPIENTRY * PFNGLCLEARCOLORIIEXTPROC) (GLint red, GLint green, GLint blue, GLint alpha); typedef void (GLAPIENTRY * PFNGLCLEARCOLORIUIEXTPROC) (GLuint red, GLuint green, GLuint blue, GLuint alpha); typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params); typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params); typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params); #define glClearColorIiEXT GLEW_GET_FUN(__glewClearColorIiEXT) #define glClearColorIuiEXT GLEW_GET_FUN(__glewClearColorIuiEXT) #define glGetTexParameterIivEXT GLEW_GET_FUN(__glewGetTexParameterIivEXT) #define glGetTexParameterIuivEXT GLEW_GET_FUN(__glewGetTexParameterIuivEXT) #define glTexParameterIivEXT GLEW_GET_FUN(__glewTexParameterIivEXT) #define glTexParameterIuivEXT GLEW_GET_FUN(__glewTexParameterIuivEXT) #define GLEW_EXT_texture_integer GLEW_GET_VAR(__GLEW_EXT_texture_integer) #endif /* GL_EXT_texture_integer */ /* ------------------------ GL_EXT_texture_lod_bias ------------------------ */ #ifndef GL_EXT_texture_lod_bias #define GL_EXT_texture_lod_bias 1 #define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD #define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 #define GL_TEXTURE_LOD_BIAS_EXT 0x8501 #define GLEW_EXT_texture_lod_bias GLEW_GET_VAR(__GLEW_EXT_texture_lod_bias) #endif /* GL_EXT_texture_lod_bias */ /* ---------------------- GL_EXT_texture_mirror_clamp ---------------------- */ #ifndef GL_EXT_texture_mirror_clamp #define GL_EXT_texture_mirror_clamp 1 #define GL_MIRROR_CLAMP_EXT 0x8742 #define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 #define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 #define GLEW_EXT_texture_mirror_clamp GLEW_GET_VAR(__GLEW_EXT_texture_mirror_clamp) #endif /* GL_EXT_texture_mirror_clamp */ /* ------------------------- GL_EXT_texture_object ------------------------- */ #ifndef GL_EXT_texture_object #define GL_EXT_texture_object 1 #define GL_TEXTURE_PRIORITY_EXT 0x8066 #define GL_TEXTURE_RESIDENT_EXT 0x8067 #define GL_TEXTURE_1D_BINDING_EXT 0x8068 #define GL_TEXTURE_2D_BINDING_EXT 0x8069 #define GL_TEXTURE_3D_BINDING_EXT 0x806A typedef GLboolean (GLAPIENTRY * PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint* textures, GLboolean* residences); typedef void (GLAPIENTRY * PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture); typedef void (GLAPIENTRY * PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint* textures); typedef void (GLAPIENTRY * PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint* textures); typedef GLboolean (GLAPIENTRY * PFNGLISTEXTUREEXTPROC) (GLuint texture); typedef void (GLAPIENTRY * PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint* textures, const GLclampf* priorities); #define glAreTexturesResidentEXT GLEW_GET_FUN(__glewAreTexturesResidentEXT) #define glBindTextureEXT GLEW_GET_FUN(__glewBindTextureEXT) #define glDeleteTexturesEXT GLEW_GET_FUN(__glewDeleteTexturesEXT) #define glGenTexturesEXT GLEW_GET_FUN(__glewGenTexturesEXT) #define glIsTextureEXT GLEW_GET_FUN(__glewIsTextureEXT) #define glPrioritizeTexturesEXT GLEW_GET_FUN(__glewPrioritizeTexturesEXT) #define GLEW_EXT_texture_object GLEW_GET_VAR(__GLEW_EXT_texture_object) #endif /* GL_EXT_texture_object */ /* --------------------- GL_EXT_texture_perturb_normal --------------------- */ #ifndef GL_EXT_texture_perturb_normal #define GL_EXT_texture_perturb_normal 1 #define GL_PERTURB_EXT 0x85AE #define GL_TEXTURE_NORMAL_EXT 0x85AF typedef void (GLAPIENTRY * PFNGLTEXTURENORMALEXTPROC) (GLenum mode); #define glTextureNormalEXT GLEW_GET_FUN(__glewTextureNormalEXT) #define GLEW_EXT_texture_perturb_normal GLEW_GET_VAR(__GLEW_EXT_texture_perturb_normal) #endif /* GL_EXT_texture_perturb_normal */ /* ------------------------ GL_EXT_texture_rectangle ----------------------- */ #ifndef GL_EXT_texture_rectangle #define GL_EXT_texture_rectangle 1 #define GL_TEXTURE_RECTANGLE_EXT 0x84F5 #define GL_TEXTURE_BINDING_RECTANGLE_EXT 0x84F6 #define GL_PROXY_TEXTURE_RECTANGLE_EXT 0x84F7 #define GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT 0x84F8 #define GLEW_EXT_texture_rectangle GLEW_GET_VAR(__GLEW_EXT_texture_rectangle) #endif /* GL_EXT_texture_rectangle */ /* -------------------------- GL_EXT_texture_sRGB -------------------------- */ #ifndef GL_EXT_texture_sRGB #define GL_EXT_texture_sRGB 1 #define GL_SRGB_EXT 0x8C40 #define GL_SRGB8_EXT 0x8C41 #define GL_SRGB_ALPHA_EXT 0x8C42 #define GL_SRGB8_ALPHA8_EXT 0x8C43 #define GL_SLUMINANCE_ALPHA_EXT 0x8C44 #define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45 #define GL_SLUMINANCE_EXT 0x8C46 #define GL_SLUMINANCE8_EXT 0x8C47 #define GL_COMPRESSED_SRGB_EXT 0x8C48 #define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49 #define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A #define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B #define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F #define GLEW_EXT_texture_sRGB GLEW_GET_VAR(__GLEW_EXT_texture_sRGB) #endif /* GL_EXT_texture_sRGB */ /* ----------------------- GL_EXT_texture_sRGB_decode ---------------------- */ #ifndef GL_EXT_texture_sRGB_decode #define GL_EXT_texture_sRGB_decode 1 #define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48 #define GL_DECODE_EXT 0x8A49 #define GL_SKIP_DECODE_EXT 0x8A4A #define GLEW_EXT_texture_sRGB_decode GLEW_GET_VAR(__GLEW_EXT_texture_sRGB_decode) #endif /* GL_EXT_texture_sRGB_decode */ /* --------------------- GL_EXT_texture_shared_exponent -------------------- */ #ifndef GL_EXT_texture_shared_exponent #define GL_EXT_texture_shared_exponent 1 #define GL_RGB9_E5_EXT 0x8C3D #define GL_UNSIGNED_INT_5_9_9_9_REV_EXT 0x8C3E #define GL_TEXTURE_SHARED_SIZE_EXT 0x8C3F #define GLEW_EXT_texture_shared_exponent GLEW_GET_VAR(__GLEW_EXT_texture_shared_exponent) #endif /* GL_EXT_texture_shared_exponent */ /* -------------------------- GL_EXT_texture_snorm ------------------------- */ #ifndef GL_EXT_texture_snorm #define GL_EXT_texture_snorm 1 #define GL_RED_SNORM 0x8F90 #define GL_RG_SNORM 0x8F91 #define GL_RGB_SNORM 0x8F92 #define GL_RGBA_SNORM 0x8F93 #define GL_R8_SNORM 0x8F94 #define GL_RG8_SNORM 0x8F95 #define GL_RGB8_SNORM 0x8F96 #define GL_RGBA8_SNORM 0x8F97 #define GL_R16_SNORM 0x8F98 #define GL_RG16_SNORM 0x8F99 #define GL_RGB16_SNORM 0x8F9A #define GL_RGBA16_SNORM 0x8F9B #define GL_SIGNED_NORMALIZED 0x8F9C #define GL_ALPHA_SNORM 0x9010 #define GL_LUMINANCE_SNORM 0x9011 #define GL_LUMINANCE_ALPHA_SNORM 0x9012 #define GL_INTENSITY_SNORM 0x9013 #define GL_ALPHA8_SNORM 0x9014 #define GL_LUMINANCE8_SNORM 0x9015 #define GL_LUMINANCE8_ALPHA8_SNORM 0x9016 #define GL_INTENSITY8_SNORM 0x9017 #define GL_ALPHA16_SNORM 0x9018 #define GL_LUMINANCE16_SNORM 0x9019 #define GL_LUMINANCE16_ALPHA16_SNORM 0x901A #define GL_INTENSITY16_SNORM 0x901B #define GLEW_EXT_texture_snorm GLEW_GET_VAR(__GLEW_EXT_texture_snorm) #endif /* GL_EXT_texture_snorm */ /* ------------------------- GL_EXT_texture_swizzle ------------------------ */ #ifndef GL_EXT_texture_swizzle #define GL_EXT_texture_swizzle 1 #define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42 #define GL_TEXTURE_SWIZZLE_G_EXT 0x8E43 #define GL_TEXTURE_SWIZZLE_B_EXT 0x8E44 #define GL_TEXTURE_SWIZZLE_A_EXT 0x8E45 #define GL_TEXTURE_SWIZZLE_RGBA_EXT 0x8E46 #define GLEW_EXT_texture_swizzle GLEW_GET_VAR(__GLEW_EXT_texture_swizzle) #endif /* GL_EXT_texture_swizzle */ /* --------------------------- GL_EXT_timer_query -------------------------- */ #ifndef GL_EXT_timer_query #define GL_EXT_timer_query 1 #define GL_TIME_ELAPSED_EXT 0x88BF typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64EXT *params); typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64EXT *params); #define glGetQueryObjecti64vEXT GLEW_GET_FUN(__glewGetQueryObjecti64vEXT) #define glGetQueryObjectui64vEXT GLEW_GET_FUN(__glewGetQueryObjectui64vEXT) #define GLEW_EXT_timer_query GLEW_GET_VAR(__GLEW_EXT_timer_query) #endif /* GL_EXT_timer_query */ /* ----------------------- GL_EXT_transform_feedback ----------------------- */ #ifndef GL_EXT_transform_feedback #define GL_EXT_transform_feedback 1 #define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT 0x8C76 #define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT 0x8C7F #define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT 0x8C80 #define GL_TRANSFORM_FEEDBACK_VARYINGS_EXT 0x8C83 #define GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT 0x8C84 #define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT 0x8C85 #define GL_PRIMITIVES_GENERATED_EXT 0x8C87 #define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT 0x8C88 #define GL_RASTERIZER_DISCARD_EXT 0x8C89 #define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT 0x8C8A #define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT 0x8C8B #define GL_INTERLEAVED_ATTRIBS_EXT 0x8C8C #define GL_SEPARATE_ATTRIBS_EXT 0x8C8D #define GL_TRANSFORM_FEEDBACK_BUFFER_EXT 0x8C8E #define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT 0x8C8F typedef void (GLAPIENTRY * PFNGLBEGINTRANSFORMFEEDBACKEXTPROC) (GLenum primitiveMode); typedef void (GLAPIENTRY * PFNGLBINDBUFFERBASEEXTPROC) (GLenum target, GLuint index, GLuint buffer); typedef void (GLAPIENTRY * PFNGLBINDBUFFEROFFSETEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); typedef void (GLAPIENTRY * PFNGLBINDBUFFERRANGEEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); typedef void (GLAPIENTRY * PFNGLENDTRANSFORMFEEDBACKEXTPROC) (void); typedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei *size, GLenum *type, GLchar *name); typedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLchar ** varyings, GLenum bufferMode); #define glBeginTransformFeedbackEXT GLEW_GET_FUN(__glewBeginTransformFeedbackEXT) #define glBindBufferBaseEXT GLEW_GET_FUN(__glewBindBufferBaseEXT) #define glBindBufferOffsetEXT GLEW_GET_FUN(__glewBindBufferOffsetEXT) #define glBindBufferRangeEXT GLEW_GET_FUN(__glewBindBufferRangeEXT) #define glEndTransformFeedbackEXT GLEW_GET_FUN(__glewEndTransformFeedbackEXT) #define glGetTransformFeedbackVaryingEXT GLEW_GET_FUN(__glewGetTransformFeedbackVaryingEXT) #define glTransformFeedbackVaryingsEXT GLEW_GET_FUN(__glewTransformFeedbackVaryingsEXT) #define GLEW_EXT_transform_feedback GLEW_GET_VAR(__GLEW_EXT_transform_feedback) #endif /* GL_EXT_transform_feedback */ /* -------------------------- GL_EXT_vertex_array -------------------------- */ #ifndef GL_EXT_vertex_array #define GL_EXT_vertex_array 1 #define GL_DOUBLE_EXT 0x140A #define GL_VERTEX_ARRAY_EXT 0x8074 #define GL_NORMAL_ARRAY_EXT 0x8075 #define GL_COLOR_ARRAY_EXT 0x8076 #define GL_INDEX_ARRAY_EXT 0x8077 #define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 #define GL_EDGE_FLAG_ARRAY_EXT 0x8079 #define GL_VERTEX_ARRAY_SIZE_EXT 0x807A #define GL_VERTEX_ARRAY_TYPE_EXT 0x807B #define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C #define GL_VERTEX_ARRAY_COUNT_EXT 0x807D #define GL_NORMAL_ARRAY_TYPE_EXT 0x807E #define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F #define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 #define GL_COLOR_ARRAY_SIZE_EXT 0x8081 #define GL_COLOR_ARRAY_TYPE_EXT 0x8082 #define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 #define GL_COLOR_ARRAY_COUNT_EXT 0x8084 #define GL_INDEX_ARRAY_TYPE_EXT 0x8085 #define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 #define GL_INDEX_ARRAY_COUNT_EXT 0x8087 #define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 #define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 #define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A #define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B #define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C #define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D #define GL_VERTEX_ARRAY_POINTER_EXT 0x808E #define GL_NORMAL_ARRAY_POINTER_EXT 0x808F #define GL_COLOR_ARRAY_POINTER_EXT 0x8090 #define GL_INDEX_ARRAY_POINTER_EXT 0x8091 #define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 #define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 typedef void (GLAPIENTRY * PFNGLARRAYELEMENTEXTPROC) (GLint i); typedef void (GLAPIENTRY * PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void* pointer); typedef void (GLAPIENTRY * PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); typedef void (GLAPIENTRY * PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean* pointer); typedef void (GLAPIENTRY * PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void* pointer); typedef void (GLAPIENTRY * PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void* pointer); typedef void (GLAPIENTRY * PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void* pointer); typedef void (GLAPIENTRY * PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void* pointer); #define glArrayElementEXT GLEW_GET_FUN(__glewArrayElementEXT) #define glColorPointerEXT GLEW_GET_FUN(__glewColorPointerEXT) #define glDrawArraysEXT GLEW_GET_FUN(__glewDrawArraysEXT) #define glEdgeFlagPointerEXT GLEW_GET_FUN(__glewEdgeFlagPointerEXT) #define glIndexPointerEXT GLEW_GET_FUN(__glewIndexPointerEXT) #define glNormalPointerEXT GLEW_GET_FUN(__glewNormalPointerEXT) #define glTexCoordPointerEXT GLEW_GET_FUN(__glewTexCoordPointerEXT) #define glVertexPointerEXT GLEW_GET_FUN(__glewVertexPointerEXT) #define GLEW_EXT_vertex_array GLEW_GET_VAR(__GLEW_EXT_vertex_array) #endif /* GL_EXT_vertex_array */ /* ------------------------ GL_EXT_vertex_array_bgra ----------------------- */ #ifndef GL_EXT_vertex_array_bgra #define GL_EXT_vertex_array_bgra 1 #define GL_BGRA 0x80E1 #define GLEW_EXT_vertex_array_bgra GLEW_GET_VAR(__GLEW_EXT_vertex_array_bgra) #endif /* GL_EXT_vertex_array_bgra */ /* ----------------------- GL_EXT_vertex_attrib_64bit ---------------------- */ #ifndef GL_EXT_vertex_attrib_64bit #define GL_EXT_vertex_attrib_64bit 1 #define GL_DOUBLE_MAT2_EXT 0x8F46 #define GL_DOUBLE_MAT3_EXT 0x8F47 #define GL_DOUBLE_MAT4_EXT 0x8F48 #define GL_DOUBLE_MAT2x3_EXT 0x8F49 #define GL_DOUBLE_MAT2x4_EXT 0x8F4A #define GL_DOUBLE_MAT3x2_EXT 0x8F4B #define GL_DOUBLE_MAT3x4_EXT 0x8F4C #define GL_DOUBLE_MAT4x2_EXT 0x8F4D #define GL_DOUBLE_MAT4x3_EXT 0x8F4E #define GL_DOUBLE_VEC2_EXT 0x8FFC #define GL_DOUBLE_VEC3_EXT 0x8FFD #define GL_DOUBLE_VEC4_EXT 0x8FFE typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLDVEXTPROC) (GLuint index, GLenum pname, GLdouble* params); typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1DEXTPROC) (GLuint index, GLdouble x); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1DVEXTPROC) (GLuint index, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2DEXTPROC) (GLuint index, GLdouble x, GLdouble y); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2DVEXTPROC) (GLuint index, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3DVEXTPROC) (GLuint index, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4DVEXTPROC) (GLuint index, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBLPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void* pointer); #define glGetVertexAttribLdvEXT GLEW_GET_FUN(__glewGetVertexAttribLdvEXT) #define glVertexArrayVertexAttribLOffsetEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribLOffsetEXT) #define glVertexAttribL1dEXT GLEW_GET_FUN(__glewVertexAttribL1dEXT) #define glVertexAttribL1dvEXT GLEW_GET_FUN(__glewVertexAttribL1dvEXT) #define glVertexAttribL2dEXT GLEW_GET_FUN(__glewVertexAttribL2dEXT) #define glVertexAttribL2dvEXT GLEW_GET_FUN(__glewVertexAttribL2dvEXT) #define glVertexAttribL3dEXT GLEW_GET_FUN(__glewVertexAttribL3dEXT) #define glVertexAttribL3dvEXT GLEW_GET_FUN(__glewVertexAttribL3dvEXT) #define glVertexAttribL4dEXT GLEW_GET_FUN(__glewVertexAttribL4dEXT) #define glVertexAttribL4dvEXT GLEW_GET_FUN(__glewVertexAttribL4dvEXT) #define glVertexAttribLPointerEXT GLEW_GET_FUN(__glewVertexAttribLPointerEXT) #define GLEW_EXT_vertex_attrib_64bit GLEW_GET_VAR(__GLEW_EXT_vertex_attrib_64bit) #endif /* GL_EXT_vertex_attrib_64bit */ /* -------------------------- GL_EXT_vertex_shader ------------------------- */ #ifndef GL_EXT_vertex_shader #define GL_EXT_vertex_shader 1 #define GL_VERTEX_SHADER_EXT 0x8780 #define GL_VERTEX_SHADER_BINDING_EXT 0x8781 #define GL_OP_INDEX_EXT 0x8782 #define GL_OP_NEGATE_EXT 0x8783 #define GL_OP_DOT3_EXT 0x8784 #define GL_OP_DOT4_EXT 0x8785 #define GL_OP_MUL_EXT 0x8786 #define GL_OP_ADD_EXT 0x8787 #define GL_OP_MADD_EXT 0x8788 #define GL_OP_FRAC_EXT 0x8789 #define GL_OP_MAX_EXT 0x878A #define GL_OP_MIN_EXT 0x878B #define GL_OP_SET_GE_EXT 0x878C #define GL_OP_SET_LT_EXT 0x878D #define GL_OP_CLAMP_EXT 0x878E #define GL_OP_FLOOR_EXT 0x878F #define GL_OP_ROUND_EXT 0x8790 #define GL_OP_EXP_BASE_2_EXT 0x8791 #define GL_OP_LOG_BASE_2_EXT 0x8792 #define GL_OP_POWER_EXT 0x8793 #define GL_OP_RECIP_EXT 0x8794 #define GL_OP_RECIP_SQRT_EXT 0x8795 #define GL_OP_SUB_EXT 0x8796 #define GL_OP_CROSS_PRODUCT_EXT 0x8797 #define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 #define GL_OP_MOV_EXT 0x8799 #define GL_OUTPUT_VERTEX_EXT 0x879A #define GL_OUTPUT_COLOR0_EXT 0x879B #define GL_OUTPUT_COLOR1_EXT 0x879C #define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D #define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E #define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F #define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 #define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 #define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 #define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 #define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 #define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 #define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 #define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 #define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 #define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 #define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA #define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB #define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC #define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD #define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE #define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF #define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 #define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 #define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 #define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 #define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 #define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 #define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 #define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 #define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 #define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 #define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA #define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB #define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC #define GL_OUTPUT_FOG_EXT 0x87BD #define GL_SCALAR_EXT 0x87BE #define GL_VECTOR_EXT 0x87BF #define GL_MATRIX_EXT 0x87C0 #define GL_VARIANT_EXT 0x87C1 #define GL_INVARIANT_EXT 0x87C2 #define GL_LOCAL_CONSTANT_EXT 0x87C3 #define GL_LOCAL_EXT 0x87C4 #define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 #define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 #define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 #define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 #define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 #define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA #define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB #define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CC #define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CD #define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE #define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF #define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 #define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 #define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 #define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 #define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 #define GL_X_EXT 0x87D5 #define GL_Y_EXT 0x87D6 #define GL_Z_EXT 0x87D7 #define GL_W_EXT 0x87D8 #define GL_NEGATIVE_X_EXT 0x87D9 #define GL_NEGATIVE_Y_EXT 0x87DA #define GL_NEGATIVE_Z_EXT 0x87DB #define GL_NEGATIVE_W_EXT 0x87DC #define GL_ZERO_EXT 0x87DD #define GL_ONE_EXT 0x87DE #define GL_NEGATIVE_ONE_EXT 0x87DF #define GL_NORMALIZED_RANGE_EXT 0x87E0 #define GL_FULL_RANGE_EXT 0x87E1 #define GL_CURRENT_VERTEX_EXT 0x87E2 #define GL_MVP_MATRIX_EXT 0x87E3 #define GL_VARIANT_VALUE_EXT 0x87E4 #define GL_VARIANT_DATATYPE_EXT 0x87E5 #define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 #define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 #define GL_VARIANT_ARRAY_EXT 0x87E8 #define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 #define GL_INVARIANT_VALUE_EXT 0x87EA #define GL_INVARIANT_DATATYPE_EXT 0x87EB #define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC #define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED typedef void (GLAPIENTRY * PFNGLBEGINVERTEXSHADEREXTPROC) (void); typedef GLuint (GLAPIENTRY * PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value); typedef GLuint (GLAPIENTRY * PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value); typedef GLuint (GLAPIENTRY * PFNGLBINDPARAMETEREXTPROC) (GLenum value); typedef GLuint (GLAPIENTRY * PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value); typedef GLuint (GLAPIENTRY * PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value); typedef void (GLAPIENTRY * PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id); typedef void (GLAPIENTRY * PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id); typedef void (GLAPIENTRY * PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); typedef void (GLAPIENTRY * PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); typedef void (GLAPIENTRY * PFNGLENDVERTEXSHADEREXTPROC) (void); typedef void (GLAPIENTRY * PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); typedef GLuint (GLAPIENTRY * PFNGLGENSYMBOLSEXTPROC) (GLenum dataType, GLenum storageType, GLenum range, GLuint components); typedef GLuint (GLAPIENTRY * PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range); typedef void (GLAPIENTRY * PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); typedef void (GLAPIENTRY * PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); typedef void (GLAPIENTRY * PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); typedef void (GLAPIENTRY * PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); typedef void (GLAPIENTRY * PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); typedef void (GLAPIENTRY * PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); typedef void (GLAPIENTRY * PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); typedef void (GLAPIENTRY * PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); typedef void (GLAPIENTRY * PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); typedef void (GLAPIENTRY * PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, GLvoid **data); typedef void (GLAPIENTRY * PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); typedef GLboolean (GLAPIENTRY * PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap); typedef void (GLAPIENTRY * PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, GLvoid *addr); typedef void (GLAPIENTRY * PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, GLvoid *addr); typedef void (GLAPIENTRY * PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1); typedef void (GLAPIENTRY * PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2); typedef void (GLAPIENTRY * PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); typedef void (GLAPIENTRY * PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); typedef void (GLAPIENTRY * PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, GLvoid *addr); typedef void (GLAPIENTRY * PFNGLVARIANTBVEXTPROC) (GLuint id, GLbyte *addr); typedef void (GLAPIENTRY * PFNGLVARIANTDVEXTPROC) (GLuint id, GLdouble *addr); typedef void (GLAPIENTRY * PFNGLVARIANTFVEXTPROC) (GLuint id, GLfloat *addr); typedef void (GLAPIENTRY * PFNGLVARIANTIVEXTPROC) (GLuint id, GLint *addr); typedef void (GLAPIENTRY * PFNGLVARIANTSVEXTPROC) (GLuint id, GLshort *addr); typedef void (GLAPIENTRY * PFNGLVARIANTUBVEXTPROC) (GLuint id, GLubyte *addr); typedef void (GLAPIENTRY * PFNGLVARIANTUIVEXTPROC) (GLuint id, GLuint *addr); typedef void (GLAPIENTRY * PFNGLVARIANTUSVEXTPROC) (GLuint id, GLushort *addr); typedef void (GLAPIENTRY * PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); #define glBeginVertexShaderEXT GLEW_GET_FUN(__glewBeginVertexShaderEXT) #define glBindLightParameterEXT GLEW_GET_FUN(__glewBindLightParameterEXT) #define glBindMaterialParameterEXT GLEW_GET_FUN(__glewBindMaterialParameterEXT) #define glBindParameterEXT GLEW_GET_FUN(__glewBindParameterEXT) #define glBindTexGenParameterEXT GLEW_GET_FUN(__glewBindTexGenParameterEXT) #define glBindTextureUnitParameterEXT GLEW_GET_FUN(__glewBindTextureUnitParameterEXT) #define glBindVertexShaderEXT GLEW_GET_FUN(__glewBindVertexShaderEXT) #define glDeleteVertexShaderEXT GLEW_GET_FUN(__glewDeleteVertexShaderEXT) #define glDisableVariantClientStateEXT GLEW_GET_FUN(__glewDisableVariantClientStateEXT) #define glEnableVariantClientStateEXT GLEW_GET_FUN(__glewEnableVariantClientStateEXT) #define glEndVertexShaderEXT GLEW_GET_FUN(__glewEndVertexShaderEXT) #define glExtractComponentEXT GLEW_GET_FUN(__glewExtractComponentEXT) #define glGenSymbolsEXT GLEW_GET_FUN(__glewGenSymbolsEXT) #define glGenVertexShadersEXT GLEW_GET_FUN(__glewGenVertexShadersEXT) #define glGetInvariantBooleanvEXT GLEW_GET_FUN(__glewGetInvariantBooleanvEXT) #define glGetInvariantFloatvEXT GLEW_GET_FUN(__glewGetInvariantFloatvEXT) #define glGetInvariantIntegervEXT GLEW_GET_FUN(__glewGetInvariantIntegervEXT) #define glGetLocalConstantBooleanvEXT GLEW_GET_FUN(__glewGetLocalConstantBooleanvEXT) #define glGetLocalConstantFloatvEXT GLEW_GET_FUN(__glewGetLocalConstantFloatvEXT) #define glGetLocalConstantIntegervEXT GLEW_GET_FUN(__glewGetLocalConstantIntegervEXT) #define glGetVariantBooleanvEXT GLEW_GET_FUN(__glewGetVariantBooleanvEXT) #define glGetVariantFloatvEXT GLEW_GET_FUN(__glewGetVariantFloatvEXT) #define glGetVariantIntegervEXT GLEW_GET_FUN(__glewGetVariantIntegervEXT) #define glGetVariantPointervEXT GLEW_GET_FUN(__glewGetVariantPointervEXT) #define glInsertComponentEXT GLEW_GET_FUN(__glewInsertComponentEXT) #define glIsVariantEnabledEXT GLEW_GET_FUN(__glewIsVariantEnabledEXT) #define glSetInvariantEXT GLEW_GET_FUN(__glewSetInvariantEXT) #define glSetLocalConstantEXT GLEW_GET_FUN(__glewSetLocalConstantEXT) #define glShaderOp1EXT GLEW_GET_FUN(__glewShaderOp1EXT) #define glShaderOp2EXT GLEW_GET_FUN(__glewShaderOp2EXT) #define glShaderOp3EXT GLEW_GET_FUN(__glewShaderOp3EXT) #define glSwizzleEXT GLEW_GET_FUN(__glewSwizzleEXT) #define glVariantPointerEXT GLEW_GET_FUN(__glewVariantPointerEXT) #define glVariantbvEXT GLEW_GET_FUN(__glewVariantbvEXT) #define glVariantdvEXT GLEW_GET_FUN(__glewVariantdvEXT) #define glVariantfvEXT GLEW_GET_FUN(__glewVariantfvEXT) #define glVariantivEXT GLEW_GET_FUN(__glewVariantivEXT) #define glVariantsvEXT GLEW_GET_FUN(__glewVariantsvEXT) #define glVariantubvEXT GLEW_GET_FUN(__glewVariantubvEXT) #define glVariantuivEXT GLEW_GET_FUN(__glewVariantuivEXT) #define glVariantusvEXT GLEW_GET_FUN(__glewVariantusvEXT) #define glWriteMaskEXT GLEW_GET_FUN(__glewWriteMaskEXT) #define GLEW_EXT_vertex_shader GLEW_GET_VAR(__GLEW_EXT_vertex_shader) #endif /* GL_EXT_vertex_shader */ /* ------------------------ GL_EXT_vertex_weighting ------------------------ */ #ifndef GL_EXT_vertex_weighting #define GL_EXT_vertex_weighting 1 #define GL_MODELVIEW0_STACK_DEPTH_EXT 0x0BA3 #define GL_MODELVIEW0_MATRIX_EXT 0x0BA6 #define GL_MODELVIEW0_EXT 0x1700 #define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 #define GL_MODELVIEW1_MATRIX_EXT 0x8506 #define GL_VERTEX_WEIGHTING_EXT 0x8509 #define GL_MODELVIEW1_EXT 0x850A #define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B #define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C #define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D #define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E #define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F #define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, void* pointer); typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTFVEXTPROC) (GLfloat* weight); #define glVertexWeightPointerEXT GLEW_GET_FUN(__glewVertexWeightPointerEXT) #define glVertexWeightfEXT GLEW_GET_FUN(__glewVertexWeightfEXT) #define glVertexWeightfvEXT GLEW_GET_FUN(__glewVertexWeightfvEXT) #define GLEW_EXT_vertex_weighting GLEW_GET_VAR(__GLEW_EXT_vertex_weighting) #endif /* GL_EXT_vertex_weighting */ /* ------------------------- GL_EXT_x11_sync_object ------------------------ */ #ifndef GL_EXT_x11_sync_object #define GL_EXT_x11_sync_object 1 #define GL_SYNC_X11_FENCE_EXT 0x90E1 typedef GLsync (GLAPIENTRY * PFNGLIMPORTSYNCEXTPROC) (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags); #define glImportSyncEXT GLEW_GET_FUN(__glewImportSyncEXT) #define GLEW_EXT_x11_sync_object GLEW_GET_VAR(__GLEW_EXT_x11_sync_object) #endif /* GL_EXT_x11_sync_object */ /* ---------------------- GL_GREMEDY_frame_terminator ---------------------- */ #ifndef GL_GREMEDY_frame_terminator #define GL_GREMEDY_frame_terminator 1 typedef void (GLAPIENTRY * PFNGLFRAMETERMINATORGREMEDYPROC) (void); #define glFrameTerminatorGREMEDY GLEW_GET_FUN(__glewFrameTerminatorGREMEDY) #define GLEW_GREMEDY_frame_terminator GLEW_GET_VAR(__GLEW_GREMEDY_frame_terminator) #endif /* GL_GREMEDY_frame_terminator */ /* ------------------------ GL_GREMEDY_string_marker ----------------------- */ #ifndef GL_GREMEDY_string_marker #define GL_GREMEDY_string_marker 1 typedef void (GLAPIENTRY * PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const void* string); #define glStringMarkerGREMEDY GLEW_GET_FUN(__glewStringMarkerGREMEDY) #define GLEW_GREMEDY_string_marker GLEW_GET_VAR(__GLEW_GREMEDY_string_marker) #endif /* GL_GREMEDY_string_marker */ /* --------------------- GL_HP_convolution_border_modes -------------------- */ #ifndef GL_HP_convolution_border_modes #define GL_HP_convolution_border_modes 1 #define GLEW_HP_convolution_border_modes GLEW_GET_VAR(__GLEW_HP_convolution_border_modes) #endif /* GL_HP_convolution_border_modes */ /* ------------------------- GL_HP_image_transform ------------------------- */ #ifndef GL_HP_image_transform #define GL_HP_image_transform 1 typedef void (GLAPIENTRY * PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint* params); typedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, const GLfloat param); typedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, const GLint param); typedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint* params); #define glGetImageTransformParameterfvHP GLEW_GET_FUN(__glewGetImageTransformParameterfvHP) #define glGetImageTransformParameterivHP GLEW_GET_FUN(__glewGetImageTransformParameterivHP) #define glImageTransformParameterfHP GLEW_GET_FUN(__glewImageTransformParameterfHP) #define glImageTransformParameterfvHP GLEW_GET_FUN(__glewImageTransformParameterfvHP) #define glImageTransformParameteriHP GLEW_GET_FUN(__glewImageTransformParameteriHP) #define glImageTransformParameterivHP GLEW_GET_FUN(__glewImageTransformParameterivHP) #define GLEW_HP_image_transform GLEW_GET_VAR(__GLEW_HP_image_transform) #endif /* GL_HP_image_transform */ /* -------------------------- GL_HP_occlusion_test ------------------------- */ #ifndef GL_HP_occlusion_test #define GL_HP_occlusion_test 1 #define GL_OCCLUSION_TEST_HP 0x8165 #define GL_OCCLUSION_TEST_RESULT_HP 0x8166 #define GLEW_HP_occlusion_test GLEW_GET_VAR(__GLEW_HP_occlusion_test) #endif /* GL_HP_occlusion_test */ /* ------------------------- GL_HP_texture_lighting ------------------------ */ #ifndef GL_HP_texture_lighting #define GL_HP_texture_lighting 1 #define GLEW_HP_texture_lighting GLEW_GET_VAR(__GLEW_HP_texture_lighting) #endif /* GL_HP_texture_lighting */ /* --------------------------- GL_IBM_cull_vertex -------------------------- */ #ifndef GL_IBM_cull_vertex #define GL_IBM_cull_vertex 1 #define GL_CULL_VERTEX_IBM 103050 #define GLEW_IBM_cull_vertex GLEW_GET_VAR(__GLEW_IBM_cull_vertex) #endif /* GL_IBM_cull_vertex */ /* ---------------------- GL_IBM_multimode_draw_arrays --------------------- */ #ifndef GL_IBM_multimode_draw_arrays #define GL_IBM_multimode_draw_arrays 1 typedef void (GLAPIENTRY * PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum* mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); typedef void (GLAPIENTRY * PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum* mode, const GLsizei *count, GLenum type, const GLvoid * const *indices, GLsizei primcount, GLint modestride); #define glMultiModeDrawArraysIBM GLEW_GET_FUN(__glewMultiModeDrawArraysIBM) #define glMultiModeDrawElementsIBM GLEW_GET_FUN(__glewMultiModeDrawElementsIBM) #define GLEW_IBM_multimode_draw_arrays GLEW_GET_VAR(__GLEW_IBM_multimode_draw_arrays) #endif /* GL_IBM_multimode_draw_arrays */ /* ------------------------- GL_IBM_rasterpos_clip ------------------------- */ #ifndef GL_IBM_rasterpos_clip #define GL_IBM_rasterpos_clip 1 #define GL_RASTER_POSITION_UNCLIPPED_IBM 103010 #define GLEW_IBM_rasterpos_clip GLEW_GET_VAR(__GLEW_IBM_rasterpos_clip) #endif /* GL_IBM_rasterpos_clip */ /* --------------------------- GL_IBM_static_data -------------------------- */ #ifndef GL_IBM_static_data #define GL_IBM_static_data 1 #define GL_ALL_STATIC_DATA_IBM 103060 #define GL_STATIC_VERTEX_ARRAY_IBM 103061 #define GLEW_IBM_static_data GLEW_GET_VAR(__GLEW_IBM_static_data) #endif /* GL_IBM_static_data */ /* --------------------- GL_IBM_texture_mirrored_repeat -------------------- */ #ifndef GL_IBM_texture_mirrored_repeat #define GL_IBM_texture_mirrored_repeat 1 #define GL_MIRRORED_REPEAT_IBM 0x8370 #define GLEW_IBM_texture_mirrored_repeat GLEW_GET_VAR(__GLEW_IBM_texture_mirrored_repeat) #endif /* GL_IBM_texture_mirrored_repeat */ /* ----------------------- GL_IBM_vertex_array_lists ----------------------- */ #ifndef GL_IBM_vertex_array_lists #define GL_IBM_vertex_array_lists 1 #define GL_VERTEX_ARRAY_LIST_IBM 103070 #define GL_NORMAL_ARRAY_LIST_IBM 103071 #define GL_COLOR_ARRAY_LIST_IBM 103072 #define GL_INDEX_ARRAY_LIST_IBM 103073 #define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 #define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 #define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 #define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 #define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 #define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 #define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 #define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 #define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 #define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 #define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 #define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 typedef void (GLAPIENTRY * PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride); typedef void (GLAPIENTRY * PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean ** pointer, GLint ptrstride); typedef void (GLAPIENTRY * PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride); typedef void (GLAPIENTRY * PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride); typedef void (GLAPIENTRY * PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride); typedef void (GLAPIENTRY * PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride); typedef void (GLAPIENTRY * PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride); #define glColorPointerListIBM GLEW_GET_FUN(__glewColorPointerListIBM) #define glEdgeFlagPointerListIBM GLEW_GET_FUN(__glewEdgeFlagPointerListIBM) #define glFogCoordPointerListIBM GLEW_GET_FUN(__glewFogCoordPointerListIBM) #define glIndexPointerListIBM GLEW_GET_FUN(__glewIndexPointerListIBM) #define glNormalPointerListIBM GLEW_GET_FUN(__glewNormalPointerListIBM) #define glSecondaryColorPointerListIBM GLEW_GET_FUN(__glewSecondaryColorPointerListIBM) #define glTexCoordPointerListIBM GLEW_GET_FUN(__glewTexCoordPointerListIBM) #define glVertexPointerListIBM GLEW_GET_FUN(__glewVertexPointerListIBM) #define GLEW_IBM_vertex_array_lists GLEW_GET_VAR(__GLEW_IBM_vertex_array_lists) #endif /* GL_IBM_vertex_array_lists */ /* -------------------------- GL_INGR_color_clamp -------------------------- */ #ifndef GL_INGR_color_clamp #define GL_INGR_color_clamp 1 #define GL_RED_MIN_CLAMP_INGR 0x8560 #define GL_GREEN_MIN_CLAMP_INGR 0x8561 #define GL_BLUE_MIN_CLAMP_INGR 0x8562 #define GL_ALPHA_MIN_CLAMP_INGR 0x8563 #define GL_RED_MAX_CLAMP_INGR 0x8564 #define GL_GREEN_MAX_CLAMP_INGR 0x8565 #define GL_BLUE_MAX_CLAMP_INGR 0x8566 #define GL_ALPHA_MAX_CLAMP_INGR 0x8567 #define GLEW_INGR_color_clamp GLEW_GET_VAR(__GLEW_INGR_color_clamp) #endif /* GL_INGR_color_clamp */ /* ------------------------- GL_INGR_interlace_read ------------------------ */ #ifndef GL_INGR_interlace_read #define GL_INGR_interlace_read 1 #define GL_INTERLACE_READ_INGR 0x8568 #define GLEW_INGR_interlace_read GLEW_GET_VAR(__GLEW_INGR_interlace_read) #endif /* GL_INGR_interlace_read */ /* ------------------------ GL_INTEL_parallel_arrays ----------------------- */ #ifndef GL_INTEL_parallel_arrays #define GL_INTEL_parallel_arrays 1 #define GL_PARALLEL_ARRAYS_INTEL 0x83F4 #define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 #define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 #define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 #define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 typedef void (GLAPIENTRY * PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const void** pointer); typedef void (GLAPIENTRY * PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const void** pointer); typedef void (GLAPIENTRY * PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const void** pointer); typedef void (GLAPIENTRY * PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const void** pointer); #define glColorPointervINTEL GLEW_GET_FUN(__glewColorPointervINTEL) #define glNormalPointervINTEL GLEW_GET_FUN(__glewNormalPointervINTEL) #define glTexCoordPointervINTEL GLEW_GET_FUN(__glewTexCoordPointervINTEL) #define glVertexPointervINTEL GLEW_GET_FUN(__glewVertexPointervINTEL) #define GLEW_INTEL_parallel_arrays GLEW_GET_VAR(__GLEW_INTEL_parallel_arrays) #endif /* GL_INTEL_parallel_arrays */ /* ------------------------ GL_INTEL_texture_scissor ----------------------- */ #ifndef GL_INTEL_texture_scissor #define GL_INTEL_texture_scissor 1 typedef void (GLAPIENTRY * PFNGLTEXSCISSORFUNCINTELPROC) (GLenum target, GLenum lfunc, GLenum hfunc); typedef void (GLAPIENTRY * PFNGLTEXSCISSORINTELPROC) (GLenum target, GLclampf tlow, GLclampf thigh); #define glTexScissorFuncINTEL GLEW_GET_FUN(__glewTexScissorFuncINTEL) #define glTexScissorINTEL GLEW_GET_FUN(__glewTexScissorINTEL) #define GLEW_INTEL_texture_scissor GLEW_GET_VAR(__GLEW_INTEL_texture_scissor) #endif /* GL_INTEL_texture_scissor */ /* ------------------------------ GL_KHR_debug ----------------------------- */ #ifndef GL_KHR_debug #define GL_KHR_debug 1 #define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 #define GL_STACK_OVERFLOW 0x0503 #define GL_STACK_UNDERFLOW 0x0504 #define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 #define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 #define GL_DEBUG_CALLBACK_FUNCTION 0x8244 #define GL_DEBUG_CALLBACK_USER_PARAM 0x8245 #define GL_DEBUG_SOURCE_API 0x8246 #define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247 #define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248 #define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249 #define GL_DEBUG_SOURCE_APPLICATION 0x824A #define GL_DEBUG_SOURCE_OTHER 0x824B #define GL_DEBUG_TYPE_ERROR 0x824C #define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D #define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E #define GL_DEBUG_TYPE_PORTABILITY 0x824F #define GL_DEBUG_TYPE_PERFORMANCE 0x8250 #define GL_DEBUG_TYPE_OTHER 0x8251 #define GL_DEBUG_TYPE_MARKER 0x8268 #define GL_DEBUG_TYPE_PUSH_GROUP 0x8269 #define GL_DEBUG_TYPE_POP_GROUP 0x826A #define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B #define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C #define GL_DEBUG_GROUP_STACK_DEPTH 0x826D #define GL_BUFFER 0x82E0 #define GL_SHADER 0x82E1 #define GL_PROGRAM 0x82E2 #define GL_QUERY 0x82E3 #define GL_PROGRAM_PIPELINE 0x82E4 #define GL_SAMPLER 0x82E6 #define GL_DISPLAY_LIST 0x82E7 #define GL_MAX_LABEL_LENGTH 0x82E8 #define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143 #define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144 #define GL_DEBUG_LOGGED_MESSAGES 0x9145 #define GL_DEBUG_SEVERITY_HIGH 0x9146 #define GL_DEBUG_SEVERITY_MEDIUM 0x9147 #define GL_DEBUG_SEVERITY_LOW 0x9148 #define GL_DEBUG_OUTPUT 0x92E0 typedef void (APIENTRY *GLDEBUGPROC)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam); typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, void* userParam); typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled); typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* buf); typedef GLuint (GLAPIENTRY * PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufsize, GLenum* sources, GLenum* types, GLuint* ids, GLenum* severities, GLsizei* lengths, GLchar* messageLog); typedef void (GLAPIENTRY * PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei* length, GLchar *label); typedef void (GLAPIENTRY * PFNGLGETOBJECTPTRLABELPROC) (void* ptr, GLsizei bufSize, GLsizei* length, GLchar *label); typedef void (GLAPIENTRY * PFNGLGETPOINTERVPROC) (GLenum pname, void** params); typedef void (GLAPIENTRY * PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar* label); typedef void (GLAPIENTRY * PFNGLOBJECTPTRLABELPROC) (void* ptr, GLsizei length, const GLchar* label); typedef void (GLAPIENTRY * PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar * message); #define glDebugMessageCallback GLEW_GET_FUN(__glewDebugMessageCallback) #define glDebugMessageControl GLEW_GET_FUN(__glewDebugMessageControl) #define glDebugMessageInsert GLEW_GET_FUN(__glewDebugMessageInsert) #define glGetDebugMessageLog GLEW_GET_FUN(__glewGetDebugMessageLog) #define glGetObjectLabel GLEW_GET_FUN(__glewGetObjectLabel) #define glGetObjectPtrLabel GLEW_GET_FUN(__glewGetObjectPtrLabel) #define glGetPointerv GLEW_GET_FUN(__glewGetPointerv) #define glObjectLabel GLEW_GET_FUN(__glewObjectLabel) #define glObjectPtrLabel GLEW_GET_FUN(__glewObjectPtrLabel) #define glPushDebugGroup GLEW_GET_FUN(__glewPushDebugGroup) #define GLEW_KHR_debug GLEW_GET_VAR(__GLEW_KHR_debug) #endif /* GL_KHR_debug */ /* ------------------ GL_KHR_texture_compression_astc_ldr ------------------ */ #ifndef GL_KHR_texture_compression_astc_ldr #define GL_KHR_texture_compression_astc_ldr 1 #define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 #define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 #define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 #define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 #define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 #define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 #define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 #define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 #define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 #define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 #define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA #define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB #define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC #define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD #define GLEW_KHR_texture_compression_astc_ldr GLEW_GET_VAR(__GLEW_KHR_texture_compression_astc_ldr) #endif /* GL_KHR_texture_compression_astc_ldr */ /* -------------------------- GL_KTX_buffer_region ------------------------- */ #ifndef GL_KTX_buffer_region #define GL_KTX_buffer_region 1 #define GL_KTX_FRONT_REGION 0x0 #define GL_KTX_BACK_REGION 0x1 #define GL_KTX_Z_REGION 0x2 #define GL_KTX_STENCIL_REGION 0x3 typedef GLuint (GLAPIENTRY * PFNGLBUFFERREGIONENABLEDPROC) (void); typedef void (GLAPIENTRY * PFNGLDELETEBUFFERREGIONPROC) (GLenum region); typedef void (GLAPIENTRY * PFNGLDRAWBUFFERREGIONPROC) (GLuint region, GLint x, GLint y, GLsizei width, GLsizei height, GLint xDest, GLint yDest); typedef GLuint (GLAPIENTRY * PFNGLNEWBUFFERREGIONPROC) (GLenum region); typedef void (GLAPIENTRY * PFNGLREADBUFFERREGIONPROC) (GLuint region, GLint x, GLint y, GLsizei width, GLsizei height); #define glBufferRegionEnabled GLEW_GET_FUN(__glewBufferRegionEnabled) #define glDeleteBufferRegion GLEW_GET_FUN(__glewDeleteBufferRegion) #define glDrawBufferRegion GLEW_GET_FUN(__glewDrawBufferRegion) #define glNewBufferRegion GLEW_GET_FUN(__glewNewBufferRegion) #define glReadBufferRegion GLEW_GET_FUN(__glewReadBufferRegion) #define GLEW_KTX_buffer_region GLEW_GET_VAR(__GLEW_KTX_buffer_region) #endif /* GL_KTX_buffer_region */ /* ------------------------- GL_MESAX_texture_stack ------------------------ */ #ifndef GL_MESAX_texture_stack #define GL_MESAX_texture_stack 1 #define GL_TEXTURE_1D_STACK_MESAX 0x8759 #define GL_TEXTURE_2D_STACK_MESAX 0x875A #define GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B #define GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C #define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D #define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E #define GLEW_MESAX_texture_stack GLEW_GET_VAR(__GLEW_MESAX_texture_stack) #endif /* GL_MESAX_texture_stack */ /* -------------------------- GL_MESA_pack_invert -------------------------- */ #ifndef GL_MESA_pack_invert #define GL_MESA_pack_invert 1 #define GL_PACK_INVERT_MESA 0x8758 #define GLEW_MESA_pack_invert GLEW_GET_VAR(__GLEW_MESA_pack_invert) #endif /* GL_MESA_pack_invert */ /* ------------------------- GL_MESA_resize_buffers ------------------------ */ #ifndef GL_MESA_resize_buffers #define GL_MESA_resize_buffers 1 typedef void (GLAPIENTRY * PFNGLRESIZEBUFFERSMESAPROC) (void); #define glResizeBuffersMESA GLEW_GET_FUN(__glewResizeBuffersMESA) #define GLEW_MESA_resize_buffers GLEW_GET_VAR(__GLEW_MESA_resize_buffers) #endif /* GL_MESA_resize_buffers */ /* --------------------------- GL_MESA_window_pos -------------------------- */ #ifndef GL_MESA_window_pos #define GL_MESA_window_pos 1 typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble* p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat* p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IVMESAPROC) (const GLint* p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y); typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SVMESAPROC) (const GLshort* p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble* p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat* p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IVMESAPROC) (const GLint* p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z); typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SVMESAPROC) (const GLshort* p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble); typedef void (GLAPIENTRY * PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble* p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (GLAPIENTRY * PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat* p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w); typedef void (GLAPIENTRY * PFNGLWINDOWPOS4IVMESAPROC) (const GLint* p); typedef void (GLAPIENTRY * PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w); typedef void (GLAPIENTRY * PFNGLWINDOWPOS4SVMESAPROC) (const GLshort* p); #define glWindowPos2dMESA GLEW_GET_FUN(__glewWindowPos2dMESA) #define glWindowPos2dvMESA GLEW_GET_FUN(__glewWindowPos2dvMESA) #define glWindowPos2fMESA GLEW_GET_FUN(__glewWindowPos2fMESA) #define glWindowPos2fvMESA GLEW_GET_FUN(__glewWindowPos2fvMESA) #define glWindowPos2iMESA GLEW_GET_FUN(__glewWindowPos2iMESA) #define glWindowPos2ivMESA GLEW_GET_FUN(__glewWindowPos2ivMESA) #define glWindowPos2sMESA GLEW_GET_FUN(__glewWindowPos2sMESA) #define glWindowPos2svMESA GLEW_GET_FUN(__glewWindowPos2svMESA) #define glWindowPos3dMESA GLEW_GET_FUN(__glewWindowPos3dMESA) #define glWindowPos3dvMESA GLEW_GET_FUN(__glewWindowPos3dvMESA) #define glWindowPos3fMESA GLEW_GET_FUN(__glewWindowPos3fMESA) #define glWindowPos3fvMESA GLEW_GET_FUN(__glewWindowPos3fvMESA) #define glWindowPos3iMESA GLEW_GET_FUN(__glewWindowPos3iMESA) #define glWindowPos3ivMESA GLEW_GET_FUN(__glewWindowPos3ivMESA) #define glWindowPos3sMESA GLEW_GET_FUN(__glewWindowPos3sMESA) #define glWindowPos3svMESA GLEW_GET_FUN(__glewWindowPos3svMESA) #define glWindowPos4dMESA GLEW_GET_FUN(__glewWindowPos4dMESA) #define glWindowPos4dvMESA GLEW_GET_FUN(__glewWindowPos4dvMESA) #define glWindowPos4fMESA GLEW_GET_FUN(__glewWindowPos4fMESA) #define glWindowPos4fvMESA GLEW_GET_FUN(__glewWindowPos4fvMESA) #define glWindowPos4iMESA GLEW_GET_FUN(__glewWindowPos4iMESA) #define glWindowPos4ivMESA GLEW_GET_FUN(__glewWindowPos4ivMESA) #define glWindowPos4sMESA GLEW_GET_FUN(__glewWindowPos4sMESA) #define glWindowPos4svMESA GLEW_GET_FUN(__glewWindowPos4svMESA) #define GLEW_MESA_window_pos GLEW_GET_VAR(__GLEW_MESA_window_pos) #endif /* GL_MESA_window_pos */ /* ------------------------- GL_MESA_ycbcr_texture ------------------------- */ #ifndef GL_MESA_ycbcr_texture #define GL_MESA_ycbcr_texture 1 #define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA #define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB #define GL_YCBCR_MESA 0x8757 #define GLEW_MESA_ycbcr_texture GLEW_GET_VAR(__GLEW_MESA_ycbcr_texture) #endif /* GL_MESA_ycbcr_texture */ /* ------------------------- GL_NVX_gpu_memory_info ------------------------ */ #ifndef GL_NVX_gpu_memory_info #define GL_NVX_gpu_memory_info 1 #define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047 #define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048 #define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049 #define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A #define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B #define GLEW_NVX_gpu_memory_info GLEW_GET_VAR(__GLEW_NVX_gpu_memory_info) #endif /* GL_NVX_gpu_memory_info */ /* ------------------------- GL_NV_bindless_texture ------------------------ */ #ifndef GL_NV_bindless_texture #define GL_NV_bindless_texture 1 typedef GLuint64 (GLAPIENTRY * PFNGLGETIMAGEHANDLENVPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); typedef GLuint64 (GLAPIENTRY * PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture); typedef GLuint64 (GLAPIENTRY * PFNGLGETTEXTURESAMPLERHANDLENVPROC) (GLuint texture, GLuint sampler); typedef GLboolean (GLAPIENTRY * PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle); typedef GLboolean (GLAPIENTRY * PFNGLISTEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle); typedef void (GLAPIENTRY * PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC) (GLuint64 handle); typedef void (GLAPIENTRY * PFNGLMAKEIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle, GLenum access); typedef void (GLAPIENTRY * PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC) (GLuint64 handle); typedef void (GLAPIENTRY * PFNGLMAKETEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC) (GLuint program, GLint location, GLuint64 value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64* values); typedef void (GLAPIENTRY * PFNGLUNIFORMHANDLEUI64NVPROC) (GLint location, GLuint64 value); typedef void (GLAPIENTRY * PFNGLUNIFORMHANDLEUI64VNVPROC) (GLint location, GLsizei count, const GLuint64* value); #define glGetImageHandleNV GLEW_GET_FUN(__glewGetImageHandleNV) #define glGetTextureHandleNV GLEW_GET_FUN(__glewGetTextureHandleNV) #define glGetTextureSamplerHandleNV GLEW_GET_FUN(__glewGetTextureSamplerHandleNV) #define glIsImageHandleResidentNV GLEW_GET_FUN(__glewIsImageHandleResidentNV) #define glIsTextureHandleResidentNV GLEW_GET_FUN(__glewIsTextureHandleResidentNV) #define glMakeImageHandleNonResidentNV GLEW_GET_FUN(__glewMakeImageHandleNonResidentNV) #define glMakeImageHandleResidentNV GLEW_GET_FUN(__glewMakeImageHandleResidentNV) #define glMakeTextureHandleNonResidentNV GLEW_GET_FUN(__glewMakeTextureHandleNonResidentNV) #define glMakeTextureHandleResidentNV GLEW_GET_FUN(__glewMakeTextureHandleResidentNV) #define glProgramUniformHandleui64NV GLEW_GET_FUN(__glewProgramUniformHandleui64NV) #define glProgramUniformHandleui64vNV GLEW_GET_FUN(__glewProgramUniformHandleui64vNV) #define glUniformHandleui64NV GLEW_GET_FUN(__glewUniformHandleui64NV) #define glUniformHandleui64vNV GLEW_GET_FUN(__glewUniformHandleui64vNV) #define GLEW_NV_bindless_texture GLEW_GET_VAR(__GLEW_NV_bindless_texture) #endif /* GL_NV_bindless_texture */ /* --------------------------- GL_NV_blend_square -------------------------- */ #ifndef GL_NV_blend_square #define GL_NV_blend_square 1 #define GLEW_NV_blend_square GLEW_GET_VAR(__GLEW_NV_blend_square) #endif /* GL_NV_blend_square */ /* ------------------------ GL_NV_conditional_render ----------------------- */ #ifndef GL_NV_conditional_render #define GL_NV_conditional_render 1 #define GL_QUERY_WAIT_NV 0x8E13 #define GL_QUERY_NO_WAIT_NV 0x8E14 #define GL_QUERY_BY_REGION_WAIT_NV 0x8E15 #define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16 typedef void (GLAPIENTRY * PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode); typedef void (GLAPIENTRY * PFNGLENDCONDITIONALRENDERNVPROC) (void); #define glBeginConditionalRenderNV GLEW_GET_FUN(__glewBeginConditionalRenderNV) #define glEndConditionalRenderNV GLEW_GET_FUN(__glewEndConditionalRenderNV) #define GLEW_NV_conditional_render GLEW_GET_VAR(__GLEW_NV_conditional_render) #endif /* GL_NV_conditional_render */ /* ----------------------- GL_NV_copy_depth_to_color ----------------------- */ #ifndef GL_NV_copy_depth_to_color #define GL_NV_copy_depth_to_color 1 #define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E #define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F #define GLEW_NV_copy_depth_to_color GLEW_GET_VAR(__GLEW_NV_copy_depth_to_color) #endif /* GL_NV_copy_depth_to_color */ /* ---------------------------- GL_NV_copy_image --------------------------- */ #ifndef GL_NV_copy_image #define GL_NV_copy_image 1 typedef void (GLAPIENTRY * PFNGLCOPYIMAGESUBDATANVPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); #define glCopyImageSubDataNV GLEW_GET_FUN(__glewCopyImageSubDataNV) #define GLEW_NV_copy_image GLEW_GET_VAR(__GLEW_NV_copy_image) #endif /* GL_NV_copy_image */ /* ------------------------ GL_NV_depth_buffer_float ----------------------- */ #ifndef GL_NV_depth_buffer_float #define GL_NV_depth_buffer_float 1 #define GL_DEPTH_COMPONENT32F_NV 0x8DAB #define GL_DEPTH32F_STENCIL8_NV 0x8DAC #define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD #define GL_DEPTH_BUFFER_FLOAT_MODE_NV 0x8DAF typedef void (GLAPIENTRY * PFNGLCLEARDEPTHDNVPROC) (GLdouble depth); typedef void (GLAPIENTRY * PFNGLDEPTHBOUNDSDNVPROC) (GLdouble zmin, GLdouble zmax); typedef void (GLAPIENTRY * PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFar); #define glClearDepthdNV GLEW_GET_FUN(__glewClearDepthdNV) #define glDepthBoundsdNV GLEW_GET_FUN(__glewDepthBoundsdNV) #define glDepthRangedNV GLEW_GET_FUN(__glewDepthRangedNV) #define GLEW_NV_depth_buffer_float GLEW_GET_VAR(__GLEW_NV_depth_buffer_float) #endif /* GL_NV_depth_buffer_float */ /* --------------------------- GL_NV_depth_clamp --------------------------- */ #ifndef GL_NV_depth_clamp #define GL_NV_depth_clamp 1 #define GL_DEPTH_CLAMP_NV 0x864F #define GLEW_NV_depth_clamp GLEW_GET_VAR(__GLEW_NV_depth_clamp) #endif /* GL_NV_depth_clamp */ /* ---------------------- GL_NV_depth_range_unclamped ---------------------- */ #ifndef GL_NV_depth_range_unclamped #define GL_NV_depth_range_unclamped 1 #define GL_SAMPLE_COUNT_BITS_NV 0x8864 #define GL_CURRENT_SAMPLE_COUNT_QUERY_NV 0x8865 #define GL_QUERY_RESULT_NV 0x8866 #define GL_QUERY_RESULT_AVAILABLE_NV 0x8867 #define GL_SAMPLE_COUNT_NV 0x8914 #define GLEW_NV_depth_range_unclamped GLEW_GET_VAR(__GLEW_NV_depth_range_unclamped) #endif /* GL_NV_depth_range_unclamped */ /* ---------------------------- GL_NV_evaluators --------------------------- */ #ifndef GL_NV_evaluators #define GL_NV_evaluators 1 #define GL_EVAL_2D_NV 0x86C0 #define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 #define GL_MAP_TESSELLATION_NV 0x86C2 #define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 #define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 #define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 #define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 #define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 #define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 #define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 #define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA #define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB #define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC #define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD #define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE #define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF #define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 #define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 #define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 #define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 #define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 #define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 #define GL_MAX_MAP_TESSELLATION_NV 0x86D6 #define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 typedef void (GLAPIENTRY * PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode); typedef void (GLAPIENTRY * PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, void* points); typedef void (GLAPIENTRY * PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const void* points); typedef void (GLAPIENTRY * PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint* params); #define glEvalMapsNV GLEW_GET_FUN(__glewEvalMapsNV) #define glGetMapAttribParameterfvNV GLEW_GET_FUN(__glewGetMapAttribParameterfvNV) #define glGetMapAttribParameterivNV GLEW_GET_FUN(__glewGetMapAttribParameterivNV) #define glGetMapControlPointsNV GLEW_GET_FUN(__glewGetMapControlPointsNV) #define glGetMapParameterfvNV GLEW_GET_FUN(__glewGetMapParameterfvNV) #define glGetMapParameterivNV GLEW_GET_FUN(__glewGetMapParameterivNV) #define glMapControlPointsNV GLEW_GET_FUN(__glewMapControlPointsNV) #define glMapParameterfvNV GLEW_GET_FUN(__glewMapParameterfvNV) #define glMapParameterivNV GLEW_GET_FUN(__glewMapParameterivNV) #define GLEW_NV_evaluators GLEW_GET_VAR(__GLEW_NV_evaluators) #endif /* GL_NV_evaluators */ /* ----------------------- GL_NV_explicit_multisample ---------------------- */ #ifndef GL_NV_explicit_multisample #define GL_NV_explicit_multisample 1 #define GL_SAMPLE_POSITION_NV 0x8E50 #define GL_SAMPLE_MASK_NV 0x8E51 #define GL_SAMPLE_MASK_VALUE_NV 0x8E52 #define GL_TEXTURE_BINDING_RENDERBUFFER_NV 0x8E53 #define GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV 0x8E54 #define GL_TEXTURE_RENDERBUFFER_NV 0x8E55 #define GL_SAMPLER_RENDERBUFFER_NV 0x8E56 #define GL_INT_SAMPLER_RENDERBUFFER_NV 0x8E57 #define GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV 0x8E58 #define GL_MAX_SAMPLE_MASK_WORDS_NV 0x8E59 typedef void (GLAPIENTRY * PFNGLGETMULTISAMPLEFVNVPROC) (GLenum pname, GLuint index, GLfloat* val); typedef void (GLAPIENTRY * PFNGLSAMPLEMASKINDEXEDNVPROC) (GLuint index, GLbitfield mask); typedef void (GLAPIENTRY * PFNGLTEXRENDERBUFFERNVPROC) (GLenum target, GLuint renderbuffer); #define glGetMultisamplefvNV GLEW_GET_FUN(__glewGetMultisamplefvNV) #define glSampleMaskIndexedNV GLEW_GET_FUN(__glewSampleMaskIndexedNV) #define glTexRenderbufferNV GLEW_GET_FUN(__glewTexRenderbufferNV) #define GLEW_NV_explicit_multisample GLEW_GET_VAR(__GLEW_NV_explicit_multisample) #endif /* GL_NV_explicit_multisample */ /* ------------------------------ GL_NV_fence ------------------------------ */ #ifndef GL_NV_fence #define GL_NV_fence 1 #define GL_ALL_COMPLETED_NV 0x84F2 #define GL_FENCE_STATUS_NV 0x84F3 #define GL_FENCE_CONDITION_NV 0x84F4 typedef void (GLAPIENTRY * PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint* fences); typedef void (GLAPIENTRY * PFNGLFINISHFENCENVPROC) (GLuint fence); typedef void (GLAPIENTRY * PFNGLGENFENCESNVPROC) (GLsizei n, GLuint* fences); typedef void (GLAPIENTRY * PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint* params); typedef GLboolean (GLAPIENTRY * PFNGLISFENCENVPROC) (GLuint fence); typedef void (GLAPIENTRY * PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); typedef GLboolean (GLAPIENTRY * PFNGLTESTFENCENVPROC) (GLuint fence); #define glDeleteFencesNV GLEW_GET_FUN(__glewDeleteFencesNV) #define glFinishFenceNV GLEW_GET_FUN(__glewFinishFenceNV) #define glGenFencesNV GLEW_GET_FUN(__glewGenFencesNV) #define glGetFenceivNV GLEW_GET_FUN(__glewGetFenceivNV) #define glIsFenceNV GLEW_GET_FUN(__glewIsFenceNV) #define glSetFenceNV GLEW_GET_FUN(__glewSetFenceNV) #define glTestFenceNV GLEW_GET_FUN(__glewTestFenceNV) #define GLEW_NV_fence GLEW_GET_VAR(__GLEW_NV_fence) #endif /* GL_NV_fence */ /* --------------------------- GL_NV_float_buffer -------------------------- */ #ifndef GL_NV_float_buffer #define GL_NV_float_buffer 1 #define GL_FLOAT_R_NV 0x8880 #define GL_FLOAT_RG_NV 0x8881 #define GL_FLOAT_RGB_NV 0x8882 #define GL_FLOAT_RGBA_NV 0x8883 #define GL_FLOAT_R16_NV 0x8884 #define GL_FLOAT_R32_NV 0x8885 #define GL_FLOAT_RG16_NV 0x8886 #define GL_FLOAT_RG32_NV 0x8887 #define GL_FLOAT_RGB16_NV 0x8888 #define GL_FLOAT_RGB32_NV 0x8889 #define GL_FLOAT_RGBA16_NV 0x888A #define GL_FLOAT_RGBA32_NV 0x888B #define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C #define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D #define GL_FLOAT_RGBA_MODE_NV 0x888E #define GLEW_NV_float_buffer GLEW_GET_VAR(__GLEW_NV_float_buffer) #endif /* GL_NV_float_buffer */ /* --------------------------- GL_NV_fog_distance -------------------------- */ #ifndef GL_NV_fog_distance #define GL_NV_fog_distance 1 #define GL_FOG_DISTANCE_MODE_NV 0x855A #define GL_EYE_RADIAL_NV 0x855B #define GL_EYE_PLANE_ABSOLUTE_NV 0x855C #define GLEW_NV_fog_distance GLEW_GET_VAR(__GLEW_NV_fog_distance) #endif /* GL_NV_fog_distance */ /* ------------------------- GL_NV_fragment_program ------------------------ */ #ifndef GL_NV_fragment_program #define GL_NV_fragment_program 1 #define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 #define GL_FRAGMENT_PROGRAM_NV 0x8870 #define GL_MAX_TEXTURE_COORDS_NV 0x8871 #define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872 #define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 #define GL_PROGRAM_ERROR_STRING_NV 0x8874 typedef void (GLAPIENTRY * PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLdouble *params); typedef void (GLAPIENTRY * PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLfloat *params); typedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, const GLdouble v[]); typedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, const GLfloat v[]); #define glGetProgramNamedParameterdvNV GLEW_GET_FUN(__glewGetProgramNamedParameterdvNV) #define glGetProgramNamedParameterfvNV GLEW_GET_FUN(__glewGetProgramNamedParameterfvNV) #define glProgramNamedParameter4dNV GLEW_GET_FUN(__glewProgramNamedParameter4dNV) #define glProgramNamedParameter4dvNV GLEW_GET_FUN(__glewProgramNamedParameter4dvNV) #define glProgramNamedParameter4fNV GLEW_GET_FUN(__glewProgramNamedParameter4fNV) #define glProgramNamedParameter4fvNV GLEW_GET_FUN(__glewProgramNamedParameter4fvNV) #define GLEW_NV_fragment_program GLEW_GET_VAR(__GLEW_NV_fragment_program) #endif /* GL_NV_fragment_program */ /* ------------------------ GL_NV_fragment_program2 ------------------------ */ #ifndef GL_NV_fragment_program2 #define GL_NV_fragment_program2 1 #define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 #define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 #define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 #define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7 #define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8 #define GLEW_NV_fragment_program2 GLEW_GET_VAR(__GLEW_NV_fragment_program2) #endif /* GL_NV_fragment_program2 */ /* ------------------------ GL_NV_fragment_program4 ------------------------ */ #ifndef GL_NV_fragment_program4 #define GL_NV_fragment_program4 1 #define GLEW_NV_fragment_program4 GLEW_GET_VAR(__GLEW_NV_fragment_program4) #endif /* GL_NV_fragment_program4 */ /* --------------------- GL_NV_fragment_program_option --------------------- */ #ifndef GL_NV_fragment_program_option #define GL_NV_fragment_program_option 1 #define GLEW_NV_fragment_program_option GLEW_GET_VAR(__GLEW_NV_fragment_program_option) #endif /* GL_NV_fragment_program_option */ /* ----------------- GL_NV_framebuffer_multisample_coverage ---------------- */ #ifndef GL_NV_framebuffer_multisample_coverage #define GL_NV_framebuffer_multisample_coverage 1 #define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB #define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10 #define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11 #define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12 typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); #define glRenderbufferStorageMultisampleCoverageNV GLEW_GET_FUN(__glewRenderbufferStorageMultisampleCoverageNV) #define GLEW_NV_framebuffer_multisample_coverage GLEW_GET_VAR(__GLEW_NV_framebuffer_multisample_coverage) #endif /* GL_NV_framebuffer_multisample_coverage */ /* ------------------------ GL_NV_geometry_program4 ------------------------ */ #ifndef GL_NV_geometry_program4 #define GL_NV_geometry_program4 1 #define GL_GEOMETRY_PROGRAM_NV 0x8C26 #define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27 #define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28 typedef void (GLAPIENTRY * PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit); #define glProgramVertexLimitNV GLEW_GET_FUN(__glewProgramVertexLimitNV) #define GLEW_NV_geometry_program4 GLEW_GET_VAR(__GLEW_NV_geometry_program4) #endif /* GL_NV_geometry_program4 */ /* ------------------------- GL_NV_geometry_shader4 ------------------------ */ #ifndef GL_NV_geometry_shader4 #define GL_NV_geometry_shader4 1 #define GLEW_NV_geometry_shader4 GLEW_GET_VAR(__GLEW_NV_geometry_shader4) #endif /* GL_NV_geometry_shader4 */ /* --------------------------- GL_NV_gpu_program4 -------------------------- */ #ifndef GL_NV_gpu_program4 #define GL_NV_gpu_program4 1 #define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904 #define GL_MAX_PROGRAM_TEXEL_OFFSET_NV 0x8905 #define GL_PROGRAM_ATTRIB_COMPONENTS_NV 0x8906 #define GL_PROGRAM_RESULT_COMPONENTS_NV 0x8907 #define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908 #define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909 #define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5 #define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6 typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params); typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params); typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params); typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params); typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params); typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params); typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params); typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params); #define glProgramEnvParameterI4iNV GLEW_GET_FUN(__glewProgramEnvParameterI4iNV) #define glProgramEnvParameterI4ivNV GLEW_GET_FUN(__glewProgramEnvParameterI4ivNV) #define glProgramEnvParameterI4uiNV GLEW_GET_FUN(__glewProgramEnvParameterI4uiNV) #define glProgramEnvParameterI4uivNV GLEW_GET_FUN(__glewProgramEnvParameterI4uivNV) #define glProgramEnvParametersI4ivNV GLEW_GET_FUN(__glewProgramEnvParametersI4ivNV) #define glProgramEnvParametersI4uivNV GLEW_GET_FUN(__glewProgramEnvParametersI4uivNV) #define glProgramLocalParameterI4iNV GLEW_GET_FUN(__glewProgramLocalParameterI4iNV) #define glProgramLocalParameterI4ivNV GLEW_GET_FUN(__glewProgramLocalParameterI4ivNV) #define glProgramLocalParameterI4uiNV GLEW_GET_FUN(__glewProgramLocalParameterI4uiNV) #define glProgramLocalParameterI4uivNV GLEW_GET_FUN(__glewProgramLocalParameterI4uivNV) #define glProgramLocalParametersI4ivNV GLEW_GET_FUN(__glewProgramLocalParametersI4ivNV) #define glProgramLocalParametersI4uivNV GLEW_GET_FUN(__glewProgramLocalParametersI4uivNV) #define GLEW_NV_gpu_program4 GLEW_GET_VAR(__GLEW_NV_gpu_program4) #endif /* GL_NV_gpu_program4 */ /* --------------------------- GL_NV_gpu_program5 -------------------------- */ #ifndef GL_NV_gpu_program5 #define GL_NV_gpu_program5 1 #define GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV 0x8E5A #define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5B #define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5C #define GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV 0x8E5D #define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5E #define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5F #define GLEW_NV_gpu_program5 GLEW_GET_VAR(__GLEW_NV_gpu_program5) #endif /* GL_NV_gpu_program5 */ /* ------------------------- GL_NV_gpu_program_fp64 ------------------------ */ #ifndef GL_NV_gpu_program_fp64 #define GL_NV_gpu_program_fp64 1 #define GLEW_NV_gpu_program_fp64 GLEW_GET_VAR(__GLEW_NV_gpu_program_fp64) #endif /* GL_NV_gpu_program_fp64 */ /* --------------------------- GL_NV_gpu_shader5 --------------------------- */ #ifndef GL_NV_gpu_shader5 #define GL_NV_gpu_shader5 1 #define GL_INT64_NV 0x140E #define GL_UNSIGNED_INT64_NV 0x140F #define GL_INT8_NV 0x8FE0 #define GL_INT8_VEC2_NV 0x8FE1 #define GL_INT8_VEC3_NV 0x8FE2 #define GL_INT8_VEC4_NV 0x8FE3 #define GL_INT16_NV 0x8FE4 #define GL_INT16_VEC2_NV 0x8FE5 #define GL_INT16_VEC3_NV 0x8FE6 #define GL_INT16_VEC4_NV 0x8FE7 #define GL_INT64_VEC2_NV 0x8FE9 #define GL_INT64_VEC3_NV 0x8FEA #define GL_INT64_VEC4_NV 0x8FEB #define GL_UNSIGNED_INT8_NV 0x8FEC #define GL_UNSIGNED_INT8_VEC2_NV 0x8FED #define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE #define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF #define GL_UNSIGNED_INT16_NV 0x8FF0 #define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1 #define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2 #define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3 #define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5 #define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6 #define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7 #define GL_FLOAT16_NV 0x8FF8 #define GL_FLOAT16_VEC2_NV 0x8FF9 #define GL_FLOAT16_VEC3_NV 0x8FFA #define GL_FLOAT16_VEC4_NV 0x8FFB typedef void (GLAPIENTRY * PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT* params); typedef void (GLAPIENTRY * PFNGLGETUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLuint64EXT* params); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT* value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value); typedef void (GLAPIENTRY * PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x); typedef void (GLAPIENTRY * PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT* value); typedef void (GLAPIENTRY * PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x); typedef void (GLAPIENTRY * PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value); typedef void (GLAPIENTRY * PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y); typedef void (GLAPIENTRY * PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT* value); typedef void (GLAPIENTRY * PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y); typedef void (GLAPIENTRY * PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value); typedef void (GLAPIENTRY * PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); typedef void (GLAPIENTRY * PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT* value); typedef void (GLAPIENTRY * PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); typedef void (GLAPIENTRY * PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value); typedef void (GLAPIENTRY * PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); typedef void (GLAPIENTRY * PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT* value); typedef void (GLAPIENTRY * PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); typedef void (GLAPIENTRY * PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value); #define glGetUniformi64vNV GLEW_GET_FUN(__glewGetUniformi64vNV) #define glGetUniformui64vNV GLEW_GET_FUN(__glewGetUniformui64vNV) #define glProgramUniform1i64NV GLEW_GET_FUN(__glewProgramUniform1i64NV) #define glProgramUniform1i64vNV GLEW_GET_FUN(__glewProgramUniform1i64vNV) #define glProgramUniform1ui64NV GLEW_GET_FUN(__glewProgramUniform1ui64NV) #define glProgramUniform1ui64vNV GLEW_GET_FUN(__glewProgramUniform1ui64vNV) #define glProgramUniform2i64NV GLEW_GET_FUN(__glewProgramUniform2i64NV) #define glProgramUniform2i64vNV GLEW_GET_FUN(__glewProgramUniform2i64vNV) #define glProgramUniform2ui64NV GLEW_GET_FUN(__glewProgramUniform2ui64NV) #define glProgramUniform2ui64vNV GLEW_GET_FUN(__glewProgramUniform2ui64vNV) #define glProgramUniform3i64NV GLEW_GET_FUN(__glewProgramUniform3i64NV) #define glProgramUniform3i64vNV GLEW_GET_FUN(__glewProgramUniform3i64vNV) #define glProgramUniform3ui64NV GLEW_GET_FUN(__glewProgramUniform3ui64NV) #define glProgramUniform3ui64vNV GLEW_GET_FUN(__glewProgramUniform3ui64vNV) #define glProgramUniform4i64NV GLEW_GET_FUN(__glewProgramUniform4i64NV) #define glProgramUniform4i64vNV GLEW_GET_FUN(__glewProgramUniform4i64vNV) #define glProgramUniform4ui64NV GLEW_GET_FUN(__glewProgramUniform4ui64NV) #define glProgramUniform4ui64vNV GLEW_GET_FUN(__glewProgramUniform4ui64vNV) #define glUniform1i64NV GLEW_GET_FUN(__glewUniform1i64NV) #define glUniform1i64vNV GLEW_GET_FUN(__glewUniform1i64vNV) #define glUniform1ui64NV GLEW_GET_FUN(__glewUniform1ui64NV) #define glUniform1ui64vNV GLEW_GET_FUN(__glewUniform1ui64vNV) #define glUniform2i64NV GLEW_GET_FUN(__glewUniform2i64NV) #define glUniform2i64vNV GLEW_GET_FUN(__glewUniform2i64vNV) #define glUniform2ui64NV GLEW_GET_FUN(__glewUniform2ui64NV) #define glUniform2ui64vNV GLEW_GET_FUN(__glewUniform2ui64vNV) #define glUniform3i64NV GLEW_GET_FUN(__glewUniform3i64NV) #define glUniform3i64vNV GLEW_GET_FUN(__glewUniform3i64vNV) #define glUniform3ui64NV GLEW_GET_FUN(__glewUniform3ui64NV) #define glUniform3ui64vNV GLEW_GET_FUN(__glewUniform3ui64vNV) #define glUniform4i64NV GLEW_GET_FUN(__glewUniform4i64NV) #define glUniform4i64vNV GLEW_GET_FUN(__glewUniform4i64vNV) #define glUniform4ui64NV GLEW_GET_FUN(__glewUniform4ui64NV) #define glUniform4ui64vNV GLEW_GET_FUN(__glewUniform4ui64vNV) #define GLEW_NV_gpu_shader5 GLEW_GET_VAR(__GLEW_NV_gpu_shader5) #endif /* GL_NV_gpu_shader5 */ /* ---------------------------- GL_NV_half_float --------------------------- */ #ifndef GL_NV_half_float #define GL_NV_half_float 1 #define GL_HALF_FLOAT_NV 0x140B typedef unsigned short GLhalf; typedef void (GLAPIENTRY * PFNGLCOLOR3HNVPROC) (GLhalf red, GLhalf green, GLhalf blue); typedef void (GLAPIENTRY * PFNGLCOLOR3HVNVPROC) (const GLhalf* v); typedef void (GLAPIENTRY * PFNGLCOLOR4HNVPROC) (GLhalf red, GLhalf green, GLhalf blue, GLhalf alpha); typedef void (GLAPIENTRY * PFNGLCOLOR4HVNVPROC) (const GLhalf* v); typedef void (GLAPIENTRY * PFNGLFOGCOORDHNVPROC) (GLhalf fog); typedef void (GLAPIENTRY * PFNGLFOGCOORDHVNVPROC) (const GLhalf* fog); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalf s); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalf* v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalf s, GLhalf t); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalf* v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalf s, GLhalf t, GLhalf r); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalf* v); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalf s, GLhalf t, GLhalf r, GLhalf q); typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalf* v); typedef void (GLAPIENTRY * PFNGLNORMAL3HNVPROC) (GLhalf nx, GLhalf ny, GLhalf nz); typedef void (GLAPIENTRY * PFNGLNORMAL3HVNVPROC) (const GLhalf* v); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3HNVPROC) (GLhalf red, GLhalf green, GLhalf blue); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalf* v); typedef void (GLAPIENTRY * PFNGLTEXCOORD1HNVPROC) (GLhalf s); typedef void (GLAPIENTRY * PFNGLTEXCOORD1HVNVPROC) (const GLhalf* v); typedef void (GLAPIENTRY * PFNGLTEXCOORD2HNVPROC) (GLhalf s, GLhalf t); typedef void (GLAPIENTRY * PFNGLTEXCOORD2HVNVPROC) (const GLhalf* v); typedef void (GLAPIENTRY * PFNGLTEXCOORD3HNVPROC) (GLhalf s, GLhalf t, GLhalf r); typedef void (GLAPIENTRY * PFNGLTEXCOORD3HVNVPROC) (const GLhalf* v); typedef void (GLAPIENTRY * PFNGLTEXCOORD4HNVPROC) (GLhalf s, GLhalf t, GLhalf r, GLhalf q); typedef void (GLAPIENTRY * PFNGLTEXCOORD4HVNVPROC) (const GLhalf* v); typedef void (GLAPIENTRY * PFNGLVERTEX2HNVPROC) (GLhalf x, GLhalf y); typedef void (GLAPIENTRY * PFNGLVERTEX2HVNVPROC) (const GLhalf* v); typedef void (GLAPIENTRY * PFNGLVERTEX3HNVPROC) (GLhalf x, GLhalf y, GLhalf z); typedef void (GLAPIENTRY * PFNGLVERTEX3HVNVPROC) (const GLhalf* v); typedef void (GLAPIENTRY * PFNGLVERTEX4HNVPROC) (GLhalf x, GLhalf y, GLhalf z, GLhalf w); typedef void (GLAPIENTRY * PFNGLVERTEX4HVNVPROC) (const GLhalf* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalf x); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalf* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalf x, GLhalf y); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalf* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalf x, GLhalf y, GLhalf z); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalf* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalf x, GLhalf y, GLhalf z, GLhalf w); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalf* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v); typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTHNVPROC) (GLhalf weight); typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalf* weight); #define glColor3hNV GLEW_GET_FUN(__glewColor3hNV) #define glColor3hvNV GLEW_GET_FUN(__glewColor3hvNV) #define glColor4hNV GLEW_GET_FUN(__glewColor4hNV) #define glColor4hvNV GLEW_GET_FUN(__glewColor4hvNV) #define glFogCoordhNV GLEW_GET_FUN(__glewFogCoordhNV) #define glFogCoordhvNV GLEW_GET_FUN(__glewFogCoordhvNV) #define glMultiTexCoord1hNV GLEW_GET_FUN(__glewMultiTexCoord1hNV) #define glMultiTexCoord1hvNV GLEW_GET_FUN(__glewMultiTexCoord1hvNV) #define glMultiTexCoord2hNV GLEW_GET_FUN(__glewMultiTexCoord2hNV) #define glMultiTexCoord2hvNV GLEW_GET_FUN(__glewMultiTexCoord2hvNV) #define glMultiTexCoord3hNV GLEW_GET_FUN(__glewMultiTexCoord3hNV) #define glMultiTexCoord3hvNV GLEW_GET_FUN(__glewMultiTexCoord3hvNV) #define glMultiTexCoord4hNV GLEW_GET_FUN(__glewMultiTexCoord4hNV) #define glMultiTexCoord4hvNV GLEW_GET_FUN(__glewMultiTexCoord4hvNV) #define glNormal3hNV GLEW_GET_FUN(__glewNormal3hNV) #define glNormal3hvNV GLEW_GET_FUN(__glewNormal3hvNV) #define glSecondaryColor3hNV GLEW_GET_FUN(__glewSecondaryColor3hNV) #define glSecondaryColor3hvNV GLEW_GET_FUN(__glewSecondaryColor3hvNV) #define glTexCoord1hNV GLEW_GET_FUN(__glewTexCoord1hNV) #define glTexCoord1hvNV GLEW_GET_FUN(__glewTexCoord1hvNV) #define glTexCoord2hNV GLEW_GET_FUN(__glewTexCoord2hNV) #define glTexCoord2hvNV GLEW_GET_FUN(__glewTexCoord2hvNV) #define glTexCoord3hNV GLEW_GET_FUN(__glewTexCoord3hNV) #define glTexCoord3hvNV GLEW_GET_FUN(__glewTexCoord3hvNV) #define glTexCoord4hNV GLEW_GET_FUN(__glewTexCoord4hNV) #define glTexCoord4hvNV GLEW_GET_FUN(__glewTexCoord4hvNV) #define glVertex2hNV GLEW_GET_FUN(__glewVertex2hNV) #define glVertex2hvNV GLEW_GET_FUN(__glewVertex2hvNV) #define glVertex3hNV GLEW_GET_FUN(__glewVertex3hNV) #define glVertex3hvNV GLEW_GET_FUN(__glewVertex3hvNV) #define glVertex4hNV GLEW_GET_FUN(__glewVertex4hNV) #define glVertex4hvNV GLEW_GET_FUN(__glewVertex4hvNV) #define glVertexAttrib1hNV GLEW_GET_FUN(__glewVertexAttrib1hNV) #define glVertexAttrib1hvNV GLEW_GET_FUN(__glewVertexAttrib1hvNV) #define glVertexAttrib2hNV GLEW_GET_FUN(__glewVertexAttrib2hNV) #define glVertexAttrib2hvNV GLEW_GET_FUN(__glewVertexAttrib2hvNV) #define glVertexAttrib3hNV GLEW_GET_FUN(__glewVertexAttrib3hNV) #define glVertexAttrib3hvNV GLEW_GET_FUN(__glewVertexAttrib3hvNV) #define glVertexAttrib4hNV GLEW_GET_FUN(__glewVertexAttrib4hNV) #define glVertexAttrib4hvNV GLEW_GET_FUN(__glewVertexAttrib4hvNV) #define glVertexAttribs1hvNV GLEW_GET_FUN(__glewVertexAttribs1hvNV) #define glVertexAttribs2hvNV GLEW_GET_FUN(__glewVertexAttribs2hvNV) #define glVertexAttribs3hvNV GLEW_GET_FUN(__glewVertexAttribs3hvNV) #define glVertexAttribs4hvNV GLEW_GET_FUN(__glewVertexAttribs4hvNV) #define glVertexWeighthNV GLEW_GET_FUN(__glewVertexWeighthNV) #define glVertexWeighthvNV GLEW_GET_FUN(__glewVertexWeighthvNV) #define GLEW_NV_half_float GLEW_GET_VAR(__GLEW_NV_half_float) #endif /* GL_NV_half_float */ /* ------------------------ GL_NV_light_max_exponent ----------------------- */ #ifndef GL_NV_light_max_exponent #define GL_NV_light_max_exponent 1 #define GL_MAX_SHININESS_NV 0x8504 #define GL_MAX_SPOT_EXPONENT_NV 0x8505 #define GLEW_NV_light_max_exponent GLEW_GET_VAR(__GLEW_NV_light_max_exponent) #endif /* GL_NV_light_max_exponent */ /* ----------------------- GL_NV_multisample_coverage ---------------------- */ #ifndef GL_NV_multisample_coverage #define GL_NV_multisample_coverage 1 #define GL_COVERAGE_SAMPLES_NV 0x80A9 #define GL_COLOR_SAMPLES_NV 0x8E20 #define GLEW_NV_multisample_coverage GLEW_GET_VAR(__GLEW_NV_multisample_coverage) #endif /* GL_NV_multisample_coverage */ /* --------------------- GL_NV_multisample_filter_hint --------------------- */ #ifndef GL_NV_multisample_filter_hint #define GL_NV_multisample_filter_hint 1 #define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 #define GLEW_NV_multisample_filter_hint GLEW_GET_VAR(__GLEW_NV_multisample_filter_hint) #endif /* GL_NV_multisample_filter_hint */ /* ------------------------- GL_NV_occlusion_query ------------------------- */ #ifndef GL_NV_occlusion_query #define GL_NV_occlusion_query 1 #define GL_PIXEL_COUNTER_BITS_NV 0x8864 #define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 #define GL_PIXEL_COUNT_NV 0x8866 #define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 typedef void (GLAPIENTRY * PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id); typedef void (GLAPIENTRY * PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint* ids); typedef void (GLAPIENTRY * PFNGLENDOCCLUSIONQUERYNVPROC) (void); typedef void (GLAPIENTRY * PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint* ids); typedef void (GLAPIENTRY * PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint* params); typedef GLboolean (GLAPIENTRY * PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id); #define glBeginOcclusionQueryNV GLEW_GET_FUN(__glewBeginOcclusionQueryNV) #define glDeleteOcclusionQueriesNV GLEW_GET_FUN(__glewDeleteOcclusionQueriesNV) #define glEndOcclusionQueryNV GLEW_GET_FUN(__glewEndOcclusionQueryNV) #define glGenOcclusionQueriesNV GLEW_GET_FUN(__glewGenOcclusionQueriesNV) #define glGetOcclusionQueryivNV GLEW_GET_FUN(__glewGetOcclusionQueryivNV) #define glGetOcclusionQueryuivNV GLEW_GET_FUN(__glewGetOcclusionQueryuivNV) #define glIsOcclusionQueryNV GLEW_GET_FUN(__glewIsOcclusionQueryNV) #define GLEW_NV_occlusion_query GLEW_GET_VAR(__GLEW_NV_occlusion_query) #endif /* GL_NV_occlusion_query */ /* ----------------------- GL_NV_packed_depth_stencil ---------------------- */ #ifndef GL_NV_packed_depth_stencil #define GL_NV_packed_depth_stencil 1 #define GL_DEPTH_STENCIL_NV 0x84F9 #define GL_UNSIGNED_INT_24_8_NV 0x84FA #define GLEW_NV_packed_depth_stencil GLEW_GET_VAR(__GLEW_NV_packed_depth_stencil) #endif /* GL_NV_packed_depth_stencil */ /* --------------------- GL_NV_parameter_buffer_object --------------------- */ #ifndef GL_NV_parameter_buffer_object #define GL_NV_parameter_buffer_object 1 #define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0 #define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1 #define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2 #define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3 #define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4 typedef void (GLAPIENTRY * PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLint *params); typedef void (GLAPIENTRY * PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLuint *params); typedef void (GLAPIENTRY * PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLfloat *params); #define glProgramBufferParametersIivNV GLEW_GET_FUN(__glewProgramBufferParametersIivNV) #define glProgramBufferParametersIuivNV GLEW_GET_FUN(__glewProgramBufferParametersIuivNV) #define glProgramBufferParametersfvNV GLEW_GET_FUN(__glewProgramBufferParametersfvNV) #define GLEW_NV_parameter_buffer_object GLEW_GET_VAR(__GLEW_NV_parameter_buffer_object) #endif /* GL_NV_parameter_buffer_object */ /* --------------------- GL_NV_parameter_buffer_object2 -------------------- */ #ifndef GL_NV_parameter_buffer_object2 #define GL_NV_parameter_buffer_object2 1 #define GLEW_NV_parameter_buffer_object2 GLEW_GET_VAR(__GLEW_NV_parameter_buffer_object2) #endif /* GL_NV_parameter_buffer_object2 */ /* -------------------------- GL_NV_path_rendering ------------------------- */ #ifndef GL_NV_path_rendering #define GL_NV_path_rendering 1 #define GL_CLOSE_PATH_NV 0x00 #define GL_BOLD_BIT_NV 0x01 #define GL_GLYPH_WIDTH_BIT_NV 0x01 #define GL_GLYPH_HEIGHT_BIT_NV 0x02 #define GL_ITALIC_BIT_NV 0x02 #define GL_MOVE_TO_NV 0x02 #define GL_RELATIVE_MOVE_TO_NV 0x03 #define GL_LINE_TO_NV 0x04 #define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04 #define GL_RELATIVE_LINE_TO_NV 0x05 #define GL_HORIZONTAL_LINE_TO_NV 0x06 #define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07 #define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08 #define GL_VERTICAL_LINE_TO_NV 0x08 #define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09 #define GL_QUADRATIC_CURVE_TO_NV 0x0A #define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B #define GL_CUBIC_CURVE_TO_NV 0x0C #define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D #define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E #define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F #define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10 #define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10 #define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11 #define GL_SMALL_CCW_ARC_TO_NV 0x12 #define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13 #define GL_SMALL_CW_ARC_TO_NV 0x14 #define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15 #define GL_LARGE_CCW_ARC_TO_NV 0x16 #define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17 #define GL_LARGE_CW_ARC_TO_NV 0x18 #define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19 #define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20 #define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40 #define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80 #define GL_RESTART_PATH_NV 0xF0 #define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2 #define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4 #define GL_RECT_NV 0xF6 #define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8 #define GL_CIRCULAR_CW_ARC_TO_NV 0xFA #define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC #define GL_ARC_TO_NV 0xFE #define GL_RELATIVE_ARC_TO_NV 0xFF #define GL_GLYPH_HAS_KERNING_BIT_NV 0x100 #define GL_PRIMARY_COLOR_NV 0x852C #define GL_SECONDARY_COLOR_NV 0x852D #define GL_PRIMARY_COLOR 0x8577 #define GL_PATH_FORMAT_SVG_NV 0x9070 #define GL_PATH_FORMAT_PS_NV 0x9071 #define GL_STANDARD_FONT_NAME_NV 0x9072 #define GL_SYSTEM_FONT_NAME_NV 0x9073 #define GL_FILE_NAME_NV 0x9074 #define GL_PATH_STROKE_WIDTH_NV 0x9075 #define GL_PATH_END_CAPS_NV 0x9076 #define GL_PATH_INITIAL_END_CAP_NV 0x9077 #define GL_PATH_TERMINAL_END_CAP_NV 0x9078 #define GL_PATH_JOIN_STYLE_NV 0x9079 #define GL_PATH_MITER_LIMIT_NV 0x907A #define GL_PATH_DASH_CAPS_NV 0x907B #define GL_PATH_INITIAL_DASH_CAP_NV 0x907C #define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D #define GL_PATH_DASH_OFFSET_NV 0x907E #define GL_PATH_CLIENT_LENGTH_NV 0x907F #define GL_PATH_FILL_MODE_NV 0x9080 #define GL_PATH_FILL_MASK_NV 0x9081 #define GL_PATH_FILL_COVER_MODE_NV 0x9082 #define GL_PATH_STROKE_COVER_MODE_NV 0x9083 #define GL_PATH_STROKE_MASK_NV 0x9084 #define GL_COUNT_UP_NV 0x9088 #define GL_COUNT_DOWN_NV 0x9089 #define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A #define GL_CONVEX_HULL_NV 0x908B #define GL_BOUNDING_BOX_NV 0x908D #define GL_TRANSLATE_X_NV 0x908E #define GL_TRANSLATE_Y_NV 0x908F #define GL_TRANSLATE_2D_NV 0x9090 #define GL_TRANSLATE_3D_NV 0x9091 #define GL_AFFINE_2D_NV 0x9092 #define GL_AFFINE_3D_NV 0x9094 #define GL_TRANSPOSE_AFFINE_2D_NV 0x9096 #define GL_TRANSPOSE_AFFINE_3D_NV 0x9098 #define GL_UTF8_NV 0x909A #define GL_UTF16_NV 0x909B #define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C #define GL_PATH_COMMAND_COUNT_NV 0x909D #define GL_PATH_COORD_COUNT_NV 0x909E #define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F #define GL_PATH_COMPUTED_LENGTH_NV 0x90A0 #define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1 #define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2 #define GL_SQUARE_NV 0x90A3 #define GL_ROUND_NV 0x90A4 #define GL_TRIANGULAR_NV 0x90A5 #define GL_BEVEL_NV 0x90A6 #define GL_MITER_REVERT_NV 0x90A7 #define GL_MITER_TRUNCATE_NV 0x90A8 #define GL_SKIP_MISSING_GLYPH_NV 0x90A9 #define GL_USE_MISSING_GLYPH_NV 0x90AA #define GL_PATH_ERROR_POSITION_NV 0x90AB #define GL_PATH_FOG_GEN_MODE_NV 0x90AC #define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD #define GL_ADJACENT_PAIRS_NV 0x90AE #define GL_FIRST_TO_REST_NV 0x90AF #define GL_PATH_GEN_MODE_NV 0x90B0 #define GL_PATH_GEN_COEFF_NV 0x90B1 #define GL_PATH_GEN_COLOR_FORMAT_NV 0x90B2 #define GL_PATH_GEN_COMPONENTS_NV 0x90B3 #define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4 #define GL_MOVE_TO_RESETS_NV 0x90B5 #define GL_MOVE_TO_CONTINUES_NV 0x90B6 #define GL_PATH_STENCIL_FUNC_NV 0x90B7 #define GL_PATH_STENCIL_REF_NV 0x90B8 #define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9 #define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD #define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE #define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF #define GL_FONT_X_MIN_BOUNDS_BIT_NV 0x00010000 #define GL_FONT_Y_MIN_BOUNDS_BIT_NV 0x00020000 #define GL_FONT_X_MAX_BOUNDS_BIT_NV 0x00040000 #define GL_FONT_Y_MAX_BOUNDS_BIT_NV 0x00080000 #define GL_FONT_UNITS_PER_EM_BIT_NV 0x00100000 #define GL_FONT_ASCENDER_BIT_NV 0x00200000 #define GL_FONT_DESCENDER_BIT_NV 0x00400000 #define GL_FONT_HEIGHT_BIT_NV 0x00800000 #define GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV 0x01000000 #define GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV 0x02000000 #define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000 #define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000 #define GL_FONT_HAS_KERNING_BIT_NV 0x10000000 typedef void (GLAPIENTRY * PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath); typedef void (GLAPIENTRY * PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); typedef void (GLAPIENTRY * PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode); typedef void (GLAPIENTRY * PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); typedef void (GLAPIENTRY * PFNGLCOVERSTROKEPATHNVPROC) (GLuint name, GLenum coverMode); typedef void (GLAPIENTRY * PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range); typedef GLuint (GLAPIENTRY * PFNGLGENPATHSNVPROC) (GLsizei range); typedef void (GLAPIENTRY * PFNGLGETPATHCOLORGENFVNVPROC) (GLenum color, GLenum pname, GLfloat* value); typedef void (GLAPIENTRY * PFNGLGETPATHCOLORGENIVNVPROC) (GLenum color, GLenum pname, GLint* value); typedef void (GLAPIENTRY * PFNGLGETPATHCOMMANDSNVPROC) (GLuint name, GLubyte* commands); typedef void (GLAPIENTRY * PFNGLGETPATHCOORDSNVPROC) (GLuint name, GLfloat* coords); typedef void (GLAPIENTRY * PFNGLGETPATHDASHARRAYNVPROC) (GLuint name, GLfloat* dashArray); typedef GLfloat (GLAPIENTRY * PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments); typedef void (GLAPIENTRY * PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint fistPathName, GLsizei numPaths, GLsizei stride, GLfloat* metrics); typedef void (GLAPIENTRY * PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); typedef void (GLAPIENTRY * PFNGLGETPATHPARAMETERFVNVPROC) (GLuint name, GLenum param, GLfloat* value); typedef void (GLAPIENTRY * PFNGLGETPATHPARAMETERIVNVPROC) (GLuint name, GLenum param, GLint* value); typedef void (GLAPIENTRY * PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); typedef void (GLAPIENTRY * PFNGLGETPATHTEXGENFVNVPROC) (GLenum texCoordSet, GLenum pname, GLfloat* value); typedef void (GLAPIENTRY * PFNGLGETPATHTEXGENIVNVPROC) (GLenum texCoordSet, GLenum pname, GLint* value); typedef void (GLAPIENTRY * PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight); typedef GLboolean (GLAPIENTRY * PFNGLISPATHNVPROC) (GLuint path); typedef GLboolean (GLAPIENTRY * PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y); typedef GLboolean (GLAPIENTRY * PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y); typedef void (GLAPIENTRY * PFNGLPATHCOLORGENNVPROC) (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat* coeffs); typedef void (GLAPIENTRY * PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte* commands, GLsizei numCoords, GLenum coordType, const GLvoid*coords); typedef void (GLAPIENTRY * PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const void* coords); typedef void (GLAPIENTRY * PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum zfunc); typedef void (GLAPIENTRY * PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat* dashArray); typedef void (GLAPIENTRY * PFNGLPATHFOGGENNVPROC) (GLenum genMode); typedef void (GLAPIENTRY * PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const void* fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); typedef void (GLAPIENTRY * PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const void* fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const GLvoid*charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); typedef void (GLAPIENTRY * PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value); typedef void (GLAPIENTRY * PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value); typedef void (GLAPIENTRY * PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint* value); typedef void (GLAPIENTRY * PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units); typedef void (GLAPIENTRY * PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask); typedef void (GLAPIENTRY * PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const void* pathString); typedef void (GLAPIENTRY * PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte* commands, GLsizei numCoords, GLenum coordType, const GLvoid*coords); typedef void (GLAPIENTRY * PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void* coords); typedef void (GLAPIENTRY * PFNGLPATHTEXGENNVPROC) (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat* coeffs); typedef GLboolean (GLAPIENTRY * PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat* x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); typedef void (GLAPIENTRY * PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); typedef void (GLAPIENTRY * PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask); typedef void (GLAPIENTRY * PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void* paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); typedef void (GLAPIENTRY * PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask); typedef void (GLAPIENTRY * PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat* transformValues); typedef void (GLAPIENTRY * PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint paths[], const GLfloat weights[]); #define glCopyPathNV GLEW_GET_FUN(__glewCopyPathNV) #define glCoverFillPathInstancedNV GLEW_GET_FUN(__glewCoverFillPathInstancedNV) #define glCoverFillPathNV GLEW_GET_FUN(__glewCoverFillPathNV) #define glCoverStrokePathInstancedNV GLEW_GET_FUN(__glewCoverStrokePathInstancedNV) #define glCoverStrokePathNV GLEW_GET_FUN(__glewCoverStrokePathNV) #define glDeletePathsNV GLEW_GET_FUN(__glewDeletePathsNV) #define glGenPathsNV GLEW_GET_FUN(__glewGenPathsNV) #define glGetPathColorGenfvNV GLEW_GET_FUN(__glewGetPathColorGenfvNV) #define glGetPathColorGenivNV GLEW_GET_FUN(__glewGetPathColorGenivNV) #define glGetPathCommandsNV GLEW_GET_FUN(__glewGetPathCommandsNV) #define glGetPathCoordsNV GLEW_GET_FUN(__glewGetPathCoordsNV) #define glGetPathDashArrayNV GLEW_GET_FUN(__glewGetPathDashArrayNV) #define glGetPathLengthNV GLEW_GET_FUN(__glewGetPathLengthNV) #define glGetPathMetricRangeNV GLEW_GET_FUN(__glewGetPathMetricRangeNV) #define glGetPathMetricsNV GLEW_GET_FUN(__glewGetPathMetricsNV) #define glGetPathParameterfvNV GLEW_GET_FUN(__glewGetPathParameterfvNV) #define glGetPathParameterivNV GLEW_GET_FUN(__glewGetPathParameterivNV) #define glGetPathSpacingNV GLEW_GET_FUN(__glewGetPathSpacingNV) #define glGetPathTexGenfvNV GLEW_GET_FUN(__glewGetPathTexGenfvNV) #define glGetPathTexGenivNV GLEW_GET_FUN(__glewGetPathTexGenivNV) #define glInterpolatePathsNV GLEW_GET_FUN(__glewInterpolatePathsNV) #define glIsPathNV GLEW_GET_FUN(__glewIsPathNV) #define glIsPointInFillPathNV GLEW_GET_FUN(__glewIsPointInFillPathNV) #define glIsPointInStrokePathNV GLEW_GET_FUN(__glewIsPointInStrokePathNV) #define glPathColorGenNV GLEW_GET_FUN(__glewPathColorGenNV) #define glPathCommandsNV GLEW_GET_FUN(__glewPathCommandsNV) #define glPathCoordsNV GLEW_GET_FUN(__glewPathCoordsNV) #define glPathCoverDepthFuncNV GLEW_GET_FUN(__glewPathCoverDepthFuncNV) #define glPathDashArrayNV GLEW_GET_FUN(__glewPathDashArrayNV) #define glPathFogGenNV GLEW_GET_FUN(__glewPathFogGenNV) #define glPathGlyphRangeNV GLEW_GET_FUN(__glewPathGlyphRangeNV) #define glPathGlyphsNV GLEW_GET_FUN(__glewPathGlyphsNV) #define glPathParameterfNV GLEW_GET_FUN(__glewPathParameterfNV) #define glPathParameterfvNV GLEW_GET_FUN(__glewPathParameterfvNV) #define glPathParameteriNV GLEW_GET_FUN(__glewPathParameteriNV) #define glPathParameterivNV GLEW_GET_FUN(__glewPathParameterivNV) #define glPathStencilDepthOffsetNV GLEW_GET_FUN(__glewPathStencilDepthOffsetNV) #define glPathStencilFuncNV GLEW_GET_FUN(__glewPathStencilFuncNV) #define glPathStringNV GLEW_GET_FUN(__glewPathStringNV) #define glPathSubCommandsNV GLEW_GET_FUN(__glewPathSubCommandsNV) #define glPathSubCoordsNV GLEW_GET_FUN(__glewPathSubCoordsNV) #define glPathTexGenNV GLEW_GET_FUN(__glewPathTexGenNV) #define glPointAlongPathNV GLEW_GET_FUN(__glewPointAlongPathNV) #define glStencilFillPathInstancedNV GLEW_GET_FUN(__glewStencilFillPathInstancedNV) #define glStencilFillPathNV GLEW_GET_FUN(__glewStencilFillPathNV) #define glStencilStrokePathInstancedNV GLEW_GET_FUN(__glewStencilStrokePathInstancedNV) #define glStencilStrokePathNV GLEW_GET_FUN(__glewStencilStrokePathNV) #define glTransformPathNV GLEW_GET_FUN(__glewTransformPathNV) #define glWeightPathsNV GLEW_GET_FUN(__glewWeightPathsNV) #define GLEW_NV_path_rendering GLEW_GET_VAR(__GLEW_NV_path_rendering) #endif /* GL_NV_path_rendering */ /* ------------------------- GL_NV_pixel_data_range ------------------------ */ #ifndef GL_NV_pixel_data_range #define GL_NV_pixel_data_range 1 #define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 #define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 #define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A #define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B #define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C #define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D typedef void (GLAPIENTRY * PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target); typedef void (GLAPIENTRY * PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, void* pointer); #define glFlushPixelDataRangeNV GLEW_GET_FUN(__glewFlushPixelDataRangeNV) #define glPixelDataRangeNV GLEW_GET_FUN(__glewPixelDataRangeNV) #define GLEW_NV_pixel_data_range GLEW_GET_VAR(__GLEW_NV_pixel_data_range) #endif /* GL_NV_pixel_data_range */ /* --------------------------- GL_NV_point_sprite -------------------------- */ #ifndef GL_NV_point_sprite #define GL_NV_point_sprite 1 #define GL_POINT_SPRITE_NV 0x8861 #define GL_COORD_REPLACE_NV 0x8862 #define GL_POINT_SPRITE_R_MODE_NV 0x8863 typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param); typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint* params); #define glPointParameteriNV GLEW_GET_FUN(__glewPointParameteriNV) #define glPointParameterivNV GLEW_GET_FUN(__glewPointParameterivNV) #define GLEW_NV_point_sprite GLEW_GET_VAR(__GLEW_NV_point_sprite) #endif /* GL_NV_point_sprite */ /* -------------------------- GL_NV_present_video -------------------------- */ #ifndef GL_NV_present_video #define GL_NV_present_video 1 #define GL_FRAME_NV 0x8E26 #define GL_FIELDS_NV 0x8E27 #define GL_CURRENT_TIME_NV 0x8E28 #define GL_NUM_FILL_STREAMS_NV 0x8E29 #define GL_PRESENT_TIME_NV 0x8E2A #define GL_PRESENT_DURATION_NV 0x8E2B typedef void (GLAPIENTRY * PFNGLGETVIDEOI64VNVPROC) (GLuint video_slot, GLenum pname, GLint64EXT* params); typedef void (GLAPIENTRY * PFNGLGETVIDEOIVNVPROC) (GLuint video_slot, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETVIDEOUI64VNVPROC) (GLuint video_slot, GLenum pname, GLuint64EXT* params); typedef void (GLAPIENTRY * PFNGLGETVIDEOUIVNVPROC) (GLuint video_slot, GLenum pname, GLuint* params); typedef void (GLAPIENTRY * PFNGLPRESENTFRAMEDUALFILLNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3); typedef void (GLAPIENTRY * PFNGLPRESENTFRAMEKEYEDNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1); #define glGetVideoi64vNV GLEW_GET_FUN(__glewGetVideoi64vNV) #define glGetVideoivNV GLEW_GET_FUN(__glewGetVideoivNV) #define glGetVideoui64vNV GLEW_GET_FUN(__glewGetVideoui64vNV) #define glGetVideouivNV GLEW_GET_FUN(__glewGetVideouivNV) #define glPresentFrameDualFillNV GLEW_GET_FUN(__glewPresentFrameDualFillNV) #define glPresentFrameKeyedNV GLEW_GET_FUN(__glewPresentFrameKeyedNV) #define GLEW_NV_present_video GLEW_GET_VAR(__GLEW_NV_present_video) #endif /* GL_NV_present_video */ /* ------------------------ GL_NV_primitive_restart ------------------------ */ #ifndef GL_NV_primitive_restart #define GL_NV_primitive_restart 1 #define GL_PRIMITIVE_RESTART_NV 0x8558 #define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 typedef void (GLAPIENTRY * PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index); typedef void (GLAPIENTRY * PFNGLPRIMITIVERESTARTNVPROC) (void); #define glPrimitiveRestartIndexNV GLEW_GET_FUN(__glewPrimitiveRestartIndexNV) #define glPrimitiveRestartNV GLEW_GET_FUN(__glewPrimitiveRestartNV) #define GLEW_NV_primitive_restart GLEW_GET_VAR(__GLEW_NV_primitive_restart) #endif /* GL_NV_primitive_restart */ /* ------------------------ GL_NV_register_combiners ----------------------- */ #ifndef GL_NV_register_combiners #define GL_NV_register_combiners 1 #define GL_REGISTER_COMBINERS_NV 0x8522 #define GL_VARIABLE_A_NV 0x8523 #define GL_VARIABLE_B_NV 0x8524 #define GL_VARIABLE_C_NV 0x8525 #define GL_VARIABLE_D_NV 0x8526 #define GL_VARIABLE_E_NV 0x8527 #define GL_VARIABLE_F_NV 0x8528 #define GL_VARIABLE_G_NV 0x8529 #define GL_CONSTANT_COLOR0_NV 0x852A #define GL_CONSTANT_COLOR1_NV 0x852B #define GL_PRIMARY_COLOR_NV 0x852C #define GL_SECONDARY_COLOR_NV 0x852D #define GL_SPARE0_NV 0x852E #define GL_SPARE1_NV 0x852F #define GL_DISCARD_NV 0x8530 #define GL_E_TIMES_F_NV 0x8531 #define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 #define GL_UNSIGNED_IDENTITY_NV 0x8536 #define GL_UNSIGNED_INVERT_NV 0x8537 #define GL_EXPAND_NORMAL_NV 0x8538 #define GL_EXPAND_NEGATE_NV 0x8539 #define GL_HALF_BIAS_NORMAL_NV 0x853A #define GL_HALF_BIAS_NEGATE_NV 0x853B #define GL_SIGNED_IDENTITY_NV 0x853C #define GL_SIGNED_NEGATE_NV 0x853D #define GL_SCALE_BY_TWO_NV 0x853E #define GL_SCALE_BY_FOUR_NV 0x853F #define GL_SCALE_BY_ONE_HALF_NV 0x8540 #define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 #define GL_COMBINER_INPUT_NV 0x8542 #define GL_COMBINER_MAPPING_NV 0x8543 #define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 #define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 #define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 #define GL_COMBINER_MUX_SUM_NV 0x8547 #define GL_COMBINER_SCALE_NV 0x8548 #define GL_COMBINER_BIAS_NV 0x8549 #define GL_COMBINER_AB_OUTPUT_NV 0x854A #define GL_COMBINER_CD_OUTPUT_NV 0x854B #define GL_COMBINER_SUM_OUTPUT_NV 0x854C #define GL_MAX_GENERAL_COMBINERS_NV 0x854D #define GL_NUM_GENERAL_COMBINERS_NV 0x854E #define GL_COLOR_SUM_CLAMP_NV 0x854F #define GL_COMBINER0_NV 0x8550 #define GL_COMBINER1_NV 0x8551 #define GL_COMBINER2_NV 0x8552 #define GL_COMBINER3_NV 0x8553 #define GL_COMBINER4_NV 0x8554 #define GL_COMBINER5_NV 0x8555 #define GL_COMBINER6_NV 0x8556 #define GL_COMBINER7_NV 0x8557 typedef void (GLAPIENTRY * PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); typedef void (GLAPIENTRY * PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); typedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param); typedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); typedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint* params); typedef void (GLAPIENTRY * PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); typedef void (GLAPIENTRY * PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint* params); #define glCombinerInputNV GLEW_GET_FUN(__glewCombinerInputNV) #define glCombinerOutputNV GLEW_GET_FUN(__glewCombinerOutputNV) #define glCombinerParameterfNV GLEW_GET_FUN(__glewCombinerParameterfNV) #define glCombinerParameterfvNV GLEW_GET_FUN(__glewCombinerParameterfvNV) #define glCombinerParameteriNV GLEW_GET_FUN(__glewCombinerParameteriNV) #define glCombinerParameterivNV GLEW_GET_FUN(__glewCombinerParameterivNV) #define glFinalCombinerInputNV GLEW_GET_FUN(__glewFinalCombinerInputNV) #define glGetCombinerInputParameterfvNV GLEW_GET_FUN(__glewGetCombinerInputParameterfvNV) #define glGetCombinerInputParameterivNV GLEW_GET_FUN(__glewGetCombinerInputParameterivNV) #define glGetCombinerOutputParameterfvNV GLEW_GET_FUN(__glewGetCombinerOutputParameterfvNV) #define glGetCombinerOutputParameterivNV GLEW_GET_FUN(__glewGetCombinerOutputParameterivNV) #define glGetFinalCombinerInputParameterfvNV GLEW_GET_FUN(__glewGetFinalCombinerInputParameterfvNV) #define glGetFinalCombinerInputParameterivNV GLEW_GET_FUN(__glewGetFinalCombinerInputParameterivNV) #define GLEW_NV_register_combiners GLEW_GET_VAR(__GLEW_NV_register_combiners) #endif /* GL_NV_register_combiners */ /* ----------------------- GL_NV_register_combiners2 ----------------------- */ #ifndef GL_NV_register_combiners2 #define GL_NV_register_combiners2 1 #define GL_PER_STAGE_CONSTANTS_NV 0x8535 typedef void (GLAPIENTRY * PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat* params); #define glCombinerStageParameterfvNV GLEW_GET_FUN(__glewCombinerStageParameterfvNV) #define glGetCombinerStageParameterfvNV GLEW_GET_FUN(__glewGetCombinerStageParameterfvNV) #define GLEW_NV_register_combiners2 GLEW_GET_VAR(__GLEW_NV_register_combiners2) #endif /* GL_NV_register_combiners2 */ /* ----------------------- GL_NV_shader_atomic_float ----------------------- */ #ifndef GL_NV_shader_atomic_float #define GL_NV_shader_atomic_float 1 #define GLEW_NV_shader_atomic_float GLEW_GET_VAR(__GLEW_NV_shader_atomic_float) #endif /* GL_NV_shader_atomic_float */ /* ------------------------ GL_NV_shader_buffer_load ----------------------- */ #ifndef GL_NV_shader_buffer_load #define GL_NV_shader_buffer_load 1 #define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D #define GL_GPU_ADDRESS_NV 0x8F34 #define GL_MAX_SHADER_BUFFER_ADDRESS_NV 0x8F35 typedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERUI64VNVPROC) (GLenum target, GLenum pname, GLuint64EXT* params); typedef void (GLAPIENTRY * PFNGLGETINTEGERUI64VNVPROC) (GLenum value, GLuint64EXT* result); typedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC) (GLuint buffer, GLenum pname, GLuint64EXT* params); typedef GLboolean (GLAPIENTRY * PFNGLISBUFFERRESIDENTNVPROC) (GLenum target); typedef GLboolean (GLAPIENTRY * PFNGLISNAMEDBUFFERRESIDENTNVPROC) (GLuint buffer); typedef void (GLAPIENTRY * PFNGLMAKEBUFFERNONRESIDENTNVPROC) (GLenum target); typedef void (GLAPIENTRY * PFNGLMAKEBUFFERRESIDENTNVPROC) (GLenum target, GLenum access); typedef void (GLAPIENTRY * PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC) (GLuint buffer); typedef void (GLAPIENTRY * PFNGLMAKENAMEDBUFFERRESIDENTNVPROC) (GLuint buffer, GLenum access); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMUI64NVPROC) (GLuint program, GLint location, GLuint64EXT value); typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value); typedef void (GLAPIENTRY * PFNGLUNIFORMUI64NVPROC) (GLint location, GLuint64EXT value); typedef void (GLAPIENTRY * PFNGLUNIFORMUI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value); #define glGetBufferParameterui64vNV GLEW_GET_FUN(__glewGetBufferParameterui64vNV) #define glGetIntegerui64vNV GLEW_GET_FUN(__glewGetIntegerui64vNV) #define glGetNamedBufferParameterui64vNV GLEW_GET_FUN(__glewGetNamedBufferParameterui64vNV) #define glIsBufferResidentNV GLEW_GET_FUN(__glewIsBufferResidentNV) #define glIsNamedBufferResidentNV GLEW_GET_FUN(__glewIsNamedBufferResidentNV) #define glMakeBufferNonResidentNV GLEW_GET_FUN(__glewMakeBufferNonResidentNV) #define glMakeBufferResidentNV GLEW_GET_FUN(__glewMakeBufferResidentNV) #define glMakeNamedBufferNonResidentNV GLEW_GET_FUN(__glewMakeNamedBufferNonResidentNV) #define glMakeNamedBufferResidentNV GLEW_GET_FUN(__glewMakeNamedBufferResidentNV) #define glProgramUniformui64NV GLEW_GET_FUN(__glewProgramUniformui64NV) #define glProgramUniformui64vNV GLEW_GET_FUN(__glewProgramUniformui64vNV) #define glUniformui64NV GLEW_GET_FUN(__glewUniformui64NV) #define glUniformui64vNV GLEW_GET_FUN(__glewUniformui64vNV) #define GLEW_NV_shader_buffer_load GLEW_GET_VAR(__GLEW_NV_shader_buffer_load) #endif /* GL_NV_shader_buffer_load */ /* ---------------------- GL_NV_tessellation_program5 ---------------------- */ #ifndef GL_NV_tessellation_program5 #define GL_NV_tessellation_program5 1 #define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV 0x86D8 #define GL_TESS_CONTROL_PROGRAM_NV 0x891E #define GL_TESS_EVALUATION_PROGRAM_NV 0x891F #define GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV 0x8C74 #define GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV 0x8C75 #define GLEW_NV_tessellation_program5 GLEW_GET_VAR(__GLEW_NV_tessellation_program5) #endif /* GL_NV_tessellation_program5 */ /* -------------------------- GL_NV_texgen_emboss -------------------------- */ #ifndef GL_NV_texgen_emboss #define GL_NV_texgen_emboss 1 #define GL_EMBOSS_LIGHT_NV 0x855D #define GL_EMBOSS_CONSTANT_NV 0x855E #define GL_EMBOSS_MAP_NV 0x855F #define GLEW_NV_texgen_emboss GLEW_GET_VAR(__GLEW_NV_texgen_emboss) #endif /* GL_NV_texgen_emboss */ /* ------------------------ GL_NV_texgen_reflection ------------------------ */ #ifndef GL_NV_texgen_reflection #define GL_NV_texgen_reflection 1 #define GL_NORMAL_MAP_NV 0x8511 #define GL_REFLECTION_MAP_NV 0x8512 #define GLEW_NV_texgen_reflection GLEW_GET_VAR(__GLEW_NV_texgen_reflection) #endif /* GL_NV_texgen_reflection */ /* ------------------------- GL_NV_texture_barrier ------------------------- */ #ifndef GL_NV_texture_barrier #define GL_NV_texture_barrier 1 typedef void (GLAPIENTRY * PFNGLTEXTUREBARRIERNVPROC) (void); #define glTextureBarrierNV GLEW_GET_FUN(__glewTextureBarrierNV) #define GLEW_NV_texture_barrier GLEW_GET_VAR(__GLEW_NV_texture_barrier) #endif /* GL_NV_texture_barrier */ /* --------------------- GL_NV_texture_compression_vtc --------------------- */ #ifndef GL_NV_texture_compression_vtc #define GL_NV_texture_compression_vtc 1 #define GLEW_NV_texture_compression_vtc GLEW_GET_VAR(__GLEW_NV_texture_compression_vtc) #endif /* GL_NV_texture_compression_vtc */ /* ----------------------- GL_NV_texture_env_combine4 ---------------------- */ #ifndef GL_NV_texture_env_combine4 #define GL_NV_texture_env_combine4 1 #define GL_COMBINE4_NV 0x8503 #define GL_SOURCE3_RGB_NV 0x8583 #define GL_SOURCE3_ALPHA_NV 0x858B #define GL_OPERAND3_RGB_NV 0x8593 #define GL_OPERAND3_ALPHA_NV 0x859B #define GLEW_NV_texture_env_combine4 GLEW_GET_VAR(__GLEW_NV_texture_env_combine4) #endif /* GL_NV_texture_env_combine4 */ /* ---------------------- GL_NV_texture_expand_normal ---------------------- */ #ifndef GL_NV_texture_expand_normal #define GL_NV_texture_expand_normal 1 #define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F #define GLEW_NV_texture_expand_normal GLEW_GET_VAR(__GLEW_NV_texture_expand_normal) #endif /* GL_NV_texture_expand_normal */ /* ----------------------- GL_NV_texture_multisample ----------------------- */ #ifndef GL_NV_texture_multisample #define GL_NV_texture_multisample 1 #define GL_TEXTURE_COVERAGE_SAMPLES_NV 0x9045 #define GL_TEXTURE_COLOR_SAMPLES_NV 0x9046 typedef void (GLAPIENTRY * PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); typedef void (GLAPIENTRY * PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); #define glTexImage2DMultisampleCoverageNV GLEW_GET_FUN(__glewTexImage2DMultisampleCoverageNV) #define glTexImage3DMultisampleCoverageNV GLEW_GET_FUN(__glewTexImage3DMultisampleCoverageNV) #define glTextureImage2DMultisampleCoverageNV GLEW_GET_FUN(__glewTextureImage2DMultisampleCoverageNV) #define glTextureImage2DMultisampleNV GLEW_GET_FUN(__glewTextureImage2DMultisampleNV) #define glTextureImage3DMultisampleCoverageNV GLEW_GET_FUN(__glewTextureImage3DMultisampleCoverageNV) #define glTextureImage3DMultisampleNV GLEW_GET_FUN(__glewTextureImage3DMultisampleNV) #define GLEW_NV_texture_multisample GLEW_GET_VAR(__GLEW_NV_texture_multisample) #endif /* GL_NV_texture_multisample */ /* ------------------------ GL_NV_texture_rectangle ------------------------ */ #ifndef GL_NV_texture_rectangle #define GL_NV_texture_rectangle 1 #define GL_TEXTURE_RECTANGLE_NV 0x84F5 #define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 #define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 #define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 #define GLEW_NV_texture_rectangle GLEW_GET_VAR(__GLEW_NV_texture_rectangle) #endif /* GL_NV_texture_rectangle */ /* -------------------------- GL_NV_texture_shader ------------------------- */ #ifndef GL_NV_texture_shader #define GL_NV_texture_shader 1 #define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C #define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D #define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E #define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 #define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA #define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB #define GL_DSDT_MAG_INTENSITY_NV 0x86DC #define GL_SHADER_CONSISTENT_NV 0x86DD #define GL_TEXTURE_SHADER_NV 0x86DE #define GL_SHADER_OPERATION_NV 0x86DF #define GL_CULL_MODES_NV 0x86E0 #define GL_OFFSET_TEXTURE_2D_MATRIX_NV 0x86E1 #define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 #define GL_OFFSET_TEXTURE_2D_SCALE_NV 0x86E2 #define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 #define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 #define GL_OFFSET_TEXTURE_2D_BIAS_NV 0x86E3 #define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 #define GL_CONST_EYE_NV 0x86E5 #define GL_PASS_THROUGH_NV 0x86E6 #define GL_CULL_FRAGMENT_NV 0x86E7 #define GL_OFFSET_TEXTURE_2D_NV 0x86E8 #define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 #define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA #define GL_DOT_PRODUCT_NV 0x86EC #define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED #define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE #define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 #define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 #define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 #define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 #define GL_HILO_NV 0x86F4 #define GL_DSDT_NV 0x86F5 #define GL_DSDT_MAG_NV 0x86F6 #define GL_DSDT_MAG_VIB_NV 0x86F7 #define GL_HILO16_NV 0x86F8 #define GL_SIGNED_HILO_NV 0x86F9 #define GL_SIGNED_HILO16_NV 0x86FA #define GL_SIGNED_RGBA_NV 0x86FB #define GL_SIGNED_RGBA8_NV 0x86FC #define GL_SIGNED_RGB_NV 0x86FE #define GL_SIGNED_RGB8_NV 0x86FF #define GL_SIGNED_LUMINANCE_NV 0x8701 #define GL_SIGNED_LUMINANCE8_NV 0x8702 #define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 #define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 #define GL_SIGNED_ALPHA_NV 0x8705 #define GL_SIGNED_ALPHA8_NV 0x8706 #define GL_SIGNED_INTENSITY_NV 0x8707 #define GL_SIGNED_INTENSITY8_NV 0x8708 #define GL_DSDT8_NV 0x8709 #define GL_DSDT8_MAG8_NV 0x870A #define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B #define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C #define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D #define GL_HI_SCALE_NV 0x870E #define GL_LO_SCALE_NV 0x870F #define GL_DS_SCALE_NV 0x8710 #define GL_DT_SCALE_NV 0x8711 #define GL_MAGNITUDE_SCALE_NV 0x8712 #define GL_VIBRANCE_SCALE_NV 0x8713 #define GL_HI_BIAS_NV 0x8714 #define GL_LO_BIAS_NV 0x8715 #define GL_DS_BIAS_NV 0x8716 #define GL_DT_BIAS_NV 0x8717 #define GL_MAGNITUDE_BIAS_NV 0x8718 #define GL_VIBRANCE_BIAS_NV 0x8719 #define GL_TEXTURE_BORDER_VALUES_NV 0x871A #define GL_TEXTURE_HI_SIZE_NV 0x871B #define GL_TEXTURE_LO_SIZE_NV 0x871C #define GL_TEXTURE_DS_SIZE_NV 0x871D #define GL_TEXTURE_DT_SIZE_NV 0x871E #define GL_TEXTURE_MAG_SIZE_NV 0x871F #define GLEW_NV_texture_shader GLEW_GET_VAR(__GLEW_NV_texture_shader) #endif /* GL_NV_texture_shader */ /* ------------------------- GL_NV_texture_shader2 ------------------------- */ #ifndef GL_NV_texture_shader2 #define GL_NV_texture_shader2 1 #define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA #define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB #define GL_DSDT_MAG_INTENSITY_NV 0x86DC #define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF #define GL_HILO_NV 0x86F4 #define GL_DSDT_NV 0x86F5 #define GL_DSDT_MAG_NV 0x86F6 #define GL_DSDT_MAG_VIB_NV 0x86F7 #define GL_HILO16_NV 0x86F8 #define GL_SIGNED_HILO_NV 0x86F9 #define GL_SIGNED_HILO16_NV 0x86FA #define GL_SIGNED_RGBA_NV 0x86FB #define GL_SIGNED_RGBA8_NV 0x86FC #define GL_SIGNED_RGB_NV 0x86FE #define GL_SIGNED_RGB8_NV 0x86FF #define GL_SIGNED_LUMINANCE_NV 0x8701 #define GL_SIGNED_LUMINANCE8_NV 0x8702 #define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 #define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 #define GL_SIGNED_ALPHA_NV 0x8705 #define GL_SIGNED_ALPHA8_NV 0x8706 #define GL_SIGNED_INTENSITY_NV 0x8707 #define GL_SIGNED_INTENSITY8_NV 0x8708 #define GL_DSDT8_NV 0x8709 #define GL_DSDT8_MAG8_NV 0x870A #define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B #define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C #define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D #define GLEW_NV_texture_shader2 GLEW_GET_VAR(__GLEW_NV_texture_shader2) #endif /* GL_NV_texture_shader2 */ /* ------------------------- GL_NV_texture_shader3 ------------------------- */ #ifndef GL_NV_texture_shader3 #define GL_NV_texture_shader3 1 #define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 #define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 #define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 #define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 #define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 #define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 #define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 #define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 #define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 #define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 #define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A #define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B #define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C #define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D #define GL_HILO8_NV 0x885E #define GL_SIGNED_HILO8_NV 0x885F #define GL_FORCE_BLUE_TO_ONE_NV 0x8860 #define GLEW_NV_texture_shader3 GLEW_GET_VAR(__GLEW_NV_texture_shader3) #endif /* GL_NV_texture_shader3 */ /* ------------------------ GL_NV_transform_feedback ----------------------- */ #ifndef GL_NV_transform_feedback #define GL_NV_transform_feedback 1 #define GL_BACK_PRIMARY_COLOR_NV 0x8C77 #define GL_BACK_SECONDARY_COLOR_NV 0x8C78 #define GL_TEXTURE_COORD_NV 0x8C79 #define GL_CLIP_DISTANCE_NV 0x8C7A #define GL_VERTEX_ID_NV 0x8C7B #define GL_PRIMITIVE_ID_NV 0x8C7C #define GL_GENERIC_ATTRIB_NV 0x8C7D #define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV 0x8C7E #define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F #define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80 #define GL_ACTIVE_VARYINGS_NV 0x8C81 #define GL_ACTIVE_VARYING_MAX_LENGTH_NV 0x8C82 #define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83 #define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84 #define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85 #define GL_TRANSFORM_FEEDBACK_RECORD_NV 0x8C86 #define GL_PRIMITIVES_GENERATED_NV 0x8C87 #define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88 #define GL_RASTERIZER_DISCARD_NV 0x8C89 #define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_NV 0x8C8A #define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B #define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C #define GL_SEPARATE_ATTRIBS_NV 0x8C8D #define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E #define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F typedef void (GLAPIENTRY * PFNGLACTIVEVARYINGNVPROC) (GLuint program, const GLchar *name); typedef void (GLAPIENTRY * PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode); typedef void (GLAPIENTRY * PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer); typedef void (GLAPIENTRY * PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); typedef void (GLAPIENTRY * PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); typedef void (GLAPIENTRY * PFNGLENDTRANSFORMFEEDBACKNVPROC) (void); typedef void (GLAPIENTRY * PFNGLGETACTIVEVARYINGNVPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); typedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC) (GLuint program, GLuint index, GLint *location); typedef GLint (GLAPIENTRY * PFNGLGETVARYINGLOCATIONNVPROC) (GLuint program, const GLchar *name); typedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLuint count, const GLint *attribs, GLenum bufferMode); typedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode); #define glActiveVaryingNV GLEW_GET_FUN(__glewActiveVaryingNV) #define glBeginTransformFeedbackNV GLEW_GET_FUN(__glewBeginTransformFeedbackNV) #define glBindBufferBaseNV GLEW_GET_FUN(__glewBindBufferBaseNV) #define glBindBufferOffsetNV GLEW_GET_FUN(__glewBindBufferOffsetNV) #define glBindBufferRangeNV GLEW_GET_FUN(__glewBindBufferRangeNV) #define glEndTransformFeedbackNV GLEW_GET_FUN(__glewEndTransformFeedbackNV) #define glGetActiveVaryingNV GLEW_GET_FUN(__glewGetActiveVaryingNV) #define glGetTransformFeedbackVaryingNV GLEW_GET_FUN(__glewGetTransformFeedbackVaryingNV) #define glGetVaryingLocationNV GLEW_GET_FUN(__glewGetVaryingLocationNV) #define glTransformFeedbackAttribsNV GLEW_GET_FUN(__glewTransformFeedbackAttribsNV) #define glTransformFeedbackVaryingsNV GLEW_GET_FUN(__glewTransformFeedbackVaryingsNV) #define GLEW_NV_transform_feedback GLEW_GET_VAR(__GLEW_NV_transform_feedback) #endif /* GL_NV_transform_feedback */ /* ----------------------- GL_NV_transform_feedback2 ----------------------- */ #ifndef GL_NV_transform_feedback2 #define GL_NV_transform_feedback2 1 #define GL_TRANSFORM_FEEDBACK_NV 0x8E22 #define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV 0x8E23 #define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV 0x8E24 #define GL_TRANSFORM_FEEDBACK_BINDING_NV 0x8E25 typedef void (GLAPIENTRY * PFNGLBINDTRANSFORMFEEDBACKNVPROC) (GLenum target, GLuint id); typedef void (GLAPIENTRY * PFNGLDELETETRANSFORMFEEDBACKSNVPROC) (GLsizei n, const GLuint* ids); typedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKNVPROC) (GLenum mode, GLuint id); typedef void (GLAPIENTRY * PFNGLGENTRANSFORMFEEDBACKSNVPROC) (GLsizei n, GLuint* ids); typedef GLboolean (GLAPIENTRY * PFNGLISTRANSFORMFEEDBACKNVPROC) (GLuint id); typedef void (GLAPIENTRY * PFNGLPAUSETRANSFORMFEEDBACKNVPROC) (void); typedef void (GLAPIENTRY * PFNGLRESUMETRANSFORMFEEDBACKNVPROC) (void); #define glBindTransformFeedbackNV GLEW_GET_FUN(__glewBindTransformFeedbackNV) #define glDeleteTransformFeedbacksNV GLEW_GET_FUN(__glewDeleteTransformFeedbacksNV) #define glDrawTransformFeedbackNV GLEW_GET_FUN(__glewDrawTransformFeedbackNV) #define glGenTransformFeedbacksNV GLEW_GET_FUN(__glewGenTransformFeedbacksNV) #define glIsTransformFeedbackNV GLEW_GET_FUN(__glewIsTransformFeedbackNV) #define glPauseTransformFeedbackNV GLEW_GET_FUN(__glewPauseTransformFeedbackNV) #define glResumeTransformFeedbackNV GLEW_GET_FUN(__glewResumeTransformFeedbackNV) #define GLEW_NV_transform_feedback2 GLEW_GET_VAR(__GLEW_NV_transform_feedback2) #endif /* GL_NV_transform_feedback2 */ /* -------------------------- GL_NV_vdpau_interop -------------------------- */ #ifndef GL_NV_vdpau_interop #define GL_NV_vdpau_interop 1 #define GL_SURFACE_STATE_NV 0x86EB #define GL_SURFACE_REGISTERED_NV 0x86FD #define GL_SURFACE_MAPPED_NV 0x8700 #define GL_WRITE_DISCARD_NV 0x88BE typedef GLintptr GLvdpauSurfaceNV; typedef void (GLAPIENTRY * PFNGLVDPAUFININVPROC) (void); typedef void (GLAPIENTRY * PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei* length, GLint *values); typedef void (GLAPIENTRY * PFNGLVDPAUINITNVPROC) (const void* vdpDevice, const GLvoid*getProcAddress); typedef void (GLAPIENTRY * PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface); typedef void (GLAPIENTRY * PFNGLVDPAUMAPSURFACESNVPROC) (GLsizei numSurfaces, const GLvdpauSurfaceNV* surfaces); typedef GLvdpauSurfaceNV (GLAPIENTRY * PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (const void* vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); typedef GLvdpauSurfaceNV (GLAPIENTRY * PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (const void* vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); typedef void (GLAPIENTRY * PFNGLVDPAUSURFACEACCESSNVPROC) (GLvdpauSurfaceNV surface, GLenum access); typedef void (GLAPIENTRY * PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, const GLvdpauSurfaceNV* surfaces); typedef void (GLAPIENTRY * PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface); #define glVDPAUFiniNV GLEW_GET_FUN(__glewVDPAUFiniNV) #define glVDPAUGetSurfaceivNV GLEW_GET_FUN(__glewVDPAUGetSurfaceivNV) #define glVDPAUInitNV GLEW_GET_FUN(__glewVDPAUInitNV) #define glVDPAUIsSurfaceNV GLEW_GET_FUN(__glewVDPAUIsSurfaceNV) #define glVDPAUMapSurfacesNV GLEW_GET_FUN(__glewVDPAUMapSurfacesNV) #define glVDPAURegisterOutputSurfaceNV GLEW_GET_FUN(__glewVDPAURegisterOutputSurfaceNV) #define glVDPAURegisterVideoSurfaceNV GLEW_GET_FUN(__glewVDPAURegisterVideoSurfaceNV) #define glVDPAUSurfaceAccessNV GLEW_GET_FUN(__glewVDPAUSurfaceAccessNV) #define glVDPAUUnmapSurfacesNV GLEW_GET_FUN(__glewVDPAUUnmapSurfacesNV) #define glVDPAUUnregisterSurfaceNV GLEW_GET_FUN(__glewVDPAUUnregisterSurfaceNV) #define GLEW_NV_vdpau_interop GLEW_GET_VAR(__GLEW_NV_vdpau_interop) #endif /* GL_NV_vdpau_interop */ /* ------------------------ GL_NV_vertex_array_range ----------------------- */ #ifndef GL_NV_vertex_array_range #define GL_NV_vertex_array_range 1 #define GL_VERTEX_ARRAY_RANGE_NV 0x851D #define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E #define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F #define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 #define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 typedef void (GLAPIENTRY * PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); typedef void (GLAPIENTRY * PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, void* pointer); #define glFlushVertexArrayRangeNV GLEW_GET_FUN(__glewFlushVertexArrayRangeNV) #define glVertexArrayRangeNV GLEW_GET_FUN(__glewVertexArrayRangeNV) #define GLEW_NV_vertex_array_range GLEW_GET_VAR(__GLEW_NV_vertex_array_range) #endif /* GL_NV_vertex_array_range */ /* ----------------------- GL_NV_vertex_array_range2 ----------------------- */ #ifndef GL_NV_vertex_array_range2 #define GL_NV_vertex_array_range2 1 #define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 #define GLEW_NV_vertex_array_range2 GLEW_GET_VAR(__GLEW_NV_vertex_array_range2) #endif /* GL_NV_vertex_array_range2 */ /* ------------------- GL_NV_vertex_attrib_integer_64bit ------------------- */ #ifndef GL_NV_vertex_attrib_integer_64bit #define GL_NV_vertex_attrib_integer_64bit 1 #define GL_INT64_NV 0x140E #define GL_UNSIGNED_INT64_NV 0x140F typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLI64VNVPROC) (GLuint index, GLenum pname, GLint64EXT* params); typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLUI64VNVPROC) (GLuint index, GLenum pname, GLuint64EXT* params); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1I64NVPROC) (GLuint index, GLint64EXT x); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1I64VNVPROC) (GLuint index, const GLint64EXT* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1UI64NVPROC) (GLuint index, GLuint64EXT x); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1UI64VNVPROC) (GLuint index, const GLuint64EXT* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2I64VNVPROC) (GLuint index, const GLint64EXT* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2UI64VNVPROC) (GLuint index, const GLuint64EXT* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3I64VNVPROC) (GLuint index, const GLint64EXT* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3UI64VNVPROC) (GLuint index, const GLuint64EXT* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4I64VNVPROC) (GLuint index, const GLint64EXT* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4UI64VNVPROC) (GLuint index, const GLuint64EXT* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBLFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride); #define glGetVertexAttribLi64vNV GLEW_GET_FUN(__glewGetVertexAttribLi64vNV) #define glGetVertexAttribLui64vNV GLEW_GET_FUN(__glewGetVertexAttribLui64vNV) #define glVertexAttribL1i64NV GLEW_GET_FUN(__glewVertexAttribL1i64NV) #define glVertexAttribL1i64vNV GLEW_GET_FUN(__glewVertexAttribL1i64vNV) #define glVertexAttribL1ui64NV GLEW_GET_FUN(__glewVertexAttribL1ui64NV) #define glVertexAttribL1ui64vNV GLEW_GET_FUN(__glewVertexAttribL1ui64vNV) #define glVertexAttribL2i64NV GLEW_GET_FUN(__glewVertexAttribL2i64NV) #define glVertexAttribL2i64vNV GLEW_GET_FUN(__glewVertexAttribL2i64vNV) #define glVertexAttribL2ui64NV GLEW_GET_FUN(__glewVertexAttribL2ui64NV) #define glVertexAttribL2ui64vNV GLEW_GET_FUN(__glewVertexAttribL2ui64vNV) #define glVertexAttribL3i64NV GLEW_GET_FUN(__glewVertexAttribL3i64NV) #define glVertexAttribL3i64vNV GLEW_GET_FUN(__glewVertexAttribL3i64vNV) #define glVertexAttribL3ui64NV GLEW_GET_FUN(__glewVertexAttribL3ui64NV) #define glVertexAttribL3ui64vNV GLEW_GET_FUN(__glewVertexAttribL3ui64vNV) #define glVertexAttribL4i64NV GLEW_GET_FUN(__glewVertexAttribL4i64NV) #define glVertexAttribL4i64vNV GLEW_GET_FUN(__glewVertexAttribL4i64vNV) #define glVertexAttribL4ui64NV GLEW_GET_FUN(__glewVertexAttribL4ui64NV) #define glVertexAttribL4ui64vNV GLEW_GET_FUN(__glewVertexAttribL4ui64vNV) #define glVertexAttribLFormatNV GLEW_GET_FUN(__glewVertexAttribLFormatNV) #define GLEW_NV_vertex_attrib_integer_64bit GLEW_GET_VAR(__GLEW_NV_vertex_attrib_integer_64bit) #endif /* GL_NV_vertex_attrib_integer_64bit */ /* ------------------- GL_NV_vertex_buffer_unified_memory ------------------ */ #ifndef GL_NV_vertex_buffer_unified_memory #define GL_NV_vertex_buffer_unified_memory 1 #define GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV 0x8F1E #define GL_ELEMENT_ARRAY_UNIFIED_NV 0x8F1F #define GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV 0x8F20 #define GL_VERTEX_ARRAY_ADDRESS_NV 0x8F21 #define GL_NORMAL_ARRAY_ADDRESS_NV 0x8F22 #define GL_COLOR_ARRAY_ADDRESS_NV 0x8F23 #define GL_INDEX_ARRAY_ADDRESS_NV 0x8F24 #define GL_TEXTURE_COORD_ARRAY_ADDRESS_NV 0x8F25 #define GL_EDGE_FLAG_ARRAY_ADDRESS_NV 0x8F26 #define GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV 0x8F27 #define GL_FOG_COORD_ARRAY_ADDRESS_NV 0x8F28 #define GL_ELEMENT_ARRAY_ADDRESS_NV 0x8F29 #define GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV 0x8F2A #define GL_VERTEX_ARRAY_LENGTH_NV 0x8F2B #define GL_NORMAL_ARRAY_LENGTH_NV 0x8F2C #define GL_COLOR_ARRAY_LENGTH_NV 0x8F2D #define GL_INDEX_ARRAY_LENGTH_NV 0x8F2E #define GL_TEXTURE_COORD_ARRAY_LENGTH_NV 0x8F2F #define GL_EDGE_FLAG_ARRAY_LENGTH_NV 0x8F30 #define GL_SECONDARY_COLOR_ARRAY_LENGTH_NV 0x8F31 #define GL_FOG_COORD_ARRAY_LENGTH_NV 0x8F32 #define GL_ELEMENT_ARRAY_LENGTH_NV 0x8F33 #define GL_DRAW_INDIRECT_UNIFIED_NV 0x8F40 #define GL_DRAW_INDIRECT_ADDRESS_NV 0x8F41 #define GL_DRAW_INDIRECT_LENGTH_NV 0x8F42 typedef void (GLAPIENTRY * PFNGLBUFFERADDRESSRANGENVPROC) (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length); typedef void (GLAPIENTRY * PFNGLCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); typedef void (GLAPIENTRY * PFNGLEDGEFLAGFORMATNVPROC) (GLsizei stride); typedef void (GLAPIENTRY * PFNGLFOGCOORDFORMATNVPROC) (GLenum type, GLsizei stride); typedef void (GLAPIENTRY * PFNGLGETINTEGERUI64I_VNVPROC) (GLenum value, GLuint index, GLuint64EXT result[]); typedef void (GLAPIENTRY * PFNGLINDEXFORMATNVPROC) (GLenum type, GLsizei stride); typedef void (GLAPIENTRY * PFNGLNORMALFORMATNVPROC) (GLenum type, GLsizei stride); typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); typedef void (GLAPIENTRY * PFNGLTEXCOORDFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBIFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride); typedef void (GLAPIENTRY * PFNGLVERTEXFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); #define glBufferAddressRangeNV GLEW_GET_FUN(__glewBufferAddressRangeNV) #define glColorFormatNV GLEW_GET_FUN(__glewColorFormatNV) #define glEdgeFlagFormatNV GLEW_GET_FUN(__glewEdgeFlagFormatNV) #define glFogCoordFormatNV GLEW_GET_FUN(__glewFogCoordFormatNV) #define glGetIntegerui64i_vNV GLEW_GET_FUN(__glewGetIntegerui64i_vNV) #define glIndexFormatNV GLEW_GET_FUN(__glewIndexFormatNV) #define glNormalFormatNV GLEW_GET_FUN(__glewNormalFormatNV) #define glSecondaryColorFormatNV GLEW_GET_FUN(__glewSecondaryColorFormatNV) #define glTexCoordFormatNV GLEW_GET_FUN(__glewTexCoordFormatNV) #define glVertexAttribFormatNV GLEW_GET_FUN(__glewVertexAttribFormatNV) #define glVertexAttribIFormatNV GLEW_GET_FUN(__glewVertexAttribIFormatNV) #define glVertexFormatNV GLEW_GET_FUN(__glewVertexFormatNV) #define GLEW_NV_vertex_buffer_unified_memory GLEW_GET_VAR(__GLEW_NV_vertex_buffer_unified_memory) #endif /* GL_NV_vertex_buffer_unified_memory */ /* -------------------------- GL_NV_vertex_program ------------------------- */ #ifndef GL_NV_vertex_program #define GL_NV_vertex_program 1 #define GL_VERTEX_PROGRAM_NV 0x8620 #define GL_VERTEX_STATE_PROGRAM_NV 0x8621 #define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 #define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 #define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 #define GL_CURRENT_ATTRIB_NV 0x8626 #define GL_PROGRAM_LENGTH_NV 0x8627 #define GL_PROGRAM_STRING_NV 0x8628 #define GL_MODELVIEW_PROJECTION_NV 0x8629 #define GL_IDENTITY_NV 0x862A #define GL_INVERSE_NV 0x862B #define GL_TRANSPOSE_NV 0x862C #define GL_INVERSE_TRANSPOSE_NV 0x862D #define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E #define GL_MAX_TRACK_MATRICES_NV 0x862F #define GL_MATRIX0_NV 0x8630 #define GL_MATRIX1_NV 0x8631 #define GL_MATRIX2_NV 0x8632 #define GL_MATRIX3_NV 0x8633 #define GL_MATRIX4_NV 0x8634 #define GL_MATRIX5_NV 0x8635 #define GL_MATRIX6_NV 0x8636 #define GL_MATRIX7_NV 0x8637 #define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 #define GL_CURRENT_MATRIX_NV 0x8641 #define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 #define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 #define GL_PROGRAM_PARAMETER_NV 0x8644 #define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 #define GL_PROGRAM_TARGET_NV 0x8646 #define GL_PROGRAM_RESIDENT_NV 0x8647 #define GL_TRACK_MATRIX_NV 0x8648 #define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 #define GL_VERTEX_PROGRAM_BINDING_NV 0x864A #define GL_PROGRAM_ERROR_POSITION_NV 0x864B #define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 #define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 #define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 #define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 #define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 #define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 #define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 #define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 #define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 #define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 #define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A #define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B #define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C #define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D #define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E #define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F #define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 #define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 #define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 #define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 #define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 #define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 #define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 #define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 #define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 #define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 #define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A #define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B #define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C #define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D #define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E #define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F #define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 #define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 #define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 #define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 #define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 #define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 #define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 #define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 #define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 #define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 #define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A #define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B #define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C #define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D #define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E #define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F typedef GLboolean (GLAPIENTRY * PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint* ids, GLboolean *residences); typedef void (GLAPIENTRY * PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id); typedef void (GLAPIENTRY * PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint* ids); typedef void (GLAPIENTRY * PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint* ids); typedef void (GLAPIENTRY * PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble* params); typedef void (GLAPIENTRY * PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte* program); typedef void (GLAPIENTRY * PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid** pointer); typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble* params); typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint* params); typedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMNVPROC) (GLuint id); typedef void (GLAPIENTRY * PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte* program); typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble* params); typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLsizei num, const GLdouble* params); typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLsizei num, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, GLuint* ids); typedef void (GLAPIENTRY * PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void* pointer); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei n, const GLshort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei n, const GLshort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei n, const GLshort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei n, const GLshort* v); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei n, const GLubyte* v); #define glAreProgramsResidentNV GLEW_GET_FUN(__glewAreProgramsResidentNV) #define glBindProgramNV GLEW_GET_FUN(__glewBindProgramNV) #define glDeleteProgramsNV GLEW_GET_FUN(__glewDeleteProgramsNV) #define glExecuteProgramNV GLEW_GET_FUN(__glewExecuteProgramNV) #define glGenProgramsNV GLEW_GET_FUN(__glewGenProgramsNV) #define glGetProgramParameterdvNV GLEW_GET_FUN(__glewGetProgramParameterdvNV) #define glGetProgramParameterfvNV GLEW_GET_FUN(__glewGetProgramParameterfvNV) #define glGetProgramStringNV GLEW_GET_FUN(__glewGetProgramStringNV) #define glGetProgramivNV GLEW_GET_FUN(__glewGetProgramivNV) #define glGetTrackMatrixivNV GLEW_GET_FUN(__glewGetTrackMatrixivNV) #define glGetVertexAttribPointervNV GLEW_GET_FUN(__glewGetVertexAttribPointervNV) #define glGetVertexAttribdvNV GLEW_GET_FUN(__glewGetVertexAttribdvNV) #define glGetVertexAttribfvNV GLEW_GET_FUN(__glewGetVertexAttribfvNV) #define glGetVertexAttribivNV GLEW_GET_FUN(__glewGetVertexAttribivNV) #define glIsProgramNV GLEW_GET_FUN(__glewIsProgramNV) #define glLoadProgramNV GLEW_GET_FUN(__glewLoadProgramNV) #define glProgramParameter4dNV GLEW_GET_FUN(__glewProgramParameter4dNV) #define glProgramParameter4dvNV GLEW_GET_FUN(__glewProgramParameter4dvNV) #define glProgramParameter4fNV GLEW_GET_FUN(__glewProgramParameter4fNV) #define glProgramParameter4fvNV GLEW_GET_FUN(__glewProgramParameter4fvNV) #define glProgramParameters4dvNV GLEW_GET_FUN(__glewProgramParameters4dvNV) #define glProgramParameters4fvNV GLEW_GET_FUN(__glewProgramParameters4fvNV) #define glRequestResidentProgramsNV GLEW_GET_FUN(__glewRequestResidentProgramsNV) #define glTrackMatrixNV GLEW_GET_FUN(__glewTrackMatrixNV) #define glVertexAttrib1dNV GLEW_GET_FUN(__glewVertexAttrib1dNV) #define glVertexAttrib1dvNV GLEW_GET_FUN(__glewVertexAttrib1dvNV) #define glVertexAttrib1fNV GLEW_GET_FUN(__glewVertexAttrib1fNV) #define glVertexAttrib1fvNV GLEW_GET_FUN(__glewVertexAttrib1fvNV) #define glVertexAttrib1sNV GLEW_GET_FUN(__glewVertexAttrib1sNV) #define glVertexAttrib1svNV GLEW_GET_FUN(__glewVertexAttrib1svNV) #define glVertexAttrib2dNV GLEW_GET_FUN(__glewVertexAttrib2dNV) #define glVertexAttrib2dvNV GLEW_GET_FUN(__glewVertexAttrib2dvNV) #define glVertexAttrib2fNV GLEW_GET_FUN(__glewVertexAttrib2fNV) #define glVertexAttrib2fvNV GLEW_GET_FUN(__glewVertexAttrib2fvNV) #define glVertexAttrib2sNV GLEW_GET_FUN(__glewVertexAttrib2sNV) #define glVertexAttrib2svNV GLEW_GET_FUN(__glewVertexAttrib2svNV) #define glVertexAttrib3dNV GLEW_GET_FUN(__glewVertexAttrib3dNV) #define glVertexAttrib3dvNV GLEW_GET_FUN(__glewVertexAttrib3dvNV) #define glVertexAttrib3fNV GLEW_GET_FUN(__glewVertexAttrib3fNV) #define glVertexAttrib3fvNV GLEW_GET_FUN(__glewVertexAttrib3fvNV) #define glVertexAttrib3sNV GLEW_GET_FUN(__glewVertexAttrib3sNV) #define glVertexAttrib3svNV GLEW_GET_FUN(__glewVertexAttrib3svNV) #define glVertexAttrib4dNV GLEW_GET_FUN(__glewVertexAttrib4dNV) #define glVertexAttrib4dvNV GLEW_GET_FUN(__glewVertexAttrib4dvNV) #define glVertexAttrib4fNV GLEW_GET_FUN(__glewVertexAttrib4fNV) #define glVertexAttrib4fvNV GLEW_GET_FUN(__glewVertexAttrib4fvNV) #define glVertexAttrib4sNV GLEW_GET_FUN(__glewVertexAttrib4sNV) #define glVertexAttrib4svNV GLEW_GET_FUN(__glewVertexAttrib4svNV) #define glVertexAttrib4ubNV GLEW_GET_FUN(__glewVertexAttrib4ubNV) #define glVertexAttrib4ubvNV GLEW_GET_FUN(__glewVertexAttrib4ubvNV) #define glVertexAttribPointerNV GLEW_GET_FUN(__glewVertexAttribPointerNV) #define glVertexAttribs1dvNV GLEW_GET_FUN(__glewVertexAttribs1dvNV) #define glVertexAttribs1fvNV GLEW_GET_FUN(__glewVertexAttribs1fvNV) #define glVertexAttribs1svNV GLEW_GET_FUN(__glewVertexAttribs1svNV) #define glVertexAttribs2dvNV GLEW_GET_FUN(__glewVertexAttribs2dvNV) #define glVertexAttribs2fvNV GLEW_GET_FUN(__glewVertexAttribs2fvNV) #define glVertexAttribs2svNV GLEW_GET_FUN(__glewVertexAttribs2svNV) #define glVertexAttribs3dvNV GLEW_GET_FUN(__glewVertexAttribs3dvNV) #define glVertexAttribs3fvNV GLEW_GET_FUN(__glewVertexAttribs3fvNV) #define glVertexAttribs3svNV GLEW_GET_FUN(__glewVertexAttribs3svNV) #define glVertexAttribs4dvNV GLEW_GET_FUN(__glewVertexAttribs4dvNV) #define glVertexAttribs4fvNV GLEW_GET_FUN(__glewVertexAttribs4fvNV) #define glVertexAttribs4svNV GLEW_GET_FUN(__glewVertexAttribs4svNV) #define glVertexAttribs4ubvNV GLEW_GET_FUN(__glewVertexAttribs4ubvNV) #define GLEW_NV_vertex_program GLEW_GET_VAR(__GLEW_NV_vertex_program) #endif /* GL_NV_vertex_program */ /* ------------------------ GL_NV_vertex_program1_1 ------------------------ */ #ifndef GL_NV_vertex_program1_1 #define GL_NV_vertex_program1_1 1 #define GLEW_NV_vertex_program1_1 GLEW_GET_VAR(__GLEW_NV_vertex_program1_1) #endif /* GL_NV_vertex_program1_1 */ /* ------------------------- GL_NV_vertex_program2 ------------------------- */ #ifndef GL_NV_vertex_program2 #define GL_NV_vertex_program2 1 #define GLEW_NV_vertex_program2 GLEW_GET_VAR(__GLEW_NV_vertex_program2) #endif /* GL_NV_vertex_program2 */ /* ---------------------- GL_NV_vertex_program2_option --------------------- */ #ifndef GL_NV_vertex_program2_option #define GL_NV_vertex_program2_option 1 #define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 #define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 #define GLEW_NV_vertex_program2_option GLEW_GET_VAR(__GLEW_NV_vertex_program2_option) #endif /* GL_NV_vertex_program2_option */ /* ------------------------- GL_NV_vertex_program3 ------------------------- */ #ifndef GL_NV_vertex_program3 #define GL_NV_vertex_program3 1 #define MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C #define GLEW_NV_vertex_program3 GLEW_GET_VAR(__GLEW_NV_vertex_program3) #endif /* GL_NV_vertex_program3 */ /* ------------------------- GL_NV_vertex_program4 ------------------------- */ #ifndef GL_NV_vertex_program4 #define GL_NV_vertex_program4 1 #define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD #define GLEW_NV_vertex_program4 GLEW_GET_VAR(__GLEW_NV_vertex_program4) #endif /* GL_NV_vertex_program4 */ /* -------------------------- GL_NV_video_capture -------------------------- */ #ifndef GL_NV_video_capture #define GL_NV_video_capture 1 #define GL_VIDEO_BUFFER_NV 0x9020 #define GL_VIDEO_BUFFER_BINDING_NV 0x9021 #define GL_FIELD_UPPER_NV 0x9022 #define GL_FIELD_LOWER_NV 0x9023 #define GL_NUM_VIDEO_CAPTURE_STREAMS_NV 0x9024 #define GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV 0x9025 #define GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV 0x9026 #define GL_LAST_VIDEO_CAPTURE_STATUS_NV 0x9027 #define GL_VIDEO_BUFFER_PITCH_NV 0x9028 #define GL_VIDEO_COLOR_CONVERSION_MATRIX_NV 0x9029 #define GL_VIDEO_COLOR_CONVERSION_MAX_NV 0x902A #define GL_VIDEO_COLOR_CONVERSION_MIN_NV 0x902B #define GL_VIDEO_COLOR_CONVERSION_OFFSET_NV 0x902C #define GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV 0x902D #define GL_PARTIAL_SUCCESS_NV 0x902E #define GL_SUCCESS_NV 0x902F #define GL_FAILURE_NV 0x9030 #define GL_YCBYCR8_422_NV 0x9031 #define GL_YCBAYCR8A_4224_NV 0x9032 #define GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV 0x9033 #define GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV 0x9034 #define GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV 0x9035 #define GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV 0x9036 #define GL_Z4Y12Z4CB12Z4CR12_444_NV 0x9037 #define GL_VIDEO_CAPTURE_FRAME_WIDTH_NV 0x9038 #define GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV 0x9039 #define GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV 0x903A #define GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV 0x903B #define GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV 0x903C typedef void (GLAPIENTRY * PFNGLBEGINVIDEOCAPTURENVPROC) (GLuint video_capture_slot); typedef void (GLAPIENTRY * PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset); typedef void (GLAPIENTRY * PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture); typedef void (GLAPIENTRY * PFNGLENDVIDEOCAPTURENVPROC) (GLuint video_capture_slot); typedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTURESTREAMDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble* params); typedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTURESTREAMFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTURESTREAMIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTUREIVNVPROC) (GLuint video_capture_slot, GLenum pname, GLint* params); typedef GLenum (GLAPIENTRY * PFNGLVIDEOCAPTURENVPROC) (GLuint video_capture_slot, GLuint* sequence_num, GLuint64EXT *capture_time); typedef void (GLAPIENTRY * PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble* params); typedef void (GLAPIENTRY * PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint* params); #define glBeginVideoCaptureNV GLEW_GET_FUN(__glewBeginVideoCaptureNV) #define glBindVideoCaptureStreamBufferNV GLEW_GET_FUN(__glewBindVideoCaptureStreamBufferNV) #define glBindVideoCaptureStreamTextureNV GLEW_GET_FUN(__glewBindVideoCaptureStreamTextureNV) #define glEndVideoCaptureNV GLEW_GET_FUN(__glewEndVideoCaptureNV) #define glGetVideoCaptureStreamdvNV GLEW_GET_FUN(__glewGetVideoCaptureStreamdvNV) #define glGetVideoCaptureStreamfvNV GLEW_GET_FUN(__glewGetVideoCaptureStreamfvNV) #define glGetVideoCaptureStreamivNV GLEW_GET_FUN(__glewGetVideoCaptureStreamivNV) #define glGetVideoCaptureivNV GLEW_GET_FUN(__glewGetVideoCaptureivNV) #define glVideoCaptureNV GLEW_GET_FUN(__glewVideoCaptureNV) #define glVideoCaptureStreamParameterdvNV GLEW_GET_FUN(__glewVideoCaptureStreamParameterdvNV) #define glVideoCaptureStreamParameterfvNV GLEW_GET_FUN(__glewVideoCaptureStreamParameterfvNV) #define glVideoCaptureStreamParameterivNV GLEW_GET_FUN(__glewVideoCaptureStreamParameterivNV) #define GLEW_NV_video_capture GLEW_GET_VAR(__GLEW_NV_video_capture) #endif /* GL_NV_video_capture */ /* ------------------------ GL_OES_byte_coordinates ------------------------ */ #ifndef GL_OES_byte_coordinates #define GL_OES_byte_coordinates 1 #define GL_BYTE 0x1400 #define GLEW_OES_byte_coordinates GLEW_GET_VAR(__GLEW_OES_byte_coordinates) #endif /* GL_OES_byte_coordinates */ /* ------------------- GL_OES_compressed_paletted_texture ------------------ */ #ifndef GL_OES_compressed_paletted_texture #define GL_OES_compressed_paletted_texture 1 #define GL_PALETTE4_RGB8_OES 0x8B90 #define GL_PALETTE4_RGBA8_OES 0x8B91 #define GL_PALETTE4_R5_G6_B5_OES 0x8B92 #define GL_PALETTE4_RGBA4_OES 0x8B93 #define GL_PALETTE4_RGB5_A1_OES 0x8B94 #define GL_PALETTE8_RGB8_OES 0x8B95 #define GL_PALETTE8_RGBA8_OES 0x8B96 #define GL_PALETTE8_R5_G6_B5_OES 0x8B97 #define GL_PALETTE8_RGBA4_OES 0x8B98 #define GL_PALETTE8_RGB5_A1_OES 0x8B99 #define GLEW_OES_compressed_paletted_texture GLEW_GET_VAR(__GLEW_OES_compressed_paletted_texture) #endif /* GL_OES_compressed_paletted_texture */ /* --------------------------- GL_OES_read_format -------------------------- */ #ifndef GL_OES_read_format #define GL_OES_read_format 1 #define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A #define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B #define GLEW_OES_read_format GLEW_GET_VAR(__GLEW_OES_read_format) #endif /* GL_OES_read_format */ /* ------------------------ GL_OES_single_precision ------------------------ */ #ifndef GL_OES_single_precision #define GL_OES_single_precision 1 typedef void (GLAPIENTRY * PFNGLCLEARDEPTHFOESPROC) (GLclampd depth); typedef void (GLAPIENTRY * PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat* equation); typedef void (GLAPIENTRY * PFNGLDEPTHRANGEFOESPROC) (GLclampf n, GLclampf f); typedef void (GLAPIENTRY * PFNGLFRUSTUMFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); typedef void (GLAPIENTRY * PFNGLGETCLIPPLANEFOESPROC) (GLenum plane, GLfloat* equation); typedef void (GLAPIENTRY * PFNGLORTHOFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); #define glClearDepthfOES GLEW_GET_FUN(__glewClearDepthfOES) #define glClipPlanefOES GLEW_GET_FUN(__glewClipPlanefOES) #define glDepthRangefOES GLEW_GET_FUN(__glewDepthRangefOES) #define glFrustumfOES GLEW_GET_FUN(__glewFrustumfOES) #define glGetClipPlanefOES GLEW_GET_FUN(__glewGetClipPlanefOES) #define glOrthofOES GLEW_GET_FUN(__glewOrthofOES) #define GLEW_OES_single_precision GLEW_GET_VAR(__GLEW_OES_single_precision) #endif /* GL_OES_single_precision */ /* ---------------------------- GL_OML_interlace --------------------------- */ #ifndef GL_OML_interlace #define GL_OML_interlace 1 #define GL_INTERLACE_OML 0x8980 #define GL_INTERLACE_READ_OML 0x8981 #define GLEW_OML_interlace GLEW_GET_VAR(__GLEW_OML_interlace) #endif /* GL_OML_interlace */ /* ---------------------------- GL_OML_resample ---------------------------- */ #ifndef GL_OML_resample #define GL_OML_resample 1 #define GL_PACK_RESAMPLE_OML 0x8984 #define GL_UNPACK_RESAMPLE_OML 0x8985 #define GL_RESAMPLE_REPLICATE_OML 0x8986 #define GL_RESAMPLE_ZERO_FILL_OML 0x8987 #define GL_RESAMPLE_AVERAGE_OML 0x8988 #define GL_RESAMPLE_DECIMATE_OML 0x8989 #define GLEW_OML_resample GLEW_GET_VAR(__GLEW_OML_resample) #endif /* GL_OML_resample */ /* ---------------------------- GL_OML_subsample --------------------------- */ #ifndef GL_OML_subsample #define GL_OML_subsample 1 #define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 #define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 #define GLEW_OML_subsample GLEW_GET_VAR(__GLEW_OML_subsample) #endif /* GL_OML_subsample */ /* --------------------------- GL_PGI_misc_hints --------------------------- */ #ifndef GL_PGI_misc_hints #define GL_PGI_misc_hints 1 #define GL_PREFER_DOUBLEBUFFER_HINT_PGI 107000 #define GL_CONSERVE_MEMORY_HINT_PGI 107005 #define GL_RECLAIM_MEMORY_HINT_PGI 107006 #define GL_NATIVE_GRAPHICS_HANDLE_PGI 107010 #define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 107011 #define GL_NATIVE_GRAPHICS_END_HINT_PGI 107012 #define GL_ALWAYS_FAST_HINT_PGI 107020 #define GL_ALWAYS_SOFT_HINT_PGI 107021 #define GL_ALLOW_DRAW_OBJ_HINT_PGI 107022 #define GL_ALLOW_DRAW_WIN_HINT_PGI 107023 #define GL_ALLOW_DRAW_FRG_HINT_PGI 107024 #define GL_ALLOW_DRAW_MEM_HINT_PGI 107025 #define GL_STRICT_DEPTHFUNC_HINT_PGI 107030 #define GL_STRICT_LIGHTING_HINT_PGI 107031 #define GL_STRICT_SCISSOR_HINT_PGI 107032 #define GL_FULL_STIPPLE_HINT_PGI 107033 #define GL_CLIP_NEAR_HINT_PGI 107040 #define GL_CLIP_FAR_HINT_PGI 107041 #define GL_WIDE_LINE_HINT_PGI 107042 #define GL_BACK_NORMALS_HINT_PGI 107043 #define GLEW_PGI_misc_hints GLEW_GET_VAR(__GLEW_PGI_misc_hints) #endif /* GL_PGI_misc_hints */ /* -------------------------- GL_PGI_vertex_hints -------------------------- */ #ifndef GL_PGI_vertex_hints #define GL_PGI_vertex_hints 1 #define GL_VERTEX23_BIT_PGI 0x00000004 #define GL_VERTEX4_BIT_PGI 0x00000008 #define GL_COLOR3_BIT_PGI 0x00010000 #define GL_COLOR4_BIT_PGI 0x00020000 #define GL_EDGEFLAG_BIT_PGI 0x00040000 #define GL_INDEX_BIT_PGI 0x00080000 #define GL_MAT_AMBIENT_BIT_PGI 0x00100000 #define GL_VERTEX_DATA_HINT_PGI 107050 #define GL_VERTEX_CONSISTENT_HINT_PGI 107051 #define GL_MATERIAL_SIDE_HINT_PGI 107052 #define GL_MAX_VERTEX_HINT_PGI 107053 #define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 #define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 #define GL_MAT_EMISSION_BIT_PGI 0x00800000 #define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 #define GL_MAT_SHININESS_BIT_PGI 0x02000000 #define GL_MAT_SPECULAR_BIT_PGI 0x04000000 #define GL_NORMAL_BIT_PGI 0x08000000 #define GL_TEXCOORD1_BIT_PGI 0x10000000 #define GL_TEXCOORD2_BIT_PGI 0x20000000 #define GL_TEXCOORD3_BIT_PGI 0x40000000 #define GL_TEXCOORD4_BIT_PGI 0x80000000 #define GLEW_PGI_vertex_hints GLEW_GET_VAR(__GLEW_PGI_vertex_hints) #endif /* GL_PGI_vertex_hints */ /* ------------------------- GL_REGAL_error_string ------------------------- */ #ifndef GL_REGAL_error_string #define GL_REGAL_error_string 1 typedef const GLchar* (GLAPIENTRY * PFNGLERRORSTRINGREGALPROC) (GLenum error); #define glErrorStringREGAL GLEW_GET_FUN(__glewErrorStringREGAL) #define GLEW_REGAL_error_string GLEW_GET_VAR(__GLEW_REGAL_error_string) #endif /* GL_REGAL_error_string */ /* ------------------------ GL_REGAL_extension_query ----------------------- */ #ifndef GL_REGAL_extension_query #define GL_REGAL_extension_query 1 typedef GLboolean (GLAPIENTRY * PFNGLGETEXTENSIONREGALPROC) (const GLchar* ext); typedef GLboolean (GLAPIENTRY * PFNGLISSUPPORTEDREGALPROC) (const GLchar* ext); #define glGetExtensionREGAL GLEW_GET_FUN(__glewGetExtensionREGAL) #define glIsSupportedREGAL GLEW_GET_FUN(__glewIsSupportedREGAL) #define GLEW_REGAL_extension_query GLEW_GET_VAR(__GLEW_REGAL_extension_query) #endif /* GL_REGAL_extension_query */ /* ------------------------------ GL_REGAL_log ----------------------------- */ #ifndef GL_REGAL_log #define GL_REGAL_log 1 #define GL_LOG_ERROR_REGAL 0x9319 #define GL_LOG_WARNING_REGAL 0x931A #define GL_LOG_INFO_REGAL 0x931B #define GL_LOG_APP_REGAL 0x931C #define GL_LOG_DRIVER_REGAL 0x931D #define GL_LOG_INTERNAL_REGAL 0x931E #define GL_LOG_DEBUG_REGAL 0x931F #define GL_LOG_STATUS_REGAL 0x9320 #define GL_LOG_HTTP_REGAL 0x9321 #define GLEW_REGAL_log GLEW_GET_VAR(__GLEW_REGAL_log) #endif /* GL_REGAL_log */ /* ----------------------- GL_REND_screen_coordinates ---------------------- */ #ifndef GL_REND_screen_coordinates #define GL_REND_screen_coordinates 1 #define GL_SCREEN_COORDINATES_REND 0x8490 #define GL_INVERTED_SCREEN_W_REND 0x8491 #define GLEW_REND_screen_coordinates GLEW_GET_VAR(__GLEW_REND_screen_coordinates) #endif /* GL_REND_screen_coordinates */ /* ------------------------------- GL_S3_s3tc ------------------------------ */ #ifndef GL_S3_s3tc #define GL_S3_s3tc 1 #define GL_RGB_S3TC 0x83A0 #define GL_RGB4_S3TC 0x83A1 #define GL_RGBA_S3TC 0x83A2 #define GL_RGBA4_S3TC 0x83A3 #define GL_RGBA_DXT5_S3TC 0x83A4 #define GL_RGBA4_DXT5_S3TC 0x83A5 #define GLEW_S3_s3tc GLEW_GET_VAR(__GLEW_S3_s3tc) #endif /* GL_S3_s3tc */ /* -------------------------- GL_SGIS_color_range -------------------------- */ #ifndef GL_SGIS_color_range #define GL_SGIS_color_range 1 #define GL_EXTENDED_RANGE_SGIS 0x85A5 #define GL_MIN_RED_SGIS 0x85A6 #define GL_MAX_RED_SGIS 0x85A7 #define GL_MIN_GREEN_SGIS 0x85A8 #define GL_MAX_GREEN_SGIS 0x85A9 #define GL_MIN_BLUE_SGIS 0x85AA #define GL_MAX_BLUE_SGIS 0x85AB #define GL_MIN_ALPHA_SGIS 0x85AC #define GL_MAX_ALPHA_SGIS 0x85AD #define GLEW_SGIS_color_range GLEW_GET_VAR(__GLEW_SGIS_color_range) #endif /* GL_SGIS_color_range */ /* ------------------------- GL_SGIS_detail_texture ------------------------ */ #ifndef GL_SGIS_detail_texture #define GL_SGIS_detail_texture 1 typedef void (GLAPIENTRY * PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat* points); typedef void (GLAPIENTRY * PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat* points); #define glDetailTexFuncSGIS GLEW_GET_FUN(__glewDetailTexFuncSGIS) #define glGetDetailTexFuncSGIS GLEW_GET_FUN(__glewGetDetailTexFuncSGIS) #define GLEW_SGIS_detail_texture GLEW_GET_VAR(__GLEW_SGIS_detail_texture) #endif /* GL_SGIS_detail_texture */ /* -------------------------- GL_SGIS_fog_function ------------------------- */ #ifndef GL_SGIS_fog_function #define GL_SGIS_fog_function 1 typedef void (GLAPIENTRY * PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat* points); typedef void (GLAPIENTRY * PFNGLGETFOGFUNCSGISPROC) (GLfloat* points); #define glFogFuncSGIS GLEW_GET_FUN(__glewFogFuncSGIS) #define glGetFogFuncSGIS GLEW_GET_FUN(__glewGetFogFuncSGIS) #define GLEW_SGIS_fog_function GLEW_GET_VAR(__GLEW_SGIS_fog_function) #endif /* GL_SGIS_fog_function */ /* ------------------------ GL_SGIS_generate_mipmap ------------------------ */ #ifndef GL_SGIS_generate_mipmap #define GL_SGIS_generate_mipmap 1 #define GL_GENERATE_MIPMAP_SGIS 0x8191 #define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 #define GLEW_SGIS_generate_mipmap GLEW_GET_VAR(__GLEW_SGIS_generate_mipmap) #endif /* GL_SGIS_generate_mipmap */ /* -------------------------- GL_SGIS_multisample -------------------------- */ #ifndef GL_SGIS_multisample #define GL_SGIS_multisample 1 #define GL_MULTISAMPLE_SGIS 0x809D #define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E #define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F #define GL_SAMPLE_MASK_SGIS 0x80A0 #define GL_1PASS_SGIS 0x80A1 #define GL_2PASS_0_SGIS 0x80A2 #define GL_2PASS_1_SGIS 0x80A3 #define GL_4PASS_0_SGIS 0x80A4 #define GL_4PASS_1_SGIS 0x80A5 #define GL_4PASS_2_SGIS 0x80A6 #define GL_4PASS_3_SGIS 0x80A7 #define GL_SAMPLE_BUFFERS_SGIS 0x80A8 #define GL_SAMPLES_SGIS 0x80A9 #define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA #define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB #define GL_SAMPLE_PATTERN_SGIS 0x80AC typedef void (GLAPIENTRY * PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert); typedef void (GLAPIENTRY * PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); #define glSampleMaskSGIS GLEW_GET_FUN(__glewSampleMaskSGIS) #define glSamplePatternSGIS GLEW_GET_FUN(__glewSamplePatternSGIS) #define GLEW_SGIS_multisample GLEW_GET_VAR(__GLEW_SGIS_multisample) #endif /* GL_SGIS_multisample */ /* ------------------------- GL_SGIS_pixel_texture ------------------------- */ #ifndef GL_SGIS_pixel_texture #define GL_SGIS_pixel_texture 1 #define GLEW_SGIS_pixel_texture GLEW_GET_VAR(__GLEW_SGIS_pixel_texture) #endif /* GL_SGIS_pixel_texture */ /* ----------------------- GL_SGIS_point_line_texgen ----------------------- */ #ifndef GL_SGIS_point_line_texgen #define GL_SGIS_point_line_texgen 1 #define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 #define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 #define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 #define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 #define GL_EYE_POINT_SGIS 0x81F4 #define GL_OBJECT_POINT_SGIS 0x81F5 #define GL_EYE_LINE_SGIS 0x81F6 #define GL_OBJECT_LINE_SGIS 0x81F7 #define GLEW_SGIS_point_line_texgen GLEW_GET_VAR(__GLEW_SGIS_point_line_texgen) #endif /* GL_SGIS_point_line_texgen */ /* ------------------------ GL_SGIS_sharpen_texture ------------------------ */ #ifndef GL_SGIS_sharpen_texture #define GL_SGIS_sharpen_texture 1 typedef void (GLAPIENTRY * PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat* points); typedef void (GLAPIENTRY * PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat* points); #define glGetSharpenTexFuncSGIS GLEW_GET_FUN(__glewGetSharpenTexFuncSGIS) #define glSharpenTexFuncSGIS GLEW_GET_FUN(__glewSharpenTexFuncSGIS) #define GLEW_SGIS_sharpen_texture GLEW_GET_VAR(__GLEW_SGIS_sharpen_texture) #endif /* GL_SGIS_sharpen_texture */ /* --------------------------- GL_SGIS_texture4D --------------------------- */ #ifndef GL_SGIS_texture4D #define GL_SGIS_texture4D 1 typedef void (GLAPIENTRY * PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLint border, GLenum format, GLenum type, const void* pixels); typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLenum format, GLenum type, const void* pixels); #define glTexImage4DSGIS GLEW_GET_FUN(__glewTexImage4DSGIS) #define glTexSubImage4DSGIS GLEW_GET_FUN(__glewTexSubImage4DSGIS) #define GLEW_SGIS_texture4D GLEW_GET_VAR(__GLEW_SGIS_texture4D) #endif /* GL_SGIS_texture4D */ /* ---------------------- GL_SGIS_texture_border_clamp --------------------- */ #ifndef GL_SGIS_texture_border_clamp #define GL_SGIS_texture_border_clamp 1 #define GL_CLAMP_TO_BORDER_SGIS 0x812D #define GLEW_SGIS_texture_border_clamp GLEW_GET_VAR(__GLEW_SGIS_texture_border_clamp) #endif /* GL_SGIS_texture_border_clamp */ /* ----------------------- GL_SGIS_texture_edge_clamp ---------------------- */ #ifndef GL_SGIS_texture_edge_clamp #define GL_SGIS_texture_edge_clamp 1 #define GL_CLAMP_TO_EDGE_SGIS 0x812F #define GLEW_SGIS_texture_edge_clamp GLEW_GET_VAR(__GLEW_SGIS_texture_edge_clamp) #endif /* GL_SGIS_texture_edge_clamp */ /* ------------------------ GL_SGIS_texture_filter4 ------------------------ */ #ifndef GL_SGIS_texture_filter4 #define GL_SGIS_texture_filter4 1 typedef void (GLAPIENTRY * PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat* weights); typedef void (GLAPIENTRY * PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat* weights); #define glGetTexFilterFuncSGIS GLEW_GET_FUN(__glewGetTexFilterFuncSGIS) #define glTexFilterFuncSGIS GLEW_GET_FUN(__glewTexFilterFuncSGIS) #define GLEW_SGIS_texture_filter4 GLEW_GET_VAR(__GLEW_SGIS_texture_filter4) #endif /* GL_SGIS_texture_filter4 */ /* -------------------------- GL_SGIS_texture_lod -------------------------- */ #ifndef GL_SGIS_texture_lod #define GL_SGIS_texture_lod 1 #define GL_TEXTURE_MIN_LOD_SGIS 0x813A #define GL_TEXTURE_MAX_LOD_SGIS 0x813B #define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C #define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D #define GLEW_SGIS_texture_lod GLEW_GET_VAR(__GLEW_SGIS_texture_lod) #endif /* GL_SGIS_texture_lod */ /* ------------------------- GL_SGIS_texture_select ------------------------ */ #ifndef GL_SGIS_texture_select #define GL_SGIS_texture_select 1 #define GLEW_SGIS_texture_select GLEW_GET_VAR(__GLEW_SGIS_texture_select) #endif /* GL_SGIS_texture_select */ /* ----------------------------- GL_SGIX_async ----------------------------- */ #ifndef GL_SGIX_async #define GL_SGIX_async 1 #define GL_ASYNC_MARKER_SGIX 0x8329 typedef void (GLAPIENTRY * PFNGLASYNCMARKERSGIXPROC) (GLuint marker); typedef void (GLAPIENTRY * PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range); typedef GLint (GLAPIENTRY * PFNGLFINISHASYNCSGIXPROC) (GLuint* markerp); typedef GLuint (GLAPIENTRY * PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range); typedef GLboolean (GLAPIENTRY * PFNGLISASYNCMARKERSGIXPROC) (GLuint marker); typedef GLint (GLAPIENTRY * PFNGLPOLLASYNCSGIXPROC) (GLuint* markerp); #define glAsyncMarkerSGIX GLEW_GET_FUN(__glewAsyncMarkerSGIX) #define glDeleteAsyncMarkersSGIX GLEW_GET_FUN(__glewDeleteAsyncMarkersSGIX) #define glFinishAsyncSGIX GLEW_GET_FUN(__glewFinishAsyncSGIX) #define glGenAsyncMarkersSGIX GLEW_GET_FUN(__glewGenAsyncMarkersSGIX) #define glIsAsyncMarkerSGIX GLEW_GET_FUN(__glewIsAsyncMarkerSGIX) #define glPollAsyncSGIX GLEW_GET_FUN(__glewPollAsyncSGIX) #define GLEW_SGIX_async GLEW_GET_VAR(__GLEW_SGIX_async) #endif /* GL_SGIX_async */ /* ------------------------ GL_SGIX_async_histogram ------------------------ */ #ifndef GL_SGIX_async_histogram #define GL_SGIX_async_histogram 1 #define GL_ASYNC_HISTOGRAM_SGIX 0x832C #define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D #define GLEW_SGIX_async_histogram GLEW_GET_VAR(__GLEW_SGIX_async_histogram) #endif /* GL_SGIX_async_histogram */ /* -------------------------- GL_SGIX_async_pixel -------------------------- */ #ifndef GL_SGIX_async_pixel #define GL_SGIX_async_pixel 1 #define GL_ASYNC_TEX_IMAGE_SGIX 0x835C #define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D #define GL_ASYNC_READ_PIXELS_SGIX 0x835E #define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F #define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 #define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 #define GLEW_SGIX_async_pixel GLEW_GET_VAR(__GLEW_SGIX_async_pixel) #endif /* GL_SGIX_async_pixel */ /* ----------------------- GL_SGIX_blend_alpha_minmax ---------------------- */ #ifndef GL_SGIX_blend_alpha_minmax #define GL_SGIX_blend_alpha_minmax 1 #define GL_ALPHA_MIN_SGIX 0x8320 #define GL_ALPHA_MAX_SGIX 0x8321 #define GLEW_SGIX_blend_alpha_minmax GLEW_GET_VAR(__GLEW_SGIX_blend_alpha_minmax) #endif /* GL_SGIX_blend_alpha_minmax */ /* ---------------------------- GL_SGIX_clipmap ---------------------------- */ #ifndef GL_SGIX_clipmap #define GL_SGIX_clipmap 1 #define GLEW_SGIX_clipmap GLEW_GET_VAR(__GLEW_SGIX_clipmap) #endif /* GL_SGIX_clipmap */ /* ---------------------- GL_SGIX_convolution_accuracy --------------------- */ #ifndef GL_SGIX_convolution_accuracy #define GL_SGIX_convolution_accuracy 1 #define GL_CONVOLUTION_HINT_SGIX 0x8316 #define GLEW_SGIX_convolution_accuracy GLEW_GET_VAR(__GLEW_SGIX_convolution_accuracy) #endif /* GL_SGIX_convolution_accuracy */ /* ------------------------- GL_SGIX_depth_texture ------------------------- */ #ifndef GL_SGIX_depth_texture #define GL_SGIX_depth_texture 1 #define GL_DEPTH_COMPONENT16_SGIX 0x81A5 #define GL_DEPTH_COMPONENT24_SGIX 0x81A6 #define GL_DEPTH_COMPONENT32_SGIX 0x81A7 #define GLEW_SGIX_depth_texture GLEW_GET_VAR(__GLEW_SGIX_depth_texture) #endif /* GL_SGIX_depth_texture */ /* -------------------------- GL_SGIX_flush_raster ------------------------- */ #ifndef GL_SGIX_flush_raster #define GL_SGIX_flush_raster 1 typedef void (GLAPIENTRY * PFNGLFLUSHRASTERSGIXPROC) (void); #define glFlushRasterSGIX GLEW_GET_FUN(__glewFlushRasterSGIX) #define GLEW_SGIX_flush_raster GLEW_GET_VAR(__GLEW_SGIX_flush_raster) #endif /* GL_SGIX_flush_raster */ /* --------------------------- GL_SGIX_fog_offset -------------------------- */ #ifndef GL_SGIX_fog_offset #define GL_SGIX_fog_offset 1 #define GL_FOG_OFFSET_SGIX 0x8198 #define GL_FOG_OFFSET_VALUE_SGIX 0x8199 #define GLEW_SGIX_fog_offset GLEW_GET_VAR(__GLEW_SGIX_fog_offset) #endif /* GL_SGIX_fog_offset */ /* -------------------------- GL_SGIX_fog_texture -------------------------- */ #ifndef GL_SGIX_fog_texture #define GL_SGIX_fog_texture 1 #define GL_TEXTURE_FOG_SGIX 0 #define GL_FOG_PATCHY_FACTOR_SGIX 0 #define GL_FRAGMENT_FOG_SGIX 0 typedef void (GLAPIENTRY * PFNGLTEXTUREFOGSGIXPROC) (GLenum pname); #define glTextureFogSGIX GLEW_GET_FUN(__glewTextureFogSGIX) #define GLEW_SGIX_fog_texture GLEW_GET_VAR(__GLEW_SGIX_fog_texture) #endif /* GL_SGIX_fog_texture */ /* ------------------- GL_SGIX_fragment_specular_lighting ------------------ */ #ifndef GL_SGIX_fragment_specular_lighting #define GL_SGIX_fragment_specular_lighting 1 typedef void (GLAPIENTRY * PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode); typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param); typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param); typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param); typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param); typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, const GLfloat param); typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, const GLint param); typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint* params); typedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum value, GLfloat* data); typedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum value, GLint* data); typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat* data); typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint* data); #define glFragmentColorMaterialSGIX GLEW_GET_FUN(__glewFragmentColorMaterialSGIX) #define glFragmentLightModelfSGIX GLEW_GET_FUN(__glewFragmentLightModelfSGIX) #define glFragmentLightModelfvSGIX GLEW_GET_FUN(__glewFragmentLightModelfvSGIX) #define glFragmentLightModeliSGIX GLEW_GET_FUN(__glewFragmentLightModeliSGIX) #define glFragmentLightModelivSGIX GLEW_GET_FUN(__glewFragmentLightModelivSGIX) #define glFragmentLightfSGIX GLEW_GET_FUN(__glewFragmentLightfSGIX) #define glFragmentLightfvSGIX GLEW_GET_FUN(__glewFragmentLightfvSGIX) #define glFragmentLightiSGIX GLEW_GET_FUN(__glewFragmentLightiSGIX) #define glFragmentLightivSGIX GLEW_GET_FUN(__glewFragmentLightivSGIX) #define glFragmentMaterialfSGIX GLEW_GET_FUN(__glewFragmentMaterialfSGIX) #define glFragmentMaterialfvSGIX GLEW_GET_FUN(__glewFragmentMaterialfvSGIX) #define glFragmentMaterialiSGIX GLEW_GET_FUN(__glewFragmentMaterialiSGIX) #define glFragmentMaterialivSGIX GLEW_GET_FUN(__glewFragmentMaterialivSGIX) #define glGetFragmentLightfvSGIX GLEW_GET_FUN(__glewGetFragmentLightfvSGIX) #define glGetFragmentLightivSGIX GLEW_GET_FUN(__glewGetFragmentLightivSGIX) #define glGetFragmentMaterialfvSGIX GLEW_GET_FUN(__glewGetFragmentMaterialfvSGIX) #define glGetFragmentMaterialivSGIX GLEW_GET_FUN(__glewGetFragmentMaterialivSGIX) #define GLEW_SGIX_fragment_specular_lighting GLEW_GET_VAR(__GLEW_SGIX_fragment_specular_lighting) #endif /* GL_SGIX_fragment_specular_lighting */ /* --------------------------- GL_SGIX_framezoom --------------------------- */ #ifndef GL_SGIX_framezoom #define GL_SGIX_framezoom 1 typedef void (GLAPIENTRY * PFNGLFRAMEZOOMSGIXPROC) (GLint factor); #define glFrameZoomSGIX GLEW_GET_FUN(__glewFrameZoomSGIX) #define GLEW_SGIX_framezoom GLEW_GET_VAR(__GLEW_SGIX_framezoom) #endif /* GL_SGIX_framezoom */ /* --------------------------- GL_SGIX_interlace --------------------------- */ #ifndef GL_SGIX_interlace #define GL_SGIX_interlace 1 #define GL_INTERLACE_SGIX 0x8094 #define GLEW_SGIX_interlace GLEW_GET_VAR(__GLEW_SGIX_interlace) #endif /* GL_SGIX_interlace */ /* ------------------------- GL_SGIX_ir_instrument1 ------------------------ */ #ifndef GL_SGIX_ir_instrument1 #define GL_SGIX_ir_instrument1 1 #define GLEW_SGIX_ir_instrument1 GLEW_GET_VAR(__GLEW_SGIX_ir_instrument1) #endif /* GL_SGIX_ir_instrument1 */ /* ------------------------- GL_SGIX_list_priority ------------------------- */ #ifndef GL_SGIX_list_priority #define GL_SGIX_list_priority 1 #define GLEW_SGIX_list_priority GLEW_GET_VAR(__GLEW_SGIX_list_priority) #endif /* GL_SGIX_list_priority */ /* ------------------------- GL_SGIX_pixel_texture ------------------------- */ #ifndef GL_SGIX_pixel_texture #define GL_SGIX_pixel_texture 1 typedef void (GLAPIENTRY * PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); #define glPixelTexGenSGIX GLEW_GET_FUN(__glewPixelTexGenSGIX) #define GLEW_SGIX_pixel_texture GLEW_GET_VAR(__GLEW_SGIX_pixel_texture) #endif /* GL_SGIX_pixel_texture */ /* ----------------------- GL_SGIX_pixel_texture_bits ---------------------- */ #ifndef GL_SGIX_pixel_texture_bits #define GL_SGIX_pixel_texture_bits 1 #define GLEW_SGIX_pixel_texture_bits GLEW_GET_VAR(__GLEW_SGIX_pixel_texture_bits) #endif /* GL_SGIX_pixel_texture_bits */ /* ------------------------ GL_SGIX_reference_plane ------------------------ */ #ifndef GL_SGIX_reference_plane #define GL_SGIX_reference_plane 1 typedef void (GLAPIENTRY * PFNGLREFERENCEPLANESGIXPROC) (const GLdouble* equation); #define glReferencePlaneSGIX GLEW_GET_FUN(__glewReferencePlaneSGIX) #define GLEW_SGIX_reference_plane GLEW_GET_VAR(__GLEW_SGIX_reference_plane) #endif /* GL_SGIX_reference_plane */ /* ---------------------------- GL_SGIX_resample --------------------------- */ #ifndef GL_SGIX_resample #define GL_SGIX_resample 1 #define GL_PACK_RESAMPLE_SGIX 0x842E #define GL_UNPACK_RESAMPLE_SGIX 0x842F #define GL_RESAMPLE_DECIMATE_SGIX 0x8430 #define GL_RESAMPLE_REPLICATE_SGIX 0x8433 #define GL_RESAMPLE_ZERO_FILL_SGIX 0x8434 #define GLEW_SGIX_resample GLEW_GET_VAR(__GLEW_SGIX_resample) #endif /* GL_SGIX_resample */ /* ----------------------------- GL_SGIX_shadow ---------------------------- */ #ifndef GL_SGIX_shadow #define GL_SGIX_shadow 1 #define GL_TEXTURE_COMPARE_SGIX 0x819A #define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B #define GL_TEXTURE_LEQUAL_R_SGIX 0x819C #define GL_TEXTURE_GEQUAL_R_SGIX 0x819D #define GLEW_SGIX_shadow GLEW_GET_VAR(__GLEW_SGIX_shadow) #endif /* GL_SGIX_shadow */ /* ------------------------- GL_SGIX_shadow_ambient ------------------------ */ #ifndef GL_SGIX_shadow_ambient #define GL_SGIX_shadow_ambient 1 #define GL_SHADOW_AMBIENT_SGIX 0x80BF #define GLEW_SGIX_shadow_ambient GLEW_GET_VAR(__GLEW_SGIX_shadow_ambient) #endif /* GL_SGIX_shadow_ambient */ /* ----------------------------- GL_SGIX_sprite ---------------------------- */ #ifndef GL_SGIX_sprite #define GL_SGIX_sprite 1 typedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param); typedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param); typedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, GLint* params); #define glSpriteParameterfSGIX GLEW_GET_FUN(__glewSpriteParameterfSGIX) #define glSpriteParameterfvSGIX GLEW_GET_FUN(__glewSpriteParameterfvSGIX) #define glSpriteParameteriSGIX GLEW_GET_FUN(__glewSpriteParameteriSGIX) #define glSpriteParameterivSGIX GLEW_GET_FUN(__glewSpriteParameterivSGIX) #define GLEW_SGIX_sprite GLEW_GET_VAR(__GLEW_SGIX_sprite) #endif /* GL_SGIX_sprite */ /* ----------------------- GL_SGIX_tag_sample_buffer ----------------------- */ #ifndef GL_SGIX_tag_sample_buffer #define GL_SGIX_tag_sample_buffer 1 typedef void (GLAPIENTRY * PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); #define glTagSampleBufferSGIX GLEW_GET_FUN(__glewTagSampleBufferSGIX) #define GLEW_SGIX_tag_sample_buffer GLEW_GET_VAR(__GLEW_SGIX_tag_sample_buffer) #endif /* GL_SGIX_tag_sample_buffer */ /* ------------------------ GL_SGIX_texture_add_env ------------------------ */ #ifndef GL_SGIX_texture_add_env #define GL_SGIX_texture_add_env 1 #define GLEW_SGIX_texture_add_env GLEW_GET_VAR(__GLEW_SGIX_texture_add_env) #endif /* GL_SGIX_texture_add_env */ /* -------------------- GL_SGIX_texture_coordinate_clamp ------------------- */ #ifndef GL_SGIX_texture_coordinate_clamp #define GL_SGIX_texture_coordinate_clamp 1 #define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 #define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A #define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B #define GLEW_SGIX_texture_coordinate_clamp GLEW_GET_VAR(__GLEW_SGIX_texture_coordinate_clamp) #endif /* GL_SGIX_texture_coordinate_clamp */ /* ------------------------ GL_SGIX_texture_lod_bias ----------------------- */ #ifndef GL_SGIX_texture_lod_bias #define GL_SGIX_texture_lod_bias 1 #define GLEW_SGIX_texture_lod_bias GLEW_GET_VAR(__GLEW_SGIX_texture_lod_bias) #endif /* GL_SGIX_texture_lod_bias */ /* ---------------------- GL_SGIX_texture_multi_buffer --------------------- */ #ifndef GL_SGIX_texture_multi_buffer #define GL_SGIX_texture_multi_buffer 1 #define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E #define GLEW_SGIX_texture_multi_buffer GLEW_GET_VAR(__GLEW_SGIX_texture_multi_buffer) #endif /* GL_SGIX_texture_multi_buffer */ /* ------------------------- GL_SGIX_texture_range ------------------------- */ #ifndef GL_SGIX_texture_range #define GL_SGIX_texture_range 1 #define GL_RGB_SIGNED_SGIX 0x85E0 #define GL_RGBA_SIGNED_SGIX 0x85E1 #define GL_ALPHA_SIGNED_SGIX 0x85E2 #define GL_LUMINANCE_SIGNED_SGIX 0x85E3 #define GL_INTENSITY_SIGNED_SGIX 0x85E4 #define GL_LUMINANCE_ALPHA_SIGNED_SGIX 0x85E5 #define GL_RGB16_SIGNED_SGIX 0x85E6 #define GL_RGBA16_SIGNED_SGIX 0x85E7 #define GL_ALPHA16_SIGNED_SGIX 0x85E8 #define GL_LUMINANCE16_SIGNED_SGIX 0x85E9 #define GL_INTENSITY16_SIGNED_SGIX 0x85EA #define GL_LUMINANCE16_ALPHA16_SIGNED_SGIX 0x85EB #define GL_RGB_EXTENDED_RANGE_SGIX 0x85EC #define GL_RGBA_EXTENDED_RANGE_SGIX 0x85ED #define GL_ALPHA_EXTENDED_RANGE_SGIX 0x85EE #define GL_LUMINANCE_EXTENDED_RANGE_SGIX 0x85EF #define GL_INTENSITY_EXTENDED_RANGE_SGIX 0x85F0 #define GL_LUMINANCE_ALPHA_EXTENDED_RANGE_SGIX 0x85F1 #define GL_RGB16_EXTENDED_RANGE_SGIX 0x85F2 #define GL_RGBA16_EXTENDED_RANGE_SGIX 0x85F3 #define GL_ALPHA16_EXTENDED_RANGE_SGIX 0x85F4 #define GL_LUMINANCE16_EXTENDED_RANGE_SGIX 0x85F5 #define GL_INTENSITY16_EXTENDED_RANGE_SGIX 0x85F6 #define GL_LUMINANCE16_ALPHA16_EXTENDED_RANGE_SGIX 0x85F7 #define GL_MIN_LUMINANCE_SGIS 0x85F8 #define GL_MAX_LUMINANCE_SGIS 0x85F9 #define GL_MIN_INTENSITY_SGIS 0x85FA #define GL_MAX_INTENSITY_SGIS 0x85FB #define GLEW_SGIX_texture_range GLEW_GET_VAR(__GLEW_SGIX_texture_range) #endif /* GL_SGIX_texture_range */ /* ----------------------- GL_SGIX_texture_scale_bias ---------------------- */ #ifndef GL_SGIX_texture_scale_bias #define GL_SGIX_texture_scale_bias 1 #define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 #define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A #define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B #define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C #define GLEW_SGIX_texture_scale_bias GLEW_GET_VAR(__GLEW_SGIX_texture_scale_bias) #endif /* GL_SGIX_texture_scale_bias */ /* ------------------------- GL_SGIX_vertex_preclip ------------------------ */ #ifndef GL_SGIX_vertex_preclip #define GL_SGIX_vertex_preclip 1 #define GL_VERTEX_PRECLIP_SGIX 0x83EE #define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF #define GLEW_SGIX_vertex_preclip GLEW_GET_VAR(__GLEW_SGIX_vertex_preclip) #endif /* GL_SGIX_vertex_preclip */ /* ---------------------- GL_SGIX_vertex_preclip_hint ---------------------- */ #ifndef GL_SGIX_vertex_preclip_hint #define GL_SGIX_vertex_preclip_hint 1 #define GL_VERTEX_PRECLIP_SGIX 0x83EE #define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF #define GLEW_SGIX_vertex_preclip_hint GLEW_GET_VAR(__GLEW_SGIX_vertex_preclip_hint) #endif /* GL_SGIX_vertex_preclip_hint */ /* ----------------------------- GL_SGIX_ycrcb ----------------------------- */ #ifndef GL_SGIX_ycrcb #define GL_SGIX_ycrcb 1 #define GLEW_SGIX_ycrcb GLEW_GET_VAR(__GLEW_SGIX_ycrcb) #endif /* GL_SGIX_ycrcb */ /* -------------------------- GL_SGI_color_matrix -------------------------- */ #ifndef GL_SGI_color_matrix #define GL_SGI_color_matrix 1 #define GL_COLOR_MATRIX_SGI 0x80B1 #define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 #define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 #define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 #define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 #define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 #define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 #define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 #define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 #define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA #define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB #define GLEW_SGI_color_matrix GLEW_GET_VAR(__GLEW_SGI_color_matrix) #endif /* GL_SGI_color_matrix */ /* --------------------------- GL_SGI_color_table -------------------------- */ #ifndef GL_SGI_color_table #define GL_SGI_color_table 1 #define GL_COLOR_TABLE_SGI 0x80D0 #define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 #define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 #define GL_PROXY_COLOR_TABLE_SGI 0x80D3 #define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 #define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 #define GL_COLOR_TABLE_SCALE_SGI 0x80D6 #define GL_COLOR_TABLE_BIAS_SGI 0x80D7 #define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 #define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 #define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA #define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB #define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC #define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD #define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE #define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF typedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat* params); typedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint* params); typedef void (GLAPIENTRY * PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void* table); typedef void (GLAPIENTRY * PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat* params); typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint* params); typedef void (GLAPIENTRY * PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, void* table); #define glColorTableParameterfvSGI GLEW_GET_FUN(__glewColorTableParameterfvSGI) #define glColorTableParameterivSGI GLEW_GET_FUN(__glewColorTableParameterivSGI) #define glColorTableSGI GLEW_GET_FUN(__glewColorTableSGI) #define glCopyColorTableSGI GLEW_GET_FUN(__glewCopyColorTableSGI) #define glGetColorTableParameterfvSGI GLEW_GET_FUN(__glewGetColorTableParameterfvSGI) #define glGetColorTableParameterivSGI GLEW_GET_FUN(__glewGetColorTableParameterivSGI) #define glGetColorTableSGI GLEW_GET_FUN(__glewGetColorTableSGI) #define GLEW_SGI_color_table GLEW_GET_VAR(__GLEW_SGI_color_table) #endif /* GL_SGI_color_table */ /* ----------------------- GL_SGI_texture_color_table ---------------------- */ #ifndef GL_SGI_texture_color_table #define GL_SGI_texture_color_table 1 #define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC #define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD #define GLEW_SGI_texture_color_table GLEW_GET_VAR(__GLEW_SGI_texture_color_table) #endif /* GL_SGI_texture_color_table */ /* ------------------------- GL_SUNX_constant_data ------------------------- */ #ifndef GL_SUNX_constant_data #define GL_SUNX_constant_data 1 #define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 #define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 typedef void (GLAPIENTRY * PFNGLFINISHTEXTURESUNXPROC) (void); #define glFinishTextureSUNX GLEW_GET_FUN(__glewFinishTextureSUNX) #define GLEW_SUNX_constant_data GLEW_GET_VAR(__GLEW_SUNX_constant_data) #endif /* GL_SUNX_constant_data */ /* -------------------- GL_SUN_convolution_border_modes -------------------- */ #ifndef GL_SUN_convolution_border_modes #define GL_SUN_convolution_border_modes 1 #define GL_WRAP_BORDER_SUN 0x81D4 #define GLEW_SUN_convolution_border_modes GLEW_GET_VAR(__GLEW_SUN_convolution_border_modes) #endif /* GL_SUN_convolution_border_modes */ /* -------------------------- GL_SUN_global_alpha -------------------------- */ #ifndef GL_SUN_global_alpha #define GL_SUN_global_alpha 1 #define GL_GLOBAL_ALPHA_SUN 0x81D9 #define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor); typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor); typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor); typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor); typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor); typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor); typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor); typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor); #define glGlobalAlphaFactorbSUN GLEW_GET_FUN(__glewGlobalAlphaFactorbSUN) #define glGlobalAlphaFactordSUN GLEW_GET_FUN(__glewGlobalAlphaFactordSUN) #define glGlobalAlphaFactorfSUN GLEW_GET_FUN(__glewGlobalAlphaFactorfSUN) #define glGlobalAlphaFactoriSUN GLEW_GET_FUN(__glewGlobalAlphaFactoriSUN) #define glGlobalAlphaFactorsSUN GLEW_GET_FUN(__glewGlobalAlphaFactorsSUN) #define glGlobalAlphaFactorubSUN GLEW_GET_FUN(__glewGlobalAlphaFactorubSUN) #define glGlobalAlphaFactoruiSUN GLEW_GET_FUN(__glewGlobalAlphaFactoruiSUN) #define glGlobalAlphaFactorusSUN GLEW_GET_FUN(__glewGlobalAlphaFactorusSUN) #define GLEW_SUN_global_alpha GLEW_GET_VAR(__GLEW_SUN_global_alpha) #endif /* GL_SUN_global_alpha */ /* --------------------------- GL_SUN_mesh_array --------------------------- */ #ifndef GL_SUN_mesh_array #define GL_SUN_mesh_array 1 #define GL_QUAD_MESH_SUN 0x8614 #define GL_TRIANGLE_MESH_SUN 0x8615 #define GLEW_SUN_mesh_array GLEW_GET_VAR(__GLEW_SUN_mesh_array) #endif /* GL_SUN_mesh_array */ /* ------------------------ GL_SUN_read_video_pixels ----------------------- */ #ifndef GL_SUN_read_video_pixels #define GL_SUN_read_video_pixels 1 typedef void (GLAPIENTRY * PFNGLREADVIDEOPIXELSSUNPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); #define glReadVideoPixelsSUN GLEW_GET_FUN(__glewReadVideoPixelsSUN) #define GLEW_SUN_read_video_pixels GLEW_GET_VAR(__GLEW_SUN_read_video_pixels) #endif /* GL_SUN_read_video_pixels */ /* --------------------------- GL_SUN_slice_accum -------------------------- */ #ifndef GL_SUN_slice_accum #define GL_SUN_slice_accum 1 #define GL_SLICE_ACCUM_SUN 0x85CC #define GLEW_SUN_slice_accum GLEW_GET_VAR(__GLEW_SUN_slice_accum) #endif /* GL_SUN_slice_accum */ /* -------------------------- GL_SUN_triangle_list ------------------------- */ #ifndef GL_SUN_triangle_list #define GL_SUN_triangle_list 1 #define GL_RESTART_SUN 0x01 #define GL_REPLACE_MIDDLE_SUN 0x02 #define GL_REPLACE_OLDEST_SUN 0x03 #define GL_TRIANGLE_LIST_SUN 0x81D7 #define GL_REPLACEMENT_CODE_SUN 0x81D8 #define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 #define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 #define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 #define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 #define GL_R1UI_V3F_SUN 0x85C4 #define GL_R1UI_C4UB_V3F_SUN 0x85C5 #define GL_R1UI_C3F_V3F_SUN 0x85C6 #define GL_R1UI_N3F_V3F_SUN 0x85C7 #define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 #define GL_R1UI_T2F_V3F_SUN 0x85C9 #define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA #define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const void* pointer); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte* code); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint* code); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort* code); #define glReplacementCodePointerSUN GLEW_GET_FUN(__glewReplacementCodePointerSUN) #define glReplacementCodeubSUN GLEW_GET_FUN(__glewReplacementCodeubSUN) #define glReplacementCodeubvSUN GLEW_GET_FUN(__glewReplacementCodeubvSUN) #define glReplacementCodeuiSUN GLEW_GET_FUN(__glewReplacementCodeuiSUN) #define glReplacementCodeuivSUN GLEW_GET_FUN(__glewReplacementCodeuivSUN) #define glReplacementCodeusSUN GLEW_GET_FUN(__glewReplacementCodeusSUN) #define glReplacementCodeusvSUN GLEW_GET_FUN(__glewReplacementCodeusvSUN) #define GLEW_SUN_triangle_list GLEW_GET_VAR(__GLEW_SUN_triangle_list) #endif /* GL_SUN_triangle_list */ /* ----------------------------- GL_SUN_vertex ----------------------------- */ #ifndef GL_SUN_vertex #define GL_SUN_vertex 1 typedef void (GLAPIENTRY * PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat* c, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* c, const GLfloat *n, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); typedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte* c, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte* c, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* n, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *c, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint* rc, const GLubyte *c, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *n, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *tc, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *c, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat* tc, const GLubyte *c, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *n, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); typedef void (GLAPIENTRY * PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (GLAPIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat* tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); typedef void (GLAPIENTRY * PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (GLAPIENTRY * PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat* tc, const GLfloat *v); #define glColor3fVertex3fSUN GLEW_GET_FUN(__glewColor3fVertex3fSUN) #define glColor3fVertex3fvSUN GLEW_GET_FUN(__glewColor3fVertex3fvSUN) #define glColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewColor4fNormal3fVertex3fSUN) #define glColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewColor4fNormal3fVertex3fvSUN) #define glColor4ubVertex2fSUN GLEW_GET_FUN(__glewColor4ubVertex2fSUN) #define glColor4ubVertex2fvSUN GLEW_GET_FUN(__glewColor4ubVertex2fvSUN) #define glColor4ubVertex3fSUN GLEW_GET_FUN(__glewColor4ubVertex3fSUN) #define glColor4ubVertex3fvSUN GLEW_GET_FUN(__glewColor4ubVertex3fvSUN) #define glNormal3fVertex3fSUN GLEW_GET_FUN(__glewNormal3fVertex3fSUN) #define glNormal3fVertex3fvSUN GLEW_GET_FUN(__glewNormal3fVertex3fvSUN) #define glReplacementCodeuiColor3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiColor3fVertex3fSUN) #define glReplacementCodeuiColor3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiColor3fVertex3fvSUN) #define glReplacementCodeuiColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4fNormal3fVertex3fSUN) #define glReplacementCodeuiColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4fNormal3fVertex3fvSUN) #define glReplacementCodeuiColor4ubVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4ubVertex3fSUN) #define glReplacementCodeuiColor4ubVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4ubVertex3fvSUN) #define glReplacementCodeuiNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiNormal3fVertex3fSUN) #define glReplacementCodeuiNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiNormal3fVertex3fvSUN) #define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN) #define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN) #define glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fNormal3fVertex3fSUN) #define glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN) #define glReplacementCodeuiTexCoord2fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fVertex3fSUN) #define glReplacementCodeuiTexCoord2fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fVertex3fvSUN) #define glReplacementCodeuiVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiVertex3fSUN) #define glReplacementCodeuiVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiVertex3fvSUN) #define glTexCoord2fColor3fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fColor3fVertex3fSUN) #define glTexCoord2fColor3fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fColor3fVertex3fvSUN) #define glTexCoord2fColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fColor4fNormal3fVertex3fSUN) #define glTexCoord2fColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fColor4fNormal3fVertex3fvSUN) #define glTexCoord2fColor4ubVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fColor4ubVertex3fSUN) #define glTexCoord2fColor4ubVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fColor4ubVertex3fvSUN) #define glTexCoord2fNormal3fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fNormal3fVertex3fSUN) #define glTexCoord2fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fNormal3fVertex3fvSUN) #define glTexCoord2fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fVertex3fSUN) #define glTexCoord2fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fVertex3fvSUN) #define glTexCoord4fColor4fNormal3fVertex4fSUN GLEW_GET_FUN(__glewTexCoord4fColor4fNormal3fVertex4fSUN) #define glTexCoord4fColor4fNormal3fVertex4fvSUN GLEW_GET_FUN(__glewTexCoord4fColor4fNormal3fVertex4fvSUN) #define glTexCoord4fVertex4fSUN GLEW_GET_FUN(__glewTexCoord4fVertex4fSUN) #define glTexCoord4fVertex4fvSUN GLEW_GET_FUN(__glewTexCoord4fVertex4fvSUN) #define GLEW_SUN_vertex GLEW_GET_VAR(__GLEW_SUN_vertex) #endif /* GL_SUN_vertex */ /* -------------------------- GL_WIN_phong_shading ------------------------- */ #ifndef GL_WIN_phong_shading #define GL_WIN_phong_shading 1 #define GL_PHONG_WIN 0x80EA #define GL_PHONG_HINT_WIN 0x80EB #define GLEW_WIN_phong_shading GLEW_GET_VAR(__GLEW_WIN_phong_shading) #endif /* GL_WIN_phong_shading */ /* -------------------------- GL_WIN_specular_fog -------------------------- */ #ifndef GL_WIN_specular_fog #define GL_WIN_specular_fog 1 #define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC #define GLEW_WIN_specular_fog GLEW_GET_VAR(__GLEW_WIN_specular_fog) #endif /* GL_WIN_specular_fog */ /* ---------------------------- GL_WIN_swap_hint --------------------------- */ #ifndef GL_WIN_swap_hint #define GL_WIN_swap_hint 1 typedef void (GLAPIENTRY * PFNGLADDSWAPHINTRECTWINPROC) (GLint x, GLint y, GLsizei width, GLsizei height); #define glAddSwapHintRectWIN GLEW_GET_FUN(__glewAddSwapHintRectWIN) #define GLEW_WIN_swap_hint GLEW_GET_VAR(__GLEW_WIN_swap_hint) #endif /* GL_WIN_swap_hint */ /* ------------------------------------------------------------------------- */ #if defined(GLEW_MX) && defined(_WIN32) #define GLEW_FUN_EXPORT #else #define GLEW_FUN_EXPORT GLEWAPI #endif /* GLEW_MX */ #if defined(GLEW_MX) #define GLEW_VAR_EXPORT #else #define GLEW_VAR_EXPORT GLEWAPI #endif /* GLEW_MX */ #if defined(GLEW_MX) && defined(_WIN32) struct GLEWContextStruct { #endif /* GLEW_MX */ GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE3DPROC __glewCopyTexSubImage3D; GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTSPROC __glewDrawRangeElements; GLEW_FUN_EXPORT PFNGLTEXIMAGE3DPROC __glewTexImage3D; GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE3DPROC __glewTexSubImage3D; GLEW_FUN_EXPORT PFNGLACTIVETEXTUREPROC __glewActiveTexture; GLEW_FUN_EXPORT PFNGLCLIENTACTIVETEXTUREPROC __glewClientActiveTexture; GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE1DPROC __glewCompressedTexImage1D; GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE2DPROC __glewCompressedTexImage2D; GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE3DPROC __glewCompressedTexImage3D; GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC __glewCompressedTexSubImage1D; GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC __glewCompressedTexSubImage2D; GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC __glewCompressedTexSubImage3D; GLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXIMAGEPROC __glewGetCompressedTexImage; GLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXDPROC __glewLoadTransposeMatrixd; GLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXFPROC __glewLoadTransposeMatrixf; GLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXDPROC __glewMultTransposeMatrixd; GLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXFPROC __glewMultTransposeMatrixf; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DPROC __glewMultiTexCoord1d; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DVPROC __glewMultiTexCoord1dv; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FPROC __glewMultiTexCoord1f; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FVPROC __glewMultiTexCoord1fv; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IPROC __glewMultiTexCoord1i; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IVPROC __glewMultiTexCoord1iv; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SPROC __glewMultiTexCoord1s; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SVPROC __glewMultiTexCoord1sv; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DPROC __glewMultiTexCoord2d; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DVPROC __glewMultiTexCoord2dv; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FPROC __glewMultiTexCoord2f; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FVPROC __glewMultiTexCoord2fv; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IPROC __glewMultiTexCoord2i; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IVPROC __glewMultiTexCoord2iv; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SPROC __glewMultiTexCoord2s; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SVPROC __glewMultiTexCoord2sv; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DPROC __glewMultiTexCoord3d; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DVPROC __glewMultiTexCoord3dv; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FPROC __glewMultiTexCoord3f; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FVPROC __glewMultiTexCoord3fv; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IPROC __glewMultiTexCoord3i; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IVPROC __glewMultiTexCoord3iv; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SPROC __glewMultiTexCoord3s; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SVPROC __glewMultiTexCoord3sv; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DPROC __glewMultiTexCoord4d; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DVPROC __glewMultiTexCoord4dv; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FPROC __glewMultiTexCoord4f; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FVPROC __glewMultiTexCoord4fv; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IPROC __glewMultiTexCoord4i; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IVPROC __glewMultiTexCoord4iv; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SPROC __glewMultiTexCoord4s; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SVPROC __glewMultiTexCoord4sv; GLEW_FUN_EXPORT PFNGLSAMPLECOVERAGEPROC __glewSampleCoverage; GLEW_FUN_EXPORT PFNGLBLENDCOLORPROC __glewBlendColor; GLEW_FUN_EXPORT PFNGLBLENDEQUATIONPROC __glewBlendEquation; GLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEPROC __glewBlendFuncSeparate; GLEW_FUN_EXPORT PFNGLFOGCOORDPOINTERPROC __glewFogCoordPointer; GLEW_FUN_EXPORT PFNGLFOGCOORDDPROC __glewFogCoordd; GLEW_FUN_EXPORT PFNGLFOGCOORDDVPROC __glewFogCoorddv; GLEW_FUN_EXPORT PFNGLFOGCOORDFPROC __glewFogCoordf; GLEW_FUN_EXPORT PFNGLFOGCOORDFVPROC __glewFogCoordfv; GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSPROC __glewMultiDrawArrays; GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSPROC __glewMultiDrawElements; GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFPROC __glewPointParameterf; GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFVPROC __glewPointParameterfv; GLEW_FUN_EXPORT PFNGLPOINTPARAMETERIPROC __glewPointParameteri; GLEW_FUN_EXPORT PFNGLPOINTPARAMETERIVPROC __glewPointParameteriv; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BPROC __glewSecondaryColor3b; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BVPROC __glewSecondaryColor3bv; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DPROC __glewSecondaryColor3d; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DVPROC __glewSecondaryColor3dv; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FPROC __glewSecondaryColor3f; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FVPROC __glewSecondaryColor3fv; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IPROC __glewSecondaryColor3i; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IVPROC __glewSecondaryColor3iv; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SPROC __glewSecondaryColor3s; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SVPROC __glewSecondaryColor3sv; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBPROC __glewSecondaryColor3ub; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBVPROC __glewSecondaryColor3ubv; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIPROC __glewSecondaryColor3ui; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIVPROC __glewSecondaryColor3uiv; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USPROC __glewSecondaryColor3us; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USVPROC __glewSecondaryColor3usv; GLEW_FUN_EXPORT PFNGLSECONDARYCOLORPOINTERPROC __glewSecondaryColorPointer; GLEW_FUN_EXPORT PFNGLWINDOWPOS2DPROC __glewWindowPos2d; GLEW_FUN_EXPORT PFNGLWINDOWPOS2DVPROC __glewWindowPos2dv; GLEW_FUN_EXPORT PFNGLWINDOWPOS2FPROC __glewWindowPos2f; GLEW_FUN_EXPORT PFNGLWINDOWPOS2FVPROC __glewWindowPos2fv; GLEW_FUN_EXPORT PFNGLWINDOWPOS2IPROC __glewWindowPos2i; GLEW_FUN_EXPORT PFNGLWINDOWPOS2IVPROC __glewWindowPos2iv; GLEW_FUN_EXPORT PFNGLWINDOWPOS2SPROC __glewWindowPos2s; GLEW_FUN_EXPORT PFNGLWINDOWPOS2SVPROC __glewWindowPos2sv; GLEW_FUN_EXPORT PFNGLWINDOWPOS3DPROC __glewWindowPos3d; GLEW_FUN_EXPORT PFNGLWINDOWPOS3DVPROC __glewWindowPos3dv; GLEW_FUN_EXPORT PFNGLWINDOWPOS3FPROC __glewWindowPos3f; GLEW_FUN_EXPORT PFNGLWINDOWPOS3FVPROC __glewWindowPos3fv; GLEW_FUN_EXPORT PFNGLWINDOWPOS3IPROC __glewWindowPos3i; GLEW_FUN_EXPORT PFNGLWINDOWPOS3IVPROC __glewWindowPos3iv; GLEW_FUN_EXPORT PFNGLWINDOWPOS3SPROC __glewWindowPos3s; GLEW_FUN_EXPORT PFNGLWINDOWPOS3SVPROC __glewWindowPos3sv; GLEW_FUN_EXPORT PFNGLBEGINQUERYPROC __glewBeginQuery; GLEW_FUN_EXPORT PFNGLBINDBUFFERPROC __glewBindBuffer; GLEW_FUN_EXPORT PFNGLBUFFERDATAPROC __glewBufferData; GLEW_FUN_EXPORT PFNGLBUFFERSUBDATAPROC __glewBufferSubData; GLEW_FUN_EXPORT PFNGLDELETEBUFFERSPROC __glewDeleteBuffers; GLEW_FUN_EXPORT PFNGLDELETEQUERIESPROC __glewDeleteQueries; GLEW_FUN_EXPORT PFNGLENDQUERYPROC __glewEndQuery; GLEW_FUN_EXPORT PFNGLGENBUFFERSPROC __glewGenBuffers; GLEW_FUN_EXPORT PFNGLGENQUERIESPROC __glewGenQueries; GLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERIVPROC __glewGetBufferParameteriv; GLEW_FUN_EXPORT PFNGLGETBUFFERPOINTERVPROC __glewGetBufferPointerv; GLEW_FUN_EXPORT PFNGLGETBUFFERSUBDATAPROC __glewGetBufferSubData; GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTIVPROC __glewGetQueryObjectiv; GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUIVPROC __glewGetQueryObjectuiv; GLEW_FUN_EXPORT PFNGLGETQUERYIVPROC __glewGetQueryiv; GLEW_FUN_EXPORT PFNGLISBUFFERPROC __glewIsBuffer; GLEW_FUN_EXPORT PFNGLISQUERYPROC __glewIsQuery; GLEW_FUN_EXPORT PFNGLMAPBUFFERPROC __glewMapBuffer; GLEW_FUN_EXPORT PFNGLUNMAPBUFFERPROC __glewUnmapBuffer; GLEW_FUN_EXPORT PFNGLATTACHSHADERPROC __glewAttachShader; GLEW_FUN_EXPORT PFNGLBINDATTRIBLOCATIONPROC __glewBindAttribLocation; GLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEPROC __glewBlendEquationSeparate; GLEW_FUN_EXPORT PFNGLCOMPILESHADERPROC __glewCompileShader; GLEW_FUN_EXPORT PFNGLCREATEPROGRAMPROC __glewCreateProgram; GLEW_FUN_EXPORT PFNGLCREATESHADERPROC __glewCreateShader; GLEW_FUN_EXPORT PFNGLDELETEPROGRAMPROC __glewDeleteProgram; GLEW_FUN_EXPORT PFNGLDELETESHADERPROC __glewDeleteShader; GLEW_FUN_EXPORT PFNGLDETACHSHADERPROC __glewDetachShader; GLEW_FUN_EXPORT PFNGLDISABLEVERTEXATTRIBARRAYPROC __glewDisableVertexAttribArray; GLEW_FUN_EXPORT PFNGLDRAWBUFFERSPROC __glewDrawBuffers; GLEW_FUN_EXPORT PFNGLENABLEVERTEXATTRIBARRAYPROC __glewEnableVertexAttribArray; GLEW_FUN_EXPORT PFNGLGETACTIVEATTRIBPROC __glewGetActiveAttrib; GLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMPROC __glewGetActiveUniform; GLEW_FUN_EXPORT PFNGLGETATTACHEDSHADERSPROC __glewGetAttachedShaders; GLEW_FUN_EXPORT PFNGLGETATTRIBLOCATIONPROC __glewGetAttribLocation; GLEW_FUN_EXPORT PFNGLGETPROGRAMINFOLOGPROC __glewGetProgramInfoLog; GLEW_FUN_EXPORT PFNGLGETPROGRAMIVPROC __glewGetProgramiv; GLEW_FUN_EXPORT PFNGLGETSHADERINFOLOGPROC __glewGetShaderInfoLog; GLEW_FUN_EXPORT PFNGLGETSHADERSOURCEPROC __glewGetShaderSource; GLEW_FUN_EXPORT PFNGLGETSHADERIVPROC __glewGetShaderiv; GLEW_FUN_EXPORT PFNGLGETUNIFORMLOCATIONPROC __glewGetUniformLocation; GLEW_FUN_EXPORT PFNGLGETUNIFORMFVPROC __glewGetUniformfv; GLEW_FUN_EXPORT PFNGLGETUNIFORMIVPROC __glewGetUniformiv; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBPOINTERVPROC __glewGetVertexAttribPointerv; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBDVPROC __glewGetVertexAttribdv; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBFVPROC __glewGetVertexAttribfv; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIVPROC __glewGetVertexAttribiv; GLEW_FUN_EXPORT PFNGLISPROGRAMPROC __glewIsProgram; GLEW_FUN_EXPORT PFNGLISSHADERPROC __glewIsShader; GLEW_FUN_EXPORT PFNGLLINKPROGRAMPROC __glewLinkProgram; GLEW_FUN_EXPORT PFNGLSHADERSOURCEPROC __glewShaderSource; GLEW_FUN_EXPORT PFNGLSTENCILFUNCSEPARATEPROC __glewStencilFuncSeparate; GLEW_FUN_EXPORT PFNGLSTENCILMASKSEPARATEPROC __glewStencilMaskSeparate; GLEW_FUN_EXPORT PFNGLSTENCILOPSEPARATEPROC __glewStencilOpSeparate; GLEW_FUN_EXPORT PFNGLUNIFORM1FPROC __glewUniform1f; GLEW_FUN_EXPORT PFNGLUNIFORM1FVPROC __glewUniform1fv; GLEW_FUN_EXPORT PFNGLUNIFORM1IPROC __glewUniform1i; GLEW_FUN_EXPORT PFNGLUNIFORM1IVPROC __glewUniform1iv; GLEW_FUN_EXPORT PFNGLUNIFORM2FPROC __glewUniform2f; GLEW_FUN_EXPORT PFNGLUNIFORM2FVPROC __glewUniform2fv; GLEW_FUN_EXPORT PFNGLUNIFORM2IPROC __glewUniform2i; GLEW_FUN_EXPORT PFNGLUNIFORM2IVPROC __glewUniform2iv; GLEW_FUN_EXPORT PFNGLUNIFORM3FPROC __glewUniform3f; GLEW_FUN_EXPORT PFNGLUNIFORM3FVPROC __glewUniform3fv; GLEW_FUN_EXPORT PFNGLUNIFORM3IPROC __glewUniform3i; GLEW_FUN_EXPORT PFNGLUNIFORM3IVPROC __glewUniform3iv; GLEW_FUN_EXPORT PFNGLUNIFORM4FPROC __glewUniform4f; GLEW_FUN_EXPORT PFNGLUNIFORM4FVPROC __glewUniform4fv; GLEW_FUN_EXPORT PFNGLUNIFORM4IPROC __glewUniform4i; GLEW_FUN_EXPORT PFNGLUNIFORM4IVPROC __glewUniform4iv; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2FVPROC __glewUniformMatrix2fv; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3FVPROC __glewUniformMatrix3fv; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4FVPROC __glewUniformMatrix4fv; GLEW_FUN_EXPORT PFNGLUSEPROGRAMPROC __glewUseProgram; GLEW_FUN_EXPORT PFNGLVALIDATEPROGRAMPROC __glewValidateProgram; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DPROC __glewVertexAttrib1d; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DVPROC __glewVertexAttrib1dv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FPROC __glewVertexAttrib1f; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FVPROC __glewVertexAttrib1fv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SPROC __glewVertexAttrib1s; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SVPROC __glewVertexAttrib1sv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DPROC __glewVertexAttrib2d; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DVPROC __glewVertexAttrib2dv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FPROC __glewVertexAttrib2f; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FVPROC __glewVertexAttrib2fv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SPROC __glewVertexAttrib2s; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SVPROC __glewVertexAttrib2sv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DPROC __glewVertexAttrib3d; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DVPROC __glewVertexAttrib3dv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FPROC __glewVertexAttrib3f; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FVPROC __glewVertexAttrib3fv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SPROC __glewVertexAttrib3s; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SVPROC __glewVertexAttrib3sv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NBVPROC __glewVertexAttrib4Nbv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NIVPROC __glewVertexAttrib4Niv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NSVPROC __glewVertexAttrib4Nsv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBPROC __glewVertexAttrib4Nub; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBVPROC __glewVertexAttrib4Nubv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUIVPROC __glewVertexAttrib4Nuiv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUSVPROC __glewVertexAttrib4Nusv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4BVPROC __glewVertexAttrib4bv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DPROC __glewVertexAttrib4d; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DVPROC __glewVertexAttrib4dv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FPROC __glewVertexAttrib4f; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FVPROC __glewVertexAttrib4fv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4IVPROC __glewVertexAttrib4iv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SPROC __glewVertexAttrib4s; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SVPROC __glewVertexAttrib4sv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBVPROC __glewVertexAttrib4ubv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UIVPROC __glewVertexAttrib4uiv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4USVPROC __glewVertexAttrib4usv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBPOINTERPROC __glewVertexAttribPointer; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X3FVPROC __glewUniformMatrix2x3fv; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X4FVPROC __glewUniformMatrix2x4fv; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3X2FVPROC __glewUniformMatrix3x2fv; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3X4FVPROC __glewUniformMatrix3x4fv; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4X2FVPROC __glewUniformMatrix4x2fv; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4X3FVPROC __glewUniformMatrix4x3fv; GLEW_FUN_EXPORT PFNGLBEGINCONDITIONALRENDERPROC __glewBeginConditionalRender; GLEW_FUN_EXPORT PFNGLBEGINTRANSFORMFEEDBACKPROC __glewBeginTransformFeedback; GLEW_FUN_EXPORT PFNGLBINDFRAGDATALOCATIONPROC __glewBindFragDataLocation; GLEW_FUN_EXPORT PFNGLCLAMPCOLORPROC __glewClampColor; GLEW_FUN_EXPORT PFNGLCLEARBUFFERFIPROC __glewClearBufferfi; GLEW_FUN_EXPORT PFNGLCLEARBUFFERFVPROC __glewClearBufferfv; GLEW_FUN_EXPORT PFNGLCLEARBUFFERIVPROC __glewClearBufferiv; GLEW_FUN_EXPORT PFNGLCLEARBUFFERUIVPROC __glewClearBufferuiv; GLEW_FUN_EXPORT PFNGLCOLORMASKIPROC __glewColorMaski; GLEW_FUN_EXPORT PFNGLDISABLEIPROC __glewDisablei; GLEW_FUN_EXPORT PFNGLENABLEIPROC __glewEnablei; GLEW_FUN_EXPORT PFNGLENDCONDITIONALRENDERPROC __glewEndConditionalRender; GLEW_FUN_EXPORT PFNGLENDTRANSFORMFEEDBACKPROC __glewEndTransformFeedback; GLEW_FUN_EXPORT PFNGLGETBOOLEANI_VPROC __glewGetBooleani_v; GLEW_FUN_EXPORT PFNGLGETFRAGDATALOCATIONPROC __glewGetFragDataLocation; GLEW_FUN_EXPORT PFNGLGETSTRINGIPROC __glewGetStringi; GLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIIVPROC __glewGetTexParameterIiv; GLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIUIVPROC __glewGetTexParameterIuiv; GLEW_FUN_EXPORT PFNGLGETTRANSFORMFEEDBACKVARYINGPROC __glewGetTransformFeedbackVarying; GLEW_FUN_EXPORT PFNGLGETUNIFORMUIVPROC __glewGetUniformuiv; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIIVPROC __glewGetVertexAttribIiv; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIUIVPROC __glewGetVertexAttribIuiv; GLEW_FUN_EXPORT PFNGLISENABLEDIPROC __glewIsEnabledi; GLEW_FUN_EXPORT PFNGLTEXPARAMETERIIVPROC __glewTexParameterIiv; GLEW_FUN_EXPORT PFNGLTEXPARAMETERIUIVPROC __glewTexParameterIuiv; GLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKVARYINGSPROC __glewTransformFeedbackVaryings; GLEW_FUN_EXPORT PFNGLUNIFORM1UIPROC __glewUniform1ui; GLEW_FUN_EXPORT PFNGLUNIFORM1UIVPROC __glewUniform1uiv; GLEW_FUN_EXPORT PFNGLUNIFORM2UIPROC __glewUniform2ui; GLEW_FUN_EXPORT PFNGLUNIFORM2UIVPROC __glewUniform2uiv; GLEW_FUN_EXPORT PFNGLUNIFORM3UIPROC __glewUniform3ui; GLEW_FUN_EXPORT PFNGLUNIFORM3UIVPROC __glewUniform3uiv; GLEW_FUN_EXPORT PFNGLUNIFORM4UIPROC __glewUniform4ui; GLEW_FUN_EXPORT PFNGLUNIFORM4UIVPROC __glewUniform4uiv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1IPROC __glewVertexAttribI1i; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1IVPROC __glewVertexAttribI1iv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1UIPROC __glewVertexAttribI1ui; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1UIVPROC __glewVertexAttribI1uiv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2IPROC __glewVertexAttribI2i; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2IVPROC __glewVertexAttribI2iv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2UIPROC __glewVertexAttribI2ui; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2UIVPROC __glewVertexAttribI2uiv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3IPROC __glewVertexAttribI3i; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3IVPROC __glewVertexAttribI3iv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3UIPROC __glewVertexAttribI3ui; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3UIVPROC __glewVertexAttribI3uiv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4BVPROC __glewVertexAttribI4bv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4IPROC __glewVertexAttribI4i; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4IVPROC __glewVertexAttribI4iv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4SVPROC __glewVertexAttribI4sv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UBVPROC __glewVertexAttribI4ubv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UIPROC __glewVertexAttribI4ui; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UIVPROC __glewVertexAttribI4uiv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4USVPROC __glewVertexAttribI4usv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBIPOINTERPROC __glewVertexAttribIPointer; GLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDPROC __glewDrawArraysInstanced; GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDPROC __glewDrawElementsInstanced; GLEW_FUN_EXPORT PFNGLPRIMITIVERESTARTINDEXPROC __glewPrimitiveRestartIndex; GLEW_FUN_EXPORT PFNGLTEXBUFFERPROC __glewTexBuffer; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREPROC __glewFramebufferTexture; GLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERI64VPROC __glewGetBufferParameteri64v; GLEW_FUN_EXPORT PFNGLGETINTEGER64I_VPROC __glewGetInteger64i_v; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBDIVISORPROC __glewVertexAttribDivisor; GLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEIPROC __glewBlendEquationSeparatei; GLEW_FUN_EXPORT PFNGLBLENDEQUATIONIPROC __glewBlendEquationi; GLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEIPROC __glewBlendFuncSeparatei; GLEW_FUN_EXPORT PFNGLBLENDFUNCIPROC __glewBlendFunci; GLEW_FUN_EXPORT PFNGLMINSAMPLESHADINGPROC __glewMinSampleShading; GLEW_FUN_EXPORT PFNGLTBUFFERMASK3DFXPROC __glewTbufferMask3DFX; GLEW_FUN_EXPORT PFNGLDEBUGMESSAGECALLBACKAMDPROC __glewDebugMessageCallbackAMD; GLEW_FUN_EXPORT PFNGLDEBUGMESSAGEENABLEAMDPROC __glewDebugMessageEnableAMD; GLEW_FUN_EXPORT PFNGLDEBUGMESSAGEINSERTAMDPROC __glewDebugMessageInsertAMD; GLEW_FUN_EXPORT PFNGLGETDEBUGMESSAGELOGAMDPROC __glewGetDebugMessageLogAMD; GLEW_FUN_EXPORT PFNGLBLENDEQUATIONINDEXEDAMDPROC __glewBlendEquationIndexedAMD; GLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC __glewBlendEquationSeparateIndexedAMD; GLEW_FUN_EXPORT PFNGLBLENDFUNCINDEXEDAMDPROC __glewBlendFuncIndexedAMD; GLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC __glewBlendFuncSeparateIndexedAMD; GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC __glewMultiDrawArraysIndirectAMD; GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC __glewMultiDrawElementsIndirectAMD; GLEW_FUN_EXPORT PFNGLDELETENAMESAMDPROC __glewDeleteNamesAMD; GLEW_FUN_EXPORT PFNGLGENNAMESAMDPROC __glewGenNamesAMD; GLEW_FUN_EXPORT PFNGLISNAMEAMDPROC __glewIsNameAMD; GLEW_FUN_EXPORT PFNGLBEGINPERFMONITORAMDPROC __glewBeginPerfMonitorAMD; GLEW_FUN_EXPORT PFNGLDELETEPERFMONITORSAMDPROC __glewDeletePerfMonitorsAMD; GLEW_FUN_EXPORT PFNGLENDPERFMONITORAMDPROC __glewEndPerfMonitorAMD; GLEW_FUN_EXPORT PFNGLGENPERFMONITORSAMDPROC __glewGenPerfMonitorsAMD; GLEW_FUN_EXPORT PFNGLGETPERFMONITORCOUNTERDATAAMDPROC __glewGetPerfMonitorCounterDataAMD; GLEW_FUN_EXPORT PFNGLGETPERFMONITORCOUNTERINFOAMDPROC __glewGetPerfMonitorCounterInfoAMD; GLEW_FUN_EXPORT PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC __glewGetPerfMonitorCounterStringAMD; GLEW_FUN_EXPORT PFNGLGETPERFMONITORCOUNTERSAMDPROC __glewGetPerfMonitorCountersAMD; GLEW_FUN_EXPORT PFNGLGETPERFMONITORGROUPSTRINGAMDPROC __glewGetPerfMonitorGroupStringAMD; GLEW_FUN_EXPORT PFNGLGETPERFMONITORGROUPSAMDPROC __glewGetPerfMonitorGroupsAMD; GLEW_FUN_EXPORT PFNGLSELECTPERFMONITORCOUNTERSAMDPROC __glewSelectPerfMonitorCountersAMD; GLEW_FUN_EXPORT PFNGLSETMULTISAMPLEFVAMDPROC __glewSetMultisamplefvAMD; GLEW_FUN_EXPORT PFNGLSTENCILOPVALUEAMDPROC __glewStencilOpValueAMD; GLEW_FUN_EXPORT PFNGLTESSELLATIONFACTORAMDPROC __glewTessellationFactorAMD; GLEW_FUN_EXPORT PFNGLTESSELLATIONMODEAMDPROC __glewTessellationModeAMD; GLEW_FUN_EXPORT PFNGLDRAWELEMENTARRAYAPPLEPROC __glewDrawElementArrayAPPLE; GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC __glewDrawRangeElementArrayAPPLE; GLEW_FUN_EXPORT PFNGLELEMENTPOINTERAPPLEPROC __glewElementPointerAPPLE; GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC __glewMultiDrawElementArrayAPPLE; GLEW_FUN_EXPORT PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC __glewMultiDrawRangeElementArrayAPPLE; GLEW_FUN_EXPORT PFNGLDELETEFENCESAPPLEPROC __glewDeleteFencesAPPLE; GLEW_FUN_EXPORT PFNGLFINISHFENCEAPPLEPROC __glewFinishFenceAPPLE; GLEW_FUN_EXPORT PFNGLFINISHOBJECTAPPLEPROC __glewFinishObjectAPPLE; GLEW_FUN_EXPORT PFNGLGENFENCESAPPLEPROC __glewGenFencesAPPLE; GLEW_FUN_EXPORT PFNGLISFENCEAPPLEPROC __glewIsFenceAPPLE; GLEW_FUN_EXPORT PFNGLSETFENCEAPPLEPROC __glewSetFenceAPPLE; GLEW_FUN_EXPORT PFNGLTESTFENCEAPPLEPROC __glewTestFenceAPPLE; GLEW_FUN_EXPORT PFNGLTESTOBJECTAPPLEPROC __glewTestObjectAPPLE; GLEW_FUN_EXPORT PFNGLBUFFERPARAMETERIAPPLEPROC __glewBufferParameteriAPPLE; GLEW_FUN_EXPORT PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC __glewFlushMappedBufferRangeAPPLE; GLEW_FUN_EXPORT PFNGLGETOBJECTPARAMETERIVAPPLEPROC __glewGetObjectParameterivAPPLE; GLEW_FUN_EXPORT PFNGLOBJECTPURGEABLEAPPLEPROC __glewObjectPurgeableAPPLE; GLEW_FUN_EXPORT PFNGLOBJECTUNPURGEABLEAPPLEPROC __glewObjectUnpurgeableAPPLE; GLEW_FUN_EXPORT PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC __glewGetTexParameterPointervAPPLE; GLEW_FUN_EXPORT PFNGLTEXTURERANGEAPPLEPROC __glewTextureRangeAPPLE; GLEW_FUN_EXPORT PFNGLBINDVERTEXARRAYAPPLEPROC __glewBindVertexArrayAPPLE; GLEW_FUN_EXPORT PFNGLDELETEVERTEXARRAYSAPPLEPROC __glewDeleteVertexArraysAPPLE; GLEW_FUN_EXPORT PFNGLGENVERTEXARRAYSAPPLEPROC __glewGenVertexArraysAPPLE; GLEW_FUN_EXPORT PFNGLISVERTEXARRAYAPPLEPROC __glewIsVertexArrayAPPLE; GLEW_FUN_EXPORT PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC __glewFlushVertexArrayRangeAPPLE; GLEW_FUN_EXPORT PFNGLVERTEXARRAYPARAMETERIAPPLEPROC __glewVertexArrayParameteriAPPLE; GLEW_FUN_EXPORT PFNGLVERTEXARRAYRANGEAPPLEPROC __glewVertexArrayRangeAPPLE; GLEW_FUN_EXPORT PFNGLDISABLEVERTEXATTRIBAPPLEPROC __glewDisableVertexAttribAPPLE; GLEW_FUN_EXPORT PFNGLENABLEVERTEXATTRIBAPPLEPROC __glewEnableVertexAttribAPPLE; GLEW_FUN_EXPORT PFNGLISVERTEXATTRIBENABLEDAPPLEPROC __glewIsVertexAttribEnabledAPPLE; GLEW_FUN_EXPORT PFNGLMAPVERTEXATTRIB1DAPPLEPROC __glewMapVertexAttrib1dAPPLE; GLEW_FUN_EXPORT PFNGLMAPVERTEXATTRIB1FAPPLEPROC __glewMapVertexAttrib1fAPPLE; GLEW_FUN_EXPORT PFNGLMAPVERTEXATTRIB2DAPPLEPROC __glewMapVertexAttrib2dAPPLE; GLEW_FUN_EXPORT PFNGLMAPVERTEXATTRIB2FAPPLEPROC __glewMapVertexAttrib2fAPPLE; GLEW_FUN_EXPORT PFNGLCLEARDEPTHFPROC __glewClearDepthf; GLEW_FUN_EXPORT PFNGLDEPTHRANGEFPROC __glewDepthRangef; GLEW_FUN_EXPORT PFNGLGETSHADERPRECISIONFORMATPROC __glewGetShaderPrecisionFormat; GLEW_FUN_EXPORT PFNGLRELEASESHADERCOMPILERPROC __glewReleaseShaderCompiler; GLEW_FUN_EXPORT PFNGLSHADERBINARYPROC __glewShaderBinary; GLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC __glewDrawArraysInstancedBaseInstance; GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC __glewDrawElementsInstancedBaseInstance; GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC __glewDrawElementsInstancedBaseVertexBaseInstance; GLEW_FUN_EXPORT PFNGLBINDFRAGDATALOCATIONINDEXEDPROC __glewBindFragDataLocationIndexed; GLEW_FUN_EXPORT PFNGLGETFRAGDATAINDEXPROC __glewGetFragDataIndex; GLEW_FUN_EXPORT PFNGLCREATESYNCFROMCLEVENTARBPROC __glewCreateSyncFromCLeventARB; GLEW_FUN_EXPORT PFNGLCLEARBUFFERDATAPROC __glewClearBufferData; GLEW_FUN_EXPORT PFNGLCLEARBUFFERSUBDATAPROC __glewClearBufferSubData; GLEW_FUN_EXPORT PFNGLCLEARNAMEDBUFFERDATAEXTPROC __glewClearNamedBufferDataEXT; GLEW_FUN_EXPORT PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC __glewClearNamedBufferSubDataEXT; GLEW_FUN_EXPORT PFNGLCLAMPCOLORARBPROC __glewClampColorARB; GLEW_FUN_EXPORT PFNGLDISPATCHCOMPUTEPROC __glewDispatchCompute; GLEW_FUN_EXPORT PFNGLDISPATCHCOMPUTEINDIRECTPROC __glewDispatchComputeIndirect; GLEW_FUN_EXPORT PFNGLCOPYBUFFERSUBDATAPROC __glewCopyBufferSubData; GLEW_FUN_EXPORT PFNGLCOPYIMAGESUBDATAPROC __glewCopyImageSubData; GLEW_FUN_EXPORT PFNGLDEBUGMESSAGECALLBACKARBPROC __glewDebugMessageCallbackARB; GLEW_FUN_EXPORT PFNGLDEBUGMESSAGECONTROLARBPROC __glewDebugMessageControlARB; GLEW_FUN_EXPORT PFNGLDEBUGMESSAGEINSERTARBPROC __glewDebugMessageInsertARB; GLEW_FUN_EXPORT PFNGLGETDEBUGMESSAGELOGARBPROC __glewGetDebugMessageLogARB; GLEW_FUN_EXPORT PFNGLDRAWBUFFERSARBPROC __glewDrawBuffersARB; GLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEIARBPROC __glewBlendEquationSeparateiARB; GLEW_FUN_EXPORT PFNGLBLENDEQUATIONIARBPROC __glewBlendEquationiARB; GLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEIARBPROC __glewBlendFuncSeparateiARB; GLEW_FUN_EXPORT PFNGLBLENDFUNCIARBPROC __glewBlendFunciARB; GLEW_FUN_EXPORT PFNGLDRAWELEMENTSBASEVERTEXPROC __glewDrawElementsBaseVertex; GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC __glewDrawElementsInstancedBaseVertex; GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC __glewDrawRangeElementsBaseVertex; GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC __glewMultiDrawElementsBaseVertex; GLEW_FUN_EXPORT PFNGLDRAWARRAYSINDIRECTPROC __glewDrawArraysIndirect; GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINDIRECTPROC __glewDrawElementsIndirect; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERPARAMETERIPROC __glewFramebufferParameteri; GLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERPARAMETERIVPROC __glewGetFramebufferParameteriv; GLEW_FUN_EXPORT PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC __glewGetNamedFramebufferParameterivEXT; GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC __glewNamedFramebufferParameteriEXT; GLEW_FUN_EXPORT PFNGLBINDFRAMEBUFFERPROC __glewBindFramebuffer; GLEW_FUN_EXPORT PFNGLBINDRENDERBUFFERPROC __glewBindRenderbuffer; GLEW_FUN_EXPORT PFNGLBLITFRAMEBUFFERPROC __glewBlitFramebuffer; GLEW_FUN_EXPORT PFNGLCHECKFRAMEBUFFERSTATUSPROC __glewCheckFramebufferStatus; GLEW_FUN_EXPORT PFNGLDELETEFRAMEBUFFERSPROC __glewDeleteFramebuffers; GLEW_FUN_EXPORT PFNGLDELETERENDERBUFFERSPROC __glewDeleteRenderbuffers; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERRENDERBUFFERPROC __glewFramebufferRenderbuffer; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE1DPROC __glewFramebufferTexture1D; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE2DPROC __glewFramebufferTexture2D; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE3DPROC __glewFramebufferTexture3D; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYERPROC __glewFramebufferTextureLayer; GLEW_FUN_EXPORT PFNGLGENFRAMEBUFFERSPROC __glewGenFramebuffers; GLEW_FUN_EXPORT PFNGLGENRENDERBUFFERSPROC __glewGenRenderbuffers; GLEW_FUN_EXPORT PFNGLGENERATEMIPMAPPROC __glewGenerateMipmap; GLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC __glewGetFramebufferAttachmentParameteriv; GLEW_FUN_EXPORT PFNGLGETRENDERBUFFERPARAMETERIVPROC __glewGetRenderbufferParameteriv; GLEW_FUN_EXPORT PFNGLISFRAMEBUFFERPROC __glewIsFramebuffer; GLEW_FUN_EXPORT PFNGLISRENDERBUFFERPROC __glewIsRenderbuffer; GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEPROC __glewRenderbufferStorage; GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC __glewRenderbufferStorageMultisample; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREARBPROC __glewFramebufferTextureARB; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREFACEARBPROC __glewFramebufferTextureFaceARB; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYERARBPROC __glewFramebufferTextureLayerARB; GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERIARBPROC __glewProgramParameteriARB; GLEW_FUN_EXPORT PFNGLGETPROGRAMBINARYPROC __glewGetProgramBinary; GLEW_FUN_EXPORT PFNGLPROGRAMBINARYPROC __glewProgramBinary; GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERIPROC __glewProgramParameteri; GLEW_FUN_EXPORT PFNGLGETUNIFORMDVPROC __glewGetUniformdv; GLEW_FUN_EXPORT PFNGLUNIFORM1DPROC __glewUniform1d; GLEW_FUN_EXPORT PFNGLUNIFORM1DVPROC __glewUniform1dv; GLEW_FUN_EXPORT PFNGLUNIFORM2DPROC __glewUniform2d; GLEW_FUN_EXPORT PFNGLUNIFORM2DVPROC __glewUniform2dv; GLEW_FUN_EXPORT PFNGLUNIFORM3DPROC __glewUniform3d; GLEW_FUN_EXPORT PFNGLUNIFORM3DVPROC __glewUniform3dv; GLEW_FUN_EXPORT PFNGLUNIFORM4DPROC __glewUniform4d; GLEW_FUN_EXPORT PFNGLUNIFORM4DVPROC __glewUniform4dv; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2DVPROC __glewUniformMatrix2dv; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X3DVPROC __glewUniformMatrix2x3dv; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X4DVPROC __glewUniformMatrix2x4dv; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3DVPROC __glewUniformMatrix3dv; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3X2DVPROC __glewUniformMatrix3x2dv; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3X4DVPROC __glewUniformMatrix3x4dv; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4DVPROC __glewUniformMatrix4dv; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4X2DVPROC __glewUniformMatrix4x2dv; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4X3DVPROC __glewUniformMatrix4x3dv; GLEW_FUN_EXPORT PFNGLCOLORSUBTABLEPROC __glewColorSubTable; GLEW_FUN_EXPORT PFNGLCOLORTABLEPROC __glewColorTable; GLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERFVPROC __glewColorTableParameterfv; GLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERIVPROC __glewColorTableParameteriv; GLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER1DPROC __glewConvolutionFilter1D; GLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER2DPROC __glewConvolutionFilter2D; GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFPROC __glewConvolutionParameterf; GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFVPROC __glewConvolutionParameterfv; GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIPROC __glewConvolutionParameteri; GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIVPROC __glewConvolutionParameteriv; GLEW_FUN_EXPORT PFNGLCOPYCOLORSUBTABLEPROC __glewCopyColorSubTable; GLEW_FUN_EXPORT PFNGLCOPYCOLORTABLEPROC __glewCopyColorTable; GLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER1DPROC __glewCopyConvolutionFilter1D; GLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER2DPROC __glewCopyConvolutionFilter2D; GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPROC __glewGetColorTable; GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERFVPROC __glewGetColorTableParameterfv; GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERIVPROC __glewGetColorTableParameteriv; GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONFILTERPROC __glewGetConvolutionFilter; GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERFVPROC __glewGetConvolutionParameterfv; GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERIVPROC __glewGetConvolutionParameteriv; GLEW_FUN_EXPORT PFNGLGETHISTOGRAMPROC __glewGetHistogram; GLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERFVPROC __glewGetHistogramParameterfv; GLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERIVPROC __glewGetHistogramParameteriv; GLEW_FUN_EXPORT PFNGLGETMINMAXPROC __glewGetMinmax; GLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERFVPROC __glewGetMinmaxParameterfv; GLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERIVPROC __glewGetMinmaxParameteriv; GLEW_FUN_EXPORT PFNGLGETSEPARABLEFILTERPROC __glewGetSeparableFilter; GLEW_FUN_EXPORT PFNGLHISTOGRAMPROC __glewHistogram; GLEW_FUN_EXPORT PFNGLMINMAXPROC __glewMinmax; GLEW_FUN_EXPORT PFNGLRESETHISTOGRAMPROC __glewResetHistogram; GLEW_FUN_EXPORT PFNGLRESETMINMAXPROC __glewResetMinmax; GLEW_FUN_EXPORT PFNGLSEPARABLEFILTER2DPROC __glewSeparableFilter2D; GLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDARBPROC __glewDrawArraysInstancedARB; GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDARBPROC __glewDrawElementsInstancedARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBDIVISORARBPROC __glewVertexAttribDivisorARB; GLEW_FUN_EXPORT PFNGLGETINTERNALFORMATIVPROC __glewGetInternalformativ; GLEW_FUN_EXPORT PFNGLGETINTERNALFORMATI64VPROC __glewGetInternalformati64v; GLEW_FUN_EXPORT PFNGLINVALIDATEBUFFERDATAPROC __glewInvalidateBufferData; GLEW_FUN_EXPORT PFNGLINVALIDATEBUFFERSUBDATAPROC __glewInvalidateBufferSubData; GLEW_FUN_EXPORT PFNGLINVALIDATEFRAMEBUFFERPROC __glewInvalidateFramebuffer; GLEW_FUN_EXPORT PFNGLINVALIDATESUBFRAMEBUFFERPROC __glewInvalidateSubFramebuffer; GLEW_FUN_EXPORT PFNGLINVALIDATETEXIMAGEPROC __glewInvalidateTexImage; GLEW_FUN_EXPORT PFNGLINVALIDATETEXSUBIMAGEPROC __glewInvalidateTexSubImage; GLEW_FUN_EXPORT PFNGLFLUSHMAPPEDBUFFERRANGEPROC __glewFlushMappedBufferRange; GLEW_FUN_EXPORT PFNGLMAPBUFFERRANGEPROC __glewMapBufferRange; GLEW_FUN_EXPORT PFNGLCURRENTPALETTEMATRIXARBPROC __glewCurrentPaletteMatrixARB; GLEW_FUN_EXPORT PFNGLMATRIXINDEXPOINTERARBPROC __glewMatrixIndexPointerARB; GLEW_FUN_EXPORT PFNGLMATRIXINDEXUBVARBPROC __glewMatrixIndexubvARB; GLEW_FUN_EXPORT PFNGLMATRIXINDEXUIVARBPROC __glewMatrixIndexuivARB; GLEW_FUN_EXPORT PFNGLMATRIXINDEXUSVARBPROC __glewMatrixIndexusvARB; GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSINDIRECTPROC __glewMultiDrawArraysIndirect; GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSINDIRECTPROC __glewMultiDrawElementsIndirect; GLEW_FUN_EXPORT PFNGLSAMPLECOVERAGEARBPROC __glewSampleCoverageARB; GLEW_FUN_EXPORT PFNGLACTIVETEXTUREARBPROC __glewActiveTextureARB; GLEW_FUN_EXPORT PFNGLCLIENTACTIVETEXTUREARBPROC __glewClientActiveTextureARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DARBPROC __glewMultiTexCoord1dARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DVARBPROC __glewMultiTexCoord1dvARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FARBPROC __glewMultiTexCoord1fARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FVARBPROC __glewMultiTexCoord1fvARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IARBPROC __glewMultiTexCoord1iARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IVARBPROC __glewMultiTexCoord1ivARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SARBPROC __glewMultiTexCoord1sARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SVARBPROC __glewMultiTexCoord1svARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DARBPROC __glewMultiTexCoord2dARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DVARBPROC __glewMultiTexCoord2dvARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FARBPROC __glewMultiTexCoord2fARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FVARBPROC __glewMultiTexCoord2fvARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IARBPROC __glewMultiTexCoord2iARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IVARBPROC __glewMultiTexCoord2ivARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SARBPROC __glewMultiTexCoord2sARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SVARBPROC __glewMultiTexCoord2svARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DARBPROC __glewMultiTexCoord3dARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DVARBPROC __glewMultiTexCoord3dvARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FARBPROC __glewMultiTexCoord3fARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FVARBPROC __glewMultiTexCoord3fvARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IARBPROC __glewMultiTexCoord3iARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IVARBPROC __glewMultiTexCoord3ivARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SARBPROC __glewMultiTexCoord3sARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SVARBPROC __glewMultiTexCoord3svARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DARBPROC __glewMultiTexCoord4dARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DVARBPROC __glewMultiTexCoord4dvARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FARBPROC __glewMultiTexCoord4fARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FVARBPROC __glewMultiTexCoord4fvARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IARBPROC __glewMultiTexCoord4iARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IVARBPROC __glewMultiTexCoord4ivARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SARBPROC __glewMultiTexCoord4sARB; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SVARBPROC __glewMultiTexCoord4svARB; GLEW_FUN_EXPORT PFNGLBEGINQUERYARBPROC __glewBeginQueryARB; GLEW_FUN_EXPORT PFNGLDELETEQUERIESARBPROC __glewDeleteQueriesARB; GLEW_FUN_EXPORT PFNGLENDQUERYARBPROC __glewEndQueryARB; GLEW_FUN_EXPORT PFNGLGENQUERIESARBPROC __glewGenQueriesARB; GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTIVARBPROC __glewGetQueryObjectivARB; GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUIVARBPROC __glewGetQueryObjectuivARB; GLEW_FUN_EXPORT PFNGLGETQUERYIVARBPROC __glewGetQueryivARB; GLEW_FUN_EXPORT PFNGLISQUERYARBPROC __glewIsQueryARB; GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFARBPROC __glewPointParameterfARB; GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFVARBPROC __glewPointParameterfvARB; GLEW_FUN_EXPORT PFNGLGETPROGRAMINTERFACEIVPROC __glewGetProgramInterfaceiv; GLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCEINDEXPROC __glewGetProgramResourceIndex; GLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCELOCATIONPROC __glewGetProgramResourceLocation; GLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC __glewGetProgramResourceLocationIndex; GLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCENAMEPROC __glewGetProgramResourceName; GLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCEIVPROC __glewGetProgramResourceiv; GLEW_FUN_EXPORT PFNGLPROVOKINGVERTEXPROC __glewProvokingVertex; GLEW_FUN_EXPORT PFNGLGETGRAPHICSRESETSTATUSARBPROC __glewGetGraphicsResetStatusARB; GLEW_FUN_EXPORT PFNGLGETNCOLORTABLEARBPROC __glewGetnColorTableARB; GLEW_FUN_EXPORT PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC __glewGetnCompressedTexImageARB; GLEW_FUN_EXPORT PFNGLGETNCONVOLUTIONFILTERARBPROC __glewGetnConvolutionFilterARB; GLEW_FUN_EXPORT PFNGLGETNHISTOGRAMARBPROC __glewGetnHistogramARB; GLEW_FUN_EXPORT PFNGLGETNMAPDVARBPROC __glewGetnMapdvARB; GLEW_FUN_EXPORT PFNGLGETNMAPFVARBPROC __glewGetnMapfvARB; GLEW_FUN_EXPORT PFNGLGETNMAPIVARBPROC __glewGetnMapivARB; GLEW_FUN_EXPORT PFNGLGETNMINMAXARBPROC __glewGetnMinmaxARB; GLEW_FUN_EXPORT PFNGLGETNPIXELMAPFVARBPROC __glewGetnPixelMapfvARB; GLEW_FUN_EXPORT PFNGLGETNPIXELMAPUIVARBPROC __glewGetnPixelMapuivARB; GLEW_FUN_EXPORT PFNGLGETNPIXELMAPUSVARBPROC __glewGetnPixelMapusvARB; GLEW_FUN_EXPORT PFNGLGETNPOLYGONSTIPPLEARBPROC __glewGetnPolygonStippleARB; GLEW_FUN_EXPORT PFNGLGETNSEPARABLEFILTERARBPROC __glewGetnSeparableFilterARB; GLEW_FUN_EXPORT PFNGLGETNTEXIMAGEARBPROC __glewGetnTexImageARB; GLEW_FUN_EXPORT PFNGLGETNUNIFORMDVARBPROC __glewGetnUniformdvARB; GLEW_FUN_EXPORT PFNGLGETNUNIFORMFVARBPROC __glewGetnUniformfvARB; GLEW_FUN_EXPORT PFNGLGETNUNIFORMIVARBPROC __glewGetnUniformivARB; GLEW_FUN_EXPORT PFNGLGETNUNIFORMUIVARBPROC __glewGetnUniformuivARB; GLEW_FUN_EXPORT PFNGLREADNPIXELSARBPROC __glewReadnPixelsARB; GLEW_FUN_EXPORT PFNGLMINSAMPLESHADINGARBPROC __glewMinSampleShadingARB; GLEW_FUN_EXPORT PFNGLBINDSAMPLERPROC __glewBindSampler; GLEW_FUN_EXPORT PFNGLDELETESAMPLERSPROC __glewDeleteSamplers; GLEW_FUN_EXPORT PFNGLGENSAMPLERSPROC __glewGenSamplers; GLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERIIVPROC __glewGetSamplerParameterIiv; GLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERIUIVPROC __glewGetSamplerParameterIuiv; GLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERFVPROC __glewGetSamplerParameterfv; GLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERIVPROC __glewGetSamplerParameteriv; GLEW_FUN_EXPORT PFNGLISSAMPLERPROC __glewIsSampler; GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIIVPROC __glewSamplerParameterIiv; GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIUIVPROC __glewSamplerParameterIuiv; GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERFPROC __glewSamplerParameterf; GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERFVPROC __glewSamplerParameterfv; GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIPROC __glewSamplerParameteri; GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIVPROC __glewSamplerParameteriv; GLEW_FUN_EXPORT PFNGLACTIVESHADERPROGRAMPROC __glewActiveShaderProgram; GLEW_FUN_EXPORT PFNGLBINDPROGRAMPIPELINEPROC __glewBindProgramPipeline; GLEW_FUN_EXPORT PFNGLCREATESHADERPROGRAMVPROC __glewCreateShaderProgramv; GLEW_FUN_EXPORT PFNGLDELETEPROGRAMPIPELINESPROC __glewDeleteProgramPipelines; GLEW_FUN_EXPORT PFNGLGENPROGRAMPIPELINESPROC __glewGenProgramPipelines; GLEW_FUN_EXPORT PFNGLGETPROGRAMPIPELINEINFOLOGPROC __glewGetProgramPipelineInfoLog; GLEW_FUN_EXPORT PFNGLGETPROGRAMPIPELINEIVPROC __glewGetProgramPipelineiv; GLEW_FUN_EXPORT PFNGLISPROGRAMPIPELINEPROC __glewIsProgramPipeline; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1DPROC __glewProgramUniform1d; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1DVPROC __glewProgramUniform1dv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1FPROC __glewProgramUniform1f; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1FVPROC __glewProgramUniform1fv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1IPROC __glewProgramUniform1i; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1IVPROC __glewProgramUniform1iv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UIPROC __glewProgramUniform1ui; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UIVPROC __glewProgramUniform1uiv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2DPROC __glewProgramUniform2d; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2DVPROC __glewProgramUniform2dv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2FPROC __glewProgramUniform2f; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2FVPROC __glewProgramUniform2fv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2IPROC __glewProgramUniform2i; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2IVPROC __glewProgramUniform2iv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UIPROC __glewProgramUniform2ui; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UIVPROC __glewProgramUniform2uiv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3DPROC __glewProgramUniform3d; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3DVPROC __glewProgramUniform3dv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3FPROC __glewProgramUniform3f; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3FVPROC __glewProgramUniform3fv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3IPROC __glewProgramUniform3i; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3IVPROC __glewProgramUniform3iv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UIPROC __glewProgramUniform3ui; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UIVPROC __glewProgramUniform3uiv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4DPROC __glewProgramUniform4d; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4DVPROC __glewProgramUniform4dv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4FPROC __glewProgramUniform4f; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4FVPROC __glewProgramUniform4fv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4IPROC __glewProgramUniform4i; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4IVPROC __glewProgramUniform4iv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UIPROC __glewProgramUniform4ui; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UIVPROC __glewProgramUniform4uiv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2DVPROC __glewProgramUniformMatrix2dv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2FVPROC __glewProgramUniformMatrix2fv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC __glewProgramUniformMatrix2x3dv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC __glewProgramUniformMatrix2x3fv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC __glewProgramUniformMatrix2x4dv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC __glewProgramUniformMatrix2x4fv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3DVPROC __glewProgramUniformMatrix3dv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3FVPROC __glewProgramUniformMatrix3fv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC __glewProgramUniformMatrix3x2dv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC __glewProgramUniformMatrix3x2fv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC __glewProgramUniformMatrix3x4dv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC __glewProgramUniformMatrix3x4fv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4DVPROC __glewProgramUniformMatrix4dv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4FVPROC __glewProgramUniformMatrix4fv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC __glewProgramUniformMatrix4x2dv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC __glewProgramUniformMatrix4x2fv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC __glewProgramUniformMatrix4x3dv; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC __glewProgramUniformMatrix4x3fv; GLEW_FUN_EXPORT PFNGLUSEPROGRAMSTAGESPROC __glewUseProgramStages; GLEW_FUN_EXPORT PFNGLVALIDATEPROGRAMPIPELINEPROC __glewValidateProgramPipeline; GLEW_FUN_EXPORT PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC __glewGetActiveAtomicCounterBufferiv; GLEW_FUN_EXPORT PFNGLBINDIMAGETEXTUREPROC __glewBindImageTexture; GLEW_FUN_EXPORT PFNGLMEMORYBARRIERPROC __glewMemoryBarrier; GLEW_FUN_EXPORT PFNGLATTACHOBJECTARBPROC __glewAttachObjectARB; GLEW_FUN_EXPORT PFNGLCOMPILESHADERARBPROC __glewCompileShaderARB; GLEW_FUN_EXPORT PFNGLCREATEPROGRAMOBJECTARBPROC __glewCreateProgramObjectARB; GLEW_FUN_EXPORT PFNGLCREATESHADEROBJECTARBPROC __glewCreateShaderObjectARB; GLEW_FUN_EXPORT PFNGLDELETEOBJECTARBPROC __glewDeleteObjectARB; GLEW_FUN_EXPORT PFNGLDETACHOBJECTARBPROC __glewDetachObjectARB; GLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMARBPROC __glewGetActiveUniformARB; GLEW_FUN_EXPORT PFNGLGETATTACHEDOBJECTSARBPROC __glewGetAttachedObjectsARB; GLEW_FUN_EXPORT PFNGLGETHANDLEARBPROC __glewGetHandleARB; GLEW_FUN_EXPORT PFNGLGETINFOLOGARBPROC __glewGetInfoLogARB; GLEW_FUN_EXPORT PFNGLGETOBJECTPARAMETERFVARBPROC __glewGetObjectParameterfvARB; GLEW_FUN_EXPORT PFNGLGETOBJECTPARAMETERIVARBPROC __glewGetObjectParameterivARB; GLEW_FUN_EXPORT PFNGLGETSHADERSOURCEARBPROC __glewGetShaderSourceARB; GLEW_FUN_EXPORT PFNGLGETUNIFORMLOCATIONARBPROC __glewGetUniformLocationARB; GLEW_FUN_EXPORT PFNGLGETUNIFORMFVARBPROC __glewGetUniformfvARB; GLEW_FUN_EXPORT PFNGLGETUNIFORMIVARBPROC __glewGetUniformivARB; GLEW_FUN_EXPORT PFNGLLINKPROGRAMARBPROC __glewLinkProgramARB; GLEW_FUN_EXPORT PFNGLSHADERSOURCEARBPROC __glewShaderSourceARB; GLEW_FUN_EXPORT PFNGLUNIFORM1FARBPROC __glewUniform1fARB; GLEW_FUN_EXPORT PFNGLUNIFORM1FVARBPROC __glewUniform1fvARB; GLEW_FUN_EXPORT PFNGLUNIFORM1IARBPROC __glewUniform1iARB; GLEW_FUN_EXPORT PFNGLUNIFORM1IVARBPROC __glewUniform1ivARB; GLEW_FUN_EXPORT PFNGLUNIFORM2FARBPROC __glewUniform2fARB; GLEW_FUN_EXPORT PFNGLUNIFORM2FVARBPROC __glewUniform2fvARB; GLEW_FUN_EXPORT PFNGLUNIFORM2IARBPROC __glewUniform2iARB; GLEW_FUN_EXPORT PFNGLUNIFORM2IVARBPROC __glewUniform2ivARB; GLEW_FUN_EXPORT PFNGLUNIFORM3FARBPROC __glewUniform3fARB; GLEW_FUN_EXPORT PFNGLUNIFORM3FVARBPROC __glewUniform3fvARB; GLEW_FUN_EXPORT PFNGLUNIFORM3IARBPROC __glewUniform3iARB; GLEW_FUN_EXPORT PFNGLUNIFORM3IVARBPROC __glewUniform3ivARB; GLEW_FUN_EXPORT PFNGLUNIFORM4FARBPROC __glewUniform4fARB; GLEW_FUN_EXPORT PFNGLUNIFORM4FVARBPROC __glewUniform4fvARB; GLEW_FUN_EXPORT PFNGLUNIFORM4IARBPROC __glewUniform4iARB; GLEW_FUN_EXPORT PFNGLUNIFORM4IVARBPROC __glewUniform4ivARB; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2FVARBPROC __glewUniformMatrix2fvARB; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3FVARBPROC __glewUniformMatrix3fvARB; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4FVARBPROC __glewUniformMatrix4fvARB; GLEW_FUN_EXPORT PFNGLUSEPROGRAMOBJECTARBPROC __glewUseProgramObjectARB; GLEW_FUN_EXPORT PFNGLVALIDATEPROGRAMARBPROC __glewValidateProgramARB; GLEW_FUN_EXPORT PFNGLSHADERSTORAGEBLOCKBINDINGPROC __glewShaderStorageBlockBinding; GLEW_FUN_EXPORT PFNGLGETACTIVESUBROUTINENAMEPROC __glewGetActiveSubroutineName; GLEW_FUN_EXPORT PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC __glewGetActiveSubroutineUniformName; GLEW_FUN_EXPORT PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC __glewGetActiveSubroutineUniformiv; GLEW_FUN_EXPORT PFNGLGETPROGRAMSTAGEIVPROC __glewGetProgramStageiv; GLEW_FUN_EXPORT PFNGLGETSUBROUTINEINDEXPROC __glewGetSubroutineIndex; GLEW_FUN_EXPORT PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC __glewGetSubroutineUniformLocation; GLEW_FUN_EXPORT PFNGLGETUNIFORMSUBROUTINEUIVPROC __glewGetUniformSubroutineuiv; GLEW_FUN_EXPORT PFNGLUNIFORMSUBROUTINESUIVPROC __glewUniformSubroutinesuiv; GLEW_FUN_EXPORT PFNGLCOMPILESHADERINCLUDEARBPROC __glewCompileShaderIncludeARB; GLEW_FUN_EXPORT PFNGLDELETENAMEDSTRINGARBPROC __glewDeleteNamedStringARB; GLEW_FUN_EXPORT PFNGLGETNAMEDSTRINGARBPROC __glewGetNamedStringARB; GLEW_FUN_EXPORT PFNGLGETNAMEDSTRINGIVARBPROC __glewGetNamedStringivARB; GLEW_FUN_EXPORT PFNGLISNAMEDSTRINGARBPROC __glewIsNamedStringARB; GLEW_FUN_EXPORT PFNGLNAMEDSTRINGARBPROC __glewNamedStringARB; GLEW_FUN_EXPORT PFNGLCLIENTWAITSYNCPROC __glewClientWaitSync; GLEW_FUN_EXPORT PFNGLDELETESYNCPROC __glewDeleteSync; GLEW_FUN_EXPORT PFNGLFENCESYNCPROC __glewFenceSync; GLEW_FUN_EXPORT PFNGLGETINTEGER64VPROC __glewGetInteger64v; GLEW_FUN_EXPORT PFNGLGETSYNCIVPROC __glewGetSynciv; GLEW_FUN_EXPORT PFNGLISSYNCPROC __glewIsSync; GLEW_FUN_EXPORT PFNGLWAITSYNCPROC __glewWaitSync; GLEW_FUN_EXPORT PFNGLPATCHPARAMETERFVPROC __glewPatchParameterfv; GLEW_FUN_EXPORT PFNGLPATCHPARAMETERIPROC __glewPatchParameteri; GLEW_FUN_EXPORT PFNGLTEXBUFFERARBPROC __glewTexBufferARB; GLEW_FUN_EXPORT PFNGLTEXBUFFERRANGEPROC __glewTexBufferRange; GLEW_FUN_EXPORT PFNGLTEXTUREBUFFERRANGEEXTPROC __glewTextureBufferRangeEXT; GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE1DARBPROC __glewCompressedTexImage1DARB; GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE2DARBPROC __glewCompressedTexImage2DARB; GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE3DARBPROC __glewCompressedTexImage3DARB; GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC __glewCompressedTexSubImage1DARB; GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC __glewCompressedTexSubImage2DARB; GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC __glewCompressedTexSubImage3DARB; GLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXIMAGEARBPROC __glewGetCompressedTexImageARB; GLEW_FUN_EXPORT PFNGLGETMULTISAMPLEFVPROC __glewGetMultisamplefv; GLEW_FUN_EXPORT PFNGLSAMPLEMASKIPROC __glewSampleMaski; GLEW_FUN_EXPORT PFNGLTEXIMAGE2DMULTISAMPLEPROC __glewTexImage2DMultisample; GLEW_FUN_EXPORT PFNGLTEXIMAGE3DMULTISAMPLEPROC __glewTexImage3DMultisample; GLEW_FUN_EXPORT PFNGLTEXSTORAGE1DPROC __glewTexStorage1D; GLEW_FUN_EXPORT PFNGLTEXSTORAGE2DPROC __glewTexStorage2D; GLEW_FUN_EXPORT PFNGLTEXSTORAGE3DPROC __glewTexStorage3D; GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE1DEXTPROC __glewTextureStorage1DEXT; GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE2DEXTPROC __glewTextureStorage2DEXT; GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE3DEXTPROC __glewTextureStorage3DEXT; GLEW_FUN_EXPORT PFNGLTEXSTORAGE2DMULTISAMPLEPROC __glewTexStorage2DMultisample; GLEW_FUN_EXPORT PFNGLTEXSTORAGE3DMULTISAMPLEPROC __glewTexStorage3DMultisample; GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC __glewTextureStorage2DMultisampleEXT; GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC __glewTextureStorage3DMultisampleEXT; GLEW_FUN_EXPORT PFNGLTEXTUREVIEWPROC __glewTextureView; GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTI64VPROC __glewGetQueryObjecti64v; GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUI64VPROC __glewGetQueryObjectui64v; GLEW_FUN_EXPORT PFNGLQUERYCOUNTERPROC __glewQueryCounter; GLEW_FUN_EXPORT PFNGLBINDTRANSFORMFEEDBACKPROC __glewBindTransformFeedback; GLEW_FUN_EXPORT PFNGLDELETETRANSFORMFEEDBACKSPROC __glewDeleteTransformFeedbacks; GLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKPROC __glewDrawTransformFeedback; GLEW_FUN_EXPORT PFNGLGENTRANSFORMFEEDBACKSPROC __glewGenTransformFeedbacks; GLEW_FUN_EXPORT PFNGLISTRANSFORMFEEDBACKPROC __glewIsTransformFeedback; GLEW_FUN_EXPORT PFNGLPAUSETRANSFORMFEEDBACKPROC __glewPauseTransformFeedback; GLEW_FUN_EXPORT PFNGLRESUMETRANSFORMFEEDBACKPROC __glewResumeTransformFeedback; GLEW_FUN_EXPORT PFNGLBEGINQUERYINDEXEDPROC __glewBeginQueryIndexed; GLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC __glewDrawTransformFeedbackStream; GLEW_FUN_EXPORT PFNGLENDQUERYINDEXEDPROC __glewEndQueryIndexed; GLEW_FUN_EXPORT PFNGLGETQUERYINDEXEDIVPROC __glewGetQueryIndexediv; GLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC __glewDrawTransformFeedbackInstanced; GLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC __glewDrawTransformFeedbackStreamInstanced; GLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXDARBPROC __glewLoadTransposeMatrixdARB; GLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXFARBPROC __glewLoadTransposeMatrixfARB; GLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXDARBPROC __glewMultTransposeMatrixdARB; GLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXFARBPROC __glewMultTransposeMatrixfARB; GLEW_FUN_EXPORT PFNGLBINDBUFFERBASEPROC __glewBindBufferBase; GLEW_FUN_EXPORT PFNGLBINDBUFFERRANGEPROC __glewBindBufferRange; GLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC __glewGetActiveUniformBlockName; GLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMBLOCKIVPROC __glewGetActiveUniformBlockiv; GLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMNAMEPROC __glewGetActiveUniformName; GLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMSIVPROC __glewGetActiveUniformsiv; GLEW_FUN_EXPORT PFNGLGETINTEGERI_VPROC __glewGetIntegeri_v; GLEW_FUN_EXPORT PFNGLGETUNIFORMBLOCKINDEXPROC __glewGetUniformBlockIndex; GLEW_FUN_EXPORT PFNGLGETUNIFORMINDICESPROC __glewGetUniformIndices; GLEW_FUN_EXPORT PFNGLUNIFORMBLOCKBINDINGPROC __glewUniformBlockBinding; GLEW_FUN_EXPORT PFNGLBINDVERTEXARRAYPROC __glewBindVertexArray; GLEW_FUN_EXPORT PFNGLDELETEVERTEXARRAYSPROC __glewDeleteVertexArrays; GLEW_FUN_EXPORT PFNGLGENVERTEXARRAYSPROC __glewGenVertexArrays; GLEW_FUN_EXPORT PFNGLISVERTEXARRAYPROC __glewIsVertexArray; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLDVPROC __glewGetVertexAttribLdv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1DPROC __glewVertexAttribL1d; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1DVPROC __glewVertexAttribL1dv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2DPROC __glewVertexAttribL2d; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2DVPROC __glewVertexAttribL2dv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3DPROC __glewVertexAttribL3d; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3DVPROC __glewVertexAttribL3dv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4DPROC __glewVertexAttribL4d; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4DVPROC __glewVertexAttribL4dv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBLPOINTERPROC __glewVertexAttribLPointer; GLEW_FUN_EXPORT PFNGLBINDVERTEXBUFFERPROC __glewBindVertexBuffer; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBBINDINGPROC __glewVertexAttribBinding; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBFORMATPROC __glewVertexAttribFormat; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBIFORMATPROC __glewVertexAttribIFormat; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBLFORMATPROC __glewVertexAttribLFormat; GLEW_FUN_EXPORT PFNGLVERTEXBINDINGDIVISORPROC __glewVertexBindingDivisor; GLEW_FUN_EXPORT PFNGLVERTEXBLENDARBPROC __glewVertexBlendARB; GLEW_FUN_EXPORT PFNGLWEIGHTPOINTERARBPROC __glewWeightPointerARB; GLEW_FUN_EXPORT PFNGLWEIGHTBVARBPROC __glewWeightbvARB; GLEW_FUN_EXPORT PFNGLWEIGHTDVARBPROC __glewWeightdvARB; GLEW_FUN_EXPORT PFNGLWEIGHTFVARBPROC __glewWeightfvARB; GLEW_FUN_EXPORT PFNGLWEIGHTIVARBPROC __glewWeightivARB; GLEW_FUN_EXPORT PFNGLWEIGHTSVARBPROC __glewWeightsvARB; GLEW_FUN_EXPORT PFNGLWEIGHTUBVARBPROC __glewWeightubvARB; GLEW_FUN_EXPORT PFNGLWEIGHTUIVARBPROC __glewWeightuivARB; GLEW_FUN_EXPORT PFNGLWEIGHTUSVARBPROC __glewWeightusvARB; GLEW_FUN_EXPORT PFNGLBINDBUFFERARBPROC __glewBindBufferARB; GLEW_FUN_EXPORT PFNGLBUFFERDATAARBPROC __glewBufferDataARB; GLEW_FUN_EXPORT PFNGLBUFFERSUBDATAARBPROC __glewBufferSubDataARB; GLEW_FUN_EXPORT PFNGLDELETEBUFFERSARBPROC __glewDeleteBuffersARB; GLEW_FUN_EXPORT PFNGLGENBUFFERSARBPROC __glewGenBuffersARB; GLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERIVARBPROC __glewGetBufferParameterivARB; GLEW_FUN_EXPORT PFNGLGETBUFFERPOINTERVARBPROC __glewGetBufferPointervARB; GLEW_FUN_EXPORT PFNGLGETBUFFERSUBDATAARBPROC __glewGetBufferSubDataARB; GLEW_FUN_EXPORT PFNGLISBUFFERARBPROC __glewIsBufferARB; GLEW_FUN_EXPORT PFNGLMAPBUFFERARBPROC __glewMapBufferARB; GLEW_FUN_EXPORT PFNGLUNMAPBUFFERARBPROC __glewUnmapBufferARB; GLEW_FUN_EXPORT PFNGLBINDPROGRAMARBPROC __glewBindProgramARB; GLEW_FUN_EXPORT PFNGLDELETEPROGRAMSARBPROC __glewDeleteProgramsARB; GLEW_FUN_EXPORT PFNGLDISABLEVERTEXATTRIBARRAYARBPROC __glewDisableVertexAttribArrayARB; GLEW_FUN_EXPORT PFNGLENABLEVERTEXATTRIBARRAYARBPROC __glewEnableVertexAttribArrayARB; GLEW_FUN_EXPORT PFNGLGENPROGRAMSARBPROC __glewGenProgramsARB; GLEW_FUN_EXPORT PFNGLGETPROGRAMENVPARAMETERDVARBPROC __glewGetProgramEnvParameterdvARB; GLEW_FUN_EXPORT PFNGLGETPROGRAMENVPARAMETERFVARBPROC __glewGetProgramEnvParameterfvARB; GLEW_FUN_EXPORT PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC __glewGetProgramLocalParameterdvARB; GLEW_FUN_EXPORT PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC __glewGetProgramLocalParameterfvARB; GLEW_FUN_EXPORT PFNGLGETPROGRAMSTRINGARBPROC __glewGetProgramStringARB; GLEW_FUN_EXPORT PFNGLGETPROGRAMIVARBPROC __glewGetProgramivARB; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBPOINTERVARBPROC __glewGetVertexAttribPointervARB; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBDVARBPROC __glewGetVertexAttribdvARB; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBFVARBPROC __glewGetVertexAttribfvARB; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIVARBPROC __glewGetVertexAttribivARB; GLEW_FUN_EXPORT PFNGLISPROGRAMARBPROC __glewIsProgramARB; GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4DARBPROC __glewProgramEnvParameter4dARB; GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4DVARBPROC __glewProgramEnvParameter4dvARB; GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4FARBPROC __glewProgramEnvParameter4fARB; GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4FVARBPROC __glewProgramEnvParameter4fvARB; GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4DARBPROC __glewProgramLocalParameter4dARB; GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4DVARBPROC __glewProgramLocalParameter4dvARB; GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4FARBPROC __glewProgramLocalParameter4fARB; GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4FVARBPROC __glewProgramLocalParameter4fvARB; GLEW_FUN_EXPORT PFNGLPROGRAMSTRINGARBPROC __glewProgramStringARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DARBPROC __glewVertexAttrib1dARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DVARBPROC __glewVertexAttrib1dvARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FARBPROC __glewVertexAttrib1fARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FVARBPROC __glewVertexAttrib1fvARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SARBPROC __glewVertexAttrib1sARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SVARBPROC __glewVertexAttrib1svARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DARBPROC __glewVertexAttrib2dARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DVARBPROC __glewVertexAttrib2dvARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FARBPROC __glewVertexAttrib2fARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FVARBPROC __glewVertexAttrib2fvARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SARBPROC __glewVertexAttrib2sARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SVARBPROC __glewVertexAttrib2svARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DARBPROC __glewVertexAttrib3dARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DVARBPROC __glewVertexAttrib3dvARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FARBPROC __glewVertexAttrib3fARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FVARBPROC __glewVertexAttrib3fvARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SARBPROC __glewVertexAttrib3sARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SVARBPROC __glewVertexAttrib3svARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NBVARBPROC __glewVertexAttrib4NbvARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NIVARBPROC __glewVertexAttrib4NivARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NSVARBPROC __glewVertexAttrib4NsvARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBARBPROC __glewVertexAttrib4NubARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBVARBPROC __glewVertexAttrib4NubvARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUIVARBPROC __glewVertexAttrib4NuivARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUSVARBPROC __glewVertexAttrib4NusvARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4BVARBPROC __glewVertexAttrib4bvARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DARBPROC __glewVertexAttrib4dARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DVARBPROC __glewVertexAttrib4dvARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FARBPROC __glewVertexAttrib4fARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FVARBPROC __glewVertexAttrib4fvARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4IVARBPROC __glewVertexAttrib4ivARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SARBPROC __glewVertexAttrib4sARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SVARBPROC __glewVertexAttrib4svARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBVARBPROC __glewVertexAttrib4ubvARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UIVARBPROC __glewVertexAttrib4uivARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4USVARBPROC __glewVertexAttrib4usvARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBPOINTERARBPROC __glewVertexAttribPointerARB; GLEW_FUN_EXPORT PFNGLBINDATTRIBLOCATIONARBPROC __glewBindAttribLocationARB; GLEW_FUN_EXPORT PFNGLGETACTIVEATTRIBARBPROC __glewGetActiveAttribARB; GLEW_FUN_EXPORT PFNGLGETATTRIBLOCATIONARBPROC __glewGetAttribLocationARB; GLEW_FUN_EXPORT PFNGLCOLORP3UIPROC __glewColorP3ui; GLEW_FUN_EXPORT PFNGLCOLORP3UIVPROC __glewColorP3uiv; GLEW_FUN_EXPORT PFNGLCOLORP4UIPROC __glewColorP4ui; GLEW_FUN_EXPORT PFNGLCOLORP4UIVPROC __glewColorP4uiv; GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP1UIPROC __glewMultiTexCoordP1ui; GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP1UIVPROC __glewMultiTexCoordP1uiv; GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP2UIPROC __glewMultiTexCoordP2ui; GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP2UIVPROC __glewMultiTexCoordP2uiv; GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP3UIPROC __glewMultiTexCoordP3ui; GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP3UIVPROC __glewMultiTexCoordP3uiv; GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP4UIPROC __glewMultiTexCoordP4ui; GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP4UIVPROC __glewMultiTexCoordP4uiv; GLEW_FUN_EXPORT PFNGLNORMALP3UIPROC __glewNormalP3ui; GLEW_FUN_EXPORT PFNGLNORMALP3UIVPROC __glewNormalP3uiv; GLEW_FUN_EXPORT PFNGLSECONDARYCOLORP3UIPROC __glewSecondaryColorP3ui; GLEW_FUN_EXPORT PFNGLSECONDARYCOLORP3UIVPROC __glewSecondaryColorP3uiv; GLEW_FUN_EXPORT PFNGLTEXCOORDP1UIPROC __glewTexCoordP1ui; GLEW_FUN_EXPORT PFNGLTEXCOORDP1UIVPROC __glewTexCoordP1uiv; GLEW_FUN_EXPORT PFNGLTEXCOORDP2UIPROC __glewTexCoordP2ui; GLEW_FUN_EXPORT PFNGLTEXCOORDP2UIVPROC __glewTexCoordP2uiv; GLEW_FUN_EXPORT PFNGLTEXCOORDP3UIPROC __glewTexCoordP3ui; GLEW_FUN_EXPORT PFNGLTEXCOORDP3UIVPROC __glewTexCoordP3uiv; GLEW_FUN_EXPORT PFNGLTEXCOORDP4UIPROC __glewTexCoordP4ui; GLEW_FUN_EXPORT PFNGLTEXCOORDP4UIVPROC __glewTexCoordP4uiv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP1UIPROC __glewVertexAttribP1ui; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP1UIVPROC __glewVertexAttribP1uiv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP2UIPROC __glewVertexAttribP2ui; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP2UIVPROC __glewVertexAttribP2uiv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP3UIPROC __glewVertexAttribP3ui; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP3UIVPROC __glewVertexAttribP3uiv; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP4UIPROC __glewVertexAttribP4ui; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP4UIVPROC __glewVertexAttribP4uiv; GLEW_FUN_EXPORT PFNGLVERTEXP2UIPROC __glewVertexP2ui; GLEW_FUN_EXPORT PFNGLVERTEXP2UIVPROC __glewVertexP2uiv; GLEW_FUN_EXPORT PFNGLVERTEXP3UIPROC __glewVertexP3ui; GLEW_FUN_EXPORT PFNGLVERTEXP3UIVPROC __glewVertexP3uiv; GLEW_FUN_EXPORT PFNGLVERTEXP4UIPROC __glewVertexP4ui; GLEW_FUN_EXPORT PFNGLVERTEXP4UIVPROC __glewVertexP4uiv; GLEW_FUN_EXPORT PFNGLDEPTHRANGEARRAYVPROC __glewDepthRangeArrayv; GLEW_FUN_EXPORT PFNGLDEPTHRANGEINDEXEDPROC __glewDepthRangeIndexed; GLEW_FUN_EXPORT PFNGLGETDOUBLEI_VPROC __glewGetDoublei_v; GLEW_FUN_EXPORT PFNGLGETFLOATI_VPROC __glewGetFloati_v; GLEW_FUN_EXPORT PFNGLSCISSORARRAYVPROC __glewScissorArrayv; GLEW_FUN_EXPORT PFNGLSCISSORINDEXEDPROC __glewScissorIndexed; GLEW_FUN_EXPORT PFNGLSCISSORINDEXEDVPROC __glewScissorIndexedv; GLEW_FUN_EXPORT PFNGLVIEWPORTARRAYVPROC __glewViewportArrayv; GLEW_FUN_EXPORT PFNGLVIEWPORTINDEXEDFPROC __glewViewportIndexedf; GLEW_FUN_EXPORT PFNGLVIEWPORTINDEXEDFVPROC __glewViewportIndexedfv; GLEW_FUN_EXPORT PFNGLWINDOWPOS2DARBPROC __glewWindowPos2dARB; GLEW_FUN_EXPORT PFNGLWINDOWPOS2DVARBPROC __glewWindowPos2dvARB; GLEW_FUN_EXPORT PFNGLWINDOWPOS2FARBPROC __glewWindowPos2fARB; GLEW_FUN_EXPORT PFNGLWINDOWPOS2FVARBPROC __glewWindowPos2fvARB; GLEW_FUN_EXPORT PFNGLWINDOWPOS2IARBPROC __glewWindowPos2iARB; GLEW_FUN_EXPORT PFNGLWINDOWPOS2IVARBPROC __glewWindowPos2ivARB; GLEW_FUN_EXPORT PFNGLWINDOWPOS2SARBPROC __glewWindowPos2sARB; GLEW_FUN_EXPORT PFNGLWINDOWPOS2SVARBPROC __glewWindowPos2svARB; GLEW_FUN_EXPORT PFNGLWINDOWPOS3DARBPROC __glewWindowPos3dARB; GLEW_FUN_EXPORT PFNGLWINDOWPOS3DVARBPROC __glewWindowPos3dvARB; GLEW_FUN_EXPORT PFNGLWINDOWPOS3FARBPROC __glewWindowPos3fARB; GLEW_FUN_EXPORT PFNGLWINDOWPOS3FVARBPROC __glewWindowPos3fvARB; GLEW_FUN_EXPORT PFNGLWINDOWPOS3IARBPROC __glewWindowPos3iARB; GLEW_FUN_EXPORT PFNGLWINDOWPOS3IVARBPROC __glewWindowPos3ivARB; GLEW_FUN_EXPORT PFNGLWINDOWPOS3SARBPROC __glewWindowPos3sARB; GLEW_FUN_EXPORT PFNGLWINDOWPOS3SVARBPROC __glewWindowPos3svARB; GLEW_FUN_EXPORT PFNGLDRAWBUFFERSATIPROC __glewDrawBuffersATI; GLEW_FUN_EXPORT PFNGLDRAWELEMENTARRAYATIPROC __glewDrawElementArrayATI; GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTARRAYATIPROC __glewDrawRangeElementArrayATI; GLEW_FUN_EXPORT PFNGLELEMENTPOINTERATIPROC __glewElementPointerATI; GLEW_FUN_EXPORT PFNGLGETTEXBUMPPARAMETERFVATIPROC __glewGetTexBumpParameterfvATI; GLEW_FUN_EXPORT PFNGLGETTEXBUMPPARAMETERIVATIPROC __glewGetTexBumpParameterivATI; GLEW_FUN_EXPORT PFNGLTEXBUMPPARAMETERFVATIPROC __glewTexBumpParameterfvATI; GLEW_FUN_EXPORT PFNGLTEXBUMPPARAMETERIVATIPROC __glewTexBumpParameterivATI; GLEW_FUN_EXPORT PFNGLALPHAFRAGMENTOP1ATIPROC __glewAlphaFragmentOp1ATI; GLEW_FUN_EXPORT PFNGLALPHAFRAGMENTOP2ATIPROC __glewAlphaFragmentOp2ATI; GLEW_FUN_EXPORT PFNGLALPHAFRAGMENTOP3ATIPROC __glewAlphaFragmentOp3ATI; GLEW_FUN_EXPORT PFNGLBEGINFRAGMENTSHADERATIPROC __glewBeginFragmentShaderATI; GLEW_FUN_EXPORT PFNGLBINDFRAGMENTSHADERATIPROC __glewBindFragmentShaderATI; GLEW_FUN_EXPORT PFNGLCOLORFRAGMENTOP1ATIPROC __glewColorFragmentOp1ATI; GLEW_FUN_EXPORT PFNGLCOLORFRAGMENTOP2ATIPROC __glewColorFragmentOp2ATI; GLEW_FUN_EXPORT PFNGLCOLORFRAGMENTOP3ATIPROC __glewColorFragmentOp3ATI; GLEW_FUN_EXPORT PFNGLDELETEFRAGMENTSHADERATIPROC __glewDeleteFragmentShaderATI; GLEW_FUN_EXPORT PFNGLENDFRAGMENTSHADERATIPROC __glewEndFragmentShaderATI; GLEW_FUN_EXPORT PFNGLGENFRAGMENTSHADERSATIPROC __glewGenFragmentShadersATI; GLEW_FUN_EXPORT PFNGLPASSTEXCOORDATIPROC __glewPassTexCoordATI; GLEW_FUN_EXPORT PFNGLSAMPLEMAPATIPROC __glewSampleMapATI; GLEW_FUN_EXPORT PFNGLSETFRAGMENTSHADERCONSTANTATIPROC __glewSetFragmentShaderConstantATI; GLEW_FUN_EXPORT PFNGLMAPOBJECTBUFFERATIPROC __glewMapObjectBufferATI; GLEW_FUN_EXPORT PFNGLUNMAPOBJECTBUFFERATIPROC __glewUnmapObjectBufferATI; GLEW_FUN_EXPORT PFNGLPNTRIANGLESFATIPROC __glewPNTrianglesfATI; GLEW_FUN_EXPORT PFNGLPNTRIANGLESIATIPROC __glewPNTrianglesiATI; GLEW_FUN_EXPORT PFNGLSTENCILFUNCSEPARATEATIPROC __glewStencilFuncSeparateATI; GLEW_FUN_EXPORT PFNGLSTENCILOPSEPARATEATIPROC __glewStencilOpSeparateATI; GLEW_FUN_EXPORT PFNGLARRAYOBJECTATIPROC __glewArrayObjectATI; GLEW_FUN_EXPORT PFNGLFREEOBJECTBUFFERATIPROC __glewFreeObjectBufferATI; GLEW_FUN_EXPORT PFNGLGETARRAYOBJECTFVATIPROC __glewGetArrayObjectfvATI; GLEW_FUN_EXPORT PFNGLGETARRAYOBJECTIVATIPROC __glewGetArrayObjectivATI; GLEW_FUN_EXPORT PFNGLGETOBJECTBUFFERFVATIPROC __glewGetObjectBufferfvATI; GLEW_FUN_EXPORT PFNGLGETOBJECTBUFFERIVATIPROC __glewGetObjectBufferivATI; GLEW_FUN_EXPORT PFNGLGETVARIANTARRAYOBJECTFVATIPROC __glewGetVariantArrayObjectfvATI; GLEW_FUN_EXPORT PFNGLGETVARIANTARRAYOBJECTIVATIPROC __glewGetVariantArrayObjectivATI; GLEW_FUN_EXPORT PFNGLISOBJECTBUFFERATIPROC __glewIsObjectBufferATI; GLEW_FUN_EXPORT PFNGLNEWOBJECTBUFFERATIPROC __glewNewObjectBufferATI; GLEW_FUN_EXPORT PFNGLUPDATEOBJECTBUFFERATIPROC __glewUpdateObjectBufferATI; GLEW_FUN_EXPORT PFNGLVARIANTARRAYOBJECTATIPROC __glewVariantArrayObjectATI; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC __glewGetVertexAttribArrayObjectfvATI; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC __glewGetVertexAttribArrayObjectivATI; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBARRAYOBJECTATIPROC __glewVertexAttribArrayObjectATI; GLEW_FUN_EXPORT PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC __glewClientActiveVertexStreamATI; GLEW_FUN_EXPORT PFNGLNORMALSTREAM3BATIPROC __glewNormalStream3bATI; GLEW_FUN_EXPORT PFNGLNORMALSTREAM3BVATIPROC __glewNormalStream3bvATI; GLEW_FUN_EXPORT PFNGLNORMALSTREAM3DATIPROC __glewNormalStream3dATI; GLEW_FUN_EXPORT PFNGLNORMALSTREAM3DVATIPROC __glewNormalStream3dvATI; GLEW_FUN_EXPORT PFNGLNORMALSTREAM3FATIPROC __glewNormalStream3fATI; GLEW_FUN_EXPORT PFNGLNORMALSTREAM3FVATIPROC __glewNormalStream3fvATI; GLEW_FUN_EXPORT PFNGLNORMALSTREAM3IATIPROC __glewNormalStream3iATI; GLEW_FUN_EXPORT PFNGLNORMALSTREAM3IVATIPROC __glewNormalStream3ivATI; GLEW_FUN_EXPORT PFNGLNORMALSTREAM3SATIPROC __glewNormalStream3sATI; GLEW_FUN_EXPORT PFNGLNORMALSTREAM3SVATIPROC __glewNormalStream3svATI; GLEW_FUN_EXPORT PFNGLVERTEXBLENDENVFATIPROC __glewVertexBlendEnvfATI; GLEW_FUN_EXPORT PFNGLVERTEXBLENDENVIATIPROC __glewVertexBlendEnviATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1DATIPROC __glewVertexStream1dATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1DVATIPROC __glewVertexStream1dvATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1FATIPROC __glewVertexStream1fATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1FVATIPROC __glewVertexStream1fvATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1IATIPROC __glewVertexStream1iATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1IVATIPROC __glewVertexStream1ivATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1SATIPROC __glewVertexStream1sATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1SVATIPROC __glewVertexStream1svATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2DATIPROC __glewVertexStream2dATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2DVATIPROC __glewVertexStream2dvATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2FATIPROC __glewVertexStream2fATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2FVATIPROC __glewVertexStream2fvATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2IATIPROC __glewVertexStream2iATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2IVATIPROC __glewVertexStream2ivATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2SATIPROC __glewVertexStream2sATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2SVATIPROC __glewVertexStream2svATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3DATIPROC __glewVertexStream3dATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3DVATIPROC __glewVertexStream3dvATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3FATIPROC __glewVertexStream3fATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3FVATIPROC __glewVertexStream3fvATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3IATIPROC __glewVertexStream3iATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3IVATIPROC __glewVertexStream3ivATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3SATIPROC __glewVertexStream3sATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3SVATIPROC __glewVertexStream3svATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4DATIPROC __glewVertexStream4dATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4DVATIPROC __glewVertexStream4dvATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4FATIPROC __glewVertexStream4fATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4FVATIPROC __glewVertexStream4fvATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4IATIPROC __glewVertexStream4iATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4IVATIPROC __glewVertexStream4ivATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4SATIPROC __glewVertexStream4sATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4SVATIPROC __glewVertexStream4svATI; GLEW_FUN_EXPORT PFNGLGETUNIFORMBUFFERSIZEEXTPROC __glewGetUniformBufferSizeEXT; GLEW_FUN_EXPORT PFNGLGETUNIFORMOFFSETEXTPROC __glewGetUniformOffsetEXT; GLEW_FUN_EXPORT PFNGLUNIFORMBUFFEREXTPROC __glewUniformBufferEXT; GLEW_FUN_EXPORT PFNGLBLENDCOLOREXTPROC __glewBlendColorEXT; GLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEEXTPROC __glewBlendEquationSeparateEXT; GLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEEXTPROC __glewBlendFuncSeparateEXT; GLEW_FUN_EXPORT PFNGLBLENDEQUATIONEXTPROC __glewBlendEquationEXT; GLEW_FUN_EXPORT PFNGLCOLORSUBTABLEEXTPROC __glewColorSubTableEXT; GLEW_FUN_EXPORT PFNGLCOPYCOLORSUBTABLEEXTPROC __glewCopyColorSubTableEXT; GLEW_FUN_EXPORT PFNGLLOCKARRAYSEXTPROC __glewLockArraysEXT; GLEW_FUN_EXPORT PFNGLUNLOCKARRAYSEXTPROC __glewUnlockArraysEXT; GLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER1DEXTPROC __glewConvolutionFilter1DEXT; GLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER2DEXTPROC __glewConvolutionFilter2DEXT; GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFEXTPROC __glewConvolutionParameterfEXT; GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFVEXTPROC __glewConvolutionParameterfvEXT; GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIEXTPROC __glewConvolutionParameteriEXT; GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIVEXTPROC __glewConvolutionParameterivEXT; GLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC __glewCopyConvolutionFilter1DEXT; GLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC __glewCopyConvolutionFilter2DEXT; GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONFILTEREXTPROC __glewGetConvolutionFilterEXT; GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC __glewGetConvolutionParameterfvEXT; GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC __glewGetConvolutionParameterivEXT; GLEW_FUN_EXPORT PFNGLGETSEPARABLEFILTEREXTPROC __glewGetSeparableFilterEXT; GLEW_FUN_EXPORT PFNGLSEPARABLEFILTER2DEXTPROC __glewSeparableFilter2DEXT; GLEW_FUN_EXPORT PFNGLBINORMALPOINTEREXTPROC __glewBinormalPointerEXT; GLEW_FUN_EXPORT PFNGLTANGENTPOINTEREXTPROC __glewTangentPointerEXT; GLEW_FUN_EXPORT PFNGLCOPYTEXIMAGE1DEXTPROC __glewCopyTexImage1DEXT; GLEW_FUN_EXPORT PFNGLCOPYTEXIMAGE2DEXTPROC __glewCopyTexImage2DEXT; GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE1DEXTPROC __glewCopyTexSubImage1DEXT; GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE2DEXTPROC __glewCopyTexSubImage2DEXT; GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE3DEXTPROC __glewCopyTexSubImage3DEXT; GLEW_FUN_EXPORT PFNGLCULLPARAMETERDVEXTPROC __glewCullParameterdvEXT; GLEW_FUN_EXPORT PFNGLCULLPARAMETERFVEXTPROC __glewCullParameterfvEXT; GLEW_FUN_EXPORT PFNGLINSERTEVENTMARKEREXTPROC __glewInsertEventMarkerEXT; GLEW_FUN_EXPORT PFNGLPOPGROUPMARKEREXTPROC __glewPopGroupMarkerEXT; GLEW_FUN_EXPORT PFNGLPUSHGROUPMARKEREXTPROC __glewPushGroupMarkerEXT; GLEW_FUN_EXPORT PFNGLDEPTHBOUNDSEXTPROC __glewDepthBoundsEXT; GLEW_FUN_EXPORT PFNGLBINDMULTITEXTUREEXTPROC __glewBindMultiTextureEXT; GLEW_FUN_EXPORT PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC __glewCheckNamedFramebufferStatusEXT; GLEW_FUN_EXPORT PFNGLCLIENTATTRIBDEFAULTEXTPROC __glewClientAttribDefaultEXT; GLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC __glewCompressedMultiTexImage1DEXT; GLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC __glewCompressedMultiTexImage2DEXT; GLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC __glewCompressedMultiTexImage3DEXT; GLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC __glewCompressedMultiTexSubImage1DEXT; GLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC __glewCompressedMultiTexSubImage2DEXT; GLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC __glewCompressedMultiTexSubImage3DEXT; GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC __glewCompressedTextureImage1DEXT; GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC __glewCompressedTextureImage2DEXT; GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC __glewCompressedTextureImage3DEXT; GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC __glewCompressedTextureSubImage1DEXT; GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC __glewCompressedTextureSubImage2DEXT; GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC __glewCompressedTextureSubImage3DEXT; GLEW_FUN_EXPORT PFNGLCOPYMULTITEXIMAGE1DEXTPROC __glewCopyMultiTexImage1DEXT; GLEW_FUN_EXPORT PFNGLCOPYMULTITEXIMAGE2DEXTPROC __glewCopyMultiTexImage2DEXT; GLEW_FUN_EXPORT PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC __glewCopyMultiTexSubImage1DEXT; GLEW_FUN_EXPORT PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC __glewCopyMultiTexSubImage2DEXT; GLEW_FUN_EXPORT PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC __glewCopyMultiTexSubImage3DEXT; GLEW_FUN_EXPORT PFNGLCOPYTEXTUREIMAGE1DEXTPROC __glewCopyTextureImage1DEXT; GLEW_FUN_EXPORT PFNGLCOPYTEXTUREIMAGE2DEXTPROC __glewCopyTextureImage2DEXT; GLEW_FUN_EXPORT PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC __glewCopyTextureSubImage1DEXT; GLEW_FUN_EXPORT PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC __glewCopyTextureSubImage2DEXT; GLEW_FUN_EXPORT PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC __glewCopyTextureSubImage3DEXT; GLEW_FUN_EXPORT PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC __glewDisableClientStateIndexedEXT; GLEW_FUN_EXPORT PFNGLDISABLECLIENTSTATEIEXTPROC __glewDisableClientStateiEXT; GLEW_FUN_EXPORT PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC __glewDisableVertexArrayAttribEXT; GLEW_FUN_EXPORT PFNGLDISABLEVERTEXARRAYEXTPROC __glewDisableVertexArrayEXT; GLEW_FUN_EXPORT PFNGLENABLECLIENTSTATEINDEXEDEXTPROC __glewEnableClientStateIndexedEXT; GLEW_FUN_EXPORT PFNGLENABLECLIENTSTATEIEXTPROC __glewEnableClientStateiEXT; GLEW_FUN_EXPORT PFNGLENABLEVERTEXARRAYATTRIBEXTPROC __glewEnableVertexArrayAttribEXT; GLEW_FUN_EXPORT PFNGLENABLEVERTEXARRAYEXTPROC __glewEnableVertexArrayEXT; GLEW_FUN_EXPORT PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC __glewFlushMappedNamedBufferRangeEXT; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC __glewFramebufferDrawBufferEXT; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC __glewFramebufferDrawBuffersEXT; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERREADBUFFEREXTPROC __glewFramebufferReadBufferEXT; GLEW_FUN_EXPORT PFNGLGENERATEMULTITEXMIPMAPEXTPROC __glewGenerateMultiTexMipmapEXT; GLEW_FUN_EXPORT PFNGLGENERATETEXTUREMIPMAPEXTPROC __glewGenerateTextureMipmapEXT; GLEW_FUN_EXPORT PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC __glewGetCompressedMultiTexImageEXT; GLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC __glewGetCompressedTextureImageEXT; GLEW_FUN_EXPORT PFNGLGETDOUBLEINDEXEDVEXTPROC __glewGetDoubleIndexedvEXT; GLEW_FUN_EXPORT PFNGLGETDOUBLEI_VEXTPROC __glewGetDoublei_vEXT; GLEW_FUN_EXPORT PFNGLGETFLOATINDEXEDVEXTPROC __glewGetFloatIndexedvEXT; GLEW_FUN_EXPORT PFNGLGETFLOATI_VEXTPROC __glewGetFloati_vEXT; GLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC __glewGetFramebufferParameterivEXT; GLEW_FUN_EXPORT PFNGLGETMULTITEXENVFVEXTPROC __glewGetMultiTexEnvfvEXT; GLEW_FUN_EXPORT PFNGLGETMULTITEXENVIVEXTPROC __glewGetMultiTexEnvivEXT; GLEW_FUN_EXPORT PFNGLGETMULTITEXGENDVEXTPROC __glewGetMultiTexGendvEXT; GLEW_FUN_EXPORT PFNGLGETMULTITEXGENFVEXTPROC __glewGetMultiTexGenfvEXT; GLEW_FUN_EXPORT PFNGLGETMULTITEXGENIVEXTPROC __glewGetMultiTexGenivEXT; GLEW_FUN_EXPORT PFNGLGETMULTITEXIMAGEEXTPROC __glewGetMultiTexImageEXT; GLEW_FUN_EXPORT PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC __glewGetMultiTexLevelParameterfvEXT; GLEW_FUN_EXPORT PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC __glewGetMultiTexLevelParameterivEXT; GLEW_FUN_EXPORT PFNGLGETMULTITEXPARAMETERIIVEXTPROC __glewGetMultiTexParameterIivEXT; GLEW_FUN_EXPORT PFNGLGETMULTITEXPARAMETERIUIVEXTPROC __glewGetMultiTexParameterIuivEXT; GLEW_FUN_EXPORT PFNGLGETMULTITEXPARAMETERFVEXTPROC __glewGetMultiTexParameterfvEXT; GLEW_FUN_EXPORT PFNGLGETMULTITEXPARAMETERIVEXTPROC __glewGetMultiTexParameterivEXT; GLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC __glewGetNamedBufferParameterivEXT; GLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERPOINTERVEXTPROC __glewGetNamedBufferPointervEXT; GLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERSUBDATAEXTPROC __glewGetNamedBufferSubDataEXT; GLEW_FUN_EXPORT PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC __glewGetNamedFramebufferAttachmentParameterivEXT; GLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC __glewGetNamedProgramLocalParameterIivEXT; GLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC __glewGetNamedProgramLocalParameterIuivEXT; GLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC __glewGetNamedProgramLocalParameterdvEXT; GLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC __glewGetNamedProgramLocalParameterfvEXT; GLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMSTRINGEXTPROC __glewGetNamedProgramStringEXT; GLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMIVEXTPROC __glewGetNamedProgramivEXT; GLEW_FUN_EXPORT PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC __glewGetNamedRenderbufferParameterivEXT; GLEW_FUN_EXPORT PFNGLGETPOINTERINDEXEDVEXTPROC __glewGetPointerIndexedvEXT; GLEW_FUN_EXPORT PFNGLGETPOINTERI_VEXTPROC __glewGetPointeri_vEXT; GLEW_FUN_EXPORT PFNGLGETTEXTUREIMAGEEXTPROC __glewGetTextureImageEXT; GLEW_FUN_EXPORT PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC __glewGetTextureLevelParameterfvEXT; GLEW_FUN_EXPORT PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC __glewGetTextureLevelParameterivEXT; GLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERIIVEXTPROC __glewGetTextureParameterIivEXT; GLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERIUIVEXTPROC __glewGetTextureParameterIuivEXT; GLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERFVEXTPROC __glewGetTextureParameterfvEXT; GLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERIVEXTPROC __glewGetTextureParameterivEXT; GLEW_FUN_EXPORT PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC __glewGetVertexArrayIntegeri_vEXT; GLEW_FUN_EXPORT PFNGLGETVERTEXARRAYINTEGERVEXTPROC __glewGetVertexArrayIntegervEXT; GLEW_FUN_EXPORT PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC __glewGetVertexArrayPointeri_vEXT; GLEW_FUN_EXPORT PFNGLGETVERTEXARRAYPOINTERVEXTPROC __glewGetVertexArrayPointervEXT; GLEW_FUN_EXPORT PFNGLMAPNAMEDBUFFEREXTPROC __glewMapNamedBufferEXT; GLEW_FUN_EXPORT PFNGLMAPNAMEDBUFFERRANGEEXTPROC __glewMapNamedBufferRangeEXT; GLEW_FUN_EXPORT PFNGLMATRIXFRUSTUMEXTPROC __glewMatrixFrustumEXT; GLEW_FUN_EXPORT PFNGLMATRIXLOADIDENTITYEXTPROC __glewMatrixLoadIdentityEXT; GLEW_FUN_EXPORT PFNGLMATRIXLOADTRANSPOSEDEXTPROC __glewMatrixLoadTransposedEXT; GLEW_FUN_EXPORT PFNGLMATRIXLOADTRANSPOSEFEXTPROC __glewMatrixLoadTransposefEXT; GLEW_FUN_EXPORT PFNGLMATRIXLOADDEXTPROC __glewMatrixLoaddEXT; GLEW_FUN_EXPORT PFNGLMATRIXLOADFEXTPROC __glewMatrixLoadfEXT; GLEW_FUN_EXPORT PFNGLMATRIXMULTTRANSPOSEDEXTPROC __glewMatrixMultTransposedEXT; GLEW_FUN_EXPORT PFNGLMATRIXMULTTRANSPOSEFEXTPROC __glewMatrixMultTransposefEXT; GLEW_FUN_EXPORT PFNGLMATRIXMULTDEXTPROC __glewMatrixMultdEXT; GLEW_FUN_EXPORT PFNGLMATRIXMULTFEXTPROC __glewMatrixMultfEXT; GLEW_FUN_EXPORT PFNGLMATRIXORTHOEXTPROC __glewMatrixOrthoEXT; GLEW_FUN_EXPORT PFNGLMATRIXPOPEXTPROC __glewMatrixPopEXT; GLEW_FUN_EXPORT PFNGLMATRIXPUSHEXTPROC __glewMatrixPushEXT; GLEW_FUN_EXPORT PFNGLMATRIXROTATEDEXTPROC __glewMatrixRotatedEXT; GLEW_FUN_EXPORT PFNGLMATRIXROTATEFEXTPROC __glewMatrixRotatefEXT; GLEW_FUN_EXPORT PFNGLMATRIXSCALEDEXTPROC __glewMatrixScaledEXT; GLEW_FUN_EXPORT PFNGLMATRIXSCALEFEXTPROC __glewMatrixScalefEXT; GLEW_FUN_EXPORT PFNGLMATRIXTRANSLATEDEXTPROC __glewMatrixTranslatedEXT; GLEW_FUN_EXPORT PFNGLMATRIXTRANSLATEFEXTPROC __glewMatrixTranslatefEXT; GLEW_FUN_EXPORT PFNGLMULTITEXBUFFEREXTPROC __glewMultiTexBufferEXT; GLEW_FUN_EXPORT PFNGLMULTITEXCOORDPOINTEREXTPROC __glewMultiTexCoordPointerEXT; GLEW_FUN_EXPORT PFNGLMULTITEXENVFEXTPROC __glewMultiTexEnvfEXT; GLEW_FUN_EXPORT PFNGLMULTITEXENVFVEXTPROC __glewMultiTexEnvfvEXT; GLEW_FUN_EXPORT PFNGLMULTITEXENVIEXTPROC __glewMultiTexEnviEXT; GLEW_FUN_EXPORT PFNGLMULTITEXENVIVEXTPROC __glewMultiTexEnvivEXT; GLEW_FUN_EXPORT PFNGLMULTITEXGENDEXTPROC __glewMultiTexGendEXT; GLEW_FUN_EXPORT PFNGLMULTITEXGENDVEXTPROC __glewMultiTexGendvEXT; GLEW_FUN_EXPORT PFNGLMULTITEXGENFEXTPROC __glewMultiTexGenfEXT; GLEW_FUN_EXPORT PFNGLMULTITEXGENFVEXTPROC __glewMultiTexGenfvEXT; GLEW_FUN_EXPORT PFNGLMULTITEXGENIEXTPROC __glewMultiTexGeniEXT; GLEW_FUN_EXPORT PFNGLMULTITEXGENIVEXTPROC __glewMultiTexGenivEXT; GLEW_FUN_EXPORT PFNGLMULTITEXIMAGE1DEXTPROC __glewMultiTexImage1DEXT; GLEW_FUN_EXPORT PFNGLMULTITEXIMAGE2DEXTPROC __glewMultiTexImage2DEXT; GLEW_FUN_EXPORT PFNGLMULTITEXIMAGE3DEXTPROC __glewMultiTexImage3DEXT; GLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERIIVEXTPROC __glewMultiTexParameterIivEXT; GLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERIUIVEXTPROC __glewMultiTexParameterIuivEXT; GLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERFEXTPROC __glewMultiTexParameterfEXT; GLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERFVEXTPROC __glewMultiTexParameterfvEXT; GLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERIEXTPROC __glewMultiTexParameteriEXT; GLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERIVEXTPROC __glewMultiTexParameterivEXT; GLEW_FUN_EXPORT PFNGLMULTITEXRENDERBUFFEREXTPROC __glewMultiTexRenderbufferEXT; GLEW_FUN_EXPORT PFNGLMULTITEXSUBIMAGE1DEXTPROC __glewMultiTexSubImage1DEXT; GLEW_FUN_EXPORT PFNGLMULTITEXSUBIMAGE2DEXTPROC __glewMultiTexSubImage2DEXT; GLEW_FUN_EXPORT PFNGLMULTITEXSUBIMAGE3DEXTPROC __glewMultiTexSubImage3DEXT; GLEW_FUN_EXPORT PFNGLNAMEDBUFFERDATAEXTPROC __glewNamedBufferDataEXT; GLEW_FUN_EXPORT PFNGLNAMEDBUFFERSUBDATAEXTPROC __glewNamedBufferSubDataEXT; GLEW_FUN_EXPORT PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC __glewNamedCopyBufferSubDataEXT; GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC __glewNamedFramebufferRenderbufferEXT; GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC __glewNamedFramebufferTexture1DEXT; GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC __glewNamedFramebufferTexture2DEXT; GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC __glewNamedFramebufferTexture3DEXT; GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC __glewNamedFramebufferTextureEXT; GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC __glewNamedFramebufferTextureFaceEXT; GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC __glewNamedFramebufferTextureLayerEXT; GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC __glewNamedProgramLocalParameter4dEXT; GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC __glewNamedProgramLocalParameter4dvEXT; GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC __glewNamedProgramLocalParameter4fEXT; GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC __glewNamedProgramLocalParameter4fvEXT; GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC __glewNamedProgramLocalParameterI4iEXT; GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC __glewNamedProgramLocalParameterI4ivEXT; GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC __glewNamedProgramLocalParameterI4uiEXT; GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC __glewNamedProgramLocalParameterI4uivEXT; GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC __glewNamedProgramLocalParameters4fvEXT; GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC __glewNamedProgramLocalParametersI4ivEXT; GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC __glewNamedProgramLocalParametersI4uivEXT; GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMSTRINGEXTPROC __glewNamedProgramStringEXT; GLEW_FUN_EXPORT PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC __glewNamedRenderbufferStorageEXT; GLEW_FUN_EXPORT PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC __glewNamedRenderbufferStorageMultisampleCoverageEXT; GLEW_FUN_EXPORT PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC __glewNamedRenderbufferStorageMultisampleEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1DEXTPROC __glewProgramUniform1dEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1DVEXTPROC __glewProgramUniform1dvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1FEXTPROC __glewProgramUniform1fEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1FVEXTPROC __glewProgramUniform1fvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1IEXTPROC __glewProgramUniform1iEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1IVEXTPROC __glewProgramUniform1ivEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UIEXTPROC __glewProgramUniform1uiEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UIVEXTPROC __glewProgramUniform1uivEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2DEXTPROC __glewProgramUniform2dEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2DVEXTPROC __glewProgramUniform2dvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2FEXTPROC __glewProgramUniform2fEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2FVEXTPROC __glewProgramUniform2fvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2IEXTPROC __glewProgramUniform2iEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2IVEXTPROC __glewProgramUniform2ivEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UIEXTPROC __glewProgramUniform2uiEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UIVEXTPROC __glewProgramUniform2uivEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3DEXTPROC __glewProgramUniform3dEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3DVEXTPROC __glewProgramUniform3dvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3FEXTPROC __glewProgramUniform3fEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3FVEXTPROC __glewProgramUniform3fvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3IEXTPROC __glewProgramUniform3iEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3IVEXTPROC __glewProgramUniform3ivEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UIEXTPROC __glewProgramUniform3uiEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UIVEXTPROC __glewProgramUniform3uivEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4DEXTPROC __glewProgramUniform4dEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4DVEXTPROC __glewProgramUniform4dvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4FEXTPROC __glewProgramUniform4fEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4FVEXTPROC __glewProgramUniform4fvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4IEXTPROC __glewProgramUniform4iEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4IVEXTPROC __glewProgramUniform4ivEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UIEXTPROC __glewProgramUniform4uiEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UIVEXTPROC __glewProgramUniform4uivEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC __glewProgramUniformMatrix2dvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC __glewProgramUniformMatrix2fvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC __glewProgramUniformMatrix2x3dvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC __glewProgramUniformMatrix2x3fvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC __glewProgramUniformMatrix2x4dvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC __glewProgramUniformMatrix2x4fvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC __glewProgramUniformMatrix3dvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC __glewProgramUniformMatrix3fvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC __glewProgramUniformMatrix3x2dvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC __glewProgramUniformMatrix3x2fvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC __glewProgramUniformMatrix3x4dvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC __glewProgramUniformMatrix3x4fvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC __glewProgramUniformMatrix4dvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC __glewProgramUniformMatrix4fvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC __glewProgramUniformMatrix4x2dvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC __glewProgramUniformMatrix4x2fvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC __glewProgramUniformMatrix4x3dvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC __glewProgramUniformMatrix4x3fvEXT; GLEW_FUN_EXPORT PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC __glewPushClientAttribDefaultEXT; GLEW_FUN_EXPORT PFNGLTEXTUREBUFFEREXTPROC __glewTextureBufferEXT; GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE1DEXTPROC __glewTextureImage1DEXT; GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE2DEXTPROC __glewTextureImage2DEXT; GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE3DEXTPROC __glewTextureImage3DEXT; GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIIVEXTPROC __glewTextureParameterIivEXT; GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIUIVEXTPROC __glewTextureParameterIuivEXT; GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERFEXTPROC __glewTextureParameterfEXT; GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERFVEXTPROC __glewTextureParameterfvEXT; GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIEXTPROC __glewTextureParameteriEXT; GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIVEXTPROC __glewTextureParameterivEXT; GLEW_FUN_EXPORT PFNGLTEXTURERENDERBUFFEREXTPROC __glewTextureRenderbufferEXT; GLEW_FUN_EXPORT PFNGLTEXTURESUBIMAGE1DEXTPROC __glewTextureSubImage1DEXT; GLEW_FUN_EXPORT PFNGLTEXTURESUBIMAGE2DEXTPROC __glewTextureSubImage2DEXT; GLEW_FUN_EXPORT PFNGLTEXTURESUBIMAGE3DEXTPROC __glewTextureSubImage3DEXT; GLEW_FUN_EXPORT PFNGLUNMAPNAMEDBUFFEREXTPROC __glewUnmapNamedBufferEXT; GLEW_FUN_EXPORT PFNGLVERTEXARRAYCOLOROFFSETEXTPROC __glewVertexArrayColorOffsetEXT; GLEW_FUN_EXPORT PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC __glewVertexArrayEdgeFlagOffsetEXT; GLEW_FUN_EXPORT PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC __glewVertexArrayFogCoordOffsetEXT; GLEW_FUN_EXPORT PFNGLVERTEXARRAYINDEXOFFSETEXTPROC __glewVertexArrayIndexOffsetEXT; GLEW_FUN_EXPORT PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC __glewVertexArrayMultiTexCoordOffsetEXT; GLEW_FUN_EXPORT PFNGLVERTEXARRAYNORMALOFFSETEXTPROC __glewVertexArrayNormalOffsetEXT; GLEW_FUN_EXPORT PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC __glewVertexArraySecondaryColorOffsetEXT; GLEW_FUN_EXPORT PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC __glewVertexArrayTexCoordOffsetEXT; GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC __glewVertexArrayVertexAttribIOffsetEXT; GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC __glewVertexArrayVertexAttribOffsetEXT; GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC __glewVertexArrayVertexOffsetEXT; GLEW_FUN_EXPORT PFNGLCOLORMASKINDEXEDEXTPROC __glewColorMaskIndexedEXT; GLEW_FUN_EXPORT PFNGLDISABLEINDEXEDEXTPROC __glewDisableIndexedEXT; GLEW_FUN_EXPORT PFNGLENABLEINDEXEDEXTPROC __glewEnableIndexedEXT; GLEW_FUN_EXPORT PFNGLGETBOOLEANINDEXEDVEXTPROC __glewGetBooleanIndexedvEXT; GLEW_FUN_EXPORT PFNGLGETINTEGERINDEXEDVEXTPROC __glewGetIntegerIndexedvEXT; GLEW_FUN_EXPORT PFNGLISENABLEDINDEXEDEXTPROC __glewIsEnabledIndexedEXT; GLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDEXTPROC __glewDrawArraysInstancedEXT; GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDEXTPROC __glewDrawElementsInstancedEXT; GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTSEXTPROC __glewDrawRangeElementsEXT; GLEW_FUN_EXPORT PFNGLFOGCOORDPOINTEREXTPROC __glewFogCoordPointerEXT; GLEW_FUN_EXPORT PFNGLFOGCOORDDEXTPROC __glewFogCoorddEXT; GLEW_FUN_EXPORT PFNGLFOGCOORDDVEXTPROC __glewFogCoorddvEXT; GLEW_FUN_EXPORT PFNGLFOGCOORDFEXTPROC __glewFogCoordfEXT; GLEW_FUN_EXPORT PFNGLFOGCOORDFVEXTPROC __glewFogCoordfvEXT; GLEW_FUN_EXPORT PFNGLFRAGMENTCOLORMATERIALEXTPROC __glewFragmentColorMaterialEXT; GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFEXTPROC __glewFragmentLightModelfEXT; GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFVEXTPROC __glewFragmentLightModelfvEXT; GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELIEXTPROC __glewFragmentLightModeliEXT; GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELIVEXTPROC __glewFragmentLightModelivEXT; GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFEXTPROC __glewFragmentLightfEXT; GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFVEXTPROC __glewFragmentLightfvEXT; GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTIEXTPROC __glewFragmentLightiEXT; GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTIVEXTPROC __glewFragmentLightivEXT; GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFEXTPROC __glewFragmentMaterialfEXT; GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFVEXTPROC __glewFragmentMaterialfvEXT; GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALIEXTPROC __glewFragmentMaterialiEXT; GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALIVEXTPROC __glewFragmentMaterialivEXT; GLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTFVEXTPROC __glewGetFragmentLightfvEXT; GLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTIVEXTPROC __glewGetFragmentLightivEXT; GLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALFVEXTPROC __glewGetFragmentMaterialfvEXT; GLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALIVEXTPROC __glewGetFragmentMaterialivEXT; GLEW_FUN_EXPORT PFNGLLIGHTENVIEXTPROC __glewLightEnviEXT; GLEW_FUN_EXPORT PFNGLBLITFRAMEBUFFEREXTPROC __glewBlitFramebufferEXT; GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC __glewRenderbufferStorageMultisampleEXT; GLEW_FUN_EXPORT PFNGLBINDFRAMEBUFFEREXTPROC __glewBindFramebufferEXT; GLEW_FUN_EXPORT PFNGLBINDRENDERBUFFEREXTPROC __glewBindRenderbufferEXT; GLEW_FUN_EXPORT PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC __glewCheckFramebufferStatusEXT; GLEW_FUN_EXPORT PFNGLDELETEFRAMEBUFFERSEXTPROC __glewDeleteFramebuffersEXT; GLEW_FUN_EXPORT PFNGLDELETERENDERBUFFERSEXTPROC __glewDeleteRenderbuffersEXT; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC __glewFramebufferRenderbufferEXT; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE1DEXTPROC __glewFramebufferTexture1DEXT; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE2DEXTPROC __glewFramebufferTexture2DEXT; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE3DEXTPROC __glewFramebufferTexture3DEXT; GLEW_FUN_EXPORT PFNGLGENFRAMEBUFFERSEXTPROC __glewGenFramebuffersEXT; GLEW_FUN_EXPORT PFNGLGENRENDERBUFFERSEXTPROC __glewGenRenderbuffersEXT; GLEW_FUN_EXPORT PFNGLGENERATEMIPMAPEXTPROC __glewGenerateMipmapEXT; GLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC __glewGetFramebufferAttachmentParameterivEXT; GLEW_FUN_EXPORT PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC __glewGetRenderbufferParameterivEXT; GLEW_FUN_EXPORT PFNGLISFRAMEBUFFEREXTPROC __glewIsFramebufferEXT; GLEW_FUN_EXPORT PFNGLISRENDERBUFFEREXTPROC __glewIsRenderbufferEXT; GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEEXTPROC __glewRenderbufferStorageEXT; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREEXTPROC __glewFramebufferTextureEXT; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC __glewFramebufferTextureFaceEXT; GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERIEXTPROC __glewProgramParameteriEXT; GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERS4FVEXTPROC __glewProgramEnvParameters4fvEXT; GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC __glewProgramLocalParameters4fvEXT; GLEW_FUN_EXPORT PFNGLBINDFRAGDATALOCATIONEXTPROC __glewBindFragDataLocationEXT; GLEW_FUN_EXPORT PFNGLGETFRAGDATALOCATIONEXTPROC __glewGetFragDataLocationEXT; GLEW_FUN_EXPORT PFNGLGETUNIFORMUIVEXTPROC __glewGetUniformuivEXT; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIIVEXTPROC __glewGetVertexAttribIivEXT; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIUIVEXTPROC __glewGetVertexAttribIuivEXT; GLEW_FUN_EXPORT PFNGLUNIFORM1UIEXTPROC __glewUniform1uiEXT; GLEW_FUN_EXPORT PFNGLUNIFORM1UIVEXTPROC __glewUniform1uivEXT; GLEW_FUN_EXPORT PFNGLUNIFORM2UIEXTPROC __glewUniform2uiEXT; GLEW_FUN_EXPORT PFNGLUNIFORM2UIVEXTPROC __glewUniform2uivEXT; GLEW_FUN_EXPORT PFNGLUNIFORM3UIEXTPROC __glewUniform3uiEXT; GLEW_FUN_EXPORT PFNGLUNIFORM3UIVEXTPROC __glewUniform3uivEXT; GLEW_FUN_EXPORT PFNGLUNIFORM4UIEXTPROC __glewUniform4uiEXT; GLEW_FUN_EXPORT PFNGLUNIFORM4UIVEXTPROC __glewUniform4uivEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1IEXTPROC __glewVertexAttribI1iEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1IVEXTPROC __glewVertexAttribI1ivEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1UIEXTPROC __glewVertexAttribI1uiEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1UIVEXTPROC __glewVertexAttribI1uivEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2IEXTPROC __glewVertexAttribI2iEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2IVEXTPROC __glewVertexAttribI2ivEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2UIEXTPROC __glewVertexAttribI2uiEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2UIVEXTPROC __glewVertexAttribI2uivEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3IEXTPROC __glewVertexAttribI3iEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3IVEXTPROC __glewVertexAttribI3ivEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3UIEXTPROC __glewVertexAttribI3uiEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3UIVEXTPROC __glewVertexAttribI3uivEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4BVEXTPROC __glewVertexAttribI4bvEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4IEXTPROC __glewVertexAttribI4iEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4IVEXTPROC __glewVertexAttribI4ivEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4SVEXTPROC __glewVertexAttribI4svEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UBVEXTPROC __glewVertexAttribI4ubvEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UIEXTPROC __glewVertexAttribI4uiEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UIVEXTPROC __glewVertexAttribI4uivEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4USVEXTPROC __glewVertexAttribI4usvEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBIPOINTEREXTPROC __glewVertexAttribIPointerEXT; GLEW_FUN_EXPORT PFNGLGETHISTOGRAMEXTPROC __glewGetHistogramEXT; GLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERFVEXTPROC __glewGetHistogramParameterfvEXT; GLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERIVEXTPROC __glewGetHistogramParameterivEXT; GLEW_FUN_EXPORT PFNGLGETMINMAXEXTPROC __glewGetMinmaxEXT; GLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERFVEXTPROC __glewGetMinmaxParameterfvEXT; GLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERIVEXTPROC __glewGetMinmaxParameterivEXT; GLEW_FUN_EXPORT PFNGLHISTOGRAMEXTPROC __glewHistogramEXT; GLEW_FUN_EXPORT PFNGLMINMAXEXTPROC __glewMinmaxEXT; GLEW_FUN_EXPORT PFNGLRESETHISTOGRAMEXTPROC __glewResetHistogramEXT; GLEW_FUN_EXPORT PFNGLRESETMINMAXEXTPROC __glewResetMinmaxEXT; GLEW_FUN_EXPORT PFNGLINDEXFUNCEXTPROC __glewIndexFuncEXT; GLEW_FUN_EXPORT PFNGLINDEXMATERIALEXTPROC __glewIndexMaterialEXT; GLEW_FUN_EXPORT PFNGLAPPLYTEXTUREEXTPROC __glewApplyTextureEXT; GLEW_FUN_EXPORT PFNGLTEXTURELIGHTEXTPROC __glewTextureLightEXT; GLEW_FUN_EXPORT PFNGLTEXTUREMATERIALEXTPROC __glewTextureMaterialEXT; GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSEXTPROC __glewMultiDrawArraysEXT; GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSEXTPROC __glewMultiDrawElementsEXT; GLEW_FUN_EXPORT PFNGLSAMPLEMASKEXTPROC __glewSampleMaskEXT; GLEW_FUN_EXPORT PFNGLSAMPLEPATTERNEXTPROC __glewSamplePatternEXT; GLEW_FUN_EXPORT PFNGLCOLORTABLEEXTPROC __glewColorTableEXT; GLEW_FUN_EXPORT PFNGLGETCOLORTABLEEXTPROC __glewGetColorTableEXT; GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERFVEXTPROC __glewGetColorTableParameterfvEXT; GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERIVEXTPROC __glewGetColorTableParameterivEXT; GLEW_FUN_EXPORT PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC __glewGetPixelTransformParameterfvEXT; GLEW_FUN_EXPORT PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC __glewGetPixelTransformParameterivEXT; GLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERFEXTPROC __glewPixelTransformParameterfEXT; GLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC __glewPixelTransformParameterfvEXT; GLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERIEXTPROC __glewPixelTransformParameteriEXT; GLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC __glewPixelTransformParameterivEXT; GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFEXTPROC __glewPointParameterfEXT; GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFVEXTPROC __glewPointParameterfvEXT; GLEW_FUN_EXPORT PFNGLPOLYGONOFFSETEXTPROC __glewPolygonOffsetEXT; GLEW_FUN_EXPORT PFNGLPROVOKINGVERTEXEXTPROC __glewProvokingVertexEXT; GLEW_FUN_EXPORT PFNGLBEGINSCENEEXTPROC __glewBeginSceneEXT; GLEW_FUN_EXPORT PFNGLENDSCENEEXTPROC __glewEndSceneEXT; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BEXTPROC __glewSecondaryColor3bEXT; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BVEXTPROC __glewSecondaryColor3bvEXT; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DEXTPROC __glewSecondaryColor3dEXT; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DVEXTPROC __glewSecondaryColor3dvEXT; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FEXTPROC __glewSecondaryColor3fEXT; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FVEXTPROC __glewSecondaryColor3fvEXT; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IEXTPROC __glewSecondaryColor3iEXT; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IVEXTPROC __glewSecondaryColor3ivEXT; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SEXTPROC __glewSecondaryColor3sEXT; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SVEXTPROC __glewSecondaryColor3svEXT; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBEXTPROC __glewSecondaryColor3ubEXT; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBVEXTPROC __glewSecondaryColor3ubvEXT; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIEXTPROC __glewSecondaryColor3uiEXT; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIVEXTPROC __glewSecondaryColor3uivEXT; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USEXTPROC __glewSecondaryColor3usEXT; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USVEXTPROC __glewSecondaryColor3usvEXT; GLEW_FUN_EXPORT PFNGLSECONDARYCOLORPOINTEREXTPROC __glewSecondaryColorPointerEXT; GLEW_FUN_EXPORT PFNGLACTIVEPROGRAMEXTPROC __glewActiveProgramEXT; GLEW_FUN_EXPORT PFNGLCREATESHADERPROGRAMEXTPROC __glewCreateShaderProgramEXT; GLEW_FUN_EXPORT PFNGLUSESHADERPROGRAMEXTPROC __glewUseShaderProgramEXT; GLEW_FUN_EXPORT PFNGLBINDIMAGETEXTUREEXTPROC __glewBindImageTextureEXT; GLEW_FUN_EXPORT PFNGLMEMORYBARRIEREXTPROC __glewMemoryBarrierEXT; GLEW_FUN_EXPORT PFNGLACTIVESTENCILFACEEXTPROC __glewActiveStencilFaceEXT; GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE1DEXTPROC __glewTexSubImage1DEXT; GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE2DEXTPROC __glewTexSubImage2DEXT; GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE3DEXTPROC __glewTexSubImage3DEXT; GLEW_FUN_EXPORT PFNGLTEXIMAGE3DEXTPROC __glewTexImage3DEXT; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC __glewFramebufferTextureLayerEXT; GLEW_FUN_EXPORT PFNGLTEXBUFFEREXTPROC __glewTexBufferEXT; GLEW_FUN_EXPORT PFNGLCLEARCOLORIIEXTPROC __glewClearColorIiEXT; GLEW_FUN_EXPORT PFNGLCLEARCOLORIUIEXTPROC __glewClearColorIuiEXT; GLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIIVEXTPROC __glewGetTexParameterIivEXT; GLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIUIVEXTPROC __glewGetTexParameterIuivEXT; GLEW_FUN_EXPORT PFNGLTEXPARAMETERIIVEXTPROC __glewTexParameterIivEXT; GLEW_FUN_EXPORT PFNGLTEXPARAMETERIUIVEXTPROC __glewTexParameterIuivEXT; GLEW_FUN_EXPORT PFNGLARETEXTURESRESIDENTEXTPROC __glewAreTexturesResidentEXT; GLEW_FUN_EXPORT PFNGLBINDTEXTUREEXTPROC __glewBindTextureEXT; GLEW_FUN_EXPORT PFNGLDELETETEXTURESEXTPROC __glewDeleteTexturesEXT; GLEW_FUN_EXPORT PFNGLGENTEXTURESEXTPROC __glewGenTexturesEXT; GLEW_FUN_EXPORT PFNGLISTEXTUREEXTPROC __glewIsTextureEXT; GLEW_FUN_EXPORT PFNGLPRIORITIZETEXTURESEXTPROC __glewPrioritizeTexturesEXT; GLEW_FUN_EXPORT PFNGLTEXTURENORMALEXTPROC __glewTextureNormalEXT; GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTI64VEXTPROC __glewGetQueryObjecti64vEXT; GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUI64VEXTPROC __glewGetQueryObjectui64vEXT; GLEW_FUN_EXPORT PFNGLBEGINTRANSFORMFEEDBACKEXTPROC __glewBeginTransformFeedbackEXT; GLEW_FUN_EXPORT PFNGLBINDBUFFERBASEEXTPROC __glewBindBufferBaseEXT; GLEW_FUN_EXPORT PFNGLBINDBUFFEROFFSETEXTPROC __glewBindBufferOffsetEXT; GLEW_FUN_EXPORT PFNGLBINDBUFFERRANGEEXTPROC __glewBindBufferRangeEXT; GLEW_FUN_EXPORT PFNGLENDTRANSFORMFEEDBACKEXTPROC __glewEndTransformFeedbackEXT; GLEW_FUN_EXPORT PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC __glewGetTransformFeedbackVaryingEXT; GLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC __glewTransformFeedbackVaryingsEXT; GLEW_FUN_EXPORT PFNGLARRAYELEMENTEXTPROC __glewArrayElementEXT; GLEW_FUN_EXPORT PFNGLCOLORPOINTEREXTPROC __glewColorPointerEXT; GLEW_FUN_EXPORT PFNGLDRAWARRAYSEXTPROC __glewDrawArraysEXT; GLEW_FUN_EXPORT PFNGLEDGEFLAGPOINTEREXTPROC __glewEdgeFlagPointerEXT; GLEW_FUN_EXPORT PFNGLINDEXPOINTEREXTPROC __glewIndexPointerEXT; GLEW_FUN_EXPORT PFNGLNORMALPOINTEREXTPROC __glewNormalPointerEXT; GLEW_FUN_EXPORT PFNGLTEXCOORDPOINTEREXTPROC __glewTexCoordPointerEXT; GLEW_FUN_EXPORT PFNGLVERTEXPOINTEREXTPROC __glewVertexPointerEXT; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLDVEXTPROC __glewGetVertexAttribLdvEXT; GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC __glewVertexArrayVertexAttribLOffsetEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1DEXTPROC __glewVertexAttribL1dEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1DVEXTPROC __glewVertexAttribL1dvEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2DEXTPROC __glewVertexAttribL2dEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2DVEXTPROC __glewVertexAttribL2dvEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3DEXTPROC __glewVertexAttribL3dEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3DVEXTPROC __glewVertexAttribL3dvEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4DEXTPROC __glewVertexAttribL4dEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4DVEXTPROC __glewVertexAttribL4dvEXT; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBLPOINTEREXTPROC __glewVertexAttribLPointerEXT; GLEW_FUN_EXPORT PFNGLBEGINVERTEXSHADEREXTPROC __glewBeginVertexShaderEXT; GLEW_FUN_EXPORT PFNGLBINDLIGHTPARAMETEREXTPROC __glewBindLightParameterEXT; GLEW_FUN_EXPORT PFNGLBINDMATERIALPARAMETEREXTPROC __glewBindMaterialParameterEXT; GLEW_FUN_EXPORT PFNGLBINDPARAMETEREXTPROC __glewBindParameterEXT; GLEW_FUN_EXPORT PFNGLBINDTEXGENPARAMETEREXTPROC __glewBindTexGenParameterEXT; GLEW_FUN_EXPORT PFNGLBINDTEXTUREUNITPARAMETEREXTPROC __glewBindTextureUnitParameterEXT; GLEW_FUN_EXPORT PFNGLBINDVERTEXSHADEREXTPROC __glewBindVertexShaderEXT; GLEW_FUN_EXPORT PFNGLDELETEVERTEXSHADEREXTPROC __glewDeleteVertexShaderEXT; GLEW_FUN_EXPORT PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC __glewDisableVariantClientStateEXT; GLEW_FUN_EXPORT PFNGLENABLEVARIANTCLIENTSTATEEXTPROC __glewEnableVariantClientStateEXT; GLEW_FUN_EXPORT PFNGLENDVERTEXSHADEREXTPROC __glewEndVertexShaderEXT; GLEW_FUN_EXPORT PFNGLEXTRACTCOMPONENTEXTPROC __glewExtractComponentEXT; GLEW_FUN_EXPORT PFNGLGENSYMBOLSEXTPROC __glewGenSymbolsEXT; GLEW_FUN_EXPORT PFNGLGENVERTEXSHADERSEXTPROC __glewGenVertexShadersEXT; GLEW_FUN_EXPORT PFNGLGETINVARIANTBOOLEANVEXTPROC __glewGetInvariantBooleanvEXT; GLEW_FUN_EXPORT PFNGLGETINVARIANTFLOATVEXTPROC __glewGetInvariantFloatvEXT; GLEW_FUN_EXPORT PFNGLGETINVARIANTINTEGERVEXTPROC __glewGetInvariantIntegervEXT; GLEW_FUN_EXPORT PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC __glewGetLocalConstantBooleanvEXT; GLEW_FUN_EXPORT PFNGLGETLOCALCONSTANTFLOATVEXTPROC __glewGetLocalConstantFloatvEXT; GLEW_FUN_EXPORT PFNGLGETLOCALCONSTANTINTEGERVEXTPROC __glewGetLocalConstantIntegervEXT; GLEW_FUN_EXPORT PFNGLGETVARIANTBOOLEANVEXTPROC __glewGetVariantBooleanvEXT; GLEW_FUN_EXPORT PFNGLGETVARIANTFLOATVEXTPROC __glewGetVariantFloatvEXT; GLEW_FUN_EXPORT PFNGLGETVARIANTINTEGERVEXTPROC __glewGetVariantIntegervEXT; GLEW_FUN_EXPORT PFNGLGETVARIANTPOINTERVEXTPROC __glewGetVariantPointervEXT; GLEW_FUN_EXPORT PFNGLINSERTCOMPONENTEXTPROC __glewInsertComponentEXT; GLEW_FUN_EXPORT PFNGLISVARIANTENABLEDEXTPROC __glewIsVariantEnabledEXT; GLEW_FUN_EXPORT PFNGLSETINVARIANTEXTPROC __glewSetInvariantEXT; GLEW_FUN_EXPORT PFNGLSETLOCALCONSTANTEXTPROC __glewSetLocalConstantEXT; GLEW_FUN_EXPORT PFNGLSHADEROP1EXTPROC __glewShaderOp1EXT; GLEW_FUN_EXPORT PFNGLSHADEROP2EXTPROC __glewShaderOp2EXT; GLEW_FUN_EXPORT PFNGLSHADEROP3EXTPROC __glewShaderOp3EXT; GLEW_FUN_EXPORT PFNGLSWIZZLEEXTPROC __glewSwizzleEXT; GLEW_FUN_EXPORT PFNGLVARIANTPOINTEREXTPROC __glewVariantPointerEXT; GLEW_FUN_EXPORT PFNGLVARIANTBVEXTPROC __glewVariantbvEXT; GLEW_FUN_EXPORT PFNGLVARIANTDVEXTPROC __glewVariantdvEXT; GLEW_FUN_EXPORT PFNGLVARIANTFVEXTPROC __glewVariantfvEXT; GLEW_FUN_EXPORT PFNGLVARIANTIVEXTPROC __glewVariantivEXT; GLEW_FUN_EXPORT PFNGLVARIANTSVEXTPROC __glewVariantsvEXT; GLEW_FUN_EXPORT PFNGLVARIANTUBVEXTPROC __glewVariantubvEXT; GLEW_FUN_EXPORT PFNGLVARIANTUIVEXTPROC __glewVariantuivEXT; GLEW_FUN_EXPORT PFNGLVARIANTUSVEXTPROC __glewVariantusvEXT; GLEW_FUN_EXPORT PFNGLWRITEMASKEXTPROC __glewWriteMaskEXT; GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTPOINTEREXTPROC __glewVertexWeightPointerEXT; GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTFEXTPROC __glewVertexWeightfEXT; GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTFVEXTPROC __glewVertexWeightfvEXT; GLEW_FUN_EXPORT PFNGLIMPORTSYNCEXTPROC __glewImportSyncEXT; GLEW_FUN_EXPORT PFNGLFRAMETERMINATORGREMEDYPROC __glewFrameTerminatorGREMEDY; GLEW_FUN_EXPORT PFNGLSTRINGMARKERGREMEDYPROC __glewStringMarkerGREMEDY; GLEW_FUN_EXPORT PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC __glewGetImageTransformParameterfvHP; GLEW_FUN_EXPORT PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC __glewGetImageTransformParameterivHP; GLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERFHPPROC __glewImageTransformParameterfHP; GLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERFVHPPROC __glewImageTransformParameterfvHP; GLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERIHPPROC __glewImageTransformParameteriHP; GLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERIVHPPROC __glewImageTransformParameterivHP; GLEW_FUN_EXPORT PFNGLMULTIMODEDRAWARRAYSIBMPROC __glewMultiModeDrawArraysIBM; GLEW_FUN_EXPORT PFNGLMULTIMODEDRAWELEMENTSIBMPROC __glewMultiModeDrawElementsIBM; GLEW_FUN_EXPORT PFNGLCOLORPOINTERLISTIBMPROC __glewColorPointerListIBM; GLEW_FUN_EXPORT PFNGLEDGEFLAGPOINTERLISTIBMPROC __glewEdgeFlagPointerListIBM; GLEW_FUN_EXPORT PFNGLFOGCOORDPOINTERLISTIBMPROC __glewFogCoordPointerListIBM; GLEW_FUN_EXPORT PFNGLINDEXPOINTERLISTIBMPROC __glewIndexPointerListIBM; GLEW_FUN_EXPORT PFNGLNORMALPOINTERLISTIBMPROC __glewNormalPointerListIBM; GLEW_FUN_EXPORT PFNGLSECONDARYCOLORPOINTERLISTIBMPROC __glewSecondaryColorPointerListIBM; GLEW_FUN_EXPORT PFNGLTEXCOORDPOINTERLISTIBMPROC __glewTexCoordPointerListIBM; GLEW_FUN_EXPORT PFNGLVERTEXPOINTERLISTIBMPROC __glewVertexPointerListIBM; GLEW_FUN_EXPORT PFNGLCOLORPOINTERVINTELPROC __glewColorPointervINTEL; GLEW_FUN_EXPORT PFNGLNORMALPOINTERVINTELPROC __glewNormalPointervINTEL; GLEW_FUN_EXPORT PFNGLTEXCOORDPOINTERVINTELPROC __glewTexCoordPointervINTEL; GLEW_FUN_EXPORT PFNGLVERTEXPOINTERVINTELPROC __glewVertexPointervINTEL; GLEW_FUN_EXPORT PFNGLTEXSCISSORFUNCINTELPROC __glewTexScissorFuncINTEL; GLEW_FUN_EXPORT PFNGLTEXSCISSORINTELPROC __glewTexScissorINTEL; GLEW_FUN_EXPORT PFNGLDEBUGMESSAGECALLBACKPROC __glewDebugMessageCallback; GLEW_FUN_EXPORT PFNGLDEBUGMESSAGECONTROLPROC __glewDebugMessageControl; GLEW_FUN_EXPORT PFNGLDEBUGMESSAGEINSERTPROC __glewDebugMessageInsert; GLEW_FUN_EXPORT PFNGLGETDEBUGMESSAGELOGPROC __glewGetDebugMessageLog; GLEW_FUN_EXPORT PFNGLGETOBJECTLABELPROC __glewGetObjectLabel; GLEW_FUN_EXPORT PFNGLGETOBJECTPTRLABELPROC __glewGetObjectPtrLabel; GLEW_FUN_EXPORT PFNGLGETPOINTERVPROC __glewGetPointerv; GLEW_FUN_EXPORT PFNGLOBJECTLABELPROC __glewObjectLabel; GLEW_FUN_EXPORT PFNGLOBJECTPTRLABELPROC __glewObjectPtrLabel; GLEW_FUN_EXPORT PFNGLPUSHDEBUGGROUPPROC __glewPushDebugGroup; GLEW_FUN_EXPORT PFNGLBUFFERREGIONENABLEDPROC __glewBufferRegionEnabled; GLEW_FUN_EXPORT PFNGLDELETEBUFFERREGIONPROC __glewDeleteBufferRegion; GLEW_FUN_EXPORT PFNGLDRAWBUFFERREGIONPROC __glewDrawBufferRegion; GLEW_FUN_EXPORT PFNGLNEWBUFFERREGIONPROC __glewNewBufferRegion; GLEW_FUN_EXPORT PFNGLREADBUFFERREGIONPROC __glewReadBufferRegion; GLEW_FUN_EXPORT PFNGLRESIZEBUFFERSMESAPROC __glewResizeBuffersMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS2DMESAPROC __glewWindowPos2dMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS2DVMESAPROC __glewWindowPos2dvMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS2FMESAPROC __glewWindowPos2fMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS2FVMESAPROC __glewWindowPos2fvMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS2IMESAPROC __glewWindowPos2iMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS2IVMESAPROC __glewWindowPos2ivMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS2SMESAPROC __glewWindowPos2sMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS2SVMESAPROC __glewWindowPos2svMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS3DMESAPROC __glewWindowPos3dMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS3DVMESAPROC __glewWindowPos3dvMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS3FMESAPROC __glewWindowPos3fMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS3FVMESAPROC __glewWindowPos3fvMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS3IMESAPROC __glewWindowPos3iMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS3IVMESAPROC __glewWindowPos3ivMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS3SMESAPROC __glewWindowPos3sMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS3SVMESAPROC __glewWindowPos3svMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS4DMESAPROC __glewWindowPos4dMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS4DVMESAPROC __glewWindowPos4dvMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS4FMESAPROC __glewWindowPos4fMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS4FVMESAPROC __glewWindowPos4fvMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS4IMESAPROC __glewWindowPos4iMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS4IVMESAPROC __glewWindowPos4ivMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS4SMESAPROC __glewWindowPos4sMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS4SVMESAPROC __glewWindowPos4svMESA; GLEW_FUN_EXPORT PFNGLGETIMAGEHANDLENVPROC __glewGetImageHandleNV; GLEW_FUN_EXPORT PFNGLGETTEXTUREHANDLENVPROC __glewGetTextureHandleNV; GLEW_FUN_EXPORT PFNGLGETTEXTURESAMPLERHANDLENVPROC __glewGetTextureSamplerHandleNV; GLEW_FUN_EXPORT PFNGLISIMAGEHANDLERESIDENTNVPROC __glewIsImageHandleResidentNV; GLEW_FUN_EXPORT PFNGLISTEXTUREHANDLERESIDENTNVPROC __glewIsTextureHandleResidentNV; GLEW_FUN_EXPORT PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC __glewMakeImageHandleNonResidentNV; GLEW_FUN_EXPORT PFNGLMAKEIMAGEHANDLERESIDENTNVPROC __glewMakeImageHandleResidentNV; GLEW_FUN_EXPORT PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC __glewMakeTextureHandleNonResidentNV; GLEW_FUN_EXPORT PFNGLMAKETEXTUREHANDLERESIDENTNVPROC __glewMakeTextureHandleResidentNV; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC __glewProgramUniformHandleui64NV; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC __glewProgramUniformHandleui64vNV; GLEW_FUN_EXPORT PFNGLUNIFORMHANDLEUI64NVPROC __glewUniformHandleui64NV; GLEW_FUN_EXPORT PFNGLUNIFORMHANDLEUI64VNVPROC __glewUniformHandleui64vNV; GLEW_FUN_EXPORT PFNGLBEGINCONDITIONALRENDERNVPROC __glewBeginConditionalRenderNV; GLEW_FUN_EXPORT PFNGLENDCONDITIONALRENDERNVPROC __glewEndConditionalRenderNV; GLEW_FUN_EXPORT PFNGLCOPYIMAGESUBDATANVPROC __glewCopyImageSubDataNV; GLEW_FUN_EXPORT PFNGLCLEARDEPTHDNVPROC __glewClearDepthdNV; GLEW_FUN_EXPORT PFNGLDEPTHBOUNDSDNVPROC __glewDepthBoundsdNV; GLEW_FUN_EXPORT PFNGLDEPTHRANGEDNVPROC __glewDepthRangedNV; GLEW_FUN_EXPORT PFNGLEVALMAPSNVPROC __glewEvalMapsNV; GLEW_FUN_EXPORT PFNGLGETMAPATTRIBPARAMETERFVNVPROC __glewGetMapAttribParameterfvNV; GLEW_FUN_EXPORT PFNGLGETMAPATTRIBPARAMETERIVNVPROC __glewGetMapAttribParameterivNV; GLEW_FUN_EXPORT PFNGLGETMAPCONTROLPOINTSNVPROC __glewGetMapControlPointsNV; GLEW_FUN_EXPORT PFNGLGETMAPPARAMETERFVNVPROC __glewGetMapParameterfvNV; GLEW_FUN_EXPORT PFNGLGETMAPPARAMETERIVNVPROC __glewGetMapParameterivNV; GLEW_FUN_EXPORT PFNGLMAPCONTROLPOINTSNVPROC __glewMapControlPointsNV; GLEW_FUN_EXPORT PFNGLMAPPARAMETERFVNVPROC __glewMapParameterfvNV; GLEW_FUN_EXPORT PFNGLMAPPARAMETERIVNVPROC __glewMapParameterivNV; GLEW_FUN_EXPORT PFNGLGETMULTISAMPLEFVNVPROC __glewGetMultisamplefvNV; GLEW_FUN_EXPORT PFNGLSAMPLEMASKINDEXEDNVPROC __glewSampleMaskIndexedNV; GLEW_FUN_EXPORT PFNGLTEXRENDERBUFFERNVPROC __glewTexRenderbufferNV; GLEW_FUN_EXPORT PFNGLDELETEFENCESNVPROC __glewDeleteFencesNV; GLEW_FUN_EXPORT PFNGLFINISHFENCENVPROC __glewFinishFenceNV; GLEW_FUN_EXPORT PFNGLGENFENCESNVPROC __glewGenFencesNV; GLEW_FUN_EXPORT PFNGLGETFENCEIVNVPROC __glewGetFenceivNV; GLEW_FUN_EXPORT PFNGLISFENCENVPROC __glewIsFenceNV; GLEW_FUN_EXPORT PFNGLSETFENCENVPROC __glewSetFenceNV; GLEW_FUN_EXPORT PFNGLTESTFENCENVPROC __glewTestFenceNV; GLEW_FUN_EXPORT PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC __glewGetProgramNamedParameterdvNV; GLEW_FUN_EXPORT PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC __glewGetProgramNamedParameterfvNV; GLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4DNVPROC __glewProgramNamedParameter4dNV; GLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC __glewProgramNamedParameter4dvNV; GLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4FNVPROC __glewProgramNamedParameter4fNV; GLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC __glewProgramNamedParameter4fvNV; GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC __glewRenderbufferStorageMultisampleCoverageNV; GLEW_FUN_EXPORT PFNGLPROGRAMVERTEXLIMITNVPROC __glewProgramVertexLimitNV; GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4INVPROC __glewProgramEnvParameterI4iNV; GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4IVNVPROC __glewProgramEnvParameterI4ivNV; GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4UINVPROC __glewProgramEnvParameterI4uiNV; GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4UIVNVPROC __glewProgramEnvParameterI4uivNV; GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERSI4IVNVPROC __glewProgramEnvParametersI4ivNV; GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC __glewProgramEnvParametersI4uivNV; GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERI4INVPROC __glewProgramLocalParameterI4iNV; GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC __glewProgramLocalParameterI4ivNV; GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERI4UINVPROC __glewProgramLocalParameterI4uiNV; GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC __glewProgramLocalParameterI4uivNV; GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC __glewProgramLocalParametersI4ivNV; GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC __glewProgramLocalParametersI4uivNV; GLEW_FUN_EXPORT PFNGLGETUNIFORMI64VNVPROC __glewGetUniformi64vNV; GLEW_FUN_EXPORT PFNGLGETUNIFORMUI64VNVPROC __glewGetUniformui64vNV; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1I64NVPROC __glewProgramUniform1i64NV; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1I64VNVPROC __glewProgramUniform1i64vNV; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UI64NVPROC __glewProgramUniform1ui64NV; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UI64VNVPROC __glewProgramUniform1ui64vNV; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2I64NVPROC __glewProgramUniform2i64NV; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2I64VNVPROC __glewProgramUniform2i64vNV; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UI64NVPROC __glewProgramUniform2ui64NV; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UI64VNVPROC __glewProgramUniform2ui64vNV; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3I64NVPROC __glewProgramUniform3i64NV; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3I64VNVPROC __glewProgramUniform3i64vNV; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UI64NVPROC __glewProgramUniform3ui64NV; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UI64VNVPROC __glewProgramUniform3ui64vNV; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4I64NVPROC __glewProgramUniform4i64NV; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4I64VNVPROC __glewProgramUniform4i64vNV; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UI64NVPROC __glewProgramUniform4ui64NV; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UI64VNVPROC __glewProgramUniform4ui64vNV; GLEW_FUN_EXPORT PFNGLUNIFORM1I64NVPROC __glewUniform1i64NV; GLEW_FUN_EXPORT PFNGLUNIFORM1I64VNVPROC __glewUniform1i64vNV; GLEW_FUN_EXPORT PFNGLUNIFORM1UI64NVPROC __glewUniform1ui64NV; GLEW_FUN_EXPORT PFNGLUNIFORM1UI64VNVPROC __glewUniform1ui64vNV; GLEW_FUN_EXPORT PFNGLUNIFORM2I64NVPROC __glewUniform2i64NV; GLEW_FUN_EXPORT PFNGLUNIFORM2I64VNVPROC __glewUniform2i64vNV; GLEW_FUN_EXPORT PFNGLUNIFORM2UI64NVPROC __glewUniform2ui64NV; GLEW_FUN_EXPORT PFNGLUNIFORM2UI64VNVPROC __glewUniform2ui64vNV; GLEW_FUN_EXPORT PFNGLUNIFORM3I64NVPROC __glewUniform3i64NV; GLEW_FUN_EXPORT PFNGLUNIFORM3I64VNVPROC __glewUniform3i64vNV; GLEW_FUN_EXPORT PFNGLUNIFORM3UI64NVPROC __glewUniform3ui64NV; GLEW_FUN_EXPORT PFNGLUNIFORM3UI64VNVPROC __glewUniform3ui64vNV; GLEW_FUN_EXPORT PFNGLUNIFORM4I64NVPROC __glewUniform4i64NV; GLEW_FUN_EXPORT PFNGLUNIFORM4I64VNVPROC __glewUniform4i64vNV; GLEW_FUN_EXPORT PFNGLUNIFORM4UI64NVPROC __glewUniform4ui64NV; GLEW_FUN_EXPORT PFNGLUNIFORM4UI64VNVPROC __glewUniform4ui64vNV; GLEW_FUN_EXPORT PFNGLCOLOR3HNVPROC __glewColor3hNV; GLEW_FUN_EXPORT PFNGLCOLOR3HVNVPROC __glewColor3hvNV; GLEW_FUN_EXPORT PFNGLCOLOR4HNVPROC __glewColor4hNV; GLEW_FUN_EXPORT PFNGLCOLOR4HVNVPROC __glewColor4hvNV; GLEW_FUN_EXPORT PFNGLFOGCOORDHNVPROC __glewFogCoordhNV; GLEW_FUN_EXPORT PFNGLFOGCOORDHVNVPROC __glewFogCoordhvNV; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1HNVPROC __glewMultiTexCoord1hNV; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1HVNVPROC __glewMultiTexCoord1hvNV; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2HNVPROC __glewMultiTexCoord2hNV; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2HVNVPROC __glewMultiTexCoord2hvNV; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3HNVPROC __glewMultiTexCoord3hNV; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3HVNVPROC __glewMultiTexCoord3hvNV; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4HNVPROC __glewMultiTexCoord4hNV; GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4HVNVPROC __glewMultiTexCoord4hvNV; GLEW_FUN_EXPORT PFNGLNORMAL3HNVPROC __glewNormal3hNV; GLEW_FUN_EXPORT PFNGLNORMAL3HVNVPROC __glewNormal3hvNV; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3HNVPROC __glewSecondaryColor3hNV; GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3HVNVPROC __glewSecondaryColor3hvNV; GLEW_FUN_EXPORT PFNGLTEXCOORD1HNVPROC __glewTexCoord1hNV; GLEW_FUN_EXPORT PFNGLTEXCOORD1HVNVPROC __glewTexCoord1hvNV; GLEW_FUN_EXPORT PFNGLTEXCOORD2HNVPROC __glewTexCoord2hNV; GLEW_FUN_EXPORT PFNGLTEXCOORD2HVNVPROC __glewTexCoord2hvNV; GLEW_FUN_EXPORT PFNGLTEXCOORD3HNVPROC __glewTexCoord3hNV; GLEW_FUN_EXPORT PFNGLTEXCOORD3HVNVPROC __glewTexCoord3hvNV; GLEW_FUN_EXPORT PFNGLTEXCOORD4HNVPROC __glewTexCoord4hNV; GLEW_FUN_EXPORT PFNGLTEXCOORD4HVNVPROC __glewTexCoord4hvNV; GLEW_FUN_EXPORT PFNGLVERTEX2HNVPROC __glewVertex2hNV; GLEW_FUN_EXPORT PFNGLVERTEX2HVNVPROC __glewVertex2hvNV; GLEW_FUN_EXPORT PFNGLVERTEX3HNVPROC __glewVertex3hNV; GLEW_FUN_EXPORT PFNGLVERTEX3HVNVPROC __glewVertex3hvNV; GLEW_FUN_EXPORT PFNGLVERTEX4HNVPROC __glewVertex4hNV; GLEW_FUN_EXPORT PFNGLVERTEX4HVNVPROC __glewVertex4hvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1HNVPROC __glewVertexAttrib1hNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1HVNVPROC __glewVertexAttrib1hvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2HNVPROC __glewVertexAttrib2hNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2HVNVPROC __glewVertexAttrib2hvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3HNVPROC __glewVertexAttrib3hNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3HVNVPROC __glewVertexAttrib3hvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4HNVPROC __glewVertexAttrib4hNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4HVNVPROC __glewVertexAttrib4hvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1HVNVPROC __glewVertexAttribs1hvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2HVNVPROC __glewVertexAttribs2hvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3HVNVPROC __glewVertexAttribs3hvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4HVNVPROC __glewVertexAttribs4hvNV; GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTHNVPROC __glewVertexWeighthNV; GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTHVNVPROC __glewVertexWeighthvNV; GLEW_FUN_EXPORT PFNGLBEGINOCCLUSIONQUERYNVPROC __glewBeginOcclusionQueryNV; GLEW_FUN_EXPORT PFNGLDELETEOCCLUSIONQUERIESNVPROC __glewDeleteOcclusionQueriesNV; GLEW_FUN_EXPORT PFNGLENDOCCLUSIONQUERYNVPROC __glewEndOcclusionQueryNV; GLEW_FUN_EXPORT PFNGLGENOCCLUSIONQUERIESNVPROC __glewGenOcclusionQueriesNV; GLEW_FUN_EXPORT PFNGLGETOCCLUSIONQUERYIVNVPROC __glewGetOcclusionQueryivNV; GLEW_FUN_EXPORT PFNGLGETOCCLUSIONQUERYUIVNVPROC __glewGetOcclusionQueryuivNV; GLEW_FUN_EXPORT PFNGLISOCCLUSIONQUERYNVPROC __glewIsOcclusionQueryNV; GLEW_FUN_EXPORT PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC __glewProgramBufferParametersIivNV; GLEW_FUN_EXPORT PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC __glewProgramBufferParametersIuivNV; GLEW_FUN_EXPORT PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC __glewProgramBufferParametersfvNV; GLEW_FUN_EXPORT PFNGLCOPYPATHNVPROC __glewCopyPathNV; GLEW_FUN_EXPORT PFNGLCOVERFILLPATHINSTANCEDNVPROC __glewCoverFillPathInstancedNV; GLEW_FUN_EXPORT PFNGLCOVERFILLPATHNVPROC __glewCoverFillPathNV; GLEW_FUN_EXPORT PFNGLCOVERSTROKEPATHINSTANCEDNVPROC __glewCoverStrokePathInstancedNV; GLEW_FUN_EXPORT PFNGLCOVERSTROKEPATHNVPROC __glewCoverStrokePathNV; GLEW_FUN_EXPORT PFNGLDELETEPATHSNVPROC __glewDeletePathsNV; GLEW_FUN_EXPORT PFNGLGENPATHSNVPROC __glewGenPathsNV; GLEW_FUN_EXPORT PFNGLGETPATHCOLORGENFVNVPROC __glewGetPathColorGenfvNV; GLEW_FUN_EXPORT PFNGLGETPATHCOLORGENIVNVPROC __glewGetPathColorGenivNV; GLEW_FUN_EXPORT PFNGLGETPATHCOMMANDSNVPROC __glewGetPathCommandsNV; GLEW_FUN_EXPORT PFNGLGETPATHCOORDSNVPROC __glewGetPathCoordsNV; GLEW_FUN_EXPORT PFNGLGETPATHDASHARRAYNVPROC __glewGetPathDashArrayNV; GLEW_FUN_EXPORT PFNGLGETPATHLENGTHNVPROC __glewGetPathLengthNV; GLEW_FUN_EXPORT PFNGLGETPATHMETRICRANGENVPROC __glewGetPathMetricRangeNV; GLEW_FUN_EXPORT PFNGLGETPATHMETRICSNVPROC __glewGetPathMetricsNV; GLEW_FUN_EXPORT PFNGLGETPATHPARAMETERFVNVPROC __glewGetPathParameterfvNV; GLEW_FUN_EXPORT PFNGLGETPATHPARAMETERIVNVPROC __glewGetPathParameterivNV; GLEW_FUN_EXPORT PFNGLGETPATHSPACINGNVPROC __glewGetPathSpacingNV; GLEW_FUN_EXPORT PFNGLGETPATHTEXGENFVNVPROC __glewGetPathTexGenfvNV; GLEW_FUN_EXPORT PFNGLGETPATHTEXGENIVNVPROC __glewGetPathTexGenivNV; GLEW_FUN_EXPORT PFNGLINTERPOLATEPATHSNVPROC __glewInterpolatePathsNV; GLEW_FUN_EXPORT PFNGLISPATHNVPROC __glewIsPathNV; GLEW_FUN_EXPORT PFNGLISPOINTINFILLPATHNVPROC __glewIsPointInFillPathNV; GLEW_FUN_EXPORT PFNGLISPOINTINSTROKEPATHNVPROC __glewIsPointInStrokePathNV; GLEW_FUN_EXPORT PFNGLPATHCOLORGENNVPROC __glewPathColorGenNV; GLEW_FUN_EXPORT PFNGLPATHCOMMANDSNVPROC __glewPathCommandsNV; GLEW_FUN_EXPORT PFNGLPATHCOORDSNVPROC __glewPathCoordsNV; GLEW_FUN_EXPORT PFNGLPATHCOVERDEPTHFUNCNVPROC __glewPathCoverDepthFuncNV; GLEW_FUN_EXPORT PFNGLPATHDASHARRAYNVPROC __glewPathDashArrayNV; GLEW_FUN_EXPORT PFNGLPATHFOGGENNVPROC __glewPathFogGenNV; GLEW_FUN_EXPORT PFNGLPATHGLYPHRANGENVPROC __glewPathGlyphRangeNV; GLEW_FUN_EXPORT PFNGLPATHGLYPHSNVPROC __glewPathGlyphsNV; GLEW_FUN_EXPORT PFNGLPATHPARAMETERFNVPROC __glewPathParameterfNV; GLEW_FUN_EXPORT PFNGLPATHPARAMETERFVNVPROC __glewPathParameterfvNV; GLEW_FUN_EXPORT PFNGLPATHPARAMETERINVPROC __glewPathParameteriNV; GLEW_FUN_EXPORT PFNGLPATHPARAMETERIVNVPROC __glewPathParameterivNV; GLEW_FUN_EXPORT PFNGLPATHSTENCILDEPTHOFFSETNVPROC __glewPathStencilDepthOffsetNV; GLEW_FUN_EXPORT PFNGLPATHSTENCILFUNCNVPROC __glewPathStencilFuncNV; GLEW_FUN_EXPORT PFNGLPATHSTRINGNVPROC __glewPathStringNV; GLEW_FUN_EXPORT PFNGLPATHSUBCOMMANDSNVPROC __glewPathSubCommandsNV; GLEW_FUN_EXPORT PFNGLPATHSUBCOORDSNVPROC __glewPathSubCoordsNV; GLEW_FUN_EXPORT PFNGLPATHTEXGENNVPROC __glewPathTexGenNV; GLEW_FUN_EXPORT PFNGLPOINTALONGPATHNVPROC __glewPointAlongPathNV; GLEW_FUN_EXPORT PFNGLSTENCILFILLPATHINSTANCEDNVPROC __glewStencilFillPathInstancedNV; GLEW_FUN_EXPORT PFNGLSTENCILFILLPATHNVPROC __glewStencilFillPathNV; GLEW_FUN_EXPORT PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC __glewStencilStrokePathInstancedNV; GLEW_FUN_EXPORT PFNGLSTENCILSTROKEPATHNVPROC __glewStencilStrokePathNV; GLEW_FUN_EXPORT PFNGLTRANSFORMPATHNVPROC __glewTransformPathNV; GLEW_FUN_EXPORT PFNGLWEIGHTPATHSNVPROC __glewWeightPathsNV; GLEW_FUN_EXPORT PFNGLFLUSHPIXELDATARANGENVPROC __glewFlushPixelDataRangeNV; GLEW_FUN_EXPORT PFNGLPIXELDATARANGENVPROC __glewPixelDataRangeNV; GLEW_FUN_EXPORT PFNGLPOINTPARAMETERINVPROC __glewPointParameteriNV; GLEW_FUN_EXPORT PFNGLPOINTPARAMETERIVNVPROC __glewPointParameterivNV; GLEW_FUN_EXPORT PFNGLGETVIDEOI64VNVPROC __glewGetVideoi64vNV; GLEW_FUN_EXPORT PFNGLGETVIDEOIVNVPROC __glewGetVideoivNV; GLEW_FUN_EXPORT PFNGLGETVIDEOUI64VNVPROC __glewGetVideoui64vNV; GLEW_FUN_EXPORT PFNGLGETVIDEOUIVNVPROC __glewGetVideouivNV; GLEW_FUN_EXPORT PFNGLPRESENTFRAMEDUALFILLNVPROC __glewPresentFrameDualFillNV; GLEW_FUN_EXPORT PFNGLPRESENTFRAMEKEYEDNVPROC __glewPresentFrameKeyedNV; GLEW_FUN_EXPORT PFNGLPRIMITIVERESTARTINDEXNVPROC __glewPrimitiveRestartIndexNV; GLEW_FUN_EXPORT PFNGLPRIMITIVERESTARTNVPROC __glewPrimitiveRestartNV; GLEW_FUN_EXPORT PFNGLCOMBINERINPUTNVPROC __glewCombinerInputNV; GLEW_FUN_EXPORT PFNGLCOMBINEROUTPUTNVPROC __glewCombinerOutputNV; GLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERFNVPROC __glewCombinerParameterfNV; GLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERFVNVPROC __glewCombinerParameterfvNV; GLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERINVPROC __glewCombinerParameteriNV; GLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERIVNVPROC __glewCombinerParameterivNV; GLEW_FUN_EXPORT PFNGLFINALCOMBINERINPUTNVPROC __glewFinalCombinerInputNV; GLEW_FUN_EXPORT PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC __glewGetCombinerInputParameterfvNV; GLEW_FUN_EXPORT PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC __glewGetCombinerInputParameterivNV; GLEW_FUN_EXPORT PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC __glewGetCombinerOutputParameterfvNV; GLEW_FUN_EXPORT PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC __glewGetCombinerOutputParameterivNV; GLEW_FUN_EXPORT PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC __glewGetFinalCombinerInputParameterfvNV; GLEW_FUN_EXPORT PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC __glewGetFinalCombinerInputParameterivNV; GLEW_FUN_EXPORT PFNGLCOMBINERSTAGEPARAMETERFVNVPROC __glewCombinerStageParameterfvNV; GLEW_FUN_EXPORT PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC __glewGetCombinerStageParameterfvNV; GLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERUI64VNVPROC __glewGetBufferParameterui64vNV; GLEW_FUN_EXPORT PFNGLGETINTEGERUI64VNVPROC __glewGetIntegerui64vNV; GLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC __glewGetNamedBufferParameterui64vNV; GLEW_FUN_EXPORT PFNGLISBUFFERRESIDENTNVPROC __glewIsBufferResidentNV; GLEW_FUN_EXPORT PFNGLISNAMEDBUFFERRESIDENTNVPROC __glewIsNamedBufferResidentNV; GLEW_FUN_EXPORT PFNGLMAKEBUFFERNONRESIDENTNVPROC __glewMakeBufferNonResidentNV; GLEW_FUN_EXPORT PFNGLMAKEBUFFERRESIDENTNVPROC __glewMakeBufferResidentNV; GLEW_FUN_EXPORT PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC __glewMakeNamedBufferNonResidentNV; GLEW_FUN_EXPORT PFNGLMAKENAMEDBUFFERRESIDENTNVPROC __glewMakeNamedBufferResidentNV; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMUI64NVPROC __glewProgramUniformui64NV; GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMUI64VNVPROC __glewProgramUniformui64vNV; GLEW_FUN_EXPORT PFNGLUNIFORMUI64NVPROC __glewUniformui64NV; GLEW_FUN_EXPORT PFNGLUNIFORMUI64VNVPROC __glewUniformui64vNV; GLEW_FUN_EXPORT PFNGLTEXTUREBARRIERNVPROC __glewTextureBarrierNV; GLEW_FUN_EXPORT PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC __glewTexImage2DMultisampleCoverageNV; GLEW_FUN_EXPORT PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC __glewTexImage3DMultisampleCoverageNV; GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC __glewTextureImage2DMultisampleCoverageNV; GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC __glewTextureImage2DMultisampleNV; GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC __glewTextureImage3DMultisampleCoverageNV; GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC __glewTextureImage3DMultisampleNV; GLEW_FUN_EXPORT PFNGLACTIVEVARYINGNVPROC __glewActiveVaryingNV; GLEW_FUN_EXPORT PFNGLBEGINTRANSFORMFEEDBACKNVPROC __glewBeginTransformFeedbackNV; GLEW_FUN_EXPORT PFNGLBINDBUFFERBASENVPROC __glewBindBufferBaseNV; GLEW_FUN_EXPORT PFNGLBINDBUFFEROFFSETNVPROC __glewBindBufferOffsetNV; GLEW_FUN_EXPORT PFNGLBINDBUFFERRANGENVPROC __glewBindBufferRangeNV; GLEW_FUN_EXPORT PFNGLENDTRANSFORMFEEDBACKNVPROC __glewEndTransformFeedbackNV; GLEW_FUN_EXPORT PFNGLGETACTIVEVARYINGNVPROC __glewGetActiveVaryingNV; GLEW_FUN_EXPORT PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC __glewGetTransformFeedbackVaryingNV; GLEW_FUN_EXPORT PFNGLGETVARYINGLOCATIONNVPROC __glewGetVaryingLocationNV; GLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC __glewTransformFeedbackAttribsNV; GLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC __glewTransformFeedbackVaryingsNV; GLEW_FUN_EXPORT PFNGLBINDTRANSFORMFEEDBACKNVPROC __glewBindTransformFeedbackNV; GLEW_FUN_EXPORT PFNGLDELETETRANSFORMFEEDBACKSNVPROC __glewDeleteTransformFeedbacksNV; GLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKNVPROC __glewDrawTransformFeedbackNV; GLEW_FUN_EXPORT PFNGLGENTRANSFORMFEEDBACKSNVPROC __glewGenTransformFeedbacksNV; GLEW_FUN_EXPORT PFNGLISTRANSFORMFEEDBACKNVPROC __glewIsTransformFeedbackNV; GLEW_FUN_EXPORT PFNGLPAUSETRANSFORMFEEDBACKNVPROC __glewPauseTransformFeedbackNV; GLEW_FUN_EXPORT PFNGLRESUMETRANSFORMFEEDBACKNVPROC __glewResumeTransformFeedbackNV; GLEW_FUN_EXPORT PFNGLVDPAUFININVPROC __glewVDPAUFiniNV; GLEW_FUN_EXPORT PFNGLVDPAUGETSURFACEIVNVPROC __glewVDPAUGetSurfaceivNV; GLEW_FUN_EXPORT PFNGLVDPAUINITNVPROC __glewVDPAUInitNV; GLEW_FUN_EXPORT PFNGLVDPAUISSURFACENVPROC __glewVDPAUIsSurfaceNV; GLEW_FUN_EXPORT PFNGLVDPAUMAPSURFACESNVPROC __glewVDPAUMapSurfacesNV; GLEW_FUN_EXPORT PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC __glewVDPAURegisterOutputSurfaceNV; GLEW_FUN_EXPORT PFNGLVDPAUREGISTERVIDEOSURFACENVPROC __glewVDPAURegisterVideoSurfaceNV; GLEW_FUN_EXPORT PFNGLVDPAUSURFACEACCESSNVPROC __glewVDPAUSurfaceAccessNV; GLEW_FUN_EXPORT PFNGLVDPAUUNMAPSURFACESNVPROC __glewVDPAUUnmapSurfacesNV; GLEW_FUN_EXPORT PFNGLVDPAUUNREGISTERSURFACENVPROC __glewVDPAUUnregisterSurfaceNV; GLEW_FUN_EXPORT PFNGLFLUSHVERTEXARRAYRANGENVPROC __glewFlushVertexArrayRangeNV; GLEW_FUN_EXPORT PFNGLVERTEXARRAYRANGENVPROC __glewVertexArrayRangeNV; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLI64VNVPROC __glewGetVertexAttribLi64vNV; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLUI64VNVPROC __glewGetVertexAttribLui64vNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1I64NVPROC __glewVertexAttribL1i64NV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1I64VNVPROC __glewVertexAttribL1i64vNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1UI64NVPROC __glewVertexAttribL1ui64NV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1UI64VNVPROC __glewVertexAttribL1ui64vNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2I64NVPROC __glewVertexAttribL2i64NV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2I64VNVPROC __glewVertexAttribL2i64vNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2UI64NVPROC __glewVertexAttribL2ui64NV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2UI64VNVPROC __glewVertexAttribL2ui64vNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3I64NVPROC __glewVertexAttribL3i64NV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3I64VNVPROC __glewVertexAttribL3i64vNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3UI64NVPROC __glewVertexAttribL3ui64NV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3UI64VNVPROC __glewVertexAttribL3ui64vNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4I64NVPROC __glewVertexAttribL4i64NV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4I64VNVPROC __glewVertexAttribL4i64vNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4UI64NVPROC __glewVertexAttribL4ui64NV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4UI64VNVPROC __glewVertexAttribL4ui64vNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBLFORMATNVPROC __glewVertexAttribLFormatNV; GLEW_FUN_EXPORT PFNGLBUFFERADDRESSRANGENVPROC __glewBufferAddressRangeNV; GLEW_FUN_EXPORT PFNGLCOLORFORMATNVPROC __glewColorFormatNV; GLEW_FUN_EXPORT PFNGLEDGEFLAGFORMATNVPROC __glewEdgeFlagFormatNV; GLEW_FUN_EXPORT PFNGLFOGCOORDFORMATNVPROC __glewFogCoordFormatNV; GLEW_FUN_EXPORT PFNGLGETINTEGERUI64I_VNVPROC __glewGetIntegerui64i_vNV; GLEW_FUN_EXPORT PFNGLINDEXFORMATNVPROC __glewIndexFormatNV; GLEW_FUN_EXPORT PFNGLNORMALFORMATNVPROC __glewNormalFormatNV; GLEW_FUN_EXPORT PFNGLSECONDARYCOLORFORMATNVPROC __glewSecondaryColorFormatNV; GLEW_FUN_EXPORT PFNGLTEXCOORDFORMATNVPROC __glewTexCoordFormatNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBFORMATNVPROC __glewVertexAttribFormatNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBIFORMATNVPROC __glewVertexAttribIFormatNV; GLEW_FUN_EXPORT PFNGLVERTEXFORMATNVPROC __glewVertexFormatNV; GLEW_FUN_EXPORT PFNGLAREPROGRAMSRESIDENTNVPROC __glewAreProgramsResidentNV; GLEW_FUN_EXPORT PFNGLBINDPROGRAMNVPROC __glewBindProgramNV; GLEW_FUN_EXPORT PFNGLDELETEPROGRAMSNVPROC __glewDeleteProgramsNV; GLEW_FUN_EXPORT PFNGLEXECUTEPROGRAMNVPROC __glewExecuteProgramNV; GLEW_FUN_EXPORT PFNGLGENPROGRAMSNVPROC __glewGenProgramsNV; GLEW_FUN_EXPORT PFNGLGETPROGRAMPARAMETERDVNVPROC __glewGetProgramParameterdvNV; GLEW_FUN_EXPORT PFNGLGETPROGRAMPARAMETERFVNVPROC __glewGetProgramParameterfvNV; GLEW_FUN_EXPORT PFNGLGETPROGRAMSTRINGNVPROC __glewGetProgramStringNV; GLEW_FUN_EXPORT PFNGLGETPROGRAMIVNVPROC __glewGetProgramivNV; GLEW_FUN_EXPORT PFNGLGETTRACKMATRIXIVNVPROC __glewGetTrackMatrixivNV; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBPOINTERVNVPROC __glewGetVertexAttribPointervNV; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBDVNVPROC __glewGetVertexAttribdvNV; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBFVNVPROC __glewGetVertexAttribfvNV; GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIVNVPROC __glewGetVertexAttribivNV; GLEW_FUN_EXPORT PFNGLISPROGRAMNVPROC __glewIsProgramNV; GLEW_FUN_EXPORT PFNGLLOADPROGRAMNVPROC __glewLoadProgramNV; GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4DNVPROC __glewProgramParameter4dNV; GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4DVNVPROC __glewProgramParameter4dvNV; GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4FNVPROC __glewProgramParameter4fNV; GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4FVNVPROC __glewProgramParameter4fvNV; GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERS4DVNVPROC __glewProgramParameters4dvNV; GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERS4FVNVPROC __glewProgramParameters4fvNV; GLEW_FUN_EXPORT PFNGLREQUESTRESIDENTPROGRAMSNVPROC __glewRequestResidentProgramsNV; GLEW_FUN_EXPORT PFNGLTRACKMATRIXNVPROC __glewTrackMatrixNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DNVPROC __glewVertexAttrib1dNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DVNVPROC __glewVertexAttrib1dvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FNVPROC __glewVertexAttrib1fNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FVNVPROC __glewVertexAttrib1fvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SNVPROC __glewVertexAttrib1sNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SVNVPROC __glewVertexAttrib1svNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DNVPROC __glewVertexAttrib2dNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DVNVPROC __glewVertexAttrib2dvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FNVPROC __glewVertexAttrib2fNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FVNVPROC __glewVertexAttrib2fvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SNVPROC __glewVertexAttrib2sNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SVNVPROC __glewVertexAttrib2svNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DNVPROC __glewVertexAttrib3dNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DVNVPROC __glewVertexAttrib3dvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FNVPROC __glewVertexAttrib3fNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FVNVPROC __glewVertexAttrib3fvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SNVPROC __glewVertexAttrib3sNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SVNVPROC __glewVertexAttrib3svNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DNVPROC __glewVertexAttrib4dNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DVNVPROC __glewVertexAttrib4dvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FNVPROC __glewVertexAttrib4fNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FVNVPROC __glewVertexAttrib4fvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SNVPROC __glewVertexAttrib4sNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SVNVPROC __glewVertexAttrib4svNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBNVPROC __glewVertexAttrib4ubNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBVNVPROC __glewVertexAttrib4ubvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBPOINTERNVPROC __glewVertexAttribPointerNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1DVNVPROC __glewVertexAttribs1dvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1FVNVPROC __glewVertexAttribs1fvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1SVNVPROC __glewVertexAttribs1svNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2DVNVPROC __glewVertexAttribs2dvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2FVNVPROC __glewVertexAttribs2fvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2SVNVPROC __glewVertexAttribs2svNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3DVNVPROC __glewVertexAttribs3dvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3FVNVPROC __glewVertexAttribs3fvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3SVNVPROC __glewVertexAttribs3svNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4DVNVPROC __glewVertexAttribs4dvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4FVNVPROC __glewVertexAttribs4fvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4SVNVPROC __glewVertexAttribs4svNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4UBVNVPROC __glewVertexAttribs4ubvNV; GLEW_FUN_EXPORT PFNGLBEGINVIDEOCAPTURENVPROC __glewBeginVideoCaptureNV; GLEW_FUN_EXPORT PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC __glewBindVideoCaptureStreamBufferNV; GLEW_FUN_EXPORT PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC __glewBindVideoCaptureStreamTextureNV; GLEW_FUN_EXPORT PFNGLENDVIDEOCAPTURENVPROC __glewEndVideoCaptureNV; GLEW_FUN_EXPORT PFNGLGETVIDEOCAPTURESTREAMDVNVPROC __glewGetVideoCaptureStreamdvNV; GLEW_FUN_EXPORT PFNGLGETVIDEOCAPTURESTREAMFVNVPROC __glewGetVideoCaptureStreamfvNV; GLEW_FUN_EXPORT PFNGLGETVIDEOCAPTURESTREAMIVNVPROC __glewGetVideoCaptureStreamivNV; GLEW_FUN_EXPORT PFNGLGETVIDEOCAPTUREIVNVPROC __glewGetVideoCaptureivNV; GLEW_FUN_EXPORT PFNGLVIDEOCAPTURENVPROC __glewVideoCaptureNV; GLEW_FUN_EXPORT PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC __glewVideoCaptureStreamParameterdvNV; GLEW_FUN_EXPORT PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC __glewVideoCaptureStreamParameterfvNV; GLEW_FUN_EXPORT PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC __glewVideoCaptureStreamParameterivNV; GLEW_FUN_EXPORT PFNGLCLEARDEPTHFOESPROC __glewClearDepthfOES; GLEW_FUN_EXPORT PFNGLCLIPPLANEFOESPROC __glewClipPlanefOES; GLEW_FUN_EXPORT PFNGLDEPTHRANGEFOESPROC __glewDepthRangefOES; GLEW_FUN_EXPORT PFNGLFRUSTUMFOESPROC __glewFrustumfOES; GLEW_FUN_EXPORT PFNGLGETCLIPPLANEFOESPROC __glewGetClipPlanefOES; GLEW_FUN_EXPORT PFNGLORTHOFOESPROC __glewOrthofOES; GLEW_FUN_EXPORT PFNGLERRORSTRINGREGALPROC __glewErrorStringREGAL; GLEW_FUN_EXPORT PFNGLGETEXTENSIONREGALPROC __glewGetExtensionREGAL; GLEW_FUN_EXPORT PFNGLISSUPPORTEDREGALPROC __glewIsSupportedREGAL; GLEW_FUN_EXPORT PFNGLDETAILTEXFUNCSGISPROC __glewDetailTexFuncSGIS; GLEW_FUN_EXPORT PFNGLGETDETAILTEXFUNCSGISPROC __glewGetDetailTexFuncSGIS; GLEW_FUN_EXPORT PFNGLFOGFUNCSGISPROC __glewFogFuncSGIS; GLEW_FUN_EXPORT PFNGLGETFOGFUNCSGISPROC __glewGetFogFuncSGIS; GLEW_FUN_EXPORT PFNGLSAMPLEMASKSGISPROC __glewSampleMaskSGIS; GLEW_FUN_EXPORT PFNGLSAMPLEPATTERNSGISPROC __glewSamplePatternSGIS; GLEW_FUN_EXPORT PFNGLGETSHARPENTEXFUNCSGISPROC __glewGetSharpenTexFuncSGIS; GLEW_FUN_EXPORT PFNGLSHARPENTEXFUNCSGISPROC __glewSharpenTexFuncSGIS; GLEW_FUN_EXPORT PFNGLTEXIMAGE4DSGISPROC __glewTexImage4DSGIS; GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE4DSGISPROC __glewTexSubImage4DSGIS; GLEW_FUN_EXPORT PFNGLGETTEXFILTERFUNCSGISPROC __glewGetTexFilterFuncSGIS; GLEW_FUN_EXPORT PFNGLTEXFILTERFUNCSGISPROC __glewTexFilterFuncSGIS; GLEW_FUN_EXPORT PFNGLASYNCMARKERSGIXPROC __glewAsyncMarkerSGIX; GLEW_FUN_EXPORT PFNGLDELETEASYNCMARKERSSGIXPROC __glewDeleteAsyncMarkersSGIX; GLEW_FUN_EXPORT PFNGLFINISHASYNCSGIXPROC __glewFinishAsyncSGIX; GLEW_FUN_EXPORT PFNGLGENASYNCMARKERSSGIXPROC __glewGenAsyncMarkersSGIX; GLEW_FUN_EXPORT PFNGLISASYNCMARKERSGIXPROC __glewIsAsyncMarkerSGIX; GLEW_FUN_EXPORT PFNGLPOLLASYNCSGIXPROC __glewPollAsyncSGIX; GLEW_FUN_EXPORT PFNGLFLUSHRASTERSGIXPROC __glewFlushRasterSGIX; GLEW_FUN_EXPORT PFNGLTEXTUREFOGSGIXPROC __glewTextureFogSGIX; GLEW_FUN_EXPORT PFNGLFRAGMENTCOLORMATERIALSGIXPROC __glewFragmentColorMaterialSGIX; GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFSGIXPROC __glewFragmentLightModelfSGIX; GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFVSGIXPROC __glewFragmentLightModelfvSGIX; GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELISGIXPROC __glewFragmentLightModeliSGIX; GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELIVSGIXPROC __glewFragmentLightModelivSGIX; GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFSGIXPROC __glewFragmentLightfSGIX; GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFVSGIXPROC __glewFragmentLightfvSGIX; GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTISGIXPROC __glewFragmentLightiSGIX; GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTIVSGIXPROC __glewFragmentLightivSGIX; GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFSGIXPROC __glewFragmentMaterialfSGIX; GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFVSGIXPROC __glewFragmentMaterialfvSGIX; GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALISGIXPROC __glewFragmentMaterialiSGIX; GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALIVSGIXPROC __glewFragmentMaterialivSGIX; GLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTFVSGIXPROC __glewGetFragmentLightfvSGIX; GLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTIVSGIXPROC __glewGetFragmentLightivSGIX; GLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALFVSGIXPROC __glewGetFragmentMaterialfvSGIX; GLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALIVSGIXPROC __glewGetFragmentMaterialivSGIX; GLEW_FUN_EXPORT PFNGLFRAMEZOOMSGIXPROC __glewFrameZoomSGIX; GLEW_FUN_EXPORT PFNGLPIXELTEXGENSGIXPROC __glewPixelTexGenSGIX; GLEW_FUN_EXPORT PFNGLREFERENCEPLANESGIXPROC __glewReferencePlaneSGIX; GLEW_FUN_EXPORT PFNGLSPRITEPARAMETERFSGIXPROC __glewSpriteParameterfSGIX; GLEW_FUN_EXPORT PFNGLSPRITEPARAMETERFVSGIXPROC __glewSpriteParameterfvSGIX; GLEW_FUN_EXPORT PFNGLSPRITEPARAMETERISGIXPROC __glewSpriteParameteriSGIX; GLEW_FUN_EXPORT PFNGLSPRITEPARAMETERIVSGIXPROC __glewSpriteParameterivSGIX; GLEW_FUN_EXPORT PFNGLTAGSAMPLEBUFFERSGIXPROC __glewTagSampleBufferSGIX; GLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERFVSGIPROC __glewColorTableParameterfvSGI; GLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERIVSGIPROC __glewColorTableParameterivSGI; GLEW_FUN_EXPORT PFNGLCOLORTABLESGIPROC __glewColorTableSGI; GLEW_FUN_EXPORT PFNGLCOPYCOLORTABLESGIPROC __glewCopyColorTableSGI; GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERFVSGIPROC __glewGetColorTableParameterfvSGI; GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERIVSGIPROC __glewGetColorTableParameterivSGI; GLEW_FUN_EXPORT PFNGLGETCOLORTABLESGIPROC __glewGetColorTableSGI; GLEW_FUN_EXPORT PFNGLFINISHTEXTURESUNXPROC __glewFinishTextureSUNX; GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORBSUNPROC __glewGlobalAlphaFactorbSUN; GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORDSUNPROC __glewGlobalAlphaFactordSUN; GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORFSUNPROC __glewGlobalAlphaFactorfSUN; GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORISUNPROC __glewGlobalAlphaFactoriSUN; GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORSSUNPROC __glewGlobalAlphaFactorsSUN; GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORUBSUNPROC __glewGlobalAlphaFactorubSUN; GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORUISUNPROC __glewGlobalAlphaFactoruiSUN; GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORUSSUNPROC __glewGlobalAlphaFactorusSUN; GLEW_FUN_EXPORT PFNGLREADVIDEOPIXELSSUNPROC __glewReadVideoPixelsSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEPOINTERSUNPROC __glewReplacementCodePointerSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUBSUNPROC __glewReplacementCodeubSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUBVSUNPROC __glewReplacementCodeubvSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUISUNPROC __glewReplacementCodeuiSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUIVSUNPROC __glewReplacementCodeuivSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUSSUNPROC __glewReplacementCodeusSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUSVSUNPROC __glewReplacementCodeusvSUN; GLEW_FUN_EXPORT PFNGLCOLOR3FVERTEX3FSUNPROC __glewColor3fVertex3fSUN; GLEW_FUN_EXPORT PFNGLCOLOR3FVERTEX3FVSUNPROC __glewColor3fVertex3fvSUN; GLEW_FUN_EXPORT PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewColor4fNormal3fVertex3fSUN; GLEW_FUN_EXPORT PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewColor4fNormal3fVertex3fvSUN; GLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX2FSUNPROC __glewColor4ubVertex2fSUN; GLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX2FVSUNPROC __glewColor4ubVertex2fvSUN; GLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX3FSUNPROC __glewColor4ubVertex3fSUN; GLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX3FVSUNPROC __glewColor4ubVertex3fvSUN; GLEW_FUN_EXPORT PFNGLNORMAL3FVERTEX3FSUNPROC __glewNormal3fVertex3fSUN; GLEW_FUN_EXPORT PFNGLNORMAL3FVERTEX3FVSUNPROC __glewNormal3fVertex3fvSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC __glewReplacementCodeuiColor3fVertex3fSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC __glewReplacementCodeuiColor3fVertex3fvSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiColor4fNormal3fVertex3fSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiColor4fNormal3fVertex3fvSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC __glewReplacementCodeuiColor4ubVertex3fSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC __glewReplacementCodeuiColor4ubVertex3fvSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiNormal3fVertex3fSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiNormal3fVertex3fvSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fNormal3fVertex3fSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fVertex3fSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fVertex3fvSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC __glewReplacementCodeuiVertex3fSUN; GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC __glewReplacementCodeuiVertex3fvSUN; GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC __glewTexCoord2fColor3fVertex3fSUN; GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC __glewTexCoord2fColor3fVertex3fvSUN; GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewTexCoord2fColor4fNormal3fVertex3fSUN; GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewTexCoord2fColor4fNormal3fVertex3fvSUN; GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC __glewTexCoord2fColor4ubVertex3fSUN; GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC __glewTexCoord2fColor4ubVertex3fvSUN; GLEW_FUN_EXPORT PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC __glewTexCoord2fNormal3fVertex3fSUN; GLEW_FUN_EXPORT PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC __glewTexCoord2fNormal3fVertex3fvSUN; GLEW_FUN_EXPORT PFNGLTEXCOORD2FVERTEX3FSUNPROC __glewTexCoord2fVertex3fSUN; GLEW_FUN_EXPORT PFNGLTEXCOORD2FVERTEX3FVSUNPROC __glewTexCoord2fVertex3fvSUN; GLEW_FUN_EXPORT PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC __glewTexCoord4fColor4fNormal3fVertex4fSUN; GLEW_FUN_EXPORT PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC __glewTexCoord4fColor4fNormal3fVertex4fvSUN; GLEW_FUN_EXPORT PFNGLTEXCOORD4FVERTEX4FSUNPROC __glewTexCoord4fVertex4fSUN; GLEW_FUN_EXPORT PFNGLTEXCOORD4FVERTEX4FVSUNPROC __glewTexCoord4fVertex4fvSUN; GLEW_FUN_EXPORT PFNGLADDSWAPHINTRECTWINPROC __glewAddSwapHintRectWIN; #if defined(GLEW_MX) && !defined(_WIN32) struct GLEWContextStruct { #endif /* GLEW_MX */ GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_1; GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2; GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2_1; GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_3; GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_4; GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_5; GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_2_0; GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_2_1; GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_0; GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_1; GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_2; GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_3; GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_0; GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_1; GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_2; GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_3; GLEW_VAR_EXPORT GLboolean __GLEW_3DFX_multisample; GLEW_VAR_EXPORT GLboolean __GLEW_3DFX_tbuffer; GLEW_VAR_EXPORT GLboolean __GLEW_3DFX_texture_compression_FXT1; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_blend_minmax_factor; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_conservative_depth; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_debug_output; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_depth_clamp_separate; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_draw_buffers_blend; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_multi_draw_indirect; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_name_gen_delete; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_performance_monitor; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_pinned_memory; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_query_buffer_object; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_sample_positions; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_seamless_cubemap_per_texture; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_shader_stencil_export; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_stencil_operation_extended; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_texture_texture4; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_transform_feedback3_lines_triangles; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_vertex_shader_layer; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_vertex_shader_tessellator; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_vertex_shader_viewport_index; GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_aux_depth_stencil; GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_client_storage; GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_element_array; GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_fence; GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_float_pixels; GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_flush_buffer_range; GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_object_purgeable; GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_pixel_buffer; GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_rgb_422; GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_row_bytes; GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_specular_vector; GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_texture_range; GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_transform_hint; GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_vertex_array_object; GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_vertex_array_range; GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_vertex_program_evaluators; GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_ycbcr_422; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_ES2_compatibility; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_ES3_compatibility; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_arrays_of_arrays; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_base_instance; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_blend_func_extended; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_cl_event; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_clear_buffer_object; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_color_buffer_float; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_compatibility; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_compressed_texture_pixel_storage; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_compute_shader; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_conservative_depth; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_copy_buffer; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_copy_image; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_debug_output; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_depth_buffer_float; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_depth_clamp; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_depth_texture; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_buffers; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_buffers_blend; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_elements_base_vertex; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_indirect; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_instanced; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_explicit_attrib_location; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_explicit_uniform_location; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_coord_conventions; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_layer_viewport; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_program; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_program_shadow; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_shader; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_framebuffer_no_attachments; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_framebuffer_object; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_framebuffer_sRGB; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_geometry_shader4; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_get_program_binary; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_gpu_shader5; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_gpu_shader_fp64; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_half_float_pixel; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_half_float_vertex; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_imaging; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_instanced_arrays; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_internalformat_query; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_internalformat_query2; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_invalidate_subdata; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_map_buffer_alignment; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_map_buffer_range; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_matrix_palette; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_multi_draw_indirect; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_multisample; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_multitexture; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_occlusion_query; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_occlusion_query2; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_pixel_buffer_object; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_point_parameters; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_point_sprite; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_program_interface_query; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_provoking_vertex; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_robust_buffer_access_behavior; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_robustness; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_robustness_application_isolation; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_robustness_share_group_isolation; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_sample_shading; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_sampler_objects; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_seamless_cube_map; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_separate_shader_objects; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_atomic_counters; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_bit_encoding; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_image_load_store; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_image_size; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_objects; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_precision; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_stencil_export; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_storage_buffer_object; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_subroutine; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_texture_lod; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_100; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_420pack; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_include; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_packing; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shadow; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shadow_ambient; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_stencil_texturing; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_sync; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_tessellation_shader; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_border_clamp; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_buffer_object; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_buffer_object_rgb32; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_buffer_range; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_compression; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_compression_bptc; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_compression_rgtc; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_cube_map; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_cube_map_array; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_add; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_combine; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_crossbar; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_dot3; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_float; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_gather; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_mirrored_repeat; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_multisample; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_non_power_of_two; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_query_levels; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_query_lod; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_rectangle; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_rg; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_rgb10_a2ui; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_storage; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_storage_multisample; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_swizzle; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_view; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_timer_query; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_transform_feedback2; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_transform_feedback3; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_transform_feedback_instanced; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_transpose_matrix; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_uniform_buffer_object; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_array_bgra; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_array_object; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_attrib_64bit; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_attrib_binding; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_blend; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_buffer_object; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_program; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_shader; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_type_2_10_10_10_rev; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_viewport_array; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_window_pos; GLEW_VAR_EXPORT GLboolean __GLEW_ATIX_point_sprites; GLEW_VAR_EXPORT GLboolean __GLEW_ATIX_texture_env_combine3; GLEW_VAR_EXPORT GLboolean __GLEW_ATIX_texture_env_route; GLEW_VAR_EXPORT GLboolean __GLEW_ATIX_vertex_shader_output_point_size; GLEW_VAR_EXPORT GLboolean __GLEW_ATI_draw_buffers; GLEW_VAR_EXPORT GLboolean __GLEW_ATI_element_array; GLEW_VAR_EXPORT GLboolean __GLEW_ATI_envmap_bumpmap; GLEW_VAR_EXPORT GLboolean __GLEW_ATI_fragment_shader; GLEW_VAR_EXPORT GLboolean __GLEW_ATI_map_object_buffer; GLEW_VAR_EXPORT GLboolean __GLEW_ATI_meminfo; GLEW_VAR_EXPORT GLboolean __GLEW_ATI_pn_triangles; GLEW_VAR_EXPORT GLboolean __GLEW_ATI_separate_stencil; GLEW_VAR_EXPORT GLboolean __GLEW_ATI_shader_texture_lod; GLEW_VAR_EXPORT GLboolean __GLEW_ATI_text_fragment_shader; GLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_compression_3dc; GLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_env_combine3; GLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_float; GLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_mirror_once; GLEW_VAR_EXPORT GLboolean __GLEW_ATI_vertex_array_object; GLEW_VAR_EXPORT GLboolean __GLEW_ATI_vertex_attrib_array_object; GLEW_VAR_EXPORT GLboolean __GLEW_ATI_vertex_streams; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_422_pixels; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_Cg_shader; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_abgr; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_bgra; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_bindable_uniform; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_color; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_equation_separate; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_func_separate; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_logic_op; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_minmax; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_subtract; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_clip_volume_hint; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_cmyka; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_color_subtable; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_compiled_vertex_array; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_convolution; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_coordinate_frame; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_copy_texture; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_cull_vertex; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_debug_marker; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_depth_bounds_test; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_direct_state_access; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_buffers2; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_instanced; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_range_elements; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_fog_coord; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_fragment_lighting; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_blit; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_multisample; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_multisample_blit_scaled; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_object; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_sRGB; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_geometry_shader4; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_gpu_program_parameters; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_gpu_shader4; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_histogram; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_array_formats; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_func; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_material; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_texture; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_light_texture; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_misc_attribute; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_multi_draw_arrays; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_multisample; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_packed_depth_stencil; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_packed_float; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_packed_pixels; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_paletted_texture; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_pixel_buffer_object; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_pixel_transform; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_pixel_transform_color_table; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_point_parameters; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_polygon_offset; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_provoking_vertex; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_rescale_normal; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_scene_marker; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_secondary_color; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_separate_shader_objects; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_separate_specular_color; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shader_image_load_store; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shadow_funcs; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shared_texture_palette; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_stencil_clear_tag; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_stencil_two_side; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_stencil_wrap; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_subtexture; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture3D; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_array; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_buffer_object; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_dxt1; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_latc; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_rgtc; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_s3tc; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_cube_map; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_edge_clamp; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env_add; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env_combine; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env_dot3; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_filter_anisotropic; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_integer; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_lod_bias; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_mirror_clamp; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_object; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_perturb_normal; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_rectangle; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_sRGB; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_sRGB_decode; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_shared_exponent; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_snorm; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_swizzle; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_timer_query; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_transform_feedback; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_array; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_array_bgra; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_attrib_64bit; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_shader; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_weighting; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_x11_sync_object; GLEW_VAR_EXPORT GLboolean __GLEW_GREMEDY_frame_terminator; GLEW_VAR_EXPORT GLboolean __GLEW_GREMEDY_string_marker; GLEW_VAR_EXPORT GLboolean __GLEW_HP_convolution_border_modes; GLEW_VAR_EXPORT GLboolean __GLEW_HP_image_transform; GLEW_VAR_EXPORT GLboolean __GLEW_HP_occlusion_test; GLEW_VAR_EXPORT GLboolean __GLEW_HP_texture_lighting; GLEW_VAR_EXPORT GLboolean __GLEW_IBM_cull_vertex; GLEW_VAR_EXPORT GLboolean __GLEW_IBM_multimode_draw_arrays; GLEW_VAR_EXPORT GLboolean __GLEW_IBM_rasterpos_clip; GLEW_VAR_EXPORT GLboolean __GLEW_IBM_static_data; GLEW_VAR_EXPORT GLboolean __GLEW_IBM_texture_mirrored_repeat; GLEW_VAR_EXPORT GLboolean __GLEW_IBM_vertex_array_lists; GLEW_VAR_EXPORT GLboolean __GLEW_INGR_color_clamp; GLEW_VAR_EXPORT GLboolean __GLEW_INGR_interlace_read; GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_parallel_arrays; GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_texture_scissor; GLEW_VAR_EXPORT GLboolean __GLEW_KHR_debug; GLEW_VAR_EXPORT GLboolean __GLEW_KHR_texture_compression_astc_ldr; GLEW_VAR_EXPORT GLboolean __GLEW_KTX_buffer_region; GLEW_VAR_EXPORT GLboolean __GLEW_MESAX_texture_stack; GLEW_VAR_EXPORT GLboolean __GLEW_MESA_pack_invert; GLEW_VAR_EXPORT GLboolean __GLEW_MESA_resize_buffers; GLEW_VAR_EXPORT GLboolean __GLEW_MESA_window_pos; GLEW_VAR_EXPORT GLboolean __GLEW_MESA_ycbcr_texture; GLEW_VAR_EXPORT GLboolean __GLEW_NVX_gpu_memory_info; GLEW_VAR_EXPORT GLboolean __GLEW_NV_bindless_texture; GLEW_VAR_EXPORT GLboolean __GLEW_NV_blend_square; GLEW_VAR_EXPORT GLboolean __GLEW_NV_conditional_render; GLEW_VAR_EXPORT GLboolean __GLEW_NV_copy_depth_to_color; GLEW_VAR_EXPORT GLboolean __GLEW_NV_copy_image; GLEW_VAR_EXPORT GLboolean __GLEW_NV_depth_buffer_float; GLEW_VAR_EXPORT GLboolean __GLEW_NV_depth_clamp; GLEW_VAR_EXPORT GLboolean __GLEW_NV_depth_range_unclamped; GLEW_VAR_EXPORT GLboolean __GLEW_NV_evaluators; GLEW_VAR_EXPORT GLboolean __GLEW_NV_explicit_multisample; GLEW_VAR_EXPORT GLboolean __GLEW_NV_fence; GLEW_VAR_EXPORT GLboolean __GLEW_NV_float_buffer; GLEW_VAR_EXPORT GLboolean __GLEW_NV_fog_distance; GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program; GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program2; GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program4; GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program_option; GLEW_VAR_EXPORT GLboolean __GLEW_NV_framebuffer_multisample_coverage; GLEW_VAR_EXPORT GLboolean __GLEW_NV_geometry_program4; GLEW_VAR_EXPORT GLboolean __GLEW_NV_geometry_shader4; GLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_program4; GLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_program5; GLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_program_fp64; GLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_shader5; GLEW_VAR_EXPORT GLboolean __GLEW_NV_half_float; GLEW_VAR_EXPORT GLboolean __GLEW_NV_light_max_exponent; GLEW_VAR_EXPORT GLboolean __GLEW_NV_multisample_coverage; GLEW_VAR_EXPORT GLboolean __GLEW_NV_multisample_filter_hint; GLEW_VAR_EXPORT GLboolean __GLEW_NV_occlusion_query; GLEW_VAR_EXPORT GLboolean __GLEW_NV_packed_depth_stencil; GLEW_VAR_EXPORT GLboolean __GLEW_NV_parameter_buffer_object; GLEW_VAR_EXPORT GLboolean __GLEW_NV_parameter_buffer_object2; GLEW_VAR_EXPORT GLboolean __GLEW_NV_path_rendering; GLEW_VAR_EXPORT GLboolean __GLEW_NV_pixel_data_range; GLEW_VAR_EXPORT GLboolean __GLEW_NV_point_sprite; GLEW_VAR_EXPORT GLboolean __GLEW_NV_present_video; GLEW_VAR_EXPORT GLboolean __GLEW_NV_primitive_restart; GLEW_VAR_EXPORT GLboolean __GLEW_NV_register_combiners; GLEW_VAR_EXPORT GLboolean __GLEW_NV_register_combiners2; GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_atomic_float; GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_buffer_load; GLEW_VAR_EXPORT GLboolean __GLEW_NV_tessellation_program5; GLEW_VAR_EXPORT GLboolean __GLEW_NV_texgen_emboss; GLEW_VAR_EXPORT GLboolean __GLEW_NV_texgen_reflection; GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_barrier; GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_compression_vtc; GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_env_combine4; GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_expand_normal; GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_multisample; GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_rectangle; GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_shader; GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_shader2; GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_shader3; GLEW_VAR_EXPORT GLboolean __GLEW_NV_transform_feedback; GLEW_VAR_EXPORT GLboolean __GLEW_NV_transform_feedback2; GLEW_VAR_EXPORT GLboolean __GLEW_NV_vdpau_interop; GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_array_range; GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_array_range2; GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_attrib_integer_64bit; GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_buffer_unified_memory; GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program; GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program1_1; GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program2; GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program2_option; GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program3; GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program4; GLEW_VAR_EXPORT GLboolean __GLEW_NV_video_capture; GLEW_VAR_EXPORT GLboolean __GLEW_OES_byte_coordinates; GLEW_VAR_EXPORT GLboolean __GLEW_OES_compressed_paletted_texture; GLEW_VAR_EXPORT GLboolean __GLEW_OES_read_format; GLEW_VAR_EXPORT GLboolean __GLEW_OES_single_precision; GLEW_VAR_EXPORT GLboolean __GLEW_OML_interlace; GLEW_VAR_EXPORT GLboolean __GLEW_OML_resample; GLEW_VAR_EXPORT GLboolean __GLEW_OML_subsample; GLEW_VAR_EXPORT GLboolean __GLEW_PGI_misc_hints; GLEW_VAR_EXPORT GLboolean __GLEW_PGI_vertex_hints; GLEW_VAR_EXPORT GLboolean __GLEW_REGAL_error_string; GLEW_VAR_EXPORT GLboolean __GLEW_REGAL_extension_query; GLEW_VAR_EXPORT GLboolean __GLEW_REGAL_log; GLEW_VAR_EXPORT GLboolean __GLEW_REND_screen_coordinates; GLEW_VAR_EXPORT GLboolean __GLEW_S3_s3tc; GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_color_range; GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_detail_texture; GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_fog_function; GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_generate_mipmap; GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_multisample; GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_pixel_texture; GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_point_line_texgen; GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_sharpen_texture; GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture4D; GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_border_clamp; GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_edge_clamp; GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_filter4; GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_lod; GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_select; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_async; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_async_histogram; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_async_pixel; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_blend_alpha_minmax; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_clipmap; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_convolution_accuracy; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_depth_texture; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_flush_raster; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_fog_offset; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_fog_texture; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_fragment_specular_lighting; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_framezoom; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_interlace; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_ir_instrument1; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_list_priority; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_pixel_texture; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_pixel_texture_bits; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_reference_plane; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_resample; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_shadow; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_shadow_ambient; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_sprite; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_tag_sample_buffer; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_add_env; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_coordinate_clamp; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_lod_bias; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_multi_buffer; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_range; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_scale_bias; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_vertex_preclip; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_vertex_preclip_hint; GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_ycrcb; GLEW_VAR_EXPORT GLboolean __GLEW_SGI_color_matrix; GLEW_VAR_EXPORT GLboolean __GLEW_SGI_color_table; GLEW_VAR_EXPORT GLboolean __GLEW_SGI_texture_color_table; GLEW_VAR_EXPORT GLboolean __GLEW_SUNX_constant_data; GLEW_VAR_EXPORT GLboolean __GLEW_SUN_convolution_border_modes; GLEW_VAR_EXPORT GLboolean __GLEW_SUN_global_alpha; GLEW_VAR_EXPORT GLboolean __GLEW_SUN_mesh_array; GLEW_VAR_EXPORT GLboolean __GLEW_SUN_read_video_pixels; GLEW_VAR_EXPORT GLboolean __GLEW_SUN_slice_accum; GLEW_VAR_EXPORT GLboolean __GLEW_SUN_triangle_list; GLEW_VAR_EXPORT GLboolean __GLEW_SUN_vertex; GLEW_VAR_EXPORT GLboolean __GLEW_WIN_phong_shading; GLEW_VAR_EXPORT GLboolean __GLEW_WIN_specular_fog; GLEW_VAR_EXPORT GLboolean __GLEW_WIN_swap_hint; #ifdef GLEW_MX }; /* GLEWContextStruct */ #endif /* GLEW_MX */ /* ------------------------------------------------------------------------- */ /* error codes */ #define GLEW_OK 0 #define GLEW_NO_ERROR 0 #define GLEW_ERROR_NO_GL_VERSION 1 /* missing GL version */ #define GLEW_ERROR_GL_VERSION_10_ONLY 2 /* Need at least OpenGL 1.1 */ #define GLEW_ERROR_GLX_VERSION_11_ONLY 3 /* Need at least GLX 1.2 */ /* string codes */ #define GLEW_VERSION 1 #define GLEW_VERSION_MAJOR 2 #define GLEW_VERSION_MINOR 3 #define GLEW_VERSION_MICRO 4 /* API */ #ifdef GLEW_MX typedef struct GLEWContextStruct GLEWContext; GLEWAPI GLenum GLEWAPIENTRY glewContextInit (GLEWContext *ctx); GLEWAPI GLboolean GLEWAPIENTRY glewContextIsSupported (const GLEWContext *ctx, const char *name); #define glewInit() glewContextInit(glewGetContext()) #define glewIsSupported(x) glewContextIsSupported(glewGetContext(), x) #define glewIsExtensionSupported(x) glewIsSupported(x) #define GLEW_GET_VAR(x) (*(const GLboolean*)&(glewGetContext()->x)) #ifdef _WIN32 # define GLEW_GET_FUN(x) glewGetContext()->x #else # define GLEW_GET_FUN(x) x #endif #else /* GLEW_MX */ GLEWAPI GLenum GLEWAPIENTRY glewInit (void); GLEWAPI GLboolean GLEWAPIENTRY glewIsSupported (const char *name); #define glewIsExtensionSupported(x) glewIsSupported(x) #define GLEW_GET_VAR(x) (*(const GLboolean*)&x) #define GLEW_GET_FUN(x) x #endif /* GLEW_MX */ GLEWAPI GLboolean glewExperimental; GLEWAPI GLboolean GLEWAPIENTRY glewGetExtension (const char *name); GLEWAPI const GLubyte * GLEWAPIENTRY glewGetErrorString (GLenum error); GLEWAPI const GLubyte * GLEWAPIENTRY glewGetString (GLenum name); #ifdef __cplusplus } #endif #ifdef GLEW_APIENTRY_DEFINED #undef GLEW_APIENTRY_DEFINED #undef APIENTRY #undef GLAPIENTRY #define GLAPIENTRY #endif #ifdef GLEW_CALLBACK_DEFINED #undef GLEW_CALLBACK_DEFINED #undef CALLBACK #endif #ifdef GLEW_WINGDIAPI_DEFINED #undef GLEW_WINGDIAPI_DEFINED #undef WINGDIAPI #endif #undef GLAPI /* #undef GLEWAPI */ #endif /* __glew_h__ */ ImageVis3D-3.1.0/Tuvok/3rdParty/GLEW/GL/glew.c0000644000175000017500000320376612320456500020260 0ustar mathieumathieu/* ** The OpenGL Extension Wrangler Library ** Copyright (C) 2002-2008, Milan Ikits ** Copyright (C) 2002-2008, Marcelo E. Magallon ** Copyright (C) 2002, Lev Povalahev ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: ** ** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright notice, ** this list of conditions and the following disclaimer in the documentation ** and/or other materials provided with the distribution. ** * The name of the author may be used to endorse or promote products ** derived from this software without specific prior written permission. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF ** THE POSSIBILITY OF SUCH DAMAGE. */ #include #if defined(_WIN32) # include #elif !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) # include #endif /* * Define glewGetContext and related helper macros. */ #ifdef GLEW_MX # define glewGetContext() ctx # ifdef _WIN32 # define GLEW_CONTEXT_ARG_DEF_INIT GLEWContext* ctx # define GLEW_CONTEXT_ARG_VAR_INIT ctx # define wglewGetContext() ctx # define WGLEW_CONTEXT_ARG_DEF_INIT WGLEWContext* ctx # define WGLEW_CONTEXT_ARG_DEF_LIST WGLEWContext* ctx # else /* _WIN32 */ # define GLEW_CONTEXT_ARG_DEF_INIT void # define GLEW_CONTEXT_ARG_VAR_INIT # define glxewGetContext() ctx # define GLXEW_CONTEXT_ARG_DEF_INIT void # define GLXEW_CONTEXT_ARG_DEF_LIST GLXEWContext* ctx # endif /* _WIN32 */ # define GLEW_CONTEXT_ARG_DEF_LIST GLEWContext* ctx #else /* GLEW_MX */ # define GLEW_CONTEXT_ARG_DEF_INIT void # define GLEW_CONTEXT_ARG_VAR_INIT # define GLEW_CONTEXT_ARG_DEF_LIST void # define WGLEW_CONTEXT_ARG_DEF_INIT void # define WGLEW_CONTEXT_ARG_DEF_LIST void # define GLXEW_CONTEXT_ARG_DEF_INIT void # define GLXEW_CONTEXT_ARG_DEF_LIST void #endif /* GLEW_MX */ #if defined(__sgi) || defined (__sun) || defined(GLEW_APPLE_GLX) #include #include #include void* dlGetProcAddress (const GLubyte* name) { static void* h = NULL; static void* gpa; if (h == NULL) { if ((h = dlopen(NULL, RTLD_LAZY | RTLD_LOCAL)) == NULL) return NULL; gpa = dlsym(h, "glXGetProcAddress"); } if (gpa != NULL) return ((void*(*)(const GLubyte*))gpa)(name); else return dlsym(h, (const char*)name); } #endif /* __sgi || __sun || GLEW_APPLE_GLX */ #if defined(__APPLE__) #include #include #include #ifdef MAC_OS_X_VERSION_10_3 #include void* NSGLGetProcAddress (const GLubyte *name) { static void* image = NULL; void* addr; if (NULL == image) { #ifdef GLEW_REGAL image = dlopen("libRegal.dylib", RTLD_LAZY); #else image = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY); #endif } if( !image ) return NULL; addr = dlsym(image, (const char*)name); if( addr ) return addr; #ifdef GLEW_APPLE_GLX return dlGetProcAddress( name ); // try next for glx symbols #else return NULL; #endif } #else #include void* NSGLGetProcAddress (const GLubyte *name) { static const struct mach_header* image = NULL; NSSymbol symbol; char* symbolName; if (NULL == image) { #ifdef GLEW_REGAL image = NSAddImage("libRegal.dylib", NSADDIMAGE_OPTION_RETURN_ON_ERROR); #else image = NSAddImage("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", NSADDIMAGE_OPTION_RETURN_ON_ERROR); #endif } /* prepend a '_' for the Unix C symbol mangling convention */ symbolName = malloc(strlen((const char*)name) + 2); strcpy(symbolName+1, (const char*)name); symbolName[0] = '_'; symbol = NULL; /* if (NSIsSymbolNameDefined(symbolName)) symbol = NSLookupAndBindSymbol(symbolName); */ symbol = image ? NSLookupSymbolInImage(image, symbolName, NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR) : NULL; free(symbolName); if( symbol ) return NSAddressOfSymbol(symbol); #ifdef GLEW_APPLE_GLX return dlGetProcAddress( name ); // try next for glx symbols #else return NULL; #endif } #endif /* MAC_OS_X_VERSION_10_3 */ #endif /* __APPLE__ */ /* * Define glewGetProcAddress. */ #if defined(_WIN32) # define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name) #elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX) # define glewGetProcAddress(name) NSGLGetProcAddress(name) #elif defined(__sgi) || defined(__sun) # define glewGetProcAddress(name) dlGetProcAddress(name) #elif defined(__ANDROID__) # define glewGetProcAddress(name) NULL /* TODO */ #else /* __linux */ # define glewGetProcAddress(name) (*glXGetProcAddressARB)(name) #endif /* * Define GLboolean const cast. */ #define CONST_CAST(x) (*(GLboolean*)&x) /* * GLEW, just like OpenGL or GLU, does not rely on the standard C library. * These functions implement the functionality required in this file. */ static GLuint _glewStrLen (const GLubyte* s) { GLuint i=0; if (s == NULL) return 0; while (s[i] != '\0') i++; return i; } static GLuint _glewStrCLen (const GLubyte* s, GLubyte c) { GLuint i=0; if (s == NULL) return 0; while (s[i] != '\0' && s[i] != c) i++; return (s[i] == '\0' || s[i] == c) ? i : 0; } static GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n) { GLuint i=0; if(a == NULL || b == NULL) return (a == NULL && b == NULL && n == 0) ? GL_TRUE : GL_FALSE; while (i < n && a[i] != '\0' && b[i] != '\0' && a[i] == b[i]) i++; return i == n ? GL_TRUE : GL_FALSE; } static GLboolean _glewStrSame1 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb) { while (*na > 0 && (**a == ' ' || **a == '\n' || **a == '\r' || **a == '\t')) { (*a)++; (*na)--; } if(*na >= nb) { GLuint i=0; while (i < nb && (*a)+i != NULL && b+i != NULL && (*a)[i] == b[i]) i++; if(i == nb) { *a = *a + nb; *na = *na - nb; return GL_TRUE; } } return GL_FALSE; } static GLboolean _glewStrSame2 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb) { if(*na >= nb) { GLuint i=0; while (i < nb && (*a)+i != NULL && b+i != NULL && (*a)[i] == b[i]) i++; if(i == nb) { *a = *a + nb; *na = *na - nb; return GL_TRUE; } } return GL_FALSE; } static GLboolean _glewStrSame3 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb) { if(*na >= nb) { GLuint i=0; while (i < nb && (*a)+i != NULL && b+i != NULL && (*a)[i] == b[i]) i++; if (i == nb && (*na == nb || (*a)[i] == ' ' || (*a)[i] == '\n' || (*a)[i] == '\r' || (*a)[i] == '\t')) { *a = *a + nb; *na = *na - nb; return GL_TRUE; } } return GL_FALSE; } /* * Search for name in the extensions string. Use of strstr() * is not sufficient because extension names can be prefixes of * other extension names. Could use strtok() but the constant * string returned by glGetString might be in read-only memory. */ static GLboolean _glewSearchExtension (const char* name, const GLubyte *start, const GLubyte *end) { const GLubyte* p; GLuint len = _glewStrLen((const GLubyte*)name); p = start; while (p < end) { GLuint n = _glewStrCLen(p, ' '); if (len == n && _glewStrSame((const GLubyte*)name, p, n)) return GL_TRUE; p += n+1; } return GL_FALSE; } #if !defined(_WIN32) || !defined(GLEW_MX) PFNGLCOPYTEXSUBIMAGE3DPROC __glewCopyTexSubImage3D = NULL; PFNGLDRAWRANGEELEMENTSPROC __glewDrawRangeElements = NULL; PFNGLTEXIMAGE3DPROC __glewTexImage3D = NULL; PFNGLTEXSUBIMAGE3DPROC __glewTexSubImage3D = NULL; PFNGLACTIVETEXTUREPROC __glewActiveTexture = NULL; PFNGLCLIENTACTIVETEXTUREPROC __glewClientActiveTexture = NULL; PFNGLCOMPRESSEDTEXIMAGE1DPROC __glewCompressedTexImage1D = NULL; PFNGLCOMPRESSEDTEXIMAGE2DPROC __glewCompressedTexImage2D = NULL; PFNGLCOMPRESSEDTEXIMAGE3DPROC __glewCompressedTexImage3D = NULL; PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC __glewCompressedTexSubImage1D = NULL; PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC __glewCompressedTexSubImage2D = NULL; PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC __glewCompressedTexSubImage3D = NULL; PFNGLGETCOMPRESSEDTEXIMAGEPROC __glewGetCompressedTexImage = NULL; PFNGLLOADTRANSPOSEMATRIXDPROC __glewLoadTransposeMatrixd = NULL; PFNGLLOADTRANSPOSEMATRIXFPROC __glewLoadTransposeMatrixf = NULL; PFNGLMULTTRANSPOSEMATRIXDPROC __glewMultTransposeMatrixd = NULL; PFNGLMULTTRANSPOSEMATRIXFPROC __glewMultTransposeMatrixf = NULL; PFNGLMULTITEXCOORD1DPROC __glewMultiTexCoord1d = NULL; PFNGLMULTITEXCOORD1DVPROC __glewMultiTexCoord1dv = NULL; PFNGLMULTITEXCOORD1FPROC __glewMultiTexCoord1f = NULL; PFNGLMULTITEXCOORD1FVPROC __glewMultiTexCoord1fv = NULL; PFNGLMULTITEXCOORD1IPROC __glewMultiTexCoord1i = NULL; PFNGLMULTITEXCOORD1IVPROC __glewMultiTexCoord1iv = NULL; PFNGLMULTITEXCOORD1SPROC __glewMultiTexCoord1s = NULL; PFNGLMULTITEXCOORD1SVPROC __glewMultiTexCoord1sv = NULL; PFNGLMULTITEXCOORD2DPROC __glewMultiTexCoord2d = NULL; PFNGLMULTITEXCOORD2DVPROC __glewMultiTexCoord2dv = NULL; PFNGLMULTITEXCOORD2FPROC __glewMultiTexCoord2f = NULL; PFNGLMULTITEXCOORD2FVPROC __glewMultiTexCoord2fv = NULL; PFNGLMULTITEXCOORD2IPROC __glewMultiTexCoord2i = NULL; PFNGLMULTITEXCOORD2IVPROC __glewMultiTexCoord2iv = NULL; PFNGLMULTITEXCOORD2SPROC __glewMultiTexCoord2s = NULL; PFNGLMULTITEXCOORD2SVPROC __glewMultiTexCoord2sv = NULL; PFNGLMULTITEXCOORD3DPROC __glewMultiTexCoord3d = NULL; PFNGLMULTITEXCOORD3DVPROC __glewMultiTexCoord3dv = NULL; PFNGLMULTITEXCOORD3FPROC __glewMultiTexCoord3f = NULL; PFNGLMULTITEXCOORD3FVPROC __glewMultiTexCoord3fv = NULL; PFNGLMULTITEXCOORD3IPROC __glewMultiTexCoord3i = NULL; PFNGLMULTITEXCOORD3IVPROC __glewMultiTexCoord3iv = NULL; PFNGLMULTITEXCOORD3SPROC __glewMultiTexCoord3s = NULL; PFNGLMULTITEXCOORD3SVPROC __glewMultiTexCoord3sv = NULL; PFNGLMULTITEXCOORD4DPROC __glewMultiTexCoord4d = NULL; PFNGLMULTITEXCOORD4DVPROC __glewMultiTexCoord4dv = NULL; PFNGLMULTITEXCOORD4FPROC __glewMultiTexCoord4f = NULL; PFNGLMULTITEXCOORD4FVPROC __glewMultiTexCoord4fv = NULL; PFNGLMULTITEXCOORD4IPROC __glewMultiTexCoord4i = NULL; PFNGLMULTITEXCOORD4IVPROC __glewMultiTexCoord4iv = NULL; PFNGLMULTITEXCOORD4SPROC __glewMultiTexCoord4s = NULL; PFNGLMULTITEXCOORD4SVPROC __glewMultiTexCoord4sv = NULL; PFNGLSAMPLECOVERAGEPROC __glewSampleCoverage = NULL; PFNGLBLENDCOLORPROC __glewBlendColor = NULL; PFNGLBLENDEQUATIONPROC __glewBlendEquation = NULL; PFNGLBLENDFUNCSEPARATEPROC __glewBlendFuncSeparate = NULL; PFNGLFOGCOORDPOINTERPROC __glewFogCoordPointer = NULL; PFNGLFOGCOORDDPROC __glewFogCoordd = NULL; PFNGLFOGCOORDDVPROC __glewFogCoorddv = NULL; PFNGLFOGCOORDFPROC __glewFogCoordf = NULL; PFNGLFOGCOORDFVPROC __glewFogCoordfv = NULL; PFNGLMULTIDRAWARRAYSPROC __glewMultiDrawArrays = NULL; PFNGLMULTIDRAWELEMENTSPROC __glewMultiDrawElements = NULL; PFNGLPOINTPARAMETERFPROC __glewPointParameterf = NULL; PFNGLPOINTPARAMETERFVPROC __glewPointParameterfv = NULL; PFNGLPOINTPARAMETERIPROC __glewPointParameteri = NULL; PFNGLPOINTPARAMETERIVPROC __glewPointParameteriv = NULL; PFNGLSECONDARYCOLOR3BPROC __glewSecondaryColor3b = NULL; PFNGLSECONDARYCOLOR3BVPROC __glewSecondaryColor3bv = NULL; PFNGLSECONDARYCOLOR3DPROC __glewSecondaryColor3d = NULL; PFNGLSECONDARYCOLOR3DVPROC __glewSecondaryColor3dv = NULL; PFNGLSECONDARYCOLOR3FPROC __glewSecondaryColor3f = NULL; PFNGLSECONDARYCOLOR3FVPROC __glewSecondaryColor3fv = NULL; PFNGLSECONDARYCOLOR3IPROC __glewSecondaryColor3i = NULL; PFNGLSECONDARYCOLOR3IVPROC __glewSecondaryColor3iv = NULL; PFNGLSECONDARYCOLOR3SPROC __glewSecondaryColor3s = NULL; PFNGLSECONDARYCOLOR3SVPROC __glewSecondaryColor3sv = NULL; PFNGLSECONDARYCOLOR3UBPROC __glewSecondaryColor3ub = NULL; PFNGLSECONDARYCOLOR3UBVPROC __glewSecondaryColor3ubv = NULL; PFNGLSECONDARYCOLOR3UIPROC __glewSecondaryColor3ui = NULL; PFNGLSECONDARYCOLOR3UIVPROC __glewSecondaryColor3uiv = NULL; PFNGLSECONDARYCOLOR3USPROC __glewSecondaryColor3us = NULL; PFNGLSECONDARYCOLOR3USVPROC __glewSecondaryColor3usv = NULL; PFNGLSECONDARYCOLORPOINTERPROC __glewSecondaryColorPointer = NULL; PFNGLWINDOWPOS2DPROC __glewWindowPos2d = NULL; PFNGLWINDOWPOS2DVPROC __glewWindowPos2dv = NULL; PFNGLWINDOWPOS2FPROC __glewWindowPos2f = NULL; PFNGLWINDOWPOS2FVPROC __glewWindowPos2fv = NULL; PFNGLWINDOWPOS2IPROC __glewWindowPos2i = NULL; PFNGLWINDOWPOS2IVPROC __glewWindowPos2iv = NULL; PFNGLWINDOWPOS2SPROC __glewWindowPos2s = NULL; PFNGLWINDOWPOS2SVPROC __glewWindowPos2sv = NULL; PFNGLWINDOWPOS3DPROC __glewWindowPos3d = NULL; PFNGLWINDOWPOS3DVPROC __glewWindowPos3dv = NULL; PFNGLWINDOWPOS3FPROC __glewWindowPos3f = NULL; PFNGLWINDOWPOS3FVPROC __glewWindowPos3fv = NULL; PFNGLWINDOWPOS3IPROC __glewWindowPos3i = NULL; PFNGLWINDOWPOS3IVPROC __glewWindowPos3iv = NULL; PFNGLWINDOWPOS3SPROC __glewWindowPos3s = NULL; PFNGLWINDOWPOS3SVPROC __glewWindowPos3sv = NULL; PFNGLBEGINQUERYPROC __glewBeginQuery = NULL; PFNGLBINDBUFFERPROC __glewBindBuffer = NULL; PFNGLBUFFERDATAPROC __glewBufferData = NULL; PFNGLBUFFERSUBDATAPROC __glewBufferSubData = NULL; PFNGLDELETEBUFFERSPROC __glewDeleteBuffers = NULL; PFNGLDELETEQUERIESPROC __glewDeleteQueries = NULL; PFNGLENDQUERYPROC __glewEndQuery = NULL; PFNGLGENBUFFERSPROC __glewGenBuffers = NULL; PFNGLGENQUERIESPROC __glewGenQueries = NULL; PFNGLGETBUFFERPARAMETERIVPROC __glewGetBufferParameteriv = NULL; PFNGLGETBUFFERPOINTERVPROC __glewGetBufferPointerv = NULL; PFNGLGETBUFFERSUBDATAPROC __glewGetBufferSubData = NULL; PFNGLGETQUERYOBJECTIVPROC __glewGetQueryObjectiv = NULL; PFNGLGETQUERYOBJECTUIVPROC __glewGetQueryObjectuiv = NULL; PFNGLGETQUERYIVPROC __glewGetQueryiv = NULL; PFNGLISBUFFERPROC __glewIsBuffer = NULL; PFNGLISQUERYPROC __glewIsQuery = NULL; PFNGLMAPBUFFERPROC __glewMapBuffer = NULL; PFNGLUNMAPBUFFERPROC __glewUnmapBuffer = NULL; PFNGLATTACHSHADERPROC __glewAttachShader = NULL; PFNGLBINDATTRIBLOCATIONPROC __glewBindAttribLocation = NULL; PFNGLBLENDEQUATIONSEPARATEPROC __glewBlendEquationSeparate = NULL; PFNGLCOMPILESHADERPROC __glewCompileShader = NULL; PFNGLCREATEPROGRAMPROC __glewCreateProgram = NULL; PFNGLCREATESHADERPROC __glewCreateShader = NULL; PFNGLDELETEPROGRAMPROC __glewDeleteProgram = NULL; PFNGLDELETESHADERPROC __glewDeleteShader = NULL; PFNGLDETACHSHADERPROC __glewDetachShader = NULL; PFNGLDISABLEVERTEXATTRIBARRAYPROC __glewDisableVertexAttribArray = NULL; PFNGLDRAWBUFFERSPROC __glewDrawBuffers = NULL; PFNGLENABLEVERTEXATTRIBARRAYPROC __glewEnableVertexAttribArray = NULL; PFNGLGETACTIVEATTRIBPROC __glewGetActiveAttrib = NULL; PFNGLGETACTIVEUNIFORMPROC __glewGetActiveUniform = NULL; PFNGLGETATTACHEDSHADERSPROC __glewGetAttachedShaders = NULL; PFNGLGETATTRIBLOCATIONPROC __glewGetAttribLocation = NULL; PFNGLGETPROGRAMINFOLOGPROC __glewGetProgramInfoLog = NULL; PFNGLGETPROGRAMIVPROC __glewGetProgramiv = NULL; PFNGLGETSHADERINFOLOGPROC __glewGetShaderInfoLog = NULL; PFNGLGETSHADERSOURCEPROC __glewGetShaderSource = NULL; PFNGLGETSHADERIVPROC __glewGetShaderiv = NULL; PFNGLGETUNIFORMLOCATIONPROC __glewGetUniformLocation = NULL; PFNGLGETUNIFORMFVPROC __glewGetUniformfv = NULL; PFNGLGETUNIFORMIVPROC __glewGetUniformiv = NULL; PFNGLGETVERTEXATTRIBPOINTERVPROC __glewGetVertexAttribPointerv = NULL; PFNGLGETVERTEXATTRIBDVPROC __glewGetVertexAttribdv = NULL; PFNGLGETVERTEXATTRIBFVPROC __glewGetVertexAttribfv = NULL; PFNGLGETVERTEXATTRIBIVPROC __glewGetVertexAttribiv = NULL; PFNGLISPROGRAMPROC __glewIsProgram = NULL; PFNGLISSHADERPROC __glewIsShader = NULL; PFNGLLINKPROGRAMPROC __glewLinkProgram = NULL; PFNGLSHADERSOURCEPROC __glewShaderSource = NULL; PFNGLSTENCILFUNCSEPARATEPROC __glewStencilFuncSeparate = NULL; PFNGLSTENCILMASKSEPARATEPROC __glewStencilMaskSeparate = NULL; PFNGLSTENCILOPSEPARATEPROC __glewStencilOpSeparate = NULL; PFNGLUNIFORM1FPROC __glewUniform1f = NULL; PFNGLUNIFORM1FVPROC __glewUniform1fv = NULL; PFNGLUNIFORM1IPROC __glewUniform1i = NULL; PFNGLUNIFORM1IVPROC __glewUniform1iv = NULL; PFNGLUNIFORM2FPROC __glewUniform2f = NULL; PFNGLUNIFORM2FVPROC __glewUniform2fv = NULL; PFNGLUNIFORM2IPROC __glewUniform2i = NULL; PFNGLUNIFORM2IVPROC __glewUniform2iv = NULL; PFNGLUNIFORM3FPROC __glewUniform3f = NULL; PFNGLUNIFORM3FVPROC __glewUniform3fv = NULL; PFNGLUNIFORM3IPROC __glewUniform3i = NULL; PFNGLUNIFORM3IVPROC __glewUniform3iv = NULL; PFNGLUNIFORM4FPROC __glewUniform4f = NULL; PFNGLUNIFORM4FVPROC __glewUniform4fv = NULL; PFNGLUNIFORM4IPROC __glewUniform4i = NULL; PFNGLUNIFORM4IVPROC __glewUniform4iv = NULL; PFNGLUNIFORMMATRIX2FVPROC __glewUniformMatrix2fv = NULL; PFNGLUNIFORMMATRIX3FVPROC __glewUniformMatrix3fv = NULL; PFNGLUNIFORMMATRIX4FVPROC __glewUniformMatrix4fv = NULL; PFNGLUSEPROGRAMPROC __glewUseProgram = NULL; PFNGLVALIDATEPROGRAMPROC __glewValidateProgram = NULL; PFNGLVERTEXATTRIB1DPROC __glewVertexAttrib1d = NULL; PFNGLVERTEXATTRIB1DVPROC __glewVertexAttrib1dv = NULL; PFNGLVERTEXATTRIB1FPROC __glewVertexAttrib1f = NULL; PFNGLVERTEXATTRIB1FVPROC __glewVertexAttrib1fv = NULL; PFNGLVERTEXATTRIB1SPROC __glewVertexAttrib1s = NULL; PFNGLVERTEXATTRIB1SVPROC __glewVertexAttrib1sv = NULL; PFNGLVERTEXATTRIB2DPROC __glewVertexAttrib2d = NULL; PFNGLVERTEXATTRIB2DVPROC __glewVertexAttrib2dv = NULL; PFNGLVERTEXATTRIB2FPROC __glewVertexAttrib2f = NULL; PFNGLVERTEXATTRIB2FVPROC __glewVertexAttrib2fv = NULL; PFNGLVERTEXATTRIB2SPROC __glewVertexAttrib2s = NULL; PFNGLVERTEXATTRIB2SVPROC __glewVertexAttrib2sv = NULL; PFNGLVERTEXATTRIB3DPROC __glewVertexAttrib3d = NULL; PFNGLVERTEXATTRIB3DVPROC __glewVertexAttrib3dv = NULL; PFNGLVERTEXATTRIB3FPROC __glewVertexAttrib3f = NULL; PFNGLVERTEXATTRIB3FVPROC __glewVertexAttrib3fv = NULL; PFNGLVERTEXATTRIB3SPROC __glewVertexAttrib3s = NULL; PFNGLVERTEXATTRIB3SVPROC __glewVertexAttrib3sv = NULL; PFNGLVERTEXATTRIB4NBVPROC __glewVertexAttrib4Nbv = NULL; PFNGLVERTEXATTRIB4NIVPROC __glewVertexAttrib4Niv = NULL; PFNGLVERTEXATTRIB4NSVPROC __glewVertexAttrib4Nsv = NULL; PFNGLVERTEXATTRIB4NUBPROC __glewVertexAttrib4Nub = NULL; PFNGLVERTEXATTRIB4NUBVPROC __glewVertexAttrib4Nubv = NULL; PFNGLVERTEXATTRIB4NUIVPROC __glewVertexAttrib4Nuiv = NULL; PFNGLVERTEXATTRIB4NUSVPROC __glewVertexAttrib4Nusv = NULL; PFNGLVERTEXATTRIB4BVPROC __glewVertexAttrib4bv = NULL; PFNGLVERTEXATTRIB4DPROC __glewVertexAttrib4d = NULL; PFNGLVERTEXATTRIB4DVPROC __glewVertexAttrib4dv = NULL; PFNGLVERTEXATTRIB4FPROC __glewVertexAttrib4f = NULL; PFNGLVERTEXATTRIB4FVPROC __glewVertexAttrib4fv = NULL; PFNGLVERTEXATTRIB4IVPROC __glewVertexAttrib4iv = NULL; PFNGLVERTEXATTRIB4SPROC __glewVertexAttrib4s = NULL; PFNGLVERTEXATTRIB4SVPROC __glewVertexAttrib4sv = NULL; PFNGLVERTEXATTRIB4UBVPROC __glewVertexAttrib4ubv = NULL; PFNGLVERTEXATTRIB4UIVPROC __glewVertexAttrib4uiv = NULL; PFNGLVERTEXATTRIB4USVPROC __glewVertexAttrib4usv = NULL; PFNGLVERTEXATTRIBPOINTERPROC __glewVertexAttribPointer = NULL; PFNGLUNIFORMMATRIX2X3FVPROC __glewUniformMatrix2x3fv = NULL; PFNGLUNIFORMMATRIX2X4FVPROC __glewUniformMatrix2x4fv = NULL; PFNGLUNIFORMMATRIX3X2FVPROC __glewUniformMatrix3x2fv = NULL; PFNGLUNIFORMMATRIX3X4FVPROC __glewUniformMatrix3x4fv = NULL; PFNGLUNIFORMMATRIX4X2FVPROC __glewUniformMatrix4x2fv = NULL; PFNGLUNIFORMMATRIX4X3FVPROC __glewUniformMatrix4x3fv = NULL; PFNGLBEGINCONDITIONALRENDERPROC __glewBeginConditionalRender = NULL; PFNGLBEGINTRANSFORMFEEDBACKPROC __glewBeginTransformFeedback = NULL; PFNGLBINDFRAGDATALOCATIONPROC __glewBindFragDataLocation = NULL; PFNGLCLAMPCOLORPROC __glewClampColor = NULL; PFNGLCLEARBUFFERFIPROC __glewClearBufferfi = NULL; PFNGLCLEARBUFFERFVPROC __glewClearBufferfv = NULL; PFNGLCLEARBUFFERIVPROC __glewClearBufferiv = NULL; PFNGLCLEARBUFFERUIVPROC __glewClearBufferuiv = NULL; PFNGLCOLORMASKIPROC __glewColorMaski = NULL; PFNGLDISABLEIPROC __glewDisablei = NULL; PFNGLENABLEIPROC __glewEnablei = NULL; PFNGLENDCONDITIONALRENDERPROC __glewEndConditionalRender = NULL; PFNGLENDTRANSFORMFEEDBACKPROC __glewEndTransformFeedback = NULL; PFNGLGETBOOLEANI_VPROC __glewGetBooleani_v = NULL; PFNGLGETFRAGDATALOCATIONPROC __glewGetFragDataLocation = NULL; PFNGLGETSTRINGIPROC __glewGetStringi = NULL; PFNGLGETTEXPARAMETERIIVPROC __glewGetTexParameterIiv = NULL; PFNGLGETTEXPARAMETERIUIVPROC __glewGetTexParameterIuiv = NULL; PFNGLGETTRANSFORMFEEDBACKVARYINGPROC __glewGetTransformFeedbackVarying = NULL; PFNGLGETUNIFORMUIVPROC __glewGetUniformuiv = NULL; PFNGLGETVERTEXATTRIBIIVPROC __glewGetVertexAttribIiv = NULL; PFNGLGETVERTEXATTRIBIUIVPROC __glewGetVertexAttribIuiv = NULL; PFNGLISENABLEDIPROC __glewIsEnabledi = NULL; PFNGLTEXPARAMETERIIVPROC __glewTexParameterIiv = NULL; PFNGLTEXPARAMETERIUIVPROC __glewTexParameterIuiv = NULL; PFNGLTRANSFORMFEEDBACKVARYINGSPROC __glewTransformFeedbackVaryings = NULL; PFNGLUNIFORM1UIPROC __glewUniform1ui = NULL; PFNGLUNIFORM1UIVPROC __glewUniform1uiv = NULL; PFNGLUNIFORM2UIPROC __glewUniform2ui = NULL; PFNGLUNIFORM2UIVPROC __glewUniform2uiv = NULL; PFNGLUNIFORM3UIPROC __glewUniform3ui = NULL; PFNGLUNIFORM3UIVPROC __glewUniform3uiv = NULL; PFNGLUNIFORM4UIPROC __glewUniform4ui = NULL; PFNGLUNIFORM4UIVPROC __glewUniform4uiv = NULL; PFNGLVERTEXATTRIBI1IPROC __glewVertexAttribI1i = NULL; PFNGLVERTEXATTRIBI1IVPROC __glewVertexAttribI1iv = NULL; PFNGLVERTEXATTRIBI1UIPROC __glewVertexAttribI1ui = NULL; PFNGLVERTEXATTRIBI1UIVPROC __glewVertexAttribI1uiv = NULL; PFNGLVERTEXATTRIBI2IPROC __glewVertexAttribI2i = NULL; PFNGLVERTEXATTRIBI2IVPROC __glewVertexAttribI2iv = NULL; PFNGLVERTEXATTRIBI2UIPROC __glewVertexAttribI2ui = NULL; PFNGLVERTEXATTRIBI2UIVPROC __glewVertexAttribI2uiv = NULL; PFNGLVERTEXATTRIBI3IPROC __glewVertexAttribI3i = NULL; PFNGLVERTEXATTRIBI3IVPROC __glewVertexAttribI3iv = NULL; PFNGLVERTEXATTRIBI3UIPROC __glewVertexAttribI3ui = NULL; PFNGLVERTEXATTRIBI3UIVPROC __glewVertexAttribI3uiv = NULL; PFNGLVERTEXATTRIBI4BVPROC __glewVertexAttribI4bv = NULL; PFNGLVERTEXATTRIBI4IPROC __glewVertexAttribI4i = NULL; PFNGLVERTEXATTRIBI4IVPROC __glewVertexAttribI4iv = NULL; PFNGLVERTEXATTRIBI4SVPROC __glewVertexAttribI4sv = NULL; PFNGLVERTEXATTRIBI4UBVPROC __glewVertexAttribI4ubv = NULL; PFNGLVERTEXATTRIBI4UIPROC __glewVertexAttribI4ui = NULL; PFNGLVERTEXATTRIBI4UIVPROC __glewVertexAttribI4uiv = NULL; PFNGLVERTEXATTRIBI4USVPROC __glewVertexAttribI4usv = NULL; PFNGLVERTEXATTRIBIPOINTERPROC __glewVertexAttribIPointer = NULL; PFNGLDRAWARRAYSINSTANCEDPROC __glewDrawArraysInstanced = NULL; PFNGLDRAWELEMENTSINSTANCEDPROC __glewDrawElementsInstanced = NULL; PFNGLPRIMITIVERESTARTINDEXPROC __glewPrimitiveRestartIndex = NULL; PFNGLTEXBUFFERPROC __glewTexBuffer = NULL; PFNGLFRAMEBUFFERTEXTUREPROC __glewFramebufferTexture = NULL; PFNGLGETBUFFERPARAMETERI64VPROC __glewGetBufferParameteri64v = NULL; PFNGLGETINTEGER64I_VPROC __glewGetInteger64i_v = NULL; PFNGLVERTEXATTRIBDIVISORPROC __glewVertexAttribDivisor = NULL; PFNGLBLENDEQUATIONSEPARATEIPROC __glewBlendEquationSeparatei = NULL; PFNGLBLENDEQUATIONIPROC __glewBlendEquationi = NULL; PFNGLBLENDFUNCSEPARATEIPROC __glewBlendFuncSeparatei = NULL; PFNGLBLENDFUNCIPROC __glewBlendFunci = NULL; PFNGLMINSAMPLESHADINGPROC __glewMinSampleShading = NULL; PFNGLTBUFFERMASK3DFXPROC __glewTbufferMask3DFX = NULL; PFNGLDEBUGMESSAGECALLBACKAMDPROC __glewDebugMessageCallbackAMD = NULL; PFNGLDEBUGMESSAGEENABLEAMDPROC __glewDebugMessageEnableAMD = NULL; PFNGLDEBUGMESSAGEINSERTAMDPROC __glewDebugMessageInsertAMD = NULL; PFNGLGETDEBUGMESSAGELOGAMDPROC __glewGetDebugMessageLogAMD = NULL; PFNGLBLENDEQUATIONINDEXEDAMDPROC __glewBlendEquationIndexedAMD = NULL; PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC __glewBlendEquationSeparateIndexedAMD = NULL; PFNGLBLENDFUNCINDEXEDAMDPROC __glewBlendFuncIndexedAMD = NULL; PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC __glewBlendFuncSeparateIndexedAMD = NULL; PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC __glewMultiDrawArraysIndirectAMD = NULL; PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC __glewMultiDrawElementsIndirectAMD = NULL; PFNGLDELETENAMESAMDPROC __glewDeleteNamesAMD = NULL; PFNGLGENNAMESAMDPROC __glewGenNamesAMD = NULL; PFNGLISNAMEAMDPROC __glewIsNameAMD = NULL; PFNGLBEGINPERFMONITORAMDPROC __glewBeginPerfMonitorAMD = NULL; PFNGLDELETEPERFMONITORSAMDPROC __glewDeletePerfMonitorsAMD = NULL; PFNGLENDPERFMONITORAMDPROC __glewEndPerfMonitorAMD = NULL; PFNGLGENPERFMONITORSAMDPROC __glewGenPerfMonitorsAMD = NULL; PFNGLGETPERFMONITORCOUNTERDATAAMDPROC __glewGetPerfMonitorCounterDataAMD = NULL; PFNGLGETPERFMONITORCOUNTERINFOAMDPROC __glewGetPerfMonitorCounterInfoAMD = NULL; PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC __glewGetPerfMonitorCounterStringAMD = NULL; PFNGLGETPERFMONITORCOUNTERSAMDPROC __glewGetPerfMonitorCountersAMD = NULL; PFNGLGETPERFMONITORGROUPSTRINGAMDPROC __glewGetPerfMonitorGroupStringAMD = NULL; PFNGLGETPERFMONITORGROUPSAMDPROC __glewGetPerfMonitorGroupsAMD = NULL; PFNGLSELECTPERFMONITORCOUNTERSAMDPROC __glewSelectPerfMonitorCountersAMD = NULL; PFNGLSETMULTISAMPLEFVAMDPROC __glewSetMultisamplefvAMD = NULL; PFNGLSTENCILOPVALUEAMDPROC __glewStencilOpValueAMD = NULL; PFNGLTESSELLATIONFACTORAMDPROC __glewTessellationFactorAMD = NULL; PFNGLTESSELLATIONMODEAMDPROC __glewTessellationModeAMD = NULL; PFNGLDRAWELEMENTARRAYAPPLEPROC __glewDrawElementArrayAPPLE = NULL; PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC __glewDrawRangeElementArrayAPPLE = NULL; PFNGLELEMENTPOINTERAPPLEPROC __glewElementPointerAPPLE = NULL; PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC __glewMultiDrawElementArrayAPPLE = NULL; PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC __glewMultiDrawRangeElementArrayAPPLE = NULL; PFNGLDELETEFENCESAPPLEPROC __glewDeleteFencesAPPLE = NULL; PFNGLFINISHFENCEAPPLEPROC __glewFinishFenceAPPLE = NULL; PFNGLFINISHOBJECTAPPLEPROC __glewFinishObjectAPPLE = NULL; PFNGLGENFENCESAPPLEPROC __glewGenFencesAPPLE = NULL; PFNGLISFENCEAPPLEPROC __glewIsFenceAPPLE = NULL; PFNGLSETFENCEAPPLEPROC __glewSetFenceAPPLE = NULL; PFNGLTESTFENCEAPPLEPROC __glewTestFenceAPPLE = NULL; PFNGLTESTOBJECTAPPLEPROC __glewTestObjectAPPLE = NULL; PFNGLBUFFERPARAMETERIAPPLEPROC __glewBufferParameteriAPPLE = NULL; PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC __glewFlushMappedBufferRangeAPPLE = NULL; PFNGLGETOBJECTPARAMETERIVAPPLEPROC __glewGetObjectParameterivAPPLE = NULL; PFNGLOBJECTPURGEABLEAPPLEPROC __glewObjectPurgeableAPPLE = NULL; PFNGLOBJECTUNPURGEABLEAPPLEPROC __glewObjectUnpurgeableAPPLE = NULL; PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC __glewGetTexParameterPointervAPPLE = NULL; PFNGLTEXTURERANGEAPPLEPROC __glewTextureRangeAPPLE = NULL; PFNGLBINDVERTEXARRAYAPPLEPROC __glewBindVertexArrayAPPLE = NULL; PFNGLDELETEVERTEXARRAYSAPPLEPROC __glewDeleteVertexArraysAPPLE = NULL; PFNGLGENVERTEXARRAYSAPPLEPROC __glewGenVertexArraysAPPLE = NULL; PFNGLISVERTEXARRAYAPPLEPROC __glewIsVertexArrayAPPLE = NULL; PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC __glewFlushVertexArrayRangeAPPLE = NULL; PFNGLVERTEXARRAYPARAMETERIAPPLEPROC __glewVertexArrayParameteriAPPLE = NULL; PFNGLVERTEXARRAYRANGEAPPLEPROC __glewVertexArrayRangeAPPLE = NULL; PFNGLDISABLEVERTEXATTRIBAPPLEPROC __glewDisableVertexAttribAPPLE = NULL; PFNGLENABLEVERTEXATTRIBAPPLEPROC __glewEnableVertexAttribAPPLE = NULL; PFNGLISVERTEXATTRIBENABLEDAPPLEPROC __glewIsVertexAttribEnabledAPPLE = NULL; PFNGLMAPVERTEXATTRIB1DAPPLEPROC __glewMapVertexAttrib1dAPPLE = NULL; PFNGLMAPVERTEXATTRIB1FAPPLEPROC __glewMapVertexAttrib1fAPPLE = NULL; PFNGLMAPVERTEXATTRIB2DAPPLEPROC __glewMapVertexAttrib2dAPPLE = NULL; PFNGLMAPVERTEXATTRIB2FAPPLEPROC __glewMapVertexAttrib2fAPPLE = NULL; PFNGLCLEARDEPTHFPROC __glewClearDepthf = NULL; PFNGLDEPTHRANGEFPROC __glewDepthRangef = NULL; PFNGLGETSHADERPRECISIONFORMATPROC __glewGetShaderPrecisionFormat = NULL; PFNGLRELEASESHADERCOMPILERPROC __glewReleaseShaderCompiler = NULL; PFNGLSHADERBINARYPROC __glewShaderBinary = NULL; PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC __glewDrawArraysInstancedBaseInstance = NULL; PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC __glewDrawElementsInstancedBaseInstance = NULL; PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC __glewDrawElementsInstancedBaseVertexBaseInstance = NULL; PFNGLBINDFRAGDATALOCATIONINDEXEDPROC __glewBindFragDataLocationIndexed = NULL; PFNGLGETFRAGDATAINDEXPROC __glewGetFragDataIndex = NULL; PFNGLCREATESYNCFROMCLEVENTARBPROC __glewCreateSyncFromCLeventARB = NULL; PFNGLCLEARBUFFERDATAPROC __glewClearBufferData = NULL; PFNGLCLEARBUFFERSUBDATAPROC __glewClearBufferSubData = NULL; PFNGLCLEARNAMEDBUFFERDATAEXTPROC __glewClearNamedBufferDataEXT = NULL; PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC __glewClearNamedBufferSubDataEXT = NULL; PFNGLCLAMPCOLORARBPROC __glewClampColorARB = NULL; PFNGLDISPATCHCOMPUTEPROC __glewDispatchCompute = NULL; PFNGLDISPATCHCOMPUTEINDIRECTPROC __glewDispatchComputeIndirect = NULL; PFNGLCOPYBUFFERSUBDATAPROC __glewCopyBufferSubData = NULL; PFNGLCOPYIMAGESUBDATAPROC __glewCopyImageSubData = NULL; PFNGLDEBUGMESSAGECALLBACKARBPROC __glewDebugMessageCallbackARB = NULL; PFNGLDEBUGMESSAGECONTROLARBPROC __glewDebugMessageControlARB = NULL; PFNGLDEBUGMESSAGEINSERTARBPROC __glewDebugMessageInsertARB = NULL; PFNGLGETDEBUGMESSAGELOGARBPROC __glewGetDebugMessageLogARB = NULL; PFNGLDRAWBUFFERSARBPROC __glewDrawBuffersARB = NULL; PFNGLBLENDEQUATIONSEPARATEIARBPROC __glewBlendEquationSeparateiARB = NULL; PFNGLBLENDEQUATIONIARBPROC __glewBlendEquationiARB = NULL; PFNGLBLENDFUNCSEPARATEIARBPROC __glewBlendFuncSeparateiARB = NULL; PFNGLBLENDFUNCIARBPROC __glewBlendFunciARB = NULL; PFNGLDRAWELEMENTSBASEVERTEXPROC __glewDrawElementsBaseVertex = NULL; PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC __glewDrawElementsInstancedBaseVertex = NULL; PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC __glewDrawRangeElementsBaseVertex = NULL; PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC __glewMultiDrawElementsBaseVertex = NULL; PFNGLDRAWARRAYSINDIRECTPROC __glewDrawArraysIndirect = NULL; PFNGLDRAWELEMENTSINDIRECTPROC __glewDrawElementsIndirect = NULL; PFNGLFRAMEBUFFERPARAMETERIPROC __glewFramebufferParameteri = NULL; PFNGLGETFRAMEBUFFERPARAMETERIVPROC __glewGetFramebufferParameteriv = NULL; PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC __glewGetNamedFramebufferParameterivEXT = NULL; PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC __glewNamedFramebufferParameteriEXT = NULL; PFNGLBINDFRAMEBUFFERPROC __glewBindFramebuffer = NULL; PFNGLBINDRENDERBUFFERPROC __glewBindRenderbuffer = NULL; PFNGLBLITFRAMEBUFFERPROC __glewBlitFramebuffer = NULL; PFNGLCHECKFRAMEBUFFERSTATUSPROC __glewCheckFramebufferStatus = NULL; PFNGLDELETEFRAMEBUFFERSPROC __glewDeleteFramebuffers = NULL; PFNGLDELETERENDERBUFFERSPROC __glewDeleteRenderbuffers = NULL; PFNGLFRAMEBUFFERRENDERBUFFERPROC __glewFramebufferRenderbuffer = NULL; PFNGLFRAMEBUFFERTEXTURE1DPROC __glewFramebufferTexture1D = NULL; PFNGLFRAMEBUFFERTEXTURE2DPROC __glewFramebufferTexture2D = NULL; PFNGLFRAMEBUFFERTEXTURE3DPROC __glewFramebufferTexture3D = NULL; PFNGLFRAMEBUFFERTEXTURELAYERPROC __glewFramebufferTextureLayer = NULL; PFNGLGENFRAMEBUFFERSPROC __glewGenFramebuffers = NULL; PFNGLGENRENDERBUFFERSPROC __glewGenRenderbuffers = NULL; PFNGLGENERATEMIPMAPPROC __glewGenerateMipmap = NULL; PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC __glewGetFramebufferAttachmentParameteriv = NULL; PFNGLGETRENDERBUFFERPARAMETERIVPROC __glewGetRenderbufferParameteriv = NULL; PFNGLISFRAMEBUFFERPROC __glewIsFramebuffer = NULL; PFNGLISRENDERBUFFERPROC __glewIsRenderbuffer = NULL; PFNGLRENDERBUFFERSTORAGEPROC __glewRenderbufferStorage = NULL; PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC __glewRenderbufferStorageMultisample = NULL; PFNGLFRAMEBUFFERTEXTUREARBPROC __glewFramebufferTextureARB = NULL; PFNGLFRAMEBUFFERTEXTUREFACEARBPROC __glewFramebufferTextureFaceARB = NULL; PFNGLFRAMEBUFFERTEXTURELAYERARBPROC __glewFramebufferTextureLayerARB = NULL; PFNGLPROGRAMPARAMETERIARBPROC __glewProgramParameteriARB = NULL; PFNGLGETPROGRAMBINARYPROC __glewGetProgramBinary = NULL; PFNGLPROGRAMBINARYPROC __glewProgramBinary = NULL; PFNGLPROGRAMPARAMETERIPROC __glewProgramParameteri = NULL; PFNGLGETUNIFORMDVPROC __glewGetUniformdv = NULL; PFNGLUNIFORM1DPROC __glewUniform1d = NULL; PFNGLUNIFORM1DVPROC __glewUniform1dv = NULL; PFNGLUNIFORM2DPROC __glewUniform2d = NULL; PFNGLUNIFORM2DVPROC __glewUniform2dv = NULL; PFNGLUNIFORM3DPROC __glewUniform3d = NULL; PFNGLUNIFORM3DVPROC __glewUniform3dv = NULL; PFNGLUNIFORM4DPROC __glewUniform4d = NULL; PFNGLUNIFORM4DVPROC __glewUniform4dv = NULL; PFNGLUNIFORMMATRIX2DVPROC __glewUniformMatrix2dv = NULL; PFNGLUNIFORMMATRIX2X3DVPROC __glewUniformMatrix2x3dv = NULL; PFNGLUNIFORMMATRIX2X4DVPROC __glewUniformMatrix2x4dv = NULL; PFNGLUNIFORMMATRIX3DVPROC __glewUniformMatrix3dv = NULL; PFNGLUNIFORMMATRIX3X2DVPROC __glewUniformMatrix3x2dv = NULL; PFNGLUNIFORMMATRIX3X4DVPROC __glewUniformMatrix3x4dv = NULL; PFNGLUNIFORMMATRIX4DVPROC __glewUniformMatrix4dv = NULL; PFNGLUNIFORMMATRIX4X2DVPROC __glewUniformMatrix4x2dv = NULL; PFNGLUNIFORMMATRIX4X3DVPROC __glewUniformMatrix4x3dv = NULL; PFNGLCOLORSUBTABLEPROC __glewColorSubTable = NULL; PFNGLCOLORTABLEPROC __glewColorTable = NULL; PFNGLCOLORTABLEPARAMETERFVPROC __glewColorTableParameterfv = NULL; PFNGLCOLORTABLEPARAMETERIVPROC __glewColorTableParameteriv = NULL; PFNGLCONVOLUTIONFILTER1DPROC __glewConvolutionFilter1D = NULL; PFNGLCONVOLUTIONFILTER2DPROC __glewConvolutionFilter2D = NULL; PFNGLCONVOLUTIONPARAMETERFPROC __glewConvolutionParameterf = NULL; PFNGLCONVOLUTIONPARAMETERFVPROC __glewConvolutionParameterfv = NULL; PFNGLCONVOLUTIONPARAMETERIPROC __glewConvolutionParameteri = NULL; PFNGLCONVOLUTIONPARAMETERIVPROC __glewConvolutionParameteriv = NULL; PFNGLCOPYCOLORSUBTABLEPROC __glewCopyColorSubTable = NULL; PFNGLCOPYCOLORTABLEPROC __glewCopyColorTable = NULL; PFNGLCOPYCONVOLUTIONFILTER1DPROC __glewCopyConvolutionFilter1D = NULL; PFNGLCOPYCONVOLUTIONFILTER2DPROC __glewCopyConvolutionFilter2D = NULL; PFNGLGETCOLORTABLEPROC __glewGetColorTable = NULL; PFNGLGETCOLORTABLEPARAMETERFVPROC __glewGetColorTableParameterfv = NULL; PFNGLGETCOLORTABLEPARAMETERIVPROC __glewGetColorTableParameteriv = NULL; PFNGLGETCONVOLUTIONFILTERPROC __glewGetConvolutionFilter = NULL; PFNGLGETCONVOLUTIONPARAMETERFVPROC __glewGetConvolutionParameterfv = NULL; PFNGLGETCONVOLUTIONPARAMETERIVPROC __glewGetConvolutionParameteriv = NULL; PFNGLGETHISTOGRAMPROC __glewGetHistogram = NULL; PFNGLGETHISTOGRAMPARAMETERFVPROC __glewGetHistogramParameterfv = NULL; PFNGLGETHISTOGRAMPARAMETERIVPROC __glewGetHistogramParameteriv = NULL; PFNGLGETMINMAXPROC __glewGetMinmax = NULL; PFNGLGETMINMAXPARAMETERFVPROC __glewGetMinmaxParameterfv = NULL; PFNGLGETMINMAXPARAMETERIVPROC __glewGetMinmaxParameteriv = NULL; PFNGLGETSEPARABLEFILTERPROC __glewGetSeparableFilter = NULL; PFNGLHISTOGRAMPROC __glewHistogram = NULL; PFNGLMINMAXPROC __glewMinmax = NULL; PFNGLRESETHISTOGRAMPROC __glewResetHistogram = NULL; PFNGLRESETMINMAXPROC __glewResetMinmax = NULL; PFNGLSEPARABLEFILTER2DPROC __glewSeparableFilter2D = NULL; PFNGLDRAWARRAYSINSTANCEDARBPROC __glewDrawArraysInstancedARB = NULL; PFNGLDRAWELEMENTSINSTANCEDARBPROC __glewDrawElementsInstancedARB = NULL; PFNGLVERTEXATTRIBDIVISORARBPROC __glewVertexAttribDivisorARB = NULL; PFNGLGETINTERNALFORMATIVPROC __glewGetInternalformativ = NULL; PFNGLGETINTERNALFORMATI64VPROC __glewGetInternalformati64v = NULL; PFNGLINVALIDATEBUFFERDATAPROC __glewInvalidateBufferData = NULL; PFNGLINVALIDATEBUFFERSUBDATAPROC __glewInvalidateBufferSubData = NULL; PFNGLINVALIDATEFRAMEBUFFERPROC __glewInvalidateFramebuffer = NULL; PFNGLINVALIDATESUBFRAMEBUFFERPROC __glewInvalidateSubFramebuffer = NULL; PFNGLINVALIDATETEXIMAGEPROC __glewInvalidateTexImage = NULL; PFNGLINVALIDATETEXSUBIMAGEPROC __glewInvalidateTexSubImage = NULL; PFNGLFLUSHMAPPEDBUFFERRANGEPROC __glewFlushMappedBufferRange = NULL; PFNGLMAPBUFFERRANGEPROC __glewMapBufferRange = NULL; PFNGLCURRENTPALETTEMATRIXARBPROC __glewCurrentPaletteMatrixARB = NULL; PFNGLMATRIXINDEXPOINTERARBPROC __glewMatrixIndexPointerARB = NULL; PFNGLMATRIXINDEXUBVARBPROC __glewMatrixIndexubvARB = NULL; PFNGLMATRIXINDEXUIVARBPROC __glewMatrixIndexuivARB = NULL; PFNGLMATRIXINDEXUSVARBPROC __glewMatrixIndexusvARB = NULL; PFNGLMULTIDRAWARRAYSINDIRECTPROC __glewMultiDrawArraysIndirect = NULL; PFNGLMULTIDRAWELEMENTSINDIRECTPROC __glewMultiDrawElementsIndirect = NULL; PFNGLSAMPLECOVERAGEARBPROC __glewSampleCoverageARB = NULL; PFNGLACTIVETEXTUREARBPROC __glewActiveTextureARB = NULL; PFNGLCLIENTACTIVETEXTUREARBPROC __glewClientActiveTextureARB = NULL; PFNGLMULTITEXCOORD1DARBPROC __glewMultiTexCoord1dARB = NULL; PFNGLMULTITEXCOORD1DVARBPROC __glewMultiTexCoord1dvARB = NULL; PFNGLMULTITEXCOORD1FARBPROC __glewMultiTexCoord1fARB = NULL; PFNGLMULTITEXCOORD1FVARBPROC __glewMultiTexCoord1fvARB = NULL; PFNGLMULTITEXCOORD1IARBPROC __glewMultiTexCoord1iARB = NULL; PFNGLMULTITEXCOORD1IVARBPROC __glewMultiTexCoord1ivARB = NULL; PFNGLMULTITEXCOORD1SARBPROC __glewMultiTexCoord1sARB = NULL; PFNGLMULTITEXCOORD1SVARBPROC __glewMultiTexCoord1svARB = NULL; PFNGLMULTITEXCOORD2DARBPROC __glewMultiTexCoord2dARB = NULL; PFNGLMULTITEXCOORD2DVARBPROC __glewMultiTexCoord2dvARB = NULL; PFNGLMULTITEXCOORD2FARBPROC __glewMultiTexCoord2fARB = NULL; PFNGLMULTITEXCOORD2FVARBPROC __glewMultiTexCoord2fvARB = NULL; PFNGLMULTITEXCOORD2IARBPROC __glewMultiTexCoord2iARB = NULL; PFNGLMULTITEXCOORD2IVARBPROC __glewMultiTexCoord2ivARB = NULL; PFNGLMULTITEXCOORD2SARBPROC __glewMultiTexCoord2sARB = NULL; PFNGLMULTITEXCOORD2SVARBPROC __glewMultiTexCoord2svARB = NULL; PFNGLMULTITEXCOORD3DARBPROC __glewMultiTexCoord3dARB = NULL; PFNGLMULTITEXCOORD3DVARBPROC __glewMultiTexCoord3dvARB = NULL; PFNGLMULTITEXCOORD3FARBPROC __glewMultiTexCoord3fARB = NULL; PFNGLMULTITEXCOORD3FVARBPROC __glewMultiTexCoord3fvARB = NULL; PFNGLMULTITEXCOORD3IARBPROC __glewMultiTexCoord3iARB = NULL; PFNGLMULTITEXCOORD3IVARBPROC __glewMultiTexCoord3ivARB = NULL; PFNGLMULTITEXCOORD3SARBPROC __glewMultiTexCoord3sARB = NULL; PFNGLMULTITEXCOORD3SVARBPROC __glewMultiTexCoord3svARB = NULL; PFNGLMULTITEXCOORD4DARBPROC __glewMultiTexCoord4dARB = NULL; PFNGLMULTITEXCOORD4DVARBPROC __glewMultiTexCoord4dvARB = NULL; PFNGLMULTITEXCOORD4FARBPROC __glewMultiTexCoord4fARB = NULL; PFNGLMULTITEXCOORD4FVARBPROC __glewMultiTexCoord4fvARB = NULL; PFNGLMULTITEXCOORD4IARBPROC __glewMultiTexCoord4iARB = NULL; PFNGLMULTITEXCOORD4IVARBPROC __glewMultiTexCoord4ivARB = NULL; PFNGLMULTITEXCOORD4SARBPROC __glewMultiTexCoord4sARB = NULL; PFNGLMULTITEXCOORD4SVARBPROC __glewMultiTexCoord4svARB = NULL; PFNGLBEGINQUERYARBPROC __glewBeginQueryARB = NULL; PFNGLDELETEQUERIESARBPROC __glewDeleteQueriesARB = NULL; PFNGLENDQUERYARBPROC __glewEndQueryARB = NULL; PFNGLGENQUERIESARBPROC __glewGenQueriesARB = NULL; PFNGLGETQUERYOBJECTIVARBPROC __glewGetQueryObjectivARB = NULL; PFNGLGETQUERYOBJECTUIVARBPROC __glewGetQueryObjectuivARB = NULL; PFNGLGETQUERYIVARBPROC __glewGetQueryivARB = NULL; PFNGLISQUERYARBPROC __glewIsQueryARB = NULL; PFNGLPOINTPARAMETERFARBPROC __glewPointParameterfARB = NULL; PFNGLPOINTPARAMETERFVARBPROC __glewPointParameterfvARB = NULL; PFNGLGETPROGRAMINTERFACEIVPROC __glewGetProgramInterfaceiv = NULL; PFNGLGETPROGRAMRESOURCEINDEXPROC __glewGetProgramResourceIndex = NULL; PFNGLGETPROGRAMRESOURCELOCATIONPROC __glewGetProgramResourceLocation = NULL; PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC __glewGetProgramResourceLocationIndex = NULL; PFNGLGETPROGRAMRESOURCENAMEPROC __glewGetProgramResourceName = NULL; PFNGLGETPROGRAMRESOURCEIVPROC __glewGetProgramResourceiv = NULL; PFNGLPROVOKINGVERTEXPROC __glewProvokingVertex = NULL; PFNGLGETGRAPHICSRESETSTATUSARBPROC __glewGetGraphicsResetStatusARB = NULL; PFNGLGETNCOLORTABLEARBPROC __glewGetnColorTableARB = NULL; PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC __glewGetnCompressedTexImageARB = NULL; PFNGLGETNCONVOLUTIONFILTERARBPROC __glewGetnConvolutionFilterARB = NULL; PFNGLGETNHISTOGRAMARBPROC __glewGetnHistogramARB = NULL; PFNGLGETNMAPDVARBPROC __glewGetnMapdvARB = NULL; PFNGLGETNMAPFVARBPROC __glewGetnMapfvARB = NULL; PFNGLGETNMAPIVARBPROC __glewGetnMapivARB = NULL; PFNGLGETNMINMAXARBPROC __glewGetnMinmaxARB = NULL; PFNGLGETNPIXELMAPFVARBPROC __glewGetnPixelMapfvARB = NULL; PFNGLGETNPIXELMAPUIVARBPROC __glewGetnPixelMapuivARB = NULL; PFNGLGETNPIXELMAPUSVARBPROC __glewGetnPixelMapusvARB = NULL; PFNGLGETNPOLYGONSTIPPLEARBPROC __glewGetnPolygonStippleARB = NULL; PFNGLGETNSEPARABLEFILTERARBPROC __glewGetnSeparableFilterARB = NULL; PFNGLGETNTEXIMAGEARBPROC __glewGetnTexImageARB = NULL; PFNGLGETNUNIFORMDVARBPROC __glewGetnUniformdvARB = NULL; PFNGLGETNUNIFORMFVARBPROC __glewGetnUniformfvARB = NULL; PFNGLGETNUNIFORMIVARBPROC __glewGetnUniformivARB = NULL; PFNGLGETNUNIFORMUIVARBPROC __glewGetnUniformuivARB = NULL; PFNGLREADNPIXELSARBPROC __glewReadnPixelsARB = NULL; PFNGLMINSAMPLESHADINGARBPROC __glewMinSampleShadingARB = NULL; PFNGLBINDSAMPLERPROC __glewBindSampler = NULL; PFNGLDELETESAMPLERSPROC __glewDeleteSamplers = NULL; PFNGLGENSAMPLERSPROC __glewGenSamplers = NULL; PFNGLGETSAMPLERPARAMETERIIVPROC __glewGetSamplerParameterIiv = NULL; PFNGLGETSAMPLERPARAMETERIUIVPROC __glewGetSamplerParameterIuiv = NULL; PFNGLGETSAMPLERPARAMETERFVPROC __glewGetSamplerParameterfv = NULL; PFNGLGETSAMPLERPARAMETERIVPROC __glewGetSamplerParameteriv = NULL; PFNGLISSAMPLERPROC __glewIsSampler = NULL; PFNGLSAMPLERPARAMETERIIVPROC __glewSamplerParameterIiv = NULL; PFNGLSAMPLERPARAMETERIUIVPROC __glewSamplerParameterIuiv = NULL; PFNGLSAMPLERPARAMETERFPROC __glewSamplerParameterf = NULL; PFNGLSAMPLERPARAMETERFVPROC __glewSamplerParameterfv = NULL; PFNGLSAMPLERPARAMETERIPROC __glewSamplerParameteri = NULL; PFNGLSAMPLERPARAMETERIVPROC __glewSamplerParameteriv = NULL; PFNGLACTIVESHADERPROGRAMPROC __glewActiveShaderProgram = NULL; PFNGLBINDPROGRAMPIPELINEPROC __glewBindProgramPipeline = NULL; PFNGLCREATESHADERPROGRAMVPROC __glewCreateShaderProgramv = NULL; PFNGLDELETEPROGRAMPIPELINESPROC __glewDeleteProgramPipelines = NULL; PFNGLGENPROGRAMPIPELINESPROC __glewGenProgramPipelines = NULL; PFNGLGETPROGRAMPIPELINEINFOLOGPROC __glewGetProgramPipelineInfoLog = NULL; PFNGLGETPROGRAMPIPELINEIVPROC __glewGetProgramPipelineiv = NULL; PFNGLISPROGRAMPIPELINEPROC __glewIsProgramPipeline = NULL; PFNGLPROGRAMUNIFORM1DPROC __glewProgramUniform1d = NULL; PFNGLPROGRAMUNIFORM1DVPROC __glewProgramUniform1dv = NULL; PFNGLPROGRAMUNIFORM1FPROC __glewProgramUniform1f = NULL; PFNGLPROGRAMUNIFORM1FVPROC __glewProgramUniform1fv = NULL; PFNGLPROGRAMUNIFORM1IPROC __glewProgramUniform1i = NULL; PFNGLPROGRAMUNIFORM1IVPROC __glewProgramUniform1iv = NULL; PFNGLPROGRAMUNIFORM1UIPROC __glewProgramUniform1ui = NULL; PFNGLPROGRAMUNIFORM1UIVPROC __glewProgramUniform1uiv = NULL; PFNGLPROGRAMUNIFORM2DPROC __glewProgramUniform2d = NULL; PFNGLPROGRAMUNIFORM2DVPROC __glewProgramUniform2dv = NULL; PFNGLPROGRAMUNIFORM2FPROC __glewProgramUniform2f = NULL; PFNGLPROGRAMUNIFORM2FVPROC __glewProgramUniform2fv = NULL; PFNGLPROGRAMUNIFORM2IPROC __glewProgramUniform2i = NULL; PFNGLPROGRAMUNIFORM2IVPROC __glewProgramUniform2iv = NULL; PFNGLPROGRAMUNIFORM2UIPROC __glewProgramUniform2ui = NULL; PFNGLPROGRAMUNIFORM2UIVPROC __glewProgramUniform2uiv = NULL; PFNGLPROGRAMUNIFORM3DPROC __glewProgramUniform3d = NULL; PFNGLPROGRAMUNIFORM3DVPROC __glewProgramUniform3dv = NULL; PFNGLPROGRAMUNIFORM3FPROC __glewProgramUniform3f = NULL; PFNGLPROGRAMUNIFORM3FVPROC __glewProgramUniform3fv = NULL; PFNGLPROGRAMUNIFORM3IPROC __glewProgramUniform3i = NULL; PFNGLPROGRAMUNIFORM3IVPROC __glewProgramUniform3iv = NULL; PFNGLPROGRAMUNIFORM3UIPROC __glewProgramUniform3ui = NULL; PFNGLPROGRAMUNIFORM3UIVPROC __glewProgramUniform3uiv = NULL; PFNGLPROGRAMUNIFORM4DPROC __glewProgramUniform4d = NULL; PFNGLPROGRAMUNIFORM4DVPROC __glewProgramUniform4dv = NULL; PFNGLPROGRAMUNIFORM4FPROC __glewProgramUniform4f = NULL; PFNGLPROGRAMUNIFORM4FVPROC __glewProgramUniform4fv = NULL; PFNGLPROGRAMUNIFORM4IPROC __glewProgramUniform4i = NULL; PFNGLPROGRAMUNIFORM4IVPROC __glewProgramUniform4iv = NULL; PFNGLPROGRAMUNIFORM4UIPROC __glewProgramUniform4ui = NULL; PFNGLPROGRAMUNIFORM4UIVPROC __glewProgramUniform4uiv = NULL; PFNGLPROGRAMUNIFORMMATRIX2DVPROC __glewProgramUniformMatrix2dv = NULL; PFNGLPROGRAMUNIFORMMATRIX2FVPROC __glewProgramUniformMatrix2fv = NULL; PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC __glewProgramUniformMatrix2x3dv = NULL; PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC __glewProgramUniformMatrix2x3fv = NULL; PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC __glewProgramUniformMatrix2x4dv = NULL; PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC __glewProgramUniformMatrix2x4fv = NULL; PFNGLPROGRAMUNIFORMMATRIX3DVPROC __glewProgramUniformMatrix3dv = NULL; PFNGLPROGRAMUNIFORMMATRIX3FVPROC __glewProgramUniformMatrix3fv = NULL; PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC __glewProgramUniformMatrix3x2dv = NULL; PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC __glewProgramUniformMatrix3x2fv = NULL; PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC __glewProgramUniformMatrix3x4dv = NULL; PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC __glewProgramUniformMatrix3x4fv = NULL; PFNGLPROGRAMUNIFORMMATRIX4DVPROC __glewProgramUniformMatrix4dv = NULL; PFNGLPROGRAMUNIFORMMATRIX4FVPROC __glewProgramUniformMatrix4fv = NULL; PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC __glewProgramUniformMatrix4x2dv = NULL; PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC __glewProgramUniformMatrix4x2fv = NULL; PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC __glewProgramUniformMatrix4x3dv = NULL; PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC __glewProgramUniformMatrix4x3fv = NULL; PFNGLUSEPROGRAMSTAGESPROC __glewUseProgramStages = NULL; PFNGLVALIDATEPROGRAMPIPELINEPROC __glewValidateProgramPipeline = NULL; PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC __glewGetActiveAtomicCounterBufferiv = NULL; PFNGLBINDIMAGETEXTUREPROC __glewBindImageTexture = NULL; PFNGLMEMORYBARRIERPROC __glewMemoryBarrier = NULL; PFNGLATTACHOBJECTARBPROC __glewAttachObjectARB = NULL; PFNGLCOMPILESHADERARBPROC __glewCompileShaderARB = NULL; PFNGLCREATEPROGRAMOBJECTARBPROC __glewCreateProgramObjectARB = NULL; PFNGLCREATESHADEROBJECTARBPROC __glewCreateShaderObjectARB = NULL; PFNGLDELETEOBJECTARBPROC __glewDeleteObjectARB = NULL; PFNGLDETACHOBJECTARBPROC __glewDetachObjectARB = NULL; PFNGLGETACTIVEUNIFORMARBPROC __glewGetActiveUniformARB = NULL; PFNGLGETATTACHEDOBJECTSARBPROC __glewGetAttachedObjectsARB = NULL; PFNGLGETHANDLEARBPROC __glewGetHandleARB = NULL; PFNGLGETINFOLOGARBPROC __glewGetInfoLogARB = NULL; PFNGLGETOBJECTPARAMETERFVARBPROC __glewGetObjectParameterfvARB = NULL; PFNGLGETOBJECTPARAMETERIVARBPROC __glewGetObjectParameterivARB = NULL; PFNGLGETSHADERSOURCEARBPROC __glewGetShaderSourceARB = NULL; PFNGLGETUNIFORMLOCATIONARBPROC __glewGetUniformLocationARB = NULL; PFNGLGETUNIFORMFVARBPROC __glewGetUniformfvARB = NULL; PFNGLGETUNIFORMIVARBPROC __glewGetUniformivARB = NULL; PFNGLLINKPROGRAMARBPROC __glewLinkProgramARB = NULL; PFNGLSHADERSOURCEARBPROC __glewShaderSourceARB = NULL; PFNGLUNIFORM1FARBPROC __glewUniform1fARB = NULL; PFNGLUNIFORM1FVARBPROC __glewUniform1fvARB = NULL; PFNGLUNIFORM1IARBPROC __glewUniform1iARB = NULL; PFNGLUNIFORM1IVARBPROC __glewUniform1ivARB = NULL; PFNGLUNIFORM2FARBPROC __glewUniform2fARB = NULL; PFNGLUNIFORM2FVARBPROC __glewUniform2fvARB = NULL; PFNGLUNIFORM2IARBPROC __glewUniform2iARB = NULL; PFNGLUNIFORM2IVARBPROC __glewUniform2ivARB = NULL; PFNGLUNIFORM3FARBPROC __glewUniform3fARB = NULL; PFNGLUNIFORM3FVARBPROC __glewUniform3fvARB = NULL; PFNGLUNIFORM3IARBPROC __glewUniform3iARB = NULL; PFNGLUNIFORM3IVARBPROC __glewUniform3ivARB = NULL; PFNGLUNIFORM4FARBPROC __glewUniform4fARB = NULL; PFNGLUNIFORM4FVARBPROC __glewUniform4fvARB = NULL; PFNGLUNIFORM4IARBPROC __glewUniform4iARB = NULL; PFNGLUNIFORM4IVARBPROC __glewUniform4ivARB = NULL; PFNGLUNIFORMMATRIX2FVARBPROC __glewUniformMatrix2fvARB = NULL; PFNGLUNIFORMMATRIX3FVARBPROC __glewUniformMatrix3fvARB = NULL; PFNGLUNIFORMMATRIX4FVARBPROC __glewUniformMatrix4fvARB = NULL; PFNGLUSEPROGRAMOBJECTARBPROC __glewUseProgramObjectARB = NULL; PFNGLVALIDATEPROGRAMARBPROC __glewValidateProgramARB = NULL; PFNGLSHADERSTORAGEBLOCKBINDINGPROC __glewShaderStorageBlockBinding = NULL; PFNGLGETACTIVESUBROUTINENAMEPROC __glewGetActiveSubroutineName = NULL; PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC __glewGetActiveSubroutineUniformName = NULL; PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC __glewGetActiveSubroutineUniformiv = NULL; PFNGLGETPROGRAMSTAGEIVPROC __glewGetProgramStageiv = NULL; PFNGLGETSUBROUTINEINDEXPROC __glewGetSubroutineIndex = NULL; PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC __glewGetSubroutineUniformLocation = NULL; PFNGLGETUNIFORMSUBROUTINEUIVPROC __glewGetUniformSubroutineuiv = NULL; PFNGLUNIFORMSUBROUTINESUIVPROC __glewUniformSubroutinesuiv = NULL; PFNGLCOMPILESHADERINCLUDEARBPROC __glewCompileShaderIncludeARB = NULL; PFNGLDELETENAMEDSTRINGARBPROC __glewDeleteNamedStringARB = NULL; PFNGLGETNAMEDSTRINGARBPROC __glewGetNamedStringARB = NULL; PFNGLGETNAMEDSTRINGIVARBPROC __glewGetNamedStringivARB = NULL; PFNGLISNAMEDSTRINGARBPROC __glewIsNamedStringARB = NULL; PFNGLNAMEDSTRINGARBPROC __glewNamedStringARB = NULL; PFNGLCLIENTWAITSYNCPROC __glewClientWaitSync = NULL; PFNGLDELETESYNCPROC __glewDeleteSync = NULL; PFNGLFENCESYNCPROC __glewFenceSync = NULL; PFNGLGETINTEGER64VPROC __glewGetInteger64v = NULL; PFNGLGETSYNCIVPROC __glewGetSynciv = NULL; PFNGLISSYNCPROC __glewIsSync = NULL; PFNGLWAITSYNCPROC __glewWaitSync = NULL; PFNGLPATCHPARAMETERFVPROC __glewPatchParameterfv = NULL; PFNGLPATCHPARAMETERIPROC __glewPatchParameteri = NULL; PFNGLTEXBUFFERARBPROC __glewTexBufferARB = NULL; PFNGLTEXBUFFERRANGEPROC __glewTexBufferRange = NULL; PFNGLTEXTUREBUFFERRANGEEXTPROC __glewTextureBufferRangeEXT = NULL; PFNGLCOMPRESSEDTEXIMAGE1DARBPROC __glewCompressedTexImage1DARB = NULL; PFNGLCOMPRESSEDTEXIMAGE2DARBPROC __glewCompressedTexImage2DARB = NULL; PFNGLCOMPRESSEDTEXIMAGE3DARBPROC __glewCompressedTexImage3DARB = NULL; PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC __glewCompressedTexSubImage1DARB = NULL; PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC __glewCompressedTexSubImage2DARB = NULL; PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC __glewCompressedTexSubImage3DARB = NULL; PFNGLGETCOMPRESSEDTEXIMAGEARBPROC __glewGetCompressedTexImageARB = NULL; PFNGLGETMULTISAMPLEFVPROC __glewGetMultisamplefv = NULL; PFNGLSAMPLEMASKIPROC __glewSampleMaski = NULL; PFNGLTEXIMAGE2DMULTISAMPLEPROC __glewTexImage2DMultisample = NULL; PFNGLTEXIMAGE3DMULTISAMPLEPROC __glewTexImage3DMultisample = NULL; PFNGLTEXSTORAGE1DPROC __glewTexStorage1D = NULL; PFNGLTEXSTORAGE2DPROC __glewTexStorage2D = NULL; PFNGLTEXSTORAGE3DPROC __glewTexStorage3D = NULL; PFNGLTEXTURESTORAGE1DEXTPROC __glewTextureStorage1DEXT = NULL; PFNGLTEXTURESTORAGE2DEXTPROC __glewTextureStorage2DEXT = NULL; PFNGLTEXTURESTORAGE3DEXTPROC __glewTextureStorage3DEXT = NULL; PFNGLTEXSTORAGE2DMULTISAMPLEPROC __glewTexStorage2DMultisample = NULL; PFNGLTEXSTORAGE3DMULTISAMPLEPROC __glewTexStorage3DMultisample = NULL; PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC __glewTextureStorage2DMultisampleEXT = NULL; PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC __glewTextureStorage3DMultisampleEXT = NULL; PFNGLTEXTUREVIEWPROC __glewTextureView = NULL; PFNGLGETQUERYOBJECTI64VPROC __glewGetQueryObjecti64v = NULL; PFNGLGETQUERYOBJECTUI64VPROC __glewGetQueryObjectui64v = NULL; PFNGLQUERYCOUNTERPROC __glewQueryCounter = NULL; PFNGLBINDTRANSFORMFEEDBACKPROC __glewBindTransformFeedback = NULL; PFNGLDELETETRANSFORMFEEDBACKSPROC __glewDeleteTransformFeedbacks = NULL; PFNGLDRAWTRANSFORMFEEDBACKPROC __glewDrawTransformFeedback = NULL; PFNGLGENTRANSFORMFEEDBACKSPROC __glewGenTransformFeedbacks = NULL; PFNGLISTRANSFORMFEEDBACKPROC __glewIsTransformFeedback = NULL; PFNGLPAUSETRANSFORMFEEDBACKPROC __glewPauseTransformFeedback = NULL; PFNGLRESUMETRANSFORMFEEDBACKPROC __glewResumeTransformFeedback = NULL; PFNGLBEGINQUERYINDEXEDPROC __glewBeginQueryIndexed = NULL; PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC __glewDrawTransformFeedbackStream = NULL; PFNGLENDQUERYINDEXEDPROC __glewEndQueryIndexed = NULL; PFNGLGETQUERYINDEXEDIVPROC __glewGetQueryIndexediv = NULL; PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC __glewDrawTransformFeedbackInstanced = NULL; PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC __glewDrawTransformFeedbackStreamInstanced = NULL; PFNGLLOADTRANSPOSEMATRIXDARBPROC __glewLoadTransposeMatrixdARB = NULL; PFNGLLOADTRANSPOSEMATRIXFARBPROC __glewLoadTransposeMatrixfARB = NULL; PFNGLMULTTRANSPOSEMATRIXDARBPROC __glewMultTransposeMatrixdARB = NULL; PFNGLMULTTRANSPOSEMATRIXFARBPROC __glewMultTransposeMatrixfARB = NULL; PFNGLBINDBUFFERBASEPROC __glewBindBufferBase = NULL; PFNGLBINDBUFFERRANGEPROC __glewBindBufferRange = NULL; PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC __glewGetActiveUniformBlockName = NULL; PFNGLGETACTIVEUNIFORMBLOCKIVPROC __glewGetActiveUniformBlockiv = NULL; PFNGLGETACTIVEUNIFORMNAMEPROC __glewGetActiveUniformName = NULL; PFNGLGETACTIVEUNIFORMSIVPROC __glewGetActiveUniformsiv = NULL; PFNGLGETINTEGERI_VPROC __glewGetIntegeri_v = NULL; PFNGLGETUNIFORMBLOCKINDEXPROC __glewGetUniformBlockIndex = NULL; PFNGLGETUNIFORMINDICESPROC __glewGetUniformIndices = NULL; PFNGLUNIFORMBLOCKBINDINGPROC __glewUniformBlockBinding = NULL; PFNGLBINDVERTEXARRAYPROC __glewBindVertexArray = NULL; PFNGLDELETEVERTEXARRAYSPROC __glewDeleteVertexArrays = NULL; PFNGLGENVERTEXARRAYSPROC __glewGenVertexArrays = NULL; PFNGLISVERTEXARRAYPROC __glewIsVertexArray = NULL; PFNGLGETVERTEXATTRIBLDVPROC __glewGetVertexAttribLdv = NULL; PFNGLVERTEXATTRIBL1DPROC __glewVertexAttribL1d = NULL; PFNGLVERTEXATTRIBL1DVPROC __glewVertexAttribL1dv = NULL; PFNGLVERTEXATTRIBL2DPROC __glewVertexAttribL2d = NULL; PFNGLVERTEXATTRIBL2DVPROC __glewVertexAttribL2dv = NULL; PFNGLVERTEXATTRIBL3DPROC __glewVertexAttribL3d = NULL; PFNGLVERTEXATTRIBL3DVPROC __glewVertexAttribL3dv = NULL; PFNGLVERTEXATTRIBL4DPROC __glewVertexAttribL4d = NULL; PFNGLVERTEXATTRIBL4DVPROC __glewVertexAttribL4dv = NULL; PFNGLVERTEXATTRIBLPOINTERPROC __glewVertexAttribLPointer = NULL; PFNGLBINDVERTEXBUFFERPROC __glewBindVertexBuffer = NULL; PFNGLVERTEXATTRIBBINDINGPROC __glewVertexAttribBinding = NULL; PFNGLVERTEXATTRIBFORMATPROC __glewVertexAttribFormat = NULL; PFNGLVERTEXATTRIBIFORMATPROC __glewVertexAttribIFormat = NULL; PFNGLVERTEXATTRIBLFORMATPROC __glewVertexAttribLFormat = NULL; PFNGLVERTEXBINDINGDIVISORPROC __glewVertexBindingDivisor = NULL; PFNGLVERTEXBLENDARBPROC __glewVertexBlendARB = NULL; PFNGLWEIGHTPOINTERARBPROC __glewWeightPointerARB = NULL; PFNGLWEIGHTBVARBPROC __glewWeightbvARB = NULL; PFNGLWEIGHTDVARBPROC __glewWeightdvARB = NULL; PFNGLWEIGHTFVARBPROC __glewWeightfvARB = NULL; PFNGLWEIGHTIVARBPROC __glewWeightivARB = NULL; PFNGLWEIGHTSVARBPROC __glewWeightsvARB = NULL; PFNGLWEIGHTUBVARBPROC __glewWeightubvARB = NULL; PFNGLWEIGHTUIVARBPROC __glewWeightuivARB = NULL; PFNGLWEIGHTUSVARBPROC __glewWeightusvARB = NULL; PFNGLBINDBUFFERARBPROC __glewBindBufferARB = NULL; PFNGLBUFFERDATAARBPROC __glewBufferDataARB = NULL; PFNGLBUFFERSUBDATAARBPROC __glewBufferSubDataARB = NULL; PFNGLDELETEBUFFERSARBPROC __glewDeleteBuffersARB = NULL; PFNGLGENBUFFERSARBPROC __glewGenBuffersARB = NULL; PFNGLGETBUFFERPARAMETERIVARBPROC __glewGetBufferParameterivARB = NULL; PFNGLGETBUFFERPOINTERVARBPROC __glewGetBufferPointervARB = NULL; PFNGLGETBUFFERSUBDATAARBPROC __glewGetBufferSubDataARB = NULL; PFNGLISBUFFERARBPROC __glewIsBufferARB = NULL; PFNGLMAPBUFFERARBPROC __glewMapBufferARB = NULL; PFNGLUNMAPBUFFERARBPROC __glewUnmapBufferARB = NULL; PFNGLBINDPROGRAMARBPROC __glewBindProgramARB = NULL; PFNGLDELETEPROGRAMSARBPROC __glewDeleteProgramsARB = NULL; PFNGLDISABLEVERTEXATTRIBARRAYARBPROC __glewDisableVertexAttribArrayARB = NULL; PFNGLENABLEVERTEXATTRIBARRAYARBPROC __glewEnableVertexAttribArrayARB = NULL; PFNGLGENPROGRAMSARBPROC __glewGenProgramsARB = NULL; PFNGLGETPROGRAMENVPARAMETERDVARBPROC __glewGetProgramEnvParameterdvARB = NULL; PFNGLGETPROGRAMENVPARAMETERFVARBPROC __glewGetProgramEnvParameterfvARB = NULL; PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC __glewGetProgramLocalParameterdvARB = NULL; PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC __glewGetProgramLocalParameterfvARB = NULL; PFNGLGETPROGRAMSTRINGARBPROC __glewGetProgramStringARB = NULL; PFNGLGETPROGRAMIVARBPROC __glewGetProgramivARB = NULL; PFNGLGETVERTEXATTRIBPOINTERVARBPROC __glewGetVertexAttribPointervARB = NULL; PFNGLGETVERTEXATTRIBDVARBPROC __glewGetVertexAttribdvARB = NULL; PFNGLGETVERTEXATTRIBFVARBPROC __glewGetVertexAttribfvARB = NULL; PFNGLGETVERTEXATTRIBIVARBPROC __glewGetVertexAttribivARB = NULL; PFNGLISPROGRAMARBPROC __glewIsProgramARB = NULL; PFNGLPROGRAMENVPARAMETER4DARBPROC __glewProgramEnvParameter4dARB = NULL; PFNGLPROGRAMENVPARAMETER4DVARBPROC __glewProgramEnvParameter4dvARB = NULL; PFNGLPROGRAMENVPARAMETER4FARBPROC __glewProgramEnvParameter4fARB = NULL; PFNGLPROGRAMENVPARAMETER4FVARBPROC __glewProgramEnvParameter4fvARB = NULL; PFNGLPROGRAMLOCALPARAMETER4DARBPROC __glewProgramLocalParameter4dARB = NULL; PFNGLPROGRAMLOCALPARAMETER4DVARBPROC __glewProgramLocalParameter4dvARB = NULL; PFNGLPROGRAMLOCALPARAMETER4FARBPROC __glewProgramLocalParameter4fARB = NULL; PFNGLPROGRAMLOCALPARAMETER4FVARBPROC __glewProgramLocalParameter4fvARB = NULL; PFNGLPROGRAMSTRINGARBPROC __glewProgramStringARB = NULL; PFNGLVERTEXATTRIB1DARBPROC __glewVertexAttrib1dARB = NULL; PFNGLVERTEXATTRIB1DVARBPROC __glewVertexAttrib1dvARB = NULL; PFNGLVERTEXATTRIB1FARBPROC __glewVertexAttrib1fARB = NULL; PFNGLVERTEXATTRIB1FVARBPROC __glewVertexAttrib1fvARB = NULL; PFNGLVERTEXATTRIB1SARBPROC __glewVertexAttrib1sARB = NULL; PFNGLVERTEXATTRIB1SVARBPROC __glewVertexAttrib1svARB = NULL; PFNGLVERTEXATTRIB2DARBPROC __glewVertexAttrib2dARB = NULL; PFNGLVERTEXATTRIB2DVARBPROC __glewVertexAttrib2dvARB = NULL; PFNGLVERTEXATTRIB2FARBPROC __glewVertexAttrib2fARB = NULL; PFNGLVERTEXATTRIB2FVARBPROC __glewVertexAttrib2fvARB = NULL; PFNGLVERTEXATTRIB2SARBPROC __glewVertexAttrib2sARB = NULL; PFNGLVERTEXATTRIB2SVARBPROC __glewVertexAttrib2svARB = NULL; PFNGLVERTEXATTRIB3DARBPROC __glewVertexAttrib3dARB = NULL; PFNGLVERTEXATTRIB3DVARBPROC __glewVertexAttrib3dvARB = NULL; PFNGLVERTEXATTRIB3FARBPROC __glewVertexAttrib3fARB = NULL; PFNGLVERTEXATTRIB3FVARBPROC __glewVertexAttrib3fvARB = NULL; PFNGLVERTEXATTRIB3SARBPROC __glewVertexAttrib3sARB = NULL; PFNGLVERTEXATTRIB3SVARBPROC __glewVertexAttrib3svARB = NULL; PFNGLVERTEXATTRIB4NBVARBPROC __glewVertexAttrib4NbvARB = NULL; PFNGLVERTEXATTRIB4NIVARBPROC __glewVertexAttrib4NivARB = NULL; PFNGLVERTEXATTRIB4NSVARBPROC __glewVertexAttrib4NsvARB = NULL; PFNGLVERTEXATTRIB4NUBARBPROC __glewVertexAttrib4NubARB = NULL; PFNGLVERTEXATTRIB4NUBVARBPROC __glewVertexAttrib4NubvARB = NULL; PFNGLVERTEXATTRIB4NUIVARBPROC __glewVertexAttrib4NuivARB = NULL; PFNGLVERTEXATTRIB4NUSVARBPROC __glewVertexAttrib4NusvARB = NULL; PFNGLVERTEXATTRIB4BVARBPROC __glewVertexAttrib4bvARB = NULL; PFNGLVERTEXATTRIB4DARBPROC __glewVertexAttrib4dARB = NULL; PFNGLVERTEXATTRIB4DVARBPROC __glewVertexAttrib4dvARB = NULL; PFNGLVERTEXATTRIB4FARBPROC __glewVertexAttrib4fARB = NULL; PFNGLVERTEXATTRIB4FVARBPROC __glewVertexAttrib4fvARB = NULL; PFNGLVERTEXATTRIB4IVARBPROC __glewVertexAttrib4ivARB = NULL; PFNGLVERTEXATTRIB4SARBPROC __glewVertexAttrib4sARB = NULL; PFNGLVERTEXATTRIB4SVARBPROC __glewVertexAttrib4svARB = NULL; PFNGLVERTEXATTRIB4UBVARBPROC __glewVertexAttrib4ubvARB = NULL; PFNGLVERTEXATTRIB4UIVARBPROC __glewVertexAttrib4uivARB = NULL; PFNGLVERTEXATTRIB4USVARBPROC __glewVertexAttrib4usvARB = NULL; PFNGLVERTEXATTRIBPOINTERARBPROC __glewVertexAttribPointerARB = NULL; PFNGLBINDATTRIBLOCATIONARBPROC __glewBindAttribLocationARB = NULL; PFNGLGETACTIVEATTRIBARBPROC __glewGetActiveAttribARB = NULL; PFNGLGETATTRIBLOCATIONARBPROC __glewGetAttribLocationARB = NULL; PFNGLCOLORP3UIPROC __glewColorP3ui = NULL; PFNGLCOLORP3UIVPROC __glewColorP3uiv = NULL; PFNGLCOLORP4UIPROC __glewColorP4ui = NULL; PFNGLCOLORP4UIVPROC __glewColorP4uiv = NULL; PFNGLMULTITEXCOORDP1UIPROC __glewMultiTexCoordP1ui = NULL; PFNGLMULTITEXCOORDP1UIVPROC __glewMultiTexCoordP1uiv = NULL; PFNGLMULTITEXCOORDP2UIPROC __glewMultiTexCoordP2ui = NULL; PFNGLMULTITEXCOORDP2UIVPROC __glewMultiTexCoordP2uiv = NULL; PFNGLMULTITEXCOORDP3UIPROC __glewMultiTexCoordP3ui = NULL; PFNGLMULTITEXCOORDP3UIVPROC __glewMultiTexCoordP3uiv = NULL; PFNGLMULTITEXCOORDP4UIPROC __glewMultiTexCoordP4ui = NULL; PFNGLMULTITEXCOORDP4UIVPROC __glewMultiTexCoordP4uiv = NULL; PFNGLNORMALP3UIPROC __glewNormalP3ui = NULL; PFNGLNORMALP3UIVPROC __glewNormalP3uiv = NULL; PFNGLSECONDARYCOLORP3UIPROC __glewSecondaryColorP3ui = NULL; PFNGLSECONDARYCOLORP3UIVPROC __glewSecondaryColorP3uiv = NULL; PFNGLTEXCOORDP1UIPROC __glewTexCoordP1ui = NULL; PFNGLTEXCOORDP1UIVPROC __glewTexCoordP1uiv = NULL; PFNGLTEXCOORDP2UIPROC __glewTexCoordP2ui = NULL; PFNGLTEXCOORDP2UIVPROC __glewTexCoordP2uiv = NULL; PFNGLTEXCOORDP3UIPROC __glewTexCoordP3ui = NULL; PFNGLTEXCOORDP3UIVPROC __glewTexCoordP3uiv = NULL; PFNGLTEXCOORDP4UIPROC __glewTexCoordP4ui = NULL; PFNGLTEXCOORDP4UIVPROC __glewTexCoordP4uiv = NULL; PFNGLVERTEXATTRIBP1UIPROC __glewVertexAttribP1ui = NULL; PFNGLVERTEXATTRIBP1UIVPROC __glewVertexAttribP1uiv = NULL; PFNGLVERTEXATTRIBP2UIPROC __glewVertexAttribP2ui = NULL; PFNGLVERTEXATTRIBP2UIVPROC __glewVertexAttribP2uiv = NULL; PFNGLVERTEXATTRIBP3UIPROC __glewVertexAttribP3ui = NULL; PFNGLVERTEXATTRIBP3UIVPROC __glewVertexAttribP3uiv = NULL; PFNGLVERTEXATTRIBP4UIPROC __glewVertexAttribP4ui = NULL; PFNGLVERTEXATTRIBP4UIVPROC __glewVertexAttribP4uiv = NULL; PFNGLVERTEXP2UIPROC __glewVertexP2ui = NULL; PFNGLVERTEXP2UIVPROC __glewVertexP2uiv = NULL; PFNGLVERTEXP3UIPROC __glewVertexP3ui = NULL; PFNGLVERTEXP3UIVPROC __glewVertexP3uiv = NULL; PFNGLVERTEXP4UIPROC __glewVertexP4ui = NULL; PFNGLVERTEXP4UIVPROC __glewVertexP4uiv = NULL; PFNGLDEPTHRANGEARRAYVPROC __glewDepthRangeArrayv = NULL; PFNGLDEPTHRANGEINDEXEDPROC __glewDepthRangeIndexed = NULL; PFNGLGETDOUBLEI_VPROC __glewGetDoublei_v = NULL; PFNGLGETFLOATI_VPROC __glewGetFloati_v = NULL; PFNGLSCISSORARRAYVPROC __glewScissorArrayv = NULL; PFNGLSCISSORINDEXEDPROC __glewScissorIndexed = NULL; PFNGLSCISSORINDEXEDVPROC __glewScissorIndexedv = NULL; PFNGLVIEWPORTARRAYVPROC __glewViewportArrayv = NULL; PFNGLVIEWPORTINDEXEDFPROC __glewViewportIndexedf = NULL; PFNGLVIEWPORTINDEXEDFVPROC __glewViewportIndexedfv = NULL; PFNGLWINDOWPOS2DARBPROC __glewWindowPos2dARB = NULL; PFNGLWINDOWPOS2DVARBPROC __glewWindowPos2dvARB = NULL; PFNGLWINDOWPOS2FARBPROC __glewWindowPos2fARB = NULL; PFNGLWINDOWPOS2FVARBPROC __glewWindowPos2fvARB = NULL; PFNGLWINDOWPOS2IARBPROC __glewWindowPos2iARB = NULL; PFNGLWINDOWPOS2IVARBPROC __glewWindowPos2ivARB = NULL; PFNGLWINDOWPOS2SARBPROC __glewWindowPos2sARB = NULL; PFNGLWINDOWPOS2SVARBPROC __glewWindowPos2svARB = NULL; PFNGLWINDOWPOS3DARBPROC __glewWindowPos3dARB = NULL; PFNGLWINDOWPOS3DVARBPROC __glewWindowPos3dvARB = NULL; PFNGLWINDOWPOS3FARBPROC __glewWindowPos3fARB = NULL; PFNGLWINDOWPOS3FVARBPROC __glewWindowPos3fvARB = NULL; PFNGLWINDOWPOS3IARBPROC __glewWindowPos3iARB = NULL; PFNGLWINDOWPOS3IVARBPROC __glewWindowPos3ivARB = NULL; PFNGLWINDOWPOS3SARBPROC __glewWindowPos3sARB = NULL; PFNGLWINDOWPOS3SVARBPROC __glewWindowPos3svARB = NULL; PFNGLDRAWBUFFERSATIPROC __glewDrawBuffersATI = NULL; PFNGLDRAWELEMENTARRAYATIPROC __glewDrawElementArrayATI = NULL; PFNGLDRAWRANGEELEMENTARRAYATIPROC __glewDrawRangeElementArrayATI = NULL; PFNGLELEMENTPOINTERATIPROC __glewElementPointerATI = NULL; PFNGLGETTEXBUMPPARAMETERFVATIPROC __glewGetTexBumpParameterfvATI = NULL; PFNGLGETTEXBUMPPARAMETERIVATIPROC __glewGetTexBumpParameterivATI = NULL; PFNGLTEXBUMPPARAMETERFVATIPROC __glewTexBumpParameterfvATI = NULL; PFNGLTEXBUMPPARAMETERIVATIPROC __glewTexBumpParameterivATI = NULL; PFNGLALPHAFRAGMENTOP1ATIPROC __glewAlphaFragmentOp1ATI = NULL; PFNGLALPHAFRAGMENTOP2ATIPROC __glewAlphaFragmentOp2ATI = NULL; PFNGLALPHAFRAGMENTOP3ATIPROC __glewAlphaFragmentOp3ATI = NULL; PFNGLBEGINFRAGMENTSHADERATIPROC __glewBeginFragmentShaderATI = NULL; PFNGLBINDFRAGMENTSHADERATIPROC __glewBindFragmentShaderATI = NULL; PFNGLCOLORFRAGMENTOP1ATIPROC __glewColorFragmentOp1ATI = NULL; PFNGLCOLORFRAGMENTOP2ATIPROC __glewColorFragmentOp2ATI = NULL; PFNGLCOLORFRAGMENTOP3ATIPROC __glewColorFragmentOp3ATI = NULL; PFNGLDELETEFRAGMENTSHADERATIPROC __glewDeleteFragmentShaderATI = NULL; PFNGLENDFRAGMENTSHADERATIPROC __glewEndFragmentShaderATI = NULL; PFNGLGENFRAGMENTSHADERSATIPROC __glewGenFragmentShadersATI = NULL; PFNGLPASSTEXCOORDATIPROC __glewPassTexCoordATI = NULL; PFNGLSAMPLEMAPATIPROC __glewSampleMapATI = NULL; PFNGLSETFRAGMENTSHADERCONSTANTATIPROC __glewSetFragmentShaderConstantATI = NULL; PFNGLMAPOBJECTBUFFERATIPROC __glewMapObjectBufferATI = NULL; PFNGLUNMAPOBJECTBUFFERATIPROC __glewUnmapObjectBufferATI = NULL; PFNGLPNTRIANGLESFATIPROC __glewPNTrianglesfATI = NULL; PFNGLPNTRIANGLESIATIPROC __glewPNTrianglesiATI = NULL; PFNGLSTENCILFUNCSEPARATEATIPROC __glewStencilFuncSeparateATI = NULL; PFNGLSTENCILOPSEPARATEATIPROC __glewStencilOpSeparateATI = NULL; PFNGLARRAYOBJECTATIPROC __glewArrayObjectATI = NULL; PFNGLFREEOBJECTBUFFERATIPROC __glewFreeObjectBufferATI = NULL; PFNGLGETARRAYOBJECTFVATIPROC __glewGetArrayObjectfvATI = NULL; PFNGLGETARRAYOBJECTIVATIPROC __glewGetArrayObjectivATI = NULL; PFNGLGETOBJECTBUFFERFVATIPROC __glewGetObjectBufferfvATI = NULL; PFNGLGETOBJECTBUFFERIVATIPROC __glewGetObjectBufferivATI = NULL; PFNGLGETVARIANTARRAYOBJECTFVATIPROC __glewGetVariantArrayObjectfvATI = NULL; PFNGLGETVARIANTARRAYOBJECTIVATIPROC __glewGetVariantArrayObjectivATI = NULL; PFNGLISOBJECTBUFFERATIPROC __glewIsObjectBufferATI = NULL; PFNGLNEWOBJECTBUFFERATIPROC __glewNewObjectBufferATI = NULL; PFNGLUPDATEOBJECTBUFFERATIPROC __glewUpdateObjectBufferATI = NULL; PFNGLVARIANTARRAYOBJECTATIPROC __glewVariantArrayObjectATI = NULL; PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC __glewGetVertexAttribArrayObjectfvATI = NULL; PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC __glewGetVertexAttribArrayObjectivATI = NULL; PFNGLVERTEXATTRIBARRAYOBJECTATIPROC __glewVertexAttribArrayObjectATI = NULL; PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC __glewClientActiveVertexStreamATI = NULL; PFNGLNORMALSTREAM3BATIPROC __glewNormalStream3bATI = NULL; PFNGLNORMALSTREAM3BVATIPROC __glewNormalStream3bvATI = NULL; PFNGLNORMALSTREAM3DATIPROC __glewNormalStream3dATI = NULL; PFNGLNORMALSTREAM3DVATIPROC __glewNormalStream3dvATI = NULL; PFNGLNORMALSTREAM3FATIPROC __glewNormalStream3fATI = NULL; PFNGLNORMALSTREAM3FVATIPROC __glewNormalStream3fvATI = NULL; PFNGLNORMALSTREAM3IATIPROC __glewNormalStream3iATI = NULL; PFNGLNORMALSTREAM3IVATIPROC __glewNormalStream3ivATI = NULL; PFNGLNORMALSTREAM3SATIPROC __glewNormalStream3sATI = NULL; PFNGLNORMALSTREAM3SVATIPROC __glewNormalStream3svATI = NULL; PFNGLVERTEXBLENDENVFATIPROC __glewVertexBlendEnvfATI = NULL; PFNGLVERTEXBLENDENVIATIPROC __glewVertexBlendEnviATI = NULL; PFNGLVERTEXSTREAM1DATIPROC __glewVertexStream1dATI = NULL; PFNGLVERTEXSTREAM1DVATIPROC __glewVertexStream1dvATI = NULL; PFNGLVERTEXSTREAM1FATIPROC __glewVertexStream1fATI = NULL; PFNGLVERTEXSTREAM1FVATIPROC __glewVertexStream1fvATI = NULL; PFNGLVERTEXSTREAM1IATIPROC __glewVertexStream1iATI = NULL; PFNGLVERTEXSTREAM1IVATIPROC __glewVertexStream1ivATI = NULL; PFNGLVERTEXSTREAM1SATIPROC __glewVertexStream1sATI = NULL; PFNGLVERTEXSTREAM1SVATIPROC __glewVertexStream1svATI = NULL; PFNGLVERTEXSTREAM2DATIPROC __glewVertexStream2dATI = NULL; PFNGLVERTEXSTREAM2DVATIPROC __glewVertexStream2dvATI = NULL; PFNGLVERTEXSTREAM2FATIPROC __glewVertexStream2fATI = NULL; PFNGLVERTEXSTREAM2FVATIPROC __glewVertexStream2fvATI = NULL; PFNGLVERTEXSTREAM2IATIPROC __glewVertexStream2iATI = NULL; PFNGLVERTEXSTREAM2IVATIPROC __glewVertexStream2ivATI = NULL; PFNGLVERTEXSTREAM2SATIPROC __glewVertexStream2sATI = NULL; PFNGLVERTEXSTREAM2SVATIPROC __glewVertexStream2svATI = NULL; PFNGLVERTEXSTREAM3DATIPROC __glewVertexStream3dATI = NULL; PFNGLVERTEXSTREAM3DVATIPROC __glewVertexStream3dvATI = NULL; PFNGLVERTEXSTREAM3FATIPROC __glewVertexStream3fATI = NULL; PFNGLVERTEXSTREAM3FVATIPROC __glewVertexStream3fvATI = NULL; PFNGLVERTEXSTREAM3IATIPROC __glewVertexStream3iATI = NULL; PFNGLVERTEXSTREAM3IVATIPROC __glewVertexStream3ivATI = NULL; PFNGLVERTEXSTREAM3SATIPROC __glewVertexStream3sATI = NULL; PFNGLVERTEXSTREAM3SVATIPROC __glewVertexStream3svATI = NULL; PFNGLVERTEXSTREAM4DATIPROC __glewVertexStream4dATI = NULL; PFNGLVERTEXSTREAM4DVATIPROC __glewVertexStream4dvATI = NULL; PFNGLVERTEXSTREAM4FATIPROC __glewVertexStream4fATI = NULL; PFNGLVERTEXSTREAM4FVATIPROC __glewVertexStream4fvATI = NULL; PFNGLVERTEXSTREAM4IATIPROC __glewVertexStream4iATI = NULL; PFNGLVERTEXSTREAM4IVATIPROC __glewVertexStream4ivATI = NULL; PFNGLVERTEXSTREAM4SATIPROC __glewVertexStream4sATI = NULL; PFNGLVERTEXSTREAM4SVATIPROC __glewVertexStream4svATI = NULL; PFNGLGETUNIFORMBUFFERSIZEEXTPROC __glewGetUniformBufferSizeEXT = NULL; PFNGLGETUNIFORMOFFSETEXTPROC __glewGetUniformOffsetEXT = NULL; PFNGLUNIFORMBUFFEREXTPROC __glewUniformBufferEXT = NULL; PFNGLBLENDCOLOREXTPROC __glewBlendColorEXT = NULL; PFNGLBLENDEQUATIONSEPARATEEXTPROC __glewBlendEquationSeparateEXT = NULL; PFNGLBLENDFUNCSEPARATEEXTPROC __glewBlendFuncSeparateEXT = NULL; PFNGLBLENDEQUATIONEXTPROC __glewBlendEquationEXT = NULL; PFNGLCOLORSUBTABLEEXTPROC __glewColorSubTableEXT = NULL; PFNGLCOPYCOLORSUBTABLEEXTPROC __glewCopyColorSubTableEXT = NULL; PFNGLLOCKARRAYSEXTPROC __glewLockArraysEXT = NULL; PFNGLUNLOCKARRAYSEXTPROC __glewUnlockArraysEXT = NULL; PFNGLCONVOLUTIONFILTER1DEXTPROC __glewConvolutionFilter1DEXT = NULL; PFNGLCONVOLUTIONFILTER2DEXTPROC __glewConvolutionFilter2DEXT = NULL; PFNGLCONVOLUTIONPARAMETERFEXTPROC __glewConvolutionParameterfEXT = NULL; PFNGLCONVOLUTIONPARAMETERFVEXTPROC __glewConvolutionParameterfvEXT = NULL; PFNGLCONVOLUTIONPARAMETERIEXTPROC __glewConvolutionParameteriEXT = NULL; PFNGLCONVOLUTIONPARAMETERIVEXTPROC __glewConvolutionParameterivEXT = NULL; PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC __glewCopyConvolutionFilter1DEXT = NULL; PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC __glewCopyConvolutionFilter2DEXT = NULL; PFNGLGETCONVOLUTIONFILTEREXTPROC __glewGetConvolutionFilterEXT = NULL; PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC __glewGetConvolutionParameterfvEXT = NULL; PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC __glewGetConvolutionParameterivEXT = NULL; PFNGLGETSEPARABLEFILTEREXTPROC __glewGetSeparableFilterEXT = NULL; PFNGLSEPARABLEFILTER2DEXTPROC __glewSeparableFilter2DEXT = NULL; PFNGLBINORMALPOINTEREXTPROC __glewBinormalPointerEXT = NULL; PFNGLTANGENTPOINTEREXTPROC __glewTangentPointerEXT = NULL; PFNGLCOPYTEXIMAGE1DEXTPROC __glewCopyTexImage1DEXT = NULL; PFNGLCOPYTEXIMAGE2DEXTPROC __glewCopyTexImage2DEXT = NULL; PFNGLCOPYTEXSUBIMAGE1DEXTPROC __glewCopyTexSubImage1DEXT = NULL; PFNGLCOPYTEXSUBIMAGE2DEXTPROC __glewCopyTexSubImage2DEXT = NULL; PFNGLCOPYTEXSUBIMAGE3DEXTPROC __glewCopyTexSubImage3DEXT = NULL; PFNGLCULLPARAMETERDVEXTPROC __glewCullParameterdvEXT = NULL; PFNGLCULLPARAMETERFVEXTPROC __glewCullParameterfvEXT = NULL; PFNGLINSERTEVENTMARKEREXTPROC __glewInsertEventMarkerEXT = NULL; PFNGLPOPGROUPMARKEREXTPROC __glewPopGroupMarkerEXT = NULL; PFNGLPUSHGROUPMARKEREXTPROC __glewPushGroupMarkerEXT = NULL; PFNGLDEPTHBOUNDSEXTPROC __glewDepthBoundsEXT = NULL; PFNGLBINDMULTITEXTUREEXTPROC __glewBindMultiTextureEXT = NULL; PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC __glewCheckNamedFramebufferStatusEXT = NULL; PFNGLCLIENTATTRIBDEFAULTEXTPROC __glewClientAttribDefaultEXT = NULL; PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC __glewCompressedMultiTexImage1DEXT = NULL; PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC __glewCompressedMultiTexImage2DEXT = NULL; PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC __glewCompressedMultiTexImage3DEXT = NULL; PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC __glewCompressedMultiTexSubImage1DEXT = NULL; PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC __glewCompressedMultiTexSubImage2DEXT = NULL; PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC __glewCompressedMultiTexSubImage3DEXT = NULL; PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC __glewCompressedTextureImage1DEXT = NULL; PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC __glewCompressedTextureImage2DEXT = NULL; PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC __glewCompressedTextureImage3DEXT = NULL; PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC __glewCompressedTextureSubImage1DEXT = NULL; PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC __glewCompressedTextureSubImage2DEXT = NULL; PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC __glewCompressedTextureSubImage3DEXT = NULL; PFNGLCOPYMULTITEXIMAGE1DEXTPROC __glewCopyMultiTexImage1DEXT = NULL; PFNGLCOPYMULTITEXIMAGE2DEXTPROC __glewCopyMultiTexImage2DEXT = NULL; PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC __glewCopyMultiTexSubImage1DEXT = NULL; PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC __glewCopyMultiTexSubImage2DEXT = NULL; PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC __glewCopyMultiTexSubImage3DEXT = NULL; PFNGLCOPYTEXTUREIMAGE1DEXTPROC __glewCopyTextureImage1DEXT = NULL; PFNGLCOPYTEXTUREIMAGE2DEXTPROC __glewCopyTextureImage2DEXT = NULL; PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC __glewCopyTextureSubImage1DEXT = NULL; PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC __glewCopyTextureSubImage2DEXT = NULL; PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC __glewCopyTextureSubImage3DEXT = NULL; PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC __glewDisableClientStateIndexedEXT = NULL; PFNGLDISABLECLIENTSTATEIEXTPROC __glewDisableClientStateiEXT = NULL; PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC __glewDisableVertexArrayAttribEXT = NULL; PFNGLDISABLEVERTEXARRAYEXTPROC __glewDisableVertexArrayEXT = NULL; PFNGLENABLECLIENTSTATEINDEXEDEXTPROC __glewEnableClientStateIndexedEXT = NULL; PFNGLENABLECLIENTSTATEIEXTPROC __glewEnableClientStateiEXT = NULL; PFNGLENABLEVERTEXARRAYATTRIBEXTPROC __glewEnableVertexArrayAttribEXT = NULL; PFNGLENABLEVERTEXARRAYEXTPROC __glewEnableVertexArrayEXT = NULL; PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC __glewFlushMappedNamedBufferRangeEXT = NULL; PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC __glewFramebufferDrawBufferEXT = NULL; PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC __glewFramebufferDrawBuffersEXT = NULL; PFNGLFRAMEBUFFERREADBUFFEREXTPROC __glewFramebufferReadBufferEXT = NULL; PFNGLGENERATEMULTITEXMIPMAPEXTPROC __glewGenerateMultiTexMipmapEXT = NULL; PFNGLGENERATETEXTUREMIPMAPEXTPROC __glewGenerateTextureMipmapEXT = NULL; PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC __glewGetCompressedMultiTexImageEXT = NULL; PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC __glewGetCompressedTextureImageEXT = NULL; PFNGLGETDOUBLEINDEXEDVEXTPROC __glewGetDoubleIndexedvEXT = NULL; PFNGLGETDOUBLEI_VEXTPROC __glewGetDoublei_vEXT = NULL; PFNGLGETFLOATINDEXEDVEXTPROC __glewGetFloatIndexedvEXT = NULL; PFNGLGETFLOATI_VEXTPROC __glewGetFloati_vEXT = NULL; PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC __glewGetFramebufferParameterivEXT = NULL; PFNGLGETMULTITEXENVFVEXTPROC __glewGetMultiTexEnvfvEXT = NULL; PFNGLGETMULTITEXENVIVEXTPROC __glewGetMultiTexEnvivEXT = NULL; PFNGLGETMULTITEXGENDVEXTPROC __glewGetMultiTexGendvEXT = NULL; PFNGLGETMULTITEXGENFVEXTPROC __glewGetMultiTexGenfvEXT = NULL; PFNGLGETMULTITEXGENIVEXTPROC __glewGetMultiTexGenivEXT = NULL; PFNGLGETMULTITEXIMAGEEXTPROC __glewGetMultiTexImageEXT = NULL; PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC __glewGetMultiTexLevelParameterfvEXT = NULL; PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC __glewGetMultiTexLevelParameterivEXT = NULL; PFNGLGETMULTITEXPARAMETERIIVEXTPROC __glewGetMultiTexParameterIivEXT = NULL; PFNGLGETMULTITEXPARAMETERIUIVEXTPROC __glewGetMultiTexParameterIuivEXT = NULL; PFNGLGETMULTITEXPARAMETERFVEXTPROC __glewGetMultiTexParameterfvEXT = NULL; PFNGLGETMULTITEXPARAMETERIVEXTPROC __glewGetMultiTexParameterivEXT = NULL; PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC __glewGetNamedBufferParameterivEXT = NULL; PFNGLGETNAMEDBUFFERPOINTERVEXTPROC __glewGetNamedBufferPointervEXT = NULL; PFNGLGETNAMEDBUFFERSUBDATAEXTPROC __glewGetNamedBufferSubDataEXT = NULL; PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC __glewGetNamedFramebufferAttachmentParameterivEXT = NULL; PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC __glewGetNamedProgramLocalParameterIivEXT = NULL; PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC __glewGetNamedProgramLocalParameterIuivEXT = NULL; PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC __glewGetNamedProgramLocalParameterdvEXT = NULL; PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC __glewGetNamedProgramLocalParameterfvEXT = NULL; PFNGLGETNAMEDPROGRAMSTRINGEXTPROC __glewGetNamedProgramStringEXT = NULL; PFNGLGETNAMEDPROGRAMIVEXTPROC __glewGetNamedProgramivEXT = NULL; PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC __glewGetNamedRenderbufferParameterivEXT = NULL; PFNGLGETPOINTERINDEXEDVEXTPROC __glewGetPointerIndexedvEXT = NULL; PFNGLGETPOINTERI_VEXTPROC __glewGetPointeri_vEXT = NULL; PFNGLGETTEXTUREIMAGEEXTPROC __glewGetTextureImageEXT = NULL; PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC __glewGetTextureLevelParameterfvEXT = NULL; PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC __glewGetTextureLevelParameterivEXT = NULL; PFNGLGETTEXTUREPARAMETERIIVEXTPROC __glewGetTextureParameterIivEXT = NULL; PFNGLGETTEXTUREPARAMETERIUIVEXTPROC __glewGetTextureParameterIuivEXT = NULL; PFNGLGETTEXTUREPARAMETERFVEXTPROC __glewGetTextureParameterfvEXT = NULL; PFNGLGETTEXTUREPARAMETERIVEXTPROC __glewGetTextureParameterivEXT = NULL; PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC __glewGetVertexArrayIntegeri_vEXT = NULL; PFNGLGETVERTEXARRAYINTEGERVEXTPROC __glewGetVertexArrayIntegervEXT = NULL; PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC __glewGetVertexArrayPointeri_vEXT = NULL; PFNGLGETVERTEXARRAYPOINTERVEXTPROC __glewGetVertexArrayPointervEXT = NULL; PFNGLMAPNAMEDBUFFEREXTPROC __glewMapNamedBufferEXT = NULL; PFNGLMAPNAMEDBUFFERRANGEEXTPROC __glewMapNamedBufferRangeEXT = NULL; PFNGLMATRIXFRUSTUMEXTPROC __glewMatrixFrustumEXT = NULL; PFNGLMATRIXLOADIDENTITYEXTPROC __glewMatrixLoadIdentityEXT = NULL; PFNGLMATRIXLOADTRANSPOSEDEXTPROC __glewMatrixLoadTransposedEXT = NULL; PFNGLMATRIXLOADTRANSPOSEFEXTPROC __glewMatrixLoadTransposefEXT = NULL; PFNGLMATRIXLOADDEXTPROC __glewMatrixLoaddEXT = NULL; PFNGLMATRIXLOADFEXTPROC __glewMatrixLoadfEXT = NULL; PFNGLMATRIXMULTTRANSPOSEDEXTPROC __glewMatrixMultTransposedEXT = NULL; PFNGLMATRIXMULTTRANSPOSEFEXTPROC __glewMatrixMultTransposefEXT = NULL; PFNGLMATRIXMULTDEXTPROC __glewMatrixMultdEXT = NULL; PFNGLMATRIXMULTFEXTPROC __glewMatrixMultfEXT = NULL; PFNGLMATRIXORTHOEXTPROC __glewMatrixOrthoEXT = NULL; PFNGLMATRIXPOPEXTPROC __glewMatrixPopEXT = NULL; PFNGLMATRIXPUSHEXTPROC __glewMatrixPushEXT = NULL; PFNGLMATRIXROTATEDEXTPROC __glewMatrixRotatedEXT = NULL; PFNGLMATRIXROTATEFEXTPROC __glewMatrixRotatefEXT = NULL; PFNGLMATRIXSCALEDEXTPROC __glewMatrixScaledEXT = NULL; PFNGLMATRIXSCALEFEXTPROC __glewMatrixScalefEXT = NULL; PFNGLMATRIXTRANSLATEDEXTPROC __glewMatrixTranslatedEXT = NULL; PFNGLMATRIXTRANSLATEFEXTPROC __glewMatrixTranslatefEXT = NULL; PFNGLMULTITEXBUFFEREXTPROC __glewMultiTexBufferEXT = NULL; PFNGLMULTITEXCOORDPOINTEREXTPROC __glewMultiTexCoordPointerEXT = NULL; PFNGLMULTITEXENVFEXTPROC __glewMultiTexEnvfEXT = NULL; PFNGLMULTITEXENVFVEXTPROC __glewMultiTexEnvfvEXT = NULL; PFNGLMULTITEXENVIEXTPROC __glewMultiTexEnviEXT = NULL; PFNGLMULTITEXENVIVEXTPROC __glewMultiTexEnvivEXT = NULL; PFNGLMULTITEXGENDEXTPROC __glewMultiTexGendEXT = NULL; PFNGLMULTITEXGENDVEXTPROC __glewMultiTexGendvEXT = NULL; PFNGLMULTITEXGENFEXTPROC __glewMultiTexGenfEXT = NULL; PFNGLMULTITEXGENFVEXTPROC __glewMultiTexGenfvEXT = NULL; PFNGLMULTITEXGENIEXTPROC __glewMultiTexGeniEXT = NULL; PFNGLMULTITEXGENIVEXTPROC __glewMultiTexGenivEXT = NULL; PFNGLMULTITEXIMAGE1DEXTPROC __glewMultiTexImage1DEXT = NULL; PFNGLMULTITEXIMAGE2DEXTPROC __glewMultiTexImage2DEXT = NULL; PFNGLMULTITEXIMAGE3DEXTPROC __glewMultiTexImage3DEXT = NULL; PFNGLMULTITEXPARAMETERIIVEXTPROC __glewMultiTexParameterIivEXT = NULL; PFNGLMULTITEXPARAMETERIUIVEXTPROC __glewMultiTexParameterIuivEXT = NULL; PFNGLMULTITEXPARAMETERFEXTPROC __glewMultiTexParameterfEXT = NULL; PFNGLMULTITEXPARAMETERFVEXTPROC __glewMultiTexParameterfvEXT = NULL; PFNGLMULTITEXPARAMETERIEXTPROC __glewMultiTexParameteriEXT = NULL; PFNGLMULTITEXPARAMETERIVEXTPROC __glewMultiTexParameterivEXT = NULL; PFNGLMULTITEXRENDERBUFFEREXTPROC __glewMultiTexRenderbufferEXT = NULL; PFNGLMULTITEXSUBIMAGE1DEXTPROC __glewMultiTexSubImage1DEXT = NULL; PFNGLMULTITEXSUBIMAGE2DEXTPROC __glewMultiTexSubImage2DEXT = NULL; PFNGLMULTITEXSUBIMAGE3DEXTPROC __glewMultiTexSubImage3DEXT = NULL; PFNGLNAMEDBUFFERDATAEXTPROC __glewNamedBufferDataEXT = NULL; PFNGLNAMEDBUFFERSUBDATAEXTPROC __glewNamedBufferSubDataEXT = NULL; PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC __glewNamedCopyBufferSubDataEXT = NULL; PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC __glewNamedFramebufferRenderbufferEXT = NULL; PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC __glewNamedFramebufferTexture1DEXT = NULL; PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC __glewNamedFramebufferTexture2DEXT = NULL; PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC __glewNamedFramebufferTexture3DEXT = NULL; PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC __glewNamedFramebufferTextureEXT = NULL; PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC __glewNamedFramebufferTextureFaceEXT = NULL; PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC __glewNamedFramebufferTextureLayerEXT = NULL; PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC __glewNamedProgramLocalParameter4dEXT = NULL; PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC __glewNamedProgramLocalParameter4dvEXT = NULL; PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC __glewNamedProgramLocalParameter4fEXT = NULL; PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC __glewNamedProgramLocalParameter4fvEXT = NULL; PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC __glewNamedProgramLocalParameterI4iEXT = NULL; PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC __glewNamedProgramLocalParameterI4ivEXT = NULL; PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC __glewNamedProgramLocalParameterI4uiEXT = NULL; PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC __glewNamedProgramLocalParameterI4uivEXT = NULL; PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC __glewNamedProgramLocalParameters4fvEXT = NULL; PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC __glewNamedProgramLocalParametersI4ivEXT = NULL; PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC __glewNamedProgramLocalParametersI4uivEXT = NULL; PFNGLNAMEDPROGRAMSTRINGEXTPROC __glewNamedProgramStringEXT = NULL; PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC __glewNamedRenderbufferStorageEXT = NULL; PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC __glewNamedRenderbufferStorageMultisampleCoverageEXT = NULL; PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC __glewNamedRenderbufferStorageMultisampleEXT = NULL; PFNGLPROGRAMUNIFORM1DEXTPROC __glewProgramUniform1dEXT = NULL; PFNGLPROGRAMUNIFORM1DVEXTPROC __glewProgramUniform1dvEXT = NULL; PFNGLPROGRAMUNIFORM1FEXTPROC __glewProgramUniform1fEXT = NULL; PFNGLPROGRAMUNIFORM1FVEXTPROC __glewProgramUniform1fvEXT = NULL; PFNGLPROGRAMUNIFORM1IEXTPROC __glewProgramUniform1iEXT = NULL; PFNGLPROGRAMUNIFORM1IVEXTPROC __glewProgramUniform1ivEXT = NULL; PFNGLPROGRAMUNIFORM1UIEXTPROC __glewProgramUniform1uiEXT = NULL; PFNGLPROGRAMUNIFORM1UIVEXTPROC __glewProgramUniform1uivEXT = NULL; PFNGLPROGRAMUNIFORM2DEXTPROC __glewProgramUniform2dEXT = NULL; PFNGLPROGRAMUNIFORM2DVEXTPROC __glewProgramUniform2dvEXT = NULL; PFNGLPROGRAMUNIFORM2FEXTPROC __glewProgramUniform2fEXT = NULL; PFNGLPROGRAMUNIFORM2FVEXTPROC __glewProgramUniform2fvEXT = NULL; PFNGLPROGRAMUNIFORM2IEXTPROC __glewProgramUniform2iEXT = NULL; PFNGLPROGRAMUNIFORM2IVEXTPROC __glewProgramUniform2ivEXT = NULL; PFNGLPROGRAMUNIFORM2UIEXTPROC __glewProgramUniform2uiEXT = NULL; PFNGLPROGRAMUNIFORM2UIVEXTPROC __glewProgramUniform2uivEXT = NULL; PFNGLPROGRAMUNIFORM3DEXTPROC __glewProgramUniform3dEXT = NULL; PFNGLPROGRAMUNIFORM3DVEXTPROC __glewProgramUniform3dvEXT = NULL; PFNGLPROGRAMUNIFORM3FEXTPROC __glewProgramUniform3fEXT = NULL; PFNGLPROGRAMUNIFORM3FVEXTPROC __glewProgramUniform3fvEXT = NULL; PFNGLPROGRAMUNIFORM3IEXTPROC __glewProgramUniform3iEXT = NULL; PFNGLPROGRAMUNIFORM3IVEXTPROC __glewProgramUniform3ivEXT = NULL; PFNGLPROGRAMUNIFORM3UIEXTPROC __glewProgramUniform3uiEXT = NULL; PFNGLPROGRAMUNIFORM3UIVEXTPROC __glewProgramUniform3uivEXT = NULL; PFNGLPROGRAMUNIFORM4DEXTPROC __glewProgramUniform4dEXT = NULL; PFNGLPROGRAMUNIFORM4DVEXTPROC __glewProgramUniform4dvEXT = NULL; PFNGLPROGRAMUNIFORM4FEXTPROC __glewProgramUniform4fEXT = NULL; PFNGLPROGRAMUNIFORM4FVEXTPROC __glewProgramUniform4fvEXT = NULL; PFNGLPROGRAMUNIFORM4IEXTPROC __glewProgramUniform4iEXT = NULL; PFNGLPROGRAMUNIFORM4IVEXTPROC __glewProgramUniform4ivEXT = NULL; PFNGLPROGRAMUNIFORM4UIEXTPROC __glewProgramUniform4uiEXT = NULL; PFNGLPROGRAMUNIFORM4UIVEXTPROC __glewProgramUniform4uivEXT = NULL; PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC __glewProgramUniformMatrix2dvEXT = NULL; PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC __glewProgramUniformMatrix2fvEXT = NULL; PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC __glewProgramUniformMatrix2x3dvEXT = NULL; PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC __glewProgramUniformMatrix2x3fvEXT = NULL; PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC __glewProgramUniformMatrix2x4dvEXT = NULL; PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC __glewProgramUniformMatrix2x4fvEXT = NULL; PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC __glewProgramUniformMatrix3dvEXT = NULL; PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC __glewProgramUniformMatrix3fvEXT = NULL; PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC __glewProgramUniformMatrix3x2dvEXT = NULL; PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC __glewProgramUniformMatrix3x2fvEXT = NULL; PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC __glewProgramUniformMatrix3x4dvEXT = NULL; PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC __glewProgramUniformMatrix3x4fvEXT = NULL; PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC __glewProgramUniformMatrix4dvEXT = NULL; PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC __glewProgramUniformMatrix4fvEXT = NULL; PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC __glewProgramUniformMatrix4x2dvEXT = NULL; PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC __glewProgramUniformMatrix4x2fvEXT = NULL; PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC __glewProgramUniformMatrix4x3dvEXT = NULL; PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC __glewProgramUniformMatrix4x3fvEXT = NULL; PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC __glewPushClientAttribDefaultEXT = NULL; PFNGLTEXTUREBUFFEREXTPROC __glewTextureBufferEXT = NULL; PFNGLTEXTUREIMAGE1DEXTPROC __glewTextureImage1DEXT = NULL; PFNGLTEXTUREIMAGE2DEXTPROC __glewTextureImage2DEXT = NULL; PFNGLTEXTUREIMAGE3DEXTPROC __glewTextureImage3DEXT = NULL; PFNGLTEXTUREPARAMETERIIVEXTPROC __glewTextureParameterIivEXT = NULL; PFNGLTEXTUREPARAMETERIUIVEXTPROC __glewTextureParameterIuivEXT = NULL; PFNGLTEXTUREPARAMETERFEXTPROC __glewTextureParameterfEXT = NULL; PFNGLTEXTUREPARAMETERFVEXTPROC __glewTextureParameterfvEXT = NULL; PFNGLTEXTUREPARAMETERIEXTPROC __glewTextureParameteriEXT = NULL; PFNGLTEXTUREPARAMETERIVEXTPROC __glewTextureParameterivEXT = NULL; PFNGLTEXTURERENDERBUFFEREXTPROC __glewTextureRenderbufferEXT = NULL; PFNGLTEXTURESUBIMAGE1DEXTPROC __glewTextureSubImage1DEXT = NULL; PFNGLTEXTURESUBIMAGE2DEXTPROC __glewTextureSubImage2DEXT = NULL; PFNGLTEXTURESUBIMAGE3DEXTPROC __glewTextureSubImage3DEXT = NULL; PFNGLUNMAPNAMEDBUFFEREXTPROC __glewUnmapNamedBufferEXT = NULL; PFNGLVERTEXARRAYCOLOROFFSETEXTPROC __glewVertexArrayColorOffsetEXT = NULL; PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC __glewVertexArrayEdgeFlagOffsetEXT = NULL; PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC __glewVertexArrayFogCoordOffsetEXT = NULL; PFNGLVERTEXARRAYINDEXOFFSETEXTPROC __glewVertexArrayIndexOffsetEXT = NULL; PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC __glewVertexArrayMultiTexCoordOffsetEXT = NULL; PFNGLVERTEXARRAYNORMALOFFSETEXTPROC __glewVertexArrayNormalOffsetEXT = NULL; PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC __glewVertexArraySecondaryColorOffsetEXT = NULL; PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC __glewVertexArrayTexCoordOffsetEXT = NULL; PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC __glewVertexArrayVertexAttribIOffsetEXT = NULL; PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC __glewVertexArrayVertexAttribOffsetEXT = NULL; PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC __glewVertexArrayVertexOffsetEXT = NULL; PFNGLCOLORMASKINDEXEDEXTPROC __glewColorMaskIndexedEXT = NULL; PFNGLDISABLEINDEXEDEXTPROC __glewDisableIndexedEXT = NULL; PFNGLENABLEINDEXEDEXTPROC __glewEnableIndexedEXT = NULL; PFNGLGETBOOLEANINDEXEDVEXTPROC __glewGetBooleanIndexedvEXT = NULL; PFNGLGETINTEGERINDEXEDVEXTPROC __glewGetIntegerIndexedvEXT = NULL; PFNGLISENABLEDINDEXEDEXTPROC __glewIsEnabledIndexedEXT = NULL; PFNGLDRAWARRAYSINSTANCEDEXTPROC __glewDrawArraysInstancedEXT = NULL; PFNGLDRAWELEMENTSINSTANCEDEXTPROC __glewDrawElementsInstancedEXT = NULL; PFNGLDRAWRANGEELEMENTSEXTPROC __glewDrawRangeElementsEXT = NULL; PFNGLFOGCOORDPOINTEREXTPROC __glewFogCoordPointerEXT = NULL; PFNGLFOGCOORDDEXTPROC __glewFogCoorddEXT = NULL; PFNGLFOGCOORDDVEXTPROC __glewFogCoorddvEXT = NULL; PFNGLFOGCOORDFEXTPROC __glewFogCoordfEXT = NULL; PFNGLFOGCOORDFVEXTPROC __glewFogCoordfvEXT = NULL; PFNGLFRAGMENTCOLORMATERIALEXTPROC __glewFragmentColorMaterialEXT = NULL; PFNGLFRAGMENTLIGHTMODELFEXTPROC __glewFragmentLightModelfEXT = NULL; PFNGLFRAGMENTLIGHTMODELFVEXTPROC __glewFragmentLightModelfvEXT = NULL; PFNGLFRAGMENTLIGHTMODELIEXTPROC __glewFragmentLightModeliEXT = NULL; PFNGLFRAGMENTLIGHTMODELIVEXTPROC __glewFragmentLightModelivEXT = NULL; PFNGLFRAGMENTLIGHTFEXTPROC __glewFragmentLightfEXT = NULL; PFNGLFRAGMENTLIGHTFVEXTPROC __glewFragmentLightfvEXT = NULL; PFNGLFRAGMENTLIGHTIEXTPROC __glewFragmentLightiEXT = NULL; PFNGLFRAGMENTLIGHTIVEXTPROC __glewFragmentLightivEXT = NULL; PFNGLFRAGMENTMATERIALFEXTPROC __glewFragmentMaterialfEXT = NULL; PFNGLFRAGMENTMATERIALFVEXTPROC __glewFragmentMaterialfvEXT = NULL; PFNGLFRAGMENTMATERIALIEXTPROC __glewFragmentMaterialiEXT = NULL; PFNGLFRAGMENTMATERIALIVEXTPROC __glewFragmentMaterialivEXT = NULL; PFNGLGETFRAGMENTLIGHTFVEXTPROC __glewGetFragmentLightfvEXT = NULL; PFNGLGETFRAGMENTLIGHTIVEXTPROC __glewGetFragmentLightivEXT = NULL; PFNGLGETFRAGMENTMATERIALFVEXTPROC __glewGetFragmentMaterialfvEXT = NULL; PFNGLGETFRAGMENTMATERIALIVEXTPROC __glewGetFragmentMaterialivEXT = NULL; PFNGLLIGHTENVIEXTPROC __glewLightEnviEXT = NULL; PFNGLBLITFRAMEBUFFEREXTPROC __glewBlitFramebufferEXT = NULL; PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC __glewRenderbufferStorageMultisampleEXT = NULL; PFNGLBINDFRAMEBUFFEREXTPROC __glewBindFramebufferEXT = NULL; PFNGLBINDRENDERBUFFEREXTPROC __glewBindRenderbufferEXT = NULL; PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC __glewCheckFramebufferStatusEXT = NULL; PFNGLDELETEFRAMEBUFFERSEXTPROC __glewDeleteFramebuffersEXT = NULL; PFNGLDELETERENDERBUFFERSEXTPROC __glewDeleteRenderbuffersEXT = NULL; PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC __glewFramebufferRenderbufferEXT = NULL; PFNGLFRAMEBUFFERTEXTURE1DEXTPROC __glewFramebufferTexture1DEXT = NULL; PFNGLFRAMEBUFFERTEXTURE2DEXTPROC __glewFramebufferTexture2DEXT = NULL; PFNGLFRAMEBUFFERTEXTURE3DEXTPROC __glewFramebufferTexture3DEXT = NULL; PFNGLGENFRAMEBUFFERSEXTPROC __glewGenFramebuffersEXT = NULL; PFNGLGENRENDERBUFFERSEXTPROC __glewGenRenderbuffersEXT = NULL; PFNGLGENERATEMIPMAPEXTPROC __glewGenerateMipmapEXT = NULL; PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC __glewGetFramebufferAttachmentParameterivEXT = NULL; PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC __glewGetRenderbufferParameterivEXT = NULL; PFNGLISFRAMEBUFFEREXTPROC __glewIsFramebufferEXT = NULL; PFNGLISRENDERBUFFEREXTPROC __glewIsRenderbufferEXT = NULL; PFNGLRENDERBUFFERSTORAGEEXTPROC __glewRenderbufferStorageEXT = NULL; PFNGLFRAMEBUFFERTEXTUREEXTPROC __glewFramebufferTextureEXT = NULL; PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC __glewFramebufferTextureFaceEXT = NULL; PFNGLPROGRAMPARAMETERIEXTPROC __glewProgramParameteriEXT = NULL; PFNGLPROGRAMENVPARAMETERS4FVEXTPROC __glewProgramEnvParameters4fvEXT = NULL; PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC __glewProgramLocalParameters4fvEXT = NULL; PFNGLBINDFRAGDATALOCATIONEXTPROC __glewBindFragDataLocationEXT = NULL; PFNGLGETFRAGDATALOCATIONEXTPROC __glewGetFragDataLocationEXT = NULL; PFNGLGETUNIFORMUIVEXTPROC __glewGetUniformuivEXT = NULL; PFNGLGETVERTEXATTRIBIIVEXTPROC __glewGetVertexAttribIivEXT = NULL; PFNGLGETVERTEXATTRIBIUIVEXTPROC __glewGetVertexAttribIuivEXT = NULL; PFNGLUNIFORM1UIEXTPROC __glewUniform1uiEXT = NULL; PFNGLUNIFORM1UIVEXTPROC __glewUniform1uivEXT = NULL; PFNGLUNIFORM2UIEXTPROC __glewUniform2uiEXT = NULL; PFNGLUNIFORM2UIVEXTPROC __glewUniform2uivEXT = NULL; PFNGLUNIFORM3UIEXTPROC __glewUniform3uiEXT = NULL; PFNGLUNIFORM3UIVEXTPROC __glewUniform3uivEXT = NULL; PFNGLUNIFORM4UIEXTPROC __glewUniform4uiEXT = NULL; PFNGLUNIFORM4UIVEXTPROC __glewUniform4uivEXT = NULL; PFNGLVERTEXATTRIBI1IEXTPROC __glewVertexAttribI1iEXT = NULL; PFNGLVERTEXATTRIBI1IVEXTPROC __glewVertexAttribI1ivEXT = NULL; PFNGLVERTEXATTRIBI1UIEXTPROC __glewVertexAttribI1uiEXT = NULL; PFNGLVERTEXATTRIBI1UIVEXTPROC __glewVertexAttribI1uivEXT = NULL; PFNGLVERTEXATTRIBI2IEXTPROC __glewVertexAttribI2iEXT = NULL; PFNGLVERTEXATTRIBI2IVEXTPROC __glewVertexAttribI2ivEXT = NULL; PFNGLVERTEXATTRIBI2UIEXTPROC __glewVertexAttribI2uiEXT = NULL; PFNGLVERTEXATTRIBI2UIVEXTPROC __glewVertexAttribI2uivEXT = NULL; PFNGLVERTEXATTRIBI3IEXTPROC __glewVertexAttribI3iEXT = NULL; PFNGLVERTEXATTRIBI3IVEXTPROC __glewVertexAttribI3ivEXT = NULL; PFNGLVERTEXATTRIBI3UIEXTPROC __glewVertexAttribI3uiEXT = NULL; PFNGLVERTEXATTRIBI3UIVEXTPROC __glewVertexAttribI3uivEXT = NULL; PFNGLVERTEXATTRIBI4BVEXTPROC __glewVertexAttribI4bvEXT = NULL; PFNGLVERTEXATTRIBI4IEXTPROC __glewVertexAttribI4iEXT = NULL; PFNGLVERTEXATTRIBI4IVEXTPROC __glewVertexAttribI4ivEXT = NULL; PFNGLVERTEXATTRIBI4SVEXTPROC __glewVertexAttribI4svEXT = NULL; PFNGLVERTEXATTRIBI4UBVEXTPROC __glewVertexAttribI4ubvEXT = NULL; PFNGLVERTEXATTRIBI4UIEXTPROC __glewVertexAttribI4uiEXT = NULL; PFNGLVERTEXATTRIBI4UIVEXTPROC __glewVertexAttribI4uivEXT = NULL; PFNGLVERTEXATTRIBI4USVEXTPROC __glewVertexAttribI4usvEXT = NULL; PFNGLVERTEXATTRIBIPOINTEREXTPROC __glewVertexAttribIPointerEXT = NULL; PFNGLGETHISTOGRAMEXTPROC __glewGetHistogramEXT = NULL; PFNGLGETHISTOGRAMPARAMETERFVEXTPROC __glewGetHistogramParameterfvEXT = NULL; PFNGLGETHISTOGRAMPARAMETERIVEXTPROC __glewGetHistogramParameterivEXT = NULL; PFNGLGETMINMAXEXTPROC __glewGetMinmaxEXT = NULL; PFNGLGETMINMAXPARAMETERFVEXTPROC __glewGetMinmaxParameterfvEXT = NULL; PFNGLGETMINMAXPARAMETERIVEXTPROC __glewGetMinmaxParameterivEXT = NULL; PFNGLHISTOGRAMEXTPROC __glewHistogramEXT = NULL; PFNGLMINMAXEXTPROC __glewMinmaxEXT = NULL; PFNGLRESETHISTOGRAMEXTPROC __glewResetHistogramEXT = NULL; PFNGLRESETMINMAXEXTPROC __glewResetMinmaxEXT = NULL; PFNGLINDEXFUNCEXTPROC __glewIndexFuncEXT = NULL; PFNGLINDEXMATERIALEXTPROC __glewIndexMaterialEXT = NULL; PFNGLAPPLYTEXTUREEXTPROC __glewApplyTextureEXT = NULL; PFNGLTEXTURELIGHTEXTPROC __glewTextureLightEXT = NULL; PFNGLTEXTUREMATERIALEXTPROC __glewTextureMaterialEXT = NULL; PFNGLMULTIDRAWARRAYSEXTPROC __glewMultiDrawArraysEXT = NULL; PFNGLMULTIDRAWELEMENTSEXTPROC __glewMultiDrawElementsEXT = NULL; PFNGLSAMPLEMASKEXTPROC __glewSampleMaskEXT = NULL; PFNGLSAMPLEPATTERNEXTPROC __glewSamplePatternEXT = NULL; PFNGLCOLORTABLEEXTPROC __glewColorTableEXT = NULL; PFNGLGETCOLORTABLEEXTPROC __glewGetColorTableEXT = NULL; PFNGLGETCOLORTABLEPARAMETERFVEXTPROC __glewGetColorTableParameterfvEXT = NULL; PFNGLGETCOLORTABLEPARAMETERIVEXTPROC __glewGetColorTableParameterivEXT = NULL; PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC __glewGetPixelTransformParameterfvEXT = NULL; PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC __glewGetPixelTransformParameterivEXT = NULL; PFNGLPIXELTRANSFORMPARAMETERFEXTPROC __glewPixelTransformParameterfEXT = NULL; PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC __glewPixelTransformParameterfvEXT = NULL; PFNGLPIXELTRANSFORMPARAMETERIEXTPROC __glewPixelTransformParameteriEXT = NULL; PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC __glewPixelTransformParameterivEXT = NULL; PFNGLPOINTPARAMETERFEXTPROC __glewPointParameterfEXT = NULL; PFNGLPOINTPARAMETERFVEXTPROC __glewPointParameterfvEXT = NULL; PFNGLPOLYGONOFFSETEXTPROC __glewPolygonOffsetEXT = NULL; PFNGLPROVOKINGVERTEXEXTPROC __glewProvokingVertexEXT = NULL; PFNGLBEGINSCENEEXTPROC __glewBeginSceneEXT = NULL; PFNGLENDSCENEEXTPROC __glewEndSceneEXT = NULL; PFNGLSECONDARYCOLOR3BEXTPROC __glewSecondaryColor3bEXT = NULL; PFNGLSECONDARYCOLOR3BVEXTPROC __glewSecondaryColor3bvEXT = NULL; PFNGLSECONDARYCOLOR3DEXTPROC __glewSecondaryColor3dEXT = NULL; PFNGLSECONDARYCOLOR3DVEXTPROC __glewSecondaryColor3dvEXT = NULL; PFNGLSECONDARYCOLOR3FEXTPROC __glewSecondaryColor3fEXT = NULL; PFNGLSECONDARYCOLOR3FVEXTPROC __glewSecondaryColor3fvEXT = NULL; PFNGLSECONDARYCOLOR3IEXTPROC __glewSecondaryColor3iEXT = NULL; PFNGLSECONDARYCOLOR3IVEXTPROC __glewSecondaryColor3ivEXT = NULL; PFNGLSECONDARYCOLOR3SEXTPROC __glewSecondaryColor3sEXT = NULL; PFNGLSECONDARYCOLOR3SVEXTPROC __glewSecondaryColor3svEXT = NULL; PFNGLSECONDARYCOLOR3UBEXTPROC __glewSecondaryColor3ubEXT = NULL; PFNGLSECONDARYCOLOR3UBVEXTPROC __glewSecondaryColor3ubvEXT = NULL; PFNGLSECONDARYCOLOR3UIEXTPROC __glewSecondaryColor3uiEXT = NULL; PFNGLSECONDARYCOLOR3UIVEXTPROC __glewSecondaryColor3uivEXT = NULL; PFNGLSECONDARYCOLOR3USEXTPROC __glewSecondaryColor3usEXT = NULL; PFNGLSECONDARYCOLOR3USVEXTPROC __glewSecondaryColor3usvEXT = NULL; PFNGLSECONDARYCOLORPOINTEREXTPROC __glewSecondaryColorPointerEXT = NULL; PFNGLACTIVEPROGRAMEXTPROC __glewActiveProgramEXT = NULL; PFNGLCREATESHADERPROGRAMEXTPROC __glewCreateShaderProgramEXT = NULL; PFNGLUSESHADERPROGRAMEXTPROC __glewUseShaderProgramEXT = NULL; PFNGLBINDIMAGETEXTUREEXTPROC __glewBindImageTextureEXT = NULL; PFNGLMEMORYBARRIEREXTPROC __glewMemoryBarrierEXT = NULL; PFNGLACTIVESTENCILFACEEXTPROC __glewActiveStencilFaceEXT = NULL; PFNGLTEXSUBIMAGE1DEXTPROC __glewTexSubImage1DEXT = NULL; PFNGLTEXSUBIMAGE2DEXTPROC __glewTexSubImage2DEXT = NULL; PFNGLTEXSUBIMAGE3DEXTPROC __glewTexSubImage3DEXT = NULL; PFNGLTEXIMAGE3DEXTPROC __glewTexImage3DEXT = NULL; PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC __glewFramebufferTextureLayerEXT = NULL; PFNGLTEXBUFFEREXTPROC __glewTexBufferEXT = NULL; PFNGLCLEARCOLORIIEXTPROC __glewClearColorIiEXT = NULL; PFNGLCLEARCOLORIUIEXTPROC __glewClearColorIuiEXT = NULL; PFNGLGETTEXPARAMETERIIVEXTPROC __glewGetTexParameterIivEXT = NULL; PFNGLGETTEXPARAMETERIUIVEXTPROC __glewGetTexParameterIuivEXT = NULL; PFNGLTEXPARAMETERIIVEXTPROC __glewTexParameterIivEXT = NULL; PFNGLTEXPARAMETERIUIVEXTPROC __glewTexParameterIuivEXT = NULL; PFNGLARETEXTURESRESIDENTEXTPROC __glewAreTexturesResidentEXT = NULL; PFNGLBINDTEXTUREEXTPROC __glewBindTextureEXT = NULL; PFNGLDELETETEXTURESEXTPROC __glewDeleteTexturesEXT = NULL; PFNGLGENTEXTURESEXTPROC __glewGenTexturesEXT = NULL; PFNGLISTEXTUREEXTPROC __glewIsTextureEXT = NULL; PFNGLPRIORITIZETEXTURESEXTPROC __glewPrioritizeTexturesEXT = NULL; PFNGLTEXTURENORMALEXTPROC __glewTextureNormalEXT = NULL; PFNGLGETQUERYOBJECTI64VEXTPROC __glewGetQueryObjecti64vEXT = NULL; PFNGLGETQUERYOBJECTUI64VEXTPROC __glewGetQueryObjectui64vEXT = NULL; PFNGLBEGINTRANSFORMFEEDBACKEXTPROC __glewBeginTransformFeedbackEXT = NULL; PFNGLBINDBUFFERBASEEXTPROC __glewBindBufferBaseEXT = NULL; PFNGLBINDBUFFEROFFSETEXTPROC __glewBindBufferOffsetEXT = NULL; PFNGLBINDBUFFERRANGEEXTPROC __glewBindBufferRangeEXT = NULL; PFNGLENDTRANSFORMFEEDBACKEXTPROC __glewEndTransformFeedbackEXT = NULL; PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC __glewGetTransformFeedbackVaryingEXT = NULL; PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC __glewTransformFeedbackVaryingsEXT = NULL; PFNGLARRAYELEMENTEXTPROC __glewArrayElementEXT = NULL; PFNGLCOLORPOINTEREXTPROC __glewColorPointerEXT = NULL; PFNGLDRAWARRAYSEXTPROC __glewDrawArraysEXT = NULL; PFNGLEDGEFLAGPOINTEREXTPROC __glewEdgeFlagPointerEXT = NULL; PFNGLINDEXPOINTEREXTPROC __glewIndexPointerEXT = NULL; PFNGLNORMALPOINTEREXTPROC __glewNormalPointerEXT = NULL; PFNGLTEXCOORDPOINTEREXTPROC __glewTexCoordPointerEXT = NULL; PFNGLVERTEXPOINTEREXTPROC __glewVertexPointerEXT = NULL; PFNGLGETVERTEXATTRIBLDVEXTPROC __glewGetVertexAttribLdvEXT = NULL; PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC __glewVertexArrayVertexAttribLOffsetEXT = NULL; PFNGLVERTEXATTRIBL1DEXTPROC __glewVertexAttribL1dEXT = NULL; PFNGLVERTEXATTRIBL1DVEXTPROC __glewVertexAttribL1dvEXT = NULL; PFNGLVERTEXATTRIBL2DEXTPROC __glewVertexAttribL2dEXT = NULL; PFNGLVERTEXATTRIBL2DVEXTPROC __glewVertexAttribL2dvEXT = NULL; PFNGLVERTEXATTRIBL3DEXTPROC __glewVertexAttribL3dEXT = NULL; PFNGLVERTEXATTRIBL3DVEXTPROC __glewVertexAttribL3dvEXT = NULL; PFNGLVERTEXATTRIBL4DEXTPROC __glewVertexAttribL4dEXT = NULL; PFNGLVERTEXATTRIBL4DVEXTPROC __glewVertexAttribL4dvEXT = NULL; PFNGLVERTEXATTRIBLPOINTEREXTPROC __glewVertexAttribLPointerEXT = NULL; PFNGLBEGINVERTEXSHADEREXTPROC __glewBeginVertexShaderEXT = NULL; PFNGLBINDLIGHTPARAMETEREXTPROC __glewBindLightParameterEXT = NULL; PFNGLBINDMATERIALPARAMETEREXTPROC __glewBindMaterialParameterEXT = NULL; PFNGLBINDPARAMETEREXTPROC __glewBindParameterEXT = NULL; PFNGLBINDTEXGENPARAMETEREXTPROC __glewBindTexGenParameterEXT = NULL; PFNGLBINDTEXTUREUNITPARAMETEREXTPROC __glewBindTextureUnitParameterEXT = NULL; PFNGLBINDVERTEXSHADEREXTPROC __glewBindVertexShaderEXT = NULL; PFNGLDELETEVERTEXSHADEREXTPROC __glewDeleteVertexShaderEXT = NULL; PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC __glewDisableVariantClientStateEXT = NULL; PFNGLENABLEVARIANTCLIENTSTATEEXTPROC __glewEnableVariantClientStateEXT = NULL; PFNGLENDVERTEXSHADEREXTPROC __glewEndVertexShaderEXT = NULL; PFNGLEXTRACTCOMPONENTEXTPROC __glewExtractComponentEXT = NULL; PFNGLGENSYMBOLSEXTPROC __glewGenSymbolsEXT = NULL; PFNGLGENVERTEXSHADERSEXTPROC __glewGenVertexShadersEXT = NULL; PFNGLGETINVARIANTBOOLEANVEXTPROC __glewGetInvariantBooleanvEXT = NULL; PFNGLGETINVARIANTFLOATVEXTPROC __glewGetInvariantFloatvEXT = NULL; PFNGLGETINVARIANTINTEGERVEXTPROC __glewGetInvariantIntegervEXT = NULL; PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC __glewGetLocalConstantBooleanvEXT = NULL; PFNGLGETLOCALCONSTANTFLOATVEXTPROC __glewGetLocalConstantFloatvEXT = NULL; PFNGLGETLOCALCONSTANTINTEGERVEXTPROC __glewGetLocalConstantIntegervEXT = NULL; PFNGLGETVARIANTBOOLEANVEXTPROC __glewGetVariantBooleanvEXT = NULL; PFNGLGETVARIANTFLOATVEXTPROC __glewGetVariantFloatvEXT = NULL; PFNGLGETVARIANTINTEGERVEXTPROC __glewGetVariantIntegervEXT = NULL; PFNGLGETVARIANTPOINTERVEXTPROC __glewGetVariantPointervEXT = NULL; PFNGLINSERTCOMPONENTEXTPROC __glewInsertComponentEXT = NULL; PFNGLISVARIANTENABLEDEXTPROC __glewIsVariantEnabledEXT = NULL; PFNGLSETINVARIANTEXTPROC __glewSetInvariantEXT = NULL; PFNGLSETLOCALCONSTANTEXTPROC __glewSetLocalConstantEXT = NULL; PFNGLSHADEROP1EXTPROC __glewShaderOp1EXT = NULL; PFNGLSHADEROP2EXTPROC __glewShaderOp2EXT = NULL; PFNGLSHADEROP3EXTPROC __glewShaderOp3EXT = NULL; PFNGLSWIZZLEEXTPROC __glewSwizzleEXT = NULL; PFNGLVARIANTPOINTEREXTPROC __glewVariantPointerEXT = NULL; PFNGLVARIANTBVEXTPROC __glewVariantbvEXT = NULL; PFNGLVARIANTDVEXTPROC __glewVariantdvEXT = NULL; PFNGLVARIANTFVEXTPROC __glewVariantfvEXT = NULL; PFNGLVARIANTIVEXTPROC __glewVariantivEXT = NULL; PFNGLVARIANTSVEXTPROC __glewVariantsvEXT = NULL; PFNGLVARIANTUBVEXTPROC __glewVariantubvEXT = NULL; PFNGLVARIANTUIVEXTPROC __glewVariantuivEXT = NULL; PFNGLVARIANTUSVEXTPROC __glewVariantusvEXT = NULL; PFNGLWRITEMASKEXTPROC __glewWriteMaskEXT = NULL; PFNGLVERTEXWEIGHTPOINTEREXTPROC __glewVertexWeightPointerEXT = NULL; PFNGLVERTEXWEIGHTFEXTPROC __glewVertexWeightfEXT = NULL; PFNGLVERTEXWEIGHTFVEXTPROC __glewVertexWeightfvEXT = NULL; PFNGLIMPORTSYNCEXTPROC __glewImportSyncEXT = NULL; PFNGLFRAMETERMINATORGREMEDYPROC __glewFrameTerminatorGREMEDY = NULL; PFNGLSTRINGMARKERGREMEDYPROC __glewStringMarkerGREMEDY = NULL; PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC __glewGetImageTransformParameterfvHP = NULL; PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC __glewGetImageTransformParameterivHP = NULL; PFNGLIMAGETRANSFORMPARAMETERFHPPROC __glewImageTransformParameterfHP = NULL; PFNGLIMAGETRANSFORMPARAMETERFVHPPROC __glewImageTransformParameterfvHP = NULL; PFNGLIMAGETRANSFORMPARAMETERIHPPROC __glewImageTransformParameteriHP = NULL; PFNGLIMAGETRANSFORMPARAMETERIVHPPROC __glewImageTransformParameterivHP = NULL; PFNGLMULTIMODEDRAWARRAYSIBMPROC __glewMultiModeDrawArraysIBM = NULL; PFNGLMULTIMODEDRAWELEMENTSIBMPROC __glewMultiModeDrawElementsIBM = NULL; PFNGLCOLORPOINTERLISTIBMPROC __glewColorPointerListIBM = NULL; PFNGLEDGEFLAGPOINTERLISTIBMPROC __glewEdgeFlagPointerListIBM = NULL; PFNGLFOGCOORDPOINTERLISTIBMPROC __glewFogCoordPointerListIBM = NULL; PFNGLINDEXPOINTERLISTIBMPROC __glewIndexPointerListIBM = NULL; PFNGLNORMALPOINTERLISTIBMPROC __glewNormalPointerListIBM = NULL; PFNGLSECONDARYCOLORPOINTERLISTIBMPROC __glewSecondaryColorPointerListIBM = NULL; PFNGLTEXCOORDPOINTERLISTIBMPROC __glewTexCoordPointerListIBM = NULL; PFNGLVERTEXPOINTERLISTIBMPROC __glewVertexPointerListIBM = NULL; PFNGLCOLORPOINTERVINTELPROC __glewColorPointervINTEL = NULL; PFNGLNORMALPOINTERVINTELPROC __glewNormalPointervINTEL = NULL; PFNGLTEXCOORDPOINTERVINTELPROC __glewTexCoordPointervINTEL = NULL; PFNGLVERTEXPOINTERVINTELPROC __glewVertexPointervINTEL = NULL; PFNGLTEXSCISSORFUNCINTELPROC __glewTexScissorFuncINTEL = NULL; PFNGLTEXSCISSORINTELPROC __glewTexScissorINTEL = NULL; PFNGLDEBUGMESSAGECALLBACKPROC __glewDebugMessageCallback = NULL; PFNGLDEBUGMESSAGECONTROLPROC __glewDebugMessageControl = NULL; PFNGLDEBUGMESSAGEINSERTPROC __glewDebugMessageInsert = NULL; PFNGLGETDEBUGMESSAGELOGPROC __glewGetDebugMessageLog = NULL; PFNGLGETOBJECTLABELPROC __glewGetObjectLabel = NULL; PFNGLGETOBJECTPTRLABELPROC __glewGetObjectPtrLabel = NULL; PFNGLGETPOINTERVPROC __glewGetPointerv = NULL; PFNGLOBJECTLABELPROC __glewObjectLabel = NULL; PFNGLOBJECTPTRLABELPROC __glewObjectPtrLabel = NULL; PFNGLPUSHDEBUGGROUPPROC __glewPushDebugGroup = NULL; PFNGLBUFFERREGIONENABLEDPROC __glewBufferRegionEnabled = NULL; PFNGLDELETEBUFFERREGIONPROC __glewDeleteBufferRegion = NULL; PFNGLDRAWBUFFERREGIONPROC __glewDrawBufferRegion = NULL; PFNGLNEWBUFFERREGIONPROC __glewNewBufferRegion = NULL; PFNGLREADBUFFERREGIONPROC __glewReadBufferRegion = NULL; PFNGLRESIZEBUFFERSMESAPROC __glewResizeBuffersMESA = NULL; PFNGLWINDOWPOS2DMESAPROC __glewWindowPos2dMESA = NULL; PFNGLWINDOWPOS2DVMESAPROC __glewWindowPos2dvMESA = NULL; PFNGLWINDOWPOS2FMESAPROC __glewWindowPos2fMESA = NULL; PFNGLWINDOWPOS2FVMESAPROC __glewWindowPos2fvMESA = NULL; PFNGLWINDOWPOS2IMESAPROC __glewWindowPos2iMESA = NULL; PFNGLWINDOWPOS2IVMESAPROC __glewWindowPos2ivMESA = NULL; PFNGLWINDOWPOS2SMESAPROC __glewWindowPos2sMESA = NULL; PFNGLWINDOWPOS2SVMESAPROC __glewWindowPos2svMESA = NULL; PFNGLWINDOWPOS3DMESAPROC __glewWindowPos3dMESA = NULL; PFNGLWINDOWPOS3DVMESAPROC __glewWindowPos3dvMESA = NULL; PFNGLWINDOWPOS3FMESAPROC __glewWindowPos3fMESA = NULL; PFNGLWINDOWPOS3FVMESAPROC __glewWindowPos3fvMESA = NULL; PFNGLWINDOWPOS3IMESAPROC __glewWindowPos3iMESA = NULL; PFNGLWINDOWPOS3IVMESAPROC __glewWindowPos3ivMESA = NULL; PFNGLWINDOWPOS3SMESAPROC __glewWindowPos3sMESA = NULL; PFNGLWINDOWPOS3SVMESAPROC __glewWindowPos3svMESA = NULL; PFNGLWINDOWPOS4DMESAPROC __glewWindowPos4dMESA = NULL; PFNGLWINDOWPOS4DVMESAPROC __glewWindowPos4dvMESA = NULL; PFNGLWINDOWPOS4FMESAPROC __glewWindowPos4fMESA = NULL; PFNGLWINDOWPOS4FVMESAPROC __glewWindowPos4fvMESA = NULL; PFNGLWINDOWPOS4IMESAPROC __glewWindowPos4iMESA = NULL; PFNGLWINDOWPOS4IVMESAPROC __glewWindowPos4ivMESA = NULL; PFNGLWINDOWPOS4SMESAPROC __glewWindowPos4sMESA = NULL; PFNGLWINDOWPOS4SVMESAPROC __glewWindowPos4svMESA = NULL; PFNGLGETIMAGEHANDLENVPROC __glewGetImageHandleNV = NULL; PFNGLGETTEXTUREHANDLENVPROC __glewGetTextureHandleNV = NULL; PFNGLGETTEXTURESAMPLERHANDLENVPROC __glewGetTextureSamplerHandleNV = NULL; PFNGLISIMAGEHANDLERESIDENTNVPROC __glewIsImageHandleResidentNV = NULL; PFNGLISTEXTUREHANDLERESIDENTNVPROC __glewIsTextureHandleResidentNV = NULL; PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC __glewMakeImageHandleNonResidentNV = NULL; PFNGLMAKEIMAGEHANDLERESIDENTNVPROC __glewMakeImageHandleResidentNV = NULL; PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC __glewMakeTextureHandleNonResidentNV = NULL; PFNGLMAKETEXTUREHANDLERESIDENTNVPROC __glewMakeTextureHandleResidentNV = NULL; PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC __glewProgramUniformHandleui64NV = NULL; PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC __glewProgramUniformHandleui64vNV = NULL; PFNGLUNIFORMHANDLEUI64NVPROC __glewUniformHandleui64NV = NULL; PFNGLUNIFORMHANDLEUI64VNVPROC __glewUniformHandleui64vNV = NULL; PFNGLBEGINCONDITIONALRENDERNVPROC __glewBeginConditionalRenderNV = NULL; PFNGLENDCONDITIONALRENDERNVPROC __glewEndConditionalRenderNV = NULL; PFNGLCOPYIMAGESUBDATANVPROC __glewCopyImageSubDataNV = NULL; PFNGLCLEARDEPTHDNVPROC __glewClearDepthdNV = NULL; PFNGLDEPTHBOUNDSDNVPROC __glewDepthBoundsdNV = NULL; PFNGLDEPTHRANGEDNVPROC __glewDepthRangedNV = NULL; PFNGLEVALMAPSNVPROC __glewEvalMapsNV = NULL; PFNGLGETMAPATTRIBPARAMETERFVNVPROC __glewGetMapAttribParameterfvNV = NULL; PFNGLGETMAPATTRIBPARAMETERIVNVPROC __glewGetMapAttribParameterivNV = NULL; PFNGLGETMAPCONTROLPOINTSNVPROC __glewGetMapControlPointsNV = NULL; PFNGLGETMAPPARAMETERFVNVPROC __glewGetMapParameterfvNV = NULL; PFNGLGETMAPPARAMETERIVNVPROC __glewGetMapParameterivNV = NULL; PFNGLMAPCONTROLPOINTSNVPROC __glewMapControlPointsNV = NULL; PFNGLMAPPARAMETERFVNVPROC __glewMapParameterfvNV = NULL; PFNGLMAPPARAMETERIVNVPROC __glewMapParameterivNV = NULL; PFNGLGETMULTISAMPLEFVNVPROC __glewGetMultisamplefvNV = NULL; PFNGLSAMPLEMASKINDEXEDNVPROC __glewSampleMaskIndexedNV = NULL; PFNGLTEXRENDERBUFFERNVPROC __glewTexRenderbufferNV = NULL; PFNGLDELETEFENCESNVPROC __glewDeleteFencesNV = NULL; PFNGLFINISHFENCENVPROC __glewFinishFenceNV = NULL; PFNGLGENFENCESNVPROC __glewGenFencesNV = NULL; PFNGLGETFENCEIVNVPROC __glewGetFenceivNV = NULL; PFNGLISFENCENVPROC __glewIsFenceNV = NULL; PFNGLSETFENCENVPROC __glewSetFenceNV = NULL; PFNGLTESTFENCENVPROC __glewTestFenceNV = NULL; PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC __glewGetProgramNamedParameterdvNV = NULL; PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC __glewGetProgramNamedParameterfvNV = NULL; PFNGLPROGRAMNAMEDPARAMETER4DNVPROC __glewProgramNamedParameter4dNV = NULL; PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC __glewProgramNamedParameter4dvNV = NULL; PFNGLPROGRAMNAMEDPARAMETER4FNVPROC __glewProgramNamedParameter4fNV = NULL; PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC __glewProgramNamedParameter4fvNV = NULL; PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC __glewRenderbufferStorageMultisampleCoverageNV = NULL; PFNGLPROGRAMVERTEXLIMITNVPROC __glewProgramVertexLimitNV = NULL; PFNGLPROGRAMENVPARAMETERI4INVPROC __glewProgramEnvParameterI4iNV = NULL; PFNGLPROGRAMENVPARAMETERI4IVNVPROC __glewProgramEnvParameterI4ivNV = NULL; PFNGLPROGRAMENVPARAMETERI4UINVPROC __glewProgramEnvParameterI4uiNV = NULL; PFNGLPROGRAMENVPARAMETERI4UIVNVPROC __glewProgramEnvParameterI4uivNV = NULL; PFNGLPROGRAMENVPARAMETERSI4IVNVPROC __glewProgramEnvParametersI4ivNV = NULL; PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC __glewProgramEnvParametersI4uivNV = NULL; PFNGLPROGRAMLOCALPARAMETERI4INVPROC __glewProgramLocalParameterI4iNV = NULL; PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC __glewProgramLocalParameterI4ivNV = NULL; PFNGLPROGRAMLOCALPARAMETERI4UINVPROC __glewProgramLocalParameterI4uiNV = NULL; PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC __glewProgramLocalParameterI4uivNV = NULL; PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC __glewProgramLocalParametersI4ivNV = NULL; PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC __glewProgramLocalParametersI4uivNV = NULL; PFNGLGETUNIFORMI64VNVPROC __glewGetUniformi64vNV = NULL; PFNGLGETUNIFORMUI64VNVPROC __glewGetUniformui64vNV = NULL; PFNGLPROGRAMUNIFORM1I64NVPROC __glewProgramUniform1i64NV = NULL; PFNGLPROGRAMUNIFORM1I64VNVPROC __glewProgramUniform1i64vNV = NULL; PFNGLPROGRAMUNIFORM1UI64NVPROC __glewProgramUniform1ui64NV = NULL; PFNGLPROGRAMUNIFORM1UI64VNVPROC __glewProgramUniform1ui64vNV = NULL; PFNGLPROGRAMUNIFORM2I64NVPROC __glewProgramUniform2i64NV = NULL; PFNGLPROGRAMUNIFORM2I64VNVPROC __glewProgramUniform2i64vNV = NULL; PFNGLPROGRAMUNIFORM2UI64NVPROC __glewProgramUniform2ui64NV = NULL; PFNGLPROGRAMUNIFORM2UI64VNVPROC __glewProgramUniform2ui64vNV = NULL; PFNGLPROGRAMUNIFORM3I64NVPROC __glewProgramUniform3i64NV = NULL; PFNGLPROGRAMUNIFORM3I64VNVPROC __glewProgramUniform3i64vNV = NULL; PFNGLPROGRAMUNIFORM3UI64NVPROC __glewProgramUniform3ui64NV = NULL; PFNGLPROGRAMUNIFORM3UI64VNVPROC __glewProgramUniform3ui64vNV = NULL; PFNGLPROGRAMUNIFORM4I64NVPROC __glewProgramUniform4i64NV = NULL; PFNGLPROGRAMUNIFORM4I64VNVPROC __glewProgramUniform4i64vNV = NULL; PFNGLPROGRAMUNIFORM4UI64NVPROC __glewProgramUniform4ui64NV = NULL; PFNGLPROGRAMUNIFORM4UI64VNVPROC __glewProgramUniform4ui64vNV = NULL; PFNGLUNIFORM1I64NVPROC __glewUniform1i64NV = NULL; PFNGLUNIFORM1I64VNVPROC __glewUniform1i64vNV = NULL; PFNGLUNIFORM1UI64NVPROC __glewUniform1ui64NV = NULL; PFNGLUNIFORM1UI64VNVPROC __glewUniform1ui64vNV = NULL; PFNGLUNIFORM2I64NVPROC __glewUniform2i64NV = NULL; PFNGLUNIFORM2I64VNVPROC __glewUniform2i64vNV = NULL; PFNGLUNIFORM2UI64NVPROC __glewUniform2ui64NV = NULL; PFNGLUNIFORM2UI64VNVPROC __glewUniform2ui64vNV = NULL; PFNGLUNIFORM3I64NVPROC __glewUniform3i64NV = NULL; PFNGLUNIFORM3I64VNVPROC __glewUniform3i64vNV = NULL; PFNGLUNIFORM3UI64NVPROC __glewUniform3ui64NV = NULL; PFNGLUNIFORM3UI64VNVPROC __glewUniform3ui64vNV = NULL; PFNGLUNIFORM4I64NVPROC __glewUniform4i64NV = NULL; PFNGLUNIFORM4I64VNVPROC __glewUniform4i64vNV = NULL; PFNGLUNIFORM4UI64NVPROC __glewUniform4ui64NV = NULL; PFNGLUNIFORM4UI64VNVPROC __glewUniform4ui64vNV = NULL; PFNGLCOLOR3HNVPROC __glewColor3hNV = NULL; PFNGLCOLOR3HVNVPROC __glewColor3hvNV = NULL; PFNGLCOLOR4HNVPROC __glewColor4hNV = NULL; PFNGLCOLOR4HVNVPROC __glewColor4hvNV = NULL; PFNGLFOGCOORDHNVPROC __glewFogCoordhNV = NULL; PFNGLFOGCOORDHVNVPROC __glewFogCoordhvNV = NULL; PFNGLMULTITEXCOORD1HNVPROC __glewMultiTexCoord1hNV = NULL; PFNGLMULTITEXCOORD1HVNVPROC __glewMultiTexCoord1hvNV = NULL; PFNGLMULTITEXCOORD2HNVPROC __glewMultiTexCoord2hNV = NULL; PFNGLMULTITEXCOORD2HVNVPROC __glewMultiTexCoord2hvNV = NULL; PFNGLMULTITEXCOORD3HNVPROC __glewMultiTexCoord3hNV = NULL; PFNGLMULTITEXCOORD3HVNVPROC __glewMultiTexCoord3hvNV = NULL; PFNGLMULTITEXCOORD4HNVPROC __glewMultiTexCoord4hNV = NULL; PFNGLMULTITEXCOORD4HVNVPROC __glewMultiTexCoord4hvNV = NULL; PFNGLNORMAL3HNVPROC __glewNormal3hNV = NULL; PFNGLNORMAL3HVNVPROC __glewNormal3hvNV = NULL; PFNGLSECONDARYCOLOR3HNVPROC __glewSecondaryColor3hNV = NULL; PFNGLSECONDARYCOLOR3HVNVPROC __glewSecondaryColor3hvNV = NULL; PFNGLTEXCOORD1HNVPROC __glewTexCoord1hNV = NULL; PFNGLTEXCOORD1HVNVPROC __glewTexCoord1hvNV = NULL; PFNGLTEXCOORD2HNVPROC __glewTexCoord2hNV = NULL; PFNGLTEXCOORD2HVNVPROC __glewTexCoord2hvNV = NULL; PFNGLTEXCOORD3HNVPROC __glewTexCoord3hNV = NULL; PFNGLTEXCOORD3HVNVPROC __glewTexCoord3hvNV = NULL; PFNGLTEXCOORD4HNVPROC __glewTexCoord4hNV = NULL; PFNGLTEXCOORD4HVNVPROC __glewTexCoord4hvNV = NULL; PFNGLVERTEX2HNVPROC __glewVertex2hNV = NULL; PFNGLVERTEX2HVNVPROC __glewVertex2hvNV = NULL; PFNGLVERTEX3HNVPROC __glewVertex3hNV = NULL; PFNGLVERTEX3HVNVPROC __glewVertex3hvNV = NULL; PFNGLVERTEX4HNVPROC __glewVertex4hNV = NULL; PFNGLVERTEX4HVNVPROC __glewVertex4hvNV = NULL; PFNGLVERTEXATTRIB1HNVPROC __glewVertexAttrib1hNV = NULL; PFNGLVERTEXATTRIB1HVNVPROC __glewVertexAttrib1hvNV = NULL; PFNGLVERTEXATTRIB2HNVPROC __glewVertexAttrib2hNV = NULL; PFNGLVERTEXATTRIB2HVNVPROC __glewVertexAttrib2hvNV = NULL; PFNGLVERTEXATTRIB3HNVPROC __glewVertexAttrib3hNV = NULL; PFNGLVERTEXATTRIB3HVNVPROC __glewVertexAttrib3hvNV = NULL; PFNGLVERTEXATTRIB4HNVPROC __glewVertexAttrib4hNV = NULL; PFNGLVERTEXATTRIB4HVNVPROC __glewVertexAttrib4hvNV = NULL; PFNGLVERTEXATTRIBS1HVNVPROC __glewVertexAttribs1hvNV = NULL; PFNGLVERTEXATTRIBS2HVNVPROC __glewVertexAttribs2hvNV = NULL; PFNGLVERTEXATTRIBS3HVNVPROC __glewVertexAttribs3hvNV = NULL; PFNGLVERTEXATTRIBS4HVNVPROC __glewVertexAttribs4hvNV = NULL; PFNGLVERTEXWEIGHTHNVPROC __glewVertexWeighthNV = NULL; PFNGLVERTEXWEIGHTHVNVPROC __glewVertexWeighthvNV = NULL; PFNGLBEGINOCCLUSIONQUERYNVPROC __glewBeginOcclusionQueryNV = NULL; PFNGLDELETEOCCLUSIONQUERIESNVPROC __glewDeleteOcclusionQueriesNV = NULL; PFNGLENDOCCLUSIONQUERYNVPROC __glewEndOcclusionQueryNV = NULL; PFNGLGENOCCLUSIONQUERIESNVPROC __glewGenOcclusionQueriesNV = NULL; PFNGLGETOCCLUSIONQUERYIVNVPROC __glewGetOcclusionQueryivNV = NULL; PFNGLGETOCCLUSIONQUERYUIVNVPROC __glewGetOcclusionQueryuivNV = NULL; PFNGLISOCCLUSIONQUERYNVPROC __glewIsOcclusionQueryNV = NULL; PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC __glewProgramBufferParametersIivNV = NULL; PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC __glewProgramBufferParametersIuivNV = NULL; PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC __glewProgramBufferParametersfvNV = NULL; PFNGLCOPYPATHNVPROC __glewCopyPathNV = NULL; PFNGLCOVERFILLPATHINSTANCEDNVPROC __glewCoverFillPathInstancedNV = NULL; PFNGLCOVERFILLPATHNVPROC __glewCoverFillPathNV = NULL; PFNGLCOVERSTROKEPATHINSTANCEDNVPROC __glewCoverStrokePathInstancedNV = NULL; PFNGLCOVERSTROKEPATHNVPROC __glewCoverStrokePathNV = NULL; PFNGLDELETEPATHSNVPROC __glewDeletePathsNV = NULL; PFNGLGENPATHSNVPROC __glewGenPathsNV = NULL; PFNGLGETPATHCOLORGENFVNVPROC __glewGetPathColorGenfvNV = NULL; PFNGLGETPATHCOLORGENIVNVPROC __glewGetPathColorGenivNV = NULL; PFNGLGETPATHCOMMANDSNVPROC __glewGetPathCommandsNV = NULL; PFNGLGETPATHCOORDSNVPROC __glewGetPathCoordsNV = NULL; PFNGLGETPATHDASHARRAYNVPROC __glewGetPathDashArrayNV = NULL; PFNGLGETPATHLENGTHNVPROC __glewGetPathLengthNV = NULL; PFNGLGETPATHMETRICRANGENVPROC __glewGetPathMetricRangeNV = NULL; PFNGLGETPATHMETRICSNVPROC __glewGetPathMetricsNV = NULL; PFNGLGETPATHPARAMETERFVNVPROC __glewGetPathParameterfvNV = NULL; PFNGLGETPATHPARAMETERIVNVPROC __glewGetPathParameterivNV = NULL; PFNGLGETPATHSPACINGNVPROC __glewGetPathSpacingNV = NULL; PFNGLGETPATHTEXGENFVNVPROC __glewGetPathTexGenfvNV = NULL; PFNGLGETPATHTEXGENIVNVPROC __glewGetPathTexGenivNV = NULL; PFNGLINTERPOLATEPATHSNVPROC __glewInterpolatePathsNV = NULL; PFNGLISPATHNVPROC __glewIsPathNV = NULL; PFNGLISPOINTINFILLPATHNVPROC __glewIsPointInFillPathNV = NULL; PFNGLISPOINTINSTROKEPATHNVPROC __glewIsPointInStrokePathNV = NULL; PFNGLPATHCOLORGENNVPROC __glewPathColorGenNV = NULL; PFNGLPATHCOMMANDSNVPROC __glewPathCommandsNV = NULL; PFNGLPATHCOORDSNVPROC __glewPathCoordsNV = NULL; PFNGLPATHCOVERDEPTHFUNCNVPROC __glewPathCoverDepthFuncNV = NULL; PFNGLPATHDASHARRAYNVPROC __glewPathDashArrayNV = NULL; PFNGLPATHFOGGENNVPROC __glewPathFogGenNV = NULL; PFNGLPATHGLYPHRANGENVPROC __glewPathGlyphRangeNV = NULL; PFNGLPATHGLYPHSNVPROC __glewPathGlyphsNV = NULL; PFNGLPATHPARAMETERFNVPROC __glewPathParameterfNV = NULL; PFNGLPATHPARAMETERFVNVPROC __glewPathParameterfvNV = NULL; PFNGLPATHPARAMETERINVPROC __glewPathParameteriNV = NULL; PFNGLPATHPARAMETERIVNVPROC __glewPathParameterivNV = NULL; PFNGLPATHSTENCILDEPTHOFFSETNVPROC __glewPathStencilDepthOffsetNV = NULL; PFNGLPATHSTENCILFUNCNVPROC __glewPathStencilFuncNV = NULL; PFNGLPATHSTRINGNVPROC __glewPathStringNV = NULL; PFNGLPATHSUBCOMMANDSNVPROC __glewPathSubCommandsNV = NULL; PFNGLPATHSUBCOORDSNVPROC __glewPathSubCoordsNV = NULL; PFNGLPATHTEXGENNVPROC __glewPathTexGenNV = NULL; PFNGLPOINTALONGPATHNVPROC __glewPointAlongPathNV = NULL; PFNGLSTENCILFILLPATHINSTANCEDNVPROC __glewStencilFillPathInstancedNV = NULL; PFNGLSTENCILFILLPATHNVPROC __glewStencilFillPathNV = NULL; PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC __glewStencilStrokePathInstancedNV = NULL; PFNGLSTENCILSTROKEPATHNVPROC __glewStencilStrokePathNV = NULL; PFNGLTRANSFORMPATHNVPROC __glewTransformPathNV = NULL; PFNGLWEIGHTPATHSNVPROC __glewWeightPathsNV = NULL; PFNGLFLUSHPIXELDATARANGENVPROC __glewFlushPixelDataRangeNV = NULL; PFNGLPIXELDATARANGENVPROC __glewPixelDataRangeNV = NULL; PFNGLPOINTPARAMETERINVPROC __glewPointParameteriNV = NULL; PFNGLPOINTPARAMETERIVNVPROC __glewPointParameterivNV = NULL; PFNGLGETVIDEOI64VNVPROC __glewGetVideoi64vNV = NULL; PFNGLGETVIDEOIVNVPROC __glewGetVideoivNV = NULL; PFNGLGETVIDEOUI64VNVPROC __glewGetVideoui64vNV = NULL; PFNGLGETVIDEOUIVNVPROC __glewGetVideouivNV = NULL; PFNGLPRESENTFRAMEDUALFILLNVPROC __glewPresentFrameDualFillNV = NULL; PFNGLPRESENTFRAMEKEYEDNVPROC __glewPresentFrameKeyedNV = NULL; PFNGLPRIMITIVERESTARTINDEXNVPROC __glewPrimitiveRestartIndexNV = NULL; PFNGLPRIMITIVERESTARTNVPROC __glewPrimitiveRestartNV = NULL; PFNGLCOMBINERINPUTNVPROC __glewCombinerInputNV = NULL; PFNGLCOMBINEROUTPUTNVPROC __glewCombinerOutputNV = NULL; PFNGLCOMBINERPARAMETERFNVPROC __glewCombinerParameterfNV = NULL; PFNGLCOMBINERPARAMETERFVNVPROC __glewCombinerParameterfvNV = NULL; PFNGLCOMBINERPARAMETERINVPROC __glewCombinerParameteriNV = NULL; PFNGLCOMBINERPARAMETERIVNVPROC __glewCombinerParameterivNV = NULL; PFNGLFINALCOMBINERINPUTNVPROC __glewFinalCombinerInputNV = NULL; PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC __glewGetCombinerInputParameterfvNV = NULL; PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC __glewGetCombinerInputParameterivNV = NULL; PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC __glewGetCombinerOutputParameterfvNV = NULL; PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC __glewGetCombinerOutputParameterivNV = NULL; PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC __glewGetFinalCombinerInputParameterfvNV = NULL; PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC __glewGetFinalCombinerInputParameterivNV = NULL; PFNGLCOMBINERSTAGEPARAMETERFVNVPROC __glewCombinerStageParameterfvNV = NULL; PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC __glewGetCombinerStageParameterfvNV = NULL; PFNGLGETBUFFERPARAMETERUI64VNVPROC __glewGetBufferParameterui64vNV = NULL; PFNGLGETINTEGERUI64VNVPROC __glewGetIntegerui64vNV = NULL; PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC __glewGetNamedBufferParameterui64vNV = NULL; PFNGLISBUFFERRESIDENTNVPROC __glewIsBufferResidentNV = NULL; PFNGLISNAMEDBUFFERRESIDENTNVPROC __glewIsNamedBufferResidentNV = NULL; PFNGLMAKEBUFFERNONRESIDENTNVPROC __glewMakeBufferNonResidentNV = NULL; PFNGLMAKEBUFFERRESIDENTNVPROC __glewMakeBufferResidentNV = NULL; PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC __glewMakeNamedBufferNonResidentNV = NULL; PFNGLMAKENAMEDBUFFERRESIDENTNVPROC __glewMakeNamedBufferResidentNV = NULL; PFNGLPROGRAMUNIFORMUI64NVPROC __glewProgramUniformui64NV = NULL; PFNGLPROGRAMUNIFORMUI64VNVPROC __glewProgramUniformui64vNV = NULL; PFNGLUNIFORMUI64NVPROC __glewUniformui64NV = NULL; PFNGLUNIFORMUI64VNVPROC __glewUniformui64vNV = NULL; PFNGLTEXTUREBARRIERNVPROC __glewTextureBarrierNV = NULL; PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC __glewTexImage2DMultisampleCoverageNV = NULL; PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC __glewTexImage3DMultisampleCoverageNV = NULL; PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC __glewTextureImage2DMultisampleCoverageNV = NULL; PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC __glewTextureImage2DMultisampleNV = NULL; PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC __glewTextureImage3DMultisampleCoverageNV = NULL; PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC __glewTextureImage3DMultisampleNV = NULL; PFNGLACTIVEVARYINGNVPROC __glewActiveVaryingNV = NULL; PFNGLBEGINTRANSFORMFEEDBACKNVPROC __glewBeginTransformFeedbackNV = NULL; PFNGLBINDBUFFERBASENVPROC __glewBindBufferBaseNV = NULL; PFNGLBINDBUFFEROFFSETNVPROC __glewBindBufferOffsetNV = NULL; PFNGLBINDBUFFERRANGENVPROC __glewBindBufferRangeNV = NULL; PFNGLENDTRANSFORMFEEDBACKNVPROC __glewEndTransformFeedbackNV = NULL; PFNGLGETACTIVEVARYINGNVPROC __glewGetActiveVaryingNV = NULL; PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC __glewGetTransformFeedbackVaryingNV = NULL; PFNGLGETVARYINGLOCATIONNVPROC __glewGetVaryingLocationNV = NULL; PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC __glewTransformFeedbackAttribsNV = NULL; PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC __glewTransformFeedbackVaryingsNV = NULL; PFNGLBINDTRANSFORMFEEDBACKNVPROC __glewBindTransformFeedbackNV = NULL; PFNGLDELETETRANSFORMFEEDBACKSNVPROC __glewDeleteTransformFeedbacksNV = NULL; PFNGLDRAWTRANSFORMFEEDBACKNVPROC __glewDrawTransformFeedbackNV = NULL; PFNGLGENTRANSFORMFEEDBACKSNVPROC __glewGenTransformFeedbacksNV = NULL; PFNGLISTRANSFORMFEEDBACKNVPROC __glewIsTransformFeedbackNV = NULL; PFNGLPAUSETRANSFORMFEEDBACKNVPROC __glewPauseTransformFeedbackNV = NULL; PFNGLRESUMETRANSFORMFEEDBACKNVPROC __glewResumeTransformFeedbackNV = NULL; PFNGLVDPAUFININVPROC __glewVDPAUFiniNV = NULL; PFNGLVDPAUGETSURFACEIVNVPROC __glewVDPAUGetSurfaceivNV = NULL; PFNGLVDPAUINITNVPROC __glewVDPAUInitNV = NULL; PFNGLVDPAUISSURFACENVPROC __glewVDPAUIsSurfaceNV = NULL; PFNGLVDPAUMAPSURFACESNVPROC __glewVDPAUMapSurfacesNV = NULL; PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC __glewVDPAURegisterOutputSurfaceNV = NULL; PFNGLVDPAUREGISTERVIDEOSURFACENVPROC __glewVDPAURegisterVideoSurfaceNV = NULL; PFNGLVDPAUSURFACEACCESSNVPROC __glewVDPAUSurfaceAccessNV = NULL; PFNGLVDPAUUNMAPSURFACESNVPROC __glewVDPAUUnmapSurfacesNV = NULL; PFNGLVDPAUUNREGISTERSURFACENVPROC __glewVDPAUUnregisterSurfaceNV = NULL; PFNGLFLUSHVERTEXARRAYRANGENVPROC __glewFlushVertexArrayRangeNV = NULL; PFNGLVERTEXARRAYRANGENVPROC __glewVertexArrayRangeNV = NULL; PFNGLGETVERTEXATTRIBLI64VNVPROC __glewGetVertexAttribLi64vNV = NULL; PFNGLGETVERTEXATTRIBLUI64VNVPROC __glewGetVertexAttribLui64vNV = NULL; PFNGLVERTEXATTRIBL1I64NVPROC __glewVertexAttribL1i64NV = NULL; PFNGLVERTEXATTRIBL1I64VNVPROC __glewVertexAttribL1i64vNV = NULL; PFNGLVERTEXATTRIBL1UI64NVPROC __glewVertexAttribL1ui64NV = NULL; PFNGLVERTEXATTRIBL1UI64VNVPROC __glewVertexAttribL1ui64vNV = NULL; PFNGLVERTEXATTRIBL2I64NVPROC __glewVertexAttribL2i64NV = NULL; PFNGLVERTEXATTRIBL2I64VNVPROC __glewVertexAttribL2i64vNV = NULL; PFNGLVERTEXATTRIBL2UI64NVPROC __glewVertexAttribL2ui64NV = NULL; PFNGLVERTEXATTRIBL2UI64VNVPROC __glewVertexAttribL2ui64vNV = NULL; PFNGLVERTEXATTRIBL3I64NVPROC __glewVertexAttribL3i64NV = NULL; PFNGLVERTEXATTRIBL3I64VNVPROC __glewVertexAttribL3i64vNV = NULL; PFNGLVERTEXATTRIBL3UI64NVPROC __glewVertexAttribL3ui64NV = NULL; PFNGLVERTEXATTRIBL3UI64VNVPROC __glewVertexAttribL3ui64vNV = NULL; PFNGLVERTEXATTRIBL4I64NVPROC __glewVertexAttribL4i64NV = NULL; PFNGLVERTEXATTRIBL4I64VNVPROC __glewVertexAttribL4i64vNV = NULL; PFNGLVERTEXATTRIBL4UI64NVPROC __glewVertexAttribL4ui64NV = NULL; PFNGLVERTEXATTRIBL4UI64VNVPROC __glewVertexAttribL4ui64vNV = NULL; PFNGLVERTEXATTRIBLFORMATNVPROC __glewVertexAttribLFormatNV = NULL; PFNGLBUFFERADDRESSRANGENVPROC __glewBufferAddressRangeNV = NULL; PFNGLCOLORFORMATNVPROC __glewColorFormatNV = NULL; PFNGLEDGEFLAGFORMATNVPROC __glewEdgeFlagFormatNV = NULL; PFNGLFOGCOORDFORMATNVPROC __glewFogCoordFormatNV = NULL; PFNGLGETINTEGERUI64I_VNVPROC __glewGetIntegerui64i_vNV = NULL; PFNGLINDEXFORMATNVPROC __glewIndexFormatNV = NULL; PFNGLNORMALFORMATNVPROC __glewNormalFormatNV = NULL; PFNGLSECONDARYCOLORFORMATNVPROC __glewSecondaryColorFormatNV = NULL; PFNGLTEXCOORDFORMATNVPROC __glewTexCoordFormatNV = NULL; PFNGLVERTEXATTRIBFORMATNVPROC __glewVertexAttribFormatNV = NULL; PFNGLVERTEXATTRIBIFORMATNVPROC __glewVertexAttribIFormatNV = NULL; PFNGLVERTEXFORMATNVPROC __glewVertexFormatNV = NULL; PFNGLAREPROGRAMSRESIDENTNVPROC __glewAreProgramsResidentNV = NULL; PFNGLBINDPROGRAMNVPROC __glewBindProgramNV = NULL; PFNGLDELETEPROGRAMSNVPROC __glewDeleteProgramsNV = NULL; PFNGLEXECUTEPROGRAMNVPROC __glewExecuteProgramNV = NULL; PFNGLGENPROGRAMSNVPROC __glewGenProgramsNV = NULL; PFNGLGETPROGRAMPARAMETERDVNVPROC __glewGetProgramParameterdvNV = NULL; PFNGLGETPROGRAMPARAMETERFVNVPROC __glewGetProgramParameterfvNV = NULL; PFNGLGETPROGRAMSTRINGNVPROC __glewGetProgramStringNV = NULL; PFNGLGETPROGRAMIVNVPROC __glewGetProgramivNV = NULL; PFNGLGETTRACKMATRIXIVNVPROC __glewGetTrackMatrixivNV = NULL; PFNGLGETVERTEXATTRIBPOINTERVNVPROC __glewGetVertexAttribPointervNV = NULL; PFNGLGETVERTEXATTRIBDVNVPROC __glewGetVertexAttribdvNV = NULL; PFNGLGETVERTEXATTRIBFVNVPROC __glewGetVertexAttribfvNV = NULL; PFNGLGETVERTEXATTRIBIVNVPROC __glewGetVertexAttribivNV = NULL; PFNGLISPROGRAMNVPROC __glewIsProgramNV = NULL; PFNGLLOADPROGRAMNVPROC __glewLoadProgramNV = NULL; PFNGLPROGRAMPARAMETER4DNVPROC __glewProgramParameter4dNV = NULL; PFNGLPROGRAMPARAMETER4DVNVPROC __glewProgramParameter4dvNV = NULL; PFNGLPROGRAMPARAMETER4FNVPROC __glewProgramParameter4fNV = NULL; PFNGLPROGRAMPARAMETER4FVNVPROC __glewProgramParameter4fvNV = NULL; PFNGLPROGRAMPARAMETERS4DVNVPROC __glewProgramParameters4dvNV = NULL; PFNGLPROGRAMPARAMETERS4FVNVPROC __glewProgramParameters4fvNV = NULL; PFNGLREQUESTRESIDENTPROGRAMSNVPROC __glewRequestResidentProgramsNV = NULL; PFNGLTRACKMATRIXNVPROC __glewTrackMatrixNV = NULL; PFNGLVERTEXATTRIB1DNVPROC __glewVertexAttrib1dNV = NULL; PFNGLVERTEXATTRIB1DVNVPROC __glewVertexAttrib1dvNV = NULL; PFNGLVERTEXATTRIB1FNVPROC __glewVertexAttrib1fNV = NULL; PFNGLVERTEXATTRIB1FVNVPROC __glewVertexAttrib1fvNV = NULL; PFNGLVERTEXATTRIB1SNVPROC __glewVertexAttrib1sNV = NULL; PFNGLVERTEXATTRIB1SVNVPROC __glewVertexAttrib1svNV = NULL; PFNGLVERTEXATTRIB2DNVPROC __glewVertexAttrib2dNV = NULL; PFNGLVERTEXATTRIB2DVNVPROC __glewVertexAttrib2dvNV = NULL; PFNGLVERTEXATTRIB2FNVPROC __glewVertexAttrib2fNV = NULL; PFNGLVERTEXATTRIB2FVNVPROC __glewVertexAttrib2fvNV = NULL; PFNGLVERTEXATTRIB2SNVPROC __glewVertexAttrib2sNV = NULL; PFNGLVERTEXATTRIB2SVNVPROC __glewVertexAttrib2svNV = NULL; PFNGLVERTEXATTRIB3DNVPROC __glewVertexAttrib3dNV = NULL; PFNGLVERTEXATTRIB3DVNVPROC __glewVertexAttrib3dvNV = NULL; PFNGLVERTEXATTRIB3FNVPROC __glewVertexAttrib3fNV = NULL; PFNGLVERTEXATTRIB3FVNVPROC __glewVertexAttrib3fvNV = NULL; PFNGLVERTEXATTRIB3SNVPROC __glewVertexAttrib3sNV = NULL; PFNGLVERTEXATTRIB3SVNVPROC __glewVertexAttrib3svNV = NULL; PFNGLVERTEXATTRIB4DNVPROC __glewVertexAttrib4dNV = NULL; PFNGLVERTEXATTRIB4DVNVPROC __glewVertexAttrib4dvNV = NULL; PFNGLVERTEXATTRIB4FNVPROC __glewVertexAttrib4fNV = NULL; PFNGLVERTEXATTRIB4FVNVPROC __glewVertexAttrib4fvNV = NULL; PFNGLVERTEXATTRIB4SNVPROC __glewVertexAttrib4sNV = NULL; PFNGLVERTEXATTRIB4SVNVPROC __glewVertexAttrib4svNV = NULL; PFNGLVERTEXATTRIB4UBNVPROC __glewVertexAttrib4ubNV = NULL; PFNGLVERTEXATTRIB4UBVNVPROC __glewVertexAttrib4ubvNV = NULL; PFNGLVERTEXATTRIBPOINTERNVPROC __glewVertexAttribPointerNV = NULL; PFNGLVERTEXATTRIBS1DVNVPROC __glewVertexAttribs1dvNV = NULL; PFNGLVERTEXATTRIBS1FVNVPROC __glewVertexAttribs1fvNV = NULL; PFNGLVERTEXATTRIBS1SVNVPROC __glewVertexAttribs1svNV = NULL; PFNGLVERTEXATTRIBS2DVNVPROC __glewVertexAttribs2dvNV = NULL; PFNGLVERTEXATTRIBS2FVNVPROC __glewVertexAttribs2fvNV = NULL; PFNGLVERTEXATTRIBS2SVNVPROC __glewVertexAttribs2svNV = NULL; PFNGLVERTEXATTRIBS3DVNVPROC __glewVertexAttribs3dvNV = NULL; PFNGLVERTEXATTRIBS3FVNVPROC __glewVertexAttribs3fvNV = NULL; PFNGLVERTEXATTRIBS3SVNVPROC __glewVertexAttribs3svNV = NULL; PFNGLVERTEXATTRIBS4DVNVPROC __glewVertexAttribs4dvNV = NULL; PFNGLVERTEXATTRIBS4FVNVPROC __glewVertexAttribs4fvNV = NULL; PFNGLVERTEXATTRIBS4SVNVPROC __glewVertexAttribs4svNV = NULL; PFNGLVERTEXATTRIBS4UBVNVPROC __glewVertexAttribs4ubvNV = NULL; PFNGLBEGINVIDEOCAPTURENVPROC __glewBeginVideoCaptureNV = NULL; PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC __glewBindVideoCaptureStreamBufferNV = NULL; PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC __glewBindVideoCaptureStreamTextureNV = NULL; PFNGLENDVIDEOCAPTURENVPROC __glewEndVideoCaptureNV = NULL; PFNGLGETVIDEOCAPTURESTREAMDVNVPROC __glewGetVideoCaptureStreamdvNV = NULL; PFNGLGETVIDEOCAPTURESTREAMFVNVPROC __glewGetVideoCaptureStreamfvNV = NULL; PFNGLGETVIDEOCAPTURESTREAMIVNVPROC __glewGetVideoCaptureStreamivNV = NULL; PFNGLGETVIDEOCAPTUREIVNVPROC __glewGetVideoCaptureivNV = NULL; PFNGLVIDEOCAPTURENVPROC __glewVideoCaptureNV = NULL; PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC __glewVideoCaptureStreamParameterdvNV = NULL; PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC __glewVideoCaptureStreamParameterfvNV = NULL; PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC __glewVideoCaptureStreamParameterivNV = NULL; PFNGLCLEARDEPTHFOESPROC __glewClearDepthfOES = NULL; PFNGLCLIPPLANEFOESPROC __glewClipPlanefOES = NULL; PFNGLDEPTHRANGEFOESPROC __glewDepthRangefOES = NULL; PFNGLFRUSTUMFOESPROC __glewFrustumfOES = NULL; PFNGLGETCLIPPLANEFOESPROC __glewGetClipPlanefOES = NULL; PFNGLORTHOFOESPROC __glewOrthofOES = NULL; PFNGLERRORSTRINGREGALPROC __glewErrorStringREGAL = NULL; PFNGLGETEXTENSIONREGALPROC __glewGetExtensionREGAL = NULL; PFNGLISSUPPORTEDREGALPROC __glewIsSupportedREGAL = NULL; PFNGLDETAILTEXFUNCSGISPROC __glewDetailTexFuncSGIS = NULL; PFNGLGETDETAILTEXFUNCSGISPROC __glewGetDetailTexFuncSGIS = NULL; PFNGLFOGFUNCSGISPROC __glewFogFuncSGIS = NULL; PFNGLGETFOGFUNCSGISPROC __glewGetFogFuncSGIS = NULL; PFNGLSAMPLEMASKSGISPROC __glewSampleMaskSGIS = NULL; PFNGLSAMPLEPATTERNSGISPROC __glewSamplePatternSGIS = NULL; PFNGLGETSHARPENTEXFUNCSGISPROC __glewGetSharpenTexFuncSGIS = NULL; PFNGLSHARPENTEXFUNCSGISPROC __glewSharpenTexFuncSGIS = NULL; PFNGLTEXIMAGE4DSGISPROC __glewTexImage4DSGIS = NULL; PFNGLTEXSUBIMAGE4DSGISPROC __glewTexSubImage4DSGIS = NULL; PFNGLGETTEXFILTERFUNCSGISPROC __glewGetTexFilterFuncSGIS = NULL; PFNGLTEXFILTERFUNCSGISPROC __glewTexFilterFuncSGIS = NULL; PFNGLASYNCMARKERSGIXPROC __glewAsyncMarkerSGIX = NULL; PFNGLDELETEASYNCMARKERSSGIXPROC __glewDeleteAsyncMarkersSGIX = NULL; PFNGLFINISHASYNCSGIXPROC __glewFinishAsyncSGIX = NULL; PFNGLGENASYNCMARKERSSGIXPROC __glewGenAsyncMarkersSGIX = NULL; PFNGLISASYNCMARKERSGIXPROC __glewIsAsyncMarkerSGIX = NULL; PFNGLPOLLASYNCSGIXPROC __glewPollAsyncSGIX = NULL; PFNGLFLUSHRASTERSGIXPROC __glewFlushRasterSGIX = NULL; PFNGLTEXTUREFOGSGIXPROC __glewTextureFogSGIX = NULL; PFNGLFRAGMENTCOLORMATERIALSGIXPROC __glewFragmentColorMaterialSGIX = NULL; PFNGLFRAGMENTLIGHTMODELFSGIXPROC __glewFragmentLightModelfSGIX = NULL; PFNGLFRAGMENTLIGHTMODELFVSGIXPROC __glewFragmentLightModelfvSGIX = NULL; PFNGLFRAGMENTLIGHTMODELISGIXPROC __glewFragmentLightModeliSGIX = NULL; PFNGLFRAGMENTLIGHTMODELIVSGIXPROC __glewFragmentLightModelivSGIX = NULL; PFNGLFRAGMENTLIGHTFSGIXPROC __glewFragmentLightfSGIX = NULL; PFNGLFRAGMENTLIGHTFVSGIXPROC __glewFragmentLightfvSGIX = NULL; PFNGLFRAGMENTLIGHTISGIXPROC __glewFragmentLightiSGIX = NULL; PFNGLFRAGMENTLIGHTIVSGIXPROC __glewFragmentLightivSGIX = NULL; PFNGLFRAGMENTMATERIALFSGIXPROC __glewFragmentMaterialfSGIX = NULL; PFNGLFRAGMENTMATERIALFVSGIXPROC __glewFragmentMaterialfvSGIX = NULL; PFNGLFRAGMENTMATERIALISGIXPROC __glewFragmentMaterialiSGIX = NULL; PFNGLFRAGMENTMATERIALIVSGIXPROC __glewFragmentMaterialivSGIX = NULL; PFNGLGETFRAGMENTLIGHTFVSGIXPROC __glewGetFragmentLightfvSGIX = NULL; PFNGLGETFRAGMENTLIGHTIVSGIXPROC __glewGetFragmentLightivSGIX = NULL; PFNGLGETFRAGMENTMATERIALFVSGIXPROC __glewGetFragmentMaterialfvSGIX = NULL; PFNGLGETFRAGMENTMATERIALIVSGIXPROC __glewGetFragmentMaterialivSGIX = NULL; PFNGLFRAMEZOOMSGIXPROC __glewFrameZoomSGIX = NULL; PFNGLPIXELTEXGENSGIXPROC __glewPixelTexGenSGIX = NULL; PFNGLREFERENCEPLANESGIXPROC __glewReferencePlaneSGIX = NULL; PFNGLSPRITEPARAMETERFSGIXPROC __glewSpriteParameterfSGIX = NULL; PFNGLSPRITEPARAMETERFVSGIXPROC __glewSpriteParameterfvSGIX = NULL; PFNGLSPRITEPARAMETERISGIXPROC __glewSpriteParameteriSGIX = NULL; PFNGLSPRITEPARAMETERIVSGIXPROC __glewSpriteParameterivSGIX = NULL; PFNGLTAGSAMPLEBUFFERSGIXPROC __glewTagSampleBufferSGIX = NULL; PFNGLCOLORTABLEPARAMETERFVSGIPROC __glewColorTableParameterfvSGI = NULL; PFNGLCOLORTABLEPARAMETERIVSGIPROC __glewColorTableParameterivSGI = NULL; PFNGLCOLORTABLESGIPROC __glewColorTableSGI = NULL; PFNGLCOPYCOLORTABLESGIPROC __glewCopyColorTableSGI = NULL; PFNGLGETCOLORTABLEPARAMETERFVSGIPROC __glewGetColorTableParameterfvSGI = NULL; PFNGLGETCOLORTABLEPARAMETERIVSGIPROC __glewGetColorTableParameterivSGI = NULL; PFNGLGETCOLORTABLESGIPROC __glewGetColorTableSGI = NULL; PFNGLFINISHTEXTURESUNXPROC __glewFinishTextureSUNX = NULL; PFNGLGLOBALALPHAFACTORBSUNPROC __glewGlobalAlphaFactorbSUN = NULL; PFNGLGLOBALALPHAFACTORDSUNPROC __glewGlobalAlphaFactordSUN = NULL; PFNGLGLOBALALPHAFACTORFSUNPROC __glewGlobalAlphaFactorfSUN = NULL; PFNGLGLOBALALPHAFACTORISUNPROC __glewGlobalAlphaFactoriSUN = NULL; PFNGLGLOBALALPHAFACTORSSUNPROC __glewGlobalAlphaFactorsSUN = NULL; PFNGLGLOBALALPHAFACTORUBSUNPROC __glewGlobalAlphaFactorubSUN = NULL; PFNGLGLOBALALPHAFACTORUISUNPROC __glewGlobalAlphaFactoruiSUN = NULL; PFNGLGLOBALALPHAFACTORUSSUNPROC __glewGlobalAlphaFactorusSUN = NULL; PFNGLREADVIDEOPIXELSSUNPROC __glewReadVideoPixelsSUN = NULL; PFNGLREPLACEMENTCODEPOINTERSUNPROC __glewReplacementCodePointerSUN = NULL; PFNGLREPLACEMENTCODEUBSUNPROC __glewReplacementCodeubSUN = NULL; PFNGLREPLACEMENTCODEUBVSUNPROC __glewReplacementCodeubvSUN = NULL; PFNGLREPLACEMENTCODEUISUNPROC __glewReplacementCodeuiSUN = NULL; PFNGLREPLACEMENTCODEUIVSUNPROC __glewReplacementCodeuivSUN = NULL; PFNGLREPLACEMENTCODEUSSUNPROC __glewReplacementCodeusSUN = NULL; PFNGLREPLACEMENTCODEUSVSUNPROC __glewReplacementCodeusvSUN = NULL; PFNGLCOLOR3FVERTEX3FSUNPROC __glewColor3fVertex3fSUN = NULL; PFNGLCOLOR3FVERTEX3FVSUNPROC __glewColor3fVertex3fvSUN = NULL; PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewColor4fNormal3fVertex3fSUN = NULL; PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewColor4fNormal3fVertex3fvSUN = NULL; PFNGLCOLOR4UBVERTEX2FSUNPROC __glewColor4ubVertex2fSUN = NULL; PFNGLCOLOR4UBVERTEX2FVSUNPROC __glewColor4ubVertex2fvSUN = NULL; PFNGLCOLOR4UBVERTEX3FSUNPROC __glewColor4ubVertex3fSUN = NULL; PFNGLCOLOR4UBVERTEX3FVSUNPROC __glewColor4ubVertex3fvSUN = NULL; PFNGLNORMAL3FVERTEX3FSUNPROC __glewNormal3fVertex3fSUN = NULL; PFNGLNORMAL3FVERTEX3FVSUNPROC __glewNormal3fVertex3fvSUN = NULL; PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC __glewReplacementCodeuiColor3fVertex3fSUN = NULL; PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC __glewReplacementCodeuiColor3fVertex3fvSUN = NULL; PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiColor4fNormal3fVertex3fSUN = NULL; PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiColor4fNormal3fVertex3fvSUN = NULL; PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC __glewReplacementCodeuiColor4ubVertex3fSUN = NULL; PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC __glewReplacementCodeuiColor4ubVertex3fvSUN = NULL; PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiNormal3fVertex3fSUN = NULL; PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiNormal3fVertex3fvSUN = NULL; PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN = NULL; PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN = NULL; PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fNormal3fVertex3fSUN = NULL; PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN = NULL; PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fVertex3fSUN = NULL; PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fVertex3fvSUN = NULL; PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC __glewReplacementCodeuiVertex3fSUN = NULL; PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC __glewReplacementCodeuiVertex3fvSUN = NULL; PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC __glewTexCoord2fColor3fVertex3fSUN = NULL; PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC __glewTexCoord2fColor3fVertex3fvSUN = NULL; PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewTexCoord2fColor4fNormal3fVertex3fSUN = NULL; PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewTexCoord2fColor4fNormal3fVertex3fvSUN = NULL; PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC __glewTexCoord2fColor4ubVertex3fSUN = NULL; PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC __glewTexCoord2fColor4ubVertex3fvSUN = NULL; PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC __glewTexCoord2fNormal3fVertex3fSUN = NULL; PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC __glewTexCoord2fNormal3fVertex3fvSUN = NULL; PFNGLTEXCOORD2FVERTEX3FSUNPROC __glewTexCoord2fVertex3fSUN = NULL; PFNGLTEXCOORD2FVERTEX3FVSUNPROC __glewTexCoord2fVertex3fvSUN = NULL; PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC __glewTexCoord4fColor4fNormal3fVertex4fSUN = NULL; PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC __glewTexCoord4fColor4fNormal3fVertex4fvSUN = NULL; PFNGLTEXCOORD4FVERTEX4FSUNPROC __glewTexCoord4fVertex4fSUN = NULL; PFNGLTEXCOORD4FVERTEX4FVSUNPROC __glewTexCoord4fVertex4fvSUN = NULL; PFNGLADDSWAPHINTRECTWINPROC __glewAddSwapHintRectWIN = NULL; #endif /* !WIN32 || !GLEW_MX */ #if !defined(GLEW_MX) GLboolean __GLEW_VERSION_1_1 = GL_FALSE; GLboolean __GLEW_VERSION_1_2 = GL_FALSE; GLboolean __GLEW_VERSION_1_2_1 = GL_FALSE; GLboolean __GLEW_VERSION_1_3 = GL_FALSE; GLboolean __GLEW_VERSION_1_4 = GL_FALSE; GLboolean __GLEW_VERSION_1_5 = GL_FALSE; GLboolean __GLEW_VERSION_2_0 = GL_FALSE; GLboolean __GLEW_VERSION_2_1 = GL_FALSE; GLboolean __GLEW_VERSION_3_0 = GL_FALSE; GLboolean __GLEW_VERSION_3_1 = GL_FALSE; GLboolean __GLEW_VERSION_3_2 = GL_FALSE; GLboolean __GLEW_VERSION_3_3 = GL_FALSE; GLboolean __GLEW_VERSION_4_0 = GL_FALSE; GLboolean __GLEW_VERSION_4_1 = GL_FALSE; GLboolean __GLEW_VERSION_4_2 = GL_FALSE; GLboolean __GLEW_VERSION_4_3 = GL_FALSE; GLboolean __GLEW_3DFX_multisample = GL_FALSE; GLboolean __GLEW_3DFX_tbuffer = GL_FALSE; GLboolean __GLEW_3DFX_texture_compression_FXT1 = GL_FALSE; GLboolean __GLEW_AMD_blend_minmax_factor = GL_FALSE; GLboolean __GLEW_AMD_conservative_depth = GL_FALSE; GLboolean __GLEW_AMD_debug_output = GL_FALSE; GLboolean __GLEW_AMD_depth_clamp_separate = GL_FALSE; GLboolean __GLEW_AMD_draw_buffers_blend = GL_FALSE; GLboolean __GLEW_AMD_multi_draw_indirect = GL_FALSE; GLboolean __GLEW_AMD_name_gen_delete = GL_FALSE; GLboolean __GLEW_AMD_performance_monitor = GL_FALSE; GLboolean __GLEW_AMD_pinned_memory = GL_FALSE; GLboolean __GLEW_AMD_query_buffer_object = GL_FALSE; GLboolean __GLEW_AMD_sample_positions = GL_FALSE; GLboolean __GLEW_AMD_seamless_cubemap_per_texture = GL_FALSE; GLboolean __GLEW_AMD_shader_stencil_export = GL_FALSE; GLboolean __GLEW_AMD_stencil_operation_extended = GL_FALSE; GLboolean __GLEW_AMD_texture_texture4 = GL_FALSE; GLboolean __GLEW_AMD_transform_feedback3_lines_triangles = GL_FALSE; GLboolean __GLEW_AMD_vertex_shader_layer = GL_FALSE; GLboolean __GLEW_AMD_vertex_shader_tessellator = GL_FALSE; GLboolean __GLEW_AMD_vertex_shader_viewport_index = GL_FALSE; GLboolean __GLEW_APPLE_aux_depth_stencil = GL_FALSE; GLboolean __GLEW_APPLE_client_storage = GL_FALSE; GLboolean __GLEW_APPLE_element_array = GL_FALSE; GLboolean __GLEW_APPLE_fence = GL_FALSE; GLboolean __GLEW_APPLE_float_pixels = GL_FALSE; GLboolean __GLEW_APPLE_flush_buffer_range = GL_FALSE; GLboolean __GLEW_APPLE_object_purgeable = GL_FALSE; GLboolean __GLEW_APPLE_pixel_buffer = GL_FALSE; GLboolean __GLEW_APPLE_rgb_422 = GL_FALSE; GLboolean __GLEW_APPLE_row_bytes = GL_FALSE; GLboolean __GLEW_APPLE_specular_vector = GL_FALSE; GLboolean __GLEW_APPLE_texture_range = GL_FALSE; GLboolean __GLEW_APPLE_transform_hint = GL_FALSE; GLboolean __GLEW_APPLE_vertex_array_object = GL_FALSE; GLboolean __GLEW_APPLE_vertex_array_range = GL_FALSE; GLboolean __GLEW_APPLE_vertex_program_evaluators = GL_FALSE; GLboolean __GLEW_APPLE_ycbcr_422 = GL_FALSE; GLboolean __GLEW_ARB_ES2_compatibility = GL_FALSE; GLboolean __GLEW_ARB_ES3_compatibility = GL_FALSE; GLboolean __GLEW_ARB_arrays_of_arrays = GL_FALSE; GLboolean __GLEW_ARB_base_instance = GL_FALSE; GLboolean __GLEW_ARB_blend_func_extended = GL_FALSE; GLboolean __GLEW_ARB_cl_event = GL_FALSE; GLboolean __GLEW_ARB_clear_buffer_object = GL_FALSE; GLboolean __GLEW_ARB_color_buffer_float = GL_FALSE; GLboolean __GLEW_ARB_compatibility = GL_FALSE; GLboolean __GLEW_ARB_compressed_texture_pixel_storage = GL_FALSE; GLboolean __GLEW_ARB_compute_shader = GL_FALSE; GLboolean __GLEW_ARB_conservative_depth = GL_FALSE; GLboolean __GLEW_ARB_copy_buffer = GL_FALSE; GLboolean __GLEW_ARB_copy_image = GL_FALSE; GLboolean __GLEW_ARB_debug_output = GL_FALSE; GLboolean __GLEW_ARB_depth_buffer_float = GL_FALSE; GLboolean __GLEW_ARB_depth_clamp = GL_FALSE; GLboolean __GLEW_ARB_depth_texture = GL_FALSE; GLboolean __GLEW_ARB_draw_buffers = GL_FALSE; GLboolean __GLEW_ARB_draw_buffers_blend = GL_FALSE; GLboolean __GLEW_ARB_draw_elements_base_vertex = GL_FALSE; GLboolean __GLEW_ARB_draw_indirect = GL_FALSE; GLboolean __GLEW_ARB_draw_instanced = GL_FALSE; GLboolean __GLEW_ARB_explicit_attrib_location = GL_FALSE; GLboolean __GLEW_ARB_explicit_uniform_location = GL_FALSE; GLboolean __GLEW_ARB_fragment_coord_conventions = GL_FALSE; GLboolean __GLEW_ARB_fragment_layer_viewport = GL_FALSE; GLboolean __GLEW_ARB_fragment_program = GL_FALSE; GLboolean __GLEW_ARB_fragment_program_shadow = GL_FALSE; GLboolean __GLEW_ARB_fragment_shader = GL_FALSE; GLboolean __GLEW_ARB_framebuffer_no_attachments = GL_FALSE; GLboolean __GLEW_ARB_framebuffer_object = GL_FALSE; GLboolean __GLEW_ARB_framebuffer_sRGB = GL_FALSE; GLboolean __GLEW_ARB_geometry_shader4 = GL_FALSE; GLboolean __GLEW_ARB_get_program_binary = GL_FALSE; GLboolean __GLEW_ARB_gpu_shader5 = GL_FALSE; GLboolean __GLEW_ARB_gpu_shader_fp64 = GL_FALSE; GLboolean __GLEW_ARB_half_float_pixel = GL_FALSE; GLboolean __GLEW_ARB_half_float_vertex = GL_FALSE; GLboolean __GLEW_ARB_imaging = GL_FALSE; GLboolean __GLEW_ARB_instanced_arrays = GL_FALSE; GLboolean __GLEW_ARB_internalformat_query = GL_FALSE; GLboolean __GLEW_ARB_internalformat_query2 = GL_FALSE; GLboolean __GLEW_ARB_invalidate_subdata = GL_FALSE; GLboolean __GLEW_ARB_map_buffer_alignment = GL_FALSE; GLboolean __GLEW_ARB_map_buffer_range = GL_FALSE; GLboolean __GLEW_ARB_matrix_palette = GL_FALSE; GLboolean __GLEW_ARB_multi_draw_indirect = GL_FALSE; GLboolean __GLEW_ARB_multisample = GL_FALSE; GLboolean __GLEW_ARB_multitexture = GL_FALSE; GLboolean __GLEW_ARB_occlusion_query = GL_FALSE; GLboolean __GLEW_ARB_occlusion_query2 = GL_FALSE; GLboolean __GLEW_ARB_pixel_buffer_object = GL_FALSE; GLboolean __GLEW_ARB_point_parameters = GL_FALSE; GLboolean __GLEW_ARB_point_sprite = GL_FALSE; GLboolean __GLEW_ARB_program_interface_query = GL_FALSE; GLboolean __GLEW_ARB_provoking_vertex = GL_FALSE; GLboolean __GLEW_ARB_robust_buffer_access_behavior = GL_FALSE; GLboolean __GLEW_ARB_robustness = GL_FALSE; GLboolean __GLEW_ARB_robustness_application_isolation = GL_FALSE; GLboolean __GLEW_ARB_robustness_share_group_isolation = GL_FALSE; GLboolean __GLEW_ARB_sample_shading = GL_FALSE; GLboolean __GLEW_ARB_sampler_objects = GL_FALSE; GLboolean __GLEW_ARB_seamless_cube_map = GL_FALSE; GLboolean __GLEW_ARB_separate_shader_objects = GL_FALSE; GLboolean __GLEW_ARB_shader_atomic_counters = GL_FALSE; GLboolean __GLEW_ARB_shader_bit_encoding = GL_FALSE; GLboolean __GLEW_ARB_shader_image_load_store = GL_FALSE; GLboolean __GLEW_ARB_shader_image_size = GL_FALSE; GLboolean __GLEW_ARB_shader_objects = GL_FALSE; GLboolean __GLEW_ARB_shader_precision = GL_FALSE; GLboolean __GLEW_ARB_shader_stencil_export = GL_FALSE; GLboolean __GLEW_ARB_shader_storage_buffer_object = GL_FALSE; GLboolean __GLEW_ARB_shader_subroutine = GL_FALSE; GLboolean __GLEW_ARB_shader_texture_lod = GL_FALSE; GLboolean __GLEW_ARB_shading_language_100 = GL_FALSE; GLboolean __GLEW_ARB_shading_language_420pack = GL_FALSE; GLboolean __GLEW_ARB_shading_language_include = GL_FALSE; GLboolean __GLEW_ARB_shading_language_packing = GL_FALSE; GLboolean __GLEW_ARB_shadow = GL_FALSE; GLboolean __GLEW_ARB_shadow_ambient = GL_FALSE; GLboolean __GLEW_ARB_stencil_texturing = GL_FALSE; GLboolean __GLEW_ARB_sync = GL_FALSE; GLboolean __GLEW_ARB_tessellation_shader = GL_FALSE; GLboolean __GLEW_ARB_texture_border_clamp = GL_FALSE; GLboolean __GLEW_ARB_texture_buffer_object = GL_FALSE; GLboolean __GLEW_ARB_texture_buffer_object_rgb32 = GL_FALSE; GLboolean __GLEW_ARB_texture_buffer_range = GL_FALSE; GLboolean __GLEW_ARB_texture_compression = GL_FALSE; GLboolean __GLEW_ARB_texture_compression_bptc = GL_FALSE; GLboolean __GLEW_ARB_texture_compression_rgtc = GL_FALSE; GLboolean __GLEW_ARB_texture_cube_map = GL_FALSE; GLboolean __GLEW_ARB_texture_cube_map_array = GL_FALSE; GLboolean __GLEW_ARB_texture_env_add = GL_FALSE; GLboolean __GLEW_ARB_texture_env_combine = GL_FALSE; GLboolean __GLEW_ARB_texture_env_crossbar = GL_FALSE; GLboolean __GLEW_ARB_texture_env_dot3 = GL_FALSE; GLboolean __GLEW_ARB_texture_float = GL_FALSE; GLboolean __GLEW_ARB_texture_gather = GL_FALSE; GLboolean __GLEW_ARB_texture_mirrored_repeat = GL_FALSE; GLboolean __GLEW_ARB_texture_multisample = GL_FALSE; GLboolean __GLEW_ARB_texture_non_power_of_two = GL_FALSE; GLboolean __GLEW_ARB_texture_query_levels = GL_FALSE; GLboolean __GLEW_ARB_texture_query_lod = GL_FALSE; GLboolean __GLEW_ARB_texture_rectangle = GL_FALSE; GLboolean __GLEW_ARB_texture_rg = GL_FALSE; GLboolean __GLEW_ARB_texture_rgb10_a2ui = GL_FALSE; GLboolean __GLEW_ARB_texture_storage = GL_FALSE; GLboolean __GLEW_ARB_texture_storage_multisample = GL_FALSE; GLboolean __GLEW_ARB_texture_swizzle = GL_FALSE; GLboolean __GLEW_ARB_texture_view = GL_FALSE; GLboolean __GLEW_ARB_timer_query = GL_FALSE; GLboolean __GLEW_ARB_transform_feedback2 = GL_FALSE; GLboolean __GLEW_ARB_transform_feedback3 = GL_FALSE; GLboolean __GLEW_ARB_transform_feedback_instanced = GL_FALSE; GLboolean __GLEW_ARB_transpose_matrix = GL_FALSE; GLboolean __GLEW_ARB_uniform_buffer_object = GL_FALSE; GLboolean __GLEW_ARB_vertex_array_bgra = GL_FALSE; GLboolean __GLEW_ARB_vertex_array_object = GL_FALSE; GLboolean __GLEW_ARB_vertex_attrib_64bit = GL_FALSE; GLboolean __GLEW_ARB_vertex_attrib_binding = GL_FALSE; GLboolean __GLEW_ARB_vertex_blend = GL_FALSE; GLboolean __GLEW_ARB_vertex_buffer_object = GL_FALSE; GLboolean __GLEW_ARB_vertex_program = GL_FALSE; GLboolean __GLEW_ARB_vertex_shader = GL_FALSE; GLboolean __GLEW_ARB_vertex_type_2_10_10_10_rev = GL_FALSE; GLboolean __GLEW_ARB_viewport_array = GL_FALSE; GLboolean __GLEW_ARB_window_pos = GL_FALSE; GLboolean __GLEW_ATIX_point_sprites = GL_FALSE; GLboolean __GLEW_ATIX_texture_env_combine3 = GL_FALSE; GLboolean __GLEW_ATIX_texture_env_route = GL_FALSE; GLboolean __GLEW_ATIX_vertex_shader_output_point_size = GL_FALSE; GLboolean __GLEW_ATI_draw_buffers = GL_FALSE; GLboolean __GLEW_ATI_element_array = GL_FALSE; GLboolean __GLEW_ATI_envmap_bumpmap = GL_FALSE; GLboolean __GLEW_ATI_fragment_shader = GL_FALSE; GLboolean __GLEW_ATI_map_object_buffer = GL_FALSE; GLboolean __GLEW_ATI_meminfo = GL_FALSE; GLboolean __GLEW_ATI_pn_triangles = GL_FALSE; GLboolean __GLEW_ATI_separate_stencil = GL_FALSE; GLboolean __GLEW_ATI_shader_texture_lod = GL_FALSE; GLboolean __GLEW_ATI_text_fragment_shader = GL_FALSE; GLboolean __GLEW_ATI_texture_compression_3dc = GL_FALSE; GLboolean __GLEW_ATI_texture_env_combine3 = GL_FALSE; GLboolean __GLEW_ATI_texture_float = GL_FALSE; GLboolean __GLEW_ATI_texture_mirror_once = GL_FALSE; GLboolean __GLEW_ATI_vertex_array_object = GL_FALSE; GLboolean __GLEW_ATI_vertex_attrib_array_object = GL_FALSE; GLboolean __GLEW_ATI_vertex_streams = GL_FALSE; GLboolean __GLEW_EXT_422_pixels = GL_FALSE; GLboolean __GLEW_EXT_Cg_shader = GL_FALSE; GLboolean __GLEW_EXT_abgr = GL_FALSE; GLboolean __GLEW_EXT_bgra = GL_FALSE; GLboolean __GLEW_EXT_bindable_uniform = GL_FALSE; GLboolean __GLEW_EXT_blend_color = GL_FALSE; GLboolean __GLEW_EXT_blend_equation_separate = GL_FALSE; GLboolean __GLEW_EXT_blend_func_separate = GL_FALSE; GLboolean __GLEW_EXT_blend_logic_op = GL_FALSE; GLboolean __GLEW_EXT_blend_minmax = GL_FALSE; GLboolean __GLEW_EXT_blend_subtract = GL_FALSE; GLboolean __GLEW_EXT_clip_volume_hint = GL_FALSE; GLboolean __GLEW_EXT_cmyka = GL_FALSE; GLboolean __GLEW_EXT_color_subtable = GL_FALSE; GLboolean __GLEW_EXT_compiled_vertex_array = GL_FALSE; GLboolean __GLEW_EXT_convolution = GL_FALSE; GLboolean __GLEW_EXT_coordinate_frame = GL_FALSE; GLboolean __GLEW_EXT_copy_texture = GL_FALSE; GLboolean __GLEW_EXT_cull_vertex = GL_FALSE; GLboolean __GLEW_EXT_debug_marker = GL_FALSE; GLboolean __GLEW_EXT_depth_bounds_test = GL_FALSE; GLboolean __GLEW_EXT_direct_state_access = GL_FALSE; GLboolean __GLEW_EXT_draw_buffers2 = GL_FALSE; GLboolean __GLEW_EXT_draw_instanced = GL_FALSE; GLboolean __GLEW_EXT_draw_range_elements = GL_FALSE; GLboolean __GLEW_EXT_fog_coord = GL_FALSE; GLboolean __GLEW_EXT_fragment_lighting = GL_FALSE; GLboolean __GLEW_EXT_framebuffer_blit = GL_FALSE; GLboolean __GLEW_EXT_framebuffer_multisample = GL_FALSE; GLboolean __GLEW_EXT_framebuffer_multisample_blit_scaled = GL_FALSE; GLboolean __GLEW_EXT_framebuffer_object = GL_FALSE; GLboolean __GLEW_EXT_framebuffer_sRGB = GL_FALSE; GLboolean __GLEW_EXT_geometry_shader4 = GL_FALSE; GLboolean __GLEW_EXT_gpu_program_parameters = GL_FALSE; GLboolean __GLEW_EXT_gpu_shader4 = GL_FALSE; GLboolean __GLEW_EXT_histogram = GL_FALSE; GLboolean __GLEW_EXT_index_array_formats = GL_FALSE; GLboolean __GLEW_EXT_index_func = GL_FALSE; GLboolean __GLEW_EXT_index_material = GL_FALSE; GLboolean __GLEW_EXT_index_texture = GL_FALSE; GLboolean __GLEW_EXT_light_texture = GL_FALSE; GLboolean __GLEW_EXT_misc_attribute = GL_FALSE; GLboolean __GLEW_EXT_multi_draw_arrays = GL_FALSE; GLboolean __GLEW_EXT_multisample = GL_FALSE; GLboolean __GLEW_EXT_packed_depth_stencil = GL_FALSE; GLboolean __GLEW_EXT_packed_float = GL_FALSE; GLboolean __GLEW_EXT_packed_pixels = GL_FALSE; GLboolean __GLEW_EXT_paletted_texture = GL_FALSE; GLboolean __GLEW_EXT_pixel_buffer_object = GL_FALSE; GLboolean __GLEW_EXT_pixel_transform = GL_FALSE; GLboolean __GLEW_EXT_pixel_transform_color_table = GL_FALSE; GLboolean __GLEW_EXT_point_parameters = GL_FALSE; GLboolean __GLEW_EXT_polygon_offset = GL_FALSE; GLboolean __GLEW_EXT_provoking_vertex = GL_FALSE; GLboolean __GLEW_EXT_rescale_normal = GL_FALSE; GLboolean __GLEW_EXT_scene_marker = GL_FALSE; GLboolean __GLEW_EXT_secondary_color = GL_FALSE; GLboolean __GLEW_EXT_separate_shader_objects = GL_FALSE; GLboolean __GLEW_EXT_separate_specular_color = GL_FALSE; GLboolean __GLEW_EXT_shader_image_load_store = GL_FALSE; GLboolean __GLEW_EXT_shadow_funcs = GL_FALSE; GLboolean __GLEW_EXT_shared_texture_palette = GL_FALSE; GLboolean __GLEW_EXT_stencil_clear_tag = GL_FALSE; GLboolean __GLEW_EXT_stencil_two_side = GL_FALSE; GLboolean __GLEW_EXT_stencil_wrap = GL_FALSE; GLboolean __GLEW_EXT_subtexture = GL_FALSE; GLboolean __GLEW_EXT_texture = GL_FALSE; GLboolean __GLEW_EXT_texture3D = GL_FALSE; GLboolean __GLEW_EXT_texture_array = GL_FALSE; GLboolean __GLEW_EXT_texture_buffer_object = GL_FALSE; GLboolean __GLEW_EXT_texture_compression_dxt1 = GL_FALSE; GLboolean __GLEW_EXT_texture_compression_latc = GL_FALSE; GLboolean __GLEW_EXT_texture_compression_rgtc = GL_FALSE; GLboolean __GLEW_EXT_texture_compression_s3tc = GL_FALSE; GLboolean __GLEW_EXT_texture_cube_map = GL_FALSE; GLboolean __GLEW_EXT_texture_edge_clamp = GL_FALSE; GLboolean __GLEW_EXT_texture_env = GL_FALSE; GLboolean __GLEW_EXT_texture_env_add = GL_FALSE; GLboolean __GLEW_EXT_texture_env_combine = GL_FALSE; GLboolean __GLEW_EXT_texture_env_dot3 = GL_FALSE; GLboolean __GLEW_EXT_texture_filter_anisotropic = GL_FALSE; GLboolean __GLEW_EXT_texture_integer = GL_FALSE; GLboolean __GLEW_EXT_texture_lod_bias = GL_FALSE; GLboolean __GLEW_EXT_texture_mirror_clamp = GL_FALSE; GLboolean __GLEW_EXT_texture_object = GL_FALSE; GLboolean __GLEW_EXT_texture_perturb_normal = GL_FALSE; GLboolean __GLEW_EXT_texture_rectangle = GL_FALSE; GLboolean __GLEW_EXT_texture_sRGB = GL_FALSE; GLboolean __GLEW_EXT_texture_sRGB_decode = GL_FALSE; GLboolean __GLEW_EXT_texture_shared_exponent = GL_FALSE; GLboolean __GLEW_EXT_texture_snorm = GL_FALSE; GLboolean __GLEW_EXT_texture_swizzle = GL_FALSE; GLboolean __GLEW_EXT_timer_query = GL_FALSE; GLboolean __GLEW_EXT_transform_feedback = GL_FALSE; GLboolean __GLEW_EXT_vertex_array = GL_FALSE; GLboolean __GLEW_EXT_vertex_array_bgra = GL_FALSE; GLboolean __GLEW_EXT_vertex_attrib_64bit = GL_FALSE; GLboolean __GLEW_EXT_vertex_shader = GL_FALSE; GLboolean __GLEW_EXT_vertex_weighting = GL_FALSE; GLboolean __GLEW_EXT_x11_sync_object = GL_FALSE; GLboolean __GLEW_GREMEDY_frame_terminator = GL_FALSE; GLboolean __GLEW_GREMEDY_string_marker = GL_FALSE; GLboolean __GLEW_HP_convolution_border_modes = GL_FALSE; GLboolean __GLEW_HP_image_transform = GL_FALSE; GLboolean __GLEW_HP_occlusion_test = GL_FALSE; GLboolean __GLEW_HP_texture_lighting = GL_FALSE; GLboolean __GLEW_IBM_cull_vertex = GL_FALSE; GLboolean __GLEW_IBM_multimode_draw_arrays = GL_FALSE; GLboolean __GLEW_IBM_rasterpos_clip = GL_FALSE; GLboolean __GLEW_IBM_static_data = GL_FALSE; GLboolean __GLEW_IBM_texture_mirrored_repeat = GL_FALSE; GLboolean __GLEW_IBM_vertex_array_lists = GL_FALSE; GLboolean __GLEW_INGR_color_clamp = GL_FALSE; GLboolean __GLEW_INGR_interlace_read = GL_FALSE; GLboolean __GLEW_INTEL_parallel_arrays = GL_FALSE; GLboolean __GLEW_INTEL_texture_scissor = GL_FALSE; GLboolean __GLEW_KHR_debug = GL_FALSE; GLboolean __GLEW_KHR_texture_compression_astc_ldr = GL_FALSE; GLboolean __GLEW_KTX_buffer_region = GL_FALSE; GLboolean __GLEW_MESAX_texture_stack = GL_FALSE; GLboolean __GLEW_MESA_pack_invert = GL_FALSE; GLboolean __GLEW_MESA_resize_buffers = GL_FALSE; GLboolean __GLEW_MESA_window_pos = GL_FALSE; GLboolean __GLEW_MESA_ycbcr_texture = GL_FALSE; GLboolean __GLEW_NVX_gpu_memory_info = GL_FALSE; GLboolean __GLEW_NV_bindless_texture = GL_FALSE; GLboolean __GLEW_NV_blend_square = GL_FALSE; GLboolean __GLEW_NV_conditional_render = GL_FALSE; GLboolean __GLEW_NV_copy_depth_to_color = GL_FALSE; GLboolean __GLEW_NV_copy_image = GL_FALSE; GLboolean __GLEW_NV_depth_buffer_float = GL_FALSE; GLboolean __GLEW_NV_depth_clamp = GL_FALSE; GLboolean __GLEW_NV_depth_range_unclamped = GL_FALSE; GLboolean __GLEW_NV_evaluators = GL_FALSE; GLboolean __GLEW_NV_explicit_multisample = GL_FALSE; GLboolean __GLEW_NV_fence = GL_FALSE; GLboolean __GLEW_NV_float_buffer = GL_FALSE; GLboolean __GLEW_NV_fog_distance = GL_FALSE; GLboolean __GLEW_NV_fragment_program = GL_FALSE; GLboolean __GLEW_NV_fragment_program2 = GL_FALSE; GLboolean __GLEW_NV_fragment_program4 = GL_FALSE; GLboolean __GLEW_NV_fragment_program_option = GL_FALSE; GLboolean __GLEW_NV_framebuffer_multisample_coverage = GL_FALSE; GLboolean __GLEW_NV_geometry_program4 = GL_FALSE; GLboolean __GLEW_NV_geometry_shader4 = GL_FALSE; GLboolean __GLEW_NV_gpu_program4 = GL_FALSE; GLboolean __GLEW_NV_gpu_program5 = GL_FALSE; GLboolean __GLEW_NV_gpu_program_fp64 = GL_FALSE; GLboolean __GLEW_NV_gpu_shader5 = GL_FALSE; GLboolean __GLEW_NV_half_float = GL_FALSE; GLboolean __GLEW_NV_light_max_exponent = GL_FALSE; GLboolean __GLEW_NV_multisample_coverage = GL_FALSE; GLboolean __GLEW_NV_multisample_filter_hint = GL_FALSE; GLboolean __GLEW_NV_occlusion_query = GL_FALSE; GLboolean __GLEW_NV_packed_depth_stencil = GL_FALSE; GLboolean __GLEW_NV_parameter_buffer_object = GL_FALSE; GLboolean __GLEW_NV_parameter_buffer_object2 = GL_FALSE; GLboolean __GLEW_NV_path_rendering = GL_FALSE; GLboolean __GLEW_NV_pixel_data_range = GL_FALSE; GLboolean __GLEW_NV_point_sprite = GL_FALSE; GLboolean __GLEW_NV_present_video = GL_FALSE; GLboolean __GLEW_NV_primitive_restart = GL_FALSE; GLboolean __GLEW_NV_register_combiners = GL_FALSE; GLboolean __GLEW_NV_register_combiners2 = GL_FALSE; GLboolean __GLEW_NV_shader_atomic_float = GL_FALSE; GLboolean __GLEW_NV_shader_buffer_load = GL_FALSE; GLboolean __GLEW_NV_tessellation_program5 = GL_FALSE; GLboolean __GLEW_NV_texgen_emboss = GL_FALSE; GLboolean __GLEW_NV_texgen_reflection = GL_FALSE; GLboolean __GLEW_NV_texture_barrier = GL_FALSE; GLboolean __GLEW_NV_texture_compression_vtc = GL_FALSE; GLboolean __GLEW_NV_texture_env_combine4 = GL_FALSE; GLboolean __GLEW_NV_texture_expand_normal = GL_FALSE; GLboolean __GLEW_NV_texture_multisample = GL_FALSE; GLboolean __GLEW_NV_texture_rectangle = GL_FALSE; GLboolean __GLEW_NV_texture_shader = GL_FALSE; GLboolean __GLEW_NV_texture_shader2 = GL_FALSE; GLboolean __GLEW_NV_texture_shader3 = GL_FALSE; GLboolean __GLEW_NV_transform_feedback = GL_FALSE; GLboolean __GLEW_NV_transform_feedback2 = GL_FALSE; GLboolean __GLEW_NV_vdpau_interop = GL_FALSE; GLboolean __GLEW_NV_vertex_array_range = GL_FALSE; GLboolean __GLEW_NV_vertex_array_range2 = GL_FALSE; GLboolean __GLEW_NV_vertex_attrib_integer_64bit = GL_FALSE; GLboolean __GLEW_NV_vertex_buffer_unified_memory = GL_FALSE; GLboolean __GLEW_NV_vertex_program = GL_FALSE; GLboolean __GLEW_NV_vertex_program1_1 = GL_FALSE; GLboolean __GLEW_NV_vertex_program2 = GL_FALSE; GLboolean __GLEW_NV_vertex_program2_option = GL_FALSE; GLboolean __GLEW_NV_vertex_program3 = GL_FALSE; GLboolean __GLEW_NV_vertex_program4 = GL_FALSE; GLboolean __GLEW_NV_video_capture = GL_FALSE; GLboolean __GLEW_OES_byte_coordinates = GL_FALSE; GLboolean __GLEW_OES_compressed_paletted_texture = GL_FALSE; GLboolean __GLEW_OES_read_format = GL_FALSE; GLboolean __GLEW_OES_single_precision = GL_FALSE; GLboolean __GLEW_OML_interlace = GL_FALSE; GLboolean __GLEW_OML_resample = GL_FALSE; GLboolean __GLEW_OML_subsample = GL_FALSE; GLboolean __GLEW_PGI_misc_hints = GL_FALSE; GLboolean __GLEW_PGI_vertex_hints = GL_FALSE; GLboolean __GLEW_REGAL_error_string = GL_FALSE; GLboolean __GLEW_REGAL_extension_query = GL_FALSE; GLboolean __GLEW_REGAL_log = GL_FALSE; GLboolean __GLEW_REND_screen_coordinates = GL_FALSE; GLboolean __GLEW_S3_s3tc = GL_FALSE; GLboolean __GLEW_SGIS_color_range = GL_FALSE; GLboolean __GLEW_SGIS_detail_texture = GL_FALSE; GLboolean __GLEW_SGIS_fog_function = GL_FALSE; GLboolean __GLEW_SGIS_generate_mipmap = GL_FALSE; GLboolean __GLEW_SGIS_multisample = GL_FALSE; GLboolean __GLEW_SGIS_pixel_texture = GL_FALSE; GLboolean __GLEW_SGIS_point_line_texgen = GL_FALSE; GLboolean __GLEW_SGIS_sharpen_texture = GL_FALSE; GLboolean __GLEW_SGIS_texture4D = GL_FALSE; GLboolean __GLEW_SGIS_texture_border_clamp = GL_FALSE; GLboolean __GLEW_SGIS_texture_edge_clamp = GL_FALSE; GLboolean __GLEW_SGIS_texture_filter4 = GL_FALSE; GLboolean __GLEW_SGIS_texture_lod = GL_FALSE; GLboolean __GLEW_SGIS_texture_select = GL_FALSE; GLboolean __GLEW_SGIX_async = GL_FALSE; GLboolean __GLEW_SGIX_async_histogram = GL_FALSE; GLboolean __GLEW_SGIX_async_pixel = GL_FALSE; GLboolean __GLEW_SGIX_blend_alpha_minmax = GL_FALSE; GLboolean __GLEW_SGIX_clipmap = GL_FALSE; GLboolean __GLEW_SGIX_convolution_accuracy = GL_FALSE; GLboolean __GLEW_SGIX_depth_texture = GL_FALSE; GLboolean __GLEW_SGIX_flush_raster = GL_FALSE; GLboolean __GLEW_SGIX_fog_offset = GL_FALSE; GLboolean __GLEW_SGIX_fog_texture = GL_FALSE; GLboolean __GLEW_SGIX_fragment_specular_lighting = GL_FALSE; GLboolean __GLEW_SGIX_framezoom = GL_FALSE; GLboolean __GLEW_SGIX_interlace = GL_FALSE; GLboolean __GLEW_SGIX_ir_instrument1 = GL_FALSE; GLboolean __GLEW_SGIX_list_priority = GL_FALSE; GLboolean __GLEW_SGIX_pixel_texture = GL_FALSE; GLboolean __GLEW_SGIX_pixel_texture_bits = GL_FALSE; GLboolean __GLEW_SGIX_reference_plane = GL_FALSE; GLboolean __GLEW_SGIX_resample = GL_FALSE; GLboolean __GLEW_SGIX_shadow = GL_FALSE; GLboolean __GLEW_SGIX_shadow_ambient = GL_FALSE; GLboolean __GLEW_SGIX_sprite = GL_FALSE; GLboolean __GLEW_SGIX_tag_sample_buffer = GL_FALSE; GLboolean __GLEW_SGIX_texture_add_env = GL_FALSE; GLboolean __GLEW_SGIX_texture_coordinate_clamp = GL_FALSE; GLboolean __GLEW_SGIX_texture_lod_bias = GL_FALSE; GLboolean __GLEW_SGIX_texture_multi_buffer = GL_FALSE; GLboolean __GLEW_SGIX_texture_range = GL_FALSE; GLboolean __GLEW_SGIX_texture_scale_bias = GL_FALSE; GLboolean __GLEW_SGIX_vertex_preclip = GL_FALSE; GLboolean __GLEW_SGIX_vertex_preclip_hint = GL_FALSE; GLboolean __GLEW_SGIX_ycrcb = GL_FALSE; GLboolean __GLEW_SGI_color_matrix = GL_FALSE; GLboolean __GLEW_SGI_color_table = GL_FALSE; GLboolean __GLEW_SGI_texture_color_table = GL_FALSE; GLboolean __GLEW_SUNX_constant_data = GL_FALSE; GLboolean __GLEW_SUN_convolution_border_modes = GL_FALSE; GLboolean __GLEW_SUN_global_alpha = GL_FALSE; GLboolean __GLEW_SUN_mesh_array = GL_FALSE; GLboolean __GLEW_SUN_read_video_pixels = GL_FALSE; GLboolean __GLEW_SUN_slice_accum = GL_FALSE; GLboolean __GLEW_SUN_triangle_list = GL_FALSE; GLboolean __GLEW_SUN_vertex = GL_FALSE; GLboolean __GLEW_WIN_phong_shading = GL_FALSE; GLboolean __GLEW_WIN_specular_fog = GL_FALSE; GLboolean __GLEW_WIN_swap_hint = GL_FALSE; #endif /* !GLEW_MX */ #ifdef GL_VERSION_1_2 static GLboolean _glewInit_GL_VERSION_1_2 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glCopyTexSubImage3D")) == NULL) || r; r = ((glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)glewGetProcAddress((const GLubyte*)"glDrawRangeElements")) == NULL) || r; r = ((glTexImage3D = (PFNGLTEXIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glTexImage3D")) == NULL) || r; r = ((glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glTexSubImage3D")) == NULL) || r; return r; } #endif /* GL_VERSION_1_2 */ #ifdef GL_VERSION_1_2_1 #endif /* GL_VERSION_1_2_1 */ #ifdef GL_VERSION_1_3 static GLboolean _glewInit_GL_VERSION_1_3 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glActiveTexture = (PFNGLACTIVETEXTUREPROC)glewGetProcAddress((const GLubyte*)"glActiveTexture")) == NULL) || r; r = ((glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC)glewGetProcAddress((const GLubyte*)"glClientActiveTexture")) == NULL) || r; r = ((glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage1D")) == NULL) || r; r = ((glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage2D")) == NULL) || r; r = ((glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage3D")) == NULL) || r; r = ((glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage1D")) == NULL) || r; r = ((glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage2D")) == NULL) || r; r = ((glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage3D")) == NULL) || r; r = ((glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)glewGetProcAddress((const GLubyte*)"glGetCompressedTexImage")) == NULL) || r; r = ((glLoadTransposeMatrixd = (PFNGLLOADTRANSPOSEMATRIXDPROC)glewGetProcAddress((const GLubyte*)"glLoadTransposeMatrixd")) == NULL) || r; r = ((glLoadTransposeMatrixf = (PFNGLLOADTRANSPOSEMATRIXFPROC)glewGetProcAddress((const GLubyte*)"glLoadTransposeMatrixf")) == NULL) || r; r = ((glMultTransposeMatrixd = (PFNGLMULTTRANSPOSEMATRIXDPROC)glewGetProcAddress((const GLubyte*)"glMultTransposeMatrixd")) == NULL) || r; r = ((glMultTransposeMatrixf = (PFNGLMULTTRANSPOSEMATRIXFPROC)glewGetProcAddress((const GLubyte*)"glMultTransposeMatrixf")) == NULL) || r; r = ((glMultiTexCoord1d = (PFNGLMULTITEXCOORD1DPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1d")) == NULL) || r; r = ((glMultiTexCoord1dv = (PFNGLMULTITEXCOORD1DVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1dv")) == NULL) || r; r = ((glMultiTexCoord1f = (PFNGLMULTITEXCOORD1FPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1f")) == NULL) || r; r = ((glMultiTexCoord1fv = (PFNGLMULTITEXCOORD1FVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1fv")) == NULL) || r; r = ((glMultiTexCoord1i = (PFNGLMULTITEXCOORD1IPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1i")) == NULL) || r; r = ((glMultiTexCoord1iv = (PFNGLMULTITEXCOORD1IVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1iv")) == NULL) || r; r = ((glMultiTexCoord1s = (PFNGLMULTITEXCOORD1SPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1s")) == NULL) || r; r = ((glMultiTexCoord1sv = (PFNGLMULTITEXCOORD1SVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1sv")) == NULL) || r; r = ((glMultiTexCoord2d = (PFNGLMULTITEXCOORD2DPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2d")) == NULL) || r; r = ((glMultiTexCoord2dv = (PFNGLMULTITEXCOORD2DVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2dv")) == NULL) || r; r = ((glMultiTexCoord2f = (PFNGLMULTITEXCOORD2FPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2f")) == NULL) || r; r = ((glMultiTexCoord2fv = (PFNGLMULTITEXCOORD2FVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2fv")) == NULL) || r; r = ((glMultiTexCoord2i = (PFNGLMULTITEXCOORD2IPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2i")) == NULL) || r; r = ((glMultiTexCoord2iv = (PFNGLMULTITEXCOORD2IVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2iv")) == NULL) || r; r = ((glMultiTexCoord2s = (PFNGLMULTITEXCOORD2SPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2s")) == NULL) || r; r = ((glMultiTexCoord2sv = (PFNGLMULTITEXCOORD2SVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2sv")) == NULL) || r; r = ((glMultiTexCoord3d = (PFNGLMULTITEXCOORD3DPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3d")) == NULL) || r; r = ((glMultiTexCoord3dv = (PFNGLMULTITEXCOORD3DVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3dv")) == NULL) || r; r = ((glMultiTexCoord3f = (PFNGLMULTITEXCOORD3FPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3f")) == NULL) || r; r = ((glMultiTexCoord3fv = (PFNGLMULTITEXCOORD3FVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3fv")) == NULL) || r; r = ((glMultiTexCoord3i = (PFNGLMULTITEXCOORD3IPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3i")) == NULL) || r; r = ((glMultiTexCoord3iv = (PFNGLMULTITEXCOORD3IVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3iv")) == NULL) || r; r = ((glMultiTexCoord3s = (PFNGLMULTITEXCOORD3SPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3s")) == NULL) || r; r = ((glMultiTexCoord3sv = (PFNGLMULTITEXCOORD3SVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3sv")) == NULL) || r; r = ((glMultiTexCoord4d = (PFNGLMULTITEXCOORD4DPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4d")) == NULL) || r; r = ((glMultiTexCoord4dv = (PFNGLMULTITEXCOORD4DVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4dv")) == NULL) || r; r = ((glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4f")) == NULL) || r; r = ((glMultiTexCoord4fv = (PFNGLMULTITEXCOORD4FVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4fv")) == NULL) || r; r = ((glMultiTexCoord4i = (PFNGLMULTITEXCOORD4IPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4i")) == NULL) || r; r = ((glMultiTexCoord4iv = (PFNGLMULTITEXCOORD4IVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4iv")) == NULL) || r; r = ((glMultiTexCoord4s = (PFNGLMULTITEXCOORD4SPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4s")) == NULL) || r; r = ((glMultiTexCoord4sv = (PFNGLMULTITEXCOORD4SVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4sv")) == NULL) || r; r = ((glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)glewGetProcAddress((const GLubyte*)"glSampleCoverage")) == NULL) || r; return r; } #endif /* GL_VERSION_1_3 */ #ifdef GL_VERSION_1_4 static GLboolean _glewInit_GL_VERSION_1_4 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBlendColor = (PFNGLBLENDCOLORPROC)glewGetProcAddress((const GLubyte*)"glBlendColor")) == NULL) || r; r = ((glBlendEquation = (PFNGLBLENDEQUATIONPROC)glewGetProcAddress((const GLubyte*)"glBlendEquation")) == NULL) || r; r = ((glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glBlendFuncSeparate")) == NULL) || r; r = ((glFogCoordPointer = (PFNGLFOGCOORDPOINTERPROC)glewGetProcAddress((const GLubyte*)"glFogCoordPointer")) == NULL) || r; r = ((glFogCoordd = (PFNGLFOGCOORDDPROC)glewGetProcAddress((const GLubyte*)"glFogCoordd")) == NULL) || r; r = ((glFogCoorddv = (PFNGLFOGCOORDDVPROC)glewGetProcAddress((const GLubyte*)"glFogCoorddv")) == NULL) || r; r = ((glFogCoordf = (PFNGLFOGCOORDFPROC)glewGetProcAddress((const GLubyte*)"glFogCoordf")) == NULL) || r; r = ((glFogCoordfv = (PFNGLFOGCOORDFVPROC)glewGetProcAddress((const GLubyte*)"glFogCoordfv")) == NULL) || r; r = ((glMultiDrawArrays = (PFNGLMULTIDRAWARRAYSPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArrays")) == NULL) || r; r = ((glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElements")) == NULL) || r; r = ((glPointParameterf = (PFNGLPOINTPARAMETERFPROC)glewGetProcAddress((const GLubyte*)"glPointParameterf")) == NULL) || r; r = ((glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glPointParameterfv")) == NULL) || r; r = ((glPointParameteri = (PFNGLPOINTPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glPointParameteri")) == NULL) || r; r = ((glPointParameteriv = (PFNGLPOINTPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glPointParameteriv")) == NULL) || r; r = ((glSecondaryColor3b = (PFNGLSECONDARYCOLOR3BPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3b")) == NULL) || r; r = ((glSecondaryColor3bv = (PFNGLSECONDARYCOLOR3BVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3bv")) == NULL) || r; r = ((glSecondaryColor3d = (PFNGLSECONDARYCOLOR3DPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3d")) == NULL) || r; r = ((glSecondaryColor3dv = (PFNGLSECONDARYCOLOR3DVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3dv")) == NULL) || r; r = ((glSecondaryColor3f = (PFNGLSECONDARYCOLOR3FPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3f")) == NULL) || r; r = ((glSecondaryColor3fv = (PFNGLSECONDARYCOLOR3FVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3fv")) == NULL) || r; r = ((glSecondaryColor3i = (PFNGLSECONDARYCOLOR3IPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3i")) == NULL) || r; r = ((glSecondaryColor3iv = (PFNGLSECONDARYCOLOR3IVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3iv")) == NULL) || r; r = ((glSecondaryColor3s = (PFNGLSECONDARYCOLOR3SPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3s")) == NULL) || r; r = ((glSecondaryColor3sv = (PFNGLSECONDARYCOLOR3SVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3sv")) == NULL) || r; r = ((glSecondaryColor3ub = (PFNGLSECONDARYCOLOR3UBPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ub")) == NULL) || r; r = ((glSecondaryColor3ubv = (PFNGLSECONDARYCOLOR3UBVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ubv")) == NULL) || r; r = ((glSecondaryColor3ui = (PFNGLSECONDARYCOLOR3UIPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ui")) == NULL) || r; r = ((glSecondaryColor3uiv = (PFNGLSECONDARYCOLOR3UIVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3uiv")) == NULL) || r; r = ((glSecondaryColor3us = (PFNGLSECONDARYCOLOR3USPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3us")) == NULL) || r; r = ((glSecondaryColor3usv = (PFNGLSECONDARYCOLOR3USVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3usv")) == NULL) || r; r = ((glSecondaryColorPointer = (PFNGLSECONDARYCOLORPOINTERPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColorPointer")) == NULL) || r; r = ((glWindowPos2d = (PFNGLWINDOWPOS2DPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2d")) == NULL) || r; r = ((glWindowPos2dv = (PFNGLWINDOWPOS2DVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2dv")) == NULL) || r; r = ((glWindowPos2f = (PFNGLWINDOWPOS2FPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2f")) == NULL) || r; r = ((glWindowPos2fv = (PFNGLWINDOWPOS2FVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2fv")) == NULL) || r; r = ((glWindowPos2i = (PFNGLWINDOWPOS2IPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2i")) == NULL) || r; r = ((glWindowPos2iv = (PFNGLWINDOWPOS2IVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2iv")) == NULL) || r; r = ((glWindowPos2s = (PFNGLWINDOWPOS2SPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2s")) == NULL) || r; r = ((glWindowPos2sv = (PFNGLWINDOWPOS2SVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2sv")) == NULL) || r; r = ((glWindowPos3d = (PFNGLWINDOWPOS3DPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3d")) == NULL) || r; r = ((glWindowPos3dv = (PFNGLWINDOWPOS3DVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3dv")) == NULL) || r; r = ((glWindowPos3f = (PFNGLWINDOWPOS3FPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3f")) == NULL) || r; r = ((glWindowPos3fv = (PFNGLWINDOWPOS3FVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3fv")) == NULL) || r; r = ((glWindowPos3i = (PFNGLWINDOWPOS3IPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3i")) == NULL) || r; r = ((glWindowPos3iv = (PFNGLWINDOWPOS3IVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3iv")) == NULL) || r; r = ((glWindowPos3s = (PFNGLWINDOWPOS3SPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3s")) == NULL) || r; r = ((glWindowPos3sv = (PFNGLWINDOWPOS3SVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3sv")) == NULL) || r; return r; } #endif /* GL_VERSION_1_4 */ #ifdef GL_VERSION_1_5 static GLboolean _glewInit_GL_VERSION_1_5 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBeginQuery = (PFNGLBEGINQUERYPROC)glewGetProcAddress((const GLubyte*)"glBeginQuery")) == NULL) || r; r = ((glBindBuffer = (PFNGLBINDBUFFERPROC)glewGetProcAddress((const GLubyte*)"glBindBuffer")) == NULL) || r; r = ((glBufferData = (PFNGLBUFFERDATAPROC)glewGetProcAddress((const GLubyte*)"glBufferData")) == NULL) || r; r = ((glBufferSubData = (PFNGLBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glBufferSubData")) == NULL) || r; r = ((glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glDeleteBuffers")) == NULL) || r; r = ((glDeleteQueries = (PFNGLDELETEQUERIESPROC)glewGetProcAddress((const GLubyte*)"glDeleteQueries")) == NULL) || r; r = ((glEndQuery = (PFNGLENDQUERYPROC)glewGetProcAddress((const GLubyte*)"glEndQuery")) == NULL) || r; r = ((glGenBuffers = (PFNGLGENBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glGenBuffers")) == NULL) || r; r = ((glGenQueries = (PFNGLGENQUERIESPROC)glewGetProcAddress((const GLubyte*)"glGenQueries")) == NULL) || r; r = ((glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetBufferParameteriv")) == NULL) || r; r = ((glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)glewGetProcAddress((const GLubyte*)"glGetBufferPointerv")) == NULL) || r; r = ((glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glGetBufferSubData")) == NULL) || r; r = ((glGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectiv")) == NULL) || r; r = ((glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectuiv")) == NULL) || r; r = ((glGetQueryiv = (PFNGLGETQUERYIVPROC)glewGetProcAddress((const GLubyte*)"glGetQueryiv")) == NULL) || r; r = ((glIsBuffer = (PFNGLISBUFFERPROC)glewGetProcAddress((const GLubyte*)"glIsBuffer")) == NULL) || r; r = ((glIsQuery = (PFNGLISQUERYPROC)glewGetProcAddress((const GLubyte*)"glIsQuery")) == NULL) || r; r = ((glMapBuffer = (PFNGLMAPBUFFERPROC)glewGetProcAddress((const GLubyte*)"glMapBuffer")) == NULL) || r; r = ((glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)glewGetProcAddress((const GLubyte*)"glUnmapBuffer")) == NULL) || r; return r; } #endif /* GL_VERSION_1_5 */ #ifdef GL_VERSION_2_0 static GLboolean _glewInit_GL_VERSION_2_0 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glAttachShader = (PFNGLATTACHSHADERPROC)glewGetProcAddress((const GLubyte*)"glAttachShader")) == NULL) || r; r = ((glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)glewGetProcAddress((const GLubyte*)"glBindAttribLocation")) == NULL) || r; r = ((glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationSeparate")) == NULL) || r; r = ((glCompileShader = (PFNGLCOMPILESHADERPROC)glewGetProcAddress((const GLubyte*)"glCompileShader")) == NULL) || r; r = ((glCreateProgram = (PFNGLCREATEPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glCreateProgram")) == NULL) || r; r = ((glCreateShader = (PFNGLCREATESHADERPROC)glewGetProcAddress((const GLubyte*)"glCreateShader")) == NULL) || r; r = ((glDeleteProgram = (PFNGLDELETEPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glDeleteProgram")) == NULL) || r; r = ((glDeleteShader = (PFNGLDELETESHADERPROC)glewGetProcAddress((const GLubyte*)"glDeleteShader")) == NULL) || r; r = ((glDetachShader = (PFNGLDETACHSHADERPROC)glewGetProcAddress((const GLubyte*)"glDetachShader")) == NULL) || r; r = ((glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)glewGetProcAddress((const GLubyte*)"glDisableVertexAttribArray")) == NULL) || r; r = ((glDrawBuffers = (PFNGLDRAWBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glDrawBuffers")) == NULL) || r; r = ((glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)glewGetProcAddress((const GLubyte*)"glEnableVertexAttribArray")) == NULL) || r; r = ((glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)glewGetProcAddress((const GLubyte*)"glGetActiveAttrib")) == NULL) || r; r = ((glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)glewGetProcAddress((const GLubyte*)"glGetActiveUniform")) == NULL) || r; r = ((glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)glewGetProcAddress((const GLubyte*)"glGetAttachedShaders")) == NULL) || r; r = ((glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)glewGetProcAddress((const GLubyte*)"glGetAttribLocation")) == NULL) || r; r = ((glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)glewGetProcAddress((const GLubyte*)"glGetProgramInfoLog")) == NULL) || r; r = ((glGetProgramiv = (PFNGLGETPROGRAMIVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramiv")) == NULL) || r; r = ((glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)glewGetProcAddress((const GLubyte*)"glGetShaderInfoLog")) == NULL) || r; r = ((glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)glewGetProcAddress((const GLubyte*)"glGetShaderSource")) == NULL) || r; r = ((glGetShaderiv = (PFNGLGETSHADERIVPROC)glewGetProcAddress((const GLubyte*)"glGetShaderiv")) == NULL) || r; r = ((glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)glewGetProcAddress((const GLubyte*)"glGetUniformLocation")) == NULL) || r; r = ((glGetUniformfv = (PFNGLGETUNIFORMFVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformfv")) == NULL) || r; r = ((glGetUniformiv = (PFNGLGETUNIFORMIVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformiv")) == NULL) || r; r = ((glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribPointerv")) == NULL) || r; r = ((glGetVertexAttribdv = (PFNGLGETVERTEXATTRIBDVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribdv")) == NULL) || r; r = ((glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribfv")) == NULL) || r; r = ((glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribiv")) == NULL) || r; r = ((glIsProgram = (PFNGLISPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glIsProgram")) == NULL) || r; r = ((glIsShader = (PFNGLISSHADERPROC)glewGetProcAddress((const GLubyte*)"glIsShader")) == NULL) || r; r = ((glLinkProgram = (PFNGLLINKPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glLinkProgram")) == NULL) || r; r = ((glShaderSource = (PFNGLSHADERSOURCEPROC)glewGetProcAddress((const GLubyte*)"glShaderSource")) == NULL) || r; r = ((glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glStencilFuncSeparate")) == NULL) || r; r = ((glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glStencilMaskSeparate")) == NULL) || r; r = ((glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glStencilOpSeparate")) == NULL) || r; r = ((glUniform1f = (PFNGLUNIFORM1FPROC)glewGetProcAddress((const GLubyte*)"glUniform1f")) == NULL) || r; r = ((glUniform1fv = (PFNGLUNIFORM1FVPROC)glewGetProcAddress((const GLubyte*)"glUniform1fv")) == NULL) || r; r = ((glUniform1i = (PFNGLUNIFORM1IPROC)glewGetProcAddress((const GLubyte*)"glUniform1i")) == NULL) || r; r = ((glUniform1iv = (PFNGLUNIFORM1IVPROC)glewGetProcAddress((const GLubyte*)"glUniform1iv")) == NULL) || r; r = ((glUniform2f = (PFNGLUNIFORM2FPROC)glewGetProcAddress((const GLubyte*)"glUniform2f")) == NULL) || r; r = ((glUniform2fv = (PFNGLUNIFORM2FVPROC)glewGetProcAddress((const GLubyte*)"glUniform2fv")) == NULL) || r; r = ((glUniform2i = (PFNGLUNIFORM2IPROC)glewGetProcAddress((const GLubyte*)"glUniform2i")) == NULL) || r; r = ((glUniform2iv = (PFNGLUNIFORM2IVPROC)glewGetProcAddress((const GLubyte*)"glUniform2iv")) == NULL) || r; r = ((glUniform3f = (PFNGLUNIFORM3FPROC)glewGetProcAddress((const GLubyte*)"glUniform3f")) == NULL) || r; r = ((glUniform3fv = (PFNGLUNIFORM3FVPROC)glewGetProcAddress((const GLubyte*)"glUniform3fv")) == NULL) || r; r = ((glUniform3i = (PFNGLUNIFORM3IPROC)glewGetProcAddress((const GLubyte*)"glUniform3i")) == NULL) || r; r = ((glUniform3iv = (PFNGLUNIFORM3IVPROC)glewGetProcAddress((const GLubyte*)"glUniform3iv")) == NULL) || r; r = ((glUniform4f = (PFNGLUNIFORM4FPROC)glewGetProcAddress((const GLubyte*)"glUniform4f")) == NULL) || r; r = ((glUniform4fv = (PFNGLUNIFORM4FVPROC)glewGetProcAddress((const GLubyte*)"glUniform4fv")) == NULL) || r; r = ((glUniform4i = (PFNGLUNIFORM4IPROC)glewGetProcAddress((const GLubyte*)"glUniform4i")) == NULL) || r; r = ((glUniform4iv = (PFNGLUNIFORM4IVPROC)glewGetProcAddress((const GLubyte*)"glUniform4iv")) == NULL) || r; r = ((glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2fv")) == NULL) || r; r = ((glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3fv")) == NULL) || r; r = ((glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4fv")) == NULL) || r; r = ((glUseProgram = (PFNGLUSEPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glUseProgram")) == NULL) || r; r = ((glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glValidateProgram")) == NULL) || r; r = ((glVertexAttrib1d = (PFNGLVERTEXATTRIB1DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1d")) == NULL) || r; r = ((glVertexAttrib1dv = (PFNGLVERTEXATTRIB1DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1dv")) == NULL) || r; r = ((glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1f")) == NULL) || r; r = ((glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1fv")) == NULL) || r; r = ((glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1s")) == NULL) || r; r = ((glVertexAttrib1sv = (PFNGLVERTEXATTRIB1SVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1sv")) == NULL) || r; r = ((glVertexAttrib2d = (PFNGLVERTEXATTRIB2DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2d")) == NULL) || r; r = ((glVertexAttrib2dv = (PFNGLVERTEXATTRIB2DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2dv")) == NULL) || r; r = ((glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2f")) == NULL) || r; r = ((glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2fv")) == NULL) || r; r = ((glVertexAttrib2s = (PFNGLVERTEXATTRIB2SPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2s")) == NULL) || r; r = ((glVertexAttrib2sv = (PFNGLVERTEXATTRIB2SVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2sv")) == NULL) || r; r = ((glVertexAttrib3d = (PFNGLVERTEXATTRIB3DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3d")) == NULL) || r; r = ((glVertexAttrib3dv = (PFNGLVERTEXATTRIB3DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3dv")) == NULL) || r; r = ((glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3f")) == NULL) || r; r = ((glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3fv")) == NULL) || r; r = ((glVertexAttrib3s = (PFNGLVERTEXATTRIB3SPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3s")) == NULL) || r; r = ((glVertexAttrib3sv = (PFNGLVERTEXATTRIB3SVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3sv")) == NULL) || r; r = ((glVertexAttrib4Nbv = (PFNGLVERTEXATTRIB4NBVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nbv")) == NULL) || r; r = ((glVertexAttrib4Niv = (PFNGLVERTEXATTRIB4NIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Niv")) == NULL) || r; r = ((glVertexAttrib4Nsv = (PFNGLVERTEXATTRIB4NSVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nsv")) == NULL) || r; r = ((glVertexAttrib4Nub = (PFNGLVERTEXATTRIB4NUBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nub")) == NULL) || r; r = ((glVertexAttrib4Nubv = (PFNGLVERTEXATTRIB4NUBVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nubv")) == NULL) || r; r = ((glVertexAttrib4Nuiv = (PFNGLVERTEXATTRIB4NUIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nuiv")) == NULL) || r; r = ((glVertexAttrib4Nusv = (PFNGLVERTEXATTRIB4NUSVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nusv")) == NULL) || r; r = ((glVertexAttrib4bv = (PFNGLVERTEXATTRIB4BVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4bv")) == NULL) || r; r = ((glVertexAttrib4d = (PFNGLVERTEXATTRIB4DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4d")) == NULL) || r; r = ((glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4dv")) == NULL) || r; r = ((glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4f")) == NULL) || r; r = ((glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4fv")) == NULL) || r; r = ((glVertexAttrib4iv = (PFNGLVERTEXATTRIB4IVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4iv")) == NULL) || r; r = ((glVertexAttrib4s = (PFNGLVERTEXATTRIB4SPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4s")) == NULL) || r; r = ((glVertexAttrib4sv = (PFNGLVERTEXATTRIB4SVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4sv")) == NULL) || r; r = ((glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4ubv")) == NULL) || r; r = ((glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4uiv")) == NULL) || r; r = ((glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4usv")) == NULL) || r; r = ((glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribPointer")) == NULL) || r; return r; } #endif /* GL_VERSION_2_0 */ #ifdef GL_VERSION_2_1 static GLboolean _glewInit_GL_VERSION_2_1 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2x3fv")) == NULL) || r; r = ((glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2x4fv")) == NULL) || r; r = ((glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3x2fv")) == NULL) || r; r = ((glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3x4fv")) == NULL) || r; r = ((glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4x2fv")) == NULL) || r; r = ((glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4x3fv")) == NULL) || r; return r; } #endif /* GL_VERSION_2_1 */ #ifdef GL_VERSION_3_0 static GLboolean _glewInit_GL_VERSION_3_0 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBeginConditionalRender = (PFNGLBEGINCONDITIONALRENDERPROC)glewGetProcAddress((const GLubyte*)"glBeginConditionalRender")) == NULL) || r; r = ((glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glBeginTransformFeedback")) == NULL) || r; r = ((glBindFragDataLocation = (PFNGLBINDFRAGDATALOCATIONPROC)glewGetProcAddress((const GLubyte*)"glBindFragDataLocation")) == NULL) || r; r = ((glClampColor = (PFNGLCLAMPCOLORPROC)glewGetProcAddress((const GLubyte*)"glClampColor")) == NULL) || r; r = ((glClearBufferfi = (PFNGLCLEARBUFFERFIPROC)glewGetProcAddress((const GLubyte*)"glClearBufferfi")) == NULL) || r; r = ((glClearBufferfv = (PFNGLCLEARBUFFERFVPROC)glewGetProcAddress((const GLubyte*)"glClearBufferfv")) == NULL) || r; r = ((glClearBufferiv = (PFNGLCLEARBUFFERIVPROC)glewGetProcAddress((const GLubyte*)"glClearBufferiv")) == NULL) || r; r = ((glClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC)glewGetProcAddress((const GLubyte*)"glClearBufferuiv")) == NULL) || r; r = ((glColorMaski = (PFNGLCOLORMASKIPROC)glewGetProcAddress((const GLubyte*)"glColorMaski")) == NULL) || r; r = ((glDisablei = (PFNGLDISABLEIPROC)glewGetProcAddress((const GLubyte*)"glDisablei")) == NULL) || r; r = ((glEnablei = (PFNGLENABLEIPROC)glewGetProcAddress((const GLubyte*)"glEnablei")) == NULL) || r; r = ((glEndConditionalRender = (PFNGLENDCONDITIONALRENDERPROC)glewGetProcAddress((const GLubyte*)"glEndConditionalRender")) == NULL) || r; r = ((glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glEndTransformFeedback")) == NULL) || r; r = ((glGetBooleani_v = (PFNGLGETBOOLEANI_VPROC)glewGetProcAddress((const GLubyte*)"glGetBooleani_v")) == NULL) || r; r = ((glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC)glewGetProcAddress((const GLubyte*)"glGetFragDataLocation")) == NULL) || r; r = ((glGetStringi = (PFNGLGETSTRINGIPROC)glewGetProcAddress((const GLubyte*)"glGetStringi")) == NULL) || r; r = ((glGetTexParameterIiv = (PFNGLGETTEXPARAMETERIIVPROC)glewGetProcAddress((const GLubyte*)"glGetTexParameterIiv")) == NULL) || r; r = ((glGetTexParameterIuiv = (PFNGLGETTEXPARAMETERIUIVPROC)glewGetProcAddress((const GLubyte*)"glGetTexParameterIuiv")) == NULL) || r; r = ((glGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)glewGetProcAddress((const GLubyte*)"glGetTransformFeedbackVarying")) == NULL) || r; r = ((glGetUniformuiv = (PFNGLGETUNIFORMUIVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformuiv")) == NULL) || r; r = ((glGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribIiv")) == NULL) || r; r = ((glGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribIuiv")) == NULL) || r; r = ((glIsEnabledi = (PFNGLISENABLEDIPROC)glewGetProcAddress((const GLubyte*)"glIsEnabledi")) == NULL) || r; r = ((glTexParameterIiv = (PFNGLTEXPARAMETERIIVPROC)glewGetProcAddress((const GLubyte*)"glTexParameterIiv")) == NULL) || r; r = ((glTexParameterIuiv = (PFNGLTEXPARAMETERIUIVPROC)glewGetProcAddress((const GLubyte*)"glTexParameterIuiv")) == NULL) || r; r = ((glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC)glewGetProcAddress((const GLubyte*)"glTransformFeedbackVaryings")) == NULL) || r; r = ((glUniform1ui = (PFNGLUNIFORM1UIPROC)glewGetProcAddress((const GLubyte*)"glUniform1ui")) == NULL) || r; r = ((glUniform1uiv = (PFNGLUNIFORM1UIVPROC)glewGetProcAddress((const GLubyte*)"glUniform1uiv")) == NULL) || r; r = ((glUniform2ui = (PFNGLUNIFORM2UIPROC)glewGetProcAddress((const GLubyte*)"glUniform2ui")) == NULL) || r; r = ((glUniform2uiv = (PFNGLUNIFORM2UIVPROC)glewGetProcAddress((const GLubyte*)"glUniform2uiv")) == NULL) || r; r = ((glUniform3ui = (PFNGLUNIFORM3UIPROC)glewGetProcAddress((const GLubyte*)"glUniform3ui")) == NULL) || r; r = ((glUniform3uiv = (PFNGLUNIFORM3UIVPROC)glewGetProcAddress((const GLubyte*)"glUniform3uiv")) == NULL) || r; r = ((glUniform4ui = (PFNGLUNIFORM4UIPROC)glewGetProcAddress((const GLubyte*)"glUniform4ui")) == NULL) || r; r = ((glUniform4uiv = (PFNGLUNIFORM4UIVPROC)glewGetProcAddress((const GLubyte*)"glUniform4uiv")) == NULL) || r; r = ((glVertexAttribI1i = (PFNGLVERTEXATTRIBI1IPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1i")) == NULL) || r; r = ((glVertexAttribI1iv = (PFNGLVERTEXATTRIBI1IVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1iv")) == NULL) || r; r = ((glVertexAttribI1ui = (PFNGLVERTEXATTRIBI1UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1ui")) == NULL) || r; r = ((glVertexAttribI1uiv = (PFNGLVERTEXATTRIBI1UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1uiv")) == NULL) || r; r = ((glVertexAttribI2i = (PFNGLVERTEXATTRIBI2IPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2i")) == NULL) || r; r = ((glVertexAttribI2iv = (PFNGLVERTEXATTRIBI2IVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2iv")) == NULL) || r; r = ((glVertexAttribI2ui = (PFNGLVERTEXATTRIBI2UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2ui")) == NULL) || r; r = ((glVertexAttribI2uiv = (PFNGLVERTEXATTRIBI2UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2uiv")) == NULL) || r; r = ((glVertexAttribI3i = (PFNGLVERTEXATTRIBI3IPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3i")) == NULL) || r; r = ((glVertexAttribI3iv = (PFNGLVERTEXATTRIBI3IVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3iv")) == NULL) || r; r = ((glVertexAttribI3ui = (PFNGLVERTEXATTRIBI3UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3ui")) == NULL) || r; r = ((glVertexAttribI3uiv = (PFNGLVERTEXATTRIBI3UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3uiv")) == NULL) || r; r = ((glVertexAttribI4bv = (PFNGLVERTEXATTRIBI4BVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4bv")) == NULL) || r; r = ((glVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4i")) == NULL) || r; r = ((glVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4iv")) == NULL) || r; r = ((glVertexAttribI4sv = (PFNGLVERTEXATTRIBI4SVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4sv")) == NULL) || r; r = ((glVertexAttribI4ubv = (PFNGLVERTEXATTRIBI4UBVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4ubv")) == NULL) || r; r = ((glVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4ui")) == NULL) || r; r = ((glVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4uiv")) == NULL) || r; r = ((glVertexAttribI4usv = (PFNGLVERTEXATTRIBI4USVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4usv")) == NULL) || r; r = ((glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribIPointer")) == NULL) || r; return r; } #endif /* GL_VERSION_3_0 */ #ifdef GL_VERSION_3_1 static GLboolean _glewInit_GL_VERSION_3_1 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysInstanced")) == NULL) || r; r = ((glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstanced")) == NULL) || r; r = ((glPrimitiveRestartIndex = (PFNGLPRIMITIVERESTARTINDEXPROC)glewGetProcAddress((const GLubyte*)"glPrimitiveRestartIndex")) == NULL) || r; r = ((glTexBuffer = (PFNGLTEXBUFFERPROC)glewGetProcAddress((const GLubyte*)"glTexBuffer")) == NULL) || r; return r; } #endif /* GL_VERSION_3_1 */ #ifdef GL_VERSION_3_2 static GLboolean _glewInit_GL_VERSION_3_2 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glFramebufferTexture = (PFNGLFRAMEBUFFERTEXTUREPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture")) == NULL) || r; r = ((glGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC)glewGetProcAddress((const GLubyte*)"glGetBufferParameteri64v")) == NULL) || r; r = ((glGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC)glewGetProcAddress((const GLubyte*)"glGetInteger64i_v")) == NULL) || r; return r; } #endif /* GL_VERSION_3_2 */ #ifdef GL_VERSION_3_3 static GLboolean _glewInit_GL_VERSION_3_3 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribDivisor")) == NULL) || r; return r; } #endif /* GL_VERSION_3_3 */ #ifdef GL_VERSION_4_0 static GLboolean _glewInit_GL_VERSION_4_0 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBlendEquationSeparatei = (PFNGLBLENDEQUATIONSEPARATEIPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationSeparatei")) == NULL) || r; r = ((glBlendEquationi = (PFNGLBLENDEQUATIONIPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationi")) == NULL) || r; r = ((glBlendFuncSeparatei = (PFNGLBLENDFUNCSEPARATEIPROC)glewGetProcAddress((const GLubyte*)"glBlendFuncSeparatei")) == NULL) || r; r = ((glBlendFunci = (PFNGLBLENDFUNCIPROC)glewGetProcAddress((const GLubyte*)"glBlendFunci")) == NULL) || r; r = ((glMinSampleShading = (PFNGLMINSAMPLESHADINGPROC)glewGetProcAddress((const GLubyte*)"glMinSampleShading")) == NULL) || r; return r; } #endif /* GL_VERSION_4_0 */ #ifdef GL_VERSION_4_1 #endif /* GL_VERSION_4_1 */ #ifdef GL_VERSION_4_2 #endif /* GL_VERSION_4_2 */ #ifdef GL_VERSION_4_3 #endif /* GL_VERSION_4_3 */ #ifdef GL_3DFX_multisample #endif /* GL_3DFX_multisample */ #ifdef GL_3DFX_tbuffer static GLboolean _glewInit_GL_3DFX_tbuffer (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glTbufferMask3DFX = (PFNGLTBUFFERMASK3DFXPROC)glewGetProcAddress((const GLubyte*)"glTbufferMask3DFX")) == NULL) || r; return r; } #endif /* GL_3DFX_tbuffer */ #ifdef GL_3DFX_texture_compression_FXT1 #endif /* GL_3DFX_texture_compression_FXT1 */ #ifdef GL_AMD_blend_minmax_factor #endif /* GL_AMD_blend_minmax_factor */ #ifdef GL_AMD_conservative_depth #endif /* GL_AMD_conservative_depth */ #ifdef GL_AMD_debug_output static GLboolean _glewInit_GL_AMD_debug_output (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDebugMessageCallbackAMD = (PFNGLDEBUGMESSAGECALLBACKAMDPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageCallbackAMD")) == NULL) || r; r = ((glDebugMessageEnableAMD = (PFNGLDEBUGMESSAGEENABLEAMDPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageEnableAMD")) == NULL) || r; r = ((glDebugMessageInsertAMD = (PFNGLDEBUGMESSAGEINSERTAMDPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageInsertAMD")) == NULL) || r; r = ((glGetDebugMessageLogAMD = (PFNGLGETDEBUGMESSAGELOGAMDPROC)glewGetProcAddress((const GLubyte*)"glGetDebugMessageLogAMD")) == NULL) || r; return r; } #endif /* GL_AMD_debug_output */ #ifdef GL_AMD_depth_clamp_separate #endif /* GL_AMD_depth_clamp_separate */ #ifdef GL_AMD_draw_buffers_blend static GLboolean _glewInit_GL_AMD_draw_buffers_blend (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBlendEquationIndexedAMD = (PFNGLBLENDEQUATIONINDEXEDAMDPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationIndexedAMD")) == NULL) || r; r = ((glBlendEquationSeparateIndexedAMD = (PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationSeparateIndexedAMD")) == NULL) || r; r = ((glBlendFuncIndexedAMD = (PFNGLBLENDFUNCINDEXEDAMDPROC)glewGetProcAddress((const GLubyte*)"glBlendFuncIndexedAMD")) == NULL) || r; r = ((glBlendFuncSeparateIndexedAMD = (PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC)glewGetProcAddress((const GLubyte*)"glBlendFuncSeparateIndexedAMD")) == NULL) || r; return r; } #endif /* GL_AMD_draw_buffers_blend */ #ifdef GL_AMD_multi_draw_indirect static GLboolean _glewInit_GL_AMD_multi_draw_indirect (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glMultiDrawArraysIndirectAMD = (PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArraysIndirectAMD")) == NULL) || r; r = ((glMultiDrawElementsIndirectAMD = (PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsIndirectAMD")) == NULL) || r; return r; } #endif /* GL_AMD_multi_draw_indirect */ #ifdef GL_AMD_name_gen_delete static GLboolean _glewInit_GL_AMD_name_gen_delete (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDeleteNamesAMD = (PFNGLDELETENAMESAMDPROC)glewGetProcAddress((const GLubyte*)"glDeleteNamesAMD")) == NULL) || r; r = ((glGenNamesAMD = (PFNGLGENNAMESAMDPROC)glewGetProcAddress((const GLubyte*)"glGenNamesAMD")) == NULL) || r; r = ((glIsNameAMD = (PFNGLISNAMEAMDPROC)glewGetProcAddress((const GLubyte*)"glIsNameAMD")) == NULL) || r; return r; } #endif /* GL_AMD_name_gen_delete */ #ifdef GL_AMD_performance_monitor static GLboolean _glewInit_GL_AMD_performance_monitor (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBeginPerfMonitorAMD = (PFNGLBEGINPERFMONITORAMDPROC)glewGetProcAddress((const GLubyte*)"glBeginPerfMonitorAMD")) == NULL) || r; r = ((glDeletePerfMonitorsAMD = (PFNGLDELETEPERFMONITORSAMDPROC)glewGetProcAddress((const GLubyte*)"glDeletePerfMonitorsAMD")) == NULL) || r; r = ((glEndPerfMonitorAMD = (PFNGLENDPERFMONITORAMDPROC)glewGetProcAddress((const GLubyte*)"glEndPerfMonitorAMD")) == NULL) || r; r = ((glGenPerfMonitorsAMD = (PFNGLGENPERFMONITORSAMDPROC)glewGetProcAddress((const GLubyte*)"glGenPerfMonitorsAMD")) == NULL) || r; r = ((glGetPerfMonitorCounterDataAMD = (PFNGLGETPERFMONITORCOUNTERDATAAMDPROC)glewGetProcAddress((const GLubyte*)"glGetPerfMonitorCounterDataAMD")) == NULL) || r; r = ((glGetPerfMonitorCounterInfoAMD = (PFNGLGETPERFMONITORCOUNTERINFOAMDPROC)glewGetProcAddress((const GLubyte*)"glGetPerfMonitorCounterInfoAMD")) == NULL) || r; r = ((glGetPerfMonitorCounterStringAMD = (PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC)glewGetProcAddress((const GLubyte*)"glGetPerfMonitorCounterStringAMD")) == NULL) || r; r = ((glGetPerfMonitorCountersAMD = (PFNGLGETPERFMONITORCOUNTERSAMDPROC)glewGetProcAddress((const GLubyte*)"glGetPerfMonitorCountersAMD")) == NULL) || r; r = ((glGetPerfMonitorGroupStringAMD = (PFNGLGETPERFMONITORGROUPSTRINGAMDPROC)glewGetProcAddress((const GLubyte*)"glGetPerfMonitorGroupStringAMD")) == NULL) || r; r = ((glGetPerfMonitorGroupsAMD = (PFNGLGETPERFMONITORGROUPSAMDPROC)glewGetProcAddress((const GLubyte*)"glGetPerfMonitorGroupsAMD")) == NULL) || r; r = ((glSelectPerfMonitorCountersAMD = (PFNGLSELECTPERFMONITORCOUNTERSAMDPROC)glewGetProcAddress((const GLubyte*)"glSelectPerfMonitorCountersAMD")) == NULL) || r; return r; } #endif /* GL_AMD_performance_monitor */ #ifdef GL_AMD_pinned_memory #endif /* GL_AMD_pinned_memory */ #ifdef GL_AMD_query_buffer_object #endif /* GL_AMD_query_buffer_object */ #ifdef GL_AMD_sample_positions static GLboolean _glewInit_GL_AMD_sample_positions (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glSetMultisamplefvAMD = (PFNGLSETMULTISAMPLEFVAMDPROC)glewGetProcAddress((const GLubyte*)"glSetMultisamplefvAMD")) == NULL) || r; return r; } #endif /* GL_AMD_sample_positions */ #ifdef GL_AMD_seamless_cubemap_per_texture #endif /* GL_AMD_seamless_cubemap_per_texture */ #ifdef GL_AMD_shader_stencil_export #endif /* GL_AMD_shader_stencil_export */ #ifdef GL_AMD_stencil_operation_extended static GLboolean _glewInit_GL_AMD_stencil_operation_extended (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glStencilOpValueAMD = (PFNGLSTENCILOPVALUEAMDPROC)glewGetProcAddress((const GLubyte*)"glStencilOpValueAMD")) == NULL) || r; return r; } #endif /* GL_AMD_stencil_operation_extended */ #ifdef GL_AMD_texture_texture4 #endif /* GL_AMD_texture_texture4 */ #ifdef GL_AMD_transform_feedback3_lines_triangles #endif /* GL_AMD_transform_feedback3_lines_triangles */ #ifdef GL_AMD_vertex_shader_layer #endif /* GL_AMD_vertex_shader_layer */ #ifdef GL_AMD_vertex_shader_tessellator static GLboolean _glewInit_GL_AMD_vertex_shader_tessellator (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glTessellationFactorAMD = (PFNGLTESSELLATIONFACTORAMDPROC)glewGetProcAddress((const GLubyte*)"glTessellationFactorAMD")) == NULL) || r; r = ((glTessellationModeAMD = (PFNGLTESSELLATIONMODEAMDPROC)glewGetProcAddress((const GLubyte*)"glTessellationModeAMD")) == NULL) || r; return r; } #endif /* GL_AMD_vertex_shader_tessellator */ #ifdef GL_AMD_vertex_shader_viewport_index #endif /* GL_AMD_vertex_shader_viewport_index */ #ifdef GL_APPLE_aux_depth_stencil #endif /* GL_APPLE_aux_depth_stencil */ #ifdef GL_APPLE_client_storage #endif /* GL_APPLE_client_storage */ #ifdef GL_APPLE_element_array static GLboolean _glewInit_GL_APPLE_element_array (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDrawElementArrayAPPLE = (PFNGLDRAWELEMENTARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glDrawElementArrayAPPLE")) == NULL) || r; r = ((glDrawRangeElementArrayAPPLE = (PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glDrawRangeElementArrayAPPLE")) == NULL) || r; r = ((glElementPointerAPPLE = (PFNGLELEMENTPOINTERAPPLEPROC)glewGetProcAddress((const GLubyte*)"glElementPointerAPPLE")) == NULL) || r; r = ((glMultiDrawElementArrayAPPLE = (PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementArrayAPPLE")) == NULL) || r; r = ((glMultiDrawRangeElementArrayAPPLE = (PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawRangeElementArrayAPPLE")) == NULL) || r; return r; } #endif /* GL_APPLE_element_array */ #ifdef GL_APPLE_fence static GLboolean _glewInit_GL_APPLE_fence (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDeleteFencesAPPLE = (PFNGLDELETEFENCESAPPLEPROC)glewGetProcAddress((const GLubyte*)"glDeleteFencesAPPLE")) == NULL) || r; r = ((glFinishFenceAPPLE = (PFNGLFINISHFENCEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glFinishFenceAPPLE")) == NULL) || r; r = ((glFinishObjectAPPLE = (PFNGLFINISHOBJECTAPPLEPROC)glewGetProcAddress((const GLubyte*)"glFinishObjectAPPLE")) == NULL) || r; r = ((glGenFencesAPPLE = (PFNGLGENFENCESAPPLEPROC)glewGetProcAddress((const GLubyte*)"glGenFencesAPPLE")) == NULL) || r; r = ((glIsFenceAPPLE = (PFNGLISFENCEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glIsFenceAPPLE")) == NULL) || r; r = ((glSetFenceAPPLE = (PFNGLSETFENCEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glSetFenceAPPLE")) == NULL) || r; r = ((glTestFenceAPPLE = (PFNGLTESTFENCEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glTestFenceAPPLE")) == NULL) || r; r = ((glTestObjectAPPLE = (PFNGLTESTOBJECTAPPLEPROC)glewGetProcAddress((const GLubyte*)"glTestObjectAPPLE")) == NULL) || r; return r; } #endif /* GL_APPLE_fence */ #ifdef GL_APPLE_float_pixels #endif /* GL_APPLE_float_pixels */ #ifdef GL_APPLE_flush_buffer_range static GLboolean _glewInit_GL_APPLE_flush_buffer_range (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBufferParameteriAPPLE = (PFNGLBUFFERPARAMETERIAPPLEPROC)glewGetProcAddress((const GLubyte*)"glBufferParameteriAPPLE")) == NULL) || r; r = ((glFlushMappedBufferRangeAPPLE = (PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glFlushMappedBufferRangeAPPLE")) == NULL) || r; return r; } #endif /* GL_APPLE_flush_buffer_range */ #ifdef GL_APPLE_object_purgeable static GLboolean _glewInit_GL_APPLE_object_purgeable (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetObjectParameterivAPPLE = (PFNGLGETOBJECTPARAMETERIVAPPLEPROC)glewGetProcAddress((const GLubyte*)"glGetObjectParameterivAPPLE")) == NULL) || r; r = ((glObjectPurgeableAPPLE = (PFNGLOBJECTPURGEABLEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glObjectPurgeableAPPLE")) == NULL) || r; r = ((glObjectUnpurgeableAPPLE = (PFNGLOBJECTUNPURGEABLEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glObjectUnpurgeableAPPLE")) == NULL) || r; return r; } #endif /* GL_APPLE_object_purgeable */ #ifdef GL_APPLE_pixel_buffer #endif /* GL_APPLE_pixel_buffer */ #ifdef GL_APPLE_rgb_422 #endif /* GL_APPLE_rgb_422 */ #ifdef GL_APPLE_row_bytes #endif /* GL_APPLE_row_bytes */ #ifdef GL_APPLE_specular_vector #endif /* GL_APPLE_specular_vector */ #ifdef GL_APPLE_texture_range static GLboolean _glewInit_GL_APPLE_texture_range (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetTexParameterPointervAPPLE = (PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC)glewGetProcAddress((const GLubyte*)"glGetTexParameterPointervAPPLE")) == NULL) || r; r = ((glTextureRangeAPPLE = (PFNGLTEXTURERANGEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glTextureRangeAPPLE")) == NULL) || r; return r; } #endif /* GL_APPLE_texture_range */ #ifdef GL_APPLE_transform_hint #endif /* GL_APPLE_transform_hint */ #ifdef GL_APPLE_vertex_array_object static GLboolean _glewInit_GL_APPLE_vertex_array_object (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBindVertexArrayAPPLE = (PFNGLBINDVERTEXARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glBindVertexArrayAPPLE")) == NULL) || r; r = ((glDeleteVertexArraysAPPLE = (PFNGLDELETEVERTEXARRAYSAPPLEPROC)glewGetProcAddress((const GLubyte*)"glDeleteVertexArraysAPPLE")) == NULL) || r; r = ((glGenVertexArraysAPPLE = (PFNGLGENVERTEXARRAYSAPPLEPROC)glewGetProcAddress((const GLubyte*)"glGenVertexArraysAPPLE")) == NULL) || r; r = ((glIsVertexArrayAPPLE = (PFNGLISVERTEXARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glIsVertexArrayAPPLE")) == NULL) || r; return r; } #endif /* GL_APPLE_vertex_array_object */ #ifdef GL_APPLE_vertex_array_range static GLboolean _glewInit_GL_APPLE_vertex_array_range (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glFlushVertexArrayRangeAPPLE = (PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glFlushVertexArrayRangeAPPLE")) == NULL) || r; r = ((glVertexArrayParameteriAPPLE = (PFNGLVERTEXARRAYPARAMETERIAPPLEPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayParameteriAPPLE")) == NULL) || r; r = ((glVertexArrayRangeAPPLE = (PFNGLVERTEXARRAYRANGEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayRangeAPPLE")) == NULL) || r; return r; } #endif /* GL_APPLE_vertex_array_range */ #ifdef GL_APPLE_vertex_program_evaluators static GLboolean _glewInit_GL_APPLE_vertex_program_evaluators (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDisableVertexAttribAPPLE = (PFNGLDISABLEVERTEXATTRIBAPPLEPROC)glewGetProcAddress((const GLubyte*)"glDisableVertexAttribAPPLE")) == NULL) || r; r = ((glEnableVertexAttribAPPLE = (PFNGLENABLEVERTEXATTRIBAPPLEPROC)glewGetProcAddress((const GLubyte*)"glEnableVertexAttribAPPLE")) == NULL) || r; r = ((glIsVertexAttribEnabledAPPLE = (PFNGLISVERTEXATTRIBENABLEDAPPLEPROC)glewGetProcAddress((const GLubyte*)"glIsVertexAttribEnabledAPPLE")) == NULL) || r; r = ((glMapVertexAttrib1dAPPLE = (PFNGLMAPVERTEXATTRIB1DAPPLEPROC)glewGetProcAddress((const GLubyte*)"glMapVertexAttrib1dAPPLE")) == NULL) || r; r = ((glMapVertexAttrib1fAPPLE = (PFNGLMAPVERTEXATTRIB1FAPPLEPROC)glewGetProcAddress((const GLubyte*)"glMapVertexAttrib1fAPPLE")) == NULL) || r; r = ((glMapVertexAttrib2dAPPLE = (PFNGLMAPVERTEXATTRIB2DAPPLEPROC)glewGetProcAddress((const GLubyte*)"glMapVertexAttrib2dAPPLE")) == NULL) || r; r = ((glMapVertexAttrib2fAPPLE = (PFNGLMAPVERTEXATTRIB2FAPPLEPROC)glewGetProcAddress((const GLubyte*)"glMapVertexAttrib2fAPPLE")) == NULL) || r; return r; } #endif /* GL_APPLE_vertex_program_evaluators */ #ifdef GL_APPLE_ycbcr_422 #endif /* GL_APPLE_ycbcr_422 */ #ifdef GL_ARB_ES2_compatibility static GLboolean _glewInit_GL_ARB_ES2_compatibility (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glClearDepthf = (PFNGLCLEARDEPTHFPROC)glewGetProcAddress((const GLubyte*)"glClearDepthf")) == NULL) || r; r = ((glDepthRangef = (PFNGLDEPTHRANGEFPROC)glewGetProcAddress((const GLubyte*)"glDepthRangef")) == NULL) || r; r = ((glGetShaderPrecisionFormat = (PFNGLGETSHADERPRECISIONFORMATPROC)glewGetProcAddress((const GLubyte*)"glGetShaderPrecisionFormat")) == NULL) || r; r = ((glReleaseShaderCompiler = (PFNGLRELEASESHADERCOMPILERPROC)glewGetProcAddress((const GLubyte*)"glReleaseShaderCompiler")) == NULL) || r; r = ((glShaderBinary = (PFNGLSHADERBINARYPROC)glewGetProcAddress((const GLubyte*)"glShaderBinary")) == NULL) || r; return r; } #endif /* GL_ARB_ES2_compatibility */ #ifdef GL_ARB_ES3_compatibility #endif /* GL_ARB_ES3_compatibility */ #ifdef GL_ARB_arrays_of_arrays #endif /* GL_ARB_arrays_of_arrays */ #ifdef GL_ARB_base_instance static GLboolean _glewInit_GL_ARB_base_instance (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDrawArraysInstancedBaseInstance = (PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysInstancedBaseInstance")) == NULL) || r; r = ((glDrawElementsInstancedBaseInstance = (PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstancedBaseInstance")) == NULL) || r; r = ((glDrawElementsInstancedBaseVertexBaseInstance = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstancedBaseVertexBaseInstance")) == NULL) || r; return r; } #endif /* GL_ARB_base_instance */ #ifdef GL_ARB_blend_func_extended static GLboolean _glewInit_GL_ARB_blend_func_extended (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBindFragDataLocationIndexed = (PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)glewGetProcAddress((const GLubyte*)"glBindFragDataLocationIndexed")) == NULL) || r; r = ((glGetFragDataIndex = (PFNGLGETFRAGDATAINDEXPROC)glewGetProcAddress((const GLubyte*)"glGetFragDataIndex")) == NULL) || r; return r; } #endif /* GL_ARB_blend_func_extended */ #ifdef GL_ARB_cl_event static GLboolean _glewInit_GL_ARB_cl_event (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glCreateSyncFromCLeventARB = (PFNGLCREATESYNCFROMCLEVENTARBPROC)glewGetProcAddress((const GLubyte*)"glCreateSyncFromCLeventARB")) == NULL) || r; return r; } #endif /* GL_ARB_cl_event */ #ifdef GL_ARB_clear_buffer_object static GLboolean _glewInit_GL_ARB_clear_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glClearBufferData = (PFNGLCLEARBUFFERDATAPROC)glewGetProcAddress((const GLubyte*)"glClearBufferData")) == NULL) || r; r = ((glClearBufferSubData = (PFNGLCLEARBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glClearBufferSubData")) == NULL) || r; r = ((glClearNamedBufferDataEXT = (PFNGLCLEARNAMEDBUFFERDATAEXTPROC)glewGetProcAddress((const GLubyte*)"glClearNamedBufferDataEXT")) == NULL) || r; r = ((glClearNamedBufferSubDataEXT = (PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC)glewGetProcAddress((const GLubyte*)"glClearNamedBufferSubDataEXT")) == NULL) || r; return r; } #endif /* GL_ARB_clear_buffer_object */ #ifdef GL_ARB_color_buffer_float static GLboolean _glewInit_GL_ARB_color_buffer_float (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glClampColorARB = (PFNGLCLAMPCOLORARBPROC)glewGetProcAddress((const GLubyte*)"glClampColorARB")) == NULL) || r; return r; } #endif /* GL_ARB_color_buffer_float */ #ifdef GL_ARB_compatibility #endif /* GL_ARB_compatibility */ #ifdef GL_ARB_compressed_texture_pixel_storage #endif /* GL_ARB_compressed_texture_pixel_storage */ #ifdef GL_ARB_compute_shader static GLboolean _glewInit_GL_ARB_compute_shader (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDispatchCompute = (PFNGLDISPATCHCOMPUTEPROC)glewGetProcAddress((const GLubyte*)"glDispatchCompute")) == NULL) || r; r = ((glDispatchComputeIndirect = (PFNGLDISPATCHCOMPUTEINDIRECTPROC)glewGetProcAddress((const GLubyte*)"glDispatchComputeIndirect")) == NULL) || r; return r; } #endif /* GL_ARB_compute_shader */ #ifdef GL_ARB_conservative_depth #endif /* GL_ARB_conservative_depth */ #ifdef GL_ARB_copy_buffer static GLboolean _glewInit_GL_ARB_copy_buffer (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glCopyBufferSubData")) == NULL) || r; return r; } #endif /* GL_ARB_copy_buffer */ #ifdef GL_ARB_copy_image static GLboolean _glewInit_GL_ARB_copy_image (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glCopyImageSubData = (PFNGLCOPYIMAGESUBDATAPROC)glewGetProcAddress((const GLubyte*)"glCopyImageSubData")) == NULL) || r; return r; } #endif /* GL_ARB_copy_image */ #ifdef GL_ARB_debug_output static GLboolean _glewInit_GL_ARB_debug_output (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKARBPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageCallbackARB")) == NULL) || r; r = ((glDebugMessageControlARB = (PFNGLDEBUGMESSAGECONTROLARBPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageControlARB")) == NULL) || r; r = ((glDebugMessageInsertARB = (PFNGLDEBUGMESSAGEINSERTARBPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageInsertARB")) == NULL) || r; r = ((glGetDebugMessageLogARB = (PFNGLGETDEBUGMESSAGELOGARBPROC)glewGetProcAddress((const GLubyte*)"glGetDebugMessageLogARB")) == NULL) || r; return r; } #endif /* GL_ARB_debug_output */ #ifdef GL_ARB_depth_buffer_float #endif /* GL_ARB_depth_buffer_float */ #ifdef GL_ARB_depth_clamp #endif /* GL_ARB_depth_clamp */ #ifdef GL_ARB_depth_texture #endif /* GL_ARB_depth_texture */ #ifdef GL_ARB_draw_buffers static GLboolean _glewInit_GL_ARB_draw_buffers (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDrawBuffersARB = (PFNGLDRAWBUFFERSARBPROC)glewGetProcAddress((const GLubyte*)"glDrawBuffersARB")) == NULL) || r; return r; } #endif /* GL_ARB_draw_buffers */ #ifdef GL_ARB_draw_buffers_blend static GLboolean _glewInit_GL_ARB_draw_buffers_blend (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBlendEquationSeparateiARB = (PFNGLBLENDEQUATIONSEPARATEIARBPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationSeparateiARB")) == NULL) || r; r = ((glBlendEquationiARB = (PFNGLBLENDEQUATIONIARBPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationiARB")) == NULL) || r; r = ((glBlendFuncSeparateiARB = (PFNGLBLENDFUNCSEPARATEIARBPROC)glewGetProcAddress((const GLubyte*)"glBlendFuncSeparateiARB")) == NULL) || r; r = ((glBlendFunciARB = (PFNGLBLENDFUNCIARBPROC)glewGetProcAddress((const GLubyte*)"glBlendFunciARB")) == NULL) || r; return r; } #endif /* GL_ARB_draw_buffers_blend */ #ifdef GL_ARB_draw_elements_base_vertex static GLboolean _glewInit_GL_ARB_draw_elements_base_vertex (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDrawElementsBaseVertex = (PFNGLDRAWELEMENTSBASEVERTEXPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsBaseVertex")) == NULL) || r; r = ((glDrawElementsInstancedBaseVertex = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstancedBaseVertex")) == NULL) || r; r = ((glDrawRangeElementsBaseVertex = (PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)glewGetProcAddress((const GLubyte*)"glDrawRangeElementsBaseVertex")) == NULL) || r; r = ((glMultiDrawElementsBaseVertex = (PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsBaseVertex")) == NULL) || r; return r; } #endif /* GL_ARB_draw_elements_base_vertex */ #ifdef GL_ARB_draw_indirect static GLboolean _glewInit_GL_ARB_draw_indirect (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDrawArraysIndirect = (PFNGLDRAWARRAYSINDIRECTPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysIndirect")) == NULL) || r; r = ((glDrawElementsIndirect = (PFNGLDRAWELEMENTSINDIRECTPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsIndirect")) == NULL) || r; return r; } #endif /* GL_ARB_draw_indirect */ #ifdef GL_ARB_draw_instanced #endif /* GL_ARB_draw_instanced */ #ifdef GL_ARB_explicit_attrib_location #endif /* GL_ARB_explicit_attrib_location */ #ifdef GL_ARB_explicit_uniform_location #endif /* GL_ARB_explicit_uniform_location */ #ifdef GL_ARB_fragment_coord_conventions #endif /* GL_ARB_fragment_coord_conventions */ #ifdef GL_ARB_fragment_layer_viewport #endif /* GL_ARB_fragment_layer_viewport */ #ifdef GL_ARB_fragment_program #endif /* GL_ARB_fragment_program */ #ifdef GL_ARB_fragment_program_shadow #endif /* GL_ARB_fragment_program_shadow */ #ifdef GL_ARB_fragment_shader #endif /* GL_ARB_fragment_shader */ #ifdef GL_ARB_framebuffer_no_attachments static GLboolean _glewInit_GL_ARB_framebuffer_no_attachments (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glFramebufferParameteri = (PFNGLFRAMEBUFFERPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glFramebufferParameteri")) == NULL) || r; r = ((glGetFramebufferParameteriv = (PFNGLGETFRAMEBUFFERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetFramebufferParameteriv")) == NULL) || r; r = ((glGetNamedFramebufferParameterivEXT = (PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedFramebufferParameterivEXT")) == NULL) || r; r = ((glNamedFramebufferParameteriEXT = (PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferParameteriEXT")) == NULL) || r; return r; } #endif /* GL_ARB_framebuffer_no_attachments */ #ifdef GL_ARB_framebuffer_object static GLboolean _glewInit_GL_ARB_framebuffer_object (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)glewGetProcAddress((const GLubyte*)"glBindFramebuffer")) == NULL) || r; r = ((glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)glewGetProcAddress((const GLubyte*)"glBindRenderbuffer")) == NULL) || r; r = ((glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC)glewGetProcAddress((const GLubyte*)"glBlitFramebuffer")) == NULL) || r; r = ((glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)glewGetProcAddress((const GLubyte*)"glCheckFramebufferStatus")) == NULL) || r; r = ((glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glDeleteFramebuffers")) == NULL) || r; r = ((glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glDeleteRenderbuffers")) == NULL) || r; r = ((glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)glewGetProcAddress((const GLubyte*)"glFramebufferRenderbuffer")) == NULL) || r; r = ((glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture1D")) == NULL) || r; r = ((glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture2D")) == NULL) || r; r = ((glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture3D")) == NULL) || r; r = ((glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureLayer")) == NULL) || r; r = ((glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glGenFramebuffers")) == NULL) || r; r = ((glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glGenRenderbuffers")) == NULL) || r; r = ((glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC)glewGetProcAddress((const GLubyte*)"glGenerateMipmap")) == NULL) || r; r = ((glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetFramebufferAttachmentParameteriv")) == NULL) || r; r = ((glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetRenderbufferParameteriv")) == NULL) || r; r = ((glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC)glewGetProcAddress((const GLubyte*)"glIsFramebuffer")) == NULL) || r; r = ((glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)glewGetProcAddress((const GLubyte*)"glIsRenderbuffer")) == NULL) || r; r = ((glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)glewGetProcAddress((const GLubyte*)"glRenderbufferStorage")) == NULL) || r; r = ((glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glRenderbufferStorageMultisample")) == NULL) || r; return r; } #endif /* GL_ARB_framebuffer_object */ #ifdef GL_ARB_framebuffer_sRGB #endif /* GL_ARB_framebuffer_sRGB */ #ifdef GL_ARB_geometry_shader4 static GLboolean _glewInit_GL_ARB_geometry_shader4 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glFramebufferTextureARB = (PFNGLFRAMEBUFFERTEXTUREARBPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureARB")) == NULL) || r; r = ((glFramebufferTextureFaceARB = (PFNGLFRAMEBUFFERTEXTUREFACEARBPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureFaceARB")) == NULL) || r; r = ((glFramebufferTextureLayerARB = (PFNGLFRAMEBUFFERTEXTURELAYERARBPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureLayerARB")) == NULL) || r; r = ((glProgramParameteriARB = (PFNGLPROGRAMPARAMETERIARBPROC)glewGetProcAddress((const GLubyte*)"glProgramParameteriARB")) == NULL) || r; return r; } #endif /* GL_ARB_geometry_shader4 */ #ifdef GL_ARB_get_program_binary static GLboolean _glewInit_GL_ARB_get_program_binary (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetProgramBinary = (PFNGLGETPROGRAMBINARYPROC)glewGetProcAddress((const GLubyte*)"glGetProgramBinary")) == NULL) || r; r = ((glProgramBinary = (PFNGLPROGRAMBINARYPROC)glewGetProcAddress((const GLubyte*)"glProgramBinary")) == NULL) || r; r = ((glProgramParameteri = (PFNGLPROGRAMPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glProgramParameteri")) == NULL) || r; return r; } #endif /* GL_ARB_get_program_binary */ #ifdef GL_ARB_gpu_shader5 #endif /* GL_ARB_gpu_shader5 */ #ifdef GL_ARB_gpu_shader_fp64 static GLboolean _glewInit_GL_ARB_gpu_shader_fp64 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetUniformdv = (PFNGLGETUNIFORMDVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformdv")) == NULL) || r; r = ((glUniform1d = (PFNGLUNIFORM1DPROC)glewGetProcAddress((const GLubyte*)"glUniform1d")) == NULL) || r; r = ((glUniform1dv = (PFNGLUNIFORM1DVPROC)glewGetProcAddress((const GLubyte*)"glUniform1dv")) == NULL) || r; r = ((glUniform2d = (PFNGLUNIFORM2DPROC)glewGetProcAddress((const GLubyte*)"glUniform2d")) == NULL) || r; r = ((glUniform2dv = (PFNGLUNIFORM2DVPROC)glewGetProcAddress((const GLubyte*)"glUniform2dv")) == NULL) || r; r = ((glUniform3d = (PFNGLUNIFORM3DPROC)glewGetProcAddress((const GLubyte*)"glUniform3d")) == NULL) || r; r = ((glUniform3dv = (PFNGLUNIFORM3DVPROC)glewGetProcAddress((const GLubyte*)"glUniform3dv")) == NULL) || r; r = ((glUniform4d = (PFNGLUNIFORM4DPROC)glewGetProcAddress((const GLubyte*)"glUniform4d")) == NULL) || r; r = ((glUniform4dv = (PFNGLUNIFORM4DVPROC)glewGetProcAddress((const GLubyte*)"glUniform4dv")) == NULL) || r; r = ((glUniformMatrix2dv = (PFNGLUNIFORMMATRIX2DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2dv")) == NULL) || r; r = ((glUniformMatrix2x3dv = (PFNGLUNIFORMMATRIX2X3DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2x3dv")) == NULL) || r; r = ((glUniformMatrix2x4dv = (PFNGLUNIFORMMATRIX2X4DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2x4dv")) == NULL) || r; r = ((glUniformMatrix3dv = (PFNGLUNIFORMMATRIX3DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3dv")) == NULL) || r; r = ((glUniformMatrix3x2dv = (PFNGLUNIFORMMATRIX3X2DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3x2dv")) == NULL) || r; r = ((glUniformMatrix3x4dv = (PFNGLUNIFORMMATRIX3X4DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3x4dv")) == NULL) || r; r = ((glUniformMatrix4dv = (PFNGLUNIFORMMATRIX4DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4dv")) == NULL) || r; r = ((glUniformMatrix4x2dv = (PFNGLUNIFORMMATRIX4X2DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4x2dv")) == NULL) || r; r = ((glUniformMatrix4x3dv = (PFNGLUNIFORMMATRIX4X3DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4x3dv")) == NULL) || r; return r; } #endif /* GL_ARB_gpu_shader_fp64 */ #ifdef GL_ARB_half_float_pixel #endif /* GL_ARB_half_float_pixel */ #ifdef GL_ARB_half_float_vertex #endif /* GL_ARB_half_float_vertex */ #ifdef GL_ARB_imaging static GLboolean _glewInit_GL_ARB_imaging (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBlendEquation = (PFNGLBLENDEQUATIONPROC)glewGetProcAddress((const GLubyte*)"glBlendEquation")) == NULL) || r; r = ((glColorSubTable = (PFNGLCOLORSUBTABLEPROC)glewGetProcAddress((const GLubyte*)"glColorSubTable")) == NULL) || r; r = ((glColorTable = (PFNGLCOLORTABLEPROC)glewGetProcAddress((const GLubyte*)"glColorTable")) == NULL) || r; r = ((glColorTableParameterfv = (PFNGLCOLORTABLEPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glColorTableParameterfv")) == NULL) || r; r = ((glColorTableParameteriv = (PFNGLCOLORTABLEPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glColorTableParameteriv")) == NULL) || r; r = ((glConvolutionFilter1D = (PFNGLCONVOLUTIONFILTER1DPROC)glewGetProcAddress((const GLubyte*)"glConvolutionFilter1D")) == NULL) || r; r = ((glConvolutionFilter2D = (PFNGLCONVOLUTIONFILTER2DPROC)glewGetProcAddress((const GLubyte*)"glConvolutionFilter2D")) == NULL) || r; r = ((glConvolutionParameterf = (PFNGLCONVOLUTIONPARAMETERFPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameterf")) == NULL) || r; r = ((glConvolutionParameterfv = (PFNGLCONVOLUTIONPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameterfv")) == NULL) || r; r = ((glConvolutionParameteri = (PFNGLCONVOLUTIONPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameteri")) == NULL) || r; r = ((glConvolutionParameteriv = (PFNGLCONVOLUTIONPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameteriv")) == NULL) || r; r = ((glCopyColorSubTable = (PFNGLCOPYCOLORSUBTABLEPROC)glewGetProcAddress((const GLubyte*)"glCopyColorSubTable")) == NULL) || r; r = ((glCopyColorTable = (PFNGLCOPYCOLORTABLEPROC)glewGetProcAddress((const GLubyte*)"glCopyColorTable")) == NULL) || r; r = ((glCopyConvolutionFilter1D = (PFNGLCOPYCONVOLUTIONFILTER1DPROC)glewGetProcAddress((const GLubyte*)"glCopyConvolutionFilter1D")) == NULL) || r; r = ((glCopyConvolutionFilter2D = (PFNGLCOPYCONVOLUTIONFILTER2DPROC)glewGetProcAddress((const GLubyte*)"glCopyConvolutionFilter2D")) == NULL) || r; r = ((glGetColorTable = (PFNGLGETCOLORTABLEPROC)glewGetProcAddress((const GLubyte*)"glGetColorTable")) == NULL) || r; r = ((glGetColorTableParameterfv = (PFNGLGETCOLORTABLEPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameterfv")) == NULL) || r; r = ((glGetColorTableParameteriv = (PFNGLGETCOLORTABLEPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameteriv")) == NULL) || r; r = ((glGetConvolutionFilter = (PFNGLGETCONVOLUTIONFILTERPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionFilter")) == NULL) || r; r = ((glGetConvolutionParameterfv = (PFNGLGETCONVOLUTIONPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionParameterfv")) == NULL) || r; r = ((glGetConvolutionParameteriv = (PFNGLGETCONVOLUTIONPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionParameteriv")) == NULL) || r; r = ((glGetHistogram = (PFNGLGETHISTOGRAMPROC)glewGetProcAddress((const GLubyte*)"glGetHistogram")) == NULL) || r; r = ((glGetHistogramParameterfv = (PFNGLGETHISTOGRAMPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetHistogramParameterfv")) == NULL) || r; r = ((glGetHistogramParameteriv = (PFNGLGETHISTOGRAMPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetHistogramParameteriv")) == NULL) || r; r = ((glGetMinmax = (PFNGLGETMINMAXPROC)glewGetProcAddress((const GLubyte*)"glGetMinmax")) == NULL) || r; r = ((glGetMinmaxParameterfv = (PFNGLGETMINMAXPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetMinmaxParameterfv")) == NULL) || r; r = ((glGetMinmaxParameteriv = (PFNGLGETMINMAXPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetMinmaxParameteriv")) == NULL) || r; r = ((glGetSeparableFilter = (PFNGLGETSEPARABLEFILTERPROC)glewGetProcAddress((const GLubyte*)"glGetSeparableFilter")) == NULL) || r; r = ((glHistogram = (PFNGLHISTOGRAMPROC)glewGetProcAddress((const GLubyte*)"glHistogram")) == NULL) || r; r = ((glMinmax = (PFNGLMINMAXPROC)glewGetProcAddress((const GLubyte*)"glMinmax")) == NULL) || r; r = ((glResetHistogram = (PFNGLRESETHISTOGRAMPROC)glewGetProcAddress((const GLubyte*)"glResetHistogram")) == NULL) || r; r = ((glResetMinmax = (PFNGLRESETMINMAXPROC)glewGetProcAddress((const GLubyte*)"glResetMinmax")) == NULL) || r; r = ((glSeparableFilter2D = (PFNGLSEPARABLEFILTER2DPROC)glewGetProcAddress((const GLubyte*)"glSeparableFilter2D")) == NULL) || r; return r; } #endif /* GL_ARB_imaging */ #ifdef GL_ARB_instanced_arrays static GLboolean _glewInit_GL_ARB_instanced_arrays (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDrawArraysInstancedARB = (PFNGLDRAWARRAYSINSTANCEDARBPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysInstancedARB")) == NULL) || r; r = ((glDrawElementsInstancedARB = (PFNGLDRAWELEMENTSINSTANCEDARBPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstancedARB")) == NULL) || r; r = ((glVertexAttribDivisorARB = (PFNGLVERTEXATTRIBDIVISORARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribDivisorARB")) == NULL) || r; return r; } #endif /* GL_ARB_instanced_arrays */ #ifdef GL_ARB_internalformat_query static GLboolean _glewInit_GL_ARB_internalformat_query (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetInternalformativ = (PFNGLGETINTERNALFORMATIVPROC)glewGetProcAddress((const GLubyte*)"glGetInternalformativ")) == NULL) || r; return r; } #endif /* GL_ARB_internalformat_query */ #ifdef GL_ARB_internalformat_query2 static GLboolean _glewInit_GL_ARB_internalformat_query2 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetInternalformati64v = (PFNGLGETINTERNALFORMATI64VPROC)glewGetProcAddress((const GLubyte*)"glGetInternalformati64v")) == NULL) || r; return r; } #endif /* GL_ARB_internalformat_query2 */ #ifdef GL_ARB_invalidate_subdata static GLboolean _glewInit_GL_ARB_invalidate_subdata (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glInvalidateBufferData = (PFNGLINVALIDATEBUFFERDATAPROC)glewGetProcAddress((const GLubyte*)"glInvalidateBufferData")) == NULL) || r; r = ((glInvalidateBufferSubData = (PFNGLINVALIDATEBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glInvalidateBufferSubData")) == NULL) || r; r = ((glInvalidateFramebuffer = (PFNGLINVALIDATEFRAMEBUFFERPROC)glewGetProcAddress((const GLubyte*)"glInvalidateFramebuffer")) == NULL) || r; r = ((glInvalidateSubFramebuffer = (PFNGLINVALIDATESUBFRAMEBUFFERPROC)glewGetProcAddress((const GLubyte*)"glInvalidateSubFramebuffer")) == NULL) || r; r = ((glInvalidateTexImage = (PFNGLINVALIDATETEXIMAGEPROC)glewGetProcAddress((const GLubyte*)"glInvalidateTexImage")) == NULL) || r; r = ((glInvalidateTexSubImage = (PFNGLINVALIDATETEXSUBIMAGEPROC)glewGetProcAddress((const GLubyte*)"glInvalidateTexSubImage")) == NULL) || r; return r; } #endif /* GL_ARB_invalidate_subdata */ #ifdef GL_ARB_map_buffer_alignment #endif /* GL_ARB_map_buffer_alignment */ #ifdef GL_ARB_map_buffer_range static GLboolean _glewInit_GL_ARB_map_buffer_range (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glFlushMappedBufferRange")) == NULL) || r; r = ((glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glMapBufferRange")) == NULL) || r; return r; } #endif /* GL_ARB_map_buffer_range */ #ifdef GL_ARB_matrix_palette static GLboolean _glewInit_GL_ARB_matrix_palette (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glCurrentPaletteMatrixARB = (PFNGLCURRENTPALETTEMATRIXARBPROC)glewGetProcAddress((const GLubyte*)"glCurrentPaletteMatrixARB")) == NULL) || r; r = ((glMatrixIndexPointerARB = (PFNGLMATRIXINDEXPOINTERARBPROC)glewGetProcAddress((const GLubyte*)"glMatrixIndexPointerARB")) == NULL) || r; r = ((glMatrixIndexubvARB = (PFNGLMATRIXINDEXUBVARBPROC)glewGetProcAddress((const GLubyte*)"glMatrixIndexubvARB")) == NULL) || r; r = ((glMatrixIndexuivARB = (PFNGLMATRIXINDEXUIVARBPROC)glewGetProcAddress((const GLubyte*)"glMatrixIndexuivARB")) == NULL) || r; r = ((glMatrixIndexusvARB = (PFNGLMATRIXINDEXUSVARBPROC)glewGetProcAddress((const GLubyte*)"glMatrixIndexusvARB")) == NULL) || r; return r; } #endif /* GL_ARB_matrix_palette */ #ifdef GL_ARB_multi_draw_indirect static GLboolean _glewInit_GL_ARB_multi_draw_indirect (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glMultiDrawArraysIndirect = (PFNGLMULTIDRAWARRAYSINDIRECTPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArraysIndirect")) == NULL) || r; r = ((glMultiDrawElementsIndirect = (PFNGLMULTIDRAWELEMENTSINDIRECTPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsIndirect")) == NULL) || r; return r; } #endif /* GL_ARB_multi_draw_indirect */ #ifdef GL_ARB_multisample static GLboolean _glewInit_GL_ARB_multisample (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glSampleCoverageARB = (PFNGLSAMPLECOVERAGEARBPROC)glewGetProcAddress((const GLubyte*)"glSampleCoverageARB")) == NULL) || r; return r; } #endif /* GL_ARB_multisample */ #ifdef GL_ARB_multitexture static GLboolean _glewInit_GL_ARB_multitexture (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)glewGetProcAddress((const GLubyte*)"glActiveTextureARB")) == NULL) || r; r = ((glClientActiveTextureARB = (PFNGLCLIENTACTIVETEXTUREARBPROC)glewGetProcAddress((const GLubyte*)"glClientActiveTextureARB")) == NULL) || r; r = ((glMultiTexCoord1dARB = (PFNGLMULTITEXCOORD1DARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1dARB")) == NULL) || r; r = ((glMultiTexCoord1dvARB = (PFNGLMULTITEXCOORD1DVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1dvARB")) == NULL) || r; r = ((glMultiTexCoord1fARB = (PFNGLMULTITEXCOORD1FARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1fARB")) == NULL) || r; r = ((glMultiTexCoord1fvARB = (PFNGLMULTITEXCOORD1FVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1fvARB")) == NULL) || r; r = ((glMultiTexCoord1iARB = (PFNGLMULTITEXCOORD1IARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1iARB")) == NULL) || r; r = ((glMultiTexCoord1ivARB = (PFNGLMULTITEXCOORD1IVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1ivARB")) == NULL) || r; r = ((glMultiTexCoord1sARB = (PFNGLMULTITEXCOORD1SARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1sARB")) == NULL) || r; r = ((glMultiTexCoord1svARB = (PFNGLMULTITEXCOORD1SVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1svARB")) == NULL) || r; r = ((glMultiTexCoord2dARB = (PFNGLMULTITEXCOORD2DARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2dARB")) == NULL) || r; r = ((glMultiTexCoord2dvARB = (PFNGLMULTITEXCOORD2DVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2dvARB")) == NULL) || r; r = ((glMultiTexCoord2fARB = (PFNGLMULTITEXCOORD2FARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2fARB")) == NULL) || r; r = ((glMultiTexCoord2fvARB = (PFNGLMULTITEXCOORD2FVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2fvARB")) == NULL) || r; r = ((glMultiTexCoord2iARB = (PFNGLMULTITEXCOORD2IARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2iARB")) == NULL) || r; r = ((glMultiTexCoord2ivARB = (PFNGLMULTITEXCOORD2IVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2ivARB")) == NULL) || r; r = ((glMultiTexCoord2sARB = (PFNGLMULTITEXCOORD2SARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2sARB")) == NULL) || r; r = ((glMultiTexCoord2svARB = (PFNGLMULTITEXCOORD2SVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2svARB")) == NULL) || r; r = ((glMultiTexCoord3dARB = (PFNGLMULTITEXCOORD3DARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3dARB")) == NULL) || r; r = ((glMultiTexCoord3dvARB = (PFNGLMULTITEXCOORD3DVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3dvARB")) == NULL) || r; r = ((glMultiTexCoord3fARB = (PFNGLMULTITEXCOORD3FARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3fARB")) == NULL) || r; r = ((glMultiTexCoord3fvARB = (PFNGLMULTITEXCOORD3FVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3fvARB")) == NULL) || r; r = ((glMultiTexCoord3iARB = (PFNGLMULTITEXCOORD3IARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3iARB")) == NULL) || r; r = ((glMultiTexCoord3ivARB = (PFNGLMULTITEXCOORD3IVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3ivARB")) == NULL) || r; r = ((glMultiTexCoord3sARB = (PFNGLMULTITEXCOORD3SARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3sARB")) == NULL) || r; r = ((glMultiTexCoord3svARB = (PFNGLMULTITEXCOORD3SVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3svARB")) == NULL) || r; r = ((glMultiTexCoord4dARB = (PFNGLMULTITEXCOORD4DARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4dARB")) == NULL) || r; r = ((glMultiTexCoord4dvARB = (PFNGLMULTITEXCOORD4DVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4dvARB")) == NULL) || r; r = ((glMultiTexCoord4fARB = (PFNGLMULTITEXCOORD4FARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4fARB")) == NULL) || r; r = ((glMultiTexCoord4fvARB = (PFNGLMULTITEXCOORD4FVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4fvARB")) == NULL) || r; r = ((glMultiTexCoord4iARB = (PFNGLMULTITEXCOORD4IARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4iARB")) == NULL) || r; r = ((glMultiTexCoord4ivARB = (PFNGLMULTITEXCOORD4IVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4ivARB")) == NULL) || r; r = ((glMultiTexCoord4sARB = (PFNGLMULTITEXCOORD4SARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4sARB")) == NULL) || r; r = ((glMultiTexCoord4svARB = (PFNGLMULTITEXCOORD4SVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4svARB")) == NULL) || r; return r; } #endif /* GL_ARB_multitexture */ #ifdef GL_ARB_occlusion_query static GLboolean _glewInit_GL_ARB_occlusion_query (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBeginQueryARB = (PFNGLBEGINQUERYARBPROC)glewGetProcAddress((const GLubyte*)"glBeginQueryARB")) == NULL) || r; r = ((glDeleteQueriesARB = (PFNGLDELETEQUERIESARBPROC)glewGetProcAddress((const GLubyte*)"glDeleteQueriesARB")) == NULL) || r; r = ((glEndQueryARB = (PFNGLENDQUERYARBPROC)glewGetProcAddress((const GLubyte*)"glEndQueryARB")) == NULL) || r; r = ((glGenQueriesARB = (PFNGLGENQUERIESARBPROC)glewGetProcAddress((const GLubyte*)"glGenQueriesARB")) == NULL) || r; r = ((glGetQueryObjectivARB = (PFNGLGETQUERYOBJECTIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectivARB")) == NULL) || r; r = ((glGetQueryObjectuivARB = (PFNGLGETQUERYOBJECTUIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectuivARB")) == NULL) || r; r = ((glGetQueryivARB = (PFNGLGETQUERYIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetQueryivARB")) == NULL) || r; r = ((glIsQueryARB = (PFNGLISQUERYARBPROC)glewGetProcAddress((const GLubyte*)"glIsQueryARB")) == NULL) || r; return r; } #endif /* GL_ARB_occlusion_query */ #ifdef GL_ARB_occlusion_query2 #endif /* GL_ARB_occlusion_query2 */ #ifdef GL_ARB_pixel_buffer_object #endif /* GL_ARB_pixel_buffer_object */ #ifdef GL_ARB_point_parameters static GLboolean _glewInit_GL_ARB_point_parameters (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glPointParameterfARB = (PFNGLPOINTPARAMETERFARBPROC)glewGetProcAddress((const GLubyte*)"glPointParameterfARB")) == NULL) || r; r = ((glPointParameterfvARB = (PFNGLPOINTPARAMETERFVARBPROC)glewGetProcAddress((const GLubyte*)"glPointParameterfvARB")) == NULL) || r; return r; } #endif /* GL_ARB_point_parameters */ #ifdef GL_ARB_point_sprite #endif /* GL_ARB_point_sprite */ #ifdef GL_ARB_program_interface_query static GLboolean _glewInit_GL_ARB_program_interface_query (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetProgramInterfaceiv = (PFNGLGETPROGRAMINTERFACEIVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramInterfaceiv")) == NULL) || r; r = ((glGetProgramResourceIndex = (PFNGLGETPROGRAMRESOURCEINDEXPROC)glewGetProcAddress((const GLubyte*)"glGetProgramResourceIndex")) == NULL) || r; r = ((glGetProgramResourceLocation = (PFNGLGETPROGRAMRESOURCELOCATIONPROC)glewGetProcAddress((const GLubyte*)"glGetProgramResourceLocation")) == NULL) || r; r = ((glGetProgramResourceLocationIndex = (PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC)glewGetProcAddress((const GLubyte*)"glGetProgramResourceLocationIndex")) == NULL) || r; r = ((glGetProgramResourceName = (PFNGLGETPROGRAMRESOURCENAMEPROC)glewGetProcAddress((const GLubyte*)"glGetProgramResourceName")) == NULL) || r; r = ((glGetProgramResourceiv = (PFNGLGETPROGRAMRESOURCEIVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramResourceiv")) == NULL) || r; return r; } #endif /* GL_ARB_program_interface_query */ #ifdef GL_ARB_provoking_vertex static GLboolean _glewInit_GL_ARB_provoking_vertex (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glProvokingVertex = (PFNGLPROVOKINGVERTEXPROC)glewGetProcAddress((const GLubyte*)"glProvokingVertex")) == NULL) || r; return r; } #endif /* GL_ARB_provoking_vertex */ #ifdef GL_ARB_robust_buffer_access_behavior #endif /* GL_ARB_robust_buffer_access_behavior */ #ifdef GL_ARB_robustness static GLboolean _glewInit_GL_ARB_robustness (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetGraphicsResetStatusARB = (PFNGLGETGRAPHICSRESETSTATUSARBPROC)glewGetProcAddress((const GLubyte*)"glGetGraphicsResetStatusARB")) == NULL) || r; r = ((glGetnColorTableARB = (PFNGLGETNCOLORTABLEARBPROC)glewGetProcAddress((const GLubyte*)"glGetnColorTableARB")) == NULL) || r; r = ((glGetnCompressedTexImageARB = (PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC)glewGetProcAddress((const GLubyte*)"glGetnCompressedTexImageARB")) == NULL) || r; r = ((glGetnConvolutionFilterARB = (PFNGLGETNCONVOLUTIONFILTERARBPROC)glewGetProcAddress((const GLubyte*)"glGetnConvolutionFilterARB")) == NULL) || r; r = ((glGetnHistogramARB = (PFNGLGETNHISTOGRAMARBPROC)glewGetProcAddress((const GLubyte*)"glGetnHistogramARB")) == NULL) || r; r = ((glGetnMapdvARB = (PFNGLGETNMAPDVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnMapdvARB")) == NULL) || r; r = ((glGetnMapfvARB = (PFNGLGETNMAPFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnMapfvARB")) == NULL) || r; r = ((glGetnMapivARB = (PFNGLGETNMAPIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnMapivARB")) == NULL) || r; r = ((glGetnMinmaxARB = (PFNGLGETNMINMAXARBPROC)glewGetProcAddress((const GLubyte*)"glGetnMinmaxARB")) == NULL) || r; r = ((glGetnPixelMapfvARB = (PFNGLGETNPIXELMAPFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnPixelMapfvARB")) == NULL) || r; r = ((glGetnPixelMapuivARB = (PFNGLGETNPIXELMAPUIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnPixelMapuivARB")) == NULL) || r; r = ((glGetnPixelMapusvARB = (PFNGLGETNPIXELMAPUSVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnPixelMapusvARB")) == NULL) || r; r = ((glGetnPolygonStippleARB = (PFNGLGETNPOLYGONSTIPPLEARBPROC)glewGetProcAddress((const GLubyte*)"glGetnPolygonStippleARB")) == NULL) || r; r = ((glGetnSeparableFilterARB = (PFNGLGETNSEPARABLEFILTERARBPROC)glewGetProcAddress((const GLubyte*)"glGetnSeparableFilterARB")) == NULL) || r; r = ((glGetnTexImageARB = (PFNGLGETNTEXIMAGEARBPROC)glewGetProcAddress((const GLubyte*)"glGetnTexImageARB")) == NULL) || r; r = ((glGetnUniformdvARB = (PFNGLGETNUNIFORMDVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformdvARB")) == NULL) || r; r = ((glGetnUniformfvARB = (PFNGLGETNUNIFORMFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformfvARB")) == NULL) || r; r = ((glGetnUniformivARB = (PFNGLGETNUNIFORMIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformivARB")) == NULL) || r; r = ((glGetnUniformuivARB = (PFNGLGETNUNIFORMUIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformuivARB")) == NULL) || r; r = ((glReadnPixelsARB = (PFNGLREADNPIXELSARBPROC)glewGetProcAddress((const GLubyte*)"glReadnPixelsARB")) == NULL) || r; return r; } #endif /* GL_ARB_robustness */ #ifdef GL_ARB_robustness_application_isolation #endif /* GL_ARB_robustness_application_isolation */ #ifdef GL_ARB_robustness_share_group_isolation #endif /* GL_ARB_robustness_share_group_isolation */ #ifdef GL_ARB_sample_shading static GLboolean _glewInit_GL_ARB_sample_shading (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glMinSampleShadingARB = (PFNGLMINSAMPLESHADINGARBPROC)glewGetProcAddress((const GLubyte*)"glMinSampleShadingARB")) == NULL) || r; return r; } #endif /* GL_ARB_sample_shading */ #ifdef GL_ARB_sampler_objects static GLboolean _glewInit_GL_ARB_sampler_objects (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBindSampler = (PFNGLBINDSAMPLERPROC)glewGetProcAddress((const GLubyte*)"glBindSampler")) == NULL) || r; r = ((glDeleteSamplers = (PFNGLDELETESAMPLERSPROC)glewGetProcAddress((const GLubyte*)"glDeleteSamplers")) == NULL) || r; r = ((glGenSamplers = (PFNGLGENSAMPLERSPROC)glewGetProcAddress((const GLubyte*)"glGenSamplers")) == NULL) || r; r = ((glGetSamplerParameterIiv = (PFNGLGETSAMPLERPARAMETERIIVPROC)glewGetProcAddress((const GLubyte*)"glGetSamplerParameterIiv")) == NULL) || r; r = ((glGetSamplerParameterIuiv = (PFNGLGETSAMPLERPARAMETERIUIVPROC)glewGetProcAddress((const GLubyte*)"glGetSamplerParameterIuiv")) == NULL) || r; r = ((glGetSamplerParameterfv = (PFNGLGETSAMPLERPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetSamplerParameterfv")) == NULL) || r; r = ((glGetSamplerParameteriv = (PFNGLGETSAMPLERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetSamplerParameteriv")) == NULL) || r; r = ((glIsSampler = (PFNGLISSAMPLERPROC)glewGetProcAddress((const GLubyte*)"glIsSampler")) == NULL) || r; r = ((glSamplerParameterIiv = (PFNGLSAMPLERPARAMETERIIVPROC)glewGetProcAddress((const GLubyte*)"glSamplerParameterIiv")) == NULL) || r; r = ((glSamplerParameterIuiv = (PFNGLSAMPLERPARAMETERIUIVPROC)glewGetProcAddress((const GLubyte*)"glSamplerParameterIuiv")) == NULL) || r; r = ((glSamplerParameterf = (PFNGLSAMPLERPARAMETERFPROC)glewGetProcAddress((const GLubyte*)"glSamplerParameterf")) == NULL) || r; r = ((glSamplerParameterfv = (PFNGLSAMPLERPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glSamplerParameterfv")) == NULL) || r; r = ((glSamplerParameteri = (PFNGLSAMPLERPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glSamplerParameteri")) == NULL) || r; r = ((glSamplerParameteriv = (PFNGLSAMPLERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glSamplerParameteriv")) == NULL) || r; return r; } #endif /* GL_ARB_sampler_objects */ #ifdef GL_ARB_seamless_cube_map #endif /* GL_ARB_seamless_cube_map */ #ifdef GL_ARB_separate_shader_objects static GLboolean _glewInit_GL_ARB_separate_shader_objects (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glActiveShaderProgram = (PFNGLACTIVESHADERPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glActiveShaderProgram")) == NULL) || r; r = ((glBindProgramPipeline = (PFNGLBINDPROGRAMPIPELINEPROC)glewGetProcAddress((const GLubyte*)"glBindProgramPipeline")) == NULL) || r; r = ((glCreateShaderProgramv = (PFNGLCREATESHADERPROGRAMVPROC)glewGetProcAddress((const GLubyte*)"glCreateShaderProgramv")) == NULL) || r; r = ((glDeleteProgramPipelines = (PFNGLDELETEPROGRAMPIPELINESPROC)glewGetProcAddress((const GLubyte*)"glDeleteProgramPipelines")) == NULL) || r; r = ((glGenProgramPipelines = (PFNGLGENPROGRAMPIPELINESPROC)glewGetProcAddress((const GLubyte*)"glGenProgramPipelines")) == NULL) || r; r = ((glGetProgramPipelineInfoLog = (PFNGLGETPROGRAMPIPELINEINFOLOGPROC)glewGetProcAddress((const GLubyte*)"glGetProgramPipelineInfoLog")) == NULL) || r; r = ((glGetProgramPipelineiv = (PFNGLGETPROGRAMPIPELINEIVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramPipelineiv")) == NULL) || r; r = ((glIsProgramPipeline = (PFNGLISPROGRAMPIPELINEPROC)glewGetProcAddress((const GLubyte*)"glIsProgramPipeline")) == NULL) || r; r = ((glProgramUniform1d = (PFNGLPROGRAMUNIFORM1DPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1d")) == NULL) || r; r = ((glProgramUniform1dv = (PFNGLPROGRAMUNIFORM1DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1dv")) == NULL) || r; r = ((glProgramUniform1f = (PFNGLPROGRAMUNIFORM1FPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1f")) == NULL) || r; r = ((glProgramUniform1fv = (PFNGLPROGRAMUNIFORM1FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1fv")) == NULL) || r; r = ((glProgramUniform1i = (PFNGLPROGRAMUNIFORM1IPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1i")) == NULL) || r; r = ((glProgramUniform1iv = (PFNGLPROGRAMUNIFORM1IVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1iv")) == NULL) || r; r = ((glProgramUniform1ui = (PFNGLPROGRAMUNIFORM1UIPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1ui")) == NULL) || r; r = ((glProgramUniform1uiv = (PFNGLPROGRAMUNIFORM1UIVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1uiv")) == NULL) || r; r = ((glProgramUniform2d = (PFNGLPROGRAMUNIFORM2DPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2d")) == NULL) || r; r = ((glProgramUniform2dv = (PFNGLPROGRAMUNIFORM2DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2dv")) == NULL) || r; r = ((glProgramUniform2f = (PFNGLPROGRAMUNIFORM2FPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2f")) == NULL) || r; r = ((glProgramUniform2fv = (PFNGLPROGRAMUNIFORM2FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2fv")) == NULL) || r; r = ((glProgramUniform2i = (PFNGLPROGRAMUNIFORM2IPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2i")) == NULL) || r; r = ((glProgramUniform2iv = (PFNGLPROGRAMUNIFORM2IVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2iv")) == NULL) || r; r = ((glProgramUniform2ui = (PFNGLPROGRAMUNIFORM2UIPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2ui")) == NULL) || r; r = ((glProgramUniform2uiv = (PFNGLPROGRAMUNIFORM2UIVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2uiv")) == NULL) || r; r = ((glProgramUniform3d = (PFNGLPROGRAMUNIFORM3DPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3d")) == NULL) || r; r = ((glProgramUniform3dv = (PFNGLPROGRAMUNIFORM3DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3dv")) == NULL) || r; r = ((glProgramUniform3f = (PFNGLPROGRAMUNIFORM3FPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3f")) == NULL) || r; r = ((glProgramUniform3fv = (PFNGLPROGRAMUNIFORM3FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3fv")) == NULL) || r; r = ((glProgramUniform3i = (PFNGLPROGRAMUNIFORM3IPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3i")) == NULL) || r; r = ((glProgramUniform3iv = (PFNGLPROGRAMUNIFORM3IVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3iv")) == NULL) || r; r = ((glProgramUniform3ui = (PFNGLPROGRAMUNIFORM3UIPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3ui")) == NULL) || r; r = ((glProgramUniform3uiv = (PFNGLPROGRAMUNIFORM3UIVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3uiv")) == NULL) || r; r = ((glProgramUniform4d = (PFNGLPROGRAMUNIFORM4DPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4d")) == NULL) || r; r = ((glProgramUniform4dv = (PFNGLPROGRAMUNIFORM4DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4dv")) == NULL) || r; r = ((glProgramUniform4f = (PFNGLPROGRAMUNIFORM4FPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4f")) == NULL) || r; r = ((glProgramUniform4fv = (PFNGLPROGRAMUNIFORM4FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4fv")) == NULL) || r; r = ((glProgramUniform4i = (PFNGLPROGRAMUNIFORM4IPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4i")) == NULL) || r; r = ((glProgramUniform4iv = (PFNGLPROGRAMUNIFORM4IVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4iv")) == NULL) || r; r = ((glProgramUniform4ui = (PFNGLPROGRAMUNIFORM4UIPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4ui")) == NULL) || r; r = ((glProgramUniform4uiv = (PFNGLPROGRAMUNIFORM4UIVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4uiv")) == NULL) || r; r = ((glProgramUniformMatrix2dv = (PFNGLPROGRAMUNIFORMMATRIX2DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2dv")) == NULL) || r; r = ((glProgramUniformMatrix2fv = (PFNGLPROGRAMUNIFORMMATRIX2FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2fv")) == NULL) || r; r = ((glProgramUniformMatrix2x3dv = (PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2x3dv")) == NULL) || r; r = ((glProgramUniformMatrix2x3fv = (PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2x3fv")) == NULL) || r; r = ((glProgramUniformMatrix2x4dv = (PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2x4dv")) == NULL) || r; r = ((glProgramUniformMatrix2x4fv = (PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2x4fv")) == NULL) || r; r = ((glProgramUniformMatrix3dv = (PFNGLPROGRAMUNIFORMMATRIX3DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3dv")) == NULL) || r; r = ((glProgramUniformMatrix3fv = (PFNGLPROGRAMUNIFORMMATRIX3FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3fv")) == NULL) || r; r = ((glProgramUniformMatrix3x2dv = (PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3x2dv")) == NULL) || r; r = ((glProgramUniformMatrix3x2fv = (PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3x2fv")) == NULL) || r; r = ((glProgramUniformMatrix3x4dv = (PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3x4dv")) == NULL) || r; r = ((glProgramUniformMatrix3x4fv = (PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3x4fv")) == NULL) || r; r = ((glProgramUniformMatrix4dv = (PFNGLPROGRAMUNIFORMMATRIX4DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4dv")) == NULL) || r; r = ((glProgramUniformMatrix4fv = (PFNGLPROGRAMUNIFORMMATRIX4FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4fv")) == NULL) || r; r = ((glProgramUniformMatrix4x2dv = (PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4x2dv")) == NULL) || r; r = ((glProgramUniformMatrix4x2fv = (PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4x2fv")) == NULL) || r; r = ((glProgramUniformMatrix4x3dv = (PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4x3dv")) == NULL) || r; r = ((glProgramUniformMatrix4x3fv = (PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4x3fv")) == NULL) || r; r = ((glUseProgramStages = (PFNGLUSEPROGRAMSTAGESPROC)glewGetProcAddress((const GLubyte*)"glUseProgramStages")) == NULL) || r; r = ((glValidateProgramPipeline = (PFNGLVALIDATEPROGRAMPIPELINEPROC)glewGetProcAddress((const GLubyte*)"glValidateProgramPipeline")) == NULL) || r; return r; } #endif /* GL_ARB_separate_shader_objects */ #ifdef GL_ARB_shader_atomic_counters static GLboolean _glewInit_GL_ARB_shader_atomic_counters (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetActiveAtomicCounterBufferiv = (PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC)glewGetProcAddress((const GLubyte*)"glGetActiveAtomicCounterBufferiv")) == NULL) || r; return r; } #endif /* GL_ARB_shader_atomic_counters */ #ifdef GL_ARB_shader_bit_encoding #endif /* GL_ARB_shader_bit_encoding */ #ifdef GL_ARB_shader_image_load_store static GLboolean _glewInit_GL_ARB_shader_image_load_store (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBindImageTexture = (PFNGLBINDIMAGETEXTUREPROC)glewGetProcAddress((const GLubyte*)"glBindImageTexture")) == NULL) || r; r = ((glMemoryBarrier = (PFNGLMEMORYBARRIERPROC)glewGetProcAddress((const GLubyte*)"glMemoryBarrier")) == NULL) || r; return r; } #endif /* GL_ARB_shader_image_load_store */ #ifdef GL_ARB_shader_image_size #endif /* GL_ARB_shader_image_size */ #ifdef GL_ARB_shader_objects static GLboolean _glewInit_GL_ARB_shader_objects (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glAttachObjectARB")) == NULL) || r; r = ((glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC)glewGetProcAddress((const GLubyte*)"glCompileShaderARB")) == NULL) || r; r = ((glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glCreateProgramObjectARB")) == NULL) || r; r = ((glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glCreateShaderObjectARB")) == NULL) || r; r = ((glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glDeleteObjectARB")) == NULL) || r; r = ((glDetachObjectARB = (PFNGLDETACHOBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glDetachObjectARB")) == NULL) || r; r = ((glGetActiveUniformARB = (PFNGLGETACTIVEUNIFORMARBPROC)glewGetProcAddress((const GLubyte*)"glGetActiveUniformARB")) == NULL) || r; r = ((glGetAttachedObjectsARB = (PFNGLGETATTACHEDOBJECTSARBPROC)glewGetProcAddress((const GLubyte*)"glGetAttachedObjectsARB")) == NULL) || r; r = ((glGetHandleARB = (PFNGLGETHANDLEARBPROC)glewGetProcAddress((const GLubyte*)"glGetHandleARB")) == NULL) || r; r = ((glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC)glewGetProcAddress((const GLubyte*)"glGetInfoLogARB")) == NULL) || r; r = ((glGetObjectParameterfvARB = (PFNGLGETOBJECTPARAMETERFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetObjectParameterfvARB")) == NULL) || r; r = ((glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetObjectParameterivARB")) == NULL) || r; r = ((glGetShaderSourceARB = (PFNGLGETSHADERSOURCEARBPROC)glewGetProcAddress((const GLubyte*)"glGetShaderSourceARB")) == NULL) || r; r = ((glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC)glewGetProcAddress((const GLubyte*)"glGetUniformLocationARB")) == NULL) || r; r = ((glGetUniformfvARB = (PFNGLGETUNIFORMFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetUniformfvARB")) == NULL) || r; r = ((glGetUniformivARB = (PFNGLGETUNIFORMIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetUniformivARB")) == NULL) || r; r = ((glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC)glewGetProcAddress((const GLubyte*)"glLinkProgramARB")) == NULL) || r; r = ((glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)glewGetProcAddress((const GLubyte*)"glShaderSourceARB")) == NULL) || r; r = ((glUniform1fARB = (PFNGLUNIFORM1FARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1fARB")) == NULL) || r; r = ((glUniform1fvARB = (PFNGLUNIFORM1FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1fvARB")) == NULL) || r; r = ((glUniform1iARB = (PFNGLUNIFORM1IARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1iARB")) == NULL) || r; r = ((glUniform1ivARB = (PFNGLUNIFORM1IVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1ivARB")) == NULL) || r; r = ((glUniform2fARB = (PFNGLUNIFORM2FARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2fARB")) == NULL) || r; r = ((glUniform2fvARB = (PFNGLUNIFORM2FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2fvARB")) == NULL) || r; r = ((glUniform2iARB = (PFNGLUNIFORM2IARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2iARB")) == NULL) || r; r = ((glUniform2ivARB = (PFNGLUNIFORM2IVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2ivARB")) == NULL) || r; r = ((glUniform3fARB = (PFNGLUNIFORM3FARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3fARB")) == NULL) || r; r = ((glUniform3fvARB = (PFNGLUNIFORM3FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3fvARB")) == NULL) || r; r = ((glUniform3iARB = (PFNGLUNIFORM3IARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3iARB")) == NULL) || r; r = ((glUniform3ivARB = (PFNGLUNIFORM3IVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3ivARB")) == NULL) || r; r = ((glUniform4fARB = (PFNGLUNIFORM4FARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4fARB")) == NULL) || r; r = ((glUniform4fvARB = (PFNGLUNIFORM4FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4fvARB")) == NULL) || r; r = ((glUniform4iARB = (PFNGLUNIFORM4IARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4iARB")) == NULL) || r; r = ((glUniform4ivARB = (PFNGLUNIFORM4IVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4ivARB")) == NULL) || r; r = ((glUniformMatrix2fvARB = (PFNGLUNIFORMMATRIX2FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2fvARB")) == NULL) || r; r = ((glUniformMatrix3fvARB = (PFNGLUNIFORMMATRIX3FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3fvARB")) == NULL) || r; r = ((glUniformMatrix4fvARB = (PFNGLUNIFORMMATRIX4FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4fvARB")) == NULL) || r; r = ((glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glUseProgramObjectARB")) == NULL) || r; r = ((glValidateProgramARB = (PFNGLVALIDATEPROGRAMARBPROC)glewGetProcAddress((const GLubyte*)"glValidateProgramARB")) == NULL) || r; return r; } #endif /* GL_ARB_shader_objects */ #ifdef GL_ARB_shader_precision #endif /* GL_ARB_shader_precision */ #ifdef GL_ARB_shader_stencil_export #endif /* GL_ARB_shader_stencil_export */ #ifdef GL_ARB_shader_storage_buffer_object static GLboolean _glewInit_GL_ARB_shader_storage_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glShaderStorageBlockBinding = (PFNGLSHADERSTORAGEBLOCKBINDINGPROC)glewGetProcAddress((const GLubyte*)"glShaderStorageBlockBinding")) == NULL) || r; return r; } #endif /* GL_ARB_shader_storage_buffer_object */ #ifdef GL_ARB_shader_subroutine static GLboolean _glewInit_GL_ARB_shader_subroutine (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetActiveSubroutineName = (PFNGLGETACTIVESUBROUTINENAMEPROC)glewGetProcAddress((const GLubyte*)"glGetActiveSubroutineName")) == NULL) || r; r = ((glGetActiveSubroutineUniformName = (PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC)glewGetProcAddress((const GLubyte*)"glGetActiveSubroutineUniformName")) == NULL) || r; r = ((glGetActiveSubroutineUniformiv = (PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC)glewGetProcAddress((const GLubyte*)"glGetActiveSubroutineUniformiv")) == NULL) || r; r = ((glGetProgramStageiv = (PFNGLGETPROGRAMSTAGEIVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramStageiv")) == NULL) || r; r = ((glGetSubroutineIndex = (PFNGLGETSUBROUTINEINDEXPROC)glewGetProcAddress((const GLubyte*)"glGetSubroutineIndex")) == NULL) || r; r = ((glGetSubroutineUniformLocation = (PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC)glewGetProcAddress((const GLubyte*)"glGetSubroutineUniformLocation")) == NULL) || r; r = ((glGetUniformSubroutineuiv = (PFNGLGETUNIFORMSUBROUTINEUIVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformSubroutineuiv")) == NULL) || r; r = ((glUniformSubroutinesuiv = (PFNGLUNIFORMSUBROUTINESUIVPROC)glewGetProcAddress((const GLubyte*)"glUniformSubroutinesuiv")) == NULL) || r; return r; } #endif /* GL_ARB_shader_subroutine */ #ifdef GL_ARB_shader_texture_lod #endif /* GL_ARB_shader_texture_lod */ #ifdef GL_ARB_shading_language_100 #endif /* GL_ARB_shading_language_100 */ #ifdef GL_ARB_shading_language_420pack #endif /* GL_ARB_shading_language_420pack */ #ifdef GL_ARB_shading_language_include static GLboolean _glewInit_GL_ARB_shading_language_include (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glCompileShaderIncludeARB = (PFNGLCOMPILESHADERINCLUDEARBPROC)glewGetProcAddress((const GLubyte*)"glCompileShaderIncludeARB")) == NULL) || r; r = ((glDeleteNamedStringARB = (PFNGLDELETENAMEDSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"glDeleteNamedStringARB")) == NULL) || r; r = ((glGetNamedStringARB = (PFNGLGETNAMEDSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"glGetNamedStringARB")) == NULL) || r; r = ((glGetNamedStringivARB = (PFNGLGETNAMEDSTRINGIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetNamedStringivARB")) == NULL) || r; r = ((glIsNamedStringARB = (PFNGLISNAMEDSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"glIsNamedStringARB")) == NULL) || r; r = ((glNamedStringARB = (PFNGLNAMEDSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"glNamedStringARB")) == NULL) || r; return r; } #endif /* GL_ARB_shading_language_include */ #ifdef GL_ARB_shading_language_packing #endif /* GL_ARB_shading_language_packing */ #ifdef GL_ARB_shadow #endif /* GL_ARB_shadow */ #ifdef GL_ARB_shadow_ambient #endif /* GL_ARB_shadow_ambient */ #ifdef GL_ARB_stencil_texturing #endif /* GL_ARB_stencil_texturing */ #ifdef GL_ARB_sync static GLboolean _glewInit_GL_ARB_sync (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC)glewGetProcAddress((const GLubyte*)"glClientWaitSync")) == NULL) || r; r = ((glDeleteSync = (PFNGLDELETESYNCPROC)glewGetProcAddress((const GLubyte*)"glDeleteSync")) == NULL) || r; r = ((glFenceSync = (PFNGLFENCESYNCPROC)glewGetProcAddress((const GLubyte*)"glFenceSync")) == NULL) || r; r = ((glGetInteger64v = (PFNGLGETINTEGER64VPROC)glewGetProcAddress((const GLubyte*)"glGetInteger64v")) == NULL) || r; r = ((glGetSynciv = (PFNGLGETSYNCIVPROC)glewGetProcAddress((const GLubyte*)"glGetSynciv")) == NULL) || r; r = ((glIsSync = (PFNGLISSYNCPROC)glewGetProcAddress((const GLubyte*)"glIsSync")) == NULL) || r; r = ((glWaitSync = (PFNGLWAITSYNCPROC)glewGetProcAddress((const GLubyte*)"glWaitSync")) == NULL) || r; return r; } #endif /* GL_ARB_sync */ #ifdef GL_ARB_tessellation_shader static GLboolean _glewInit_GL_ARB_tessellation_shader (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glPatchParameterfv = (PFNGLPATCHPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glPatchParameterfv")) == NULL) || r; r = ((glPatchParameteri = (PFNGLPATCHPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glPatchParameteri")) == NULL) || r; return r; } #endif /* GL_ARB_tessellation_shader */ #ifdef GL_ARB_texture_border_clamp #endif /* GL_ARB_texture_border_clamp */ #ifdef GL_ARB_texture_buffer_object static GLboolean _glewInit_GL_ARB_texture_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glTexBufferARB = (PFNGLTEXBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"glTexBufferARB")) == NULL) || r; return r; } #endif /* GL_ARB_texture_buffer_object */ #ifdef GL_ARB_texture_buffer_object_rgb32 #endif /* GL_ARB_texture_buffer_object_rgb32 */ #ifdef GL_ARB_texture_buffer_range static GLboolean _glewInit_GL_ARB_texture_buffer_range (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glTexBufferRange = (PFNGLTEXBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glTexBufferRange")) == NULL) || r; r = ((glTextureBufferRangeEXT = (PFNGLTEXTUREBUFFERRANGEEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureBufferRangeEXT")) == NULL) || r; return r; } #endif /* GL_ARB_texture_buffer_range */ #ifdef GL_ARB_texture_compression static GLboolean _glewInit_GL_ARB_texture_compression (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glCompressedTexImage1DARB = (PFNGLCOMPRESSEDTEXIMAGE1DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage1DARB")) == NULL) || r; r = ((glCompressedTexImage2DARB = (PFNGLCOMPRESSEDTEXIMAGE2DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage2DARB")) == NULL) || r; r = ((glCompressedTexImage3DARB = (PFNGLCOMPRESSEDTEXIMAGE3DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage3DARB")) == NULL) || r; r = ((glCompressedTexSubImage1DARB = (PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage1DARB")) == NULL) || r; r = ((glCompressedTexSubImage2DARB = (PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage2DARB")) == NULL) || r; r = ((glCompressedTexSubImage3DARB = (PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage3DARB")) == NULL) || r; r = ((glGetCompressedTexImageARB = (PFNGLGETCOMPRESSEDTEXIMAGEARBPROC)glewGetProcAddress((const GLubyte*)"glGetCompressedTexImageARB")) == NULL) || r; return r; } #endif /* GL_ARB_texture_compression */ #ifdef GL_ARB_texture_compression_bptc #endif /* GL_ARB_texture_compression_bptc */ #ifdef GL_ARB_texture_compression_rgtc #endif /* GL_ARB_texture_compression_rgtc */ #ifdef GL_ARB_texture_cube_map #endif /* GL_ARB_texture_cube_map */ #ifdef GL_ARB_texture_cube_map_array #endif /* GL_ARB_texture_cube_map_array */ #ifdef GL_ARB_texture_env_add #endif /* GL_ARB_texture_env_add */ #ifdef GL_ARB_texture_env_combine #endif /* GL_ARB_texture_env_combine */ #ifdef GL_ARB_texture_env_crossbar #endif /* GL_ARB_texture_env_crossbar */ #ifdef GL_ARB_texture_env_dot3 #endif /* GL_ARB_texture_env_dot3 */ #ifdef GL_ARB_texture_float #endif /* GL_ARB_texture_float */ #ifdef GL_ARB_texture_gather #endif /* GL_ARB_texture_gather */ #ifdef GL_ARB_texture_mirrored_repeat #endif /* GL_ARB_texture_mirrored_repeat */ #ifdef GL_ARB_texture_multisample static GLboolean _glewInit_GL_ARB_texture_multisample (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC)glewGetProcAddress((const GLubyte*)"glGetMultisamplefv")) == NULL) || r; r = ((glSampleMaski = (PFNGLSAMPLEMASKIPROC)glewGetProcAddress((const GLubyte*)"glSampleMaski")) == NULL) || r; r = ((glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glTexImage2DMultisample")) == NULL) || r; r = ((glTexImage3DMultisample = (PFNGLTEXIMAGE3DMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glTexImage3DMultisample")) == NULL) || r; return r; } #endif /* GL_ARB_texture_multisample */ #ifdef GL_ARB_texture_non_power_of_two #endif /* GL_ARB_texture_non_power_of_two */ #ifdef GL_ARB_texture_query_levels #endif /* GL_ARB_texture_query_levels */ #ifdef GL_ARB_texture_query_lod #endif /* GL_ARB_texture_query_lod */ #ifdef GL_ARB_texture_rectangle #endif /* GL_ARB_texture_rectangle */ #ifdef GL_ARB_texture_rg #endif /* GL_ARB_texture_rg */ #ifdef GL_ARB_texture_rgb10_a2ui #endif /* GL_ARB_texture_rgb10_a2ui */ #ifdef GL_ARB_texture_storage static GLboolean _glewInit_GL_ARB_texture_storage (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glTexStorage1D = (PFNGLTEXSTORAGE1DPROC)glewGetProcAddress((const GLubyte*)"glTexStorage1D")) == NULL) || r; r = ((glTexStorage2D = (PFNGLTEXSTORAGE2DPROC)glewGetProcAddress((const GLubyte*)"glTexStorage2D")) == NULL) || r; r = ((glTexStorage3D = (PFNGLTEXSTORAGE3DPROC)glewGetProcAddress((const GLubyte*)"glTexStorage3D")) == NULL) || r; r = ((glTextureStorage1DEXT = (PFNGLTEXTURESTORAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage1DEXT")) == NULL) || r; r = ((glTextureStorage2DEXT = (PFNGLTEXTURESTORAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage2DEXT")) == NULL) || r; r = ((glTextureStorage3DEXT = (PFNGLTEXTURESTORAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage3DEXT")) == NULL) || r; return r; } #endif /* GL_ARB_texture_storage */ #ifdef GL_ARB_texture_storage_multisample static GLboolean _glewInit_GL_ARB_texture_storage_multisample (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glTexStorage2DMultisample = (PFNGLTEXSTORAGE2DMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glTexStorage2DMultisample")) == NULL) || r; r = ((glTexStorage3DMultisample = (PFNGLTEXSTORAGE3DMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glTexStorage3DMultisample")) == NULL) || r; r = ((glTextureStorage2DMultisampleEXT = (PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage2DMultisampleEXT")) == NULL) || r; r = ((glTextureStorage3DMultisampleEXT = (PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage3DMultisampleEXT")) == NULL) || r; return r; } #endif /* GL_ARB_texture_storage_multisample */ #ifdef GL_ARB_texture_swizzle #endif /* GL_ARB_texture_swizzle */ #ifdef GL_ARB_texture_view static GLboolean _glewInit_GL_ARB_texture_view (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glTextureView = (PFNGLTEXTUREVIEWPROC)glewGetProcAddress((const GLubyte*)"glTextureView")) == NULL) || r; return r; } #endif /* GL_ARB_texture_view */ #ifdef GL_ARB_timer_query static GLboolean _glewInit_GL_ARB_timer_query (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetQueryObjecti64v = (PFNGLGETQUERYOBJECTI64VPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjecti64v")) == NULL) || r; r = ((glGetQueryObjectui64v = (PFNGLGETQUERYOBJECTUI64VPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectui64v")) == NULL) || r; r = ((glQueryCounter = (PFNGLQUERYCOUNTERPROC)glewGetProcAddress((const GLubyte*)"glQueryCounter")) == NULL) || r; return r; } #endif /* GL_ARB_timer_query */ #ifdef GL_ARB_transform_feedback2 static GLboolean _glewInit_GL_ARB_transform_feedback2 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBindTransformFeedback = (PFNGLBINDTRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glBindTransformFeedback")) == NULL) || r; r = ((glDeleteTransformFeedbacks = (PFNGLDELETETRANSFORMFEEDBACKSPROC)glewGetProcAddress((const GLubyte*)"glDeleteTransformFeedbacks")) == NULL) || r; r = ((glDrawTransformFeedback = (PFNGLDRAWTRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glDrawTransformFeedback")) == NULL) || r; r = ((glGenTransformFeedbacks = (PFNGLGENTRANSFORMFEEDBACKSPROC)glewGetProcAddress((const GLubyte*)"glGenTransformFeedbacks")) == NULL) || r; r = ((glIsTransformFeedback = (PFNGLISTRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glIsTransformFeedback")) == NULL) || r; r = ((glPauseTransformFeedback = (PFNGLPAUSETRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glPauseTransformFeedback")) == NULL) || r; r = ((glResumeTransformFeedback = (PFNGLRESUMETRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glResumeTransformFeedback")) == NULL) || r; return r; } #endif /* GL_ARB_transform_feedback2 */ #ifdef GL_ARB_transform_feedback3 static GLboolean _glewInit_GL_ARB_transform_feedback3 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBeginQueryIndexed = (PFNGLBEGINQUERYINDEXEDPROC)glewGetProcAddress((const GLubyte*)"glBeginQueryIndexed")) == NULL) || r; r = ((glDrawTransformFeedbackStream = (PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC)glewGetProcAddress((const GLubyte*)"glDrawTransformFeedbackStream")) == NULL) || r; r = ((glEndQueryIndexed = (PFNGLENDQUERYINDEXEDPROC)glewGetProcAddress((const GLubyte*)"glEndQueryIndexed")) == NULL) || r; r = ((glGetQueryIndexediv = (PFNGLGETQUERYINDEXEDIVPROC)glewGetProcAddress((const GLubyte*)"glGetQueryIndexediv")) == NULL) || r; return r; } #endif /* GL_ARB_transform_feedback3 */ #ifdef GL_ARB_transform_feedback_instanced static GLboolean _glewInit_GL_ARB_transform_feedback_instanced (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDrawTransformFeedbackInstanced = (PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC)glewGetProcAddress((const GLubyte*)"glDrawTransformFeedbackInstanced")) == NULL) || r; r = ((glDrawTransformFeedbackStreamInstanced = (PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC)glewGetProcAddress((const GLubyte*)"glDrawTransformFeedbackStreamInstanced")) == NULL) || r; return r; } #endif /* GL_ARB_transform_feedback_instanced */ #ifdef GL_ARB_transpose_matrix static GLboolean _glewInit_GL_ARB_transpose_matrix (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glLoadTransposeMatrixdARB = (PFNGLLOADTRANSPOSEMATRIXDARBPROC)glewGetProcAddress((const GLubyte*)"glLoadTransposeMatrixdARB")) == NULL) || r; r = ((glLoadTransposeMatrixfARB = (PFNGLLOADTRANSPOSEMATRIXFARBPROC)glewGetProcAddress((const GLubyte*)"glLoadTransposeMatrixfARB")) == NULL) || r; r = ((glMultTransposeMatrixdARB = (PFNGLMULTTRANSPOSEMATRIXDARBPROC)glewGetProcAddress((const GLubyte*)"glMultTransposeMatrixdARB")) == NULL) || r; r = ((glMultTransposeMatrixfARB = (PFNGLMULTTRANSPOSEMATRIXFARBPROC)glewGetProcAddress((const GLubyte*)"glMultTransposeMatrixfARB")) == NULL) || r; return r; } #endif /* GL_ARB_transpose_matrix */ #ifdef GL_ARB_uniform_buffer_object static GLboolean _glewInit_GL_ARB_uniform_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)glewGetProcAddress((const GLubyte*)"glBindBufferBase")) == NULL) || r; r = ((glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glBindBufferRange")) == NULL) || r; r = ((glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)glewGetProcAddress((const GLubyte*)"glGetActiveUniformBlockName")) == NULL) || r; r = ((glGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC)glewGetProcAddress((const GLubyte*)"glGetActiveUniformBlockiv")) == NULL) || r; r = ((glGetActiveUniformName = (PFNGLGETACTIVEUNIFORMNAMEPROC)glewGetProcAddress((const GLubyte*)"glGetActiveUniformName")) == NULL) || r; r = ((glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC)glewGetProcAddress((const GLubyte*)"glGetActiveUniformsiv")) == NULL) || r; r = ((glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)glewGetProcAddress((const GLubyte*)"glGetIntegeri_v")) == NULL) || r; r = ((glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC)glewGetProcAddress((const GLubyte*)"glGetUniformBlockIndex")) == NULL) || r; r = ((glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC)glewGetProcAddress((const GLubyte*)"glGetUniformIndices")) == NULL) || r; r = ((glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC)glewGetProcAddress((const GLubyte*)"glUniformBlockBinding")) == NULL) || r; return r; } #endif /* GL_ARB_uniform_buffer_object */ #ifdef GL_ARB_vertex_array_bgra #endif /* GL_ARB_vertex_array_bgra */ #ifdef GL_ARB_vertex_array_object static GLboolean _glewInit_GL_ARB_vertex_array_object (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC)glewGetProcAddress((const GLubyte*)"glBindVertexArray")) == NULL) || r; r = ((glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC)glewGetProcAddress((const GLubyte*)"glDeleteVertexArrays")) == NULL) || r; r = ((glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)glewGetProcAddress((const GLubyte*)"glGenVertexArrays")) == NULL) || r; r = ((glIsVertexArray = (PFNGLISVERTEXARRAYPROC)glewGetProcAddress((const GLubyte*)"glIsVertexArray")) == NULL) || r; return r; } #endif /* GL_ARB_vertex_array_object */ #ifdef GL_ARB_vertex_attrib_64bit static GLboolean _glewInit_GL_ARB_vertex_attrib_64bit (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetVertexAttribLdv = (PFNGLGETVERTEXATTRIBLDVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribLdv")) == NULL) || r; r = ((glVertexAttribL1d = (PFNGLVERTEXATTRIBL1DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1d")) == NULL) || r; r = ((glVertexAttribL1dv = (PFNGLVERTEXATTRIBL1DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1dv")) == NULL) || r; r = ((glVertexAttribL2d = (PFNGLVERTEXATTRIBL2DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2d")) == NULL) || r; r = ((glVertexAttribL2dv = (PFNGLVERTEXATTRIBL2DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2dv")) == NULL) || r; r = ((glVertexAttribL3d = (PFNGLVERTEXATTRIBL3DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3d")) == NULL) || r; r = ((glVertexAttribL3dv = (PFNGLVERTEXATTRIBL3DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3dv")) == NULL) || r; r = ((glVertexAttribL4d = (PFNGLVERTEXATTRIBL4DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4d")) == NULL) || r; r = ((glVertexAttribL4dv = (PFNGLVERTEXATTRIBL4DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4dv")) == NULL) || r; r = ((glVertexAttribLPointer = (PFNGLVERTEXATTRIBLPOINTERPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribLPointer")) == NULL) || r; return r; } #endif /* GL_ARB_vertex_attrib_64bit */ #ifdef GL_ARB_vertex_attrib_binding static GLboolean _glewInit_GL_ARB_vertex_attrib_binding (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBindVertexBuffer = (PFNGLBINDVERTEXBUFFERPROC)glewGetProcAddress((const GLubyte*)"glBindVertexBuffer")) == NULL) || r; r = ((glVertexAttribBinding = (PFNGLVERTEXATTRIBBINDINGPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribBinding")) == NULL) || r; r = ((glVertexAttribFormat = (PFNGLVERTEXATTRIBFORMATPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribFormat")) == NULL) || r; r = ((glVertexAttribIFormat = (PFNGLVERTEXATTRIBIFORMATPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribIFormat")) == NULL) || r; r = ((glVertexAttribLFormat = (PFNGLVERTEXATTRIBLFORMATPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribLFormat")) == NULL) || r; r = ((glVertexBindingDivisor = (PFNGLVERTEXBINDINGDIVISORPROC)glewGetProcAddress((const GLubyte*)"glVertexBindingDivisor")) == NULL) || r; return r; } #endif /* GL_ARB_vertex_attrib_binding */ #ifdef GL_ARB_vertex_blend static GLboolean _glewInit_GL_ARB_vertex_blend (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glVertexBlendARB = (PFNGLVERTEXBLENDARBPROC)glewGetProcAddress((const GLubyte*)"glVertexBlendARB")) == NULL) || r; r = ((glWeightPointerARB = (PFNGLWEIGHTPOINTERARBPROC)glewGetProcAddress((const GLubyte*)"glWeightPointerARB")) == NULL) || r; r = ((glWeightbvARB = (PFNGLWEIGHTBVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightbvARB")) == NULL) || r; r = ((glWeightdvARB = (PFNGLWEIGHTDVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightdvARB")) == NULL) || r; r = ((glWeightfvARB = (PFNGLWEIGHTFVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightfvARB")) == NULL) || r; r = ((glWeightivARB = (PFNGLWEIGHTIVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightivARB")) == NULL) || r; r = ((glWeightsvARB = (PFNGLWEIGHTSVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightsvARB")) == NULL) || r; r = ((glWeightubvARB = (PFNGLWEIGHTUBVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightubvARB")) == NULL) || r; r = ((glWeightuivARB = (PFNGLWEIGHTUIVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightuivARB")) == NULL) || r; r = ((glWeightusvARB = (PFNGLWEIGHTUSVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightusvARB")) == NULL) || r; return r; } #endif /* GL_ARB_vertex_blend */ #ifdef GL_ARB_vertex_buffer_object static GLboolean _glewInit_GL_ARB_vertex_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBindBufferARB = (PFNGLBINDBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"glBindBufferARB")) == NULL) || r; r = ((glBufferDataARB = (PFNGLBUFFERDATAARBPROC)glewGetProcAddress((const GLubyte*)"glBufferDataARB")) == NULL) || r; r = ((glBufferSubDataARB = (PFNGLBUFFERSUBDATAARBPROC)glewGetProcAddress((const GLubyte*)"glBufferSubDataARB")) == NULL) || r; r = ((glDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC)glewGetProcAddress((const GLubyte*)"glDeleteBuffersARB")) == NULL) || r; r = ((glGenBuffersARB = (PFNGLGENBUFFERSARBPROC)glewGetProcAddress((const GLubyte*)"glGenBuffersARB")) == NULL) || r; r = ((glGetBufferParameterivARB = (PFNGLGETBUFFERPARAMETERIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetBufferParameterivARB")) == NULL) || r; r = ((glGetBufferPointervARB = (PFNGLGETBUFFERPOINTERVARBPROC)glewGetProcAddress((const GLubyte*)"glGetBufferPointervARB")) == NULL) || r; r = ((glGetBufferSubDataARB = (PFNGLGETBUFFERSUBDATAARBPROC)glewGetProcAddress((const GLubyte*)"glGetBufferSubDataARB")) == NULL) || r; r = ((glIsBufferARB = (PFNGLISBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"glIsBufferARB")) == NULL) || r; r = ((glMapBufferARB = (PFNGLMAPBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"glMapBufferARB")) == NULL) || r; r = ((glUnmapBufferARB = (PFNGLUNMAPBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"glUnmapBufferARB")) == NULL) || r; return r; } #endif /* GL_ARB_vertex_buffer_object */ #ifdef GL_ARB_vertex_program static GLboolean _glewInit_GL_ARB_vertex_program (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBindProgramARB = (PFNGLBINDPROGRAMARBPROC)glewGetProcAddress((const GLubyte*)"glBindProgramARB")) == NULL) || r; r = ((glDeleteProgramsARB = (PFNGLDELETEPROGRAMSARBPROC)glewGetProcAddress((const GLubyte*)"glDeleteProgramsARB")) == NULL) || r; r = ((glDisableVertexAttribArrayARB = (PFNGLDISABLEVERTEXATTRIBARRAYARBPROC)glewGetProcAddress((const GLubyte*)"glDisableVertexAttribArrayARB")) == NULL) || r; r = ((glEnableVertexAttribArrayARB = (PFNGLENABLEVERTEXATTRIBARRAYARBPROC)glewGetProcAddress((const GLubyte*)"glEnableVertexAttribArrayARB")) == NULL) || r; r = ((glGenProgramsARB = (PFNGLGENPROGRAMSARBPROC)glewGetProcAddress((const GLubyte*)"glGenProgramsARB")) == NULL) || r; r = ((glGetProgramEnvParameterdvARB = (PFNGLGETPROGRAMENVPARAMETERDVARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramEnvParameterdvARB")) == NULL) || r; r = ((glGetProgramEnvParameterfvARB = (PFNGLGETPROGRAMENVPARAMETERFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramEnvParameterfvARB")) == NULL) || r; r = ((glGetProgramLocalParameterdvARB = (PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramLocalParameterdvARB")) == NULL) || r; r = ((glGetProgramLocalParameterfvARB = (PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramLocalParameterfvARB")) == NULL) || r; r = ((glGetProgramStringARB = (PFNGLGETPROGRAMSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramStringARB")) == NULL) || r; r = ((glGetProgramivARB = (PFNGLGETPROGRAMIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramivARB")) == NULL) || r; r = ((glGetVertexAttribPointervARB = (PFNGLGETVERTEXATTRIBPOINTERVARBPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribPointervARB")) == NULL) || r; r = ((glGetVertexAttribdvARB = (PFNGLGETVERTEXATTRIBDVARBPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribdvARB")) == NULL) || r; r = ((glGetVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribfvARB")) == NULL) || r; r = ((glGetVertexAttribivARB = (PFNGLGETVERTEXATTRIBIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribivARB")) == NULL) || r; r = ((glIsProgramARB = (PFNGLISPROGRAMARBPROC)glewGetProcAddress((const GLubyte*)"glIsProgramARB")) == NULL) || r; r = ((glProgramEnvParameter4dARB = (PFNGLPROGRAMENVPARAMETER4DARBPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameter4dARB")) == NULL) || r; r = ((glProgramEnvParameter4dvARB = (PFNGLPROGRAMENVPARAMETER4DVARBPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameter4dvARB")) == NULL) || r; r = ((glProgramEnvParameter4fARB = (PFNGLPROGRAMENVPARAMETER4FARBPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameter4fARB")) == NULL) || r; r = ((glProgramEnvParameter4fvARB = (PFNGLPROGRAMENVPARAMETER4FVARBPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameter4fvARB")) == NULL) || r; r = ((glProgramLocalParameter4dARB = (PFNGLPROGRAMLOCALPARAMETER4DARBPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameter4dARB")) == NULL) || r; r = ((glProgramLocalParameter4dvARB = (PFNGLPROGRAMLOCALPARAMETER4DVARBPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameter4dvARB")) == NULL) || r; r = ((glProgramLocalParameter4fARB = (PFNGLPROGRAMLOCALPARAMETER4FARBPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameter4fARB")) == NULL) || r; r = ((glProgramLocalParameter4fvARB = (PFNGLPROGRAMLOCALPARAMETER4FVARBPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameter4fvARB")) == NULL) || r; r = ((glProgramStringARB = (PFNGLPROGRAMSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"glProgramStringARB")) == NULL) || r; r = ((glVertexAttrib1dARB = (PFNGLVERTEXATTRIB1DARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1dARB")) == NULL) || r; r = ((glVertexAttrib1dvARB = (PFNGLVERTEXATTRIB1DVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1dvARB")) == NULL) || r; r = ((glVertexAttrib1fARB = (PFNGLVERTEXATTRIB1FARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1fARB")) == NULL) || r; r = ((glVertexAttrib1fvARB = (PFNGLVERTEXATTRIB1FVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1fvARB")) == NULL) || r; r = ((glVertexAttrib1sARB = (PFNGLVERTEXATTRIB1SARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1sARB")) == NULL) || r; r = ((glVertexAttrib1svARB = (PFNGLVERTEXATTRIB1SVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1svARB")) == NULL) || r; r = ((glVertexAttrib2dARB = (PFNGLVERTEXATTRIB2DARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2dARB")) == NULL) || r; r = ((glVertexAttrib2dvARB = (PFNGLVERTEXATTRIB2DVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2dvARB")) == NULL) || r; r = ((glVertexAttrib2fARB = (PFNGLVERTEXATTRIB2FARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2fARB")) == NULL) || r; r = ((glVertexAttrib2fvARB = (PFNGLVERTEXATTRIB2FVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2fvARB")) == NULL) || r; r = ((glVertexAttrib2sARB = (PFNGLVERTEXATTRIB2SARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2sARB")) == NULL) || r; r = ((glVertexAttrib2svARB = (PFNGLVERTEXATTRIB2SVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2svARB")) == NULL) || r; r = ((glVertexAttrib3dARB = (PFNGLVERTEXATTRIB3DARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3dARB")) == NULL) || r; r = ((glVertexAttrib3dvARB = (PFNGLVERTEXATTRIB3DVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3dvARB")) == NULL) || r; r = ((glVertexAttrib3fARB = (PFNGLVERTEXATTRIB3FARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3fARB")) == NULL) || r; r = ((glVertexAttrib3fvARB = (PFNGLVERTEXATTRIB3FVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3fvARB")) == NULL) || r; r = ((glVertexAttrib3sARB = (PFNGLVERTEXATTRIB3SARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3sARB")) == NULL) || r; r = ((glVertexAttrib3svARB = (PFNGLVERTEXATTRIB3SVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3svARB")) == NULL) || r; r = ((glVertexAttrib4NbvARB = (PFNGLVERTEXATTRIB4NBVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NbvARB")) == NULL) || r; r = ((glVertexAttrib4NivARB = (PFNGLVERTEXATTRIB4NIVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NivARB")) == NULL) || r; r = ((glVertexAttrib4NsvARB = (PFNGLVERTEXATTRIB4NSVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NsvARB")) == NULL) || r; r = ((glVertexAttrib4NubARB = (PFNGLVERTEXATTRIB4NUBARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NubARB")) == NULL) || r; r = ((glVertexAttrib4NubvARB = (PFNGLVERTEXATTRIB4NUBVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NubvARB")) == NULL) || r; r = ((glVertexAttrib4NuivARB = (PFNGLVERTEXATTRIB4NUIVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NuivARB")) == NULL) || r; r = ((glVertexAttrib4NusvARB = (PFNGLVERTEXATTRIB4NUSVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NusvARB")) == NULL) || r; r = ((glVertexAttrib4bvARB = (PFNGLVERTEXATTRIB4BVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4bvARB")) == NULL) || r; r = ((glVertexAttrib4dARB = (PFNGLVERTEXATTRIB4DARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4dARB")) == NULL) || r; r = ((glVertexAttrib4dvARB = (PFNGLVERTEXATTRIB4DVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4dvARB")) == NULL) || r; r = ((glVertexAttrib4fARB = (PFNGLVERTEXATTRIB4FARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4fARB")) == NULL) || r; r = ((glVertexAttrib4fvARB = (PFNGLVERTEXATTRIB4FVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4fvARB")) == NULL) || r; r = ((glVertexAttrib4ivARB = (PFNGLVERTEXATTRIB4IVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4ivARB")) == NULL) || r; r = ((glVertexAttrib4sARB = (PFNGLVERTEXATTRIB4SARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4sARB")) == NULL) || r; r = ((glVertexAttrib4svARB = (PFNGLVERTEXATTRIB4SVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4svARB")) == NULL) || r; r = ((glVertexAttrib4ubvARB = (PFNGLVERTEXATTRIB4UBVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4ubvARB")) == NULL) || r; r = ((glVertexAttrib4uivARB = (PFNGLVERTEXATTRIB4UIVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4uivARB")) == NULL) || r; r = ((glVertexAttrib4usvARB = (PFNGLVERTEXATTRIB4USVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4usvARB")) == NULL) || r; r = ((glVertexAttribPointerARB = (PFNGLVERTEXATTRIBPOINTERARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribPointerARB")) == NULL) || r; return r; } #endif /* GL_ARB_vertex_program */ #ifdef GL_ARB_vertex_shader static GLboolean _glewInit_GL_ARB_vertex_shader (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC)glewGetProcAddress((const GLubyte*)"glBindAttribLocationARB")) == NULL) || r; r = ((glGetActiveAttribARB = (PFNGLGETACTIVEATTRIBARBPROC)glewGetProcAddress((const GLubyte*)"glGetActiveAttribARB")) == NULL) || r; r = ((glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC)glewGetProcAddress((const GLubyte*)"glGetAttribLocationARB")) == NULL) || r; return r; } #endif /* GL_ARB_vertex_shader */ #ifdef GL_ARB_vertex_type_2_10_10_10_rev static GLboolean _glewInit_GL_ARB_vertex_type_2_10_10_10_rev (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glColorP3ui = (PFNGLCOLORP3UIPROC)glewGetProcAddress((const GLubyte*)"glColorP3ui")) == NULL) || r; r = ((glColorP3uiv = (PFNGLCOLORP3UIVPROC)glewGetProcAddress((const GLubyte*)"glColorP3uiv")) == NULL) || r; r = ((glColorP4ui = (PFNGLCOLORP4UIPROC)glewGetProcAddress((const GLubyte*)"glColorP4ui")) == NULL) || r; r = ((glColorP4uiv = (PFNGLCOLORP4UIVPROC)glewGetProcAddress((const GLubyte*)"glColorP4uiv")) == NULL) || r; r = ((glMultiTexCoordP1ui = (PFNGLMULTITEXCOORDP1UIPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP1ui")) == NULL) || r; r = ((glMultiTexCoordP1uiv = (PFNGLMULTITEXCOORDP1UIVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP1uiv")) == NULL) || r; r = ((glMultiTexCoordP2ui = (PFNGLMULTITEXCOORDP2UIPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP2ui")) == NULL) || r; r = ((glMultiTexCoordP2uiv = (PFNGLMULTITEXCOORDP2UIVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP2uiv")) == NULL) || r; r = ((glMultiTexCoordP3ui = (PFNGLMULTITEXCOORDP3UIPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP3ui")) == NULL) || r; r = ((glMultiTexCoordP3uiv = (PFNGLMULTITEXCOORDP3UIVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP3uiv")) == NULL) || r; r = ((glMultiTexCoordP4ui = (PFNGLMULTITEXCOORDP4UIPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP4ui")) == NULL) || r; r = ((glMultiTexCoordP4uiv = (PFNGLMULTITEXCOORDP4UIVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP4uiv")) == NULL) || r; r = ((glNormalP3ui = (PFNGLNORMALP3UIPROC)glewGetProcAddress((const GLubyte*)"glNormalP3ui")) == NULL) || r; r = ((glNormalP3uiv = (PFNGLNORMALP3UIVPROC)glewGetProcAddress((const GLubyte*)"glNormalP3uiv")) == NULL) || r; r = ((glSecondaryColorP3ui = (PFNGLSECONDARYCOLORP3UIPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColorP3ui")) == NULL) || r; r = ((glSecondaryColorP3uiv = (PFNGLSECONDARYCOLORP3UIVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColorP3uiv")) == NULL) || r; r = ((glTexCoordP1ui = (PFNGLTEXCOORDP1UIPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP1ui")) == NULL) || r; r = ((glTexCoordP1uiv = (PFNGLTEXCOORDP1UIVPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP1uiv")) == NULL) || r; r = ((glTexCoordP2ui = (PFNGLTEXCOORDP2UIPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP2ui")) == NULL) || r; r = ((glTexCoordP2uiv = (PFNGLTEXCOORDP2UIVPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP2uiv")) == NULL) || r; r = ((glTexCoordP3ui = (PFNGLTEXCOORDP3UIPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP3ui")) == NULL) || r; r = ((glTexCoordP3uiv = (PFNGLTEXCOORDP3UIVPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP3uiv")) == NULL) || r; r = ((glTexCoordP4ui = (PFNGLTEXCOORDP4UIPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP4ui")) == NULL) || r; r = ((glTexCoordP4uiv = (PFNGLTEXCOORDP4UIVPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP4uiv")) == NULL) || r; r = ((glVertexAttribP1ui = (PFNGLVERTEXATTRIBP1UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP1ui")) == NULL) || r; r = ((glVertexAttribP1uiv = (PFNGLVERTEXATTRIBP1UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP1uiv")) == NULL) || r; r = ((glVertexAttribP2ui = (PFNGLVERTEXATTRIBP2UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP2ui")) == NULL) || r; r = ((glVertexAttribP2uiv = (PFNGLVERTEXATTRIBP2UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP2uiv")) == NULL) || r; r = ((glVertexAttribP3ui = (PFNGLVERTEXATTRIBP3UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP3ui")) == NULL) || r; r = ((glVertexAttribP3uiv = (PFNGLVERTEXATTRIBP3UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP3uiv")) == NULL) || r; r = ((glVertexAttribP4ui = (PFNGLVERTEXATTRIBP4UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP4ui")) == NULL) || r; r = ((glVertexAttribP4uiv = (PFNGLVERTEXATTRIBP4UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP4uiv")) == NULL) || r; r = ((glVertexP2ui = (PFNGLVERTEXP2UIPROC)glewGetProcAddress((const GLubyte*)"glVertexP2ui")) == NULL) || r; r = ((glVertexP2uiv = (PFNGLVERTEXP2UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexP2uiv")) == NULL) || r; r = ((glVertexP3ui = (PFNGLVERTEXP3UIPROC)glewGetProcAddress((const GLubyte*)"glVertexP3ui")) == NULL) || r; r = ((glVertexP3uiv = (PFNGLVERTEXP3UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexP3uiv")) == NULL) || r; r = ((glVertexP4ui = (PFNGLVERTEXP4UIPROC)glewGetProcAddress((const GLubyte*)"glVertexP4ui")) == NULL) || r; r = ((glVertexP4uiv = (PFNGLVERTEXP4UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexP4uiv")) == NULL) || r; return r; } #endif /* GL_ARB_vertex_type_2_10_10_10_rev */ #ifdef GL_ARB_viewport_array static GLboolean _glewInit_GL_ARB_viewport_array (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDepthRangeArrayv = (PFNGLDEPTHRANGEARRAYVPROC)glewGetProcAddress((const GLubyte*)"glDepthRangeArrayv")) == NULL) || r; r = ((glDepthRangeIndexed = (PFNGLDEPTHRANGEINDEXEDPROC)glewGetProcAddress((const GLubyte*)"glDepthRangeIndexed")) == NULL) || r; r = ((glGetDoublei_v = (PFNGLGETDOUBLEI_VPROC)glewGetProcAddress((const GLubyte*)"glGetDoublei_v")) == NULL) || r; r = ((glGetFloati_v = (PFNGLGETFLOATI_VPROC)glewGetProcAddress((const GLubyte*)"glGetFloati_v")) == NULL) || r; r = ((glScissorArrayv = (PFNGLSCISSORARRAYVPROC)glewGetProcAddress((const GLubyte*)"glScissorArrayv")) == NULL) || r; r = ((glScissorIndexed = (PFNGLSCISSORINDEXEDPROC)glewGetProcAddress((const GLubyte*)"glScissorIndexed")) == NULL) || r; r = ((glScissorIndexedv = (PFNGLSCISSORINDEXEDVPROC)glewGetProcAddress((const GLubyte*)"glScissorIndexedv")) == NULL) || r; r = ((glViewportArrayv = (PFNGLVIEWPORTARRAYVPROC)glewGetProcAddress((const GLubyte*)"glViewportArrayv")) == NULL) || r; r = ((glViewportIndexedf = (PFNGLVIEWPORTINDEXEDFPROC)glewGetProcAddress((const GLubyte*)"glViewportIndexedf")) == NULL) || r; r = ((glViewportIndexedfv = (PFNGLVIEWPORTINDEXEDFVPROC)glewGetProcAddress((const GLubyte*)"glViewportIndexedfv")) == NULL) || r; return r; } #endif /* GL_ARB_viewport_array */ #ifdef GL_ARB_window_pos static GLboolean _glewInit_GL_ARB_window_pos (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glWindowPos2dARB = (PFNGLWINDOWPOS2DARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2dARB")) == NULL) || r; r = ((glWindowPos2dvARB = (PFNGLWINDOWPOS2DVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2dvARB")) == NULL) || r; r = ((glWindowPos2fARB = (PFNGLWINDOWPOS2FARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2fARB")) == NULL) || r; r = ((glWindowPos2fvARB = (PFNGLWINDOWPOS2FVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2fvARB")) == NULL) || r; r = ((glWindowPos2iARB = (PFNGLWINDOWPOS2IARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2iARB")) == NULL) || r; r = ((glWindowPos2ivARB = (PFNGLWINDOWPOS2IVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2ivARB")) == NULL) || r; r = ((glWindowPos2sARB = (PFNGLWINDOWPOS2SARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2sARB")) == NULL) || r; r = ((glWindowPos2svARB = (PFNGLWINDOWPOS2SVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2svARB")) == NULL) || r; r = ((glWindowPos3dARB = (PFNGLWINDOWPOS3DARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3dARB")) == NULL) || r; r = ((glWindowPos3dvARB = (PFNGLWINDOWPOS3DVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3dvARB")) == NULL) || r; r = ((glWindowPos3fARB = (PFNGLWINDOWPOS3FARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3fARB")) == NULL) || r; r = ((glWindowPos3fvARB = (PFNGLWINDOWPOS3FVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3fvARB")) == NULL) || r; r = ((glWindowPos3iARB = (PFNGLWINDOWPOS3IARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3iARB")) == NULL) || r; r = ((glWindowPos3ivARB = (PFNGLWINDOWPOS3IVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3ivARB")) == NULL) || r; r = ((glWindowPos3sARB = (PFNGLWINDOWPOS3SARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3sARB")) == NULL) || r; r = ((glWindowPos3svARB = (PFNGLWINDOWPOS3SVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3svARB")) == NULL) || r; return r; } #endif /* GL_ARB_window_pos */ #ifdef GL_ATIX_point_sprites #endif /* GL_ATIX_point_sprites */ #ifdef GL_ATIX_texture_env_combine3 #endif /* GL_ATIX_texture_env_combine3 */ #ifdef GL_ATIX_texture_env_route #endif /* GL_ATIX_texture_env_route */ #ifdef GL_ATIX_vertex_shader_output_point_size #endif /* GL_ATIX_vertex_shader_output_point_size */ #ifdef GL_ATI_draw_buffers static GLboolean _glewInit_GL_ATI_draw_buffers (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDrawBuffersATI = (PFNGLDRAWBUFFERSATIPROC)glewGetProcAddress((const GLubyte*)"glDrawBuffersATI")) == NULL) || r; return r; } #endif /* GL_ATI_draw_buffers */ #ifdef GL_ATI_element_array static GLboolean _glewInit_GL_ATI_element_array (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDrawElementArrayATI = (PFNGLDRAWELEMENTARRAYATIPROC)glewGetProcAddress((const GLubyte*)"glDrawElementArrayATI")) == NULL) || r; r = ((glDrawRangeElementArrayATI = (PFNGLDRAWRANGEELEMENTARRAYATIPROC)glewGetProcAddress((const GLubyte*)"glDrawRangeElementArrayATI")) == NULL) || r; r = ((glElementPointerATI = (PFNGLELEMENTPOINTERATIPROC)glewGetProcAddress((const GLubyte*)"glElementPointerATI")) == NULL) || r; return r; } #endif /* GL_ATI_element_array */ #ifdef GL_ATI_envmap_bumpmap static GLboolean _glewInit_GL_ATI_envmap_bumpmap (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetTexBumpParameterfvATI = (PFNGLGETTEXBUMPPARAMETERFVATIPROC)glewGetProcAddress((const GLubyte*)"glGetTexBumpParameterfvATI")) == NULL) || r; r = ((glGetTexBumpParameterivATI = (PFNGLGETTEXBUMPPARAMETERIVATIPROC)glewGetProcAddress((const GLubyte*)"glGetTexBumpParameterivATI")) == NULL) || r; r = ((glTexBumpParameterfvATI = (PFNGLTEXBUMPPARAMETERFVATIPROC)glewGetProcAddress((const GLubyte*)"glTexBumpParameterfvATI")) == NULL) || r; r = ((glTexBumpParameterivATI = (PFNGLTEXBUMPPARAMETERIVATIPROC)glewGetProcAddress((const GLubyte*)"glTexBumpParameterivATI")) == NULL) || r; return r; } #endif /* GL_ATI_envmap_bumpmap */ #ifdef GL_ATI_fragment_shader static GLboolean _glewInit_GL_ATI_fragment_shader (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glAlphaFragmentOp1ATI = (PFNGLALPHAFRAGMENTOP1ATIPROC)glewGetProcAddress((const GLubyte*)"glAlphaFragmentOp1ATI")) == NULL) || r; r = ((glAlphaFragmentOp2ATI = (PFNGLALPHAFRAGMENTOP2ATIPROC)glewGetProcAddress((const GLubyte*)"glAlphaFragmentOp2ATI")) == NULL) || r; r = ((glAlphaFragmentOp3ATI = (PFNGLALPHAFRAGMENTOP3ATIPROC)glewGetProcAddress((const GLubyte*)"glAlphaFragmentOp3ATI")) == NULL) || r; r = ((glBeginFragmentShaderATI = (PFNGLBEGINFRAGMENTSHADERATIPROC)glewGetProcAddress((const GLubyte*)"glBeginFragmentShaderATI")) == NULL) || r; r = ((glBindFragmentShaderATI = (PFNGLBINDFRAGMENTSHADERATIPROC)glewGetProcAddress((const GLubyte*)"glBindFragmentShaderATI")) == NULL) || r; r = ((glColorFragmentOp1ATI = (PFNGLCOLORFRAGMENTOP1ATIPROC)glewGetProcAddress((const GLubyte*)"glColorFragmentOp1ATI")) == NULL) || r; r = ((glColorFragmentOp2ATI = (PFNGLCOLORFRAGMENTOP2ATIPROC)glewGetProcAddress((const GLubyte*)"glColorFragmentOp2ATI")) == NULL) || r; r = ((glColorFragmentOp3ATI = (PFNGLCOLORFRAGMENTOP3ATIPROC)glewGetProcAddress((const GLubyte*)"glColorFragmentOp3ATI")) == NULL) || r; r = ((glDeleteFragmentShaderATI = (PFNGLDELETEFRAGMENTSHADERATIPROC)glewGetProcAddress((const GLubyte*)"glDeleteFragmentShaderATI")) == NULL) || r; r = ((glEndFragmentShaderATI = (PFNGLENDFRAGMENTSHADERATIPROC)glewGetProcAddress((const GLubyte*)"glEndFragmentShaderATI")) == NULL) || r; r = ((glGenFragmentShadersATI = (PFNGLGENFRAGMENTSHADERSATIPROC)glewGetProcAddress((const GLubyte*)"glGenFragmentShadersATI")) == NULL) || r; r = ((glPassTexCoordATI = (PFNGLPASSTEXCOORDATIPROC)glewGetProcAddress((const GLubyte*)"glPassTexCoordATI")) == NULL) || r; r = ((glSampleMapATI = (PFNGLSAMPLEMAPATIPROC)glewGetProcAddress((const GLubyte*)"glSampleMapATI")) == NULL) || r; r = ((glSetFragmentShaderConstantATI = (PFNGLSETFRAGMENTSHADERCONSTANTATIPROC)glewGetProcAddress((const GLubyte*)"glSetFragmentShaderConstantATI")) == NULL) || r; return r; } #endif /* GL_ATI_fragment_shader */ #ifdef GL_ATI_map_object_buffer static GLboolean _glewInit_GL_ATI_map_object_buffer (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glMapObjectBufferATI = (PFNGLMAPOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glMapObjectBufferATI")) == NULL) || r; r = ((glUnmapObjectBufferATI = (PFNGLUNMAPOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glUnmapObjectBufferATI")) == NULL) || r; return r; } #endif /* GL_ATI_map_object_buffer */ #ifdef GL_ATI_meminfo #endif /* GL_ATI_meminfo */ #ifdef GL_ATI_pn_triangles static GLboolean _glewInit_GL_ATI_pn_triangles (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glPNTrianglesfATI = (PFNGLPNTRIANGLESFATIPROC)glewGetProcAddress((const GLubyte*)"glPNTrianglesfATI")) == NULL) || r; r = ((glPNTrianglesiATI = (PFNGLPNTRIANGLESIATIPROC)glewGetProcAddress((const GLubyte*)"glPNTrianglesiATI")) == NULL) || r; return r; } #endif /* GL_ATI_pn_triangles */ #ifdef GL_ATI_separate_stencil static GLboolean _glewInit_GL_ATI_separate_stencil (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glStencilFuncSeparateATI = (PFNGLSTENCILFUNCSEPARATEATIPROC)glewGetProcAddress((const GLubyte*)"glStencilFuncSeparateATI")) == NULL) || r; r = ((glStencilOpSeparateATI = (PFNGLSTENCILOPSEPARATEATIPROC)glewGetProcAddress((const GLubyte*)"glStencilOpSeparateATI")) == NULL) || r; return r; } #endif /* GL_ATI_separate_stencil */ #ifdef GL_ATI_shader_texture_lod #endif /* GL_ATI_shader_texture_lod */ #ifdef GL_ATI_text_fragment_shader #endif /* GL_ATI_text_fragment_shader */ #ifdef GL_ATI_texture_compression_3dc #endif /* GL_ATI_texture_compression_3dc */ #ifdef GL_ATI_texture_env_combine3 #endif /* GL_ATI_texture_env_combine3 */ #ifdef GL_ATI_texture_float #endif /* GL_ATI_texture_float */ #ifdef GL_ATI_texture_mirror_once #endif /* GL_ATI_texture_mirror_once */ #ifdef GL_ATI_vertex_array_object static GLboolean _glewInit_GL_ATI_vertex_array_object (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glArrayObjectATI = (PFNGLARRAYOBJECTATIPROC)glewGetProcAddress((const GLubyte*)"glArrayObjectATI")) == NULL) || r; r = ((glFreeObjectBufferATI = (PFNGLFREEOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glFreeObjectBufferATI")) == NULL) || r; r = ((glGetArrayObjectfvATI = (PFNGLGETARRAYOBJECTFVATIPROC)glewGetProcAddress((const GLubyte*)"glGetArrayObjectfvATI")) == NULL) || r; r = ((glGetArrayObjectivATI = (PFNGLGETARRAYOBJECTIVATIPROC)glewGetProcAddress((const GLubyte*)"glGetArrayObjectivATI")) == NULL) || r; r = ((glGetObjectBufferfvATI = (PFNGLGETOBJECTBUFFERFVATIPROC)glewGetProcAddress((const GLubyte*)"glGetObjectBufferfvATI")) == NULL) || r; r = ((glGetObjectBufferivATI = (PFNGLGETOBJECTBUFFERIVATIPROC)glewGetProcAddress((const GLubyte*)"glGetObjectBufferivATI")) == NULL) || r; r = ((glGetVariantArrayObjectfvATI = (PFNGLGETVARIANTARRAYOBJECTFVATIPROC)glewGetProcAddress((const GLubyte*)"glGetVariantArrayObjectfvATI")) == NULL) || r; r = ((glGetVariantArrayObjectivATI = (PFNGLGETVARIANTARRAYOBJECTIVATIPROC)glewGetProcAddress((const GLubyte*)"glGetVariantArrayObjectivATI")) == NULL) || r; r = ((glIsObjectBufferATI = (PFNGLISOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glIsObjectBufferATI")) == NULL) || r; r = ((glNewObjectBufferATI = (PFNGLNEWOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glNewObjectBufferATI")) == NULL) || r; r = ((glUpdateObjectBufferATI = (PFNGLUPDATEOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glUpdateObjectBufferATI")) == NULL) || r; r = ((glVariantArrayObjectATI = (PFNGLVARIANTARRAYOBJECTATIPROC)glewGetProcAddress((const GLubyte*)"glVariantArrayObjectATI")) == NULL) || r; return r; } #endif /* GL_ATI_vertex_array_object */ #ifdef GL_ATI_vertex_attrib_array_object static GLboolean _glewInit_GL_ATI_vertex_attrib_array_object (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetVertexAttribArrayObjectfvATI = (PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribArrayObjectfvATI")) == NULL) || r; r = ((glGetVertexAttribArrayObjectivATI = (PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribArrayObjectivATI")) == NULL) || r; r = ((glVertexAttribArrayObjectATI = (PFNGLVERTEXATTRIBARRAYOBJECTATIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribArrayObjectATI")) == NULL) || r; return r; } #endif /* GL_ATI_vertex_attrib_array_object */ #ifdef GL_ATI_vertex_streams static GLboolean _glewInit_GL_ATI_vertex_streams (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glClientActiveVertexStreamATI = (PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC)glewGetProcAddress((const GLubyte*)"glClientActiveVertexStreamATI")) == NULL) || r; r = ((glNormalStream3bATI = (PFNGLNORMALSTREAM3BATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3bATI")) == NULL) || r; r = ((glNormalStream3bvATI = (PFNGLNORMALSTREAM3BVATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3bvATI")) == NULL) || r; r = ((glNormalStream3dATI = (PFNGLNORMALSTREAM3DATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3dATI")) == NULL) || r; r = ((glNormalStream3dvATI = (PFNGLNORMALSTREAM3DVATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3dvATI")) == NULL) || r; r = ((glNormalStream3fATI = (PFNGLNORMALSTREAM3FATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3fATI")) == NULL) || r; r = ((glNormalStream3fvATI = (PFNGLNORMALSTREAM3FVATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3fvATI")) == NULL) || r; r = ((glNormalStream3iATI = (PFNGLNORMALSTREAM3IATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3iATI")) == NULL) || r; r = ((glNormalStream3ivATI = (PFNGLNORMALSTREAM3IVATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3ivATI")) == NULL) || r; r = ((glNormalStream3sATI = (PFNGLNORMALSTREAM3SATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3sATI")) == NULL) || r; r = ((glNormalStream3svATI = (PFNGLNORMALSTREAM3SVATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3svATI")) == NULL) || r; r = ((glVertexBlendEnvfATI = (PFNGLVERTEXBLENDENVFATIPROC)glewGetProcAddress((const GLubyte*)"glVertexBlendEnvfATI")) == NULL) || r; r = ((glVertexBlendEnviATI = (PFNGLVERTEXBLENDENVIATIPROC)glewGetProcAddress((const GLubyte*)"glVertexBlendEnviATI")) == NULL) || r; r = ((glVertexStream1dATI = (PFNGLVERTEXSTREAM1DATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1dATI")) == NULL) || r; r = ((glVertexStream1dvATI = (PFNGLVERTEXSTREAM1DVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1dvATI")) == NULL) || r; r = ((glVertexStream1fATI = (PFNGLVERTEXSTREAM1FATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1fATI")) == NULL) || r; r = ((glVertexStream1fvATI = (PFNGLVERTEXSTREAM1FVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1fvATI")) == NULL) || r; r = ((glVertexStream1iATI = (PFNGLVERTEXSTREAM1IATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1iATI")) == NULL) || r; r = ((glVertexStream1ivATI = (PFNGLVERTEXSTREAM1IVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1ivATI")) == NULL) || r; r = ((glVertexStream1sATI = (PFNGLVERTEXSTREAM1SATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1sATI")) == NULL) || r; r = ((glVertexStream1svATI = (PFNGLVERTEXSTREAM1SVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1svATI")) == NULL) || r; r = ((glVertexStream2dATI = (PFNGLVERTEXSTREAM2DATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2dATI")) == NULL) || r; r = ((glVertexStream2dvATI = (PFNGLVERTEXSTREAM2DVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2dvATI")) == NULL) || r; r = ((glVertexStream2fATI = (PFNGLVERTEXSTREAM2FATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2fATI")) == NULL) || r; r = ((glVertexStream2fvATI = (PFNGLVERTEXSTREAM2FVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2fvATI")) == NULL) || r; r = ((glVertexStream2iATI = (PFNGLVERTEXSTREAM2IATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2iATI")) == NULL) || r; r = ((glVertexStream2ivATI = (PFNGLVERTEXSTREAM2IVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2ivATI")) == NULL) || r; r = ((glVertexStream2sATI = (PFNGLVERTEXSTREAM2SATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2sATI")) == NULL) || r; r = ((glVertexStream2svATI = (PFNGLVERTEXSTREAM2SVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2svATI")) == NULL) || r; r = ((glVertexStream3dATI = (PFNGLVERTEXSTREAM3DATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3dATI")) == NULL) || r; r = ((glVertexStream3dvATI = (PFNGLVERTEXSTREAM3DVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3dvATI")) == NULL) || r; r = ((glVertexStream3fATI = (PFNGLVERTEXSTREAM3FATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3fATI")) == NULL) || r; r = ((glVertexStream3fvATI = (PFNGLVERTEXSTREAM3FVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3fvATI")) == NULL) || r; r = ((glVertexStream3iATI = (PFNGLVERTEXSTREAM3IATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3iATI")) == NULL) || r; r = ((glVertexStream3ivATI = (PFNGLVERTEXSTREAM3IVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3ivATI")) == NULL) || r; r = ((glVertexStream3sATI = (PFNGLVERTEXSTREAM3SATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3sATI")) == NULL) || r; r = ((glVertexStream3svATI = (PFNGLVERTEXSTREAM3SVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3svATI")) == NULL) || r; r = ((glVertexStream4dATI = (PFNGLVERTEXSTREAM4DATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4dATI")) == NULL) || r; r = ((glVertexStream4dvATI = (PFNGLVERTEXSTREAM4DVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4dvATI")) == NULL) || r; r = ((glVertexStream4fATI = (PFNGLVERTEXSTREAM4FATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4fATI")) == NULL) || r; r = ((glVertexStream4fvATI = (PFNGLVERTEXSTREAM4FVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4fvATI")) == NULL) || r; r = ((glVertexStream4iATI = (PFNGLVERTEXSTREAM4IATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4iATI")) == NULL) || r; r = ((glVertexStream4ivATI = (PFNGLVERTEXSTREAM4IVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4ivATI")) == NULL) || r; r = ((glVertexStream4sATI = (PFNGLVERTEXSTREAM4SATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4sATI")) == NULL) || r; r = ((glVertexStream4svATI = (PFNGLVERTEXSTREAM4SVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4svATI")) == NULL) || r; return r; } #endif /* GL_ATI_vertex_streams */ #ifdef GL_EXT_422_pixels #endif /* GL_EXT_422_pixels */ #ifdef GL_EXT_Cg_shader #endif /* GL_EXT_Cg_shader */ #ifdef GL_EXT_abgr #endif /* GL_EXT_abgr */ #ifdef GL_EXT_bgra #endif /* GL_EXT_bgra */ #ifdef GL_EXT_bindable_uniform static GLboolean _glewInit_GL_EXT_bindable_uniform (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetUniformBufferSizeEXT = (PFNGLGETUNIFORMBUFFERSIZEEXTPROC)glewGetProcAddress((const GLubyte*)"glGetUniformBufferSizeEXT")) == NULL) || r; r = ((glGetUniformOffsetEXT = (PFNGLGETUNIFORMOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glGetUniformOffsetEXT")) == NULL) || r; r = ((glUniformBufferEXT = (PFNGLUNIFORMBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glUniformBufferEXT")) == NULL) || r; return r; } #endif /* GL_EXT_bindable_uniform */ #ifdef GL_EXT_blend_color static GLboolean _glewInit_GL_EXT_blend_color (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBlendColorEXT = (PFNGLBLENDCOLOREXTPROC)glewGetProcAddress((const GLubyte*)"glBlendColorEXT")) == NULL) || r; return r; } #endif /* GL_EXT_blend_color */ #ifdef GL_EXT_blend_equation_separate static GLboolean _glewInit_GL_EXT_blend_equation_separate (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBlendEquationSeparateEXT = (PFNGLBLENDEQUATIONSEPARATEEXTPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationSeparateEXT")) == NULL) || r; return r; } #endif /* GL_EXT_blend_equation_separate */ #ifdef GL_EXT_blend_func_separate static GLboolean _glewInit_GL_EXT_blend_func_separate (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBlendFuncSeparateEXT = (PFNGLBLENDFUNCSEPARATEEXTPROC)glewGetProcAddress((const GLubyte*)"glBlendFuncSeparateEXT")) == NULL) || r; return r; } #endif /* GL_EXT_blend_func_separate */ #ifdef GL_EXT_blend_logic_op #endif /* GL_EXT_blend_logic_op */ #ifdef GL_EXT_blend_minmax static GLboolean _glewInit_GL_EXT_blend_minmax (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBlendEquationEXT = (PFNGLBLENDEQUATIONEXTPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationEXT")) == NULL) || r; return r; } #endif /* GL_EXT_blend_minmax */ #ifdef GL_EXT_blend_subtract #endif /* GL_EXT_blend_subtract */ #ifdef GL_EXT_clip_volume_hint #endif /* GL_EXT_clip_volume_hint */ #ifdef GL_EXT_cmyka #endif /* GL_EXT_cmyka */ #ifdef GL_EXT_color_subtable static GLboolean _glewInit_GL_EXT_color_subtable (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glColorSubTableEXT = (PFNGLCOLORSUBTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"glColorSubTableEXT")) == NULL) || r; r = ((glCopyColorSubTableEXT = (PFNGLCOPYCOLORSUBTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyColorSubTableEXT")) == NULL) || r; return r; } #endif /* GL_EXT_color_subtable */ #ifdef GL_EXT_compiled_vertex_array static GLboolean _glewInit_GL_EXT_compiled_vertex_array (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glLockArraysEXT = (PFNGLLOCKARRAYSEXTPROC)glewGetProcAddress((const GLubyte*)"glLockArraysEXT")) == NULL) || r; r = ((glUnlockArraysEXT = (PFNGLUNLOCKARRAYSEXTPROC)glewGetProcAddress((const GLubyte*)"glUnlockArraysEXT")) == NULL) || r; return r; } #endif /* GL_EXT_compiled_vertex_array */ #ifdef GL_EXT_convolution static GLboolean _glewInit_GL_EXT_convolution (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glConvolutionFilter1DEXT = (PFNGLCONVOLUTIONFILTER1DEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionFilter1DEXT")) == NULL) || r; r = ((glConvolutionFilter2DEXT = (PFNGLCONVOLUTIONFILTER2DEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionFilter2DEXT")) == NULL) || r; r = ((glConvolutionParameterfEXT = (PFNGLCONVOLUTIONPARAMETERFEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameterfEXT")) == NULL) || r; r = ((glConvolutionParameterfvEXT = (PFNGLCONVOLUTIONPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameterfvEXT")) == NULL) || r; r = ((glConvolutionParameteriEXT = (PFNGLCONVOLUTIONPARAMETERIEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameteriEXT")) == NULL) || r; r = ((glConvolutionParameterivEXT = (PFNGLCONVOLUTIONPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameterivEXT")) == NULL) || r; r = ((glCopyConvolutionFilter1DEXT = (PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyConvolutionFilter1DEXT")) == NULL) || r; r = ((glCopyConvolutionFilter2DEXT = (PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyConvolutionFilter2DEXT")) == NULL) || r; r = ((glGetConvolutionFilterEXT = (PFNGLGETCONVOLUTIONFILTEREXTPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionFilterEXT")) == NULL) || r; r = ((glGetConvolutionParameterfvEXT = (PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionParameterfvEXT")) == NULL) || r; r = ((glGetConvolutionParameterivEXT = (PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionParameterivEXT")) == NULL) || r; r = ((glGetSeparableFilterEXT = (PFNGLGETSEPARABLEFILTEREXTPROC)glewGetProcAddress((const GLubyte*)"glGetSeparableFilterEXT")) == NULL) || r; r = ((glSeparableFilter2DEXT = (PFNGLSEPARABLEFILTER2DEXTPROC)glewGetProcAddress((const GLubyte*)"glSeparableFilter2DEXT")) == NULL) || r; return r; } #endif /* GL_EXT_convolution */ #ifdef GL_EXT_coordinate_frame static GLboolean _glewInit_GL_EXT_coordinate_frame (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBinormalPointerEXT = (PFNGLBINORMALPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glBinormalPointerEXT")) == NULL) || r; r = ((glTangentPointerEXT = (PFNGLTANGENTPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glTangentPointerEXT")) == NULL) || r; return r; } #endif /* GL_EXT_coordinate_frame */ #ifdef GL_EXT_copy_texture static GLboolean _glewInit_GL_EXT_copy_texture (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glCopyTexImage1DEXT = (PFNGLCOPYTEXIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTexImage1DEXT")) == NULL) || r; r = ((glCopyTexImage2DEXT = (PFNGLCOPYTEXIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTexImage2DEXT")) == NULL) || r; r = ((glCopyTexSubImage1DEXT = (PFNGLCOPYTEXSUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTexSubImage1DEXT")) == NULL) || r; r = ((glCopyTexSubImage2DEXT = (PFNGLCOPYTEXSUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTexSubImage2DEXT")) == NULL) || r; r = ((glCopyTexSubImage3DEXT = (PFNGLCOPYTEXSUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTexSubImage3DEXT")) == NULL) || r; return r; } #endif /* GL_EXT_copy_texture */ #ifdef GL_EXT_cull_vertex static GLboolean _glewInit_GL_EXT_cull_vertex (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glCullParameterdvEXT = (PFNGLCULLPARAMETERDVEXTPROC)glewGetProcAddress((const GLubyte*)"glCullParameterdvEXT")) == NULL) || r; r = ((glCullParameterfvEXT = (PFNGLCULLPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glCullParameterfvEXT")) == NULL) || r; return r; } #endif /* GL_EXT_cull_vertex */ #ifdef GL_EXT_debug_marker static GLboolean _glewInit_GL_EXT_debug_marker (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glInsertEventMarkerEXT = (PFNGLINSERTEVENTMARKEREXTPROC)glewGetProcAddress((const GLubyte*)"glInsertEventMarkerEXT")) == NULL) || r; r = ((glPopGroupMarkerEXT = (PFNGLPOPGROUPMARKEREXTPROC)glewGetProcAddress((const GLubyte*)"glPopGroupMarkerEXT")) == NULL) || r; r = ((glPushGroupMarkerEXT = (PFNGLPUSHGROUPMARKEREXTPROC)glewGetProcAddress((const GLubyte*)"glPushGroupMarkerEXT")) == NULL) || r; return r; } #endif /* GL_EXT_debug_marker */ #ifdef GL_EXT_depth_bounds_test static GLboolean _glewInit_GL_EXT_depth_bounds_test (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDepthBoundsEXT = (PFNGLDEPTHBOUNDSEXTPROC)glewGetProcAddress((const GLubyte*)"glDepthBoundsEXT")) == NULL) || r; return r; } #endif /* GL_EXT_depth_bounds_test */ #ifdef GL_EXT_direct_state_access static GLboolean _glewInit_GL_EXT_direct_state_access (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBindMultiTextureEXT = (PFNGLBINDMULTITEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glBindMultiTextureEXT")) == NULL) || r; r = ((glCheckNamedFramebufferStatusEXT = (PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC)glewGetProcAddress((const GLubyte*)"glCheckNamedFramebufferStatusEXT")) == NULL) || r; r = ((glClientAttribDefaultEXT = (PFNGLCLIENTATTRIBDEFAULTEXTPROC)glewGetProcAddress((const GLubyte*)"glClientAttribDefaultEXT")) == NULL) || r; r = ((glCompressedMultiTexImage1DEXT = (PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedMultiTexImage1DEXT")) == NULL) || r; r = ((glCompressedMultiTexImage2DEXT = (PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedMultiTexImage2DEXT")) == NULL) || r; r = ((glCompressedMultiTexImage3DEXT = (PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedMultiTexImage3DEXT")) == NULL) || r; r = ((glCompressedMultiTexSubImage1DEXT = (PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedMultiTexSubImage1DEXT")) == NULL) || r; r = ((glCompressedMultiTexSubImage2DEXT = (PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedMultiTexSubImage2DEXT")) == NULL) || r; r = ((glCompressedMultiTexSubImage3DEXT = (PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedMultiTexSubImage3DEXT")) == NULL) || r; r = ((glCompressedTextureImage1DEXT = (PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureImage1DEXT")) == NULL) || r; r = ((glCompressedTextureImage2DEXT = (PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureImage2DEXT")) == NULL) || r; r = ((glCompressedTextureImage3DEXT = (PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureImage3DEXT")) == NULL) || r; r = ((glCompressedTextureSubImage1DEXT = (PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureSubImage1DEXT")) == NULL) || r; r = ((glCompressedTextureSubImage2DEXT = (PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureSubImage2DEXT")) == NULL) || r; r = ((glCompressedTextureSubImage3DEXT = (PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureSubImage3DEXT")) == NULL) || r; r = ((glCopyMultiTexImage1DEXT = (PFNGLCOPYMULTITEXIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyMultiTexImage1DEXT")) == NULL) || r; r = ((glCopyMultiTexImage2DEXT = (PFNGLCOPYMULTITEXIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyMultiTexImage2DEXT")) == NULL) || r; r = ((glCopyMultiTexSubImage1DEXT = (PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyMultiTexSubImage1DEXT")) == NULL) || r; r = ((glCopyMultiTexSubImage2DEXT = (PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyMultiTexSubImage2DEXT")) == NULL) || r; r = ((glCopyMultiTexSubImage3DEXT = (PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyMultiTexSubImage3DEXT")) == NULL) || r; r = ((glCopyTextureImage1DEXT = (PFNGLCOPYTEXTUREIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTextureImage1DEXT")) == NULL) || r; r = ((glCopyTextureImage2DEXT = (PFNGLCOPYTEXTUREIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTextureImage2DEXT")) == NULL) || r; r = ((glCopyTextureSubImage1DEXT = (PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTextureSubImage1DEXT")) == NULL) || r; r = ((glCopyTextureSubImage2DEXT = (PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTextureSubImage2DEXT")) == NULL) || r; r = ((glCopyTextureSubImage3DEXT = (PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTextureSubImage3DEXT")) == NULL) || r; r = ((glDisableClientStateIndexedEXT = (PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC)glewGetProcAddress((const GLubyte*)"glDisableClientStateIndexedEXT")) == NULL) || r; r = ((glDisableClientStateiEXT = (PFNGLDISABLECLIENTSTATEIEXTPROC)glewGetProcAddress((const GLubyte*)"glDisableClientStateiEXT")) == NULL) || r; r = ((glDisableVertexArrayAttribEXT = (PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC)glewGetProcAddress((const GLubyte*)"glDisableVertexArrayAttribEXT")) == NULL) || r; r = ((glDisableVertexArrayEXT = (PFNGLDISABLEVERTEXARRAYEXTPROC)glewGetProcAddress((const GLubyte*)"glDisableVertexArrayEXT")) == NULL) || r; r = ((glEnableClientStateIndexedEXT = (PFNGLENABLECLIENTSTATEINDEXEDEXTPROC)glewGetProcAddress((const GLubyte*)"glEnableClientStateIndexedEXT")) == NULL) || r; r = ((glEnableClientStateiEXT = (PFNGLENABLECLIENTSTATEIEXTPROC)glewGetProcAddress((const GLubyte*)"glEnableClientStateiEXT")) == NULL) || r; r = ((glEnableVertexArrayAttribEXT = (PFNGLENABLEVERTEXARRAYATTRIBEXTPROC)glewGetProcAddress((const GLubyte*)"glEnableVertexArrayAttribEXT")) == NULL) || r; r = ((glEnableVertexArrayEXT = (PFNGLENABLEVERTEXARRAYEXTPROC)glewGetProcAddress((const GLubyte*)"glEnableVertexArrayEXT")) == NULL) || r; r = ((glFlushMappedNamedBufferRangeEXT = (PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC)glewGetProcAddress((const GLubyte*)"glFlushMappedNamedBufferRangeEXT")) == NULL) || r; r = ((glFramebufferDrawBufferEXT = (PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferDrawBufferEXT")) == NULL) || r; r = ((glFramebufferDrawBuffersEXT = (PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferDrawBuffersEXT")) == NULL) || r; r = ((glFramebufferReadBufferEXT = (PFNGLFRAMEBUFFERREADBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferReadBufferEXT")) == NULL) || r; r = ((glGenerateMultiTexMipmapEXT = (PFNGLGENERATEMULTITEXMIPMAPEXTPROC)glewGetProcAddress((const GLubyte*)"glGenerateMultiTexMipmapEXT")) == NULL) || r; r = ((glGenerateTextureMipmapEXT = (PFNGLGENERATETEXTUREMIPMAPEXTPROC)glewGetProcAddress((const GLubyte*)"glGenerateTextureMipmapEXT")) == NULL) || r; r = ((glGetCompressedMultiTexImageEXT = (PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glGetCompressedMultiTexImageEXT")) == NULL) || r; r = ((glGetCompressedTextureImageEXT = (PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glGetCompressedTextureImageEXT")) == NULL) || r; r = ((glGetDoubleIndexedvEXT = (PFNGLGETDOUBLEINDEXEDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetDoubleIndexedvEXT")) == NULL) || r; r = ((glGetDoublei_vEXT = (PFNGLGETDOUBLEI_VEXTPROC)glewGetProcAddress((const GLubyte*)"glGetDoublei_vEXT")) == NULL) || r; r = ((glGetFloatIndexedvEXT = (PFNGLGETFLOATINDEXEDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFloatIndexedvEXT")) == NULL) || r; r = ((glGetFloati_vEXT = (PFNGLGETFLOATI_VEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFloati_vEXT")) == NULL) || r; r = ((glGetFramebufferParameterivEXT = (PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFramebufferParameterivEXT")) == NULL) || r; r = ((glGetMultiTexEnvfvEXT = (PFNGLGETMULTITEXENVFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexEnvfvEXT")) == NULL) || r; r = ((glGetMultiTexEnvivEXT = (PFNGLGETMULTITEXENVIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexEnvivEXT")) == NULL) || r; r = ((glGetMultiTexGendvEXT = (PFNGLGETMULTITEXGENDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexGendvEXT")) == NULL) || r; r = ((glGetMultiTexGenfvEXT = (PFNGLGETMULTITEXGENFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexGenfvEXT")) == NULL) || r; r = ((glGetMultiTexGenivEXT = (PFNGLGETMULTITEXGENIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexGenivEXT")) == NULL) || r; r = ((glGetMultiTexImageEXT = (PFNGLGETMULTITEXIMAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexImageEXT")) == NULL) || r; r = ((glGetMultiTexLevelParameterfvEXT = (PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexLevelParameterfvEXT")) == NULL) || r; r = ((glGetMultiTexLevelParameterivEXT = (PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexLevelParameterivEXT")) == NULL) || r; r = ((glGetMultiTexParameterIivEXT = (PFNGLGETMULTITEXPARAMETERIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexParameterIivEXT")) == NULL) || r; r = ((glGetMultiTexParameterIuivEXT = (PFNGLGETMULTITEXPARAMETERIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexParameterIuivEXT")) == NULL) || r; r = ((glGetMultiTexParameterfvEXT = (PFNGLGETMULTITEXPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexParameterfvEXT")) == NULL) || r; r = ((glGetMultiTexParameterivEXT = (PFNGLGETMULTITEXPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexParameterivEXT")) == NULL) || r; r = ((glGetNamedBufferParameterivEXT = (PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedBufferParameterivEXT")) == NULL) || r; r = ((glGetNamedBufferPointervEXT = (PFNGLGETNAMEDBUFFERPOINTERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedBufferPointervEXT")) == NULL) || r; r = ((glGetNamedBufferSubDataEXT = (PFNGLGETNAMEDBUFFERSUBDATAEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedBufferSubDataEXT")) == NULL) || r; r = ((glGetNamedFramebufferAttachmentParameterivEXT = (PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedFramebufferAttachmentParameterivEXT")) == NULL) || r; r = ((glGetNamedProgramLocalParameterIivEXT = (PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedProgramLocalParameterIivEXT")) == NULL) || r; r = ((glGetNamedProgramLocalParameterIuivEXT = (PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedProgramLocalParameterIuivEXT")) == NULL) || r; r = ((glGetNamedProgramLocalParameterdvEXT = (PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedProgramLocalParameterdvEXT")) == NULL) || r; r = ((glGetNamedProgramLocalParameterfvEXT = (PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedProgramLocalParameterfvEXT")) == NULL) || r; r = ((glGetNamedProgramStringEXT = (PFNGLGETNAMEDPROGRAMSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedProgramStringEXT")) == NULL) || r; r = ((glGetNamedProgramivEXT = (PFNGLGETNAMEDPROGRAMIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedProgramivEXT")) == NULL) || r; r = ((glGetNamedRenderbufferParameterivEXT = (PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedRenderbufferParameterivEXT")) == NULL) || r; r = ((glGetPointerIndexedvEXT = (PFNGLGETPOINTERINDEXEDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetPointerIndexedvEXT")) == NULL) || r; r = ((glGetPointeri_vEXT = (PFNGLGETPOINTERI_VEXTPROC)glewGetProcAddress((const GLubyte*)"glGetPointeri_vEXT")) == NULL) || r; r = ((glGetTextureImageEXT = (PFNGLGETTEXTUREIMAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTextureImageEXT")) == NULL) || r; r = ((glGetTextureLevelParameterfvEXT = (PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTextureLevelParameterfvEXT")) == NULL) || r; r = ((glGetTextureLevelParameterivEXT = (PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTextureLevelParameterivEXT")) == NULL) || r; r = ((glGetTextureParameterIivEXT = (PFNGLGETTEXTUREPARAMETERIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTextureParameterIivEXT")) == NULL) || r; r = ((glGetTextureParameterIuivEXT = (PFNGLGETTEXTUREPARAMETERIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTextureParameterIuivEXT")) == NULL) || r; r = ((glGetTextureParameterfvEXT = (PFNGLGETTEXTUREPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTextureParameterfvEXT")) == NULL) || r; r = ((glGetTextureParameterivEXT = (PFNGLGETTEXTUREPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTextureParameterivEXT")) == NULL) || r; r = ((glGetVertexArrayIntegeri_vEXT = (PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVertexArrayIntegeri_vEXT")) == NULL) || r; r = ((glGetVertexArrayIntegervEXT = (PFNGLGETVERTEXARRAYINTEGERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVertexArrayIntegervEXT")) == NULL) || r; r = ((glGetVertexArrayPointeri_vEXT = (PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVertexArrayPointeri_vEXT")) == NULL) || r; r = ((glGetVertexArrayPointervEXT = (PFNGLGETVERTEXARRAYPOINTERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVertexArrayPointervEXT")) == NULL) || r; r = ((glMapNamedBufferEXT = (PFNGLMAPNAMEDBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glMapNamedBufferEXT")) == NULL) || r; r = ((glMapNamedBufferRangeEXT = (PFNGLMAPNAMEDBUFFERRANGEEXTPROC)glewGetProcAddress((const GLubyte*)"glMapNamedBufferRangeEXT")) == NULL) || r; r = ((glMatrixFrustumEXT = (PFNGLMATRIXFRUSTUMEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixFrustumEXT")) == NULL) || r; r = ((glMatrixLoadIdentityEXT = (PFNGLMATRIXLOADIDENTITYEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixLoadIdentityEXT")) == NULL) || r; r = ((glMatrixLoadTransposedEXT = (PFNGLMATRIXLOADTRANSPOSEDEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixLoadTransposedEXT")) == NULL) || r; r = ((glMatrixLoadTransposefEXT = (PFNGLMATRIXLOADTRANSPOSEFEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixLoadTransposefEXT")) == NULL) || r; r = ((glMatrixLoaddEXT = (PFNGLMATRIXLOADDEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixLoaddEXT")) == NULL) || r; r = ((glMatrixLoadfEXT = (PFNGLMATRIXLOADFEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixLoadfEXT")) == NULL) || r; r = ((glMatrixMultTransposedEXT = (PFNGLMATRIXMULTTRANSPOSEDEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixMultTransposedEXT")) == NULL) || r; r = ((glMatrixMultTransposefEXT = (PFNGLMATRIXMULTTRANSPOSEFEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixMultTransposefEXT")) == NULL) || r; r = ((glMatrixMultdEXT = (PFNGLMATRIXMULTDEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixMultdEXT")) == NULL) || r; r = ((glMatrixMultfEXT = (PFNGLMATRIXMULTFEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixMultfEXT")) == NULL) || r; r = ((glMatrixOrthoEXT = (PFNGLMATRIXORTHOEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixOrthoEXT")) == NULL) || r; r = ((glMatrixPopEXT = (PFNGLMATRIXPOPEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixPopEXT")) == NULL) || r; r = ((glMatrixPushEXT = (PFNGLMATRIXPUSHEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixPushEXT")) == NULL) || r; r = ((glMatrixRotatedEXT = (PFNGLMATRIXROTATEDEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixRotatedEXT")) == NULL) || r; r = ((glMatrixRotatefEXT = (PFNGLMATRIXROTATEFEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixRotatefEXT")) == NULL) || r; r = ((glMatrixScaledEXT = (PFNGLMATRIXSCALEDEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixScaledEXT")) == NULL) || r; r = ((glMatrixScalefEXT = (PFNGLMATRIXSCALEFEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixScalefEXT")) == NULL) || r; r = ((glMatrixTranslatedEXT = (PFNGLMATRIXTRANSLATEDEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixTranslatedEXT")) == NULL) || r; r = ((glMatrixTranslatefEXT = (PFNGLMATRIXTRANSLATEFEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixTranslatefEXT")) == NULL) || r; r = ((glMultiTexBufferEXT = (PFNGLMULTITEXBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexBufferEXT")) == NULL) || r; r = ((glMultiTexCoordPointerEXT = (PFNGLMULTITEXCOORDPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordPointerEXT")) == NULL) || r; r = ((glMultiTexEnvfEXT = (PFNGLMULTITEXENVFEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexEnvfEXT")) == NULL) || r; r = ((glMultiTexEnvfvEXT = (PFNGLMULTITEXENVFVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexEnvfvEXT")) == NULL) || r; r = ((glMultiTexEnviEXT = (PFNGLMULTITEXENVIEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexEnviEXT")) == NULL) || r; r = ((glMultiTexEnvivEXT = (PFNGLMULTITEXENVIVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexEnvivEXT")) == NULL) || r; r = ((glMultiTexGendEXT = (PFNGLMULTITEXGENDEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexGendEXT")) == NULL) || r; r = ((glMultiTexGendvEXT = (PFNGLMULTITEXGENDVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexGendvEXT")) == NULL) || r; r = ((glMultiTexGenfEXT = (PFNGLMULTITEXGENFEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexGenfEXT")) == NULL) || r; r = ((glMultiTexGenfvEXT = (PFNGLMULTITEXGENFVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexGenfvEXT")) == NULL) || r; r = ((glMultiTexGeniEXT = (PFNGLMULTITEXGENIEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexGeniEXT")) == NULL) || r; r = ((glMultiTexGenivEXT = (PFNGLMULTITEXGENIVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexGenivEXT")) == NULL) || r; r = ((glMultiTexImage1DEXT = (PFNGLMULTITEXIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexImage1DEXT")) == NULL) || r; r = ((glMultiTexImage2DEXT = (PFNGLMULTITEXIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexImage2DEXT")) == NULL) || r; r = ((glMultiTexImage3DEXT = (PFNGLMULTITEXIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexImage3DEXT")) == NULL) || r; r = ((glMultiTexParameterIivEXT = (PFNGLMULTITEXPARAMETERIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexParameterIivEXT")) == NULL) || r; r = ((glMultiTexParameterIuivEXT = (PFNGLMULTITEXPARAMETERIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexParameterIuivEXT")) == NULL) || r; r = ((glMultiTexParameterfEXT = (PFNGLMULTITEXPARAMETERFEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexParameterfEXT")) == NULL) || r; r = ((glMultiTexParameterfvEXT = (PFNGLMULTITEXPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexParameterfvEXT")) == NULL) || r; r = ((glMultiTexParameteriEXT = (PFNGLMULTITEXPARAMETERIEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexParameteriEXT")) == NULL) || r; r = ((glMultiTexParameterivEXT = (PFNGLMULTITEXPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexParameterivEXT")) == NULL) || r; r = ((glMultiTexRenderbufferEXT = (PFNGLMULTITEXRENDERBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexRenderbufferEXT")) == NULL) || r; r = ((glMultiTexSubImage1DEXT = (PFNGLMULTITEXSUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexSubImage1DEXT")) == NULL) || r; r = ((glMultiTexSubImage2DEXT = (PFNGLMULTITEXSUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexSubImage2DEXT")) == NULL) || r; r = ((glMultiTexSubImage3DEXT = (PFNGLMULTITEXSUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexSubImage3DEXT")) == NULL) || r; r = ((glNamedBufferDataEXT = (PFNGLNAMEDBUFFERDATAEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedBufferDataEXT")) == NULL) || r; r = ((glNamedBufferSubDataEXT = (PFNGLNAMEDBUFFERSUBDATAEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedBufferSubDataEXT")) == NULL) || r; r = ((glNamedCopyBufferSubDataEXT = (PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedCopyBufferSubDataEXT")) == NULL) || r; r = ((glNamedFramebufferRenderbufferEXT = (PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferRenderbufferEXT")) == NULL) || r; r = ((glNamedFramebufferTexture1DEXT = (PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTexture1DEXT")) == NULL) || r; r = ((glNamedFramebufferTexture2DEXT = (PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTexture2DEXT")) == NULL) || r; r = ((glNamedFramebufferTexture3DEXT = (PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTexture3DEXT")) == NULL) || r; r = ((glNamedFramebufferTextureEXT = (PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTextureEXT")) == NULL) || r; r = ((glNamedFramebufferTextureFaceEXT = (PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTextureFaceEXT")) == NULL) || r; r = ((glNamedFramebufferTextureLayerEXT = (PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTextureLayerEXT")) == NULL) || r; r = ((glNamedProgramLocalParameter4dEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameter4dEXT")) == NULL) || r; r = ((glNamedProgramLocalParameter4dvEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameter4dvEXT")) == NULL) || r; r = ((glNamedProgramLocalParameter4fEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameter4fEXT")) == NULL) || r; r = ((glNamedProgramLocalParameter4fvEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameter4fvEXT")) == NULL) || r; r = ((glNamedProgramLocalParameterI4iEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameterI4iEXT")) == NULL) || r; r = ((glNamedProgramLocalParameterI4ivEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameterI4ivEXT")) == NULL) || r; r = ((glNamedProgramLocalParameterI4uiEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameterI4uiEXT")) == NULL) || r; r = ((glNamedProgramLocalParameterI4uivEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameterI4uivEXT")) == NULL) || r; r = ((glNamedProgramLocalParameters4fvEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameters4fvEXT")) == NULL) || r; r = ((glNamedProgramLocalParametersI4ivEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParametersI4ivEXT")) == NULL) || r; r = ((glNamedProgramLocalParametersI4uivEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParametersI4uivEXT")) == NULL) || r; r = ((glNamedProgramStringEXT = (PFNGLNAMEDPROGRAMSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramStringEXT")) == NULL) || r; r = ((glNamedRenderbufferStorageEXT = (PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedRenderbufferStorageEXT")) == NULL) || r; r = ((glNamedRenderbufferStorageMultisampleCoverageEXT = (PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedRenderbufferStorageMultisampleCoverageEXT")) == NULL) || r; r = ((glNamedRenderbufferStorageMultisampleEXT = (PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedRenderbufferStorageMultisampleEXT")) == NULL) || r; r = ((glProgramUniform1dEXT = (PFNGLPROGRAMUNIFORM1DEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1dEXT")) == NULL) || r; r = ((glProgramUniform1dvEXT = (PFNGLPROGRAMUNIFORM1DVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1dvEXT")) == NULL) || r; r = ((glProgramUniform1fEXT = (PFNGLPROGRAMUNIFORM1FEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1fEXT")) == NULL) || r; r = ((glProgramUniform1fvEXT = (PFNGLPROGRAMUNIFORM1FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1fvEXT")) == NULL) || r; r = ((glProgramUniform1iEXT = (PFNGLPROGRAMUNIFORM1IEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1iEXT")) == NULL) || r; r = ((glProgramUniform1ivEXT = (PFNGLPROGRAMUNIFORM1IVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1ivEXT")) == NULL) || r; r = ((glProgramUniform1uiEXT = (PFNGLPROGRAMUNIFORM1UIEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1uiEXT")) == NULL) || r; r = ((glProgramUniform1uivEXT = (PFNGLPROGRAMUNIFORM1UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1uivEXT")) == NULL) || r; r = ((glProgramUniform2dEXT = (PFNGLPROGRAMUNIFORM2DEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2dEXT")) == NULL) || r; r = ((glProgramUniform2dvEXT = (PFNGLPROGRAMUNIFORM2DVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2dvEXT")) == NULL) || r; r = ((glProgramUniform2fEXT = (PFNGLPROGRAMUNIFORM2FEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2fEXT")) == NULL) || r; r = ((glProgramUniform2fvEXT = (PFNGLPROGRAMUNIFORM2FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2fvEXT")) == NULL) || r; r = ((glProgramUniform2iEXT = (PFNGLPROGRAMUNIFORM2IEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2iEXT")) == NULL) || r; r = ((glProgramUniform2ivEXT = (PFNGLPROGRAMUNIFORM2IVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2ivEXT")) == NULL) || r; r = ((glProgramUniform2uiEXT = (PFNGLPROGRAMUNIFORM2UIEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2uiEXT")) == NULL) || r; r = ((glProgramUniform2uivEXT = (PFNGLPROGRAMUNIFORM2UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2uivEXT")) == NULL) || r; r = ((glProgramUniform3dEXT = (PFNGLPROGRAMUNIFORM3DEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3dEXT")) == NULL) || r; r = ((glProgramUniform3dvEXT = (PFNGLPROGRAMUNIFORM3DVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3dvEXT")) == NULL) || r; r = ((glProgramUniform3fEXT = (PFNGLPROGRAMUNIFORM3FEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3fEXT")) == NULL) || r; r = ((glProgramUniform3fvEXT = (PFNGLPROGRAMUNIFORM3FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3fvEXT")) == NULL) || r; r = ((glProgramUniform3iEXT = (PFNGLPROGRAMUNIFORM3IEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3iEXT")) == NULL) || r; r = ((glProgramUniform3ivEXT = (PFNGLPROGRAMUNIFORM3IVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3ivEXT")) == NULL) || r; r = ((glProgramUniform3uiEXT = (PFNGLPROGRAMUNIFORM3UIEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3uiEXT")) == NULL) || r; r = ((glProgramUniform3uivEXT = (PFNGLPROGRAMUNIFORM3UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3uivEXT")) == NULL) || r; r = ((glProgramUniform4dEXT = (PFNGLPROGRAMUNIFORM4DEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4dEXT")) == NULL) || r; r = ((glProgramUniform4dvEXT = (PFNGLPROGRAMUNIFORM4DVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4dvEXT")) == NULL) || r; r = ((glProgramUniform4fEXT = (PFNGLPROGRAMUNIFORM4FEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4fEXT")) == NULL) || r; r = ((glProgramUniform4fvEXT = (PFNGLPROGRAMUNIFORM4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4fvEXT")) == NULL) || r; r = ((glProgramUniform4iEXT = (PFNGLPROGRAMUNIFORM4IEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4iEXT")) == NULL) || r; r = ((glProgramUniform4ivEXT = (PFNGLPROGRAMUNIFORM4IVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4ivEXT")) == NULL) || r; r = ((glProgramUniform4uiEXT = (PFNGLPROGRAMUNIFORM4UIEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4uiEXT")) == NULL) || r; r = ((glProgramUniform4uivEXT = (PFNGLPROGRAMUNIFORM4UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4uivEXT")) == NULL) || r; r = ((glProgramUniformMatrix2dvEXT = (PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2dvEXT")) == NULL) || r; r = ((glProgramUniformMatrix2fvEXT = (PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2fvEXT")) == NULL) || r; r = ((glProgramUniformMatrix2x3dvEXT = (PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2x3dvEXT")) == NULL) || r; r = ((glProgramUniformMatrix2x3fvEXT = (PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2x3fvEXT")) == NULL) || r; r = ((glProgramUniformMatrix2x4dvEXT = (PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2x4dvEXT")) == NULL) || r; r = ((glProgramUniformMatrix2x4fvEXT = (PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2x4fvEXT")) == NULL) || r; r = ((glProgramUniformMatrix3dvEXT = (PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3dvEXT")) == NULL) || r; r = ((glProgramUniformMatrix3fvEXT = (PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3fvEXT")) == NULL) || r; r = ((glProgramUniformMatrix3x2dvEXT = (PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3x2dvEXT")) == NULL) || r; r = ((glProgramUniformMatrix3x2fvEXT = (PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3x2fvEXT")) == NULL) || r; r = ((glProgramUniformMatrix3x4dvEXT = (PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3x4dvEXT")) == NULL) || r; r = ((glProgramUniformMatrix3x4fvEXT = (PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3x4fvEXT")) == NULL) || r; r = ((glProgramUniformMatrix4dvEXT = (PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4dvEXT")) == NULL) || r; r = ((glProgramUniformMatrix4fvEXT = (PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4fvEXT")) == NULL) || r; r = ((glProgramUniformMatrix4x2dvEXT = (PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4x2dvEXT")) == NULL) || r; r = ((glProgramUniformMatrix4x2fvEXT = (PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4x2fvEXT")) == NULL) || r; r = ((glProgramUniformMatrix4x3dvEXT = (PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4x3dvEXT")) == NULL) || r; r = ((glProgramUniformMatrix4x3fvEXT = (PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4x3fvEXT")) == NULL) || r; r = ((glPushClientAttribDefaultEXT = (PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC)glewGetProcAddress((const GLubyte*)"glPushClientAttribDefaultEXT")) == NULL) || r; r = ((glTextureBufferEXT = (PFNGLTEXTUREBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glTextureBufferEXT")) == NULL) || r; r = ((glTextureImage1DEXT = (PFNGLTEXTUREIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureImage1DEXT")) == NULL) || r; r = ((glTextureImage2DEXT = (PFNGLTEXTUREIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureImage2DEXT")) == NULL) || r; r = ((glTextureImage3DEXT = (PFNGLTEXTUREIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureImage3DEXT")) == NULL) || r; r = ((glTextureParameterIivEXT = (PFNGLTEXTUREPARAMETERIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterIivEXT")) == NULL) || r; r = ((glTextureParameterIuivEXT = (PFNGLTEXTUREPARAMETERIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterIuivEXT")) == NULL) || r; r = ((glTextureParameterfEXT = (PFNGLTEXTUREPARAMETERFEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterfEXT")) == NULL) || r; r = ((glTextureParameterfvEXT = (PFNGLTEXTUREPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterfvEXT")) == NULL) || r; r = ((glTextureParameteriEXT = (PFNGLTEXTUREPARAMETERIEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureParameteriEXT")) == NULL) || r; r = ((glTextureParameterivEXT = (PFNGLTEXTUREPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterivEXT")) == NULL) || r; r = ((glTextureRenderbufferEXT = (PFNGLTEXTURERENDERBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glTextureRenderbufferEXT")) == NULL) || r; r = ((glTextureSubImage1DEXT = (PFNGLTEXTURESUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureSubImage1DEXT")) == NULL) || r; r = ((glTextureSubImage2DEXT = (PFNGLTEXTURESUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureSubImage2DEXT")) == NULL) || r; r = ((glTextureSubImage3DEXT = (PFNGLTEXTURESUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureSubImage3DEXT")) == NULL) || r; r = ((glUnmapNamedBufferEXT = (PFNGLUNMAPNAMEDBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glUnmapNamedBufferEXT")) == NULL) || r; r = ((glVertexArrayColorOffsetEXT = (PFNGLVERTEXARRAYCOLOROFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayColorOffsetEXT")) == NULL) || r; r = ((glVertexArrayEdgeFlagOffsetEXT = (PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayEdgeFlagOffsetEXT")) == NULL) || r; r = ((glVertexArrayFogCoordOffsetEXT = (PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayFogCoordOffsetEXT")) == NULL) || r; r = ((glVertexArrayIndexOffsetEXT = (PFNGLVERTEXARRAYINDEXOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayIndexOffsetEXT")) == NULL) || r; r = ((glVertexArrayMultiTexCoordOffsetEXT = (PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayMultiTexCoordOffsetEXT")) == NULL) || r; r = ((glVertexArrayNormalOffsetEXT = (PFNGLVERTEXARRAYNORMALOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayNormalOffsetEXT")) == NULL) || r; r = ((glVertexArraySecondaryColorOffsetEXT = (PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArraySecondaryColorOffsetEXT")) == NULL) || r; r = ((glVertexArrayTexCoordOffsetEXT = (PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayTexCoordOffsetEXT")) == NULL) || r; r = ((glVertexArrayVertexAttribIOffsetEXT = (PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexAttribIOffsetEXT")) == NULL) || r; r = ((glVertexArrayVertexAttribOffsetEXT = (PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexAttribOffsetEXT")) == NULL) || r; r = ((glVertexArrayVertexOffsetEXT = (PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexOffsetEXT")) == NULL) || r; return r; } #endif /* GL_EXT_direct_state_access */ #ifdef GL_EXT_draw_buffers2 static GLboolean _glewInit_GL_EXT_draw_buffers2 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glColorMaskIndexedEXT = (PFNGLCOLORMASKINDEXEDEXTPROC)glewGetProcAddress((const GLubyte*)"glColorMaskIndexedEXT")) == NULL) || r; r = ((glDisableIndexedEXT = (PFNGLDISABLEINDEXEDEXTPROC)glewGetProcAddress((const GLubyte*)"glDisableIndexedEXT")) == NULL) || r; r = ((glEnableIndexedEXT = (PFNGLENABLEINDEXEDEXTPROC)glewGetProcAddress((const GLubyte*)"glEnableIndexedEXT")) == NULL) || r; r = ((glGetBooleanIndexedvEXT = (PFNGLGETBOOLEANINDEXEDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetBooleanIndexedvEXT")) == NULL) || r; r = ((glGetIntegerIndexedvEXT = (PFNGLGETINTEGERINDEXEDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetIntegerIndexedvEXT")) == NULL) || r; r = ((glIsEnabledIndexedEXT = (PFNGLISENABLEDINDEXEDEXTPROC)glewGetProcAddress((const GLubyte*)"glIsEnabledIndexedEXT")) == NULL) || r; return r; } #endif /* GL_EXT_draw_buffers2 */ #ifdef GL_EXT_draw_instanced static GLboolean _glewInit_GL_EXT_draw_instanced (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDrawArraysInstancedEXT = (PFNGLDRAWARRAYSINSTANCEDEXTPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysInstancedEXT")) == NULL) || r; r = ((glDrawElementsInstancedEXT = (PFNGLDRAWELEMENTSINSTANCEDEXTPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstancedEXT")) == NULL) || r; return r; } #endif /* GL_EXT_draw_instanced */ #ifdef GL_EXT_draw_range_elements static GLboolean _glewInit_GL_EXT_draw_range_elements (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDrawRangeElementsEXT = (PFNGLDRAWRANGEELEMENTSEXTPROC)glewGetProcAddress((const GLubyte*)"glDrawRangeElementsEXT")) == NULL) || r; return r; } #endif /* GL_EXT_draw_range_elements */ #ifdef GL_EXT_fog_coord static GLboolean _glewInit_GL_EXT_fog_coord (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glFogCoordPointerEXT = (PFNGLFOGCOORDPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glFogCoordPointerEXT")) == NULL) || r; r = ((glFogCoorddEXT = (PFNGLFOGCOORDDEXTPROC)glewGetProcAddress((const GLubyte*)"glFogCoorddEXT")) == NULL) || r; r = ((glFogCoorddvEXT = (PFNGLFOGCOORDDVEXTPROC)glewGetProcAddress((const GLubyte*)"glFogCoorddvEXT")) == NULL) || r; r = ((glFogCoordfEXT = (PFNGLFOGCOORDFEXTPROC)glewGetProcAddress((const GLubyte*)"glFogCoordfEXT")) == NULL) || r; r = ((glFogCoordfvEXT = (PFNGLFOGCOORDFVEXTPROC)glewGetProcAddress((const GLubyte*)"glFogCoordfvEXT")) == NULL) || r; return r; } #endif /* GL_EXT_fog_coord */ #ifdef GL_EXT_fragment_lighting static GLboolean _glewInit_GL_EXT_fragment_lighting (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glFragmentColorMaterialEXT = (PFNGLFRAGMENTCOLORMATERIALEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentColorMaterialEXT")) == NULL) || r; r = ((glFragmentLightModelfEXT = (PFNGLFRAGMENTLIGHTMODELFEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelfEXT")) == NULL) || r; r = ((glFragmentLightModelfvEXT = (PFNGLFRAGMENTLIGHTMODELFVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelfvEXT")) == NULL) || r; r = ((glFragmentLightModeliEXT = (PFNGLFRAGMENTLIGHTMODELIEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModeliEXT")) == NULL) || r; r = ((glFragmentLightModelivEXT = (PFNGLFRAGMENTLIGHTMODELIVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelivEXT")) == NULL) || r; r = ((glFragmentLightfEXT = (PFNGLFRAGMENTLIGHTFEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightfEXT")) == NULL) || r; r = ((glFragmentLightfvEXT = (PFNGLFRAGMENTLIGHTFVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightfvEXT")) == NULL) || r; r = ((glFragmentLightiEXT = (PFNGLFRAGMENTLIGHTIEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightiEXT")) == NULL) || r; r = ((glFragmentLightivEXT = (PFNGLFRAGMENTLIGHTIVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightivEXT")) == NULL) || r; r = ((glFragmentMaterialfEXT = (PFNGLFRAGMENTMATERIALFEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialfEXT")) == NULL) || r; r = ((glFragmentMaterialfvEXT = (PFNGLFRAGMENTMATERIALFVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialfvEXT")) == NULL) || r; r = ((glFragmentMaterialiEXT = (PFNGLFRAGMENTMATERIALIEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialiEXT")) == NULL) || r; r = ((glFragmentMaterialivEXT = (PFNGLFRAGMENTMATERIALIVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialivEXT")) == NULL) || r; r = ((glGetFragmentLightfvEXT = (PFNGLGETFRAGMENTLIGHTFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentLightfvEXT")) == NULL) || r; r = ((glGetFragmentLightivEXT = (PFNGLGETFRAGMENTLIGHTIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentLightivEXT")) == NULL) || r; r = ((glGetFragmentMaterialfvEXT = (PFNGLGETFRAGMENTMATERIALFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentMaterialfvEXT")) == NULL) || r; r = ((glGetFragmentMaterialivEXT = (PFNGLGETFRAGMENTMATERIALIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentMaterialivEXT")) == NULL) || r; r = ((glLightEnviEXT = (PFNGLLIGHTENVIEXTPROC)glewGetProcAddress((const GLubyte*)"glLightEnviEXT")) == NULL) || r; return r; } #endif /* GL_EXT_fragment_lighting */ #ifdef GL_EXT_framebuffer_blit static GLboolean _glewInit_GL_EXT_framebuffer_blit (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBlitFramebufferEXT = (PFNGLBLITFRAMEBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glBlitFramebufferEXT")) == NULL) || r; return r; } #endif /* GL_EXT_framebuffer_blit */ #ifdef GL_EXT_framebuffer_multisample static GLboolean _glewInit_GL_EXT_framebuffer_multisample (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glRenderbufferStorageMultisampleEXT = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)glewGetProcAddress((const GLubyte*)"glRenderbufferStorageMultisampleEXT")) == NULL) || r; return r; } #endif /* GL_EXT_framebuffer_multisample */ #ifdef GL_EXT_framebuffer_multisample_blit_scaled #endif /* GL_EXT_framebuffer_multisample_blit_scaled */ #ifdef GL_EXT_framebuffer_object static GLboolean _glewInit_GL_EXT_framebuffer_object (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindFramebufferEXT")) == NULL) || r; r = ((glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindRenderbufferEXT")) == NULL) || r; r = ((glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)glewGetProcAddress((const GLubyte*)"glCheckFramebufferStatusEXT")) == NULL) || r; r = ((glDeleteFramebuffersEXT = (PFNGLDELETEFRAMEBUFFERSEXTPROC)glewGetProcAddress((const GLubyte*)"glDeleteFramebuffersEXT")) == NULL) || r; r = ((glDeleteRenderbuffersEXT = (PFNGLDELETERENDERBUFFERSEXTPROC)glewGetProcAddress((const GLubyte*)"glDeleteRenderbuffersEXT")) == NULL) || r; r = ((glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferRenderbufferEXT")) == NULL) || r; r = ((glFramebufferTexture1DEXT = (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture1DEXT")) == NULL) || r; r = ((glFramebufferTexture2DEXT = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture2DEXT")) == NULL) || r; r = ((glFramebufferTexture3DEXT = (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture3DEXT")) == NULL) || r; r = ((glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC)glewGetProcAddress((const GLubyte*)"glGenFramebuffersEXT")) == NULL) || r; r = ((glGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC)glewGetProcAddress((const GLubyte*)"glGenRenderbuffersEXT")) == NULL) || r; r = ((glGenerateMipmapEXT = (PFNGLGENERATEMIPMAPEXTPROC)glewGetProcAddress((const GLubyte*)"glGenerateMipmapEXT")) == NULL) || r; r = ((glGetFramebufferAttachmentParameterivEXT = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFramebufferAttachmentParameterivEXT")) == NULL) || r; r = ((glGetRenderbufferParameterivEXT = (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetRenderbufferParameterivEXT")) == NULL) || r; r = ((glIsFramebufferEXT = (PFNGLISFRAMEBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glIsFramebufferEXT")) == NULL) || r; r = ((glIsRenderbufferEXT = (PFNGLISRENDERBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glIsRenderbufferEXT")) == NULL) || r; r = ((glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glRenderbufferStorageEXT")) == NULL) || r; return r; } #endif /* GL_EXT_framebuffer_object */ #ifdef GL_EXT_framebuffer_sRGB #endif /* GL_EXT_framebuffer_sRGB */ #ifdef GL_EXT_geometry_shader4 static GLboolean _glewInit_GL_EXT_geometry_shader4 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glFramebufferTextureEXT = (PFNGLFRAMEBUFFERTEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureEXT")) == NULL) || r; r = ((glFramebufferTextureFaceEXT = (PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureFaceEXT")) == NULL) || r; r = ((glProgramParameteriEXT = (PFNGLPROGRAMPARAMETERIEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramParameteriEXT")) == NULL) || r; return r; } #endif /* GL_EXT_geometry_shader4 */ #ifdef GL_EXT_gpu_program_parameters static GLboolean _glewInit_GL_EXT_gpu_program_parameters (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glProgramEnvParameters4fvEXT = (PFNGLPROGRAMENVPARAMETERS4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameters4fvEXT")) == NULL) || r; r = ((glProgramLocalParameters4fvEXT = (PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameters4fvEXT")) == NULL) || r; return r; } #endif /* GL_EXT_gpu_program_parameters */ #ifdef GL_EXT_gpu_shader4 static GLboolean _glewInit_GL_EXT_gpu_shader4 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBindFragDataLocationEXT = (PFNGLBINDFRAGDATALOCATIONEXTPROC)glewGetProcAddress((const GLubyte*)"glBindFragDataLocationEXT")) == NULL) || r; r = ((glGetFragDataLocationEXT = (PFNGLGETFRAGDATALOCATIONEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFragDataLocationEXT")) == NULL) || r; r = ((glGetUniformuivEXT = (PFNGLGETUNIFORMUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetUniformuivEXT")) == NULL) || r; r = ((glGetVertexAttribIivEXT = (PFNGLGETVERTEXATTRIBIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribIivEXT")) == NULL) || r; r = ((glGetVertexAttribIuivEXT = (PFNGLGETVERTEXATTRIBIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribIuivEXT")) == NULL) || r; r = ((glUniform1uiEXT = (PFNGLUNIFORM1UIEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform1uiEXT")) == NULL) || r; r = ((glUniform1uivEXT = (PFNGLUNIFORM1UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform1uivEXT")) == NULL) || r; r = ((glUniform2uiEXT = (PFNGLUNIFORM2UIEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform2uiEXT")) == NULL) || r; r = ((glUniform2uivEXT = (PFNGLUNIFORM2UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform2uivEXT")) == NULL) || r; r = ((glUniform3uiEXT = (PFNGLUNIFORM3UIEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform3uiEXT")) == NULL) || r; r = ((glUniform3uivEXT = (PFNGLUNIFORM3UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform3uivEXT")) == NULL) || r; r = ((glUniform4uiEXT = (PFNGLUNIFORM4UIEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform4uiEXT")) == NULL) || r; r = ((glUniform4uivEXT = (PFNGLUNIFORM4UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform4uivEXT")) == NULL) || r; r = ((glVertexAttribI1iEXT = (PFNGLVERTEXATTRIBI1IEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1iEXT")) == NULL) || r; r = ((glVertexAttribI1ivEXT = (PFNGLVERTEXATTRIBI1IVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1ivEXT")) == NULL) || r; r = ((glVertexAttribI1uiEXT = (PFNGLVERTEXATTRIBI1UIEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1uiEXT")) == NULL) || r; r = ((glVertexAttribI1uivEXT = (PFNGLVERTEXATTRIBI1UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1uivEXT")) == NULL) || r; r = ((glVertexAttribI2iEXT = (PFNGLVERTEXATTRIBI2IEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2iEXT")) == NULL) || r; r = ((glVertexAttribI2ivEXT = (PFNGLVERTEXATTRIBI2IVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2ivEXT")) == NULL) || r; r = ((glVertexAttribI2uiEXT = (PFNGLVERTEXATTRIBI2UIEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2uiEXT")) == NULL) || r; r = ((glVertexAttribI2uivEXT = (PFNGLVERTEXATTRIBI2UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2uivEXT")) == NULL) || r; r = ((glVertexAttribI3iEXT = (PFNGLVERTEXATTRIBI3IEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3iEXT")) == NULL) || r; r = ((glVertexAttribI3ivEXT = (PFNGLVERTEXATTRIBI3IVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3ivEXT")) == NULL) || r; r = ((glVertexAttribI3uiEXT = (PFNGLVERTEXATTRIBI3UIEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3uiEXT")) == NULL) || r; r = ((glVertexAttribI3uivEXT = (PFNGLVERTEXATTRIBI3UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3uivEXT")) == NULL) || r; r = ((glVertexAttribI4bvEXT = (PFNGLVERTEXATTRIBI4BVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4bvEXT")) == NULL) || r; r = ((glVertexAttribI4iEXT = (PFNGLVERTEXATTRIBI4IEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4iEXT")) == NULL) || r; r = ((glVertexAttribI4ivEXT = (PFNGLVERTEXATTRIBI4IVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4ivEXT")) == NULL) || r; r = ((glVertexAttribI4svEXT = (PFNGLVERTEXATTRIBI4SVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4svEXT")) == NULL) || r; r = ((glVertexAttribI4ubvEXT = (PFNGLVERTEXATTRIBI4UBVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4ubvEXT")) == NULL) || r; r = ((glVertexAttribI4uiEXT = (PFNGLVERTEXATTRIBI4UIEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4uiEXT")) == NULL) || r; r = ((glVertexAttribI4uivEXT = (PFNGLVERTEXATTRIBI4UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4uivEXT")) == NULL) || r; r = ((glVertexAttribI4usvEXT = (PFNGLVERTEXATTRIBI4USVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4usvEXT")) == NULL) || r; r = ((glVertexAttribIPointerEXT = (PFNGLVERTEXATTRIBIPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribIPointerEXT")) == NULL) || r; return r; } #endif /* GL_EXT_gpu_shader4 */ #ifdef GL_EXT_histogram static GLboolean _glewInit_GL_EXT_histogram (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetHistogramEXT = (PFNGLGETHISTOGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glGetHistogramEXT")) == NULL) || r; r = ((glGetHistogramParameterfvEXT = (PFNGLGETHISTOGRAMPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetHistogramParameterfvEXT")) == NULL) || r; r = ((glGetHistogramParameterivEXT = (PFNGLGETHISTOGRAMPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetHistogramParameterivEXT")) == NULL) || r; r = ((glGetMinmaxEXT = (PFNGLGETMINMAXEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMinmaxEXT")) == NULL) || r; r = ((glGetMinmaxParameterfvEXT = (PFNGLGETMINMAXPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMinmaxParameterfvEXT")) == NULL) || r; r = ((glGetMinmaxParameterivEXT = (PFNGLGETMINMAXPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMinmaxParameterivEXT")) == NULL) || r; r = ((glHistogramEXT = (PFNGLHISTOGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glHistogramEXT")) == NULL) || r; r = ((glMinmaxEXT = (PFNGLMINMAXEXTPROC)glewGetProcAddress((const GLubyte*)"glMinmaxEXT")) == NULL) || r; r = ((glResetHistogramEXT = (PFNGLRESETHISTOGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glResetHistogramEXT")) == NULL) || r; r = ((glResetMinmaxEXT = (PFNGLRESETMINMAXEXTPROC)glewGetProcAddress((const GLubyte*)"glResetMinmaxEXT")) == NULL) || r; return r; } #endif /* GL_EXT_histogram */ #ifdef GL_EXT_index_array_formats #endif /* GL_EXT_index_array_formats */ #ifdef GL_EXT_index_func static GLboolean _glewInit_GL_EXT_index_func (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glIndexFuncEXT = (PFNGLINDEXFUNCEXTPROC)glewGetProcAddress((const GLubyte*)"glIndexFuncEXT")) == NULL) || r; return r; } #endif /* GL_EXT_index_func */ #ifdef GL_EXT_index_material static GLboolean _glewInit_GL_EXT_index_material (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glIndexMaterialEXT = (PFNGLINDEXMATERIALEXTPROC)glewGetProcAddress((const GLubyte*)"glIndexMaterialEXT")) == NULL) || r; return r; } #endif /* GL_EXT_index_material */ #ifdef GL_EXT_index_texture #endif /* GL_EXT_index_texture */ #ifdef GL_EXT_light_texture static GLboolean _glewInit_GL_EXT_light_texture (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glApplyTextureEXT = (PFNGLAPPLYTEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glApplyTextureEXT")) == NULL) || r; r = ((glTextureLightEXT = (PFNGLTEXTURELIGHTEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureLightEXT")) == NULL) || r; r = ((glTextureMaterialEXT = (PFNGLTEXTUREMATERIALEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureMaterialEXT")) == NULL) || r; return r; } #endif /* GL_EXT_light_texture */ #ifdef GL_EXT_misc_attribute #endif /* GL_EXT_misc_attribute */ #ifdef GL_EXT_multi_draw_arrays static GLboolean _glewInit_GL_EXT_multi_draw_arrays (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glMultiDrawArraysEXT = (PFNGLMULTIDRAWARRAYSEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArraysEXT")) == NULL) || r; r = ((glMultiDrawElementsEXT = (PFNGLMULTIDRAWELEMENTSEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsEXT")) == NULL) || r; return r; } #endif /* GL_EXT_multi_draw_arrays */ #ifdef GL_EXT_multisample static GLboolean _glewInit_GL_EXT_multisample (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glSampleMaskEXT = (PFNGLSAMPLEMASKEXTPROC)glewGetProcAddress((const GLubyte*)"glSampleMaskEXT")) == NULL) || r; r = ((glSamplePatternEXT = (PFNGLSAMPLEPATTERNEXTPROC)glewGetProcAddress((const GLubyte*)"glSamplePatternEXT")) == NULL) || r; return r; } #endif /* GL_EXT_multisample */ #ifdef GL_EXT_packed_depth_stencil #endif /* GL_EXT_packed_depth_stencil */ #ifdef GL_EXT_packed_float #endif /* GL_EXT_packed_float */ #ifdef GL_EXT_packed_pixels #endif /* GL_EXT_packed_pixels */ #ifdef GL_EXT_paletted_texture static GLboolean _glewInit_GL_EXT_paletted_texture (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glColorTableEXT = (PFNGLCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"glColorTableEXT")) == NULL) || r; r = ((glGetColorTableEXT = (PFNGLGETCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableEXT")) == NULL) || r; r = ((glGetColorTableParameterfvEXT = (PFNGLGETCOLORTABLEPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameterfvEXT")) == NULL) || r; r = ((glGetColorTableParameterivEXT = (PFNGLGETCOLORTABLEPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameterivEXT")) == NULL) || r; return r; } #endif /* GL_EXT_paletted_texture */ #ifdef GL_EXT_pixel_buffer_object #endif /* GL_EXT_pixel_buffer_object */ #ifdef GL_EXT_pixel_transform static GLboolean _glewInit_GL_EXT_pixel_transform (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetPixelTransformParameterfvEXT = (PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetPixelTransformParameterfvEXT")) == NULL) || r; r = ((glGetPixelTransformParameterivEXT = (PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetPixelTransformParameterivEXT")) == NULL) || r; r = ((glPixelTransformParameterfEXT = (PFNGLPIXELTRANSFORMPARAMETERFEXTPROC)glewGetProcAddress((const GLubyte*)"glPixelTransformParameterfEXT")) == NULL) || r; r = ((glPixelTransformParameterfvEXT = (PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glPixelTransformParameterfvEXT")) == NULL) || r; r = ((glPixelTransformParameteriEXT = (PFNGLPIXELTRANSFORMPARAMETERIEXTPROC)glewGetProcAddress((const GLubyte*)"glPixelTransformParameteriEXT")) == NULL) || r; r = ((glPixelTransformParameterivEXT = (PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glPixelTransformParameterivEXT")) == NULL) || r; return r; } #endif /* GL_EXT_pixel_transform */ #ifdef GL_EXT_pixel_transform_color_table #endif /* GL_EXT_pixel_transform_color_table */ #ifdef GL_EXT_point_parameters static GLboolean _glewInit_GL_EXT_point_parameters (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glPointParameterfEXT = (PFNGLPOINTPARAMETERFEXTPROC)glewGetProcAddress((const GLubyte*)"glPointParameterfEXT")) == NULL) || r; r = ((glPointParameterfvEXT = (PFNGLPOINTPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glPointParameterfvEXT")) == NULL) || r; return r; } #endif /* GL_EXT_point_parameters */ #ifdef GL_EXT_polygon_offset static GLboolean _glewInit_GL_EXT_polygon_offset (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glPolygonOffsetEXT = (PFNGLPOLYGONOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glPolygonOffsetEXT")) == NULL) || r; return r; } #endif /* GL_EXT_polygon_offset */ #ifdef GL_EXT_provoking_vertex static GLboolean _glewInit_GL_EXT_provoking_vertex (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glProvokingVertexEXT = (PFNGLPROVOKINGVERTEXEXTPROC)glewGetProcAddress((const GLubyte*)"glProvokingVertexEXT")) == NULL) || r; return r; } #endif /* GL_EXT_provoking_vertex */ #ifdef GL_EXT_rescale_normal #endif /* GL_EXT_rescale_normal */ #ifdef GL_EXT_scene_marker static GLboolean _glewInit_GL_EXT_scene_marker (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBeginSceneEXT = (PFNGLBEGINSCENEEXTPROC)glewGetProcAddress((const GLubyte*)"glBeginSceneEXT")) == NULL) || r; r = ((glEndSceneEXT = (PFNGLENDSCENEEXTPROC)glewGetProcAddress((const GLubyte*)"glEndSceneEXT")) == NULL) || r; return r; } #endif /* GL_EXT_scene_marker */ #ifdef GL_EXT_secondary_color static GLboolean _glewInit_GL_EXT_secondary_color (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glSecondaryColor3bEXT = (PFNGLSECONDARYCOLOR3BEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3bEXT")) == NULL) || r; r = ((glSecondaryColor3bvEXT = (PFNGLSECONDARYCOLOR3BVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3bvEXT")) == NULL) || r; r = ((glSecondaryColor3dEXT = (PFNGLSECONDARYCOLOR3DEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3dEXT")) == NULL) || r; r = ((glSecondaryColor3dvEXT = (PFNGLSECONDARYCOLOR3DVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3dvEXT")) == NULL) || r; r = ((glSecondaryColor3fEXT = (PFNGLSECONDARYCOLOR3FEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3fEXT")) == NULL) || r; r = ((glSecondaryColor3fvEXT = (PFNGLSECONDARYCOLOR3FVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3fvEXT")) == NULL) || r; r = ((glSecondaryColor3iEXT = (PFNGLSECONDARYCOLOR3IEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3iEXT")) == NULL) || r; r = ((glSecondaryColor3ivEXT = (PFNGLSECONDARYCOLOR3IVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ivEXT")) == NULL) || r; r = ((glSecondaryColor3sEXT = (PFNGLSECONDARYCOLOR3SEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3sEXT")) == NULL) || r; r = ((glSecondaryColor3svEXT = (PFNGLSECONDARYCOLOR3SVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3svEXT")) == NULL) || r; r = ((glSecondaryColor3ubEXT = (PFNGLSECONDARYCOLOR3UBEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ubEXT")) == NULL) || r; r = ((glSecondaryColor3ubvEXT = (PFNGLSECONDARYCOLOR3UBVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ubvEXT")) == NULL) || r; r = ((glSecondaryColor3uiEXT = (PFNGLSECONDARYCOLOR3UIEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3uiEXT")) == NULL) || r; r = ((glSecondaryColor3uivEXT = (PFNGLSECONDARYCOLOR3UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3uivEXT")) == NULL) || r; r = ((glSecondaryColor3usEXT = (PFNGLSECONDARYCOLOR3USEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3usEXT")) == NULL) || r; r = ((glSecondaryColor3usvEXT = (PFNGLSECONDARYCOLOR3USVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3usvEXT")) == NULL) || r; r = ((glSecondaryColorPointerEXT = (PFNGLSECONDARYCOLORPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColorPointerEXT")) == NULL) || r; return r; } #endif /* GL_EXT_secondary_color */ #ifdef GL_EXT_separate_shader_objects static GLboolean _glewInit_GL_EXT_separate_shader_objects (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glActiveProgramEXT = (PFNGLACTIVEPROGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glActiveProgramEXT")) == NULL) || r; r = ((glCreateShaderProgramEXT = (PFNGLCREATESHADERPROGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glCreateShaderProgramEXT")) == NULL) || r; r = ((glUseShaderProgramEXT = (PFNGLUSESHADERPROGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glUseShaderProgramEXT")) == NULL) || r; return r; } #endif /* GL_EXT_separate_shader_objects */ #ifdef GL_EXT_separate_specular_color #endif /* GL_EXT_separate_specular_color */ #ifdef GL_EXT_shader_image_load_store static GLboolean _glewInit_GL_EXT_shader_image_load_store (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBindImageTextureEXT = (PFNGLBINDIMAGETEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glBindImageTextureEXT")) == NULL) || r; r = ((glMemoryBarrierEXT = (PFNGLMEMORYBARRIEREXTPROC)glewGetProcAddress((const GLubyte*)"glMemoryBarrierEXT")) == NULL) || r; return r; } #endif /* GL_EXT_shader_image_load_store */ #ifdef GL_EXT_shadow_funcs #endif /* GL_EXT_shadow_funcs */ #ifdef GL_EXT_shared_texture_palette #endif /* GL_EXT_shared_texture_palette */ #ifdef GL_EXT_stencil_clear_tag #endif /* GL_EXT_stencil_clear_tag */ #ifdef GL_EXT_stencil_two_side static GLboolean _glewInit_GL_EXT_stencil_two_side (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glActiveStencilFaceEXT = (PFNGLACTIVESTENCILFACEEXTPROC)glewGetProcAddress((const GLubyte*)"glActiveStencilFaceEXT")) == NULL) || r; return r; } #endif /* GL_EXT_stencil_two_side */ #ifdef GL_EXT_stencil_wrap #endif /* GL_EXT_stencil_wrap */ #ifdef GL_EXT_subtexture static GLboolean _glewInit_GL_EXT_subtexture (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glTexSubImage1DEXT = (PFNGLTEXSUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glTexSubImage1DEXT")) == NULL) || r; r = ((glTexSubImage2DEXT = (PFNGLTEXSUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glTexSubImage2DEXT")) == NULL) || r; r = ((glTexSubImage3DEXT = (PFNGLTEXSUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glTexSubImage3DEXT")) == NULL) || r; return r; } #endif /* GL_EXT_subtexture */ #ifdef GL_EXT_texture #endif /* GL_EXT_texture */ #ifdef GL_EXT_texture3D static GLboolean _glewInit_GL_EXT_texture3D (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glTexImage3DEXT = (PFNGLTEXIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glTexImage3DEXT")) == NULL) || r; return r; } #endif /* GL_EXT_texture3D */ #ifdef GL_EXT_texture_array static GLboolean _glewInit_GL_EXT_texture_array (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glFramebufferTextureLayerEXT = (PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureLayerEXT")) == NULL) || r; return r; } #endif /* GL_EXT_texture_array */ #ifdef GL_EXT_texture_buffer_object static GLboolean _glewInit_GL_EXT_texture_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glTexBufferEXT = (PFNGLTEXBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glTexBufferEXT")) == NULL) || r; return r; } #endif /* GL_EXT_texture_buffer_object */ #ifdef GL_EXT_texture_compression_dxt1 #endif /* GL_EXT_texture_compression_dxt1 */ #ifdef GL_EXT_texture_compression_latc #endif /* GL_EXT_texture_compression_latc */ #ifdef GL_EXT_texture_compression_rgtc #endif /* GL_EXT_texture_compression_rgtc */ #ifdef GL_EXT_texture_compression_s3tc #endif /* GL_EXT_texture_compression_s3tc */ #ifdef GL_EXT_texture_cube_map #endif /* GL_EXT_texture_cube_map */ #ifdef GL_EXT_texture_edge_clamp #endif /* GL_EXT_texture_edge_clamp */ #ifdef GL_EXT_texture_env #endif /* GL_EXT_texture_env */ #ifdef GL_EXT_texture_env_add #endif /* GL_EXT_texture_env_add */ #ifdef GL_EXT_texture_env_combine #endif /* GL_EXT_texture_env_combine */ #ifdef GL_EXT_texture_env_dot3 #endif /* GL_EXT_texture_env_dot3 */ #ifdef GL_EXT_texture_filter_anisotropic #endif /* GL_EXT_texture_filter_anisotropic */ #ifdef GL_EXT_texture_integer static GLboolean _glewInit_GL_EXT_texture_integer (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glClearColorIiEXT = (PFNGLCLEARCOLORIIEXTPROC)glewGetProcAddress((const GLubyte*)"glClearColorIiEXT")) == NULL) || r; r = ((glClearColorIuiEXT = (PFNGLCLEARCOLORIUIEXTPROC)glewGetProcAddress((const GLubyte*)"glClearColorIuiEXT")) == NULL) || r; r = ((glGetTexParameterIivEXT = (PFNGLGETTEXPARAMETERIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTexParameterIivEXT")) == NULL) || r; r = ((glGetTexParameterIuivEXT = (PFNGLGETTEXPARAMETERIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTexParameterIuivEXT")) == NULL) || r; r = ((glTexParameterIivEXT = (PFNGLTEXPARAMETERIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glTexParameterIivEXT")) == NULL) || r; r = ((glTexParameterIuivEXT = (PFNGLTEXPARAMETERIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glTexParameterIuivEXT")) == NULL) || r; return r; } #endif /* GL_EXT_texture_integer */ #ifdef GL_EXT_texture_lod_bias #endif /* GL_EXT_texture_lod_bias */ #ifdef GL_EXT_texture_mirror_clamp #endif /* GL_EXT_texture_mirror_clamp */ #ifdef GL_EXT_texture_object static GLboolean _glewInit_GL_EXT_texture_object (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glAreTexturesResidentEXT = (PFNGLARETEXTURESRESIDENTEXTPROC)glewGetProcAddress((const GLubyte*)"glAreTexturesResidentEXT")) == NULL) || r; r = ((glBindTextureEXT = (PFNGLBINDTEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glBindTextureEXT")) == NULL) || r; r = ((glDeleteTexturesEXT = (PFNGLDELETETEXTURESEXTPROC)glewGetProcAddress((const GLubyte*)"glDeleteTexturesEXT")) == NULL) || r; r = ((glGenTexturesEXT = (PFNGLGENTEXTURESEXTPROC)glewGetProcAddress((const GLubyte*)"glGenTexturesEXT")) == NULL) || r; r = ((glIsTextureEXT = (PFNGLISTEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glIsTextureEXT")) == NULL) || r; r = ((glPrioritizeTexturesEXT = (PFNGLPRIORITIZETEXTURESEXTPROC)glewGetProcAddress((const GLubyte*)"glPrioritizeTexturesEXT")) == NULL) || r; return r; } #endif /* GL_EXT_texture_object */ #ifdef GL_EXT_texture_perturb_normal static GLboolean _glewInit_GL_EXT_texture_perturb_normal (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glTextureNormalEXT = (PFNGLTEXTURENORMALEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureNormalEXT")) == NULL) || r; return r; } #endif /* GL_EXT_texture_perturb_normal */ #ifdef GL_EXT_texture_rectangle #endif /* GL_EXT_texture_rectangle */ #ifdef GL_EXT_texture_sRGB #endif /* GL_EXT_texture_sRGB */ #ifdef GL_EXT_texture_sRGB_decode #endif /* GL_EXT_texture_sRGB_decode */ #ifdef GL_EXT_texture_shared_exponent #endif /* GL_EXT_texture_shared_exponent */ #ifdef GL_EXT_texture_snorm #endif /* GL_EXT_texture_snorm */ #ifdef GL_EXT_texture_swizzle #endif /* GL_EXT_texture_swizzle */ #ifdef GL_EXT_timer_query static GLboolean _glewInit_GL_EXT_timer_query (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetQueryObjecti64vEXT = (PFNGLGETQUERYOBJECTI64VEXTPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjecti64vEXT")) == NULL) || r; r = ((glGetQueryObjectui64vEXT = (PFNGLGETQUERYOBJECTUI64VEXTPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectui64vEXT")) == NULL) || r; return r; } #endif /* GL_EXT_timer_query */ #ifdef GL_EXT_transform_feedback static GLboolean _glewInit_GL_EXT_transform_feedback (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBeginTransformFeedbackEXT = (PFNGLBEGINTRANSFORMFEEDBACKEXTPROC)glewGetProcAddress((const GLubyte*)"glBeginTransformFeedbackEXT")) == NULL) || r; r = ((glBindBufferBaseEXT = (PFNGLBINDBUFFERBASEEXTPROC)glewGetProcAddress((const GLubyte*)"glBindBufferBaseEXT")) == NULL) || r; r = ((glBindBufferOffsetEXT = (PFNGLBINDBUFFEROFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glBindBufferOffsetEXT")) == NULL) || r; r = ((glBindBufferRangeEXT = (PFNGLBINDBUFFERRANGEEXTPROC)glewGetProcAddress((const GLubyte*)"glBindBufferRangeEXT")) == NULL) || r; r = ((glEndTransformFeedbackEXT = (PFNGLENDTRANSFORMFEEDBACKEXTPROC)glewGetProcAddress((const GLubyte*)"glEndTransformFeedbackEXT")) == NULL) || r; r = ((glGetTransformFeedbackVaryingEXT = (PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTransformFeedbackVaryingEXT")) == NULL) || r; r = ((glTransformFeedbackVaryingsEXT = (PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC)glewGetProcAddress((const GLubyte*)"glTransformFeedbackVaryingsEXT")) == NULL) || r; return r; } #endif /* GL_EXT_transform_feedback */ #ifdef GL_EXT_vertex_array static GLboolean _glewInit_GL_EXT_vertex_array (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glArrayElementEXT = (PFNGLARRAYELEMENTEXTPROC)glewGetProcAddress((const GLubyte*)"glArrayElementEXT")) == NULL) || r; r = ((glColorPointerEXT = (PFNGLCOLORPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glColorPointerEXT")) == NULL) || r; r = ((glDrawArraysEXT = (PFNGLDRAWARRAYSEXTPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysEXT")) == NULL) || r; r = ((glEdgeFlagPointerEXT = (PFNGLEDGEFLAGPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glEdgeFlagPointerEXT")) == NULL) || r; r = ((glIndexPointerEXT = (PFNGLINDEXPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glIndexPointerEXT")) == NULL) || r; r = ((glNormalPointerEXT = (PFNGLNORMALPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glNormalPointerEXT")) == NULL) || r; r = ((glTexCoordPointerEXT = (PFNGLTEXCOORDPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glTexCoordPointerEXT")) == NULL) || r; r = ((glVertexPointerEXT = (PFNGLVERTEXPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glVertexPointerEXT")) == NULL) || r; return r; } #endif /* GL_EXT_vertex_array */ #ifdef GL_EXT_vertex_array_bgra #endif /* GL_EXT_vertex_array_bgra */ #ifdef GL_EXT_vertex_attrib_64bit static GLboolean _glewInit_GL_EXT_vertex_attrib_64bit (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetVertexAttribLdvEXT = (PFNGLGETVERTEXATTRIBLDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribLdvEXT")) == NULL) || r; r = ((glVertexArrayVertexAttribLOffsetEXT = (PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexAttribLOffsetEXT")) == NULL) || r; r = ((glVertexAttribL1dEXT = (PFNGLVERTEXATTRIBL1DEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1dEXT")) == NULL) || r; r = ((glVertexAttribL1dvEXT = (PFNGLVERTEXATTRIBL1DVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1dvEXT")) == NULL) || r; r = ((glVertexAttribL2dEXT = (PFNGLVERTEXATTRIBL2DEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2dEXT")) == NULL) || r; r = ((glVertexAttribL2dvEXT = (PFNGLVERTEXATTRIBL2DVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2dvEXT")) == NULL) || r; r = ((glVertexAttribL3dEXT = (PFNGLVERTEXATTRIBL3DEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3dEXT")) == NULL) || r; r = ((glVertexAttribL3dvEXT = (PFNGLVERTEXATTRIBL3DVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3dvEXT")) == NULL) || r; r = ((glVertexAttribL4dEXT = (PFNGLVERTEXATTRIBL4DEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4dEXT")) == NULL) || r; r = ((glVertexAttribL4dvEXT = (PFNGLVERTEXATTRIBL4DVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4dvEXT")) == NULL) || r; r = ((glVertexAttribLPointerEXT = (PFNGLVERTEXATTRIBLPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribLPointerEXT")) == NULL) || r; return r; } #endif /* GL_EXT_vertex_attrib_64bit */ #ifdef GL_EXT_vertex_shader static GLboolean _glewInit_GL_EXT_vertex_shader (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBeginVertexShaderEXT = (PFNGLBEGINVERTEXSHADEREXTPROC)glewGetProcAddress((const GLubyte*)"glBeginVertexShaderEXT")) == NULL) || r; r = ((glBindLightParameterEXT = (PFNGLBINDLIGHTPARAMETEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindLightParameterEXT")) == NULL) || r; r = ((glBindMaterialParameterEXT = (PFNGLBINDMATERIALPARAMETEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindMaterialParameterEXT")) == NULL) || r; r = ((glBindParameterEXT = (PFNGLBINDPARAMETEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindParameterEXT")) == NULL) || r; r = ((glBindTexGenParameterEXT = (PFNGLBINDTEXGENPARAMETEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindTexGenParameterEXT")) == NULL) || r; r = ((glBindTextureUnitParameterEXT = (PFNGLBINDTEXTUREUNITPARAMETEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindTextureUnitParameterEXT")) == NULL) || r; r = ((glBindVertexShaderEXT = (PFNGLBINDVERTEXSHADEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindVertexShaderEXT")) == NULL) || r; r = ((glDeleteVertexShaderEXT = (PFNGLDELETEVERTEXSHADEREXTPROC)glewGetProcAddress((const GLubyte*)"glDeleteVertexShaderEXT")) == NULL) || r; r = ((glDisableVariantClientStateEXT = (PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC)glewGetProcAddress((const GLubyte*)"glDisableVariantClientStateEXT")) == NULL) || r; r = ((glEnableVariantClientStateEXT = (PFNGLENABLEVARIANTCLIENTSTATEEXTPROC)glewGetProcAddress((const GLubyte*)"glEnableVariantClientStateEXT")) == NULL) || r; r = ((glEndVertexShaderEXT = (PFNGLENDVERTEXSHADEREXTPROC)glewGetProcAddress((const GLubyte*)"glEndVertexShaderEXT")) == NULL) || r; r = ((glExtractComponentEXT = (PFNGLEXTRACTCOMPONENTEXTPROC)glewGetProcAddress((const GLubyte*)"glExtractComponentEXT")) == NULL) || r; r = ((glGenSymbolsEXT = (PFNGLGENSYMBOLSEXTPROC)glewGetProcAddress((const GLubyte*)"glGenSymbolsEXT")) == NULL) || r; r = ((glGenVertexShadersEXT = (PFNGLGENVERTEXSHADERSEXTPROC)glewGetProcAddress((const GLubyte*)"glGenVertexShadersEXT")) == NULL) || r; r = ((glGetInvariantBooleanvEXT = (PFNGLGETINVARIANTBOOLEANVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetInvariantBooleanvEXT")) == NULL) || r; r = ((glGetInvariantFloatvEXT = (PFNGLGETINVARIANTFLOATVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetInvariantFloatvEXT")) == NULL) || r; r = ((glGetInvariantIntegervEXT = (PFNGLGETINVARIANTINTEGERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetInvariantIntegervEXT")) == NULL) || r; r = ((glGetLocalConstantBooleanvEXT = (PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetLocalConstantBooleanvEXT")) == NULL) || r; r = ((glGetLocalConstantFloatvEXT = (PFNGLGETLOCALCONSTANTFLOATVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetLocalConstantFloatvEXT")) == NULL) || r; r = ((glGetLocalConstantIntegervEXT = (PFNGLGETLOCALCONSTANTINTEGERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetLocalConstantIntegervEXT")) == NULL) || r; r = ((glGetVariantBooleanvEXT = (PFNGLGETVARIANTBOOLEANVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVariantBooleanvEXT")) == NULL) || r; r = ((glGetVariantFloatvEXT = (PFNGLGETVARIANTFLOATVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVariantFloatvEXT")) == NULL) || r; r = ((glGetVariantIntegervEXT = (PFNGLGETVARIANTINTEGERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVariantIntegervEXT")) == NULL) || r; r = ((glGetVariantPointervEXT = (PFNGLGETVARIANTPOINTERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVariantPointervEXT")) == NULL) || r; r = ((glInsertComponentEXT = (PFNGLINSERTCOMPONENTEXTPROC)glewGetProcAddress((const GLubyte*)"glInsertComponentEXT")) == NULL) || r; r = ((glIsVariantEnabledEXT = (PFNGLISVARIANTENABLEDEXTPROC)glewGetProcAddress((const GLubyte*)"glIsVariantEnabledEXT")) == NULL) || r; r = ((glSetInvariantEXT = (PFNGLSETINVARIANTEXTPROC)glewGetProcAddress((const GLubyte*)"glSetInvariantEXT")) == NULL) || r; r = ((glSetLocalConstantEXT = (PFNGLSETLOCALCONSTANTEXTPROC)glewGetProcAddress((const GLubyte*)"glSetLocalConstantEXT")) == NULL) || r; r = ((glShaderOp1EXT = (PFNGLSHADEROP1EXTPROC)glewGetProcAddress((const GLubyte*)"glShaderOp1EXT")) == NULL) || r; r = ((glShaderOp2EXT = (PFNGLSHADEROP2EXTPROC)glewGetProcAddress((const GLubyte*)"glShaderOp2EXT")) == NULL) || r; r = ((glShaderOp3EXT = (PFNGLSHADEROP3EXTPROC)glewGetProcAddress((const GLubyte*)"glShaderOp3EXT")) == NULL) || r; r = ((glSwizzleEXT = (PFNGLSWIZZLEEXTPROC)glewGetProcAddress((const GLubyte*)"glSwizzleEXT")) == NULL) || r; r = ((glVariantPointerEXT = (PFNGLVARIANTPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glVariantPointerEXT")) == NULL) || r; r = ((glVariantbvEXT = (PFNGLVARIANTBVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantbvEXT")) == NULL) || r; r = ((glVariantdvEXT = (PFNGLVARIANTDVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantdvEXT")) == NULL) || r; r = ((glVariantfvEXT = (PFNGLVARIANTFVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantfvEXT")) == NULL) || r; r = ((glVariantivEXT = (PFNGLVARIANTIVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantivEXT")) == NULL) || r; r = ((glVariantsvEXT = (PFNGLVARIANTSVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantsvEXT")) == NULL) || r; r = ((glVariantubvEXT = (PFNGLVARIANTUBVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantubvEXT")) == NULL) || r; r = ((glVariantuivEXT = (PFNGLVARIANTUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantuivEXT")) == NULL) || r; r = ((glVariantusvEXT = (PFNGLVARIANTUSVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantusvEXT")) == NULL) || r; r = ((glWriteMaskEXT = (PFNGLWRITEMASKEXTPROC)glewGetProcAddress((const GLubyte*)"glWriteMaskEXT")) == NULL) || r; return r; } #endif /* GL_EXT_vertex_shader */ #ifdef GL_EXT_vertex_weighting static GLboolean _glewInit_GL_EXT_vertex_weighting (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glVertexWeightPointerEXT = (PFNGLVERTEXWEIGHTPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glVertexWeightPointerEXT")) == NULL) || r; r = ((glVertexWeightfEXT = (PFNGLVERTEXWEIGHTFEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexWeightfEXT")) == NULL) || r; r = ((glVertexWeightfvEXT = (PFNGLVERTEXWEIGHTFVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexWeightfvEXT")) == NULL) || r; return r; } #endif /* GL_EXT_vertex_weighting */ #ifdef GL_EXT_x11_sync_object static GLboolean _glewInit_GL_EXT_x11_sync_object (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glImportSyncEXT = (PFNGLIMPORTSYNCEXTPROC)glewGetProcAddress((const GLubyte*)"glImportSyncEXT")) == NULL) || r; return r; } #endif /* GL_EXT_x11_sync_object */ #ifdef GL_GREMEDY_frame_terminator static GLboolean _glewInit_GL_GREMEDY_frame_terminator (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glFrameTerminatorGREMEDY = (PFNGLFRAMETERMINATORGREMEDYPROC)glewGetProcAddress((const GLubyte*)"glFrameTerminatorGREMEDY")) == NULL) || r; return r; } #endif /* GL_GREMEDY_frame_terminator */ #ifdef GL_GREMEDY_string_marker static GLboolean _glewInit_GL_GREMEDY_string_marker (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glStringMarkerGREMEDY = (PFNGLSTRINGMARKERGREMEDYPROC)glewGetProcAddress((const GLubyte*)"glStringMarkerGREMEDY")) == NULL) || r; return r; } #endif /* GL_GREMEDY_string_marker */ #ifdef GL_HP_convolution_border_modes #endif /* GL_HP_convolution_border_modes */ #ifdef GL_HP_image_transform static GLboolean _glewInit_GL_HP_image_transform (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetImageTransformParameterfvHP = (PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC)glewGetProcAddress((const GLubyte*)"glGetImageTransformParameterfvHP")) == NULL) || r; r = ((glGetImageTransformParameterivHP = (PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC)glewGetProcAddress((const GLubyte*)"glGetImageTransformParameterivHP")) == NULL) || r; r = ((glImageTransformParameterfHP = (PFNGLIMAGETRANSFORMPARAMETERFHPPROC)glewGetProcAddress((const GLubyte*)"glImageTransformParameterfHP")) == NULL) || r; r = ((glImageTransformParameterfvHP = (PFNGLIMAGETRANSFORMPARAMETERFVHPPROC)glewGetProcAddress((const GLubyte*)"glImageTransformParameterfvHP")) == NULL) || r; r = ((glImageTransformParameteriHP = (PFNGLIMAGETRANSFORMPARAMETERIHPPROC)glewGetProcAddress((const GLubyte*)"glImageTransformParameteriHP")) == NULL) || r; r = ((glImageTransformParameterivHP = (PFNGLIMAGETRANSFORMPARAMETERIVHPPROC)glewGetProcAddress((const GLubyte*)"glImageTransformParameterivHP")) == NULL) || r; return r; } #endif /* GL_HP_image_transform */ #ifdef GL_HP_occlusion_test #endif /* GL_HP_occlusion_test */ #ifdef GL_HP_texture_lighting #endif /* GL_HP_texture_lighting */ #ifdef GL_IBM_cull_vertex #endif /* GL_IBM_cull_vertex */ #ifdef GL_IBM_multimode_draw_arrays static GLboolean _glewInit_GL_IBM_multimode_draw_arrays (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glMultiModeDrawArraysIBM = (PFNGLMULTIMODEDRAWARRAYSIBMPROC)glewGetProcAddress((const GLubyte*)"glMultiModeDrawArraysIBM")) == NULL) || r; r = ((glMultiModeDrawElementsIBM = (PFNGLMULTIMODEDRAWELEMENTSIBMPROC)glewGetProcAddress((const GLubyte*)"glMultiModeDrawElementsIBM")) == NULL) || r; return r; } #endif /* GL_IBM_multimode_draw_arrays */ #ifdef GL_IBM_rasterpos_clip #endif /* GL_IBM_rasterpos_clip */ #ifdef GL_IBM_static_data #endif /* GL_IBM_static_data */ #ifdef GL_IBM_texture_mirrored_repeat #endif /* GL_IBM_texture_mirrored_repeat */ #ifdef GL_IBM_vertex_array_lists static GLboolean _glewInit_GL_IBM_vertex_array_lists (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glColorPointerListIBM = (PFNGLCOLORPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glColorPointerListIBM")) == NULL) || r; r = ((glEdgeFlagPointerListIBM = (PFNGLEDGEFLAGPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glEdgeFlagPointerListIBM")) == NULL) || r; r = ((glFogCoordPointerListIBM = (PFNGLFOGCOORDPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glFogCoordPointerListIBM")) == NULL) || r; r = ((glIndexPointerListIBM = (PFNGLINDEXPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glIndexPointerListIBM")) == NULL) || r; r = ((glNormalPointerListIBM = (PFNGLNORMALPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glNormalPointerListIBM")) == NULL) || r; r = ((glSecondaryColorPointerListIBM = (PFNGLSECONDARYCOLORPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColorPointerListIBM")) == NULL) || r; r = ((glTexCoordPointerListIBM = (PFNGLTEXCOORDPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glTexCoordPointerListIBM")) == NULL) || r; r = ((glVertexPointerListIBM = (PFNGLVERTEXPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glVertexPointerListIBM")) == NULL) || r; return r; } #endif /* GL_IBM_vertex_array_lists */ #ifdef GL_INGR_color_clamp #endif /* GL_INGR_color_clamp */ #ifdef GL_INGR_interlace_read #endif /* GL_INGR_interlace_read */ #ifdef GL_INTEL_parallel_arrays static GLboolean _glewInit_GL_INTEL_parallel_arrays (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glColorPointervINTEL = (PFNGLCOLORPOINTERVINTELPROC)glewGetProcAddress((const GLubyte*)"glColorPointervINTEL")) == NULL) || r; r = ((glNormalPointervINTEL = (PFNGLNORMALPOINTERVINTELPROC)glewGetProcAddress((const GLubyte*)"glNormalPointervINTEL")) == NULL) || r; r = ((glTexCoordPointervINTEL = (PFNGLTEXCOORDPOINTERVINTELPROC)glewGetProcAddress((const GLubyte*)"glTexCoordPointervINTEL")) == NULL) || r; r = ((glVertexPointervINTEL = (PFNGLVERTEXPOINTERVINTELPROC)glewGetProcAddress((const GLubyte*)"glVertexPointervINTEL")) == NULL) || r; return r; } #endif /* GL_INTEL_parallel_arrays */ #ifdef GL_INTEL_texture_scissor static GLboolean _glewInit_GL_INTEL_texture_scissor (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glTexScissorFuncINTEL = (PFNGLTEXSCISSORFUNCINTELPROC)glewGetProcAddress((const GLubyte*)"glTexScissorFuncINTEL")) == NULL) || r; r = ((glTexScissorINTEL = (PFNGLTEXSCISSORINTELPROC)glewGetProcAddress((const GLubyte*)"glTexScissorINTEL")) == NULL) || r; return r; } #endif /* GL_INTEL_texture_scissor */ #ifdef GL_KHR_debug static GLboolean _glewInit_GL_KHR_debug (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDebugMessageCallback = (PFNGLDEBUGMESSAGECALLBACKPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageCallback")) == NULL) || r; r = ((glDebugMessageControl = (PFNGLDEBUGMESSAGECONTROLPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageControl")) == NULL) || r; r = ((glDebugMessageInsert = (PFNGLDEBUGMESSAGEINSERTPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageInsert")) == NULL) || r; r = ((glGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGPROC)glewGetProcAddress((const GLubyte*)"glGetDebugMessageLog")) == NULL) || r; r = ((glGetObjectLabel = (PFNGLGETOBJECTLABELPROC)glewGetProcAddress((const GLubyte*)"glGetObjectLabel")) == NULL) || r; r = ((glGetObjectPtrLabel = (PFNGLGETOBJECTPTRLABELPROC)glewGetProcAddress((const GLubyte*)"glGetObjectPtrLabel")) == NULL) || r; r = ((glGetPointerv = (PFNGLGETPOINTERVPROC)glewGetProcAddress((const GLubyte*)"glGetPointerv")) == NULL) || r; r = ((glObjectLabel = (PFNGLOBJECTLABELPROC)glewGetProcAddress((const GLubyte*)"glObjectLabel")) == NULL) || r; r = ((glObjectPtrLabel = (PFNGLOBJECTPTRLABELPROC)glewGetProcAddress((const GLubyte*)"glObjectPtrLabel")) == NULL) || r; r = ((glPushDebugGroup = (PFNGLPUSHDEBUGGROUPPROC)glewGetProcAddress((const GLubyte*)"glPushDebugGroup")) == NULL) || r; return r; } #endif /* GL_KHR_debug */ #ifdef GL_KHR_texture_compression_astc_ldr #endif /* GL_KHR_texture_compression_astc_ldr */ #ifdef GL_KTX_buffer_region static GLboolean _glewInit_GL_KTX_buffer_region (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBufferRegionEnabled = (PFNGLBUFFERREGIONENABLEDPROC)glewGetProcAddress((const GLubyte*)"glBufferRegionEnabled")) == NULL) || r; r = ((glDeleteBufferRegion = (PFNGLDELETEBUFFERREGIONPROC)glewGetProcAddress((const GLubyte*)"glDeleteBufferRegion")) == NULL) || r; r = ((glDrawBufferRegion = (PFNGLDRAWBUFFERREGIONPROC)glewGetProcAddress((const GLubyte*)"glDrawBufferRegion")) == NULL) || r; r = ((glNewBufferRegion = (PFNGLNEWBUFFERREGIONPROC)glewGetProcAddress((const GLubyte*)"glNewBufferRegion")) == NULL) || r; r = ((glReadBufferRegion = (PFNGLREADBUFFERREGIONPROC)glewGetProcAddress((const GLubyte*)"glReadBufferRegion")) == NULL) || r; return r; } #endif /* GL_KTX_buffer_region */ #ifdef GL_MESAX_texture_stack #endif /* GL_MESAX_texture_stack */ #ifdef GL_MESA_pack_invert #endif /* GL_MESA_pack_invert */ #ifdef GL_MESA_resize_buffers static GLboolean _glewInit_GL_MESA_resize_buffers (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glResizeBuffersMESA = (PFNGLRESIZEBUFFERSMESAPROC)glewGetProcAddress((const GLubyte*)"glResizeBuffersMESA")) == NULL) || r; return r; } #endif /* GL_MESA_resize_buffers */ #ifdef GL_MESA_window_pos static GLboolean _glewInit_GL_MESA_window_pos (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glWindowPos2dMESA = (PFNGLWINDOWPOS2DMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2dMESA")) == NULL) || r; r = ((glWindowPos2dvMESA = (PFNGLWINDOWPOS2DVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2dvMESA")) == NULL) || r; r = ((glWindowPos2fMESA = (PFNGLWINDOWPOS2FMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2fMESA")) == NULL) || r; r = ((glWindowPos2fvMESA = (PFNGLWINDOWPOS2FVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2fvMESA")) == NULL) || r; r = ((glWindowPos2iMESA = (PFNGLWINDOWPOS2IMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2iMESA")) == NULL) || r; r = ((glWindowPos2ivMESA = (PFNGLWINDOWPOS2IVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2ivMESA")) == NULL) || r; r = ((glWindowPos2sMESA = (PFNGLWINDOWPOS2SMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2sMESA")) == NULL) || r; r = ((glWindowPos2svMESA = (PFNGLWINDOWPOS2SVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2svMESA")) == NULL) || r; r = ((glWindowPos3dMESA = (PFNGLWINDOWPOS3DMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3dMESA")) == NULL) || r; r = ((glWindowPos3dvMESA = (PFNGLWINDOWPOS3DVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3dvMESA")) == NULL) || r; r = ((glWindowPos3fMESA = (PFNGLWINDOWPOS3FMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3fMESA")) == NULL) || r; r = ((glWindowPos3fvMESA = (PFNGLWINDOWPOS3FVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3fvMESA")) == NULL) || r; r = ((glWindowPos3iMESA = (PFNGLWINDOWPOS3IMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3iMESA")) == NULL) || r; r = ((glWindowPos3ivMESA = (PFNGLWINDOWPOS3IVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3ivMESA")) == NULL) || r; r = ((glWindowPos3sMESA = (PFNGLWINDOWPOS3SMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3sMESA")) == NULL) || r; r = ((glWindowPos3svMESA = (PFNGLWINDOWPOS3SVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3svMESA")) == NULL) || r; r = ((glWindowPos4dMESA = (PFNGLWINDOWPOS4DMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4dMESA")) == NULL) || r; r = ((glWindowPos4dvMESA = (PFNGLWINDOWPOS4DVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4dvMESA")) == NULL) || r; r = ((glWindowPos4fMESA = (PFNGLWINDOWPOS4FMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4fMESA")) == NULL) || r; r = ((glWindowPos4fvMESA = (PFNGLWINDOWPOS4FVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4fvMESA")) == NULL) || r; r = ((glWindowPos4iMESA = (PFNGLWINDOWPOS4IMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4iMESA")) == NULL) || r; r = ((glWindowPos4ivMESA = (PFNGLWINDOWPOS4IVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4ivMESA")) == NULL) || r; r = ((glWindowPos4sMESA = (PFNGLWINDOWPOS4SMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4sMESA")) == NULL) || r; r = ((glWindowPos4svMESA = (PFNGLWINDOWPOS4SVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4svMESA")) == NULL) || r; return r; } #endif /* GL_MESA_window_pos */ #ifdef GL_MESA_ycbcr_texture #endif /* GL_MESA_ycbcr_texture */ #ifdef GL_NVX_gpu_memory_info #endif /* GL_NVX_gpu_memory_info */ #ifdef GL_NV_bindless_texture static GLboolean _glewInit_GL_NV_bindless_texture (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetImageHandleNV = (PFNGLGETIMAGEHANDLENVPROC)glewGetProcAddress((const GLubyte*)"glGetImageHandleNV")) == NULL) || r; r = ((glGetTextureHandleNV = (PFNGLGETTEXTUREHANDLENVPROC)glewGetProcAddress((const GLubyte*)"glGetTextureHandleNV")) == NULL) || r; r = ((glGetTextureSamplerHandleNV = (PFNGLGETTEXTURESAMPLERHANDLENVPROC)glewGetProcAddress((const GLubyte*)"glGetTextureSamplerHandleNV")) == NULL) || r; r = ((glIsImageHandleResidentNV = (PFNGLISIMAGEHANDLERESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glIsImageHandleResidentNV")) == NULL) || r; r = ((glIsTextureHandleResidentNV = (PFNGLISTEXTUREHANDLERESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glIsTextureHandleResidentNV")) == NULL) || r; r = ((glMakeImageHandleNonResidentNV = (PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeImageHandleNonResidentNV")) == NULL) || r; r = ((glMakeImageHandleResidentNV = (PFNGLMAKEIMAGEHANDLERESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeImageHandleResidentNV")) == NULL) || r; r = ((glMakeTextureHandleNonResidentNV = (PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeTextureHandleNonResidentNV")) == NULL) || r; r = ((glMakeTextureHandleResidentNV = (PFNGLMAKETEXTUREHANDLERESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeTextureHandleResidentNV")) == NULL) || r; r = ((glProgramUniformHandleui64NV = (PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformHandleui64NV")) == NULL) || r; r = ((glProgramUniformHandleui64vNV = (PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformHandleui64vNV")) == NULL) || r; r = ((glUniformHandleui64NV = (PFNGLUNIFORMHANDLEUI64NVPROC)glewGetProcAddress((const GLubyte*)"glUniformHandleui64NV")) == NULL) || r; r = ((glUniformHandleui64vNV = (PFNGLUNIFORMHANDLEUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniformHandleui64vNV")) == NULL) || r; return r; } #endif /* GL_NV_bindless_texture */ #ifdef GL_NV_blend_square #endif /* GL_NV_blend_square */ #ifdef GL_NV_conditional_render static GLboolean _glewInit_GL_NV_conditional_render (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBeginConditionalRenderNV = (PFNGLBEGINCONDITIONALRENDERNVPROC)glewGetProcAddress((const GLubyte*)"glBeginConditionalRenderNV")) == NULL) || r; r = ((glEndConditionalRenderNV = (PFNGLENDCONDITIONALRENDERNVPROC)glewGetProcAddress((const GLubyte*)"glEndConditionalRenderNV")) == NULL) || r; return r; } #endif /* GL_NV_conditional_render */ #ifdef GL_NV_copy_depth_to_color #endif /* GL_NV_copy_depth_to_color */ #ifdef GL_NV_copy_image static GLboolean _glewInit_GL_NV_copy_image (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glCopyImageSubDataNV = (PFNGLCOPYIMAGESUBDATANVPROC)glewGetProcAddress((const GLubyte*)"glCopyImageSubDataNV")) == NULL) || r; return r; } #endif /* GL_NV_copy_image */ #ifdef GL_NV_depth_buffer_float static GLboolean _glewInit_GL_NV_depth_buffer_float (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glClearDepthdNV = (PFNGLCLEARDEPTHDNVPROC)glewGetProcAddress((const GLubyte*)"glClearDepthdNV")) == NULL) || r; r = ((glDepthBoundsdNV = (PFNGLDEPTHBOUNDSDNVPROC)glewGetProcAddress((const GLubyte*)"glDepthBoundsdNV")) == NULL) || r; r = ((glDepthRangedNV = (PFNGLDEPTHRANGEDNVPROC)glewGetProcAddress((const GLubyte*)"glDepthRangedNV")) == NULL) || r; return r; } #endif /* GL_NV_depth_buffer_float */ #ifdef GL_NV_depth_clamp #endif /* GL_NV_depth_clamp */ #ifdef GL_NV_depth_range_unclamped #endif /* GL_NV_depth_range_unclamped */ #ifdef GL_NV_evaluators static GLboolean _glewInit_GL_NV_evaluators (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glEvalMapsNV = (PFNGLEVALMAPSNVPROC)glewGetProcAddress((const GLubyte*)"glEvalMapsNV")) == NULL) || r; r = ((glGetMapAttribParameterfvNV = (PFNGLGETMAPATTRIBPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetMapAttribParameterfvNV")) == NULL) || r; r = ((glGetMapAttribParameterivNV = (PFNGLGETMAPATTRIBPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetMapAttribParameterivNV")) == NULL) || r; r = ((glGetMapControlPointsNV = (PFNGLGETMAPCONTROLPOINTSNVPROC)glewGetProcAddress((const GLubyte*)"glGetMapControlPointsNV")) == NULL) || r; r = ((glGetMapParameterfvNV = (PFNGLGETMAPPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetMapParameterfvNV")) == NULL) || r; r = ((glGetMapParameterivNV = (PFNGLGETMAPPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetMapParameterivNV")) == NULL) || r; r = ((glMapControlPointsNV = (PFNGLMAPCONTROLPOINTSNVPROC)glewGetProcAddress((const GLubyte*)"glMapControlPointsNV")) == NULL) || r; r = ((glMapParameterfvNV = (PFNGLMAPPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glMapParameterfvNV")) == NULL) || r; r = ((glMapParameterivNV = (PFNGLMAPPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glMapParameterivNV")) == NULL) || r; return r; } #endif /* GL_NV_evaluators */ #ifdef GL_NV_explicit_multisample static GLboolean _glewInit_GL_NV_explicit_multisample (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetMultisamplefvNV = (PFNGLGETMULTISAMPLEFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetMultisamplefvNV")) == NULL) || r; r = ((glSampleMaskIndexedNV = (PFNGLSAMPLEMASKINDEXEDNVPROC)glewGetProcAddress((const GLubyte*)"glSampleMaskIndexedNV")) == NULL) || r; r = ((glTexRenderbufferNV = (PFNGLTEXRENDERBUFFERNVPROC)glewGetProcAddress((const GLubyte*)"glTexRenderbufferNV")) == NULL) || r; return r; } #endif /* GL_NV_explicit_multisample */ #ifdef GL_NV_fence static GLboolean _glewInit_GL_NV_fence (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDeleteFencesNV = (PFNGLDELETEFENCESNVPROC)glewGetProcAddress((const GLubyte*)"glDeleteFencesNV")) == NULL) || r; r = ((glFinishFenceNV = (PFNGLFINISHFENCENVPROC)glewGetProcAddress((const GLubyte*)"glFinishFenceNV")) == NULL) || r; r = ((glGenFencesNV = (PFNGLGENFENCESNVPROC)glewGetProcAddress((const GLubyte*)"glGenFencesNV")) == NULL) || r; r = ((glGetFenceivNV = (PFNGLGETFENCEIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetFenceivNV")) == NULL) || r; r = ((glIsFenceNV = (PFNGLISFENCENVPROC)glewGetProcAddress((const GLubyte*)"glIsFenceNV")) == NULL) || r; r = ((glSetFenceNV = (PFNGLSETFENCENVPROC)glewGetProcAddress((const GLubyte*)"glSetFenceNV")) == NULL) || r; r = ((glTestFenceNV = (PFNGLTESTFENCENVPROC)glewGetProcAddress((const GLubyte*)"glTestFenceNV")) == NULL) || r; return r; } #endif /* GL_NV_fence */ #ifdef GL_NV_float_buffer #endif /* GL_NV_float_buffer */ #ifdef GL_NV_fog_distance #endif /* GL_NV_fog_distance */ #ifdef GL_NV_fragment_program static GLboolean _glewInit_GL_NV_fragment_program (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetProgramNamedParameterdvNV = (PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramNamedParameterdvNV")) == NULL) || r; r = ((glGetProgramNamedParameterfvNV = (PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramNamedParameterfvNV")) == NULL) || r; r = ((glProgramNamedParameter4dNV = (PFNGLPROGRAMNAMEDPARAMETER4DNVPROC)glewGetProcAddress((const GLubyte*)"glProgramNamedParameter4dNV")) == NULL) || r; r = ((glProgramNamedParameter4dvNV = (PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramNamedParameter4dvNV")) == NULL) || r; r = ((glProgramNamedParameter4fNV = (PFNGLPROGRAMNAMEDPARAMETER4FNVPROC)glewGetProcAddress((const GLubyte*)"glProgramNamedParameter4fNV")) == NULL) || r; r = ((glProgramNamedParameter4fvNV = (PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramNamedParameter4fvNV")) == NULL) || r; return r; } #endif /* GL_NV_fragment_program */ #ifdef GL_NV_fragment_program2 #endif /* GL_NV_fragment_program2 */ #ifdef GL_NV_fragment_program4 #endif /* GL_NV_fragment_program4 */ #ifdef GL_NV_fragment_program_option #endif /* GL_NV_fragment_program_option */ #ifdef GL_NV_framebuffer_multisample_coverage static GLboolean _glewInit_GL_NV_framebuffer_multisample_coverage (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glRenderbufferStorageMultisampleCoverageNV = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC)glewGetProcAddress((const GLubyte*)"glRenderbufferStorageMultisampleCoverageNV")) == NULL) || r; return r; } #endif /* GL_NV_framebuffer_multisample_coverage */ #ifdef GL_NV_geometry_program4 static GLboolean _glewInit_GL_NV_geometry_program4 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glProgramVertexLimitNV = (PFNGLPROGRAMVERTEXLIMITNVPROC)glewGetProcAddress((const GLubyte*)"glProgramVertexLimitNV")) == NULL) || r; return r; } #endif /* GL_NV_geometry_program4 */ #ifdef GL_NV_geometry_shader4 #endif /* GL_NV_geometry_shader4 */ #ifdef GL_NV_gpu_program4 static GLboolean _glewInit_GL_NV_gpu_program4 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glProgramEnvParameterI4iNV = (PFNGLPROGRAMENVPARAMETERI4INVPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameterI4iNV")) == NULL) || r; r = ((glProgramEnvParameterI4ivNV = (PFNGLPROGRAMENVPARAMETERI4IVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameterI4ivNV")) == NULL) || r; r = ((glProgramEnvParameterI4uiNV = (PFNGLPROGRAMENVPARAMETERI4UINVPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameterI4uiNV")) == NULL) || r; r = ((glProgramEnvParameterI4uivNV = (PFNGLPROGRAMENVPARAMETERI4UIVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameterI4uivNV")) == NULL) || r; r = ((glProgramEnvParametersI4ivNV = (PFNGLPROGRAMENVPARAMETERSI4IVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParametersI4ivNV")) == NULL) || r; r = ((glProgramEnvParametersI4uivNV = (PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParametersI4uivNV")) == NULL) || r; r = ((glProgramLocalParameterI4iNV = (PFNGLPROGRAMLOCALPARAMETERI4INVPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameterI4iNV")) == NULL) || r; r = ((glProgramLocalParameterI4ivNV = (PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameterI4ivNV")) == NULL) || r; r = ((glProgramLocalParameterI4uiNV = (PFNGLPROGRAMLOCALPARAMETERI4UINVPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameterI4uiNV")) == NULL) || r; r = ((glProgramLocalParameterI4uivNV = (PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameterI4uivNV")) == NULL) || r; r = ((glProgramLocalParametersI4ivNV = (PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParametersI4ivNV")) == NULL) || r; r = ((glProgramLocalParametersI4uivNV = (PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParametersI4uivNV")) == NULL) || r; return r; } #endif /* GL_NV_gpu_program4 */ #ifdef GL_NV_gpu_program5 #endif /* GL_NV_gpu_program5 */ #ifdef GL_NV_gpu_program_fp64 #endif /* GL_NV_gpu_program_fp64 */ #ifdef GL_NV_gpu_shader5 static GLboolean _glewInit_GL_NV_gpu_shader5 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetUniformi64vNV = (PFNGLGETUNIFORMI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformi64vNV")) == NULL) || r; r = ((glGetUniformui64vNV = (PFNGLGETUNIFORMUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformui64vNV")) == NULL) || r; r = ((glProgramUniform1i64NV = (PFNGLPROGRAMUNIFORM1I64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1i64NV")) == NULL) || r; r = ((glProgramUniform1i64vNV = (PFNGLPROGRAMUNIFORM1I64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1i64vNV")) == NULL) || r; r = ((glProgramUniform1ui64NV = (PFNGLPROGRAMUNIFORM1UI64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1ui64NV")) == NULL) || r; r = ((glProgramUniform1ui64vNV = (PFNGLPROGRAMUNIFORM1UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1ui64vNV")) == NULL) || r; r = ((glProgramUniform2i64NV = (PFNGLPROGRAMUNIFORM2I64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2i64NV")) == NULL) || r; r = ((glProgramUniform2i64vNV = (PFNGLPROGRAMUNIFORM2I64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2i64vNV")) == NULL) || r; r = ((glProgramUniform2ui64NV = (PFNGLPROGRAMUNIFORM2UI64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2ui64NV")) == NULL) || r; r = ((glProgramUniform2ui64vNV = (PFNGLPROGRAMUNIFORM2UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2ui64vNV")) == NULL) || r; r = ((glProgramUniform3i64NV = (PFNGLPROGRAMUNIFORM3I64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3i64NV")) == NULL) || r; r = ((glProgramUniform3i64vNV = (PFNGLPROGRAMUNIFORM3I64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3i64vNV")) == NULL) || r; r = ((glProgramUniform3ui64NV = (PFNGLPROGRAMUNIFORM3UI64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3ui64NV")) == NULL) || r; r = ((glProgramUniform3ui64vNV = (PFNGLPROGRAMUNIFORM3UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3ui64vNV")) == NULL) || r; r = ((glProgramUniform4i64NV = (PFNGLPROGRAMUNIFORM4I64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4i64NV")) == NULL) || r; r = ((glProgramUniform4i64vNV = (PFNGLPROGRAMUNIFORM4I64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4i64vNV")) == NULL) || r; r = ((glProgramUniform4ui64NV = (PFNGLPROGRAMUNIFORM4UI64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4ui64NV")) == NULL) || r; r = ((glProgramUniform4ui64vNV = (PFNGLPROGRAMUNIFORM4UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4ui64vNV")) == NULL) || r; r = ((glUniform1i64NV = (PFNGLUNIFORM1I64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform1i64NV")) == NULL) || r; r = ((glUniform1i64vNV = (PFNGLUNIFORM1I64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform1i64vNV")) == NULL) || r; r = ((glUniform1ui64NV = (PFNGLUNIFORM1UI64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform1ui64NV")) == NULL) || r; r = ((glUniform1ui64vNV = (PFNGLUNIFORM1UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform1ui64vNV")) == NULL) || r; r = ((glUniform2i64NV = (PFNGLUNIFORM2I64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform2i64NV")) == NULL) || r; r = ((glUniform2i64vNV = (PFNGLUNIFORM2I64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform2i64vNV")) == NULL) || r; r = ((glUniform2ui64NV = (PFNGLUNIFORM2UI64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform2ui64NV")) == NULL) || r; r = ((glUniform2ui64vNV = (PFNGLUNIFORM2UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform2ui64vNV")) == NULL) || r; r = ((glUniform3i64NV = (PFNGLUNIFORM3I64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform3i64NV")) == NULL) || r; r = ((glUniform3i64vNV = (PFNGLUNIFORM3I64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform3i64vNV")) == NULL) || r; r = ((glUniform3ui64NV = (PFNGLUNIFORM3UI64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform3ui64NV")) == NULL) || r; r = ((glUniform3ui64vNV = (PFNGLUNIFORM3UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform3ui64vNV")) == NULL) || r; r = ((glUniform4i64NV = (PFNGLUNIFORM4I64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform4i64NV")) == NULL) || r; r = ((glUniform4i64vNV = (PFNGLUNIFORM4I64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform4i64vNV")) == NULL) || r; r = ((glUniform4ui64NV = (PFNGLUNIFORM4UI64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform4ui64NV")) == NULL) || r; r = ((glUniform4ui64vNV = (PFNGLUNIFORM4UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform4ui64vNV")) == NULL) || r; return r; } #endif /* GL_NV_gpu_shader5 */ #ifdef GL_NV_half_float static GLboolean _glewInit_GL_NV_half_float (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glColor3hNV = (PFNGLCOLOR3HNVPROC)glewGetProcAddress((const GLubyte*)"glColor3hNV")) == NULL) || r; r = ((glColor3hvNV = (PFNGLCOLOR3HVNVPROC)glewGetProcAddress((const GLubyte*)"glColor3hvNV")) == NULL) || r; r = ((glColor4hNV = (PFNGLCOLOR4HNVPROC)glewGetProcAddress((const GLubyte*)"glColor4hNV")) == NULL) || r; r = ((glColor4hvNV = (PFNGLCOLOR4HVNVPROC)glewGetProcAddress((const GLubyte*)"glColor4hvNV")) == NULL) || r; r = ((glFogCoordhNV = (PFNGLFOGCOORDHNVPROC)glewGetProcAddress((const GLubyte*)"glFogCoordhNV")) == NULL) || r; r = ((glFogCoordhvNV = (PFNGLFOGCOORDHVNVPROC)glewGetProcAddress((const GLubyte*)"glFogCoordhvNV")) == NULL) || r; r = ((glMultiTexCoord1hNV = (PFNGLMULTITEXCOORD1HNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1hNV")) == NULL) || r; r = ((glMultiTexCoord1hvNV = (PFNGLMULTITEXCOORD1HVNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1hvNV")) == NULL) || r; r = ((glMultiTexCoord2hNV = (PFNGLMULTITEXCOORD2HNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2hNV")) == NULL) || r; r = ((glMultiTexCoord2hvNV = (PFNGLMULTITEXCOORD2HVNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2hvNV")) == NULL) || r; r = ((glMultiTexCoord3hNV = (PFNGLMULTITEXCOORD3HNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3hNV")) == NULL) || r; r = ((glMultiTexCoord3hvNV = (PFNGLMULTITEXCOORD3HVNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3hvNV")) == NULL) || r; r = ((glMultiTexCoord4hNV = (PFNGLMULTITEXCOORD4HNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4hNV")) == NULL) || r; r = ((glMultiTexCoord4hvNV = (PFNGLMULTITEXCOORD4HVNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4hvNV")) == NULL) || r; r = ((glNormal3hNV = (PFNGLNORMAL3HNVPROC)glewGetProcAddress((const GLubyte*)"glNormal3hNV")) == NULL) || r; r = ((glNormal3hvNV = (PFNGLNORMAL3HVNVPROC)glewGetProcAddress((const GLubyte*)"glNormal3hvNV")) == NULL) || r; r = ((glSecondaryColor3hNV = (PFNGLSECONDARYCOLOR3HNVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3hNV")) == NULL) || r; r = ((glSecondaryColor3hvNV = (PFNGLSECONDARYCOLOR3HVNVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3hvNV")) == NULL) || r; r = ((glTexCoord1hNV = (PFNGLTEXCOORD1HNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord1hNV")) == NULL) || r; r = ((glTexCoord1hvNV = (PFNGLTEXCOORD1HVNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord1hvNV")) == NULL) || r; r = ((glTexCoord2hNV = (PFNGLTEXCOORD2HNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2hNV")) == NULL) || r; r = ((glTexCoord2hvNV = (PFNGLTEXCOORD2HVNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2hvNV")) == NULL) || r; r = ((glTexCoord3hNV = (PFNGLTEXCOORD3HNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord3hNV")) == NULL) || r; r = ((glTexCoord3hvNV = (PFNGLTEXCOORD3HVNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord3hvNV")) == NULL) || r; r = ((glTexCoord4hNV = (PFNGLTEXCOORD4HNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4hNV")) == NULL) || r; r = ((glTexCoord4hvNV = (PFNGLTEXCOORD4HVNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4hvNV")) == NULL) || r; r = ((glVertex2hNV = (PFNGLVERTEX2HNVPROC)glewGetProcAddress((const GLubyte*)"glVertex2hNV")) == NULL) || r; r = ((glVertex2hvNV = (PFNGLVERTEX2HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertex2hvNV")) == NULL) || r; r = ((glVertex3hNV = (PFNGLVERTEX3HNVPROC)glewGetProcAddress((const GLubyte*)"glVertex3hNV")) == NULL) || r; r = ((glVertex3hvNV = (PFNGLVERTEX3HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertex3hvNV")) == NULL) || r; r = ((glVertex4hNV = (PFNGLVERTEX4HNVPROC)glewGetProcAddress((const GLubyte*)"glVertex4hNV")) == NULL) || r; r = ((glVertex4hvNV = (PFNGLVERTEX4HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertex4hvNV")) == NULL) || r; r = ((glVertexAttrib1hNV = (PFNGLVERTEXATTRIB1HNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1hNV")) == NULL) || r; r = ((glVertexAttrib1hvNV = (PFNGLVERTEXATTRIB1HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1hvNV")) == NULL) || r; r = ((glVertexAttrib2hNV = (PFNGLVERTEXATTRIB2HNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2hNV")) == NULL) || r; r = ((glVertexAttrib2hvNV = (PFNGLVERTEXATTRIB2HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2hvNV")) == NULL) || r; r = ((glVertexAttrib3hNV = (PFNGLVERTEXATTRIB3HNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3hNV")) == NULL) || r; r = ((glVertexAttrib3hvNV = (PFNGLVERTEXATTRIB3HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3hvNV")) == NULL) || r; r = ((glVertexAttrib4hNV = (PFNGLVERTEXATTRIB4HNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4hNV")) == NULL) || r; r = ((glVertexAttrib4hvNV = (PFNGLVERTEXATTRIB4HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4hvNV")) == NULL) || r; r = ((glVertexAttribs1hvNV = (PFNGLVERTEXATTRIBS1HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs1hvNV")) == NULL) || r; r = ((glVertexAttribs2hvNV = (PFNGLVERTEXATTRIBS2HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs2hvNV")) == NULL) || r; r = ((glVertexAttribs3hvNV = (PFNGLVERTEXATTRIBS3HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs3hvNV")) == NULL) || r; r = ((glVertexAttribs4hvNV = (PFNGLVERTEXATTRIBS4HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs4hvNV")) == NULL) || r; r = ((glVertexWeighthNV = (PFNGLVERTEXWEIGHTHNVPROC)glewGetProcAddress((const GLubyte*)"glVertexWeighthNV")) == NULL) || r; r = ((glVertexWeighthvNV = (PFNGLVERTEXWEIGHTHVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexWeighthvNV")) == NULL) || r; return r; } #endif /* GL_NV_half_float */ #ifdef GL_NV_light_max_exponent #endif /* GL_NV_light_max_exponent */ #ifdef GL_NV_multisample_coverage #endif /* GL_NV_multisample_coverage */ #ifdef GL_NV_multisample_filter_hint #endif /* GL_NV_multisample_filter_hint */ #ifdef GL_NV_occlusion_query static GLboolean _glewInit_GL_NV_occlusion_query (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBeginOcclusionQueryNV = (PFNGLBEGINOCCLUSIONQUERYNVPROC)glewGetProcAddress((const GLubyte*)"glBeginOcclusionQueryNV")) == NULL) || r; r = ((glDeleteOcclusionQueriesNV = (PFNGLDELETEOCCLUSIONQUERIESNVPROC)glewGetProcAddress((const GLubyte*)"glDeleteOcclusionQueriesNV")) == NULL) || r; r = ((glEndOcclusionQueryNV = (PFNGLENDOCCLUSIONQUERYNVPROC)glewGetProcAddress((const GLubyte*)"glEndOcclusionQueryNV")) == NULL) || r; r = ((glGenOcclusionQueriesNV = (PFNGLGENOCCLUSIONQUERIESNVPROC)glewGetProcAddress((const GLubyte*)"glGenOcclusionQueriesNV")) == NULL) || r; r = ((glGetOcclusionQueryivNV = (PFNGLGETOCCLUSIONQUERYIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetOcclusionQueryivNV")) == NULL) || r; r = ((glGetOcclusionQueryuivNV = (PFNGLGETOCCLUSIONQUERYUIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetOcclusionQueryuivNV")) == NULL) || r; r = ((glIsOcclusionQueryNV = (PFNGLISOCCLUSIONQUERYNVPROC)glewGetProcAddress((const GLubyte*)"glIsOcclusionQueryNV")) == NULL) || r; return r; } #endif /* GL_NV_occlusion_query */ #ifdef GL_NV_packed_depth_stencil #endif /* GL_NV_packed_depth_stencil */ #ifdef GL_NV_parameter_buffer_object static GLboolean _glewInit_GL_NV_parameter_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glProgramBufferParametersIivNV = (PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramBufferParametersIivNV")) == NULL) || r; r = ((glProgramBufferParametersIuivNV = (PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramBufferParametersIuivNV")) == NULL) || r; r = ((glProgramBufferParametersfvNV = (PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramBufferParametersfvNV")) == NULL) || r; return r; } #endif /* GL_NV_parameter_buffer_object */ #ifdef GL_NV_parameter_buffer_object2 #endif /* GL_NV_parameter_buffer_object2 */ #ifdef GL_NV_path_rendering static GLboolean _glewInit_GL_NV_path_rendering (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glCopyPathNV = (PFNGLCOPYPATHNVPROC)glewGetProcAddress((const GLubyte*)"glCopyPathNV")) == NULL) || r; r = ((glCoverFillPathInstancedNV = (PFNGLCOVERFILLPATHINSTANCEDNVPROC)glewGetProcAddress((const GLubyte*)"glCoverFillPathInstancedNV")) == NULL) || r; r = ((glCoverFillPathNV = (PFNGLCOVERFILLPATHNVPROC)glewGetProcAddress((const GLubyte*)"glCoverFillPathNV")) == NULL) || r; r = ((glCoverStrokePathInstancedNV = (PFNGLCOVERSTROKEPATHINSTANCEDNVPROC)glewGetProcAddress((const GLubyte*)"glCoverStrokePathInstancedNV")) == NULL) || r; r = ((glCoverStrokePathNV = (PFNGLCOVERSTROKEPATHNVPROC)glewGetProcAddress((const GLubyte*)"glCoverStrokePathNV")) == NULL) || r; r = ((glDeletePathsNV = (PFNGLDELETEPATHSNVPROC)glewGetProcAddress((const GLubyte*)"glDeletePathsNV")) == NULL) || r; r = ((glGenPathsNV = (PFNGLGENPATHSNVPROC)glewGetProcAddress((const GLubyte*)"glGenPathsNV")) == NULL) || r; r = ((glGetPathColorGenfvNV = (PFNGLGETPATHCOLORGENFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathColorGenfvNV")) == NULL) || r; r = ((glGetPathColorGenivNV = (PFNGLGETPATHCOLORGENIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathColorGenivNV")) == NULL) || r; r = ((glGetPathCommandsNV = (PFNGLGETPATHCOMMANDSNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathCommandsNV")) == NULL) || r; r = ((glGetPathCoordsNV = (PFNGLGETPATHCOORDSNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathCoordsNV")) == NULL) || r; r = ((glGetPathDashArrayNV = (PFNGLGETPATHDASHARRAYNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathDashArrayNV")) == NULL) || r; r = ((glGetPathLengthNV = (PFNGLGETPATHLENGTHNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathLengthNV")) == NULL) || r; r = ((glGetPathMetricRangeNV = (PFNGLGETPATHMETRICRANGENVPROC)glewGetProcAddress((const GLubyte*)"glGetPathMetricRangeNV")) == NULL) || r; r = ((glGetPathMetricsNV = (PFNGLGETPATHMETRICSNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathMetricsNV")) == NULL) || r; r = ((glGetPathParameterfvNV = (PFNGLGETPATHPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathParameterfvNV")) == NULL) || r; r = ((glGetPathParameterivNV = (PFNGLGETPATHPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathParameterivNV")) == NULL) || r; r = ((glGetPathSpacingNV = (PFNGLGETPATHSPACINGNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathSpacingNV")) == NULL) || r; r = ((glGetPathTexGenfvNV = (PFNGLGETPATHTEXGENFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathTexGenfvNV")) == NULL) || r; r = ((glGetPathTexGenivNV = (PFNGLGETPATHTEXGENIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathTexGenivNV")) == NULL) || r; r = ((glInterpolatePathsNV = (PFNGLINTERPOLATEPATHSNVPROC)glewGetProcAddress((const GLubyte*)"glInterpolatePathsNV")) == NULL) || r; r = ((glIsPathNV = (PFNGLISPATHNVPROC)glewGetProcAddress((const GLubyte*)"glIsPathNV")) == NULL) || r; r = ((glIsPointInFillPathNV = (PFNGLISPOINTINFILLPATHNVPROC)glewGetProcAddress((const GLubyte*)"glIsPointInFillPathNV")) == NULL) || r; r = ((glIsPointInStrokePathNV = (PFNGLISPOINTINSTROKEPATHNVPROC)glewGetProcAddress((const GLubyte*)"glIsPointInStrokePathNV")) == NULL) || r; r = ((glPathColorGenNV = (PFNGLPATHCOLORGENNVPROC)glewGetProcAddress((const GLubyte*)"glPathColorGenNV")) == NULL) || r; r = ((glPathCommandsNV = (PFNGLPATHCOMMANDSNVPROC)glewGetProcAddress((const GLubyte*)"glPathCommandsNV")) == NULL) || r; r = ((glPathCoordsNV = (PFNGLPATHCOORDSNVPROC)glewGetProcAddress((const GLubyte*)"glPathCoordsNV")) == NULL) || r; r = ((glPathCoverDepthFuncNV = (PFNGLPATHCOVERDEPTHFUNCNVPROC)glewGetProcAddress((const GLubyte*)"glPathCoverDepthFuncNV")) == NULL) || r; r = ((glPathDashArrayNV = (PFNGLPATHDASHARRAYNVPROC)glewGetProcAddress((const GLubyte*)"glPathDashArrayNV")) == NULL) || r; r = ((glPathFogGenNV = (PFNGLPATHFOGGENNVPROC)glewGetProcAddress((const GLubyte*)"glPathFogGenNV")) == NULL) || r; r = ((glPathGlyphRangeNV = (PFNGLPATHGLYPHRANGENVPROC)glewGetProcAddress((const GLubyte*)"glPathGlyphRangeNV")) == NULL) || r; r = ((glPathGlyphsNV = (PFNGLPATHGLYPHSNVPROC)glewGetProcAddress((const GLubyte*)"glPathGlyphsNV")) == NULL) || r; r = ((glPathParameterfNV = (PFNGLPATHPARAMETERFNVPROC)glewGetProcAddress((const GLubyte*)"glPathParameterfNV")) == NULL) || r; r = ((glPathParameterfvNV = (PFNGLPATHPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glPathParameterfvNV")) == NULL) || r; r = ((glPathParameteriNV = (PFNGLPATHPARAMETERINVPROC)glewGetProcAddress((const GLubyte*)"glPathParameteriNV")) == NULL) || r; r = ((glPathParameterivNV = (PFNGLPATHPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glPathParameterivNV")) == NULL) || r; r = ((glPathStencilDepthOffsetNV = (PFNGLPATHSTENCILDEPTHOFFSETNVPROC)glewGetProcAddress((const GLubyte*)"glPathStencilDepthOffsetNV")) == NULL) || r; r = ((glPathStencilFuncNV = (PFNGLPATHSTENCILFUNCNVPROC)glewGetProcAddress((const GLubyte*)"glPathStencilFuncNV")) == NULL) || r; r = ((glPathStringNV = (PFNGLPATHSTRINGNVPROC)glewGetProcAddress((const GLubyte*)"glPathStringNV")) == NULL) || r; r = ((glPathSubCommandsNV = (PFNGLPATHSUBCOMMANDSNVPROC)glewGetProcAddress((const GLubyte*)"glPathSubCommandsNV")) == NULL) || r; r = ((glPathSubCoordsNV = (PFNGLPATHSUBCOORDSNVPROC)glewGetProcAddress((const GLubyte*)"glPathSubCoordsNV")) == NULL) || r; r = ((glPathTexGenNV = (PFNGLPATHTEXGENNVPROC)glewGetProcAddress((const GLubyte*)"glPathTexGenNV")) == NULL) || r; r = ((glPointAlongPathNV = (PFNGLPOINTALONGPATHNVPROC)glewGetProcAddress((const GLubyte*)"glPointAlongPathNV")) == NULL) || r; r = ((glStencilFillPathInstancedNV = (PFNGLSTENCILFILLPATHINSTANCEDNVPROC)glewGetProcAddress((const GLubyte*)"glStencilFillPathInstancedNV")) == NULL) || r; r = ((glStencilFillPathNV = (PFNGLSTENCILFILLPATHNVPROC)glewGetProcAddress((const GLubyte*)"glStencilFillPathNV")) == NULL) || r; r = ((glStencilStrokePathInstancedNV = (PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC)glewGetProcAddress((const GLubyte*)"glStencilStrokePathInstancedNV")) == NULL) || r; r = ((glStencilStrokePathNV = (PFNGLSTENCILSTROKEPATHNVPROC)glewGetProcAddress((const GLubyte*)"glStencilStrokePathNV")) == NULL) || r; r = ((glTransformPathNV = (PFNGLTRANSFORMPATHNVPROC)glewGetProcAddress((const GLubyte*)"glTransformPathNV")) == NULL) || r; r = ((glWeightPathsNV = (PFNGLWEIGHTPATHSNVPROC)glewGetProcAddress((const GLubyte*)"glWeightPathsNV")) == NULL) || r; return r; } #endif /* GL_NV_path_rendering */ #ifdef GL_NV_pixel_data_range static GLboolean _glewInit_GL_NV_pixel_data_range (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glFlushPixelDataRangeNV = (PFNGLFLUSHPIXELDATARANGENVPROC)glewGetProcAddress((const GLubyte*)"glFlushPixelDataRangeNV")) == NULL) || r; r = ((glPixelDataRangeNV = (PFNGLPIXELDATARANGENVPROC)glewGetProcAddress((const GLubyte*)"glPixelDataRangeNV")) == NULL) || r; return r; } #endif /* GL_NV_pixel_data_range */ #ifdef GL_NV_point_sprite static GLboolean _glewInit_GL_NV_point_sprite (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glPointParameteriNV = (PFNGLPOINTPARAMETERINVPROC)glewGetProcAddress((const GLubyte*)"glPointParameteriNV")) == NULL) || r; r = ((glPointParameterivNV = (PFNGLPOINTPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glPointParameterivNV")) == NULL) || r; return r; } #endif /* GL_NV_point_sprite */ #ifdef GL_NV_present_video static GLboolean _glewInit_GL_NV_present_video (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetVideoi64vNV = (PFNGLGETVIDEOI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoi64vNV")) == NULL) || r; r = ((glGetVideoivNV = (PFNGLGETVIDEOIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoivNV")) == NULL) || r; r = ((glGetVideoui64vNV = (PFNGLGETVIDEOUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoui64vNV")) == NULL) || r; r = ((glGetVideouivNV = (PFNGLGETVIDEOUIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideouivNV")) == NULL) || r; r = ((glPresentFrameDualFillNV = (PFNGLPRESENTFRAMEDUALFILLNVPROC)glewGetProcAddress((const GLubyte*)"glPresentFrameDualFillNV")) == NULL) || r; r = ((glPresentFrameKeyedNV = (PFNGLPRESENTFRAMEKEYEDNVPROC)glewGetProcAddress((const GLubyte*)"glPresentFrameKeyedNV")) == NULL) || r; return r; } #endif /* GL_NV_present_video */ #ifdef GL_NV_primitive_restart static GLboolean _glewInit_GL_NV_primitive_restart (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glPrimitiveRestartIndexNV = (PFNGLPRIMITIVERESTARTINDEXNVPROC)glewGetProcAddress((const GLubyte*)"glPrimitiveRestartIndexNV")) == NULL) || r; r = ((glPrimitiveRestartNV = (PFNGLPRIMITIVERESTARTNVPROC)glewGetProcAddress((const GLubyte*)"glPrimitiveRestartNV")) == NULL) || r; return r; } #endif /* GL_NV_primitive_restart */ #ifdef GL_NV_register_combiners static GLboolean _glewInit_GL_NV_register_combiners (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glCombinerInputNV = (PFNGLCOMBINERINPUTNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerInputNV")) == NULL) || r; r = ((glCombinerOutputNV = (PFNGLCOMBINEROUTPUTNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerOutputNV")) == NULL) || r; r = ((glCombinerParameterfNV = (PFNGLCOMBINERPARAMETERFNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerParameterfNV")) == NULL) || r; r = ((glCombinerParameterfvNV = (PFNGLCOMBINERPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerParameterfvNV")) == NULL) || r; r = ((glCombinerParameteriNV = (PFNGLCOMBINERPARAMETERINVPROC)glewGetProcAddress((const GLubyte*)"glCombinerParameteriNV")) == NULL) || r; r = ((glCombinerParameterivNV = (PFNGLCOMBINERPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerParameterivNV")) == NULL) || r; r = ((glFinalCombinerInputNV = (PFNGLFINALCOMBINERINPUTNVPROC)glewGetProcAddress((const GLubyte*)"glFinalCombinerInputNV")) == NULL) || r; r = ((glGetCombinerInputParameterfvNV = (PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetCombinerInputParameterfvNV")) == NULL) || r; r = ((glGetCombinerInputParameterivNV = (PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetCombinerInputParameterivNV")) == NULL) || r; r = ((glGetCombinerOutputParameterfvNV = (PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetCombinerOutputParameterfvNV")) == NULL) || r; r = ((glGetCombinerOutputParameterivNV = (PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetCombinerOutputParameterivNV")) == NULL) || r; r = ((glGetFinalCombinerInputParameterfvNV = (PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetFinalCombinerInputParameterfvNV")) == NULL) || r; r = ((glGetFinalCombinerInputParameterivNV = (PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetFinalCombinerInputParameterivNV")) == NULL) || r; return r; } #endif /* GL_NV_register_combiners */ #ifdef GL_NV_register_combiners2 static GLboolean _glewInit_GL_NV_register_combiners2 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glCombinerStageParameterfvNV = (PFNGLCOMBINERSTAGEPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerStageParameterfvNV")) == NULL) || r; r = ((glGetCombinerStageParameterfvNV = (PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetCombinerStageParameterfvNV")) == NULL) || r; return r; } #endif /* GL_NV_register_combiners2 */ #ifdef GL_NV_shader_atomic_float #endif /* GL_NV_shader_atomic_float */ #ifdef GL_NV_shader_buffer_load static GLboolean _glewInit_GL_NV_shader_buffer_load (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetBufferParameterui64vNV = (PFNGLGETBUFFERPARAMETERUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetBufferParameterui64vNV")) == NULL) || r; r = ((glGetIntegerui64vNV = (PFNGLGETINTEGERUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetIntegerui64vNV")) == NULL) || r; r = ((glGetNamedBufferParameterui64vNV = (PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetNamedBufferParameterui64vNV")) == NULL) || r; r = ((glIsBufferResidentNV = (PFNGLISBUFFERRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glIsBufferResidentNV")) == NULL) || r; r = ((glIsNamedBufferResidentNV = (PFNGLISNAMEDBUFFERRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glIsNamedBufferResidentNV")) == NULL) || r; r = ((glMakeBufferNonResidentNV = (PFNGLMAKEBUFFERNONRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeBufferNonResidentNV")) == NULL) || r; r = ((glMakeBufferResidentNV = (PFNGLMAKEBUFFERRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeBufferResidentNV")) == NULL) || r; r = ((glMakeNamedBufferNonResidentNV = (PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeNamedBufferNonResidentNV")) == NULL) || r; r = ((glMakeNamedBufferResidentNV = (PFNGLMAKENAMEDBUFFERRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeNamedBufferResidentNV")) == NULL) || r; r = ((glProgramUniformui64NV = (PFNGLPROGRAMUNIFORMUI64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformui64NV")) == NULL) || r; r = ((glProgramUniformui64vNV = (PFNGLPROGRAMUNIFORMUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformui64vNV")) == NULL) || r; r = ((glUniformui64NV = (PFNGLUNIFORMUI64NVPROC)glewGetProcAddress((const GLubyte*)"glUniformui64NV")) == NULL) || r; r = ((glUniformui64vNV = (PFNGLUNIFORMUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniformui64vNV")) == NULL) || r; return r; } #endif /* GL_NV_shader_buffer_load */ #ifdef GL_NV_tessellation_program5 #endif /* GL_NV_tessellation_program5 */ #ifdef GL_NV_texgen_emboss #endif /* GL_NV_texgen_emboss */ #ifdef GL_NV_texgen_reflection #endif /* GL_NV_texgen_reflection */ #ifdef GL_NV_texture_barrier static GLboolean _glewInit_GL_NV_texture_barrier (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glTextureBarrierNV = (PFNGLTEXTUREBARRIERNVPROC)glewGetProcAddress((const GLubyte*)"glTextureBarrierNV")) == NULL) || r; return r; } #endif /* GL_NV_texture_barrier */ #ifdef GL_NV_texture_compression_vtc #endif /* GL_NV_texture_compression_vtc */ #ifdef GL_NV_texture_env_combine4 #endif /* GL_NV_texture_env_combine4 */ #ifdef GL_NV_texture_expand_normal #endif /* GL_NV_texture_expand_normal */ #ifdef GL_NV_texture_multisample static GLboolean _glewInit_GL_NV_texture_multisample (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glTexImage2DMultisampleCoverageNV = (PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC)glewGetProcAddress((const GLubyte*)"glTexImage2DMultisampleCoverageNV")) == NULL) || r; r = ((glTexImage3DMultisampleCoverageNV = (PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC)glewGetProcAddress((const GLubyte*)"glTexImage3DMultisampleCoverageNV")) == NULL) || r; r = ((glTextureImage2DMultisampleCoverageNV = (PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC)glewGetProcAddress((const GLubyte*)"glTextureImage2DMultisampleCoverageNV")) == NULL) || r; r = ((glTextureImage2DMultisampleNV = (PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC)glewGetProcAddress((const GLubyte*)"glTextureImage2DMultisampleNV")) == NULL) || r; r = ((glTextureImage3DMultisampleCoverageNV = (PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC)glewGetProcAddress((const GLubyte*)"glTextureImage3DMultisampleCoverageNV")) == NULL) || r; r = ((glTextureImage3DMultisampleNV = (PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC)glewGetProcAddress((const GLubyte*)"glTextureImage3DMultisampleNV")) == NULL) || r; return r; } #endif /* GL_NV_texture_multisample */ #ifdef GL_NV_texture_rectangle #endif /* GL_NV_texture_rectangle */ #ifdef GL_NV_texture_shader #endif /* GL_NV_texture_shader */ #ifdef GL_NV_texture_shader2 #endif /* GL_NV_texture_shader2 */ #ifdef GL_NV_texture_shader3 #endif /* GL_NV_texture_shader3 */ #ifdef GL_NV_transform_feedback static GLboolean _glewInit_GL_NV_transform_feedback (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glActiveVaryingNV = (PFNGLACTIVEVARYINGNVPROC)glewGetProcAddress((const GLubyte*)"glActiveVaryingNV")) == NULL) || r; r = ((glBeginTransformFeedbackNV = (PFNGLBEGINTRANSFORMFEEDBACKNVPROC)glewGetProcAddress((const GLubyte*)"glBeginTransformFeedbackNV")) == NULL) || r; r = ((glBindBufferBaseNV = (PFNGLBINDBUFFERBASENVPROC)glewGetProcAddress((const GLubyte*)"glBindBufferBaseNV")) == NULL) || r; r = ((glBindBufferOffsetNV = (PFNGLBINDBUFFEROFFSETNVPROC)glewGetProcAddress((const GLubyte*)"glBindBufferOffsetNV")) == NULL) || r; r = ((glBindBufferRangeNV = (PFNGLBINDBUFFERRANGENVPROC)glewGetProcAddress((const GLubyte*)"glBindBufferRangeNV")) == NULL) || r; r = ((glEndTransformFeedbackNV = (PFNGLENDTRANSFORMFEEDBACKNVPROC)glewGetProcAddress((const GLubyte*)"glEndTransformFeedbackNV")) == NULL) || r; r = ((glGetActiveVaryingNV = (PFNGLGETACTIVEVARYINGNVPROC)glewGetProcAddress((const GLubyte*)"glGetActiveVaryingNV")) == NULL) || r; r = ((glGetTransformFeedbackVaryingNV = (PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC)glewGetProcAddress((const GLubyte*)"glGetTransformFeedbackVaryingNV")) == NULL) || r; r = ((glGetVaryingLocationNV = (PFNGLGETVARYINGLOCATIONNVPROC)glewGetProcAddress((const GLubyte*)"glGetVaryingLocationNV")) == NULL) || r; r = ((glTransformFeedbackAttribsNV = (PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC)glewGetProcAddress((const GLubyte*)"glTransformFeedbackAttribsNV")) == NULL) || r; r = ((glTransformFeedbackVaryingsNV = (PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC)glewGetProcAddress((const GLubyte*)"glTransformFeedbackVaryingsNV")) == NULL) || r; return r; } #endif /* GL_NV_transform_feedback */ #ifdef GL_NV_transform_feedback2 static GLboolean _glewInit_GL_NV_transform_feedback2 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBindTransformFeedbackNV = (PFNGLBINDTRANSFORMFEEDBACKNVPROC)glewGetProcAddress((const GLubyte*)"glBindTransformFeedbackNV")) == NULL) || r; r = ((glDeleteTransformFeedbacksNV = (PFNGLDELETETRANSFORMFEEDBACKSNVPROC)glewGetProcAddress((const GLubyte*)"glDeleteTransformFeedbacksNV")) == NULL) || r; r = ((glDrawTransformFeedbackNV = (PFNGLDRAWTRANSFORMFEEDBACKNVPROC)glewGetProcAddress((const GLubyte*)"glDrawTransformFeedbackNV")) == NULL) || r; r = ((glGenTransformFeedbacksNV = (PFNGLGENTRANSFORMFEEDBACKSNVPROC)glewGetProcAddress((const GLubyte*)"glGenTransformFeedbacksNV")) == NULL) || r; r = ((glIsTransformFeedbackNV = (PFNGLISTRANSFORMFEEDBACKNVPROC)glewGetProcAddress((const GLubyte*)"glIsTransformFeedbackNV")) == NULL) || r; r = ((glPauseTransformFeedbackNV = (PFNGLPAUSETRANSFORMFEEDBACKNVPROC)glewGetProcAddress((const GLubyte*)"glPauseTransformFeedbackNV")) == NULL) || r; r = ((glResumeTransformFeedbackNV = (PFNGLRESUMETRANSFORMFEEDBACKNVPROC)glewGetProcAddress((const GLubyte*)"glResumeTransformFeedbackNV")) == NULL) || r; return r; } #endif /* GL_NV_transform_feedback2 */ #ifdef GL_NV_vdpau_interop static GLboolean _glewInit_GL_NV_vdpau_interop (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glVDPAUFiniNV = (PFNGLVDPAUFININVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUFiniNV")) == NULL) || r; r = ((glVDPAUGetSurfaceivNV = (PFNGLVDPAUGETSURFACEIVNVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUGetSurfaceivNV")) == NULL) || r; r = ((glVDPAUInitNV = (PFNGLVDPAUINITNVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUInitNV")) == NULL) || r; r = ((glVDPAUIsSurfaceNV = (PFNGLVDPAUISSURFACENVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUIsSurfaceNV")) == NULL) || r; r = ((glVDPAUMapSurfacesNV = (PFNGLVDPAUMAPSURFACESNVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUMapSurfacesNV")) == NULL) || r; r = ((glVDPAURegisterOutputSurfaceNV = (PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC)glewGetProcAddress((const GLubyte*)"glVDPAURegisterOutputSurfaceNV")) == NULL) || r; r = ((glVDPAURegisterVideoSurfaceNV = (PFNGLVDPAUREGISTERVIDEOSURFACENVPROC)glewGetProcAddress((const GLubyte*)"glVDPAURegisterVideoSurfaceNV")) == NULL) || r; r = ((glVDPAUSurfaceAccessNV = (PFNGLVDPAUSURFACEACCESSNVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUSurfaceAccessNV")) == NULL) || r; r = ((glVDPAUUnmapSurfacesNV = (PFNGLVDPAUUNMAPSURFACESNVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUUnmapSurfacesNV")) == NULL) || r; r = ((glVDPAUUnregisterSurfaceNV = (PFNGLVDPAUUNREGISTERSURFACENVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUUnregisterSurfaceNV")) == NULL) || r; return r; } #endif /* GL_NV_vdpau_interop */ #ifdef GL_NV_vertex_array_range static GLboolean _glewInit_GL_NV_vertex_array_range (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glFlushVertexArrayRangeNV = (PFNGLFLUSHVERTEXARRAYRANGENVPROC)glewGetProcAddress((const GLubyte*)"glFlushVertexArrayRangeNV")) == NULL) || r; r = ((glVertexArrayRangeNV = (PFNGLVERTEXARRAYRANGENVPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayRangeNV")) == NULL) || r; return r; } #endif /* GL_NV_vertex_array_range */ #ifdef GL_NV_vertex_array_range2 #endif /* GL_NV_vertex_array_range2 */ #ifdef GL_NV_vertex_attrib_integer_64bit static GLboolean _glewInit_GL_NV_vertex_attrib_integer_64bit (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetVertexAttribLi64vNV = (PFNGLGETVERTEXATTRIBLI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribLi64vNV")) == NULL) || r; r = ((glGetVertexAttribLui64vNV = (PFNGLGETVERTEXATTRIBLUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribLui64vNV")) == NULL) || r; r = ((glVertexAttribL1i64NV = (PFNGLVERTEXATTRIBL1I64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1i64NV")) == NULL) || r; r = ((glVertexAttribL1i64vNV = (PFNGLVERTEXATTRIBL1I64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1i64vNV")) == NULL) || r; r = ((glVertexAttribL1ui64NV = (PFNGLVERTEXATTRIBL1UI64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1ui64NV")) == NULL) || r; r = ((glVertexAttribL1ui64vNV = (PFNGLVERTEXATTRIBL1UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1ui64vNV")) == NULL) || r; r = ((glVertexAttribL2i64NV = (PFNGLVERTEXATTRIBL2I64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2i64NV")) == NULL) || r; r = ((glVertexAttribL2i64vNV = (PFNGLVERTEXATTRIBL2I64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2i64vNV")) == NULL) || r; r = ((glVertexAttribL2ui64NV = (PFNGLVERTEXATTRIBL2UI64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2ui64NV")) == NULL) || r; r = ((glVertexAttribL2ui64vNV = (PFNGLVERTEXATTRIBL2UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2ui64vNV")) == NULL) || r; r = ((glVertexAttribL3i64NV = (PFNGLVERTEXATTRIBL3I64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3i64NV")) == NULL) || r; r = ((glVertexAttribL3i64vNV = (PFNGLVERTEXATTRIBL3I64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3i64vNV")) == NULL) || r; r = ((glVertexAttribL3ui64NV = (PFNGLVERTEXATTRIBL3UI64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3ui64NV")) == NULL) || r; r = ((glVertexAttribL3ui64vNV = (PFNGLVERTEXATTRIBL3UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3ui64vNV")) == NULL) || r; r = ((glVertexAttribL4i64NV = (PFNGLVERTEXATTRIBL4I64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4i64NV")) == NULL) || r; r = ((glVertexAttribL4i64vNV = (PFNGLVERTEXATTRIBL4I64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4i64vNV")) == NULL) || r; r = ((glVertexAttribL4ui64NV = (PFNGLVERTEXATTRIBL4UI64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4ui64NV")) == NULL) || r; r = ((glVertexAttribL4ui64vNV = (PFNGLVERTEXATTRIBL4UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4ui64vNV")) == NULL) || r; r = ((glVertexAttribLFormatNV = (PFNGLVERTEXATTRIBLFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribLFormatNV")) == NULL) || r; return r; } #endif /* GL_NV_vertex_attrib_integer_64bit */ #ifdef GL_NV_vertex_buffer_unified_memory static GLboolean _glewInit_GL_NV_vertex_buffer_unified_memory (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBufferAddressRangeNV = (PFNGLBUFFERADDRESSRANGENVPROC)glewGetProcAddress((const GLubyte*)"glBufferAddressRangeNV")) == NULL) || r; r = ((glColorFormatNV = (PFNGLCOLORFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glColorFormatNV")) == NULL) || r; r = ((glEdgeFlagFormatNV = (PFNGLEDGEFLAGFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glEdgeFlagFormatNV")) == NULL) || r; r = ((glFogCoordFormatNV = (PFNGLFOGCOORDFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glFogCoordFormatNV")) == NULL) || r; r = ((glGetIntegerui64i_vNV = (PFNGLGETINTEGERUI64I_VNVPROC)glewGetProcAddress((const GLubyte*)"glGetIntegerui64i_vNV")) == NULL) || r; r = ((glIndexFormatNV = (PFNGLINDEXFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glIndexFormatNV")) == NULL) || r; r = ((glNormalFormatNV = (PFNGLNORMALFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glNormalFormatNV")) == NULL) || r; r = ((glSecondaryColorFormatNV = (PFNGLSECONDARYCOLORFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColorFormatNV")) == NULL) || r; r = ((glTexCoordFormatNV = (PFNGLTEXCOORDFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoordFormatNV")) == NULL) || r; r = ((glVertexAttribFormatNV = (PFNGLVERTEXATTRIBFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribFormatNV")) == NULL) || r; r = ((glVertexAttribIFormatNV = (PFNGLVERTEXATTRIBIFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribIFormatNV")) == NULL) || r; r = ((glVertexFormatNV = (PFNGLVERTEXFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glVertexFormatNV")) == NULL) || r; return r; } #endif /* GL_NV_vertex_buffer_unified_memory */ #ifdef GL_NV_vertex_program static GLboolean _glewInit_GL_NV_vertex_program (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glAreProgramsResidentNV = (PFNGLAREPROGRAMSRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glAreProgramsResidentNV")) == NULL) || r; r = ((glBindProgramNV = (PFNGLBINDPROGRAMNVPROC)glewGetProcAddress((const GLubyte*)"glBindProgramNV")) == NULL) || r; r = ((glDeleteProgramsNV = (PFNGLDELETEPROGRAMSNVPROC)glewGetProcAddress((const GLubyte*)"glDeleteProgramsNV")) == NULL) || r; r = ((glExecuteProgramNV = (PFNGLEXECUTEPROGRAMNVPROC)glewGetProcAddress((const GLubyte*)"glExecuteProgramNV")) == NULL) || r; r = ((glGenProgramsNV = (PFNGLGENPROGRAMSNVPROC)glewGetProcAddress((const GLubyte*)"glGenProgramsNV")) == NULL) || r; r = ((glGetProgramParameterdvNV = (PFNGLGETPROGRAMPARAMETERDVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramParameterdvNV")) == NULL) || r; r = ((glGetProgramParameterfvNV = (PFNGLGETPROGRAMPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramParameterfvNV")) == NULL) || r; r = ((glGetProgramStringNV = (PFNGLGETPROGRAMSTRINGNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramStringNV")) == NULL) || r; r = ((glGetProgramivNV = (PFNGLGETPROGRAMIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramivNV")) == NULL) || r; r = ((glGetTrackMatrixivNV = (PFNGLGETTRACKMATRIXIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetTrackMatrixivNV")) == NULL) || r; r = ((glGetVertexAttribPointervNV = (PFNGLGETVERTEXATTRIBPOINTERVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribPointervNV")) == NULL) || r; r = ((glGetVertexAttribdvNV = (PFNGLGETVERTEXATTRIBDVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribdvNV")) == NULL) || r; r = ((glGetVertexAttribfvNV = (PFNGLGETVERTEXATTRIBFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribfvNV")) == NULL) || r; r = ((glGetVertexAttribivNV = (PFNGLGETVERTEXATTRIBIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribivNV")) == NULL) || r; r = ((glIsProgramNV = (PFNGLISPROGRAMNVPROC)glewGetProcAddress((const GLubyte*)"glIsProgramNV")) == NULL) || r; r = ((glLoadProgramNV = (PFNGLLOADPROGRAMNVPROC)glewGetProcAddress((const GLubyte*)"glLoadProgramNV")) == NULL) || r; r = ((glProgramParameter4dNV = (PFNGLPROGRAMPARAMETER4DNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameter4dNV")) == NULL) || r; r = ((glProgramParameter4dvNV = (PFNGLPROGRAMPARAMETER4DVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameter4dvNV")) == NULL) || r; r = ((glProgramParameter4fNV = (PFNGLPROGRAMPARAMETER4FNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameter4fNV")) == NULL) || r; r = ((glProgramParameter4fvNV = (PFNGLPROGRAMPARAMETER4FVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameter4fvNV")) == NULL) || r; r = ((glProgramParameters4dvNV = (PFNGLPROGRAMPARAMETERS4DVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameters4dvNV")) == NULL) || r; r = ((glProgramParameters4fvNV = (PFNGLPROGRAMPARAMETERS4FVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameters4fvNV")) == NULL) || r; r = ((glRequestResidentProgramsNV = (PFNGLREQUESTRESIDENTPROGRAMSNVPROC)glewGetProcAddress((const GLubyte*)"glRequestResidentProgramsNV")) == NULL) || r; r = ((glTrackMatrixNV = (PFNGLTRACKMATRIXNVPROC)glewGetProcAddress((const GLubyte*)"glTrackMatrixNV")) == NULL) || r; r = ((glVertexAttrib1dNV = (PFNGLVERTEXATTRIB1DNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1dNV")) == NULL) || r; r = ((glVertexAttrib1dvNV = (PFNGLVERTEXATTRIB1DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1dvNV")) == NULL) || r; r = ((glVertexAttrib1fNV = (PFNGLVERTEXATTRIB1FNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1fNV")) == NULL) || r; r = ((glVertexAttrib1fvNV = (PFNGLVERTEXATTRIB1FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1fvNV")) == NULL) || r; r = ((glVertexAttrib1sNV = (PFNGLVERTEXATTRIB1SNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1sNV")) == NULL) || r; r = ((glVertexAttrib1svNV = (PFNGLVERTEXATTRIB1SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1svNV")) == NULL) || r; r = ((glVertexAttrib2dNV = (PFNGLVERTEXATTRIB2DNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2dNV")) == NULL) || r; r = ((glVertexAttrib2dvNV = (PFNGLVERTEXATTRIB2DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2dvNV")) == NULL) || r; r = ((glVertexAttrib2fNV = (PFNGLVERTEXATTRIB2FNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2fNV")) == NULL) || r; r = ((glVertexAttrib2fvNV = (PFNGLVERTEXATTRIB2FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2fvNV")) == NULL) || r; r = ((glVertexAttrib2sNV = (PFNGLVERTEXATTRIB2SNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2sNV")) == NULL) || r; r = ((glVertexAttrib2svNV = (PFNGLVERTEXATTRIB2SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2svNV")) == NULL) || r; r = ((glVertexAttrib3dNV = (PFNGLVERTEXATTRIB3DNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3dNV")) == NULL) || r; r = ((glVertexAttrib3dvNV = (PFNGLVERTEXATTRIB3DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3dvNV")) == NULL) || r; r = ((glVertexAttrib3fNV = (PFNGLVERTEXATTRIB3FNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3fNV")) == NULL) || r; r = ((glVertexAttrib3fvNV = (PFNGLVERTEXATTRIB3FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3fvNV")) == NULL) || r; r = ((glVertexAttrib3sNV = (PFNGLVERTEXATTRIB3SNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3sNV")) == NULL) || r; r = ((glVertexAttrib3svNV = (PFNGLVERTEXATTRIB3SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3svNV")) == NULL) || r; r = ((glVertexAttrib4dNV = (PFNGLVERTEXATTRIB4DNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4dNV")) == NULL) || r; r = ((glVertexAttrib4dvNV = (PFNGLVERTEXATTRIB4DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4dvNV")) == NULL) || r; r = ((glVertexAttrib4fNV = (PFNGLVERTEXATTRIB4FNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4fNV")) == NULL) || r; r = ((glVertexAttrib4fvNV = (PFNGLVERTEXATTRIB4FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4fvNV")) == NULL) || r; r = ((glVertexAttrib4sNV = (PFNGLVERTEXATTRIB4SNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4sNV")) == NULL) || r; r = ((glVertexAttrib4svNV = (PFNGLVERTEXATTRIB4SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4svNV")) == NULL) || r; r = ((glVertexAttrib4ubNV = (PFNGLVERTEXATTRIB4UBNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4ubNV")) == NULL) || r; r = ((glVertexAttrib4ubvNV = (PFNGLVERTEXATTRIB4UBVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4ubvNV")) == NULL) || r; r = ((glVertexAttribPointerNV = (PFNGLVERTEXATTRIBPOINTERNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribPointerNV")) == NULL) || r; r = ((glVertexAttribs1dvNV = (PFNGLVERTEXATTRIBS1DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs1dvNV")) == NULL) || r; r = ((glVertexAttribs1fvNV = (PFNGLVERTEXATTRIBS1FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs1fvNV")) == NULL) || r; r = ((glVertexAttribs1svNV = (PFNGLVERTEXATTRIBS1SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs1svNV")) == NULL) || r; r = ((glVertexAttribs2dvNV = (PFNGLVERTEXATTRIBS2DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs2dvNV")) == NULL) || r; r = ((glVertexAttribs2fvNV = (PFNGLVERTEXATTRIBS2FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs2fvNV")) == NULL) || r; r = ((glVertexAttribs2svNV = (PFNGLVERTEXATTRIBS2SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs2svNV")) == NULL) || r; r = ((glVertexAttribs3dvNV = (PFNGLVERTEXATTRIBS3DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs3dvNV")) == NULL) || r; r = ((glVertexAttribs3fvNV = (PFNGLVERTEXATTRIBS3FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs3fvNV")) == NULL) || r; r = ((glVertexAttribs3svNV = (PFNGLVERTEXATTRIBS3SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs3svNV")) == NULL) || r; r = ((glVertexAttribs4dvNV = (PFNGLVERTEXATTRIBS4DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs4dvNV")) == NULL) || r; r = ((glVertexAttribs4fvNV = (PFNGLVERTEXATTRIBS4FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs4fvNV")) == NULL) || r; r = ((glVertexAttribs4svNV = (PFNGLVERTEXATTRIBS4SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs4svNV")) == NULL) || r; r = ((glVertexAttribs4ubvNV = (PFNGLVERTEXATTRIBS4UBVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs4ubvNV")) == NULL) || r; return r; } #endif /* GL_NV_vertex_program */ #ifdef GL_NV_vertex_program1_1 #endif /* GL_NV_vertex_program1_1 */ #ifdef GL_NV_vertex_program2 #endif /* GL_NV_vertex_program2 */ #ifdef GL_NV_vertex_program2_option #endif /* GL_NV_vertex_program2_option */ #ifdef GL_NV_vertex_program3 #endif /* GL_NV_vertex_program3 */ #ifdef GL_NV_vertex_program4 #endif /* GL_NV_vertex_program4 */ #ifdef GL_NV_video_capture static GLboolean _glewInit_GL_NV_video_capture (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glBeginVideoCaptureNV = (PFNGLBEGINVIDEOCAPTURENVPROC)glewGetProcAddress((const GLubyte*)"glBeginVideoCaptureNV")) == NULL) || r; r = ((glBindVideoCaptureStreamBufferNV = (PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC)glewGetProcAddress((const GLubyte*)"glBindVideoCaptureStreamBufferNV")) == NULL) || r; r = ((glBindVideoCaptureStreamTextureNV = (PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC)glewGetProcAddress((const GLubyte*)"glBindVideoCaptureStreamTextureNV")) == NULL) || r; r = ((glEndVideoCaptureNV = (PFNGLENDVIDEOCAPTURENVPROC)glewGetProcAddress((const GLubyte*)"glEndVideoCaptureNV")) == NULL) || r; r = ((glGetVideoCaptureStreamdvNV = (PFNGLGETVIDEOCAPTURESTREAMDVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoCaptureStreamdvNV")) == NULL) || r; r = ((glGetVideoCaptureStreamfvNV = (PFNGLGETVIDEOCAPTURESTREAMFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoCaptureStreamfvNV")) == NULL) || r; r = ((glGetVideoCaptureStreamivNV = (PFNGLGETVIDEOCAPTURESTREAMIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoCaptureStreamivNV")) == NULL) || r; r = ((glGetVideoCaptureivNV = (PFNGLGETVIDEOCAPTUREIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoCaptureivNV")) == NULL) || r; r = ((glVideoCaptureNV = (PFNGLVIDEOCAPTURENVPROC)glewGetProcAddress((const GLubyte*)"glVideoCaptureNV")) == NULL) || r; r = ((glVideoCaptureStreamParameterdvNV = (PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC)glewGetProcAddress((const GLubyte*)"glVideoCaptureStreamParameterdvNV")) == NULL) || r; r = ((glVideoCaptureStreamParameterfvNV = (PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glVideoCaptureStreamParameterfvNV")) == NULL) || r; r = ((glVideoCaptureStreamParameterivNV = (PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glVideoCaptureStreamParameterivNV")) == NULL) || r; return r; } #endif /* GL_NV_video_capture */ #ifdef GL_OES_byte_coordinates #endif /* GL_OES_byte_coordinates */ #ifdef GL_OES_compressed_paletted_texture #endif /* GL_OES_compressed_paletted_texture */ #ifdef GL_OES_read_format #endif /* GL_OES_read_format */ #ifdef GL_OES_single_precision static GLboolean _glewInit_GL_OES_single_precision (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glClearDepthfOES = (PFNGLCLEARDEPTHFOESPROC)glewGetProcAddress((const GLubyte*)"glClearDepthfOES")) == NULL) || r; r = ((glClipPlanefOES = (PFNGLCLIPPLANEFOESPROC)glewGetProcAddress((const GLubyte*)"glClipPlanefOES")) == NULL) || r; r = ((glDepthRangefOES = (PFNGLDEPTHRANGEFOESPROC)glewGetProcAddress((const GLubyte*)"glDepthRangefOES")) == NULL) || r; r = ((glFrustumfOES = (PFNGLFRUSTUMFOESPROC)glewGetProcAddress((const GLubyte*)"glFrustumfOES")) == NULL) || r; r = ((glGetClipPlanefOES = (PFNGLGETCLIPPLANEFOESPROC)glewGetProcAddress((const GLubyte*)"glGetClipPlanefOES")) == NULL) || r; r = ((glOrthofOES = (PFNGLORTHOFOESPROC)glewGetProcAddress((const GLubyte*)"glOrthofOES")) == NULL) || r; return r; } #endif /* GL_OES_single_precision */ #ifdef GL_OML_interlace #endif /* GL_OML_interlace */ #ifdef GL_OML_resample #endif /* GL_OML_resample */ #ifdef GL_OML_subsample #endif /* GL_OML_subsample */ #ifdef GL_PGI_misc_hints #endif /* GL_PGI_misc_hints */ #ifdef GL_PGI_vertex_hints #endif /* GL_PGI_vertex_hints */ #ifdef GL_REGAL_error_string static GLboolean _glewInit_GL_REGAL_error_string (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glErrorStringREGAL = (PFNGLERRORSTRINGREGALPROC)glewGetProcAddress((const GLubyte*)"glErrorStringREGAL")) == NULL) || r; return r; } #endif /* GL_REGAL_error_string */ #ifdef GL_REGAL_extension_query static GLboolean _glewInit_GL_REGAL_extension_query (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetExtensionREGAL = (PFNGLGETEXTENSIONREGALPROC)glewGetProcAddress((const GLubyte*)"glGetExtensionREGAL")) == NULL) || r; r = ((glIsSupportedREGAL = (PFNGLISSUPPORTEDREGALPROC)glewGetProcAddress((const GLubyte*)"glIsSupportedREGAL")) == NULL) || r; return r; } #endif /* GL_REGAL_extension_query */ #ifdef GL_REGAL_log #endif /* GL_REGAL_log */ #ifdef GL_REND_screen_coordinates #endif /* GL_REND_screen_coordinates */ #ifdef GL_S3_s3tc #endif /* GL_S3_s3tc */ #ifdef GL_SGIS_color_range #endif /* GL_SGIS_color_range */ #ifdef GL_SGIS_detail_texture static GLboolean _glewInit_GL_SGIS_detail_texture (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glDetailTexFuncSGIS = (PFNGLDETAILTEXFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glDetailTexFuncSGIS")) == NULL) || r; r = ((glGetDetailTexFuncSGIS = (PFNGLGETDETAILTEXFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glGetDetailTexFuncSGIS")) == NULL) || r; return r; } #endif /* GL_SGIS_detail_texture */ #ifdef GL_SGIS_fog_function static GLboolean _glewInit_GL_SGIS_fog_function (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glFogFuncSGIS = (PFNGLFOGFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glFogFuncSGIS")) == NULL) || r; r = ((glGetFogFuncSGIS = (PFNGLGETFOGFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glGetFogFuncSGIS")) == NULL) || r; return r; } #endif /* GL_SGIS_fog_function */ #ifdef GL_SGIS_generate_mipmap #endif /* GL_SGIS_generate_mipmap */ #ifdef GL_SGIS_multisample static GLboolean _glewInit_GL_SGIS_multisample (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glSampleMaskSGIS = (PFNGLSAMPLEMASKSGISPROC)glewGetProcAddress((const GLubyte*)"glSampleMaskSGIS")) == NULL) || r; r = ((glSamplePatternSGIS = (PFNGLSAMPLEPATTERNSGISPROC)glewGetProcAddress((const GLubyte*)"glSamplePatternSGIS")) == NULL) || r; return r; } #endif /* GL_SGIS_multisample */ #ifdef GL_SGIS_pixel_texture #endif /* GL_SGIS_pixel_texture */ #ifdef GL_SGIS_point_line_texgen #endif /* GL_SGIS_point_line_texgen */ #ifdef GL_SGIS_sharpen_texture static GLboolean _glewInit_GL_SGIS_sharpen_texture (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetSharpenTexFuncSGIS = (PFNGLGETSHARPENTEXFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glGetSharpenTexFuncSGIS")) == NULL) || r; r = ((glSharpenTexFuncSGIS = (PFNGLSHARPENTEXFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glSharpenTexFuncSGIS")) == NULL) || r; return r; } #endif /* GL_SGIS_sharpen_texture */ #ifdef GL_SGIS_texture4D static GLboolean _glewInit_GL_SGIS_texture4D (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glTexImage4DSGIS = (PFNGLTEXIMAGE4DSGISPROC)glewGetProcAddress((const GLubyte*)"glTexImage4DSGIS")) == NULL) || r; r = ((glTexSubImage4DSGIS = (PFNGLTEXSUBIMAGE4DSGISPROC)glewGetProcAddress((const GLubyte*)"glTexSubImage4DSGIS")) == NULL) || r; return r; } #endif /* GL_SGIS_texture4D */ #ifdef GL_SGIS_texture_border_clamp #endif /* GL_SGIS_texture_border_clamp */ #ifdef GL_SGIS_texture_edge_clamp #endif /* GL_SGIS_texture_edge_clamp */ #ifdef GL_SGIS_texture_filter4 static GLboolean _glewInit_GL_SGIS_texture_filter4 (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGetTexFilterFuncSGIS = (PFNGLGETTEXFILTERFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glGetTexFilterFuncSGIS")) == NULL) || r; r = ((glTexFilterFuncSGIS = (PFNGLTEXFILTERFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glTexFilterFuncSGIS")) == NULL) || r; return r; } #endif /* GL_SGIS_texture_filter4 */ #ifdef GL_SGIS_texture_lod #endif /* GL_SGIS_texture_lod */ #ifdef GL_SGIS_texture_select #endif /* GL_SGIS_texture_select */ #ifdef GL_SGIX_async static GLboolean _glewInit_GL_SGIX_async (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glAsyncMarkerSGIX = (PFNGLASYNCMARKERSGIXPROC)glewGetProcAddress((const GLubyte*)"glAsyncMarkerSGIX")) == NULL) || r; r = ((glDeleteAsyncMarkersSGIX = (PFNGLDELETEASYNCMARKERSSGIXPROC)glewGetProcAddress((const GLubyte*)"glDeleteAsyncMarkersSGIX")) == NULL) || r; r = ((glFinishAsyncSGIX = (PFNGLFINISHASYNCSGIXPROC)glewGetProcAddress((const GLubyte*)"glFinishAsyncSGIX")) == NULL) || r; r = ((glGenAsyncMarkersSGIX = (PFNGLGENASYNCMARKERSSGIXPROC)glewGetProcAddress((const GLubyte*)"glGenAsyncMarkersSGIX")) == NULL) || r; r = ((glIsAsyncMarkerSGIX = (PFNGLISASYNCMARKERSGIXPROC)glewGetProcAddress((const GLubyte*)"glIsAsyncMarkerSGIX")) == NULL) || r; r = ((glPollAsyncSGIX = (PFNGLPOLLASYNCSGIXPROC)glewGetProcAddress((const GLubyte*)"glPollAsyncSGIX")) == NULL) || r; return r; } #endif /* GL_SGIX_async */ #ifdef GL_SGIX_async_histogram #endif /* GL_SGIX_async_histogram */ #ifdef GL_SGIX_async_pixel #endif /* GL_SGIX_async_pixel */ #ifdef GL_SGIX_blend_alpha_minmax #endif /* GL_SGIX_blend_alpha_minmax */ #ifdef GL_SGIX_clipmap #endif /* GL_SGIX_clipmap */ #ifdef GL_SGIX_convolution_accuracy #endif /* GL_SGIX_convolution_accuracy */ #ifdef GL_SGIX_depth_texture #endif /* GL_SGIX_depth_texture */ #ifdef GL_SGIX_flush_raster static GLboolean _glewInit_GL_SGIX_flush_raster (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glFlushRasterSGIX = (PFNGLFLUSHRASTERSGIXPROC)glewGetProcAddress((const GLubyte*)"glFlushRasterSGIX")) == NULL) || r; return r; } #endif /* GL_SGIX_flush_raster */ #ifdef GL_SGIX_fog_offset #endif /* GL_SGIX_fog_offset */ #ifdef GL_SGIX_fog_texture static GLboolean _glewInit_GL_SGIX_fog_texture (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glTextureFogSGIX = (PFNGLTEXTUREFOGSGIXPROC)glewGetProcAddress((const GLubyte*)"glTextureFogSGIX")) == NULL) || r; return r; } #endif /* GL_SGIX_fog_texture */ #ifdef GL_SGIX_fragment_specular_lighting static GLboolean _glewInit_GL_SGIX_fragment_specular_lighting (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glFragmentColorMaterialSGIX = (PFNGLFRAGMENTCOLORMATERIALSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentColorMaterialSGIX")) == NULL) || r; r = ((glFragmentLightModelfSGIX = (PFNGLFRAGMENTLIGHTMODELFSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelfSGIX")) == NULL) || r; r = ((glFragmentLightModelfvSGIX = (PFNGLFRAGMENTLIGHTMODELFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelfvSGIX")) == NULL) || r; r = ((glFragmentLightModeliSGIX = (PFNGLFRAGMENTLIGHTMODELISGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModeliSGIX")) == NULL) || r; r = ((glFragmentLightModelivSGIX = (PFNGLFRAGMENTLIGHTMODELIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelivSGIX")) == NULL) || r; r = ((glFragmentLightfSGIX = (PFNGLFRAGMENTLIGHTFSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightfSGIX")) == NULL) || r; r = ((glFragmentLightfvSGIX = (PFNGLFRAGMENTLIGHTFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightfvSGIX")) == NULL) || r; r = ((glFragmentLightiSGIX = (PFNGLFRAGMENTLIGHTISGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightiSGIX")) == NULL) || r; r = ((glFragmentLightivSGIX = (PFNGLFRAGMENTLIGHTIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightivSGIX")) == NULL) || r; r = ((glFragmentMaterialfSGIX = (PFNGLFRAGMENTMATERIALFSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialfSGIX")) == NULL) || r; r = ((glFragmentMaterialfvSGIX = (PFNGLFRAGMENTMATERIALFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialfvSGIX")) == NULL) || r; r = ((glFragmentMaterialiSGIX = (PFNGLFRAGMENTMATERIALISGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialiSGIX")) == NULL) || r; r = ((glFragmentMaterialivSGIX = (PFNGLFRAGMENTMATERIALIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialivSGIX")) == NULL) || r; r = ((glGetFragmentLightfvSGIX = (PFNGLGETFRAGMENTLIGHTFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentLightfvSGIX")) == NULL) || r; r = ((glGetFragmentLightivSGIX = (PFNGLGETFRAGMENTLIGHTIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentLightivSGIX")) == NULL) || r; r = ((glGetFragmentMaterialfvSGIX = (PFNGLGETFRAGMENTMATERIALFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentMaterialfvSGIX")) == NULL) || r; r = ((glGetFragmentMaterialivSGIX = (PFNGLGETFRAGMENTMATERIALIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentMaterialivSGIX")) == NULL) || r; return r; } #endif /* GL_SGIX_fragment_specular_lighting */ #ifdef GL_SGIX_framezoom static GLboolean _glewInit_GL_SGIX_framezoom (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glFrameZoomSGIX = (PFNGLFRAMEZOOMSGIXPROC)glewGetProcAddress((const GLubyte*)"glFrameZoomSGIX")) == NULL) || r; return r; } #endif /* GL_SGIX_framezoom */ #ifdef GL_SGIX_interlace #endif /* GL_SGIX_interlace */ #ifdef GL_SGIX_ir_instrument1 #endif /* GL_SGIX_ir_instrument1 */ #ifdef GL_SGIX_list_priority #endif /* GL_SGIX_list_priority */ #ifdef GL_SGIX_pixel_texture static GLboolean _glewInit_GL_SGIX_pixel_texture (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glPixelTexGenSGIX = (PFNGLPIXELTEXGENSGIXPROC)glewGetProcAddress((const GLubyte*)"glPixelTexGenSGIX")) == NULL) || r; return r; } #endif /* GL_SGIX_pixel_texture */ #ifdef GL_SGIX_pixel_texture_bits #endif /* GL_SGIX_pixel_texture_bits */ #ifdef GL_SGIX_reference_plane static GLboolean _glewInit_GL_SGIX_reference_plane (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glReferencePlaneSGIX = (PFNGLREFERENCEPLANESGIXPROC)glewGetProcAddress((const GLubyte*)"glReferencePlaneSGIX")) == NULL) || r; return r; } #endif /* GL_SGIX_reference_plane */ #ifdef GL_SGIX_resample #endif /* GL_SGIX_resample */ #ifdef GL_SGIX_shadow #endif /* GL_SGIX_shadow */ #ifdef GL_SGIX_shadow_ambient #endif /* GL_SGIX_shadow_ambient */ #ifdef GL_SGIX_sprite static GLboolean _glewInit_GL_SGIX_sprite (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glSpriteParameterfSGIX = (PFNGLSPRITEPARAMETERFSGIXPROC)glewGetProcAddress((const GLubyte*)"glSpriteParameterfSGIX")) == NULL) || r; r = ((glSpriteParameterfvSGIX = (PFNGLSPRITEPARAMETERFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glSpriteParameterfvSGIX")) == NULL) || r; r = ((glSpriteParameteriSGIX = (PFNGLSPRITEPARAMETERISGIXPROC)glewGetProcAddress((const GLubyte*)"glSpriteParameteriSGIX")) == NULL) || r; r = ((glSpriteParameterivSGIX = (PFNGLSPRITEPARAMETERIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glSpriteParameterivSGIX")) == NULL) || r; return r; } #endif /* GL_SGIX_sprite */ #ifdef GL_SGIX_tag_sample_buffer static GLboolean _glewInit_GL_SGIX_tag_sample_buffer (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glTagSampleBufferSGIX = (PFNGLTAGSAMPLEBUFFERSGIXPROC)glewGetProcAddress((const GLubyte*)"glTagSampleBufferSGIX")) == NULL) || r; return r; } #endif /* GL_SGIX_tag_sample_buffer */ #ifdef GL_SGIX_texture_add_env #endif /* GL_SGIX_texture_add_env */ #ifdef GL_SGIX_texture_coordinate_clamp #endif /* GL_SGIX_texture_coordinate_clamp */ #ifdef GL_SGIX_texture_lod_bias #endif /* GL_SGIX_texture_lod_bias */ #ifdef GL_SGIX_texture_multi_buffer #endif /* GL_SGIX_texture_multi_buffer */ #ifdef GL_SGIX_texture_range #endif /* GL_SGIX_texture_range */ #ifdef GL_SGIX_texture_scale_bias #endif /* GL_SGIX_texture_scale_bias */ #ifdef GL_SGIX_vertex_preclip #endif /* GL_SGIX_vertex_preclip */ #ifdef GL_SGIX_vertex_preclip_hint #endif /* GL_SGIX_vertex_preclip_hint */ #ifdef GL_SGIX_ycrcb #endif /* GL_SGIX_ycrcb */ #ifdef GL_SGI_color_matrix #endif /* GL_SGI_color_matrix */ #ifdef GL_SGI_color_table static GLboolean _glewInit_GL_SGI_color_table (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glColorTableParameterfvSGI = (PFNGLCOLORTABLEPARAMETERFVSGIPROC)glewGetProcAddress((const GLubyte*)"glColorTableParameterfvSGI")) == NULL) || r; r = ((glColorTableParameterivSGI = (PFNGLCOLORTABLEPARAMETERIVSGIPROC)glewGetProcAddress((const GLubyte*)"glColorTableParameterivSGI")) == NULL) || r; r = ((glColorTableSGI = (PFNGLCOLORTABLESGIPROC)glewGetProcAddress((const GLubyte*)"glColorTableSGI")) == NULL) || r; r = ((glCopyColorTableSGI = (PFNGLCOPYCOLORTABLESGIPROC)glewGetProcAddress((const GLubyte*)"glCopyColorTableSGI")) == NULL) || r; r = ((glGetColorTableParameterfvSGI = (PFNGLGETCOLORTABLEPARAMETERFVSGIPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameterfvSGI")) == NULL) || r; r = ((glGetColorTableParameterivSGI = (PFNGLGETCOLORTABLEPARAMETERIVSGIPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameterivSGI")) == NULL) || r; r = ((glGetColorTableSGI = (PFNGLGETCOLORTABLESGIPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableSGI")) == NULL) || r; return r; } #endif /* GL_SGI_color_table */ #ifdef GL_SGI_texture_color_table #endif /* GL_SGI_texture_color_table */ #ifdef GL_SUNX_constant_data static GLboolean _glewInit_GL_SUNX_constant_data (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glFinishTextureSUNX = (PFNGLFINISHTEXTURESUNXPROC)glewGetProcAddress((const GLubyte*)"glFinishTextureSUNX")) == NULL) || r; return r; } #endif /* GL_SUNX_constant_data */ #ifdef GL_SUN_convolution_border_modes #endif /* GL_SUN_convolution_border_modes */ #ifdef GL_SUN_global_alpha static GLboolean _glewInit_GL_SUN_global_alpha (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glGlobalAlphaFactorbSUN = (PFNGLGLOBALALPHAFACTORBSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactorbSUN")) == NULL) || r; r = ((glGlobalAlphaFactordSUN = (PFNGLGLOBALALPHAFACTORDSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactordSUN")) == NULL) || r; r = ((glGlobalAlphaFactorfSUN = (PFNGLGLOBALALPHAFACTORFSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactorfSUN")) == NULL) || r; r = ((glGlobalAlphaFactoriSUN = (PFNGLGLOBALALPHAFACTORISUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactoriSUN")) == NULL) || r; r = ((glGlobalAlphaFactorsSUN = (PFNGLGLOBALALPHAFACTORSSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactorsSUN")) == NULL) || r; r = ((glGlobalAlphaFactorubSUN = (PFNGLGLOBALALPHAFACTORUBSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactorubSUN")) == NULL) || r; r = ((glGlobalAlphaFactoruiSUN = (PFNGLGLOBALALPHAFACTORUISUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactoruiSUN")) == NULL) || r; r = ((glGlobalAlphaFactorusSUN = (PFNGLGLOBALALPHAFACTORUSSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactorusSUN")) == NULL) || r; return r; } #endif /* GL_SUN_global_alpha */ #ifdef GL_SUN_mesh_array #endif /* GL_SUN_mesh_array */ #ifdef GL_SUN_read_video_pixels static GLboolean _glewInit_GL_SUN_read_video_pixels (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glReadVideoPixelsSUN = (PFNGLREADVIDEOPIXELSSUNPROC)glewGetProcAddress((const GLubyte*)"glReadVideoPixelsSUN")) == NULL) || r; return r; } #endif /* GL_SUN_read_video_pixels */ #ifdef GL_SUN_slice_accum #endif /* GL_SUN_slice_accum */ #ifdef GL_SUN_triangle_list static GLboolean _glewInit_GL_SUN_triangle_list (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glReplacementCodePointerSUN = (PFNGLREPLACEMENTCODEPOINTERSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodePointerSUN")) == NULL) || r; r = ((glReplacementCodeubSUN = (PFNGLREPLACEMENTCODEUBSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeubSUN")) == NULL) || r; r = ((glReplacementCodeubvSUN = (PFNGLREPLACEMENTCODEUBVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeubvSUN")) == NULL) || r; r = ((glReplacementCodeuiSUN = (PFNGLREPLACEMENTCODEUISUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiSUN")) == NULL) || r; r = ((glReplacementCodeuivSUN = (PFNGLREPLACEMENTCODEUIVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuivSUN")) == NULL) || r; r = ((glReplacementCodeusSUN = (PFNGLREPLACEMENTCODEUSSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeusSUN")) == NULL) || r; r = ((glReplacementCodeusvSUN = (PFNGLREPLACEMENTCODEUSVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeusvSUN")) == NULL) || r; return r; } #endif /* GL_SUN_triangle_list */ #ifdef GL_SUN_vertex static GLboolean _glewInit_GL_SUN_vertex (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glColor3fVertex3fSUN = (PFNGLCOLOR3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glColor3fVertex3fSUN")) == NULL) || r; r = ((glColor3fVertex3fvSUN = (PFNGLCOLOR3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glColor3fVertex3fvSUN")) == NULL) || r; r = ((glColor4fNormal3fVertex3fSUN = (PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4fNormal3fVertex3fSUN")) == NULL) || r; r = ((glColor4fNormal3fVertex3fvSUN = (PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4fNormal3fVertex3fvSUN")) == NULL) || r; r = ((glColor4ubVertex2fSUN = (PFNGLCOLOR4UBVERTEX2FSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4ubVertex2fSUN")) == NULL) || r; r = ((glColor4ubVertex2fvSUN = (PFNGLCOLOR4UBVERTEX2FVSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4ubVertex2fvSUN")) == NULL) || r; r = ((glColor4ubVertex3fSUN = (PFNGLCOLOR4UBVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4ubVertex3fSUN")) == NULL) || r; r = ((glColor4ubVertex3fvSUN = (PFNGLCOLOR4UBVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4ubVertex3fvSUN")) == NULL) || r; r = ((glNormal3fVertex3fSUN = (PFNGLNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glNormal3fVertex3fSUN")) == NULL) || r; r = ((glNormal3fVertex3fvSUN = (PFNGLNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glNormal3fVertex3fvSUN")) == NULL) || r; r = ((glReplacementCodeuiColor3fVertex3fSUN = (PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor3fVertex3fSUN")) == NULL) || r; r = ((glReplacementCodeuiColor3fVertex3fvSUN = (PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor3fVertex3fvSUN")) == NULL) || r; r = ((glReplacementCodeuiColor4fNormal3fVertex3fSUN = (PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor4fNormal3fVertex3fSUN")) == NULL) || r; r = ((glReplacementCodeuiColor4fNormal3fVertex3fvSUN = (PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor4fNormal3fVertex3fvSUN")) == NULL) || r; r = ((glReplacementCodeuiColor4ubVertex3fSUN = (PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor4ubVertex3fSUN")) == NULL) || r; r = ((glReplacementCodeuiColor4ubVertex3fvSUN = (PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor4ubVertex3fvSUN")) == NULL) || r; r = ((glReplacementCodeuiNormal3fVertex3fSUN = (PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiNormal3fVertex3fSUN")) == NULL) || r; r = ((glReplacementCodeuiNormal3fVertex3fvSUN = (PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiNormal3fVertex3fvSUN")) == NULL) || r; r = ((glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN")) == NULL) || r; r = ((glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN")) == NULL) || r; r = ((glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN")) == NULL) || r; r = ((glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN")) == NULL) || r; r = ((glReplacementCodeuiTexCoord2fVertex3fSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fVertex3fSUN")) == NULL) || r; r = ((glReplacementCodeuiTexCoord2fVertex3fvSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fVertex3fvSUN")) == NULL) || r; r = ((glReplacementCodeuiVertex3fSUN = (PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiVertex3fSUN")) == NULL) || r; r = ((glReplacementCodeuiVertex3fvSUN = (PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiVertex3fvSUN")) == NULL) || r; r = ((glTexCoord2fColor3fVertex3fSUN = (PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor3fVertex3fSUN")) == NULL) || r; r = ((glTexCoord2fColor3fVertex3fvSUN = (PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor3fVertex3fvSUN")) == NULL) || r; r = ((glTexCoord2fColor4fNormal3fVertex3fSUN = (PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor4fNormal3fVertex3fSUN")) == NULL) || r; r = ((glTexCoord2fColor4fNormal3fVertex3fvSUN = (PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor4fNormal3fVertex3fvSUN")) == NULL) || r; r = ((glTexCoord2fColor4ubVertex3fSUN = (PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor4ubVertex3fSUN")) == NULL) || r; r = ((glTexCoord2fColor4ubVertex3fvSUN = (PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor4ubVertex3fvSUN")) == NULL) || r; r = ((glTexCoord2fNormal3fVertex3fSUN = (PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fNormal3fVertex3fSUN")) == NULL) || r; r = ((glTexCoord2fNormal3fVertex3fvSUN = (PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fNormal3fVertex3fvSUN")) == NULL) || r; r = ((glTexCoord2fVertex3fSUN = (PFNGLTEXCOORD2FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fVertex3fSUN")) == NULL) || r; r = ((glTexCoord2fVertex3fvSUN = (PFNGLTEXCOORD2FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fVertex3fvSUN")) == NULL) || r; r = ((glTexCoord4fColor4fNormal3fVertex4fSUN = (PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4fColor4fNormal3fVertex4fSUN")) == NULL) || r; r = ((glTexCoord4fColor4fNormal3fVertex4fvSUN = (PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4fColor4fNormal3fVertex4fvSUN")) == NULL) || r; r = ((glTexCoord4fVertex4fSUN = (PFNGLTEXCOORD4FVERTEX4FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4fVertex4fSUN")) == NULL) || r; r = ((glTexCoord4fVertex4fvSUN = (PFNGLTEXCOORD4FVERTEX4FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4fVertex4fvSUN")) == NULL) || r; return r; } #endif /* GL_SUN_vertex */ #ifdef GL_WIN_phong_shading #endif /* GL_WIN_phong_shading */ #ifdef GL_WIN_specular_fog #endif /* GL_WIN_specular_fog */ #ifdef GL_WIN_swap_hint static GLboolean _glewInit_GL_WIN_swap_hint (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glAddSwapHintRectWIN = (PFNGLADDSWAPHINTRECTWINPROC)glewGetProcAddress((const GLubyte*)"glAddSwapHintRectWIN")) == NULL) || r; return r; } #endif /* GL_WIN_swap_hint */ /* ------------------------------------------------------------------------- */ GLboolean GLEWAPIENTRY glewGetExtension (const char* name) { const GLubyte* start; const GLubyte* end; start = (const GLubyte*)glGetString(GL_EXTENSIONS); if (start == 0) return GL_FALSE; end = start + _glewStrLen(start); return _glewSearchExtension(name, start, end); } /* ------------------------------------------------------------------------- */ #ifndef GLEW_MX static #endif GLenum GLEWAPIENTRY glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST) { const GLubyte* s; GLuint dot; GLint major, minor; const GLubyte* extStart; const GLubyte* extEnd; /* query opengl version */ s = glGetString(GL_VERSION); dot = _glewStrCLen(s, '.'); if (dot == 0) return GLEW_ERROR_NO_GL_VERSION; major = s[dot-1]-'0'; minor = s[dot+1]-'0'; if (minor < 0 || minor > 9) minor = 0; if (major<0 || major>9) return GLEW_ERROR_NO_GL_VERSION; if (major == 1 && minor == 0) { return GLEW_ERROR_GL_VERSION_10_ONLY; } else { CONST_CAST(GLEW_VERSION_4_3) = ( major > 4 ) || ( major == 4 && minor >= 3 ) ? GL_TRUE : GL_FALSE; CONST_CAST(GLEW_VERSION_4_2) = GLEW_VERSION_4_3 == GL_TRUE || ( major == 4 && minor >= 2 ) ? GL_TRUE : GL_FALSE; CONST_CAST(GLEW_VERSION_4_1) = GLEW_VERSION_4_2 == GL_TRUE || ( major == 4 && minor >= 1 ) ? GL_TRUE : GL_FALSE; CONST_CAST(GLEW_VERSION_4_0) = GLEW_VERSION_4_1 == GL_TRUE || ( major == 4 ) ? GL_TRUE : GL_FALSE; CONST_CAST(GLEW_VERSION_3_3) = GLEW_VERSION_4_0 == GL_TRUE || ( major == 3 && minor >= 3 ) ? GL_TRUE : GL_FALSE; CONST_CAST(GLEW_VERSION_3_2) = GLEW_VERSION_3_3 == GL_TRUE || ( major == 3 && minor >= 2 ) ? GL_TRUE : GL_FALSE; CONST_CAST(GLEW_VERSION_3_1) = GLEW_VERSION_3_2 == GL_TRUE || ( major == 3 && minor >= 1 ) ? GL_TRUE : GL_FALSE; CONST_CAST(GLEW_VERSION_3_0) = GLEW_VERSION_3_1 == GL_TRUE || ( major == 3 ) ? GL_TRUE : GL_FALSE; CONST_CAST(GLEW_VERSION_2_1) = GLEW_VERSION_3_0 == GL_TRUE || ( major == 2 && minor >= 1 ) ? GL_TRUE : GL_FALSE; CONST_CAST(GLEW_VERSION_2_0) = GLEW_VERSION_2_1 == GL_TRUE || ( major == 2 ) ? GL_TRUE : GL_FALSE; CONST_CAST(GLEW_VERSION_1_5) = GLEW_VERSION_2_0 == GL_TRUE || ( major == 1 && minor >= 5 ) ? GL_TRUE : GL_FALSE; CONST_CAST(GLEW_VERSION_1_4) = GLEW_VERSION_1_5 == GL_TRUE || ( major == 1 && minor >= 4 ) ? GL_TRUE : GL_FALSE; CONST_CAST(GLEW_VERSION_1_3) = GLEW_VERSION_1_4 == GL_TRUE || ( major == 1 && minor >= 3 ) ? GL_TRUE : GL_FALSE; CONST_CAST(GLEW_VERSION_1_2_1) = GLEW_VERSION_1_3 == GL_TRUE ? GL_TRUE : GL_FALSE; CONST_CAST(GLEW_VERSION_1_2) = GLEW_VERSION_1_2_1 == GL_TRUE || ( major == 1 && minor >= 2 ) ? GL_TRUE : GL_FALSE; CONST_CAST(GLEW_VERSION_1_1) = GLEW_VERSION_1_2 == GL_TRUE || ( major == 1 && minor >= 1 ) ? GL_TRUE : GL_FALSE; } /* query opengl extensions string */ extStart = glGetString(GL_EXTENSIONS); if (extStart == 0) extStart = (const GLubyte*)""; extEnd = extStart + _glewStrLen(extStart); /* initialize extensions */ #ifdef GL_VERSION_1_2 if (glewExperimental || GLEW_VERSION_1_2) CONST_CAST(GLEW_VERSION_1_2) = !_glewInit_GL_VERSION_1_2(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_VERSION_1_2 */ #ifdef GL_VERSION_1_2_1 #endif /* GL_VERSION_1_2_1 */ #ifdef GL_VERSION_1_3 if (glewExperimental || GLEW_VERSION_1_3) CONST_CAST(GLEW_VERSION_1_3) = !_glewInit_GL_VERSION_1_3(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_VERSION_1_3 */ #ifdef GL_VERSION_1_4 if (glewExperimental || GLEW_VERSION_1_4) CONST_CAST(GLEW_VERSION_1_4) = !_glewInit_GL_VERSION_1_4(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_VERSION_1_4 */ #ifdef GL_VERSION_1_5 if (glewExperimental || GLEW_VERSION_1_5) CONST_CAST(GLEW_VERSION_1_5) = !_glewInit_GL_VERSION_1_5(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_VERSION_1_5 */ #ifdef GL_VERSION_2_0 if (glewExperimental || GLEW_VERSION_2_0) CONST_CAST(GLEW_VERSION_2_0) = !_glewInit_GL_VERSION_2_0(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_VERSION_2_0 */ #ifdef GL_VERSION_2_1 if (glewExperimental || GLEW_VERSION_2_1) CONST_CAST(GLEW_VERSION_2_1) = !_glewInit_GL_VERSION_2_1(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_VERSION_2_1 */ #ifdef GL_VERSION_3_0 if (glewExperimental || GLEW_VERSION_3_0) CONST_CAST(GLEW_VERSION_3_0) = !_glewInit_GL_VERSION_3_0(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_VERSION_3_0 */ #ifdef GL_VERSION_3_1 if (glewExperimental || GLEW_VERSION_3_1) CONST_CAST(GLEW_VERSION_3_1) = !_glewInit_GL_VERSION_3_1(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_VERSION_3_1 */ #ifdef GL_VERSION_3_2 if (glewExperimental || GLEW_VERSION_3_2) CONST_CAST(GLEW_VERSION_3_2) = !_glewInit_GL_VERSION_3_2(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_VERSION_3_2 */ #ifdef GL_VERSION_3_3 if (glewExperimental || GLEW_VERSION_3_3) CONST_CAST(GLEW_VERSION_3_3) = !_glewInit_GL_VERSION_3_3(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_VERSION_3_3 */ #ifdef GL_VERSION_4_0 if (glewExperimental || GLEW_VERSION_4_0) CONST_CAST(GLEW_VERSION_4_0) = !_glewInit_GL_VERSION_4_0(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_VERSION_4_0 */ #ifdef GL_VERSION_4_1 #endif /* GL_VERSION_4_1 */ #ifdef GL_VERSION_4_2 #endif /* GL_VERSION_4_2 */ #ifdef GL_VERSION_4_3 #endif /* GL_VERSION_4_3 */ #ifdef GL_3DFX_multisample CONST_CAST(GLEW_3DFX_multisample) = _glewSearchExtension("GL_3DFX_multisample", extStart, extEnd); #endif /* GL_3DFX_multisample */ #ifdef GL_3DFX_tbuffer CONST_CAST(GLEW_3DFX_tbuffer) = _glewSearchExtension("GL_3DFX_tbuffer", extStart, extEnd); if (glewExperimental || GLEW_3DFX_tbuffer) CONST_CAST(GLEW_3DFX_tbuffer) = !_glewInit_GL_3DFX_tbuffer(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_3DFX_tbuffer */ #ifdef GL_3DFX_texture_compression_FXT1 CONST_CAST(GLEW_3DFX_texture_compression_FXT1) = _glewSearchExtension("GL_3DFX_texture_compression_FXT1", extStart, extEnd); #endif /* GL_3DFX_texture_compression_FXT1 */ #ifdef GL_AMD_blend_minmax_factor CONST_CAST(GLEW_AMD_blend_minmax_factor) = _glewSearchExtension("GL_AMD_blend_minmax_factor", extStart, extEnd); #endif /* GL_AMD_blend_minmax_factor */ #ifdef GL_AMD_conservative_depth CONST_CAST(GLEW_AMD_conservative_depth) = _glewSearchExtension("GL_AMD_conservative_depth", extStart, extEnd); #endif /* GL_AMD_conservative_depth */ #ifdef GL_AMD_debug_output CONST_CAST(GLEW_AMD_debug_output) = _glewSearchExtension("GL_AMD_debug_output", extStart, extEnd); if (glewExperimental || GLEW_AMD_debug_output) CONST_CAST(GLEW_AMD_debug_output) = !_glewInit_GL_AMD_debug_output(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_AMD_debug_output */ #ifdef GL_AMD_depth_clamp_separate CONST_CAST(GLEW_AMD_depth_clamp_separate) = _glewSearchExtension("GL_AMD_depth_clamp_separate", extStart, extEnd); #endif /* GL_AMD_depth_clamp_separate */ #ifdef GL_AMD_draw_buffers_blend CONST_CAST(GLEW_AMD_draw_buffers_blend) = _glewSearchExtension("GL_AMD_draw_buffers_blend", extStart, extEnd); if (glewExperimental || GLEW_AMD_draw_buffers_blend) CONST_CAST(GLEW_AMD_draw_buffers_blend) = !_glewInit_GL_AMD_draw_buffers_blend(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_AMD_draw_buffers_blend */ #ifdef GL_AMD_multi_draw_indirect CONST_CAST(GLEW_AMD_multi_draw_indirect) = _glewSearchExtension("GL_AMD_multi_draw_indirect", extStart, extEnd); if (glewExperimental || GLEW_AMD_multi_draw_indirect) CONST_CAST(GLEW_AMD_multi_draw_indirect) = !_glewInit_GL_AMD_multi_draw_indirect(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_AMD_multi_draw_indirect */ #ifdef GL_AMD_name_gen_delete CONST_CAST(GLEW_AMD_name_gen_delete) = _glewSearchExtension("GL_AMD_name_gen_delete", extStart, extEnd); if (glewExperimental || GLEW_AMD_name_gen_delete) CONST_CAST(GLEW_AMD_name_gen_delete) = !_glewInit_GL_AMD_name_gen_delete(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_AMD_name_gen_delete */ #ifdef GL_AMD_performance_monitor CONST_CAST(GLEW_AMD_performance_monitor) = _glewSearchExtension("GL_AMD_performance_monitor", extStart, extEnd); if (glewExperimental || GLEW_AMD_performance_monitor) CONST_CAST(GLEW_AMD_performance_monitor) = !_glewInit_GL_AMD_performance_monitor(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_AMD_performance_monitor */ #ifdef GL_AMD_pinned_memory CONST_CAST(GLEW_AMD_pinned_memory) = _glewSearchExtension("GL_AMD_pinned_memory", extStart, extEnd); #endif /* GL_AMD_pinned_memory */ #ifdef GL_AMD_query_buffer_object CONST_CAST(GLEW_AMD_query_buffer_object) = _glewSearchExtension("GL_AMD_query_buffer_object", extStart, extEnd); #endif /* GL_AMD_query_buffer_object */ #ifdef GL_AMD_sample_positions CONST_CAST(GLEW_AMD_sample_positions) = _glewSearchExtension("GL_AMD_sample_positions", extStart, extEnd); if (glewExperimental || GLEW_AMD_sample_positions) CONST_CAST(GLEW_AMD_sample_positions) = !_glewInit_GL_AMD_sample_positions(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_AMD_sample_positions */ #ifdef GL_AMD_seamless_cubemap_per_texture CONST_CAST(GLEW_AMD_seamless_cubemap_per_texture) = _glewSearchExtension("GL_AMD_seamless_cubemap_per_texture", extStart, extEnd); #endif /* GL_AMD_seamless_cubemap_per_texture */ #ifdef GL_AMD_shader_stencil_export CONST_CAST(GLEW_AMD_shader_stencil_export) = _glewSearchExtension("GL_AMD_shader_stencil_export", extStart, extEnd); #endif /* GL_AMD_shader_stencil_export */ #ifdef GL_AMD_stencil_operation_extended CONST_CAST(GLEW_AMD_stencil_operation_extended) = _glewSearchExtension("GL_AMD_stencil_operation_extended", extStart, extEnd); if (glewExperimental || GLEW_AMD_stencil_operation_extended) CONST_CAST(GLEW_AMD_stencil_operation_extended) = !_glewInit_GL_AMD_stencil_operation_extended(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_AMD_stencil_operation_extended */ #ifdef GL_AMD_texture_texture4 CONST_CAST(GLEW_AMD_texture_texture4) = _glewSearchExtension("GL_AMD_texture_texture4", extStart, extEnd); #endif /* GL_AMD_texture_texture4 */ #ifdef GL_AMD_transform_feedback3_lines_triangles CONST_CAST(GLEW_AMD_transform_feedback3_lines_triangles) = _glewSearchExtension("GL_AMD_transform_feedback3_lines_triangles", extStart, extEnd); #endif /* GL_AMD_transform_feedback3_lines_triangles */ #ifdef GL_AMD_vertex_shader_layer CONST_CAST(GLEW_AMD_vertex_shader_layer) = _glewSearchExtension("GL_AMD_vertex_shader_layer", extStart, extEnd); #endif /* GL_AMD_vertex_shader_layer */ #ifdef GL_AMD_vertex_shader_tessellator CONST_CAST(GLEW_AMD_vertex_shader_tessellator) = _glewSearchExtension("GL_AMD_vertex_shader_tessellator", extStart, extEnd); if (glewExperimental || GLEW_AMD_vertex_shader_tessellator) CONST_CAST(GLEW_AMD_vertex_shader_tessellator) = !_glewInit_GL_AMD_vertex_shader_tessellator(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_AMD_vertex_shader_tessellator */ #ifdef GL_AMD_vertex_shader_viewport_index CONST_CAST(GLEW_AMD_vertex_shader_viewport_index) = _glewSearchExtension("GL_AMD_vertex_shader_viewport_index", extStart, extEnd); #endif /* GL_AMD_vertex_shader_viewport_index */ #ifdef GL_APPLE_aux_depth_stencil CONST_CAST(GLEW_APPLE_aux_depth_stencil) = _glewSearchExtension("GL_APPLE_aux_depth_stencil", extStart, extEnd); #endif /* GL_APPLE_aux_depth_stencil */ #ifdef GL_APPLE_client_storage CONST_CAST(GLEW_APPLE_client_storage) = _glewSearchExtension("GL_APPLE_client_storage", extStart, extEnd); #endif /* GL_APPLE_client_storage */ #ifdef GL_APPLE_element_array CONST_CAST(GLEW_APPLE_element_array) = _glewSearchExtension("GL_APPLE_element_array", extStart, extEnd); if (glewExperimental || GLEW_APPLE_element_array) CONST_CAST(GLEW_APPLE_element_array) = !_glewInit_GL_APPLE_element_array(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_APPLE_element_array */ #ifdef GL_APPLE_fence CONST_CAST(GLEW_APPLE_fence) = _glewSearchExtension("GL_APPLE_fence", extStart, extEnd); if (glewExperimental || GLEW_APPLE_fence) CONST_CAST(GLEW_APPLE_fence) = !_glewInit_GL_APPLE_fence(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_APPLE_fence */ #ifdef GL_APPLE_float_pixels CONST_CAST(GLEW_APPLE_float_pixels) = _glewSearchExtension("GL_APPLE_float_pixels", extStart, extEnd); #endif /* GL_APPLE_float_pixels */ #ifdef GL_APPLE_flush_buffer_range CONST_CAST(GLEW_APPLE_flush_buffer_range) = _glewSearchExtension("GL_APPLE_flush_buffer_range", extStart, extEnd); if (glewExperimental || GLEW_APPLE_flush_buffer_range) CONST_CAST(GLEW_APPLE_flush_buffer_range) = !_glewInit_GL_APPLE_flush_buffer_range(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_APPLE_flush_buffer_range */ #ifdef GL_APPLE_object_purgeable CONST_CAST(GLEW_APPLE_object_purgeable) = _glewSearchExtension("GL_APPLE_object_purgeable", extStart, extEnd); if (glewExperimental || GLEW_APPLE_object_purgeable) CONST_CAST(GLEW_APPLE_object_purgeable) = !_glewInit_GL_APPLE_object_purgeable(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_APPLE_object_purgeable */ #ifdef GL_APPLE_pixel_buffer CONST_CAST(GLEW_APPLE_pixel_buffer) = _glewSearchExtension("GL_APPLE_pixel_buffer", extStart, extEnd); #endif /* GL_APPLE_pixel_buffer */ #ifdef GL_APPLE_rgb_422 CONST_CAST(GLEW_APPLE_rgb_422) = _glewSearchExtension("GL_APPLE_rgb_422", extStart, extEnd); #endif /* GL_APPLE_rgb_422 */ #ifdef GL_APPLE_row_bytes CONST_CAST(GLEW_APPLE_row_bytes) = _glewSearchExtension("GL_APPLE_row_bytes", extStart, extEnd); #endif /* GL_APPLE_row_bytes */ #ifdef GL_APPLE_specular_vector CONST_CAST(GLEW_APPLE_specular_vector) = _glewSearchExtension("GL_APPLE_specular_vector", extStart, extEnd); #endif /* GL_APPLE_specular_vector */ #ifdef GL_APPLE_texture_range CONST_CAST(GLEW_APPLE_texture_range) = _glewSearchExtension("GL_APPLE_texture_range", extStart, extEnd); if (glewExperimental || GLEW_APPLE_texture_range) CONST_CAST(GLEW_APPLE_texture_range) = !_glewInit_GL_APPLE_texture_range(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_APPLE_texture_range */ #ifdef GL_APPLE_transform_hint CONST_CAST(GLEW_APPLE_transform_hint) = _glewSearchExtension("GL_APPLE_transform_hint", extStart, extEnd); #endif /* GL_APPLE_transform_hint */ #ifdef GL_APPLE_vertex_array_object CONST_CAST(GLEW_APPLE_vertex_array_object) = _glewSearchExtension("GL_APPLE_vertex_array_object", extStart, extEnd); if (glewExperimental || GLEW_APPLE_vertex_array_object) CONST_CAST(GLEW_APPLE_vertex_array_object) = !_glewInit_GL_APPLE_vertex_array_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_APPLE_vertex_array_object */ #ifdef GL_APPLE_vertex_array_range CONST_CAST(GLEW_APPLE_vertex_array_range) = _glewSearchExtension("GL_APPLE_vertex_array_range", extStart, extEnd); if (glewExperimental || GLEW_APPLE_vertex_array_range) CONST_CAST(GLEW_APPLE_vertex_array_range) = !_glewInit_GL_APPLE_vertex_array_range(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_APPLE_vertex_array_range */ #ifdef GL_APPLE_vertex_program_evaluators CONST_CAST(GLEW_APPLE_vertex_program_evaluators) = _glewSearchExtension("GL_APPLE_vertex_program_evaluators", extStart, extEnd); if (glewExperimental || GLEW_APPLE_vertex_program_evaluators) CONST_CAST(GLEW_APPLE_vertex_program_evaluators) = !_glewInit_GL_APPLE_vertex_program_evaluators(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_APPLE_vertex_program_evaluators */ #ifdef GL_APPLE_ycbcr_422 CONST_CAST(GLEW_APPLE_ycbcr_422) = _glewSearchExtension("GL_APPLE_ycbcr_422", extStart, extEnd); #endif /* GL_APPLE_ycbcr_422 */ #ifdef GL_ARB_ES2_compatibility CONST_CAST(GLEW_ARB_ES2_compatibility) = _glewSearchExtension("GL_ARB_ES2_compatibility", extStart, extEnd); if (glewExperimental || GLEW_ARB_ES2_compatibility) CONST_CAST(GLEW_ARB_ES2_compatibility) = !_glewInit_GL_ARB_ES2_compatibility(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_ES2_compatibility */ #ifdef GL_ARB_ES3_compatibility CONST_CAST(GLEW_ARB_ES3_compatibility) = _glewSearchExtension("GL_ARB_ES3_compatibility", extStart, extEnd); #endif /* GL_ARB_ES3_compatibility */ #ifdef GL_ARB_arrays_of_arrays CONST_CAST(GLEW_ARB_arrays_of_arrays) = _glewSearchExtension("GL_ARB_arrays_of_arrays", extStart, extEnd); #endif /* GL_ARB_arrays_of_arrays */ #ifdef GL_ARB_base_instance CONST_CAST(GLEW_ARB_base_instance) = _glewSearchExtension("GL_ARB_base_instance", extStart, extEnd); if (glewExperimental || GLEW_ARB_base_instance) CONST_CAST(GLEW_ARB_base_instance) = !_glewInit_GL_ARB_base_instance(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_base_instance */ #ifdef GL_ARB_blend_func_extended CONST_CAST(GLEW_ARB_blend_func_extended) = _glewSearchExtension("GL_ARB_blend_func_extended", extStart, extEnd); if (glewExperimental || GLEW_ARB_blend_func_extended) CONST_CAST(GLEW_ARB_blend_func_extended) = !_glewInit_GL_ARB_blend_func_extended(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_blend_func_extended */ #ifdef GL_ARB_cl_event CONST_CAST(GLEW_ARB_cl_event) = _glewSearchExtension("GL_ARB_cl_event", extStart, extEnd); if (glewExperimental || GLEW_ARB_cl_event) CONST_CAST(GLEW_ARB_cl_event) = !_glewInit_GL_ARB_cl_event(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_cl_event */ #ifdef GL_ARB_clear_buffer_object CONST_CAST(GLEW_ARB_clear_buffer_object) = _glewSearchExtension("GL_ARB_clear_buffer_object", extStart, extEnd); if (glewExperimental || GLEW_ARB_clear_buffer_object) CONST_CAST(GLEW_ARB_clear_buffer_object) = !_glewInit_GL_ARB_clear_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_clear_buffer_object */ #ifdef GL_ARB_color_buffer_float CONST_CAST(GLEW_ARB_color_buffer_float) = _glewSearchExtension("GL_ARB_color_buffer_float", extStart, extEnd); if (glewExperimental || GLEW_ARB_color_buffer_float) CONST_CAST(GLEW_ARB_color_buffer_float) = !_glewInit_GL_ARB_color_buffer_float(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_color_buffer_float */ #ifdef GL_ARB_compatibility CONST_CAST(GLEW_ARB_compatibility) = _glewSearchExtension("GL_ARB_compatibility", extStart, extEnd); #endif /* GL_ARB_compatibility */ #ifdef GL_ARB_compressed_texture_pixel_storage CONST_CAST(GLEW_ARB_compressed_texture_pixel_storage) = _glewSearchExtension("GL_ARB_compressed_texture_pixel_storage", extStart, extEnd); #endif /* GL_ARB_compressed_texture_pixel_storage */ #ifdef GL_ARB_compute_shader CONST_CAST(GLEW_ARB_compute_shader) = _glewSearchExtension("GL_ARB_compute_shader", extStart, extEnd); if (glewExperimental || GLEW_ARB_compute_shader) CONST_CAST(GLEW_ARB_compute_shader) = !_glewInit_GL_ARB_compute_shader(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_compute_shader */ #ifdef GL_ARB_conservative_depth CONST_CAST(GLEW_ARB_conservative_depth) = _glewSearchExtension("GL_ARB_conservative_depth", extStart, extEnd); #endif /* GL_ARB_conservative_depth */ #ifdef GL_ARB_copy_buffer CONST_CAST(GLEW_ARB_copy_buffer) = _glewSearchExtension("GL_ARB_copy_buffer", extStart, extEnd); if (glewExperimental || GLEW_ARB_copy_buffer) CONST_CAST(GLEW_ARB_copy_buffer) = !_glewInit_GL_ARB_copy_buffer(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_copy_buffer */ #ifdef GL_ARB_copy_image CONST_CAST(GLEW_ARB_copy_image) = _glewSearchExtension("GL_ARB_copy_image", extStart, extEnd); if (glewExperimental || GLEW_ARB_copy_image) CONST_CAST(GLEW_ARB_copy_image) = !_glewInit_GL_ARB_copy_image(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_copy_image */ #ifdef GL_ARB_debug_output CONST_CAST(GLEW_ARB_debug_output) = _glewSearchExtension("GL_ARB_debug_output", extStart, extEnd); if (glewExperimental || GLEW_ARB_debug_output) CONST_CAST(GLEW_ARB_debug_output) = !_glewInit_GL_ARB_debug_output(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_debug_output */ #ifdef GL_ARB_depth_buffer_float CONST_CAST(GLEW_ARB_depth_buffer_float) = _glewSearchExtension("GL_ARB_depth_buffer_float", extStart, extEnd); #endif /* GL_ARB_depth_buffer_float */ #ifdef GL_ARB_depth_clamp CONST_CAST(GLEW_ARB_depth_clamp) = _glewSearchExtension("GL_ARB_depth_clamp", extStart, extEnd); #endif /* GL_ARB_depth_clamp */ #ifdef GL_ARB_depth_texture CONST_CAST(GLEW_ARB_depth_texture) = _glewSearchExtension("GL_ARB_depth_texture", extStart, extEnd); #endif /* GL_ARB_depth_texture */ #ifdef GL_ARB_draw_buffers CONST_CAST(GLEW_ARB_draw_buffers) = _glewSearchExtension("GL_ARB_draw_buffers", extStart, extEnd); if (glewExperimental || GLEW_ARB_draw_buffers) CONST_CAST(GLEW_ARB_draw_buffers) = !_glewInit_GL_ARB_draw_buffers(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_draw_buffers */ #ifdef GL_ARB_draw_buffers_blend CONST_CAST(GLEW_ARB_draw_buffers_blend) = _glewSearchExtension("GL_ARB_draw_buffers_blend", extStart, extEnd); if (glewExperimental || GLEW_ARB_draw_buffers_blend) CONST_CAST(GLEW_ARB_draw_buffers_blend) = !_glewInit_GL_ARB_draw_buffers_blend(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_draw_buffers_blend */ #ifdef GL_ARB_draw_elements_base_vertex CONST_CAST(GLEW_ARB_draw_elements_base_vertex) = _glewSearchExtension("GL_ARB_draw_elements_base_vertex", extStart, extEnd); if (glewExperimental || GLEW_ARB_draw_elements_base_vertex) CONST_CAST(GLEW_ARB_draw_elements_base_vertex) = !_glewInit_GL_ARB_draw_elements_base_vertex(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_draw_elements_base_vertex */ #ifdef GL_ARB_draw_indirect CONST_CAST(GLEW_ARB_draw_indirect) = _glewSearchExtension("GL_ARB_draw_indirect", extStart, extEnd); if (glewExperimental || GLEW_ARB_draw_indirect) CONST_CAST(GLEW_ARB_draw_indirect) = !_glewInit_GL_ARB_draw_indirect(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_draw_indirect */ #ifdef GL_ARB_draw_instanced CONST_CAST(GLEW_ARB_draw_instanced) = _glewSearchExtension("GL_ARB_draw_instanced", extStart, extEnd); #endif /* GL_ARB_draw_instanced */ #ifdef GL_ARB_explicit_attrib_location CONST_CAST(GLEW_ARB_explicit_attrib_location) = _glewSearchExtension("GL_ARB_explicit_attrib_location", extStart, extEnd); #endif /* GL_ARB_explicit_attrib_location */ #ifdef GL_ARB_explicit_uniform_location CONST_CAST(GLEW_ARB_explicit_uniform_location) = _glewSearchExtension("GL_ARB_explicit_uniform_location", extStart, extEnd); #endif /* GL_ARB_explicit_uniform_location */ #ifdef GL_ARB_fragment_coord_conventions CONST_CAST(GLEW_ARB_fragment_coord_conventions) = _glewSearchExtension("GL_ARB_fragment_coord_conventions", extStart, extEnd); #endif /* GL_ARB_fragment_coord_conventions */ #ifdef GL_ARB_fragment_layer_viewport CONST_CAST(GLEW_ARB_fragment_layer_viewport) = _glewSearchExtension("GL_ARB_fragment_layer_viewport", extStart, extEnd); #endif /* GL_ARB_fragment_layer_viewport */ #ifdef GL_ARB_fragment_program CONST_CAST(GLEW_ARB_fragment_program) = _glewSearchExtension("GL_ARB_fragment_program", extStart, extEnd); #endif /* GL_ARB_fragment_program */ #ifdef GL_ARB_fragment_program_shadow CONST_CAST(GLEW_ARB_fragment_program_shadow) = _glewSearchExtension("GL_ARB_fragment_program_shadow", extStart, extEnd); #endif /* GL_ARB_fragment_program_shadow */ #ifdef GL_ARB_fragment_shader CONST_CAST(GLEW_ARB_fragment_shader) = _glewSearchExtension("GL_ARB_fragment_shader", extStart, extEnd); #endif /* GL_ARB_fragment_shader */ #ifdef GL_ARB_framebuffer_no_attachments CONST_CAST(GLEW_ARB_framebuffer_no_attachments) = _glewSearchExtension("GL_ARB_framebuffer_no_attachments", extStart, extEnd); if (glewExperimental || GLEW_ARB_framebuffer_no_attachments) CONST_CAST(GLEW_ARB_framebuffer_no_attachments) = !_glewInit_GL_ARB_framebuffer_no_attachments(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_framebuffer_no_attachments */ #ifdef GL_ARB_framebuffer_object CONST_CAST(GLEW_ARB_framebuffer_object) = _glewSearchExtension("GL_ARB_framebuffer_object", extStart, extEnd); if (glewExperimental || GLEW_ARB_framebuffer_object) CONST_CAST(GLEW_ARB_framebuffer_object) = !_glewInit_GL_ARB_framebuffer_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_framebuffer_object */ #ifdef GL_ARB_framebuffer_sRGB CONST_CAST(GLEW_ARB_framebuffer_sRGB) = _glewSearchExtension("GL_ARB_framebuffer_sRGB", extStart, extEnd); #endif /* GL_ARB_framebuffer_sRGB */ #ifdef GL_ARB_geometry_shader4 CONST_CAST(GLEW_ARB_geometry_shader4) = _glewSearchExtension("GL_ARB_geometry_shader4", extStart, extEnd); if (glewExperimental || GLEW_ARB_geometry_shader4) CONST_CAST(GLEW_ARB_geometry_shader4) = !_glewInit_GL_ARB_geometry_shader4(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_geometry_shader4 */ #ifdef GL_ARB_get_program_binary CONST_CAST(GLEW_ARB_get_program_binary) = _glewSearchExtension("GL_ARB_get_program_binary", extStart, extEnd); if (glewExperimental || GLEW_ARB_get_program_binary) CONST_CAST(GLEW_ARB_get_program_binary) = !_glewInit_GL_ARB_get_program_binary(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_get_program_binary */ #ifdef GL_ARB_gpu_shader5 CONST_CAST(GLEW_ARB_gpu_shader5) = _glewSearchExtension("GL_ARB_gpu_shader5", extStart, extEnd); #endif /* GL_ARB_gpu_shader5 */ #ifdef GL_ARB_gpu_shader_fp64 CONST_CAST(GLEW_ARB_gpu_shader_fp64) = _glewSearchExtension("GL_ARB_gpu_shader_fp64", extStart, extEnd); if (glewExperimental || GLEW_ARB_gpu_shader_fp64) CONST_CAST(GLEW_ARB_gpu_shader_fp64) = !_glewInit_GL_ARB_gpu_shader_fp64(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_gpu_shader_fp64 */ #ifdef GL_ARB_half_float_pixel CONST_CAST(GLEW_ARB_half_float_pixel) = _glewSearchExtension("GL_ARB_half_float_pixel", extStart, extEnd); #endif /* GL_ARB_half_float_pixel */ #ifdef GL_ARB_half_float_vertex CONST_CAST(GLEW_ARB_half_float_vertex) = _glewSearchExtension("GL_ARB_half_float_vertex", extStart, extEnd); #endif /* GL_ARB_half_float_vertex */ #ifdef GL_ARB_imaging CONST_CAST(GLEW_ARB_imaging) = _glewSearchExtension("GL_ARB_imaging", extStart, extEnd); if (glewExperimental || GLEW_ARB_imaging) CONST_CAST(GLEW_ARB_imaging) = !_glewInit_GL_ARB_imaging(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_imaging */ #ifdef GL_ARB_instanced_arrays CONST_CAST(GLEW_ARB_instanced_arrays) = _glewSearchExtension("GL_ARB_instanced_arrays", extStart, extEnd); if (glewExperimental || GLEW_ARB_instanced_arrays) CONST_CAST(GLEW_ARB_instanced_arrays) = !_glewInit_GL_ARB_instanced_arrays(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_instanced_arrays */ #ifdef GL_ARB_internalformat_query CONST_CAST(GLEW_ARB_internalformat_query) = _glewSearchExtension("GL_ARB_internalformat_query", extStart, extEnd); if (glewExperimental || GLEW_ARB_internalformat_query) CONST_CAST(GLEW_ARB_internalformat_query) = !_glewInit_GL_ARB_internalformat_query(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_internalformat_query */ #ifdef GL_ARB_internalformat_query2 CONST_CAST(GLEW_ARB_internalformat_query2) = _glewSearchExtension("GL_ARB_internalformat_query2", extStart, extEnd); if (glewExperimental || GLEW_ARB_internalformat_query2) CONST_CAST(GLEW_ARB_internalformat_query2) = !_glewInit_GL_ARB_internalformat_query2(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_internalformat_query2 */ #ifdef GL_ARB_invalidate_subdata CONST_CAST(GLEW_ARB_invalidate_subdata) = _glewSearchExtension("GL_ARB_invalidate_subdata", extStart, extEnd); if (glewExperimental || GLEW_ARB_invalidate_subdata) CONST_CAST(GLEW_ARB_invalidate_subdata) = !_glewInit_GL_ARB_invalidate_subdata(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_invalidate_subdata */ #ifdef GL_ARB_map_buffer_alignment CONST_CAST(GLEW_ARB_map_buffer_alignment) = _glewSearchExtension("GL_ARB_map_buffer_alignment", extStart, extEnd); #endif /* GL_ARB_map_buffer_alignment */ #ifdef GL_ARB_map_buffer_range CONST_CAST(GLEW_ARB_map_buffer_range) = _glewSearchExtension("GL_ARB_map_buffer_range", extStart, extEnd); if (glewExperimental || GLEW_ARB_map_buffer_range) CONST_CAST(GLEW_ARB_map_buffer_range) = !_glewInit_GL_ARB_map_buffer_range(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_map_buffer_range */ #ifdef GL_ARB_matrix_palette CONST_CAST(GLEW_ARB_matrix_palette) = _glewSearchExtension("GL_ARB_matrix_palette", extStart, extEnd); if (glewExperimental || GLEW_ARB_matrix_palette) CONST_CAST(GLEW_ARB_matrix_palette) = !_glewInit_GL_ARB_matrix_palette(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_matrix_palette */ #ifdef GL_ARB_multi_draw_indirect CONST_CAST(GLEW_ARB_multi_draw_indirect) = _glewSearchExtension("GL_ARB_multi_draw_indirect", extStart, extEnd); if (glewExperimental || GLEW_ARB_multi_draw_indirect) CONST_CAST(GLEW_ARB_multi_draw_indirect) = !_glewInit_GL_ARB_multi_draw_indirect(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_multi_draw_indirect */ #ifdef GL_ARB_multisample CONST_CAST(GLEW_ARB_multisample) = _glewSearchExtension("GL_ARB_multisample", extStart, extEnd); if (glewExperimental || GLEW_ARB_multisample) CONST_CAST(GLEW_ARB_multisample) = !_glewInit_GL_ARB_multisample(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_multisample */ #ifdef GL_ARB_multitexture CONST_CAST(GLEW_ARB_multitexture) = _glewSearchExtension("GL_ARB_multitexture", extStart, extEnd); if (glewExperimental || GLEW_ARB_multitexture) CONST_CAST(GLEW_ARB_multitexture) = !_glewInit_GL_ARB_multitexture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_multitexture */ #ifdef GL_ARB_occlusion_query CONST_CAST(GLEW_ARB_occlusion_query) = _glewSearchExtension("GL_ARB_occlusion_query", extStart, extEnd); if (glewExperimental || GLEW_ARB_occlusion_query) CONST_CAST(GLEW_ARB_occlusion_query) = !_glewInit_GL_ARB_occlusion_query(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_occlusion_query */ #ifdef GL_ARB_occlusion_query2 CONST_CAST(GLEW_ARB_occlusion_query2) = _glewSearchExtension("GL_ARB_occlusion_query2", extStart, extEnd); #endif /* GL_ARB_occlusion_query2 */ #ifdef GL_ARB_pixel_buffer_object CONST_CAST(GLEW_ARB_pixel_buffer_object) = _glewSearchExtension("GL_ARB_pixel_buffer_object", extStart, extEnd); #endif /* GL_ARB_pixel_buffer_object */ #ifdef GL_ARB_point_parameters CONST_CAST(GLEW_ARB_point_parameters) = _glewSearchExtension("GL_ARB_point_parameters", extStart, extEnd); if (glewExperimental || GLEW_ARB_point_parameters) CONST_CAST(GLEW_ARB_point_parameters) = !_glewInit_GL_ARB_point_parameters(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_point_parameters */ #ifdef GL_ARB_point_sprite CONST_CAST(GLEW_ARB_point_sprite) = _glewSearchExtension("GL_ARB_point_sprite", extStart, extEnd); #endif /* GL_ARB_point_sprite */ #ifdef GL_ARB_program_interface_query CONST_CAST(GLEW_ARB_program_interface_query) = _glewSearchExtension("GL_ARB_program_interface_query", extStart, extEnd); if (glewExperimental || GLEW_ARB_program_interface_query) CONST_CAST(GLEW_ARB_program_interface_query) = !_glewInit_GL_ARB_program_interface_query(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_program_interface_query */ #ifdef GL_ARB_provoking_vertex CONST_CAST(GLEW_ARB_provoking_vertex) = _glewSearchExtension("GL_ARB_provoking_vertex", extStart, extEnd); if (glewExperimental || GLEW_ARB_provoking_vertex) CONST_CAST(GLEW_ARB_provoking_vertex) = !_glewInit_GL_ARB_provoking_vertex(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_provoking_vertex */ #ifdef GL_ARB_robust_buffer_access_behavior CONST_CAST(GLEW_ARB_robust_buffer_access_behavior) = _glewSearchExtension("GL_ARB_robust_buffer_access_behavior", extStart, extEnd); #endif /* GL_ARB_robust_buffer_access_behavior */ #ifdef GL_ARB_robustness CONST_CAST(GLEW_ARB_robustness) = _glewSearchExtension("GL_ARB_robustness", extStart, extEnd); if (glewExperimental || GLEW_ARB_robustness) CONST_CAST(GLEW_ARB_robustness) = !_glewInit_GL_ARB_robustness(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_robustness */ #ifdef GL_ARB_robustness_application_isolation CONST_CAST(GLEW_ARB_robustness_application_isolation) = _glewSearchExtension("GL_ARB_robustness_application_isolation", extStart, extEnd); #endif /* GL_ARB_robustness_application_isolation */ #ifdef GL_ARB_robustness_share_group_isolation CONST_CAST(GLEW_ARB_robustness_share_group_isolation) = _glewSearchExtension("GL_ARB_robustness_share_group_isolation", extStart, extEnd); #endif /* GL_ARB_robustness_share_group_isolation */ #ifdef GL_ARB_sample_shading CONST_CAST(GLEW_ARB_sample_shading) = _glewSearchExtension("GL_ARB_sample_shading", extStart, extEnd); if (glewExperimental || GLEW_ARB_sample_shading) CONST_CAST(GLEW_ARB_sample_shading) = !_glewInit_GL_ARB_sample_shading(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_sample_shading */ #ifdef GL_ARB_sampler_objects CONST_CAST(GLEW_ARB_sampler_objects) = _glewSearchExtension("GL_ARB_sampler_objects", extStart, extEnd); if (glewExperimental || GLEW_ARB_sampler_objects) CONST_CAST(GLEW_ARB_sampler_objects) = !_glewInit_GL_ARB_sampler_objects(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_sampler_objects */ #ifdef GL_ARB_seamless_cube_map CONST_CAST(GLEW_ARB_seamless_cube_map) = _glewSearchExtension("GL_ARB_seamless_cube_map", extStart, extEnd); #endif /* GL_ARB_seamless_cube_map */ #ifdef GL_ARB_separate_shader_objects CONST_CAST(GLEW_ARB_separate_shader_objects) = _glewSearchExtension("GL_ARB_separate_shader_objects", extStart, extEnd); if (glewExperimental || GLEW_ARB_separate_shader_objects) CONST_CAST(GLEW_ARB_separate_shader_objects) = !_glewInit_GL_ARB_separate_shader_objects(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_separate_shader_objects */ #ifdef GL_ARB_shader_atomic_counters CONST_CAST(GLEW_ARB_shader_atomic_counters) = _glewSearchExtension("GL_ARB_shader_atomic_counters", extStart, extEnd); if (glewExperimental || GLEW_ARB_shader_atomic_counters) CONST_CAST(GLEW_ARB_shader_atomic_counters) = !_glewInit_GL_ARB_shader_atomic_counters(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_shader_atomic_counters */ #ifdef GL_ARB_shader_bit_encoding CONST_CAST(GLEW_ARB_shader_bit_encoding) = _glewSearchExtension("GL_ARB_shader_bit_encoding", extStart, extEnd); #endif /* GL_ARB_shader_bit_encoding */ #ifdef GL_ARB_shader_image_load_store CONST_CAST(GLEW_ARB_shader_image_load_store) = _glewSearchExtension("GL_ARB_shader_image_load_store", extStart, extEnd); if (glewExperimental || GLEW_ARB_shader_image_load_store) CONST_CAST(GLEW_ARB_shader_image_load_store) = !_glewInit_GL_ARB_shader_image_load_store(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_shader_image_load_store */ #ifdef GL_ARB_shader_image_size CONST_CAST(GLEW_ARB_shader_image_size) = _glewSearchExtension("GL_ARB_shader_image_size", extStart, extEnd); #endif /* GL_ARB_shader_image_size */ #ifdef GL_ARB_shader_objects CONST_CAST(GLEW_ARB_shader_objects) = _glewSearchExtension("GL_ARB_shader_objects", extStart, extEnd); if (glewExperimental || GLEW_ARB_shader_objects) CONST_CAST(GLEW_ARB_shader_objects) = !_glewInit_GL_ARB_shader_objects(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_shader_objects */ #ifdef GL_ARB_shader_precision CONST_CAST(GLEW_ARB_shader_precision) = _glewSearchExtension("GL_ARB_shader_precision", extStart, extEnd); #endif /* GL_ARB_shader_precision */ #ifdef GL_ARB_shader_stencil_export CONST_CAST(GLEW_ARB_shader_stencil_export) = _glewSearchExtension("GL_ARB_shader_stencil_export", extStart, extEnd); #endif /* GL_ARB_shader_stencil_export */ #ifdef GL_ARB_shader_storage_buffer_object CONST_CAST(GLEW_ARB_shader_storage_buffer_object) = _glewSearchExtension("GL_ARB_shader_storage_buffer_object", extStart, extEnd); if (glewExperimental || GLEW_ARB_shader_storage_buffer_object) CONST_CAST(GLEW_ARB_shader_storage_buffer_object) = !_glewInit_GL_ARB_shader_storage_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_shader_storage_buffer_object */ #ifdef GL_ARB_shader_subroutine CONST_CAST(GLEW_ARB_shader_subroutine) = _glewSearchExtension("GL_ARB_shader_subroutine", extStart, extEnd); if (glewExperimental || GLEW_ARB_shader_subroutine) CONST_CAST(GLEW_ARB_shader_subroutine) = !_glewInit_GL_ARB_shader_subroutine(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_shader_subroutine */ #ifdef GL_ARB_shader_texture_lod CONST_CAST(GLEW_ARB_shader_texture_lod) = _glewSearchExtension("GL_ARB_shader_texture_lod", extStart, extEnd); #endif /* GL_ARB_shader_texture_lod */ #ifdef GL_ARB_shading_language_100 CONST_CAST(GLEW_ARB_shading_language_100) = _glewSearchExtension("GL_ARB_shading_language_100", extStart, extEnd); #endif /* GL_ARB_shading_language_100 */ #ifdef GL_ARB_shading_language_420pack CONST_CAST(GLEW_ARB_shading_language_420pack) = _glewSearchExtension("GL_ARB_shading_language_420pack", extStart, extEnd); #endif /* GL_ARB_shading_language_420pack */ #ifdef GL_ARB_shading_language_include CONST_CAST(GLEW_ARB_shading_language_include) = _glewSearchExtension("GL_ARB_shading_language_include", extStart, extEnd); if (glewExperimental || GLEW_ARB_shading_language_include) CONST_CAST(GLEW_ARB_shading_language_include) = !_glewInit_GL_ARB_shading_language_include(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_shading_language_include */ #ifdef GL_ARB_shading_language_packing CONST_CAST(GLEW_ARB_shading_language_packing) = _glewSearchExtension("GL_ARB_shading_language_packing", extStart, extEnd); #endif /* GL_ARB_shading_language_packing */ #ifdef GL_ARB_shadow CONST_CAST(GLEW_ARB_shadow) = _glewSearchExtension("GL_ARB_shadow", extStart, extEnd); #endif /* GL_ARB_shadow */ #ifdef GL_ARB_shadow_ambient CONST_CAST(GLEW_ARB_shadow_ambient) = _glewSearchExtension("GL_ARB_shadow_ambient", extStart, extEnd); #endif /* GL_ARB_shadow_ambient */ #ifdef GL_ARB_stencil_texturing CONST_CAST(GLEW_ARB_stencil_texturing) = _glewSearchExtension("GL_ARB_stencil_texturing", extStart, extEnd); #endif /* GL_ARB_stencil_texturing */ #ifdef GL_ARB_sync CONST_CAST(GLEW_ARB_sync) = _glewSearchExtension("GL_ARB_sync", extStart, extEnd); if (glewExperimental || GLEW_ARB_sync) CONST_CAST(GLEW_ARB_sync) = !_glewInit_GL_ARB_sync(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_sync */ #ifdef GL_ARB_tessellation_shader CONST_CAST(GLEW_ARB_tessellation_shader) = _glewSearchExtension("GL_ARB_tessellation_shader", extStart, extEnd); if (glewExperimental || GLEW_ARB_tessellation_shader) CONST_CAST(GLEW_ARB_tessellation_shader) = !_glewInit_GL_ARB_tessellation_shader(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_tessellation_shader */ #ifdef GL_ARB_texture_border_clamp CONST_CAST(GLEW_ARB_texture_border_clamp) = _glewSearchExtension("GL_ARB_texture_border_clamp", extStart, extEnd); #endif /* GL_ARB_texture_border_clamp */ #ifdef GL_ARB_texture_buffer_object CONST_CAST(GLEW_ARB_texture_buffer_object) = _glewSearchExtension("GL_ARB_texture_buffer_object", extStart, extEnd); if (glewExperimental || GLEW_ARB_texture_buffer_object) CONST_CAST(GLEW_ARB_texture_buffer_object) = !_glewInit_GL_ARB_texture_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_texture_buffer_object */ #ifdef GL_ARB_texture_buffer_object_rgb32 CONST_CAST(GLEW_ARB_texture_buffer_object_rgb32) = _glewSearchExtension("GL_ARB_texture_buffer_object_rgb32", extStart, extEnd); #endif /* GL_ARB_texture_buffer_object_rgb32 */ #ifdef GL_ARB_texture_buffer_range CONST_CAST(GLEW_ARB_texture_buffer_range) = _glewSearchExtension("GL_ARB_texture_buffer_range", extStart, extEnd); if (glewExperimental || GLEW_ARB_texture_buffer_range) CONST_CAST(GLEW_ARB_texture_buffer_range) = !_glewInit_GL_ARB_texture_buffer_range(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_texture_buffer_range */ #ifdef GL_ARB_texture_compression CONST_CAST(GLEW_ARB_texture_compression) = _glewSearchExtension("GL_ARB_texture_compression", extStart, extEnd); if (glewExperimental || GLEW_ARB_texture_compression) CONST_CAST(GLEW_ARB_texture_compression) = !_glewInit_GL_ARB_texture_compression(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_texture_compression */ #ifdef GL_ARB_texture_compression_bptc CONST_CAST(GLEW_ARB_texture_compression_bptc) = _glewSearchExtension("GL_ARB_texture_compression_bptc", extStart, extEnd); #endif /* GL_ARB_texture_compression_bptc */ #ifdef GL_ARB_texture_compression_rgtc CONST_CAST(GLEW_ARB_texture_compression_rgtc) = _glewSearchExtension("GL_ARB_texture_compression_rgtc", extStart, extEnd); #endif /* GL_ARB_texture_compression_rgtc */ #ifdef GL_ARB_texture_cube_map CONST_CAST(GLEW_ARB_texture_cube_map) = _glewSearchExtension("GL_ARB_texture_cube_map", extStart, extEnd); #endif /* GL_ARB_texture_cube_map */ #ifdef GL_ARB_texture_cube_map_array CONST_CAST(GLEW_ARB_texture_cube_map_array) = _glewSearchExtension("GL_ARB_texture_cube_map_array", extStart, extEnd); #endif /* GL_ARB_texture_cube_map_array */ #ifdef GL_ARB_texture_env_add CONST_CAST(GLEW_ARB_texture_env_add) = _glewSearchExtension("GL_ARB_texture_env_add", extStart, extEnd); #endif /* GL_ARB_texture_env_add */ #ifdef GL_ARB_texture_env_combine CONST_CAST(GLEW_ARB_texture_env_combine) = _glewSearchExtension("GL_ARB_texture_env_combine", extStart, extEnd); #endif /* GL_ARB_texture_env_combine */ #ifdef GL_ARB_texture_env_crossbar CONST_CAST(GLEW_ARB_texture_env_crossbar) = _glewSearchExtension("GL_ARB_texture_env_crossbar", extStart, extEnd); #endif /* GL_ARB_texture_env_crossbar */ #ifdef GL_ARB_texture_env_dot3 CONST_CAST(GLEW_ARB_texture_env_dot3) = _glewSearchExtension("GL_ARB_texture_env_dot3", extStart, extEnd); #endif /* GL_ARB_texture_env_dot3 */ #ifdef GL_ARB_texture_float CONST_CAST(GLEW_ARB_texture_float) = _glewSearchExtension("GL_ARB_texture_float", extStart, extEnd); #endif /* GL_ARB_texture_float */ #ifdef GL_ARB_texture_gather CONST_CAST(GLEW_ARB_texture_gather) = _glewSearchExtension("GL_ARB_texture_gather", extStart, extEnd); #endif /* GL_ARB_texture_gather */ #ifdef GL_ARB_texture_mirrored_repeat CONST_CAST(GLEW_ARB_texture_mirrored_repeat) = _glewSearchExtension("GL_ARB_texture_mirrored_repeat", extStart, extEnd); #endif /* GL_ARB_texture_mirrored_repeat */ #ifdef GL_ARB_texture_multisample CONST_CAST(GLEW_ARB_texture_multisample) = _glewSearchExtension("GL_ARB_texture_multisample", extStart, extEnd); if (glewExperimental || GLEW_ARB_texture_multisample) CONST_CAST(GLEW_ARB_texture_multisample) = !_glewInit_GL_ARB_texture_multisample(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_texture_multisample */ #ifdef GL_ARB_texture_non_power_of_two CONST_CAST(GLEW_ARB_texture_non_power_of_two) = _glewSearchExtension("GL_ARB_texture_non_power_of_two", extStart, extEnd); #endif /* GL_ARB_texture_non_power_of_two */ #ifdef GL_ARB_texture_query_levels CONST_CAST(GLEW_ARB_texture_query_levels) = _glewSearchExtension("GL_ARB_texture_query_levels", extStart, extEnd); #endif /* GL_ARB_texture_query_levels */ #ifdef GL_ARB_texture_query_lod CONST_CAST(GLEW_ARB_texture_query_lod) = _glewSearchExtension("GL_ARB_texture_query_lod", extStart, extEnd); #endif /* GL_ARB_texture_query_lod */ #ifdef GL_ARB_texture_rectangle CONST_CAST(GLEW_ARB_texture_rectangle) = _glewSearchExtension("GL_ARB_texture_rectangle", extStart, extEnd); #endif /* GL_ARB_texture_rectangle */ #ifdef GL_ARB_texture_rg CONST_CAST(GLEW_ARB_texture_rg) = _glewSearchExtension("GL_ARB_texture_rg", extStart, extEnd); #endif /* GL_ARB_texture_rg */ #ifdef GL_ARB_texture_rgb10_a2ui CONST_CAST(GLEW_ARB_texture_rgb10_a2ui) = _glewSearchExtension("GL_ARB_texture_rgb10_a2ui", extStart, extEnd); #endif /* GL_ARB_texture_rgb10_a2ui */ #ifdef GL_ARB_texture_storage CONST_CAST(GLEW_ARB_texture_storage) = _glewSearchExtension("GL_ARB_texture_storage", extStart, extEnd); if (glewExperimental || GLEW_ARB_texture_storage) CONST_CAST(GLEW_ARB_texture_storage) = !_glewInit_GL_ARB_texture_storage(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_texture_storage */ #ifdef GL_ARB_texture_storage_multisample CONST_CAST(GLEW_ARB_texture_storage_multisample) = _glewSearchExtension("GL_ARB_texture_storage_multisample", extStart, extEnd); if (glewExperimental || GLEW_ARB_texture_storage_multisample) CONST_CAST(GLEW_ARB_texture_storage_multisample) = !_glewInit_GL_ARB_texture_storage_multisample(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_texture_storage_multisample */ #ifdef GL_ARB_texture_swizzle CONST_CAST(GLEW_ARB_texture_swizzle) = _glewSearchExtension("GL_ARB_texture_swizzle", extStart, extEnd); #endif /* GL_ARB_texture_swizzle */ #ifdef GL_ARB_texture_view CONST_CAST(GLEW_ARB_texture_view) = _glewSearchExtension("GL_ARB_texture_view", extStart, extEnd); if (glewExperimental || GLEW_ARB_texture_view) CONST_CAST(GLEW_ARB_texture_view) = !_glewInit_GL_ARB_texture_view(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_texture_view */ #ifdef GL_ARB_timer_query CONST_CAST(GLEW_ARB_timer_query) = _glewSearchExtension("GL_ARB_timer_query", extStart, extEnd); if (glewExperimental || GLEW_ARB_timer_query) CONST_CAST(GLEW_ARB_timer_query) = !_glewInit_GL_ARB_timer_query(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_timer_query */ #ifdef GL_ARB_transform_feedback2 CONST_CAST(GLEW_ARB_transform_feedback2) = _glewSearchExtension("GL_ARB_transform_feedback2", extStart, extEnd); if (glewExperimental || GLEW_ARB_transform_feedback2) CONST_CAST(GLEW_ARB_transform_feedback2) = !_glewInit_GL_ARB_transform_feedback2(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_transform_feedback2 */ #ifdef GL_ARB_transform_feedback3 CONST_CAST(GLEW_ARB_transform_feedback3) = _glewSearchExtension("GL_ARB_transform_feedback3", extStart, extEnd); if (glewExperimental || GLEW_ARB_transform_feedback3) CONST_CAST(GLEW_ARB_transform_feedback3) = !_glewInit_GL_ARB_transform_feedback3(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_transform_feedback3 */ #ifdef GL_ARB_transform_feedback_instanced CONST_CAST(GLEW_ARB_transform_feedback_instanced) = _glewSearchExtension("GL_ARB_transform_feedback_instanced", extStart, extEnd); if (glewExperimental || GLEW_ARB_transform_feedback_instanced) CONST_CAST(GLEW_ARB_transform_feedback_instanced) = !_glewInit_GL_ARB_transform_feedback_instanced(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_transform_feedback_instanced */ #ifdef GL_ARB_transpose_matrix CONST_CAST(GLEW_ARB_transpose_matrix) = _glewSearchExtension("GL_ARB_transpose_matrix", extStart, extEnd); if (glewExperimental || GLEW_ARB_transpose_matrix) CONST_CAST(GLEW_ARB_transpose_matrix) = !_glewInit_GL_ARB_transpose_matrix(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_transpose_matrix */ #ifdef GL_ARB_uniform_buffer_object CONST_CAST(GLEW_ARB_uniform_buffer_object) = _glewSearchExtension("GL_ARB_uniform_buffer_object", extStart, extEnd); if (glewExperimental || GLEW_ARB_uniform_buffer_object) CONST_CAST(GLEW_ARB_uniform_buffer_object) = !_glewInit_GL_ARB_uniform_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_uniform_buffer_object */ #ifdef GL_ARB_vertex_array_bgra CONST_CAST(GLEW_ARB_vertex_array_bgra) = _glewSearchExtension("GL_ARB_vertex_array_bgra", extStart, extEnd); #endif /* GL_ARB_vertex_array_bgra */ #ifdef GL_ARB_vertex_array_object CONST_CAST(GLEW_ARB_vertex_array_object) = _glewSearchExtension("GL_ARB_vertex_array_object", extStart, extEnd); if (glewExperimental || GLEW_ARB_vertex_array_object) CONST_CAST(GLEW_ARB_vertex_array_object) = !_glewInit_GL_ARB_vertex_array_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_vertex_array_object */ #ifdef GL_ARB_vertex_attrib_64bit CONST_CAST(GLEW_ARB_vertex_attrib_64bit) = _glewSearchExtension("GL_ARB_vertex_attrib_64bit", extStart, extEnd); if (glewExperimental || GLEW_ARB_vertex_attrib_64bit) CONST_CAST(GLEW_ARB_vertex_attrib_64bit) = !_glewInit_GL_ARB_vertex_attrib_64bit(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_vertex_attrib_64bit */ #ifdef GL_ARB_vertex_attrib_binding CONST_CAST(GLEW_ARB_vertex_attrib_binding) = _glewSearchExtension("GL_ARB_vertex_attrib_binding", extStart, extEnd); if (glewExperimental || GLEW_ARB_vertex_attrib_binding) CONST_CAST(GLEW_ARB_vertex_attrib_binding) = !_glewInit_GL_ARB_vertex_attrib_binding(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_vertex_attrib_binding */ #ifdef GL_ARB_vertex_blend CONST_CAST(GLEW_ARB_vertex_blend) = _glewSearchExtension("GL_ARB_vertex_blend", extStart, extEnd); if (glewExperimental || GLEW_ARB_vertex_blend) CONST_CAST(GLEW_ARB_vertex_blend) = !_glewInit_GL_ARB_vertex_blend(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_vertex_blend */ #ifdef GL_ARB_vertex_buffer_object CONST_CAST(GLEW_ARB_vertex_buffer_object) = _glewSearchExtension("GL_ARB_vertex_buffer_object", extStart, extEnd); if (glewExperimental || GLEW_ARB_vertex_buffer_object) CONST_CAST(GLEW_ARB_vertex_buffer_object) = !_glewInit_GL_ARB_vertex_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_vertex_buffer_object */ #ifdef GL_ARB_vertex_program CONST_CAST(GLEW_ARB_vertex_program) = _glewSearchExtension("GL_ARB_vertex_program", extStart, extEnd); if (glewExperimental || GLEW_ARB_vertex_program) CONST_CAST(GLEW_ARB_vertex_program) = !_glewInit_GL_ARB_vertex_program(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_vertex_program */ #ifdef GL_ARB_vertex_shader CONST_CAST(GLEW_ARB_vertex_shader) = _glewSearchExtension("GL_ARB_vertex_shader", extStart, extEnd); if (glewExperimental || GLEW_ARB_vertex_shader) CONST_CAST(GLEW_ARB_vertex_shader) = !_glewInit_GL_ARB_vertex_shader(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_vertex_shader */ #ifdef GL_ARB_vertex_type_2_10_10_10_rev CONST_CAST(GLEW_ARB_vertex_type_2_10_10_10_rev) = _glewSearchExtension("GL_ARB_vertex_type_2_10_10_10_rev", extStart, extEnd); if (glewExperimental || GLEW_ARB_vertex_type_2_10_10_10_rev) CONST_CAST(GLEW_ARB_vertex_type_2_10_10_10_rev) = !_glewInit_GL_ARB_vertex_type_2_10_10_10_rev(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_vertex_type_2_10_10_10_rev */ #ifdef GL_ARB_viewport_array CONST_CAST(GLEW_ARB_viewport_array) = _glewSearchExtension("GL_ARB_viewport_array", extStart, extEnd); if (glewExperimental || GLEW_ARB_viewport_array) CONST_CAST(GLEW_ARB_viewport_array) = !_glewInit_GL_ARB_viewport_array(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_viewport_array */ #ifdef GL_ARB_window_pos CONST_CAST(GLEW_ARB_window_pos) = _glewSearchExtension("GL_ARB_window_pos", extStart, extEnd); if (glewExperimental || GLEW_ARB_window_pos) CONST_CAST(GLEW_ARB_window_pos) = !_glewInit_GL_ARB_window_pos(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_window_pos */ #ifdef GL_ATIX_point_sprites CONST_CAST(GLEW_ATIX_point_sprites) = _glewSearchExtension("GL_ATIX_point_sprites", extStart, extEnd); #endif /* GL_ATIX_point_sprites */ #ifdef GL_ATIX_texture_env_combine3 CONST_CAST(GLEW_ATIX_texture_env_combine3) = _glewSearchExtension("GL_ATIX_texture_env_combine3", extStart, extEnd); #endif /* GL_ATIX_texture_env_combine3 */ #ifdef GL_ATIX_texture_env_route CONST_CAST(GLEW_ATIX_texture_env_route) = _glewSearchExtension("GL_ATIX_texture_env_route", extStart, extEnd); #endif /* GL_ATIX_texture_env_route */ #ifdef GL_ATIX_vertex_shader_output_point_size CONST_CAST(GLEW_ATIX_vertex_shader_output_point_size) = _glewSearchExtension("GL_ATIX_vertex_shader_output_point_size", extStart, extEnd); #endif /* GL_ATIX_vertex_shader_output_point_size */ #ifdef GL_ATI_draw_buffers CONST_CAST(GLEW_ATI_draw_buffers) = _glewSearchExtension("GL_ATI_draw_buffers", extStart, extEnd); if (glewExperimental || GLEW_ATI_draw_buffers) CONST_CAST(GLEW_ATI_draw_buffers) = !_glewInit_GL_ATI_draw_buffers(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ATI_draw_buffers */ #ifdef GL_ATI_element_array CONST_CAST(GLEW_ATI_element_array) = _glewSearchExtension("GL_ATI_element_array", extStart, extEnd); if (glewExperimental || GLEW_ATI_element_array) CONST_CAST(GLEW_ATI_element_array) = !_glewInit_GL_ATI_element_array(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ATI_element_array */ #ifdef GL_ATI_envmap_bumpmap CONST_CAST(GLEW_ATI_envmap_bumpmap) = _glewSearchExtension("GL_ATI_envmap_bumpmap", extStart, extEnd); if (glewExperimental || GLEW_ATI_envmap_bumpmap) CONST_CAST(GLEW_ATI_envmap_bumpmap) = !_glewInit_GL_ATI_envmap_bumpmap(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ATI_envmap_bumpmap */ #ifdef GL_ATI_fragment_shader CONST_CAST(GLEW_ATI_fragment_shader) = _glewSearchExtension("GL_ATI_fragment_shader", extStart, extEnd); if (glewExperimental || GLEW_ATI_fragment_shader) CONST_CAST(GLEW_ATI_fragment_shader) = !_glewInit_GL_ATI_fragment_shader(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ATI_fragment_shader */ #ifdef GL_ATI_map_object_buffer CONST_CAST(GLEW_ATI_map_object_buffer) = _glewSearchExtension("GL_ATI_map_object_buffer", extStart, extEnd); if (glewExperimental || GLEW_ATI_map_object_buffer) CONST_CAST(GLEW_ATI_map_object_buffer) = !_glewInit_GL_ATI_map_object_buffer(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ATI_map_object_buffer */ #ifdef GL_ATI_meminfo CONST_CAST(GLEW_ATI_meminfo) = _glewSearchExtension("GL_ATI_meminfo", extStart, extEnd); #endif /* GL_ATI_meminfo */ #ifdef GL_ATI_pn_triangles CONST_CAST(GLEW_ATI_pn_triangles) = _glewSearchExtension("GL_ATI_pn_triangles", extStart, extEnd); if (glewExperimental || GLEW_ATI_pn_triangles) CONST_CAST(GLEW_ATI_pn_triangles) = !_glewInit_GL_ATI_pn_triangles(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ATI_pn_triangles */ #ifdef GL_ATI_separate_stencil CONST_CAST(GLEW_ATI_separate_stencil) = _glewSearchExtension("GL_ATI_separate_stencil", extStart, extEnd); if (glewExperimental || GLEW_ATI_separate_stencil) CONST_CAST(GLEW_ATI_separate_stencil) = !_glewInit_GL_ATI_separate_stencil(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ATI_separate_stencil */ #ifdef GL_ATI_shader_texture_lod CONST_CAST(GLEW_ATI_shader_texture_lod) = _glewSearchExtension("GL_ATI_shader_texture_lod", extStart, extEnd); #endif /* GL_ATI_shader_texture_lod */ #ifdef GL_ATI_text_fragment_shader CONST_CAST(GLEW_ATI_text_fragment_shader) = _glewSearchExtension("GL_ATI_text_fragment_shader", extStart, extEnd); #endif /* GL_ATI_text_fragment_shader */ #ifdef GL_ATI_texture_compression_3dc CONST_CAST(GLEW_ATI_texture_compression_3dc) = _glewSearchExtension("GL_ATI_texture_compression_3dc", extStart, extEnd); #endif /* GL_ATI_texture_compression_3dc */ #ifdef GL_ATI_texture_env_combine3 CONST_CAST(GLEW_ATI_texture_env_combine3) = _glewSearchExtension("GL_ATI_texture_env_combine3", extStart, extEnd); #endif /* GL_ATI_texture_env_combine3 */ #ifdef GL_ATI_texture_float CONST_CAST(GLEW_ATI_texture_float) = _glewSearchExtension("GL_ATI_texture_float", extStart, extEnd); #endif /* GL_ATI_texture_float */ #ifdef GL_ATI_texture_mirror_once CONST_CAST(GLEW_ATI_texture_mirror_once) = _glewSearchExtension("GL_ATI_texture_mirror_once", extStart, extEnd); #endif /* GL_ATI_texture_mirror_once */ #ifdef GL_ATI_vertex_array_object CONST_CAST(GLEW_ATI_vertex_array_object) = _glewSearchExtension("GL_ATI_vertex_array_object", extStart, extEnd); if (glewExperimental || GLEW_ATI_vertex_array_object) CONST_CAST(GLEW_ATI_vertex_array_object) = !_glewInit_GL_ATI_vertex_array_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ATI_vertex_array_object */ #ifdef GL_ATI_vertex_attrib_array_object CONST_CAST(GLEW_ATI_vertex_attrib_array_object) = _glewSearchExtension("GL_ATI_vertex_attrib_array_object", extStart, extEnd); if (glewExperimental || GLEW_ATI_vertex_attrib_array_object) CONST_CAST(GLEW_ATI_vertex_attrib_array_object) = !_glewInit_GL_ATI_vertex_attrib_array_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ATI_vertex_attrib_array_object */ #ifdef GL_ATI_vertex_streams CONST_CAST(GLEW_ATI_vertex_streams) = _glewSearchExtension("GL_ATI_vertex_streams", extStart, extEnd); if (glewExperimental || GLEW_ATI_vertex_streams) CONST_CAST(GLEW_ATI_vertex_streams) = !_glewInit_GL_ATI_vertex_streams(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ATI_vertex_streams */ #ifdef GL_EXT_422_pixels CONST_CAST(GLEW_EXT_422_pixels) = _glewSearchExtension("GL_EXT_422_pixels", extStart, extEnd); #endif /* GL_EXT_422_pixels */ #ifdef GL_EXT_Cg_shader CONST_CAST(GLEW_EXT_Cg_shader) = _glewSearchExtension("GL_EXT_Cg_shader", extStart, extEnd); #endif /* GL_EXT_Cg_shader */ #ifdef GL_EXT_abgr CONST_CAST(GLEW_EXT_abgr) = _glewSearchExtension("GL_EXT_abgr", extStart, extEnd); #endif /* GL_EXT_abgr */ #ifdef GL_EXT_bgra CONST_CAST(GLEW_EXT_bgra) = _glewSearchExtension("GL_EXT_bgra", extStart, extEnd); #endif /* GL_EXT_bgra */ #ifdef GL_EXT_bindable_uniform CONST_CAST(GLEW_EXT_bindable_uniform) = _glewSearchExtension("GL_EXT_bindable_uniform", extStart, extEnd); if (glewExperimental || GLEW_EXT_bindable_uniform) CONST_CAST(GLEW_EXT_bindable_uniform) = !_glewInit_GL_EXT_bindable_uniform(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_bindable_uniform */ #ifdef GL_EXT_blend_color CONST_CAST(GLEW_EXT_blend_color) = _glewSearchExtension("GL_EXT_blend_color", extStart, extEnd); if (glewExperimental || GLEW_EXT_blend_color) CONST_CAST(GLEW_EXT_blend_color) = !_glewInit_GL_EXT_blend_color(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_blend_color */ #ifdef GL_EXT_blend_equation_separate CONST_CAST(GLEW_EXT_blend_equation_separate) = _glewSearchExtension("GL_EXT_blend_equation_separate", extStart, extEnd); if (glewExperimental || GLEW_EXT_blend_equation_separate) CONST_CAST(GLEW_EXT_blend_equation_separate) = !_glewInit_GL_EXT_blend_equation_separate(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_blend_equation_separate */ #ifdef GL_EXT_blend_func_separate CONST_CAST(GLEW_EXT_blend_func_separate) = _glewSearchExtension("GL_EXT_blend_func_separate", extStart, extEnd); if (glewExperimental || GLEW_EXT_blend_func_separate) CONST_CAST(GLEW_EXT_blend_func_separate) = !_glewInit_GL_EXT_blend_func_separate(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_blend_func_separate */ #ifdef GL_EXT_blend_logic_op CONST_CAST(GLEW_EXT_blend_logic_op) = _glewSearchExtension("GL_EXT_blend_logic_op", extStart, extEnd); #endif /* GL_EXT_blend_logic_op */ #ifdef GL_EXT_blend_minmax CONST_CAST(GLEW_EXT_blend_minmax) = _glewSearchExtension("GL_EXT_blend_minmax", extStart, extEnd); if (glewExperimental || GLEW_EXT_blend_minmax) CONST_CAST(GLEW_EXT_blend_minmax) = !_glewInit_GL_EXT_blend_minmax(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_blend_minmax */ #ifdef GL_EXT_blend_subtract CONST_CAST(GLEW_EXT_blend_subtract) = _glewSearchExtension("GL_EXT_blend_subtract", extStart, extEnd); #endif /* GL_EXT_blend_subtract */ #ifdef GL_EXT_clip_volume_hint CONST_CAST(GLEW_EXT_clip_volume_hint) = _glewSearchExtension("GL_EXT_clip_volume_hint", extStart, extEnd); #endif /* GL_EXT_clip_volume_hint */ #ifdef GL_EXT_cmyka CONST_CAST(GLEW_EXT_cmyka) = _glewSearchExtension("GL_EXT_cmyka", extStart, extEnd); #endif /* GL_EXT_cmyka */ #ifdef GL_EXT_color_subtable CONST_CAST(GLEW_EXT_color_subtable) = _glewSearchExtension("GL_EXT_color_subtable", extStart, extEnd); if (glewExperimental || GLEW_EXT_color_subtable) CONST_CAST(GLEW_EXT_color_subtable) = !_glewInit_GL_EXT_color_subtable(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_color_subtable */ #ifdef GL_EXT_compiled_vertex_array CONST_CAST(GLEW_EXT_compiled_vertex_array) = _glewSearchExtension("GL_EXT_compiled_vertex_array", extStart, extEnd); if (glewExperimental || GLEW_EXT_compiled_vertex_array) CONST_CAST(GLEW_EXT_compiled_vertex_array) = !_glewInit_GL_EXT_compiled_vertex_array(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_compiled_vertex_array */ #ifdef GL_EXT_convolution CONST_CAST(GLEW_EXT_convolution) = _glewSearchExtension("GL_EXT_convolution", extStart, extEnd); if (glewExperimental || GLEW_EXT_convolution) CONST_CAST(GLEW_EXT_convolution) = !_glewInit_GL_EXT_convolution(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_convolution */ #ifdef GL_EXT_coordinate_frame CONST_CAST(GLEW_EXT_coordinate_frame) = _glewSearchExtension("GL_EXT_coordinate_frame", extStart, extEnd); if (glewExperimental || GLEW_EXT_coordinate_frame) CONST_CAST(GLEW_EXT_coordinate_frame) = !_glewInit_GL_EXT_coordinate_frame(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_coordinate_frame */ #ifdef GL_EXT_copy_texture CONST_CAST(GLEW_EXT_copy_texture) = _glewSearchExtension("GL_EXT_copy_texture", extStart, extEnd); if (glewExperimental || GLEW_EXT_copy_texture) CONST_CAST(GLEW_EXT_copy_texture) = !_glewInit_GL_EXT_copy_texture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_copy_texture */ #ifdef GL_EXT_cull_vertex CONST_CAST(GLEW_EXT_cull_vertex) = _glewSearchExtension("GL_EXT_cull_vertex", extStart, extEnd); if (glewExperimental || GLEW_EXT_cull_vertex) CONST_CAST(GLEW_EXT_cull_vertex) = !_glewInit_GL_EXT_cull_vertex(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_cull_vertex */ #ifdef GL_EXT_debug_marker CONST_CAST(GLEW_EXT_debug_marker) = _glewSearchExtension("GL_EXT_debug_marker", extStart, extEnd); if (glewExperimental || GLEW_EXT_debug_marker) CONST_CAST(GLEW_EXT_debug_marker) = !_glewInit_GL_EXT_debug_marker(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_debug_marker */ #ifdef GL_EXT_depth_bounds_test CONST_CAST(GLEW_EXT_depth_bounds_test) = _glewSearchExtension("GL_EXT_depth_bounds_test", extStart, extEnd); if (glewExperimental || GLEW_EXT_depth_bounds_test) CONST_CAST(GLEW_EXT_depth_bounds_test) = !_glewInit_GL_EXT_depth_bounds_test(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_depth_bounds_test */ #ifdef GL_EXT_direct_state_access CONST_CAST(GLEW_EXT_direct_state_access) = _glewSearchExtension("GL_EXT_direct_state_access", extStart, extEnd); if (glewExperimental || GLEW_EXT_direct_state_access) CONST_CAST(GLEW_EXT_direct_state_access) = !_glewInit_GL_EXT_direct_state_access(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_direct_state_access */ #ifdef GL_EXT_draw_buffers2 CONST_CAST(GLEW_EXT_draw_buffers2) = _glewSearchExtension("GL_EXT_draw_buffers2", extStart, extEnd); if (glewExperimental || GLEW_EXT_draw_buffers2) CONST_CAST(GLEW_EXT_draw_buffers2) = !_glewInit_GL_EXT_draw_buffers2(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_draw_buffers2 */ #ifdef GL_EXT_draw_instanced CONST_CAST(GLEW_EXT_draw_instanced) = _glewSearchExtension("GL_EXT_draw_instanced", extStart, extEnd); if (glewExperimental || GLEW_EXT_draw_instanced) CONST_CAST(GLEW_EXT_draw_instanced) = !_glewInit_GL_EXT_draw_instanced(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_draw_instanced */ #ifdef GL_EXT_draw_range_elements CONST_CAST(GLEW_EXT_draw_range_elements) = _glewSearchExtension("GL_EXT_draw_range_elements", extStart, extEnd); if (glewExperimental || GLEW_EXT_draw_range_elements) CONST_CAST(GLEW_EXT_draw_range_elements) = !_glewInit_GL_EXT_draw_range_elements(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_draw_range_elements */ #ifdef GL_EXT_fog_coord CONST_CAST(GLEW_EXT_fog_coord) = _glewSearchExtension("GL_EXT_fog_coord", extStart, extEnd); if (glewExperimental || GLEW_EXT_fog_coord) CONST_CAST(GLEW_EXT_fog_coord) = !_glewInit_GL_EXT_fog_coord(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_fog_coord */ #ifdef GL_EXT_fragment_lighting CONST_CAST(GLEW_EXT_fragment_lighting) = _glewSearchExtension("GL_EXT_fragment_lighting", extStart, extEnd); if (glewExperimental || GLEW_EXT_fragment_lighting) CONST_CAST(GLEW_EXT_fragment_lighting) = !_glewInit_GL_EXT_fragment_lighting(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_fragment_lighting */ #ifdef GL_EXT_framebuffer_blit CONST_CAST(GLEW_EXT_framebuffer_blit) = _glewSearchExtension("GL_EXT_framebuffer_blit", extStart, extEnd); if (glewExperimental || GLEW_EXT_framebuffer_blit) CONST_CAST(GLEW_EXT_framebuffer_blit) = !_glewInit_GL_EXT_framebuffer_blit(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_framebuffer_blit */ #ifdef GL_EXT_framebuffer_multisample CONST_CAST(GLEW_EXT_framebuffer_multisample) = _glewSearchExtension("GL_EXT_framebuffer_multisample", extStart, extEnd); if (glewExperimental || GLEW_EXT_framebuffer_multisample) CONST_CAST(GLEW_EXT_framebuffer_multisample) = !_glewInit_GL_EXT_framebuffer_multisample(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_framebuffer_multisample */ #ifdef GL_EXT_framebuffer_multisample_blit_scaled CONST_CAST(GLEW_EXT_framebuffer_multisample_blit_scaled) = _glewSearchExtension("GL_EXT_framebuffer_multisample_blit_scaled", extStart, extEnd); #endif /* GL_EXT_framebuffer_multisample_blit_scaled */ #ifdef GL_EXT_framebuffer_object CONST_CAST(GLEW_EXT_framebuffer_object) = _glewSearchExtension("GL_EXT_framebuffer_object", extStart, extEnd); if (glewExperimental || GLEW_EXT_framebuffer_object) CONST_CAST(GLEW_EXT_framebuffer_object) = !_glewInit_GL_EXT_framebuffer_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_framebuffer_object */ #ifdef GL_EXT_framebuffer_sRGB CONST_CAST(GLEW_EXT_framebuffer_sRGB) = _glewSearchExtension("GL_EXT_framebuffer_sRGB", extStart, extEnd); #endif /* GL_EXT_framebuffer_sRGB */ #ifdef GL_EXT_geometry_shader4 CONST_CAST(GLEW_EXT_geometry_shader4) = _glewSearchExtension("GL_EXT_geometry_shader4", extStart, extEnd); if (glewExperimental || GLEW_EXT_geometry_shader4) CONST_CAST(GLEW_EXT_geometry_shader4) = !_glewInit_GL_EXT_geometry_shader4(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_geometry_shader4 */ #ifdef GL_EXT_gpu_program_parameters CONST_CAST(GLEW_EXT_gpu_program_parameters) = _glewSearchExtension("GL_EXT_gpu_program_parameters", extStart, extEnd); if (glewExperimental || GLEW_EXT_gpu_program_parameters) CONST_CAST(GLEW_EXT_gpu_program_parameters) = !_glewInit_GL_EXT_gpu_program_parameters(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_gpu_program_parameters */ #ifdef GL_EXT_gpu_shader4 CONST_CAST(GLEW_EXT_gpu_shader4) = _glewSearchExtension("GL_EXT_gpu_shader4", extStart, extEnd); if (glewExperimental || GLEW_EXT_gpu_shader4) CONST_CAST(GLEW_EXT_gpu_shader4) = !_glewInit_GL_EXT_gpu_shader4(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_gpu_shader4 */ #ifdef GL_EXT_histogram CONST_CAST(GLEW_EXT_histogram) = _glewSearchExtension("GL_EXT_histogram", extStart, extEnd); if (glewExperimental || GLEW_EXT_histogram) CONST_CAST(GLEW_EXT_histogram) = !_glewInit_GL_EXT_histogram(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_histogram */ #ifdef GL_EXT_index_array_formats CONST_CAST(GLEW_EXT_index_array_formats) = _glewSearchExtension("GL_EXT_index_array_formats", extStart, extEnd); #endif /* GL_EXT_index_array_formats */ #ifdef GL_EXT_index_func CONST_CAST(GLEW_EXT_index_func) = _glewSearchExtension("GL_EXT_index_func", extStart, extEnd); if (glewExperimental || GLEW_EXT_index_func) CONST_CAST(GLEW_EXT_index_func) = !_glewInit_GL_EXT_index_func(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_index_func */ #ifdef GL_EXT_index_material CONST_CAST(GLEW_EXT_index_material) = _glewSearchExtension("GL_EXT_index_material", extStart, extEnd); if (glewExperimental || GLEW_EXT_index_material) CONST_CAST(GLEW_EXT_index_material) = !_glewInit_GL_EXT_index_material(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_index_material */ #ifdef GL_EXT_index_texture CONST_CAST(GLEW_EXT_index_texture) = _glewSearchExtension("GL_EXT_index_texture", extStart, extEnd); #endif /* GL_EXT_index_texture */ #ifdef GL_EXT_light_texture CONST_CAST(GLEW_EXT_light_texture) = _glewSearchExtension("GL_EXT_light_texture", extStart, extEnd); if (glewExperimental || GLEW_EXT_light_texture) CONST_CAST(GLEW_EXT_light_texture) = !_glewInit_GL_EXT_light_texture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_light_texture */ #ifdef GL_EXT_misc_attribute CONST_CAST(GLEW_EXT_misc_attribute) = _glewSearchExtension("GL_EXT_misc_attribute", extStart, extEnd); #endif /* GL_EXT_misc_attribute */ #ifdef GL_EXT_multi_draw_arrays CONST_CAST(GLEW_EXT_multi_draw_arrays) = _glewSearchExtension("GL_EXT_multi_draw_arrays", extStart, extEnd); if (glewExperimental || GLEW_EXT_multi_draw_arrays) CONST_CAST(GLEW_EXT_multi_draw_arrays) = !_glewInit_GL_EXT_multi_draw_arrays(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_multi_draw_arrays */ #ifdef GL_EXT_multisample CONST_CAST(GLEW_EXT_multisample) = _glewSearchExtension("GL_EXT_multisample", extStart, extEnd); if (glewExperimental || GLEW_EXT_multisample) CONST_CAST(GLEW_EXT_multisample) = !_glewInit_GL_EXT_multisample(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_multisample */ #ifdef GL_EXT_packed_depth_stencil CONST_CAST(GLEW_EXT_packed_depth_stencil) = _glewSearchExtension("GL_EXT_packed_depth_stencil", extStart, extEnd); #endif /* GL_EXT_packed_depth_stencil */ #ifdef GL_EXT_packed_float CONST_CAST(GLEW_EXT_packed_float) = _glewSearchExtension("GL_EXT_packed_float", extStart, extEnd); #endif /* GL_EXT_packed_float */ #ifdef GL_EXT_packed_pixels CONST_CAST(GLEW_EXT_packed_pixels) = _glewSearchExtension("GL_EXT_packed_pixels", extStart, extEnd); #endif /* GL_EXT_packed_pixels */ #ifdef GL_EXT_paletted_texture CONST_CAST(GLEW_EXT_paletted_texture) = _glewSearchExtension("GL_EXT_paletted_texture", extStart, extEnd); if (glewExperimental || GLEW_EXT_paletted_texture) CONST_CAST(GLEW_EXT_paletted_texture) = !_glewInit_GL_EXT_paletted_texture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_paletted_texture */ #ifdef GL_EXT_pixel_buffer_object CONST_CAST(GLEW_EXT_pixel_buffer_object) = _glewSearchExtension("GL_EXT_pixel_buffer_object", extStart, extEnd); #endif /* GL_EXT_pixel_buffer_object */ #ifdef GL_EXT_pixel_transform CONST_CAST(GLEW_EXT_pixel_transform) = _glewSearchExtension("GL_EXT_pixel_transform", extStart, extEnd); if (glewExperimental || GLEW_EXT_pixel_transform) CONST_CAST(GLEW_EXT_pixel_transform) = !_glewInit_GL_EXT_pixel_transform(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_pixel_transform */ #ifdef GL_EXT_pixel_transform_color_table CONST_CAST(GLEW_EXT_pixel_transform_color_table) = _glewSearchExtension("GL_EXT_pixel_transform_color_table", extStart, extEnd); #endif /* GL_EXT_pixel_transform_color_table */ #ifdef GL_EXT_point_parameters CONST_CAST(GLEW_EXT_point_parameters) = _glewSearchExtension("GL_EXT_point_parameters", extStart, extEnd); if (glewExperimental || GLEW_EXT_point_parameters) CONST_CAST(GLEW_EXT_point_parameters) = !_glewInit_GL_EXT_point_parameters(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_point_parameters */ #ifdef GL_EXT_polygon_offset CONST_CAST(GLEW_EXT_polygon_offset) = _glewSearchExtension("GL_EXT_polygon_offset", extStart, extEnd); if (glewExperimental || GLEW_EXT_polygon_offset) CONST_CAST(GLEW_EXT_polygon_offset) = !_glewInit_GL_EXT_polygon_offset(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_polygon_offset */ #ifdef GL_EXT_provoking_vertex CONST_CAST(GLEW_EXT_provoking_vertex) = _glewSearchExtension("GL_EXT_provoking_vertex", extStart, extEnd); if (glewExperimental || GLEW_EXT_provoking_vertex) CONST_CAST(GLEW_EXT_provoking_vertex) = !_glewInit_GL_EXT_provoking_vertex(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_provoking_vertex */ #ifdef GL_EXT_rescale_normal CONST_CAST(GLEW_EXT_rescale_normal) = _glewSearchExtension("GL_EXT_rescale_normal", extStart, extEnd); #endif /* GL_EXT_rescale_normal */ #ifdef GL_EXT_scene_marker CONST_CAST(GLEW_EXT_scene_marker) = _glewSearchExtension("GL_EXT_scene_marker", extStart, extEnd); if (glewExperimental || GLEW_EXT_scene_marker) CONST_CAST(GLEW_EXT_scene_marker) = !_glewInit_GL_EXT_scene_marker(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_scene_marker */ #ifdef GL_EXT_secondary_color CONST_CAST(GLEW_EXT_secondary_color) = _glewSearchExtension("GL_EXT_secondary_color", extStart, extEnd); if (glewExperimental || GLEW_EXT_secondary_color) CONST_CAST(GLEW_EXT_secondary_color) = !_glewInit_GL_EXT_secondary_color(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_secondary_color */ #ifdef GL_EXT_separate_shader_objects CONST_CAST(GLEW_EXT_separate_shader_objects) = _glewSearchExtension("GL_EXT_separate_shader_objects", extStart, extEnd); if (glewExperimental || GLEW_EXT_separate_shader_objects) CONST_CAST(GLEW_EXT_separate_shader_objects) = !_glewInit_GL_EXT_separate_shader_objects(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_separate_shader_objects */ #ifdef GL_EXT_separate_specular_color CONST_CAST(GLEW_EXT_separate_specular_color) = _glewSearchExtension("GL_EXT_separate_specular_color", extStart, extEnd); #endif /* GL_EXT_separate_specular_color */ #ifdef GL_EXT_shader_image_load_store CONST_CAST(GLEW_EXT_shader_image_load_store) = _glewSearchExtension("GL_EXT_shader_image_load_store", extStart, extEnd); if (glewExperimental || GLEW_EXT_shader_image_load_store) CONST_CAST(GLEW_EXT_shader_image_load_store) = !_glewInit_GL_EXT_shader_image_load_store(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_shader_image_load_store */ #ifdef GL_EXT_shadow_funcs CONST_CAST(GLEW_EXT_shadow_funcs) = _glewSearchExtension("GL_EXT_shadow_funcs", extStart, extEnd); #endif /* GL_EXT_shadow_funcs */ #ifdef GL_EXT_shared_texture_palette CONST_CAST(GLEW_EXT_shared_texture_palette) = _glewSearchExtension("GL_EXT_shared_texture_palette", extStart, extEnd); #endif /* GL_EXT_shared_texture_palette */ #ifdef GL_EXT_stencil_clear_tag CONST_CAST(GLEW_EXT_stencil_clear_tag) = _glewSearchExtension("GL_EXT_stencil_clear_tag", extStart, extEnd); #endif /* GL_EXT_stencil_clear_tag */ #ifdef GL_EXT_stencil_two_side CONST_CAST(GLEW_EXT_stencil_two_side) = _glewSearchExtension("GL_EXT_stencil_two_side", extStart, extEnd); if (glewExperimental || GLEW_EXT_stencil_two_side) CONST_CAST(GLEW_EXT_stencil_two_side) = !_glewInit_GL_EXT_stencil_two_side(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_stencil_two_side */ #ifdef GL_EXT_stencil_wrap CONST_CAST(GLEW_EXT_stencil_wrap) = _glewSearchExtension("GL_EXT_stencil_wrap", extStart, extEnd); #endif /* GL_EXT_stencil_wrap */ #ifdef GL_EXT_subtexture CONST_CAST(GLEW_EXT_subtexture) = _glewSearchExtension("GL_EXT_subtexture", extStart, extEnd); if (glewExperimental || GLEW_EXT_subtexture) CONST_CAST(GLEW_EXT_subtexture) = !_glewInit_GL_EXT_subtexture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_subtexture */ #ifdef GL_EXT_texture CONST_CAST(GLEW_EXT_texture) = _glewSearchExtension("GL_EXT_texture", extStart, extEnd); #endif /* GL_EXT_texture */ #ifdef GL_EXT_texture3D CONST_CAST(GLEW_EXT_texture3D) = _glewSearchExtension("GL_EXT_texture3D", extStart, extEnd); if (glewExperimental || GLEW_EXT_texture3D) CONST_CAST(GLEW_EXT_texture3D) = !_glewInit_GL_EXT_texture3D(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_texture3D */ #ifdef GL_EXT_texture_array CONST_CAST(GLEW_EXT_texture_array) = _glewSearchExtension("GL_EXT_texture_array", extStart, extEnd); if (glewExperimental || GLEW_EXT_texture_array) CONST_CAST(GLEW_EXT_texture_array) = !_glewInit_GL_EXT_texture_array(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_texture_array */ #ifdef GL_EXT_texture_buffer_object CONST_CAST(GLEW_EXT_texture_buffer_object) = _glewSearchExtension("GL_EXT_texture_buffer_object", extStart, extEnd); if (glewExperimental || GLEW_EXT_texture_buffer_object) CONST_CAST(GLEW_EXT_texture_buffer_object) = !_glewInit_GL_EXT_texture_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_texture_buffer_object */ #ifdef GL_EXT_texture_compression_dxt1 CONST_CAST(GLEW_EXT_texture_compression_dxt1) = _glewSearchExtension("GL_EXT_texture_compression_dxt1", extStart, extEnd); #endif /* GL_EXT_texture_compression_dxt1 */ #ifdef GL_EXT_texture_compression_latc CONST_CAST(GLEW_EXT_texture_compression_latc) = _glewSearchExtension("GL_EXT_texture_compression_latc", extStart, extEnd); #endif /* GL_EXT_texture_compression_latc */ #ifdef GL_EXT_texture_compression_rgtc CONST_CAST(GLEW_EXT_texture_compression_rgtc) = _glewSearchExtension("GL_EXT_texture_compression_rgtc", extStart, extEnd); #endif /* GL_EXT_texture_compression_rgtc */ #ifdef GL_EXT_texture_compression_s3tc CONST_CAST(GLEW_EXT_texture_compression_s3tc) = _glewSearchExtension("GL_EXT_texture_compression_s3tc", extStart, extEnd); #endif /* GL_EXT_texture_compression_s3tc */ #ifdef GL_EXT_texture_cube_map CONST_CAST(GLEW_EXT_texture_cube_map) = _glewSearchExtension("GL_EXT_texture_cube_map", extStart, extEnd); #endif /* GL_EXT_texture_cube_map */ #ifdef GL_EXT_texture_edge_clamp CONST_CAST(GLEW_EXT_texture_edge_clamp) = _glewSearchExtension("GL_EXT_texture_edge_clamp", extStart, extEnd); #endif /* GL_EXT_texture_edge_clamp */ #ifdef GL_EXT_texture_env CONST_CAST(GLEW_EXT_texture_env) = _glewSearchExtension("GL_EXT_texture_env", extStart, extEnd); #endif /* GL_EXT_texture_env */ #ifdef GL_EXT_texture_env_add CONST_CAST(GLEW_EXT_texture_env_add) = _glewSearchExtension("GL_EXT_texture_env_add", extStart, extEnd); #endif /* GL_EXT_texture_env_add */ #ifdef GL_EXT_texture_env_combine CONST_CAST(GLEW_EXT_texture_env_combine) = _glewSearchExtension("GL_EXT_texture_env_combine", extStart, extEnd); #endif /* GL_EXT_texture_env_combine */ #ifdef GL_EXT_texture_env_dot3 CONST_CAST(GLEW_EXT_texture_env_dot3) = _glewSearchExtension("GL_EXT_texture_env_dot3", extStart, extEnd); #endif /* GL_EXT_texture_env_dot3 */ #ifdef GL_EXT_texture_filter_anisotropic CONST_CAST(GLEW_EXT_texture_filter_anisotropic) = _glewSearchExtension("GL_EXT_texture_filter_anisotropic", extStart, extEnd); #endif /* GL_EXT_texture_filter_anisotropic */ #ifdef GL_EXT_texture_integer CONST_CAST(GLEW_EXT_texture_integer) = _glewSearchExtension("GL_EXT_texture_integer", extStart, extEnd); if (glewExperimental || GLEW_EXT_texture_integer) CONST_CAST(GLEW_EXT_texture_integer) = !_glewInit_GL_EXT_texture_integer(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_texture_integer */ #ifdef GL_EXT_texture_lod_bias CONST_CAST(GLEW_EXT_texture_lod_bias) = _glewSearchExtension("GL_EXT_texture_lod_bias", extStart, extEnd); #endif /* GL_EXT_texture_lod_bias */ #ifdef GL_EXT_texture_mirror_clamp CONST_CAST(GLEW_EXT_texture_mirror_clamp) = _glewSearchExtension("GL_EXT_texture_mirror_clamp", extStart, extEnd); #endif /* GL_EXT_texture_mirror_clamp */ #ifdef GL_EXT_texture_object CONST_CAST(GLEW_EXT_texture_object) = _glewSearchExtension("GL_EXT_texture_object", extStart, extEnd); if (glewExperimental || GLEW_EXT_texture_object) CONST_CAST(GLEW_EXT_texture_object) = !_glewInit_GL_EXT_texture_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_texture_object */ #ifdef GL_EXT_texture_perturb_normal CONST_CAST(GLEW_EXT_texture_perturb_normal) = _glewSearchExtension("GL_EXT_texture_perturb_normal", extStart, extEnd); if (glewExperimental || GLEW_EXT_texture_perturb_normal) CONST_CAST(GLEW_EXT_texture_perturb_normal) = !_glewInit_GL_EXT_texture_perturb_normal(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_texture_perturb_normal */ #ifdef GL_EXT_texture_rectangle CONST_CAST(GLEW_EXT_texture_rectangle) = _glewSearchExtension("GL_EXT_texture_rectangle", extStart, extEnd); #endif /* GL_EXT_texture_rectangle */ #ifdef GL_EXT_texture_sRGB CONST_CAST(GLEW_EXT_texture_sRGB) = _glewSearchExtension("GL_EXT_texture_sRGB", extStart, extEnd); #endif /* GL_EXT_texture_sRGB */ #ifdef GL_EXT_texture_sRGB_decode CONST_CAST(GLEW_EXT_texture_sRGB_decode) = _glewSearchExtension("GL_EXT_texture_sRGB_decode", extStart, extEnd); #endif /* GL_EXT_texture_sRGB_decode */ #ifdef GL_EXT_texture_shared_exponent CONST_CAST(GLEW_EXT_texture_shared_exponent) = _glewSearchExtension("GL_EXT_texture_shared_exponent", extStart, extEnd); #endif /* GL_EXT_texture_shared_exponent */ #ifdef GL_EXT_texture_snorm CONST_CAST(GLEW_EXT_texture_snorm) = _glewSearchExtension("GL_EXT_texture_snorm", extStart, extEnd); #endif /* GL_EXT_texture_snorm */ #ifdef GL_EXT_texture_swizzle CONST_CAST(GLEW_EXT_texture_swizzle) = _glewSearchExtension("GL_EXT_texture_swizzle", extStart, extEnd); #endif /* GL_EXT_texture_swizzle */ #ifdef GL_EXT_timer_query CONST_CAST(GLEW_EXT_timer_query) = _glewSearchExtension("GL_EXT_timer_query", extStart, extEnd); if (glewExperimental || GLEW_EXT_timer_query) CONST_CAST(GLEW_EXT_timer_query) = !_glewInit_GL_EXT_timer_query(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_timer_query */ #ifdef GL_EXT_transform_feedback CONST_CAST(GLEW_EXT_transform_feedback) = _glewSearchExtension("GL_EXT_transform_feedback", extStart, extEnd); if (glewExperimental || GLEW_EXT_transform_feedback) CONST_CAST(GLEW_EXT_transform_feedback) = !_glewInit_GL_EXT_transform_feedback(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_transform_feedback */ #ifdef GL_EXT_vertex_array CONST_CAST(GLEW_EXT_vertex_array) = _glewSearchExtension("GL_EXT_vertex_array", extStart, extEnd); if (glewExperimental || GLEW_EXT_vertex_array) CONST_CAST(GLEW_EXT_vertex_array) = !_glewInit_GL_EXT_vertex_array(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_vertex_array */ #ifdef GL_EXT_vertex_array_bgra CONST_CAST(GLEW_EXT_vertex_array_bgra) = _glewSearchExtension("GL_EXT_vertex_array_bgra", extStart, extEnd); #endif /* GL_EXT_vertex_array_bgra */ #ifdef GL_EXT_vertex_attrib_64bit CONST_CAST(GLEW_EXT_vertex_attrib_64bit) = _glewSearchExtension("GL_EXT_vertex_attrib_64bit", extStart, extEnd); if (glewExperimental || GLEW_EXT_vertex_attrib_64bit) CONST_CAST(GLEW_EXT_vertex_attrib_64bit) = !_glewInit_GL_EXT_vertex_attrib_64bit(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_vertex_attrib_64bit */ #ifdef GL_EXT_vertex_shader CONST_CAST(GLEW_EXT_vertex_shader) = _glewSearchExtension("GL_EXT_vertex_shader", extStart, extEnd); if (glewExperimental || GLEW_EXT_vertex_shader) CONST_CAST(GLEW_EXT_vertex_shader) = !_glewInit_GL_EXT_vertex_shader(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_vertex_shader */ #ifdef GL_EXT_vertex_weighting CONST_CAST(GLEW_EXT_vertex_weighting) = _glewSearchExtension("GL_EXT_vertex_weighting", extStart, extEnd); if (glewExperimental || GLEW_EXT_vertex_weighting) CONST_CAST(GLEW_EXT_vertex_weighting) = !_glewInit_GL_EXT_vertex_weighting(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_vertex_weighting */ #ifdef GL_EXT_x11_sync_object CONST_CAST(GLEW_EXT_x11_sync_object) = _glewSearchExtension("GL_EXT_x11_sync_object", extStart, extEnd); if (glewExperimental || GLEW_EXT_x11_sync_object) CONST_CAST(GLEW_EXT_x11_sync_object) = !_glewInit_GL_EXT_x11_sync_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_x11_sync_object */ #ifdef GL_GREMEDY_frame_terminator CONST_CAST(GLEW_GREMEDY_frame_terminator) = _glewSearchExtension("GL_GREMEDY_frame_terminator", extStart, extEnd); if (glewExperimental || GLEW_GREMEDY_frame_terminator) CONST_CAST(GLEW_GREMEDY_frame_terminator) = !_glewInit_GL_GREMEDY_frame_terminator(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_GREMEDY_frame_terminator */ #ifdef GL_GREMEDY_string_marker CONST_CAST(GLEW_GREMEDY_string_marker) = _glewSearchExtension("GL_GREMEDY_string_marker", extStart, extEnd); if (glewExperimental || GLEW_GREMEDY_string_marker) CONST_CAST(GLEW_GREMEDY_string_marker) = !_glewInit_GL_GREMEDY_string_marker(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_GREMEDY_string_marker */ #ifdef GL_HP_convolution_border_modes CONST_CAST(GLEW_HP_convolution_border_modes) = _glewSearchExtension("GL_HP_convolution_border_modes", extStart, extEnd); #endif /* GL_HP_convolution_border_modes */ #ifdef GL_HP_image_transform CONST_CAST(GLEW_HP_image_transform) = _glewSearchExtension("GL_HP_image_transform", extStart, extEnd); if (glewExperimental || GLEW_HP_image_transform) CONST_CAST(GLEW_HP_image_transform) = !_glewInit_GL_HP_image_transform(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_HP_image_transform */ #ifdef GL_HP_occlusion_test CONST_CAST(GLEW_HP_occlusion_test) = _glewSearchExtension("GL_HP_occlusion_test", extStart, extEnd); #endif /* GL_HP_occlusion_test */ #ifdef GL_HP_texture_lighting CONST_CAST(GLEW_HP_texture_lighting) = _glewSearchExtension("GL_HP_texture_lighting", extStart, extEnd); #endif /* GL_HP_texture_lighting */ #ifdef GL_IBM_cull_vertex CONST_CAST(GLEW_IBM_cull_vertex) = _glewSearchExtension("GL_IBM_cull_vertex", extStart, extEnd); #endif /* GL_IBM_cull_vertex */ #ifdef GL_IBM_multimode_draw_arrays CONST_CAST(GLEW_IBM_multimode_draw_arrays) = _glewSearchExtension("GL_IBM_multimode_draw_arrays", extStart, extEnd); if (glewExperimental || GLEW_IBM_multimode_draw_arrays) CONST_CAST(GLEW_IBM_multimode_draw_arrays) = !_glewInit_GL_IBM_multimode_draw_arrays(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_IBM_multimode_draw_arrays */ #ifdef GL_IBM_rasterpos_clip CONST_CAST(GLEW_IBM_rasterpos_clip) = _glewSearchExtension("GL_IBM_rasterpos_clip", extStart, extEnd); #endif /* GL_IBM_rasterpos_clip */ #ifdef GL_IBM_static_data CONST_CAST(GLEW_IBM_static_data) = _glewSearchExtension("GL_IBM_static_data", extStart, extEnd); #endif /* GL_IBM_static_data */ #ifdef GL_IBM_texture_mirrored_repeat CONST_CAST(GLEW_IBM_texture_mirrored_repeat) = _glewSearchExtension("GL_IBM_texture_mirrored_repeat", extStart, extEnd); #endif /* GL_IBM_texture_mirrored_repeat */ #ifdef GL_IBM_vertex_array_lists CONST_CAST(GLEW_IBM_vertex_array_lists) = _glewSearchExtension("GL_IBM_vertex_array_lists", extStart, extEnd); if (glewExperimental || GLEW_IBM_vertex_array_lists) CONST_CAST(GLEW_IBM_vertex_array_lists) = !_glewInit_GL_IBM_vertex_array_lists(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_IBM_vertex_array_lists */ #ifdef GL_INGR_color_clamp CONST_CAST(GLEW_INGR_color_clamp) = _glewSearchExtension("GL_INGR_color_clamp", extStart, extEnd); #endif /* GL_INGR_color_clamp */ #ifdef GL_INGR_interlace_read CONST_CAST(GLEW_INGR_interlace_read) = _glewSearchExtension("GL_INGR_interlace_read", extStart, extEnd); #endif /* GL_INGR_interlace_read */ #ifdef GL_INTEL_parallel_arrays CONST_CAST(GLEW_INTEL_parallel_arrays) = _glewSearchExtension("GL_INTEL_parallel_arrays", extStart, extEnd); if (glewExperimental || GLEW_INTEL_parallel_arrays) CONST_CAST(GLEW_INTEL_parallel_arrays) = !_glewInit_GL_INTEL_parallel_arrays(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_INTEL_parallel_arrays */ #ifdef GL_INTEL_texture_scissor CONST_CAST(GLEW_INTEL_texture_scissor) = _glewSearchExtension("GL_INTEL_texture_scissor", extStart, extEnd); if (glewExperimental || GLEW_INTEL_texture_scissor) CONST_CAST(GLEW_INTEL_texture_scissor) = !_glewInit_GL_INTEL_texture_scissor(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_INTEL_texture_scissor */ #ifdef GL_KHR_debug CONST_CAST(GLEW_KHR_debug) = _glewSearchExtension("GL_KHR_debug", extStart, extEnd); if (glewExperimental || GLEW_KHR_debug) CONST_CAST(GLEW_KHR_debug) = !_glewInit_GL_KHR_debug(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_KHR_debug */ #ifdef GL_KHR_texture_compression_astc_ldr CONST_CAST(GLEW_KHR_texture_compression_astc_ldr) = _glewSearchExtension("GL_KHR_texture_compression_astc_ldr", extStart, extEnd); #endif /* GL_KHR_texture_compression_astc_ldr */ #ifdef GL_KTX_buffer_region CONST_CAST(GLEW_KTX_buffer_region) = _glewSearchExtension("GL_KTX_buffer_region", extStart, extEnd); if (glewExperimental || GLEW_KTX_buffer_region) CONST_CAST(GLEW_KTX_buffer_region) = !_glewInit_GL_KTX_buffer_region(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_KTX_buffer_region */ #ifdef GL_MESAX_texture_stack CONST_CAST(GLEW_MESAX_texture_stack) = _glewSearchExtension("GL_MESAX_texture_stack", extStart, extEnd); #endif /* GL_MESAX_texture_stack */ #ifdef GL_MESA_pack_invert CONST_CAST(GLEW_MESA_pack_invert) = _glewSearchExtension("GL_MESA_pack_invert", extStart, extEnd); #endif /* GL_MESA_pack_invert */ #ifdef GL_MESA_resize_buffers CONST_CAST(GLEW_MESA_resize_buffers) = _glewSearchExtension("GL_MESA_resize_buffers", extStart, extEnd); if (glewExperimental || GLEW_MESA_resize_buffers) CONST_CAST(GLEW_MESA_resize_buffers) = !_glewInit_GL_MESA_resize_buffers(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_MESA_resize_buffers */ #ifdef GL_MESA_window_pos CONST_CAST(GLEW_MESA_window_pos) = _glewSearchExtension("GL_MESA_window_pos", extStart, extEnd); if (glewExperimental || GLEW_MESA_window_pos) CONST_CAST(GLEW_MESA_window_pos) = !_glewInit_GL_MESA_window_pos(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_MESA_window_pos */ #ifdef GL_MESA_ycbcr_texture CONST_CAST(GLEW_MESA_ycbcr_texture) = _glewSearchExtension("GL_MESA_ycbcr_texture", extStart, extEnd); #endif /* GL_MESA_ycbcr_texture */ #ifdef GL_NVX_gpu_memory_info CONST_CAST(GLEW_NVX_gpu_memory_info) = _glewSearchExtension("GL_NVX_gpu_memory_info", extStart, extEnd); #endif /* GL_NVX_gpu_memory_info */ #ifdef GL_NV_bindless_texture CONST_CAST(GLEW_NV_bindless_texture) = _glewSearchExtension("GL_NV_bindless_texture", extStart, extEnd); if (glewExperimental || GLEW_NV_bindless_texture) CONST_CAST(GLEW_NV_bindless_texture) = !_glewInit_GL_NV_bindless_texture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_bindless_texture */ #ifdef GL_NV_blend_square CONST_CAST(GLEW_NV_blend_square) = _glewSearchExtension("GL_NV_blend_square", extStart, extEnd); #endif /* GL_NV_blend_square */ #ifdef GL_NV_conditional_render CONST_CAST(GLEW_NV_conditional_render) = _glewSearchExtension("GL_NV_conditional_render", extStart, extEnd); if (glewExperimental || GLEW_NV_conditional_render) CONST_CAST(GLEW_NV_conditional_render) = !_glewInit_GL_NV_conditional_render(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_conditional_render */ #ifdef GL_NV_copy_depth_to_color CONST_CAST(GLEW_NV_copy_depth_to_color) = _glewSearchExtension("GL_NV_copy_depth_to_color", extStart, extEnd); #endif /* GL_NV_copy_depth_to_color */ #ifdef GL_NV_copy_image CONST_CAST(GLEW_NV_copy_image) = _glewSearchExtension("GL_NV_copy_image", extStart, extEnd); if (glewExperimental || GLEW_NV_copy_image) CONST_CAST(GLEW_NV_copy_image) = !_glewInit_GL_NV_copy_image(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_copy_image */ #ifdef GL_NV_depth_buffer_float CONST_CAST(GLEW_NV_depth_buffer_float) = _glewSearchExtension("GL_NV_depth_buffer_float", extStart, extEnd); if (glewExperimental || GLEW_NV_depth_buffer_float) CONST_CAST(GLEW_NV_depth_buffer_float) = !_glewInit_GL_NV_depth_buffer_float(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_depth_buffer_float */ #ifdef GL_NV_depth_clamp CONST_CAST(GLEW_NV_depth_clamp) = _glewSearchExtension("GL_NV_depth_clamp", extStart, extEnd); #endif /* GL_NV_depth_clamp */ #ifdef GL_NV_depth_range_unclamped CONST_CAST(GLEW_NV_depth_range_unclamped) = _glewSearchExtension("GL_NV_depth_range_unclamped", extStart, extEnd); #endif /* GL_NV_depth_range_unclamped */ #ifdef GL_NV_evaluators CONST_CAST(GLEW_NV_evaluators) = _glewSearchExtension("GL_NV_evaluators", extStart, extEnd); if (glewExperimental || GLEW_NV_evaluators) CONST_CAST(GLEW_NV_evaluators) = !_glewInit_GL_NV_evaluators(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_evaluators */ #ifdef GL_NV_explicit_multisample CONST_CAST(GLEW_NV_explicit_multisample) = _glewSearchExtension("GL_NV_explicit_multisample", extStart, extEnd); if (glewExperimental || GLEW_NV_explicit_multisample) CONST_CAST(GLEW_NV_explicit_multisample) = !_glewInit_GL_NV_explicit_multisample(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_explicit_multisample */ #ifdef GL_NV_fence CONST_CAST(GLEW_NV_fence) = _glewSearchExtension("GL_NV_fence", extStart, extEnd); if (glewExperimental || GLEW_NV_fence) CONST_CAST(GLEW_NV_fence) = !_glewInit_GL_NV_fence(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_fence */ #ifdef GL_NV_float_buffer CONST_CAST(GLEW_NV_float_buffer) = _glewSearchExtension("GL_NV_float_buffer", extStart, extEnd); #endif /* GL_NV_float_buffer */ #ifdef GL_NV_fog_distance CONST_CAST(GLEW_NV_fog_distance) = _glewSearchExtension("GL_NV_fog_distance", extStart, extEnd); #endif /* GL_NV_fog_distance */ #ifdef GL_NV_fragment_program CONST_CAST(GLEW_NV_fragment_program) = _glewSearchExtension("GL_NV_fragment_program", extStart, extEnd); if (glewExperimental || GLEW_NV_fragment_program) CONST_CAST(GLEW_NV_fragment_program) = !_glewInit_GL_NV_fragment_program(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_fragment_program */ #ifdef GL_NV_fragment_program2 CONST_CAST(GLEW_NV_fragment_program2) = _glewSearchExtension("GL_NV_fragment_program2", extStart, extEnd); #endif /* GL_NV_fragment_program2 */ #ifdef GL_NV_fragment_program4 CONST_CAST(GLEW_NV_fragment_program4) = _glewSearchExtension("GL_NV_gpu_program4", extStart, extEnd); #endif /* GL_NV_fragment_program4 */ #ifdef GL_NV_fragment_program_option CONST_CAST(GLEW_NV_fragment_program_option) = _glewSearchExtension("GL_NV_fragment_program_option", extStart, extEnd); #endif /* GL_NV_fragment_program_option */ #ifdef GL_NV_framebuffer_multisample_coverage CONST_CAST(GLEW_NV_framebuffer_multisample_coverage) = _glewSearchExtension("GL_NV_framebuffer_multisample_coverage", extStart, extEnd); if (glewExperimental || GLEW_NV_framebuffer_multisample_coverage) CONST_CAST(GLEW_NV_framebuffer_multisample_coverage) = !_glewInit_GL_NV_framebuffer_multisample_coverage(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_framebuffer_multisample_coverage */ #ifdef GL_NV_geometry_program4 CONST_CAST(GLEW_NV_geometry_program4) = _glewSearchExtension("GL_NV_gpu_program4", extStart, extEnd); if (glewExperimental || GLEW_NV_geometry_program4) CONST_CAST(GLEW_NV_geometry_program4) = !_glewInit_GL_NV_geometry_program4(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_geometry_program4 */ #ifdef GL_NV_geometry_shader4 CONST_CAST(GLEW_NV_geometry_shader4) = _glewSearchExtension("GL_NV_geometry_shader4", extStart, extEnd); #endif /* GL_NV_geometry_shader4 */ #ifdef GL_NV_gpu_program4 CONST_CAST(GLEW_NV_gpu_program4) = _glewSearchExtension("GL_NV_gpu_program4", extStart, extEnd); if (glewExperimental || GLEW_NV_gpu_program4) CONST_CAST(GLEW_NV_gpu_program4) = !_glewInit_GL_NV_gpu_program4(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_gpu_program4 */ #ifdef GL_NV_gpu_program5 CONST_CAST(GLEW_NV_gpu_program5) = _glewSearchExtension("GL_NV_gpu_program5", extStart, extEnd); #endif /* GL_NV_gpu_program5 */ #ifdef GL_NV_gpu_program_fp64 CONST_CAST(GLEW_NV_gpu_program_fp64) = _glewSearchExtension("GL_NV_gpu_program_fp64", extStart, extEnd); #endif /* GL_NV_gpu_program_fp64 */ #ifdef GL_NV_gpu_shader5 CONST_CAST(GLEW_NV_gpu_shader5) = _glewSearchExtension("GL_NV_gpu_shader5", extStart, extEnd); if (glewExperimental || GLEW_NV_gpu_shader5) CONST_CAST(GLEW_NV_gpu_shader5) = !_glewInit_GL_NV_gpu_shader5(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_gpu_shader5 */ #ifdef GL_NV_half_float CONST_CAST(GLEW_NV_half_float) = _glewSearchExtension("GL_NV_half_float", extStart, extEnd); if (glewExperimental || GLEW_NV_half_float) CONST_CAST(GLEW_NV_half_float) = !_glewInit_GL_NV_half_float(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_half_float */ #ifdef GL_NV_light_max_exponent CONST_CAST(GLEW_NV_light_max_exponent) = _glewSearchExtension("GL_NV_light_max_exponent", extStart, extEnd); #endif /* GL_NV_light_max_exponent */ #ifdef GL_NV_multisample_coverage CONST_CAST(GLEW_NV_multisample_coverage) = _glewSearchExtension("GL_NV_multisample_coverage", extStart, extEnd); #endif /* GL_NV_multisample_coverage */ #ifdef GL_NV_multisample_filter_hint CONST_CAST(GLEW_NV_multisample_filter_hint) = _glewSearchExtension("GL_NV_multisample_filter_hint", extStart, extEnd); #endif /* GL_NV_multisample_filter_hint */ #ifdef GL_NV_occlusion_query CONST_CAST(GLEW_NV_occlusion_query) = _glewSearchExtension("GL_NV_occlusion_query", extStart, extEnd); if (glewExperimental || GLEW_NV_occlusion_query) CONST_CAST(GLEW_NV_occlusion_query) = !_glewInit_GL_NV_occlusion_query(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_occlusion_query */ #ifdef GL_NV_packed_depth_stencil CONST_CAST(GLEW_NV_packed_depth_stencil) = _glewSearchExtension("GL_NV_packed_depth_stencil", extStart, extEnd); #endif /* GL_NV_packed_depth_stencil */ #ifdef GL_NV_parameter_buffer_object CONST_CAST(GLEW_NV_parameter_buffer_object) = _glewSearchExtension("GL_NV_parameter_buffer_object", extStart, extEnd); if (glewExperimental || GLEW_NV_parameter_buffer_object) CONST_CAST(GLEW_NV_parameter_buffer_object) = !_glewInit_GL_NV_parameter_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_parameter_buffer_object */ #ifdef GL_NV_parameter_buffer_object2 CONST_CAST(GLEW_NV_parameter_buffer_object2) = _glewSearchExtension("GL_NV_parameter_buffer_object2", extStart, extEnd); #endif /* GL_NV_parameter_buffer_object2 */ #ifdef GL_NV_path_rendering CONST_CAST(GLEW_NV_path_rendering) = _glewSearchExtension("GL_NV_path_rendering", extStart, extEnd); if (glewExperimental || GLEW_NV_path_rendering) CONST_CAST(GLEW_NV_path_rendering) = !_glewInit_GL_NV_path_rendering(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_path_rendering */ #ifdef GL_NV_pixel_data_range CONST_CAST(GLEW_NV_pixel_data_range) = _glewSearchExtension("GL_NV_pixel_data_range", extStart, extEnd); if (glewExperimental || GLEW_NV_pixel_data_range) CONST_CAST(GLEW_NV_pixel_data_range) = !_glewInit_GL_NV_pixel_data_range(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_pixel_data_range */ #ifdef GL_NV_point_sprite CONST_CAST(GLEW_NV_point_sprite) = _glewSearchExtension("GL_NV_point_sprite", extStart, extEnd); if (glewExperimental || GLEW_NV_point_sprite) CONST_CAST(GLEW_NV_point_sprite) = !_glewInit_GL_NV_point_sprite(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_point_sprite */ #ifdef GL_NV_present_video CONST_CAST(GLEW_NV_present_video) = _glewSearchExtension("GL_NV_present_video", extStart, extEnd); if (glewExperimental || GLEW_NV_present_video) CONST_CAST(GLEW_NV_present_video) = !_glewInit_GL_NV_present_video(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_present_video */ #ifdef GL_NV_primitive_restart CONST_CAST(GLEW_NV_primitive_restart) = _glewSearchExtension("GL_NV_primitive_restart", extStart, extEnd); if (glewExperimental || GLEW_NV_primitive_restart) CONST_CAST(GLEW_NV_primitive_restart) = !_glewInit_GL_NV_primitive_restart(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_primitive_restart */ #ifdef GL_NV_register_combiners CONST_CAST(GLEW_NV_register_combiners) = _glewSearchExtension("GL_NV_register_combiners", extStart, extEnd); if (glewExperimental || GLEW_NV_register_combiners) CONST_CAST(GLEW_NV_register_combiners) = !_glewInit_GL_NV_register_combiners(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_register_combiners */ #ifdef GL_NV_register_combiners2 CONST_CAST(GLEW_NV_register_combiners2) = _glewSearchExtension("GL_NV_register_combiners2", extStart, extEnd); if (glewExperimental || GLEW_NV_register_combiners2) CONST_CAST(GLEW_NV_register_combiners2) = !_glewInit_GL_NV_register_combiners2(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_register_combiners2 */ #ifdef GL_NV_shader_atomic_float CONST_CAST(GLEW_NV_shader_atomic_float) = _glewSearchExtension("GL_NV_shader_atomic_float", extStart, extEnd); #endif /* GL_NV_shader_atomic_float */ #ifdef GL_NV_shader_buffer_load CONST_CAST(GLEW_NV_shader_buffer_load) = _glewSearchExtension("GL_NV_shader_buffer_load", extStart, extEnd); if (glewExperimental || GLEW_NV_shader_buffer_load) CONST_CAST(GLEW_NV_shader_buffer_load) = !_glewInit_GL_NV_shader_buffer_load(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_shader_buffer_load */ #ifdef GL_NV_tessellation_program5 CONST_CAST(GLEW_NV_tessellation_program5) = _glewSearchExtension("GL_NV_gpu_program5", extStart, extEnd); #endif /* GL_NV_tessellation_program5 */ #ifdef GL_NV_texgen_emboss CONST_CAST(GLEW_NV_texgen_emboss) = _glewSearchExtension("GL_NV_texgen_emboss", extStart, extEnd); #endif /* GL_NV_texgen_emboss */ #ifdef GL_NV_texgen_reflection CONST_CAST(GLEW_NV_texgen_reflection) = _glewSearchExtension("GL_NV_texgen_reflection", extStart, extEnd); #endif /* GL_NV_texgen_reflection */ #ifdef GL_NV_texture_barrier CONST_CAST(GLEW_NV_texture_barrier) = _glewSearchExtension("GL_NV_texture_barrier", extStart, extEnd); if (glewExperimental || GLEW_NV_texture_barrier) CONST_CAST(GLEW_NV_texture_barrier) = !_glewInit_GL_NV_texture_barrier(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_texture_barrier */ #ifdef GL_NV_texture_compression_vtc CONST_CAST(GLEW_NV_texture_compression_vtc) = _glewSearchExtension("GL_NV_texture_compression_vtc", extStart, extEnd); #endif /* GL_NV_texture_compression_vtc */ #ifdef GL_NV_texture_env_combine4 CONST_CAST(GLEW_NV_texture_env_combine4) = _glewSearchExtension("GL_NV_texture_env_combine4", extStart, extEnd); #endif /* GL_NV_texture_env_combine4 */ #ifdef GL_NV_texture_expand_normal CONST_CAST(GLEW_NV_texture_expand_normal) = _glewSearchExtension("GL_NV_texture_expand_normal", extStart, extEnd); #endif /* GL_NV_texture_expand_normal */ #ifdef GL_NV_texture_multisample CONST_CAST(GLEW_NV_texture_multisample) = _glewSearchExtension("GL_NV_texture_multisample", extStart, extEnd); if (glewExperimental || GLEW_NV_texture_multisample) CONST_CAST(GLEW_NV_texture_multisample) = !_glewInit_GL_NV_texture_multisample(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_texture_multisample */ #ifdef GL_NV_texture_rectangle CONST_CAST(GLEW_NV_texture_rectangle) = _glewSearchExtension("GL_NV_texture_rectangle", extStart, extEnd); #endif /* GL_NV_texture_rectangle */ #ifdef GL_NV_texture_shader CONST_CAST(GLEW_NV_texture_shader) = _glewSearchExtension("GL_NV_texture_shader", extStart, extEnd); #endif /* GL_NV_texture_shader */ #ifdef GL_NV_texture_shader2 CONST_CAST(GLEW_NV_texture_shader2) = _glewSearchExtension("GL_NV_texture_shader2", extStart, extEnd); #endif /* GL_NV_texture_shader2 */ #ifdef GL_NV_texture_shader3 CONST_CAST(GLEW_NV_texture_shader3) = _glewSearchExtension("GL_NV_texture_shader3", extStart, extEnd); #endif /* GL_NV_texture_shader3 */ #ifdef GL_NV_transform_feedback CONST_CAST(GLEW_NV_transform_feedback) = _glewSearchExtension("GL_NV_transform_feedback", extStart, extEnd); if (glewExperimental || GLEW_NV_transform_feedback) CONST_CAST(GLEW_NV_transform_feedback) = !_glewInit_GL_NV_transform_feedback(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_transform_feedback */ #ifdef GL_NV_transform_feedback2 CONST_CAST(GLEW_NV_transform_feedback2) = _glewSearchExtension("GL_NV_transform_feedback2", extStart, extEnd); if (glewExperimental || GLEW_NV_transform_feedback2) CONST_CAST(GLEW_NV_transform_feedback2) = !_glewInit_GL_NV_transform_feedback2(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_transform_feedback2 */ #ifdef GL_NV_vdpau_interop CONST_CAST(GLEW_NV_vdpau_interop) = _glewSearchExtension("GL_NV_vdpau_interop", extStart, extEnd); if (glewExperimental || GLEW_NV_vdpau_interop) CONST_CAST(GLEW_NV_vdpau_interop) = !_glewInit_GL_NV_vdpau_interop(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_vdpau_interop */ #ifdef GL_NV_vertex_array_range CONST_CAST(GLEW_NV_vertex_array_range) = _glewSearchExtension("GL_NV_vertex_array_range", extStart, extEnd); if (glewExperimental || GLEW_NV_vertex_array_range) CONST_CAST(GLEW_NV_vertex_array_range) = !_glewInit_GL_NV_vertex_array_range(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_vertex_array_range */ #ifdef GL_NV_vertex_array_range2 CONST_CAST(GLEW_NV_vertex_array_range2) = _glewSearchExtension("GL_NV_vertex_array_range2", extStart, extEnd); #endif /* GL_NV_vertex_array_range2 */ #ifdef GL_NV_vertex_attrib_integer_64bit CONST_CAST(GLEW_NV_vertex_attrib_integer_64bit) = _glewSearchExtension("GL_NV_vertex_attrib_integer_64bit", extStart, extEnd); if (glewExperimental || GLEW_NV_vertex_attrib_integer_64bit) CONST_CAST(GLEW_NV_vertex_attrib_integer_64bit) = !_glewInit_GL_NV_vertex_attrib_integer_64bit(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_vertex_attrib_integer_64bit */ #ifdef GL_NV_vertex_buffer_unified_memory CONST_CAST(GLEW_NV_vertex_buffer_unified_memory) = _glewSearchExtension("GL_NV_vertex_buffer_unified_memory", extStart, extEnd); if (glewExperimental || GLEW_NV_vertex_buffer_unified_memory) CONST_CAST(GLEW_NV_vertex_buffer_unified_memory) = !_glewInit_GL_NV_vertex_buffer_unified_memory(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_vertex_buffer_unified_memory */ #ifdef GL_NV_vertex_program CONST_CAST(GLEW_NV_vertex_program) = _glewSearchExtension("GL_NV_vertex_program", extStart, extEnd); if (glewExperimental || GLEW_NV_vertex_program) CONST_CAST(GLEW_NV_vertex_program) = !_glewInit_GL_NV_vertex_program(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_vertex_program */ #ifdef GL_NV_vertex_program1_1 CONST_CAST(GLEW_NV_vertex_program1_1) = _glewSearchExtension("GL_NV_vertex_program1_1", extStart, extEnd); #endif /* GL_NV_vertex_program1_1 */ #ifdef GL_NV_vertex_program2 CONST_CAST(GLEW_NV_vertex_program2) = _glewSearchExtension("GL_NV_vertex_program2", extStart, extEnd); #endif /* GL_NV_vertex_program2 */ #ifdef GL_NV_vertex_program2_option CONST_CAST(GLEW_NV_vertex_program2_option) = _glewSearchExtension("GL_NV_vertex_program2_option", extStart, extEnd); #endif /* GL_NV_vertex_program2_option */ #ifdef GL_NV_vertex_program3 CONST_CAST(GLEW_NV_vertex_program3) = _glewSearchExtension("GL_NV_vertex_program3", extStart, extEnd); #endif /* GL_NV_vertex_program3 */ #ifdef GL_NV_vertex_program4 CONST_CAST(GLEW_NV_vertex_program4) = _glewSearchExtension("GL_NV_gpu_program4", extStart, extEnd); #endif /* GL_NV_vertex_program4 */ #ifdef GL_NV_video_capture CONST_CAST(GLEW_NV_video_capture) = _glewSearchExtension("GL_NV_video_capture", extStart, extEnd); if (glewExperimental || GLEW_NV_video_capture) CONST_CAST(GLEW_NV_video_capture) = !_glewInit_GL_NV_video_capture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_video_capture */ #ifdef GL_OES_byte_coordinates CONST_CAST(GLEW_OES_byte_coordinates) = _glewSearchExtension("GL_OES_byte_coordinates", extStart, extEnd); #endif /* GL_OES_byte_coordinates */ #ifdef GL_OES_compressed_paletted_texture CONST_CAST(GLEW_OES_compressed_paletted_texture) = _glewSearchExtension("GL_OES_compressed_paletted_texture", extStart, extEnd); #endif /* GL_OES_compressed_paletted_texture */ #ifdef GL_OES_read_format CONST_CAST(GLEW_OES_read_format) = _glewSearchExtension("GL_OES_read_format", extStart, extEnd); #endif /* GL_OES_read_format */ #ifdef GL_OES_single_precision CONST_CAST(GLEW_OES_single_precision) = _glewSearchExtension("GL_OES_single_precision", extStart, extEnd); if (glewExperimental || GLEW_OES_single_precision) CONST_CAST(GLEW_OES_single_precision) = !_glewInit_GL_OES_single_precision(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_OES_single_precision */ #ifdef GL_OML_interlace CONST_CAST(GLEW_OML_interlace) = _glewSearchExtension("GL_OML_interlace", extStart, extEnd); #endif /* GL_OML_interlace */ #ifdef GL_OML_resample CONST_CAST(GLEW_OML_resample) = _glewSearchExtension("GL_OML_resample", extStart, extEnd); #endif /* GL_OML_resample */ #ifdef GL_OML_subsample CONST_CAST(GLEW_OML_subsample) = _glewSearchExtension("GL_OML_subsample", extStart, extEnd); #endif /* GL_OML_subsample */ #ifdef GL_PGI_misc_hints CONST_CAST(GLEW_PGI_misc_hints) = _glewSearchExtension("GL_PGI_misc_hints", extStart, extEnd); #endif /* GL_PGI_misc_hints */ #ifdef GL_PGI_vertex_hints CONST_CAST(GLEW_PGI_vertex_hints) = _glewSearchExtension("GL_PGI_vertex_hints", extStart, extEnd); #endif /* GL_PGI_vertex_hints */ #ifdef GL_REGAL_error_string CONST_CAST(GLEW_REGAL_error_string) = _glewSearchExtension("GL_REGAL_error_string", extStart, extEnd); if (glewExperimental || GLEW_REGAL_error_string) CONST_CAST(GLEW_REGAL_error_string) = !_glewInit_GL_REGAL_error_string(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_REGAL_error_string */ #ifdef GL_REGAL_extension_query CONST_CAST(GLEW_REGAL_extension_query) = _glewSearchExtension("GL_REGAL_extension_query", extStart, extEnd); if (glewExperimental || GLEW_REGAL_extension_query) CONST_CAST(GLEW_REGAL_extension_query) = !_glewInit_GL_REGAL_extension_query(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_REGAL_extension_query */ #ifdef GL_REGAL_log CONST_CAST(GLEW_REGAL_log) = _glewSearchExtension("GL_REGAL_log", extStart, extEnd); #endif /* GL_REGAL_log */ #ifdef GL_REND_screen_coordinates CONST_CAST(GLEW_REND_screen_coordinates) = _glewSearchExtension("GL_REND_screen_coordinates", extStart, extEnd); #endif /* GL_REND_screen_coordinates */ #ifdef GL_S3_s3tc CONST_CAST(GLEW_S3_s3tc) = _glewSearchExtension("GL_S3_s3tc", extStart, extEnd); #endif /* GL_S3_s3tc */ #ifdef GL_SGIS_color_range CONST_CAST(GLEW_SGIS_color_range) = _glewSearchExtension("GL_SGIS_color_range", extStart, extEnd); #endif /* GL_SGIS_color_range */ #ifdef GL_SGIS_detail_texture CONST_CAST(GLEW_SGIS_detail_texture) = _glewSearchExtension("GL_SGIS_detail_texture", extStart, extEnd); if (glewExperimental || GLEW_SGIS_detail_texture) CONST_CAST(GLEW_SGIS_detail_texture) = !_glewInit_GL_SGIS_detail_texture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIS_detail_texture */ #ifdef GL_SGIS_fog_function CONST_CAST(GLEW_SGIS_fog_function) = _glewSearchExtension("GL_SGIS_fog_function", extStart, extEnd); if (glewExperimental || GLEW_SGIS_fog_function) CONST_CAST(GLEW_SGIS_fog_function) = !_glewInit_GL_SGIS_fog_function(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIS_fog_function */ #ifdef GL_SGIS_generate_mipmap CONST_CAST(GLEW_SGIS_generate_mipmap) = _glewSearchExtension("GL_SGIS_generate_mipmap", extStart, extEnd); #endif /* GL_SGIS_generate_mipmap */ #ifdef GL_SGIS_multisample CONST_CAST(GLEW_SGIS_multisample) = _glewSearchExtension("GL_SGIS_multisample", extStart, extEnd); if (glewExperimental || GLEW_SGIS_multisample) CONST_CAST(GLEW_SGIS_multisample) = !_glewInit_GL_SGIS_multisample(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIS_multisample */ #ifdef GL_SGIS_pixel_texture CONST_CAST(GLEW_SGIS_pixel_texture) = _glewSearchExtension("GL_SGIS_pixel_texture", extStart, extEnd); #endif /* GL_SGIS_pixel_texture */ #ifdef GL_SGIS_point_line_texgen CONST_CAST(GLEW_SGIS_point_line_texgen) = _glewSearchExtension("GL_SGIS_point_line_texgen", extStart, extEnd); #endif /* GL_SGIS_point_line_texgen */ #ifdef GL_SGIS_sharpen_texture CONST_CAST(GLEW_SGIS_sharpen_texture) = _glewSearchExtension("GL_SGIS_sharpen_texture", extStart, extEnd); if (glewExperimental || GLEW_SGIS_sharpen_texture) CONST_CAST(GLEW_SGIS_sharpen_texture) = !_glewInit_GL_SGIS_sharpen_texture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIS_sharpen_texture */ #ifdef GL_SGIS_texture4D CONST_CAST(GLEW_SGIS_texture4D) = _glewSearchExtension("GL_SGIS_texture4D", extStart, extEnd); if (glewExperimental || GLEW_SGIS_texture4D) CONST_CAST(GLEW_SGIS_texture4D) = !_glewInit_GL_SGIS_texture4D(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIS_texture4D */ #ifdef GL_SGIS_texture_border_clamp CONST_CAST(GLEW_SGIS_texture_border_clamp) = _glewSearchExtension("GL_SGIS_texture_border_clamp", extStart, extEnd); #endif /* GL_SGIS_texture_border_clamp */ #ifdef GL_SGIS_texture_edge_clamp CONST_CAST(GLEW_SGIS_texture_edge_clamp) = _glewSearchExtension("GL_SGIS_texture_edge_clamp", extStart, extEnd); #endif /* GL_SGIS_texture_edge_clamp */ #ifdef GL_SGIS_texture_filter4 CONST_CAST(GLEW_SGIS_texture_filter4) = _glewSearchExtension("GL_SGIS_texture_filter4", extStart, extEnd); if (glewExperimental || GLEW_SGIS_texture_filter4) CONST_CAST(GLEW_SGIS_texture_filter4) = !_glewInit_GL_SGIS_texture_filter4(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIS_texture_filter4 */ #ifdef GL_SGIS_texture_lod CONST_CAST(GLEW_SGIS_texture_lod) = _glewSearchExtension("GL_SGIS_texture_lod", extStart, extEnd); #endif /* GL_SGIS_texture_lod */ #ifdef GL_SGIS_texture_select CONST_CAST(GLEW_SGIS_texture_select) = _glewSearchExtension("GL_SGIS_texture_select", extStart, extEnd); #endif /* GL_SGIS_texture_select */ #ifdef GL_SGIX_async CONST_CAST(GLEW_SGIX_async) = _glewSearchExtension("GL_SGIX_async", extStart, extEnd); if (glewExperimental || GLEW_SGIX_async) CONST_CAST(GLEW_SGIX_async) = !_glewInit_GL_SGIX_async(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIX_async */ #ifdef GL_SGIX_async_histogram CONST_CAST(GLEW_SGIX_async_histogram) = _glewSearchExtension("GL_SGIX_async_histogram", extStart, extEnd); #endif /* GL_SGIX_async_histogram */ #ifdef GL_SGIX_async_pixel CONST_CAST(GLEW_SGIX_async_pixel) = _glewSearchExtension("GL_SGIX_async_pixel", extStart, extEnd); #endif /* GL_SGIX_async_pixel */ #ifdef GL_SGIX_blend_alpha_minmax CONST_CAST(GLEW_SGIX_blend_alpha_minmax) = _glewSearchExtension("GL_SGIX_blend_alpha_minmax", extStart, extEnd); #endif /* GL_SGIX_blend_alpha_minmax */ #ifdef GL_SGIX_clipmap CONST_CAST(GLEW_SGIX_clipmap) = _glewSearchExtension("GL_SGIX_clipmap", extStart, extEnd); #endif /* GL_SGIX_clipmap */ #ifdef GL_SGIX_convolution_accuracy CONST_CAST(GLEW_SGIX_convolution_accuracy) = _glewSearchExtension("GL_SGIX_convolution_accuracy", extStart, extEnd); #endif /* GL_SGIX_convolution_accuracy */ #ifdef GL_SGIX_depth_texture CONST_CAST(GLEW_SGIX_depth_texture) = _glewSearchExtension("GL_SGIX_depth_texture", extStart, extEnd); #endif /* GL_SGIX_depth_texture */ #ifdef GL_SGIX_flush_raster CONST_CAST(GLEW_SGIX_flush_raster) = _glewSearchExtension("GL_SGIX_flush_raster", extStart, extEnd); if (glewExperimental || GLEW_SGIX_flush_raster) CONST_CAST(GLEW_SGIX_flush_raster) = !_glewInit_GL_SGIX_flush_raster(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIX_flush_raster */ #ifdef GL_SGIX_fog_offset CONST_CAST(GLEW_SGIX_fog_offset) = _glewSearchExtension("GL_SGIX_fog_offset", extStart, extEnd); #endif /* GL_SGIX_fog_offset */ #ifdef GL_SGIX_fog_texture CONST_CAST(GLEW_SGIX_fog_texture) = _glewSearchExtension("GL_SGIX_fog_texture", extStart, extEnd); if (glewExperimental || GLEW_SGIX_fog_texture) CONST_CAST(GLEW_SGIX_fog_texture) = !_glewInit_GL_SGIX_fog_texture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIX_fog_texture */ #ifdef GL_SGIX_fragment_specular_lighting CONST_CAST(GLEW_SGIX_fragment_specular_lighting) = _glewSearchExtension("GL_SGIX_fragment_specular_lighting", extStart, extEnd); if (glewExperimental || GLEW_SGIX_fragment_specular_lighting) CONST_CAST(GLEW_SGIX_fragment_specular_lighting) = !_glewInit_GL_SGIX_fragment_specular_lighting(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIX_fragment_specular_lighting */ #ifdef GL_SGIX_framezoom CONST_CAST(GLEW_SGIX_framezoom) = _glewSearchExtension("GL_SGIX_framezoom", extStart, extEnd); if (glewExperimental || GLEW_SGIX_framezoom) CONST_CAST(GLEW_SGIX_framezoom) = !_glewInit_GL_SGIX_framezoom(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIX_framezoom */ #ifdef GL_SGIX_interlace CONST_CAST(GLEW_SGIX_interlace) = _glewSearchExtension("GL_SGIX_interlace", extStart, extEnd); #endif /* GL_SGIX_interlace */ #ifdef GL_SGIX_ir_instrument1 CONST_CAST(GLEW_SGIX_ir_instrument1) = _glewSearchExtension("GL_SGIX_ir_instrument1", extStart, extEnd); #endif /* GL_SGIX_ir_instrument1 */ #ifdef GL_SGIX_list_priority CONST_CAST(GLEW_SGIX_list_priority) = _glewSearchExtension("GL_SGIX_list_priority", extStart, extEnd); #endif /* GL_SGIX_list_priority */ #ifdef GL_SGIX_pixel_texture CONST_CAST(GLEW_SGIX_pixel_texture) = _glewSearchExtension("GL_SGIX_pixel_texture", extStart, extEnd); if (glewExperimental || GLEW_SGIX_pixel_texture) CONST_CAST(GLEW_SGIX_pixel_texture) = !_glewInit_GL_SGIX_pixel_texture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIX_pixel_texture */ #ifdef GL_SGIX_pixel_texture_bits CONST_CAST(GLEW_SGIX_pixel_texture_bits) = _glewSearchExtension("GL_SGIX_pixel_texture_bits", extStart, extEnd); #endif /* GL_SGIX_pixel_texture_bits */ #ifdef GL_SGIX_reference_plane CONST_CAST(GLEW_SGIX_reference_plane) = _glewSearchExtension("GL_SGIX_reference_plane", extStart, extEnd); if (glewExperimental || GLEW_SGIX_reference_plane) CONST_CAST(GLEW_SGIX_reference_plane) = !_glewInit_GL_SGIX_reference_plane(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIX_reference_plane */ #ifdef GL_SGIX_resample CONST_CAST(GLEW_SGIX_resample) = _glewSearchExtension("GL_SGIX_resample", extStart, extEnd); #endif /* GL_SGIX_resample */ #ifdef GL_SGIX_shadow CONST_CAST(GLEW_SGIX_shadow) = _glewSearchExtension("GL_SGIX_shadow", extStart, extEnd); #endif /* GL_SGIX_shadow */ #ifdef GL_SGIX_shadow_ambient CONST_CAST(GLEW_SGIX_shadow_ambient) = _glewSearchExtension("GL_SGIX_shadow_ambient", extStart, extEnd); #endif /* GL_SGIX_shadow_ambient */ #ifdef GL_SGIX_sprite CONST_CAST(GLEW_SGIX_sprite) = _glewSearchExtension("GL_SGIX_sprite", extStart, extEnd); if (glewExperimental || GLEW_SGIX_sprite) CONST_CAST(GLEW_SGIX_sprite) = !_glewInit_GL_SGIX_sprite(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIX_sprite */ #ifdef GL_SGIX_tag_sample_buffer CONST_CAST(GLEW_SGIX_tag_sample_buffer) = _glewSearchExtension("GL_SGIX_tag_sample_buffer", extStart, extEnd); if (glewExperimental || GLEW_SGIX_tag_sample_buffer) CONST_CAST(GLEW_SGIX_tag_sample_buffer) = !_glewInit_GL_SGIX_tag_sample_buffer(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIX_tag_sample_buffer */ #ifdef GL_SGIX_texture_add_env CONST_CAST(GLEW_SGIX_texture_add_env) = _glewSearchExtension("GL_SGIX_texture_add_env", extStart, extEnd); #endif /* GL_SGIX_texture_add_env */ #ifdef GL_SGIX_texture_coordinate_clamp CONST_CAST(GLEW_SGIX_texture_coordinate_clamp) = _glewSearchExtension("GL_SGIX_texture_coordinate_clamp", extStart, extEnd); #endif /* GL_SGIX_texture_coordinate_clamp */ #ifdef GL_SGIX_texture_lod_bias CONST_CAST(GLEW_SGIX_texture_lod_bias) = _glewSearchExtension("GL_SGIX_texture_lod_bias", extStart, extEnd); #endif /* GL_SGIX_texture_lod_bias */ #ifdef GL_SGIX_texture_multi_buffer CONST_CAST(GLEW_SGIX_texture_multi_buffer) = _glewSearchExtension("GL_SGIX_texture_multi_buffer", extStart, extEnd); #endif /* GL_SGIX_texture_multi_buffer */ #ifdef GL_SGIX_texture_range CONST_CAST(GLEW_SGIX_texture_range) = _glewSearchExtension("GL_SGIX_texture_range", extStart, extEnd); #endif /* GL_SGIX_texture_range */ #ifdef GL_SGIX_texture_scale_bias CONST_CAST(GLEW_SGIX_texture_scale_bias) = _glewSearchExtension("GL_SGIX_texture_scale_bias", extStart, extEnd); #endif /* GL_SGIX_texture_scale_bias */ #ifdef GL_SGIX_vertex_preclip CONST_CAST(GLEW_SGIX_vertex_preclip) = _glewSearchExtension("GL_SGIX_vertex_preclip", extStart, extEnd); #endif /* GL_SGIX_vertex_preclip */ #ifdef GL_SGIX_vertex_preclip_hint CONST_CAST(GLEW_SGIX_vertex_preclip_hint) = _glewSearchExtension("GL_SGIX_vertex_preclip_hint", extStart, extEnd); #endif /* GL_SGIX_vertex_preclip_hint */ #ifdef GL_SGIX_ycrcb CONST_CAST(GLEW_SGIX_ycrcb) = _glewSearchExtension("GL_SGIX_ycrcb", extStart, extEnd); #endif /* GL_SGIX_ycrcb */ #ifdef GL_SGI_color_matrix CONST_CAST(GLEW_SGI_color_matrix) = _glewSearchExtension("GL_SGI_color_matrix", extStart, extEnd); #endif /* GL_SGI_color_matrix */ #ifdef GL_SGI_color_table CONST_CAST(GLEW_SGI_color_table) = _glewSearchExtension("GL_SGI_color_table", extStart, extEnd); if (glewExperimental || GLEW_SGI_color_table) CONST_CAST(GLEW_SGI_color_table) = !_glewInit_GL_SGI_color_table(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGI_color_table */ #ifdef GL_SGI_texture_color_table CONST_CAST(GLEW_SGI_texture_color_table) = _glewSearchExtension("GL_SGI_texture_color_table", extStart, extEnd); #endif /* GL_SGI_texture_color_table */ #ifdef GL_SUNX_constant_data CONST_CAST(GLEW_SUNX_constant_data) = _glewSearchExtension("GL_SUNX_constant_data", extStart, extEnd); if (glewExperimental || GLEW_SUNX_constant_data) CONST_CAST(GLEW_SUNX_constant_data) = !_glewInit_GL_SUNX_constant_data(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SUNX_constant_data */ #ifdef GL_SUN_convolution_border_modes CONST_CAST(GLEW_SUN_convolution_border_modes) = _glewSearchExtension("GL_SUN_convolution_border_modes", extStart, extEnd); #endif /* GL_SUN_convolution_border_modes */ #ifdef GL_SUN_global_alpha CONST_CAST(GLEW_SUN_global_alpha) = _glewSearchExtension("GL_SUN_global_alpha", extStart, extEnd); if (glewExperimental || GLEW_SUN_global_alpha) CONST_CAST(GLEW_SUN_global_alpha) = !_glewInit_GL_SUN_global_alpha(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SUN_global_alpha */ #ifdef GL_SUN_mesh_array CONST_CAST(GLEW_SUN_mesh_array) = _glewSearchExtension("GL_SUN_mesh_array", extStart, extEnd); #endif /* GL_SUN_mesh_array */ #ifdef GL_SUN_read_video_pixels CONST_CAST(GLEW_SUN_read_video_pixels) = _glewSearchExtension("GL_SUN_read_video_pixels", extStart, extEnd); if (glewExperimental || GLEW_SUN_read_video_pixels) CONST_CAST(GLEW_SUN_read_video_pixels) = !_glewInit_GL_SUN_read_video_pixels(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SUN_read_video_pixels */ #ifdef GL_SUN_slice_accum CONST_CAST(GLEW_SUN_slice_accum) = _glewSearchExtension("GL_SUN_slice_accum", extStart, extEnd); #endif /* GL_SUN_slice_accum */ #ifdef GL_SUN_triangle_list CONST_CAST(GLEW_SUN_triangle_list) = _glewSearchExtension("GL_SUN_triangle_list", extStart, extEnd); if (glewExperimental || GLEW_SUN_triangle_list) CONST_CAST(GLEW_SUN_triangle_list) = !_glewInit_GL_SUN_triangle_list(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SUN_triangle_list */ #ifdef GL_SUN_vertex CONST_CAST(GLEW_SUN_vertex) = _glewSearchExtension("GL_SUN_vertex", extStart, extEnd); if (glewExperimental || GLEW_SUN_vertex) CONST_CAST(GLEW_SUN_vertex) = !_glewInit_GL_SUN_vertex(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SUN_vertex */ #ifdef GL_WIN_phong_shading CONST_CAST(GLEW_WIN_phong_shading) = _glewSearchExtension("GL_WIN_phong_shading", extStart, extEnd); #endif /* GL_WIN_phong_shading */ #ifdef GL_WIN_specular_fog CONST_CAST(GLEW_WIN_specular_fog) = _glewSearchExtension("GL_WIN_specular_fog", extStart, extEnd); #endif /* GL_WIN_specular_fog */ #ifdef GL_WIN_swap_hint CONST_CAST(GLEW_WIN_swap_hint) = _glewSearchExtension("GL_WIN_swap_hint", extStart, extEnd); if (glewExperimental || GLEW_WIN_swap_hint) CONST_CAST(GLEW_WIN_swap_hint) = !_glewInit_GL_WIN_swap_hint(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_WIN_swap_hint */ return GLEW_OK; } #if defined(_WIN32) #if !defined(GLEW_MX) PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL = NULL; PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC __wglewBlitContextFramebufferAMD = NULL; PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC __wglewCreateAssociatedContextAMD = NULL; PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC __wglewCreateAssociatedContextAttribsAMD = NULL; PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC __wglewDeleteAssociatedContextAMD = NULL; PFNWGLGETCONTEXTGPUIDAMDPROC __wglewGetContextGPUIDAMD = NULL; PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC __wglewGetCurrentAssociatedContextAMD = NULL; PFNWGLGETGPUIDSAMDPROC __wglewGetGPUIDsAMD = NULL; PFNWGLGETGPUINFOAMDPROC __wglewGetGPUInfoAMD = NULL; PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC __wglewMakeAssociatedContextCurrentAMD = NULL; PFNWGLCREATEBUFFERREGIONARBPROC __wglewCreateBufferRegionARB = NULL; PFNWGLDELETEBUFFERREGIONARBPROC __wglewDeleteBufferRegionARB = NULL; PFNWGLRESTOREBUFFERREGIONARBPROC __wglewRestoreBufferRegionARB = NULL; PFNWGLSAVEBUFFERREGIONARBPROC __wglewSaveBufferRegionARB = NULL; PFNWGLCREATECONTEXTATTRIBSARBPROC __wglewCreateContextAttribsARB = NULL; PFNWGLGETEXTENSIONSSTRINGARBPROC __wglewGetExtensionsStringARB = NULL; PFNWGLGETCURRENTREADDCARBPROC __wglewGetCurrentReadDCARB = NULL; PFNWGLMAKECONTEXTCURRENTARBPROC __wglewMakeContextCurrentARB = NULL; PFNWGLCREATEPBUFFERARBPROC __wglewCreatePbufferARB = NULL; PFNWGLDESTROYPBUFFERARBPROC __wglewDestroyPbufferARB = NULL; PFNWGLGETPBUFFERDCARBPROC __wglewGetPbufferDCARB = NULL; PFNWGLQUERYPBUFFERARBPROC __wglewQueryPbufferARB = NULL; PFNWGLRELEASEPBUFFERDCARBPROC __wglewReleasePbufferDCARB = NULL; PFNWGLCHOOSEPIXELFORMATARBPROC __wglewChoosePixelFormatARB = NULL; PFNWGLGETPIXELFORMATATTRIBFVARBPROC __wglewGetPixelFormatAttribfvARB = NULL; PFNWGLGETPIXELFORMATATTRIBIVARBPROC __wglewGetPixelFormatAttribivARB = NULL; PFNWGLBINDTEXIMAGEARBPROC __wglewBindTexImageARB = NULL; PFNWGLRELEASETEXIMAGEARBPROC __wglewReleaseTexImageARB = NULL; PFNWGLSETPBUFFERATTRIBARBPROC __wglewSetPbufferAttribARB = NULL; PFNWGLBINDDISPLAYCOLORTABLEEXTPROC __wglewBindDisplayColorTableEXT = NULL; PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC __wglewCreateDisplayColorTableEXT = NULL; PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC __wglewDestroyDisplayColorTableEXT = NULL; PFNWGLLOADDISPLAYCOLORTABLEEXTPROC __wglewLoadDisplayColorTableEXT = NULL; PFNWGLGETEXTENSIONSSTRINGEXTPROC __wglewGetExtensionsStringEXT = NULL; PFNWGLGETCURRENTREADDCEXTPROC __wglewGetCurrentReadDCEXT = NULL; PFNWGLMAKECONTEXTCURRENTEXTPROC __wglewMakeContextCurrentEXT = NULL; PFNWGLCREATEPBUFFEREXTPROC __wglewCreatePbufferEXT = NULL; PFNWGLDESTROYPBUFFEREXTPROC __wglewDestroyPbufferEXT = NULL; PFNWGLGETPBUFFERDCEXTPROC __wglewGetPbufferDCEXT = NULL; PFNWGLQUERYPBUFFEREXTPROC __wglewQueryPbufferEXT = NULL; PFNWGLRELEASEPBUFFERDCEXTPROC __wglewReleasePbufferDCEXT = NULL; PFNWGLCHOOSEPIXELFORMATEXTPROC __wglewChoosePixelFormatEXT = NULL; PFNWGLGETPIXELFORMATATTRIBFVEXTPROC __wglewGetPixelFormatAttribfvEXT = NULL; PFNWGLGETPIXELFORMATATTRIBIVEXTPROC __wglewGetPixelFormatAttribivEXT = NULL; PFNWGLGETSWAPINTERVALEXTPROC __wglewGetSwapIntervalEXT = NULL; PFNWGLSWAPINTERVALEXTPROC __wglewSwapIntervalEXT = NULL; PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC __wglewGetDigitalVideoParametersI3D = NULL; PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC __wglewSetDigitalVideoParametersI3D = NULL; PFNWGLGETGAMMATABLEI3DPROC __wglewGetGammaTableI3D = NULL; PFNWGLGETGAMMATABLEPARAMETERSI3DPROC __wglewGetGammaTableParametersI3D = NULL; PFNWGLSETGAMMATABLEI3DPROC __wglewSetGammaTableI3D = NULL; PFNWGLSETGAMMATABLEPARAMETERSI3DPROC __wglewSetGammaTableParametersI3D = NULL; PFNWGLDISABLEGENLOCKI3DPROC __wglewDisableGenlockI3D = NULL; PFNWGLENABLEGENLOCKI3DPROC __wglewEnableGenlockI3D = NULL; PFNWGLGENLOCKSAMPLERATEI3DPROC __wglewGenlockSampleRateI3D = NULL; PFNWGLGENLOCKSOURCEDELAYI3DPROC __wglewGenlockSourceDelayI3D = NULL; PFNWGLGENLOCKSOURCEEDGEI3DPROC __wglewGenlockSourceEdgeI3D = NULL; PFNWGLGENLOCKSOURCEI3DPROC __wglewGenlockSourceI3D = NULL; PFNWGLGETGENLOCKSAMPLERATEI3DPROC __wglewGetGenlockSampleRateI3D = NULL; PFNWGLGETGENLOCKSOURCEDELAYI3DPROC __wglewGetGenlockSourceDelayI3D = NULL; PFNWGLGETGENLOCKSOURCEEDGEI3DPROC __wglewGetGenlockSourceEdgeI3D = NULL; PFNWGLGETGENLOCKSOURCEI3DPROC __wglewGetGenlockSourceI3D = NULL; PFNWGLISENABLEDGENLOCKI3DPROC __wglewIsEnabledGenlockI3D = NULL; PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC __wglewQueryGenlockMaxSourceDelayI3D = NULL; PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC __wglewAssociateImageBufferEventsI3D = NULL; PFNWGLCREATEIMAGEBUFFERI3DPROC __wglewCreateImageBufferI3D = NULL; PFNWGLDESTROYIMAGEBUFFERI3DPROC __wglewDestroyImageBufferI3D = NULL; PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC __wglewReleaseImageBufferEventsI3D = NULL; PFNWGLDISABLEFRAMELOCKI3DPROC __wglewDisableFrameLockI3D = NULL; PFNWGLENABLEFRAMELOCKI3DPROC __wglewEnableFrameLockI3D = NULL; PFNWGLISENABLEDFRAMELOCKI3DPROC __wglewIsEnabledFrameLockI3D = NULL; PFNWGLQUERYFRAMELOCKMASTERI3DPROC __wglewQueryFrameLockMasterI3D = NULL; PFNWGLBEGINFRAMETRACKINGI3DPROC __wglewBeginFrameTrackingI3D = NULL; PFNWGLENDFRAMETRACKINGI3DPROC __wglewEndFrameTrackingI3D = NULL; PFNWGLGETFRAMEUSAGEI3DPROC __wglewGetFrameUsageI3D = NULL; PFNWGLQUERYFRAMETRACKINGI3DPROC __wglewQueryFrameTrackingI3D = NULL; PFNWGLDXCLOSEDEVICENVPROC __wglewDXCloseDeviceNV = NULL; PFNWGLDXLOCKOBJECTSNVPROC __wglewDXLockObjectsNV = NULL; PFNWGLDXOBJECTACCESSNVPROC __wglewDXObjectAccessNV = NULL; PFNWGLDXOPENDEVICENVPROC __wglewDXOpenDeviceNV = NULL; PFNWGLDXREGISTEROBJECTNVPROC __wglewDXRegisterObjectNV = NULL; PFNWGLDXSETRESOURCESHAREHANDLENVPROC __wglewDXSetResourceShareHandleNV = NULL; PFNWGLDXUNLOCKOBJECTSNVPROC __wglewDXUnlockObjectsNV = NULL; PFNWGLDXUNREGISTEROBJECTNVPROC __wglewDXUnregisterObjectNV = NULL; PFNWGLCOPYIMAGESUBDATANVPROC __wglewCopyImageSubDataNV = NULL; PFNWGLCREATEAFFINITYDCNVPROC __wglewCreateAffinityDCNV = NULL; PFNWGLDELETEDCNVPROC __wglewDeleteDCNV = NULL; PFNWGLENUMGPUDEVICESNVPROC __wglewEnumGpuDevicesNV = NULL; PFNWGLENUMGPUSFROMAFFINITYDCNVPROC __wglewEnumGpusFromAffinityDCNV = NULL; PFNWGLENUMGPUSNVPROC __wglewEnumGpusNV = NULL; PFNWGLBINDVIDEODEVICENVPROC __wglewBindVideoDeviceNV = NULL; PFNWGLENUMERATEVIDEODEVICESNVPROC __wglewEnumerateVideoDevicesNV = NULL; PFNWGLQUERYCURRENTCONTEXTNVPROC __wglewQueryCurrentContextNV = NULL; PFNWGLBINDSWAPBARRIERNVPROC __wglewBindSwapBarrierNV = NULL; PFNWGLJOINSWAPGROUPNVPROC __wglewJoinSwapGroupNV = NULL; PFNWGLQUERYFRAMECOUNTNVPROC __wglewQueryFrameCountNV = NULL; PFNWGLQUERYMAXSWAPGROUPSNVPROC __wglewQueryMaxSwapGroupsNV = NULL; PFNWGLQUERYSWAPGROUPNVPROC __wglewQuerySwapGroupNV = NULL; PFNWGLRESETFRAMECOUNTNVPROC __wglewResetFrameCountNV = NULL; PFNWGLALLOCATEMEMORYNVPROC __wglewAllocateMemoryNV = NULL; PFNWGLFREEMEMORYNVPROC __wglewFreeMemoryNV = NULL; PFNWGLBINDVIDEOCAPTUREDEVICENVPROC __wglewBindVideoCaptureDeviceNV = NULL; PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC __wglewEnumerateVideoCaptureDevicesNV = NULL; PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC __wglewLockVideoCaptureDeviceNV = NULL; PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC __wglewQueryVideoCaptureDeviceNV = NULL; PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC __wglewReleaseVideoCaptureDeviceNV = NULL; PFNWGLBINDVIDEOIMAGENVPROC __wglewBindVideoImageNV = NULL; PFNWGLGETVIDEODEVICENVPROC __wglewGetVideoDeviceNV = NULL; PFNWGLGETVIDEOINFONVPROC __wglewGetVideoInfoNV = NULL; PFNWGLRELEASEVIDEODEVICENVPROC __wglewReleaseVideoDeviceNV = NULL; PFNWGLRELEASEVIDEOIMAGENVPROC __wglewReleaseVideoImageNV = NULL; PFNWGLSENDPBUFFERTOVIDEONVPROC __wglewSendPbufferToVideoNV = NULL; PFNWGLGETMSCRATEOMLPROC __wglewGetMscRateOML = NULL; PFNWGLGETSYNCVALUESOMLPROC __wglewGetSyncValuesOML = NULL; PFNWGLSWAPBUFFERSMSCOMLPROC __wglewSwapBuffersMscOML = NULL; PFNWGLSWAPLAYERBUFFERSMSCOMLPROC __wglewSwapLayerBuffersMscOML = NULL; PFNWGLWAITFORMSCOMLPROC __wglewWaitForMscOML = NULL; PFNWGLWAITFORSBCOMLPROC __wglewWaitForSbcOML = NULL; GLboolean __WGLEW_3DFX_multisample = GL_FALSE; GLboolean __WGLEW_3DL_stereo_control = GL_FALSE; GLboolean __WGLEW_AMD_gpu_association = GL_FALSE; GLboolean __WGLEW_ARB_buffer_region = GL_FALSE; GLboolean __WGLEW_ARB_create_context = GL_FALSE; GLboolean __WGLEW_ARB_create_context_profile = GL_FALSE; GLboolean __WGLEW_ARB_create_context_robustness = GL_FALSE; GLboolean __WGLEW_ARB_extensions_string = GL_FALSE; GLboolean __WGLEW_ARB_framebuffer_sRGB = GL_FALSE; GLboolean __WGLEW_ARB_make_current_read = GL_FALSE; GLboolean __WGLEW_ARB_multisample = GL_FALSE; GLboolean __WGLEW_ARB_pbuffer = GL_FALSE; GLboolean __WGLEW_ARB_pixel_format = GL_FALSE; GLboolean __WGLEW_ARB_pixel_format_float = GL_FALSE; GLboolean __WGLEW_ARB_render_texture = GL_FALSE; GLboolean __WGLEW_ATI_pixel_format_float = GL_FALSE; GLboolean __WGLEW_ATI_render_texture_rectangle = GL_FALSE; GLboolean __WGLEW_EXT_create_context_es2_profile = GL_FALSE; GLboolean __WGLEW_EXT_create_context_es_profile = GL_FALSE; GLboolean __WGLEW_EXT_depth_float = GL_FALSE; GLboolean __WGLEW_EXT_display_color_table = GL_FALSE; GLboolean __WGLEW_EXT_extensions_string = GL_FALSE; GLboolean __WGLEW_EXT_framebuffer_sRGB = GL_FALSE; GLboolean __WGLEW_EXT_make_current_read = GL_FALSE; GLboolean __WGLEW_EXT_multisample = GL_FALSE; GLboolean __WGLEW_EXT_pbuffer = GL_FALSE; GLboolean __WGLEW_EXT_pixel_format = GL_FALSE; GLboolean __WGLEW_EXT_pixel_format_packed_float = GL_FALSE; GLboolean __WGLEW_EXT_swap_control = GL_FALSE; GLboolean __WGLEW_EXT_swap_control_tear = GL_FALSE; GLboolean __WGLEW_I3D_digital_video_control = GL_FALSE; GLboolean __WGLEW_I3D_gamma = GL_FALSE; GLboolean __WGLEW_I3D_genlock = GL_FALSE; GLboolean __WGLEW_I3D_image_buffer = GL_FALSE; GLboolean __WGLEW_I3D_swap_frame_lock = GL_FALSE; GLboolean __WGLEW_I3D_swap_frame_usage = GL_FALSE; GLboolean __WGLEW_NV_DX_interop = GL_FALSE; GLboolean __WGLEW_NV_DX_interop2 = GL_FALSE; GLboolean __WGLEW_NV_copy_image = GL_FALSE; GLboolean __WGLEW_NV_float_buffer = GL_FALSE; GLboolean __WGLEW_NV_gpu_affinity = GL_FALSE; GLboolean __WGLEW_NV_multisample_coverage = GL_FALSE; GLboolean __WGLEW_NV_present_video = GL_FALSE; GLboolean __WGLEW_NV_render_depth_texture = GL_FALSE; GLboolean __WGLEW_NV_render_texture_rectangle = GL_FALSE; GLboolean __WGLEW_NV_swap_group = GL_FALSE; GLboolean __WGLEW_NV_vertex_array_range = GL_FALSE; GLboolean __WGLEW_NV_video_capture = GL_FALSE; GLboolean __WGLEW_NV_video_output = GL_FALSE; GLboolean __WGLEW_OML_sync_control = GL_FALSE; #endif /* !GLEW_MX */ #ifdef WGL_3DFX_multisample #endif /* WGL_3DFX_multisample */ #ifdef WGL_3DL_stereo_control static GLboolean _glewInit_WGL_3DL_stereo_control (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglSetStereoEmitterState3DL = (PFNWGLSETSTEREOEMITTERSTATE3DLPROC)glewGetProcAddress((const GLubyte*)"wglSetStereoEmitterState3DL")) == NULL) || r; return r; } #endif /* WGL_3DL_stereo_control */ #ifdef WGL_AMD_gpu_association static GLboolean _glewInit_WGL_AMD_gpu_association (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglBlitContextFramebufferAMD = (PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC)glewGetProcAddress((const GLubyte*)"wglBlitContextFramebufferAMD")) == NULL) || r; r = ((wglCreateAssociatedContextAMD = (PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC)glewGetProcAddress((const GLubyte*)"wglCreateAssociatedContextAMD")) == NULL) || r; r = ((wglCreateAssociatedContextAttribsAMD = (PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC)glewGetProcAddress((const GLubyte*)"wglCreateAssociatedContextAttribsAMD")) == NULL) || r; r = ((wglDeleteAssociatedContextAMD = (PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC)glewGetProcAddress((const GLubyte*)"wglDeleteAssociatedContextAMD")) == NULL) || r; r = ((wglGetContextGPUIDAMD = (PFNWGLGETCONTEXTGPUIDAMDPROC)glewGetProcAddress((const GLubyte*)"wglGetContextGPUIDAMD")) == NULL) || r; r = ((wglGetCurrentAssociatedContextAMD = (PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC)glewGetProcAddress((const GLubyte*)"wglGetCurrentAssociatedContextAMD")) == NULL) || r; r = ((wglGetGPUIDsAMD = (PFNWGLGETGPUIDSAMDPROC)glewGetProcAddress((const GLubyte*)"wglGetGPUIDsAMD")) == NULL) || r; r = ((wglGetGPUInfoAMD = (PFNWGLGETGPUINFOAMDPROC)glewGetProcAddress((const GLubyte*)"wglGetGPUInfoAMD")) == NULL) || r; r = ((wglMakeAssociatedContextCurrentAMD = (PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC)glewGetProcAddress((const GLubyte*)"wglMakeAssociatedContextCurrentAMD")) == NULL) || r; return r; } #endif /* WGL_AMD_gpu_association */ #ifdef WGL_ARB_buffer_region static GLboolean _glewInit_WGL_ARB_buffer_region (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglCreateBufferRegionARB = (PFNWGLCREATEBUFFERREGIONARBPROC)glewGetProcAddress((const GLubyte*)"wglCreateBufferRegionARB")) == NULL) || r; r = ((wglDeleteBufferRegionARB = (PFNWGLDELETEBUFFERREGIONARBPROC)glewGetProcAddress((const GLubyte*)"wglDeleteBufferRegionARB")) == NULL) || r; r = ((wglRestoreBufferRegionARB = (PFNWGLRESTOREBUFFERREGIONARBPROC)glewGetProcAddress((const GLubyte*)"wglRestoreBufferRegionARB")) == NULL) || r; r = ((wglSaveBufferRegionARB = (PFNWGLSAVEBUFFERREGIONARBPROC)glewGetProcAddress((const GLubyte*)"wglSaveBufferRegionARB")) == NULL) || r; return r; } #endif /* WGL_ARB_buffer_region */ #ifdef WGL_ARB_create_context static GLboolean _glewInit_WGL_ARB_create_context (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)glewGetProcAddress((const GLubyte*)"wglCreateContextAttribsARB")) == NULL) || r; return r; } #endif /* WGL_ARB_create_context */ #ifdef WGL_ARB_create_context_profile #endif /* WGL_ARB_create_context_profile */ #ifdef WGL_ARB_create_context_robustness #endif /* WGL_ARB_create_context_robustness */ #ifdef WGL_ARB_extensions_string static GLboolean _glewInit_WGL_ARB_extensions_string (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringARB")) == NULL) || r; return r; } #endif /* WGL_ARB_extensions_string */ #ifdef WGL_ARB_framebuffer_sRGB #endif /* WGL_ARB_framebuffer_sRGB */ #ifdef WGL_ARB_make_current_read static GLboolean _glewInit_WGL_ARB_make_current_read (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglGetCurrentReadDCARB = (PFNWGLGETCURRENTREADDCARBPROC)glewGetProcAddress((const GLubyte*)"wglGetCurrentReadDCARB")) == NULL) || r; r = ((wglMakeContextCurrentARB = (PFNWGLMAKECONTEXTCURRENTARBPROC)glewGetProcAddress((const GLubyte*)"wglMakeContextCurrentARB")) == NULL) || r; return r; } #endif /* WGL_ARB_make_current_read */ #ifdef WGL_ARB_multisample #endif /* WGL_ARB_multisample */ #ifdef WGL_ARB_pbuffer static GLboolean _glewInit_WGL_ARB_pbuffer (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglCreatePbufferARB = (PFNWGLCREATEPBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"wglCreatePbufferARB")) == NULL) || r; r = ((wglDestroyPbufferARB = (PFNWGLDESTROYPBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"wglDestroyPbufferARB")) == NULL) || r; r = ((wglGetPbufferDCARB = (PFNWGLGETPBUFFERDCARBPROC)glewGetProcAddress((const GLubyte*)"wglGetPbufferDCARB")) == NULL) || r; r = ((wglQueryPbufferARB = (PFNWGLQUERYPBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"wglQueryPbufferARB")) == NULL) || r; r = ((wglReleasePbufferDCARB = (PFNWGLRELEASEPBUFFERDCARBPROC)glewGetProcAddress((const GLubyte*)"wglReleasePbufferDCARB")) == NULL) || r; return r; } #endif /* WGL_ARB_pbuffer */ #ifdef WGL_ARB_pixel_format static GLboolean _glewInit_WGL_ARB_pixel_format (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)glewGetProcAddress((const GLubyte*)"wglChoosePixelFormatARB")) == NULL) || r; r = ((wglGetPixelFormatAttribfvARB = (PFNWGLGETPIXELFORMATATTRIBFVARBPROC)glewGetProcAddress((const GLubyte*)"wglGetPixelFormatAttribfvARB")) == NULL) || r; r = ((wglGetPixelFormatAttribivARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)glewGetProcAddress((const GLubyte*)"wglGetPixelFormatAttribivARB")) == NULL) || r; return r; } #endif /* WGL_ARB_pixel_format */ #ifdef WGL_ARB_pixel_format_float #endif /* WGL_ARB_pixel_format_float */ #ifdef WGL_ARB_render_texture static GLboolean _glewInit_WGL_ARB_render_texture (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglBindTexImageARB = (PFNWGLBINDTEXIMAGEARBPROC)glewGetProcAddress((const GLubyte*)"wglBindTexImageARB")) == NULL) || r; r = ((wglReleaseTexImageARB = (PFNWGLRELEASETEXIMAGEARBPROC)glewGetProcAddress((const GLubyte*)"wglReleaseTexImageARB")) == NULL) || r; r = ((wglSetPbufferAttribARB = (PFNWGLSETPBUFFERATTRIBARBPROC)glewGetProcAddress((const GLubyte*)"wglSetPbufferAttribARB")) == NULL) || r; return r; } #endif /* WGL_ARB_render_texture */ #ifdef WGL_ATI_pixel_format_float #endif /* WGL_ATI_pixel_format_float */ #ifdef WGL_ATI_render_texture_rectangle #endif /* WGL_ATI_render_texture_rectangle */ #ifdef WGL_EXT_create_context_es2_profile #endif /* WGL_EXT_create_context_es2_profile */ #ifdef WGL_EXT_create_context_es_profile #endif /* WGL_EXT_create_context_es_profile */ #ifdef WGL_EXT_depth_float #endif /* WGL_EXT_depth_float */ #ifdef WGL_EXT_display_color_table static GLboolean _glewInit_WGL_EXT_display_color_table (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglBindDisplayColorTableEXT = (PFNWGLBINDDISPLAYCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"wglBindDisplayColorTableEXT")) == NULL) || r; r = ((wglCreateDisplayColorTableEXT = (PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"wglCreateDisplayColorTableEXT")) == NULL) || r; r = ((wglDestroyDisplayColorTableEXT = (PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"wglDestroyDisplayColorTableEXT")) == NULL) || r; r = ((wglLoadDisplayColorTableEXT = (PFNWGLLOADDISPLAYCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"wglLoadDisplayColorTableEXT")) == NULL) || r; return r; } #endif /* WGL_EXT_display_color_table */ #ifdef WGL_EXT_extensions_string static GLboolean _glewInit_WGL_EXT_extensions_string (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringEXT")) == NULL) || r; return r; } #endif /* WGL_EXT_extensions_string */ #ifdef WGL_EXT_framebuffer_sRGB #endif /* WGL_EXT_framebuffer_sRGB */ #ifdef WGL_EXT_make_current_read static GLboolean _glewInit_WGL_EXT_make_current_read (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglGetCurrentReadDCEXT = (PFNWGLGETCURRENTREADDCEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetCurrentReadDCEXT")) == NULL) || r; r = ((wglMakeContextCurrentEXT = (PFNWGLMAKECONTEXTCURRENTEXTPROC)glewGetProcAddress((const GLubyte*)"wglMakeContextCurrentEXT")) == NULL) || r; return r; } #endif /* WGL_EXT_make_current_read */ #ifdef WGL_EXT_multisample #endif /* WGL_EXT_multisample */ #ifdef WGL_EXT_pbuffer static GLboolean _glewInit_WGL_EXT_pbuffer (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglCreatePbufferEXT = (PFNWGLCREATEPBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"wglCreatePbufferEXT")) == NULL) || r; r = ((wglDestroyPbufferEXT = (PFNWGLDESTROYPBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"wglDestroyPbufferEXT")) == NULL) || r; r = ((wglGetPbufferDCEXT = (PFNWGLGETPBUFFERDCEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetPbufferDCEXT")) == NULL) || r; r = ((wglQueryPbufferEXT = (PFNWGLQUERYPBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"wglQueryPbufferEXT")) == NULL) || r; r = ((wglReleasePbufferDCEXT = (PFNWGLRELEASEPBUFFERDCEXTPROC)glewGetProcAddress((const GLubyte*)"wglReleasePbufferDCEXT")) == NULL) || r; return r; } #endif /* WGL_EXT_pbuffer */ #ifdef WGL_EXT_pixel_format static GLboolean _glewInit_WGL_EXT_pixel_format (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglChoosePixelFormatEXT = (PFNWGLCHOOSEPIXELFORMATEXTPROC)glewGetProcAddress((const GLubyte*)"wglChoosePixelFormatEXT")) == NULL) || r; r = ((wglGetPixelFormatAttribfvEXT = (PFNWGLGETPIXELFORMATATTRIBFVEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetPixelFormatAttribfvEXT")) == NULL) || r; r = ((wglGetPixelFormatAttribivEXT = (PFNWGLGETPIXELFORMATATTRIBIVEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetPixelFormatAttribivEXT")) == NULL) || r; return r; } #endif /* WGL_EXT_pixel_format */ #ifdef WGL_EXT_pixel_format_packed_float #endif /* WGL_EXT_pixel_format_packed_float */ #ifdef WGL_EXT_swap_control static GLboolean _glewInit_WGL_EXT_swap_control (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglGetSwapIntervalEXT = (PFNWGLGETSWAPINTERVALEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetSwapIntervalEXT")) == NULL) || r; r = ((wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)glewGetProcAddress((const GLubyte*)"wglSwapIntervalEXT")) == NULL) || r; return r; } #endif /* WGL_EXT_swap_control */ #ifdef WGL_EXT_swap_control_tear #endif /* WGL_EXT_swap_control_tear */ #ifdef WGL_I3D_digital_video_control static GLboolean _glewInit_WGL_I3D_digital_video_control (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglGetDigitalVideoParametersI3D = (PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetDigitalVideoParametersI3D")) == NULL) || r; r = ((wglSetDigitalVideoParametersI3D = (PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC)glewGetProcAddress((const GLubyte*)"wglSetDigitalVideoParametersI3D")) == NULL) || r; return r; } #endif /* WGL_I3D_digital_video_control */ #ifdef WGL_I3D_gamma static GLboolean _glewInit_WGL_I3D_gamma (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglGetGammaTableI3D = (PFNWGLGETGAMMATABLEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGammaTableI3D")) == NULL) || r; r = ((wglGetGammaTableParametersI3D = (PFNWGLGETGAMMATABLEPARAMETERSI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGammaTableParametersI3D")) == NULL) || r; r = ((wglSetGammaTableI3D = (PFNWGLSETGAMMATABLEI3DPROC)glewGetProcAddress((const GLubyte*)"wglSetGammaTableI3D")) == NULL) || r; r = ((wglSetGammaTableParametersI3D = (PFNWGLSETGAMMATABLEPARAMETERSI3DPROC)glewGetProcAddress((const GLubyte*)"wglSetGammaTableParametersI3D")) == NULL) || r; return r; } #endif /* WGL_I3D_gamma */ #ifdef WGL_I3D_genlock static GLboolean _glewInit_WGL_I3D_genlock (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglDisableGenlockI3D = (PFNWGLDISABLEGENLOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglDisableGenlockI3D")) == NULL) || r; r = ((wglEnableGenlockI3D = (PFNWGLENABLEGENLOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglEnableGenlockI3D")) == NULL) || r; r = ((wglGenlockSampleRateI3D = (PFNWGLGENLOCKSAMPLERATEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGenlockSampleRateI3D")) == NULL) || r; r = ((wglGenlockSourceDelayI3D = (PFNWGLGENLOCKSOURCEDELAYI3DPROC)glewGetProcAddress((const GLubyte*)"wglGenlockSourceDelayI3D")) == NULL) || r; r = ((wglGenlockSourceEdgeI3D = (PFNWGLGENLOCKSOURCEEDGEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGenlockSourceEdgeI3D")) == NULL) || r; r = ((wglGenlockSourceI3D = (PFNWGLGENLOCKSOURCEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGenlockSourceI3D")) == NULL) || r; r = ((wglGetGenlockSampleRateI3D = (PFNWGLGETGENLOCKSAMPLERATEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGenlockSampleRateI3D")) == NULL) || r; r = ((wglGetGenlockSourceDelayI3D = (PFNWGLGETGENLOCKSOURCEDELAYI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGenlockSourceDelayI3D")) == NULL) || r; r = ((wglGetGenlockSourceEdgeI3D = (PFNWGLGETGENLOCKSOURCEEDGEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGenlockSourceEdgeI3D")) == NULL) || r; r = ((wglGetGenlockSourceI3D = (PFNWGLGETGENLOCKSOURCEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGenlockSourceI3D")) == NULL) || r; r = ((wglIsEnabledGenlockI3D = (PFNWGLISENABLEDGENLOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglIsEnabledGenlockI3D")) == NULL) || r; r = ((wglQueryGenlockMaxSourceDelayI3D = (PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC)glewGetProcAddress((const GLubyte*)"wglQueryGenlockMaxSourceDelayI3D")) == NULL) || r; return r; } #endif /* WGL_I3D_genlock */ #ifdef WGL_I3D_image_buffer static GLboolean _glewInit_WGL_I3D_image_buffer (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglAssociateImageBufferEventsI3D = (PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC)glewGetProcAddress((const GLubyte*)"wglAssociateImageBufferEventsI3D")) == NULL) || r; r = ((wglCreateImageBufferI3D = (PFNWGLCREATEIMAGEBUFFERI3DPROC)glewGetProcAddress((const GLubyte*)"wglCreateImageBufferI3D")) == NULL) || r; r = ((wglDestroyImageBufferI3D = (PFNWGLDESTROYIMAGEBUFFERI3DPROC)glewGetProcAddress((const GLubyte*)"wglDestroyImageBufferI3D")) == NULL) || r; r = ((wglReleaseImageBufferEventsI3D = (PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC)glewGetProcAddress((const GLubyte*)"wglReleaseImageBufferEventsI3D")) == NULL) || r; return r; } #endif /* WGL_I3D_image_buffer */ #ifdef WGL_I3D_swap_frame_lock static GLboolean _glewInit_WGL_I3D_swap_frame_lock (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglDisableFrameLockI3D = (PFNWGLDISABLEFRAMELOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglDisableFrameLockI3D")) == NULL) || r; r = ((wglEnableFrameLockI3D = (PFNWGLENABLEFRAMELOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglEnableFrameLockI3D")) == NULL) || r; r = ((wglIsEnabledFrameLockI3D = (PFNWGLISENABLEDFRAMELOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglIsEnabledFrameLockI3D")) == NULL) || r; r = ((wglQueryFrameLockMasterI3D = (PFNWGLQUERYFRAMELOCKMASTERI3DPROC)glewGetProcAddress((const GLubyte*)"wglQueryFrameLockMasterI3D")) == NULL) || r; return r; } #endif /* WGL_I3D_swap_frame_lock */ #ifdef WGL_I3D_swap_frame_usage static GLboolean _glewInit_WGL_I3D_swap_frame_usage (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglBeginFrameTrackingI3D = (PFNWGLBEGINFRAMETRACKINGI3DPROC)glewGetProcAddress((const GLubyte*)"wglBeginFrameTrackingI3D")) == NULL) || r; r = ((wglEndFrameTrackingI3D = (PFNWGLENDFRAMETRACKINGI3DPROC)glewGetProcAddress((const GLubyte*)"wglEndFrameTrackingI3D")) == NULL) || r; r = ((wglGetFrameUsageI3D = (PFNWGLGETFRAMEUSAGEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetFrameUsageI3D")) == NULL) || r; r = ((wglQueryFrameTrackingI3D = (PFNWGLQUERYFRAMETRACKINGI3DPROC)glewGetProcAddress((const GLubyte*)"wglQueryFrameTrackingI3D")) == NULL) || r; return r; } #endif /* WGL_I3D_swap_frame_usage */ #ifdef WGL_NV_DX_interop static GLboolean _glewInit_WGL_NV_DX_interop (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglDXCloseDeviceNV = (PFNWGLDXCLOSEDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglDXCloseDeviceNV")) == NULL) || r; r = ((wglDXLockObjectsNV = (PFNWGLDXLOCKOBJECTSNVPROC)glewGetProcAddress((const GLubyte*)"wglDXLockObjectsNV")) == NULL) || r; r = ((wglDXObjectAccessNV = (PFNWGLDXOBJECTACCESSNVPROC)glewGetProcAddress((const GLubyte*)"wglDXObjectAccessNV")) == NULL) || r; r = ((wglDXOpenDeviceNV = (PFNWGLDXOPENDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglDXOpenDeviceNV")) == NULL) || r; r = ((wglDXRegisterObjectNV = (PFNWGLDXREGISTEROBJECTNVPROC)glewGetProcAddress((const GLubyte*)"wglDXRegisterObjectNV")) == NULL) || r; r = ((wglDXSetResourceShareHandleNV = (PFNWGLDXSETRESOURCESHAREHANDLENVPROC)glewGetProcAddress((const GLubyte*)"wglDXSetResourceShareHandleNV")) == NULL) || r; r = ((wglDXUnlockObjectsNV = (PFNWGLDXUNLOCKOBJECTSNVPROC)glewGetProcAddress((const GLubyte*)"wglDXUnlockObjectsNV")) == NULL) || r; r = ((wglDXUnregisterObjectNV = (PFNWGLDXUNREGISTEROBJECTNVPROC)glewGetProcAddress((const GLubyte*)"wglDXUnregisterObjectNV")) == NULL) || r; return r; } #endif /* WGL_NV_DX_interop */ #ifdef WGL_NV_DX_interop2 #endif /* WGL_NV_DX_interop2 */ #ifdef WGL_NV_copy_image static GLboolean _glewInit_WGL_NV_copy_image (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglCopyImageSubDataNV = (PFNWGLCOPYIMAGESUBDATANVPROC)glewGetProcAddress((const GLubyte*)"wglCopyImageSubDataNV")) == NULL) || r; return r; } #endif /* WGL_NV_copy_image */ #ifdef WGL_NV_float_buffer #endif /* WGL_NV_float_buffer */ #ifdef WGL_NV_gpu_affinity static GLboolean _glewInit_WGL_NV_gpu_affinity (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglCreateAffinityDCNV = (PFNWGLCREATEAFFINITYDCNVPROC)glewGetProcAddress((const GLubyte*)"wglCreateAffinityDCNV")) == NULL) || r; r = ((wglDeleteDCNV = (PFNWGLDELETEDCNVPROC)glewGetProcAddress((const GLubyte*)"wglDeleteDCNV")) == NULL) || r; r = ((wglEnumGpuDevicesNV = (PFNWGLENUMGPUDEVICESNVPROC)glewGetProcAddress((const GLubyte*)"wglEnumGpuDevicesNV")) == NULL) || r; r = ((wglEnumGpusFromAffinityDCNV = (PFNWGLENUMGPUSFROMAFFINITYDCNVPROC)glewGetProcAddress((const GLubyte*)"wglEnumGpusFromAffinityDCNV")) == NULL) || r; r = ((wglEnumGpusNV = (PFNWGLENUMGPUSNVPROC)glewGetProcAddress((const GLubyte*)"wglEnumGpusNV")) == NULL) || r; return r; } #endif /* WGL_NV_gpu_affinity */ #ifdef WGL_NV_multisample_coverage #endif /* WGL_NV_multisample_coverage */ #ifdef WGL_NV_present_video static GLboolean _glewInit_WGL_NV_present_video (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglBindVideoDeviceNV = (PFNWGLBINDVIDEODEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglBindVideoDeviceNV")) == NULL) || r; r = ((wglEnumerateVideoDevicesNV = (PFNWGLENUMERATEVIDEODEVICESNVPROC)glewGetProcAddress((const GLubyte*)"wglEnumerateVideoDevicesNV")) == NULL) || r; r = ((wglQueryCurrentContextNV = (PFNWGLQUERYCURRENTCONTEXTNVPROC)glewGetProcAddress((const GLubyte*)"wglQueryCurrentContextNV")) == NULL) || r; return r; } #endif /* WGL_NV_present_video */ #ifdef WGL_NV_render_depth_texture #endif /* WGL_NV_render_depth_texture */ #ifdef WGL_NV_render_texture_rectangle #endif /* WGL_NV_render_texture_rectangle */ #ifdef WGL_NV_swap_group static GLboolean _glewInit_WGL_NV_swap_group (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglBindSwapBarrierNV = (PFNWGLBINDSWAPBARRIERNVPROC)glewGetProcAddress((const GLubyte*)"wglBindSwapBarrierNV")) == NULL) || r; r = ((wglJoinSwapGroupNV = (PFNWGLJOINSWAPGROUPNVPROC)glewGetProcAddress((const GLubyte*)"wglJoinSwapGroupNV")) == NULL) || r; r = ((wglQueryFrameCountNV = (PFNWGLQUERYFRAMECOUNTNVPROC)glewGetProcAddress((const GLubyte*)"wglQueryFrameCountNV")) == NULL) || r; r = ((wglQueryMaxSwapGroupsNV = (PFNWGLQUERYMAXSWAPGROUPSNVPROC)glewGetProcAddress((const GLubyte*)"wglQueryMaxSwapGroupsNV")) == NULL) || r; r = ((wglQuerySwapGroupNV = (PFNWGLQUERYSWAPGROUPNVPROC)glewGetProcAddress((const GLubyte*)"wglQuerySwapGroupNV")) == NULL) || r; r = ((wglResetFrameCountNV = (PFNWGLRESETFRAMECOUNTNVPROC)glewGetProcAddress((const GLubyte*)"wglResetFrameCountNV")) == NULL) || r; return r; } #endif /* WGL_NV_swap_group */ #ifdef WGL_NV_vertex_array_range static GLboolean _glewInit_WGL_NV_vertex_array_range (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglAllocateMemoryNV = (PFNWGLALLOCATEMEMORYNVPROC)glewGetProcAddress((const GLubyte*)"wglAllocateMemoryNV")) == NULL) || r; r = ((wglFreeMemoryNV = (PFNWGLFREEMEMORYNVPROC)glewGetProcAddress((const GLubyte*)"wglFreeMemoryNV")) == NULL) || r; return r; } #endif /* WGL_NV_vertex_array_range */ #ifdef WGL_NV_video_capture static GLboolean _glewInit_WGL_NV_video_capture (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglBindVideoCaptureDeviceNV = (PFNWGLBINDVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglBindVideoCaptureDeviceNV")) == NULL) || r; r = ((wglEnumerateVideoCaptureDevicesNV = (PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC)glewGetProcAddress((const GLubyte*)"wglEnumerateVideoCaptureDevicesNV")) == NULL) || r; r = ((wglLockVideoCaptureDeviceNV = (PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglLockVideoCaptureDeviceNV")) == NULL) || r; r = ((wglQueryVideoCaptureDeviceNV = (PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglQueryVideoCaptureDeviceNV")) == NULL) || r; r = ((wglReleaseVideoCaptureDeviceNV = (PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglReleaseVideoCaptureDeviceNV")) == NULL) || r; return r; } #endif /* WGL_NV_video_capture */ #ifdef WGL_NV_video_output static GLboolean _glewInit_WGL_NV_video_output (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglBindVideoImageNV = (PFNWGLBINDVIDEOIMAGENVPROC)glewGetProcAddress((const GLubyte*)"wglBindVideoImageNV")) == NULL) || r; r = ((wglGetVideoDeviceNV = (PFNWGLGETVIDEODEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglGetVideoDeviceNV")) == NULL) || r; r = ((wglGetVideoInfoNV = (PFNWGLGETVIDEOINFONVPROC)glewGetProcAddress((const GLubyte*)"wglGetVideoInfoNV")) == NULL) || r; r = ((wglReleaseVideoDeviceNV = (PFNWGLRELEASEVIDEODEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglReleaseVideoDeviceNV")) == NULL) || r; r = ((wglReleaseVideoImageNV = (PFNWGLRELEASEVIDEOIMAGENVPROC)glewGetProcAddress((const GLubyte*)"wglReleaseVideoImageNV")) == NULL) || r; r = ((wglSendPbufferToVideoNV = (PFNWGLSENDPBUFFERTOVIDEONVPROC)glewGetProcAddress((const GLubyte*)"wglSendPbufferToVideoNV")) == NULL) || r; return r; } #endif /* WGL_NV_video_output */ #ifdef WGL_OML_sync_control static GLboolean _glewInit_WGL_OML_sync_control (WGLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((wglGetMscRateOML = (PFNWGLGETMSCRATEOMLPROC)glewGetProcAddress((const GLubyte*)"wglGetMscRateOML")) == NULL) || r; r = ((wglGetSyncValuesOML = (PFNWGLGETSYNCVALUESOMLPROC)glewGetProcAddress((const GLubyte*)"wglGetSyncValuesOML")) == NULL) || r; r = ((wglSwapBuffersMscOML = (PFNWGLSWAPBUFFERSMSCOMLPROC)glewGetProcAddress((const GLubyte*)"wglSwapBuffersMscOML")) == NULL) || r; r = ((wglSwapLayerBuffersMscOML = (PFNWGLSWAPLAYERBUFFERSMSCOMLPROC)glewGetProcAddress((const GLubyte*)"wglSwapLayerBuffersMscOML")) == NULL) || r; r = ((wglWaitForMscOML = (PFNWGLWAITFORMSCOMLPROC)glewGetProcAddress((const GLubyte*)"wglWaitForMscOML")) == NULL) || r; r = ((wglWaitForSbcOML = (PFNWGLWAITFORSBCOMLPROC)glewGetProcAddress((const GLubyte*)"wglWaitForSbcOML")) == NULL) || r; return r; } #endif /* WGL_OML_sync_control */ /* ------------------------------------------------------------------------- */ static PFNWGLGETEXTENSIONSSTRINGARBPROC _wglewGetExtensionsStringARB = NULL; static PFNWGLGETEXTENSIONSSTRINGEXTPROC _wglewGetExtensionsStringEXT = NULL; GLboolean GLEWAPIENTRY wglewGetExtension (const char* name) { const GLubyte* start; const GLubyte* end; if (_wglewGetExtensionsStringARB == NULL) if (_wglewGetExtensionsStringEXT == NULL) return GL_FALSE; else start = (const GLubyte*)_wglewGetExtensionsStringEXT(); else start = (const GLubyte*)_wglewGetExtensionsStringARB(wglGetCurrentDC()); if (start == 0) return GL_FALSE; end = start + _glewStrLen(start); return _glewSearchExtension(name, start, end); } GLenum GLEWAPIENTRY wglewContextInit (WGLEW_CONTEXT_ARG_DEF_LIST) { GLboolean crippled; const GLubyte* extStart; const GLubyte* extEnd; /* find wgl extension string query functions */ _wglewGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringARB"); _wglewGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringEXT"); /* query wgl extension string */ if (_wglewGetExtensionsStringARB == NULL) if (_wglewGetExtensionsStringEXT == NULL) extStart = (const GLubyte*)""; else extStart = (const GLubyte*)_wglewGetExtensionsStringEXT(); else extStart = (const GLubyte*)_wglewGetExtensionsStringARB(wglGetCurrentDC()); extEnd = extStart + _glewStrLen(extStart); /* initialize extensions */ crippled = _wglewGetExtensionsStringARB == NULL && _wglewGetExtensionsStringEXT == NULL; #ifdef WGL_3DFX_multisample CONST_CAST(WGLEW_3DFX_multisample) = _glewSearchExtension("WGL_3DFX_multisample", extStart, extEnd); #endif /* WGL_3DFX_multisample */ #ifdef WGL_3DL_stereo_control CONST_CAST(WGLEW_3DL_stereo_control) = _glewSearchExtension("WGL_3DL_stereo_control", extStart, extEnd); if (glewExperimental || WGLEW_3DL_stereo_control|| crippled) CONST_CAST(WGLEW_3DL_stereo_control)= !_glewInit_WGL_3DL_stereo_control(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_3DL_stereo_control */ #ifdef WGL_AMD_gpu_association CONST_CAST(WGLEW_AMD_gpu_association) = _glewSearchExtension("WGL_AMD_gpu_association", extStart, extEnd); if (glewExperimental || WGLEW_AMD_gpu_association|| crippled) CONST_CAST(WGLEW_AMD_gpu_association)= !_glewInit_WGL_AMD_gpu_association(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_AMD_gpu_association */ #ifdef WGL_ARB_buffer_region CONST_CAST(WGLEW_ARB_buffer_region) = _glewSearchExtension("WGL_ARB_buffer_region", extStart, extEnd); if (glewExperimental || WGLEW_ARB_buffer_region|| crippled) CONST_CAST(WGLEW_ARB_buffer_region)= !_glewInit_WGL_ARB_buffer_region(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_ARB_buffer_region */ #ifdef WGL_ARB_create_context CONST_CAST(WGLEW_ARB_create_context) = _glewSearchExtension("WGL_ARB_create_context", extStart, extEnd); if (glewExperimental || WGLEW_ARB_create_context|| crippled) CONST_CAST(WGLEW_ARB_create_context)= !_glewInit_WGL_ARB_create_context(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_ARB_create_context */ #ifdef WGL_ARB_create_context_profile CONST_CAST(WGLEW_ARB_create_context_profile) = _glewSearchExtension("WGL_ARB_create_context_profile", extStart, extEnd); #endif /* WGL_ARB_create_context_profile */ #ifdef WGL_ARB_create_context_robustness CONST_CAST(WGLEW_ARB_create_context_robustness) = _glewSearchExtension("WGL_ARB_create_context_robustness", extStart, extEnd); #endif /* WGL_ARB_create_context_robustness */ #ifdef WGL_ARB_extensions_string CONST_CAST(WGLEW_ARB_extensions_string) = _glewSearchExtension("WGL_ARB_extensions_string", extStart, extEnd); if (glewExperimental || WGLEW_ARB_extensions_string|| crippled) CONST_CAST(WGLEW_ARB_extensions_string)= !_glewInit_WGL_ARB_extensions_string(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_ARB_extensions_string */ #ifdef WGL_ARB_framebuffer_sRGB CONST_CAST(WGLEW_ARB_framebuffer_sRGB) = _glewSearchExtension("WGL_ARB_framebuffer_sRGB", extStart, extEnd); #endif /* WGL_ARB_framebuffer_sRGB */ #ifdef WGL_ARB_make_current_read CONST_CAST(WGLEW_ARB_make_current_read) = _glewSearchExtension("WGL_ARB_make_current_read", extStart, extEnd); if (glewExperimental || WGLEW_ARB_make_current_read|| crippled) CONST_CAST(WGLEW_ARB_make_current_read)= !_glewInit_WGL_ARB_make_current_read(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_ARB_make_current_read */ #ifdef WGL_ARB_multisample CONST_CAST(WGLEW_ARB_multisample) = _glewSearchExtension("WGL_ARB_multisample", extStart, extEnd); #endif /* WGL_ARB_multisample */ #ifdef WGL_ARB_pbuffer CONST_CAST(WGLEW_ARB_pbuffer) = _glewSearchExtension("WGL_ARB_pbuffer", extStart, extEnd); if (glewExperimental || WGLEW_ARB_pbuffer|| crippled) CONST_CAST(WGLEW_ARB_pbuffer)= !_glewInit_WGL_ARB_pbuffer(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_ARB_pbuffer */ #ifdef WGL_ARB_pixel_format CONST_CAST(WGLEW_ARB_pixel_format) = _glewSearchExtension("WGL_ARB_pixel_format", extStart, extEnd); if (glewExperimental || WGLEW_ARB_pixel_format|| crippled) CONST_CAST(WGLEW_ARB_pixel_format)= !_glewInit_WGL_ARB_pixel_format(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_ARB_pixel_format */ #ifdef WGL_ARB_pixel_format_float CONST_CAST(WGLEW_ARB_pixel_format_float) = _glewSearchExtension("WGL_ARB_pixel_format_float", extStart, extEnd); #endif /* WGL_ARB_pixel_format_float */ #ifdef WGL_ARB_render_texture CONST_CAST(WGLEW_ARB_render_texture) = _glewSearchExtension("WGL_ARB_render_texture", extStart, extEnd); if (glewExperimental || WGLEW_ARB_render_texture|| crippled) CONST_CAST(WGLEW_ARB_render_texture)= !_glewInit_WGL_ARB_render_texture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_ARB_render_texture */ #ifdef WGL_ATI_pixel_format_float CONST_CAST(WGLEW_ATI_pixel_format_float) = _glewSearchExtension("WGL_ATI_pixel_format_float", extStart, extEnd); #endif /* WGL_ATI_pixel_format_float */ #ifdef WGL_ATI_render_texture_rectangle CONST_CAST(WGLEW_ATI_render_texture_rectangle) = _glewSearchExtension("WGL_ATI_render_texture_rectangle", extStart, extEnd); #endif /* WGL_ATI_render_texture_rectangle */ #ifdef WGL_EXT_create_context_es2_profile CONST_CAST(WGLEW_EXT_create_context_es2_profile) = _glewSearchExtension("WGL_EXT_create_context_es2_profile", extStart, extEnd); #endif /* WGL_EXT_create_context_es2_profile */ #ifdef WGL_EXT_create_context_es_profile CONST_CAST(WGLEW_EXT_create_context_es_profile) = _glewSearchExtension("WGL_EXT_create_context_es_profile", extStart, extEnd); #endif /* WGL_EXT_create_context_es_profile */ #ifdef WGL_EXT_depth_float CONST_CAST(WGLEW_EXT_depth_float) = _glewSearchExtension("WGL_EXT_depth_float", extStart, extEnd); #endif /* WGL_EXT_depth_float */ #ifdef WGL_EXT_display_color_table CONST_CAST(WGLEW_EXT_display_color_table) = _glewSearchExtension("WGL_EXT_display_color_table", extStart, extEnd); if (glewExperimental || WGLEW_EXT_display_color_table|| crippled) CONST_CAST(WGLEW_EXT_display_color_table)= !_glewInit_WGL_EXT_display_color_table(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_EXT_display_color_table */ #ifdef WGL_EXT_extensions_string CONST_CAST(WGLEW_EXT_extensions_string) = _glewSearchExtension("WGL_EXT_extensions_string", extStart, extEnd); if (glewExperimental || WGLEW_EXT_extensions_string|| crippled) CONST_CAST(WGLEW_EXT_extensions_string)= !_glewInit_WGL_EXT_extensions_string(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_EXT_extensions_string */ #ifdef WGL_EXT_framebuffer_sRGB CONST_CAST(WGLEW_EXT_framebuffer_sRGB) = _glewSearchExtension("WGL_EXT_framebuffer_sRGB", extStart, extEnd); #endif /* WGL_EXT_framebuffer_sRGB */ #ifdef WGL_EXT_make_current_read CONST_CAST(WGLEW_EXT_make_current_read) = _glewSearchExtension("WGL_EXT_make_current_read", extStart, extEnd); if (glewExperimental || WGLEW_EXT_make_current_read|| crippled) CONST_CAST(WGLEW_EXT_make_current_read)= !_glewInit_WGL_EXT_make_current_read(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_EXT_make_current_read */ #ifdef WGL_EXT_multisample CONST_CAST(WGLEW_EXT_multisample) = _glewSearchExtension("WGL_EXT_multisample", extStart, extEnd); #endif /* WGL_EXT_multisample */ #ifdef WGL_EXT_pbuffer CONST_CAST(WGLEW_EXT_pbuffer) = _glewSearchExtension("WGL_EXT_pbuffer", extStart, extEnd); if (glewExperimental || WGLEW_EXT_pbuffer|| crippled) CONST_CAST(WGLEW_EXT_pbuffer)= !_glewInit_WGL_EXT_pbuffer(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_EXT_pbuffer */ #ifdef WGL_EXT_pixel_format CONST_CAST(WGLEW_EXT_pixel_format) = _glewSearchExtension("WGL_EXT_pixel_format", extStart, extEnd); if (glewExperimental || WGLEW_EXT_pixel_format|| crippled) CONST_CAST(WGLEW_EXT_pixel_format)= !_glewInit_WGL_EXT_pixel_format(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_EXT_pixel_format */ #ifdef WGL_EXT_pixel_format_packed_float CONST_CAST(WGLEW_EXT_pixel_format_packed_float) = _glewSearchExtension("WGL_EXT_pixel_format_packed_float", extStart, extEnd); #endif /* WGL_EXT_pixel_format_packed_float */ #ifdef WGL_EXT_swap_control CONST_CAST(WGLEW_EXT_swap_control) = _glewSearchExtension("WGL_EXT_swap_control", extStart, extEnd); if (glewExperimental || WGLEW_EXT_swap_control|| crippled) CONST_CAST(WGLEW_EXT_swap_control)= !_glewInit_WGL_EXT_swap_control(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_EXT_swap_control */ #ifdef WGL_EXT_swap_control_tear CONST_CAST(WGLEW_EXT_swap_control_tear) = _glewSearchExtension("WGL_EXT_swap_control_tear", extStart, extEnd); #endif /* WGL_EXT_swap_control_tear */ #ifdef WGL_I3D_digital_video_control CONST_CAST(WGLEW_I3D_digital_video_control) = _glewSearchExtension("WGL_I3D_digital_video_control", extStart, extEnd); if (glewExperimental || WGLEW_I3D_digital_video_control|| crippled) CONST_CAST(WGLEW_I3D_digital_video_control)= !_glewInit_WGL_I3D_digital_video_control(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_I3D_digital_video_control */ #ifdef WGL_I3D_gamma CONST_CAST(WGLEW_I3D_gamma) = _glewSearchExtension("WGL_I3D_gamma", extStart, extEnd); if (glewExperimental || WGLEW_I3D_gamma|| crippled) CONST_CAST(WGLEW_I3D_gamma)= !_glewInit_WGL_I3D_gamma(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_I3D_gamma */ #ifdef WGL_I3D_genlock CONST_CAST(WGLEW_I3D_genlock) = _glewSearchExtension("WGL_I3D_genlock", extStart, extEnd); if (glewExperimental || WGLEW_I3D_genlock|| crippled) CONST_CAST(WGLEW_I3D_genlock)= !_glewInit_WGL_I3D_genlock(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_I3D_genlock */ #ifdef WGL_I3D_image_buffer CONST_CAST(WGLEW_I3D_image_buffer) = _glewSearchExtension("WGL_I3D_image_buffer", extStart, extEnd); if (glewExperimental || WGLEW_I3D_image_buffer|| crippled) CONST_CAST(WGLEW_I3D_image_buffer)= !_glewInit_WGL_I3D_image_buffer(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_I3D_image_buffer */ #ifdef WGL_I3D_swap_frame_lock CONST_CAST(WGLEW_I3D_swap_frame_lock) = _glewSearchExtension("WGL_I3D_swap_frame_lock", extStart, extEnd); if (glewExperimental || WGLEW_I3D_swap_frame_lock|| crippled) CONST_CAST(WGLEW_I3D_swap_frame_lock)= !_glewInit_WGL_I3D_swap_frame_lock(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_I3D_swap_frame_lock */ #ifdef WGL_I3D_swap_frame_usage CONST_CAST(WGLEW_I3D_swap_frame_usage) = _glewSearchExtension("WGL_I3D_swap_frame_usage", extStart, extEnd); if (glewExperimental || WGLEW_I3D_swap_frame_usage|| crippled) CONST_CAST(WGLEW_I3D_swap_frame_usage)= !_glewInit_WGL_I3D_swap_frame_usage(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_I3D_swap_frame_usage */ #ifdef WGL_NV_DX_interop CONST_CAST(WGLEW_NV_DX_interop) = _glewSearchExtension("WGL_NV_DX_interop", extStart, extEnd); if (glewExperimental || WGLEW_NV_DX_interop|| crippled) CONST_CAST(WGLEW_NV_DX_interop)= !_glewInit_WGL_NV_DX_interop(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_NV_DX_interop */ #ifdef WGL_NV_DX_interop2 CONST_CAST(WGLEW_NV_DX_interop2) = _glewSearchExtension("WGL_NV_DX_interop2", extStart, extEnd); #endif /* WGL_NV_DX_interop2 */ #ifdef WGL_NV_copy_image CONST_CAST(WGLEW_NV_copy_image) = _glewSearchExtension("WGL_NV_copy_image", extStart, extEnd); if (glewExperimental || WGLEW_NV_copy_image|| crippled) CONST_CAST(WGLEW_NV_copy_image)= !_glewInit_WGL_NV_copy_image(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_NV_copy_image */ #ifdef WGL_NV_float_buffer CONST_CAST(WGLEW_NV_float_buffer) = _glewSearchExtension("WGL_NV_float_buffer", extStart, extEnd); #endif /* WGL_NV_float_buffer */ #ifdef WGL_NV_gpu_affinity CONST_CAST(WGLEW_NV_gpu_affinity) = _glewSearchExtension("WGL_NV_gpu_affinity", extStart, extEnd); if (glewExperimental || WGLEW_NV_gpu_affinity|| crippled) CONST_CAST(WGLEW_NV_gpu_affinity)= !_glewInit_WGL_NV_gpu_affinity(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_NV_gpu_affinity */ #ifdef WGL_NV_multisample_coverage CONST_CAST(WGLEW_NV_multisample_coverage) = _glewSearchExtension("WGL_NV_multisample_coverage", extStart, extEnd); #endif /* WGL_NV_multisample_coverage */ #ifdef WGL_NV_present_video CONST_CAST(WGLEW_NV_present_video) = _glewSearchExtension("WGL_NV_present_video", extStart, extEnd); if (glewExperimental || WGLEW_NV_present_video|| crippled) CONST_CAST(WGLEW_NV_present_video)= !_glewInit_WGL_NV_present_video(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_NV_present_video */ #ifdef WGL_NV_render_depth_texture CONST_CAST(WGLEW_NV_render_depth_texture) = _glewSearchExtension("WGL_NV_render_depth_texture", extStart, extEnd); #endif /* WGL_NV_render_depth_texture */ #ifdef WGL_NV_render_texture_rectangle CONST_CAST(WGLEW_NV_render_texture_rectangle) = _glewSearchExtension("WGL_NV_render_texture_rectangle", extStart, extEnd); #endif /* WGL_NV_render_texture_rectangle */ #ifdef WGL_NV_swap_group CONST_CAST(WGLEW_NV_swap_group) = _glewSearchExtension("WGL_NV_swap_group", extStart, extEnd); if (glewExperimental || WGLEW_NV_swap_group|| crippled) CONST_CAST(WGLEW_NV_swap_group)= !_glewInit_WGL_NV_swap_group(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_NV_swap_group */ #ifdef WGL_NV_vertex_array_range CONST_CAST(WGLEW_NV_vertex_array_range) = _glewSearchExtension("WGL_NV_vertex_array_range", extStart, extEnd); if (glewExperimental || WGLEW_NV_vertex_array_range|| crippled) CONST_CAST(WGLEW_NV_vertex_array_range)= !_glewInit_WGL_NV_vertex_array_range(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_NV_vertex_array_range */ #ifdef WGL_NV_video_capture CONST_CAST(WGLEW_NV_video_capture) = _glewSearchExtension("WGL_NV_video_capture", extStart, extEnd); if (glewExperimental || WGLEW_NV_video_capture|| crippled) CONST_CAST(WGLEW_NV_video_capture)= !_glewInit_WGL_NV_video_capture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_NV_video_capture */ #ifdef WGL_NV_video_output CONST_CAST(WGLEW_NV_video_output) = _glewSearchExtension("WGL_NV_video_output", extStart, extEnd); if (glewExperimental || WGLEW_NV_video_output|| crippled) CONST_CAST(WGLEW_NV_video_output)= !_glewInit_WGL_NV_video_output(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_NV_video_output */ #ifdef WGL_OML_sync_control CONST_CAST(WGLEW_OML_sync_control) = _glewSearchExtension("WGL_OML_sync_control", extStart, extEnd); if (glewExperimental || WGLEW_OML_sync_control|| crippled) CONST_CAST(WGLEW_OML_sync_control)= !_glewInit_WGL_OML_sync_control(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_OML_sync_control */ return GLEW_OK; } #elif !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) PFNGLXGETCURRENTDISPLAYPROC __glewXGetCurrentDisplay = NULL; PFNGLXCHOOSEFBCONFIGPROC __glewXChooseFBConfig = NULL; PFNGLXCREATENEWCONTEXTPROC __glewXCreateNewContext = NULL; PFNGLXCREATEPBUFFERPROC __glewXCreatePbuffer = NULL; PFNGLXCREATEPIXMAPPROC __glewXCreatePixmap = NULL; PFNGLXCREATEWINDOWPROC __glewXCreateWindow = NULL; PFNGLXDESTROYPBUFFERPROC __glewXDestroyPbuffer = NULL; PFNGLXDESTROYPIXMAPPROC __glewXDestroyPixmap = NULL; PFNGLXDESTROYWINDOWPROC __glewXDestroyWindow = NULL; PFNGLXGETCURRENTREADDRAWABLEPROC __glewXGetCurrentReadDrawable = NULL; PFNGLXGETFBCONFIGATTRIBPROC __glewXGetFBConfigAttrib = NULL; PFNGLXGETFBCONFIGSPROC __glewXGetFBConfigs = NULL; PFNGLXGETSELECTEDEVENTPROC __glewXGetSelectedEvent = NULL; PFNGLXGETVISUALFROMFBCONFIGPROC __glewXGetVisualFromFBConfig = NULL; PFNGLXMAKECONTEXTCURRENTPROC __glewXMakeContextCurrent = NULL; PFNGLXQUERYCONTEXTPROC __glewXQueryContext = NULL; PFNGLXQUERYDRAWABLEPROC __glewXQueryDrawable = NULL; PFNGLXSELECTEVENTPROC __glewXSelectEvent = NULL; PFNGLXCREATECONTEXTATTRIBSARBPROC __glewXCreateContextAttribsARB = NULL; PFNGLXBINDTEXIMAGEATIPROC __glewXBindTexImageATI = NULL; PFNGLXDRAWABLEATTRIBATIPROC __glewXDrawableAttribATI = NULL; PFNGLXRELEASETEXIMAGEATIPROC __glewXReleaseTexImageATI = NULL; PFNGLXFREECONTEXTEXTPROC __glewXFreeContextEXT = NULL; PFNGLXGETCONTEXTIDEXTPROC __glewXGetContextIDEXT = NULL; PFNGLXIMPORTCONTEXTEXTPROC __glewXImportContextEXT = NULL; PFNGLXQUERYCONTEXTINFOEXTPROC __glewXQueryContextInfoEXT = NULL; PFNGLXSWAPINTERVALEXTPROC __glewXSwapIntervalEXT = NULL; PFNGLXBINDTEXIMAGEEXTPROC __glewXBindTexImageEXT = NULL; PFNGLXRELEASETEXIMAGEEXTPROC __glewXReleaseTexImageEXT = NULL; PFNGLXGETAGPOFFSETMESAPROC __glewXGetAGPOffsetMESA = NULL; PFNGLXCOPYSUBBUFFERMESAPROC __glewXCopySubBufferMESA = NULL; PFNGLXCREATEGLXPIXMAPMESAPROC __glewXCreateGLXPixmapMESA = NULL; PFNGLXRELEASEBUFFERSMESAPROC __glewXReleaseBuffersMESA = NULL; PFNGLXSET3DFXMODEMESAPROC __glewXSet3DfxModeMESA = NULL; PFNGLXGETSWAPINTERVALMESAPROC __glewXGetSwapIntervalMESA = NULL; PFNGLXSWAPINTERVALMESAPROC __glewXSwapIntervalMESA = NULL; PFNGLXCOPYIMAGESUBDATANVPROC __glewXCopyImageSubDataNV = NULL; PFNGLXBINDVIDEODEVICENVPROC __glewXBindVideoDeviceNV = NULL; PFNGLXENUMERATEVIDEODEVICESNVPROC __glewXEnumerateVideoDevicesNV = NULL; PFNGLXBINDSWAPBARRIERNVPROC __glewXBindSwapBarrierNV = NULL; PFNGLXJOINSWAPGROUPNVPROC __glewXJoinSwapGroupNV = NULL; PFNGLXQUERYFRAMECOUNTNVPROC __glewXQueryFrameCountNV = NULL; PFNGLXQUERYMAXSWAPGROUPSNVPROC __glewXQueryMaxSwapGroupsNV = NULL; PFNGLXQUERYSWAPGROUPNVPROC __glewXQuerySwapGroupNV = NULL; PFNGLXRESETFRAMECOUNTNVPROC __glewXResetFrameCountNV = NULL; PFNGLXALLOCATEMEMORYNVPROC __glewXAllocateMemoryNV = NULL; PFNGLXFREEMEMORYNVPROC __glewXFreeMemoryNV = NULL; PFNGLXBINDVIDEOCAPTUREDEVICENVPROC __glewXBindVideoCaptureDeviceNV = NULL; PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC __glewXEnumerateVideoCaptureDevicesNV = NULL; PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC __glewXLockVideoCaptureDeviceNV = NULL; PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC __glewXQueryVideoCaptureDeviceNV = NULL; PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC __glewXReleaseVideoCaptureDeviceNV = NULL; PFNGLXBINDVIDEOIMAGENVPROC __glewXBindVideoImageNV = NULL; PFNGLXGETVIDEODEVICENVPROC __glewXGetVideoDeviceNV = NULL; PFNGLXGETVIDEOINFONVPROC __glewXGetVideoInfoNV = NULL; PFNGLXRELEASEVIDEODEVICENVPROC __glewXReleaseVideoDeviceNV = NULL; PFNGLXRELEASEVIDEOIMAGENVPROC __glewXReleaseVideoImageNV = NULL; PFNGLXSENDPBUFFERTOVIDEONVPROC __glewXSendPbufferToVideoNV = NULL; PFNGLXGETMSCRATEOMLPROC __glewXGetMscRateOML = NULL; PFNGLXGETSYNCVALUESOMLPROC __glewXGetSyncValuesOML = NULL; PFNGLXSWAPBUFFERSMSCOMLPROC __glewXSwapBuffersMscOML = NULL; PFNGLXWAITFORMSCOMLPROC __glewXWaitForMscOML = NULL; PFNGLXWAITFORSBCOMLPROC __glewXWaitForSbcOML = NULL; PFNGLXCHOOSEFBCONFIGSGIXPROC __glewXChooseFBConfigSGIX = NULL; PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC __glewXCreateContextWithConfigSGIX = NULL; PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC __glewXCreateGLXPixmapWithConfigSGIX = NULL; PFNGLXGETFBCONFIGATTRIBSGIXPROC __glewXGetFBConfigAttribSGIX = NULL; PFNGLXGETFBCONFIGFROMVISUALSGIXPROC __glewXGetFBConfigFromVisualSGIX = NULL; PFNGLXGETVISUALFROMFBCONFIGSGIXPROC __glewXGetVisualFromFBConfigSGIX = NULL; PFNGLXBINDHYPERPIPESGIXPROC __glewXBindHyperpipeSGIX = NULL; PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC __glewXDestroyHyperpipeConfigSGIX = NULL; PFNGLXHYPERPIPEATTRIBSGIXPROC __glewXHyperpipeAttribSGIX = NULL; PFNGLXHYPERPIPECONFIGSGIXPROC __glewXHyperpipeConfigSGIX = NULL; PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC __glewXQueryHyperpipeAttribSGIX = NULL; PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC __glewXQueryHyperpipeBestAttribSGIX = NULL; PFNGLXQUERYHYPERPIPECONFIGSGIXPROC __glewXQueryHyperpipeConfigSGIX = NULL; PFNGLXQUERYHYPERPIPENETWORKSGIXPROC __glewXQueryHyperpipeNetworkSGIX = NULL; PFNGLXCREATEGLXPBUFFERSGIXPROC __glewXCreateGLXPbufferSGIX = NULL; PFNGLXDESTROYGLXPBUFFERSGIXPROC __glewXDestroyGLXPbufferSGIX = NULL; PFNGLXGETSELECTEDEVENTSGIXPROC __glewXGetSelectedEventSGIX = NULL; PFNGLXQUERYGLXPBUFFERSGIXPROC __glewXQueryGLXPbufferSGIX = NULL; PFNGLXSELECTEVENTSGIXPROC __glewXSelectEventSGIX = NULL; PFNGLXBINDSWAPBARRIERSGIXPROC __glewXBindSwapBarrierSGIX = NULL; PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC __glewXQueryMaxSwapBarriersSGIX = NULL; PFNGLXJOINSWAPGROUPSGIXPROC __glewXJoinSwapGroupSGIX = NULL; PFNGLXBINDCHANNELTOWINDOWSGIXPROC __glewXBindChannelToWindowSGIX = NULL; PFNGLXCHANNELRECTSGIXPROC __glewXChannelRectSGIX = NULL; PFNGLXCHANNELRECTSYNCSGIXPROC __glewXChannelRectSyncSGIX = NULL; PFNGLXQUERYCHANNELDELTASSGIXPROC __glewXQueryChannelDeltasSGIX = NULL; PFNGLXQUERYCHANNELRECTSGIXPROC __glewXQueryChannelRectSGIX = NULL; PFNGLXCUSHIONSGIPROC __glewXCushionSGI = NULL; PFNGLXGETCURRENTREADDRAWABLESGIPROC __glewXGetCurrentReadDrawableSGI = NULL; PFNGLXMAKECURRENTREADSGIPROC __glewXMakeCurrentReadSGI = NULL; PFNGLXSWAPINTERVALSGIPROC __glewXSwapIntervalSGI = NULL; PFNGLXGETVIDEOSYNCSGIPROC __glewXGetVideoSyncSGI = NULL; PFNGLXWAITVIDEOSYNCSGIPROC __glewXWaitVideoSyncSGI = NULL; PFNGLXGETTRANSPARENTINDEXSUNPROC __glewXGetTransparentIndexSUN = NULL; PFNGLXGETVIDEORESIZESUNPROC __glewXGetVideoResizeSUN = NULL; PFNGLXVIDEORESIZESUNPROC __glewXVideoResizeSUN = NULL; #if !defined(GLEW_MX) GLboolean __GLXEW_VERSION_1_0 = GL_FALSE; GLboolean __GLXEW_VERSION_1_1 = GL_FALSE; GLboolean __GLXEW_VERSION_1_2 = GL_FALSE; GLboolean __GLXEW_VERSION_1_3 = GL_FALSE; GLboolean __GLXEW_VERSION_1_4 = GL_FALSE; GLboolean __GLXEW_3DFX_multisample = GL_FALSE; GLboolean __GLXEW_AMD_gpu_association = GL_FALSE; GLboolean __GLXEW_ARB_create_context = GL_FALSE; GLboolean __GLXEW_ARB_create_context_profile = GL_FALSE; GLboolean __GLXEW_ARB_create_context_robustness = GL_FALSE; GLboolean __GLXEW_ARB_fbconfig_float = GL_FALSE; GLboolean __GLXEW_ARB_framebuffer_sRGB = GL_FALSE; GLboolean __GLXEW_ARB_get_proc_address = GL_FALSE; GLboolean __GLXEW_ARB_multisample = GL_FALSE; GLboolean __GLXEW_ARB_robustness_application_isolation = GL_FALSE; GLboolean __GLXEW_ARB_robustness_share_group_isolation = GL_FALSE; GLboolean __GLXEW_ARB_vertex_buffer_object = GL_FALSE; GLboolean __GLXEW_ATI_pixel_format_float = GL_FALSE; GLboolean __GLXEW_ATI_render_texture = GL_FALSE; GLboolean __GLXEW_EXT_create_context_es2_profile = GL_FALSE; GLboolean __GLXEW_EXT_create_context_es_profile = GL_FALSE; GLboolean __GLXEW_EXT_fbconfig_packed_float = GL_FALSE; GLboolean __GLXEW_EXT_framebuffer_sRGB = GL_FALSE; GLboolean __GLXEW_EXT_import_context = GL_FALSE; GLboolean __GLXEW_EXT_scene_marker = GL_FALSE; GLboolean __GLXEW_EXT_swap_control = GL_FALSE; GLboolean __GLXEW_EXT_swap_control_tear = GL_FALSE; GLboolean __GLXEW_EXT_texture_from_pixmap = GL_FALSE; GLboolean __GLXEW_EXT_visual_info = GL_FALSE; GLboolean __GLXEW_EXT_visual_rating = GL_FALSE; GLboolean __GLXEW_INTEL_swap_event = GL_FALSE; GLboolean __GLXEW_MESA_agp_offset = GL_FALSE; GLboolean __GLXEW_MESA_copy_sub_buffer = GL_FALSE; GLboolean __GLXEW_MESA_pixmap_colormap = GL_FALSE; GLboolean __GLXEW_MESA_release_buffers = GL_FALSE; GLboolean __GLXEW_MESA_set_3dfx_mode = GL_FALSE; GLboolean __GLXEW_MESA_swap_control = GL_FALSE; GLboolean __GLXEW_NV_copy_image = GL_FALSE; GLboolean __GLXEW_NV_float_buffer = GL_FALSE; GLboolean __GLXEW_NV_multisample_coverage = GL_FALSE; GLboolean __GLXEW_NV_present_video = GL_FALSE; GLboolean __GLXEW_NV_swap_group = GL_FALSE; GLboolean __GLXEW_NV_vertex_array_range = GL_FALSE; GLboolean __GLXEW_NV_video_capture = GL_FALSE; GLboolean __GLXEW_NV_video_out = GL_FALSE; GLboolean __GLXEW_OML_swap_method = GL_FALSE; GLboolean __GLXEW_OML_sync_control = GL_FALSE; GLboolean __GLXEW_SGIS_blended_overlay = GL_FALSE; GLboolean __GLXEW_SGIS_color_range = GL_FALSE; GLboolean __GLXEW_SGIS_multisample = GL_FALSE; GLboolean __GLXEW_SGIS_shared_multisample = GL_FALSE; GLboolean __GLXEW_SGIX_fbconfig = GL_FALSE; GLboolean __GLXEW_SGIX_hyperpipe = GL_FALSE; GLboolean __GLXEW_SGIX_pbuffer = GL_FALSE; GLboolean __GLXEW_SGIX_swap_barrier = GL_FALSE; GLboolean __GLXEW_SGIX_swap_group = GL_FALSE; GLboolean __GLXEW_SGIX_video_resize = GL_FALSE; GLboolean __GLXEW_SGIX_visual_select_group = GL_FALSE; GLboolean __GLXEW_SGI_cushion = GL_FALSE; GLboolean __GLXEW_SGI_make_current_read = GL_FALSE; GLboolean __GLXEW_SGI_swap_control = GL_FALSE; GLboolean __GLXEW_SGI_video_sync = GL_FALSE; GLboolean __GLXEW_SUN_get_transparent_index = GL_FALSE; GLboolean __GLXEW_SUN_video_resize = GL_FALSE; #endif /* !GLEW_MX */ #ifdef GLX_VERSION_1_2 static GLboolean _glewInit_GLX_VERSION_1_2 (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXGetCurrentDisplay = (PFNGLXGETCURRENTDISPLAYPROC)glewGetProcAddress((const GLubyte*)"glXGetCurrentDisplay")) == NULL) || r; return r; } #endif /* GLX_VERSION_1_2 */ #ifdef GLX_VERSION_1_3 static GLboolean _glewInit_GLX_VERSION_1_3 (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXChooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC)glewGetProcAddress((const GLubyte*)"glXChooseFBConfig")) == NULL) || r; r = ((glXCreateNewContext = (PFNGLXCREATENEWCONTEXTPROC)glewGetProcAddress((const GLubyte*)"glXCreateNewContext")) == NULL) || r; r = ((glXCreatePbuffer = (PFNGLXCREATEPBUFFERPROC)glewGetProcAddress((const GLubyte*)"glXCreatePbuffer")) == NULL) || r; r = ((glXCreatePixmap = (PFNGLXCREATEPIXMAPPROC)glewGetProcAddress((const GLubyte*)"glXCreatePixmap")) == NULL) || r; r = ((glXCreateWindow = (PFNGLXCREATEWINDOWPROC)glewGetProcAddress((const GLubyte*)"glXCreateWindow")) == NULL) || r; r = ((glXDestroyPbuffer = (PFNGLXDESTROYPBUFFERPROC)glewGetProcAddress((const GLubyte*)"glXDestroyPbuffer")) == NULL) || r; r = ((glXDestroyPixmap = (PFNGLXDESTROYPIXMAPPROC)glewGetProcAddress((const GLubyte*)"glXDestroyPixmap")) == NULL) || r; r = ((glXDestroyWindow = (PFNGLXDESTROYWINDOWPROC)glewGetProcAddress((const GLubyte*)"glXDestroyWindow")) == NULL) || r; r = ((glXGetCurrentReadDrawable = (PFNGLXGETCURRENTREADDRAWABLEPROC)glewGetProcAddress((const GLubyte*)"glXGetCurrentReadDrawable")) == NULL) || r; r = ((glXGetFBConfigAttrib = (PFNGLXGETFBCONFIGATTRIBPROC)glewGetProcAddress((const GLubyte*)"glXGetFBConfigAttrib")) == NULL) || r; r = ((glXGetFBConfigs = (PFNGLXGETFBCONFIGSPROC)glewGetProcAddress((const GLubyte*)"glXGetFBConfigs")) == NULL) || r; r = ((glXGetSelectedEvent = (PFNGLXGETSELECTEDEVENTPROC)glewGetProcAddress((const GLubyte*)"glXGetSelectedEvent")) == NULL) || r; r = ((glXGetVisualFromFBConfig = (PFNGLXGETVISUALFROMFBCONFIGPROC)glewGetProcAddress((const GLubyte*)"glXGetVisualFromFBConfig")) == NULL) || r; r = ((glXMakeContextCurrent = (PFNGLXMAKECONTEXTCURRENTPROC)glewGetProcAddress((const GLubyte*)"glXMakeContextCurrent")) == NULL) || r; r = ((glXQueryContext = (PFNGLXQUERYCONTEXTPROC)glewGetProcAddress((const GLubyte*)"glXQueryContext")) == NULL) || r; r = ((glXQueryDrawable = (PFNGLXQUERYDRAWABLEPROC)glewGetProcAddress((const GLubyte*)"glXQueryDrawable")) == NULL) || r; r = ((glXSelectEvent = (PFNGLXSELECTEVENTPROC)glewGetProcAddress((const GLubyte*)"glXSelectEvent")) == NULL) || r; return r; } #endif /* GLX_VERSION_1_3 */ #ifdef GLX_VERSION_1_4 #endif /* GLX_VERSION_1_4 */ #ifdef GLX_3DFX_multisample #endif /* GLX_3DFX_multisample */ #ifdef GLX_AMD_gpu_association #endif /* GLX_AMD_gpu_association */ #ifdef GLX_ARB_create_context static GLboolean _glewInit_GLX_ARB_create_context (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glewGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB")) == NULL) || r; return r; } #endif /* GLX_ARB_create_context */ #ifdef GLX_ARB_create_context_profile #endif /* GLX_ARB_create_context_profile */ #ifdef GLX_ARB_create_context_robustness #endif /* GLX_ARB_create_context_robustness */ #ifdef GLX_ARB_fbconfig_float #endif /* GLX_ARB_fbconfig_float */ #ifdef GLX_ARB_framebuffer_sRGB #endif /* GLX_ARB_framebuffer_sRGB */ #ifdef GLX_ARB_get_proc_address #endif /* GLX_ARB_get_proc_address */ #ifdef GLX_ARB_multisample #endif /* GLX_ARB_multisample */ #ifdef GLX_ARB_robustness_application_isolation #endif /* GLX_ARB_robustness_application_isolation */ #ifdef GLX_ARB_robustness_share_group_isolation #endif /* GLX_ARB_robustness_share_group_isolation */ #ifdef GLX_ARB_vertex_buffer_object #endif /* GLX_ARB_vertex_buffer_object */ #ifdef GLX_ATI_pixel_format_float #endif /* GLX_ATI_pixel_format_float */ #ifdef GLX_ATI_render_texture static GLboolean _glewInit_GLX_ATI_render_texture (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXBindTexImageATI = (PFNGLXBINDTEXIMAGEATIPROC)glewGetProcAddress((const GLubyte*)"glXBindTexImageATI")) == NULL) || r; r = ((glXDrawableAttribATI = (PFNGLXDRAWABLEATTRIBATIPROC)glewGetProcAddress((const GLubyte*)"glXDrawableAttribATI")) == NULL) || r; r = ((glXReleaseTexImageATI = (PFNGLXRELEASETEXIMAGEATIPROC)glewGetProcAddress((const GLubyte*)"glXReleaseTexImageATI")) == NULL) || r; return r; } #endif /* GLX_ATI_render_texture */ #ifdef GLX_EXT_create_context_es2_profile #endif /* GLX_EXT_create_context_es2_profile */ #ifdef GLX_EXT_create_context_es_profile #endif /* GLX_EXT_create_context_es_profile */ #ifdef GLX_EXT_fbconfig_packed_float #endif /* GLX_EXT_fbconfig_packed_float */ #ifdef GLX_EXT_framebuffer_sRGB #endif /* GLX_EXT_framebuffer_sRGB */ #ifdef GLX_EXT_import_context static GLboolean _glewInit_GLX_EXT_import_context (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXFreeContextEXT = (PFNGLXFREECONTEXTEXTPROC)glewGetProcAddress((const GLubyte*)"glXFreeContextEXT")) == NULL) || r; r = ((glXGetContextIDEXT = (PFNGLXGETCONTEXTIDEXTPROC)glewGetProcAddress((const GLubyte*)"glXGetContextIDEXT")) == NULL) || r; r = ((glXImportContextEXT = (PFNGLXIMPORTCONTEXTEXTPROC)glewGetProcAddress((const GLubyte*)"glXImportContextEXT")) == NULL) || r; r = ((glXQueryContextInfoEXT = (PFNGLXQUERYCONTEXTINFOEXTPROC)glewGetProcAddress((const GLubyte*)"glXQueryContextInfoEXT")) == NULL) || r; return r; } #endif /* GLX_EXT_import_context */ #ifdef GLX_EXT_scene_marker #endif /* GLX_EXT_scene_marker */ #ifdef GLX_EXT_swap_control static GLboolean _glewInit_GLX_EXT_swap_control (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXSwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)glewGetProcAddress((const GLubyte*)"glXSwapIntervalEXT")) == NULL) || r; return r; } #endif /* GLX_EXT_swap_control */ #ifdef GLX_EXT_swap_control_tear #endif /* GLX_EXT_swap_control_tear */ #ifdef GLX_EXT_texture_from_pixmap static GLboolean _glewInit_GLX_EXT_texture_from_pixmap (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXBindTexImageEXT = (PFNGLXBINDTEXIMAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glXBindTexImageEXT")) == NULL) || r; r = ((glXReleaseTexImageEXT = (PFNGLXRELEASETEXIMAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glXReleaseTexImageEXT")) == NULL) || r; return r; } #endif /* GLX_EXT_texture_from_pixmap */ #ifdef GLX_EXT_visual_info #endif /* GLX_EXT_visual_info */ #ifdef GLX_EXT_visual_rating #endif /* GLX_EXT_visual_rating */ #ifdef GLX_INTEL_swap_event #endif /* GLX_INTEL_swap_event */ #ifdef GLX_MESA_agp_offset static GLboolean _glewInit_GLX_MESA_agp_offset (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXGetAGPOffsetMESA = (PFNGLXGETAGPOFFSETMESAPROC)glewGetProcAddress((const GLubyte*)"glXGetAGPOffsetMESA")) == NULL) || r; return r; } #endif /* GLX_MESA_agp_offset */ #ifdef GLX_MESA_copy_sub_buffer static GLboolean _glewInit_GLX_MESA_copy_sub_buffer (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXCopySubBufferMESA = (PFNGLXCOPYSUBBUFFERMESAPROC)glewGetProcAddress((const GLubyte*)"glXCopySubBufferMESA")) == NULL) || r; return r; } #endif /* GLX_MESA_copy_sub_buffer */ #ifdef GLX_MESA_pixmap_colormap static GLboolean _glewInit_GLX_MESA_pixmap_colormap (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXCreateGLXPixmapMESA = (PFNGLXCREATEGLXPIXMAPMESAPROC)glewGetProcAddress((const GLubyte*)"glXCreateGLXPixmapMESA")) == NULL) || r; return r; } #endif /* GLX_MESA_pixmap_colormap */ #ifdef GLX_MESA_release_buffers static GLboolean _glewInit_GLX_MESA_release_buffers (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXReleaseBuffersMESA = (PFNGLXRELEASEBUFFERSMESAPROC)glewGetProcAddress((const GLubyte*)"glXReleaseBuffersMESA")) == NULL) || r; return r; } #endif /* GLX_MESA_release_buffers */ #ifdef GLX_MESA_set_3dfx_mode static GLboolean _glewInit_GLX_MESA_set_3dfx_mode (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXSet3DfxModeMESA = (PFNGLXSET3DFXMODEMESAPROC)glewGetProcAddress((const GLubyte*)"glXSet3DfxModeMESA")) == NULL) || r; return r; } #endif /* GLX_MESA_set_3dfx_mode */ #ifdef GLX_MESA_swap_control static GLboolean _glewInit_GLX_MESA_swap_control (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXGetSwapIntervalMESA = (PFNGLXGETSWAPINTERVALMESAPROC)glewGetProcAddress((const GLubyte*)"glXGetSwapIntervalMESA")) == NULL) || r; r = ((glXSwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)glewGetProcAddress((const GLubyte*)"glXSwapIntervalMESA")) == NULL) || r; return r; } #endif /* GLX_MESA_swap_control */ #ifdef GLX_NV_copy_image static GLboolean _glewInit_GLX_NV_copy_image (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXCopyImageSubDataNV = (PFNGLXCOPYIMAGESUBDATANVPROC)glewGetProcAddress((const GLubyte*)"glXCopyImageSubDataNV")) == NULL) || r; return r; } #endif /* GLX_NV_copy_image */ #ifdef GLX_NV_float_buffer #endif /* GLX_NV_float_buffer */ #ifdef GLX_NV_multisample_coverage #endif /* GLX_NV_multisample_coverage */ #ifdef GLX_NV_present_video static GLboolean _glewInit_GLX_NV_present_video (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXBindVideoDeviceNV = (PFNGLXBINDVIDEODEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXBindVideoDeviceNV")) == NULL) || r; r = ((glXEnumerateVideoDevicesNV = (PFNGLXENUMERATEVIDEODEVICESNVPROC)glewGetProcAddress((const GLubyte*)"glXEnumerateVideoDevicesNV")) == NULL) || r; return r; } #endif /* GLX_NV_present_video */ #ifdef GLX_NV_swap_group static GLboolean _glewInit_GLX_NV_swap_group (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXBindSwapBarrierNV = (PFNGLXBINDSWAPBARRIERNVPROC)glewGetProcAddress((const GLubyte*)"glXBindSwapBarrierNV")) == NULL) || r; r = ((glXJoinSwapGroupNV = (PFNGLXJOINSWAPGROUPNVPROC)glewGetProcAddress((const GLubyte*)"glXJoinSwapGroupNV")) == NULL) || r; r = ((glXQueryFrameCountNV = (PFNGLXQUERYFRAMECOUNTNVPROC)glewGetProcAddress((const GLubyte*)"glXQueryFrameCountNV")) == NULL) || r; r = ((glXQueryMaxSwapGroupsNV = (PFNGLXQUERYMAXSWAPGROUPSNVPROC)glewGetProcAddress((const GLubyte*)"glXQueryMaxSwapGroupsNV")) == NULL) || r; r = ((glXQuerySwapGroupNV = (PFNGLXQUERYSWAPGROUPNVPROC)glewGetProcAddress((const GLubyte*)"glXQuerySwapGroupNV")) == NULL) || r; r = ((glXResetFrameCountNV = (PFNGLXRESETFRAMECOUNTNVPROC)glewGetProcAddress((const GLubyte*)"glXResetFrameCountNV")) == NULL) || r; return r; } #endif /* GLX_NV_swap_group */ #ifdef GLX_NV_vertex_array_range static GLboolean _glewInit_GLX_NV_vertex_array_range (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXAllocateMemoryNV = (PFNGLXALLOCATEMEMORYNVPROC)glewGetProcAddress((const GLubyte*)"glXAllocateMemoryNV")) == NULL) || r; r = ((glXFreeMemoryNV = (PFNGLXFREEMEMORYNVPROC)glewGetProcAddress((const GLubyte*)"glXFreeMemoryNV")) == NULL) || r; return r; } #endif /* GLX_NV_vertex_array_range */ #ifdef GLX_NV_video_capture static GLboolean _glewInit_GLX_NV_video_capture (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXBindVideoCaptureDeviceNV = (PFNGLXBINDVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXBindVideoCaptureDeviceNV")) == NULL) || r; r = ((glXEnumerateVideoCaptureDevicesNV = (PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC)glewGetProcAddress((const GLubyte*)"glXEnumerateVideoCaptureDevicesNV")) == NULL) || r; r = ((glXLockVideoCaptureDeviceNV = (PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXLockVideoCaptureDeviceNV")) == NULL) || r; r = ((glXQueryVideoCaptureDeviceNV = (PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXQueryVideoCaptureDeviceNV")) == NULL) || r; r = ((glXReleaseVideoCaptureDeviceNV = (PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXReleaseVideoCaptureDeviceNV")) == NULL) || r; return r; } #endif /* GLX_NV_video_capture */ #ifdef GLX_NV_video_out static GLboolean _glewInit_GLX_NV_video_out (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXBindVideoImageNV = (PFNGLXBINDVIDEOIMAGENVPROC)glewGetProcAddress((const GLubyte*)"glXBindVideoImageNV")) == NULL) || r; r = ((glXGetVideoDeviceNV = (PFNGLXGETVIDEODEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXGetVideoDeviceNV")) == NULL) || r; r = ((glXGetVideoInfoNV = (PFNGLXGETVIDEOINFONVPROC)glewGetProcAddress((const GLubyte*)"glXGetVideoInfoNV")) == NULL) || r; r = ((glXReleaseVideoDeviceNV = (PFNGLXRELEASEVIDEODEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXReleaseVideoDeviceNV")) == NULL) || r; r = ((glXReleaseVideoImageNV = (PFNGLXRELEASEVIDEOIMAGENVPROC)glewGetProcAddress((const GLubyte*)"glXReleaseVideoImageNV")) == NULL) || r; r = ((glXSendPbufferToVideoNV = (PFNGLXSENDPBUFFERTOVIDEONVPROC)glewGetProcAddress((const GLubyte*)"glXSendPbufferToVideoNV")) == NULL) || r; return r; } #endif /* GLX_NV_video_out */ #ifdef GLX_OML_swap_method #endif /* GLX_OML_swap_method */ #ifdef GLX_OML_sync_control static GLboolean _glewInit_GLX_OML_sync_control (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXGetMscRateOML = (PFNGLXGETMSCRATEOMLPROC)glewGetProcAddress((const GLubyte*)"glXGetMscRateOML")) == NULL) || r; r = ((glXGetSyncValuesOML = (PFNGLXGETSYNCVALUESOMLPROC)glewGetProcAddress((const GLubyte*)"glXGetSyncValuesOML")) == NULL) || r; r = ((glXSwapBuffersMscOML = (PFNGLXSWAPBUFFERSMSCOMLPROC)glewGetProcAddress((const GLubyte*)"glXSwapBuffersMscOML")) == NULL) || r; r = ((glXWaitForMscOML = (PFNGLXWAITFORMSCOMLPROC)glewGetProcAddress((const GLubyte*)"glXWaitForMscOML")) == NULL) || r; r = ((glXWaitForSbcOML = (PFNGLXWAITFORSBCOMLPROC)glewGetProcAddress((const GLubyte*)"glXWaitForSbcOML")) == NULL) || r; return r; } #endif /* GLX_OML_sync_control */ #ifdef GLX_SGIS_blended_overlay #endif /* GLX_SGIS_blended_overlay */ #ifdef GLX_SGIS_color_range #endif /* GLX_SGIS_color_range */ #ifdef GLX_SGIS_multisample #endif /* GLX_SGIS_multisample */ #ifdef GLX_SGIS_shared_multisample #endif /* GLX_SGIS_shared_multisample */ #ifdef GLX_SGIX_fbconfig static GLboolean _glewInit_GLX_SGIX_fbconfig (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXChooseFBConfigSGIX = (PFNGLXCHOOSEFBCONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXChooseFBConfigSGIX")) == NULL) || r; r = ((glXCreateContextWithConfigSGIX = (PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXCreateContextWithConfigSGIX")) == NULL) || r; r = ((glXCreateGLXPixmapWithConfigSGIX = (PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXCreateGLXPixmapWithConfigSGIX")) == NULL) || r; r = ((glXGetFBConfigAttribSGIX = (PFNGLXGETFBCONFIGATTRIBSGIXPROC)glewGetProcAddress((const GLubyte*)"glXGetFBConfigAttribSGIX")) == NULL) || r; r = ((glXGetFBConfigFromVisualSGIX = (PFNGLXGETFBCONFIGFROMVISUALSGIXPROC)glewGetProcAddress((const GLubyte*)"glXGetFBConfigFromVisualSGIX")) == NULL) || r; r = ((glXGetVisualFromFBConfigSGIX = (PFNGLXGETVISUALFROMFBCONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXGetVisualFromFBConfigSGIX")) == NULL) || r; return r; } #endif /* GLX_SGIX_fbconfig */ #ifdef GLX_SGIX_hyperpipe static GLboolean _glewInit_GLX_SGIX_hyperpipe (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXBindHyperpipeSGIX = (PFNGLXBINDHYPERPIPESGIXPROC)glewGetProcAddress((const GLubyte*)"glXBindHyperpipeSGIX")) == NULL) || r; r = ((glXDestroyHyperpipeConfigSGIX = (PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXDestroyHyperpipeConfigSGIX")) == NULL) || r; r = ((glXHyperpipeAttribSGIX = (PFNGLXHYPERPIPEATTRIBSGIXPROC)glewGetProcAddress((const GLubyte*)"glXHyperpipeAttribSGIX")) == NULL) || r; r = ((glXHyperpipeConfigSGIX = (PFNGLXHYPERPIPECONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXHyperpipeConfigSGIX")) == NULL) || r; r = ((glXQueryHyperpipeAttribSGIX = (PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryHyperpipeAttribSGIX")) == NULL) || r; r = ((glXQueryHyperpipeBestAttribSGIX = (PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryHyperpipeBestAttribSGIX")) == NULL) || r; r = ((glXQueryHyperpipeConfigSGIX = (PFNGLXQUERYHYPERPIPECONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryHyperpipeConfigSGIX")) == NULL) || r; r = ((glXQueryHyperpipeNetworkSGIX = (PFNGLXQUERYHYPERPIPENETWORKSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryHyperpipeNetworkSGIX")) == NULL) || r; return r; } #endif /* GLX_SGIX_hyperpipe */ #ifdef GLX_SGIX_pbuffer static GLboolean _glewInit_GLX_SGIX_pbuffer (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXCreateGLXPbufferSGIX = (PFNGLXCREATEGLXPBUFFERSGIXPROC)glewGetProcAddress((const GLubyte*)"glXCreateGLXPbufferSGIX")) == NULL) || r; r = ((glXDestroyGLXPbufferSGIX = (PFNGLXDESTROYGLXPBUFFERSGIXPROC)glewGetProcAddress((const GLubyte*)"glXDestroyGLXPbufferSGIX")) == NULL) || r; r = ((glXGetSelectedEventSGIX = (PFNGLXGETSELECTEDEVENTSGIXPROC)glewGetProcAddress((const GLubyte*)"glXGetSelectedEventSGIX")) == NULL) || r; r = ((glXQueryGLXPbufferSGIX = (PFNGLXQUERYGLXPBUFFERSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryGLXPbufferSGIX")) == NULL) || r; r = ((glXSelectEventSGIX = (PFNGLXSELECTEVENTSGIXPROC)glewGetProcAddress((const GLubyte*)"glXSelectEventSGIX")) == NULL) || r; return r; } #endif /* GLX_SGIX_pbuffer */ #ifdef GLX_SGIX_swap_barrier static GLboolean _glewInit_GLX_SGIX_swap_barrier (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXBindSwapBarrierSGIX = (PFNGLXBINDSWAPBARRIERSGIXPROC)glewGetProcAddress((const GLubyte*)"glXBindSwapBarrierSGIX")) == NULL) || r; r = ((glXQueryMaxSwapBarriersSGIX = (PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryMaxSwapBarriersSGIX")) == NULL) || r; return r; } #endif /* GLX_SGIX_swap_barrier */ #ifdef GLX_SGIX_swap_group static GLboolean _glewInit_GLX_SGIX_swap_group (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXJoinSwapGroupSGIX = (PFNGLXJOINSWAPGROUPSGIXPROC)glewGetProcAddress((const GLubyte*)"glXJoinSwapGroupSGIX")) == NULL) || r; return r; } #endif /* GLX_SGIX_swap_group */ #ifdef GLX_SGIX_video_resize static GLboolean _glewInit_GLX_SGIX_video_resize (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXBindChannelToWindowSGIX = (PFNGLXBINDCHANNELTOWINDOWSGIXPROC)glewGetProcAddress((const GLubyte*)"glXBindChannelToWindowSGIX")) == NULL) || r; r = ((glXChannelRectSGIX = (PFNGLXCHANNELRECTSGIXPROC)glewGetProcAddress((const GLubyte*)"glXChannelRectSGIX")) == NULL) || r; r = ((glXChannelRectSyncSGIX = (PFNGLXCHANNELRECTSYNCSGIXPROC)glewGetProcAddress((const GLubyte*)"glXChannelRectSyncSGIX")) == NULL) || r; r = ((glXQueryChannelDeltasSGIX = (PFNGLXQUERYCHANNELDELTASSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryChannelDeltasSGIX")) == NULL) || r; r = ((glXQueryChannelRectSGIX = (PFNGLXQUERYCHANNELRECTSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryChannelRectSGIX")) == NULL) || r; return r; } #endif /* GLX_SGIX_video_resize */ #ifdef GLX_SGIX_visual_select_group #endif /* GLX_SGIX_visual_select_group */ #ifdef GLX_SGI_cushion static GLboolean _glewInit_GLX_SGI_cushion (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXCushionSGI = (PFNGLXCUSHIONSGIPROC)glewGetProcAddress((const GLubyte*)"glXCushionSGI")) == NULL) || r; return r; } #endif /* GLX_SGI_cushion */ #ifdef GLX_SGI_make_current_read static GLboolean _glewInit_GLX_SGI_make_current_read (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXGetCurrentReadDrawableSGI = (PFNGLXGETCURRENTREADDRAWABLESGIPROC)glewGetProcAddress((const GLubyte*)"glXGetCurrentReadDrawableSGI")) == NULL) || r; r = ((glXMakeCurrentReadSGI = (PFNGLXMAKECURRENTREADSGIPROC)glewGetProcAddress((const GLubyte*)"glXMakeCurrentReadSGI")) == NULL) || r; return r; } #endif /* GLX_SGI_make_current_read */ #ifdef GLX_SGI_swap_control static GLboolean _glewInit_GLX_SGI_swap_control (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXSwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)glewGetProcAddress((const GLubyte*)"glXSwapIntervalSGI")) == NULL) || r; return r; } #endif /* GLX_SGI_swap_control */ #ifdef GLX_SGI_video_sync static GLboolean _glewInit_GLX_SGI_video_sync (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXGetVideoSyncSGI = (PFNGLXGETVIDEOSYNCSGIPROC)glewGetProcAddress((const GLubyte*)"glXGetVideoSyncSGI")) == NULL) || r; r = ((glXWaitVideoSyncSGI = (PFNGLXWAITVIDEOSYNCSGIPROC)glewGetProcAddress((const GLubyte*)"glXWaitVideoSyncSGI")) == NULL) || r; return r; } #endif /* GLX_SGI_video_sync */ #ifdef GLX_SUN_get_transparent_index static GLboolean _glewInit_GLX_SUN_get_transparent_index (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXGetTransparentIndexSUN = (PFNGLXGETTRANSPARENTINDEXSUNPROC)glewGetProcAddress((const GLubyte*)"glXGetTransparentIndexSUN")) == NULL) || r; return r; } #endif /* GLX_SUN_get_transparent_index */ #ifdef GLX_SUN_video_resize static GLboolean _glewInit_GLX_SUN_video_resize (GLXEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; r = ((glXGetVideoResizeSUN = (PFNGLXGETVIDEORESIZESUNPROC)glewGetProcAddress((const GLubyte*)"glXGetVideoResizeSUN")) == NULL) || r; r = ((glXVideoResizeSUN = (PFNGLXVIDEORESIZESUNPROC)glewGetProcAddress((const GLubyte*)"glXVideoResizeSUN")) == NULL) || r; return r; } #endif /* GLX_SUN_video_resize */ /* ------------------------------------------------------------------------ */ GLboolean glxewGetExtension (const char* name) { const GLubyte* start; const GLubyte* end; if (glXGetCurrentDisplay == NULL) return GL_FALSE; start = (const GLubyte*)glXGetClientString(glXGetCurrentDisplay(), GLX_EXTENSIONS); if (0 == start) return GL_FALSE; end = start + _glewStrLen(start); return _glewSearchExtension(name, start, end); } GLenum glxewContextInit (GLXEW_CONTEXT_ARG_DEF_LIST) { int major, minor; const GLubyte* extStart; const GLubyte* extEnd; /* initialize core GLX 1.2 */ if (_glewInit_GLX_VERSION_1_2(GLEW_CONTEXT_ARG_VAR_INIT)) return GLEW_ERROR_GLX_VERSION_11_ONLY; /* initialize flags */ CONST_CAST(GLXEW_VERSION_1_0) = GL_TRUE; CONST_CAST(GLXEW_VERSION_1_1) = GL_TRUE; CONST_CAST(GLXEW_VERSION_1_2) = GL_TRUE; CONST_CAST(GLXEW_VERSION_1_3) = GL_TRUE; CONST_CAST(GLXEW_VERSION_1_4) = GL_TRUE; /* query GLX version */ glXQueryVersion(glXGetCurrentDisplay(), &major, &minor); if (major == 1 && minor <= 3) { switch (minor) { case 3: CONST_CAST(GLXEW_VERSION_1_4) = GL_FALSE; break; case 2: CONST_CAST(GLXEW_VERSION_1_4) = GL_FALSE; CONST_CAST(GLXEW_VERSION_1_3) = GL_FALSE; break; default: return GLEW_ERROR_GLX_VERSION_11_ONLY; break; } } /* query GLX extension string */ extStart = 0; if (glXGetCurrentDisplay != NULL) extStart = (const GLubyte*)glXGetClientString(glXGetCurrentDisplay(), GLX_EXTENSIONS); if (extStart == 0) extStart = (const GLubyte *)""; extEnd = extStart + _glewStrLen(extStart); /* initialize extensions */ #ifdef GLX_VERSION_1_3 if (glewExperimental || GLXEW_VERSION_1_3) CONST_CAST(GLXEW_VERSION_1_3) = !_glewInit_GLX_VERSION_1_3(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_VERSION_1_3 */ #ifdef GLX_3DFX_multisample CONST_CAST(GLXEW_3DFX_multisample) = _glewSearchExtension("GLX_3DFX_multisample", extStart, extEnd); #endif /* GLX_3DFX_multisample */ #ifdef GLX_AMD_gpu_association CONST_CAST(GLXEW_AMD_gpu_association) = _glewSearchExtension("GLX_AMD_gpu_association", extStart, extEnd); #endif /* GLX_AMD_gpu_association */ #ifdef GLX_ARB_create_context CONST_CAST(GLXEW_ARB_create_context) = _glewSearchExtension("GLX_ARB_create_context", extStart, extEnd); if (glewExperimental || GLXEW_ARB_create_context) CONST_CAST(GLXEW_ARB_create_context) = !_glewInit_GLX_ARB_create_context(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_ARB_create_context */ #ifdef GLX_ARB_create_context_profile CONST_CAST(GLXEW_ARB_create_context_profile) = _glewSearchExtension("GLX_ARB_create_context_profile", extStart, extEnd); #endif /* GLX_ARB_create_context_profile */ #ifdef GLX_ARB_create_context_robustness CONST_CAST(GLXEW_ARB_create_context_robustness) = _glewSearchExtension("GLX_ARB_create_context_robustness", extStart, extEnd); #endif /* GLX_ARB_create_context_robustness */ #ifdef GLX_ARB_fbconfig_float CONST_CAST(GLXEW_ARB_fbconfig_float) = _glewSearchExtension("GLX_ARB_fbconfig_float", extStart, extEnd); #endif /* GLX_ARB_fbconfig_float */ #ifdef GLX_ARB_framebuffer_sRGB CONST_CAST(GLXEW_ARB_framebuffer_sRGB) = _glewSearchExtension("GLX_ARB_framebuffer_sRGB", extStart, extEnd); #endif /* GLX_ARB_framebuffer_sRGB */ #ifdef GLX_ARB_get_proc_address CONST_CAST(GLXEW_ARB_get_proc_address) = _glewSearchExtension("GLX_ARB_get_proc_address", extStart, extEnd); #endif /* GLX_ARB_get_proc_address */ #ifdef GLX_ARB_multisample CONST_CAST(GLXEW_ARB_multisample) = _glewSearchExtension("GLX_ARB_multisample", extStart, extEnd); #endif /* GLX_ARB_multisample */ #ifdef GLX_ARB_robustness_application_isolation CONST_CAST(GLXEW_ARB_robustness_application_isolation) = _glewSearchExtension("GLX_ARB_robustness_application_isolation", extStart, extEnd); #endif /* GLX_ARB_robustness_application_isolation */ #ifdef GLX_ARB_robustness_share_group_isolation CONST_CAST(GLXEW_ARB_robustness_share_group_isolation) = _glewSearchExtension("GLX_ARB_robustness_share_group_isolation", extStart, extEnd); #endif /* GLX_ARB_robustness_share_group_isolation */ #ifdef GLX_ARB_vertex_buffer_object CONST_CAST(GLXEW_ARB_vertex_buffer_object) = _glewSearchExtension("GLX_ARB_vertex_buffer_object", extStart, extEnd); #endif /* GLX_ARB_vertex_buffer_object */ #ifdef GLX_ATI_pixel_format_float CONST_CAST(GLXEW_ATI_pixel_format_float) = _glewSearchExtension("GLX_ATI_pixel_format_float", extStart, extEnd); #endif /* GLX_ATI_pixel_format_float */ #ifdef GLX_ATI_render_texture CONST_CAST(GLXEW_ATI_render_texture) = _glewSearchExtension("GLX_ATI_render_texture", extStart, extEnd); if (glewExperimental || GLXEW_ATI_render_texture) CONST_CAST(GLXEW_ATI_render_texture) = !_glewInit_GLX_ATI_render_texture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_ATI_render_texture */ #ifdef GLX_EXT_create_context_es2_profile CONST_CAST(GLXEW_EXT_create_context_es2_profile) = _glewSearchExtension("GLX_EXT_create_context_es2_profile", extStart, extEnd); #endif /* GLX_EXT_create_context_es2_profile */ #ifdef GLX_EXT_create_context_es_profile CONST_CAST(GLXEW_EXT_create_context_es_profile) = _glewSearchExtension("GLX_EXT_create_context_es_profile", extStart, extEnd); #endif /* GLX_EXT_create_context_es_profile */ #ifdef GLX_EXT_fbconfig_packed_float CONST_CAST(GLXEW_EXT_fbconfig_packed_float) = _glewSearchExtension("GLX_EXT_fbconfig_packed_float", extStart, extEnd); #endif /* GLX_EXT_fbconfig_packed_float */ #ifdef GLX_EXT_framebuffer_sRGB CONST_CAST(GLXEW_EXT_framebuffer_sRGB) = _glewSearchExtension("GLX_EXT_framebuffer_sRGB", extStart, extEnd); #endif /* GLX_EXT_framebuffer_sRGB */ #ifdef GLX_EXT_import_context CONST_CAST(GLXEW_EXT_import_context) = _glewSearchExtension("GLX_EXT_import_context", extStart, extEnd); if (glewExperimental || GLXEW_EXT_import_context) CONST_CAST(GLXEW_EXT_import_context) = !_glewInit_GLX_EXT_import_context(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_EXT_import_context */ #ifdef GLX_EXT_scene_marker CONST_CAST(GLXEW_EXT_scene_marker) = _glewSearchExtension("GLX_EXT_scene_marker", extStart, extEnd); #endif /* GLX_EXT_scene_marker */ #ifdef GLX_EXT_swap_control CONST_CAST(GLXEW_EXT_swap_control) = _glewSearchExtension("GLX_EXT_swap_control", extStart, extEnd); if (glewExperimental || GLXEW_EXT_swap_control) CONST_CAST(GLXEW_EXT_swap_control) = !_glewInit_GLX_EXT_swap_control(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_EXT_swap_control */ #ifdef GLX_EXT_swap_control_tear CONST_CAST(GLXEW_EXT_swap_control_tear) = _glewSearchExtension("GLX_EXT_swap_control_tear", extStart, extEnd); #endif /* GLX_EXT_swap_control_tear */ #ifdef GLX_EXT_texture_from_pixmap CONST_CAST(GLXEW_EXT_texture_from_pixmap) = _glewSearchExtension("GLX_EXT_texture_from_pixmap", extStart, extEnd); if (glewExperimental || GLXEW_EXT_texture_from_pixmap) CONST_CAST(GLXEW_EXT_texture_from_pixmap) = !_glewInit_GLX_EXT_texture_from_pixmap(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_EXT_texture_from_pixmap */ #ifdef GLX_EXT_visual_info CONST_CAST(GLXEW_EXT_visual_info) = _glewSearchExtension("GLX_EXT_visual_info", extStart, extEnd); #endif /* GLX_EXT_visual_info */ #ifdef GLX_EXT_visual_rating CONST_CAST(GLXEW_EXT_visual_rating) = _glewSearchExtension("GLX_EXT_visual_rating", extStart, extEnd); #endif /* GLX_EXT_visual_rating */ #ifdef GLX_INTEL_swap_event CONST_CAST(GLXEW_INTEL_swap_event) = _glewSearchExtension("GLX_INTEL_swap_event", extStart, extEnd); #endif /* GLX_INTEL_swap_event */ #ifdef GLX_MESA_agp_offset CONST_CAST(GLXEW_MESA_agp_offset) = _glewSearchExtension("GLX_MESA_agp_offset", extStart, extEnd); if (glewExperimental || GLXEW_MESA_agp_offset) CONST_CAST(GLXEW_MESA_agp_offset) = !_glewInit_GLX_MESA_agp_offset(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_MESA_agp_offset */ #ifdef GLX_MESA_copy_sub_buffer CONST_CAST(GLXEW_MESA_copy_sub_buffer) = _glewSearchExtension("GLX_MESA_copy_sub_buffer", extStart, extEnd); if (glewExperimental || GLXEW_MESA_copy_sub_buffer) CONST_CAST(GLXEW_MESA_copy_sub_buffer) = !_glewInit_GLX_MESA_copy_sub_buffer(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_MESA_copy_sub_buffer */ #ifdef GLX_MESA_pixmap_colormap CONST_CAST(GLXEW_MESA_pixmap_colormap) = _glewSearchExtension("GLX_MESA_pixmap_colormap", extStart, extEnd); if (glewExperimental || GLXEW_MESA_pixmap_colormap) CONST_CAST(GLXEW_MESA_pixmap_colormap) = !_glewInit_GLX_MESA_pixmap_colormap(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_MESA_pixmap_colormap */ #ifdef GLX_MESA_release_buffers CONST_CAST(GLXEW_MESA_release_buffers) = _glewSearchExtension("GLX_MESA_release_buffers", extStart, extEnd); if (glewExperimental || GLXEW_MESA_release_buffers) CONST_CAST(GLXEW_MESA_release_buffers) = !_glewInit_GLX_MESA_release_buffers(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_MESA_release_buffers */ #ifdef GLX_MESA_set_3dfx_mode CONST_CAST(GLXEW_MESA_set_3dfx_mode) = _glewSearchExtension("GLX_MESA_set_3dfx_mode", extStart, extEnd); if (glewExperimental || GLXEW_MESA_set_3dfx_mode) CONST_CAST(GLXEW_MESA_set_3dfx_mode) = !_glewInit_GLX_MESA_set_3dfx_mode(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_MESA_set_3dfx_mode */ #ifdef GLX_MESA_swap_control CONST_CAST(GLXEW_MESA_swap_control) = _glewSearchExtension("GLX_MESA_swap_control", extStart, extEnd); if (glewExperimental || GLXEW_MESA_swap_control) CONST_CAST(GLXEW_MESA_swap_control) = !_glewInit_GLX_MESA_swap_control(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_MESA_swap_control */ #ifdef GLX_NV_copy_image CONST_CAST(GLXEW_NV_copy_image) = _glewSearchExtension("GLX_NV_copy_image", extStart, extEnd); if (glewExperimental || GLXEW_NV_copy_image) CONST_CAST(GLXEW_NV_copy_image) = !_glewInit_GLX_NV_copy_image(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_NV_copy_image */ #ifdef GLX_NV_float_buffer CONST_CAST(GLXEW_NV_float_buffer) = _glewSearchExtension("GLX_NV_float_buffer", extStart, extEnd); #endif /* GLX_NV_float_buffer */ #ifdef GLX_NV_multisample_coverage CONST_CAST(GLXEW_NV_multisample_coverage) = _glewSearchExtension("GLX_NV_multisample_coverage", extStart, extEnd); #endif /* GLX_NV_multisample_coverage */ #ifdef GLX_NV_present_video CONST_CAST(GLXEW_NV_present_video) = _glewSearchExtension("GLX_NV_present_video", extStart, extEnd); if (glewExperimental || GLXEW_NV_present_video) CONST_CAST(GLXEW_NV_present_video) = !_glewInit_GLX_NV_present_video(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_NV_present_video */ #ifdef GLX_NV_swap_group CONST_CAST(GLXEW_NV_swap_group) = _glewSearchExtension("GLX_NV_swap_group", extStart, extEnd); if (glewExperimental || GLXEW_NV_swap_group) CONST_CAST(GLXEW_NV_swap_group) = !_glewInit_GLX_NV_swap_group(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_NV_swap_group */ #ifdef GLX_NV_vertex_array_range CONST_CAST(GLXEW_NV_vertex_array_range) = _glewSearchExtension("GLX_NV_vertex_array_range", extStart, extEnd); if (glewExperimental || GLXEW_NV_vertex_array_range) CONST_CAST(GLXEW_NV_vertex_array_range) = !_glewInit_GLX_NV_vertex_array_range(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_NV_vertex_array_range */ #ifdef GLX_NV_video_capture CONST_CAST(GLXEW_NV_video_capture) = _glewSearchExtension("GLX_NV_video_capture", extStart, extEnd); if (glewExperimental || GLXEW_NV_video_capture) CONST_CAST(GLXEW_NV_video_capture) = !_glewInit_GLX_NV_video_capture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_NV_video_capture */ #ifdef GLX_NV_video_out CONST_CAST(GLXEW_NV_video_out) = _glewSearchExtension("GLX_NV_video_out", extStart, extEnd); if (glewExperimental || GLXEW_NV_video_out) CONST_CAST(GLXEW_NV_video_out) = !_glewInit_GLX_NV_video_out(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_NV_video_out */ #ifdef GLX_OML_swap_method CONST_CAST(GLXEW_OML_swap_method) = _glewSearchExtension("GLX_OML_swap_method", extStart, extEnd); #endif /* GLX_OML_swap_method */ #ifdef GLX_OML_sync_control CONST_CAST(GLXEW_OML_sync_control) = _glewSearchExtension("GLX_OML_sync_control", extStart, extEnd); if (glewExperimental || GLXEW_OML_sync_control) CONST_CAST(GLXEW_OML_sync_control) = !_glewInit_GLX_OML_sync_control(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_OML_sync_control */ #ifdef GLX_SGIS_blended_overlay CONST_CAST(GLXEW_SGIS_blended_overlay) = _glewSearchExtension("GLX_SGIS_blended_overlay", extStart, extEnd); #endif /* GLX_SGIS_blended_overlay */ #ifdef GLX_SGIS_color_range CONST_CAST(GLXEW_SGIS_color_range) = _glewSearchExtension("GLX_SGIS_color_range", extStart, extEnd); #endif /* GLX_SGIS_color_range */ #ifdef GLX_SGIS_multisample CONST_CAST(GLXEW_SGIS_multisample) = _glewSearchExtension("GLX_SGIS_multisample", extStart, extEnd); #endif /* GLX_SGIS_multisample */ #ifdef GLX_SGIS_shared_multisample CONST_CAST(GLXEW_SGIS_shared_multisample) = _glewSearchExtension("GLX_SGIS_shared_multisample", extStart, extEnd); #endif /* GLX_SGIS_shared_multisample */ #ifdef GLX_SGIX_fbconfig CONST_CAST(GLXEW_SGIX_fbconfig) = _glewSearchExtension("GLX_SGIX_fbconfig", extStart, extEnd); if (glewExperimental || GLXEW_SGIX_fbconfig) CONST_CAST(GLXEW_SGIX_fbconfig) = !_glewInit_GLX_SGIX_fbconfig(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SGIX_fbconfig */ #ifdef GLX_SGIX_hyperpipe CONST_CAST(GLXEW_SGIX_hyperpipe) = _glewSearchExtension("GLX_SGIX_hyperpipe", extStart, extEnd); if (glewExperimental || GLXEW_SGIX_hyperpipe) CONST_CAST(GLXEW_SGIX_hyperpipe) = !_glewInit_GLX_SGIX_hyperpipe(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SGIX_hyperpipe */ #ifdef GLX_SGIX_pbuffer CONST_CAST(GLXEW_SGIX_pbuffer) = _glewSearchExtension("GLX_SGIX_pbuffer", extStart, extEnd); if (glewExperimental || GLXEW_SGIX_pbuffer) CONST_CAST(GLXEW_SGIX_pbuffer) = !_glewInit_GLX_SGIX_pbuffer(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SGIX_pbuffer */ #ifdef GLX_SGIX_swap_barrier CONST_CAST(GLXEW_SGIX_swap_barrier) = _glewSearchExtension("GLX_SGIX_swap_barrier", extStart, extEnd); if (glewExperimental || GLXEW_SGIX_swap_barrier) CONST_CAST(GLXEW_SGIX_swap_barrier) = !_glewInit_GLX_SGIX_swap_barrier(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SGIX_swap_barrier */ #ifdef GLX_SGIX_swap_group CONST_CAST(GLXEW_SGIX_swap_group) = _glewSearchExtension("GLX_SGIX_swap_group", extStart, extEnd); if (glewExperimental || GLXEW_SGIX_swap_group) CONST_CAST(GLXEW_SGIX_swap_group) = !_glewInit_GLX_SGIX_swap_group(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SGIX_swap_group */ #ifdef GLX_SGIX_video_resize CONST_CAST(GLXEW_SGIX_video_resize) = _glewSearchExtension("GLX_SGIX_video_resize", extStart, extEnd); if (glewExperimental || GLXEW_SGIX_video_resize) CONST_CAST(GLXEW_SGIX_video_resize) = !_glewInit_GLX_SGIX_video_resize(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SGIX_video_resize */ #ifdef GLX_SGIX_visual_select_group CONST_CAST(GLXEW_SGIX_visual_select_group) = _glewSearchExtension("GLX_SGIX_visual_select_group", extStart, extEnd); #endif /* GLX_SGIX_visual_select_group */ #ifdef GLX_SGI_cushion CONST_CAST(GLXEW_SGI_cushion) = _glewSearchExtension("GLX_SGI_cushion", extStart, extEnd); if (glewExperimental || GLXEW_SGI_cushion) CONST_CAST(GLXEW_SGI_cushion) = !_glewInit_GLX_SGI_cushion(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SGI_cushion */ #ifdef GLX_SGI_make_current_read CONST_CAST(GLXEW_SGI_make_current_read) = _glewSearchExtension("GLX_SGI_make_current_read", extStart, extEnd); if (glewExperimental || GLXEW_SGI_make_current_read) CONST_CAST(GLXEW_SGI_make_current_read) = !_glewInit_GLX_SGI_make_current_read(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SGI_make_current_read */ #ifdef GLX_SGI_swap_control CONST_CAST(GLXEW_SGI_swap_control) = _glewSearchExtension("GLX_SGI_swap_control", extStart, extEnd); if (glewExperimental || GLXEW_SGI_swap_control) CONST_CAST(GLXEW_SGI_swap_control) = !_glewInit_GLX_SGI_swap_control(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SGI_swap_control */ #ifdef GLX_SGI_video_sync CONST_CAST(GLXEW_SGI_video_sync) = _glewSearchExtension("GLX_SGI_video_sync", extStart, extEnd); if (glewExperimental || GLXEW_SGI_video_sync) CONST_CAST(GLXEW_SGI_video_sync) = !_glewInit_GLX_SGI_video_sync(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SGI_video_sync */ #ifdef GLX_SUN_get_transparent_index CONST_CAST(GLXEW_SUN_get_transparent_index) = _glewSearchExtension("GLX_SUN_get_transparent_index", extStart, extEnd); if (glewExperimental || GLXEW_SUN_get_transparent_index) CONST_CAST(GLXEW_SUN_get_transparent_index) = !_glewInit_GLX_SUN_get_transparent_index(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SUN_get_transparent_index */ #ifdef GLX_SUN_video_resize CONST_CAST(GLXEW_SUN_video_resize) = _glewSearchExtension("GLX_SUN_video_resize", extStart, extEnd); if (glewExperimental || GLXEW_SUN_video_resize) CONST_CAST(GLXEW_SUN_video_resize) = !_glewInit_GLX_SUN_video_resize(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SUN_video_resize */ return GLEW_OK; } #endif /* !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) */ /* ------------------------------------------------------------------------ */ const GLubyte * GLEWAPIENTRY glewGetErrorString (GLenum error) { static const GLubyte* _glewErrorString[] = { (const GLubyte*)"No error", (const GLubyte*)"Missing GL version", (const GLubyte*)"GL 1.1 and up are not supported", (const GLubyte*)"GLX 1.2 and up are not supported", (const GLubyte*)"Unknown error" }; const int max_error = sizeof(_glewErrorString)/sizeof(*_glewErrorString) - 1; return _glewErrorString[(int)error > max_error ? max_error : (int)error]; } const GLubyte * GLEWAPIENTRY glewGetString (GLenum name) { static const GLubyte* _glewString[] = { (const GLubyte*)NULL, (const GLubyte*)"1.9.0", (const GLubyte*)"1", (const GLubyte*)"9", (const GLubyte*)"0" }; const int max_string = sizeof(_glewString)/sizeof(*_glewString) - 1; return _glewString[(int)name > max_string ? 0 : (int)name]; } /* ------------------------------------------------------------------------ */ GLboolean glewExperimental = GL_FALSE; #if !defined(GLEW_MX) #if defined(_WIN32) extern GLenum GLEWAPIENTRY wglewContextInit (void); #elif !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) extern GLenum GLEWAPIENTRY glxewContextInit (void); #endif /* _WIN32 */ GLenum GLEWAPIENTRY glewInit (void) { GLenum r; r = glewContextInit(); if ( r != 0 ) return r; #if defined(_WIN32) return wglewContextInit(); #elif !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) /* _UNIX */ return glxewContextInit(); #else return r; #endif /* _WIN32 */ } #endif /* !GLEW_MX */ #ifdef GLEW_MX GLboolean GLEWAPIENTRY glewContextIsSupported (const GLEWContext* ctx, const char* name) #else GLboolean GLEWAPIENTRY glewIsSupported (const char* name) #endif { GLubyte* pos = (GLubyte*)name; GLuint len = _glewStrLen(pos); GLboolean ret = GL_TRUE; while (ret && len > 0) { if (_glewStrSame1(&pos, &len, (const GLubyte*)"GL_", 3)) { if (_glewStrSame2(&pos, &len, (const GLubyte*)"VERSION_", 8)) { #ifdef GL_VERSION_1_2 if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_2", 3)) { ret = GLEW_VERSION_1_2; continue; } #endif #ifdef GL_VERSION_1_2_1 if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_2_1", 5)) { ret = GLEW_VERSION_1_2_1; continue; } #endif #ifdef GL_VERSION_1_3 if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_3", 3)) { ret = GLEW_VERSION_1_3; continue; } #endif #ifdef GL_VERSION_1_4 if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_4", 3)) { ret = GLEW_VERSION_1_4; continue; } #endif #ifdef GL_VERSION_1_5 if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_5", 3)) { ret = GLEW_VERSION_1_5; continue; } #endif #ifdef GL_VERSION_2_0 if (_glewStrSame3(&pos, &len, (const GLubyte*)"2_0", 3)) { ret = GLEW_VERSION_2_0; continue; } #endif #ifdef GL_VERSION_2_1 if (_glewStrSame3(&pos, &len, (const GLubyte*)"2_1", 3)) { ret = GLEW_VERSION_2_1; continue; } #endif #ifdef GL_VERSION_3_0 if (_glewStrSame3(&pos, &len, (const GLubyte*)"3_0", 3)) { ret = GLEW_VERSION_3_0; continue; } #endif #ifdef GL_VERSION_3_1 if (_glewStrSame3(&pos, &len, (const GLubyte*)"3_1", 3)) { ret = GLEW_VERSION_3_1; continue; } #endif #ifdef GL_VERSION_3_2 if (_glewStrSame3(&pos, &len, (const GLubyte*)"3_2", 3)) { ret = GLEW_VERSION_3_2; continue; } #endif #ifdef GL_VERSION_3_3 if (_glewStrSame3(&pos, &len, (const GLubyte*)"3_3", 3)) { ret = GLEW_VERSION_3_3; continue; } #endif #ifdef GL_VERSION_4_0 if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_0", 3)) { ret = GLEW_VERSION_4_0; continue; } #endif #ifdef GL_VERSION_4_1 if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_1", 3)) { ret = GLEW_VERSION_4_1; continue; } #endif #ifdef GL_VERSION_4_2 if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_2", 3)) { ret = GLEW_VERSION_4_2; continue; } #endif #ifdef GL_VERSION_4_3 if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_3", 3)) { ret = GLEW_VERSION_4_3; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"3DFX_", 5)) { #ifdef GL_3DFX_multisample if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) { ret = GLEW_3DFX_multisample; continue; } #endif #ifdef GL_3DFX_tbuffer if (_glewStrSame3(&pos, &len, (const GLubyte*)"tbuffer", 7)) { ret = GLEW_3DFX_tbuffer; continue; } #endif #ifdef GL_3DFX_texture_compression_FXT1 if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_FXT1", 24)) { ret = GLEW_3DFX_texture_compression_FXT1; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"AMD_", 4)) { #ifdef GL_AMD_blend_minmax_factor if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_minmax_factor", 19)) { ret = GLEW_AMD_blend_minmax_factor; continue; } #endif #ifdef GL_AMD_conservative_depth if (_glewStrSame3(&pos, &len, (const GLubyte*)"conservative_depth", 18)) { ret = GLEW_AMD_conservative_depth; continue; } #endif #ifdef GL_AMD_debug_output if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug_output", 12)) { ret = GLEW_AMD_debug_output; continue; } #endif #ifdef GL_AMD_depth_clamp_separate if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_clamp_separate", 20)) { ret = GLEW_AMD_depth_clamp_separate; continue; } #endif #ifdef GL_AMD_draw_buffers_blend if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers_blend", 18)) { ret = GLEW_AMD_draw_buffers_blend; continue; } #endif #ifdef GL_AMD_multi_draw_indirect if (_glewStrSame3(&pos, &len, (const GLubyte*)"multi_draw_indirect", 19)) { ret = GLEW_AMD_multi_draw_indirect; continue; } #endif #ifdef GL_AMD_name_gen_delete if (_glewStrSame3(&pos, &len, (const GLubyte*)"name_gen_delete", 15)) { ret = GLEW_AMD_name_gen_delete; continue; } #endif #ifdef GL_AMD_performance_monitor if (_glewStrSame3(&pos, &len, (const GLubyte*)"performance_monitor", 19)) { ret = GLEW_AMD_performance_monitor; continue; } #endif #ifdef GL_AMD_pinned_memory if (_glewStrSame3(&pos, &len, (const GLubyte*)"pinned_memory", 13)) { ret = GLEW_AMD_pinned_memory; continue; } #endif #ifdef GL_AMD_query_buffer_object if (_glewStrSame3(&pos, &len, (const GLubyte*)"query_buffer_object", 19)) { ret = GLEW_AMD_query_buffer_object; continue; } #endif #ifdef GL_AMD_sample_positions if (_glewStrSame3(&pos, &len, (const GLubyte*)"sample_positions", 16)) { ret = GLEW_AMD_sample_positions; continue; } #endif #ifdef GL_AMD_seamless_cubemap_per_texture if (_glewStrSame3(&pos, &len, (const GLubyte*)"seamless_cubemap_per_texture", 28)) { ret = GLEW_AMD_seamless_cubemap_per_texture; continue; } #endif #ifdef GL_AMD_shader_stencil_export if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_stencil_export", 21)) { ret = GLEW_AMD_shader_stencil_export; continue; } #endif #ifdef GL_AMD_stencil_operation_extended if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_operation_extended", 26)) { ret = GLEW_AMD_stencil_operation_extended; continue; } #endif #ifdef GL_AMD_texture_texture4 if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_texture4", 16)) { ret = GLEW_AMD_texture_texture4; continue; } #endif #ifdef GL_AMD_transform_feedback3_lines_triangles if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback3_lines_triangles", 35)) { ret = GLEW_AMD_transform_feedback3_lines_triangles; continue; } #endif #ifdef GL_AMD_vertex_shader_layer if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader_layer", 19)) { ret = GLEW_AMD_vertex_shader_layer; continue; } #endif #ifdef GL_AMD_vertex_shader_tessellator if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader_tessellator", 25)) { ret = GLEW_AMD_vertex_shader_tessellator; continue; } #endif #ifdef GL_AMD_vertex_shader_viewport_index if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader_viewport_index", 28)) { ret = GLEW_AMD_vertex_shader_viewport_index; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"APPLE_", 6)) { #ifdef GL_APPLE_aux_depth_stencil if (_glewStrSame3(&pos, &len, (const GLubyte*)"aux_depth_stencil", 17)) { ret = GLEW_APPLE_aux_depth_stencil; continue; } #endif #ifdef GL_APPLE_client_storage if (_glewStrSame3(&pos, &len, (const GLubyte*)"client_storage", 14)) { ret = GLEW_APPLE_client_storage; continue; } #endif #ifdef GL_APPLE_element_array if (_glewStrSame3(&pos, &len, (const GLubyte*)"element_array", 13)) { ret = GLEW_APPLE_element_array; continue; } #endif #ifdef GL_APPLE_fence if (_glewStrSame3(&pos, &len, (const GLubyte*)"fence", 5)) { ret = GLEW_APPLE_fence; continue; } #endif #ifdef GL_APPLE_float_pixels if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_pixels", 12)) { ret = GLEW_APPLE_float_pixels; continue; } #endif #ifdef GL_APPLE_flush_buffer_range if (_glewStrSame3(&pos, &len, (const GLubyte*)"flush_buffer_range", 18)) { ret = GLEW_APPLE_flush_buffer_range; continue; } #endif #ifdef GL_APPLE_object_purgeable if (_glewStrSame3(&pos, &len, (const GLubyte*)"object_purgeable", 16)) { ret = GLEW_APPLE_object_purgeable; continue; } #endif #ifdef GL_APPLE_pixel_buffer if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_buffer", 12)) { ret = GLEW_APPLE_pixel_buffer; continue; } #endif #ifdef GL_APPLE_rgb_422 if (_glewStrSame3(&pos, &len, (const GLubyte*)"rgb_422", 7)) { ret = GLEW_APPLE_rgb_422; continue; } #endif #ifdef GL_APPLE_row_bytes if (_glewStrSame3(&pos, &len, (const GLubyte*)"row_bytes", 9)) { ret = GLEW_APPLE_row_bytes; continue; } #endif #ifdef GL_APPLE_specular_vector if (_glewStrSame3(&pos, &len, (const GLubyte*)"specular_vector", 15)) { ret = GLEW_APPLE_specular_vector; continue; } #endif #ifdef GL_APPLE_texture_range if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_range", 13)) { ret = GLEW_APPLE_texture_range; continue; } #endif #ifdef GL_APPLE_transform_hint if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_hint", 14)) { ret = GLEW_APPLE_transform_hint; continue; } #endif #ifdef GL_APPLE_vertex_array_object if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_object", 19)) { ret = GLEW_APPLE_vertex_array_object; continue; } #endif #ifdef GL_APPLE_vertex_array_range if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18)) { ret = GLEW_APPLE_vertex_array_range; continue; } #endif #ifdef GL_APPLE_vertex_program_evaluators if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program_evaluators", 25)) { ret = GLEW_APPLE_vertex_program_evaluators; continue; } #endif #ifdef GL_APPLE_ycbcr_422 if (_glewStrSame3(&pos, &len, (const GLubyte*)"ycbcr_422", 9)) { ret = GLEW_APPLE_ycbcr_422; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"ARB_", 4)) { #ifdef GL_ARB_ES2_compatibility if (_glewStrSame3(&pos, &len, (const GLubyte*)"ES2_compatibility", 17)) { ret = GLEW_ARB_ES2_compatibility; continue; } #endif #ifdef GL_ARB_ES3_compatibility if (_glewStrSame3(&pos, &len, (const GLubyte*)"ES3_compatibility", 17)) { ret = GLEW_ARB_ES3_compatibility; continue; } #endif #ifdef GL_ARB_arrays_of_arrays if (_glewStrSame3(&pos, &len, (const GLubyte*)"arrays_of_arrays", 16)) { ret = GLEW_ARB_arrays_of_arrays; continue; } #endif #ifdef GL_ARB_base_instance if (_glewStrSame3(&pos, &len, (const GLubyte*)"base_instance", 13)) { ret = GLEW_ARB_base_instance; continue; } #endif #ifdef GL_ARB_blend_func_extended if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_func_extended", 19)) { ret = GLEW_ARB_blend_func_extended; continue; } #endif #ifdef GL_ARB_cl_event if (_glewStrSame3(&pos, &len, (const GLubyte*)"cl_event", 8)) { ret = GLEW_ARB_cl_event; continue; } #endif #ifdef GL_ARB_clear_buffer_object if (_glewStrSame3(&pos, &len, (const GLubyte*)"clear_buffer_object", 19)) { ret = GLEW_ARB_clear_buffer_object; continue; } #endif #ifdef GL_ARB_color_buffer_float if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_buffer_float", 18)) { ret = GLEW_ARB_color_buffer_float; continue; } #endif #ifdef GL_ARB_compatibility if (_glewStrSame3(&pos, &len, (const GLubyte*)"compatibility", 13)) { ret = GLEW_ARB_compatibility; continue; } #endif #ifdef GL_ARB_compressed_texture_pixel_storage if (_glewStrSame3(&pos, &len, (const GLubyte*)"compressed_texture_pixel_storage", 32)) { ret = GLEW_ARB_compressed_texture_pixel_storage; continue; } #endif #ifdef GL_ARB_compute_shader if (_glewStrSame3(&pos, &len, (const GLubyte*)"compute_shader", 14)) { ret = GLEW_ARB_compute_shader; continue; } #endif #ifdef GL_ARB_conservative_depth if (_glewStrSame3(&pos, &len, (const GLubyte*)"conservative_depth", 18)) { ret = GLEW_ARB_conservative_depth; continue; } #endif #ifdef GL_ARB_copy_buffer if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_buffer", 11)) { ret = GLEW_ARB_copy_buffer; continue; } #endif #ifdef GL_ARB_copy_image if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_image", 10)) { ret = GLEW_ARB_copy_image; continue; } #endif #ifdef GL_ARB_debug_output if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug_output", 12)) { ret = GLEW_ARB_debug_output; continue; } #endif #ifdef GL_ARB_depth_buffer_float if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_buffer_float", 18)) { ret = GLEW_ARB_depth_buffer_float; continue; } #endif #ifdef GL_ARB_depth_clamp if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_clamp", 11)) { ret = GLEW_ARB_depth_clamp; continue; } #endif #ifdef GL_ARB_depth_texture if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_texture", 13)) { ret = GLEW_ARB_depth_texture; continue; } #endif #ifdef GL_ARB_draw_buffers if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers", 12)) { ret = GLEW_ARB_draw_buffers; continue; } #endif #ifdef GL_ARB_draw_buffers_blend if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers_blend", 18)) { ret = GLEW_ARB_draw_buffers_blend; continue; } #endif #ifdef GL_ARB_draw_elements_base_vertex if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_elements_base_vertex", 25)) { ret = GLEW_ARB_draw_elements_base_vertex; continue; } #endif #ifdef GL_ARB_draw_indirect if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_indirect", 13)) { ret = GLEW_ARB_draw_indirect; continue; } #endif #ifdef GL_ARB_draw_instanced if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_instanced", 14)) { ret = GLEW_ARB_draw_instanced; continue; } #endif #ifdef GL_ARB_explicit_attrib_location if (_glewStrSame3(&pos, &len, (const GLubyte*)"explicit_attrib_location", 24)) { ret = GLEW_ARB_explicit_attrib_location; continue; } #endif #ifdef GL_ARB_explicit_uniform_location if (_glewStrSame3(&pos, &len, (const GLubyte*)"explicit_uniform_location", 25)) { ret = GLEW_ARB_explicit_uniform_location; continue; } #endif #ifdef GL_ARB_fragment_coord_conventions if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_coord_conventions", 26)) { ret = GLEW_ARB_fragment_coord_conventions; continue; } #endif #ifdef GL_ARB_fragment_layer_viewport if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_layer_viewport", 23)) { ret = GLEW_ARB_fragment_layer_viewport; continue; } #endif #ifdef GL_ARB_fragment_program if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program", 16)) { ret = GLEW_ARB_fragment_program; continue; } #endif #ifdef GL_ARB_fragment_program_shadow if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program_shadow", 23)) { ret = GLEW_ARB_fragment_program_shadow; continue; } #endif #ifdef GL_ARB_fragment_shader if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader", 15)) { ret = GLEW_ARB_fragment_shader; continue; } #endif #ifdef GL_ARB_framebuffer_no_attachments if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_no_attachments", 26)) { ret = GLEW_ARB_framebuffer_no_attachments; continue; } #endif #ifdef GL_ARB_framebuffer_object if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_object", 18)) { ret = GLEW_ARB_framebuffer_object; continue; } #endif #ifdef GL_ARB_framebuffer_sRGB if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) { ret = GLEW_ARB_framebuffer_sRGB; continue; } #endif #ifdef GL_ARB_geometry_shader4 if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_shader4", 16)) { ret = GLEW_ARB_geometry_shader4; continue; } #endif #ifdef GL_ARB_get_program_binary if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_program_binary", 18)) { ret = GLEW_ARB_get_program_binary; continue; } #endif #ifdef GL_ARB_gpu_shader5 if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader5", 11)) { ret = GLEW_ARB_gpu_shader5; continue; } #endif #ifdef GL_ARB_gpu_shader_fp64 if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader_fp64", 15)) { ret = GLEW_ARB_gpu_shader_fp64; continue; } #endif #ifdef GL_ARB_half_float_pixel if (_glewStrSame3(&pos, &len, (const GLubyte*)"half_float_pixel", 16)) { ret = GLEW_ARB_half_float_pixel; continue; } #endif #ifdef GL_ARB_half_float_vertex if (_glewStrSame3(&pos, &len, (const GLubyte*)"half_float_vertex", 17)) { ret = GLEW_ARB_half_float_vertex; continue; } #endif #ifdef GL_ARB_imaging if (_glewStrSame3(&pos, &len, (const GLubyte*)"imaging", 7)) { ret = GLEW_ARB_imaging; continue; } #endif #ifdef GL_ARB_instanced_arrays if (_glewStrSame3(&pos, &len, (const GLubyte*)"instanced_arrays", 16)) { ret = GLEW_ARB_instanced_arrays; continue; } #endif #ifdef GL_ARB_internalformat_query if (_glewStrSame3(&pos, &len, (const GLubyte*)"internalformat_query", 20)) { ret = GLEW_ARB_internalformat_query; continue; } #endif #ifdef GL_ARB_internalformat_query2 if (_glewStrSame3(&pos, &len, (const GLubyte*)"internalformat_query2", 21)) { ret = GLEW_ARB_internalformat_query2; continue; } #endif #ifdef GL_ARB_invalidate_subdata if (_glewStrSame3(&pos, &len, (const GLubyte*)"invalidate_subdata", 18)) { ret = GLEW_ARB_invalidate_subdata; continue; } #endif #ifdef GL_ARB_map_buffer_alignment if (_glewStrSame3(&pos, &len, (const GLubyte*)"map_buffer_alignment", 20)) { ret = GLEW_ARB_map_buffer_alignment; continue; } #endif #ifdef GL_ARB_map_buffer_range if (_glewStrSame3(&pos, &len, (const GLubyte*)"map_buffer_range", 16)) { ret = GLEW_ARB_map_buffer_range; continue; } #endif #ifdef GL_ARB_matrix_palette if (_glewStrSame3(&pos, &len, (const GLubyte*)"matrix_palette", 14)) { ret = GLEW_ARB_matrix_palette; continue; } #endif #ifdef GL_ARB_multi_draw_indirect if (_glewStrSame3(&pos, &len, (const GLubyte*)"multi_draw_indirect", 19)) { ret = GLEW_ARB_multi_draw_indirect; continue; } #endif #ifdef GL_ARB_multisample if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) { ret = GLEW_ARB_multisample; continue; } #endif #ifdef GL_ARB_multitexture if (_glewStrSame3(&pos, &len, (const GLubyte*)"multitexture", 12)) { ret = GLEW_ARB_multitexture; continue; } #endif #ifdef GL_ARB_occlusion_query if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_query", 15)) { ret = GLEW_ARB_occlusion_query; continue; } #endif #ifdef GL_ARB_occlusion_query2 if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_query2", 16)) { ret = GLEW_ARB_occlusion_query2; continue; } #endif #ifdef GL_ARB_pixel_buffer_object if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_buffer_object", 19)) { ret = GLEW_ARB_pixel_buffer_object; continue; } #endif #ifdef GL_ARB_point_parameters if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_parameters", 16)) { ret = GLEW_ARB_point_parameters; continue; } #endif #ifdef GL_ARB_point_sprite if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_sprite", 12)) { ret = GLEW_ARB_point_sprite; continue; } #endif #ifdef GL_ARB_program_interface_query if (_glewStrSame3(&pos, &len, (const GLubyte*)"program_interface_query", 23)) { ret = GLEW_ARB_program_interface_query; continue; } #endif #ifdef GL_ARB_provoking_vertex if (_glewStrSame3(&pos, &len, (const GLubyte*)"provoking_vertex", 16)) { ret = GLEW_ARB_provoking_vertex; continue; } #endif #ifdef GL_ARB_robust_buffer_access_behavior if (_glewStrSame3(&pos, &len, (const GLubyte*)"robust_buffer_access_behavior", 29)) { ret = GLEW_ARB_robust_buffer_access_behavior; continue; } #endif #ifdef GL_ARB_robustness if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness", 10)) { ret = GLEW_ARB_robustness; continue; } #endif #ifdef GL_ARB_robustness_application_isolation if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_application_isolation", 32)) { ret = GLEW_ARB_robustness_application_isolation; continue; } #endif #ifdef GL_ARB_robustness_share_group_isolation if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_share_group_isolation", 32)) { ret = GLEW_ARB_robustness_share_group_isolation; continue; } #endif #ifdef GL_ARB_sample_shading if (_glewStrSame3(&pos, &len, (const GLubyte*)"sample_shading", 14)) { ret = GLEW_ARB_sample_shading; continue; } #endif #ifdef GL_ARB_sampler_objects if (_glewStrSame3(&pos, &len, (const GLubyte*)"sampler_objects", 15)) { ret = GLEW_ARB_sampler_objects; continue; } #endif #ifdef GL_ARB_seamless_cube_map if (_glewStrSame3(&pos, &len, (const GLubyte*)"seamless_cube_map", 17)) { ret = GLEW_ARB_seamless_cube_map; continue; } #endif #ifdef GL_ARB_separate_shader_objects if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_shader_objects", 23)) { ret = GLEW_ARB_separate_shader_objects; continue; } #endif #ifdef GL_ARB_shader_atomic_counters if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_counters", 22)) { ret = GLEW_ARB_shader_atomic_counters; continue; } #endif #ifdef GL_ARB_shader_bit_encoding if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_bit_encoding", 19)) { ret = GLEW_ARB_shader_bit_encoding; continue; } #endif #ifdef GL_ARB_shader_image_load_store if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_image_load_store", 23)) { ret = GLEW_ARB_shader_image_load_store; continue; } #endif #ifdef GL_ARB_shader_image_size if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_image_size", 17)) { ret = GLEW_ARB_shader_image_size; continue; } #endif #ifdef GL_ARB_shader_objects if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_objects", 14)) { ret = GLEW_ARB_shader_objects; continue; } #endif #ifdef GL_ARB_shader_precision if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_precision", 16)) { ret = GLEW_ARB_shader_precision; continue; } #endif #ifdef GL_ARB_shader_stencil_export if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_stencil_export", 21)) { ret = GLEW_ARB_shader_stencil_export; continue; } #endif #ifdef GL_ARB_shader_storage_buffer_object if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_storage_buffer_object", 28)) { ret = GLEW_ARB_shader_storage_buffer_object; continue; } #endif #ifdef GL_ARB_shader_subroutine if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_subroutine", 17)) { ret = GLEW_ARB_shader_subroutine; continue; } #endif #ifdef GL_ARB_shader_texture_lod if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_texture_lod", 18)) { ret = GLEW_ARB_shader_texture_lod; continue; } #endif #ifdef GL_ARB_shading_language_100 if (_glewStrSame3(&pos, &len, (const GLubyte*)"shading_language_100", 20)) { ret = GLEW_ARB_shading_language_100; continue; } #endif #ifdef GL_ARB_shading_language_420pack if (_glewStrSame3(&pos, &len, (const GLubyte*)"shading_language_420pack", 24)) { ret = GLEW_ARB_shading_language_420pack; continue; } #endif #ifdef GL_ARB_shading_language_include if (_glewStrSame3(&pos, &len, (const GLubyte*)"shading_language_include", 24)) { ret = GLEW_ARB_shading_language_include; continue; } #endif #ifdef GL_ARB_shading_language_packing if (_glewStrSame3(&pos, &len, (const GLubyte*)"shading_language_packing", 24)) { ret = GLEW_ARB_shading_language_packing; continue; } #endif #ifdef GL_ARB_shadow if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow", 6)) { ret = GLEW_ARB_shadow; continue; } #endif #ifdef GL_ARB_shadow_ambient if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow_ambient", 14)) { ret = GLEW_ARB_shadow_ambient; continue; } #endif #ifdef GL_ARB_stencil_texturing if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_texturing", 17)) { ret = GLEW_ARB_stencil_texturing; continue; } #endif #ifdef GL_ARB_sync if (_glewStrSame3(&pos, &len, (const GLubyte*)"sync", 4)) { ret = GLEW_ARB_sync; continue; } #endif #ifdef GL_ARB_tessellation_shader if (_glewStrSame3(&pos, &len, (const GLubyte*)"tessellation_shader", 19)) { ret = GLEW_ARB_tessellation_shader; continue; } #endif #ifdef GL_ARB_texture_border_clamp if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_border_clamp", 20)) { ret = GLEW_ARB_texture_border_clamp; continue; } #endif #ifdef GL_ARB_texture_buffer_object if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_buffer_object", 21)) { ret = GLEW_ARB_texture_buffer_object; continue; } #endif #ifdef GL_ARB_texture_buffer_object_rgb32 if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_buffer_object_rgb32", 27)) { ret = GLEW_ARB_texture_buffer_object_rgb32; continue; } #endif #ifdef GL_ARB_texture_buffer_range if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_buffer_range", 20)) { ret = GLEW_ARB_texture_buffer_range; continue; } #endif #ifdef GL_ARB_texture_compression if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression", 19)) { ret = GLEW_ARB_texture_compression; continue; } #endif #ifdef GL_ARB_texture_compression_bptc if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_bptc", 24)) { ret = GLEW_ARB_texture_compression_bptc; continue; } #endif #ifdef GL_ARB_texture_compression_rgtc if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_rgtc", 24)) { ret = GLEW_ARB_texture_compression_rgtc; continue; } #endif #ifdef GL_ARB_texture_cube_map if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_cube_map", 16)) { ret = GLEW_ARB_texture_cube_map; continue; } #endif #ifdef GL_ARB_texture_cube_map_array if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_cube_map_array", 22)) { ret = GLEW_ARB_texture_cube_map_array; continue; } #endif #ifdef GL_ARB_texture_env_add if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_add", 15)) { ret = GLEW_ARB_texture_env_add; continue; } #endif #ifdef GL_ARB_texture_env_combine if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine", 19)) { ret = GLEW_ARB_texture_env_combine; continue; } #endif #ifdef GL_ARB_texture_env_crossbar if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_crossbar", 20)) { ret = GLEW_ARB_texture_env_crossbar; continue; } #endif #ifdef GL_ARB_texture_env_dot3 if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_dot3", 16)) { ret = GLEW_ARB_texture_env_dot3; continue; } #endif #ifdef GL_ARB_texture_float if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_float", 13)) { ret = GLEW_ARB_texture_float; continue; } #endif #ifdef GL_ARB_texture_gather if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_gather", 14)) { ret = GLEW_ARB_texture_gather; continue; } #endif #ifdef GL_ARB_texture_mirrored_repeat if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirrored_repeat", 23)) { ret = GLEW_ARB_texture_mirrored_repeat; continue; } #endif #ifdef GL_ARB_texture_multisample if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_multisample", 19)) { ret = GLEW_ARB_texture_multisample; continue; } #endif #ifdef GL_ARB_texture_non_power_of_two if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_non_power_of_two", 24)) { ret = GLEW_ARB_texture_non_power_of_two; continue; } #endif #ifdef GL_ARB_texture_query_levels if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_query_levels", 20)) { ret = GLEW_ARB_texture_query_levels; continue; } #endif #ifdef GL_ARB_texture_query_lod if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_query_lod", 17)) { ret = GLEW_ARB_texture_query_lod; continue; } #endif #ifdef GL_ARB_texture_rectangle if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rectangle", 17)) { ret = GLEW_ARB_texture_rectangle; continue; } #endif #ifdef GL_ARB_texture_rg if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rg", 10)) { ret = GLEW_ARB_texture_rg; continue; } #endif #ifdef GL_ARB_texture_rgb10_a2ui if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rgb10_a2ui", 18)) { ret = GLEW_ARB_texture_rgb10_a2ui; continue; } #endif #ifdef GL_ARB_texture_storage if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_storage", 15)) { ret = GLEW_ARB_texture_storage; continue; } #endif #ifdef GL_ARB_texture_storage_multisample if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_storage_multisample", 27)) { ret = GLEW_ARB_texture_storage_multisample; continue; } #endif #ifdef GL_ARB_texture_swizzle if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_swizzle", 15)) { ret = GLEW_ARB_texture_swizzle; continue; } #endif #ifdef GL_ARB_texture_view if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_view", 12)) { ret = GLEW_ARB_texture_view; continue; } #endif #ifdef GL_ARB_timer_query if (_glewStrSame3(&pos, &len, (const GLubyte*)"timer_query", 11)) { ret = GLEW_ARB_timer_query; continue; } #endif #ifdef GL_ARB_transform_feedback2 if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback2", 19)) { ret = GLEW_ARB_transform_feedback2; continue; } #endif #ifdef GL_ARB_transform_feedback3 if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback3", 19)) { ret = GLEW_ARB_transform_feedback3; continue; } #endif #ifdef GL_ARB_transform_feedback_instanced if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback_instanced", 28)) { ret = GLEW_ARB_transform_feedback_instanced; continue; } #endif #ifdef GL_ARB_transpose_matrix if (_glewStrSame3(&pos, &len, (const GLubyte*)"transpose_matrix", 16)) { ret = GLEW_ARB_transpose_matrix; continue; } #endif #ifdef GL_ARB_uniform_buffer_object if (_glewStrSame3(&pos, &len, (const GLubyte*)"uniform_buffer_object", 21)) { ret = GLEW_ARB_uniform_buffer_object; continue; } #endif #ifdef GL_ARB_vertex_array_bgra if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_bgra", 17)) { ret = GLEW_ARB_vertex_array_bgra; continue; } #endif #ifdef GL_ARB_vertex_array_object if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_object", 19)) { ret = GLEW_ARB_vertex_array_object; continue; } #endif #ifdef GL_ARB_vertex_attrib_64bit if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_64bit", 19)) { ret = GLEW_ARB_vertex_attrib_64bit; continue; } #endif #ifdef GL_ARB_vertex_attrib_binding if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_binding", 21)) { ret = GLEW_ARB_vertex_attrib_binding; continue; } #endif #ifdef GL_ARB_vertex_blend if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_blend", 12)) { ret = GLEW_ARB_vertex_blend; continue; } #endif #ifdef GL_ARB_vertex_buffer_object if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_buffer_object", 20)) { ret = GLEW_ARB_vertex_buffer_object; continue; } #endif #ifdef GL_ARB_vertex_program if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program", 14)) { ret = GLEW_ARB_vertex_program; continue; } #endif #ifdef GL_ARB_vertex_shader if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader", 13)) { ret = GLEW_ARB_vertex_shader; continue; } #endif #ifdef GL_ARB_vertex_type_2_10_10_10_rev if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_type_2_10_10_10_rev", 26)) { ret = GLEW_ARB_vertex_type_2_10_10_10_rev; continue; } #endif #ifdef GL_ARB_viewport_array if (_glewStrSame3(&pos, &len, (const GLubyte*)"viewport_array", 14)) { ret = GLEW_ARB_viewport_array; continue; } #endif #ifdef GL_ARB_window_pos if (_glewStrSame3(&pos, &len, (const GLubyte*)"window_pos", 10)) { ret = GLEW_ARB_window_pos; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"ATIX_", 5)) { #ifdef GL_ATIX_point_sprites if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_sprites", 13)) { ret = GLEW_ATIX_point_sprites; continue; } #endif #ifdef GL_ATIX_texture_env_combine3 if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine3", 20)) { ret = GLEW_ATIX_texture_env_combine3; continue; } #endif #ifdef GL_ATIX_texture_env_route if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_route", 17)) { ret = GLEW_ATIX_texture_env_route; continue; } #endif #ifdef GL_ATIX_vertex_shader_output_point_size if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader_output_point_size", 31)) { ret = GLEW_ATIX_vertex_shader_output_point_size; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"ATI_", 4)) { #ifdef GL_ATI_draw_buffers if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers", 12)) { ret = GLEW_ATI_draw_buffers; continue; } #endif #ifdef GL_ATI_element_array if (_glewStrSame3(&pos, &len, (const GLubyte*)"element_array", 13)) { ret = GLEW_ATI_element_array; continue; } #endif #ifdef GL_ATI_envmap_bumpmap if (_glewStrSame3(&pos, &len, (const GLubyte*)"envmap_bumpmap", 14)) { ret = GLEW_ATI_envmap_bumpmap; continue; } #endif #ifdef GL_ATI_fragment_shader if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader", 15)) { ret = GLEW_ATI_fragment_shader; continue; } #endif #ifdef GL_ATI_map_object_buffer if (_glewStrSame3(&pos, &len, (const GLubyte*)"map_object_buffer", 17)) { ret = GLEW_ATI_map_object_buffer; continue; } #endif #ifdef GL_ATI_meminfo if (_glewStrSame3(&pos, &len, (const GLubyte*)"meminfo", 7)) { ret = GLEW_ATI_meminfo; continue; } #endif #ifdef GL_ATI_pn_triangles if (_glewStrSame3(&pos, &len, (const GLubyte*)"pn_triangles", 12)) { ret = GLEW_ATI_pn_triangles; continue; } #endif #ifdef GL_ATI_separate_stencil if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_stencil", 16)) { ret = GLEW_ATI_separate_stencil; continue; } #endif #ifdef GL_ATI_shader_texture_lod if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_texture_lod", 18)) { ret = GLEW_ATI_shader_texture_lod; continue; } #endif #ifdef GL_ATI_text_fragment_shader if (_glewStrSame3(&pos, &len, (const GLubyte*)"text_fragment_shader", 20)) { ret = GLEW_ATI_text_fragment_shader; continue; } #endif #ifdef GL_ATI_texture_compression_3dc if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_3dc", 23)) { ret = GLEW_ATI_texture_compression_3dc; continue; } #endif #ifdef GL_ATI_texture_env_combine3 if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine3", 20)) { ret = GLEW_ATI_texture_env_combine3; continue; } #endif #ifdef GL_ATI_texture_float if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_float", 13)) { ret = GLEW_ATI_texture_float; continue; } #endif #ifdef GL_ATI_texture_mirror_once if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirror_once", 19)) { ret = GLEW_ATI_texture_mirror_once; continue; } #endif #ifdef GL_ATI_vertex_array_object if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_object", 19)) { ret = GLEW_ATI_vertex_array_object; continue; } #endif #ifdef GL_ATI_vertex_attrib_array_object if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_array_object", 26)) { ret = GLEW_ATI_vertex_attrib_array_object; continue; } #endif #ifdef GL_ATI_vertex_streams if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_streams", 14)) { ret = GLEW_ATI_vertex_streams; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"EXT_", 4)) { #ifdef GL_EXT_422_pixels if (_glewStrSame3(&pos, &len, (const GLubyte*)"422_pixels", 10)) { ret = GLEW_EXT_422_pixels; continue; } #endif #ifdef GL_EXT_Cg_shader if (_glewStrSame3(&pos, &len, (const GLubyte*)"Cg_shader", 9)) { ret = GLEW_EXT_Cg_shader; continue; } #endif #ifdef GL_EXT_abgr if (_glewStrSame3(&pos, &len, (const GLubyte*)"abgr", 4)) { ret = GLEW_EXT_abgr; continue; } #endif #ifdef GL_EXT_bgra if (_glewStrSame3(&pos, &len, (const GLubyte*)"bgra", 4)) { ret = GLEW_EXT_bgra; continue; } #endif #ifdef GL_EXT_bindable_uniform if (_glewStrSame3(&pos, &len, (const GLubyte*)"bindable_uniform", 16)) { ret = GLEW_EXT_bindable_uniform; continue; } #endif #ifdef GL_EXT_blend_color if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_color", 11)) { ret = GLEW_EXT_blend_color; continue; } #endif #ifdef GL_EXT_blend_equation_separate if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_equation_separate", 23)) { ret = GLEW_EXT_blend_equation_separate; continue; } #endif #ifdef GL_EXT_blend_func_separate if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_func_separate", 19)) { ret = GLEW_EXT_blend_func_separate; continue; } #endif #ifdef GL_EXT_blend_logic_op if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_logic_op", 14)) { ret = GLEW_EXT_blend_logic_op; continue; } #endif #ifdef GL_EXT_blend_minmax if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_minmax", 12)) { ret = GLEW_EXT_blend_minmax; continue; } #endif #ifdef GL_EXT_blend_subtract if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_subtract", 14)) { ret = GLEW_EXT_blend_subtract; continue; } #endif #ifdef GL_EXT_clip_volume_hint if (_glewStrSame3(&pos, &len, (const GLubyte*)"clip_volume_hint", 16)) { ret = GLEW_EXT_clip_volume_hint; continue; } #endif #ifdef GL_EXT_cmyka if (_glewStrSame3(&pos, &len, (const GLubyte*)"cmyka", 5)) { ret = GLEW_EXT_cmyka; continue; } #endif #ifdef GL_EXT_color_subtable if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_subtable", 14)) { ret = GLEW_EXT_color_subtable; continue; } #endif #ifdef GL_EXT_compiled_vertex_array if (_glewStrSame3(&pos, &len, (const GLubyte*)"compiled_vertex_array", 21)) { ret = GLEW_EXT_compiled_vertex_array; continue; } #endif #ifdef GL_EXT_convolution if (_glewStrSame3(&pos, &len, (const GLubyte*)"convolution", 11)) { ret = GLEW_EXT_convolution; continue; } #endif #ifdef GL_EXT_coordinate_frame if (_glewStrSame3(&pos, &len, (const GLubyte*)"coordinate_frame", 16)) { ret = GLEW_EXT_coordinate_frame; continue; } #endif #ifdef GL_EXT_copy_texture if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_texture", 12)) { ret = GLEW_EXT_copy_texture; continue; } #endif #ifdef GL_EXT_cull_vertex if (_glewStrSame3(&pos, &len, (const GLubyte*)"cull_vertex", 11)) { ret = GLEW_EXT_cull_vertex; continue; } #endif #ifdef GL_EXT_debug_marker if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug_marker", 12)) { ret = GLEW_EXT_debug_marker; continue; } #endif #ifdef GL_EXT_depth_bounds_test if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_bounds_test", 17)) { ret = GLEW_EXT_depth_bounds_test; continue; } #endif #ifdef GL_EXT_direct_state_access if (_glewStrSame3(&pos, &len, (const GLubyte*)"direct_state_access", 19)) { ret = GLEW_EXT_direct_state_access; continue; } #endif #ifdef GL_EXT_draw_buffers2 if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers2", 13)) { ret = GLEW_EXT_draw_buffers2; continue; } #endif #ifdef GL_EXT_draw_instanced if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_instanced", 14)) { ret = GLEW_EXT_draw_instanced; continue; } #endif #ifdef GL_EXT_draw_range_elements if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_range_elements", 19)) { ret = GLEW_EXT_draw_range_elements; continue; } #endif #ifdef GL_EXT_fog_coord if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_coord", 9)) { ret = GLEW_EXT_fog_coord; continue; } #endif #ifdef GL_EXT_fragment_lighting if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_lighting", 17)) { ret = GLEW_EXT_fragment_lighting; continue; } #endif #ifdef GL_EXT_framebuffer_blit if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_blit", 16)) { ret = GLEW_EXT_framebuffer_blit; continue; } #endif #ifdef GL_EXT_framebuffer_multisample if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_multisample", 23)) { ret = GLEW_EXT_framebuffer_multisample; continue; } #endif #ifdef GL_EXT_framebuffer_multisample_blit_scaled if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_multisample_blit_scaled", 35)) { ret = GLEW_EXT_framebuffer_multisample_blit_scaled; continue; } #endif #ifdef GL_EXT_framebuffer_object if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_object", 18)) { ret = GLEW_EXT_framebuffer_object; continue; } #endif #ifdef GL_EXT_framebuffer_sRGB if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) { ret = GLEW_EXT_framebuffer_sRGB; continue; } #endif #ifdef GL_EXT_geometry_shader4 if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_shader4", 16)) { ret = GLEW_EXT_geometry_shader4; continue; } #endif #ifdef GL_EXT_gpu_program_parameters if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program_parameters", 22)) { ret = GLEW_EXT_gpu_program_parameters; continue; } #endif #ifdef GL_EXT_gpu_shader4 if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader4", 11)) { ret = GLEW_EXT_gpu_shader4; continue; } #endif #ifdef GL_EXT_histogram if (_glewStrSame3(&pos, &len, (const GLubyte*)"histogram", 9)) { ret = GLEW_EXT_histogram; continue; } #endif #ifdef GL_EXT_index_array_formats if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_array_formats", 19)) { ret = GLEW_EXT_index_array_formats; continue; } #endif #ifdef GL_EXT_index_func if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_func", 10)) { ret = GLEW_EXT_index_func; continue; } #endif #ifdef GL_EXT_index_material if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_material", 14)) { ret = GLEW_EXT_index_material; continue; } #endif #ifdef GL_EXT_index_texture if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_texture", 13)) { ret = GLEW_EXT_index_texture; continue; } #endif #ifdef GL_EXT_light_texture if (_glewStrSame3(&pos, &len, (const GLubyte*)"light_texture", 13)) { ret = GLEW_EXT_light_texture; continue; } #endif #ifdef GL_EXT_misc_attribute if (_glewStrSame3(&pos, &len, (const GLubyte*)"misc_attribute", 14)) { ret = GLEW_EXT_misc_attribute; continue; } #endif #ifdef GL_EXT_multi_draw_arrays if (_glewStrSame3(&pos, &len, (const GLubyte*)"multi_draw_arrays", 17)) { ret = GLEW_EXT_multi_draw_arrays; continue; } #endif #ifdef GL_EXT_multisample if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) { ret = GLEW_EXT_multisample; continue; } #endif #ifdef GL_EXT_packed_depth_stencil if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_depth_stencil", 20)) { ret = GLEW_EXT_packed_depth_stencil; continue; } #endif #ifdef GL_EXT_packed_float if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_float", 12)) { ret = GLEW_EXT_packed_float; continue; } #endif #ifdef GL_EXT_packed_pixels if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_pixels", 13)) { ret = GLEW_EXT_packed_pixels; continue; } #endif #ifdef GL_EXT_paletted_texture if (_glewStrSame3(&pos, &len, (const GLubyte*)"paletted_texture", 16)) { ret = GLEW_EXT_paletted_texture; continue; } #endif #ifdef GL_EXT_pixel_buffer_object if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_buffer_object", 19)) { ret = GLEW_EXT_pixel_buffer_object; continue; } #endif #ifdef GL_EXT_pixel_transform if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_transform", 15)) { ret = GLEW_EXT_pixel_transform; continue; } #endif #ifdef GL_EXT_pixel_transform_color_table if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_transform_color_table", 27)) { ret = GLEW_EXT_pixel_transform_color_table; continue; } #endif #ifdef GL_EXT_point_parameters if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_parameters", 16)) { ret = GLEW_EXT_point_parameters; continue; } #endif #ifdef GL_EXT_polygon_offset if (_glewStrSame3(&pos, &len, (const GLubyte*)"polygon_offset", 14)) { ret = GLEW_EXT_polygon_offset; continue; } #endif #ifdef GL_EXT_provoking_vertex if (_glewStrSame3(&pos, &len, (const GLubyte*)"provoking_vertex", 16)) { ret = GLEW_EXT_provoking_vertex; continue; } #endif #ifdef GL_EXT_rescale_normal if (_glewStrSame3(&pos, &len, (const GLubyte*)"rescale_normal", 14)) { ret = GLEW_EXT_rescale_normal; continue; } #endif #ifdef GL_EXT_scene_marker if (_glewStrSame3(&pos, &len, (const GLubyte*)"scene_marker", 12)) { ret = GLEW_EXT_scene_marker; continue; } #endif #ifdef GL_EXT_secondary_color if (_glewStrSame3(&pos, &len, (const GLubyte*)"secondary_color", 15)) { ret = GLEW_EXT_secondary_color; continue; } #endif #ifdef GL_EXT_separate_shader_objects if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_shader_objects", 23)) { ret = GLEW_EXT_separate_shader_objects; continue; } #endif #ifdef GL_EXT_separate_specular_color if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_specular_color", 23)) { ret = GLEW_EXT_separate_specular_color; continue; } #endif #ifdef GL_EXT_shader_image_load_store if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_image_load_store", 23)) { ret = GLEW_EXT_shader_image_load_store; continue; } #endif #ifdef GL_EXT_shadow_funcs if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow_funcs", 12)) { ret = GLEW_EXT_shadow_funcs; continue; } #endif #ifdef GL_EXT_shared_texture_palette if (_glewStrSame3(&pos, &len, (const GLubyte*)"shared_texture_palette", 22)) { ret = GLEW_EXT_shared_texture_palette; continue; } #endif #ifdef GL_EXT_stencil_clear_tag if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_clear_tag", 17)) { ret = GLEW_EXT_stencil_clear_tag; continue; } #endif #ifdef GL_EXT_stencil_two_side if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_two_side", 16)) { ret = GLEW_EXT_stencil_two_side; continue; } #endif #ifdef GL_EXT_stencil_wrap if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_wrap", 12)) { ret = GLEW_EXT_stencil_wrap; continue; } #endif #ifdef GL_EXT_subtexture if (_glewStrSame3(&pos, &len, (const GLubyte*)"subtexture", 10)) { ret = GLEW_EXT_subtexture; continue; } #endif #ifdef GL_EXT_texture if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture", 7)) { ret = GLEW_EXT_texture; continue; } #endif #ifdef GL_EXT_texture3D if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture3D", 9)) { ret = GLEW_EXT_texture3D; continue; } #endif #ifdef GL_EXT_texture_array if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_array", 13)) { ret = GLEW_EXT_texture_array; continue; } #endif #ifdef GL_EXT_texture_buffer_object if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_buffer_object", 21)) { ret = GLEW_EXT_texture_buffer_object; continue; } #endif #ifdef GL_EXT_texture_compression_dxt1 if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_dxt1", 24)) { ret = GLEW_EXT_texture_compression_dxt1; continue; } #endif #ifdef GL_EXT_texture_compression_latc if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_latc", 24)) { ret = GLEW_EXT_texture_compression_latc; continue; } #endif #ifdef GL_EXT_texture_compression_rgtc if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_rgtc", 24)) { ret = GLEW_EXT_texture_compression_rgtc; continue; } #endif #ifdef GL_EXT_texture_compression_s3tc if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_s3tc", 24)) { ret = GLEW_EXT_texture_compression_s3tc; continue; } #endif #ifdef GL_EXT_texture_cube_map if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_cube_map", 16)) { ret = GLEW_EXT_texture_cube_map; continue; } #endif #ifdef GL_EXT_texture_edge_clamp if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_edge_clamp", 18)) { ret = GLEW_EXT_texture_edge_clamp; continue; } #endif #ifdef GL_EXT_texture_env if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env", 11)) { ret = GLEW_EXT_texture_env; continue; } #endif #ifdef GL_EXT_texture_env_add if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_add", 15)) { ret = GLEW_EXT_texture_env_add; continue; } #endif #ifdef GL_EXT_texture_env_combine if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine", 19)) { ret = GLEW_EXT_texture_env_combine; continue; } #endif #ifdef GL_EXT_texture_env_dot3 if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_dot3", 16)) { ret = GLEW_EXT_texture_env_dot3; continue; } #endif #ifdef GL_EXT_texture_filter_anisotropic if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_filter_anisotropic", 26)) { ret = GLEW_EXT_texture_filter_anisotropic; continue; } #endif #ifdef GL_EXT_texture_integer if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_integer", 15)) { ret = GLEW_EXT_texture_integer; continue; } #endif #ifdef GL_EXT_texture_lod_bias if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lod_bias", 16)) { ret = GLEW_EXT_texture_lod_bias; continue; } #endif #ifdef GL_EXT_texture_mirror_clamp if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirror_clamp", 20)) { ret = GLEW_EXT_texture_mirror_clamp; continue; } #endif #ifdef GL_EXT_texture_object if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_object", 14)) { ret = GLEW_EXT_texture_object; continue; } #endif #ifdef GL_EXT_texture_perturb_normal if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_perturb_normal", 22)) { ret = GLEW_EXT_texture_perturb_normal; continue; } #endif #ifdef GL_EXT_texture_rectangle if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rectangle", 17)) { ret = GLEW_EXT_texture_rectangle; continue; } #endif #ifdef GL_EXT_texture_sRGB if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_sRGB", 12)) { ret = GLEW_EXT_texture_sRGB; continue; } #endif #ifdef GL_EXT_texture_sRGB_decode if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_sRGB_decode", 19)) { ret = GLEW_EXT_texture_sRGB_decode; continue; } #endif #ifdef GL_EXT_texture_shared_exponent if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shared_exponent", 23)) { ret = GLEW_EXT_texture_shared_exponent; continue; } #endif #ifdef GL_EXT_texture_snorm if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_snorm", 13)) { ret = GLEW_EXT_texture_snorm; continue; } #endif #ifdef GL_EXT_texture_swizzle if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_swizzle", 15)) { ret = GLEW_EXT_texture_swizzle; continue; } #endif #ifdef GL_EXT_timer_query if (_glewStrSame3(&pos, &len, (const GLubyte*)"timer_query", 11)) { ret = GLEW_EXT_timer_query; continue; } #endif #ifdef GL_EXT_transform_feedback if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback", 18)) { ret = GLEW_EXT_transform_feedback; continue; } #endif #ifdef GL_EXT_vertex_array if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array", 12)) { ret = GLEW_EXT_vertex_array; continue; } #endif #ifdef GL_EXT_vertex_array_bgra if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_bgra", 17)) { ret = GLEW_EXT_vertex_array_bgra; continue; } #endif #ifdef GL_EXT_vertex_attrib_64bit if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_64bit", 19)) { ret = GLEW_EXT_vertex_attrib_64bit; continue; } #endif #ifdef GL_EXT_vertex_shader if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader", 13)) { ret = GLEW_EXT_vertex_shader; continue; } #endif #ifdef GL_EXT_vertex_weighting if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_weighting", 16)) { ret = GLEW_EXT_vertex_weighting; continue; } #endif #ifdef GL_EXT_x11_sync_object if (_glewStrSame3(&pos, &len, (const GLubyte*)"x11_sync_object", 15)) { ret = GLEW_EXT_x11_sync_object; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"GREMEDY_", 8)) { #ifdef GL_GREMEDY_frame_terminator if (_glewStrSame3(&pos, &len, (const GLubyte*)"frame_terminator", 16)) { ret = GLEW_GREMEDY_frame_terminator; continue; } #endif #ifdef GL_GREMEDY_string_marker if (_glewStrSame3(&pos, &len, (const GLubyte*)"string_marker", 13)) { ret = GLEW_GREMEDY_string_marker; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"HP_", 3)) { #ifdef GL_HP_convolution_border_modes if (_glewStrSame3(&pos, &len, (const GLubyte*)"convolution_border_modes", 24)) { ret = GLEW_HP_convolution_border_modes; continue; } #endif #ifdef GL_HP_image_transform if (_glewStrSame3(&pos, &len, (const GLubyte*)"image_transform", 15)) { ret = GLEW_HP_image_transform; continue; } #endif #ifdef GL_HP_occlusion_test if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_test", 14)) { ret = GLEW_HP_occlusion_test; continue; } #endif #ifdef GL_HP_texture_lighting if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lighting", 16)) { ret = GLEW_HP_texture_lighting; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"IBM_", 4)) { #ifdef GL_IBM_cull_vertex if (_glewStrSame3(&pos, &len, (const GLubyte*)"cull_vertex", 11)) { ret = GLEW_IBM_cull_vertex; continue; } #endif #ifdef GL_IBM_multimode_draw_arrays if (_glewStrSame3(&pos, &len, (const GLubyte*)"multimode_draw_arrays", 21)) { ret = GLEW_IBM_multimode_draw_arrays; continue; } #endif #ifdef GL_IBM_rasterpos_clip if (_glewStrSame3(&pos, &len, (const GLubyte*)"rasterpos_clip", 14)) { ret = GLEW_IBM_rasterpos_clip; continue; } #endif #ifdef GL_IBM_static_data if (_glewStrSame3(&pos, &len, (const GLubyte*)"static_data", 11)) { ret = GLEW_IBM_static_data; continue; } #endif #ifdef GL_IBM_texture_mirrored_repeat if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirrored_repeat", 23)) { ret = GLEW_IBM_texture_mirrored_repeat; continue; } #endif #ifdef GL_IBM_vertex_array_lists if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_lists", 18)) { ret = GLEW_IBM_vertex_array_lists; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"INGR_", 5)) { #ifdef GL_INGR_color_clamp if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_clamp", 11)) { ret = GLEW_INGR_color_clamp; continue; } #endif #ifdef GL_INGR_interlace_read if (_glewStrSame3(&pos, &len, (const GLubyte*)"interlace_read", 14)) { ret = GLEW_INGR_interlace_read; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"INTEL_", 6)) { #ifdef GL_INTEL_parallel_arrays if (_glewStrSame3(&pos, &len, (const GLubyte*)"parallel_arrays", 15)) { ret = GLEW_INTEL_parallel_arrays; continue; } #endif #ifdef GL_INTEL_texture_scissor if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_scissor", 15)) { ret = GLEW_INTEL_texture_scissor; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"KHR_", 4)) { #ifdef GL_KHR_debug if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug", 5)) { ret = GLEW_KHR_debug; continue; } #endif #ifdef GL_KHR_texture_compression_astc_ldr if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_astc_ldr", 28)) { ret = GLEW_KHR_texture_compression_astc_ldr; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"KTX_", 4)) { #ifdef GL_KTX_buffer_region if (_glewStrSame3(&pos, &len, (const GLubyte*)"buffer_region", 13)) { ret = GLEW_KTX_buffer_region; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"MESAX_", 6)) { #ifdef GL_MESAX_texture_stack if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_stack", 13)) { ret = GLEW_MESAX_texture_stack; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"MESA_", 5)) { #ifdef GL_MESA_pack_invert if (_glewStrSame3(&pos, &len, (const GLubyte*)"pack_invert", 11)) { ret = GLEW_MESA_pack_invert; continue; } #endif #ifdef GL_MESA_resize_buffers if (_glewStrSame3(&pos, &len, (const GLubyte*)"resize_buffers", 14)) { ret = GLEW_MESA_resize_buffers; continue; } #endif #ifdef GL_MESA_window_pos if (_glewStrSame3(&pos, &len, (const GLubyte*)"window_pos", 10)) { ret = GLEW_MESA_window_pos; continue; } #endif #ifdef GL_MESA_ycbcr_texture if (_glewStrSame3(&pos, &len, (const GLubyte*)"ycbcr_texture", 13)) { ret = GLEW_MESA_ycbcr_texture; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"NVX_", 4)) { #ifdef GL_NVX_gpu_memory_info if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_memory_info", 15)) { ret = GLEW_NVX_gpu_memory_info; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"NV_", 3)) { #ifdef GL_NV_bindless_texture if (_glewStrSame3(&pos, &len, (const GLubyte*)"bindless_texture", 16)) { ret = GLEW_NV_bindless_texture; continue; } #endif #ifdef GL_NV_blend_square if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_square", 12)) { ret = GLEW_NV_blend_square; continue; } #endif #ifdef GL_NV_conditional_render if (_glewStrSame3(&pos, &len, (const GLubyte*)"conditional_render", 18)) { ret = GLEW_NV_conditional_render; continue; } #endif #ifdef GL_NV_copy_depth_to_color if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_depth_to_color", 19)) { ret = GLEW_NV_copy_depth_to_color; continue; } #endif #ifdef GL_NV_copy_image if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_image", 10)) { ret = GLEW_NV_copy_image; continue; } #endif #ifdef GL_NV_depth_buffer_float if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_buffer_float", 18)) { ret = GLEW_NV_depth_buffer_float; continue; } #endif #ifdef GL_NV_depth_clamp if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_clamp", 11)) { ret = GLEW_NV_depth_clamp; continue; } #endif #ifdef GL_NV_depth_range_unclamped if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_range_unclamped", 21)) { ret = GLEW_NV_depth_range_unclamped; continue; } #endif #ifdef GL_NV_evaluators if (_glewStrSame3(&pos, &len, (const GLubyte*)"evaluators", 10)) { ret = GLEW_NV_evaluators; continue; } #endif #ifdef GL_NV_explicit_multisample if (_glewStrSame3(&pos, &len, (const GLubyte*)"explicit_multisample", 20)) { ret = GLEW_NV_explicit_multisample; continue; } #endif #ifdef GL_NV_fence if (_glewStrSame3(&pos, &len, (const GLubyte*)"fence", 5)) { ret = GLEW_NV_fence; continue; } #endif #ifdef GL_NV_float_buffer if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_buffer", 12)) { ret = GLEW_NV_float_buffer; continue; } #endif #ifdef GL_NV_fog_distance if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_distance", 12)) { ret = GLEW_NV_fog_distance; continue; } #endif #ifdef GL_NV_fragment_program if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program", 16)) { ret = GLEW_NV_fragment_program; continue; } #endif #ifdef GL_NV_fragment_program2 if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program2", 17)) { ret = GLEW_NV_fragment_program2; continue; } #endif #ifdef GL_NV_fragment_program4 if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program4", 17)) { ret = GLEW_NV_fragment_program4; continue; } #endif #ifdef GL_NV_fragment_program_option if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program_option", 23)) { ret = GLEW_NV_fragment_program_option; continue; } #endif #ifdef GL_NV_framebuffer_multisample_coverage if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_multisample_coverage", 32)) { ret = GLEW_NV_framebuffer_multisample_coverage; continue; } #endif #ifdef GL_NV_geometry_program4 if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_program4", 17)) { ret = GLEW_NV_geometry_program4; continue; } #endif #ifdef GL_NV_geometry_shader4 if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_shader4", 16)) { ret = GLEW_NV_geometry_shader4; continue; } #endif #ifdef GL_NV_gpu_program4 if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program4", 12)) { ret = GLEW_NV_gpu_program4; continue; } #endif #ifdef GL_NV_gpu_program5 if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program5", 12)) { ret = GLEW_NV_gpu_program5; continue; } #endif #ifdef GL_NV_gpu_program_fp64 if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program_fp64", 16)) { ret = GLEW_NV_gpu_program_fp64; continue; } #endif #ifdef GL_NV_gpu_shader5 if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader5", 11)) { ret = GLEW_NV_gpu_shader5; continue; } #endif #ifdef GL_NV_half_float if (_glewStrSame3(&pos, &len, (const GLubyte*)"half_float", 10)) { ret = GLEW_NV_half_float; continue; } #endif #ifdef GL_NV_light_max_exponent if (_glewStrSame3(&pos, &len, (const GLubyte*)"light_max_exponent", 18)) { ret = GLEW_NV_light_max_exponent; continue; } #endif #ifdef GL_NV_multisample_coverage if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample_coverage", 20)) { ret = GLEW_NV_multisample_coverage; continue; } #endif #ifdef GL_NV_multisample_filter_hint if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample_filter_hint", 23)) { ret = GLEW_NV_multisample_filter_hint; continue; } #endif #ifdef GL_NV_occlusion_query if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_query", 15)) { ret = GLEW_NV_occlusion_query; continue; } #endif #ifdef GL_NV_packed_depth_stencil if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_depth_stencil", 20)) { ret = GLEW_NV_packed_depth_stencil; continue; } #endif #ifdef GL_NV_parameter_buffer_object if (_glewStrSame3(&pos, &len, (const GLubyte*)"parameter_buffer_object", 23)) { ret = GLEW_NV_parameter_buffer_object; continue; } #endif #ifdef GL_NV_parameter_buffer_object2 if (_glewStrSame3(&pos, &len, (const GLubyte*)"parameter_buffer_object2", 24)) { ret = GLEW_NV_parameter_buffer_object2; continue; } #endif #ifdef GL_NV_path_rendering if (_glewStrSame3(&pos, &len, (const GLubyte*)"path_rendering", 14)) { ret = GLEW_NV_path_rendering; continue; } #endif #ifdef GL_NV_pixel_data_range if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_data_range", 16)) { ret = GLEW_NV_pixel_data_range; continue; } #endif #ifdef GL_NV_point_sprite if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_sprite", 12)) { ret = GLEW_NV_point_sprite; continue; } #endif #ifdef GL_NV_present_video if (_glewStrSame3(&pos, &len, (const GLubyte*)"present_video", 13)) { ret = GLEW_NV_present_video; continue; } #endif #ifdef GL_NV_primitive_restart if (_glewStrSame3(&pos, &len, (const GLubyte*)"primitive_restart", 17)) { ret = GLEW_NV_primitive_restart; continue; } #endif #ifdef GL_NV_register_combiners if (_glewStrSame3(&pos, &len, (const GLubyte*)"register_combiners", 18)) { ret = GLEW_NV_register_combiners; continue; } #endif #ifdef GL_NV_register_combiners2 if (_glewStrSame3(&pos, &len, (const GLubyte*)"register_combiners2", 19)) { ret = GLEW_NV_register_combiners2; continue; } #endif #ifdef GL_NV_shader_atomic_float if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_float", 19)) { ret = GLEW_NV_shader_atomic_float; continue; } #endif #ifdef GL_NV_shader_buffer_load if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_buffer_load", 18)) { ret = GLEW_NV_shader_buffer_load; continue; } #endif #ifdef GL_NV_tessellation_program5 if (_glewStrSame3(&pos, &len, (const GLubyte*)"tessellation_program5", 21)) { ret = GLEW_NV_tessellation_program5; continue; } #endif #ifdef GL_NV_texgen_emboss if (_glewStrSame3(&pos, &len, (const GLubyte*)"texgen_emboss", 13)) { ret = GLEW_NV_texgen_emboss; continue; } #endif #ifdef GL_NV_texgen_reflection if (_glewStrSame3(&pos, &len, (const GLubyte*)"texgen_reflection", 17)) { ret = GLEW_NV_texgen_reflection; continue; } #endif #ifdef GL_NV_texture_barrier if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_barrier", 15)) { ret = GLEW_NV_texture_barrier; continue; } #endif #ifdef GL_NV_texture_compression_vtc if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_vtc", 23)) { ret = GLEW_NV_texture_compression_vtc; continue; } #endif #ifdef GL_NV_texture_env_combine4 if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine4", 20)) { ret = GLEW_NV_texture_env_combine4; continue; } #endif #ifdef GL_NV_texture_expand_normal if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_expand_normal", 21)) { ret = GLEW_NV_texture_expand_normal; continue; } #endif #ifdef GL_NV_texture_multisample if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_multisample", 19)) { ret = GLEW_NV_texture_multisample; continue; } #endif #ifdef GL_NV_texture_rectangle if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rectangle", 17)) { ret = GLEW_NV_texture_rectangle; continue; } #endif #ifdef GL_NV_texture_shader if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shader", 14)) { ret = GLEW_NV_texture_shader; continue; } #endif #ifdef GL_NV_texture_shader2 if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shader2", 15)) { ret = GLEW_NV_texture_shader2; continue; } #endif #ifdef GL_NV_texture_shader3 if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shader3", 15)) { ret = GLEW_NV_texture_shader3; continue; } #endif #ifdef GL_NV_transform_feedback if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback", 18)) { ret = GLEW_NV_transform_feedback; continue; } #endif #ifdef GL_NV_transform_feedback2 if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback2", 19)) { ret = GLEW_NV_transform_feedback2; continue; } #endif #ifdef GL_NV_vdpau_interop if (_glewStrSame3(&pos, &len, (const GLubyte*)"vdpau_interop", 13)) { ret = GLEW_NV_vdpau_interop; continue; } #endif #ifdef GL_NV_vertex_array_range if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18)) { ret = GLEW_NV_vertex_array_range; continue; } #endif #ifdef GL_NV_vertex_array_range2 if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range2", 19)) { ret = GLEW_NV_vertex_array_range2; continue; } #endif #ifdef GL_NV_vertex_attrib_integer_64bit if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_integer_64bit", 27)) { ret = GLEW_NV_vertex_attrib_integer_64bit; continue; } #endif #ifdef GL_NV_vertex_buffer_unified_memory if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_buffer_unified_memory", 28)) { ret = GLEW_NV_vertex_buffer_unified_memory; continue; } #endif #ifdef GL_NV_vertex_program if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program", 14)) { ret = GLEW_NV_vertex_program; continue; } #endif #ifdef GL_NV_vertex_program1_1 if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program1_1", 17)) { ret = GLEW_NV_vertex_program1_1; continue; } #endif #ifdef GL_NV_vertex_program2 if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program2", 15)) { ret = GLEW_NV_vertex_program2; continue; } #endif #ifdef GL_NV_vertex_program2_option if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program2_option", 22)) { ret = GLEW_NV_vertex_program2_option; continue; } #endif #ifdef GL_NV_vertex_program3 if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program3", 15)) { ret = GLEW_NV_vertex_program3; continue; } #endif #ifdef GL_NV_vertex_program4 if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program4", 15)) { ret = GLEW_NV_vertex_program4; continue; } #endif #ifdef GL_NV_video_capture if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_capture", 13)) { ret = GLEW_NV_video_capture; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"OES_", 4)) { #ifdef GL_OES_byte_coordinates if (_glewStrSame3(&pos, &len, (const GLubyte*)"byte_coordinates", 16)) { ret = GLEW_OES_byte_coordinates; continue; } #endif #ifdef GL_OES_compressed_paletted_texture if (_glewStrSame3(&pos, &len, (const GLubyte*)"compressed_paletted_texture", 27)) { ret = GLEW_OES_compressed_paletted_texture; continue; } #endif #ifdef GL_OES_read_format if (_glewStrSame3(&pos, &len, (const GLubyte*)"read_format", 11)) { ret = GLEW_OES_read_format; continue; } #endif #ifdef GL_OES_single_precision if (_glewStrSame3(&pos, &len, (const GLubyte*)"single_precision", 16)) { ret = GLEW_OES_single_precision; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"OML_", 4)) { #ifdef GL_OML_interlace if (_glewStrSame3(&pos, &len, (const GLubyte*)"interlace", 9)) { ret = GLEW_OML_interlace; continue; } #endif #ifdef GL_OML_resample if (_glewStrSame3(&pos, &len, (const GLubyte*)"resample", 8)) { ret = GLEW_OML_resample; continue; } #endif #ifdef GL_OML_subsample if (_glewStrSame3(&pos, &len, (const GLubyte*)"subsample", 9)) { ret = GLEW_OML_subsample; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"PGI_", 4)) { #ifdef GL_PGI_misc_hints if (_glewStrSame3(&pos, &len, (const GLubyte*)"misc_hints", 10)) { ret = GLEW_PGI_misc_hints; continue; } #endif #ifdef GL_PGI_vertex_hints if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_hints", 12)) { ret = GLEW_PGI_vertex_hints; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"REGAL_", 6)) { #ifdef GL_REGAL_error_string if (_glewStrSame3(&pos, &len, (const GLubyte*)"error_string", 12)) { ret = GLEW_REGAL_error_string; continue; } #endif #ifdef GL_REGAL_extension_query if (_glewStrSame3(&pos, &len, (const GLubyte*)"extension_query", 15)) { ret = GLEW_REGAL_extension_query; continue; } #endif #ifdef GL_REGAL_log if (_glewStrSame3(&pos, &len, (const GLubyte*)"log", 3)) { ret = GLEW_REGAL_log; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"REND_", 5)) { #ifdef GL_REND_screen_coordinates if (_glewStrSame3(&pos, &len, (const GLubyte*)"screen_coordinates", 18)) { ret = GLEW_REND_screen_coordinates; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"S3_", 3)) { #ifdef GL_S3_s3tc if (_glewStrSame3(&pos, &len, (const GLubyte*)"s3tc", 4)) { ret = GLEW_S3_s3tc; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIS_", 5)) { #ifdef GL_SGIS_color_range if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_range", 11)) { ret = GLEW_SGIS_color_range; continue; } #endif #ifdef GL_SGIS_detail_texture if (_glewStrSame3(&pos, &len, (const GLubyte*)"detail_texture", 14)) { ret = GLEW_SGIS_detail_texture; continue; } #endif #ifdef GL_SGIS_fog_function if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_function", 12)) { ret = GLEW_SGIS_fog_function; continue; } #endif #ifdef GL_SGIS_generate_mipmap if (_glewStrSame3(&pos, &len, (const GLubyte*)"generate_mipmap", 15)) { ret = GLEW_SGIS_generate_mipmap; continue; } #endif #ifdef GL_SGIS_multisample if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) { ret = GLEW_SGIS_multisample; continue; } #endif #ifdef GL_SGIS_pixel_texture if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_texture", 13)) { ret = GLEW_SGIS_pixel_texture; continue; } #endif #ifdef GL_SGIS_point_line_texgen if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_line_texgen", 17)) { ret = GLEW_SGIS_point_line_texgen; continue; } #endif #ifdef GL_SGIS_sharpen_texture if (_glewStrSame3(&pos, &len, (const GLubyte*)"sharpen_texture", 15)) { ret = GLEW_SGIS_sharpen_texture; continue; } #endif #ifdef GL_SGIS_texture4D if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture4D", 9)) { ret = GLEW_SGIS_texture4D; continue; } #endif #ifdef GL_SGIS_texture_border_clamp if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_border_clamp", 20)) { ret = GLEW_SGIS_texture_border_clamp; continue; } #endif #ifdef GL_SGIS_texture_edge_clamp if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_edge_clamp", 18)) { ret = GLEW_SGIS_texture_edge_clamp; continue; } #endif #ifdef GL_SGIS_texture_filter4 if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_filter4", 15)) { ret = GLEW_SGIS_texture_filter4; continue; } #endif #ifdef GL_SGIS_texture_lod if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lod", 11)) { ret = GLEW_SGIS_texture_lod; continue; } #endif #ifdef GL_SGIS_texture_select if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_select", 14)) { ret = GLEW_SGIS_texture_select; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIX_", 5)) { #ifdef GL_SGIX_async if (_glewStrSame3(&pos, &len, (const GLubyte*)"async", 5)) { ret = GLEW_SGIX_async; continue; } #endif #ifdef GL_SGIX_async_histogram if (_glewStrSame3(&pos, &len, (const GLubyte*)"async_histogram", 15)) { ret = GLEW_SGIX_async_histogram; continue; } #endif #ifdef GL_SGIX_async_pixel if (_glewStrSame3(&pos, &len, (const GLubyte*)"async_pixel", 11)) { ret = GLEW_SGIX_async_pixel; continue; } #endif #ifdef GL_SGIX_blend_alpha_minmax if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_alpha_minmax", 18)) { ret = GLEW_SGIX_blend_alpha_minmax; continue; } #endif #ifdef GL_SGIX_clipmap if (_glewStrSame3(&pos, &len, (const GLubyte*)"clipmap", 7)) { ret = GLEW_SGIX_clipmap; continue; } #endif #ifdef GL_SGIX_convolution_accuracy if (_glewStrSame3(&pos, &len, (const GLubyte*)"convolution_accuracy", 20)) { ret = GLEW_SGIX_convolution_accuracy; continue; } #endif #ifdef GL_SGIX_depth_texture if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_texture", 13)) { ret = GLEW_SGIX_depth_texture; continue; } #endif #ifdef GL_SGIX_flush_raster if (_glewStrSame3(&pos, &len, (const GLubyte*)"flush_raster", 12)) { ret = GLEW_SGIX_flush_raster; continue; } #endif #ifdef GL_SGIX_fog_offset if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_offset", 10)) { ret = GLEW_SGIX_fog_offset; continue; } #endif #ifdef GL_SGIX_fog_texture if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_texture", 11)) { ret = GLEW_SGIX_fog_texture; continue; } #endif #ifdef GL_SGIX_fragment_specular_lighting if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_specular_lighting", 26)) { ret = GLEW_SGIX_fragment_specular_lighting; continue; } #endif #ifdef GL_SGIX_framezoom if (_glewStrSame3(&pos, &len, (const GLubyte*)"framezoom", 9)) { ret = GLEW_SGIX_framezoom; continue; } #endif #ifdef GL_SGIX_interlace if (_glewStrSame3(&pos, &len, (const GLubyte*)"interlace", 9)) { ret = GLEW_SGIX_interlace; continue; } #endif #ifdef GL_SGIX_ir_instrument1 if (_glewStrSame3(&pos, &len, (const GLubyte*)"ir_instrument1", 14)) { ret = GLEW_SGIX_ir_instrument1; continue; } #endif #ifdef GL_SGIX_list_priority if (_glewStrSame3(&pos, &len, (const GLubyte*)"list_priority", 13)) { ret = GLEW_SGIX_list_priority; continue; } #endif #ifdef GL_SGIX_pixel_texture if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_texture", 13)) { ret = GLEW_SGIX_pixel_texture; continue; } #endif #ifdef GL_SGIX_pixel_texture_bits if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_texture_bits", 18)) { ret = GLEW_SGIX_pixel_texture_bits; continue; } #endif #ifdef GL_SGIX_reference_plane if (_glewStrSame3(&pos, &len, (const GLubyte*)"reference_plane", 15)) { ret = GLEW_SGIX_reference_plane; continue; } #endif #ifdef GL_SGIX_resample if (_glewStrSame3(&pos, &len, (const GLubyte*)"resample", 8)) { ret = GLEW_SGIX_resample; continue; } #endif #ifdef GL_SGIX_shadow if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow", 6)) { ret = GLEW_SGIX_shadow; continue; } #endif #ifdef GL_SGIX_shadow_ambient if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow_ambient", 14)) { ret = GLEW_SGIX_shadow_ambient; continue; } #endif #ifdef GL_SGIX_sprite if (_glewStrSame3(&pos, &len, (const GLubyte*)"sprite", 6)) { ret = GLEW_SGIX_sprite; continue; } #endif #ifdef GL_SGIX_tag_sample_buffer if (_glewStrSame3(&pos, &len, (const GLubyte*)"tag_sample_buffer", 17)) { ret = GLEW_SGIX_tag_sample_buffer; continue; } #endif #ifdef GL_SGIX_texture_add_env if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_add_env", 15)) { ret = GLEW_SGIX_texture_add_env; continue; } #endif #ifdef GL_SGIX_texture_coordinate_clamp if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_coordinate_clamp", 24)) { ret = GLEW_SGIX_texture_coordinate_clamp; continue; } #endif #ifdef GL_SGIX_texture_lod_bias if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lod_bias", 16)) { ret = GLEW_SGIX_texture_lod_bias; continue; } #endif #ifdef GL_SGIX_texture_multi_buffer if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_multi_buffer", 20)) { ret = GLEW_SGIX_texture_multi_buffer; continue; } #endif #ifdef GL_SGIX_texture_range if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_range", 13)) { ret = GLEW_SGIX_texture_range; continue; } #endif #ifdef GL_SGIX_texture_scale_bias if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_scale_bias", 18)) { ret = GLEW_SGIX_texture_scale_bias; continue; } #endif #ifdef GL_SGIX_vertex_preclip if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_preclip", 14)) { ret = GLEW_SGIX_vertex_preclip; continue; } #endif #ifdef GL_SGIX_vertex_preclip_hint if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_preclip_hint", 19)) { ret = GLEW_SGIX_vertex_preclip_hint; continue; } #endif #ifdef GL_SGIX_ycrcb if (_glewStrSame3(&pos, &len, (const GLubyte*)"ycrcb", 5)) { ret = GLEW_SGIX_ycrcb; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGI_", 4)) { #ifdef GL_SGI_color_matrix if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_matrix", 12)) { ret = GLEW_SGI_color_matrix; continue; } #endif #ifdef GL_SGI_color_table if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_table", 11)) { ret = GLEW_SGI_color_table; continue; } #endif #ifdef GL_SGI_texture_color_table if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_color_table", 19)) { ret = GLEW_SGI_texture_color_table; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"SUNX_", 5)) { #ifdef GL_SUNX_constant_data if (_glewStrSame3(&pos, &len, (const GLubyte*)"constant_data", 13)) { ret = GLEW_SUNX_constant_data; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"SUN_", 4)) { #ifdef GL_SUN_convolution_border_modes if (_glewStrSame3(&pos, &len, (const GLubyte*)"convolution_border_modes", 24)) { ret = GLEW_SUN_convolution_border_modes; continue; } #endif #ifdef GL_SUN_global_alpha if (_glewStrSame3(&pos, &len, (const GLubyte*)"global_alpha", 12)) { ret = GLEW_SUN_global_alpha; continue; } #endif #ifdef GL_SUN_mesh_array if (_glewStrSame3(&pos, &len, (const GLubyte*)"mesh_array", 10)) { ret = GLEW_SUN_mesh_array; continue; } #endif #ifdef GL_SUN_read_video_pixels if (_glewStrSame3(&pos, &len, (const GLubyte*)"read_video_pixels", 17)) { ret = GLEW_SUN_read_video_pixels; continue; } #endif #ifdef GL_SUN_slice_accum if (_glewStrSame3(&pos, &len, (const GLubyte*)"slice_accum", 11)) { ret = GLEW_SUN_slice_accum; continue; } #endif #ifdef GL_SUN_triangle_list if (_glewStrSame3(&pos, &len, (const GLubyte*)"triangle_list", 13)) { ret = GLEW_SUN_triangle_list; continue; } #endif #ifdef GL_SUN_vertex if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex", 6)) { ret = GLEW_SUN_vertex; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"WIN_", 4)) { #ifdef GL_WIN_phong_shading if (_glewStrSame3(&pos, &len, (const GLubyte*)"phong_shading", 13)) { ret = GLEW_WIN_phong_shading; continue; } #endif #ifdef GL_WIN_specular_fog if (_glewStrSame3(&pos, &len, (const GLubyte*)"specular_fog", 12)) { ret = GLEW_WIN_specular_fog; continue; } #endif #ifdef GL_WIN_swap_hint if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_hint", 9)) { ret = GLEW_WIN_swap_hint; continue; } #endif } } ret = (len == 0); } return ret; } #if defined(_WIN32) #if defined(GLEW_MX) GLboolean GLEWAPIENTRY wglewContextIsSupported (const WGLEWContext* ctx, const char* name) #else GLboolean GLEWAPIENTRY wglewIsSupported (const char* name) #endif { GLubyte* pos = (GLubyte*)name; GLuint len = _glewStrLen(pos); GLboolean ret = GL_TRUE; while (ret && len > 0) { if (_glewStrSame1(&pos, &len, (const GLubyte*)"WGL_", 4)) { if (_glewStrSame2(&pos, &len, (const GLubyte*)"3DFX_", 5)) { #ifdef WGL_3DFX_multisample if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) { ret = WGLEW_3DFX_multisample; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"3DL_", 4)) { #ifdef WGL_3DL_stereo_control if (_glewStrSame3(&pos, &len, (const GLubyte*)"stereo_control", 14)) { ret = WGLEW_3DL_stereo_control; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"AMD_", 4)) { #ifdef WGL_AMD_gpu_association if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_association", 15)) { ret = WGLEW_AMD_gpu_association; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"ARB_", 4)) { #ifdef WGL_ARB_buffer_region if (_glewStrSame3(&pos, &len, (const GLubyte*)"buffer_region", 13)) { ret = WGLEW_ARB_buffer_region; continue; } #endif #ifdef WGL_ARB_create_context if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context", 14)) { ret = WGLEW_ARB_create_context; continue; } #endif #ifdef WGL_ARB_create_context_profile if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_profile", 22)) { ret = WGLEW_ARB_create_context_profile; continue; } #endif #ifdef WGL_ARB_create_context_robustness if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_robustness", 25)) { ret = WGLEW_ARB_create_context_robustness; continue; } #endif #ifdef WGL_ARB_extensions_string if (_glewStrSame3(&pos, &len, (const GLubyte*)"extensions_string", 17)) { ret = WGLEW_ARB_extensions_string; continue; } #endif #ifdef WGL_ARB_framebuffer_sRGB if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) { ret = WGLEW_ARB_framebuffer_sRGB; continue; } #endif #ifdef WGL_ARB_make_current_read if (_glewStrSame3(&pos, &len, (const GLubyte*)"make_current_read", 17)) { ret = WGLEW_ARB_make_current_read; continue; } #endif #ifdef WGL_ARB_multisample if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) { ret = WGLEW_ARB_multisample; continue; } #endif #ifdef WGL_ARB_pbuffer if (_glewStrSame3(&pos, &len, (const GLubyte*)"pbuffer", 7)) { ret = WGLEW_ARB_pbuffer; continue; } #endif #ifdef WGL_ARB_pixel_format if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format", 12)) { ret = WGLEW_ARB_pixel_format; continue; } #endif #ifdef WGL_ARB_pixel_format_float if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format_float", 18)) { ret = WGLEW_ARB_pixel_format_float; continue; } #endif #ifdef WGL_ARB_render_texture if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture", 14)) { ret = WGLEW_ARB_render_texture; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"ATI_", 4)) { #ifdef WGL_ATI_pixel_format_float if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format_float", 18)) { ret = WGLEW_ATI_pixel_format_float; continue; } #endif #ifdef WGL_ATI_render_texture_rectangle if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture_rectangle", 24)) { ret = WGLEW_ATI_render_texture_rectangle; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"EXT_", 4)) { #ifdef WGL_EXT_create_context_es2_profile if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_es2_profile", 26)) { ret = WGLEW_EXT_create_context_es2_profile; continue; } #endif #ifdef WGL_EXT_create_context_es_profile if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_es_profile", 25)) { ret = WGLEW_EXT_create_context_es_profile; continue; } #endif #ifdef WGL_EXT_depth_float if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_float", 11)) { ret = WGLEW_EXT_depth_float; continue; } #endif #ifdef WGL_EXT_display_color_table if (_glewStrSame3(&pos, &len, (const GLubyte*)"display_color_table", 19)) { ret = WGLEW_EXT_display_color_table; continue; } #endif #ifdef WGL_EXT_extensions_string if (_glewStrSame3(&pos, &len, (const GLubyte*)"extensions_string", 17)) { ret = WGLEW_EXT_extensions_string; continue; } #endif #ifdef WGL_EXT_framebuffer_sRGB if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) { ret = WGLEW_EXT_framebuffer_sRGB; continue; } #endif #ifdef WGL_EXT_make_current_read if (_glewStrSame3(&pos, &len, (const GLubyte*)"make_current_read", 17)) { ret = WGLEW_EXT_make_current_read; continue; } #endif #ifdef WGL_EXT_multisample if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) { ret = WGLEW_EXT_multisample; continue; } #endif #ifdef WGL_EXT_pbuffer if (_glewStrSame3(&pos, &len, (const GLubyte*)"pbuffer", 7)) { ret = WGLEW_EXT_pbuffer; continue; } #endif #ifdef WGL_EXT_pixel_format if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format", 12)) { ret = WGLEW_EXT_pixel_format; continue; } #endif #ifdef WGL_EXT_pixel_format_packed_float if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format_packed_float", 25)) { ret = WGLEW_EXT_pixel_format_packed_float; continue; } #endif #ifdef WGL_EXT_swap_control if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12)) { ret = WGLEW_EXT_swap_control; continue; } #endif #ifdef WGL_EXT_swap_control_tear if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control_tear", 17)) { ret = WGLEW_EXT_swap_control_tear; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"I3D_", 4)) { #ifdef WGL_I3D_digital_video_control if (_glewStrSame3(&pos, &len, (const GLubyte*)"digital_video_control", 21)) { ret = WGLEW_I3D_digital_video_control; continue; } #endif #ifdef WGL_I3D_gamma if (_glewStrSame3(&pos, &len, (const GLubyte*)"gamma", 5)) { ret = WGLEW_I3D_gamma; continue; } #endif #ifdef WGL_I3D_genlock if (_glewStrSame3(&pos, &len, (const GLubyte*)"genlock", 7)) { ret = WGLEW_I3D_genlock; continue; } #endif #ifdef WGL_I3D_image_buffer if (_glewStrSame3(&pos, &len, (const GLubyte*)"image_buffer", 12)) { ret = WGLEW_I3D_image_buffer; continue; } #endif #ifdef WGL_I3D_swap_frame_lock if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_frame_lock", 15)) { ret = WGLEW_I3D_swap_frame_lock; continue; } #endif #ifdef WGL_I3D_swap_frame_usage if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_frame_usage", 16)) { ret = WGLEW_I3D_swap_frame_usage; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"NV_", 3)) { #ifdef WGL_NV_DX_interop if (_glewStrSame3(&pos, &len, (const GLubyte*)"DX_interop", 10)) { ret = WGLEW_NV_DX_interop; continue; } #endif #ifdef WGL_NV_DX_interop2 if (_glewStrSame3(&pos, &len, (const GLubyte*)"DX_interop2", 11)) { ret = WGLEW_NV_DX_interop2; continue; } #endif #ifdef WGL_NV_copy_image if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_image", 10)) { ret = WGLEW_NV_copy_image; continue; } #endif #ifdef WGL_NV_float_buffer if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_buffer", 12)) { ret = WGLEW_NV_float_buffer; continue; } #endif #ifdef WGL_NV_gpu_affinity if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_affinity", 12)) { ret = WGLEW_NV_gpu_affinity; continue; } #endif #ifdef WGL_NV_multisample_coverage if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample_coverage", 20)) { ret = WGLEW_NV_multisample_coverage; continue; } #endif #ifdef WGL_NV_present_video if (_glewStrSame3(&pos, &len, (const GLubyte*)"present_video", 13)) { ret = WGLEW_NV_present_video; continue; } #endif #ifdef WGL_NV_render_depth_texture if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_depth_texture", 20)) { ret = WGLEW_NV_render_depth_texture; continue; } #endif #ifdef WGL_NV_render_texture_rectangle if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture_rectangle", 24)) { ret = WGLEW_NV_render_texture_rectangle; continue; } #endif #ifdef WGL_NV_swap_group if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_group", 10)) { ret = WGLEW_NV_swap_group; continue; } #endif #ifdef WGL_NV_vertex_array_range if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18)) { ret = WGLEW_NV_vertex_array_range; continue; } #endif #ifdef WGL_NV_video_capture if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_capture", 13)) { ret = WGLEW_NV_video_capture; continue; } #endif #ifdef WGL_NV_video_output if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_output", 12)) { ret = WGLEW_NV_video_output; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"OML_", 4)) { #ifdef WGL_OML_sync_control if (_glewStrSame3(&pos, &len, (const GLubyte*)"sync_control", 12)) { ret = WGLEW_OML_sync_control; continue; } #endif } } ret = (len == 0); } return ret; } #elif !defined(__ANDROID__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX) #if defined(GLEW_MX) GLboolean glxewContextIsSupported (const GLXEWContext* ctx, const char* name) #else GLboolean glxewIsSupported (const char* name) #endif { GLubyte* pos = (GLubyte*)name; GLuint len = _glewStrLen(pos); GLboolean ret = GL_TRUE; while (ret && len > 0) { if(_glewStrSame1(&pos, &len, (const GLubyte*)"GLX_", 4)) { if (_glewStrSame2(&pos, &len, (const GLubyte*)"VERSION_", 8)) { #ifdef GLX_VERSION_1_2 if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_2", 3)) { ret = GLXEW_VERSION_1_2; continue; } #endif #ifdef GLX_VERSION_1_3 if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_3", 3)) { ret = GLXEW_VERSION_1_3; continue; } #endif #ifdef GLX_VERSION_1_4 if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_4", 3)) { ret = GLXEW_VERSION_1_4; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"3DFX_", 5)) { #ifdef GLX_3DFX_multisample if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) { ret = GLXEW_3DFX_multisample; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"AMD_", 4)) { #ifdef GLX_AMD_gpu_association if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_association", 15)) { ret = GLXEW_AMD_gpu_association; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"ARB_", 4)) { #ifdef GLX_ARB_create_context if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context", 14)) { ret = GLXEW_ARB_create_context; continue; } #endif #ifdef GLX_ARB_create_context_profile if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_profile", 22)) { ret = GLXEW_ARB_create_context_profile; continue; } #endif #ifdef GLX_ARB_create_context_robustness if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_robustness", 25)) { ret = GLXEW_ARB_create_context_robustness; continue; } #endif #ifdef GLX_ARB_fbconfig_float if (_glewStrSame3(&pos, &len, (const GLubyte*)"fbconfig_float", 14)) { ret = GLXEW_ARB_fbconfig_float; continue; } #endif #ifdef GLX_ARB_framebuffer_sRGB if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) { ret = GLXEW_ARB_framebuffer_sRGB; continue; } #endif #ifdef GLX_ARB_get_proc_address if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_proc_address", 16)) { ret = GLXEW_ARB_get_proc_address; continue; } #endif #ifdef GLX_ARB_multisample if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) { ret = GLXEW_ARB_multisample; continue; } #endif #ifdef GLX_ARB_robustness_application_isolation if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_application_isolation", 32)) { ret = GLXEW_ARB_robustness_application_isolation; continue; } #endif #ifdef GLX_ARB_robustness_share_group_isolation if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_share_group_isolation", 32)) { ret = GLXEW_ARB_robustness_share_group_isolation; continue; } #endif #ifdef GLX_ARB_vertex_buffer_object if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_buffer_object", 20)) { ret = GLXEW_ARB_vertex_buffer_object; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"ATI_", 4)) { #ifdef GLX_ATI_pixel_format_float if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format_float", 18)) { ret = GLXEW_ATI_pixel_format_float; continue; } #endif #ifdef GLX_ATI_render_texture if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture", 14)) { ret = GLXEW_ATI_render_texture; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"EXT_", 4)) { #ifdef GLX_EXT_create_context_es2_profile if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_es2_profile", 26)) { ret = GLXEW_EXT_create_context_es2_profile; continue; } #endif #ifdef GLX_EXT_create_context_es_profile if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_es_profile", 25)) { ret = GLXEW_EXT_create_context_es_profile; continue; } #endif #ifdef GLX_EXT_fbconfig_packed_float if (_glewStrSame3(&pos, &len, (const GLubyte*)"fbconfig_packed_float", 21)) { ret = GLXEW_EXT_fbconfig_packed_float; continue; } #endif #ifdef GLX_EXT_framebuffer_sRGB if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) { ret = GLXEW_EXT_framebuffer_sRGB; continue; } #endif #ifdef GLX_EXT_import_context if (_glewStrSame3(&pos, &len, (const GLubyte*)"import_context", 14)) { ret = GLXEW_EXT_import_context; continue; } #endif #ifdef GLX_EXT_scene_marker if (_glewStrSame3(&pos, &len, (const GLubyte*)"scene_marker", 12)) { ret = GLXEW_EXT_scene_marker; continue; } #endif #ifdef GLX_EXT_swap_control if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12)) { ret = GLXEW_EXT_swap_control; continue; } #endif #ifdef GLX_EXT_swap_control_tear if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control_tear", 17)) { ret = GLXEW_EXT_swap_control_tear; continue; } #endif #ifdef GLX_EXT_texture_from_pixmap if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_from_pixmap", 19)) { ret = GLXEW_EXT_texture_from_pixmap; continue; } #endif #ifdef GLX_EXT_visual_info if (_glewStrSame3(&pos, &len, (const GLubyte*)"visual_info", 11)) { ret = GLXEW_EXT_visual_info; continue; } #endif #ifdef GLX_EXT_visual_rating if (_glewStrSame3(&pos, &len, (const GLubyte*)"visual_rating", 13)) { ret = GLXEW_EXT_visual_rating; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"INTEL_", 6)) { #ifdef GLX_INTEL_swap_event if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_event", 10)) { ret = GLXEW_INTEL_swap_event; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"MESA_", 5)) { #ifdef GLX_MESA_agp_offset if (_glewStrSame3(&pos, &len, (const GLubyte*)"agp_offset", 10)) { ret = GLXEW_MESA_agp_offset; continue; } #endif #ifdef GLX_MESA_copy_sub_buffer if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_sub_buffer", 15)) { ret = GLXEW_MESA_copy_sub_buffer; continue; } #endif #ifdef GLX_MESA_pixmap_colormap if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixmap_colormap", 15)) { ret = GLXEW_MESA_pixmap_colormap; continue; } #endif #ifdef GLX_MESA_release_buffers if (_glewStrSame3(&pos, &len, (const GLubyte*)"release_buffers", 15)) { ret = GLXEW_MESA_release_buffers; continue; } #endif #ifdef GLX_MESA_set_3dfx_mode if (_glewStrSame3(&pos, &len, (const GLubyte*)"set_3dfx_mode", 13)) { ret = GLXEW_MESA_set_3dfx_mode; continue; } #endif #ifdef GLX_MESA_swap_control if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12)) { ret = GLXEW_MESA_swap_control; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"NV_", 3)) { #ifdef GLX_NV_copy_image if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_image", 10)) { ret = GLXEW_NV_copy_image; continue; } #endif #ifdef GLX_NV_float_buffer if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_buffer", 12)) { ret = GLXEW_NV_float_buffer; continue; } #endif #ifdef GLX_NV_multisample_coverage if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample_coverage", 20)) { ret = GLXEW_NV_multisample_coverage; continue; } #endif #ifdef GLX_NV_present_video if (_glewStrSame3(&pos, &len, (const GLubyte*)"present_video", 13)) { ret = GLXEW_NV_present_video; continue; } #endif #ifdef GLX_NV_swap_group if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_group", 10)) { ret = GLXEW_NV_swap_group; continue; } #endif #ifdef GLX_NV_vertex_array_range if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18)) { ret = GLXEW_NV_vertex_array_range; continue; } #endif #ifdef GLX_NV_video_capture if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_capture", 13)) { ret = GLXEW_NV_video_capture; continue; } #endif #ifdef GLX_NV_video_out if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_out", 9)) { ret = GLXEW_NV_video_out; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"OML_", 4)) { #ifdef GLX_OML_swap_method if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_method", 11)) { ret = GLXEW_OML_swap_method; continue; } #endif #ifdef GLX_OML_sync_control if (_glewStrSame3(&pos, &len, (const GLubyte*)"sync_control", 12)) { ret = GLXEW_OML_sync_control; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIS_", 5)) { #ifdef GLX_SGIS_blended_overlay if (_glewStrSame3(&pos, &len, (const GLubyte*)"blended_overlay", 15)) { ret = GLXEW_SGIS_blended_overlay; continue; } #endif #ifdef GLX_SGIS_color_range if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_range", 11)) { ret = GLXEW_SGIS_color_range; continue; } #endif #ifdef GLX_SGIS_multisample if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) { ret = GLXEW_SGIS_multisample; continue; } #endif #ifdef GLX_SGIS_shared_multisample if (_glewStrSame3(&pos, &len, (const GLubyte*)"shared_multisample", 18)) { ret = GLXEW_SGIS_shared_multisample; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIX_", 5)) { #ifdef GLX_SGIX_fbconfig if (_glewStrSame3(&pos, &len, (const GLubyte*)"fbconfig", 8)) { ret = GLXEW_SGIX_fbconfig; continue; } #endif #ifdef GLX_SGIX_hyperpipe if (_glewStrSame3(&pos, &len, (const GLubyte*)"hyperpipe", 9)) { ret = GLXEW_SGIX_hyperpipe; continue; } #endif #ifdef GLX_SGIX_pbuffer if (_glewStrSame3(&pos, &len, (const GLubyte*)"pbuffer", 7)) { ret = GLXEW_SGIX_pbuffer; continue; } #endif #ifdef GLX_SGIX_swap_barrier if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_barrier", 12)) { ret = GLXEW_SGIX_swap_barrier; continue; } #endif #ifdef GLX_SGIX_swap_group if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_group", 10)) { ret = GLXEW_SGIX_swap_group; continue; } #endif #ifdef GLX_SGIX_video_resize if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_resize", 12)) { ret = GLXEW_SGIX_video_resize; continue; } #endif #ifdef GLX_SGIX_visual_select_group if (_glewStrSame3(&pos, &len, (const GLubyte*)"visual_select_group", 19)) { ret = GLXEW_SGIX_visual_select_group; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGI_", 4)) { #ifdef GLX_SGI_cushion if (_glewStrSame3(&pos, &len, (const GLubyte*)"cushion", 7)) { ret = GLXEW_SGI_cushion; continue; } #endif #ifdef GLX_SGI_make_current_read if (_glewStrSame3(&pos, &len, (const GLubyte*)"make_current_read", 17)) { ret = GLXEW_SGI_make_current_read; continue; } #endif #ifdef GLX_SGI_swap_control if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12)) { ret = GLXEW_SGI_swap_control; continue; } #endif #ifdef GLX_SGI_video_sync if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_sync", 10)) { ret = GLXEW_SGI_video_sync; continue; } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"SUN_", 4)) { #ifdef GLX_SUN_get_transparent_index if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_transparent_index", 21)) { ret = GLXEW_SUN_get_transparent_index; continue; } #endif #ifdef GLX_SUN_video_resize if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_resize", 12)) { ret = GLXEW_SUN_video_resize; continue; } #endif } } ret = (len == 0); } return ret; } #endif /* _WIN32 */ ImageVis3D-3.1.0/Tuvok/3rdParty/GLEW/GL/glxew.h0000644000175000017500000020047312320456500020442 0ustar mathieumathieu/* ** The OpenGL Extension Wrangler Library ** Copyright (C) 2002-2008, Milan Ikits ** Copyright (C) 2002-2008, Marcelo E. Magallon ** Copyright (C) 2002, Lev Povalahev ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: ** ** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright notice, ** this list of conditions and the following disclaimer in the documentation ** and/or other materials provided with the distribution. ** * The name of the author may be used to endorse or promote products ** derived from this software without specific prior written permission. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF ** THE POSSIBILITY OF SUCH DAMAGE. */ /* * Mesa 3-D graphics library * Version: 7.0 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* ** Copyright (c) 2007 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including ** without limitation the rights to use, copy, modify, merge, publish, ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are furnished to do so, subject to ** the following conditions: ** ** The above copyright notice and this permission notice shall be included ** in all copies or substantial portions of the Materials. ** ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ #ifndef __glxew_h__ #define __glxew_h__ #define __GLXEW_H__ #ifdef __glxext_h_ #error glxext.h included before glxew.h #endif #if defined(GLX_H) || defined(__GLX_glx_h__) || defined(__glx_h__) #error glx.h included before glxew.h #endif #define __glxext_h_ #define GLX_H #define __GLX_glx_h__ #define __glx_h__ #include #include #include #include #ifdef __cplusplus extern "C" { #endif /* ---------------------------- GLX_VERSION_1_0 --------------------------- */ #ifndef GLX_VERSION_1_0 #define GLX_VERSION_1_0 1 #define GLX_USE_GL 1 #define GLX_BUFFER_SIZE 2 #define GLX_LEVEL 3 #define GLX_RGBA 4 #define GLX_DOUBLEBUFFER 5 #define GLX_STEREO 6 #define GLX_AUX_BUFFERS 7 #define GLX_RED_SIZE 8 #define GLX_GREEN_SIZE 9 #define GLX_BLUE_SIZE 10 #define GLX_ALPHA_SIZE 11 #define GLX_DEPTH_SIZE 12 #define GLX_STENCIL_SIZE 13 #define GLX_ACCUM_RED_SIZE 14 #define GLX_ACCUM_GREEN_SIZE 15 #define GLX_ACCUM_BLUE_SIZE 16 #define GLX_ACCUM_ALPHA_SIZE 17 #define GLX_BAD_SCREEN 1 #define GLX_BAD_ATTRIBUTE 2 #define GLX_NO_EXTENSION 3 #define GLX_BAD_VISUAL 4 #define GLX_BAD_CONTEXT 5 #define GLX_BAD_VALUE 6 #define GLX_BAD_ENUM 7 typedef XID GLXDrawable; typedef XID GLXPixmap; #ifdef __sun typedef struct __glXContextRec *GLXContext; #else typedef struct __GLXcontextRec *GLXContext; #endif typedef unsigned int GLXVideoDeviceNV; extern Bool glXQueryExtension (Display *dpy, int *errorBase, int *eventBase); extern Bool glXQueryVersion (Display *dpy, int *major, int *minor); extern int glXGetConfig (Display *dpy, XVisualInfo *vis, int attrib, int *value); extern XVisualInfo* glXChooseVisual (Display *dpy, int screen, int *attribList); extern GLXPixmap glXCreateGLXPixmap (Display *dpy, XVisualInfo *vis, Pixmap pixmap); extern void glXDestroyGLXPixmap (Display *dpy, GLXPixmap pix); extern GLXContext glXCreateContext (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct); extern void glXDestroyContext (Display *dpy, GLXContext ctx); extern Bool glXIsDirect (Display *dpy, GLXContext ctx); extern void glXCopyContext (Display *dpy, GLXContext src, GLXContext dst, GLulong mask); extern Bool glXMakeCurrent (Display *dpy, GLXDrawable drawable, GLXContext ctx); extern GLXContext glXGetCurrentContext (void); extern GLXDrawable glXGetCurrentDrawable (void); extern void glXWaitGL (void); extern void glXWaitX (void); extern void glXSwapBuffers (Display *dpy, GLXDrawable drawable); extern void glXUseXFont (Font font, int first, int count, int listBase); #define GLXEW_VERSION_1_0 GLXEW_GET_VAR(__GLXEW_VERSION_1_0) #endif /* GLX_VERSION_1_0 */ /* ---------------------------- GLX_VERSION_1_1 --------------------------- */ #ifndef GLX_VERSION_1_1 #define GLX_VERSION_1_1 #define GLX_VENDOR 0x1 #define GLX_VERSION 0x2 #define GLX_EXTENSIONS 0x3 extern const char* glXQueryExtensionsString (Display *dpy, int screen); extern const char* glXGetClientString (Display *dpy, int name); extern const char* glXQueryServerString (Display *dpy, int screen, int name); #define GLXEW_VERSION_1_1 GLXEW_GET_VAR(__GLXEW_VERSION_1_1) #endif /* GLX_VERSION_1_1 */ /* ---------------------------- GLX_VERSION_1_2 ---------------------------- */ #ifndef GLX_VERSION_1_2 #define GLX_VERSION_1_2 1 typedef Display* ( * PFNGLXGETCURRENTDISPLAYPROC) (void); #define glXGetCurrentDisplay GLXEW_GET_FUN(__glewXGetCurrentDisplay) #define GLXEW_VERSION_1_2 GLXEW_GET_VAR(__GLXEW_VERSION_1_2) #endif /* GLX_VERSION_1_2 */ /* ---------------------------- GLX_VERSION_1_3 ---------------------------- */ #ifndef GLX_VERSION_1_3 #define GLX_VERSION_1_3 1 #define GLX_RGBA_BIT 0x00000001 #define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 #define GLX_WINDOW_BIT 0x00000001 #define GLX_COLOR_INDEX_BIT 0x00000002 #define GLX_PIXMAP_BIT 0x00000002 #define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 #define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 #define GLX_PBUFFER_BIT 0x00000004 #define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 #define GLX_AUX_BUFFERS_BIT 0x00000010 #define GLX_CONFIG_CAVEAT 0x20 #define GLX_DEPTH_BUFFER_BIT 0x00000020 #define GLX_X_VISUAL_TYPE 0x22 #define GLX_TRANSPARENT_TYPE 0x23 #define GLX_TRANSPARENT_INDEX_VALUE 0x24 #define GLX_TRANSPARENT_RED_VALUE 0x25 #define GLX_TRANSPARENT_GREEN_VALUE 0x26 #define GLX_TRANSPARENT_BLUE_VALUE 0x27 #define GLX_TRANSPARENT_ALPHA_VALUE 0x28 #define GLX_STENCIL_BUFFER_BIT 0x00000040 #define GLX_ACCUM_BUFFER_BIT 0x00000080 #define GLX_NONE 0x8000 #define GLX_SLOW_CONFIG 0x8001 #define GLX_TRUE_COLOR 0x8002 #define GLX_DIRECT_COLOR 0x8003 #define GLX_PSEUDO_COLOR 0x8004 #define GLX_STATIC_COLOR 0x8005 #define GLX_GRAY_SCALE 0x8006 #define GLX_STATIC_GRAY 0x8007 #define GLX_TRANSPARENT_RGB 0x8008 #define GLX_TRANSPARENT_INDEX 0x8009 #define GLX_VISUAL_ID 0x800B #define GLX_SCREEN 0x800C #define GLX_NON_CONFORMANT_CONFIG 0x800D #define GLX_DRAWABLE_TYPE 0x8010 #define GLX_RENDER_TYPE 0x8011 #define GLX_X_RENDERABLE 0x8012 #define GLX_FBCONFIG_ID 0x8013 #define GLX_RGBA_TYPE 0x8014 #define GLX_COLOR_INDEX_TYPE 0x8015 #define GLX_MAX_PBUFFER_WIDTH 0x8016 #define GLX_MAX_PBUFFER_HEIGHT 0x8017 #define GLX_MAX_PBUFFER_PIXELS 0x8018 #define GLX_PRESERVED_CONTENTS 0x801B #define GLX_LARGEST_PBUFFER 0x801C #define GLX_WIDTH 0x801D #define GLX_HEIGHT 0x801E #define GLX_EVENT_MASK 0x801F #define GLX_DAMAGED 0x8020 #define GLX_SAVED 0x8021 #define GLX_WINDOW 0x8022 #define GLX_PBUFFER 0x8023 #define GLX_PBUFFER_HEIGHT 0x8040 #define GLX_PBUFFER_WIDTH 0x8041 #define GLX_PBUFFER_CLOBBER_MASK 0x08000000 #define GLX_DONT_CARE 0xFFFFFFFF typedef XID GLXFBConfigID; typedef XID GLXPbuffer; typedef XID GLXWindow; typedef struct __GLXFBConfigRec *GLXFBConfig; typedef struct { int event_type; int draw_type; unsigned long serial; Bool send_event; Display *display; GLXDrawable drawable; unsigned int buffer_mask; unsigned int aux_buffer; int x, y; int width, height; int count; } GLXPbufferClobberEvent; typedef union __GLXEvent { GLXPbufferClobberEvent glxpbufferclobber; long pad[24]; } GLXEvent; typedef GLXFBConfig* ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); typedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); typedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list); typedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); typedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); typedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf); typedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap); typedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win); typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void); typedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value); typedef GLXFBConfig* ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements); typedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask); typedef XVisualInfo* ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config); typedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *display, GLXDrawable draw, GLXDrawable read, GLXContext ctx); typedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); typedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); typedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask); #define glXChooseFBConfig GLXEW_GET_FUN(__glewXChooseFBConfig) #define glXCreateNewContext GLXEW_GET_FUN(__glewXCreateNewContext) #define glXCreatePbuffer GLXEW_GET_FUN(__glewXCreatePbuffer) #define glXCreatePixmap GLXEW_GET_FUN(__glewXCreatePixmap) #define glXCreateWindow GLXEW_GET_FUN(__glewXCreateWindow) #define glXDestroyPbuffer GLXEW_GET_FUN(__glewXDestroyPbuffer) #define glXDestroyPixmap GLXEW_GET_FUN(__glewXDestroyPixmap) #define glXDestroyWindow GLXEW_GET_FUN(__glewXDestroyWindow) #define glXGetCurrentReadDrawable GLXEW_GET_FUN(__glewXGetCurrentReadDrawable) #define glXGetFBConfigAttrib GLXEW_GET_FUN(__glewXGetFBConfigAttrib) #define glXGetFBConfigs GLXEW_GET_FUN(__glewXGetFBConfigs) #define glXGetSelectedEvent GLXEW_GET_FUN(__glewXGetSelectedEvent) #define glXGetVisualFromFBConfig GLXEW_GET_FUN(__glewXGetVisualFromFBConfig) #define glXMakeContextCurrent GLXEW_GET_FUN(__glewXMakeContextCurrent) #define glXQueryContext GLXEW_GET_FUN(__glewXQueryContext) #define glXQueryDrawable GLXEW_GET_FUN(__glewXQueryDrawable) #define glXSelectEvent GLXEW_GET_FUN(__glewXSelectEvent) #define GLXEW_VERSION_1_3 GLXEW_GET_VAR(__GLXEW_VERSION_1_3) #endif /* GLX_VERSION_1_3 */ /* ---------------------------- GLX_VERSION_1_4 ---------------------------- */ #ifndef GLX_VERSION_1_4 #define GLX_VERSION_1_4 1 #define GLX_SAMPLE_BUFFERS 100000 #define GLX_SAMPLES 100001 extern void ( * glXGetProcAddress (const GLubyte *procName)) (void); #define GLXEW_VERSION_1_4 GLXEW_GET_VAR(__GLXEW_VERSION_1_4) #endif /* GLX_VERSION_1_4 */ /* -------------------------- GLX_3DFX_multisample ------------------------- */ #ifndef GLX_3DFX_multisample #define GLX_3DFX_multisample 1 #define GLX_SAMPLE_BUFFERS_3DFX 0x8050 #define GLX_SAMPLES_3DFX 0x8051 #define GLXEW_3DFX_multisample GLXEW_GET_VAR(__GLXEW_3DFX_multisample) #endif /* GLX_3DFX_multisample */ /* ------------------------ GLX_AMD_gpu_association ------------------------ */ #ifndef GLX_AMD_gpu_association #define GLX_AMD_gpu_association 1 #define GLX_GPU_VENDOR_AMD 0x1F00 #define GLX_GPU_RENDERER_STRING_AMD 0x1F01 #define GLX_GPU_OPENGL_VERSION_STRING_AMD 0x1F02 #define GLX_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2 #define GLX_GPU_RAM_AMD 0x21A3 #define GLX_GPU_CLOCK_AMD 0x21A4 #define GLX_GPU_NUM_PIPES_AMD 0x21A5 #define GLX_GPU_NUM_SIMD_AMD 0x21A6 #define GLX_GPU_NUM_RB_AMD 0x21A7 #define GLX_GPU_NUM_SPI_AMD 0x21A8 #define GLXEW_AMD_gpu_association GLXEW_GET_VAR(__GLXEW_AMD_gpu_association) #endif /* GLX_AMD_gpu_association */ /* ------------------------- GLX_ARB_create_context ------------------------ */ #ifndef GLX_ARB_create_context #define GLX_ARB_create_context 1 #define GLX_CONTEXT_DEBUG_BIT_ARB 0x0001 #define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 #define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 #define GLX_CONTEXT_FLAGS_ARB 0x2094 typedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display* dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list); #define glXCreateContextAttribsARB GLXEW_GET_FUN(__glewXCreateContextAttribsARB) #define GLXEW_ARB_create_context GLXEW_GET_VAR(__GLXEW_ARB_create_context) #endif /* GLX_ARB_create_context */ /* --------------------- GLX_ARB_create_context_profile -------------------- */ #ifndef GLX_ARB_create_context_profile #define GLX_ARB_create_context_profile 1 #define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 #define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 #define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126 #define GLXEW_ARB_create_context_profile GLXEW_GET_VAR(__GLXEW_ARB_create_context_profile) #endif /* GLX_ARB_create_context_profile */ /* ------------------- GLX_ARB_create_context_robustness ------------------- */ #ifndef GLX_ARB_create_context_robustness #define GLX_ARB_create_context_robustness 1 #define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 #define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252 #define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 #define GLX_NO_RESET_NOTIFICATION_ARB 0x8261 #define GLXEW_ARB_create_context_robustness GLXEW_GET_VAR(__GLXEW_ARB_create_context_robustness) #endif /* GLX_ARB_create_context_robustness */ /* ------------------------- GLX_ARB_fbconfig_float ------------------------ */ #ifndef GLX_ARB_fbconfig_float #define GLX_ARB_fbconfig_float 1 #define GLX_RGBA_FLOAT_BIT 0x00000004 #define GLX_RGBA_FLOAT_TYPE 0x20B9 #define GLXEW_ARB_fbconfig_float GLXEW_GET_VAR(__GLXEW_ARB_fbconfig_float) #endif /* GLX_ARB_fbconfig_float */ /* ------------------------ GLX_ARB_framebuffer_sRGB ----------------------- */ #ifndef GLX_ARB_framebuffer_sRGB #define GLX_ARB_framebuffer_sRGB 1 #define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2 #define GLXEW_ARB_framebuffer_sRGB GLXEW_GET_VAR(__GLXEW_ARB_framebuffer_sRGB) #endif /* GLX_ARB_framebuffer_sRGB */ /* ------------------------ GLX_ARB_get_proc_address ----------------------- */ #ifndef GLX_ARB_get_proc_address #define GLX_ARB_get_proc_address 1 extern void ( * glXGetProcAddressARB (const GLubyte *procName)) (void); #define GLXEW_ARB_get_proc_address GLXEW_GET_VAR(__GLXEW_ARB_get_proc_address) #endif /* GLX_ARB_get_proc_address */ /* -------------------------- GLX_ARB_multisample -------------------------- */ #ifndef GLX_ARB_multisample #define GLX_ARB_multisample 1 #define GLX_SAMPLE_BUFFERS_ARB 100000 #define GLX_SAMPLES_ARB 100001 #define GLXEW_ARB_multisample GLXEW_GET_VAR(__GLXEW_ARB_multisample) #endif /* GLX_ARB_multisample */ /* ---------------- GLX_ARB_robustness_application_isolation --------------- */ #ifndef GLX_ARB_robustness_application_isolation #define GLX_ARB_robustness_application_isolation 1 #define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008 #define GLXEW_ARB_robustness_application_isolation GLXEW_GET_VAR(__GLXEW_ARB_robustness_application_isolation) #endif /* GLX_ARB_robustness_application_isolation */ /* ---------------- GLX_ARB_robustness_share_group_isolation --------------- */ #ifndef GLX_ARB_robustness_share_group_isolation #define GLX_ARB_robustness_share_group_isolation 1 #define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008 #define GLXEW_ARB_robustness_share_group_isolation GLXEW_GET_VAR(__GLXEW_ARB_robustness_share_group_isolation) #endif /* GLX_ARB_robustness_share_group_isolation */ /* ---------------------- GLX_ARB_vertex_buffer_object --------------------- */ #ifndef GLX_ARB_vertex_buffer_object #define GLX_ARB_vertex_buffer_object 1 #define GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB 0x2095 #define GLXEW_ARB_vertex_buffer_object GLXEW_GET_VAR(__GLXEW_ARB_vertex_buffer_object) #endif /* GLX_ARB_vertex_buffer_object */ /* ----------------------- GLX_ATI_pixel_format_float ---------------------- */ #ifndef GLX_ATI_pixel_format_float #define GLX_ATI_pixel_format_float 1 #define GLX_RGBA_FLOAT_ATI_BIT 0x00000100 #define GLXEW_ATI_pixel_format_float GLXEW_GET_VAR(__GLXEW_ATI_pixel_format_float) #endif /* GLX_ATI_pixel_format_float */ /* ------------------------- GLX_ATI_render_texture ------------------------ */ #ifndef GLX_ATI_render_texture #define GLX_ATI_render_texture 1 #define GLX_BIND_TO_TEXTURE_RGB_ATI 0x9800 #define GLX_BIND_TO_TEXTURE_RGBA_ATI 0x9801 #define GLX_TEXTURE_FORMAT_ATI 0x9802 #define GLX_TEXTURE_TARGET_ATI 0x9803 #define GLX_MIPMAP_TEXTURE_ATI 0x9804 #define GLX_TEXTURE_RGB_ATI 0x9805 #define GLX_TEXTURE_RGBA_ATI 0x9806 #define GLX_NO_TEXTURE_ATI 0x9807 #define GLX_TEXTURE_CUBE_MAP_ATI 0x9808 #define GLX_TEXTURE_1D_ATI 0x9809 #define GLX_TEXTURE_2D_ATI 0x980A #define GLX_MIPMAP_LEVEL_ATI 0x980B #define GLX_CUBE_MAP_FACE_ATI 0x980C #define GLX_TEXTURE_CUBE_MAP_POSITIVE_X_ATI 0x980D #define GLX_TEXTURE_CUBE_MAP_NEGATIVE_X_ATI 0x980E #define GLX_TEXTURE_CUBE_MAP_POSITIVE_Y_ATI 0x980F #define GLX_TEXTURE_CUBE_MAP_NEGATIVE_Y_ATI 0x9810 #define GLX_TEXTURE_CUBE_MAP_POSITIVE_Z_ATI 0x9811 #define GLX_TEXTURE_CUBE_MAP_NEGATIVE_Z_ATI 0x9812 #define GLX_FRONT_LEFT_ATI 0x9813 #define GLX_FRONT_RIGHT_ATI 0x9814 #define GLX_BACK_LEFT_ATI 0x9815 #define GLX_BACK_RIGHT_ATI 0x9816 #define GLX_AUX0_ATI 0x9817 #define GLX_AUX1_ATI 0x9818 #define GLX_AUX2_ATI 0x9819 #define GLX_AUX3_ATI 0x981A #define GLX_AUX4_ATI 0x981B #define GLX_AUX5_ATI 0x981C #define GLX_AUX6_ATI 0x981D #define GLX_AUX7_ATI 0x981E #define GLX_AUX8_ATI 0x981F #define GLX_AUX9_ATI 0x9820 #define GLX_BIND_TO_TEXTURE_LUMINANCE_ATI 0x9821 #define GLX_BIND_TO_TEXTURE_INTENSITY_ATI 0x9822 typedef void ( * PFNGLXBINDTEXIMAGEATIPROC) (Display *dpy, GLXPbuffer pbuf, int buffer); typedef void ( * PFNGLXDRAWABLEATTRIBATIPROC) (Display *dpy, GLXDrawable draw, const int *attrib_list); typedef void ( * PFNGLXRELEASETEXIMAGEATIPROC) (Display *dpy, GLXPbuffer pbuf, int buffer); #define glXBindTexImageATI GLXEW_GET_FUN(__glewXBindTexImageATI) #define glXDrawableAttribATI GLXEW_GET_FUN(__glewXDrawableAttribATI) #define glXReleaseTexImageATI GLXEW_GET_FUN(__glewXReleaseTexImageATI) #define GLXEW_ATI_render_texture GLXEW_GET_VAR(__GLXEW_ATI_render_texture) #endif /* GLX_ATI_render_texture */ /* ------------------- GLX_EXT_create_context_es2_profile ------------------ */ #ifndef GLX_EXT_create_context_es2_profile #define GLX_EXT_create_context_es2_profile 1 #define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 #define GLXEW_EXT_create_context_es2_profile GLXEW_GET_VAR(__GLXEW_EXT_create_context_es2_profile) #endif /* GLX_EXT_create_context_es2_profile */ /* ------------------- GLX_EXT_create_context_es_profile ------------------- */ #ifndef GLX_EXT_create_context_es_profile #define GLX_EXT_create_context_es_profile 1 #define GLX_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004 #define GLXEW_EXT_create_context_es_profile GLXEW_GET_VAR(__GLXEW_EXT_create_context_es_profile) #endif /* GLX_EXT_create_context_es_profile */ /* --------------------- GLX_EXT_fbconfig_packed_float --------------------- */ #ifndef GLX_EXT_fbconfig_packed_float #define GLX_EXT_fbconfig_packed_float 1 #define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008 #define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1 #define GLXEW_EXT_fbconfig_packed_float GLXEW_GET_VAR(__GLXEW_EXT_fbconfig_packed_float) #endif /* GLX_EXT_fbconfig_packed_float */ /* ------------------------ GLX_EXT_framebuffer_sRGB ----------------------- */ #ifndef GLX_EXT_framebuffer_sRGB #define GLX_EXT_framebuffer_sRGB 1 #define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2 #define GLXEW_EXT_framebuffer_sRGB GLXEW_GET_VAR(__GLXEW_EXT_framebuffer_sRGB) #endif /* GLX_EXT_framebuffer_sRGB */ /* ------------------------- GLX_EXT_import_context ------------------------ */ #ifndef GLX_EXT_import_context #define GLX_EXT_import_context 1 #define GLX_SHARE_CONTEXT_EXT 0x800A #define GLX_VISUAL_ID_EXT 0x800B #define GLX_SCREEN_EXT 0x800C typedef XID GLXContextID; typedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display* dpy, GLXContext context); typedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context); typedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display* dpy, GLXContextID contextID); typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display* dpy, GLXContext context, int attribute,int *value); #define glXFreeContextEXT GLXEW_GET_FUN(__glewXFreeContextEXT) #define glXGetContextIDEXT GLXEW_GET_FUN(__glewXGetContextIDEXT) #define glXImportContextEXT GLXEW_GET_FUN(__glewXImportContextEXT) #define glXQueryContextInfoEXT GLXEW_GET_FUN(__glewXQueryContextInfoEXT) #define GLXEW_EXT_import_context GLXEW_GET_VAR(__GLXEW_EXT_import_context) #endif /* GLX_EXT_import_context */ /* -------------------------- GLX_EXT_scene_marker ------------------------- */ #ifndef GLX_EXT_scene_marker #define GLX_EXT_scene_marker 1 #define GLXEW_EXT_scene_marker GLXEW_GET_VAR(__GLXEW_EXT_scene_marker) #endif /* GLX_EXT_scene_marker */ /* -------------------------- GLX_EXT_swap_control ------------------------- */ #ifndef GLX_EXT_swap_control #define GLX_EXT_swap_control 1 #define GLX_SWAP_INTERVAL_EXT 0x20F1 #define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2 typedef void ( * PFNGLXSWAPINTERVALEXTPROC) (Display* dpy, GLXDrawable drawable, int interval); #define glXSwapIntervalEXT GLXEW_GET_FUN(__glewXSwapIntervalEXT) #define GLXEW_EXT_swap_control GLXEW_GET_VAR(__GLXEW_EXT_swap_control) #endif /* GLX_EXT_swap_control */ /* ----------------------- GLX_EXT_swap_control_tear ----------------------- */ #ifndef GLX_EXT_swap_control_tear #define GLX_EXT_swap_control_tear 1 #define GLX_LATE_SWAPS_TEAR_EXT 0x20F3 #define GLXEW_EXT_swap_control_tear GLXEW_GET_VAR(__GLXEW_EXT_swap_control_tear) #endif /* GLX_EXT_swap_control_tear */ /* ---------------------- GLX_EXT_texture_from_pixmap ---------------------- */ #ifndef GLX_EXT_texture_from_pixmap #define GLX_EXT_texture_from_pixmap 1 #define GLX_TEXTURE_1D_BIT_EXT 0x00000001 #define GLX_TEXTURE_2D_BIT_EXT 0x00000002 #define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 #define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 #define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 #define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 #define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 #define GLX_Y_INVERTED_EXT 0x20D4 #define GLX_TEXTURE_FORMAT_EXT 0x20D5 #define GLX_TEXTURE_TARGET_EXT 0x20D6 #define GLX_MIPMAP_TEXTURE_EXT 0x20D7 #define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8 #define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9 #define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA #define GLX_TEXTURE_1D_EXT 0x20DB #define GLX_TEXTURE_2D_EXT 0x20DC #define GLX_TEXTURE_RECTANGLE_EXT 0x20DD #define GLX_FRONT_LEFT_EXT 0x20DE #define GLX_FRONT_RIGHT_EXT 0x20DF #define GLX_BACK_LEFT_EXT 0x20E0 #define GLX_BACK_RIGHT_EXT 0x20E1 #define GLX_AUX0_EXT 0x20E2 #define GLX_AUX1_EXT 0x20E3 #define GLX_AUX2_EXT 0x20E4 #define GLX_AUX3_EXT 0x20E5 #define GLX_AUX4_EXT 0x20E6 #define GLX_AUX5_EXT 0x20E7 #define GLX_AUX6_EXT 0x20E8 #define GLX_AUX7_EXT 0x20E9 #define GLX_AUX8_EXT 0x20EA #define GLX_AUX9_EXT 0x20EB typedef void ( * PFNGLXBINDTEXIMAGEEXTPROC) (Display* display, GLXDrawable drawable, int buffer, const int *attrib_list); typedef void ( * PFNGLXRELEASETEXIMAGEEXTPROC) (Display* display, GLXDrawable drawable, int buffer); #define glXBindTexImageEXT GLXEW_GET_FUN(__glewXBindTexImageEXT) #define glXReleaseTexImageEXT GLXEW_GET_FUN(__glewXReleaseTexImageEXT) #define GLXEW_EXT_texture_from_pixmap GLXEW_GET_VAR(__GLXEW_EXT_texture_from_pixmap) #endif /* GLX_EXT_texture_from_pixmap */ /* -------------------------- GLX_EXT_visual_info -------------------------- */ #ifndef GLX_EXT_visual_info #define GLX_EXT_visual_info 1 #define GLX_X_VISUAL_TYPE_EXT 0x22 #define GLX_TRANSPARENT_TYPE_EXT 0x23 #define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 #define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 #define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 #define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 #define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 #define GLX_NONE_EXT 0x8000 #define GLX_TRUE_COLOR_EXT 0x8002 #define GLX_DIRECT_COLOR_EXT 0x8003 #define GLX_PSEUDO_COLOR_EXT 0x8004 #define GLX_STATIC_COLOR_EXT 0x8005 #define GLX_GRAY_SCALE_EXT 0x8006 #define GLX_STATIC_GRAY_EXT 0x8007 #define GLX_TRANSPARENT_RGB_EXT 0x8008 #define GLX_TRANSPARENT_INDEX_EXT 0x8009 #define GLXEW_EXT_visual_info GLXEW_GET_VAR(__GLXEW_EXT_visual_info) #endif /* GLX_EXT_visual_info */ /* ------------------------- GLX_EXT_visual_rating ------------------------- */ #ifndef GLX_EXT_visual_rating #define GLX_EXT_visual_rating 1 #define GLX_VISUAL_CAVEAT_EXT 0x20 #define GLX_SLOW_VISUAL_EXT 0x8001 #define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D #define GLXEW_EXT_visual_rating GLXEW_GET_VAR(__GLXEW_EXT_visual_rating) #endif /* GLX_EXT_visual_rating */ /* -------------------------- GLX_INTEL_swap_event ------------------------- */ #ifndef GLX_INTEL_swap_event #define GLX_INTEL_swap_event 1 #define GLX_EXCHANGE_COMPLETE_INTEL 0x8180 #define GLX_COPY_COMPLETE_INTEL 0x8181 #define GLX_FLIP_COMPLETE_INTEL 0x8182 #define GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK 0x04000000 #define GLXEW_INTEL_swap_event GLXEW_GET_VAR(__GLXEW_INTEL_swap_event) #endif /* GLX_INTEL_swap_event */ /* -------------------------- GLX_MESA_agp_offset -------------------------- */ #ifndef GLX_MESA_agp_offset #define GLX_MESA_agp_offset 1 typedef unsigned int ( * PFNGLXGETAGPOFFSETMESAPROC) (const void* pointer); #define glXGetAGPOffsetMESA GLXEW_GET_FUN(__glewXGetAGPOffsetMESA) #define GLXEW_MESA_agp_offset GLXEW_GET_VAR(__GLXEW_MESA_agp_offset) #endif /* GLX_MESA_agp_offset */ /* ------------------------ GLX_MESA_copy_sub_buffer ----------------------- */ #ifndef GLX_MESA_copy_sub_buffer #define GLX_MESA_copy_sub_buffer 1 typedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display* dpy, GLXDrawable drawable, int x, int y, int width, int height); #define glXCopySubBufferMESA GLXEW_GET_FUN(__glewXCopySubBufferMESA) #define GLXEW_MESA_copy_sub_buffer GLXEW_GET_VAR(__GLXEW_MESA_copy_sub_buffer) #endif /* GLX_MESA_copy_sub_buffer */ /* ------------------------ GLX_MESA_pixmap_colormap ----------------------- */ #ifndef GLX_MESA_pixmap_colormap #define GLX_MESA_pixmap_colormap 1 typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display* dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap); #define glXCreateGLXPixmapMESA GLXEW_GET_FUN(__glewXCreateGLXPixmapMESA) #define GLXEW_MESA_pixmap_colormap GLXEW_GET_VAR(__GLXEW_MESA_pixmap_colormap) #endif /* GLX_MESA_pixmap_colormap */ /* ------------------------ GLX_MESA_release_buffers ----------------------- */ #ifndef GLX_MESA_release_buffers #define GLX_MESA_release_buffers 1 typedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display* dpy, GLXDrawable d); #define glXReleaseBuffersMESA GLXEW_GET_FUN(__glewXReleaseBuffersMESA) #define GLXEW_MESA_release_buffers GLXEW_GET_VAR(__GLXEW_MESA_release_buffers) #endif /* GLX_MESA_release_buffers */ /* ------------------------- GLX_MESA_set_3dfx_mode ------------------------ */ #ifndef GLX_MESA_set_3dfx_mode #define GLX_MESA_set_3dfx_mode 1 #define GLX_3DFX_WINDOW_MODE_MESA 0x1 #define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 typedef GLboolean ( * PFNGLXSET3DFXMODEMESAPROC) (GLint mode); #define glXSet3DfxModeMESA GLXEW_GET_FUN(__glewXSet3DfxModeMESA) #define GLXEW_MESA_set_3dfx_mode GLXEW_GET_VAR(__GLXEW_MESA_set_3dfx_mode) #endif /* GLX_MESA_set_3dfx_mode */ /* ------------------------- GLX_MESA_swap_control ------------------------- */ #ifndef GLX_MESA_swap_control #define GLX_MESA_swap_control 1 typedef int ( * PFNGLXGETSWAPINTERVALMESAPROC) (void); typedef int ( * PFNGLXSWAPINTERVALMESAPROC) (unsigned int interval); #define glXGetSwapIntervalMESA GLXEW_GET_FUN(__glewXGetSwapIntervalMESA) #define glXSwapIntervalMESA GLXEW_GET_FUN(__glewXSwapIntervalMESA) #define GLXEW_MESA_swap_control GLXEW_GET_VAR(__GLXEW_MESA_swap_control) #endif /* GLX_MESA_swap_control */ /* --------------------------- GLX_NV_copy_image --------------------------- */ #ifndef GLX_NV_copy_image #define GLX_NV_copy_image 1 typedef void ( * PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); #define glXCopyImageSubDataNV GLXEW_GET_FUN(__glewXCopyImageSubDataNV) #define GLXEW_NV_copy_image GLXEW_GET_VAR(__GLXEW_NV_copy_image) #endif /* GLX_NV_copy_image */ /* -------------------------- GLX_NV_float_buffer -------------------------- */ #ifndef GLX_NV_float_buffer #define GLX_NV_float_buffer 1 #define GLX_FLOAT_COMPONENTS_NV 0x20B0 #define GLXEW_NV_float_buffer GLXEW_GET_VAR(__GLXEW_NV_float_buffer) #endif /* GLX_NV_float_buffer */ /* ---------------------- GLX_NV_multisample_coverage ---------------------- */ #ifndef GLX_NV_multisample_coverage #define GLX_NV_multisample_coverage 1 #define GLX_COLOR_SAMPLES_NV 0x20B3 #define GLX_COVERAGE_SAMPLES_NV 100001 #define GLXEW_NV_multisample_coverage GLXEW_GET_VAR(__GLXEW_NV_multisample_coverage) #endif /* GLX_NV_multisample_coverage */ /* -------------------------- GLX_NV_present_video ------------------------- */ #ifndef GLX_NV_present_video #define GLX_NV_present_video 1 #define GLX_NUM_VIDEO_SLOTS_NV 0x20F0 typedef int ( * PFNGLXBINDVIDEODEVICENVPROC) (Display* dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list); typedef unsigned int* ( * PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int screen, int *nelements); #define glXBindVideoDeviceNV GLXEW_GET_FUN(__glewXBindVideoDeviceNV) #define glXEnumerateVideoDevicesNV GLXEW_GET_FUN(__glewXEnumerateVideoDevicesNV) #define GLXEW_NV_present_video GLXEW_GET_VAR(__GLXEW_NV_present_video) #endif /* GLX_NV_present_video */ /* --------------------------- GLX_NV_swap_group --------------------------- */ #ifndef GLX_NV_swap_group #define GLX_NV_swap_group 1 typedef Bool ( * PFNGLXBINDSWAPBARRIERNVPROC) (Display* dpy, GLuint group, GLuint barrier); typedef Bool ( * PFNGLXJOINSWAPGROUPNVPROC) (Display* dpy, GLXDrawable drawable, GLuint group); typedef Bool ( * PFNGLXQUERYFRAMECOUNTNVPROC) (Display* dpy, int screen, GLuint *count); typedef Bool ( * PFNGLXQUERYMAXSWAPGROUPSNVPROC) (Display* dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers); typedef Bool ( * PFNGLXQUERYSWAPGROUPNVPROC) (Display* dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier); typedef Bool ( * PFNGLXRESETFRAMECOUNTNVPROC) (Display* dpy, int screen); #define glXBindSwapBarrierNV GLXEW_GET_FUN(__glewXBindSwapBarrierNV) #define glXJoinSwapGroupNV GLXEW_GET_FUN(__glewXJoinSwapGroupNV) #define glXQueryFrameCountNV GLXEW_GET_FUN(__glewXQueryFrameCountNV) #define glXQueryMaxSwapGroupsNV GLXEW_GET_FUN(__glewXQueryMaxSwapGroupsNV) #define glXQuerySwapGroupNV GLXEW_GET_FUN(__glewXQuerySwapGroupNV) #define glXResetFrameCountNV GLXEW_GET_FUN(__glewXResetFrameCountNV) #define GLXEW_NV_swap_group GLXEW_GET_VAR(__GLXEW_NV_swap_group) #endif /* GLX_NV_swap_group */ /* ----------------------- GLX_NV_vertex_array_range ----------------------- */ #ifndef GLX_NV_vertex_array_range #define GLX_NV_vertex_array_range 1 typedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority); typedef void ( * PFNGLXFREEMEMORYNVPROC) (void *pointer); #define glXAllocateMemoryNV GLXEW_GET_FUN(__glewXAllocateMemoryNV) #define glXFreeMemoryNV GLXEW_GET_FUN(__glewXFreeMemoryNV) #define GLXEW_NV_vertex_array_range GLXEW_GET_VAR(__GLXEW_NV_vertex_array_range) #endif /* GLX_NV_vertex_array_range */ /* -------------------------- GLX_NV_video_capture ------------------------- */ #ifndef GLX_NV_video_capture #define GLX_NV_video_capture 1 #define GLX_DEVICE_ID_NV 0x20CD #define GLX_UNIQUE_ID_NV 0x20CE #define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF typedef XID GLXVideoCaptureDeviceNV; typedef int ( * PFNGLXBINDVIDEOCAPTUREDEVICENVPROC) (Display* dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device); typedef GLXVideoCaptureDeviceNV * ( * PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display* dpy, int screen, int *nelements); typedef void ( * PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device); typedef int ( * PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value); typedef void ( * PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device); #define glXBindVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXBindVideoCaptureDeviceNV) #define glXEnumerateVideoCaptureDevicesNV GLXEW_GET_FUN(__glewXEnumerateVideoCaptureDevicesNV) #define glXLockVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXLockVideoCaptureDeviceNV) #define glXQueryVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXQueryVideoCaptureDeviceNV) #define glXReleaseVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXReleaseVideoCaptureDeviceNV) #define GLXEW_NV_video_capture GLXEW_GET_VAR(__GLXEW_NV_video_capture) #endif /* GLX_NV_video_capture */ /* ---------------------------- GLX_NV_video_out --------------------------- */ #ifndef GLX_NV_video_out #define GLX_NV_video_out 1 #define GLX_VIDEO_OUT_COLOR_NV 0x20C3 #define GLX_VIDEO_OUT_ALPHA_NV 0x20C4 #define GLX_VIDEO_OUT_DEPTH_NV 0x20C5 #define GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6 #define GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7 #define GLX_VIDEO_OUT_FRAME_NV 0x20C8 #define GLX_VIDEO_OUT_FIELD_1_NV 0x20C9 #define GLX_VIDEO_OUT_FIELD_2_NV 0x20CA #define GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV 0x20CB #define GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV 0x20CC typedef int ( * PFNGLXBINDVIDEOIMAGENVPROC) (Display* dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer); typedef int ( * PFNGLXGETVIDEODEVICENVPROC) (Display* dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice); typedef int ( * PFNGLXGETVIDEOINFONVPROC) (Display* dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); typedef int ( * PFNGLXRELEASEVIDEODEVICENVPROC) (Display* dpy, int screen, GLXVideoDeviceNV VideoDevice); typedef int ( * PFNGLXRELEASEVIDEOIMAGENVPROC) (Display* dpy, GLXPbuffer pbuf); typedef int ( * PFNGLXSENDPBUFFERTOVIDEONVPROC) (Display* dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock); #define glXBindVideoImageNV GLXEW_GET_FUN(__glewXBindVideoImageNV) #define glXGetVideoDeviceNV GLXEW_GET_FUN(__glewXGetVideoDeviceNV) #define glXGetVideoInfoNV GLXEW_GET_FUN(__glewXGetVideoInfoNV) #define glXReleaseVideoDeviceNV GLXEW_GET_FUN(__glewXReleaseVideoDeviceNV) #define glXReleaseVideoImageNV GLXEW_GET_FUN(__glewXReleaseVideoImageNV) #define glXSendPbufferToVideoNV GLXEW_GET_FUN(__glewXSendPbufferToVideoNV) #define GLXEW_NV_video_out GLXEW_GET_VAR(__GLXEW_NV_video_out) #endif /* GLX_NV_video_out */ /* -------------------------- GLX_OML_swap_method -------------------------- */ #ifndef GLX_OML_swap_method #define GLX_OML_swap_method 1 #define GLX_SWAP_METHOD_OML 0x8060 #define GLX_SWAP_EXCHANGE_OML 0x8061 #define GLX_SWAP_COPY_OML 0x8062 #define GLX_SWAP_UNDEFINED_OML 0x8063 #define GLXEW_OML_swap_method GLXEW_GET_VAR(__GLXEW_OML_swap_method) #endif /* GLX_OML_swap_method */ /* -------------------------- GLX_OML_sync_control ------------------------- */ #ifndef GLX_OML_sync_control #define GLX_OML_sync_control 1 typedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display* dpy, GLXDrawable drawable, int32_t* numerator, int32_t* denominator); typedef Bool ( * PFNGLXGETSYNCVALUESOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t* ust, int64_t* msc, int64_t* sbc); typedef int64_t ( * PFNGLXSWAPBUFFERSMSCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder); typedef Bool ( * PFNGLXWAITFORMSCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t* ust, int64_t* msc, int64_t* sbc); typedef Bool ( * PFNGLXWAITFORSBCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_sbc, int64_t* ust, int64_t* msc, int64_t* sbc); #define glXGetMscRateOML GLXEW_GET_FUN(__glewXGetMscRateOML) #define glXGetSyncValuesOML GLXEW_GET_FUN(__glewXGetSyncValuesOML) #define glXSwapBuffersMscOML GLXEW_GET_FUN(__glewXSwapBuffersMscOML) #define glXWaitForMscOML GLXEW_GET_FUN(__glewXWaitForMscOML) #define glXWaitForSbcOML GLXEW_GET_FUN(__glewXWaitForSbcOML) #define GLXEW_OML_sync_control GLXEW_GET_VAR(__GLXEW_OML_sync_control) #endif /* GLX_OML_sync_control */ /* ------------------------ GLX_SGIS_blended_overlay ----------------------- */ #ifndef GLX_SGIS_blended_overlay #define GLX_SGIS_blended_overlay 1 #define GLX_BLENDED_RGBA_SGIS 0x8025 #define GLXEW_SGIS_blended_overlay GLXEW_GET_VAR(__GLXEW_SGIS_blended_overlay) #endif /* GLX_SGIS_blended_overlay */ /* -------------------------- GLX_SGIS_color_range ------------------------- */ #ifndef GLX_SGIS_color_range #define GLX_SGIS_color_range 1 #define GLX_MIN_RED_SGIS 0 #define GLX_MAX_GREEN_SGIS 0 #define GLX_MIN_BLUE_SGIS 0 #define GLX_MAX_ALPHA_SGIS 0 #define GLX_MIN_GREEN_SGIS 0 #define GLX_MIN_ALPHA_SGIS 0 #define GLX_MAX_RED_SGIS 0 #define GLX_EXTENDED_RANGE_SGIS 0 #define GLX_MAX_BLUE_SGIS 0 #define GLXEW_SGIS_color_range GLXEW_GET_VAR(__GLXEW_SGIS_color_range) #endif /* GLX_SGIS_color_range */ /* -------------------------- GLX_SGIS_multisample ------------------------- */ #ifndef GLX_SGIS_multisample #define GLX_SGIS_multisample 1 #define GLX_SAMPLE_BUFFERS_SGIS 100000 #define GLX_SAMPLES_SGIS 100001 #define GLXEW_SGIS_multisample GLXEW_GET_VAR(__GLXEW_SGIS_multisample) #endif /* GLX_SGIS_multisample */ /* ---------------------- GLX_SGIS_shared_multisample ---------------------- */ #ifndef GLX_SGIS_shared_multisample #define GLX_SGIS_shared_multisample 1 #define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026 #define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027 #define GLXEW_SGIS_shared_multisample GLXEW_GET_VAR(__GLXEW_SGIS_shared_multisample) #endif /* GLX_SGIS_shared_multisample */ /* --------------------------- GLX_SGIX_fbconfig --------------------------- */ #ifndef GLX_SGIX_fbconfig #define GLX_SGIX_fbconfig 1 #define GLX_WINDOW_BIT_SGIX 0x00000001 #define GLX_RGBA_BIT_SGIX 0x00000001 #define GLX_PIXMAP_BIT_SGIX 0x00000002 #define GLX_COLOR_INDEX_BIT_SGIX 0x00000002 #define GLX_SCREEN_EXT 0x800C #define GLX_DRAWABLE_TYPE_SGIX 0x8010 #define GLX_RENDER_TYPE_SGIX 0x8011 #define GLX_X_RENDERABLE_SGIX 0x8012 #define GLX_FBCONFIG_ID_SGIX 0x8013 #define GLX_RGBA_TYPE_SGIX 0x8014 #define GLX_COLOR_INDEX_TYPE_SGIX 0x8015 typedef XID GLXFBConfigIDSGIX; typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; typedef GLXFBConfigSGIX* ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); typedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display* dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display* dpy, GLXFBConfig config, Pixmap pixmap); typedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display* dpy, GLXFBConfigSGIX config, int attribute, int *value); typedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display* dpy, XVisualInfo *vis); typedef XVisualInfo* ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfig config); #define glXChooseFBConfigSGIX GLXEW_GET_FUN(__glewXChooseFBConfigSGIX) #define glXCreateContextWithConfigSGIX GLXEW_GET_FUN(__glewXCreateContextWithConfigSGIX) #define glXCreateGLXPixmapWithConfigSGIX GLXEW_GET_FUN(__glewXCreateGLXPixmapWithConfigSGIX) #define glXGetFBConfigAttribSGIX GLXEW_GET_FUN(__glewXGetFBConfigAttribSGIX) #define glXGetFBConfigFromVisualSGIX GLXEW_GET_FUN(__glewXGetFBConfigFromVisualSGIX) #define glXGetVisualFromFBConfigSGIX GLXEW_GET_FUN(__glewXGetVisualFromFBConfigSGIX) #define GLXEW_SGIX_fbconfig GLXEW_GET_VAR(__GLXEW_SGIX_fbconfig) #endif /* GLX_SGIX_fbconfig */ /* --------------------------- GLX_SGIX_hyperpipe -------------------------- */ #ifndef GLX_SGIX_hyperpipe #define GLX_SGIX_hyperpipe 1 #define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001 #define GLX_PIPE_RECT_SGIX 0x00000001 #define GLX_PIPE_RECT_LIMITS_SGIX 0x00000002 #define GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002 #define GLX_HYPERPIPE_STEREO_SGIX 0x00000003 #define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004 #define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80 #define GLX_BAD_HYPERPIPE_CONFIG_SGIX 91 #define GLX_BAD_HYPERPIPE_SGIX 92 #define GLX_HYPERPIPE_ID_SGIX 0x8030 typedef struct { char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; int networkId; } GLXHyperpipeNetworkSGIX; typedef struct { char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; int XOrigin; int YOrigin; int maxHeight; int maxWidth; } GLXPipeRectLimits; typedef struct { char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; int channel; unsigned int participationType; int timeSlice; } GLXHyperpipeConfigSGIX; typedef struct { char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; int srcXOrigin; int srcYOrigin; int srcWidth; int srcHeight; int destXOrigin; int destYOrigin; int destWidth; int destHeight; } GLXPipeRect; typedef int ( * PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId); typedef int ( * PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId); typedef int ( * PFNGLXHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList); typedef int ( * PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId); typedef int ( * PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList); typedef int ( * PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList); typedef GLXHyperpipeConfigSGIX * ( * PFNGLXQUERYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId, int *npipes); typedef GLXHyperpipeNetworkSGIX * ( * PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes); #define glXBindHyperpipeSGIX GLXEW_GET_FUN(__glewXBindHyperpipeSGIX) #define glXDestroyHyperpipeConfigSGIX GLXEW_GET_FUN(__glewXDestroyHyperpipeConfigSGIX) #define glXHyperpipeAttribSGIX GLXEW_GET_FUN(__glewXHyperpipeAttribSGIX) #define glXHyperpipeConfigSGIX GLXEW_GET_FUN(__glewXHyperpipeConfigSGIX) #define glXQueryHyperpipeAttribSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeAttribSGIX) #define glXQueryHyperpipeBestAttribSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeBestAttribSGIX) #define glXQueryHyperpipeConfigSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeConfigSGIX) #define glXQueryHyperpipeNetworkSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeNetworkSGIX) #define GLXEW_SGIX_hyperpipe GLXEW_GET_VAR(__GLXEW_SGIX_hyperpipe) #endif /* GLX_SGIX_hyperpipe */ /* ---------------------------- GLX_SGIX_pbuffer --------------------------- */ #ifndef GLX_SGIX_pbuffer #define GLX_SGIX_pbuffer 1 #define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001 #define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002 #define GLX_PBUFFER_BIT_SGIX 0x00000004 #define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004 #define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008 #define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010 #define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020 #define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040 #define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080 #define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100 #define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016 #define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017 #define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018 #define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 #define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A #define GLX_PRESERVED_CONTENTS_SGIX 0x801B #define GLX_LARGEST_PBUFFER_SGIX 0x801C #define GLX_WIDTH_SGIX 0x801D #define GLX_HEIGHT_SGIX 0x801E #define GLX_EVENT_MASK_SGIX 0x801F #define GLX_DAMAGED_SGIX 0x8020 #define GLX_SAVED_SGIX 0x8021 #define GLX_WINDOW_SGIX 0x8022 #define GLX_PBUFFER_SGIX 0x8023 #define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000 typedef XID GLXPbufferSGIX; typedef struct { int type; unsigned long serial; Bool send_event; Display *display; GLXDrawable drawable; int event_type; int draw_type; unsigned int mask; int x, y; int width, height; int count; } GLXBufferClobberEventSGIX; typedef GLXPbuffer ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display* dpy, GLXFBConfig config, unsigned int width, unsigned int height, int *attrib_list); typedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display* dpy, GLXPbuffer pbuf); typedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display* dpy, GLXDrawable drawable, unsigned long *mask); typedef void ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display* dpy, GLXPbuffer pbuf, int attribute, unsigned int *value); typedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display* dpy, GLXDrawable drawable, unsigned long mask); #define glXCreateGLXPbufferSGIX GLXEW_GET_FUN(__glewXCreateGLXPbufferSGIX) #define glXDestroyGLXPbufferSGIX GLXEW_GET_FUN(__glewXDestroyGLXPbufferSGIX) #define glXGetSelectedEventSGIX GLXEW_GET_FUN(__glewXGetSelectedEventSGIX) #define glXQueryGLXPbufferSGIX GLXEW_GET_FUN(__glewXQueryGLXPbufferSGIX) #define glXSelectEventSGIX GLXEW_GET_FUN(__glewXSelectEventSGIX) #define GLXEW_SGIX_pbuffer GLXEW_GET_VAR(__GLXEW_SGIX_pbuffer) #endif /* GLX_SGIX_pbuffer */ /* ------------------------- GLX_SGIX_swap_barrier ------------------------- */ #ifndef GLX_SGIX_swap_barrier #define GLX_SGIX_swap_barrier 1 typedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier); typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max); #define glXBindSwapBarrierSGIX GLXEW_GET_FUN(__glewXBindSwapBarrierSGIX) #define glXQueryMaxSwapBarriersSGIX GLXEW_GET_FUN(__glewXQueryMaxSwapBarriersSGIX) #define GLXEW_SGIX_swap_barrier GLXEW_GET_VAR(__GLXEW_SGIX_swap_barrier) #endif /* GLX_SGIX_swap_barrier */ /* -------------------------- GLX_SGIX_swap_group -------------------------- */ #ifndef GLX_SGIX_swap_group #define GLX_SGIX_swap_group 1 typedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member); #define glXJoinSwapGroupSGIX GLXEW_GET_FUN(__glewXJoinSwapGroupSGIX) #define GLXEW_SGIX_swap_group GLXEW_GET_VAR(__GLXEW_SGIX_swap_group) #endif /* GLX_SGIX_swap_group */ /* ------------------------- GLX_SGIX_video_resize ------------------------- */ #ifndef GLX_SGIX_video_resize #define GLX_SGIX_video_resize 1 #define GLX_SYNC_FRAME_SGIX 0x00000000 #define GLX_SYNC_SWAP_SGIX 0x00000001 typedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display* display, int screen, int channel, Window window); typedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display* display, int screen, int channel, int x, int y, int w, int h); typedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display* display, int screen, int channel, GLenum synctype); typedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display* display, int screen, int channel, int *x, int *y, int *w, int *h); typedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display* display, int screen, int channel, int *dx, int *dy, int *dw, int *dh); #define glXBindChannelToWindowSGIX GLXEW_GET_FUN(__glewXBindChannelToWindowSGIX) #define glXChannelRectSGIX GLXEW_GET_FUN(__glewXChannelRectSGIX) #define glXChannelRectSyncSGIX GLXEW_GET_FUN(__glewXChannelRectSyncSGIX) #define glXQueryChannelDeltasSGIX GLXEW_GET_FUN(__glewXQueryChannelDeltasSGIX) #define glXQueryChannelRectSGIX GLXEW_GET_FUN(__glewXQueryChannelRectSGIX) #define GLXEW_SGIX_video_resize GLXEW_GET_VAR(__GLXEW_SGIX_video_resize) #endif /* GLX_SGIX_video_resize */ /* ---------------------- GLX_SGIX_visual_select_group --------------------- */ #ifndef GLX_SGIX_visual_select_group #define GLX_SGIX_visual_select_group 1 #define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028 #define GLXEW_SGIX_visual_select_group GLXEW_GET_VAR(__GLXEW_SGIX_visual_select_group) #endif /* GLX_SGIX_visual_select_group */ /* ---------------------------- GLX_SGI_cushion ---------------------------- */ #ifndef GLX_SGI_cushion #define GLX_SGI_cushion 1 typedef void ( * PFNGLXCUSHIONSGIPROC) (Display* dpy, Window window, float cushion); #define glXCushionSGI GLXEW_GET_FUN(__glewXCushionSGI) #define GLXEW_SGI_cushion GLXEW_GET_VAR(__GLXEW_SGI_cushion) #endif /* GLX_SGI_cushion */ /* ----------------------- GLX_SGI_make_current_read ----------------------- */ #ifndef GLX_SGI_make_current_read #define GLX_SGI_make_current_read 1 typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void); typedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display* dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); #define glXGetCurrentReadDrawableSGI GLXEW_GET_FUN(__glewXGetCurrentReadDrawableSGI) #define glXMakeCurrentReadSGI GLXEW_GET_FUN(__glewXMakeCurrentReadSGI) #define GLXEW_SGI_make_current_read GLXEW_GET_VAR(__GLXEW_SGI_make_current_read) #endif /* GLX_SGI_make_current_read */ /* -------------------------- GLX_SGI_swap_control ------------------------- */ #ifndef GLX_SGI_swap_control #define GLX_SGI_swap_control 1 typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval); #define glXSwapIntervalSGI GLXEW_GET_FUN(__glewXSwapIntervalSGI) #define GLXEW_SGI_swap_control GLXEW_GET_VAR(__GLXEW_SGI_swap_control) #endif /* GLX_SGI_swap_control */ /* --------------------------- GLX_SGI_video_sync -------------------------- */ #ifndef GLX_SGI_video_sync #define GLX_SGI_video_sync 1 typedef int ( * PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int* count); typedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int* count); #define glXGetVideoSyncSGI GLXEW_GET_FUN(__glewXGetVideoSyncSGI) #define glXWaitVideoSyncSGI GLXEW_GET_FUN(__glewXWaitVideoSyncSGI) #define GLXEW_SGI_video_sync GLXEW_GET_VAR(__GLXEW_SGI_video_sync) #endif /* GLX_SGI_video_sync */ /* --------------------- GLX_SUN_get_transparent_index --------------------- */ #ifndef GLX_SUN_get_transparent_index #define GLX_SUN_get_transparent_index 1 typedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display* dpy, Window overlay, Window underlay, unsigned long *pTransparentIndex); #define glXGetTransparentIndexSUN GLXEW_GET_FUN(__glewXGetTransparentIndexSUN) #define GLXEW_SUN_get_transparent_index GLXEW_GET_VAR(__GLXEW_SUN_get_transparent_index) #endif /* GLX_SUN_get_transparent_index */ /* -------------------------- GLX_SUN_video_resize ------------------------- */ #ifndef GLX_SUN_video_resize #define GLX_SUN_video_resize 1 #define GLX_VIDEO_RESIZE_SUN 0x8171 #define GL_VIDEO_RESIZE_COMPENSATION_SUN 0x85CD typedef int ( * PFNGLXGETVIDEORESIZESUNPROC) (Display* display, GLXDrawable window, float* factor); typedef int ( * PFNGLXVIDEORESIZESUNPROC) (Display* display, GLXDrawable window, float factor); #define glXGetVideoResizeSUN GLXEW_GET_FUN(__glewXGetVideoResizeSUN) #define glXVideoResizeSUN GLXEW_GET_FUN(__glewXVideoResizeSUN) #define GLXEW_SUN_video_resize GLXEW_GET_VAR(__GLXEW_SUN_video_resize) #endif /* GLX_SUN_video_resize */ /* ------------------------------------------------------------------------- */ #ifdef GLEW_MX #define GLXEW_FUN_EXPORT #define GLXEW_VAR_EXPORT #else #define GLXEW_FUN_EXPORT GLEW_FUN_EXPORT #define GLXEW_VAR_EXPORT GLEW_VAR_EXPORT #endif /* GLEW_MX */ GLXEW_FUN_EXPORT PFNGLXGETCURRENTDISPLAYPROC __glewXGetCurrentDisplay; GLXEW_FUN_EXPORT PFNGLXCHOOSEFBCONFIGPROC __glewXChooseFBConfig; GLXEW_FUN_EXPORT PFNGLXCREATENEWCONTEXTPROC __glewXCreateNewContext; GLXEW_FUN_EXPORT PFNGLXCREATEPBUFFERPROC __glewXCreatePbuffer; GLXEW_FUN_EXPORT PFNGLXCREATEPIXMAPPROC __glewXCreatePixmap; GLXEW_FUN_EXPORT PFNGLXCREATEWINDOWPROC __glewXCreateWindow; GLXEW_FUN_EXPORT PFNGLXDESTROYPBUFFERPROC __glewXDestroyPbuffer; GLXEW_FUN_EXPORT PFNGLXDESTROYPIXMAPPROC __glewXDestroyPixmap; GLXEW_FUN_EXPORT PFNGLXDESTROYWINDOWPROC __glewXDestroyWindow; GLXEW_FUN_EXPORT PFNGLXGETCURRENTREADDRAWABLEPROC __glewXGetCurrentReadDrawable; GLXEW_FUN_EXPORT PFNGLXGETFBCONFIGATTRIBPROC __glewXGetFBConfigAttrib; GLXEW_FUN_EXPORT PFNGLXGETFBCONFIGSPROC __glewXGetFBConfigs; GLXEW_FUN_EXPORT PFNGLXGETSELECTEDEVENTPROC __glewXGetSelectedEvent; GLXEW_FUN_EXPORT PFNGLXGETVISUALFROMFBCONFIGPROC __glewXGetVisualFromFBConfig; GLXEW_FUN_EXPORT PFNGLXMAKECONTEXTCURRENTPROC __glewXMakeContextCurrent; GLXEW_FUN_EXPORT PFNGLXQUERYCONTEXTPROC __glewXQueryContext; GLXEW_FUN_EXPORT PFNGLXQUERYDRAWABLEPROC __glewXQueryDrawable; GLXEW_FUN_EXPORT PFNGLXSELECTEVENTPROC __glewXSelectEvent; GLXEW_FUN_EXPORT PFNGLXCREATECONTEXTATTRIBSARBPROC __glewXCreateContextAttribsARB; GLXEW_FUN_EXPORT PFNGLXBINDTEXIMAGEATIPROC __glewXBindTexImageATI; GLXEW_FUN_EXPORT PFNGLXDRAWABLEATTRIBATIPROC __glewXDrawableAttribATI; GLXEW_FUN_EXPORT PFNGLXRELEASETEXIMAGEATIPROC __glewXReleaseTexImageATI; GLXEW_FUN_EXPORT PFNGLXFREECONTEXTEXTPROC __glewXFreeContextEXT; GLXEW_FUN_EXPORT PFNGLXGETCONTEXTIDEXTPROC __glewXGetContextIDEXT; GLXEW_FUN_EXPORT PFNGLXIMPORTCONTEXTEXTPROC __glewXImportContextEXT; GLXEW_FUN_EXPORT PFNGLXQUERYCONTEXTINFOEXTPROC __glewXQueryContextInfoEXT; GLXEW_FUN_EXPORT PFNGLXSWAPINTERVALEXTPROC __glewXSwapIntervalEXT; GLXEW_FUN_EXPORT PFNGLXBINDTEXIMAGEEXTPROC __glewXBindTexImageEXT; GLXEW_FUN_EXPORT PFNGLXRELEASETEXIMAGEEXTPROC __glewXReleaseTexImageEXT; GLXEW_FUN_EXPORT PFNGLXGETAGPOFFSETMESAPROC __glewXGetAGPOffsetMESA; GLXEW_FUN_EXPORT PFNGLXCOPYSUBBUFFERMESAPROC __glewXCopySubBufferMESA; GLXEW_FUN_EXPORT PFNGLXCREATEGLXPIXMAPMESAPROC __glewXCreateGLXPixmapMESA; GLXEW_FUN_EXPORT PFNGLXRELEASEBUFFERSMESAPROC __glewXReleaseBuffersMESA; GLXEW_FUN_EXPORT PFNGLXSET3DFXMODEMESAPROC __glewXSet3DfxModeMESA; GLXEW_FUN_EXPORT PFNGLXGETSWAPINTERVALMESAPROC __glewXGetSwapIntervalMESA; GLXEW_FUN_EXPORT PFNGLXSWAPINTERVALMESAPROC __glewXSwapIntervalMESA; GLXEW_FUN_EXPORT PFNGLXCOPYIMAGESUBDATANVPROC __glewXCopyImageSubDataNV; GLXEW_FUN_EXPORT PFNGLXBINDVIDEODEVICENVPROC __glewXBindVideoDeviceNV; GLXEW_FUN_EXPORT PFNGLXENUMERATEVIDEODEVICESNVPROC __glewXEnumerateVideoDevicesNV; GLXEW_FUN_EXPORT PFNGLXBINDSWAPBARRIERNVPROC __glewXBindSwapBarrierNV; GLXEW_FUN_EXPORT PFNGLXJOINSWAPGROUPNVPROC __glewXJoinSwapGroupNV; GLXEW_FUN_EXPORT PFNGLXQUERYFRAMECOUNTNVPROC __glewXQueryFrameCountNV; GLXEW_FUN_EXPORT PFNGLXQUERYMAXSWAPGROUPSNVPROC __glewXQueryMaxSwapGroupsNV; GLXEW_FUN_EXPORT PFNGLXQUERYSWAPGROUPNVPROC __glewXQuerySwapGroupNV; GLXEW_FUN_EXPORT PFNGLXRESETFRAMECOUNTNVPROC __glewXResetFrameCountNV; GLXEW_FUN_EXPORT PFNGLXALLOCATEMEMORYNVPROC __glewXAllocateMemoryNV; GLXEW_FUN_EXPORT PFNGLXFREEMEMORYNVPROC __glewXFreeMemoryNV; GLXEW_FUN_EXPORT PFNGLXBINDVIDEOCAPTUREDEVICENVPROC __glewXBindVideoCaptureDeviceNV; GLXEW_FUN_EXPORT PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC __glewXEnumerateVideoCaptureDevicesNV; GLXEW_FUN_EXPORT PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC __glewXLockVideoCaptureDeviceNV; GLXEW_FUN_EXPORT PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC __glewXQueryVideoCaptureDeviceNV; GLXEW_FUN_EXPORT PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC __glewXReleaseVideoCaptureDeviceNV; GLXEW_FUN_EXPORT PFNGLXBINDVIDEOIMAGENVPROC __glewXBindVideoImageNV; GLXEW_FUN_EXPORT PFNGLXGETVIDEODEVICENVPROC __glewXGetVideoDeviceNV; GLXEW_FUN_EXPORT PFNGLXGETVIDEOINFONVPROC __glewXGetVideoInfoNV; GLXEW_FUN_EXPORT PFNGLXRELEASEVIDEODEVICENVPROC __glewXReleaseVideoDeviceNV; GLXEW_FUN_EXPORT PFNGLXRELEASEVIDEOIMAGENVPROC __glewXReleaseVideoImageNV; GLXEW_FUN_EXPORT PFNGLXSENDPBUFFERTOVIDEONVPROC __glewXSendPbufferToVideoNV; GLXEW_FUN_EXPORT PFNGLXGETMSCRATEOMLPROC __glewXGetMscRateOML; GLXEW_FUN_EXPORT PFNGLXGETSYNCVALUESOMLPROC __glewXGetSyncValuesOML; GLXEW_FUN_EXPORT PFNGLXSWAPBUFFERSMSCOMLPROC __glewXSwapBuffersMscOML; GLXEW_FUN_EXPORT PFNGLXWAITFORMSCOMLPROC __glewXWaitForMscOML; GLXEW_FUN_EXPORT PFNGLXWAITFORSBCOMLPROC __glewXWaitForSbcOML; GLXEW_FUN_EXPORT PFNGLXCHOOSEFBCONFIGSGIXPROC __glewXChooseFBConfigSGIX; GLXEW_FUN_EXPORT PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC __glewXCreateContextWithConfigSGIX; GLXEW_FUN_EXPORT PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC __glewXCreateGLXPixmapWithConfigSGIX; GLXEW_FUN_EXPORT PFNGLXGETFBCONFIGATTRIBSGIXPROC __glewXGetFBConfigAttribSGIX; GLXEW_FUN_EXPORT PFNGLXGETFBCONFIGFROMVISUALSGIXPROC __glewXGetFBConfigFromVisualSGIX; GLXEW_FUN_EXPORT PFNGLXGETVISUALFROMFBCONFIGSGIXPROC __glewXGetVisualFromFBConfigSGIX; GLXEW_FUN_EXPORT PFNGLXBINDHYPERPIPESGIXPROC __glewXBindHyperpipeSGIX; GLXEW_FUN_EXPORT PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC __glewXDestroyHyperpipeConfigSGIX; GLXEW_FUN_EXPORT PFNGLXHYPERPIPEATTRIBSGIXPROC __glewXHyperpipeAttribSGIX; GLXEW_FUN_EXPORT PFNGLXHYPERPIPECONFIGSGIXPROC __glewXHyperpipeConfigSGIX; GLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC __glewXQueryHyperpipeAttribSGIX; GLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC __glewXQueryHyperpipeBestAttribSGIX; GLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPECONFIGSGIXPROC __glewXQueryHyperpipeConfigSGIX; GLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPENETWORKSGIXPROC __glewXQueryHyperpipeNetworkSGIX; GLXEW_FUN_EXPORT PFNGLXCREATEGLXPBUFFERSGIXPROC __glewXCreateGLXPbufferSGIX; GLXEW_FUN_EXPORT PFNGLXDESTROYGLXPBUFFERSGIXPROC __glewXDestroyGLXPbufferSGIX; GLXEW_FUN_EXPORT PFNGLXGETSELECTEDEVENTSGIXPROC __glewXGetSelectedEventSGIX; GLXEW_FUN_EXPORT PFNGLXQUERYGLXPBUFFERSGIXPROC __glewXQueryGLXPbufferSGIX; GLXEW_FUN_EXPORT PFNGLXSELECTEVENTSGIXPROC __glewXSelectEventSGIX; GLXEW_FUN_EXPORT PFNGLXBINDSWAPBARRIERSGIXPROC __glewXBindSwapBarrierSGIX; GLXEW_FUN_EXPORT PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC __glewXQueryMaxSwapBarriersSGIX; GLXEW_FUN_EXPORT PFNGLXJOINSWAPGROUPSGIXPROC __glewXJoinSwapGroupSGIX; GLXEW_FUN_EXPORT PFNGLXBINDCHANNELTOWINDOWSGIXPROC __glewXBindChannelToWindowSGIX; GLXEW_FUN_EXPORT PFNGLXCHANNELRECTSGIXPROC __glewXChannelRectSGIX; GLXEW_FUN_EXPORT PFNGLXCHANNELRECTSYNCSGIXPROC __glewXChannelRectSyncSGIX; GLXEW_FUN_EXPORT PFNGLXQUERYCHANNELDELTASSGIXPROC __glewXQueryChannelDeltasSGIX; GLXEW_FUN_EXPORT PFNGLXQUERYCHANNELRECTSGIXPROC __glewXQueryChannelRectSGIX; GLXEW_FUN_EXPORT PFNGLXCUSHIONSGIPROC __glewXCushionSGI; GLXEW_FUN_EXPORT PFNGLXGETCURRENTREADDRAWABLESGIPROC __glewXGetCurrentReadDrawableSGI; GLXEW_FUN_EXPORT PFNGLXMAKECURRENTREADSGIPROC __glewXMakeCurrentReadSGI; GLXEW_FUN_EXPORT PFNGLXSWAPINTERVALSGIPROC __glewXSwapIntervalSGI; GLXEW_FUN_EXPORT PFNGLXGETVIDEOSYNCSGIPROC __glewXGetVideoSyncSGI; GLXEW_FUN_EXPORT PFNGLXWAITVIDEOSYNCSGIPROC __glewXWaitVideoSyncSGI; GLXEW_FUN_EXPORT PFNGLXGETTRANSPARENTINDEXSUNPROC __glewXGetTransparentIndexSUN; GLXEW_FUN_EXPORT PFNGLXGETVIDEORESIZESUNPROC __glewXGetVideoResizeSUN; GLXEW_FUN_EXPORT PFNGLXVIDEORESIZESUNPROC __glewXVideoResizeSUN; #if defined(GLEW_MX) struct GLXEWContextStruct { #endif /* GLEW_MX */ GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_0; GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_1; GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_2; GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_3; GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_4; GLXEW_VAR_EXPORT GLboolean __GLXEW_3DFX_multisample; GLXEW_VAR_EXPORT GLboolean __GLXEW_AMD_gpu_association; GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_create_context; GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_create_context_profile; GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_create_context_robustness; GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_fbconfig_float; GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_framebuffer_sRGB; GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_get_proc_address; GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_multisample; GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_robustness_application_isolation; GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_robustness_share_group_isolation; GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_vertex_buffer_object; GLXEW_VAR_EXPORT GLboolean __GLXEW_ATI_pixel_format_float; GLXEW_VAR_EXPORT GLboolean __GLXEW_ATI_render_texture; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_create_context_es2_profile; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_create_context_es_profile; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_fbconfig_packed_float; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_framebuffer_sRGB; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_import_context; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_scene_marker; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_swap_control; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_swap_control_tear; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_texture_from_pixmap; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_visual_info; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_visual_rating; GLXEW_VAR_EXPORT GLboolean __GLXEW_INTEL_swap_event; GLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_agp_offset; GLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_copy_sub_buffer; GLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_pixmap_colormap; GLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_release_buffers; GLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_set_3dfx_mode; GLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_swap_control; GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_copy_image; GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_float_buffer; GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_multisample_coverage; GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_present_video; GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_swap_group; GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_vertex_array_range; GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_video_capture; GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_video_out; GLXEW_VAR_EXPORT GLboolean __GLXEW_OML_swap_method; GLXEW_VAR_EXPORT GLboolean __GLXEW_OML_sync_control; GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_blended_overlay; GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_color_range; GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_multisample; GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_shared_multisample; GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_fbconfig; GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_hyperpipe; GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_pbuffer; GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_swap_barrier; GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_swap_group; GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_video_resize; GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_visual_select_group; GLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_cushion; GLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_make_current_read; GLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_swap_control; GLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_video_sync; GLXEW_VAR_EXPORT GLboolean __GLXEW_SUN_get_transparent_index; GLXEW_VAR_EXPORT GLboolean __GLXEW_SUN_video_resize; #ifdef GLEW_MX }; /* GLXEWContextStruct */ #endif /* GLEW_MX */ /* ------------------------------------------------------------------------ */ #ifdef GLEW_MX typedef struct GLXEWContextStruct GLXEWContext; GLEWAPI GLenum GLEWAPIENTRY glxewContextInit (GLXEWContext *ctx); GLEWAPI GLboolean GLEWAPIENTRY glxewContextIsSupported (const GLXEWContext *ctx, const char *name); #define glxewInit() glxewContextInit(glxewGetContext()) #define glxewIsSupported(x) glxewContextIsSupported(glxewGetContext(), x) #define GLXEW_GET_VAR(x) (*(const GLboolean*)&(glxewGetContext()->x)) #define GLXEW_GET_FUN(x) x #else /* GLEW_MX */ #define GLXEW_GET_VAR(x) (*(const GLboolean*)&x) #define GLXEW_GET_FUN(x) x GLEWAPI GLboolean GLEWAPIENTRY glxewIsSupported (const char *name); #endif /* GLEW_MX */ GLEWAPI GLboolean GLEWAPIENTRY glxewGetExtension (const char *name); #ifdef __cplusplus } #endif #endif /* __glxew_h__ */ ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/0000755000175000017500000000000012320456500016516 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lmem.cpp0000644000175000017500000000616712320456500020166 0ustar mathieumathieu/* ** $Id: lmem.c,v 1.83 2011/11/30 12:42:49 roberto Exp $ ** Interface to Memory Manager ** See Copyright Notice in lua.h */ #include #define lmem_c #define LUA_CORE #include "lua.h" #include "ldebug.h" #include "ldo.h" #include "lgc.h" #include "lmem.h" #include "lobject.h" #include "lstate.h" /* ** About the realloc function: ** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize); ** (`osize' is the old size, `nsize' is the new size) ** ** * frealloc(ud, NULL, x, s) creates a new block of size `s' (no ** matter 'x'). ** ** * frealloc(ud, p, x, 0) frees the block `p' ** (in this specific case, frealloc must return NULL); ** particularly, frealloc(ud, NULL, 0, 0) does nothing ** (which is equivalent to free(NULL) in ANSI C) ** ** frealloc returns NULL if it cannot create or reallocate the area ** (any reallocation to an equal or smaller size cannot fail!) */ #define MINSIZEARRAY 4 void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems, int limit, const char *what) { void *newblock; int newsize; if (*size >= limit/2) { /* cannot double it? */ if (*size >= limit) /* cannot grow even a little? */ luaG_runerror(L, "too many %s (limit is %d)", what, limit); newsize = limit; /* still have at least one free place */ } else { newsize = (*size)*2; if (newsize < MINSIZEARRAY) newsize = MINSIZEARRAY; /* minimum size */ } newblock = luaM_reallocv(L, block, *size, newsize, size_elems); *size = newsize; /* update only when everything else is OK */ return newblock; } l_noret luaM_toobig (lua_State *L) { luaG_runerror(L, "memory allocation error: block too big"); } /* ** generic allocation routine. */ void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { void *newblock; global_State *g = G(L); size_t realosize = (block) ? osize : 0; lua_assert((realosize == 0) == (block == NULL)); #if defined(HARDMEMTESTS) if (nsize > realosize && g->gcrunning) luaC_fullgc(L, 1); /* force a GC whenever possible */ #endif newblock = (*g->frealloc)(g->ud, block, osize, nsize); if (newblock == NULL && nsize > 0) { api_check(L, nsize > realosize, "realloc cannot fail when shrinking a block"); if (g->gcrunning) { luaC_fullgc(L, 1); /* try to free some memory... */ newblock = (*g->frealloc)(g->ud, block, osize, nsize); /* try again */ } if (newblock == NULL) luaD_throw(L, LUA_ERRMEM); } lua_assert((nsize == 0) == (newblock == NULL)); g->GCdebt = (g->GCdebt + nsize) - realosize; #if defined(TRACEMEM) { /* auxiliary patch to monitor garbage collection. ** To plot, gnuplot with following command: ** plot TRACEMEM using 1:2 with lines, TRACEMEM using 1:3 with lines */ static unsigned long total = 0; /* our "time" */ static FILE *f = NULL; /* output file */ total++; /* "time" always grows */ if ((total % 200) == 0) { if (f == NULL) f = fopen(TRACEMEM, "w"); fprintf(f, "%lu %u %d %d\n", total, gettotalbytes(g), g->GCdebt, g->gcstate * 10000); } } #endif return newblock; } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/loadlib.cpp0000644000175000017500000005101012320456500020625 0ustar mathieumathieu/* ** $Id: loadlib.c,v 1.108 2011/12/12 16:34:03 roberto Exp $ ** Dynamic library loader for Lua ** See Copyright Notice in lua.h ** ** This module contains an implementation of loadlib for Unix systems ** that have dlfcn, an implementation for Windows, and a stub for other ** systems. */ /* ** if needed, includes windows header before everything else */ #if defined(_WIN32) #include #endif #include #include #define loadlib_c #define LUA_LIB #include "lua.h" #include "lauxlib.h" #include "lualib.h" /* ** LUA_PATH and LUA_CPATH are the names of the environment ** variables that Lua check to set its paths. */ #if !defined(LUA_PATH) #define LUA_PATH "LUA_PATH" #endif #if !defined(LUA_CPATH) #define LUA_CPATH "LUA_CPATH" #endif #define LUA_PATHSUFFIX "_" LUA_VERSION_MAJOR "_" LUA_VERSION_MINOR #define LUA_PATHVERSION LUA_PATH LUA_PATHSUFFIX #define LUA_CPATHVERSION LUA_CPATH LUA_PATHSUFFIX /* ** LUA_PATH_SEP is the character that separates templates in a path. ** LUA_PATH_MARK is the string that marks the substitution points in a ** template. ** LUA_EXEC_DIR in a Windows path is replaced by the executable's ** directory. ** LUA_IGMARK is a mark to ignore all before it when building the ** luaopen_ function name. */ #if !defined (LUA_PATH_SEP) #define LUA_PATH_SEP ";" #endif #if !defined (LUA_PATH_MARK) #define LUA_PATH_MARK "?" #endif #if !defined (LUA_EXEC_DIR) #define LUA_EXEC_DIR "!" #endif #if !defined (LUA_IGMARK) #define LUA_IGMARK "-" #endif /* ** LUA_CSUBSEP is the character that replaces dots in submodule names ** when searching for a C loader. ** LUA_LSUBSEP is the character that replaces dots in submodule names ** when searching for a Lua loader. */ #if !defined(LUA_CSUBSEP) #define LUA_CSUBSEP LUA_DIRSEP #endif #if !defined(LUA_LSUBSEP) #define LUA_LSUBSEP LUA_DIRSEP #endif /* prefix for open functions in C libraries */ #define LUA_POF "luaopen_" /* separator for open functions in C libraries */ #define LUA_OFSEP "_" #define LIBPREFIX "LOADLIB: " #define POF LUA_POF #define LIB_FAIL "open" /* error codes for ll_loadfunc */ #define ERRLIB 1 #define ERRFUNC 2 #define setprogdir(L) ((void)0) /* ** system-dependent functions */ static void ll_unloadlib (void *lib); static void *ll_load (lua_State *L, const char *path, int seeglb); static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym); #if defined(LUA_USE_DLOPEN) /* ** {======================================================================== ** This is an implementation of loadlib based on the dlfcn interface. ** The dlfcn interface is available in Linux, SunOS, Solaris, IRIX, FreeBSD, ** NetBSD, AIX 4.2, HPUX 11, and probably most other Unix flavors, at least ** as an emulation layer on top of native functions. ** ========================================================================= */ #include static void ll_unloadlib (void *lib) { dlclose(lib); } static void *ll_load (lua_State *L, const char *path, int seeglb) { void *lib = dlopen(path, RTLD_NOW | (seeglb ? RTLD_GLOBAL : RTLD_LOCAL)); if (lib == NULL) lua_pushstring(L, dlerror()); return lib; } static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { lua_CFunction f = (lua_CFunction)dlsym(lib, sym); if (f == NULL) lua_pushstring(L, dlerror()); return f; } /* }====================================================== */ #elif defined(LUA_DL_DLL) /* ** {====================================================================== ** This is an implementation of loadlib for Windows using native functions. ** ======================================================================= */ #undef setprogdir /* ** optional flags for LoadLibraryEx */ #if !defined(LUA_LLE_FLAGS) #define LUA_LLE_FLAGS 0 #endif static void setprogdir (lua_State *L) { char buff[MAX_PATH + 1]; char *lb; DWORD nsize = sizeof(buff)/sizeof(char); DWORD n = GetModuleFileNameA(NULL, buff, nsize); if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL) luaL_error(L, "unable to get ModuleFileName"); else { *lb = '\0'; luaL_gsub(L, lua_tostring(L, -1), LUA_EXEC_DIR, buff); lua_remove(L, -2); /* remove original string */ } } static void pusherror (lua_State *L) { int error = GetLastError(); char buffer[128]; if (FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, NULL, error, 0, buffer, sizeof(buffer)/sizeof(char), NULL)) lua_pushstring(L, buffer); else lua_pushfstring(L, "system error %d\n", error); } static void ll_unloadlib (void *lib) { FreeLibrary((HMODULE)lib); } static void *ll_load (lua_State *L, const char *path, int seeglb) { HMODULE lib = LoadLibraryExA(path, NULL, LUA_LLE_FLAGS); (void)(seeglb); /* not used: symbols are 'global' by default */ if (lib == NULL) pusherror(L); return lib; } static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { lua_CFunction f = (lua_CFunction)GetProcAddress((HMODULE)lib, sym); if (f == NULL) pusherror(L); return f; } /* }====================================================== */ #else /* ** {====================================================== ** Fallback for other systems ** ======================================================= */ #undef LIB_FAIL #define LIB_FAIL "absent" #define DLMSG "dynamic libraries not enabled; check your Lua installation" static void ll_unloadlib (void *lib) { (void)(lib); /* not used */ } static void *ll_load (lua_State *L, const char *path, int seeglb) { (void)(path); (void)(seeglb); /* not used */ lua_pushliteral(L, DLMSG); return NULL; } static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { (void)(lib); (void)(sym); /* not used */ lua_pushliteral(L, DLMSG); return NULL; } /* }====================================================== */ #endif static void **ll_register (lua_State *L, const char *path) { void **plib; lua_pushfstring(L, "%s%s", LIBPREFIX, path); lua_gettable(L, LUA_REGISTRYINDEX); /* check library in registry? */ if (!lua_isnil(L, -1)) /* is there an entry? */ plib = (void **)lua_touserdata(L, -1); else { /* no entry yet; create one */ lua_pop(L, 1); /* remove result from gettable */ plib = (void **)lua_newuserdata(L, sizeof(const void *)); *plib = NULL; luaL_setmetatable(L, "_LOADLIB"); lua_pushfstring(L, "%s%s", LIBPREFIX, path); lua_pushvalue(L, -2); lua_settable(L, LUA_REGISTRYINDEX); } return plib; } /* ** __gc tag method: calls library's `ll_unloadlib' function with the lib ** handle */ static int gctm (lua_State *L) { void **lib = (void **)luaL_checkudata(L, 1, "_LOADLIB"); if (*lib) ll_unloadlib(*lib); *lib = NULL; /* mark library as closed */ return 0; } static int ll_loadfunc (lua_State *L, const char *path, const char *sym) { void **reg = ll_register(L, path); if (*reg == NULL) *reg = ll_load(L, path, *sym == '*'); if (*reg == NULL) return ERRLIB; /* unable to load library */ if (*sym == '*') { /* loading only library (no function)? */ lua_pushboolean(L, 1); /* return 'true' */ return 0; /* no errors */ } else { lua_CFunction f = ll_sym(L, *reg, sym); if (f == NULL) return ERRFUNC; /* unable to find function */ lua_pushcfunction(L, f); /* else create new function */ return 0; /* no errors */ } } static int ll_loadlib (lua_State *L) { const char *path = luaL_checkstring(L, 1); const char *init = luaL_checkstring(L, 2); int stat = ll_loadfunc(L, path, init); if (stat == 0) /* no errors? */ return 1; /* return the loaded function */ else { /* error; error message is on stack top */ lua_pushnil(L); lua_insert(L, -2); lua_pushstring(L, (stat == ERRLIB) ? LIB_FAIL : "init"); return 3; /* return nil, error message, and where */ } } /* ** {====================================================== ** 'require' function ** ======================================================= */ static int readable (const char *filename) { FILE *f = fopen(filename, "r"); /* try to open file */ if (f == NULL) return 0; /* open failed */ fclose(f); return 1; } static const char *pushnexttemplate (lua_State *L, const char *path) { const char *l; while (*path == *LUA_PATH_SEP) path++; /* skip separators */ if (*path == '\0') return NULL; /* no more templates */ l = strchr(path, *LUA_PATH_SEP); /* find next separator */ if (l == NULL) l = path + strlen(path); lua_pushlstring(L, path, l - path); /* template */ return l; } static const char *searchpath (lua_State *L, const char *name, const char *path, const char *sep, const char *dirsep) { luaL_Buffer msg; /* to build error message */ luaL_buffinit(L, &msg); if (*sep != '\0') /* non-empty separator? */ name = luaL_gsub(L, name, sep, dirsep); /* replace it by 'dirsep' */ while ((path = pushnexttemplate(L, path)) != NULL) { const char *filename = luaL_gsub(L, lua_tostring(L, -1), LUA_PATH_MARK, name); lua_remove(L, -2); /* remove path template */ if (readable(filename)) /* does file exist and is readable? */ return filename; /* return that file name */ lua_pushfstring(L, "\n\tno file " LUA_QS, filename); lua_remove(L, -2); /* remove file name */ luaL_addvalue(&msg); /* concatenate error msg. entry */ } luaL_pushresult(&msg); /* create error message */ return NULL; /* not found */ } static int ll_searchpath (lua_State *L) { const char *f = searchpath(L, luaL_checkstring(L, 1), luaL_checkstring(L, 2), luaL_optstring(L, 3, "."), luaL_optstring(L, 4, LUA_DIRSEP)); if (f != NULL) return 1; else { /* error message is on top of the stack */ lua_pushnil(L); lua_insert(L, -2); return 2; /* return nil + error message */ } } static const char *findfile (lua_State *L, const char *name, const char *pname, const char *dirsep) { const char *path; lua_getfield(L, lua_upvalueindex(1), pname); path = lua_tostring(L, -1); if (path == NULL) luaL_error(L, LUA_QL("package.%s") " must be a string", pname); return searchpath(L, name, path, ".", dirsep); } static int checkload (lua_State *L, int stat, const char *filename) { if (stat) { /* module loaded successfully? */ lua_pushstring(L, filename); /* will be 2nd argument to module */ return 2; /* return open function and file name */ } else return luaL_error(L, "error loading module " LUA_QS " from file " LUA_QS ":\n\t%s", lua_tostring(L, 1), filename, lua_tostring(L, -1)); } static int searcher_Lua (lua_State *L) { const char *filename; const char *name = luaL_checkstring(L, 1); filename = findfile(L, name, "path", LUA_LSUBSEP); if (filename == NULL) return 1; /* module not found in this path */ return checkload(L, (luaL_loadfile(L, filename) == LUA_OK), filename); } static int loadfunc (lua_State *L, const char *filename, const char *modname) { const char *funcname; const char *mark; modname = luaL_gsub(L, modname, ".", LUA_OFSEP); mark = strchr(modname, *LUA_IGMARK); if (mark) { int stat; funcname = lua_pushlstring(L, modname, mark - modname); funcname = lua_pushfstring(L, POF"%s", funcname); stat = ll_loadfunc(L, filename, funcname); if (stat != ERRFUNC) return stat; modname = mark + 1; /* else go ahead and try old-style name */ } funcname = lua_pushfstring(L, POF"%s", modname); return ll_loadfunc(L, filename, funcname); } static int searcher_C (lua_State *L) { const char *name = luaL_checkstring(L, 1); const char *filename = findfile(L, name, "cpath", LUA_CSUBSEP); if (filename == NULL) return 1; /* module not found in this path */ return checkload(L, (loadfunc(L, filename, name) == 0), filename); } static int searcher_Croot (lua_State *L) { const char *filename; const char *name = luaL_checkstring(L, 1); const char *p = strchr(name, '.'); int stat; if (p == NULL) return 0; /* is root */ lua_pushlstring(L, name, p - name); filename = findfile(L, lua_tostring(L, -1), "cpath", LUA_CSUBSEP); if (filename == NULL) return 1; /* root not found */ if ((stat = loadfunc(L, filename, name)) != 0) { if (stat != ERRFUNC) return checkload(L, 0, filename); /* real error */ else { /* open function not found */ lua_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS, name, filename); return 1; } } lua_pushstring(L, filename); /* will be 2nd argument to module */ return 2; } static int searcher_preload (lua_State *L) { const char *name = luaL_checkstring(L, 1); lua_getfield(L, LUA_REGISTRYINDEX, "_PRELOAD"); lua_getfield(L, -1, name); if (lua_isnil(L, -1)) /* not found? */ lua_pushfstring(L, "\n\tno field package.preload['%s']", name); return 1; } static void findloader (lua_State *L, const char *name) { int i; luaL_Buffer msg; /* to build error message */ luaL_buffinit(L, &msg); lua_getfield(L, lua_upvalueindex(1), "searchers"); /* will be at index 3 */ if (!lua_istable(L, 3)) luaL_error(L, LUA_QL("package.searchers") " must be a table"); /* iterate over available seachers to find a loader */ for (i = 1; ; i++) { lua_rawgeti(L, 3, i); /* get a seacher */ if (lua_isnil(L, -1)) { /* no more searchers? */ lua_pop(L, 1); /* remove nil */ luaL_pushresult(&msg); /* create error message */ luaL_error(L, "module " LUA_QS " not found:%s", name, lua_tostring(L, -1)); } lua_pushstring(L, name); lua_call(L, 1, 2); /* call it */ if (lua_isfunction(L, -2)) /* did it find a loader? */ return; /* module loader found */ else if (lua_isstring(L, -2)) { /* searcher returned error message? */ lua_pop(L, 1); /* remove extra return */ luaL_addvalue(&msg); /* concatenate error message */ } else lua_pop(L, 2); /* remove both returns */ } } static int ll_require (lua_State *L) { const char *name = luaL_checkstring(L, 1); lua_settop(L, 1); /* _LOADED table will be at index 2 */ lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); lua_getfield(L, 2, name); /* _LOADED[name] */ if (lua_toboolean(L, -1)) /* is it there? */ return 1; /* package is already loaded */ /* else must load package */ lua_pop(L, 1); /* remove 'getfield' result */ findloader(L, name); lua_pushstring(L, name); /* pass name as argument to module loader */ lua_insert(L, -2); /* name is 1st argument (before search data) */ lua_call(L, 2, 1); /* run loader to load module */ if (!lua_isnil(L, -1)) /* non-nil return? */ lua_setfield(L, 2, name); /* _LOADED[name] = returned value */ lua_getfield(L, 2, name); if (lua_isnil(L, -1)) { /* module did not set a value? */ lua_pushboolean(L, 1); /* use true as result */ lua_pushvalue(L, -1); /* extra copy to be returned */ lua_setfield(L, 2, name); /* _LOADED[name] = true */ } return 1; } /* }====================================================== */ /* ** {====================================================== ** 'module' function ** ======================================================= */ #if defined(LUA_COMPAT_MODULE) /* ** changes the environment variable of calling function */ static void set_env (lua_State *L) { lua_Debug ar; if (lua_getstack(L, 1, &ar) == 0 || lua_getinfo(L, "f", &ar) == 0 || /* get calling function */ lua_iscfunction(L, -1)) luaL_error(L, LUA_QL("module") " not called from a Lua function"); lua_pushvalue(L, -2); /* copy new environment table to top */ lua_setupvalue(L, -2, 1); lua_pop(L, 1); /* remove function */ } static void dooptions (lua_State *L, int n) { int i; for (i = 2; i <= n; i++) { if (lua_isfunction(L, i)) { /* avoid 'calling' extra info. */ lua_pushvalue(L, i); /* get option (a function) */ lua_pushvalue(L, -2); /* module */ lua_call(L, 1, 0); } } } static void modinit (lua_State *L, const char *modname) { const char *dot; lua_pushvalue(L, -1); lua_setfield(L, -2, "_M"); /* module._M = module */ lua_pushstring(L, modname); lua_setfield(L, -2, "_NAME"); dot = strrchr(modname, '.'); /* look for last dot in module name */ if (dot == NULL) dot = modname; else dot++; /* set _PACKAGE as package name (full module name minus last part) */ lua_pushlstring(L, modname, dot - modname); lua_setfield(L, -2, "_PACKAGE"); } static int ll_module (lua_State *L) { const char *modname = luaL_checkstring(L, 1); int lastarg = lua_gettop(L); /* last parameter */ luaL_pushmodule(L, modname, 1); /* get/create module table */ /* check whether table already has a _NAME field */ lua_getfield(L, -1, "_NAME"); if (!lua_isnil(L, -1)) /* is table an initialized module? */ lua_pop(L, 1); else { /* no; initialize it */ lua_pop(L, 1); modinit(L, modname); } lua_pushvalue(L, -1); set_env(L); dooptions(L, lastarg); return 1; } static int ll_seeall (lua_State *L) { luaL_checktype(L, 1, LUA_TTABLE); if (!lua_getmetatable(L, 1)) { lua_createtable(L, 0, 1); /* create new metatable */ lua_pushvalue(L, -1); lua_setmetatable(L, 1); } lua_pushglobaltable(L); lua_setfield(L, -2, "__index"); /* mt.__index = _G */ return 0; } #endif /* }====================================================== */ /* auxiliary mark (for internal use) */ #define AUXMARK "\1" /* ** return registry.LUA_NOENV as a boolean */ static int noenv (lua_State *L) { int b; lua_getfield(L, LUA_REGISTRYINDEX, "LUA_NOENV"); b = lua_toboolean(L, -1); lua_pop(L, 1); /* remove value */ return b; } static void setpath (lua_State *L, const char *fieldname, const char *envname1, const char *envname2, const char *def) { const char *path = getenv(envname1); if (path == NULL) /* no environment variable? */ path = getenv(envname2); /* try alternative name */ if (path == NULL || noenv(L)) /* no environment variable? */ lua_pushstring(L, def); /* use default */ else { /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */ path = luaL_gsub(L, path, LUA_PATH_SEP LUA_PATH_SEP, LUA_PATH_SEP AUXMARK LUA_PATH_SEP); luaL_gsub(L, path, AUXMARK, def); lua_remove(L, -2); } setprogdir(L); lua_setfield(L, -2, fieldname); } static const luaL_Reg pk_funcs[] = { {"loadlib", ll_loadlib}, {"searchpath", ll_searchpath}, #if defined(LUA_COMPAT_MODULE) {"seeall", ll_seeall}, #endif {NULL, NULL} }; static const luaL_Reg ll_funcs[] = { #if defined(LUA_COMPAT_MODULE) {"module", ll_module}, #endif {"require", ll_require}, {NULL, NULL} }; static const lua_CFunction searchers[] = {searcher_preload, searcher_Lua, searcher_C, searcher_Croot, NULL}; LUAMOD_API int luaopen_package (lua_State *L) { int i; /* create new type _LOADLIB */ luaL_newmetatable(L, "_LOADLIB"); lua_pushcfunction(L, gctm); lua_setfield(L, -2, "__gc"); /* create `package' table */ luaL_newlib(L, pk_funcs); /* create 'searchers' table */ lua_createtable(L, sizeof(searchers)/sizeof(searchers[0]) - 1, 0); /* fill it with pre-defined searchers */ for (i=0; searchers[i] != NULL; i++) { lua_pushvalue(L, -2); /* set 'package' as upvalue for all searchers */ lua_pushcclosure(L, searchers[i], 1); lua_rawseti(L, -2, i+1); } #if defined(LUA_COMPAT_LOADERS) lua_pushvalue(L, -1); /* make a copy of 'searchers' table */ lua_setfield(L, -3, "loaders"); /* put it in field `loaders' */ #endif lua_setfield(L, -2, "searchers"); /* put it in field 'searchers' */ /* set field 'path' */ setpath(L, "path", LUA_PATHVERSION, LUA_PATH, LUA_PATH_DEFAULT); /* set field 'cpath' */ setpath(L, "cpath", LUA_CPATHVERSION, LUA_CPATH, LUA_CPATH_DEFAULT); /* store config information */ lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATH_SEP "\n" LUA_PATH_MARK "\n" LUA_EXEC_DIR "\n" LUA_IGMARK "\n"); lua_setfield(L, -2, "config"); /* set field `loaded' */ luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED"); lua_setfield(L, -2, "loaded"); /* set field `preload' */ luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD"); lua_setfield(L, -2, "preload"); lua_pushglobaltable(L); lua_pushvalue(L, -2); /* set 'package' as upvalue for next lib */ luaL_setfuncs(L, ll_funcs, 1); /* open lib into global table */ lua_pop(L, 1); /* pop global table */ return 1; /* return 'package' table */ } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/ldebug.h0000644000175000017500000000207312320456500020133 0ustar mathieumathieu/* ** $Id: ldebug.h,v 2.7 2011/10/07 20:45:19 roberto Exp $ ** Auxiliary functions from Debug Interface module ** See Copyright Notice in lua.h */ #ifndef ldebug_h #define ldebug_h #include "lstate.h" #define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) #define getfuncline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) #define resethookcount(L) (L->hookcount = L->basehookcount) /* Active Lua function (given call info) */ #define ci_func(ci) (clLvalue((ci)->func)) LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o, const char *opname); LUAI_FUNC l_noret luaG_concaterror (lua_State *L, StkId p1, StkId p2); LUAI_FUNC l_noret luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2); LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2); LUAI_FUNC l_noret luaG_runerror (lua_State *L, const char *fmt, ...); LUAI_FUNC l_noret luaG_errormsg (lua_State *L); #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/loslib.cpp0000644000175000017500000001771212320456500020516 0ustar mathieumathieu/* ** $Id: loslib.c,v 1.38 2011/11/30 12:35:05 roberto Exp $ ** Standard Operating System library ** See Copyright Notice in lua.h */ #include #include #include #include #include #define loslib_c #define LUA_LIB #include "lua.h" #include "lauxlib.h" #include "lualib.h" /* ** list of valid conversion specifiers for the 'strftime' function */ #if !defined(LUA_STRFTIMEOPTIONS) #if !defined(LUA_USE_POSIX) #define LUA_STRFTIMEOPTIONS { "aAbBcdHIjmMpSUwWxXyYz%", "" } #else #define LUA_STRFTIMEOPTIONS { "aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ%", "", \ "E", "cCxXyY", \ "O", "deHImMSuUVwWy" } #endif #endif /* ** By default, Lua uses tmpnam except when POSIX is available, where it ** uses mkstemp. */ #if defined(LUA_USE_MKSTEMP) #include #define LUA_TMPNAMBUFSIZE 32 #define lua_tmpnam(b,e) { \ strcpy(b, "/tmp/lua_XXXXXX"); \ e = mkstemp(b); \ if (e != -1) close(e); \ e = (e == -1); } #elif !defined(lua_tmpnam) #define LUA_TMPNAMBUFSIZE L_tmpnam #define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); } #endif /* ** By default, Lua uses gmtime/localtime, except when POSIX is available, ** where it uses gmtime_r/localtime_r */ #if defined(LUA_USE_GMTIME_R) #define l_gmtime(t,r) gmtime_r(t,r) #define l_localtime(t,r) localtime_r(t,r) #elif !defined(l_gmtime) #define l_gmtime(t,r) ((void)r, gmtime(t)) #define l_localtime(t,r) ((void)r, localtime(t)) #endif static int os_execute (lua_State *L) { const char *cmd = luaL_optstring(L, 1, NULL); int stat = system(cmd); if (cmd != NULL) return luaL_execresult(L, stat); else { lua_pushboolean(L, stat); /* true if there is a shell */ return 1; } } static int os_remove (lua_State *L) { const char *filename = luaL_checkstring(L, 1); return luaL_fileresult(L, remove(filename) == 0, filename); } static int os_rename (lua_State *L) { const char *fromname = luaL_checkstring(L, 1); const char *toname = luaL_checkstring(L, 2); return luaL_fileresult(L, rename(fromname, toname) == 0, fromname); } static int os_tmpname (lua_State *L) { char buff[LUA_TMPNAMBUFSIZE]; int err; lua_tmpnam(buff, err); if (err) return luaL_error(L, "unable to generate a unique filename"); lua_pushstring(L, buff); return 1; } static int os_getenv (lua_State *L) { lua_pushstring(L, getenv(luaL_checkstring(L, 1))); /* if NULL push nil */ return 1; } static int os_clock (lua_State *L) { lua_pushnumber(L, ((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC); return 1; } /* ** {====================================================== ** Time/Date operations ** { year=%Y, month=%m, day=%d, hour=%H, min=%M, sec=%S, ** wday=%w+1, yday=%j, isdst=? } ** ======================================================= */ static void setfield (lua_State *L, const char *key, int value) { lua_pushinteger(L, value); lua_setfield(L, -2, key); } static void setboolfield (lua_State *L, const char *key, int value) { if (value < 0) /* undefined? */ return; /* does not set field */ lua_pushboolean(L, value); lua_setfield(L, -2, key); } static int getboolfield (lua_State *L, const char *key) { int res; lua_getfield(L, -1, key); res = lua_isnil(L, -1) ? -1 : lua_toboolean(L, -1); lua_pop(L, 1); return res; } static int getfield (lua_State *L, const char *key, int d) { int res, isnum; lua_getfield(L, -1, key); res = (int)lua_tointegerx(L, -1, &isnum); if (!isnum) { if (d < 0) return luaL_error(L, "field " LUA_QS " missing in date table", key); res = d; } lua_pop(L, 1); return res; } static const char *checkoption (lua_State *L, const char *conv, char *buff) { static const char *const options[] = LUA_STRFTIMEOPTIONS; unsigned int i; for (i = 0; i < sizeof(options)/sizeof(options[0]); i += 2) { if (*conv != '\0' && strchr(options[i], *conv) != NULL) { buff[1] = *conv; if (*options[i + 1] == '\0') { /* one-char conversion specifier? */ buff[2] = '\0'; /* end buffer */ return conv + 1; } else if (*(conv + 1) != '\0' && strchr(options[i + 1], *(conv + 1)) != NULL) { buff[2] = *(conv + 1); /* valid two-char conversion specifier */ buff[3] = '\0'; /* end buffer */ return conv + 2; } } } luaL_argerror(L, 1, lua_pushfstring(L, "invalid conversion specifier '%%%s'", conv)); return conv; /* to avoid warnings */ } static int os_date (lua_State *L) { const char *s = luaL_optstring(L, 1, "%c"); time_t t = luaL_opt(L, (time_t)luaL_checknumber, 2, time(NULL)); struct tm tmr, *stm; if (*s == '!') { /* UTC? */ stm = l_gmtime(&t, &tmr); s++; /* skip `!' */ } else stm = l_localtime(&t, &tmr); if (stm == NULL) /* invalid date? */ lua_pushnil(L); else if (strcmp(s, "*t") == 0) { lua_createtable(L, 0, 9); /* 9 = number of fields */ setfield(L, "sec", stm->tm_sec); setfield(L, "min", stm->tm_min); setfield(L, "hour", stm->tm_hour); setfield(L, "day", stm->tm_mday); setfield(L, "month", stm->tm_mon+1); setfield(L, "year", stm->tm_year+1900); setfield(L, "wday", stm->tm_wday+1); setfield(L, "yday", stm->tm_yday+1); setboolfield(L, "isdst", stm->tm_isdst); } else { char cc[4]; luaL_Buffer b; cc[0] = '%'; luaL_buffinit(L, &b); while (*s) { if (*s != '%') /* no conversion specifier? */ luaL_addchar(&b, *s++); else { size_t reslen; char buff[200]; /* should be big enough for any conversion result */ s = checkoption(L, s + 1, cc); reslen = strftime(buff, sizeof(buff), cc, stm); luaL_addlstring(&b, buff, reslen); } } luaL_pushresult(&b); } return 1; } static int os_time (lua_State *L) { time_t t; if (lua_isnoneornil(L, 1)) /* called without args? */ t = time(NULL); /* get current time */ else { struct tm ts; luaL_checktype(L, 1, LUA_TTABLE); lua_settop(L, 1); /* make sure table is at the top */ ts.tm_sec = getfield(L, "sec", 0); ts.tm_min = getfield(L, "min", 0); ts.tm_hour = getfield(L, "hour", 12); ts.tm_mday = getfield(L, "day", -1); ts.tm_mon = getfield(L, "month", -1) - 1; ts.tm_year = getfield(L, "year", -1) - 1900; ts.tm_isdst = getboolfield(L, "isdst"); t = mktime(&ts); } if (t == (time_t)(-1)) lua_pushnil(L); else lua_pushnumber(L, (lua_Number)t); return 1; } static int os_difftime (lua_State *L) { lua_pushnumber(L, difftime((time_t)(luaL_checknumber(L, 1)), (time_t)(luaL_optnumber(L, 2, 0)))); return 1; } /* }====================================================== */ static int os_setlocale (lua_State *L) { static const int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME}; static const char *const catnames[] = {"all", "collate", "ctype", "monetary", "numeric", "time", NULL}; const char *l = luaL_optstring(L, 1, NULL); int op = luaL_checkoption(L, 2, "all", catnames); lua_pushstring(L, setlocale(cat[op], l)); return 1; } static int os_exit (lua_State *L) { int status; if (lua_isboolean(L, 1)) status = (lua_toboolean(L, 1) ? EXIT_SUCCESS : EXIT_FAILURE); else status = luaL_optint(L, 1, EXIT_SUCCESS); if (lua_toboolean(L, 2)) lua_close(L); if (L) exit(status); /* 'if' to avoid warnings for unreachable 'return' */ return 0; } static const luaL_Reg syslib[] = { {"clock", os_clock}, {"date", os_date}, {"difftime", os_difftime}, {"execute", os_execute}, {"exit", os_exit}, {"getenv", os_getenv}, {"remove", os_remove}, {"rename", os_rename}, {"setlocale", os_setlocale}, {"time", os_time}, {"tmpname", os_tmpname}, {NULL, NULL} }; /* }====================================================== */ LUAMOD_API int luaopen_os (lua_State *L) { luaL_newlib(L, syslib); return 1; } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/ltablib.cpp0000644000175000017500000001670512320456500020644 0ustar mathieumathieu/* ** $Id: ltablib.c,v 1.63 2011/11/28 17:26:30 roberto Exp $ ** Library for Table Manipulation ** See Copyright Notice in lua.h */ #include #define ltablib_c #define LUA_LIB #include "lua.h" #include "lauxlib.h" #include "lualib.h" #define aux_getn(L,n) \ (luaL_checktype(L, n, LUA_TTABLE), luaL_len(L, n)) #if defined(LUA_COMPAT_MAXN) static int maxn (lua_State *L) { lua_Number max = 0; luaL_checktype(L, 1, LUA_TTABLE); lua_pushnil(L); /* first key */ while (lua_next(L, 1)) { lua_pop(L, 1); /* remove value */ if (lua_type(L, -1) == LUA_TNUMBER) { lua_Number v = lua_tonumber(L, -1); if (v > max) max = v; } } lua_pushnumber(L, max); return 1; } #endif static int tinsert (lua_State *L) { int e = aux_getn(L, 1) + 1; /* first empty element */ int pos; /* where to insert new element */ switch (lua_gettop(L)) { case 2: { /* called with only 2 arguments */ pos = e; /* insert new element at the end */ break; } case 3: { int i; pos = luaL_checkint(L, 2); /* 2nd argument is the position */ if (pos > e) e = pos; /* `grow' array if necessary */ for (i = e; i > pos; i--) { /* move up elements */ lua_rawgeti(L, 1, i-1); lua_rawseti(L, 1, i); /* t[i] = t[i-1] */ } break; } default: { return luaL_error(L, "wrong number of arguments to " LUA_QL("insert")); } } lua_rawseti(L, 1, pos); /* t[pos] = v */ return 0; } static int tremove (lua_State *L) { int e = aux_getn(L, 1); int pos = luaL_optint(L, 2, e); if (!(1 <= pos && pos <= e)) /* position is outside bounds? */ return 0; /* nothing to remove */ lua_rawgeti(L, 1, pos); /* result = t[pos] */ for ( ;pos 0) { /* at least one element? */ int i; lua_pushvalue(L, 1); lua_rawseti(L, -2, 1); /* insert first element */ lua_replace(L, 1); /* move table into index 1 */ for (i = n; i >= 2; i--) /* assign other elements */ lua_rawseti(L, 1, i); } return 1; /* return table */ } static int unpack (lua_State *L) { int i, e, n; luaL_checktype(L, 1, LUA_TTABLE); i = luaL_optint(L, 2, 1); e = luaL_opt(L, luaL_checkint, 3, luaL_len(L, 1)); if (i > e) return 0; /* empty range */ n = e - i + 1; /* number of elements */ if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arith. overflow */ return luaL_error(L, "too many results to unpack"); lua_rawgeti(L, 1, i); /* push arg[i] (avoiding overflow problems) */ while (i++ < e) /* push arg[i + 1...e] */ lua_rawgeti(L, 1, i); return n; } /* }====================================================== */ /* ** {====================================================== ** Quicksort ** (based on `Algorithms in MODULA-3', Robert Sedgewick; ** Addison-Wesley, 1993.) ** ======================================================= */ static void set2 (lua_State *L, int i, int j) { lua_rawseti(L, 1, i); lua_rawseti(L, 1, j); } static int sort_comp (lua_State *L, int a, int b) { if (!lua_isnil(L, 2)) { /* function? */ int res; lua_pushvalue(L, 2); lua_pushvalue(L, a-1); /* -1 to compensate function */ lua_pushvalue(L, b-2); /* -2 to compensate function and `a' */ lua_call(L, 2, 1); res = lua_toboolean(L, -1); lua_pop(L, 1); return res; } else /* a < b? */ return lua_compare(L, a, b, LUA_OPLT); } static void auxsort (lua_State *L, int l, int u) { while (l < u) { /* for tail recursion */ int i, j; /* sort elements a[l], a[(l+u)/2] and a[u] */ lua_rawgeti(L, 1, l); lua_rawgeti(L, 1, u); if (sort_comp(L, -1, -2)) /* a[u] < a[l]? */ set2(L, l, u); /* swap a[l] - a[u] */ else lua_pop(L, 2); if (u-l == 1) break; /* only 2 elements */ i = (l+u)/2; lua_rawgeti(L, 1, i); lua_rawgeti(L, 1, l); if (sort_comp(L, -2, -1)) /* a[i]= P */ while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) { if (i>=u) luaL_error(L, "invalid order function for sorting"); lua_pop(L, 1); /* remove a[i] */ } /* repeat --j until a[j] <= P */ while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) { if (j<=l) luaL_error(L, "invalid order function for sorting"); lua_pop(L, 1); /* remove a[j] */ } if (jgcstate && (g)->gcstate <= GCSsweep) #define isgenerational(g) ((g)->gckind == KGC_GEN) /* ** macro to tell when main invariant (white objects cannot point to black ** ones) must be kept. During a non-generational collection, the sweep ** phase may break the invariant, as objects turned white may point to ** still-black objects. The invariant is restored when sweep ends and ** all objects are white again. During a generational collection, the ** invariant must be kept all times. */ #define keepinvariant(g) (isgenerational(g) || g->gcstate <= GCSatomic) /* ** some useful bit tricks */ #define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) #define setbits(x,m) ((x) |= (m)) #define testbits(x,m) ((x) & (m)) #define bitmask(b) (1<<(b)) #define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) #define l_setbit(x,b) setbits(x, bitmask(b)) #define resetbit(x,b) resetbits(x, bitmask(b)) #define testbit(x,b) testbits(x, bitmask(b)) /* Layout for bit use in `marked' field: */ #define WHITE0BIT 0 /* object is white (type 0) */ #define WHITE1BIT 1 /* object is white (type 1) */ #define BLACKBIT 2 /* object is black */ #define FINALIZEDBIT 3 /* object has been separated for finalization */ #define SEPARATED 4 /* object is in 'finobj' list or in 'tobefnz' */ #define FIXEDBIT 5 /* object is fixed (should not be collected) */ #define OLDBIT 6 /* object is old (only in generational mode) */ /* bit 7 is currently used by tests (luaL_checkmemory) */ #define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) #define iswhite(x) testbits((x)->gch.marked, WHITEBITS) #define isblack(x) testbit((x)->gch.marked, BLACKBIT) #define isgray(x) /* neither white nor black */ \ (!testbits((x)->gch.marked, WHITEBITS | bitmask(BLACKBIT))) #define isold(x) testbit((x)->gch.marked, OLDBIT) /* MOVE OLD rule: whenever an object is moved to the beginning of a GC list, its old bit must be cleared */ #define resetoldbit(o) resetbit((o)->gch.marked, OLDBIT) #define otherwhite(g) (g->currentwhite ^ WHITEBITS) #define isdeadm(ow,m) (!(((m) ^ WHITEBITS) & (ow))) #define isdead(g,v) isdeadm(otherwhite(g), (v)->gch.marked) #define changewhite(x) ((x)->gch.marked ^= WHITEBITS) #define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT) #define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) #define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) #define luaC_condGC(L,c) \ {if (G(L)->GCdebt > 0) {c;}; condchangemem(L);} #define luaC_checkGC(L) luaC_condGC(L, luaC_step(L);) #define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \ luaC_barrier_(L,obj2gco(p),gcvalue(v)); } #define luaC_barrierback(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \ luaC_barrierback_(L,p); } #define luaC_objbarrier(L,p,o) \ { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \ luaC_barrier_(L,obj2gco(p),obj2gco(o)); } #define luaC_objbarrierback(L,p,o) \ { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) luaC_barrierback_(L,p); } #define luaC_barrierproto(L,p,c) \ { if (isblack(obj2gco(p))) luaC_barrierproto_(L,p,c); } LUAI_FUNC void luaC_freeallobjects (lua_State *L); LUAI_FUNC void luaC_step (lua_State *L); LUAI_FUNC void luaC_forcestep (lua_State *L); LUAI_FUNC void luaC_runtilstate (lua_State *L, int statesmask); LUAI_FUNC void luaC_fullgc (lua_State *L, int isemergency); LUAI_FUNC GCObject *luaC_newobj (lua_State *L, int tt, size_t sz, GCObject **list, int offset); LUAI_FUNC void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v); LUAI_FUNC void luaC_barrierback_ (lua_State *L, GCObject *o); LUAI_FUNC void luaC_barrierproto_ (lua_State *L, Proto *p, Closure *c); LUAI_FUNC void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt); LUAI_FUNC void luaC_checkupvalcolor (global_State *g, UpVal *uv); LUAI_FUNC void luaC_changemode (lua_State *L, int mode); #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/ltm.cpp0000644000175000017500000000340312320456500020016 0ustar mathieumathieu/* ** $Id: ltm.c,v 2.14 2011/06/02 19:31:40 roberto Exp $ ** Tag methods ** See Copyright Notice in lua.h */ #include #define ltm_c #define LUA_CORE #include "lua.h" #include "lobject.h" #include "lstate.h" #include "lstring.h" #include "ltable.h" #include "ltm.h" static const char udatatypename[] = "userdata"; LUAI_DDEF const char *const luaT_typenames_[LUA_TOTALTAGS] = { "no value", "nil", "boolean", udatatypename, "number", "string", "table", "function", udatatypename, "thread", "proto", "upval" /* these last two cases are used for tests only */ }; void luaT_init (lua_State *L) { static const char *const luaT_eventname[] = { /* ORDER TM */ "__index", "__newindex", "__gc", "__mode", "__len", "__eq", "__add", "__sub", "__mul", "__div", "__mod", "__pow", "__unm", "__lt", "__le", "__concat", "__call" }; int i; for (i=0; itmname[i] = luaS_new(L, luaT_eventname[i]); luaS_fix(G(L)->tmname[i]); /* never collect these names */ } } /* ** function to be used with macro "fasttm": optimized for absence of ** tag methods */ const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { const TValue *tm = luaH_getstr(events, ename); lua_assert(event <= TM_EQ); if (ttisnil(tm)) { /* no tag method? */ events->flags |= cast_byte(1u<metatable; break; case LUA_TUSERDATA: mt = uvalue(o)->metatable; break; default: mt = G(L)->mt[ttypenv(o)]; } return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject); } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/ltable.h0000644000175000017500000000235312320456500020135 0ustar mathieumathieu/* ** $Id: ltable.h,v 2.16 2011/08/17 20:26:47 roberto Exp $ ** Lua tables (hash) ** See Copyright Notice in lua.h */ #ifndef ltable_h #define ltable_h #include "lobject.h" #define gnode(t,i) (&(t)->node[i]) #define gkey(n) (&(n)->i_key.tvk) #define gval(n) (&(n)->i_val) #define gnext(n) ((n)->i_key.nk.next) #define invalidateTMcache(t) ((t)->flags = 0) LUAI_FUNC const TValue *luaH_getint (Table *t, int key); LUAI_FUNC void luaH_setint (lua_State *L, Table *t, int key, TValue *value); LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); LUAI_FUNC TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key); LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); LUAI_FUNC Table *luaH_new (lua_State *L); LUAI_FUNC void luaH_resize (lua_State *L, Table *t, int nasize, int nhsize); LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize); LUAI_FUNC void luaH_free (lua_State *L, Table *t); LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); LUAI_FUNC int luaH_getn (Table *t); #if defined(LUA_DEBUG) LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); LUAI_FUNC int luaH_isdummy (Node *n); #endif #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lcorolib.cpp0000644000175000017500000000674612320456500021044 0ustar mathieumathieu/* ** $Id: lcorolib.c,v 1.3 2011/08/23 17:24:34 roberto Exp $ ** Coroutine Library ** See Copyright Notice in lua.h */ #include #define lcorolib_c #define LUA_LIB #include "lua.h" #include "lauxlib.h" #include "lualib.h" static int auxresume (lua_State *L, lua_State *co, int narg) { int status; if (!lua_checkstack(co, narg)) { lua_pushliteral(L, "too many arguments to resume"); return -1; /* error flag */ } if (lua_status(co) == LUA_OK && lua_gettop(co) == 0) { lua_pushliteral(L, "cannot resume dead coroutine"); return -1; /* error flag */ } lua_xmove(L, co, narg); status = lua_resume(co, L, narg); if (status == LUA_OK || status == LUA_YIELD) { int nres = lua_gettop(co); if (!lua_checkstack(L, nres + 1)) { lua_pop(co, nres); /* remove results anyway */ lua_pushliteral(L, "too many results to resume"); return -1; /* error flag */ } lua_xmove(co, L, nres); /* move yielded values */ return nres; } else { lua_xmove(co, L, 1); /* move error message */ return -1; /* error flag */ } } static int luaB_coresume (lua_State *L) { lua_State *co = lua_tothread(L, 1); int r; luaL_argcheck(L, co, 1, "coroutine expected"); r = auxresume(L, co, lua_gettop(L) - 1); if (r < 0) { lua_pushboolean(L, 0); lua_insert(L, -2); return 2; /* return false + error message */ } else { lua_pushboolean(L, 1); lua_insert(L, -(r + 1)); return r + 1; /* return true + `resume' returns */ } } static int luaB_auxwrap (lua_State *L) { lua_State *co = lua_tothread(L, lua_upvalueindex(1)); int r = auxresume(L, co, lua_gettop(L)); if (r < 0) { if (lua_isstring(L, -1)) { /* error object is a string? */ luaL_where(L, 1); /* add extra info */ lua_insert(L, -2); lua_concat(L, 2); } lua_error(L); /* propagate error */ } return r; } static int luaB_cocreate (lua_State *L) { lua_State *NL = lua_newthread(L); luaL_checktype(L, 1, LUA_TFUNCTION); lua_pushvalue(L, 1); /* move function to top */ lua_xmove(L, NL, 1); /* move function from L to NL */ return 1; } static int luaB_cowrap (lua_State *L) { luaB_cocreate(L); lua_pushcclosure(L, luaB_auxwrap, 1); return 1; } static int luaB_yield (lua_State *L) { return lua_yield(L, lua_gettop(L)); } static int luaB_costatus (lua_State *L) { lua_State *co = lua_tothread(L, 1); luaL_argcheck(L, co, 1, "coroutine expected"); if (L == co) lua_pushliteral(L, "running"); else { switch (lua_status(co)) { case LUA_YIELD: lua_pushliteral(L, "suspended"); break; case LUA_OK: { lua_Debug ar; if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */ lua_pushliteral(L, "normal"); /* it is running */ else if (lua_gettop(co) == 0) lua_pushliteral(L, "dead"); else lua_pushliteral(L, "suspended"); /* initial state */ break; } default: /* some error occurred */ lua_pushliteral(L, "dead"); break; } } return 1; } static int luaB_corunning (lua_State *L) { int ismain = lua_pushthread(L); lua_pushboolean(L, ismain); return 2; } static const luaL_Reg co_funcs[] = { {"create", luaB_cocreate}, {"resume", luaB_coresume}, {"running", luaB_corunning}, {"status", luaB_costatus}, {"wrap", luaB_cowrap}, {"yield", luaB_yield}, {NULL, NULL} }; LUAMOD_API int luaopen_coroutine (lua_State *L) { luaL_newlib(L, co_funcs); return 1; } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lopcodes.h0000644000175000017500000002044212320456500020501 0ustar mathieumathieu/* ** $Id: lopcodes.h,v 1.142 2011/07/15 12:50:29 roberto Exp $ ** Opcodes for Lua virtual machine ** See Copyright Notice in lua.h */ #ifndef lopcodes_h #define lopcodes_h #include "llimits.h" /*=========================================================================== We assume that instructions are unsigned numbers. All instructions have an opcode in the first 6 bits. Instructions can have the following fields: `A' : 8 bits `B' : 9 bits `C' : 9 bits 'Ax' : 26 bits ('A', 'B', and 'C' together) `Bx' : 18 bits (`B' and `C' together) `sBx' : signed Bx A signed argument is represented in excess K; that is, the number value is the unsigned value minus K. K is exactly the maximum value for that argument (so that -max is represented by 0, and +max is represented by 2*max), which is half the maximum for the corresponding unsigned argument. ===========================================================================*/ enum OpMode {iABC, iABx, iAsBx, iAx}; /* basic instruction format */ /* ** size and position of opcode arguments. */ #define SIZE_C 9 #define SIZE_B 9 #define SIZE_Bx (SIZE_C + SIZE_B) #define SIZE_A 8 #define SIZE_Ax (SIZE_C + SIZE_B + SIZE_A) #define SIZE_OP 6 #define POS_OP 0 #define POS_A (POS_OP + SIZE_OP) #define POS_C (POS_A + SIZE_A) #define POS_B (POS_C + SIZE_C) #define POS_Bx POS_C #define POS_Ax POS_A /* ** limits for opcode arguments. ** we use (signed) int to manipulate most arguments, ** so they must fit in LUAI_BITSINT-1 bits (-1 for sign) */ #if SIZE_Bx < LUAI_BITSINT-1 #define MAXARG_Bx ((1<>1) /* `sBx' is signed */ #else #define MAXARG_Bx MAX_INT #define MAXARG_sBx MAX_INT #endif #if SIZE_Ax < LUAI_BITSINT-1 #define MAXARG_Ax ((1<>POS_OP) & MASK1(SIZE_OP,0))) #define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \ ((cast(Instruction, o)<>pos) & MASK1(size,0))) #define setarg(i,v,pos,size) ((i) = (((i)&MASK0(size,pos)) | \ ((cast(Instruction, v)<= R(A) + 1 */ OP_EQ,/* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */ OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */ OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */ OP_TEST,/* A C if not (R(A) <=> C) then pc++ */ OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */ OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */ OP_FORLOOP,/* A sBx R(A)+=R(A+2); if R(A) > 4) & 3)) #define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3)) #define testAMode(m) (luaP_opmodes[m] & (1 << 6)) #define testTMode(m) (luaP_opmodes[m] & (1 << 7)) LUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */ /* number of list items to accumulate before a SETLIST instruction */ #define LFIELDS_PER_FLUSH 50 #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lfunc.cpp0000644000175000017500000001070612320456500020335 0ustar mathieumathieu/* ** $Id: lfunc.c,v 2.27 2010/06/30 14:11:17 roberto Exp $ ** Auxiliary functions to manipulate prototypes and closures ** See Copyright Notice in lua.h */ #include #define lfunc_c #define LUA_CORE #include "lua.h" #include "lfunc.h" #include "lgc.h" #include "lmem.h" #include "lobject.h" #include "lstate.h" Closure *luaF_newCclosure (lua_State *L, int n) { Closure *c = &luaC_newobj(L, LUA_TFUNCTION, sizeCclosure(n), NULL, 0)->cl; c->c.isC = 1; c->c.nupvalues = cast_byte(n); return c; } Closure *luaF_newLclosure (lua_State *L, Proto *p) { int n = p->sizeupvalues; Closure *c = &luaC_newobj(L, LUA_TFUNCTION, sizeLclosure(n), NULL, 0)->cl; c->l.isC = 0; c->l.p = p; c->l.nupvalues = cast_byte(n); while (n--) c->l.upvals[n] = NULL; return c; } UpVal *luaF_newupval (lua_State *L) { UpVal *uv = &luaC_newobj(L, LUA_TUPVAL, sizeof(UpVal), NULL, 0)->uv; uv->v = &uv->u.value; setnilvalue(uv->v); return uv; } UpVal *luaF_findupval (lua_State *L, StkId level) { global_State *g = G(L); GCObject **pp = &L->openupval; UpVal *p; UpVal *uv; while (*pp != NULL && (p = gco2uv(*pp))->v >= level) { GCObject *o = obj2gco(p); lua_assert(p->v != &p->u.value); if (p->v == level) { /* found a corresponding upvalue? */ if (isdead(g, o)) /* is it dead? */ changewhite(o); /* resurrect it */ return p; } resetoldbit(o); /* may create a newer upval after this one */ pp = &p->next; } /* not found: create a new one */ uv = &luaC_newobj(L, LUA_TUPVAL, sizeof(UpVal), pp, 0)->uv; uv->v = level; /* current value lives in the stack */ uv->u.l.prev = &g->uvhead; /* double link it in `uvhead' list */ uv->u.l.next = g->uvhead.u.l.next; uv->u.l.next->u.l.prev = uv; g->uvhead.u.l.next = uv; lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); return uv; } static void unlinkupval (UpVal *uv) { lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); uv->u.l.next->u.l.prev = uv->u.l.prev; /* remove from `uvhead' list */ uv->u.l.prev->u.l.next = uv->u.l.next; } void luaF_freeupval (lua_State *L, UpVal *uv) { if (uv->v != &uv->u.value) /* is it open? */ unlinkupval(uv); /* remove from open list */ luaM_free(L, uv); /* free upvalue */ } void luaF_close (lua_State *L, StkId level) { UpVal *uv; global_State *g = G(L); while (L->openupval != NULL && (uv = gco2uv(L->openupval))->v >= level) { GCObject *o = obj2gco(uv); lua_assert(!isblack(o) && uv->v != &uv->u.value); L->openupval = uv->next; /* remove from `open' list */ if (isdead(g, o)) luaF_freeupval(L, uv); /* free upvalue */ else { unlinkupval(uv); /* remove upvalue from 'uvhead' list */ setobj(L, &uv->u.value, uv->v); /* move value to upvalue slot */ uv->v = &uv->u.value; /* now current value lives here */ gch(o)->next = g->allgc; /* link upvalue into 'allgc' list */ g->allgc = o; luaC_checkupvalcolor(g, uv); } } } Proto *luaF_newproto (lua_State *L) { Proto *f = &luaC_newobj(L, LUA_TPROTO, sizeof(Proto), NULL, 0)->p; f->k = NULL; f->sizek = 0; f->p = NULL; f->sizep = 0; f->code = NULL; f->cache = NULL; f->sizecode = 0; f->lineinfo = NULL; f->sizelineinfo = 0; f->upvalues = NULL; f->sizeupvalues = 0; f->numparams = 0; f->is_vararg = 0; f->maxstacksize = 0; f->locvars = NULL; f->sizelocvars = 0; f->linedefined = 0; f->lastlinedefined = 0; f->source = NULL; return f; } void luaF_freeproto (lua_State *L, Proto *f) { luaM_freearray(L, f->code, f->sizecode); luaM_freearray(L, f->p, f->sizep); luaM_freearray(L, f->k, f->sizek); luaM_freearray(L, f->lineinfo, f->sizelineinfo); luaM_freearray(L, f->locvars, f->sizelocvars); luaM_freearray(L, f->upvalues, f->sizeupvalues); luaM_free(L, f); } void luaF_freeclosure (lua_State *L, Closure *c) { int size = (c->c.isC) ? sizeCclosure(c->c.nupvalues) : sizeLclosure(c->l.nupvalues); luaM_freemem(L, c, size); } /* ** Look for n-th local variable at line `line' in function `func'. ** Returns NULL if not found. */ const char *luaF_getlocalname (const Proto *f, int local_number, int pc) { int i; for (i = 0; isizelocvars && f->locvars[i].startpc <= pc; i++) { if (pc < f->locvars[i].endpc) { /* is variable active? */ local_number--; if (local_number == 0) return getstr(f->locvars[i].varname); } } return NULL; /* not found */ } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lopcodes.cpp0000644000175000017500000000573512320456500021044 0ustar mathieumathieu/* ** $Id: lopcodes.c,v 1.48 2011/04/19 16:22:13 roberto Exp $ ** See Copyright Notice in lua.h */ #define lopcodes_c #define LUA_CORE #include "lopcodes.h" /* ORDER OP */ LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = { "MOVE", "LOADK", "LOADKX", "LOADBOOL", "LOADNIL", "GETUPVAL", "GETTABUP", "GETTABLE", "SETTABUP", "SETUPVAL", "SETTABLE", "NEWTABLE", "SELF", "ADD", "SUB", "MUL", "DIV", "MOD", "POW", "UNM", "NOT", "LEN", "CONCAT", "JMP", "EQ", "LT", "LE", "TEST", "TESTSET", "CALL", "TAILCALL", "RETURN", "FORLOOP", "FORPREP", "TFORCALL", "TFORLOOP", "SETLIST", "CLOSURE", "VARARG", "EXTRAARG", NULL }; #define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m)) LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { /* T A B C mode opcode */ opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */ ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */ ,opmode(0, 1, OpArgN, OpArgN, iABx) /* OP_LOADKX */ ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_LOADBOOL */ ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_LOADNIL */ ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_GETUPVAL */ ,opmode(0, 1, OpArgU, OpArgK, iABC) /* OP_GETTABUP */ ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_GETTABLE */ ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABUP */ ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_SETUPVAL */ ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABLE */ ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_NEWTABLE */ ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_SELF */ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_ADD */ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SUB */ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MUL */ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_DIV */ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MOD */ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_POW */ ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */ ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */ ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LEN */ ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_CONCAT */ ,opmode(0, 0, OpArgR, OpArgN, iAsBx) /* OP_JMP */ ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_EQ */ ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LT */ ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LE */ ,opmode(1, 0, OpArgN, OpArgU, iABC) /* OP_TEST */ ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TESTSET */ ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_CALL */ ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_TAILCALL */ ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_RETURN */ ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */ ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */ ,opmode(0, 0, OpArgN, OpArgU, iABC) /* OP_TFORCALL */ ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_TFORLOOP */ ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */ ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */ ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */ ,opmode(0, 0, OpArgU, OpArgU, iAx) /* OP_EXTRAARG */ }; ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/ldblib.cpp0000644000175000017500000002307612320456500020462 0ustar mathieumathieu/* ** $Id: ldblib.c,v 1.131 2011/10/24 14:54:05 roberto Exp $ ** Interface from Lua to its debug API ** See Copyright Notice in lua.h */ #include #include #include #define ldblib_c #define LUA_LIB #include "lua.h" #include "lauxlib.h" #include "lualib.h" #define HOOKKEY "_HKEY" static int db_getregistry (lua_State *L) { lua_pushvalue(L, LUA_REGISTRYINDEX); return 1; } static int db_getmetatable (lua_State *L) { luaL_checkany(L, 1); if (!lua_getmetatable(L, 1)) { lua_pushnil(L); /* no metatable */ } return 1; } static int db_setmetatable (lua_State *L) { int t = lua_type(L, 2); luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, "nil or table expected"); lua_settop(L, 2); lua_setmetatable(L, 1); return 1; /* return 1st argument */ } static int db_getuservalue (lua_State *L) { if (lua_type(L, 1) != LUA_TUSERDATA) lua_pushnil(L); else lua_getuservalue(L, 1); return 1; } static int db_setuservalue (lua_State *L) { if (lua_type(L, 1) == LUA_TLIGHTUSERDATA) luaL_argerror(L, 1, "full userdata expected, got light userdata"); luaL_checktype(L, 1, LUA_TUSERDATA); if (!lua_isnoneornil(L, 2)) luaL_checktype(L, 2, LUA_TTABLE); lua_settop(L, 2); lua_setuservalue(L, 1); return 1; } static void settabss (lua_State *L, const char *i, const char *v) { lua_pushstring(L, v); lua_setfield(L, -2, i); } static void settabsi (lua_State *L, const char *i, int v) { lua_pushinteger(L, v); lua_setfield(L, -2, i); } static void settabsb (lua_State *L, const char *i, int v) { lua_pushboolean(L, v); lua_setfield(L, -2, i); } static lua_State *getthread (lua_State *L, int *arg) { if (lua_isthread(L, 1)) { *arg = 1; return lua_tothread(L, 1); } else { *arg = 0; return L; } } static void treatstackoption (lua_State *L, lua_State *L1, const char *fname) { if (L == L1) { lua_pushvalue(L, -2); lua_remove(L, -3); } else lua_xmove(L1, L, 1); lua_setfield(L, -2, fname); } static int db_getinfo (lua_State *L) { lua_Debug ar; int arg; lua_State *L1 = getthread(L, &arg); const char *options = luaL_optstring(L, arg+2, "flnStu"); if (lua_isnumber(L, arg+1)) { if (!lua_getstack(L1, (int)lua_tointeger(L, arg+1), &ar)) { lua_pushnil(L); /* level out of range */ return 1; } } else if (lua_isfunction(L, arg+1)) { lua_pushfstring(L, ">%s", options); options = lua_tostring(L, -1); lua_pushvalue(L, arg+1); lua_xmove(L, L1, 1); } else return luaL_argerror(L, arg+1, "function or level expected"); if (!lua_getinfo(L1, options, &ar)) return luaL_argerror(L, arg+2, "invalid option"); lua_createtable(L, 0, 2); if (strchr(options, 'S')) { settabss(L, "source", ar.source); settabss(L, "short_src", ar.short_src); settabsi(L, "linedefined", ar.linedefined); settabsi(L, "lastlinedefined", ar.lastlinedefined); settabss(L, "what", ar.what); } if (strchr(options, 'l')) settabsi(L, "currentline", ar.currentline); if (strchr(options, 'u')) { settabsi(L, "nups", ar.nups); settabsi(L, "nparams", ar.nparams); settabsb(L, "isvararg", ar.isvararg); } if (strchr(options, 'n')) { settabss(L, "name", ar.name); settabss(L, "namewhat", ar.namewhat); } if (strchr(options, 't')) settabsb(L, "istailcall", ar.istailcall); if (strchr(options, 'L')) treatstackoption(L, L1, "activelines"); if (strchr(options, 'f')) treatstackoption(L, L1, "func"); return 1; /* return table */ } static int db_getlocal (lua_State *L) { int arg; lua_State *L1 = getthread(L, &arg); lua_Debug ar; const char *name; int nvar = luaL_checkint(L, arg+2); /* local-variable index */ if (lua_isfunction(L, arg + 1)) { /* function argument? */ lua_pushvalue(L, arg + 1); /* push function */ lua_pushstring(L, lua_getlocal(L, NULL, nvar)); /* push local name */ return 1; } else { /* stack-level argument */ if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */ return luaL_argerror(L, arg+1, "level out of range"); name = lua_getlocal(L1, &ar, nvar); if (name) { lua_xmove(L1, L, 1); /* push local value */ lua_pushstring(L, name); /* push name */ lua_pushvalue(L, -2); /* re-order */ return 2; } else { lua_pushnil(L); /* no name (nor value) */ return 1; } } } static int db_setlocal (lua_State *L) { int arg; lua_State *L1 = getthread(L, &arg); lua_Debug ar; if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */ return luaL_argerror(L, arg+1, "level out of range"); luaL_checkany(L, arg+3); lua_settop(L, arg+3); lua_xmove(L, L1, 1); lua_pushstring(L, lua_setlocal(L1, &ar, luaL_checkint(L, arg+2))); return 1; } static int auxupvalue (lua_State *L, int get) { const char *name; int n = luaL_checkint(L, 2); luaL_checktype(L, 1, LUA_TFUNCTION); name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n); if (name == NULL) return 0; lua_pushstring(L, name); lua_insert(L, -(get+1)); return get + 1; } static int db_getupvalue (lua_State *L) { return auxupvalue(L, 1); } static int db_setupvalue (lua_State *L) { luaL_checkany(L, 3); return auxupvalue(L, 0); } static int checkupval (lua_State *L, int argf, int argnup) { lua_Debug ar; int nup = luaL_checkint(L, argnup); luaL_checktype(L, argf, LUA_TFUNCTION); lua_pushvalue(L, argf); lua_getinfo(L, ">u", &ar); luaL_argcheck(L, 1 <= nup && nup <= ar.nups, argnup, "invalid upvalue index"); return nup; } static int db_upvalueid (lua_State *L) { int n = checkupval(L, 1, 2); lua_pushlightuserdata(L, lua_upvalueid(L, 1, n)); return 1; } static int db_upvaluejoin (lua_State *L) { int n1 = checkupval(L, 1, 2); int n2 = checkupval(L, 3, 4); luaL_argcheck(L, !lua_iscfunction(L, 1), 1, "Lua function expected"); luaL_argcheck(L, !lua_iscfunction(L, 3), 3, "Lua function expected"); lua_upvaluejoin(L, 1, n1, 3, n2); return 0; } #define gethooktable(L) luaL_getsubtable(L, LUA_REGISTRYINDEX, HOOKKEY); static void hookf (lua_State *L, lua_Debug *ar) { static const char *const hooknames[] = {"call", "return", "line", "count", "tail call"}; gethooktable(L); lua_rawgetp(L, -1, L); if (lua_isfunction(L, -1)) { lua_pushstring(L, hooknames[(int)ar->event]); if (ar->currentline >= 0) lua_pushinteger(L, ar->currentline); else lua_pushnil(L); lua_assert(lua_getinfo(L, "lS", ar)); lua_call(L, 2, 0); } } static int makemask (const char *smask, int count) { int mask = 0; if (strchr(smask, 'c')) mask |= LUA_MASKCALL; if (strchr(smask, 'r')) mask |= LUA_MASKRET; if (strchr(smask, 'l')) mask |= LUA_MASKLINE; if (count > 0) mask |= LUA_MASKCOUNT; return mask; } static char *unmakemask (int mask, char *smask) { int i = 0; if (mask & LUA_MASKCALL) smask[i++] = 'c'; if (mask & LUA_MASKRET) smask[i++] = 'r'; if (mask & LUA_MASKLINE) smask[i++] = 'l'; smask[i] = '\0'; return smask; } static int db_sethook (lua_State *L) { int arg, mask, count; lua_Hook func; lua_State *L1 = getthread(L, &arg); if (lua_isnoneornil(L, arg+1)) { lua_settop(L, arg+1); func = NULL; mask = 0; count = 0; /* turn off hooks */ } else { const char *smask = luaL_checkstring(L, arg+2); luaL_checktype(L, arg+1, LUA_TFUNCTION); count = luaL_optint(L, arg+3, 0); func = hookf; mask = makemask(smask, count); } gethooktable(L); lua_pushvalue(L, arg+1); lua_rawsetp(L, -2, L1); /* set new hook */ lua_pop(L, 1); /* remove hook table */ lua_sethook(L1, func, mask, count); /* set hooks */ return 0; } static int db_gethook (lua_State *L) { int arg; lua_State *L1 = getthread(L, &arg); char buff[5]; int mask = lua_gethookmask(L1); lua_Hook hook = lua_gethook(L1); if (hook != NULL && hook != hookf) /* external hook? */ lua_pushliteral(L, "external hook"); else { gethooktable(L); lua_rawgetp(L, -1, L1); /* get hook */ lua_remove(L, -2); /* remove hook table */ } lua_pushstring(L, unmakemask(mask, buff)); lua_pushinteger(L, lua_gethookcount(L1)); return 3; } static int db_debug (lua_State *L) { for (;;) { char buffer[250]; luai_writestringerror("%s", "lua_debug> "); if (fgets(buffer, sizeof(buffer), stdin) == 0 || strcmp(buffer, "cont\n") == 0) return 0; if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") || lua_pcall(L, 0, 0, 0)) luai_writestringerror("%s\n", lua_tostring(L, -1)); lua_settop(L, 0); /* remove eventual returns */ } } static int db_traceback (lua_State *L) { int arg; lua_State *L1 = getthread(L, &arg); const char *msg = lua_tostring(L, arg + 1); if (msg == NULL && !lua_isnoneornil(L, arg + 1)) /* non-string 'msg'? */ lua_pushvalue(L, arg + 1); /* return it untouched */ else { int level = luaL_optint(L, arg + 2, (L == L1) ? 1 : 0); luaL_traceback(L, L1, msg, level); } return 1; } static const luaL_Reg dblib[] = { {"debug", db_debug}, {"getuservalue", db_getuservalue}, {"gethook", db_gethook}, {"getinfo", db_getinfo}, {"getlocal", db_getlocal}, {"getregistry", db_getregistry}, {"getmetatable", db_getmetatable}, {"getupvalue", db_getupvalue}, {"upvaluejoin", db_upvaluejoin}, {"upvalueid", db_upvalueid}, {"setuservalue", db_setuservalue}, {"sethook", db_sethook}, {"setlocal", db_setlocal}, {"setmetatable", db_setmetatable}, {"setupvalue", db_setupvalue}, {"traceback", db_traceback}, {NULL, NULL} }; LUAMOD_API int luaopen_debug (lua_State *L) { luaL_newlib(L, dblib); return 1; } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lualib.h0000644000175000017500000000210712320456500020137 0ustar mathieumathieu/* ** $Id: lualib.h,v 1.43 2011/12/08 12:11:37 roberto Exp $ ** Lua standard libraries ** See Copyright Notice in lua.h */ #ifndef lualib_h #define lualib_h #include "lua.h" LUAMOD_API int (luaopen_base) (lua_State *L); #define LUA_COLIBNAME "coroutine" LUAMOD_API int (luaopen_coroutine) (lua_State *L); #define LUA_TABLIBNAME "table" LUAMOD_API int (luaopen_table) (lua_State *L); #define LUA_IOLIBNAME "io" LUAMOD_API int (luaopen_io) (lua_State *L); #define LUA_OSLIBNAME "os" LUAMOD_API int (luaopen_os) (lua_State *L); #define LUA_STRLIBNAME "string" LUAMOD_API int (luaopen_string) (lua_State *L); #define LUA_BITLIBNAME "bit32" LUAMOD_API int (luaopen_bit32) (lua_State *L); #define LUA_MATHLIBNAME "math" LUAMOD_API int (luaopen_math) (lua_State *L); #define LUA_DBLIBNAME "debug" LUAMOD_API int (luaopen_debug) (lua_State *L); #define LUA_LOADLIBNAME "package" LUAMOD_API int (luaopen_package) (lua_State *L); /* open all previous libraries */ LUALIB_API void (luaL_openlibs) (lua_State *L); #if !defined(lua_assert) #define lua_assert(x) ((void)0) #endif #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lapi.cpp0000644000175000017500000007171612320456500020163 0ustar mathieumathieu/* ** $Id: lapi.c,v 2.159 2011/11/30 12:32:05 roberto Exp $ ** Lua API ** See Copyright Notice in lua.h */ #include #include #define lapi_c #define LUA_CORE #include "lua.h" #include "lapi.h" #include "ldebug.h" #include "ldo.h" #include "lfunc.h" #include "lgc.h" #include "lmem.h" #include "lobject.h" #include "lstate.h" #include "lstring.h" #include "ltable.h" #include "ltm.h" #include "lundump.h" #include "lvm.h" const char lua_ident[] = "$LuaVersion: " LUA_COPYRIGHT " $" "$LuaAuthors: " LUA_AUTHORS " $"; /* value at a non-valid index */ #define NONVALIDVALUE cast(TValue *, luaO_nilobject) /* corresponding test */ #define isvalid(o) ((o) != luaO_nilobject) #define api_checkvalidindex(L, i) api_check(L, isvalid(i), "invalid index") static TValue *index2addr (lua_State *L, int idx) { CallInfo *ci = L->ci; if (idx > 0) { TValue *o = ci->func + idx; api_check(L, idx <= ci->top - (ci->func + 1), "unacceptable index"); if (o >= L->top) return NONVALIDVALUE; else return o; } else if (idx > LUA_REGISTRYINDEX) { api_check(L, idx != 0 && -idx <= L->top - (ci->func + 1), "invalid index"); return L->top + idx; } else if (idx == LUA_REGISTRYINDEX) return &G(L)->l_registry; else { /* upvalues */ idx = LUA_REGISTRYINDEX - idx; api_check(L, idx <= MAXUPVAL + 1, "upvalue index too large"); if (ttislcf(ci->func)) /* light C function? */ return NONVALIDVALUE; /* it has no upvalues */ else { CClosure *func = clCvalue(ci->func); return (idx <= func->nupvalues) ? &func->upvalue[idx-1] : NONVALIDVALUE; } } } /* ** to be called by 'lua_checkstack' in protected mode, to grow stack ** capturing memory errors */ static void growstack (lua_State *L, void *ud) { int size = *(int *)ud; luaD_growstack(L, size); } LUA_API int lua_checkstack (lua_State *L, int size) { int res; CallInfo *ci = L->ci; lua_lock(L); if (L->stack_last - L->top > size) /* stack large enough? */ res = 1; /* yes; check is OK */ else { /* no; need to grow stack */ int inuse = cast_int(L->top - L->stack) + EXTRA_STACK; if (inuse > LUAI_MAXSTACK - size) /* can grow without overflow? */ res = 0; /* no */ else /* try to grow stack */ res = (luaD_rawrunprotected(L, &growstack, &size) == LUA_OK); } if (res && ci->top < L->top + size) ci->top = L->top + size; /* adjust frame top */ lua_unlock(L); return res; } LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) { int i; if (from == to) return; lua_lock(to); api_checknelems(from, n); api_check(from, G(from) == G(to), "moving among independent states"); api_check(from, to->ci->top - to->top >= n, "not enough elements to move"); from->top -= n; for (i = 0; i < n; i++) { setobj2s(to, to->top++, from->top + i); } lua_unlock(to); } LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) { lua_CFunction old; lua_lock(L); old = G(L)->panic; G(L)->panic = panicf; lua_unlock(L); return old; } LUA_API const lua_Number *lua_version (lua_State *L) { static const lua_Number version = LUA_VERSION_NUM; if (L == NULL) return &version; else return G(L)->version; } /* ** basic stack manipulation */ /* ** convert an acceptable stack index into an absolute index */ LUA_API int lua_absindex (lua_State *L, int idx) { return (idx > 0 || idx <= LUA_REGISTRYINDEX) ? idx : cast_int(L->top - L->ci->func + idx); } LUA_API int lua_gettop (lua_State *L) { return cast_int(L->top - (L->ci->func + 1)); } LUA_API void lua_settop (lua_State *L, int idx) { StkId func = L->ci->func; lua_lock(L); if (idx >= 0) { api_check(L, idx <= L->stack_last - (func + 1), "new top too large"); while (L->top < (func + 1) + idx) setnilvalue(L->top++); L->top = (func + 1) + idx; } else { api_check(L, -(idx+1) <= (L->top - (func + 1)), "invalid new top"); L->top += idx+1; /* `subtract' index (index is negative) */ } lua_unlock(L); } LUA_API void lua_remove (lua_State *L, int idx) { StkId p; lua_lock(L); p = index2addr(L, idx); api_checkvalidindex(L, p); while (++p < L->top) setobjs2s(L, p-1, p); L->top--; lua_unlock(L); } LUA_API void lua_insert (lua_State *L, int idx) { StkId p; StkId q; lua_lock(L); p = index2addr(L, idx); api_checkvalidindex(L, p); for (q = L->top; q>p; q--) setobjs2s(L, q, q-1); setobjs2s(L, p, L->top); lua_unlock(L); } static void moveto (lua_State *L, TValue *fr, int idx) { TValue *to = index2addr(L, idx); api_checkvalidindex(L, to); setobj(L, to, fr); if (idx < LUA_REGISTRYINDEX) /* function upvalue? */ luaC_barrier(L, clCvalue(L->ci->func), fr); /* LUA_REGISTRYINDEX does not need gc barrier (collector revisits it before finishing collection) */ } LUA_API void lua_replace (lua_State *L, int idx) { lua_lock(L); api_checknelems(L, 1); moveto(L, L->top - 1, idx); L->top--; lua_unlock(L); } LUA_API void lua_copy (lua_State *L, int fromidx, int toidx) { TValue *fr; lua_lock(L); fr = index2addr(L, fromidx); api_checkvalidindex(L, fr); moveto(L, fr, toidx); lua_unlock(L); } LUA_API void lua_pushvalue (lua_State *L, int idx) { lua_lock(L); setobj2s(L, L->top, index2addr(L, idx)); api_incr_top(L); lua_unlock(L); } /* ** access functions (stack -> C) */ LUA_API int lua_type (lua_State *L, int idx) { StkId o = index2addr(L, idx); return (isvalid(o) ? ttypenv(o) : LUA_TNONE); } LUA_API const char *lua_typename (lua_State *L, int t) { UNUSED(L); return ttypename(t); } LUA_API int lua_iscfunction (lua_State *L, int idx) { StkId o = index2addr(L, idx); return (ttislcf(o) || (ttisCclosure(o))); } LUA_API int lua_isnumber (lua_State *L, int idx) { TValue n; const TValue *o = index2addr(L, idx); return tonumber(o, &n); } LUA_API int lua_isstring (lua_State *L, int idx) { int t = lua_type(L, idx); return (t == LUA_TSTRING || t == LUA_TNUMBER); } LUA_API int lua_isuserdata (lua_State *L, int idx) { const TValue *o = index2addr(L, idx); return (ttisuserdata(o) || ttislightuserdata(o)); } LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { StkId o1 = index2addr(L, index1); StkId o2 = index2addr(L, index2); return (isvalid(o1) && isvalid(o2)) ? luaV_rawequalobj(o1, o2) : 0; } LUA_API void lua_arith (lua_State *L, int op) { StkId o1; /* 1st operand */ StkId o2; /* 2nd operand */ lua_lock(L); if (op != LUA_OPUNM) /* all other operations expect two operands */ api_checknelems(L, 2); else { /* for unary minus, add fake 2nd operand */ api_checknelems(L, 1); setobjs2s(L, L->top, L->top - 1); L->top++; } o1 = L->top - 2; o2 = L->top - 1; if (ttisnumber(o1) && ttisnumber(o2)) { changenvalue(o1, luaO_arith(op, nvalue(o1), nvalue(o2))); } else luaV_arith(L, o1, o1, o2, cast(TMS, op - LUA_OPADD + TM_ADD)); L->top--; lua_unlock(L); } LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) { StkId o1, o2; int i = 0; lua_lock(L); /* may call tag method */ o1 = index2addr(L, index1); o2 = index2addr(L, index2); if (isvalid(o1) && isvalid(o2)) { switch (op) { case LUA_OPEQ: i = equalobj(L, o1, o2); break; case LUA_OPLT: i = luaV_lessthan(L, o1, o2); break; case LUA_OPLE: i = luaV_lessequal(L, o1, o2); break; default: api_check(L, 0, "invalid option"); } } lua_unlock(L); return i; } LUA_API lua_Number lua_tonumberx (lua_State *L, int idx, int *isnum) { TValue n; const TValue *o = index2addr(L, idx); if (tonumber(o, &n)) { if (isnum) *isnum = 1; return nvalue(o); } else { if (isnum) *isnum = 0; return 0; } } LUA_API lua_Integer lua_tointegerx (lua_State *L, int idx, int *isnum) { TValue n; const TValue *o = index2addr(L, idx); if (tonumber(o, &n)) { lua_Integer res; lua_Number num = nvalue(o); lua_number2integer(res, num); if (isnum) *isnum = 1; return res; } else { if (isnum) *isnum = 0; return 0; } } LUA_API lua_Unsigned lua_tounsignedx (lua_State *L, int idx, int *isnum) { TValue n; const TValue *o = index2addr(L, idx); if (tonumber(o, &n)) { lua_Unsigned res; lua_Number num = nvalue(o); lua_number2unsigned(res, num); if (isnum) *isnum = 1; return res; } else { if (isnum) *isnum = 0; return 0; } } LUA_API int lua_toboolean (lua_State *L, int idx) { const TValue *o = index2addr(L, idx); return !l_isfalse(o); } LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { StkId o = index2addr(L, idx); if (!ttisstring(o)) { lua_lock(L); /* `luaV_tostring' may create a new string */ if (!luaV_tostring(L, o)) { /* conversion failed? */ if (len != NULL) *len = 0; lua_unlock(L); return NULL; } luaC_checkGC(L); o = index2addr(L, idx); /* previous call may reallocate the stack */ lua_unlock(L); } if (len != NULL) *len = tsvalue(o)->len; return svalue(o); } LUA_API size_t lua_rawlen (lua_State *L, int idx) { StkId o = index2addr(L, idx); switch (ttypenv(o)) { case LUA_TSTRING: return tsvalue(o)->len; case LUA_TUSERDATA: return uvalue(o)->len; case LUA_TTABLE: return luaH_getn(hvalue(o)); default: return 0; } } LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { StkId o = index2addr(L, idx); if (ttislcf(o)) return fvalue(o); else if (ttisCclosure(o)) return clCvalue(o)->f; else return NULL; /* not a C function */ } LUA_API void *lua_touserdata (lua_State *L, int idx) { StkId o = index2addr(L, idx); switch (ttypenv(o)) { case LUA_TUSERDATA: return (rawuvalue(o) + 1); case LUA_TLIGHTUSERDATA: return pvalue(o); default: return NULL; } } LUA_API lua_State *lua_tothread (lua_State *L, int idx) { StkId o = index2addr(L, idx); return (!ttisthread(o)) ? NULL : thvalue(o); } LUA_API const void *lua_topointer (lua_State *L, int idx) { StkId o = index2addr(L, idx); switch (ttype(o)) { case LUA_TTABLE: return hvalue(o); case LUA_TLCL: return clLvalue(o); case LUA_TCCL: return clCvalue(o); case LUA_TLCF: return cast(void *, cast(size_t, fvalue(o))); case LUA_TTHREAD: return thvalue(o); case LUA_TUSERDATA: case LUA_TLIGHTUSERDATA: return lua_touserdata(L, idx); default: return NULL; } } /* ** push functions (C -> stack) */ LUA_API void lua_pushnil (lua_State *L) { lua_lock(L); setnilvalue(L->top); api_incr_top(L); lua_unlock(L); } LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { lua_lock(L); setnvalue(L->top, n); luai_checknum(L, L->top, luaG_runerror(L, "C API - attempt to push a signaling NaN")); api_incr_top(L); lua_unlock(L); } LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) { lua_lock(L); setnvalue(L->top, cast_num(n)); api_incr_top(L); lua_unlock(L); } LUA_API void lua_pushunsigned (lua_State *L, lua_Unsigned u) { lua_Number n; lua_lock(L); n = lua_unsigned2number(u); setnvalue(L->top, n); api_incr_top(L); lua_unlock(L); } LUA_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len) { TString *ts; lua_lock(L); luaC_checkGC(L); ts = luaS_newlstr(L, s, len); setsvalue2s(L, L->top, ts); api_incr_top(L); lua_unlock(L); return getstr(ts); } LUA_API const char *lua_pushstring (lua_State *L, const char *s) { if (s == NULL) { lua_pushnil(L); return NULL; } else { TString *ts; lua_lock(L); luaC_checkGC(L); ts = luaS_new(L, s); setsvalue2s(L, L->top, ts); api_incr_top(L); lua_unlock(L); return getstr(ts); } } LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt, va_list argp) { const char *ret; lua_lock(L); luaC_checkGC(L); ret = luaO_pushvfstring(L, fmt, argp); lua_unlock(L); return ret; } LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) { const char *ret; va_list argp; lua_lock(L); luaC_checkGC(L); va_start(argp, fmt); ret = luaO_pushvfstring(L, fmt, argp); va_end(argp); lua_unlock(L); return ret; } LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { lua_lock(L); if (n == 0) { setfvalue(L->top, fn); } else { Closure *cl; api_checknelems(L, n); api_check(L, n <= MAXUPVAL, "upvalue index too large"); luaC_checkGC(L); cl = luaF_newCclosure(L, n); cl->c.f = fn; L->top -= n; while (n--) setobj2n(L, &cl->c.upvalue[n], L->top + n); setclCvalue(L, L->top, cl); } api_incr_top(L); lua_unlock(L); } LUA_API void lua_pushboolean (lua_State *L, int b) { lua_lock(L); setbvalue(L->top, (b != 0)); /* ensure that true is 1 */ api_incr_top(L); lua_unlock(L); } LUA_API void lua_pushlightuserdata (lua_State *L, void *p) { lua_lock(L); setpvalue(L->top, p); api_incr_top(L); lua_unlock(L); } LUA_API int lua_pushthread (lua_State *L) { lua_lock(L); setthvalue(L, L->top, L); api_incr_top(L); lua_unlock(L); return (G(L)->mainthread == L); } /* ** get functions (Lua -> stack) */ LUA_API void lua_getglobal (lua_State *L, const char *var) { Table *reg = hvalue(&G(L)->l_registry); const TValue *gt; /* global table */ lua_lock(L); gt = luaH_getint(reg, LUA_RIDX_GLOBALS); setsvalue2s(L, L->top++, luaS_new(L, var)); luaV_gettable(L, gt, L->top - 1, L->top - 1); lua_unlock(L); } LUA_API void lua_gettable (lua_State *L, int idx) { StkId t; lua_lock(L); t = index2addr(L, idx); api_checkvalidindex(L, t); luaV_gettable(L, t, L->top - 1, L->top - 1); lua_unlock(L); } LUA_API void lua_getfield (lua_State *L, int idx, const char *k) { StkId t; lua_lock(L); t = index2addr(L, idx); api_checkvalidindex(L, t); setsvalue2s(L, L->top, luaS_new(L, k)); api_incr_top(L); luaV_gettable(L, t, L->top - 1, L->top - 1); lua_unlock(L); } LUA_API void lua_rawget (lua_State *L, int idx) { StkId t; lua_lock(L); t = index2addr(L, idx); api_check(L, ttistable(t), "table expected"); setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1)); lua_unlock(L); } LUA_API void lua_rawgeti (lua_State *L, int idx, int n) { StkId t; lua_lock(L); t = index2addr(L, idx); api_check(L, ttistable(t), "table expected"); setobj2s(L, L->top, luaH_getint(hvalue(t), n)); api_incr_top(L); lua_unlock(L); } LUA_API void lua_rawgetp (lua_State *L, int idx, const void *p) { StkId t; TValue k; lua_lock(L); t = index2addr(L, idx); api_check(L, ttistable(t), "table expected"); setpvalue(&k, cast(void *, p)); setobj2s(L, L->top, luaH_get(hvalue(t), &k)); api_incr_top(L); lua_unlock(L); } LUA_API void lua_createtable (lua_State *L, int narray, int nrec) { Table *t; lua_lock(L); luaC_checkGC(L); t = luaH_new(L); sethvalue(L, L->top, t); api_incr_top(L); if (narray > 0 || nrec > 0) luaH_resize(L, t, narray, nrec); lua_unlock(L); } LUA_API int lua_getmetatable (lua_State *L, int objindex) { const TValue *obj; Table *mt = NULL; int res; lua_lock(L); obj = index2addr(L, objindex); switch (ttypenv(obj)) { case LUA_TTABLE: mt = hvalue(obj)->metatable; break; case LUA_TUSERDATA: mt = uvalue(obj)->metatable; break; default: mt = G(L)->mt[ttypenv(obj)]; break; } if (mt == NULL) res = 0; else { sethvalue(L, L->top, mt); api_incr_top(L); res = 1; } lua_unlock(L); return res; } LUA_API void lua_getuservalue (lua_State *L, int idx) { StkId o; lua_lock(L); o = index2addr(L, idx); api_checkvalidindex(L, o); api_check(L, ttisuserdata(o), "userdata expected"); if (uvalue(o)->env) { sethvalue(L, L->top, uvalue(o)->env); } else setnilvalue(L->top); api_incr_top(L); lua_unlock(L); } /* ** set functions (stack -> Lua) */ LUA_API void lua_setglobal (lua_State *L, const char *var) { Table *reg = hvalue(&G(L)->l_registry); const TValue *gt; /* global table */ lua_lock(L); api_checknelems(L, 1); gt = luaH_getint(reg, LUA_RIDX_GLOBALS); setsvalue2s(L, L->top++, luaS_new(L, var)); luaV_settable(L, gt, L->top - 1, L->top - 2); L->top -= 2; /* pop value and key */ lua_unlock(L); } LUA_API void lua_settable (lua_State *L, int idx) { StkId t; lua_lock(L); api_checknelems(L, 2); t = index2addr(L, idx); api_checkvalidindex(L, t); luaV_settable(L, t, L->top - 2, L->top - 1); L->top -= 2; /* pop index and value */ lua_unlock(L); } LUA_API void lua_setfield (lua_State *L, int idx, const char *k) { StkId t; lua_lock(L); api_checknelems(L, 1); t = index2addr(L, idx); api_checkvalidindex(L, t); setsvalue2s(L, L->top++, luaS_new(L, k)); luaV_settable(L, t, L->top - 1, L->top - 2); L->top -= 2; /* pop value and key */ lua_unlock(L); } LUA_API void lua_rawset (lua_State *L, int idx) { StkId t; lua_lock(L); api_checknelems(L, 2); t = index2addr(L, idx); api_check(L, ttistable(t), "table expected"); setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1); invalidateTMcache(hvalue(t)); luaC_barrierback(L, gcvalue(t), L->top-1); L->top -= 2; lua_unlock(L); } LUA_API void lua_rawseti (lua_State *L, int idx, int n) { StkId t; lua_lock(L); api_checknelems(L, 1); t = index2addr(L, idx); api_check(L, ttistable(t), "table expected"); luaH_setint(L, hvalue(t), n, L->top - 1); luaC_barrierback(L, gcvalue(t), L->top-1); L->top--; lua_unlock(L); } LUA_API void lua_rawsetp (lua_State *L, int idx, const void *p) { StkId t; TValue k; lua_lock(L); api_checknelems(L, 1); t = index2addr(L, idx); api_check(L, ttistable(t), "table expected"); setpvalue(&k, cast(void *, p)); setobj2t(L, luaH_set(L, hvalue(t), &k), L->top - 1); luaC_barrierback(L, gcvalue(t), L->top - 1); L->top--; lua_unlock(L); } LUA_API int lua_setmetatable (lua_State *L, int objindex) { TValue *obj; Table *mt; lua_lock(L); api_checknelems(L, 1); obj = index2addr(L, objindex); api_checkvalidindex(L, obj); if (ttisnil(L->top - 1)) mt = NULL; else { api_check(L, ttistable(L->top - 1), "table expected"); mt = hvalue(L->top - 1); } switch (ttypenv(obj)) { case LUA_TTABLE: { hvalue(obj)->metatable = mt; if (mt) luaC_objbarrierback(L, gcvalue(obj), mt); luaC_checkfinalizer(L, gcvalue(obj), mt); break; } case LUA_TUSERDATA: { uvalue(obj)->metatable = mt; if (mt) { luaC_objbarrier(L, rawuvalue(obj), mt); luaC_checkfinalizer(L, gcvalue(obj), mt); } break; } default: { G(L)->mt[ttypenv(obj)] = mt; break; } } L->top--; lua_unlock(L); return 1; } LUA_API void lua_setuservalue (lua_State *L, int idx) { StkId o; lua_lock(L); api_checknelems(L, 1); o = index2addr(L, idx); api_checkvalidindex(L, o); api_check(L, ttisuserdata(o), "userdata expected"); if (ttisnil(L->top - 1)) uvalue(o)->env = NULL; else { api_check(L, ttistable(L->top - 1), "table expected"); uvalue(o)->env = hvalue(L->top - 1); luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1)); } L->top--; lua_unlock(L); } /* ** `load' and `call' functions (run Lua code) */ #define checkresults(L,na,nr) \ api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na)), \ "results from function overflow current stack size") LUA_API int lua_getctx (lua_State *L, int *ctx) { if (L->ci->callstatus & CIST_YIELDED) { if (ctx) *ctx = L->ci->u.c.ctx; return L->ci->u.c.status; } else return LUA_OK; } LUA_API void lua_callk (lua_State *L, int nargs, int nresults, int ctx, lua_CFunction k) { StkId func; lua_lock(L); api_check(L, k == NULL || !isLua(L->ci), "cannot use continuations inside hooks"); api_checknelems(L, nargs+1); api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); checkresults(L, nargs, nresults); func = L->top - (nargs+1); if (k != NULL && L->nny == 0) { /* need to prepare continuation? */ L->ci->u.c.k = k; /* save continuation */ L->ci->u.c.ctx = ctx; /* save context */ luaD_call(L, func, nresults, 1); /* do the call */ } else /* no continuation or no yieldable */ luaD_call(L, func, nresults, 0); /* just do the call */ adjustresults(L, nresults); lua_unlock(L); } /* ** Execute a protected call. */ struct CallS { /* data to `f_call' */ StkId func; int nresults; }; static void f_call (lua_State *L, void *ud) { struct CallS *c = cast(struct CallS *, ud); luaD_call(L, c->func, c->nresults, 0); } LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc, int ctx, lua_CFunction k) { struct CallS c; int status; ptrdiff_t func; lua_lock(L); api_check(L, k == NULL || !isLua(L->ci), "cannot use continuations inside hooks"); api_checknelems(L, nargs+1); api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); checkresults(L, nargs, nresults); if (errfunc == 0) func = 0; else { StkId o = index2addr(L, errfunc); api_checkvalidindex(L, o); func = savestack(L, o); } c.func = L->top - (nargs+1); /* function to be called */ if (k == NULL || L->nny > 0) { /* no continuation or no yieldable? */ c.nresults = nresults; /* do a 'conventional' protected call */ status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); } else { /* prepare continuation (call is already protected by 'resume') */ CallInfo *ci = L->ci; ci->u.c.k = k; /* save continuation */ ci->u.c.ctx = ctx; /* save context */ /* save information for error recovery */ ci->u.c.extra = savestack(L, c.func); ci->u.c.old_allowhook = L->allowhook; ci->u.c.old_errfunc = L->errfunc; L->errfunc = func; /* mark that function may do error recovery */ ci->callstatus |= CIST_YPCALL; luaD_call(L, c.func, nresults, 1); /* do the call */ ci->callstatus &= ~CIST_YPCALL; L->errfunc = ci->u.c.old_errfunc; status = LUA_OK; /* if it is here, there were no errors */ } adjustresults(L, nresults); lua_unlock(L); return status; } LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data, const char *chunkname, const char *mode) { ZIO z; int status; lua_lock(L); if (!chunkname) chunkname = "?"; luaZ_init(L, &z, reader, data); status = luaD_protectedparser(L, &z, chunkname, mode); if (status == LUA_OK) { /* no errors? */ LClosure *f = clLvalue(L->top - 1); /* get newly created function */ if (f->nupvalues == 1) { /* does it have one upvalue? */ /* get global table from registry */ Table *reg = hvalue(&G(L)->l_registry); const TValue *gt = luaH_getint(reg, LUA_RIDX_GLOBALS); /* set global table as 1st upvalue of 'f' (may be LUA_ENV) */ setobj(L, f->upvals[0]->v, gt); luaC_barrier(L, f->upvals[0], gt); } } lua_unlock(L); return status; } LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data) { int status; TValue *o; lua_lock(L); api_checknelems(L, 1); o = L->top - 1; if (isLfunction(o)) status = luaU_dump(L, getproto(o), writer, data, 0); else status = 1; lua_unlock(L); return status; } LUA_API int lua_status (lua_State *L) { return L->status; } /* ** Garbage-collection function */ LUA_API int lua_gc (lua_State *L, int what, int data) { int res = 0; global_State *g; lua_lock(L); g = G(L); switch (what) { case LUA_GCSTOP: { g->gcrunning = 0; break; } case LUA_GCRESTART: { luaE_setdebt(g, 0); g->gcrunning = 1; break; } case LUA_GCCOLLECT: { luaC_fullgc(L, 0); break; } case LUA_GCCOUNT: { /* GC values are expressed in Kbytes: #bytes/2^10 */ res = cast_int(gettotalbytes(g) >> 10); break; } case LUA_GCCOUNTB: { res = cast_int(gettotalbytes(g) & 0x3ff); break; } case LUA_GCSTEP: { if (g->gckind == KGC_GEN) { /* generational mode? */ res = (g->lastmajormem == 0); /* 1 if will do major collection */ luaC_forcestep(L); /* do a single step */ } else { while (data-- >= 0) { luaC_forcestep(L); if (g->gcstate == GCSpause) { /* end of cycle? */ res = 1; /* signal it */ break; } } } break; } case LUA_GCSETPAUSE: { res = g->gcpause; g->gcpause = data; break; } case LUA_GCSETMAJORINC: { res = g->gcmajorinc; g->gcmajorinc = data; break; } case LUA_GCSETSTEPMUL: { res = g->gcstepmul; g->gcstepmul = data; break; } case LUA_GCISRUNNING: { res = g->gcrunning; break; } case LUA_GCGEN: { /* change collector to generational mode */ luaC_changemode(L, KGC_GEN); break; } case LUA_GCINC: { /* change collector to incremental mode */ luaC_changemode(L, KGC_NORMAL); break; } default: res = -1; /* invalid option */ } lua_unlock(L); return res; } /* ** miscellaneous functions */ LUA_API int lua_error (lua_State *L) { lua_lock(L); api_checknelems(L, 1); luaG_errormsg(L); lua_unlock(L); return 0; /* to avoid warnings */ } LUA_API int lua_next (lua_State *L, int idx) { StkId t; int more; lua_lock(L); t = index2addr(L, idx); api_check(L, ttistable(t), "table expected"); more = luaH_next(L, hvalue(t), L->top - 1); if (more) { api_incr_top(L); } else /* no more elements */ L->top -= 1; /* remove key */ lua_unlock(L); return more; } LUA_API void lua_concat (lua_State *L, int n) { lua_lock(L); api_checknelems(L, n); if (n >= 2) { luaC_checkGC(L); luaV_concat(L, n); } else if (n == 0) { /* push empty string */ setsvalue2s(L, L->top, luaS_newlstr(L, "", 0)); api_incr_top(L); } /* else n == 1; nothing to do */ lua_unlock(L); } LUA_API void lua_len (lua_State *L, int idx) { StkId t; lua_lock(L); t = index2addr(L, idx); luaV_objlen(L, L->top, t); api_incr_top(L); lua_unlock(L); } LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { lua_Alloc f; lua_lock(L); if (ud) *ud = G(L)->ud; f = G(L)->frealloc; lua_unlock(L); return f; } LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) { lua_lock(L); G(L)->ud = ud; G(L)->frealloc = f; lua_unlock(L); } LUA_API void *lua_newuserdata (lua_State *L, size_t size) { Udata *u; lua_lock(L); luaC_checkGC(L); u = luaS_newudata(L, size, NULL); setuvalue(L, L->top, u); api_incr_top(L); lua_unlock(L); return u + 1; } static const char *aux_upvalue (StkId fi, int n, TValue **val, GCObject **owner) { switch (ttype(fi)) { case LUA_TCCL: { /* C closure */ CClosure *f = clCvalue(fi); if (!(1 <= n && n <= f->nupvalues)) return NULL; *val = &f->upvalue[n-1]; if (owner) *owner = obj2gco(f); return ""; } case LUA_TLCL: { /* Lua closure */ LClosure *f = clLvalue(fi); TString *name; Proto *p = f->p; if (!(1 <= n && n <= p->sizeupvalues)) return NULL; *val = f->upvals[n-1]->v; if (owner) *owner = obj2gco(f->upvals[n - 1]); name = p->upvalues[n-1].name; return (name == NULL) ? "" : getstr(name); } default: return NULL; /* not a closure */ } } LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { const char *name; TValue *val = NULL; /* to avoid warnings */ lua_lock(L); name = aux_upvalue(index2addr(L, funcindex), n, &val, NULL); if (name) { setobj2s(L, L->top, val); api_incr_top(L); } lua_unlock(L); return name; } LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { const char *name; TValue *val = NULL; /* to avoid warnings */ GCObject *owner = NULL; /* to avoid warnings */ StkId fi; lua_lock(L); fi = index2addr(L, funcindex); api_checknelems(L, 1); name = aux_upvalue(fi, n, &val, &owner); if (name) { L->top--; setobj(L, val, L->top); luaC_barrier(L, owner, L->top); } lua_unlock(L); return name; } static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) { LClosure *f; StkId fi = index2addr(L, fidx); api_check(L, ttisLclosure(fi), "Lua function expected"); f = clLvalue(fi); api_check(L, (1 <= n && n <= f->p->sizeupvalues), "invalid upvalue index"); if (pf) *pf = f; return &f->upvals[n - 1]; /* get its upvalue pointer */ } LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) { StkId fi = index2addr(L, fidx); switch (ttype(fi)) { case LUA_TLCL: { /* lua closure */ return *getupvalref(L, fidx, n, NULL); } case LUA_TCCL: { /* C closure */ CClosure *f = clCvalue(fi); api_check(L, 1 <= n && n <= f->nupvalues, "invalid upvalue index"); return &f->upvalue[n - 1]; } default: { api_check(L, 0, "closure expected"); return NULL; } } } LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1, int fidx2, int n2) { LClosure *f1; UpVal **up1 = getupvalref(L, fidx1, n1, &f1); UpVal **up2 = getupvalref(L, fidx2, n2, NULL); *up1 = *up2; luaC_objbarrier(L, f1, *up2); } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/ldump.cpp0000644000175000017500000000615512320456500020352 0ustar mathieumathieu/* ** $Id: ldump.c,v 1.19 2011/11/23 17:48:18 lhf Exp $ ** save precompiled Lua chunks ** See Copyright Notice in lua.h */ #include #define ldump_c #define LUA_CORE #include "lua.h" #include "lobject.h" #include "lstate.h" #include "lundump.h" typedef struct { lua_State* L; lua_Writer writer; void* data; int strip; int status; } DumpState; #define DumpMem(b,n,size,D) DumpBlock(b,(n)*(size),D) #define DumpVar(x,D) DumpMem(&x,1,sizeof(x),D) static void DumpBlock(const void* b, size_t size, DumpState* D) { if (D->status==0) { lua_unlock(D->L); D->status=(*D->writer)(D->L,b,size,D->data); lua_lock(D->L); } } static void DumpChar(int y, DumpState* D) { char x=(char)y; DumpVar(x,D); } static void DumpInt(int x, DumpState* D) { DumpVar(x,D); } static void DumpNumber(lua_Number x, DumpState* D) { DumpVar(x,D); } static void DumpVector(const void* b, int n, size_t size, DumpState* D) { DumpInt(n,D); DumpMem(b,n,size,D); } static void DumpString(const TString* s, DumpState* D) { if (s==NULL) { size_t size=0; DumpVar(size,D); } else { size_t size=s->tsv.len+1; /* include trailing '\0' */ DumpVar(size,D); DumpBlock(getstr(s),size*sizeof(char),D); } } #define DumpCode(f,D) DumpVector(f->code,f->sizecode,sizeof(Instruction),D) static void DumpFunction(const Proto* f, DumpState* D); static void DumpConstants(const Proto* f, DumpState* D) { int i,n=f->sizek; DumpInt(n,D); for (i=0; ik[i]; DumpChar(ttype(o),D); switch (ttype(o)) { case LUA_TNIL: break; case LUA_TBOOLEAN: DumpChar(bvalue(o),D); break; case LUA_TNUMBER: DumpNumber(nvalue(o),D); break; case LUA_TSTRING: DumpString(rawtsvalue(o),D); break; } } n=f->sizep; DumpInt(n,D); for (i=0; ip[i],D); } static void DumpUpvalues(const Proto* f, DumpState* D) { int i,n=f->sizeupvalues; DumpInt(n,D); for (i=0; iupvalues[i].instack,D); DumpChar(f->upvalues[i].idx,D); } } static void DumpDebug(const Proto* f, DumpState* D) { int i,n; DumpString((D->strip) ? NULL : f->source,D); n= (D->strip) ? 0 : f->sizelineinfo; DumpVector(f->lineinfo,n,sizeof(int),D); n= (D->strip) ? 0 : f->sizelocvars; DumpInt(n,D); for (i=0; ilocvars[i].varname,D); DumpInt(f->locvars[i].startpc,D); DumpInt(f->locvars[i].endpc,D); } n= (D->strip) ? 0 : f->sizeupvalues; DumpInt(n,D); for (i=0; iupvalues[i].name,D); } static void DumpFunction(const Proto* f, DumpState* D) { DumpInt(f->linedefined,D); DumpInt(f->lastlinedefined,D); DumpChar(f->numparams,D); DumpChar(f->is_vararg,D); DumpChar(f->maxstacksize,D); DumpCode(f,D); DumpConstants(f,D); DumpUpvalues(f,D); DumpDebug(f,D); } static void DumpHeader(DumpState* D) { lu_byte h[LUAC_HEADERSIZE]; luaU_header(h); DumpBlock(h,LUAC_HEADERSIZE,D); } /* ** dump Lua function as precompiled chunk */ int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip) { DumpState D; D.L=L; D.writer=w; D.data=data; D.strip=strip; D.status=0; DumpHeader(&D); DumpFunction(f,&D); return D.status; } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lstate.cpp0000644000175000017500000001500512320456500020517 0ustar mathieumathieu/* ** $Id: lstate.c,v 2.92 2011/10/03 17:54:25 roberto Exp $ ** Global State ** See Copyright Notice in lua.h */ #include #define lstate_c #define LUA_CORE #include "lua.h" #include "lapi.h" #include "ldebug.h" #include "ldo.h" #include "lfunc.h" #include "lgc.h" #include "llex.h" #include "lmem.h" #include "lstate.h" #include "lstring.h" #include "ltable.h" #include "ltm.h" #if !defined(LUAI_GCPAUSE) #define LUAI_GCPAUSE 200 /* 200% */ #endif #if !defined(LUAI_GCMAJOR) #define LUAI_GCMAJOR 200 /* 200% */ #endif #if !defined(LUAI_GCMUL) #define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ #endif #define MEMERRMSG "not enough memory" /* ** thread state + extra space */ typedef struct LX { #if defined(LUAI_EXTRASPACE) char buff[LUAI_EXTRASPACE]; #endif lua_State l; } LX; /* ** Main thread combines a thread state and the global state */ typedef struct LG { LX l; global_State g; } LG; #define fromstate(L) (cast(LX *, cast(lu_byte *, (L)) - offsetof(LX, l))) /* ** set GCdebt to a new value keeping the value (totalbytes + GCdebt) ** invariant */ void luaE_setdebt (global_State *g, l_mem debt) { g->totalbytes -= (debt - g->GCdebt); g->GCdebt = debt; } CallInfo *luaE_extendCI (lua_State *L) { CallInfo *ci = luaM_new(L, CallInfo); lua_assert(L->ci->next == NULL); L->ci->next = ci; ci->previous = L->ci; ci->next = NULL; return ci; } void luaE_freeCI (lua_State *L) { CallInfo *ci = L->ci; CallInfo *next = ci->next; ci->next = NULL; while ((ci = next) != NULL) { next = ci->next; luaM_free(L, ci); } } static void stack_init (lua_State *L1, lua_State *L) { int i; CallInfo *ci; /* initialize stack array */ L1->stack = luaM_newvector(L, BASIC_STACK_SIZE, TValue); L1->stacksize = BASIC_STACK_SIZE; for (i = 0; i < BASIC_STACK_SIZE; i++) setnilvalue(L1->stack + i); /* erase new stack */ L1->top = L1->stack; L1->stack_last = L1->stack + L1->stacksize - EXTRA_STACK; /* initialize first ci */ ci = &L1->base_ci; ci->next = ci->previous = NULL; ci->callstatus = 0; ci->func = L1->top; setnilvalue(L1->top++); /* 'function' entry for this 'ci' */ ci->top = L1->top + LUA_MINSTACK; L1->ci = ci; } static void freestack (lua_State *L) { if (L->stack == NULL) return; /* stack not completely built yet */ L->ci = &L->base_ci; /* free the entire 'ci' list */ luaE_freeCI(L); luaM_freearray(L, L->stack, L->stacksize); /* free stack array */ } /* ** Create registry table and its predefined values */ static void init_registry (lua_State *L, global_State *g) { TValue mt; /* create registry */ Table *registry = luaH_new(L); sethvalue(L, &g->l_registry, registry); luaH_resize(L, registry, LUA_RIDX_LAST, 0); /* registry[LUA_RIDX_MAINTHREAD] = L */ setthvalue(L, &mt, L); luaH_setint(L, registry, LUA_RIDX_MAINTHREAD, &mt); /* registry[LUA_RIDX_GLOBALS] = table of globals */ sethvalue(L, &mt, luaH_new(L)); luaH_setint(L, registry, LUA_RIDX_GLOBALS, &mt); } /* ** open parts of the state that may cause memory-allocation errors */ static void f_luaopen (lua_State *L, void *ud) { global_State *g = G(L); UNUSED(ud); stack_init(L, L); /* init stack */ init_registry(L, g); luaS_resize(L, MINSTRTABSIZE); /* initial size of string table */ luaT_init(L); luaX_init(L); /* pre-create memory-error message */ g->memerrmsg = luaS_newliteral(L, MEMERRMSG); luaS_fix(g->memerrmsg); /* it should never be collected */ g->gcrunning = 1; /* allow gc */ } /* ** preinitialize a state with consistent values without allocating ** any memory (to avoid errors) */ static void preinit_state (lua_State *L, global_State *g) { G(L) = g; L->stack = NULL; L->ci = NULL; L->stacksize = 0; L->errorJmp = NULL; L->nCcalls = 0; L->hook = NULL; L->hookmask = 0; L->basehookcount = 0; L->allowhook = 1; resethookcount(L); L->openupval = NULL; L->nny = 1; L->status = LUA_OK; L->errfunc = 0; } static void close_state (lua_State *L) { global_State *g = G(L); luaF_close(L, L->stack); /* close all upvalues for this thread */ luaC_freeallobjects(L); /* collect all objects */ luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size); luaZ_freebuffer(L, &g->buff); freestack(L); lua_assert(gettotalbytes(g) == sizeof(LG)); (*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0); /* free main block */ } LUA_API lua_State *lua_newthread (lua_State *L) { lua_State *L1; lua_lock(L); luaC_checkGC(L); L1 = &luaC_newobj(L, LUA_TTHREAD, sizeof(LX), NULL, offsetof(LX, l))->th; setthvalue(L, L->top, L1); api_incr_top(L); preinit_state(L1, G(L)); L1->hookmask = L->hookmask; L1->basehookcount = L->basehookcount; L1->hook = L->hook; resethookcount(L1); luai_userstatethread(L, L1); stack_init(L1, L); /* init stack */ lua_unlock(L); return L1; } void luaE_freethread (lua_State *L, lua_State *L1) { LX *l = fromstate(L1); luaF_close(L1, L1->stack); /* close all upvalues for this thread */ lua_assert(L1->openupval == NULL); luai_userstatefree(L, L1); freestack(L1); luaM_free(L, l); } LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { int i; lua_State *L; global_State *g; LG *l = cast(LG *, (*f)(ud, NULL, LUA_TTHREAD, sizeof(LG))); if (l == NULL) return NULL; L = &l->l.l; g = &l->g; L->next = NULL; L->tt = LUA_TTHREAD; g->currentwhite = bit2mask(WHITE0BIT, FIXEDBIT); L->marked = luaC_white(g); g->gckind = KGC_NORMAL; preinit_state(L, g); g->frealloc = f; g->ud = ud; g->mainthread = L; g->uvhead.u.l.prev = &g->uvhead; g->uvhead.u.l.next = &g->uvhead; g->gcrunning = 0; /* no GC while building state */ g->lastmajormem = 0; g->strt.size = 0; g->strt.nuse = 0; g->strt.hash = NULL; setnilvalue(&g->l_registry); luaZ_initbuffer(L, &g->buff); g->panic = NULL; g->version = lua_version(NULL); g->gcstate = GCSpause; g->allgc = NULL; g->finobj = NULL; g->tobefnz = NULL; g->gray = g->grayagain = NULL; g->weak = g->ephemeron = g->allweak = NULL; g->totalbytes = sizeof(LG); g->GCdebt = 0; g->gcpause = LUAI_GCPAUSE; g->gcmajorinc = LUAI_GCMAJOR; g->gcstepmul = LUAI_GCMUL; for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL; if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) { /* memory allocation error: free partial state */ close_state(L); L = NULL; } else luai_userstateopen(L); return L; } LUA_API void lua_close (lua_State *L) { L = G(L)->mainthread; /* only the main thread can be closed */ lua_lock(L); luai_userstateclose(L); close_state(L); } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lctype.cpp0000644000175000017500000000436712320456500020534 0ustar mathieumathieu/* ** $Id: lctype.c,v 1.11 2011/10/03 16:19:23 roberto Exp $ ** 'ctype' functions for Lua ** See Copyright Notice in lua.h */ #define lctype_c #define LUA_CORE #include "lctype.h" #if !LUA_USE_CTYPE /* { */ #include LUAI_DDEF const lu_byte luai_ctype_[UCHAR_MAX + 2] = { 0x00, /* EOZ */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0. */ 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 1. */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, /* 2. */ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, /* 3. */ 0x16, 0x16, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 4. */ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 5. */ 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x05, 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 6. */ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 7. */ 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 8. */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 9. */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* a. */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* b. */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* c. */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* d. */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* e. */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* f. */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; #endif /* } */ ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lcode.h0000644000175000017500000000605412320456500017762 0ustar mathieumathieu/* ** $Id: lcode.h,v 1.58 2011/08/30 16:26:41 roberto Exp $ ** Code generator for Lua ** See Copyright Notice in lua.h */ #ifndef lcode_h #define lcode_h #include "llex.h" #include "lobject.h" #include "lopcodes.h" #include "lparser.h" /* ** Marks the end of a patch list. It is an invalid value both as an absolute ** address, and as a list link (would link an element to itself). */ #define NO_JUMP (-1) /* ** grep "ORDER OPR" if you change these enums (ORDER OP) */ typedef enum BinOpr { OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW, OPR_CONCAT, OPR_EQ, OPR_LT, OPR_LE, OPR_NE, OPR_GT, OPR_GE, OPR_AND, OPR_OR, OPR_NOBINOPR } BinOpr; typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; #define getcode(fs,e) ((fs)->f->code[(e)->u.info]) #define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx) #define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) #define luaK_jumpto(fs,t) luaK_patchlist(fs, luaK_jump(fs), t) LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C); LUAI_FUNC int luaK_codek (FuncState *fs, int reg, int k); LUAI_FUNC void luaK_fixline (FuncState *fs, int line); LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n); LUAI_FUNC void luaK_checkstack (FuncState *fs, int n); LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s); LUAI_FUNC int luaK_numberK (FuncState *fs, lua_Number r); LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e); LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e); LUAI_FUNC void luaK_exp2anyregup (FuncState *fs, expdesc *e); LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e); LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e); LUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e); LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key); LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k); LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e); LUAI_FUNC void luaK_goiffalse (FuncState *fs, expdesc *e); LUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e); LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults); LUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e); LUAI_FUNC int luaK_jump (FuncState *fs); LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret); LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target); LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list); LUAI_FUNC void luaK_patchclose (FuncState *fs, int list, int level); LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2); LUAI_FUNC int luaK_getlabel (FuncState *fs); LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v, int line); LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v); LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2, int line); LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore); #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lparser.h0000644000175000017500000000637412320456500020351 0ustar mathieumathieu/* ** $Id: lparser.h,v 1.69 2011/07/27 18:09:01 roberto Exp $ ** Lua Parser ** See Copyright Notice in lua.h */ #ifndef lparser_h #define lparser_h #include "llimits.h" #include "lobject.h" #include "lzio.h" /* ** Expression descriptor */ typedef enum { VVOID, /* no value */ VNIL, VTRUE, VFALSE, VK, /* info = index of constant in `k' */ VKNUM, /* nval = numerical value */ VNONRELOC, /* info = result register */ VLOCAL, /* info = local register */ VUPVAL, /* info = index of upvalue in 'upvalues' */ VINDEXED, /* t = table register/upvalue; idx = index R/K */ VJMP, /* info = instruction pc */ VRELOCABLE, /* info = instruction pc */ VCALL, /* info = instruction pc */ VVARARG /* info = instruction pc */ } expkind; #define vkisvar(k) (VLOCAL <= (k) && (k) <= VINDEXED) #define vkisinreg(k) ((k) == VNONRELOC || (k) == VLOCAL) typedef struct expdesc { expkind k; union { struct { /* for indexed variables (VINDEXED) */ short idx; /* index (R/K) */ lu_byte t; /* table (register or upvalue) */ lu_byte vt; /* whether 't' is register (VLOCAL) or upvalue (VUPVAL) */ } ind; int info; /* for generic use */ lua_Number nval; /* for VKNUM */ } u; int t; /* patch list of `exit when true' */ int f; /* patch list of `exit when false' */ } expdesc; /* description of active local variable */ typedef struct Vardesc { short idx; /* variable index in stack */ } Vardesc; /* description of pending goto statements and label statements */ typedef struct Labeldesc { TString *name; /* label identifier */ int pc; /* position in code */ int line; /* line where it appeared */ lu_byte nactvar; /* local level where it appears in current block */ } Labeldesc; /* list of labels or gotos */ typedef struct Labellist { Labeldesc *arr; /* array */ int n; /* number of entries in use */ int size; /* array size */ } Labellist; /* dynamic structures used by the parser */ typedef struct Dyndata { struct { /* list of active local variables */ Vardesc *arr; int n; int size; } actvar; Labellist gt; /* list of pending gotos */ Labellist label; /* list of active labels */ } Dyndata; /* control of blocks */ struct BlockCnt; /* defined in lparser.c */ /* state needed to generate code for a given function */ typedef struct FuncState { Proto *f; /* current function header */ Table *h; /* table to find (and reuse) elements in `k' */ struct FuncState *prev; /* enclosing function */ struct LexState *ls; /* lexical state */ struct BlockCnt *bl; /* chain of current blocks */ int pc; /* next position to code (equivalent to `ncode') */ int lasttarget; /* 'label' of last 'jump label' */ int jpc; /* list of pending jumps to `pc' */ int nk; /* number of elements in `k' */ int np; /* number of elements in `p' */ int firstlocal; /* index of first local var (in Dyndata array) */ short nlocvars; /* number of elements in 'f->locvars' */ lu_byte nactvar; /* number of active local variables */ lu_byte nups; /* number of upvalues */ lu_byte freereg; /* first free register */ } FuncState; LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, Dyndata *dyd, const char *name, int firstchar); #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lctype.h0000644000175000017500000000345512320456500020176 0ustar mathieumathieu/* ** $Id: lctype.h,v 1.12 2011/07/15 12:50:29 roberto Exp $ ** 'ctype' functions for Lua ** See Copyright Notice in lua.h */ #ifndef lctype_h #define lctype_h #include "lua.h" /* ** WARNING: the functions defined here do not necessarily correspond ** to the similar functions in the standard C ctype.h. They are ** optimized for the specific needs of Lua */ #if !defined(LUA_USE_CTYPE) #if 'A' == 65 && '0' == 48 /* ASCII case: can use its own tables; faster and fixed */ #define LUA_USE_CTYPE 0 #else /* must use standard C ctype */ #define LUA_USE_CTYPE 1 #endif #endif #if !LUA_USE_CTYPE /* { */ #include #include "llimits.h" #define ALPHABIT 0 #define DIGITBIT 1 #define PRINTBIT 2 #define SPACEBIT 3 #define XDIGITBIT 4 #define MASK(B) (1 << (B)) /* ** add 1 to char to allow index -1 (EOZ) */ #define testprop(c,p) (luai_ctype_[(c)+1] & (p)) /* ** 'lalpha' (Lua alphabetic) and 'lalnum' (Lua alphanumeric) both include '_' */ #define lislalpha(c) testprop(c, MASK(ALPHABIT)) #define lislalnum(c) testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))) #define lisdigit(c) testprop(c, MASK(DIGITBIT)) #define lisspace(c) testprop(c, MASK(SPACEBIT)) #define lisprint(c) testprop(c, MASK(PRINTBIT)) #define lisxdigit(c) testprop(c, MASK(XDIGITBIT)) /* ** this 'ltolower' only works for alphabetic characters */ #define ltolower(c) ((c) | ('A' ^ 'a')) /* two more entries for 0 and -1 (EOZ) */ LUAI_DDEC const lu_byte luai_ctype_[UCHAR_MAX + 2]; #else /* }{ */ /* ** use standard C ctypes */ #include #define lislalpha(c) (isalpha(c) || (c) == '_') #define lislalnum(c) (isalnum(c) || (c) == '_') #define lisdigit(c) (isdigit(c)) #define lisspace(c) (isspace(c)) #define lisprint(c) (isprint(c)) #define lisxdigit(c) (isxdigit(c)) #define ltolower(c) (tolower(c)) #endif /* } */ #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lua.h0000644000175000017500000003237212320456500017457 0ustar mathieumathieu/* ** $Id: lua.h,v 1.282 2011/11/29 15:55:08 roberto Exp $ ** Lua - A Scripting Language ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) ** See Copyright Notice at the end of this file */ #ifndef lua_h #define lua_h #include #include #include "luaconf.h" #define LUA_VERSION_MAJOR "5" #define LUA_VERSION_MINOR "2" #define LUA_VERSION_NUM 502 #define LUA_VERSION_RELEASE "0" #define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR #define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE #define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2011 Lua.org, PUC-Rio" #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes" /* mark for precompiled code ('Lua') */ #define LUA_SIGNATURE "\033Lua" /* option for multiple returns in 'lua_pcall' and 'lua_call' */ #define LUA_MULTRET (-1) /* ** pseudo-indices */ #define LUA_REGISTRYINDEX LUAI_FIRSTPSEUDOIDX #define lua_upvalueindex(i) (LUA_REGISTRYINDEX - (i)) /* thread status */ #define LUA_OK 0 #define LUA_YIELD 1 #define LUA_ERRRUN 2 #define LUA_ERRSYNTAX 3 #define LUA_ERRMEM 4 #define LUA_ERRGCMM 5 #define LUA_ERRERR 6 typedef struct lua_State lua_State; typedef int (*lua_CFunction) (lua_State *L); /* ** functions that read/write blocks when loading/dumping Lua chunks */ typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz); typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud); /* ** prototype for memory-allocation functions */ typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); /* ** basic types */ #define LUA_TNONE (-1) #define LUA_TNIL 0 #define LUA_TBOOLEAN 1 #define LUA_TLIGHTUSERDATA 2 #define LUA_TNUMBER 3 #define LUA_TSTRING 4 #define LUA_TTABLE 5 #define LUA_TFUNCTION 6 #define LUA_TUSERDATA 7 #define LUA_TTHREAD 8 #define LUA_NUMTAGS 9 /* minimum Lua stack available to a C function */ #define LUA_MINSTACK 20 /* predefined values in the registry */ #define LUA_RIDX_MAINTHREAD 1 #define LUA_RIDX_GLOBALS 2 #define LUA_RIDX_LAST LUA_RIDX_GLOBALS /* type of numbers in Lua */ typedef LUA_NUMBER lua_Number; /* type for integer functions */ typedef LUA_INTEGER lua_Integer; /* unsigned integer type */ typedef LUA_UNSIGNED lua_Unsigned; /* ** generic extra include file */ #if defined(LUA_USER_H) #include LUA_USER_H #endif /* ** state manipulation */ LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); LUA_API void (lua_close) (lua_State *L); LUA_API lua_State *(lua_newthread) (lua_State *L); LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); LUA_API const lua_Number *(lua_version) (lua_State *L); /* ** basic stack manipulation */ LUA_API int (lua_absindex) (lua_State *L, int idx); LUA_API int (lua_gettop) (lua_State *L); LUA_API void (lua_settop) (lua_State *L, int idx); LUA_API void (lua_pushvalue) (lua_State *L, int idx); LUA_API void (lua_remove) (lua_State *L, int idx); LUA_API void (lua_insert) (lua_State *L, int idx); LUA_API void (lua_replace) (lua_State *L, int idx); LUA_API void (lua_copy) (lua_State *L, int fromidx, int toidx); LUA_API int (lua_checkstack) (lua_State *L, int sz); LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n); /* ** access functions (stack -> C) */ LUA_API int (lua_isnumber) (lua_State *L, int idx); LUA_API int (lua_isstring) (lua_State *L, int idx); LUA_API int (lua_iscfunction) (lua_State *L, int idx); LUA_API int (lua_isuserdata) (lua_State *L, int idx); LUA_API int (lua_type) (lua_State *L, int idx); LUA_API const char *(lua_typename) (lua_State *L, int tp); LUA_API lua_Number (lua_tonumberx) (lua_State *L, int idx, int *isnum); LUA_API lua_Integer (lua_tointegerx) (lua_State *L, int idx, int *isnum); LUA_API lua_Unsigned (lua_tounsignedx) (lua_State *L, int idx, int *isnum); LUA_API int (lua_toboolean) (lua_State *L, int idx); LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); LUA_API size_t (lua_rawlen) (lua_State *L, int idx); LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); LUA_API void *(lua_touserdata) (lua_State *L, int idx); LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); LUA_API const void *(lua_topointer) (lua_State *L, int idx); /* ** Comparison and arithmetic functions */ #define LUA_OPADD 0 /* ORDER TM */ #define LUA_OPSUB 1 #define LUA_OPMUL 2 #define LUA_OPDIV 3 #define LUA_OPMOD 4 #define LUA_OPPOW 5 #define LUA_OPUNM 6 LUA_API void (lua_arith) (lua_State *L, int op); #define LUA_OPEQ 0 #define LUA_OPLT 1 #define LUA_OPLE 2 LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); LUA_API int (lua_compare) (lua_State *L, int idx1, int idx2, int op); /* ** push functions (C -> stack) */ LUA_API void (lua_pushnil) (lua_State *L); LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n); LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n); LUA_API void (lua_pushunsigned) (lua_State *L, lua_Unsigned n); LUA_API const char *(lua_pushlstring) (lua_State *L, const char *s, size_t l); LUA_API const char *(lua_pushstring) (lua_State *L, const char *s); LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt, va_list argp); LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...); LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n); LUA_API void (lua_pushboolean) (lua_State *L, int b); LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p); LUA_API int (lua_pushthread) (lua_State *L); /* ** get functions (Lua -> stack) */ LUA_API void (lua_getglobal) (lua_State *L, const char *var); LUA_API void (lua_gettable) (lua_State *L, int idx); LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k); LUA_API void (lua_rawget) (lua_State *L, int idx); LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n); LUA_API void (lua_rawgetp) (lua_State *L, int idx, const void *p); LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); LUA_API int (lua_getmetatable) (lua_State *L, int objindex); LUA_API void (lua_getuservalue) (lua_State *L, int idx); /* ** set functions (stack -> Lua) */ LUA_API void (lua_setglobal) (lua_State *L, const char *var); LUA_API void (lua_settable) (lua_State *L, int idx); LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k); LUA_API void (lua_rawset) (lua_State *L, int idx); LUA_API void (lua_rawseti) (lua_State *L, int idx, int n); LUA_API void (lua_rawsetp) (lua_State *L, int idx, const void *p); LUA_API int (lua_setmetatable) (lua_State *L, int objindex); LUA_API void (lua_setuservalue) (lua_State *L, int idx); /* ** 'load' and 'call' functions (load and run Lua code) */ LUA_API void (lua_callk) (lua_State *L, int nargs, int nresults, int ctx, lua_CFunction k); #define lua_call(L,n,r) lua_callk(L, (n), (r), 0, NULL) LUA_API int (lua_getctx) (lua_State *L, int *ctx); LUA_API int (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc, int ctx, lua_CFunction k); #define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL) LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, const char *chunkname, const char *mode); LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data); /* ** coroutine functions */ LUA_API int (lua_yieldk) (lua_State *L, int nresults, int ctx, lua_CFunction k); #define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL) LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg); LUA_API int (lua_status) (lua_State *L); /* ** garbage-collection function and options */ #define LUA_GCSTOP 0 #define LUA_GCRESTART 1 #define LUA_GCCOLLECT 2 #define LUA_GCCOUNT 3 #define LUA_GCCOUNTB 4 #define LUA_GCSTEP 5 #define LUA_GCSETPAUSE 6 #define LUA_GCSETSTEPMUL 7 #define LUA_GCSETMAJORINC 8 #define LUA_GCISRUNNING 9 #define LUA_GCGEN 10 #define LUA_GCINC 11 LUA_API int (lua_gc) (lua_State *L, int what, int data); /* ** miscellaneous functions */ LUA_API int (lua_error) (lua_State *L); LUA_API int (lua_next) (lua_State *L, int idx); LUA_API void (lua_concat) (lua_State *L, int n); LUA_API void (lua_len) (lua_State *L, int idx); LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); /* ** =============================================================== ** some useful macros ** =============================================================== */ #define lua_tonumber(L,i) lua_tonumberx(L,i,NULL) #define lua_tointeger(L,i) lua_tointegerx(L,i,NULL) #define lua_tounsigned(L,i) lua_tounsignedx(L,i,NULL) #define lua_pop(L,n) lua_settop(L, -(n)-1) #define lua_newtable(L) lua_createtable(L, 0, 0) #define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) #define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) #define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) #define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) #define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) #define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) #define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) #define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) #define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) #define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) #define lua_pushliteral(L, s) \ lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1) #define lua_pushglobaltable(L) \ lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS) #define lua_tostring(L,i) lua_tolstring(L, (i), NULL) /* ** {====================================================================== ** Debug API ** ======================================================================= */ /* ** Event codes */ #define LUA_HOOKCALL 0 #define LUA_HOOKRET 1 #define LUA_HOOKLINE 2 #define LUA_HOOKCOUNT 3 #define LUA_HOOKTAILCALL 4 /* ** Event masks */ #define LUA_MASKCALL (1 << LUA_HOOKCALL) #define LUA_MASKRET (1 << LUA_HOOKRET) #define LUA_MASKLINE (1 << LUA_HOOKLINE) #define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) typedef struct lua_Debug lua_Debug; /* activation record */ /* Functions to be called by the debugger in specific events */ typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); LUA_API int (lua_getstack) (lua_State *L, int level, lua_Debug *ar); LUA_API int (lua_getinfo) (lua_State *L, const char *what, lua_Debug *ar); LUA_API const char *(lua_getlocal) (lua_State *L, const lua_Debug *ar, int n); LUA_API const char *(lua_setlocal) (lua_State *L, const lua_Debug *ar, int n); LUA_API const char *(lua_getupvalue) (lua_State *L, int funcindex, int n); LUA_API const char *(lua_setupvalue) (lua_State *L, int funcindex, int n); LUA_API void *(lua_upvalueid) (lua_State *L, int fidx, int n); LUA_API void (lua_upvaluejoin) (lua_State *L, int fidx1, int n1, int fidx2, int n2); LUA_API int (lua_sethook) (lua_State *L, lua_Hook func, int mask, int count); LUA_API lua_Hook (lua_gethook) (lua_State *L); LUA_API int (lua_gethookmask) (lua_State *L); LUA_API int (lua_gethookcount) (lua_State *L); struct lua_Debug { int event; const char *name; /* (n) */ const char *namewhat; /* (n) 'global', 'local', 'field', 'method' */ const char *what; /* (S) 'Lua', 'C', 'main', 'tail' */ const char *source; /* (S) */ int currentline; /* (l) */ int linedefined; /* (S) */ int lastlinedefined; /* (S) */ unsigned char nups; /* (u) number of upvalues */ unsigned char nparams;/* (u) number of parameters */ char isvararg; /* (u) */ char istailcall; /* (t) */ char short_src[LUA_IDSIZE]; /* (S) */ /* private part */ struct CallInfo *i_ci; /* active function */ }; /* }====================================================================== */ /****************************************************************************** * Copyright (C) 1994-2011 Lua.org, PUC-Rio. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lapi.h0000644000175000017500000000103512320456500017613 0ustar mathieumathieu/* ** $Id: lapi.h,v 2.7 2009/11/27 15:37:59 roberto Exp $ ** Auxiliary functions from Lua API ** See Copyright Notice in lua.h */ #ifndef lapi_h #define lapi_h #include "llimits.h" #include "lstate.h" #define api_incr_top(L) {L->top++; api_check(L, L->top <= L->ci->top, \ "stack overflow");} #define adjustresults(L,nres) \ { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; } #define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \ "not enough elements in the stack") #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/ldo.cpp0000644000175000017500000004750512320456500020013 0ustar mathieumathieu/* ** $Id: ldo.c,v 2.102 2011/11/29 15:55:08 roberto Exp $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ #include #include #include #define ldo_c #define LUA_CORE #include "lua.h" #include "lapi.h" #include "ldebug.h" #include "ldo.h" #include "lfunc.h" #include "lgc.h" #include "lmem.h" #include "lobject.h" #include "lopcodes.h" #include "lparser.h" #include "lstate.h" #include "lstring.h" #include "ltable.h" #include "ltm.h" #include "lundump.h" #include "lvm.h" #include "lzio.h" /* ** {====================================================== ** Error-recovery functions ** ======================================================= */ /* ** LUAI_THROW/LUAI_TRY define how Lua does exception handling. By ** default, Lua handles errors with exceptions when compiling as ** C++ code, with _longjmp/_setjmp when asked to use them, and with ** longjmp/setjmp otherwise. */ #if !defined(LUAI_THROW) #if defined(__cplusplus) && !defined(LUA_USE_LONGJMP) /* C++ exceptions */ #define LUAI_THROW(L,c) throw(c) #define LUAI_TRY(L,c,a) \ try { a } catch(...) { if ((c)->status == 0) (c)->status = -1; } #define luai_jmpbuf int /* dummy variable */ #elif defined(LUA_USE_ULONGJMP) /* in Unix, try _longjmp/_setjmp (more efficient) */ #define LUAI_THROW(L,c) _longjmp((c)->b, 1) #define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } #define luai_jmpbuf jmp_buf #else /* default handling with long jumps */ #define LUAI_THROW(L,c) longjmp((c)->b, 1) #define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } #define luai_jmpbuf jmp_buf #endif #endif /* chain list of long jump buffers */ struct lua_longjmp { struct lua_longjmp *previous; luai_jmpbuf b; volatile int status; /* error code */ }; static void seterrorobj (lua_State *L, int errcode, StkId oldtop) { switch (errcode) { case LUA_ERRMEM: { /* memory error? */ setsvalue2s(L, oldtop, G(L)->memerrmsg); /* reuse preregistered msg. */ break; } case LUA_ERRERR: { setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling")); break; } default: { setobjs2s(L, oldtop, L->top - 1); /* error message on current top */ break; } } L->top = oldtop + 1; } l_noret luaD_throw (lua_State *L, int errcode) { if (L->errorJmp) { /* thread has an error handler? */ L->errorJmp->status = errcode; /* set status */ LUAI_THROW(L, L->errorJmp); /* jump to it */ } else { /* thread has no error handler */ L->status = cast_byte(errcode); /* mark it as dead */ if (G(L)->mainthread->errorJmp) { /* main thread has a handler? */ setobjs2s(L, G(L)->mainthread->top++, L->top - 1); /* copy error obj. */ luaD_throw(G(L)->mainthread, errcode); /* re-throw in main thread */ } else { /* no handler at all; abort */ if (G(L)->panic) { /* panic function? */ lua_unlock(L); G(L)->panic(L); /* call it (last chance to jump out) */ } abort(); } } } int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { unsigned short oldnCcalls = L->nCcalls; struct lua_longjmp lj; lj.status = LUA_OK; lj.previous = L->errorJmp; /* chain new error handler */ L->errorJmp = &lj; LUAI_TRY(L, &lj, (*f)(L, ud); ); L->errorJmp = lj.previous; /* restore old error handler */ L->nCcalls = oldnCcalls; return lj.status; } /* }====================================================== */ static void correctstack (lua_State *L, TValue *oldstack) { CallInfo *ci; GCObject *up; L->top = (L->top - oldstack) + L->stack; for (up = L->openupval; up != NULL; up = up->gch.next) gco2uv(up)->v = (gco2uv(up)->v - oldstack) + L->stack; for (ci = L->ci; ci != NULL; ci = ci->previous) { ci->top = (ci->top - oldstack) + L->stack; ci->func = (ci->func - oldstack) + L->stack; if (isLua(ci)) ci->u.l.base = (ci->u.l.base - oldstack) + L->stack; } } /* some space for error handling */ #define ERRORSTACKSIZE (LUAI_MAXSTACK + 200) void luaD_reallocstack (lua_State *L, int newsize) { TValue *oldstack = L->stack; int lim = L->stacksize; lua_assert(newsize <= LUAI_MAXSTACK || newsize == ERRORSTACKSIZE); lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK); luaM_reallocvector(L, L->stack, L->stacksize, newsize, TValue); for (; lim < newsize; lim++) setnilvalue(L->stack + lim); /* erase new segment */ L->stacksize = newsize; L->stack_last = L->stack + newsize - EXTRA_STACK; correctstack(L, oldstack); } void luaD_growstack (lua_State *L, int n) { int size = L->stacksize; if (size > LUAI_MAXSTACK) /* error after extra size? */ luaD_throw(L, LUA_ERRERR); else { int needed = cast_int(L->top - L->stack) + n + EXTRA_STACK; int newsize = 2 * size; if (newsize > LUAI_MAXSTACK) newsize = LUAI_MAXSTACK; if (newsize < needed) newsize = needed; if (newsize > LUAI_MAXSTACK) { /* stack overflow? */ luaD_reallocstack(L, ERRORSTACKSIZE); luaG_runerror(L, "stack overflow"); } else luaD_reallocstack(L, newsize); } } static int stackinuse (lua_State *L) { CallInfo *ci; StkId lim = L->top; for (ci = L->ci; ci != NULL; ci = ci->previous) { lua_assert(ci->top <= L->stack_last); if (lim < ci->top) lim = ci->top; } return cast_int(lim - L->stack) + 1; /* part of stack in use */ } void luaD_shrinkstack (lua_State *L) { int inuse = stackinuse(L); int goodsize = inuse + (inuse / 8) + 2*EXTRA_STACK; if (goodsize > LUAI_MAXSTACK) goodsize = LUAI_MAXSTACK; if (inuse > LUAI_MAXSTACK || /* handling stack overflow? */ goodsize >= L->stacksize) /* would grow instead of shrink? */ condmovestack(L); /* don't change stack (change only for debugging) */ else luaD_reallocstack(L, goodsize); /* shrink it */ } void luaD_hook (lua_State *L, int event, int line) { lua_Hook hook = L->hook; if (hook && L->allowhook) { CallInfo *ci = L->ci; ptrdiff_t top = savestack(L, L->top); ptrdiff_t ci_top = savestack(L, ci->top); lua_Debug ar; ar.event = event; ar.currentline = line; ar.i_ci = ci; luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ ci->top = L->top + LUA_MINSTACK; lua_assert(ci->top <= L->stack_last); L->allowhook = 0; /* cannot call hooks inside a hook */ ci->callstatus |= CIST_HOOKED; lua_unlock(L); (*hook)(L, &ar); lua_lock(L); lua_assert(!L->allowhook); L->allowhook = 1; ci->top = restorestack(L, ci_top); L->top = restorestack(L, top); ci->callstatus &= ~CIST_HOOKED; } } static void callhook (lua_State *L, CallInfo *ci) { int hook = LUA_HOOKCALL; ci->u.l.savedpc++; /* hooks assume 'pc' is already incremented */ if (isLua(ci->previous) && GET_OPCODE(*(ci->previous->u.l.savedpc - 1)) == OP_TAILCALL) { ci->callstatus |= CIST_TAIL; hook = LUA_HOOKTAILCALL; } luaD_hook(L, hook, -1); ci->u.l.savedpc--; /* correct 'pc' */ } static StkId adjust_varargs (lua_State *L, Proto *p, int actual) { int i; int nfixargs = p->numparams; StkId base, fixed; lua_assert(actual >= nfixargs); /* move fixed parameters to final position */ fixed = L->top - actual; /* first fixed argument */ base = L->top; /* final position of first argument */ for (i=0; itop++, fixed + i); setnilvalue(fixed + i); } return base; } static StkId tryfuncTM (lua_State *L, StkId func) { const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL); StkId p; ptrdiff_t funcr = savestack(L, func); if (!ttisfunction(tm)) luaG_typeerror(L, func, "call"); /* Open a hole inside the stack at `func' */ for (p = L->top; p > func; p--) setobjs2s(L, p, p-1); incr_top(L); func = restorestack(L, funcr); /* previous call may change stack */ setobj2s(L, func, tm); /* tag method is the new function to be called */ return func; } #define next_ci(L) (L->ci = (L->ci->next ? L->ci->next : luaE_extendCI(L))) /* ** returns true if function has been executed (C function) */ int luaD_precall (lua_State *L, StkId func, int nresults) { lua_CFunction f; CallInfo *ci; int n; /* number of arguments (Lua) or returns (C) */ ptrdiff_t funcr = savestack(L, func); switch (ttype(func)) { case LUA_TLCF: /* light C function */ f = fvalue(func); goto Cfunc; case LUA_TCCL: { /* C closure */ f = clCvalue(func)->f; Cfunc: luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ ci = next_ci(L); /* now 'enter' new function */ ci->nresults = nresults; ci->func = restorestack(L, funcr); ci->top = L->top + LUA_MINSTACK; lua_assert(ci->top <= L->stack_last); ci->callstatus = 0; if (L->hookmask & LUA_MASKCALL) luaD_hook(L, LUA_HOOKCALL, -1); lua_unlock(L); n = (*f)(L); /* do the actual call */ lua_lock(L); api_checknelems(L, n); luaD_poscall(L, L->top - n); return 1; } case LUA_TLCL: { /* Lua function: prepare its call */ StkId base; Proto *p = clLvalue(func)->p; luaD_checkstack(L, p->maxstacksize); func = restorestack(L, funcr); n = cast_int(L->top - func) - 1; /* number of real arguments */ for (; n < p->numparams; n++) setnilvalue(L->top++); /* complete missing arguments */ base = (!p->is_vararg) ? func + 1 : adjust_varargs(L, p, n); ci = next_ci(L); /* now 'enter' new function */ ci->nresults = nresults; ci->func = func; ci->u.l.base = base; ci->top = base + p->maxstacksize; lua_assert(ci->top <= L->stack_last); ci->u.l.savedpc = p->code; /* starting point */ ci->callstatus = CIST_LUA; L->top = ci->top; if (L->hookmask & LUA_MASKCALL) callhook(L, ci); return 0; } default: { /* not a function */ func = tryfuncTM(L, func); /* retry with 'function' tag method */ return luaD_precall(L, func, nresults); /* now it must be a function */ } } } int luaD_poscall (lua_State *L, StkId firstResult) { StkId res; int wanted, i; CallInfo *ci = L->ci; if (L->hookmask & (LUA_MASKRET | LUA_MASKLINE)) { if (L->hookmask & LUA_MASKRET) { ptrdiff_t fr = savestack(L, firstResult); /* hook may change stack */ luaD_hook(L, LUA_HOOKRET, -1); firstResult = restorestack(L, fr); } L->oldpc = ci->previous->u.l.savedpc; /* 'oldpc' for caller function */ } res = ci->func; /* res == final position of 1st result */ wanted = ci->nresults; L->ci = ci = ci->previous; /* back to caller */ /* move results to correct place */ for (i = wanted; i != 0 && firstResult < L->top; i--) setobjs2s(L, res++, firstResult++); while (i-- > 0) setnilvalue(res++); L->top = res; return (wanted - LUA_MULTRET); /* 0 iff wanted == LUA_MULTRET */ } /* ** Call a function (C or Lua). The function to be called is at *func. ** The arguments are on the stack, right after the function. ** When returns, all the results are on the stack, starting at the original ** function position. */ void luaD_call (lua_State *L, StkId func, int nResults, int allowyield) { if (++L->nCcalls >= LUAI_MAXCCALLS) { if (L->nCcalls == LUAI_MAXCCALLS) luaG_runerror(L, "C stack overflow"); else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3))) luaD_throw(L, LUA_ERRERR); /* error while handing stack error */ } if (!allowyield) L->nny++; if (!luaD_precall(L, func, nResults)) /* is a Lua function? */ luaV_execute(L); /* call it */ if (!allowyield) L->nny--; L->nCcalls--; luaC_checkGC(L); } static void finishCcall (lua_State *L) { CallInfo *ci = L->ci; int n; lua_assert(ci->u.c.k != NULL); /* must have a continuation */ lua_assert(L->nny == 0); /* finish 'luaD_call' */ L->nCcalls--; /* finish 'lua_callk' */ adjustresults(L, ci->nresults); /* call continuation function */ if (!(ci->callstatus & CIST_STAT)) /* no call status? */ ci->u.c.status = LUA_YIELD; /* 'default' status */ lua_assert(ci->u.c.status != LUA_OK); ci->callstatus = (ci->callstatus & ~(CIST_YPCALL | CIST_STAT)) | CIST_YIELDED; lua_unlock(L); n = (*ci->u.c.k)(L); lua_lock(L); api_checknelems(L, n); /* finish 'luaD_precall' */ luaD_poscall(L, L->top - n); } static void unroll (lua_State *L, void *ud) { UNUSED(ud); for (;;) { if (L->ci == &L->base_ci) /* stack is empty? */ return; /* coroutine finished normally */ if (!isLua(L->ci)) /* C function? */ finishCcall(L); else { /* Lua function */ luaV_finishOp(L); /* finish interrupted instruction */ luaV_execute(L); /* execute down to higher C 'boundary' */ } } } /* ** check whether thread has a suspended protected call */ static CallInfo *findpcall (lua_State *L) { CallInfo *ci; for (ci = L->ci; ci != NULL; ci = ci->previous) { /* search for a pcall */ if (ci->callstatus & CIST_YPCALL) return ci; } return NULL; /* no pending pcall */ } static int recover (lua_State *L, int status) { StkId oldtop; CallInfo *ci = findpcall(L); if (ci == NULL) return 0; /* no recovery point */ /* "finish" luaD_pcall */ oldtop = restorestack(L, ci->u.c.extra); luaF_close(L, oldtop); seterrorobj(L, status, oldtop); L->ci = ci; L->allowhook = ci->u.c.old_allowhook; L->nny = 0; /* should be zero to be yieldable */ luaD_shrinkstack(L); L->errfunc = ci->u.c.old_errfunc; ci->callstatus |= CIST_STAT; /* call has error status */ ci->u.c.status = status; /* (here it is) */ return 1; /* continue running the coroutine */ } /* ** signal an error in the call to 'resume', not in the execution of the ** coroutine itself. (Such errors should not be handled by any coroutine ** error handler and should not kill the coroutine.) */ static l_noret resume_error (lua_State *L, const char *msg, StkId firstArg) { L->top = firstArg; /* remove args from the stack */ setsvalue2s(L, L->top, luaS_new(L, msg)); /* push error message */ incr_top(L); luaD_throw(L, -1); /* jump back to 'lua_resume' */ } /* ** do the work for 'lua_resume' in protected mode */ static void resume (lua_State *L, void *ud) { StkId firstArg = cast(StkId, ud); CallInfo *ci = L->ci; if (L->nCcalls >= LUAI_MAXCCALLS) resume_error(L, "C stack overflow", firstArg); if (L->status == LUA_OK) { /* may be starting a coroutine */ if (ci != &L->base_ci) /* not in base level? */ resume_error(L, "cannot resume non-suspended coroutine", firstArg); /* coroutine is in base level; start running it */ if (!luaD_precall(L, firstArg - 1, LUA_MULTRET)) /* Lua function? */ luaV_execute(L); /* call it */ } else if (L->status != LUA_YIELD) resume_error(L, "cannot resume dead coroutine", firstArg); else { /* resuming from previous yield */ L->status = LUA_OK; if (isLua(ci)) /* yielded inside a hook? */ luaV_execute(L); /* just continue running Lua code */ else { /* 'common' yield */ ci->func = restorestack(L, ci->u.c.extra); if (ci->u.c.k != NULL) { /* does it have a continuation? */ int n; ci->u.c.status = LUA_YIELD; /* 'default' status */ ci->callstatus |= CIST_YIELDED; lua_unlock(L); n = (*ci->u.c.k)(L); /* call continuation */ lua_lock(L); api_checknelems(L, n); firstArg = L->top - n; /* yield results come from continuation */ } L->nCcalls--; /* finish 'luaD_call' */ luaD_poscall(L, firstArg); /* finish 'luaD_precall' */ } unroll(L, NULL); } } LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs) { int status; lua_lock(L); luai_userstateresume(L, nargs); L->nCcalls = (from) ? from->nCcalls + 1 : 1; L->nny = 0; /* allow yields */ api_checknelems(L, (L->status == LUA_OK) ? nargs + 1 : nargs); status = luaD_rawrunprotected(L, resume, L->top - nargs); if (status == -1) /* error calling 'lua_resume'? */ status = LUA_ERRRUN; else { /* yield or regular error */ while (status != LUA_OK && status != LUA_YIELD) { /* error? */ if (recover(L, status)) /* recover point? */ status = luaD_rawrunprotected(L, unroll, NULL); /* run continuation */ else { /* unrecoverable error */ L->status = cast_byte(status); /* mark thread as `dead' */ seterrorobj(L, status, L->top); L->ci->top = L->top; break; } } lua_assert(status == L->status); } L->nny = 1; /* do not allow yields */ L->nCcalls--; lua_assert(L->nCcalls == ((from) ? from->nCcalls : 0)); lua_unlock(L); return status; } LUA_API int lua_yieldk (lua_State *L, int nresults, int ctx, lua_CFunction k) { CallInfo *ci = L->ci; luai_userstateyield(L, nresults); lua_lock(L); api_checknelems(L, nresults); if (L->nny > 0) { if (L != G(L)->mainthread) luaG_runerror(L, "attempt to yield across metamethod/C-call boundary"); else luaG_runerror(L, "attempt to yield from outside a coroutine"); } L->status = LUA_YIELD; if (isLua(ci)) { /* inside a hook? */ api_check(L, k == NULL, "hooks cannot continue after yielding"); } else { if ((ci->u.c.k = k) != NULL) /* is there a continuation? */ ci->u.c.ctx = ctx; /* save context */ ci->u.c.extra = savestack(L, ci->func); /* save current 'func' */ ci->func = L->top - nresults - 1; /* protect stack below results */ luaD_throw(L, LUA_YIELD); } lua_assert(ci->callstatus & CIST_HOOKED); /* must be inside a hook */ lua_unlock(L); return 0; /* return to 'luaD_hook' */ } int luaD_pcall (lua_State *L, Pfunc func, void *u, ptrdiff_t old_top, ptrdiff_t ef) { int status; CallInfo *old_ci = L->ci; lu_byte old_allowhooks = L->allowhook; unsigned short old_nny = L->nny; ptrdiff_t old_errfunc = L->errfunc; L->errfunc = ef; status = luaD_rawrunprotected(L, func, u); if (status != LUA_OK) { /* an error occurred? */ StkId oldtop = restorestack(L, old_top); luaF_close(L, oldtop); /* close possible pending closures */ seterrorobj(L, status, oldtop); L->ci = old_ci; L->allowhook = old_allowhooks; L->nny = old_nny; luaD_shrinkstack(L); } L->errfunc = old_errfunc; return status; } /* ** Execute a protected parser. */ struct SParser { /* data to `f_parser' */ ZIO *z; Mbuffer buff; /* dynamic structure used by the scanner */ Dyndata dyd; /* dynamic structures used by the parser */ const char *mode; const char *name; }; static void checkmode (lua_State *L, const char *mode, const char *x) { if (mode && strchr(mode, x[0]) == NULL) { luaO_pushfstring(L, "attempt to load a %s chunk (mode is " LUA_QS ")", x, mode); luaD_throw(L, LUA_ERRSYNTAX); } } static void f_parser (lua_State *L, void *ud) { int i; Proto *tf; Closure *cl; struct SParser *p = cast(struct SParser *, ud); int c = zgetc(p->z); /* read first character */ if (c == LUA_SIGNATURE[0]) { checkmode(L, p->mode, "binary"); tf = luaU_undump(L, p->z, &p->buff, p->name); } else { checkmode(L, p->mode, "text"); tf = luaY_parser(L, p->z, &p->buff, &p->dyd, p->name, c); } setptvalue2s(L, L->top, tf); incr_top(L); cl = luaF_newLclosure(L, tf); setclLvalue(L, L->top - 1, cl); for (i = 0; i < tf->sizeupvalues; i++) /* initialize upvalues */ cl->l.upvals[i] = luaF_newupval(L); } int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, const char *mode) { struct SParser p; int status; L->nny++; /* cannot yield during parsing */ p.z = z; p.name = name; p.mode = mode; p.dyd.actvar.arr = NULL; p.dyd.actvar.size = 0; p.dyd.gt.arr = NULL; p.dyd.gt.size = 0; p.dyd.label.arr = NULL; p.dyd.label.size = 0; luaZ_initbuffer(L, &p.buff); status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc); luaZ_freebuffer(L, &p.buff); luaM_freearray(L, p.dyd.actvar.arr, p.dyd.actvar.size); luaM_freearray(L, p.dyd.gt.arr, p.dyd.gt.size); luaM_freearray(L, p.dyd.label.arr, p.dyd.label.size); L->nny--; return status; } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lundump.h0000644000175000017500000000137212320456500020356 0ustar mathieumathieu/* ** $Id: lundump.h,v 1.44 2011/05/06 13:35:17 lhf Exp $ ** load precompiled Lua chunks ** See Copyright Notice in lua.h */ #ifndef lundump_h #define lundump_h #include "lobject.h" #include "lzio.h" /* load one chunk; from lundump.c */ LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name); /* make header; from lundump.c */ LUAI_FUNC void luaU_header (lu_byte* h); /* dump one chunk; from ldump.c */ LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); /* data to catch conversion errors */ #define LUAC_TAIL "\x19\x93\r\n\x1a\n" /* size in bytes of header of binary files */ #define LUAC_HEADERSIZE (sizeof(LUA_SIGNATURE)-sizeof(char)+2+6+sizeof(LUAC_TAIL)-sizeof(char)) #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lstring.h0000644000175000017500000000164612320456500020360 0ustar mathieumathieu/* ** $Id: lstring.h,v 1.46 2010/04/05 16:26:37 roberto Exp $ ** String table (keep all strings handled by Lua) ** See Copyright Notice in lua.h */ #ifndef lstring_h #define lstring_h #include "lgc.h" #include "lobject.h" #include "lstate.h" #define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) #define sizeudata(u) (sizeof(union Udata)+(u)->len) #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ (sizeof(s)/sizeof(char))-1)) #define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) /* ** as all string are internalized, string equality becomes ** pointer equality */ #define eqstr(a,b) ((a) == (b)) LUAI_FUNC void luaS_resize (lua_State *L, int newsize); LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); LUAI_FUNC TString *luaS_new (lua_State *L, const char *str); #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lbitlib.cpp0000644000175000017500000001013612320456500020644 0ustar mathieumathieu/* ** $Id: lbitlib.c,v 1.16 2011/06/20 16:35:23 roberto Exp $ ** Standard library for bitwise operations ** See Copyright Notice in lua.h */ #define lbitlib_c #define LUA_LIB #include "lua.h" #include "lauxlib.h" #include "lualib.h" /* number of bits to consider in a number */ #if !defined(LUA_NBITS) #define LUA_NBITS 32 #endif #define ALLONES (~(((~(lua_Unsigned)0) << (LUA_NBITS - 1)) << 1)) /* macro to trim extra bits */ #define trim(x) ((x) & ALLONES) /* builds a number with 'n' ones (1 <= n <= LUA_NBITS) */ #define mask(n) (~((ALLONES << 1) << ((n) - 1))) typedef lua_Unsigned b_uint; static b_uint andaux (lua_State *L) { int i, n = lua_gettop(L); b_uint r = ~(b_uint)0; for (i = 1; i <= n; i++) r &= luaL_checkunsigned(L, i); return trim(r); } static int b_and (lua_State *L) { b_uint r = andaux(L); lua_pushunsigned(L, r); return 1; } static int b_test (lua_State *L) { b_uint r = andaux(L); lua_pushboolean(L, r != 0); return 1; } static int b_or (lua_State *L) { int i, n = lua_gettop(L); b_uint r = 0; for (i = 1; i <= n; i++) r |= luaL_checkunsigned(L, i); lua_pushunsigned(L, trim(r)); return 1; } static int b_xor (lua_State *L) { int i, n = lua_gettop(L); b_uint r = 0; for (i = 1; i <= n; i++) r ^= luaL_checkunsigned(L, i); lua_pushunsigned(L, trim(r)); return 1; } static int b_not (lua_State *L) { b_uint r = ~luaL_checkunsigned(L, 1); lua_pushunsigned(L, trim(r)); return 1; } static int b_shift (lua_State *L, b_uint r, int i) { if (i < 0) { /* shift right? */ i = -i; r = trim(r); if (i >= LUA_NBITS) r = 0; else r >>= i; } else { /* shift left */ if (i >= LUA_NBITS) r = 0; else r <<= i; r = trim(r); } lua_pushunsigned(L, r); return 1; } static int b_lshift (lua_State *L) { return b_shift(L, luaL_checkunsigned(L, 1), luaL_checkint(L, 2)); } static int b_rshift (lua_State *L) { return b_shift(L, luaL_checkunsigned(L, 1), -luaL_checkint(L, 2)); } static int b_arshift (lua_State *L) { b_uint r = luaL_checkunsigned(L, 1); int i = luaL_checkint(L, 2); if (i < 0 || !(r & ((b_uint)1 << (LUA_NBITS - 1)))) return b_shift(L, r, -i); else { /* arithmetic shift for 'negative' number */ if (i >= LUA_NBITS) r = ALLONES; else r = trim((r >> i) | ~(~(b_uint)0 >> i)); /* add signal bit */ lua_pushunsigned(L, r); return 1; } } static int b_rot (lua_State *L, int i) { b_uint r = luaL_checkunsigned(L, 1); i &= (LUA_NBITS - 1); /* i = i % NBITS */ r = trim(r); r = (r << i) | (r >> (LUA_NBITS - i)); lua_pushunsigned(L, trim(r)); return 1; } static int b_lrot (lua_State *L) { return b_rot(L, luaL_checkint(L, 2)); } static int b_rrot (lua_State *L) { return b_rot(L, -luaL_checkint(L, 2)); } /* ** get field and width arguments for field-manipulation functions, ** checking whether they are valid */ static int fieldargs (lua_State *L, int farg, int *width) { int f = luaL_checkint(L, farg); int w = luaL_optint(L, farg + 1, 1); luaL_argcheck(L, 0 <= f, farg, "field cannot be negative"); luaL_argcheck(L, 0 < w, farg + 1, "width must be positive"); if (f + w > LUA_NBITS) luaL_error(L, "trying to access non-existent bits"); *width = w; return f; } static int b_extract (lua_State *L) { int w; b_uint r = luaL_checkunsigned(L, 1); int f = fieldargs(L, 2, &w); r = (r >> f) & mask(w); lua_pushunsigned(L, r); return 1; } static int b_replace (lua_State *L) { int w; b_uint r = luaL_checkunsigned(L, 1); b_uint v = luaL_checkunsigned(L, 2); int f = fieldargs(L, 3, &w); int m = mask(w); v &= m; /* erase bits outside given width */ r = (r & ~(m << f)) | (v << f); lua_pushunsigned(L, r); return 1; } static const luaL_Reg bitlib[] = { {"arshift", b_arshift}, {"band", b_and}, {"bnot", b_not}, {"bor", b_or}, {"bxor", b_xor}, {"btest", b_test}, {"extract", b_extract}, {"lrotate", b_lrot}, {"lshift", b_lshift}, {"replace", b_replace}, {"rrotate", b_rrot}, {"rshift", b_rshift}, {NULL, NULL} }; LUAMOD_API int luaopen_bit32 (lua_State *L) { luaL_newlib(L, bitlib); return 1; } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lzio.h0000644000175000017500000000271212320456500017646 0ustar mathieumathieu/* ** $Id: lzio.h,v 1.26 2011/07/15 12:48:03 roberto Exp $ ** Buffered streams ** See Copyright Notice in lua.h */ #ifndef lzio_h #define lzio_h #include "lua.h" #include "lmem.h" #define EOZ (-1) /* end of stream */ typedef struct Zio ZIO; #define zgetc(z) (((z)->n--)>0 ? cast_uchar(*(z)->p++) : luaZ_fill(z)) typedef struct Mbuffer { char *buffer; size_t n; size_t buffsize; } Mbuffer; #define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) #define luaZ_buffer(buff) ((buff)->buffer) #define luaZ_sizebuffer(buff) ((buff)->buffsize) #define luaZ_bufflen(buff) ((buff)->n) #define luaZ_resetbuffer(buff) ((buff)->n = 0) #define luaZ_resizebuffer(L, buff, size) \ (luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \ (buff)->buffsize = size) #define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data); LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */ /* --------- Private Part ------------------ */ struct Zio { size_t n; /* bytes still unread */ const char *p; /* current position in buffer */ lua_Reader reader; /* reader function */ void* data; /* additional data */ lua_State *L; /* Lua state (for reader) */ }; LUAI_FUNC int luaZ_fill (ZIO *z); #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lua.hpp0000644000175000017500000000014312320456500020006 0ustar mathieumathieu// lua.hpp // Lua header files for C++ #include "lua.h" #include "lualib.h" #include "lauxlib.h" ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lvm.cpp0000644000175000017500000006741612320456500020036 0ustar mathieumathieu/* ** $Id: lvm.c,v 2.147 2011/12/07 14:43:55 roberto Exp $ ** Lua virtual machine ** See Copyright Notice in lua.h */ #include #include #include #define lvm_c #define LUA_CORE #include "lua.h" #include "ldebug.h" #include "ldo.h" #include "lfunc.h" #include "lgc.h" #include "lobject.h" #include "lopcodes.h" #include "lstate.h" #include "lstring.h" #include "ltable.h" #include "ltm.h" #include "lvm.h" /* limit for table tag-method chains (to avoid loops) */ #define MAXTAGLOOP 100 const TValue *luaV_tonumber (const TValue *obj, TValue *n) { lua_Number num; if (ttisnumber(obj)) return obj; if (ttisstring(obj) && luaO_str2d(svalue(obj), tsvalue(obj)->len, &num)) { setnvalue(n, num); return n; } else return NULL; } int luaV_tostring (lua_State *L, StkId obj) { if (!ttisnumber(obj)) return 0; else { char s[LUAI_MAXNUMBER2STR]; lua_Number n = nvalue(obj); int l = lua_number2str(s, n); setsvalue2s(L, obj, luaS_newlstr(L, s, l)); return 1; } } static void traceexec (lua_State *L) { CallInfo *ci = L->ci; lu_byte mask = L->hookmask; if ((mask & LUA_MASKCOUNT) && L->hookcount == 0) { resethookcount(L); luaD_hook(L, LUA_HOOKCOUNT, -1); } if (mask & LUA_MASKLINE) { Proto *p = ci_func(ci)->p; int npc = pcRel(ci->u.l.savedpc, p); int newline = getfuncline(p, npc); if (npc == 0 || /* call linehook when enter a new function, */ ci->u.l.savedpc <= L->oldpc || /* when jump back (loop), or when */ newline != getfuncline(p, pcRel(L->oldpc, p))) /* enter a new line */ luaD_hook(L, LUA_HOOKLINE, newline); } L->oldpc = ci->u.l.savedpc; if (L->status == LUA_YIELD) { /* did hook yield? */ ci->u.l.savedpc--; /* undo increment (resume will increment it again) */ luaD_throw(L, LUA_YIELD); } } static void callTM (lua_State *L, const TValue *f, const TValue *p1, const TValue *p2, TValue *p3, int hasres) { ptrdiff_t result = savestack(L, p3); setobj2s(L, L->top++, f); /* push function */ setobj2s(L, L->top++, p1); /* 1st argument */ setobj2s(L, L->top++, p2); /* 2nd argument */ if (!hasres) /* no result? 'p3' is third argument */ setobj2s(L, L->top++, p3); /* 3rd argument */ luaD_checkstack(L, 0); /* metamethod may yield only when called from Lua code */ luaD_call(L, L->top - (4 - hasres), hasres, isLua(L->ci)); if (hasres) { /* if has result, move it to its place */ p3 = restorestack(L, result); setobjs2s(L, p3, --L->top); } } void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) { int loop; for (loop = 0; loop < MAXTAGLOOP; loop++) { const TValue *tm; if (ttistable(t)) { /* `t' is a table? */ Table *h = hvalue(t); const TValue *res = luaH_get(h, key); /* do a primitive get */ if (!ttisnil(res) || /* result is not nil? */ (tm = fasttm(L, h->metatable, TM_INDEX)) == NULL) { /* or no TM? */ setobj2s(L, val, res); return; } /* else will try the tag method */ } else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX))) luaG_typeerror(L, t, "index"); if (ttisfunction(tm)) { callTM(L, tm, t, key, val, 1); return; } t = tm; /* else repeat with 'tm' */ } luaG_runerror(L, "loop in gettable"); } void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) { int loop; for (loop = 0; loop < MAXTAGLOOP; loop++) { const TValue *tm; if (ttistable(t)) { /* `t' is a table? */ Table *h = hvalue(t); TValue *oldval = cast(TValue *, luaH_get(h, key)); /* if previous value is not nil, there must be a previous entry in the table; moreover, a metamethod has no relevance */ if (!ttisnil(oldval) || /* previous value is nil; must check the metamethod */ ((tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL && /* no metamethod; is there a previous entry in the table? */ (oldval != luaO_nilobject || /* no previous entry; must create one. (The next test is always true; we only need the assignment.) */ (oldval = luaH_newkey(L, h, key), 1)))) { /* no metamethod and (now) there is an entry with given key */ setobj2t(L, oldval, val); /* assign new value to that entry */ invalidateTMcache(h); luaC_barrierback(L, obj2gco(h), val); return; } /* else will try the metamethod */ } else /* not a table; check metamethod */ if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX))) luaG_typeerror(L, t, "index"); /* there is a metamethod */ if (ttisfunction(tm)) { callTM(L, tm, t, key, val, 0); return; } t = tm; /* else repeat with 'tm' */ } luaG_runerror(L, "loop in settable"); } static int call_binTM (lua_State *L, const TValue *p1, const TValue *p2, StkId res, TMS event) { const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */ if (ttisnil(tm)) tm = luaT_gettmbyobj(L, p2, event); /* try second operand */ if (ttisnil(tm)) return 0; callTM(L, tm, p1, p2, res, 1); return 1; } static const TValue *get_equalTM (lua_State *L, Table *mt1, Table *mt2, TMS event) { const TValue *tm1 = fasttm(L, mt1, event); const TValue *tm2; if (tm1 == NULL) return NULL; /* no metamethod */ if (mt1 == mt2) return tm1; /* same metatables => same metamethods */ tm2 = fasttm(L, mt2, event); if (tm2 == NULL) return NULL; /* no metamethod */ if (luaV_rawequalobj(tm1, tm2)) /* same metamethods? */ return tm1; return NULL; } static int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2, TMS event) { if (!call_binTM(L, p1, p2, L->top, event)) return -1; /* no metamethod */ else return !l_isfalse(L->top); } static int l_strcmp (const TString *ls, const TString *rs) { const char *l = getstr(ls); size_t ll = ls->tsv.len; const char *r = getstr(rs); size_t lr = rs->tsv.len; for (;;) { int temp = strcoll(l, r); if (temp != 0) return temp; else { /* strings are equal up to a `\0' */ size_t len = strlen(l); /* index of first `\0' in both strings */ if (len == lr) /* r is finished? */ return (len == ll) ? 0 : 1; else if (len == ll) /* l is finished? */ return -1; /* l is smaller than r (because r is not finished) */ /* both strings longer than `len'; go on comparing (after the `\0') */ len++; l += len; ll -= len; r += len; lr -= len; } } } int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { int res; if (ttisnumber(l) && ttisnumber(r)) return luai_numlt(L, nvalue(l), nvalue(r)); else if (ttisstring(l) && ttisstring(r)) return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0; else if ((res = call_orderTM(L, l, r, TM_LT)) < 0) luaG_ordererror(L, l, r); return res; } int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r) { int res; if (ttisnumber(l) && ttisnumber(r)) return luai_numle(L, nvalue(l), nvalue(r)); else if (ttisstring(l) && ttisstring(r)) return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0; else if ((res = call_orderTM(L, l, r, TM_LE)) >= 0) /* first try `le' */ return res; else if ((res = call_orderTM(L, r, l, TM_LT)) < 0) /* else try `lt' */ luaG_ordererror(L, l, r); return !res; } /* ** equality of Lua values. L == NULL means raw equality (no metamethods) */ int luaV_equalobj_ (lua_State *L, const TValue *t1, const TValue *t2) { const TValue *tm; lua_assert(ttisequal(t1, t2)); switch (ttype(t1)) { case LUA_TNIL: return 1; case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2)); case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); case LUA_TLCF: return fvalue(t1) == fvalue(t2); case LUA_TSTRING: return eqstr(rawtsvalue(t1), rawtsvalue(t2)); case LUA_TUSERDATA: { if (uvalue(t1) == uvalue(t2)) return 1; else if (L == NULL) return 0; tm = get_equalTM(L, uvalue(t1)->metatable, uvalue(t2)->metatable, TM_EQ); break; /* will try TM */ } case LUA_TTABLE: { if (hvalue(t1) == hvalue(t2)) return 1; else if (L == NULL) return 0; tm = get_equalTM(L, hvalue(t1)->metatable, hvalue(t2)->metatable, TM_EQ); break; /* will try TM */ } default: lua_assert(iscollectable(t1)); return gcvalue(t1) == gcvalue(t2); } if (tm == NULL) return 0; /* no TM? */ callTM(L, tm, t1, t2, L->top, 1); /* call TM */ return !l_isfalse(L->top); } void luaV_concat (lua_State *L, int total) { lua_assert(total >= 2); do { StkId top = L->top; int n = 2; /* number of elements handled in this pass (at least 2) */ if (!(ttisstring(top-2) || ttisnumber(top-2)) || !tostring(L, top-1)) { if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT)) luaG_concaterror(L, top-2, top-1); } else if (tsvalue(top-1)->len == 0) /* second operand is empty? */ (void)tostring(L, top - 2); /* result is first operand */ else if (ttisstring(top-2) && tsvalue(top-2)->len == 0) { setsvalue2s(L, top-2, rawtsvalue(top-1)); /* result is second op. */ } else { /* at least two non-empty string values; get as many as possible */ size_t tl = tsvalue(top-1)->len; char *buffer; int i; /* collect total length */ for (i = 1; i < total && tostring(L, top-i-1); i++) { size_t l = tsvalue(top-i-1)->len; if (l >= (MAX_SIZET/sizeof(char)) - tl) luaG_runerror(L, "string length overflow"); tl += l; } buffer = luaZ_openspace(L, &G(L)->buff, tl); tl = 0; n = i; do { /* concat all strings */ size_t l = tsvalue(top-i)->len; memcpy(buffer+tl, svalue(top-i), l * sizeof(char)); tl += l; } while (--i > 0); setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl)); } total -= n-1; /* got 'n' strings to create 1 new */ L->top -= n-1; /* popped 'n' strings and pushed one */ } while (total > 1); /* repeat until only 1 result left */ } void luaV_objlen (lua_State *L, StkId ra, const TValue *rb) { const TValue *tm; switch (ttypenv(rb)) { case LUA_TTABLE: { Table *h = hvalue(rb); tm = fasttm(L, h->metatable, TM_LEN); if (tm) break; /* metamethod? break switch to call it */ setnvalue(ra, cast_num(luaH_getn(h))); /* else primitive len */ return; } case LUA_TSTRING: { setnvalue(ra, cast_num(tsvalue(rb)->len)); return; } default: { /* try metamethod */ tm = luaT_gettmbyobj(L, rb, TM_LEN); if (ttisnil(tm)) /* no metamethod? */ luaG_typeerror(L, rb, "get length of"); break; } } callTM(L, tm, rb, rb, ra, 1); } void luaV_arith (lua_State *L, StkId ra, const TValue *rb, const TValue *rc, TMS op) { TValue tempb, tempc; const TValue *b, *c; if ((b = luaV_tonumber(rb, &tempb)) != NULL && (c = luaV_tonumber(rc, &tempc)) != NULL) { lua_Number res = luaO_arith(op - TM_ADD + LUA_OPADD, nvalue(b), nvalue(c)); setnvalue(ra, res); } else if (!call_binTM(L, rb, rc, ra, op)) luaG_aritherror(L, rb, rc); } /* ** check whether cached closure in prototype 'p' may be reused, that is, ** whether there is a cached closure with the same upvalues needed by ** new closure to be created. */ static Closure *getcached (Proto *p, UpVal **encup, StkId base) { Closure *c = p->cache; if (c != NULL) { /* is there a cached closure? */ int nup = p->sizeupvalues; Upvaldesc *uv = p->upvalues; int i; for (i = 0; i < nup; i++) { /* check whether it has right upvalues */ TValue *v = uv[i].instack ? base + uv[i].idx : encup[uv[i].idx]->v; if (c->l.upvals[i]->v != v) return NULL; /* wrong upvalue; cannot reuse closure */ } } return c; /* return cached closure (or NULL if no cached closure) */ } /* ** create a new Lua closure, push it in the stack, and initialize ** its upvalues. Note that the call to 'luaC_barrierproto' must come ** before the assignment to 'p->cache', as the function needs the ** original value of that field. */ static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base, StkId ra) { int nup = p->sizeupvalues; Upvaldesc *uv = p->upvalues; int i; Closure *ncl = luaF_newLclosure(L, p); setclLvalue(L, ra, ncl); /* anchor new closure in stack */ for (i = 0; i < nup; i++) { /* fill in its upvalues */ if (uv[i].instack) /* upvalue refers to local variable? */ ncl->l.upvals[i] = luaF_findupval(L, base + uv[i].idx); else /* get upvalue from enclosing function */ ncl->l.upvals[i] = encup[uv[i].idx]; } luaC_barrierproto(L, p, ncl); p->cache = ncl; /* save it on cache for reuse */ } /* ** finish execution of an opcode interrupted by an yield */ void luaV_finishOp (lua_State *L) { CallInfo *ci = L->ci; StkId base = ci->u.l.base; Instruction inst = *(ci->u.l.savedpc - 1); /* interrupted instruction */ OpCode op = GET_OPCODE(inst); switch (op) { /* finish its execution */ case OP_ADD: case OP_SUB: case OP_MUL: case OP_DIV: case OP_MOD: case OP_POW: case OP_UNM: case OP_LEN: case OP_GETTABUP: case OP_GETTABLE: case OP_SELF: { setobjs2s(L, base + GETARG_A(inst), --L->top); break; } case OP_LE: case OP_LT: case OP_EQ: { int res = !l_isfalse(L->top - 1); L->top--; /* metamethod should not be called when operand is K */ lua_assert(!ISK(GETARG_B(inst))); if (op == OP_LE && /* "<=" using "<" instead? */ ttisnil(luaT_gettmbyobj(L, base + GETARG_B(inst), TM_LE))) res = !res; /* invert result */ lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_JMP); if (res != GETARG_A(inst)) /* condition failed? */ ci->u.l.savedpc++; /* skip jump instruction */ break; } case OP_CONCAT: { StkId top = L->top - 1; /* top when 'call_binTM' was called */ int b = GETARG_B(inst); /* first element to concatenate */ int total = cast_int(top - 1 - (base + b)); /* yet to concatenate */ setobj2s(L, top - 2, top); /* put TM result in proper position */ if (total > 1) { /* are there elements to concat? */ L->top = top - 1; /* top is one after last element (at top-2) */ luaV_concat(L, total); /* concat them (may yield again) */ } /* move final result to final position */ setobj2s(L, ci->u.l.base + GETARG_A(inst), L->top - 1); L->top = ci->top; /* restore top */ break; } case OP_TFORCALL: { lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_TFORLOOP); L->top = ci->top; /* correct top */ break; } case OP_CALL: { if (GETARG_C(inst) - 1 >= 0) /* nresults >= 0? */ L->top = ci->top; /* adjust results */ break; } case OP_TAILCALL: case OP_SETTABUP: case OP_SETTABLE: break; default: lua_assert(0); } } /* ** some macros for common tasks in `luaV_execute' */ #if !defined luai_runtimecheck #define luai_runtimecheck(L, c) /* void */ #endif #define RA(i) (base+GETARG_A(i)) /* to be used after possible stack reallocation */ #define RB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i)) #define RC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i)) #define RKB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, \ ISK(GETARG_B(i)) ? k+INDEXK(GETARG_B(i)) : base+GETARG_B(i)) #define RKC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \ ISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i)) #define KBx(i) \ (k + (GETARG_Bx(i) != 0 ? GETARG_Bx(i) - 1 : GETARG_Ax(*ci->u.l.savedpc++))) /* execute a jump instruction */ #define dojump(ci,i,e) \ { int a = GETARG_A(i); \ if (a > 0) luaF_close(L, ci->u.l.base + a - 1); \ ci->u.l.savedpc += GETARG_sBx(i) + e; } /* for test instructions, execute the jump instruction that follows it */ #define donextjump(ci) { i = *ci->u.l.savedpc; dojump(ci, i, 1); } #define Protect(x) { {x;}; base = ci->u.l.base; } #define checkGC(L,c) Protect(luaC_condGC(L, c); luai_threadyield(L);) #define arith_op(op,tm) { \ TValue *rb = RKB(i); \ TValue *rc = RKC(i); \ if (ttisnumber(rb) && ttisnumber(rc)) { \ lua_Number nb = nvalue(rb), nc = nvalue(rc); \ setnvalue(ra, op(L, nb, nc)); \ } \ else { Protect(luaV_arith(L, ra, rb, rc, tm)); } } #define vmdispatch(o) switch(o) #define vmcase(l,b) case l: {b} break; #define vmcasenb(l,b) case l: {b} /* nb = no break */ void luaV_execute (lua_State *L) { CallInfo *ci = L->ci; LClosure *cl; TValue *k; StkId base; newframe: /* reentry point when frame changes (call/return) */ lua_assert(ci == L->ci); cl = clLvalue(ci->func); k = cl->p->k; base = ci->u.l.base; /* main loop of interpreter */ for (;;) { Instruction i = *(ci->u.l.savedpc++); StkId ra; if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) && (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) { Protect(traceexec(L)); } /* WARNING: several calls may realloc the stack and invalidate `ra' */ ra = RA(i); lua_assert(base == ci->u.l.base); lua_assert(base <= L->top && L->top < L->stack + L->stacksize); vmdispatch (GET_OPCODE(i)) { vmcase(OP_MOVE, setobjs2s(L, ra, RB(i)); ) vmcase(OP_LOADK, TValue *rb = k + GETARG_Bx(i); setobj2s(L, ra, rb); ) vmcase(OP_LOADKX, TValue *rb; lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_EXTRAARG); rb = k + GETARG_Ax(*ci->u.l.savedpc++); setobj2s(L, ra, rb); ) vmcase(OP_LOADBOOL, setbvalue(ra, GETARG_B(i)); if (GETARG_C(i)) ci->u.l.savedpc++; /* skip next instruction (if C) */ ) vmcase(OP_LOADNIL, int b = GETARG_B(i); do { setnilvalue(ra++); } while (b--); ) vmcase(OP_GETUPVAL, int b = GETARG_B(i); setobj2s(L, ra, cl->upvals[b]->v); ) vmcase(OP_GETTABUP, int b = GETARG_B(i); Protect(luaV_gettable(L, cl->upvals[b]->v, RKC(i), ra)); ) vmcase(OP_GETTABLE, Protect(luaV_gettable(L, RB(i), RKC(i), ra)); ) vmcase(OP_SETTABUP, int a = GETARG_A(i); Protect(luaV_settable(L, cl->upvals[a]->v, RKB(i), RKC(i))); ) vmcase(OP_SETUPVAL, UpVal *uv = cl->upvals[GETARG_B(i)]; setobj(L, uv->v, ra); luaC_barrier(L, uv, ra); ) vmcase(OP_SETTABLE, Protect(luaV_settable(L, ra, RKB(i), RKC(i))); ) vmcase(OP_NEWTABLE, int b = GETARG_B(i); int c = GETARG_C(i); Table *t = luaH_new(L); sethvalue(L, ra, t); if (b != 0 || c != 0) luaH_resize(L, t, luaO_fb2int(b), luaO_fb2int(c)); checkGC(L, L->top = ra + 1; /* limit of live values */ luaC_step(L); L->top = ci->top; /* restore top */ ) ) vmcase(OP_SELF, StkId rb = RB(i); setobjs2s(L, ra+1, rb); Protect(luaV_gettable(L, rb, RKC(i), ra)); ) vmcase(OP_ADD, arith_op(luai_numadd, TM_ADD); ) vmcase(OP_SUB, arith_op(luai_numsub, TM_SUB); ) vmcase(OP_MUL, arith_op(luai_nummul, TM_MUL); ) vmcase(OP_DIV, arith_op(luai_numdiv, TM_DIV); ) vmcase(OP_MOD, arith_op(luai_nummod, TM_MOD); ) vmcase(OP_POW, arith_op(luai_numpow, TM_POW); ) vmcase(OP_UNM, TValue *rb = RB(i); if (ttisnumber(rb)) { lua_Number nb = nvalue(rb); setnvalue(ra, luai_numunm(L, nb)); } else { Protect(luaV_arith(L, ra, rb, rb, TM_UNM)); } ) vmcase(OP_NOT, TValue *rb = RB(i); int res = l_isfalse(rb); /* next assignment may change this value */ setbvalue(ra, res); ) vmcase(OP_LEN, Protect(luaV_objlen(L, ra, RB(i))); ) vmcase(OP_CONCAT, int b = GETARG_B(i); int c = GETARG_C(i); StkId rb; L->top = base + c + 1; /* mark the end of concat operands */ Protect(luaV_concat(L, c - b + 1)); ra = RA(i); /* 'luav_concat' may invoke TMs and move the stack */ rb = b + base; setobjs2s(L, ra, rb); checkGC(L, L->top = (ra >= rb ? ra + 1 : rb); /* limit of live values */ luaC_step(L); ) L->top = ci->top; /* restore top */ ) vmcase(OP_JMP, dojump(ci, i, 0); ) vmcase(OP_EQ, TValue *rb = RKB(i); TValue *rc = RKC(i); Protect( if (cast_int(equalobj(L, rb, rc)) != GETARG_A(i)) ci->u.l.savedpc++; else donextjump(ci); ) ) vmcase(OP_LT, Protect( if (luaV_lessthan(L, RKB(i), RKC(i)) != GETARG_A(i)) ci->u.l.savedpc++; else donextjump(ci); ) ) vmcase(OP_LE, Protect( if (luaV_lessequal(L, RKB(i), RKC(i)) != GETARG_A(i)) ci->u.l.savedpc++; else donextjump(ci); ) ) vmcase(OP_TEST, if (GETARG_C(i) ? l_isfalse(ra) : !l_isfalse(ra)) ci->u.l.savedpc++; else donextjump(ci); ) vmcase(OP_TESTSET, TValue *rb = RB(i); if (GETARG_C(i) ? l_isfalse(rb) : !l_isfalse(rb)) ci->u.l.savedpc++; else { setobjs2s(L, ra, rb); donextjump(ci); } ) vmcase(OP_CALL, int b = GETARG_B(i); int nresults = GETARG_C(i) - 1; if (b != 0) L->top = ra+b; /* else previous instruction set top */ if (luaD_precall(L, ra, nresults)) { /* C function? */ if (nresults >= 0) L->top = ci->top; /* adjust results */ base = ci->u.l.base; } else { /* Lua function */ ci = L->ci; ci->callstatus |= CIST_REENTRY; goto newframe; /* restart luaV_execute over new Lua function */ } ) vmcase(OP_TAILCALL, int b = GETARG_B(i); if (b != 0) L->top = ra+b; /* else previous instruction set top */ lua_assert(GETARG_C(i) - 1 == LUA_MULTRET); if (luaD_precall(L, ra, LUA_MULTRET)) /* C function? */ base = ci->u.l.base; else { /* tail call: put called frame (n) in place of caller one (o) */ CallInfo *nci = L->ci; /* called frame */ CallInfo *oci = nci->previous; /* caller frame */ StkId nfunc = nci->func; /* called function */ StkId ofunc = oci->func; /* caller function */ /* last stack slot filled by 'precall' */ StkId lim = nci->u.l.base + getproto(nfunc)->numparams; int aux; /* close all upvalues from previous call */ if (cl->p->sizep > 0) luaF_close(L, oci->u.l.base); /* move new frame into old one */ for (aux = 0; nfunc + aux < lim; aux++) setobjs2s(L, ofunc + aux, nfunc + aux); oci->u.l.base = ofunc + (nci->u.l.base - nfunc); /* correct base */ oci->top = L->top = ofunc + (L->top - nfunc); /* correct top */ oci->u.l.savedpc = nci->u.l.savedpc; oci->callstatus |= CIST_TAIL; /* function was tail called */ ci = L->ci = oci; /* remove new frame */ lua_assert(L->top == oci->u.l.base + getproto(ofunc)->maxstacksize); goto newframe; /* restart luaV_execute over new Lua function */ } ) vmcasenb(OP_RETURN, int b = GETARG_B(i); if (b != 0) L->top = ra+b-1; if (cl->p->sizep > 0) luaF_close(L, base); b = luaD_poscall(L, ra); if (!(ci->callstatus & CIST_REENTRY)) /* 'ci' still the called one */ return; /* external invocation: return */ else { /* invocation via reentry: continue execution */ ci = L->ci; if (b) L->top = ci->top; lua_assert(isLua(ci)); lua_assert(GET_OPCODE(*((ci)->u.l.savedpc - 1)) == OP_CALL); goto newframe; /* restart luaV_execute over new Lua function */ } ) vmcase(OP_FORLOOP, lua_Number step = nvalue(ra+2); lua_Number idx = luai_numadd(L, nvalue(ra), step); /* increment index */ lua_Number limit = nvalue(ra+1); if (luai_numlt(L, 0, step) ? luai_numle(L, idx, limit) : luai_numle(L, limit, idx)) { ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ setnvalue(ra, idx); /* update internal index... */ setnvalue(ra+3, idx); /* ...and external index */ } ) vmcase(OP_FORPREP, const TValue *init = ra; const TValue *plimit = ra+1; const TValue *pstep = ra+2; if (!tonumber(init, ra)) luaG_runerror(L, LUA_QL("for") " initial value must be a number"); else if (!tonumber(plimit, ra+1)) luaG_runerror(L, LUA_QL("for") " limit must be a number"); else if (!tonumber(pstep, ra+2)) luaG_runerror(L, LUA_QL("for") " step must be a number"); setnvalue(ra, luai_numsub(L, nvalue(ra), nvalue(pstep))); ci->u.l.savedpc += GETARG_sBx(i); ) vmcasenb(OP_TFORCALL, StkId cb = ra + 3; /* call base */ setobjs2s(L, cb+2, ra+2); setobjs2s(L, cb+1, ra+1); setobjs2s(L, cb, ra); L->top = cb + 3; /* func. + 2 args (state and index) */ Protect(luaD_call(L, cb, GETARG_C(i), 1)); L->top = ci->top; i = *(ci->u.l.savedpc++); /* go to next instruction */ ra = RA(i); lua_assert(GET_OPCODE(i) == OP_TFORLOOP); goto l_tforloop; ) vmcase(OP_TFORLOOP, l_tforloop: if (!ttisnil(ra + 1)) { /* continue loop? */ setobjs2s(L, ra, ra + 1); /* save control variable */ ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ } ) vmcase(OP_SETLIST, int n = GETARG_B(i); int c = GETARG_C(i); int last; Table *h; if (n == 0) n = cast_int(L->top - ra) - 1; if (c == 0) { lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_EXTRAARG); c = GETARG_Ax(*ci->u.l.savedpc++); } luai_runtimecheck(L, ttistable(ra)); h = hvalue(ra); last = ((c-1)*LFIELDS_PER_FLUSH) + n; if (last > h->sizearray) /* needs more space? */ luaH_resizearray(L, h, last); /* pre-allocate it at once */ for (; n > 0; n--) { TValue *val = ra+n; luaH_setint(L, h, last--, val); luaC_barrierback(L, obj2gco(h), val); } L->top = ci->top; /* correct top (in case of previous open call) */ ) vmcase(OP_CLOSURE, Proto *p = cl->p->p[GETARG_Bx(i)]; Closure *ncl = getcached(p, cl->upvals, base); /* cached closure */ if (ncl == NULL) /* no match? */ pushclosure(L, p, cl->upvals, base, ra); /* create a new one */ else setclLvalue(L, ra, ncl); /* push cashed closure */ checkGC(L, L->top = ra + 1; /* limit of live values */ luaC_step(L); L->top = ci->top; /* restore top */ ) ) vmcase(OP_VARARG, int b = GETARG_B(i) - 1; int j; int n = cast_int(base - ci->func) - cl->p->numparams - 1; if (b < 0) { /* B == 0? */ b = n; /* get all var. arguments */ Protect(luaD_checkstack(L, n)); ra = RA(i); /* previous call may change the stack */ L->top = ra + n; } for (j = 0; j < b; j++) { if (j < n) { setobjs2s(L, ra + j, base - n + j); } else { setnilvalue(ra + j); } } ) vmcase(OP_EXTRAARG, lua_assert(0); ) } } } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/linit.cpp0000644000175000017500000000322512320456500020343 0ustar mathieumathieu/* ** $Id: linit.c,v 1.32 2011/04/08 19:17:36 roberto Exp $ ** Initialization of libraries for lua.c and other clients ** See Copyright Notice in lua.h */ /* ** If you embed Lua in your program and need to open the standard ** libraries, call luaL_openlibs in your program. If you need a ** different set of libraries, copy this file to your project and edit ** it to suit your needs. */ #define linit_c #define LUA_LIB #include "lua.h" #include "lualib.h" #include "lauxlib.h" /* ** these libs are loaded by lua.c and are readily available to any Lua ** program */ static const luaL_Reg loadedlibs[] = { {"_G", luaopen_base}, {LUA_LOADLIBNAME, luaopen_package}, {LUA_COLIBNAME, luaopen_coroutine}, {LUA_TABLIBNAME, luaopen_table}, {LUA_IOLIBNAME, luaopen_io}, {LUA_OSLIBNAME, luaopen_os}, {LUA_STRLIBNAME, luaopen_string}, {LUA_BITLIBNAME, luaopen_bit32}, {LUA_MATHLIBNAME, luaopen_math}, {LUA_DBLIBNAME, luaopen_debug}, {NULL, NULL} }; /* ** these libs are preloaded and must be required before used */ static const luaL_Reg preloadedlibs[] = { {NULL, NULL} }; LUALIB_API void luaL_openlibs (lua_State *L) { const luaL_Reg *lib; /* call open functions from 'loadedlibs' and set results to global table */ for (lib = loadedlibs; lib->func; lib++) { luaL_requiref(L, lib->name, lib->func, 1); lua_pop(L, 1); /* remove lib */ } /* add open functions from 'preloadedlibs' into 'package.preload' table */ luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD"); for (lib = preloadedlibs; lib->func; lib++) { lua_pushcfunction(L, lib->func); lua_setfield(L, -2, lib->name); } lua_pop(L, 1); /* remove _PRELOAD table */ } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/ltable.cpp0000644000175000017500000003744212320456500020477 0ustar mathieumathieu/* ** $Id: ltable.c,v 2.67 2011/11/30 12:41:45 roberto Exp $ ** Lua tables (hash) ** See Copyright Notice in lua.h */ /* ** Implementation of tables (aka arrays, objects, or hash tables). ** Tables keep its elements in two parts: an array part and a hash part. ** Non-negative integer keys are all candidates to be kept in the array ** part. The actual size of the array is the largest `n' such that at ** least half the slots between 0 and n are in use. ** Hash uses a mix of chained scatter table with Brent's variation. ** A main invariant of these tables is that, if an element is not ** in its main position (i.e. the `original' position that its hash gives ** to it), then the colliding element is in its own main position. ** Hence even when the load factor reaches 100%, performance remains good. */ #include #define ltable_c #define LUA_CORE #include "lua.h" #include "ldebug.h" #include "ldo.h" #include "lgc.h" #include "lmem.h" #include "lobject.h" #include "lstate.h" #include "lstring.h" #include "ltable.h" #include "lvm.h" /* ** max size of array part is 2^MAXBITS */ #if LUAI_BITSINT >= 32 #define MAXBITS 30 #else #define MAXBITS (LUAI_BITSINT-2) #endif #define MAXASIZE (1 << MAXBITS) #define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t)))) #define hashstr(t,str) hashpow2(t, (str)->tsv.hash) #define hashboolean(t,p) hashpow2(t, p) /* ** for some types, it is better to avoid modulus by power of 2, as ** they tend to have many 2 factors. */ #define hashmod(t,n) (gnode(t, ((n) % ((sizenode(t)-1)|1)))) #define hashpointer(t,p) hashmod(t, IntPoint(p)) #define dummynode (&dummynode_) #define isdummy(n) ((n) == dummynode) static const Node dummynode_ = { {NILCONSTANT}, /* value */ {{NILCONSTANT, NULL}} /* key */ }; /* ** hash for lua_Numbers */ static Node *hashnum (const Table *t, lua_Number n) { int i; luai_hashnum(i, n); if (i < 0) { if (cast(unsigned int, i) == 0u - i) /* use unsigned to avoid overflows */ i = 0; /* handle INT_MIN */ i = -i; /* must be a positive value */ } return hashmod(t, i); } /* ** returns the `main' position of an element in a table (that is, the index ** of its hash value) */ static Node *mainposition (const Table *t, const TValue *key) { switch (ttype(key)) { case LUA_TNUMBER: return hashnum(t, nvalue(key)); case LUA_TSTRING: return hashstr(t, rawtsvalue(key)); case LUA_TBOOLEAN: return hashboolean(t, bvalue(key)); case LUA_TLIGHTUSERDATA: return hashpointer(t, pvalue(key)); case LUA_TLCF: return hashpointer(t, fvalue(key)); default: return hashpointer(t, gcvalue(key)); } } /* ** returns the index for `key' if `key' is an appropriate key to live in ** the array part of the table, -1 otherwise. */ static int arrayindex (const TValue *key) { if (ttisnumber(key)) { lua_Number n = nvalue(key); int k; lua_number2int(k, n); if (luai_numeq(cast_num(k), n)) return k; } return -1; /* `key' did not match some condition */ } /* ** returns the index of a `key' for table traversals. First goes all ** elements in the array part, then elements in the hash part. The ** beginning of a traversal is signaled by -1. */ static int findindex (lua_State *L, Table *t, StkId key) { int i; if (ttisnil(key)) return -1; /* first iteration */ i = arrayindex(key); if (0 < i && i <= t->sizearray) /* is `key' inside array part? */ return i-1; /* yes; that's the index (corrected to C) */ else { Node *n = mainposition(t, key); for (;;) { /* check whether `key' is somewhere in the chain */ /* key may be dead already, but it is ok to use it in `next' */ if (luaV_rawequalobj(gkey(n), key) || (ttisdeadkey(gkey(n)) && iscollectable(key) && deadvalue(gkey(n)) == gcvalue(key))) { i = cast_int(n - gnode(t, 0)); /* key index in hash table */ /* hash elements are numbered after array ones */ return i + t->sizearray; } else n = gnext(n); if (n == NULL) luaG_runerror(L, "invalid key to " LUA_QL("next")); /* key not found */ } } } int luaH_next (lua_State *L, Table *t, StkId key) { int i = findindex(L, t, key); /* find original element */ for (i++; i < t->sizearray; i++) { /* try first array part */ if (!ttisnil(&t->array[i])) { /* a non-nil value? */ setnvalue(key, cast_num(i+1)); setobj2s(L, key+1, &t->array[i]); return 1; } } for (i -= t->sizearray; i < sizenode(t); i++) { /* then hash part */ if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */ setobj2s(L, key, gkey(gnode(t, i))); setobj2s(L, key+1, gval(gnode(t, i))); return 1; } } return 0; /* no more elements */ } /* ** {============================================================= ** Rehash ** ============================================================== */ static int computesizes (int nums[], int *narray) { int i; int twotoi; /* 2^i */ int a = 0; /* number of elements smaller than 2^i */ int na = 0; /* number of elements to go to array part */ int n = 0; /* optimal size for array part */ for (i = 0, twotoi = 1; twotoi/2 < *narray; i++, twotoi *= 2) { if (nums[i] > 0) { a += nums[i]; if (a > twotoi/2) { /* more than half elements present? */ n = twotoi; /* optimal size (till now) */ na = a; /* all elements smaller than n will go to array part */ } } if (a == *narray) break; /* all elements already counted */ } *narray = n; lua_assert(*narray/2 <= na && na <= *narray); return na; } static int countint (const TValue *key, int *nums) { int k = arrayindex(key); if (0 < k && k <= MAXASIZE) { /* is `key' an appropriate array index? */ nums[luaO_ceillog2(k)]++; /* count as such */ return 1; } else return 0; } static int numusearray (const Table *t, int *nums) { int lg; int ttlg; /* 2^lg */ int ause = 0; /* summation of `nums' */ int i = 1; /* count to traverse all array keys */ for (lg=0, ttlg=1; lg<=MAXBITS; lg++, ttlg*=2) { /* for each slice */ int lc = 0; /* counter */ int lim = ttlg; if (lim > t->sizearray) { lim = t->sizearray; /* adjust upper limit */ if (i > lim) break; /* no more elements to count */ } /* count elements in range (2^(lg-1), 2^lg] */ for (; i <= lim; i++) { if (!ttisnil(&t->array[i-1])) lc++; } nums[lg] += lc; ause += lc; } return ause; } static int numusehash (const Table *t, int *nums, int *pnasize) { int totaluse = 0; /* total number of elements */ int ause = 0; /* summation of `nums' */ int i = sizenode(t); while (i--) { Node *n = &t->node[i]; if (!ttisnil(gval(n))) { ause += countint(gkey(n), nums); totaluse++; } } *pnasize += ause; return totaluse; } static void setarrayvector (lua_State *L, Table *t, int size) { int i; luaM_reallocvector(L, t->array, t->sizearray, size, TValue); for (i=t->sizearray; iarray[i]); t->sizearray = size; } static void setnodevector (lua_State *L, Table *t, int size) { int lsize; if (size == 0) { /* no elements to hash part? */ t->node = cast(Node *, dummynode); /* use common `dummynode' */ lsize = 0; } else { int i; lsize = luaO_ceillog2(size); if (lsize > MAXBITS) luaG_runerror(L, "table overflow"); size = twoto(lsize); t->node = luaM_newvector(L, size, Node); for (i=0; ilsizenode = cast_byte(lsize); t->lastfree = gnode(t, size); /* all positions are free */ } void luaH_resize (lua_State *L, Table *t, int nasize, int nhsize) { int i; int oldasize = t->sizearray; int oldhsize = t->lsizenode; Node *nold = t->node; /* save old hash ... */ if (nasize > oldasize) /* array part must grow? */ setarrayvector(L, t, nasize); /* create new hash part with appropriate size */ setnodevector(L, t, nhsize); if (nasize < oldasize) { /* array part must shrink? */ t->sizearray = nasize; /* re-insert elements from vanishing slice */ for (i=nasize; iarray[i])) luaH_setint(L, t, i + 1, &t->array[i]); } /* shrink array */ luaM_reallocvector(L, t->array, oldasize, nasize, TValue); } /* re-insert elements from hash part */ for (i = twoto(oldhsize) - 1; i >= 0; i--) { Node *old = nold+i; if (!ttisnil(gval(old))) { /* doesn't need barrier/invalidate cache, as entry was already present in the table */ setobjt2t(L, luaH_set(L, t, gkey(old)), gval(old)); } } if (!isdummy(nold)) luaM_freearray(L, nold, cast(size_t, twoto(oldhsize))); /* free old array */ } void luaH_resizearray (lua_State *L, Table *t, int nasize) { int nsize = isdummy(t->node) ? 0 : sizenode(t); luaH_resize(L, t, nasize, nsize); } static void rehash (lua_State *L, Table *t, const TValue *ek) { int nasize, na; int nums[MAXBITS+1]; /* nums[i] = number of keys with 2^(i-1) < k <= 2^i */ int i; int totaluse; for (i=0; i<=MAXBITS; i++) nums[i] = 0; /* reset counts */ nasize = numusearray(t, nums); /* count keys in array part */ totaluse = nasize; /* all those keys are integer keys */ totaluse += numusehash(t, nums, &nasize); /* count keys in hash part */ /* count extra key */ nasize += countint(ek, nums); totaluse++; /* compute new size for array part */ na = computesizes(nums, &nasize); /* resize the table to new computed sizes */ luaH_resize(L, t, nasize, totaluse - na); } /* ** }============================================================= */ Table *luaH_new (lua_State *L) { Table *t = &luaC_newobj(L, LUA_TTABLE, sizeof(Table), NULL, 0)->h; t->metatable = NULL; t->flags = cast_byte(~0); t->array = NULL; t->sizearray = 0; setnodevector(L, t, 0); return t; } void luaH_free (lua_State *L, Table *t) { if (!isdummy(t->node)) luaM_freearray(L, t->node, cast(size_t, sizenode(t))); luaM_freearray(L, t->array, t->sizearray); luaM_free(L, t); } static Node *getfreepos (Table *t) { while (t->lastfree > t->node) { t->lastfree--; if (ttisnil(gkey(t->lastfree))) return t->lastfree; } return NULL; /* could not find a free place */ } /* ** inserts a new key into a hash table; first, check whether key's main ** position is free. If not, check whether colliding node is in its main ** position or not: if it is not, move colliding node to an empty place and ** put new key in its main position; otherwise (colliding node is in its main ** position), new key goes to an empty position. */ TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) { Node *mp; if (ttisnil(key)) luaG_runerror(L, "table index is nil"); else if (ttisnumber(key) && luai_numisnan(L, nvalue(key))) luaG_runerror(L, "table index is NaN"); mp = mainposition(t, key); if (!ttisnil(gval(mp)) || isdummy(mp)) { /* main position is taken? */ Node *othern; Node *n = getfreepos(t); /* get a free place */ if (n == NULL) { /* cannot find a free place? */ rehash(L, t, key); /* grow table */ /* whatever called 'newkey' take care of TM cache and GC barrier */ return luaH_set(L, t, key); /* insert key into grown table */ } lua_assert(!isdummy(n)); othern = mainposition(t, gkey(mp)); if (othern != mp) { /* is colliding node out of its main position? */ /* yes; move colliding node into free position */ while (gnext(othern) != mp) othern = gnext(othern); /* find previous */ gnext(othern) = n; /* redo the chain with `n' in place of `mp' */ *n = *mp; /* copy colliding node into free pos. (mp->next also goes) */ gnext(mp) = NULL; /* now `mp' is free */ setnilvalue(gval(mp)); } else { /* colliding node is in its own main position */ /* new node will go into free position */ gnext(n) = gnext(mp); /* chain new position */ gnext(mp) = n; mp = n; } } setobj2t(L, gkey(mp), key); luaC_barrierback(L, obj2gco(t), key); lua_assert(ttisnil(gval(mp))); return gval(mp); } /* ** search function for integers */ const TValue *luaH_getint (Table *t, int key) { /* (1 <= key && key <= t->sizearray) */ if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray)) return &t->array[key-1]; else { lua_Number nk = cast_num(key); Node *n = hashnum(t, nk); do { /* check whether `key' is somewhere in the chain */ if (ttisnumber(gkey(n)) && luai_numeq(nvalue(gkey(n)), nk)) return gval(n); /* that's it */ else n = gnext(n); } while (n); return luaO_nilobject; } } /* ** search function for strings */ const TValue *luaH_getstr (Table *t, TString *key) { Node *n = hashstr(t, key); do { /* check whether `key' is somewhere in the chain */ if (ttisstring(gkey(n)) && eqstr(rawtsvalue(gkey(n)), key)) return gval(n); /* that's it */ else n = gnext(n); } while (n); return luaO_nilobject; } /* ** main search function */ const TValue *luaH_get (Table *t, const TValue *key) { switch (ttypenv(key)) { case LUA_TNIL: return luaO_nilobject; case LUA_TSTRING: return luaH_getstr(t, rawtsvalue(key)); case LUA_TNUMBER: { int k; lua_Number n = nvalue(key); lua_number2int(k, n); if (luai_numeq(cast_num(k), nvalue(key))) /* index is int? */ return luaH_getint(t, k); /* use specialized version */ /* else go through */ } default: { Node *n = mainposition(t, key); do { /* check whether `key' is somewhere in the chain */ if (luaV_rawequalobj(gkey(n), key)) return gval(n); /* that's it */ else n = gnext(n); } while (n); return luaO_nilobject; } } } /* ** beware: when using this function you probably need to check a GC ** barrier and invalidate the TM cache. */ TValue *luaH_set (lua_State *L, Table *t, const TValue *key) { const TValue *p = luaH_get(t, key); if (p != luaO_nilobject) return cast(TValue *, p); else return luaH_newkey(L, t, key); } void luaH_setint (lua_State *L, Table *t, int key, TValue *value) { const TValue *p = luaH_getint(t, key); TValue *cell; if (p != luaO_nilobject) cell = cast(TValue *, p); else { TValue k; setnvalue(&k, cast_num(key)); cell = luaH_newkey(L, t, &k); } setobj2t(L, cell, value); } static int unbound_search (Table *t, unsigned int j) { unsigned int i = j; /* i is zero or a present index */ j++; /* find `i' and `j' such that i is present and j is not */ while (!ttisnil(luaH_getint(t, j))) { i = j; j *= 2; if (j > cast(unsigned int, MAX_INT)) { /* overflow? */ /* table was built with bad purposes: resort to linear search */ i = 1; while (!ttisnil(luaH_getint(t, i))) i++; return i - 1; } } /* now do a binary search between them */ while (j - i > 1) { unsigned int m = (i+j)/2; if (ttisnil(luaH_getint(t, m))) j = m; else i = m; } return i; } /* ** Try to find a boundary in table `t'. A `boundary' is an integer index ** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil). */ int luaH_getn (Table *t) { unsigned int j = t->sizearray; if (j > 0 && ttisnil(&t->array[j - 1])) { /* there is a boundary in the array part: (binary) search for it */ unsigned int i = 0; while (j - i > 1) { unsigned int m = (i+j)/2; if (ttisnil(&t->array[m - 1])) j = m; else i = m; } return i; } /* else must find a boundary in hash part */ else if (isdummy(t->node)) /* hash part is empty? */ return j; /* that is easy... */ else return unbound_search(t, j); } #if defined(LUA_DEBUG) Node *luaH_mainposition (const Table *t, const TValue *key) { return mainposition(t, key); } int luaH_isdummy (Node *n) { return isdummy(n); } #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/llex.cpp0000644000175000017500000003474412320456500020202 0ustar mathieumathieu/* ** $Id: llex.c,v 2.59 2011/11/30 12:43:51 roberto Exp $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ #include #include #define llex_c #define LUA_CORE #include "lua.h" #include "lctype.h" #include "ldo.h" #include "llex.h" #include "lobject.h" #include "lparser.h" #include "lstate.h" #include "lstring.h" #include "ltable.h" #include "lzio.h" #define next(ls) (ls->current = zgetc(ls->z)) #define currIsNewline(ls) (ls->current == '\n' || ls->current == '\r') /* ORDER RESERVED */ static const char *const luaX_tokens [] = { "and", "break", "do", "else", "elseif", "end", "false", "for", "function", "goto", "if", "in", "local", "nil", "not", "or", "repeat", "return", "then", "true", "until", "while", "..", "...", "==", ">=", "<=", "~=", "::", "", "", "", "" }; #define save_and_next(ls) (save(ls, ls->current), next(ls)) static l_noret lexerror (LexState *ls, const char *msg, int token); static void save (LexState *ls, int c) { Mbuffer *b = ls->buff; if (luaZ_bufflen(b) + 1 > luaZ_sizebuffer(b)) { size_t newsize; if (luaZ_sizebuffer(b) >= MAX_SIZET/2) lexerror(ls, "lexical element too long", 0); newsize = luaZ_sizebuffer(b) * 2; luaZ_resizebuffer(ls->L, b, newsize); } b->buffer[luaZ_bufflen(b)++] = cast(char, c); } void luaX_init (lua_State *L) { int i; for (i=0; itsv.reserved = cast_byte(i+1); /* reserved word */ } } const char *luaX_token2str (LexState *ls, int token) { if (token < FIRST_RESERVED) { lua_assert(token == cast(unsigned char, token)); return (lisprint(token)) ? luaO_pushfstring(ls->L, LUA_QL("%c"), token) : luaO_pushfstring(ls->L, "char(%d)", token); } else { const char *s = luaX_tokens[token - FIRST_RESERVED]; if (token < TK_EOS) return luaO_pushfstring(ls->L, LUA_QS, s); else return s; } } static const char *txtToken (LexState *ls, int token) { switch (token) { case TK_NAME: case TK_STRING: case TK_NUMBER: save(ls, '\0'); return luaO_pushfstring(ls->L, LUA_QS, luaZ_buffer(ls->buff)); default: return luaX_token2str(ls, token); } } static l_noret lexerror (LexState *ls, const char *msg, int token) { char buff[LUA_IDSIZE]; luaO_chunkid(buff, getstr(ls->source), LUA_IDSIZE); msg = luaO_pushfstring(ls->L, "%s:%d: %s", buff, ls->linenumber, msg); if (token) luaO_pushfstring(ls->L, "%s near %s", msg, txtToken(ls, token)); luaD_throw(ls->L, LUA_ERRSYNTAX); } l_noret luaX_syntaxerror (LexState *ls, const char *msg) { lexerror(ls, msg, ls->t.token); } /* ** creates a new string and anchors it in function's table so that ** it will not be collected until the end of the function's compilation ** (by that time it should be anchored in function's prototype) */ TString *luaX_newstring (LexState *ls, const char *str, size_t l) { lua_State *L = ls->L; TValue *o; /* entry for `str' */ TString *ts = luaS_newlstr(L, str, l); /* create new string */ setsvalue2s(L, L->top++, ts); /* temporarily anchor it in stack */ o = luaH_set(L, ls->fs->h, L->top - 1); if (ttisnil(o)) { /* not in use yet? (see 'addK') */ /* boolean value does not need GC barrier; table has no metatable, so it does not need to invalidate cache */ setbvalue(o, 1); /* t[string] = true */ luaC_checkGC(L); } L->top--; /* remove string from stack */ return ts; } /* ** increment line number and skips newline sequence (any of ** \n, \r, \n\r, or \r\n) */ static void inclinenumber (LexState *ls) { int old = ls->current; lua_assert(currIsNewline(ls)); next(ls); /* skip `\n' or `\r' */ if (currIsNewline(ls) && ls->current != old) next(ls); /* skip `\n\r' or `\r\n' */ if (++ls->linenumber >= MAX_INT) luaX_syntaxerror(ls, "chunk has too many lines"); } void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source, int firstchar) { ls->decpoint = '.'; ls->L = L; ls->current = firstchar; ls->lookahead.token = TK_EOS; /* no look-ahead token */ ls->z = z; ls->fs = NULL; ls->linenumber = 1; ls->lastline = 1; ls->source = source; ls->envn = luaS_new(L, LUA_ENV); /* create env name */ luaS_fix(ls->envn); /* never collect this name */ luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */ } /* ** ======================================================= ** LEXICAL ANALYZER ** ======================================================= */ static int check_next (LexState *ls, const char *set) { if (ls->current == '\0' || !strchr(set, ls->current)) return 0; save_and_next(ls); return 1; } /* ** change all characters 'from' in buffer to 'to' */ static void buffreplace (LexState *ls, char from, char to) { size_t n = luaZ_bufflen(ls->buff); char *p = luaZ_buffer(ls->buff); while (n--) if (p[n] == from) p[n] = to; } #if !defined(getlocaledecpoint) #define getlocaledecpoint() (localeconv()->decimal_point[0]) #endif #define buff2d(b,e) luaO_str2d(luaZ_buffer(b), luaZ_bufflen(b) - 1, e) /* ** in case of format error, try to change decimal point separator to ** the one defined in the current locale and check again */ static void trydecpoint (LexState *ls, SemInfo *seminfo) { char old = ls->decpoint; ls->decpoint = getlocaledecpoint(); buffreplace(ls, old, ls->decpoint); /* try new decimal separator */ if (!buff2d(ls->buff, &seminfo->r)) { /* format error with correct decimal point: no more options */ buffreplace(ls, ls->decpoint, '.'); /* undo change (for error message) */ lexerror(ls, "malformed number", TK_NUMBER); } } /* LUA_NUMBER */ static void read_numeral (LexState *ls, SemInfo *seminfo) { lua_assert(lisdigit(ls->current)); do { save_and_next(ls); if (check_next(ls, "EePp")) /* exponent part? */ check_next(ls, "+-"); /* optional exponent sign */ } while (lislalnum(ls->current) || ls->current == '.'); save(ls, '\0'); buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */ if (!buff2d(ls->buff, &seminfo->r)) /* format error? */ trydecpoint(ls, seminfo); /* try to update decimal point separator */ } /* ** skip a sequence '[=*[' or ']=*]' and return its number of '='s or ** -1 if sequence is malformed */ static int skip_sep (LexState *ls) { int count = 0; int s = ls->current; lua_assert(s == '[' || s == ']'); save_and_next(ls); while (ls->current == '=') { save_and_next(ls); count++; } return (ls->current == s) ? count : (-count) - 1; } static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { save_and_next(ls); /* skip 2nd `[' */ if (currIsNewline(ls)) /* string starts with a newline? */ inclinenumber(ls); /* skip it */ for (;;) { switch (ls->current) { case EOZ: lexerror(ls, (seminfo) ? "unfinished long string" : "unfinished long comment", TK_EOS); break; /* to avoid warnings */ case ']': { if (skip_sep(ls) == sep) { save_and_next(ls); /* skip 2nd `]' */ goto endloop; } break; } case '\n': case '\r': { save(ls, '\n'); inclinenumber(ls); if (!seminfo) luaZ_resetbuffer(ls->buff); /* avoid wasting space */ break; } default: { if (seminfo) save_and_next(ls); else next(ls); } } } endloop: if (seminfo) seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep), luaZ_bufflen(ls->buff) - 2*(2 + sep)); } static void escerror (LexState *ls, int *c, int n, const char *msg) { int i; luaZ_resetbuffer(ls->buff); /* prepare error message */ save(ls, '\\'); for (i = 0; i < n && c[i] != EOZ; i++) save(ls, c[i]); lexerror(ls, msg, TK_STRING); } static int readhexaesc (LexState *ls) { int c[3], i; /* keep input for error message */ int r = 0; /* result accumulator */ c[0] = 'x'; /* for error message */ for (i = 1; i < 3; i++) { /* read two hexa digits */ c[i] = next(ls); if (!lisxdigit(c[i])) escerror(ls, c, i + 1, "hexadecimal digit expected"); r = (r << 4) + luaO_hexavalue(c[i]); } return r; } static int readdecesc (LexState *ls) { int c[3], i; int r = 0; /* result accumulator */ for (i = 0; i < 3 && lisdigit(ls->current); i++) { /* read up to 3 digits */ c[i] = ls->current; r = 10*r + c[i] - '0'; next(ls); } if (r > UCHAR_MAX) escerror(ls, c, i, "decimal escape too large"); return r; } static void read_string (LexState *ls, int del, SemInfo *seminfo) { save_and_next(ls); /* keep delimiter (for error messages) */ while (ls->current != del) { switch (ls->current) { case EOZ: lexerror(ls, "unfinished string", TK_EOS); break; /* to avoid warnings */ case '\n': case '\r': lexerror(ls, "unfinished string", TK_STRING); break; /* to avoid warnings */ case '\\': { /* escape sequences */ int c; /* final character to be saved */ next(ls); /* do not save the `\' */ switch (ls->current) { case 'a': c = '\a'; goto read_save; case 'b': c = '\b'; goto read_save; case 'f': c = '\f'; goto read_save; case 'n': c = '\n'; goto read_save; case 'r': c = '\r'; goto read_save; case 't': c = '\t'; goto read_save; case 'v': c = '\v'; goto read_save; case 'x': c = readhexaesc(ls); goto read_save; case '\n': case '\r': inclinenumber(ls); c = '\n'; goto only_save; case '\\': case '\"': case '\'': c = ls->current; goto read_save; case EOZ: goto no_save; /* will raise an error next loop */ case 'z': { /* zap following span of spaces */ next(ls); /* skip the 'z' */ while (lisspace(ls->current)) { if (currIsNewline(ls)) inclinenumber(ls); else next(ls); } goto no_save; } default: { if (!lisdigit(ls->current)) escerror(ls, &ls->current, 1, "invalid escape sequence"); /* digital escape \ddd */ c = readdecesc(ls); goto only_save; } } read_save: next(ls); /* read next character */ only_save: save(ls, c); /* save 'c' */ no_save: break; } default: save_and_next(ls); } } save_and_next(ls); /* skip delimiter */ seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1, luaZ_bufflen(ls->buff) - 2); } static int llex (LexState *ls, SemInfo *seminfo) { luaZ_resetbuffer(ls->buff); for (;;) { switch (ls->current) { case '\n': case '\r': { /* line breaks */ inclinenumber(ls); break; } case ' ': case '\f': case '\t': case '\v': { /* spaces */ next(ls); break; } case '-': { /* '-' or '--' (comment) */ next(ls); if (ls->current != '-') return '-'; /* else is a comment */ next(ls); if (ls->current == '[') { /* long comment? */ int sep = skip_sep(ls); luaZ_resetbuffer(ls->buff); /* `skip_sep' may dirty the buffer */ if (sep >= 0) { read_long_string(ls, NULL, sep); /* skip long comment */ luaZ_resetbuffer(ls->buff); /* previous call may dirty the buff. */ break; } } /* else short comment */ while (!currIsNewline(ls) && ls->current != EOZ) next(ls); /* skip until end of line (or end of file) */ break; } case '[': { /* long string or simply '[' */ int sep = skip_sep(ls); if (sep >= 0) { read_long_string(ls, seminfo, sep); return TK_STRING; } else if (sep == -1) return '['; else lexerror(ls, "invalid long string delimiter", TK_STRING); } case '=': { next(ls); if (ls->current != '=') return '='; else { next(ls); return TK_EQ; } } case '<': { next(ls); if (ls->current != '=') return '<'; else { next(ls); return TK_LE; } } case '>': { next(ls); if (ls->current != '=') return '>'; else { next(ls); return TK_GE; } } case '~': { next(ls); if (ls->current != '=') return '~'; else { next(ls); return TK_NE; } } case ':': { next(ls); if (ls->current != ':') return ':'; else { next(ls); return TK_DBCOLON; } } case '"': case '\'': { /* short literal strings */ read_string(ls, ls->current, seminfo); return TK_STRING; } case '.': { /* '.', '..', '...', or number */ save_and_next(ls); if (check_next(ls, ".")) { if (check_next(ls, ".")) return TK_DOTS; /* '...' */ else return TK_CONCAT; /* '..' */ } else if (!lisdigit(ls->current)) return '.'; /* else go through */ } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { read_numeral(ls, seminfo); return TK_NUMBER; } case EOZ: { return TK_EOS; } default: { if (lislalpha(ls->current)) { /* identifier or reserved word? */ TString *ts; do { save_and_next(ls); } while (lislalnum(ls->current)); ts = luaX_newstring(ls, luaZ_buffer(ls->buff), luaZ_bufflen(ls->buff)); seminfo->ts = ts; if (ts->tsv.reserved > 0) /* reserved word? */ return ts->tsv.reserved - 1 + FIRST_RESERVED; else { return TK_NAME; } } else { /* single-char tokens (+ - / ...) */ int c = ls->current; next(ls); return c; } } } } } void luaX_next (LexState *ls) { ls->lastline = ls->linenumber; if (ls->lookahead.token != TK_EOS) { /* is there a look-ahead token? */ ls->t = ls->lookahead; /* use this one */ ls->lookahead.token = TK_EOS; /* and discharge it */ } else ls->t.token = llex(ls, &ls->t.seminfo); /* read next token */ } int luaX_lookahead (LexState *ls) { lua_assert(ls->lookahead.token == TK_EOS); ls->lookahead.token = llex(ls, &ls->lookahead.seminfo); return ls->lookahead.token; } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/llex.h0000644000175000017500000000415612320456500017641 0ustar mathieumathieu/* ** $Id: llex.h,v 1.72 2011/11/30 12:43:51 roberto Exp $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ #ifndef llex_h #define llex_h #include "lobject.h" #include "lzio.h" #define FIRST_RESERVED 257 /* * WARNING: if you change the order of this enumeration, * grep "ORDER RESERVED" */ enum RESERVED { /* terminal symbols denoted by reserved words */ TK_AND = FIRST_RESERVED, TK_BREAK, TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, TK_GOTO, TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, /* other terminal symbols */ TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_DBCOLON, TK_EOS, TK_NUMBER, TK_NAME, TK_STRING }; /* number of reserved words */ #define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) typedef union { lua_Number r; TString *ts; } SemInfo; /* semantics information */ typedef struct Token { int token; SemInfo seminfo; } Token; /* state of the lexer plus state of the parser when shared by all functions */ typedef struct LexState { int current; /* current character (charint) */ int linenumber; /* input line counter */ int lastline; /* line of last token `consumed' */ Token t; /* current token */ Token lookahead; /* look ahead token */ struct FuncState *fs; /* current function (parser) */ struct lua_State *L; ZIO *z; /* input stream */ Mbuffer *buff; /* buffer for tokens */ struct Dyndata *dyd; /* dynamic structures used by the parser */ TString *source; /* current source name */ TString *envn; /* environment variable name */ char decpoint; /* locale decimal point */ } LexState; LUAI_FUNC void luaX_init (lua_State *L); LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source, int firstchar); LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); LUAI_FUNC void luaX_next (LexState *ls); LUAI_FUNC int luaX_lookahead (LexState *ls); LUAI_FUNC l_noret luaX_syntaxerror (LexState *ls, const char *s); LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/luaconf.h0000644000175000017500000003460212320456500020323 0ustar mathieumathieu/* ** $Id: luaconf.h,v 1.170 2011/12/06 16:58:36 roberto Exp $ ** Configuration file for Lua ** See Copyright Notice in lua.h */ #ifndef lconfig_h #define lconfig_h #include #include /* ** ================================================================== ** Search for "@@" to find all configurable definitions. ** =================================================================== */ /* @@ LUA_ANSI controls the use of non-ansi features. ** CHANGE it (define it) if you want Lua to avoid the use of any ** non-ansi feature or library. */ #if !defined(LUA_ANSI) && defined(__STRICT_ANSI__) #define LUA_ANSI #endif #if !defined(LUA_ANSI) && defined(_WIN32) && !defined(_WIN32_WCE) #define LUA_WIN /* enable goodies for regular Windows platforms */ #endif #if defined(LUA_WIN) #define LUA_DL_DLL #define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ #endif #if defined(LUA_USE_LINUX) #define LUA_USE_POSIX #define LUA_USE_DLOPEN /* needs an extra library: -ldl */ #define LUA_USE_READLINE /* needs some extra libraries */ #define LUA_USE_STRTODHEX /* assume 'strtod' handles hexa formats */ #define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ #define LUA_USE_LONGLONG /* assume support for long long */ #endif #if defined(LUA_USE_MACOSX) #define LUA_USE_POSIX #define LUA_USE_DLOPEN /* does not need -ldl */ #define LUA_USE_READLINE /* needs an extra library: -lreadline */ #define LUA_USE_STRTODHEX /* assume 'strtod' handles hexa formats */ #define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ #define LUA_USE_LONGLONG /* assume support for long long */ #endif /* @@ LUA_USE_POSIX includes all functionality listed as X/Open System @* Interfaces Extension (XSI). ** CHANGE it (define it) if your system is XSI compatible. */ #if defined(LUA_USE_POSIX) #define LUA_USE_MKSTEMP #define LUA_USE_ISATTY #define LUA_USE_POPEN #define LUA_USE_ULONGJMP #define LUA_USE_GMTIME_R #endif /* @@ LUA_PATH_DEFAULT is the default path that Lua uses to look for @* Lua libraries. @@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for @* C libraries. ** CHANGE them if your machine has a non-conventional directory ** hierarchy or if you want to install your libraries in ** non-conventional directories. */ #if defined(_WIN32) /* { */ /* ** In Windows, any exclamation mark ('!') in the path is replaced by the ** path of the directory of the executable file of the current process. */ #define LUA_LDIR "!\\lua\\" #define LUA_CDIR "!\\" #define LUA_PATH_DEFAULT \ LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" ".\\?.lua" #define LUA_CPATH_DEFAULT \ LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll;" ".\\?.dll" #else /* }{ */ #define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR "/" #define LUA_ROOT "/usr/local/" #define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR #define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR #define LUA_PATH_DEFAULT \ LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" "./?.lua" #define LUA_CPATH_DEFAULT \ LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so" #endif /* } */ /* @@ LUA_DIRSEP is the directory separator (for submodules). ** CHANGE it if your machine does not use "/" as the directory separator ** and is not Windows. (On Windows Lua automatically uses "\".) */ #if defined(_WIN32) #define LUA_DIRSEP "\\" #else #define LUA_DIRSEP "/" #endif /* @@ LUA_ENV is the name of the variable that holds the current @@ environment, used to access global names. ** CHANGE it if you do not like this name. */ #define LUA_ENV "_ENV" /* @@ LUA_API is a mark for all core API functions. @@ LUALIB_API is a mark for all auxiliary library functions. @@ LUAMOD_API is a mark for all standard library opening functions. ** CHANGE them if you need to define those functions in some special way. ** For instance, if you want to create one Windows DLL with the core and ** the libraries, you may want to use the following definition (define ** LUA_BUILD_AS_DLL to get it). */ #if defined(LUA_BUILD_AS_DLL) /* { */ #if defined(LUA_CORE) || defined(LUA_LIB) /* { */ #define LUA_API __declspec(dllexport) #else /* }{ */ #define LUA_API __declspec(dllimport) #endif /* } */ #else /* }{ */ #define LUA_API extern #endif /* } */ /* more often than not the libs go together with the core */ #define LUALIB_API LUA_API #define LUAMOD_API LUALIB_API /* @@ LUAI_FUNC is a mark for all extern functions that are not to be @* exported to outside modules. @@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables @* that are not to be exported to outside modules (LUAI_DDEF for @* definitions and LUAI_DDEC for declarations). ** CHANGE them if you need to mark them in some special way. Elf/gcc ** (versions 3.2 and later) mark them as "hidden" to optimize access ** when Lua is compiled as a shared library. Not all elf targets support ** this attribute. Unfortunately, gcc does not offer a way to check ** whether the target offers that support, and those without support ** give a warning about it. To avoid these warnings, change to the ** default definition. */ #if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ defined(__ELF__) /* { */ #define LUAI_FUNC __attribute__((visibility("hidden"))) extern #define LUAI_DDEC LUAI_FUNC #define LUAI_DDEF /* empty */ #else /* }{ */ #define LUAI_FUNC extern #define LUAI_DDEC extern #define LUAI_DDEF /* empty */ #endif /* } */ /* @@ LUA_QL describes how error messages quote program elements. ** CHANGE it if you want a different appearance. */ #define LUA_QL(x) "'" x "'" #define LUA_QS LUA_QL("%s") /* @@ LUA_IDSIZE gives the maximum size for the description of the source @* of a function in debug information. ** CHANGE it if you want a different size. */ #define LUA_IDSIZE 60 /* @@ luai_writestring/luai_writeline define how 'print' prints its results. ** They are only used in libraries and the stand-alone program. (The #if ** avoids including 'stdio.h' everywhere.) */ #if defined(LUA_LIB) || defined(lua_c) #include #define luai_writestring(s,l) fwrite((s), sizeof(char), (l), stdout) #define luai_writeline() (luai_writestring("\n", 1), fflush(stdout)) #endif /* @@ luai_writestringerror defines how to print error messages. ** (A format string with one argument is enough for Lua...) */ #define luai_writestringerror(s,p) \ (fprintf(stderr, (s), (p)), fflush(stderr)) /* ** {================================================================== ** Compatibility with previous versions ** =================================================================== */ /* @@ LUA_COMPAT_ALL controls all compatibility options. ** You can define it to get all options, or change specific options ** to fit your specific needs. */ #if defined(LUA_COMPAT_ALL) /* { */ /* @@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'. ** You can replace it with 'table.unpack'. */ #define LUA_COMPAT_UNPACK /* @@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'. ** You can replace it with 'package.searchers'. */ #define LUA_COMPAT_LOADERS /* @@ macro 'lua_cpcall' emulates deprecated function lua_cpcall. ** You can call your C function directly (with light C functions). */ #define lua_cpcall(L,f,u) \ (lua_pushcfunction(L, (f)), \ lua_pushlightuserdata(L,(u)), \ lua_pcall(L,1,0,0)) /* @@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library. ** You can rewrite 'log10(x)' as 'log(x, 10)'. */ #define LUA_COMPAT_LOG10 /* @@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base ** library. You can rewrite 'loadstring(s)' as 'load(s)'. */ #define LUA_COMPAT_LOADSTRING /* @@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library. */ #define LUA_COMPAT_MAXN /* @@ The following macros supply trivial compatibility for some ** changes in the API. The macros themselves document how to ** change your code to avoid using them. */ #define lua_strlen(L,i) lua_rawlen(L, (i)) #define lua_objlen(L,i) lua_rawlen(L, (i)) #define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) #define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) /* @@ LUA_COMPAT_MODULE controls compatibility with previous ** module functions 'module' (Lua) and 'luaL_register' (C). */ #define LUA_COMPAT_MODULE #endif /* } */ /* }================================================================== */ /* @@ LUAI_BITSINT defines the number of bits in an int. ** CHANGE here if Lua cannot automatically detect the number of bits of ** your machine. Probably you do not need to change this. */ /* avoid overflows in comparison */ #if INT_MAX-20 < 32760 /* { */ #define LUAI_BITSINT 16 #elif INT_MAX > 2147483640L /* }{ */ /* int has at least 32 bits */ #define LUAI_BITSINT 32 #else /* }{ */ #error "you must define LUA_BITSINT with number of bits in an integer" #endif /* } */ /* @@ LUA_INT32 is an signed integer with exactly 32 bits. @@ LUAI_UMEM is an unsigned integer big enough to count the total @* memory used by Lua. @@ LUAI_MEM is a signed integer big enough to count the total memory @* used by Lua. ** CHANGE here if for some weird reason the default definitions are not ** good enough for your machine. Probably you do not need to change ** this. */ #if LUAI_BITSINT >= 32 /* { */ #define LUA_INT32 int #define LUAI_UMEM size_t #define LUAI_MEM ptrdiff_t #else /* }{ */ /* 16-bit ints */ #define LUA_INT32 long #define LUAI_UMEM unsigned long #define LUAI_MEM long #endif /* } */ /* @@ LUAI_MAXSTACK limits the size of the Lua stack. ** CHANGE it if you need a different limit. This limit is arbitrary; ** its only purpose is to stop Lua to consume unlimited stack ** space (and to reserve some numbers for pseudo-indices). */ #if LUAI_BITSINT >= 32 #define LUAI_MAXSTACK 1000000 #else #define LUAI_MAXSTACK 15000 #endif /* reserve some space for error handling */ #define LUAI_FIRSTPSEUDOIDX (-LUAI_MAXSTACK - 1000) /* @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. ** CHANGE it if it uses too much C-stack space. */ #define LUAL_BUFFERSIZE BUFSIZ /* ** {================================================================== @@ LUA_NUMBER is the type of numbers in Lua. ** CHANGE the following definitions only if you want to build Lua ** with a number type different from double. You may also need to ** change lua_number2int & lua_number2integer. ** =================================================================== */ #define LUA_NUMBER_DOUBLE #define LUA_NUMBER double /* @@ LUAI_UACNUMBER is the result of an 'usual argument conversion' @* over a number. */ #define LUAI_UACNUMBER double /* @@ LUA_NUMBER_SCAN is the format for reading numbers. @@ LUA_NUMBER_FMT is the format for writing numbers. @@ lua_number2str converts a number to a string. @@ LUAI_MAXNUMBER2STR is maximum size of previous conversion. */ #define LUA_NUMBER_SCAN "%lf" #define LUA_NUMBER_FMT "%.14g" #define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) #define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ /* @@ lua_str2number converts a decimal numeric string to a number. @@ lua_strx2number converts an hexadecimal numeric string to a number. ** In C99, 'strtod' do both conversions. C89, however, has no function ** to convert floating hexadecimal strings to numbers. For these ** systems, you can leave 'lua_strx2number' undefined and Lua will ** provide its own implementation. */ #define lua_str2number(s,p) strtod((s), (p)) #if defined(LUA_USE_STRTODHEX) #define lua_strx2number(s,p) strtod((s), (p)) #endif /* @@ The luai_num* macros define the primitive operations over numbers. */ /* the following operations need the math library */ #if defined(lobject_c) || defined(lvm_c) #include #define luai_nummod(L,a,b) ((a) - floor((a)/(b))*(b)) #define luai_numpow(L,a,b) (pow(a,b)) #endif /* these are quite standard operations */ #if defined(LUA_CORE) #define luai_numadd(L,a,b) ((a)+(b)) #define luai_numsub(L,a,b) ((a)-(b)) #define luai_nummul(L,a,b) ((a)*(b)) #define luai_numdiv(L,a,b) ((a)/(b)) #define luai_numunm(L,a) (-(a)) #define luai_numeq(a,b) ((a)==(b)) #define luai_numlt(L,a,b) ((a)<(b)) #define luai_numle(L,a,b) ((a)<=(b)) #define luai_numisnan(L,a) (!luai_numeq((a), (a))) #endif /* @@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger. ** CHANGE that if ptrdiff_t is not adequate on your machine. (On most ** machines, ptrdiff_t gives a good choice between int or long.) */ #define LUA_INTEGER ptrdiff_t /* @@ LUA_UNSIGNED is the integral type used by lua_pushunsigned/lua_tounsigned. ** It must have at least 32 bits. */ #define LUA_UNSIGNED unsigned LUA_INT32 #if defined(LUA_CORE) /* { */ #if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) /* { */ /* On a Microsoft compiler on a Pentium, use assembler to avoid clashes with a DirectX idiosyncrasy */ #if defined(LUA_WIN) && defined(_MSC_VER) && defined(_M_IX86) /* { */ #define MS_ASMTRICK #else /* }{ */ /* the next definition uses a trick that should work on any machine using IEEE754 with a 32-bit integer type */ #define LUA_IEEE754TRICK /* @@ LUA_IEEEENDIAN is the endianness of doubles in your machine ** (0 for little endian, 1 for big endian); if not defined, Lua will ** check it dynamically. */ /* check for known architectures */ #if defined(__i386__) || defined(__i386) || defined(__X86__) || \ defined (__x86_64) #define LUA_IEEEENDIAN 0 #elif defined(__POWERPC__) || defined(__ppc__) #define LUA_IEEEENDIAN 1 #endif #endif /* } */ #endif /* } */ #endif /* } */ /* }================================================================== */ /* @@ LUA_NANTRICK_LE/LUA_NANTRICK_BE controls the use of a trick to ** pack all types into a single double value, using NaN values to ** represent non-number values. The trick only works on 32-bit machines ** (ints and pointers are 32-bit values) with numbers represented as ** IEEE 754-2008 doubles with conventional endianess (12345678 or ** 87654321), in CPUs that do not produce signaling NaN values (all NaNs ** are quiet). */ #if defined(LUA_CORE) && \ defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) /* { */ /* little-endian architectures that satisfy those conditions */ #if defined(__i386__) || defined(__i386) || defined(__X86__) || \ defined(_M_IX86) #define LUA_NANTRICK_LE #endif #endif /* } */ /* =================================================================== */ /* ** Local configuration. You can use this space to add your redefinitions ** without modifying the main part of the file. */ #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/ltm.h0000644000175000017500000000214112320456500017461 0ustar mathieumathieu/* ** $Id: ltm.h,v 2.11 2011/02/28 17:32:10 roberto Exp $ ** Tag methods ** See Copyright Notice in lua.h */ #ifndef ltm_h #define ltm_h #include "lobject.h" /* * WARNING: if you change the order of this enumeration, * grep "ORDER TM" */ typedef enum { TM_INDEX, TM_NEWINDEX, TM_GC, TM_MODE, TM_LEN, TM_EQ, /* last tag method with `fast' access */ TM_ADD, TM_SUB, TM_MUL, TM_DIV, TM_MOD, TM_POW, TM_UNM, TM_LT, TM_LE, TM_CONCAT, TM_CALL, TM_N /* number of elements in the enum */ } TMS; #define gfasttm(g,et,e) ((et) == NULL ? NULL : \ ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) #define fasttm(l,et,e) gfasttm(G(l), et, e) #define ttypename(x) luaT_typenames_[(x) + 1] #define objtypename(x) ttypename(ttypenv(x)) LUAI_DDEC const char *const luaT_typenames_[LUA_TOTALTAGS]; LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event); LUAI_FUNC void luaT_init (lua_State *L); #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lvm.h0000644000175000017500000000275612320456500017477 0ustar mathieumathieu/* ** $Id: lvm.h,v 2.17 2011/05/31 18:27:56 roberto Exp $ ** Lua virtual machine ** See Copyright Notice in lua.h */ #ifndef lvm_h #define lvm_h #include "ldo.h" #include "lobject.h" #include "ltm.h" #define tostring(L,o) (ttisstring(o) || (luaV_tostring(L, o))) #define tonumber(o,n) (ttisnumber(o) || (((o) = luaV_tonumber(o,n)) != NULL)) #define equalobj(L,o1,o2) (ttisequal(o1, o2) && luaV_equalobj_(L, o1, o2)) #define luaV_rawequalobj(t1,t2) \ (ttisequal(t1,t2) && luaV_equalobj_(NULL,t1,t2)) /* not to called directly */ LUAI_FUNC int luaV_equalobj_ (lua_State *L, const TValue *t1, const TValue *t2); LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); LUAI_FUNC int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r); LUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n); LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj); LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val); LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val); LUAI_FUNC void luaV_finishOp (lua_State *L); LUAI_FUNC void luaV_execute (lua_State *L); LUAI_FUNC void luaV_concat (lua_State *L, int total); LUAI_FUNC void luaV_arith (lua_State *L, StkId ra, const TValue *rb, const TValue *rc, TMS op); LUAI_FUNC void luaV_objlen (lua_State *L, StkId ra, const TValue *rb); #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/llimits.h0000644000175000017500000001613412320456500020351 0ustar mathieumathieu/* ** $Id: llimits.h,v 1.95 2011/12/06 16:58:36 roberto Exp $ ** Limits, basic types, and some other `installation-dependent' definitions ** See Copyright Notice in lua.h */ #ifndef llimits_h #define llimits_h #include #include #include "lua.h" typedef unsigned LUA_INT32 lu_int32; typedef LUAI_UMEM lu_mem; typedef LUAI_MEM l_mem; /* chars used as small naturals (so that `char' is reserved for characters) */ typedef unsigned char lu_byte; #define MAX_SIZET ((size_t)(~(size_t)0)-2) #define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2) #define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ /* ** conversion of pointer to integer ** this is for hashing only; there is no problem if the integer ** cannot hold the whole pointer value */ #define IntPoint(p) ((unsigned int)(lu_mem)(p)) /* type to ensure maximum alignment */ #if !defined(LUAI_USER_ALIGNMENT_T) #define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; } #endif typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; /* result of a `usual argument conversion' over lua_Number */ typedef LUAI_UACNUMBER l_uacNumber; /* internal assertions for in-house debugging */ #if defined(lua_assert) #define check_exp(c,e) (lua_assert(c), (e)) /* to avoid problems with conditions too long */ #define lua_longassert(c) { if (!(c)) lua_assert(0); } #else #define lua_assert(c) ((void)0) #define check_exp(c,e) (e) #define lua_longassert(c) ((void)0) #endif /* ** assertion for checking API calls */ #if !defined(luai_apicheck) #if defined(LUA_USE_APICHECK) #include #define luai_apicheck(L,e) assert(e) #else #define luai_apicheck(L,e) lua_assert(e) #endif #endif #define api_check(l,e,msg) luai_apicheck(l,(e) && msg) #if !defined(UNUSED) #define UNUSED(x) ((void)(x)) /* to avoid warnings */ #endif #define cast(t, exp) ((t)(exp)) #define cast_byte(i) cast(lu_byte, (i)) #define cast_num(i) cast(lua_Number, (i)) #define cast_int(i) cast(int, (i)) #define cast_uchar(i) cast(unsigned char, (i)) /* ** non-return type */ #if defined(__GNUC__) #define l_noret void __attribute__((noreturn)) #elif defined(_MSC_VER) #define l_noret void __declspec(noreturn) #else #define l_noret void #endif /* ** maximum depth for nested C calls and syntactical nested non-terminals ** in a program. (Value must fit in an unsigned short int.) */ #if !defined(LUAI_MAXCCALLS) #define LUAI_MAXCCALLS 200 #endif /* ** maximum number of upvalues in a closure (both C and Lua). (Value ** must fit in an unsigned char.) */ #define MAXUPVAL UCHAR_MAX /* ** type for virtual-machine instructions ** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) */ typedef lu_int32 Instruction; /* maximum stack for a Lua function */ #define MAXSTACK 250 /* minimum size for the string table (must be power of 2) */ #if !defined(MINSTRTABSIZE) #define MINSTRTABSIZE 32 #endif /* minimum size for string buffer */ #if !defined(LUA_MINBUFFER) #define LUA_MINBUFFER 32 #endif #if !defined(lua_lock) #define lua_lock(L) ((void) 0) #define lua_unlock(L) ((void) 0) #endif #if !defined(luai_threadyield) #define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} #endif /* ** these macros allow user-specific actions on threads when you defined ** LUAI_EXTRASPACE and need to do something extra when a thread is ** created/deleted/resumed/yielded. */ #if !defined(luai_userstateopen) #define luai_userstateopen(L) ((void)L) #endif #if !defined(luai_userstateclose) #define luai_userstateclose(L) ((void)L) #endif #if !defined(luai_userstatethread) #define luai_userstatethread(L,L1) ((void)L) #endif #if !defined(luai_userstatefree) #define luai_userstatefree(L,L1) ((void)L) #endif #if !defined(luai_userstateresume) #define luai_userstateresume(L,n) ((void)L) #endif #if !defined(luai_userstateyield) #define luai_userstateyield(L,n) ((void)L) #endif /* ** lua_number2int is a macro to convert lua_Number to int. ** lua_number2integer is a macro to convert lua_Number to lua_Integer. ** lua_number2unsigned is a macro to convert a lua_Number to a lua_Unsigned. ** lua_unsigned2number is a macro to convert a lua_Unsigned to a lua_Number. ** luai_hashnum is a macro to hash a lua_Number value into an integer. ** The hash must be deterministic and give reasonable values for ** both small and large values (outside the range of integers). */ #if defined(MS_ASMTRICK) /* { */ /* trick with Microsoft assembler for X86 */ #define lua_number2int(i,n) __asm {__asm fld n __asm fistp i} #define lua_number2integer(i,n) lua_number2int(i, n) #define lua_number2unsigned(i,n) \ {__int64 l; __asm {__asm fld n __asm fistp l} i = (unsigned int)l;} #elif defined(LUA_IEEE754TRICK) /* }{ */ /* the next trick should work on any machine using IEEE754 with a 32-bit integer type */ union luai_Cast { double l_d; LUA_INT32 l_p[2]; }; #if !defined(LUA_IEEEENDIAN) /* { */ #define LUAI_EXTRAIEEE \ static const union luai_Cast ieeeendian = {-(33.0 + 6755399441055744.0)}; #define LUA_IEEEENDIAN (ieeeendian.l_p[1] == 33) #else #define LUAI_EXTRAIEEE /* empty */ #endif /* } */ #define lua_number2int32(i,n,t) \ { LUAI_EXTRAIEEE \ volatile union luai_Cast u; u.l_d = (n) + 6755399441055744.0; \ (i) = (t)u.l_p[LUA_IEEEENDIAN]; } #define luai_hashnum(i,n) \ { volatile union luai_Cast u; u.l_d = (n) + 1.0; /* avoid -0 */ \ (i) = u.l_p[0]; (i) += u.l_p[1]; } /* add double bits for his hash */ #define lua_number2int(i,n) lua_number2int32(i, n, int) #define lua_number2integer(i,n) lua_number2int32(i, n, lua_Integer) #define lua_number2unsigned(i,n) lua_number2int32(i, n, lua_Unsigned) #endif /* } */ /* the following definitions always work, but may be slow */ #if !defined(lua_number2int) #define lua_number2int(i,n) ((i)=(int)(n)) #endif #if !defined(lua_number2integer) #define lua_number2integer(i,n) ((i)=(lua_Integer)(n)) #endif #if !defined(lua_number2unsigned) /* { */ /* the following definition assures proper modulo behavior */ #if defined(LUA_NUMBER_DOUBLE) #include #define SUPUNSIGNED ((lua_Number)(~(lua_Unsigned)0) + 1) #define lua_number2unsigned(i,n) \ ((i)=(lua_Unsigned)((n) - floor((n)/SUPUNSIGNED)*SUPUNSIGNED)) #else #define lua_number2unsigned(i,n) ((i)=(lua_Unsigned)(n)) #endif #endif /* } */ #if !defined(lua_unsigned2number) /* on several machines, coercion from unsigned to double is slow, so it may be worth to avoid */ #define lua_unsigned2number(u) \ (((u) <= (lua_Unsigned)INT_MAX) ? (lua_Number)(int)(u) : (lua_Number)(u)) #endif #if defined(ltable_c) && !defined(luai_hashnum) #include #include #define luai_hashnum(i,n) { int e; \ n = frexp(n, &e) * (lua_Number)(INT_MAX - DBL_MAX_EXP); \ lua_number2int(i, n); i += e; } #endif /* ** macro to control inclusion of some hard tests on stack reallocation */ #if !defined(HARDSTACKTESTS) #define condmovestack(L) ((void)0) #else /* realloc stack keeping its size */ #define condmovestack(L) luaD_reallocstack((L), (L)->stacksize) #endif #if !defined(HARDMEMTESTS) #define condchangemem(L) condmovestack(L) #else #define condchangemem(L) \ ((void)(!(G(L)->gcrunning) || (luaC_fullgc(L, 0), 1))) #endif #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/ldebug.cpp0000644000175000017500000003624212320456500020473 0ustar mathieumathieu/* ** $Id: ldebug.c,v 2.88 2011/11/30 12:43:51 roberto Exp $ ** Debug Interface ** See Copyright Notice in lua.h */ #include #include #include #define ldebug_c #define LUA_CORE #include "lua.h" #include "lapi.h" #include "lcode.h" #include "ldebug.h" #include "ldo.h" #include "lfunc.h" #include "lobject.h" #include "lopcodes.h" #include "lstate.h" #include "lstring.h" #include "ltable.h" #include "ltm.h" #include "lvm.h" static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name); static int currentpc (CallInfo *ci) { lua_assert(isLua(ci)); return pcRel(ci->u.l.savedpc, ci_func(ci)->p); } static int currentline (CallInfo *ci) { return getfuncline(ci_func(ci)->p, currentpc(ci)); } /* ** this function can be called asynchronous (e.g. during a signal) */ LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { if (func == NULL || mask == 0) { /* turn off hooks? */ mask = 0; func = NULL; } if (isLua(L->ci)) L->oldpc = L->ci->u.l.savedpc; L->hook = func; L->basehookcount = count; resethookcount(L); L->hookmask = cast_byte(mask); return 1; } LUA_API lua_Hook lua_gethook (lua_State *L) { return L->hook; } LUA_API int lua_gethookmask (lua_State *L) { return L->hookmask; } LUA_API int lua_gethookcount (lua_State *L) { return L->basehookcount; } LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { int status; CallInfo *ci; if (level < 0) return 0; /* invalid (negative) level */ lua_lock(L); for (ci = L->ci; level > 0 && ci != &L->base_ci; ci = ci->previous) level--; if (level == 0 && ci != &L->base_ci) { /* level found? */ status = 1; ar->i_ci = ci; } else status = 0; /* no such level */ lua_unlock(L); return status; } static const char *upvalname (Proto *p, int uv) { TString *s = check_exp(uv < p->sizeupvalues, p->upvalues[uv].name); if (s == NULL) return "?"; else return getstr(s); } static const char *findvararg (CallInfo *ci, int n, StkId *pos) { int nparams = clLvalue(ci->func)->p->numparams; if (n >= ci->u.l.base - ci->func - nparams) return NULL; /* no such vararg */ else { *pos = ci->func + nparams + n; return "(*vararg)"; /* generic name for any vararg */ } } static const char *findlocal (lua_State *L, CallInfo *ci, int n, StkId *pos) { const char *name = NULL; StkId base; if (isLua(ci)) { if (n < 0) /* access to vararg values? */ return findvararg(ci, -n, pos); else { base = ci->u.l.base; name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci)); } } else base = ci->func + 1; if (name == NULL) { /* no 'standard' name? */ StkId limit = (ci == L->ci) ? L->top : ci->next->func; if (limit - base >= n && n > 0) /* is 'n' inside 'ci' stack? */ name = "(*temporary)"; /* generic name for any valid slot */ else return NULL; /* no name */ } *pos = base + (n - 1); return name; } LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { const char *name; lua_lock(L); if (ar == NULL) { /* information about non-active function? */ if (!isLfunction(L->top - 1)) /* not a Lua function? */ name = NULL; else /* consider live variables at function start (parameters) */ name = luaF_getlocalname(clLvalue(L->top - 1)->p, n, 0); } else { /* active function; get information through 'ar' */ StkId pos = 0; /* to avoid warnings */ name = findlocal(L, ar->i_ci, n, &pos); if (name) { setobj2s(L, L->top, pos); api_incr_top(L); } } lua_unlock(L); return name; } LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { StkId pos = 0; /* to avoid warnings */ const char *name = findlocal(L, ar->i_ci, n, &pos); lua_lock(L); if (name) setobjs2s(L, pos, L->top - 1); L->top--; /* pop value */ lua_unlock(L); return name; } static void funcinfo (lua_Debug *ar, Closure *cl) { if (cl == NULL || cl->c.isC) { ar->source = "=[C]"; ar->linedefined = -1; ar->lastlinedefined = -1; ar->what = "C"; } else { Proto *p = cl->l.p; ar->source = p->source ? getstr(p->source) : "=?"; ar->linedefined = p->linedefined; ar->lastlinedefined = p->lastlinedefined; ar->what = (ar->linedefined == 0) ? "main" : "Lua"; } luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); } static void collectvalidlines (lua_State *L, Closure *f) { if (f == NULL || f->c.isC) { setnilvalue(L->top); incr_top(L); } else { int i; TValue v; int *lineinfo = f->l.p->lineinfo; Table *t = luaH_new(L); /* new table to store active lines */ sethvalue(L, L->top, t); /* push it on stack */ incr_top(L); setbvalue(&v, 1); /* boolean 'true' to be the value of all indices */ for (i = 0; i < f->l.p->sizelineinfo; i++) /* for all lines with code */ luaH_setint(L, t, lineinfo[i], &v); /* table[line] = true */ } } static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, Closure *f, CallInfo *ci) { int status = 1; for (; *what; what++) { switch (*what) { case 'S': { funcinfo(ar, f); break; } case 'l': { ar->currentline = (ci && isLua(ci)) ? currentline(ci) : -1; break; } case 'u': { ar->nups = (f == NULL) ? 0 : f->c.nupvalues; if (f == NULL || f->c.isC) { ar->isvararg = 1; ar->nparams = 0; } else { ar->isvararg = f->l.p->is_vararg; ar->nparams = f->l.p->numparams; } break; } case 't': { ar->istailcall = (ci) ? ci->callstatus & CIST_TAIL : 0; break; } case 'n': { /* calling function is a known Lua function? */ if (ci && !(ci->callstatus & CIST_TAIL) && isLua(ci->previous)) ar->namewhat = getfuncname(L, ci->previous, &ar->name); else ar->namewhat = NULL; if (ar->namewhat == NULL) { ar->namewhat = ""; /* not found */ ar->name = NULL; } break; } case 'L': case 'f': /* handled by lua_getinfo */ break; default: status = 0; /* invalid option */ } } return status; } LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { int status; Closure *cl; CallInfo *ci; StkId func; lua_lock(L); if (*what == '>') { ci = NULL; func = L->top - 1; api_check(L, ttisfunction(func), "function expected"); what++; /* skip the '>' */ L->top--; /* pop function */ } else { ci = ar->i_ci; func = ci->func; lua_assert(ttisfunction(ci->func)); } cl = ttisclosure(func) ? clvalue(func) : NULL; status = auxgetinfo(L, what, ar, cl, ci); if (strchr(what, 'f')) { setobjs2s(L, L->top, func); incr_top(L); } if (strchr(what, 'L')) collectvalidlines(L, cl); lua_unlock(L); return status; } /* ** {====================================================== ** Symbolic Execution ** ======================================================= */ static const char *getobjname (Proto *p, int lastpc, int reg, const char **name); /* ** find a "name" for the RK value 'c' */ static void kname (Proto *p, int pc, int c, const char **name) { if (ISK(c)) { /* is 'c' a constant? */ TValue *kvalue = &p->k[INDEXK(c)]; if (ttisstring(kvalue)) { /* literal constant? */ *name = svalue(kvalue); /* it is its own name */ return; } /* else no reasonable name found */ } else { /* 'c' is a register */ const char *what = getobjname(p, pc, c, name); /* search for 'c' */ if (what && *what == 'c') { /* found a constant name? */ return; /* 'name' already filled */ } /* else no reasonable name found */ } *name = "?"; /* no reasonable name found */ } /* ** try to find last instruction before 'lastpc' that modified register 'reg' */ static int findsetreg (Proto *p, int lastpc, int reg) { int pc; int setreg = -1; /* keep last instruction that changed 'reg' */ for (pc = 0; pc < lastpc; pc++) { Instruction i = p->code[pc]; OpCode op = GET_OPCODE(i); int a = GETARG_A(i); switch (op) { case OP_LOADNIL: { int b = GETARG_B(i); if (a <= reg && reg <= a + b) /* set registers from 'a' to 'a+b' */ setreg = pc; break; } case OP_TFORCALL: { if (reg >= a + 2) setreg = pc; /* affect all regs above its base */ break; } case OP_CALL: case OP_TAILCALL: { if (reg >= a) setreg = pc; /* affect all registers above base */ break; } case OP_JMP: { int b = GETARG_sBx(i); int dest = pc + 1 + b; /* jump is forward and do not skip `lastpc'? */ if (pc < dest && dest <= lastpc) pc += b; /* do the jump */ break; } case OP_TEST: { if (reg == a) setreg = pc; /* jumped code can change 'a' */ break; } default: if (testAMode(op) && reg == a) /* any instruction that set A */ setreg = pc; break; } } return setreg; } static const char *getobjname (Proto *p, int lastpc, int reg, const char **name) { int pc; *name = luaF_getlocalname(p, reg + 1, lastpc); if (*name) /* is a local? */ return "local"; /* else try symbolic execution */ pc = findsetreg(p, lastpc, reg); if (pc != -1) { /* could find instruction? */ Instruction i = p->code[pc]; OpCode op = GET_OPCODE(i); switch (op) { case OP_MOVE: { int b = GETARG_B(i); /* move from 'b' to 'a' */ if (b < GETARG_A(i)) return getobjname(p, pc, b, name); /* get name for 'b' */ break; } case OP_GETTABUP: case OP_GETTABLE: { int k = GETARG_C(i); /* key index */ int t = GETARG_B(i); /* table index */ const char *vn = (op == OP_GETTABLE) /* name of indexed variable */ ? luaF_getlocalname(p, t + 1, pc) : upvalname(p, t); kname(p, pc, k, name); return (vn && strcmp(vn, LUA_ENV) == 0) ? "global" : "field"; } case OP_GETUPVAL: { *name = upvalname(p, GETARG_B(i)); return "upvalue"; } case OP_LOADK: case OP_LOADKX: { int b = (op == OP_LOADK) ? GETARG_Bx(i) : GETARG_Ax(p->code[pc + 1]); if (ttisstring(&p->k[b])) { *name = svalue(&p->k[b]); return "constant"; } break; } case OP_SELF: { int k = GETARG_C(i); /* key index */ kname(p, pc, k, name); return "method"; } default: break; /* go through to return NULL */ } } return NULL; /* could not find reasonable name */ } static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { TMS tm; Proto *p = ci_func(ci)->p; /* calling function */ int pc = currentpc(ci); /* calling instruction index */ Instruction i = p->code[pc]; /* calling instruction */ switch (GET_OPCODE(i)) { case OP_CALL: case OP_TAILCALL: /* get function name */ return getobjname(p, pc, GETARG_A(i), name); case OP_TFORCALL: { /* for iterator */ *name = "for iterator"; return "for iterator"; } /* all other instructions can call only through metamethods */ case OP_SELF: case OP_GETTABUP: case OP_GETTABLE: tm = TM_INDEX; break; case OP_SETTABUP: case OP_SETTABLE: tm = TM_NEWINDEX; break; case OP_EQ: tm = TM_EQ; break; case OP_ADD: tm = TM_ADD; break; case OP_SUB: tm = TM_SUB; break; case OP_MUL: tm = TM_MUL; break; case OP_DIV: tm = TM_DIV; break; case OP_MOD: tm = TM_MOD; break; case OP_POW: tm = TM_POW; break; case OP_UNM: tm = TM_UNM; break; case OP_LEN: tm = TM_LEN; break; case OP_LT: tm = TM_LT; break; case OP_LE: tm = TM_LE; break; case OP_CONCAT: tm = TM_CONCAT; break; default: return NULL; /* else no useful name can be found */ } *name = getstr(G(L)->tmname[tm]); return "metamethod"; } /* }====================================================== */ /* ** only ANSI way to check whether a pointer points to an array ** (used only for error messages, so efficiency is not a big concern) */ static int isinstack (CallInfo *ci, const TValue *o) { StkId p; for (p = ci->u.l.base; p < ci->top; p++) if (o == p) return 1; return 0; } static const char *getupvalname (CallInfo *ci, const TValue *o, const char **name) { LClosure *c = ci_func(ci); int i; for (i = 0; i < c->nupvalues; i++) { if (c->upvals[i]->v == o) { *name = upvalname(c->p, i); return "upvalue"; } } return NULL; } l_noret luaG_typeerror (lua_State *L, const TValue *o, const char *op) { CallInfo *ci = L->ci; const char *name = NULL; const char *t = objtypename(o); const char *kind = NULL; if (isLua(ci)) { kind = getupvalname(ci, o, &name); /* check whether 'o' is an upvalue */ if (!kind && isinstack(ci, o)) /* no? try a register */ kind = getobjname(ci_func(ci)->p, currentpc(ci), cast_int(o - ci->u.l.base), &name); } if (kind) luaG_runerror(L, "attempt to %s %s " LUA_QS " (a %s value)", op, kind, name, t); else luaG_runerror(L, "attempt to %s a %s value", op, t); } l_noret luaG_concaterror (lua_State *L, StkId p1, StkId p2) { if (ttisstring(p1) || ttisnumber(p1)) p1 = p2; lua_assert(!ttisstring(p1) && !ttisnumber(p2)); luaG_typeerror(L, p1, "concatenate"); } l_noret luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) { TValue temp; if (luaV_tonumber(p1, &temp) == NULL) p2 = p1; /* first operand is wrong */ luaG_typeerror(L, p2, "perform arithmetic on"); } l_noret luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { const char *t1 = objtypename(p1); const char *t2 = objtypename(p2); if (t1 == t2) luaG_runerror(L, "attempt to compare two %s values", t1); else luaG_runerror(L, "attempt to compare %s with %s", t1, t2); } static void addinfo (lua_State *L, const char *msg) { CallInfo *ci = L->ci; if (isLua(ci)) { /* is Lua code? */ char buff[LUA_IDSIZE]; /* add file:line information */ int line = currentline(ci); TString *src = ci_func(ci)->p->source; if (src) luaO_chunkid(buff, getstr(src), LUA_IDSIZE); else { /* no source available; use "?" instead */ buff[0] = '?'; buff[1] = '\0'; } luaO_pushfstring(L, "%s:%d: %s", buff, line, msg); } } l_noret luaG_errormsg (lua_State *L) { if (L->errfunc != 0) { /* is there an error handling function? */ StkId errfunc = restorestack(L, L->errfunc); if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR); setobjs2s(L, L->top, L->top - 1); /* move argument */ setobjs2s(L, L->top - 1, errfunc); /* push function */ incr_top(L); luaD_call(L, L->top - 2, 1, 0); /* call it */ } luaD_throw(L, LUA_ERRRUN); } l_noret luaG_runerror (lua_State *L, const char *fmt, ...) { va_list argp; va_start(argp, fmt); addinfo(L, luaO_pushvfstring(L, fmt, argp)); va_end(argp); luaG_errormsg(L); } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lobject.cpp0000644000175000017500000001734212320456500020653 0ustar mathieumathieu/* ** $Id: lobject.c,v 2.55 2011/11/30 19:30:16 roberto Exp $ ** Some generic functions over Lua objects ** See Copyright Notice in lua.h */ #include #include #include #include #define lobject_c #define LUA_CORE #include "lua.h" #include "lctype.h" #include "ldebug.h" #include "ldo.h" #include "lmem.h" #include "lobject.h" #include "lstate.h" #include "lstring.h" #include "lvm.h" LUAI_DDEF const TValue luaO_nilobject_ = {NILCONSTANT}; /* ** converts an integer to a "floating point byte", represented as ** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if ** eeeee != 0 and (xxx) otherwise. */ int luaO_int2fb (unsigned int x) { int e = 0; /* exponent */ if (x < 8) return x; while (x >= 0x10) { x = (x+1) >> 1; e++; } return ((e+1) << 3) | (cast_int(x) - 8); } /* converts back */ int luaO_fb2int (int x) { int e = (x >> 3) & 0x1f; if (e == 0) return x; else return ((x & 7) + 8) << (e - 1); } int luaO_ceillog2 (unsigned int x) { static const lu_byte log_2[256] = { 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 }; int l = 0; x--; while (x >= 256) { l += 8; x >>= 8; } return l + log_2[x]; } lua_Number luaO_arith (int op, lua_Number v1, lua_Number v2) { switch (op) { case LUA_OPADD: return luai_numadd(NULL, v1, v2); case LUA_OPSUB: return luai_numsub(NULL, v1, v2); case LUA_OPMUL: return luai_nummul(NULL, v1, v2); case LUA_OPDIV: return luai_numdiv(NULL, v1, v2); case LUA_OPMOD: return luai_nummod(NULL, v1, v2); case LUA_OPPOW: return luai_numpow(NULL, v1, v2); case LUA_OPUNM: return luai_numunm(NULL, v1); default: lua_assert(0); return 0; } } int luaO_hexavalue (int c) { if (lisdigit(c)) return c - '0'; else return ltolower(c) - 'a' + 10; } #if !defined(lua_strx2number) #include static int isneg (const char **s) { if (**s == '-') { (*s)++; return 1; } else if (**s == '+') (*s)++; return 0; } static lua_Number readhexa (const char **s, lua_Number r, int *count) { for (; lisxdigit(cast_uchar(**s)); (*s)++) { /* read integer part */ r = (r * 16.0) + cast_num(luaO_hexavalue(cast_uchar(**s))); (*count)++; } return r; } /* ** convert an hexadecimal numeric string to a number, following ** C99 specification for 'strtod' */ static lua_Number lua_strx2number (const char *s, char **endptr) { lua_Number r = 0.0; int e = 0, i = 0; int neg = 0; /* 1 if number is negative */ *endptr = cast(char *, s); /* nothing is valid yet */ while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */ neg = isneg(&s); /* check signal */ if (!(*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))) /* check '0x' */ return 0.0; /* invalid format (no '0x') */ s += 2; /* skip '0x' */ r = readhexa(&s, r, &i); /* read integer part */ if (*s == '.') { s++; /* skip dot */ r = readhexa(&s, r, &e); /* read fractional part */ } if (i == 0 && e == 0) return 0.0; /* invalid format (no digit) */ e *= -4; /* each fractional digit divides value by 2^-4 */ *endptr = cast(char *, s); /* valid up to here */ if (*s == 'p' || *s == 'P') { /* exponent part? */ int exp1 = 0; int neg1; s++; /* skip 'p' */ neg1 = isneg(&s); /* signal */ if (!lisdigit(cast_uchar(*s))) goto ret; /* must have at least one digit */ while (lisdigit(cast_uchar(*s))) /* read exponent */ exp1 = exp1 * 10 + *(s++) - '0'; if (neg1) exp1 = -exp1; e += exp1; } *endptr = cast(char *, s); /* valid up to here */ ret: if (neg) r = -r; return ldexp(r, e); } #endif int luaO_str2d (const char *s, size_t len, lua_Number *result) { char *endptr; if (strpbrk(s, "nN")) /* reject 'inf' and 'nan' */ return 0; else if (strpbrk(s, "xX")) /* hexa? */ *result = lua_strx2number(s, &endptr); else *result = lua_str2number(s, &endptr); if (endptr == s) return 0; /* nothing recognized */ while (lisspace(cast_uchar(*endptr))) endptr++; return (endptr == s + len); /* OK if no trailing characters */ } static void pushstr (lua_State *L, const char *str, size_t l) { setsvalue2s(L, L->top, luaS_newlstr(L, str, l)); incr_top(L); } /* this function handles only `%d', `%c', %f, %p, and `%s' formats */ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { int n = 0; for (;;) { const char *e = strchr(fmt, '%'); if (e == NULL) break; setsvalue2s(L, L->top, luaS_newlstr(L, fmt, e-fmt)); incr_top(L); switch (*(e+1)) { case 's': { const char *s = va_arg(argp, char *); if (s == NULL) s = "(null)"; pushstr(L, s, strlen(s)); break; } case 'c': { char buff; buff = cast(char, va_arg(argp, int)); pushstr(L, &buff, 1); break; } case 'd': { setnvalue(L->top, cast_num(va_arg(argp, int))); incr_top(L); break; } case 'f': { setnvalue(L->top, cast_num(va_arg(argp, l_uacNumber))); incr_top(L); break; } case 'p': { char buff[4*sizeof(void *) + 8]; /* should be enough space for a `%p' */ int l = sprintf(buff, "%p", va_arg(argp, void *)); pushstr(L, buff, l); break; } case '%': { pushstr(L, "%", 1); break; } default: { luaG_runerror(L, "invalid option " LUA_QL("%%%c") " to " LUA_QL("lua_pushfstring"), *(e + 1)); } } n += 2; fmt = e+2; } pushstr(L, fmt, strlen(fmt)); if (n > 0) luaV_concat(L, n + 1); return svalue(L->top - 1); } const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) { const char *msg; va_list argp; va_start(argp, fmt); msg = luaO_pushvfstring(L, fmt, argp); va_end(argp); return msg; } /* number of chars of a literal string without the ending \0 */ #define LL(x) (sizeof(x)/sizeof(char) - 1) #define RETS "..." #define PRE "[string \"" #define POS "\"]" #define addstr(a,b,l) ( memcpy(a,b,(l) * sizeof(char)), a += (l) ) void luaO_chunkid (char *out, const char *source, size_t bufflen) { size_t l = strlen(source); if (*source == '=') { /* 'literal' source */ if (l <= bufflen) /* small enough? */ memcpy(out, source + 1, l * sizeof(char)); else { /* truncate it */ addstr(out, source + 1, bufflen - 1); *out = '\0'; } } else if (*source == '@') { /* file name */ if (l <= bufflen) /* small enough? */ memcpy(out, source + 1, l * sizeof(char)); else { /* add '...' before rest of name */ addstr(out, RETS, LL(RETS)); bufflen -= LL(RETS); memcpy(out, source + 1 + l - bufflen, bufflen * sizeof(char)); } } else { /* string; format as [string "source"] */ const char *nl = strchr(source, '\n'); /* find first new line (if any) */ addstr(out, PRE, LL(PRE)); /* add prefix */ bufflen -= LL(PRE RETS POS) + 1; /* save space for prefix+suffix+'\0' */ if (l < bufflen && nl == NULL) { /* small one-line source? */ addstr(out, source, l); /* keep it */ } else { if (nl != NULL) l = nl - source; /* stop at first newline */ if (l > bufflen) l = bufflen; addstr(out, source, l); addstr(out, RETS, LL(RETS)); } memcpy(out, POS, (LL(POS) + 1) * sizeof(char)); } } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lmem.h0000644000175000017500000000303112320456500017616 0ustar mathieumathieu/* ** $Id: lmem.h,v 1.38 2011/12/02 13:26:54 roberto Exp $ ** Interface to Memory Manager ** See Copyright Notice in lua.h */ #ifndef lmem_h #define lmem_h #include #include "llimits.h" #include "lua.h" #define luaM_reallocv(L,b,on,n,e) \ ((cast(size_t, (n)+1) > MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \ (luaM_toobig(L), (void *)0) : \ luaM_realloc_(L, (b), (on)*(e), (n)*(e))) #define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) #define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) #define luaM_freearray(L, b, n) luaM_reallocv(L, (b), n, 0, sizeof((b)[0])) #define luaM_malloc(L,s) luaM_realloc_(L, NULL, 0, (s)) #define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) #define luaM_newvector(L,n,t) \ cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) #define luaM_newobject(L,tag,s) luaM_realloc_(L, NULL, tag, (s)) #define luaM_growvector(L,v,nelems,size,t,limit,e) \ if ((nelems)+1 > (size)) \ ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) #define luaM_reallocvector(L, v,oldn,n,t) \ ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) LUAI_FUNC l_noret luaM_toobig (lua_State *L); /* not to be called directly */ LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, size_t size); LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elem, int limit, const char *what); #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lzio.cpp0000644000175000017500000000314512320456500020202 0ustar mathieumathieu/* ** $Id: lzio.c,v 1.34 2011/07/15 12:35:32 roberto Exp $ ** a generic input stream interface ** See Copyright Notice in lua.h */ #include #define lzio_c #define LUA_CORE #include "lua.h" #include "llimits.h" #include "lmem.h" #include "lstate.h" #include "lzio.h" int luaZ_fill (ZIO *z) { size_t size; lua_State *L = z->L; const char *buff; lua_unlock(L); buff = z->reader(L, z->data, &size); lua_lock(L); if (buff == NULL || size == 0) return EOZ; z->n = size - 1; /* discount char being returned */ z->p = buff; return cast_uchar(*(z->p++)); } void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { z->L = L; z->reader = reader; z->data = data; z->n = 0; z->p = NULL; } /* --------------------------------------------------------------- read --- */ size_t luaZ_read (ZIO *z, void *b, size_t n) { while (n) { size_t m; if (z->n == 0) { /* no bytes in buffer? */ if (luaZ_fill(z) == EOZ) /* try to read more */ return n; /* no more input; return number of missing bytes */ else { z->n++; /* luaZ_fill consumed first byte; put it back */ z->p--; } } m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ memcpy(b, z->p, m); z->n -= m; z->p += m; b = (char *)b + m; n -= m; } return 0; } /* ------------------------------------------------------------------------ */ char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) { if (n > buff->buffsize) { if (n < LUA_MINBUFFER) n = LUA_MINBUFFER; luaZ_resizebuffer(L, buff, n); } return buff->buffer; } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lbaselib.cpp0000644000175000017500000002763112320456500021010 0ustar mathieumathieu/* ** $Id: lbaselib.c,v 1.273 2011/11/30 13:03:24 roberto Exp $ ** Basic library ** See Copyright Notice in lua.h */ #include #include #include #include #define lbaselib_c #define LUA_LIB #include "lua.h" #include "lauxlib.h" #include "lualib.h" static int luaB_print (lua_State *L) { int n = lua_gettop(L); /* number of arguments */ int i; lua_getglobal(L, "tostring"); for (i=1; i<=n; i++) { const char *s; size_t l; lua_pushvalue(L, -1); /* function to be called */ lua_pushvalue(L, i); /* value to print */ lua_call(L, 1, 1); s = lua_tolstring(L, -1, &l); /* get result */ if (s == NULL) return luaL_error(L, LUA_QL("tostring") " must return a string to " LUA_QL("print")); if (i>1) luai_writestring("\t", 1); luai_writestring(s, l); lua_pop(L, 1); /* pop result */ } luai_writeline(); return 0; } #define SPACECHARS " \f\n\r\t\v" static int luaB_tonumber (lua_State *L) { if (lua_isnoneornil(L, 2)) { /* standard conversion */ int isnum; lua_Number n = lua_tonumberx(L, 1, &isnum); if (isnum) { lua_pushnumber(L, n); return 1; } /* else not a number; must be something */ luaL_checkany(L, 1); } else { size_t l; const char *s = luaL_checklstring(L, 1, &l); const char *e = s + l; /* end point for 's' */ int base = luaL_checkint(L, 2); int neg = 0; luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range"); s += strspn(s, SPACECHARS); /* skip initial spaces */ if (*s == '-') { s++; neg = 1; } /* handle signal */ else if (*s == '+') s++; if (isalnum((unsigned char)*s)) { lua_Number n = 0; do { int digit = (isdigit((unsigned char)*s)) ? *s - '0' : toupper((unsigned char)*s) - 'A' + 10; if (digit >= base) break; /* invalid numeral; force a fail */ n = n * (lua_Number)base + (lua_Number)digit; s++; } while (isalnum((unsigned char)*s)); s += strspn(s, SPACECHARS); /* skip trailing spaces */ if (s == e) { /* no invalid trailing characters? */ lua_pushnumber(L, (neg) ? -n : n); return 1; } /* else not a number */ } /* else not a number */ } lua_pushnil(L); /* not a number */ return 1; } static int luaB_error (lua_State *L) { int level = luaL_optint(L, 2, 1); lua_settop(L, 1); if (lua_isstring(L, 1) && level > 0) { /* add extra information? */ luaL_where(L, level); lua_pushvalue(L, 1); lua_concat(L, 2); } return lua_error(L); } static int luaB_getmetatable (lua_State *L) { luaL_checkany(L, 1); if (!lua_getmetatable(L, 1)) { lua_pushnil(L); return 1; /* no metatable */ } luaL_getmetafield(L, 1, "__metatable"); return 1; /* returns either __metatable field (if present) or metatable */ } static int luaB_setmetatable (lua_State *L) { int t = lua_type(L, 2); luaL_checktype(L, 1, LUA_TTABLE); luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, "nil or table expected"); if (luaL_getmetafield(L, 1, "__metatable")) return luaL_error(L, "cannot change a protected metatable"); lua_settop(L, 2); lua_setmetatable(L, 1); return 1; } static int luaB_rawequal (lua_State *L) { luaL_checkany(L, 1); luaL_checkany(L, 2); lua_pushboolean(L, lua_rawequal(L, 1, 2)); return 1; } static int luaB_rawlen (lua_State *L) { int t = lua_type(L, 1); luaL_argcheck(L, t == LUA_TTABLE || t == LUA_TSTRING, 1, "table or string expected"); lua_pushinteger(L, lua_rawlen(L, 1)); return 1; } static int luaB_rawget (lua_State *L) { luaL_checktype(L, 1, LUA_TTABLE); luaL_checkany(L, 2); lua_settop(L, 2); lua_rawget(L, 1); return 1; } static int luaB_rawset (lua_State *L) { luaL_checktype(L, 1, LUA_TTABLE); luaL_checkany(L, 2); luaL_checkany(L, 3); lua_settop(L, 3); lua_rawset(L, 1); return 1; } static int luaB_collectgarbage (lua_State *L) { static const char *const opts[] = {"stop", "restart", "collect", "count", "step", "setpause", "setstepmul", "setmajorinc", "isrunning", "generational", "incremental", NULL}; static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL, LUA_GCSETMAJORINC, LUA_GCISRUNNING, LUA_GCGEN, LUA_GCINC}; int o = optsnum[luaL_checkoption(L, 1, "collect", opts)]; int ex = luaL_optint(L, 2, 0); int res = lua_gc(L, o, ex); switch (o) { case LUA_GCCOUNT: { int b = lua_gc(L, LUA_GCCOUNTB, 0); lua_pushnumber(L, res + ((lua_Number)b/1024)); lua_pushinteger(L, b); return 2; } case LUA_GCSTEP: case LUA_GCISRUNNING: { lua_pushboolean(L, res); return 1; } default: { lua_pushinteger(L, res); return 1; } } } static int luaB_type (lua_State *L) { luaL_checkany(L, 1); lua_pushstring(L, luaL_typename(L, 1)); return 1; } static int pairsmeta (lua_State *L, const char *method, int iszero, lua_CFunction iter) { if (!luaL_getmetafield(L, 1, method)) { /* no metamethod? */ luaL_checktype(L, 1, LUA_TTABLE); /* argument must be a table */ lua_pushcfunction(L, iter); /* will return generator, */ lua_pushvalue(L, 1); /* state, */ if (iszero) lua_pushinteger(L, 0); /* and initial value */ else lua_pushnil(L); } else { lua_pushvalue(L, 1); /* argument 'self' to metamethod */ lua_call(L, 1, 3); /* get 3 values from metamethod */ } return 3; } static int luaB_next (lua_State *L) { luaL_checktype(L, 1, LUA_TTABLE); lua_settop(L, 2); /* create a 2nd argument if there isn't one */ if (lua_next(L, 1)) return 2; else { lua_pushnil(L); return 1; } } static int luaB_pairs (lua_State *L) { return pairsmeta(L, "__pairs", 0, luaB_next); } static int ipairsaux (lua_State *L) { int i = luaL_checkint(L, 2); luaL_checktype(L, 1, LUA_TTABLE); i++; /* next value */ lua_pushinteger(L, i); lua_rawgeti(L, 1, i); return (lua_isnil(L, -1)) ? 1 : 2; } static int luaB_ipairs (lua_State *L) { return pairsmeta(L, "__ipairs", 1, ipairsaux); } static int load_aux (lua_State *L, int status) { if (status == LUA_OK) return 1; else { lua_pushnil(L); lua_insert(L, -2); /* put before error message */ return 2; /* return nil plus error message */ } } static int luaB_loadfile (lua_State *L) { const char *fname = luaL_optstring(L, 1, NULL); const char *mode = luaL_optstring(L, 2, NULL); int env = !lua_isnone(L, 3); /* 'env' parameter? */ int status = luaL_loadfilex(L, fname, mode); if (status == LUA_OK && env) { /* 'env' parameter? */ lua_pushvalue(L, 3); lua_setupvalue(L, -2, 1); /* set it as 1st upvalue of loaded chunk */ } return load_aux(L, status); } /* ** {====================================================== ** Generic Read function ** ======================================================= */ /* ** reserved slot, above all arguments, to hold a copy of the returned ** string to avoid it being collected while parsed. 'load' has four ** optional arguments (chunk, source name, mode, and environment). */ #define RESERVEDSLOT 5 /* ** Reader for generic `load' function: `lua_load' uses the ** stack for internal stuff, so the reader cannot change the ** stack top. Instead, it keeps its resulting string in a ** reserved slot inside the stack. */ static const char *generic_reader (lua_State *L, void *ud, size_t *size) { (void)(ud); /* not used */ luaL_checkstack(L, 2, "too many nested functions"); lua_pushvalue(L, 1); /* get function */ lua_call(L, 0, 1); /* call it */ if (lua_isnil(L, -1)) { *size = 0; return NULL; } else if (!lua_isstring(L, -1)) luaL_error(L, "reader function must return a string"); lua_replace(L, RESERVEDSLOT); /* save string in reserved slot */ return lua_tolstring(L, RESERVEDSLOT, size); } static int luaB_load (lua_State *L) { int status; size_t l; int top = lua_gettop(L); const char *s = lua_tolstring(L, 1, &l); const char *mode = luaL_optstring(L, 3, "bt"); if (s != NULL) { /* loading a string? */ const char *chunkname = luaL_optstring(L, 2, s); status = luaL_loadbufferx(L, s, l, chunkname, mode); } else { /* loading from a reader function */ const char *chunkname = luaL_optstring(L, 2, "=(load)"); luaL_checktype(L, 1, LUA_TFUNCTION); lua_settop(L, RESERVEDSLOT); /* create reserved slot */ status = lua_load(L, generic_reader, NULL, chunkname, mode); } if (status == LUA_OK && top >= 4) { /* is there an 'env' argument */ lua_pushvalue(L, 4); /* environment for loaded function */ lua_setupvalue(L, -2, 1); /* set it as 1st upvalue */ } return load_aux(L, status); } /* }====================================================== */ static int dofilecont (lua_State *L) { return lua_gettop(L) - 1; } static int luaB_dofile (lua_State *L) { const char *fname = luaL_optstring(L, 1, NULL); lua_settop(L, 1); if (luaL_loadfile(L, fname) != LUA_OK) lua_error(L); lua_callk(L, 0, LUA_MULTRET, 0, dofilecont); return dofilecont(L); } static int luaB_assert (lua_State *L) { if (!lua_toboolean(L, 1)) return luaL_error(L, "%s", luaL_optstring(L, 2, "assertion failed!")); return lua_gettop(L); } static int luaB_select (lua_State *L) { int n = lua_gettop(L); if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') { lua_pushinteger(L, n-1); return 1; } else { int i = luaL_checkint(L, 1); if (i < 0) i = n + i; else if (i > n) i = n; luaL_argcheck(L, 1 <= i, 1, "index out of range"); return n - i; } } static int finishpcall (lua_State *L, int status) { if (!lua_checkstack(L, 1)) { /* no space for extra boolean? */ lua_settop(L, 0); /* create space for return values */ lua_pushboolean(L, 0); lua_pushstring(L, "stack overflow"); return 2; /* return false, msg */ } lua_pushboolean(L, status); /* first result (status) */ lua_replace(L, 1); /* put first result in first slot */ return lua_gettop(L); } static int pcallcont (lua_State *L) { int status = lua_getctx(L, NULL); return finishpcall(L, (status == LUA_YIELD)); } static int luaB_pcall (lua_State *L) { int status; luaL_checkany(L, 1); lua_pushnil(L); lua_insert(L, 1); /* create space for status result */ status = lua_pcallk(L, lua_gettop(L) - 2, LUA_MULTRET, 0, 0, pcallcont); return finishpcall(L, (status == LUA_OK)); } static int luaB_xpcall (lua_State *L) { int status; int n = lua_gettop(L); luaL_argcheck(L, n >= 2, 2, "value expected"); lua_pushvalue(L, 1); /* exchange function... */ lua_copy(L, 2, 1); /* ...and error handler */ lua_replace(L, 2); status = lua_pcallk(L, n - 2, LUA_MULTRET, 1, 0, pcallcont); return finishpcall(L, (status == LUA_OK)); } static int luaB_tostring (lua_State *L) { luaL_checkany(L, 1); luaL_tolstring(L, 1, NULL); return 1; } static const luaL_Reg base_funcs[] = { {"assert", luaB_assert}, {"collectgarbage", luaB_collectgarbage}, {"dofile", luaB_dofile}, {"error", luaB_error}, {"getmetatable", luaB_getmetatable}, {"ipairs", luaB_ipairs}, {"loadfile", luaB_loadfile}, {"load", luaB_load}, #if defined(LUA_COMPAT_LOADSTRING) {"loadstring", luaB_load}, #endif {"next", luaB_next}, {"pairs", luaB_pairs}, {"pcall", luaB_pcall}, {"print", luaB_print}, {"rawequal", luaB_rawequal}, {"rawlen", luaB_rawlen}, {"rawget", luaB_rawget}, {"rawset", luaB_rawset}, {"select", luaB_select}, {"setmetatable", luaB_setmetatable}, {"tonumber", luaB_tonumber}, {"tostring", luaB_tostring}, {"type", luaB_type}, {"xpcall", luaB_xpcall}, {NULL, NULL} }; LUAMOD_API int luaopen_base (lua_State *L) { /* set global _G */ lua_pushglobaltable(L); lua_pushglobaltable(L); lua_setfield(L, -2, "_G"); /* open lib into global table */ luaL_setfuncs(L, base_funcs, 0); lua_pushliteral(L, LUA_VERSION); lua_setfield(L, -2, "_VERSION"); /* set global _VERSION */ return 1; } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lstate.h0000644000175000017500000001571512320456500020174 0ustar mathieumathieu/* ** $Id: lstate.h,v 2.74 2011/09/30 12:45:07 roberto Exp $ ** Global State ** See Copyright Notice in lua.h */ #ifndef lstate_h #define lstate_h #include "lua.h" #include "lobject.h" #include "ltm.h" #include "lzio.h" /* ** Some notes about garbage-collected objects: All objects in Lua must ** be kept somehow accessible until being freed. ** ** Lua keeps most objects linked in list g->allgc. The link uses field ** 'next' of the CommonHeader. ** ** Strings are kept in several lists headed by the array g->strt.hash. ** ** Open upvalues are not subject to independent garbage collection. They ** are collected together with their respective threads. Lua keeps a ** double-linked list with all open upvalues (g->uvhead) so that it can ** mark objects referred by them. (They are always gray, so they must ** be remarked in the atomic step. Usually their contents would be marked ** when traversing the respective threads, but the thread may already be ** dead, while the upvalue is still accessible through closures.) ** ** Objects with finalizers are kept in the list g->finobj. ** ** The list g->tobefnz links all objects being finalized. */ struct lua_longjmp; /* defined in ldo.c */ /* extra stack space to handle TM calls and some other extras */ #define EXTRA_STACK 5 #define BASIC_STACK_SIZE (2*LUA_MINSTACK) /* kinds of Garbage Collection */ #define KGC_NORMAL 0 #define KGC_EMERGENCY 1 /* gc was forced by an allocation failure */ #define KGC_GEN 2 /* generational collection */ typedef struct stringtable { GCObject **hash; lu_int32 nuse; /* number of elements */ int size; } stringtable; /* ** information about a call */ typedef struct CallInfo { StkId func; /* function index in the stack */ StkId top; /* top for this function */ struct CallInfo *previous, *next; /* dynamic call link */ short nresults; /* expected number of results from this function */ lu_byte callstatus; union { struct { /* only for Lua functions */ StkId base; /* base for this function */ const Instruction *savedpc; } l; struct { /* only for C functions */ int ctx; /* context info. in case of yields */ lua_CFunction k; /* continuation in case of yields */ ptrdiff_t old_errfunc; ptrdiff_t extra; lu_byte old_allowhook; lu_byte status; } c; } u; } CallInfo; /* ** Bits in CallInfo status */ #define CIST_LUA (1<<0) /* call is running a Lua function */ #define CIST_HOOKED (1<<1) /* call is running a debug hook */ #define CIST_REENTRY (1<<2) /* call is running on same invocation of luaV_execute of previous call */ #define CIST_YIELDED (1<<3) /* call reentered after suspension */ #define CIST_YPCALL (1<<4) /* call is a yieldable protected call */ #define CIST_STAT (1<<5) /* call has an error status (pcall) */ #define CIST_TAIL (1<<6) /* call was tail called */ #define isLua(ci) ((ci)->callstatus & CIST_LUA) /* ** `global state', shared by all threads of this state */ typedef struct global_State { lua_Alloc frealloc; /* function to reallocate memory */ void *ud; /* auxiliary data to `frealloc' */ lu_mem totalbytes; /* number of bytes currently allocated - GCdebt */ l_mem GCdebt; /* bytes allocated not yet compensated by the collector */ lu_mem lastmajormem; /* memory in use after last major collection */ stringtable strt; /* hash table for strings */ TValue l_registry; lu_byte currentwhite; lu_byte gcstate; /* state of garbage collector */ lu_byte gckind; /* kind of GC running */ lu_byte gcrunning; /* true if GC is running */ int sweepstrgc; /* position of sweep in `strt' */ GCObject *allgc; /* list of all collectable objects */ GCObject *finobj; /* list of collectable objects with finalizers */ GCObject **sweepgc; /* current position of sweep */ GCObject *gray; /* list of gray objects */ GCObject *grayagain; /* list of objects to be traversed atomically */ GCObject *weak; /* list of tables with weak values */ GCObject *ephemeron; /* list of ephemeron tables (weak keys) */ GCObject *allweak; /* list of all-weak tables */ GCObject *tobefnz; /* list of userdata to be GC */ UpVal uvhead; /* head of double-linked list of all open upvalues */ Mbuffer buff; /* temporary buffer for string concatenation */ int gcpause; /* size of pause between successive GCs */ int gcmajorinc; /* how much to wait for a major GC (only in gen. mode) */ int gcstepmul; /* GC `granularity' */ lua_CFunction panic; /* to be called in unprotected errors */ struct lua_State *mainthread; const lua_Number *version; /* pointer to version number */ TString *memerrmsg; /* memory-error message */ TString *tmname[TM_N]; /* array with tag-method names */ struct Table *mt[LUA_NUMTAGS]; /* metatables for basic types */ } global_State; /* ** `per thread' state */ struct lua_State { CommonHeader; lu_byte status; StkId top; /* first free slot in the stack */ global_State *l_G; CallInfo *ci; /* call info for current function */ const Instruction *oldpc; /* last pc traced */ StkId stack_last; /* last free slot in the stack */ StkId stack; /* stack base */ int stacksize; unsigned short nny; /* number of non-yieldable calls in stack */ unsigned short nCcalls; /* number of nested C calls */ lu_byte hookmask; lu_byte allowhook; int basehookcount; int hookcount; lua_Hook hook; GCObject *openupval; /* list of open upvalues in this stack */ GCObject *gclist; struct lua_longjmp *errorJmp; /* current error recover point */ ptrdiff_t errfunc; /* current error handling function (stack index) */ CallInfo base_ci; /* CallInfo for first level (C calling Lua) */ }; #define G(L) (L->l_G) /* ** Union of all collectable objects */ union GCObject { GCheader gch; /* common header */ union TString ts; union Udata u; union Closure cl; struct Table h; struct Proto p; struct UpVal uv; struct lua_State th; /* thread */ }; #define gch(o) (&(o)->gch) /* macros to convert a GCObject into a specific value */ #define rawgco2ts(o) check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts)) #define gco2ts(o) (&rawgco2ts(o)->tsv) #define rawgco2u(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u)) #define gco2u(o) (&rawgco2u(o)->uv) #define gco2cl(o) check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl)) #define gco2t(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h)) #define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p)) #define gco2uv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv)) #define gco2th(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th)) /* macro to convert any Lua object into a GCObject */ #define obj2gco(v) (cast(GCObject *, (v))) /* actual number of total bytes allocated */ #define gettotalbytes(g) ((g)->totalbytes + (g)->GCdebt) LUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt); LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L); LUAI_FUNC void luaE_freeCI (lua_State *L); #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/ldo.h0000644000175000017500000000276712320456500017461 0ustar mathieumathieu/* ** $Id: ldo.h,v 2.20 2011/11/29 15:55:08 roberto Exp $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ #ifndef ldo_h #define ldo_h #include "lobject.h" #include "lstate.h" #include "lzio.h" #define luaD_checkstack(L,n) if (L->stack_last - L->top <= (n)) \ luaD_growstack(L, n); else condmovestack(L); #define incr_top(L) {L->top++; luaD_checkstack(L,0);} #define savestack(L,p) ((char *)(p) - (char *)L->stack) #define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) /* type of protected functions, to be ran by `runprotected' */ typedef void (*Pfunc) (lua_State *L, void *ud); LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, const char *mode); LUAI_FUNC void luaD_hook (lua_State *L, int event, int line); LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults, int allowyield); LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, ptrdiff_t oldtop, ptrdiff_t ef); LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult); LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); LUAI_FUNC void luaD_growstack (lua_State *L, int n); LUAI_FUNC void luaD_shrinkstack (lua_State *L); LUAI_FUNC l_noret luaD_throw (lua_State *L, int errcode); LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/liolib.cpp0000644000175000017500000004114012320456500020474 0ustar mathieumathieu/* ** $Id: liolib.c,v 2.108 2011/11/25 12:50:03 roberto Exp $ ** Standard I/O (and system) library ** See Copyright Notice in lua.h */ /* ** POSIX idiosyncrasy! ** This definition must come before the inclusion of 'stdio.h'; it ** should not affect non-POSIX systems */ #if !defined(_FILE_OFFSET_BITS) #define _FILE_OFFSET_BITS 64 #endif #include #include #include #include #define liolib_c #define LUA_LIB #include "lua.h" #include "lauxlib.h" #include "lualib.h" /* ** {====================================================== ** lua_popen spawns a new process connected to the current ** one through the file streams. ** ======================================================= */ #if !defined(lua_popen) /* { */ #if defined(LUA_USE_POPEN) /* { */ #define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m)) #define lua_pclose(L,file) ((void)L, pclose(file)) #elif defined(LUA_WIN) /* }{ */ #define lua_popen(L,c,m) ((void)L, _popen(c,m)) #define lua_pclose(L,file) ((void)L, _pclose(file)) #else /* }{ */ #define lua_popen(L,c,m) ((void)((void)c, m), \ luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0) #define lua_pclose(L,file) ((void)((void)L, file), -1) #endif /* } */ #endif /* } */ /* }====================================================== */ /* ** {====================================================== ** lua_fseek/lua_ftell: configuration for longer offsets ** ======================================================= */ #if !defined(lua_fseek) /* { */ #if defined(LUA_USE_POSIX) #define l_fseek(f,o,w) fseeko(f,o,w) #define l_ftell(f) ftello(f) #define l_seeknum off_t #elif defined(LUA_WIN) && !defined(_CRTIMP_TYPEINFO) \ && defined(_MSC_VER) && (_MSC_VER >= 1400) /* Windows (but not DDK) and Visual C++ 2005 or higher */ #define l_fseek(f,o,w) _fseeki64(f,o,w) #define l_ftell(f) _ftelli64(f) #define l_seeknum __int64 #else #define l_fseek(f,o,w) fseek(f,o,w) #define l_ftell(f) ftell(f) #define l_seeknum long #endif #endif /* } */ /* }====================================================== */ #define IO_PREFIX "_IO_" #define IO_INPUT (IO_PREFIX "input") #define IO_OUTPUT (IO_PREFIX "output") typedef luaL_Stream LStream; #define tolstream(L) ((LStream *)luaL_checkudata(L, 1, LUA_FILEHANDLE)) #define isclosed(p) ((p)->closef == NULL) static int io_type (lua_State *L) { LStream *p; luaL_checkany(L, 1); p = (LStream *)luaL_testudata(L, 1, LUA_FILEHANDLE); if (p == NULL) lua_pushnil(L); /* not a file */ else if (isclosed(p)) lua_pushliteral(L, "closed file"); else lua_pushliteral(L, "file"); return 1; } static int f_tostring (lua_State *L) { LStream *p = tolstream(L); if (isclosed(p)) lua_pushliteral(L, "file (closed)"); else lua_pushfstring(L, "file (%p)", p->f); return 1; } static FILE *tofile (lua_State *L) { LStream *p = tolstream(L); if (isclosed(p)) luaL_error(L, "attempt to use a closed file"); lua_assert(p->f); return p->f; } /* ** When creating file handles, always creates a `closed' file handle ** before opening the actual file; so, if there is a memory error, the ** file is not left opened. */ static LStream *newprefile (lua_State *L) { LStream *p = (LStream *)lua_newuserdata(L, sizeof(LStream)); p->closef = NULL; /* mark file handle as 'closed' */ luaL_setmetatable(L, LUA_FILEHANDLE); return p; } static int aux_close (lua_State *L) { LStream *p = tolstream(L); lua_CFunction cf = p->closef; p->closef = NULL; /* mark stream as closed */ return (*cf)(L); /* close it */ } static int io_close (lua_State *L) { if (lua_isnone(L, 1)) /* no argument? */ lua_getfield(L, LUA_REGISTRYINDEX, IO_OUTPUT); /* use standard output */ tofile(L); /* make sure argument is an open stream */ return aux_close(L); } static int f_gc (lua_State *L) { LStream *p = tolstream(L); if (!isclosed(p) && p->f != NULL) aux_close(L); /* ignore closed and incompletely open files */ return 0; } /* ** function to close regular files */ static int io_fclose (lua_State *L) { LStream *p = tolstream(L); int res = fclose(p->f); return luaL_fileresult(L, (res == 0), NULL); } static LStream *newfile (lua_State *L) { LStream *p = newprefile(L); p->f = NULL; p->closef = &io_fclose; return p; } static void opencheck (lua_State *L, const char *fname, const char *mode) { LStream *p = newfile(L); p->f = fopen(fname, mode); if (p->f == NULL) luaL_error(L, "cannot open file " LUA_QS " (%s)", fname, strerror(errno)); } static int io_open (lua_State *L) { const char *filename = luaL_checkstring(L, 1); const char *mode = luaL_optstring(L, 2, "r"); LStream *p = newfile(L); int i = 0; /* check whether 'mode' matches '[rwa]%+?b?' */ if (!(mode[i] != '\0' && strchr("rwa", mode[i++]) != NULL && (mode[i] != '+' || ++i) && /* skip if char is '+' */ (mode[i] != 'b' || ++i) && /* skip if char is 'b' */ (mode[i] == '\0'))) return luaL_error(L, "invalid mode " LUA_QS " (should match " LUA_QL("[rwa]%%+?b?") ")", mode); p->f = fopen(filename, mode); return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; } /* ** function to close 'popen' files */ static int io_pclose (lua_State *L) { LStream *p = tolstream(L); return luaL_execresult(L, lua_pclose(L, p->f)); } static int io_popen (lua_State *L) { const char *filename = luaL_checkstring(L, 1); const char *mode = luaL_optstring(L, 2, "r"); LStream *p = newprefile(L); p->f = lua_popen(L, filename, mode); p->closef = &io_pclose; return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; } static int io_tmpfile (lua_State *L) { LStream *p = newfile(L); p->f = tmpfile(); return (p->f == NULL) ? luaL_fileresult(L, 0, NULL) : 1; } static FILE *getiofile (lua_State *L, const char *findex) { LStream *p; lua_getfield(L, LUA_REGISTRYINDEX, findex); p = (LStream *)lua_touserdata(L, -1); if (isclosed(p)) luaL_error(L, "standard %s file is closed", findex + strlen(IO_PREFIX)); return p->f; } static int g_iofile (lua_State *L, const char *f, const char *mode) { if (!lua_isnoneornil(L, 1)) { const char *filename = lua_tostring(L, 1); if (filename) opencheck(L, filename, mode); else { tofile(L); /* check that it's a valid file handle */ lua_pushvalue(L, 1); } lua_setfield(L, LUA_REGISTRYINDEX, f); } /* return current value */ lua_getfield(L, LUA_REGISTRYINDEX, f); return 1; } static int io_input (lua_State *L) { return g_iofile(L, IO_INPUT, "r"); } static int io_output (lua_State *L) { return g_iofile(L, IO_OUTPUT, "w"); } static int io_readline (lua_State *L); static void aux_lines (lua_State *L, int toclose) { int i; int n = lua_gettop(L) - 1; /* number of arguments to read */ /* ensure that arguments will fit here and into 'io_readline' stack */ luaL_argcheck(L, n <= LUA_MINSTACK - 3, LUA_MINSTACK - 3, "too many options"); lua_pushvalue(L, 1); /* file handle */ lua_pushinteger(L, n); /* number of arguments to read */ lua_pushboolean(L, toclose); /* close/not close file when finished */ for (i = 1; i <= n; i++) lua_pushvalue(L, i + 1); /* copy arguments */ lua_pushcclosure(L, io_readline, 3 + n); } static int f_lines (lua_State *L) { tofile(L); /* check that it's a valid file handle */ aux_lines(L, 0); return 1; } static int io_lines (lua_State *L) { int toclose; if (lua_isnone(L, 1)) lua_pushnil(L); /* at least one argument */ if (lua_isnil(L, 1)) { /* no file name? */ lua_getfield(L, LUA_REGISTRYINDEX, IO_INPUT); /* get default input */ lua_replace(L, 1); /* put it at index 1 */ tofile(L); /* check that it's a valid file handle */ toclose = 0; /* do not close it after iteration */ } else { /* open a new file */ const char *filename = luaL_checkstring(L, 1); opencheck(L, filename, "r"); lua_replace(L, 1); /* put file at index 1 */ toclose = 1; /* close it after iteration */ } aux_lines(L, toclose); return 1; } /* ** {====================================================== ** READ ** ======================================================= */ static int read_number (lua_State *L, FILE *f) { lua_Number d; if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) { lua_pushnumber(L, d); return 1; } else { lua_pushnil(L); /* "result" to be removed */ return 0; /* read fails */ } } static int test_eof (lua_State *L, FILE *f) { int c = getc(f); ungetc(c, f); lua_pushlstring(L, NULL, 0); return (c != EOF); } static int read_line (lua_State *L, FILE *f, int chop) { luaL_Buffer b; luaL_buffinit(L, &b); for (;;) { size_t l; char *p = luaL_prepbuffer(&b); if (fgets(p, LUAL_BUFFERSIZE, f) == NULL) { /* eof? */ luaL_pushresult(&b); /* close buffer */ return (lua_rawlen(L, -1) > 0); /* check whether read something */ } l = strlen(p); if (l == 0 || p[l-1] != '\n') luaL_addsize(&b, l); else { luaL_addsize(&b, l - chop); /* chop 'eol' if needed */ luaL_pushresult(&b); /* close buffer */ return 1; /* read at least an `eol' */ } } } #define MAX_SIZE_T (~(size_t)0) static void read_all (lua_State *L, FILE *f) { size_t rlen = LUAL_BUFFERSIZE; /* how much to read in each cycle */ luaL_Buffer b; luaL_buffinit(L, &b); for (;;) { char *p = luaL_prepbuffsize(&b, rlen); size_t nr = fread(p, sizeof(char), rlen, f); luaL_addsize(&b, nr); if (nr < rlen) break; /* eof? */ else if (rlen <= (MAX_SIZE_T / 4)) /* avoid buffers too large */ rlen *= 2; /* double buffer size at each iteration */ } luaL_pushresult(&b); /* close buffer */ } static int read_chars (lua_State *L, FILE *f, size_t n) { size_t nr; /* number of chars actually read */ char *p; luaL_Buffer b; luaL_buffinit(L, &b); p = luaL_prepbuffsize(&b, n); /* prepare buffer to read whole block */ nr = fread(p, sizeof(char), n, f); /* try to read 'n' chars */ luaL_addsize(&b, nr); luaL_pushresult(&b); /* close buffer */ return (nr > 0); /* true iff read something */ } static int g_read (lua_State *L, FILE *f, int first) { int nargs = lua_gettop(L) - 1; int success; int n; clearerr(f); if (nargs == 0) { /* no arguments? */ success = read_line(L, f, 1); n = first+1; /* to return 1 result */ } else { /* ensure stack space for all results and for auxlib's buffer */ luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments"); success = 1; for (n = first; nargs-- && success; n++) { if (lua_type(L, n) == LUA_TNUMBER) { size_t l = (size_t)lua_tointeger(L, n); success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l); } else { const char *p = lua_tostring(L, n); luaL_argcheck(L, p && p[0] == '*', n, "invalid option"); switch (p[1]) { case 'n': /* number */ success = read_number(L, f); break; case 'l': /* line */ success = read_line(L, f, 1); break; case 'L': /* line with end-of-line */ success = read_line(L, f, 0); break; case 'a': /* file */ read_all(L, f); /* read entire file */ success = 1; /* always success */ break; default: return luaL_argerror(L, n, "invalid format"); } } } } if (ferror(f)) return luaL_fileresult(L, 0, NULL); if (!success) { lua_pop(L, 1); /* remove last result */ lua_pushnil(L); /* push nil instead */ } return n - first; } static int io_read (lua_State *L) { return g_read(L, getiofile(L, IO_INPUT), 1); } static int f_read (lua_State *L) { return g_read(L, tofile(L), 2); } static int io_readline (lua_State *L) { LStream *p = (LStream *)lua_touserdata(L, lua_upvalueindex(1)); int i; int n = (int)lua_tointeger(L, lua_upvalueindex(2)); if (isclosed(p)) /* file is already closed? */ return luaL_error(L, "file is already closed"); lua_settop(L , 1); for (i = 1; i <= n; i++) /* push arguments to 'g_read' */ lua_pushvalue(L, lua_upvalueindex(3 + i)); n = g_read(L, p->f, 2); /* 'n' is number of results */ lua_assert(n > 0); /* should return at least a nil */ if (!lua_isnil(L, -n)) /* read at least one value? */ return n; /* return them */ else { /* first result is nil: EOF or error */ if (n > 1) { /* is there error information? */ /* 2nd result is error message */ return luaL_error(L, "%s", lua_tostring(L, -n + 1)); } if (lua_toboolean(L, lua_upvalueindex(3))) { /* generator created file? */ lua_settop(L, 0); lua_pushvalue(L, lua_upvalueindex(1)); aux_close(L); /* close it */ } return 0; } } /* }====================================================== */ static int g_write (lua_State *L, FILE *f, int arg) { int nargs = lua_gettop(L) - arg; int status = 1; for (; nargs--; arg++) { if (lua_type(L, arg) == LUA_TNUMBER) { /* optimization: could be done exactly as for strings */ status = status && fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)) > 0; } else { size_t l; const char *s = luaL_checklstring(L, arg, &l); status = status && (fwrite(s, sizeof(char), l, f) == l); } } if (status) return 1; /* file handle already on stack top */ else return luaL_fileresult(L, status, NULL); } static int io_write (lua_State *L) { return g_write(L, getiofile(L, IO_OUTPUT), 1); } static int f_write (lua_State *L) { FILE *f = tofile(L); lua_pushvalue(L, 1); /* push file at the stack top (to be returned) */ return g_write(L, f, 2); } static int f_seek (lua_State *L) { static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END}; static const char *const modenames[] = {"set", "cur", "end", NULL}; FILE *f = tofile(L); int op = luaL_checkoption(L, 2, "cur", modenames); lua_Number p3 = luaL_optnumber(L, 3, 0); l_seeknum offset = (l_seeknum)p3; luaL_argcheck(L, (lua_Number)offset == p3, 3, "not an integer in proper range"); op = l_fseek(f, offset, mode[op]); if (op) return luaL_fileresult(L, 0, NULL); /* error */ else { lua_pushnumber(L, (lua_Number)l_ftell(f)); return 1; } } static int f_setvbuf (lua_State *L) { static const int mode[] = {_IONBF, _IOFBF, _IOLBF}; static const char *const modenames[] = {"no", "full", "line", NULL}; FILE *f = tofile(L); int op = luaL_checkoption(L, 2, NULL, modenames); lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE); int res = setvbuf(f, NULL, mode[op], sz); return luaL_fileresult(L, res == 0, NULL); } static int io_flush (lua_State *L) { return luaL_fileresult(L, fflush(getiofile(L, IO_OUTPUT)) == 0, NULL); } static int f_flush (lua_State *L) { return luaL_fileresult(L, fflush(tofile(L)) == 0, NULL); } /* ** functions for 'io' library */ static const luaL_Reg iolib[] = { {"close", io_close}, {"flush", io_flush}, {"input", io_input}, {"lines", io_lines}, {"open", io_open}, {"output", io_output}, {"popen", io_popen}, {"read", io_read}, {"tmpfile", io_tmpfile}, {"type", io_type}, {"write", io_write}, {NULL, NULL} }; /* ** methods for file handles */ static const luaL_Reg flib[] = { {"close", io_close}, {"flush", f_flush}, {"lines", f_lines}, {"read", f_read}, {"seek", f_seek}, {"setvbuf", f_setvbuf}, {"write", f_write}, {"__gc", f_gc}, {"__tostring", f_tostring}, {NULL, NULL} }; static void createmeta (lua_State *L) { luaL_newmetatable(L, LUA_FILEHANDLE); /* create metatable for file handles */ lua_pushvalue(L, -1); /* push metatable */ lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */ luaL_setfuncs(L, flib, 0); /* add file methods to new metatable */ lua_pop(L, 1); /* pop new metatable */ } /* ** function to (not) close the standard files stdin, stdout, and stderr */ static int io_noclose (lua_State *L) { LStream *p = tolstream(L); p->closef = &io_noclose; /* keep file opened */ lua_pushnil(L); lua_pushliteral(L, "cannot close standard file"); return 2; } static void createstdfile (lua_State *L, FILE *f, const char *k, const char *fname) { LStream *p = newprefile(L); p->f = f; p->closef = &io_noclose; if (k != NULL) { lua_pushvalue(L, -1); lua_setfield(L, LUA_REGISTRYINDEX, k); /* add file to registry */ } lua_setfield(L, -2, fname); /* add file to module */ } LUAMOD_API int luaopen_io (lua_State *L) { luaL_newlib(L, iolib); /* new module */ createmeta(L); /* create (and set) default files */ createstdfile(L, stdin, IO_INPUT, "stdin"); createstdfile(L, stdout, IO_OUTPUT, "stdout"); createstdfile(L, stderr, NULL, "stderr"); return 1; } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lmathlib.cpp0000644000175000017500000001457612320456500021033 0ustar mathieumathieu/* ** $Id: lmathlib.c,v 1.80 2011/07/05 12:49:35 roberto Exp $ ** Standard mathematical library ** See Copyright Notice in lua.h */ #include #include #define lmathlib_c #define LUA_LIB #include "lua.h" #include "lauxlib.h" #include "lualib.h" #undef PI #define PI (3.14159265358979323846) #define RADIANS_PER_DEGREE (PI/180.0) /* macro 'l_tg' allows the addition of an 'l' or 'f' to all math operations */ #if !defined(l_tg) #define l_tg(x) (x) #endif static int math_abs (lua_State *L) { lua_pushnumber(L, l_tg(fabs)(luaL_checknumber(L, 1))); return 1; } static int math_sin (lua_State *L) { lua_pushnumber(L, l_tg(sin)(luaL_checknumber(L, 1))); return 1; } static int math_sinh (lua_State *L) { lua_pushnumber(L, l_tg(sinh)(luaL_checknumber(L, 1))); return 1; } static int math_cos (lua_State *L) { lua_pushnumber(L, l_tg(cos)(luaL_checknumber(L, 1))); return 1; } static int math_cosh (lua_State *L) { lua_pushnumber(L, l_tg(cosh)(luaL_checknumber(L, 1))); return 1; } static int math_tan (lua_State *L) { lua_pushnumber(L, l_tg(tan)(luaL_checknumber(L, 1))); return 1; } static int math_tanh (lua_State *L) { lua_pushnumber(L, l_tg(tanh)(luaL_checknumber(L, 1))); return 1; } static int math_asin (lua_State *L) { lua_pushnumber(L, l_tg(asin)(luaL_checknumber(L, 1))); return 1; } static int math_acos (lua_State *L) { lua_pushnumber(L, l_tg(acos)(luaL_checknumber(L, 1))); return 1; } static int math_atan (lua_State *L) { lua_pushnumber(L, l_tg(atan)(luaL_checknumber(L, 1))); return 1; } static int math_atan2 (lua_State *L) { lua_pushnumber(L, l_tg(atan2)(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); return 1; } static int math_ceil (lua_State *L) { lua_pushnumber(L, l_tg(ceil)(luaL_checknumber(L, 1))); return 1; } static int math_floor (lua_State *L) { lua_pushnumber(L, l_tg(floor)(luaL_checknumber(L, 1))); return 1; } static int math_fmod (lua_State *L) { lua_pushnumber(L, l_tg(fmod)(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); return 1; } static int math_modf (lua_State *L) { lua_Number ip; lua_Number fp = l_tg(modf)(luaL_checknumber(L, 1), &ip); lua_pushnumber(L, ip); lua_pushnumber(L, fp); return 2; } static int math_sqrt (lua_State *L) { lua_pushnumber(L, l_tg(sqrt)(luaL_checknumber(L, 1))); return 1; } static int math_pow (lua_State *L) { lua_pushnumber(L, l_tg(pow)(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); return 1; } static int math_log (lua_State *L) { lua_Number x = luaL_checknumber(L, 1); lua_Number res; if (lua_isnoneornil(L, 2)) res = l_tg(log)(x); else { lua_Number base = luaL_checknumber(L, 2); if (base == 10.0) res = l_tg(log10)(x); else res = l_tg(log)(x)/l_tg(log)(base); } lua_pushnumber(L, res); return 1; } #if defined(LUA_COMPAT_LOG10) static int math_log10 (lua_State *L) { lua_pushnumber(L, l_tg(log10)(luaL_checknumber(L, 1))); return 1; } #endif static int math_exp (lua_State *L) { lua_pushnumber(L, l_tg(exp)(luaL_checknumber(L, 1))); return 1; } static int math_deg (lua_State *L) { lua_pushnumber(L, luaL_checknumber(L, 1)/RADIANS_PER_DEGREE); return 1; } static int math_rad (lua_State *L) { lua_pushnumber(L, luaL_checknumber(L, 1)*RADIANS_PER_DEGREE); return 1; } static int math_frexp (lua_State *L) { int e; lua_pushnumber(L, l_tg(frexp)(luaL_checknumber(L, 1), &e)); lua_pushinteger(L, e); return 2; } static int math_ldexp (lua_State *L) { lua_pushnumber(L, l_tg(ldexp)(luaL_checknumber(L, 1), luaL_checkint(L, 2))); return 1; } static int math_min (lua_State *L) { int n = lua_gettop(L); /* number of arguments */ lua_Number dmin = luaL_checknumber(L, 1); int i; for (i=2; i<=n; i++) { lua_Number d = luaL_checknumber(L, i); if (d < dmin) dmin = d; } lua_pushnumber(L, dmin); return 1; } static int math_max (lua_State *L) { int n = lua_gettop(L); /* number of arguments */ lua_Number dmax = luaL_checknumber(L, 1); int i; for (i=2; i<=n; i++) { lua_Number d = luaL_checknumber(L, i); if (d > dmax) dmax = d; } lua_pushnumber(L, dmax); return 1; } static int math_random (lua_State *L) { /* the `%' avoids the (rare) case of r==1, and is needed also because on some systems (SunOS!) `rand()' may return a value larger than RAND_MAX */ lua_Number r = (lua_Number)(rand()%RAND_MAX) / (lua_Number)RAND_MAX; switch (lua_gettop(L)) { /* check number of arguments */ case 0: { /* no arguments */ lua_pushnumber(L, r); /* Number between 0 and 1 */ break; } case 1: { /* only upper limit */ lua_Number u = luaL_checknumber(L, 1); luaL_argcheck(L, 1.0 <= u, 1, "interval is empty"); lua_pushnumber(L, l_tg(floor)(r*u) + 1.0); /* int in [1, u] */ break; } case 2: { /* lower and upper limits */ lua_Number l = luaL_checknumber(L, 1); lua_Number u = luaL_checknumber(L, 2); luaL_argcheck(L, l <= u, 2, "interval is empty"); lua_pushnumber(L, l_tg(floor)(r*(u-l+1)) + l); /* int in [l, u] */ break; } default: return luaL_error(L, "wrong number of arguments"); } return 1; } static int math_randomseed (lua_State *L) { srand(luaL_checkunsigned(L, 1)); (void)rand(); /* discard first value to avoid undesirable correlations */ return 0; } static const luaL_Reg mathlib[] = { {"abs", math_abs}, {"acos", math_acos}, {"asin", math_asin}, {"atan2", math_atan2}, {"atan", math_atan}, {"ceil", math_ceil}, {"cosh", math_cosh}, {"cos", math_cos}, {"deg", math_deg}, {"exp", math_exp}, {"floor", math_floor}, {"fmod", math_fmod}, {"frexp", math_frexp}, {"ldexp", math_ldexp}, #if defined(LUA_COMPAT_LOG10) {"log10", math_log10}, #endif {"log", math_log}, {"max", math_max}, {"min", math_min}, {"modf", math_modf}, {"pow", math_pow}, {"rad", math_rad}, {"random", math_random}, {"randomseed", math_randomseed}, {"sinh", math_sinh}, {"sin", math_sin}, {"sqrt", math_sqrt}, {"tanh", math_tanh}, {"tan", math_tan}, {NULL, NULL} }; /* ** Open math library */ LUAMOD_API int luaopen_math (lua_State *L) { luaL_newlib(L, mathlib); lua_pushnumber(L, PI); lua_setfield(L, -2, "pi"); lua_pushnumber(L, HUGE_VAL); lua_setfield(L, -2, "huge"); return 1; } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lauxlib.h0000644000175000017500000001625412320456500020337 0ustar mathieumathieu/* ** $Id: lauxlib.h,v 1.120 2011/11/29 15:55:08 roberto Exp $ ** Auxiliary functions for building Lua libraries ** See Copyright Notice in lua.h */ #ifndef lauxlib_h #define lauxlib_h #include #include #include "lua.h" /* extra error code for `luaL_load' */ #define LUA_ERRFILE (LUA_ERRERR+1) typedef struct luaL_Reg { const char *name; lua_CFunction func; } luaL_Reg; LUALIB_API void (luaL_checkversion_) (lua_State *L, lua_Number ver); #define luaL_checkversion(L) luaL_checkversion_(L, LUA_VERSION_NUM) LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e); LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e); LUALIB_API const char *(luaL_tolstring) (lua_State *L, int idx, size_t *len); LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg); LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg, size_t *l); LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg, const char *def, size_t *l); LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg); LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def); LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg); LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg, lua_Integer def); LUALIB_API lua_Unsigned (luaL_checkunsigned) (lua_State *L, int numArg); LUALIB_API lua_Unsigned (luaL_optunsigned) (lua_State *L, int numArg, lua_Unsigned def); LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg); LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t); LUALIB_API void (luaL_checkany) (lua_State *L, int narg); LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname); LUALIB_API void (luaL_setmetatable) (lua_State *L, const char *tname); LUALIB_API void *(luaL_testudata) (lua_State *L, int ud, const char *tname); LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname); LUALIB_API void (luaL_where) (lua_State *L, int lvl); LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...); LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def, const char *const lst[]); LUALIB_API int (luaL_fileresult) (lua_State *L, int stat, const char *fname); LUALIB_API int (luaL_execresult) (lua_State *L, int stat); /* pre-defined references */ #define LUA_NOREF (-2) #define LUA_REFNIL (-1) LUALIB_API int (luaL_ref) (lua_State *L, int t); LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref); LUALIB_API int (luaL_loadfilex) (lua_State *L, const char *filename, const char *mode); #define luaL_loadfile(L,f) luaL_loadfilex(L,f,NULL) LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz, const char *name, const char *mode); LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); LUALIB_API lua_State *(luaL_newstate) (void); LUALIB_API int (luaL_len) (lua_State *L, int idx); LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, const char *r); LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup); LUALIB_API int (luaL_getsubtable) (lua_State *L, int idx, const char *fname); LUALIB_API void (luaL_traceback) (lua_State *L, lua_State *L1, const char *msg, int level); LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname, lua_CFunction openf, int glb); /* ** =============================================================== ** some useful macros ** =============================================================== */ #define luaL_newlibtable(L,l) \ lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1) #define luaL_newlib(L,l) (luaL_newlibtable(L,l), luaL_setfuncs(L,l,0)) #define luaL_argcheck(L, cond,numarg,extramsg) \ ((void)((cond) || luaL_argerror(L, (numarg), (extramsg)))) #define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) #define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) #define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) #define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) #define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) #define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) #define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) #define luaL_dofile(L, fn) \ (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0)) #define luaL_dostring(L, s) \ (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0)) #define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) #define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) #define luaL_loadbuffer(L,s,sz,n) luaL_loadbufferx(L,s,sz,n,NULL) /* ** {====================================================== ** Generic Buffer manipulation ** ======================================================= */ typedef struct luaL_Buffer { char *b; /* buffer address */ size_t size; /* buffer size */ size_t n; /* number of characters in buffer */ lua_State *L; char initb[LUAL_BUFFERSIZE]; /* initial buffer */ } luaL_Buffer; #define luaL_addchar(B,c) \ ((void)((B)->n < (B)->size || luaL_prepbuffsize((B), 1)), \ ((B)->b[(B)->n++] = (c))) #define luaL_addsize(B,s) ((B)->n += (s)) LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); LUALIB_API char *(luaL_prepbuffsize) (luaL_Buffer *B, size_t sz); LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s); LUALIB_API void (luaL_addvalue) (luaL_Buffer *B); LUALIB_API void (luaL_pushresult) (luaL_Buffer *B); LUALIB_API void (luaL_pushresultsize) (luaL_Buffer *B, size_t sz); LUALIB_API char *(luaL_buffinitsize) (lua_State *L, luaL_Buffer *B, size_t sz); #define luaL_prepbuffer(B) luaL_prepbuffsize(B, LUAL_BUFFERSIZE) /* }====================================================== */ /* ** {====================================================== ** File handles for IO library ** ======================================================= */ /* ** A file handle is a userdata with metatable 'LUA_FILEHANDLE' and ** initial structure 'luaL_Stream' (it may contain other fields ** after that initial structure). */ #define LUA_FILEHANDLE "FILE*" typedef struct luaL_Stream { FILE *f; /* stream (NULL for incompletely created streams) */ lua_CFunction closef; /* to close stream (NULL for closed streams) */ } luaL_Stream; /* }====================================================== */ /* compatibility with old module system */ #if defined(LUA_COMPAT_MODULE) LUALIB_API void (luaL_pushmodule) (lua_State *L, const char *modname, int sizehint); LUALIB_API void (luaL_openlib) (lua_State *L, const char *libname, const luaL_Reg *l, int nup); #define luaL_register(L,n,l) (luaL_openlib(L,(n),(l),0)) #endif #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lstrlib.cpp0000644000175000017500000006460612320456500020711 0ustar mathieumathieu/* ** $Id: lstrlib.c,v 1.173 2011/11/30 18:24:56 roberto Exp $ ** Standard library for string operations and pattern-matching ** See Copyright Notice in lua.h */ #include #include #include #include #include #define lstrlib_c #define LUA_LIB #include "lua.h" #include "lauxlib.h" #include "lualib.h" /* ** maximum number of captures that a pattern can do during ** pattern-matching. This limit is arbitrary. */ #if !defined(LUA_MAXCAPTURES) #define LUA_MAXCAPTURES 32 #endif /* macro to `unsign' a character */ #define uchar(c) ((unsigned char)(c)) static int str_len (lua_State *L) { size_t l; luaL_checklstring(L, 1, &l); lua_pushinteger(L, (lua_Integer)l); return 1; } /* translate a relative string position: negative means back from end */ static size_t posrelat (ptrdiff_t pos, size_t len) { if (pos >= 0) return (size_t)pos; else if (0u - (size_t)pos > len) return 0; else return len - ((size_t)-pos) + 1; } static int str_sub (lua_State *L) { size_t l; const char *s = luaL_checklstring(L, 1, &l); size_t start = posrelat(luaL_checkinteger(L, 2), l); size_t end = posrelat(luaL_optinteger(L, 3, -1), l); if (start < 1) start = 1; if (end > l) end = l; if (start <= end) lua_pushlstring(L, s + start - 1, end - start + 1); else lua_pushliteral(L, ""); return 1; } static int str_reverse (lua_State *L) { size_t l, i; luaL_Buffer b; const char *s = luaL_checklstring(L, 1, &l); char *p = luaL_buffinitsize(L, &b, l); for (i = 0; i < l; i++) p[i] = s[l - i - 1]; luaL_pushresultsize(&b, l); return 1; } static int str_lower (lua_State *L) { size_t l; size_t i; luaL_Buffer b; const char *s = luaL_checklstring(L, 1, &l); char *p = luaL_buffinitsize(L, &b, l); for (i=0; i> 1) static int str_rep (lua_State *L) { size_t l, lsep; const char *s = luaL_checklstring(L, 1, &l); int n = luaL_checkint(L, 2); const char *sep = luaL_optlstring(L, 3, "", &lsep); if (n <= 0) lua_pushliteral(L, ""); else if (l + lsep < l || l + lsep >= MAXSIZE / n) /* may overflow? */ return luaL_error(L, "resulting string too large"); else { size_t totallen = n * l + (n - 1) * lsep; luaL_Buffer b; char *p = luaL_buffinitsize(L, &b, totallen); while (n-- > 1) { /* first n-1 copies (followed by separator) */ memcpy(p, s, l * sizeof(char)); p += l; memcpy(p, sep, lsep * sizeof(char)); p += lsep; } memcpy(p, s, l * sizeof(char)); /* last copy (not followed by separator) */ luaL_pushresultsize(&b, totallen); } return 1; } static int str_byte (lua_State *L) { size_t l; const char *s = luaL_checklstring(L, 1, &l); size_t posi = posrelat(luaL_optinteger(L, 2, 1), l); size_t pose = posrelat(luaL_optinteger(L, 3, posi), l); int n, i; if (posi < 1) posi = 1; if (pose > l) pose = l; if (posi > pose) return 0; /* empty interval; return no values */ n = (int)(pose - posi + 1); if (posi + n <= pose) /* (size_t -> int) overflow? */ return luaL_error(L, "string slice too long"); luaL_checkstack(L, n, "string slice too long"); for (i=0; i= ms->level || ms->capture[l].len == CAP_UNFINISHED) return luaL_error(ms->L, "invalid capture index %%%d", l + 1); return l; } static int capture_to_close (MatchState *ms) { int level = ms->level; for (level--; level>=0; level--) if (ms->capture[level].len == CAP_UNFINISHED) return level; return luaL_error(ms->L, "invalid pattern capture"); } static const char *classend (MatchState *ms, const char *p) { switch (*p++) { case L_ESC: { if (p == ms->p_end) luaL_error(ms->L, "malformed pattern (ends with " LUA_QL("%%") ")"); return p+1; } case '[': { if (*p == '^') p++; do { /* look for a `]' */ if (p == ms->p_end) luaL_error(ms->L, "malformed pattern (missing " LUA_QL("]") ")"); if (*(p++) == L_ESC && p < ms->p_end) p++; /* skip escapes (e.g. `%]') */ } while (*p != ']'); return p+1; } default: { return p; } } } static int match_class (int c, int cl) { int res; switch (tolower(cl)) { case 'a' : res = isalpha(c); break; case 'c' : res = iscntrl(c); break; case 'd' : res = isdigit(c); break; case 'g' : res = isgraph(c); break; case 'l' : res = islower(c); break; case 'p' : res = ispunct(c); break; case 's' : res = isspace(c); break; case 'u' : res = isupper(c); break; case 'w' : res = isalnum(c); break; case 'x' : res = isxdigit(c); break; case 'z' : res = (c == 0); break; /* deprecated option */ default: return (cl == c); } return (islower(cl) ? res : !res); } static int matchbracketclass (int c, const char *p, const char *ec) { int sig = 1; if (*(p+1) == '^') { sig = 0; p++; /* skip the `^' */ } while (++p < ec) { if (*p == L_ESC) { p++; if (match_class(c, uchar(*p))) return sig; } else if ((*(p+1) == '-') && (p+2 < ec)) { p+=2; if (uchar(*(p-2)) <= c && c <= uchar(*p)) return sig; } else if (uchar(*p) == c) return sig; } return !sig; } static int singlematch (int c, const char *p, const char *ep) { switch (*p) { case '.': return 1; /* matches any char */ case L_ESC: return match_class(c, uchar(*(p+1))); case '[': return matchbracketclass(c, p, ep-1); default: return (uchar(*p) == c); } } static const char *match (MatchState *ms, const char *s, const char *p); static const char *matchbalance (MatchState *ms, const char *s, const char *p) { if (p >= ms->p_end - 1) luaL_error(ms->L, "malformed pattern " "(missing arguments to " LUA_QL("%%b") ")"); if (*s != *p) return NULL; else { int b = *p; int e = *(p+1); int cont = 1; while (++s < ms->src_end) { if (*s == e) { if (--cont == 0) return s+1; } else if (*s == b) cont++; } } return NULL; /* string ends out of balance */ } static const char *max_expand (MatchState *ms, const char *s, const char *p, const char *ep) { ptrdiff_t i = 0; /* counts maximum expand for item */ while ((s+i)src_end && singlematch(uchar(*(s+i)), p, ep)) i++; /* keeps trying to match with the maximum repetitions */ while (i>=0) { const char *res = match(ms, (s+i), ep+1); if (res) return res; i--; /* else didn't match; reduce 1 repetition to try again */ } return NULL; } static const char *min_expand (MatchState *ms, const char *s, const char *p, const char *ep) { for (;;) { const char *res = match(ms, s, ep+1); if (res != NULL) return res; else if (ssrc_end && singlematch(uchar(*s), p, ep)) s++; /* try with one more repetition */ else return NULL; } } static const char *start_capture (MatchState *ms, const char *s, const char *p, int what) { const char *res; int level = ms->level; if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures"); ms->capture[level].init = s; ms->capture[level].len = what; ms->level = level+1; if ((res=match(ms, s, p)) == NULL) /* match failed? */ ms->level--; /* undo capture */ return res; } static const char *end_capture (MatchState *ms, const char *s, const char *p) { int l = capture_to_close(ms); const char *res; ms->capture[l].len = s - ms->capture[l].init; /* close capture */ if ((res = match(ms, s, p)) == NULL) /* match failed? */ ms->capture[l].len = CAP_UNFINISHED; /* undo capture */ return res; } static const char *match_capture (MatchState *ms, const char *s, int l) { size_t len; l = check_capture(ms, l); len = ms->capture[l].len; if ((size_t)(ms->src_end-s) >= len && memcmp(ms->capture[l].init, s, len) == 0) return s+len; else return NULL; } static const char *match (MatchState *ms, const char *s, const char *p) { init: /* using goto's to optimize tail recursion */ if (p == ms->p_end) /* end of pattern? */ return s; /* match succeeded */ switch (*p) { case '(': { /* start capture */ if (*(p+1) == ')') /* position capture? */ return start_capture(ms, s, p+2, CAP_POSITION); else return start_capture(ms, s, p+1, CAP_UNFINISHED); } case ')': { /* end capture */ return end_capture(ms, s, p+1); } case '$': { if ((p+1) == ms->p_end) /* is the `$' the last char in pattern? */ return (s == ms->src_end) ? s : NULL; /* check end of string */ else goto dflt; } case L_ESC: { /* escaped sequences not in the format class[*+?-]? */ switch (*(p+1)) { case 'b': { /* balanced string? */ s = matchbalance(ms, s, p+2); if (s == NULL) return NULL; p+=4; goto init; /* else return match(ms, s, p+4); */ } case 'f': { /* frontier? */ const char *ep; char previous; p += 2; if (*p != '[') luaL_error(ms->L, "missing " LUA_QL("[") " after " LUA_QL("%%f") " in pattern"); ep = classend(ms, p); /* points to what is next */ previous = (s == ms->src_init) ? '\0' : *(s-1); if (matchbracketclass(uchar(previous), p, ep-1) || !matchbracketclass(uchar(*s), p, ep-1)) return NULL; p=ep; goto init; /* else return match(ms, s, ep); */ } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { /* capture results (%0-%9)? */ s = match_capture(ms, s, uchar(*(p+1))); if (s == NULL) return NULL; p+=2; goto init; /* else return match(ms, s, p+2) */ } default: goto dflt; } } default: dflt: { /* pattern class plus optional suffix */ const char *ep = classend(ms, p); /* points to what is next */ int m = s < ms->src_end && singlematch(uchar(*s), p, ep); switch (*ep) { case '?': { /* optional */ const char *res; if (m && ((res=match(ms, s+1, ep+1)) != NULL)) return res; p=ep+1; goto init; /* else return match(ms, s, ep+1); */ } case '*': { /* 0 or more repetitions */ return max_expand(ms, s, p, ep); } case '+': { /* 1 or more repetitions */ return (m ? max_expand(ms, s+1, p, ep) : NULL); } case '-': { /* 0 or more repetitions (minimum) */ return min_expand(ms, s, p, ep); } default: { if (!m) return NULL; s++; p=ep; goto init; /* else return match(ms, s+1, ep); */ } } } } } static const char *lmemfind (const char *s1, size_t l1, const char *s2, size_t l2) { if (l2 == 0) return s1; /* empty strings are everywhere */ else if (l2 > l1) return NULL; /* avoids a negative `l1' */ else { const char *init; /* to search for a `*s2' inside `s1' */ l2--; /* 1st char will be checked by `memchr' */ l1 = l1-l2; /* `s2' cannot be found after that */ while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) { init++; /* 1st char is already checked */ if (memcmp(init, s2+1, l2) == 0) return init-1; else { /* correct `l1' and `s1' to try again */ l1 -= init-s1; s1 = init; } } return NULL; /* not found */ } } static void push_onecapture (MatchState *ms, int i, const char *s, const char *e) { if (i >= ms->level) { if (i == 0) /* ms->level == 0, too */ lua_pushlstring(ms->L, s, e - s); /* add whole match */ else luaL_error(ms->L, "invalid capture index"); } else { ptrdiff_t l = ms->capture[i].len; if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture"); if (l == CAP_POSITION) lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1); else lua_pushlstring(ms->L, ms->capture[i].init, l); } } static int push_captures (MatchState *ms, const char *s, const char *e) { int i; int nlevels = (ms->level == 0 && s) ? 1 : ms->level; luaL_checkstack(ms->L, nlevels, "too many captures"); for (i = 0; i < nlevels; i++) push_onecapture(ms, i, s, e); return nlevels; /* number of strings pushed */ } /* check whether pattern has no special characters */ static int nospecials (const char *p, size_t l) { size_t upto = 0; do { if (strpbrk(p + upto, SPECIALS)) return 0; /* pattern has a special character */ upto += strlen(p + upto) + 1; /* may have more after \0 */ } while (upto <= l); return 1; /* no special chars found */ } static int str_find_aux (lua_State *L, int find) { size_t ls, lp; const char *s = luaL_checklstring(L, 1, &ls); const char *p = luaL_checklstring(L, 2, &lp); size_t init = posrelat(luaL_optinteger(L, 3, 1), ls); if (init < 1) init = 1; else if (init > ls + 1) { /* start after string's end? */ lua_pushnil(L); /* cannot find anything */ return 1; } /* explicit request or no special characters? */ if (find && (lua_toboolean(L, 4) || nospecials(p, lp))) { /* do a plain search */ const char *s2 = lmemfind(s + init - 1, ls - init + 1, p, lp); if (s2) { lua_pushinteger(L, s2 - s + 1); lua_pushinteger(L, s2 - s + lp); return 2; } } else { MatchState ms; const char *s1 = s + init - 1; int anchor = (*p == '^'); if (anchor) { p++; lp--; /* skip anchor character */ } ms.L = L; ms.src_init = s; ms.src_end = s + ls; ms.p_end = p + lp; do { const char *res; ms.level = 0; if ((res=match(&ms, s1, p)) != NULL) { if (find) { lua_pushinteger(L, s1 - s + 1); /* start */ lua_pushinteger(L, res - s); /* end */ return push_captures(&ms, NULL, 0) + 2; } else return push_captures(&ms, s1, res); } } while (s1++ < ms.src_end && !anchor); } lua_pushnil(L); /* not found */ return 1; } static int str_find (lua_State *L) { return str_find_aux(L, 1); } static int str_match (lua_State *L) { return str_find_aux(L, 0); } static int gmatch_aux (lua_State *L) { MatchState ms; size_t ls, lp; const char *s = lua_tolstring(L, lua_upvalueindex(1), &ls); const char *p = lua_tolstring(L, lua_upvalueindex(2), &lp); const char *src; ms.L = L; ms.src_init = s; ms.src_end = s+ls; ms.p_end = p + lp; for (src = s + (size_t)lua_tointeger(L, lua_upvalueindex(3)); src <= ms.src_end; src++) { const char *e; ms.level = 0; if ((e = match(&ms, src, p)) != NULL) { lua_Integer newstart = e-s; if (e == src) newstart++; /* empty match? go at least one position */ lua_pushinteger(L, newstart); lua_replace(L, lua_upvalueindex(3)); return push_captures(&ms, src, e); } } return 0; /* not found */ } static int gmatch (lua_State *L) { luaL_checkstring(L, 1); luaL_checkstring(L, 2); lua_settop(L, 2); lua_pushinteger(L, 0); lua_pushcclosure(L, gmatch_aux, 3); return 1; } static void add_s (MatchState *ms, luaL_Buffer *b, const char *s, const char *e) { size_t l, i; const char *news = lua_tolstring(ms->L, 3, &l); for (i = 0; i < l; i++) { if (news[i] != L_ESC) luaL_addchar(b, news[i]); else { i++; /* skip ESC */ if (!isdigit(uchar(news[i]))) { if (news[i] != L_ESC) luaL_error(ms->L, "invalid use of " LUA_QL("%c") " in replacement string", L_ESC); luaL_addchar(b, news[i]); } else if (news[i] == '0') luaL_addlstring(b, s, e - s); else { push_onecapture(ms, news[i] - '1', s, e); luaL_addvalue(b); /* add capture to accumulated result */ } } } } static void add_value (MatchState *ms, luaL_Buffer *b, const char *s, const char *e, int tr) { lua_State *L = ms->L; switch (tr) { case LUA_TFUNCTION: { int n; lua_pushvalue(L, 3); n = push_captures(ms, s, e); lua_call(L, n, 1); break; } case LUA_TTABLE: { push_onecapture(ms, 0, s, e); lua_gettable(L, 3); break; } default: { /* LUA_TNUMBER or LUA_TSTRING */ add_s(ms, b, s, e); return; } } if (!lua_toboolean(L, -1)) { /* nil or false? */ lua_pop(L, 1); lua_pushlstring(L, s, e - s); /* keep original text */ } else if (!lua_isstring(L, -1)) luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1)); luaL_addvalue(b); /* add result to accumulator */ } static int str_gsub (lua_State *L) { size_t srcl, lp; const char *src = luaL_checklstring(L, 1, &srcl); const char *p = luaL_checklstring(L, 2, &lp); int tr = lua_type(L, 3); size_t max_s = luaL_optinteger(L, 4, srcl+1); int anchor = (*p == '^'); size_t n = 0; MatchState ms; luaL_Buffer b; luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING || tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3, "string/function/table expected"); luaL_buffinit(L, &b); if (anchor) { p++; lp--; /* skip anchor character */ } ms.L = L; ms.src_init = src; ms.src_end = src+srcl; ms.p_end = p + lp; while (n < max_s) { const char *e; ms.level = 0; e = match(&ms, src, p); if (e) { n++; add_value(&ms, &b, src, e, tr); } if (e && e>src) /* non empty match? */ src = e; /* skip it */ else if (src < ms.src_end) luaL_addchar(&b, *src++); else break; if (anchor) break; } luaL_addlstring(&b, src, ms.src_end-src); luaL_pushresult(&b); lua_pushinteger(L, n); /* number of substitutions */ return 2; } /* }====================================================== */ /* ** {====================================================== ** STRING FORMAT ** ======================================================= */ /* ** LUA_INTFRMLEN is the length modifier for integer conversions in ** 'string.format'; LUA_INTFRM_T is the integer type corresponding to ** the previous length */ #if !defined(LUA_INTFRMLEN) /* { */ #if defined(LUA_USE_LONGLONG) #define LUA_INTFRMLEN "ll" #define LUA_INTFRM_T long long #else #define LUA_INTFRMLEN "l" #define LUA_INTFRM_T long #endif #endif /* } */ #define MAX_UINTFRM ((lua_Number)(~(unsigned LUA_INTFRM_T)0)) #define MAX_INTFRM ((lua_Number)((~(unsigned LUA_INTFRM_T)0)/2)) #define MIN_INTFRM (-(lua_Number)((~(unsigned LUA_INTFRM_T)0)/2) - 1) /* ** LUA_FLTFRMLEN is the length modifier for float conversions in ** 'string.format'; LUA_FLTFRM_T is the float type corresponding to ** the previous length */ #if !defined(LUA_FLTFRMLEN) #define LUA_FLTFRMLEN "" #define LUA_FLTFRM_T double #endif /* maximum size of each formatted item (> len(format('%99.99f', -1e308))) */ #define MAX_ITEM 512 /* valid flags in a format specification */ #define FLAGS "-+ #0" /* ** maximum size of each format specification (such as '%-099.99d') ** (+10 accounts for %99.99x plus margin of error) */ #define MAX_FORMAT (sizeof(FLAGS) + sizeof(LUA_INTFRMLEN) + 10) static void addquoted (lua_State *L, luaL_Buffer *b, int arg) { size_t l; const char *s = luaL_checklstring(L, arg, &l); luaL_addchar(b, '"'); while (l--) { if (*s == '"' || *s == '\\' || *s == '\n') { luaL_addchar(b, '\\'); luaL_addchar(b, *s); } else if (*s == '\0' || iscntrl(uchar(*s))) { char buff[10]; if (!isdigit(uchar(*(s+1)))) sprintf(buff, "\\%d", (int)uchar(*s)); else sprintf(buff, "\\%03d", (int)uchar(*s)); luaL_addstring(b, buff); } else luaL_addchar(b, *s); s++; } luaL_addchar(b, '"'); } static const char *scanformat (lua_State *L, const char *strfrmt, char *form) { const char *p = strfrmt; while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++; /* skip flags */ if ((size_t)(p - strfrmt) >= sizeof(FLAGS)/sizeof(char)) luaL_error(L, "invalid format (repeated flags)"); if (isdigit(uchar(*p))) p++; /* skip width */ if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ if (*p == '.') { p++; if (isdigit(uchar(*p))) p++; /* skip precision */ if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ } if (isdigit(uchar(*p))) luaL_error(L, "invalid format (width or precision too long)"); *(form++) = '%'; memcpy(form, strfrmt, (p - strfrmt + 1) * sizeof(char)); form += p - strfrmt + 1; *form = '\0'; return p; } /* ** add length modifier into formats */ static void addlenmod (char *form, const char *lenmod) { size_t l = strlen(form); size_t lm = strlen(lenmod); char spec = form[l - 1]; strcpy(form + l - 1, lenmod); form[l + lm - 1] = spec; form[l + lm] = '\0'; } static int str_format (lua_State *L) { int top = lua_gettop(L); int arg = 1; size_t sfl; const char *strfrmt = luaL_checklstring(L, arg, &sfl); const char *strfrmt_end = strfrmt+sfl; luaL_Buffer b; luaL_buffinit(L, &b); while (strfrmt < strfrmt_end) { if (*strfrmt != L_ESC) luaL_addchar(&b, *strfrmt++); else if (*++strfrmt == L_ESC) luaL_addchar(&b, *strfrmt++); /* %% */ else { /* format item */ char form[MAX_FORMAT]; /* to store the format (`%...') */ char *buff = luaL_prepbuffsize(&b, MAX_ITEM); /* to put formatted item */ int nb = 0; /* number of bytes in added item */ if (++arg > top) luaL_argerror(L, arg, "no value"); strfrmt = scanformat(L, strfrmt, form); switch (*strfrmt++) { case 'c': { nb = sprintf(buff, form, luaL_checkint(L, arg)); break; } case 'd': case 'i': { lua_Number n = luaL_checknumber(L, arg); luaL_argcheck(L, (MIN_INTFRM - 1) < n && n < (MAX_INTFRM + 1), arg, "not a number in proper range"); addlenmod(form, LUA_INTFRMLEN); nb = sprintf(buff, form, (LUA_INTFRM_T)n); break; } case 'o': case 'u': case 'x': case 'X': { lua_Number n = luaL_checknumber(L, arg); luaL_argcheck(L, 0 <= n && n < (MAX_UINTFRM + 1), arg, "not a non-negative number in proper range"); addlenmod(form, LUA_INTFRMLEN); nb = sprintf(buff, form, (unsigned LUA_INTFRM_T)n); break; } case 'e': case 'E': case 'f': #if defined(LUA_USE_AFORMAT) case 'a': case 'A': #endif case 'g': case 'G': { addlenmod(form, LUA_FLTFRMLEN); nb = sprintf(buff, form, (LUA_FLTFRM_T)luaL_checknumber(L, arg)); break; } case 'q': { addquoted(L, &b, arg); break; } case 's': { size_t l; const char *s = luaL_tolstring(L, arg, &l); if (!strchr(form, '.') && l >= 100) { /* no precision and string is too long to be formatted; keep original string */ luaL_addvalue(&b); break; } else { nb = sprintf(buff, form, s); lua_pop(L, 1); /* remove result from 'luaL_tolstring' */ break; } } default: { /* also treat cases `pnLlh' */ return luaL_error(L, "invalid option " LUA_QL("%%%c") " to " LUA_QL("format"), *(strfrmt - 1)); } } luaL_addsize(&b, nb); } } luaL_pushresult(&b); return 1; } /* }====================================================== */ static const luaL_Reg strlib[] = { {"byte", str_byte}, {"char", str_char}, {"dump", str_dump}, {"find", str_find}, {"format", str_format}, {"gmatch", gmatch}, {"gsub", str_gsub}, {"len", str_len}, {"lower", str_lower}, {"match", str_match}, {"rep", str_rep}, {"reverse", str_reverse}, {"sub", str_sub}, {"upper", str_upper}, {NULL, NULL} }; static void createmetatable (lua_State *L) { lua_createtable(L, 0, 1); /* table to be metatable for strings */ lua_pushliteral(L, ""); /* dummy string */ lua_pushvalue(L, -2); /* copy table */ lua_setmetatable(L, -2); /* set table as metatable for strings */ lua_pop(L, 1); /* pop dummy string */ lua_pushvalue(L, -2); /* get string library */ lua_setfield(L, -2, "__index"); /* metatable.__index = string */ lua_pop(L, 1); /* pop metatable */ } /* ** Open string library */ LUAMOD_API int luaopen_string (lua_State *L) { luaL_newlib(L, strlib); createmetatable(L); return 1; } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lobject.h0000644000175000017500000003422612320456500020320 0ustar mathieumathieu/* ** $Id: lobject.h,v 2.64 2011/10/31 17:48:22 roberto Exp $ ** Type definitions for Lua objects ** See Copyright Notice in lua.h */ #ifndef lobject_h #define lobject_h #include #include "llimits.h" #include "lua.h" /* ** Extra tags for non-values */ #define LUA_TPROTO LUA_NUMTAGS #define LUA_TUPVAL (LUA_NUMTAGS+1) #define LUA_TDEADKEY (LUA_NUMTAGS+2) /* ** number of all possible tags (including LUA_TNONE but excluding DEADKEY) */ #define LUA_TOTALTAGS (LUA_TUPVAL+2) /* ** tags for Tagged Values have the following use of bits: ** bits 0-3: actual tag (a LUA_T* value) ** bits 4-5: variant bits ** bit 6: whether value is collectable */ /* ** LUA_TFUNCTION variants: ** 0 - Lua function ** 1 - light C function ** 2 - regular C function (closure) */ /* Variant tags for functions */ #define LUA_TLCL (LUA_TFUNCTION | (0 << 4)) /* Lua closure */ #define LUA_TLCF (LUA_TFUNCTION | (1 << 4)) /* light C function */ #define LUA_TCCL (LUA_TFUNCTION | (2 << 4)) /* C closure */ /* Bit mark for collectable types */ #define BIT_ISCOLLECTABLE (1 << 6) /* mark a tag as collectable */ #define ctb(t) ((t) | BIT_ISCOLLECTABLE) /* ** Union of all collectable objects */ typedef union GCObject GCObject; /* ** Common Header for all collectable objects (in macro form, to be ** included in other objects) */ #define CommonHeader GCObject *next; lu_byte tt; lu_byte marked /* ** Common header in struct form */ typedef struct GCheader { CommonHeader; } GCheader; /* ** Union of all Lua values */ typedef union Value Value; #define numfield lua_Number n; /* numbers */ /* ** Tagged Values. This is the basic representation of values in Lua, ** an actual value plus a tag with its type. */ #define TValuefields Value value_; int tt_ typedef struct lua_TValue TValue; /* macro defining a nil value */ #define NILCONSTANT {NULL}, LUA_TNIL #define val_(o) ((o)->value_) #define num_(o) (val_(o).n) /* raw type tag of a TValue */ #define rttype(o) ((o)->tt_) /* type tag of a TValue (bits 0-3 for tags + variant bits 4-5) */ #define ttype(o) (rttype(o) & 0x3F) /* type tag of a TValue with no variants (bits 0-3) */ #define ttypenv(o) (rttype(o) & 0x0F) /* Macros to test type */ #define checktag(o,t) (rttype(o) == (t)) #define ttisnumber(o) checktag((o), LUA_TNUMBER) #define ttisnil(o) checktag((o), LUA_TNIL) #define ttisboolean(o) checktag((o), LUA_TBOOLEAN) #define ttislightuserdata(o) checktag((o), LUA_TLIGHTUSERDATA) #define ttisstring(o) checktag((o), ctb(LUA_TSTRING)) #define ttistable(o) checktag((o), ctb(LUA_TTABLE)) #define ttisfunction(o) (ttypenv(o) == LUA_TFUNCTION) #define ttisclosure(o) ((rttype(o) & 0x1F) == LUA_TFUNCTION) #define ttisCclosure(o) checktag((o), ctb(LUA_TCCL)) #define ttisLclosure(o) checktag((o), ctb(LUA_TLCL)) #define ttislcf(o) checktag((o), LUA_TLCF) #define ttisuserdata(o) checktag((o), ctb(LUA_TUSERDATA)) #define ttisthread(o) checktag((o), ctb(LUA_TTHREAD)) #define ttisdeadkey(o) checktag((o), LUA_TDEADKEY) #define ttisequal(o1,o2) (rttype(o1) == rttype(o2)) /* Macros to access values */ #define nvalue(o) check_exp(ttisnumber(o), num_(o)) #define gcvalue(o) check_exp(iscollectable(o), val_(o).gc) #define pvalue(o) check_exp(ttislightuserdata(o), val_(o).p) #define rawtsvalue(o) check_exp(ttisstring(o), &val_(o).gc->ts) #define tsvalue(o) (&rawtsvalue(o)->tsv) #define rawuvalue(o) check_exp(ttisuserdata(o), &val_(o).gc->u) #define uvalue(o) (&rawuvalue(o)->uv) #define clvalue(o) check_exp(ttisclosure(o), &val_(o).gc->cl) #define clLvalue(o) check_exp(ttisLclosure(o), &val_(o).gc->cl.l) #define clCvalue(o) check_exp(ttisCclosure(o), &val_(o).gc->cl.c) #define fvalue(o) check_exp(ttislcf(o), val_(o).f) #define hvalue(o) check_exp(ttistable(o), &val_(o).gc->h) #define bvalue(o) check_exp(ttisboolean(o), val_(o).b) #define thvalue(o) check_exp(ttisthread(o), &val_(o).gc->th) /* a dead value may get the 'gc' field, but cannot access its contents */ #define deadvalue(o) check_exp(ttisdeadkey(o), cast(void *, val_(o).gc)) #define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) #define iscollectable(o) (rttype(o) & BIT_ISCOLLECTABLE) /* Macros for internal tests */ #define righttt(obj) (ttypenv(obj) == gcvalue(obj)->gch.tt) #define checkliveness(g,obj) \ lua_longassert(!iscollectable(obj) || \ (righttt(obj) && !isdead(g,gcvalue(obj)))) /* Macros to set values */ #define settt_(o,t) ((o)->tt_=(t)) #define setnvalue(obj,x) \ { TValue *io=(obj); num_(io)=(x); settt_(io, LUA_TNUMBER); } #define changenvalue(o,x) check_exp(ttisnumber(o), num_(o)=(x)) #define setnilvalue(obj) settt_(obj, LUA_TNIL) #define setfvalue(obj,x) \ { TValue *io=(obj); val_(io).f=(x); settt_(io, LUA_TLCF); } #define setpvalue(obj,x) \ { TValue *io=(obj); val_(io).p=(x); settt_(io, LUA_TLIGHTUSERDATA); } #define setbvalue(obj,x) \ { TValue *io=(obj); val_(io).b=(x); settt_(io, LUA_TBOOLEAN); } #define setgcovalue(L,obj,x) \ { TValue *io=(obj); GCObject *i_g=(x); \ val_(io).gc=i_g; settt_(io, ctb(gch(i_g)->tt)); } #define setsvalue(L,obj,x) \ { TValue *io=(obj); \ val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TSTRING)); \ checkliveness(G(L),io); } #define setuvalue(L,obj,x) \ { TValue *io=(obj); \ val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TUSERDATA)); \ checkliveness(G(L),io); } #define setthvalue(L,obj,x) \ { TValue *io=(obj); \ val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TTHREAD)); \ checkliveness(G(L),io); } #define setclLvalue(L,obj,x) \ { TValue *io=(obj); \ val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TLCL)); \ checkliveness(G(L),io); } #define setclCvalue(L,obj,x) \ { TValue *io=(obj); \ val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TCCL)); \ checkliveness(G(L),io); } #define sethvalue(L,obj,x) \ { TValue *io=(obj); \ val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TTABLE)); \ checkliveness(G(L),io); } #define setptvalue(L,obj,x) \ { TValue *io=(obj); \ val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TPROTO)); \ checkliveness(G(L),io); } #define setdeadvalue(obj) settt_(obj, LUA_TDEADKEY) #define setobj(L,obj1,obj2) \ { const TValue *io2=(obj2); TValue *io1=(obj1); \ io1->value_ = io2->value_; io1->tt_ = io2->tt_; \ checkliveness(G(L),io1); } /* ** different types of assignments, according to destination */ /* from stack to (same) stack */ #define setobjs2s setobj /* to stack (not from same stack) */ #define setobj2s setobj #define setsvalue2s setsvalue #define sethvalue2s sethvalue #define setptvalue2s setptvalue /* from table to same table */ #define setobjt2t setobj /* to table */ #define setobj2t setobj /* to new object */ #define setobj2n setobj #define setsvalue2n setsvalue /* ** {====================================================== ** NaN Trick ** ======================================================= */ #if defined(LUA_NANTRICK) \ || defined(LUA_NANTRICK_LE) \ || defined(LUA_NANTRICK_BE) /* ** numbers are represented in the 'd_' field. All other values have the ** value (NNMARK | tag) in 'tt__'. A number with such pattern would be ** a "signaled NaN", which is never generated by regular operations by ** the CPU (nor by 'strtod') */ #if !defined(NNMARK) #define NNMARK 0x7FF7A500 #define NNMASK 0x7FFFFF00 #endif #undef TValuefields #undef NILCONSTANT #if defined(LUA_NANTRICK_LE) /* little endian */ #define TValuefields \ union { struct { Value v__; int tt__; } i; double d__; } u #define NILCONSTANT {{{NULL}, tag2tt(LUA_TNIL)}} /* field-access macros */ #define v_(o) ((o)->u.i.v__) #define d_(o) ((o)->u.d__) #define tt_(o) ((o)->u.i.tt__) #elif defined(LUA_NANTRICK_BE) /* big endian */ #define TValuefields \ union { struct { int tt__; Value v__; } i; double d__; } u #define NILCONSTANT {{tag2tt(LUA_TNIL), {NULL}}} /* field-access macros */ #define v_(o) ((o)->u.i.v__) #define d_(o) ((o)->u.d__) #define tt_(o) ((o)->u.i.tt__) #elif !defined(TValuefields) #error option 'LUA_NANTRICK' needs declaration for 'TValuefields' #endif /* correspondence with standard representation */ #undef val_ #define val_(o) v_(o) #undef num_ #define num_(o) d_(o) #undef numfield #define numfield /* no such field; numbers are the entire struct */ /* basic check to distinguish numbers from non-numbers */ #undef ttisnumber #define ttisnumber(o) ((tt_(o) & NNMASK) != NNMARK) #define tag2tt(t) (NNMARK | (t)) #undef rttype #define rttype(o) (ttisnumber(o) ? LUA_TNUMBER : tt_(o) & 0xff) #undef settt_ #define settt_(o,t) (tt_(o) = tag2tt(t)) #undef setnvalue #define setnvalue(obj,x) \ { TValue *io_=(obj); num_(io_)=(x); lua_assert(ttisnumber(io_)); } #undef setobj #define setobj(L,obj1,obj2) \ { const TValue *o2_=(obj2); TValue *o1_=(obj1); \ o1_->u = o2_->u; \ checkliveness(G(L),o1_); } /* ** these redefinitions are not mandatory, but these forms are more efficient */ #undef checktag #define checktag(o,t) (tt_(o) == tag2tt(t)) #undef ttisequal #define ttisequal(o1,o2) \ (ttisnumber(o1) ? ttisnumber(o2) : (tt_(o1) == tt_(o2))) #define luai_checknum(L,o,c) { if (!ttisnumber(o)) c; } #else #define luai_checknum(L,o,c) { /* empty */ } #endif /* }====================================================== */ /* ** {====================================================== ** types and prototypes ** ======================================================= */ union Value { GCObject *gc; /* collectable objects */ void *p; /* light userdata */ int b; /* booleans */ lua_CFunction f; /* light C functions */ numfield /* numbers */ }; struct lua_TValue { TValuefields; }; typedef TValue *StkId; /* index to stack elements */ /* ** Header for string value; string bytes follow the end of this structure */ typedef union TString { L_Umaxalign dummy; /* ensures maximum alignment for strings */ struct { CommonHeader; lu_byte reserved; unsigned int hash; size_t len; /* number of characters in string */ } tsv; } TString; /* get the actual string (array of bytes) from a TString */ #define getstr(ts) cast(const char *, (ts) + 1) /* get the actual string (array of bytes) from a Lua value */ #define svalue(o) getstr(rawtsvalue(o)) /* ** Header for userdata; memory area follows the end of this structure */ typedef union Udata { L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */ struct { CommonHeader; struct Table *metatable; struct Table *env; size_t len; /* number of bytes */ } uv; } Udata; /* ** Description of an upvalue for function prototypes */ typedef struct Upvaldesc { TString *name; /* upvalue name (for debug information) */ lu_byte instack; /* whether it is in stack */ lu_byte idx; /* index of upvalue (in stack or in outer function's list) */ } Upvaldesc; /* ** Description of a local variable for function prototypes ** (used for debug information) */ typedef struct LocVar { TString *varname; int startpc; /* first point where variable is active */ int endpc; /* first point where variable is dead */ } LocVar; /* ** Function Prototypes */ typedef struct Proto { CommonHeader; TValue *k; /* constants used by the function */ Instruction *code; struct Proto **p; /* functions defined inside the function */ int *lineinfo; /* map from opcodes to source lines (debug information) */ LocVar *locvars; /* information about local variables (debug information) */ Upvaldesc *upvalues; /* upvalue information */ union Closure *cache; /* last created closure with this prototype */ TString *source; /* used for debug information */ int sizeupvalues; /* size of 'upvalues' */ int sizek; /* size of `k' */ int sizecode; int sizelineinfo; int sizep; /* size of `p' */ int sizelocvars; int linedefined; int lastlinedefined; GCObject *gclist; lu_byte numparams; /* number of fixed parameters */ lu_byte is_vararg; lu_byte maxstacksize; /* maximum stack used by this function */ } Proto; /* ** Lua Upvalues */ typedef struct UpVal { CommonHeader; TValue *v; /* points to stack or to its own value */ union { TValue value; /* the value (when closed) */ struct { /* double linked list (when open) */ struct UpVal *prev; struct UpVal *next; } l; } u; } UpVal; /* ** Closures */ #define ClosureHeader \ CommonHeader; lu_byte isC; lu_byte nupvalues; GCObject *gclist typedef struct CClosure { ClosureHeader; lua_CFunction f; TValue upvalue[1]; /* list of upvalues */ } CClosure; typedef struct LClosure { ClosureHeader; struct Proto *p; UpVal *upvals[1]; /* list of upvalues */ } LClosure; typedef union Closure { CClosure c; LClosure l; } Closure; #define isLfunction(o) ttisLclosure(o) #define getproto(o) (clLvalue(o)->p) /* ** Tables */ typedef union TKey { struct { TValuefields; struct Node *next; /* for chaining */ } nk; TValue tvk; } TKey; typedef struct Node { TValue i_val; TKey i_key; } Node; typedef struct Table { CommonHeader; lu_byte flags; /* 1<

lsizenode)) /* ** (address of) a fixed nil value */ #define luaO_nilobject (&luaO_nilobject_) LUAI_DDEC const TValue luaO_nilobject_; LUAI_FUNC int luaO_int2fb (unsigned int x); LUAI_FUNC int luaO_fb2int (int x); LUAI_FUNC int luaO_ceillog2 (unsigned int x); LUAI_FUNC lua_Number luaO_arith (int op, lua_Number v1, lua_Number v2); LUAI_FUNC int luaO_str2d (const char *s, size_t len, lua_Number *result); LUAI_FUNC int luaO_hexavalue (int c); LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp); LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...); LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len); #endif ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lstring.cpp0000644000175000017500000000641512320456500020712 0ustar mathieumathieu/* ** $Id: lstring.c,v 2.19 2011/05/03 16:01:57 roberto Exp $ ** String table (keeps all strings handled by Lua) ** See Copyright Notice in lua.h */ #include #define lstring_c #define LUA_CORE #include "lua.h" #include "lmem.h" #include "lobject.h" #include "lstate.h" #include "lstring.h" void luaS_resize (lua_State *L, int newsize) { int i; stringtable *tb = &G(L)->strt; /* cannot resize while GC is traversing strings */ luaC_runtilstate(L, ~bitmask(GCSsweepstring)); if (newsize > tb->size) { luaM_reallocvector(L, tb->hash, tb->size, newsize, GCObject *); for (i = tb->size; i < newsize; i++) tb->hash[i] = NULL; } /* rehash */ for (i=0; isize; i++) { GCObject *p = tb->hash[i]; tb->hash[i] = NULL; while (p) { /* for each node in the list */ GCObject *next = gch(p)->next; /* save next */ unsigned int h = lmod(gco2ts(p)->hash, newsize); /* new position */ gch(p)->next = tb->hash[h]; /* chain it */ tb->hash[h] = p; resetoldbit(p); /* see MOVE OLD rule */ p = next; } } if (newsize < tb->size) { /* shrinking slice must be empty */ lua_assert(tb->hash[newsize] == NULL && tb->hash[tb->size - 1] == NULL); luaM_reallocvector(L, tb->hash, tb->size, newsize, GCObject *); } tb->size = newsize; } static TString *newlstr (lua_State *L, const char *str, size_t l, unsigned int h) { size_t totalsize; /* total size of TString object */ GCObject **list; /* (pointer to) list where it will be inserted */ TString *ts; stringtable *tb = &G(L)->strt; if (l+1 > (MAX_SIZET - sizeof(TString))/sizeof(char)) luaM_toobig(L); if (tb->nuse >= cast(lu_int32, tb->size) && tb->size <= MAX_INT/2) luaS_resize(L, tb->size*2); /* too crowded */ totalsize = sizeof(TString) + ((l + 1) * sizeof(char)); list = &tb->hash[lmod(h, tb->size)]; ts = &luaC_newobj(L, LUA_TSTRING, totalsize, list, 0)->ts; ts->tsv.len = l; ts->tsv.hash = h; ts->tsv.reserved = 0; memcpy(ts+1, str, l*sizeof(char)); ((char *)(ts+1))[l] = '\0'; /* ending 0 */ tb->nuse++; return ts; } TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { GCObject *o; unsigned int h = cast(unsigned int, l); /* seed */ size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */ size_t l1; for (l1=l; l1>=step; l1-=step) /* compute hash */ h = h ^ ((h<<5)+(h>>2)+cast(unsigned char, str[l1-1])); for (o = G(L)->strt.hash[lmod(h, G(L)->strt.size)]; o != NULL; o = gch(o)->next) { TString *ts = rawgco2ts(o); if (h == ts->tsv.hash && ts->tsv.len == l && (memcmp(str, getstr(ts), l * sizeof(char)) == 0)) { if (isdead(G(L), o)) /* string is dead (but was not collected yet)? */ changewhite(o); /* resurrect it */ return ts; } } return newlstr(L, str, l, h); /* not found; create a new string */ } TString *luaS_new (lua_State *L, const char *str) { return luaS_newlstr(L, str, strlen(str)); } Udata *luaS_newudata (lua_State *L, size_t s, Table *e) { Udata *u; if (s > MAX_SIZET - sizeof(Udata)) luaM_toobig(L); u = &luaC_newobj(L, LUA_TUSERDATA, sizeof(Udata) + s, NULL, 0)->u; u->uv.len = s; u->uv.metatable = NULL; u->uv.env = e; return u; } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lparser.cpp0000644000175000017500000013060012320456500020672 0ustar mathieumathieu/* ** $Id: lparser.c,v 2.124 2011/12/02 13:23:56 roberto Exp $ ** Lua Parser ** See Copyright Notice in lua.h */ #include #define lparser_c #define LUA_CORE #include "lua.h" #include "lcode.h" #include "ldebug.h" #include "ldo.h" #include "lfunc.h" #include "llex.h" #include "lmem.h" #include "lobject.h" #include "lopcodes.h" #include "lparser.h" #include "lstate.h" #include "lstring.h" #include "ltable.h" /* maximum number of local variables per function (must be smaller than 250, due to the bytecode format) */ #define MAXVARS 200 #define hasmultret(k) ((k) == VCALL || (k) == VVARARG) /* ** nodes for block list (list of active blocks) */ typedef struct BlockCnt { struct BlockCnt *previous; /* chain */ short firstlabel; /* index of first label in this block */ short firstgoto; /* index of first pending goto in this block */ lu_byte nactvar; /* # active locals outside the block */ lu_byte upval; /* true if some variable in the block is an upvalue */ lu_byte isloop; /* true if `block' is a loop */ } BlockCnt; /* ** prototypes for recursive non-terminal functions */ static void statement (LexState *ls); static void expr (LexState *ls, expdesc *v); static void anchor_token (LexState *ls) { /* last token from outer function must be EOS */ lua_assert(ls->fs != NULL || ls->t.token == TK_EOS); if (ls->t.token == TK_NAME || ls->t.token == TK_STRING) { TString *ts = ls->t.seminfo.ts; luaX_newstring(ls, getstr(ts), ts->tsv.len); } } /* semantic error */ static l_noret semerror (LexState *ls, const char *msg) { ls->t.token = 0; /* remove 'near to' from final message */ luaX_syntaxerror(ls, msg); } static l_noret error_expected (LexState *ls, int token) { luaX_syntaxerror(ls, luaO_pushfstring(ls->L, "%s expected", luaX_token2str(ls, token))); } static l_noret errorlimit (FuncState *fs, int limit, const char *what) { lua_State *L = fs->ls->L; const char *msg; int line = fs->f->linedefined; const char *where = (line == 0) ? "main function" : luaO_pushfstring(L, "function at line %d", line); msg = luaO_pushfstring(L, "too many %s (limit is %d) in %s", what, limit, where); luaX_syntaxerror(fs->ls, msg); } static void checklimit (FuncState *fs, int v, int l, const char *what) { if (v > l) errorlimit(fs, l, what); } static int testnext (LexState *ls, int c) { if (ls->t.token == c) { luaX_next(ls); return 1; } else return 0; } static void check (LexState *ls, int c) { if (ls->t.token != c) error_expected(ls, c); } static void checknext (LexState *ls, int c) { check(ls, c); luaX_next(ls); } #define check_condition(ls,c,msg) { if (!(c)) luaX_syntaxerror(ls, msg); } static void check_match (LexState *ls, int what, int who, int where) { if (!testnext(ls, what)) { if (where == ls->linenumber) error_expected(ls, what); else { luaX_syntaxerror(ls, luaO_pushfstring(ls->L, "%s expected (to close %s at line %d)", luaX_token2str(ls, what), luaX_token2str(ls, who), where)); } } } static TString *str_checkname (LexState *ls) { TString *ts; check(ls, TK_NAME); ts = ls->t.seminfo.ts; luaX_next(ls); return ts; } static void init_exp (expdesc *e, expkind k, int i) { e->f = e->t = NO_JUMP; e->k = k; e->u.info = i; } static void codestring (LexState *ls, expdesc *e, TString *s) { init_exp(e, VK, luaK_stringK(ls->fs, s)); } static void checkname (LexState *ls, expdesc *e) { codestring(ls, e, str_checkname(ls)); } static int registerlocalvar (LexState *ls, TString *varname) { FuncState *fs = ls->fs; Proto *f = fs->f; int oldsize = f->sizelocvars; luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars, LocVar, SHRT_MAX, "local variables"); while (oldsize < f->sizelocvars) f->locvars[oldsize++].varname = NULL; f->locvars[fs->nlocvars].varname = varname; luaC_objbarrier(ls->L, f, varname); return fs->nlocvars++; } static void new_localvar (LexState *ls, TString *name) { FuncState *fs = ls->fs; Dyndata *dyd = ls->dyd; int reg = registerlocalvar(ls, name); checklimit(fs, dyd->actvar.n + 1 - fs->firstlocal, MAXVARS, "local variables"); luaM_growvector(ls->L, dyd->actvar.arr, dyd->actvar.n + 1, dyd->actvar.size, Vardesc, MAX_INT, "local variables"); dyd->actvar.arr[dyd->actvar.n++].idx = cast(short, reg); } static void new_localvarliteral_ (LexState *ls, const char *name, size_t sz) { new_localvar(ls, luaX_newstring(ls, name, sz)); } #define new_localvarliteral(ls,v) \ new_localvarliteral_(ls, "" v, (sizeof(v)/sizeof(char))-1) static LocVar *getlocvar (FuncState *fs, int i) { int idx = fs->ls->dyd->actvar.arr[fs->firstlocal + i].idx; lua_assert(idx < fs->nlocvars); return &fs->f->locvars[idx]; } static void adjustlocalvars (LexState *ls, int nvars) { FuncState *fs = ls->fs; fs->nactvar = cast_byte(fs->nactvar + nvars); for (; nvars; nvars--) { getlocvar(fs, fs->nactvar - nvars)->startpc = fs->pc; } } static void removevars (FuncState *fs, int tolevel) { fs->ls->dyd->actvar.n -= (fs->nactvar - tolevel); while (fs->nactvar > tolevel) getlocvar(fs, --fs->nactvar)->endpc = fs->pc; } static int searchupvalue (FuncState *fs, TString *name) { int i; Upvaldesc *up = fs->f->upvalues; for (i = 0; i < fs->nups; i++) { if (eqstr(up[i].name, name)) return i; } return -1; /* not found */ } static int newupvalue (FuncState *fs, TString *name, expdesc *v) { Proto *f = fs->f; int oldsize = f->sizeupvalues; checklimit(fs, fs->nups + 1, MAXUPVAL, "upvalues"); luaM_growvector(fs->ls->L, f->upvalues, fs->nups, f->sizeupvalues, Upvaldesc, MAXUPVAL, "upvalues"); while (oldsize < f->sizeupvalues) f->upvalues[oldsize++].name = NULL; f->upvalues[fs->nups].instack = (v->k == VLOCAL); f->upvalues[fs->nups].idx = cast_byte(v->u.info); f->upvalues[fs->nups].name = name; luaC_objbarrier(fs->ls->L, f, name); return fs->nups++; } static int searchvar (FuncState *fs, TString *n) { int i; for (i=fs->nactvar-1; i >= 0; i--) { if (eqstr(n, getlocvar(fs, i)->varname)) return i; } return -1; /* not found */ } /* Mark block where variable at given level was defined (to emit close instructions later). */ static void markupval (FuncState *fs, int level) { BlockCnt *bl = fs->bl; while (bl->nactvar > level) bl = bl->previous; bl->upval = 1; } /* Find variable with given name 'n'. If it is an upvalue, add this upvalue into all intermediate functions. */ static int singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) { if (fs == NULL) /* no more levels? */ return VVOID; /* default is global */ else { int v = searchvar(fs, n); /* look up locals at current level */ if (v >= 0) { /* found? */ init_exp(var, VLOCAL, v); /* variable is local */ if (!base) markupval(fs, v); /* local will be used as an upval */ return VLOCAL; } else { /* not found as local at current level; try upvalues */ int idx = searchupvalue(fs, n); /* try existing upvalues */ if (idx < 0) { /* not found? */ if (singlevaraux(fs->prev, n, var, 0) == VVOID) /* try upper levels */ return VVOID; /* not found; is a global */ /* else was LOCAL or UPVAL */ idx = newupvalue(fs, n, var); /* will be a new upvalue */ } init_exp(var, VUPVAL, idx); return VUPVAL; } } } static void singlevar (LexState *ls, expdesc *var) { TString *varname = str_checkname(ls); FuncState *fs = ls->fs; if (singlevaraux(fs, varname, var, 1) == VVOID) { /* global name? */ expdesc key; singlevaraux(fs, ls->envn, var, 1); /* get environment variable */ lua_assert(var->k == VLOCAL || var->k == VUPVAL); codestring(ls, &key, varname); /* key is variable name */ luaK_indexed(fs, var, &key); /* env[varname] */ } } static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) { FuncState *fs = ls->fs; int extra = nvars - nexps; if (hasmultret(e->k)) { extra++; /* includes call itself */ if (extra < 0) extra = 0; luaK_setreturns(fs, e, extra); /* last exp. provides the difference */ if (extra > 1) luaK_reserveregs(fs, extra-1); } else { if (e->k != VVOID) luaK_exp2nextreg(fs, e); /* close last expression */ if (extra > 0) { int reg = fs->freereg; luaK_reserveregs(fs, extra); luaK_nil(fs, reg, extra); } } } static void enterlevel (LexState *ls) { lua_State *L = ls->L; ++L->nCcalls; checklimit(ls->fs, L->nCcalls, LUAI_MAXCCALLS, "C levels"); } #define leavelevel(ls) ((ls)->L->nCcalls--) static void closegoto (LexState *ls, int g, Labeldesc *label) { int i; FuncState *fs = ls->fs; Labellist *gl = &ls->dyd->gt; Labeldesc *gt = &gl->arr[g]; lua_assert(eqstr(gt->name, label->name)); if (gt->nactvar < label->nactvar) { TString *vname = getlocvar(fs, gt->nactvar)->varname; const char *msg = luaO_pushfstring(ls->L, " at line %d jumps into the scope of local " LUA_QS, getstr(gt->name), gt->line, getstr(vname)); semerror(ls, msg); } luaK_patchlist(fs, gt->pc, label->pc); /* remove goto from pending list */ for (i = g; i < gl->n - 1; i++) gl->arr[i] = gl->arr[i + 1]; gl->n--; } /* ** try to close a goto with existing labels; this solves backward jumps */ static int findlabel (LexState *ls, int g) { int i; BlockCnt *bl = ls->fs->bl; Dyndata *dyd = ls->dyd; Labeldesc *gt = &dyd->gt.arr[g]; /* check labels in current block for a match */ for (i = bl->firstlabel; i < dyd->label.n; i++) { Labeldesc *lb = &dyd->label.arr[i]; if (eqstr(lb->name, gt->name)) { /* correct label? */ if (gt->nactvar > lb->nactvar && (bl->upval || dyd->label.n > bl->firstlabel)) luaK_patchclose(ls->fs, gt->pc, lb->nactvar); closegoto(ls, g, lb); /* close it */ return 1; } } return 0; /* label not found; cannot close goto */ } static int newlabelentry (LexState *ls, Labellist *l, TString *name, int line, int pc) { int n = l->n; luaM_growvector(ls->L, l->arr, n, l->size, Labeldesc, SHRT_MAX, "labels/gotos"); l->arr[n].name = name; l->arr[n].line = line; l->arr[n].nactvar = ls->fs->nactvar; l->arr[n].pc = pc; l->n++; return n; } /* ** check whether new label 'lb' matches any pending gotos in current ** block; solves forward jumps */ static void findgotos (LexState *ls, Labeldesc *lb) { Labellist *gl = &ls->dyd->gt; int i = ls->fs->bl->firstgoto; while (i < gl->n) { if (eqstr(gl->arr[i].name, lb->name)) closegoto(ls, i, lb); else i++; } } /* ** "export" pending gotos to outer level, to check them against ** outer labels; if the block being exited has upvalues, and ** the goto exits the scope of any variable (which can be the ** upvalue), close those variables being exited. */ static void movegotosout (FuncState *fs, BlockCnt *bl) { int i = bl->firstgoto; Labellist *gl = &fs->ls->dyd->gt; /* correct pending gotos to current block and try to close it with visible labels */ while (i < gl->n) { Labeldesc *gt = &gl->arr[i]; if (gt->nactvar > bl->nactvar) { if (bl->upval) luaK_patchclose(fs, gt->pc, bl->nactvar); gt->nactvar = bl->nactvar; } if (!findlabel(fs->ls, i)) i++; /* move to next one */ } } static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isloop) { bl->isloop = isloop; bl->nactvar = fs->nactvar; bl->firstlabel = fs->ls->dyd->label.n; bl->firstgoto = fs->ls->dyd->gt.n; bl->upval = 0; bl->previous = fs->bl; fs->bl = bl; lua_assert(fs->freereg == fs->nactvar); } /* ** create a label named "break" to resolve break statements */ static void breaklabel (LexState *ls) { TString *n = luaS_new(ls->L, "break"); int l = newlabelentry(ls, &ls->dyd->label, n, 0, ls->fs->pc); findgotos(ls, &ls->dyd->label.arr[l]); } /* ** generates an error for an undefined 'goto'; choose appropriate ** message when label name is a reserved word (which can only be 'break') */ static l_noret undefgoto (LexState *ls, Labeldesc *gt) { const char *msg = (gt->name->tsv.reserved > 0) ? "<%s> at line %d not inside a loop" : "no visible label " LUA_QS " for at line %d"; msg = luaO_pushfstring(ls->L, msg, getstr(gt->name), gt->line); semerror(ls, msg); } static void leaveblock (FuncState *fs) { BlockCnt *bl = fs->bl; LexState *ls = fs->ls; if (bl->previous && bl->upval) { /* create a 'jump to here' to close upvalues */ int j = luaK_jump(fs); luaK_patchclose(fs, j, bl->nactvar); luaK_patchtohere(fs, j); } if (bl->isloop) breaklabel(ls); /* close pending breaks */ fs->bl = bl->previous; removevars(fs, bl->nactvar); lua_assert(bl->nactvar == fs->nactvar); fs->freereg = fs->nactvar; /* free registers */ ls->dyd->label.n = bl->firstlabel; /* remove local labels */ if (bl->previous) /* inner block? */ movegotosout(fs, bl); /* update pending gotos to outer block */ else if (bl->firstgoto < ls->dyd->gt.n) /* pending gotos in outer block? */ undefgoto(ls, &ls->dyd->gt.arr[bl->firstgoto]); /* error */ } /* ** adds prototype being created into its parent list of prototypes ** and codes instruction to create new closure */ static void codeclosure (LexState *ls, Proto *clp, expdesc *v) { FuncState *fs = ls->fs->prev; Proto *f = fs->f; /* prototype of function creating new closure */ if (fs->np >= f->sizep) { int oldsize = f->sizep; luaM_growvector(ls->L, f->p, fs->np, f->sizep, Proto *, MAXARG_Bx, "functions"); while (oldsize < f->sizep) f->p[oldsize++] = NULL; } f->p[fs->np++] = clp; luaC_objbarrier(ls->L, f, clp); init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np-1)); luaK_exp2nextreg(fs, v); /* fix it at stack top (for GC) */ } static void open_func (LexState *ls, FuncState *fs, BlockCnt *bl) { lua_State *L = ls->L; Proto *f; fs->prev = ls->fs; /* linked list of funcstates */ fs->ls = ls; ls->fs = fs; fs->pc = 0; fs->lasttarget = 0; fs->jpc = NO_JUMP; fs->freereg = 0; fs->nk = 0; fs->np = 0; fs->nups = 0; fs->nlocvars = 0; fs->nactvar = 0; fs->firstlocal = ls->dyd->actvar.n; fs->bl = NULL; f = luaF_newproto(L); fs->f = f; f->source = ls->source; f->maxstacksize = 2; /* registers 0/1 are always valid */ /* anchor prototype (to avoid being collected) */ setptvalue2s(L, L->top, f); incr_top(L); fs->h = luaH_new(L); /* anchor table of constants (to avoid being collected) */ sethvalue2s(L, L->top, fs->h); incr_top(L); enterblock(fs, bl, 0); } static void close_func (LexState *ls) { lua_State *L = ls->L; FuncState *fs = ls->fs; Proto *f = fs->f; luaK_ret(fs, 0, 0); /* final return */ leaveblock(fs); luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction); f->sizecode = fs->pc; luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int); f->sizelineinfo = fs->pc; luaM_reallocvector(L, f->k, f->sizek, fs->nk, TValue); f->sizek = fs->nk; luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *); f->sizep = fs->np; luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar); f->sizelocvars = fs->nlocvars; luaM_reallocvector(L, f->upvalues, f->sizeupvalues, fs->nups, Upvaldesc); f->sizeupvalues = fs->nups; lua_assert(fs->bl == NULL); ls->fs = fs->prev; /* last token read was anchored in defunct function; must re-anchor it */ anchor_token(ls); L->top--; /* pop table of constants */ luaC_checkGC(L); L->top--; /* pop prototype (after possible collection) */ } /* ** opens the main function, which is a regular vararg function with an ** upvalue named LUA_ENV */ static void open_mainfunc (LexState *ls, FuncState *fs, BlockCnt *bl) { expdesc v; open_func(ls, fs, bl); fs->f->is_vararg = 1; /* main function is always vararg */ init_exp(&v, VLOCAL, 0); newupvalue(fs, ls->envn, &v); /* create environment upvalue */ } /*============================================================*/ /* GRAMMAR RULES */ /*============================================================*/ /* ** check whether current token is in the follow set of a block. ** 'until' closes syntactical blocks, but do not close scope, ** so it handled in separate. */ static int block_follow (LexState *ls, int withuntil) { switch (ls->t.token) { case TK_ELSE: case TK_ELSEIF: case TK_END: case TK_EOS: return 1; case TK_UNTIL: return withuntil; default: return 0; } } static void statlist (LexState *ls) { /* statlist -> { stat [`;'] } */ while (!block_follow(ls, 1)) { if (ls->t.token == TK_RETURN) { statement(ls); return; /* 'return' must be last statement */ } statement(ls); } } static void fieldsel (LexState *ls, expdesc *v) { /* fieldsel -> ['.' | ':'] NAME */ FuncState *fs = ls->fs; expdesc key; luaK_exp2anyregup(fs, v); luaX_next(ls); /* skip the dot or colon */ checkname(ls, &key); luaK_indexed(fs, v, &key); } static void yindex (LexState *ls, expdesc *v) { /* index -> '[' expr ']' */ luaX_next(ls); /* skip the '[' */ expr(ls, v); luaK_exp2val(ls->fs, v); checknext(ls, ']'); } /* ** {====================================================================== ** Rules for Constructors ** ======================================================================= */ struct ConsControl { expdesc v; /* last list item read */ expdesc *t; /* table descriptor */ int nh; /* total number of `record' elements */ int na; /* total number of array elements */ int tostore; /* number of array elements pending to be stored */ }; static void recfield (LexState *ls, struct ConsControl *cc) { /* recfield -> (NAME | `['exp1`]') = exp1 */ FuncState *fs = ls->fs; int reg = ls->fs->freereg; expdesc key, val; int rkkey; if (ls->t.token == TK_NAME) { checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); checkname(ls, &key); } else /* ls->t.token == '[' */ yindex(ls, &key); cc->nh++; checknext(ls, '='); rkkey = luaK_exp2RK(fs, &key); expr(ls, &val); luaK_codeABC(fs, OP_SETTABLE, cc->t->u.info, rkkey, luaK_exp2RK(fs, &val)); fs->freereg = reg; /* free registers */ } static void closelistfield (FuncState *fs, struct ConsControl *cc) { if (cc->v.k == VVOID) return; /* there is no list item */ luaK_exp2nextreg(fs, &cc->v); cc->v.k = VVOID; if (cc->tostore == LFIELDS_PER_FLUSH) { luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore); /* flush */ cc->tostore = 0; /* no more items pending */ } } static void lastlistfield (FuncState *fs, struct ConsControl *cc) { if (cc->tostore == 0) return; if (hasmultret(cc->v.k)) { luaK_setmultret(fs, &cc->v); luaK_setlist(fs, cc->t->u.info, cc->na, LUA_MULTRET); cc->na--; /* do not count last expression (unknown number of elements) */ } else { if (cc->v.k != VVOID) luaK_exp2nextreg(fs, &cc->v); luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore); } } static void listfield (LexState *ls, struct ConsControl *cc) { /* listfield -> exp */ expr(ls, &cc->v); checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor"); cc->na++; cc->tostore++; } static void field (LexState *ls, struct ConsControl *cc) { /* field -> listfield | recfield */ switch(ls->t.token) { case TK_NAME: { /* may be 'listfield' or 'recfield' */ if (luaX_lookahead(ls) != '=') /* expression? */ listfield(ls, cc); else recfield(ls, cc); break; } case '[': { recfield(ls, cc); break; } default: { listfield(ls, cc); break; } } } static void constructor (LexState *ls, expdesc *t) { /* constructor -> '{' [ field { sep field } [sep] ] '}' sep -> ',' | ';' */ FuncState *fs = ls->fs; int line = ls->linenumber; int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0); struct ConsControl cc; cc.na = cc.nh = cc.tostore = 0; cc.t = t; init_exp(t, VRELOCABLE, pc); init_exp(&cc.v, VVOID, 0); /* no value (yet) */ luaK_exp2nextreg(ls->fs, t); /* fix it at stack top */ checknext(ls, '{'); do { lua_assert(cc.v.k == VVOID || cc.tostore > 0); if (ls->t.token == '}') break; closelistfield(fs, &cc); field(ls, &cc); } while (testnext(ls, ',') || testnext(ls, ';')); check_match(ls, '}', '{', line); lastlistfield(fs, &cc); SETARG_B(fs->f->code[pc], luaO_int2fb(cc.na)); /* set initial array size */ SETARG_C(fs->f->code[pc], luaO_int2fb(cc.nh)); /* set initial table size */ } /* }====================================================================== */ static void parlist (LexState *ls) { /* parlist -> [ param { `,' param } ] */ FuncState *fs = ls->fs; Proto *f = fs->f; int nparams = 0; f->is_vararg = 0; if (ls->t.token != ')') { /* is `parlist' not empty? */ do { switch (ls->t.token) { case TK_NAME: { /* param -> NAME */ new_localvar(ls, str_checkname(ls)); nparams++; break; } case TK_DOTS: { /* param -> `...' */ luaX_next(ls); f->is_vararg = 1; break; } default: luaX_syntaxerror(ls, " or " LUA_QL("...") " expected"); } } while (!f->is_vararg && testnext(ls, ',')); } adjustlocalvars(ls, nparams); f->numparams = cast_byte(fs->nactvar); luaK_reserveregs(fs, fs->nactvar); /* reserve register for parameters */ } static void body (LexState *ls, expdesc *e, int ismethod, int line) { /* body -> `(' parlist `)' block END */ FuncState new_fs; BlockCnt bl; open_func(ls, &new_fs, &bl); new_fs.f->linedefined = line; checknext(ls, '('); if (ismethod) { new_localvarliteral(ls, "self"); /* create 'self' parameter */ adjustlocalvars(ls, 1); } parlist(ls); checknext(ls, ')'); statlist(ls); new_fs.f->lastlinedefined = ls->linenumber; check_match(ls, TK_END, TK_FUNCTION, line); codeclosure(ls, new_fs.f, e); close_func(ls); } static int explist (LexState *ls, expdesc *v) { /* explist -> expr { `,' expr } */ int n = 1; /* at least one expression */ expr(ls, v); while (testnext(ls, ',')) { luaK_exp2nextreg(ls->fs, v); expr(ls, v); n++; } return n; } static void funcargs (LexState *ls, expdesc *f, int line) { FuncState *fs = ls->fs; expdesc args; int base, nparams; switch (ls->t.token) { case '(': { /* funcargs -> `(' [ explist ] `)' */ luaX_next(ls); if (ls->t.token == ')') /* arg list is empty? */ args.k = VVOID; else { explist(ls, &args); luaK_setmultret(fs, &args); } check_match(ls, ')', '(', line); break; } case '{': { /* funcargs -> constructor */ constructor(ls, &args); break; } case TK_STRING: { /* funcargs -> STRING */ codestring(ls, &args, ls->t.seminfo.ts); luaX_next(ls); /* must use `seminfo' before `next' */ break; } default: { luaX_syntaxerror(ls, "function arguments expected"); } } lua_assert(f->k == VNONRELOC); base = f->u.info; /* base register for call */ if (hasmultret(args.k)) nparams = LUA_MULTRET; /* open call */ else { if (args.k != VVOID) luaK_exp2nextreg(fs, &args); /* close last argument */ nparams = fs->freereg - (base+1); } init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2)); luaK_fixline(fs, line); fs->freereg = base+1; /* call remove function and arguments and leaves (unless changed) one result */ } /* ** {====================================================================== ** Expression parsing ** ======================================================================= */ static void prefixexp (LexState *ls, expdesc *v) { /* prefixexp -> NAME | '(' expr ')' */ switch (ls->t.token) { case '(': { int line = ls->linenumber; luaX_next(ls); expr(ls, v); check_match(ls, ')', '(', line); luaK_dischargevars(ls->fs, v); return; } case TK_NAME: { singlevar(ls, v); return; } default: { luaX_syntaxerror(ls, "unexpected symbol"); } } } static void primaryexp (LexState *ls, expdesc *v) { /* primaryexp -> prefixexp { `.' NAME | `[' exp `]' | `:' NAME funcargs | funcargs } */ FuncState *fs = ls->fs; int line = ls->linenumber; prefixexp(ls, v); for (;;) { switch (ls->t.token) { case '.': { /* fieldsel */ fieldsel(ls, v); break; } case '[': { /* `[' exp1 `]' */ expdesc key; luaK_exp2anyregup(fs, v); yindex(ls, &key); luaK_indexed(fs, v, &key); break; } case ':': { /* `:' NAME funcargs */ expdesc key; luaX_next(ls); checkname(ls, &key); luaK_self(fs, v, &key); funcargs(ls, v, line); break; } case '(': case TK_STRING: case '{': { /* funcargs */ luaK_exp2nextreg(fs, v); funcargs(ls, v, line); break; } default: return; } } } static void simpleexp (LexState *ls, expdesc *v) { /* simpleexp -> NUMBER | STRING | NIL | TRUE | FALSE | ... | constructor | FUNCTION body | primaryexp */ switch (ls->t.token) { case TK_NUMBER: { init_exp(v, VKNUM, 0); v->u.nval = ls->t.seminfo.r; break; } case TK_STRING: { codestring(ls, v, ls->t.seminfo.ts); break; } case TK_NIL: { init_exp(v, VNIL, 0); break; } case TK_TRUE: { init_exp(v, VTRUE, 0); break; } case TK_FALSE: { init_exp(v, VFALSE, 0); break; } case TK_DOTS: { /* vararg */ FuncState *fs = ls->fs; check_condition(ls, fs->f->is_vararg, "cannot use " LUA_QL("...") " outside a vararg function"); init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0)); break; } case '{': { /* constructor */ constructor(ls, v); return; } case TK_FUNCTION: { luaX_next(ls); body(ls, v, 0, ls->linenumber); return; } default: { primaryexp(ls, v); return; } } luaX_next(ls); } static UnOpr getunopr (int op) { switch (op) { case TK_NOT: return OPR_NOT; case '-': return OPR_MINUS; case '#': return OPR_LEN; default: return OPR_NOUNOPR; } } static BinOpr getbinopr (int op) { switch (op) { case '+': return OPR_ADD; case '-': return OPR_SUB; case '*': return OPR_MUL; case '/': return OPR_DIV; case '%': return OPR_MOD; case '^': return OPR_POW; case TK_CONCAT: return OPR_CONCAT; case TK_NE: return OPR_NE; case TK_EQ: return OPR_EQ; case '<': return OPR_LT; case TK_LE: return OPR_LE; case '>': return OPR_GT; case TK_GE: return OPR_GE; case TK_AND: return OPR_AND; case TK_OR: return OPR_OR; default: return OPR_NOBINOPR; } } static const struct { lu_byte left; /* left priority for each binary operator */ lu_byte right; /* right priority */ } priority[] = { /* ORDER OPR */ {6, 6}, {6, 6}, {7, 7}, {7, 7}, {7, 7}, /* `+' `-' `*' `/' `%' */ {10, 9}, {5, 4}, /* ^, .. (right associative) */ {3, 3}, {3, 3}, {3, 3}, /* ==, <, <= */ {3, 3}, {3, 3}, {3, 3}, /* ~=, >, >= */ {2, 2}, {1, 1} /* and, or */ }; #define UNARY_PRIORITY 8 /* priority for unary operators */ /* ** subexpr -> (simpleexp | unop subexpr) { binop subexpr } ** where `binop' is any binary operator with a priority higher than `limit' */ static BinOpr subexpr (LexState *ls, expdesc *v, int limit) { BinOpr op; UnOpr uop; enterlevel(ls); uop = getunopr(ls->t.token); if (uop != OPR_NOUNOPR) { int line = ls->linenumber; luaX_next(ls); subexpr(ls, v, UNARY_PRIORITY); luaK_prefix(ls->fs, uop, v, line); } else simpleexp(ls, v); /* expand while operators have priorities higher than `limit' */ op = getbinopr(ls->t.token); while (op != OPR_NOBINOPR && priority[op].left > limit) { expdesc v2; BinOpr nextop; int line = ls->linenumber; luaX_next(ls); luaK_infix(ls->fs, op, v); /* read sub-expression with higher priority */ nextop = subexpr(ls, &v2, priority[op].right); luaK_posfix(ls->fs, op, v, &v2, line); op = nextop; } leavelevel(ls); return op; /* return first untreated operator */ } static void expr (LexState *ls, expdesc *v) { subexpr(ls, v, 0); } /* }==================================================================== */ /* ** {====================================================================== ** Rules for Statements ** ======================================================================= */ static void block (LexState *ls) { /* block -> statlist */ FuncState *fs = ls->fs; BlockCnt bl; enterblock(fs, &bl, 0); statlist(ls); leaveblock(fs); } /* ** structure to chain all variables in the left-hand side of an ** assignment */ struct LHS_assign { struct LHS_assign *prev; expdesc v; /* variable (global, local, upvalue, or indexed) */ }; /* ** check whether, in an assignment to an upvalue/local variable, the ** upvalue/local variable is begin used in a previous assignment to a ** table. If so, save original upvalue/local value in a safe place and ** use this safe copy in the previous assignment. */ static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) { FuncState *fs = ls->fs; int extra = fs->freereg; /* eventual position to save local variable */ int conflict = 0; for (; lh; lh = lh->prev) { /* check all previous assignments */ if (lh->v.k == VINDEXED) { /* assigning to a table? */ /* table is the upvalue/local being assigned now? */ if (lh->v.u.ind.vt == v->k && lh->v.u.ind.t == v->u.info) { conflict = 1; lh->v.u.ind.vt = VLOCAL; lh->v.u.ind.t = extra; /* previous assignment will use safe copy */ } /* index is the local being assigned? (index cannot be upvalue) */ if (v->k == VLOCAL && lh->v.u.ind.idx == v->u.info) { conflict = 1; lh->v.u.ind.idx = extra; /* previous assignment will use safe copy */ } } } if (conflict) { /* copy upvalue/local value to a temporary (in position 'extra') */ OpCode op = (v->k == VLOCAL) ? OP_MOVE : OP_GETUPVAL; luaK_codeABC(fs, op, extra, v->u.info, 0); luaK_reserveregs(fs, 1); } } static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) { expdesc e; check_condition(ls, vkisvar(lh->v.k), "syntax error"); if (testnext(ls, ',')) { /* assignment -> `,' primaryexp assignment */ struct LHS_assign nv; nv.prev = lh; primaryexp(ls, &nv.v); if (nv.v.k != VINDEXED) check_conflict(ls, lh, &nv.v); checklimit(ls->fs, nvars + ls->L->nCcalls, LUAI_MAXCCALLS, "C levels"); assignment(ls, &nv, nvars+1); } else { /* assignment -> `=' explist */ int nexps; checknext(ls, '='); nexps = explist(ls, &e); if (nexps != nvars) { adjust_assign(ls, nvars, nexps, &e); if (nexps > nvars) ls->fs->freereg -= nexps - nvars; /* remove extra values */ } else { luaK_setoneret(ls->fs, &e); /* close last expression */ luaK_storevar(ls->fs, &lh->v, &e); return; /* avoid default */ } } init_exp(&e, VNONRELOC, ls->fs->freereg-1); /* default assignment */ luaK_storevar(ls->fs, &lh->v, &e); } static int cond (LexState *ls) { /* cond -> exp */ expdesc v; expr(ls, &v); /* read condition */ if (v.k == VNIL) v.k = VFALSE; /* `falses' are all equal here */ luaK_goiftrue(ls->fs, &v); return v.f; } static void gotostat (LexState *ls, int pc) { int line = ls->linenumber; TString *label; int g; if (testnext(ls, TK_GOTO)) label = str_checkname(ls); else { luaX_next(ls); /* skip break */ label = luaS_new(ls->L, "break"); } g = newlabelentry(ls, &ls->dyd->gt, label, line, pc); findlabel(ls, g); /* close it if label already defined */ } /* check for repeated labels on the same block */ static void checkrepeated (FuncState *fs, Labellist *ll, TString *label) { int i; for (i = fs->bl->firstlabel; i < ll->n; i++) { if (eqstr(label, ll->arr[i].name)) { const char *msg = luaO_pushfstring(fs->ls->L, "label " LUA_QS " already defined on line %d", getstr(label), ll->arr[i].line); semerror(fs->ls, msg); } } } static void labelstat (LexState *ls, TString *label, int line) { /* label -> '::' NAME '::' */ FuncState *fs = ls->fs; Labellist *ll = &ls->dyd->label; int l; /* index of new label being created */ checkrepeated(fs, ll, label); /* check for repeated labels */ checknext(ls, TK_DBCOLON); /* skip double colon */ /* create new entry for this label */ l = newlabelentry(ls, ll, label, line, fs->pc); /* skip other no-op statements */ while (ls->t.token == ';' || ls->t.token == TK_DBCOLON) statement(ls); if (block_follow(ls, 0)) { /* label is last no-op statement in the block? */ /* assume that locals are already out of scope */ ll->arr[l].nactvar = fs->bl->nactvar; } findgotos(ls, &ll->arr[l]); } static void whilestat (LexState *ls, int line) { /* whilestat -> WHILE cond DO block END */ FuncState *fs = ls->fs; int whileinit; int condexit; BlockCnt bl; luaX_next(ls); /* skip WHILE */ whileinit = luaK_getlabel(fs); condexit = cond(ls); enterblock(fs, &bl, 1); checknext(ls, TK_DO); block(ls); luaK_jumpto(fs, whileinit); check_match(ls, TK_END, TK_WHILE, line); leaveblock(fs); luaK_patchtohere(fs, condexit); /* false conditions finish the loop */ } static void repeatstat (LexState *ls, int line) { /* repeatstat -> REPEAT block UNTIL cond */ int condexit; FuncState *fs = ls->fs; int repeat_init = luaK_getlabel(fs); BlockCnt bl1, bl2; enterblock(fs, &bl1, 1); /* loop block */ enterblock(fs, &bl2, 0); /* scope block */ luaX_next(ls); /* skip REPEAT */ statlist(ls); check_match(ls, TK_UNTIL, TK_REPEAT, line); condexit = cond(ls); /* read condition (inside scope block) */ if (bl2.upval) /* upvalues? */ luaK_patchclose(fs, condexit, bl2.nactvar); leaveblock(fs); /* finish scope */ luaK_patchlist(fs, condexit, repeat_init); /* close the loop */ leaveblock(fs); /* finish loop */ } static int exp1 (LexState *ls) { expdesc e; int reg; expr(ls, &e); luaK_exp2nextreg(ls->fs, &e); lua_assert(e.k == VNONRELOC); reg = e.u.info; return reg; } static void forbody (LexState *ls, int base, int line, int nvars, int isnum) { /* forbody -> DO block */ BlockCnt bl; FuncState *fs = ls->fs; int prep, endfor; adjustlocalvars(ls, 3); /* control variables */ checknext(ls, TK_DO); prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs); enterblock(fs, &bl, 0); /* scope for declared variables */ adjustlocalvars(ls, nvars); luaK_reserveregs(fs, nvars); block(ls); leaveblock(fs); /* end of scope for declared variables */ luaK_patchtohere(fs, prep); if (isnum) /* numeric for? */ endfor = luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP); else { /* generic for */ luaK_codeABC(fs, OP_TFORCALL, base, 0, nvars); luaK_fixline(fs, line); endfor = luaK_codeAsBx(fs, OP_TFORLOOP, base + 2, NO_JUMP); } luaK_patchlist(fs, endfor, prep + 1); luaK_fixline(fs, line); } static void fornum (LexState *ls, TString *varname, int line) { /* fornum -> NAME = exp1,exp1[,exp1] forbody */ FuncState *fs = ls->fs; int base = fs->freereg; new_localvarliteral(ls, "(for index)"); new_localvarliteral(ls, "(for limit)"); new_localvarliteral(ls, "(for step)"); new_localvar(ls, varname); checknext(ls, '='); exp1(ls); /* initial value */ checknext(ls, ','); exp1(ls); /* limit */ if (testnext(ls, ',')) exp1(ls); /* optional step */ else { /* default step = 1 */ luaK_codek(fs, fs->freereg, luaK_numberK(fs, 1)); luaK_reserveregs(fs, 1); } forbody(ls, base, line, 1, 1); } static void forlist (LexState *ls, TString *indexname) { /* forlist -> NAME {,NAME} IN explist forbody */ FuncState *fs = ls->fs; expdesc e; int nvars = 4; /* gen, state, control, plus at least one declared var */ int line; int base = fs->freereg; /* create control variables */ new_localvarliteral(ls, "(for generator)"); new_localvarliteral(ls, "(for state)"); new_localvarliteral(ls, "(for control)"); /* create declared variables */ new_localvar(ls, indexname); while (testnext(ls, ',')) { new_localvar(ls, str_checkname(ls)); nvars++; } checknext(ls, TK_IN); line = ls->linenumber; adjust_assign(ls, 3, explist(ls, &e), &e); luaK_checkstack(fs, 3); /* extra space to call generator */ forbody(ls, base, line, nvars - 3, 0); } static void forstat (LexState *ls, int line) { /* forstat -> FOR (fornum | forlist) END */ FuncState *fs = ls->fs; TString *varname; BlockCnt bl; enterblock(fs, &bl, 1); /* scope for loop and control variables */ luaX_next(ls); /* skip `for' */ varname = str_checkname(ls); /* first variable name */ switch (ls->t.token) { case '=': fornum(ls, varname, line); break; case ',': case TK_IN: forlist(ls, varname); break; default: luaX_syntaxerror(ls, LUA_QL("=") " or " LUA_QL("in") " expected"); } check_match(ls, TK_END, TK_FOR, line); leaveblock(fs); /* loop scope (`break' jumps to this point) */ } static void test_then_block (LexState *ls, int *escapelist) { /* test_then_block -> [IF | ELSEIF] cond THEN block */ BlockCnt bl; FuncState *fs = ls->fs; expdesc v; int jf; /* instruction to skip 'then' code (if condition is false) */ luaX_next(ls); /* skip IF or ELSEIF */ expr(ls, &v); /* read condition */ checknext(ls, TK_THEN); if (ls->t.token == TK_GOTO || ls->t.token == TK_BREAK) { luaK_goiffalse(ls->fs, &v); /* will jump to label if condition is true */ enterblock(fs, &bl, 0); /* must enter block before 'goto' */ gotostat(ls, v.t); /* handle goto/break */ if (block_follow(ls, 0)) { /* 'goto' is the entire block? */ leaveblock(fs); return; /* and that is it */ } else /* must skip over 'then' part if condition is false */ jf = luaK_jump(fs); } else { /* regular case (not goto/break) */ luaK_goiftrue(ls->fs, &v); /* skip over block if condition is false */ enterblock(fs, &bl, 0); jf = v.f; } statlist(ls); /* `then' part */ leaveblock(fs); if (ls->t.token == TK_ELSE || ls->t.token == TK_ELSEIF) /* followed by 'else'/'elseif'? */ luaK_concat(fs, escapelist, luaK_jump(fs)); /* must jump over it */ luaK_patchtohere(fs, jf); } static void ifstat (LexState *ls, int line) { /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */ FuncState *fs = ls->fs; int escapelist = NO_JUMP; /* exit list for finished parts */ test_then_block(ls, &escapelist); /* IF cond THEN block */ while (ls->t.token == TK_ELSEIF) test_then_block(ls, &escapelist); /* ELSEIF cond THEN block */ if (testnext(ls, TK_ELSE)) block(ls); /* `else' part */ check_match(ls, TK_END, TK_IF, line); luaK_patchtohere(fs, escapelist); /* patch escape list to 'if' end */ } static void localfunc (LexState *ls) { expdesc b; FuncState *fs = ls->fs; new_localvar(ls, str_checkname(ls)); /* new local variable */ adjustlocalvars(ls, 1); /* enter its scope */ body(ls, &b, 0, ls->linenumber); /* function created in next register */ /* debug information will only see the variable after this point! */ getlocvar(fs, b.u.info)->startpc = fs->pc; } static void localstat (LexState *ls) { /* stat -> LOCAL NAME {`,' NAME} [`=' explist] */ int nvars = 0; int nexps; expdesc e; do { new_localvar(ls, str_checkname(ls)); nvars++; } while (testnext(ls, ',')); if (testnext(ls, '=')) nexps = explist(ls, &e); else { e.k = VVOID; nexps = 0; } adjust_assign(ls, nvars, nexps, &e); adjustlocalvars(ls, nvars); } static int funcname (LexState *ls, expdesc *v) { /* funcname -> NAME {fieldsel} [`:' NAME] */ int ismethod = 0; singlevar(ls, v); while (ls->t.token == '.') fieldsel(ls, v); if (ls->t.token == ':') { ismethod = 1; fieldsel(ls, v); } return ismethod; } static void funcstat (LexState *ls, int line) { /* funcstat -> FUNCTION funcname body */ int ismethod; expdesc v, b; luaX_next(ls); /* skip FUNCTION */ ismethod = funcname(ls, &v); body(ls, &b, ismethod, line); luaK_storevar(ls->fs, &v, &b); luaK_fixline(ls->fs, line); /* definition `happens' in the first line */ } static void exprstat (LexState *ls) { /* stat -> func | assignment */ FuncState *fs = ls->fs; struct LHS_assign v; primaryexp(ls, &v.v); if (v.v.k == VCALL) /* stat -> func */ SETARG_C(getcode(fs, &v.v), 1); /* call statement uses no results */ else { /* stat -> assignment */ v.prev = NULL; assignment(ls, &v, 1); } } static void retstat (LexState *ls) { /* stat -> RETURN [explist] [';'] */ FuncState *fs = ls->fs; expdesc e; int first, nret; /* registers with returned values */ if (block_follow(ls, 1) || ls->t.token == ';') first = nret = 0; /* return no values */ else { nret = explist(ls, &e); /* optional return values */ if (hasmultret(e.k)) { luaK_setmultret(fs, &e); if (e.k == VCALL && nret == 1) { /* tail call? */ SET_OPCODE(getcode(fs,&e), OP_TAILCALL); lua_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar); } first = fs->nactvar; nret = LUA_MULTRET; /* return all values */ } else { if (nret == 1) /* only one single value? */ first = luaK_exp2anyreg(fs, &e); else { luaK_exp2nextreg(fs, &e); /* values must go to the `stack' */ first = fs->nactvar; /* return all `active' values */ lua_assert(nret == fs->freereg - first); } } } luaK_ret(fs, first, nret); testnext(ls, ';'); /* skip optional semicolon */ } static void statement (LexState *ls) { int line = ls->linenumber; /* may be needed for error messages */ enterlevel(ls); switch (ls->t.token) { case ';': { /* stat -> ';' (empty statement) */ luaX_next(ls); /* skip ';' */ break; } case TK_IF: { /* stat -> ifstat */ ifstat(ls, line); break; } case TK_WHILE: { /* stat -> whilestat */ whilestat(ls, line); break; } case TK_DO: { /* stat -> DO block END */ luaX_next(ls); /* skip DO */ block(ls); check_match(ls, TK_END, TK_DO, line); break; } case TK_FOR: { /* stat -> forstat */ forstat(ls, line); break; } case TK_REPEAT: { /* stat -> repeatstat */ repeatstat(ls, line); break; } case TK_FUNCTION: { /* stat -> funcstat */ funcstat(ls, line); break; } case TK_LOCAL: { /* stat -> localstat */ luaX_next(ls); /* skip LOCAL */ if (testnext(ls, TK_FUNCTION)) /* local function? */ localfunc(ls); else localstat(ls); break; } case TK_DBCOLON: { /* stat -> label */ luaX_next(ls); /* skip double colon */ labelstat(ls, str_checkname(ls), line); break; } case TK_RETURN: { /* stat -> retstat */ luaX_next(ls); /* skip RETURN */ retstat(ls); break; } case TK_BREAK: /* stat -> breakstat */ case TK_GOTO: { /* stat -> 'goto' NAME */ gotostat(ls, luaK_jump(ls->fs)); break; } default: { /* stat -> func | assignment */ exprstat(ls); break; } } lua_assert(ls->fs->f->maxstacksize >= ls->fs->freereg && ls->fs->freereg >= ls->fs->nactvar); ls->fs->freereg = ls->fs->nactvar; /* free registers */ leavelevel(ls); } /* }====================================================================== */ Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, Dyndata *dyd, const char *name, int firstchar) { LexState lexstate; FuncState funcstate; BlockCnt bl; TString *tname = luaS_new(L, name); setsvalue2s(L, L->top, tname); /* push name to protect it */ incr_top(L); lexstate.buff = buff; lexstate.dyd = dyd; dyd->actvar.n = dyd->gt.n = dyd->label.n = 0; luaX_setinput(L, &lexstate, z, tname, firstchar); open_mainfunc(&lexstate, &funcstate, &bl); luaX_next(&lexstate); /* read first token */ statlist(&lexstate); /* main body */ check(&lexstate, TK_EOS); close_func(&lexstate); L->top--; /* pop name */ lua_assert(!funcstate.prev && funcstate.nups == 1 && !lexstate.fs); /* all scopes should be correctly finished */ lua_assert(dyd->actvar.n == 0 && dyd->gt.n == 0 && dyd->label.n == 0); return funcstate.f; } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lundump.cpp0000644000175000017500000001233712320456500020714 0ustar mathieumathieu/* ** $Id: lundump.c,v 1.71 2011/12/07 10:39:12 lhf Exp $ ** load precompiled Lua chunks ** See Copyright Notice in lua.h */ #include #define lundump_c #define LUA_CORE #include "lua.h" #include "ldebug.h" #include "ldo.h" #include "lfunc.h" #include "lmem.h" #include "lobject.h" #include "lstring.h" #include "lundump.h" #include "lzio.h" typedef struct { lua_State* L; ZIO* Z; Mbuffer* b; const char* name; } LoadState; static void error(LoadState* S, const char* why) { luaO_pushfstring(S->L,"%s: %s precompiled chunk",S->name,why); luaD_throw(S->L,LUA_ERRSYNTAX); } #define LoadMem(S,b,n,size) LoadBlock(S,b,(n)*(size)) #define LoadByte(S) (lu_byte)LoadChar(S) #define LoadVar(S,x) LoadMem(S,&x,1,sizeof(x)) #define LoadVector(S,b,n,size) LoadMem(S,b,n,size) #if !defined(luai_verifycode) #define luai_verifycode(L,b,f) (f) #endif static void LoadBlock(LoadState* S, void* b, size_t size) { if (luaZ_read(S->Z,b,size)!=0) error(S,"truncated"); } static int LoadChar(LoadState* S) { char x; LoadVar(S,x); return x; } static int LoadInt(LoadState* S) { int x; LoadVar(S,x); if (x<0) error(S,"corrupted"); return x; } static lua_Number LoadNumber(LoadState* S) { lua_Number x; LoadVar(S,x); return x; } static TString* LoadString(LoadState* S) { size_t size; LoadVar(S,size); if (size==0) return NULL; else { char* s=luaZ_openspace(S->L,S->b,size); LoadBlock(S,s,size*sizeof(char)); return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */ } } static void LoadCode(LoadState* S, Proto* f) { int n=LoadInt(S); f->code=luaM_newvector(S->L,n,Instruction); f->sizecode=n; LoadVector(S,f->code,n,sizeof(Instruction)); } static Proto* LoadFunction(LoadState* S); static void LoadConstants(LoadState* S, Proto* f) { int i,n; n=LoadInt(S); f->k=luaM_newvector(S->L,n,TValue); f->sizek=n; for (i=0; ik[i]); for (i=0; ik[i]; int t=LoadChar(S); switch (t) { case LUA_TNIL: setnilvalue(o); break; case LUA_TBOOLEAN: setbvalue(o,LoadChar(S)); break; case LUA_TNUMBER: setnvalue(o,LoadNumber(S)); break; case LUA_TSTRING: setsvalue2n(S->L,o,LoadString(S)); break; } } n=LoadInt(S); f->p=luaM_newvector(S->L,n,Proto*); f->sizep=n; for (i=0; ip[i]=NULL; for (i=0; ip[i]=LoadFunction(S); } static void LoadUpvalues(LoadState* S, Proto* f) { int i,n; n=LoadInt(S); f->upvalues=luaM_newvector(S->L,n,Upvaldesc); f->sizeupvalues=n; for (i=0; iupvalues[i].name=NULL; for (i=0; iupvalues[i].instack=LoadByte(S); f->upvalues[i].idx=LoadByte(S); } } static void LoadDebug(LoadState* S, Proto* f) { int i,n; f->source=LoadString(S); n=LoadInt(S); f->lineinfo=luaM_newvector(S->L,n,int); f->sizelineinfo=n; LoadVector(S,f->lineinfo,n,sizeof(int)); n=LoadInt(S); f->locvars=luaM_newvector(S->L,n,LocVar); f->sizelocvars=n; for (i=0; ilocvars[i].varname=NULL; for (i=0; ilocvars[i].varname=LoadString(S); f->locvars[i].startpc=LoadInt(S); f->locvars[i].endpc=LoadInt(S); } n=LoadInt(S); for (i=0; iupvalues[i].name=LoadString(S); } static Proto* LoadFunction(LoadState* S) { Proto* f=luaF_newproto(S->L); setptvalue2s(S->L,S->L->top,f); incr_top(S->L); f->linedefined=LoadInt(S); f->lastlinedefined=LoadInt(S); f->numparams=LoadByte(S); f->is_vararg=LoadByte(S); f->maxstacksize=LoadByte(S); LoadCode(S,f); LoadConstants(S,f); LoadUpvalues(S,f); LoadDebug(S,f); S->L->top--; return f; } /* the code below must be consistent with the code in luaU_header */ #define N0 LUAC_HEADERSIZE #define N1 (sizeof(LUA_SIGNATURE)-sizeof(char)) #define N2 N1+2 #define N3 N2+6 static void LoadHeader(LoadState* S) { lu_byte h[LUAC_HEADERSIZE]; lu_byte s[LUAC_HEADERSIZE]; luaU_header(h); memcpy(s,h,sizeof(char)); /* first char already read */ LoadBlock(S,s+sizeof(char),LUAC_HEADERSIZE-sizeof(char)); if (memcmp(h,s,N0)==0) return; if (memcmp(h,s,N1)!=0) error(S,"not a"); if (memcmp(h,s,N2)!=0) error(S,"version mismatch in"); if (memcmp(h,s,N3)!=0) error(S,"incompatible"); else error(S,"corrupted"); } /* ** load precompiled chunk */ Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name) { LoadState S; if (*name=='@' || *name=='=') S.name=name+1; else if (*name==LUA_SIGNATURE[0]) S.name="binary string"; else S.name=name; S.L=L; S.Z=Z; S.b=buff; LoadHeader(&S); return luai_verifycode(L,buff,LoadFunction(&S)); } #define MYINT(s) (s[0]-'0') #define VERSION MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR) #define FORMAT 0 /* this is the official format */ /* * make header for precompiled chunks * if you change the code below be sure to update LoadHeader and FORMAT above * and LUAC_HEADERSIZE in lundump.h */ void luaU_header (lu_byte* h) { int x=1; memcpy(h,LUA_SIGNATURE,sizeof(LUA_SIGNATURE)-sizeof(char)); h+=sizeof(LUA_SIGNATURE)-sizeof(char); *h++=cast_byte(VERSION); *h++=cast_byte(FORMAT); *h++=cast_byte(*(char*)&x); /* endianness */ *h++=cast_byte(sizeof(int)); *h++=cast_byte(sizeof(size_t)); *h++=cast_byte(sizeof(Instruction)); *h++=cast_byte(sizeof(lua_Number)); *h++=cast_byte(((lua_Number)0.5)==0); /* is lua_Number integral? */ memcpy(h,LUAC_TAIL,sizeof(LUAC_TAIL)-sizeof(char)); } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lcode.cpp0000644000175000017500000005362312320456500020321 0ustar mathieumathieu/* ** $Id: lcode.c,v 2.60 2011/08/30 16:26:41 roberto Exp $ ** Code generator for Lua ** See Copyright Notice in lua.h */ #include #define lcode_c #define LUA_CORE #include "lua.h" #include "lcode.h" #include "ldebug.h" #include "ldo.h" #include "lgc.h" #include "llex.h" #include "lmem.h" #include "lobject.h" #include "lopcodes.h" #include "lparser.h" #include "lstring.h" #include "ltable.h" #include "lvm.h" #define hasjumps(e) ((e)->t != (e)->f) static int isnumeral(expdesc *e) { return (e->k == VKNUM && e->t == NO_JUMP && e->f == NO_JUMP); } void luaK_nil (FuncState *fs, int from, int n) { Instruction *previous; int l = from + n - 1; /* last register to set nil */ if (fs->pc > fs->lasttarget) { /* no jumps to current position? */ previous = &fs->f->code[fs->pc-1]; if (GET_OPCODE(*previous) == OP_LOADNIL) { int pfrom = GETARG_A(*previous); int pl = pfrom + GETARG_B(*previous); if ((pfrom <= from && from <= pl + 1) || (from <= pfrom && pfrom <= l + 1)) { /* can connect both? */ if (pfrom < from) from = pfrom; /* from = min(from, pfrom) */ if (pl > l) l = pl; /* l = max(l, pl) */ SETARG_A(*previous, from); SETARG_B(*previous, l - from); return; } } /* else go through */ } luaK_codeABC(fs, OP_LOADNIL, from, n - 1, 0); /* else no optimization */ } int luaK_jump (FuncState *fs) { int jpc = fs->jpc; /* save list of jumps to here */ int j; fs->jpc = NO_JUMP; j = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP); luaK_concat(fs, &j, jpc); /* keep them on hold */ return j; } void luaK_ret (FuncState *fs, int first, int nret) { luaK_codeABC(fs, OP_RETURN, first, nret+1, 0); } static int condjump (FuncState *fs, OpCode op, int A, int B, int C) { luaK_codeABC(fs, op, A, B, C); return luaK_jump(fs); } static void fixjump (FuncState *fs, int pc, int dest) { Instruction *jmp = &fs->f->code[pc]; int offset = dest-(pc+1); lua_assert(dest != NO_JUMP); if (abs(offset) > MAXARG_sBx) luaX_syntaxerror(fs->ls, "control structure too long"); SETARG_sBx(*jmp, offset); } /* ** returns current `pc' and marks it as a jump target (to avoid wrong ** optimizations with consecutive instructions not in the same basic block). */ int luaK_getlabel (FuncState *fs) { fs->lasttarget = fs->pc; return fs->pc; } static int getjump (FuncState *fs, int pc) { int offset = GETARG_sBx(fs->f->code[pc]); if (offset == NO_JUMP) /* point to itself represents end of list */ return NO_JUMP; /* end of list */ else return (pc+1)+offset; /* turn offset into absolute position */ } static Instruction *getjumpcontrol (FuncState *fs, int pc) { Instruction *pi = &fs->f->code[pc]; if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1)))) return pi-1; else return pi; } /* ** check whether list has any jump that do not produce a value ** (or produce an inverted value) */ static int need_value (FuncState *fs, int list) { for (; list != NO_JUMP; list = getjump(fs, list)) { Instruction i = *getjumpcontrol(fs, list); if (GET_OPCODE(i) != OP_TESTSET) return 1; } return 0; /* not found */ } static int patchtestreg (FuncState *fs, int node, int reg) { Instruction *i = getjumpcontrol(fs, node); if (GET_OPCODE(*i) != OP_TESTSET) return 0; /* cannot patch other instructions */ if (reg != NO_REG && reg != GETARG_B(*i)) SETARG_A(*i, reg); else /* no register to put value or register already has the value */ *i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i)); return 1; } static void removevalues (FuncState *fs, int list) { for (; list != NO_JUMP; list = getjump(fs, list)) patchtestreg(fs, list, NO_REG); } static void patchlistaux (FuncState *fs, int list, int vtarget, int reg, int dtarget) { while (list != NO_JUMP) { int next = getjump(fs, list); if (patchtestreg(fs, list, reg)) fixjump(fs, list, vtarget); else fixjump(fs, list, dtarget); /* jump to default target */ list = next; } } static void dischargejpc (FuncState *fs) { patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc); fs->jpc = NO_JUMP; } void luaK_patchlist (FuncState *fs, int list, int target) { if (target == fs->pc) luaK_patchtohere(fs, list); else { lua_assert(target < fs->pc); patchlistaux(fs, list, target, NO_REG, target); } } LUAI_FUNC void luaK_patchclose (FuncState *fs, int list, int level) { level++; /* argument is +1 to reserve 0 as non-op */ while (list != NO_JUMP) { int next = getjump(fs, list); lua_assert(GET_OPCODE(fs->f->code[list]) == OP_JMP && (GETARG_A(fs->f->code[list]) == 0 || GETARG_A(fs->f->code[list]) >= level)); SETARG_A(fs->f->code[list], level); list = next; } } void luaK_patchtohere (FuncState *fs, int list) { luaK_getlabel(fs); luaK_concat(fs, &fs->jpc, list); } void luaK_concat (FuncState *fs, int *l1, int l2) { if (l2 == NO_JUMP) return; else if (*l1 == NO_JUMP) *l1 = l2; else { int list = *l1; int next; while ((next = getjump(fs, list)) != NO_JUMP) /* find last element */ list = next; fixjump(fs, list, l2); } } static int luaK_code (FuncState *fs, Instruction i) { Proto *f = fs->f; dischargejpc(fs); /* `pc' will change */ /* put new instruction in code array */ luaM_growvector(fs->ls->L, f->code, fs->pc, f->sizecode, Instruction, MAX_INT, "opcodes"); f->code[fs->pc] = i; /* save corresponding line information */ luaM_growvector(fs->ls->L, f->lineinfo, fs->pc, f->sizelineinfo, int, MAX_INT, "opcodes"); f->lineinfo[fs->pc] = fs->ls->lastline; return fs->pc++; } int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) { lua_assert(getOpMode(o) == iABC); lua_assert(getBMode(o) != OpArgN || b == 0); lua_assert(getCMode(o) != OpArgN || c == 0); lua_assert(a <= MAXARG_A && b <= MAXARG_B && c <= MAXARG_C); return luaK_code(fs, CREATE_ABC(o, a, b, c)); } int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) { lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx); lua_assert(getCMode(o) == OpArgN); lua_assert(a <= MAXARG_A && bc <= MAXARG_Bx); return luaK_code(fs, CREATE_ABx(o, a, bc)); } static int codeextraarg (FuncState *fs, int a) { lua_assert(a <= MAXARG_Ax); return luaK_code(fs, CREATE_Ax(OP_EXTRAARG, a)); } int luaK_codek (FuncState *fs, int reg, int k) { if (k <= MAXARG_Bx) return luaK_codeABx(fs, OP_LOADK, reg, k); else { int p = luaK_codeABx(fs, OP_LOADKX, reg, 0); codeextraarg(fs, k); return p; } } void luaK_checkstack (FuncState *fs, int n) { int newstack = fs->freereg + n; if (newstack > fs->f->maxstacksize) { if (newstack >= MAXSTACK) luaX_syntaxerror(fs->ls, "function or expression too complex"); fs->f->maxstacksize = cast_byte(newstack); } } void luaK_reserveregs (FuncState *fs, int n) { luaK_checkstack(fs, n); fs->freereg += n; } static void freereg (FuncState *fs, int reg) { if (!ISK(reg) && reg >= fs->nactvar) { fs->freereg--; lua_assert(reg == fs->freereg); } } static void freeexp (FuncState *fs, expdesc *e) { if (e->k == VNONRELOC) freereg(fs, e->u.info); } static int addk (FuncState *fs, TValue *key, TValue *v) { lua_State *L = fs->ls->L; TValue *idx = luaH_set(L, fs->h, key); Proto *f = fs->f; int k, oldsize; if (ttisnumber(idx)) { lua_Number n = nvalue(idx); lua_number2int(k, n); if (luaV_rawequalobj(&f->k[k], v)) return k; /* else may be a collision (e.g., between 0.0 and "\0\0\0\0\0\0\0\0"); go through and create a new entry for this value */ } /* constant not found; create a new entry */ oldsize = f->sizek; k = fs->nk; /* numerical value does not need GC barrier; table has no metatable, so it does not need to invalidate cache */ setnvalue(idx, cast_num(k)); luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Ax, "constants"); while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]); setobj(L, &f->k[k], v); fs->nk++; luaC_barrier(L, f, v); return k; } int luaK_stringK (FuncState *fs, TString *s) { TValue o; setsvalue(fs->ls->L, &o, s); return addk(fs, &o, &o); } int luaK_numberK (FuncState *fs, lua_Number r) { int n; lua_State *L = fs->ls->L; TValue o; setnvalue(&o, r); if (r == 0 || luai_numisnan(NULL, r)) { /* handle -0 and NaN */ /* use raw representation as key to avoid numeric problems */ setsvalue(L, L->top, luaS_newlstr(L, (char *)&r, sizeof(r))); incr_top(L); n = addk(fs, L->top - 1, &o); L->top--; } else n = addk(fs, &o, &o); /* regular case */ return n; } static int boolK (FuncState *fs, int b) { TValue o; setbvalue(&o, b); return addk(fs, &o, &o); } static int nilK (FuncState *fs) { TValue k, v; setnilvalue(&v); /* cannot use nil as key; instead use table itself to represent nil */ sethvalue(fs->ls->L, &k, fs->h); return addk(fs, &k, &v); } void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) { if (e->k == VCALL) { /* expression is an open function call? */ SETARG_C(getcode(fs, e), nresults+1); } else if (e->k == VVARARG) { SETARG_B(getcode(fs, e), nresults+1); SETARG_A(getcode(fs, e), fs->freereg); luaK_reserveregs(fs, 1); } } void luaK_setoneret (FuncState *fs, expdesc *e) { if (e->k == VCALL) { /* expression is an open function call? */ e->k = VNONRELOC; e->u.info = GETARG_A(getcode(fs, e)); } else if (e->k == VVARARG) { SETARG_B(getcode(fs, e), 2); e->k = VRELOCABLE; /* can relocate its simple result */ } } void luaK_dischargevars (FuncState *fs, expdesc *e) { switch (e->k) { case VLOCAL: { e->k = VNONRELOC; break; } case VUPVAL: { e->u.info = luaK_codeABC(fs, OP_GETUPVAL, 0, e->u.info, 0); e->k = VRELOCABLE; break; } case VINDEXED: { OpCode op = OP_GETTABUP; /* assume 't' is in an upvalue */ freereg(fs, e->u.ind.idx); if (e->u.ind.vt == VLOCAL) { /* 't' is in a register? */ freereg(fs, e->u.ind.t); op = OP_GETTABLE; } e->u.info = luaK_codeABC(fs, op, 0, e->u.ind.t, e->u.ind.idx); e->k = VRELOCABLE; break; } case VVARARG: case VCALL: { luaK_setoneret(fs, e); break; } default: break; /* there is one value available (somewhere) */ } } static int code_label (FuncState *fs, int A, int b, int jump) { luaK_getlabel(fs); /* those instructions may be jump targets */ return luaK_codeABC(fs, OP_LOADBOOL, A, b, jump); } static void discharge2reg (FuncState *fs, expdesc *e, int reg) { luaK_dischargevars(fs, e); switch (e->k) { case VNIL: { luaK_nil(fs, reg, 1); break; } case VFALSE: case VTRUE: { luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0); break; } case VK: { luaK_codek(fs, reg, e->u.info); break; } case VKNUM: { luaK_codek(fs, reg, luaK_numberK(fs, e->u.nval)); break; } case VRELOCABLE: { Instruction *pc = &getcode(fs, e); SETARG_A(*pc, reg); break; } case VNONRELOC: { if (reg != e->u.info) luaK_codeABC(fs, OP_MOVE, reg, e->u.info, 0); break; } default: { lua_assert(e->k == VVOID || e->k == VJMP); return; /* nothing to do... */ } } e->u.info = reg; e->k = VNONRELOC; } static void discharge2anyreg (FuncState *fs, expdesc *e) { if (e->k != VNONRELOC) { luaK_reserveregs(fs, 1); discharge2reg(fs, e, fs->freereg-1); } } static void exp2reg (FuncState *fs, expdesc *e, int reg) { discharge2reg(fs, e, reg); if (e->k == VJMP) luaK_concat(fs, &e->t, e->u.info); /* put this jump in `t' list */ if (hasjumps(e)) { int final; /* position after whole expression */ int p_f = NO_JUMP; /* position of an eventual LOAD false */ int p_t = NO_JUMP; /* position of an eventual LOAD true */ if (need_value(fs, e->t) || need_value(fs, e->f)) { int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs); p_f = code_label(fs, reg, 0, 1); p_t = code_label(fs, reg, 1, 0); luaK_patchtohere(fs, fj); } final = luaK_getlabel(fs); patchlistaux(fs, e->f, final, reg, p_f); patchlistaux(fs, e->t, final, reg, p_t); } e->f = e->t = NO_JUMP; e->u.info = reg; e->k = VNONRELOC; } void luaK_exp2nextreg (FuncState *fs, expdesc *e) { luaK_dischargevars(fs, e); freeexp(fs, e); luaK_reserveregs(fs, 1); exp2reg(fs, e, fs->freereg - 1); } int luaK_exp2anyreg (FuncState *fs, expdesc *e) { luaK_dischargevars(fs, e); if (e->k == VNONRELOC) { if (!hasjumps(e)) return e->u.info; /* exp is already in a register */ if (e->u.info >= fs->nactvar) { /* reg. is not a local? */ exp2reg(fs, e, e->u.info); /* put value on it */ return e->u.info; } } luaK_exp2nextreg(fs, e); /* default */ return e->u.info; } void luaK_exp2anyregup (FuncState *fs, expdesc *e) { if (e->k != VUPVAL || hasjumps(e)) luaK_exp2anyreg(fs, e); } void luaK_exp2val (FuncState *fs, expdesc *e) { if (hasjumps(e)) luaK_exp2anyreg(fs, e); else luaK_dischargevars(fs, e); } int luaK_exp2RK (FuncState *fs, expdesc *e) { luaK_exp2val(fs, e); switch (e->k) { case VTRUE: case VFALSE: case VNIL: { if (fs->nk <= MAXINDEXRK) { /* constant fits in RK operand? */ e->u.info = (e->k == VNIL) ? nilK(fs) : boolK(fs, (e->k == VTRUE)); e->k = VK; return RKASK(e->u.info); } else break; } case VKNUM: { e->u.info = luaK_numberK(fs, e->u.nval); e->k = VK; /* go through */ } case VK: { if (e->u.info <= MAXINDEXRK) /* constant fits in argC? */ return RKASK(e->u.info); else break; } default: break; } /* not a constant in the right range: put it in a register */ return luaK_exp2anyreg(fs, e); } void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) { switch (var->k) { case VLOCAL: { freeexp(fs, ex); exp2reg(fs, ex, var->u.info); return; } case VUPVAL: { int e = luaK_exp2anyreg(fs, ex); luaK_codeABC(fs, OP_SETUPVAL, e, var->u.info, 0); break; } case VINDEXED: { OpCode op = (var->u.ind.vt == VLOCAL) ? OP_SETTABLE : OP_SETTABUP; int e = luaK_exp2RK(fs, ex); luaK_codeABC(fs, op, var->u.ind.t, var->u.ind.idx, e); break; } default: { lua_assert(0); /* invalid var kind to store */ break; } } freeexp(fs, ex); } void luaK_self (FuncState *fs, expdesc *e, expdesc *key) { int ereg; luaK_exp2anyreg(fs, e); ereg = e->u.info; /* register where 'e' was placed */ freeexp(fs, e); e->u.info = fs->freereg; /* base register for op_self */ e->k = VNONRELOC; luaK_reserveregs(fs, 2); /* function and 'self' produced by op_self */ luaK_codeABC(fs, OP_SELF, e->u.info, ereg, luaK_exp2RK(fs, key)); freeexp(fs, key); } static void invertjump (FuncState *fs, expdesc *e) { Instruction *pc = getjumpcontrol(fs, e->u.info); lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET && GET_OPCODE(*pc) != OP_TEST); SETARG_A(*pc, !(GETARG_A(*pc))); } static int jumponcond (FuncState *fs, expdesc *e, int cond) { if (e->k == VRELOCABLE) { Instruction ie = getcode(fs, e); if (GET_OPCODE(ie) == OP_NOT) { fs->pc--; /* remove previous OP_NOT */ return condjump(fs, OP_TEST, GETARG_B(ie), 0, !cond); } /* else go through */ } discharge2anyreg(fs, e); freeexp(fs, e); return condjump(fs, OP_TESTSET, NO_REG, e->u.info, cond); } void luaK_goiftrue (FuncState *fs, expdesc *e) { int pc; /* pc of last jump */ luaK_dischargevars(fs, e); switch (e->k) { case VJMP: { invertjump(fs, e); pc = e->u.info; break; } case VK: case VKNUM: case VTRUE: { pc = NO_JUMP; /* always true; do nothing */ break; } default: { pc = jumponcond(fs, e, 0); break; } } luaK_concat(fs, &e->f, pc); /* insert last jump in `f' list */ luaK_patchtohere(fs, e->t); e->t = NO_JUMP; } void luaK_goiffalse (FuncState *fs, expdesc *e) { int pc; /* pc of last jump */ luaK_dischargevars(fs, e); switch (e->k) { case VJMP: { pc = e->u.info; break; } case VNIL: case VFALSE: { pc = NO_JUMP; /* always false; do nothing */ break; } default: { pc = jumponcond(fs, e, 1); break; } } luaK_concat(fs, &e->t, pc); /* insert last jump in `t' list */ luaK_patchtohere(fs, e->f); e->f = NO_JUMP; } static void codenot (FuncState *fs, expdesc *e) { luaK_dischargevars(fs, e); switch (e->k) { case VNIL: case VFALSE: { e->k = VTRUE; break; } case VK: case VKNUM: case VTRUE: { e->k = VFALSE; break; } case VJMP: { invertjump(fs, e); break; } case VRELOCABLE: case VNONRELOC: { discharge2anyreg(fs, e); freeexp(fs, e); e->u.info = luaK_codeABC(fs, OP_NOT, 0, e->u.info, 0); e->k = VRELOCABLE; break; } default: { lua_assert(0); /* cannot happen */ break; } } /* interchange true and false lists */ { int temp = e->f; e->f = e->t; e->t = temp; } removevalues(fs, e->f); removevalues(fs, e->t); } void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) { lua_assert(!hasjumps(t)); t->u.ind.t = t->u.info; t->u.ind.idx = luaK_exp2RK(fs, k); t->u.ind.vt = (t->k == VUPVAL) ? VUPVAL : check_exp(vkisinreg(t->k), VLOCAL); t->k = VINDEXED; } static int constfolding (OpCode op, expdesc *e1, expdesc *e2) { lua_Number r; if (!isnumeral(e1) || !isnumeral(e2)) return 0; if ((op == OP_DIV || op == OP_MOD) && e2->u.nval == 0) return 0; /* do not attempt to divide by 0 */ r = luaO_arith(op - OP_ADD + LUA_OPADD, e1->u.nval, e2->u.nval); e1->u.nval = r; return 1; } static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2, int line) { if (constfolding(op, e1, e2)) return; else { int o2 = (op != OP_UNM && op != OP_LEN) ? luaK_exp2RK(fs, e2) : 0; int o1 = luaK_exp2RK(fs, e1); if (o1 > o2) { freeexp(fs, e1); freeexp(fs, e2); } else { freeexp(fs, e2); freeexp(fs, e1); } e1->u.info = luaK_codeABC(fs, op, 0, o1, o2); e1->k = VRELOCABLE; luaK_fixline(fs, line); } } static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1, expdesc *e2) { int o1 = luaK_exp2RK(fs, e1); int o2 = luaK_exp2RK(fs, e2); freeexp(fs, e2); freeexp(fs, e1); if (cond == 0 && op != OP_EQ) { int temp; /* exchange args to replace by `<' or `<=' */ temp = o1; o1 = o2; o2 = temp; /* o1 <==> o2 */ cond = 1; } e1->u.info = condjump(fs, op, cond, o1, o2); e1->k = VJMP; } void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e, int line) { expdesc e2; e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0; switch (op) { case OPR_MINUS: { if (isnumeral(e)) /* minus constant? */ e->u.nval = luai_numunm(NULL, e->u.nval); /* fold it */ else { luaK_exp2anyreg(fs, e); codearith(fs, OP_UNM, e, &e2, line); } break; } case OPR_NOT: codenot(fs, e); break; case OPR_LEN: { luaK_exp2anyreg(fs, e); /* cannot operate on constants */ codearith(fs, OP_LEN, e, &e2, line); break; } default: lua_assert(0); } } void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { switch (op) { case OPR_AND: { luaK_goiftrue(fs, v); break; } case OPR_OR: { luaK_goiffalse(fs, v); break; } case OPR_CONCAT: { luaK_exp2nextreg(fs, v); /* operand must be on the `stack' */ break; } case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV: case OPR_MOD: case OPR_POW: { if (!isnumeral(v)) luaK_exp2RK(fs, v); break; } default: { luaK_exp2RK(fs, v); break; } } } void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2, int line) { switch (op) { case OPR_AND: { lua_assert(e1->t == NO_JUMP); /* list must be closed */ luaK_dischargevars(fs, e2); luaK_concat(fs, &e2->f, e1->f); *e1 = *e2; break; } case OPR_OR: { lua_assert(e1->f == NO_JUMP); /* list must be closed */ luaK_dischargevars(fs, e2); luaK_concat(fs, &e2->t, e1->t); *e1 = *e2; break; } case OPR_CONCAT: { luaK_exp2val(fs, e2); if (e2->k == VRELOCABLE && GET_OPCODE(getcode(fs, e2)) == OP_CONCAT) { lua_assert(e1->u.info == GETARG_B(getcode(fs, e2))-1); freeexp(fs, e1); SETARG_B(getcode(fs, e2), e1->u.info); e1->k = VRELOCABLE; e1->u.info = e2->u.info; } else { luaK_exp2nextreg(fs, e2); /* operand must be on the 'stack' */ codearith(fs, OP_CONCAT, e1, e2, line); } break; } case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV: case OPR_MOD: case OPR_POW: { codearith(fs, cast(OpCode, op - OPR_ADD + OP_ADD), e1, e2, line); break; } case OPR_EQ: case OPR_LT: case OPR_LE: { codecomp(fs, cast(OpCode, op - OPR_EQ + OP_EQ), 1, e1, e2); break; } case OPR_NE: case OPR_GT: case OPR_GE: { codecomp(fs, cast(OpCode, op - OPR_NE + OP_EQ), 0, e1, e2); break; } default: lua_assert(0); } } void luaK_fixline (FuncState *fs, int line) { fs->f->lineinfo[fs->pc - 1] = line; } void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1; int b = (tostore == LUA_MULTRET) ? 0 : tostore; lua_assert(tostore != 0); if (c <= MAXARG_C) luaK_codeABC(fs, OP_SETLIST, base, b, c); else if (c <= MAXARG_Ax) { luaK_codeABC(fs, OP_SETLIST, base, b, 0); codeextraarg(fs, c); } else luaX_syntaxerror(fs->ls, "constructor too long"); fs->freereg = base + 1; /* free registers with list values */ } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lauxlib.cpp0000644000175000017500000006557312320456500020702 0ustar mathieumathieu/* ** $Id: lauxlib.c,v 1.240 2011/12/06 16:33:55 roberto Exp $ ** Auxiliary functions for building Lua libraries ** See Copyright Notice in lua.h */ #include #include #include #include #include /* This file uses only the official API of Lua. ** Any function declared here could be written as an application function. */ #define lauxlib_c #define LUA_LIB #include "lua.h" #include "lauxlib.h" /* ** {====================================================== ** Traceback ** ======================================================= */ #define LEVELS1 12 /* size of the first part of the stack */ #define LEVELS2 10 /* size of the second part of the stack */ /* ** search for 'objidx' in table at index -1. ** return 1 + string at top if find a good name. */ static int findfield (lua_State *L, int objidx, int level) { if (level == 0 || !lua_istable(L, -1)) return 0; /* not found */ lua_pushnil(L); /* start 'next' loop */ while (lua_next(L, -2)) { /* for each pair in table */ if (lua_type(L, -2) == LUA_TSTRING) { /* ignore non-string keys */ if (lua_rawequal(L, objidx, -1)) { /* found object? */ lua_pop(L, 1); /* remove value (but keep name) */ return 1; } else if (findfield(L, objidx, level - 1)) { /* try recursively */ lua_remove(L, -2); /* remove table (but keep name) */ lua_pushliteral(L, "."); lua_insert(L, -2); /* place '.' between the two names */ lua_concat(L, 3); return 1; } } lua_pop(L, 1); /* remove value */ } return 0; /* not found */ } static int pushglobalfuncname (lua_State *L, lua_Debug *ar) { int top = lua_gettop(L); lua_getinfo(L, "f", ar); /* push function */ lua_pushglobaltable(L); if (findfield(L, top + 1, 2)) { lua_copy(L, -1, top + 1); /* move name to proper place */ lua_pop(L, 2); /* remove pushed values */ return 1; } else { lua_settop(L, top); /* remove function and global table */ return 0; } } static void pushfuncname (lua_State *L, lua_Debug *ar) { if (*ar->namewhat != '\0') /* is there a name? */ lua_pushfstring(L, "function " LUA_QS, ar->name); else if (*ar->what == 'm') /* main? */ lua_pushfstring(L, "main chunk"); else if (*ar->what == 'C') { if (pushglobalfuncname(L, ar)) { lua_pushfstring(L, "function " LUA_QS, lua_tostring(L, -1)); lua_remove(L, -2); /* remove name */ } else lua_pushliteral(L, "?"); } else lua_pushfstring(L, "function <%s:%d>", ar->short_src, ar->linedefined); } static int countlevels (lua_State *L) { lua_Debug ar; int li = 1, le = 1; /* find an upper bound */ while (lua_getstack(L, le, &ar)) { li = le; le *= 2; } /* do a binary search */ while (li < le) { int m = (li + le)/2; if (lua_getstack(L, m, &ar)) li = m + 1; else le = m; } return le - 1; } LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, const char *msg, int level) { lua_Debug ar; int top = lua_gettop(L); int numlevels = countlevels(L1); int mark = (numlevels > LEVELS1 + LEVELS2) ? LEVELS1 : 0; if (msg) lua_pushfstring(L, "%s\n", msg); lua_pushliteral(L, "stack traceback:"); while (lua_getstack(L1, level++, &ar)) { if (level == mark) { /* too many levels? */ lua_pushliteral(L, "\n\t..."); /* add a '...' */ level = numlevels - LEVELS2; /* and skip to last ones */ } else { lua_getinfo(L1, "Slnt", &ar); lua_pushfstring(L, "\n\t%s:", ar.short_src); if (ar.currentline > 0) lua_pushfstring(L, "%d:", ar.currentline); lua_pushliteral(L, " in "); pushfuncname(L, &ar); if (ar.istailcall) lua_pushliteral(L, "\n\t(...tail calls...)"); lua_concat(L, lua_gettop(L) - top); } } lua_concat(L, lua_gettop(L) - top); } /* }====================================================== */ /* ** {====================================================== ** Error-report functions ** ======================================================= */ LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) { lua_Debug ar; if (!lua_getstack(L, 0, &ar)) /* no stack frame? */ return luaL_error(L, "bad argument #%d (%s)", narg, extramsg); lua_getinfo(L, "n", &ar); if (strcmp(ar.namewhat, "method") == 0) { narg--; /* do not count `self' */ if (narg == 0) /* error is in the self argument itself? */ return luaL_error(L, "calling " LUA_QS " on bad self", ar.name); } if (ar.name == NULL) ar.name = (pushglobalfuncname(L, &ar)) ? lua_tostring(L, -1) : "?"; return luaL_error(L, "bad argument #%d to " LUA_QS " (%s)", narg, ar.name, extramsg); } static int typeerror (lua_State *L, int narg, const char *tname) { const char *msg = lua_pushfstring(L, "%s expected, got %s", tname, luaL_typename(L, narg)); return luaL_argerror(L, narg, msg); } static void tag_error (lua_State *L, int narg, int tag) { typeerror(L, narg, lua_typename(L, tag)); } LUALIB_API void luaL_where (lua_State *L, int level) { lua_Debug ar; if (lua_getstack(L, level, &ar)) { /* check function at level */ lua_getinfo(L, "Sl", &ar); /* get info about it */ if (ar.currentline > 0) { /* is there info? */ lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline); return; } } lua_pushliteral(L, ""); /* else, no information available... */ } LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) { va_list argp; va_start(argp, fmt); luaL_where(L, 1); lua_pushvfstring(L, fmt, argp); va_end(argp); lua_concat(L, 2); return lua_error(L); } LUALIB_API int luaL_fileresult (lua_State *L, int stat, const char *fname) { int en = errno; /* calls to Lua API may change this value */ if (stat) { lua_pushboolean(L, 1); return 1; } else { lua_pushnil(L); if (fname) lua_pushfstring(L, "%s: %s", fname, strerror(en)); else lua_pushfstring(L, "%s", strerror(en)); lua_pushinteger(L, en); return 3; } } #if !defined(inspectstat) /* { */ #if defined(LUA_USE_POSIX) #include /* ** use appropriate macros to interpret 'pclose' return status */ #define inspectstat(stat,what) \ if (WIFEXITED(stat)) { stat = WEXITSTATUS(stat); } \ else if (WIFSIGNALED(stat)) { stat = WTERMSIG(stat); what = "signal"; } #else #define inspectstat(stat,what) /* no op */ #endif #endif /* } */ LUALIB_API int luaL_execresult (lua_State *L, int stat) { const char *what = "exit"; /* type of termination */ if (stat == -1) /* error? */ return luaL_fileresult(L, 0, NULL); else { inspectstat(stat, what); /* interpret result */ if (*what == 'e' && stat == 0) /* successful termination? */ lua_pushboolean(L, 1); else lua_pushnil(L); lua_pushstring(L, what); lua_pushinteger(L, stat); return 3; /* return true/nil,what,code */ } } /* }====================================================== */ /* ** {====================================================== ** Userdata's metatable manipulation ** ======================================================= */ LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { luaL_getmetatable(L, tname); /* try to get metatable */ if (!lua_isnil(L, -1)) /* name already in use? */ return 0; /* leave previous value on top, but return 0 */ lua_pop(L, 1); lua_newtable(L); /* create metatable */ lua_pushvalue(L, -1); lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */ return 1; } LUALIB_API void luaL_setmetatable (lua_State *L, const char *tname) { luaL_getmetatable(L, tname); lua_setmetatable(L, -2); } LUALIB_API void *luaL_testudata (lua_State *L, int ud, const char *tname) { void *p = lua_touserdata(L, ud); if (p != NULL) { /* value is a userdata? */ if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ luaL_getmetatable(L, tname); /* get correct metatable */ if (!lua_rawequal(L, -1, -2)) /* not the same? */ p = NULL; /* value is a userdata with wrong metatable */ lua_pop(L, 2); /* remove both metatables */ return p; } } return NULL; /* value is not a userdata with a metatable */ } LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) { void *p = luaL_testudata(L, ud, tname); if (p == NULL) typeerror(L, ud, tname); return p; } /* }====================================================== */ /* ** {====================================================== ** Argument check functions ** ======================================================= */ LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def, const char *const lst[]) { const char *name = (def) ? luaL_optstring(L, narg, def) : luaL_checkstring(L, narg); int i; for (i=0; lst[i]; i++) if (strcmp(lst[i], name) == 0) return i; return luaL_argerror(L, narg, lua_pushfstring(L, "invalid option " LUA_QS, name)); } LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *msg) { /* keep some extra space to run error routines, if needed */ const int extra = LUA_MINSTACK; if (!lua_checkstack(L, space + extra)) { if (msg) luaL_error(L, "stack overflow (%s)", msg); else luaL_error(L, "stack overflow"); } } LUALIB_API void luaL_checktype (lua_State *L, int narg, int t) { if (lua_type(L, narg) != t) tag_error(L, narg, t); } LUALIB_API void luaL_checkany (lua_State *L, int narg) { if (lua_type(L, narg) == LUA_TNONE) luaL_argerror(L, narg, "value expected"); } LUALIB_API const char *luaL_checklstring (lua_State *L, int narg, size_t *len) { const char *s = lua_tolstring(L, narg, len); if (!s) tag_error(L, narg, LUA_TSTRING); return s; } LUALIB_API const char *luaL_optlstring (lua_State *L, int narg, const char *def, size_t *len) { if (lua_isnoneornil(L, narg)) { if (len) *len = (def ? strlen(def) : 0); return def; } else return luaL_checklstring(L, narg, len); } LUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg) { int isnum; lua_Number d = lua_tonumberx(L, narg, &isnum); if (!isnum) tag_error(L, narg, LUA_TNUMBER); return d; } LUALIB_API lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number def) { return luaL_opt(L, luaL_checknumber, narg, def); } LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) { int isnum; lua_Integer d = lua_tointegerx(L, narg, &isnum); if (!isnum) tag_error(L, narg, LUA_TNUMBER); return d; } LUALIB_API lua_Unsigned luaL_checkunsigned (lua_State *L, int narg) { int isnum; lua_Unsigned d = lua_tounsignedx(L, narg, &isnum); if (!isnum) tag_error(L, narg, LUA_TNUMBER); return d; } LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg, lua_Integer def) { return luaL_opt(L, luaL_checkinteger, narg, def); } LUALIB_API lua_Unsigned luaL_optunsigned (lua_State *L, int narg, lua_Unsigned def) { return luaL_opt(L, luaL_checkunsigned, narg, def); } /* }====================================================== */ /* ** {====================================================== ** Generic Buffer manipulation ** ======================================================= */ /* ** check whether buffer is using a userdata on the stack as a temporary ** buffer */ #define buffonstack(B) ((B)->b != (B)->initb) /* ** returns a pointer to a free area with at least 'sz' bytes */ LUALIB_API char *luaL_prepbuffsize (luaL_Buffer *B, size_t sz) { lua_State *L = B->L; if (B->size - B->n < sz) { /* not enough space? */ char *newbuff; size_t newsize = B->size * 2; /* double buffer size */ if (newsize - B->n < sz) /* not bit enough? */ newsize = B->n + sz; if (newsize < B->n || newsize - B->n < sz) luaL_error(L, "buffer too large"); /* create larger buffer */ newbuff = (char *)lua_newuserdata(L, newsize * sizeof(char)); /* move content to new buffer */ memcpy(newbuff, B->b, B->n * sizeof(char)); if (buffonstack(B)) lua_remove(L, -2); /* remove old buffer */ B->b = newbuff; B->size = newsize; } return &B->b[B->n]; } LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) { char *b = luaL_prepbuffsize(B, l); memcpy(b, s, l * sizeof(char)); luaL_addsize(B, l); } LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) { luaL_addlstring(B, s, strlen(s)); } LUALIB_API void luaL_pushresult (luaL_Buffer *B) { lua_State *L = B->L; lua_pushlstring(L, B->b, B->n); if (buffonstack(B)) lua_remove(L, -2); /* remove old buffer */ } LUALIB_API void luaL_pushresultsize (luaL_Buffer *B, size_t sz) { luaL_addsize(B, sz); luaL_pushresult(B); } LUALIB_API void luaL_addvalue (luaL_Buffer *B) { lua_State *L = B->L; size_t l; const char *s = lua_tolstring(L, -1, &l); if (buffonstack(B)) lua_insert(L, -2); /* put value below buffer */ luaL_addlstring(B, s, l); lua_remove(L, (buffonstack(B)) ? -2 : -1); /* remove value */ } LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { B->L = L; B->b = B->initb; B->n = 0; B->size = LUAL_BUFFERSIZE; } LUALIB_API char *luaL_buffinitsize (lua_State *L, luaL_Buffer *B, size_t sz) { luaL_buffinit(L, B); return luaL_prepbuffsize(B, sz); } /* }====================================================== */ /* ** {====================================================== ** Reference system ** ======================================================= */ /* index of free-list header */ #define freelist 0 LUALIB_API int luaL_ref (lua_State *L, int t) { int ref; t = lua_absindex(L, t); if (lua_isnil(L, -1)) { lua_pop(L, 1); /* remove from stack */ return LUA_REFNIL; /* `nil' has a unique fixed reference */ } lua_rawgeti(L, t, freelist); /* get first free element */ ref = (int)lua_tointeger(L, -1); /* ref = t[freelist] */ lua_pop(L, 1); /* remove it from stack */ if (ref != 0) { /* any free element? */ lua_rawgeti(L, t, ref); /* remove it from list */ lua_rawseti(L, t, freelist); /* (t[freelist] = t[ref]) */ } else /* no free elements */ ref = (int)lua_rawlen(L, t) + 1; /* get a new reference */ lua_rawseti(L, t, ref); return ref; } LUALIB_API void luaL_unref (lua_State *L, int t, int ref) { if (ref >= 0) { t = lua_absindex(L, t); lua_rawgeti(L, t, freelist); lua_rawseti(L, t, ref); /* t[ref] = t[freelist] */ lua_pushinteger(L, ref); lua_rawseti(L, t, freelist); /* t[freelist] = ref */ } } /* }====================================================== */ /* ** {====================================================== ** Load functions ** ======================================================= */ typedef struct LoadF { int n; /* number of pre-read characters */ FILE *f; /* file being read */ char buff[LUAL_BUFFERSIZE]; /* area for reading file */ } LoadF; static const char *getF (lua_State *L, void *ud, size_t *size) { LoadF *lf = (LoadF *)ud; (void)L; /* not used */ if (lf->n > 0) { /* are there pre-read characters to be read? */ *size = lf->n; /* return them (chars already in buffer) */ lf->n = 0; /* no more pre-read characters */ } else { /* read a block from file */ /* 'fread' can return > 0 *and* set the EOF flag. If next call to 'getF' called 'fread', it might still wait for user input. The next check avoids this problem. */ if (feof(lf->f)) return NULL; *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f); /* read block */ } return lf->buff; } static int errfile (lua_State *L, const char *what, int fnameindex) { const char *serr = strerror(errno); const char *filename = lua_tostring(L, fnameindex) + 1; lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr); lua_remove(L, fnameindex); return LUA_ERRFILE; } static int skipBOM (LoadF *lf) { const char *p = "\xEF\xBB\xBF"; /* Utf8 BOM mark */ int c; lf->n = 0; do { c = getc(lf->f); if (c == EOF || c != *(unsigned char *)p++) return c; lf->buff[lf->n++] = c; /* to be read by the parser */ } while (*p != '\0'); lf->n = 0; /* prefix matched; discard it */ return getc(lf->f); /* return next character */ } /* ** reads the first character of file 'f' and skips an optional BOM mark ** in its beginning plus its first line if it starts with '#'. Returns ** true if it skipped the first line. In any case, '*cp' has the ** first "valid" character of the file (after the optional BOM and ** a first-line comment). */ static int skipcomment (LoadF *lf, int *cp) { int c = *cp = skipBOM(lf); if (c == '#') { /* first line is a comment (Unix exec. file)? */ while ((c = getc(lf->f)) != EOF && c != '\n') ; /* skip first line */ *cp = getc(lf->f); /* skip end-of-line */ return 1; /* there was a comment */ } else return 0; /* no comment */ } LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename, const char *mode) { LoadF lf; int status, readstatus; int c; int fnameindex = lua_gettop(L) + 1; /* index of filename on the stack */ if (filename == NULL) { lua_pushliteral(L, "=stdin"); lf.f = stdin; } else { lua_pushfstring(L, "@%s", filename); lf.f = fopen(filename, "r"); if (lf.f == NULL) return errfile(L, "open", fnameindex); } if (skipcomment(&lf, &c)) /* read initial portion */ lf.buff[lf.n++] = '\n'; /* add line to correct line numbers */ if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */ lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */ if (lf.f == NULL) return errfile(L, "reopen", fnameindex); skipcomment(&lf, &c); /* re-read initial portion */ } if (c != EOF) lf.buff[lf.n++] = c; /* 'c' is the first character of the stream */ status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode); readstatus = ferror(lf.f); if (filename) fclose(lf.f); /* close file (even in case of errors) */ if (readstatus) { lua_settop(L, fnameindex); /* ignore results from `lua_load' */ return errfile(L, "read", fnameindex); } lua_remove(L, fnameindex); return status; } typedef struct LoadS { const char *s; size_t size; } LoadS; static const char *getS (lua_State *L, void *ud, size_t *size) { LoadS *ls = (LoadS *)ud; (void)L; /* not used */ if (ls->size == 0) return NULL; *size = ls->size; ls->size = 0; return ls->s; } LUALIB_API int luaL_loadbufferx (lua_State *L, const char *buff, size_t size, const char *name, const char *mode) { LoadS ls; ls.s = buff; ls.size = size; return lua_load(L, getS, &ls, name, mode); } LUALIB_API int luaL_loadstring (lua_State *L, const char *s) { return luaL_loadbuffer(L, s, strlen(s), s); } /* }====================================================== */ LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { if (!lua_getmetatable(L, obj)) /* no metatable? */ return 0; lua_pushstring(L, event); lua_rawget(L, -2); if (lua_isnil(L, -1)) { lua_pop(L, 2); /* remove metatable and metafield */ return 0; } else { lua_remove(L, -2); /* remove only metatable */ return 1; } } LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) { obj = lua_absindex(L, obj); if (!luaL_getmetafield(L, obj, event)) /* no metafield? */ return 0; lua_pushvalue(L, obj); lua_call(L, 1, 1); return 1; } LUALIB_API int luaL_len (lua_State *L, int idx) { int l; int isnum; lua_len(L, idx); l = (int)lua_tointegerx(L, -1, &isnum); if (!isnum) luaL_error(L, "object length is not a number"); lua_pop(L, 1); /* remove object */ return l; } LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) { if (!luaL_callmeta(L, idx, "__tostring")) { /* no metafield? */ switch (lua_type(L, idx)) { case LUA_TNUMBER: case LUA_TSTRING: lua_pushvalue(L, idx); break; case LUA_TBOOLEAN: lua_pushstring(L, (lua_toboolean(L, idx) ? "true" : "false")); break; case LUA_TNIL: lua_pushliteral(L, "nil"); break; default: lua_pushfstring(L, "%s: %p", luaL_typename(L, idx), lua_topointer(L, idx)); break; } } return lua_tolstring(L, -1, len); } /* ** {====================================================== ** Compatibility with 5.1 module functions ** ======================================================= */ #if defined(LUA_COMPAT_MODULE) static const char *luaL_findtable (lua_State *L, int idx, const char *fname, int szhint) { const char *e; if (idx) lua_pushvalue(L, idx); do { e = strchr(fname, '.'); if (e == NULL) e = fname + strlen(fname); lua_pushlstring(L, fname, e - fname); lua_rawget(L, -2); if (lua_isnil(L, -1)) { /* no such field? */ lua_pop(L, 1); /* remove this nil */ lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */ lua_pushlstring(L, fname, e - fname); lua_pushvalue(L, -2); lua_settable(L, -4); /* set new table into field */ } else if (!lua_istable(L, -1)) { /* field has a non-table value? */ lua_pop(L, 2); /* remove table and value */ return fname; /* return problematic part of the name */ } lua_remove(L, -2); /* remove previous table */ fname = e + 1; } while (*e == '.'); return NULL; } /* ** Count number of elements in a luaL_Reg list. */ static int libsize (const luaL_Reg *l) { int size = 0; for (; l && l->name; l++) size++; return size; } /* ** Find or create a module table with a given name. The function ** first looks at the _LOADED table and, if that fails, try a ** global variable with that name. In any case, leaves on the stack ** the module table. */ LUALIB_API void luaL_pushmodule (lua_State *L, const char *modname, int sizehint) { luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 1); /* get _LOADED table */ lua_getfield(L, -1, modname); /* get _LOADED[modname] */ if (!lua_istable(L, -1)) { /* not found? */ lua_pop(L, 1); /* remove previous result */ /* try global variable (and create one if it does not exist) */ lua_pushglobaltable(L); if (luaL_findtable(L, 0, modname, sizehint) != NULL) luaL_error(L, "name conflict for module " LUA_QS, modname); lua_pushvalue(L, -1); lua_setfield(L, -3, modname); /* _LOADED[modname] = new table */ } lua_remove(L, -2); /* remove _LOADED table */ } LUALIB_API void luaL_openlib (lua_State *L, const char *libname, const luaL_Reg *l, int nup) { luaL_checkversion(L); if (libname) { luaL_pushmodule(L, libname, libsize(l)); /* get/create library table */ lua_insert(L, -(nup + 1)); /* move library table to below upvalues */ } if (l) luaL_setfuncs(L, l, nup); else lua_pop(L, nup); /* remove upvalues */ } #endif /* }====================================================== */ /* ** set functions from list 'l' into table at top - 'nup'; each ** function gets the 'nup' elements at the top as upvalues. ** Returns with only the table at the stack. */ LUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) { luaL_checkstack(L, nup, "too many upvalues"); for (; l->name != NULL; l++) { /* fill the table with given functions */ int i; for (i = 0; i < nup; i++) /* copy upvalues to the top */ lua_pushvalue(L, -nup); lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */ lua_setfield(L, -(nup + 2), l->name); } lua_pop(L, nup); /* remove upvalues */ } /* ** ensure that stack[idx][fname] has a table and push that table ** into the stack */ LUALIB_API int luaL_getsubtable (lua_State *L, int idx, const char *fname) { lua_getfield(L, idx, fname); if (lua_istable(L, -1)) return 1; /* table already there */ else { idx = lua_absindex(L, idx); lua_pop(L, 1); /* remove previous result */ lua_newtable(L); lua_pushvalue(L, -1); /* copy to be left at top */ lua_setfield(L, idx, fname); /* assign new table to field */ return 0; /* false, because did not find table there */ } } /* ** stripped-down 'require'. Calls 'openf' to open a module, ** registers the result in 'package.loaded' table and, if 'glb' ** is true, also registers the result in the global table. ** Leaves resulting module on the top. */ LUALIB_API void luaL_requiref (lua_State *L, const char *modname, lua_CFunction openf, int glb) { lua_pushcfunction(L, openf); lua_pushstring(L, modname); /* argument to open function */ lua_call(L, 1, 1); /* open module */ luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED"); lua_pushvalue(L, -2); /* make copy of module (call result) */ lua_setfield(L, -2, modname); /* _LOADED[modname] = module */ lua_pop(L, 1); /* remove _LOADED table */ if (glb) { lua_pushglobaltable(L); lua_pushvalue(L, -2); /* copy of 'mod' */ lua_setfield(L, -2, modname); /* _G[modname] = module */ lua_pop(L, 1); /* remove _G table */ } } LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p, const char *r) { const char *wild; size_t l = strlen(p); luaL_Buffer b; luaL_buffinit(L, &b); while ((wild = strstr(s, p)) != NULL) { luaL_addlstring(&b, s, wild - s); /* push prefix */ luaL_addstring(&b, r); /* push replacement in place of pattern */ s = wild + l; /* continue after `p' */ } luaL_addstring(&b, s); /* push last suffix */ luaL_pushresult(&b); return lua_tostring(L, -1); } static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { (void)ud; (void)osize; /* not used */ if (nsize == 0) { free(ptr); return NULL; } else return realloc(ptr, nsize); } static int panic (lua_State *L) { luai_writestringerror("PANIC: unprotected error in call to Lua API (%s)\n", lua_tostring(L, -1)); return 0; /* return to Lua to abort */ } LUALIB_API lua_State *luaL_newstate (void) { lua_State *L = lua_newstate(l_alloc, NULL); if (L) lua_atpanic(L, &panic); return L; } LUALIB_API void luaL_checkversion_ (lua_State *L, lua_Number ver) { const lua_Number *v = lua_version(L); if (v != lua_version(NULL)) luaL_error(L, "multiple Lua VMs detected"); else if (*v != ver) luaL_error(L, "version mismatch: app. needs %f, Lua core provides %f", ver, *v); /* check conversions number -> integer types */ lua_pushnumber(L, -(lua_Number)0x1234); if (lua_tointeger(L, -1) != -0x1234 || lua_tounsigned(L, -1) != (lua_Unsigned)-0x1234) luaL_error(L, "bad conversion number->int;" " must recompile Lua with proper settings"); lua_pop(L, 1); } ImageVis3D-3.1.0/Tuvok/3rdParty/LUA/lgc.cpp0000644000175000017500000010120312320456500017764 0ustar mathieumathieu/* ** $Id: lgc.c,v 2.116 2011/12/02 13:18:41 roberto Exp $ ** Garbage Collector ** See Copyright Notice in lua.h */ #include #define lgc_c #define LUA_CORE #include "lua.h" #include "ldebug.h" #include "ldo.h" #include "lfunc.h" #include "lgc.h" #include "lmem.h" #include "lobject.h" #include "lstate.h" #include "lstring.h" #include "ltable.h" #include "ltm.h" /* how much to allocate before next GC step */ #define GCSTEPSIZE 1024 /* maximum number of elements to sweep in each single step */ #define GCSWEEPMAX 40 /* cost of sweeping one element */ #define GCSWEEPCOST 1 /* maximum number of finalizers to call in each GC step */ #define GCFINALIZENUM 4 /* cost of marking the root set */ #define GCROOTCOST 10 /* cost of atomic step */ #define GCATOMICCOST 1000 /* basic cost to traverse one object (to be added to the links the object may have) */ #define TRAVCOST 5 /* ** standard negative debt for GC; a reasonable "time" to wait before ** starting a new cycle */ #define stddebt(g) (-cast(l_mem, gettotalbytes(g)/100) * g->gcpause) /* ** 'makewhite' erases all color bits plus the old bit and then ** sets only the current white bit */ #define maskcolors (~(bit2mask(BLACKBIT, OLDBIT) | WHITEBITS)) #define makewhite(g,x) \ (gch(x)->marked = cast_byte((gch(x)->marked & maskcolors) | luaC_white(g))) #define white2gray(x) resetbits(gch(x)->marked, WHITEBITS) #define black2gray(x) resetbit(gch(x)->marked, BLACKBIT) #define stringmark(s) ((void)((s) && resetbits((s)->tsv.marked, WHITEBITS))) #define isfinalized(x) testbit(gch(x)->marked, FINALIZEDBIT) #define checkdeadkey(n) lua_assert(!ttisdeadkey(gkey(n)) || ttisnil(gval(n))) #define checkconsistency(obj) \ lua_longassert(!iscollectable(obj) || righttt(obj)) #define markvalue(g,o) { checkconsistency(o); \ if (valiswhite(o)) reallymarkobject(g,gcvalue(o)); } #define markobject(g,t) { if ((t) && iswhite(obj2gco(t))) \ reallymarkobject(g, obj2gco(t)); } static void reallymarkobject (global_State *g, GCObject *o); /* ** {====================================================== ** Generic functions ** ======================================================= */ /* ** one after last element in a hash array */ #define gnodelast(h) gnode(h, cast(size_t, sizenode(h))) /* ** link table 'h' into list pointed by 'p' */ #define linktable(h,p) ((h)->gclist = *(p), *(p) = obj2gco(h)) /* ** if key is not marked, mark its entry as dead (therefore removing it ** from the table) */ static void removeentry (Node *n) { lua_assert(ttisnil(gval(n))); if (valiswhite(gkey(n))) setdeadvalue(gkey(n)); /* unused and unmarked key; remove it */ } /* ** tells whether a key or value can be cleared from a weak ** table. Non-collectable objects are never removed from weak ** tables. Strings behave as `values', so are never removed too. for ** other objects: if really collected, cannot keep them; for objects ** being finalized, keep them in keys, but not in values */ static int iscleared (const TValue *o) { if (!iscollectable(o)) return 0; else if (ttisstring(o)) { stringmark(rawtsvalue(o)); /* strings are `values', so are never weak */ return 0; } else return iswhite(gcvalue(o)); } /* ** barrier that moves collector forward, that is, mark the white object ** being pointed by a black object. */ void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v) { global_State *g = G(L); lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); lua_assert(isgenerational(g) || g->gcstate != GCSpause); lua_assert(gch(o)->tt != LUA_TTABLE); if (keepinvariant(g)) /* must keep invariant? */ reallymarkobject(g, v); /* restore invariant */ else { /* sweep phase */ lua_assert(issweepphase(g)); makewhite(g, o); /* mark main obj. as white to avoid other barriers */ } } /* ** barrier that moves collector backward, that is, mark the black object ** pointing to a white object as gray again. (Current implementation ** only works for tables; access to 'gclist' is not uniform across ** different types.) */ void luaC_barrierback_ (lua_State *L, GCObject *o) { global_State *g = G(L); lua_assert(isblack(o) && !isdead(g, o) && gch(o)->tt == LUA_TTABLE); black2gray(o); /* make object gray (again) */ gco2t(o)->gclist = g->grayagain; g->grayagain = o; } /* ** barrier for prototypes. When creating first closure (cache is ** NULL), use a forward barrier; this may be the only closure of the ** prototype (if it is a "regular" function, with a single instance) ** and the prototype may be big, so it is better to avoid traversing ** it again. Otherwise, use a backward barrier, to avoid marking all ** possible instances. */ LUAI_FUNC void luaC_barrierproto_ (lua_State *L, Proto *p, Closure *c) { global_State *g = G(L); lua_assert(isblack(obj2gco(p))); if (p->cache == NULL) { /* first time? */ luaC_objbarrier(L, p, c); } else { /* use a backward barrier */ black2gray(obj2gco(p)); /* make prototype gray (again) */ p->gclist = g->grayagain; g->grayagain = obj2gco(p); } } /* ** check color (and invariants) for an upvalue that was closed, ** i.e., moved into the 'allgc' list */ void luaC_checkupvalcolor (global_State *g, UpVal *uv) { GCObject *o = obj2gco(uv); lua_assert(!isblack(o)); /* open upvalues are never black */ if (isgray(o)) { if (keepinvariant(g)) { resetoldbit(o); /* see MOVE OLD rule */ gray2black(o); /* it is being visited now */ markvalue(g, uv->v); } else { lua_assert(issweepphase(g)); makewhite(g, o); } } } /* ** create a new collectable object (with given type and size) and link ** it to '*list'. 'offset' tells how many bytes to allocate before the ** object itself (used only by states). */ GCObject *luaC_newobj (lua_State *L, int tt, size_t sz, GCObject **list, int offset) { global_State *g = G(L); GCObject *o = obj2gco(cast(char *, luaM_newobject(L, tt, sz)) + offset); if (list == NULL) list = &g->allgc; /* standard list for collectable objects */ gch(o)->marked = luaC_white(g); gch(o)->tt = tt; gch(o)->next = *list; *list = o; return o; } /* }====================================================== */ /* ** {====================================================== ** Mark functions ** ======================================================= */ /* ** mark an object. Userdata and closed upvalues are visited and turned ** black here. Strings remain gray (it is the same as making them ** black). Other objects are marked gray and added to appropriate list ** to be visited (and turned black) later. (Open upvalues are already ** linked in 'headuv' list.) */ static void reallymarkobject (global_State *g, GCObject *o) { lua_assert(iswhite(o) && !isdead(g, o)); white2gray(o); switch (gch(o)->tt) { case LUA_TSTRING: { return; /* for strings, gray is as good as black */ } case LUA_TUSERDATA: { Table *mt = gco2u(o)->metatable; markobject(g, mt); markobject(g, gco2u(o)->env); gray2black(o); /* all pointers marked */ return; } case LUA_TUPVAL: { UpVal *uv = gco2uv(o); markvalue(g, uv->v); if (uv->v == &uv->u.value) /* closed? (open upvalues remain gray) */ gray2black(o); /* make it black */ return; } case LUA_TFUNCTION: { gco2cl(o)->c.gclist = g->gray; g->gray = o; break; } case LUA_TTABLE: { linktable(gco2t(o), &g->gray); break; } case LUA_TTHREAD: { gco2th(o)->gclist = g->gray; g->gray = o; break; } case LUA_TPROTO: { gco2p(o)->gclist = g->gray; g->gray = o; break; } default: lua_assert(0); } } /* ** mark metamethods for basic types */ static void markmt (global_State *g) { int i; for (i=0; i < LUA_NUMTAGS; i++) markobject(g, g->mt[i]); } /* ** mark all objects in list of being-finalized */ static void markbeingfnz (global_State *g) { GCObject *o; for (o = g->tobefnz; o != NULL; o = gch(o)->next) { makewhite(g, o); reallymarkobject(g, o); } } /* ** mark all values stored in marked open upvalues. (See comment in ** 'lstate.h'.) */ static void remarkupvals (global_State *g) { UpVal *uv; for (uv = g->uvhead.u.l.next; uv != &g->uvhead; uv = uv->u.l.next) { if (isgray(obj2gco(uv))) markvalue(g, uv->v); } } /* ** mark root set and reset all gray lists, to start a new ** incremental (or full) collection */ static void markroot (global_State *g) { g->gray = g->grayagain = NULL; g->weak = g->allweak = g->ephemeron = NULL; markobject(g, g->mainthread); markvalue(g, &g->l_registry); markmt(g); markbeingfnz(g); /* mark any finalizing object left from previous cycle */ } /* }====================================================== */ /* ** {====================================================== ** Traverse functions ** ======================================================= */ static void traverseweakvalue (global_State *g, Table *h) { Node *n, *limit = gnodelast(h); /* if there is array part, assume it may have white values (do not traverse it just to check) */ int hasclears = (h->sizearray > 0); for (n = gnode(h, 0); n < limit; n++) { checkdeadkey(n); if (ttisnil(gval(n))) /* entry is empty? */ removeentry(n); /* remove it */ else { lua_assert(!ttisnil(gkey(n))); markvalue(g, gkey(n)); /* mark key */ if (!hasclears && iscleared(gval(n))) /* is there a white value? */ hasclears = 1; /* table will have to be cleared */ } } if (hasclears) linktable(h, &g->weak); /* has to be cleared later */ else /* no white values */ linktable(h, &g->grayagain); /* no need to clean */ } static int traverseephemeron (global_State *g, Table *h) { int marked = 0; /* true if an object is marked in this traversal */ int hasclears = 0; /* true if table has white keys */ int prop = 0; /* true if table has entry "white-key -> white-value" */ Node *n, *limit = gnodelast(h); int i; /* traverse array part (numeric keys are 'strong') */ for (i = 0; i < h->sizearray; i++) { if (valiswhite(&h->array[i])) { marked = 1; reallymarkobject(g, gcvalue(&h->array[i])); } } /* traverse hash part */ for (n = gnode(h, 0); n < limit; n++) { checkdeadkey(n); if (ttisnil(gval(n))) /* entry is empty? */ removeentry(n); /* remove it */ else if (iscleared(gkey(n))) { /* key is not marked (yet)? */ hasclears = 1; /* table must be cleared */ if (valiswhite(gval(n))) /* value not marked yet? */ prop = 1; /* must propagate again */ } else if (valiswhite(gval(n))) { /* value not marked yet? */ marked = 1; reallymarkobject(g, gcvalue(gval(n))); /* mark it now */ } } if (prop) linktable(h, &g->ephemeron); /* have to propagate again */ else if (hasclears) /* does table have white keys? */ linktable(h, &g->allweak); /* may have to clean white keys */ else /* no white keys */ linktable(h, &g->grayagain); /* no need to clean */ return marked; } static void traversestrongtable (global_State *g, Table *h) { Node *n, *limit = gnodelast(h); int i; for (i = 0; i < h->sizearray; i++) /* traverse array part */ markvalue(g, &h->array[i]); for (n = gnode(h, 0); n < limit; n++) { /* traverse hash part */ checkdeadkey(n); if (ttisnil(gval(n))) /* entry is empty? */ removeentry(n); /* remove it */ else { lua_assert(!ttisnil(gkey(n))); markvalue(g, gkey(n)); /* mark key */ markvalue(g, gval(n)); /* mark value */ } } } static int traversetable (global_State *g, Table *h) { const TValue *mode = gfasttm(g, h->metatable, TM_MODE); markobject(g, h->metatable); if (mode && ttisstring(mode)) { /* is there a weak mode? */ int weakkey = (strchr(svalue(mode), 'k') != NULL); int weakvalue = (strchr(svalue(mode), 'v') != NULL); if (weakkey || weakvalue) { /* is really weak? */ black2gray(obj2gco(h)); /* keep table gray */ if (!weakkey) { /* strong keys? */ traverseweakvalue(g, h); return TRAVCOST + sizenode(h); } else if (!weakvalue) { /* strong values? */ traverseephemeron(g, h); return TRAVCOST + h->sizearray + sizenode(h); } else { linktable(h, &g->allweak); /* nothing to traverse now */ return TRAVCOST; } } /* else go through */ } traversestrongtable(g, h); return TRAVCOST + h->sizearray + (2 * sizenode(h)); } static int traverseproto (global_State *g, Proto *f) { int i; if (f->cache && iswhite(obj2gco(f->cache))) f->cache = NULL; /* allow cache to be collected */ stringmark(f->source); for (i = 0; i < f->sizek; i++) /* mark literals */ markvalue(g, &f->k[i]); for (i = 0; i < f->sizeupvalues; i++) /* mark upvalue names */ stringmark(f->upvalues[i].name); for (i = 0; i < f->sizep; i++) /* mark nested protos */ markobject(g, f->p[i]); for (i = 0; i < f->sizelocvars; i++) /* mark local-variable names */ stringmark(f->locvars[i].varname); return TRAVCOST + f->sizek + f->sizeupvalues + f->sizep + f->sizelocvars; } static int traverseclosure (global_State *g, Closure *cl) { if (cl->c.isC) { int i; for (i=0; ic.nupvalues; i++) /* mark its upvalues */ markvalue(g, &cl->c.upvalue[i]); } else { int i; lua_assert(cl->l.nupvalues == cl->l.p->sizeupvalues); markobject(g, cl->l.p); /* mark its prototype */ for (i=0; il.nupvalues; i++) /* mark its upvalues */ markobject(g, cl->l.upvals[i]); } return TRAVCOST + cl->c.nupvalues; } static int traversestack (global_State *g, lua_State *L) { StkId o = L->stack; if (o == NULL) return 1; /* stack not completely built yet */ for (; o < L->top; o++) markvalue(g, o); if (g->gcstate == GCSatomic) { /* final traversal? */ StkId lim = L->stack + L->stacksize; /* real end of stack */ for (; o < lim; o++) /* clear not-marked stack slice */ setnilvalue(o); } return TRAVCOST + cast_int(o - L->stack); } /* ** traverse one gray object, turning it to black (except for threads, ** which are always gray). ** Returns number of values traversed. */ static int propagatemark (global_State *g) { GCObject *o = g->gray; lua_assert(isgray(o)); gray2black(o); switch (gch(o)->tt) { case LUA_TTABLE: { Table *h = gco2t(o); g->gray = h->gclist; return traversetable(g, h); } case LUA_TFUNCTION: { Closure *cl = gco2cl(o); g->gray = cl->c.gclist; return traverseclosure(g, cl); } case LUA_TTHREAD: { lua_State *th = gco2th(o); g->gray = th->gclist; th->gclist = g->grayagain; g->grayagain = o; black2gray(o); return traversestack(g, th); } case LUA_TPROTO: { Proto *p = gco2p(o); g->gray = p->gclist; return traverseproto(g, p); } default: lua_assert(0); return 0; } } static void propagateall (global_State *g) { while (g->gray) propagatemark(g); } static void propagatelist (global_State *g, GCObject *l) { lua_assert(g->gray == NULL); /* no grays left */ g->gray = l; propagateall(g); /* traverse all elements from 'l' */ } /* ** retraverse all gray lists. Because tables may be reinserted in other ** lists when traversed, traverse the original lists to avoid traversing ** twice the same table (which is not wrong, but inefficient) */ static void retraversegrays (global_State *g) { GCObject *weak = g->weak; /* save original lists */ GCObject *grayagain = g->grayagain; GCObject *ephemeron = g->ephemeron; g->weak = g->grayagain = g->ephemeron = NULL; propagateall(g); /* traverse main gray list */ propagatelist(g, grayagain); propagatelist(g, weak); propagatelist(g, ephemeron); } static void convergeephemerons (global_State *g) { int changed; do { GCObject *w; GCObject *next = g->ephemeron; /* get ephemeron list */ g->ephemeron = NULL; /* tables will return to this list when traversed */ changed = 0; while ((w = next) != NULL) { next = gco2t(w)->gclist; if (traverseephemeron(g, gco2t(w))) { /* traverse marked some value? */ propagateall(g); /* propagate changes */ changed = 1; /* will have to revisit all ephemeron tables */ } } } while (changed); } /* }====================================================== */ /* ** {====================================================== ** Sweep Functions ** ======================================================= */ /* ** clear entries with unmarked keys from all weaktables in list 'l' up ** to element 'f' */ static void clearkeys (GCObject *l, GCObject *f) { for (; l != f; l = gco2t(l)->gclist) { Table *h = gco2t(l); Node *n, *limit = gnodelast(h); for (n = gnode(h, 0); n < limit; n++) { if (!ttisnil(gval(n)) && (iscleared(gkey(n)))) { setnilvalue(gval(n)); /* remove value ... */ removeentry(n); /* and remove entry from table */ } } } } /* ** clear entries with unmarked values from all weaktables in list 'l' up ** to element 'f' */ static void clearvalues (GCObject *l, GCObject *f) { for (; l != f; l = gco2t(l)->gclist) { Table *h = gco2t(l); Node *n, *limit = gnodelast(h); int i; for (i = 0; i < h->sizearray; i++) { TValue *o = &h->array[i]; if (iscleared(o)) /* value was collected? */ setnilvalue(o); /* remove value */ } for (n = gnode(h, 0); n < limit; n++) { if (!ttisnil(gval(n)) && iscleared(gval(n))) { setnilvalue(gval(n)); /* remove value ... */ removeentry(n); /* and remove entry from table */ } } } } static void freeobj (lua_State *L, GCObject *o) { switch (gch(o)->tt) { case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break; case LUA_TFUNCTION: luaF_freeclosure(L, gco2cl(o)); break; case LUA_TUPVAL: luaF_freeupval(L, gco2uv(o)); break; case LUA_TTABLE: luaH_free(L, gco2t(o)); break; case LUA_TTHREAD: luaE_freethread(L, gco2th(o)); break; case LUA_TUSERDATA: luaM_freemem(L, o, sizeudata(gco2u(o))); break; case LUA_TSTRING: { G(L)->strt.nuse--; luaM_freemem(L, o, sizestring(gco2ts(o))); break; } default: lua_assert(0); } } #define sweepwholelist(L,p) sweeplist(L,p,MAX_LUMEM) static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count); /* ** sweep the (open) upvalues of a thread and resize its stack and ** list of call-info structures. */ static void sweepthread (lua_State *L, lua_State *L1) { if (L1->stack == NULL) return; /* stack not completely built yet */ sweepwholelist(L, &L1->openupval); /* sweep open upvalues */ luaE_freeCI(L1); /* free extra CallInfo slots */ /* should not change the stack during an emergency gc cycle */ if (G(L)->gckind != KGC_EMERGENCY) luaD_shrinkstack(L1); } /* ** sweep at most 'count' elements from a list of GCObjects erasing dead ** objects, where a dead (not alive) object is one marked with the "old" ** (non current) white and not fixed. ** In non-generational mode, change all non-dead objects back to white, ** preparing for next collection cycle. ** In generational mode, keep black objects black, and also mark them as ** old; stop when hitting an old object, as all objects after that ** one will be old too. ** When object is a thread, sweep its list of open upvalues too. */ static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) { global_State *g = G(L); int ow = otherwhite(g); int toclear, toset; /* bits to clear and to set in all live objects */ int tostop; /* stop sweep when this is true */ l_mem debt = g->GCdebt; /* current debt */ if (isgenerational(g)) { /* generational mode? */ toclear = ~0; /* clear nothing */ toset = bitmask(OLDBIT); /* set the old bit of all surviving objects */ tostop = bitmask(OLDBIT); /* do not sweep old generation */ } else { /* normal mode */ toclear = maskcolors; /* clear all color bits + old bit */ toset = luaC_white(g); /* make object white */ tostop = 0; /* do not stop */ } while (*p != NULL && count-- > 0) { GCObject *curr = *p; int marked = gch(curr)->marked; if (isdeadm(ow, marked)) { /* is 'curr' dead? */ *p = gch(curr)->next; /* remove 'curr' from list */ freeobj(L, curr); /* erase 'curr' */ } else { if (gch(curr)->tt == LUA_TTHREAD) sweepthread(L, gco2th(curr)); /* sweep thread's upvalues */ if (testbits(marked, tostop)) { static GCObject *nullp = NULL; p = &nullp; /* stop sweeping this list */ break; } /* update marks */ gch(curr)->marked = cast_byte((marked & toclear) | toset); p = &gch(curr)->next; /* go to next element */ } } luaE_setdebt(g, debt); /* sweeping should not change debt */ return p; } /* }====================================================== */ /* ** {====================================================== ** Finalization ** ======================================================= */ static void checkSizes (lua_State *L) { global_State *g = G(L); if (g->gckind != KGC_EMERGENCY) { /* do not change sizes in emergency */ int hs = g->strt.size / 2; /* half the size of the string table */ if (g->strt.nuse < cast(lu_int32, hs)) /* using less than that half? */ luaS_resize(L, hs); /* halve its size */ luaZ_freebuffer(L, &g->buff); /* free concatenation buffer */ } } static GCObject *udata2finalize (global_State *g) { GCObject *o = g->tobefnz; /* get first element */ lua_assert(isfinalized(o)); g->tobefnz = gch(o)->next; /* remove it from 'tobefnz' list */ gch(o)->next = g->allgc; /* return it to 'allgc' list */ g->allgc = o; resetbit(gch(o)->marked, SEPARATED); /* mark that it is not in 'tobefnz' */ lua_assert(!isold(o)); /* see MOVE OLD rule */ if (!keepinvariant(g)) /* not keeping invariant? */ makewhite(g, o); /* "sweep" object */ return o; } static void dothecall (lua_State *L, void *ud) { UNUSED(ud); luaD_call(L, L->top - 2, 0, 0); } static void GCTM (lua_State *L, int propagateerrors) { global_State *g = G(L); const TValue *tm; TValue v; setgcovalue(L, &v, udata2finalize(g)); tm = luaT_gettmbyobj(L, &v, TM_GC); if (tm != NULL && ttisfunction(tm)) { /* is there a finalizer? */ int status; lu_byte oldah = L->allowhook; int running = g->gcrunning; L->allowhook = 0; /* stop debug hooks during GC metamethod */ g->gcrunning = 0; /* avoid GC steps */ setobj2s(L, L->top, tm); /* push finalizer... */ setobj2s(L, L->top + 1, &v); /* ... and its argument */ L->top += 2; /* and (next line) call the finalizer */ status = luaD_pcall(L, dothecall, NULL, savestack(L, L->top - 2), 0); L->allowhook = oldah; /* restore hooks */ g->gcrunning = running; /* restore state */ if (status != LUA_OK && propagateerrors) { /* error while running __gc? */ if (status == LUA_ERRRUN) { /* is there an error msg.? */ luaO_pushfstring(L, "error in __gc metamethod (%s)", lua_tostring(L, -1)); status = LUA_ERRGCMM; /* error in __gc metamethod */ } luaD_throw(L, status); /* re-send error */ } } } /* ** move all unreachable objects (or 'all' objects) that need ** finalization from list 'finobj' to list 'tobefnz' (to be finalized) */ static void separatetobefnz (lua_State *L, int all) { global_State *g = G(L); GCObject **p = &g->finobj; GCObject *curr; GCObject **lastnext = &g->tobefnz; /* find last 'next' field in 'tobefnz' list (to add elements in its end) */ while (*lastnext != NULL) lastnext = &gch(*lastnext)->next; while ((curr = *p) != NULL) { /* traverse all finalizable objects */ lua_assert(!isfinalized(curr)); lua_assert(testbit(gch(curr)->marked, SEPARATED)); if (!(all || iswhite(curr))) /* not being collected? */ p = &gch(curr)->next; /* don't bother with it */ else { l_setbit(gch(curr)->marked, FINALIZEDBIT); /* won't be finalized again */ *p = gch(curr)->next; /* remove 'curr' from 'finobj' list */ gch(curr)->next = *lastnext; /* link at the end of 'tobefnz' list */ *lastnext = curr; lastnext = &gch(curr)->next; } } } /* ** if object 'o' has a finalizer, remove it from 'allgc' list (must ** search the list to find it) and link it in 'finobj' list. */ void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) { global_State *g = G(L); if (testbit(gch(o)->marked, SEPARATED) || /* obj. is already separated... */ isfinalized(o) || /* ... or is finalized... */ gfasttm(g, mt, TM_GC) == NULL) /* or has no finalizer? */ return; /* nothing to be done */ else { /* move 'o' to 'finobj' list */ GCObject **p; for (p = &g->allgc; *p != o; p = &gch(*p)->next) ; *p = gch(o)->next; /* remove 'o' from root list */ gch(o)->next = g->finobj; /* link it in list 'finobj' */ g->finobj = o; l_setbit(gch(o)->marked, SEPARATED); /* mark it as such */ resetoldbit(o); /* see MOVE OLD rule */ } } /* }====================================================== */ /* ** {====================================================== ** GC control ** ======================================================= */ #define sweepphases \ (bitmask(GCSsweepstring) | bitmask(GCSsweepudata) | bitmask(GCSsweep)) /* ** change GC mode */ void luaC_changemode (lua_State *L, int mode) { global_State *g = G(L); if (mode == g->gckind) return; /* nothing to change */ if (mode == KGC_GEN) { /* change to generational mode */ /* make sure gray lists are consistent */ luaC_runtilstate(L, bitmask(GCSpropagate)); g->lastmajormem = gettotalbytes(g); g->gckind = KGC_GEN; } else { /* change to incremental mode */ /* sweep all objects to turn them back to white (as white has not changed, nothing extra will be collected) */ g->sweepstrgc = 0; g->gcstate = GCSsweepstring; g->gckind = KGC_NORMAL; luaC_runtilstate(L, ~sweepphases); } } /* ** call all pending finalizers */ static void callallpendingfinalizers (lua_State *L, int propagateerrors) { global_State *g = G(L); while (g->tobefnz) { resetoldbit(g->tobefnz); GCTM(L, propagateerrors); } } void luaC_freeallobjects (lua_State *L) { global_State *g = G(L); int i; separatetobefnz(L, 1); /* separate all objects with finalizers */ lua_assert(g->finobj == NULL); callallpendingfinalizers(L, 0); g->currentwhite = WHITEBITS; /* this "white" makes all objects look dead */ g->gckind = KGC_NORMAL; sweepwholelist(L, &g->finobj); /* finalizers can create objs. in 'finobj' */ sweepwholelist(L, &g->allgc); for (i = 0; i < g->strt.size; i++) /* free all string lists */ sweepwholelist(L, &g->strt.hash[i]); lua_assert(g->strt.nuse == 0); } static void atomic (lua_State *L) { global_State *g = G(L); GCObject *origweak, *origall; lua_assert(!iswhite(obj2gco(g->mainthread))); markobject(g, L); /* mark running thread */ /* registry and global metatables may be changed by API */ markvalue(g, &g->l_registry); markmt(g); /* mark basic metatables */ /* remark occasional upvalues of (maybe) dead threads */ remarkupvals(g); /* traverse objects caught by write barrier and by 'remarkupvals' */ retraversegrays(g); convergeephemerons(g); /* at this point, all strongly accessible objects are marked. */ /* clear values from weak tables, before checking finalizers */ clearvalues(g->weak, NULL); clearvalues(g->allweak, NULL); origweak = g->weak; origall = g->allweak; separatetobefnz(L, 0); /* separate objects to be finalized */ markbeingfnz(g); /* mark userdata that will be finalized */ propagateall(g); /* remark, to propagate `preserveness' */ convergeephemerons(g); /* at this point, all resurrected objects are marked. */ /* remove dead objects from weak tables */ clearkeys(g->ephemeron, NULL); /* clear keys from all ephemeron tables */ clearkeys(g->allweak, NULL); /* clear keys from all allweak tables */ /* clear values from resurrected weak tables */ clearvalues(g->weak, origweak); clearvalues(g->allweak, origall); g->sweepstrgc = 0; /* prepare to sweep strings */ g->gcstate = GCSsweepstring; g->currentwhite = cast_byte(otherwhite(g)); /* flip current white */ /*lua_checkmemory(L);*/ } static l_mem singlestep (lua_State *L) { global_State *g = G(L); switch (g->gcstate) { case GCSpause: { if (!isgenerational(g)) markroot(g); /* start a new collection */ /* in any case, root must be marked */ lua_assert(!iswhite(obj2gco(g->mainthread)) && !iswhite(gcvalue(&g->l_registry))); g->gcstate = GCSpropagate; return GCROOTCOST; } case GCSpropagate: { if (g->gray) return propagatemark(g); else { /* no more `gray' objects */ g->gcstate = GCSatomic; /* finish mark phase */ atomic(L); return GCATOMICCOST; } } case GCSsweepstring: { if (g->sweepstrgc < g->strt.size) { sweepwholelist(L, &g->strt.hash[g->sweepstrgc++]); return GCSWEEPCOST; } else { /* no more strings to sweep */ g->sweepgc = &g->finobj; /* prepare to sweep finalizable objects */ g->gcstate = GCSsweepudata; return 0; } } case GCSsweepudata: { if (*g->sweepgc) { g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX); return GCSWEEPMAX*GCSWEEPCOST; } else { g->sweepgc = &g->allgc; /* go to next phase */ g->gcstate = GCSsweep; return GCSWEEPCOST; } } case GCSsweep: { if (*g->sweepgc) { g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX); return GCSWEEPMAX*GCSWEEPCOST; } else { /* sweep main thread */ GCObject *mt = obj2gco(g->mainthread); sweeplist(L, &mt, 1); checkSizes(L); g->gcstate = GCSpause; /* finish collection */ return GCSWEEPCOST; } } default: lua_assert(0); return 0; } } /* ** advances the garbage collector until it reaches a state allowed ** by 'statemask' */ void luaC_runtilstate (lua_State *L, int statesmask) { global_State *g = G(L); while (!testbit(statesmask, g->gcstate)) singlestep(L); } static void generationalcollection (lua_State *L) { global_State *g = G(L); if (g->lastmajormem == 0) { /* signal for another major collection? */ luaC_fullgc(L, 0); /* perform a full regular collection */ g->lastmajormem = gettotalbytes(g); /* update control */ } else { luaC_runtilstate(L, ~bitmask(GCSpause)); /* run complete cycle */ luaC_runtilstate(L, bitmask(GCSpause)); if (gettotalbytes(g) > g->lastmajormem/100 * g->gcmajorinc) g->lastmajormem = 0; /* signal for a major collection */ } luaE_setdebt(g, stddebt(g)); } static void step (lua_State *L) { global_State *g = G(L); l_mem lim = g->gcstepmul; /* how much to work */ do { /* always perform at least one single step */ lim -= singlestep(L); } while (lim > 0 && g->gcstate != GCSpause); if (g->gcstate != GCSpause) luaE_setdebt(g, g->GCdebt - GCSTEPSIZE); else luaE_setdebt(g, stddebt(g)); } /* ** performs a basic GC step even if the collector is stopped */ void luaC_forcestep (lua_State *L) { global_State *g = G(L); int i; if (isgenerational(g)) generationalcollection(L); else step(L); for (i = 0; i < GCFINALIZENUM && g->tobefnz; i++) GCTM(L, 1); /* Call a few pending finalizers */ } /* ** performs a basic GC step only if collector is running */ void luaC_step (lua_State *L) { if (G(L)->gcrunning) luaC_forcestep(L); } /* ** performs a full GC cycle; if "isemergency", does not call ** finalizers (which could change stack positions) */ void luaC_fullgc (lua_State *L, int isemergency) { global_State *g = G(L); int origkind = g->gckind; lua_assert(origkind != KGC_EMERGENCY); if (!isemergency) /* do not run finalizers during emergency GC */ callallpendingfinalizers(L, 1); if (keepinvariant(g)) { /* marking phase? */ /* must sweep all objects to turn them back to white (as white has not changed, nothing will be collected) */ g->sweepstrgc = 0; g->gcstate = GCSsweepstring; } g->gckind = isemergency ? KGC_EMERGENCY : KGC_NORMAL; /* finish any pending sweep phase to start a new cycle */ luaC_runtilstate(L, bitmask(GCSpause)); /* run entire collector */ luaC_runtilstate(L, ~bitmask(GCSpause)); luaC_runtilstate(L, bitmask(GCSpause)); if (origkind == KGC_GEN) { /* generational mode? */ /* generational mode must always start in propagate phase */ luaC_runtilstate(L, bitmask(GCSpropagate)); } g->gckind = origkind; luaE_setdebt(g, stddebt(g)); if (!isemergency) /* do not run finalizers during emergency GC */ callallpendingfinalizers(L, 1); } /* }====================================================== */ ImageVis3D-3.1.0/Tuvok/CMakeLists.txt0000644000175000017500000000607012320456500017130 0ustar mathieumathieu# This is a CMake file for building/including Tuvok into your own projects. # It is meant only as a guide; it sets up only basic options which are specific # to Tuvok. If you need additional settings, it's recommended that you create # an external file and use CMake's `include' directive to include this file # inline. # Still, there are some mechanisms setup to make that task easy. # . Use TUVOK_EXTERNAL_INCLUDES to setup a list of external include # directories. This is useful if you want to, say, replace Tuvok's # internal copy of GLEW/boost with your own. This directory gets included # *before* Tuvok's own directories. # . Set TUVOK_IGNORE to a CMake-list of files one doesn't want to use/compile # in their project. cmake_minimum_required(VERSION 2.6) if(COMMAND CMAKE_POLICY) cmake_policy(VERSION 2.6) endif(COMMAND CMAKE_POLICY) project(tuvok) find_package(Qt4 REQUIRED) include(${QT_USE_FILE}) include_directories(${QT_INCLUDE_DIR}) include_directories(. ${TUVOK_EXTERNAL_INCLUDES} Basics Controller DebugOut IO Renderer Scripting 3rdParty/GLEW IO/3rdParty/boost IO/exception IO/expressions ${QT_INCLUDE_DIR}) # Tuvok will not build as a shared lib. set(BUILD_SHARED_LIBS OFF) set(TUVOK_LIBRARY tuvok CACHE FILEPATH "Tuvok library name.") set(TUVOK_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/3rdParty;${CMAKE_CURRENT_SOURCE_DIR}/IO/3rdParty/boost;${QT_INCLUDE_DIR}" CACHE STRING "Tuvok include directory (Tuvok's source tree root)" FORCE) # fPIC is required for libraries. if(${CMAKE_COMPILER_IS_GNUCXX}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") endif(${CMAKE_COMPILER_IS_GNUCXX}) # Disable Qt as well. Needed for now... working on it, slowly. #set(TUVOK_DEFINES -DTUVOK_NO_IO -DTUVOK_NO_QT CACHE STRING set(TUVOK_DEFINES -DTUVOK_NO_IO CACHE STRING "Defines needed for building Tuvok in most projects.") # Disable IO and Qt within Tuvok. add_definitions(${TUVOK_DEFINES}) # Sets the variable TUVOK_SRCS. include(.tuvok_srcs) if(DEFINED TUVOK_IGNORE) list(REMOVE_ITEM TUVOK_SRCS TUVOK_IGNORE) endif(DEFINED TUVOK_IGNORE) add_library(${TUVOK_LIBRARY} ${TUVOK_SRCS}) # We try to read shaders from the bundle on Macs, so we need CoreFoundation. if(APPLE) target_link_libraries(${TUVOK_LIBRARY} "-framework CoreFoundation") endif(APPLE) target_link_libraries(${TUVOK_LIBRARY} ${QT_LIBRARIES}) target_link_libraries(${TUVOK_LIBRARY} ${GL_LIBRARY}) install(DIRECTORY Shaders DESTINATION ${CMAKE_INSTALL_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE) file(COPY Shaders DESTINATION ${CMAKE_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE) ImageVis3D-3.1.0/Tuvok/Renderer/0000755000175000017500000000000012320456500016133 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/Renderer/Context.cpp0000644000175000017500000000253012320456500020263 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "Context.h" using namespace tuvok; std::map> Context::contextMap; ImageVis3D-3.1.0/Tuvok/Renderer/FrameCapture.h0000644000175000017500000001261512320456500020667 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file FrameCapture.h \author Jens Krueger SCI Institute University of Utah \date November 2008 */ #pragma once #ifndef FRAMECAPTURE_H #define FRAMECAPTURE_H #include #include "../StdTuvokDefines.h" #include "../Basics/Vectors.h" #include "Controller/Controller.h" #include "Basics/SysTools.h" #include "IO/TTIFFWriter/TTIFFWriter.h" #ifndef TUVOK_NO_QT # include #endif namespace tuvok { class FrameCapture { public: FrameCapture() {} virtual ~FrameCapture() {} virtual bool CaptureSingleFrame(const std::string& strFilename, bool bPreserveTransparency) const = 0; private: #ifndef TUVOK_NO_QT static int DemultiplyAlpha(unsigned char cmp, unsigned char alpha) { return int(0.5f+float(cmp)/(float(alpha)/255.0f)); } #endif template static void RGBAToRGB(const std::vector& in, std::vector& out) { size_t j = 0; for (size_t i = 0;i bool SaveImage(const std::string& strFilename, const UINTVECTOR2& vSize, const std::vector& vInputData, bool bPreserveTransparency) const { // OpenGL Data is upside down so first flip it std::vector vData(vInputData.size()); size_t i = 0; for (int y = 0;y vDataRGB(vSize.area()*3); RGBAToRGB(vData, vDataRGB); TTIFFWriter::Write(strFilename.c_str(), vSize.x, vSize.y, TTIFFWriter::TT_RGB, vDataRGB); } } catch (const ttiff_error& e) { T_ERROR("Unable to save image %s: %s.",strFilename.c_str(), e.what()); return false; } return true; } else { #ifdef TUVOK_NO_QT T_ERROR("Refusing to save image %s: Tuvok was compiled without Qt support so export is restricted to TIFF files.", strFilename.c_str()); return false; #else if (sizeof(T) > 1) { T_ERROR("Unable to save high precision data to image %s please select TIFF fromat.",strFilename.c_str()); return false; } QImage qTargetFile(QSize(vSize.x, vSize.y), QImage::Format_ARGB32); size_t i = 0; if (bPreserveTransparency) { for (size_t y = 0;y #include #include #include namespace tuvok { /// A common way to identify a shader. /// We need to know whether a shader is equivalent. When we're asked to load a /// new shader, we search through a list of cached ones and see if it already /// exists. This allows us to avoid loading it multiple times, and more /// importantly compiling it multiple times. /// This is made a bit difficult by how we build shaders: they can come from /// files or strings. class ShaderDescriptor { public: ShaderDescriptor(); /// Constructs the descriptor from a list of FILES for each shader type. ShaderDescriptor(const std::vector& vertex, const std::vector& fragment); ShaderDescriptor(const ShaderDescriptor&); /// @param dir list of paths /// @return the list of paths which exist. static std::vector ValidPaths(std::vector dir); /// Takes a list of directories and *two* lists of shaders. Both lists /// must be terminated with a null. The first is a list of filenames for /// the vertex shaders, the second is a list of filenames for fragment /// shaders. static ShaderDescriptor Create( std::vector directories, ... ); static ShaderDescriptor Create( std::vector directories, std::vector> fragmentDataBindings, ... ); /// Adds a global string to the shader that is used for every compilation unit void AddDefine(const std::string& define); void AddDefines(const std::vector& defines); /// Adds a vertex shader in a string (i.e. not from a filename) void AddVertexShaderString(const std::string shader); /// Adds a fragment shader in a string (i.e. not from a filename) void AddFragmentShaderString(const std::string shader); /// Two shaders are equal if they utilize the same set of filenames/strings /// to compose the shader. bool operator ==(const ShaderDescriptor& sd) const; /// Shader iterator. When dereferenced, produces a pair of 'program text' /// (first) and the source of that program text (second). The latter is /// only intended for diagnostics, and may be empty. struct SIterator : public std::iterator { SIterator(const SIterator&); SIterator& operator++(); SIterator& operator++(int); bool operator==(const SIterator&) const; bool operator!=(const SIterator&) const; std::pair operator*() const; private: struct siterinfo; std::shared_ptr si; SIterator(struct siterinfo); friend class ShaderDescriptor; }; /// Iterate over the list of shaders. SIterator begin_vertex() const; SIterator end_vertex() const; SIterator begin_fragment() const; SIterator end_fragment() const; std::vector> fragmentDataBindings; private: struct sinfo; std::shared_ptr si; }; } #endif // TUVOK_SHADER_DESCRIPTOR_H /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/Renderer/CullingLOD.cpp0000644000175000017500000001427712320456500020606 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file CullingLOD.cpp \brief Simple conservative frustum Culling and LOD computation \author Jens Krueger SCI Institute University of Utah \version 1.1 \date November 2008 */ #include "CullingLOD.h" using namespace std; using namespace tuvok; CullingLOD::CullingLOD(float fScreenSpaceError) : m_fFOVY(1.0f), m_fAspect(1.0f), m_fNearPlane(0.1f), m_fFarPlane(100.0f), m_iPixelCountY(1), m_fScreenSpaceError(fScreenSpaceError), m_fLODFactor(1.0f), m_bPassAll(false) { } void CullingLOD::SetScreenParams(float fFOVY, float fAspect, float fNearPlane, float fFarPlane, uint32_t iPixelCountY) { m_fFOVY = fFOVY; m_fAspect = fAspect; m_fNearPlane = fNearPlane; m_fFarPlane = fFarPlane; m_iPixelCountY = iPixelCountY; m_fLODFactor = 2.0f * tan(fFOVY * ((3.1416f/180.0f) / 2.0f)) * m_fScreenSpaceError / float(m_iPixelCountY); } FLOATVECTOR2 CullingLOD::GetDepthScaleParams() const { return FLOATVECTOR2(m_fFarPlane / (m_fFarPlane - m_fNearPlane), (m_fFarPlane * m_fNearPlane / (m_fNearPlane - m_fFarPlane))); } void CullingLOD::SetProjectionMatrix(const FLOATMATRIX4& mProjectionMatrix) { m_mProjectionMatrix = mProjectionMatrix; m_mModelViewProjectionMatrix = m_mModelViewMatrix * m_mProjectionMatrix; } void CullingLOD::SetViewMatrix(const FLOATMATRIX4& mViewMatrix) { m_mViewMatrix = mViewMatrix; } void CullingLOD::SetModelMatrix(const FLOATMATRIX4& mModelMatrix) { m_mModelMatrix = mModelMatrix; } void CullingLOD::Update() { m_mModelViewMatrix = m_mModelMatrix * m_mViewMatrix; m_mModelViewProjectionMatrix = m_mModelViewMatrix * m_mProjectionMatrix; // right clip-plane m_Planes[0].x = -m_mModelViewProjectionMatrix.m11 + m_mModelViewProjectionMatrix.m14; m_Planes[0].y = -m_mModelViewProjectionMatrix.m21 + m_mModelViewProjectionMatrix.m24; m_Planes[0].z = -m_mModelViewProjectionMatrix.m31 + m_mModelViewProjectionMatrix.m34; m_Planes[0].w = -m_mModelViewProjectionMatrix.m41 + m_mModelViewProjectionMatrix.m44; // left clip-plane m_Planes[1].x = m_mModelViewProjectionMatrix.m11 + m_mModelViewProjectionMatrix.m14; m_Planes[1].y = m_mModelViewProjectionMatrix.m21 + m_mModelViewProjectionMatrix.m24; m_Planes[1].z = m_mModelViewProjectionMatrix.m31 + m_mModelViewProjectionMatrix.m34; m_Planes[1].w = m_mModelViewProjectionMatrix.m41 + m_mModelViewProjectionMatrix.m44; // top clip-plane m_Planes[2].x = -m_mModelViewProjectionMatrix.m12 + m_mModelViewProjectionMatrix.m14; m_Planes[2].y = -m_mModelViewProjectionMatrix.m22 + m_mModelViewProjectionMatrix.m24; m_Planes[2].z = -m_mModelViewProjectionMatrix.m32 + m_mModelViewProjectionMatrix.m34; m_Planes[2].w = -m_mModelViewProjectionMatrix.m42 + m_mModelViewProjectionMatrix.m44; // bottom clip-plane m_Planes[3].x = m_mModelViewProjectionMatrix.m12 + m_mModelViewProjectionMatrix.m14; m_Planes[3].y = m_mModelViewProjectionMatrix.m22 + m_mModelViewProjectionMatrix.m24; m_Planes[3].z = m_mModelViewProjectionMatrix.m32 + m_mModelViewProjectionMatrix.m34; m_Planes[3].w = m_mModelViewProjectionMatrix.m42 + m_mModelViewProjectionMatrix.m44; // far clip-plane m_Planes[4].x = m_mModelViewProjectionMatrix.m13 + m_mModelViewProjectionMatrix.m14; m_Planes[4].y = m_mModelViewProjectionMatrix.m23 + m_mModelViewProjectionMatrix.m24; m_Planes[4].z = m_mModelViewProjectionMatrix.m33 + m_mModelViewProjectionMatrix.m34; m_Planes[4].w = m_mModelViewProjectionMatrix.m43 + m_mModelViewProjectionMatrix.m44; // near clip-plane m_Planes[5].x = -m_mModelViewProjectionMatrix.m13 + m_mModelViewProjectionMatrix.m14; m_Planes[5].y = -m_mModelViewProjectionMatrix.m23 + m_mModelViewProjectionMatrix.m24; m_Planes[5].z = -m_mModelViewProjectionMatrix.m33 + m_mModelViewProjectionMatrix.m34; m_Planes[5].w = -m_mModelViewProjectionMatrix.m43 + m_mModelViewProjectionMatrix.m44; } int CullingLOD::GetLODLevel(const FLOATVECTOR3& vfCenter, const FLOATVECTOR3& vfExtent, const UINTVECTOR3& viVoxelCount) const { float fLevelZeroWorldSpaceError = (vfExtent/FLOATVECTOR3(viVoxelCount)).maxVal(); float zCenter = (FLOATVECTOR4(vfCenter,1) * m_mModelViewMatrix).z; float zMinBrick = -zCenter; float fZ = max(m_fNearPlane, zMinBrick); return static_cast(floor(log(m_fLODFactor * fZ / fLevelZeroWorldSpaceError) / log(2.0f))); } bool CullingLOD::IsVisible(const FLOATVECTOR3& vCenter, const FLOATVECTOR3& vfExtent) const { if (m_bPassAll) return true; FLOATVECTOR3 vHalfExtent = 0.5f * vfExtent; for (uint32_t uiPlane = 0; uiPlane < 6; uiPlane++) { FLOATVECTOR4 plane = m_Planes[uiPlane]; if ( plane.x * vCenter.x + plane.y * vCenter.y + plane.z * vCenter.z + plane.w <= -(vHalfExtent.x * fabs(plane.x) + vHalfExtent.y * fabs(plane.y) + vHalfExtent.z * fabs(plane.z)) ) { return false; } } return true; } ImageVis3D-3.1.0/Tuvok/Renderer/AbstrRenderer.h0000644000175000017500000007756412320456500021071 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file AbstrRenderer.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date August 2008 */ #pragma once #ifndef ABSTRRENDERER_H #define ABSTRRENDERER_H #include "StdTuvokDefines.h" #include #include #include "../StdTuvokDefines.h" #include "../Renderer/CullingLOD.h" #include "../Renderer/RenderRegion.h" #include "../IO/Dataset.h" #include "../Basics/Plane.h" #include "../Basics/GeometryGenerator.h" #include "Context.h" #include "Basics/Interpolant.h" #include "LuaScripting/LuaScripting.h" #include "LuaScripting/LuaClassRegistration.h" class TransferFunction1D; class TransferFunction2D; namespace tuvok { class MasterController; class RenderMesh; class LuaDatasetProxy; class LuaTransferFun1DProxy; class LuaTransferFun2DProxy; class Brick { public: Brick() : vCenter(0,0,0), vExtension(0,0,0), vVoxelCount(0, 0, 0), vCoords(0,0,0), kBrick(), fDistance(0), bIsEmpty(false) { } Brick(uint32_t x, uint32_t y, uint32_t z, uint32_t iSizeX, uint32_t iSizeY, uint32_t iSizeZ, const BrickKey& k) : vCenter(0,0,0), vExtension(0,0,0), vVoxelCount(iSizeX, iSizeY, iSizeZ), vCoords(x,y,z), kBrick(k), fDistance(0), bIsEmpty(false) { } FLOATVECTOR3 vCenter; FLOATVECTOR3 vTexcoordsMin; FLOATVECTOR3 vTexcoordsMax; FLOATVECTOR3 vExtension; UINTVECTOR3 vVoxelCount; UINTVECTOR3 vCoords; BrickKey kBrick; float fDistance; bool bIsEmpty; }; inline bool operator < (const Brick& left, const Brick& right) { return (left.fDistance < right.fDistance); } /** \class AbstrRenderer * Base for all renderers. */ class AbstrRenderer { public: enum ERendererTarget { RT_INTERACTIVE = 0, RT_CAPTURE, RT_HEADLESS, RT_INVALID_MODE }; enum ERendererType { RT_SBVR = 0, RT_RC, RT_INVALID }; enum EStereoMode { SM_RB = 0, // red blue anaglyph SM_SCANLINE, // scan line interleave SM_SBS, // side by side SM_AF, // alternating frame SM_INVALID }; enum EStereoID { SI_LEFT_OR_MONO = 0, SI_RIGHT = 1, SI_INVALID }; enum ERenderMode { RM_1DTRANS = 0, /**< one dimensional transfer function */ RM_2DTRANS, /**< two dimensional transfer function */ RM_ISOSURFACE, /**< render isosurfaces */ RM_INVALID }; enum EBlendPrecision { BP_8BIT = 0, BP_16BIT, BP_32BIT, BP_INVALID }; enum ScalingMethod { SMETH_BIT_WIDTH=0, ///< scaled based on DS and TF bit width SMETH_BIAS_AND_SCALE ///< bias + scale factors of DS calculated }; /** Default settings: 1D transfer function, single-image view, white text, * black BG. * @param pMasterController message router * @param bUseOnlyPowerOfTwo force power of two textures, for systems that * do not support npot textures. * @param bDownSampleTo8Bits force 8bit textures, for systems that do not * support 16bit textures (or 16bit linear * interpolation). * @param bDisableBorder don't use OpenGL borders for textures. * @param smeth method to scale values into TF range */ AbstrRenderer(MasterController* pMasterController, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder, enum ScalingMethod smeth = SMETH_BIT_WIDTH); /** Deallocates dataset and transfer functions. */ virtual ~AbstrRenderer(); /// Sets the dataset from external source; only meant to be used by clients /// which don't want to use the LOD subsystem. void SetDataset(Dataset *vds); /* /// Modifies previously uploaded data. void UpdateData(const BrickKey&, std::shared_ptr fp, size_t len); */ void ClearBricks() { m_pDataset->Clear(); } virtual void Set1DTrans(const std::vector& rgba) = 0; /** Notify renderer that 1D TF has changed. In most cases, this will cause * the renderer to start anew. */ virtual void Changed1DTrans(); /** Notify renderer that 2D TF has changed. In most cases, this will cause * the renderer to start anew. */ virtual void Changed2DTrans(); FLOATVECTOR4 GetTextColor() const {return m_vTextColor;} virtual void SetViewPort(UINTVECTOR2 lower_left, UINTVECTOR2 upper_right, bool decrease_screen_res) = 0; virtual void SetRotationRR(RenderRegion * region, const FLOATMATRIX4& rotation); virtual const FLOATMATRIX4& GetRotation(const RenderRegion *renderRegion) const; virtual void SetTranslation(RenderRegion *renderRegion, const FLOATMATRIX4& translation); virtual const FLOATMATRIX4& GetTranslation( const RenderRegion *renderRegion) const; virtual void SetClipPlane(RenderRegion *renderRegion, const ExtendedPlane& plane); virtual bool IsClipPlaneEnabled(RenderRegion *renderRegion=NULL); virtual void EnableClipPlane(RenderRegion *renderRegion=NULL); virtual void DisableClipPlane(RenderRegion *renderRegion=NULL); /// slice parameter for slice views. virtual void SetSliceDepth(RenderRegion *renderRegion, uint64_t fSliceDepth); virtual uint64_t GetSliceDepth(const RenderRegion *renderRegion) const; void SetClearFramebuffer(bool bClearFramebuffer) { m_bClearFramebuffer = bClearFramebuffer; } bool GetClearFramebuffer() const {return m_bClearFramebuffer;} void Set2DFlipMode(RenderRegion *renderRegion, bool bFlipX, bool bFlipY); void Get2DFlipMode(const RenderRegion *renderRegion, bool& bFlipX, bool& bFlipY) const; bool GetUseMIP(const RenderRegion *renderRegion) const; void SetUseMIP(RenderRegion *renderRegion, bool bUseMIP); virtual void SetUserMatrices(const FLOATMATRIX4& view, const FLOATMATRIX4& projection, const FLOATMATRIX4& viewLeft, const FLOATMATRIX4& projectionLeft, const FLOATMATRIX4& viewRight, const FLOATMATRIX4& projectionRight); virtual void UnsetUserMatrices(); // ClearView virtual INTVECTOR2 GetCVMousePos() const {return m_vCVMousePos;} virtual FLOATVECTOR3 Pick(const UINTVECTOR2&) const = 0; virtual void ScheduleWindowRedraw(RenderRegion *renderRegion); void SetViewParameters(float angle, float znear, float zfar, const FLOATVECTOR3& eye, const FLOATVECTOR3& ref, const FLOATVECTOR3& vup) { m_vEye = eye; m_vAt = ref; m_vUp = vup; m_fFOV = angle; m_fZNear = znear; m_fZFar = zfar; this->ScheduleCompleteRedraw(); } void SetScalingMethod(enum ScalingMethod sm) { this->m_TFScalingMethod = sm; } virtual void NewFrameClear(const RenderRegion &) = 0; const FLOATMATRIX4& GetProjectionMatrix(size_t eyeIndex = 0) const {return m_mProjection[eyeIndex];} const FLOATMATRIX4& GetViewMatrix(size_t eyeIndex = 0) const {return m_mView[eyeIndex];} bool Execute(const std::string& strCommand, const std::vector& strParams, std::string& strMessage); std::shared_ptr GetContext() const {return m_pContext;} /// Registers base class Lua functions. static void RegisterLuaFunctions(LuaClassRegistration& reg, AbstrRenderer* me, LuaScripting* ss); /// This function is called at the end of RegisterLuaFunctions. /// Use it to register additional renderer specific functions. /// (functions that don't make sense as an inherited abstract method). virtual void RegisterDerivedClassLuaFunctions( LuaClassRegistration&, LuaScripting*) {} /// "PH" == "paper hacks". sorry. delete these after pacvis. ///@{ virtual void PH_ClearWorkingSet(); virtual UINTVECTOR4 PH_RecalculateVisibility(); virtual bool PH_Converged() const; virtual bool PH_OpenBrickAccessLogfile(const std::string&); virtual bool PH_CloseBrickAccessLogfile(); virtual bool PH_OpenLogfile(const std::string&); virtual bool PH_CloseLogfile(); virtual void PH_SetOptimalFrameAverageCount(size_t); virtual size_t PH_GetOptimalFrameAverageCount() const; virtual bool PH_IsDebugViewAvailable() const; virtual bool PH_IsWorkingSetTrackerAvailable() const; ///@} public: // The following functions are public ONLY because there are dependencies // upon them within Tuvok. Their dependencies are listed. // Dependency: RenderRegion.cpp virtual void ShowClipPlane(bool, RenderRegion *renderRegion=NULL); // Dependency: RenderRegion.cpp const ExtendedPlane& GetClipPlane() const; protected: // Functions in this section were made protected due to the transition to // Lua. All functions in this section are exposed through the Lua interface. virtual ERendererType GetRendererType() const {return RT_INVALID;} virtual void SetRendermode(ERenderMode eRenderMode); virtual void SetBlendPrecision(EBlendPrecision eBlendPrecision); /** Sets up a gradient background which fades vertically. * @param vColors[0] is the color at the bottom; * @param vColors[1] is the color at the top. */ virtual bool SetBackgroundColors(FLOATVECTOR3 vTopColor, FLOATVECTOR3 vBotColor) { if (vTopColor != m_vBackgroundColors[0] || vBotColor != m_vBackgroundColors[1]) { m_vBackgroundColors[0]=vTopColor; m_vBackgroundColors[1]=vBotColor; ScheduleCompleteRedraw(); return true; } return false; } virtual bool SetTextColor(FLOATVECTOR4 vColor) { if (vColor != m_vTextColor) { m_vTextColor=vColor;ScheduleCompleteRedraw(); return true; } return false; } virtual void SetLogoParams(std::string strLogoFilename, int iLogoPos); virtual void ClipPlaneRelativeLock(bool); // Clear view virtual bool SupportsClearView() {return false;} virtual std::string ClearViewDisableReason() const { return "this renderer does not support ClearView"; } virtual void SetCV(bool bEnable); virtual bool GetCV() const {return m_bDoClearView;} virtual void SetCVIsoValue(float fIsovalue); virtual float GetCVIsoValue() const { return m_fCVIsovalue; } virtual void SetCVColor(const FLOATVECTOR3& vColor); virtual FLOATVECTOR3 GetCVColor() const {return m_vCVColor;} virtual void SetCVSize(float fSize); virtual float GetCVSize() const {return m_fCVSize;} virtual void SetCVContextScale(float fScale); virtual float GetCVContextScale() const {return m_fCVContextScale;} virtual void SetCVBorderScale(float fScale); virtual float GetCVBorderScale() const {return m_fCVBorderScale;} virtual void SetCVFocusPosFVec(const FLOATVECTOR4& vCVPos); virtual void SetCVFocusPos(LuaClassInstance renderRegion, const INTVECTOR2& vPos); virtual FLOATVECTOR4 GetCVFocusPos() const {return m_vCVPos;} // Modification/access of internal Frustum Culling class void SetFrustumCullingModelMatrix(const FLOATMATRIX4& modelMatrix); int GetFrustumCullingLODLevel(const FLOATVECTOR3& vfCenter, const FLOATVECTOR3& vfExtent, const UINTVECTOR3& viVoxelCount) const; std::shared_ptr GetFirst3DRegion(); virtual void SetRenderCoordArrows(bool bRenderCoordArrows); virtual bool GetRenderCoordArrows() const {return m_bRenderCoordArrows;} virtual void Transfer3DRotationToMIP(); void SetMIPLOD(bool bMIPLOD) {m_bMIPLOD = bMIPLOD;} virtual void SetStereo(bool bStereoRendering); virtual void SetStereoEyeDist(float fStereoEyeDist); virtual void SetStereoFocalLength(float fStereoFocalLength); virtual void SetStereoMode(EStereoMode mode); virtual void SetStereoEyeSwap(bool bSwap); virtual bool GetStereo() const {return m_bRequestStereoRendering;} virtual float GetStereoEyeDist() const {return m_fStereoEyeDist;} virtual float GetStereoFocalLength() const {return m_fStereoFocalLength;} virtual EStereoMode GetStereoMode() const {return m_eStereoMode;} virtual bool GetStereoEyeSwap() const {return m_bStereoEyeSwap;} virtual void InitStereoFrame(); virtual void ToggleStereoFrame(); virtual bool CaptureSingleFrame(const std::string& strFilename, bool bPreserveTransparency) const; virtual void ScheduleCompleteRedraw(); /** Query whether or not we should redraw the next frame, else we should * reuse what is already rendered or continue with the current frame if it * is not complete yet. */ virtual bool CheckForRedraw(); /** Deallocates GPU memory allocated during the rendering process. */ virtual void Cleanup() = 0; virtual void SetOrthoView(bool bOrthoView); virtual bool GetOrthoView() const {return m_bOrthoView;} virtual void SetUseLighting(bool bUseLighting); virtual void SetSampleRateModifier(float fSampleRateModifier); virtual void SetIsoValue(float fIsovalue); /// the given isovalue is in the range [0,1] and is interpreted as a /// percentage of the available isovalues. virtual void SetIsoValueRelative(float fIsovalue); virtual void SetIsosurfaceColor(const FLOATVECTOR3& vColor); virtual FLOATVECTOR3 GetIsosurfaceColor() const { return m_vIsoColor; } UINTVECTOR2 GetSize() const {return m_vWinSize;} /** Change the size of the render window. Any previous image is * destroyed, causing a full redraw on the next render. * \param vWinSize new width and height of the view window */ virtual void Resize(const UINTVECTOR2& vWinSize); virtual bool Paint() { if (m_bDatasetIsInvalid) return true; if (renderRegions.empty()) { renderRegions.push_back(simpleRenderRegion3D); } if (renderRegions.size() == 1) { renderRegions[0]->maxCoord = m_vWinSize; //minCoord is always (0,0) } // check if we are rendering a stereo frame m_bDoStereoRendering = m_bRequestStereoRendering && renderRegions.size() == 1 && renderRegions[0]->is3D(); return true; // nothing can go wrong here } virtual void SetConsiderPreviousDepthbuffer(bool bConsiderPreviousDepthbuffer); virtual bool GetConsiderPreviousDepthbuffer() const { return m_bConsiderPreviousDepthbuffer; } /// creates a dataset and registers it with this renderer. virtual bool LoadFile(const std::string& filename); /// registers the dataset with this renderer. this renderer then 'owns' it /// and will handle deletion. virtual bool RegisterDataset(Dataset* ds); /// ditto as LoadDataset, but gives a rebricked DS virtual bool LoadRebricked(const std::string& strFilename, const UINTVECTOR3 bsize, size_t minmaxMode); virtual bool Initialize(std::shared_ptr ctx); virtual void SetInterpolant(Interpolant eInterpolant); virtual void ScanForNewMeshes() {} virtual void RemoveMeshData(size_t index); virtual void SetRescaleFactors(const DOUBLEVECTOR3& vfRescale) { m_pDataset->SetRescaleFactors(vfRescale); ScheduleCompleteRedraw(); } virtual void Schedule3DWindowRedraws(); // Redraw all 3D windows. virtual bool CropDataset(const std::string& strTempDir, bool bKeepOldData) = 0; ExtendedPlane LuaGetClipPlane() const; void GetVolumeAABB(FLOATVECTOR3& vCenter, FLOATVECTOR3& vExtend) const; float GetIsoValue() const { return m_fIsovalue; } virtual void CycleDebugViews(); virtual void SetDebugView(uint32_t iDebugView); virtual uint32_t GetDebugViewCount() const; uint32_t GetDebugView() const; private: // Functions in this section were made private due to the transition to Lua. // All functions in this section are exposed through the Lua interface. // If a derived class needs access to these functions, it is appropriate // to move the function to protected, but not public. ERendererTarget GetRendererTarget() const { return m_eRendererTarget; } void SetRendererTarget(ERendererTarget eRendererTarget) { m_eRendererTarget = eRendererTarget; } void SetViewPos(const FLOATVECTOR3& vPos); FLOATVECTOR3 GetViewPos() const; void ResetViewPos(); void SetViewDir(const FLOATVECTOR3& vDir); FLOATVECTOR3 GetViewDir() const; void ResetViewDir(); void SetUpDir(const FLOATVECTOR3& vDir); FLOATVECTOR3 GetUpDir() const; void ResetUpDir(); ERenderMode GetRendermode() {return m_eRenderMode;} Dataset& GetDataset() { return *m_pDataset; } const Dataset& GetDataset() const { return *m_pDataset; } TransferFunction1D* Get1DTrans() {return m_p1DTrans;} TransferFunction2D* Get2DTrans() {return m_p2DTrans;} FLOATVECTOR3 GetBackgroundColor(int i) const { return m_vBackgroundColors[i]; } EBlendPrecision GetBlendPrecision() {return m_eBlendPrecision;} void SetRenderRegions(const std::vector>&); void LuaSetRenderRegions(std::vector); const std::vector>& GetRenderRegions() const { return renderRegions; } std::vector LuaGetRenderRegions(); LuaClassInstance LuaGetFirst3DRegion(); bool ClipPlaneLocked() const { return m_bClipPlaneLocked; } bool ClipPlaneEnabled() const { return m_bClipPlaneOn; } bool ClipPlaneShown() const { return m_bClipPlaneDisplayed; } bool SupportsMeshes() const {return m_bSupportsMeshes;} void SetMIPRotationAngle(float fAngle) { m_fMIPRotationAngle = fAngle; ScheduleCompleteRedraw(); } virtual void Set2DPlanesIn3DView(bool bRenderPlanesIn3D, RenderRegion* renderRegion=NULL); virtual bool Get2DPlanesIn3DView(RenderRegion* = NULL) const { /// @todo: Make this bool a per 3d render region toggle. return m_bRenderPlanesIn3D;} void LuaSet2DPlanesIn3DView(bool bRenderPlanesIn3D,LuaClassInstance region); bool LuaGet2DPlanesIn3DView() const {return Get2DPlanesIn3DView();} void SetTimeSlice(uint32_t iMSecs) {m_iTimeSliceMSecs = iMSecs;} void SetPerfMeasures(uint32_t iMinFramerate, bool bRenderLowResIntermediateResults, float fScreenResDecFactor, float fSampleDecFactor, uint32_t iStartDelay); void LuaCloneRenderMode(LuaClassInstance inst); bool GetUseLighting() const { return m_bUseLighting; } void SetFoV(float fFoV); float GetFoV() const {return m_fFOV;} void SetTimestep(size_t); size_t Timestep() const; void SetGlobalBBox(bool bRenderBBox); bool GetGlobalBBox() const {return m_bRenderGlobalBBox;} void SetLocalBBox(bool bRenderBBox); bool GetLocalBBox() const {return m_bRenderLocalBBox;} void LuaShowClipPlane(bool bShown, LuaClassInstance inst); // scheduling routines uint64_t GetCurrentSubFrameCount() const { return 1+m_iMaxLODIndex-m_iMinLODForCurrentView; } uint32_t GetWorkingSubFrame() const { return 1+static_cast(m_iMaxLODIndex-m_iCurrentLOD); } uint32_t GetCurrentBrickCount() const { return uint32_t(m_vCurrentBrickList.size()); } uint32_t GetWorkingBrick() const { return static_cast(m_iBricksRenderedInThisSubFrame); } virtual uint32_t GetFrameProgress() const { return uint32_t(100.0f * float(GetWorkingSubFrame()) / float(GetCurrentSubFrameCount())); } virtual uint32_t GetSubFrameProgress() const { return (m_vCurrentBrickList.empty()) ? 100 : uint32_t(100.0f * m_iBricksRenderedInThisSubFrame / float(m_vCurrentBrickList.size())); } uint64_t GetMaxLODIndex() const { return m_iMaxLODIndex; } uint64_t GetMinLODIndex() const { return m_iMinLODForCurrentView; } bool GetUseOnlyPowerOfTwo() const {return m_bUseOnlyPowerOfTwo;} bool GetDownSampleTo8Bits() const {return m_bDownSampleTo8Bits;} bool GetDisableBorder() const {return m_bDisableBorder;} /// Prepends the given directory to the list of paths Tuvok will /// try to find shaders in. void AddShaderPath(const std::string &path) { m_vShaderSearchDirs.insert(m_vShaderSearchDirs.begin(), path); } UINTVECTOR2 GetLODLimits() const { return m_iLODLimits; } void SetLODLimits(const UINTVECTOR2 iLODLimits); void SetColors(FLOATVECTOR4 ambient, FLOATVECTOR4 diffuse, FLOATVECTOR4 specular, FLOATVECTOR3 lightDir); Interpolant GetInterpolant() const {return m_eInterpolant;} FLOATVECTOR4 GetAmbient() const; FLOATVECTOR4 GetDiffuse() const; FLOATVECTOR4 GetSpecular()const; FLOATVECTOR3 GetLightDir()const; void SetDatasetIsInvalid(bool bDatasetIsInvalid) { m_bDatasetIsInvalid = bDatasetIsInvalid; } // Return value references are not supported by lua. std::vector> GetMeshes() {return m_Meshes;} void ReloadMesh(size_t index, const std::shared_ptr m); float GetSampleRateModifier() const { return m_fSampleRateModifier; } DOUBLEVECTOR3 GetRescaleFactors() const { return m_pDataset->GetRescaleFactors(); } FLOATVECTOR3 LuaGetVolumeAABBExtents() const; FLOATVECTOR3 LuaGetVolumeAABBCenter() const; virtual void FixedFunctionality() const = 0; virtual void SyncStateManager() = 0; // we can't create a std::vector in Lua, but setRenderRegions needs one. // this hacks around it. std::vector vecRegion(LuaClassInstance); /// sets the current rotation matrix. virtual void SetRotation(const FLOATMATRIX4& rotation); protected: /// Unsets the current transfer function, including deleting it from GPU /// memory. It's expected you'll set another one directly afterwards. void Free1DTrans(); /// This is the function that should be called after creating a new 1D /// transfer function and associating it with the variable m_p1DTrans. /// @todo Find a more elegant way of doing this. void LuaBindNew1DTrans(); /// This is the function that should be called after creating a new 2D /// transfer function and associating it with the variable m_p2DTrans. void LuaBindNew2DTrans(); /// @return the current iso value, normalized to be in [0,1] double GetNormalizedIsovalue() const; /// @return the current clearview iso value, normalized to be in [0,1] double GetNormalizedCVIsovalue() const; virtual void ClearColorBuffer() const = 0; virtual void UpdateLightParamsInShaders() = 0; virtual void CVFocusHasChanged(LuaClassInstance region); /// @returns if the data we're rendering is color or not. virtual bool ColorData() const; protected: MasterController* m_pMasterController; std::shared_ptr m_pContext; ERenderMode m_eRenderMode; bool m_bFirstDrawAfterModeChange; bool m_bFirstDrawAfterResize; EBlendPrecision m_eBlendPrecision; bool m_bUseLighting; Dataset* m_pDataset; TransferFunction1D* m_p1DTrans; TransferFunction2D* m_p2DTrans; float m_fSampleRateModifier; FLOATVECTOR3 m_vIsoColor; FLOATVECTOR3 m_vBackgroundColors[2]; FLOATVECTOR4 m_vTextColor; bool m_bRenderGlobalBBox; bool m_bRenderLocalBBox; UINTVECTOR2 m_vWinSize; int m_iLogoPos; std::string m_strLogoFilename; uint32_t m_iDebugView; Interpolant m_eInterpolant; bool m_bSupportsMeshes; std::vector> m_Meshes; /// parameters for dynamic resolution adjustments ///@{ float msecPassed[2]; // time taken for last two frames float msecPassedCurrentFrame; // time taken for our current rendering uint32_t m_iLODNotOKCounter; // n frames waited for render to become faster bool decreaseScreenRes; ///< dec.'d display resolution (lower n_fragments) bool decreaseScreenResNow; bool decreaseSamplingRate; ///< dec.'d sampling rate (less shader work) bool decreaseSamplingRateNow; bool doAnotherRedrawDueToLowResOutput; ///< previous subframe had res or rate /// reduced; we need another render to /// complete finish up. float m_fMaxMSPerFrame; float m_fScreenResDecFactor; float m_fSampleDecFactor; bool m_bRenderLowResIntermediateResults; bool m_bOffscreenIsLowRes; uint32_t m_iStartDelay; uint64_t m_iMinLODForCurrentView; uint32_t m_iTimeSliceMSecs; ///@} uint64_t m_iIntraFrameCounter; uint64_t m_iFrameCounter; uint32_t m_iCheckCounter; uint64_t m_iMaxLODIndex; UINTVECTOR2 m_iLODLimits; uint64_t m_iPerformanceBasedLODSkip; uint64_t m_iCurrentLODOffset; uint64_t m_iStartLODOffset; size_t m_iTimestep; CullingLOD m_FrustumCullingLOD; bool m_bClearFramebuffer; bool m_bConsiderPreviousDepthbuffer; uint64_t m_iCurrentLOD; uint64_t m_iBricksRenderedInThisSubFrame; std::vector m_vCurrentBrickList; std::vector m_vLeftEyeBrickList; ERendererTarget m_eRendererTarget; bool m_bMIPLOD; float m_fMIPRotationAngle; FLOATMATRIX4 m_maMIPRotation; bool m_bOrthoView; bool m_bRenderCoordArrows; bool m_bRenderPlanesIn3D; bool m_bDoClearView; FLOATVECTOR3 m_vCVColor; float m_fCVSize; float m_fCVContextScale; float m_fCVBorderScale; INTVECTOR2 m_vCVMousePos; FLOATVECTOR4 m_vCVPos; bool m_bPerformReCompose; bool m_bRequestStereoRendering; bool m_bDoStereoRendering; bool m_bUserMatrices; FLOATMATRIX4 m_UserView; FLOATMATRIX4 m_UserViewLeft; FLOATMATRIX4 m_UserViewRight; FLOATMATRIX4 m_UserProjection; FLOATMATRIX4 m_UserProjectionLeft; FLOATMATRIX4 m_UserProjectionRight; int m_iAlternatingFrameID; float m_fStereoEyeDist; float m_fStereoFocalLength; EStereoMode m_eStereoMode; bool m_bStereoEyeSwap; std::vector m_vArrowGeometry; bool m_bDatasetIsInvalid; // compatibility settings bool m_bUseOnlyPowerOfTwo; bool m_bDownSampleTo8Bits; bool m_bDisableBorder; enum ScalingMethod m_TFScalingMethod; FLOATMATRIX4 m_mProjection[2]; FLOATMATRIX4 m_mView[2]; std::vector m_vShaderSearchDirs; ExtendedPlane m_ClipPlane; bool m_bClipPlaneOn; bool m_bClipPlaneDisplayed; bool m_bClipPlaneLocked; /// view parameters. ///@{ FLOATVECTOR3 m_vEye, m_vAt, m_vUp; float m_fFOV; float m_fZNear, m_fZFar; bool m_bFirstPersonMode; ///@} std::vector> renderRegions; // For displaying a full single 3D view without the client needing to know // about RenderRegions. std::shared_ptr simpleRenderRegion3D; // colors for the volume light FLOATVECTOR4 m_cAmbient; FLOATVECTOR4 m_cDiffuse; FLOATVECTOR4 m_cSpecular; // colors for the mesh light FLOATVECTOR4 m_cAmbientM; FLOATVECTOR4 m_cDiffuseM; FLOATVECTOR4 m_cSpecularM; // light direction (for both) FLOATVECTOR3 m_vLightDir; virtual void ScheduleRecompose(RenderRegion *renderRegion=NULL); void ComputeMinLODForCurrentView(); void ComputeMaxLODForCurrentView(); virtual void PlanFrame(RenderRegion3D& region); void PlanHQMIPFrame(RenderRegion& renderRegion); /// @return true if the brick is needed to render the given region bool RegionNeedsBrick(const RenderRegion& rr, const BrickKey& key, const BrickMD& bmd, bool& bIsEmptyButInFrustum) const; /// @return true if this brick is clipped by a clipping plane. bool Clipped(const RenderRegion&, const Brick&) const; /// does the current brick contain relevant data? bool ContainsData(const BrickKey&) const; std::vector BuildSubFrameBrickList(bool bUseResidencyAsDistanceCriterion=false); std::vector BuildLeftEyeSubFrameBrickList( const FLOATMATRIX4& modelview, const std::vector& vRightEyeBrickList ) const; void CompletedASubframe(RenderRegion* region); void RestartTimer(const size_t iTimerIndex); void RestartTimers(); double MaxValue() const; bool OnlyRecomposite(RenderRegion* region) const; virtual bool IsVolumeResident(const BrickKey& key) const = 0; /// Since m_Meshes no longer gets returned as a reference from GetMeshes, /// we need to implement these mutation functions to provide support via /// lua. void ClearRendererMeshes(); LuaClassInstance m_pLua2DTrans; LuaTransferFun2DProxy* m_pLua2DTransPtr; /// Used by GLRenderer. LuaClassInstance LuaGet2DTrans(); bool m_bDebugBricks; /// write out md5sums of bricks. private: float m_fIsovalue; float m_fCVIsovalue; // Private Lua-only functions/variables private: LuaClassInstance m_pLuaDataset; LuaDatasetProxy* m_pLuaDatasetPtr; LuaClassInstance LuaGetDataset(); LuaClassInstance m_pLua1DTrans; LuaTransferFun1DProxy* m_pLua1DTransPtr; LuaClassInstance LuaGet1DTrans(); void BrickDebugging(bool); }; }; //namespace tuvok #endif // ABSTRRENDERER_H ImageVis3D-3.1.0/Tuvok/Renderer/TFScaling.h0000644000175000017500000000337012320456500020121 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2009 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file TFScaling \author Tom Fogal SCI Institute University of Utah \brief Functions for scaling transfer functions. */ #pragma once #ifndef TUVOK_TF_SCALING_H #define TUVOK_TF_SCALING_H #include class TransferFunction1D; namespace tuvok { class Dataset; float scale_bit_width(const Dataset& ds, bool downsample, const TransferFunction1D& tf); std::pair scale_bias_and_scale(Dataset& ds); }; // tuvok namespace. #endif // TUVOK_TF_SCALING_H ImageVis3D-3.1.0/Tuvok/Renderer/SBVRGeogen3D.cpp0000644000175000017500000002431212320456500020731 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file SBVRGeogen3D.cpp \author Jens Krueger SCI Institute University of Utah \date September 2008 */ #include "StdTuvokDefines.h" #include #include #include #include #include #include "SBVRGeogen3D.h" #include "MathTools.h" using namespace tuvok; static bool CheckOrdering(const FLOATVECTOR3& a, const FLOATVECTOR3& b, const FLOATVECTOR3& c); static void SortPoints(std::vector &fArray); SBVRGeogen3D::SBVRGeogen3D(void) : SBVRGeogen(), m_fMaxZ(0), m_fMinZ(0) { } SBVRGeogen3D::~SBVRGeogen3D(void) { } // Finds the point with the minimum position in Z. struct vertex_max_z : public std::binary_function { bool operator()(const VERTEX_FORMAT &a, const VERTEX_FORMAT &b) const { return (a.m_vPos.z < b.m_vPos.z); } }; // Finds the point with the maximum position in Z. struct vertex_min_z : public std::binary_function { bool operator()(const VERTEX_FORMAT &a, const VERTEX_FORMAT &b) const { return (a.m_vPos.z > b.m_vPos.z); } }; void SBVRGeogen3D::InitBBOX() { SBVRGeogen::InitBBOX(); // find the maximum z value m_fMaxZ = (*std::max_element(m_pfBBOXVertex, m_pfBBOXVertex+8, vertex_max_z())).m_vPos.z; m_fMinZ = (*std::max_element(m_pfBBOXVertex, m_pfBBOXVertex+8, vertex_min_z())).m_vPos.z; } bool SBVRGeogen3D::DepthPlaneIntersection(float z, const VERTEX_FORMAT &plA, const VERTEX_FORMAT &plB, std::vector& vHits, bool bClip) { /* returns NO INTERSECTION if the line of the 2 points a,b is 1. in front of the intersection plane 2. behind the intersection plane 3. parallel to the intersection plane (both points have "pretty much" the same z) */ if ((z > plA.m_vPos.z && z > plB.m_vPos.z) || (z < plA.m_vPos.z && z < plB.m_vPos.z) || (EpsilonEqual(plA.m_vPos.z, plB.m_vPos.z))) { return false; } float fAlpha = (z - plA.m_vPos.z) / (plA.m_vPos.z - plB.m_vPos.z); VERTEX_FORMAT vHit; vHit.m_vPos.x = plA.m_vPos.x + (plA.m_vPos.x - plB.m_vPos.x) * fAlpha; vHit.m_vPos.y = plA.m_vPos.y + (plA.m_vPos.y - plB.m_vPos.y) * fAlpha; vHit.m_vPos.z = z; vHit.m_vVertexData = plA.m_vVertexData + (plA.m_vVertexData - plB.m_vVertexData) * fAlpha; vHit.m_bClip = bClip; vHits.push_back(vHit); return true; } // Functor to identify the point with the lowest `y' coordinate. struct vertex_min : public std::binary_function { bool operator()(const VERTEX_FORMAT &a, const VERTEX_FORMAT &b) const { return (a.m_vPos.y < b.m_vPos.y); } }; // Sorts a vector void SBVRGeogen3D::SortByGradient(std::vector& fArray) { // move bottom element to front of array if(fArray.empty()) { return; } std::swap(fArray[0], *std::min_element(fArray.begin(), fArray.end(), vertex_min())); if(fArray.size() > 2) { // sort points according to gradient SortPoints(fArray); } } void SBVRGeogen3D::Triangulate(std::vector &fArray) { SortByGradient(fArray); // convert to triangles for (uint32_t i=0; i<(fArray.size()-2) ; i++) { m_vSliceTriangles.push_back(fArray[0]); m_vSliceTriangles.push_back(fArray[i+1]); m_vSliceTriangles.push_back(fArray[i+2]); } } bool SBVRGeogen3D::ComputeLayerGeometry(float fDepth) { std::vector vLayerPoints; vLayerPoints.reserve(12); assert(!MathTools::NaN(fDepth)); DepthPlaneIntersection(fDepth, m_pfBBOXVertex[0], m_pfBBOXVertex[1], vLayerPoints, m_bClipVolume); DepthPlaneIntersection(fDepth, m_pfBBOXVertex[1], m_pfBBOXVertex[2], vLayerPoints, m_bClipVolume); DepthPlaneIntersection(fDepth, m_pfBBOXVertex[2], m_pfBBOXVertex[3], vLayerPoints, m_bClipVolume); DepthPlaneIntersection(fDepth, m_pfBBOXVertex[3], m_pfBBOXVertex[0], vLayerPoints, m_bClipVolume); DepthPlaneIntersection(fDepth, m_pfBBOXVertex[4], m_pfBBOXVertex[5], vLayerPoints, m_bClipVolume); DepthPlaneIntersection(fDepth, m_pfBBOXVertex[5], m_pfBBOXVertex[6], vLayerPoints, m_bClipVolume); DepthPlaneIntersection(fDepth, m_pfBBOXVertex[6], m_pfBBOXVertex[7], vLayerPoints, m_bClipVolume); DepthPlaneIntersection(fDepth, m_pfBBOXVertex[7], m_pfBBOXVertex[4], vLayerPoints, m_bClipVolume); DepthPlaneIntersection(fDepth, m_pfBBOXVertex[4], m_pfBBOXVertex[0], vLayerPoints, m_bClipVolume); DepthPlaneIntersection(fDepth, m_pfBBOXVertex[5], m_pfBBOXVertex[1], vLayerPoints, m_bClipVolume); DepthPlaneIntersection(fDepth, m_pfBBOXVertex[6], m_pfBBOXVertex[2], vLayerPoints, m_bClipVolume); DepthPlaneIntersection(fDepth, m_pfBBOXVertex[7], m_pfBBOXVertex[3], vLayerPoints, m_bClipVolume); if (vLayerPoints.size() <= 2) { return false; } // insert mesh triangles if (HasMesh()) InsertMeshUpToSlice(fDepth); Triangulate(vLayerPoints); return true; } float SBVRGeogen3D::GetLayerDistance() const { return (0.5f * 1.0f/m_fSamplingModifier * (m_vAspect/FLOATVECTOR3(m_vSize))).minVal(); } void SBVRGeogen3D::InsertMeshUpToSlice(float fDepth) { for (SortIndexPVec::const_iterator index = m_MeshTransferIter; index != m_mesh.end(); index++) { if ((*index)->fDepth <= fDepth) { m_MeshTransferIter = index; return; } MeshEntryToVertexFormat(m_vSliceTriangles, (*index)->m_mesh, (*index)->m_index, m_bClipMesh); } m_MeshTransferIter = m_mesh.end(); } void SBVRGeogen3D::DepthSortMeshWithVolume() { // this is m_matWorldView without the brick transformation FLOATMATRIX4 matWorldView = m_matWorld * m_matView; // change "depth" from "distance to eye z-depth for (SortIndexPVec::iterator index = m_mesh.begin(); index != m_mesh.end(); index++) { // get poly centroid FLOATVECTOR3 centroid = (*index)->m_centroid; // transform it centroid = (FLOATVECTOR4(centroid,1) * matWorldView).xyz(); (*index)->fDepth = centroid.z; } // sort std::sort(m_mesh.begin(), m_mesh.end(), DistanceSortOver); m_MeshTransferIter = m_mesh.begin(); } void SBVRGeogen3D::ComputeGeometry(bool bMeshOnly) { InitBBOX(); m_vSliceTriangles.clear(); if (bMeshOnly) { SortMeshWithoutVolume(m_vSliceTriangles); return; } float fDepth = m_fMaxZ; float fLayerDistance = GetLayerDistance(); assert(fLayerDistance > 0); // I hit this every time I fiddle with the integration of an // application. If an app doesn't set brick metadata properly, we'll // calculate a bad minimum Z value of nan. nan + anything is still nan, // so we end up with an infinite loop computing geometry below. assert(!MathTools::NaN(fDepth)); // prepare mesh triangles for insertion (i.e. sort them) if (HasMesh()) DepthSortMeshWithVolume(); do { ComputeLayerGeometry(fDepth); fDepth -= fLayerDistance; } while (fDepth > m_fMinZ); // insert all the leftover triangles they must be behind the last plane if (HasMesh()) { for (SortIndexPVec::const_iterator index = m_MeshTransferIter; index != m_mesh.end(); index++) { MeshEntryToVertexFormat(m_vSliceTriangles, (*index)->m_mesh, (*index)->m_index, m_bClipMesh); } } if(m_bClipPlaneEnabled && (m_bClipVolume || m_bClipMesh)) { PLANE transformed = m_ClipPlane * m_matView; const FLOATVECTOR3 normal(transformed.xyz()); const float d = transformed.d(); m_vSliceTriangles = ClipTriangles(m_vSliceTriangles, normal, d); } } // Checks the ordering of two points relative to a third. static bool CheckOrdering(const FLOATVECTOR3& a, const FLOATVECTOR3& b, const FLOATVECTOR3& c) { float g1 = (a.y-c.y)/(a.x-c.x), g2 = (b.y-c.y)/(b.x-c.x); if (EpsilonEqual(a.x,c.x)) return (g2 < 0) || (EpsilonEqual(g2,0.0f) && b.x < c.x); if (EpsilonEqual(b.x,c.x)) return (g1 > 0) || (EpsilonEqual(g1,0.0f) && a.x > c.x); if (a.x < c.x) if (b.x < c.x) return g1 < g2; else return false; else if (b.x < c.x) return true; else return g1 < g2; } /// @todo: should be replaced with std::sort. static void SortPoints(std::vector &fArray) { // for small arrays, this bubble sort actually beats qsort. for (uint32_t i= 1;i #include #include #include #include "Basics/MathTools.h" #include "Basics/nonstd.h" #include "Basics/GeometryGenerator.h" #include "Basics/SysTools.h" #include "IO/Tuvok_QtPlugins.h" #include "IO/IOManager.h" #include "IO/TransferFunction1D.h" #include "IO/TransferFunction2D.h" #include "AbstrRenderer.h" #include "Controller/Controller.h" #include "LuaScripting/LuaScripting.h" #include "LuaScripting/LuaClassInstance.h" #include "LuaScripting/TuvokSpecific/LuaTuvokTypes.h" #include "LuaScripting/TuvokSpecific/LuaDatasetProxy.h" #include "LuaScripting/TuvokSpecific/LuaTransferFun1DProxy.h" #include "LuaScripting/TuvokSpecific/LuaTransferFun2DProxy.h" #include "Renderer/GPUMemMan/GPUMemMan.h" #include "RenderMesh.h" #include "ShaderDescriptor.h" using namespace std; using namespace tuvok; static const FLOATVECTOR3 s_vEye(0,0,1.6f); static const FLOATVECTOR3 s_vAt(0,0,0); static const FLOATVECTOR3 s_vUp(0,1,0); static const float s_fFOV = 50.0f; static const float s_fZNear = 0.01f; static const float s_fZFar = 1000.0f; AbstrRenderer::AbstrRenderer(MasterController* pMasterController, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder, enum ScalingMethod sm) : m_pMasterController(pMasterController), m_eRenderMode(RM_1DTRANS), m_bFirstDrawAfterModeChange(true), m_bFirstDrawAfterResize(true), m_eBlendPrecision(BP_32BIT), m_bUseLighting(true), m_pDataset(NULL), m_p1DTrans(NULL), m_p2DTrans(NULL), m_fSampleRateModifier(1.0f), m_vIsoColor(0.5,0.5,0.5), m_vTextColor(1,1,1,1), m_bRenderGlobalBBox(false), m_bRenderLocalBBox(false), m_vWinSize(0,0), m_iLogoPos(3), m_strLogoFilename(""), m_iDebugView(0), m_eInterpolant(Linear), m_bSupportsMeshes(false), msecPassedCurrentFrame(-1.0f), m_iLODNotOKCounter(0), decreaseScreenRes(false), decreaseScreenResNow(false), decreaseSamplingRate(false), decreaseSamplingRateNow(false), doAnotherRedrawDueToLowResOutput(false), m_fMaxMSPerFrame(10000), m_fScreenResDecFactor(2.0f), m_fSampleDecFactor(2.0f), m_bRenderLowResIntermediateResults(false), m_bOffscreenIsLowRes(false), m_iStartDelay(1000), m_iMinLODForCurrentView(0), m_iTimeSliceMSecs(100), m_iIntraFrameCounter(0), m_iFrameCounter(0), m_iCheckCounter(0), m_iMaxLODIndex(0), m_iLODLimits(0,0), m_iPerformanceBasedLODSkip(0), m_iCurrentLODOffset(0), m_iStartLODOffset(0), m_iTimestep(0), m_bClearFramebuffer(true), m_bConsiderPreviousDepthbuffer(true), m_iCurrentLOD(0), m_iBricksRenderedInThisSubFrame(0), m_eRendererTarget(RT_INTERACTIVE), m_bMIPLOD(true), m_fMIPRotationAngle(0.0f), m_bOrthoView(false), m_bRenderCoordArrows(false), m_bRenderPlanesIn3D(false), m_bDoClearView(false), m_vCVColor(1,0,0), m_fCVSize(5.5f), m_fCVContextScale(1.0f), m_fCVBorderScale(60.0f), m_vCVMousePos(0, 0), m_vCVPos(0,0,0.5f,1.0f), m_bPerformReCompose(false), m_bRequestStereoRendering(false), m_bDoStereoRendering(false), m_bUserMatrices(false), m_iAlternatingFrameID(0), m_fStereoEyeDist(0.02f), m_fStereoFocalLength(1.0f), m_eStereoMode(SM_RB), m_bStereoEyeSwap(false), m_bDatasetIsInvalid(false), m_bUseOnlyPowerOfTwo(bUseOnlyPowerOfTwo), m_bDownSampleTo8Bits(bDownSampleTo8Bits), m_bDisableBorder(bDisableBorder), m_TFScalingMethod(sm), m_bClipPlaneOn(false), m_bClipPlaneDisplayed(true), m_bClipPlaneLocked(true), m_vEye(s_vEye), m_vAt(s_vAt), m_vUp(s_vUp), m_fFOV(s_fFOV), m_fZNear(s_fZNear), m_fZFar(s_fZFar), m_bFirstPersonMode(false), simpleRenderRegion3D(new RenderRegion3D(this)), m_cAmbient(1.0f,1.0f,1.0f,0.1f), m_cDiffuse(1.0f,1.0f,1.0f,1.0f), m_cSpecular(1.0f,1.0f,1.0f,1.0f), m_cAmbientM(1.0f,1.0f,1.0f,0.1f), m_cDiffuseM(1.0f,1.0f,1.0f,1.0f), m_cSpecularM(1.0f,1.0f,1.0f,1.0f), m_vLightDir(0.0f,0.0f,-1.0f), m_bDebugBricks(false), m_fIsovalue(0.5f), m_fCVIsovalue(0.8f) { m_vBackgroundColors[0] = FLOATVECTOR3(0,0,0); m_vBackgroundColors[1] = FLOATVECTOR3(0,0,0); simpleRenderRegion3D->minCoord = UINTVECTOR2(0,0); // maxCoord is updated in Paint(). renderRegions.push_back(simpleRenderRegion3D); RestartTimers(); if(SysTools::FileExists("Shaders")) { m_vShaderSearchDirs.push_back("Shaders"); } if(SysTools::FileExists("Tuvok/Shaders")) { m_vShaderSearchDirs.push_back("Tuvok/Shaders"); } if(SysTools::FileExists("../Tuvok/Shaders")) { m_vShaderSearchDirs.push_back("../Tuvok/Shaders"); } // trim out directories which are nonsense. Gets rid of some warnings. m_vShaderSearchDirs = ShaderDescriptor::ValidPaths(m_vShaderSearchDirs); m_vArrowGeometry = GeometryGenerator::GenArrow(0.3f,0.8f,0.006f,0.012f,20); // Create our dataset proxy. m_pLuaDataset = m_pMasterController->LuaScript()->cexecRet( "tuvok.datasetProxy.new"); m_pLuaDatasetPtr = m_pLuaDataset.getRawPointer( m_pMasterController->LuaScript()); // Create our 1D transfer function proxy. m_pLua1DTrans = m_pMasterController->LuaScript()->cexecRet( "tuvok.transferFun1D.new"); m_pLua1DTransPtr = m_pLua1DTrans.getRawPointer( m_pMasterController->LuaScript()); // Create our 2D transfer function proxy. m_pLua2DTrans = m_pMasterController->LuaScript()->cexecRet( "tuvok.transferFun2D.new"); m_pLua2DTransPtr = m_pLua2DTrans.getRawPointer( m_pMasterController->LuaScript()); } bool AbstrRenderer::Initialize(std::shared_ptr ctx) { m_pContext = ctx; return m_pDataset != NULL; } bool AbstrRenderer::LoadFile(const std::string& filename) { if(NULL == m_pMasterController) { return false; } if(NULL == m_pMasterController->IOMan()) { T_ERROR("no IOManager! can't load DS"); return false; } Dataset* ds = m_pMasterController->IOMan()->LoadDataset(filename, this); if(NULL == ds) { T_ERROR("IOManager could not load '%s', giving up", filename.c_str()); return false; } MESSAGE("Load successful, initializing renderer!"); return this->RegisterDataset(ds); } bool AbstrRenderer::RegisterDataset(Dataset* ds) { if(m_pDataset) { m_pMasterController->MemMan()->FreeDataset(m_pDataset, this); m_pLuaDatasetPtr->bind(NULL, m_pMasterController->LuaScript()); } m_pDataset = ds; m_pLuaDatasetPtr->bind(m_pDataset, m_pMasterController->LuaScript()); // find the maximum LOD index m_iMaxLODIndex = m_pDataset->GetLargestSingleBrickLOD(0); // now that we know the range of the dataset, we can set the default // isoval to half the range. For CV, we'll set the isovals to a bit above // the context isoval; with any luck, it'll make a valid image right off the // bat. std::pair rng = m_pDataset->GetRange(); // It can happen that we don't know the range; old UVFs, for example. We'll // know this because the minimum will be g.t. the maximum. if(rng.first > rng.second) { m_fIsovalue = float(rng.second) / 2.0f; } else { m_fIsovalue = float(rng.second-rng.first) / 2.0f; } m_fCVIsovalue = m_fIsovalue + (m_fIsovalue/2.0f); return true; } bool AbstrRenderer::LoadRebricked(const std::string& filename, const UINTVECTOR3 bsize, size_t minmaxMode) { const IOManager& iomgr = Controller::Const().IOMan(); Dataset* ds = iomgr.LoadRebrickedDataset(filename, bsize, minmaxMode); Controller::Instance().MemMan()->AddDataset(ds, this); return this->RegisterDataset(ds); } AbstrRenderer::~AbstrRenderer() { if (m_pDataset) m_pMasterController->MemMan()->FreeDataset(m_pDataset, this); if (m_p1DTrans) m_pMasterController->MemMan()->Free1DTrans(m_p1DTrans, this); if (m_p2DTrans) m_pMasterController->MemMan()->Free2DTrans(m_p2DTrans, this); // Ensure the master controller has remove this abstract renderer from its // list. m_pMasterController->ReleaseVolumeRenderer(this); // Kill the dataset proxy. m_pMasterController->LuaScript()->cexecRet( "deleteClass", m_pLuaDataset); // Kill the transfer function 1d proxy. m_pMasterController->LuaScript()->cexecRet( "deleteClass", m_pLua1DTrans); // Kill the transfer function 2d proxy. m_pMasterController->LuaScript()->cexecRet( "deleteClass", m_pLua2DTrans); } void AbstrRenderer::SetRendermode(ERenderMode eRenderMode) { if (m_eRenderMode != eRenderMode) { m_eRenderMode = eRenderMode; m_bFirstDrawAfterModeChange = true; ScheduleCompleteRedraw(); } } void AbstrRenderer::SetUseLighting(bool bUseLighting) { if (m_bUseLighting != bUseLighting) { m_bUseLighting = bUseLighting; Schedule3DWindowRedraws(); } } void AbstrRenderer::SetBlendPrecision(EBlendPrecision eBlendPrecision) { if (m_eBlendPrecision != eBlendPrecision) { m_eBlendPrecision = eBlendPrecision; ScheduleCompleteRedraw(); } } /// @todo fixme: this and ::LoadDataset should coexist better: the latter /// should probably call this method, instead of duplicating stuff. void AbstrRenderer::SetDataset(Dataset *vds) { if(m_pDataset) { Controller::Instance().MemMan()->FreeDataset(m_pDataset, this); } m_pDataset = vds; m_iMaxLODIndex = m_pDataset->GetLargestSingleBrickLOD(0); Controller::Instance().MemMan()->AddDataset(m_pDataset, this); ScheduleCompleteRedraw(); } void AbstrRenderer::Free1DTrans() { GPUMemMan& mm = *(Controller::Instance().MemMan()); mm.Free1DTrans(m_p1DTrans, this); m_pLua1DTransPtr->bind(NULL); } void AbstrRenderer::LuaBindNew2DTrans() { m_pLua2DTransPtr->bind(m_p2DTrans); } void AbstrRenderer::LuaBindNew1DTrans() { m_pLua1DTransPtr->bind(m_p1DTrans); } void AbstrRenderer::Changed1DTrans() { AbstrDebugOut *dbg = m_pMasterController->DebugOut(); if (m_eRenderMode != RM_1DTRANS) { dbg->Message(_func_, "not using the 1D transferfunction at the moment, " "ignoring message"); } else { dbg->Message(_func_, "complete redraw scheduled"); ScheduleCompleteRedraw(); // No provenance; as a mechanism to filter out too many updates, we place // the onus on updating this in the UI which is driving us. } } void AbstrRenderer::Changed2DTrans() { if (m_eRenderMode != RM_2DTRANS) { MESSAGE("not currently using 2D tfqn; ignoring message."); } else { ScheduleCompleteRedraw(); // No provenance; handled by application, not Tuvok lib. } } void AbstrRenderer::SetFoV(float fFoV) { if(m_fFOV != fFoV) { m_fFOV = fFoV; Schedule3DWindowRedraws(); } } void AbstrRenderer::SetSampleRateModifier(float fSampleRateModifier) { if(m_fSampleRateModifier != fSampleRateModifier) { m_fSampleRateModifier = fSampleRateModifier; Schedule3DWindowRedraws(); } } void AbstrRenderer::SetIsoValue(float fIsovalue) { if(fIsovalue != m_fIsovalue) { m_fIsovalue = fIsovalue; Schedule3DWindowRedraws(); } } /// The given isoval is interpreted relative to the min/max of the range of the /// data values: 0 is the min and 1 is the max. void AbstrRenderer::SetIsoValueRelative(float isorel) { // can't assert a proper range, but we can at least prevent idiots from // calling 'SetIsoValueRelative(255)'. assert(-0.01 <= isorel && isorel <= 1.01); // clamp it to [0,1] isorel = std::max(0.0f, isorel); isorel = std::min(1.0f, isorel); // grab the range and lerp the given isoval to that range std::pair minmax = m_pDataset->GetRange(); // we might not know the range; use the bit width if so. if(minmax.second <= minmax.first) { minmax.first = 0; minmax.second = std::pow(2.0, static_cast(m_pDataset->GetBitWidth())); } float newiso = MathTools::lerp(isorel, 0.0f, 1.0f, minmax.first, minmax.second); this->SetIsoValue(newiso); } double AbstrRenderer::GetNormalizedIsovalue() const { if(m_pDataset->GetBitWidth() != 8 && m_bDownSampleTo8Bits) { double mx; if(m_pDataset->GetRange().first > m_pDataset->GetRange().second) { mx = double(m_p1DTrans->GetSize()); } else { mx = m_pDataset->GetRange().second; } return MathTools::lerp(m_fIsovalue, 0.f,static_cast(mx), 0.f,1.f); } return m_fIsovalue / (1 << m_pDataset->GetBitWidth()); } double AbstrRenderer::GetNormalizedCVIsovalue() const { if(m_pDataset->GetBitWidth() != 8 && m_bDownSampleTo8Bits) { double mx; if(m_pDataset->GetRange().first > m_pDataset->GetRange().second) { mx = double(m_p1DTrans->GetSize()); } else { mx = m_pDataset->GetRange().second; } return MathTools::lerp(m_fCVIsovalue, 0.f,static_cast(mx), 0.f,1.f); } return m_fCVIsovalue / (1 << m_pDataset->GetBitWidth()); } bool AbstrRenderer::CheckForRedraw() { if (m_vWinSize.area() == 0) return false; // can't draw to a size zero window. bool decrementCounter = false; bool redrawRequired = false; redrawRequired = m_bPerformReCompose; for (size_t i=0; i < renderRegions.size(); ++i) { const std::shared_ptr region = renderRegions[i]; // need to redraw for 1 of three reasons: // didn't finish last paint call; bricks remain. // haven't rendered the finest LOD for the current view // last draw was low res or sample rate for interactivity if (m_vCurrentBrickList.size() > m_iBricksRenderedInThisSubFrame || m_iCurrentLODOffset > m_iMinLODForCurrentView || this->doAnotherRedrawDueToLowResOutput) { if (m_iCheckCounter == 0 || m_eRendererTarget != RT_INTERACTIVE) { MESSAGE("Still drawing..."); return true; } else { decrementCounter = true; } } // region is completely blank? redrawRequired |= region->isBlank; } /// @todo Is this logic for how/when to decrement correct? if (decrementCounter) m_iCheckCounter--; return redrawRequired; } void AbstrRenderer::Resize(const UINTVECTOR2& vWinSize) { m_vWinSize = vWinSize; m_bFirstDrawAfterResize = true; ScheduleCompleteRedraw(); } std::shared_ptr AbstrRenderer::GetFirst3DRegion() { for (size_t i=0; i < renderRegions.size(); ++i) { if (renderRegions[i]->is3D()) { return std::dynamic_pointer_cast(renderRegions[i]); } } return NULL; } LuaClassInstance AbstrRenderer::LuaGetFirst3DRegion() { return m_pMasterController->LuaScript()->getLuaClassInstance( dynamic_cast(GetFirst3DRegion().get())); } void AbstrRenderer::SetRotationRR(RenderRegion *renderRegion, const FLOATMATRIX4& rotation) { renderRegion->rotation = rotation; ScheduleWindowRedraw(renderRegion); } const FLOATMATRIX4& AbstrRenderer::GetRotation(const RenderRegion* renderRegion) const { return renderRegion->rotation; } void AbstrRenderer::SetTranslation(RenderRegion *renderRegion, const FLOATMATRIX4& mTranslation) { renderRegion->translation = mTranslation; ScheduleWindowRedraw(renderRegion); } const FLOATMATRIX4& AbstrRenderer::GetTranslation(const RenderRegion* renderRegion) const { return renderRegion->translation; } void AbstrRenderer::SetClipPlane(RenderRegion *renderRegion, const ExtendedPlane& plane) { if(plane == m_ClipPlane) { return; } m_ClipPlane = plane; /// @todo: Make this per RenderRegion. ScheduleWindowRedraw(renderRegion); } bool AbstrRenderer::IsClipPlaneEnabled(RenderRegion *renderRegion) { if (renderRegion) return m_bClipPlaneOn; /// @todo: Make this per RenderRegion. else return false; } void AbstrRenderer::EnableClipPlane(RenderRegion *renderRegion) { if (renderRegion) { if(!m_bClipPlaneOn) { m_bClipPlaneOn = true; /// @todo: Make this per RenderRegion. ScheduleWindowRedraw(renderRegion); } } } void AbstrRenderer::DisableClipPlane(RenderRegion *renderRegion) { if (renderRegion) { if(m_bClipPlaneOn) { m_bClipPlaneOn = false; /// @todo: Make this per RenderRegion. ScheduleWindowRedraw(renderRegion); } } } void AbstrRenderer::ShowClipPlane(bool bShown, RenderRegion *renderRegion) { if (renderRegion) { m_bClipPlaneDisplayed = bShown; /// @todo: Make this per RenderRegion. if(m_bClipPlaneOn) { ScheduleWindowRedraw(renderRegion); } } } void AbstrRenderer::LuaShowClipPlane(bool bShown, LuaClassInstance inst) { shared_ptr ss = m_pMasterController->LuaScript(); ShowClipPlane(bShown, inst.getRawPointer(ss)); } const ExtendedPlane& AbstrRenderer::GetClipPlane() const { return m_ClipPlane; } ExtendedPlane AbstrRenderer::LuaGetClipPlane() const { return GetClipPlane(); } void AbstrRenderer::ClipPlaneRelativeLock(bool bRel) { m_bClipPlaneLocked = bRel;/// @todo: Make this per RenderRegion ? } void AbstrRenderer::SetSliceDepth(RenderRegion *renderRegion, uint64_t sliceDepth) { if (renderRegion->GetSliceIndex() != sliceDepth) { renderRegion->SetSliceIndex(sliceDepth); ScheduleWindowRedraw(renderRegion); if (m_bRenderPlanesIn3D) Schedule3DWindowRedraws(); } } uint64_t AbstrRenderer::GetSliceDepth(const RenderRegion *renderRegion) const { return renderRegion->GetSliceIndex(); } void AbstrRenderer::SetGlobalBBox(bool bRenderBBox) { m_bRenderGlobalBBox = bRenderBBox; /// @todo: Make this per RenderRegion. Schedule3DWindowRedraws(); } void AbstrRenderer::SetLocalBBox(bool bRenderBBox) { m_bRenderLocalBBox = bRenderBBox; /// @todo: Make this per RenderRegion. Schedule3DWindowRedraws(); } void AbstrRenderer::ScheduleCompleteRedraw() { m_iCheckCounter = m_iStartDelay; MESSAGE("complete redraw scheduled"); for (size_t i=0; i < renderRegions.size(); ++i) { renderRegions[i]->redrawMask = true; renderRegions[i]->isBlank = true; renderRegions[i]->isTargetBlank = true; } } void AbstrRenderer::Schedule3DWindowRedraws() { m_iCheckCounter = m_iStartDelay; for (size_t i=0; i < renderRegions.size(); ++i) { if (renderRegions[i]->is3D()) { renderRegions[i]->redrawMask = true; renderRegions[i]->isBlank = true; renderRegions[i]->isTargetBlank = true; } } } void AbstrRenderer::ScheduleWindowRedraw(RenderRegion *renderRegion) { m_iCheckCounter = m_iStartDelay; renderRegion->redrawMask = true; renderRegion->isBlank = true; renderRegion->isTargetBlank = true; } void AbstrRenderer::ScheduleRecompose(RenderRegion *renderRegion) { if (!renderRegion) renderRegion = GetFirst3DRegion().get(); if (renderRegion) { // ensure we've finished the current frame: if(m_vCurrentBrickList.size() == m_iBricksRenderedInThisSubFrame) { m_bPerformReCompose = true; renderRegion->redrawMask = true; } else { ScheduleWindowRedraw(renderRegion); } } else { WARNING("ScheduleRecompose called with null render region"); } } void AbstrRenderer::CompletedASubframe(RenderRegion* region) { bool bRenderingFirstSubFrame = (m_iCurrentLODOffset == m_iStartLODOffset) && (!this->decreaseScreenRes || this->decreaseScreenResNow) && (!this->decreaseSamplingRate || this->decreaseSamplingRateNow); bool bSecondSubFrame = !bRenderingFirstSubFrame && (m_iCurrentLODOffset == m_iStartLODOffset || (m_iCurrentLODOffset == m_iStartLODOffset-1 && !(this->decreaseScreenRes || this->decreaseSamplingRate))); if (bRenderingFirstSubFrame) { // time for current interaction LOD -> to detect if we are too slow this->msecPassed[0] = this->msecPassedCurrentFrame; } else if(bSecondSubFrame) { this->msecPassed[1] = this->msecPassedCurrentFrame; } this->msecPassedCurrentFrame = 0.0f; region->isTargetBlank = false; } void AbstrRenderer::RestartTimer(const size_t iTimerIndex) { this->msecPassed[iTimerIndex] = -1.0f; } void AbstrRenderer::RestartTimers() { RestartTimer(0); RestartTimer(1); } void AbstrRenderer::ComputeMaxLODForCurrentView() { if (m_eRendererTarget != RT_CAPTURE && this->msecPassed[0]>=0.0f) { // if rendering is too slow use a lower resolution during interaction if (this->msecPassed[0] > m_fMaxMSPerFrame) { // wait for 3 frames before switching to lower lod (3 here is // chosen more or less arbitrarily, can be changed if needed) if (m_iLODNotOKCounter < 3) { MESSAGE("Would increase start LOD but will give the renderer %u " "more frame(s) time to become faster", 3 - m_iLODNotOKCounter); m_iLODNotOKCounter++; } else { // We gave it a chance but rendering was too slow. So let's drop down // in quality. m_iLODNotOKCounter = 0; // Easiest thing is to try rendering a lower quality LOD. So try this // if possible. uint64_t iPerformanceBasedLODSkip = std::max(1, m_iPerformanceBasedLODSkip) - 1; if (m_iPerformanceBasedLODSkip != iPerformanceBasedLODSkip) { MESSAGE("Increasing start LOD to %llu as it took %g ms " "to render the first LOD level (max is %g) ", m_iPerformanceBasedLODSkip, this->msecPassed[0], m_fMaxMSPerFrame); this->msecPassed[0] = this->msecPassed[1]; m_iPerformanceBasedLODSkip = iPerformanceBasedLODSkip; } else { // Already at lowest quality LOD, so will need to try something else. MESSAGE("Would like to increase start LOD as it took %g ms " "to render the first LOD level (max is %g) BUT CAN'T.", this->msecPassed[0], m_fMaxMSPerFrame); if (m_bRenderLowResIntermediateResults) { if (this->decreaseSamplingRate && this->decreaseScreenRes) { MESSAGE("Even with UseAllMeans there is nothing that " "can be done to meet the specified framerate."); } else { if (!this->decreaseScreenRes) { MESSAGE("UseAllMeans enabled: decreasing resolution " "to meet target framerate"); this->decreaseScreenRes = true; } else { MESSAGE("UseAllMeans enabled: decreasing sampling rate " "to meet target framerate"); this->decreaseSamplingRate = true; } } } else { MESSAGE("UseAllMeans disabled so framerate can not be met..."); } } } } else { // if finished rendering last frame (m_iBricksRenderedInThisSubFrame is // from the last frame, not the new one we are about to start) and did // this fast enough, use a higher resolution during interaction. if (m_vCurrentBrickList.size() == m_iBricksRenderedInThisSubFrame && this->msecPassed[1] >= 0.0f && this->msecPassed[1] <= m_fMaxMSPerFrame) { m_iLODNotOKCounter = 0; // We're rendering fast, so lets step up the quality. Easiest thing to // try first is rendering at normal sampling rate and resolution. if (this->decreaseSamplingRate || this->decreaseScreenRes) { if (this->decreaseSamplingRate) { MESSAGE("Rendering at full resolution as this took only %g ms", this->msecPassed[0]); this->decreaseSamplingRate = false; } else { if (this->decreaseScreenRes) { MESSAGE("Rendering to full viewport as this took only %g ms", this->msecPassed[0]); this->decreaseScreenRes = false; } } } else { // Let's try rendering at a higher quality LOD. uint64_t iPerformanceBasedLODSkip = std::min(m_iMaxLODIndex - m_iMinLODForCurrentView, m_iPerformanceBasedLODSkip + 1); if (m_iPerformanceBasedLODSkip != iPerformanceBasedLODSkip) { MESSAGE("Decreasing start LOD to %llu as it took only %g ms " "to render the second LOD level", m_iPerformanceBasedLODSkip, this->msecPassed[1]); m_iPerformanceBasedLODSkip = iPerformanceBasedLODSkip; } } } else { if (m_vCurrentBrickList.size() == m_iBricksRenderedInThisSubFrame) { MESSAGE("Start LOD seems to be ok"); } } } m_iStartLODOffset = std::max(m_iMinLODForCurrentView, m_iMaxLODIndex - m_iPerformanceBasedLODSkip); } else if (m_eRendererTarget != RT_INTERACTIVE){ m_iStartLODOffset = m_iMinLODForCurrentView; } else { // This is our very first frame, let's take it easy. m_iStartLODOffset = m_iMaxLODIndex; } m_iStartLODOffset = std::min(m_iStartLODOffset, static_cast(m_iMaxLODIndex - m_iLODLimits.x)); m_iCurrentLODOffset = m_iStartLODOffset; RestartTimers(); } void AbstrRenderer::ComputeMinLODForCurrentView() { // compute scale factor for domain UINTVECTOR3 vDomainSize = UINTVECTOR3(m_pDataset->GetDomainSize()); FLOATVECTOR3 vScale = FLOATVECTOR3(m_pDataset->GetScale()); FLOATVECTOR3 vExtend = FLOATVECTOR3(vDomainSize) * vScale; vExtend /= vExtend.maxVal(); /// @todo consider real extent not center FLOATVECTOR3 vfCenter(0,0,0); m_iMinLODForCurrentView = static_cast( MathTools::Clamp(m_FrustumCullingLOD.GetLODLevel(vfCenter, vExtend, vDomainSize), static_cast(m_iLODLimits.y), static_cast(m_pDataset->GetLODLevelCount()-1))); } /// Calculates the distance to a given brick given the current view /// transformation. There is a slight offset towards the center, which helps /// avoid ambiguous cases. static float brick_distance(const Brick &b, const FLOATMATRIX4 &mat_modelview) { const float fEpsilon = 0.4999f; const FLOATVECTOR3 vEpsilonEdges[8] = { b.vCenter + FLOATVECTOR3(-b.vExtension.x,-b.vExtension.y,-b.vExtension.z) * fEpsilon, b.vCenter + FLOATVECTOR3(-b.vExtension.x,-b.vExtension.y,+b.vExtension.z) * fEpsilon, b.vCenter + FLOATVECTOR3(-b.vExtension.x,+b.vExtension.y,-b.vExtension.z) * fEpsilon, b.vCenter + FLOATVECTOR3(-b.vExtension.x,+b.vExtension.y,+b.vExtension.z) * fEpsilon, b.vCenter + FLOATVECTOR3(+b.vExtension.x,-b.vExtension.y,-b.vExtension.z) * fEpsilon, b.vCenter + FLOATVECTOR3(+b.vExtension.x,-b.vExtension.y,+b.vExtension.z) * fEpsilon, b.vCenter + FLOATVECTOR3(+b.vExtension.x,+b.vExtension.y,-b.vExtension.z) * fEpsilon, b.vCenter + FLOATVECTOR3(+b.vExtension.x,+b.vExtension.y,+b.vExtension.z) * fEpsilon }; // final distance is the distance to the closest corner. float fDistance = std::numeric_limits::max(); for(size_t i=0; i < 8; ++i) { fDistance = std::min( fDistance, (FLOATVECTOR4(vEpsilonEdges[i],1.0f)*mat_modelview) .xyz().length() ); } return fDistance; } vector AbstrRenderer::BuildLeftEyeSubFrameBrickList( const FLOATMATRIX4& modelView, const vector& vRightEyeBrickList) const { vector vBrickList = vRightEyeBrickList; for (uint32_t iBrick = 0;iBrickGetBitWidth() != 8 && m_bDownSampleTo8Bits) return 255; else return (m_pDataset->GetRange().first > m_pDataset->GetRange().second) ? m_p1DTrans->GetSize() : m_pDataset->GetRange().second; } bool AbstrRenderer::OnlyRecomposite(RenderRegion* region) const { return !region->isBlank && m_bPerformReCompose && !this->doAnotherRedrawDueToLowResOutput; } bool AbstrRenderer::RegionNeedsBrick(const RenderRegion& rr, const BrickKey& key, const BrickMD& bmd, bool& bIsEmptyButInFrustum) const { if(rr.is2D()) { return rr.GetUseMIP() || std::get<1>(key) == m_pDataset->GetLODLevelCount()-1; } FLOATVECTOR3 vScale(float(m_pDataset->GetScale().x), float(m_pDataset->GetScale().y), float(m_pDataset->GetScale().z)); UINT64VECTOR3 vDomainSize = m_pDataset->GetDomainSize(size_t(m_iCurrentLOD)); FLOATVECTOR3 vDomainSizeCorrectedScale = vScale * FLOATVECTOR3(vDomainSize)/float(vDomainSize.maxVal()); vScale /= vDomainSizeCorrectedScale.maxVal(); Brick b; b.vExtension = bmd.extents * vScale; b.vCenter = bmd.center * vScale; b.vVoxelCount = bmd.n_voxels; // skip the brick if it is outside the current view frustum if (!m_FrustumCullingLOD.IsVisible(b.vCenter, b.vExtension)) { MESSAGE("Outside view frustum, skipping <%u,%u,%u>", static_cast(std::get<0>(key)), static_cast(std::get<1>(key)), static_cast(std::get<2>(key))); return false; } // skip the brick if the clipping plane removes it. if(m_bClipPlaneOn && Clipped(rr, b)) { MESSAGE("clipped by clip plane: skipping <%u,%u,%u>", static_cast(std::get<0>(key)), static_cast(std::get<1>(key)), static_cast(std::get<2>(key))); return false; } // finally, query the data in the brick; if no data can possibly be visible, // don't render this brick. bIsEmptyButInFrustum = !ContainsData(key); MESSAGE("empty but visible: %d", static_cast(bIsEmptyButInFrustum)); return true; } /// @return true if this brick is clipped by a clipping plane. bool AbstrRenderer::Clipped(const RenderRegion& rr, const Brick& b) const { FLOATVECTOR3 vBrickVertices[8] = { b.vCenter + FLOATVECTOR3(-b.vExtension.x,-b.vExtension.y,-b.vExtension.z) * 0.5f, b.vCenter + FLOATVECTOR3(-b.vExtension.x,-b.vExtension.y,+b.vExtension.z) * 0.5f, b.vCenter + FLOATVECTOR3(-b.vExtension.x,+b.vExtension.y,-b.vExtension.z) * 0.5f, b.vCenter + FLOATVECTOR3(-b.vExtension.x,+b.vExtension.y,+b.vExtension.z) * 0.5f, b.vCenter + FLOATVECTOR3(+b.vExtension.x,-b.vExtension.y,-b.vExtension.z) * 0.5f, b.vCenter + FLOATVECTOR3(+b.vExtension.x,-b.vExtension.y,+b.vExtension.z) * 0.5f, b.vCenter + FLOATVECTOR3(+b.vExtension.x,+b.vExtension.y,-b.vExtension.z) * 0.5f, b.vCenter + FLOATVECTOR3(+b.vExtension.x,+b.vExtension.y,+b.vExtension.z) * 0.5f, }; FLOATMATRIX4 matWorld = rr.rotation * rr.translation; // project the 8 corners of the brick. If we find just a single corner // which isn't clipped by our plane, we need this brick. for (size_t i=0; i < 8; i++) { vBrickVertices[i] = (FLOATVECTOR4(vBrickVertices[i],1) * matWorld) .dehomo(); if (!m_ClipPlane.Plane().clip(vBrickVertices[i])) { return false; } } // no corner was found; must be clipped. return true; } // checks if the given brick contains useful data. As one example, a brick // that has data between 608-912 will not be relevant if we are rendering an // isosurface of 42. bool AbstrRenderer::ContainsData(const BrickKey& key) const { if(this->ColorData()) { // We don't have good metadata for color data currently, so it can never be // skipped. return true; } double fMaxValue = (m_pDataset->GetRange().first > m_pDataset->GetRange().second) ? m_p1DTrans->GetSize() : m_pDataset->GetRange().second; double fRescaleFactor = fMaxValue / double(m_p1DTrans->GetSize()-1); bool bContainsData; // render mode dictates how we look at data ... switch (m_eRenderMode) { case RM_1DTRANS: // ... in 1D we only care about the range of data in a brick bContainsData = m_pDataset->ContainsData( key, double(m_p1DTrans->GetNonZeroLimits().x) * fRescaleFactor, double(m_p1DTrans->GetNonZeroLimits().y) * fRescaleFactor ); break; case RM_2DTRANS: // ... in 2D we also need to concern ourselves w/ min/max gradients bContainsData = m_pDataset->ContainsData( key, double(m_p2DTrans->GetNonZeroLimits().x) * fRescaleFactor, double(m_p2DTrans->GetNonZeroLimits().y) * fRescaleFactor, double(m_p2DTrans->GetNonZeroLimits().z), double(m_p2DTrans->GetNonZeroLimits().w) ); break; case RM_ISOSURFACE: // ... and in isosurface mode we only care about a single value. bContainsData = m_pDataset->ContainsData(key, m_fIsovalue); break; default: T_ERROR("Unhandled rendering mode. Skipping brick!"); bContainsData = false; break; } return bContainsData; } vector AbstrRenderer::BuildSubFrameBrickList(bool bUseResidencyAsDistanceCriterion) { vector vBrickList; UINT64VECTOR3 vDomainSize = m_pDataset->GetDomainSize(0); FLOATVECTOR3 vScale(float(m_pDataset->GetScale().x), float(m_pDataset->GetScale().y), float(m_pDataset->GetScale().z)); FLOATVECTOR3 vDomainSizeCorrectedScale = vScale * FLOATVECTOR3(vDomainSize)/ float(vDomainSize.maxVal()); vScale /= vDomainSizeCorrectedScale.maxVal(); MESSAGE("Building active brick list from %u active bricks.", static_cast(m_pDataset->GetBrickCount(size_t(m_iCurrentLOD), m_iTimestep))); BrickTable::const_iterator brick = m_pDataset->BricksBegin(); for(; brick != m_pDataset->BricksEnd(); ++brick) { // skip over the brick if it's for the wrong timestep or LOD if(std::get<0>(brick->first) != m_iTimestep || std::get<1>(brick->first) != m_iCurrentLOD) { continue; } const BrickMD& bmd = brick->second; Brick b; b.vExtension = bmd.extents * vScale; b.vCenter = bmd.center * vScale; b.vVoxelCount = bmd.n_voxels; #ifndef __clang__ b.kBrick = brick->first; #else BrickKey key = brick->first; b.kBrick = key; #endif bool needed = false; for(auto reg = renderRegions.cbegin(); reg != renderRegions.cend(); ++reg) { if(RegionNeedsBrick(**reg, brick->first, brick->second, b.bIsEmpty)) { needed = true; break; } } if(!needed) { MESSAGE("Skipping brick <%u,%u,%u> because it isn't relevant.", static_cast(std::get<0>(brick->first)), static_cast(std::get<1>(brick->first)), static_cast(std::get<2>(brick->first))); continue; } if(b.bIsEmpty) { MESSAGE("Skipping further computations for brick <%u,%u,%u> " "because it is empty/invisible given the current vis parameters," " but we'll keep it in the list in case it overlaps with other " "data (e.g. a mesh)", static_cast(std::get<0>(brick->first)), static_cast(std::get<1>(brick->first)), static_cast(std::get<2>(brick->first))); } else { std::pair vTexcoords = m_pDataset->GetTextCoords(brick, m_bUseOnlyPowerOfTwo); b.vTexcoordsMin = vTexcoords.first; b.vTexcoordsMax = vTexcoords.second; // the depth order doesn't really matter for MIP rotations, // since we need to traverse every brick anyway. So we do a // sort based on which bricks are already resident, to get a // good cache hit rate. if (bUseResidencyAsDistanceCriterion) { if (IsVolumeResident(brick->first)) { b.fDistance = 0; } else { b.fDistance = 1; } } else { // compute minimum distance to brick corners (offset // slightly to the center to resolve ambiguities) // "GetFirst" region: see FIXME below. b.fDistance = brick_distance(b, GetFirst3DRegion()->modelView[0]); } } /* MESSAGE("considering brick <%zu,%zu,%zu>", std::get<0>(brick->first), std::get<1>(brick->first), std::get<2>(brick->first)); */ // add the brick to the list of active bricks vBrickList.push_back(b); } // depth sort bricks /// @todo FIXME?: we need to do smarter sorting. If we've got multiple 3D /// regions, they might need different orderings. However, we want to try to /// traverse bricks in a similar order, because the IO will rape us /// otherwise. /// For now, IV3D doesn't support multiple 3D regions in a single renderer. sort(vBrickList.begin(), vBrickList.end()); return vBrickList; } void AbstrRenderer::GetVolumeAABB(FLOATVECTOR3& vCenter, FLOATVECTOR3& vExtend) const { UINT64VECTOR3 vDomainSize = m_pDataset->GetDomainSize(); FLOATVECTOR3 vScale = FLOATVECTOR3(m_pDataset->GetScale()); vExtend = FLOATVECTOR3(vDomainSize) * vScale; vExtend /= vExtend.maxVal(); vCenter = FLOATVECTOR3(0,0,0); } FLOATVECTOR3 AbstrRenderer::LuaGetVolumeAABBCenter() const { FLOATVECTOR3 vCenter; FLOATVECTOR3 vExtend; GetVolumeAABB(vCenter, vExtend); return vCenter; } FLOATVECTOR3 AbstrRenderer::LuaGetVolumeAABBExtents() const { FLOATVECTOR3 vCenter; FLOATVECTOR3 vExtend; GetVolumeAABB(vCenter, vExtend); return vExtend; } void AbstrRenderer::PlanFrame(RenderRegion3D& region) { m_FrustumCullingLOD.SetViewMatrix(region.modelView[0]); m_FrustumCullingLOD.Update(); // let the mesh know about our current state, technically // SetVolumeAABB only needs to be called when the geometry of volume // has changed (rescale) and SetUserPos only when the view has // changed (matrix update) but the mesh class is smart enough to catch // redundant changes so we just leave the code here for now if (m_bSupportsMeshes) { FLOATVECTOR3 vCenter, vExtend; GetVolumeAABB(vCenter, vExtend); FLOATVECTOR3 vMinPoint = vCenter-vExtend/2.0, vMaxPoint = vCenter+vExtend/2.0; for (vector>::iterator mesh = m_Meshes.begin(); mesh != m_Meshes.end(); mesh++) { if ((*mesh)->GetActive()) { (*mesh)->SetVolumeAABB(vMinPoint, vMaxPoint); (*mesh)->SetUserPos( (FLOATVECTOR4(0,0,0,1)* region.modelView[0].inverse()).xyz() ); } } } // if we found a blank region, we need to reset and do some actual // planning. if(region.isBlank) { // figure out how fine we need to draw the data for the current view // this method takes the size of a voxel in screen space into account ComputeMinLODForCurrentView(); // figure out at what coarse level we need to start for the current view // this method takes the rendermode (capture or not) and the time it took // to render the last subframe into account ComputeMaxLODForCurrentView(); } // plan if the frame is to be redrawn // or if we have completed the last subframe but not the entire frame if (region.isBlank || (m_vCurrentBrickList.size() == m_iBricksRenderedInThisSubFrame)) { bool bBuildNewList = false; if (region.isBlank) { this->decreaseSamplingRateNow = this->decreaseSamplingRate; this->decreaseScreenResNow = this->decreaseScreenRes; bBuildNewList = true; if (this->decreaseSamplingRateNow || this->decreaseScreenResNow) this->doAnotherRedrawDueToLowResOutput = true; } else { if (this->decreaseSamplingRateNow || this->decreaseScreenResNow) { this->decreaseScreenResNow = false; this->decreaseSamplingRateNow = false; m_iBricksRenderedInThisSubFrame = 0; this->doAnotherRedrawDueToLowResOutput = false; } else { if (m_iCurrentLODOffset > m_iMinLODForCurrentView) { bBuildNewList = true; m_iCurrentLODOffset--; } } } if (bBuildNewList) { if(m_eRendererTarget == RT_CAPTURE) { m_iCurrentLOD = 0; } else { m_iCurrentLOD = std::min(m_iCurrentLODOffset, m_pDataset->GetLODLevelCount()-1); } // build new brick todo-list MESSAGE("Building new brick list for LOD %llu...", m_iCurrentLOD); m_vCurrentBrickList = BuildSubFrameBrickList(); MESSAGE("%u bricks made the cut.", uint32_t(m_vCurrentBrickList.size())); if (m_bDoStereoRendering) { m_vLeftEyeBrickList = BuildLeftEyeSubFrameBrickList(region.modelView[1], m_vCurrentBrickList); } m_iBricksRenderedInThisSubFrame = 0; } } if(region.isBlank) { // update frame states m_iIntraFrameCounter = 0; m_iFrameCounter = m_pMasterController->MemMan()->UpdateFrameCounter(); } } void AbstrRenderer::PlanHQMIPFrame(RenderRegion& renderRegion) { // compute modelviewmatrix and pass it to the culling object renderRegion.modelView[0] = renderRegion.rotation*renderRegion.translation*m_mView[0]; m_FrustumCullingLOD.SetPassAll(true); UINTVECTOR3 viVoxelCount = UINTVECTOR3(m_pDataset->GetDomainSize()); m_iCurrentLODOffset = 0; m_iCurrentLOD = 0; if (m_bMIPLOD) { while (viVoxelCount.minVal() >= m_vWinSize.maxVal()) { viVoxelCount /= 2; m_iCurrentLOD++; } } if (m_iCurrentLOD > 0) { m_iCurrentLOD = min(m_pDataset->GetLODLevelCount()-1, m_iCurrentLOD-1); } // build new brick todo-list m_vCurrentBrickList = BuildSubFrameBrickList(true); m_iBricksRenderedInThisSubFrame = 0; // update frame states m_iIntraFrameCounter = 0; m_iFrameCounter = m_pMasterController->MemMan()->UpdateFrameCounter(); } void AbstrRenderer::SetCV(bool bEnable) { if (!SupportsClearView()) bEnable = false; if (m_bDoClearView != bEnable) { m_bDoClearView = bEnable; m_bFirstDrawAfterModeChange = true; if (m_eRenderMode == RM_ISOSURFACE) Schedule3DWindowRedraws(); } } void AbstrRenderer::SetIsosurfaceColor(const FLOATVECTOR3& vColor) { m_vIsoColor = vColor; if (m_eRenderMode == RM_ISOSURFACE) ScheduleRecompose(); } void AbstrRenderer::SetOrthoView(bool bOrthoView) { if (m_bOrthoView != bOrthoView) { m_bOrthoView = bOrthoView; ScheduleCompleteRedraw(); } } void AbstrRenderer::Transfer3DRotationToMIP() { FLOATMATRIX4 rot = GetFirst3DRegion()->rotation; for (size_t i=0; i < renderRegions.size(); ++i) { if (!renderRegions[i]->is3D()) renderRegions[i]->rotation = rot; } } void AbstrRenderer::SetRenderCoordArrows(bool bRenderCoordArrows) { if (m_bRenderCoordArrows != bRenderCoordArrows) { m_bRenderCoordArrows = bRenderCoordArrows; Schedule3DWindowRedraws(); } } void AbstrRenderer::Set2DPlanesIn3DView(bool bRenderPlanesIn3D, RenderRegion *renderRegion) { assert(renderRegion); if (renderRegion) { if (m_bRenderPlanesIn3D != bRenderPlanesIn3D) { m_bRenderPlanesIn3D = bRenderPlanesIn3D; ScheduleWindowRedraw(renderRegion); } } } void AbstrRenderer::LuaSet2DPlanesIn3DView(bool bRenderPlanesIn3D, LuaClassInstance region) { shared_ptr ss = m_pMasterController->LuaScript(); Set2DPlanesIn3DView(bRenderPlanesIn3D,region.getRawPointer(ss)); } void AbstrRenderer::SetCVIsoValue(float fIsovalue) { if (m_fCVIsovalue != fIsovalue) { m_fCVIsovalue = fIsovalue; if (m_bDoClearView && m_eRenderMode == RM_ISOSURFACE) { Schedule3DWindowRedraws(); } std::ostringstream prov; prov << fIsovalue; } } void AbstrRenderer::SetCVColor(const FLOATVECTOR3& vColor) { if (m_vCVColor != vColor) { m_vCVColor = vColor; if (m_bDoClearView && m_eRenderMode == RM_ISOSURFACE) ScheduleRecompose(); } } void AbstrRenderer::SetCVSize(float fSize) { if (m_fCVSize != fSize) { m_fCVSize = fSize; if (m_bDoClearView && m_eRenderMode == RM_ISOSURFACE) ScheduleRecompose(); } } void AbstrRenderer::SetCVContextScale(float fScale) { if (m_fCVContextScale != fScale) { m_fCVContextScale = fScale; if (m_bDoClearView && m_eRenderMode == RM_ISOSURFACE) ScheduleRecompose(); } } void AbstrRenderer::SetCVBorderScale(float fScale) { if (m_fCVBorderScale != fScale) { m_fCVBorderScale = fScale; if (m_bDoClearView && m_eRenderMode == RM_ISOSURFACE) { ScheduleRecompose(); } } } void AbstrRenderer::SetCVFocusPosFVec(const FLOATVECTOR4& vCVPos) { m_vCVMousePos = INTVECTOR2(-1,-1); m_vCVPos = vCVPos; } void AbstrRenderer::SetCVFocusPos(LuaClassInstance renderRegion, const INTVECTOR2& vPos) { if (m_vCVMousePos!= vPos) { m_vCVMousePos = vPos; if (m_bDoClearView && m_eRenderMode == RM_ISOSURFACE) CVFocusHasChanged(renderRegion); } } void AbstrRenderer::SetLogoParams(string strLogoFilename, int iLogoPos) { m_strLogoFilename = strLogoFilename; m_iLogoPos = iLogoPos; } void AbstrRenderer::Set2DFlipMode(RenderRegion *renderRegion, bool flipX, bool flipY) { renderRegion->SetFlipView(flipX, flipY); ScheduleWindowRedraw(renderRegion); } void AbstrRenderer::Get2DFlipMode(const RenderRegion *renderRegion, bool& flipX, bool& flipY) const { renderRegion->GetFlipView(flipX, flipY); } bool AbstrRenderer::GetUseMIP(const RenderRegion *renderRegion) const { return renderRegion->GetUseMIP(); } void AbstrRenderer::SetUseMIP(RenderRegion *renderRegion, bool useMIP) { renderRegion->SetUseMIP(useMIP); ScheduleWindowRedraw(renderRegion); } void AbstrRenderer::SetStereo(bool bStereoRendering) { m_bRequestStereoRendering = bStereoRendering; Schedule3DWindowRedraws(); } void AbstrRenderer::SetStereoEyeDist(float fStereoEyeDist) { m_fStereoEyeDist = fStereoEyeDist; if (m_bDoStereoRendering) Schedule3DWindowRedraws(); } void AbstrRenderer::SetStereoFocalLength(float fStereoFocalLength) { m_fStereoFocalLength = fStereoFocalLength; if (m_bDoStereoRendering) Schedule3DWindowRedraws(); } void AbstrRenderer::SetStereoMode(EStereoMode mode) { m_eStereoMode = mode; if (m_bDoStereoRendering) Schedule3DWindowRedraws(); } void AbstrRenderer::SetStereoEyeSwap(bool bSwap) { m_bStereoEyeSwap = bSwap; if (m_bDoStereoRendering) Schedule3DWindowRedraws(); } void AbstrRenderer::CVFocusHasChanged(LuaClassInstance) { ScheduleRecompose(); } bool AbstrRenderer::ColorData() const { // right now we just look for 4- and 3-component data, and assume all // such data is RGBA... at some point we probably want to add some // sort of query into tuvok::Dataset, so that a file format could // decide whether or not it wants to consider 4-component data to be // RGBA data. return m_pDataset->GetComponentCount() == 4 || m_pDataset->GetComponentCount() == 3; } void AbstrRenderer::SetConsiderPreviousDepthbuffer(bool bConsiderPreviousDepthbuffer) { if (m_bConsiderPreviousDepthbuffer != bConsiderPreviousDepthbuffer) { m_bConsiderPreviousDepthbuffer = bConsiderPreviousDepthbuffer; ScheduleCompleteRedraw(); } } void AbstrRenderer::SetPerfMeasures(uint32_t iMinFramerate, bool bRenderLowResIntermediateResults, float fScreenResDecFactor, float fSampleDecFactor, uint32_t iStartDelay) { m_fMaxMSPerFrame = (iMinFramerate == 0) ? 10000 : 1000.0f / float(iMinFramerate); m_fScreenResDecFactor = fScreenResDecFactor; m_fSampleDecFactor = fSampleDecFactor; m_bRenderLowResIntermediateResults = bRenderLowResIntermediateResults; if (!m_bRenderLowResIntermediateResults) { this->decreaseScreenRes = false; this->decreaseScreenResNow = false; this->decreaseSamplingRate = false; this->decreaseSamplingRateNow = false; this->doAnotherRedrawDueToLowResOutput = false; } m_iStartDelay = iStartDelay; ScheduleCompleteRedraw(); } void AbstrRenderer::SetLODLimits(const UINTVECTOR2 iLODLimits) { m_iLODLimits = iLODLimits; ScheduleCompleteRedraw(); } void AbstrRenderer::SetColors(FLOATVECTOR4 ambient, FLOATVECTOR4 diffuse, FLOATVECTOR4 specular, FLOATVECTOR3 lightDir) { m_cAmbient = ambient; m_cDiffuse = diffuse; m_cSpecular = specular; m_vLightDir = lightDir; UpdateLightParamsInShaders(); if (m_eRenderMode == RM_ISOSURFACE) ScheduleRecompose(); else if (m_bUseLighting) Schedule3DWindowRedraws(); } FLOATVECTOR4 AbstrRenderer::GetAmbient() const { return m_cAmbient; } FLOATVECTOR4 AbstrRenderer::GetDiffuse() const { return m_cDiffuse; } FLOATVECTOR4 AbstrRenderer::GetSpecular()const { return m_cSpecular; } FLOATVECTOR3 AbstrRenderer::GetLightDir()const { return m_vLightDir; } void AbstrRenderer::SetRenderRegions( const std::vector> ®ions ) { this->renderRegions = regions; this->RestartTimers(); this->msecPassedCurrentFrame = -1.0f; } void AbstrRenderer::LuaSetRenderRegions(std::vector regions) { shared_ptr ss = m_pMasterController->LuaScript(); // Generate our own vector of render regions from the provided information. this->renderRegions.clear(); this->renderRegions.reserve(regions.size()); for (std::vector::iterator it = regions.begin(); it != regions.end(); ++it) { std::shared_ptr rr(it->getRawPointer(ss), nonstd::null_deleter() ); this->renderRegions.push_back(rr); } this->RestartTimers(); this->msecPassedCurrentFrame = -1.0f; } std::vector AbstrRenderer::LuaGetRenderRegions() { shared_ptr ss = m_pMasterController->LuaScript(); std::vector ret; ret.reserve(this->renderRegions.size()); for(auto it = this->renderRegions.begin(); it != this->renderRegions.end(); ++it) { ret.push_back(ss->getLuaClassInstance(it->get())); } return ret; } void AbstrRenderer::RemoveMeshData(size_t index) { m_Meshes.erase(m_Meshes.begin()+index); Schedule3DWindowRedraws(); } void AbstrRenderer::ReloadMesh(size_t index, const std::shared_ptr m) { m_Meshes[index]->Clone(m.get()); Schedule3DWindowRedraws(); } void AbstrRenderer::SetTimestep(size_t t) { if(t != m_iTimestep) { m_iTimestep = t; ScheduleCompleteRedraw(); } } size_t AbstrRenderer::Timestep() const { return m_iTimestep; } void AbstrRenderer::SetUserMatrices(const FLOATMATRIX4& view, const FLOATMATRIX4& projection, const FLOATMATRIX4& viewLeft, const FLOATMATRIX4& projectionLeft, const FLOATMATRIX4& viewRight, const FLOATMATRIX4& projectionRight) { m_UserView = view; m_UserProjection = projection; m_UserViewLeft = viewLeft; m_UserProjectionLeft = projectionLeft; m_UserViewRight = viewRight; m_UserProjectionRight = projectionRight; m_bUserMatrices = true; Schedule3DWindowRedraws(); } void AbstrRenderer::UnsetUserMatrices() { m_bUserMatrices = false; Schedule3DWindowRedraws(); } void AbstrRenderer::InitStereoFrame() { m_iAlternatingFrameID = 0; Schedule3DWindowRedraws(); } void AbstrRenderer::ToggleStereoFrame() { m_iAlternatingFrameID = 1-m_iAlternatingFrameID; ScheduleRecompose(); } void AbstrRenderer::SetViewPos(const FLOATVECTOR3& vPos) { m_vAt += vPos-m_vEye; m_vEye = vPos; this->ScheduleCompleteRedraw(); } FLOATVECTOR3 AbstrRenderer::GetViewPos() const { return m_vEye; } void AbstrRenderer::ResetViewPos() { m_vAt = s_vAt; m_vEye = s_vEye; this->ScheduleCompleteRedraw(); } void AbstrRenderer::SetViewDir(const FLOATVECTOR3& vDir) { m_vAt = vDir+m_vEye; this->ScheduleCompleteRedraw(); } FLOATVECTOR3 AbstrRenderer::GetViewDir() const { return (m_vAt-m_vEye).normalized(); } void AbstrRenderer::ResetViewDir() { m_vAt = s_vAt; this->ScheduleCompleteRedraw(); } void AbstrRenderer::SetUpDir(const FLOATVECTOR3& vDir) { m_vUp = vDir; this->ScheduleCompleteRedraw(); } FLOATVECTOR3 AbstrRenderer::GetUpDir() const { return m_vUp.normalized(); } void AbstrRenderer::ResetUpDir() { m_vUp = s_vUp; this->ScheduleCompleteRedraw(); } void AbstrRenderer::CycleDebugViews() { SetDebugView((m_iDebugView + 1) % GetDebugViewCount()); } void AbstrRenderer::SetDebugView(uint32_t iDebugView) { m_iDebugView = iDebugView; this->ScheduleCompleteRedraw(); } uint32_t AbstrRenderer::GetDebugView() const { return m_iDebugView; } uint32_t AbstrRenderer::GetDebugViewCount() const { return 1; } bool AbstrRenderer::Execute(const std::string& strCommand, const std::vector& strParams, std::string& strMessage) { strMessage = ""; std::istringstream is; if(strCommand == "eye") { float x,y,z; if(strParams.size() != 3) { strMessage = "Invalid number of parameters."; return false; } is.str(strParams[0]); is >> x; is.str(strParams[1]); is >> y; is.str(strParams[2]); is >> z; this->SetViewParameters(m_fFOV, m_fZNear, m_fZFar, FLOATVECTOR3(x,y,z), m_vAt, m_vUp); } else if(strCommand == "ref") { float x,y,z; if(strParams.size() != 3) { strMessage = "Invalid number of parameters."; return false; } is.str(strParams[0]); is >> x; is.str(strParams[1]); is >> y; is.str(strParams[2]); is >> z; this->SetViewParameters(m_fFOV, m_fZNear, m_fZFar, m_vEye, FLOATVECTOR3(x,y,z), m_vUp); } else if(strCommand == "vup") { float x,y,z; if(strParams.size() != 3) { strMessage = "Invalid number of parameters."; return false; } is.str(strParams[0]); is >> x; is.str(strParams[1]); is >> y; is.str(strParams[2]); is >> z; this->SetViewParameters(m_fFOV, m_fZNear, m_fZFar, m_vEye, m_vAt, FLOATVECTOR3(x,y,z)); } else { strMessage = "Unhandled command."; return false; } return true; } void AbstrRenderer::SetInterpolant(Interpolant eInterpolant) { if (m_eInterpolant != eInterpolant) { m_eInterpolant = eInterpolant; ScheduleCompleteRedraw(); } } LuaClassInstance AbstrRenderer::LuaGetDataset() { return m_pLuaDataset; } LuaClassInstance AbstrRenderer::LuaGet1DTrans() { return m_pLua1DTrans; } LuaClassInstance AbstrRenderer::LuaGet2DTrans() { return m_pLua2DTrans; } void AbstrRenderer::BrickDebugging(bool b) { this->m_bDebugBricks = b; } void AbstrRenderer::SetFrustumCullingModelMatrix(const FLOATMATRIX4& modelMatrix) { m_FrustumCullingLOD.SetModelMatrix(modelMatrix); } int AbstrRenderer::GetFrustumCullingLODLevel( const FLOATVECTOR3& vfCenter, const FLOATVECTOR3& vfExtent, const UINTVECTOR3& viVoxelCount) const { return m_FrustumCullingLOD.GetLODLevel(vfCenter, vfExtent, viVoxelCount); } void AbstrRenderer::LuaCloneRenderMode(LuaClassInstance inst) { shared_ptr ss(m_pMasterController->LuaScript()); AbstrRenderer* other = inst.getRawPointer(ss); this->SetUseLighting(other->GetUseLighting()); this->SetSampleRateModifier(other->GetSampleRateModifier()); this->SetGlobalBBox(other->GetGlobalBBox()); this->SetLocalBBox(other->GetLocalBBox()); if (other->IsClipPlaneEnabled()) this->EnableClipPlane(); else this->DisableClipPlane(); this->SetIsosurfaceColor(other->GetIsosurfaceColor()); this->SetIsoValue(other->GetIsoValue()); this->SetCVIsoValue(other->GetCVIsoValue()); this->SetCVSize(other->GetCVSize()); this->SetCVContextScale(other->GetCVContextScale()); this->SetCVBorderScale(other->GetCVBorderScale()); this->SetCVColor(other->GetCVColor()); this->SetCV(other->GetCV()); this->SetCVFocusPosFVec(other->GetCVFocusPos()); this->SetInterpolant(other->GetInterpolant()); } void AbstrRenderer::ClearRendererMeshes() { m_Meshes.clear(); } bool AbstrRenderer::CaptureSingleFrame(const std::string&, bool) const { return false; } /// Hacks! These just do nothing. void AbstrRenderer::PH_ClearWorkingSet() { } UINTVECTOR4 AbstrRenderer::PH_RecalculateVisibility() { return UINTVECTOR4(0, 0, 0, 0); } bool AbstrRenderer::PH_Converged() const { AbstrRenderer* ren = const_cast(this); return ren->CheckForRedraw(); } bool AbstrRenderer::PH_OpenBrickAccessLogfile(const std::string&) { return false; } bool AbstrRenderer::PH_CloseBrickAccessLogfile() { return false; } bool AbstrRenderer::PH_OpenLogfile(const std::string&) { return false; } bool AbstrRenderer::PH_CloseLogfile() { return false; } void AbstrRenderer::PH_SetOptimalFrameAverageCount(size_t) { } size_t AbstrRenderer::PH_GetOptimalFrameAverageCount() const { return 0; } bool AbstrRenderer::PH_IsDebugViewAvailable() const { return false; } bool AbstrRenderer::PH_IsWorkingSetTrackerAvailable() const { return false; } std::vector AbstrRenderer::vecRegion(LuaClassInstance c) { std::vector vc(1); vc[0] = c; return vc; } /// sets the current rotation matrix. void AbstrRenderer::SetRotation(const FLOATMATRIX4& rotation) { std::shared_ptr rr = GetFirst3DRegion(); this->SetRotationRR(rr.get(), rotation); } void AbstrRenderer::RegisterLuaFunctions( LuaClassRegistration& reg, AbstrRenderer* me, LuaScripting* ss) { ss->vPrint("Registering abstract renderer functions."); std::string id; id = reg.function(&AbstrRenderer::GetRendererType, "getRendererType", "Retrieves the renderer type.", false); id = reg.function(&AbstrRenderer::GetRendererTarget, "getRendererTarget", "Renderer target specifies the interaction mode. " "The two basic modes are interactive (standard ImageVis3D " "mode), and high quality capture mode.", false); id = reg.function(&AbstrRenderer::SetRendererTarget, "setRendererTarget", "Specifies the renderer target. See getRendererTarget.", true); id = reg.function(&AbstrRenderer::SetViewPos, "setViewPos", "Set the camera's position", true); id = reg.function(&AbstrRenderer::GetViewPos, "getViewPos", "Retrieve the camera's position", false); id = reg.function(&AbstrRenderer::ResetViewPos, "resetViewPos", "Reset the camera's position", false); id = reg.function(&AbstrRenderer::SetViewDir, "setViewDir", "Set the camera's viewing direction", true); id = reg.function(&AbstrRenderer::GetViewDir, "getViewDir", "Retrieve the camera's viewing direction", false); id = reg.function(&AbstrRenderer::ResetViewDir, "resetViewDir", "Reset the camera's direction", false); id = reg.function(&AbstrRenderer::SetUpDir, "setUpDir", "Set the camera's up direction", true); id = reg.function(&AbstrRenderer::GetUpDir, "getUpDir", "Retrieve the camera's up direction", false); id = reg.function(&AbstrRenderer::ResetUpDir, "resetUpDir", "Reset the camera's up direction", false); id = reg.function(&AbstrRenderer::CycleDebugViews, "cycleDebugViews", "Cycle through available debug view modes", true); id = reg.function(&AbstrRenderer::SetDebugView, "setDebugView", "Set whether debug view mode", true); id = reg.function(&AbstrRenderer::GetDebugView, "getDebugView", "Retrieve current debug view mode", true); id = reg.function(&AbstrRenderer::SetRendermode, "setRenderMode", "Set the render mode (1D transfer function, 2D transfer " "function, etc...", true); id = reg.function(&AbstrRenderer::GetRendermode, "getRenderMode", "Returns the renderer mode (1D transfer function, 2D " "transfer function, etc...", false); id = reg.function(&AbstrRenderer::LuaGetDataset, "getDataset", "Retrieves the renderer's current dataset.", false); id = reg.function(&AbstrRenderer::LuaGet1DTrans, "get1DTrans", "", false); id = reg.function(&AbstrRenderer::LuaGet2DTrans, "get2DTrans", "", false); id = reg.function(&AbstrRenderer::SetBackgroundColors, "setBGColors", "Sets the background colors.", true); ss->addParamInfo(id, 0, "topColor", "Top [0,1] RGB color."); ss->addParamInfo(id, 1, "botColor", "Bottom [0,1] RGB color"); id = reg.function(&AbstrRenderer::GetBackgroundColor, "getBackgroundColor", "Retrieves specified background " "color.", false); id = reg.function(&AbstrRenderer::SetTextColor, "setTextColor", "Sets the text color.", true); ss->addParamInfo(id, 0, "textColor", "Text [0,1] RGBA color."); id = reg.function(&AbstrRenderer::SetBlendPrecision, "setBlendPrecision", "Sets the blending precision to 8, 16, or 32 bit.", true); id = reg.function(&AbstrRenderer::SetLogoParams, "setLogoParams", "Sets the filename and position of a logo.", true); ss->addParamInfo(id, 0, "filename", "Filename of the logo."); ss->addParamInfo(id, 1, "pos", "Position of the logo."); id = reg.function(&AbstrRenderer::LuaSetRenderRegions, "setRenderRegions", "Sets regions to render. See tuvok.renderRegion3D " "and tuvok.renderRegion2D.", true); ss->addParamInfo(id, 0, "regionArray", "Render region array."); id = reg.function(&AbstrRenderer::LuaGetRenderRegions, "getRenderRegions", "Retrieves the current render regions.", false); id = reg.function(&AbstrRenderer::LuaGetFirst3DRegion, "getFirst3DRenderRegion", "Retrieves the first 3D render region. A default instance " "is returned if none is found.", false); id = reg.function(&AbstrRenderer::ClipPlaneLocked, "isClipPlaneLocked", "", false); id = reg.function(&AbstrRenderer::ClipPlaneRelativeLock, "setClipPlaneLocked", "Sets relative clip plane lock.", true); id = reg.function(&AbstrRenderer::ClipPlaneEnabled, "isClipPlaneEnabled", "", false); id = reg.function(&AbstrRenderer::ClipPlaneShown, "isClipPlaneShown", "", false); id = reg.function(&AbstrRenderer::SupportsClearView, "supportsClearView", "Returns true if clear view is " "supported by this renderer instance.", false); id = reg.function(&AbstrRenderer::SupportsMeshes, "supportsMeshes", "Returns true if meshes are supported " "by this renderer.", false); id = reg.function(&AbstrRenderer::SetCV, "setClearViewEnabled", "Enables/Disables clear view.", true); id = reg.function(&AbstrRenderer::GetCV, "getClearViewEnabled", "Returns clear view enabled state.", false); id = reg.function(&AbstrRenderer::ClearViewDisableReason, "getClearViewDisabledReason", "", false); id = reg.function(&AbstrRenderer::SetRenderCoordArrows, "setCoordinateArrowsEnabled", "Enables/Disables rendering " "of coordinate axes.", true); id = reg.function(&AbstrRenderer::GetRenderCoordArrows, "getCoordinateArrowsEnabled", "Returns coordinate axes " "enabled state.", false); id = reg.function(&AbstrRenderer::Transfer3DRotationToMIP, "transfer3DRotationToMIP", "Transfers current 3D rotation " "into all 2D render regions. Has the effect of applying " "3D rotation to maximal intensity projection.", true); id = reg.function(&AbstrRenderer::SetMIPRotationAngle, "setMIPRotationAngle", "", true); id = reg.function(&AbstrRenderer::SetMIPLOD, "setMIPLODEnabled", "Enables/Disables MIP LOD.", true); id = reg.function(&AbstrRenderer::LuaSet2DPlanesIn3DView, "set2DPlanesIn3DView", "Adds 2D planes to the 3d view.", true); id = reg.function(&AbstrRenderer::LuaGet2DPlanesIn3DView, "get2DPlanesIn3DView", "Returns 2D planes in 3D view " "enabled state.", false); id = reg.function(&AbstrRenderer::SetStereo, "setStereoEnabled", "Enables/Disables stereo rendering.", true); id = reg.function(&AbstrRenderer::GetStereo, "getStereoEnabled", "Returns stereo enabled state.", false); id = reg.function(&AbstrRenderer::GetStereoEyeDist, "getStereoEyeDist", "", false); id = reg.function(&AbstrRenderer::SetStereoEyeDist, "setStereoEyeDist", "", false); id = reg.function(&AbstrRenderer::GetStereoFocalLength, "getStereoFocalLength", "", false); id = reg.function(&AbstrRenderer::SetStereoFocalLength, "setStereoFocalLength", "", false); id = reg.function(&AbstrRenderer::GetStereoEyeSwap, "getStereoEyeSwap", "", false); id = reg.function(&AbstrRenderer::SetStereoEyeSwap, "setStereoEyeSwap", "", false); id = reg.function(&AbstrRenderer::GetStereoMode, "getStereoMode", "", false); id = reg.function(&AbstrRenderer::SetStereoMode, "setStereoMode", "", false); id = reg.function(&AbstrRenderer::InitStereoFrame, "initStereoFrame", "", false); id = reg.function(&AbstrRenderer::ToggleStereoFrame, "toggleStereoFrame", "", false); id = reg.function(&AbstrRenderer::SetTimeSlice, "setTimeSlice", "", false); id = reg.function(&AbstrRenderer::ScheduleCompleteRedraw, "scheduleCompleteRedraw", "", false); id = reg.function(&AbstrRenderer::CheckForRedraw, "checkForRedraw", "", false); ss->setProvenanceExempt(id); // This function was spamming the prov record. /// @todo This function is deprecated. Just delete the render window that /// created this abstract renderer, or delete the abstract renderer itself. id = reg.function(&AbstrRenderer::Cleanup, "cleanup", "Deallocates GPU memory allocated during the rendering " "process. Should always be called before deleting " "the renderer.", false); /// @todo Pick was not exposed and subsequently removed from IV3D because /// of a discussion I had with Tom. We will need to re-implement it /// correctly. // id = reg.function(&AbstrRenderer::Pick, // "pick", "Obtains an index for the volume element at the " // "specified screen coordinates. Output is printed to " // "the 'Other' debug channel.", false); id = reg.function(&AbstrRenderer::SetPerfMeasures, "setPerfMeasures", "changes how LOD delays, etc.", false); ss->addParamInfo(id, 0, "minFramerate", ""); ss->addParamInfo(id, 1, "renderLowResResults", "If true, renders low " "resolution intermediate results."); ss->addParamInfo(id, 2, "screenResDecFactor", ""); ss->addParamInfo(id, 3, "sampleDecFactor", ""); ss->addParamInfo(id, 4, "startDelay", ""); id = reg.function(&AbstrRenderer::SetOrthoView, "setOrthoViewEnabled", "Enables/Disables orthographic view.", true); id = reg.function(&AbstrRenderer::GetOrthoView, "getOrthoViewEnabled", "Returns orthographic view enabled state.", false); id = reg.function(&AbstrRenderer::LuaCloneRenderMode, "cloneRenderMode", "Clones this renderer's mode from the specified renderer.", true); id = reg.function(&AbstrRenderer::SetUseLighting, "setLightingEnabled", "Enables/Disables lighting.", true); id = reg.function(&AbstrRenderer::GetUseLighting, "getLightingEnabled", "Returns lighting enabled state.", false); id = reg.function(&AbstrRenderer::SetSampleRateModifier, "setSampleRateModifier", "Sets the multiplicator for the sampling rate, e.g. setting it to two will double the samples.", true); id = reg.function(&AbstrRenderer::SetFoV, "setFoV", "Sets the angle/field of view for the virtual camera.", true); id = reg.function(&AbstrRenderer::GetFoV, "getFoV", "Returns the angle/field of view for the virtual camera.", false); id = reg.function(&AbstrRenderer::SetIsoValue, "setIsoValue", "changes the current isovalue", true); id = reg.function(&AbstrRenderer::SetIsoValueRelative, "setIsoValueRelative", "changes isovalue; [0,1] range", true); id = reg.function(&AbstrRenderer::SetIsosurfaceColor, "setIsosurfaceColor", "", true); id = reg.function(&AbstrRenderer::GetIsosurfaceColor, "getIsosurfaceColor", "", false); id = reg.function(&AbstrRenderer::SetCVIsoValue, "setCVIsoValue", "", true); id = reg.function(&AbstrRenderer::GetCVIsoValue, "getCVIsoValue", "", false); id = reg.function(&AbstrRenderer::SetCVSize, "setCVSize", "", true); id = reg.function(&AbstrRenderer::GetCVSize, "getCVSize", "", false); id = reg.function(&AbstrRenderer::SetCVContextScale, "setCVContextScale", "", true); id = reg.function(&AbstrRenderer::GetCVContextScale, "getCVContextScale", "", false); id = reg.function(&AbstrRenderer::SetCVBorderScale, "setCVBorderScale", "", true); id = reg.function(&AbstrRenderer::GetCVBorderScale, "getCVBorderScale", "", false); id = reg.function(&AbstrRenderer::SetCVColor, "setCVColor", "", true); id = reg.function(&AbstrRenderer::GetCVColor, "getCVColor", "", true); id = reg.function(&AbstrRenderer::SetCVFocusPos, "setCVFocusPos", "", true); id = reg.function(&AbstrRenderer::SetTimestep, "setTimestep", "", true); id = reg.function(&AbstrRenderer::SetGlobalBBox, "setGlobalBBox", "", true); id = reg.function(&AbstrRenderer::SetLocalBBox, "setLocalBBox", "", true); id = reg.function(&AbstrRenderer::LuaShowClipPlane, "showClipPlane", "", true); id = reg.function(&AbstrRenderer::GetSize, "getSize", "", false); id = reg.function(&AbstrRenderer::Resize, "resize", "", true); id = reg.function(&AbstrRenderer::Paint, "paint", "", true); id = reg.function(&AbstrRenderer::GetCurrentSubFrameCount, "getCurrentSubFrameCount", "", false); id = reg.function(&AbstrRenderer::GetWorkingSubFrame, "getWorkingSubFrame", "", false); id = reg.function(&AbstrRenderer::GetCurrentBrickCount, "getCurrentBrickCount", "", false); id = reg.function(&AbstrRenderer::GetWorkingBrick, "getWorkingBrick", "", false); id = reg.function(&AbstrRenderer::GetMinLODIndex, "getMinLODIndex", "", false); id = reg.function(&AbstrRenderer::GetMaxLODIndex, "getMaxLODIndex", "", false); id = reg.function(&AbstrRenderer::SetConsiderPreviousDepthbuffer, "setConsiderPrevDepthBuffer", "", true); id = reg.function(&AbstrRenderer::LoadFile, "loadDataset", "", true); id = reg.function(&AbstrRenderer::LoadRebricked, "loadRebricked", "load a rebricked DS", true); id = reg.function(&AbstrRenderer::GetUseOnlyPowerOfTwo, "getUseOnlyPowerOfTwo", "", false); id = reg.function(&AbstrRenderer::GetDownSampleTo8Bits, "getDownSampleTo8Bits", "", false); id = reg.function(&AbstrRenderer::GetDisableBorder, "getDisableBorder", "", false); id = reg.function(&AbstrRenderer::AddShaderPath, "addShaderPath", "", true); id = reg.function(&AbstrRenderer::Initialize, "initialize", "Provenance is NOT recorded for this function. It should " "be called from the renderer initialization code " "(such that all provenance records are " "children of the call to create the new renderer).", false); ss->setProvenanceExempt(id); id = reg.function(&AbstrRenderer::SetLODLimits, "setLODLimits", "", true); id = reg.function(&AbstrRenderer::SetColors, "setLightColors", "", true); id = reg.function(&AbstrRenderer::SetInterpolant, "setInterpolant", "", true); id = reg.function(&AbstrRenderer::GetInterpolant, "getInterpolant", "", false); id = reg.function(&AbstrRenderer::GetAmbient, "getAmbient", "", false); id = reg.function(&AbstrRenderer::GetDiffuse, "getDiffuse", "", false); id = reg.function(&AbstrRenderer::GetSpecular, "getSpecular", "", false); id = reg.function(&AbstrRenderer::GetLightDir, "getLightDir", "", false); id = reg.function(&AbstrRenderer::SetDatasetIsInvalid, "setDatasetIsInvalid", "", true); id = reg.function(&AbstrRenderer::RemoveMeshData, "removeMeshData", "", true); id = reg.function(&AbstrRenderer::ScanForNewMeshes, "scanForNewMeshes", "", true); id = reg.function(&AbstrRenderer::GetMeshes, "getMeshes", "", false); ss->setProvenanceExempt(id); id = reg.function(&AbstrRenderer::ClearRendererMeshes, "clearMeshes", "", true); id = reg.function(&AbstrRenderer::GetSampleRateModifier, "getSampleRateModifier", "", false); id = reg.function(&AbstrRenderer::GetIsoValue, "getIsoValue", "", false); id = reg.function(&AbstrRenderer::GetRescaleFactors, "getRescaleFactors", "", false); id = reg.function(&AbstrRenderer::SetRescaleFactors, "setRescaleFactors", "", false); id = reg.function(&AbstrRenderer::GetGlobalBBox, "getGlobalBBox", "", false); id = reg.function(&AbstrRenderer::GetLocalBBox, "getLocalBBox", "", false); id = reg.function(&AbstrRenderer::Timestep, "getTimestep", "", false); id = reg.function(&AbstrRenderer::GetLODLimits, "getLODLimits", "", false); id = reg.function(&AbstrRenderer::Schedule3DWindowRedraws, "schedule3DWindowRedraws", "", false); id = reg.function(&AbstrRenderer::ReloadMesh, "reloadMesh", "", false); id = reg.function(&AbstrRenderer::LuaGetVolumeAABBCenter, "getVolumeAABBCenter", "", false); id = reg.function(&AbstrRenderer::LuaGetVolumeAABBExtents, "getVolumeAABBExtents", "", false); id = reg.function(&AbstrRenderer::CropDataset, "cropDataset", "", false); id = reg.function(&AbstrRenderer::LuaGetClipPlane, "getClipPlane", "", false); id = reg.function(&AbstrRenderer::FixedFunctionality, "fixedFunctionality", "", false); id = reg.function(&AbstrRenderer::SyncStateManager, "syncStateManager", "", false); id = reg.function(&AbstrRenderer::PH_ClearWorkingSet, "clearWorkingSet", "clears pool data", false); id = reg.function(&AbstrRenderer::PH_RecalculateVisibility, "recalcVisibility", "force to recompute the brick visibility" " synchronously! returns: (totalProcessedBrickCount, " "emptyBrickCount, childEmptyBrickCount, emptyLeafBrickCount)", false); id = reg.function(&AbstrRenderer::PH_Converged, "converged", "checks if rendering converged", false); id = reg.function(&AbstrRenderer::PH_OpenBrickAccessLogfile, "openBALogfile", "opens a new log file where brick access stats will be written to", false); id = reg.function(&AbstrRenderer::PH_CloseBrickAccessLogfile, "closeBALogfile", "closes a open brick access log file", false); id = reg.function(&AbstrRenderer::PH_OpenLogfile, "openLogfile", "opens a new log file where frame stats will be written to", false); id = reg.function(&AbstrRenderer::PH_CloseLogfile, "closeLogfile", "closes a open log file", false); id = reg.function(&AbstrRenderer::PH_SetOptimalFrameAverageCount, "setOptimalFrameAveragingCount", "re-renders the optimal frame", false); id = reg.function(&AbstrRenderer::PH_GetOptimalFrameAverageCount, "getOptimalFrameAveragingCount", "returns the number of frames that get re-rendered", false); id = reg.function(&AbstrRenderer::PH_IsDebugViewAvailable, "isDebugViewAvailable", "checks if debug view can be toggled", false); id = reg.function(&AbstrRenderer::PH_IsWorkingSetTrackerAvailable, "isWorkingSetTrackerAvailable", "checks if working set is being tracked (bad performance)", false); id = reg.function(&AbstrRenderer::GetSubFrameProgress, "getSubFrameProgress", "", false); id = reg.function(&AbstrRenderer::GetFrameProgress, "getFrameProgress", "", false); id = reg.function(&AbstrRenderer::GetProjectionMatrix, "getProjectionMatrix", "", false); id = reg.function(&AbstrRenderer::SetUserMatrices, "setUserMatrices", "", true); id = reg.function(&AbstrRenderer::UnsetUserMatrices, "unsetUserMatrices", "", true); id = reg.function(&AbstrRenderer::SetFrustumCullingModelMatrix, "setFrustumCullingModelMatrix", "", true); id = reg.function(&AbstrRenderer::GetFrustumCullingLODLevel, "getFrustumCullingLODLevel", "", true); id = reg.function(&AbstrRenderer::CaptureSingleFrame, "captureSingleFrame", "Captures current FBO state.", true); reg.function(&AbstrRenderer::vecRegion, "createVecRegion", "creates a " "std::vector from a single LuaClassInstance", true); id = reg.function(&AbstrRenderer::SetRotation, "setRotation", "sets the current rotation matrix", true); ss->addParamInfo(id, 0, "matrix", "4x4 rotation matrix to set"); id = reg.function(&AbstrRenderer::BrickDebugging, "setBrickDebugging", "enables a debug mode in which we write out brick md5sums", true); ss->addParamInfo(id, 0, "boolean", "true to enable, false to disable"); /// Register renderer specific functions. me->RegisterDerivedClassLuaFunctions(reg, ss); } ImageVis3D-3.1.0/Tuvok/Renderer/GL/0000755000175000017500000000000012320456500016435 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/Renderer/GL/GLGridLeaper.h0000644000175000017500000002021312320456500021045 0ustar mathieumathieu#pragma once #ifndef GLGRIDLEAPER_H #define GLGRIDLEAPER_H #include "../../StdTuvokDefines.h" #include "GLGPURayTraverser.h" #include "Renderer/VisibilityState.h" #include "AvgMinMaxTracker.h" // for profiling #include // for Paper Hack file log //#define GLGRIDLEAPER_DEBUGVIEW // define to toggle debug view with 'D'-key //#define GLGRIDLEAPER_WORKINGSET // define to measure per frame working set //#define GLGRIDLEAPER_PROFILE // adds some glFinish() commands all over the place //#define GLGRIDLEAPER_SORT_HT // hack to make layout comparisons fair class ExtendedPlane; namespace tuvok { class GLHashTable; class GLVolumePool; class GLVBO; class LinearIndexDataset; class ShaderDescriptor; /** \class GLGridLeaper * GPU Raycaster. * * GLGridLeaper is a GLSL-based raycaster for volumetric data */ class GLGridLeaper : public GLGPURayTraverser { public: /** Constructs a VRer with immediate redraw, and * wireframe mode off. * \param pMasterController message routing object * \param bUseOnlyPowerOfTwo force power of two textures (compatibility) * \param bDownSampleTo8Bits force 8bit textures (compatibility) */ GLGridLeaper(MasterController* pMasterController, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder); virtual ~GLGridLeaper(); // this is work in progress so before we start we disable all we can virtual bool SupportsClearView() {return false;} virtual void Set1DTrans(const std::vector& rgba); virtual std::string ClearViewDisableReason() const { return "this renderer is work in progress and clearview is simply not implemented yet"; } virtual ERendererType GetRendererType() const {return RT_RC;} bool CheckForRedraw(); virtual void SetInterpolant(Interpolant eInterpolant); virtual uint32_t GetFrameProgress() const { return m_bConverged ? 100 : 1; } virtual uint32_t GetSubFrameProgress() const { return 100; } /// "PH" == "paper hacks". sorry. delete these after pacvis. ///@{ virtual void PH_ClearWorkingSet(); // @return (totalProcessedBrickCount, emptyBrickCount, childEmptyBrickCount, emptyLeafBrickCount) virtual UINTVECTOR4 PH_RecalculateVisibility(); virtual bool PH_Converged() const; virtual bool PH_OpenBrickAccessLogfile(const std::string&); virtual bool PH_CloseBrickAccessLogfile(); virtual bool PH_OpenLogfile(const std::string&); virtual bool PH_CloseLogfile(); virtual void PH_SetOptimalFrameAverageCount(size_t); virtual size_t PH_GetOptimalFrameAverageCount() const; virtual bool PH_IsDebugViewAvailable() const; virtual bool PH_IsWorkingSetTrackerAvailable() const; ///@} virtual void SetDebugView(uint32_t iDebugView); virtual uint32_t GetDebugViewCount() const; protected: GLHashTable* m_pglHashTable; GLVolumePool* m_pVolumePool; std::array m_pFBORayStart; std::array m_pFBORayStartNext; std::array m_pFBOStartColor; std::array m_pFBOStartColorNext; GLSLProgram* m_pProgramRenderFrontFaces; GLSLProgram* m_pProgramRenderFrontFacesNearPlane; GLSLProgram* m_pProgramRayCast1D; GLSLProgram* m_pProgramRayCast1DLighting; GLSLProgram* m_pProgramRayCast2D; GLSLProgram* m_pProgramRayCast2DLighting; GLSLProgram* m_pProgramRayCastISO; GLSLProgram* m_pProgramRayCast1DColor; GLSLProgram* m_pProgramRayCast1DLightingColor; GLSLProgram* m_pProgramRayCast2DColor; GLSLProgram* m_pProgramRayCast2DLightingColor; GLSLProgram* m_pProgramRayCastISOColor; LinearIndexDataset* m_pToCDataset; bool m_bConverged; VisibilityState m_VisibilityState; // profiling uint32_t m_iSubframes; size_t m_iPagedBricks; uint64_t m_iPagedBytes; AvgMinMaxTracker m_FrameTimes; size_t m_iAveragingFrameCount; bool m_bAveragingFrameTimes; std::ofstream* m_pLogFile; std::ofstream* m_pBrickAccess; uint64_t m_iFrameCount; #ifdef GLGRIDLEAPER_DEBUGVIEW GLFBOTex* m_pFBODebug; GLFBOTex* m_pFBODebugNext; #endif #ifdef GLGRIDLEAPER_WORKINGSET GLHashTable* m_pWorkingSetTable; #endif /** Loads GLSL vertex and fragment shaders. */ virtual bool LoadShaders(); /** Deallocates Shaders */ virtual void CleanupShaders(); /** Called once at startup to initialize constant GL data*/ bool Initialize(std::shared_ptr ctx); void InitHashTable(); bool Continue3DDraw(); void Raycast(RenderRegion3D& rr, EStereoID eStereoID); virtual bool Render3DRegion(RenderRegion3D& region3D); void FillRayEntryBuffer(RenderRegion3D& rr, EStereoID eStereoID); virtual void CreateOffscreenBuffers(); FLOATMATRIX4 ComputeEyeToModelMatrix(const RenderRegion &renderRegion, EStereoID eStereoID) const; /** Deallocates GPU memory allocated during the rendering process. */ virtual void Cleanup(); void CleanupHashTable(); bool RegisterDataset(tuvok::Dataset*); bool CreateVolumePool(); uint32_t UpdateToVolumePool(const UINTVECTOR4& brick); uint32_t UpdateToVolumePool(std::vector& hash); // @return (totalProcessedBrickCount, emptyBrickCount, childEmptyBrickCount, emptyLeafBrickCount) UINTVECTOR4 RecomputeBrickVisibility(bool bForceSynchronousUpdate = false); // catch all circumstances that change the visibility of a brick virtual void SetIsoValue(float fIsovalue); virtual void Changed2DTrans(); virtual void Changed1DTrans(); virtual void SetRendermode(AbstrRenderer::ERenderMode eRenderMode); // intercept cliplane changes virtual void SetClipPlane(RenderRegion *renderRegion, const ExtendedPlane& plane); virtual void EnableClipPlane(RenderRegion *renderRegion=NULL); virtual void DisableClipPlane(RenderRegion *renderRegion=NULL); virtual void ClipPlaneRelativeLock(bool); virtual void SetRescaleFactors(const DOUBLEVECTOR3& vfRescale); void FillBBoxVBO(); bool LoadTraversalShaders(const std::vector& vDefines = std::vector()); void CleanupTraversalShaders(); // disable this function, in our implementation parameters are set once // the frame begins virtual void UpdateLightParamsInShaders() {}; bool LoadCheckShader(GLSLProgram** shader, ShaderDescriptor& sd, std::string name); void SetupRaycastShader(GLSLProgram* shaderProgram, RenderRegion3D& rr, EStereoID eStereoID); }; } // tuvok namespace. #endif // GLGRIDLEAPER_H /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLVolume3DTex.h0000644000175000017500000000504312320456500021152 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLVolume3DTex.h \author Jens Krueger DFKI Saarbruecken & SCI Institute University of Utah \date May 2010 */ #pragma once #ifndef GLVOLUME3DTEX_H #define GLVOLUME3DTEX_H #include #include "GLVolume.h" namespace tuvok { class GLTexture3D; /// Controls 3D volume data as a texture. class GLVolume3DTex : public GLVolume { public: GLVolume3DTex(uint32_t iSizeX, uint32_t iSizeY, uint32_t iSizeZ, GLint internalformat, GLenum format, GLenum type, const GLvoid *voxels = 0, GLint iMagFilter = GL_NEAREST, GLint iMinFilter = GL_NEAREST, GLint wrapX = GL_CLAMP_TO_EDGE, GLint wrapY = GL_CLAMP_TO_EDGE, GLint wrapZ = GL_CLAMP_TO_EDGE); GLVolume3DTex(); virtual ~GLVolume3DTex(); virtual void Bind(uint32_t iUnit=0); virtual void SetData(const void *voxels); virtual std::shared_ptr GetData(); virtual uint64_t GetCPUSize() const; virtual uint64_t GetGPUSize() const; virtual void SetFilter(GLint iMagFilter = GL_NEAREST, GLint iMinFilter = GL_NEAREST); private: GLTexture3D* m_pTexture; void FreeGLResources(); }; } #endif // GLVOLUME3DTEX_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLSLProgram.h0000644000175000017500000001322612320456500020703 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLSLProgram.h \author Jens Schneider, Jens Krueger SCI Institute, University of Utah \date October 2008 */ #pragma once #ifndef GLSLPROGRAM_H #define GLSLPROGRAM_H #include "StdTuvokDefines.h" #include #include /// if enabled, GLSL-compiler warnings are treated as errors #define GLSLPROGRAM_STRICT #ifdef _DEBUG #define GLSL_DEBUG 1 #endif /// on windows warn if GLSL_DEBUG differs from _DEBUG (i.e.. if the /// lines above are not used) #ifdef _WIN32 #ifndef _DEBUG #ifdef GLSL_DEBUG #pragma message(" [GLSLProgram.h] DEBUG ON.\n") #endif #else #ifndef GLSL_DEBUG #pragma message(" [GLSLProgram.h] DEBUG OFF.\n") #endif #endif #endif //! Used to specify sources for shaders. /*! \author Jens Schneider \date March 2004 */ typedef enum { GLSLPROGRAM_DISK=0, //!< the shader is a C-string containing the file name. GLSLPROGRAM_STRING /*!< the shader sourcecode is specified directly in the given C-string. */ } GLSLPROGRAM_SOURCE; #include "GLObject.h" #include #include namespace tuvok { class GLTexture; class MasterController; class ShaderDescriptor; typedef std::map texMap; /** * Wrapper for handling OpenGL 2.0 conformant program objects. * \class GLSLProgram * \warning include _before_ you include anything like gl.h, glut.h etc. * \warning requires the GL Extension Wrangler (GLEW) library. * \author Jens Schneider * \date November 2005 */ class GLSLProgram : public GLObject { public: GLSLProgram(MasterController* pMasterController); virtual ~GLSLProgram(); /// Loads a series of shaders. void Load(const ShaderDescriptor& sd); /// Enables this shader for rendering. void Enable(void); /// Disables all shaders for rendering (use fixed function pipeline again) static void Disable(void); /// Returns the handle of this shader. operator GLuint(void) const; /// returns true if this program is valid bool IsValid(void) const; void Set(const char *name, float x) const; void Set(const char *name, float x, float y) const; void Set(const char *name, float x, float y, float z) const; void Set(const char *name, float x, float y, float z, float w) const; void Set(const char *name, const float *m, size_t size, bool bTranspose=false) const; void Set(const char *name, int x) const; void Set(const char *name, int x, int y) const; void Set(const char *name, int x, int y, int z) const; void Set(const char *name, int x, int y, int z, int w) const; void Set(const char *name, const int *m, size_t size, bool bTranspose=false) const; void Set(const char *name, bool x) const; void Set(const char *name, bool x, bool y) const; void Set(const char *name, bool x, bool y, bool z) const; void Set(const char *name, bool x, bool y, bool z, bool w) const; void Set(const char *name, const bool *m, size_t size, bool bTranspose=false) const; /// Sets a texture parameter. void SetTexture(const std::string& name, const GLTexture& pTexture); /// Force a specific name/texID binding void ConnectTextureID(const std::string& name, const int iUnit); /// assume near zero CPU memory cost for shaders to avoid any memory /// manager from paging out shaders, the 1 is basically only to /// detect memory leaks virtual uint64_t GetCPUSize() const {return 1;} /// assume near zero GPU memory cost for shaders to avoid any memory /// manager from paging out shaders, the 1 is basically only to /// detect memory leaks virtual uint64_t GetGPUSize() const {return 1;} private: bool Initialize(void); GLuint LoadShader(const char*, GLenum, GLSLPROGRAM_SOURCE src); bool WriteInfoLog(const char*, GLuint, bool); bool CheckGLError(const char *pcError=NULL, const char *pcAdditional=NULL) const; GLenum get_type(const char *name) const; GLint get_location(const char *name) const; void CheckType(const char *name, GLenum type) const; void CheckSamplerType(const char *name) const; MasterController* m_pMasterController; bool m_bInitialized; bool m_bEnabled; GLuint m_hProgram; static bool m_bGLChecked; static bool m_bGLUseARB; texMap m_mBindings; }; //#ifdef GLSL_ALLOW_IMPLICIT_CASTS //#undef GLSL_ALLOW_IMPLICIT_CASTS //#endif }; #endif // GLSLPROGRAM_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/RenderMeshGL.h0000644000175000017500000000707712320456500021100 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : RenderMeshGL.h //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #pragma once #ifndef TUVOK_RENDERMESHGL_H #define TUVOK_RENDERMESHGL_H #include #include "../RenderMesh.h" #include "GLInclude.h" namespace tuvok { class RenderMeshGL : public RenderMesh { public: RenderMeshGL(const Mesh& other); RenderMeshGL(const VertVec& vertices, const NormVec& normals, const TexCoordVec& texcoords, const ColorVec& colors, const IndexVec& vIndices, const IndexVec& nIndices, const IndexVec& tIndices, const IndexVec& cIndices, bool bBuildKDTree, bool bScaleToUnitCube, const std::string& desc, EMeshType meshType); ~RenderMeshGL(); virtual void InitRenderer(); virtual void RenderOpaqueGeometry(); virtual void RenderTransGeometryFront(); virtual void RenderTransGeometryBehind(); virtual void RenderTransGeometryInside(); virtual void GeometryHasChanged(bool bUpdateAABB, bool bUpdateKDtree); typedef std::array color; /// if on, adds some simple geometry at the location of every vertex. void EnableVertexMarkers(bool b); /// changes the color of the markers used for vertices. void SetVertexMarkerColor(color c); private: bool m_bGLInitialized; enum { POSITION_VBO = 0, NORMAL_VBO, TEXCOORD_VBO, COLOR_VBO, SPHERE_VBO, DATA_VBO_COUNT }; enum { POSITION_INDEX_VBO = 0, NORMAL_INDEX_VBO, TEXCOORD_INDEX_VBO, COLOR_INDEX_VBO, INDEX_VBO_COUNT }; GLuint m_VBOs[DATA_VBO_COUNT]; GLuint m_IndexVBOOpaque; GLuint m_IndexVBOFront; GLuint m_IndexVBOBehind; GLuint m_IndexVBOInside; GLuint m_SpheresVBO; typedef std::array point; typedef std::array triangle; typedef std::array isocahedron; isocahedron m_Isocahedron; bool m_bSpheresEnabled; color m_SphereColor; void PrepareOpaqueBuffers(); void PrepareTransBuffers(GLuint IndexVBO, const SortIndexPVec& list); void RenderGeometry(GLuint IndexVBO, size_t count); void UnrollArrays(); /// generate the geometry for an isocahedron, filling m_Isocahedron. void PrepareIsocahedron(); }; } #endif // TUVOK_RENDERMESHGL_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLTexture3D.h0000644000175000017500000000627012320456500020665 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLTexture3D.h \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #pragma once #ifndef GLTEXTURE3D_H #define GLTEXTURE3D_H #include "../../StdTuvokDefines.h" #include #include "GLTexture.h" #include "../../Basics/Vectors.h" namespace tuvok { class GLTexture3D : public GLTexture { public: GLTexture3D(uint32_t iSizeX, uint32_t iSizeY, uint32_t iSizeZ, GLint internalformat, GLenum format, GLenum type, const GLvoid *pixels = 0, GLint iMagFilter = GL_NEAREST, GLint iMinFilter = GL_NEAREST, GLint wrapX = GL_CLAMP_TO_EDGE, GLint wrapY = GL_CLAMP_TO_EDGE, GLint wrapZ = GL_CLAMP_TO_EDGE); virtual ~GLTexture3D() {} virtual void Bind(uint32_t iUnit=0) const { GLint iPrevUint; GL(glGetIntegerv(GL_ACTIVE_TEXTURE, &iPrevUint)); GL(glActiveTexture(GLenum(GL_TEXTURE0 + iUnit))); GL(glBindTexture(GL_TEXTURE_3D, m_iGLID)); GL(glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, m_iMagFilter)); GL(glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, m_iMinFilter)); GL(glActiveTexture(iPrevUint)); } virtual void SetData(const void *pixels, bool bRestoreBinding=true); void SetData(const UINTVECTOR3& offset, const UINTVECTOR3& size, const void *pixels, bool bRestoreBinding=true); virtual std::shared_ptr GetData(); virtual uint64_t GetCPUSize() const { return uint64_t(m_iSizeX*m_iSizeY*m_iSizeZ*SizePerElement()); } virtual uint64_t GetGPUSize() const { return uint64_t(m_iSizeX*m_iSizeY*m_iSizeZ*SizePerElement()); } UINTVECTOR3 GetSize() const { return UINTVECTOR3(uint32_t(m_iSizeX), uint32_t(m_iSizeY), uint32_t(m_iSizeZ)); } protected: GLuint m_iSizeX; GLuint m_iSizeY; GLuint m_iSizeZ; }; } #endif // GLTEXTURE3D_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLGridLeaper.cpp0000644000175000017500000014075012320456500021411 0ustar mathieumathieu#include "Basics/Clipper.h" #include "Basics/Plane.h" #include "Basics/SysTools.h" // for Paper Hack file log #include "Controller/Controller.h" #include "Controller/StackTimer.h" #include "IO/TransferFunction1D.h" #include "IO/TransferFunction2D.h" #include "IO/FileBackedDataset.h" #include "IO/LinearIndexDataset.h" #include "Renderer/GPUMemMan/GPUMemMan.h" #include "GLFBOTex.h" #include "GLGridLeaper.h" #include "GLHashTable.h" #include "GLInclude.h" #include "GLSLProgram.h" #include "GLTexture1D.h" #include "GLVolumePool.h" #include "GLVBO.h" #ifdef GLGRIDLEAPER_SORT_HT #include "IO/uvfDataset.h" #endif using std::bind; using namespace std::placeholders; using namespace std; using namespace tuvok; GLGridLeaper::GLGridLeaper(MasterController* pMasterController, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder) : GLGPURayTraverser(pMasterController, bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder), m_pglHashTable(NULL), m_pVolumePool(NULL), m_pProgramRenderFrontFaces(NULL), m_pProgramRenderFrontFacesNearPlane(NULL), m_pProgramRayCast1D(NULL), m_pProgramRayCast1DLighting(NULL), m_pProgramRayCast2D(NULL), m_pProgramRayCast2DLighting(NULL), m_pProgramRayCastISO(NULL), m_pProgramRayCast1DColor(NULL), m_pProgramRayCast1DLightingColor(NULL), m_pProgramRayCast2DColor(NULL), m_pProgramRayCast2DLightingColor(NULL), m_pProgramRayCastISOColor(NULL), m_pToCDataset(NULL), m_bConverged(true), m_VisibilityState() , m_iSubframes(0) , m_iPagedBricks(0) , m_iPagedBytes(0) , m_FrameTimes(100) , m_iAveragingFrameCount(0) , m_bAveragingFrameTimes(false) , m_pLogFile(NULL) , m_pBrickAccess(NULL) , m_iFrameCount(0) #ifdef GLGRIDLEAPER_DEBUGVIEW , m_pFBODebug(NULL) , m_pFBODebugNext(NULL) #endif #ifdef GLGRIDLEAPER_WORKINGSET , m_pWorkingSetTable(NULL) #endif { // a member of the parent class, hence it's initialized here m_bSupportsMeshes = false; std::fill(m_pFBOStartColor.begin(), m_pFBOStartColor.end(), (GLFBOTex*)NULL); std::fill(m_pFBOStartColorNext.begin(), m_pFBOStartColorNext.end(), (GLFBOTex*)NULL); std::fill(m_pFBORayStart.begin(), m_pFBORayStart.end(), (GLFBOTex*)NULL); std::fill(m_pFBORayStartNext.begin(), m_pFBORayStartNext.end(), (GLFBOTex*)NULL); } bool GLGridLeaper::CreateVolumePool() { m_pVolumePool = Controller::Instance().MemMan()->GetVolumePool(m_pToCDataset, ComputeGLFilter(), m_pContext->GetShareGroupID() ); if (!m_pVolumePool) return false; // upload a brick that covers the entire domain to make sure have // something to render // find lowest LoD with only a single brick const BrickKey bkey = m_pToCDataset->IndexFrom4D( UINTVECTOR4(0,0,0, uint32_t(m_pToCDataset->GetLargestSingleBrickLOD(m_iTimestep))), m_iTimestep ); m_pVolumePool->UploadFirstBrick(bkey); RecomputeBrickVisibility(); return true; } bool GLGridLeaper::RegisterDataset(Dataset* ds) { if(!AbstrRenderer::RegisterDataset(ds)) { return false; } LinearIndexDataset* pLinDataset = dynamic_cast (m_pDataset); if (!pLinDataset) { T_ERROR("Currently, this renderer works only with linear datasets."); return false; } bool const bReinit = (m_pVolumePool != NULL); if (bReinit) { CleanupTraversalShaders(); Controller::Instance().MemMan()->DeleteVolumePool(&m_pVolumePool); CleanupHashTable(); } m_pToCDataset = pLinDataset; if (bReinit) { m_VisibilityState = VisibilityState(); // reset visibility state to force update InitHashTable(); FillBBoxVBO(); CreateVolumePool(); LoadTraversalShaders(); } return true; } GLGridLeaper::~GLGridLeaper() { PH_CloseLogfile(); PH_CloseBrickAccessLogfile(); } void GLGridLeaper::CleanupShaders() { GLGPURayTraverser::CleanupShaders(); CleanupShader(&m_pProgramRenderFrontFaces); CleanupShader(&m_pProgramRenderFrontFacesNearPlane); CleanupTraversalShaders(); } struct { void operator() (GLFBOTex*& fbo) const { if (fbo){ Controller::Instance().MemMan()->FreeFBO(fbo); fbo = NULL; } } } deleteFBO; void GLGridLeaper::Cleanup() { GLGPURayTraverser::Cleanup(); std::for_each(m_pFBORayStart.begin(), m_pFBORayStart.end(), deleteFBO); std::for_each(m_pFBORayStartNext.begin(), m_pFBORayStartNext.end(), deleteFBO); std::for_each(m_pFBOStartColor.begin(), m_pFBOStartColor.end(), deleteFBO); std::for_each(m_pFBOStartColorNext.begin(), m_pFBOStartColorNext.end(), deleteFBO); #ifdef GLGRIDLEAPER_DEBUGVIEW deleteFBO(m_pFBODebug); deleteFBO(m_pFBODebugNext); #endif CleanupHashTable(); Controller::Instance().MemMan()->DeleteVolumePool(&m_pVolumePool); } void GLGridLeaper::CleanupHashTable() { if (m_pglHashTable) { m_pglHashTable->FreeGL(); delete m_pglHashTable; m_pglHashTable = NULL; } #ifdef GLGRIDLEAPER_WORKINGSET if (m_pWorkingSetTable) { m_pWorkingSetTable->FreeGL(); delete m_pWorkingSetTable; m_pWorkingSetTable = NULL; } #endif } void recreateFBO(GLFBOTex*& fbo, std::shared_ptr pContext, const UINTVECTOR2& ws, GLenum intformat, GLenum format, GLenum type) { if (fbo) Controller::Instance().MemMan()->FreeFBO(fbo); fbo = Controller::Instance().MemMan()->GetFBO(GL_NEAREST, GL_NEAREST, GL_CLAMP, ws.x, ws.y, intformat, format, type, pContext->GetShareGroupID(), false); } void GLGridLeaper::CreateOffscreenBuffers() { GLGPURayTraverser::CreateOffscreenBuffers(); GLenum intformat, type; switch (m_eBlendPrecision) { case BP_8BIT : intformat = GL_RGBA8; type = GL_UNSIGNED_BYTE; break; case BP_16BIT : intformat = m_texFormat16; type = GL_HALF_FLOAT; break; case BP_32BIT : intformat = m_texFormat32; type = GL_FLOAT; break; default : MESSAGE("Invalid Blending Precision"); return; } if (m_vWinSize.area() > 0) { recreateFBO(m_pFBORayStart[0], m_pContext, m_vWinSize, intformat, GL_RGBA, type); recreateFBO(m_pFBORayStart[1], m_pContext, m_vWinSize, intformat, GL_RGBA, type); recreateFBO(m_pFBORayStartNext[0], m_pContext, m_vWinSize, intformat, GL_RGBA, type); recreateFBO(m_pFBORayStartNext[1], m_pContext, m_vWinSize, intformat, GL_RGBA, type); recreateFBO(m_pFBOStartColor[0], m_pContext, m_vWinSize, intformat, GL_RGBA, type); recreateFBO(m_pFBOStartColor[1], m_pContext, m_vWinSize, intformat, GL_RGBA, type); recreateFBO(m_pFBOStartColorNext[0], m_pContext, m_vWinSize, intformat, GL_RGBA, type); recreateFBO(m_pFBOStartColorNext[1], m_pContext, m_vWinSize, intformat, GL_RGBA, type); #ifdef GLGRIDLEAPER_DEBUGVIEW recreateFBO(m_pFBODebug, m_pContext ,m_vWinSize, intformat, GL_RGBA, type); recreateFBO(m_pFBODebugNext, m_pContext ,m_vWinSize, intformat, GL_RGBA, type); #endif } } bool GLGridLeaper::Initialize(std::shared_ptr ctx) { if (!GLGPURayTraverser::Initialize(ctx)) { T_ERROR("Error in parent call -> aborting"); return false; } InitHashTable(); FillBBoxVBO(); if (!CreateVolumePool()) return false; // now that we've created the hashtable and the volume pool // we can load the rest of the shader that depend on those if (!LoadTraversalShaders()) return false; return true; } void GLGridLeaper::InitHashTable() { UINTVECTOR3 const finestBrickLayout(m_pToCDataset->GetBrickLayout(0, 0)); unsigned ht_size = Controller::Const().RState.HashTableSize; if(ht_size == 0) { const float rmax = m_pToCDataset->GetMaxBrickSize().volume() / 32768.; ht_size = std::max(15, static_cast(509 / rmax)); } MESSAGE("Using %u-element hash table.", ht_size); m_pglHashTable = new GLHashTable(finestBrickLayout, uint32_t(ht_size), Controller::Const().RState.RehashCount ); m_pglHashTable->InitGL(); #ifdef GLGRIDLEAPER_WORKINGSET // the HT needs to have the full 4D volume size here in order to guarantee // a 1:1 mapping with the hash function m_pWorkingSetTable = new GLHashTable( finestBrickLayout, finestBrickLayout.volume() * uint32_t(m_pToCDataset->GetLargestSingleBrickLOD(0)) + 1, 0, true, "workingSet" ); m_pWorkingSetTable->InitGL(); #endif } bool GLGridLeaper::LoadCheckShader(GLSLProgram** shader, ShaderDescriptor& sd, std::string name) { MESSAGE("Loading %s shader.", name.c_str()); *shader = m_pMasterController->MemMan()->GetGLSLProgram(sd, m_pContext->GetShareGroupID()); if (!(*shader) || !(*shader)->IsValid()) { Cleanup(); T_ERROR("Error loading %s shader.", name.c_str()); return false; } return true; } static GLVolumePool::MissingBrickStrategy MCStrategyToVPoolStrategy( RendererState::BrickStrategy bs ) { switch(bs) { case RendererState::BS_OnlyNeeded: return GLVolumePool::OnlyNeeded; case RendererState::BS_RequestAll: return GLVolumePool::RequestAll; case RendererState::BS_SkipOneLevel: return GLVolumePool::SkipOneLevel; case RendererState::BS_SkipTwoLevels: return GLVolumePool::SkipTwoLevels; } return GLVolumePool::MissingBrickStrategy(0); } bool GLGridLeaper::LoadTraversalShaders(const std::vector& vDefines) { #ifdef GLGRIDLEAPER_WORKINGSET const std::string infoFragment = m_pWorkingSetTable->GetShaderFragment(7); const std::string poolFragment = m_pVolumePool->GetShaderFragment( 3, 4, MCStrategyToVPoolStrategy(Controller::ConstInstance().RState.BStrategy), m_pWorkingSetTable->GetPrefixName()); #else const std::string poolFragment = m_pVolumePool->GetShaderFragment( 3, 4, MCStrategyToVPoolStrategy(Controller::ConstInstance().RState.BStrategy) ); #endif const std::string hashFragment = m_pglHashTable->GetShaderFragment(5); std::vector vs, fs; vs.push_back(FindFileInDirs("GLGridLeaper-entry-VS.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-blend.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-Method-1D.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("Compositing.glsl", m_vShaderSearchDirs, false)); ShaderDescriptor sd(vs, fs); sd.AddDefines(vDefines); sd.AddFragmentShaderString(poolFragment); sd.AddFragmentShaderString(hashFragment); #ifdef GLGRIDLEAPER_WORKINGSET sd.AddFragmentShaderString(infoFragment); #endif if (!LoadCheckShader(&m_pProgramRayCast1D, sd, "1D TF")) return false; vs.clear(); fs.clear(); vs.push_back(FindFileInDirs("GLGridLeaper-entry-VS.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-blend.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-Method-1D-color.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("Compositing.glsl", m_vShaderSearchDirs, false)); sd = ShaderDescriptor(vs, fs); sd.AddDefines(vDefines); sd.AddFragmentShaderString(poolFragment); sd.AddFragmentShaderString(hashFragment); #ifdef GLGRIDLEAPER_WORKINGSET sd.AddFragmentShaderString(infoFragment); #endif if (!LoadCheckShader(&m_pProgramRayCast1DColor, sd, "Color 1D TF")) return false; vs.clear(); fs.clear(); vs.push_back(FindFileInDirs("GLGridLeaper-entry-VS.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-blend.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-Method-1D-L.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-GradientTools.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("lighting.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("Compositing.glsl", m_vShaderSearchDirs, false)); sd = ShaderDescriptor(vs, fs); sd.AddDefines(vDefines); sd.AddFragmentShaderString(poolFragment); sd.AddFragmentShaderString(hashFragment); #ifdef GLGRIDLEAPER_WORKINGSET sd.AddFragmentShaderString(infoFragment); #endif if (!LoadCheckShader(&m_pProgramRayCast1DLighting, sd, "1D TF lighting")) return false; vs.clear(); fs.clear(); vs.push_back(FindFileInDirs("GLGridLeaper-entry-VS.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-blend.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-Method-1D-L-color.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-GradientTools.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("lighting.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("Compositing.glsl", m_vShaderSearchDirs, false)); sd = ShaderDescriptor(vs, fs); sd.AddDefines(vDefines); sd.AddFragmentShaderString(poolFragment); sd.AddFragmentShaderString(hashFragment); #ifdef GLGRIDLEAPER_WORKINGSET sd.AddFragmentShaderString(infoFragment); #endif if (!LoadCheckShader(&m_pProgramRayCast1DLightingColor, sd, "Color 1D TF lighting")) return false; vs.clear(); fs.clear(); vs.push_back(FindFileInDirs("GLGridLeaper-entry-VS.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-blend.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-Method-2D.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-GradientTools.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("Compositing.glsl", m_vShaderSearchDirs, false)); sd = ShaderDescriptor(vs, fs); sd.AddDefines(vDefines); sd.AddFragmentShaderString(poolFragment); sd.AddFragmentShaderString(hashFragment); #ifdef GLGRIDLEAPER_WORKINGSET sd.AddFragmentShaderString(infoFragment); #endif if (!LoadCheckShader(&m_pProgramRayCast2D, sd, "2D TF")) return false; vs.clear(); fs.clear(); vs.push_back(FindFileInDirs("GLGridLeaper-entry-VS.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-blend.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-Method-2D-color.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-GradientTools.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("Compositing.glsl", m_vShaderSearchDirs, false)); sd = ShaderDescriptor(vs, fs); sd.AddDefines(vDefines); sd.AddFragmentShaderString(poolFragment); sd.AddFragmentShaderString(hashFragment); #ifdef GLGRIDLEAPER_WORKINGSET sd.AddFragmentShaderString(infoFragment); #endif if (!LoadCheckShader(&m_pProgramRayCast2DColor, sd, "Color 2D TF")) return false; vs.clear(); fs.clear(); vs.push_back(FindFileInDirs("GLGridLeaper-entry-VS.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-blend.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-Method-2D-L.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-GradientTools.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("lighting.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("Compositing.glsl", m_vShaderSearchDirs, false)); sd = ShaderDescriptor(vs, fs); sd.AddDefines(vDefines); sd.AddFragmentShaderString(poolFragment); sd.AddFragmentShaderString(hashFragment); #ifdef GLGRIDLEAPER_WORKINGSET sd.AddFragmentShaderString(infoFragment); #endif if (!LoadCheckShader(&m_pProgramRayCast2DLighting, sd, "2D TF lighting")) return false; vs.clear(); fs.clear(); vs.push_back(FindFileInDirs("GLGridLeaper-entry-VS.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-blend.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-Method-2D-L-color.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-GradientTools.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("lighting.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("Compositing.glsl", m_vShaderSearchDirs, false)); sd = ShaderDescriptor(vs, fs); sd.AddDefines(vDefines); sd.AddFragmentShaderString(poolFragment); sd.AddFragmentShaderString(hashFragment); #ifdef GLGRIDLEAPER_WORKINGSET sd.AddFragmentShaderString(infoFragment); #endif if (!LoadCheckShader(&m_pProgramRayCast2DLightingColor, sd, "Color 2D TF lighting")) return false; vs.clear(); fs.clear(); vs.push_back(FindFileInDirs("GLGridLeaper-entry-VS.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-iso.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-Method-iso.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-GradientTools.glsl", m_vShaderSearchDirs, false)); sd = ShaderDescriptor(vs, fs); sd.AddDefines(vDefines); sd.AddFragmentShaderString(poolFragment); sd.AddFragmentShaderString(hashFragment); #ifdef GLGRIDLEAPER_WORKINGSET sd.AddFragmentShaderString(infoFragment); #endif if (!LoadCheckShader(&m_pProgramRayCastISO, sd, "Isosurface")) return false; vs.clear(); fs.clear(); vs.push_back(FindFileInDirs("GLGridLeaper-entry-VS.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-iso.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-Method-iso-color.glsl", m_vShaderSearchDirs, false)); fs.push_back(FindFileInDirs("GLGridLeaper-GradientTools.glsl", m_vShaderSearchDirs, false)); sd = ShaderDescriptor(vs, fs); sd.AddDefines(vDefines); sd.AddFragmentShaderString(poolFragment); sd.AddFragmentShaderString(hashFragment); #ifdef GLGRIDLEAPER_WORKINGSET sd.AddFragmentShaderString(infoFragment); #endif if (!LoadCheckShader(&m_pProgramRayCastISOColor, sd, "Color Isosurface")) return false; return true; } void GLGridLeaper::CleanupTraversalShaders() { CleanupShader(&m_pProgramRayCast1D); CleanupShader(&m_pProgramRayCast1DLighting); CleanupShader(&m_pProgramRayCast2D); CleanupShader(&m_pProgramRayCast2DLighting); CleanupShader(&m_pProgramRayCastISO); CleanupShader(&m_pProgramRayCast1DColor); CleanupShader(&m_pProgramRayCast1DLightingColor); CleanupShader(&m_pProgramRayCast2DColor); CleanupShader(&m_pProgramRayCast2DLightingColor); CleanupShader(&m_pProgramRayCastISOColor); } void GLGridLeaper::SetRescaleFactors(const DOUBLEVECTOR3& vfRescale) { GLGPURayTraverser::SetRescaleFactors(vfRescale); FillBBoxVBO(); } void GLGridLeaper::FillBBoxVBO() { FLOATVECTOR3 vCenter, vExtend; GetVolumeAABB(vCenter, vExtend); FLOATVECTOR3 vMinPoint, vMaxPoint; vMinPoint = (vCenter - vExtend/2.0); vMaxPoint = (vCenter + vExtend/2.0); m_pBBoxVBO = std::shared_ptr(new GLVBO()); std::vector posData; MaxMinBoxToVector(vMinPoint, vMaxPoint, posData); if ( m_bClipPlaneOn ) { // clip plane is normally defined in world space, transform it back to // model space FLOATMATRIX4 inv = (GetFirst3DRegion()->rotation*GetFirst3DRegion()->translation).inverse(); PLANE transformed = m_ClipPlane.Plane() * inv; const FLOATVECTOR3 normal(transformed.xyz().normalized()); const float d = transformed.d(); Clipper::BoxPlane(posData, normal, d); } m_pBBoxVBO->ClearVertexData(); m_pBBoxVBO->AddVertexData(posData); } bool GLGridLeaper::LoadShaders() { if (!GLGPURayTraverser::LoadShaders()) { T_ERROR("Error in parent call -> aborting"); return false; } if(!LoadAndVerifyShader(&m_pProgramRenderFrontFaces, m_vShaderSearchDirs, "GLGridLeaper-entry-VS.glsl", NULL, "GLGridLeaper-frontfaces-FS.glsl", NULL) || !LoadAndVerifyShader(&m_pProgramRenderFrontFacesNearPlane, m_vShaderSearchDirs, "GLGridLeaper-NearPlane-VS.glsl", NULL, "GLGridLeaper-frontfaces-FS.glsl", NULL) ) { Cleanup(); T_ERROR("Error loading a shader."); return false; } return true; } FLOATMATRIX4 GLGridLeaper::ComputeEyeToModelMatrix(const RenderRegion &renderRegion, EStereoID eStereoID) const { FLOATVECTOR3 vCenter, vExtend; GetVolumeAABB(vCenter, vExtend); FLOATMATRIX4 mTrans, mScale, mNormalize; mTrans.Translation(-vCenter); mScale.Scaling(1.0f/vExtend); mNormalize.Translation(0.5f, 0.5f, 0.5f); return renderRegion.modelView[size_t(eStereoID)].inverse() * mTrans * mScale * mNormalize; } bool GLGridLeaper::Continue3DDraw() { return !m_bConverged; } void GLGridLeaper::FillRayEntryBuffer(RenderRegion3D& rr, EStereoID eStereoID) { #ifdef GLGRIDLEAPER_DEBUGVIEW if (m_iDebugView == 2) m_TargetBinder.Bind(m_pFBODebug, m_pFBODebugNext, m_pFBOStartColor[size_t(eStereoID)], m_pFBORayStart[size_t(eStereoID)]); else m_TargetBinder.Bind(m_pFBOStartColor[size_t(eStereoID)], m_pFBORayStart[size_t(eStereoID)]); #else m_TargetBinder.Bind(m_pFBOStartColor[size_t(eStereoID)], m_pFBORayStart[size_t(eStereoID)]); #endif glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); m_TargetBinder.Bind(m_pFBORayStart[size_t(eStereoID)]); // render nearplane into buffer GPUState localState = m_BaseState; localState.enableBlend = false; localState.depthMask = false; localState.enableDepthTest = false; m_pContext->GetStateManager()->Apply(localState); m_pProgramRenderFrontFacesNearPlane->Enable(); m_pProgramRenderFrontFacesNearPlane->Set("mEyeToModel", ComputeEyeToModelMatrix(rr, eStereoID), 4, false); m_pProgramRenderFrontFacesNearPlane->Set("mInvProjection", m_mProjection[size_t(eStereoID)].inverse(), 4, false); m_pNearPlaneQuad->Bind(); m_pNearPlaneQuad->Draw(GL_QUADS); m_pNearPlaneQuad->UnBind(); // render bbox's front faces into buffer m_pContext->GetStateManager()->SetEnableCullFace(true); m_pContext->GetStateManager()->SetCullState(CULL_BACK); m_pProgramRenderFrontFaces->Enable(); m_pProgramRenderFrontFaces->Set("mEyeToModel", ComputeEyeToModelMatrix(rr, eStereoID), 4, false); m_pProgramRenderFrontFaces->Set("mModelView", rr.modelView[size_t(eStereoID)], 4, false); m_pProgramRenderFrontFaces->Set("mModelViewProjection", rr.modelView[size_t(eStereoID)]*m_mProjection[size_t(eStereoID)], 4, false); m_pBBoxVBO->Bind(); m_pBBoxVBO->Draw(GL_TRIANGLES); m_pBBoxVBO->UnBind(); } void GLGridLeaper::SetIsoValue(float fIsovalue) { GLGPURayTraverser::SetIsoValue(fIsovalue); RecomputeBrickVisibility(); } void GLGridLeaper::Changed2DTrans() { GLGPURayTraverser::Changed2DTrans(); RecomputeBrickVisibility(); } void GLGridLeaper::Changed1DTrans() { GLGPURayTraverser::Changed1DTrans(); RecomputeBrickVisibility(); } void GLGridLeaper::Set1DTrans(const std::vector& rgba) { GLGPURayTraverser::Set1DTrans(rgba); RecomputeBrickVisibility(); } void GLGridLeaper::SetRendermode(AbstrRenderer::ERenderMode eRenderMode) { GLGPURayTraverser::SetRendermode(eRenderMode); RecomputeBrickVisibility(); } UINTVECTOR4 GLGridLeaper::RecomputeBrickVisibility(bool bForceSynchronousUpdate) { // (totalProcessedBrickCount, emptyBrickCount, childEmptyBrickCount) UINTVECTOR4 vEmptyBrickCount(0, 0, 0, 0); if (!m_pVolumePool) return vEmptyBrickCount; double const fMaxValue = (m_pDataset->GetRange().first > m_pDataset->GetRange().second) ? m_p1DTrans->GetSize() : m_pDataset->GetRange().second; double const fRescaleFactor = fMaxValue / double(m_p1DTrans->GetSize()-1); // render mode dictates how we look at data ... switch (m_eRenderMode) { case RM_1DTRANS: { double const fMin = double(m_p1DTrans->GetNonZeroLimits().x) * fRescaleFactor; double const fMax = double(m_p1DTrans->GetNonZeroLimits().y) * fRescaleFactor; if (m_VisibilityState.NeedsUpdate(fMin, fMax) || bForceSynchronousUpdate) { vEmptyBrickCount = m_pVolumePool->RecomputeVisibility(m_VisibilityState, m_iTimestep, bForceSynchronousUpdate); } break; } case RM_2DTRANS: { double const fMin = double(m_p2DTrans->GetNonZeroLimits().x) * fRescaleFactor; double const fMax = double(m_p2DTrans->GetNonZeroLimits().y) * fRescaleFactor; double const fMinGradient = double(m_p2DTrans->GetNonZeroLimits().z); double const fMaxGradient = double(m_p2DTrans->GetNonZeroLimits().w); if (m_VisibilityState.NeedsUpdate(fMin, fMax, fMinGradient, fMaxGradient) || bForceSynchronousUpdate) { vEmptyBrickCount = m_pVolumePool->RecomputeVisibility(m_VisibilityState, m_iTimestep, bForceSynchronousUpdate); } break; } case RM_ISOSURFACE: { double const fIsoValue = GetIsoValue(); if (m_VisibilityState.NeedsUpdate(fIsoValue) || bForceSynchronousUpdate) { vEmptyBrickCount = m_pVolumePool->RecomputeVisibility(m_VisibilityState, m_iTimestep, bForceSynchronousUpdate); } break; } default: T_ERROR("Unhandled rendering mode."); break; } return vEmptyBrickCount; } void GLGridLeaper::SetupRaycastShader(GLSLProgram* shaderProgram, RenderRegion3D& rr, EStereoID eStereoID) { UINTVECTOR3 vDomainSize = UINTVECTOR3(m_pToCDataset->GetDomainSize()); FLOATVECTOR3 vScale = FLOATVECTOR3(m_pToCDataset->GetScale()); FLOATVECTOR3 vExtend = FLOATVECTOR3(vDomainSize) * vScale; vExtend /= vExtend.maxVal(); vScale /= vScale.minVal(); FLOATMATRIX4 emm = ComputeEyeToModelMatrix(rr, eStereoID); m_pVolumePool->Enable(m_FrustumCullingLOD.GetLoDFactor(), vExtend, vScale, shaderProgram); // bound to 3 and 4 m_pglHashTable->Enable(); // bound to 5 #ifdef GLGRIDLEAPER_DEBUGVIEW if (m_iDebugView == 2) m_pFBODebug->Read(6); #endif #ifdef GLGRIDLEAPER_WORKINGSET m_pWorkingSetTable->Enable(); // bound to 7 #endif // set shader parameters shaderProgram->Enable(); shaderProgram->Set("sampleRateModifier", m_fSampleRateModifier); shaderProgram->Set("mEyeToModel", emm, 4, false); shaderProgram->Set("mModelView", rr.modelView[size_t(eStereoID)], 4, false); shaderProgram->Set("mModelViewProjection", rr.modelView[size_t(eStereoID)]*m_mProjection[size_t(eStereoID)], 4, false); if (m_eRenderMode == RM_ISOSURFACE) { shaderProgram->Set("fIsoval", static_cast (this->GetNormalizedIsovalue())); FLOATVECTOR3 scale = 1.0f/vScale; shaderProgram->Set("vDomainScale",scale.x,scale.y,scale.z); shaderProgram->Set("mModelToEye",emm.inverse(), 4, false); shaderProgram->Set("mModelViewIT", rr.modelView[size_t(eStereoID)].inverse(), 4, true); } else { float fScale = CalculateScaling(); shaderProgram->Set("fTransScale",fScale); if (m_eRenderMode == RM_2DTRANS) { float fGradientScale = (m_pDataset->MaxGradientMagnitude() == 0) ? 1.0f : 1.0f/m_pDataset->MaxGradientMagnitude(); shaderProgram->Set("fGradientScale",fGradientScale); } if (m_bUseLighting) { FLOATVECTOR3 a = m_cAmbient.xyz()*m_cAmbient.w; FLOATVECTOR3 d = m_cDiffuse.xyz()*m_cDiffuse.w; FLOATVECTOR3 s = m_cSpecular.xyz()*m_cSpecular.w; FLOATVECTOR3 scale = 1.0f/vScale; FLOATVECTOR3 vModelSpaceLightDir = ( FLOATVECTOR4(m_vLightDir,0.0f) * emm ).xyz().normalized(); FLOATVECTOR3 vModelSpaceEyePos = (FLOATVECTOR4(0,0,0,1) * emm).xyz(); shaderProgram->Set("vLightAmbient",a.x,a.y,a.z); shaderProgram->Set("vLightDiffuse",d.x,d.y,d.z); shaderProgram->Set("vLightSpecular",s.x,s.y,s.z); shaderProgram->Set("vModelSpaceLightDir",vModelSpaceLightDir.x,vModelSpaceLightDir.y,vModelSpaceLightDir.z); shaderProgram->Set("vModelSpaceEyePos",vModelSpaceEyePos.x,vModelSpaceEyePos.y,vModelSpaceEyePos.z); shaderProgram->Set("vDomainScale",scale.x,scale.y,scale.z); } } } void GLGridLeaper::Raycast(RenderRegion3D& rr, EStereoID eStereoID) { #ifdef GLGRIDLEAPER_PROFILE GL(glFinish()); #endif StackTimer rendering(PERF_RAYCAST); GLSLProgram* shaderProgram = NULL; switch (m_eRenderMode) { default: if (m_bDoClearView) { // TODO: RM_CLEARVIEW } else { // RM_ISOSURFACE if (this->ColorData()) shaderProgram = m_pProgramRayCastISOColor; else shaderProgram = m_pProgramRayCastISO; } break; case RM_1DTRANS : m_p1DTransTex->Bind(2); if (m_bUseLighting) { if (this->ColorData()) shaderProgram = m_pProgramRayCast1DLightingColor; else shaderProgram = m_pProgramRayCast1DLighting; } else { if (this->ColorData()) shaderProgram = m_pProgramRayCast1DColor; else shaderProgram = m_pProgramRayCast1D; } break; case RM_2DTRANS : m_p2DTransTex->Bind(2); if (m_bUseLighting) { if (this->ColorData()) shaderProgram = m_pProgramRayCast2DLightingColor; else shaderProgram = m_pProgramRayCast2DLighting; } else { if (this->ColorData()) shaderProgram = m_pProgramRayCast2DColor; else shaderProgram = m_pProgramRayCast2D; } break; } SetupRaycastShader(shaderProgram, rr, eStereoID); #ifdef GLGRIDLEAPER_DEBUGVIEW if (m_eRenderMode == RM_ISOSURFACE) { m_TargetBinder.Bind(m_pFBOIsoHit[size_t(eStereoID)], 0, m_pFBOIsoHit[size_t(eStereoID)], 1, m_pFBORayStartNext[size_t(eStereoID)],0, m_pFBOStartColorNext[size_t(eStereoID)],0); } else { if (m_iDebugView == 2) m_TargetBinder.Bind(m_pFBO3DImageNext[size_t(eStereoID)], m_pFBOStartColorNext[size_t(eStereoID)], m_pFBORayStartNext[size_t(eStereoID)], m_pFBODebugNext); else m_TargetBinder.Bind(m_pFBO3DImageNext[size_t(eStereoID)], m_pFBOStartColorNext[size_t(eStereoID)], m_pFBORayStartNext[size_t(eStereoID)]); } #else if (m_eRenderMode == RM_ISOSURFACE) { m_TargetBinder.Bind(m_pFBOIsoHit[size_t(eStereoID)], 0, m_pFBOIsoHit[size_t(eStereoID)], 1, m_pFBORayStartNext[size_t(eStereoID)],0, m_pFBOStartColorNext[size_t(eStereoID)],0); } else { m_TargetBinder.Bind(m_pFBO3DImageNext[size_t(eStereoID)], m_pFBOStartColorNext[size_t(eStereoID)], m_pFBORayStartNext[size_t(eStereoID)]); } #endif m_pFBORayStart[size_t(eStereoID)]->Read(0); m_pFBOStartColor[size_t(eStereoID)]->Read(1); // clear the buffers glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // render the back faces (in this pass we do all the work) m_pContext->GetStateManager()->SetEnableCullFace(true); m_pContext->GetStateManager()->SetCullState(CULL_FRONT); m_pBBoxVBO->Bind(); m_pBBoxVBO->Draw(GL_TRIANGLES); m_pBBoxVBO->UnBind(); m_pVolumePool->Disable(); // unbind input textures m_pFBORayStart[size_t(eStereoID)]->FinishRead(); m_pFBOStartColor[size_t(eStereoID)]->FinishRead(); #ifdef GLGRIDLEAPER_DEBUGVIEW if (m_iDebugView == 2) m_pFBODebug->FinishRead(); #endif // done rendering for now m_TargetBinder.Unbind(); // swap current and next resume color std::swap(m_pFBOStartColorNext[size_t(eStereoID)], m_pFBOStartColor[size_t(eStereoID)]); std::swap(m_pFBORayStartNext[size_t(eStereoID)], m_pFBORayStart[size_t(eStereoID)]); #ifdef GLGRIDLEAPER_DEBUGVIEW if (m_iDebugView == 2) std::swap(m_pFBODebugNext, m_pFBODebug); #endif #ifdef GLGRIDLEAPER_PROFILE GL(glFinish()); #endif } bool GLGridLeaper::CheckForRedraw() { // can't draw to a size zero window. if (m_vWinSize.area() == 0) return false; if (m_bPerformReCompose) return true; // if we have not converged yet redraw immediately // TODO: after finished implementing and debugging // we should be using the m_iCheckCounter here similar // to AbstrRenderer::CheckForRedraw() if (!m_bConverged) return true; for (size_t i=0; i < renderRegions.size(); ++i) { const std::shared_ptr region = renderRegions[i]; if (region->isBlank) return true; } return false; } uint32_t GLGridLeaper::UpdateToVolumePool(const UINTVECTOR4& brick) { std::vector bricks; bricks.push_back(brick); return UpdateToVolumePool(bricks); } uint32_t GLGridLeaper::UpdateToVolumePool(std::vector& hash) { /* // DEBUG Code uint32_t iHQLevel = std::numeric_limits::max(); uint32_t iLQLevel = 0; for (auto missingBrick = hash.begin();missingBrickw, iHQLevel); iLQLevel = std::max(missingBrick->w, iLQLevel); } MESSAGE("Max Quality %i, Min Quality=%i", iHQLevel, iLQLevel); // DEBUG Code End */ return m_pVolumePool->UploadBricks(hash, m_bDebugBricks); } bool GLGridLeaper::Render3DRegion(RenderRegion3D& rr) { tuvok::Controller::Instance().IncrementPerfCounter(PERF_SUBFRAMES, 1.0); #ifdef GLGRIDLEAPER_PROFILE GL(glFinish()); #endif StackTimer overall(PERF_RENDER); glClearColor(0,0,0,0); size_t iStereoBufferCount = (m_bDoStereoRendering) ? 2 : 1; // prepare a new view if (rr.isBlank || m_bAveragingFrameTimes) { if (rr.isBlank) m_bAveragingFrameTimes = false; //OTHER("Preparing new view"); m_iSubframes = 0; m_iPagedBricks = 0; m_iPagedBytes = 0; #ifdef GLGRIDLEAPER_WORKINGSET // clear the info hash table at the beginning of every frame m_pWorkingSetTable->ClearData(); #endif for (size_t i = 0;iClearData(); for (size_t i = 0;iGetStateManager()->Apply(localState); // do raycasting Raycast(rr, EStereoID(i)); } // evaluate hashtable std::vector hash = m_pglHashTable->GetData(); #ifdef GLGRIDLEAPER_SORT_HT { // sort hash table bricks according to their file offsets // in order to guarantee fair layout comparisons StackTimer sorting(PERF_SORT_HTABLE); UVFDataset* pUVFDataset = dynamic_cast(m_pToCDataset); if (pUVFDataset) { std::shared_ptr toc = pUVFDataset->GetTOCBlock(); if (toc) { class Sorter { public: Sorter(std::shared_ptr toc) : m_toc(toc) {} bool operator() (UINTVECTOR4 const& a, UINTVECTOR4 const& b) { UINT64VECTOR4 aa(a); UINT64VECTOR4 bb(b); TOCEntry const& ar = m_toc->GetBrickInfo(aa); TOCEntry const& br = m_toc->GetBrickInfo(bb); return ar.m_iOffset < br.m_iOffset; } private: std::shared_ptr m_toc; }; Sorter brickAccessSorter(toc); std::sort(hash.begin(), hash.end(), brickAccessSorter); } } } #endif // upload missing bricks if (!m_pVolumePool->IsVisibilityUpdated() || !hash.empty()) m_iPagedBricks += UpdateToVolumePool(hash); // conditional measurements if (!hash.empty()) { float const t = float(m_Timer.Elapsed()); if (m_pBrickAccess) { // report used bricks *m_pBrickAccess << " Subframe=" << m_iSubframes; *m_pBrickAccess << " PagedBrickCount=" << hash.size() << std::endl; for (size_t i=0; iGetBitWidth() / 8) * m_pDataset->GetComponentCount(); uint64_t iAccuratePagedInBytes = 0; for (auto pagedInBrick=hash.cbegin(); pagedInBrick!=hash.cend(); pagedInBrick++) { BrickKey const key = m_pToCDataset->IndexFrom4D(*pagedInBrick, 0); UINTVECTOR3 const vVoxels = m_pToCDataset->GetBrickVoxelCounts(key); iAccuratePagedInBytes += vVoxels.volume() * iBytesPerVoxel; } m_iPagedBytes += iAccuratePagedInBytes; } OTHER("subframe %d took %.2f ms and %d bricks were paged in", m_iSubframes, t, m_iPagedBricks); m_iSubframes++; } else { std::stringstream ss; ss << std::fixed << std::setprecision(2); float const fFrameTime = float(m_Timer.Elapsed()); // final frame completed if (m_iAveragingFrameCount) { if (m_iPagedBricks || !m_bAveragingFrameTimes || !m_pVolumePool->IsVisibilityUpdated()) { m_bConverged = false; m_bAveragingFrameTimes = true; m_FrameTimes = AvgMinMaxTracker(m_FrameTimes.GetMaxHistoryLength()); // clear return true; // quick exit to start averaging } } // debug output m_FrameTimes.Push(fFrameTime); ss << "Total frame (with " << m_iSubframes << " subframes) took " << fFrameTime << " ms to render (" << 1000.f / fFrameTime << " FPS) " << " Average of the last " << m_FrameTimes.GetHistroryLength() << " frame times: " << m_FrameTimes.GetAvgMinMax() << " " << " Total paged bricks: " << m_iPagedBricks << " "; bool const bWriteToLogFileForEveryFrame = m_pLogFile && !m_iAveragingFrameCount; if (bWriteToLogFileForEveryFrame) { *m_pLogFile << 1000.f/fFrameTime << ";" // avg FPS << "1;" // avg sample count << fFrameTime << ";" // avg frame time (ms) << fFrameTime << ";" // min frame time (ms) << fFrameTime << ";" // max frame time (ms) << m_iSubframes << ";" // subframe count << m_iPagedBricks << ";" // paged in brick count << m_iPagedBytes / 1024.f / 1024.f << ";"; // paged in memory (MB) } if (m_pBrickAccess) { *m_pBrickAccess << " Frame=" << ++m_iFrameCount; *m_pBrickAccess << " TotalPagedBrickCount=" << m_iPagedBricks; *m_pBrickAccess << " TotalSubframeCount=" << m_iSubframes << std::endl; } #ifdef GLGRIDLEAPER_WORKINGSET std::vector vUsedBricks = m_pWorkingSetTable->GetData(); // compute accurate working set size const uint64_t iBytesPerVoxel = (m_pDataset->GetBitWidth() / 8) * m_pDataset->GetComponentCount(); uint64_t iAccurateGpuWorkingSetBytes = 0; for (auto usedBrick=vUsedBricks.cbegin(); usedBrick!=vUsedBricks.cend(); usedBrick++) { BrickKey const key = m_pToCDataset->IndexFrom4D(*usedBrick, 0); UINTVECTOR3 const vVoxels = m_pToCDataset->GetBrickVoxelCounts(key); iAccurateGpuWorkingSetBytes += vVoxels.volume() * iBytesPerVoxel; } // debug output ss << "Working set bricks for optimal frame: " << vUsedBricks.size() << " (" << iAccurateGpuWorkingSetBytes / 1024.f / 1024.f << " MB)"; if (bWriteToLogFileForEveryFrame) { *m_pLogFile << vUsedBricks.size() << ";" // working set brick count << iAccurateGpuWorkingSetBytes / 1024.f / 1024.f << ";"; // working set memory (MB) } #endif // debug output OTHER("%s", ss.str().c_str()); if (bWriteToLogFileForEveryFrame) { *m_pLogFile << std::endl; } #ifdef GLGRIDLEAPER_DEBUGVIEW if (m_iDebugView == 2) std::swap(m_pFBODebug, m_pFBO3DImageNext[0]); // always use first eye #endif } if (!m_iAveragingFrameCount) { m_bConverged = hash.empty(); m_bAveragingFrameTimes = false; } else { // we want absolute frame times without paging that's why we // re-render a couple of times after we converged and write averaged stats to log file if (m_FrameTimes.GetHistroryLength() >= m_iAveragingFrameCount) { if (m_pLogFile) { *m_pLogFile << 1000.f/m_FrameTimes.GetAvg() << ";" // avg FPS << m_FrameTimes.GetHistroryLength() << ";" // avg sample count << m_FrameTimes.GetAvg() << ";" // avg frame time (ms) << m_FrameTimes.GetMin() << ";" // min frame time (ms) << m_FrameTimes.GetMax() << ";" // max frame time (ms) << m_iSubframes << ";" // subframe count << m_iPagedBricks << ";" // paged in brick count << m_iPagedBytes / 1024.f / 1024.f << ";"; // paged in memory (MB) #ifdef GLGRIDLEAPER_WORKINGSET std::vector vUsedBricks = m_pWorkingSetTable->GetData(); // compute accurate working set size const uint64_t iBytesPerVoxel = (m_pDataset->GetBitWidth() / 8) * m_pDataset->GetComponentCount(); uint64_t iAccurateGpuWorkingSetBytes = 0; for (auto usedBrick=vUsedBricks.cbegin(); usedBrick!=vUsedBricks.cend(); usedBrick++) { BrickKey const key = m_pToCDataset->IndexFrom4D(*usedBrick, 0); UINTVECTOR3 const vVoxels = m_pToCDataset->GetBrickVoxelCounts(key); iAccurateGpuWorkingSetBytes += vVoxels.volume() * iBytesPerVoxel; } *m_pLogFile << vUsedBricks.size() << ";" // working set brick count << iAccurateGpuWorkingSetBytes / 1024.f / 1024.f << ";"; // working set memory (MB) #endif *m_pLogFile << std::endl; } if (m_pBrickAccess) { *m_pBrickAccess << " Frame=" << ++m_iFrameCount; *m_pBrickAccess << " TotalPagedBrickCount=" << m_iPagedBricks; *m_pBrickAccess << " TotalSubframeCount=" << m_iSubframes << std::endl; } m_bConverged = true; m_bAveragingFrameTimes = false; } else { m_bConverged = false; } } if (m_eRenderMode == RM_ISOSURFACE) { for (size_t i = 0;iSetFilterMode(ComputeGLFilter()); } void GLGridLeaper::PH_ClearWorkingSet() { m_pVolumePool->PH_Reset(m_VisibilityState, m_iTimestep); ScheduleWindowRedraw(GetFirst3DRegion().get()); } UINTVECTOR4 GLGridLeaper::PH_RecalculateVisibility() { return RecomputeBrickVisibility(true); } bool GLGridLeaper::PH_Converged() const { return m_bConverged; } bool GLGridLeaper::PH_OpenBrickAccessLogfile(const std::string& filename) { if (m_pBrickAccess) return false; // we already have a file do close and open std::string logFilename = filename; std::string dsName; if (filename.empty()) { try { const FileBackedDataset& ds = dynamic_cast (*m_pToCDataset); dsName = SysTools::RemoveExt(ds.Filename()); logFilename = dsName + "_log.ba"; } catch(const std::bad_cast&) { return false; // we do not know which file to open } } logFilename = SysTools::FindNextSequenceName(logFilename); m_pBrickAccess = new std::ofstream(logFilename); // write header *m_pBrickAccess << std::fixed << std::setprecision(5); if (m_pToCDataset) { *m_pBrickAccess << "Filename=" << dsName << std::endl; *m_pBrickAccess << "MaxBrickSize=" << m_pToCDataset->GetMaxBrickSize() << std::endl; *m_pBrickAccess << "BrickOverlap=" << m_pToCDataset->GetBrickOverlapSize() << std::endl; *m_pBrickAccess << "LoDCount=" << m_pToCDataset->GetLODLevelCount() << std::endl; for (uint64_t lod=0; lod < m_pToCDataset->GetLODLevelCount(); ++lod) { *m_pBrickAccess << " LoD=" << lod; *m_pBrickAccess << " DomainSize=" << m_pToCDataset->GetDomainSize(lod); *m_pBrickAccess << " BrickCount=" << m_pToCDataset->GetBrickLayout(lod, 0); *m_pBrickAccess << std::endl; } } *m_pBrickAccess << std::endl; m_iFrameCount = 0; // single largest brick is always chached, just print it here for completeness *m_pBrickAccess << " Subframe=" << 0; *m_pBrickAccess << " PagedBrickCount=" << 1 << std::endl; *m_pBrickAccess << UINTVECTOR4(0,0,0, uint32_t(m_pToCDataset->GetLargestSingleBrickLOD(m_iTimestep))) << " "; *m_pBrickAccess << std::endl; *m_pBrickAccess << " Frame=" << 0; *m_pBrickAccess << " TotalPagedBrickCount=" << 1; *m_pBrickAccess << " TotalSubframeCount=" << 1 << std::endl; return true; } bool GLGridLeaper::PH_CloseBrickAccessLogfile() { if (m_pBrickAccess) { m_pBrickAccess->close(); delete m_pBrickAccess; m_pBrickAccess = NULL; return true; } else { return false; } } bool GLGridLeaper::PH_OpenLogfile(const std::string& filename) { if (m_pLogFile) return false; // we already have a file do close and open std::string logFilename = filename; if (filename.empty()) { try { const FileBackedDataset& ds = dynamic_cast (*m_pToCDataset); logFilename = SysTools::RemoveExt(ds.Filename()) + "_log.csv"; } catch(const std::bad_cast&) { return false; // we do not know which file to open } } logFilename = SysTools::FindNextSequenceName(logFilename); m_pLogFile = new std::ofstream(logFilename); // write header *m_pLogFile << std::fixed << std::setprecision(5); *m_pLogFile << "avg FPS;" << "avg sample count;" << "avg frame time (ms);" << "min frame time (ms);" << "max frame time (ms);" << "subframe count;" << "paged in brick count;" << "paged in memory (MB);"; #ifdef GLGRIDLEAPER_WORKINGSET *m_pLogFile << "working set brick count;" << "working set memory (MB);"; #endif *m_pLogFile << std::endl; return true; } bool GLGridLeaper::PH_CloseLogfile() { if (m_pLogFile) { m_pLogFile->close(); delete m_pLogFile; m_pLogFile = NULL; return true; } else { return false; } } void GLGridLeaper::PH_SetOptimalFrameAverageCount(size_t iValue) { m_iAveragingFrameCount = iValue; } size_t GLGridLeaper::PH_GetOptimalFrameAverageCount() const { return m_iAveragingFrameCount; } bool GLGridLeaper::PH_IsDebugViewAvailable() const { #ifdef GLGRIDLEAPER_DEBUGVIEW return true; #else return false; #endif } bool GLGridLeaper::PH_IsWorkingSetTrackerAvailable() const { #ifdef GLGRIDLEAPER_WORKINGSET return true; #else return false; #endif } uint32_t GLGridLeaper::GetDebugViewCount() const { #ifdef GLGRIDLEAPER_DEBUGVIEW return 3; #else return 2; #endif } void GLGridLeaper::SetDebugView(uint32_t iDebugView) { // recompile shaders CleanupTraversalShaders(); std::vector vDefines; switch (iDebugView) { case 0: break; // no debug mode case 1: vDefines.push_back("#define COLOR_LODS"); break; default: // should only happen if GLGRIDLEAPER_DEBUGVIEW is defined vDefines.push_back("#define DEBUG"); break; } if (!LoadTraversalShaders(vDefines)) { T_ERROR("could not reload traversal shaders"); } AbstrRenderer::SetDebugView(iDebugView); } void GLGridLeaper::SetClipPlane(RenderRegion *renderRegion, const ExtendedPlane& plane) { GLGPURayTraverser::SetClipPlane(renderRegion, plane); FillBBoxVBO(); } void GLGridLeaper::EnableClipPlane(RenderRegion *renderRegion) { GLGPURayTraverser::EnableClipPlane(renderRegion); FillBBoxVBO(); } void GLGridLeaper::DisableClipPlane(RenderRegion *renderRegion) { GLGPURayTraverser::DisableClipPlane(renderRegion); FillBBoxVBO(); } void GLGridLeaper::ClipPlaneRelativeLock(bool bRelative) { GLGPURayTraverser::ClipPlaneRelativeLock(bRelative); FillBBoxVBO(); } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/Renderer/GL/RenderMeshGL.cpp0000644000175000017500000003077512320456500021434 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : RenderMeshGL.cpp //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #include #include #include #include "RenderMeshGL.h" #include "KDTree.h" using namespace tuvok; RenderMeshGL::RenderMeshGL(const Mesh& other) : RenderMesh(other), m_bGLInitialized(false), m_bSpheresEnabled(false) { UnrollArrays(); m_SphereColor[0] = 1.0; m_SphereColor[1] = m_SphereColor[2] = 0.0; } RenderMeshGL::RenderMeshGL(const VertVec& vertices, const NormVec& normals, const TexCoordVec& texcoords, const ColorVec& colors, const IndexVec& vIndices, const IndexVec& nIndices, const IndexVec& tIndices, const IndexVec& cIndices, bool bBuildKDTree, bool bScaleToUnitCube, const std::string& desc, EMeshType meshType) : RenderMesh(vertices,normals,texcoords,colors, vIndices,nIndices,tIndices,cIndices, bBuildKDTree, bScaleToUnitCube, desc, meshType), m_bGLInitialized(false), m_bSpheresEnabled(false) { UnrollArrays(); m_SphereColor[0] = 1.0; m_SphereColor[1] = m_SphereColor[2] = 0.0; } RenderMeshGL::~RenderMeshGL() { if (m_bGLInitialized) { glDeleteBuffers(DATA_VBO_COUNT, m_VBOs); glDeleteBuffers(1, &m_IndexVBOOpaque); glDeleteBuffers(1, &m_IndexVBOFront); glDeleteBuffers(1, &m_IndexVBOBehind); glDeleteBuffers(1, &m_IndexVBOInside); glDeleteBuffers(1, &m_SpheresVBO); } } void RenderMeshGL::PrepareOpaqueBuffers() { if (m_Data.m_VertIndices.empty()) return; glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_IndexVBOOpaque); glBufferData(GL_ELEMENT_ARRAY_BUFFER, m_splitIndex*sizeof(uint32_t), &m_Data.m_VertIndices[0], GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, m_VBOs[POSITION_VBO]); glBufferData(GL_ARRAY_BUFFER, m_Data.m_vertices.size()*sizeof(float)*3, &m_Data.m_vertices[0], GL_STATIC_DRAW); if (m_Data.m_NormalIndices.size() == m_Data.m_VertIndices.size()) { GL(glBindBuffer(GL_ARRAY_BUFFER, m_VBOs[NORMAL_VBO])); GL(glBufferData(GL_ARRAY_BUFFER, m_Data.m_normals.size()*sizeof(float)*3, &m_Data.m_normals[0], GL_STATIC_DRAW)); } if (m_Data.m_TCIndices.size() == m_Data.m_VertIndices.size()) { glBindBuffer(GL_ARRAY_BUFFER, m_VBOs[TEXCOORD_VBO]); glBufferData(GL_ARRAY_BUFFER, m_Data.m_texcoords.size()*sizeof(float)*2, &m_Data.m_texcoords[0], GL_STATIC_DRAW); } if (m_Data.m_COLIndices.size() == m_Data.m_VertIndices.size()) { glBindBuffer(GL_ARRAY_BUFFER, m_VBOs[COLOR_VBO]); glBufferData(GL_ARRAY_BUFFER, m_Data.m_colors.size()*sizeof(float)*4, &m_Data.m_colors[0], GL_STATIC_DRAW); } // if we are rendering the mesh as a line, we want to put a sphere at each // vertex. generate a VBO for the sphere geometry. if(m_meshType == MT_LINES) { this->PrepareIsocahedron(); GL(glBindBuffer(GL_ARRAY_BUFFER, m_VBOs[SPHERE_VBO])); // assumes m_Isocahedron[0].size() == m_Isocahedron[i].size(), forall i assert(m_Isocahedron[0].size() == m_Isocahedron[1].size()); // etc. GL(glBufferData(GL_ARRAY_BUFFER, m_Isocahedron.size() * m_Isocahedron[0].size() * m_Isocahedron[0][0].size() * sizeof(float), &m_Isocahedron[0], GL_STATIC_DRAW)); } } void RenderMeshGL::RenderGeometry(GLuint IndexVBO, size_t count) { if (!m_bGLInitialized || count == 0) return; GL(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IndexVBO)); GL(glBindBuffer(GL_ARRAY_BUFFER, m_VBOs[POSITION_VBO])); GL(glVertexPointer(3, GL_FLOAT, 0, 0)); GL(glEnableClientState(GL_VERTEX_ARRAY)); if (m_Data.m_NormalIndices.size() == m_Data.m_VertIndices.size()) { GL(glBindBuffer(GL_ARRAY_BUFFER, m_VBOs[NORMAL_VBO])); GL(glNormalPointer(GL_FLOAT, 0, 0)); GL(glEnableClientState(GL_NORMAL_ARRAY)); } else { GL(glNormal3f(2,2,2)); // tells the shader to disable lighting } if (m_Data.m_TCIndices.size() == m_Data.m_VertIndices.size()) { GL(glBindBuffer(GL_ARRAY_BUFFER, m_VBOs[TEXCOORD_VBO])); GL(glTexCoordPointer(2, GL_FLOAT, 0, 0)); GL(glEnableClientState(GL_TEXTURE_COORD_ARRAY)); } else { GL(glTexCoord2f(0,0)); } if (m_Data.m_COLIndices.size() == m_Data.m_VertIndices.size()) { GL(glBindBuffer(GL_ARRAY_BUFFER, m_VBOs[COLOR_VBO])); GL(glColorPointer(4, GL_FLOAT, 0, 0)); GL(glEnableClientState(GL_COLOR_ARRAY)); } else { GL(glColor4f(m_DefColor.x, m_DefColor.y, m_DefColor.z, m_DefColor.w)); } switch (m_meshType) { case MT_LINES : GL(glDrawElements(GL_LINES, GLsizei(count), GL_UNSIGNED_INT, 0)); break; case MT_TRIANGLES: GL(glDrawElements(GL_TRIANGLES, GLsizei(count), GL_UNSIGNED_INT, 0)); break; default : throw std::runtime_error("rendering unsupported mesh type"); } GL(glDisableClientState(GL_VERTEX_ARRAY)); if (m_Data.m_NormalIndices.size() == m_Data.m_VertIndices.size()) glDisableClientState(GL_NORMAL_ARRAY); if (m_Data.m_TCIndices.size() == m_Data.m_VertIndices.size()) glDisableClientState(GL_TEXTURE_COORD_ARRAY); if (m_Data.m_COLIndices.size() == m_Data.m_VertIndices.size()) glDisableClientState(GL_COLOR_ARRAY); } void RenderMeshGL::RenderOpaqueGeometry() { RenderGeometry(m_IndexVBOOpaque, m_splitIndex); if(m_meshType == MT_LINES && m_bSpheresEnabled) { GL(glColor3f(m_SphereColor[0], m_SphereColor[1], m_SphereColor[2])); GL(glEnableClientState(GL_VERTEX_ARRAY)); GL(glDisable(GL_LIGHTING)); GL(glBindBuffer(GL_ARRAY_BUFFER, m_VBOs[SPHERE_VBO])); GL(glVertexPointer(3, GL_FLOAT, 0, 0)); // neat trick: our normals are the same as our vertices! // .. but we don't want these lit. Oh well. //GL(glNormalPointer(GL_FLOAT, 0, 0)); for(VertVec::const_iterator v = this->m_Data.m_vertices.begin(); v != this->m_Data.m_vertices.end(); ++v) { glTranslatef((*v)[0], (*v)[1], (*v)[2]); GL(glDrawArrays(GL_TRIANGLES, 0, GLsizei(m_Isocahedron.size() * m_Isocahedron[0].size() * m_Isocahedron[0][0].size()))); glTranslatef(-(*v)[0], -(*v)[1], -(*v)[2]); } GL(glDisableClientState(GL_VERTEX_ARRAY)); GL(glEnable(GL_LIGHTING)); } } void RenderMeshGL::RenderTransGeometryFront() { PrepareTransBuffers(m_IndexVBOFront, GetFrontPointList(true)); RenderGeometry(m_IndexVBOFront, m_FrontPointList.size()*m_VerticesPerPoly); } void RenderMeshGL::RenderTransGeometryBehind() { PrepareTransBuffers(m_IndexVBOBehind, GetBehindPointList(true)); RenderGeometry(m_IndexVBOBehind, m_BehindPointList.size()*m_VerticesPerPoly); } void RenderMeshGL::RenderTransGeometryInside() { PrepareTransBuffers(m_IndexVBOInside, GetInPointList(true)); RenderGeometry(m_IndexVBOInside, m_InPointList.size()*m_VerticesPerPoly); } void RenderMeshGL::InitRenderer() { m_bGLInitialized = true; glGenBuffers(DATA_VBO_COUNT, m_VBOs); glGenBuffers(1, &m_IndexVBOOpaque); glGenBuffers(1, &m_IndexVBOFront); glGenBuffers(1, &m_IndexVBOBehind); glGenBuffers(1, &m_IndexVBOInside); glGenBuffers(1, &m_SpheresVBO); PrepareOpaqueBuffers(); } void RenderMeshGL::GeometryHasChanged(bool bUpdateAABB, bool bUpdateKDtree) { RenderMesh::GeometryHasChanged(bUpdateAABB, bUpdateKDtree); if (m_bGLInitialized) PrepareOpaqueBuffers(); } void RenderMeshGL::PrepareTransBuffers(GLuint IndexVBO, const SortIndexPVec& list) { if (list.empty()) return; IndexVec VertIndices; VertIndices.reserve(list.size()); for(SortIndexPVec::const_iterator index = list.begin(); index != list.end(); ++index) { size_t iIndex = (*index)->m_index; for(size_t i = 0;iDelete(); throw OUT_OF_MEMORY("allocating 3d texture"); } else if(err != GL_NO_ERROR) { WARNING("Unknown error (%x) occurred while setting 3D texture.", static_cast(err)); } GL(glBindTexture(GL_TEXTURE_3D, prevTex)); } void GLTexture3D::SetData(const UINTVECTOR3& offset, const UINTVECTOR3& size, const void *pixels, bool bRestoreBinding) { GL(glPixelStorei(GL_PACK_ALIGNMENT, 1)); GL(glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); GLint prevTex=0; if (bRestoreBinding) GL(glGetIntegerv(GL_TEXTURE_BINDING_3D, &prevTex)); GL(glBindTexture(GL_TEXTURE_3D, m_iGLID)); GL(glTexSubImage3D(GL_TEXTURE_3D, 0, offset.x, offset.y, offset.z, size.x, size.y, size.z, m_format, m_type, (GLvoid*)pixels)); if (bRestoreBinding && GLuint(prevTex) != m_iGLID) GL(glBindTexture(GL_TEXTURE_3D, prevTex)); } void GLTexture3D::SetData(const void *pixels, bool bRestoreBinding) { GL(glPixelStorei(GL_PACK_ALIGNMENT, 1)); GL(glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); GLint prevTex=0; if (bRestoreBinding) GL(glGetIntegerv(GL_TEXTURE_BINDING_3D, &prevTex)); GL(glBindTexture(GL_TEXTURE_3D, m_iGLID)); glTexImage3D(GL_TEXTURE_3D, 0, m_internalformat, m_iSizeX, m_iSizeY, m_iSizeZ, 0, m_format, m_type, (GLvoid*)pixels); GLenum err = glGetError(); if(err == GL_OUT_OF_MEMORY) { this->Delete(); throw OUT_OF_MEMORY("allocating 3d texture"); } else if(err != GL_NO_ERROR) { WARNING("Unknown error (%x) occurred while setting 3D texture.", static_cast(err)); } if (bRestoreBinding && GLuint(prevTex) != m_iGLID) GL(glBindTexture(GL_TEXTURE_3D, prevTex)); } std::shared_ptr GLTexture3D::GetData() { GL(glPixelStorei(GL_PACK_ALIGNMENT ,1)); GL(glPixelStorei(GL_UNPACK_ALIGNMENT ,1)); GL(glBindTexture(GL_TEXTURE_3D, m_iGLID)); const size_t sz = m_iSizeX * m_iSizeY * m_iSizeZ * SizePerElement(); std::shared_ptr data(new char[sz]); GL(glGetTexImage(GL_TEXTURE_3D, 0, m_format, m_type, data.get())); return data; } ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLTexture.cpp0000644000175000017500000000477012320456500021034 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLTexture.cpp \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #include "GLTexture.h" #include "GLCommon.h" #include #include "GLSLProgram.h" using namespace tuvok; GLTexture::GLTexture(GLint internalformat, GLenum format, GLenum type, GLint iMagFilter, GLint iMinFilter) : m_iGLID(UINT32_INVALID), m_iMagFilter(iMagFilter), m_iMinFilter(iMinFilter), m_internalformat(internalformat), m_format(format), m_type(type) { } GLTexture::~GLTexture() { /*! \todo We'd like to call ::Delete() here, but we're not guaranteed to be * in the correct context. Instead, we'll make sure the texture was * previously Deleted, or at least never initialized. */ assert(m_iGLID == UINT32_INVALID); } void GLTexture::Delete() { glDeleteTextures(1,&m_iGLID); m_iGLID = UINT32_INVALID; } void GLTexture::Bind(GLSLProgram& shader, const std::string& name) const { shader.SetTexture(name, (*this)); } void GLTexture::SetFilter(GLint iMagFilter, GLint iMinFilter) { m_iMagFilter = iMagFilter; m_iMinFilter = iMinFilter; } size_t GLTexture::SizePerElement() const { return GLCommon::gl_byte_width(m_type) * GLCommon::gl_components(m_format); } ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLHashTable.h0000644000175000017500000000465612320456500020677 0ustar mathieumathieu#pragma once #ifndef GLHASHTABLE_H #define GLHASHTABLE_H #include "StdTuvokDefines.h" #include "GLObject.h" #include "Basics/Vectors.h" #include #include //#define GLHASHTABLE_PROFILE // adds some glFinish() commands all over the place namespace tuvok { class GLTexture; class GLHashTable : public GLObject { public: GLHashTable(const UINTVECTOR3& maxBrickCount, uint32_t iTableSize=509, uint32_t iRehashCount=10, bool bUseGLCore=true, std::string const& strPrefixName = ""); virtual ~GLHashTable(); void InitGL(); // might throw void FreeGL(); std::string GetShaderFragment(uint32_t iMountPoint=0); void Enable(); std::vector GetData(); std::string const& GetPrefixName() const { return m_strPrefixName; } void ClearData(); virtual uint64_t GetCPUSize() const; virtual uint64_t GetGPUSize() const; private: std::string m_strPrefixName; UINTVECTOR3 m_maxBrickCount; uint32_t m_iTableSize; uint32_t m_iRehashCount; GLTexture* m_pHashTableTex; UINTVECTOR2 m_texSize; std::shared_ptr m_pRawData; bool m_bUseGLCore; uint32_t m_iMountPoint; UINTVECTOR4 Int2Vector(uint32_t index) const; bool Is2DTexture() const; }; } #endif // GLHASHTABLE_H /* The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group, Saarland University Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLSBVR.h0000644000175000017500000000747512320456500017622 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLSBVR.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date August 2008 */ #pragma once #ifndef GLSBVR_H #define GLSBVR_H #include "../../StdTuvokDefines.h" #include "GLRenderer.h" #include "../SBVRGeogen3D.h" /** \class GLSBVR * Slice-based GPU volume renderer. * * GLSBVR is a slice based volume renderer which uses GLSL. */ namespace tuvok { class GLSBVR : public GLRenderer { public: /** Constructs a VRer with immediate redraw, and * wireframe mode off. * \param pMasterController message routing object * \param bUseOnlyPowerOfTwo force power of two textures (compatibility) * \param bDownSampleTo8Bits force 8bit textures (compatibility) */ GLSBVR(MasterController* pMasterController, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder); virtual ~GLSBVR(); /// registers a dataset to this renderer. this renderer will then handle /// deletion. virtual bool RegisterDataset(tuvok::Dataset*); virtual bool SupportsClearView(){ CheckMeshStatus(); return m_iNumMeshes == 0 && m_pDataset->GetComponentCount() == 1; } virtual std::string ClearViewDisableReason() const { if (m_iNumMeshes > 0) return "geometry is active"; if (m_pDataset->GetComponentCount() != 1) return "this dataset has more than one component"; return ""; } virtual void EnableClipPlane(RenderRegion *renderRegion); virtual void DisableClipPlane(RenderRegion *renderRegion); virtual ERendererType GetRendererType() const {return RT_SBVR;} protected: SBVRGeogen3D m_SBVRGeogen; GLSLProgram* m_pProgram1DTransMesh[2]; GLSLProgram* m_pProgram2DTransMesh[2]; void SetBrickDepShaderVars(const Brick& currentBrick); virtual void Render3DPreLoop(const RenderRegion3D& region); virtual void Render3DInLoop(const RenderRegion3D& renderRegion, size_t iCurrentBrick, EStereoID eStereoID); virtual void RenderHQMIPPreLoop(RenderRegion2D& renderRegion); virtual void RenderHQMIPInLoop(const RenderRegion2D& renderRegion, const Brick& b); void RenderProxyGeometry() const; virtual void CleanupShaders(); virtual void UpdateLightParamsInShaders(); /** Loads GLSL vertex and fragment shaders. */ virtual bool LoadShaders(); virtual void SetDataDepShaderVars(); }; }; #endif // GLSBVR_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLVolume3DTex.cpp0000644000175000017500000000646312320456500021514 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLVolume3DTex.cpp \author Jens Krueger DFKI Saarbruecken & SCI Institute University of Utah \date May 2010 */ #include "GLVolume3DTex.h" #include "GLTexture3D.h" using namespace tuvok; GLVolume3DTex::GLVolume3DTex() : GLVolume(0, 0, 0, 0, 0, 0, NULL, GL_NEAREST, GL_NEAREST, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE), m_pTexture(NULL) { } GLVolume3DTex::GLVolume3DTex(uint32_t iSizeX, uint32_t iSizeY, uint32_t iSizeZ, GLint internalformat, GLenum format, GLenum type, const GLvoid *voxels, GLint iMagFilter, GLint iMinFilter, GLint wrapX, GLint wrapY, GLint wrapZ) : GLVolume(iSizeX, iSizeY, iSizeZ, internalformat, format, type, voxels, iMagFilter, iMinFilter,wrapX, wrapY, wrapZ), m_pTexture(new GLTexture3D(iSizeX, iSizeY, iSizeZ, internalformat, format, type, voxels, iMagFilter, iMinFilter, wrapX, wrapY, wrapZ)) { } GLVolume3DTex::~GLVolume3DTex() { FreeGLResources(); } void GLVolume3DTex::Bind(uint32_t iUnit) { m_pTexture->Bind(iUnit); } void GLVolume3DTex::FreeGLResources() { if (m_pTexture) { m_pTexture->Delete(); delete m_pTexture; } m_pTexture = NULL; } void GLVolume3DTex::SetData(const void *voxels) { if (m_pTexture) m_pTexture->SetData(voxels); } std::shared_ptr GLVolume3DTex::GetData() { if(m_pTexture) { return m_pTexture->GetData(); } return std::shared_ptr(); } uint64_t GLVolume3DTex::GetCPUSize() const { return (m_pTexture) ? m_pTexture->GetCPUSize() : 0; } uint64_t GLVolume3DTex::GetGPUSize() const { return (m_pTexture) ? m_pTexture->GetGPUSize() : 0; } void GLVolume3DTex::SetFilter(GLint iMagFilter, GLint iMinFilter) { GLVolume::SetFilter(iMagFilter, iMinFilter); if (m_pTexture) m_pTexture->SetFilter(m_iMagFilter, m_iMinFilter); } ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLSBVR2D.h0000644000175000017500000001121412320456500017772 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLSBVR2D.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date August 2008 */ #pragma once #ifndef GLSBVR2D_H #define GLSBVR2D_H #include "../../StdTuvokDefines.h" #include "GLRenderer.h" #include "../SBVRGeogen2D.h" namespace tuvok { /** \class GLSBVR2D * Slice-based GPU volume renderer. * * GLSBVR2D is a slice based volume renderer which uses GLSL * and emulates 3D volumes with three stacks of 2D textures. */ class GLSBVR2D : public GLRenderer { public: /** Constructs a VRer with immediate redraw, and * wireframe mode off. * \param pMasterController message routing object * \param bUseOnlyPowerOfTwo force power of two textures (compatibility) * \param bDownSampleTo8Bits force 8bit textures (compatibility) */ GLSBVR2D(MasterController* pMasterController, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder); virtual ~GLSBVR2D(); /// registers a data set with this renderer virtual bool RegisterDataset(tuvok::Dataset*); virtual bool SupportsClearView() { return m_pDataset->GetComponentCount() == 1; } virtual std::string ClearViewDisableReason() const { if (m_pDataset->GetComponentCount() != 1) return "this dataset has more than one component"; return ""; } virtual void EnableClipPlane(RenderRegion *renderRegion); virtual void DisableClipPlane(RenderRegion *renderRegion); virtual ERendererType GetRendererType() const {return RT_SBVR;} bool GetUse3DTexture() const {return m_bUse3DTexture;} void SetUse3DTexture(bool bUse3DTexture); virtual void SetInterpolant(Interpolant eInterpolant); protected: SBVRGeogen2D m_SBVRGeogen; bool m_bUse3DTexture; void SetBrickDepShaderVars(const RenderRegion3D& region, const Brick& currentBrick); virtual void Render3DPreLoop(const RenderRegion3D& region); virtual void Render3DInLoop(const RenderRegion3D& renderRegion, size_t iCurrentBrick, EStereoID eStereoID); virtual void RenderHQMIPPreLoop(RenderRegion2D& region); virtual void RenderHQMIPInLoop(const RenderRegion2D& region, const Brick& b); void RenderProxyGeometry() const; void RenderProxyGeometry2D() const; void RenderProxyGeometry3D() const; virtual void CleanupShaders(); virtual void ComposeSurfaceImage(const RenderRegion& renderRegion, EStereoID eStereoID); virtual void UpdateLightParamsInShaders(); virtual bool BindVolumeTex(const BrickKey& bkey, const uint64_t iIntraFrameCounter); virtual bool IsVolumeResident(const BrickKey& key) const; virtual void RenderSlice(const RenderRegion2D& region, double fSliceIndex, FLOATVECTOR3 vMinCoords, FLOATVECTOR3 vMaxCoords, DOUBLEVECTOR3 vAspectRatio, DOUBLEVECTOR2 vWinAspectRatio); /** Loads GLSL vertex and fragment shaders. */ virtual bool LoadShaders(); virtual void SetDataDepShaderVars(); private: void BindVolumeStringsToTexUnit(GLSLProgram* program, bool bGradients=true); }; } // tuvok namespace #endif // GLSBVR2D_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLFrameCapture.h0000644000175000017500000000402112320456500021404 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLFrameCapture.h \author Jens Krueger SCI Institute University of Utah \date November 2008 */ #pragma once #ifndef GLFRAMECAPTURE_H #define GLFRAMECAPTURE_H #include "../../StdTuvokDefines.h" #include #include "../FrameCapture.h" namespace tuvok { class GLFBOTex; class GLFrameCapture : public FrameCapture { public: GLFrameCapture() : FrameCapture() {} virtual ~GLFrameCapture() {} virtual bool CaptureSingleFrame(const std::string& strFilename, bool bPreserveTransparency) const; virtual bool CaptureSingleFrame(const std::string& filename, GLFBOTex* from, bool transparency=false) const; }; } #endif // GLFRAMECAPTURE_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLGPURayTraverser.h0000644000175000017500000000473712320456500022051 0ustar mathieumathieu#pragma once #ifndef GLGPURAYTRAVERSER_H #define GLGPURAYTRAVERSER_H #include "../../StdTuvokDefines.h" #include "GLRenderer.h" class ExtendedPlane; namespace tuvok { class GLVBO; /** \class GLGPURayTraverser * GPU Raycaster. * * GLGPURayTraverser is a GLSL-based raycaster for volumetric data */ class GLGPURayTraverser : public GLRenderer { public: /** Constructs a VRer with immediate redraw, and * wireframe mode off. * \param pMasterController message routing object * \param bUseOnlyPowerOfTwo force power of two textures (compatibility) * \param bDownSampleTo8Bits force 8bit textures (compatibility) */ GLGPURayTraverser(MasterController* pMasterController, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder); virtual ~GLGPURayTraverser() {} protected: GLVBO* m_pNearPlaneQuad; std::shared_ptr m_pBBoxVBO; /** Deallocates GPU memory allocated during the rendering process. */ virtual void Cleanup(); /** Called once at startup to initialize constant GL data*/ bool Initialize(std::shared_ptr ctx); }; } // tuvok namespace. #endif // GLGPURAYTRAVERSER_H /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLCommon.cpp0000644000175000017500000001216512320456500020621 0ustar mathieumathieu#include "StdTuvokDefines.h" #include #include #include "GLCommon.h" using namespace GLCommon; size_t GLCommon::gl_internal_bit_size(GLenum internalformat) { switch(internalformat) { // deprecated formats, assume 8bit per component case GL_INTENSITY: return 8; case GL_LUMINANCE: return 8; case GL_RGB: return 3*8; case GL_RGBA: return 4*8; case GL_ALPHA : return 8; case GL_INTENSITY4: case GL_LUMINANCE4 : case GL_ALPHA4 : return 4; case GL_INTENSITY8: case GL_LUMINANCE6_ALPHA2: case GL_LUMINANCE4_ALPHA4: case GL_LUMINANCE8: case GL_ALPHA8 : case GL_R8I : case GL_R8UI : case GL_RGBA2 : case GL_R3_G3_B2 : case GL_R8_SNORM : case GL_R8 : return 8; case GL_INTENSITY12: case GL_LUMINANCE12: case GL_ALPHA12 : case GL_RGB4 : return 12; case GL_RGB5 : return 15; case GL_INTENSITY16 : case GL_LUMINANCE12_ALPHA4: case GL_LUMINANCE_ALPHA: case GL_LUMINANCE8_ALPHA8: case GL_LUMINANCE16: case GL_DEPTH_COMPONENT16: case GL_ALPHA16 : case GL_RG8I : case GL_RG8UI : case GL_R16I : case GL_R16UI : case GL_R16F : case GL_RGB5_A1 : case GL_RGBA4 : case GL_RG8 : case GL_RG8_SNORM : case GL_R16_SNORM : case GL_R16 : return 16; case GL_LUMINANCE12_ALPHA12: case GL_DEPTH_COMPONENT24 : case GL_RGB8I : case GL_RGB8UI : case GL_SRGB8 : case GL_RGB8_SNORM : case GL_RGB8 : return 24; case GL_RGB10 : return 30; case GL_LUMINANCE16_ALPHA16: case GL_DEPTH_COMPONENT32: case GL_RGBA8I : case GL_RGBA8UI : case GL_RG16I : case GL_RG16UI : case GL_R32I : case GL_R32UI : case GL_RGB9_E5 : case GL_R11F_G11F_B10F : case GL_R32F : case GL_RG16F : case GL_SRGB8_ALPHA8 : case GL_RGB10_A2UI : case GL_RGB10_A2 : case GL_RGBA8 : case GL_RGBA8_SNORM : case GL_RG16 : case GL_RG16_SNORM : return 32; case GL_RGB12 : return 36; case GL_RGB16I : case GL_RGB16UI : case GL_RGB16F : case GL_RGBA12 : case GL_RGB16 : case GL_RGB16_SNORM : return 48; case GL_RGBA16I : case GL_RGBA16UI : case GL_RG32I : case GL_RG32UI : case GL_RG32F : case GL_RGBA16F : case GL_RGBA16 : return 64; case GL_RGB32I : case GL_RGB32UI : case GL_RGB32F : return 96; case GL_RGBA32I : case GL_RGBA32UI : case GL_RGBA32F : return 128; } // unnsuported formats // GL_COMPRESSED_ALPHA, GL_COMPRESSED_LUMINANCE, GL_COMPRESSED_LUMINANCE_ALPHA, GL_COMPRESSED_INTENSITY, GL_COMPRESSED_RGB, GL_COMPRESSED_RGBA throw std::domain_error("unknown GL format"); } size_t GLCommon::gl_components(GLenum format) { switch(format) { case GL_RED_INTEGER: case GL_GREEN_INTEGER: case GL_BLUE_INTEGER: case GL_ALPHA_INTEGER: case GL_RED: case GL_GREEN: case GL_BLUE: case GL_LUMINANCE: case GL_ALPHA: return 1; case GL_LUMINANCE_ALPHA: return 2; case GL_RGB: case GL_BGR: return 3; case GL_RGBA: case GL_BGRA: return 4; } throw std::domain_error("unknown GL format"); } size_t GLCommon::gl_byte_width(GLenum gltype) { switch(gltype) { case GL_UNSIGNED_BYTE: case GL_BYTE: case GL_UNSIGNED_BYTE_3_3_2: case GL_UNSIGNED_BYTE_2_3_3_REV: case GL_BITMAP: return 1; case GL_HALF_FLOAT: case GL_UNSIGNED_SHORT: case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_5_6_5_REV: case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_4_4_4_4_REV: case GL_UNSIGNED_SHORT_5_5_5_1: case GL_UNSIGNED_SHORT_1_5_5_5_REV: case GL_SHORT: return 2; case GL_UNSIGNED_INT: case GL_INT: case GL_FLOAT: case GL_UNSIGNED_INT_8_8_8_8: case GL_UNSIGNED_INT_8_8_8_8_REV: case GL_UNSIGNED_INT_10_10_10_2: case GL_UNSIGNED_INT_2_10_10_10_REV: return 4; break; } throw std::domain_error("unknown GL type"); } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLRenderer.h0000644000175000017500000002534112320456500020604 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLRenderer.h \author Jens Krueger SCI Institute University of Utah */ #pragma once #ifndef GLRENDERER_H #define GLRENDERER_H #include #include #include "StdTuvokDefines.h" #include "Basics/Timer.h" #include "Renderer/AbstrRenderer.h" #include "GLTargetBinder.h" #include "GLStateManager.h" #include "GLFrameCapture.h" #include "RenderMeshGL.h" namespace tuvok { class MasterController; class GLTexture1D; class GLTexture2D; class GLVolume; class GLSLProgram; class GLRenderer : public AbstrRenderer { public: /** Constructs a VRer * \param pMasterController message routing object * \param bUseOnlyPowerOfTwo force power of two textures (compatibility) * \param bDownSampleTo8Bits force 8bit textures (compatibility) */ GLRenderer(MasterController* pMasterController, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder); virtual ~GLRenderer(); virtual bool Initialize(std::shared_ptr ctx); virtual void Set1DTrans(const std::vector& rgba); virtual void Changed1DTrans(); virtual void Changed2DTrans(); /** Set the bit depth mode of the offscreen buffer used for blending. Causes a full redraw. */ virtual void SetBlendPrecision(EBlendPrecision eBlendPrecision); /** Deallocates GPU memory allocated during the rendering process. */ virtual void Cleanup(); /** Deallocates shaders. */ virtual void CleanupShaders(); /** Paint the image */ virtual bool Paint(); virtual bool CropDataset(const std::string& strTempDir, bool bKeepOldData); /// registers a data set with this renderer. this renderer then 'owns' it. virtual bool RegisterDataset(tuvok::Dataset*); /** Change the size of the FBO we render to. Any previous image is * destroyed, causing a full redraw on the next render. * \param vWinSize new width and height of the view window */ virtual void Resize(const UINTVECTOR2& vWinSize); virtual void SetLogoParams(std::string strLogoFilename, int iLogoPos); virtual void RenderSlice(const RenderRegion2D& region, double fSliceIndex, FLOATVECTOR3 vMinCoords, FLOATVECTOR3 vMaxCoords, DOUBLEVECTOR3 vAspectRatio, DOUBLEVECTOR2 vWinAspectRatio); virtual void NewFrameClear(const RenderRegion& renderRegion); GLFBOTex* GetLastFBO() const { return m_pFBO3DImageLast; } virtual void ScanForNewMeshes(); virtual void FixedFunctionality() const; virtual void SyncStateManager(); void CopyImageToDisplayBuffer(); protected: GLTargetBinder m_TargetBinder; GLTexture1D* m_p1DTransTex; GLTexture2D* m_p2DTransTex; std::vector m_p1DData; unsigned char* m_p2DData; GLFBOTex* m_pFBO3DImageLast; GLFBOTex* m_pFBO3DImageNext[2]; GLFBOTex* m_pFBOResizeQuickBlit; GLFBOTex* m_pFBOIsoHit[2]; GLFBOTex* m_pFBOCVHit[2]; GLTexture2D* m_pLogoTex; GLSLProgram* m_pProgram1DTrans[2]; GLSLProgram* m_pProgram2DTrans[2]; GLSLProgram* m_pProgramIso; GLSLProgram* m_pProgramColor; GLSLProgram* m_pProgramHQMIPRot; Timer m_Timer; GPUState m_BaseState; GLFrameCapture m_FrameCapture; void MaxMinBoxToVector(const FLOATVECTOR3& vMinPoint, const FLOATVECTOR3& vMaxPoint, std::vector& posData) const; void SetRenderTargetArea(const RenderRegion& renderRegion, bool bDecreaseScreenResNow); void SetRenderTargetArea(UINTVECTOR2 minCoord, UINTVECTOR2 maxCoord, bool bDecreaseScreenResNow); void SetRenderTargetAreaScissor(const RenderRegion& renderRegion); void SetViewPort(UINTVECTOR2 viLowerLeft, UINTVECTOR2 viUpperRight, bool bDecreaseScreenResNow); bool Render2DView(RenderRegion2D& renderRegion); void RenderBBox(const FLOATVECTOR4 vColor = FLOATVECTOR4(1,0,0,1)); void RenderBBox(const FLOATVECTOR4 vColor, const FLOATVECTOR3& vCenter, const FLOATVECTOR3& vExtend); void RenderClipPlane(EStereoID eStereoID); virtual bool Execute3DFrame(RenderRegion3D& renderRegion, float& fMsecPassed, bool& completedJob); void DrawLogo() const; void DrawBackGradient() const; bool CaptureSingleFrame(const std::string& strFilename, bool bPreserveTransparency) const; virtual bool Continue3DDraw(); virtual bool IsVolumeResident(const BrickKey& key) const; /// Defines a value to use for scaling the TF. Client apps which hand us /// over the raw data will usually want to override this to be 1, since /// they generally won't support any notion of TF scaling. virtual float CalculateScaling(); /// shader variables which will be constant with respect to the data set. /// these might be things which are dependent on program settings or /// similar. virtual void SetConstantShaderVars(); virtual void SetDataDepShaderVars(); virtual bool Render3DView(const RenderRegion3D& renderRegion, float& fMsecPassed); virtual void Render3DPreLoop(const RenderRegion3D &) { }; virtual void Render3DInLoop(const RenderRegion3D& , size_t , EStereoID ) {}; virtual void Render3DPostLoop() {} virtual void ComposeSurfaceImage(const RenderRegion& renderRegion, EStereoID eStereoID); virtual void RecomposeView(const RenderRegion&); virtual void Recompose3DView(const RenderRegion3D& renderRegion); virtual void RenderHQMIPPreLoop(RenderRegion2D& region); virtual void RenderHQMIPInLoop(const RenderRegion2D& , const Brick&) {} virtual void RenderHQMIPPostLoop() {} virtual void CreateOffscreenBuffers(); std::string FindFile(const std::string& file, bool subdirs) const; std::string FindFileInDirs(const std::string& file, const std::vector strDirs,bool subdirs) const; virtual bool LoadAndVerifyShader(GLSLProgram**, const std::vector strDirs, ...); virtual bool LoadAndVerifyShader(std::vector vert, std::vector frag, GLSLProgram**) const; virtual bool Render3DRegion(RenderRegion3D& region3D); void GeometryPreRender(); void GeometryPostRender(); void PlaneIn3DPreRender(); void PlaneIn3DPostRender(); void RenderPlanesIn3D(bool bDepthPassOnly); virtual void ClearColorBuffer() const; virtual void StartFrame(); virtual void EndFrame(const std::vector& justCompletedRegions); void CopyOverCompletedRegion(const RenderRegion* region); void PreSubframe(const RenderRegion& renderRegion); void PostSubframe(const RenderRegion& renderRegion); virtual void CVFocusHasChanged(LuaClassInstance region); virtual FLOATVECTOR3 Pick(const UINTVECTOR2&) const; void FullscreenQuad() const; void FullscreenQuadRegions() const; void FullscreenQuadRegion(const RenderRegion* region, bool decreaseScreenRes) const; void ComputeViewAndProjection(float fAspect); virtual void UpdateLightParamsInShaders(); GLVolume* m_pGLVolume; virtual bool BindVolumeTex(const BrickKey& bkey, const uint64_t iIntraFrameCounter); virtual bool UnbindVolumeTex(); virtual bool LoadShaders() { return LoadShaders("Volume3D.glsl", true); } virtual bool LoadShaders(const std::string& volumeAccessFunction, bool bBindVolume); virtual void InitBaseState(); void CleanupShader(GLSLProgram** p); void RenderOpaqueGeometry(); void SetMeshBTFSorting(bool bSortBTF); void RenderTransBackGeometry(); void RenderTransInGeometry(); void RenderTransFrontGeometry(); void RenderMergedMesh(SortIndexPVec& mergedMesh); void CheckMeshStatus(); GLint ComputeGLFilter() const; bool m_bSortMeshBTF; GLuint m_GeoBuffer; size_t m_iNumTransMeshes; size_t m_iNumMeshes; GLSLProgram* m_pProgramTrans; GLSLProgram* m_pProgram1DTransSlice; GLSLProgram* m_pProgram2DTransSlice; GLSLProgram* m_pProgram1DTransSlice3D; GLSLProgram* m_pProgram2DTransSlice3D; GLSLProgram* m_pProgramMIPSlice; GLSLProgram* m_pProgramTransMIP; GLSLProgram* m_pProgramIsoCompose; GLSLProgram* m_pProgramColorCompose; GLSLProgram* m_pProgramCVCompose; GLSLProgram* m_pProgramComposeAnaglyphs; GLSLProgram* m_pProgramComposeScanlineStereo; GLSLProgram* m_pProgramSBSStereo; GLSLProgram* m_pProgramAFStereo; GLSLProgram* m_pProgramBBox; GLSLProgram* m_pProgramMeshFTB; GLSLProgram* m_pProgramMeshBTF; GLenum m_texFormat16; ///< 16bit internal texture format to use GLenum m_texFormat32; ///< 32bit internal texture format to use private: float* m_aDepthStorage; void SetBrickDepShaderVarsSlice(const UINTVECTOR3& vVoxelCount) const; void RenderCoordArrows(const RenderRegion& renderRegion) const; void SaveEmptyDepthBuffer(); void SaveDepthBuffer(); void CreateDepthStorage(); void DeleteDepthStorage() {delete [] m_aDepthStorage;} void TargetIsBlankButFrameIsNotFinished(const RenderRegion* region); }; } // tuvok namespace #endif // GLRenderer_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLVolume.h0000644000175000017500000000451012320456500020300 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLVolume.h \author Jens Krueger DFKI Saarbruecken & SCI Institute University of Utah \date May 2010 \brief Abstracts volume creation via 2D or 3D textures. */ #pragma once #ifndef GLVOLUME_H #define GLVOLUME_H #include "../../StdTuvokDefines.h" #include "GLInclude.h" #include "../GPUObject.h" namespace tuvok { class GLVolume : public GPUObject { public: GLVolume(uint32_t iSizeX, uint32_t iSizeY, uint32_t iSizeZ, GLint internalformat, GLenum format, GLenum type, const GLvoid *pixels = 0, GLint iMagFilter = GL_NEAREST, GLint iMinFilter = GL_NEAREST, GLint wrapX = GL_CLAMP_TO_EDGE, GLint wrapY = GL_CLAMP_TO_EDGE, GLint wrapZ = GL_CLAMP_TO_EDGE); GLVolume(); virtual ~GLVolume(); virtual void SetData(const void *voxels) = 0; virtual void SetFilter(GLint iMagFilter = GL_NEAREST, GLint iMinFilter = GL_NEAREST); protected: GLint m_iMagFilter; GLint m_iMinFilter; }; } #endif // GLVOLUME_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLTargetBinder.cpp0000644000175000017500000001141212320456500021735 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLTargetBinder.cpp \author Jens Krueger SCI Institute University of Utah \date Januray 2009 */ #include "GLTargetBinder.h" #include "GLFBOTex.h" #include "Controller/Controller.h" using namespace tuvok; GLTargetBinder::GLTargetBinder(MasterController* pMasterController) : m_pMasterController(pMasterController) { } GLTargetBinder::~GLTargetBinder() { Unbind(); } void GLTargetBinder::Bind(const std::vector& vpFBOs) { // now for the fun stuff with OpenGL binding UnbindInternal(); switch (vpFBOs.size()) { case 1 : vpFBOs[0].pBuffer->Write(0,vpFBOs[0].iSubBuffer); GLFBOTex::OneDrawBuffer(); break; case 2 : vpFBOs[0].pBuffer->Write(0,vpFBOs[0].iSubBuffer); vpFBOs[1].pBuffer->Write(1,vpFBOs[1].iSubBuffer); GLFBOTex::TwoDrawBuffers(); break; case 3 : vpFBOs[0].pBuffer->Write(0,vpFBOs[0].iSubBuffer); vpFBOs[1].pBuffer->Write(1,vpFBOs[1].iSubBuffer); vpFBOs[2].pBuffer->Write(2,vpFBOs[2].iSubBuffer); GLFBOTex::ThreeDrawBuffers(); break; case 4 : vpFBOs[0].pBuffer->Write(0,vpFBOs[0].iSubBuffer); vpFBOs[1].pBuffer->Write(1,vpFBOs[1].iSubBuffer); vpFBOs[2].pBuffer->Write(2,vpFBOs[2].iSubBuffer); vpFBOs[3].pBuffer->Write(3,vpFBOs[3].iSubBuffer); GLFBOTex::FourDrawBuffers(); break; default : T_ERROR("Invalid number of FBOs %u", static_cast(vpFBOs.size())); return; } m_vpBoundFBOs = vpFBOs; } void GLTargetBinder::Bind(GLFBOTex* pFBO0, int iSubBuffer0, GLFBOTex* pFBO1, int iSubBuffer1, GLFBOTex* pFBO2, int iSubBuffer2, GLFBOTex* pFBO3, int iSubBuffer3) { std::vector vpFBOs; vpFBOs.push_back(GLBufferID(pFBO0, iSubBuffer0)); if (pFBO1) vpFBOs.push_back(GLBufferID(pFBO1, iSubBuffer1)); if (pFBO2) vpFBOs.push_back(GLBufferID(pFBO2, iSubBuffer2)); if (pFBO3) vpFBOs.push_back(GLBufferID(pFBO3, iSubBuffer3)); Bind(vpFBOs); } void GLTargetBinder::Bind(GLFBOTex* pFBO0, GLFBOTex* pFBO1, GLFBOTex* pFBO2, GLFBOTex* pFBO3) { std::vector vpFBOs; vpFBOs.push_back(GLBufferID(pFBO0)); if (pFBO1) vpFBOs.push_back(GLBufferID(pFBO1)); if (pFBO2) vpFBOs.push_back(GLBufferID(pFBO2)); if (pFBO3) vpFBOs.push_back(GLBufferID(pFBO3)); Bind(vpFBOs); } void GLTargetBinder::Unbind() { UnbindInternal(); } void GLTargetBinder::UnbindInternal() { if (m_vpBoundFBOs.size() == 1) { m_vpBoundFBOs[0].pBuffer->FinishWrite(m_vpBoundFBOs[0].iSubBuffer); } else if (m_vpBoundFBOs.size() == 2) { GLFBOTex::NoDrawBuffer(); m_vpBoundFBOs[1].pBuffer->FinishWrite(m_vpBoundFBOs[1].iSubBuffer); m_vpBoundFBOs[0].pBuffer->FinishWrite(m_vpBoundFBOs[0].iSubBuffer); } else if (m_vpBoundFBOs.size() == 3) { GLFBOTex::NoDrawBuffer(); m_vpBoundFBOs[2].pBuffer->FinishWrite(m_vpBoundFBOs[2].iSubBuffer); m_vpBoundFBOs[1].pBuffer->FinishWrite(m_vpBoundFBOs[1].iSubBuffer); m_vpBoundFBOs[0].pBuffer->FinishWrite(m_vpBoundFBOs[0].iSubBuffer); } else if (m_vpBoundFBOs.size() == 4) { GLFBOTex::NoDrawBuffer(); m_vpBoundFBOs[3].pBuffer->FinishWrite(m_vpBoundFBOs[3].iSubBuffer); m_vpBoundFBOs[2].pBuffer->FinishWrite(m_vpBoundFBOs[2].iSubBuffer); m_vpBoundFBOs[1].pBuffer->FinishWrite(m_vpBoundFBOs[1].iSubBuffer); m_vpBoundFBOs[0].pBuffer->FinishWrite(m_vpBoundFBOs[0].iSubBuffer); } m_vpBoundFBOs.clear(); } ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLInclude.h0000644000175000017500000001603612320456500020422 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLInclude.h \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #pragma once #ifndef TUVOK_GLINCLUDE_H #define TUVOK_GLINCLUDE_H #include "../../StdTuvokDefines.h" #include "3rdParty/GLEW/GL/glew.h" #ifdef WIN32 #define NOMINMAX #include "3rdParty/GLEW/GL/wglew.h" #include // undef stupid windows defines to max and min #ifdef max #undef max #endif #ifdef min #undef min #endif #endif #include "Controller/Controller.h" // under some circumstances the glError loops below do not // terminate, either glError itself causes an erro or does // not reset the error state. Neither should happen, but // still do #define MAX_GL_ERROR_COUNT 10 # define GL_RET(stmt) \ do { \ GLenum glerr; \ unsigned int iCounter = 0; \ while((glerr = glGetError()) != GL_NO_ERROR) { \ T_ERROR("GL error before line %u (%s): %s (%#x)", \ __LINE__, __FILE__, \ gluErrorString(glerr), \ static_cast(glerr)); \ iCounter++; \ if (iCounter > MAX_GL_ERROR_COUNT) break; \ } \ stmt; \ if ((glerr = glGetError()) != GL_NO_ERROR) { \ T_ERROR("'%s' on line %u (%s) caused GL error: %s (%#x)", #stmt, \ __LINE__, __FILE__, \ gluErrorString(glerr), \ static_cast(glerr)); \ return false; \ } \ } while(0) #ifdef _DEBUG # define GL_CHECK() \ do { \ GLenum glerr; \ unsigned int iCounter = 0; \ while((glerr = glGetError()) != GL_NO_ERROR) { \ T_ERROR("GL error before line %u (%s): %s (%#x)", \ __LINE__, __FILE__, \ gluErrorString(glerr), \ static_cast(glerr)); \ iCounter++; \ if (iCounter > MAX_GL_ERROR_COUNT) break; \ } \ } while(0) #else # define GL_CHECK() #endif #ifdef _DEBUG # define GL(stmt) \ do { \ GLenum glerr; \ unsigned int iCounter = 0; \ while((glerr = glGetError()) != GL_NO_ERROR) { \ T_ERROR("GL error calling %s before line %u (%s): %s (%#x)", \ #stmt, __LINE__, __FILE__, \ gluErrorString(glerr), \ static_cast(glerr)); \ iCounter++; \ if (iCounter > MAX_GL_ERROR_COUNT) break; \ } \ stmt; \ iCounter = 0; \ while((glerr = glGetError()) != GL_NO_ERROR) { \ T_ERROR("'%s' on line %u (%s) caused GL error: %s (%#x)", #stmt, \ __LINE__, __FILE__, \ gluErrorString(glerr), \ static_cast(glerr)); \ iCounter++; \ if (iCounter > MAX_GL_ERROR_COUNT) break; \ } \ } while(0) #else # define GL(stmt) do { stmt; } while(0) #endif /// macros for tracking glbegin and glend #ifdef _DEBUG #define GLBEGIN(mode) \ do { \ MESSAGE("glBegin(%s) on line %u (%s) called ", #mode, \ __LINE__, __FILE__ ); \ glBegin(mode); \ } while(0) #define GLEND() \ do { \ MESSAGE("glEnd() on line %u (%s) called ", \ __LINE__, __FILE__ ); \ glEnd(); \ } while(0) #else #define GLBEGIN(mode) do { glBegin(mode); } while(0) #define GLEND() do { glEnd(); } while(0) #endif #endif // TUVOK_GLINCLUDE_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLObject.h0000644000175000017500000000347312320456500020246 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLObject.h \author Jens Krueger SCI Institute University of Utah \date September 2008 */ #pragma once #ifndef GLOBJECT_H #define GLOBJECT_H #include "../../StdTuvokDefines.h" #include "../GPUObject.h" #include "GLInclude.h" namespace tuvok { /** Base for all OpenGL types which will utilize GPU memory. * Forces children to keep track of memory use on both the CPU and GPU, * allowing us to use as much memory as will be possible without swapping. */ class GLObject : public GPUObject { public: virtual ~GLObject() {} }; } #endif // GLOBJECT_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLVBO.cpp0000644000175000017500000001560212320456500020016 0ustar mathieumathieu#include "GLVBO.h" #include #include "GLInclude.h" using namespace tuvok; GLVBO::GLVBO() : m_vboHandles(0), m_iboHandle(std::make_pair(IBDesc(0,0),0)) { } GLVBO::~GLVBO() { FreeGL(); } GLuint GLVBO::GetNewAB() { GLuint vboHandle = 0; GL(glGenBuffers(1, &vboHandle)); GL(glBindBuffer(GL_ARRAY_BUFFER, vboHandle)); return vboHandle; } void GLVBO::ClearVertexData() { if(m_vboHandles.size()) { for (auto buffer = m_vboHandles.begin();buffersecond))); m_vboHandles.clear(); } } void GLVBO::FreeGL() { ClearVertexData(); if(m_iboHandle.first.count) { GL(glDeleteBuffers(1, &(m_iboHandle.second))); m_iboHandle.first.count = 0; m_iboHandle.first.type = 0; m_iboHandle.second = 0; } } void GLVBO::Bind() const { GLuint i = 0; for (auto buffer = m_vboHandles.begin();buffersecond)); GL(glEnableVertexAttribArray(i)); GL(glVertexAttribPointer(i++, GLint(buffer->first.elemCount), buffer->first.type, GL_FALSE, 0, NULL)); } glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_iboHandle.second); } void GLVBO::Draw(GLenum mode) const { if (m_vboHandles.empty()) return; if(m_iboHandle.first.count) GL(glDrawElements(mode, GLsizei(m_iboHandle.first.count), m_iboHandle.first.type, 0)); else GL(glDrawArrays(mode, 0, GLsizei(m_vboHandles[0].first.count))); } void GLVBO::Draw(GLsizei count, GLenum mode) const { if (m_vboHandles.empty()) return; if(m_iboHandle.first.count) GL(glDrawElements(mode, count, m_iboHandle.first.type, 0)); else GL(glDrawArrays(mode, 0, count)); } void GLVBO::UnBind() const { GLuint i = 0; for (auto buffer = m_vboHandles.begin();buffer& indexData) { if (indexData.empty()) return; if (m_iboHandle.first.count == 0) GL(glGenBuffers(1, &m_iboHandle.second)); m_iboHandle.first.type = GL_UNSIGNED_INT; m_iboHandle.first.count = indexData.size(); GL(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_iboHandle.second)); GL(glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(uint32_t)*indexData.size(), &(indexData[0]), GL_STATIC_DRAW)); } void GLVBO::SetIndexData(const std::vector& indexData) { if (indexData.empty()) return; if (m_iboHandle.first.count == 0) GL(glGenBuffers(1, &m_iboHandle.second)); m_iboHandle.first.type = GL_UNSIGNED_SHORT; m_iboHandle.first.count = indexData.size(); GL(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_iboHandle.second)); GL(glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(uint16_t)*indexData.size(), &(indexData[0]), GL_STATIC_DRAW)); } void GLVBO::AddVertexData(const std::vector& vertexData) { if (!vertexData.empty()) AddVertexData(1, sizeof(float), GL_FLOAT, vertexData.size(), &(vertexData[0])); } void GLVBO::AddVertexData(const std::vector& vertexData){ if (!vertexData.empty()) AddVertexData(2, sizeof(float), GL_FLOAT, vertexData.size(), &(vertexData[0])); } void GLVBO::AddVertexData(const std::vector& vertexData){ if (!vertexData.empty()) AddVertexData(3, sizeof(float), GL_FLOAT, vertexData.size(), &(vertexData[0])); } void GLVBO::AddVertexData(const std::vector& vertexData){ AddVertexData(4, sizeof(float), GL_FLOAT, vertexData.size(), &(vertexData[0])); } void GLVBO::AddVertexData(const std::vector& vertexData){ if (!vertexData.empty()) AddVertexData(1, sizeof(int32_t), GL_INT, vertexData.size(), &(vertexData[0])); } void GLVBO::AddVertexData(const std::vector& vertexData){ if (!vertexData.empty()) AddVertexData(2, sizeof(int32_t), GL_INT, vertexData.size(), &(vertexData[0])); } void GLVBO::AddVertexData(const std::vector& vertexData){ if (!vertexData.empty()) AddVertexData(3, sizeof(int32_t), GL_INT, vertexData.size(), &(vertexData[0])); } void GLVBO::AddVertexData(const std::vector& vertexData){ if (!vertexData.empty()) AddVertexData(4, sizeof(int32_t), GL_INT, vertexData.size(), &(vertexData[0])); } void GLVBO::AddVertexData(const std::vector& vertexData){ if (!vertexData.empty()) AddVertexData(1, sizeof(uint32_t), GL_UNSIGNED_INT, vertexData.size(), &(vertexData[0])); } void GLVBO::AddVertexData(const std::vector& vertexData){ if (!vertexData.empty()) AddVertexData(2, sizeof(uint32_t), GL_UNSIGNED_INT, vertexData.size(), &(vertexData[0])); } void GLVBO::AddVertexData(const std::vector& vertexData){ if (!vertexData.empty()) AddVertexData(3, sizeof(uint32_t), GL_UNSIGNED_INT, vertexData.size(), &(vertexData[0])); } void GLVBO::AddVertexData(const std::vector& vertexData){ if (!vertexData.empty()) AddVertexData(4, sizeof(uint32_t), GL_UNSIGNED_INT, vertexData.size(), &(vertexData[0])); } void GLVBO::AddVertexData(const std::vector& vertexData){ if (!vertexData.empty()) AddVertexData(1, sizeof(int8_t), GL_BYTE, vertexData.size(), &(vertexData[0])); } void GLVBO::AddVertexData(const std::vector>& vertexData){ if (!vertexData.empty()) AddVertexData(2, sizeof(int8_t), GL_BYTE, vertexData.size(), &(vertexData[0])); } void GLVBO::AddVertexData(const std::vector>& vertexData){ if (!vertexData.empty()) AddVertexData(3, sizeof(int8_t), GL_BYTE, vertexData.size(), &(vertexData[0])); } void GLVBO::AddVertexData(const std::vector>& vertexData){ if (!vertexData.empty()) AddVertexData(4, sizeof(int8_t), GL_BYTE, vertexData.size(), &(vertexData[0])); } void GLVBO::AddVertexData(const std::vector& vertexData){ if (!vertexData.empty()) AddVertexData(1, sizeof(int8_t), GL_UNSIGNED_BYTE, vertexData.size(), &(vertexData[0])); } void GLVBO::AddVertexData(const std::vector>& vertexData){ if (!vertexData.empty()) AddVertexData(2, sizeof(int8_t), GL_UNSIGNED_BYTE, vertexData.size(), &(vertexData[0])); } void GLVBO::AddVertexData(const std::vector>& vertexData){ if (!vertexData.empty()) AddVertexData(3, sizeof(int8_t), GL_UNSIGNED_BYTE, vertexData.size(), &(vertexData[0])); } void GLVBO::AddVertexData(const std::vector>& vertexData){ if (!vertexData.empty()) AddVertexData(4, sizeof(int8_t), GL_UNSIGNED_BYTE, vertexData.size(), &(vertexData[0])); } void GLVBO::AddVertexData(size_t elemCount, size_t elemSize, GLenum type, size_t count, const GLvoid * pointer) { GLuint id = GetNewAB(); m_vboHandles.push_back(std::make_pair(ABDesc(type, elemCount, count), id)); GL(glBufferData(GL_ARRAY_BUFFER, count*elemCount*elemSize, pointer, GL_STATIC_DRAW)); } ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLContext.h0000644000175000017500000000602112320456500020454 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLContext.h \author Tom Fogal SCI Institute University of Utah */ #pragma once #ifndef TUVOK_GL_CONTEXT_ID_H #define TUVOK_GL_CONTEXT_ID_H #include #ifdef DETECTED_OS_WINDOWS # include #else # include #endif #include "../Context.h" #include "GLStateManager.h" namespace tuvok { class GLContext : public Context { public: #ifdef DETECTED_OS_WINDOWS #define GetContext wglGetCurrentContext #else #define GetContext glXGetCurrentContext #endif GLContext(int iShareGroupID) : Context(iShareGroupID) { ctx = GetContext(); if (ctx) m_pState = std::shared_ptr(new GLStateManager()); else m_pState = std::shared_ptr(); } /// Create an ID from the given context. GLContext(const GLContext& ct) : Context(ct.m_iShareGroupID) { ctx = ct.ctx; m_pState = ct.m_pState; } static std::shared_ptr Current(int iShareGroupID) { if(contextMap.find(GetContext()) == contextMap.end()) { std::pair> tmp( GetContext(), std::shared_ptr(new GLContext(iShareGroupID)) ); return contextMap.insert(tmp).first->second; // return what we're inserting } return contextMap[GetContext()]; } bool operator==(const GLContext &gl_cid) const { return this->ctx == gl_cid.ctx; } bool operator!=(const GLContext &gl_cid) const { return this->ctx != gl_cid.ctx; } GLContext& operator=(const GLContext &ct) { this->m_iShareGroupID = ct.m_iShareGroupID; this->ctx = ct.ctx; return *this; } private: GLContext(const Context&); ///< unimplemented }; } #endif // TUVOK_GL_CONTEXT_ID_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/QtGLContext.h0000644000175000017500000000711212320456500020763 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file QtGLContext.h \author Tom Fogal SCI Institute University of Utah */ #pragma once #ifndef TUVOK_QT_GL_CONTEXT_ID_H #define TUVOK_QT_GL_CONTEXT_ID_H #include #include #include "../Context.h" #include "GLStateManager.h" #include namespace tuvok { /// GL context information based on the `QGLContext' class. class QtGLContext : public Context { public: /// Create an ID with the current context. QtGLContext(int iShareGroupID) : Context(iShareGroupID) { ctx = QGLContext::currentContext(); if (ctx) m_pState = std::shared_ptr(new GLStateManager()); else m_pState = std::shared_ptr(); } /// Create an ID from the given context. /// NOTE: Do not create multiple QtGLContext's from the same QGLContext! QtGLContext(const QGLContext *ct, int iShareGroupID) : Context(iShareGroupID) { m_iShareGroupID = iShareGroupID; ctx = ct; if (ctx) m_pState = std::shared_ptr(new GLStateManager()); else m_pState = std::shared_ptr(); } QtGLContext(const QtGLContext& ct, int iShareGroupID) : Context(iShareGroupID) { m_iShareGroupID = ct.m_iShareGroupID; ctx = ct.ctx; m_pState = ct.m_pState; } static std::shared_ptr Current(int iShareGroupID) { if(contextMap.find(QGLContext::currentContext()) == contextMap.end()) { std::pair> tmp( QGLContext::currentContext(), std::shared_ptr(new QtGLContext(iShareGroupID)) ); return contextMap.insert(tmp).first->second; // return what we're inserting } assert(iShareGroupID == contextMap[QGLContext::currentContext()]->GetShareGroupID()); return contextMap[QGLContext::currentContext()]; } bool operator==(const QtGLContext &gl_cid) const { return this->ctx == gl_cid.ctx; } bool operator!=(const QtGLContext &gl_cid) const { return this->ctx != gl_cid.ctx; } QtGLContext& operator=(const QtGLContext &ct) { this->m_iShareGroupID = ct.m_iShareGroupID; this->ctx = ct.ctx; return *this; } private: QtGLContext(const Context&); ///< unimplemented }; } #endif // TUVOK_GL_CONTEXT_ID_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLVolumePool.cpp0000644000175000017500000024657012320456500021503 0ustar mathieumathieu#include "StdTuvokDefines.h" #include #include #include #include #include #include #include #ifdef WRITE_SHADERS # include # include #endif #include "Basics/MathTools.h" #include "Basics/TuvokException.h" #include "Basics/Threads.h" #include "IO/LinearIndexDataset.h" #include "IO/UVF/ExtendedOctree/VolumeTools.h" #include "Controller/StackTimer.h" #include "Renderer/VisibilityState.h" #include "Renderer/writebrick.h" #include "GLSLProgram.h" #include "GLVolumePool.h" enum BrickIDFlags { BI_MISSING = 0, BI_CHILD_EMPTY, BI_EMPTY, BI_FLAG_COUNT }; using namespace tuvok; namespace tuvok { class AsyncVisibilityUpdater : public ThreadClass { public: AsyncVisibilityUpdater(GLVolumePool& m_Parent); ~AsyncVisibilityUpdater(); void Restart(const VisibilityState& visibility); bool Pause(); // returns true if thread is busy, false means thread is idle virtual void Resume(); // call pause before using any getter and probably resume or restart afterwards const VisibilityState& GetVisibility() const { return m_Visibility; } #ifdef GLVOLUMEPOOL_PROFILE struct Stats { double fTimeTotal; double fTimeInterruptions; uint32_t iInterruptions; }; Stats const& GetStats() const { return m_Stats; } #endif private: bool Continue(); // returns true if thread should continue its work, false signals restart request virtual void ThreadMain(void*); GLVolumePool& m_Pool; VisibilityState m_Visibility; enum State { RestartRequested, PauseRequested, Paused, Busy, Idle } m_eState; CriticalSection m_StateGuard; WaitCondition m_Parent; WaitCondition m_Worker; #ifdef GLVOLUMEPOOL_PROFILE Timer m_Timer; Stats m_Stats; #endif }; } // namespace tuvok static UINTVECTOR3 GetLoDSize(const UINTVECTOR3& volumeSize, uint32_t iLoD) { UINTVECTOR3 vLoDSize(uint32_t(ceil(double(volumeSize.x)/MathTools::Pow2(iLoD))), uint32_t(ceil(double(volumeSize.y)/MathTools::Pow2(iLoD))), uint32_t(ceil(double(volumeSize.z)/MathTools::Pow2(iLoD)))); return vLoDSize; } static FLOATVECTOR3 GetFloatBrickLayout(const UINTVECTOR3& volumeSize, const UINTVECTOR3& maxInnerBrickSize, uint32_t iLoD) { FLOATVECTOR3 baseBrickCount(float(volumeSize.x)/maxInnerBrickSize.x, float(volumeSize.y)/maxInnerBrickSize.y, float(volumeSize.z)/maxInnerBrickSize.z); baseBrickCount /= float(MathTools::Pow2(iLoD)); // subtract smallest possible floating point epsilon from integer values that would mess up the brick index computation in the shader if (float(uint32_t(baseBrickCount.x)) == baseBrickCount.x) baseBrickCount.x -= baseBrickCount.x * std::numeric_limits::epsilon(); if (float(uint32_t(baseBrickCount.y)) == baseBrickCount.y) baseBrickCount.y -= baseBrickCount.y * std::numeric_limits::epsilon(); if (float(uint32_t(baseBrickCount.z)) == baseBrickCount.z) baseBrickCount.z -= baseBrickCount.z * std::numeric_limits::epsilon(); return baseBrickCount; } static UINTVECTOR3 GetBrickLayout(const UINTVECTOR3& volumeSize, const UINTVECTOR3& maxInnerBrickSize, uint32_t iLoD) { UINTVECTOR3 baseBrickCount(uint32_t(ceil(double(volumeSize.x)/maxInnerBrickSize.x)), uint32_t(ceil(double(volumeSize.y)/maxInnerBrickSize.y)), uint32_t(ceil(double(volumeSize.z)/maxInnerBrickSize.z))); return GetLoDSize(baseBrickCount, iLoD); } GLVolumePool::GLVolumePool(const UINTVECTOR3& poolSize, LinearIndexDataset* pDataset, GLenum filter, bool bUseGLCore, DebugMode dm) : m_pPoolMetadataTexture(NULL), m_pPoolDataTexture(NULL), m_vPoolCapacity(0,0,0), m_poolSize(poolSize), m_maxInnerBrickSize(UINTVECTOR3(pDataset->GetMaxUsedBrickSizes()) - UINTVECTOR3(pDataset->GetBrickOverlapSize()) * 2), m_maxTotalBrickSize(pDataset->GetMaxUsedBrickSizes()), m_volumeSize(pDataset->GetDomainSize()), m_iLoDCount(uint32_t(pDataset->GetLargestSingleBrickLOD(0)+1)), m_filter(filter), m_iTimeOfCreation(2), m_iMetaTextureUnit(0), m_iDataTextureUnit(1), m_bUseGLCore(bUseGLCore), m_iInsertPos(0), m_pDataset(pDataset), m_pUpdater(NULL), m_bVisibilityUpdated(false) #ifdef GLVOLUMEPOOL_PROFILE , m_Timer() , m_TimesRecomputeVisibilityForBrickPool(100) , m_TimesMetaTextureUpload(100) , m_TimesRecomputeVisibility(100) #endif , m_iMinMaxScalarTimestep(0) , m_iMinMaxGradientTimestep(0) , m_BrickIOTime(0.0) , m_BrickIOBytes(0) , m_iMaxUsedBrickVoxelCount(0) , m_iMaxUsedBrickBytes(0) , m_eDebugMode(dm) { const uint64_t iBitWidth = m_pDataset->GetBitWidth(); const uint64_t iCompCount = m_pDataset->GetComponentCount(); m_iMaxUsedBrickVoxelCount = m_maxTotalBrickSize.volume(); m_iMaxUsedBrickBytes = (iBitWidth/8) * iCompCount * m_iMaxUsedBrickVoxelCount; switch (iCompCount) { case 1 : m_format = GL_LUMINANCE; break; case 3 : m_format = GL_RGB; break; case 4 : m_format = GL_RGBA; break; default : throw Exception("Invalid Component Count", _func_, __LINE__); } switch (iBitWidth) { case 8 : { m_type = GL_UNSIGNED_BYTE; switch (iCompCount) { case 1 : m_internalformat = GL_LUMINANCE8; break; case 3 : m_internalformat = GL_RGB8; break; case 4 : m_internalformat = GL_RGBA8; break; default : throw Exception("Invalid Component Count", _func_, __LINE__); } } break; case 16 : { m_type = GL_UNSIGNED_SHORT; switch (iCompCount) { case 1 : m_internalformat = GL_LUMINANCE16; break; case 3 : m_internalformat = GL_RGB16; break; case 4 : m_internalformat = GL_RGBA16; break; default : throw Exception("Invalid Component Count", _func_, __LINE__); } } break; case 32 : { m_type = GL_FLOAT; switch (iCompCount) { case 1 : m_internalformat = GL_LUMINANCE32F_ARB; break; case 3 : m_internalformat = GL_RGB32F; break; case 4 : m_internalformat = GL_RGBA32F; break; default : throw Exception("Invalid Component Count", _func_, __LINE__); } } break; default : throw Exception("Invalid bit width", _func_, __LINE__); } // fill the pool slot information const UINTVECTOR3 slotLayout = poolSize/m_maxTotalBrickSize; m_vPoolSlotData.reserve(slotLayout.volume()); for (uint32_t z = 0;zIndexFrom4D(vBrickID, m_iMinMaxScalarTimestep); MinMaxBlock imme = m_pDataset->MaxMinForKey(key); m_vMinMaxScalar[i].min = imme.minScalar; m_vMinMaxScalar[i].max = imme.maxScalar; } switch (m_eDebugMode) { default: case DM_NONE: { uint32_t const iAsyncUpdaterThreshold = 7500 * 5; // we can process 7500 bricks/ms (1500 running debug build) if (m_iTotalBrickCount > iAsyncUpdaterThreshold) m_pUpdater = new AsyncVisibilityUpdater(*this); } break; case DM_BUSY: // if we want to simulate a busy async updater we need to make sure to instantiate it WARNING("Async worker simulates to be busy without doing anything useful, forcing the renderer to figure out the metadata on its own."); m_pUpdater = new AsyncVisibilityUpdater(*this); break; case DM_SYNC: // if we want to disable the async updater we just don't instantiate it WARNING("Forcing always synchronous metadata updates, async worker is disabled."); break; case DM_NOEMPTYSPACELEAPING: WARNING("Visibility computation is DISABLED, disabling empty space leaping."); break; } } void GLVolumePool::PH_Reset(const VisibilityState& visibility, size_t iTimestep) { // remember largest single brick parameters uint32_t const iLastBrickIndex = *(m_vLoDOffsetTable.end()-1); uint32_t const iLastBrickFlag = m_vBrickMetadata[iLastBrickIndex]; // clear pool slot data for (auto slot = m_vPoolSlotData.begin(); slot != m_vPoolSlotData.end(); slot++) { if (slot->m_iBrickID != int32_t(iLastBrickIndex)) { slot->m_iBrickID = -1; slot->m_iTimeOfCreation = 0; slot->m_iOrigTimeOfCreation = 0; } } // clear metadata std::fill(m_vBrickMetadata.begin(), m_vBrickMetadata.end(), BI_MISSING); // restore largest single brick flag m_vBrickMetadata[iLastBrickIndex] = iLastBrickFlag; RecomputeVisibility(visibility, iTimestep, true); } uint32_t GLVolumePool::GetLoDCount() const { return m_iLoDCount; } uint32_t GLVolumePool::GetIntegerBrickID(const UINTVECTOR4& vBrickID) const { UINTVECTOR3 bricks = GetBrickLayout(m_volumeSize, m_maxInnerBrickSize, vBrickID.w); return vBrickID.x + vBrickID.y * bricks.x + vBrickID.z * bricks.x * bricks.y + m_vLoDOffsetTable[vBrickID.w]; } UINTVECTOR4 GLVolumePool::GetVectorBrickID(uint32_t iBrickID) const { auto up = std::upper_bound(m_vLoDOffsetTable.cbegin(), m_vLoDOffsetTable.cend(), iBrickID); uint32_t lod = uint32_t(up - m_vLoDOffsetTable.cbegin()) - 1; UINTVECTOR3 bricks = GetBrickLayout(m_volumeSize, m_maxInnerBrickSize, lod); iBrickID -= m_vLoDOffsetTable[lod]; return UINTVECTOR4(iBrickID % bricks.x, (iBrickID % (bricks.x*bricks.y)) / bricks.x, iBrickID / (bricks.x*bricks.y), lod); } UINTVECTOR3 const& GLVolumePool::GetPoolCapacity() const { return m_vPoolCapacity; } inline UINTVECTOR3 const& GLVolumePool::GetVolumeSize() const { return m_volumeSize; } inline UINTVECTOR3 const& GLVolumePool::GetMaxInnerBrickSize() const { return m_maxInnerBrickSize; } std::string GLVolumePool::GetShaderFragment(uint32_t iMetaTextureUnit, uint32_t iDataTextureUnit, MissingBrickStrategy strategy, const std::string& WsetPrefixName) { // must have created GL resources before asking for shader if (!m_pPoolMetadataTexture || !m_pPoolDataTexture) return ""; m_iMetaTextureUnit = iMetaTextureUnit; m_iDataTextureUnit = iDataTextureUnit; std::stringstream ss; //#define WRITE_SHADERS #ifdef WRITE_SHADERS const char* shname = "volpool.glsl"; std::ifstream shader(shname); if(shader) { MESSAGE("Reusing volpool.glsl shader on disk."); shader >> std::noskipws; std::string sh( (std::istream_iterator(shader)), (std::istream_iterator()) ); shader.close(); return sh; } #endif if (m_bUseGLCore) ss << "#version 420 core\n"; else ss << "#version 420 compatibility\n"; FLOATVECTOR3 poolAspect(m_pPoolDataTexture->GetSize()); poolAspect /= poolAspect.minVal(); // get the maximum precision for floats (larger precisions would just append // zeroes) ss << std::setprecision(36); ss << "\n" << "layout(binding = " << m_iMetaTextureUnit << ") uniform usampler3D metaData;\n" << "#define iMetaTextureSize uvec3(" << m_pPoolMetadataTexture->GetSize().x << ", " << m_pPoolMetadataTexture->GetSize().y << ", " << m_pPoolMetadataTexture->GetSize().z << ")\n" << "// #define iMetaTextureWidth " << m_pPoolMetadataTexture->GetSize().x << "\n" << "\n" << "#define BI_CHILD_EMPTY " << BI_CHILD_EMPTY << "\n" << "#define BI_EMPTY " << BI_EMPTY << "\n" << "#define BI_MISSING " << BI_MISSING << "\n" << "#define BI_FLAG_COUNT " << BI_FLAG_COUNT << "\n" << "\n" << "layout(binding = " << m_iDataTextureUnit << ") uniform sampler3D volumePool;\n" << "#define iPoolSize ivec3(" << m_pPoolDataTexture->GetSize().x << ", " << m_pPoolDataTexture->GetSize().y << ", " << m_pPoolDataTexture->GetSize().z <<")\n" << "#define volumeSize vec3(" << m_volumeSize.x << ", " << m_volumeSize.y << ", " << m_volumeSize.z <<")\n" << "#define poolAspect vec3(" << poolAspect.x << ", " << poolAspect.y << ", " << poolAspect.z <<")\n" << "#define poolCapacity ivec3(" << m_vPoolCapacity.x << ", " << m_vPoolCapacity.y << ", " << m_vPoolCapacity.z <<")\n" << "// the total size of a brick in the pool, including the boundary\n" << "#define maxTotalBrickSize ivec3(" << m_maxTotalBrickSize.x << ", " << m_maxTotalBrickSize.y << ", " << m_maxTotalBrickSize.z <<")\n" << "// just the addressable (inner) size of a brick\n" << "#define maxInnerBrickSize ivec3(" << m_maxInnerBrickSize.x << ", " << m_maxInnerBrickSize.y << ", " << m_maxInnerBrickSize.z <<")\n" << "// brick overlap voxels (in pool texcoords)\n" << "#define overlap vec3(" << (m_maxTotalBrickSize.x - m_maxInnerBrickSize.x) / (2.0f*m_pPoolDataTexture->GetSize().x) << ", " << (m_maxTotalBrickSize.y - m_maxInnerBrickSize.y) / (2.0f*m_pPoolDataTexture->GetSize().y) << ", " << (m_maxTotalBrickSize.z - m_maxInnerBrickSize.z) / (2.0f*m_pPoolDataTexture->GetSize().z) <<")\n" << "uniform float fLoDFactor;\n" << "uniform float fLevelZeroWorldSpaceError;\n" << "uniform vec3 volumeAspect;\n" << "#define iMaxLOD " << m_iLoDCount-1 << "\n"; if (m_iLoDCount < 2) { // HACK: aparently GLSL (at least NVIDIA's implementation) // does not like arrays with just a single element // so if we only have one LOD we just append a dummy // element to each array ss << "uniform uint vLODOffset[2] = uint[](" << "uint(" << m_vLoDOffsetTable[0] << "), uint(0));\n" << "uniform vec3 vLODLayout[2] = vec3[](\n"; FLOATVECTOR3 vLoDSize = GetFloatBrickLayout(m_volumeSize, m_maxInnerBrickSize, 0); ss << " vec3(" << vLoDSize.x << ", " << vLoDSize.y << ", " << vLoDSize.z << "), // Level \n" << " vec3(0.0,0.0,0.0) // Dummy \n );\n" // HACK: << "uniform uvec2 iLODLayoutSize[3] = uvec2[](\n" << " uvec2(0, 0),// dummy Level that we'll never access to fix ATI/AMD issue where we cannot access the first element in a uniform integer array (does always return 0)\n"; vLoDSize = GetFloatBrickLayout(m_volumeSize, m_maxInnerBrickSize, 0); ss << " uvec2(" << unsigned(ceil(vLoDSize.x)) << ", " << unsigned(ceil(vLoDSize.x)) * unsigned(ceil(vLoDSize.y)) << "), // Level 0\n" << " uvec2(uint(0),uint(0)) // Dummy \n );\n"; } else { ss << "uniform uint vLODOffset[" << m_iLoDCount << "] = uint[]("; for (uint32_t i = 0;i negative z-axis hence the minus\n" << " return min(iMaxLOD, uint(log2(fLoDFactor*(-dist)/fLevelZeroWorldSpaceError)));\n" << "}\n"; #ifdef WRITE_SHADERS std::ofstream vpool(shname, std::ios::trunc); if(vpool) { MESSAGE("Writing new volpool shader."); const std::string& s = ss.str(); std::copy(s.begin(), s.end(), std::ostream_iterator(vpool, "")); } vpool.close(); #endif return ss.str(); } void GLVolumePool::UploadBrick(uint32_t iBrickID, const UINTVECTOR3& vVoxelSize, void* pData, size_t iInsertPos, uint64_t iTimeOfCreation) { StackTimer ubrick(PERF_POOL_UPLOAD_BRICK); PoolSlotData& slot = m_vPoolSlotData[iInsertPos]; if (slot.ContainsVisibleBrick()) { m_vBrickMetadata[slot.m_iBrickID] = BI_MISSING; // upload paged-out meta texel UploadMetadataTexel(slot.m_iBrickID); // MESSAGE("Removing brick %i at queue position %i from pool", // int(m_PoolSlotData[iInsertPos].m_iBrickID), // int(iInsertPos)); } slot.m_iBrickID = iBrickID; slot.m_iTimeOfCreation = iTimeOfCreation; uint32_t iPoolCoordinate = slot.PositionInPool().x + slot.PositionInPool().y * m_vPoolCapacity.x + slot.PositionInPool().z * m_vPoolCapacity.x * m_vPoolCapacity.y; /* MESSAGE("Loading brick %i at queue position %i (pool coord: %i=[%i, %i, %i]) at time %llu", int(m_PoolSlotData[iInsertPos].m_iBrickID), int(iInsertPos), int(iPoolCoordinate), int(m_PoolSlotData[iInsertPos].PositionInPool().x), int(m_PoolSlotData[iInsertPos].PositionInPool().y), int(m_PoolSlotData[iInsertPos].PositionInPool().z), iTimeOfCreation); */ // update metadata (does NOT update the texture on the GPU) // this is done by the explicit UploadMetaData call to // only upload the updated data once all bricks have been // updated m_vBrickMetadata[slot.m_iBrickID] = iPoolCoordinate + BI_FLAG_COUNT; // upload paged-in meta texel UploadMetadataTexel(slot.m_iBrickID); // upload brick to 3D texture m_pPoolDataTexture->SetData(slot.PositionInPool() * m_maxTotalBrickSize, vVoxelSize, pData); } namespace { template void UploadFirstBrickT( const BrickKey& bkey, GLVolumePool& pool, const LinearIndexDataset* pDataset ) { const UINTVECTOR3 vVoxelCount = pDataset->GetBrickVoxelCounts(bkey); std::vector vUploadMem(vVoxelCount.volume()); { tuvok::StackTimer poolGetBrick(PERF_POOL_GET_BRICK); pDataset->GetBrick(bkey, vUploadMem); } pool.UploadFirstBrick(vVoxelCount, &vUploadMem[0]); } } void GLVolumePool::UploadFirstBrick(const BrickKey& bkey) { unsigned int const iBitWidth = m_pDataset->GetBitWidth(); if (!m_pDataset->GetIsSigned()) { switch (iBitWidth) { case 8 : return UploadFirstBrickT (bkey, *this, m_pDataset); case 16 : return UploadFirstBrickT(bkey, *this, m_pDataset); case 32 : return UploadFirstBrickT(bkey, *this, m_pDataset); default : throw Exception("Invalid bit width for an unsigned dataset", _func_, __LINE__); } } else if (m_pDataset->GetIsFloat()) { switch (iBitWidth) { case 32 : return UploadFirstBrickT (bkey, *this, m_pDataset); case 64 : return UploadFirstBrickT(bkey, *this, m_pDataset); default : throw Exception("Invalid bit width for a float dataset", _func_, __LINE__); } } else { switch (iBitWidth) { case 8 : return UploadFirstBrickT (bkey, *this, m_pDataset); case 16 : return UploadFirstBrickT(bkey, *this, m_pDataset); case 32 : return UploadFirstBrickT(bkey, *this, m_pDataset); default : throw Exception("Invalid bit width for a signed dataset", _func_, __LINE__); } } } void GLVolumePool::UploadFirstBrick(const UINTVECTOR3& m_vVoxelSize, void* pData) { uint32_t iLastBrickIndex = *(m_vLoDOffsetTable.end()-1); UploadBrick(iLastBrickIndex, m_vVoxelSize, pData, m_vPoolSlotData.size()-1, std::numeric_limits::max()); } bool GLVolumePool::UploadBrick(const BrickElemInfo& metaData, void* pData) { // in this frame we already replaced all bricks (except the single low-res brick) // in the pool so now we should render them first if (m_iInsertPos >= m_vPoolSlotData.size()-1) return false; int32_t iBrickID = GetIntegerBrickID(metaData.m_vBrickID); UploadBrick(iBrickID, metaData.m_vVoxelSize, pData, m_iInsertPos, m_iTimeOfCreation++); m_iInsertPos++; return true; } bool GLVolumePool::IsBrickResident(const UINTVECTOR4& vBrickID) const { int32_t iBrickID = GetIntegerBrickID(vBrickID); for (auto slot = m_vPoolSlotData.begin(); slotm_iBrickID) == iBrickID) return true; } return false; } void GLVolumePool::Enable(float fLoDFactor, const FLOATVECTOR3& vExtend, const FLOATVECTOR3& /*vAspect */, GLSLProgram* pShaderProgram) const { m_pPoolMetadataTexture->Bind(m_iMetaTextureUnit); m_pPoolDataTexture->Bind(m_iDataTextureUnit); pShaderProgram->Enable(); pShaderProgram->Set("fLoDFactor",fLoDFactor); // pShaderProgram->Set("volumeAspect",vAspect.x, vAspect.y, vAspect.z); float fLevelZeroWorldSpaceError = (vExtend/FLOATVECTOR3(m_volumeSize)).maxVal(); pShaderProgram->Set("fLevelZeroWorldSpaceError",fLevelZeroWorldSpaceError); } void GLVolumePool::Disable() const { /*m_pPoolMetadataTexture->FinishRead();*/ } GLVolumePool::~GLVolumePool() { if (m_pUpdater) delete m_pUpdater; FreeGLResources(); } static UINTVECTOR3 Fit1DIndexTo3DArray(uint64_t maxIdx, uint32_t maxArraySize) { // we're creating a 3D texture.. make sure it can be large enough to hold the // data! const uint64_t max_elems = uint64_t(maxArraySize) * uint64_t(maxArraySize) * uint64_t(maxArraySize); if(maxIdx > max_elems) { throw std::runtime_error("index texture exceeds max allowable size!"); } UINTVECTOR3 texSize; if(maxIdx < uint64_t(maxArraySize)) { // fits 1D index into a single row texSize.x = uint32_t(maxIdx); texSize.y = 1; texSize.z = 1; } else if (maxIdx < uint64_t(maxArraySize)*uint64_t(maxArraySize)) { // fit 1D index into the smallest possible rectangle texSize.x = uint32_t(std::ceil(std::sqrt(double(maxIdx)))); texSize.y = uint32_t(std::ceil(double(maxIdx)/double(texSize.x))); texSize.z = 1; } else { // fit 1D index into the smallest possible cuboid texSize.x = uint32_t(std::ceil(pow(double(maxIdx), 1.0/3.0))); texSize.y = uint32_t(std::ceil(double(maxIdx)/double(texSize.x * texSize.x))); texSize.z = uint32_t(std::ceil(double(maxIdx)/double(texSize.x * texSize.y))); } assert((uint64_t(texSize.x) * uint64_t(texSize.y) * uint64_t(texSize.z)) >= maxIdx); assert(texSize.x <= maxArraySize); assert(texSize.y <= maxArraySize); assert(texSize.z <= maxArraySize); return texSize; } void GLVolumePool::CreateGLResources() { m_pPoolDataTexture = new GLTexture3D(m_poolSize.x, m_poolSize.y, m_poolSize.z, m_internalformat, m_format, m_type, 0, m_filter, m_filter); m_vPoolCapacity = UINTVECTOR3(m_pPoolDataTexture->GetSize().x/m_maxTotalBrickSize.x, m_pPoolDataTexture->GetSize().y/m_maxTotalBrickSize.y, m_pPoolDataTexture->GetSize().z/m_maxTotalBrickSize.z); MESSAGE("Creating brick pool of size [%u,%u,%u] to hold a " "max of [%u,%u,%u] bricks of size [%u,%u,%u] (" "addressable size [%u,%u,%u]) and smaller.", m_pPoolDataTexture->GetSize().x, m_pPoolDataTexture->GetSize().y, m_pPoolDataTexture->GetSize().z, m_vPoolCapacity.x, m_vPoolCapacity.y, m_vPoolCapacity.z, m_maxTotalBrickSize.x, m_maxTotalBrickSize.y, m_maxTotalBrickSize.z, m_maxInnerBrickSize.x, m_maxInnerBrickSize.y, m_maxInnerBrickSize.z); int gpumax; GL(glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE_EXT, &gpumax)); // last element in the offset table contains all bricks until the // last level + that last level itself contains one brick m_iTotalBrickCount = *(m_vLoDOffsetTable.end()-1)+1; UINTVECTOR3 vTexSize; try { vTexSize = Fit1DIndexTo3DArray(m_iTotalBrickCount, gpumax); } catch (std::runtime_error const& e) { // this is very unlikely but not impossible T_ERROR(e.what()); throw; } m_vBrickMetadata.resize(vTexSize.volume()); std::fill(m_vBrickMetadata.begin(), m_vBrickMetadata.end(), BI_MISSING); std::stringstream ss; ss << "Creating brick metadata texture of size " << vTexSize.x << " x " << vTexSize.y << " x " << vTexSize.z << " to effectively hold " << m_iTotalBrickCount << " entries. " << "Consequently, " << vTexSize.volume() - m_iTotalBrickCount << " entries in " << "texture are wasted due to the 3D extension process."; MESSAGE(ss.str().c_str()); m_pPoolMetadataTexture = new GLTexture3D( vTexSize.x, vTexSize.y, vTexSize.z, GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, &m_vBrickMetadata[0] ); } struct { bool operator() (const PoolSlotData& i, const PoolSlotData& j) const { return (i.m_iTimeOfCreation < j.m_iTimeOfCreation); } } PoolSorter; void GLVolumePool::UploadMetadataTexture() { StackTimer poolmd(PERF_POOL_UPLOAD_METADATA); // DEBUG code /* MESSAGE("Brickpool Metadata entries:"); for (size_t i = 0; i BI_MISSING) used++; } MESSAGE("Pool Utilization %u/%u %g%%", used, m_PoolSlotData.size(), 100.0f*used/float(m_PoolSlotData.size())); // DEBUG code end */ #ifdef GLVOLUMEPOOL_PROFILE double const t = m_Timer.Elapsed(); #endif m_pPoolMetadataTexture->SetData(&m_vBrickMetadata[0]); #ifdef GLVOLUMEPOOL_PROFILE m_TimesMetaTextureUpload.Push(static_cast(m_Timer.Elapsed() - t)); #endif } void GLVolumePool::UploadMetadataTexel(uint32_t iBrickID) { StackTimer pooltexel(PERF_POOL_UPLOAD_TEXEL); UINTVECTOR3 texDim = m_pPoolMetadataTexture->GetSize(); UINTVECTOR3 const vSize(1, 1, 1); // size of single texel const uint32_t idx = iBrickID; const UINTVECTOR3 vOffset(idx % texDim[0], (idx/texDim[0]) % texDim[1], idx / (texDim[0] * texDim[1])); m_pPoolMetadataTexture->SetData(vOffset, vSize, &m_vBrickMetadata[iBrickID]); } void GLVolumePool::PrepareForPaging() { StackTimer ppage(PERF_POOL_SORT); std::sort(m_vPoolSlotData.begin(), m_vPoolSlotData.end(), PoolSorter); m_iInsertPos = 0; } namespace { template bool ContainsData(VisibilityState const& visibility, uint32_t iBrickID, std::vector const& vMinMaxScalar, std::vector const& vMinMaxGradient) { assert(eRenderMode == visibility.GetRenderMode()); static_assert(eRenderMode == AbstrRenderer::RM_1DTRANS || eRenderMode == AbstrRenderer::RM_2DTRANS || eRenderMode == AbstrRenderer::RM_ISOSURFACE, "render mode not supported"); switch (eRenderMode) { case AbstrRenderer::RM_1DTRANS: return (visibility.Get1DTransfer().fMax >= vMinMaxScalar[iBrickID].min && visibility.Get1DTransfer().fMin <= vMinMaxScalar[iBrickID].max); break; case AbstrRenderer::RM_2DTRANS: return (visibility.Get2DTransfer().fMax >= vMinMaxScalar[iBrickID].min && visibility.Get2DTransfer().fMin <= vMinMaxScalar[iBrickID].max) && (visibility.Get2DTransfer().fMaxGradient >= vMinMaxGradient[iBrickID].min && visibility.Get2DTransfer().fMinGradient <= vMinMaxGradient[iBrickID].max); break; case AbstrRenderer::RM_ISOSURFACE: return (visibility.GetIsoSurface().fIsoValue <= vMinMaxScalar[iBrickID].max); break; } return true; } template void RecomputeVisibilityForBrickPool( VisibilityState const& visibility, GLVolumePool const& pool, std::vector& vBrickMetadata, std::vector& vBrickPool, std::vector const& vMinMaxScalar, std::vector const& vMinMaxGradient) { assert(eRenderMode == visibility.GetRenderMode()); for (auto slot = vBrickPool.begin(); slot < vBrickPool.end(); slot++) { if (slot->WasEverUsed()) { bool const bContainsData = ContainsData(visibility, slot->m_iBrickID, vMinMaxScalar, vMinMaxGradient); bool const bContainedData = slot->ContainsVisibleBrick(); if (bContainsData) { if (!bContainedData) slot->Restore(); uint32_t const iPoolCoordinate = slot->PositionInPool().x + slot->PositionInPool().y * pool.GetPoolCapacity().x + slot->PositionInPool().z * pool.GetPoolCapacity().x * pool.GetPoolCapacity().y; vBrickMetadata[slot->m_iBrickID] = iPoolCoordinate + BI_FLAG_COUNT; } else { if (bContainedData) slot->FlagEmpty(); vBrickMetadata[slot->m_iBrickID] = BI_EMPTY; } } } // for all slots in brick pool } template UINTVECTOR4 RecomputeVisibilityForOctree( VisibilityState const& visibility, GLVolumePool const& pool, std::vector& vBrickMetadata, std::vector const& vMinMaxScalar, std::vector const& vMinMaxGradient, tuvok::ThreadClass::PredicateFunction pContinue = tuvok::ThreadClass::PredicateFunction()) { UINTVECTOR4 vEmptyBrickCount(0, 0, 0, 0); #ifndef _DEBUG uint32_t const iContinue = 375; // we approximately process 7500 bricks/ms, checking for interruption every 375 bricks allows us to pause in 0.05 ms (worst case) #else uint32_t const iContinue = 75; // we'll just get 1500 bricks/ms running a debug build #endif uint32_t const iLoDCount = pool.GetLoDCount(); UINTVECTOR3 iChildLayout = GetBrickLayout(pool.GetVolumeSize(), pool.GetMaxInnerBrickSize(), 0); // evaluate child visibility for finest level for (uint32_t z = 0; z < iChildLayout.z; z++) { for (uint32_t y = 0; y < iChildLayout.y; y++) { for (uint32_t x = 0; x < iChildLayout.x; x++) { if (bInterruptable && !(x % iContinue)/* && pContinue*/) if (!pContinue()) return vEmptyBrickCount; vEmptyBrickCount.x++; // increment total brick count UINTVECTOR4 const vBrickID(x, y, z, 0); uint32_t const brickIndex = pool.GetIntegerBrickID(vBrickID); if (vBrickMetadata[brickIndex] < BI_FLAG_COUNT) // only check bricks that are not cached in the pool { bool const bContainsData = ContainsData(visibility, brickIndex, vMinMaxScalar, vMinMaxGradient); if (!bContainsData) { vBrickMetadata[brickIndex] = BI_CHILD_EMPTY; // finest level bricks are all child empty by definition vEmptyBrickCount.w++; // increment leaf empty brick count } } } // for x } // for y } // for z // walk up hierarchy (from finest to coarsest level) and propagate child empty visibility for (uint32_t iLoD = 1; iLoD < iLoDCount; iLoD++) { UINTVECTOR3 const iLayout = GetBrickLayout(pool.GetVolumeSize(), pool.GetMaxInnerBrickSize(), iLoD); // process even-sized volume UINTVECTOR3 const iEvenLayout = iChildLayout / 2; for (uint32_t z = 0; z < iEvenLayout.z; z++) { for (uint32_t y = 0; y < iEvenLayout.y; y++) { for (uint32_t x = 0; x < iEvenLayout.x; x++) { if (bInterruptable && !(x % iContinue)/* && pContinue*/) if (!pContinue()) return vEmptyBrickCount; vEmptyBrickCount.x++; // increment total brick count UINTVECTOR4 const vBrickID(x, y, z, iLoD); uint32_t const brickIndex = pool.GetIntegerBrickID(vBrickID); if (vBrickMetadata[brickIndex] < BI_FLAG_COUNT) // only check bricks that are not cached in the pool { bool const bContainsData = ContainsData(visibility, brickIndex, vMinMaxScalar, vMinMaxGradient); if (!bContainsData) { vBrickMetadata[brickIndex] = BI_CHILD_EMPTY; // flag parent brick to be child empty for now so that we can save a couple of tests below UINTVECTOR4 const childPosition(x*2, y*2, z*2, iLoD-1); if ((vBrickMetadata[pool.GetIntegerBrickID(childPosition)] != BI_CHILD_EMPTY) || (vBrickMetadata[pool.GetIntegerBrickID(childPosition + UINTVECTOR4(0, 0, 1, 0))] != BI_CHILD_EMPTY) || (vBrickMetadata[pool.GetIntegerBrickID(childPosition + UINTVECTOR4(0, 1, 0, 0))] != BI_CHILD_EMPTY) || (vBrickMetadata[pool.GetIntegerBrickID(childPosition + UINTVECTOR4(0, 1, 1, 0))] != BI_CHILD_EMPTY) || (vBrickMetadata[pool.GetIntegerBrickID(childPosition + UINTVECTOR4(1, 0, 0, 0))] != BI_CHILD_EMPTY) || (vBrickMetadata[pool.GetIntegerBrickID(childPosition + UINTVECTOR4(1, 0, 1, 0))] != BI_CHILD_EMPTY) || (vBrickMetadata[pool.GetIntegerBrickID(childPosition + UINTVECTOR4(1, 1, 0, 0))] != BI_CHILD_EMPTY) || (vBrickMetadata[pool.GetIntegerBrickID(childPosition + UINTVECTOR4(1, 1, 1, 0))] != BI_CHILD_EMPTY)) { vBrickMetadata[brickIndex] = BI_EMPTY; // downgrade parent brick if we found a non child empty child vEmptyBrickCount.y++; // increment empty brick count } else { vEmptyBrickCount.z++; // increment child empty brick count } } } } // for x } // for y } // for z // process odd boundaries (if any) // plane at the end of the x-axis if (iChildLayout.x % 2) { for (uint32_t z = 0; z < iEvenLayout.z; z++) { for (uint32_t y = 0; y < iEvenLayout.y; y++) { if (bInterruptable && !(y % iContinue)/* && pContinue*/) if (!pContinue()) return vEmptyBrickCount; vEmptyBrickCount.x++; // increment total brick count uint32_t const x = iLayout.x - 1; UINTVECTOR4 const vBrickID(x, y, z, iLoD); uint32_t const brickIndex = pool.GetIntegerBrickID(vBrickID); if (vBrickMetadata[brickIndex] < BI_FLAG_COUNT) // only check bricks that are not cached in the pool { bool const bContainsData = ContainsData(visibility, brickIndex, vMinMaxScalar, vMinMaxGradient); if (!bContainsData) { vBrickMetadata[brickIndex] = BI_CHILD_EMPTY; // flag parent brick to be child empty for now so that we can save a couple of tests below UINTVECTOR4 const childPosition(x*2, y*2, z*2, iLoD-1); if ((vBrickMetadata[pool.GetIntegerBrickID(childPosition)] != BI_CHILD_EMPTY) || (vBrickMetadata[pool.GetIntegerBrickID(childPosition + UINTVECTOR4(0, 0, 1, 0))] != BI_CHILD_EMPTY) || (vBrickMetadata[pool.GetIntegerBrickID(childPosition + UINTVECTOR4(0, 1, 0, 0))] != BI_CHILD_EMPTY) || (vBrickMetadata[pool.GetIntegerBrickID(childPosition + UINTVECTOR4(0, 1, 1, 0))] != BI_CHILD_EMPTY)) { vBrickMetadata[brickIndex] = BI_EMPTY; // downgrade parent brick if we found a non child empty child vEmptyBrickCount.y++; // increment empty brick count } else { vEmptyBrickCount.z++; // increment child empty brick count } } } } // for y } // for z } // if x is odd // plane at the end of the y-axis if (iChildLayout.y % 2) { for (uint32_t z = 0; z < iEvenLayout.z; z++) { for (uint32_t x = 0; x < iEvenLayout.x; x++) { if (bInterruptable && !(x % iContinue)/* && pContinue*/) if (!pContinue()) return vEmptyBrickCount; vEmptyBrickCount.x++; // increment total brick count uint32_t const y = iLayout.y - 1; UINTVECTOR4 const vBrickID(x, y, z, iLoD); uint32_t const brickIndex = pool.GetIntegerBrickID(vBrickID); if (vBrickMetadata[brickIndex] < BI_FLAG_COUNT) // only check bricks that are not cached in the pool { bool const bContainsData = ContainsData(visibility, brickIndex, vMinMaxScalar, vMinMaxGradient); if (!bContainsData) { vBrickMetadata[brickIndex] = BI_CHILD_EMPTY; // flag parent brick to be child empty for now so that we can save a couple of tests below UINTVECTOR4 const childPosition(x*2, y*2, z*2, iLoD-1); if ((vBrickMetadata[pool.GetIntegerBrickID(childPosition)] != BI_CHILD_EMPTY) || (vBrickMetadata[pool.GetIntegerBrickID(childPosition + UINTVECTOR4(0, 0, 1, 0))] != BI_CHILD_EMPTY) || (vBrickMetadata[pool.GetIntegerBrickID(childPosition + UINTVECTOR4(1, 0, 0, 0))] != BI_CHILD_EMPTY) || (vBrickMetadata[pool.GetIntegerBrickID(childPosition + UINTVECTOR4(1, 0, 1, 0))] != BI_CHILD_EMPTY)) { vBrickMetadata[brickIndex] = BI_EMPTY; // downgrade parent brick if we found a non-empty child vEmptyBrickCount.y++; // increment empty brick count } else { vEmptyBrickCount.z++; // increment child empty brick count } } } } // for x } // for z } // if y is odd // plane at the end of the z-axis if (iChildLayout.z % 2) { for (uint32_t y = 0; y < iEvenLayout.y; y++) { for (uint32_t x = 0; x < iEvenLayout.x; x++) { if (bInterruptable && !(x % iContinue)/* && pContinue*/) if (!pContinue()) return vEmptyBrickCount; vEmptyBrickCount.x++; // increment total brick count uint32_t const z = iLayout.z - 1; UINTVECTOR4 const vBrickID(x, y, z, iLoD); uint32_t const brickIndex = pool.GetIntegerBrickID(vBrickID); if (vBrickMetadata[brickIndex] < BI_FLAG_COUNT) // only check bricks that are not cached in the pool { bool const bContainsData = ContainsData(visibility, brickIndex, vMinMaxScalar, vMinMaxGradient); if (!bContainsData) { vBrickMetadata[brickIndex] = BI_CHILD_EMPTY; // flag parent brick to be child empty for now so that we can save a couple of tests below UINTVECTOR4 const childPosition(x*2, y*2, z*2, iLoD-1); if ((vBrickMetadata[pool.GetIntegerBrickID(childPosition)] != BI_CHILD_EMPTY) || (vBrickMetadata[pool.GetIntegerBrickID(childPosition + UINTVECTOR4(0, 1, 0, 0))] != BI_CHILD_EMPTY) || (vBrickMetadata[pool.GetIntegerBrickID(childPosition + UINTVECTOR4(1, 0, 0, 0))] != BI_CHILD_EMPTY) || (vBrickMetadata[pool.GetIntegerBrickID(childPosition + UINTVECTOR4(1, 1, 0, 0))] != BI_CHILD_EMPTY)) { vBrickMetadata[brickIndex] = BI_EMPTY; // downgrade parent brick if we found a non-empty child vEmptyBrickCount.y++; // increment empty brick count } else { vEmptyBrickCount.z++; // increment child empty brick count } } } } // for x } // for y } // if z is odd // line at the end of the x/y-axes if (iChildLayout.x % 2 && iChildLayout.y % 2) { for (uint32_t z = 0; z < iEvenLayout.z; z++) { if (bInterruptable && !(z % iContinue)/* && pContinue*/) if (!pContinue()) return vEmptyBrickCount; vEmptyBrickCount.x++; // increment total brick count uint32_t const y = iLayout.y - 1; uint32_t const x = iLayout.x - 1; UINTVECTOR4 const vBrickID(x, y, z, iLoD); uint32_t const brickIndex = pool.GetIntegerBrickID(vBrickID); if (vBrickMetadata[brickIndex] < BI_FLAG_COUNT) // only check bricks that are not cached in the pool { bool const bContainsData = ContainsData(visibility, brickIndex, vMinMaxScalar, vMinMaxGradient); if (!bContainsData) { vBrickMetadata[brickIndex] = BI_CHILD_EMPTY; // flag parent brick to be child empty for now so that we can save a couple of tests below UINTVECTOR4 const childPosition(x*2, y*2, z*2, iLoD-1); if ((vBrickMetadata[pool.GetIntegerBrickID(childPosition)] != BI_CHILD_EMPTY) || (vBrickMetadata[pool.GetIntegerBrickID(childPosition + UINTVECTOR4(0, 0, 1, 0))] != BI_CHILD_EMPTY)) { vBrickMetadata[brickIndex] = BI_EMPTY; // downgrade parent brick if we found a non-empty child vEmptyBrickCount.y++; // increment empty brick count } else { vEmptyBrickCount.z++; // increment child empty brick count } } } } // for z } // if x and y are odd // line at the end of the x/z-axes if (iChildLayout.x % 2 && iChildLayout.z % 2) { for (uint32_t y = 0; y < iEvenLayout.y; y++) { if (bInterruptable && !(y % iContinue)/* && pContinue*/) if (!pContinue()) return vEmptyBrickCount; vEmptyBrickCount.x++; // increment total brick count uint32_t const z = iLayout.z - 1; uint32_t const x = iLayout.x - 1; UINTVECTOR4 const vBrickID(x, y, z, iLoD); uint32_t const brickIndex = pool.GetIntegerBrickID(vBrickID); if (vBrickMetadata[brickIndex] < BI_FLAG_COUNT) // only check bricks that are not cached in the pool { bool const bContainsData = ContainsData(visibility, brickIndex, vMinMaxScalar, vMinMaxGradient); if (!bContainsData) { vBrickMetadata[brickIndex] = BI_CHILD_EMPTY; // flag parent brick to be child empty for now so that we can save a couple of tests below UINTVECTOR4 const childPosition(x*2, y*2, z*2, iLoD-1); if ((vBrickMetadata[pool.GetIntegerBrickID(childPosition)] != BI_CHILD_EMPTY) || (vBrickMetadata[pool.GetIntegerBrickID(childPosition + UINTVECTOR4(0, 1, 0, 0))] != BI_CHILD_EMPTY)) { vBrickMetadata[brickIndex] = BI_EMPTY; // downgrade parent brick if we found a non-empty child vEmptyBrickCount.y++; // increment empty brick count } else { vEmptyBrickCount.z++; // increment child empty brick count } } } } // for y } // if x and z are odd // line at the end of the y/z-axes if (iChildLayout.y % 2 && iChildLayout.z % 2) { for (uint32_t x = 0; x < iEvenLayout.x; x++) { if (bInterruptable && !(x % iContinue)/* && pContinue*/) if (!pContinue()) return vEmptyBrickCount; vEmptyBrickCount.x++; // increment total brick count uint32_t const z = iLayout.z - 1; uint32_t const y = iLayout.y - 1; UINTVECTOR4 const vBrickID(x, y, z, iLoD); uint32_t const brickIndex = pool.GetIntegerBrickID(vBrickID); if (vBrickMetadata[brickIndex] < BI_FLAG_COUNT) // only check bricks that are not cached in the pool { bool const bContainsData = ContainsData(visibility, brickIndex, vMinMaxScalar, vMinMaxGradient); if (!bContainsData) { vBrickMetadata[brickIndex] = BI_CHILD_EMPTY; // flag parent brick to be child empty for now so that we can save a couple of tests below UINTVECTOR4 const childPosition(x*2, y*2, z*2, iLoD-1); if ((vBrickMetadata[pool.GetIntegerBrickID(childPosition)] != BI_CHILD_EMPTY) || (vBrickMetadata[pool.GetIntegerBrickID(childPosition + UINTVECTOR4(1, 0, 0, 0))] != BI_CHILD_EMPTY)) { vBrickMetadata[brickIndex] = BI_EMPTY; // downgrade parent brick if we found a non-empty child vEmptyBrickCount.y++; // increment empty brick count } else { vEmptyBrickCount.z++; // increment child empty brick count } } } } // for x } // if y and z are odd // single brick at the x/y/z corner if (iChildLayout.x % 2 && iChildLayout.y % 2 && iChildLayout.z % 2) { if (bInterruptable /* && pContinue*/) if (!pContinue()) return vEmptyBrickCount; vEmptyBrickCount.x++; // increment total brick count uint32_t const z = iLayout.z - 1; uint32_t const y = iLayout.y - 1; uint32_t const x = iLayout.x - 1; UINTVECTOR4 const vBrickID(x, y, z, iLoD); uint32_t const brickIndex = pool.GetIntegerBrickID(vBrickID); if (vBrickMetadata[brickIndex] < BI_FLAG_COUNT) // only check bricks that are not cached in the pool { bool const bContainsData = ContainsData(visibility, brickIndex, vMinMaxScalar, vMinMaxGradient); if (!bContainsData) { vBrickMetadata[brickIndex] = BI_CHILD_EMPTY; // flag parent brick to be child empty for now so that we can save a couple of tests below UINTVECTOR4 const childPosition(x*2, y*2, z*2, iLoD-1); if (vBrickMetadata[pool.GetIntegerBrickID(childPosition)] != BI_CHILD_EMPTY) { vBrickMetadata[brickIndex] = BI_EMPTY; // downgrade parent brick if we found a non-empty child vEmptyBrickCount.y++; // increment empty brick count } else { vEmptyBrickCount.z++; // increment child empty brick count } } } } // if x, y and z are odd iChildLayout = iLayout; } // for all levels return vEmptyBrickCount; } template uint32_t UploadBricksToBrickPoolT( GLVolumePool& pool, std::vector const& vBrickIDs, const LinearIndexDataset* pDataset, size_t iTimestep, const size_t maxUsedBrickVoxelCount // we pass it in here to avoid the pDataset->GetMaxUsedBrickSize() loop over all bricks ) { uint32_t iPagedBricks = 0; std::vector vUploadMem(maxUsedBrickVoxelCount); Timer t; for (auto missingBrick = vBrickIDs.cbegin(); missingBrick < vBrickIDs.cend(); missingBrick++) { UINTVECTOR4 const& vBrickID = *missingBrick; BrickKey const key = pDataset->IndexFrom4D(vBrickID, iTimestep); UINTVECTOR3 const vVoxelSize = pDataset->GetBrickVoxelCounts(key); // upload brick core { tuvok::StackTimer poolGetBrick(PERF_POOL_GET_BRICK); pDataset->GetBrick(key, vUploadMem); } if (brickDebug) { writeBrick(key, vUploadMem); } if (!pool.UploadBrick(BrickElemInfo(vBrickID, vVoxelSize), &vUploadMem[0])) break; else iPagedBricks++; tuvok::Controller::Instance().IncrementPerfCounter(PERF_POOL_UPLOADED_MEM, double(vUploadMem.size() * sizeof(T))); } return iPagedBricks; } uint32_t UploadBricksToBrickPool( GLVolumePool& pool, const std::vector& vBrickIDs, const LinearIndexDataset* pDataset, size_t iTimestep, const size_t maxUsedBrickVoxelCount, // we pass it in here to avoid the pDataset->GetMaxUsedBrickSize() loop over all bricks bool brickDebug ) { unsigned int const iBitWidth = pDataset->GetBitWidth(); if (brickDebug) { // brick debugging enabled if (!pDataset->GetIsSigned()) { switch (iBitWidth) { case 8 : return UploadBricksToBrickPoolT(pool, vBrickIDs, pDataset, iTimestep, maxUsedBrickVoxelCount); case 16 : return UploadBricksToBrickPoolT(pool, vBrickIDs, pDataset, iTimestep, maxUsedBrickVoxelCount); case 32 : return UploadBricksToBrickPoolT(pool, vBrickIDs, pDataset, iTimestep, maxUsedBrickVoxelCount); default : throw Exception("Invalid bit width for an unsigned dataset", _func_, __LINE__); } } else if (pDataset->GetIsFloat()) { switch (iBitWidth) { case 32 : return UploadBricksToBrickPoolT(pool, vBrickIDs, pDataset, iTimestep, maxUsedBrickVoxelCount); case 64 : return UploadBricksToBrickPoolT(pool, vBrickIDs, pDataset, iTimestep, maxUsedBrickVoxelCount); default : throw Exception("Invalid bit width for a float dataset", _func_, __LINE__); } } else { switch (iBitWidth) { case 8 : return UploadBricksToBrickPoolT(pool, vBrickIDs, pDataset, iTimestep, maxUsedBrickVoxelCount); case 16 : return UploadBricksToBrickPoolT(pool, vBrickIDs, pDataset, iTimestep, maxUsedBrickVoxelCount); case 32 : return UploadBricksToBrickPoolT(pool, vBrickIDs, pDataset, iTimestep, maxUsedBrickVoxelCount); default : throw Exception("Invalid bit width for a signed dataset", _func_, __LINE__); } } } else { // brick debugging disabled if (!pDataset->GetIsSigned()) { switch (iBitWidth) { case 8 : return UploadBricksToBrickPoolT(pool, vBrickIDs, pDataset, iTimestep, maxUsedBrickVoxelCount); case 16 : return UploadBricksToBrickPoolT(pool, vBrickIDs, pDataset, iTimestep, maxUsedBrickVoxelCount); case 32 : return UploadBricksToBrickPoolT(pool, vBrickIDs, pDataset, iTimestep, maxUsedBrickVoxelCount); default : throw Exception("Invalid bit width for an unsigned dataset", _func_, __LINE__); } } else if (pDataset->GetIsFloat()) { switch (iBitWidth) { case 32 : return UploadBricksToBrickPoolT(pool, vBrickIDs, pDataset, iTimestep, maxUsedBrickVoxelCount); case 64 : return UploadBricksToBrickPoolT(pool, vBrickIDs, pDataset, iTimestep, maxUsedBrickVoxelCount); default : throw Exception("Invalid bit width for a float dataset", _func_, __LINE__); } } else { switch (iBitWidth) { case 8 : return UploadBricksToBrickPoolT(pool, vBrickIDs, pDataset, iTimestep, maxUsedBrickVoxelCount); case 16 : return UploadBricksToBrickPoolT(pool, vBrickIDs, pDataset, iTimestep, maxUsedBrickVoxelCount); case 32 : return UploadBricksToBrickPoolT(pool, vBrickIDs, pDataset, iTimestep, maxUsedBrickVoxelCount); default : throw Exception("Invalid bit width for a signed dataset", _func_, __LINE__); } } } //return 0; } template uint32_t PotentiallyUploadBricksToBrickPoolT( const VisibilityState& visibility, const LinearIndexDataset* pDataset, size_t iTimestep, GLVolumePool& pool, std::vector& vBrickMetadata, const std::vector& vBrickIDs, const std::vector& vMinMaxScalar, const std::vector& vMinMaxGradient, const size_t maxUsedBrickVoxelCount // we pass it in here to avoid the pDataset->GetMaxUsedBrickSize() loop over all bricks ) { uint32_t iPagedBricks = 0; std::vector vUploadMem(maxUsedBrickVoxelCount); // now iterate over the missing bricks and upload them to the GPU // todo: consider batching this if it turns out to make a difference // from submitting each brick separately Timer t; for (auto missingBrick = vBrickIDs.cbegin(); missingBrick < vBrickIDs.cend(); missingBrick++) { UINTVECTOR4 const& vBrickID = *missingBrick; BrickKey const key = pDataset->IndexFrom4D(vBrickID, iTimestep); UINTVECTOR3 const vVoxelSize = pDataset->GetBrickVoxelCounts(key); uint32_t const brickIndex = pool.GetIntegerBrickID(vBrickID); // the brick could be flagged as empty by now if the async updater tested the brick after we ran the last render pass if (vBrickMetadata[brickIndex] == BI_MISSING) { // we might not have tested the brick for visibility yet since the updater's still running and we do not have a BI_UNKNOWN flag for now bool const bContainsData = ContainsData(visibility, brickIndex, vMinMaxScalar, vMinMaxGradient); if (bContainsData) { // upload brick core { tuvok::StackTimer poolGetBrick(PERF_POOL_GET_BRICK); pDataset->GetBrick(key, vUploadMem); } if(brickDebug) { writeBrick(key, vUploadMem); } if (!pool.UploadBrick(BrickElemInfo(vBrickID, vVoxelSize), &vUploadMem[0])) return iPagedBricks; else iPagedBricks++; tuvok::Controller::Instance().IncrementPerfCounter(PERF_POOL_UPLOADED_MEM, double(vUploadMem.size() * sizeof(T))); } else { vBrickMetadata[brickIndex] = BI_EMPTY; pool.UploadMetadataTexel(brickIndex); } } else if (vBrickMetadata[brickIndex] < BI_FLAG_COUNT) { // if the updater touched the brick in the meanwhile, we need to upload the meta texel pool.UploadMetadataTexel(brickIndex); } else { assert(false); // should never happen } } return iPagedBricks; } template uint32_t PotentiallyUploadBricksToBrickPool( const VisibilityState& visibility, const LinearIndexDataset* pDataset, size_t iTimestep, GLVolumePool& pool, std::vector& vBrickMetadata, const std::vector& vBrickIDs, const std::vector& vMinMaxScalar, const std::vector& vMinMaxGradient, const size_t maxUsedBrickVoxelCount, // we pass it in here to avoid the pDataset->GetMaxUsedBrickSize() loop over all bricks bool brickDebug ) { unsigned int const iBitWidth = pDataset->GetBitWidth(); if (brickDebug) { // brick debugging enabled if (!pDataset->GetIsSigned()) { switch (iBitWidth) { case 8 : return PotentiallyUploadBricksToBrickPoolT(visibility, pDataset, iTimestep, pool, vBrickMetadata, vBrickIDs, vMinMaxScalar, vMinMaxGradient, maxUsedBrickVoxelCount); case 16 : return PotentiallyUploadBricksToBrickPoolT(visibility, pDataset, iTimestep, pool, vBrickMetadata, vBrickIDs, vMinMaxScalar, vMinMaxGradient, maxUsedBrickVoxelCount); case 32 : return PotentiallyUploadBricksToBrickPoolT(visibility, pDataset, iTimestep, pool, vBrickMetadata, vBrickIDs, vMinMaxScalar, vMinMaxGradient, maxUsedBrickVoxelCount); default : throw Exception("Invalid bit width for an unsigned dataset", _func_, __LINE__); } } else if (pDataset->GetIsFloat()) { switch (iBitWidth) { case 32 : return PotentiallyUploadBricksToBrickPoolT(visibility, pDataset, iTimestep, pool, vBrickMetadata, vBrickIDs, vMinMaxScalar, vMinMaxGradient, maxUsedBrickVoxelCount); case 64 : return PotentiallyUploadBricksToBrickPoolT(visibility, pDataset, iTimestep, pool, vBrickMetadata, vBrickIDs, vMinMaxScalar, vMinMaxGradient, maxUsedBrickVoxelCount); default : throw Exception("Invalid bit width for a float dataset", _func_, __LINE__); } } else { switch (iBitWidth) { case 8 : return PotentiallyUploadBricksToBrickPoolT(visibility, pDataset, iTimestep, pool, vBrickMetadata, vBrickIDs, vMinMaxScalar, vMinMaxGradient, maxUsedBrickVoxelCount); case 16 : return PotentiallyUploadBricksToBrickPoolT(visibility, pDataset, iTimestep, pool, vBrickMetadata, vBrickIDs, vMinMaxScalar, vMinMaxGradient, maxUsedBrickVoxelCount); case 32 : return PotentiallyUploadBricksToBrickPoolT(visibility, pDataset, iTimestep, pool, vBrickMetadata, vBrickIDs, vMinMaxScalar, vMinMaxGradient, maxUsedBrickVoxelCount); default : throw Exception("Invalid bit width for a signed dataset", _func_, __LINE__); } } } else { // brick debugging disabled if (!pDataset->GetIsSigned()) { switch (iBitWidth) { case 8 : return PotentiallyUploadBricksToBrickPoolT(visibility, pDataset, iTimestep, pool, vBrickMetadata, vBrickIDs, vMinMaxScalar, vMinMaxGradient, maxUsedBrickVoxelCount); case 16 : return PotentiallyUploadBricksToBrickPoolT(visibility, pDataset, iTimestep, pool, vBrickMetadata, vBrickIDs, vMinMaxScalar, vMinMaxGradient, maxUsedBrickVoxelCount); case 32 : return PotentiallyUploadBricksToBrickPoolT(visibility, pDataset, iTimestep, pool, vBrickMetadata, vBrickIDs, vMinMaxScalar, vMinMaxGradient, maxUsedBrickVoxelCount); default : throw Exception("Invalid bit width for an unsigned dataset", _func_, __LINE__); } } else if (pDataset->GetIsFloat()) { switch (iBitWidth) { case 32 : return PotentiallyUploadBricksToBrickPoolT(visibility, pDataset, iTimestep, pool, vBrickMetadata, vBrickIDs, vMinMaxScalar, vMinMaxGradient, maxUsedBrickVoxelCount); case 64 : return PotentiallyUploadBricksToBrickPoolT(visibility, pDataset, iTimestep, pool, vBrickMetadata, vBrickIDs, vMinMaxScalar, vMinMaxGradient, maxUsedBrickVoxelCount); default : throw Exception("Invalid bit width for a float dataset", _func_, __LINE__); } } else { switch (iBitWidth) { case 8 : return PotentiallyUploadBricksToBrickPoolT(visibility, pDataset, iTimestep, pool, vBrickMetadata, vBrickIDs, vMinMaxScalar, vMinMaxGradient, maxUsedBrickVoxelCount); case 16 : return PotentiallyUploadBricksToBrickPoolT(visibility, pDataset, iTimestep, pool, vBrickMetadata, vBrickIDs, vMinMaxScalar, vMinMaxGradient, maxUsedBrickVoxelCount); case 32 : return PotentiallyUploadBricksToBrickPoolT(visibility, pDataset, iTimestep, pool, vBrickMetadata, vBrickIDs, vMinMaxScalar, vMinMaxGradient, maxUsedBrickVoxelCount); default : throw Exception("Invalid bit width for a signed dataset", _func_, __LINE__); } } } //return 0; } } // anonymous namespace UINTVECTOR4 GLVolumePool::RecomputeVisibility(VisibilityState const& visibility, size_t iTimestep, bool bForceSynchronousUpdate) { // (totalProcessedBrickCount, emptyBrickCount, childEmptyBrickCount) UINTVECTOR4 vEmptyBrickCount(0, 0, 0, 0); if (m_eDebugMode == DM_NOEMPTYSPACELEAPING) { m_bVisibilityUpdated = true; return vEmptyBrickCount; } #ifdef GLVOLUMEPOOL_PROFILE m_Timer.Start(); #endif // pause async updater because we will touch the meta data if (m_pUpdater) m_pUpdater->Pause(); // fill minmax scalar acceleration data structure if timestep changed if (m_iMinMaxScalarTimestep != iTimestep) { m_iMinMaxScalarTimestep = iTimestep; for (uint32_t iBrickID = 0; iBrickID < m_vMinMaxScalar.size(); iBrickID++) { UINTVECTOR4 const vBrickID = GetVectorBrickID(iBrickID); BrickKey const key = m_pDataset->IndexFrom4D(vBrickID, m_iMinMaxScalarTimestep); MinMaxBlock imme = m_pDataset->MaxMinForKey(key); m_vMinMaxScalar[iBrickID].min = imme.minScalar; m_vMinMaxScalar[iBrickID].max = imme.maxScalar; } } // fill minmax gradient acceleration data structure if needed and timestep changed if (visibility.GetRenderMode() == AbstrRenderer::RM_2DTRANS) { if (m_iMinMaxGradientTimestep != iTimestep || m_vMinMaxGradient.empty()) { if (m_vMinMaxGradient.empty()) m_vMinMaxGradient.resize(m_iTotalBrickCount); m_iMinMaxGradientTimestep = iTimestep; for (uint32_t iBrickID = 0; iBrickID < m_vMinMaxScalar.size(); iBrickID++) { UINTVECTOR4 const vBrickID = GetVectorBrickID(iBrickID); BrickKey const key = m_pDataset->IndexFrom4D(vBrickID, m_iMinMaxGradientTimestep); MinMaxBlock imme = m_pDataset->MaxMinForKey(key); m_vMinMaxGradient[iBrickID].min = imme.minGradient; m_vMinMaxGradient[iBrickID].max = imme.maxGradient; } } } // reset meta data for all bricks (BI_MISSING means that we haven't test the data for visibility until the async updater finishes) std::fill(m_vBrickMetadata.begin(), m_vBrickMetadata.end(), BI_MISSING); // TODO: if metadata texture grows too large (14 ms CPU update time for approx 2000x2000 texture) consider to // update texel regions efficiently that will be toched by RecomputeVisibilityForBrickPool() // updating every single texel turned out to be not efficient in this case /* m_pPoolMetadataTexture->Write(); GL(glClearColor(0, 0, 0, 0)); // clears metadata texture to BI_MISSING that equals zero GL(glClear(GL_COLOR_BUFFER_BIT)); m_pPoolMetadataTexture->FinishWrite(); */ #ifdef GLVOLUMEPOOL_PROFILE double const t = m_Timer.Elapsed(); #endif // recompute visibility for cached bricks immediately switch (visibility.GetRenderMode()) { case AbstrRenderer::RM_1DTRANS: RecomputeVisibilityForBrickPool(visibility, *this, m_vBrickMetadata, m_vPoolSlotData, m_vMinMaxScalar, m_vMinMaxGradient); break; case AbstrRenderer::RM_2DTRANS: RecomputeVisibilityForBrickPool(visibility, *this, m_vBrickMetadata, m_vPoolSlotData, m_vMinMaxScalar, m_vMinMaxGradient); break; case AbstrRenderer::RM_ISOSURFACE: RecomputeVisibilityForBrickPool(visibility, *this, m_vBrickMetadata, m_vPoolSlotData, m_vMinMaxScalar, m_vMinMaxGradient); break; default: T_ERROR("Unhandled rendering mode."); return vEmptyBrickCount; } #ifdef GLVOLUMEPOOL_PROFILE m_TimesRecomputeVisibilityForBrickPool.Push(m_Timer.Elapsed() - t); #endif if (!m_pUpdater || bForceSynchronousUpdate) { // recompute visibility for the entire hierarchy immediately switch (visibility.GetRenderMode()) { case AbstrRenderer::RM_1DTRANS: vEmptyBrickCount = RecomputeVisibilityForOctree(visibility, *this, m_vBrickMetadata, m_vMinMaxScalar, m_vMinMaxGradient); break; case AbstrRenderer::RM_2DTRANS: vEmptyBrickCount = RecomputeVisibilityForOctree(visibility, *this, m_vBrickMetadata, m_vMinMaxScalar, m_vMinMaxGradient); break; case AbstrRenderer::RM_ISOSURFACE: vEmptyBrickCount = RecomputeVisibilityForOctree(visibility, *this, m_vBrickMetadata, m_vMinMaxScalar, m_vMinMaxGradient); break; default: T_ERROR("Unhandled rendering mode."); return vEmptyBrickCount; } m_bVisibilityUpdated = true; // will be true after we uploaded the metadata texture in the next line if (vEmptyBrickCount.x != m_iTotalBrickCount) { WARNING("%u of %u bricks were processed during synchronous visibility recomputation!"); } uint32_t const iLeafBrickCount = m_pDataset->GetBrickLayout(0, 0).volume(); uint32_t const iInternalBrickCount = m_iTotalBrickCount - iLeafBrickCount; MESSAGE("Synchronously recomputed brick visibility for %u bricks", vEmptyBrickCount.x); MESSAGE("%u inner bricks are EMPTY (%.2f%% of inner bricks, %.2f%% of all bricks)", vEmptyBrickCount.y, (static_cast(vEmptyBrickCount.y)/iInternalBrickCount)*100.0f, (static_cast(vEmptyBrickCount.y)/m_iTotalBrickCount)*100.0f); MESSAGE("%u inner bricks are CHILD_EMPTY (%.2f%% of inner bricks, %.2f%% of all bricks)", vEmptyBrickCount.z, (static_cast(vEmptyBrickCount.z)/iInternalBrickCount)*100.0f, (static_cast(vEmptyBrickCount.z)/m_iTotalBrickCount)*100.0f); MESSAGE("%u leaf bricks are empty (%.2f%% of leaf bricks, %.2f%% of all bricks)", vEmptyBrickCount.w, (static_cast(vEmptyBrickCount.w)/iLeafBrickCount)*100.0f, (static_cast(vEmptyBrickCount.w)/m_iTotalBrickCount)*100.0f); } // upload new metadata to GPU UploadMetadataTexture(); // restart async updater because visibility changed if (m_pUpdater && !bForceSynchronousUpdate) { m_pUpdater->Restart(visibility); m_bVisibilityUpdated = false; OTHER("computed visibility for %d bricks in volume pool and started async visibility update for the entire hierarchy", m_vPoolSlotData.size()); } #ifdef GLVOLUMEPOOL_PROFILE m_TimesRecomputeVisibility.Push(static_cast(m_Timer.Elapsed())); OTHER("recompute visibility for brick pool [avg: %.2f, min: %.2f, max: %.2f, samples: %d]" , m_TimesRecomputeVisibilityForBrickPool.GetAvg(), m_TimesRecomputeVisibilityForBrickPool.GetMin(), m_TimesRecomputeVisibilityForBrickPool.GetMax(), m_TimesRecomputeVisibilityForBrickPool.GetHistroryLength()); OTHER("meta texture (%.4f MB) upload cost [avg: %.2f, min: %.2f, max: %.2f, samples: %d]" , m_pPoolMetadataTexture->GetCPUSize() / 1024.0f / 1024.0f, m_TimesMetaTextureUpload.GetAvg(), m_TimesMetaTextureUpload.GetMin(), m_TimesMetaTextureUpload.GetMax(), m_TimesMetaTextureUpload.GetHistroryLength()); OTHER("recompute visibility cost [avg: %.2f, min: %.2f, max: %.2f, samples: %d]" , m_TimesRecomputeVisibility.GetAvg(), m_TimesRecomputeVisibility.GetMin(), m_TimesRecomputeVisibility.GetMax(), m_TimesRecomputeVisibility.GetHistroryLength()); #endif return vEmptyBrickCount; } uint32_t GLVolumePool::UploadBricks(const std::vector& vBrickIDs, bool brickDebug) { // pause async updater because we will touch the meta data bool const bBusy = m_pUpdater && m_pUpdater->Pause(); uint32_t iPagedBricks = 0; StackTimer brick_upload(PERF_UPLOAD_BRICKS); if (!vBrickIDs.empty()) { PrepareForPaging(); if (!m_bVisibilityUpdated) { VisibilityState const& visibility = m_pUpdater->GetVisibility(); switch (visibility.GetRenderMode()) { case AbstrRenderer::RM_1DTRANS: iPagedBricks = PotentiallyUploadBricksToBrickPool( visibility, m_pDataset, m_iMinMaxScalarTimestep, *this, m_vBrickMetadata, vBrickIDs, m_vMinMaxScalar, m_vMinMaxGradient, m_iMaxUsedBrickVoxelCount, brickDebug ); break; case AbstrRenderer::RM_2DTRANS: iPagedBricks = PotentiallyUploadBricksToBrickPool( visibility, m_pDataset, m_iMinMaxScalarTimestep, *this, m_vBrickMetadata, vBrickIDs, m_vMinMaxScalar, m_vMinMaxGradient, m_iMaxUsedBrickVoxelCount, brickDebug ); break; case AbstrRenderer::RM_ISOSURFACE: iPagedBricks = PotentiallyUploadBricksToBrickPool( visibility, m_pDataset, m_iMinMaxScalarTimestep, *this, m_vBrickMetadata, vBrickIDs, m_vMinMaxScalar, m_vMinMaxGradient, m_iMaxUsedBrickVoxelCount, brickDebug ); break; default: T_ERROR("Unhandled rendering mode."); return iPagedBricks; } } else { // visibility is updated guaranteeing that requested bricks do contain data iPagedBricks = UploadBricksToBrickPool( *this, vBrickIDs, m_pDataset, m_iMinMaxScalarTimestep, m_iMaxUsedBrickVoxelCount, brickDebug); } } if (bBusy && !m_bVisibilityUpdated) { m_pUpdater->Resume(); // resume async updater if we were busy } else { if (!m_bVisibilityUpdated) { UploadMetadataTexture(); // we want to upload the whole meta texture when async updater is done m_bVisibilityUpdated = true; // must be set one frame delayed otherwise we might upload empty bricks #ifdef GLVOLUMEPOOL_PROFILE AsyncVisibilityUpdater::Stats const& stats = m_pUpdater->GetStats(); OTHER("async visibility update completed for %d bricks in %.2f ms excluding %d interruptions that cost %.3f ms (%.2f bricks/ms)" , m_iTotalBrickCount, stats.fTimeTotal - stats.fTimeInterruptions, stats.iInterruptions, stats.fTimeInterruptions, m_iTotalBrickCount/(stats.fTimeTotal - stats.fTimeInterruptions)); #else OTHER("async visibility update completed for %d bricks", m_iTotalBrickCount); #endif } } return iPagedBricks; } AsyncVisibilityUpdater::AsyncVisibilityUpdater(GLVolumePool& parent) : m_Pool(parent) , m_Visibility() , m_eState(Idle) { StartThread(); } AsyncVisibilityUpdater::~AsyncVisibilityUpdater() { RequestThreadStop(); Resume(); JoinThread(); } void AsyncVisibilityUpdater::Restart(VisibilityState const& visibility) { SCOPEDLOCK(m_StateGuard); Pause(); m_Visibility = visibility; if (m_Pool.m_eDebugMode != GLVolumePool::DM_BUSY) { m_eState = RestartRequested; Resume(); // restart worker } } bool AsyncVisibilityUpdater::Pause() { SCOPEDLOCK(m_StateGuard); while (m_eState != Paused && m_eState != Idle) { m_eState = PauseRequested; Resume(); // wake up worker to update its state if necessary m_Parent.Wait(m_StateGuard); // wait until worker is paused } if (m_Pool.m_eDebugMode != GLVolumePool::DM_BUSY) { return m_eState != Idle; } else { return true; } } void AsyncVisibilityUpdater::Resume() { m_Worker.WakeOne(); // resume worker } bool AsyncVisibilityUpdater::Continue() { if (!m_bContinue) // check if thread should terminate return false; #ifdef GLVOLUMEPOOL_PROFILE double t = m_Timer.Elapsed(); #endif SCOPEDLOCK(m_StateGuard); if (m_eState == PauseRequested) { m_eState = Paused; m_Parent.WakeOne(); // wake up parent because worker just paused m_Worker.Wait(m_StateGuard); // wait until parent wakes worker to continue #ifdef GLVOLUMEPOOL_PROFILE m_Stats.iInterruptions++; // real interruption #endif } #ifdef GLVOLUMEPOOL_PROFILE m_Stats.fTimeInterruptions += m_Timer.Elapsed() - t; // time interruptions and interruption checks #endif if (m_eState == RestartRequested) { return false; } m_eState = Busy; return true; } void AsyncVisibilityUpdater::ThreadMain(void*) { PredicateFunction pContinue = std::bind(&AsyncVisibilityUpdater::Continue, this); while (m_bContinue) { { SCOPEDLOCK(m_StateGuard); while (m_eState != RestartRequested) { m_eState = Idle; m_Worker.Wait(m_StateGuard); if (!m_bContinue) // worker just was awaked, check if thread should be terminated return; } m_eState = Busy; } #ifdef GLVOLUMEPOOL_PROFILE m_Stats.fTimeInterruptions = 0.0; m_Stats.fTimeTotal = 0.0; m_Stats.iInterruptions = 0; m_Timer.Start(); #endif switch (m_Visibility.GetRenderMode()) { case AbstrRenderer::RM_1DTRANS: RecomputeVisibilityForOctree(m_Visibility, m_Pool, m_Pool.m_vBrickMetadata, m_Pool.m_vMinMaxScalar, m_Pool.m_vMinMaxGradient, pContinue); break; case AbstrRenderer::RM_2DTRANS: RecomputeVisibilityForOctree(m_Visibility, m_Pool, m_Pool.m_vBrickMetadata, m_Pool.m_vMinMaxScalar, m_Pool.m_vMinMaxGradient, pContinue); break; case AbstrRenderer::RM_ISOSURFACE: RecomputeVisibilityForOctree(m_Visibility, m_Pool, m_Pool.m_vBrickMetadata, m_Pool.m_vMinMaxScalar, m_Pool.m_vMinMaxGradient, pContinue); break; default: assert(false); //T_ERROR("Unhandled rendering mode."); break; } #ifdef GLVOLUMEPOOL_PROFILE m_Stats.fTimeTotal = m_Timer.Elapsed(); #endif } } void GLVolumePool::FreeGLResources() { if (m_pPoolMetadataTexture) { m_pPoolMetadataTexture->Delete(); delete m_pPoolMetadataTexture; } if (m_pPoolDataTexture) { m_pPoolDataTexture->Delete(); delete m_pPoolDataTexture; } } uint64_t GLVolumePool::GetCPUSize() const { return m_pPoolMetadataTexture->GetCPUSize() + m_pPoolDataTexture->GetCPUSize(); } uint64_t GLVolumePool::GetGPUSize() const { return m_pPoolMetadataTexture->GetGPUSize() + m_pPoolDataTexture->GetGPUSize(); } void GLVolumePool::SetFilterMode(GLenum filter) { m_filter = filter; m_pPoolDataTexture->SetFilter(filter, filter); } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLTexture1D.cpp0000644000175000017500000000772012320456500021217 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLTexture1D.cpp \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #include "GLTexture1D.h" #include "Controller/Controller.h" #include "GLCommon.h" #include "Basics/nonstd.h" using namespace tuvok; GLTexture1D::GLTexture1D(uint32_t iSize, GLint internalformat, GLenum format, GLenum type, const GLvoid *pixels, GLint iMagFilter, GLint iMinFilter, GLint wrap) : GLTexture(internalformat, format, type, iMagFilter, iMinFilter), m_iSize(GLuint(iSize)) { GL(glGenTextures(1, &m_iGLID)); GL(glBindTexture(GL_TEXTURE_1D, m_iGLID)); GL(glPixelStorei(GL_PACK_ALIGNMENT, 1)); GL(glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); GL(glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, wrap)); GL(glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, iMagFilter)); GL(glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, iMinFilter)); GL(glTexImage1D(GL_TEXTURE_1D, 0, m_internalformat, m_iSize, 0, m_format, m_type, (GLvoid*)pixels)); } void GLTexture1D::SetData(uint32_t offset, uint32_t size, const void *pixels, bool bRestoreBinding) { GL(glPixelStorei(GL_PACK_ALIGNMENT, 1)); GL(glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); GLint prevTex=0; if (bRestoreBinding) { GL(glGetIntegerv(GL_TEXTURE_BINDING_1D, &prevTex)); if (GLuint(prevTex) != m_iGLID) GL(glBindTexture(GL_TEXTURE_1D, m_iGLID)); } else { GL(glBindTexture(GL_TEXTURE_1D, m_iGLID)); } GL(glTexSubImage1D(GL_TEXTURE_1D, 0, offset, size, m_format, m_type, (GLvoid*)pixels)); if (bRestoreBinding && GLuint(prevTex) != m_iGLID) GL(glBindTexture(GL_TEXTURE_1D, GLuint(prevTex))); } void GLTexture1D::SetData(const void *pixels, bool bRestoreBinding) { GL(glPixelStorei(GL_PACK_ALIGNMENT, 1)); GL(glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); GLint prevTex=0; if (bRestoreBinding) { GL(glGetIntegerv(GL_TEXTURE_BINDING_1D, &prevTex)); if (GLuint(prevTex) != m_iGLID) GL(glBindTexture(GL_TEXTURE_1D, m_iGLID)); } else { GL(glBindTexture(GL_TEXTURE_1D, m_iGLID)); } GL(glTexImage1D(GL_TEXTURE_1D, 0, m_internalformat, m_iSize, 0, m_format, m_type, (GLvoid*)pixels)); if (bRestoreBinding && GLuint(prevTex) != m_iGLID) GL(glBindTexture(GL_TEXTURE_1D, GLuint(prevTex))); } std::shared_ptr GLTexture1D::GetData() { GL(glPixelStorei(GL_PACK_ALIGNMENT, 1)); GL(glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); GL(glBindTexture(GL_TEXTURE_1D, m_iGLID)); const size_t sz = m_iSize * this->SizePerElement(); std::shared_ptr data(new char[sz]); GL(glGetTexImage(GL_TEXTURE_1D, 0, m_format, m_type, data.get())); return data; } ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLRaycaster.h0000644000175000017500000001071012320456500020765 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLRaycaster.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date November 2008 */ #pragma once #ifndef GLRAYCASTER_H #define GLRAYCASTER_H #include "../../StdTuvokDefines.h" #include "GLGPURayTraverser.h" class ExtendedPlane; namespace tuvok { class GLVBO; /** \class GLRaycaster * GPU Rayster. * * GLRaycaster is a GLSL-based raycaster for volumetric data */ class GLRaycaster : public GLGPURayTraverser { public: /** Constructs a VRer with immediate redraw, and * wireframe mode off. * \param pMasterController message routing object * \param bUseOnlyPowerOfTwo force power of two textures (compatibility) * \param bDownSampleTo8Bits force 8bit textures (compatibility) */ GLRaycaster(MasterController* pMasterController, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder); virtual ~GLRaycaster(); /// Can only use CV on scalar datasets. There's nothing really preventing /// its application to RGBA datasets, but shaders would need updating (and /// they haven't been) virtual bool SupportsClearView() { return m_pDataset->GetComponentCount() == 1; } virtual std::string ClearViewDisableReason() const { if (m_pDataset->GetComponentCount() != 1) return "this dataset has more than one component"; return ""; } virtual ERendererType GetRendererType() const {return RT_RC;} protected: GLFBOTex* m_pFBORayEntry; GLSLProgram* m_pProgramRenderFrontFaces; GLSLProgram* m_pProgramRenderFrontFacesNT; GLSLProgram* m_pProgramIso2; /** Sets variables related to bricks in the shader. */ void SetBrickDepShaderVars(const RenderRegion3D& region, const Brick& currentBrick, size_t iCurrentBrick); virtual void CreateOffscreenBuffers(); void RenderBox(const RenderRegion& renderRegion, const FLOATVECTOR3& vCenter, const FLOATVECTOR3& vExtend, const FLOATVECTOR3& vMinCoords, const FLOATVECTOR3& vMaxCoords, bool bCullBack, EStereoID eStereoID) const; virtual void Render3DPreLoop(const RenderRegion3D& region); virtual void Render3DInLoop(const RenderRegion3D& renderRegion, size_t iCurrentBrick, EStereoID eStereoID); virtual void RenderHQMIPPreLoop(RenderRegion2D ®ion); virtual void RenderHQMIPInLoop(const RenderRegion2D &renderRegion, const Brick& b); virtual void StartFrame(); virtual void SetDataDepShaderVars(); FLOATMATRIX4 ComputeEyeToTextureMatrix(const RenderRegion &renderRegion, FLOATVECTOR3 p1, FLOATVECTOR3 t1, FLOATVECTOR3 p2, FLOATVECTOR3 t2, EStereoID eStereoID) const; /** Loads GLSL vertex and fragment shaders. */ virtual bool LoadShaders(); /** Deallocates Shaders */ virtual void CleanupShaders(); /** Deallocates GPU memory allocated during the rendering process. */ virtual void Cleanup(); }; } // tuvok namespace. #endif // GLRAYCASTER_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLFrameCapture.cpp0000644000175000017500000000665612320456500021757 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLFrameCapture.cpp \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #include "GLFrameCapture.h" #include "Basics/Vectors.h" #include "Controller/Controller.h" #include "GLInclude.h" #include "GLFBOTex.h" #include "GLTargetBinder.h" using namespace tuvok; bool GLFrameCapture::CaptureSingleFrame(const std::string& strFilename, bool bPreserveTransparency) const { GLint viewport[4]; glGetIntegerv(GL_VIEWPORT, viewport); // for TIFF capture in 16 bit std::string extension = SysTools::ToLowerCase(SysTools::GetExt(strFilename)); if (extension == "tif" || extension == "tiff") { // testing new here to avoid a crash when // trying to capture 4k images on a 32 bit build std::vector image; try { image.resize(viewport[2]*viewport[3]*4); } catch (...) { image.clear(); } if ( image.empty() ) return false; GL(glPixelStorei(GL_PACK_ALIGNMENT, 1)); GL(glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); GL(glReadBuffer(GL_COLOR_ATTACHMENT0)); GL(glReadPixels(0,0,viewport[2],viewport[3],GL_RGBA,GL_UNSIGNED_SHORT,&image[0])); return SaveImage(strFilename, UINTVECTOR2(viewport[2], viewport[3]), image, bPreserveTransparency); } else { // testing new here to avoid a crash when // trying to capture 4k images on a 32 bit build std::vector image; try { image.resize(viewport[2]*viewport[3]*4); } catch (...) { image.clear(); } if ( image.empty() ) return false; GL(glPixelStorei(GL_PACK_ALIGNMENT, 1)); GL(glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); GL(glReadBuffer(GL_COLOR_ATTACHMENT0)); GL(glReadPixels(0,0,viewport[2],viewport[3],GL_RGBA,GL_UNSIGNED_BYTE,&image[0])); return SaveImage(strFilename, UINTVECTOR2(viewport[2], viewport[3]), image, bPreserveTransparency); } } bool GLFrameCapture::CaptureSingleFrame(const std::string& filename, GLFBOTex* from, bool transparency) const { GLTargetBinder bind(&Controller::Instance()); bind.Bind(from); bool rv = this->CaptureSingleFrame(filename, transparency); bind.Unbind(); return rv; } ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLTexture2D.h0000644000175000017500000000576512320456500020674 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLTexture2D.h \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #pragma once #ifndef GLTEXTURE2D_H #define GLTEXTURE2D_H #include "../../StdTuvokDefines.h" #include #include "GLTexture.h" #include "../../Basics/Vectors.h" namespace tuvok { class GLTexture2D : public GLTexture { public: GLTexture2D(uint32_t iSizeX, uint32_t iSizeY, GLint internalformat, GLenum format, GLenum type, const GLvoid *pixels = 0, GLint iMagFilter = GL_NEAREST, GLint iMinFilter = GL_NEAREST, GLint wrapX = GL_CLAMP_TO_EDGE, GLint wrapY = GL_CLAMP_TO_EDGE ); virtual ~GLTexture2D() {} virtual void Bind(uint32_t iUnit=0) const { GLint iPrevUint; GL(glGetIntegerv(GL_ACTIVE_TEXTURE, &iPrevUint)); GL(glActiveTexture(GLenum(GL_TEXTURE0 + iUnit))); GL(glBindTexture(GL_TEXTURE_2D, m_iGLID)); GL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, m_iMagFilter)); GL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, m_iMinFilter)); GL(glActiveTexture(iPrevUint)); } virtual void SetData(const void *pixels, bool bRestoreBinding=true); void SetData(const UINTVECTOR2& offset, const UINTVECTOR2& size, const void *pixels, bool bRestoreBinding=true); virtual std::shared_ptr GetData(); virtual uint64_t GetCPUSize() const { return uint64_t(m_iSizeX*m_iSizeY*SizePerElement()); } virtual uint64_t GetGPUSize() const { return uint64_t(m_iSizeX*m_iSizeY*SizePerElement()); } UINTVECTOR2 GetSize() const { return UINTVECTOR2(uint32_t(m_iSizeX), uint32_t(m_iSizeY)); } protected: GLuint m_iSizeX; GLuint m_iSizeY; }; } #endif // GLTEXTURE2D_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLTargetBinder.h0000644000175000017500000000473612320456500021415 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLTargetBinder.h \author Jens Krueger SCI Institute University of Utah \date Januray 2009 */ #pragma once #ifndef GLTARGETBINDER_H #define GLTARGETBINDER_H #include #include #include "../../StdTuvokDefines.h" namespace tuvok { class GLFBOTex; class MasterController; class GLBufferID { public: GLBufferID(GLFBOTex* _pBuffer, uint32_t _iSubBuffer=0) : pBuffer(_pBuffer), iSubBuffer(_iSubBuffer) { } GLFBOTex* pBuffer; uint32_t iSubBuffer; }; class GLTargetBinder { public: GLTargetBinder(MasterController* pMasterController); virtual ~GLTargetBinder(); virtual void Bind(const std::vector& vpFBOs); virtual void Bind(GLFBOTex* pFBO0, GLFBOTex* pFBO1 = NULL, GLFBOTex* pFBO2 = NULL, GLFBOTex* pFBO3 = NULL); virtual void Bind(GLFBOTex* pFBO0, int iSubBuffer0, GLFBOTex* pFBO1 = NULL, int iSubBuffer1=0, GLFBOTex* pFBO2 = NULL, int iSubBuffer2=0, GLFBOTex* pFBO3 = NULL, int iSubBuffer3=0); virtual void Unbind(); protected: MasterController* m_pMasterController; std::vector m_vpBoundFBOs; void UnbindInternal(); }; }; #endif // GLTARGETBINDER_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLGPURayTraverser.cpp0000644000175000017500000000467612320456500022406 0ustar mathieumathieu#include "GLInclude.h" #include "GLGPURayTraverser.h" #include "GLVBO.h" using namespace tuvok; GLGPURayTraverser::GLGPURayTraverser(MasterController* pMasterController, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder) : GLRenderer(pMasterController, bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder), m_pNearPlaneQuad(NULL), m_pBBoxVBO(NULL) { } void GLGPURayTraverser::Cleanup() { GLRenderer::Cleanup(); m_pBBoxVBO.reset(); delete m_pNearPlaneQuad; m_pNearPlaneQuad = NULL; } bool GLGPURayTraverser::Initialize(std::shared_ptr ctx) { if (!GLRenderer::Initialize(ctx)) { T_ERROR("Error in parent call -> aborting"); return false; } // init near plane vbo m_pNearPlaneQuad = new GLVBO(); std::vector posData; posData.push_back(FLOATVECTOR3(-1.0f, 1.0f, -0.5f)); posData.push_back(FLOATVECTOR3( 1.0f, 1.0f, -0.5f)); posData.push_back(FLOATVECTOR3( 1.0f, -1.0f, -0.5f)); posData.push_back(FLOATVECTOR3(-1.0f, -1.0f, -0.5f)); m_pNearPlaneQuad->AddVertexData(posData); m_pBBoxVBO = std::shared_ptr(new GLVBO()); return true; } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLTexture2D.cpp0000644000175000017500000001016412320456500021214 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLTexture2D.cpp \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #include "StdTuvokDefines.h" #include #include "GLTexture2D.h" #include "GLCommon.h" #include "Basics/nonstd.h" using namespace tuvok; GLTexture2D::GLTexture2D(uint32_t iSizeX, uint32_t iSizeY, GLint internalformat, GLenum format, GLenum type, const GLvoid *pixels, GLint iMagFilter, GLint iMinFilter, GLint wrapX, GLint wrapY) : GLTexture(internalformat, format, type, iMagFilter, iMinFilter), m_iSizeX(GLuint(iSizeX)), m_iSizeY(GLuint(iSizeY)) { GLint prevTex; GL(glGetIntegerv(GL_TEXTURE_BINDING_2D, &prevTex)); GL(glGenTextures(1, &m_iGLID)); GL(glBindTexture(GL_TEXTURE_2D, m_iGLID)); GL(glPixelStorei(GL_PACK_ALIGNMENT ,1)); GL(glPixelStorei(GL_UNPACK_ALIGNMENT ,1)); GL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapX)); GL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapY)); GL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, iMagFilter)); GL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, iMinFilter)); GL(glTexImage2D(GL_TEXTURE_2D, 0, m_internalformat, GLuint(m_iSizeX),GLuint(m_iSizeY), 0, m_format, m_type, (GLvoid*)pixels)); GL(glBindTexture(GL_TEXTURE_2D, prevTex)); } void GLTexture2D::SetData(const UINTVECTOR2& offset, const UINTVECTOR2& size, const void *pixels, bool bRestoreBinding) { GL(glPixelStorei(GL_PACK_ALIGNMENT ,1)); GL(glPixelStorei(GL_UNPACK_ALIGNMENT ,1)); GLint prevTex=0; if (bRestoreBinding) GL(glGetIntegerv(GL_TEXTURE_BINDING_2D, &prevTex)); GL(glBindTexture(GL_TEXTURE_2D, m_iGLID)); GL(glTexSubImage2D(GL_TEXTURE_2D, 0, offset.x, offset.y, size.x, size.y, m_format, m_type, (GLvoid*)pixels)); if (bRestoreBinding && GLuint(prevTex) != m_iGLID) GL(glBindTexture(GL_TEXTURE_2D, prevTex)); } void GLTexture2D::SetData(const void *pixels, bool bRestoreBinding) { GL(glPixelStorei(GL_PACK_ALIGNMENT ,1)); GL(glPixelStorei(GL_UNPACK_ALIGNMENT ,1)); GLint prevTex=0; if (bRestoreBinding) GL(glGetIntegerv(GL_TEXTURE_BINDING_2D, &prevTex)); GL(glBindTexture(GL_TEXTURE_2D, m_iGLID)); GL(glTexImage2D(GL_TEXTURE_2D, 0, m_internalformat, m_iSizeX, m_iSizeY, 0, m_format, m_type, (GLvoid*)pixels)); if (bRestoreBinding && GLuint(prevTex) != m_iGLID) GL(glBindTexture(GL_TEXTURE_2D, prevTex)); } std::shared_ptr GLTexture2D::GetData() { GL(glPixelStorei(GL_PACK_ALIGNMENT, 1)); GL(glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); GL(glBindTexture(GL_TEXTURE_2D, m_iGLID)); const size_t sz = m_iSizeX * m_iSizeY * SizePerElement(); std::shared_ptr data(new char[sz]); GL(glGetTexImage(GL_TEXTURE_2D, 0, m_format, m_type, data.get())); return data; } ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLStateManager.h0000644000175000017500000000575412320456500021417 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifndef GLSTATEMANAGER_H #define GLSTATEMANAGER_H #include "../StateManager.h" #include "StdTuvokDefines.h" namespace tuvok { /** \class GLStateManager * OpenGL state managers. This state manager applies is state object's properties to the OpenGL subsystem.*/ class GLStateManager : public StateManager { public: GLStateManager(); virtual void Apply(const GPUState& state, bool bForce=false); virtual void SetEnableDepthTest(const bool& value, bool bForce=false); virtual void SetDepthFunc(const DEPTH_FUNC& value, bool bForce=false); virtual void SetEnableCullFace(const bool& value, bool bForce=false); virtual void SetCullState(const STATE_CULL& value, bool bForce=false); virtual void SetEnableBlend(const bool& value, bool bForce=false); virtual void SetEnableScissor(const bool& value, bool bForce=false); virtual void SetEnableLighting(const bool& value, bool bForce=false); virtual void SetEnableColorMaterial(const bool& value, bool bForce=false); virtual void SetEnableLight(size_t i, const bool& value, bool bForce=false); virtual void SetEnableTex(size_t i, const STATE_TEX& value, bool bForce=false); virtual void SetActiveTexUnit(const size_t iUnit, bool bForce=false); virtual void SetDepthMask(const bool value, bool bForce=false); virtual void SetColorMask(const bool value, bool bForce=false); virtual void SetBlendEquation(const BLEND_EQUATION value, bool bForce=false); virtual void SetBlendFunction(const BLEND_FUNC src, const BLEND_FUNC dest, bool bForce=false); virtual void SetLineWidth(const float value, bool bForce=false); protected: void GetFromOpenGL(); }; } //namespace tuvok #endif // GLSTATEMANAGER_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLStateManager.cpp0000644000175000017500000003273012320456500021744 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "GLStateManager.h" #include "GLInclude.h" using namespace tuvok; GLenum BLEND_FUNCToGL(const BLEND_FUNC& func) { switch (func) { case BF_ZERO : return GL_ZERO; break; case BF_ONE : return GL_ONE; break; case BF_SRC_COLOR : return GL_SRC_COLOR; break; case BF_ONE_MINUS_SRC_COLOR : return GL_ONE_MINUS_SRC_COLOR; break; case BF_DST_COLOR : return GL_DST_COLOR; break; case BF_ONE_MINUS_DST_COLOR : return GL_ONE_MINUS_DST_COLOR; break; case BF_SRC_ALPHA : return GL_SRC_ALPHA; break; case BF_ONE_MINUS_SRC_ALPHA : return GL_ONE_MINUS_SRC_ALPHA; break; case BF_DST_ALPHA : return GL_DST_ALPHA; break; case BF_ONE_MINUS_DST_ALPHA : return GL_ONE_MINUS_DST_ALPHA; break; case BF_SRC_ALPHA_SATURATE : return GL_SRC_ALPHA_SATURATE; break; } return GL_ONE; } BLEND_FUNC GLToBLEND_FUNC(const GLenum& func) { switch (func) { case GL_ZERO : return BF_ZERO; break; case GL_ONE : return BF_ONE; break; case GL_SRC_COLOR : return BF_SRC_COLOR; break; case GL_ONE_MINUS_SRC_COLOR : return BF_ONE_MINUS_SRC_COLOR; break; case GL_DST_COLOR : return BF_DST_COLOR; break; case GL_ONE_MINUS_DST_COLOR : return BF_ONE_MINUS_DST_COLOR; break; case GL_SRC_ALPHA : return BF_SRC_ALPHA; break; case GL_ONE_MINUS_SRC_ALPHA : return BF_ONE_MINUS_SRC_ALPHA; break; case GL_DST_ALPHA : return BF_DST_ALPHA; break; case GL_ONE_MINUS_DST_ALPHA : return BF_ONE_MINUS_DST_ALPHA; break; case GL_SRC_ALPHA_SATURATE : return BF_SRC_ALPHA_SATURATE; break; } return BF_ONE; } GLenum BLEND_EQUATIONToGL(const BLEND_EQUATION& func) { switch (func) { case BE_FUNC_ADD : return GL_FUNC_ADD; break; case BE_FUNC_SUBTRACT : return GL_FUNC_SUBTRACT; break; case BE_FUNC_REVERSE_SUBTRACT : return GL_FUNC_REVERSE_SUBTRACT; break; case BE_MIN : return GL_MIN; break; case BE_MAX : return GL_MAX; break; } return GL_FUNC_ADD; } BLEND_EQUATION GLToBLEND_EQUATION(const GLenum& func) { switch (func) { case GL_FUNC_ADD : return BE_FUNC_ADD; break; case GL_FUNC_SUBTRACT : return BE_FUNC_SUBTRACT; break; case GL_FUNC_REVERSE_SUBTRACT : return BE_FUNC_REVERSE_SUBTRACT; break; case GL_MIN : return BE_MIN; break; case GL_MAX : return BE_MAX; break; } return BE_FUNC_ADD; } GLenum DEPTH_FUNCToGL(const DEPTH_FUNC& func) { switch (func) { case DF_NEVER : return GL_NEVER; break; case DF_LESS : return GL_LESS; break; case DF_EQUAL : return GL_EQUAL; break; case DF_LEQUAL : return GL_LEQUAL; break; case DF_GREATER : return GL_GREATER; break; case DF_NOTEQUAL : return GL_NOTEQUAL; break; case DF_GEQUAL : return GL_GEQUAL; break; case DF_ALWAYS : return GL_ALWAYS; break; } return GL_LEQUAL; } DEPTH_FUNC GLToDEPTH_FUNC(const GLenum& func) { switch (func) { case GL_NEVER : return DF_NEVER; break; case GL_LESS : return DF_LESS; break; case GL_EQUAL : return DF_EQUAL; break; case GL_LEQUAL : return DF_LEQUAL; break; case GL_GREATER : return DF_GREATER; break; case GL_NOTEQUAL : return DF_NOTEQUAL; break; case GL_GEQUAL : return DF_GEQUAL; break; case GL_ALWAYS : return DF_ALWAYS; break; } return DF_LEQUAL; } void GLStateManager::Apply(const GPUState& state, bool bForce) { GL_CHECK(); SetEnableDepthTest(state.enableDepthTest, bForce); SetDepthFunc(state.depthFunc, bForce); SetEnableCullFace(state.enableCullFace, bForce); SetCullState(state.cullState, bForce); SetEnableBlend(state.enableBlend, bForce); SetEnableScissor(state.enableScissor, bForce); SetEnableLighting(state.enableLighting, bForce); SetEnableColorMaterial(state.enableColorMaterial, bForce); for (size_t i = 0;i GetData(); virtual uint64_t GetCPUSize() const { return uint64_t(m_iSize*SizePerElement()); } virtual uint64_t GetGPUSize() const { return uint64_t(m_iSize*SizePerElement()); } uint32_t GetSize() const {return uint32_t(m_iSize);} protected: GLuint m_iSize; }; } #endif // GLTEXTURE1D_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLTexture.h0000644000175000017500000000615112320456500020474 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLTexture.h \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #pragma once #ifndef TUVOK_GLTEXTURE_H #define TUVOK_GLTEXTURE_H #include "../../StdTuvokDefines.h" #include #include "GLObject.h" namespace tuvok { class GLSLProgram; /** \class GLTexture * Abstracted texture usage. * * GLTexture loads and unloads textures from the GPU. */ class GLTexture : public GLObject { public: /** Constructs an invalid texture. * A texture is created with an invalid GL identifier. No data are * pushed to the GPU. Derived classes are expected to generate the * texture in their constructor[s]. */ GLTexture(GLint internalformat, GLenum format, GLenum type, GLint iMagFilter, GLint iMinFilter); virtual ~GLTexture(); /** Removes this texture from the OpenGL context. */ virtual void Delete(); /** Initializes the texture data with the given data. */ virtual void SetData(const void *pixels, bool bRestoreBinding=true) = 0; /// bind this texture to the given texture unit virtual void Bind(uint32_t iUnit=0) const = 0; /// bind this texture the given texture in a specific shader void Bind(GLSLProgram& shader, const std::string& name) const; /// set the texture filter mode (must be called before a bind call to be in effect) void SetFilter(GLint iMagFilter = GL_NEAREST, GLint iMinFilter = GL_NEAREST); /** \return The OpenGL identifier for this texture. */ GLuint GetGLID() const {return m_iGLID;} /// expensive read back of texture data virtual std::shared_ptr GetData() = 0; protected: GLuint m_iGLID; GLint m_iMagFilter; GLint m_iMinFilter; GLint m_internalformat; GLenum m_format; GLenum m_type; size_t SizePerElement() const; }; } #endif // TUVOK_GLTEXTURE_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLSBVR2D.cpp0000644000175000017500000007370112320456500020336 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLSBVR2D.cpp \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #include #include "GLInclude.h" #include "GLSBVR2D.h" #include "Controller/Controller.h" #include "Renderer/GL/GLSLProgram.h" #include "Renderer/GL/GLTexture1D.h" #include "Renderer/GL/GLTexture2D.h" #include "Renderer/GL/GLVolume2DTex.h" #include "Renderer/GPUMemMan/GPUMemMan.h" #include "Renderer/TFScaling.h" using namespace std; using namespace tuvok; GLSBVR2D::GLSBVR2D(MasterController* pMasterController, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder) : GLRenderer(pMasterController, bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder), m_bUse3DTexture(false) { m_bSupportsMeshes = false; // not fully implemented yet } GLSBVR2D::~GLSBVR2D() { } void GLSBVR2D::CleanupShaders() { GLRenderer::CleanupShaders(); } void GLSBVR2D::SetInterpolant(Interpolant eInterpolant) { if (m_eInterpolant != eInterpolant) { m_eInterpolant = eInterpolant; CleanupShaders(); LoadShaders(); ScheduleCompleteRedraw(); } } void GLSBVR2D::SetUse3DTexture(bool bUse3DTexture) { if (bUse3DTexture != m_bUse3DTexture) { m_bUse3DTexture = bUse3DTexture; CleanupShaders(); LoadShaders(); ScheduleCompleteRedraw(); } } void GLSBVR2D::BindVolumeStringsToTexUnit(GLSLProgram* program, bool bGradients) { if (m_bUse3DTexture) { program->ConnectTextureID("texVolume",0); } else { program->ConnectTextureID("texSlice0",0); program->ConnectTextureID("texSlice1",2); if (bGradients) program->ConnectTextureID("texSlice2",3); } } bool GLSBVR2D::LoadShaders() { // do not call GLRenderer::LoadShaders as we want to control // what volume access function is linked (Volume3D or Volume2D) string volumeAccessFunction = m_bUse3DTexture ? "Volume3D" : "Volume2D"; // add the appropriate suffix in 2D. We need separate shaders because we do // manual sampling in the 2D shaders. if (!m_bUse3DTexture) { switch (m_eInterpolant) { case Linear : volumeAccessFunction += "-linear"; break; case NearestNeighbor : volumeAccessFunction += "-nearest"; break; } } volumeAccessFunction += ".glsl"; if (!GLRenderer::LoadShaders(volumeAccessFunction, m_bUse3DTexture)) { T_ERROR("Error in parent call -> aborting"); return false; } std::string tfqn = m_pDataset ? this->ColorData() ? "VRender1D-Color" : "VRender1D" : "VRender1D"; const std::string tfqnLit = m_pDataset ? this->ColorData() ? "VRender1DLit-Color.glsl" : "VRender1DLit.glsl" : "VRender1DLit.glsl"; const std::string bias = tfqn + "-BScale.glsl"; tfqn += ".glsl"; if(!LoadAndVerifyShader(&m_pProgram1DTrans[0], m_vShaderSearchDirs, "GLSBVR-VS.glsl", NULL, volumeAccessFunction.c_str(), // sampleVolume tfqn.c_str(), // VRender1D bias.c_str(), "VRender1DProxy.glsl", "FTB.glsl", // TraversalOrderDepColor "GLSBVR-1D-FS.glsl", NULL) || !LoadAndVerifyShader(&m_pProgram1DTrans[1], m_vShaderSearchDirs, "GLSBVR-VS.glsl", NULL, volumeAccessFunction.c_str(), tfqnLit.c_str(), // VRender1DLit "lighting.glsl", // Lighting "FTB.glsl", // TraversalOrderDepColor "GLSBVR-1D-light-FS.glsl", NULL) || !LoadAndVerifyShader(&m_pProgram2DTrans[0], m_vShaderSearchDirs, "GLSBVR-VS.glsl", NULL, volumeAccessFunction.c_str(), "FTB.glsl", // TraversalOrderDepColor "GLSBVR-2D-FS.glsl", NULL) || !LoadAndVerifyShader(&m_pProgram2DTrans[1], m_vShaderSearchDirs, "GLSBVR-VS.glsl", NULL, volumeAccessFunction.c_str(), "lighting.glsl", "FTB.glsl", // TraversalOrderDepColor "GLSBVR-2D-light-FS.glsl", NULL) || !LoadAndVerifyShader(&m_pProgramHQMIPRot, m_vShaderSearchDirs, "GLSBVR-VS.glsl", NULL, volumeAccessFunction.c_str(), "GLSBVR-MIP-Rot-FS.glsl", NULL) || !LoadAndVerifyShader(&m_pProgramIso, m_vShaderSearchDirs, "GLSBVR-VS.glsl", NULL, volumeAccessFunction.c_str(), "GLSBVR-ISO-FS.glsl", NULL) || !LoadAndVerifyShader(&m_pProgramColor, m_vShaderSearchDirs, "GLSBVR-VS.glsl", NULL, volumeAccessFunction.c_str(), "GLSBVR-Color-FS.glsl", NULL)) { Cleanup(); T_ERROR("Error loading a shader."); return false; } else { BindVolumeStringsToTexUnit(m_pProgram1DTrans[0],false); m_pProgram1DTrans[0]->ConnectTextureID("texTrans",1); BindVolumeStringsToTexUnit(m_pProgram1DTrans[1]); m_pProgram1DTrans[1]->ConnectTextureID("texTrans",1); BindVolumeStringsToTexUnit(m_pProgram2DTrans[0]); m_pProgram2DTrans[0]->ConnectTextureID("texTrans",1); BindVolumeStringsToTexUnit(m_pProgram2DTrans[1]); m_pProgram2DTrans[1]->ConnectTextureID("texTrans",1); BindVolumeStringsToTexUnit(m_pProgramIso); BindVolumeStringsToTexUnit(m_pProgramColor); BindVolumeStringsToTexUnit(m_pProgramHQMIPRot, false); UpdateLightParamsInShaders(); } return true; } void GLSBVR2D::SetDataDepShaderVars() { GLRenderer::SetDataDepShaderVars(); if(m_eRenderMode == RM_1DTRANS && m_TFScalingMethod == SMETH_BIAS_AND_SCALE) { std::pair bias_scale = scale_bias_and_scale(*m_pDataset); MESSAGE("setting TF bias (%5.3f) and scale (%5.3f)", bias_scale.first, bias_scale.second); m_pProgram1DTrans[m_bUseLighting ? 1 : 0]->Enable(); m_pProgram1DTrans[m_bUseLighting ? 1 : 0]->Set("TFuncBias", bias_scale.first); m_pProgram1DTrans[m_bUseLighting ? 1 : 0]->Set("fTransScale", bias_scale.second); } } void GLSBVR2D::SetBrickDepShaderVars(const RenderRegion3D&, const Brick& currentBrick) { FLOATVECTOR3 vStep(1.0f/currentBrick.vVoxelCount.x, 1.0f/currentBrick.vVoxelCount.y, 1.0f/currentBrick.vVoxelCount.z); float fSampleRateModifier = m_fSampleRateModifier / (this->decreaseSamplingRateNow ? m_fSampleDecFactor : 1.0f); float fStepScale = 1.414213562f/fSampleRateModifier * //1.414213562 = sqrt(2) (FLOATVECTOR3(m_pDataset->GetDomainSize()) / FLOATVECTOR3(m_pDataset->GetDomainSize( static_cast(m_iCurrentLOD)) )).maxVal(); switch (m_eRenderMode) { case RM_1DTRANS: { GLSLProgram *shader = m_pProgram1DTrans[m_bUseLighting ? 1 : 0]; shader->Set("fStepScale", fStepScale); if (m_bUseLighting) { m_pProgram1DTrans[1]->Set("vVoxelStepsize", vStep.x, vStep.y, vStep.z); } break; } case RM_2DTRANS: { GLSLProgram *shader = m_pProgram2DTrans[m_bUseLighting ? 1 : 0]; shader->Set("fStepScale", fStepScale); shader->Set("vVoxelStepsize", vStep.x, vStep.y, vStep.z); break; } case RM_ISOSURFACE: { GLSLProgram *shader; shader = this->ColorData() ? m_pProgramColor : m_pProgramIso; shader->Set("vVoxelStepsize", vStep.x, vStep.y, vStep.z); break; } case RM_INVALID: T_ERROR("Invalid rendermode set"); break; } } void GLSBVR2D::EnableClipPlane(RenderRegion *renderRegion) { if(!m_bClipPlaneOn) { AbstrRenderer::EnableClipPlane(renderRegion); m_SBVRGeogen.EnableClipPlane(); PLANE plane(m_ClipPlane.Plane()); m_SBVRGeogen.SetClipPlane(plane); } } void GLSBVR2D::DisableClipPlane(RenderRegion *renderRegion) { if(m_bClipPlaneOn) { AbstrRenderer::DisableClipPlane(renderRegion); m_SBVRGeogen.DisableClipPlane(); } } void GLSBVR2D::Render3DPreLoop(const RenderRegion3D&) { m_SBVRGeogen.SetSamplingModifier(m_fSampleRateModifier / ((this->decreaseSamplingRateNow) ? m_fSampleDecFactor : 1.0f)); if(m_bClipPlaneOn) { m_SBVRGeogen.EnableClipPlane(); PLANE plane(m_ClipPlane.Plane()); m_SBVRGeogen.SetClipPlane(plane); } else { m_SBVRGeogen.DisableClipPlane(); } switch (m_eRenderMode) { case RM_1DTRANS : m_p1DTransTex->Bind(1); m_pProgram1DTrans[m_bUseLighting ? 1 : 0]->Enable(); break; case RM_2DTRANS : m_p2DTransTex->Bind(1); m_pProgram2DTrans[m_bUseLighting ? 1 : 0]->Enable(); break; case RM_ISOSURFACE : break; default : T_ERROR("Invalid rendermode set"); break; } m_SBVRGeogen.SetLODData(UINTVECTOR3(m_pDataset->GetDomainSize(static_cast(m_iCurrentLOD)))); } void GLSBVR2D::RenderProxyGeometry() const { if (!m_pGLVolume) { T_ERROR("Volume data invalid, unable to render."); return; } if (m_bUse3DTexture) RenderProxyGeometry3D(); else RenderProxyGeometry2D(); } // keeps track of slice geometry. Meant to be an element in a larger // data structure; for each slice_geom, we store the texture to use, a // set of (3D) texture coords, and a set of (3D) vertices. struct slice_geom { uint32_t texid; std::vector texcoords; std::vector tris; }; // Iterate through the slices: bind the current slice and adjacent // slices, and then send the tex and vertex coords down via arrays. static void submit_vert_arrays(const GLVolume2DTex* vol, const std::vector& slices, size_t dimension) { glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); for(std::vector::const_iterator slice = slices.begin(); slice != slices.end(); ++slice) { // skip empty arrays. if(slice->texcoords.empty() || slice->tris.empty()) { continue; } vol->Bind(0, static_cast(slice->texid)+0, static_cast(dimension)); vol->Bind(2, static_cast(slice->texid)+1, static_cast(dimension)); vol->Bind(3, static_cast(slice->texid)+2, static_cast(dimension)); glTexCoordPointer(3, GL_FLOAT, 0, &(slice->texcoords[0])); glVertexPointer(3, GL_FLOAT, 0, &(slice->tris[0])); glDrawArrays(GL_TRIANGLES, 0, static_cast(slice->tris.size()/3)); } glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); } // assignment with move semantics; copies the data from "from" to "to", but in // doing so clobbers the values in "from". This can be done considerably more // efficiently than a simple assignment, however. void move_slice(struct slice_geom& to, struct slice_geom& from) { to.texid = from.texid; to.texcoords.swap(from.texcoords); to.tris.swap(from.tris); } void GLSBVR2D::RenderProxyGeometry2D() const { GLVolume2DTex* pGLVolume = static_cast(m_pGLVolume); if (!m_SBVRGeogen.m_vSliceTrianglesX.empty()) { // set coordinate shuffle matrix glMatrixMode(GL_TEXTURE); float m[16] = {0,0,1,0, 0,1,0,0, 1,0,0,0, 0,0,0,1}; glLoadIdentity(); glLoadMatrixf(m); std::vector slices; slices.reserve(pGLVolume->GetSizeX()); int iLastTexID = -1; size_t slc_idx = 0; // index into 'slices'. slice_geom geom; // Experimentally, I observed that the max we see is a little above // 1800 entries (i.e. 600 verts). So this should make sure we do // all our allocations up front. geom.texcoords.reserve(2048); geom.tris.reserve(2048); for(size_t i=0; i < m_SBVRGeogen.m_vSliceTrianglesX.size(); ++i) { const float depth = m_SBVRGeogen.m_vSliceTrianglesX[i].m_vVertexData.x - 0.5f/pGLVolume->GetSizeX(); // compensate for OpenGL sampling at the texel center const unsigned iCurrentTexID = static_cast(depth*(pGLVolume->GetSizeX())); if (i == 0) iLastTexID = iCurrentTexID; if(static_cast(iCurrentTexID) != iLastTexID) { // finished a slice // copy the current geom over ... slice_geom g; slices.push_back(g); // note that move_slice will clear geom.texcoords/tris, too! move_slice(slices[slc_idx], geom); slices[slc_idx++].texid = iLastTexID; // .. and move on to the next slice. iLastTexID = iCurrentTexID; } const float fraction = depth*(pGLVolume->GetSizeX()) - iCurrentTexID; geom.texcoords.push_back(m_SBVRGeogen.m_vSliceTrianglesX[i].m_vVertexData.z); geom.texcoords.push_back(m_SBVRGeogen.m_vSliceTrianglesX[i].m_vVertexData.y); geom.texcoords.push_back(fraction); geom.tris.push_back(m_SBVRGeogen.m_vSliceTrianglesX[i].m_vPos.x); geom.tris.push_back(m_SBVRGeogen.m_vSliceTrianglesX[i].m_vPos.y); geom.tris.push_back(m_SBVRGeogen.m_vSliceTrianglesX[i].m_vPos.z); } // copy the last geom over slice_geom g; slices.push_back(g); move_slice(slices[slc_idx], geom); slices[slc_idx++].texid = iLastTexID; submit_vert_arrays(pGLVolume, slices, 0); } if (!m_SBVRGeogen.m_vSliceTrianglesY.empty()) { // set coordinate shuffle matrix glMatrixMode(GL_TEXTURE); float m[16] = {1,0,0,0, 0,0,1,0, 0,1,0,0, 0,0,0,1}; glLoadIdentity(); glLoadMatrixf(m); int iLastTexID = -1; std::vector slices; slices.reserve(pGLVolume->GetSizeX()); size_t slc_idx = 0; // index into 'slices'. slice_geom geom; geom.texcoords.reserve(2048); geom.tris.reserve(2048); for (size_t i = 0;iGetSizeY(); // compensate for OpenGL sampling at the texel center const unsigned iCurrentTexID = static_cast(depth*(pGLVolume->GetSizeY())); if (i == 0) iLastTexID = iCurrentTexID; if(static_cast(iCurrentTexID) != iLastTexID) { // we finished a slice. copy the current geom over ... slice_geom g; slices.push_back(g); // note that move_slice will clear geom.texcoords/tris, too! move_slice(slices[slc_idx], geom); slices[slc_idx++].texid = iLastTexID; // .. and move on to the next slice. iLastTexID = iCurrentTexID; } const float fraction = depth*(pGLVolume->GetSizeY()) - iCurrentTexID; geom.texcoords.push_back(m_SBVRGeogen.m_vSliceTrianglesY[i].m_vVertexData.x); geom.texcoords.push_back(m_SBVRGeogen.m_vSliceTrianglesY[i].m_vVertexData.z); geom.texcoords.push_back(fraction); geom.tris.push_back(m_SBVRGeogen.m_vSliceTrianglesY[i].m_vPos.x); geom.tris.push_back(m_SBVRGeogen.m_vSliceTrianglesY[i].m_vPos.y); geom.tris.push_back(m_SBVRGeogen.m_vSliceTrianglesY[i].m_vPos.z); } // copy the last geom over slice_geom g; slices.push_back(g); move_slice(slices[slc_idx], geom); slices[slc_idx++].texid = iLastTexID; submit_vert_arrays(pGLVolume, slices, 1); } if (!m_SBVRGeogen.m_vSliceTrianglesZ.empty()) { // set coordinate shuffle matrix glMatrixMode(GL_TEXTURE); glLoadIdentity(); int iLastTexID = -1; std::vector slices; slices.reserve(pGLVolume->GetSizeX()); size_t slc_idx = 0; // index into 'slices'. slice_geom geom; geom.texcoords.reserve(2048); geom.tris.reserve(2048); for (size_t i = 0;iGetSizeZ(); // compensate for OpenGL sampling at the texel center const unsigned iCurrentTexID = static_cast(depth*(pGLVolume->GetSizeZ())); if (i == 0) iLastTexID = iCurrentTexID; if(static_cast(iCurrentTexID) != iLastTexID) { // we finished a slice. copy the current geom over ... slice_geom g; slices.push_back(g); // note that move_slice will clear geom.texcoords/tris, too! move_slice(slices[slc_idx], geom); slices[slc_idx++].texid = iLastTexID; // .. and move on to the next slice. iLastTexID = iCurrentTexID; } const float fraction = depth*(pGLVolume->GetSizeZ()) - iCurrentTexID; geom.texcoords.push_back(m_SBVRGeogen.m_vSliceTrianglesZ[i].m_vVertexData.x); geom.texcoords.push_back(m_SBVRGeogen.m_vSliceTrianglesZ[i].m_vVertexData.y); geom.texcoords.push_back(fraction); geom.tris.push_back(m_SBVRGeogen.m_vSliceTrianglesZ[i].m_vPos.x); geom.tris.push_back(m_SBVRGeogen.m_vSliceTrianglesZ[i].m_vPos.y); geom.tris.push_back(m_SBVRGeogen.m_vSliceTrianglesZ[i].m_vPos.z); } // copy the last geom over slice_geom g; slices.push_back(g); move_slice(slices[slc_idx], geom); slices[slc_idx++].texid = iLastTexID; submit_vert_arrays(pGLVolume, slices, 2); } } void GLSBVR2D::RenderProxyGeometry3D() const { if(!m_SBVRGeogen.m_vSliceTrianglesX.empty()) { glBegin(GL_TRIANGLES); for (size_t i = 0;iGetStateManager()->Apply(m_BaseState); const Brick& b = (eStereoID == SI_LEFT_OR_MONO) ? m_vCurrentBrickList[iCurrentBrick] : m_vLeftEyeBrickList[iCurrentBrick]; if (m_iBricksRenderedInThisSubFrame == 0 && m_eRenderMode == RM_ISOSURFACE){ m_TargetBinder.Bind(m_pFBOIsoHit[size_t(eStereoID)], 0, m_pFBOIsoHit[size_t(eStereoID)], 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if (m_bDoClearView) { m_TargetBinder.Bind(m_pFBOCVHit[size_t(eStereoID)], 0, m_pFBOCVHit[size_t(eStereoID)], 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } } if (b.bIsEmpty) { return; } // setup the slice generator m_SBVRGeogen.SetBrickData(b.vExtension, b.vVoxelCount, b.vTexcoordsMin, b.vTexcoordsMax); FLOATMATRIX4 maBricktTrans; maBricktTrans.Translation(b.vCenter.x, b.vCenter.y, b.vCenter.z); m_mProjection[size_t(eStereoID)].setProjection(); renderRegion.modelView[size_t(eStereoID)].setModelview(); m_SBVRGeogen.SetBrickTrans(b.vCenter); m_SBVRGeogen.SetWorld(renderRegion.rotation*renderRegion.translation); m_SBVRGeogen.SetView(m_mView[size_t(eStereoID)]); m_SBVRGeogen.ComputeGeometry(b.bIsEmpty); if (m_eRenderMode == RM_ISOSURFACE) { m_pContext->GetStateManager()->SetEnableBlend(false); GLSLProgram* shader = this->ColorData() ? m_pProgramColor : m_pProgramIso; m_TargetBinder.Bind(m_pFBOIsoHit[size_t(eStereoID)], 0, m_pFBOIsoHit[size_t(eStereoID)], 1); shader->Enable(); SetBrickDepShaderVars(renderRegion, b); shader->Set("fIsoval", static_cast (this->GetNormalizedIsovalue())); RenderProxyGeometry(); if (m_bDoClearView) { m_TargetBinder.Bind(m_pFBOCVHit[size_t(eStereoID)], 0, m_pFBOCVHit[size_t(eStereoID)], 1); m_pProgramIso->Enable(); m_pProgramIso->Set("fIsoval", static_cast (GetNormalizedCVIsovalue())); RenderProxyGeometry(); } } else { m_TargetBinder.Bind(m_pFBO3DImageNext[size_t(eStereoID)]); m_pContext->GetStateManager()->SetDepthMask(false); SetBrickDepShaderVars(renderRegion, b); RenderProxyGeometry(); } m_TargetBinder.Unbind(); } void GLSBVR2D::RenderHQMIPPreLoop(RenderRegion2D& region) { GLRenderer::RenderHQMIPPreLoop(region); m_pProgramHQMIPRot->Enable(); } void GLSBVR2D::RenderHQMIPInLoop(const RenderRegion2D&, const Brick& b) { GPUState localState = m_BaseState; localState.blendFuncSrc = BF_ONE; localState.blendEquation = BE_MAX; localState.enableDepthTest = false; m_pContext->GetStateManager()->Apply(localState); m_SBVRGeogen.SetBrickData(b.vExtension, b.vVoxelCount, b.vTexcoordsMin, b.vTexcoordsMax); m_SBVRGeogen.SetBrickTrans(b.vCenter); if (m_bOrthoView) { // here we push the volume back by one to make sure // the viewing direction computation in the geometry generator // works FLOATMATRIX4 m; m.Translation(0,0,1); m_SBVRGeogen.SetView(m); } else { m_SBVRGeogen.SetView(m_mView[0]); } m_SBVRGeogen.SetWorld(m_maMIPRotation); m_SBVRGeogen.ComputeGeometry(b.bIsEmpty); RenderProxyGeometry(); } bool GLSBVR2D::RegisterDataset(Dataset* ds) { if(GLRenderer::RegisterDataset(ds)) { UINTVECTOR3 vSize = UINTVECTOR3(m_pDataset->GetDomainSize()); FLOATVECTOR3 vAspect = FLOATVECTOR3(m_pDataset->GetScale()); vAspect /= vAspect.maxVal(); m_SBVRGeogen.SetVolumeData(vAspect, vSize); return true; } else { return false; } } void GLSBVR2D::ComposeSurfaceImage(const RenderRegion& renderRegion, EStereoID eStereoID) { GLRenderer::ComposeSurfaceImage(renderRegion, eStereoID); } void GLSBVR2D::UpdateLightParamsInShaders() { GLRenderer::UpdateLightParamsInShaders(); } bool GLSBVR2D::BindVolumeTex(const BrickKey& bkey, const uint64_t iIntraFrameCounter) { if (m_bUse3DTexture) return GLRenderer::BindVolumeTex(bkey,iIntraFrameCounter); m_pGLVolume = m_pMasterController->MemMan()->GetVolume(m_pDataset, bkey, m_bUseOnlyPowerOfTwo, m_bDownSampleTo8Bits, m_bDisableBorder, true, iIntraFrameCounter, m_iFrameCounter, m_pContext->GetShareGroupID()); if(m_pGLVolume) { m_pGLVolume->SetFilter(ComputeGLFilter(), ComputeGLFilter()); return true; } else { return false; } } bool GLSBVR2D::IsVolumeResident(const BrickKey& key) const{ if (m_bUse3DTexture) return GLRenderer::IsVolumeResident(key); else return m_pMasterController->MemMan()->IsResident(m_pDataset, key, m_bUseOnlyPowerOfTwo, m_bDownSampleTo8Bits, m_bDisableBorder, true, m_pContext->GetShareGroupID() ); } void GLSBVR2D::RenderSlice(const RenderRegion2D& region, double fSliceIndex, FLOATVECTOR3 vMinCoords, FLOATVECTOR3 vMaxCoords, DOUBLEVECTOR3 vAspectRatio, DOUBLEVECTOR2 vWinAspectRatio) { GLVolume2DTex* pGLVolume = static_cast(m_pGLVolume); switch (region.windowMode) { case RenderRegion::WM_AXIAL : { if (region.flipView.x) { float fTemp = vMinCoords.x; vMinCoords.x = vMaxCoords.x; vMaxCoords.x = fTemp; } if (region.flipView.y) { float fTemp = vMinCoords.z; vMinCoords.z = vMaxCoords.z; vMaxCoords.z = fTemp; } int iCurrentTexID = int(fSliceIndex*pGLVolume->GetSizeY()); pGLVolume->Bind(0, iCurrentTexID, 1); pGLVolume->Bind(2, iCurrentTexID+1, 1); float fraction = float(fSliceIndex*pGLVolume->GetSizeY() - iCurrentTexID); DOUBLEVECTOR2 v2AspectRatio = vAspectRatio.xz()*DOUBLEVECTOR2(vWinAspectRatio); v2AspectRatio = v2AspectRatio / v2AspectRatio.maxVal(); glBegin(GL_QUADS); glTexCoord3d(vMinCoords.x,vMaxCoords.z,fraction); glVertex3d(-1.0f*v2AspectRatio.x, +1.0f*v2AspectRatio.y, -0.5f); glTexCoord3d(vMaxCoords.x,vMaxCoords.z,fraction); glVertex3d(+1.0f*v2AspectRatio.x, +1.0f*v2AspectRatio.y, -0.5f); glTexCoord3d(vMaxCoords.x,vMinCoords.z,fraction); glVertex3d(+1.0f*v2AspectRatio.x, -1.0f*v2AspectRatio.y, -0.5f); glTexCoord3d(vMinCoords.x,vMinCoords.z,fraction); glVertex3d(-1.0f*v2AspectRatio.x, -1.0f*v2AspectRatio.y, -0.5f); glEnd(); break; } case RenderRegion::WM_CORONAL : { if (region.flipView.x) { float fTemp = vMinCoords.x; vMinCoords.x = vMaxCoords.x; vMaxCoords.x = fTemp; } if (region.flipView.y) { float fTemp = vMinCoords.y; vMinCoords.y = vMaxCoords.y; vMaxCoords.y = fTemp; } DOUBLEVECTOR2 v2AspectRatio = vAspectRatio.xy()*DOUBLEVECTOR2(vWinAspectRatio); v2AspectRatio = v2AspectRatio / v2AspectRatio.maxVal(); int iCurrentTexID = int(fSliceIndex*pGLVolume->GetSizeZ()); pGLVolume->Bind(0, iCurrentTexID, 2); pGLVolume->Bind(2, iCurrentTexID+1, 2); float fraction = float(fSliceIndex*pGLVolume->GetSizeZ() - iCurrentTexID); glBegin(GL_QUADS); glTexCoord3d(vMinCoords.x,vMaxCoords.y,fraction); glVertex3d(-1.0f*v2AspectRatio.x, +1.0f*v2AspectRatio.y, -0.5f); glTexCoord3d(vMaxCoords.x,vMaxCoords.y,fraction); glVertex3d(+1.0f*v2AspectRatio.x, +1.0f*v2AspectRatio.y, -0.5f); glTexCoord3d(vMaxCoords.x,vMinCoords.y,fraction); glVertex3d(+1.0f*v2AspectRatio.x, -1.0f*v2AspectRatio.y, -0.5f); glTexCoord3d(vMinCoords.x,vMinCoords.y,fraction); glVertex3d(-1.0f*v2AspectRatio.x, -1.0f*v2AspectRatio.y, -0.5f); glEnd(); break; } case RenderRegion::WM_SAGITTAL : { if (region.flipView.x) { float fTemp = vMinCoords.y; vMinCoords.y = vMaxCoords.y; vMaxCoords.y = fTemp; } if (region.flipView.y) { float fTemp = vMinCoords.z; vMinCoords.z = vMaxCoords.z; vMaxCoords.z = fTemp; } int iCurrentTexID = int(fSliceIndex*pGLVolume->GetSizeX()); pGLVolume->Bind(0, iCurrentTexID, 0); pGLVolume->Bind(2, iCurrentTexID+1, 0); float fraction = float(fSliceIndex*pGLVolume->GetSizeX() - iCurrentTexID); DOUBLEVECTOR2 v2AspectRatio = vAspectRatio.yz()*DOUBLEVECTOR2(vWinAspectRatio); v2AspectRatio = v2AspectRatio / v2AspectRatio.maxVal(); glBegin(GL_QUADS); glTexCoord3d(vMaxCoords.z,vMinCoords.y,fraction); glVertex3d(-1.0f*v2AspectRatio.x, +1.0f*v2AspectRatio.y, -0.5f); glTexCoord3d(vMaxCoords.z,vMaxCoords.y,fraction); glVertex3d(+1.0f*v2AspectRatio.x, +1.0f*v2AspectRatio.y, -0.5f); glTexCoord3d(vMinCoords.z,vMaxCoords.y,fraction); glVertex3d(+1.0f*v2AspectRatio.x, -1.0f*v2AspectRatio.y, -0.5f); glTexCoord3d(vMinCoords.z,vMinCoords.y,fraction); glVertex3d(-1.0f*v2AspectRatio.x, -1.0f*v2AspectRatio.y, -0.5f); glEnd(); break; } default : T_ERROR("Invalid windowmode set"); break; } } ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLVolume.cpp0000644000175000017500000000367412320456500020645 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLVolume.cpp \author Jens Krueger DFKI Saarbruecken & SCI Institute University of Utah \date May 2010 */ #include "GLVolume.h" using namespace tuvok; GLVolume::GLVolume(uint32_t , uint32_t , uint32_t , GLint , GLenum , GLenum , const GLvoid *, GLint iMagFilter, GLint iMinFilter, GLint , GLint , GLint ) : m_iMagFilter(iMagFilter), m_iMinFilter(iMinFilter) { } GLVolume::GLVolume() { } GLVolume::~GLVolume() { } void GLVolume::SetFilter(GLint iMagFilter, GLint iMinFilter) { m_iMagFilter = iMagFilter; m_iMinFilter = iMinFilter; } ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLCommon.h0000644000175000017500000000302112320456500020255 0ustar mathieumathieu#pragma once #ifndef TUVOK_GL_COMMON_H #define TUVOK_GL_COMMON_H #include "StdTuvokDefines.h" #include namespace GLCommon { size_t gl_internal_bit_size(GLenum internalformat); size_t gl_components(GLenum format); size_t gl_byte_width(GLenum gltype); } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #endif // TUVOK_GL_COMMON_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLVolume2DTex.cpp0000644000175000017500000001763412320456500021515 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLVolume2DTex.cpp \author Jens Krueger DFKI Saarbruecken & SCI Institute University of Utah \date May 2010 */ #include "GLVolume2DTex.h" #include "GLTexture2D.h" #include "GLCommon.h" #include // for memcpy using namespace tuvok; using namespace std; GLVolume2DTex::GLVolume2DTex(uint32_t iSizeX, uint32_t iSizeY, uint32_t iSizeZ, GLint internalformat, GLenum format, GLenum type, const GLvoid *voxels, GLint iMagFilter, GLint iMinFilter, GLint wrapX, GLint wrapY, GLint wrapZ) : GLVolume(iSizeX, iSizeY, iSizeZ, internalformat, format, type, voxels, iMagFilter, iMinFilter,wrapX, wrapY, wrapZ), m_iSizeX(iSizeX), m_iSizeY(iSizeY), m_iSizeZ(iSizeZ), m_internalformat(internalformat), m_format(format), m_type(type), m_wrapX(wrapX), m_wrapY(wrapY), m_wrapZ(wrapZ), m_iGPUSize(0), m_iCPUSize(0) { m_pTextures.resize(3); CreateGLResources(); SetData(voxels); } GLVolume2DTex::GLVolume2DTex() : m_iSizeX(0), m_iSizeY(0), m_iSizeZ(0), m_internalformat(0), m_format(0), m_type(0), m_wrapX(GL_CLAMP_TO_EDGE), m_wrapY(GL_CLAMP_TO_EDGE), m_wrapZ(GL_CLAMP_TO_EDGE), m_iGPUSize(0), m_iCPUSize(0) { m_pTextures.resize(3); } GLVolume2DTex::~GLVolume2DTex() { FreeGLResources(); } void GLVolume2DTex::Bind(uint32_t iUnit, int iDepth, int iStack) const { if (iDepth >= 0 && iDepth < static_cast(m_pTextures[iStack].size())) { m_pTextures[iStack][iDepth]->Bind(iUnit); } else { switch (m_wrapZ) { default: WARNING("Unsupported wrap mode, falling back to GL_CLAMP"); case GL_CLAMP : GLint iPrevUint; GL(glGetIntegerv(GL_ACTIVE_TEXTURE, &iPrevUint)); GL(glActiveTexture(GLenum(GL_TEXTURE0 + iUnit))); GL(glBindTexture(GL_TEXTURE_2D, 0)); GL(glActiveTexture(iPrevUint)); break; case GL_CLAMP_TO_EDGE : if (iDepth < 0) m_pTextures[iStack][0]->Bind(iUnit); else m_pTextures[iStack][m_pTextures[iStack].size()-1]->Bind(iUnit); break; } } } void GLVolume2DTex::CreateGLResources() { m_pTextures[0].resize(m_iSizeX); for (size_t i = 0;iDelete(); delete m_pTextures[iDir][i]; } m_pTextures[iDir][i] = NULL; } m_pTextures[iDir].resize(0); } m_iCPUSize = 0; m_iGPUSize = 0; } void GLVolume2DTex::SetData(const void *voxels) { // push data into the stacks // z is easy as this matches the data layout // x and y are more nasty and require a // random acces traversal througth the data, hence // the complicated indexing const char* charPtr = static_cast(voxels); char* copyBuffer = new char[static_cast(max( m_pTextures[0][0]->GetCPUSize(), m_pTextures[1][0]->GetCPUSize()) )]; size_t sliceElemCount = m_iSizeY*m_iSizeX; size_t elemtSize = GLCommon::gl_byte_width(m_type) * GLCommon::gl_components(m_format); for (size_t i = 0;iSetData(copyBuffer); } for (size_t i = 0;iSetData(copyBuffer); } delete[] copyBuffer; // z direction is easy size_t stepping = static_cast(m_pTextures[2][0]->GetCPUSize()); for (size_t i = 0;iSetData(charPtr); charPtr += stepping; } } uint64_t GLVolume2DTex::GetCPUSize() const { if (m_iCPUSize) return m_iCPUSize; uint64_t iSize = 0; for (size_t iDir = 0;iDirGetCPUSize(); } } return iSize; } uint64_t GLVolume2DTex::GetGPUSize() const { if (m_iGPUSize) return m_iGPUSize; uint64_t iSize = 0; for (size_t iDir = 0;iDirGetGPUSize(); } } return iSize; } void GLVolume2DTex::SetFilter(GLint iMagFilter, GLint iMinFilter) { GLVolume::SetFilter(iMagFilter, iMinFilter); for (size_t iDir = 0;iDirSetFilter(m_iMagFilter, m_iMinFilter); } } } } ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLFBOTex.h0000644000175000017500000001134012320456500020117 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLFBOTex.h \author Jens Krueger SCI Institute University of Utah Jens Schneider tum.3D, Muenchen \date August 2008 */ #ifndef TUVOK_GLFBOTEX_H_ #define TUVOK_GLFBOTEX_H_ #include "../../StdTuvokDefines.h" #include "GLObject.h" #include "GLTexture.h" namespace tuvok { class MasterController; class GLFBOTex : public GLObject { public: GLFBOTex(MasterController* pMasterController, GLenum minfilter, GLenum magfilter, GLenum wrapmode, GLsizei width, GLsizei height, GLenum intformat, GLenum format, GLenum type, bool bHaveDepth=false, int iNumBuffers=1); virtual ~GLFBOTex(void); virtual void SetViewport(); virtual void Write(unsigned int iTargetBuffer=0, int iBuffer=0, bool bCheckBuffer=true); virtual void Read(unsigned int iTargetUnit,int iBuffer=0); virtual void FinishWrite(int iBuffer=0); virtual void FinishRead(int iBuffer=0); virtual void ReadDepth(unsigned int iTargetUnit); virtual void FinishDepthRead(); virtual void CopyToFramebuffer(unsigned int iBuffer=0); virtual void CopyToFramebuffer(unsigned int x, unsigned int w, unsigned int y, unsigned int h, unsigned int tx, unsigned int tw, unsigned int ty, unsigned int th, unsigned int iBuffer=0, GLenum eFilter=GL_NEAREST); virtual operator GLuint(void) { return m_hTexture[0]; } virtual operator GLuint*(void) { return m_hTexture; } /// \todo check how much mem an FBO really occupies virtual uint64_t GetCPUSize() const; virtual uint64_t GetGPUSize() const; static uint64_t EstimateCPUSize(GLsizei width, GLsizei height, size_t iSizePerElement, bool bHaveDepth=false, int iNumBuffers=1); static uint64_t EstimateGPUSize(GLsizei width, GLsizei height, size_t iSizePerElement, bool bHaveDepth=false, int iNumBuffers=1); bool Valid() const { return m_hFBO != 0; } static void NoDrawBuffer(); static void OneDrawBuffer(); static void TwoDrawBuffers(); static void ThreeDrawBuffers(); static void FourDrawBuffers(); void ReadBackPixels(int x, int y, int sX, int sY, void* pData); GLuint Width() const {return m_iSizeX;} GLuint Height() const {return m_iSizeY;} void SetData(const void *pixels, int iBuffer=0, bool bRestoreBinding=true); void SetData(const UINTVECTOR2& offset, const UINTVECTOR2& size, const void *pixels, int iBuffer=0, bool bRestoreBinding=true); private: MasterController* m_pMasterController; GLuint m_iSizeX; GLuint m_iSizeY; GLuint* m_hTexture; GLuint m_hDepthBuffer; static GLuint m_hFBO; static bool m_bInitialized; static int m_iCount; GLenum* m_LastTexUnit; GLenum m_LastDepthTextUnit; int m_iNumBuffers; GLenum* m_LastAttachment; GLenum m_intformat; GLenum m_format; GLenum m_type; bool CheckFBO(const char* method); void initFBO(void); bool initTextures(GLenum minfilter, GLenum magfilter, GLenum wrapmode, GLsizei width, GLsizei height, GLenum intformat, GLenum format, GLenum type); }; } // tuvok namespace #endif // TUVOK_GLFBOTEX_H_ ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLSBVR.cpp0000644000175000017500000005066412320456500020153 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLSBVR.cpp \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #include "GLInclude.h" #include "GLSBVR.h" #include "Controller/Controller.h" #include "Renderer/GL/GLSLProgram.h" #include "Renderer/GL/GLTexture1D.h" #include "Renderer/GL/GLTexture2D.h" #include "Renderer/GPUMemMan/GPUMemMan.h" #include "Renderer/TFScaling.h" #include "Basics/MathTools.h" using namespace std; using namespace tuvok; GLSBVR::GLSBVR(MasterController* pMasterController, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder) : GLRenderer(pMasterController, bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder) { m_bSupportsMeshes = true; m_pProgram1DTransMesh[0] = NULL; m_pProgram1DTransMesh[1] = NULL; m_pProgram2DTransMesh[0] = NULL; m_pProgram2DTransMesh[1] = NULL; } GLSBVR::~GLSBVR() { } void GLSBVR::CleanupShaders() { GLRenderer::CleanupShaders(); CleanupShader(&m_pProgram1DTransMesh[0]); CleanupShader(&m_pProgram1DTransMesh[1]); CleanupShader(&m_pProgram2DTransMesh[0]); CleanupShader(&m_pProgram2DTransMesh[1]); } bool GLSBVR::LoadShaders() { if (!GLRenderer::LoadShaders()) { T_ERROR("Error in parent call -> aborting"); return false; } std::string tfqn = m_pDataset ? this->ColorData() ? "VRender1D-Color" : "VRender1D" : "VRender1D"; const std::string tfqnLit = m_pDataset ? this->ColorData() ? "VRender1DLit-Color.glsl" : "VRender1DLit.glsl" : "VRender1DLit.glsl"; const std::string bias = tfqn + "-BScale.glsl"; tfqn += ".glsl"; if(!LoadAndVerifyShader(&m_pProgram1DTrans[0], m_vShaderSearchDirs, "GLSBVR-VS.glsl", NULL, "Volume3D.glsl", // SampleVolume tfqn.c_str(), // VRender1D bias.c_str(), "VRender1DProxy.glsl", "FTB.glsl", // TraversalOrderDepColor "GLSBVR-1D-FS.glsl", NULL) || !LoadAndVerifyShader(&m_pProgram1DTrans[1], m_vShaderSearchDirs, "GLSBVR-VS.glsl", NULL, "Volume3D.glsl", // SampleVolume tfqnLit.c_str(), // VRender1DLit "lighting.glsl", // Lighting "FTB.glsl", // TraversalOrderDepColor "GLSBVR-1D-light-FS.glsl", NULL) || !LoadAndVerifyShader(&m_pProgram2DTrans[0], m_vShaderSearchDirs, "GLSBVR-VS.glsl", NULL, "Volume3D.glsl", // SampleVolume, ComputeGradient "FTB.glsl", // TraversalOrderDepColor "GLSBVR-2D-FS.glsl", NULL) || !LoadAndVerifyShader(&m_pProgram2DTrans[1], m_vShaderSearchDirs, "GLSBVR-VS.glsl", NULL, "Volume3D.glsl", // SampleVolume, ComputeGradient "lighting.glsl", // Lighting "FTB.glsl", // TraversalOrderDepColor "GLSBVR-2D-light-FS.glsl", NULL) || !LoadAndVerifyShader(&m_pProgramHQMIPRot, m_vShaderSearchDirs, "GLSBVR-VS.glsl", NULL, "Volume3D.glsl", // SampleVolume "GLSBVR-MIP-Rot-FS.glsl", NULL) || !LoadAndVerifyShader(&m_pProgramIso, m_vShaderSearchDirs, "GLSBVR-VS.glsl", NULL, "Volume3D.glsl", // SampleVolume, ComputeNormal "GLSBVR-ISO-FS.glsl", NULL) || !LoadAndVerifyShader(&m_pProgramColor, m_vShaderSearchDirs, "GLSBVR-VS.glsl", NULL, "Volume3D.glsl", // SampleVolume, ComputeNormal "GLSBVR-Color-FS.glsl", NULL) || !LoadAndVerifyShader(&m_pProgram1DTransMesh[0], m_vShaderSearchDirs, "GLSBVR-Mesh-VS.glsl", NULL, "Volume3D.glsl", // SampleVolume tfqn.c_str(), // VRender1D bias.c_str(), "FTB.glsl", // TraversalOrderDepColor "lighting.glsl", // Lighting (for Mesh) "VRender1DProxy.glsl", "GLSBVR-Mesh-1D-FS.glsl", NULL) || !LoadAndVerifyShader(&m_pProgram1DTransMesh[1], m_vShaderSearchDirs, "GLSBVR-Mesh-VS.glsl", NULL, "Volume3D.glsl", // SampleVolume tfqnLit.c_str(), // VRender1DLit "lighting.glsl", // Lighting "FTB.glsl", // TraversalOrderDepColor "GLSBVR-Mesh-1D-light-FS.glsl", NULL) || !LoadAndVerifyShader(&m_pProgram2DTransMesh[0], m_vShaderSearchDirs, "GLSBVR-Mesh-VS.glsl", NULL, "Volume3D.glsl", // SampleVolume, ComputeNormal "lighting.glsl", // Lighting (for Mesh) "FTB.glsl", // TraversalOrderDepColor "GLSBVR-Mesh-2D-FS.glsl", NULL) || !LoadAndVerifyShader(&m_pProgram2DTransMesh[1], m_vShaderSearchDirs, "GLSBVR-Mesh-VS.glsl", NULL, "Volume3D.glsl", // SampleVolume "lighting.glsl", // Lighting "FTB.glsl", // TraversalOrderDepColor "GLSBVR-Mesh-2D-light-FS.glsl", NULL)) { Cleanup(); T_ERROR("Error loading a shader."); return false; } else { m_pProgram1DTrans[0]->ConnectTextureID("texVolume",0); m_pProgram1DTrans[0]->ConnectTextureID("texTrans",1); m_pProgram1DTrans[1]->ConnectTextureID("texVolume",0); m_pProgram1DTrans[1]->ConnectTextureID("texTrans",1); m_pProgram2DTrans[0]->ConnectTextureID("texVolume",0); m_pProgram2DTrans[0]->ConnectTextureID("texTrans",1); m_pProgram2DTrans[1]->ConnectTextureID("texVolume",0); m_pProgram2DTrans[1]->ConnectTextureID("texTrans",1); m_pProgram1DTransMesh[0]->ConnectTextureID("texVolume",0); m_pProgram1DTransMesh[0]->ConnectTextureID("texTrans",1); m_pProgram1DTransMesh[1]->ConnectTextureID("texVolume",0); m_pProgram1DTransMesh[1]->ConnectTextureID("texTrans",1); m_pProgram2DTransMesh[0]->ConnectTextureID("texVolume",0); m_pProgram2DTransMesh[0]->ConnectTextureID("texTrans",1); m_pProgram2DTransMesh[1]->ConnectTextureID("texVolume",0); m_pProgram2DTransMesh[1]->ConnectTextureID("texTrans",1); m_pProgramIso->ConnectTextureID("texVolume",0); m_pProgramColor->ConnectTextureID("texVolume",0); m_pProgramHQMIPRot->ConnectTextureID("texVolume",0); UpdateLightParamsInShaders(); } return true; } void GLSBVR::SetDataDepShaderVars() { GLRenderer::SetDataDepShaderVars(); if (m_SBVRGeogen.HasMesh()) { // if m_bDownSampleTo8Bits is enabled the full range from 0..255 -> 0..1 is used float fScale = CalculateScaling(); float fGradientScale = (m_pDataset->MaxGradientMagnitude() == 0) ? 1.0f : 1.0f/m_pDataset->MaxGradientMagnitude(); switch (m_eRenderMode) { case RM_1DTRANS: { m_pProgram1DTransMesh[m_bUseLighting ? 1 : 0]->Enable(); m_pProgram1DTransMesh[m_bUseLighting ? 1 : 0]->Set("fTransScale",fScale); break; } case RM_2DTRANS: { m_pProgram2DTransMesh[m_bUseLighting ? 1 : 0]->Enable(); m_pProgram2DTransMesh[m_bUseLighting ? 1 : 0]->Set("fTransScale",fScale); m_pProgram2DTransMesh[m_bUseLighting ? 1 : 0]->Set("fGradientScale",fGradientScale); break; } default : break; // suppress warnings } } if(m_eRenderMode == RM_1DTRANS && m_TFScalingMethod == SMETH_BIAS_AND_SCALE) { std::pair bias_scale = scale_bias_and_scale(*m_pDataset); MESSAGE("setting TF bias (%5.3f) and scale (%5.3f)", bias_scale.first, bias_scale.second); m_pProgram1DTrans[m_bUseLighting ? 1 : 0]->Enable(); m_pProgram1DTrans[m_bUseLighting ? 1 : 0]->Set("TFuncBias", bias_scale.first); m_pProgram1DTrans[m_bUseLighting ? 1 : 0]->Set("fTransScale", bias_scale.second); } } void GLSBVR::SetBrickDepShaderVars(const Brick& currentBrick) { FLOATVECTOR3 vVoxelSizeTexSpace; if (m_bUseOnlyPowerOfTwo) { UINTVECTOR3 vP2VoxelCount(MathTools::NextPow2(currentBrick.vVoxelCount.x), MathTools::NextPow2(currentBrick.vVoxelCount.y), MathTools::NextPow2(currentBrick.vVoxelCount.z)); vVoxelSizeTexSpace = 1.0f/FLOATVECTOR3(vP2VoxelCount); } else { vVoxelSizeTexSpace = 1.0f/FLOATVECTOR3(currentBrick.vVoxelCount); } float fStepScale = m_SBVRGeogen.GetOpacityCorrection(); GLSLProgram *shader; switch (m_eRenderMode) { case RM_1DTRANS: { shader = (m_SBVRGeogen.HasMesh() ? (m_pProgram1DTransMesh[m_bUseLighting ? 1 : 0]) : (m_pProgram1DTrans[m_bUseLighting ? 1 : 0])); shader->Enable(); shader->Set("fStepScale", fStepScale); if (m_bUseLighting) { shader->Set("vVoxelStepsize", vVoxelSizeTexSpace.x, vVoxelSizeTexSpace.y, vVoxelSizeTexSpace.z); } break; } case RM_2DTRANS: { shader = (m_SBVRGeogen.HasMesh() ? (m_pProgram2DTransMesh[m_bUseLighting ? 1 : 0]) : (m_pProgram2DTrans[m_bUseLighting ? 1 : 0])); shader->Enable(); shader->Set("fStepScale", fStepScale); shader->Set("vVoxelStepsize", vVoxelSizeTexSpace.x, vVoxelSizeTexSpace.y, vVoxelSizeTexSpace.z); break; } case RM_ISOSURFACE: { shader = this->ColorData() ? m_pProgramColor : m_pProgramIso; shader->Enable(); shader->Set("vVoxelStepsize", vVoxelSizeTexSpace.x, vVoxelSizeTexSpace.y, vVoxelSizeTexSpace.z); break; } default: T_ERROR("Invalid rendermode set"); break; } } void GLSBVR::EnableClipPlane(RenderRegion *renderRegion) { if(!m_bClipPlaneOn) { AbstrRenderer::EnableClipPlane(renderRegion); m_SBVRGeogen.EnableClipPlane(); PLANE plane(m_ClipPlane.Plane()); m_SBVRGeogen.SetClipPlane(plane); } } void GLSBVR::DisableClipPlane(RenderRegion *renderRegion) { if(m_bClipPlaneOn) { AbstrRenderer::DisableClipPlane(renderRegion); m_SBVRGeogen.DisableClipPlane(); } } void GLSBVR::Render3DPreLoop(const RenderRegion3D&) { m_SBVRGeogen.SetSamplingModifier( m_fSampleRateModifier / (this->decreaseSamplingRateNow ? m_fSampleDecFactor : 1.0f)); if(m_bClipPlaneOn) { m_SBVRGeogen.EnableClipPlane(); PLANE plane(m_ClipPlane.Plane()); m_SBVRGeogen.SetClipPlane(plane); } else { m_SBVRGeogen.DisableClipPlane(); } switch (m_eRenderMode) { case RM_1DTRANS : m_p1DTransTex->Bind(1); m_pProgram1DTrans[m_bUseLighting ? 1 : 0]->Enable(); break; case RM_2DTRANS : m_p2DTransTex->Bind(1); m_pProgram2DTrans[m_bUseLighting ? 1 : 0]->Enable(); break; case RM_ISOSURFACE : // can't set the shader here as multiple shaders // are used for that renderer break; default : T_ERROR("Invalid rendermode set"); break; } m_SBVRGeogen.SetLODData( UINTVECTOR3(m_pDataset->GetDomainSize(static_cast(m_iCurrentLOD)))); } #define BUFFER_OFFSET(i) ((char *)NULL + (i)) GLsizei iStructSize = GLsizei(sizeof(VERTEX_FORMAT)); void GLSBVR::RenderProxyGeometry() const { if (m_SBVRGeogen.m_vSliceTriangles.empty()) return; GL(glBindBuffer(GL_ARRAY_BUFFER, m_GeoBuffer)); GL(glBufferData(GL_ARRAY_BUFFER, GLsizei(m_SBVRGeogen.m_vSliceTriangles.size())*iStructSize, &m_SBVRGeogen.m_vSliceTriangles[0], GL_STREAM_DRAW)); GL(glVertexPointer(3, GL_FLOAT, iStructSize, BUFFER_OFFSET(0))); if (m_SBVRGeogen.HasMesh()) { GL(glTexCoordPointer(4 , GL_FLOAT, iStructSize, BUFFER_OFFSET(12))); GL(glNormalPointer(GL_FLOAT, iStructSize, BUFFER_OFFSET(28))); GL(glEnableClientState(GL_NORMAL_ARRAY)); } else { GL(glTexCoordPointer(3, GL_FLOAT, iStructSize, BUFFER_OFFSET(12))); } GL(glEnableClientState(GL_VERTEX_ARRAY)); GL(glEnableClientState(GL_TEXTURE_COORD_ARRAY)); GL(glDrawArrays(GL_TRIANGLES, 0, GLsizei(m_SBVRGeogen.m_vSliceTriangles.size()))); GL(glDisableClientState(GL_VERTEX_ARRAY)); GL(glDisableClientState(GL_TEXTURE_COORD_ARRAY)); GL(glDisableClientState(GL_NORMAL_ARRAY)); } void GLSBVR::Render3DInLoop(const RenderRegion3D& renderRegion, size_t iCurrentBrick, EStereoID eStereoID) { m_pContext->GetStateManager()->Apply(m_BaseState); const Brick& b = (eStereoID == SI_LEFT_OR_MONO) ? m_vCurrentBrickList[iCurrentBrick] : m_vLeftEyeBrickList[iCurrentBrick]; if (m_iBricksRenderedInThisSubFrame == 0 && m_eRenderMode == RM_ISOSURFACE){ m_TargetBinder.Bind(m_pFBOIsoHit[size_t(eStereoID)], 0, m_pFBOIsoHit[size_t(eStereoID)], 1); GL(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)); if (m_bDoClearView) { m_TargetBinder.Bind(m_pFBOCVHit[size_t(eStereoID)], 0, m_pFBOCVHit[size_t(eStereoID)], 1); GL(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)); } } if (!m_bSupportsMeshes && b.bIsEmpty) return; // setup the slice generator m_SBVRGeogen.SetBrickData(b.vExtension, b.vVoxelCount, b.vTexcoordsMin, b.vTexcoordsMax); FLOATMATRIX4 maBricktTrans; maBricktTrans.Translation(b.vCenter.x, b.vCenter.y, b.vCenter.z); m_mProjection[size_t(eStereoID)].setProjection(); renderRegion.modelView[size_t(eStereoID)].setModelview(); m_SBVRGeogen.SetBrickTrans(b.vCenter); m_SBVRGeogen.SetWorld(renderRegion.rotation*renderRegion.translation); m_SBVRGeogen.SetView(m_mView[size_t(eStereoID)]); if (m_bSupportsMeshes) { m_SBVRGeogen.ResetMesh(); if (m_eRenderMode != RM_ISOSURFACE) { for (vector>::iterator mesh = m_Meshes.begin(); mesh != m_Meshes.end(); mesh++) { if ((*mesh)->GetActive()) { m_SBVRGeogen.AddMesh((*mesh)->GetInPointList(false)); } } } } m_SBVRGeogen.ComputeGeometry(b.bIsEmpty); if (m_eRenderMode == RM_ISOSURFACE) { m_pContext->GetStateManager()->SetEnableBlend(false); m_TargetBinder.Bind(m_pFBOIsoHit[size_t(eStereoID)], 0, m_pFBOIsoHit[size_t(eStereoID)], 1); SetBrickDepShaderVars(b); GLSLProgram* shader = this->ColorData() ? m_pProgramColor : m_pProgramIso; shader->Set("fIsoval", static_cast (this->GetNormalizedIsovalue())); RenderProxyGeometry(); if (m_bDoClearView) { m_TargetBinder.Bind(m_pFBOCVHit[size_t(eStereoID)], 0, m_pFBOCVHit[size_t(eStereoID)], 1); m_pProgramIso->Enable(); m_pProgramIso->Set("fIsoval", static_cast (GetNormalizedCVIsovalue())); RenderProxyGeometry(); } } else { m_pContext->GetStateManager()->SetDepthMask(false); m_TargetBinder.Bind(m_pFBO3DImageNext[size_t(eStereoID)]); SetBrickDepShaderVars(b); RenderProxyGeometry(); } m_TargetBinder.Unbind(); } void GLSBVR::RenderHQMIPPreLoop(RenderRegion2D ®ion) { GLRenderer::RenderHQMIPPreLoop(region); m_pProgramHQMIPRot->Enable(); } void GLSBVR::RenderHQMIPInLoop(const RenderRegion2D &, const Brick& b) { m_SBVRGeogen.SetBrickData(b.vExtension, b.vVoxelCount, b.vTexcoordsMin, b.vTexcoordsMax); if (m_bOrthoView) m_SBVRGeogen.SetView(FLOATMATRIX4()); else m_SBVRGeogen.SetView(m_mView[0]); m_SBVRGeogen.SetBrickTrans(b.vCenter); m_SBVRGeogen.SetWorld(m_maMIPRotation); m_SBVRGeogen.ComputeGeometry(false); GPUState localState = m_BaseState; localState.blendFuncSrc = BF_ONE; localState.blendEquation = BE_MAX; localState.enableDepthTest = false; m_pContext->GetStateManager()->Apply(localState); RenderProxyGeometry(); } bool GLSBVR::RegisterDataset(Dataset* ds) { if(GLRenderer::RegisterDataset(ds)) { UINTVECTOR3 vSize = UINTVECTOR3(m_pDataset->GetDomainSize()); FLOATVECTOR3 vAspect = FLOATVECTOR3(m_pDataset->GetScale()); vAspect /= vAspect.maxVal(); m_SBVRGeogen.SetVolumeData(vAspect, vSize); return true; } else { return false; } } void GLSBVR::UpdateLightParamsInShaders() { GLRenderer::UpdateLightParamsInShaders(); FLOATVECTOR3 a = m_cAmbient.xyz()*m_cAmbient.w; FLOATVECTOR3 d = m_cDiffuse.xyz()*m_cDiffuse.w; FLOATVECTOR3 s = m_cSpecular.xyz()*m_cSpecular.w; FLOATVECTOR3 aM = m_cAmbientM.xyz()*m_cAmbientM.w; FLOATVECTOR3 dM = m_cDiffuseM.xyz()*m_cDiffuseM.w; FLOATVECTOR3 sM = m_cSpecularM.xyz()*m_cSpecularM.w; FLOATVECTOR3 scale = 1.0f/FLOATVECTOR3(m_pDataset->GetScale()); m_pProgram1DTransMesh[0]->Enable(); m_pProgram1DTransMesh[0]->Set("vLightAmbientM",aM.x,aM.y,aM.z); m_pProgram1DTransMesh[0]->Set("vLightDiffuseM",dM.x,dM.y,dM.z); m_pProgram1DTransMesh[0]->Set("vLightSpecularM",sM.x,sM.y,sM.z); m_pProgram1DTransMesh[0]->Set("vLightDir",m_vLightDir.x,m_vLightDir.y,m_vLightDir.z); m_pProgram2DTransMesh[0]->Enable(); m_pProgram2DTransMesh[0]->Set("vLightAmbientM",aM.x,aM.y,aM.z); m_pProgram2DTransMesh[0]->Set("vLightDiffuseM",dM.x,dM.y,dM.z); m_pProgram2DTransMesh[0]->Set("vLightSpecularM",sM.x,sM.y,sM.z); m_pProgram2DTransMesh[0]->Set("vLightDir",m_vLightDir.x,m_vLightDir.y,m_vLightDir.z); m_pProgram1DTransMesh[1]->Enable(); m_pProgram1DTransMesh[1]->Set("vLightAmbient",a.x,a.y,a.z); m_pProgram1DTransMesh[1]->Set("vLightDiffuse",d.x,d.y,d.z); m_pProgram1DTransMesh[1]->Set("vLightSpecular",s.x,s.y,s.z); m_pProgram1DTransMesh[1]->Set("vLightAmbientM",aM.x,aM.y,aM.z); m_pProgram1DTransMesh[1]->Set("vLightDiffuseM",dM.x,dM.y,dM.z); m_pProgram1DTransMesh[1]->Set("vLightSpecularM",sM.x,sM.y,sM.z); m_pProgram1DTransMesh[1]->Set("vLightDir",m_vLightDir.x,m_vLightDir.y,m_vLightDir.z); m_pProgram1DTransMesh[1]->Set("vDomainScale",scale.x,scale.y,scale.z); m_pProgram2DTransMesh[1]->Enable(); m_pProgram2DTransMesh[1]->Set("vLightAmbient",a.x,a.y,a.z); m_pProgram2DTransMesh[1]->Set("vLightDiffuse",d.x,d.y,d.z); m_pProgram2DTransMesh[1]->Set("vLightSpecular",s.x,s.y,s.z); m_pProgram2DTransMesh[1]->Set("vLightAmbientM",aM.x,aM.y,aM.z); m_pProgram2DTransMesh[1]->Set("vLightDiffuseM",dM.x,dM.y,dM.z); m_pProgram2DTransMesh[1]->Set("vLightSpecularM",sM.x,sM.y,sM.z); m_pProgram2DTransMesh[1]->Set("vLightDir",m_vLightDir.x,m_vLightDir.y,m_vLightDir.z); m_pProgram2DTransMesh[1]->Set("vDomainScale",scale.x,scale.y,scale.z); } ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLRaycaster.cpp0000644000175000017500000005607112320456500021332 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLRaycaster.cpp \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #include "GLInclude.h" #include "GLRaycaster.h" #include "GLFBOTex.h" #include "GLVBO.h" #include #include "../GPUMemMan/GPUMemMan.h" #include "../../Basics/Plane.h" #include "GLSLProgram.h" #include "GLTexture1D.h" #include "GLTexture2D.h" #include "Renderer/TFScaling.h" #include "Basics/MathTools.h" #include "Basics/Clipper.h" using namespace std; using namespace tuvok; GLRaycaster::GLRaycaster(MasterController* pMasterController, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder) : GLGPURayTraverser(pMasterController, bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder), m_pFBORayEntry(NULL), m_pProgramRenderFrontFaces(NULL), m_pProgramRenderFrontFacesNT(NULL), m_pProgramIso2(NULL) { m_bSupportsMeshes = false; // for now we require full support // otherweise we rather say no } GLRaycaster::~GLRaycaster() { } void GLRaycaster::CleanupShaders() { GLGPURayTraverser::CleanupShaders(); CleanupShader(&m_pProgramRenderFrontFaces); CleanupShader(&m_pProgramRenderFrontFacesNT); CleanupShader(&m_pProgramIso2); } void GLRaycaster::Cleanup() { GLGPURayTraverser::Cleanup(); if (m_pFBORayEntry){ m_pMasterController->MemMan()->FreeFBO(m_pFBORayEntry); m_pFBORayEntry = NULL; } } void GLRaycaster::CreateOffscreenBuffers() { GLGPURayTraverser::CreateOffscreenBuffers(); if (m_pFBORayEntry){m_pMasterController->MemMan()->FreeFBO(m_pFBORayEntry); m_pFBORayEntry = NULL;} if (m_vWinSize.area() > 0) { m_pFBORayEntry = m_pMasterController->MemMan()->GetFBO(GL_NEAREST, GL_NEAREST, GL_CLAMP, m_vWinSize.x, m_vWinSize.y, GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, m_pContext->GetShareGroupID(), false); } } bool GLRaycaster::LoadShaders() { if (!GLGPURayTraverser::LoadShaders()) { T_ERROR("Error in parent call -> aborting"); return false; } const char* shaderNames[7]; shaderNames[0] = "GLRaycaster-1D-FS.glsl"; shaderNames[1] = "GLRaycaster-1D-light-FS.glsl"; shaderNames[2] = "GLRaycaster-2D-FS.glsl"; shaderNames[3] = "GLRaycaster-2D-light-FS.glsl"; shaderNames[4] = "GLRaycaster-Color-FS.glsl"; shaderNames[5] = "GLRaycaster-ISO-CV-FS.glsl"; shaderNames[6] = "GLRaycaster-ISO-FS.glsl"; std::string tfqn = m_pDataset ? this->ColorData() ? "VRender1D-Color" : "VRender1D" : "VRender1D"; const std::string tfqnLit = m_pDataset ? this->ColorData() ? "VRender1DLit-Color.glsl" : "VRender1DLit.glsl" : "VRender1DLit.glsl"; const std::string bias = tfqn + "-BScale.glsl"; tfqn += ".glsl"; if(!LoadAndVerifyShader(&m_pProgramRenderFrontFaces, m_vShaderSearchDirs, "GLRaycaster-VS.glsl", NULL, "GLRaycaster-frontfaces-FS.glsl", NULL) || !LoadAndVerifyShader(&m_pProgramRenderFrontFacesNT, m_vShaderSearchDirs, "GLRaycasterNoTransform-VS.glsl", NULL, "GLRaycaster-frontfaces-FS.glsl", NULL) || !LoadAndVerifyShader(&m_pProgram1DTrans[0], m_vShaderSearchDirs, "GLRaycaster-VS.glsl", NULL, "Compositing.glsl", // UnderCompositing "Volume3D.glsl", // SampleVolume tfqn.c_str(), // VRender1D bias.c_str(), "VRender1DProxy.glsl", shaderNames[0], NULL) || !LoadAndVerifyShader(&m_pProgram1DTrans[1], m_vShaderSearchDirs, "GLRaycaster-VS.glsl", NULL, "Compositing.glsl", // UnderCompositing "Volume3D.glsl", // SampleVolume "lighting.glsl", // Lighting tfqnLit.c_str(), // VRender1DLit shaderNames[1], NULL) || !LoadAndVerifyShader(&m_pProgram2DTrans[0], m_vShaderSearchDirs, "GLRaycaster-VS.glsl", NULL, "Compositing.glsl", // UnderCompositing "Volume3D.glsl", // SampleVolume, ComputeGradient shaderNames[2], NULL) || !LoadAndVerifyShader(&m_pProgram2DTrans[1], m_vShaderSearchDirs, "GLRaycaster-VS.glsl", NULL, "Compositing.glsl", // UnderCompositing "Volume3D.glsl", // SampleVolume, ComputeGradient "lighting.glsl", // Lighting shaderNames[3], NULL) || !LoadAndVerifyShader(&m_pProgramIso, m_vShaderSearchDirs, "GLRaycaster-VS.glsl", NULL, "RefineIsosurface.glsl", // RefineIsosurface "Volume3D.glsl", // SampleVolume, ComputeNormal shaderNames[6], NULL) || !LoadAndVerifyShader(&m_pProgramColor, m_vShaderSearchDirs, "GLRaycaster-VS.glsl", NULL, "RefineIsosurface.glsl", // RefineIsosurface "Volume3D.glsl", // SampleVolume, ComputeNormal shaderNames[4], NULL) || !LoadAndVerifyShader(&m_pProgramIso2, m_vShaderSearchDirs, "GLRaycaster-VS.glsl", NULL, "RefineIsosurface.glsl", // RefineIsosurface "Volume3D.glsl", // SampleVolume, ComputeNormal shaderNames[5], NULL) || !LoadAndVerifyShader(&m_pProgramHQMIPRot, m_vShaderSearchDirs, "GLRaycaster-VS.glsl", NULL, "Volume3D.glsl", // SampleVolume "GLRaycaster-MIP-Rot-FS.glsl", NULL)) { Cleanup(); T_ERROR("Error loading a shader."); return false; } else { m_pProgram1DTrans[0]->ConnectTextureID("texVolume",0); m_pProgram1DTrans[0]->ConnectTextureID("texTrans",1); m_pProgram1DTrans[0]->ConnectTextureID("texRayExitPos",2); m_pProgram1DTrans[1]->ConnectTextureID("texVolume",0); m_pProgram1DTrans[1]->ConnectTextureID("texTrans",1); m_pProgram1DTrans[1]->ConnectTextureID("texRayExitPos",2); m_pProgram2DTrans[0]->ConnectTextureID("texVolume",0); m_pProgram2DTrans[0]->ConnectTextureID("texTrans",1); m_pProgram2DTrans[0]->ConnectTextureID("texRayExitPos",2); m_pProgram2DTrans[1]->ConnectTextureID("texVolume",0); m_pProgram2DTrans[1]->ConnectTextureID("texTrans",1); m_pProgram2DTrans[1]->ConnectTextureID("texRayExitPos",2); FLOATVECTOR2 vParams = m_FrustumCullingLOD.GetDepthScaleParams(); m_pProgramIso->ConnectTextureID("texVolume",0); m_pProgramIso->ConnectTextureID("texRayExitPos",2); m_pProgramIso->Set("vProjParam",vParams.x, vParams.y); m_pProgramIso->Set("iTileID", 1); // just to make sure it is never 0 m_pProgramColor->ConnectTextureID("texVolume",0); m_pProgramColor->ConnectTextureID("texRayExitPos",2); m_pProgramColor->Set("vProjParam",vParams.x, vParams.y); m_pProgramHQMIPRot->ConnectTextureID("texVolume",0); m_pProgramHQMIPRot->ConnectTextureID("texRayExitPos",2); m_pProgramIso2->ConnectTextureID("texVolume",0); m_pProgramIso2->ConnectTextureID("texRayExitPos",2); m_pProgramIso2->ConnectTextureID("texLastHit",4); m_pProgramIso2->ConnectTextureID("texLastHitPos",5); UpdateLightParamsInShaders(); return true; } } void GLRaycaster::SetBrickDepShaderVars(const RenderRegion3D&, const Brick& currentBrick, size_t iCurrentBrick) { FLOATVECTOR3 vVoxelSizeTexSpace; if (m_bUseOnlyPowerOfTwo) { UINTVECTOR3 vP2VoxelCount(MathTools::NextPow2(currentBrick.vVoxelCount.x), MathTools::NextPow2(currentBrick.vVoxelCount.y), MathTools::NextPow2(currentBrick.vVoxelCount.z)); vVoxelSizeTexSpace = 1.0f/FLOATVECTOR3(vP2VoxelCount); } else { vVoxelSizeTexSpace = 1.0f/FLOATVECTOR3(currentBrick.vVoxelCount); } float fSampleRateModifier = m_fSampleRateModifier / (this->decreaseSamplingRateNow ? m_fSampleDecFactor : 1.0f); float fRayStep = (currentBrick.vExtension*vVoxelSizeTexSpace * 0.5f * 1.0f/fSampleRateModifier).minVal(); float fStepScale = 1.0f/fSampleRateModifier * (FLOATVECTOR3(m_pDataset->GetDomainSize())/FLOATVECTOR3(m_pDataset->GetDomainSize(static_cast(m_iCurrentLOD)))).maxVal(); switch (m_eRenderMode) { case RM_1DTRANS : { m_pProgram1DTrans[m_bUseLighting ? 1 : 0]->Set("fStepScale", fStepScale); m_pProgram1DTrans[m_bUseLighting ? 1 : 0]->Set("fRayStepsize", fRayStep); if (m_bUseLighting) m_pProgram1DTrans[1]->Set("vVoxelStepsize", vVoxelSizeTexSpace.x, vVoxelSizeTexSpace.y, vVoxelSizeTexSpace.z ); break; } case RM_2DTRANS : { m_pProgram2DTrans[m_bUseLighting ? 1 : 0]->Set("fStepScale", fStepScale); m_pProgram2DTrans[m_bUseLighting ? 1 : 0]->Set("vVoxelStepsize", vVoxelSizeTexSpace.x, vVoxelSizeTexSpace.y, vVoxelSizeTexSpace.z ); m_pProgram2DTrans[m_bUseLighting ? 1 : 0]->Set("fRayStepsize", fRayStep); break; } case RM_ISOSURFACE : { GLSLProgram* shader = this->ColorData() ? m_pProgramColor : m_pProgramIso; if (m_bDoClearView) { m_pProgramIso2->Enable(); m_pProgramIso2->Set("vVoxelStepsize", vVoxelSizeTexSpace.x, vVoxelSizeTexSpace.y, vVoxelSizeTexSpace.z ); m_pProgramIso2->Set("fRayStepsize", fRayStep); m_pProgramIso2->Set("iTileID", int(iCurrentBrick)); shader->Enable(); shader->Set("iTileID", int(iCurrentBrick)); } shader->Set("vVoxelStepsize", vVoxelSizeTexSpace.x, vVoxelSizeTexSpace.y, vVoxelSizeTexSpace.z ); shader->Set("fRayStepsize", fRayStep); break; } case RM_INVALID: T_ERROR("Invalid rendermode set"); break; } } void GLRaycaster::RenderBox(const RenderRegion& renderRegion, const FLOATVECTOR3& vCenter, const FLOATVECTOR3& vExtend, const FLOATVECTOR3& vMinCoords, const FLOATVECTOR3& vMaxCoords, bool bCullBack, EStereoID eStereoID) const { m_pContext->GetStateManager()->SetCullState(bCullBack ? CULL_FRONT : CULL_BACK); FLOATVECTOR3 vMinPoint, vMaxPoint; vMinPoint = (vCenter - vExtend/2.0); vMaxPoint = (vCenter + vExtend/2.0); // \todo compute this only once per brick FLOATMATRIX4 m = ComputeEyeToTextureMatrix(renderRegion, FLOATVECTOR3(vMaxPoint.x, vMaxPoint.y, vMaxPoint.z), FLOATVECTOR3(vMaxCoords.x, vMaxCoords.y, vMaxCoords.z), FLOATVECTOR3(vMinPoint.x, vMinPoint.y, vMinPoint.z), FLOATVECTOR3(vMinCoords.x, vMinCoords.y, vMinCoords.z), eStereoID); m.setTextureMatrix(); std::vector posData; MaxMinBoxToVector(vMinPoint, vMaxPoint, posData); if ( m_bClipPlaneOn ) { // clip plane is normaly defined in world space, transform back to model space FLOATMATRIX4 inv = (renderRegion.rotation * renderRegion.translation).inverse(); PLANE transformed = m_ClipPlane.Plane() * inv; const FLOATVECTOR3 normal(transformed.xyz().normalized()); const float d = transformed.d(); Clipper::BoxPlane(posData, normal, d); } m_pBBoxVBO->ClearVertexData(); m_pBBoxVBO->AddVertexData(posData); m_pBBoxVBO->Bind(); m_pBBoxVBO->Draw(GL_TRIANGLES); m_pBBoxVBO->UnBind(); } void GLRaycaster::Render3DPreLoop(const RenderRegion3D &) { // render nearplane into buffer if (m_iBricksRenderedInThisSubFrame == 0) { GPUState localState = m_BaseState; localState.enableBlend = false; localState.depthMask = false; localState.enableDepthTest = false; m_pContext->GetStateManager()->Apply(localState); m_TargetBinder.Bind(m_pFBORayEntry); FLOATMATRIX4 mInvProj = m_mProjection[0].inverse(); mInvProj.setProjection(); m_pProgramRenderFrontFacesNT->Enable(); m_pNearPlaneQuad->Bind(); m_pNearPlaneQuad->Draw(GL_QUADS); m_pNearPlaneQuad->UnBind(); m_TargetBinder.Unbind(); } switch (m_eRenderMode) { case RM_1DTRANS : m_p1DTransTex->Bind(1); break; case RM_2DTRANS : m_p2DTransTex->Bind(1); break; case RM_ISOSURFACE : break; default : T_ERROR("Invalid rendermode set"); break; } } void GLRaycaster::Render3DInLoop(const RenderRegion3D& renderRegion, size_t iCurrentBrick, EStereoID eStereoID) { m_pContext->GetStateManager()->Apply(m_BaseState); const Brick& b = (eStereoID == SI_LEFT_OR_MONO) ? m_vCurrentBrickList[iCurrentBrick] : m_vLeftEyeBrickList[iCurrentBrick]; if (m_iBricksRenderedInThisSubFrame == 0 && m_eRenderMode == RM_ISOSURFACE){ m_TargetBinder.Bind(m_pFBOIsoHit[size_t(eStereoID)], 0, m_pFBOIsoHit[size_t(eStereoID)], 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if (m_bDoClearView) { m_TargetBinder.Bind(m_pFBOCVHit[size_t(eStereoID)], 0, m_pFBOCVHit[size_t(eStereoID)], 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } } if (b.bIsEmpty) return; GPUState localState = m_BaseState; localState.enableBlend = false; localState.depthMask = false; localState.enableCullFace = true; m_pContext->GetStateManager()->Apply(localState); renderRegion.modelView[size_t(eStereoID)].setModelview(); m_mProjection[size_t(eStereoID)].setProjection(); // write frontfaces (ray entry points) m_TargetBinder.Bind(m_pFBORayEntry); m_pProgramRenderFrontFaces->Enable(); RenderBox(renderRegion, b.vCenter, b.vExtension, b.vTexcoordsMin, b.vTexcoordsMax, false, eStereoID); /* float* vec = new float[m_pFBORayEntry->Width()*m_pFBORayEntry->Height()*4]; m_pFBORayEntry->ReadBackPixels(0,0,m_pFBORayEntry->Width(),m_pFBORayEntry->Height(), vec); delete [] vec; */ if (m_eRenderMode == RM_ISOSURFACE) { m_pContext->GetStateManager()->SetDepthMask(true); m_TargetBinder.Bind(m_pFBOIsoHit[size_t(eStereoID)], 0, m_pFBOIsoHit[size_t(eStereoID)], 1); GLSLProgram* shader = this->ColorData() ? m_pProgramColor : m_pProgramIso; shader->Enable(); SetBrickDepShaderVars(renderRegion, b, iCurrentBrick); m_pFBORayEntry->Read(2); RenderBox(renderRegion, b.vCenter, b.vExtension, b.vTexcoordsMin, b.vTexcoordsMax, true, eStereoID); m_pFBORayEntry->FinishRead(); if (m_bDoClearView) { m_TargetBinder.Bind(m_pFBOCVHit[size_t(eStereoID)], 0, m_pFBOCVHit[size_t(eStereoID)], 1); m_pProgramIso2->Enable(); m_pFBORayEntry->Read(2); m_pFBOIsoHit[size_t(eStereoID)]->Read(4, 0); m_pFBOIsoHit[size_t(eStereoID)]->Read(5, 1); RenderBox(renderRegion, b.vCenter, b.vExtension, b.vTexcoordsMin, b.vTexcoordsMax, true, eStereoID); m_pFBOIsoHit[size_t(eStereoID)]->FinishRead(1); m_pFBOIsoHit[size_t(eStereoID)]->FinishRead(0); m_pFBORayEntry->FinishRead(); } } else { m_TargetBinder.Bind(m_pFBO3DImageNext[size_t(eStereoID)]); // do the raycasting switch (m_eRenderMode) { case RM_1DTRANS : m_pProgram1DTrans[m_bUseLighting ? 1 : 0]->Enable(); break; case RM_2DTRANS : m_pProgram2DTrans[m_bUseLighting ? 1 : 0]->Enable(); break; default : T_ERROR("Invalid rendermode set"); break; } m_pContext->GetStateManager()->SetEnableBlend(true); SetBrickDepShaderVars(renderRegion, b, iCurrentBrick); m_pFBORayEntry->Read(2); RenderBox(renderRegion, b.vCenter, b.vExtension, b.vTexcoordsMin, b.vTexcoordsMax, true, eStereoID); m_pFBORayEntry->FinishRead(); } m_TargetBinder.Unbind(); } void GLRaycaster::RenderHQMIPPreLoop(RenderRegion2D ®ion) { GLGPURayTraverser::RenderHQMIPPreLoop(region); m_pProgramHQMIPRot->Enable(); m_pProgramHQMIPRot->Set("vScreensize",float(m_vWinSize.x), float(m_vWinSize.y)); if (m_bOrthoView) region.modelView[0] = m_maMIPRotation; else region.modelView[0] = m_maMIPRotation * m_mView[0]; region.modelView[0].setModelview(); } void GLRaycaster::RenderHQMIPInLoop(const RenderRegion2D &renderRegion, const Brick& b) { GPUState localState = m_BaseState; localState.enableDepthTest = false; localState.depthMask = false; localState.enableCullFace = false; localState.enableBlend = false; m_pContext->GetStateManager()->Apply(localState); // write frontfaces (ray entry points) m_TargetBinder.Bind(m_pFBORayEntry); m_pProgramRenderFrontFaces->Enable(); RenderBox(renderRegion, b.vCenter, b.vExtension, b.vTexcoordsMin, b.vTexcoordsMax, false, SI_LEFT_OR_MONO); m_TargetBinder.Bind(m_pFBO3DImageNext[1]); // for MIP rendering "abuse" left-eye buffer for the itermediate results localState.enableBlend = true; localState.blendFuncSrc = BF_ONE; localState.blendEquation = BE_MAX; m_pContext->GetStateManager()->Apply(localState); m_pProgramHQMIPRot->Enable(); FLOATVECTOR3 vVoxelSizeTexSpace = 1.0f/FLOATVECTOR3(b.vVoxelCount); float fRayStep = (b.vExtension*vVoxelSizeTexSpace * 0.5f * 1.0f/m_fSampleRateModifier).minVal(); m_pProgramHQMIPRot->Set("fRayStepsize", fRayStep); m_pFBORayEntry->Read(2); RenderBox(renderRegion, b.vCenter, b.vExtension,b.vTexcoordsMin, b.vTexcoordsMax, true, SI_LEFT_OR_MONO); m_pFBORayEntry->FinishRead(); } void GLRaycaster::StartFrame() { GLGPURayTraverser::StartFrame(); FLOATVECTOR2 vfWinSize = FLOATVECTOR2(m_vWinSize); switch (m_eRenderMode) { case RM_1DTRANS : m_pProgram1DTrans[0]->Enable(); m_pProgram1DTrans[0]->Set("vScreensize",vfWinSize.x, vfWinSize.y); m_pProgram1DTrans[1]->Enable(); m_pProgram1DTrans[1]->Set("vScreensize",vfWinSize.x, vfWinSize.y); break; case RM_2DTRANS : m_pProgram2DTrans[0]->Enable(); m_pProgram2DTrans[0]->Set("vScreensize",vfWinSize.x, vfWinSize.y); m_pProgram2DTrans[1]->Enable(); m_pProgram2DTrans[1]->Set("vScreensize",vfWinSize.x, vfWinSize.y); break; case RM_ISOSURFACE : { FLOATVECTOR3 scale = 1.0f/FLOATVECTOR3(m_pDataset->GetScale()); if (m_bDoClearView) { m_pProgramIso2->Enable(); m_pProgramIso2->Set("vScreensize",vfWinSize.x, vfWinSize.y); m_pProgramIso2->Set("vDomainScale",scale.x,scale.y,scale.z); } GLSLProgram* shader = this->ColorData() ? m_pProgramColor : m_pProgramIso; shader->Enable(); shader->Set("vScreensize",vfWinSize.x, vfWinSize.y); shader->Set("vDomainScale",scale.x,scale.y,scale.z); } break; default : T_ERROR("Invalid rendermode set"); break; } } void GLRaycaster::SetDataDepShaderVars() { GLGPURayTraverser::SetDataDepShaderVars(); if (m_eRenderMode == RM_ISOSURFACE && m_bDoClearView) { m_pProgramIso2->Enable(); m_pProgramIso2->Set("fIsoval", static_cast (GetNormalizedCVIsovalue())); } if(m_eRenderMode == RM_1DTRANS && m_TFScalingMethod == SMETH_BIAS_AND_SCALE) { std::pair bias_scale = scale_bias_and_scale(*m_pDataset); MESSAGE("setting TF bias (%5.3f) and scale (%5.3f)", bias_scale.first, bias_scale.second); m_pProgram1DTrans[m_bUseLighting ? 1 : 0]->Enable(); m_pProgram1DTrans[m_bUseLighting ? 1 : 0]->Set("TFuncBias", bias_scale.first); m_pProgram1DTrans[m_bUseLighting ? 1 : 0]->Set("fTransScale", bias_scale.second); } } FLOATMATRIX4 GLRaycaster::ComputeEyeToTextureMatrix(const RenderRegion &renderRegion, FLOATVECTOR3 p1, FLOATVECTOR3 t1, FLOATVECTOR3 p2, FLOATVECTOR3 t2, EStereoID eStereoID) const { FLOATMATRIX4 m; FLOATMATRIX4 mInvModelView = renderRegion.modelView[size_t(eStereoID)].inverse(); FLOATVECTOR3 vTrans1 = -p1; FLOATVECTOR3 vScale = (t2-t1) / (p2-p1); FLOATVECTOR3 vTrans2 = t1; FLOATMATRIX4 mTrans1; FLOATMATRIX4 mScale; FLOATMATRIX4 mTrans2; mTrans1.Translation(vTrans1.x,vTrans1.y,vTrans1.z); mScale.Scaling(vScale.x,vScale.y,vScale.z); mTrans2.Translation(vTrans2.x,vTrans2.y,vTrans2.z); m = mInvModelView * mTrans1 * mScale * mTrans2; return m; } ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLRenderer.cpp0000644000175000017500000032104412320456500021136 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLRenderer.cpp \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #include #include #include #include #include #include "GLInclude.h" #include "GLRenderer.h" #include "Basics/GeometryGenerator.h" #include "Basics/MathTools.h" #include "Basics/SystemInfo.h" #include "Basics/SysTools.h" #include "Controller/Controller.h" #include "IO/FileBackedDataset.h" #include "IO/TransferFunction1D.h" #include "IO/TransferFunction2D.h" #include "IO/IOManager.h" #include "Renderer/Context.h" #include "Renderer/SBVRGeogen.h" #include "Renderer/GPUMemMan/GPUMemMan.h" #include "Renderer/ShaderDescriptor.h" #include "Renderer/writebrick.h" #include "GLFBOTex.h" #include "GLSLProgram.h" #include "GLTexture1D.h" #include "GLTexture2D.h" #include "GLVolume3DTex.h" using namespace std; using namespace tuvok; GLRenderer::GLRenderer(MasterController* pMasterController, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder) : AbstrRenderer(pMasterController, bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder), m_TargetBinder(pMasterController), m_p1DTransTex(NULL), m_p2DTransTex(NULL), m_p2DData(NULL), m_pFBO3DImageLast(NULL), m_pFBOResizeQuickBlit(NULL), m_pLogoTex(NULL), m_pProgramIso(NULL), m_pProgramColor(NULL), m_pProgramHQMIPRot(NULL), m_pGLVolume(NULL), m_bSortMeshBTF(false), m_GeoBuffer(0), m_iNumTransMeshes(0), m_iNumMeshes(0), m_pProgramTrans(NULL), m_pProgram1DTransSlice(NULL), m_pProgram2DTransSlice(NULL), m_pProgram1DTransSlice3D(NULL), m_pProgram2DTransSlice3D(NULL), m_pProgramMIPSlice(NULL), m_pProgramTransMIP(NULL), m_pProgramIsoCompose(NULL), m_pProgramColorCompose(NULL), m_pProgramCVCompose(NULL), m_pProgramComposeAnaglyphs(NULL), m_pProgramComposeScanlineStereo(NULL), m_pProgramSBSStereo(NULL), m_pProgramAFStereo(NULL), m_pProgramBBox(NULL), m_pProgramMeshFTB(NULL), m_pProgramMeshBTF(NULL), m_texFormat16(GL_RGBA16), m_texFormat32(GL_RGBA), m_aDepthStorage(NULL) { m_pProgram1DTrans[0] = NULL; m_pProgram1DTrans[1] = NULL; m_pProgram2DTrans[0] = NULL; m_pProgram2DTrans[1] = NULL; m_pFBO3DImageNext[0] = NULL; m_pFBOIsoHit[0] = NULL; m_pFBOCVHit[0] = NULL; m_pFBO3DImageNext[1] = NULL; m_pFBOIsoHit[1] = NULL; m_pFBOCVHit[1] = NULL; } GLRenderer::~GLRenderer() { delete [] m_p2DData; m_Meshes.clear(); DeleteDepthStorage(); } void GLRenderer::InitBaseState() { // first get the current state m_BaseState = GPUState(m_pContext->GetStateManager()->GetCurrentState()); // now set gl parameters how we use them most of the time m_BaseState.enableDepthTest = true; m_BaseState.depthFunc = DF_LESS; m_BaseState.enableCullFace = false; m_BaseState.cullState = CULL_BACK; m_BaseState.enableBlend = true; m_BaseState.enableScissor = false; m_BaseState.enableLighting =false; m_BaseState.enableColorMaterial = false; m_BaseState.enableTex[0] = TEX_3D; m_BaseState.enableTex[1] = TEX_2D; m_BaseState.activeTexUnit = 0; m_BaseState.depthMask = true; m_BaseState.colorMask = true; m_BaseState.blendEquation = BE_FUNC_ADD; m_BaseState.blendFuncSrc = BF_ONE_MINUS_DST_ALPHA;; m_BaseState.blendFuncDst = BF_ONE; m_BaseState.lineWidth = 1.0f; } // Some drivers do not support floating point textures. static GLenum driver_supports_fp_textures() { return glewGetExtension("GL_ARB_texture_float"); } bool GLRenderer::Initialize(std::shared_ptr ctx) { if (!AbstrRenderer::Initialize(ctx)) { T_ERROR("Error in parent call -> aborting"); return false; } InitBaseState(); // Try to guess filenames for a transfer functions. We guess based on the // filename of the dataset, but it could be the case that our client gave us // an in-memory dataset. std::string strPotential1DTransName; std::string strPotential2DTransName; try { FileBackedDataset& ds = dynamic_cast(*m_pDataset); strPotential1DTransName = SysTools::ChangeExt(ds.Filename(), "1dt"); strPotential2DTransName = SysTools::ChangeExt(ds.Filename(), "2dt"); } catch(std::bad_cast) { // Will happen when we don't have a file-backed dataset; just disable the // filename-guessing / automatic TF loading feature. strPotential1DTransName = ""; strPotential2DTransName = ""; } GPUMemMan &mm = *(Controller::Instance().MemMan()); if (SysTools::FileExists(strPotential1DTransName)) { MESSAGE("Loading 1D TF from file."); mm.Get1DTransFromFile(strPotential1DTransName, this, &m_p1DTrans, &m_p1DTransTex, m_pDataset->Get1DHistogram()->GetFilledSize()); } else { MESSAGE("Creating empty 1D TF."); mm.GetEmpty1DTrans(m_pDataset->Get1DHistogram()->GetFilledSize(), this, &m_p1DTrans, &m_p1DTransTex); } // This is a bit of a kludge, but there's currently no way for AbstrRenderer // to know when a new m_p1DTrans has been set. LuaBindNew1DTrans(); if (SysTools::FileExists(strPotential2DTransName)) { mm.Get2DTransFromFile(strPotential2DTransName, this, &m_p2DTrans, &m_p2DTransTex, m_pDataset->Get2DHistogram()->GetFilledSize()); if(m_p2DTrans == NULL) { WARNING("Falling back to empty 2D TFqn..."); mm.GetEmpty2DTrans(m_pDataset->Get2DHistogram()->GetFilledSize(), this, &m_p2DTrans, &m_p2DTransTex); } LuaBindNew2DTrans(); } else { mm.GetEmpty2DTrans(m_pDataset->Get2DHistogram()->GetFilledSize(), this, &m_p2DTrans, &m_p2DTransTex); // Setup a default polygon in the 2D TF, so it doesn't look like they're // broken (nothing is rendered) when the user first switches to 2D TF mode. TFPolygon newSwatch; newSwatch.pPoints.push_back(FLOATVECTOR2(0.1f,0.1f)); newSwatch.pPoints.push_back(FLOATVECTOR2(0.1f,0.9f)); newSwatch.pPoints.push_back(FLOATVECTOR2(0.9f,0.9f)); newSwatch.pPoints.push_back(FLOATVECTOR2(0.9f,0.1f)); newSwatch.pGradientCoords[0] = FLOATVECTOR2(0.1f,0.5f); newSwatch.pGradientCoords[1] = FLOATVECTOR2(0.9f,0.5f); GradientStop g1(0.0f,FLOATVECTOR4(0,0,0,0)), g2(0.5f,FLOATVECTOR4(1,1,1,1)), g3(1.0f,FLOATVECTOR4(0,0,0,0)); newSwatch.pGradientStops.push_back(g1); newSwatch.pGradientStops.push_back(g2); newSwatch.pGradientStops.push_back(g3); m_p2DTrans->m_pvSwatches->push_back(newSwatch); /// LuaBindNew2DTrans needs to be called before using m_pLua2DTrans. LuaBindNew2DTrans(); m_pMasterController->MemMan()->Changed2DTrans(LuaClassInstance(), m_pLua2DTrans); } for (vector>::iterator mesh = m_Meshes.begin(); mesh != m_Meshes.end(); mesh++) { (*mesh)->InitRenderer(); } GL(glGenBuffers(1, &m_GeoBuffer)); this->m_texFormat16 = GL_RGBA16; this->m_texFormat32 = GL_RGBA; if(driver_supports_fp_textures()) { MESSAGE("Floating point textures supported (good!)"); this->m_texFormat16 = GL_RGBA16F_ARB; this->m_texFormat32 = GL_RGBA32F_ARB; } if(!LoadShaders()) { return false; } SetConstantShaderVars(); return true; } bool GLRenderer::LoadShaders(const string& volumeAccessFunction, bool bBindVolume) { std::string tfqn = m_pDataset ? this->ColorData() ? "VRender1D-Color" : "VRender1D" : "VRender1D"; const std::string tfqnLit = m_pDataset ? this->ColorData() ? "VRender1DLit-Color.glsl" : "VRender1DLit.glsl" : "VRender1DLit.glsl"; const std::string bias = tfqn + "-BScale.glsl"; tfqn += ".glsl"; MESSAGE("Loading '%s' volume rendering shader...", tfqn.c_str()); // we want to call 'MemMan::GetGLSLProgram' repeatedly, always using the same // memory manager (duh), and always using the same context ID. // Make a small functor so we don't have to keep specifying those parameters. GPUMemMan& mm = *(Controller::Instance().MemMan()); using namespace std::placeholders; std::function program = std::bind(&GPUMemMan::GetGLSLProgram, &mm, _1, m_pContext->GetShareGroupID()); m_pProgramTrans = program(ShaderDescriptor::Create(m_vShaderSearchDirs, "Transfer-VS.glsl", NULL, "Transfer-FS.glsl", NULL) ); m_pProgram1DTransSlice = program(ShaderDescriptor::Create(m_vShaderSearchDirs, "Transfer-VS.glsl", NULL, tfqn.c_str(), bias.c_str(), "lighting.glsl", "VRender1DProxy.glsl", "1D-slice-FS.glsl", volumeAccessFunction.c_str(), NULL) ); m_pProgram2DTransSlice = program(ShaderDescriptor::Create(m_vShaderSearchDirs, "Transfer-VS.glsl", NULL, "2D-slice-FS.glsl", volumeAccessFunction.c_str(), NULL) ); m_pProgramMIPSlice = program(ShaderDescriptor::Create(m_vShaderSearchDirs, "Transfer-VS.glsl", NULL, "MIP-slice-FS.glsl", volumeAccessFunction.c_str(), NULL) ); m_pProgram1DTransSlice3D = program(ShaderDescriptor::Create( m_vShaderSearchDirs, "SlicesIn3D.glsl", NULL, tfqn.c_str(), bias.c_str(), "lighting.glsl", "VRender1DProxy.glsl", "1D-slice-FS.glsl", volumeAccessFunction.c_str(), NULL) ); m_pProgram2DTransSlice3D = program(ShaderDescriptor::Create( m_vShaderSearchDirs, "SlicesIn3D.glsl", NULL, "2D-slice-FS.glsl", volumeAccessFunction.c_str(), NULL) ); m_pProgramTransMIP = program(ShaderDescriptor::Create(m_vShaderSearchDirs, "Transfer-VS.glsl", NULL, "Transfer-MIP-FS.glsl", NULL) ); m_pProgramIsoCompose = program(ShaderDescriptor::Create(m_vShaderSearchDirs, "Transfer-VS.glsl", NULL, "Compose-FS.glsl", NULL) ); m_pProgramColorCompose = program(ShaderDescriptor::Create(m_vShaderSearchDirs, "Transfer-VS.glsl", NULL, "Compose-Color-FS.glsl", NULL) ); m_pProgramCVCompose = program(ShaderDescriptor::Create(m_vShaderSearchDirs, "Transfer-VS.glsl", NULL, "Compose-CV-FS.glsl", NULL) ); m_pProgramComposeAnaglyphs = program(ShaderDescriptor::Create( m_vShaderSearchDirs, "Transfer-VS.glsl", NULL, "Compose-Anaglyphs-FS.glsl", NULL) ); m_pProgramSBSStereo = program(ShaderDescriptor::Create( m_vShaderSearchDirs, "Transfer-VS.glsl", NULL, "Compose-SBS-FS.glsl", NULL) ); m_pProgramAFStereo = program(ShaderDescriptor::Create(m_vShaderSearchDirs, "Transfer-VS.glsl", NULL, "Compose-AF-FS.glsl", NULL) ); m_pProgramComposeScanlineStereo = program(ShaderDescriptor::Create( m_vShaderSearchDirs, "Transfer-VS.glsl", NULL, "Compose-Scanline-FS.glsl", NULL) ); m_pProgramBBox = program(ShaderDescriptor::Create(m_vShaderSearchDirs, "BBox-VS.glsl", NULL, "BBox-FS.glsl", NULL) ); m_pProgramMeshFTB = program(ShaderDescriptor::Create(m_vShaderSearchDirs, "Mesh-VS.glsl", NULL, "Mesh-FS.glsl","FTB.glsl","lighting.glsl",NULL) ); m_pProgramMeshBTF = program(ShaderDescriptor::Create(m_vShaderSearchDirs, "Mesh-VS.glsl", NULL, "Mesh-FS.glsl","BTF.glsl","lighting.glsl", NULL) ); m_pProgramTrans->ConnectTextureID("texColor",0); m_pProgramTrans->ConnectTextureID("texDepth",1); if (bBindVolume) m_pProgram1DTransSlice->ConnectTextureID("texVolume",0); m_pProgram1DTransSlice->ConnectTextureID("texTrans",1); if (bBindVolume) m_pProgram2DTransSlice->ConnectTextureID("texVolume",0); m_pProgram2DTransSlice->ConnectTextureID("texTrans",1); if (bBindVolume) m_pProgram1DTransSlice3D->ConnectTextureID("texVolume",0); m_pProgram1DTransSlice3D->ConnectTextureID("texTrans",1); if (bBindVolume) m_pProgram2DTransSlice3D->ConnectTextureID("texVolume",0); m_pProgram2DTransSlice3D->ConnectTextureID("texTrans",1); if (bBindVolume) m_pProgramMIPSlice->ConnectTextureID("texVolume",0); m_pProgramTransMIP->ConnectTextureID("texLast",0); m_pProgramTransMIP->ConnectTextureID("texTrans",1); FLOATVECTOR2 vParams = m_FrustumCullingLOD.GetDepthScaleParams(); m_pProgramIsoCompose->ConnectTextureID("texRayHitPos",0); m_pProgramIsoCompose->ConnectTextureID("texRayHitNormal",1); m_pProgramIsoCompose->Set("vProjParam",vParams.x, vParams.y); m_pProgramColorCompose->ConnectTextureID("texRayHitPos",0); m_pProgramColorCompose->ConnectTextureID("texRayHitNormal",1); m_pProgramColorCompose->Set("vProjParam",vParams.x, vParams.y); m_pProgramCVCompose->ConnectTextureID("texRayHitPos",0); m_pProgramCVCompose->ConnectTextureID("texRayHitNormal",1); m_pProgramCVCompose->ConnectTextureID("texRayHitPos2",2); m_pProgramCVCompose->ConnectTextureID("texRayHitNormal2",3); m_pProgramCVCompose->Set("vProjParam",vParams.x, vParams.y); m_pProgramComposeAnaglyphs->ConnectTextureID("texLeftEye",0); m_pProgramComposeAnaglyphs->ConnectTextureID("texRightEye",1); m_pProgramComposeScanlineStereo->ConnectTextureID("texLeftEye",0); m_pProgramComposeScanlineStereo->ConnectTextureID("texRightEye",1); m_pProgramSBSStereo->ConnectTextureID("texLeftEye",0); m_pProgramSBSStereo->ConnectTextureID("texRightEye",1); m_pProgramAFStereo->ConnectTextureID("texLeftEye",0); m_pProgramAFStereo->ConnectTextureID("texRightEye",1); return true; } void GLRenderer::CleanupShader(GLSLProgram** p) { if (*p) { m_pMasterController->MemMan()->FreeGLSLProgram(*p); *p =NULL; } } void GLRenderer::CleanupShaders() { FixedFunctionality(); CleanupShader(&m_pProgramTrans); CleanupShader(&m_pProgram1DTransSlice); CleanupShader(&m_pProgram2DTransSlice); CleanupShader(&m_pProgram1DTransSlice3D); CleanupShader(&m_pProgram2DTransSlice3D); CleanupShader(&m_pProgramMIPSlice); CleanupShader(&m_pProgramHQMIPRot); CleanupShader(&m_pProgramTransMIP); CleanupShader(&m_pProgram1DTrans[0]); CleanupShader(&m_pProgram1DTrans[1]); CleanupShader(&m_pProgram2DTrans[0]); CleanupShader(&m_pProgram2DTrans[1]); CleanupShader(&m_pProgramIso); CleanupShader(&m_pProgramColor); CleanupShader(&m_pProgramIsoCompose); CleanupShader(&m_pProgramColorCompose); CleanupShader(&m_pProgramCVCompose); CleanupShader(&m_pProgramComposeAnaglyphs); CleanupShader(&m_pProgramComposeScanlineStereo); CleanupShader(&m_pProgramSBSStereo); CleanupShader(&m_pProgramAFStereo); CleanupShader(&m_pProgramBBox); CleanupShader(&m_pProgramMeshFTB); CleanupShader(&m_pProgramMeshBTF); } void GLRenderer::Set1DTrans(const std::vector& rgba) { AbstrRenderer::Free1DTrans(); GPUMemMan& mm = *(Controller::Instance().MemMan()); std::pair tf; tf = mm.SetExternal1DTrans(rgba, this); m_p1DTrans = tf.first; m_p1DTransTex = tf.second; LuaBindNew1DTrans(); } void GLRenderer::Changed1DTrans() { assert(m_p1DTransTex->GetSize() == m_p1DTrans->GetSize()); m_p1DTrans->GetByteArray(m_p1DData); m_p1DTransTex->SetData(&m_p1DData.at(0)); AbstrRenderer::Changed1DTrans(); } void GLRenderer::Changed2DTrans() { m_p2DTrans->GetByteArray(&m_p2DData); m_p2DTransTex->SetData(m_p2DData); AbstrRenderer::Changed2DTrans(); } void GLRenderer::Resize(const UINTVECTOR2& vWinSize) { AbstrRenderer::Resize(vWinSize); MESSAGE("Resizing to %u x %u", vWinSize.x, vWinSize.y); glViewport(0, 0, m_vWinSize.x, m_vWinSize.y); ClearColorBuffer(); } void GLRenderer::ClearColorBuffer() const { m_pContext->GetStateManager()->Apply(m_BaseState); if (m_bDoStereoRendering && m_eStereoMode == SM_RB) { // render anaglyphs against a black background only glClearColor(0,0,0,0); glClear(GL_COLOR_BUFFER_BIT); } else { // if top and bottom colors are the same simply clear ... if (m_vBackgroundColors[0] == m_vBackgroundColors[1]) { glClearColor(m_vBackgroundColors[0].x, m_vBackgroundColors[0].y, m_vBackgroundColors[0].z, 0); glClear(GL_COLOR_BUFFER_BIT); } else { // ... draw a gradient image otherwise DrawBackGradient(); } } // finally blit the logo onto the screen (if present) DrawLogo(); } void GLRenderer::StartFrame() { // clear the depthbuffer (if requested) if (m_bClearFramebuffer) { glClear(GL_DEPTH_BUFFER_BIT); if (m_bConsiderPreviousDepthbuffer) SaveEmptyDepthBuffer(); } else { if (m_bConsiderPreviousDepthbuffer) SaveDepthBuffer(); } if (m_eRenderMode == RM_ISOSURFACE) { FLOATVECTOR2 vfWinSize = FLOATVECTOR2(m_vWinSize); if (m_bDoClearView) { m_pProgramCVCompose->Enable(); m_pProgramCVCompose->Set("vScreensize",vfWinSize.x, vfWinSize.y); } else { GLSLProgram* shader = this->ColorData() ? m_pProgramColorCompose : m_pProgramIsoCompose; shader->Enable(); shader->Set("vScreensize",vfWinSize.x, vfWinSize.y); } } } void GLRenderer::RecomposeView(const RenderRegion& rgn) { MESSAGE("Recomposing region {(%u,%u), (%u,%u)}", static_cast(rgn.minCoord[0]), static_cast(rgn.minCoord[1]), static_cast(rgn.maxCoord[0]), static_cast(rgn.maxCoord[1])); if(rgn.is3D()) { Recompose3DView(dynamic_cast(rgn)); } } bool GLRenderer::Continue3DDraw() { return (m_vCurrentBrickList.size() > m_iBricksRenderedInThisSubFrame) || (m_iCurrentLODOffset > m_iMinLODForCurrentView) || this->decreaseScreenResNow; } bool GLRenderer::Render3DRegion(RenderRegion3D& region3D) { PlanFrame(region3D); // decreaseScreenResNow could have changed after calling PlanFrame. SetRenderTargetArea(region3D, this->decreaseScreenResNow); // execute the frame float fMsecPassed = 0.0f; bool bJobDone = false; if (!Execute3DFrame(region3D, fMsecPassed, bJobDone) ) { T_ERROR("Could not execute the 3D frame, aborting."); return false; } this->msecPassedCurrentFrame += fMsecPassed; return bJobDone; } bool GLRenderer::Paint() { if (!AbstrRenderer::Paint()) return false; m_pContext->GetStateManager()->Apply(m_BaseState); if (m_bDatasetIsInvalid) return true; // we want vector, but of course that's a bad idea. vector justCompletedRegions(renderRegions.size(), false); // if we are drawing for the first time after a resize we do not want to // start a full redraw loop, rather we just blit the last valid image // onto the screen. This makes resizing more responsive. We'll schedule a // complete redraw after, no worries. if (m_bFirstDrawAfterResize) { CreateOffscreenBuffers(); CreateDepthStorage(); } if (m_bFirstDrawAfterResize || m_bFirstDrawAfterModeChange ) { StartFrame(); } if (m_bFirstDrawAfterResize && m_eRendererTarget != RT_HEADLESS) { if (m_pFBOResizeQuickBlit) { m_pFBO3DImageLast->Write(); glViewport(0,0,m_vWinSize.x,m_vWinSize.y); m_pContext->GetStateManager()->SetEnableBlend(false); m_pFBOResizeQuickBlit->Read(0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); m_pFBOResizeQuickBlit->ReadDepth(1); glClearColor(1,0,0,1); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); m_pContext->GetStateManager()->SetEnableDepthTest(false); glClearColor(0,0,0,0); m_pProgramTrans->Enable(); FullscreenQuad(); m_pFBOResizeQuickBlit->FinishRead(); m_pFBOResizeQuickBlit->FinishDepthRead(); m_pFBO3DImageLast->FinishWrite(); m_pMasterController->MemMan()->FreeFBO(m_pFBOResizeQuickBlit); m_pFBOResizeQuickBlit = NULL; } } else { for (size_t i=0; i < renderRegions.size(); ++i) { if (renderRegions[i]->redrawMask) { SetRenderTargetArea(*renderRegions[i], this->decreaseScreenResNow); if(renderRegions[i]->isBlank) { renderRegions[i]->modelView[0] = renderRegions[i]->rotation * renderRegions[i]->translation * m_mView[0]; if(m_bDoStereoRendering) { renderRegions[i]->modelView[1] = renderRegions[i]->rotation * renderRegions[i]->translation * m_mView[1]; } } if (renderRegions[i]->is3D()) { RenderRegion3D ®ion3D = *static_cast (renderRegions[i].get()); if (!region3D.isBlank && m_bPerformReCompose){ Recompose3DView(region3D); justCompletedRegions[i] = true; } else { justCompletedRegions[i] = Render3DRegion(region3D); } // are we done rendering or do we need to render at higher quality? region3D.redrawMask = Continue3DDraw(); } else if (renderRegions[i]->is2D()) { // in a 2D view mode RenderRegion2D& region2D = *static_cast(renderRegions[i].get()); justCompletedRegions[i] = Render2DView(region2D); region2D.redrawMask = false; if(this->decreaseScreenResNow) { // if we just rendered at reduced res, we've got to do another // render later. region2D.redrawMask = true; } } } else { justCompletedRegions[i] = false; } renderRegions[i]->isBlank = false; } } EndFrame(justCompletedRegions); // reset render states m_bFirstDrawAfterResize = false; m_bFirstDrawAfterModeChange = false; return true; } void GLRenderer::FullscreenQuad() const { glBegin(GL_QUADS); glTexCoord2d(0, 0); glVertex3d(-1.0, -1.0, -0.5); glTexCoord2d(1, 0); glVertex3d( 1.0, -1.0, -0.5); glTexCoord2d(1, 1); glVertex3d( 1.0, 1.0, -0.5); glTexCoord2d(0, 1); glVertex3d(-1.0, 1.0, -0.5); glEnd(); } void GLRenderer::FullscreenQuadRegions() const { for (size_t i=0; i < renderRegions.size(); ++i) { FullscreenQuadRegion(renderRegions[i].get(), this->decreaseScreenResNow); } } void GLRenderer::FullscreenQuadRegion(const RenderRegion* region, bool decreaseScreenRes) const { const float rescale = decreaseScreenRes ? 1.0f / m_fScreenResDecFactor : 1.0f; FLOATVECTOR2 minCoord(region->minCoord); FLOATVECTOR2 maxCoord(region->maxCoord); //normalize to 0,1. FLOATVECTOR2 minCoordNormalized = minCoord / FLOATVECTOR2(m_vWinSize); FLOATVECTOR2 maxCoordNormalized = maxCoord / FLOATVECTOR2(m_vWinSize); FLOATVECTOR2 minTexCoord = minCoordNormalized; FLOATVECTOR2 maxTexCoord = minCoordNormalized + (maxCoordNormalized-minCoordNormalized)*rescale; glBegin(GL_QUADS); glTexCoord2d(minTexCoord[0], minTexCoord[1]); glVertex3d(minCoordNormalized[0]*2-1, minCoordNormalized[1]*2-1, -0.5); glTexCoord2d(maxTexCoord[0], minTexCoord[1]); glVertex3d(maxCoordNormalized[0]*2-1, minCoordNormalized[1]*2-1, -0.5); glTexCoord2d(maxTexCoord[0], maxTexCoord[1]); glVertex3d(maxCoordNormalized[0]*2-1, maxCoordNormalized[1]*2-1, -0.5); glTexCoord2d(minTexCoord[0], maxTexCoord[1]); glVertex3d(minCoordNormalized[0]*2-1, maxCoordNormalized[1]*2-1, -0.5); glEnd(); } /// copy the newly completed image into the buffer that stores completed /// images. void GLRenderer::CopyOverCompletedRegion(const RenderRegion* region) { // write to FBO that contains final images. m_TargetBinder.Bind(m_pFBO3DImageLast); GPUState localState = m_BaseState; localState.enableBlend = false; localState.depthFunc = DF_LEQUAL; localState.enableScissor = true; m_pContext->GetStateManager()->Apply(localState); glViewport(0, 0, m_vWinSize.x, m_vWinSize.y); SetRenderTargetAreaScissor(*region); // always clear the depth buffer since we are transporting new data from the FBO glClear(GL_DEPTH_BUFFER_BIT); // Read newly completed image m_pFBO3DImageNext[0]->Read(0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (this->decreaseScreenResNow) ? GL_LINEAR : GL_NEAREST); m_pFBO3DImageNext[0]->ReadDepth(1); // Display this to the old buffer so we can reuse it in future frame. m_pProgramTrans->Enable(); FullscreenQuadRegion(region, this->decreaseScreenResNow); m_TargetBinder.Unbind(); m_pFBO3DImageNext[0]->FinishRead(); m_pFBO3DImageNext[0]->FinishDepthRead(); } void GLRenderer::TargetIsBlankButFrameIsNotFinished(const RenderRegion* region) { // In stereo, we just clear; otherwise we'll see a rendering for just one of // the eyes. if(m_bDoStereoRendering) { ClearColorBuffer(); } else { CopyOverCompletedRegion(region); } } void GLRenderer::EndFrame(const vector& justCompletedRegions) { // For a single region we can support stereo and we can also optimize the // code by swapping the buffers instead of copying data from one to the // other. if (renderRegions.size() == 1) { // if the image is complete if (justCompletedRegions[0]) { m_bOffscreenIsLowRes = this->decreaseScreenResNow; // in stereo compose both images into one, in mono mode simply swap the // pointers if (m_bDoStereoRendering) { m_pContext->GetStateManager()->Apply(m_BaseState); if (m_bStereoEyeSwap) { m_pFBO3DImageNext[0]->Read(1); m_pFBO3DImageNext[1]->Read(0); } else { m_pFBO3DImageNext[0]->Read(0); m_pFBO3DImageNext[1]->Read(1); } m_TargetBinder.Bind(m_pFBO3DImageLast); glClear(GL_COLOR_BUFFER_BIT); switch (m_eStereoMode) { case SM_RB : m_pProgramComposeAnaglyphs->Enable(); break; case SM_SCANLINE: { m_pProgramComposeScanlineStereo->Enable(); FLOATVECTOR2 vfWinSize = FLOATVECTOR2(m_vWinSize); m_pProgramComposeScanlineStereo->Set("vScreensize",vfWinSize.x, vfWinSize.y); break; } case SM_SBS: { m_pProgramSBSStereo->Enable(); float fSplitCoord = (m_bOffscreenIsLowRes) ? 0.5f / m_fScreenResDecFactor : 0.5f; m_pProgramSBSStereo->Set("fSplitCoord",fSplitCoord); break; } default : // SM_AF m_pProgramAFStereo->Enable(); m_pProgramAFStereo->Set("iAlternatingFrameID",m_iAlternatingFrameID); break; } m_pContext->GetStateManager()->SetEnableDepthTest(false); FullscreenQuadRegions(); m_TargetBinder.Unbind(); m_pFBO3DImageNext[0]->FinishRead(); m_pFBO3DImageNext[1]->FinishRead(); } else { swap(m_pFBO3DImageLast, m_pFBO3DImageNext[0]); } for (size_t i=0; i < renderRegions.size(); ++i) { if(!OnlyRecomposite(renderRegions[i].get())) { CompletedASubframe(renderRegions[i].get()); } } } else { if (!renderRegions[0]->isBlank && renderRegions[0]->isTargetBlank) { TargetIsBlankButFrameIsNotFinished(renderRegions[0].get()); } } } else { for (size_t i=0; i < renderRegions.size(); ++i) { if(justCompletedRegions[i]) { if (!OnlyRecomposite(renderRegions[i].get())) { CompletedASubframe(renderRegions[i].get()); } CopyOverCompletedRegion(renderRegions[i].get()); } else { if (!renderRegions[i]->isBlank && renderRegions[i]->isTargetBlank) { TargetIsBlankButFrameIsNotFinished(renderRegions[i].get()); } } } } CopyImageToDisplayBuffer(); // we've definitely recomposed by now. m_bPerformReCompose = false; } void GLRenderer::SetRenderTargetArea(const RenderRegion& renderRegion, bool bDecreaseScreenResNow) { SetRenderTargetArea(renderRegion.minCoord, renderRegion.maxCoord, bDecreaseScreenResNow); } void GLRenderer::SetRenderTargetArea(UINTVECTOR2 minCoord, UINTVECTOR2 maxCoord, bool bDecreaseScreenResNow) { SetViewPort(minCoord, maxCoord, bDecreaseScreenResNow); } void GLRenderer::SetRenderTargetAreaScissor(const RenderRegion& renderRegion) { UINTVECTOR2 regionSize = renderRegion.maxCoord - renderRegion.minCoord; glScissor(renderRegion.minCoord.x, renderRegion.minCoord.y, regionSize.x, regionSize.y); } void GLRenderer::SetViewPort(UINTVECTOR2 viLowerLeft, UINTVECTOR2 viUpperRight, bool bDecreaseScreenResNow) { UINTVECTOR2 viSize = viUpperRight-viLowerLeft; const uint32_t originalPixelsY = viSize.y; if (bDecreaseScreenResNow) { const float rescale = 1.0f/m_fScreenResDecFactor; //Note, we round to the nearest int (the + 0.5 part). This in //effect expands the render region in all directions to the nearest int and //so hides any possible gaps that could result. viSize = UINTVECTOR2((FLOATVECTOR2(viSize) * rescale) + FLOATVECTOR2(0.5, 0.5)); } // viewport glViewport(viLowerLeft.x,viLowerLeft.y,viSize.x,viSize.y); float fAspect =(float)viSize.x/(float)viSize.y; ComputeViewAndProjection(fAspect); // forward the projection matrix to the culling object m_FrustumCullingLOD.SetProjectionMatrix(m_mProjection[0]); m_FrustumCullingLOD.SetScreenParams(m_fFOV, fAspect, m_fZNear, m_fZFar, originalPixelsY); } void GLRenderer::ComputeViewAndProjection(float fAspect) { if (m_bUserMatrices) { if (m_bDoStereoRendering) { m_mView[0] = m_UserViewLeft; m_mProjection[0] = m_UserProjectionLeft; m_mView[1] = m_UserViewRight; m_mProjection[1] = m_UserProjectionRight; } else { m_mView[0] = m_UserView; m_mProjection[0] = m_UserProjection; m_mProjection[0].setProjection(); } } else { if (m_bDoStereoRendering) { FLOATMATRIX4::BuildStereoLookAtAndProjection(m_vEye, m_vAt, m_vUp, m_fFOV, fAspect, m_fZNear, m_fZFar, m_fStereoFocalLength, m_fStereoEyeDist, m_mView[0], m_mView[1], m_mProjection[0], m_mProjection[1]); } else { // view matrix m_mView[0].BuildLookAt(m_vEye, m_vAt, m_vUp); // projection matrix m_mProjection[0].Perspective(m_fFOV, fAspect, m_fZNear, m_fZFar); m_mProjection[0].setProjection(); } } } void GLRenderer::RenderSlice(const RenderRegion2D& region, double fSliceIndex, FLOATVECTOR3 vMinCoords, FLOATVECTOR3 vMaxCoords, DOUBLEVECTOR3 vAspectRatio, DOUBLEVECTOR2 vWinAspectRatio) { switch (region.windowMode) { case RenderRegion::WM_AXIAL : { if (region.flipView.x) { float fTemp = vMinCoords.x; vMinCoords.x = vMaxCoords.x; vMaxCoords.x = fTemp; } if (region.flipView.y) { float fTemp = vMinCoords.z; vMinCoords.z = vMaxCoords.z; vMaxCoords.z = fTemp; } DOUBLEVECTOR2 v2AspectRatio = vAspectRatio.xz()*DOUBLEVECTOR2(vWinAspectRatio); v2AspectRatio = v2AspectRatio / v2AspectRatio.maxVal(); glBegin(GL_QUADS); glTexCoord3d(vMinCoords.x,fSliceIndex,vMaxCoords.z); glVertex3d(-1.0f*v2AspectRatio.x, +1.0f*v2AspectRatio.y, -0.5f); glTexCoord3d(vMaxCoords.x,fSliceIndex,vMaxCoords.z); glVertex3d(+1.0f*v2AspectRatio.x, +1.0f*v2AspectRatio.y, -0.5f); glTexCoord3d(vMaxCoords.x,fSliceIndex,vMinCoords.z); glVertex3d(+1.0f*v2AspectRatio.x, -1.0f*v2AspectRatio.y, -0.5f); glTexCoord3d(vMinCoords.x,fSliceIndex,vMinCoords.z); glVertex3d(-1.0f*v2AspectRatio.x, -1.0f*v2AspectRatio.y, -0.5f); glEnd(); break; } case RenderRegion::WM_CORONAL : { if (region.flipView.x) { float fTemp = vMinCoords.x; vMinCoords.x = vMaxCoords.x; vMaxCoords.x = fTemp; } if (region.flipView.y) { float fTemp = vMinCoords.y; vMinCoords.y = vMaxCoords.y; vMaxCoords.y = fTemp; } DOUBLEVECTOR2 v2AspectRatio = vAspectRatio.xy()*DOUBLEVECTOR2(vWinAspectRatio); v2AspectRatio = v2AspectRatio / v2AspectRatio.maxVal(); glBegin(GL_QUADS); glTexCoord3d(vMinCoords.x,vMaxCoords.y,fSliceIndex); glVertex3d(-1.0f*v2AspectRatio.x, +1.0f*v2AspectRatio.y, -0.5f); glTexCoord3d(vMaxCoords.x,vMaxCoords.y,fSliceIndex); glVertex3d(+1.0f*v2AspectRatio.x, +1.0f*v2AspectRatio.y, -0.5f); glTexCoord3d(vMaxCoords.x,vMinCoords.y,fSliceIndex); glVertex3d(+1.0f*v2AspectRatio.x, -1.0f*v2AspectRatio.y, -0.5f); glTexCoord3d(vMinCoords.x,vMinCoords.y,fSliceIndex); glVertex3d(-1.0f*v2AspectRatio.x, -1.0f*v2AspectRatio.y, -0.5f); glEnd(); break; } case RenderRegion::WM_SAGITTAL : { if (region.flipView.x) { float fTemp = vMinCoords.y; vMinCoords.y = vMaxCoords.y; vMaxCoords.y = fTemp; } if (region.flipView.y) { float fTemp = vMinCoords.z; vMinCoords.z = vMaxCoords.z; vMaxCoords.z = fTemp; } DOUBLEVECTOR2 v2AspectRatio = vAspectRatio.yz()*DOUBLEVECTOR2(vWinAspectRatio); v2AspectRatio = v2AspectRatio / v2AspectRatio.maxVal(); glBegin(GL_QUADS); glTexCoord3d(fSliceIndex,vMinCoords.y,vMaxCoords.z); glVertex3d(-1.0f*v2AspectRatio.x, +1.0f*v2AspectRatio.y, -0.5f); glTexCoord3d(fSliceIndex,vMaxCoords.y,vMaxCoords.z); glVertex3d(+1.0f*v2AspectRatio.x, +1.0f*v2AspectRatio.y, -0.5f); glTexCoord3d(fSliceIndex,vMaxCoords.y,vMinCoords.z); glVertex3d(+1.0f*v2AspectRatio.x, -1.0f*v2AspectRatio.y, -0.5f); glTexCoord3d(fSliceIndex,vMinCoords.y,vMinCoords.z); glVertex3d(-1.0f*v2AspectRatio.x, -1.0f*v2AspectRatio.y, -0.5f); glEnd(); break; } default : T_ERROR("Invalid windowmode set"); break; } } bool GLRenderer::BindVolumeTex(const BrickKey& bkey, const uint64_t iIntraFrameCounter) { GL_CHECK(); // get the 3D texture from the memory manager m_pGLVolume = m_pMasterController->MemMan()->GetVolume(m_pDataset, bkey, m_bUseOnlyPowerOfTwo, m_bDownSampleTo8Bits, m_bDisableBorder, false, iIntraFrameCounter, m_iFrameCounter, m_pContext->GetShareGroupID()); GL_CHECK(); if(m_pGLVolume) { m_pGLVolume->SetFilter(ComputeGLFilter(), ComputeGLFilter()); static_cast(m_pGLVolume)->Bind(0); if(m_bDebugBricks) { const std::shared_ptr data = std::static_pointer_cast( static_cast(m_pGLVolume)->GetData() ); const size_t sz = m_pDataset->GetBrickVoxelCounts(bkey).volume(); writeBrickT(bkey, data.get(),data.get()+sz); } return true; } else { return false; } } bool GLRenderer::UnbindVolumeTex() { if(m_pGLVolume) { m_pMasterController->MemMan()->Release3DTexture(m_pGLVolume); m_pGLVolume = NULL; return true; } else { return false; } } bool GLRenderer::Render2DView(RenderRegion2D& renderRegion) { // bind offscreen buffer if (renderRegion.GetUseMIP()) { // for MIP rendering "abuse" left-eye buffer for the itermediate results m_TargetBinder.Bind(m_pFBO3DImageNext[1]); } else { m_TargetBinder.Bind(m_pFBO3DImageNext[0]); } SetDataDepShaderVars(); // if we render a slice view or MIP preview if (!renderRegion.GetUseMIP() || m_eRendererTarget != RT_CAPTURE) { GPUState localState = m_BaseState; if (!renderRegion.GetUseMIP()) { switch (m_eRenderMode) { case RM_2DTRANS : m_p2DTransTex->Bind(1); m_pProgram2DTransSlice->Enable(); break; default : m_p1DTransTex->Bind(1); m_pProgram1DTransSlice->Enable(); break; } localState.enableBlend = false; } else { m_pProgramMIPSlice->Enable(); localState.blendEquation = BE_MAX; localState.blendFuncSrc = BF_ONE; localState.blendFuncDst = BF_ONE; } localState.enableDepthTest = false; m_pContext->GetStateManager()->Apply(localState); size_t iCurrentLOD = 0; UINTVECTOR3 vVoxelCount(1,1,1); // make sure we do not divide by zero later // if no single-brick LOD exists // For now to make things simpler for the slice renderer we use the LOD // level with just one brick for (size_t i = 0;iGetLODLevelCount());i++) { if (m_pDataset->GetBrickCount(i, m_iTimestep) == 1) { iCurrentLOD = i; const BrickKey bkey(m_iTimestep, iCurrentLOD, 0); vVoxelCount = UINTVECTOR3(m_pDataset->GetBrickVoxelCounts(bkey)); break; } } if (!renderRegion.GetUseMIP()) SetBrickDepShaderVarsSlice(vVoxelCount); // Get the brick at this LOD; note we're guaranteed this brick will cover // the entire domain, because the search above gives us the finest LOD // covered by a single brick const BrickKey bkey(m_iTimestep, iCurrentLOD, 0); if (!BindVolumeTex(bkey,0)) { T_ERROR("Unable to bind volume to texture (LOD:%u, Brick:0)", static_cast(iCurrentLOD)); return false; } // clear the target at the beginning m_pContext->GetStateManager()->SetEnableScissor(true); SetRenderTargetAreaScissor(renderRegion); glClearColor(0,0,0,1); glClear(GL_COLOR_BUFFER_BIT); m_pContext->GetStateManager()->SetEnableScissor(false); // 'VoxelCount' is the number of voxels in the brick which contain data. // 'RealVoxelCount' will be the actual number of voxels in the brick, which // could be larger than the voxel count if we need to use PoT textures. UINTVECTOR3 vRealVoxelCount; if (m_bUseOnlyPowerOfTwo) { vRealVoxelCount = UINTVECTOR3(MathTools::NextPow2(vVoxelCount.x), MathTools::NextPow2(vVoxelCount.y), MathTools::NextPow2(vVoxelCount.z)); } else { vRealVoxelCount = vVoxelCount; } FLOATVECTOR3 vMinCoords = FLOATVECTOR3( (FLOATVECTOR3(vVoxelCount) - FLOATVECTOR3(m_pDataset->GetDomainSize(iCurrentLOD))+ 1) /(2.0f * FLOATVECTOR3(vRealVoxelCount) ) ); FLOATVECTOR3 vMaxCoords = (FLOATVECTOR3(vVoxelCount) / FLOATVECTOR3(vRealVoxelCount)) - vMinCoords; UINT64VECTOR3 vDomainSize = m_pDataset->GetDomainSize(); DOUBLEVECTOR3 vAspectRatio = m_pDataset->GetScale() * DOUBLEVECTOR3(vDomainSize); DOUBLEVECTOR2 renderRegionSize(renderRegion.maxCoord - renderRegion.minCoord); DOUBLEVECTOR2 vWinAspectRatio = 1.0 / renderRegionSize; vWinAspectRatio = vWinAspectRatio / vWinAspectRatio.maxVal(); const int sliceDir = static_cast(renderRegion.windowMode); if (renderRegion.GetUseMIP()) { // Iterate; render all slices, and we'll figure out the 'M'(aximum) in // the shader. Note that we iterate over all slices which have data // ("VoxelCount"), not over all slices ("RealVoxelCount"). for (uint64_t i = 0;i(i) / vVoxelCount[sliceDir]; // Now correct for PoT textures: a [0..1] space gives us the location // of the slice in a perfect world, but if we're using PoT textures we // might only access say [0..0.75] e.g. if we needed to increase the // 3Dtexture size by 25% to make it PoT. fSliceIndex *= static_cast (vVoxelCount[sliceDir]) / static_cast (vRealVoxelCount[sliceDir]); RenderSlice(renderRegion, fSliceIndex, vMinCoords, vMaxCoords, vAspectRatio, vWinAspectRatio); } } else { // same indexing fix as above. double fSliceIndex = static_cast(renderRegion.GetSliceIndex()) / vDomainSize[sliceDir]; fSliceIndex *= static_cast (vVoxelCount[sliceDir]) / static_cast (vRealVoxelCount[sliceDir]); RenderSlice(renderRegion, fSliceIndex, vMinCoords, vMaxCoords, vAspectRatio, vWinAspectRatio); } if (!UnbindVolumeTex()) { T_ERROR("Cannot unbind volume: No volume bound"); return false; } } else { if (m_bOrthoView) { FLOATMATRIX4 maOrtho; DOUBLEVECTOR2 vWinAspectRatio = 1.0 / DOUBLEVECTOR2(m_vWinSize); vWinAspectRatio = vWinAspectRatio / vWinAspectRatio.maxVal(); float fRoot2Scale = (vWinAspectRatio.x < vWinAspectRatio.y) ? max(1.0f, 1.414213f * float(vWinAspectRatio.x/vWinAspectRatio.y)) : 1.414213f; maOrtho.Ortho(-0.5f*fRoot2Scale/float(vWinAspectRatio.x), +0.5f*fRoot2Scale/float(vWinAspectRatio.x), -0.5f*fRoot2Scale/float(vWinAspectRatio.y), +0.5f*fRoot2Scale/float(vWinAspectRatio.y), -100.0f, 100.0f); maOrtho.setProjection(); } PlanHQMIPFrame(renderRegion); glClearColor(0,0,0,0); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); RenderHQMIPPreLoop(renderRegion); for (size_t iBrickIndex = 0;iBrickIndex(iBrickIndex+1), static_cast(m_vCurrentBrickList.size())); // for MIP we do not consider empty bricks since we do not render // other geometry such as meshes anyway if (m_vCurrentBrickList[iBrickIndex].bIsEmpty) continue; const BrickKey &key = m_vCurrentBrickList[iBrickIndex].kBrick; // get the 3D texture from the memory manager if (!BindVolumeTex(key,0)) { T_ERROR("Unable to bind volume to texture (LOD:%u, Brick:%u)", static_cast(m_iCurrentLOD), static_cast(iBrickIndex)); return false; } RenderHQMIPInLoop(renderRegion, m_vCurrentBrickList[iBrickIndex]); if (!UnbindVolumeTex()) { T_ERROR("Cannot unbind volume: No volume bound"); return false; } } RenderHQMIPPostLoop(); } // apply 1D transferfunction to MIP image if (renderRegion.GetUseMIP()) { GPUState localState = m_BaseState; localState.enableBlend = false; localState.enableDepthTest = false; m_pContext->GetStateManager()->Apply(localState); m_TargetBinder.Bind(m_pFBO3DImageNext[0]); SetRenderTargetArea(UINTVECTOR2(0,0), m_vWinSize, false); m_pContext->GetStateManager()->SetEnableScissor(true); SetRenderTargetAreaScissor(renderRegion); m_pFBO3DImageNext[1]->Read(0); m_p1DTransTex->Bind(1); m_pProgramTransMIP->Enable(); FullscreenQuad(); m_pFBO3DImageNext[1]->FinishRead(0); } m_TargetBinder.Unbind(); return true; } void GLRenderer::RenderHQMIPPreLoop(RenderRegion2D& region) { double dPI = 3.141592653589793238462643383; FLOATMATRIX4 matRotDir, matFlipX, matFlipY; switch (region.windowMode) { case RenderRegion::WM_SAGITTAL : { FLOATMATRIX4 matTemp; matRotDir.RotationX(-dPI/2.0); matTemp.RotationY(-dPI/2.0); matRotDir = matRotDir * matTemp; break; } case RenderRegion::WM_AXIAL : matRotDir.RotationX(-dPI/2.0); break; case RenderRegion::WM_CORONAL : break; default : T_ERROR("Invalid windowmode set"); break; } if (region.flipView.x) { matFlipY.Scaling(-1,1,1); } if (region.flipView.y) { matFlipX.Scaling(1,-1,1); } m_maMIPRotation.RotationY(dPI*double(m_fMIPRotationAngle)/180.0); m_maMIPRotation = matRotDir * region.rotation * matFlipX * matFlipY * m_maMIPRotation; } void GLRenderer::RenderBBox(const FLOATVECTOR4 vColor) { FLOATVECTOR3 vCenter, vExtend; GetVolumeAABB(vCenter,vExtend); RenderBBox(vColor, vCenter, vExtend); } void GLRenderer::RenderBBox(const FLOATVECTOR4 vColor, const FLOATVECTOR3& vCenter, const FLOATVECTOR3& vExtend) { FLOATVECTOR3 vMinPoint, vMaxPoint; vMinPoint = (vCenter - vExtend/2.0); vMaxPoint = (vCenter + vExtend/2.0); m_pProgramBBox->Enable(); glBegin(GL_LINES); glColor4f(vColor.x,vColor.y,vColor.z,vColor.w); // FRONT glVertex3f( vMaxPoint.x,vMinPoint.y,vMinPoint.z); glVertex3f(vMinPoint.x,vMinPoint.y,vMinPoint.z); glVertex3f( vMaxPoint.x, vMaxPoint.y,vMinPoint.z); glVertex3f(vMinPoint.x, vMaxPoint.y,vMinPoint.z); glVertex3f(vMinPoint.x,vMinPoint.y,vMinPoint.z); glVertex3f(vMinPoint.x, vMaxPoint.y,vMinPoint.z); glVertex3f( vMaxPoint.x,vMinPoint.y,vMinPoint.z); glVertex3f( vMaxPoint.x, vMaxPoint.y,vMinPoint.z); // BACK glVertex3f( vMaxPoint.x,vMinPoint.y, vMaxPoint.z); glVertex3f(vMinPoint.x,vMinPoint.y, vMaxPoint.z); glVertex3f( vMaxPoint.x, vMaxPoint.y, vMaxPoint.z); glVertex3f(vMinPoint.x, vMaxPoint.y, vMaxPoint.z); glVertex3f(vMinPoint.x,vMinPoint.y, vMaxPoint.z); glVertex3f(vMinPoint.x, vMaxPoint.y, vMaxPoint.z); glVertex3f( vMaxPoint.x,vMinPoint.y, vMaxPoint.z); glVertex3f( vMaxPoint.x, vMaxPoint.y, vMaxPoint.z); // CONNECTION glVertex3f(vMinPoint.x,vMinPoint.y, vMaxPoint.z); glVertex3f(vMinPoint.x,vMinPoint.y,vMinPoint.z); glVertex3f(vMinPoint.x, vMaxPoint.y, vMaxPoint.z); glVertex3f(vMinPoint.x, vMaxPoint.y,vMinPoint.z); glVertex3f( vMaxPoint.x,vMinPoint.y, vMaxPoint.z); glVertex3f( vMaxPoint.x,vMinPoint.y,vMinPoint.z); glVertex3f( vMaxPoint.x, vMaxPoint.y, vMaxPoint.z); glVertex3f( vMaxPoint.x, vMaxPoint.y,vMinPoint.z); glEnd(); } void GLRenderer::NewFrameClear(const RenderRegion& renderRegion) { m_pContext->GetStateManager()->SetEnableScissor(true); SetRenderTargetAreaScissor(renderRegion); GL(glClearColor(0,0,0,0)); size_t iStereoBufferCount = (m_bDoStereoRendering) ? 2 : 1; for (size_t i = 0;iGetStateManager()->SetColorMask(false); GL(glDrawPixels(m_vWinSize.x, m_vWinSize.y, GL_DEPTH_COMPONENT, GL_FLOAT, m_aDepthStorage)); m_pContext->GetStateManager()->SetColorMask(true); } else { GL(glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT)); } } m_TargetBinder.Unbind(); } void GLRenderer::RenderCoordArrows(const RenderRegion& renderRegion) const { GPUState localState = m_BaseState; localState.enableLighting = true; localState.enableLight[0] = true; localState.enableCullFace = true; localState.enableTex[0] = TEX_NONE; localState.enableTex[1] = TEX_NONE; localState.enableBlend = false; m_pContext->GetStateManager()->Apply(localState); // TODO get rid of all the fixed function lighting and use a shader FixedFunctionality(); GLfloat light_diffuse[4] ={0.4f,0.4f,0.4f,1.0f}; GLfloat light_specular[4] ={1.0f,1.0f,1.0f,1.0f}; GLfloat global_ambient[4] ={0.1f,0.1f,0.1f,1.0f}; glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); glLightfv(GL_LIGHT0, GL_AMBIENT, global_ambient); glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); glLightModelf(GL_LIGHT_MODEL_LOCAL_VIEWER, 1.0f); glMaterialf(GL_FRONT_AND_BACK,GL_SHININESS,16.0f); glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,light_specular); glEnable(GL_COLOR_MATERIAL); GLfloat pfLightDirection[4]={0.0f,1.0f,1.0f,0.0f}; FLOATMATRIX4 matModelView, mTranslation, mProjection; matModelView = m_mView[0]; matModelView.setModelview(); glLightfv(GL_LIGHT0, GL_POSITION, pfLightDirection); mTranslation.Translation(0.8f,0.8f,-1.85f); mProjection = m_mProjection[0]*mTranslation; mProjection.setProjection(); FLOATMATRIX4 mRotation; matModelView = renderRegion.rotation*m_mView[0]; matModelView.setModelview(); glBegin(GL_TRIANGLES); glColor4f(0.0f,0.0f,1.0f,1.0f); for (size_t i = 0;i m_iBricksRenderedInThisSubFrame) { MESSAGE("%u bricks left to render", static_cast(uint64_t(m_vCurrentBrickList.size()) - m_iBricksRenderedInThisSubFrame)); // setup shaders vars SetDataDepShaderVars(); // Render a few bricks and return the time it took float fMsecPassedInThisPass = 0; if (!Render3DView(renderRegion, fMsecPassedInThisPass)) { completedJob = false; return false; } fMsecPassed += fMsecPassedInThisPass; // if there is nothing left todo in this subframe -> present the result if (m_vCurrentBrickList.size() == m_iBricksRenderedInThisSubFrame) { // show the timings as "other", to distinguish it from all those million messages OTHER("The current subframe took %g ms to render (LOD Level %u)", this->msecPassedCurrentFrame + fMsecPassed, static_cast(m_iCurrentLODOffset)); PostSubframe(renderRegion); completedJob = true; return true; } } completedJob = false; return true; } void GLRenderer::CopyImageToDisplayBuffer() { GL(glViewport(0,0,m_vWinSize.x,m_vWinSize.y)); if (m_bClearFramebuffer) ClearColorBuffer(); GPUState localState = m_BaseState; localState.blendFuncSrc = BF_SRC_ALPHA; localState.blendFuncDst = BF_ONE_MINUS_SRC_ALPHA; localState.depthFunc = DF_LEQUAL; localState.enableTex[0] = TEX_2D; localState.enableTex[1] = TEX_NONE; m_pContext->GetStateManager()->Apply(localState); m_pFBO3DImageLast->Read(0); // when we have more than 1 region the buffer already contains the normal // sized region so there's no need to resize again. // // Note: We check m_bOffscreenIsLowRes instead of the // ::decreaseScreenResNow because the low res image we are trying // to display might have been rendered a while ago and now the render region // has decreaseScreenResNow set to false while it's in the midst of trying to // render a new image. bool decreaseRes = renderRegions.size() == 1 && m_bOffscreenIsLowRes; GL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, decreaseRes ? GL_LINEAR : GL_NEAREST)); m_pFBO3DImageLast->ReadDepth(1); // always clear the depth buffer since we are transporting new data from the FBO GL(glClear(GL_DEPTH_BUFFER_BIT)); m_pProgramTrans->Enable(); if (decreaseRes) FullscreenQuadRegion(renderRegions[0].get(), decreaseRes); else FullscreenQuad(); m_pFBO3DImageLast->FinishRead(); m_pFBO3DImageLast->FinishDepthRead(); } void GLRenderer::DrawLogo() const { if (m_pLogoTex == NULL) return; FixedFunctionality(); GPUState localState = m_BaseState; localState.depthMask = false; localState.blendFuncSrc = BF_SRC_ALPHA; localState.blendFuncDst = BF_ONE_MINUS_SRC_ALPHA; localState.enableDepthTest = false; localState.enableTex[0] = TEX_2D; localState.enableTex[1] = TEX_NONE; m_pContext->GetStateManager()->Apply(localState); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrtho(-0.5, +0.5, -0.5, +0.5, 0.0, 1.0); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glMatrixMode(GL_TEXTURE); glLoadIdentity(); m_pLogoTex->Bind(); UINTVECTOR2 vSizes(m_pLogoTex->GetSize()); FLOATVECTOR2 vTexelSize(1.0f/FLOATVECTOR2(vSizes)); FLOATVECTOR2 vImageAspect(FLOATVECTOR2(vSizes)/FLOATVECTOR2(m_vWinSize)); vImageAspect /= vImageAspect.maxVal(); FLOATVECTOR2 vExtend(vImageAspect*0.25f); FLOATVECTOR2 vCenter; switch (m_iLogoPos) { case 0 : vCenter = FLOATVECTOR2(-0.50f+vExtend.x, 0.50f-vExtend.y); break; case 1 : vCenter = FLOATVECTOR2( 0.50f-vExtend.x, 0.50f-vExtend.y); break; case 2 : vCenter = FLOATVECTOR2(-0.50f+vExtend.x, -0.50f+vExtend.y); break; default : vCenter = FLOATVECTOR2( 0.50f-vExtend.x, -0.50f+vExtend.y); break; } glBegin(GL_QUADS); glColor4d(1,1,1,1); glTexCoord2d(0+vTexelSize.x,1-vTexelSize.y); glVertex3f(vCenter.x-vExtend.x, vCenter.y+vExtend.y, -0.5); glTexCoord2d(1-vTexelSize.x,1-vTexelSize.y); glVertex3f(vCenter.x+vExtend.x, vCenter.y+vExtend.y, -0.5); glTexCoord2d(1-vTexelSize.x,0+vTexelSize.y); glVertex3f(vCenter.x+vExtend.x, vCenter.y-vExtend.y, -0.5); glTexCoord2d(0+vTexelSize.x,0+vTexelSize.y); glVertex3f(vCenter.x-vExtend.x, vCenter.y-vExtend.y, -0.5); glEnd(); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); } void GLRenderer::DrawBackGradient() const { FixedFunctionality(); GPUState localState = m_BaseState; localState.depthMask = false; localState.enableBlend = false; localState.enableDepthTest = false; localState.enableTex[0] = TEX_NONE; localState.enableTex[1] = TEX_NONE; m_pContext->GetStateManager()->Apply(localState); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrtho(-1.0, +1.0, +1.0, -1.0, 0.0, 1.0); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glBegin(GL_QUADS); glColor4d(m_vBackgroundColors[0].x, m_vBackgroundColors[0].y, m_vBackgroundColors[0].z, 0); glVertex3d(-1.0, -1.0, -0.5); glVertex3d( 1.0, -1.0, -0.5); glColor4d(m_vBackgroundColors[1].x, m_vBackgroundColors[1].y, m_vBackgroundColors[1].z,0); glVertex3d( 1.0, 1.0, -0.5); glVertex3d(-1.0, 1.0, -0.5); glEnd(); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); } bool GLRenderer::CaptureSingleFrame(const std::string& strFilename, bool bPreserveTransparency) const { return m_FrameCapture.CaptureSingleFrame(strFilename, GetLastFBO(), bPreserveTransparency); } void GLRenderer::Cleanup() { m_TargetBinder.Unbind(); // make sure nothing is bound before we delete the buffers GPUMemMan& mm = *(m_pMasterController->MemMan()); if (m_pFBO3DImageLast) { mm.FreeFBO(m_pFBO3DImageLast); m_pFBO3DImageLast =NULL; } if (m_pFBOResizeQuickBlit) { mm.FreeFBO(m_pFBOResizeQuickBlit); m_pFBOResizeQuickBlit =NULL; } for (uint32_t i = 0;i<2;i++) { if (m_pFBO3DImageNext[i]) { mm.FreeFBO(m_pFBO3DImageNext[i]); m_pFBO3DImageNext[i] = NULL; } if (m_pFBOIsoHit[i]) { mm.FreeFBO(m_pFBOIsoHit[i]); m_pFBOIsoHit[i] = NULL; } if (m_pFBOCVHit[i]) { mm.FreeFBO(m_pFBOCVHit[i]); m_pFBOCVHit[i] = NULL; } } if (m_pLogoTex) { mm.FreeTexture(m_pLogoTex); m_pLogoTex =NULL; } // opengl may not be enabed yet so be careful calling gl functions if (glDeleteBuffers) GL(glDeleteBuffers(1, &m_GeoBuffer)); CleanupShaders(); } void GLRenderer::CreateOffscreenBuffers() { m_TargetBinder.Unbind(); // make sure nothing is bound before we delete the buffers GPUMemMan &mm = *(Controller::Instance().MemMan()); if (m_pFBO3DImageLast) { if (m_pFBOResizeQuickBlit) { mm.FreeFBO(m_pFBOResizeQuickBlit); m_pFBOResizeQuickBlit = NULL; } m_pFBOResizeQuickBlit = m_pFBO3DImageLast; m_pFBO3DImageLast = NULL; } for (uint32_t i=0; i < 2; i++) { if (m_pFBO3DImageNext[i]) { mm.FreeFBO(m_pFBO3DImageNext[i]); m_pFBO3DImageNext[i] = NULL; } if (m_pFBOIsoHit[i]) { mm.FreeFBO(m_pFBOIsoHit[i]); m_pFBOIsoHit[i] = NULL; } if (m_pFBOCVHit[i]) { mm.FreeFBO(m_pFBOCVHit[i]); m_pFBOCVHit[i] = NULL; } } if (m_vWinSize.area() > 0) { MESSAGE("Creating FBOs..."); GLenum intformat, type; switch (m_eBlendPrecision) { case BP_8BIT : intformat = GL_RGBA8; type = GL_UNSIGNED_BYTE; break; case BP_16BIT : intformat = m_texFormat16; type = GL_HALF_FLOAT; break; case BP_32BIT : intformat = m_texFormat32; type = GL_FLOAT; break; default : MESSAGE("Invalid Blending Precision"); return; } for (uint32_t i = 0;i<2;i++) { if (i==0) { m_pFBO3DImageLast = mm.GetFBO(GL_NEAREST, GL_NEAREST, GL_CLAMP, m_vWinSize.x, m_vWinSize.y, intformat, GL_RGBA, type, m_pContext->GetShareGroupID(), true); } m_pFBO3DImageNext[i] = mm.GetFBO(GL_NEAREST, GL_NEAREST, GL_CLAMP, m_vWinSize.x, m_vWinSize.y, intformat, GL_RGBA, type, m_pContext->GetShareGroupID(), true); m_pFBOIsoHit[i] = mm.GetFBO(GL_NEAREST, GL_NEAREST, GL_CLAMP, m_vWinSize.x, m_vWinSize.y, m_texFormat32, GL_RGBA, GL_FLOAT, m_pContext->GetShareGroupID(), true, 2); m_pFBOCVHit[i] = mm.GetFBO(GL_NEAREST, GL_NEAREST, GL_CLAMP, m_vWinSize.x, m_vWinSize.y, m_texFormat16, GL_RGBA, GL_HALF_FLOAT, m_pContext->GetShareGroupID(), true, 2); } } } void GLRenderer::SetBrickDepShaderVarsSlice(const UINTVECTOR3& vVoxelCount) const { if (m_eRenderMode == RM_2DTRANS) { FLOATVECTOR3 vStep = 1.0f/FLOATVECTOR3(vVoxelCount); m_pProgram2DTransSlice->Set("vVoxelStepsize", vStep.x, vStep.y, vStep.z); } } // If we're downsampling the data, no scaling is needed, but otherwise we need // to scale the TF in the same manner that we've scaled the data. float GLRenderer::CalculateScaling() { double fMaxValue = MaxValue(); uint32_t iMaxRange = uint32_t(1<GetBitWidth()); return (m_pDataset->GetBitWidth() != 8 && m_bDownSampleTo8Bits) ? 1.0f : float(iMaxRange/fMaxValue); } void GLRenderer::SetConstantShaderVars() { /* // no scaling for this case. m_pProgram1DTransSlice->Set("fStepScale", 1.0f); int method = static_cast(this->m_TFScalingMethod); MESSAGE("Setting scale method to %d", method); m_pProgram1DTransSlice->Set("ScaleMethod", method); GL_CHECK(); // TODO Tom: why are we trying to set a variable that does not exist in the shader? m_pProgram1DTransSlice3D->Set("ScaleMethod", method); GL_CHECK(); // TODO Tom: why are we trying to set a variable that does not exist in the shader? */ } void GLRenderer::SetDataDepShaderVars() { MESSAGE("Setting up vars"); // if m_bDownSampleTo8Bits is enabled the full range from 0..255 -> 0..1 is used float fScale = CalculateScaling(); float fGradientScale = (m_pDataset->MaxGradientMagnitude() == 0) ? 1.0f : 1.0f/m_pDataset->MaxGradientMagnitude(); MESSAGE("Transfer function scaling factor: %5.3f", fScale); MESSAGE("Gradient scaling factor: %5.3f", fGradientScale); bool bMipViewActive = false; bool bSliceViewActive = false; bool b3DViewActive = false; for (size_t i=0; i < renderRegions.size(); ++i) { if (renderRegions[i]->is2D()) { bSliceViewActive = true; if (renderRegions[i]->GetUseMIP()) { bMipViewActive = true; } } else { b3DViewActive = true; } } // If we're rendering RGBA data, we don't scale the TFqn... because we // don't even use a TFqn. if(!this->ColorData() && bMipViewActive) { m_pProgramTransMIP->Enable(); m_pProgramTransMIP->Set("fTransScale",fScale); } switch (m_eRenderMode) { case RM_1DTRANS: { if(!this->ColorData()) { if (bSliceViewActive) { m_pProgram1DTransSlice->Enable(); m_pProgram1DTransSlice->Set("fTransScale",fScale); m_pProgram1DTransSlice3D->Enable(); m_pProgram1DTransSlice3D->Set("fTransScale",fScale); } if (b3DViewActive) { m_pProgram1DTrans[m_bUseLighting ? 1 : 0]->Enable(); m_pProgram1DTrans[m_bUseLighting ? 1 : 0]->Set("fTransScale",fScale); } } break; } case RM_2DTRANS: { if (bSliceViewActive) { m_pProgram2DTransSlice->Enable(); m_pProgram2DTransSlice->Set("fTransScale",fScale); m_pProgram2DTransSlice->Set("fGradientScale",fGradientScale); m_pProgram2DTransSlice3D->Enable(); m_pProgram2DTransSlice3D->Set("fTransScale",fScale); m_pProgram2DTransSlice3D->Set("fGradientScale",fGradientScale); } if (b3DViewActive) { m_pProgram2DTrans[m_bUseLighting ? 1 : 0]->Enable(); m_pProgram2DTrans[m_bUseLighting ? 1 : 0]->Set("fTransScale",fScale); m_pProgram2DTrans[m_bUseLighting ? 1 : 0]->Set("fGradientScale",fGradientScale); } break; } case RM_ISOSURFACE: { // as we are rendering the 2 slices with the 1d transferfunction in iso // mode, we need update that shader, too if (bSliceViewActive) { m_pProgram1DTransSlice->Enable(); m_pProgram1DTransSlice->Set("fTransScale",fScale); m_pProgram1DTransSlice3D->Enable(); m_pProgram1DTransSlice3D->Set("fTransScale",fScale); } if (b3DViewActive) { GLSLProgram* shader = this->ColorData() ? m_pProgramColor : m_pProgramIso; shader->Enable(); shader->Set("fIsoval", static_cast (this->GetNormalizedIsovalue())); } break; } case RM_INVALID: T_ERROR("Invalid rendermode set"); break; } MESSAGE("Done"); } void GLRenderer::SetBlendPrecision(EBlendPrecision eBlendPrecision) { if (eBlendPrecision != m_eBlendPrecision) { AbstrRenderer::SetBlendPrecision(eBlendPrecision); CreateOffscreenBuffers(); } } std::string GLRenderer::FindFileInDirs(const std::string& file, const std::vector strDirs,bool subdirs) const { #ifdef DETECTED_OS_APPLE if (SysTools::FileExists(SysTools::GetFromResourceOnMac(file))) { std::string res = SysTools::GetFromResourceOnMac(file); MESSAGE("Found %s in bundle, using that.", file.c_str()); return res; } #endif if (SysTools::FileExists(file)) return file; // not in the current dir! // iterate through all directories, looking for the file in them. for (size_t i = 0;i dirs = SysTools::GetSubDirList( Controller::ConstInstance().SysInfo().GetProgramPath() ); dirs.push_back(Controller::ConstInstance().SysInfo().GetProgramPath()); std::string raw_fn = SysTools::GetFilename(file); for(std::vector::const_iterator d = dirs.begin(); d != dirs.end(); ++d) { std::string testfn = *d + "/" + raw_fn; if(SysTools::FileExists(testfn)) { return testfn; } } } WARNING("Could not find '%s'", file.c_str()); return ""; } return file; } namespace { template bool all_exist(ForwIter bgn, ForwIter end) { if(bgn == end) { WARNING("Odd, empty range..."); } while(bgn != end) { if(!SysTools::FileExists(*bgn)) { return false; } ++bgn; } return true; } } bool GLRenderer::LoadAndVerifyShader(GLSLProgram** program, const std::vector strDirs, ...) { // first build list of fragment shaders std::vector vertex; std::vector frag; va_list args; va_start(args, strDirs); { const char* filename; // We expect two NULLs; the first terminates the vertex shader list, the // latter terminates the fragment shader list. while(NULL != (filename = va_arg(args, const char*)) ) { std::string shader = FindFileInDirs(std::string(filename), strDirs, false); if(shader == "") { WARNING("Could not find VS shader '%s'!", filename); } vertex.push_back(shader); } while(NULL != (filename = va_arg(args, const char*)) ) { std::string shader = FindFileInDirs(std::string(filename), strDirs, false); if(shader == "") { WARNING("Could not find FS shader '%s'!", filename); } frag.push_back(shader); } } va_end(args); if(!vertex.empty() && !frag.empty() && all_exist(vertex.begin(), vertex.end()) && all_exist(frag.begin(), frag.end())) { return LoadAndVerifyShader(vertex, frag, program); } return false; } bool GLRenderer::LoadAndVerifyShader(std::vector vert, std::vector frag, GLSLProgram** program) const { for(std::vector::iterator v = vert.begin(); v != vert.end(); ++v) { *v = FindFile(*v, false); if(v->empty()) { WARNING("We'll need to search for vertex shader '%s'...", v->c_str()); } } for(std::vector::iterator f = frag.begin(); f != frag.end(); ++f) { *f = FindFile(*f, false); if(f->empty()) { WARNING("We'll need to search for fragment shader '%s'...", f->c_str()); } } GPUMemMan& mm = *(m_pMasterController->MemMan()); (*program) = mm.GetGLSLProgram(ShaderDescriptor(vert, frag), m_pContext->GetShareGroupID()); if((*program) == NULL || !(*program)->IsValid()) { /// @todo fixme report *which* shaders! T_ERROR("Error loading shaders."); mm.FreeGLSLProgram(*program); return false; } return true; } void GLRenderer::CheckMeshStatus() { // if we can do geometry then let's first find out information // about the geometry to render if (m_bSupportsMeshes) { m_iNumTransMeshes = 0; m_iNumMeshes = 0; for (vector>::iterator mesh = m_Meshes.begin(); mesh != m_Meshes.end(); mesh++) { if ((*mesh)->GetActive()) { m_iNumMeshes++; if (!(*mesh)->IsCompletelyOpaque()) m_iNumTransMeshes++; } } MESSAGE("Found %u meshes %u of which contain transparent parts.", static_cast(m_iNumMeshes), static_cast(m_iNumTransMeshes)); } } void GLRenderer::GeometryPreRender() { CheckMeshStatus(); // for rendering modes other than isosurface render the bbox in the first // pass once, to init the depth buffer. for isosurface rendering we can go // ahead and render the bbox directly as isosurfacing writes out correct // depth values if (m_eRenderMode != RM_ISOSURFACE || m_bDoClearView) { GPUState localState = m_BaseState; localState.enableBlend = false; localState.depthMask = false; m_pContext->GetStateManager()->Apply(localState); // first render the pars of the meshes that are in front of the volume // remember the volume uses front to back compositing if (m_bSupportsMeshes && m_iNumMeshes) { m_pProgramMeshFTB->Enable(); RenderTransFrontGeometry(); } // now write the depth mask of the opaque geomentry into the buffer // as we do front to back compositing we can not write the colors // into the buffer yet // start with the bboxes m_pContext->GetStateManager()->SetDepthMask(true); m_pContext->GetStateManager()->SetColorMask(false); if (m_bRenderGlobalBBox) RenderBBox(); if (m_bRenderLocalBBox) { for (size_t iCurrentBrick = 0; iCurrentBrick < m_vCurrentBrickList.size(); iCurrentBrick++) { if (m_vCurrentBrickList[iCurrentBrick].bIsEmpty) RenderBBox(FLOATVECTOR4(1,1,0,1), m_vCurrentBrickList[iCurrentBrick].vCenter, m_vCurrentBrickList[iCurrentBrick].vExtension*0.99f); else RenderBBox(FLOATVECTOR4(0,1,0,1), m_vCurrentBrickList[iCurrentBrick].vCenter, m_vCurrentBrickList[iCurrentBrick].vExtension); } } // now the opaque parts of the mesh if (m_bSupportsMeshes && m_iNumMeshes) { // FTB and BTF would both be ok here, so we use BTF as it is simpler m_pProgramMeshBTF->Enable(); RenderOpaqueGeometry(); } } else { // if we are in isosurface mode none of the complicated stuff from // above applies, as the volume is opqaue we can just use regular // depth testing and the order of the opaque elements does not matter // so we might as well now write all the opaque geoemtry into the color // and depth buffer GPUState localState = m_BaseState; localState.enableBlend = false; m_pContext->GetStateManager()->Apply(localState); // first the bboxes if (m_bRenderGlobalBBox) RenderBBox(); if (m_bRenderLocalBBox) { for (size_t iCurrentBrick = 0; iCurrentBrick < m_vCurrentBrickList.size(); iCurrentBrick++) { if (m_vCurrentBrickList[iCurrentBrick].bIsEmpty) RenderBBox(FLOATVECTOR4(1,1,0,1), m_vCurrentBrickList[iCurrentBrick].vCenter, m_vCurrentBrickList[iCurrentBrick].vExtension*0.99f); else RenderBBox(FLOATVECTOR4(0,1,0,1), m_vCurrentBrickList[iCurrentBrick].vCenter, m_vCurrentBrickList[iCurrentBrick].vExtension); } } // the the opaque parts of the meshes if (m_bSupportsMeshes && m_iNumMeshes) { // FTB and BTF would both be ok here, so we use BTF as it is simpler m_pProgramMeshBTF->Enable(); RenderOpaqueGeometry(); } } } // For volume rendering, we render the bounding box again after rendering the // dataset. This is because we want the box lines which are in front of the // dataset to appear .. well, in front of the dataset. void GLRenderer::GeometryPostRender() { // Not required for isosurfacing, since we use the depth buffer for // occluding/showing the bbox's outline. if (m_eRenderMode != RM_ISOSURFACE || m_bDoClearView) { GPUState localState = m_BaseState; localState.depthFunc = DF_LEQUAL; m_pContext->GetStateManager()->Apply(localState); if (m_bRenderGlobalBBox) RenderBBox(); if (m_bRenderLocalBBox) { for (size_t iCurrentBrick = 0;iCurrentBrickEnable(); m_pProgramMeshBTF->Set("fOffset",0.001f); RenderOpaqueGeometry(); m_pProgramMeshBTF->Set("fOffset",0.0f); } m_pContext->GetStateManager()->SetEnableDepthTest(false); if (m_bSupportsMeshes && m_iNumMeshes) { m_pProgramMeshFTB->Enable(); RenderTransBackGeometry(); } } else { if (m_bSupportsMeshes && m_iNumMeshes) { GPUState localState = m_BaseState; localState.depthMask = false; m_pContext->GetStateManager()->Apply(localState); // "over"-compositing with proper alpha // we only use this once in the project so we bypass // the state manager, be carfeull to reset it below GL(glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); m_pProgramMeshBTF->Enable(); SetMeshBTFSorting(true); RenderTransBackGeometry(); RenderTransInGeometry(); RenderTransFrontGeometry(); SetMeshBTFSorting(false); // reset the blending in the state manager m_pContext->GetStateManager()->SetBlendFunction(BF_ONE,BF_ONE, true); } } } void GLRenderer::SetMeshBTFSorting(bool bSortBTF) { m_bSortMeshBTF = bSortBTF; for (vector>::iterator mesh = m_Meshes.begin(); mesh != m_Meshes.end(); mesh++) { (*mesh)->EnableOverSorting(bSortBTF); } } void GLRenderer::RenderOpaqueGeometry() { for (vector>::iterator mesh = m_Meshes.begin(); mesh != m_Meshes.end(); mesh++) { if ((*mesh)->GetActive()) (*mesh)->RenderOpaqueGeometry(); } } #define BUFFER_OFFSET(i) ((char *)NULL + (i)) struct MeshFormat { FLOATVECTOR3 m_vPos; FLOATVECTOR4 m_vColor; FLOATVECTOR3 m_vNormal; FLOATVECTOR2 m_vTexCoords; }; static const GLsizei iStructSize = GLsizei(sizeof(MeshFormat)); void ListEntryToMeshFormat(std::vector& list, const RenderMesh* mesh, size_t startIndex) { bool bHasNormal = mesh->GetNormalIndices().size() == mesh->GetVertexIndices().size(); bool bHasTC = mesh->GetTexCoordIndices().size() == mesh->GetVertexIndices().size(); MeshFormat f; // currently we only support triangles, hence the 3 for (size_t i = 0;i<3;i++) { size_t vertexIndex = mesh->GetVertexIndices()[startIndex+i]; f.m_vPos = mesh->GetVertices()[vertexIndex]; if (mesh->UseDefaultColor()) f.m_vColor = mesh->GetDefaultColor(); else f.m_vColor = mesh->GetColors()[vertexIndex]; if (bHasNormal) f.m_vNormal = mesh->GetNormals()[vertexIndex]; else f.m_vNormal = FLOATVECTOR3(2,2,2); if (bHasNormal) f.m_vNormal = mesh->GetNormals()[vertexIndex]; else f.m_vNormal = FLOATVECTOR3(2,2,2); if (bHasTC) f.m_vTexCoords = mesh->GetTexCoords()[vertexIndex]; else f.m_vTexCoords = FLOATVECTOR2(0,0); list.push_back(f); } } void GLRenderer::RenderMergedMesh(SortIndexPVec& mergedMesh) { // terminate early if the mesh is empty if (mergedMesh.empty()) return; // sort the mesh std::sort(mergedMesh.begin(), mergedMesh.end(), (m_bSortMeshBTF) ? DistanceSortOver : DistanceSortUnder); // turn it into something renderable std::vector list; for (SortIndexPVec::const_iterator index = mergedMesh.begin(); index != mergedMesh.end(); index++) { ListEntryToMeshFormat(list, (*index)->m_mesh, (*index)->m_index); } // render it // all of the following calls are bypassing the state manager GL(glBindBuffer(GL_ARRAY_BUFFER, m_GeoBuffer)); GL(glBufferData(GL_ARRAY_BUFFER, GLsizei(list.size())*iStructSize, &list[0], GL_STREAM_DRAW)); GL(glVertexPointer(3, GL_FLOAT, iStructSize, BUFFER_OFFSET(0))); GL(glColorPointer(4, GL_FLOAT, iStructSize, BUFFER_OFFSET(3*sizeof(float)))); GL(glNormalPointer(GL_FLOAT, iStructSize, BUFFER_OFFSET(7*sizeof(float)))); GL(glTexCoordPointer(2, GL_FLOAT, iStructSize, BUFFER_OFFSET(10*sizeof(float)))); GL(glEnableClientState(GL_VERTEX_ARRAY)); GL(glEnableClientState(GL_COLOR_ARRAY)); GL(glEnableClientState(GL_NORMAL_ARRAY)); GL(glEnableClientState(GL_TEXTURE_COORD_ARRAY)); GL(glDrawArrays(GL_TRIANGLES, 0, GLsizei(list.size()))); GL(glDisableClientState(GL_VERTEX_ARRAY)); GL(glDisableClientState(GL_COLOR_ARRAY)); GL(glDisableClientState(GL_NORMAL_ARRAY)); GL(glDisableClientState(GL_TEXTURE_COORD_ARRAY)); } void GLRenderer::RenderTransBackGeometry() { // no transparent mesh -> nothing todo if (m_iNumTransMeshes == 0) return; // only one transparent mesh -> render it if (m_iNumTransMeshes == 1) { for (vector>::iterator mesh = m_Meshes.begin(); mesh != m_Meshes.end(); mesh++) { if ((*mesh)->GetActive()) (*mesh)->RenderTransGeometryBehind(); } return; } // more than one transparent mesh -> merge them before sorting and rendering SortIndexPVec mergedMesh; for (vector>::iterator mesh = m_Meshes.begin(); mesh != m_Meshes.end(); mesh++) { if ((*mesh)->GetActive()) { const SortIndexPVec& m = (*mesh)->GetBehindPointList(false); // don't worry about empty meshes if (m.empty()) continue; // currently only triangles are supported if (m[0]->m_mesh->GetVerticesPerPoly() != 3) continue; // merge lists mergedMesh.insert(mergedMesh.end(), m.begin(), m.end()); } } RenderMergedMesh(mergedMesh); } void GLRenderer::RenderTransInGeometry() { // no transparent mesh -> nothing todo if (m_iNumTransMeshes == 0) return; // only one transparent mesh -> render it if (m_iNumTransMeshes == 1) { for (vector>::iterator mesh = m_Meshes.begin(); mesh != m_Meshes.end(); mesh++) { if ((*mesh)->GetActive()) (*mesh)->RenderTransGeometryInside(); } return; } // more than one transparent mesh -> merge them before sorting and rendering SortIndexPVec mergedMesh; for (vector>::iterator mesh = m_Meshes.begin(); mesh != m_Meshes.end(); mesh++) { if ((*mesh)->GetActive()) { const SortIndexPVec& m = (*mesh)->GetInPointList(false); // don't worry about empty meshes if (m.empty()) continue; // currently only triangles are supported if (m[0]->m_mesh->GetVerticesPerPoly() != 3) continue; // merge lists mergedMesh.insert(mergedMesh.end(), m.begin(), m.end()); } } RenderMergedMesh(mergedMesh); } void GLRenderer::RenderTransFrontGeometry() { // no transparent mesh -> nothing todo if (m_iNumTransMeshes == 0) return; // only one transparent mesh -> render it if (m_iNumTransMeshes == 1) { for (vector>::iterator mesh = m_Meshes.begin(); mesh != m_Meshes.end(); mesh++) { if ((*mesh)->GetActive()) (*mesh)->RenderTransGeometryFront(); } return; } // more than one transparent mesh -> merge them before sorting and rendering SortIndexPVec mergedMesh; for (vector>::iterator mesh = m_Meshes.begin(); mesh != m_Meshes.end(); mesh++) { if ((*mesh)->GetActive()) { const SortIndexPVec& m = (*mesh)->GetFrontPointList(false); // don't worry about empty meshes if (m.empty()) continue; // currently only triangles are supported if (m[0]->m_mesh->GetVerticesPerPoly() != 3) continue; // merge lists mergedMesh.insert(mergedMesh.end(), m.begin(), m.end()); } } RenderMergedMesh(mergedMesh); } void GLRenderer::PlaneIn3DPreRender() { if (!m_bRenderPlanesIn3D) return; FixedFunctionality(); // for rendering modes other than isosurface render the planes in the first // pass once to init the depth buffer. for isosurface rendering we can go // ahead and render the planes directly as isosurfacing writes out correct // depth values if (m_eRenderMode != RM_ISOSURFACE || m_bDoClearView) { RenderPlanesIn3D(true); } else { RenderPlanesIn3D(false); } } void GLRenderer::PlaneIn3DPostRender() { if (!m_bRenderPlanesIn3D) return; FixedFunctionality(); // Not required for isosurfacing, since we use the depth buffer for // occluding/showing the planes if (m_eRenderMode != RM_ISOSURFACE || m_bDoClearView) { GPUState localState = m_BaseState; localState.enableDepthTest = false; m_pContext->GetStateManager()->Apply(localState); RenderPlanesIn3D(false); } } void GLRenderer::RenderPlanesIn3D(bool bDepthPassOnly) { FLOATVECTOR3 vCenter, vExtend; GetVolumeAABB(vCenter, vExtend); FLOATVECTOR3 vMinPoint = -vExtend/2.0f, vMaxPoint = vExtend/2.0f; GPUState localState = m_BaseState; localState.depthFunc = DF_LEQUAL; localState.lineWidth = 2.0f; localState.enableTex[0] = TEX_NONE; localState.enableTex[1] = TEX_NONE; localState.colorMask = !bDepthPassOnly; m_pContext->GetStateManager()->Apply(localState); if (!bDepthPassOnly) glColor4f(1,1,1,1); for (size_t i=0; i < renderRegions.size(); ++i) { int k=0; switch (renderRegions[i]->windowMode) { case RenderRegion::WM_SAGITTAL: k=0; break; case RenderRegion::WM_AXIAL : k=1; break; case RenderRegion::WM_CORONAL : k=2; break; default: continue; }; const float sliceIndex = static_cast(renderRegions[i]->GetSliceIndex()) / m_pDataset->GetDomainSize()[k]; const float planePos = vMinPoint[k] * (1.0f-sliceIndex) + vMaxPoint[k] * sliceIndex; glBegin(GL_LINE_LOOP); switch (renderRegions[i]->windowMode) { case RenderRegion::WM_SAGITTAL : glVertex3f(planePos, vMinPoint.y, vMaxPoint.z); glVertex3f(planePos, vMinPoint.y, vMinPoint.z); glVertex3f(planePos, vMaxPoint.y, vMinPoint.z); glVertex3f(planePos, vMaxPoint.y, vMaxPoint.z); break; case RenderRegion::WM_AXIAL : glVertex3f(vMaxPoint.x, planePos, vMinPoint.z); glVertex3f(vMinPoint.x, planePos, vMinPoint.z); glVertex3f(vMinPoint.x, planePos, vMaxPoint.z); glVertex3f(vMaxPoint.x, planePos, vMaxPoint.z); break; case RenderRegion::WM_CORONAL : glVertex3f(vMaxPoint.x, vMinPoint.y, planePos); glVertex3f(vMinPoint.x, vMinPoint.y, planePos); glVertex3f(vMinPoint.x, vMaxPoint.y, planePos); glVertex3f(vMaxPoint.x, vMaxPoint.y, planePos); break; default: break; // Should not get here. }; glEnd(); } } /** Renders the currently configured clip plane. * The plane logic is mostly handled by ExtendedPlane::Quad: though we only * need the plane's normal to clip things, we store an orthogonal vector for * the plane's surface specifically to make rendering the plane easy. */ void GLRenderer::RenderClipPlane(EStereoID eStereoID) { /* Bail if the user doesn't want to use or see the plane. */ if(!m_bClipPlaneOn || !m_bClipPlaneDisplayed) { return ; } FLOATVECTOR4 vColorQuad(0.0f,0.0f,0.8f,0.4f); FLOATVECTOR4 vColorBorder(1.0f,1.0f,0.0f,1.0f); ExtendedPlane transformed(m_ClipPlane); m_mView[size_t(eStereoID)].setModelview(); FixedFunctionality(); GPUState localState = m_BaseState; localState.enableTex[0] = TEX_NONE; localState.enableTex[1] = TEX_NONE; typedef std::vector TriList; TriList quad; /* transformed.Quad will give us back a list of triangle vertices; the return * value gives us the order we should render those so that we don't mess up * front/back faces. */ bool ccw = transformed.Quad(m_vEye, quad); if (m_iNumMeshes == 0) { if((m_eRenderMode != RM_ISOSURFACE || m_bDoClearView) && !ccw) { vColorQuad *= vColorQuad.w; vColorBorder *= vColorBorder.w; localState.blendFuncSrc = BF_ONE_MINUS_DST_ALPHA; localState.blendFuncDst = BF_ONE; } else { localState.blendFuncSrc = BF_SRC_ALPHA; localState.blendFuncDst = BF_ONE_MINUS_SRC_ALPHA; } // Now render the plane. m_pContext->GetStateManager()->Apply(localState); glBegin(GL_TRIANGLES); glColor4f(vColorQuad.x, vColorQuad.y, vColorQuad.z, vColorQuad.w); for(size_t i=0; i < 6; i+=3) { // 2 tris: 6 points. glVertex3f(quad[i+0].x, quad[i+0].y, quad[i+0].z); glVertex3f(quad[i+1].x, quad[i+1].y, quad[i+1].z); glVertex3f(quad[i+2].x, quad[i+2].y, quad[i+2].z); } glEnd(); glEnable(GL_LINE_SMOOTH); // bypassing the state manager here } else { localState.enableBlend = false; m_pContext->GetStateManager()->Apply(localState); } m_pContext->GetStateManager()->SetLineWidth(4.0f); glBegin(GL_LINES); glColor4f(vColorBorder.x, vColorBorder.y, vColorBorder.z, vColorBorder.w); for(size_t i = 6; i<14 ; i += 2) { glVertex3f(quad[i+0].x, quad[i+0].y, quad[i+0].z); glVertex3f(quad[i+1].x, quad[i+1].y, quad[i+1].z); } glEnd(); glDisable(GL_LINE_SMOOTH); // bypassing the state manager here } void GLRenderer::ScanForNewMeshes() { vector> meshVec = m_pDataset->GetMeshes(); for (size_t i = m_Meshes.size(); i(new RenderMeshGL(*meshVec[i]))); m_Meshes[m_Meshes.size()-1]->InitRenderer(); } Schedule3DWindowRedraws(); } void GLRenderer::FixedFunctionality() const { GLSLProgram::Disable(); } void GLRenderer::SyncStateManager() { m_pContext->GetStateManager()->Apply(m_BaseState, true); } bool GLRenderer::RegisterDataset(Dataset* ds) { if(!AbstrRenderer::RegisterDataset(ds)) { return false; } if (m_pProgram1DTrans[0] != NULL) SetDataDepShaderVars(); // convert meshes in dataset to RenderMeshes vector> meshVec = m_pDataset->GetMeshes(); for (vector>::const_iterator mesh = meshVec.begin(); mesh != meshVec.end(); mesh++) { m_Meshes.push_back(shared_ptr(new RenderMeshGL(**mesh))); } return true; } void GLRenderer::Recompose3DView(const RenderRegion3D& renderRegion) { MESSAGE("Recompositing..."); NewFrameClear(renderRegion); size_t iStereoBufferCount = (m_bDoStereoRendering) ? 2 : 1; for (size_t i = 0;i m_iBricksRenderedInThisSubFrame && (m_eRendererTarget == RT_HEADLESS || fMsecPassed < m_iTimeSliceMSecs)) { MESSAGE(" Brick %u of %u", static_cast(m_iBricksRenderedInThisSubFrame+1), static_cast(m_vCurrentBrickList.size())); const BrickKey& bkey = m_vCurrentBrickList[size_t(m_iBricksRenderedInThisSubFrame)].kBrick; MESSAGE(" Requesting texture from MemMan"); if(BindVolumeTex(bkey, m_iIntraFrameCounter++)) { MESSAGE(" Binding Texture"); } else { T_ERROR("Cannot bind texture, GetVolume returned invalid volume"); return false; } Render3DInLoop(renderRegion, size_t(m_iBricksRenderedInThisSubFrame), SI_LEFT_OR_MONO); if (m_bDoStereoRendering) { if (m_vLeftEyeBrickList[size_t(m_iBricksRenderedInThisSubFrame)].kBrick != m_vCurrentBrickList[size_t(m_iBricksRenderedInThisSubFrame)].kBrick) { const BrickKey& left_eye_key = m_vLeftEyeBrickList[size_t(m_iBricksRenderedInThisSubFrame)].kBrick; UnbindVolumeTex(); if(BindVolumeTex(left_eye_key, m_iIntraFrameCounter++)) { MESSAGE(" Binding Texture (left eye)"); } else { T_ERROR("Cannot bind texture (left eye), GetVolume returned invalid volume"); return false; } } Render3DInLoop(renderRegion, size_t(m_iBricksRenderedInThisSubFrame),SI_RIGHT); } // release the 3D texture if (!UnbindVolumeTex()) { T_ERROR("Cannot unbind volume."); return false; } // count the bricks rendered m_iBricksRenderedInThisSubFrame++; if (m_eRendererTarget != RT_CAPTURE) { #ifdef DETECTED_OS_APPLE // really (hopefully) force a pipleine flush unsigned char dummy[4]; glReadPixels(0,0,1,1,GL_RGBA,GL_UNSIGNED_BYTE,dummy); #else // let's pretend this actually does what it should glFinish(); #endif } // time this loop fMsecPassed = float(m_Timer.Elapsed()); ++bricks_this_call; } MESSAGE("Rendered %u bricks this call.", bricks_this_call); Render3DPostLoop(); if (m_eRenderMode == RM_ISOSURFACE && m_vCurrentBrickList.size() == m_iBricksRenderedInThisSubFrame) { for (size_t i = 0;iMemMan()); if (m_pLogoTex) { mm.FreeTexture(m_pLogoTex); m_pLogoTex =NULL; } if (m_strLogoFilename != "") m_pLogoTex = mm.Load2DTextureFromFile(m_strLogoFilename, m_pContext->GetShareGroupID()); ScheduleCompleteRedraw(); } void GLRenderer::ComposeSurfaceImage(const RenderRegion &renderRegion, EStereoID eStereoID) { GPUState localState = m_BaseState; localState.enableTex[0] = TEX_2D; localState.enableTex[1] = TEX_2D; localState.enableBlend = false; m_pContext->GetStateManager()->Apply(localState); m_pFBOIsoHit[size_t(eStereoID)]->Read(0, 0); m_pFBOIsoHit[size_t(eStereoID)]->Read(1, 1); FLOATVECTOR3 a = m_cAmbient.xyz()*m_cAmbient.w; FLOATVECTOR3 d = m_cDiffuse.xyz()*m_cDiffuse.w; FLOATVECTOR3 s = m_cSpecular.xyz()*m_cSpecular.w; if (m_bDoClearView) { m_pProgramCVCompose->Enable(); m_pProgramCVCompose->Set("vLightAmbient",a.x,a.y,a.z); m_pProgramCVCompose->Set("vLightSpecular",s.x,s.y,s.z); m_pProgramCVCompose->Set("vLightDir",m_vLightDir.x,m_vLightDir.y,m_vLightDir.z); m_pProgramCVCompose->Set("vLightDiffuse", d.x*m_vIsoColor.x, d.y*m_vIsoColor.y, d.z*m_vIsoColor.z); m_pProgramCVCompose->Set("vLightDiffuse2", d.x*m_vCVColor.x, d.y*m_vCVColor.y, d.z*m_vCVColor.z); m_pProgramCVCompose->Set("vCVParam",m_fCVSize, m_fCVContextScale, m_fCVBorderScale); FLOATVECTOR4 transPos = m_vCVPos * renderRegion.modelView[size_t(eStereoID)]; m_pProgramCVCompose->Set("vCVPickPos", transPos.x, transPos.y, transPos.z); m_pFBOCVHit[size_t(eStereoID)]->Read(2, 0); m_pFBOCVHit[size_t(eStereoID)]->Read(3, 1); } else { if(this->ColorData()) { m_pProgramColorCompose->Enable(); m_pProgramColorCompose->Set("vLightAmbient",a.x,a.y,a.z); m_pProgramColorCompose->Set("vLightSpecular",s.x,s.y,s.z); m_pProgramColorCompose->Set("vLightDiffuse", d.x, d.y, d.z); m_pProgramColorCompose->Set("vLightDir",m_vLightDir.x,m_vLightDir.y,m_vLightDir.z); } else { m_pProgramIsoCompose->Enable(); m_pProgramIsoCompose->Set("vLightAmbient",a.x,a.y,a.z); m_pProgramIsoCompose->Set("vLightSpecular",s.x,s.y,s.z); m_pProgramIsoCompose->Set("vLightDir",m_vLightDir.x,m_vLightDir.y,m_vLightDir.z); m_pProgramIsoCompose->Set("vLightDiffuse", d.x*m_vIsoColor.x, d.y*m_vIsoColor.y, d.z*m_vIsoColor.z); } } glBegin(GL_QUADS); glTexCoord2d(0,1); glVertex3d(-1.0, 1.0, -0.5); glTexCoord2d(1,1); glVertex3d( 1.0, 1.0, -0.5); glTexCoord2d(1,0); glVertex3d( 1.0, -1.0, -0.5); glTexCoord2d(0,0); glVertex3d(-1.0, -1.0, -0.5); glEnd(); if (m_bDoClearView) { m_pFBOCVHit[size_t(eStereoID)]->FinishRead(0); m_pFBOCVHit[size_t(eStereoID)]->FinishRead(1); } m_pFBOIsoHit[size_t(eStereoID)]->FinishRead(1); m_pFBOIsoHit[size_t(eStereoID)]->FinishRead(0); } void GLRenderer::CVFocusHasChanged(LuaClassInstance luaRegion) { // read back the 3D position from the framebuffer float vec[4]; m_pFBOIsoHit[0]->ReadBackPixels(m_vCVMousePos.x, m_vWinSize.y-m_vCVMousePos.y, 1, 1, vec); shared_ptr ss = m_pMasterController->LuaScript(); RenderRegion* region = luaRegion.getRawPointer(ss); // update m_vCVPos if (vec[3] != 0.0f) { m_vCVPos = FLOATVECTOR4(vec[0],vec[1],vec[2],1.0f) * region->modelView[0].inverse(); } else { // if we do not pick a valid point move CV pos to "nirvana" m_vCVPos = FLOATVECTOR4(10000000.0f, 10000000.0f, 10000000.0f, 0.0f); } // now let the parent do its part AbstrRenderer::CVFocusHasChanged(luaRegion); } FLOATVECTOR3 GLRenderer::Pick(const UINTVECTOR2& mousePos) const { if(m_eRenderMode != RM_ISOSURFACE) { throw std::runtime_error("Can only determine pick locations in " "isosurface rendering mode."); } // readback the pos from the FB float vec[4]; m_pFBOIsoHit[0]->ReadBackPixels(mousePos.x, m_vWinSize.y-mousePos.y, 1, 1, vec); if(vec[3] == 0.0f) { throw std::range_error("No intersection."); } return FLOATVECTOR3(vec[0], vec[1], vec[2]); } void GLRenderer::SaveEmptyDepthBuffer() { if (m_aDepthStorage == NULL) return; for (size_t i = 0;iGetScale()); m_pProgram1DTrans[1]->Enable(); m_pProgram1DTrans[1]->Set("vLightAmbient",a.x,a.y,a.z); m_pProgram1DTrans[1]->Set("vLightDiffuse",d.x,d.y,d.z); m_pProgram1DTrans[1]->Set("vLightSpecular",s.x,s.y,s.z); m_pProgram1DTrans[1]->Set("vLightDir",m_vLightDir.x,m_vLightDir.y,m_vLightDir.z); m_pProgram1DTrans[1]->Set("vDomainScale",scale.x,scale.y,scale.z); m_pProgram2DTrans[1]->Enable(); m_pProgram2DTrans[1]->Set("vLightAmbient",a.x,a.y,a.z); m_pProgram2DTrans[1]->Set("vLightDiffuse",d.x,d.y,d.z); m_pProgram2DTrans[1]->Set("vLightSpecular",s.x,s.y,s.z); m_pProgram2DTrans[1]->Set("vLightDir",m_vLightDir.x,m_vLightDir.y,m_vLightDir.z); m_pProgram2DTrans[1]->Set("vDomainScale",scale.x,scale.y,scale.z); m_pProgramMeshBTF->Enable(); m_pProgramMeshBTF->Set("vLightAmbientM",aM.x,aM.y,aM.z); m_pProgramMeshBTF->Set("vLightDiffuseM",dM.x,dM.y,dM.z); m_pProgramMeshBTF->Set("vLightSpecularM",sM.x,sM.y,sM.z); m_pProgramMeshBTF->Set("vLightDir",m_vLightDir.x,m_vLightDir.y,m_vLightDir.z); m_pProgramMeshFTB->Enable(); m_pProgramMeshFTB->Set("vLightAmbientM",aM.x,aM.y,aM.z); m_pProgramMeshFTB->Set("vLightDiffuseM",dM.x,dM.y,dM.z); m_pProgramMeshFTB->Set("vLightSpecularM",sM.x,sM.y,sM.z); m_pProgramMeshFTB->Set("vLightDir",m_vLightDir.x,m_vLightDir.y,m_vLightDir.z); m_pProgramIso->Enable(); m_pProgramIso->Set("vDomainScale",scale.x,scale.y,scale.z); m_pProgramColor->Enable(); m_pProgramColor->Set("vDomainScale",scale.x,scale.y,scale.z); } bool GLRenderer::IsVolumeResident(const BrickKey& key) const { // normally we use "real" 3D textures so implement this method // for 3D textures, it is overridden by 2D texture children return m_pMasterController->MemMan()->IsResident(m_pDataset, key, m_bUseOnlyPowerOfTwo, m_bDownSampleTo8Bits, m_bDisableBorder, false, m_pContext->GetShareGroupID() ); } GLint GLRenderer::ComputeGLFilter() const { GLint iFilter = GL_LINEAR; switch (m_eInterpolant) { case Linear : iFilter = GL_LINEAR; break; case NearestNeighbor : iFilter = GL_NEAREST; break; } return iFilter; } bool GLRenderer::CropDataset(const std::string& strTempDir, bool bKeepOldData) { ExtendedPlane p = GetClipPlane(); FLOATMATRIX4 trans = GetFirst3DRegion()->rotation * GetFirst3DRegion()->translation; // get rid of the viewing transformation in the plane p.Transform(trans.inverse(),false); if (!m_pDataset->Crop(p.Plane(),strTempDir,bKeepOldData, m_pMasterController->IOMan()->GetUseMedianFilter(), m_pMasterController->IOMan()->GetClampToEdge())) return false; FileBackedDataset* fbd = dynamic_cast(m_pDataset); if (NULL != fbd) { LoadFile(fbd->Filename()); } return true; } void GLRenderer::MaxMinBoxToVector(const FLOATVECTOR3& vMinPoint, const FLOATVECTOR3& vMaxPoint, std::vector& posData) const { // BACK posData.push_back(FLOATVECTOR3(vMaxPoint.x, vMinPoint.y, vMinPoint.z)); posData.push_back(FLOATVECTOR3(vMinPoint.x, vMinPoint.y, vMinPoint.z)); posData.push_back(FLOATVECTOR3(vMinPoint.x, vMaxPoint.y, vMinPoint.z)); posData.push_back(FLOATVECTOR3(vMinPoint.x, vMaxPoint.y, vMinPoint.z)); posData.push_back(FLOATVECTOR3(vMaxPoint.x, vMaxPoint.y, vMinPoint.z)); posData.push_back(FLOATVECTOR3(vMaxPoint.x, vMinPoint.y, vMinPoint.z)); // FRONT posData.push_back(FLOATVECTOR3(vMaxPoint.x, vMaxPoint.y, vMaxPoint.z)); posData.push_back(FLOATVECTOR3(vMinPoint.x, vMaxPoint.y, vMaxPoint.z)); posData.push_back(FLOATVECTOR3(vMinPoint.x, vMinPoint.y, vMaxPoint.z)); posData.push_back(FLOATVECTOR3(vMinPoint.x, vMinPoint.y, vMaxPoint.z)); posData.push_back(FLOATVECTOR3(vMaxPoint.x, vMinPoint.y, vMaxPoint.z)); posData.push_back(FLOATVECTOR3(vMaxPoint.x, vMaxPoint.y, vMaxPoint.z)); // LEFT posData.push_back(FLOATVECTOR3(vMinPoint.x, vMaxPoint.y, vMinPoint.z)); posData.push_back(FLOATVECTOR3(vMinPoint.x, vMinPoint.y, vMinPoint.z)); posData.push_back(FLOATVECTOR3(vMinPoint.x, vMinPoint.y, vMaxPoint.z)); posData.push_back(FLOATVECTOR3(vMinPoint.x, vMinPoint.y, vMaxPoint.z)); posData.push_back(FLOATVECTOR3(vMinPoint.x, vMaxPoint.y, vMaxPoint.z)); posData.push_back(FLOATVECTOR3(vMinPoint.x, vMaxPoint.y, vMinPoint.z)); // RIGHT posData.push_back(FLOATVECTOR3(vMaxPoint.x, vMaxPoint.y, vMaxPoint.z)); posData.push_back(FLOATVECTOR3(vMaxPoint.x, vMinPoint.y, vMaxPoint.z)); posData.push_back(FLOATVECTOR3(vMaxPoint.x, vMinPoint.y, vMinPoint.z)); posData.push_back(FLOATVECTOR3(vMaxPoint.x, vMinPoint.y, vMinPoint.z)); posData.push_back(FLOATVECTOR3(vMaxPoint.x, vMaxPoint.y, vMinPoint.z)); posData.push_back(FLOATVECTOR3(vMaxPoint.x, vMaxPoint.y, vMaxPoint.z)); // BOTTOM posData.push_back(FLOATVECTOR3(vMaxPoint.x, vMinPoint.y, vMaxPoint.z)); posData.push_back(FLOATVECTOR3(vMinPoint.x, vMinPoint.y, vMaxPoint.z)); posData.push_back(FLOATVECTOR3(vMinPoint.x, vMinPoint.y, vMinPoint.z)); posData.push_back(FLOATVECTOR3(vMinPoint.x, vMinPoint.y, vMinPoint.z)); posData.push_back(FLOATVECTOR3(vMaxPoint.x, vMinPoint.y, vMinPoint.z)); posData.push_back(FLOATVECTOR3(vMaxPoint.x, vMinPoint.y, vMaxPoint.z)); // TOP posData.push_back(FLOATVECTOR3(vMaxPoint.x, vMaxPoint.y, vMinPoint.z)); posData.push_back(FLOATVECTOR3(vMinPoint.x, vMaxPoint.y, vMinPoint.z)); posData.push_back(FLOATVECTOR3(vMinPoint.x, vMaxPoint.y, vMaxPoint.z)); posData.push_back(FLOATVECTOR3(vMinPoint.x, vMaxPoint.y, vMaxPoint.z)); posData.push_back(FLOATVECTOR3(vMaxPoint.x, vMaxPoint.y, vMaxPoint.z)); posData.push_back(FLOATVECTOR3(vMaxPoint.x, vMaxPoint.y, vMinPoint.z)); } ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLVolume2DTex.h0000644000175000017500000000575712320456500021165 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLVolume2DTex.h \author Jens Krueger DFKI Saarbruecken & SCI Institute University of Utah \date May 2010 */ #pragma once #ifndef GLVOLUME2DTEX_H #define GLVOLUME2DTEX_H #include "GLVolume.h" #include namespace tuvok { class GLTexture2D; /// Emulates a 3D volume using stacks of 3D textures. class GLVolume2DTex : public GLVolume { public: GLVolume2DTex(uint32_t iSizeX, uint32_t iSizeY, uint32_t iSizeZ, GLint internalformat, GLenum format, GLenum type, const GLvoid *voxels = 0, GLint iMagFilter = GL_NEAREST, GLint iMinFilter = GL_NEAREST, GLint wrapX = GL_CLAMP_TO_EDGE, GLint wrapY = GL_CLAMP_TO_EDGE, GLint wrapZ = GL_CLAMP_TO_EDGE); GLVolume2DTex(); virtual ~GLVolume2DTex(); virtual void Bind(uint32_t iUnit, int depth, int iStack) const; virtual void SetData(const void *voxels); virtual uint64_t GetCPUSize() const; virtual uint64_t GetGPUSize() const; uint32_t GetSizeX() {return m_iSizeX;} uint32_t GetSizeY() {return m_iSizeY;} uint32_t GetSizeZ() {return m_iSizeZ;} virtual void SetFilter(GLint iMagFilter = GL_NEAREST, GLint iMinFilter = GL_NEAREST); private: std::vector< std::vector> m_pTextures; uint32_t m_iSizeX; uint32_t m_iSizeY; uint32_t m_iSizeZ; GLint m_internalformat; GLenum m_format; GLenum m_type; GLint m_wrapX; GLint m_wrapY; GLint m_wrapZ; uint64_t m_iGPUSize; uint64_t m_iCPUSize; void CreateGLResources(); void FreeGLResources(); }; } #endif // GLVOLUME2DTEX_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLError.h0000644000175000017500000000512112320456500020121 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLError.h \author Tom Fogal SCI Institute University of Utah */ #pragma once #ifndef TUVOK_GL_ERROR_H #define TUVOK_GL_ERROR_H #include "TuvokException.h" /// Defines OpenGL errors that we'll throw, and GL error detection code. namespace tuvok { /// Thrown when allocating an OpenGL resource fails due to out of memory /// condition. class OutOfMemory : virtual public tuvok::Exception { public: explicit OutOfMemory(const char* e, const char *where=NULL, size_t ln=0) : tuvok::Exception(e, where, ln) { } virtual ~OutOfMemory() throw() { } }; /// Intended to be thrown, e.g.: /// throw OUT_OF_MEM("OpenGL 3d texture"); /// It automatically sets location information. #define OUT_OF_MEMORY(s) tuvok::OutOfMemory(s, __FILE__, __LINE__) /// Generic OpenGL error. class GLError : virtual public tuvok::Exception { public: explicit GLError(int glerr, const char *where=NULL, size_t ln=0) : tuvok::Exception("OpenGL error", where, ln), glerrno(glerr) {} virtual ~GLError() throw() { } int error() const { return this->glerrno; } private: int glerrno; }; } /// Intended to be thrown, e.g.: /// throw GL_ERROR(42); /// It automatically sets location information. #define GL_ERROR(e) tuvok::GLError(e, __FILE__, __LINE__) #endif // TUVOK_GL_ERROR_H ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLVolumePool.h0000644000175000017500000002043712320456500021140 0ustar mathieumathieu#pragma once #ifndef GLVOLUMEPOOL_H #define GLVOLUMEPOOL_H #include "StdTuvokDefines.h" #include #include "Basics/Timer.h" #include "GLInclude.h" #include "GLTexture2D.h" #include "GLTexture3D.h" //#define GLVOLUMEPOOL_PROFILE // define to measure some timings #ifdef GLVOLUMEPOOL_PROFILE #include "Basics/AvgMinMaxTracker.h" #endif namespace tuvok { class GLSLProgram; class LinearIndexDataset; class AsyncVisibilityUpdater; class VisibilityState; class PoolSlotData { public: PoolSlotData(const UINTVECTOR3& vPositionInPool) : m_iBrickID(-1), m_iTimeOfCreation(0), m_iOrigTimeOfCreation(0), m_vPositionInPool(vPositionInPool) {} bool WasEverUsed() const { return m_iBrickID != -1; } bool ContainsVisibleBrick() const { return m_iTimeOfCreation > 1; } void FlagEmpty() { m_iOrigTimeOfCreation = m_iTimeOfCreation; m_iTimeOfCreation = 1; } void Restore() { m_iTimeOfCreation = m_iOrigTimeOfCreation; } const UINTVECTOR3& PositionInPool() const {return m_vPositionInPool;} int32_t m_iBrickID; uint64_t m_iTimeOfCreation; uint64_t m_iOrigTimeOfCreation; private: UINTVECTOR3 m_vPositionInPool; PoolSlotData(); }; struct BrickElemInfo { BrickElemInfo(const UINTVECTOR4& vBrickID, const UINTVECTOR3& vVoxelSize) : m_vBrickID(vBrickID), m_vVoxelSize(vVoxelSize) {} UINTVECTOR4 m_vBrickID; UINTVECTOR3 m_vVoxelSize; }; class GLVolumePool : public GLObject { public: enum DebugMode { DM_NONE = 0, // no debugging DM_BUSY, // prevent the async worker from doing anything useful forcing the situation when the async updater has not yet updated the metadata but should DM_SYNC, // disables the async worker and forces synchronous metadata updates all the time DM_NOEMPTYSPACELEAPING // prevent all visibility computations and thus never ever skip/leap empty space }; /// @throws tuvok::Exception on init error GLVolumePool(const UINTVECTOR3& poolSize, LinearIndexDataset* pDataset, GLenum filter, bool bUseGLCore=true, DebugMode dm=DM_NONE); virtual ~GLVolumePool(); // signals if meta texture is up-to-date including child emptiness for // the whole hierarchy bool IsVisibilityUpdated() const { return m_bVisibilityUpdated; } // @return (totalProcessedBrickCount, emptyBrickCount, childEmptyBrickCount, emptyLeafBrickCount) UINTVECTOR4 RecomputeVisibility(const VisibilityState& visibility, size_t iTimestep, bool bForceSynchronousUpdate = false); // returns number of bricks paged in that must not be equal to given // number of brick IDs especially if async updater is busy we'll get // requests for empty bricks too that won't be paged in /// @param brickDebug write out md5sums of bricks as we read them. uint32_t UploadBricks(const std::vector& vBrickIDs, bool brickDebug); void UploadFirstBrick(const BrickKey& bkey); // returns false if we need to render first before we can continue to upload further bricks bool UploadBrick(const BrickElemInfo& metaData, void* pData); // TODO: we could use the 1D-index here too void UploadFirstBrick(const UINTVECTOR3& m_vVoxelSize, void* pData); void UploadMetadataTexture(); void UploadMetadataTexel(uint32_t iBrickID); bool IsBrickResident(const UINTVECTOR4& vBrickID) const; void Enable(float fLoDFactor, const FLOATVECTOR3& vExtend, const FLOATVECTOR3& vAspect, GLSLProgram* pShaderProgram) const; void Disable() const; // resets the pool and metadata and preserves the single largest brick void PH_Reset(const VisibilityState& visibility, size_t iTimestep); enum MissingBrickStrategy { OnlyNeeded, RequestAll, SkipOneLevel, SkipTwoLevels }; std::string GetShaderFragment(uint32_t iMetaTextureUnit, uint32_t iDataTextureUnit, enum MissingBrickStrategy, const std::string& = ""); void SetFilterMode(GLenum filter); virtual uint64_t GetCPUSize() const; virtual uint64_t GetGPUSize() const; uint32_t GetLoDCount() const; uint32_t GetIntegerBrickID(const UINTVECTOR4& vBrickID) const; // x, y , z, lod (w) to iBrickID UINTVECTOR4 GetVectorBrickID(uint32_t iBrickID) const; UINTVECTOR3 const& GetPoolCapacity() const; UINTVECTOR3 const& GetVolumeSize() const; UINTVECTOR3 const& GetMaxInnerBrickSize() const; struct MinMax { double min; double max; }; uint64_t GetMaxUsedBrickBytes() const { return m_iMaxUsedBrickBytes; } protected: GLTexture3D* m_pPoolMetadataTexture; GLTexture3D* m_pPoolDataTexture; UINTVECTOR3 m_vPoolCapacity; UINTVECTOR3 m_poolSize; UINTVECTOR3 m_maxInnerBrickSize; UINTVECTOR3 m_maxTotalBrickSize; UINTVECTOR3 m_volumeSize; uint32_t m_iLoDCount; GLenum m_filter; GLint m_internalformat; GLenum m_format; GLenum m_type; uint64_t m_iTimeOfCreation; uint32_t m_iMetaTextureUnit; uint32_t m_iDataTextureUnit; bool m_bUseGLCore; size_t m_iInsertPos; uint32_t m_iTotalBrickCount; LinearIndexDataset* m_pDataset; friend class AsyncVisibilityUpdater; AsyncVisibilityUpdater* m_pUpdater; bool m_bVisibilityUpdated; #ifdef GLVOLUMEPOOL_PROFILE Timer m_Timer; AvgMinMaxTracker m_TimesRecomputeVisibilityForBrickPool; AvgMinMaxTracker m_TimesMetaTextureUpload; AvgMinMaxTracker m_TimesRecomputeVisibility; #endif std::vector m_vBrickMetadata; // ref by iBrickID, size of total brick count + some unused 2d texture padding std::vector m_vPoolSlotData; // size of available pool slots std::vector m_vLoDOffsetTable; // size of LoDs, stores index sums, level 0 is finest size_t m_iMinMaxScalarTimestep; // current timestep of scalar acceleration structure below size_t m_iMinMaxGradientTimestep; // current timestep of gradient acceleration structure below std::vector m_vMinMaxScalar; // accelerates access to minmax scalar information, gets constructed in c'tor std::vector m_vMinMaxGradient; // accelerates access to minmax gradient information, gets constructed on first access to safe some mem double m_BrickIOTime; uint64_t m_BrickIOBytes; // time savers, derived from Dataset::GetMaxUsedBrickSize() uint64_t m_iMaxUsedBrickVoxelCount; uint64_t m_iMaxUsedBrickBytes; void CreateGLResources(); void FreeGLResources(); void PrepareForPaging(); void UploadBrick(uint32_t iBrickID, const UINTVECTOR3& vVoxelSize, void* pData, size_t iInsertPos, uint64_t iTimeOfCreation); DebugMode const m_eDebugMode; }; } #endif // GLVOLUMEPOOL_H /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLFBOTex.cpp0000644000175000017500000003643112320456500020462 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GLFBOTex.cpp \author Jens Krueger SCI Institute University of Utah Jens Schneider tum.3D, Muenchen \date August 2008 */ #include "GLFBOTex.h" #include "GLCommon.h" #include #ifdef WIN32 #ifndef DEBUG #pragma warning( disable : 4189 ) // disable unused var warning #endif #endif using namespace tuvok; GLuint GLFBOTex::m_hFBO = 0; int GLFBOTex::m_iCount = 0; bool GLFBOTex::m_bInitialized = true; /** * Constructor: on first instantiation, generate an FBO. * In any case a new dummy texture according to the parameters is generated. */ GLFBOTex::GLFBOTex(MasterController* pMasterController, GLenum minfilter, GLenum magfilter, GLenum wrapmode, GLsizei width, GLsizei height, GLenum intformat, GLenum format, GLenum type, bool bHaveDepth, int iNumBuffers) : m_pMasterController(pMasterController), m_iSizeX(width), m_iSizeY(height), m_hTexture(new GLuint[iNumBuffers]), m_LastTexUnit(NULL), m_LastDepthTextUnit(0), m_iNumBuffers(iNumBuffers), m_LastAttachment(NULL), m_intformat(intformat), m_format(format), m_type(type) { if (width<1) width=1; if (height<1) height=1; if (!m_bInitialized) { if (GLEW_OK!=glewInit()) { T_ERROR("failed to initialize GLEW!"); return; } if (!glewGetExtension("GL_EXT_framebuffer_object")) { T_ERROR("GL_EXT_framebuffer_object not supported!"); return; } m_bInitialized=true; } assert(iNumBuffers>0); assert(iNumBuffers<5); m_LastTexUnit=new GLenum[iNumBuffers]; m_LastAttachment=new GLenum[iNumBuffers]; for (int i=0; i(glerr)); GL(glDeleteFramebuffersEXT(1,&m_hFBO)); m_hFBO=0; return; } } while(glGetError() != GL_NO_ERROR) { ; } // clear error state. if (!initTextures(minfilter,magfilter,wrapmode,width,height,intformat, format, type)) { T_ERROR("GL Error during texture creation!"); GL(glDeleteTextures(m_iNumBuffers,m_hTexture)); delete[] m_hTexture; m_hTexture=NULL; return; } if (bHaveDepth) { #ifdef GLFBOTEX_DEPTH_RENDERBUFFER GL(glGenRenderbuffersEXT(1,&m_hDepthBuffer)); GL(glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, width,height)); #else GL(glGenTextures(1,&m_hDepthBuffer)); GL(glBindTexture(GL_TEXTURE_2D,m_hDepthBuffer)); GL(glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE)); GL(glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE)); GL(glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST)); GL(glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST)); GL(glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, width, height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL)); #endif } else m_hDepthBuffer=0; ++m_iCount; } /** * Destructor: Delete texture object. If no more instances of * GLFBOTex are around, the FBO is deleted as well. */ GLFBOTex::~GLFBOTex(void) { if (m_hTexture) { GL(glDeleteTextures(m_iNumBuffers,m_hTexture)); delete[] m_hTexture; m_hTexture=NULL; } delete[] m_LastTexUnit; m_LastTexUnit=NULL; delete[] m_LastAttachment; m_LastAttachment=NULL; #ifdef GLFBOTEX_DEPTH_RENDERBUFFER if (m_hDepthBuffer) GL(glDeleteRenderbuffersEXT(1,&m_hDepthBuffer)); #else if (m_hDepthBuffer) GL(glDeleteTextures(1,&m_hDepthBuffer)); #endif m_hDepthBuffer=0; --m_iCount; if (m_iCount==0) { if (m_pMasterController) m_pMasterController->DebugOut()->Message(_func_, "FBO released via " "destructor call."); GL(glDeleteFramebuffersEXT(1,&m_hFBO)); m_hFBO=0; } } /** * Build a dummy texture according to the parameters. */ bool GLFBOTex::initTextures(GLenum minfilter, GLenum magfilter, GLenum wrapmode, GLsizei width, GLsizei height, GLenum intformat, GLenum format, GLenum type) { MESSAGE("Initializing %u 2D texture(s) of size %ux%u (MinFilter=%#x " "MinFilter=%#x WrapMode=%#x, IntFormat=%#x)", static_cast(m_iNumBuffers), static_cast(width), static_cast(height), static_cast(minfilter), static_cast(magfilter), static_cast(wrapmode), static_cast(intformat)); //glDeleteTextures(m_iNumBufers,m_hTexture); GL(glGenTextures(m_iNumBuffers,m_hTexture)); for (int i=0; i0) width=1; if (width>0 && height==0) height=1; ++level; } while (width>=1 && height>=1); break; default: GL_RET(glTexImage2D(GL_TEXTURE_2D, 0, intformat, width, height, 0, format, type, NULL)); break; } } return true; } /** * Build a new FBO. */ void GLFBOTex::initFBO(void) { MESSAGE("Initializing FBO..."); // Don't wrap this in a `GL()'! The caller is expected to query the GL // error state to see if this worked. glGenFramebuffersEXT(1, &m_hFBO); } /** * Check the FBO for consistency. */ bool GLFBOTex::CheckFBO(const char* method) { GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); switch(status) { case GL_FRAMEBUFFER_COMPLETE_EXT: return true; case GL_FRAMEBUFFER_UNSUPPORTED_EXT: T_ERROR("%s() - Unsupported Format!",method); return false; case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT: T_ERROR("%s() - Incomplete attachment",method); return false; case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT: T_ERROR("%s() - Incomplete missing attachment",method); return false; case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT: T_ERROR("%s() - Incomplete dimensions",method); return false; case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT: T_ERROR("%s() - Incomplete formats",method); return false; case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT: T_ERROR("%s() - Incomplete draw buffer",method); return false; case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT: T_ERROR("%s() - Incomplete read buffer",method); return false; default: return false; } } void GLFBOTex::SetViewport() { glViewport(0, 0, m_iSizeX, m_iSizeY); } /** * Lock texture for writing. Texture may not be bound any more! */ void GLFBOTex::Write(unsigned int iTargetBuffer, int iBuffer, bool bCheckBuffer) { GLenum target = GL_COLOR_ATTACHMENT0 + iTargetBuffer; if (!m_hFBO) { T_ERROR("FBO not initialized!"); return; } GL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,m_hFBO)); assert(iBuffer>=0); assert(iBuffer=0); assert(iBuffer=0); assert(iBuffer=0); assert(iBuffer #include #include #include #include #include "GLSLProgram.h" #include "Controller/Controller.h" #include "Renderer/ShaderDescriptor.h" #include "Renderer/GL/GLError.h" #include "Renderer/GL/GLTexture.h" using namespace tuvok; using namespace std; bool GLSLProgram::m_bGLChecked=false; ///< use pre GL 2.0 syntax bool GLSLProgram::m_bGLUseARB=false; ///< use pre GL 2.0 syntax // Abstract out the basic ARB/OGL 2.0 shader API differences. Does not attempt // to unify the APIs; some calls actually do differ, and error checking changed // when standardizing, Clients should check gl::arb and handle these // differences manually. namespace gl { static bool arb = false; GLuint CreateProgram(); GLuint CreateShader(GLenum type); void ShaderSource(GLuint, GLsizei, const GLchar**, const GLint*); void CompileShader(GLuint); void AttachShader(GLuint, GLuint); void DetachShader(GLuint, GLuint); GLboolean IsShader(GLuint); void UseProgram(GLuint); void DeleteShader(GLuint); void DeleteProgram(GLuint); void GetAttachedShaders(GLuint, GLsizei, GLsizei*, GLuint*); GLint GetUniformLocation(GLuint, const GLchar*); GLuint CreateProgram() { if(arb) { return glCreateProgramObjectARB(); } else { return glCreateProgram(); } } GLuint CreateShader(GLenum type) { assert(type == GL_VERTEX_SHADER || type == GL_FRAGMENT_SHADER); if(arb) { return glCreateShaderObjectARB(type); } else { return glCreateShader(type); } } void ShaderSource(GLuint shader, GLsizei count, const GLchar** str, const GLint*length) { if(arb) { glShaderSourceARB(shader, count, str, length); } else { glShaderSource(shader, count, str, length); } } void CompileShader(GLuint shader) { if(arb) { glCompileShaderARB(shader); } else { glCompileShader(shader); } } void AttachShader(GLuint program, GLuint shader) { if(arb) { glAttachObjectARB(program, shader); } else { glAttachShader(program, shader); } } void DetachShader(GLuint program, GLuint shader) { if(arb) { glDetachObjectARB(program, shader); } else { glDetachShader(program, shader); } } // There's no function of this type in the ARB whatsoever. So we just hack // it for the ARB case. GLboolean IsShader(GLuint shader) { if(arb) { return shader != 0; } else { return glIsShader(shader); } } void LinkProgram(GLuint program) { if(arb) { glLinkProgramARB(program); } else { glLinkProgram(program); } } void UseProgram(GLuint shader) { if(arb) { glUseProgramObjectARB(shader); } else { glUseProgram(shader); } } void DeleteShader(GLuint shader) { if(arb) { glDeleteObjectARB(shader); } else { glDeleteShader(shader); } } void DeleteProgram(GLuint p) { if(arb) { glDeleteObjectARB(p); } else { glDeleteProgram(p); } } void GetAttachedShaders(GLuint program, GLsizei mx, GLsizei* count, GLuint* objs) { // workaround for broken GL implementations // some implementations crash if count is a NULL pointer // althougth this is perfectly valid according to the spec GLsizei dummyCount; if (count == NULL) count = &dummyCount; if(arb) { glGetAttachedObjectsARB(static_cast(program), mx, count, reinterpret_cast(objs)); } else { glGetAttachedShaders(program, mx, count, objs); } } GLint GetUniformLocation(GLuint program, const GLchar* name) { if(arb) { return glGetUniformLocationARB(program, name); } else { return glGetUniformLocation(program, name); } } } /** * Default Constructor. * Initializes glew on first instantiation. * \param void * \return void * \author Jens Schneider * \date Aug.2004 * \see Initialize() */ GLSLProgram::GLSLProgram(MasterController* pMasterController) : m_pMasterController(pMasterController), m_bInitialized(false), m_bEnabled(false), m_hProgram(0) { if(!Initialize()) { T_ERROR("GL initialization failed!"); } } /// detaches all shaders attached to the given program ID static void detach_shaders(GLuint program) { GLenum err; // clear all other errors in the stack do { err = glGetError(); if(err != GL_NO_ERROR) { WARNING("Previous GL error: %#x", static_cast(err)); } } while(err != GL_NO_ERROR); // how many shaders are attached? GLint num_shaders=0; if(gl::arb) { glGetObjectParameterivARB(program, GL_OBJECT_ATTACHED_OBJECTS_ARB, &num_shaders); } else { glGetProgramiv(program, GL_ATTACHED_SHADERS, &num_shaders); } if((err = glGetError()) != GL_NO_ERROR) { WARNING("Error obtaining the number of shaders attached to program %u: %x", static_cast(program), static_cast(err)); num_shaders=0; } if(num_shaders > 0) { // get the shader IDs std::vector shaders(num_shaders); gl::GetAttachedShaders(program, num_shaders, NULL, &shaders[0]); if((err = glGetError()) != GL_NO_ERROR) { WARNING("Error obtaining the shader IDs attached to program %u: %#x", static_cast(program), static_cast(err)); } // MESSAGE("%d shaders attached to %u", static_cast(num_shaders), // static_cast(program)); // detach each shader for(std::vector::const_iterator sh = shaders.begin(); sh != shaders.end(); ++sh) { if(gl::IsShader(*sh)) { gl::DetachShader(program, *sh); if((err = glGetError()) != GL_NO_ERROR) { WARNING("Error detaching shader %u from %u: %#x", static_cast(*sh), static_cast(program), static_cast(err)); } } } } } GLSLProgram::~GLSLProgram() { if (IsValid() && m_hProgram != 0) { detach_shaders(m_hProgram); gl::DeleteProgram(m_hProgram); } m_hProgram=0; } /** * Returns the handle to this shader. * \return a const handle. If this is an invalid shader, the handle will be 0. * \author Jens Schneider * \date Feb.2005 */ GLSLProgram::operator GLuint(void) const { return m_hProgram; } /** * Initializes the class. * If GLSLProgram is initialized for the first time, initialize GLEW * \param void * \return bool * \author Jens Schneider * \date Aug.2004 * \see m_bGlewInitialized */ bool GLSLProgram::Initialize(void) { if (!m_bGLChecked) { MESSAGE("Initializing OpenGL on a: %s", (const char*)glGetString(GL_VENDOR)); if (atof((const char*)glGetString(GL_VERSION)) >= 2.0) { MESSAGE("OpenGL 2.0 supported (actual version: \"%s\")", glGetString(GL_VERSION)); gl::arb = m_bGLUseARB = false; } else { // check for ARB extensions if (glewGetExtension("GL_ARB_shader_objects")) MESSAGE("ARB_shader_objects supported."); else { T_ERROR("Neither OpenGL 2.0 nor ARB_shader_objects not supported!"); return false; } if (glewGetExtension("GL_ARB_shading_language_100")) MESSAGE("ARB_shading_language_100 supported."); else { MESSAGE("Neither OpenGL 2.0 nor ARB_shading_language_100 not supported!"); return false; } glUniform1i = glUniform1iARB; glUniform2i = glUniform2iARB; glUniform1iv = glUniform1ivARB; glUniform2iv = glUniform2ivARB; glUniform3i = glUniform3iARB; glUniform4i = glUniform4iARB; glUniform3iv = glUniform3ivARB; glUniform4iv = glUniform4ivARB; glUniform1f = glUniform1fARB; glUniform2f = glUniform2fARB; glUniform1fv = glUniform1fvARB; glUniform2fv = glUniform2fvARB; glUniform3f = glUniform3fARB; glUniform4f = glUniform4fARB; glUniform3fv = glUniform3fvARB; glUniform4fv = glUniform4fvARB; glUniformMatrix2fv = glUniformMatrix2fvARB; glUniformMatrix3fv = glUniformMatrix3fvARB; glUniformMatrix4fv = glUniformMatrix4fvARB; MESSAGE("Using ARB functions instead of builtin GL 2.0."); gl::arb = m_bGLUseARB = true; } m_bGLChecked = true; } return true; } static bool attachshader(GLuint program, const std::string& source, const std::string& filename, GLenum shtype) { if(source.empty()) { T_ERROR("Empty shader (type %d) '%s'!", static_cast(shtype), filename.c_str()); return false; } GLuint sh = gl::CreateShader(shtype); if(sh == 0) { T_ERROR("Error (%d) creating shader (type %d) from '%s'", static_cast(glGetError()), static_cast(shtype), filename.c_str()); return false; } const GLchar* src[1] = { source.c_str() }; const GLint lengths[1] = { static_cast(source.length()) }; gl::ShaderSource(sh, 1, src, lengths); if(glGetError() != GL_NO_ERROR) { T_ERROR("Error uploading shader (type %d) source from '%s'", static_cast(shtype), filename.c_str()); gl::DeleteShader(sh); return false; } gl::CompileShader(sh); // did it compile successfully? { GLint success[1] = { GL_TRUE }; if(!gl::arb) { glGetShaderiv(sh, GL_COMPILE_STATUS, success); } else { glGetObjectParameterivARB(sh, GL_OBJECT_COMPILE_STATUS_ARB, success); } { GLenum glerr = glGetError(); if(glerr != GL_NO_ERROR) { WARNING("GL error looking up compilation status: %#x", static_cast(glerr)); success[0] = GL_FALSE; } } if(success[0] == GL_FALSE) { std::ostringstream errmsg; errmsg << "Compilation error in '" << filename << "': "; // retrieve the error message if(!gl::arb) { // ARB calls are different, not used much, we don't care. GLint log_length=0; glGetShaderiv(sh, GL_INFO_LOG_LENGTH, &log_length); // cap err length, for crazy drivers. log_length = std::min(static_cast(4096), log_length); std::vector log(log_length); glGetShaderInfoLog(sh, static_cast(log.size()), NULL, &log[0]); errmsg << &log[0]; } gl::DeleteShader(sh); T_ERROR("%s", errmsg.str().c_str()); return false; } } // MESSAGE("Adding shader '%s' to program %u", filename.c_str(), // static_cast(program)); gl::AttachShader(program, sh); if(glGetError() != GL_NO_ERROR) { T_ERROR("Error attaching shader %u to program %u", static_cast(sh), static_cast(program)); gl::DeleteShader(sh); return false; } // shaders are refcounted; it won't actually be deleted until it is // detached from the program object. gl::DeleteShader(sh); return true; } void GLSLProgram::Load(const ShaderDescriptor& sd) { CheckGLError(); // clear previous error status. // create the shader program this->m_hProgram = gl::CreateProgram(); if(this->m_hProgram == 0) { T_ERROR("Error creating shader program."); CheckGLError(_func_); gl::DeleteProgram(this->m_hProgram); this->m_hProgram = 0; return; } // create a shader for each vertex shader, and attach it to the main program. for(auto vsh = sd.begin_vertex(); vsh != sd.end_vertex(); ++vsh) { if(!attachshader(this->m_hProgram, (*vsh).first, (*vsh).second, GL_VERTEX_SHADER)) { T_ERROR("Attaching vertex shader '%s' failed.", (*vsh).second.c_str()); detach_shaders(this->m_hProgram); gl::DeleteProgram(this->m_hProgram); this->m_hProgram = 0; return; } } // create a shader for each fragment shader, and attach it to the main // program. for(auto fsh = sd.begin_fragment(); fsh != sd.end_fragment(); ++fsh) { if(!attachshader(this->m_hProgram, (*fsh).first, (*fsh).second, GL_FRAGMENT_SHADER)) { T_ERROR("Attaching fragment shader '%s' failed.", (*fsh).second.c_str()); detach_shaders(this->m_hProgram); gl::DeleteProgram(this->m_hProgram); return; } } if(glBindFragDataLocation) { for (auto binding = sd.fragmentDataBindings.begin(); binding < sd.fragmentDataBindings.end(); binding++) { GL(glBindFragDataLocation(this->m_hProgram, binding->first, binding->second.c_str())); } } else { T_ERROR("glBindFragDataLocation not supported on this GL version"); } gl::LinkProgram(this->m_hProgram); { // figure out if the linking was successful. GLint linked = GL_TRUE; if(gl::arb) { GL(glGetObjectParameterivARB(this->m_hProgram, GL_OBJECT_LINK_STATUS_ARB, &linked)); } else { GL(glGetProgramiv(this->m_hProgram, GL_LINK_STATUS, &linked)); } if(linked != GL_TRUE) { GLchar linkerr[2048]; linkerr[2047]=0; GLsizei len=256; glGetProgramInfoLog(this->m_hProgram, 2047, &len, linkerr); linkerr[len] = 0; T_ERROR("Program could not link (%d): '%s'", len, linkerr); detach_shaders(this->m_hProgram); gl::DeleteProgram(this->m_hProgram); this->m_hProgram = 0; return; } } m_bInitialized = true; } /** * Gets the InfoLogARB of hObject and messages it. * \param hObject - a handle to the object. * \param bProgram - if true, hObject is a program object, otherwise it is a shader object. * \return true: InfoLogARB non-empty and GLSLPROGRAM_STRICT defined OR only warning, false otherwise * \author Jens Schneider * \date Aug.2004 */ bool GLSLProgram::WriteInfoLog(const char* shaderdesc, GLuint hObject, bool bProgram) { // Check for errors GLint iLength=0; if (bProgram) glGetProgramiv(hObject,GL_INFO_LOG_LENGTH,&iLength); else glGetShaderiv(hObject,GL_INFO_LOG_LENGTH,&iLength); #ifdef _DEBUG GLenum err = glGetError(); assert(GL_NO_ERROR == err); #endif GLboolean bAtMostWarnings = GL_TRUE; if (iLength > 1) { char *pcLogInfo=new char[iLength]; if (bProgram) { glGetProgramInfoLog(hObject,iLength,&iLength,pcLogInfo); bAtMostWarnings = glIsProgram(hObject); } else { glGetShaderInfoLog(hObject,iLength,&iLength,pcLogInfo); bAtMostWarnings = glIsShader(hObject); } if (bAtMostWarnings) { WARNING("%s", shaderdesc); WARNING("%s", pcLogInfo); delete[] pcLogInfo; return false; } else { T_ERROR("%s", shaderdesc); T_ERROR("%s", pcLogInfo); delete[] pcLogInfo; #ifdef GLSLPROGRAM_STRICT return true; #endif } #ifdef _DEBUG } else { MESSAGE("No info log available."); #endif } return !bool(bAtMostWarnings==GL_TRUE); // error occured? } /** * Loads a vertex or fragment shader. * Loads either a vertex or fragment shader and tries to compile it. * \param ShaderDesc - name of the file containing the shader * \param Type - either GL_VERTEX_SHADER or GL_FRAGMENT_SHADER * \param src - defines the source of the shader. Can be either GLSLPROGRAM_DISK or GLSLPROGRAM_STRING. * \return a handle to the compiled shader if successful, 0 otherwise * \warning uses glGetError() * \author Jens Schneider * \date Mar.2005 * \see GLSLPROGRAM_SOURCE */ GLuint GLSLProgram::LoadShader(const char *ShaderDesc, GLenum Type, GLSLPROGRAM_SOURCE src) { // assert right type assert(Type==GL_VERTEX_SHADER || Type==GL_FRAGMENT_SHADER); CheckGLError(); unsigned long lFileSize; char *pcShader; FILE *fptr; // Load and compile vertex shader switch(src) { case GLSLPROGRAM_DISK: fptr=fopen(ShaderDesc,"rb"); if (!fptr) { T_ERROR("File %s not found!",ShaderDesc); return 0; } if (fseek(fptr,0,SEEK_END)) { fclose(fptr); T_ERROR("Error reading file %s.",ShaderDesc); return 0; } lFileSize=ftell(fptr)/sizeof(char); fseek(fptr,0,SEEK_SET); pcShader=new char[lFileSize+1]; pcShader[lFileSize]='\0'; if (lFileSize!=fread(pcShader,sizeof(char),lFileSize,fptr)) { fclose(fptr); delete[] pcShader; T_ERROR("Error reading file %s.",ShaderDesc); return 0; } fclose(fptr); break; case GLSLPROGRAM_STRING: pcShader=(char*)ShaderDesc; lFileSize=long(strlen(pcShader)); break; default: T_ERROR("Unknown source"); return 0; break; } GLuint hShader = 0; bool bError=false; if (m_bGLUseARB) { hShader = glCreateShaderObjectARB(Type); glShaderSourceARB(hShader,1,(const GLchar**)&pcShader,NULL); // upload null-terminated shader glCompileShaderARB(hShader); // Check for errors if (CheckGLError("LoadProgram()")) { glDeleteObjectARB(hShader); bError =true; } } else { hShader = glCreateShader(Type); // upload null-terminated shader glShaderSource(hShader,1,(const char**)&pcShader,NULL); glCompileShader(hShader); // Check for compile status GLint iCompiled=42, srclen=42; glGetShaderiv(hShader,GL_COMPILE_STATUS,&iCompiled); glGetShaderiv(hShader, GL_SHADER_SOURCE_LENGTH, &srclen); // Check for errors if (WriteInfoLog(ShaderDesc, hShader, false)) { T_ERROR("WIL failed, deleting shader.."); glDeleteShader(hShader); bError=true; } if (CheckGLError("LoadProgram()") || iCompiled!=GLint(GL_TRUE)) { T_ERROR("Shader compilation failed."); glDeleteShader(hShader); bError=true; } } if (pcShader!=ShaderDesc) delete[] pcShader; if (bError) return 0; return hShader; } /** * Enables the program for rendering. * Generates error messages if something went wrong (i.e. program not initialized etc.) * \param void * \return void * \warning uses glGetError() * \author Jens Schneider * \date Aug.2004 */ void GLSLProgram::Enable(void) { if(glIsProgram(m_hProgram) != GL_TRUE) { T_ERROR("not a program!"); } if (m_bInitialized) { do { } while(CheckGLError()); gl::UseProgram(m_hProgram); if (!CheckGLError("Enable()")) m_bEnabled=true; } else T_ERROR("No program loaded!"); } /** * Disables the program for rendering. * Generates error messages if something went wrong (i.e. program not initialized etc.) * \param void * \return void * \warning uses glGetError() * \author Jens Schneider * \date Aug.2004 */ void GLSLProgram::Disable(void) { // opengl may not be enabed yet so be careful calling gl functions if (glUseProgramObjectARB != NULL || glUseProgram != NULL) gl::UseProgram(0); } /** * Checks and handles glErrors. * This routine is verbose when run with GLSL_DEBUG defined, only. * If called with NULL as parameter, queries glGetError() and returns true if glGetError() did not return GL_NO_ERROR. * If called with a non-NULL parameter, queries glGetError() and concatenates pcError and the verbosed glError. * If in debug mode, the error is output to stderr, otherwise it is silently ignored. * \param pcError first part of an error message. May be NULL. * \param pcAdditional additional part of error message. May be NULL. * \return bool specifying if an error occured (true) or not (false) * \warning uses glGetError() * \author Jens Schneider * \date Aug.2004 */ #ifndef GLSL_DEBUG bool GLSLProgram::CheckGLError(const char*, const char*) const { return (glGetError()!=GL_NO_ERROR); } #else bool GLSLProgram::CheckGLError(const char *pcError, const char *pcAdditional) const { if (pcError==NULL) { // Simply check for error, true if an error occured. // is there and error in the stack bool bError = glGetError()!=GL_NO_ERROR ; // clear all other errors in the stack while (glGetError() != GL_NO_ERROR ) {} return bError; } else { // print out error GLenum iError=glGetError(); if (iError==GL_NO_ERROR ) return false; while (iError !=GL_NO_ERROR ) { char *pcMessage; if (pcAdditional) { size_t len=16+strlen(pcError)+(pcAdditional ? strlen(pcAdditional) : 0); pcMessage=new char[len]; sprintf(pcMessage,pcError,pcAdditional); } else pcMessage=(char*)pcError; std::ostringstream msg; msg << pcMessage << " - "; switch (iError) { case GL_NO_ERROR: if (pcMessage!=pcError) delete[] pcMessage; return false; break; case GL_INVALID_ENUM: msg << "GL_INVALID_ENUM"; break; case GL_INVALID_VALUE: msg << "GL_INVALID_VALUE"; break; case GL_INVALID_OPERATION: msg << "GL_INVALID_OPERATION"; break; case GL_STACK_OVERFLOW: msg << "GL_STACK_OVERFLOW"; break; case GL_STACK_UNDERFLOW: msg << "GL_STACK_UNDERFLOW"; break; case GL_OUT_OF_MEMORY: msg << "GL_OUT_OF_MEMORY"; break; default: msg << "unknown GL_ERROR " << iError; break; } if (pcMessage!=pcError) delete[] pcMessage; // display the error. T_ERROR("%s", msg.str().c_str()); // fetch the next error from the stack iError=glGetError(); } return true; } } #endif /*************************************************************************** (c) 2004-05 by Jens Schneider, TUM.3D mailto:jens.schneider@in.tum.de Computer Graphics and Visualization Group Institute for Computer Science I15 Technical University of Munich ****************************************************************************/ /** * Returns true if this program is valid. * \param void * \return true if this program was initialized properly * \author Jens Schneider * \date Jun.2005 */ bool GLSLProgram::IsValid(void) const { return m_bInitialized; } GLint GLSLProgram::get_location(const char *name) const { while(glGetError() != GL_NO_ERROR) {;} // flush current error state. GLint location; // Get the position for the uniform var. location = gl::GetUniformLocation(m_hProgram, name); GLenum gl_err = glGetError(); if(gl_err != GL_NO_ERROR) { throw GL_ERROR(gl_err); } if(location == -1) { throw GL_ERROR(0); } return location; } GLenum GLSLProgram::get_type(const char *name) const { GLint numUniforms = 0; glGetProgramiv( m_hProgram, GL_ACTIVE_UNIFORMS, &numUniforms ); GLint uniformMaxLength = 0; glGetProgramiv( m_hProgram, GL_ACTIVE_UNIFORM_MAX_LENGTH, &uniformMaxLength ); GLint size = -1; GLenum type = 0; GLchar* uniformName = new GLchar[uniformMaxLength]; for ( GLint i = 0; i < numUniforms; ++i ) { GLsizei length; if (GLSLProgram::m_bGLUseARB) glGetActiveUniformARB( m_hProgram, i, uniformMaxLength, &length, &size, &type, uniformName); else glGetActiveUniform( m_hProgram, i, uniformMaxLength, &length, &size, &type, uniformName); if ( strcmp(uniformName, name) == 0 ) break; else type = 0; } delete [] uniformName; GLenum gl_err = glGetError(); if(gl_err != GL_NO_ERROR) { T_ERROR("Error getting uniform parameter type."); throw GL_ERROR(gl_err); } return type; } #ifdef GLSL_DEBUG void GLSLProgram::CheckType(const char *name, GLenum type) const { GLenum eTypeInShader = get_type(name); if (eTypeInShader != type) { WARNING("Requested uniform variable type (%i) does not " "match shader definition (%i).", type, eTypeInShader); } } #else void GLSLProgram::CheckType(const char *, GLenum) const { } #endif #ifdef GLSL_DEBUG void GLSLProgram::CheckSamplerType(const char *name) const { GLenum eTypeInShader = get_type(name); if (eTypeInShader != GL_SAMPLER_1D && eTypeInShader != GL_SAMPLER_2D && eTypeInShader != GL_SAMPLER_3D && eTypeInShader != GL_SAMPLER_CUBE && eTypeInShader != GL_SAMPLER_1D_SHADOW && eTypeInShader != GL_SAMPLER_2D_SHADOW && eTypeInShader != GL_SAMPLER_2D_RECT_ARB && eTypeInShader != GL_SAMPLER_2D_RECT_SHADOW_ARB) { WARNING("Shader definition (%i) does not match any " "sampler type.", eTypeInShader); } } #else void GLSLProgram::CheckSamplerType(const char *) const { } #endif void GLSLProgram::ConnectTextureID(const string& name, const int iUnit) { Enable(); m_mBindings[name] = iUnit; try { GLint location = get_location(name.c_str()); CheckSamplerType(name.c_str()); GL(glUniform1i(location,iUnit)); } catch(GLError gl) { T_ERROR("Error (%d) obtaining uniform %s.", gl.error(), name.c_str()); return; } } void GLSLProgram::SetTexture(const string& name, const GLTexture& pTexture) { if (m_mBindings.find(name) == m_mBindings.end ()) { // find a free texture unit int iUnusedTexUnit = 0; for (texMap::iterator i = m_mBindings.begin();i != m_mBindings.end();++i){ if (i->second <= iUnusedTexUnit) iUnusedTexUnit = i->second+1; } ConnectTextureID(name, iUnusedTexUnit); pTexture.Bind(iUnusedTexUnit); } else { pTexture.Bind(m_mBindings[name]); } } void GLSLProgram::Set(const char *name, float x) const { try { GLint location = get_location(name); CheckType(name, GL_FLOAT); GL(glUniform1f(location,x)); // MESSAGE("Set uniform %s to %g", name, x); } catch(GLError gl) { T_ERROR("Error (%d) obtaining uniform %s.", gl.error(), name); return; } } void GLSLProgram::Set(const char *name, float x, float y) const { try { GLint location = get_location(name); CheckType(name, GL_FLOAT_VEC2); GL(glUniform2f(location,x,y)); // MESSAGE("Set uniform %s to (%g,%g)", name, x, y); } catch(GLError gl) { T_ERROR("Error (%d) obtaining uniform %s.", gl.error(), name); return; } } void GLSLProgram::Set(const char *name, float x, float y, float z) const { try { GLint location = get_location(name); CheckType(name, GL_FLOAT_VEC3); GL(glUniform3f(location,x,y,z)); // MESSAGE("Set uniform %s to (%g,%g,%g)", name, x, y, z); } catch(GLError gl) { T_ERROR("Error (%d) obtaining uniform %s.", gl.error(), name); return; } } void GLSLProgram::Set(const char *name, float x, float y, float z, float w) const { try { GLint location = get_location(name); CheckType(name, GL_FLOAT_VEC4); GL(glUniform4f(location,x,y,z,w)); // MESSAGE("Set uniform %s to (%g,%g,%g,%g)", name, x, y, z, w); } catch(GLError gl) { T_ERROR("Error (%d) obtaining uniform %s.", gl.error(), name); return; } } void GLSLProgram::Set(const char *name, const float *m, size_t size, bool bTranspose) const { try { GLint location = get_location(name); switch (size) { case 2 : CheckType(name, GL_FLOAT_MAT2); GL(glUniformMatrix2fv(location,1,bTranspose,m)); break; case 3 : CheckType(name, GL_FLOAT_MAT3); GL(glUniformMatrix3fv(location,1,bTranspose,m)); break; case 4 : CheckType(name, GL_FLOAT_MAT4); GL(glUniformMatrix4fv(location,1,bTranspose,m)); break; default: T_ERROR("Invalid size (%i) when setting matrix %s.", (int)size, name); return; } } catch(GLError gl) { T_ERROR("Error (%d) obtaining uniform %s.", gl.error(), name); return; } } void GLSLProgram::Set(const char *name, int x) const { try { GLint location = get_location(name); CheckType(name, GL_INT); GL(glUniform1i(location,x)); // MESSAGE("Set uniform %s to %d", name, x); } catch(GLError gl) { T_ERROR("Error (%d) obtaining uniform %s.", gl.error(), name); return; } } void GLSLProgram::Set(const char *name, int x, int y) const { try { GLint location = get_location(name); CheckType(name, GL_INT_VEC2); GL(glUniform2i(location,x,y)); // MESSAGE("Set uniform %s to (%d,%d)", name, x, y); } catch(GLError gl) { T_ERROR("Error (%d) obtaining uniform %s.", gl.error(), name); return; } } void GLSLProgram::Set(const char *name, int x, int y, int z) const { try { GLint location = get_location(name); CheckType(name, GL_INT_VEC3); GL(glUniform3i(location,x,y,z)); // MESSAGE("Set uniform %s to (%d,%d,%d)", name, x, y, z); } catch(GLError gl) { T_ERROR("Error (%d) obtaining uniform %s.", gl.error(), name); return; } } void GLSLProgram::Set(const char *name, int x, int y, int z, int w) const { try { GLint location = get_location(name); CheckType(name, GL_INT_VEC4); GL(glUniform4i(location,x,y,z,w)); // MESSAGE("Set uniform %s to (%d,%d,%d,%d)", name, x, y, z, w); } catch(GLError gl) { T_ERROR("Error (%d) obtaining uniform %s.", gl.error(), name); return; } } void GLSLProgram::Set(const char *name, const int *m, size_t size, bool bTranspose) const { if (size < 2 || size > 4) { T_ERROR("Invalid size (%i) when setting matrix %s.", (int)size, name); return; } float mf[4]; for (size_t i = 0;i 4) { T_ERROR("Invalid size (%i) when setting matrix %s.", (int)size, name); return; } float mf[4]; for (size_t i = 0;i # include #endif #include #include #include #include "Basics/nonstd.h" #include "IO/UVF/ExtendedOctree/VolumeTools.h" #include "Controller/StackTimer.h" #include "GLHashTable.h" #include "GLInclude.h" #include "GLSLProgram.h" #include "GLFBOTex.h" #include "GLTexture1D.h" #include "GLTexture2D.h" #include "Renderer/ShaderDescriptor.h" using namespace tuvok; GLHashTable::GLHashTable(const UINTVECTOR3& maxBrickCount, uint32_t iTableSize, uint32_t iRehashCount, bool bUseGLCore, std::string const& strPrefixName) : m_strPrefixName(strPrefixName), m_maxBrickCount(maxBrickCount), m_iTableSize(iTableSize), m_iRehashCount(iRehashCount), m_pHashTableTex(NULL), m_bUseGLCore(bUseGLCore), m_iMountPoint(0) { } GLHashTable::~GLHashTable() { FreeGL(); } void GLHashTable::InitGL() { int gpumax; GL(glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gpumax)); try { m_texSize = VolumeTools::Fit1DIndexTo2DArray(m_iTableSize, gpumax); } catch (std::runtime_error const& e) { // this is very unlikely but not impossible T_ERROR(e.what()); throw; } // try to use 1D texture if possible because it appears to be slightly faster than a 2D texture if (Is2DTexture()) { m_pHashTableTex = new GLTexture2D(m_texSize.x, m_texSize.y, GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, NULL); } else { assert(m_texSize.x == m_iTableSize); m_pHashTableTex = new GLTexture1D(m_texSize.x, GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, NULL); } m_pRawData = std::shared_ptr( new uint32_t[m_texSize.area()], nonstd::DeleteArray() ); } UINTVECTOR4 GLHashTable::Int2Vector(uint32_t index) const { UINTVECTOR4 coords; coords.w = index / m_maxBrickCount.volume(); index -= coords.w*m_maxBrickCount.volume(); coords.z = index / (m_maxBrickCount.x * m_maxBrickCount.y); index -= coords.z*(m_maxBrickCount.x * m_maxBrickCount.y); coords.y = index / m_maxBrickCount.x; index -= coords.y*m_maxBrickCount.x; coords.x = index; return coords; } bool GLHashTable::Is2DTexture() const { return m_texSize.y > 1; } void GLHashTable::Enable() { GL(glBindImageTexture(m_iMountPoint, m_pHashTableTex->GetGLID(), 0, false, 0, GL_READ_WRITE, GL_R32UI)); } std::vector GLHashTable::GetData() { GL(glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT)); #ifdef GLHASHTABLE_PROFILE GL(glFinish()); #endif TimedStatement(PERF_READ_HTABLE, m_pRawData = std::static_pointer_cast(m_pHashTableTex->GetData()); ); std::vector requests; StackTimer condense(PERF_CONDENSE_HTABLE); for (size_t i = 0;iSetData(m_pRawData.get()); } std::string GLHashTable::GetShaderFragment(uint32_t iMountPoint) { m_iMountPoint = iMountPoint; std::stringstream ss; #ifdef WRITE_SHADERS const char* shname = "hashtable.glsl"; std::ifstream shader(shname); if(shader) { MESSAGE("Reusing hashtable.glsl shader on disk."); shader >> std::noskipws; std::string sh( (std::istream_iterator(shader)), (std::istream_iterator()) ); shader.close(); return sh; } #endif if (m_bUseGLCore) ss << "#version 420 core\n"; else ss << "#version 420 compatibility\n"; ss << "\n" << "layout(binding = " << iMountPoint << ", size1x32) coherent uniform " << (Is2DTexture() ? "uimage2D " : "uimage1D ") << m_strPrefixName << "hashTable;\n" << "\n" << "uint " << m_strPrefixName << "Serialize(uvec4 bd) {\n" << " return 1 + bd.x + bd.y * " << m_maxBrickCount.x << " + bd.z * " << m_maxBrickCount.x * m_maxBrickCount.y << " + bd.w * " << m_maxBrickCount.volume() << ";\n" << "}\n" << "\n" << "uint " << m_strPrefixName << "HashValue(uint serializedValue) {\n" << " return uint(serializedValue % " << m_iTableSize << ");\n" << "}\n" << "\n"; if (Is2DTexture()) { // we are using a 2D texture ss << "uint " << m_strPrefixName << "AccessHashTable(uint hashValue, uint serializedValue) {\n" << " ivec2 hashPosition = ivec2(hashValue % " << m_texSize.x << ", " "hashValue / " << m_texSize.x << ");\n" << " return imageAtomicCompSwap(" << m_strPrefixName << "hashTable," "hashPosition, uint(0), serializedValue);\n" << "}\n" << "\n"; } else { // we are using a 1D texture ss << "uint " << m_strPrefixName << "AccessHashTable(uint hashValue, uint serializedValue) {\n" << " int hashPosition = int(hashValue);\n" << " return imageAtomicCompSwap(" << m_strPrefixName << "hashTable," "hashPosition, uint(0), serializedValue);\n" << "}\n" << "\n"; } ss << "uint " << m_strPrefixName << "Hash(uvec4 bd) {\n" << " uint rehashCount = 0;\n" << " uint serializedValue = " << m_strPrefixName << "Serialize(bd);\n" << "\n" << " do {\n" << " uint hash = " << m_strPrefixName << "HashValue(serializedValue+rehashCount);\n" << " uint valueInImage = " << m_strPrefixName << "AccessHashTable(hash, serializedValue);\n" << " if (valueInImage == 0 || valueInImage == serializedValue)\n" << " return rehashCount;\n" << " } while (++rehashCount < " << m_iRehashCount << ");\n" << "\n" << " return uint(" << m_iRehashCount << ");\n" << "}\n"; #ifdef WRITE_SHADERS std::ofstream hashtab(shname, std::ios::trunc); if(hashtab) { MESSAGE("Writing new hashtable shader."); const std::string& s = ss.str(); std::copy(s.begin(), s.end(), std::ostream_iterator(hashtab, "")); } hashtab.close(); #endif // WRITE_SHADERS return ss.str(); } void GLHashTable::FreeGL() { if (m_pHashTableTex) { m_pHashTableTex->Delete(); delete m_pHashTableTex; m_pHashTableTex = NULL; } } uint64_t GLHashTable::GetCPUSize() const { return m_pHashTableTex->GetCPUSize() + m_iTableSize*4; } uint64_t GLHashTable::GetGPUSize() const { return m_pHashTableTex->GetGPUSize(); } ImageVis3D-3.1.0/Tuvok/Renderer/GL/GLVBO.h0000644000175000017500000000756412320456500017473 0ustar mathieumathieu#pragma once #ifndef GLVBO_H #define GLVBO_H #include "StdTuvokDefines.h" #include "GLObject.h" #include "Basics/Vectors.h" #include namespace tuvok { class ABDesc { public: ABDesc() {} ABDesc(GLenum _type, size_t _elemCount, size_t _count) : type(_type), elemCount(_elemCount), count(_count) {} GLenum type; size_t elemCount; size_t count; }; class IBDesc { public: IBDesc() {} IBDesc(GLenum _type, size_t _count) : type(_type), count(_count) {} GLenum type; size_t count; }; class GLVBO : public GLObject { public: GLVBO(); virtual ~GLVBO(); void AddVertexData(const std::vector& vertexData); void AddVertexData(const std::vector& vertexData); void AddVertexData(const std::vector& vertexData); void AddVertexData(const std::vector& vertexData); void AddVertexData(const std::vector& vertexData); void AddVertexData(const std::vector& vertexData); void AddVertexData(const std::vector& vertexData); void AddVertexData(const std::vector& vertexData); void AddVertexData(const std::vector& vertexData); void AddVertexData(const std::vector& vertexData); void AddVertexData(const std::vector& vertexData); void AddVertexData(const std::vector& vertexData); void AddVertexData(const std::vector& vertexData); void AddVertexData(const std::vector>& vertexData); void AddVertexData(const std::vector>& vertexData); void AddVertexData(const std::vector>& vertexData); void AddVertexData(const std::vector& vertexData); void AddVertexData(const std::vector>& vertexData); void AddVertexData(const std::vector>& vertexData); void AddVertexData(const std::vector>& vertexData); void ClearVertexData(); void SetIndexData(const std::vector& indexData); void SetIndexData(const std::vector& indexData); void FreeGL(); void Bind() const; void Draw(GLsizei count, GLenum mode) const; void Draw(GLenum mode) const; void UnBind() const; virtual uint64_t GetCPUSize() const; virtual uint64_t GetGPUSize() const; private: std::vector> m_vboHandles; std::pair m_iboHandle; GLuint GetNewAB(); void AddVertexData(size_t elemCount, size_t elemSize, GLenum type, size_t count, const GLvoid * pointer); }; } #endif // GLVBO_H /* The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group, Saarland University Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/Renderer/StateManager.h0000644000175000017500000001250312320456500020660 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file StateManager.h \author Jens Krueger IVDA, Saarbruecken SCI Institute, University of Utah */ #pragma once #ifndef STATEMANAGER_H #define STATEMANAGER_H #include "StdTuvokDefines.h" #include namespace tuvok { #define StateLightCount 1 #define StateTUCount 4 enum STATE_CULL { CULL_FRONT, CULL_BACK }; enum STATE_TEX { TEX_1D, TEX_2D, TEX_3D, TEX_NONE }; enum BLEND_FUNC { BF_ZERO, BF_ONE, BF_SRC_COLOR, BF_ONE_MINUS_SRC_COLOR, BF_DST_COLOR, BF_ONE_MINUS_DST_COLOR, BF_SRC_ALPHA, BF_ONE_MINUS_SRC_ALPHA, BF_DST_ALPHA, BF_ONE_MINUS_DST_ALPHA, BF_SRC_ALPHA_SATURATE }; enum BLEND_EQUATION { BE_FUNC_ADD, BE_FUNC_SUBTRACT, BE_FUNC_REVERSE_SUBTRACT, BE_MIN, BE_MAX }; enum DEPTH_FUNC { DF_NEVER, DF_LESS, DF_EQUAL, DF_LEQUAL, DF_GREATER, DF_NOTEQUAL, DF_GEQUAL, DF_ALWAYS }; /** \class GPUState * Base class for all GPU state this object holds the rendering pipleine's state in one single object to the GPU.*/ class GPUState { public: GPUState() : enableDepthTest(true), depthFunc(DF_LESS), enableCullFace(true), cullState(CULL_BACK), enableBlend(false), enableScissor(false), enableLighting(false), enableColorMaterial(false), activeTexUnit(0), depthMask(true), colorMask(true), blendEquation(BE_FUNC_ADD), blendFuncSrc(BF_ONE_MINUS_DST_ALPHA), blendFuncDst(BF_ONE), lineWidth(1.0f) { for (size_t i = 0;i StateManagerPtr; }; //namespace tuvok #endif // STATEMANAGER_H ImageVis3D-3.1.0/Tuvok/Renderer/SBVRGeogen2D.cpp0000644000175000017500000007557612320456500020752 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file SBVRGeogen2D.h \author Jens Krueger SCI Institute DFKI Saarbruecken & University of Utah \date March 2010 */ #include "StdTuvokDefines.h" #include #include #include #include #include #include "SBVRGeogen2D.h" using namespace std; using namespace tuvok; static const float fMinCos = 0.01f; SBVRGeogen2D::SBVRGeogen2D(void) : SBVRGeogen(), m_eMethod(METHOD_KRUEGER_FAST) { } SBVRGeogen2D::~SBVRGeogen2D(void) { } float SBVRGeogen2D::GetDelta(int iDir) const { return 1.0f/(m_fSamplingModifier * m_vSize[iDir] * 1.414213562f); // = sqrt(2) } void SBVRGeogen2D::InterpolateVertices(const VERTEX_FORMAT& v1, const VERTEX_FORMAT& v2, float a, VERTEX_FORMAT& r) const { r.m_vPos = (1.0f-a)*v1.m_vPos + a*v2.m_vPos; r.m_vVertexData = (1.0f-a)*v1.m_vVertexData + a*v2.m_vVertexData; r.m_bClip = m_bClipVolume; } void SBVRGeogen2D::ComputeGeometry(bool bMeshOnly) { InitBBOX(); if (bMeshOnly) { m_vSliceTrianglesX.clear(); m_vSliceTrianglesY.clear(); m_vSliceTrianglesZ.clear(); SortMeshWithoutVolume(m_vSliceTrianglesX); m_vSliceTrianglesY = m_vSliceTrianglesX; m_vSliceTrianglesZ = m_vSliceTrianglesX; return; } // TODO handle mesh when the volume is not empty switch (m_eMethod) { case METHOD_REZK : ComputeGeometryRezk(); break; case METHOD_KRUEGER : ComputeGeometryKrueger(); break; default : ComputeGeometryKruegerFast(); break; } if(m_bClipPlaneEnabled && (m_bClipVolume || m_bClipMesh)) { PLANE transformed = m_ClipPlane * m_matView; const FLOATVECTOR3 normal(transformed.xyz()); const float d = transformed.d(); m_vSliceTrianglesX = ClipTriangles(m_vSliceTrianglesX, normal, d); m_vSliceTrianglesY = ClipTriangles(m_vSliceTrianglesY, normal, d); m_vSliceTrianglesZ = ClipTriangles(m_vSliceTrianglesZ, normal, d); } } /* Compute 2D geometry via C. Rezk-Salama et al. 2000 "Interactive Volume Rendering on Standard PC Graphics Hardware Using Multi-Textures and Multi-Stage Rasterization" */ void SBVRGeogen2D::ComputeGeometryRezk() { // compute optimal stack FLOATVECTOR3 vCenter = (m_pfBBOXVertex[0].m_vPos+ m_pfBBOXVertex[6].m_vPos) / 2.0f; FLOATVECTOR3 vCoordFrame[3] = {(m_pfBBOXVertex[0].m_vPos- m_pfBBOXVertex[1].m_vPos), // X (m_pfBBOXVertex[0].m_vPos- m_pfBBOXVertex[4].m_vPos), // Y (m_pfBBOXVertex[0].m_vPos- m_pfBBOXVertex[3].m_vPos)}; // Z for (size_t i = 0;i<3;i++) vCoordFrame[i].normalize(); float fCosX = vCenter^vCoordFrame[0]; float fCosY = vCenter^vCoordFrame[1]; float fCosZ = vCenter^vCoordFrame[2]; int iStack = 2; bool bFlipStack=fCosZ>0; if (fabs(fCosX) > fabs(fCosY) && fabs(fCosX) > fabs(fCosZ)) { iStack = 0; bFlipStack = fCosX<0; } else { if (fabs(fCosY) > fabs(fCosX) && fabs(fCosY) > fabs(fCosZ)) { iStack = 1; bFlipStack=fCosY>0; } } m_vSliceTrianglesX.clear(); m_vSliceTrianglesY.clear(); m_vSliceTrianglesZ.clear(); VERTEX_FORMAT pfSliceVertex[4]; float fDelta = GetDelta(iStack); uint32_t iLayerCount = uint32_t(floor(1.0f/fDelta)); fDelta = 1.0f / float(iLayerCount-1); float fDepth = 0; if (bFlipStack) { fDelta *= -1; fDepth = 1; } switch (iStack) { case 0 :{ for (uint32_t x = 0;x vEdges[12] = {make_pair(3,2), // top, front, left to right make_pair(0,1), // top, back, left to right make_pair(3,0), // top, front to back, left make_pair(2,1), // top, front to back, right make_pair(7,6), // bottom, front, left to right make_pair(4,5), // bottom, back, left to right make_pair(7,4), // bottom, front to back, left make_pair(6,5), // bottom, front to back, right make_pair(3,7), // top-bottom, front, left make_pair(2,6), // top-bottom, front, right make_pair(1,5), // top-bottom, back, left make_pair(0,4)};// top-bottom, back, right // faces // 0 left = -X // 1 right = X // 2 bottom = -Y // 3 top = Y // 4 back = -Z // 5 front = Z // indices of the faces adjacent to the edges pair vAdjFaces[12] = {make_pair(3,5), make_pair(3,4), make_pair(3,0), make_pair(3,1), make_pair(2,5), make_pair(2,4), make_pair(2,0), make_pair(2,1), make_pair(0,5), make_pair(5,1), make_pair(1,4), make_pair(4,0)}; // centerpoints of the edges FLOATVECTOR3 vEdgeCenters[12]; for (size_t i = 0;i<12;i++) { vEdgeCenters[i] = (m_pfBBOXVertex[vEdges[i].first].m_vPos+ m_pfBBOXVertex[vEdges[i].second].m_vPos)/2.0f; } // face normals (pointing inwards) FLOATVECTOR3 vFaceNormals[6] = { vCoordFrame[0], -vCoordFrame[0], vCoordFrame[1], -vCoordFrame[1], vCoordFrame[2], -vCoordFrame[2]}; vector vIntersects; for (size_t i = 0;i<12;i++) { FLOATVECTOR3 vDir = vEdgeCenters[i]; float a = vFaceNormals[vAdjFaces[i].first]^vDir; float b = vFaceNormals[vAdjFaces[i].second]^vDir; if (a > 0 && b > 0) { vIntersects.push_back(i); } } vector vPlanes; for (size_t i = 0;inormalize(); } // compute the face center vertices FLOATVECTOR3 vFaceVec[6]; vFaceVec[0] = (m_pfBBOXVertex[0].m_vPos+m_pfBBOXVertex[4].m_vPos+ m_pfBBOXVertex[3].m_vPos+m_pfBBOXVertex[7].m_vPos)/4.0f; vFaceVec[1] = (m_pfBBOXVertex[6].m_vPos+m_pfBBOXVertex[2].m_vPos+ m_pfBBOXVertex[1].m_vPos+m_pfBBOXVertex[5].m_vPos)/4.0f; vFaceVec[2] = (m_pfBBOXVertex[4].m_vPos+m_pfBBOXVertex[5].m_vPos+ m_pfBBOXVertex[6].m_vPos+m_pfBBOXVertex[7].m_vPos)/4.0f; vFaceVec[3] = (m_pfBBOXVertex[0].m_vPos+m_pfBBOXVertex[1].m_vPos+ m_pfBBOXVertex[2].m_vPos+m_pfBBOXVertex[3].m_vPos)/4.0f; vFaceVec[4] = (m_pfBBOXVertex[0].m_vPos+m_pfBBOXVertex[1].m_vPos+ m_pfBBOXVertex[4].m_vPos+m_pfBBOXVertex[5].m_vPos)/4.0f; vFaceVec[5] = (m_pfBBOXVertex[3].m_vPos+m_pfBBOXVertex[2].m_vPos+ m_pfBBOXVertex[7].m_vPos+m_pfBBOXVertex[6].m_vPos)/4.0f; for (int i = 0;i<6;i++) vFaceVec[i].normalize(); float fCosAngleX = max(vFaceVec[0]^ vCoordFrame[0], vFaceVec[1]^-vCoordFrame[0]); float fCosAngleY = max(vFaceVec[2]^ vCoordFrame[1], vFaceVec[3]^-vCoordFrame[1]); float fCosAngleZ = max(vFaceVec[4]^ vCoordFrame[2], vFaceVec[5]^-vCoordFrame[2]); float normalization = sqrt(fCosAngleX*fCosAngleX+ fCosAngleY*fCosAngleY+ fCosAngleZ*fCosAngleZ); fCosAngleX /= normalization; fCosAngleY /= normalization; fCosAngleZ /= normalization; m_vSliceTrianglesX.clear(); m_vSliceTrianglesY.clear(); m_vSliceTrianglesZ.clear(); VERTEX_FORMAT pfSliceVertex[4]; FLOATVECTOR3 fDelta; fDelta.x = GetDelta(0)*fCosAngleX; fDelta.y = GetDelta(1)*fCosAngleY; fDelta.z = GetDelta(2)*fCosAngleZ; // if something of the x stack is visible if (fCosAngleX > fMinCos) { uint32_t iLayerCount = uint32_t(floor(1.0f/fDelta.x)); fDelta.x = 1.0f / float(iLayerCount-1); // detemine if we a moving back to front or front to back // (as seen from the untransfrormed orientation) float a = 0; if ((vFaceVec[0]^vCoordFrame[0]) > 0.0f) { fDelta.x *= -1; a = 1; } // generate ALL stack quads for (uint32_t x = 0;x fMinCos) { uint32_t iLayerCount = uint32_t(floor(1.0f/fDelta.y)); fDelta.y = 1.0f / float(iLayerCount-1); float a = 0; // detemine if we a moving back to front or front to back // (as seen from the untransfrormed orientation) if ((vFaceVec[2]^vCoordFrame[1]) > 0.0f) { fDelta.y *= -1; a = 1; } // generate ALL stack quads for (uint32_t y = 0;y fMinCos) { uint32_t iLayerCount = uint32_t(floor(1.0f/fDelta.z)); fDelta.z = 1.0f / float(iLayerCount-1); float a = 0; // detemine if we a moving back to front or front to back // (as seen from the untransfrormed orientation) if ((vFaceVec[4]^vCoordFrame[2]) > 0.0f){ fDelta.z *= -1; a = 1; } // generate ALL stack quads for (uint32_t z = 0;z vEdges[12] = {make_pair(3,2), // top, front, left to right make_pair(0,1), // top, back, left to right make_pair(3,0), // top, front to back, left make_pair(2,1), // top, front to back, right make_pair(7,6), // bottom, front, left to right make_pair(4,5), // bottom, back, left to right make_pair(7,4), // bottom, front to back, left make_pair(6,5), // bottom, front to back, right make_pair(3,7), // top-bottom, front, left make_pair(2,6), // top-bottom, front, right make_pair(1,5), // top-bottom, back, left make_pair(0,4)};// top-bottom, back, right // faces // 0 left = -X // 1 right = X // 2 bottom = -Y // 3 top = Y // 4 back = -Z // 5 front = Z // indices of the faces adjacent to the edges pair vAdjFaces[12] = {make_pair(3,5), make_pair(3,4), make_pair(3,0), make_pair(3,1), make_pair(2,5), make_pair(2,4), make_pair(2,0), make_pair(2,1), make_pair(0,5), make_pair(5,1), make_pair(1,4), make_pair(4,0)}; // centerpoints of the edges FLOATVECTOR3 vEdgeCenters[12]; for (size_t i = 0;i<12;i++) { vEdgeCenters[i] = (m_pfBBOXVertex[vEdges[i].first].m_vPos+ m_pfBBOXVertex[vEdges[i].second].m_vPos)/2.0f; } // face normals (pointing inwards) FLOATVECTOR3 vFaceNormals[6] = { vCoordFrame[0], -vCoordFrame[0], vCoordFrame[1], -vCoordFrame[1], vCoordFrame[2], -vCoordFrame[2]}; // find edges creating intersecting planes vector vIntersects; vector vIntersectPlanes; for (size_t i = 0;i<12;i++) { FLOATVECTOR3 vDir = vEdgeCenters[i]; float a = vFaceNormals[vAdjFaces[i].first]^vDir; float b = vFaceNormals[vAdjFaces[i].second]^vDir; if (a > 0 && b > 0) { vIntersects.push_back(i); FLOATPLANE v = FLOATPLANE(m_pfBBOXVertex[vEdges[i].first].m_vPos, m_pfBBOXVertex[vEdges[i].second].m_vPos, m_pfBBOXVertex[vEdges[i].second].m_vPos+ vEdgeCenters[i]); v.normalize(); vIntersectPlanes.push_back(v); } } // compute the face center vertices FLOATVECTOR3 vFaceVec[8]; vFaceVec[0] = (m_pfBBOXVertex[0].m_vPos+m_pfBBOXVertex[4].m_vPos+ m_pfBBOXVertex[3].m_vPos+m_pfBBOXVertex[7].m_vPos)/4.0f; vFaceVec[1] = (m_pfBBOXVertex[6].m_vPos+m_pfBBOXVertex[2].m_vPos+ m_pfBBOXVertex[1].m_vPos+m_pfBBOXVertex[5].m_vPos)/4.0f; vFaceVec[2] = (m_pfBBOXVertex[4].m_vPos+m_pfBBOXVertex[5].m_vPos+ m_pfBBOXVertex[6].m_vPos+m_pfBBOXVertex[7].m_vPos)/4.0f; vFaceVec[3] = (m_pfBBOXVertex[0].m_vPos+m_pfBBOXVertex[1].m_vPos+ m_pfBBOXVertex[2].m_vPos+m_pfBBOXVertex[3].m_vPos)/4.0f; vFaceVec[4] = (m_pfBBOXVertex[0].m_vPos+m_pfBBOXVertex[1].m_vPos+ m_pfBBOXVertex[4].m_vPos+m_pfBBOXVertex[5].m_vPos)/4.0f; vFaceVec[5] = (m_pfBBOXVertex[3].m_vPos+m_pfBBOXVertex[2].m_vPos+ m_pfBBOXVertex[7].m_vPos+m_pfBBOXVertex[6].m_vPos)/4.0f; for (int i = 0;i<6;i++) { vFaceVec[i].normalize(); } float fCosAngleX = max(vFaceVec[0]^ vCoordFrame[0], vFaceVec[1]^-vCoordFrame[0]); float fCosAngleY = max(vFaceVec[2]^ vCoordFrame[1], vFaceVec[3]^-vCoordFrame[1]); float fCosAngleZ = max(vFaceVec[4]^ vCoordFrame[2], vFaceVec[5]^-vCoordFrame[2]); if (fCosAngleX < 0 && fCosAngleY < 0 && fCosAngleZ < 0) { // inside the volume use christophs approach ComputeGeometryRezk(); return; } float normalization = sqrt(fCosAngleX*fCosAngleX+ fCosAngleY*fCosAngleY+ fCosAngleZ*fCosAngleZ); fCosAngleX /= normalization; fCosAngleY /= normalization; fCosAngleZ /= normalization; m_vSliceTrianglesX.clear(); m_vSliceTrianglesY.clear(); m_vSliceTrianglesZ.clear(); FLOATVECTOR3 fDelta; fDelta.x = GetDelta(0)*fCosAngleX; fDelta.y = GetDelta(1)*fCosAngleY; fDelta.z = GetDelta(2)*fCosAngleZ; // if something of the x stack is visible compute geometry if (fCosAngleX > fMinCos) { const size_t vertexIndices[8] = {1,2,6,5,0,3,7,4}; const size_t edgeIndices[8] = {3,7,10,9,2,6,11,8}; BuildStackQuads(0, fDelta.x, vertexIndices, edgeIndices, vFaceVec, vIntersects, vIntersectPlanes, vCoordFrame, m_vSliceTrianglesX); } // if something of the y stack is visible compute geometry if (fCosAngleY > fMinCos) { const size_t vertexIndices[8] = {0,1,2,3,4,5,6,7}; const size_t edgeIndices[8] = {1,0,2,3,5,4,6,7}; BuildStackQuads(1, fDelta.y, vertexIndices, edgeIndices, vFaceVec, vIntersects, vIntersectPlanes, vCoordFrame, m_vSliceTrianglesY); } // if something of the z stack is visible compute geometry if (fCosAngleZ > fMinCos) { const size_t vertexIndices[8] = {3,2,6,7,0,1,5,4}; const size_t edgeIndices[8] = {0,4,8,9,1,5,11,10}; BuildStackQuads(2, fDelta.z, vertexIndices, edgeIndices, vFaceVec, vIntersects, vIntersectPlanes, vCoordFrame, m_vSliceTrianglesZ); } } class HitEdge { public: int m_p0; int m_p1; int m_p0Sec; int m_iChange; HitEdge() : m_p0(0), m_p1(0), m_iChange(0) {} void set(int p0, int p1, int p0Sec = -1) { m_p0 = p0; m_p1 = p1; m_p0Sec = p0Sec; m_iChange = (p0Sec < 0) ? 1 : 2; } }; void SBVRGeogen2D::BuildStackQuads( const int iDirIndex, float fDelta, const size_t *vertexIndices, const size_t *edgeIndices, const FLOATVECTOR3* vFaceVec, const vector& vIntersects, const vector& vIntersectPlanes, const FLOATVECTOR3* vCoordFrame, vector& vSliceTriangles ) { VERTEX_FORMAT pVertices[8]; size_t pEdges[8]; // set unclipped front and back vertices if ((vFaceVec[iDirIndex*2]^vCoordFrame[iDirIndex]) <= 0.0f){ for (int i = 0;i<4;i++) { pVertices[i] = m_pfBBOXVertex[vertexIndices[i]]; pVertices[i+4] = m_pfBBOXVertex[vertexIndices[i+4]]; pEdges[i] = edgeIndices[i]; } } else { for (int i = 0;i<4;i++) { pVertices[i] = m_pfBBOXVertex[vertexIndices[i+4]]; pVertices[i+4] = m_pfBBOXVertex[vertexIndices[i]]; pEdges[i] = edgeIndices[i+4]; } } // compute splice vertices VERTEX_FORMAT pfSliceVertex[4]; for (size_t i = 0;i 0) { float t; if (!v.intersect( pVertices[bp[j].m_p0].m_vPos, pVertices[bp[j].m_p1].m_vPos, t)) { continue; } if (t < 0 || t > 1) continue; InterpolateVertices(pVertices[bp[j].m_p0], pVertices[bp[j].m_p1], t, pVertices[bp[j].m_p0] ); if (bp[j].m_iChange > 1) { pVertices[bp[j].m_p0Sec] = pVertices[bp[j].m_p0]; } } } } // compute depth of stack float fDistScale = min( min((pVertices[0].m_vPos-pVertices[4].m_vPos).length() / (m_pfBBOXVertex[vertexIndices[0]].m_vPos- m_pfBBOXVertex[vertexIndices[4]].m_vPos).length() , (pVertices[1].m_vPos-pVertices[5].m_vPos).length() / (m_pfBBOXVertex[vertexIndices[1]].m_vPos- m_pfBBOXVertex[vertexIndices[5]].m_vPos).length()), min((pVertices[3].m_vPos-pVertices[7].m_vPos).length() / (m_pfBBOXVertex[vertexIndices[3]].m_vPos- m_pfBBOXVertex[vertexIndices[7]].m_vPos).length() , (pVertices[2].m_vPos-pVertices[6].m_vPos).length() / (m_pfBBOXVertex[vertexIndices[2]].m_vPos- m_pfBBOXVertex[vertexIndices[6]].m_vPos).length())); // compute number of layers to cover depth uint32_t iLayerCount = uint32_t(floor(fDistScale/fDelta)); fDelta = 1.0f / float(iLayerCount-1); vSliceTriangles.resize(iLayerCount*6); size_t iVectorIndex = 0; // interpolate the required stack quads while (iVectorIndex < iLayerCount*6) { float t = (iVectorIndex/6) * fDelta; InterpolateVertices(pVertices[0], pVertices[4], t, pfSliceVertex[0]); InterpolateVertices(pVertices[1], pVertices[5], t, pfSliceVertex[1]); InterpolateVertices(pVertices[2], pVertices[6], t, pfSliceVertex[2]); InterpolateVertices(pVertices[3], pVertices[7], t, pfSliceVertex[3]); vSliceTriangles[iVectorIndex++] = pfSliceVertex[2]; vSliceTriangles[iVectorIndex++] = pfSliceVertex[1]; vSliceTriangles[iVectorIndex++] = pfSliceVertex[0]; vSliceTriangles[iVectorIndex++] = pfSliceVertex[0]; vSliceTriangles[iVectorIndex++] = pfSliceVertex[3]; vSliceTriangles[iVectorIndex++] = pfSliceVertex[2]; } } ImageVis3D-3.1.0/Tuvok/Renderer/SBVRGeogen.h0000644000175000017500000003054112320456500020210 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file SBVRGeogen.h \author Jens Krueger SCI Institute University of Utah \date September 2008 */ #pragma once #ifndef SBVRGEOGEN_H #define SBVRGEOGEN_H #include #include "../Basics/Vectors.h" #include "../StdTuvokDefines.h" #include "RenderMesh.h" namespace tuvok { /** \class VERTEX_FORMAT \brief simple aggregate class to hold 3D position and 4D vertex info (either used as 3D texccords or 4d color) */ #define AS_TEXCOORD 2 #pragma pack(push, 1) class VERTEX_FORMAT { public: /** \brief standard constructor initializes both the position as well as the texture coodinate to (0,0,0,0) */ VERTEX_FORMAT() : m_vPos(), m_vVertexData(), m_fOpacity(AS_TEXCOORD), m_bClip(true) {} /** \brief initializes both the position as well as the texture coodinate to the given parameters */ VERTEX_FORMAT(const FLOATVECTOR3 &vPos, const FLOATVECTOR3 &vTex) : m_vPos(vPos), m_vVertexData(vTex), m_fOpacity(AS_TEXCOORD), m_bClip(true) {} /** \brief initializes the position to the x,y,z coordinate of the give position (IGNORING the w component) and the texture coodinate to the given parameter */ VERTEX_FORMAT(const FLOATVECTOR4 &vPos, const FLOATVECTOR3 &vTex) : m_vPos(vPos.xyz()), m_vVertexData(vTex), m_fOpacity(AS_TEXCOORD), m_bClip(true) {} /** \brief initializes the position to give parameter and the texture coordinate to the position + 0.5 this is useful for the realtively common case that the normlized volume is centered in the origin */ VERTEX_FORMAT(const FLOATVECTOR3 &vPos) : m_vPos(vPos), m_fOpacity(AS_TEXCOORD), m_bClip(true) { m_vVertexData = m_vPos + 0.5f; } //! the 3D position FLOATVECTOR3 m_vPos; //! the 3D texture coordinate or a RBG channels of a color FLOATVECTOR3 m_vVertexData; //! if the vertex is a color vertex then this holds the opacity otherwise // it stores AS_TEXCOORD float m_fOpacity; FLOATVECTOR3 m_vNormal; bool m_bClip; }; #pragma pack(pop) /** \class SBVRGeoGen * Geometry generation for the slice-based volume renderer. */ /** \class SBVRGeoGen \brief Abstract base class for the geometry generation for the slice-based volume renderer. This class implements all the accessor code and the required member variables for the geometry generation. It does not implement the most important call ComputeGeometry() but defines it as pure virtual call. */ class SBVRGeogen { public: /** \brief The Standard and also the only constructor SBVRGeogen takes no parameters in the constructor as the information required to compute the geometry mode is supplied later via accessor calls */ SBVRGeogen(void); virtual ~SBVRGeogen(void); /** \brief Modifies the default sampling rate \param fSamplingModifier user specified oversampling (if > 1) or undersampling (if < 1) rate */ void SetSamplingModifier(float fSamplingModifier) { m_fSamplingModifier = fSamplingModifier; } /** \brief Sets the view matrix \param matView the new view matrix */ void SetView(const FLOATMATRIX4 &matView); /** \brief Sets the world matrix (or model matrix) without brick translation \param matWorld the new world matrix */ void SetWorld(const FLOATMATRIX4& matWorld); /** \brief Sets translation of the brick within the array of volume bricks \param brickTranslation the translation of the brick */ void SetBrickTrans(const FLOATVECTOR3& brickTranslation); /** \brief Sets the global volume parameters \param vAspect the global aspect ratio of the entire volume (not just the current brick) \param vSize the global size of the highest resolution of the entire volume (not just the current brick) */ void SetVolumeData(const FLOATVECTOR3& vAspect, const UINTVECTOR3& vSize); /** \brief Sets the global LOD information \param vSize the global size of the current LOD of the entire volume (not just the current brick) */ void SetLODData(const UINTVECTOR3& vSize); /** \brief Sets the local brick parameters \param vAspect the aspect ratio of the current brick \param vSize the voxel size of the current brick \param vTexCoordMin minimum texture coordinates usualy this is not (0,0,0) due to brick overlaps \param vTexCoordMax maximum texture coordinates usualy this is not (1,1,1) due to brick overlaps */ void SetBrickData(const FLOATVECTOR3& vAspect, const UINTVECTOR3& vSize, const FLOATVECTOR3& vTexCoordMin=FLOATVECTOR3(0,0,0), const FLOATVECTOR3& vTexCoordMax=FLOATVECTOR3(1,1,1)); /** \brief abstract call the is supposed to do the actual geometry computation in the derived classes */ virtual void ComputeGeometry(bool bMeshOnly) = 0; /** \brief returns the opacity correction parameter based on the global volume paramerts set by SetVolumeData() and SetLODData() */ float GetOpacityCorrection() const; //! enables the clip plane, does not recompute the geometry void DisableClipPlane() { m_bClipPlaneEnabled = false; } //! enables the clip plane, does not recompute the geometry void EnableClipPlane() { m_bClipPlaneEnabled = true; } /** \brief specifies the clipping plane recompute the geometry if the plane is differnt from the previously stored clip plane \param plane the new clipping plane */ void SetClipPlane(const PLANE& plane) { if(m_ClipPlane != plane) { m_ClipPlane = plane; } } virtual bool HasMesh() const {return !m_mesh.empty();} void ResetMesh() {m_mesh.clear();} void AddMesh(const SortIndexPVec& mesh); void ClipVolumeOnPlanes(bool bClipVolume) {m_bClipVolume = bClipVolume;} void ClipMeshOnPlanes(bool bClipMesh) {m_bClipMesh = bClipMesh;} protected: //! user specified oversampling (if > 1) or undersampling (if < 1) rate float m_fSamplingModifier; //! the world matrix a.k.a. model matrix FLOATMATRIX4 m_matWorld; //! the view matrix FLOATMATRIX4 m_matView; //! caches m_matWorld * m_matView, updated via MatricesUpdated() FLOATMATRIX4 m_matWorldView; //! the translation of the brick FLOATVECTOR3 m_brickTranslation; /** \brief size in voxels of the entire full-res dataset (not just the current LOD) this parameter is used to compute the opacity correction */ UINTVECTOR3 m_vGlobalSize; //! aspect ratio of the entire dataset (not just the current brick) FLOATVECTOR3 m_vGlobalAspect; /** \brief aspect ratio of the entire dataset of the current LOD (not just the current brick) this parameter is used to compute the opacity correction */ UINTVECTOR3 m_vLODSize; //! the positions of the transformed vertices of the brick bounding box VERTEX_FORMAT m_pfBBOXVertex[8]; //! the positions of the untransformed vertices of the brick bounding box FLOATVECTOR3 m_pfBBOXStaticVertex[8]; //! the aspect ratio of this brick FLOATVECTOR3 m_vAspect; //! the size in voxels of the current brick UINTVECTOR3 m_vSize; /** \brief minimum texture coordinates usualy, this is not (0,0,0) due to brick overlaps */ FLOATVECTOR3 m_vTexCoordMin; /** \brief maximum texture coordinates usualy, this is not (1,1,1) due to brick overlaps */ FLOATVECTOR3 m_vTexCoordMax; //! a user defined clip plane PLANE m_ClipPlane; //! specifies if the clip plane above is actually used bool m_bClipPlaneEnabled; //! part of a transparent mesh to be interleaved with the volume SortIndexPVec m_mesh; //! should the volume be clipped on the clipping plane? bool m_bClipVolume; //! should the mesh be clipped on the clipping plane? bool m_bClipMesh; //! Computes the transformed vertices m_pfBBOXVertex from m_pfBBOXStaticVertex virtual void InitBBOX(); //! Updates the internal matrix states and recomputes the geometry void MatricesUpdated(); /** \brief static method that splits a single triangle a,b,c at the plane (normal,D) \param a the first vertex of the source triangle \param b the second vertex of the source triangle \param c the third vertex of the source triangle \param normal normal of the splitting plane \param D distance of the splitting plane to the origin \result the vertices of the split triangles */ static std::vector SplitTriangle(VERTEX_FORMAT a, VERTEX_FORMAT b, VERTEX_FORMAT c, const VECTOR3 &normal, const float D); /** \brief static method that clips a number of triangles at the plane (normal,D) \param in the vertex list of the triangles, every three vertices are interpreted as one triable \param normal normal of the splitting plane \param D distance of the splitting plane to the origin \result the vertices of the split triangles */ static std::vector ClipTriangles(const std::vector &in, const VECTOR3 &normal, const float D); /** \brief static method that checks if a ray intersects a plane \param la start point of the ray \param lb end point of the ray \param normal normal of the plane \param D distance of the splitting plane to the origin \param hit output parameter that holds the intersection point, undfined if no intersection is found \result true iff the ray intersects the plane */ static bool RayPlaneIntersection(const VERTEX_FORMAT &la, const VERTEX_FORMAT &lb, const FLOATVECTOR3 &n, const float D, VERTEX_FORMAT &hit); /** \brief Tests if a point is inside a AABB given min & max \param min the min coordinates of the AABB \param max the max coordinates of the AABB \param point the point to be tested \result true iff the point is inside this volume */ static bool isInsideAABB(const FLOATVECTOR3& min, const FLOATVECTOR3& max, const FLOATVECTOR3& point); void SortMeshWithoutVolume(std::vector& list); static void MeshEntryToVertexFormat(std::vector& list, const RenderMesh* mesh, size_t startIndex, bool bClipMesh=false); }; }; #endif // SBVRGEOGEN_H ImageVis3D-3.1.0/Tuvok/Renderer/GPUObject.h0000644000175000017500000000351712320456500020074 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GPUObject.h \author Jens Krueger SCI Institute University of Utah \date September 2008 */ #pragma once #ifndef GPUOBJECT_H #define GPUOBJECT_H #include "../StdTuvokDefines.h" namespace tuvok { /** Base for all types which will utilize GPU memory. * Forces children to keep track of memory use on both the CPU and GPU, * allowing us to use as much memory as will be possible without swapping. */ class GPUObject { public: virtual ~GPUObject() {} virtual uint64_t GetCPUSize() const = 0; virtual uint64_t GetGPUSize() const = 0; }; }; #endif // GPUOBJECT_H ImageVis3D-3.1.0/Tuvok/Renderer/TFScaling.cpp0000644000175000017500000000451612320456500020457 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2009 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file TFScaling \author Tom Fogal SCI Institute University of Utah \brief Functions for scaling transfer functions. */ #include #include "TFScaling.h" #include "IO/Dataset.h" #include "IO/TransferFunction1D.h" namespace tuvok { float scale_bit_width(const Dataset& ds, bool downsample, const TransferFunction1D& tf) { size_t max_value = (ds.GetBitWidth() != 8 && downsample) ? 65536 : tf.GetSize(); uint32_t max_range = static_cast(1 << ds.GetBitWidth()); return (ds.GetBitWidth() != 8 && downsample) ? 1.0f : static_cast(max_range) / static_cast(max_value); } std::pair scale_bias_and_scale(Dataset& ds) { std::pair retval; // bias by the minimum value in the dataset. retval.first = static_cast(-(ds.GetRange().first)); // scale by the full range of the data retval.second = fabsf(static_cast(ds.GetRange().first)) + fabsf(static_cast(ds.GetRange().second)); return retval; } }; // tuvok namespace. ImageVis3D-3.1.0/Tuvok/Renderer/RenderMesh.h0000644000175000017500000001536512320456500020352 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : RenderMesh.h //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #pragma once #ifndef RENDERMESH_H #define RENDERMESH_H #include "../Basics/Mesh.h" #include #include namespace tuvok { class RenderMesh; class SortIndex { public: size_t m_index; FLOATVECTOR3 m_centroid; const RenderMesh* m_mesh; float fDepth; SortIndex(size_t index, const RenderMesh* m); void UpdateDistance(); protected: void ComputeCentroid(); }; inline bool DistanceSortOver(const SortIndex* e1, const SortIndex* e2) { return e1->fDepth > e2->fDepth; } inline bool DistanceSortUnder(const SortIndex* e1, const SortIndex* e2) { return e1->fDepth < e2->fDepth; } typedef std::vector< SortIndex > SortIndexVec; typedef std::vector< SortIndex* > SortIndexPVec; class RenderMesh : public Mesh { public: RenderMesh(const Mesh& other, float fTransTreshhold=1.0f); RenderMesh(const VertVec& vertices, const NormVec& normals, const TexCoordVec& texcoords, const ColorVec& colors, const IndexVec& vIndices, const IndexVec& nIndices, const IndexVec& tIndices, const IndexVec& cIndices, bool bBuildKDTree, bool bScaleToUnitCube, const std::string& desc, EMeshType meshType, float fTransTreshhold=1.0f); virtual void InitRenderer() = 0; virtual void RenderOpaqueGeometry() = 0; virtual void RenderTransGeometryFront() = 0; virtual void RenderTransGeometryBehind() = 0; virtual void RenderTransGeometryInside() = 0; void SetActive(bool bActive) {m_bActive = bActive;} bool GetActive() const {return m_bActive;} void SetTransTreshhold(float fTransTreshhold); float GetTransTreshhold() const {return m_fTransTreshhold;} virtual void SetDefaultColor(const FLOATVECTOR4& color); // ******************************************************************* // ****** the calls below are only used for transparent meshes ******* // ******************************************************************* /**\brief Specifies the position of the volume's AABB * \param min the min coodinates of the AABB * \param max the max coodinates of the AABB */ void SetVolumeAABB(const FLOATVECTOR3& min, const FLOATVECTOR3& max); /**\brief Accepts the transformed position of the viewer relative to the * untransformed volume * \param viewPoint the transformedposition of the viewer relative to the * untransformed volume */ void SetUserPos(const FLOATVECTOR3& viewPoint); /**\brief Returns the list of all polygons in front of the AABB as * computed by SetUserPos * \param sorted if true then the resulting list is depth sorted * \result the points in front of the AABB */ const SortIndexPVec& GetFrontPointList(bool bSorted); /**\brief Returns the list of all polygons inside the AABB as * computed by SetUserPos * \param sorted if true then the resulting list is depth sorted * \result the points inside the AABB */ const SortIndexPVec& GetInPointList(bool bSorted); /**\brief Returns the list of all polygons behind the AABB as * computed by SetUserPos this list is nor depth sorted * \param sorted if true then the resulting list is depth sorted * \result the points behind the AABB */ const SortIndexPVec& GetBehindPointList(bool bSorted); virtual void GeometryHasChanged(bool bUpdateAABB, bool bUpdateKDtree); void EnableOverSorting(bool bOver) { if (m_bSortOver != bOver) { m_BackSorted = false; m_InSorted = false; m_FrontSorted = false; m_bSortOver = bOver; } } bool IsCompletelyOpaque() { return m_splitIndex == m_Data.m_VertIndices.size(); } protected: bool m_bActive; size_t m_splitIndex; float m_fTransTreshhold; bool m_bSortOver; bool m_BackSorted; bool m_InSorted; bool m_FrontSorted; void Swap(size_t i, size_t j); bool isTransparent(size_t i); void SplitOpaqueFromTransparent(); // transparent meshes FLOATVECTOR3 m_viewPoint; FLOATVECTOR3 m_VolumeMin; FLOATVECTOR3 m_VolumeMax; bool m_QuadrantsDirty; bool m_FIBHashDirty; SortIndexVec m_allPolys; std::vector< SortIndexPVec > m_Quadrants; SortIndexPVec m_FrontPointList; SortIndexPVec m_InPointList; SortIndexPVec m_BehindPointList; /** If the mesh contains transparent parts this call creates * 27 * lists pointing to parts of the transparent mesh in the 27 * quadrants * defined by the 6 planes of the volume's AABB */ void SortTransparentDataIntoQuadrants(); /** If the mesh contains transparent parts this call creates * three lists pointing to parts of the transparent mesh * one list conatins all triangles in front of the AABB specified * by min and max as viewed from viewPoint. */ void RehashTransparentData(); /** Sorts a point into one of the 27 quadrants in and around the volume * \param pos of the point to be sorted * \result the quadrant index */ size_t PosToQuadrant(const FLOATVECTOR3& pos); /** Appends a quadrant with index "index" to "target" * \param target the list to append to * \param index the index of the quadrant to be appended to "target" */ void Append(SortIndexPVec& target, size_t index) { target.insert(target.end(), m_Quadrants[index].begin(), m_Quadrants[index].end()); } void Front(int index,...); friend class SortIndex; }; } #endif // RENDERMESH_H ImageVis3D-3.1.0/Tuvok/Renderer/Context.h0000644000175000017500000000376412320456500017742 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file Context.h \author Tom Fogal SCI Institute University of Utah \brief Base class for holding comparative context information. */ #pragma once #ifndef TUVOK_CONTEXT_ID_H #define TUVOK_CONTEXT_ID_H #include "StateManager.h" #include namespace tuvok { class Context { public: Context(int iShareGroupID) : m_iShareGroupID(iShareGroupID) {} virtual ~Context() {} std::shared_ptr GetStateManager() {return m_pState;} int GetShareGroupID() const {return m_iShareGroupID;} protected: static std::map> contextMap; std::shared_ptr m_pState; const void* ctx; /// will be GLXContext, HGLRC, or Device int m_iShareGroupID; }; } #endif // TUVOK_CONTEXT_ID_H ImageVis3D-3.1.0/Tuvok/Renderer/RenderMesh.cpp0000644000175000017500000004323112320456500020676 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2010 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //! File : RenderMesh.cpp //! Author : Jens Krueger //! IVCI & DFKI & MMCI, Saarbruecken //! SCI Institute, University of Utah //! Date : July 2010 // //! Copyright (C) 2010 DFKI, MMCI, SCI Institute #include "RenderMesh.h" #include "KDTree.h" #include #include using namespace tuvok; SortIndex::SortIndex(size_t index, const RenderMesh* m) : m_index(index), m_mesh(m) { ComputeCentroid(); } void SortIndex::UpdateDistance() { fDepth = (m_mesh->m_viewPoint-m_centroid).length(); } void SortIndex::ComputeCentroid() { size_t vertexCount = m_mesh->GetVerticesPerPoly(); m_centroid = FLOATVECTOR3(0,0,0); for (size_t iVertex = 0;iVertexGetVertices()[m_mesh->GetVertexIndices()[m_index+iVertex]]; } m_centroid /= float(vertexCount); } RenderMesh::RenderMesh(const Mesh& other, float fTransTreshhold) : Mesh(other.GetVertices(),other.GetNormals(), other.GetTexCoords(),other.GetColors(), other.GetVertexIndices(),other.GetNormalIndices(), other.GetTexCoordIndices(),other.GetColorIndices(), false, false, other.Name(),other.GetMeshType()), m_bActive(true), m_splitIndex(0), m_fTransTreshhold(fTransTreshhold), m_bSortOver(false), m_viewPoint(FLOATVECTOR3(0,0,0)), m_VolumeMin(FLOATVECTOR3(0,0,0)), m_VolumeMax(FLOATVECTOR3(0,0,0)), m_QuadrantsDirty(true), m_FIBHashDirty(true) { m_Quadrants.resize(27); SplitOpaqueFromTransparent(); GeometryHasChanged(other.GetKDTree() != 0, other.GetKDTree() != 0); } RenderMesh::RenderMesh(const VertVec& vertices, const NormVec& normals, const TexCoordVec& texcoords, const ColorVec& colors, const IndexVec& vIndices, const IndexVec& nIndices, const IndexVec& tIndices, const IndexVec& cIndices, bool bBuildKDTree, bool bScaleToUnitCube, const std::string& desc, EMeshType meshType, float fTransTreshhold) : Mesh(vertices,normals,texcoords,colors, vIndices,nIndices,tIndices,cIndices, false, bScaleToUnitCube,desc,meshType), m_bActive(true), m_splitIndex(0), m_fTransTreshhold(fTransTreshhold), m_bSortOver(false), m_viewPoint(FLOATVECTOR3(0,0,0)), m_VolumeMin(FLOATVECTOR3(0,0,0)), m_VolumeMax(FLOATVECTOR3(0,0,0)), m_QuadrantsDirty(true), m_FIBHashDirty(true) { m_Quadrants.resize(27); SplitOpaqueFromTransparent(); if (bBuildKDTree) ComputeKDTree(); } void RenderMesh::Swap(size_t i, size_t j) { for (size_t iVertex = 0;iVertex= m_fTransTreshhold) || (prevAlpha >= m_fTransTreshhold && m_DefColor.w < m_fTransTreshhold))) { SplitOpaqueFromTransparent(); if (m_KDTree) ComputeKDTree(); } } void RenderMesh::GeometryHasChanged(bool bUpdateAABB, bool bUpdateKDtree) { Mesh::GeometryHasChanged(bUpdateAABB, bUpdateKDtree); // create sortindex list with all tris m_allPolys.clear(); for (size_t i = m_splitIndex;ibox , ym_centroid); m_Quadrants[index].push_back(&(*poly)); } m_InPointList = m_Quadrants[13]; } inline size_t RenderMesh::PosToQuadrant(const FLOATVECTOR3& pos) { size_t index = 0; if (pos.x < m_VolumeMin.x) index = 0; else if (pos.x > m_VolumeMax.x) index = 2; else index = 1; if (pos.y < m_VolumeMin.y) index += 0; else if (pos.y > m_VolumeMax.y) index += 6; else index += 3; if (pos.z < m_VolumeMin.z) index += 0; else if (pos.z > m_VolumeMax.z) index += 18; else index += 9; return index; } #define END 27 void RenderMesh::Front(int index,...) { va_list indices; va_start(indices,index); for (int i = 0;i<27;i++) { if (i == 13) continue; // center quadrant if (i == index) { Append(m_FrontPointList, i); index = va_arg(indices,int); } else { Append(m_BehindPointList, i); } } va_end(indices); } void RenderMesh::RehashTransparentData() { m_FIBHashDirty = false; for (SortIndexVec::iterator poly = m_allPolys.begin(); poly != m_allPolys.end(); poly++) { poly->UpdateDistance(); } m_FrontPointList.clear(); m_BehindPointList.clear(); // is the entire mesh opaque ? if (IsCompletelyOpaque()) return; size_t index = PosToQuadrant(m_viewPoint); switch (index) { case 0 : Front( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11, 12, 15, 18,19,20, 21, 24, END); break; case 1 : Front( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11, 18,19,20, END); break; case 2 : Front( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11, 14, 17, 18,19,20, 23, 26, END); break; case 3 : Front( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 15, 18, 21, 24, END); break; case 4 : Front( 0, 1, 2, 3, 4, 5, 6, 7, 8, END); break; case 5 : Front( 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 14, 17, 20, 23, 26, END); break; case 6 : Front( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 15,16,17, 18, 21, 24,25,26, END); break; case 7 : Front( 0, 1, 2, 3, 4, 5, 6, 7, 8, 15,16,17, 24,25,26, END); break; case 8 : Front( 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 14, 15,16,17, 20, 23, 24,25,26, END); break; case 9 : Front( 0, 1, 2, 3, 6, 9,10,11, 12, 15, 18,19,20, 21, 24, END); break; case 10 : Front( 0, 1, 2, 9,10,11, 18,19,20, END); break; case 11 : Front( 0, 1, 2, 5, 8, 9,10,11, 14, 17, 18,19,20, 23, 26, END); break; case 12 : Front( 0, 3, 6, 9, 12, 15, 18, 21, 24, END); break; case 13 : Front(END); break; case 14 : Front( 2, 5, 8, 11, 14, 17, 20, 23, 26, END); break; case 15 : Front( 0, 3, 6, 7, 8, 9, 12, 15,16,17, 18, 21, 24,25,26, END); break; case 16 : Front( 6, 7, 8, 15,16,17, 24,25,26, END); break; case 17 : Front( 2, 5, 6, 7, 8, 11, 14, 15,16,17, 20, 23, 24,25,26, END); break; case 18 : Front( 0, 1, 2, 3, 6, 9,10,11, 12, 15, 18,19,20, 21,22,23, 24,25,26, END); break; case 19 : Front( 0, 1, 2, 9,10,11, 18,19,20, 21,22,23, 24,25,26, END); break; case 20 : Front( 0, 1, 2, 5, 8, 9,10,11, 14, 17, 18,19,20, 21,22,23, 24,25,26, END); break; case 21 : Front( 0, 3, 6, 9, 12, 15, 18,19,20, 21,22,23, 24,25,26, END); break; case 22 : Front(18,19,20, 21,22,23, 24,25,26, END); break; case 23 : Front( 2, 5, 8, 11, 14, 17, 18,19,20, 21,22,23, 24,25,26, END); break; case 24 : Front( 0, 3, 6, 7, 8, 9, 12, 15,16,17, 18,19,20, 21,22,23, 24,25,26, END); break; case 25 : Front( 6, 7, 8, 15,16,17, 18,19,20, 21,22,23, 24,25,26, END); break; case 26 : Front( 2, 5, 6, 7, 8, 11, 14, 15,16,17, 18,19,20, 21,22,23, 24,25,26, END); break; } m_BackSorted = false; m_InSorted = false; m_FrontSorted = false; } const SortIndexPVec& RenderMesh::GetFrontPointList(bool bSorted) { if (m_QuadrantsDirty) SortTransparentDataIntoQuadrants(); if (m_FIBHashDirty) RehashTransparentData(); if (bSorted && !m_FrontSorted) { std::sort(m_FrontPointList.begin(), m_FrontPointList.end(), (m_bSortOver) ? DistanceSortOver : DistanceSortUnder); m_FrontSorted = true; } return m_FrontPointList; } const SortIndexPVec& RenderMesh::GetInPointList(bool bSorted) { if (m_QuadrantsDirty) SortTransparentDataIntoQuadrants(); if (m_FIBHashDirty) RehashTransparentData(); if (bSorted && !m_InSorted) { std::sort(m_InPointList.begin(), m_InPointList.end(), (m_bSortOver) ? DistanceSortOver : DistanceSortUnder); m_InSorted = true; } return m_InPointList; } const SortIndexPVec& RenderMesh::GetBehindPointList(bool bSorted) { if (m_QuadrantsDirty) SortTransparentDataIntoQuadrants(); if (m_FIBHashDirty) RehashTransparentData(); if (bSorted && !m_BackSorted) { std::sort(m_BehindPointList.begin(), m_BehindPointList.end(), (m_bSortOver) ? DistanceSortOver : DistanceSortUnder); m_BackSorted = true; } return m_BehindPointList; } ImageVis3D-3.1.0/Tuvok/Renderer/DX/0000755000175000017500000000000012320456500016446 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/Renderer/DX/DXTexture.cpp0000644000175000017500000000352512320456500021053 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DXTexture.cpp \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #if defined(_WIN32) && defined(USE_DIRECTX) #include "DXTexture.h" using namespace tuvok; DXTexture::~DXTexture() { Delete(); } void DXTexture::Delete() { SAFE_RELEASE(m_pTexture_SRV); } void DXTexture::Bind(ID3D10EffectShaderResourceVariable* pSRVar) { m_pSRVarBound = pSRVar; m_pSRVarBound->SetResource( m_pTexture_SRV ); } void DXTexture::UnBind() { if (m_pSRVarBound) { m_pSRVarBound->SetResource( NULL ); m_pSRVarBound=NULL; } } #endif // _WIN32 && USE_DIRECTX ImageVis3D-3.1.0/Tuvok/Renderer/DX/DXTexture1D.cpp0000644000175000017500000001005612320456500021235 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DXTexture1D.cpp \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #if defined(_WIN32) && defined(USE_DIRECTX) #include "DXTexture1D.h" #include using namespace tuvok; DXTexture1D::DXTexture1D(ID3D10Device* pd3dDevice, uint32_t iSize, DXGI_FORMAT format) : DXTexture(pd3dDevice, g_dx10Format[int(format)].m_iByteSize, false), m_iSize(iSize), m_pTexture(NULL) { // create texture and fill with zeros D3D10_TEXTURE1D_DESC texDesc = { m_iSize, 1, 1, format, D3D10_USAGE_DEFAULT, D3D10_BIND_SHADER_RESOURCE, 0, 0 }; m_pd3dDevice->CreateTexture1D( &texDesc, NULL, &m_pTexture); // create shader resource views D3D10_SHADER_RESOURCE_VIEW_DESC SRVDesc = { texDesc.Format, D3D10_SRV_DIMENSION_TEXTURE1D, 0, 1 }; m_pd3dDevice->CreateShaderResourceView( m_pTexture, &SRVDesc, &m_pTexture_SRV ); } DXTexture1D::DXTexture1D(ID3D10Device* pd3dDevice, uint32_t iSize, DXGI_FORMAT format, const void* pInitialData, bool bIsReadOnly) : DXTexture(pd3dDevice, g_dx10Format[int(format)].m_iByteSize, bIsReadOnly), m_iSize(iSize), m_pTexture(NULL) { assert(pInitialData || !bIsReadOnly); // create texture (if no inital data is specified the textures are filled with zeros) D3D10_TEXTURE1D_DESC texDesc = { m_iSize, 1, 1, format, bIsReadOnly ? D3D10_USAGE_IMMUTABLE : D3D10_USAGE_DEFAULT, D3D10_BIND_SHADER_RESOURCE, 0, 0 }; D3D10_SUBRESOURCE_DATA vbInitDataTex = { pInitialData, 0, 0 }; m_pd3dDevice->CreateTexture1D( &texDesc, pInitialData == NULL ? NULL : &vbInitDataTex, &m_pTexture); // create shader resource views D3D10_SHADER_RESOURCE_VIEW_DESC SRVDesc = { texDesc.Format, D3D10_SRV_DIMENSION_TEXTURE2D, 0, 1 }; m_pd3dDevice->CreateShaderResourceView( m_pTexture, &SRVDesc, &m_pTexture_SRV ); } DXTexture1D::~DXTexture1D() { Delete(); } void DXTexture1D::SetData(const void *pData) { assert(!m_bIsReadOnly); // Create a staging resource to copy the data ID3D10Texture1D* pStagingTexture = NULL; D3D10_TEXTURE1D_DESC desc; m_pTexture->GetDesc(&desc); desc.Usage = D3D10_USAGE_STAGING; desc.BindFlags = 0; desc.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE; m_pd3dDevice->CreateTexture1D( &desc, NULL, &pStagingTexture ); char* pcData = (char*)pData; void *pMapData; pStagingTexture->Map(0, D3D10_MAP_WRITE, 0, &pMapData ); char *pStagingData = (char*)pMapData; size_t iDataSize = m_iSizePerElement * m_iSize; memcpy(pStagingData, pcData, iDataSize); pStagingTexture->Unmap(0); m_pd3dDevice->CopyResource(m_pTexture, pStagingTexture); SAFE_RELEASE(pStagingTexture); } void DXTexture1D::Delete() { SAFE_RELEASE(m_pTexture); } #endif // _WIN32 && USE_DIRECTX ImageVis3D-3.1.0/Tuvok/Renderer/DX/DXTexture3D.cpp0000644000175000017500000001177712320456500021252 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DXTexture3D.cpp \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #if defined(_WIN32) && defined(USE_DIRECTX) #include "DXTexture3D.h" #include using namespace tuvok; DXTexture3D::DXTexture3D(ID3D10Device* pd3dDevice, uint32_t iSizeX, uint32_t iSizeY, uint32_t iSizeZ, DXGI_FORMAT format) : DXTexture(pd3dDevice, g_dx10Format[int(format)].m_iByteSize, false), m_iSizeX(iSizeX), m_iSizeY(iSizeY), m_iSizeZ(iSizeZ), m_pTexture(NULL) { // create texture and fill with zeros D3D10_TEXTURE3D_DESC texDesc = { m_iSizeX, m_iSizeY, m_iSizeZ, 1, format, D3D10_USAGE_DEFAULT, D3D10_BIND_SHADER_RESOURCE, 0, 0 }; m_pd3dDevice->CreateTexture3D( &texDesc, NULL, &m_pTexture); // create shader resource views D3D10_SHADER_RESOURCE_VIEW_DESC SRVDesc = { texDesc.Format, D3D10_SRV_DIMENSION_TEXTURE2D, 0, 1 }; m_pd3dDevice->CreateShaderResourceView( m_pTexture, &SRVDesc, &m_pTexture_SRV ); } DXTexture3D::DXTexture3D(ID3D10Device* pd3dDevice, uint32_t iSizeX, uint32_t iSizeY, uint32_t iSizeZ, DXGI_FORMAT format, const void* pInitialData, bool bIsReadOnly) : DXTexture(pd3dDevice, g_dx10Format[int(format)].m_iByteSize, bIsReadOnly), m_iSizeX(iSizeX), m_iSizeY(iSizeY), m_iSizeZ(iSizeZ), m_pTexture(NULL) { assert(pInitialData || !bIsReadOnly); // create texture (if no inital data is spcified the textures are filled with zeros) D3D10_TEXTURE3D_DESC texDesc = { m_iSizeX, m_iSizeY, m_iSizeZ, 1, format, bIsReadOnly ? D3D10_USAGE_IMMUTABLE : D3D10_USAGE_DEFAULT, D3D10_BIND_SHADER_RESOURCE, 0, 0 }; D3D10_SUBRESOURCE_DATA vbInitDataTex = { pInitialData, m_iSizePerElement*m_iSizeX, m_iSizePerElement*m_iSizeX*m_iSizeY }; m_pd3dDevice->CreateTexture3D( &texDesc, pInitialData == NULL ? NULL : &vbInitDataTex, &m_pTexture); // create shader resource views D3D10_SHADER_RESOURCE_VIEW_DESC SRVDesc = { texDesc.Format, D3D10_SRV_DIMENSION_TEXTURE2D, 0, 1 }; m_pd3dDevice->CreateShaderResourceView( m_pTexture, &SRVDesc, &m_pTexture_SRV ); } DXTexture3D::~DXTexture3D() { Delete(); } void DXTexture3D::SetData(const void *pData) { assert(!m_bIsReadOnly); // Create a staging resource to copy the data ID3D10Texture3D* pStagingTexture = NULL; D3D10_TEXTURE3D_DESC desc; m_pTexture->GetDesc(&desc); desc.Usage = D3D10_USAGE_STAGING; desc.BindFlags = 0; desc.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE; m_pd3dDevice->CreateTexture3D( &desc, NULL, &pStagingTexture ); char* pcData = (char*)pData; D3D10_MAPPED_TEXTURE3D map; pStagingTexture->Map(0, D3D10_MAP_WRITE, 0, &map ); if (map.RowPitch == m_iSizePerElement * m_iSizeX && map.DepthPitch == m_iSizePerElement * m_iSizeX * m_iSizeY) { char *pStagingData = (char*)map.pData; size_t iDataSize = m_iSizePerElement * m_iSizeX * m_iSizeY * m_iSizeZ; memcpy(pStagingData, pcData, iDataSize); } else { for (unsigned int z = 0;zUnmap(0); m_pd3dDevice->CopyResource(m_pTexture, pStagingTexture); SAFE_RELEASE(pStagingTexture); } void DXTexture3D::Delete() { SAFE_RELEASE(m_pTexture); } #endif // _WIN32 && USE_DIRECTX ImageVis3D-3.1.0/Tuvok/Renderer/DX/DXTexture3D.h0000644000175000017500000000500012320456500020675 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DXTexture3D.h \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #pragma once #if defined(_WIN32) && defined(USE_DIRECTX) #ifndef DXTEXTURE3D_H #define DXTEXTURE3D_H #include "../../StdTuvokDefines.h" #include "DXTexture.h" #include "../../Basics/Vectors.h" namespace tuvok { class DXTexture3D : public DXTexture { public: DXTexture3D(ID3D10Device* pd3dDevice, uint32_t iSizeX, uint32_t iSizeY, uint32_t iSizeZ, DXGI_FORMAT format); DXTexture3D(ID3D10Device* pd3dDevice, uint32_t iSizeX, uint32_t iSizeY, uint32_t iSizeZ, DXGI_FORMAT format, const void* pInitialData, bool bIsReadOnly=true); virtual ~DXTexture3D(); virtual void SetData(const void *pData); virtual void Delete(); virtual uint64_t GetCPUSize() {return uint64_t(m_iSizeX*m_iSizeY*m_iSizeZ*m_iSizePerElement);} virtual uint64_t GetGPUSize() {return uint64_t(m_iSizeX*m_iSizeY*m_iSizeZ*m_iSizePerElement);} UINTVECTOR3 GetSize() const {return UINTVECTOR3(uint32_t(m_iSizeX),uint32_t(m_iSizeY),uint32_t(m_iSizeZ));} protected: uint32_t m_iSizeX; uint32_t m_iSizeY; uint32_t m_iSizeZ; ID3D10Texture3D* m_pTexture; }; }; //namespace tuvok #endif // DXTEXTURE3D_H #endif // _WIN32 && USE_DIRECTX ImageVis3D-3.1.0/Tuvok/Renderer/DX/DXSBVR.h0000644000175000017500000000471412320456500017635 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DXSBVR.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date November 2008 */ #pragma once #if defined(_WIN32) && defined(USE_DIRECTX) #ifndef DXSBVR_H #define DXSBVR_H #include "../../StdTuvokDefines.h" #include "DXRenderer.h" namespace tuvok { /** \class DXSBVR * DirectX 10 GPU SBVR. * * DXSBVR is a GPU slice based renderer for volumetric scalar data which uses HLSL. */ class DXSBVR : public DXRenderer { public: /** Constructs a VRer with immediate redraw, and * wireframe mode off. * \param pMasterController message routing object * \param bUseOnlyPowerOfTwo force power of two textures (compatibility) * \param bDownSampleTo8Bits force 8bit textures (compatibility) */ DXSBVR(MasterController* pMasterController, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder); virtual ~DXSBVR(); virtual ERendererType GetRendererType() {return RT_SBVR;} protected: virtual void Render3DInLoop(size_t iCurrentBrick, EStereoID eStereoID); virtual void RenderHQMIPInLoop(const Brick& b); virtual void UpdateLightParamsInShaders(); }; }; //namespace tuvok #endif // DXSBVR_H #endif // _WIN32 && USE_DIRECTX ImageVis3D-3.1.0/Tuvok/Renderer/DX/DXRenderer.cpp0000644000175000017500000002351712320456500021164 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DXRenderer.cpp \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #if defined(_WIN32) && defined(USE_DIRECTX) #include #include #include #include #include "DXRenderer.h" #include "DXTexture1D.h" #include #include #include "DXContext.h" using namespace std; using namespace tuvok; DXRenderer::DXRenderer(MasterController* pMasterController, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder) : AbstrRenderer(pMasterController, bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder), m_hWnd(NULL), m_hInst(NULL), m_driverType(D3D10_DRIVER_TYPE_NULL), m_pd3dDevice(NULL), m_pSwapChain(NULL), m_pRenderTargetView(NULL), m_pDXGIFactory(NULL) { } DXRenderer::~DXRenderer() { } void DXRenderer::Cleanup() { OnReleasingSwapChain(); OnDestroyDevice(); } bool DXRenderer::InitializeDirectX() { // next destroy the dx system we may have created already if (m_pd3dDevice) OnDestroyDevice(); // next initialize the DirectX subsystem HRESULT hr = S_OK; UINT createDeviceFlags = 0; #ifdef _DEBUG createDeviceFlags |= D3D10_CREATE_DEVICE_DEBUG; #endif D3D10_DRIVER_TYPE driverTypes[] = { D3D10_DRIVER_TYPE_HARDWARE, D3D10_DRIVER_TYPE_REFERENCE, }; UINT numDriverTypes = sizeof( driverTypes ) / sizeof( driverTypes[0] ); m_pd3dDevice = NULL; for( UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++ ) { m_driverType = driverTypes[driverTypeIndex]; hr = DynamicDX::D3D10CreateDevice( NULL, m_driverType, NULL, createDeviceFlags, D3D10_SDK_VERSION, &m_pd3dDevice ); if( SUCCEEDED( hr ) ) break; } if( FAILED( hr ) ) return false; hr = DynamicDX::CreateDXGIFactory( IID_IDXGIFactory, ( void** )&m_pDXGIFactory ); if( FAILED( hr ) ) return false; // call the parent std::shared_ptr dxc = std::shared_ptr(new DXContext(m_pd3dDevice)); if (!AbstrRenderer::Initialize(dxc)) { T_ERROR("Error in parent call -> aborting"); return false; } // finally initialize the renderer return OnCreateDevice(); } void DXRenderer::Changed1DTrans() { AbstrRenderer::Changed1DTrans(); } void DXRenderer::Changed2DTrans() { AbstrRenderer::Changed2DTrans(); } void DXRenderer::Resize(const UINTVECTOR2& vWinSize) { // call the parent AbstrRenderer::Resize(vWinSize); // next destroy screen dependent data we may have created already if (m_pSwapChain) OnReleasingSwapChain(); // next create the DirectX swapchain subsystem HRESULT hr = S_OK; // get the dxgi device IDXGIDevice* pDXGIDevice = NULL; hr = m_pd3dDevice->QueryInterface( IID_IDXGIDevice, ( void** )&pDXGIDevice ); if( FAILED( hr ) ) { // TODO report failiure return; } // create a swap chain DXGI_SWAP_CHAIN_DESC SwapChainDesc; ZeroMemory( &SwapChainDesc, sizeof( DXGI_SWAP_CHAIN_DESC ) ); SwapChainDesc.BufferDesc.Width = vWinSize.x; SwapChainDesc.BufferDesc.Height = vWinSize.y; SwapChainDesc.BufferDesc.RefreshRate.Numerator = 60; SwapChainDesc.BufferDesc.RefreshRate.Denominator = 1; SwapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; SwapChainDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; SwapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED; SwapChainDesc.SampleDesc.Count = 1; SwapChainDesc.SampleDesc.Quality = 0; SwapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; SwapChainDesc.BufferCount = 3; SwapChainDesc.OutputWindow = m_hWnd; SwapChainDesc.Windowed = true; SwapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; SwapChainDesc.Flags = 0; hr = m_pDXGIFactory->CreateSwapChain( pDXGIDevice, &SwapChainDesc, &m_pSwapChain ); pDXGIDevice->Release(); pDXGIDevice = NULL; if( FAILED( hr ) ) { // TODO report failiure return; } // Create a render target view ID3D10Texture2D* pBackBuffer; hr = m_pSwapChain->GetBuffer( 0, __uuidof( ID3D10Texture2D ), ( LPVOID* )&pBackBuffer ); if( FAILED( hr ) ) { // TODO report failiure return; } hr = m_pd3dDevice->CreateRenderTargetView( pBackBuffer, NULL, &m_pRenderTargetView ); pBackBuffer->Release(); if( FAILED( hr ) ) { // TODO report failiure return; } m_pd3dDevice->OMSetRenderTargets( 1, &m_pRenderTargetView, NULL ); // Setup the viewport D3D10_VIEWPORT vp; vp.Width = vWinSize.x; vp.Height = vWinSize.y; vp.MinDepth = 0.0f; vp.MaxDepth = 1.0f; vp.TopLeftX = 0; vp.TopLeftY = 0; m_pd3dDevice->RSSetViewports( 1, &vp ); // next initialize the renderer if (!OnResizedSwapChain()) { // TODO report failiure return; } } bool DXRenderer::OnCreateDevice() { return true; } bool DXRenderer::OnResizedSwapChain() { return true; } void DXRenderer::OnReleasingSwapChain() { } void DXRenderer::OnDestroyDevice() { } void DXRenderer::RenderSeperatingLines() { } void DXRenderer::ClearColorBuffer() const { } void DXRenderer::StartFrame() { } bool DXRenderer::Paint() { return AbstrRenderer::Paint(); // TODO } #pragma warning(disable:4100) // disable "unused parameter" warning for now void DXRenderer::EndFrame(RenderRegion* region, bool bNewDataToShow) { // if the image is complete if (bNewDataToShow) { // TODO CompletedASubframe(region); } // show the result if (bNewDataToShow) RerenderPreviousResult(true); // no complete redraw is necessary as we just finished the first pass region->isBlank = false; } FLOATVECTOR3 DXRenderer::Pick(const UINTVECTOR2&) const { T_ERROR("Unimplemented."); // should probably be a logic_error, but catch code isn't expecting that. throw std::runtime_error("Unimplemented."); } void DXRenderer::SetRenderTargetArea(const tuvok::RenderRegion& renderRegion) { } void DXRenderer::SetRenderTargetAreaScissor(const tuvok::RenderRegion& renderRegion) { } void DXRenderer::SetViewPort(UINTVECTOR2, UINTVECTOR2, bool) { } void DXRenderer::RenderBBox(const FLOATVECTOR4 vColor, bool bEpsilonOffset) { } void DXRenderer::RenderBBox(const FLOATVECTOR4 vColor, bool bEpsilonOffset, const FLOATVECTOR3& vCenter, const FLOATVECTOR3& vExtend) { } void DXRenderer::NewFrameClear(const tuvok::RenderRegion& renderRegion) { } void DXRenderer::RenderCoordArrows() { } bool DXRenderer::Execute3DFrame(const tuvok::RenderRegion3D& renderRegion, float &fMsecPassed) { return true; } void DXRenderer::RerenderPreviousResult(bool bTransferToFramebuffer) { } void DXRenderer::DrawBackGradient() { } void DXRenderer::CreateOffscreenBuffers() { } void DXRenderer::SetBrickDepShaderVarsSlice(const UINTVECTOR3& vVoxelCount) { } void DXRenderer::SetDataDepShaderVars() { } void DXRenderer::SetBlendPrecision(EBlendPrecision eBlendPrecision) { if (eBlendPrecision != m_eBlendPrecision) { AbstrRenderer::SetBlendPrecision(eBlendPrecision); // TODO } } bool DXRenderer::LoadAndVerifyShader(string strVSFile, string strFSFile, const std::vector& strDirs, GLSLProgram** pShaderProgram) { return true; } bool DXRenderer::LoadAndVerifyShader(string strVSFile, string strFSFile, GLSLProgram** pShaderProgram, bool bSearchSubdirs) { return true; } void DXRenderer::GeometryPreRender() { } void DXRenderer::GeometryPostRender() { } void DXRenderer::PlaneIn3DPreRender() { } void DXRenderer::PlaneIn3DPostRender() { } bool DXRenderer::LoadFile(const string& strFilename) { if (AbstrRenderer::LoadFile(strFilename)) { // TODO return true; } else return false; } bool DXRenderer::RegisterDataset(Dataset* ds) { if (AbstrRenderer::RegisterDataset(ds)) { // TODO return true; } else return false; } void DXRenderer::Recompose3DView(const tuvok::RenderRegion3D& renderRegion) { } bool DXRenderer::Render3DView() { return true; } void DXRenderer::SetLogoParams(std::string strLogoFilename, int iLogoPos) { AbstrRenderer::SetLogoParams(strLogoFilename, iLogoPos); // TODO } void DXRenderer::ComposeSurfaceImage(EStereoID eStereoID) { } bool DXRenderer::IsVolumeResident(const BrickKey& key) const{ return false; } void DXRenderer::RegisterDerivedClassLuaFunctions( LuaClassRegistration& reg, LuaScripting* ss) { std::string id; id = reg.function(&DXRenderer::SetWinID, "setWinID", "Sets HWND.", false); id = reg.function(&DXRenderer::InitializeDirectX, "initializeDirectX", "DirectX specific initialization function.", false); } #endif // _WIN32 && USE_DIRECTX ImageVis3D-3.1.0/Tuvok/Renderer/DX/DXTexture1D.h0000644000175000017500000000441212320456500020701 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DXTexture1D.h \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #pragma once #if defined(_WIN32) && defined(USE_DIRECTX) #ifndef DXTEXTURE1D_H #define DXTEXTURE1D_H #include "../../StdTuvokDefines.h" #include "DXTexture.h" namespace tuvok { class DXTexture1D : public DXTexture { public: DXTexture1D(ID3D10Device* pd3dDevice, uint32_t iSize, DXGI_FORMAT format); DXTexture1D(ID3D10Device* pd3dDevice, uint32_t iSize, DXGI_FORMAT format, const void* pInitialData, bool bIsReadOnly=true); virtual ~DXTexture1D(); virtual void SetData(const void *pData); virtual void Delete(); virtual uint64_t GetCPUSize() {return uint64_t(m_iSize*m_iSizePerElement);} virtual uint64_t GetGPUSize() {return uint64_t(m_iSize*m_iSizePerElement);} uint32_t GetSize() const {return uint32_t(m_iSize);} protected: uint32_t m_iSize; ID3D10Texture1D* m_pTexture; }; }; //namespace tuvok #endif // DXTEXTURE1D_H #endif // _WIN32 && USE_DIRECTX ImageVis3D-3.1.0/Tuvok/Renderer/DX/DXTexture.h0000644000175000017500000000606212320456500020517 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DXTexture.h \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #pragma once #if defined(_WIN32) && defined(USE_DIRECTX) #ifndef DXTEXTURE_H #define DXTEXTURE_H #include "../../StdTuvokDefines.h" #include "DXObject.h" namespace tuvok { /** \class DXTexture * Abstracted texture usage. * * DXTexture loads and unloads textures from the GPU. */ class DXTexture : public DXObject { public: /** Constructs an invalid texture. * A texture is created with an invalid GL identifier. No data are * pushed to the GPU. Derived classes are expected to generate the * texture in their constructor[s]. * @param iSizePerElement bits per texel. Used to track memory size of the texture. */ DXTexture(ID3D10Device* pd3dDevice, uint32_t iSizePerElement, bool bIsReadOnly) : m_pd3dDevice(pd3dDevice), m_iSizePerElement(iSizePerElement), m_bIsReadOnly(bIsReadOnly), m_pTexture_SRV(NULL), m_pSRVarBound(NULL) {} virtual ~DXTexture(); virtual void Delete(); /** Initializes the texture data with the given data. */ virtual void SetData(const void *pixels) = 0; virtual void Bind(ID3D10EffectShaderResourceVariable* pSRVar); virtual void UnBind(); protected: ID3D10Device* m_pd3dDevice; uint32_t m_iSizePerElement; bool m_bIsReadOnly; ID3D10ShaderResourceView* m_pTexture_SRV; ID3D10EffectShaderResourceVariable* m_pSRVarBound; }; }; //namespace tuvok #endif // DXTEXTURE_H #endif // _WIN32 && USE_DIRECTX ImageVis3D-3.1.0/Tuvok/Renderer/DX/DXObject.h0000644000175000017500000000365512320456500020272 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DXObject.h \author Jens Krueger SCI Institute University of Utah \date September 2008 */ #pragma once #if defined(_WIN32) && defined(USE_DIRECTX) #ifndef DXOBJECT_H #define DXOBJECT_H #include "../../StdTuvokDefines.h" #include "../GPUObject.h" #include "../../Basics/DynamicDX.h" namespace tuvok { /** Base for all DirectX types which will utilize GPU memory. * Forces children to keep track of memory use on both the CPU and GPU, * allowing us to use as much memory as will be possible without swapping. */ class DXObject : public GPUObject { public: virtual ~DXObject() {} }; }; //namespace tuvok #endif // DXOBJECT_H #endif // _WIN32 && USE_DIRECTX ImageVis3D-3.1.0/Tuvok/Renderer/DX/DXRenderer.h0000644000175000017500000001501112320456500020617 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DXRenderer.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date August 2008 */ #pragma once #if defined(_WIN32) && defined(USE_DIRECTX) #ifndef DXRENDERER_H #define DXRENDERER_H #include #include "../../StdTuvokDefines.h" #include "../GPUMemMan/GPUMemMan.h" #include "../AbstrRenderer.h" #include "../../Basics/DynamicDX.h" namespace tuvok { class DXTexture1D; class MasterController; class DXRenderer : public AbstrRenderer { public: DXRenderer(MasterController* pMasterController, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder); virtual ~DXRenderer(); virtual bool InitializeDirectX(); virtual void Changed1DTrans(); virtual void Changed2DTrans(); /** Set the bit depth mode of the offscreen buffer used for blending. Causes a full redraw. */ virtual void SetBlendPrecision(EBlendPrecision eBlendPrecision); /** Deallocates GPU memory allocated during the rendering process. */ virtual void Cleanup(); /** Paint the image */ virtual bool Paint(); /// creates a dataset and registers it with this renderer. virtual bool LoadFile(const std::string& filename); /// registers the dataset with this renderer. this renderer then 'owns' it /// and will handle deletion. virtual bool RegisterDataset(Dataset* ds); /** Change the size of the FBO we render to. Any previous image is * destroyed, causing a full redraw on the next render. * \param vWinSize new width and height of the view window */ virtual void Resize(const UINTVECTOR2& vWinSize); virtual void SetLogoParams(std::string strLogoFilename, int iLogoPos); virtual bool IsVolumeResident(const BrickKey& key) const; void SetWinID(HWND winId) {m_hWnd = winId;} void FixedFunctionality() const { /** @todo implement */ } virtual void SyncStateManager() { /** @todo implement */ } virtual bool CropDataset(const std::string&, bool ) { /** @todo implement */ return false;} protected: HWND m_hWnd; HINSTANCE m_hInst; D3D10_DRIVER_TYPE m_driverType; ID3D10Device* m_pd3dDevice; IDXGISwapChain* m_pSwapChain; ID3D10RenderTargetView* m_pRenderTargetView; IDXGIFactory* m_pDXGIFactory; bool OnCreateDevice(); bool OnResizedSwapChain(); void OnReleasingSwapChain(); void OnDestroyDevice(); void SetRenderTargetArea(const tuvok::RenderRegion& renderRegion); void SetRenderTargetAreaScissor(const tuvok::RenderRegion& renderRegion); void SetViewPort(UINTVECTOR2 viLowerLeft, UINTVECTOR2 viUpperRight, bool decreaseScreenRes); void RenderBBox(const FLOATVECTOR4 vColor = FLOATVECTOR4(1,0,0,1), bool bEpsilonOffset=true); void RenderBBox(const FLOATVECTOR4 vColor, bool bEpsilonOffset, const FLOATVECTOR3& vCenter, const FLOATVECTOR3& vExtend); void NewFrameClear(const tuvok::RenderRegion& renderRegion); bool Execute3DFrame(const tuvok::RenderRegion3D& renderRegion, float &fMsecPassed); void RerenderPreviousResult(bool bTransferToFramebuffer); void DrawLogo(); void DrawBackGradient(); virtual void SetDataDepShaderVars(); virtual bool Render3DView(); virtual void Render3DPreLoop() {}; virtual void Render3DInLoop(size_t iCurentBrick, EStereoID eStereoID) = 0; virtual void Render3DPostLoop() {} virtual void ComposeSurfaceImage(EStereoID eStereoID); virtual void Recompose3DView(const tuvok::RenderRegion3D& renderRegion); virtual void RenderHQMIPInLoop(const Brick& b) = 0; virtual void RenderHQMIPPostLoop() {} virtual void CreateOffscreenBuffers(); virtual bool LoadAndVerifyShader(std::string strVSFile, std::string strFSFile, const std::vector& strDirs, GLSLProgram** pShaderProgram); virtual bool LoadAndVerifyShader(std::string strVSFile, std::string strFSFile, GLSLProgram** pShaderProgram, bool bSearchSubdirs); void GeometryPreRender(); void GeometryPostRender(); void PlaneIn3DPreRender(); void PlaneIn3DPostRender(); virtual void ClearColorBuffer() const; virtual void StartFrame(); virtual void EndFrame(RenderRegion* region, bool bNewDataToShow); virtual FLOATVECTOR3 Pick(const UINTVECTOR2&) const; virtual void RegisterDerivedClassLuaFunctions( LuaClassRegistration& reg, LuaScripting* ss); private: void SetBrickDepShaderVarsSlice(const UINTVECTOR3& vVoxelCount); void RenderSeperatingLines(); void RenderCoordArrows(); private: DXTexture1D* m_p1DTransTex; }; // Necessary to pass HWND around in the scripting system. // HWND is a pointer to a structure. template <> class LuaStrictStack { public: typedef HWND Type; static HWND get(lua_State* L, int pos) { HWND hwnd = reinterpret_cast(lua_touserdata(L, pos)); return hwnd; } static void push(lua_State* L, HWND hwnd) { lua_pushlightuserdata(L, hwnd); } static std::string getValStr(HWND) { std::ostringstream os; os << "HWND - ???"; return os.str(); } static std::string getTypeStr() { return "HWND"; } static HWND getDefault() { return NULL; } }; }; //namespace tuvok #endif // DXRENDERER_H #endif // _WIN32 && USE_DIRECTX ImageVis3D-3.1.0/Tuvok/Renderer/DX/DXContext.h0000644000175000017500000000471112320456500020502 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DXContext.h \author Tom Fogal SCI Institute University of Utah */ #pragma once #ifndef TUVOK_DX_CONTEXT_ID_H #define TUVOK_DX_CONTEXT_ID_H #include "../Context.h" #include "../../Basics/DynamicDX.h" namespace tuvok { /// Abstraction for current DirectX context. See base class for details. /// /// Currently unimplemented, just holds null; this means that all DirectX /// contexts will be considered equivalent. class DXContext : public Context { public: DXContext(int iShareGroupID) : Context(iShareGroupID) { ctx = NULL; } /// Create an ID from the given context. DXContext(ID3D10Device *c) : Context(m_iShareGroupID) { ctx = c; } DXContext(const DXContext &dx) : Context(m_iShareGroupID) { ctx = dx.ctx; } static DXContext Current(ID3D10Device *c) { return DXContext(c); } bool operator==(const DXContext &dx_cid) const { return this->ctx == dx_cid.ctx; } bool operator!=(const DXContext &dx_cid) const { return this->ctx != dx_cid.ctx; } DXContext& operator=(const DXContext &ct) { this->ctx = ct.ctx; this->m_iShareGroupID = ct.m_iShareGroupID; return *this; } }; } #endif // TUVOK_DX_CONTEXT_ID_H ImageVis3D-3.1.0/Tuvok/Renderer/DX/DXSBVR.cpp0000644000175000017500000000411712320456500020165 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DXSBVR.cpp \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #if defined(_WIN32) && defined(USE_DIRECTX) #include "DXSBVR.h" #include #include #include #include using namespace std; using namespace tuvok; DXSBVR::DXSBVR(MasterController* pMasterController, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder) : DXRenderer(pMasterController,bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder) { } DXSBVR::~DXSBVR() { } #pragma warning(disable:4100) // disable "unused parameter" warning for now void DXSBVR::Render3DInLoop(size_t iCurrentBrick, EStereoID eStereoID) { } void DXSBVR::RenderHQMIPInLoop(const Brick& b) { } void DXSBVR::UpdateLightParamsInShaders() { } #endif // _WIN32 && USE_DIRECTX ImageVis3D-3.1.0/Tuvok/Renderer/DX/DXTexture2D.h0000644000175000017500000000464312320456500020710 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DXTexture2D.h \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #pragma once #if defined(_WIN32) && defined(USE_DIRECTX) #ifndef DXTEXTURE2D_H #define DXTEXTURE2D_H #include "../../StdTuvokDefines.h" #include "DXTexture.h" #include "../../Basics/Vectors.h" namespace tuvok { class DXTexture2D : public DXTexture { public: DXTexture2D(ID3D10Device* pd3dDevice, uint32_t iSizeX, uint32_t iSizeY, DXGI_FORMAT format); DXTexture2D(ID3D10Device* pd3dDevice, uint32_t iSizeX, uint32_t iSizeY, DXGI_FORMAT format, const void* pInitialData, bool bIsReadOnly=true); virtual ~DXTexture2D(); virtual void SetData(const void *pixels); virtual void Delete(); virtual uint64_t GetCPUSize() {return uint64_t(m_iSizeX*m_iSizeY*m_iSizePerElement);} virtual uint64_t GetGPUSize() {return uint64_t(m_iSizeX*m_iSizeY*m_iSizePerElement);} UINTVECTOR2 GetSize() const {return UINTVECTOR2(uint32_t(m_iSizeX), uint32_t(m_iSizeY));} protected: uint32_t m_iSizeX; uint32_t m_iSizeY; ID3D10Texture2D* m_pTexture; }; }; //namespace tuvok #endif // DXTEXTURE2D_H #endif // _WIN32 && USE_DIRECTX ImageVis3D-3.1.0/Tuvok/Renderer/DX/DXTexture2D.cpp0000644000175000017500000001105412320456500021235 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DXTexture2D.cpp \author Jens Krueger SCI Institute University of Utah \date January 2009 */ #if defined(_WIN32) && defined(USE_DIRECTX) #include "DXTexture2D.h" #include using namespace tuvok; DXTexture2D::DXTexture2D(ID3D10Device* pd3dDevice, uint32_t iSizeX, uint32_t iSizeY, DXGI_FORMAT format) : DXTexture(pd3dDevice, g_dx10Format[int(format)].m_iByteSize, false), m_iSizeX(iSizeX), m_iSizeY(iSizeY), m_pTexture(NULL) { // create texture and fill with zeros D3D10_TEXTURE2D_DESC texDesc = { m_iSizeX, m_iSizeY, 1, 1, format, 1,0, D3D10_USAGE_DEFAULT, D3D10_BIND_SHADER_RESOURCE, 0, 0 }; m_pd3dDevice->CreateTexture2D( &texDesc, NULL, &m_pTexture); // create shader resource views D3D10_SHADER_RESOURCE_VIEW_DESC SRVDesc = { texDesc.Format, D3D10_SRV_DIMENSION_TEXTURE2D, 0, 1 }; m_pd3dDevice->CreateShaderResourceView( m_pTexture, &SRVDesc, &m_pTexture_SRV ); } DXTexture2D::DXTexture2D(ID3D10Device* pd3dDevice, uint32_t iSizeX, uint32_t iSizeY, DXGI_FORMAT format, const void* pInitialData, bool bIsReadOnly) : DXTexture(pd3dDevice, g_dx10Format[int(format)].m_iByteSize, bIsReadOnly), m_iSizeX(iSizeX), m_iSizeY(iSizeY), m_pTexture(NULL) { assert(pInitialData || !bIsReadOnly); // create texture (if no inital data is specified the textures are filled with zeros) D3D10_TEXTURE2D_DESC texDesc = { m_iSizeX, m_iSizeY, 1, 1, format, 1,0, bIsReadOnly ? D3D10_USAGE_IMMUTABLE : D3D10_USAGE_DEFAULT, D3D10_BIND_SHADER_RESOURCE, 0, 0 }; D3D10_SUBRESOURCE_DATA vbInitDataTex = { pInitialData, m_iSizePerElement*m_iSizeX, 0 }; m_pd3dDevice->CreateTexture2D( &texDesc, pInitialData == NULL ? NULL : &vbInitDataTex, &m_pTexture); // create shader resource views D3D10_SHADER_RESOURCE_VIEW_DESC SRVDesc = { texDesc.Format, D3D10_SRV_DIMENSION_TEXTURE2D, 0, 1 }; m_pd3dDevice->CreateShaderResourceView( m_pTexture, &SRVDesc, &m_pTexture_SRV ); } DXTexture2D::~DXTexture2D() { Delete(); } void DXTexture2D::SetData(const void *pData) { assert(!m_bIsReadOnly); // Create a staging resource to copy the data ID3D10Texture2D* pStagingTexture = NULL; D3D10_TEXTURE2D_DESC desc; m_pTexture->GetDesc(&desc); desc.Usage = D3D10_USAGE_STAGING; desc.BindFlags = 0; desc.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE; m_pd3dDevice->CreateTexture2D( &desc, NULL, &pStagingTexture ); char* pcData = (char*)pData; D3D10_MAPPED_TEXTURE2D map; pStagingTexture->Map(0, D3D10_MAP_WRITE, 0, &map ); char *pStagingData = (char*)map.pData; if (map.RowPitch == m_iSizePerElement * m_iSizeX) { size_t iDataSize = m_iSizePerElement * m_iSizeX * m_iSizeY; memcpy(pStagingData, pcData, iDataSize); } else { size_t iRowize = m_iSizePerElement * m_iSizeX; for (unsigned int i = 0;iUnmap(0); m_pd3dDevice->CopyResource(m_pTexture, pStagingTexture); SAFE_RELEASE(pStagingTexture); } void DXTexture2D::Delete() { SAFE_RELEASE(m_pTexture); } #endif // _WIN32 && USE_DIRECTX ImageVis3D-3.1.0/Tuvok/Renderer/DX/DXRaycaster.h0000644000175000017500000000475112320456500021017 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DXRaycaster.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date November 2008 */ #pragma once #if defined(_WIN32) && defined(USE_DIRECTX) #ifndef DXRAYCASTER_H #define DXRAYCASTER_H #include "../../StdTuvokDefines.h" #include "DXRenderer.h" namespace tuvok { /** \class DXRaycaster * GPU Rayster. * * DXRaycaster is a GPU based raycaster for volumetric scalar data which uses HLSL. */ class DXRaycaster : public DXRenderer { public: /** Constructs a VRer with immediate redraw, and * wireframe mode off. * \param pMasterController message routing object * \param bUseOnlyPowerOfTwo force power of two textures (compatibility) * \param bDownSampleTo8Bits force 8bit textures (compatibility) */ DXRaycaster(MasterController* pMasterController, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder); virtual ~DXRaycaster(); virtual ERendererType GetRendererType() {return RT_RC;} protected: virtual void Render3DInLoop(size_t iCurrentBrick, EStereoID eStereoID); virtual void RenderHQMIPInLoop(const Brick& b); virtual void UpdateLightParamsInShaders(); }; }; //namespace tuvok #endif // DXRAYCASTER_H #endif // _WIN32 && USE_DIRECTX ImageVis3D-3.1.0/Tuvok/Renderer/DX/DXRaycaster.cpp0000644000175000017500000000417612320456500021353 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file DXRaycaster.cpp \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #if defined(_WIN32) && defined(USE_DIRECTX) #include "DXRaycaster.h" #include #include #include #include using namespace std; using namespace tuvok; DXRaycaster::DXRaycaster(MasterController* pMasterController, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder) : DXRenderer(pMasterController,bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder) { } DXRaycaster::~DXRaycaster() { } #pragma warning(disable:4100) // disable "unused parameter" warning for now void DXRaycaster::Render3DInLoop(size_t iCurrentBrick, EStereoID eStereoID) { } void DXRaycaster::RenderHQMIPInLoop(const Brick& b) { } void DXRaycaster::UpdateLightParamsInShaders() { } #endif // _WIN32 && USE_DIRECTX ImageVis3D-3.1.0/Tuvok/Renderer/VisibilityState.cpp0000644000175000017500000000243312320456500021771 0ustar mathieumathieu#include "VisibilityState.h" using namespace tuvok; VisibilityState::VisibilityState() : m_eRenderMode(AbstrRenderer::RM_INVALID) {} bool VisibilityState::NeedsUpdate(double fMin, double fMax) { bool const bNeedsUpdate = (m_eRenderMode != AbstrRenderer::RM_1DTRANS) || (m_rm1DTrans.fMin != fMin) || (m_rm1DTrans.fMax != fMax); m_eRenderMode = AbstrRenderer::RM_1DTRANS; m_rm1DTrans.fMin = fMin; m_rm1DTrans.fMax = fMax; return bNeedsUpdate; } bool VisibilityState::NeedsUpdate(double fMin, double fMax, double fMinGradient, double fMaxGradient) { bool const bNeedsUpdate = (m_eRenderMode != AbstrRenderer::RM_2DTRANS) || (m_rm2DTrans.fMin != fMin) || (m_rm2DTrans.fMax != fMax) || (m_rm2DTrans.fMinGradient != fMinGradient) || (m_rm2DTrans.fMaxGradient != fMaxGradient); m_eRenderMode = AbstrRenderer::RM_2DTRANS; m_rm2DTrans.fMin = fMin; m_rm2DTrans.fMax = fMax; m_rm2DTrans.fMinGradient = fMinGradient; m_rm2DTrans.fMaxGradient = fMaxGradient; return bNeedsUpdate; } bool VisibilityState::NeedsUpdate(double fIsoValue) { bool const bNeedsUpdate = (m_eRenderMode != AbstrRenderer::RM_ISOSURFACE) || (m_rmIsoSurf.fIsoValue != fIsoValue); m_eRenderMode = AbstrRenderer::RM_ISOSURFACE; m_rmIsoSurf.fIsoValue = fIsoValue; return bNeedsUpdate; } ImageVis3D-3.1.0/Tuvok/Renderer/RenderRegion.h0000644000175000017500000001456212320456500020677 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifndef RENDERREGION_H #define RENDERREGION_H #include "../Basics/Plane.h" namespace tuvok { class AbstrRenderer; class GLRenderer; class GLSBVR2D; class LuaScripting; template class LuaClassRegistration; // NOTE: client code should never directly modify a RenderRegion. Instead, // modifications should be done through the tuvok API so that tuvok is aware // of these changes. class RenderRegion { public: enum EWindowMode { WM_SAGITTAL = 0, WM_AXIAL = 1, WM_CORONAL = 2, WM_3D, WM_INVALID }; UINTVECTOR2 minCoord, maxCoord; EWindowMode windowMode; // does drawing (possibly at higher quality settings) still need to be done? bool redrawMask; // has this never been drawn (are we starting from scratch for this view)? bool isBlank; // no LOD has been completed (this is different from "isBlank" above as // it considers what is visible to the user not what is in the backbuffer) bool isTargetBlank; RenderRegion(EWindowMode mode, AbstrRenderer* ren): windowMode(mode), redrawMask(true), isBlank(true), isTargetBlank(true), mRen(ren) { } virtual ~RenderRegion() { /* nothing to destruct */ } virtual bool is2D() const { return false; } virtual bool is3D() const { return false; } bool ContainsPoint(UINTVECTOR2 pos) { return (minCoord[0] < pos[0] && pos[0] < maxCoord[0]) && (minCoord[1] < pos[1] && pos[1] < maxCoord[1]); } static void defineLuaInterface(LuaClassRegistration& reg, RenderRegion* me, LuaScripting* ss); // These really should just be for 3D and for 3D MIP. But because 3D MIP is // considered 2D, we have to put this here for now... FLOATMATRIX4 modelView[2]; // one for each eye (if in stereo mode). FLOATMATRIX4 rotation; FLOATMATRIX4 translation; protected: // These methods should be accessed through AbstrRenderer friend class AbstrRenderer; friend class GLRenderer; // 2D methods virtual bool GetUseMIP() const = 0; virtual void SetUseMIP(bool) = 0; virtual uint64_t GetSliceIndex() const = 0; virtual void SetSliceIndex(uint64_t index) = 0; virtual void GetFlipView(bool &flipX, bool &flipY) const = 0; virtual void SetFlipView(bool flipX, bool flipY) = 0; AbstrRenderer* mRen; private: // Lua functions that expose functionality. The guts of most of these // functions exist in the abstract renderer. void luaSetRotation4x4(FLOATMATRIX4 mat); FLOATMATRIX4 luaGetRotation4x4(); void luaSet2DFlipMode(bool bFlipX, bool bFlipY); bool luaGet2DFlipModeX(); bool luaGet2DFlipModeY(); bool luaGetUseMIP() const; void luaSetUseMIP(bool bUseMIP); void luaSetTranslation4x4(FLOATMATRIX4 translation); FLOATMATRIX4 luaGetTranslation4x4(); void luaSetSliceDepth(uint64_t sliceDepth); uint64_t luaGetSliceDepth() const; void luaSetClipPlane(ExtendedPlane plane); ExtendedPlane luaGetClipPlane(); void luaEnableClipPlane(bool enable); bool luaIsClipPlaneEnabled(); void luaShowClipPlane(bool enable); FLOATMATRIX4 luaGetModelView(int stereoIndex); }; class RenderRegion2D : public RenderRegion { public: RenderRegion2D(EWindowMode mode, uint64_t sliceIndex, AbstrRenderer* ren) : RenderRegion(mode, ren), useMIP(false), sliceIndex(sliceIndex) { flipView = VECTOR2(false, false); } virtual ~RenderRegion2D() { /* nothing to destruct */ } virtual bool is2D() const { return true; } protected: // These methods should be accessed through AbstrRenderer friend class AbstrRenderer; friend class GLRenderer; friend class GLSBVR2D; virtual bool GetUseMIP() const { return useMIP; } virtual void SetUseMIP(bool useMIP_) { useMIP = useMIP_; } virtual uint64_t GetSliceIndex() const { return sliceIndex; } virtual void SetSliceIndex(uint64_t index) { sliceIndex = index; } virtual void GetFlipView(bool &flipX, bool &flipY) const { flipX = flipView.x; flipY = flipView.y; } virtual void SetFlipView(bool flipX, bool flipY) { flipView.x = flipX; flipView.y = flipY; } VECTOR2 flipView; bool useMIP; uint64_t sliceIndex; }; class RenderRegion3D : public RenderRegion { public: RenderRegion3D(AbstrRenderer* ren) : RenderRegion(WM_3D, ren) {} virtual ~RenderRegion3D() { /* nothing to destruct */ } virtual bool is3D() const { return true; } protected: // These methods should be accessed through AbstrRenderer friend class AbstrRenderer; friend class GLRenderer; // 3D regions don't do the following things: virtual bool GetUseMIP() const { assert(false); return false; } virtual void SetUseMIP(bool) { assert(false); } virtual uint64_t GetSliceIndex() const { assert(false); return 0; } virtual void SetSliceIndex(uint64_t) { assert(false); } virtual void SetFlipView(bool, bool) { assert(false); } virtual void GetFlipView(bool &, bool &) const {assert(false); } }; }; #endif // RENDERREGION_H ImageVis3D-3.1.0/Tuvok/Renderer/RenderRegion.cpp0000644000175000017500000002036512320456500021230 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "3rdParty/LUA/lua.hpp" // Standard #include "../Basics/Vectors.h" #include "../StdTuvokDefines.h" #include "RenderRegion.h" #include "../LuaScripting/LuaScripting.h" #include "../LuaScripting/LuaClassRegistration.h" #include "../LuaScripting/TuvokSpecific/LuaTuvokTypes.h" namespace tuvok { //----------------------------------------------------------------------------- void RenderRegion::defineLuaInterface(LuaClassRegistration& reg, RenderRegion*, LuaScripting*) { std::string id; id = reg.function(&RenderRegion::is2D, "is2D", "True if render region is 2D.", false); id = reg.function(&RenderRegion::is3D, "is3D", "True if render region is 2D.", false); id = reg.function(&RenderRegion::ContainsPoint, "containsPoint", "True if the " "pixel coordinates given are within our rectangular region.", false); id = reg.function(&RenderRegion::luaSetRotation4x4, "setRotation4x4", "Sets the render region's world space rotation as a 4x4" "matrix.", true); id = reg.function(&RenderRegion::luaGetRotation4x4, "getRotation4x4", "Retrieves render region's rotation as a 4x4 matrix.", false); id = reg.function(&RenderRegion::luaSetTranslation4x4, "setTranslation4x4", "Sets the render region's translation as a 4x4 matrix.", true); id = reg.function(&RenderRegion::luaGetTranslation4x4, "getTranslation4x4", "Retrieves the render region's translation as a 4x4 matrix." , false); id = reg.function(&RenderRegion::luaSet2DFlipMode, "set2DFlipMode", "Sets horizontal and vertical flip flags.", true); id = reg.function(&RenderRegion::luaGet2DFlipModeX, "get2DFlipModeX", "Returns current horizontal flip flag value.", false); id = reg.function(&RenderRegion::luaGet2DFlipModeY, "get2DFlipModeY", "Returns current vertical flip flag value.", false); id = reg.function(&RenderRegion::luaSetUseMIP, "setUseMIP", "Toggle Maximum Intensity Projection on/off.", true); id = reg.function(&RenderRegion::luaGetUseMIP, "getUseMIP", "Retrieve the state of Maximum Intensity Projection.", false); id = reg.function(&RenderRegion::luaSetSliceDepth, "setSliceDepth", "Sets the slice depth.", true); id = reg.function(&RenderRegion::luaGetSliceDepth, "getSliceDepth", "Retrieves the slice depth.", false); id = reg.function(&RenderRegion::luaSetClipPlane, "setClipPlane", "Sets the arbitrary clipping plane against which to clip " "the volume.", true); id = reg.function(&RenderRegion::luaGetClipPlane, "getClipPlane", "Retrieves arbitrary clipping plane.", false); id = reg.function(&RenderRegion::luaEnableClipPlane, "enableClipPlane", "Enables/Disables clipping plane.", true); id = reg.function(&RenderRegion::luaIsClipPlaneEnabled, "isClipPlaneEnabled", "Returns enabled status of clipping plane.", true); id = reg.function(&RenderRegion::luaShowClipPlane, "showClipPlane", "Enable/Disables clip plane visibility.", true); id = reg.function(&RenderRegion::luaGetModelView, "getModelView", "Retrieves model view matrix.", false); } //----------------------------------------------------------------------------- void RenderRegion::luaSetRotation4x4(FLOATMATRIX4 mat) { mRen->SetRotationRR(this, mat); } //----------------------------------------------------------------------------- FLOATMATRIX4 RenderRegion::luaGetRotation4x4() { return mRen->GetRotation(this); } //----------------------------------------------------------------------------- void RenderRegion::luaSet2DFlipMode(bool bFlipX, bool bFlipY) { mRen->Set2DFlipMode(this, bFlipX, bFlipY); } //----------------------------------------------------------------------------- bool RenderRegion::luaGet2DFlipModeX() { bool x = false, y = false; mRen->Get2DFlipMode(this, x, y); return x; } //----------------------------------------------------------------------------- bool RenderRegion::luaGet2DFlipModeY() { bool x = false, y = false; mRen->Get2DFlipMode(this, x, y); return y; } //----------------------------------------------------------------------------- bool RenderRegion::luaGetUseMIP() const { return mRen->GetUseMIP(this); } //----------------------------------------------------------------------------- void RenderRegion::luaSetUseMIP(bool bUseMIP) { mRen->SetUseMIP(this, bUseMIP); } //----------------------------------------------------------------------------- void RenderRegion::luaSetTranslation4x4(FLOATMATRIX4 translation) { mRen->SetTranslation(this, translation); } //----------------------------------------------------------------------------- FLOATMATRIX4 RenderRegion::luaGetTranslation4x4() { return mRen->GetTranslation(this); } //----------------------------------------------------------------------------- void RenderRegion::luaSetSliceDepth(uint64_t sliceDepth) { mRen->SetSliceDepth(this, sliceDepth); } //----------------------------------------------------------------------------- uint64_t RenderRegion::luaGetSliceDepth() const { return mRen->GetSliceDepth(this); } //----------------------------------------------------------------------------- void RenderRegion::luaSetClipPlane(ExtendedPlane plane) { mRen->SetClipPlane(this, plane); } //----------------------------------------------------------------------------- ExtendedPlane RenderRegion::luaGetClipPlane() { return mRen->GetClipPlane(); } //----------------------------------------------------------------------------- void RenderRegion::luaEnableClipPlane(bool enable) { if (enable) mRen->EnableClipPlane(this); else mRen->DisableClipPlane(this); } //----------------------------------------------------------------------------- bool RenderRegion::luaIsClipPlaneEnabled() { return mRen->IsClipPlaneEnabled(this); } //----------------------------------------------------------------------------- void RenderRegion::luaShowClipPlane(bool enable) { mRen->ShowClipPlane(enable, this); } //----------------------------------------------------------------------------- FLOATMATRIX4 RenderRegion::luaGetModelView(int stereoIndex) { return modelView[stereoIndex]; } } ImageVis3D-3.1.0/Tuvok/Renderer/ShaderDescriptor.cpp0000644000175000017500000003367012320456500022115 0ustar mathieumathieu#include "StdTuvokDefines.h" #include #include #include #include #include #include #include #include #include "ShaderDescriptor.h" #include "Basics/SysTools.h" #include "Basics/SystemInfo.h" #include "Controller/Controller.h" namespace tuvok { enum shader_type { SHADER_VERTEX_DISK, SHADER_VERTEX_STRING, SHADER_FRAGMENT_DISK, SHADER_FRAGMENT_STRING }; struct ShaderDescriptor::sinfo { std::vector defines; std::vector> vertex; std::vector> fragment; bool operator==(const ShaderDescriptor::sinfo& sdi) const; }; bool ShaderDescriptor::sinfo::operator==(const ShaderDescriptor::sinfo& sdi) const { return vertex.size() == sdi.vertex.size() && fragment.size() == sdi.fragment.size() && std::equal(vertex.begin(), vertex.end(), sdi.vertex.begin()) && std::equal(fragment.begin(), fragment.end(), sdi.fragment.begin()) && std::equal(defines.begin(), defines.end(), sdi.defines.begin()); } ShaderDescriptor::ShaderDescriptor() : si(new struct sinfo()) { } ShaderDescriptor::ShaderDescriptor(const ShaderDescriptor& sd) : si(sd.si) {} ShaderDescriptor::ShaderDescriptor(const std::vector& vertex, const std::vector& fragment) : si(new struct sinfo()) { typedef std::vector sv; for(sv::const_iterator v = vertex.begin(); v != vertex.end(); ++v) { this->si->vertex.push_back(std::make_pair(*v, SHADER_VERTEX_DISK)); } for(sv::const_iterator f = fragment.begin(); f != fragment.end(); ++f) { this->si->fragment.push_back(std::make_pair(*f, SHADER_FRAGMENT_DISK)); } } // SysTools::FileExists can take a std::string OR a std::wstring. This makes // it hard to use in a function composition, because the compiler cannot figure // out which one we want, and it's not a template or anything so we cannot just // be explicit. // This serves to rename it to avoid the ambiguity. static bool exists(std::string s) { return SysTools::FileExists(s); } // we could technically achieve this by composing std::plus with // std::plus, but my god is that a nightmare in c++03. static std::string concat(std::string a, std::string b, std::string c) { return a + b + c; } /// expects a list of directories (filenames). Removes any from the /// list which don't exist. static std::vector existing(std::vector directories) { typedef std::vector sv; sv::iterator end = std::remove_if(directories.begin(), directories.end(), std::not1(std::ptr_fun(exists))); for(sv::const_iterator e = end; e != directories.end(); ++e) { if (!e->empty()) WARNING("Directory %s does not exist!", e->c_str()); } // also, we know they're junk, so don't search in them directories.erase(end, directories.end()); return directories; } // Searches for the given filename in the given directories. Returns the fully // qualified path of the file's location. static std::string find_filename(const std::vector& directories, std::string filename) { // if we're on Mac, first try to see if the file is in our bundle. #ifdef DETECTED_OS_APPLE if (SysTools::FileExists(SysTools::GetFromResourceOnMac(filename))) { filename = SysTools::GetFromResourceOnMac(filename); MESSAGE("Found %s in bundle, using that.", filename.c_str()); return filename; } #endif typedef std::vector sv; // okay, now prepend each directory into our flename and see if we find a // match. using namespace std::placeholders; const std::string dirsep = "/"; // the functor is a composition: 'exists(add(_1, dirsep, filename))' sv::const_iterator fn = std::find_if(directories.begin(), directories.end(), std::bind( std::ptr_fun(exists), std::bind(concat, _1, dirsep, filename) )); if(fn == directories.end()) { // file not found. throw std::runtime_error("could not find file"); } return *fn + dirsep + filename; } std::vector ShaderDescriptor::ValidPaths(std::vector dirs) { return existing(dirs); } ShaderDescriptor ShaderDescriptor::Create( std::vector directories, std::vector> fragmentDataBindings, ... ) { ShaderDescriptor rv; va_list args; va_start(args, fragmentDataBindings); const char* filename; // we expect two NULLs: first terminates vertex list, second fragment list. do { filename = va_arg(args, const char*); if(filename != NULL) { rv.si->vertex.push_back(std::make_pair(std::string(filename), SHADER_VERTEX_DISK)); } } while(filename != NULL); // now second: fragment shaders. do { filename = va_arg(args, const char*); if(filename != NULL) { rv.si->fragment.push_back(std::make_pair(std::string(filename), SHADER_FRAGMENT_DISK)); } } while(filename != NULL); va_end(args); // now try to clean up all those paths. // The user gave us some directories to search, but let's make sure we also // search the location of our binary. std::vector dirs = SysTools::GetSubDirList( Controller::ConstInstance().SysInfo().GetProgramPath() ); directories.insert(directories.end(), dirs.begin(), dirs.end()); directories.push_back(Controller::ConstInstance().SysInfo().GetProgramPath()); directories = existing(directories); // prune bad directories typedef std::vector> sv; for(sv::iterator v = rv.si->vertex.begin(); v != rv.si->vertex.end(); ++v) { v->first = find_filename(directories, v->first); } for(sv::iterator f = rv.si->fragment.begin(); f != rv.si->fragment.end(); ++f) { f->first = find_filename(directories, f->first); } rv.fragmentDataBindings = fragmentDataBindings; return rv; } ShaderDescriptor ShaderDescriptor::Create( std::vector directories, ... ) { ShaderDescriptor rv; va_list args; va_start(args, directories); const char* filename; // we expect two NULLs: first terminates vertex list, second fragment list. do { filename = va_arg(args, const char*); if(filename != NULL) { rv.si->vertex.push_back(std::make_pair(std::string(filename), SHADER_VERTEX_DISK)); } } while(filename != NULL); // now second: fragment shaders. do { filename = va_arg(args, const char*); if(filename != NULL) { rv.si->fragment.push_back(std::make_pair(std::string(filename), SHADER_FRAGMENT_DISK)); } } while(filename != NULL); va_end(args); // now try to clean up all those paths. // The user gave us some directories to search, but let's make sure we also // search the location of our binary. std::vector dirs = SysTools::GetSubDirList( Controller::ConstInstance().SysInfo().GetProgramPath() ); directories.insert(directories.end(), dirs.begin(), dirs.end()); directories.push_back(Controller::ConstInstance().SysInfo().GetProgramPath()); directories = existing(directories); // prune bad directories typedef std::vector> sv; for(sv::iterator v = rv.si->vertex.begin(); v != rv.si->vertex.end(); ++v) { v->first = find_filename(directories, v->first); } for(sv::iterator f = rv.si->fragment.begin(); f != rv.si->fragment.end(); ++f) { f->first = find_filename(directories, f->first); } return rv; } void ShaderDescriptor::AddDefine(const std::string& define) { this->si->defines.push_back(define); } void ShaderDescriptor::AddDefines(const std::vector& defines) { for (auto define = defines.cbegin(); define != defines.cend(); define++) AddDefine(*define); } /// Adds a vertex shader in a string (i.e. not from a filename) void ShaderDescriptor::AddVertexShaderString(const std::string shader) { this->si->vertex.push_back(std::make_pair(shader, SHADER_VERTEX_STRING)); } /// Adds a fragment shader in a string (i.e. not from a filename) void ShaderDescriptor::AddFragmentShaderString(const std::string shader) { this->si->fragment.push_back(std::make_pair(shader, SHADER_FRAGMENT_STRING)); } /// Two shaders are equal if they utilize the same set of filenames/strings /// to compose the shader. bool ShaderDescriptor::operator ==(const ShaderDescriptor& sd) const { return this->si == sd.si; } static std::string readfile(const std::string& filename) { // open in append mode so the file pointer will be at EOF and we can // therefore easily/quickly figure out the file size. std::ifstream ifs(filename.c_str(), std::ios::in | std::ios::ate); if(!ifs.is_open()) { T_ERROR("Could not open shader '%s'", filename.c_str()); throw std::runtime_error("file could not be opened"); } std::ifstream::pos_type len = ifs.tellg(); ifs.seekg(0, std::ios::beg); std::vector file(size_t(len+std::ifstream::pos_type(1)), 0); size_t offset=0; do { std::streamsize length = std::streamsize(len) - std::streamsize(offset); ifs.read(&file[offset], length); offset += size_t(ifs.gcount()); } while(!ifs.eof() && std::ifstream::pos_type(offset) < len); ifs.close(); return std::string(&file[0]); } typedef std::vector> slist; // internal implementation: we keep track of which object (ShaderDescriptor) we // came from, the location within that object, and what type we are. The // latter helps us with equality; no location in the vertex shader list is // equal to any location in the fragment shader list. struct ShaderDescriptor::SIterator::siterinfo { const ShaderDescriptor* sd; slist::const_iterator location; enum VertFrag { ITER_VERTEX, ITER_FRAGMENT } vf; siterinfo(const ShaderDescriptor* sdesc, slist::const_iterator loc, enum VertFrag typ) : sd(sdesc), location(loc), vf(typ) { } bool operator==(const siterinfo& sit) const { return this->vf == sit.vf && this->location == sit.location; } }; ShaderDescriptor::SIterator::SIterator(const ShaderDescriptor::SIterator& sit) : si(sit.si) { } ShaderDescriptor::SIterator::SIterator( struct ShaderDescriptor::SIterator::siterinfo sit ) : si(new ShaderDescriptor::SIterator::siterinfo(sit)) { } ShaderDescriptor::SIterator& ShaderDescriptor::SIterator::operator++() { ++this->si->location; return *this; } ShaderDescriptor::SIterator& ShaderDescriptor::SIterator::operator++(int n) { std::advance(this->si->location, n); return *this; } bool ShaderDescriptor::SIterator::operator==(const ShaderDescriptor::SIterator& sit) const { return *(this->si) == (*sit.si); } bool ShaderDescriptor::SIterator::operator!=(const ShaderDescriptor::SIterator& sit) const { return !(*this == sit); } static std::string vectorStringToString(std::vector const& vs) { std::string defines; for (auto define = vs.cbegin(); define != vs.cend(); define++) { defines.append(*define + "\n"); } return defines; } std::pair ShaderDescriptor::SIterator::operator*() const { std::pair rv( std::make_pair(vectorStringToString(this->si->sd->si->defines) + this->si->location->first, "(in-memory)") ); if(this->si->location->second == SHADER_VERTEX_DISK || this->si->location->second == SHADER_FRAGMENT_DISK) { // load it from disk and replace those parameters. rv.first = vectorStringToString(this->si->sd->si->defines) + readfile(this->si->location->first); rv.second = this->si->location->first; } return rv; } ShaderDescriptor::SIterator ShaderDescriptor::begin_vertex() const { return ShaderDescriptor::SIterator( ShaderDescriptor::SIterator::siterinfo( this, this->si->vertex.begin(), ShaderDescriptor::SIterator::siterinfo::ITER_VERTEX ) ); } ShaderDescriptor::SIterator ShaderDescriptor::end_vertex() const { return ShaderDescriptor::SIterator( ShaderDescriptor::SIterator::siterinfo( this, this->si->vertex.end(), ShaderDescriptor::SIterator::siterinfo::ITER_VERTEX ) ); } ShaderDescriptor::SIterator ShaderDescriptor::begin_fragment() const { return ShaderDescriptor::SIterator( ShaderDescriptor::SIterator::siterinfo( this, this->si->fragment.begin(), ShaderDescriptor::SIterator::siterinfo::ITER_FRAGMENT ) ); } ShaderDescriptor::SIterator ShaderDescriptor::end_fragment() const { return ShaderDescriptor::SIterator( ShaderDescriptor::SIterator::siterinfo( this, this->si->fragment.end(), ShaderDescriptor::SIterator::siterinfo::ITER_FRAGMENT ) ); } } // namespace tuvok /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/Tuvok/Renderer/SBVRGeogen2D.h0000644000175000017500000001532212320456500020376 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file SBVRGeogen2D.h \author Jens Krueger SCI Institute DFKI Saarbruecken & University of Utah \date March 2010 */ #pragma once #ifndef SBVRGEOGEN2D_H #define SBVRGEOGEN2D_H #include "SBVRGeogen.h" namespace tuvok { /** \class SBVRGeogen2D \brief Geometry generation for 2D texture based the slice-based volume renderer. This class implements 3 different algorithms to generate the object aligned geometry for a 2D texture slice-based volume renderer. Those three methods are Christoph Resz's "traditional" stack switching method, where the one stack three object aligned stacks is chosen for rendering that is most perpendicular to the viewing direction (i.e. the normal to viewing direction dot product is minimal). The other two approaches are the naive slow and the optimized fast implementation of Jens Krueger's new sampling scheme for slice based volume rendering. Which of the three methods is used can be controlled by setting m_eMethod. */ class SBVRGeogen2D : public SBVRGeogen { public: /** \brief An enum specifing the three geometry generation modes METHOD_REZK is Christoph Rezk-Salama et al.'s 2000 method METHOD_KRUEGER is Jens Krueger's 2010 naive method METHOD_KRUEGER_FAST is Jens Krueger's 2010 optimized method */ enum ESliceMethod { METHOD_REZK=0, METHOD_KRUEGER, METHOD_KRUEGER_FAST }; /** \brief The Standard and also the only constructor SBVRGeogen2D takes no parameters in the constructor as the geometry mode is by modifing m_eMethod and the view parametes are set via various accessor methods in the parent class */ SBVRGeogen2D(void); virtual ~SBVRGeogen2D(void); /** \brief This call invokes the actual geometry generation Overridden ComputeGeometry call, this call does the actual work of computing the object aligned slices internally it calls either ComputeGeometryRezk(), ComputeGeometryKrueger() or ComputeGeometryKruegerFast() depending on m_eMethod \post stores the slice geometry in m_vSliceTrianglesX, m_vSliceTrianglesY and m_vSliceTrianglesZ \sa ComputeGeometryRezk() ComputeGeometryKrueger() ComputeGeometryKruegerFast() m_eMethod */ virtual void ComputeGeometry(bool bMeshOnly); //! Vector holding the slices that access the X axis aligned textures std::vector m_vSliceTrianglesX; //! Vector holding the slices that access the Y axis aligned textures std::vector m_vSliceTrianglesY; //! Vector holding the slices that access the Z axis aligned textures std::vector m_vSliceTrianglesZ; /** \brief Holds the Geometry generation method Geometry generation method, for values see ESliceMethod enum above if this value is changed ComputeGeometry() has to be called to update m_vSliceTrianglesX, m_vSliceTrianglesY, and m_vSliceTrianglesZ vectors */ ESliceMethod m_eMethod; protected: /** \brief Computes the normalized distance between two object aligned slices \param iDir the direction (0=x, 1=y, 2=z) \return the slice distance in direction iDir */ float GetDelta(int iDir) const; /** \brief Interpolates VERTEX_FORMAT "r" between "v1" and "v2" with parameter "a" \param v1 the first vertex \param v2 the second vertex \param a the interpolation parameter a (should be in [0..1]) \param r the interpolated vertex structure */ void InterpolateVertices(const VERTEX_FORMAT& v1, const VERTEX_FORMAT& v2, float a, VERTEX_FORMAT& r) const; private: /** \brief Computes 2D geometry via C. Rezk-Salama et al. 2000 Computes 2D geometry via C. Rezk-Salama et al. 2000 "Interactive Volume Rendering on Standard PC Graphics Hardware Using Multi-Textures and Multi-Stage Rasterization" */ void ComputeGeometryRezk(); /** \brief Computes 2D geometry alike Krger 2010 Computes 2D geometry alike Krger 2010 "A new sampling scheme for slice based volume rendering" but with a very slow approach, should be used only for demonstation */ void ComputeGeometryKrueger(); /** \brief Computes 2D geometry via Krger 2010 Computes 2D geometry via Krger 2010 "A new sampling scheme for slice based volume rendering" */ void ComputeGeometryKruegerFast(); /** \brief Computes the geometry for one direction used by ComputeGeometryKruegerFast \param iDirIndex the direction (x=0, y=1, z=2) \param fDelta the slice distance \param vertexIndices bounding box indices as seen from direction iDirIndex \param edgeIndices edge indices as seen from direction iDirIndex \param vFaceVec connection vector from the eye point to the face centers \param vIntersects front-edge-plane / edge intersctions \param vIntersectPlanes front-edge-planes that cause intersections \param vCoordFrame transformed local coordinate frame \param vSliceTriangles the computed geometry is stored in this vector */ void BuildStackQuads(const int iDirIndex, float fDelta, const size_t *vertexIndices, const size_t *edgeIndices, const FLOATVECTOR3* vFaceVec, const std::vector& vIntersects, const std::vector& vIntersectPlanes, const FLOATVECTOR3* vCoordFrame, std::vector& vSliceTriangles); }; }; #endif // SBVRGEOGEN2D_H ImageVis3D-3.1.0/Tuvok/Renderer/ContextIdentification.h0000644000175000017500000000306012320456500022601 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2011 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifndef TUVOK_CONTEXT_IDENTIFICATION_H #define TUVOK_CONTEXT_IDENTIFICATION_H // just to make it more confusing for you. #ifdef TUVOK_NO_QT # include "GL/GLContext.h" # define GLContextID GLContext #else # include "GL/QtGLContext.h" # define GLContextID QtGLContext #endif #endif /* TUVOK_CONTEXT_IDENTIFICATION_H */ ImageVis3D-3.1.0/Tuvok/Renderer/writebrick.h0000644000175000017500000000331412320456500020452 0ustar mathieumathieu#ifndef TUVOK_RENDERER_WRITEBRICK_H #define TUVOK_RENDERER_WRITEBRICK_H #include #include #include #include #include #include "Basics/Checksums/MD5.h" #include "IO/Brick.h" #ifdef _MSC_VER # define snprintf _snprintf #endif // Debug code: write data's md5 hash to a file. namespace { template void writeBrick(const tuvok::BrickKey& k, const std::vector& data) { char filename[1024]; snprintf(filename, 1024, "%u-%02u-%03u.md5", static_cast(std::get<0>(k)), static_cast(std::get<1>(k)), static_cast(std::get<2>(k))); std::ofstream ofs(filename, std::ios::trunc); ofs << "bytes: " << data.size() * sizeof(T) << std::endl; ofs << std::hex; std::array checksum = md5::const_iterator,T>(data.begin(), data.end()); for(auto i = checksum.begin(); i != checksum.end(); ++i) { ofs << uint16_t(*i); } ofs << "\n"; ofs.close(); } template void writeBrickT(const tuvok::BrickKey& k, Iter begin, Iter end) { char filename[1024]; snprintf(filename, 1024, "%u-%02u-%03u.md5", static_cast(std::get<0>(k)), static_cast(std::get<1>(k)), static_cast(std::get<2>(k))); std::ofstream ofs(filename, std::ios::trunc); ofs << "bytes: " << std::distance(begin, end) * sizeof(T) << std::endl; ofs << std::hex; std::array checksum = md5(begin, end); for(auto i = checksum.begin(); i != checksum.end(); ++i) { ofs << uint16_t(*i); } ofs << "\n"; ofs.close(); } } #endif ImageVis3D-3.1.0/Tuvok/Renderer/GPUMemMan/0000755000175000017500000000000012320456500017661 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/Renderer/GPUMemMan/GPUMemMan.h0000644000175000017500000001664212320456500021571 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifndef TUVOK_GPUMEMMAN_H #define TUVOK_GPUMEMMAN_H #include #include #include "../../StdTuvokDefines.h" #include "3rdParty/GLEW/GL/glew.h" #include "Basics/Vectors.h" #include "GPUMemManDataStructs.h" class SystemInfo; class TransferFunction1D; class TransferFunction2D; namespace tuvok { class AbstrRenderer; class GLFBOTex; class GLSLProgram; class GLTexture1D; class GLTexture2D; class MasterController; class GLVolumePool; class Dataset; class LinearIndexDataset; class GPUMemMan { public: GPUMemMan(MasterController* masterController); virtual ~GPUMemMan(); Dataset* LoadDataset(const std::string& strFilename, AbstrRenderer* requester); void AddDataset(Dataset* ds, AbstrRenderer *requester); void FreeAssociatedTextures(Dataset* pDataset, int iShareGroupID); void FreeDataset(Dataset* pVolumeDataset, AbstrRenderer* requester); void Changed1DTrans(LuaClassInstance abstrRenderer, LuaClassInstance transferFun1D); void GetEmpty1DTrans(size_t iSize, AbstrRenderer* requester, TransferFunction1D** ppTransferFunction1D, GLTexture1D** tex); void Get1DTransFromFile(const std::string& strFilename, AbstrRenderer* requester, TransferFunction1D** ppTransferFunction1D, GLTexture1D** tex, size_t iSize=0); std::pair SetExternal1DTrans(const std::vector& rgba, AbstrRenderer* requester); GLTexture1D* Access1DTrans(TransferFunction1D* pTransferFunction1D, AbstrRenderer* requester); void Free1DTrans(TransferFunction1D* pTransferFunction1D, const AbstrRenderer* requester); void Changed2DTrans(LuaClassInstance luaAbstrRen, LuaClassInstance tf2d); void GetEmpty2DTrans(const VECTOR2& vSize, AbstrRenderer* requester, TransferFunction2D** ppTransferFunction2D, GLTexture2D** tex); void Get2DTransFromFile(const std::string& strFilename, AbstrRenderer* requester, TransferFunction2D** ppTransferFunction2D, GLTexture2D** tex, const VECTOR2& iSize=VECTOR2(0,0)); GLTexture2D* Access2DTrans(TransferFunction2D* pTransferFunction2D, AbstrRenderer* requester); void Free2DTrans(TransferFunction2D* pTransferFunction2D, const AbstrRenderer* requester); GLTexture2D* Load2DTextureFromFile(const std::string& strFilename, int iShareGroupID); void FreeTexture(GLTexture2D* pTexture); GLVolume* GetVolume(Dataset* pDataset, const BrickKey& key, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder, bool bEmulate3DWith2DStacks, uint64_t iIntraFrameCounter, uint64_t iFrameCounter, int iShareGroupID); bool IsResident(const Dataset* pDataset, const BrickKey& key, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder, bool bEmulate3DWith2DStacks, int iShareGroupID) const; void Release3DTexture(GLVolume* pGLVolume); GLFBOTex* GetFBO(GLenum minfilter, GLenum magfilter, GLenum wrapmode, GLsizei width, GLsizei height, GLenum intformat, GLenum format, GLenum type, int iShareGroupID, bool bHaveDepth=false, int iNumBuffers=1); void FreeFBO(GLFBOTex* pFBO); GLSLProgram* GetGLSLProgram(const ShaderDescriptor& sdesc, int iShareGroupID); void FreeGLSLProgram(GLSLProgram* pGLSLProgram); GLVolumePool* GetVolumePool(LinearIndexDataset* dataSet, GLenum filter, int iShareGroupID); void DeleteVolumePool(GLVolumePool** pool); void MemSizesChanged(); // ok, i know this uint64_t could theoretically overflow but lets assume the // universe collapses before that happens // Seems likely. -- TJF uint64_t UpdateFrameCounter() {return ++m_iFrameCounter;} /// system statistics ///@{ uint64_t GetCPUMem() const; uint64_t GetGPUMem() const; uint64_t GetAllocatedCPUMem() const {return m_iAllocatedCPUMemory;} uint64_t GetAllocatedGPUMem() const {return m_iAllocatedGPUMemory;} uint32_t GetBitWidthMem() const; uint32_t GetNumCPUs() const; ///@} private: VolDataList m_vpVolumeDatasets; SimpleTextureList m_vpSimpleTextures; Trans1DList m_vpTrans1DList; Trans2DList m_vpTrans2DList; GLVolumeList m_vpTex3DList; FBOList m_vpFBOList; GLSLList m_vpGLSLList; MasterController* m_MasterController; const SystemInfo& m_SystemInfo; uint64_t m_iAllocatedGPUMemory; uint64_t m_iAllocatedCPUMemory; uint64_t m_iFrameCounter; uint64_t m_iInCoreSize; std::vector m_vUploadHub; std::unique_ptr m_pMemReg; GLVolume* AllocOrGetVolume(Dataset* pDataset, const BrickKey& key, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder, bool bEmulate3DWith2DStacks, uint64_t iIntraFrameCounter, uint64_t iFrameCounter, int iShareGroupID); size_t DeleteUnusedBricks(int iShareGroupID); void DeleteArbitraryBrick(int iShareGroupID); void Delete3DTexture(size_t iIndex); void Delete3DTexture(const GLVolumeListIter &tex); void RegisterLuaCommands(); }; } #endif // TUVOK_GPUMEMMAN_H ImageVis3D-3.1.0/Tuvok/Renderer/GPUMemMan/GPUMemManDataStructs.h0000644000175000017500000002311312320456500023742 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GPUMemManDataStructs.h \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #pragma once #ifndef GPUMEMMANDATASTRUCTS_H #define GPUMEMMANDATASTRUCTS_H #include #include #include #include #include #include "3rdParty/GLEW/GL/glew.h" #include "boost/noncopyable.hpp" #include "Basics/Vectors.h" #include "IO/Brick.h" #include "../Context.h" #include "../../StdTuvokDefines.h" #include "../GL/GLFBOTex.h" #include "../GL/GLSLProgram.h" #include "Renderer/AbstrRenderer.h" #include "Renderer/ShaderDescriptor.h" class TransferFunction1D; class TransferFunction2D; class VolumeDataset; namespace tuvok { class Dataset; class GLTexture1D; class GLTexture2D; class GLTexture3D; class GLVolume; typedef std::deque< AbstrRenderer* > AbstrRendererList; typedef AbstrRendererList::iterator AbstrRendererListIter; // volume datasets class VolDataListElem { public: VolDataListElem(Dataset* _pVolumeDataset, AbstrRenderer* pUser) : pVolumeDataset(_pVolumeDataset) { qpUser.push_back(pUser); } Dataset* pVolumeDataset; AbstrRendererList qpUser; }; typedef std::deque VolDataList; typedef VolDataList::iterator VolDataListIter; // simple textures class SimpleTextureListElem { public: SimpleTextureListElem(uint32_t _iAccessCounter, GLTexture2D* _pTexture, std::string _strFilename, int iShareGroupID) : iAccessCounter(_iAccessCounter), pTexture(_pTexture), strFilename(_strFilename), m_iShareGroupID(iShareGroupID) {} uint32_t iAccessCounter; GLTexture2D* pTexture; std::string strFilename; int m_iShareGroupID; }; typedef std::deque SimpleTextureList; typedef SimpleTextureList::iterator SimpleTextureListIter; // 1D transfer functions class Trans1DListElem { public: Trans1DListElem(TransferFunction1D* _pTransferFunction1D, GLTexture1D* _pTexture, AbstrRenderer* pUser) : pTransferFunction1D(_pTransferFunction1D), pTexture(_pTexture), m_iShareGroupID(pUser->GetContext()->GetShareGroupID()) { qpUser.push_back(pUser); } TransferFunction1D* pTransferFunction1D; GLTexture1D* pTexture; AbstrRendererList qpUser; int m_iShareGroupID; }; typedef std::deque Trans1DList; typedef Trans1DList::iterator Trans1DListIter; // 2D transfer functions class Trans2DListElem { public: Trans2DListElem(TransferFunction2D* _pTransferFunction2D, GLTexture2D* _pTexture, AbstrRenderer* pUser) : pTransferFunction2D(_pTransferFunction2D), pTexture(_pTexture), m_iShareGroupID(pUser->GetContext()->GetShareGroupID()) { qpUser.push_back(pUser); } TransferFunction2D* pTransferFunction2D; GLTexture2D* pTexture; AbstrRendererList qpUser; int m_iShareGroupID; }; typedef std::deque Trans2DList; typedef Trans2DList::iterator Trans2DListIter; // 3D textures /// For equivalent contexts, it might actually be valid to copy a 3D texture /// object. However, for one, this is untested. Secondly, this object may /// hold the chunk of data for the 3D texture, so copying it in the general /// case would be a bad idea -- the copy might be large. class GLVolumeListElem : boost::noncopyable { public: GLVolumeListElem(Dataset* _pDataset, const BrickKey&, bool bIsPaddedToPowerOfTwo, bool bDisableBorder, bool bIsDownsampledTo8Bits, bool bEmulate3DWith2DStacks, uint64_t iIntraFrameCounter, uint64_t iFrameCounter, MasterController* pMasterController, std::vector& vUploadHub, int iShareGroupID); ~GLVolumeListElem(); bool Equals(const Dataset* _pDataset, const BrickKey&, bool bIsPaddedToPowerOfTwo, bool bIsDownsampledTo8Bits, bool bDisableBorder, bool bEmulate3DWith2DStacks, int iShareGroupID) const; bool Replace(Dataset* _pDataset, const BrickKey&, bool bIsPaddedToPowerOfTwo, bool bIsDownsampledTo8Bits, bool bDisableBorder, bool bEmulate3DWith2DStacks, uint64_t iIntraFrameCounter, uint64_t iFrameCounter, std::vector& vUploadHub, int iShareGroupID); bool BestMatch(const UINTVECTOR3& vDimension, bool bIsPaddedToPowerOfTwo, bool bIsDownsampledTo8Bits, bool bDisableBorder, bool bEmulate3DWith2DStacks, uint64_t& iIntraFrameCounter, uint64_t& iFrameCounter, int iShareGroupID) const; void GetCounters(uint64_t& iIntraFrameCounter, uint64_t& iFrameCounter) const { iIntraFrameCounter = m_iIntraFrameCounter; iFrameCounter = m_iFrameCounter; } /// Calculates the sizes for all GLVolume's we've currently got loaded. ///@{ size_t GetGPUSize() const; size_t GetCPUSize() const; ///@} GLVolume* Access(uint64_t& iIntraFrameCounter, uint64_t& iFrameCounter); bool LoadData(std::vector& vUploadHub); void FreeData(); std::pair, UINTVECTOR3> PadData( unsigned char* pRawData, UINTVECTOR3 vSize, uint64_t iBitWidth, uint64_t iCompCount ) const; bool CreateTexture(std::vector& vUploadHub, bool bDeleteOldTexture=true); void FreeTexture(); std::vector vData; GLVolume* volume; Dataset* pDataset; uint32_t iUserCount; uint64_t GetIntraFrameCounter() const {return m_iIntraFrameCounter;} uint64_t GetFrameCounter() const {return m_iFrameCounter;} int GetShareGroupID() const {return m_iShareGroupID;} private: bool Match(const UINTVECTOR3& vDimension) const; uint64_t m_iIntraFrameCounter; uint64_t m_iFrameCounter; MasterController* m_pMasterController; BrickKey m_Key; bool m_bIsPaddedToPowerOfTwo; bool m_bIsDownsampledTo8Bits; bool m_bDisableBorder; bool m_bEmulate3DWith2DStacks; bool m_bUsingHub; int m_iShareGroupID; }; typedef std::deque GLVolumeList; typedef GLVolumeList::iterator GLVolumeListIter; typedef GLVolumeList::const_iterator GLVolumeListConstIter; // framebuffer objects class FBOListElem { public: FBOListElem(GLFBOTex* _pFBOTex, int iShareGroupID) : pFBOTex(_pFBOTex), m_iShareGroupID(iShareGroupID) {} FBOListElem(MasterController* pMasterController, GLenum minfilter, GLenum magfilter, GLenum wrapmode, GLsizei width, GLsizei height, GLenum intformat, GLenum format, GLenum type, bool bHaveDepth, int iNumBuffers, int iShareGroupID) : pFBOTex(new GLFBOTex(pMasterController, minfilter, magfilter, wrapmode, width, height, intformat, format, type, bHaveDepth, iNumBuffers)), m_iShareGroupID(iShareGroupID) {} ~FBOListElem() { delete pFBOTex; } GLFBOTex* const pFBOTex; int m_iShareGroupID; }; typedef std::deque FBOList; typedef FBOList::iterator FBOListIter; // shader objects class GLSLListElem { public: GLSLListElem(MasterController* mc, const ShaderDescriptor& sd, int iShareGroupID, bool load=true) : sdesc(sd), iAccessCounter(1), pGLSLProgram(new GLSLProgram(mc)), m_iShareGroupID(iShareGroupID) { if(load) { pGLSLProgram->Load(sdesc); if(!pGLSLProgram->IsValid()) { delete pGLSLProgram; pGLSLProgram = NULL; } } } ~GLSLListElem() { delete pGLSLProgram; } bool operator ==(const GLSLListElem& glsl) const { return m_iShareGroupID == glsl.m_iShareGroupID && sdesc == glsl.sdesc; } const ShaderDescriptor sdesc; uint32_t iAccessCounter; GLSLProgram* pGLSLProgram; const int m_iShareGroupID; }; typedef std::deque GLSLList; typedef GLSLList::iterator GLSLListIter; typedef GLSLList::const_iterator GLSLConstListIter; }; #endif // GPUMEMMANDATASTRUCTS_H ImageVis3D-3.1.0/Tuvok/Renderer/GPUMemMan/GPUMemManDataStructs.cpp0000644000175000017500000004262512320456500024306 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GPUMemManDataStructs.cpp \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #include #include #include #include #include #include "IO/IOManager.h" #include "GPUMemManDataStructs.h" #include "Basics/MathTools.h" #include "Controller/Controller.h" #include "IO/uvfDataset.h" #include "Renderer/GL/GLTexture3D.h" #include "Renderer/GL/GLTexture2D.h" #include "Renderer/GL/GLVolume3DTex.h" #include "Renderer/GL/GLVolume2DTex.h" using namespace tuvok; GLVolumeListElem::GLVolumeListElem(Dataset* _pDataset, const BrickKey& key, bool bIsPaddedToPowerOfTwo, bool bIsDownsampledTo8Bits, bool bDisableBorder, bool bEmulate3DWith2DStacks, uint64_t iIntraFrameCounter, uint64_t iFrameCounter, MasterController* pMasterController, std::vector& vUploadHub, int iShareGroupID) : pDataset(_pDataset), iUserCount(1), m_iIntraFrameCounter(iIntraFrameCounter), m_iFrameCounter(iFrameCounter), m_pMasterController(pMasterController), m_Key(key), m_bIsPaddedToPowerOfTwo(bIsPaddedToPowerOfTwo), m_bIsDownsampledTo8Bits(bIsDownsampledTo8Bits), m_bDisableBorder(bDisableBorder), m_bEmulate3DWith2DStacks(bEmulate3DWith2DStacks), m_bUsingHub(false), m_iShareGroupID(iShareGroupID) { // initialize the volumes to be null pointers. volume = NULL; if (!CreateTexture(vUploadHub) && volume) { FreeTexture(); } } GLVolumeListElem::~GLVolumeListElem() { FreeData(); FreeTexture(); } bool GLVolumeListElem::Equals(const Dataset* _pDataset, const BrickKey& key, bool bIsPaddedToPowerOfTwo, bool bIsDownsampledTo8Bits, bool bDisableBorder, bool bEmulate3DWith2DStacks, int iShareGroupID) const { if (_pDataset != pDataset || m_Key != key || m_bIsPaddedToPowerOfTwo != bIsPaddedToPowerOfTwo || m_bIsDownsampledTo8Bits != bIsDownsampledTo8Bits || m_bDisableBorder != bDisableBorder || m_bEmulate3DWith2DStacks != bEmulate3DWith2DStacks || m_iShareGroupID != iShareGroupID) { return false; } return true; } GLVolume* GLVolumeListElem::Access(uint64_t& iIntraFrameCounter, uint64_t& iFrameCounter) { m_iIntraFrameCounter = iIntraFrameCounter; m_iFrameCounter = iFrameCounter; iUserCount++; return volume; } bool GLVolumeListElem::BestMatch(const UINTVECTOR3& vDimension, bool bIsPaddedToPowerOfTwo, bool bIsDownsampledTo8Bits, bool bDisableBorder, bool bEmulate3DWith2DStacks, uint64_t& iIntraFrameCounter, uint64_t& iFrameCounter, int iShareGroupID) const { if (!Match(vDimension) || iUserCount > 0 || m_bIsPaddedToPowerOfTwo != bIsPaddedToPowerOfTwo || m_bIsDownsampledTo8Bits != bIsDownsampledTo8Bits || m_bDisableBorder != bDisableBorder || m_bEmulate3DWith2DStacks != bEmulate3DWith2DStacks || m_iShareGroupID != iShareGroupID) { return false; } // framewise older data as before found -> use this object if (iFrameCounter > m_iFrameCounter) { iFrameCounter = m_iFrameCounter; iIntraFrameCounter = m_iIntraFrameCounter; return true; } // framewise older data as before found -> use this object if (iFrameCounter == m_iFrameCounter && iIntraFrameCounter < m_iIntraFrameCounter) { iFrameCounter = m_iFrameCounter; iIntraFrameCounter = m_iIntraFrameCounter; return true; } return false; } namespace nonstd { // an accumulate which follows the standard accumulate, except instead of: // result = result + *i // at each iteration, it performs: // result = result + f(*i) // i.e. it applies a unary op to the item iterated over. How is this not // part of the standard already?? template T accumulate(InputIter first, InputIter last, T init, UnaryFunc uop) { T rv = init; for(; first != last; ++first) { rv = rv + T(uop(*first)); } return rv; } } size_t GLVolumeListElem::GetGPUSize() const { return size_t(volume->GetGPUSize()); /* // Apparently MSVC fixed this in 2010, but 2008 is broken. #if defined(_MSC_VER) && _MSC_VER <= 1500 size_t sz=0; for(size_t i=0; i < volumes.size(); ++i) { sz += size_t(volumes[i]->GetGPUSize()); } return sz; #else return static_cast(nonstd::accumulate( this->volumes.begin(), this->volumes.end(), 0, std::mem_fn(&GLVolume::GetGPUSize)) ); #endif */ } size_t GLVolumeListElem::GetCPUSize() const { return size_t(volume->GetCPUSize()); /* #if defined(_MSC_VER) && _MSC_VER <= 1500 size_t sz=0; for(size_t i=0; i < volumes.size(); ++i) { sz += size_t(volumes[i]->GetGPUSize()); } return sz; #else return static_cast(nonstd::accumulate( this->volumes.begin(), this->volumes.end(), 0, std::mem_fn(&GLVolume::GetCPUSize)) ); #endif */ } bool GLVolumeListElem::Match(const UINTVECTOR3& vDimension) const { if(!volume) { return false; } const UINTVECTOR3 vSize = pDataset->GetBrickVoxelCounts(m_Key); for (size_t i=0; i < 3; i++) { if (vSize[i] != vDimension[i]) { return false; } } return true; } bool GLVolumeListElem::Replace(Dataset* _pDataset, const BrickKey& key, bool bIsPaddedToPowerOfTwo, bool bIsDownsampledTo8Bits, bool bDisableBorder, bool bEmulate3DWith2DStacks, uint64_t iIntraFrameCounter, uint64_t iFrameCounter, std::vector& vUploadHub, int iShareGroupID) { if(!volume) { return false; } pDataset = _pDataset; #ifdef __clang__ BrickKey tmpKey = key; m_Key = tmpKey; #else m_Key = key; #endif m_bIsPaddedToPowerOfTwo = bIsPaddedToPowerOfTwo; m_bIsDownsampledTo8Bits = bIsDownsampledTo8Bits; m_bDisableBorder = bDisableBorder; m_bEmulate3DWith2DStacks = bEmulate3DWith2DStacks; assert(m_iShareGroupID == iShareGroupID); #ifdef NDEBUG // avoid 'unused variable' warning. (void)iShareGroupID; #endif m_iIntraFrameCounter = iIntraFrameCounter; m_iFrameCounter = iFrameCounter; if (!LoadData(vUploadHub)) { T_ERROR("LoadData call failed, system may be out of memory"); return false; } while (glGetError() != GL_NO_ERROR) {}; // clear gl error flags const UINTVECTOR3 vSize = pDataset->GetBrickVoxelCounts(m_Key); if (!m_bIsPaddedToPowerOfTwo || (MathTools::IsPow2(uint32_t(vSize[0])) && MathTools::IsPow2(uint32_t(vSize[1])) && MathTools::IsPow2(uint32_t(vSize[2])))) { volume->SetData(m_bUsingHub ? &vUploadHub.at(0) : &vData.at(0)); } else { std::pair, UINTVECTOR3> padded = PadData( m_bUsingHub ? &vUploadHub.at(0) : &vData.at(0), pDataset->GetBrickVoxelCounts(m_Key), pDataset->GetBitWidth(), pDataset->GetComponentCount() ); volume->SetData(padded.first.get()); } return GL_NO_ERROR==glGetError(); } bool GLVolumeListElem::LoadData(std::vector& vUploadHub) { const UINTVECTOR3 vSize = pDataset->GetBrickVoxelCounts(m_Key); uint64_t iByteWidth = pDataset->GetBitWidth()/8; uint64_t iCompCount = pDataset->GetComponentCount(); uint64_t iBrickSize = vSize[0]*vSize[1]*vSize[2]*iByteWidth * iCompCount; if (!vUploadHub.empty() && iBrickSize <= uint64_t(m_pMasterController->IOMan()->GetIncoresize()*4)) { m_bUsingHub = true; return pDataset->GetBrick(m_Key, vUploadHub); } else { return pDataset->GetBrick(m_Key, vData); } } void GLVolumeListElem::FreeData() { vData.resize(0); } static void DeleteArray(unsigned char* p) { delete[] p; } std::pair, UINTVECTOR3> GLVolumeListElem::PadData(unsigned char* pRawData, UINTVECTOR3 vSize, uint64_t iBitWidth, uint64_t iCompCount) const { // pad the data to a power of two UINTVECTOR3 vPaddedSize(MathTools::NextPow2(uint32_t(vSize[0])), MathTools::NextPow2(uint32_t(vSize[1])), MathTools::NextPow2(uint32_t(vSize[2]))); size_t iTarget = 0; size_t iSource = 0; size_t iElementSize = static_cast(iBitWidth/8*iCompCount); size_t iRowSizeSource = vSize[0]*iElementSize; size_t iRowSizeTarget = vPaddedSize[0]*iElementSize; std::shared_ptr pPaddedData; try { pPaddedData = std::shared_ptr( new unsigned char[iRowSizeTarget * vPaddedSize[1] * vPaddedSize[2]], DeleteArray ); } catch(std::bad_alloc&) { return std::make_pair(std::shared_ptr(), vPaddedSize); } memset(pPaddedData.get(), 0, iRowSizeTarget*vPaddedSize[1]*vPaddedSize[2]); for (size_t z = 0;z iRowSizeSource) memcpy(pPaddedData.get()+iTarget+iRowSizeSource, pPaddedData.get()+iTarget+iRowSizeSource-iElementSize, iElementSize); iTarget += iRowSizeTarget; iSource += iRowSizeSource; } // if the y sizes differ, duplicate the last element to make the texture // behave like clamp if (vPaddedSize[1] > vSize[1]) { if (!m_bDisableBorder) memcpy(pPaddedData.get()+iTarget, pPaddedData.get()+iTarget-iRowSizeTarget, iRowSizeTarget); iTarget += (vPaddedSize[1]-vSize[1])*iRowSizeTarget; } } // if the z sizes differ, duplicate the last element to make the texture // behave like clamp if (!m_bDisableBorder && vPaddedSize[2] > vSize[2]) { memcpy(pPaddedData.get()+iTarget, pPaddedData.get()+(iTarget-vPaddedSize[1]*iRowSizeTarget), vPaddedSize[1]*iRowSizeTarget); } MESSAGE("Actually using new texture %u x %u x %u, bitsize=%llu, " "componentcount=%llu due to compatibility settings", vPaddedSize[0], vPaddedSize[1], vPaddedSize[2], iBitWidth, iCompCount); return std::make_pair(pPaddedData, vPaddedSize); } bool GLVolumeListElem::CreateTexture(std::vector& vUploadHub, bool bDeleteOldTexture) { if (bDeleteOldTexture) FreeTexture(); if (vData.empty()) { MESSAGE("Completely reloading brick"); if (!LoadData(vUploadHub)) { return false; } } else { MESSAGE("Reusing CPU copy of brick data"); } unsigned char* pRawData = (m_bUsingHub) ? &vUploadHub.at(0) : &vData.at(0); // Figure out how big this is going to be. const UINTVECTOR3 vSize = pDataset->GetBrickVoxelCounts(m_Key); bool bToggleEndian = !pDataset->IsSameEndianness(); uint64_t iBitWidth = pDataset->GetBitWidth(); uint64_t iCompCount = pDataset->GetComponentCount(); MESSAGE("%llu components of width %llu", iCompCount, iBitWidth); GLint glInternalformat; GLenum glFormat; GLenum glType; if (m_bIsDownsampledTo8Bits && iBitWidth != 8) { // here we assume that data which is not 8 bit is 16 bit if (iBitWidth != 16) { T_ERROR("Don't know how to handle %llu-bit data.", iBitWidth); FreeData(); return false; } double fMin = pDataset->GetRange().first; double fMax = pDataset->GetRange().second; for (size_t i = 0;i); } switch (iCompCount) { case 1 : glInternalformat = GL_LUMINANCE16; break; case 3 : glInternalformat = GL_RGB16; break; case 4 : glInternalformat = GL_RGBA16; break; default : FreeData(); return false; } } else { if(iBitWidth == 32) { glType = GL_FLOAT; glInternalformat = GL_LUMINANCE32F_ARB; glFormat = GL_LUMINANCE; } else { T_ERROR("Cannot handle data of width %d", iBitWidth); FreeData(); return false; } } } glGetError(); if (!m_bIsPaddedToPowerOfTwo || (MathTools::IsPow2(uint32_t(vSize[0])) && MathTools::IsPow2(uint32_t(vSize[1])) && MathTools::IsPow2(uint32_t(vSize[2])))) { GLenum clamp = m_bDisableBorder ? GL_CLAMP_TO_EDGE : GL_CLAMP; if (m_bEmulate3DWith2DStacks) { volume = new GLVolume2DTex(uint32_t(vSize[0]), uint32_t(vSize[1]), uint32_t(vSize[2]), glInternalformat, glFormat, glType, pRawData, GL_LINEAR, GL_LINEAR, clamp, clamp, clamp); } else { volume = new GLVolume3DTex(uint32_t(vSize[0]), uint32_t(vSize[1]), uint32_t(vSize[2]), glInternalformat, glFormat, glType, pRawData, GL_LINEAR, GL_LINEAR, clamp, clamp, clamp); } } else { std::pair, UINTVECTOR3> padded = PadData(pRawData, vSize, iBitWidth, iCompCount); const std::shared_ptr& pPaddedData = padded.first; const UINTVECTOR3& vPaddedSize = padded.second; if (m_bEmulate3DWith2DStacks) { volume = new GLVolume2DTex(vPaddedSize[0], vPaddedSize[1], vPaddedSize[2], glInternalformat, glFormat, glType, pPaddedData.get(), GL_LINEAR, GL_LINEAR, m_bDisableBorder ? GL_CLAMP_TO_EDGE : GL_CLAMP, m_bDisableBorder ? GL_CLAMP_TO_EDGE : GL_CLAMP, m_bDisableBorder ? GL_CLAMP_TO_EDGE : GL_CLAMP); } else { volume = new GLVolume3DTex(vPaddedSize[0], vPaddedSize[1], vPaddedSize[2], glInternalformat, glFormat, glType, pPaddedData.get(), GL_LINEAR, GL_LINEAR, m_bDisableBorder ? GL_CLAMP_TO_EDGE : GL_CLAMP, m_bDisableBorder ? GL_CLAMP_TO_EDGE : GL_CLAMP, m_bDisableBorder ? GL_CLAMP_TO_EDGE : GL_CLAMP); } } // In the OpenGL case we can release the data at this point as we // let the OpenGL subsystem handle the CPU/GPU paging, i.e. we ignore // the GPU usage FreeData(); return GL_NO_ERROR==glGetError(); } void GLVolumeListElem::FreeTexture() { if (volume) { delete volume; volume = NULL; } } ImageVis3D-3.1.0/Tuvok/Renderer/GPUMemMan/GPUMemMan.cpp0000644000175000017500000013517512320456500022127 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file GPUMemMan.h \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #include #include #include #include #include #include // normally we'd include Qt headers first, but we want to make sure to get GLEW // before GL in this special case. #include "GPUMemMan.h" #ifndef TUVOK_NO_QT # include # include #endif #include "Basics/SystemInfo.h" #include "Basics/SysTools.h" #include "Controller/Controller.h" #include "GPUMemManDataStructs.h" #include "IO/FileBackedDataset.h" #include "IO/IOManager.h" #include "IO/TransferFunction1D.h" #include "IO/TransferFunction2D.h" #include "IO/TuvokSizes.h" #include "Renderer/AbstrRenderer.h" #include "Renderer/ShaderDescriptor.h" #include "Renderer/GL/GLError.h" #include "Renderer/GL/GLTexture1D.h" #include "Renderer/GL/GLTexture2D.h" #include "Renderer/GL/GLVolume.h" #include "Renderer/GL/GLCommon.h" #include "IO/uvfDataset.h" #include "Renderer/GL/GLVolumePool.h" #include "../LuaScripting/LuaScripting.h" #include "../LuaScripting/LuaMemberReg.h" #include "../LuaScripting/TuvokSpecific/LuaTuvokTypes.h" #include "../LuaScripting/TuvokSpecific/LuaTransferFun1DProxy.h" #include "../LuaScripting/TuvokSpecific/LuaTransferFun2DProxy.h" using namespace std; using namespace std::placeholders; using namespace tuvok; GPUMemMan::GPUMemMan(MasterController* masterController) : m_MasterController(masterController), m_SystemInfo(*masterController->SysInfo()), m_iAllocatedGPUMemory(0), m_iAllocatedCPUMemory(0), m_iFrameCounter(0), m_iInCoreSize(DEFAULT_INCORESIZE), m_pMemReg(new LuaMemberReg(masterController->LuaScript())) { if (masterController && masterController->IOMan()) { m_iInCoreSize = masterController->IOMan()->GetIncoresize(); } m_vUploadHub.resize(size_t(m_iInCoreSize*4)); m_iAllocatedCPUMemory = size_t(m_iInCoreSize*4); RegisterLuaCommands(); } GPUMemMan::~GPUMemMan() { // Can't access the controller through the singleton; this destructor is // called during MC's destructor! Since the MC is dying, we shouldn't rely // on anything within it being valid, but as a bit of a hack we'll grab the // active debug output anyway. This works because we know that the debug // outputs will be deleted last -- after the memory manager. AbstrDebugOut &dbg = *(m_MasterController->DebugOut()); for (VolDataListIter i = m_vpVolumeDatasets.begin(); i < m_vpVolumeDatasets.end(); ++i) { try { dbg.Warning(_func_, "Detected unfreed dataset %s.", dynamic_cast (*(i->pVolumeDataset)).Filename().c_str()); } catch(std::bad_cast) { dbg.Warning(_func_, "Detected unfreed dataset %p.", i->pVolumeDataset); } delete i->pVolumeDataset; } for (SimpleTextureListIter i = m_vpSimpleTextures.begin(); i < m_vpSimpleTextures.end(); ++i) { dbg.Warning(_func_, "Detected unfreed SimpleTexture %s.", i->strFilename.c_str()); m_iAllocatedGPUMemory -= i->pTexture->GetGPUSize(); m_iAllocatedCPUMemory -= i->pTexture->GetCPUSize(); delete i->pTexture; } for (Trans1DListIter i = m_vpTrans1DList.begin(); i < m_vpTrans1DList.end(); ++i) { dbg.Warning(_func_, "Detected unfreed 1D Transferfunction."); m_iAllocatedGPUMemory -= i->pTexture->GetGPUSize(); m_iAllocatedCPUMemory -= i->pTexture->GetCPUSize(); delete i->pTexture; delete i->pTransferFunction1D; } for (Trans2DListIter i = m_vpTrans2DList.begin(); i < m_vpTrans2DList.end(); ++i) { dbg.Warning(_func_, "Detected unfreed 2D Transferfunction."); m_iAllocatedGPUMemory -= i->pTexture->GetGPUSize(); m_iAllocatedCPUMemory -= i->pTexture->GetCPUSize(); delete i->pTexture; delete i->pTransferFunction2D; } for (GLVolumeListIter i = m_vpTex3DList.begin(); i < m_vpTex3DList.end(); ++i) { dbg.Warning(_func_, "Detected unfreed 3D texture."); m_iAllocatedGPUMemory -= (*i)->GetGPUSize(); m_iAllocatedCPUMemory -= (*i)->GetCPUSize(); delete (*i); } for (FBOListIter i = m_vpFBOList.begin(); i < m_vpFBOList.end(); ++i) { dbg.Warning(_func_, "Detected unfreed FBO."); m_iAllocatedGPUMemory -= (*i)->pFBOTex->GetGPUSize(); m_iAllocatedCPUMemory -= (*i)->pFBOTex->GetCPUSize(); delete (*i); } for (GLSLListIter i = m_vpGLSLList.begin(); i < m_vpGLSLList.end(); ++i) { dbg.Warning(_func_, "Detected unfreed GLSL program."); m_iAllocatedGPUMemory -= (*i)->pGLSLProgram->GetGPUSize(); m_iAllocatedCPUMemory -= (*i)->pGLSLProgram->GetCPUSize(); delete (*i); } m_vUploadHub.clear(); m_iAllocatedCPUMemory -= size_t(m_iInCoreSize*4); assert(m_iAllocatedGPUMemory == 0); assert(m_iAllocatedCPUMemory == 0); } Dataset* GPUMemMan::LoadDataset(const string& strFilename, AbstrRenderer* requester) { // We want to reuse datasets which have already been loaded. Yet // we have a list of `Dataset's, not `FileBackedDataset's, and so // therefore we can't rely on each element of the list having a file // backing it up. // // Yet they all will; this method is never going to get called for datasets // which are given from clients via an in-memory transfer. Thus nothing is // ever going to get added to the list which isn't a FileBackedDataset. // // We could make the list be composed only of FileBackedDatasets. // Eventually we'd like to do dataset caching for any client though, // not just ImageVis3D. for (VolDataListIter i = m_vpVolumeDatasets.begin(); i < m_vpVolumeDatasets.end(); ++i) { // Given the above explanation, this cast is guaranteed to succeed. FileBackedDataset *dataset = dynamic_cast (i->pVolumeDataset); assert(dataset != NULL); if (dataset->Filename() == strFilename) { MESSAGE("Reusing %s", strFilename.c_str()); i->qpUser.push_back(requester); return i->pVolumeDataset; } } MESSAGE("Loading %s", strFilename.c_str()); const IOManager& mgr = *m_MasterController->IOMan(); /// @todo fixme: just use `Dataset's here; instead of explicitly doing the /// IsOpen check, below, just rely on an exception being thrown. Dataset* dataset = // false: assume the file has already been verified mgr.CreateDataset(strFilename, mgr.GetMaxBrickSize(), false); m_vpVolumeDatasets.push_back(VolDataListElem(dataset, requester)); return dataset; } void GPUMemMan::AddDataset(Dataset* ds, AbstrRenderer *requester) { m_vpVolumeDatasets.push_back(VolDataListElem(ds, requester)); } // Functor to find the VolDataListElem which holds the Dataset given in // the constructor. struct find_ds : public std::unary_function { find_ds(const Dataset* vds) : _ds(vds) { } bool operator()(const VolDataListElem &cmp) const { return cmp.pVolumeDataset == _ds; } private: const Dataset* _ds; }; void GPUMemMan::FreeDataset(Dataset* pVolumeDataset, AbstrRenderer* requester) { // store a name conditional for later logging std::string ds_name; try { const FileBackedDataset& ds = dynamic_cast (*pVolumeDataset); ds_name = ds.Filename(); } catch(std::bad_cast) { ds_name = "(unnamed dataset)"; } // find the dataset this refers to in our internal list VolDataListIter vol_ds = std::find_if(m_vpVolumeDatasets.begin(), m_vpVolumeDatasets.end(), find_ds(pVolumeDataset)); // Don't access the singleton; see comment in the destructor. AbstrDebugOut &dbg = *(m_MasterController->DebugOut()); if(vol_ds == m_vpVolumeDatasets.end()) { dbg.Warning(_func_,"Dataset '%s' not found or not being used by requester", ds_name.c_str()); return; } // search for a renderer that the dataset is using AbstrRendererListIter renderer = std::find(vol_ds->qpUser.begin(), vol_ds->qpUser.end(), requester); // bail out if there doesn't appear to be a link between the DS and a // renderer. if(renderer == vol_ds->qpUser.end()) { dbg.Warning(_func_, "Dataset %s does not seem to be associated " "with a renderer.", ds_name.c_str()); return; } // remove it from the list of renderers which use this DS; if this brings the // reference count of the DS to 0, delete it. vol_ds->qpUser.erase(renderer); if(vol_ds->qpUser.empty()) { dbg.Message(_func_, "Cleaning up all 3D textures associated w/ dataset %s", ds_name.c_str()); if (requester->GetContext()) // if we never created a context then we never created any textures FreeAssociatedTextures(pVolumeDataset, requester->GetContext()->GetShareGroupID()); dbg.Message(_func_, "Released Dataset %s", ds_name.c_str()); delete pVolumeDataset; m_vpVolumeDatasets.erase(vol_ds); } else { dbg.Message(_func_,"Decreased access count but dataset %s is still " " in use by another subsystem", ds_name.c_str()); } } // ******************** Simple Textures GLTexture2D* GPUMemMan::Load2DTextureFromFile(const string& strFilename, int iShareGroupID) { for (SimpleTextureListIter i = m_vpSimpleTextures.begin(); i < m_vpSimpleTextures.end(); ++i) { if (i->strFilename == strFilename && i->m_iShareGroupID == iShareGroupID) { MESSAGE("Reusing %s", strFilename.c_str()); i->iAccessCounter++; return i->pTexture; } } #ifndef TUVOK_NO_QT QImage image; if (!image.load(strFilename.c_str())) { T_ERROR("Unable to load file %s", strFilename.c_str()); return NULL; } MESSAGE("Loaded %s, now creating OpenGL resources ..", strFilename.c_str()); QImage glimage = QGLWidget::convertToGLFormat(image); GLTexture2D* tex = new GLTexture2D(glimage.width(),glimage.height(), GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, glimage.bits()); m_iAllocatedGPUMemory += tex->GetGPUSize(); m_iAllocatedCPUMemory += tex->GetCPUSize(); m_vpSimpleTextures.push_back(SimpleTextureListElem(1,tex,strFilename,iShareGroupID)); return tex; #else T_ERROR("No Qt support!"); return NULL; #endif } void GPUMemMan::FreeTexture(GLTexture2D* pTexture) { for (SimpleTextureListIter i = m_vpSimpleTextures.begin(); i < m_vpSimpleTextures.end(); ++i) { if (i->pTexture == pTexture) { i->iAccessCounter--; if (i->iAccessCounter == 0) { MESSAGE("Deleted texture %s", i->strFilename.c_str()); m_iAllocatedGPUMemory -= i->pTexture->GetGPUSize(); m_iAllocatedCPUMemory -= i->pTexture->GetCPUSize(); i->pTexture->Delete(); m_vpSimpleTextures.erase(i); } else { MESSAGE("Decreased access count, " "but the texture %s is still in use by another subsystem", i->strFilename.c_str()); } return; } } WARNING("Texture not found"); } // ******************** 1D Trans void GPUMemMan::Changed1DTrans(LuaClassInstance luaAbstrRen, LuaClassInstance tf1d) { MESSAGE("Sending change notification for 1D transfer function"); shared_ptr ss = m_MasterController->LuaScript(); // Convert LuaClassInstance -> LuaTransferFun1DProxy -> TransferFunction1D LuaTransferFun1DProxy* tfProxy = tf1d.getRawPointer(ss); TransferFunction1D* pTransferFunction1D = tfProxy->get1DTransferFunction(); pTransferFunction1D->ComputeNonZeroLimits(); // Retrieve raw pointer for the Abstract renderer. AbstrRenderer* requester = NULL; if (luaAbstrRen.isValid(ss)) { requester = luaAbstrRen.getRawPointer(ss); } for (Trans1DListIter i = m_vpTrans1DList.begin();ipTransferFunction1D == pTransferFunction1D) { for (AbstrRendererListIter j = i->qpUser.begin();jqpUser.end();j++) { if (*j != requester) (*j)->Changed1DTrans(); } } } } void GPUMemMan::GetEmpty1DTrans(size_t iSize, AbstrRenderer* requester, TransferFunction1D** ppTransferFunction1D, GLTexture1D** tex) { MESSAGE("Creating new empty 1D transfer function"); assert(iSize > 0); // if not, our TF would be *really* empty :) *ppTransferFunction1D = new TransferFunction1D(iSize); (*ppTransferFunction1D)->SetStdFunction(); std::vector vTFData; (*ppTransferFunction1D)->GetByteArray(vTFData); *tex = new GLTexture1D(uint32_t((*ppTransferFunction1D)->GetSize()), GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, &vTFData.at(0)); m_iAllocatedGPUMemory += (*tex)->GetGPUSize(); m_iAllocatedCPUMemory += (*tex)->GetCPUSize(); m_vpTrans1DList.push_back(Trans1DListElem(*ppTransferFunction1D, *tex, requester)); } void GPUMemMan::Get1DTransFromFile(const string& strFilename, AbstrRenderer* requester, TransferFunction1D** ppTransferFunction1D, GLTexture1D** tex, size_t iSize) { MESSAGE("Loading 1D transfer function from file"); *ppTransferFunction1D = new TransferFunction1D(strFilename); if (iSize != 0 && (*ppTransferFunction1D)->GetSize() != iSize) { (*ppTransferFunction1D)->Resample(iSize); } std::vector vTFData; (*ppTransferFunction1D)->GetByteArray(vTFData); *tex = new GLTexture1D(uint32_t((*ppTransferFunction1D)->GetSize()), GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, &vTFData.at(0)); m_iAllocatedGPUMemory += (*tex)->GetGPUSize(); m_iAllocatedCPUMemory += (*tex)->GetCPUSize(); m_vpTrans1DList.push_back(Trans1DListElem(*ppTransferFunction1D, *tex, requester)); } std::pair GPUMemMan::SetExternal1DTrans(const std::vector& rgba, AbstrRenderer* requester) { const size_t sz = rgba.size() / 4; // RGBA, i.e. 4 components. MESSAGE("Setting %u element 1D TF from external source.", static_cast(sz)); assert(!rgba.empty()); TransferFunction1D *tf1d = new TransferFunction1D(sz); tf1d->Set(rgba); GLTexture1D *tex = new GLTexture1D(static_cast(tf1d->GetSize()), GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, &rgba.at(0)); m_iAllocatedGPUMemory += tex->GetGPUSize(); m_iAllocatedCPUMemory += tex->GetCPUSize(); m_vpTrans1DList.push_back(Trans1DListElem(tf1d, tex, requester)); return std::make_pair(tf1d, tex); } GLTexture1D* GPUMemMan::Access1DTrans(TransferFunction1D* pTransferFunction1D, AbstrRenderer* requester) { for (Trans1DListIter i = m_vpTrans1DList.begin();ipTransferFunction1D == pTransferFunction1D) { MESSAGE("Accessing 1D transferfunction"); i->qpUser.push_back(requester); return i->pTexture; } } T_ERROR("Unable to find 1D transferfunction"); return NULL; } void GPUMemMan::Free1DTrans(TransferFunction1D* pTransferFunction1D, const AbstrRenderer* requester) { AbstrDebugOut &dbg = *(m_MasterController->DebugOut()); for (Trans1DListIter i = m_vpTrans1DList.begin(); i < m_vpTrans1DList.end(); ++i) { if (i->pTransferFunction1D == pTransferFunction1D) { for (AbstrRendererListIter j = i->qpUser.begin();jqpUser.end();j++) { if (*j == requester) { i->qpUser.erase(j); if (i->qpUser.empty()) { dbg.Message(_func_, "Released 1D TF"); m_iAllocatedGPUMemory -= i->pTexture->GetGPUSize(); m_iAllocatedCPUMemory -= i->pTexture->GetCPUSize(); delete i->pTransferFunction1D; i->pTexture->Delete(); delete i->pTexture; m_vpTrans1DList.erase(i); } else { dbg.Message(_func_, "Decreased access count, but 1D TF is still " "in use by another subsystem."); } return; } } } } dbg.Warning(_func_, "1D TF not found not in use by requester."); } // ******************** 2D Trans void GPUMemMan::Changed2DTrans(LuaClassInstance luaAbstrRen, LuaClassInstance tf2d) { MESSAGE("Sending change notification for 2D transfer function"); shared_ptr ss = m_MasterController->LuaScript(); // Convert LuaClassInstance -> LuaTransferFun2DProxy -> TransferFunction2D LuaTransferFun2DProxy* tfProxy = tf2d.getRawPointer(ss); TransferFunction2D* pTransferFunction2D = tfProxy->get2DTransferFunction(); pTransferFunction2D->InvalidateCache(); pTransferFunction2D->ComputeNonZeroLimits(); // Retrieve raw pointer for the Abstract renderer. AbstrRenderer* requester = NULL; if (luaAbstrRen.isValid(ss)) { requester = luaAbstrRen.getRawPointer(ss); } for (Trans2DListIter i = m_vpTrans2DList.begin(); i < m_vpTrans2DList.end(); ++i) { if (i->pTransferFunction2D == pTransferFunction2D) { for (AbstrRendererListIter j = i->qpUser.begin();jqpUser.end();j++) { if (*j != requester) (*j)->Changed2DTrans(); } } } } void GPUMemMan::GetEmpty2DTrans(const VECTOR2& iSize, AbstrRenderer* requester, TransferFunction2D** ppTransferFunction2D, GLTexture2D** tex) { MESSAGE("Creating new empty 2D transfer function"); *ppTransferFunction2D = new TransferFunction2D(iSize); unsigned char* pcData = NULL; (*ppTransferFunction2D)->GetByteArray(&pcData); *tex = new GLTexture2D(uint32_t(iSize.x), uint32_t(iSize.y), GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, pcData); delete [] pcData; m_iAllocatedGPUMemory += (*tex)->GetGPUSize(); m_iAllocatedCPUMemory += (*tex)->GetCPUSize(); m_vpTrans2DList.push_back(Trans2DListElem(*ppTransferFunction2D, *tex, requester)); } void GPUMemMan::Get2DTransFromFile(const string& strFilename, AbstrRenderer* requester, TransferFunction2D** ppTransferFunction2D, GLTexture2D** tex, const VECTOR2& vSize) { MESSAGE("Loading 2D transfer function from file"); *ppTransferFunction2D = new TransferFunction2D(); if(!(*ppTransferFunction2D)->Load(strFilename)) { T_ERROR("Loading failed."); delete *ppTransferFunction2D; *ppTransferFunction2D = NULL; return; } if ((vSize.x != 0 || vSize.y != 0) && (*ppTransferFunction2D)->GetSize() != vSize) { MESSAGE("2D transfer function needs resampling..."); (*ppTransferFunction2D)->Resample(vSize); } unsigned char* pcData = NULL; (*ppTransferFunction2D)->GetByteArray(&pcData); *tex = new GLTexture2D(uint32_t((*ppTransferFunction2D)->GetSize().x), uint32_t((*ppTransferFunction2D)->GetSize().y), GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE,pcData); delete [] pcData; m_iAllocatedGPUMemory += (*tex)->GetGPUSize(); m_iAllocatedCPUMemory += (*tex)->GetCPUSize(); m_vpTrans2DList.push_back(Trans2DListElem(*ppTransferFunction2D, *tex, requester)); } GLTexture2D* GPUMemMan::Access2DTrans(TransferFunction2D* pTransferFunction2D, AbstrRenderer* requester) { for (Trans2DListIter i = m_vpTrans2DList.begin();ipTransferFunction2D == pTransferFunction2D) { MESSAGE("Accessing 2D transferfunction"); i->qpUser.push_back(requester); return i->pTexture; } } T_ERROR("Unable to find 2D transferfunction"); return NULL; } void GPUMemMan::Free2DTrans(TransferFunction2D* pTransferFunction2D, const AbstrRenderer* requester) { AbstrDebugOut &dbg = *(m_MasterController->DebugOut()); for (Trans2DListIter i = m_vpTrans2DList.begin(); i < m_vpTrans2DList.end(); ++i) { if (i->pTransferFunction2D == pTransferFunction2D) { for (AbstrRendererListIter j = i->qpUser.begin();jqpUser.end();j++) { if (*j == requester) { i->qpUser.erase(j); if (i->qpUser.empty()) { dbg.Message(_func_, "Released 2D TF"); m_iAllocatedGPUMemory -= i->pTexture->GetGPUSize(); m_iAllocatedCPUMemory -= i->pTexture->GetCPUSize(); delete i->pTransferFunction2D; i->pTexture->Delete(); delete i->pTexture; m_vpTrans2DList.erase(i); } else { dbg.Message(_func_, "Decreased access count, " "but 2D TF is still in use by another subsystem."); } return; } } } } dbg.Warning(_func_, "2D TF not found or not in use by requester."); } // ******************** Volumes bool GPUMemMan::IsResident(const Dataset* pDataset, const BrickKey& key, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder, bool bEmulate3DWith2DStacks, int iShareGroupID) const { for(GLVolumeListConstIter i = m_vpTex3DList.begin(); i < m_vpTex3DList.end(); ++i) { if((*i)->Equals(pDataset, key, bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder, bEmulate3DWith2DStacks, iShareGroupID)) { return true; } } return false; } /// Calculates the amount of memory the given brick will take up. /// Slightly complicated because we might have an N-dimensional brick. static uint64_t required_cpu_memory(const Dataset& ds, const BrickKey& key) { uint64_t mem = 1; const UINTVECTOR3 size = ds.GetBrickVoxelCounts(key); mem = size[0] * size[1] * size[2]; mem *= ds.GetBitWidth()/8; mem *= ds.GetComponentCount(); return mem; } /// Searches the texture list for a texture which matches the given criterion. /// @return matching texture, or lst.end() if no texture matches. static GLVolumeListIter find_closest_texture(GLVolumeList &lst, const UINTVECTOR3& vSize, bool use_pot, bool downsample, bool disable_border, bool bEmulate3DWith2DStacks, int iShareGroupID) { uint64_t iTargetFrameCounter = UINT64_INVALID; uint64_t iTargetIntraFrameCounter = UINT64_INVALID; GLVolumeListIter iBestMatch = lst.end(); for (GLVolumeListIter i=lst.begin(); i < lst.end(); ++i) { if ((*i)->BestMatch(vSize, use_pot, downsample, disable_border, bEmulate3DWith2DStacks, iTargetIntraFrameCounter, iTargetFrameCounter, iShareGroupID)) { iBestMatch = i; } } if(iBestMatch != lst.end()) { MESSAGE(" Found suitable target brick from frame %llu with intraframe " "counter %llu.", iTargetFrameCounter, iTargetIntraFrameCounter); } return iBestMatch; } // We use our own function instead of a functor because we're searching through // a list of 3D textures, which are noncopyable. A copy operation on our 3d // texes would be expensive. template static ForwIter find_brick_with_usercount(ForwIter first, const ForwIter last, int iShareGroupID, uint32_t user_count) { while(first != last && !((*first)->iUserCount == user_count && iShareGroupID == (*first)->GetShareGroupID())) { ++first; } return first; } // Gets rid of *all* unused bricks. Returns the number of bricks it deleted. size_t GPUMemMan::DeleteUnusedBricks(int iShareGroupID) { size_t removed = 0; // This is a bit harsh. erase() in the middle of a deque invalidates *all* // iterators. So we repeatedly search for unused bricks, until our search // comes up empty. // That said, erase() at the beginning or end of a deque only invalidates the // pointed-to element. You might consider an optimization where we delete // all unused bricks from the beginning and end of the structure, before // moving on to the exhaustive+expensive search. bool found; do { found = false; const GLVolumeListIter& iter = find_brick_with_usercount( m_vpTex3DList.begin(), m_vpTex3DList.end(), 0, iShareGroupID ); if(iter != m_vpTex3DList.end()) { ++removed; found = true; Delete3DTexture(iter); } } while(!m_vpTex3DList.empty() && found); MESSAGE("Got rid of %u unused bricks.", static_cast(removed)); return removed; } // We don't have enough CPU memory to load something. Get rid of a brick. void GPUMemMan::DeleteArbitraryBrick(int iShareGroupID) { assert(!m_vpTex3DList.empty()); // Identify the least used brick. The 128 is an arbitrary choice. We want // it to be high enough to hit every conceivable number of users for a brick. // We don't want to use 2^32 though, because then the application would feel // like it hung if we had some other bug. for(uint32_t in_use_by=0; in_use_by < 128; ++in_use_by) { const GLVolumeListIter& iter = find_brick_with_usercount( m_vpTex3DList.begin(), m_vpTex3DList.end(), iShareGroupID, in_use_by ); if(iter != m_vpTex3DList.end()) { MESSAGE(" Deleting texture %d", std::distance(iter, m_vpTex3DList.begin())); Delete3DTexture(iter); return; } } WARNING("All bricks are (heavily) in use: " "cannot make space for a new brick."); } void GPUMemMan::DeleteVolumePool(GLVolumePool** pool) { delete *pool; *pool = NULL; } GLVolumePool* GPUMemMan::GetVolumePool(LinearIndexDataset* dataSet, GLenum filter, int /* iShareGroupID */) { const uint64_t iBitWidth = dataSet->GetBitWidth(); const uint64_t iCompCount = dataSet->GetComponentCount(); const UINTVECTOR3 vMaxBS = UINTVECTOR3(dataSet->GetMaxUsedBrickSizes()); // Compute the pool size as a (almost) cubed texture that fits // into the user specified GPU mem, is a multiple of the bricksize // and is no bigger than what OpenGL tells us is possible GLint iMaxVolumeDims; GL(glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE_EXT, &iMaxVolumeDims)); const uint64_t iMaxGPUMem = Controller::ConstInstance().SysInfo().GetMaxUsableGPUMem() - m_iAllocatedGPUMemory; // the max brick layout that fits into the available GPU memory const uint64_t iMaxVoxelCount = iMaxGPUMem/(iCompCount*iBitWidth/8); const uint64_t r3Voxels = uint64_t(pow(double(iMaxVoxelCount), 1.0/3.0)); UINTVECTOR3 maxBricksForGPU; // round the starting input size (r3Voxels) to the closest multiple brick size // to guarantee as cubic as possible volume pools and to better fill the // available amount of memory // (e.g. it creates a 1024x512x1536 pool instead of a 512x2048x512 pool for // a brick size of 512^3 and 3.4 GB available memory) uint64_t multipleOfBrickSizeThatFitsInX = uint64_t(((float)r3Voxels/vMaxBS.x) + 0.5f) *vMaxBS.x; if (multipleOfBrickSizeThatFitsInX > uint64_t(iMaxVolumeDims)) multipleOfBrickSizeThatFitsInX = (iMaxVolumeDims/vMaxBS.x)*vMaxBS.x; maxBricksForGPU.x = (uint32_t)multipleOfBrickSizeThatFitsInX; uint64_t multipleOfBrickSizeThatFitsInY = ((iMaxVoxelCount/(maxBricksForGPU.x*maxBricksForGPU.x))/vMaxBS.y)*vMaxBS.y; if (multipleOfBrickSizeThatFitsInY > uint64_t(iMaxVolumeDims)) multipleOfBrickSizeThatFitsInY = (iMaxVolumeDims/vMaxBS.y)*vMaxBS.y; maxBricksForGPU.y = (uint32_t)multipleOfBrickSizeThatFitsInY; uint64_t multipleOfBrickSizeThatFitsInZ = ((iMaxVoxelCount/(maxBricksForGPU.x*maxBricksForGPU.y))/vMaxBS.z)*vMaxBS.z; if (multipleOfBrickSizeThatFitsInZ > uint64_t(iMaxVolumeDims)) multipleOfBrickSizeThatFitsInZ = (iMaxVolumeDims/vMaxBS.z)*vMaxBS.z; maxBricksForGPU.z = (uint32_t)multipleOfBrickSizeThatFitsInZ; // the max brick layout required by the dataset const uint64_t iMaxBrickCount = dataSet->GetTotalBrickCount(); const uint64_t r3Bricks = uint64_t(pow(double(iMaxBrickCount), 1.0/3.0)); UINT64VECTOR3 maxBricksForDataset; multipleOfBrickSizeThatFitsInX = vMaxBS.x*r3Bricks; if (multipleOfBrickSizeThatFitsInX > uint64_t(iMaxVolumeDims)) multipleOfBrickSizeThatFitsInX = (iMaxVolumeDims/vMaxBS.x)*vMaxBS.x; maxBricksForDataset.x = (uint32_t)multipleOfBrickSizeThatFitsInX; multipleOfBrickSizeThatFitsInY = vMaxBS.y*uint64_t(ceil(float(iMaxBrickCount) / ((maxBricksForDataset.x/vMaxBS.x) * (maxBricksForDataset.x/vMaxBS.x)))); if (multipleOfBrickSizeThatFitsInY > uint64_t(iMaxVolumeDims)) multipleOfBrickSizeThatFitsInY = (iMaxVolumeDims/vMaxBS.y)*vMaxBS.y; maxBricksForDataset.y = (uint32_t)multipleOfBrickSizeThatFitsInY; multipleOfBrickSizeThatFitsInZ = vMaxBS.z*uint64_t(ceil(float(iMaxBrickCount) / ((maxBricksForDataset.x/vMaxBS.x) * (maxBricksForDataset.y/vMaxBS.y)))); if (multipleOfBrickSizeThatFitsInZ > uint64_t(iMaxVolumeDims)) multipleOfBrickSizeThatFitsInZ = (iMaxVolumeDims/vMaxBS.z)*vMaxBS.z; maxBricksForDataset.z = (uint32_t)multipleOfBrickSizeThatFitsInZ; // now use the smaller of the two layouts, normally that // would be the maxBricksForGPU but for small datasets that // can be rendered entirely in-core we may need less space const UINTVECTOR3 poolSize = (maxBricksForDataset.volume() < UINT64VECTOR3(maxBricksForGPU).volume()) ? UINTVECTOR3(maxBricksForDataset) : maxBricksForGPU; GLVolumePool* pPool = NULL; try { const unsigned md_up = Controller::Const().RState.MDUpdateBehavior; GLVolumePool::DebugMode mdupdate = static_cast(md_up); pPool = new GLVolumePool(poolSize, dataSet, filter, true, mdupdate); } catch (tuvok::Exception const& e) { pPool = NULL; T_ERROR(e.what()); } return pPool; } GLVolume* GPUMemMan::GetVolume(Dataset* pDataset, const BrickKey& key, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder, bool bEmulate3DWith2DStacks, uint64_t iIntraFrameCounter, uint64_t iFrameCounter, int iShareGroupID) { // It can occur that we can create the brick in CPU memory but OpenGL must // perform a texture copy to obtain the texture. If that happens, we'll // delete any brick and then try again. do { try { return this->AllocOrGetVolume(pDataset, key, bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder, bEmulate3DWith2DStacks, iIntraFrameCounter, iFrameCounter, iShareGroupID); } catch(OutOfMemory&) { // Texture allocation failed. // If texture allocation failed and we had no bricks loaded, then the // system must be extremely memory limited. Make a note and then bail. if(m_vpTex3DList.empty()) { T_ERROR("This system does not have enough memory to render a brick."); return NULL; } // Delete all bricks that aren't used. If that ends up being nothing, // then we're pretty screwed. Stupidly choose a brick in that case. if(0 == DeleteUnusedBricks(iShareGroupID)) { WARNING("No bricks unused. Falling back to " "deleting bricks that ARE in use!"); // Delete up to 4 bricks. We want to delete multiple bricks here // because we'll temporarily need copies of the bricks in memory. for(size_t i=0; i < 4 && !m_vpTex3DList.empty(); ++i) { DeleteArbitraryBrick(iShareGroupID); } } } } while(!m_vpTex3DList.empty()); // Can't happen, but to quiet compilers: return NULL; } GLVolume* GPUMemMan::AllocOrGetVolume(Dataset* pDataset, const BrickKey& key, bool bUseOnlyPowerOfTwo, bool bDownSampleTo8Bits, bool bDisableBorder, bool bEmulate3DWith2DStacks, uint64_t iIntraFrameCounter, uint64_t iFrameCounter, int iShareGroupID) { for (GLVolumeListIter i = m_vpTex3DList.begin(); i < m_vpTex3DList.end(); i++) { if ((*i)->Equals(pDataset, key, bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder, bEmulate3DWith2DStacks, iShareGroupID)) { GL_CHECK(); MESSAGE("Reusing 3D texture"); return (*i)->Access(iIntraFrameCounter, iFrameCounter); } } uint64_t iNeededCPUMemory = required_cpu_memory(*pDataset, key); /// @todo FIXME these keys are all wrong; we shouldn't be using N-dimensional /// data structures for the keys here. const UINTVECTOR3 sz = pDataset->GetBrickVoxelCounts(key); const uint64_t iBitWidth = pDataset->GetBitWidth(); const uint64_t iCompCount = pDataset->GetComponentCount(); // for OpenGL we ignore the GPU memory load and let GL do the paging if (m_iAllocatedCPUMemory + iNeededCPUMemory > m_SystemInfo.GetMaxUsableCPUMem()) { MESSAGE("Not enough memory for texture %u x %u x %u (%llubit * %llu), " "paging ...", sz[0], sz[1], sz[2], iBitWidth, iCompCount); // search for best brick to replace with this brick UINTVECTOR3 vSize = pDataset->GetBrickVoxelCounts(key); GLVolumeListIter iBestMatch = find_closest_texture(m_vpTex3DList, vSize, bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder, bEmulate3DWith2DStacks, iShareGroupID); if (iBestMatch != m_vpTex3DList.end()) { // found a suitable brick that can be replaced (*iBestMatch)->Replace(pDataset, key, bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder, bEmulate3DWith2DStacks, iIntraFrameCounter, iFrameCounter, m_vUploadHub, iShareGroupID); (*iBestMatch)->iUserCount++; return (*iBestMatch)->volume; } else { // We know the brick doesn't fit in memory, and we know there's no // existing texture which matches enough that we could overwrite it with // this one. There's little we can do at this point ... WARNING(" No suitable brick found. Randomly deleting bricks until this" " brick fits into memory"); while (m_iAllocatedCPUMemory + iNeededCPUMemory > m_SystemInfo.GetMaxUsableCPUMem()) { if (m_vpTex3DList.empty()) { // we do not have enough memory to page in even a single block... T_ERROR("Not enough memory to page a single brick into memory, " "aborting (MaxMem=%llukb, NeededMem=%llukb).", m_SystemInfo.GetMaxUsableCPUMem()/1024, iNeededCPUMemory/1024); return NULL; } DeleteArbitraryBrick(iShareGroupID); } } } { std::ostringstream newvol; newvol << "Creating new GL volume " << sz[0] << " x " << sz[1] << " x " << sz[2] << ", bitsize=" << iBitWidth << ", componentcount=" << iCompCount; MESSAGE("%s", newvol.str().c_str()); } GLVolumeListElem* pNew3DTex = new GLVolumeListElem(pDataset, key, bUseOnlyPowerOfTwo, bDownSampleTo8Bits, bDisableBorder, bEmulate3DWith2DStacks, iIntraFrameCounter, iFrameCounter, m_MasterController, m_vUploadHub, iShareGroupID); if (pNew3DTex->volume == NULL) { T_ERROR("Failed to create OpenGL resource for volume."); delete pNew3DTex; return NULL; } MESSAGE("texture(s) created."); pNew3DTex->iUserCount = 1; m_iAllocatedGPUMemory += pNew3DTex->GetGPUSize(); m_iAllocatedCPUMemory += pNew3DTex->GetCPUSize(); m_vpTex3DList.push_back(pNew3DTex); return (*(m_vpTex3DList.end()-1))->volume; } void GPUMemMan::Release3DTexture(GLVolume* pGLVolume) { for (size_t i = 0;ivolume == pGLVolume) { if (m_vpTex3DList[i]->iUserCount > 0) { m_vpTex3DList[i]->iUserCount--; MESSAGE("Decreased 3D texture use count to %u", m_vpTex3DList[i]->iUserCount); } else { WARNING("Attempting to release a 3D volume that is not in use."); } } } } void GPUMemMan::Delete3DTexture(const GLVolumeListIter& tex) { m_iAllocatedGPUMemory -= (*tex)->GetGPUSize(); m_iAllocatedCPUMemory -= (*tex)->GetCPUSize(); if((*tex)->iUserCount != 0) { WARNING("Freeing used GL volume!"); } MESSAGE("Deleting GL texture with use count %u", static_cast((*tex)->iUserCount)); delete *tex; m_vpTex3DList.erase(tex); } void GPUMemMan::Delete3DTexture(size_t iIndex) { this->Delete3DTexture(m_vpTex3DList.begin() + iIndex); } // Functor to identify a texture that belongs to a particular dataset. struct DatasetTexture: std::binary_function { bool operator()(const GLVolumeListElem* tex, std::pair dsinfo) const { return tex->pDataset == dsinfo.first && tex->GetShareGroupID() == dsinfo.second; } }; void GPUMemMan::FreeAssociatedTextures(Dataset* pDataset, int iShareGroupID) { // Don't use singleton; see destructor comments. AbstrDebugOut& dbg = *(m_MasterController->DebugOut()); try { const FileBackedDataset& fbd = dynamic_cast(*pDataset); dbg.Message(_func_, "Deleting textures associated with '%s' dataset.", fbd.Filename().c_str()); } catch(const std::bad_cast&) {} while(1) { // exit condition is checked for and `break'd in the loop. const GLVolumeListIter& iter = std::find_if(m_vpTex3DList.begin(), m_vpTex3DList.end(), std::bind(DatasetTexture(), _1, make_pair(pDataset,iShareGroupID)) ); if(iter == m_vpTex3DList.end()) { break; } Delete3DTexture(iter); } } void GPUMemMan::MemSizesChanged() { if (m_iAllocatedCPUMemory > m_SystemInfo.GetMaxUsableCPUMem()) { /// \todo CPU free resources to match max mem requirements } if (m_iAllocatedGPUMemory > m_SystemInfo.GetMaxUsableGPUMem()) { /// \todo GPU free resources to match max mem requirements } } GLFBOTex* GPUMemMan::GetFBO(GLenum minfilter, GLenum magfilter, GLenum wrapmode, GLsizei width, GLsizei height, GLenum intformat, GLenum format, GLenum type, int iShareGroupID, bool bHaveDepth, int iNumBuffers) { MESSAGE("Creating new FBO of size %i x %i", int(width), int(height)); uint64_t m_iCPUMemEstimate = GLFBOTex::EstimateCPUSize(width, height, GLCommon::gl_byte_width(type) * GLCommon::gl_components(format), bHaveDepth, iNumBuffers); // if we are running out of mem, kick out bricks to create room for the FBO while (m_iAllocatedCPUMemory + m_iCPUMemEstimate > m_SystemInfo.GetMaxUsableCPUMem() && !m_vpTex3DList.empty()) { MESSAGE("Not enough memory for FBO %i x %i x %i, " "paging out bricks ...", int(width), int(height), iNumBuffers); // search for best brick to replace with this brick uint64_t iMinTargetFrameCounter; uint64_t iMaxTargetIntraFrameCounter; (*m_vpTex3DList.begin())->GetCounters(iMaxTargetIntraFrameCounter, iMinTargetFrameCounter); size_t iIndex = 0; size_t iBestIndex = 0; for (GLVolumeListIter i = m_vpTex3DList.begin()+1; i < m_vpTex3DList.end(); ++i) { uint64_t iTargetFrameCounter = UINT64_INVALID; uint64_t iTargetIntraFrameCounter = UINT64_INVALID; (*i)->GetCounters(iTargetIntraFrameCounter, iTargetFrameCounter); iIndex++; if (iTargetFrameCounter < iMinTargetFrameCounter) { iMinTargetFrameCounter = iTargetFrameCounter; iMaxTargetIntraFrameCounter = iTargetIntraFrameCounter; iBestIndex = iIndex; } else { if (iTargetFrameCounter == iMinTargetFrameCounter && iTargetIntraFrameCounter > iMaxTargetIntraFrameCounter) { iMaxTargetIntraFrameCounter = iTargetIntraFrameCounter; iBestIndex = iIndex; } } } MESSAGE(" Deleting texture %u", static_cast(iBestIndex)); Delete3DTexture(iBestIndex); } FBOListElem* e = new FBOListElem(m_MasterController, minfilter, magfilter, wrapmode, width, height, intformat, format, type, bHaveDepth, iNumBuffers, iShareGroupID); if(!e->pFBOTex->Valid()) { T_ERROR("FBO creation failed!"); return NULL; } // clear the buffer, on some GPUs new FBOs are not zeroed out e->pFBOTex->Write(); glClearColor(0,0,0,0); glClear(GL_COLOR_BUFFER_BIT); e->pFBOTex->FinishWrite(); m_vpFBOList.push_back(e); m_iAllocatedGPUMemory += e->pFBOTex->GetGPUSize(); m_iAllocatedCPUMemory += e->pFBOTex->GetCPUSize(); return e->pFBOTex; } void GPUMemMan::FreeFBO(GLFBOTex* pFBO) { for (size_t i = 0;ipFBOTex == pFBO) { MESSAGE("Freeing FBO "); m_iAllocatedGPUMemory -= m_vpFBOList[i]->pFBOTex->GetGPUSize(); m_iAllocatedCPUMemory -= m_vpFBOList[i]->pFBOTex->GetCPUSize(); delete m_vpFBOList[i]; m_vpFBOList.erase(m_vpFBOList.begin()+i); return; } } WARNING("FBO to free not found."); } struct deref_glsl : public std::binary_function { bool operator ()(const GLSLListElem* a, const GLSLListElem* b) const { return *a == *b; } }; GLSLProgram* GPUMemMan::GetGLSLProgram(const ShaderDescriptor& sdesc, int iShareGroupID) { GLSLListElem elem(m_MasterController, sdesc, iShareGroupID, false); using namespace std::placeholders; GLSLListIter i = std::find_if(m_vpGLSLList.begin(), m_vpGLSLList.end(), std::bind(deref_glsl(), _1, &elem)); if(i != m_vpGLSLList.end()) { MESSAGE("Reusing GLSL program."); (*i)->iAccessCounter++; return (*i)->pGLSLProgram; } MESSAGE("Creating new GLSL program from %u-element VS and %u-element FS", std::distance(sdesc.begin_vertex(), sdesc.end_vertex()), std::distance(sdesc.begin_fragment(), sdesc.end_fragment())); GLSLListElem* e = new GLSLListElem(m_MasterController, sdesc, iShareGroupID); if(e->pGLSLProgram == NULL) { T_ERROR("Failed to create program!"); return NULL; } m_vpGLSLList.push_back(e); m_iAllocatedGPUMemory += e->pGLSLProgram->GetGPUSize(); m_iAllocatedCPUMemory += e->pGLSLProgram->GetCPUSize(); return e->pGLSLProgram; } void GPUMemMan::FreeGLSLProgram(GLSLProgram* pGLSLProgram) { if (pGLSLProgram == NULL) return; for (size_t i = 0;ipGLSLProgram == pGLSLProgram) { m_vpGLSLList[i]->iAccessCounter--; if (m_vpGLSLList[i]->iAccessCounter == 0) { MESSAGE("Freeing GLSL program %u", static_cast(GLuint(*pGLSLProgram))); m_iAllocatedGPUMemory -= m_vpGLSLList[i]->pGLSLProgram->GetGPUSize(); m_iAllocatedCPUMemory -= m_vpGLSLList[i]->pGLSLProgram->GetCPUSize(); delete m_vpGLSLList[i]; m_vpGLSLList.erase(m_vpGLSLList.begin()+i); } else { MESSAGE("Decreased access counter but kept GLSL program in memory."); } return; } } WARNING("GLSL program to free not found."); } uint64_t GPUMemMan::GetCPUMem() const {return m_SystemInfo.GetCPUMemSize();} uint64_t GPUMemMan::GetGPUMem() const {return m_SystemInfo.GetGPUMemSize();} uint32_t GPUMemMan::GetBitWidthMem() const { return m_SystemInfo.GetProgramBitWidth(); } uint32_t GPUMemMan::GetNumCPUs() const {return m_SystemInfo.GetNumberOfCPUs();} void GPUMemMan::RegisterLuaCommands() { std::string id; const std::string nm = "tuvok.gpu."; // namespace id = m_pMemReg->registerFunction(this,&GPUMemMan::Changed1DTrans, nm + "changed1DTrans", "", false); id = m_pMemReg->registerFunction(this,&GPUMemMan::Changed2DTrans, nm + "changed2DTrans", "", false); } ImageVis3D-3.1.0/Tuvok/Renderer/SBVRGeogen3D.h0000644000175000017500000001116012320456500020373 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file SBVRGeogen3D.h \author Jens Krueger SCI Institute University of Utah \date September 2008 */ #pragma once #ifndef SBVRGEOGEN3D_H #define SBVRGEOGEN3D_H #include "SBVRGeogen.h" namespace tuvok { /** \class SBVRGeogen3D \brief View aligned geometry generation for 3D texture based the slice-based volume renderer. */ class SBVRGeogen3D : public SBVRGeogen { public: /** \brief The Standard and also the only constructor SBVRGeogen takes no parameters in the constructor as the information required to compute the geometry mode is supplied later via accessor calls in the parent class */ SBVRGeogen3D(void); virtual ~SBVRGeogen3D(void); /** \brief This call invokes the actual geometry generation of the view aligned slices */ virtual void ComputeGeometry(bool bMeshOnly); //! this is where ComputeGeometry() outputs the geometry to std::vector m_vSliceTriangles; protected: //! depth of the slice closest to the viewer float m_fMaxZ; //! depth of the slice furthest away from the viewer float m_fMinZ; /** \brief Calls InitBBOX from the parent class which computes the transformed vertices m_pfBBOXVertex from m_pfBBOXStaticVertex and in addition to this updates m_fMaxZ */ virtual void InitBBOX(); /** \brief Computes a single view aligned slice at depth fDepth the slice is appended to m_vSliceTriangles \param fDepth the depth of the slice \result if geometry for this slice was generated, no gemeotry may be generated if fDepth puts the slice in front of the bounding box or behind the bounding box or if the geoemtry degenerates into less then a triangle (a line or a point) */ bool ComputeLayerGeometry(float fDepth); /** \brief Triangulates a planar polygon specified by the vertices in fArray, the result is appended to m_vSliceTriangles \param fArray the vertices of the polygon */ void Triangulate(std::vector &fArray); //! returns the distance between two slices float GetLayerDistance() const; /** \brief Computes the intersection of a plane perpendicular to the viewing direction with a line (typically one of the edges of the the bounding box of the volume) \param z distance of the plane to the viewer \param plA starting point of the line \param plB end point of the line \param vHits intersection point of the line and the plane \result true if the plane intersects the line */ static bool DepthPlaneIntersection(float z, const VERTEX_FORMAT &plA, const VERTEX_FORMAT &plB, std::vector& vHits, bool bClip); /** \brief inplace sorts a number lines by their gradient, the n-1 lines defined by an array of n vertices, whereas the m-th line is a connection of the (m-1)-th vertex to the first \param fArray the vertices defining the lines */ static void SortByGradient(std::vector& fArray); SortIndexPVec::const_iterator m_MeshTransferIter; void DepthSortMeshWithVolume(); void InsertMeshUpToSlice(float fDepth); }; }; #endif // SBVRGEOGEN3D_H ImageVis3D-3.1.0/Tuvok/Renderer/SBVRGeogen.cpp0000644000175000017500000003104712320456500020545 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file SBVRGeogen.cpp \author Jens Krueger SCI Institute University of Utah \date September 2008 */ #include "StdTuvokDefines.h" #include #include #include #include #include #include "SBVRGeogen.h" using namespace tuvok; SBVRGeogen::SBVRGeogen(void) : m_fSamplingModifier(1.0f), m_vGlobalSize(1,1,1), m_vGlobalAspect(1,1,1), m_vLODSize(1,1,1), m_vAspect(1,1,1), m_vSize(1,1,1), m_vTexCoordMin(0,0,0), m_vTexCoordMax(1,1,1), m_bClipPlaneEnabled(false), m_bClipVolume(true), m_bClipMesh(false) { m_pfBBOXStaticVertex[0] = FLOATVECTOR3(-0.5, 0.5,-0.5); // top,left,back m_pfBBOXStaticVertex[1] = FLOATVECTOR3( 0.5, 0.5,-0.5); // top,right,back m_pfBBOXStaticVertex[2] = FLOATVECTOR3( 0.5, 0.5, 0.5); // top,right,front m_pfBBOXStaticVertex[3] = FLOATVECTOR3(-0.5, 0.5, 0.5); // top,left,front m_pfBBOXStaticVertex[4] = FLOATVECTOR3(-0.5,-0.5,-0.5); // bottom,left,back m_pfBBOXStaticVertex[5] = FLOATVECTOR3( 0.5,-0.5,-0.5); // bottom,right,back m_pfBBOXStaticVertex[6] = FLOATVECTOR3( 0.5,-0.5, 0.5); // bottom,right,front m_pfBBOXStaticVertex[7] = FLOATVECTOR3(-0.5,-0.5, 0.5); // bottom,left,front m_pfBBOXVertex[0] = FLOATVECTOR3(0,0,0); m_pfBBOXVertex[1] = FLOATVECTOR3(0,0,0); m_pfBBOXVertex[2] = FLOATVECTOR3(0,0,0); m_pfBBOXVertex[3] = FLOATVECTOR3(0,0,0); m_pfBBOXVertex[4] = FLOATVECTOR3(0,0,0); m_pfBBOXVertex[5] = FLOATVECTOR3(0,0,0); m_pfBBOXVertex[6] = FLOATVECTOR3(0,0,0); m_pfBBOXVertex[7] = FLOATVECTOR3(0,0,0); } SBVRGeogen::~SBVRGeogen(void) { } float SBVRGeogen::GetOpacityCorrection() const { return 1.0f/m_fSamplingModifier * (FLOATVECTOR3(m_vGlobalSize)/FLOATVECTOR3(m_vLODSize)).maxVal(); // GetLayerDistance()*m_vSize.maxVal(); } void SBVRGeogen::MatricesUpdated() { FLOATMATRIX4 maBricktTrans; maBricktTrans.Translation(m_brickTranslation.x, m_brickTranslation.y, m_brickTranslation.z); m_matWorldView = maBricktTrans * m_matWorld * m_matView; } void SBVRGeogen::SetBrickTrans(const FLOATVECTOR3& brickTranslation) { if (m_brickTranslation != brickTranslation) { m_brickTranslation = brickTranslation; MatricesUpdated(); } } void SBVRGeogen::SetWorld(const FLOATMATRIX4& matWorld) { if (m_matWorld != matWorld) { m_matWorld = matWorld; MatricesUpdated(); } } void SBVRGeogen::SetView(const FLOATMATRIX4& mTransform) { if(m_matView != mTransform) { m_matView = mTransform; MatricesUpdated(); } } void SBVRGeogen::InitBBOX() { m_pfBBOXVertex[0] = VERTEX_FORMAT(FLOATVECTOR4(m_pfBBOXStaticVertex[0]*m_vAspect,1.0f) * m_matWorldView, FLOATVECTOR3(m_vTexCoordMin.x,m_vTexCoordMax.y,m_vTexCoordMin.z)); m_pfBBOXVertex[1] = VERTEX_FORMAT(FLOATVECTOR4(m_pfBBOXStaticVertex[1]*m_vAspect,1.0f) * m_matWorldView, FLOATVECTOR3(m_vTexCoordMax.x,m_vTexCoordMax.y,m_vTexCoordMin.z)); m_pfBBOXVertex[2] = VERTEX_FORMAT(FLOATVECTOR4(m_pfBBOXStaticVertex[2]*m_vAspect,1.0f) * m_matWorldView, FLOATVECTOR3(m_vTexCoordMax.x,m_vTexCoordMax.y,m_vTexCoordMax.z)); m_pfBBOXVertex[3] = VERTEX_FORMAT(FLOATVECTOR4(m_pfBBOXStaticVertex[3]*m_vAspect,1.0f) * m_matWorldView, FLOATVECTOR3(m_vTexCoordMin.x,m_vTexCoordMax.y,m_vTexCoordMax.z)); m_pfBBOXVertex[4] = VERTEX_FORMAT(FLOATVECTOR4(m_pfBBOXStaticVertex[4]*m_vAspect,1.0f) * m_matWorldView, FLOATVECTOR3(m_vTexCoordMin.x,m_vTexCoordMin.y,m_vTexCoordMin.z)); m_pfBBOXVertex[5] = VERTEX_FORMAT(FLOATVECTOR4(m_pfBBOXStaticVertex[5]*m_vAspect,1.0f) * m_matWorldView, FLOATVECTOR3(m_vTexCoordMax.x,m_vTexCoordMin.y,m_vTexCoordMin.z)); m_pfBBOXVertex[6] = VERTEX_FORMAT(FLOATVECTOR4(m_pfBBOXStaticVertex[6]*m_vAspect,1.0f) * m_matWorldView, FLOATVECTOR3(m_vTexCoordMax.x,m_vTexCoordMin.y,m_vTexCoordMax.z)); m_pfBBOXVertex[7] = VERTEX_FORMAT(FLOATVECTOR4(m_pfBBOXStaticVertex[7]*m_vAspect,1.0f) * m_matWorldView, FLOATVECTOR3(m_vTexCoordMin.x,m_vTexCoordMin.y,m_vTexCoordMax.z)); } void SBVRGeogen::SetVolumeData(const FLOATVECTOR3& vAspect, const UINTVECTOR3& vSize) { m_vGlobalAspect = vAspect; m_vGlobalSize = vSize; } void SBVRGeogen::SetLODData(const UINTVECTOR3& vSize) { m_vLODSize = vSize; } void SBVRGeogen::SetBrickData(const FLOATVECTOR3& vAspect, const UINTVECTOR3& vSize, const FLOATVECTOR3& vTexCoordMin, const FLOATVECTOR3& vTexCoordMax) { m_vAspect = vAspect; m_vSize = vSize; m_vTexCoordMin = vTexCoordMin; m_vTexCoordMax = vTexCoordMax; InitBBOX(); } // Splits a triangle along a plane with the given normal. // Assumes: plane's D == 0. // triangle does span the plane. std::vector SBVRGeogen::SplitTriangle(VERTEX_FORMAT a, VERTEX_FORMAT b, VERTEX_FORMAT c, const VECTOR3 &normal, const float D) { std::vector out; // We'll always throw away at least one of the generated triangles. out.reserve(2); float fa = (normal ^ a.m_vPos) + D; float fb = (normal ^ b.m_vPos) + D; float fc = (normal ^ c.m_vPos) + D; if(fabs(fa) < (2 * std::numeric_limits::epsilon())) { fa = 0; } if(fabs(fb) < (2 * std::numeric_limits::epsilon())) { fb = 0; } if(fabs(fc) < (2 * std::numeric_limits::epsilon())) { fc = 0; } // rotation / mirroring. // c // o Push `c' to be alone on one side of the plane, making // / \ `a' and `b' on the other. Later we'll be able to // plane --------- assume that there will be an intersection with the // / \ clip plane along the lines `ac' and `bc'. This // o-------o reduces the number of cases below. // a b // if fa*fc is non-negative, both have the same sign -- and thus are on the // same side of the plane. if(fa*fc >= 0) { std::swap(fb, fc); std::swap(b, c); std::swap(fa, fb); std::swap(a, b); } else if(fb*fc >= 0) { std::swap(fa, fc); std::swap(a, c); std::swap(fa, fb); std::swap(a, b); } // Find the intersection points. VERTEX_FORMAT A, B; RayPlaneIntersection(a,c, normal,D, A); RayPlaneIntersection(b,c, normal,D, B); if(fc >= 0) { out.push_back(a); out.push_back(b); out.push_back(A); out.push_back(b); out.push_back(B); out.push_back(A); } else { out.push_back(A); out.push_back(B); out.push_back(c); } return out; } std::vector SBVRGeogen::ClipTriangles(const std::vector &in, const VECTOR3 &normal, const float D) { std::vector out; if (in.empty()) return out; assert(in.size() % 3 == 0); // bail out even in release (otherwise we would get a crash later) if (in.size() % 3 != 0) return out; out.reserve(in.size()); for(std::vector::const_iterator iter = in.begin(); iter < (in.end()-2); iter += 3) { const VERTEX_FORMAT &a = (*iter); const VERTEX_FORMAT &b = (*(iter+1)); const VERTEX_FORMAT &c = (*(iter+2)); // assume that either all or none of the tri vertices are to be clipped if (!a.m_bClip) { out.push_back(a); out.push_back(b); out.push_back(c); continue; } float fa = (normal ^ a.m_vPos) + D; float fb = (normal ^ b.m_vPos) + D; float fc = (normal ^ c.m_vPos) + D; if(fabs(fa) < (2 * std::numeric_limits::epsilon())) { fa = 0; } if(fabs(fb) < (2 * std::numeric_limits::epsilon())) { fb = 0; } if(fabs(fc) < (2 * std::numeric_limits::epsilon())) { fc = 0; } if(fa >= 0 && fb >= 0 && fc >= 0) { // trivial reject // discard -- i.e. do nothing / ignore tri. } else if(fa <= 0 && fb <= 0 && fc <= 0) { // trivial accept out.push_back(a); out.push_back(b); out.push_back(c); } else { // triangle spans plane -- must be split. const std::vector& tris = SplitTriangle(a,b,c, normal,D); assert(!tris.empty()); assert(tris.size() <= 6); // vector is actually of points, not tris. for(std::vector::const_iterator tri = tris.begin(); tri != tris.end(); ++tri) { out.push_back(*tri); } } } return out; } // Calculates the intersection point of a line segment lb->la which crosses the // plane with normal 'n'. bool SBVRGeogen::RayPlaneIntersection(const VERTEX_FORMAT &la, const VERTEX_FORMAT &lb, const FLOATVECTOR3 &n, const float D, VERTEX_FORMAT &hit) { const FLOATVECTOR3 &va = la.m_vPos; const FLOATVECTOR3 &vb = lb.m_vPos; const float denom = n ^ (va - vb); if(EpsilonEqual(denom, 0.0f)) { return false; } const float t = ((n ^ va) + D) / denom; hit.m_vPos = va + (t*(vb - va)); hit.m_vVertexData = la.m_vVertexData + t*(lb.m_vVertexData - la.m_vVertexData); return true; } bool SBVRGeogen::isInsideAABB(const FLOATVECTOR3& min, const FLOATVECTOR3& max, const FLOATVECTOR3& point) { return point.x >= min.x && point.x <= max.x && point.y >= min.y && point.y <= max.y && point.z >= min.z && point.z <= max.z; } void SBVRGeogen::AddMesh(const SortIndexPVec& mesh) { if (mesh.empty()) return; // TODO: currently only triangles are supported if (mesh[0]->m_mesh->GetVerticesPerPoly() != 3) return; FLOATVECTOR3 min = ( m_vAspect * -0.5f) + m_brickTranslation; FLOATVECTOR3 max = ( m_vAspect * 0.5f) + m_brickTranslation; for (SortIndexPVec::const_iterator index = mesh.begin(); index != mesh.end(); index++) { FLOATVECTOR3 c = (*index)->m_centroid; if (isInsideAABB(min, max, c)) m_mesh.push_back(*index); } } void SBVRGeogen::MeshEntryToVertexFormat(std::vector& list, const RenderMesh* mesh, size_t startIndex, bool bClipMesh) { bool bHasNormal = mesh->GetNormalIndices().size() == mesh->GetVertexIndices().size(); VERTEX_FORMAT f; // currently we only support triangles, hence the 3 for (size_t i = 0;i<3;i++) { size_t vertexIndex = mesh->GetVertexIndices()[startIndex+i]; f.m_vPos = mesh->GetVertices()[vertexIndex]; if (mesh->UseDefaultColor()) { f.m_vVertexData = mesh->GetDefaultColor().xyz(); f.m_fOpacity = mesh->GetDefaultColor().w; } else { f.m_vVertexData = mesh->GetColors()[vertexIndex].xyz(); f.m_fOpacity = mesh->GetColors()[vertexIndex].w; } if (bHasNormal) f.m_vNormal = mesh->GetNormals()[vertexIndex]; else f.m_vNormal = FLOATVECTOR3(2,2,2); f.m_bClip = bClipMesh; list.push_back(f); } } void SBVRGeogen::SortMeshWithoutVolume(std::vector& list) { if (!m_mesh.empty()) { std::sort(m_mesh.begin(), m_mesh.end(), DistanceSortUnder); for (SortIndexPVec::const_iterator index = m_mesh.begin(); index != m_mesh.end(); index++) { MeshEntryToVertexFormat(list, (*index)->m_mesh, (*index)->m_index, m_bClipMesh); } } } ImageVis3D-3.1.0/Tuvok/Renderer/CullingLOD.h0000644000175000017500000000564412320456500020251 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file CullingLOD.h \brief Simple routines for filename handling \author Jens Krueger SCI Institute University of Utah \version 1.4 \date July 2008 */ #pragma once #ifndef CULLINGLOD_H #define CULLINGLOD_H #include "../Basics/Vectors.h" #include "../StdTuvokDefines.h" namespace tuvok { class CullingLOD { public: CullingLOD(float fScreenSpaceError=1.0f); void SetScreenParams(float fFOVY, float fAspect, float fNearPlane, float fFarPlane, uint32_t iPixelCountY); void SetProjectionMatrix(const FLOATMATRIX4& mProjectionMatrix); void SetModelMatrix(const FLOATMATRIX4& mModelMatrix); void SetViewMatrix(const FLOATMATRIX4& mViewMatrix); void Update(); void SetPassAll(bool bPassAll) {m_bPassAll = bPassAll;} int GetLODLevel(const FLOATVECTOR3& vfCenter, const FLOATVECTOR3& vfExtent, const UINTVECTOR3& viVoxelCount) const; bool IsVisible(const FLOATVECTOR3& vCenter, const FLOATVECTOR3& vfExtent) const; FLOATVECTOR2 GetDepthScaleParams() const; float GetNearPlane() const {return m_fNearPlane;} float GetFarPlane() const {return m_fFarPlane;} float GetLoDFactor() const {return m_fLODFactor;} private: FLOATMATRIX4 m_mModelViewProjectionMatrix; FLOATMATRIX4 m_mModelViewMatrix; FLOATMATRIX4 m_mProjectionMatrix; FLOATMATRIX4 m_mViewMatrix; FLOATMATRIX4 m_mModelMatrix; FLOATVECTOR4 m_Planes[6]; float m_fFOVY; float m_fAspect; float m_fNearPlane; float m_fFarPlane; uint32_t m_iPixelCountY; float m_fScreenSpaceError; float m_fLODFactor; bool m_bPassAll; }; } #endif // CULLINGLOD_H ImageVis3D-3.1.0/Tuvok/tvk.pro0000644000175000017500000006315112320456500015721 0ustar mathieumathieuTEMPLATE = lib win32:TEMPLATE = vclib CONFIG += warn_on qt rtti static staticlib stl largefile CONFIG += exceptions macx:DEFINES += QT_MAC_USE_COCOA=1 LUA_USE_MACOSX=1 unix:DEFINES += LZHAM_ANSI_CPLUSPLUS=1 DEFINES += _FILE_OFFSET_BITS=64 TARGET = Build/Tuvok win32 { DESTDIR = Build TARGET = Tuvok } RCC_DIR = Build/rcc OBJECTS_DIR = Build/objects DEPENDPATH += . Basics Controller DebugOut IO Renderer INCLUDEPATH += . 3rdParty/GLEW IO/3rdParty/boost IO/3rdParty/zlib IO/3rdParty/lzma IO/3rdParty/lz4 IO/3rdParty/lzham INCLUDEPATH += Basics IO/exception QT += opengl QMAKE_LIBDIR += IO/expressions LIBS = -ltuvokexpr unix:LIBS += -lz -lpthread win32:LIBS += shlwapi.lib unix:QMAKE_CXXFLAGS += -std=c++0x unix:QMAKE_CXXFLAGS += -fno-strict-aliasing unix:QMAKE_CFLAGS += -fno-strict-aliasing !macx:unix:QMAKE_CXXFLAGS += -fopenmp !macx:unix:QMAKE_LFLAGS += -fopenmp -bullshit-link-flag !macx:unix:LIBS += -lGLU macx:QMAKE_CXXFLAGS += -stdlib=libc++ -mmacosx-version-min=10.7 macx:QMAKE_CFLAGS += -mmacosx-version-min=10.7 macx:LIBS += -stdlib=libc++ -framework CoreFoundation -mmacosx-version-min=10.7 # Try to link to GLU statically. gludirs = /usr/lib /usr/lib/x86_64-linux-gnu for(d, gludirs) { if(exists($${d}/libGLU.a) && static) { LIBS -= -lGLU; LIBS += $${d}/libGLU.a } } # Find the location of QtGui's prl file, and include it here so we can look at # the QMAKE_PRL_CONFIG variable. TEMP = $$[QT_INSTALL_LIBS] libQtGui.prl PRL = $$[QT_INSTALL_LIBS] QtGui.framework/QtGui.prl TEMP = $$join(TEMP, "/") PRL = $$join(PRL, "/") exists($$TEMP) { include($$TEMP) } exists($$PRL) { include($$PRL) } ### Should we link Qt statically or as a shared lib? # If the PRL config contains the `shared' configuration, then the installed # Qt is shared. In that case, disable the image plugins. contains(QMAKE_PRL_CONFIG, shared) { QTPLUGIN -= qgif qjpeg qtiff } else { QTPLUGIN += qgif qjpeg qtiff } # Input HEADERS += \ 3rdParty/GLEW/GL/glew.h \ 3rdParty/GLEW/GL/glxew.h \ 3rdParty/GLEW/GL/wglew.h \ 3rdParty/LUA/lapi.h \ 3rdParty/LUA/lauxlib.h \ 3rdParty/LUA/lcode.h \ 3rdParty/LUA/lctype.h \ 3rdParty/LUA/ldebug.h \ 3rdParty/LUA/ldo.h \ 3rdParty/LUA/lfunc.h \ 3rdParty/LUA/lgc.h \ 3rdParty/LUA/llimits.h \ 3rdParty/LUA/lmem.h \ 3rdParty/LUA/lobject.h \ 3rdParty/LUA/lopcodes.h \ 3rdParty/LUA/lparser.h \ 3rdParty/LUA/lstate.h \ 3rdParty/LUA/lstring.h \ 3rdParty/LUA/ltable.h \ 3rdParty/LUA/ltm.h \ 3rdParty/LUA/luaconf.h \ 3rdParty/LUA/lua.h \ 3rdParty/LUA/lua.hpp \ 3rdParty/LUA/lualib.h \ 3rdParty/LUA/lundump.h \ 3rdParty/LUA/lvm.h \ 3rdParty/LUA/lzio.h \ Basics/Appendix.h \ Basics/ArcBall.h \ Basics/AvgMinMaxTracker.h \ Basics/Checksums/crc32.h \ Basics/Checksums/MD5.h \ Basics/Clipper.h \ Basics/EndianFile.h \ Basics/GeometryGenerator.h \ Basics/Grids.h \ Basics/KDTree.h \ Basics/LargeFileC.h \ Basics/LargeFile.h \ Basics/LargeRAWFile.h \ Basics/MathTools.h \ Basics/MC.h \ Basics/Mesh.h \ Basics/nonstd.h \ Basics/PerfCounter.h \ Basics/Plane.h \ Basics/ProgressTimer.h \ Basics/SysTools.h \ Basics/Threads.h \ Basics/Timer.h \ Basics/TuvokException.h \ Basics/Vectors.h \ Controller/Controller.h \ Controller/MasterController.h \ DebugOut/AbstrDebugOut.h \ DebugOut/ConsoleOut.h \ DebugOut/MultiplexOut.h \ DebugOut/TextfileOut.h \ IO/3rdParty/bzip2/bzlib_private.h \ IO/3rdParty/jpeglib/cderror.h \ IO/3rdParty/jpeglib/cdjpeg.h \ IO/3rdParty/jpeglib/jchuff.h \ IO/3rdParty/jpeglib/jconfig.h \ IO/3rdParty/jpeglib/jdct.h \ IO/3rdParty/jpeglib/jdhuff.h \ IO/3rdParty/jpeglib/jerror.h \ IO/3rdParty/jpeglib/jinclude.h \ IO/3rdParty/jpeglib/jlossls.h \ IO/3rdParty/jpeglib/jlossy.h \ IO/3rdParty/jpeglib/jmemsys.h \ IO/3rdParty/jpeglib/jmorecfg.h \ IO/3rdParty/jpeglib/jpegint.h \ IO/3rdParty/jpeglib/jpeglib.h \ IO/3rdParty/jpeglib/jversion.h \ IO/3rdParty/jpeglib/mangle_jpeg.h \ IO/3rdParty/jpeglib/transupp.h \ IO/3rdParty/lz4/lz4.h \ IO/3rdParty/lz4/lz4hc.h \ IO/3rdParty/lzham/lzham_assert.h \ IO/3rdParty/lzham/lzham_checksum.h \ IO/3rdParty/lzham/lzham_comp.h \ IO/3rdParty/lzham/lzham_config.h \ IO/3rdParty/lzham/lzham_core.h \ IO/3rdParty/lzham/lzham_decomp.h \ IO/3rdParty/lzham/lzham.h \ IO/3rdParty/lzham/lzham_helpers.h \ IO/3rdParty/lzham/lzham_huffman_codes.h \ IO/3rdParty/lzham/lzham_lzbase.h \ IO/3rdParty/lzham/lzham_lzcomp_internal.h \ IO/3rdParty/lzham/lzham_lzdecompbase.h \ IO/3rdParty/lzham/lzham_match_accel.h \ IO/3rdParty/lzham/lzham_math.h \ IO/3rdParty/lzham/lzham_mem.h \ IO/3rdParty/lzham/lzham_null_threading.h \ IO/3rdParty/lzham/lzham_platform.h \ IO/3rdParty/lzham/lzham_polar_codes.h \ IO/3rdParty/lzham/lzham_prefix_coding.h \ IO/3rdParty/lzham/lzham_pthreads_threading.h \ IO/3rdParty/lzham/lzham_static_lib.h \ IO/3rdParty/lzham/lzham_symbol_codec.h \ IO/3rdParty/lzham/lzham_threading.h \ IO/3rdParty/lzham/lzham_timer.h \ IO/3rdParty/lzham/lzham_traits.h \ IO/3rdParty/lzham/lzham_types.h \ IO/3rdParty/lzham/lzham_utils.h \ IO/3rdParty/lzham/lzham_vector.h \ IO/3rdParty/lzham/lzham_win32_threading.h \ IO/3rdParty/lzma/LzFind.h \ IO/3rdParty/lzma/LzHash.h \ IO/3rdParty/lzma/LzmaDec.h \ IO/3rdParty/lzma/LzmaEnc.h \ IO/3rdParty/lzma/Types.h \ IO/3rdParty/tiff/t4.h \ IO/3rdParty/tiff/tif_dir.h \ IO/3rdParty/tiff/tif_fax3.h \ IO/3rdParty/tiff/tiffconf.h \ IO/3rdParty/tiff/tiff.h \ IO/3rdParty/tiff/tiffio.h \ IO/3rdParty/tiff/tiffiop.h \ IO/3rdParty/tiff/tiffvers.h \ IO/3rdParty/tiff/tif_predict.h \ IO/3rdParty/tiff/uvcode.h \ IO/AbstrConverter.h \ IO/AbstrGeoConverter.h \ IO/AmiraConverter.h \ IO/AnalyzeConverter.h \ IO/BOVConverter.h \ IO/BrickCache.h \ IO/BrickedDataset.h \ IO/const-brick-iterator.h \ IO/Dataset.h \ IO/DICOM/DICOMParser.h \ IO/DirectoryParser.h \ IO/DSFactory.h \ IO/DynamicBrickingDS.h \ IO/FileBackedDataset.h \ IO/G3D.h \ IO/GeomViewConverter.h \ IO/gzio.h \ IO/I3MConverter.h \ IO/IASSConverter.h \ IO/Images/ImageParser.h \ IO/Images/StackExporter.h \ IO/InveonConverter.h \ IO/IOManager.h \ IO/KeyValueFileParser.h \ IO/KitwareConverter.h \ IO/LinearIndexDataset.h \ IO/LinesGeoConverter.h \ IO/MedAlyVisFiberTractGeoConverter.h \ IO/MedAlyVisGeoConverter.h \ IO/MobileGeoConverter.h \ IO/MRCConverter.h \ IO/NRRDConverter.h \ IO/OBJGeoConverter.h \ IO/PLYGeoConverter.h \ IO/Quantize.h \ IO/QVISConverter.h \ IO/RAWConverter.h \ IO/REKConverter.h \ IO/StkConverter.h \ IO/StLGeoConverter.h \ IO/TiffVolumeConverter.h \ IO/TransferFunction1D.h \ IO/TransferFunction2D.h \ IO/TTIFFWriter/TTIFFWriter.h \ IO/TuvokIOError.h \ IO/TuvokJPEG.h \ IO/Tuvok_QtPlugins.h \ IO/TuvokSizes.h \ IO/UVF/DataBlock.h \ IO/uvfDataset.h \ IO/UVF/ExtendedOctree/BzlibCompression.h \ IO/UVF/ExtendedOctree/ExtendedOctreeConverter.h \ IO/UVF/ExtendedOctree/ExtendedOctree.h \ IO/UVF/ExtendedOctree/Hilbert.h \ IO/UVF/ExtendedOctree/Lz4Compression.h \ IO/UVF/ExtendedOctree/LzhamCompression.h \ IO/UVF/ExtendedOctree/LzmaCompression.h \ IO/UVF/ExtendedOctree/VolumeTools.h \ IO/UVF/ExtendedOctree/ZlibCompression.h \ IO/UVF/GeometryDataBlock.h \ IO/UVF/GlobalHeader.h \ IO/UVF/Histogram1DDataBlock.h \ IO/UVF/Histogram2DDataBlock.h \ IO/UVF/KeyValuePairDataBlock.h \ IO/UVF/MaxMinDataBlock.h \ IO/uvfMesh.h \ IO/UVF/RasterDataBlock.h \ IO/UVF/TOCBlock.h \ IO/UVF/UVFBasic.h \ IO/UVF/UVF.h \ IO/UVF/UVFTables.h \ IO/VariantArray.h \ IO/VFFConverter.h \ IO/VGIHeaderParser.h \ IO/VGStudioConverter.h \ IO/VTKConverter.h \ IO/XML3DGeoConverter.h \ LuaScripting/LuaClassConstructor.h \ LuaScripting/LuaClassInstance.h \ LuaScripting/LuaClassRegistration.h \ LuaScripting/LuaCommon.h \ LuaScripting/LuaError.h \ LuaScripting/LuaFunBindingCore.h \ LuaScripting/LuaFunBinding.h \ LuaScripting/LuaMemberReg.h \ LuaScripting/LuaMemberRegUnsafe.h \ LuaScripting/LuaProvenance.h \ LuaScripting/LuaScriptingExecBody.h \ LuaScripting/LuaScriptingExecHeader.h \ LuaScripting/LuaScripting.h \ LuaScripting/LuaStackRAII.h \ LuaScripting/TuvokSpecific/LuaDatasetProxy.h \ LuaScripting/TuvokSpecific/LuaIOManagerProxy.h \ LuaScripting/TuvokSpecific/LuaTransferFun1DProxy.h \ LuaScripting/TuvokSpecific/LuaTransferFun2DProxy.h \ LuaScripting/TuvokSpecific/LuaTuvokTypes.h \ LuaScripting/TuvokSpecific/MatrixMath.h \ Renderer/AbstrRenderer.h \ Renderer/Context.h \ Renderer/ContextIdentification.h \ Renderer/CullingLOD.h \ Renderer/FrameCapture.h \ Renderer/GL/GLCommon.h \ Renderer/GL/GLContext.h \ Renderer/GL/GLFrameCapture.h \ Renderer/GL/GLGPURayTraverser.h \ Renderer/GL/GLGridLeaper.h \ Renderer/GL/GLHashTable.h \ Renderer/GL/GLInclude.h \ Renderer/GL/GLObject.h \ Renderer/GL/GLRaycaster.h \ Renderer/GL/GLRenderer.h \ Renderer/GL/GLSBVR2D.h \ Renderer/GL/GLSBVR.h \ Renderer/GL/GLSLProgram.h \ Renderer/GL/GLStateManager.h \ Renderer/GL/GLTargetBinder.h \ Renderer/GL/GLTexture1D.h \ Renderer/GL/GLTexture2D.h \ Renderer/GL/GLTexture3D.h \ Renderer/GL/GLTexture.h \ Renderer/GL/GLVBO.h \ Renderer/GL/GLVolume2DTex.h \ Renderer/GL/GLVolume3DTex.h \ Renderer/GL/GLVolume.h \ Renderer/GL/GLVolumePool.h \ Renderer/GL/QtGLContext.h \ Renderer/GL/RenderMeshGL.h \ Renderer/GPUMemMan/GPUMemManDataStructs.h \ Renderer/GPUMemMan/GPUMemMan.h \ Renderer/GPUObject.h \ Renderer/RenderMesh.h \ Renderer/RenderRegion.h \ Renderer/SBVRGeoGen2D.h \ Renderer/SBVRGeoGen3D.h \ Renderer/SBVRGeoGen.h \ Renderer/ShaderDescriptor.h \ Renderer/StateManager.h \ Renderer/TFScaling.h \ Renderer/VisibilityState.h \ Renderer/writebrick.h \ StdTuvokDefines.h unix:HEADERS += \ Basics/LargeFileAIO.h \ Basics/LargeFileFD.h \ Basics/LargeFileMMap.h SOURCES += \ 3rdParty/GLEW/GL/glew.c \ 3rdParty/LUA/lapi.cpp \ 3rdParty/LUA/lauxlib.cpp \ 3rdParty/LUA/lbaselib.cpp \ 3rdParty/LUA/lbitlib.cpp \ 3rdParty/LUA/lcode.cpp \ 3rdParty/LUA/lcorolib.cpp \ 3rdParty/LUA/lctype.cpp \ 3rdParty/LUA/ldblib.cpp \ 3rdParty/LUA/ldebug.cpp \ 3rdParty/LUA/ldo.cpp \ 3rdParty/LUA/ldump.cpp \ 3rdParty/LUA/lfunc.cpp \ 3rdParty/LUA/lgc.cpp \ 3rdParty/LUA/linit.cpp \ 3rdParty/LUA/liolib.cpp \ 3rdParty/LUA/llex.cpp \ 3rdParty/LUA/lmathlib.cpp \ 3rdParty/LUA/lmem.cpp \ 3rdParty/LUA/loadlib.cpp \ 3rdParty/LUA/lobject.cpp \ 3rdParty/LUA/lopcodes.cpp \ 3rdParty/LUA/loslib.cpp \ 3rdParty/LUA/lparser.cpp \ 3rdParty/LUA/lstate.cpp \ 3rdParty/LUA/lstring.cpp \ 3rdParty/LUA/lstrlib.cpp \ 3rdParty/LUA/ltable.cpp \ 3rdParty/LUA/ltablib.cpp \ 3rdParty/LUA/ltm.cpp \ 3rdParty/LUA/lundump.cpp \ 3rdParty/LUA/lvm.cpp \ 3rdParty/LUA/lzio.cpp \ Basics/Appendix.cpp \ Basics/ArcBall.cpp \ Basics/Checksums/MD5.cpp \ Basics/Clipper.cpp \ Basics/EndianFile.cpp \ Basics/GeometryGenerator.cpp \ Basics/KDTree.cpp \ Basics/LargeFileC.cpp \ Basics/LargeFile.cpp \ Basics/LargeRAWFile.cpp \ Basics/MathTools.cpp \ Basics/MC.cpp \ Basics/Mesh.cpp \ Basics/Plane.cpp \ Basics/ProgressTimer.cpp \ Basics/SystemInfo.cpp \ Basics/SysTools.cpp \ Basics/Threads.cpp \ Basics/Timer.cpp \ Controller/MasterController.cpp \ DebugOut/AbstrDebugOut.cpp \ DebugOut/ConsoleOut.cpp \ DebugOut/MultiplexOut.cpp \ DebugOut/TextfileOut.cpp \ IO/3rdParty/bzip2/blocksort.c \ IO/3rdParty/bzip2/bzlib.c \ IO/3rdParty/bzip2/compress.c \ IO/3rdParty/bzip2/crctable.c \ IO/3rdParty/bzip2/decompress.c \ IO/3rdParty/bzip2/huffman.c \ IO/3rdParty/bzip2/randtable.c \ IO/3rdParty/jpeglib/cdjpeg.c \ IO/3rdParty/jpeglib/jcapimin.c \ IO/3rdParty/jpeglib/jcapistd.c \ IO/3rdParty/jpeglib/jccoefct.c \ IO/3rdParty/jpeglib/jccolor.c \ IO/3rdParty/jpeglib/jcdctmgr.c \ IO/3rdParty/jpeglib/jcdiffct.c \ IO/3rdParty/jpeglib/jchuff.c \ IO/3rdParty/jpeglib/jcinit.c \ IO/3rdParty/jpeglib/jclhuff.c \ IO/3rdParty/jpeglib/jclossls.c \ IO/3rdParty/jpeglib/jclossy.c \ IO/3rdParty/jpeglib/jcmainct.c \ IO/3rdParty/jpeglib/jcmarker.c \ IO/3rdParty/jpeglib/jcmaster.c \ IO/3rdParty/jpeglib/jcodec.c \ IO/3rdParty/jpeglib/jcomapi.c \ IO/3rdParty/jpeglib/jcparam.c \ IO/3rdParty/jpeglib/jcphuff.c \ IO/3rdParty/jpeglib/jcpred.c \ IO/3rdParty/jpeglib/jcprepct.c \ IO/3rdParty/jpeglib/jcsample.c \ IO/3rdParty/jpeglib/jcscale.c \ IO/3rdParty/jpeglib/jcshuff.c \ IO/3rdParty/jpeglib/jctrans.c \ IO/3rdParty/jpeglib/jdapimin.c \ IO/3rdParty/jpeglib/jdapistd.c \ IO/3rdParty/jpeglib/jdatadst.c \ IO/3rdParty/jpeglib/jdatasrc.c \ IO/3rdParty/jpeglib/jdcoefct.c \ IO/3rdParty/jpeglib/jdcolor.c \ IO/3rdParty/jpeglib/jddctmgr.c \ IO/3rdParty/jpeglib/jddiffct.c \ IO/3rdParty/jpeglib/jdhuff.c \ IO/3rdParty/jpeglib/jdinput.c \ IO/3rdParty/jpeglib/jdlhuff.c \ IO/3rdParty/jpeglib/jdlossls.c \ IO/3rdParty/jpeglib/jdlossy.c \ IO/3rdParty/jpeglib/jdmainct.c \ IO/3rdParty/jpeglib/jdmarker.c \ IO/3rdParty/jpeglib/jdmaster.c \ IO/3rdParty/jpeglib/jdmerge.c \ IO/3rdParty/jpeglib/jdphuff.c \ IO/3rdParty/jpeglib/jdpostct.c \ IO/3rdParty/jpeglib/jdpred.c \ IO/3rdParty/jpeglib/jdsample.c \ IO/3rdParty/jpeglib/jdscale.c \ IO/3rdParty/jpeglib/jdshuff.c \ IO/3rdParty/jpeglib/jdtrans.c \ IO/3rdParty/jpeglib/jerror.c \ IO/3rdParty/jpeglib/jfdctflt.c \ IO/3rdParty/jpeglib/jfdctfst.c \ IO/3rdParty/jpeglib/jfdctint.c \ IO/3rdParty/jpeglib/jidctflt.c \ IO/3rdParty/jpeglib/jidctfst.c \ IO/3rdParty/jpeglib/jidctint.c \ IO/3rdParty/jpeglib/jidctred.c \ IO/3rdParty/jpeglib/jmemmgr.c \ IO/3rdParty/jpeglib/jmemnobs.c \ IO/3rdParty/jpeglib/jquant1.c \ IO/3rdParty/jpeglib/jquant2.c \ IO/3rdParty/jpeglib/jutils.c \ IO/3rdParty/jpeglib/rdcolmap.c \ IO/3rdParty/jpeglib/rdswitch.c \ IO/3rdParty/jpeglib/transupp.c \ IO/3rdParty/lz4/lz4.c \ IO/3rdParty/lz4/lz4hc.c \ IO/3rdParty/lzham/lzham_api.cpp \ IO/3rdParty/lzham/lzham_assert.cpp \ IO/3rdParty/lzham/lzham_checksum.cpp \ IO/3rdParty/lzham/lzham_huffman_codes.cpp \ IO/3rdParty/lzham/lzham_lib.cpp \ IO/3rdParty/lzham/lzham_lzbase.cpp \ IO/3rdParty/lzham/lzham_lzcomp.cpp \ IO/3rdParty/lzham/lzham_lzcomp_internal.cpp \ IO/3rdParty/lzham/lzham_lzcomp_state.cpp \ IO/3rdParty/lzham/lzham_lzdecompbase.cpp \ IO/3rdParty/lzham/lzham_lzdecomp.cpp \ IO/3rdParty/lzham/lzham_match_accel.cpp \ IO/3rdParty/lzham/lzham_mem.cpp \ IO/3rdParty/lzham/lzham_platform.cpp \ IO/3rdParty/lzham/lzham_polar_codes.cpp \ IO/3rdParty/lzham/lzham_prefix_coding.cpp \ IO/3rdParty/lzham/lzham_pthreads_threading.cpp \ IO/3rdParty/lzham/lzham_symbol_codec.cpp \ IO/3rdParty/lzham/lzham_timer.cpp \ IO/3rdParty/lzham/lzham_vector.cpp \ IO/3rdParty/lzham/lzham_win32_threading.cpp \ IO/3rdParty/lzma/LzFind.c \ IO/3rdParty/lzma/LzmaDec.c \ IO/3rdParty/lzma/LzmaEnc.c \ IO/3rdParty/tiff/tif_aux.c \ IO/3rdParty/tiff/tif_close.c \ IO/3rdParty/tiff/tif_codec.c \ IO/3rdParty/tiff/tif_color.c \ IO/3rdParty/tiff/tif_compress.c \ IO/3rdParty/tiff/tif_dir.c \ IO/3rdParty/tiff/tif_dirinfo.c \ IO/3rdParty/tiff/tif_dirread.c \ IO/3rdParty/tiff/tif_dirwrite.c \ IO/3rdParty/tiff/tif_dumpmode.c \ IO/3rdParty/tiff/tif_error.c \ IO/3rdParty/tiff/tif_extension.c \ IO/3rdParty/tiff/tif_fax3.c \ IO/3rdParty/tiff/tif_fax3sm.c \ IO/3rdParty/tiff/tif_flush.c \ IO/3rdParty/tiff/tif_getimage.c \ IO/3rdParty/tiff/tif_jpeg.c \ IO/3rdParty/tiff/tif_luv.c \ IO/3rdParty/tiff/tif_lzw.c \ IO/3rdParty/tiff/tif_next.c \ IO/3rdParty/tiff/tif_open.c \ IO/3rdParty/tiff/tif_packbits.c \ IO/3rdParty/tiff/tif_pixarlog.c \ IO/3rdParty/tiff/tif_predict.c \ IO/3rdParty/tiff/tif_print.c \ IO/3rdParty/tiff/tif_read.c \ IO/3rdParty/tiff/tif_strip.c \ IO/3rdParty/tiff/tif_swab.c \ IO/3rdParty/tiff/tif_thunder.c \ IO/3rdParty/tiff/tif_tile.c \ IO/3rdParty/tiff/tif_version.c \ IO/3rdParty/tiff/tif_warning.c \ IO/3rdParty/tiff/tif_write.c \ IO/3rdParty/tiff/tif_zip.c \ IO/AbstrConverter.cpp \ IO/AbstrGeoConverter.cpp \ IO/AmiraConverter.cpp \ IO/AnalyzeConverter.cpp \ IO/BOVConverter.cpp \ IO/BrickCache.cpp \ IO/BrickedDataset.cpp \ IO/const-brick-iterator.cpp \ IO/Dataset.cpp \ IO/DICOM/DICOMParser.cpp \ IO/DirectoryParser.cpp \ IO/DSFactory.cpp \ IO/DynamicBrickingDS.cpp \ IO/FileBackedDataset.cpp \ IO/G3D.cpp \ IO/GeomViewConverter.cpp \ IO/gzio.c \ IO/I3MConverter.cpp \ IO/IASSConverter.cpp \ IO/Images/ImageParser.cpp \ IO/Images/StackExporter.cpp \ IO/InveonConverter.cpp \ IO/IOManager.cpp \ IO/KeyValueFileParser.cpp \ IO/KitwareConverter.cpp \ IO/LinearIndexDataset.cpp \ IO/LinesGeoConverter.cpp \ IO/MedAlyVisFiberTractGeoConverter.cpp \ IO/MedAlyVisGeoConverter.cpp \ IO/MobileGeoConverter.cpp \ IO/MRCConverter.cpp \ IO/NRRDConverter.cpp \ IO/OBJGeoConverter.cpp \ IO/PLYGeoConverter.cpp \ IO/QVISConverter.cpp \ IO/RAWConverter.cpp \ IO/REKConverter.cpp \ IO/StkConverter.cpp \ IO/StLGeoConverter.cpp \ IO/TiffVolumeConverter.cpp \ IO/TransferFunction1D.cpp \ IO/TransferFunction2D.cpp \ IO/TTIFFWriter/TTIFFWriter.cpp \ IO/TuvokJPEG.cpp \ IO/UVF/DataBlock.cpp \ IO/uvfDataset.cpp \ IO/UVF/ExtendedOctree/BzlibCompression.cpp \ IO/UVF/ExtendedOctree/ExtendedOctreeConverter.cpp \ IO/UVF/ExtendedOctree/ExtendedOctree.cpp \ IO/UVF/ExtendedOctree/Lz4Compression.cpp \ IO/UVF/ExtendedOctree/LzhamCompression.cpp \ IO/UVF/ExtendedOctree/LzmaCompression.cpp \ IO/UVF/ExtendedOctree/VolumeTools.cpp \ IO/UVF/ExtendedOctree/ZlibCompression.cpp \ IO/UVF/GeometryDataBlock.cpp \ IO/UVF/GlobalHeader.cpp \ IO/UVF/Histogram1DDataBlock.cpp \ IO/UVF/Histogram2DDataBlock.cpp \ IO/UVF/KeyValuePairDataBlock.cpp \ IO/UVF/MaxMinDataBlock.cpp \ IO/uvfMesh.cpp \ IO/UVF/RasterDataBlock.cpp \ IO/UVF/TOCBlock.cpp \ IO/UVF/UVF.cpp \ IO/UVF/UVFTables.cpp \ IO/VariantArray.cpp \ IO/VFFConverter.cpp \ IO/VGIHeaderParser.cpp \ IO/VGStudioConverter.cpp \ IO/VTKConverter.cpp \ IO/XML3DGeoConverter.cpp \ LuaScripting/LuaClassConstructor.cpp \ LuaScripting/LuaClassInstance.cpp \ LuaScripting/LuaClassRegistration.cpp \ LuaScripting/LuaMemberReg.cpp \ LuaScripting/LuaMemberRegUnsafe.cpp \ LuaScripting/LuaProvenance.cpp \ LuaScripting/LuaScripting.cpp \ LuaScripting/LuaStackRAII.cpp \ LuaScripting/TuvokSpecific/LuaDatasetProxy.cpp \ LuaScripting/TuvokSpecific/LuaIOManagerProxy.cpp \ LuaScripting/TuvokSpecific/LuaTransferFun1DProxy.cpp \ LuaScripting/TuvokSpecific/LuaTransferFun2DProxy.cpp \ LuaScripting/TuvokSpecific/LuaTuvokTypes.cpp \ LuaScripting/TuvokSpecific/MatrixMath.cpp \ Renderer/AbstrRenderer.cpp \ Renderer/Context.cpp \ Renderer/CullingLOD.cpp \ Renderer/GL/GLCommon.cpp \ Renderer/GL/GLFBOTex.cpp \ Renderer/GL/GLFrameCapture.cpp \ Renderer/GL/GLGPURayTraverser.cpp \ Renderer/GL/GLGridLeaper.cpp \ Renderer/GL/GLHashTable.cpp \ Renderer/GL/GLRaycaster.cpp \ Renderer/GL/GLRenderer.cpp \ Renderer/GL/GLSBVR2D.cpp \ Renderer/GL/GLSBVR.cpp \ Renderer/GL/GLSLProgram.cpp \ Renderer/GL/GLStateManager.cpp \ Renderer/GL/GLTargetBinder.cpp \ Renderer/GL/GLTexture1D.cpp \ Renderer/GL/GLTexture2D.cpp \ Renderer/GL/GLTexture3D.cpp \ Renderer/GL/GLTexture.cpp \ Renderer/GL/GLVBO.cpp \ Renderer/GL/GLVolume2DTex.cpp \ Renderer/GL/GLVolume3DTex.cpp \ Renderer/GL/GLVolume.cpp \ Renderer/GL/GLVolumePool.cpp \ Renderer/GL/RenderMeshGL.cpp \ Renderer/GPUMemMan/GPUMemMan.cpp \ Renderer/GPUMemMan/GPUMemManDataStructs.cpp \ Renderer/RenderMesh.cpp \ Renderer/RenderRegion.cpp \ Renderer/SBVRGeogen2D.cpp \ Renderer/SBVRGeogen3D.cpp \ Renderer/SBVRGeogen.cpp \ Renderer/ShaderDescriptor.cpp \ Renderer/TFScaling.cpp \ Renderer/VisibilityState.cpp unix:SOURCES += \ Basics/LargeFileAIO.cpp \ Basics/LargeFileFD.cpp \ Basics/LargeFileMMap.cpp \ IO/3rdParty/tiff/tif_unix.c win32 { HEADERS += \ Basics/DynamicDX.h \ Renderer/DX/DXContext.h \ Renderer/DX/DXObject.h \ Renderer/DX/DXRaycaster.h \ Renderer/DX/DXRenderer.h \ Renderer/DX/DXSBVR.h \ Renderer/DX/DXTexture.h \ Renderer/DX/DXTexture1D.h \ Renderer/DX/DXTexture2D.h \ Renderer/DX/DXTexture3D.h SOURCES += \ Basics/DynamicDX.cpp \ IO/3rdParty/tiff/tif_win32.c \ Renderer/DX/DXRaycaster.cpp \ Renderer/DX/DXRenderer.cpp \ Renderer/DX/DXSBVR.cpp \ Renderer/DX/DXTexture.cpp \ Renderer/DX/DXTexture1D.cpp \ Renderer/DX/DXTexture2D.cpp \ Renderer/DX/DXTexture3D.cpp } ImageVis3D-3.1.0/Tuvok/DebugOut/0000755000175000017500000000000012320456500016103 5ustar mathieumathieuImageVis3D-3.1.0/Tuvok/DebugOut/AbstrDebugOut.cpp0000644000175000017500000001354712320456500021333 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file AbstrDebugOut.cpp \author Jens Krueger SCI Institute University of Utah \date January 2009 */ #include #include #include #include "AbstrDebugOut.h" const char *AbstrDebugOut::ChannelToString(enum DebugChannel c) const { switch(c) { case CHANNEL_NONE: /* FALL THROUGH */ case CHANNEL_FINAL: return ""; case CHANNEL_ERROR: return "ERROR"; case CHANNEL_WARNING: return "WARNING"; case CHANNEL_MESSAGE: return "MESSAGE"; case CHANNEL_OTHER: return "OTHER"; } return ""; } bool AbstrDebugOut::Enabled(enum DebugChannel channel) const { switch(channel) { case CHANNEL_NONE: /* FALL THROUGH */ case CHANNEL_FINAL: return true; case CHANNEL_ERROR: return m_bShowErrors; case CHANNEL_WARNING: return m_bShowWarnings; case CHANNEL_MESSAGE: return m_bShowMessages; case CHANNEL_OTHER: return m_bShowOther; } return true; } void AbstrDebugOut::Other(const char *source, const char* format, ...) { if (!m_bShowOther) return; char buff[16384]; va_list args; va_start(args, format); #ifdef DETECTED_OS_WINDOWS _vsnprintf_s(buff, 16384, sizeof(buff), format, args); #else vsnprintf(buff, sizeof(buff), format, args); #endif va_end(args); this->printf(CHANNEL_OTHER, source, buff); } void AbstrDebugOut::Message(const char* source, const char* format, ...) { if (!m_bShowMessages) return; char buff[16384]; va_list args; va_start(args, format); #ifdef DETECTED_OS_WINDOWS _vsnprintf_s(buff, 16384, sizeof(buff), format, args); #else vsnprintf(buff, sizeof(buff), format, args); #endif va_end(args); this->printf(CHANNEL_MESSAGE, source, buff); } void AbstrDebugOut::Warning(const char* source, const char* format, ...) { if (!m_bShowWarnings) return; char buff[16384]; va_list args; va_start(args, format); #ifdef DETECTED_OS_WINDOWS _vsnprintf_s(buff, 16384, sizeof(buff), format, args); #else vsnprintf(buff, sizeof(buff), format, args); #endif va_end(args); this->printf(CHANNEL_WARNING, source, buff); } void AbstrDebugOut::Error(const char* source, const char* format, ...) { if (!m_bShowErrors) return; char buff[16384]; va_list args; va_start(args, format); #ifdef DETECTED_OS_WINDOWS _vsnprintf_s(buff, 16384, sizeof(buff), format, args); #else vsnprintf(buff, sizeof(buff), format, args); #endif va_end(args); this->printf(CHANNEL_ERROR, source, buff); } void AbstrDebugOut::PrintErrorList() { printf( "Printing recorded errors:" ); for (std::deque::const_iterator i = m_strLists[CHANNEL_ERROR].begin(); i != m_strLists[CHANNEL_ERROR].end(); ++i) { printf( i->c_str() ); } printf( "end of recorded errors" ); } void AbstrDebugOut::PrintWarningList() { printf( "Printing recorded errors:" ); for (std::deque::const_iterator i = m_strLists[CHANNEL_WARNING].begin(); i != m_strLists[CHANNEL_WARNING].end(); ++i) { printf( i->c_str() ); } printf( "end of recorded errors" ); } void AbstrDebugOut::PrintMessageList() { printf( "Printing recorded errors:" ); for (std::deque::const_iterator i = m_strLists[CHANNEL_MESSAGE].begin(); i != m_strLists[CHANNEL_MESSAGE].end(); ++i) { printf( i->c_str() ); } printf( "end of recorded errors" ); } void AbstrDebugOut::SetOutput(bool bShowErrors, bool bShowWarnings, bool bShowMessages, bool bShowOther) { SetShowMessages(bShowMessages); SetShowWarnings(bShowWarnings); SetShowErrors(bShowErrors); SetShowOther(bShowOther); } void AbstrDebugOut::GetOutput(bool& bShowErrors, bool& bShowWarnings, bool& bShowMessages, bool& bShowOther) const { bShowMessages = ShowMessages(); bShowWarnings = ShowWarnings(); bShowErrors = ShowErrors(); bShowOther = ShowOther(); } void AbstrDebugOut::SetShowMessages(bool bShowMessages) { m_bShowMessages = bShowMessages; } void AbstrDebugOut::SetShowWarnings(bool bShowWarnings) { m_bShowWarnings = bShowWarnings; } void AbstrDebugOut::SetShowErrors(bool bShowErrors) { m_bShowErrors = bShowErrors; } void AbstrDebugOut::SetShowOther(bool bShowOther) { m_bShowOther = bShowOther; } void AbstrDebugOut::ReplaceSpecialChars(char* buff, size_t iSize) const { std::string s = buff; size_t j=0; for (;(j = s.find( "%", j )) != std::string::npos;) { s.replace( j, 1, "%%" ); j+=2; } size_t iLength = std::min(s.length(), iSize-1); std::memcpy(buff, s.c_str(), iLength); buff[iLength] = 0; } ImageVis3D-3.1.0/Tuvok/DebugOut/AbstrDebugOut.h0000644000175000017500000001111012320456500020760 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file AbstrDebugOut.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date August 2008 */ #pragma once #ifndef TUVOK_ABSTRDEBUGOUT_H #define TUVOK_ABSTRDEBUGOUT_H #include "../StdTuvokDefines.h" #include #include #include #include class AbstrDebugOut { public: AbstrDebugOut() : m_bShowMessages(false), #ifdef _DEBUG m_bShowWarnings(true), #else m_bShowWarnings(false), #endif m_bShowErrors(true), m_bShowOther(false) { for(size_t i=0; i < m_bRecordLists.size(); ++i) { m_bRecordLists[i] = false; } } virtual ~AbstrDebugOut() { for(size_t i=0; i < m_bRecordLists.size(); ++i) { m_bRecordLists[i] = false; } } enum DebugChannel { CHANNEL_NONE=0, CHANNEL_ERROR, CHANNEL_WARNING, CHANNEL_MESSAGE, CHANNEL_OTHER, CHANNEL_FINAL, ///< don't use, but must be the last one. }; const char *ChannelToString(enum DebugChannel) const; bool Enabled(enum DebugChannel) const; virtual void printf(enum DebugChannel, const char* source, const char* msg) = 0; virtual void printf(const char *s) const = 0; virtual void Other(const char *source, const char* format, ...); virtual void Message(const char* source, const char* format, ...); virtual void Warning(const char* source, const char* format, ...); virtual void Error(const char* source, const char* format, ...); void PrintErrorList(); void PrintWarningList(); void PrintMessageList(); virtual void ClearErrorList() { m_strLists[CHANNEL_ERROR].clear(); } virtual void ClearWarningList() { m_strLists[CHANNEL_WARNING].clear(); } virtual void ClearMessageList() { m_strLists[CHANNEL_MESSAGE].clear(); } virtual void SetListRecordingErrors(bool bRecord) {m_bRecordLists[0] = bRecord;} virtual void SetListRecordingWarnings(bool bRecord) {m_bRecordLists[1] = bRecord;} virtual void SetListRecordingMessages(bool bRecord) {m_bRecordLists[2] = bRecord;} virtual bool GetListRecordingErrors() {return m_bRecordLists[0];} virtual bool GetListRecordingWarnings() {return m_bRecordLists[1];} virtual bool GetListRecordingMessages() {return m_bRecordLists[2];} void SetOutput(bool bShowErrors, bool bShowWarnings, bool bShowMessages, bool bShowOther); void GetOutput(bool& bShowErrors, bool& bShowWarnings, bool& bShowMessages, bool& bShowOther) const; bool ShowMessages() const {return m_bShowMessages;} bool ShowWarnings() const {return m_bShowWarnings;} bool ShowErrors() const {return m_bShowErrors;} bool ShowOther() const {return m_bShowOther;} virtual void SetShowMessages(bool bShowMessages); virtual void SetShowWarnings(bool bShowWarnings); virtual void SetShowErrors(bool bShowErrors); virtual void SetShowOther(bool bShowOther); protected: bool m_bShowMessages; bool m_bShowWarnings; bool m_bShowErrors; bool m_bShowOther; std::array m_bRecordLists; std::array, CHANNEL_FINAL> m_strLists; void ReplaceSpecialChars(char* buff, size_t iSize) const; }; #endif // TUVOK_ABSTRDEBUGOUT_H ImageVis3D-3.1.0/Tuvok/DebugOut/ConsoleOut.h0000644000175000017500000000331312320456500020346 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file ConsoleOut.h \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #pragma once #ifndef CONSOLEOUT_H #define CONSOLEOUT_H #include "AbstrDebugOut.h" class ConsoleOut : public AbstrDebugOut { public: ConsoleOut(); ~ConsoleOut(); virtual void printf(enum DebugChannel, const char* source, const char* msg); virtual void printf(const char *s) const; }; #endif // CONSOLEOUT_H ImageVis3D-3.1.0/Tuvok/DebugOut/MultiplexOut.h0000644000175000017500000000437712320456500020742 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file MultiplexOut.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date September 2008 */ #pragma once #ifndef TUVOK_MULTIPLEXOUT_H #define TUVOK_MULTIPLEXOUT_H #include #include "AbstrDebugOut.h" class MultiplexOut : public AbstrDebugOut { public: MultiplexOut() {} ~MultiplexOut(); void AddDebugOut(AbstrDebugOut* pDebugger); void RemoveDebugOut(AbstrDebugOut* pDebugger); virtual void printf(enum DebugChannel, const char* source, const char* msg); virtual void printf(const char *s) const; virtual void SetShowMessages(bool bShowMessages); virtual void SetShowWarnings(bool bShowWarnings); virtual void SetShowErrors(bool bShowErrors); virtual void SetShowOther(bool bShowOther); size_t size() const { return m_vpDebugger.size(); } bool empty() const { return m_vpDebugger.empty(); } void clear(); private: std::vector m_vpDebugger; }; #endif // TUVOK_MULTIPLEXOUT_H ImageVis3D-3.1.0/Tuvok/DebugOut/TextfileOut.cpp0000644000175000017500000000571412320456500021072 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file TextfileOut.cpp \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #include #include #ifdef WIN32 #include #endif #include "TextfileOut.h" #include using namespace std; TextfileOut::TextfileOut(std::string strFilename) : m_strFilename(strFilename) { this->Message(_func_, "Starting up"); } TextfileOut::~TextfileOut() { this->Message(_func_, "Shutting down\n"); } void TextfileOut::printf(enum DebugChannel channel, const char* source, const char* buff) { time_t epoch_time; time(&epoch_time); #undef ADDR_NOW #ifdef DETECTED_OS_WINDOWS struct tm now; localtime_s(&now, &epoch_time); #define ADDR_NOW (&now) #else struct tm* now; now = localtime(&epoch_time); #define ADDR_NOW (now) #endif char datetime[64]; ofstream fs; fs.open(m_strFilename.c_str(), ios_base::app); if (fs.fail()) return; if(strftime(datetime, 64, "(%d.%m.%Y %H:%M:%S)", ADDR_NOW) > 0) { fs << datetime << " "; } fs << ChannelToString(channel) << " (" << source << ") " << buff << std::endl; fs.flush(); fs.close(); } void TextfileOut::printf(const char *s) const { time_t epoch_time; time(&epoch_time); #undef ADDR_NOW #ifdef DETECTED_OS_WINDOWS struct tm now; localtime_s(&now, &epoch_time); #define ADDR_NOW (&now) #else struct tm* now; now = localtime(&epoch_time); #define ADDR_NOW (now) #endif char datetime[64]; ofstream fs; fs.open(m_strFilename.c_str(), ios_base::app); if (fs.fail()) return; if(strftime(datetime, 64, "(%d.%m.%Y %H:%M:%S)", ADDR_NOW) > 0) { fs << datetime << " " << s << std::endl; } else { fs << s << std::endl; } fs.flush(); fs.close(); } ImageVis3D-3.1.0/Tuvok/DebugOut/ConsoleOut.cpp0000644000175000017500000000565412320456500020713 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file ConsoleOut.cpp \author Jens Krueger SCI Institute University of Utah \date August 2008 */ #include #include "ConsoleOut.h" #include "Basics/Console.h" /// ANSI escape codes for various colors. ///@{ static const char C_DGRAY[] = "\033[01;30m"; static const char C_NORM[] = "\033[00m"; static const char C_RED[] = "\033[01;31m"; static const char C_YELLOW[] = "\033[01;33m"; static const char C_GREEN[] = "\033[01;32m"; static const char C_MAG[] = "\033[01;35m"; static const char C_LBLUE[] = "\033[01;36m"; static const char C_WHITE[] = "\033[01;27m"; ///@} ConsoleOut::ConsoleOut() { Message("ConsoleOut::ConsoleOut:","Starting up ConsoleDebug out"); } ConsoleOut::~ConsoleOut() { Message("ConsoleOut::~ConsoleOut:","Shutting down ConsoleDebug out"); } void ConsoleOut::printf(enum DebugChannel channel, const char* source, const char* msg) { char buff[16384] = {0}; #ifdef DETECTED_OS_WINDOWS strncpy_s(buff, 16384, msg, 16384); #else strncpy(buff, msg, 16384); #endif #ifdef DETECTED_OS_WINDOWS Console::printf("%s (%s): %s\n", ChannelToString(channel), source, buff); #else const char *color = C_NORM; switch(channel) { case CHANNEL_FINAL: /* FALL THROUGH */ case CHANNEL_NONE: color = C_NORM; break; case CHANNEL_ERROR: color = C_RED; break; case CHANNEL_WARNING: color = C_YELLOW; break; case CHANNEL_MESSAGE: color = C_DGRAY; break; case CHANNEL_OTHER: color = C_LBLUE; break; } Console::printf("%s%s%s (%s): %s\n", color, ChannelToString(channel), C_NORM, source, buff); #endif } void ConsoleOut::printf(const char *s) const { Console::printf("%s\n", s); } ImageVis3D-3.1.0/Tuvok/DebugOut/TextfileOut.h0000644000175000017500000000411112320456500020525 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file TextfileOut.h \author Jens Krueger SCI Institute University of Utah \version 1.0 \date August 2008 */ #pragma once #ifndef TUVOK_TEXTFILEOUT_H #define TUVOK_TEXTFILEOUT_H #include #include "AbstrDebugOut.h" class TextfileOut : public AbstrDebugOut { public: TextfileOut(std::string strFilename="logfile.txt"); ~TextfileOut(); virtual void printf(enum DebugChannel, const char* source, const char* msg); virtual void printf(const char *s) const; const std::string& GetFileName() const {return m_strFilename;} private: TextfileOut(const TextfileOut &); ///< unimplemented. private: std::string m_strFilename; /// same as printf above but does regard m_bShowOther void _printf(const char* format, ...) const; }; #endif // TUVOK_TEXTFILEOUT_H ImageVis3D-3.1.0/Tuvok/DebugOut/MultiplexOut.cpp0000644000175000017500000000766212320456500021275 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file MultiplexOut.cpp \author Jens Krueger SCI Institute University of Utah \date September 2008 */ #include #include #include #include #include "MultiplexOut.h" #ifdef WIN32 #include // undef stupid windows defines to max and min #ifdef max #undef max #endif #ifdef min #undef min #endif #endif using namespace std; MultiplexOut::~MultiplexOut() { for (size_t i = 0;iOther(_func_, "Shutting down"); delete m_vpDebugger[i]; } } void MultiplexOut::AddDebugOut(AbstrDebugOut* pDebugger) { m_vpDebugger.push_back(pDebugger); pDebugger->Other(_func_,"Operating as part of a multiplexed debug out now."); // Find the maximal set of channels to enable. m_bShowMessages |= pDebugger->ShowMessages(); m_bShowWarnings |= pDebugger->ShowWarnings(); m_bShowErrors |= pDebugger->ShowErrors(); m_bShowOther |= pDebugger->ShowOther(); } void MultiplexOut::RemoveDebugOut(AbstrDebugOut* pDebugger) { std::vector::iterator del; del = std::find(m_vpDebugger.begin(), m_vpDebugger.end(), pDebugger); if(del != m_vpDebugger.end()) { delete *del; m_vpDebugger.erase(del); } } void MultiplexOut::printf(enum DebugChannel channel, const char* source, const char* msg) { for (size_t i = 0;iEnabled(channel)) { m_vpDebugger[i]->printf(channel, source, msg); } } } void MultiplexOut::printf(const char *s) const { for (size_t i = 0;iprintf(s); } } void MultiplexOut::SetShowMessages(bool bShowMessages) { AbstrDebugOut::SetShowMessages(bShowMessages); for (size_t i = 0;iSetShowMessages(bShowMessages); } void MultiplexOut::SetShowWarnings(bool bShowWarnings) { AbstrDebugOut::SetShowWarnings(bShowWarnings); for (size_t i = 0;iSetShowWarnings(bShowWarnings); } void MultiplexOut::SetShowErrors(bool bShowErrors) { AbstrDebugOut::SetShowErrors(bShowErrors); for (size_t i = 0;iSetShowErrors(bShowErrors); } void MultiplexOut::SetShowOther(bool bShowOther) { AbstrDebugOut::SetShowOther(bShowOther); for (size_t i = 0;iSetShowOther(bShowOther); } template struct deleter : std::unary_function { void operator()(T* p) const { delete p; } }; void MultiplexOut::clear() { std::for_each(m_vpDebugger.begin(), m_vpDebugger.end(), deleter()); m_vpDebugger.clear(); } ImageVis3D-3.1.0/Tuvok/Tuvok.vcxproj0000644000175000017500000045042312320456500017122 0ustar mathieumathieu Debug (No Qt) Win32 Debug (No Qt) x64 Debug (with DirectX) Win32 Debug (with DirectX) x64 Debug Win32 Debug x64 Release (No Qt) Win32 Release (No Qt) x64 Release (with DirectX) Win32 Release (with DirectX) x64 Release Win32 Release x64 {D474A1E1-2ED3-42E6-826C-372430E549B9} Tuvoc Win32Proj StaticLibrary Unicode true StaticLibrary Unicode StaticLibrary Unicode true StaticLibrary Unicode true StaticLibrary Unicode StaticLibrary Unicode StaticLibrary Unicode true StaticLibrary Unicode StaticLibrary Unicode true StaticLibrary Unicode true StaticLibrary Unicode StaticLibrary Unicode <_ProjectFileVersion>10.0.40219.1 Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ Build\$(Platform)\$(Configuration)\objects\ Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ Build\$(Platform)\$(Configuration)\objects\ Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ Build\$(Platform)\$(Configuration)\objects\ Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ Build\$(Platform)\$(Configuration)\objects\ Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset $(DXSDK_DIR)lib\x86;$(LibraryPath) $(DXSDK_DIR)lib\x86;$(LibraryPath) $(DXSDK_DIR)lib\x64;$(LibraryPath) $(DXSDK_DIR)lib\x64;$(LibraryPath) $(DXSDK_DIR)include;$(IncludePath) $(DXSDK_DIR)include;$(IncludePath) $(DXSDK_DIR)include;$(IncludePath) $(DXSDK_DIR)include;$(IncludePath) Disabled 3rdParty/GLEW;.;IO/3rdParty/boost;IO/3rdParty/zlib;IO/exception;Basics/;Basics/3rdParty/boost;IO/3rdParty/lzma;IO/3rdParty/lz4;IO/3rdParty/lzham;$(QTDIR32)/include;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 EditAndContinue 4127;4512;4006;%(DisableSpecificWarnings) glu32.lib;%(AdditionalDependencies) $(QTDIR32)\lib;%(AdditionalLibraryDirectories) Disabled 3rdParty/GLEW;.;IO/3rdParty/boost;IO/3rdParty/zlib;IO/exception;Basics/;Basics/3rdParty/boost;IO/3rdParty/lzma;IO/3rdParty/lz4;IO/3rdParty/lzham;$(QTDIR32)/include;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;TUVOK_NO_QT;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 EditAndContinue 4127;4512;4006;%(DisableSpecificWarnings) glu32.lib;%(AdditionalDependencies) $(QTDIR32)\lib;%(AdditionalLibraryDirectories) X64 Disabled 3rdParty/GLEW;.;IO/3rdParty/boost;IO/3rdParty/zlib;IO/exception;Basics/;Basics/3rdParty/boost;IO/3rdParty/lzma;IO/3rdParty/lz4;IO/3rdParty/lzham;$(QTDIR64)/include;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 ProgramDatabase 4127;4512;4006;%(DisableSpecificWarnings) glu32.lib;%(AdditionalDependencies) $(QTDIR64)\lib;%(AdditionalLibraryDirectories) X64 Disabled 3rdParty/GLEW;.;IO/3rdParty/boost;IO/3rdParty/zlib;IO/exception;Basics/;Basics/3rdParty/boost;IO/3rdParty/lzma;IO/3rdParty/lz4;IO/3rdParty/lzham;$(QTDIR64)/include;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;TUVOK_NO_QT;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 ProgramDatabase 4127;4512;4006;%(DisableSpecificWarnings) glu32.lib;%(AdditionalDependencies) $(QTDIR64)\lib;%(AdditionalLibraryDirectories) /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) MaxSpeed true 3rdParty/GLEW;.;IO/3rdParty/boost;IO/3rdParty/zlib;IO/exception;Basics/;Basics/3rdParty/boost;IO/3rdParty/lzma;IO/3rdParty/lz4;IO/3rdParty/lzham;$(QTDIR32)/include;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;4006;%(DisableSpecificWarnings) glu32.lib;%(AdditionalDependencies) $(QTDIR32)\lib;%(AdditionalLibraryDirectories) /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) MaxSpeed true 3rdParty/GLEW;.;IO/3rdParty/boost;IO/3rdParty/zlib;IO/exception;Basics/;Basics/3rdParty/boost;IO/3rdParty/lzma;IO/3rdParty/lz4;IO/3rdParty/lzham;$(QTDIR32)/include;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;TUVOK_NO_QT;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;4006;%(DisableSpecificWarnings) glu32.lib;%(AdditionalDependencies) $(QTDIR32)\lib;%(AdditionalLibraryDirectories) X64 /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) MaxSpeed true 3rdParty/GLEW;.;IO/3rdParty/boost;IO/3rdParty/zlib;IO/exception;Basics/;Basics/3rdParty/boost;IO/3rdParty/lzma;IO/3rdParty/lz4;IO/3rdParty/lzham;$(QTDIR64)/include;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;4006;%(DisableSpecificWarnings) glu32.lib;%(AdditionalDependencies) $(QTDIR64)\lib;%(AdditionalLibraryDirectories) X64 /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) MaxSpeed true 3rdParty/GLEW;.;IO/3rdParty/boost;IO/3rdParty/zlib;IO/exception;Basics/;Basics/3rdParty/boost;IO/3rdParty/lzma;IO/3rdParty/lz4;IO/3rdParty/lzham;$(QTDIR64)/include;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;TUVOK_NO_QT;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;4006;%(DisableSpecificWarnings) glu32.lib;%(AdditionalDependencies) $(QTDIR64)\lib;%(AdditionalLibraryDirectories) Disabled 3rdParty/GLEW;.;IO/3rdParty/boost;IO/3rdParty/zlib;IO/exception;Basics/;Basics/3rdParty/boost;IO/3rdParty/lzma;IO/3rdParty/lz4;IO/3rdParty/lzham;$(QTDIR32)/include;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_LIB;USE_DIRECTX;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 EditAndContinue 4127;4512;4006;%(DisableSpecificWarnings) glu32.lib;%(AdditionalDependencies) $(QTDIR32)\lib;%(AdditionalLibraryDirectories) X64 Disabled 3rdParty/GLEW;.;IO/3rdParty/boost;IO/3rdParty/zlib;IO/exception;Basics/;Basics/3rdParty/boost;IO/3rdParty/lzma;IO/3rdParty/lz4;IO/3rdParty/lzham;$(QTDIR64)/include;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_LIB;USE_DIRECTX;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 ProgramDatabase 4127;4512;4006;%(DisableSpecificWarnings) glu32.lib;%(AdditionalDependencies) $(QTDIR64)\lib;%(AdditionalLibraryDirectories) /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) MaxSpeed true 3rdParty/GLEW;.;IO/3rdParty/boost;IO/3rdParty/zlib;IO/exception;Basics/;Basics/3rdParty/boost;IO/3rdParty/lzma;IO/3rdParty/lz4;IO/3rdParty/lzham;$(QTDIR32)/include;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_LIB;USE_DIRECTX;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;4006;%(DisableSpecificWarnings) glu32.lib;%(AdditionalDependencies) $(QTDIR32)\lib;%(AdditionalLibraryDirectories) X64 /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) MaxSpeed true 3rdParty/GLEW;.;IO/3rdParty/boost;IO/3rdParty/zlib;IO/exception;Basics/;Basics/3rdParty/boost;IO/3rdParty/lzma;IO/3rdParty/lz4;IO/3rdParty/lzham;$(QTDIR64)/include;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_LIB;USE_DIRECTX;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;4006;%(DisableSpecificWarnings) glu32.lib;%(AdditionalDependencies) $(QTDIR64)\lib;%(AdditionalLibraryDirectories) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4310; 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4115;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267; 4669;%(DisableSpecificWarnings) 4267; 4669;%(DisableSpecificWarnings) 4267; 4669;%(DisableSpecificWarnings) 4267; 4669;%(DisableSpecificWarnings) 4267; 4669;%(DisableSpecificWarnings) 4267; 4669;%(DisableSpecificWarnings) 4267; 4669;%(DisableSpecificWarnings) 4267; 4669;%(DisableSpecificWarnings) 4267; 4669;%(DisableSpecificWarnings) 4267; 4669;%(DisableSpecificWarnings) 4267; 4669;%(DisableSpecificWarnings) 4267; 4669;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4310;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4996;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4267; 4706;%(DisableSpecificWarnings) 4267; 4706;%(DisableSpecificWarnings) 4267; 4706;%(DisableSpecificWarnings) 4267; 4706;%(DisableSpecificWarnings) 4267; 4706;%(DisableSpecificWarnings) 4267; 4706;%(DisableSpecificWarnings) 4267; 4706;%(DisableSpecificWarnings) 4267; 4706;%(DisableSpecificWarnings) 4267; 4706;%(DisableSpecificWarnings) 4267; 4706;%(DisableSpecificWarnings) 4267; 4706;%(DisableSpecificWarnings) 4267; 4706;%(DisableSpecificWarnings) 4267; 4996;4706;%(DisableSpecificWarnings) 4267; 4996;4706;%(DisableSpecificWarnings) 4267; 4996;4706;%(DisableSpecificWarnings) 4267; 4996;4706;%(DisableSpecificWarnings) 4267; 4996;4706;%(DisableSpecificWarnings) 4267; 4996;4706;%(DisableSpecificWarnings) 4267; 4996;4706;%(DisableSpecificWarnings) 4267; 4996;4706;%(DisableSpecificWarnings) 4267; 4996;4706;%(DisableSpecificWarnings) 4267; 4996;4706;%(DisableSpecificWarnings) 4267; 4996;4706;%(DisableSpecificWarnings) 4267; 4996;4706;%(DisableSpecificWarnings) 4267; 4244;%(DisableSpecificWarnings) 4267; 4244;%(DisableSpecificWarnings) 4267; 4244;%(DisableSpecificWarnings) 4267; 4244;%(DisableSpecificWarnings) 4267; 4244;%(DisableSpecificWarnings) 4267; 4244;%(DisableSpecificWarnings) 4267; 4244;%(DisableSpecificWarnings) 4267; 4244;%(DisableSpecificWarnings) 4267; 4244;%(DisableSpecificWarnings) 4267; 4244;%(DisableSpecificWarnings) 4267; 4244;%(DisableSpecificWarnings) 4267; 4244;%(DisableSpecificWarnings) 4267; 4133;4996;%(DisableSpecificWarnings) 4267; 4133;4996;%(DisableSpecificWarnings) 4267; 4133;4996;%(DisableSpecificWarnings) 4267; 4133;4996;%(DisableSpecificWarnings) 4267; 4133;4996;%(DisableSpecificWarnings) 4267; 4133;4996;%(DisableSpecificWarnings) 4267; 4133;4996;%(DisableSpecificWarnings) 4267; 4133;4996;%(DisableSpecificWarnings) 4267; 4133;4996;%(DisableSpecificWarnings) 4267; 4133;4996;%(DisableSpecificWarnings) 4267; 4133;4996;%(DisableSpecificWarnings) 4267; 4133;4996;%(DisableSpecificWarnings) 4267;4334;%(DisableSpecificWarnings) 4267;4334;%(DisableSpecificWarnings) 4267;4334;%(DisableSpecificWarnings) 4267;4334;%(DisableSpecificWarnings) 4267;4334;%(DisableSpecificWarnings) 4267;4334;%(DisableSpecificWarnings) 4267;4334;%(DisableSpecificWarnings) 4267;4334;%(DisableSpecificWarnings) 4267;4334;%(DisableSpecificWarnings) 4267;4334;%(DisableSpecificWarnings) 4267;4334;%(DisableSpecificWarnings) 4267;4334;%(DisableSpecificWarnings) 4267; 4996;%(DisableSpecificWarnings) 4267; 4996;%(DisableSpecificWarnings) 4267; 4996;%(DisableSpecificWarnings) 4267; 4996;%(DisableSpecificWarnings) 4267; 4996;%(DisableSpecificWarnings) 4267; 4996;%(DisableSpecificWarnings) 4267; 4996;%(DisableSpecificWarnings) 4267; 4996;%(DisableSpecificWarnings) 4267; 4996;%(DisableSpecificWarnings) 4267; 4996;%(DisableSpecificWarnings) 4267; 4996;%(DisableSpecificWarnings) 4267; 4996;%(DisableSpecificWarnings) 4244;4305;4706;%(DisableSpecificWarnings) 4244;4305;4706;%(DisableSpecificWarnings) 4244;4305;4706;%(DisableSpecificWarnings) 4244;4305;4706;%(DisableSpecificWarnings) 4244;4305;4706;%(DisableSpecificWarnings) 4244;4305;4706;%(DisableSpecificWarnings) 4244;4305;4706;%(DisableSpecificWarnings) 4244;4305;4706;%(DisableSpecificWarnings) 4244;4305;4706;%(DisableSpecificWarnings) 4244;4305;4706;%(DisableSpecificWarnings) 4244;4305;4706;%(DisableSpecificWarnings) 4244;4305;4706;%(DisableSpecificWarnings) 4996;4244;%(DisableSpecificWarnings) 4996;4244;%(DisableSpecificWarnings) 4996;4244;%(DisableSpecificWarnings) 4996;4244;%(DisableSpecificWarnings) 4996;4244;%(DisableSpecificWarnings) 4996;4244;%(DisableSpecificWarnings) 4996;4244;%(DisableSpecificWarnings) 4996;4244;%(DisableSpecificWarnings) 4996;4244;%(DisableSpecificWarnings) 4996;4244;%(DisableSpecificWarnings) 4996;4244;%(DisableSpecificWarnings) 4996;4244;%(DisableSpecificWarnings) 4267;4100;%(DisableSpecificWarnings) 4267;4100;%(DisableSpecificWarnings) 4267;4100;%(DisableSpecificWarnings) 4267;4100;%(DisableSpecificWarnings) 4267;4100;%(DisableSpecificWarnings) 4267;4100;%(DisableSpecificWarnings) 4267;4100;%(DisableSpecificWarnings) 4267;4100;%(DisableSpecificWarnings) 4267;4100;%(DisableSpecificWarnings) 4267;4100;%(DisableSpecificWarnings) 4267;4100;%(DisableSpecificWarnings) 4267;4100;%(DisableSpecificWarnings) 4244;4100;%(DisableSpecificWarnings) 4244;4100;%(DisableSpecificWarnings) 4244;4100;%(DisableSpecificWarnings) 4244;4100;%(DisableSpecificWarnings) 4244;4100;%(DisableSpecificWarnings) 4244;4100;%(DisableSpecificWarnings) 4244;4100;%(DisableSpecificWarnings) 4244;4100;%(DisableSpecificWarnings) 4244;4100;%(DisableSpecificWarnings) 4244;4100;%(DisableSpecificWarnings) 4244;4100;%(DisableSpecificWarnings) 4244;4100;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4267;4996;%(DisableSpecificWarnings) 4244; 4706;%(DisableSpecificWarnings) 4244; 4706;%(DisableSpecificWarnings) 4244; 4706;%(DisableSpecificWarnings) 4244; 4706;%(DisableSpecificWarnings) 4244; 4706;%(DisableSpecificWarnings) 4244; 4706;%(DisableSpecificWarnings) 4244; 4706;%(DisableSpecificWarnings) 4244; 4706;%(DisableSpecificWarnings) 4244; 4706;%(DisableSpecificWarnings) 4244; 4706;%(DisableSpecificWarnings) 4244; 4706;%(DisableSpecificWarnings) 4244; 4706;%(DisableSpecificWarnings) 4244; 4267;4100;%(DisableSpecificWarnings) 4244; 4267;4100;%(DisableSpecificWarnings) 4244; 4267;4100;%(DisableSpecificWarnings) 4244; 4267;4100;%(DisableSpecificWarnings) 4244; 4267;4100;%(DisableSpecificWarnings) 4244; 4267;4100;%(DisableSpecificWarnings) 4244; 4267;4100;%(DisableSpecificWarnings) 4244; 4267;4100;%(DisableSpecificWarnings) 4244; 4267;4100;%(DisableSpecificWarnings) 4244; 4267;4100;%(DisableSpecificWarnings) 4244; 4267;4100;%(DisableSpecificWarnings) 4244; 4267;4100;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4267;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;%(DisableSpecificWarnings) 4100;4244;4267;4663;4996;%(DisableSpecificWarnings) 4100;4244;4267;4663;4996;%(DisableSpecificWarnings) 4100;4244;4267;4663;4996;%(DisableSpecificWarnings) 4100;4244;4267;4663;4996;%(DisableSpecificWarnings) 4100;4244;4267;4663;4996;%(DisableSpecificWarnings) 4100;4244;4267;4663;4996;%(DisableSpecificWarnings) 4100;4244;4267;4663;4996;%(DisableSpecificWarnings) 4100;4244;4267;4663;4996;%(DisableSpecificWarnings) 4100;4244;4267;4663;4996;%(DisableSpecificWarnings) 4100;4244;4267;4663;4996;%(DisableSpecificWarnings) 4100;4244;4267;4663;4996;%(DisableSpecificWarnings) 4100;4244;4267;4663;4996;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) 4244;%(DisableSpecificWarnings) ImageVis3D-3.1.0/Tuvok/README.md0000644000175000017500000000004512320456500015643 0ustar mathieumathieuTuvok ===== Renderer for ImageVis3D ImageVis3D-3.1.0/Tuvok/StdTuvokDefines.h0000644000175000017500000000511212320456500017616 0ustar mathieumathieu/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** \file StdTuvokDefines.h \author Jens Krueger SCI Institute University of Utah \date December 2008 */ #pragma once #ifndef STDTUVOKDEFINES_H #define STDTUVOKDEFINES_H // To compile Tuvok without the Qt dependency // enable the following macro. Be aware that // for use in ImageVis3D Qt in Tuvok is required // #define TUVOK_NO_QT 1 // CRT's memory leak detection on windows. // only makes sense with TUVOK_NO_QT enabled // as otherwise Qt will trigger the memleak detection #ifdef TUVOK_NO_QT /* #ifdef _WIN32 #if defined(DEBUG) || defined(_DEBUG) #define _CRTDBG_MAP_ALLOC #include #include #ifndef DBG_NEW #define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ ) #define new DBG_NEW #endif #endif #endif */ #endif #include "Basics/StdDefines.h" // Make sure windows doesn't give us stupid macros. #define NOMINMAX #define BOOST_FILESYSTEM_STATIC_LINK 1 #ifdef __cplusplus # include #else # include #endif #define TUVOK_MAJOR 3 #define TUVOK_MINOR 1 #define TUVOK_PATCH 0 #define TUVOK_VERSION "3.1.0" #define TUVOK_VERSION_TYPE "Release Build" #ifdef _MSC_VER # define _func_ __FUNCTION__ #elif defined(__GNUC__) # define _func_ __func__ #else # warning "unknown compiler!" # define _func_ "???" #endif #endif // STDTUVOKDEFINES_H ImageVis3D-3.1.0/.gitmodules0000644000175000017500000000012312320517543015433 0ustar mathieumathieu[submodule "Tuvok"] path = Tuvok url = https://github.com/SCIInstitute/Tuvok.git ImageVis3D-3.1.0/ImageVis3D-2010.sln0000644000175000017500000001770512320517543016265 0ustar mathieumathieu Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageVis3D", "ImageVis3D\ImageVis3D.vcxproj", "{85742DE8-68C9-4140-A6A7-412CF789DECA}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tuvok", "Tuvok\Tuvok.vcxproj", "{D474A1E1-2ED3-42E6-826C-372430E549B9}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TuvokConverter", "CmdLineConverter\TuvokConverter.vcxproj", "{3D1630AA-C160-493B-88F2-E29AB13AF140}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExtractDebugInfo", "ExtractDebugInfo\ExtractDebugInfo.vcxproj", "{5494E269-CBE9-443E-9C3D-997B141FDDC7}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TuvokReader", "UVFReader\TuvokReader.vcxproj", "{741CA829-A68D-4CAC-844A-E23FFDC94323}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug (with DirectX)|Win32 = Debug (with DirectX)|Win32 Debug (with DirectX)|x64 = Debug (with DirectX)|x64 Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release (with DirectX)|Win32 = Release (with DirectX)|Win32 Release (with DirectX)|x64 = Release (with DirectX)|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {85742DE8-68C9-4140-A6A7-412CF789DECA}.Debug (with DirectX)|Win32.ActiveCfg = Debug (with DirectX)|Win32 {85742DE8-68C9-4140-A6A7-412CF789DECA}.Debug (with DirectX)|Win32.Build.0 = Debug (with DirectX)|Win32 {85742DE8-68C9-4140-A6A7-412CF789DECA}.Debug (with DirectX)|x64.ActiveCfg = Debug (with DirectX)|x64 {85742DE8-68C9-4140-A6A7-412CF789DECA}.Debug (with DirectX)|x64.Build.0 = Debug (with DirectX)|x64 {85742DE8-68C9-4140-A6A7-412CF789DECA}.Debug|Win32.ActiveCfg = Debug|Win32 {85742DE8-68C9-4140-A6A7-412CF789DECA}.Debug|Win32.Build.0 = Debug|Win32 {85742DE8-68C9-4140-A6A7-412CF789DECA}.Debug|x64.ActiveCfg = Debug|x64 {85742DE8-68C9-4140-A6A7-412CF789DECA}.Debug|x64.Build.0 = Debug|x64 {85742DE8-68C9-4140-A6A7-412CF789DECA}.Release (with DirectX)|Win32.ActiveCfg = Release (with DirectX)|Win32 {85742DE8-68C9-4140-A6A7-412CF789DECA}.Release (with DirectX)|Win32.Build.0 = Release (with DirectX)|Win32 {85742DE8-68C9-4140-A6A7-412CF789DECA}.Release (with DirectX)|x64.ActiveCfg = Release (with DirectX)|x64 {85742DE8-68C9-4140-A6A7-412CF789DECA}.Release (with DirectX)|x64.Build.0 = Release (with DirectX)|x64 {85742DE8-68C9-4140-A6A7-412CF789DECA}.Release|Win32.ActiveCfg = Release|Win32 {85742DE8-68C9-4140-A6A7-412CF789DECA}.Release|Win32.Build.0 = Release|Win32 {85742DE8-68C9-4140-A6A7-412CF789DECA}.Release|x64.ActiveCfg = Release|x64 {85742DE8-68C9-4140-A6A7-412CF789DECA}.Release|x64.Build.0 = Release|x64 {D474A1E1-2ED3-42E6-826C-372430E549B9}.Debug (with DirectX)|Win32.ActiveCfg = Debug (with DirectX)|Win32 {D474A1E1-2ED3-42E6-826C-372430E549B9}.Debug (with DirectX)|Win32.Build.0 = Debug (with DirectX)|Win32 {D474A1E1-2ED3-42E6-826C-372430E549B9}.Debug (with DirectX)|x64.ActiveCfg = Debug (with DirectX)|x64 {D474A1E1-2ED3-42E6-826C-372430E549B9}.Debug (with DirectX)|x64.Build.0 = Debug (with DirectX)|x64 {D474A1E1-2ED3-42E6-826C-372430E549B9}.Debug|Win32.ActiveCfg = Debug|Win32 {D474A1E1-2ED3-42E6-826C-372430E549B9}.Debug|Win32.Build.0 = Debug|Win32 {D474A1E1-2ED3-42E6-826C-372430E549B9}.Debug|x64.ActiveCfg = Debug|x64 {D474A1E1-2ED3-42E6-826C-372430E549B9}.Debug|x64.Build.0 = Debug|x64 {D474A1E1-2ED3-42E6-826C-372430E549B9}.Release (with DirectX)|Win32.ActiveCfg = Release (with DirectX)|Win32 {D474A1E1-2ED3-42E6-826C-372430E549B9}.Release (with DirectX)|Win32.Build.0 = Release (with DirectX)|Win32 {D474A1E1-2ED3-42E6-826C-372430E549B9}.Release (with DirectX)|x64.ActiveCfg = Release (with DirectX)|x64 {D474A1E1-2ED3-42E6-826C-372430E549B9}.Release (with DirectX)|x64.Build.0 = Release (with DirectX)|x64 {D474A1E1-2ED3-42E6-826C-372430E549B9}.Release|Win32.ActiveCfg = Release|Win32 {D474A1E1-2ED3-42E6-826C-372430E549B9}.Release|Win32.Build.0 = Release|Win32 {D474A1E1-2ED3-42E6-826C-372430E549B9}.Release|x64.ActiveCfg = Release|x64 {D474A1E1-2ED3-42E6-826C-372430E549B9}.Release|x64.Build.0 = Release|x64 {3D1630AA-C160-493B-88F2-E29AB13AF140}.Debug (with DirectX)|Win32.ActiveCfg = Debug (with DirectX)|Win32 {3D1630AA-C160-493B-88F2-E29AB13AF140}.Debug (with DirectX)|Win32.Build.0 = Debug (with DirectX)|Win32 {3D1630AA-C160-493B-88F2-E29AB13AF140}.Debug (with DirectX)|x64.ActiveCfg = Debug (with DirectX)|x64 {3D1630AA-C160-493B-88F2-E29AB13AF140}.Debug (with DirectX)|x64.Build.0 = Debug (with DirectX)|x64 {3D1630AA-C160-493B-88F2-E29AB13AF140}.Debug|Win32.ActiveCfg = Debug|Win32 {3D1630AA-C160-493B-88F2-E29AB13AF140}.Debug|Win32.Build.0 = Debug|Win32 {3D1630AA-C160-493B-88F2-E29AB13AF140}.Debug|x64.ActiveCfg = Debug|x64 {3D1630AA-C160-493B-88F2-E29AB13AF140}.Debug|x64.Build.0 = Debug|x64 {3D1630AA-C160-493B-88F2-E29AB13AF140}.Release (with DirectX)|Win32.ActiveCfg = Release (with DirectX)|Win32 {3D1630AA-C160-493B-88F2-E29AB13AF140}.Release (with DirectX)|Win32.Build.0 = Release (with DirectX)|Win32 {3D1630AA-C160-493B-88F2-E29AB13AF140}.Release (with DirectX)|x64.ActiveCfg = Release (with DirectX)|x64 {3D1630AA-C160-493B-88F2-E29AB13AF140}.Release (with DirectX)|x64.Build.0 = Release (with DirectX)|x64 {3D1630AA-C160-493B-88F2-E29AB13AF140}.Release|Win32.ActiveCfg = Release|Win32 {3D1630AA-C160-493B-88F2-E29AB13AF140}.Release|Win32.Build.0 = Release|Win32 {3D1630AA-C160-493B-88F2-E29AB13AF140}.Release|x64.ActiveCfg = Release|x64 {3D1630AA-C160-493B-88F2-E29AB13AF140}.Release|x64.Build.0 = Release|x64 {5494E269-CBE9-443E-9C3D-997B141FDDC7}.Debug (with DirectX)|Win32.ActiveCfg = Debug (with DirectX)|Win32 {5494E269-CBE9-443E-9C3D-997B141FDDC7}.Debug (with DirectX)|x64.ActiveCfg = Debug (with DirectX)|x64 {5494E269-CBE9-443E-9C3D-997B141FDDC7}.Debug|Win32.ActiveCfg = Debug|Win32 {5494E269-CBE9-443E-9C3D-997B141FDDC7}.Debug|x64.ActiveCfg = Debug|x64 {5494E269-CBE9-443E-9C3D-997B141FDDC7}.Release (with DirectX)|Win32.ActiveCfg = Release (with DirectX)|Win32 {5494E269-CBE9-443E-9C3D-997B141FDDC7}.Release (with DirectX)|x64.ActiveCfg = Release (with DirectX)|x64 {5494E269-CBE9-443E-9C3D-997B141FDDC7}.Release|Win32.ActiveCfg = Release|Win32 {5494E269-CBE9-443E-9C3D-997B141FDDC7}.Release|x64.ActiveCfg = Release|x64 {741CA829-A68D-4CAC-844A-E23FFDC94323}.Debug (with DirectX)|Win32.ActiveCfg = Debug (with DirectX)|Win32 {741CA829-A68D-4CAC-844A-E23FFDC94323}.Debug (with DirectX)|Win32.Build.0 = Debug (with DirectX)|Win32 {741CA829-A68D-4CAC-844A-E23FFDC94323}.Debug (with DirectX)|x64.ActiveCfg = Debug (with DirectX)|x64 {741CA829-A68D-4CAC-844A-E23FFDC94323}.Debug (with DirectX)|x64.Build.0 = Debug (with DirectX)|x64 {741CA829-A68D-4CAC-844A-E23FFDC94323}.Debug|Win32.ActiveCfg = Debug|Win32 {741CA829-A68D-4CAC-844A-E23FFDC94323}.Debug|Win32.Build.0 = Debug|Win32 {741CA829-A68D-4CAC-844A-E23FFDC94323}.Debug|x64.ActiveCfg = Debug|x64 {741CA829-A68D-4CAC-844A-E23FFDC94323}.Debug|x64.Build.0 = Debug|x64 {741CA829-A68D-4CAC-844A-E23FFDC94323}.Release (with DirectX)|Win32.ActiveCfg = Release (with DirectX)|Win32 {741CA829-A68D-4CAC-844A-E23FFDC94323}.Release (with DirectX)|Win32.Build.0 = Release (with DirectX)|Win32 {741CA829-A68D-4CAC-844A-E23FFDC94323}.Release (with DirectX)|x64.ActiveCfg = Release (with DirectX)|x64 {741CA829-A68D-4CAC-844A-E23FFDC94323}.Release (with DirectX)|x64.Build.0 = Release (with DirectX)|x64 {741CA829-A68D-4CAC-844A-E23FFDC94323}.Release|Win32.ActiveCfg = Release|Win32 {741CA829-A68D-4CAC-844A-E23FFDC94323}.Release|Win32.Build.0 = Release|Win32 {741CA829-A68D-4CAC-844A-E23FFDC94323}.Release|x64.ActiveCfg = Release|x64 {741CA829-A68D-4CAC-844A-E23FFDC94323}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal ImageVis3D-3.1.0/LICENSE0000644000175000017500000000564712320517543014303 0ustar mathieumathieuFor more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008-2014 Scientific Computing and Imaging Institute, University of Utah & High Performance Computing Group at the University of Duisburg-Essen, Germany Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Additionally, this program utilizes code from the Qt software package. Qt may be downloaded at: http://www.qtsoftware.com/. You may also contact the ImageVis3D team on the `iv3d-users@sci.utah.edu' mailing list to request the Qt package in source form. Hilbert Curve implementation copyright 1998, Rice University. LZ4 - Fast LZ compression algorithm Copyright (C) 2011-2012, Yann Collet. BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.ImageVis3D-3.1.0/pre-commit.sh0000755000175000017500000000115212320517543015674 0ustar mathieumathieu#!/bin/sh # See: http://longair.net/blog/2011/04/09/missing-git-hooks-documentation/ # Check to see if there are any modifications in the ./Tuvok directory. unset GIT_DIR unset GIT_INDEX_FILE CHANGES=`git --git-dir=Tuvok/.git --work-tree=Tuvok status --porcelain` if [ "$CHANGES" == "" ]; then exit 0 else echo "[POLICY] You cannot make changes to Tuvok in the ImageVis3D repo.\n" echo "Please clone Tuvok separately, make your changes, then update\nthe Tuvok submodule in ImageVis3D. To update the submodule,\nuse 'git checkout master' followed by 'git pull' in the Tuvok\nsubmodule directory." exit 1 fi ImageVis3D-3.1.0/ui_files.rules0000644000175000017500000000200512320517543016132 0ustar mathieumathieu ImageVis3D-3.1.0/IV3D.plist0000644000175000017500000000136512320517543015051 0ustar mathieumathieu CFBundleIconFile ImageVis3D.icns CFBundlePackageType APPL CFBundleGetInfoString Scientific Computing and Imaging Institute University of Utah 72 S Central Campus Drive 3750 WEB Salt Lake City, UT 84112 USA CFBundleShortVersionString VERSION CFBundleSignature IV3D CFBundleExecutable ImageVis3D NOTE Please, do NOT change this file -- It was generated by Qt/QMake. ImageVis3D-3.1.0/ImageVis3D.pro0000644000175000017500000000050212320517543015674 0ustar mathieumathieu###################################################################### # Generated by Jens Krueger ###################################################################### SUBDIRS = Tuvok ImageVis3D CmdLineConverter ExtractDebugInfo UVFReader BatchRenderer TEMPLATE = subdirs CONFIG += ordered ImageVis3D-3.1.0/StandaloneTuvok/0000755000175000017500000000000012320517543016403 5ustar mathieumathieuImageVis3D-3.1.0/StandaloneTuvok/StandaloneTuvok.sln0000644000175000017500000000234212320517543022243 0ustar mathieumathieu Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StandaloneTuvok", "StandaloneTuvok.vcxproj", "{D1D7C8D7-C8E8-4A36-A049-FFBDEB742875}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {D1D7C8D7-C8E8-4A36-A049-FFBDEB742875}.Debug|Win32.ActiveCfg = Debug|Win32 {D1D7C8D7-C8E8-4A36-A049-FFBDEB742875}.Debug|Win32.Build.0 = Debug|Win32 {D1D7C8D7-C8E8-4A36-A049-FFBDEB742875}.Debug|x64.ActiveCfg = Debug|x64 {D1D7C8D7-C8E8-4A36-A049-FFBDEB742875}.Debug|x64.Build.0 = Debug|x64 {D1D7C8D7-C8E8-4A36-A049-FFBDEB742875}.Release|Win32.ActiveCfg = Release|Win32 {D1D7C8D7-C8E8-4A36-A049-FFBDEB742875}.Release|Win32.Build.0 = Release|Win32 {D1D7C8D7-C8E8-4A36-A049-FFBDEB742875}.Release|x64.ActiveCfg = Release|x64 {D1D7C8D7-C8E8-4A36-A049-FFBDEB742875}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal ImageVis3D-3.1.0/StandaloneTuvok/StandaloneTuvok.vcxproj0000644000175000017500000003175512320517543023154 0ustar mathieumathieu Debug Win32 Debug x64 Release Win32 Release x64 {D1D7C8D7-C8E8-4A36-A049-FFBDEB742875} StandaloneTuvok Win32Proj Application Unicode true Application Unicode Application Unicode true Application Unicode <_ProjectFileVersion>10.0.40219.1 $(SolutionDir)$(Configuration)\ $(Configuration)\ true $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true $(SolutionDir)$(Configuration)\ $(Configuration)\ false $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset Disabled ../Tuvok;../Tuvok/Basics/3rdParty;../Tuvok/3rdParty/GLEW;../Tuvok/IO/3rdParty/boost;../Tuvok/Basics/3rdParty/boost;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;TUVOK_NO_QT;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level3 EditAndContinue Tuvok.lib;opengl32.lib;glu32.lib;gdi32.lib;user32.lib;shlwapi.lib;%(AdditionalDependencies) ..\Tuvok\Build\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) true Console MachineX86 X64 Disabled ../Tuvok;../Tuvok/Basics/3rdParty;../Tuvok/3rdParty/GLEW;../Tuvok/IO/3rdParty/boost;../Tuvok/Basics/3rdParty/boost;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;TUVOK_NO_QT;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level3 ProgramDatabase Tuvok.lib;opengl32.lib;glu32.lib;gdi32.lib;user32.lib;shlwapi.lib;%(AdditionalDependencies) ..\Tuvok\Build\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) true Console MachineX64 MaxSpeed true ../Tuvok;../Tuvok/Basics/3rdParty;../Tuvok/3rdParty/GLEW;../Tuvok/IO/3rdParty/boost;../Tuvok/Basics/3rdParty/boost;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;TUVOK_NO_QT;%(PreprocessorDefinitions) MultiThreadedDLL true Level3 ProgramDatabase Tuvok.lib;opengl32.lib;glu32.lib;gdi32.lib;user32.lib;shlwapi.lib;%(AdditionalDependencies) %(AdditionalLibraryDirectories) true Console true true MachineX86 X64 MaxSpeed true ../Tuvok;../Tuvok/Basics/3rdParty;../Tuvok/3rdParty/GLEW;../Tuvok/IO/3rdParty/boost;../Tuvok/Basics/3rdParty/boost;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;TUVOK_NO_QT;%(PreprocessorDefinitions) MultiThreadedDLL true Level3 ProgramDatabase Tuvok.lib;opengl32.lib;glu32.lib;gdi32.lib;user32.lib;shlwapi.lib;%(AdditionalDependencies) ..\Tuvok\Build\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) true Console true true MachineX64 ImageVis3D-3.1.0/StandaloneTuvok/SmallImage.h0000644000175000017500000000512412320517543020571 0ustar mathieumathieu#ifndef SMALLIMAGE_H #define SMALLIMAGE_H #include "StdTuvokDefines.h" #include #include #include "Basics/Vectors.h" typedef VECTOR3 Color; class SmallImage { public: SmallImage(unsigned int width, unsigned int height, unsigned int iComponentCount); SmallImage(const std::string& filename); virtual ~SmallImage(void); static bool PeekBMPHeader(const std::string& filename, UINTVECTOR2& size, unsigned int& iComponentCount); bool SaveToRAWFile(const std::string& filename) const; bool SaveToBMPFile(const std::string& filename) const; void SetPixel(unsigned int x, unsigned int y, boost::uint8_t r, boost::uint8_t g, boost::uint8_t b, boost::uint8_t a); void SetPixel(unsigned int x, unsigned int y, boost::uint8_t r, boost::uint8_t g, boost::uint8_t b); void SetPixel(unsigned int x, unsigned int y, boost::uint8_t grey); void SetPixel(unsigned int x, unsigned int y, const Color& c); void GetPixel(unsigned int x, unsigned int y, boost::uint8_t& r, boost::uint8_t& g, boost::uint8_t& b, boost::uint8_t& a) const; void GetPixel(unsigned int x, unsigned int y, boost::uint8_t& r, boost::uint8_t& g, boost::uint8_t& b) const; void GetPixel(unsigned int x, unsigned int y, boost::uint8_t& grey) const; void GetPixel(unsigned int x, unsigned int y, Color& c) const; Color GetPixel(unsigned int x, unsigned int y) const; int ComponentCount() const {return m_iComponentCount;} int Height() const {return m_size.y;} int Width() const {return m_size.x;} int Area() const {return m_size.area();} const UINTVECTOR2& GetSize() const {return m_size;} void ForceComponentCount(unsigned int newCompCount, boost::uint8_t padValue=255); void Resample(unsigned int newWidth, unsigned int newHeight, bool bKeepAspect=false); SmallImage* GeneratePreviewImage(unsigned int newWidth, unsigned int newHeight, bool bKeepAspect=false); const boost::uint8_t* GetDataPtr() const { return m_pData;} boost::uint8_t* GetDataPtrRW() { return m_pData;} private: UINTVECTOR2 m_size; unsigned int m_iComponentCount; boost::uint8_t *m_pData; static bool PeekBMPHeader(const std::string& filename, UINTVECTOR2& size, unsigned int& iComponentCount, bool& bUpsideDown, int& iOffsetToData); void InitData(); bool LoadFromBMP(const std::string& filename); size_t OneDIndex(unsigned int x, unsigned int y) const { return size_t(m_iComponentCount*(x+y*m_size.x)); } void Resample(boost::uint8_t* pTarget, unsigned int newWidth, unsigned int newHeight); void AdjustToAspect(unsigned int& newWidth, unsigned int& newHeight); }; #endif // SMALLIMAGE_H ImageVis3D-3.1.0/StandaloneTuvok/StandaloneTuvok.vcxproj.filters0000644000175000017500000000714312320517543024615 0ustar mathieumathieu {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hpp;hxx;hm;inl;inc;xsd {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav {8c5e3a9e-b8ee-42f6-a629-d6495b6612c9} Quelldateien Quelldateien Quelldateien zlib zlib zlib zlib zlib zlib zlib zlib zlib zlib zlib zlib Headerdateien Headerdateien zlib zlib zlib zlib zlib zlib zlib zlib zlib zlib zlib ImageVis3D-3.1.0/StandaloneTuvok/SmallImage.cpp0000644000175000017500000002564712320517543021140 0ustar mathieumathieu#include "SmallImage.h" #include SmallImage::SmallImage(unsigned int width, unsigned int height, unsigned int iComponentCount) : m_size(width, height), m_iComponentCount(iComponentCount), m_pData(0) { InitData(); } SmallImage::SmallImage(const std::string& filename) : m_size(0,0), m_iComponentCount(0), m_pData(0) { LoadFromBMP(filename); } SmallImage::~SmallImage(void) { delete [] m_pData; } void SmallImage::InitData() { m_pData = new boost::uint8_t[m_iComponentCount*m_size.area()]; memset(m_pData,0,m_iComponentCount*m_size.area()); } bool SmallImage::PeekBMPHeader(const std::string& filename, UINTVECTOR2& size, unsigned int& iComponentCount) { bool bUpsideDown; int iOffsetToData; return PeekBMPHeader(filename, size, iComponentCount, bUpsideDown, iOffsetToData); } bool SmallImage::PeekBMPHeader(const std::string& filename, UINTVECTOR2& size, unsigned int& iComponentCount, bool& bUpsideDown, int& iOffsetToData) { std::ifstream inStream(filename.c_str(), std::ofstream::binary); if (inStream.fail()) return false; // check "BM" magic bytes boost::uint16_t bfType; inStream.read((char*)&bfType, 2); if (bfType != 19778) { inStream.close(); return false; } // skip file size and reserved fields of bitmap file header inStream.seekg(8, std::ios_base::cur); // get the position of the actual bitmap data inStream.read((char*)&iOffsetToData, 4); inStream.seekg(4, std::ios_base::cur); // skip size of bitmap info header int w, h; inStream.read((char*)&w, 4); // get the width of the bitmap inStream.read((char*)&h, 4); // get the hight of the bitmap short int biPlanes; inStream.read((char*)&biPlanes, 2); // get the number of planes if (biPlanes != 1) { inStream.close(); return false; } // get the number of bits per pixel boost::uint16_t biBitCount; inStream.read((char*)&biBitCount, 2); // get the number of planes if (biBitCount != 24 && biBitCount != 32) { inStream.close(); return false; } iComponentCount = biBitCount/8; size = UINTVECTOR2(w,abs(h)); bUpsideDown = h < 0; inStream.close(); return true; } bool SmallImage::LoadFromBMP(const std::string& filename) { bool bUpsideDown; int iOffsetToData; if (!PeekBMPHeader(filename, m_size, m_iComponentCount, bUpsideDown, iOffsetToData)) { return false; } // seek to the actual data std::ifstream inStream(filename.c_str(), std::ofstream::binary); if (inStream.fail()) return false; inStream.seekg(iOffsetToData, std::ios_base::beg); delete m_pData; m_pData = new boost::uint8_t[m_iComponentCount*m_size.area()]; int rowPad= 4- (m_size.x*m_iComponentCount)%4; if (rowPad == 4) rowPad = 0; if (rowPad == 0 && bUpsideDown) inStream.read((char*)m_pData, m_iComponentCount*m_size.area()); else { for (unsigned int row = 0; row < m_size.y; row++ ) { int offset = (bUpsideDown ? row : ((m_size.y-1)-row)) * m_iComponentCount*m_size.x; inStream.read((char*)m_pData+offset, m_iComponentCount*m_size.x); if (rowPad > 0) inStream.seekg(rowPad, std::ios_base::cur); } } inStream.close(); // swap red and blue (bgr[a] -> rgb[a]) for (boost::uint32_t i = 0; i < m_size.area()*m_iComponentCount; i += m_iComponentCount) std::swap(m_pData[i], m_pData[i+2]); return true; } bool SmallImage::SaveToRAWFile(const std::string& filename) const { std::ofstream outStream(filename.c_str(), std::ofstream::binary); if (!outStream.is_open()) return false; outStream.write((char*)m_pData, m_iComponentCount*m_size.area()); outStream.close(); return true; } bool SmallImage::SaveToBMPFile(const std::string& filename) const { std::ofstream outStream(filename.c_str(), std::ofstream::binary); if (!outStream.is_open()) return false; int h = m_size.y; int w = m_size.x; // write BMP-Header outStream.write((char*)"BM", 2); // all BMP-Files start with "BM" boost::uint32_t header[3]; int rowPad= 4-((w*8*m_iComponentCount)%32)/8; if (rowPad == 4) rowPad = 0; header[0] = 54+w*h*m_iComponentCount+rowPad*h; // filesize = 54 (header) + sizeX * sizeY * numChannels header[1] = 0; // reserved = 0 (4 Bytes) header[2] = 54; // File offset to Raster Data outStream.write((char*)header, 4*3); // write BMP-Info-Header boost::uint32_t infoHeader[10]; infoHeader[0] = 40; // size of info header infoHeader[1] = w; // Bitmap Width infoHeader[2] = -h; // Bitmap Height (negative to flip image) infoHeader[3] = 1+65536*8*m_iComponentCount; // first 2 bytes=Number of Planes (=1) // next 2 bytes=BPP infoHeader[4] = 0; // compression (0 = none) infoHeader[5] = 0; // compressed file size (0 if no compression) infoHeader[6] = 11810; // horizontal resolution: Pixels/meter (11810 = 300 dpi) infoHeader[7] = 11810; // vertical resolution: Pixels/meter (11810 = 300 dpi) infoHeader[8] = 0; // Number of actually used colors infoHeader[9] = 0; // Number of important colors 0 = all outStream.write((char*)infoHeader, 4*10); // data in BMP is stored BGR, so convert RGB to BGR boost::uint8_t* pData = new boost::uint8_t [m_iComponentCount*m_size.area()]; for (boost::uint32_t i = 0; i < m_iComponentCount*m_size.area(); i+=m_iComponentCount) { pData[i] = m_pData[i+2]; pData[i+1] = m_pData[i+1]; pData[i+2] = m_pData[i]; if (m_iComponentCount==4) pData[i+3] = m_pData[i+3]; } // write data (pad if necessary) if (rowPad==0) { outStream.write((char*)pData, m_iComponentCount*m_size.area()); } else { boost::uint8_t zeroes[9]={0,0,0,0,0,0,0,0,0}; for (int i=0; i float(m_size.x)/float(m_size.y)) { newWidth = (unsigned int)(float(newHeight) * float(m_size.x)/float(m_size.y)); } else { newHeight = (unsigned int)(float(newWidth) * float(m_size.y)/float(m_size.x)); } } void SmallImage::Resample(boost::uint8_t* pTarget, unsigned int newWidth, unsigned int newHeight) { // info: this code is very inneficient but it's easy to read // and this is a SMALL-Image class after all :-) float deltaX = m_size.x / float(newWidth); float deltaY = m_size.y / float(newHeight); boost::uint8_t* targetPtr = pTarget; for (unsigned int y = 0;ym_pData, newWidth, newHeight); return preview; } void SmallImage::ForceComponentCount(unsigned int newCompCount, boost::uint8_t padValue) { if (newCompCount != 3 && newCompCount != 4) return; //unsupported component count if (newCompCount == m_iComponentCount) return; // that was easy :-) boost::uint8_t* pData = new boost::uint8_t [newCompCount*m_size.area()]; boost::uint8_t* targetPtr = pData; boost::uint8_t* sourcePtr = m_pData; if (newCompCount < m_iComponentCount) { for (size_t i = 0;i #include #ifdef DETECTED_OS_WINDOWS #include #endif class GLContext { public: GLContext(UINT32 width, UINT32 height, BYTE colorBits = 32, BYTE depthBits = 24, BYTE stencilBits = 8, bool useDoubleBuffer = true, std::wostream * errorOutput = NULL); ~GLContext(); bool isValid() const { return valid; } bool set(); bool restorePrevious(); bool copyState(const GLContext & fromContext); bool swapBuffers(); private: #ifdef DETECTED_OS_WINDOWS HDC deviceContext, previousDeviceContext; HGLRC renderingContext, previousRenderingContext; HWND window; #else Window window, previousWindow; GLXContext renderingContext, previousRenderingContext; Display * display; #endif bool valid; std::wostream * errorStream; void outputWarning(const std::wstring & warning) const; void outputError(const std::wstring & error) const; void outputLastError() const; }; #endif ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/0000755000175000017500000000000012320517543020113 5ustar mathieumathieuImageVis3D-3.1.0/StandaloneTuvok/3rdParty/crc32.h0000644000175000017500000007355012320517543021212 0ustar mathieumathieu/* crc32.h -- tables for rapid CRC calculation * Generated automatically by crc32.c */ local const unsigned long FAR crc_table[TBLS][256] = { { 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, 0x2d02ef8dUL #ifdef BYFOUR }, { 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, 0x9324fd72UL }, { 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, 0xbe9834edUL }, { 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, 0xde0506f1UL }, { 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, 0x8def022dUL }, { 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, 0x72fd2493UL }, { 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, 0xed3498beUL }, { 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, 0xf10605deUL #endif } }; ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/compress.c0000644000175000017500000000467312320517543022124 0ustar mathieumathieu/* compress.c -- compress a memory buffer * Copyright (C) 1995-2003 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ #define ZLIB_INTERNAL #include "zlib.h" /* =========================================================================== Compresses the source buffer into the destination buffer. The level parameter has the same meaning as in deflateInit. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be at least 0.1% larger than sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, Z_STREAM_ERROR if the level parameter is invalid. */ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) Bytef *dest; uLongf *destLen; const Bytef *source; uLong sourceLen; int level; { z_stream stream; int err; stream.next_in = (Bytef*)source; stream.avail_in = (uInt)sourceLen; #ifdef MAXSEG_64K /* Check for source > 64K on 16-bit machine: */ if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; #endif stream.next_out = dest; stream.avail_out = (uInt)*destLen; if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; stream.zalloc = (alloc_func)0; stream.zfree = (free_func)0; stream.opaque = (voidpf)0; err = deflateInit(&stream, level); if (err != Z_OK) return err; err = deflate(&stream, Z_FINISH); if (err != Z_STREAM_END) { deflateEnd(&stream); return err == Z_OK ? Z_BUF_ERROR : err; } *destLen = stream.total_out; err = deflateEnd(&stream); return err; } /* =========================================================================== */ int Q_ZEXPORT compress (dest, destLen, source, sourceLen) Bytef *dest; uLongf *destLen; const Bytef *source; uLong sourceLen; { return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); } /* =========================================================================== If the default memLevel or windowBits for deflateInit() is changed, then this function needs to be updated. */ uLong ZEXPORT compressBound (sourceLen) uLong sourceLen; { return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11; } ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/inffast.c0000644000175000017500000003043012320517543021711 0ustar mathieumathieu/* inffast.c -- fast decoding * Copyright (C) 1995-2004 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" #include "inftrees.h" #include "inflate.h" #include "inffast.h" #ifndef ASMINF /* Allow machine dependent optimization for post-increment or pre-increment. Based on testing to date, Pre-increment preferred for: - PowerPC G3 (Adler) - MIPS R5000 (Randers-Pehrson) Post-increment preferred for: - none No measurable difference: - Pentium III (Anderson) - M68060 (Nikl) */ #ifdef POSTINC # define OFF 0 # define PUP(a) *(a)++ #else # define OFF 1 # define PUP(a) *++(a) #endif /* Decode literal, length, and distance codes and write out the resulting literal and match bytes until either not enough input or output is available, an end-of-block is encountered, or a data error is encountered. When large enough input and output buffers are supplied to inflate(), for example, a 16K input buffer and a 64K output buffer, more than 95% of the inflate execution time is spent in this routine. Entry assumptions: state->mode == LEN strm->avail_in >= 6 strm->avail_out >= 258 start >= strm->avail_out state->bits < 8 On return, state->mode is one of: LEN -- ran out of enough output space or enough available input TYPE -- reached end of block code, inflate() to interpret next block BAD -- error in block data Notes: - The maximum input bits used by a length/distance pair is 15 bits for the length code, 5 bits for the length extra, 15 bits for the distance code, and 13 bits for the distance extra. This totals 48 bits, or six bytes. Therefore if strm->avail_in >= 6, then there is enough input to avoid checking for available input while decoding. - The maximum bytes that a single length/distance pair can output is 258 bytes, which is the maximum length that can be coded. inflate_fast() requires strm->avail_out >= 258 for each loop to avoid checking for output space. */ void inflate_fast(strm, start) z_streamp strm; unsigned start; /* inflate()'s starting value for strm->avail_out */ { struct inflate_state FAR *state; unsigned char FAR *in; /* local strm->next_in */ unsigned char FAR *last; /* while in < last, enough input available */ unsigned char FAR *out; /* local strm->next_out */ unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ unsigned char FAR *end; /* while out < end, enough space available */ #ifdef INFLATE_STRICT unsigned dmax; /* maximum distance from zlib header */ #endif unsigned wsize; /* window size or zero if not using window */ unsigned whave; /* valid bytes in the window */ unsigned write; /* window write index */ unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ unsigned long hold; /* local strm->hold */ unsigned bits; /* local strm->bits */ code const FAR *lcode; /* local strm->lencode */ code const FAR *dcode; /* local strm->distcode */ unsigned lmask; /* mask for first level of length codes */ unsigned dmask; /* mask for first level of distance codes */ code this; /* retrieved table entry */ unsigned op; /* code bits, operation, extra bits, or */ /* window position, window bytes to copy */ unsigned len; /* match length, unused bytes */ unsigned dist; /* match distance */ unsigned char FAR *from; /* where to copy match from */ /* copy state to local variables */ state = (struct inflate_state FAR *)strm->state; in = strm->next_in - OFF; last = in + (strm->avail_in - 5); out = strm->next_out - OFF; beg = out - (start - strm->avail_out); end = out + (strm->avail_out - 257); #ifdef INFLATE_STRICT dmax = state->dmax; #endif wsize = state->wsize; whave = state->whave; write = state->write; window = state->window; hold = state->hold; bits = state->bits; lcode = state->lencode; dcode = state->distcode; lmask = (1U << state->lenbits) - 1; dmask = (1U << state->distbits) - 1; /* decode literals and length/distances until end-of-block or not enough input data or output space */ do { if (bits < 15) { hold += (unsigned long)(PUP(in)) << bits; bits += 8; hold += (unsigned long)(PUP(in)) << bits; bits += 8; } this = lcode[hold & lmask]; dolen: op = (unsigned)(this.bits); hold >>= op; bits -= op; op = (unsigned)(this.op); if (op == 0) { /* literal */ Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? "inflate: literal '%c'\n" : "inflate: literal 0x%02x\n", this.val)); PUP(out) = (unsigned char)(this.val); } else if (op & 16) { /* length base */ len = (unsigned)(this.val); op &= 15; /* number of extra bits */ if (op) { if (bits < op) { hold += (unsigned long)(PUP(in)) << bits; bits += 8; } len += (unsigned)hold & ((1U << op) - 1); hold >>= op; bits -= op; } Tracevv((stderr, "inflate: length %u\n", len)); if (bits < 15) { hold += (unsigned long)(PUP(in)) << bits; bits += 8; hold += (unsigned long)(PUP(in)) << bits; bits += 8; } this = dcode[hold & dmask]; dodist: op = (unsigned)(this.bits); hold >>= op; bits -= op; op = (unsigned)(this.op); if (op & 16) { /* distance base */ dist = (unsigned)(this.val); op &= 15; /* number of extra bits */ if (bits < op) { hold += (unsigned long)(PUP(in)) << bits; bits += 8; if (bits < op) { hold += (unsigned long)(PUP(in)) << bits; bits += 8; } } dist += (unsigned)hold & ((1U << op) - 1); #ifdef INFLATE_STRICT if (dist > dmax) { strm->msg = (char *)"invalid distance too far back"; state->mode = BAD; break; } #endif hold >>= op; bits -= op; Tracevv((stderr, "inflate: distance %u\n", dist)); op = (unsigned)(out - beg); /* max distance in output */ if (dist > op) { /* see if copy from window */ op = dist - op; /* distance back in window */ if (op > whave) { strm->msg = (char *)"invalid distance too far back"; state->mode = BAD; break; } from = window - OFF; if (write == 0) { /* very common case */ from += wsize - op; if (op < len) { /* some from window */ len -= op; do { PUP(out) = PUP(from); } while (--op); from = out - dist; /* rest from output */ } } else if (write < op) { /* wrap around window */ from += wsize + write - op; op -= write; if (op < len) { /* some from end of window */ len -= op; do { PUP(out) = PUP(from); } while (--op); from = window - OFF; if (write < len) { /* some from start of window */ op = write; len -= op; do { PUP(out) = PUP(from); } while (--op); from = out - dist; /* rest from output */ } } } else { /* contiguous in window */ from += write - op; if (op < len) { /* some from window */ len -= op; do { PUP(out) = PUP(from); } while (--op); from = out - dist; /* rest from output */ } } while (len > 2) { PUP(out) = PUP(from); PUP(out) = PUP(from); PUP(out) = PUP(from); len -= 3; } if (len) { PUP(out) = PUP(from); if (len > 1) PUP(out) = PUP(from); } } else { from = out - dist; /* copy direct from output */ do { /* minimum length is three */ PUP(out) = PUP(from); PUP(out) = PUP(from); PUP(out) = PUP(from); len -= 3; } while (len > 2); if (len) { PUP(out) = PUP(from); if (len > 1) PUP(out) = PUP(from); } } } else if ((op & 64) == 0) { /* 2nd level distance code */ this = dcode[this.val + (hold & ((1U << op) - 1))]; goto dodist; } else { strm->msg = (char *)"invalid distance code"; state->mode = BAD; break; } } else if ((op & 64) == 0) { /* 2nd level length code */ this = lcode[this.val + (hold & ((1U << op) - 1))]; goto dolen; } else if (op & 32) { /* end-of-block */ Tracevv((stderr, "inflate: end of block\n")); state->mode = TYPE; break; } else { strm->msg = (char *)"invalid literal/length code"; state->mode = BAD; break; } } while (in < last && out < end); /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ len = bits >> 3; in -= len; bits -= len << 3; hold &= (1U << bits) - 1; /* update state and return */ strm->next_in = in + OFF; strm->next_out = out + OFF; strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); strm->avail_out = (unsigned)(out < end ? 257 + (end - out) : 257 - (out - end)); state->hold = hold; state->bits = bits; return; } /* inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): - Using bit fields for code structure - Different op definition to avoid & for extra bits (do & for table bits) - Three separate decoding do-loops for direct, window, and write == 0 - Special case for distance > 1 copies to do overlapped load and store copy - Explicit branch predictions (based on measured branch probabilities) - Deferring match copy and interspersed it with decoding subsequent codes - Swapping literal/length else - Swapping window/direct else - Larger unrolled copy loops (three is about right) - Moving len -= 3 statement into middle of loop */ #endif /* !ASMINF */ ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/zutil.h0000644000175000017500000001531312320517543021436 0ustar mathieumathieu/* zutil.h -- internal interface and configuration of the compression library * Copyright (C) 1995-2005 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ /* @(#) $Id$ */ #ifndef ZUTIL_H #define ZUTIL_H #define ZLIB_INTERNAL #include "zlib.h" #ifdef STDC # ifndef _WIN32_WCE # include # endif # include # include #endif #ifdef NO_ERRNO_H # ifdef _WIN32_WCE /* The Microsoft C Run-Time Library for Windows CE doesn't have * errno. We define it as a global variable to simplify porting. * Its value is always 0 and should not be used. We rename it to * avoid conflict with other libraries that use the same workaround. */ # define errno z_errno # endif extern int errno; #else # ifndef _WIN32_WCE # include # endif #endif #ifndef local # define local static #endif /* compile with -Dlocal if your debugger can't find static symbols */ typedef unsigned char uch; typedef uch FAR uchf; typedef unsigned short ush; typedef ush FAR ushf; typedef unsigned long ulg; extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] #define ERR_RETURN(strm,err) \ return (strm->msg = (char*)ERR_MSG(err), (err)) /* To be used only when the state is known to be valid */ /* common constants */ #ifndef DEF_WBITS # define DEF_WBITS MAX_WBITS #endif /* default windowBits for decompression. MAX_WBITS is for compression only */ #if MAX_MEM_LEVEL >= 8 # define DEF_MEM_LEVEL 8 #else # define DEF_MEM_LEVEL MAX_MEM_LEVEL #endif /* default memLevel */ #define STORED_BLOCK 0 #define STATIC_TREES 1 #define DYN_TREES 2 /* The three kinds of block type */ #define MIN_MATCH 3 #define MAX_MATCH 258 /* The minimum and maximum match lengths */ #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ /* target dependencies */ #if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) # define OS_CODE 0x00 # if defined(__TURBOC__) || defined(__BORLANDC__) # if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) /* Allow compilation with ANSI keywords only enabled */ void _Cdecl farfree( void *block ); void *_Cdecl farmalloc( unsigned long nbytes ); # else # include # endif # else /* MSC or DJGPP */ # include # endif #endif #ifdef AMIGA # define OS_CODE 0x01 #endif #if defined(VAXC) || defined(VMS) # define OS_CODE 0x02 # define F_OPEN(name, mode) \ fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") #endif #if defined(ATARI) || defined(atarist) # define OS_CODE 0x05 #endif #ifdef OS2 # define OS_CODE 0x06 # ifdef M_I86 #include # endif #endif #if defined(MACOS) || defined(TARGET_OS_MAC) # define OS_CODE 0x07 # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os # include /* for fdopen */ # else # ifndef fdopen # define fdopen(fd,mode) NULL /* No fdopen() */ # endif # endif #endif #ifdef TOPS20 # define OS_CODE 0x0a #endif #ifdef WIN32 # ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ # define OS_CODE 0x0b # endif #endif #ifdef __50SERIES /* Prime/PRIMOS */ # define OS_CODE 0x0f #endif #if defined(_BEOS_) || defined(RISCOS) # define fdopen(fd,mode) NULL /* No fdopen() */ #endif #if (defined(_MSC_VER) && (_MSC_VER > 600)) # if defined(_WIN32_WCE) # define fdopen(fd,mode) NULL /* No fdopen() */ # ifndef _PTRDIFF_T_DEFINED typedef int ptrdiff_t; # define _PTRDIFF_T_DEFINED # endif # else # define fdopen(fd,type) _fdopen(fd,type) # endif #endif /* common defaults */ #ifndef OS_CODE # define OS_CODE 0x03 /* assume Unix */ #endif #ifndef F_OPEN # define F_OPEN(name, mode) fopen((name), (mode)) #endif /* functions */ #if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) # ifndef HAVE_VSNPRINTF # define HAVE_VSNPRINTF # endif #endif #if defined(__CYGWIN__) # ifndef HAVE_VSNPRINTF # define HAVE_VSNPRINTF # endif #endif #ifndef HAVE_VSNPRINTF # ifdef MSDOS /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), but for now we just assume it doesn't. */ # define NO_vsnprintf # endif # ifdef __TURBOC__ # define NO_vsnprintf # endif # ifdef WIN32 /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ # if !defined(vsnprintf) && !defined(NO_vsnprintf) # define vsnprintf _vsnprintf # endif # endif # ifdef __SASC # define NO_vsnprintf # endif #endif #ifdef VMS # define NO_vsnprintf #endif #if defined(pyr) # define NO_MEMCPY #endif #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) /* Use our own functions for small and medium model with MSC <= 5.0. * You may have to use the same strategy for Borland C (untested). * The __SC__ check is for Symantec. */ # define NO_MEMCPY #endif #if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) # define HAVE_MEMCPY #endif #ifdef HAVE_MEMCPY # ifdef SMALL_MEDIUM /* MSDOS small or medium model */ # define zmemcpy _fmemcpy # define zmemcmp _fmemcmp # define zmemzero(dest, len) _fmemset(dest, 0, len) # else # define zmemcpy memcpy # define zmemcmp memcmp # define zmemzero(dest, len) memset(dest, 0, len) # endif #else extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); extern void zmemzero OF((Bytef* dest, uInt len)); #endif /* Diagnostic functions */ #ifdef DEBUG # include extern int z_verbose; extern void z_error OF((char *m)); # define Assert(cond,msg) {if(!(cond)) z_error(msg);} # define Trace(x) {if (z_verbose>=0) fprintf x ;} # define Tracev(x) {if (z_verbose>0) fprintf x ;} # define Tracevv(x) {if (z_verbose>1) fprintf x ;} # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} #else # define Assert(cond,msg) # define Trace(x) # define Tracev(x) # define Tracevv(x) # define Tracec(c,x) # define Tracecv(c,x) #endif voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); void zcfree OF((voidpf opaque, voidpf ptr)); #define ZALLOC(strm, items, size) \ (*((strm)->zalloc))((strm)->opaque, (items), (size)) #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) #define TRY_FREE(s, p) {if (p) ZFREE(s, p);} #endif /* ZUTIL_H */ ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/inffixed.h0000644000175000017500000001430712320517543022065 0ustar mathieumathieu /* inffixed.h -- table for decoding fixed codes * Generated automatically by makefixed(). */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ static const code lenfix[512] = { {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, {0,9,255} }; static const code distfix[32] = { {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, {22,5,193},{64,5,0} }; ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/deflate.h0000644000175000017500000002752212320517543021700 0ustar mathieumathieu/* deflate.h -- internal compression state * Copyright (C) 1995-2004 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ /* @(#) $Id$ */ #ifndef DEFLATE_H #define DEFLATE_H #include "zutil.h" /* define NO_GZIP when compiling if you want to disable gzip header and trailer creation by deflate(). NO_GZIP would be used to avoid linking in the crc code when it is not needed. For shared libraries, gzip encoding should be left enabled. */ #ifndef NO_GZIP # define GZIP #endif /* =========================================================================== * Internal compression state. */ #define LENGTH_CODES 29 /* number of length codes, not counting the special END_BLOCK code */ #define LITERALS 256 /* number of literal bytes 0..255 */ #define L_CODES (LITERALS+1+LENGTH_CODES) /* number of Literal or Length codes, including the END_BLOCK code */ #define D_CODES 30 /* number of distance codes */ #define BL_CODES 19 /* number of codes used to transfer the bit lengths */ #define HEAP_SIZE (2*L_CODES+1) /* maximum heap size */ #define MAX_BITS 15 /* All codes must not exceed MAX_BITS bits */ #define INIT_STATE 42 #define EXTRA_STATE 69 #define NAME_STATE 73 #define COMMENT_STATE 91 #define HCRC_STATE 103 #define BUSY_STATE 113 #define FINISH_STATE 666 /* Stream status */ /* Data structure describing a single value and its code string. */ typedef struct ct_data_s { union { ush freq; /* frequency count */ ush code; /* bit string */ } fc; union { ush dad; /* father node in Huffman tree */ ush len; /* length of bit string */ } dl; } FAR ct_data; #define Freq fc.freq #define Code fc.code #define Dad dl.dad #define Len dl.len typedef struct static_tree_desc_s static_tree_desc; typedef struct tree_desc_s { ct_data *dyn_tree; /* the dynamic tree */ int max_code; /* largest code with non zero frequency */ static_tree_desc *stat_desc; /* the corresponding static tree */ } FAR tree_desc; typedef ush Pos; typedef Pos FAR Posf; typedef unsigned IPos; /* A Pos is an index in the character window. We use short instead of int to * save space in the various tables. IPos is used only for parameter passing. */ typedef struct internal_state { z_streamp strm; /* pointer back to this zlib stream */ int status; /* as the name implies */ Bytef *pending_buf; /* output still pending */ ulg pending_buf_size; /* size of pending_buf */ Bytef *pending_out; /* next pending byte to output to the stream */ uInt pending; /* nb of bytes in the pending buffer */ int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ gz_headerp gzhead; /* gzip header information to write */ uInt gzindex; /* where in extra, name, or comment */ Byte method; /* STORED (for zip only) or DEFLATED */ int last_flush; /* value of flush param for previous deflate call */ /* used by deflate.c: */ uInt w_size; /* LZ77 window size (32K by default) */ uInt w_bits; /* log2(w_size) (8..16) */ uInt w_mask; /* w_size - 1 */ Bytef *window; /* Sliding window. Input bytes are read into the second half of the window, * and move to the first half later to keep a dictionary of at least wSize * bytes. With this organization, matches are limited to a distance of * wSize-MAX_MATCH bytes, but this ensures that IO is always * performed with a length multiple of the block size. Also, it limits * the window size to 64K, which is quite useful on MSDOS. * To do: use the user input buffer as sliding window. */ ulg window_size; /* Actual size of window: 2*wSize, except when the user input buffer * is directly used as sliding window. */ Posf *prev; /* Link to older string with same hash index. To limit the size of this * array to 64K, this link is maintained only for the last 32K strings. * An index in this array is thus a window index modulo 32K. */ Posf *head; /* Heads of the hash chains or NIL. */ uInt ins_h; /* hash index of string to be inserted */ uInt hash_size; /* number of elements in hash table */ uInt hash_bits; /* log2(hash_size) */ uInt hash_mask; /* hash_size-1 */ uInt hash_shift; /* Number of bits by which ins_h must be shifted at each input * step. It must be such that after MIN_MATCH steps, the oldest * byte no longer takes part in the hash key, that is: * hash_shift * MIN_MATCH >= hash_bits */ long block_start; /* Window position at the beginning of the current output block. Gets * negative when the window is moved backwards. */ uInt match_length; /* length of best match */ IPos prev_match; /* previous match */ int match_available; /* set if previous match exists */ uInt strstart; /* start of string to insert */ uInt match_start; /* start of matching string */ uInt lookahead; /* number of valid bytes ahead in window */ uInt prev_length; /* Length of the best match at previous step. Matches not greater than this * are discarded. This is used in the lazy match evaluation. */ uInt max_chain_length; /* To speed up deflation, hash chains are never searched beyond this * length. A higher limit improves compression ratio but degrades the * speed. */ uInt max_lazy_match; /* Attempt to find a better match only when the current match is strictly * smaller than this value. This mechanism is used only for compression * levels >= 4. */ # define max_insert_length max_lazy_match /* Insert new strings in the hash table only if the match length is not * greater than this length. This saves time but degrades compression. * max_insert_length is used only for compression levels <= 3. */ int level; /* compression level (1..9) */ int strategy; /* favor or force Huffman coding*/ uInt good_match; /* Use a faster search when the previous match is longer than this */ int nice_match; /* Stop searching when current match exceeds this */ /* used by trees.c: */ /* Didn't use ct_data typedef below to supress compiler warning */ struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ struct tree_desc_s l_desc; /* desc. for literal tree */ struct tree_desc_s d_desc; /* desc. for distance tree */ struct tree_desc_s bl_desc; /* desc. for bit length tree */ ush bl_count[MAX_BITS+1]; /* number of codes at each bit length for an optimal tree */ int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ int heap_len; /* number of elements in the heap */ int heap_max; /* element of largest frequency */ /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. * The same heap array is used to build all trees. */ uch depth[2*L_CODES+1]; /* Depth of each subtree used as tie breaker for trees of equal frequency */ uchf *l_buf; /* buffer for literals or lengths */ uInt lit_bufsize; /* Size of match buffer for literals/lengths. There are 4 reasons for * limiting lit_bufsize to 64K: * - frequencies can be kept in 16 bit counters * - if compression is not successful for the first block, all input * data is still in the window so we can still emit a stored block even * when input comes from standard input. (This can also be done for * all blocks if lit_bufsize is not greater than 32K.) * - if compression is not successful for a file smaller than 64K, we can * even emit a stored file instead of a stored block (saving 5 bytes). * This is applicable only for zip (not gzip or zlib). * - creating new Huffman trees less frequently may not provide fast * adaptation to changes in the input data statistics. (Take for * example a binary file with poorly compressible code followed by * a highly compressible string table.) Smaller buffer sizes give * fast adaptation but have of course the overhead of transmitting * trees more frequently. * - I can't count above 4 */ uInt last_lit; /* running index in l_buf */ ushf *d_buf; /* Buffer for distances. To simplify the code, d_buf and l_buf have * the same number of elements. To use different lengths, an extra flag * array would be necessary. */ ulg opt_len; /* bit length of current block with optimal trees */ ulg static_len; /* bit length of current block with static trees */ uInt matches; /* number of string matches in current block */ int last_eob_len; /* bit length of EOB code for last block */ #ifdef DEBUG ulg compressed_len; /* total bit length of compressed file mod 2^32 */ ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ #endif ush bi_buf; /* Output buffer. bits are inserted starting at the bottom (least * significant bits). */ int bi_valid; /* Number of valid bits in bi_buf. All bits above the last valid bit * are always zero. */ } FAR deflate_state; /* Output a byte on the stream. * IN assertion: there is enough room in pending_buf. */ #define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) /* Minimum amount of lookahead, except at the end of the input file. * See deflate.c for comments about the MIN_MATCH+1. */ #define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) /* In order to simplify the code, particularly on 16 bit machines, match * distances are limited to MAX_DIST instead of WSIZE. */ /* in trees.c */ void _tr_init OF((deflate_state *s)); int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len, int eof)); void _tr_align OF((deflate_state *s)); void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, int eof)); #define d_code(dist) \ ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) /* Mapping from a distance to a distance code. dist is the distance - 1 and * must not have side effects. _dist_code[256] and _dist_code[257] are never * used. */ #ifndef DEBUG /* Inline versions of _tr_tally for speed: */ #if defined(GEN_TREES_H) || !defined(STDC) extern uch _length_code[]; extern uch _dist_code[]; #else extern const uch _length_code[]; extern const uch _dist_code[]; #endif # define _tr_tally_lit(s, c, flush) \ { uch cc = (c); \ s->d_buf[s->last_lit] = 0; \ s->l_buf[s->last_lit++] = cc; \ s->dyn_ltree[cc].Freq++; \ flush = (s->last_lit == s->lit_bufsize-1); \ } # define _tr_tally_dist(s, distance, length, flush) \ { uch len = (length); \ ush dist = (distance); \ s->d_buf[s->last_lit] = dist; \ s->l_buf[s->last_lit++] = len; \ dist--; \ s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ s->dyn_dtree[d_code(dist)].Freq++; \ flush = (s->last_lit == s->lit_bufsize-1); \ } #else # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) # define _tr_tally_dist(s, distance, length, flush) \ flush = _tr_tally(s, distance, length) #endif #endif /* DEFLATE_H */ ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/gzio.c0000644000175000017500000007464312320517543021245 0ustar mathieumathieu/* gzio.c -- IO on .gz files * Copyright (C) 1995-2005 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h * * Compile this file with -DNO_GZCOMPRESS to avoid the compression code. */ /* @(#) $Id$ */ #include #include "zutil.h" #ifdef NO_DEFLATE /* for compatibility with old definition */ # define NO_GZCOMPRESS #endif #ifndef NO_DUMMY_DECL struct internal_state {int dummy;}; /* for buggy compilers */ #endif #ifndef Z_BUFSIZE # ifdef MAXSEG_64K # define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */ # else # define Z_BUFSIZE 16384 # endif #endif #ifndef Z_PRINTF_BUFSIZE # define Z_PRINTF_BUFSIZE 4096 #endif #ifdef __MVS__ # pragma map (fdopen , "\174\174FDOPEN") FILE *fdopen(int, const char *); #endif #ifndef STDC extern voidp malloc OF((uInt size)); extern void free OF((voidpf ptr)); #endif #define ALLOC(size) malloc(size) #define TRYFREE(p) {if (p) free(p);} static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ /* gzip flag byte */ #define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ #define HEAD_CRC 0x02 /* bit 1 set: header CRC present */ #define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ #define ORIG_NAME 0x08 /* bit 3 set: original file name present */ #define COMMENT 0x10 /* bit 4 set: file comment present */ #define RESERVED 0xE0 /* bits 5..7: reserved */ typedef struct gz_stream { z_stream stream; int z_err; /* error code for last stream operation */ int z_eof; /* set if end of input file */ FILE *file; /* .gz file */ Byte *inbuf; /* input buffer */ Byte *outbuf; /* output buffer */ uLong crc; /* crc32 of uncompressed data */ char *msg; /* error message */ char *path; /* path name for debugging only */ int transparent; /* 1 if input file is not a .gz file */ char mode; /* 'w' or 'r' */ z_off_t start; /* start of compressed data in file (header skipped) */ z_off_t in; /* bytes into deflate or inflate */ z_off_t out; /* bytes out of deflate or inflate */ int back; /* one character push-back */ int last; /* true if push-back is last character */ } gz_stream; local gzFile gz_open OF((const char *path, const char *mode, int fd)); local int do_flush OF((gzFile file, int flush)); local int get_byte OF((gz_stream *s)); local void check_header OF((gz_stream *s)); local int destroy OF((gz_stream *s)); local void putLong OF((FILE *file, uLong x)); local uLong getLong OF((gz_stream *s)); /* =========================================================================== Opens a gzip (.gz) file for reading or writing. The mode parameter is as in fopen ("rb" or "wb"). The file is given either by file descriptor or path name (if fd == -1). gz_open returns NULL if the file could not be opened or if there was insufficient memory to allocate the (de)compression state; errno can be checked to distinguish the two cases (if errno is zero, the zlib error is Z_MEM_ERROR). */ local gzFile gz_open (path, mode, fd) const char *path; const char *mode; int fd; { int err; int level = Z_DEFAULT_COMPRESSION; /* compression level */ int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */ char *p = (char*)mode; gz_stream *s; char fmode[80]; /* copy of mode, without the compression level */ char *m = fmode; if (!path || !mode) return Z_NULL; s = (gz_stream *)ALLOC(sizeof(gz_stream)); if (!s) return Z_NULL; s->stream.zalloc = (alloc_func)0; s->stream.zfree = (free_func)0; s->stream.opaque = (voidpf)0; s->stream.next_in = s->inbuf = Z_NULL; s->stream.next_out = s->outbuf = Z_NULL; s->stream.avail_in = s->stream.avail_out = 0; s->file = NULL; s->z_err = Z_OK; s->z_eof = 0; s->in = 0; s->out = 0; s->back = EOF; s->crc = crc32(0L, Z_NULL, 0); s->msg = NULL; s->transparent = 0; s->path = (char*)ALLOC(strlen(path)+1); if (s->path == NULL) { return destroy(s), (gzFile)Z_NULL; } strcpy(s->path, path); /* do this early for debugging */ s->mode = '\0'; do { if (*p == 'r') s->mode = 'r'; if (*p == 'w' || *p == 'a') s->mode = 'w'; if (*p >= '0' && *p <= '9') { level = *p - '0'; } else if (*p == 'f') { strategy = Z_FILTERED; } else if (*p == 'h') { strategy = Z_HUFFMAN_ONLY; } else if (*p == 'R') { strategy = Z_RLE; } else { *m++ = *p; /* copy the mode */ } } while (*p++ && m != fmode + sizeof(fmode)); if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL; if (s->mode == 'w') { #ifdef NO_GZCOMPRESS err = Z_STREAM_ERROR; #else err = deflateInit2(&(s->stream), level, Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy); /* windowBits is passed < 0 to suppress zlib header */ s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); #endif if (err != Z_OK || s->outbuf == Z_NULL) { return destroy(s), (gzFile)Z_NULL; } } else { s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); err = inflateInit2(&(s->stream), -MAX_WBITS); /* windowBits is passed < 0 to tell that there is no zlib header. * Note that in this case inflate *requires* an extra "dummy" byte * after the compressed stream in order to complete decompression and * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are * present after the compressed stream. */ if (err != Z_OK || s->inbuf == Z_NULL) { return destroy(s), (gzFile)Z_NULL; } } s->stream.avail_out = Z_BUFSIZE; errno = 0; s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode); if (s->file == NULL) { return destroy(s), (gzFile)Z_NULL; } if (s->mode == 'w') { /* Write a very simple .gz header: */ fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1], Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE); s->start = 10L; /* We use 10L instead of ftell(s->file) to because ftell causes an * fflush on some systems. This version of the library doesn't use * start anyway in write mode, so this initialization is not * necessary. */ } else { check_header(s); /* skip the .gz header */ s->start = ftell(s->file) - s->stream.avail_in; } return (gzFile)s; } /* =========================================================================== Opens a gzip (.gz) file for reading or writing. */ gzFile Q_ZEXPORT gzopen (path, mode) const char *path; const char *mode; { return gz_open (path, mode, -1); } /* =========================================================================== Associate a gzFile with the file descriptor fd. fd is not dup'ed here to mimic the behavio(u)r of fdopen. */ gzFile ZEXPORT gzdopen (fd, mode) int fd; const char *mode; { char name[46]; /* allow for up to 128-bit integers */ if (fd < 0) return (gzFile)Z_NULL; sprintf(name, "", fd); /* for debugging */ return gz_open (name, mode, fd); } /* =========================================================================== * Update the compression level and strategy */ int ZEXPORT gzsetparams (file, level, strategy) gzFile file; int level; int strategy; { gz_stream *s = (gz_stream*)file; if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; /* Make room to allow flushing */ if (s->stream.avail_out == 0) { s->stream.next_out = s->outbuf; if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { s->z_err = Z_ERRNO; } s->stream.avail_out = Z_BUFSIZE; } return deflateParams (&(s->stream), level, strategy); } /* =========================================================================== Read a byte from a gz_stream; update next_in and avail_in. Return EOF for end of file. IN assertion: the stream s has been sucessfully opened for reading. */ local int get_byte(s) gz_stream *s; { if (s->z_eof) return EOF; if (s->stream.avail_in == 0) { errno = 0; s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file); if (s->stream.avail_in == 0) { s->z_eof = 1; if (ferror(s->file)) s->z_err = Z_ERRNO; return EOF; } s->stream.next_in = s->inbuf; } s->stream.avail_in--; return *(s->stream.next_in)++; } /* =========================================================================== Check the gzip header of a gz_stream opened for reading. Set the stream mode to transparent if the gzip magic header is not present; set s->err to Z_DATA_ERROR if the magic header is present but the rest of the header is incorrect. IN assertion: the stream s has already been created sucessfully; s->stream.avail_in is zero for the first time, but may be non-zero for concatenated .gz files. */ local void check_header(s) gz_stream *s; { int method; /* method byte */ int flags; /* flags byte */ uInt len; int c; /* Assure two bytes in the buffer so we can peek ahead -- handle case where first byte of header is at the end of the buffer after the last gzip segment */ len = s->stream.avail_in; if (len < 2) { if (len) s->inbuf[0] = s->stream.next_in[0]; errno = 0; len = (uInt)fread(s->inbuf + len, 1, Z_BUFSIZE >> len, s->file); if (len == 0 && ferror(s->file)) s->z_err = Z_ERRNO; s->stream.avail_in += len; s->stream.next_in = s->inbuf; if (s->stream.avail_in < 2) { s->transparent = s->stream.avail_in; return; } } /* Peek ahead to check the gzip magic header */ if (s->stream.next_in[0] != gz_magic[0] || s->stream.next_in[1] != gz_magic[1]) { s->transparent = 1; return; } s->stream.avail_in -= 2; s->stream.next_in += 2; /* Check the rest of the gzip header */ method = get_byte(s); flags = get_byte(s); if (method != Z_DEFLATED || (flags & RESERVED) != 0) { s->z_err = Z_DATA_ERROR; return; } /* Discard time, xflags and OS code: */ for (len = 0; len < 6; len++) (void)get_byte(s); if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */ len = (uInt)get_byte(s); len += ((uInt)get_byte(s))<<8; /* len is garbage if EOF but the loop below will quit anyway */ while (len-- != 0 && get_byte(s) != EOF) ; } if ((flags & ORIG_NAME) != 0) { /* skip the original file name */ while ((c = get_byte(s)) != 0 && c != EOF) ; } if ((flags & COMMENT) != 0) { /* skip the .gz file comment */ while ((c = get_byte(s)) != 0 && c != EOF) ; } if ((flags & HEAD_CRC) != 0) { /* skip the header crc */ for (len = 0; len < 2; len++) (void)get_byte(s); } s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK; } /* =========================================================================== * Cleanup then free the given gz_stream. Return a zlib error code. Try freeing in the reverse order of allocations. */ local int destroy (s) gz_stream *s; { int err = Z_OK; if (!s) return Z_STREAM_ERROR; TRYFREE(s->msg); if (s->stream.state != NULL) { if (s->mode == 'w') { #ifdef NO_GZCOMPRESS err = Z_STREAM_ERROR; #else err = deflateEnd(&(s->stream)); #endif } else if (s->mode == 'r') { err = inflateEnd(&(s->stream)); } } if (s->file != NULL && fclose(s->file)) { #ifdef ESPIPE if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */ #endif err = Z_ERRNO; } if (s->z_err < 0) err = s->z_err; TRYFREE(s->inbuf); TRYFREE(s->outbuf); TRYFREE(s->path); TRYFREE(s); return err; } /* =========================================================================== Reads the given number of uncompressed bytes from the compressed file. gzread returns the number of bytes actually read (0 for end of file). */ int Q_ZEXPORT gzread (file, buf, len) gzFile file; voidp buf; unsigned len; { gz_stream *s = (gz_stream*)file; Bytef *start = (Bytef*)buf; /* starting point for crc computation */ Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */ if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR; if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1; if (s->z_err == Z_STREAM_END) return 0; /* EOF */ next_out = (Byte*)buf; s->stream.next_out = (Bytef*)buf; s->stream.avail_out = len; if (s->stream.avail_out && s->back != EOF) { *next_out++ = s->back; s->stream.next_out++; s->stream.avail_out--; s->back = EOF; s->out++; start++; if (s->last) { s->z_err = Z_STREAM_END; return 1; } } while (s->stream.avail_out != 0) { if (s->transparent) { /* Copy first the lookahead bytes: */ uInt n = s->stream.avail_in; if (n > s->stream.avail_out) n = s->stream.avail_out; if (n > 0) { zmemcpy(s->stream.next_out, s->stream.next_in, n); next_out += n; s->stream.next_out = next_out; s->stream.next_in += n; s->stream.avail_out -= n; s->stream.avail_in -= n; } if (s->stream.avail_out > 0) { s->stream.avail_out -= (uInt)fread(next_out, 1, s->stream.avail_out, s->file); } len -= s->stream.avail_out; s->in += len; s->out += len; if (len == 0) s->z_eof = 1; return (int)len; } if (s->stream.avail_in == 0 && !s->z_eof) { errno = 0; s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file); if (s->stream.avail_in == 0) { s->z_eof = 1; if (ferror(s->file)) { s->z_err = Z_ERRNO; break; } } s->stream.next_in = s->inbuf; } s->in += s->stream.avail_in; s->out += s->stream.avail_out; s->z_err = inflate(&(s->stream), Z_NO_FLUSH); s->in -= s->stream.avail_in; s->out -= s->stream.avail_out; if (s->z_err == Z_STREAM_END) { /* Check CRC and original size */ s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); start = s->stream.next_out; if (getLong(s) != s->crc) { s->z_err = Z_DATA_ERROR; } else { (void)getLong(s); /* The uncompressed length returned by above getlong() may be * different from s->out in case of concatenated .gz files. * Check for such files: */ check_header(s); if (s->z_err == Z_OK) { inflateReset(&(s->stream)); s->crc = crc32(0L, Z_NULL, 0); } } } if (s->z_err != Z_OK || s->z_eof) break; } s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); if (len == s->stream.avail_out && (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO)) return -1; return (int)(len - s->stream.avail_out); } /* =========================================================================== Reads one byte from the compressed file. gzgetc returns this byte or -1 in case of end of file or error. */ int ZEXPORT gzgetc(file) gzFile file; { unsigned char c; return gzread(file, &c, 1) == 1 ? c : -1; } /* =========================================================================== Push one byte back onto the stream. */ int ZEXPORT gzungetc(c, file) int c; gzFile file; { gz_stream *s = (gz_stream*)file; if (s == NULL || s->mode != 'r' || c == EOF || s->back != EOF) return EOF; s->back = c; s->out--; s->last = (s->z_err == Z_STREAM_END); if (s->last) s->z_err = Z_OK; s->z_eof = 0; return c; } /* =========================================================================== Reads bytes from the compressed file until len-1 characters are read, or a newline character is read and transferred to buf, or an end-of-file condition is encountered. The string is then terminated with a null character. gzgets returns buf, or Z_NULL in case of error. The current implementation is not optimized at all. */ char * ZEXPORT gzgets(file, buf, len) gzFile file; char *buf; int len; { char *b = buf; if (buf == Z_NULL || len <= 0) return Z_NULL; while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ; *buf = '\0'; return b == buf && len > 0 ? Z_NULL : b; } #ifndef NO_GZCOMPRESS /* =========================================================================== Writes the given number of uncompressed bytes into the compressed file. gzwrite returns the number of bytes actually written (0 in case of error). */ int ZEXPORT gzwrite (file, buf, len) gzFile file; voidpc buf; unsigned len; { gz_stream *s = (gz_stream*)file; if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; s->stream.next_in = (Bytef*)buf; s->stream.avail_in = len; while (s->stream.avail_in != 0) { if (s->stream.avail_out == 0) { s->stream.next_out = s->outbuf; if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { s->z_err = Z_ERRNO; break; } s->stream.avail_out = Z_BUFSIZE; } s->in += s->stream.avail_in; s->out += s->stream.avail_out; s->z_err = deflate(&(s->stream), Z_NO_FLUSH); s->in -= s->stream.avail_in; s->out -= s->stream.avail_out; if (s->z_err != Z_OK) break; } s->crc = crc32(s->crc, (const Bytef *)buf, len); return (int)(len - s->stream.avail_in); } /* =========================================================================== Converts, formats, and writes the args to the compressed file under control of the format string, as in fprintf. gzprintf returns the number of uncompressed bytes actually written (0 in case of error). */ #ifdef STDC #include int Q_ZEXPORT gzprintf (gzFile file, const char *format, /* args */ ...) { char buf[Z_PRINTF_BUFSIZE]; va_list va; int len; buf[sizeof(buf) - 1] = 0; va_start(va, format); #ifdef NO_vsnprintf # ifdef HAS_vsprintf_void (void)vsprintf(buf, format, va); va_end(va); for (len = 0; len < sizeof(buf); len++) if (buf[len] == 0) break; # else len = vsprintf(buf, format, va); va_end(va); # endif #else # ifdef HAS_vsnprintf_void (void)vsnprintf(buf, sizeof(buf), format, va); va_end(va); len = strlen(buf); # else len = vsnprintf(buf, sizeof(buf), format, va); va_end(va); # endif #endif if (len <= 0 || len >= (int)sizeof(buf) || buf[sizeof(buf) - 1] != 0) return 0; return gzwrite(file, buf, (unsigned)len); } #else /* not ANSI C */ int Q_ZEXPORT gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) gzFile file; const char *format; int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; { char buf[Z_PRINTF_BUFSIZE]; int len; buf[sizeof(buf) - 1] = 0; #ifdef NO_snprintf # ifdef HAS_sprintf_void sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); for (len = 0; len < sizeof(buf); len++) if (buf[len] == 0) break; # else len = sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); # endif #else # ifdef HAS_snprintf_void snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); len = strlen(buf); # else len = snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); # endif #endif if (len <= 0 || len >= sizeof(buf) || buf[sizeof(buf) - 1] != 0) return 0; return gzwrite(file, buf, len); } #endif /* =========================================================================== Writes c, converted to an unsigned char, into the compressed file. gzputc returns the value that was written, or -1 in case of error. */ int ZEXPORT gzputc(file, c) gzFile file; int c; { unsigned char cc = (unsigned char) c; /* required for big endian systems */ return gzwrite(file, &cc, 1) == 1 ? (int)cc : -1; } /* =========================================================================== Writes the given null-terminated string to the compressed file, excluding the terminating null character. gzputs returns the number of characters written, or -1 in case of error. */ int ZEXPORT gzputs(file, s) gzFile file; const char *s; { return gzwrite(file, (char*)s, (unsigned)strlen(s)); } /* =========================================================================== Flushes all pending output into the compressed file. The parameter flush is as in the deflate() function. */ local int do_flush (file, flush) gzFile file; int flush; { uInt len; int done = 0; gz_stream *s = (gz_stream*)file; if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; s->stream.avail_in = 0; /* should be zero already anyway */ for (;;) { len = Z_BUFSIZE - s->stream.avail_out; if (len != 0) { if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) { s->z_err = Z_ERRNO; return Z_ERRNO; } s->stream.next_out = s->outbuf; s->stream.avail_out = Z_BUFSIZE; } if (done) break; s->out += s->stream.avail_out; s->z_err = deflate(&(s->stream), flush); s->out -= s->stream.avail_out; /* Ignore the second of two consecutive flushes: */ if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK; /* deflate has finished flushing only when it hasn't used up * all the available space in the output buffer: */ done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END); if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break; } return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; } int ZEXPORT gzflush (file, flush) gzFile file; int flush; { gz_stream *s = (gz_stream*)file; int err = do_flush (file, flush); if (err) return err; fflush(s->file); return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; } #endif /* NO_GZCOMPRESS */ /* =========================================================================== Sets the starting position for the next gzread or gzwrite on the given compressed file. The offset represents a number of bytes in the gzseek returns the resulting offset location as measured in bytes from the beginning of the uncompressed stream, or -1 in case of error. SEEK_END is not implemented, returns error. In this version of the library, gzseek can be extremely slow. */ z_off_t ZEXPORT gzseek (file, offset, whence) gzFile file; z_off_t offset; int whence; { gz_stream *s = (gz_stream*)file; if (s == NULL || whence == SEEK_END || s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) { return -1L; } if (s->mode == 'w') { #ifdef NO_GZCOMPRESS return -1L; #else if (whence == SEEK_SET) { offset -= s->in; } if (offset < 0) return -1L; /* At this point, offset is the number of zero bytes to write. */ if (s->inbuf == Z_NULL) { s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */ if (s->inbuf == Z_NULL) return -1L; zmemzero(s->inbuf, Z_BUFSIZE); } while (offset > 0) { uInt size = Z_BUFSIZE; if (offset < Z_BUFSIZE) size = (uInt)offset; size = gzwrite(file, s->inbuf, size); if (size == 0) return -1L; offset -= size; } return s->in; #endif } /* Rest of function is for reading only */ /* compute absolute position */ if (whence == SEEK_CUR) { offset += s->out; } if (offset < 0) return -1L; if (s->transparent) { /* map to fseek */ s->back = EOF; s->stream.avail_in = 0; s->stream.next_in = s->inbuf; if (fseek(s->file, offset, SEEK_SET) < 0) return -1L; s->in = s->out = offset; return offset; } /* For a negative seek, rewind and use positive seek */ if (offset >= s->out) { offset -= s->out; } else if (gzrewind(file) < 0) { return -1L; } /* offset is now the number of bytes to skip. */ if (offset != 0 && s->outbuf == Z_NULL) { s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); if (s->outbuf == Z_NULL) return -1L; } if (offset && s->back != EOF) { s->back = EOF; s->out++; offset--; if (s->last) s->z_err = Z_STREAM_END; } while (offset > 0) { int size = Z_BUFSIZE; if (offset < Z_BUFSIZE) size = (int)offset; size = gzread(file, s->outbuf, (uInt)size); if (size <= 0) return -1L; offset -= size; } return s->out; } /* =========================================================================== Rewinds input file. */ int ZEXPORT gzrewind (file) gzFile file; { gz_stream *s = (gz_stream*)file; if (s == NULL || s->mode != 'r') return -1; s->z_err = Z_OK; s->z_eof = 0; s->back = EOF; s->stream.avail_in = 0; s->stream.next_in = s->inbuf; s->crc = crc32(0L, Z_NULL, 0); if (!s->transparent) (void)inflateReset(&s->stream); s->in = 0; s->out = 0; return fseek(s->file, s->start, SEEK_SET); } /* =========================================================================== Returns the starting position for the next gzread or gzwrite on the given compressed file. This position represents a number of bytes in the uncompressed data stream. */ z_off_t ZEXPORT gztell (file) gzFile file; { return gzseek(file, 0L, SEEK_CUR); } /* =========================================================================== Returns 1 when EOF has previously been detected reading the given input stream, otherwise zero. */ int ZEXPORT gzeof (file) gzFile file; { gz_stream *s = (gz_stream*)file; /* With concatenated compressed files that can have embedded * crc trailers, z_eof is no longer the only/best indicator of EOF * on a gz_stream. Handle end-of-stream error explicitly here. */ if (s == NULL || s->mode != 'r') return 0; if (s->z_eof) return 1; return s->z_err == Z_STREAM_END; } /* =========================================================================== Returns 1 if reading and doing so transparently, otherwise zero. */ int ZEXPORT gzdirect (file) gzFile file; { gz_stream *s = (gz_stream*)file; if (s == NULL || s->mode != 'r') return 0; return s->transparent; } /* =========================================================================== Outputs a long in LSB order to the given file */ local void putLong (file, x) FILE *file; uLong x; { int n; for (n = 0; n < 4; n++) { fputc((int)(x & 0xff), file); x >>= 8; } } /* =========================================================================== Reads a long in LSB order from the given gz_stream. Sets z_err in case of error. */ local uLong getLong (s) gz_stream *s; { uLong x = (uLong)get_byte(s); int c; x += ((uLong)get_byte(s))<<8; x += ((uLong)get_byte(s))<<16; c = get_byte(s); if (c == EOF) s->z_err = Z_DATA_ERROR; x += ((uLong)c)<<24; return x; } /* =========================================================================== Flushes all pending output if necessary, closes the compressed file and deallocates all the (de)compression state. */ int Q_ZEXPORT gzclose (file) gzFile file; { gz_stream *s = (gz_stream*)file; if (s == NULL) return Z_STREAM_ERROR; if (s->mode == 'w') { #ifdef NO_GZCOMPRESS return Z_STREAM_ERROR; #else if (do_flush (file, Z_FINISH) != Z_OK) return destroy((gz_stream*)file); putLong (s->file, s->crc); putLong (s->file, (uLong)(s->in & 0xffffffff)); #endif } return destroy((gz_stream*)file); } #if defined(STDC) && !defined(_WIN32_WCE) # define zstrerror(errnum) strerror(errnum) #else # define zstrerror(errnum) "" #endif /* =========================================================================== Returns the error message for the last error which occurred on the given compressed file. errnum is set to zlib error number. If an error occurred in the file system and not in the compression library, errnum is set to Z_ERRNO and the application may consult errno to get the exact error code. */ const char * ZEXPORT gzerror (file, errnum) gzFile file; int *errnum; { char *m; gz_stream *s = (gz_stream*)file; if (s == NULL) { *errnum = Z_STREAM_ERROR; return (const char*)ERR_MSG(Z_STREAM_ERROR); } *errnum = s->z_err; if (*errnum == Z_OK) return (const char*)""; m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg); if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err); TRYFREE(s->msg); s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3); if (s->msg == Z_NULL) return (const char*)ERR_MSG(Z_MEM_ERROR); strcpy(s->msg, s->path); strcat(s->msg, ": "); strcat(s->msg, m); return (const char*)s->msg; } /* =========================================================================== Clear the error and end-of-file flags, and do the same for the real file. */ void ZEXPORT gzclearerr (file) gzFile file; { gz_stream *s = (gz_stream*)file; if (s == NULL) return; if (s->z_err != Z_STREAM_END) s->z_err = Z_OK; s->z_eof = 0; clearerr(s->file); } ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/deflate.c0000644000175000017500000017524312320517543021677 0ustar mathieumathieu/* deflate.c -- compress data using the deflation algorithm * Copyright (C) 1995-2005 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* * ALGORITHM * * The "deflation" process depends on being able to identify portions * of the input text which are identical to earlier input (within a * sliding window trailing behind the input currently being processed). * * The most straightforward technique turns out to be the fastest for * most input files: try all possible matches and select the longest. * The key feature of this algorithm is that insertions into the string * dictionary are very simple and thus fast, and deletions are avoided * completely. Insertions are performed at each input character, whereas * string matches are performed only when the previous match ends. So it * is preferable to spend more time in matches to allow very fast string * insertions and avoid deletions. The matching algorithm for small * strings is inspired from that of Rabin & Karp. A brute force approach * is used to find longer strings when a small match has been found. * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze * (by Leonid Broukhis). * A previous version of this file used a more sophisticated algorithm * (by Fiala and Greene) which is guaranteed to run in linear amortized * time, but has a larger average cost, uses more memory and is patented. * However the F&G algorithm may be faster for some highly redundant * files if the parameter max_chain_length (described below) is too large. * * ACKNOWLEDGEMENTS * * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and * I found it in 'freeze' written by Leonid Broukhis. * Thanks to many people for bug reports and testing. * * REFERENCES * * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". * Available in http://www.ietf.org/rfc/rfc1951.txt * * A description of the Rabin and Karp algorithm is given in the book * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. * * Fiala,E.R., and Greene,D.H. * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 * */ /* @(#) $Id$ */ #include "deflate.h" const char deflate_copyright[] = " deflate 1.2.3 Copyright 1995-2005 Jean-loup Gailly "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot include such an acknowledgment, I would appreciate that you keep this copyright string in the executable of your product. */ /* =========================================================================== * Function prototypes. */ typedef enum { need_more, /* block not completed, need more input or more output */ block_done, /* block flush performed */ finish_started, /* finish started, need only more output at next deflate */ finish_done /* finish done, accept no more input or output */ } block_state; typedef block_state (*compress_func) OF((deflate_state *s, int flush)); /* Compression function. Returns the block state after the call. */ local void fill_window OF((deflate_state *s)); local block_state deflate_stored OF((deflate_state *s, int flush)); local block_state deflate_fast OF((deflate_state *s, int flush)); #ifndef FASTEST local block_state deflate_slow OF((deflate_state *s, int flush)); #endif local void lm_init OF((deflate_state *s)); local void putShortMSB OF((deflate_state *s, uInt b)); local void flush_pending OF((z_streamp strm)); local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); #ifndef FASTEST #ifdef ASMV void match_init OF((void)); /* asm code initialization */ uInt longest_match OF((deflate_state *s, IPos cur_match)); #else local uInt longest_match OF((deflate_state *s, IPos cur_match)); #endif #endif local uInt longest_match_fast OF((deflate_state *s, IPos cur_match)); #ifdef DEBUG local void check_match OF((deflate_state *s, IPos start, IPos match, int length)); #endif /* =========================================================================== * Local data */ #define NIL 0 /* Tail of hash chains */ #ifndef TOO_FAR # define TOO_FAR 4096 #endif /* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) /* Minimum amount of lookahead, except at the end of the input file. * See deflate.c for comments about the MIN_MATCH+1. */ /* Values for max_lazy_match, good_match and max_chain_length, depending on * the desired pack level (0..9). The values given below have been tuned to * exclude worst case performance for pathological files. Better values may be * found for specific files. */ typedef struct config_s { ush good_length; /* reduce lazy search above this match length */ ush max_lazy; /* do not perform lazy search above this match length */ ush nice_length; /* quit search above this match length */ ush max_chain; compress_func func; } config; #ifdef FASTEST local const config configuration_table[2] = { /* good lazy nice chain */ /* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ /* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */ #else local const config configuration_table[10] = { /* good lazy nice chain */ /* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ /* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ /* 2 */ {4, 5, 16, 8, deflate_fast}, /* 3 */ {4, 6, 32, 32, deflate_fast}, /* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */ /* 5 */ {8, 16, 32, 32, deflate_slow}, /* 6 */ {8, 16, 128, 128, deflate_slow}, /* 7 */ {8, 32, 128, 256, deflate_slow}, /* 8 */ {32, 128, 258, 1024, deflate_slow}, /* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */ #endif /* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 * For deflate_fast() (levels <= 3) good is ignored and lazy has a different * meaning. */ #define EQUAL 0 /* result of memcmp for equal strings */ #ifndef NO_DUMMY_DECL struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ #endif /* =========================================================================== * Update a hash value with the given input byte * IN assertion: all calls to to UPDATE_HASH are made with consecutive * input characters, so that a running hash key can be computed from the * previous key instead of complete recalculation each time. */ #define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) /* =========================================================================== * Insert string str in the dictionary and set match_head to the previous head * of the hash chain (the most recent string with same hash key). Return * the previous length of the hash chain. * If this file is compiled with -DFASTEST, the compression level is forced * to 1, and no hash chains are maintained. * IN assertion: all calls to to INSERT_STRING are made with consecutive * input characters and the first MIN_MATCH bytes of str are valid * (except for the last MIN_MATCH-1 bytes of the input file). */ #ifdef FASTEST #define INSERT_STRING(s, str, match_head) \ (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ match_head = s->head[s->ins_h], \ s->head[s->ins_h] = (Pos)(str)) #else #define INSERT_STRING(s, str, match_head) \ (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ s->head[s->ins_h] = (Pos)(str)) #endif /* =========================================================================== * Initialize the hash table (avoiding 64K overflow for 16 bit systems). * prev[] will be initialized on the fly. */ #define CLEAR_HASH(s) \ s->head[s->hash_size-1] = NIL; \ zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); /* ========================================================================= */ int ZEXPORT deflateInit_(strm, level, version, stream_size) z_streamp strm; int level; const char *version; int stream_size; { return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, version, stream_size); /* To do: ignore strm->next_in if we use it as window */ } /* ========================================================================= */ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, version, stream_size) z_streamp strm; int level; int method; int windowBits; int memLevel; int strategy; const char *version; int stream_size; { deflate_state *s; int wrap = 1; static const char my_version[] = ZLIB_VERSION; ushf *overlay; /* We overlay pending_buf and d_buf+l_buf. This works since the average * output size for (length,distance) codes is <= 24 bits. */ if (version == Z_NULL || version[0] != my_version[0] || stream_size != sizeof(z_stream)) { return Z_VERSION_ERROR; } if (strm == Z_NULL) return Z_STREAM_ERROR; strm->msg = Z_NULL; if (strm->zalloc == (alloc_func)0) { strm->zalloc = zcalloc; strm->opaque = (voidpf)0; } if (strm->zfree == (free_func)0) strm->zfree = zcfree; #ifdef FASTEST if (level != 0) level = 1; #else if (level == Z_DEFAULT_COMPRESSION) level = 6; #endif if (windowBits < 0) { /* suppress zlib wrapper */ wrap = 0; windowBits = -windowBits; } #ifdef GZIP else if (windowBits > 15) { wrap = 2; /* write gzip wrapper instead */ windowBits -= 16; } #endif if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { return Z_STREAM_ERROR; } if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); if (s == Z_NULL) return Z_MEM_ERROR; strm->state = (struct internal_state FAR *)s; s->strm = strm; s->wrap = wrap; s->gzhead = Z_NULL; s->w_bits = windowBits; s->w_size = 1 << s->w_bits; s->w_mask = s->w_size - 1; s->hash_bits = memLevel + 7; s->hash_size = 1 << s->hash_bits; s->hash_mask = s->hash_size - 1; s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); s->pending_buf = (uchf *) overlay; s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || s->pending_buf == Z_NULL) { s->status = FINISH_STATE; strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); deflateEnd (strm); return Z_MEM_ERROR; } s->d_buf = overlay + s->lit_bufsize/sizeof(ush); s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; s->level = level; s->strategy = strategy; s->method = (Byte)method; return deflateReset(strm); } /* ========================================================================= */ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) z_streamp strm; const Bytef *dictionary; uInt dictLength; { deflate_state *s; uInt length = dictLength; uInt n; IPos hash_head = 0; if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL || strm->state->wrap == 2 || (strm->state->wrap == 1 && strm->state->status != INIT_STATE)) return Z_STREAM_ERROR; s = strm->state; if (s->wrap) strm->adler = adler32(strm->adler, dictionary, dictLength); if (length < MIN_MATCH) return Z_OK; if (length > MAX_DIST(s)) { length = MAX_DIST(s); dictionary += dictLength - length; /* use the tail of the dictionary */ } zmemcpy(s->window, dictionary, length); s->strstart = length; s->block_start = (long)length; /* Insert all strings in the hash table (except for the last two bytes). * s->lookahead stays null, so s->ins_h will be recomputed at the next * call of fill_window. */ s->ins_h = s->window[0]; UPDATE_HASH(s, s->ins_h, s->window[1]); for (n = 0; n <= length - MIN_MATCH; n++) { INSERT_STRING(s, n, hash_head); } if (hash_head) hash_head = 0; /* to make compiler happy */ return Z_OK; } /* ========================================================================= */ int ZEXPORT deflateReset (strm) z_streamp strm; { deflate_state *s; if (strm == Z_NULL || strm->state == Z_NULL || strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { return Z_STREAM_ERROR; } strm->total_in = strm->total_out = 0; strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ strm->data_type = Z_UNKNOWN; s = (deflate_state *)strm->state; s->pending = 0; s->pending_out = s->pending_buf; if (s->wrap < 0) { s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ } s->status = s->wrap ? INIT_STATE : BUSY_STATE; strm->adler = #ifdef GZIP s->wrap == 2 ? crc32(0L, Z_NULL, 0) : #endif adler32(0L, Z_NULL, 0); s->last_flush = Z_NO_FLUSH; _tr_init(s); lm_init(s); return Z_OK; } /* ========================================================================= */ int ZEXPORT deflateSetHeader (strm, head) z_streamp strm; gz_headerp head; { if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; if (strm->state->wrap != 2) return Z_STREAM_ERROR; strm->state->gzhead = head; return Z_OK; } /* ========================================================================= */ int ZEXPORT deflatePrime (strm, bits, value) z_streamp strm; int bits; int value; { if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; strm->state->bi_valid = bits; strm->state->bi_buf = (ush)(value & ((1 << bits) - 1)); return Z_OK; } /* ========================================================================= */ int ZEXPORT deflateParams(strm, level, strategy) z_streamp strm; int level; int strategy; { deflate_state *s; compress_func func; int err = Z_OK; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; s = strm->state; #ifdef FASTEST if (level != 0) level = 1; #else if (level == Z_DEFAULT_COMPRESSION) level = 6; #endif if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { return Z_STREAM_ERROR; } func = configuration_table[s->level].func; if (func != configuration_table[level].func && strm->total_in != 0) { /* Flush the last buffer: */ err = deflate(strm, Z_PARTIAL_FLUSH); } if (s->level != level) { s->level = level; s->max_lazy_match = configuration_table[level].max_lazy; s->good_match = configuration_table[level].good_length; s->nice_match = configuration_table[level].nice_length; s->max_chain_length = configuration_table[level].max_chain; } s->strategy = strategy; return err; } /* ========================================================================= */ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) z_streamp strm; int good_length; int max_lazy; int nice_length; int max_chain; { deflate_state *s; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; s = strm->state; s->good_match = good_length; s->max_lazy_match = max_lazy; s->nice_match = nice_length; s->max_chain_length = max_chain; return Z_OK; } /* ========================================================================= * For the default windowBits of 15 and memLevel of 8, this function returns * a close to exact, as well as small, upper bound on the compressed size. * They are coded as constants here for a reason--if the #define's are * changed, then this function needs to be changed as well. The return * value for 15 and 8 only works for those exact settings. * * For any setting other than those defaults for windowBits and memLevel, * the value returned is a conservative worst case for the maximum expansion * resulting from using fixed blocks instead of stored blocks, which deflate * can emit on compressed data for some combinations of the parameters. * * This function could be more sophisticated to provide closer upper bounds * for every combination of windowBits and memLevel, as well as wrap. * But even the conservative upper bound of about 14% expansion does not * seem onerous for output buffer allocation. */ uLong ZEXPORT deflateBound(strm, sourceLen) z_streamp strm; uLong sourceLen; { deflate_state *s; uLong destLen; /* conservative upper bound */ destLen = sourceLen + ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 11; /* if can't get parameters, return conservative bound */ if (strm == Z_NULL || strm->state == Z_NULL) return destLen; /* if not default parameters, return conservative bound */ s = strm->state; if (s->w_bits != 15 || s->hash_bits != 8 + 7) return destLen; /* default settings: return tight bound for that case */ return compressBound(sourceLen); } /* ========================================================================= * Put a short in the pending buffer. The 16-bit value is put in MSB order. * IN assertion: the stream state is correct and there is enough room in * pending_buf. */ local void putShortMSB (s, b) deflate_state *s; uInt b; { put_byte(s, (Byte)(b >> 8)); put_byte(s, (Byte)(b & 0xff)); } /* ========================================================================= * Flush as much pending output as possible. All deflate() output goes * through this function so some applications may wish to modify it * to avoid allocating a large strm->next_out buffer and copying into it. * (See also read_buf()). */ local void flush_pending(strm) z_streamp strm; { unsigned len = strm->state->pending; if (len > strm->avail_out) len = strm->avail_out; if (len == 0) return; zmemcpy(strm->next_out, strm->state->pending_out, len); strm->next_out += len; strm->state->pending_out += len; strm->total_out += len; strm->avail_out -= len; strm->state->pending -= len; if (strm->state->pending == 0) { strm->state->pending_out = strm->state->pending_buf; } } /* ========================================================================= */ int ZEXPORT deflate (strm, flush) z_streamp strm; int flush; { int old_flush; /* value of flush param for previous deflate call */ deflate_state *s; if (strm == Z_NULL || strm->state == Z_NULL || flush > Z_FINISH || flush < 0) { return Z_STREAM_ERROR; } s = strm->state; if (strm->next_out == Z_NULL || (strm->next_in == Z_NULL && strm->avail_in != 0) || (s->status == FINISH_STATE && flush != Z_FINISH)) { ERR_RETURN(strm, Z_STREAM_ERROR); } if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); s->strm = strm; /* just in case */ old_flush = s->last_flush; s->last_flush = flush; /* Write the header */ if (s->status == INIT_STATE) { #ifdef GZIP if (s->wrap == 2) { strm->adler = crc32(0L, Z_NULL, 0); put_byte(s, 31); put_byte(s, 139); put_byte(s, 8); if (s->gzhead == NULL) { put_byte(s, 0); put_byte(s, 0); put_byte(s, 0); put_byte(s, 0); put_byte(s, 0); put_byte(s, s->level == 9 ? 2 : (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? 4 : 0)); put_byte(s, OS_CODE); s->status = BUSY_STATE; } else { put_byte(s, (s->gzhead->text ? 1 : 0) + (s->gzhead->hcrc ? 2 : 0) + (s->gzhead->extra == Z_NULL ? 0 : 4) + (s->gzhead->name == Z_NULL ? 0 : 8) + (s->gzhead->comment == Z_NULL ? 0 : 16) ); put_byte(s, (Byte)(s->gzhead->time & 0xff)); put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff)); put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff)); put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff)); put_byte(s, s->level == 9 ? 2 : (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? 4 : 0)); put_byte(s, s->gzhead->os & 0xff); if (s->gzhead->extra != NULL) { put_byte(s, s->gzhead->extra_len & 0xff); put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); } if (s->gzhead->hcrc) strm->adler = crc32(strm->adler, s->pending_buf, s->pending); s->gzindex = 0; s->status = EXTRA_STATE; } } else #endif { uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; uInt level_flags; if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) level_flags = 0; else if (s->level < 6) level_flags = 1; else if (s->level == 6) level_flags = 2; else level_flags = 3; header |= (level_flags << 6); if (s->strstart != 0) header |= PRESET_DICT; header += 31 - (header % 31); s->status = BUSY_STATE; putShortMSB(s, header); /* Save the adler32 of the preset dictionary: */ if (s->strstart != 0) { putShortMSB(s, (uInt)(strm->adler >> 16)); putShortMSB(s, (uInt)(strm->adler & 0xffff)); } strm->adler = adler32(0L, Z_NULL, 0); } } #ifdef GZIP if (s->status == EXTRA_STATE) { if (s->gzhead->extra != NULL) { uInt beg = s->pending; /* start of bytes to update crc */ while (s->gzindex < (s->gzhead->extra_len & 0xffff)) { if (s->pending == s->pending_buf_size) { if (s->gzhead->hcrc && s->pending > beg) strm->adler = crc32(strm->adler, s->pending_buf + beg, s->pending - beg); flush_pending(strm); beg = s->pending; if (s->pending == s->pending_buf_size) break; } put_byte(s, s->gzhead->extra[s->gzindex]); s->gzindex++; } if (s->gzhead->hcrc && s->pending > beg) strm->adler = crc32(strm->adler, s->pending_buf + beg, s->pending - beg); if (s->gzindex == s->gzhead->extra_len) { s->gzindex = 0; s->status = NAME_STATE; } } else s->status = NAME_STATE; } if (s->status == NAME_STATE) { if (s->gzhead->name != NULL) { uInt beg = s->pending; /* start of bytes to update crc */ int val; do { if (s->pending == s->pending_buf_size) { if (s->gzhead->hcrc && s->pending > beg) strm->adler = crc32(strm->adler, s->pending_buf + beg, s->pending - beg); flush_pending(strm); beg = s->pending; if (s->pending == s->pending_buf_size) { val = 1; break; } } val = s->gzhead->name[s->gzindex++]; put_byte(s, val); } while (val != 0); if (s->gzhead->hcrc && s->pending > beg) strm->adler = crc32(strm->adler, s->pending_buf + beg, s->pending - beg); if (val == 0) { s->gzindex = 0; s->status = COMMENT_STATE; } } else s->status = COMMENT_STATE; } if (s->status == COMMENT_STATE) { if (s->gzhead->comment != NULL) { uInt beg = s->pending; /* start of bytes to update crc */ int val; do { if (s->pending == s->pending_buf_size) { if (s->gzhead->hcrc && s->pending > beg) strm->adler = crc32(strm->adler, s->pending_buf + beg, s->pending - beg); flush_pending(strm); beg = s->pending; if (s->pending == s->pending_buf_size) { val = 1; break; } } val = s->gzhead->comment[s->gzindex++]; put_byte(s, val); } while (val != 0); if (s->gzhead->hcrc && s->pending > beg) strm->adler = crc32(strm->adler, s->pending_buf + beg, s->pending - beg); if (val == 0) s->status = HCRC_STATE; } else s->status = HCRC_STATE; } if (s->status == HCRC_STATE) { if (s->gzhead->hcrc) { if (s->pending + 2 > s->pending_buf_size) flush_pending(strm); if (s->pending + 2 <= s->pending_buf_size) { put_byte(s, (Byte)(strm->adler & 0xff)); put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); strm->adler = crc32(0L, Z_NULL, 0); s->status = BUSY_STATE; } } else s->status = BUSY_STATE; } #endif /* Flush as much pending output as possible */ if (s->pending != 0) { flush_pending(strm); if (strm->avail_out == 0) { /* Since avail_out is 0, deflate will be called again with * more output space, but possibly with both pending and * avail_in equal to zero. There won't be anything to do, * but this is not an error situation so make sure we * return OK instead of BUF_ERROR at next call of deflate: */ s->last_flush = -1; return Z_OK; } /* Make sure there is something to do and avoid duplicate consecutive * flushes. For repeated and useless calls with Z_FINISH, we keep * returning Z_STREAM_END instead of Z_BUF_ERROR. */ } else if (strm->avail_in == 0 && flush <= old_flush && flush != Z_FINISH) { ERR_RETURN(strm, Z_BUF_ERROR); } /* User must not provide more input after the first FINISH: */ if (s->status == FINISH_STATE && strm->avail_in != 0) { ERR_RETURN(strm, Z_BUF_ERROR); } /* Start a new block or continue the current one. */ if (strm->avail_in != 0 || s->lookahead != 0 || (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { block_state bstate; bstate = (*(configuration_table[s->level].func))(s, flush); if (bstate == finish_started || bstate == finish_done) { s->status = FINISH_STATE; } if (bstate == need_more || bstate == finish_started) { if (strm->avail_out == 0) { s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ } return Z_OK; /* If flush != Z_NO_FLUSH && avail_out == 0, the next call * of deflate should use the same flush parameter to make sure * that the flush is complete. So we don't have to output an * empty block here, this will be done at next call. This also * ensures that for a very small output buffer, we emit at most * one empty block. */ } if (bstate == block_done) { if (flush == Z_PARTIAL_FLUSH) { _tr_align(s); } else { /* FULL_FLUSH or SYNC_FLUSH */ _tr_stored_block(s, (char*)0, 0L, 0); /* For a full flush, this empty block will be recognized * as a special marker by inflate_sync(). */ if (flush == Z_FULL_FLUSH) { CLEAR_HASH(s); /* forget history */ } } flush_pending(strm); if (strm->avail_out == 0) { s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ return Z_OK; } } } Assert(strm->avail_out > 0, "bug2"); if (flush != Z_FINISH) return Z_OK; if (s->wrap <= 0) return Z_STREAM_END; /* Write the trailer */ #ifdef GZIP if (s->wrap == 2) { put_byte(s, (Byte)(strm->adler & 0xff)); put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); put_byte(s, (Byte)((strm->adler >> 16) & 0xff)); put_byte(s, (Byte)((strm->adler >> 24) & 0xff)); put_byte(s, (Byte)(strm->total_in & 0xff)); put_byte(s, (Byte)((strm->total_in >> 8) & 0xff)); put_byte(s, (Byte)((strm->total_in >> 16) & 0xff)); put_byte(s, (Byte)((strm->total_in >> 24) & 0xff)); } else #endif { putShortMSB(s, (uInt)(strm->adler >> 16)); putShortMSB(s, (uInt)(strm->adler & 0xffff)); } flush_pending(strm); /* If avail_out is zero, the application will call deflate again * to flush the rest. */ if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ return s->pending != 0 ? Z_OK : Z_STREAM_END; } /* ========================================================================= */ int ZEXPORT deflateEnd (strm) z_streamp strm; { int status; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; status = strm->state->status; if (status != INIT_STATE && status != EXTRA_STATE && status != NAME_STATE && status != COMMENT_STATE && status != HCRC_STATE && status != BUSY_STATE && status != FINISH_STATE) { return Z_STREAM_ERROR; } /* Deallocate in reverse order of allocations: */ TRY_FREE(strm, strm->state->pending_buf); TRY_FREE(strm, strm->state->head); TRY_FREE(strm, strm->state->prev); TRY_FREE(strm, strm->state->window); ZFREE(strm, strm->state); strm->state = Z_NULL; return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; } /* ========================================================================= * Copy the source state to the destination state. * To simplify the source, this is not supported for 16-bit MSDOS (which * doesn't have enough memory anyway to duplicate compression states). */ int ZEXPORT deflateCopy (dest, source) z_streamp dest; z_streamp source; { #ifdef MAXSEG_64K return Z_STREAM_ERROR; #else deflate_state *ds; deflate_state *ss; ushf *overlay; if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { return Z_STREAM_ERROR; } ss = source->state; zmemcpy(dest, source, sizeof(z_stream)); ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); if (ds == Z_NULL) return Z_MEM_ERROR; dest->state = (struct internal_state FAR *) ds; zmemcpy(ds, ss, sizeof(deflate_state)); ds->strm = dest; ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); ds->pending_buf = (uchf *) overlay; if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || ds->pending_buf == Z_NULL) { deflateEnd (dest); return Z_MEM_ERROR; } /* following zmemcpy do not work for 16-bit MSDOS */ zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos)); zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos)); zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; ds->l_desc.dyn_tree = ds->dyn_ltree; ds->d_desc.dyn_tree = ds->dyn_dtree; ds->bl_desc.dyn_tree = ds->bl_tree; return Z_OK; #endif /* MAXSEG_64K */ } /* =========================================================================== * Read a new buffer from the current input stream, update the adler32 * and total number of bytes read. All deflate() input goes through * this function so some applications may wish to modify it to avoid * allocating a large strm->next_in buffer and copying from it. * (See also flush_pending()). */ local int read_buf(strm, buf, size) z_streamp strm; Bytef *buf; unsigned size; { unsigned len = strm->avail_in; if (len > size) len = size; if (len == 0) return 0; strm->avail_in -= len; if (strm->state->wrap == 1) { strm->adler = adler32(strm->adler, strm->next_in, len); } #ifdef GZIP else if (strm->state->wrap == 2) { strm->adler = crc32(strm->adler, strm->next_in, len); } #endif zmemcpy(buf, strm->next_in, len); strm->next_in += len; strm->total_in += len; return (int)len; } /* =========================================================================== * Initialize the "longest match" routines for a new zlib stream */ local void lm_init (s) deflate_state *s; { s->window_size = (ulg)2L*s->w_size; CLEAR_HASH(s); /* Set the default configuration parameters: */ s->max_lazy_match = configuration_table[s->level].max_lazy; s->good_match = configuration_table[s->level].good_length; s->nice_match = configuration_table[s->level].nice_length; s->max_chain_length = configuration_table[s->level].max_chain; s->strstart = 0; s->block_start = 0L; s->lookahead = 0; s->match_length = s->prev_length = MIN_MATCH-1; s->match_available = 0; s->ins_h = 0; #ifndef FASTEST #ifdef ASMV match_init(); /* initialize the asm code */ #endif #endif } #ifndef FASTEST /* =========================================================================== * Set match_start to the longest match starting at the given string and * return its length. Matches shorter or equal to prev_length are discarded, * in which case the result is equal to prev_length and match_start is * garbage. * IN assertions: cur_match is the head of the hash chain for the current * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 * OUT assertion: the match length is not greater than s->lookahead. */ #ifndef ASMV /* For 80x86 and 680x0, an optimized version will be provided in match.asm or * match.S. The code will be functionally equivalent. */ local uInt longest_match(s, cur_match) deflate_state *s; IPos cur_match; /* current match */ { unsigned chain_length = s->max_chain_length;/* max hash chain length */ register Bytef *scan = s->window + s->strstart; /* current string */ register Bytef *match; /* matched string */ register int len; /* length of current match */ int best_len = s->prev_length; /* best match length so far */ int nice_match = s->nice_match; /* stop if match long enough */ IPos limit = s->strstart > (IPos)MAX_DIST(s) ? s->strstart - (IPos)MAX_DIST(s) : NIL; /* Stop when cur_match becomes <= limit. To simplify the code, * we prevent matches with the string of window index 0. */ Posf *prev = s->prev; uInt wmask = s->w_mask; #ifdef UNALIGNED_OK /* Compare two bytes at a time. Note: this is not always beneficial. * Try with and without -DUNALIGNED_OK to check. */ register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; register ush scan_start = *(ushf*)scan; register ush scan_end = *(ushf*)(scan+best_len-1); #else register Bytef *strend = s->window + s->strstart + MAX_MATCH; register Byte scan_end1 = scan[best_len-1]; register Byte scan_end = scan[best_len]; #endif /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. * It is easy to get rid of this optimization if necessary. */ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); /* Do not waste too much time if we already have a good match: */ if (s->prev_length >= s->good_match) { chain_length >>= 2; } /* Do not look for matches beyond the end of the input. This is necessary * to make deflate deterministic. */ if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); do { Assert(cur_match < s->strstart, "no future"); match = s->window + cur_match; /* Skip to next match if the match length cannot increase * or if the match length is less than 2. Note that the checks below * for insufficient lookahead only occur occasionally for performance * reasons. Therefore uninitialized memory will be accessed, and * conditional jumps will be made that depend on those values. * However the length of the match is limited to the lookahead, so * the output of deflate is not affected by the uninitialized values. */ #if (defined(UNALIGNED_OK) && MAX_MATCH == 258) /* This code assumes sizeof(unsigned short) == 2. Do not use * UNALIGNED_OK if your compiler uses a different size. */ if (*(ushf*)(match+best_len-1) != scan_end || *(ushf*)match != scan_start) continue; /* It is not necessary to compare scan[2] and match[2] since they are * always equal when the other bytes match, given that the hash keys * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at * strstart+3, +5, ... up to strstart+257. We check for insufficient * lookahead only every 4th comparison; the 128th check will be made * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is * necessary to put more guard bytes at the end of the window, or * to check more often for insufficient lookahead. */ Assert(scan[2] == match[2], "scan[2]?"); scan++, match++; do { } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && *(ushf*)(scan+=2) == *(ushf*)(match+=2) && *(ushf*)(scan+=2) == *(ushf*)(match+=2) && *(ushf*)(scan+=2) == *(ushf*)(match+=2) && scan < strend); /* The funny "do {}" generates better code on most compilers */ /* Here, scan <= window+strstart+257 */ Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); if (*scan == *match) scan++; len = (MAX_MATCH - 1) - (int)(strend-scan); scan = strend - (MAX_MATCH-1); #else /* UNALIGNED_OK */ if (match[best_len] != scan_end || match[best_len-1] != scan_end1 || *match != *scan || *++match != scan[1]) continue; /* The check at best_len-1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that * the hash keys are equal and that HASH_BITS >= 8. */ scan += 2, match++; Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; * the 256th check will be made at strstart+258. */ do { } while (*++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && scan < strend); Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); len = MAX_MATCH - (int)(strend - scan); scan = strend - MAX_MATCH; #endif /* UNALIGNED_OK */ if (len > best_len) { s->match_start = cur_match; best_len = len; if (len >= nice_match) break; #ifdef UNALIGNED_OK scan_end = *(ushf*)(scan+best_len-1); #else scan_end1 = scan[best_len-1]; scan_end = scan[best_len]; #endif } } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length != 0); if ((uInt)best_len <= s->lookahead) return (uInt)best_len; return s->lookahead; } #endif /* ASMV */ #endif /* FASTEST */ /* --------------------------------------------------------------------------- * Optimized version for level == 1 or strategy == Z_RLE only */ local uInt longest_match_fast(s, cur_match) deflate_state *s; IPos cur_match; /* current match */ { register Bytef *scan = s->window + s->strstart; /* current string */ register Bytef *match; /* matched string */ register int len; /* length of current match */ register Bytef *strend = s->window + s->strstart + MAX_MATCH; /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. * It is easy to get rid of this optimization if necessary. */ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); Assert(cur_match < s->strstart, "no future"); match = s->window + cur_match; /* Return failure if the match length is less than 2: */ if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; /* The check at best_len-1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that * the hash keys are equal and that HASH_BITS >= 8. */ scan += 2, match += 2; Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; * the 256th check will be made at strstart+258. */ do { } while (*++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && scan < strend); Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); len = MAX_MATCH - (int)(strend - scan); if (len < MIN_MATCH) return MIN_MATCH - 1; s->match_start = cur_match; return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead; } #ifdef DEBUG /* =========================================================================== * Check that the match at match_start is indeed a match. */ local void check_match(s, start, match, length) deflate_state *s; IPos start, match; int length; { /* check that the match is indeed a match */ if (zmemcmp(s->window + match, s->window + start, length) != EQUAL) { fprintf(stderr, " start %u, match %u, length %d\n", start, match, length); do { fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); } while (--length != 0); z_error("invalid match"); } if (z_verbose > 1) { fprintf(stderr,"\\[%d,%d]", start-match, length); do { putc(s->window[start++], stderr); } while (--length != 0); } } #else # define check_match(s, start, match, length) #endif /* DEBUG */ /* =========================================================================== * Fill the window when the lookahead becomes insufficient. * Updates strstart and lookahead. * * IN assertion: lookahead < MIN_LOOKAHEAD * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD * At least one byte has been read, or avail_in == 0; reads are * performed for at least two bytes (required for the zip translate_eol * option -- not supported here). */ local void fill_window(s) deflate_state *s; { register unsigned n, m; register Posf *p; unsigned more; /* Amount of free space at the end of the window. */ uInt wsize = s->w_size; do { more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); /* Deal with !@#$% 64K limit: */ if (sizeof(int) <= 2) { if (more == 0 && s->strstart == 0 && s->lookahead == 0) { more = wsize; } else if (more == (unsigned)(-1)) { /* Very unlikely, but possible on 16 bit machine if * strstart == 0 && lookahead == 1 (input done a byte at time) */ more--; } } /* If the window is almost full and there is insufficient lookahead, * move the upper half to the lower one to make room in the upper half. */ if (s->strstart >= wsize+MAX_DIST(s)) { zmemcpy(s->window, s->window+wsize, (unsigned)wsize); s->match_start -= wsize; s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ s->block_start -= (long) wsize; /* Slide the hash table (could be avoided with 32 bit values at the expense of memory usage). We slide even when level == 0 to keep the hash table consistent if we switch back to level > 0 later. (Using level 0 permanently is not an optimal usage of zlib, so we don't care about this pathological case.) */ /* %%% avoid this when Z_RLE */ n = s->hash_size; p = &s->head[n]; do { m = *--p; *p = (Pos)(m >= wsize ? m-wsize : NIL); } while (--n); n = wsize; #ifndef FASTEST p = &s->prev[n]; do { m = *--p; *p = (Pos)(m >= wsize ? m-wsize : NIL); /* If n is not on any hash chain, prev[n] is garbage but * its value will never be used. */ } while (--n); #endif more += wsize; } if (s->strm->avail_in == 0) return; /* If there was no sliding: * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && * more == window_size - lookahead - strstart * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) * => more >= window_size - 2*WSIZE + 2 * In the BIG_MEM or MMAP case (not yet supported), * window_size == input_size + MIN_LOOKAHEAD && * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. * Otherwise, window_size == 2*WSIZE so more >= 2. * If there was sliding, more >= WSIZE. So in all cases, more >= 2. */ Assert(more >= 2, "more < 2"); n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); s->lookahead += n; /* Initialize the hash value now that we have some input: */ if (s->lookahead >= MIN_MATCH) { s->ins_h = s->window[s->strstart]; UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); #if MIN_MATCH != 3 Call UPDATE_HASH() MIN_MATCH-3 more times #endif } /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, * but this is not important since only literal bytes will be emitted. */ } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); } /* =========================================================================== * Flush the current block, with given end-of-file flag. * IN assertion: strstart is set to the end of the current match. */ #define FLUSH_BLOCK_ONLY(s, eof) { \ _tr_flush_block(s, (s->block_start >= 0L ? \ (charf *)&s->window[(unsigned)s->block_start] : \ (charf *)Z_NULL), \ (ulg)((long)s->strstart - s->block_start), \ (eof)); \ s->block_start = s->strstart; \ flush_pending(s->strm); \ Tracev((stderr,"[FLUSH]")); \ } /* Same but force premature exit if necessary. */ #define FLUSH_BLOCK(s, eof) { \ FLUSH_BLOCK_ONLY(s, eof); \ if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \ } /* =========================================================================== * Copy without compression as much as possible from the input stream, return * the current block state. * This function does not insert new strings in the dictionary since * uncompressible data is probably not useful. This function is used * only for the level=0 compression option. * NOTE: this function should be optimized to avoid extra copying from * window to pending_buf. */ local block_state deflate_stored(s, flush) deflate_state *s; int flush; { /* Stored blocks are limited to 0xffff bytes, pending_buf is limited * to pending_buf_size, and each stored block has a 5 byte header: */ ulg max_block_size = 0xffff; ulg max_start; if (max_block_size > s->pending_buf_size - 5) { max_block_size = s->pending_buf_size - 5; } /* Copy as much as possible from input to output: */ for (;;) { /* Fill the window as much as possible: */ if (s->lookahead <= 1) { Assert(s->strstart < s->w_size+MAX_DIST(s) || s->block_start >= (long)s->w_size, "slide too late"); fill_window(s); if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; if (s->lookahead == 0) break; /* flush the current block */ } Assert(s->block_start >= 0L, "block gone"); s->strstart += s->lookahead; s->lookahead = 0; /* Emit a stored block if pending_buf will be full: */ max_start = s->block_start + max_block_size; if (s->strstart == 0 || (ulg)s->strstart >= max_start) { /* strstart == 0 is possible when wraparound on 16-bit machine */ s->lookahead = (uInt)(s->strstart - max_start); s->strstart = (uInt)max_start; FLUSH_BLOCK(s, 0); } /* Flush if we may have to slide, otherwise block_start may become * negative and the data will be gone: */ if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { FLUSH_BLOCK(s, 0); } } FLUSH_BLOCK(s, flush == Z_FINISH); return flush == Z_FINISH ? finish_done : block_done; } /* =========================================================================== * Compress as much as possible from the input stream, return the current * block state. * This function does not perform lazy evaluation of matches and inserts * new strings in the dictionary only for unmatched strings or for short * matches. It is used only for the fast compression options. */ local block_state deflate_fast(s, flush) deflate_state *s; int flush; { IPos hash_head = NIL; /* head of the hash chain */ int bflush; /* set if current block must be flushed */ for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the next match, plus MIN_MATCH bytes to insert the * string following the next match. */ if (s->lookahead < MIN_LOOKAHEAD) { fill_window(s); if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { return need_more; } if (s->lookahead == 0) break; /* flush the current block */ } /* Insert the string window[strstart .. strstart+2] in the * dictionary, and set hash_head to the head of the hash chain: */ if (s->lookahead >= MIN_MATCH) { INSERT_STRING(s, s->strstart, hash_head); } /* Find the longest match, discarding those <= prev_length. * At this point we have always match_length < MIN_MATCH */ if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) { /* To simplify the code, we prevent matches with the string * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ #ifdef FASTEST if ((s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) || (s->strategy == Z_RLE && s->strstart - hash_head == 1)) { s->match_length = longest_match_fast (s, hash_head); } #else if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) { s->match_length = longest_match (s, hash_head); } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) { s->match_length = longest_match_fast (s, hash_head); } #endif /* longest_match() or longest_match_fast() sets match_start */ } if (s->match_length >= MIN_MATCH) { check_match(s, s->strstart, s->match_start, s->match_length); _tr_tally_dist(s, s->strstart - s->match_start, s->match_length - MIN_MATCH, bflush); s->lookahead -= s->match_length; /* Insert new strings in the hash table only if the match length * is not too large. This saves time but degrades compression. */ #ifndef FASTEST if (s->match_length <= s->max_insert_length && s->lookahead >= MIN_MATCH) { s->match_length--; /* string at strstart already in table */ do { s->strstart++; INSERT_STRING(s, s->strstart, hash_head); /* strstart never exceeds WSIZE-MAX_MATCH, so there are * always MIN_MATCH bytes ahead. */ } while (--s->match_length != 0); s->strstart++; } else #endif { s->strstart += s->match_length; s->match_length = 0; s->ins_h = s->window[s->strstart]; UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); #if MIN_MATCH != 3 Call UPDATE_HASH() MIN_MATCH-3 more times #endif /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not * matter since it will be recomputed at next deflate call. */ } } else { /* No match, output a literal byte */ Tracevv((stderr,"%c", s->window[s->strstart])); _tr_tally_lit (s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; } if (bflush) FLUSH_BLOCK(s, 0); } FLUSH_BLOCK(s, flush == Z_FINISH); return flush == Z_FINISH ? finish_done : block_done; } #ifndef FASTEST /* =========================================================================== * Same as above, but achieves better compression. We use a lazy * evaluation for matches: a match is finally adopted only if there is * no better match at the next window position. */ local block_state deflate_slow(s, flush) deflate_state *s; int flush; { IPos hash_head = NIL; /* head of hash chain */ int bflush; /* set if current block must be flushed */ /* Process the input block. */ for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the next match, plus MIN_MATCH bytes to insert the * string following the next match. */ if (s->lookahead < MIN_LOOKAHEAD) { fill_window(s); if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { return need_more; } if (s->lookahead == 0) break; /* flush the current block */ } /* Insert the string window[strstart .. strstart+2] in the * dictionary, and set hash_head to the head of the hash chain: */ if (s->lookahead >= MIN_MATCH) { INSERT_STRING(s, s->strstart, hash_head); } /* Find the longest match, discarding those <= prev_length. */ s->prev_length = s->match_length, s->prev_match = s->match_start; s->match_length = MIN_MATCH-1; if (hash_head != NIL && s->prev_length < s->max_lazy_match && s->strstart - hash_head <= MAX_DIST(s)) { /* To simplify the code, we prevent matches with the string * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) { s->match_length = longest_match (s, hash_head); } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) { s->match_length = longest_match_fast (s, hash_head); } /* longest_match() or longest_match_fast() sets match_start */ if (s->match_length <= 5 && (s->strategy == Z_FILTERED #if TOO_FAR <= 32767 || (s->match_length == MIN_MATCH && s->strstart - s->match_start > TOO_FAR) #endif )) { /* If prev_match is also MIN_MATCH, match_start is garbage * but we will ignore the current match anyway. */ s->match_length = MIN_MATCH-1; } } /* If there was a match at the previous step and the current * match is not better, output the previous match: */ if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) { uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; /* Do not insert strings in hash table beyond this. */ check_match(s, s->strstart-1, s->prev_match, s->prev_length); _tr_tally_dist(s, s->strstart -1 - s->prev_match, s->prev_length - MIN_MATCH, bflush); /* Insert in hash table all strings up to the end of the match. * strstart-1 and strstart are already inserted. If there is not * enough lookahead, the last two strings are not inserted in * the hash table. */ s->lookahead -= s->prev_length-1; s->prev_length -= 2; do { if (++s->strstart <= max_insert) { INSERT_STRING(s, s->strstart, hash_head); } } while (--s->prev_length != 0); s->match_available = 0; s->match_length = MIN_MATCH-1; s->strstart++; if (bflush) FLUSH_BLOCK(s, 0); } else if (s->match_available) { /* If there was no match at the previous position, output a * single literal. If there was a match but the current match * is longer, truncate the previous match to a single literal. */ Tracevv((stderr,"%c", s->window[s->strstart-1])); _tr_tally_lit(s, s->window[s->strstart-1], bflush); if (bflush) { FLUSH_BLOCK_ONLY(s, 0); } s->strstart++; s->lookahead--; if (s->strm->avail_out == 0) return need_more; } else { /* There is no previous match to compare with, wait for * the next step to decide. */ s->match_available = 1; s->strstart++; s->lookahead--; } } Assert (flush != Z_NO_FLUSH, "no flush?"); if (s->match_available) { Tracevv((stderr,"%c", s->window[s->strstart-1])); _tr_tally_lit(s, s->window[s->strstart-1], bflush); s->match_available = 0; } FLUSH_BLOCK(s, flush == Z_FINISH); return flush == Z_FINISH ? finish_done : block_done; } #endif /* FASTEST */ #if 0 /* =========================================================================== * For Z_RLE, simply look for runs of bytes, generate matches only of distance * one. Do not maintain a hash table. (It will be regenerated if this run of * deflate switches away from Z_RLE.) */ local block_state deflate_rle(s, flush) deflate_state *s; int flush; { int bflush; /* set if current block must be flushed */ uInt run; /* length of run */ uInt max; /* maximum length of run */ uInt prev; /* byte at distance one to match */ Bytef *scan; /* scan for end of run */ for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the longest encodable run. */ if (s->lookahead < MAX_MATCH) { fill_window(s); if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) { return need_more; } if (s->lookahead == 0) break; /* flush the current block */ } /* See how many times the previous byte repeats */ run = 0; if (s->strstart > 0) { /* if there is a previous byte, that is */ max = s->lookahead < MAX_MATCH ? s->lookahead : MAX_MATCH; scan = s->window + s->strstart - 1; prev = *scan++; do { if (*scan++ != prev) break; } while (++run < max); } /* Emit match if have run of MIN_MATCH or longer, else emit literal */ if (run >= MIN_MATCH) { check_match(s, s->strstart, s->strstart - 1, run); _tr_tally_dist(s, 1, run - MIN_MATCH, bflush); s->lookahead -= run; s->strstart += run; } else { /* No match, output a literal byte */ Tracevv((stderr,"%c", s->window[s->strstart])); _tr_tally_lit (s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; } if (bflush) FLUSH_BLOCK(s, 0); } FLUSH_BLOCK(s, flush == Z_FINISH); return flush == Z_FINISH ? finish_done : block_done; } #endif ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/zconf.h0000644000175000017500000002251012320517543021403 0ustar mathieumathieu/* zconf.h -- configuration of the zlib compression library * Copyright (C) 1995-2005 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ #ifndef ZCONF_H #define ZCONF_H /* * If you *really* need a unique prefix for all types and library functions, * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. */ #ifdef Z_PREFIX # define deflateInit_ z_deflateInit_ # define deflate z_deflate # define deflateEnd z_deflateEnd # define inflateInit_ z_inflateInit_ # define inflate z_inflate # define inflateEnd z_inflateEnd # define deflateInit2_ z_deflateInit2_ # define deflateSetDictionary z_deflateSetDictionary # define deflateCopy z_deflateCopy # define deflateReset z_deflateReset # define deflateParams z_deflateParams # define deflateBound z_deflateBound # define deflatePrime z_deflatePrime # define inflateInit2_ z_inflateInit2_ # define inflateSetDictionary z_inflateSetDictionary # define inflateSync z_inflateSync # define inflateSyncPoint z_inflateSyncPoint # define inflateCopy z_inflateCopy # define inflateReset z_inflateReset # define inflateBack z_inflateBack # define inflateBackEnd z_inflateBackEnd # define compress z_compress # define compress2 z_compress2 # define compressBound z_compressBound # define uncompress z_uncompress # define adler32 z_adler32 # define crc32 z_crc32 # define get_crc_table z_get_crc_table # define zError z_zError # define alloc_func z_alloc_func # define free_func z_free_func # define in_func z_in_func # define out_func z_out_func # define Byte z_Byte # define uInt z_uInt # define uLong z_uLong # define Bytef z_Bytef # define charf z_charf # define intf z_intf # define uIntf z_uIntf # define uLongf z_uLongf # define voidpf z_voidpf # define voidp z_voidp #endif #if defined(__MSDOS__) && !defined(MSDOS) # define MSDOS #endif #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) # define OS2 #endif #if defined(_WINDOWS) && !defined(WINDOWS) # define WINDOWS #endif #if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) # ifndef WIN32 # define WIN32 # endif #endif #if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) # if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) # ifndef SYS16BIT # define SYS16BIT # endif # endif #endif /* * Compile with -DMAXSEG_64K if the alloc function cannot allocate more * than 64k bytes at a time (needed on systems with 16-bit int). */ #ifdef SYS16BIT # define MAXSEG_64K #endif #ifdef MSDOS # define UNALIGNED_OK #endif #ifdef __STDC_VERSION__ # ifndef STDC # define STDC # endif # if __STDC_VERSION__ >= 199901L # ifndef STDC99 # define STDC99 # endif # endif #endif #if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) # define STDC #endif #if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) # define STDC #endif #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) # define STDC #endif #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) # define STDC #endif #if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ # define STDC #endif #ifndef STDC # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ # define const /* note: need a more gentle solution here */ # endif #endif /* Some Mac compilers merge all .h files incorrectly: */ #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) # define NO_DUMMY_DECL #endif /* Maximum value for memLevel in deflateInit2 */ #ifndef MAX_MEM_LEVEL # ifdef MAXSEG_64K # define MAX_MEM_LEVEL 8 # else # define MAX_MEM_LEVEL 9 # endif #endif /* Maximum value for windowBits in deflateInit2 and inflateInit2. * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files * created by gzip. (Files created by minigzip can still be extracted by * gzip.) */ #ifndef MAX_WBITS # define MAX_WBITS 15 /* 32K LZ77 window */ #endif /* The memory requirements for deflate are (in bytes): (1 << (windowBits+2)) + (1 << (memLevel+9)) that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) plus a few kilobytes for small objects. For example, if you want to reduce the default memory requirements from 256K to 128K, compile with make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" Of course this will generally degrade compression (there's no free lunch). The memory requirements for inflate are (in bytes) 1 << windowBits that is, 32K for windowBits=15 (default value) plus a few kilobytes for small objects. */ /* Type declarations */ #ifndef OF /* function prototypes */ # ifdef STDC # define OF(args) args # else # define OF(args) () # endif #endif /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, * just define FAR to be empty. */ #ifdef SYS16BIT # if defined(M_I86SM) || defined(M_I86MM) /* MSC small or medium model */ # define SMALL_MEDIUM # ifdef _MSC_VER # define FAR _far # else # define FAR far # endif # endif # if (defined(__SMALL__) || defined(__MEDIUM__)) /* Turbo C small or medium model */ # define SMALL_MEDIUM # ifdef __BORLANDC__ # define FAR _far # else # define FAR far # endif # endif #endif #if defined(WINDOWS) || defined(WIN32) /* If building or using zlib as a DLL, define ZLIB_DLL. * This is not mandatory, but it offers a little performance increase. */ # ifdef ZLIB_DLL # if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) # ifdef ZLIB_INTERNAL # define ZEXTERN extern __declspec(dllexport) # else # define ZEXTERN extern __declspec(dllimport) # endif # endif # endif /* ZLIB_DLL */ /* If building or using zlib with the WINAPI/WINAPIV calling convention, * define ZLIB_WINAPI. * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. */ # ifdef ZLIB_WINAPI # ifdef FAR # undef FAR # endif # include /* No need for _export, use ZLIB.DEF instead. */ /* For complete Windows compatibility, use WINAPI, not __stdcall. */ # define ZEXPORT WINAPI # ifdef WIN32 # define ZEXPORTVA WINAPIV # else # define ZEXPORTVA FAR CDECL # endif # endif #endif #if defined (__BEOS__) # ifdef ZLIB_DLL # ifdef ZLIB_INTERNAL # define ZEXPORT __declspec(dllexport) # define ZEXPORTVA __declspec(dllexport) # else # define ZEXPORT __declspec(dllimport) # define ZEXPORTVA __declspec(dllimport) # endif # endif #endif #ifndef ZEXTERN # define ZEXTERN extern #endif #ifndef ZEXPORT # define ZEXPORT #endif #ifndef ZEXPORTVA # define ZEXPORTVA #endif #ifndef FAR # define FAR #endif #if !defined(__MACTYPES__) typedef unsigned char Byte; /* 8 bits */ #endif typedef unsigned int uInt; /* 16 bits or more */ typedef unsigned long uLong; /* 32 bits or more */ #ifdef SMALL_MEDIUM /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ # define Bytef Byte FAR #else typedef Byte FAR Bytef; #endif typedef char FAR charf; typedef int FAR intf; typedef uInt FAR uIntf; typedef uLong FAR uLongf; #ifdef STDC typedef void const *voidpc; typedef void FAR *voidpf; typedef void *voidp; #else typedef Byte const *voidpc; typedef Byte FAR *voidpf; typedef Byte *voidp; #endif #if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ # include /* for off_t */ # include /* for SEEK_* and off_t */ # ifdef VMS # include /* for off_t */ # endif # define z_off_t off_t #endif #ifndef SEEK_SET # define SEEK_SET 0 /* Seek from beginning of file. */ # define SEEK_CUR 1 /* Seek from current position. */ # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ #endif #ifndef z_off_t # define z_off_t long #endif #if defined(__OS400__) # define NO_vsnprintf #endif #if defined(__MVS__) # define NO_vsnprintf # ifdef FAR # undef FAR # endif #endif /* MVS linker does not support external names larger than 8 bytes */ #if defined(__MVS__) # pragma map(deflateInit_,"DEIN") # pragma map(deflateInit2_,"DEIN2") # pragma map(deflateEnd,"DEEND") # pragma map(deflateBound,"DEBND") # pragma map(inflateInit_,"ININ") # pragma map(inflateInit2_,"ININ2") # pragma map(inflateEnd,"INEND") # pragma map(inflateSync,"INSY") # pragma map(inflateSetDictionary,"INSEDI") # pragma map(compressBound,"CMBND") # pragma map(inflate_table,"INTABL") # pragma map(inflate_fast,"INFA") # pragma map(inflate_copyright,"INCOPY") #endif #endif /* ZCONF_H */ ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/zlib.h0000644000175000017500000020165612320517543021236 0ustar mathieumathieu/* zlib.h -- interface of the 'zlib' general purpose compression library version 1.2.3, July 18th, 2005 Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Jean-loup Gailly Mark Adler jloup@gzip.org madler@alumni.caltech.edu The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). */ #ifndef ZLIB_H #define ZLIB_H #include "zconf.h" #ifdef __cplusplus extern "C" { #endif #define ZLIB_VERSION "1.2.3" #define ZLIB_VERNUM 0x1230 #if defined(QT_VISIBILITY_AVAILABLE) # define Q_ZEXPORT __attribute__((visibility("default"))) #else # ifdef QT_MAKEDLL # define Q_ZEXPORT __declspec(dllexport) # else # define Q_ZEXPORT ZEXPORT # endif #endif /* The 'zlib' compression library provides in-memory compression and decompression functions, including integrity checks of the uncompressed data. This version of the library supports only one compression method (deflation) but other algorithms will be added later and will have the same stream interface. Compression can be done in a single step if the buffers are large enough (for example if an input file is mmap'ed), or can be done by repeated calls of the compression function. In the latter case, the application must provide more input and/or consume the output (providing more output space) before each call. The compressed data format used by default by the in-memory functions is the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped around a deflate stream, which is itself documented in RFC 1951. The library also supports reading and writing files in gzip (.gz) format with an interface similar to that of stdio using the functions that start with "gz". The gzip format is different from the zlib format. gzip is a gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. This library can optionally read and write gzip streams in memory as well. The zlib format was designed to be compact and fast for use in memory and on communications channels. The gzip format was designed for single- file compression on file systems, has a larger header than zlib to maintain directory information, and uses a different, slower check method than zlib. The library does not install any signal handler. The decoder checks the consistency of the compressed data, so the library should never crash even in case of corrupted input. */ typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); typedef void (*free_func) OF((voidpf opaque, voidpf address)); struct internal_state; typedef struct z_stream_s { Bytef *next_in; /* next input byte */ uInt avail_in; /* number of bytes available at next_in */ uLong total_in; /* total nb of input bytes read so far */ Bytef *next_out; /* next output byte should be put there */ uInt avail_out; /* remaining free space at next_out */ uLong total_out; /* total nb of bytes output so far */ char *msg; /* last error message, NULL if no error */ struct internal_state FAR *state; /* not visible by applications */ alloc_func zalloc; /* used to allocate the internal state */ free_func zfree; /* used to free the internal state */ voidpf opaque; /* private data object passed to zalloc and zfree */ int data_type; /* best guess about the data type: binary or text */ uLong adler; /* adler32 value of the uncompressed data */ uLong reserved; /* reserved for future use */ } z_stream; typedef z_stream FAR *z_streamp; /* gzip header information passed to and from zlib routines. See RFC 1952 for more details on the meanings of these fields. */ typedef struct gz_header_s { int text; /* true if compressed data believed to be text */ uLong time; /* modification time */ int xflags; /* extra flags (not used when writing a gzip file) */ int os; /* operating system */ Bytef *extra; /* pointer to extra field or Z_NULL if none */ uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ uInt extra_max; /* space at extra (only when reading header) */ Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ uInt name_max; /* space at name (only when reading header) */ Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ uInt comm_max; /* space at comment (only when reading header) */ int hcrc; /* true if there was or will be a header crc */ int done; /* true when done reading gzip header (not used when writing a gzip file) */ } gz_header; typedef gz_header FAR *gz_headerp; /* The application must update next_in and avail_in when avail_in has dropped to zero. It must update next_out and avail_out when avail_out has dropped to zero. The application must initialize zalloc, zfree and opaque before calling the init function. All other fields are set by the compression library and must not be updated by the application. The opaque value provided by the application will be passed as the first parameter for calls of zalloc and zfree. This can be useful for custom memory management. The compression library attaches no meaning to the opaque value. zalloc must return Z_NULL if there is not enough memory for the object. If zlib is used in a multi-threaded application, zalloc and zfree must be thread safe. On 16-bit systems, the functions zalloc and zfree must be able to allocate exactly 65536 bytes, but will not be required to allocate more than this if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers returned by zalloc for objects of exactly 65536 bytes *must* have their offset normalized to zero. The default allocation function provided by this library ensures this (see zutil.c). To reduce memory requirements and avoid any allocation of 64K objects, at the expense of compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). The fields total_in and total_out can be used for statistics or progress reports. After compression, total_in holds the total size of the uncompressed data and may be saved for use in the decompressor (particularly if the decompressor wants to decompress everything in a single step). */ /* constants */ #define Z_NO_FLUSH 0 #define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ #define Z_SYNC_FLUSH 2 #define Z_FULL_FLUSH 3 #define Z_FINISH 4 #define Z_BLOCK 5 /* Allowed flush values; see deflate() and inflate() below for details */ #define Z_OK 0 #define Z_STREAM_END 1 #define Z_NEED_DICT 2 #define Z_ERRNO (-1) #define Z_STREAM_ERROR (-2) #define Z_DATA_ERROR (-3) #define Z_MEM_ERROR (-4) #define Z_BUF_ERROR (-5) #define Z_VERSION_ERROR (-6) /* Return codes for the compression/decompression functions. Negative * values are errors, positive values are used for special but normal events. */ #define Z_NO_COMPRESSION 0 #define Z_BEST_SPEED 1 #define Z_BEST_COMPRESSION 9 #define Z_DEFAULT_COMPRESSION (-1) /* compression levels */ #define Z_FILTERED 1 #define Z_HUFFMAN_ONLY 2 #define Z_RLE 3 #define Z_FIXED 4 #define Z_DEFAULT_STRATEGY 0 /* compression strategy; see deflateInit2() below for details */ #define Z_BINARY 0 #define Z_TEXT 1 #define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ #define Z_UNKNOWN 2 /* Possible values of the data_type field (though see inflate()) */ #define Z_DEFLATED 8 /* The deflate compression method (the only one supported in this version) */ #define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ #define zlib_version zlibVersion() /* for compatibility with versions < 1.0.2 */ /* basic functions */ ZEXTERN Q_ZEXPORT const char * zlibVersion OF((void)); /* The application can compare zlibVersion and ZLIB_VERSION for consistency. If the first character differs, the library code actually used is not compatible with the zlib.h header file used by the application. This check is automatically made by deflateInit and inflateInit. */ /* ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); Initializes the internal stream state for compression. The fields zalloc, zfree and opaque must be initialized before by the caller. If zalloc and zfree are set to Z_NULL, deflateInit updates them to use default allocation functions. The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: 1 gives best speed, 9 gives best compression, 0 gives no compression at all (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION requests a default compromise between speed and compression (currently equivalent to level 6). deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if level is not a valid compression level, Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible with the version assumed by the caller (ZLIB_VERSION). msg is set to null if there is no error message. deflateInit does not perform any compression: this will be done by deflate(). */ ZEXTERN int Q_ZEXPORT deflate OF((z_streamp strm, int flush)); /* deflate compresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce some output latency (reading input without producing any output) except when forced to flush. The detailed semantics are as follows. deflate performs one or both of the following actions: - Compress more input starting at next_in and update next_in and avail_in accordingly. If not all input can be processed (because there is not enough room in the output buffer), next_in and avail_in are updated and processing will resume at this point for the next call of deflate(). - Provide more output starting at next_out and update next_out and avail_out accordingly. This action is forced if the parameter flush is non zero. Forcing flush frequently degrades the compression ratio, so this parameter should be set only when necessary (in interactive applications). Some output may be provided even if flush is not set. Before the call of deflate(), the application should ensure that at least one of the actions is possible, by providing more input and/or consuming more output, and updating avail_in or avail_out accordingly; avail_out should never be zero before the call. The application can consume the compressed output when it wants, for example when the output buffer is full (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to decide how much data to accumualte before producing output, in order to maximize compression. If the parameter flush is set to Z_SYNC_FLUSH, all pending output is flushed to the output buffer and the output is aligned on a byte boundary, so that the decompressor can get all input data available so far. (In particular avail_in is zero after the call if enough output space has been provided before the call.) Flushing may degrade compression for some compression algorithms and so it should be used only when necessary. If flush is set to Z_FULL_FLUSH, all output is flushed as with Z_SYNC_FLUSH, and the compression state is reset so that decompression can restart from this point if previous compressed data has been damaged or if random access is desired. Using Z_FULL_FLUSH too often can seriously degrade compression. If deflate returns with avail_out == 0, this function must be called again with the same value of the flush parameter and more output space (updated avail_out), until the flush is complete (deflate returns with non-zero avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that avail_out is greater than six to avoid repeated flush markers due to avail_out == 0 on return. If the parameter flush is set to Z_FINISH, pending input is processed, pending output is flushed and deflate returns with Z_STREAM_END if there was enough output space; if deflate returns with Z_OK, this function must be called again with Z_FINISH and more output space (updated avail_out) but no more input data, until it returns with Z_STREAM_END or an error. After deflate has returned Z_STREAM_END, the only possible operations on the stream are deflateReset or deflateEnd. Z_FINISH can be used immediately after deflateInit if all the compression is to be done in a single step. In this case, avail_out must be at least the value returned by deflateBound (see below). If deflate does not return Z_STREAM_END, then it must be called again as described above. deflate() sets strm->adler to the adler32 checksum of all input read so far (that is, total_in bytes). deflate() may update strm->data_type if it can make a good guess about the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered binary. This field is only for information purposes and does not affect the compression algorithm in any manner. deflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if all input has been consumed and all output has been produced (only when flush is set to Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and deflate() can be called again with more input and more output space to continue compressing. */ ZEXTERN int Q_ZEXPORT deflateEnd OF((z_streamp strm)); /* All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending output. deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state was inconsistent, Z_DATA_ERROR if the stream was freed prematurely (some input or output was discarded). In the error case, msg may be set but then points to a static string (which must not be deallocated). */ /* ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); Initializes the internal stream state for decompression. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by the caller. If next_in is not Z_NULL and avail_in is large enough (the exact value depends on the compression method), inflateInit determines the compression method from the zlib header and allocates all data structures accordingly; otherwise the allocation will be deferred to the first call of inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to use default allocation functions. inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the version assumed by the caller. msg is set to null if there is no error message. inflateInit does not perform any decompression apart from reading the zlib header if present: this will be done by inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unchanged.) */ ZEXTERN int Q_ZEXPORT inflate OF((z_streamp strm, int flush)); /* inflate decompresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce some output latency (reading input without producing any output) except when forced to flush. The detailed semantics are as follows. inflate performs one or both of the following actions: - Decompress more input starting at next_in and update next_in and avail_in accordingly. If not all input can be processed (because there is not enough room in the output buffer), next_in is updated and processing will resume at this point for the next call of inflate(). - Provide more output starting at next_out and update next_out and avail_out accordingly. inflate() provides as much output as possible, until there is no more input data or no more space in the output buffer (see below about the flush parameter). Before the call of inflate(), the application should ensure that at least one of the actions is possible, by providing more input and/or consuming more output, and updating the next_* and avail_* values accordingly. The application can consume the uncompressed output when it wants, for example when the output buffer is full (avail_out == 0), or after each call of inflate(). If inflate returns Z_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much output as possible to the output buffer. Z_BLOCK requests that inflate() stop if and when it gets to the next deflate block boundary. When decoding the zlib or gzip format, this will cause inflate() to return immediately after the header and before the first block. When doing a raw inflate, inflate() will go ahead and process the first block, and will return when it gets to the end of that block, or when it runs out of data. The Z_BLOCK option assists in appending to or combining deflate streams. Also to assist in this, on return inflate() will set strm->data_type to the number of unused bits in the last byte taken from strm->next_in, plus 64 if inflate() is currently decoding the last block in the deflate stream, plus 128 if inflate() returned immediately after decoding an end-of-block code or decoding the complete header up to just before the first byte of the deflate stream. The end-of-block will not be indicated until all of the uncompressed data from that block has been written to strm->next_out. The number of unused bits may in general be greater than seven, except when bit 7 of data_type is set, in which case the number of unused bits will be less than eight. inflate() should normally be called until it returns Z_STREAM_END or an error. However if all decompression is to be performed in a single step (a single call of inflate), the parameter flush should be set to Z_FINISH. In this case all pending input is processed and all pending output is flushed; avail_out must be large enough to hold all the uncompressed data. (The size of the uncompressed data may have been saved by the compressor for this purpose.) The next operation on this stream must be inflateEnd to deallocate the decompression state. The use of Z_FINISH is never required, but can be used to inform inflate that a faster approach may be used for the single inflate() call. In this implementation, inflate() always flushes as much output as possible to the output buffer, and always uses the faster approach on the first call. So the only effect of the flush parameter in this implementation is on the return value of inflate(), as noted below, or when it returns early because Z_BLOCK is used. If a preset dictionary is needed after this call (see inflateSetDictionary below), inflate sets strm->adler to the adler32 checksum of the dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise it sets strm->adler to the adler32 checksum of all output produced so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described below. At the end of the stream, inflate() checks that its computed adler32 checksum is equal to that saved by the compressor and returns Z_STREAM_END only if the checksum is correct. inflate() will decompress and check either zlib-wrapped or gzip-wrapped deflate data. The header type is detected automatically. Any information contained in the gzip header is not retained, so applications that need that information should instead use raw inflate, see inflateInit2() below, or inflateBack() and perform their own processing of the gzip header and trailer. inflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if the end of the compressed data has been reached and all uncompressed output has been produced, Z_NEED_DICT if a preset dictionary is needed at this point, Z_DATA_ERROR if the input data was corrupted (input stream not conforming to the zlib format or incorrect check value), Z_STREAM_ERROR if the stream structure was inconsistent (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if no progress is possible or if there was not enough room in the output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and inflate() can be called again with more input and more output space to continue decompressing. If Z_DATA_ERROR is returned, the application may then call inflateSync() to look for a good compression block if a partial recovery of the data is desired. */ ZEXTERN int Q_ZEXPORT inflateEnd OF((z_streamp strm)); /* All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending output. inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state was inconsistent. In the error case, msg may be set but then points to a static string (which must not be deallocated). */ /* Advanced functions */ /* The following functions are needed only in some special applications. */ /* ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy)); This is another version of deflateInit with more compression options. The fields next_in, zalloc, zfree and opaque must be initialized before by the caller. The method parameter is the compression method. It must be Z_DEFLATED in this version of the library. The windowBits parameter is the base two logarithm of the window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. Larger values of this parameter result in better compression at the expense of memory usage. The default value is 15 if deflateInit is used instead. windowBits can also be -8..-15 for raw deflate. In this case, -windowBits determines the window size. deflate() will then generate raw deflate data with no zlib header or trailer, and will not compute an adler32 check value. windowBits can also be greater than 15 for optional gzip encoding. Add 16 to windowBits to write a simple gzip header and trailer around the compressed data instead of a zlib wrapper. The gzip header will have no file name, no extra data, no comment, no modification time (set to zero), no header crc, and the operating system will be set to 255 (unknown). If a gzip stream is being written, strm->adler is a crc32 instead of an adler32. The memLevel parameter specifies how much memory should be allocated for the internal compression state. memLevel=1 uses minimum memory but is slow and reduces compression ratio; memLevel=9 uses maximum memory for optimal speed. The default value is 8. See zconf.h for total memory usage as a function of windowBits and memLevel. The strategy parameter is used to tune the compression algorithm. Use the value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no string match), or Z_RLE to limit match distances to one (run-length encoding). Filtered data consists mostly of small values with a somewhat random distribution. In this case, the compression algorithm is tuned to compress them better. The effect of Z_FILTERED is to force more Huffman coding and less string matching; it is somewhat intermediate between Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately. Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications. deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid method). msg is set to null if there is no error message. deflateInit2 does not perform any compression: this will be done by deflate(). */ ZEXTERN int Q_ZEXPORT deflateSetDictionary OF((z_streamp strm, const Bytef *dictionary, uInt dictLength)); /* Initializes the compression dictionary from the given byte sequence without producing any compressed output. This function must be called immediately after deflateInit, deflateInit2 or deflateReset, before any call of deflate. The compressor and decompressor must use exactly the same dictionary (see inflateSetDictionary). The dictionary should consist of strings (byte sequences) that are likely to be encountered later in the data to be compressed, with the most commonly used strings preferably put towards the end of the dictionary. Using a dictionary is most useful when the data to be compressed is short and can be predicted with good accuracy; the data can then be compressed better than with the default empty dictionary. Depending on the size of the compression data structures selected by deflateInit or deflateInit2, a part of the dictionary may in effect be discarded, for example if the dictionary is larger than the window size in deflate or deflate2. Thus the strings most likely to be useful should be put at the end of the dictionary, not at the front. In addition, the current implementation of deflate will use at most the window size minus 262 bytes of the provided dictionary. Upon return of this function, strm->adler is set to the adler32 value of the dictionary; the decompressor may later use this value to determine which dictionary has been used by the compressor. (The adler32 value applies to the whole dictionary even if only a subset of the dictionary is actually used by the compressor.) If a raw deflate was requested, then the adler32 value is not computed and strm->adler is not set. deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a parameter is invalid (such as NULL dictionary) or the stream state is inconsistent (for example if deflate has already been called for this stream or if the compression method is bsort). deflateSetDictionary does not perform any compression: this will be done by deflate(). */ ZEXTERN int Q_ZEXPORT deflateCopy OF((z_streamp dest, z_streamp source)); /* Sets the destination stream as a complete copy of the source stream. This function can be useful when several compression strategies will be tried, for example when there are several ways of pre-processing the input data with a filter. The streams that will be discarded should then be freed by calling deflateEnd. Note that deflateCopy duplicates the internal compression state which can be quite large, so this strategy is slow and can consume lots of memory. deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc being NULL). msg is left unchanged in both source and destination. */ ZEXTERN int Q_ZEXPORT deflateReset OF((z_streamp strm)); /* This function is equivalent to deflateEnd followed by deflateInit, but does not free and reallocate all the internal compression state. The stream will keep the same compression level and any other attributes that may have been set by deflateInit2. deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being NULL). */ ZEXTERN int Q_ZEXPORT deflateParams OF((z_streamp strm, int level, int strategy)); /* Dynamically update the compression level and compression strategy. The interpretation of level and strategy is as in deflateInit2. This can be used to switch between compression and straight copy of the input data, or to switch to a different kind of input data requiring a different strategy. If the compression level is changed, the input available so far is compressed with the old level (and may be flushed); the new level will take effect only at the next call of deflate(). Before the call of deflateParams, the stream state must be set as for a call of deflate(), since the currently available input may have to be compressed and flushed. In particular, strm->avail_out must be non-zero. deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if strm->avail_out was zero. */ ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, int good_length, int max_lazy, int nice_length, int max_chain)); /* Fine tune deflate's internal compression parameters. This should only be used by someone who understands the algorithm used by zlib's deflate for searching for the best matching string, and even then only by the most fanatic optimizer trying to squeeze out the last compressed bit for their specific input data. Read the deflate.c source code for the meaning of the max_lazy, good_length, nice_length, and max_chain parameters. deflateTune() can be called after deflateInit() or deflateInit2(), and returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. */ ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, uLong sourceLen)); /* deflateBound() returns an upper bound on the compressed size after deflation of sourceLen bytes. It must be called after deflateInit() or deflateInit2(). This would be used to allocate an output buffer for deflation in a single pass, and so would be called before deflate(). */ ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, int bits, int value)); /* deflatePrime() inserts bits in the deflate output stream. The intent is that this function is used to start off the deflate output with the bits leftover from a previous deflate stream when appending to it. As such, this function can only be used for raw deflate, and must be used before the first deflate() call after a deflateInit2() or deflateReset(). bits must be less than or equal to 16, and that many of the least significant bits of value will be inserted in the output. deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, gz_headerp head)); /* deflateSetHeader() provides gzip header information for when a gzip stream is requested by deflateInit2(). deflateSetHeader() may be called after deflateInit2() or deflateReset() and before the first call of deflate(). The text, time, os, extra field, name, and comment information in the provided gz_header structure are written to the gzip header (xflag is ignored -- the extra flags are set according to the compression level). The caller must assure that, if not Z_NULL, name and comment are terminated with a zero byte, and that if extra is not Z_NULL, that extra_len bytes are available there. If hcrc is true, a gzip header crc is included. Note that the current versions of the command-line version of gzip (up through version 1.3.x) do not support header crc's, and will report that it is a "multi-part gzip file" and give up. If deflateSetHeader is not used, the default gzip header has text false, the time set to zero, and os set to 255, with no extra, name, or comment fields. The gzip header is returned to the default state by deflateReset(). deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ /* ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, int windowBits)); This is another version of inflateInit with an extra parameter. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by the caller. The windowBits parameter is the base two logarithm of the maximum window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. The default value is 15 if inflateInit is used instead. windowBits must be greater than or equal to the windowBits value provided to deflateInit2() while compressing, or it must be equal to 15 if deflateInit2() was not used. If a compressed stream with a larger window size is given as input, inflate() will return with the error code Z_DATA_ERROR instead of trying to allocate a larger window. windowBits can also be -8..-15 for raw inflate. In this case, -windowBits determines the window size. inflate() will then process raw deflate data, not looking for a zlib or gzip header, not generating a check value, and not looking for any check values for comparison at the end of the stream. This is for use with other formats that use the deflate compressed data format such as zip. Those formats provide their own check values. If a custom format is developed using the raw deflate format for compressed data, it is recommended that a check value such as an adler32 or a crc32 be applied to the uncompressed data as is done in the zlib, gzip, and zip formats. For most applications, the zlib format should be used as is. Note that comments above on the use in deflateInit2() applies to the magnitude of windowBits. windowBits can also be greater than 15 for optional gzip decoding. Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection, or add 16 to decode only the gzip format (the zlib format will return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a crc32 instead of an adler32. inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg is set to null if there is no error message. inflateInit2 does not perform any decompression apart from reading the zlib header if present: this will be done by inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unchanged.) */ ZEXTERN int Q_ZEXPORT inflateSetDictionary OF((z_streamp strm, const Bytef *dictionary, uInt dictLength)); /* Initializes the decompression dictionary from the given uncompressed byte sequence. This function must be called immediately after a call of inflate, if that call returned Z_NEED_DICT. The dictionary chosen by the compressor can be determined from the adler32 value returned by that call of inflate. The compressor and decompressor must use exactly the same dictionary (see deflateSetDictionary). For raw inflate, this function can be called immediately after inflateInit2() or inflateReset() and before any call of inflate() to set the dictionary. The application must insure that the dictionary that was used for compression is provided. inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a parameter is invalid (such as NULL dictionary) or the stream state is inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the expected one (incorrect adler32 value). inflateSetDictionary does not perform any decompression: this will be done by subsequent calls of inflate(). */ ZEXTERN int Q_ZEXPORT inflateSync OF((z_streamp strm)); /* Skips invalid compressed data until a full flush point (see above the description of deflate with Z_FULL_FLUSH) can be found, or until all available input is skipped. No output is provided. inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the success case, the application may save the current current value of total_in which indicates where valid compressed data was found. In the error case, the application may repeatedly call inflateSync, providing more input each time, until success or end of the input data. */ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, z_streamp source)); /* Sets the destination stream as a complete copy of the source stream. This function can be useful when randomly accessing a large stream. The first pass through the stream can periodically record the inflate state, allowing restarting inflate at those points when randomly accessing the stream. inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc being NULL). msg is left unchanged in both source and destination. */ ZEXTERN int Q_ZEXPORT inflateReset OF((z_streamp strm)); /* This function is equivalent to inflateEnd followed by inflateInit, but does not free and reallocate all the internal decompression state. The stream will keep attributes that may have been set by inflateInit2. inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being NULL). */ ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, int bits, int value)); /* This function inserts bits in the inflate input stream. The intent is that this function is used to start inflating at a bit position in the middle of a byte. The provided bits will be used before any bytes are used from next_in. This function should only be used with raw inflate, and should be used before the first inflate() call after inflateInit2() or inflateReset(). bits must be less than or equal to 16, and that many of the least significant bits of value will be inserted in the input. inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, gz_headerp head)); /* inflateGetHeader() requests that gzip header information be stored in the provided gz_header structure. inflateGetHeader() may be called after inflateInit2() or inflateReset(), and before the first call of inflate(). As inflate() processes the gzip stream, head->done is zero until the header is completed, at which time head->done is set to one. If a zlib stream is being decoded, then head->done is set to -1 to indicate that there will be no gzip header information forthcoming. Note that Z_BLOCK can be used to force inflate() to return immediately after header processing is complete and before any actual data is decompressed. The text, time, xflags, and os fields are filled in with the gzip header contents. hcrc is set to true if there is a header CRC. (The header CRC was valid if done is set to one.) If extra is not Z_NULL, then extra_max contains the maximum number of bytes to write to extra. Once done is true, extra_len contains the actual extra field length, and extra contains the extra field, or that field truncated if extra_max is less than extra_len. If name is not Z_NULL, then up to name_max characters are written there, terminated with a zero unless the length is greater than name_max. If comment is not Z_NULL, then up to comm_max characters are written there, terminated with a zero unless the length is greater than comm_max. When any of extra, name, or comment are not Z_NULL and the respective field is not present in the header, then that field is set to Z_NULL to signal its absence. This allows the use of deflateSetHeader() with the returned structure to duplicate the header. However if those fields are set to allocated memory, then the application will need to save those pointers elsewhere so that they can be eventually freed. If inflateGetHeader is not used, then the header information is simply discarded. The header is always checked for validity, including the header CRC if present. inflateReset() will reset the process to discard the header information. The application would need to call inflateGetHeader() again to retrieve the header from the next gzip stream. inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ /* ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, unsigned char FAR *window)); Initialize the internal stream state for decompression using inflateBack() calls. The fields zalloc, zfree and opaque in strm must be initialized before the call. If zalloc and zfree are Z_NULL, then the default library- derived memory allocation routines are used. windowBits is the base two logarithm of the window size, in the range 8..15. window is a caller supplied buffer of that size. Except for special applications where it is assured that deflate was used with small window sizes, windowBits must be 15 and a 32K byte window must be supplied to be able to decompress general deflate streams. See inflateBack() for the usage of these routines. inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of the paramaters are invalid, Z_MEM_ERROR if the internal state could not be allocated, or Z_VERSION_ERROR if the version of the library does not match the version of the header file. */ typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, in_func in, void FAR *in_desc, out_func out, void FAR *out_desc)); /* inflateBack() does a raw inflate with a single call using a call-back interface for input and output. This is more efficient than inflate() for file i/o applications in that it avoids copying between the output and the sliding window by simply making the window itself the output buffer. This function trusts the application to not change the output buffer passed by the output function, at least until inflateBack() returns. inflateBackInit() must be called first to allocate the internal state and to initialize the state with the user-provided window buffer. inflateBack() may then be used multiple times to inflate a complete, raw deflate stream with each call. inflateBackEnd() is then called to free the allocated state. A raw deflate stream is one with no zlib or gzip header or trailer. This routine would normally be used in a utility that reads zip or gzip files and writes out uncompressed files. The utility would decode the header and process the trailer on its own, hence this routine expects only the raw deflate stream to decompress. This is different from the normal behavior of inflate(), which expects either a zlib or gzip header and trailer around the deflate stream. inflateBack() uses two subroutines supplied by the caller that are then called by inflateBack() for input and output. inflateBack() calls those routines until it reads a complete deflate stream and writes out all of the uncompressed data, or until it encounters an error. The function's parameters and return types are defined above in the in_func and out_func typedefs. inflateBack() will call in(in_desc, &buf) which should return the number of bytes of provided input, and a pointer to that input in buf. If there is no input available, in() must return zero--buf is ignored in that case--and inflateBack() will return a buffer error. inflateBack() will call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() should return zero on success, or non-zero on failure. If out() returns non-zero, inflateBack() will return with an error. Neither in() nor out() are permitted to change the contents of the window provided to inflateBackInit(), which is also the buffer that out() uses to write from. The length written by out() will be at most the window size. Any non-zero amount of input may be provided by in(). For convenience, inflateBack() can be provided input on the first call by setting strm->next_in and strm->avail_in. If that input is exhausted, then in() will be called. Therefore strm->next_in must be initialized before calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in must also be initialized, and then if strm->avail_in is not zero, input will initially be taken from strm->next_in[0 .. strm->avail_in - 1]. The in_desc and out_desc parameters of inflateBack() is passed as the first parameter of in() and out() respectively when they are called. These descriptors can be optionally used to pass any information that the caller- supplied in() and out() functions need to do their job. On return, inflateBack() will set strm->next_in and strm->avail_in to pass back any unused input that was provided by the last in() call. The return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR if in() or out() returned an error, Z_DATA_ERROR if there was a format error in the deflate stream (in which case strm->msg is set to indicate the nature of the error), or Z_STREAM_ERROR if the stream was not properly initialized. In the case of Z_BUF_ERROR, an input or output error can be distinguished using strm->next_in which will be Z_NULL only if in() returned an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to out() returning non-zero. (in() will always be called before out(), so strm->next_in is assured to be defined if out() returns non-zero.) Note that inflateBack() cannot return Z_OK. */ ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); /* All memory allocated by inflateBackInit() is freed. inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream state was inconsistent. */ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); /* Return flags indicating compile-time options. Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: 1.0: size of uInt 3.2: size of uLong 5.4: size of voidpf (pointer) 7.6: size of z_off_t Compiler, assembler, and debug options: 8: DEBUG 9: ASMV or ASMINF -- use ASM code 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention 11: 0 (reserved) One-time table building (smaller code, but not thread-safe if true): 12: BUILDFIXED -- build static block decoding tables when needed 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed 14,15: 0 (reserved) Library content (indicates missing functionality): 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking deflate code when not needed) 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect and decode gzip streams (to avoid linking crc code) 18-19: 0 (reserved) Operation variations (changes in library functionality): 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate 21: FASTEST -- deflate algorithm with only one, lowest compression level 22,23: 0 (reserved) The sprintf variant used by gzprintf (zero is best): 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! 26: 0 = returns value, 1 = void -- 1 means inferred string length returned Remainder: 27-31: 0 (reserved) */ /* utility functions */ /* The following utility functions are implemented on top of the basic stream-oriented functions. To simplify the interface, some default options are assumed (compression level and memory usage, standard memory allocation functions). The source code of these utility functions can easily be modified if you need special options. */ ZEXTERN int Q_ZEXPORT compress OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)); /* Compresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be at least the value returned by compressBound(sourceLen). Upon exit, destLen is the actual size of the compressed buffer. This function can be used to compress a whole file at once if the input file is mmap'ed. compress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer. */ ZEXTERN int Q_ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level)); /* Compresses the source buffer into the destination buffer. The level parameter has the same meaning as in deflateInit. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be at least the value returned by compressBound(sourceLen). Upon exit, destLen is the actual size of the compressed buffer. compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, Z_STREAM_ERROR if the level parameter is invalid. */ ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); /* compressBound() returns an upper bound on the compressed size after compress() or compress2() on sourceLen bytes. It would be used before a compress() or compress2() call to allocate the destination buffer. */ ZEXTERN int Q_ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)); /* Decompresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be large enough to hold the entire uncompressed data. (The size of the uncompressed data must have been saved previously by the compressor and transmitted to the decompressor by some mechanism outside the scope of this compression library.) Upon exit, destLen is the actual size of the compressed buffer. This function can be used to decompress a whole file at once if the input file is mmap'ed. uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. */ typedef voidp gzFile; ZEXTERN gzFile Q_ZEXPORT gzopen OF((const char *path, const char *mode)); /* Opens a gzip (.gz) file for reading or writing. The mode parameter is as in fopen ("rb" or "wb") but can also include a compression level ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman only compression as in "wb1h", or 'R' for run-length encoding as in "wb1R". (See the description of deflateInit2 for more information about the strategy parameter.) gzopen can be used to read a file which is not in gzip format; in this case gzread will directly read from the file without decompression. gzopen returns NULL if the file could not be opened or if there was insufficient memory to allocate the (de)compression state; errno can be checked to distinguish the two cases (if errno is zero, the zlib error is Z_MEM_ERROR). */ ZEXTERN gzFile Q_ZEXPORT gzdopen OF((int fd, const char *mode)); /* gzdopen() associates a gzFile with the file descriptor fd. File descriptors are obtained from calls like open, dup, creat, pipe or fileno (in the file has been previously opened with fopen). The mode parameter is as in gzopen. The next call of gzclose on the returned gzFile will also close the file descriptor fd, just like fclose(fdopen(fd), mode) closes the file descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). gzdopen returns NULL if there was insufficient memory to allocate the (de)compression state. */ ZEXTERN int Q_ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); /* Dynamically update the compression level or strategy. See the description of deflateInit2 for the meaning of these parameters. gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not opened for writing. */ ZEXTERN int Q_ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); /* Reads the given number of uncompressed bytes from the compressed file. If the input file was not in gzip format, gzread copies the given number of bytes into the buffer. gzread returns the number of uncompressed bytes actually read (0 for end of file, -1 for error). */ ZEXTERN int Q_ZEXPORT gzwrite OF((gzFile file, voidpc buf, unsigned len)); /* Writes the given number of uncompressed bytes into the compressed file. gzwrite returns the number of uncompressed bytes actually written (0 in case of error). */ ZEXTERN int Q_ZEXPORT gzprintf OF((gzFile file, const char *format, ...)); /* Converts, formats, and writes the args to the compressed file under control of the format string, as in fprintf. gzprintf returns the number of uncompressed bytes actually written (0 in case of error). The number of uncompressed bytes written is limited to 4095. The caller should assure that this limit is not exceeded. If it is exceeded, then gzprintf() will return return an error (0) with nothing written. In this case, there may also be a buffer overflow with unpredictable consequences, which is possible only if zlib was compiled with the insecure functions sprintf() or vsprintf() because the secure snprintf() or vsnprintf() functions were not available. */ ZEXTERN int Q_ZEXPORT gzputs OF((gzFile file, const char *s)); /* Writes the given null-terminated string to the compressed file, excluding the terminating null character. gzputs returns the number of characters written, or -1 in case of error. */ ZEXTERN Q_ZEXPORT char * gzgets OF((gzFile file, char *buf, int len)); /* Reads bytes from the compressed file until len-1 characters are read, or a newline character is read and transferred to buf, or an end-of-file condition is encountered. The string is then terminated with a null character. gzgets returns buf, or Z_NULL in case of error. */ ZEXTERN int Q_ZEXPORT gzputc OF((gzFile file, int c)); /* Writes c, converted to an unsigned char, into the compressed file. gzputc returns the value that was written, or -1 in case of error. */ ZEXTERN int Q_ZEXPORT gzgetc OF((gzFile file)); /* Reads one byte from the compressed file. gzgetc returns this byte or -1 in case of end of file or error. */ ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); /* Push one character back onto the stream to be read again later. Only one character of push-back is allowed. gzungetc() returns the character pushed, or -1 on failure. gzungetc() will fail if a character has been pushed but not read yet, or if c is -1. The pushed character will be discarded if the stream is repositioned with gzseek() or gzrewind(). */ ZEXTERN int Q_ZEXPORT gzflush OF((gzFile file, int flush)); /* Flushes all pending output into the compressed file. The parameter flush is as in the deflate() function. The return value is the zlib error number (see function gzerror below). gzflush returns Z_OK if the flush parameter is Z_FINISH and all output could be flushed. gzflush should be called only when strictly necessary because it can degrade compression. */ ZEXTERN z_off_t Q_ZEXPORT gzseek OF((gzFile file, z_off_t offset, int whence)); /* Sets the starting position for the next gzread or gzwrite on the given compressed file. The offset represents a number of bytes in the uncompressed data stream. The whence parameter is defined as in lseek(2); the value SEEK_END is not supported. If the file is opened for reading, this function is emulated but can be extremely slow. If the file is opened for writing, only forward seeks are supported; gzseek then compresses a sequence of zeroes up to the new starting position. gzseek returns the resulting offset location as measured in bytes from the beginning of the uncompressed stream, or -1 in case of error, in particular if the file is opened for writing and the new starting position would be before the current position. */ ZEXTERN int Q_ZEXPORT gzrewind OF((gzFile file)); /* Rewinds the given file. This function is supported only for reading. gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) */ ZEXTERN z_off_t Q_ZEXPORT gztell OF((gzFile file)); /* Returns the starting position for the next gzread or gzwrite on the given compressed file. This position represents a number of bytes in the uncompressed data stream. gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) */ ZEXTERN int Q_ZEXPORT gzeof OF((gzFile file)); /* Returns 1 when EOF has previously been detected reading the given input stream, otherwise zero. */ ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); /* Returns 1 if file is being read directly without decompression, otherwise zero. */ ZEXTERN int Q_ZEXPORT gzclose OF((gzFile file)); /* Flushes all pending output if necessary, closes the compressed file and deallocates all the (de)compression state. The return value is the zlib error number (see function gzerror below). */ ZEXTERN Q_ZEXPORT const char * gzerror OF((gzFile file, int *errnum)); /* Returns the error message for the last error which occurred on the given compressed file. errnum is set to zlib error number. If an error occurred in the file system and not in the compression library, errnum is set to Z_ERRNO and the application may consult errno to get the exact error code. */ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); /* Clears the error and end-of-file flags for file. This is analogous to the clearerr() function in stdio. This is useful for continuing to read a gzip file that is being written concurrently. */ /* checksum functions */ /* These functions are not related to compression but are exported anyway because they might be useful in applications using the compression library. */ ZEXTERN uLong Q_ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); /* Update a running Adler-32 checksum with the bytes buf[0..len-1] and return the updated checksum. If buf is NULL, this function returns the required initial value for the checksum. An Adler-32 checksum is almost as reliable as a CRC32 but can be computed much faster. Usage example: uLong adler = adler32(0L, Z_NULL, 0); while (read_buffer(buffer, length) != EOF) { adler = adler32(adler, buffer, length); } if (adler != original_adler) error(); */ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, z_off_t len2)); /* Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. */ ZEXTERN uLong Q_ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); /* Update a running CRC-32 with the bytes buf[0..len-1] and return the updated CRC-32. If buf is NULL, this function returns the required initial value for the for the crc. Pre- and post-conditioning (one's complement) is performed within this function so it shouldn't be done by the application. Usage example: uLong crc = crc32(0L, Z_NULL, 0); while (read_buffer(buffer, length) != EOF) { crc = crc32(crc, buffer, length); } if (crc != original_crc) error(); */ ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); /* Combine two CRC-32 check values into one. For two sequences of bytes, seq1 and seq2 with lengths len1 and len2, CRC-32 check values were calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and len2. */ /* various hacks, don't look :) */ /* deflateInit and inflateInit are macros to allow checking the zlib version * and the compiler's view of z_stream: */ ZEXTERN int Q_ZEXPORT deflateInit_ OF((z_streamp strm, int level, const char *version, int stream_size)); ZEXTERN int Q_ZEXPORT inflateInit_ OF((z_streamp strm, const char *version, int stream_size)); ZEXTERN int Q_ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, const char *version, int stream_size)); ZEXTERN int Q_ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, const char *version, int stream_size)); ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, unsigned char FAR *window, const char *version, int stream_size)); #define deflateInit(strm, level) \ deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) #define inflateInit(strm) \ inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ (strategy), ZLIB_VERSION, sizeof(z_stream)) #define inflateInit2(strm, windowBits) \ inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) #define inflateBackInit(strm, windowBits, window) \ inflateBackInit_((strm), (windowBits), (window), \ ZLIB_VERSION, sizeof(z_stream)) #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) struct internal_state {int dummy;}; /* hack for buggy compilers */ #endif ZEXTERN Q_ZEXPORT const char * zError OF((int)); ZEXTERN int Q_ZEXPORT inflateSyncPoint OF((z_streamp z)); ZEXTERN Q_ZEXPORT const uLongf * get_crc_table OF((void)); #ifdef __cplusplus } #endif #endif /* ZLIB_H */ ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/adler32.c0000644000175000017500000001071712320517543021521 0ustar mathieumathieu/* adler32.c -- compute the Adler-32 checksum of a data stream * Copyright (C) 1995-2004 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ #define ZLIB_INTERNAL #include "zlib.h" #define BASE 65521UL /* largest prime smaller than 65536 */ #define NMAX 5552 /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ #define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;} #define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); #define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); #define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); #define DO16(buf) DO8(buf,0); DO8(buf,8); /* use NO_DIVIDE if your processor does not do division in hardware */ #ifdef NO_DIVIDE # define MOD(a) \ do { \ if (a >= (BASE << 16)) a -= (BASE << 16); \ if (a >= (BASE << 15)) a -= (BASE << 15); \ if (a >= (BASE << 14)) a -= (BASE << 14); \ if (a >= (BASE << 13)) a -= (BASE << 13); \ if (a >= (BASE << 12)) a -= (BASE << 12); \ if (a >= (BASE << 11)) a -= (BASE << 11); \ if (a >= (BASE << 10)) a -= (BASE << 10); \ if (a >= (BASE << 9)) a -= (BASE << 9); \ if (a >= (BASE << 8)) a -= (BASE << 8); \ if (a >= (BASE << 7)) a -= (BASE << 7); \ if (a >= (BASE << 6)) a -= (BASE << 6); \ if (a >= (BASE << 5)) a -= (BASE << 5); \ if (a >= (BASE << 4)) a -= (BASE << 4); \ if (a >= (BASE << 3)) a -= (BASE << 3); \ if (a >= (BASE << 2)) a -= (BASE << 2); \ if (a >= (BASE << 1)) a -= (BASE << 1); \ if (a >= BASE) a -= BASE; \ } while (0) # define MOD4(a) \ do { \ if (a >= (BASE << 4)) a -= (BASE << 4); \ if (a >= (BASE << 3)) a -= (BASE << 3); \ if (a >= (BASE << 2)) a -= (BASE << 2); \ if (a >= (BASE << 1)) a -= (BASE << 1); \ if (a >= BASE) a -= BASE; \ } while (0) #else # define MOD(a) a %= BASE # define MOD4(a) a %= BASE #endif /* ========================================================================= */ uLong ZEXPORT adler32(adler, buf, len) uLong adler; const Bytef *buf; uInt len; { unsigned long sum2; unsigned n; /* split Adler-32 into component sums */ sum2 = (adler >> 16) & 0xffff; adler &= 0xffff; /* in case user likes doing a byte at a time, keep it fast */ if (len == 1) { adler += buf[0]; if (adler >= BASE) adler -= BASE; sum2 += adler; if (sum2 >= BASE) sum2 -= BASE; return adler | (sum2 << 16); } /* initial Adler-32 value (deferred check for len == 1 speed) */ if (buf == Z_NULL) return 1L; /* in case short lengths are provided, keep it somewhat fast */ if (len < 16) { while (len--) { adler += *buf++; sum2 += adler; } if (adler >= BASE) adler -= BASE; MOD4(sum2); /* only added so many BASE's */ return adler | (sum2 << 16); } /* do length NMAX blocks -- requires just one modulo operation */ while (len >= NMAX) { len -= NMAX; n = NMAX / 16; /* NMAX is divisible by 16 */ do { DO16(buf); /* 16 sums unrolled */ buf += 16; } while (--n); MOD(adler); MOD(sum2); } /* do remaining bytes (less than NMAX, still just one modulo) */ if (len) { /* avoid modulos if none remaining */ while (len >= 16) { len -= 16; DO16(buf); buf += 16; } while (len--) { adler += *buf++; sum2 += adler; } MOD(adler); MOD(sum2); } /* return recombined sums */ return adler | (sum2 << 16); } /* ========================================================================= */ uLong ZEXPORT adler32_combine(adler1, adler2, len2) uLong adler1; uLong adler2; z_off_t len2; { unsigned long sum1; unsigned long sum2; unsigned rem; /* the derivation of this formula is left as an exercise for the reader */ rem = (unsigned)(len2 % BASE); sum1 = adler1 & 0xffff; sum2 = rem * sum1; MOD(sum2); sum1 += (adler2 & 0xffff) + BASE - 1; sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; if (sum1 > BASE) sum1 -= BASE; if (sum1 > BASE) sum1 -= BASE; if (sum2 > (BASE << 1)) sum2 -= (BASE << 1); if (sum2 > BASE) sum2 -= BASE; return sum1 | (sum2 << 16); } ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/inffast.h0000644000175000017500000000062712320517543021723 0ustar mathieumathieu/* inffast.h -- header to use inffast.c * Copyright (C) 1995-2003 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ void inflate_fast OF((z_streamp strm, unsigned start)); ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/inftrees.c0000644000175000017500000003267412320517543022112 0ustar mathieumathieu/* inftrees.c -- generate Huffman trees for efficient decoding * Copyright (C) 1995-2005 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" #include "inftrees.h" #define MAXBITS 15 const char inflate_copyright[] = " inflate 1.2.3 Copyright 1995-2005 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot include such an acknowledgment, I would appreciate that you keep this copyright string in the executable of your product. */ /* Build a set of tables to decode the provided canonical Huffman code. The code lengths are lens[0..codes-1]. The result starts at *table, whose indices are 0..2^bits-1. work is a writable array of at least lens shorts, which is used as a work area. type is the type of code to be generated, CODES, LENS, or DISTS. On return, zero is success, -1 is an invalid code, and +1 means that ENOUGH isn't enough. table on return points to the next available entry's address. bits is the requested root table index bits, and on return it is the actual root table index bits. It will differ if the request is greater than the longest code or if it is less than the shortest code. */ int inflate_table(type, lens, codes, table, bits, work) codetype type; unsigned short FAR *lens; unsigned codes; code FAR * FAR *table; unsigned FAR *bits; unsigned short FAR *work; { unsigned len; /* a code's length in bits */ unsigned sym; /* index of code symbols */ unsigned min, max; /* minimum and maximum code lengths */ unsigned root; /* number of index bits for root table */ unsigned curr; /* number of index bits for current table */ unsigned drop; /* code bits to drop for sub-table */ int left; /* number of prefix codes available */ unsigned used; /* code entries in table used */ unsigned huff; /* Huffman code */ unsigned incr; /* for incrementing code, index */ unsigned fill; /* index for replicating entries */ unsigned low; /* low bits for current root entry */ unsigned mask; /* mask for low root bits */ code this; /* table entry for duplication */ code FAR *next; /* next available space in table */ const unsigned short FAR *base; /* base value table to use */ const unsigned short FAR *extra; /* extra bits table to use */ int end; /* use base and extra for symbol > end */ unsigned short count[MAXBITS+1]; /* number of codes of each length */ unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ static const unsigned short lbase[31] = { /* Length codes 257..285 base */ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 201, 196}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0}; static const unsigned short dext[32] = { /* Distance codes 0..29 extra */ 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64}; /* Process a set of code lengths to create a canonical Huffman code. The code lengths are lens[0..codes-1]. Each length corresponds to the symbols 0..codes-1. The Huffman code is generated by first sorting the symbols by length from short to long, and retaining the symbol order for codes with equal lengths. Then the code starts with all zero bits for the first code of the shortest length, and the codes are integer increments for the same length, and zeros are appended as the length increases. For the deflate format, these bits are stored backwards from their more natural integer increment ordering, and so when the decoding tables are built in the large loop below, the integer codes are incremented backwards. This routine assumes, but does not check, that all of the entries in lens[] are in the range 0..MAXBITS. The caller must assure this. 1..MAXBITS is interpreted as that code length. zero means that that symbol does not occur in this code. The codes are sorted by computing a count of codes for each length, creating from that a table of starting indices for each length in the sorted table, and then entering the symbols in order in the sorted table. The sorted table is work[], with that space being provided by the caller. The length counts are used for other purposes as well, i.e. finding the minimum and maximum length codes, determining if there are any codes at all, checking for a valid set of lengths, and looking ahead at length counts to determine sub-table sizes when building the decoding tables. */ /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ for (len = 0; len <= MAXBITS; len++) count[len] = 0; for (sym = 0; sym < codes; sym++) count[lens[sym]]++; /* bound code lengths, force root to be within code lengths */ root = *bits; for (max = MAXBITS; max >= 1; max--) if (count[max] != 0) break; if (root > max) root = max; if (max == 0) { /* no symbols to code at all */ this.op = (unsigned char)64; /* invalid code marker */ this.bits = (unsigned char)1; this.val = (unsigned short)0; *(*table)++ = this; /* make a table to force an error */ *(*table)++ = this; *bits = 1; return 0; /* no symbols, but wait for decoding to report error */ } for (min = 1; min <= MAXBITS; min++) if (count[min] != 0) break; if (root < min) root = min; /* check for an over-subscribed or incomplete set of lengths */ left = 1; for (len = 1; len <= MAXBITS; len++) { left <<= 1; left -= count[len]; if (left < 0) return -1; /* over-subscribed */ } if (left > 0 && (type == CODES || max != 1)) return -1; /* incomplete set */ /* generate offsets into symbol table for each length for sorting */ offs[1] = 0; for (len = 1; len < MAXBITS; len++) offs[len + 1] = offs[len] + count[len]; /* sort symbols by length, by symbol order within each length */ for (sym = 0; sym < codes; sym++) if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym; /* Create and fill in decoding tables. In this loop, the table being filled is at next and has curr index bits. The code being used is huff with length len. That code is converted to an index by dropping drop bits off of the bottom. For codes where len is less than drop + curr, those top drop + curr - len bits are incremented through all values to fill the table with replicated entries. root is the number of index bits for the root table. When len exceeds root, sub-tables are created pointed to by the root entry with an index of the low root bits of huff. This is saved in low to check for when a new sub-table should be started. drop is zero when the root table is being filled, and drop is root when sub-tables are being filled. When a new sub-table is needed, it is necessary to look ahead in the code lengths to determine what size sub-table is needed. The length counts are used for this, and so count[] is decremented as codes are entered in the tables. used keeps track of how many table entries have been allocated from the provided *table space. It is checked when a LENS table is being made against the space in *table, ENOUGH, minus the maximum space needed by the worst case distance code, MAXD. This should never happen, but the sufficiency of ENOUGH has not been proven exhaustively, hence the check. This assumes that when type == LENS, bits == 9. sym increments through all symbols, and the loop terminates when all codes of length max, i.e. all codes, have been processed. This routine permits incomplete codes, so another loop after this one fills in the rest of the decoding tables with invalid code markers. */ /* set up for code type */ switch (type) { case CODES: base = extra = work; /* dummy value--not used */ end = 19; break; case LENS: base = lbase; base -= 257; extra = lext; extra -= 257; end = 256; break; default: /* DISTS */ base = dbase; extra = dext; end = -1; } /* initialize state for loop */ huff = 0; /* starting code */ sym = 0; /* starting code symbol */ len = min; /* starting code length */ next = *table; /* current table to fill in */ curr = root; /* current table index bits */ drop = 0; /* current bits to drop from code for index */ low = (unsigned)(-1); /* trigger new sub-table when len > root */ used = 1U << root; /* use root table entries */ mask = used - 1; /* mask for comparing low */ /* check available table space */ if (type == LENS && used >= ENOUGH - MAXD) return 1; /* process all codes and make table entries */ for (;;) { /* create table entry */ this.bits = (unsigned char)(len - drop); if ((int)(work[sym]) < end) { this.op = (unsigned char)0; this.val = work[sym]; } else if ((int)(work[sym]) > end) { this.op = (unsigned char)(extra[work[sym]]); this.val = base[work[sym]]; } else { this.op = (unsigned char)(32 + 64); /* end of block */ this.val = 0; } /* replicate for those indices with low len bits equal to huff */ incr = 1U << (len - drop); fill = 1U << curr; min = fill; /* save offset to next table */ do { fill -= incr; next[(huff >> drop) + fill] = this; } while (fill != 0); /* backwards increment the len-bit code huff */ incr = 1U << (len - 1); while (huff & incr) incr >>= 1; if (incr != 0) { huff &= incr - 1; huff += incr; } else huff = 0; /* go to next symbol, update count, len */ sym++; if (--(count[len]) == 0) { if (len == max) break; len = lens[work[sym]]; } /* create new sub-table if needed */ if (len > root && (huff & mask) != low) { /* if first time, transition to sub-tables */ if (drop == 0) drop = root; /* increment past last table */ next += min; /* here min is 1 << curr */ /* determine length of next table */ curr = len - drop; left = (int)(1 << curr); while (curr + drop < max) { left -= count[curr + drop]; if (left <= 0) break; curr++; left <<= 1; } /* check for enough space */ used += 1U << curr; if (type == LENS && used >= ENOUGH - MAXD) return 1; /* point entry in root table to sub-table */ low = huff & mask; (*table)[low].op = (unsigned char)curr; (*table)[low].bits = (unsigned char)root; (*table)[low].val = (unsigned short)(next - *table); } } /* Fill in rest of table for incomplete codes. This loop is similar to the loop above in incrementing huff for table indices. It is assumed that len is equal to curr + drop, so there is no loop needed to increment through high index bits. When the current sub-table is filled, the loop drops back to the root table to fill in any remaining entries there. */ this.op = (unsigned char)64; /* invalid code marker */ this.bits = (unsigned char)(len - drop); this.val = (unsigned short)0; while (huff != 0) { /* when done with sub-table, drop back to root table */ if (drop != 0 && (huff & mask) != low) { drop = 0; len = root; next = *table; this.bits = (unsigned char)len; } /* put invalid code marker in table */ next[huff >> drop] = this; /* backwards increment the len-bit code huff */ incr = 1U << (len - 1); while (huff & incr) incr >>= 1; if (incr != 0) { huff &= incr - 1; huff += incr; } else huff = 0; } /* set return parameters */ *table += used; *bits = root; return 0; } ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/trees.c0000644000175000017500000012577312320517543021420 0ustar mathieumathieu/* trees.c -- output deflated data using Huffman coding * Copyright (C) 1995-2005 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ /* * ALGORITHM * * The "deflation" process uses several Huffman trees. The more * common source values are represented by shorter bit sequences. * * Each code tree is stored in a compressed form which is itself * a Huffman encoding of the lengths of all the code strings (in * ascending order by source values). The actual code strings are * reconstructed from the lengths in the inflate process, as described * in the deflate specification. * * REFERENCES * * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc * * Storer, James A. * Data Compression: Methods and Theory, pp. 49-50. * Computer Science Press, 1988. ISBN 0-7167-8156-5. * * Sedgewick, R. * Algorithms, p290. * Addison-Wesley, 1983. ISBN 0-201-06672-6. */ /* @(#) $Id$ */ /* #define GEN_TREES_H */ #include "deflate.h" #ifdef DEBUG # include #endif /* =========================================================================== * Constants */ #define MAX_BL_BITS 7 /* Bit length codes must not exceed MAX_BL_BITS bits */ #define END_BLOCK 256 /* end of block literal code */ #define REP_3_6 16 /* repeat previous bit length 3-6 times (2 bits of repeat count) */ #define REPZ_3_10 17 /* repeat a zero length 3-10 times (3 bits of repeat count) */ #define REPZ_11_138 18 /* repeat a zero length 11-138 times (7 bits of repeat count) */ local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; local const int extra_dbits[D_CODES] /* extra bits for each distance code */ = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; local const uch bl_order[BL_CODES] = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; /* The lengths of the bit length codes are sent in order of decreasing * probability, to avoid transmitting the lengths for unused bit length codes. */ #define Buf_size (8 * 2*sizeof(char)) /* Number of bits used within bi_buf. (bi_buf might be implemented on * more than 16 bits on some systems.) */ /* =========================================================================== * Local data. These are initialized only once. */ #define DIST_CODE_LEN 512 /* see definition of array dist_code below */ #if defined(GEN_TREES_H) || !defined(STDC) /* non ANSI compilers may not accept trees.h */ local ct_data static_ltree[L_CODES+2]; /* The static literal tree. Since the bit lengths are imposed, there is no * need for the L_CODES extra codes used during heap construction. However * The codes 286 and 287 are needed to build a canonical tree (see _tr_init * below). */ local ct_data static_dtree[D_CODES]; /* The static distance tree. (Actually a trivial tree since all codes use * 5 bits.) */ uch _dist_code[DIST_CODE_LEN]; /* Distance codes. The first 256 values correspond to the distances * 3 .. 258, the last 256 values correspond to the top 8 bits of * the 15 bit distances. */ uch _length_code[MAX_MATCH-MIN_MATCH+1]; /* length code for each normalized match length (0 == MIN_MATCH) */ local int base_length[LENGTH_CODES]; /* First normalized length for each code (0 = MIN_MATCH) */ local int base_dist[D_CODES]; /* First normalized distance for each code (0 = distance of 1) */ #else # include "trees.h" #endif /* GEN_TREES_H */ struct static_tree_desc_s { const ct_data *static_tree; /* static tree or NULL */ const intf *extra_bits; /* extra bits for each code or NULL */ int extra_base; /* base index for extra_bits */ int elems; /* max number of elements in the tree */ int max_length; /* max bit length for the codes */ }; local static_tree_desc static_l_desc = {static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; local static_tree_desc static_d_desc = {static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; local static_tree_desc static_bl_desc = {(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; /* =========================================================================== * Local (static) routines in this file. */ local void tr_static_init OF((void)); local void init_block OF((deflate_state *s)); local void pqdownheap OF((deflate_state *s, ct_data *tree, int k)); local void gen_bitlen OF((deflate_state *s, tree_desc *desc)); local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count)); local void build_tree OF((deflate_state *s, tree_desc *desc)); local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); local int build_bl_tree OF((deflate_state *s)); local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, int blcodes)); local void compress_block OF((deflate_state *s, ct_data *ltree, ct_data *dtree)); local void set_data_type OF((deflate_state *s)); local unsigned bi_reverse OF((unsigned value, int length)); local void bi_windup OF((deflate_state *s)); local void bi_flush OF((deflate_state *s)); local void copy_block OF((deflate_state *s, charf *buf, unsigned len, int header)); #ifdef GEN_TREES_H local void gen_trees_header OF((void)); #endif #ifndef DEBUG # define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) /* Send a code of the given tree. c and tree must not have side effects */ #else /* DEBUG */ # define send_code(s, c, tree) \ { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ send_bits(s, tree[c].Code, tree[c].Len); } #endif /* =========================================================================== * Output a short LSB first on the stream. * IN assertion: there is enough room in pendingBuf. */ #define put_short(s, w) { \ put_byte(s, (uch)((w) & 0xff)); \ put_byte(s, (uch)((ush)(w) >> 8)); \ } /* =========================================================================== * Send a value on a given number of bits. * IN assertion: length <= 16 and value fits in length bits. */ #ifdef DEBUG local void send_bits OF((deflate_state *s, int value, int length)); local void send_bits(s, value, length) deflate_state *s; int value; /* value to send */ int length; /* number of bits */ { Tracevv((stderr," l %2d v %4x ", length, value)); Assert(length > 0 && length <= 15, "invalid length"); s->bits_sent += (ulg)length; /* If not enough room in bi_buf, use (valid) bits from bi_buf and * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) * unused bits in value. */ if (s->bi_valid > (int)Buf_size - length) { s->bi_buf |= (value << s->bi_valid); put_short(s, s->bi_buf); s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); s->bi_valid += length - Buf_size; } else { s->bi_buf |= value << s->bi_valid; s->bi_valid += length; } } #else /* !DEBUG */ #define send_bits(s, value, length) \ { int len = length;\ if (s->bi_valid > (int)Buf_size - len) {\ int val = value;\ s->bi_buf |= (val << s->bi_valid);\ put_short(s, s->bi_buf);\ s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ s->bi_valid += len - Buf_size;\ } else {\ s->bi_buf |= (value) << s->bi_valid;\ s->bi_valid += len;\ }\ } #endif /* DEBUG */ /* the arguments must not have side effects */ /* =========================================================================== * Initialize the various 'constant' tables. */ local void tr_static_init() { #if defined(GEN_TREES_H) || !defined(STDC) static int static_init_done = 0; int n; /* iterates over tree elements */ int bits; /* bit counter */ int length; /* length value */ int code; /* code value */ int dist; /* distance index */ ush bl_count[MAX_BITS+1]; /* number of codes at each bit length for an optimal tree */ if (static_init_done) return; /* For some embedded targets, global variables are not initialized: */ static_l_desc.static_tree = static_ltree; static_l_desc.extra_bits = extra_lbits; static_d_desc.static_tree = static_dtree; static_d_desc.extra_bits = extra_dbits; static_bl_desc.extra_bits = extra_blbits; /* Initialize the mapping length (0..255) -> length code (0..28) */ length = 0; for (code = 0; code < LENGTH_CODES-1; code++) { base_length[code] = length; for (n = 0; n < (1< dist code (0..29) */ dist = 0; for (code = 0 ; code < 16; code++) { base_dist[code] = dist; for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ for ( ; code < D_CODES; code++) { base_dist[code] = dist << 7; for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { _dist_code[256 + dist++] = (uch)code; } } Assert (dist == 256, "tr_static_init: 256+dist != 512"); /* Construct the codes of the static literal tree */ for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; n = 0; while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; /* Codes 286 and 287 do not exist, but we must include them in the * tree construction to get a canonical Huffman tree (longest code * all ones) */ gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); /* The static distance tree is trivial: */ for (n = 0; n < D_CODES; n++) { static_dtree[n].Len = 5; static_dtree[n].Code = bi_reverse((unsigned)n, 5); } static_init_done = 1; # ifdef GEN_TREES_H gen_trees_header(); # endif #endif /* defined(GEN_TREES_H) || !defined(STDC) */ } /* =========================================================================== * Genererate the file trees.h describing the static trees. */ #ifdef GEN_TREES_H # ifndef DEBUG # include # endif # define SEPARATOR(i, last, width) \ ((i) == (last)? "\n};\n\n" : \ ((i) % (width) == (width)-1 ? ",\n" : ", ")) void gen_trees_header() { FILE *header = fopen("trees.h", "w"); int i; Assert (header != NULL, "Can't open trees.h"); fprintf(header, "/* header created automatically with -DGEN_TREES_H */\n\n"); fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); for (i = 0; i < L_CODES+2; i++) { fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); } fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); for (i = 0; i < D_CODES; i++) { fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); } fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n"); for (i = 0; i < DIST_CODE_LEN; i++) { fprintf(header, "%2u%s", _dist_code[i], SEPARATOR(i, DIST_CODE_LEN-1, 20)); } fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { fprintf(header, "%2u%s", _length_code[i], SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); } fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); for (i = 0; i < LENGTH_CODES; i++) { fprintf(header, "%1u%s", base_length[i], SEPARATOR(i, LENGTH_CODES-1, 20)); } fprintf(header, "local const int base_dist[D_CODES] = {\n"); for (i = 0; i < D_CODES; i++) { fprintf(header, "%5u%s", base_dist[i], SEPARATOR(i, D_CODES-1, 10)); } fclose(header); } #endif /* GEN_TREES_H */ /* =========================================================================== * Initialize the tree data structures for a new zlib stream. */ void _tr_init(s) deflate_state *s; { tr_static_init(); s->l_desc.dyn_tree = s->dyn_ltree; s->l_desc.stat_desc = &static_l_desc; s->d_desc.dyn_tree = s->dyn_dtree; s->d_desc.stat_desc = &static_d_desc; s->bl_desc.dyn_tree = s->bl_tree; s->bl_desc.stat_desc = &static_bl_desc; s->bi_buf = 0; s->bi_valid = 0; s->last_eob_len = 8; /* enough lookahead for inflate */ #ifdef DEBUG s->compressed_len = 0L; s->bits_sent = 0L; #endif /* Initialize the first block of the first file: */ init_block(s); } /* =========================================================================== * Initialize a new block. */ local void init_block(s) deflate_state *s; { int n; /* iterates over tree elements */ /* Initialize the trees. */ for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; s->dyn_ltree[END_BLOCK].Freq = 1; s->opt_len = s->static_len = 0L; s->last_lit = s->matches = 0; } #define SMALLEST 1 /* Index within the heap array of least frequent node in the Huffman tree */ /* =========================================================================== * Remove the smallest element from the heap and recreate the heap with * one less element. Updates heap and heap_len. */ #define pqremove(s, tree, top) \ {\ top = s->heap[SMALLEST]; \ s->heap[SMALLEST] = s->heap[s->heap_len--]; \ pqdownheap(s, tree, SMALLEST); \ } /* =========================================================================== * Compares to subtrees, using the tree depth as tie breaker when * the subtrees have equal frequency. This minimizes the worst case length. */ #define smaller(tree, n, m, depth) \ (tree[n].Freq < tree[m].Freq || \ (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) /* =========================================================================== * Restore the heap property by moving down the tree starting at node k, * exchanging a node with the smallest of its two sons if necessary, stopping * when the heap property is re-established (each father smaller than its * two sons). */ local void pqdownheap(s, tree, k) deflate_state *s; ct_data *tree; /* the tree to restore */ int k; /* node to move down */ { int v = s->heap[k]; int j = k << 1; /* left son of k */ while (j <= s->heap_len) { /* Set j to the smallest of the two sons: */ if (j < s->heap_len && smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { j++; } /* Exit if v is smaller than both sons */ if (smaller(tree, v, s->heap[j], s->depth)) break; /* Exchange v with the smallest son */ s->heap[k] = s->heap[j]; k = j; /* And continue down the tree, setting j to the left son of k */ j <<= 1; } s->heap[k] = v; } /* =========================================================================== * Compute the optimal bit lengths for a tree and update the total bit length * for the current block. * IN assertion: the fields freq and dad are set, heap[heap_max] and * above are the tree nodes sorted by increasing frequency. * OUT assertions: the field len is set to the optimal bit length, the * array bl_count contains the frequencies for each bit length. * The length opt_len is updated; static_len is also updated if stree is * not null. */ local void gen_bitlen(s, desc) deflate_state *s; tree_desc *desc; /* the tree descriptor */ { ct_data *tree = desc->dyn_tree; int max_code = desc->max_code; const ct_data *stree = desc->stat_desc->static_tree; const intf *extra = desc->stat_desc->extra_bits; int base = desc->stat_desc->extra_base; int max_length = desc->stat_desc->max_length; int h; /* heap index */ int n, m; /* iterate over the tree elements */ int bits; /* bit length */ int xbits; /* extra bits */ ush f; /* frequency */ int overflow = 0; /* number of elements with bit length too large */ for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; /* In a first pass, compute the optimal bit lengths (which may * overflow in the case of the bit length tree). */ tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ for (h = s->heap_max+1; h < HEAP_SIZE; h++) { n = s->heap[h]; bits = tree[tree[n].Dad].Len + 1; if (bits > max_length) bits = max_length, overflow++; tree[n].Len = (ush)bits; /* We overwrite tree[n].Dad which is no longer needed */ if (n > max_code) continue; /* not a leaf node */ s->bl_count[bits]++; xbits = 0; if (n >= base) xbits = extra[n-base]; f = tree[n].Freq; s->opt_len += (ulg)f * (bits + xbits); if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits); } if (overflow == 0) return; Trace((stderr,"\nbit length overflow\n")); /* This happens for example on obj2 and pic of the Calgary corpus */ /* Find the first bit length which could increase: */ do { bits = max_length-1; while (s->bl_count[bits] == 0) bits--; s->bl_count[bits]--; /* move one leaf down the tree */ s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ s->bl_count[max_length]--; /* The brother of the overflow item also moves one step up, * but this does not affect bl_count[max_length] */ overflow -= 2; } while (overflow > 0); /* Now recompute all bit lengths, scanning in increasing frequency. * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all * lengths instead of fixing only the wrong ones. This idea is taken * from 'ar' written by Haruhiko Okumura.) */ for (bits = max_length; bits != 0; bits--) { n = s->bl_count[bits]; while (n != 0) { m = s->heap[--h]; if (m > max_code) continue; if ((unsigned) tree[m].Len != (unsigned) bits) { Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); s->opt_len += ((long)bits - (long)tree[m].Len) *(long)tree[m].Freq; tree[m].Len = (ush)bits; } n--; } } } /* =========================================================================== * Generate the codes for a given tree and bit counts (which need not be * optimal). * IN assertion: the array bl_count contains the bit length statistics for * the given tree and the field len is set for all tree elements. * OUT assertion: the field code is set for all tree elements of non * zero code length. */ local void gen_codes (tree, max_code, bl_count) ct_data *tree; /* the tree to decorate */ int max_code; /* largest code with non zero frequency */ ushf *bl_count; /* number of codes at each bit length */ { ush next_code[MAX_BITS+1]; /* next code value for each bit length */ ush code = 0; /* running code value */ int bits; /* bit index */ int n; /* code index */ /* The distribution counts are first used to generate the code values * without bit reversal. */ for (bits = 1; bits <= MAX_BITS; bits++) { next_code[bits] = code = (code + bl_count[bits-1]) << 1; } /* Check that the bit counts in bl_count are consistent. The last code * must be all ones. */ Assert (code + bl_count[MAX_BITS]-1 == (1<dyn_tree; const ct_data *stree = desc->stat_desc->static_tree; int elems = desc->stat_desc->elems; int n, m; /* iterate over heap elements */ int max_code = -1; /* largest code with non zero frequency */ int node; /* new node being created */ /* Construct the initial heap, with least frequent element in * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. * heap[0] is not used. */ s->heap_len = 0, s->heap_max = HEAP_SIZE; for (n = 0; n < elems; n++) { if (tree[n].Freq != 0) { s->heap[++(s->heap_len)] = max_code = n; s->depth[n] = 0; } else { tree[n].Len = 0; } } /* The pkzip format requires that at least one distance code exists, * and that at least one bit should be sent even if there is only one * possible code. So to avoid special checks later on we force at least * two codes of non zero frequency. */ while (s->heap_len < 2) { node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); tree[node].Freq = 1; s->depth[node] = 0; s->opt_len--; if (stree) s->static_len -= stree[node].Len; /* node is 0 or 1 so it does not have extra bits */ } desc->max_code = max_code; /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, * establish sub-heaps of increasing lengths: */ for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); /* Construct the Huffman tree by repeatedly combining the least two * frequent nodes. */ node = elems; /* next internal node of the tree */ do { pqremove(s, tree, n); /* n = node of least frequency */ m = s->heap[SMALLEST]; /* m = node of next least frequency */ s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ s->heap[--(s->heap_max)] = m; /* Create a new node father of n and m */ tree[node].Freq = tree[n].Freq + tree[m].Freq; s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? s->depth[n] : s->depth[m]) + 1); tree[n].Dad = tree[m].Dad = (ush)node; #ifdef DUMP_BL_TREE if (tree == s->bl_tree) { fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); } #endif /* and insert the new node in the heap */ s->heap[SMALLEST] = node++; pqdownheap(s, tree, SMALLEST); } while (s->heap_len >= 2); s->heap[--(s->heap_max)] = s->heap[SMALLEST]; /* At this point, the fields freq and dad are set. We can now * generate the bit lengths. */ gen_bitlen(s, (tree_desc *)desc); /* The field len is now set, we can generate the bit codes */ gen_codes ((ct_data *)tree, max_code, s->bl_count); } /* =========================================================================== * Scan a literal or distance tree to determine the frequencies of the codes * in the bit length tree. */ local void scan_tree (s, tree, max_code) deflate_state *s; ct_data *tree; /* the tree to be scanned */ int max_code; /* and its largest code of non zero frequency */ { int n; /* iterates over all tree elements */ int prevlen = -1; /* last emitted length */ int curlen; /* length of current code */ int nextlen = tree[0].Len; /* length of next code */ int count = 0; /* repeat count of the current code */ int max_count = 7; /* max repeat count */ int min_count = 4; /* min repeat count */ if (nextlen == 0) max_count = 138, min_count = 3; tree[max_code+1].Len = (ush)0xffff; /* guard */ for (n = 0; n <= max_code; n++) { curlen = nextlen; nextlen = tree[n+1].Len; if (++count < max_count && curlen == nextlen) { continue; } else if (count < min_count) { s->bl_tree[curlen].Freq += count; } else if (curlen != 0) { if (curlen != prevlen) s->bl_tree[curlen].Freq++; s->bl_tree[REP_3_6].Freq++; } else if (count <= 10) { s->bl_tree[REPZ_3_10].Freq++; } else { s->bl_tree[REPZ_11_138].Freq++; } count = 0; prevlen = curlen; if (nextlen == 0) { max_count = 138, min_count = 3; } else if (curlen == nextlen) { max_count = 6, min_count = 3; } else { max_count = 7, min_count = 4; } } } /* =========================================================================== * Send a literal or distance tree in compressed form, using the codes in * bl_tree. */ local void send_tree (s, tree, max_code) deflate_state *s; ct_data *tree; /* the tree to be scanned */ int max_code; /* and its largest code of non zero frequency */ { int n; /* iterates over all tree elements */ int prevlen = -1; /* last emitted length */ int curlen; /* length of current code */ int nextlen = tree[0].Len; /* length of next code */ int count = 0; /* repeat count of the current code */ int max_count = 7; /* max repeat count */ int min_count = 4; /* min repeat count */ /* tree[max_code+1].Len = -1; */ /* guard already set */ if (nextlen == 0) max_count = 138, min_count = 3; for (n = 0; n <= max_code; n++) { curlen = nextlen; nextlen = tree[n+1].Len; if (++count < max_count && curlen == nextlen) { continue; } else if (count < min_count) { do { send_code(s, curlen, s->bl_tree); } while (--count != 0); } else if (curlen != 0) { if (curlen != prevlen) { send_code(s, curlen, s->bl_tree); count--; } Assert(count >= 3 && count <= 6, " 3_6?"); send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); } else if (count <= 10) { send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); } else { send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); } count = 0; prevlen = curlen; if (nextlen == 0) { max_count = 138, min_count = 3; } else if (curlen == nextlen) { max_count = 6, min_count = 3; } else { max_count = 7, min_count = 4; } } } /* =========================================================================== * Construct the Huffman tree for the bit lengths and return the index in * bl_order of the last bit length code to send. */ local int build_bl_tree(s) deflate_state *s; { int max_blindex; /* index of last bit length code of non zero freq */ /* Determine the bit length frequencies for literal and distance trees */ scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); /* Build the bit length tree: */ build_tree(s, (tree_desc *)(&(s->bl_desc))); /* opt_len now includes the length of the tree representations, except * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. */ /* Determine the number of bit length codes to send. The pkzip format * requires that at least 4 bit length codes be sent. (appnote.txt says * 3 but the actual value used is 4.) */ for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; } /* Update opt_len to include the bit length tree and counts */ s->opt_len += 3*(max_blindex+1) + 5+5+4; Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", s->opt_len, s->static_len)); return max_blindex; } /* =========================================================================== * Send the header for a block using dynamic Huffman trees: the counts, the * lengths of the bit length codes, the literal tree and the distance tree. * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. */ local void send_all_trees(s, lcodes, dcodes, blcodes) deflate_state *s; int lcodes, dcodes, blcodes; /* number of codes for each tree */ { int rank; /* index in bl_order */ Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, "too many codes"); Tracev((stderr, "\nbl counts: ")); send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ send_bits(s, dcodes-1, 5); send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ for (rank = 0; rank < blcodes; rank++) { Tracev((stderr, "\nbl code %2d ", bl_order[rank])); send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); } Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); } /* =========================================================================== * Send a stored block */ void _tr_stored_block(s, buf, stored_len, eof) deflate_state *s; charf *buf; /* input block */ ulg stored_len; /* length of input block */ int eof; /* true if this is the last block for a file */ { send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */ #ifdef DEBUG s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; s->compressed_len += (stored_len + 4) << 3; #endif copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ } /* =========================================================================== * Send one empty static block to give enough lookahead for inflate. * This takes 10 bits, of which 7 may remain in the bit buffer. * The current inflate code requires 9 bits of lookahead. If the * last two codes for the previous block (real code plus EOB) were coded * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode * the last real code. In this case we send two empty static blocks instead * of one. (There are no problems if the previous block is stored or fixed.) * To simplify the code, we assume the worst case of last real code encoded * on one bit only. */ void _tr_align(s) deflate_state *s; { send_bits(s, STATIC_TREES<<1, 3); send_code(s, END_BLOCK, static_ltree); #ifdef DEBUG s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ #endif bi_flush(s); /* Of the 10 bits for the empty block, we have already sent * (10 - bi_valid) bits. The lookahead for the last real code (before * the EOB of the previous block) was thus at least one plus the length * of the EOB plus what we have just sent of the empty static block. */ if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { send_bits(s, STATIC_TREES<<1, 3); send_code(s, END_BLOCK, static_ltree); #ifdef DEBUG s->compressed_len += 10L; #endif bi_flush(s); } s->last_eob_len = 7; } /* =========================================================================== * Determine the best encoding for the current block: dynamic trees, static * trees or store, and output the encoded block to the zip file. */ void _tr_flush_block(s, buf, stored_len, eof) deflate_state *s; charf *buf; /* input block, or NULL if too old */ ulg stored_len; /* length of input block */ int eof; /* true if this is the last block for a file */ { ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ int max_blindex = 0; /* index of last bit length code of non zero freq */ /* Build the Huffman trees unless a stored block is forced */ if (s->level > 0) { /* Check if the file is binary or text */ if (stored_len > 0 && s->strm->data_type == Z_UNKNOWN) set_data_type(s); /* Construct the literal and distance trees */ build_tree(s, (tree_desc *)(&(s->l_desc))); Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, s->static_len)); build_tree(s, (tree_desc *)(&(s->d_desc))); Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, s->static_len)); /* At this point, opt_len and static_len are the total bit lengths of * the compressed block data, excluding the tree representations. */ /* Build the bit length tree for the above two trees, and get the index * in bl_order of the last bit length code to send. */ max_blindex = build_bl_tree(s); /* Determine the best encoding. Compute the block lengths in bytes. */ opt_lenb = (s->opt_len+3+7)>>3; static_lenb = (s->static_len+3+7)>>3; Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, s->last_lit)); if (static_lenb <= opt_lenb) opt_lenb = static_lenb; } else { Assert(buf != (char*)0, "lost buf"); opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ } #ifdef FORCE_STORED if (buf != (char*)0) { /* force stored block */ #else if (stored_len+4 <= opt_lenb && buf != (char*)0) { /* 4: two words for the lengths */ #endif /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. * Otherwise we can't have processed more than WSIZE input bytes since * the last block flush, because compression would have been * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to * transform a block into a stored block. */ _tr_stored_block(s, buf, stored_len, eof); #ifdef FORCE_STATIC } else if (static_lenb >= 0) { /* force static trees */ #else } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { #endif send_bits(s, (STATIC_TREES<<1)+eof, 3); compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); #ifdef DEBUG s->compressed_len += 3 + s->static_len; #endif } else { send_bits(s, (DYN_TREES<<1)+eof, 3); send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, max_blindex+1); compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); #ifdef DEBUG s->compressed_len += 3 + s->opt_len; #endif } Assert (s->compressed_len == s->bits_sent, "bad compressed size"); /* The above check is made mod 2^32, for files larger than 512 MB * and uLong implemented on 32 bits. */ init_block(s); if (eof) { bi_windup(s); #ifdef DEBUG s->compressed_len += 7; /* align on byte boundary */ #endif } Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, s->compressed_len-7*eof)); } /* =========================================================================== * Save the match info and tally the frequency counts. Return true if * the current block must be flushed. */ int _tr_tally (s, dist, lc) deflate_state *s; unsigned dist; /* distance of matched string */ unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ { s->d_buf[s->last_lit] = (ush)dist; s->l_buf[s->last_lit++] = (uch)lc; if (dist == 0) { /* lc is the unmatched char */ s->dyn_ltree[lc].Freq++; } else { s->matches++; /* Here, lc is the match length - MIN_MATCH */ dist--; /* dist = match distance - 1 */ Assert((ush)dist < (ush)MAX_DIST(s) && (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; s->dyn_dtree[d_code(dist)].Freq++; } #ifdef TRUNCATE_BLOCK /* Try to guess if it is profitable to stop the current block here */ if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { /* Compute an upper bound for the compressed length */ ulg out_length = (ulg)s->last_lit*8L; ulg in_length = (ulg)((long)s->strstart - s->block_start); int dcode; for (dcode = 0; dcode < D_CODES; dcode++) { out_length += (ulg)s->dyn_dtree[dcode].Freq * (5L+extra_dbits[dcode]); } out_length >>= 3; Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", s->last_lit, in_length, out_length, 100L - out_length*100L/in_length)); if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; } #endif return (s->last_lit == s->lit_bufsize-1); /* We avoid equality with lit_bufsize because of wraparound at 64K * on 16 bit machines and because stored blocks are restricted to * 64K-1 bytes. */ } /* =========================================================================== * Send the block data compressed using the given Huffman trees */ local void compress_block(s, ltree, dtree) deflate_state *s; ct_data *ltree; /* literal tree */ ct_data *dtree; /* distance tree */ { unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ unsigned lx = 0; /* running index in l_buf */ unsigned code; /* the code to send */ int extra; /* number of extra bits to send */ if (s->last_lit != 0) do { dist = s->d_buf[lx]; lc = s->l_buf[lx++]; if (dist == 0) { send_code(s, lc, ltree); /* send a literal byte */ Tracecv(isgraph(lc), (stderr," '%c' ", lc)); } else { /* Here, lc is the match length - MIN_MATCH */ code = _length_code[lc]; send_code(s, code+LITERALS+1, ltree); /* send the length code */ extra = extra_lbits[code]; if (extra != 0) { lc -= base_length[code]; send_bits(s, lc, extra); /* send the extra length bits */ } dist--; /* dist is now the match distance - 1 */ code = d_code(dist); Assert (code < D_CODES, "bad d_code"); send_code(s, code, dtree); /* send the distance code */ extra = extra_dbits[code]; if (extra != 0) { dist -= base_dist[code]; send_bits(s, dist, extra); /* send the extra distance bits */ } } /* literal or match pair ? */ /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, "pendingBuf overflow"); } while (lx < s->last_lit); send_code(s, END_BLOCK, ltree); s->last_eob_len = ltree[END_BLOCK].Len; } /* =========================================================================== * Set the data type to BINARY or TEXT, using a crude approximation: * set it to Z_TEXT if all symbols are either printable characters (33 to 255) * or white spaces (9 to 13, or 32); or set it to Z_BINARY otherwise. * IN assertion: the fields Freq of dyn_ltree are set. */ local void set_data_type(s) deflate_state *s; { int n; for (n = 0; n < 9; n++) if (s->dyn_ltree[n].Freq != 0) break; if (n == 9) for (n = 14; n < 32; n++) if (s->dyn_ltree[n].Freq != 0) break; s->strm->data_type = (n == 32) ? Z_TEXT : Z_BINARY; } /* =========================================================================== * Reverse the first len bits of a code, using straightforward code (a faster * method would use a table) * IN assertion: 1 <= len <= 15 */ local unsigned bi_reverse(code, len) unsigned code; /* the value to invert */ int len; /* its bit length */ { register unsigned res = 0; do { res |= code & 1; code >>= 1, res <<= 1; } while (--len > 0); return res >> 1; } /* =========================================================================== * Flush the bit buffer, keeping at most 7 bits in it. */ local void bi_flush(s) deflate_state *s; { if (s->bi_valid == 16) { put_short(s, s->bi_buf); s->bi_buf = 0; s->bi_valid = 0; } else if (s->bi_valid >= 8) { put_byte(s, (Byte)s->bi_buf); s->bi_buf >>= 8; s->bi_valid -= 8; } } /* =========================================================================== * Flush the bit buffer and align the output on a byte boundary */ local void bi_windup(s) deflate_state *s; { if (s->bi_valid > 8) { put_short(s, s->bi_buf); } else if (s->bi_valid > 0) { put_byte(s, (Byte)s->bi_buf); } s->bi_buf = 0; s->bi_valid = 0; #ifdef DEBUG s->bits_sent = (s->bits_sent+7) & ~7; #endif } /* =========================================================================== * Copy a stored block, storing first the length and its * one's complement if requested. */ local void copy_block(s, buf, len, header) deflate_state *s; charf *buf; /* the input data */ unsigned len; /* its length */ int header; /* true if block header must be written */ { bi_windup(s); /* align on byte boundary */ s->last_eob_len = 8; /* enough lookahead for inflate */ if (header) { put_short(s, (ush)len); put_short(s, (ush)~len); #ifdef DEBUG s->bits_sent += 2*16; #endif } #ifdef DEBUG s->bits_sent += (ulg)len<<3; #endif while (len--) { put_byte(s, *buf++); } } ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/inflate.h0000644000175000017500000001343412320517543021713 0ustar mathieumathieu/* inflate.h -- internal inflate state definition * Copyright (C) 1995-2004 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ /* define NO_GZIP when compiling if you want to disable gzip header and trailer decoding by inflate(). NO_GZIP would be used to avoid linking in the crc code when it is not needed. For shared libraries, gzip decoding should be left enabled. */ #ifndef NO_GZIP # define GUNZIP #endif /* Possible inflate modes between inflate() calls */ typedef enum { HEAD, /* i: waiting for magic header */ FLAGS, /* i: waiting for method and flags (gzip) */ TIME, /* i: waiting for modification time (gzip) */ OS, /* i: waiting for extra flags and operating system (gzip) */ EXLEN, /* i: waiting for extra length (gzip) */ EXTRA, /* i: waiting for extra bytes (gzip) */ NAME, /* i: waiting for end of file name (gzip) */ COMMENT, /* i: waiting for end of comment (gzip) */ HCRC, /* i: waiting for header crc (gzip) */ DICTID, /* i: waiting for dictionary check value */ DICT, /* waiting for inflateSetDictionary() call */ TYPE, /* i: waiting for type bits, including last-flag bit */ TYPEDO, /* i: same, but skip check to exit inflate on new block */ STORED, /* i: waiting for stored size (length and complement) */ COPY, /* i/o: waiting for input or output to copy stored block */ TABLE, /* i: waiting for dynamic block table lengths */ LENLENS, /* i: waiting for code length code lengths */ CODELENS, /* i: waiting for length/lit and distance code lengths */ LEN, /* i: waiting for length/lit code */ LENEXT, /* i: waiting for length extra bits */ DIST, /* i: waiting for distance code */ DISTEXT, /* i: waiting for distance extra bits */ MATCH, /* o: waiting for output space to copy string */ LIT, /* o: waiting for output space to write literal */ CHECK, /* i: waiting for 32-bit check value */ LENGTH, /* i: waiting for 32-bit length (gzip) */ DONE, /* finished check, done -- remain here until reset */ BAD, /* got a data error -- remain here until reset */ MEM, /* got an inflate() memory error -- remain here until reset */ SYNC /* looking for synchronization bytes to restart inflate() */ } inflate_mode; /* State transitions between above modes - (most modes can go to the BAD or MEM mode -- not shown for clarity) Process header: HEAD -> (gzip) or (zlib) (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME NAME -> COMMENT -> HCRC -> TYPE (zlib) -> DICTID or TYPE DICTID -> DICT -> TYPE Read deflate blocks: TYPE -> STORED or TABLE or LEN or CHECK STORED -> COPY -> TYPE TABLE -> LENLENS -> CODELENS -> LEN Read deflate codes: LEN -> LENEXT or LIT or TYPE LENEXT -> DIST -> DISTEXT -> MATCH -> LEN LIT -> LEN Process trailer: CHECK -> LENGTH -> DONE */ /* state maintained between inflate() calls. Approximately 7K bytes. */ struct inflate_state { inflate_mode mode; /* current inflate mode */ int last; /* true if processing last block */ int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ int havedict; /* true if dictionary provided */ int flags; /* gzip header method and flags (0 if zlib) */ unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ unsigned long check; /* protected copy of check value */ unsigned long total; /* protected copy of output count */ gz_headerp head; /* where to save gzip header information */ /* sliding window */ unsigned wbits; /* log base 2 of requested window size */ unsigned wsize; /* window size or zero if not using window */ unsigned whave; /* valid bytes in the window */ unsigned write; /* window write index */ unsigned char FAR *window; /* allocated sliding window, if needed */ /* bit accumulator */ unsigned long hold; /* input bit accumulator */ unsigned bits; /* number of bits in "in" */ /* for string and stored block copying */ unsigned length; /* literal or length of data to copy */ unsigned offset; /* distance back to copy string from */ /* for table and code decoding */ unsigned extra; /* extra bits needed */ /* fixed and dynamic code tables */ code const FAR *lencode; /* starting table for length/literal codes */ code const FAR *distcode; /* starting table for distance codes */ unsigned lenbits; /* index bits for lencode */ unsigned distbits; /* index bits for distcode */ /* dynamic table building */ unsigned ncode; /* number of code length code lengths */ unsigned nlen; /* number of length code lengths */ unsigned ndist; /* number of distance code lengths */ unsigned have; /* number of code lengths in lens[] */ code FAR *next; /* next available space in codes[] */ unsigned short lens[320]; /* temporary storage for code lengths */ unsigned short work[288]; /* work area for code table building */ code codes[ENOUGH]; /* space for code tables */ }; ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/crc32.c0000644000175000017500000003161112320517543021175 0ustar mathieumathieu/* crc32.c -- compute the CRC-32 of a data stream * Copyright (C) 1995-2005 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h * * Thanks to Rodney Brown for his contribution of faster * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing * tables for updating the shift register in one step with three exclusive-ors * instead of four steps with four exclusive-ors. This results in about a * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. */ /* @(#) $Id$ */ /* Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore protection on the static variables used to control the first-use generation of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should first call get_crc_table() to initialize the tables before allowing more than one thread to use crc32(). */ #ifdef MAKECRCH # include # ifndef DYNAMIC_CRC_TABLE # define DYNAMIC_CRC_TABLE # endif /* !DYNAMIC_CRC_TABLE */ #endif /* MAKECRCH */ #include "zutil.h" /* for STDC and FAR definitions */ #define local static /* Find a four-byte integer type for crc32_little() and crc32_big(). */ #ifndef NOBYFOUR # ifdef STDC /* need ANSI C limits.h to determine sizes */ # include # define BYFOUR # if (UINT_MAX == 0xffffffffUL) typedef unsigned int u4; # else # if (ULONG_MAX == 0xffffffffUL) typedef unsigned long u4; # else # if (USHRT_MAX == 0xffffffffUL) typedef unsigned short u4; # else # undef BYFOUR /* can't find a four-byte integer type! */ # endif # endif # endif # endif /* STDC */ #endif /* !NOBYFOUR */ /* Definitions for doing the crc four data bytes at a time. */ #ifdef BYFOUR # define REV(w) (((w)>>24)+(((w)>>8)&0xff00)+ \ (((w)&0xff00)<<8)+(((w)&0xff)<<24)) local unsigned long crc32_little OF((unsigned long, const unsigned char FAR *, unsigned)); local unsigned long crc32_big OF((unsigned long, const unsigned char FAR *, unsigned)); # define TBLS 8 #else # define TBLS 1 #endif /* BYFOUR */ /* Local functions for crc concatenation */ local unsigned long gf2_matrix_times OF((unsigned long *mat, unsigned long vec)); local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); #ifdef DYNAMIC_CRC_TABLE local volatile int crc_table_empty = 1; local unsigned long FAR crc_table[TBLS][256]; local void make_crc_table OF((void)); #ifdef MAKECRCH local void write_table OF((FILE *, const unsigned long FAR *)); #endif /* MAKECRCH */ /* Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. Polynomials over GF(2) are represented in binary, one bit per coefficient, with the lowest powers in the most significant bit. Then adding polynomials is just exclusive-or, and multiplying a polynomial by x is a right shift by one. If we call the above polynomial p, and represent a byte as the polynomial q, also with the lowest power in the most significant bit (so the byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, where a mod b means the remainder after dividing a by b. This calculation is done using the shift-register method of multiplying and taking the remainder. The register is initialized to zero, and for each incoming bit, x^32 is added mod p to the register if the bit is a one (where x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by x (which is shifting right by one and adding x^32 mod p if the bit shifted out is a one). We start with the highest power (least significant bit) of q and repeat for all eight bits of q. The first table is simply the CRC of all possible eight bit values. This is all the information needed to generate CRCs on data a byte at a time for all combinations of CRC register values and incoming bytes. The remaining tables allow for word-at-a-time CRC calculation for both big-endian and little- endian machines, where a word is four bytes. */ local void make_crc_table() { unsigned long c; int n, k; unsigned long poly; /* polynomial exclusive-or pattern */ /* terms of polynomial defining this crc (except x^32): */ static volatile int first = 1; /* flag to limit concurrent making */ static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; /* See if another task is already doing this (not thread-safe, but better than nothing -- significantly reduces duration of vulnerability in case the advice about DYNAMIC_CRC_TABLE is ignored) */ if (first) { first = 0; /* make exclusive-or pattern from polynomial (0xedb88320UL) */ poly = 0UL; for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++) poly |= 1UL << (31 - p[n]); /* generate a crc for every 8-bit value */ for (n = 0; n < 256; n++) { c = (unsigned long)n; for (k = 0; k < 8; k++) c = c & 1 ? poly ^ (c >> 1) : c >> 1; crc_table[0][n] = c; } #ifdef BYFOUR /* generate crc for each value followed by one, two, and three zeros, and then the byte reversal of those as well as the first table */ for (n = 0; n < 256; n++) { c = crc_table[0][n]; crc_table[4][n] = REV(c); for (k = 1; k < 4; k++) { c = crc_table[0][c & 0xff] ^ (c >> 8); crc_table[k][n] = c; crc_table[k + 4][n] = REV(c); } } #endif /* BYFOUR */ crc_table_empty = 0; } else { /* not first */ /* wait for the other guy to finish (not efficient, but rare) */ while (crc_table_empty) ; } #ifdef MAKECRCH /* write out CRC tables to crc32.h */ { FILE *out; out = fopen("crc32.h", "w"); if (out == NULL) return; fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); fprintf(out, "local const unsigned long FAR "); fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); write_table(out, crc_table[0]); # ifdef BYFOUR fprintf(out, "#ifdef BYFOUR\n"); for (k = 1; k < 8; k++) { fprintf(out, " },\n {\n"); write_table(out, crc_table[k]); } fprintf(out, "#endif\n"); # endif /* BYFOUR */ fprintf(out, " }\n};\n"); fclose(out); } #endif /* MAKECRCH */ } #ifdef MAKECRCH local void write_table(out, table) FILE *out; const unsigned long FAR *table; { int n; for (n = 0; n < 256; n++) fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n], n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); } #endif /* MAKECRCH */ #else /* !DYNAMIC_CRC_TABLE */ /* ======================================================================== * Tables of CRC-32s of all single-byte values, made by make_crc_table(). */ #include "crc32.h" #endif /* DYNAMIC_CRC_TABLE */ /* ========================================================================= * This function can be used by asm versions of crc32() */ const unsigned long FAR * ZEXPORT get_crc_table() { #ifdef DYNAMIC_CRC_TABLE if (crc_table_empty) make_crc_table(); #endif /* DYNAMIC_CRC_TABLE */ return (const unsigned long FAR *)crc_table; } /* ========================================================================= */ #define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) #define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 /* ========================================================================= */ unsigned long ZEXPORT crc32(crc, buf, len) unsigned long crc; const unsigned char FAR *buf; unsigned len; { if (buf == Z_NULL) return 0UL; #ifdef DYNAMIC_CRC_TABLE if (crc_table_empty) make_crc_table(); #endif /* DYNAMIC_CRC_TABLE */ #ifdef BYFOUR if (sizeof(void *) == sizeof(ptrdiff_t)) { u4 endian; endian = 1; if (*((unsigned char *)(&endian))) return crc32_little(crc, buf, len); else return crc32_big(crc, buf, len); } #endif /* BYFOUR */ crc = crc ^ 0xffffffffUL; while (len >= 8) { DO8; len -= 8; } if (len) do { DO1; } while (--len); return crc ^ 0xffffffffUL; } #ifdef BYFOUR /* ========================================================================= */ #define DOLIT4 c ^= *buf4++; \ c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] #define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 /* ========================================================================= */ local unsigned long crc32_little(crc, buf, len) unsigned long crc; const unsigned char FAR *buf; unsigned len; { register u4 c; register const u4 FAR *buf4; c = (u4)crc; c = ~c; while (len && ((ptrdiff_t)buf & 3)) { c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); len--; } buf4 = (const u4 FAR *)(const void FAR *)buf; while (len >= 32) { DOLIT32; len -= 32; } while (len >= 4) { DOLIT4; len -= 4; } buf = (const unsigned char FAR *)buf4; if (len) do { c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); } while (--len); c = ~c; return (unsigned long)c; } /* ========================================================================= */ #define DOBIG4 c ^= *++buf4; \ c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] #define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 /* ========================================================================= */ local unsigned long crc32_big(crc, buf, len) unsigned long crc; const unsigned char FAR *buf; unsigned len; { register u4 c; register const u4 FAR *buf4; c = REV((u4)crc); c = ~c; while (len && ((ptrdiff_t)buf & 3)) { c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); len--; } buf4 = (const u4 FAR *)(const void FAR *)buf; buf4--; while (len >= 32) { DOBIG32; len -= 32; } while (len >= 4) { DOBIG4; len -= 4; } buf4++; buf = (const unsigned char FAR *)buf4; if (len) do { c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); } while (--len); c = ~c; return (unsigned long)(REV(c)); } #endif /* BYFOUR */ #define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ /* ========================================================================= */ local unsigned long gf2_matrix_times(mat, vec) unsigned long *mat; unsigned long vec; { unsigned long sum; sum = 0; while (vec) { if (vec & 1) sum ^= *mat; vec >>= 1; mat++; } return sum; } /* ========================================================================= */ local void gf2_matrix_square(square, mat) unsigned long *square; unsigned long *mat; { int n; for (n = 0; n < GF2_DIM; n++) square[n] = gf2_matrix_times(mat, mat[n]); } /* ========================================================================= */ uLong ZEXPORT crc32_combine(crc1, crc2, len2) uLong crc1; uLong crc2; z_off_t len2; { int n; unsigned long row; unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */ unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */ /* degenerate case */ if (len2 == 0) return crc1; /* put operator for one zero bit in odd */ odd[0] = 0xedb88320L; /* CRC-32 polynomial */ row = 1; for (n = 1; n < GF2_DIM; n++) { odd[n] = row; row <<= 1; } /* put operator for two zero bits in even */ gf2_matrix_square(even, odd); /* put operator for four zero bits in odd */ gf2_matrix_square(odd, even); /* apply len2 zeros to crc1 (first square will put the operator for one zero byte, eight zero bits, in even) */ do { /* apply zeros operator for this bit of len2 */ gf2_matrix_square(even, odd); if (len2 & 1) crc1 = gf2_matrix_times(even, crc1); len2 >>= 1; /* if no more bits set, then done */ if (len2 == 0) break; /* another iteration of the loop with odd and even swapped */ gf2_matrix_square(odd, even); if (len2 & 1) crc1 = gf2_matrix_times(odd, crc1); len2 >>= 1; /* if no more bits set, then done */ } while (len2 != 0); /* return combined crc */ crc1 ^= crc2; return crc1; } ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/inftrees.h0000644000175000017500000000450512320517543022107 0ustar mathieumathieu/* inftrees.h -- header to use inftrees.c * Copyright (C) 1995-2005 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ /* Structure for decoding tables. Each entry provides either the information needed to do the operation requested by the code that indexed that table entry, or it provides a pointer to another table that indexes more bits of the code. op indicates whether the entry is a pointer to another table, a literal, a length or distance, an end-of-block, or an invalid code. For a table pointer, the low four bits of op is the number of index bits of that table. For a length or distance, the low four bits of op is the number of extra bits to get after the code. bits is the number of bits in this code or part of the code to drop off of the bit buffer. val is the actual byte to output in the case of a literal, the base length or distance, or the offset from the current table to the next table. Each entry is four bytes. */ typedef struct { unsigned char op; /* operation, extra bits, table bits */ unsigned char bits; /* bits in this part of the code */ unsigned short val; /* offset in table or code value */ } code; /* op values as set by inflate_table(): 00000000 - literal 0000tttt - table link, tttt != 0 is the number of table index bits 0001eeee - length or distance, eeee is the number of extra bits 01100000 - end of block 01000000 - invalid code */ /* Maximum size of dynamic tree. The maximum found in a long but non- exhaustive search was 1444 code structures (852 for length/literals and 592 for distances, the latter actually the result of an exhaustive search). The true maximum is not known, but the value below is more than safe. */ #define ENOUGH 2048 #define MAXD 592 /* Type of code to build for inftable() */ typedef enum { CODES, LENS, DISTS } codetype; extern int inflate_table OF((codetype type, unsigned short FAR *lens, unsigned codes, code FAR * FAR *table, unsigned FAR *bits, unsigned short FAR *work)); ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/inflate.c0000644000175000017500000013752112320517543021712 0ustar mathieumathieu/* inflate.c -- zlib decompression * Copyright (C) 1995-2005 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* * Change history: * * 1.2.beta0 24 Nov 2002 * - First version -- complete rewrite of inflate to simplify code, avoid * creation of window when not needed, minimize use of window when it is * needed, make inffast.c even faster, implement gzip decoding, and to * improve code readability and style over the previous zlib inflate code * * 1.2.beta1 25 Nov 2002 * - Use pointers for available input and output checking in inffast.c * - Remove input and output counters in inffast.c * - Change inffast.c entry and loop from avail_in >= 7 to >= 6 * - Remove unnecessary second byte pull from length extra in inffast.c * - Unroll direct copy to three copies per loop in inffast.c * * 1.2.beta2 4 Dec 2002 * - Change external routine names to reduce potential conflicts * - Correct filename to inffixed.h for fixed tables in inflate.c * - Make hbuf[] unsigned char to match parameter type in inflate.c * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset) * to avoid negation problem on Alphas (64 bit) in inflate.c * * 1.2.beta3 22 Dec 2002 * - Add comments on state->bits assertion in inffast.c * - Add comments on op field in inftrees.h * - Fix bug in reuse of allocated window after inflateReset() * - Remove bit fields--back to byte structure for speed * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths * - Change post-increments to pre-increments in inflate_fast(), PPC biased? * - Add compile time option, POSTINC, to use post-increments instead (Intel?) * - Make MATCH copy in inflate() much faster for when inflate_fast() not used * - Use local copies of stream next and avail values, as well as local bit * buffer and bit count in inflate()--for speed when inflate_fast() not used * * 1.2.beta4 1 Jan 2003 * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings * - Move a comment on output buffer sizes from inffast.c to inflate.c * - Add comments in inffast.c to introduce the inflate_fast() routine * - Rearrange window copies in inflate_fast() for speed and simplification * - Unroll last copy for window match in inflate_fast() * - Use local copies of window variables in inflate_fast() for speed * - Pull out common write == 0 case for speed in inflate_fast() * - Make op and len in inflate_fast() unsigned for consistency * - Add FAR to lcode and dcode declarations in inflate_fast() * - Simplified bad distance check in inflate_fast() * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new * source file infback.c to provide a call-back interface to inflate for * programs like gzip and unzip -- uses window as output buffer to avoid * window copying * * 1.2.beta5 1 Jan 2003 * - Improved inflateBack() interface to allow the caller to provide initial * input in strm. * - Fixed stored blocks bug in inflateBack() * * 1.2.beta6 4 Jan 2003 * - Added comments in inffast.c on effectiveness of POSTINC * - Typecasting all around to reduce compiler warnings * - Changed loops from while (1) or do {} while (1) to for (;;), again to * make compilers happy * - Changed type of window in inflateBackInit() to unsigned char * * * 1.2.beta7 27 Jan 2003 * - Changed many types to unsigned or unsigned short to avoid warnings * - Added inflateCopy() function * * 1.2.0 9 Mar 2003 * - Changed inflateBack() interface to provide separate opaque descriptors * for the in() and out() functions * - Changed inflateBack() argument and in_func typedef to swap the length * and buffer address return values for the input function * - Check next_in and next_out for Z_NULL on entry to inflate() * * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. */ #include "zutil.h" #include "inftrees.h" #include "inflate.h" #include "inffast.h" #ifdef MAKEFIXED # ifndef BUILDFIXED # define BUILDFIXED # endif #endif /* function prototypes */ local void fixedtables OF((struct inflate_state FAR *state)); local int updatewindow OF((z_streamp strm, unsigned out)); #ifdef BUILDFIXED void makefixed OF((void)); #endif local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, unsigned len)); int ZEXPORT inflateReset(strm) z_streamp strm; { struct inflate_state FAR *state; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; strm->total_in = strm->total_out = state->total = 0; strm->msg = Z_NULL; strm->adler = 1; /* to support ill-conceived Java test suite */ state->mode = HEAD; state->last = 0; state->havedict = 0; state->dmax = 32768U; state->head = Z_NULL; state->wsize = 0; state->whave = 0; state->write = 0; state->hold = 0; state->bits = 0; state->lencode = state->distcode = state->next = state->codes; Tracev((stderr, "inflate: reset\n")); return Z_OK; } int ZEXPORT inflatePrime(strm, bits, value) z_streamp strm; int bits; int value; { struct inflate_state FAR *state; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR; value &= (1L << bits) - 1; state->hold += value << state->bits; state->bits += bits; return Z_OK; } int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) z_streamp strm; int windowBits; const char *version; int stream_size; { struct inflate_state FAR *state; if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || stream_size != (int)(sizeof(z_stream))) return Z_VERSION_ERROR; if (strm == Z_NULL) return Z_STREAM_ERROR; strm->msg = Z_NULL; /* in case we return an error */ if (strm->zalloc == (alloc_func)0) { strm->zalloc = zcalloc; strm->opaque = (voidpf)0; } if (strm->zfree == (free_func)0) strm->zfree = zcfree; state = (struct inflate_state FAR *) ZALLOC(strm, 1, sizeof(struct inflate_state)); if (state == Z_NULL) return Z_MEM_ERROR; Tracev((stderr, "inflate: allocated\n")); strm->state = (struct internal_state FAR *)state; if (windowBits < 0) { state->wrap = 0; windowBits = -windowBits; } else { state->wrap = (windowBits >> 4) + 1; #ifdef GUNZIP if (windowBits < 48) windowBits &= 15; #endif } if (windowBits < 8 || windowBits > 15) { ZFREE(strm, state); strm->state = Z_NULL; return Z_STREAM_ERROR; } state->wbits = (unsigned)windowBits; state->window = Z_NULL; return inflateReset(strm); } int ZEXPORT inflateInit_(strm, version, stream_size) z_streamp strm; const char *version; int stream_size; { return inflateInit2_(strm, DEF_WBITS, version, stream_size); } /* Return state with length and distance decoding tables and index sizes set to fixed code decoding. Normally this returns fixed tables from inffixed.h. If BUILDFIXED is defined, then instead this routine builds the tables the first time it's called, and returns those tables the first time and thereafter. This reduces the size of the code by about 2K bytes, in exchange for a little execution time. However, BUILDFIXED should not be used for threaded applications, since the rewriting of the tables and virgin may not be thread-safe. */ local void fixedtables(state) struct inflate_state FAR *state; { #ifdef BUILDFIXED static int virgin = 1; static code *lenfix, *distfix; static code fixed[544]; /* build fixed huffman tables if first call (may not be thread safe) */ if (virgin) { unsigned sym, bits; static code *next; /* literal/length table */ sym = 0; while (sym < 144) state->lens[sym++] = 8; while (sym < 256) state->lens[sym++] = 9; while (sym < 280) state->lens[sym++] = 7; while (sym < 288) state->lens[sym++] = 8; next = fixed; lenfix = next; bits = 9; inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); /* distance table */ sym = 0; while (sym < 32) state->lens[sym++] = 5; distfix = next; bits = 5; inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); /* do this just once */ virgin = 0; } #else /* !BUILDFIXED */ # include "inffixed.h" #endif /* BUILDFIXED */ state->lencode = lenfix; state->lenbits = 9; state->distcode = distfix; state->distbits = 5; } #ifdef MAKEFIXED #include /* Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also defines BUILDFIXED, so the tables are built on the fly. makefixed() writes those tables to stdout, which would be piped to inffixed.h. A small program can simply call makefixed to do this: void makefixed(void); int main(void) { makefixed(); return 0; } Then that can be linked with zlib built with MAKEFIXED defined and run: a.out > inffixed.h */ void makefixed() { unsigned low, size; struct inflate_state state; fixedtables(&state); puts(" /* inffixed.h -- table for decoding fixed codes"); puts(" * Generated automatically by makefixed()."); puts(" */"); puts(""); puts(" /* WARNING: this file should *not* be used by applications."); puts(" It is part of the implementation of this library and is"); puts(" subject to change. Applications should only use zlib.h."); puts(" */"); puts(""); size = 1U << 9; printf(" static const code lenfix[%u] = {", size); low = 0; for (;;) { if ((low % 7) == 0) printf("\n "); printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits, state.lencode[low].val); if (++low == size) break; putchar(','); } puts("\n };"); size = 1U << 5; printf("\n static const code distfix[%u] = {", size); low = 0; for (;;) { if ((low % 6) == 0) printf("\n "); printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, state.distcode[low].val); if (++low == size) break; putchar(','); } puts("\n };"); } #endif /* MAKEFIXED */ /* Update the window with the last wsize (normally 32K) bytes written before returning. If window does not exist yet, create it. This is only called when a window is already in use, or when output has been written during this inflate call, but the end of the deflate stream has not been reached yet. It is also called to create a window for dictionary data when a dictionary is loaded. Providing output buffers larger than 32K to inflate() should provide a speed advantage, since only the last 32K of output is copied to the sliding window upon return from inflate(), and since all distances after the first 32K of output will fall in the output data, making match copies simpler and faster. The advantage may be dependent on the size of the processor's data caches. */ local int updatewindow(strm, out) z_streamp strm; unsigned out; { struct inflate_state FAR *state; unsigned copy, dist; state = (struct inflate_state FAR *)strm->state; /* if it hasn't been done already, allocate space for the window */ if (state->window == Z_NULL) { state->window = (unsigned char FAR *) ZALLOC(strm, 1U << state->wbits, sizeof(unsigned char)); if (state->window == Z_NULL) return 1; } /* if window not in use yet, initialize */ if (state->wsize == 0) { state->wsize = 1U << state->wbits; state->write = 0; state->whave = 0; } /* copy state->wsize or less output bytes into the circular window */ copy = out - strm->avail_out; if (copy >= state->wsize) { zmemcpy(state->window, strm->next_out - state->wsize, state->wsize); state->write = 0; state->whave = state->wsize; } else { dist = state->wsize - state->write; if (dist > copy) dist = copy; zmemcpy(state->window + state->write, strm->next_out - copy, dist); copy -= dist; if (copy) { zmemcpy(state->window, strm->next_out - copy, copy); state->write = copy; state->whave = state->wsize; } else { state->write += dist; if (state->write == state->wsize) state->write = 0; if (state->whave < state->wsize) state->whave += dist; } } return 0; } /* Macros for inflate(): */ /* check function to use adler32() for zlib or crc32() for gzip */ #ifdef GUNZIP # define UPDATE(check, buf, len) \ (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) #else # define UPDATE(check, buf, len) adler32(check, buf, len) #endif /* check macros for header crc */ #ifdef GUNZIP # define CRC2(check, word) \ do { \ hbuf[0] = (unsigned char)(word); \ hbuf[1] = (unsigned char)((word) >> 8); \ check = crc32(check, hbuf, 2); \ } while (0) # define CRC4(check, word) \ do { \ hbuf[0] = (unsigned char)(word); \ hbuf[1] = (unsigned char)((word) >> 8); \ hbuf[2] = (unsigned char)((word) >> 16); \ hbuf[3] = (unsigned char)((word) >> 24); \ check = crc32(check, hbuf, 4); \ } while (0) #endif /* Load registers with state in inflate() for speed */ #define LOAD() \ do { \ put = strm->next_out; \ left = strm->avail_out; \ next = strm->next_in; \ have = strm->avail_in; \ hold = state->hold; \ bits = state->bits; \ } while (0) /* Restore state from registers in inflate() */ #define RESTORE() \ do { \ strm->next_out = put; \ strm->avail_out = left; \ strm->next_in = next; \ strm->avail_in = have; \ state->hold = hold; \ state->bits = bits; \ } while (0) /* Clear the input bit accumulator */ #define INITBITS() \ do { \ hold = 0; \ bits = 0; \ } while (0) /* Get a byte of input into the bit accumulator, or return from inflate() if there is no input available. */ #define PULLBYTE() \ do { \ if (have == 0) goto inf_leave; \ have--; \ hold += (unsigned long)(*next++) << bits; \ bits += 8; \ } while (0) /* Assure that there are at least n bits in the bit accumulator. If there is not enough available input to do that, then return from inflate(). */ #define NEEDBITS(n) \ do { \ while (bits < (unsigned)(n)) \ PULLBYTE(); \ } while (0) /* Return the low n bits of the bit accumulator (n < 16) */ #define BITS(n) \ ((unsigned)hold & ((1U << (n)) - 1)) /* Remove n bits from the bit accumulator */ #define DROPBITS(n) \ do { \ hold >>= (n); \ bits -= (unsigned)(n); \ } while (0) /* Remove zero to seven bits as needed to go to a byte boundary */ #define BYTEBITS() \ do { \ hold >>= bits & 7; \ bits -= bits & 7; \ } while (0) /* Reverse the bytes in a 32-bit value */ #define REVERSE(q) \ ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) /* inflate() uses a state machine to process as much input data and generate as much output data as possible before returning. The state machine is structured roughly as follows: for (;;) switch (state) { ... case STATEn: if (not enough input data or output space to make progress) return; ... make progress ... state = STATEm; break; ... } so when inflate() is called again, the same case is attempted again, and if the appropriate resources are provided, the machine proceeds to the next state. The NEEDBITS() macro is usually the way the state evaluates whether it can proceed or should return. NEEDBITS() does the return if the requested bits are not available. The typical use of the BITS macros is: NEEDBITS(n); ... do something with BITS(n) ... DROPBITS(n); where NEEDBITS(n) either returns from inflate() if there isn't enough input left to load n bits into the accumulator, or it continues. BITS(n) gives the low n bits in the accumulator. When done, DROPBITS(n) drops the low n bits off the accumulator. INITBITS() clears the accumulator and sets the number of available bits to zero. BYTEBITS() discards just enough bits to put the accumulator on a byte boundary. After BYTEBITS() and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return if there is no input available. The decoding of variable length codes uses PULLBYTE() directly in order to pull just enough bytes to decode the next code, and no more. Some states loop until they get enough input, making sure that enough state information is maintained to continue the loop where it left off if NEEDBITS() returns in the loop. For example, want, need, and keep would all have to actually be part of the saved state in case NEEDBITS() returns: case STATEw: while (want < need) { NEEDBITS(n); keep[want++] = BITS(n); DROPBITS(n); } state = STATEx; case STATEx: As shown above, if the next state is also the next case, then the break is omitted. A state may also return if there is not enough output space available to complete that state. Those states are copying stored data, writing a literal byte, and copying a matching string. When returning, a "goto inf_leave" is used to update the total counters, update the check value, and determine whether any progress has been made during that inflate() call in order to return the proper return code. Progress is defined as a change in either strm->avail_in or strm->avail_out. When there is a window, goto inf_leave will update the window with the last output written. If a goto inf_leave occurs in the middle of decompression and there is no window currently, goto inf_leave will create one and copy output to the window for the next call of inflate(). In this implementation, the flush parameter of inflate() only affects the return code (per zlib.h). inflate() always writes as much as possible to strm->next_out, given the space available and the provided input--the effect documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers the allocation of and copying into a sliding window until necessary, which provides the effect documented in zlib.h for Z_FINISH when the entire input stream available. So the only thing the flush parameter actually does is: when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it will return Z_BUF_ERROR if it has not reached the end of the stream. */ int ZEXPORT inflate(strm, flush) z_streamp strm; int flush; { struct inflate_state FAR *state; unsigned char FAR *next; /* next input */ unsigned char FAR *put; /* next output */ unsigned have, left; /* available input and output */ unsigned long hold; /* bit buffer */ unsigned bits; /* bits in bit buffer */ unsigned in, out; /* save starting available input and output */ unsigned copy; /* number of stored or match bytes to copy */ unsigned char FAR *from; /* where to copy match bytes from */ code this; /* current decoding table entry */ code last; /* parent table entry */ unsigned len; /* length to copy for repeats, bits to drop */ int ret; /* return code */ #ifdef GUNZIP unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ #endif static const unsigned short order[19] = /* permutation of code lengths */ {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL || (strm->next_in == Z_NULL && strm->avail_in != 0)) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ LOAD(); in = have; out = left; ret = Z_OK; for (;;) switch (state->mode) { case HEAD: if (state->wrap == 0) { state->mode = TYPEDO; break; } NEEDBITS(16); #ifdef GUNZIP if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ state->check = crc32(0L, Z_NULL, 0); CRC2(state->check, hold); INITBITS(); state->mode = FLAGS; break; } state->flags = 0; /* expect zlib header */ if (state->head != Z_NULL) state->head->done = -1; if (!(state->wrap & 1) || /* check if zlib header allowed */ #else if ( #endif ((BITS(8) << 8) + (hold >> 8)) % 31) { strm->msg = (char *)"incorrect header check"; state->mode = BAD; break; } if (BITS(4) != Z_DEFLATED) { strm->msg = (char *)"unknown compression method"; state->mode = BAD; break; } DROPBITS(4); len = BITS(4) + 8; if (len > state->wbits) { strm->msg = (char *)"invalid window size"; state->mode = BAD; break; } state->dmax = 1U << len; Tracev((stderr, "inflate: zlib header ok\n")); strm->adler = state->check = adler32(0L, Z_NULL, 0); state->mode = hold & 0x200 ? DICTID : TYPE; INITBITS(); break; #ifdef GUNZIP case FLAGS: NEEDBITS(16); state->flags = (int)(hold); if ((state->flags & 0xff) != Z_DEFLATED) { strm->msg = (char *)"unknown compression method"; state->mode = BAD; break; } if (state->flags & 0xe000) { strm->msg = (char *)"unknown header flags set"; state->mode = BAD; break; } if (state->head != Z_NULL) state->head->text = (int)((hold >> 8) & 1); if (state->flags & 0x0200) CRC2(state->check, hold); INITBITS(); state->mode = TIME; case TIME: NEEDBITS(32); if (state->head != Z_NULL) state->head->time = hold; if (state->flags & 0x0200) CRC4(state->check, hold); INITBITS(); state->mode = OS; case OS: NEEDBITS(16); if (state->head != Z_NULL) { state->head->xflags = (int)(hold & 0xff); state->head->os = (int)(hold >> 8); } if (state->flags & 0x0200) CRC2(state->check, hold); INITBITS(); state->mode = EXLEN; case EXLEN: if (state->flags & 0x0400) { NEEDBITS(16); state->length = (unsigned)(hold); if (state->head != Z_NULL) state->head->extra_len = (unsigned)hold; if (state->flags & 0x0200) CRC2(state->check, hold); INITBITS(); } else if (state->head != Z_NULL) state->head->extra = Z_NULL; state->mode = EXTRA; case EXTRA: if (state->flags & 0x0400) { copy = state->length; if (copy > have) copy = have; if (copy) { if (state->head != Z_NULL && state->head->extra != Z_NULL) { len = state->head->extra_len - state->length; zmemcpy(state->head->extra + len, next, len + copy > state->head->extra_max ? state->head->extra_max - len : copy); } if (state->flags & 0x0200) state->check = crc32(state->check, next, copy); have -= copy; next += copy; state->length -= copy; } if (state->length) goto inf_leave; } state->length = 0; state->mode = NAME; case NAME: if (state->flags & 0x0800) { if (have == 0) goto inf_leave; copy = 0; do { len = (unsigned)(next[copy++]); if (state->head != Z_NULL && state->head->name != Z_NULL && state->length < state->head->name_max) state->head->name[state->length++] = len; } while (len && copy < have); if (state->flags & 0x0200) state->check = crc32(state->check, next, copy); have -= copy; next += copy; if (len) goto inf_leave; } else if (state->head != Z_NULL) state->head->name = Z_NULL; state->length = 0; state->mode = COMMENT; case COMMENT: if (state->flags & 0x1000) { if (have == 0) goto inf_leave; copy = 0; do { len = (unsigned)(next[copy++]); if (state->head != Z_NULL && state->head->comment != Z_NULL && state->length < state->head->comm_max) state->head->comment[state->length++] = len; } while (len && copy < have); if (state->flags & 0x0200) state->check = crc32(state->check, next, copy); have -= copy; next += copy; if (len) goto inf_leave; } else if (state->head != Z_NULL) state->head->comment = Z_NULL; state->mode = HCRC; case HCRC: if (state->flags & 0x0200) { NEEDBITS(16); if (hold != (state->check & 0xffff)) { strm->msg = (char *)"header crc mismatch"; state->mode = BAD; break; } INITBITS(); } if (state->head != Z_NULL) { state->head->hcrc = (int)((state->flags >> 9) & 1); state->head->done = 1; } strm->adler = state->check = crc32(0L, Z_NULL, 0); state->mode = TYPE; break; #endif case DICTID: NEEDBITS(32); strm->adler = state->check = REVERSE(hold); INITBITS(); state->mode = DICT; case DICT: if (state->havedict == 0) { RESTORE(); return Z_NEED_DICT; } strm->adler = state->check = adler32(0L, Z_NULL, 0); state->mode = TYPE; case TYPE: if (flush == Z_BLOCK) goto inf_leave; case TYPEDO: if (state->last) { BYTEBITS(); state->mode = CHECK; break; } NEEDBITS(3); state->last = BITS(1); DROPBITS(1); switch (BITS(2)) { case 0: /* stored block */ Tracev((stderr, "inflate: stored block%s\n", state->last ? " (last)" : "")); state->mode = STORED; break; case 1: /* fixed block */ fixedtables(state); Tracev((stderr, "inflate: fixed codes block%s\n", state->last ? " (last)" : "")); state->mode = LEN; /* decode codes */ break; case 2: /* dynamic block */ Tracev((stderr, "inflate: dynamic codes block%s\n", state->last ? " (last)" : "")); state->mode = TABLE; break; case 3: strm->msg = (char *)"invalid block type"; state->mode = BAD; } DROPBITS(2); break; case STORED: BYTEBITS(); /* go to byte boundary */ NEEDBITS(32); if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { strm->msg = (char *)"invalid stored block lengths"; state->mode = BAD; break; } state->length = (unsigned)hold & 0xffff; Tracev((stderr, "inflate: stored length %u\n", state->length)); INITBITS(); state->mode = COPY; case COPY: copy = state->length; if (copy) { if (copy > have) copy = have; if (copy > left) copy = left; if (copy == 0) goto inf_leave; zmemcpy(put, next, copy); have -= copy; next += copy; left -= copy; put += copy; state->length -= copy; break; } Tracev((stderr, "inflate: stored end\n")); state->mode = TYPE; break; case TABLE: NEEDBITS(14); state->nlen = BITS(5) + 257; DROPBITS(5); state->ndist = BITS(5) + 1; DROPBITS(5); state->ncode = BITS(4) + 4; DROPBITS(4); #ifndef PKZIP_BUG_WORKAROUND if (state->nlen > 286 || state->ndist > 30) { strm->msg = (char *)"too many length or distance symbols"; state->mode = BAD; break; } #endif Tracev((stderr, "inflate: table sizes ok\n")); state->have = 0; state->mode = LENLENS; case LENLENS: while (state->have < state->ncode) { NEEDBITS(3); state->lens[order[state->have++]] = (unsigned short)BITS(3); DROPBITS(3); } while (state->have < 19) state->lens[order[state->have++]] = 0; state->next = state->codes; state->lencode = (code const FAR *)(state->next); state->lenbits = 7; ret = inflate_table(CODES, state->lens, 19, &(state->next), &(state->lenbits), state->work); if (ret) { strm->msg = (char *)"invalid code lengths set"; state->mode = BAD; break; } Tracev((stderr, "inflate: code lengths ok\n")); state->have = 0; state->mode = CODELENS; case CODELENS: while (state->have < state->nlen + state->ndist) { for (;;) { this = state->lencode[BITS(state->lenbits)]; if ((unsigned)(this.bits) <= bits) break; PULLBYTE(); } if (this.val < 16) { NEEDBITS(this.bits); DROPBITS(this.bits); state->lens[state->have++] = this.val; } else { if (this.val == 16) { NEEDBITS(this.bits + 2); DROPBITS(this.bits); if (state->have == 0) { strm->msg = (char *)"invalid bit length repeat"; state->mode = BAD; break; } len = state->lens[state->have - 1]; copy = 3 + BITS(2); DROPBITS(2); } else if (this.val == 17) { NEEDBITS(this.bits + 3); DROPBITS(this.bits); len = 0; copy = 3 + BITS(3); DROPBITS(3); } else { NEEDBITS(this.bits + 7); DROPBITS(this.bits); len = 0; copy = 11 + BITS(7); DROPBITS(7); } if (state->have + copy > state->nlen + state->ndist) { strm->msg = (char *)"invalid bit length repeat"; state->mode = BAD; break; } while (copy--) state->lens[state->have++] = (unsigned short)len; } } /* handle error breaks in while */ if (state->mode == BAD) break; /* build code tables */ state->next = state->codes; state->lencode = (code const FAR *)(state->next); state->lenbits = 9; ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), &(state->lenbits), state->work); if (ret) { strm->msg = (char *)"invalid literal/lengths set"; state->mode = BAD; break; } state->distcode = (code const FAR *)(state->next); state->distbits = 6; ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, &(state->next), &(state->distbits), state->work); if (ret) { strm->msg = (char *)"invalid distances set"; state->mode = BAD; break; } Tracev((stderr, "inflate: codes ok\n")); state->mode = LEN; case LEN: if (have >= 6 && left >= 258) { RESTORE(); inflate_fast(strm, out); LOAD(); break; } for (;;) { this = state->lencode[BITS(state->lenbits)]; if ((unsigned)(this.bits) <= bits) break; PULLBYTE(); } if (this.op && (this.op & 0xf0) == 0) { last = this; for (;;) { this = state->lencode[last.val + (BITS(last.bits + last.op) >> last.bits)]; if ((unsigned)(last.bits + this.bits) <= bits) break; PULLBYTE(); } DROPBITS(last.bits); } DROPBITS(this.bits); state->length = (unsigned)this.val; if ((int)(this.op) == 0) { Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? "inflate: literal '%c'\n" : "inflate: literal 0x%02x\n", this.val)); state->mode = LIT; break; } if (this.op & 32) { Tracevv((stderr, "inflate: end of block\n")); state->mode = TYPE; break; } if (this.op & 64) { strm->msg = (char *)"invalid literal/length code"; state->mode = BAD; break; } state->extra = (unsigned)(this.op) & 15; state->mode = LENEXT; case LENEXT: if (state->extra) { NEEDBITS(state->extra); state->length += BITS(state->extra); DROPBITS(state->extra); } Tracevv((stderr, "inflate: length %u\n", state->length)); state->mode = DIST; case DIST: for (;;) { this = state->distcode[BITS(state->distbits)]; if ((unsigned)(this.bits) <= bits) break; PULLBYTE(); } if ((this.op & 0xf0) == 0) { last = this; for (;;) { this = state->distcode[last.val + (BITS(last.bits + last.op) >> last.bits)]; if ((unsigned)(last.bits + this.bits) <= bits) break; PULLBYTE(); } DROPBITS(last.bits); } DROPBITS(this.bits); if (this.op & 64) { strm->msg = (char *)"invalid distance code"; state->mode = BAD; break; } state->offset = (unsigned)this.val; state->extra = (unsigned)(this.op) & 15; state->mode = DISTEXT; case DISTEXT: if (state->extra) { NEEDBITS(state->extra); state->offset += BITS(state->extra); DROPBITS(state->extra); } #ifdef INFLATE_STRICT if (state->offset > state->dmax) { strm->msg = (char *)"invalid distance too far back"; state->mode = BAD; break; } #endif if (state->offset > state->whave + out - left) { strm->msg = (char *)"invalid distance too far back"; state->mode = BAD; break; } Tracevv((stderr, "inflate: distance %u\n", state->offset)); state->mode = MATCH; case MATCH: if (left == 0) goto inf_leave; copy = out - left; if (state->offset > copy) { /* copy from window */ copy = state->offset - copy; if (copy > state->write) { copy -= state->write; from = state->window + (state->wsize - copy); } else from = state->window + (state->write - copy); if (copy > state->length) copy = state->length; } else { /* copy from output */ from = put - state->offset; copy = state->length; } if (copy > left) copy = left; left -= copy; state->length -= copy; do { *put++ = *from++; } while (--copy); if (state->length == 0) state->mode = LEN; break; case LIT: if (left == 0) goto inf_leave; *put++ = (unsigned char)(state->length); left--; state->mode = LEN; break; case CHECK: if (state->wrap) { NEEDBITS(32); out -= left; strm->total_out += out; state->total += out; if (out) strm->adler = state->check = UPDATE(state->check, put - out, out); out = left; if (( #ifdef GUNZIP state->flags ? hold : #endif REVERSE(hold)) != state->check) { strm->msg = (char *)"incorrect data check"; state->mode = BAD; break; } INITBITS(); Tracev((stderr, "inflate: check matches trailer\n")); } #ifdef GUNZIP state->mode = LENGTH; case LENGTH: if (state->wrap && state->flags) { NEEDBITS(32); if (hold != (state->total & 0xffffffffUL)) { strm->msg = (char *)"incorrect length check"; state->mode = BAD; break; } INITBITS(); Tracev((stderr, "inflate: length matches trailer\n")); } #endif state->mode = DONE; case DONE: ret = Z_STREAM_END; goto inf_leave; case BAD: ret = Z_DATA_ERROR; goto inf_leave; case MEM: return Z_MEM_ERROR; case SYNC: default: return Z_STREAM_ERROR; } /* Return from inflate(), updating the total counts and the check value. If there was no progress during the inflate() call, return a buffer error. Call updatewindow() to create and/or update the window state. Note: a memory error from inflate() is non-recoverable. */ inf_leave: RESTORE(); if (state->wsize || (state->mode < CHECK && out != strm->avail_out)) if (updatewindow(strm, out)) { state->mode = MEM; return Z_MEM_ERROR; } in -= strm->avail_in; out -= strm->avail_out; strm->total_in += in; strm->total_out += out; state->total += out; if (state->wrap && out) strm->adler = state->check = UPDATE(state->check, strm->next_out - out, out); strm->data_type = state->bits + (state->last ? 64 : 0) + (state->mode == TYPE ? 128 : 0); if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) ret = Z_BUF_ERROR; return ret; } int ZEXPORT inflateEnd(strm) z_streamp strm; { struct inflate_state FAR *state; if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (state->window != Z_NULL) ZFREE(strm, state->window); ZFREE(strm, strm->state); strm->state = Z_NULL; Tracev((stderr, "inflate: end\n")); return Z_OK; } int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) z_streamp strm; const Bytef *dictionary; uInt dictLength; { struct inflate_state FAR *state; unsigned long id; /* check state */ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (state->wrap != 0 && state->mode != DICT) return Z_STREAM_ERROR; /* check for correct dictionary id */ if (state->mode == DICT) { id = adler32(0L, Z_NULL, 0); id = adler32(id, dictionary, dictLength); if (id != state->check) return Z_DATA_ERROR; } /* copy dictionary to window */ if (updatewindow(strm, strm->avail_out)) { state->mode = MEM; return Z_MEM_ERROR; } if (dictLength > state->wsize) { zmemcpy(state->window, dictionary + dictLength - state->wsize, state->wsize); state->whave = state->wsize; } else { zmemcpy(state->window + state->wsize - dictLength, dictionary, dictLength); state->whave = dictLength; } state->havedict = 1; Tracev((stderr, "inflate: dictionary set\n")); return Z_OK; } int ZEXPORT inflateGetHeader(strm, head) z_streamp strm; gz_headerp head; { struct inflate_state FAR *state; /* check state */ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; /* save header structure */ state->head = head; head->done = 0; return Z_OK; } /* Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found or when out of input. When called, *have is the number of pattern bytes found in order so far, in 0..3. On return *have is updated to the new state. If on return *have equals four, then the pattern was found and the return value is how many bytes were read including the last byte of the pattern. If *have is less than four, then the pattern has not been found yet and the return value is len. In the latter case, syncsearch() can be called again with more data and the *have state. *have is initialized to zero for the first call. */ local unsigned syncsearch(have, buf, len) unsigned FAR *have; unsigned char FAR *buf; unsigned len; { unsigned got; unsigned next; got = *have; next = 0; while (next < len && got < 4) { if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) got++; else if (buf[next]) got = 0; else got = 4 - got; next++; } *have = got; return next; } int ZEXPORT inflateSync(strm) z_streamp strm; { unsigned len; /* number of bytes to look at or looked at */ unsigned long in, out; /* temporary to save total_in and total_out */ unsigned char buf[4]; /* to restore bit buffer to byte string */ struct inflate_state FAR *state; /* check parameters */ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; /* if first time, start search in bit buffer */ if (state->mode != SYNC) { state->mode = SYNC; state->hold <<= state->bits & 7; state->bits -= state->bits & 7; len = 0; while (state->bits >= 8) { buf[len++] = (unsigned char)(state->hold); state->hold >>= 8; state->bits -= 8; } state->have = 0; syncsearch(&(state->have), buf, len); } /* search available input */ len = syncsearch(&(state->have), strm->next_in, strm->avail_in); strm->avail_in -= len; strm->next_in += len; strm->total_in += len; /* return no joy or set up to restart inflate() on a new block */ if (state->have != 4) return Z_DATA_ERROR; in = strm->total_in; out = strm->total_out; inflateReset(strm); strm->total_in = in; strm->total_out = out; state->mode = TYPE; return Z_OK; } /* Returns true if inflate is currently at the end of a block generated by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP implementation to provide an additional safety check. PPP uses Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored block. When decompressing, PPP checks that at the end of input packet, inflate is waiting for these length bytes. */ int ZEXPORT inflateSyncPoint(strm) z_streamp strm; { struct inflate_state FAR *state; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; return state->mode == STORED && state->bits == 0; } int ZEXPORT inflateCopy(dest, source) z_streamp dest; z_streamp source; { struct inflate_state FAR *state; struct inflate_state FAR *copy; unsigned char FAR *window; unsigned wsize; /* check input */ if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || source->zalloc == (alloc_func)0 || source->zfree == (free_func)0) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)source->state; /* allocate space */ copy = (struct inflate_state FAR *) ZALLOC(source, 1, sizeof(struct inflate_state)); if (copy == Z_NULL) return Z_MEM_ERROR; window = Z_NULL; if (state->window != Z_NULL) { window = (unsigned char FAR *) ZALLOC(source, 1U << state->wbits, sizeof(unsigned char)); if (window == Z_NULL) { ZFREE(source, copy); return Z_MEM_ERROR; } } /* copy state */ zmemcpy(dest, source, sizeof(z_stream)); zmemcpy(copy, state, sizeof(struct inflate_state)); if (state->lencode >= state->codes && state->lencode <= state->codes + ENOUGH - 1) { copy->lencode = copy->codes + (state->lencode - state->codes); copy->distcode = copy->codes + (state->distcode - state->codes); } copy->next = copy->codes + (state->next - state->codes); if (window != Z_NULL) { wsize = 1U << state->wbits; zmemcpy(window, state->window, wsize); } copy->window = window; dest->state = (struct internal_state FAR *)copy; return Z_OK; } ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/zconf.in.h0000644000175000017500000002251012320517543022010 0ustar mathieumathieu/* zconf.h -- configuration of the zlib compression library * Copyright (C) 1995-2005 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ #ifndef ZCONF_H #define ZCONF_H /* * If you *really* need a unique prefix for all types and library functions, * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. */ #ifdef Z_PREFIX # define deflateInit_ z_deflateInit_ # define deflate z_deflate # define deflateEnd z_deflateEnd # define inflateInit_ z_inflateInit_ # define inflate z_inflate # define inflateEnd z_inflateEnd # define deflateInit2_ z_deflateInit2_ # define deflateSetDictionary z_deflateSetDictionary # define deflateCopy z_deflateCopy # define deflateReset z_deflateReset # define deflateParams z_deflateParams # define deflateBound z_deflateBound # define deflatePrime z_deflatePrime # define inflateInit2_ z_inflateInit2_ # define inflateSetDictionary z_inflateSetDictionary # define inflateSync z_inflateSync # define inflateSyncPoint z_inflateSyncPoint # define inflateCopy z_inflateCopy # define inflateReset z_inflateReset # define inflateBack z_inflateBack # define inflateBackEnd z_inflateBackEnd # define compress z_compress # define compress2 z_compress2 # define compressBound z_compressBound # define uncompress z_uncompress # define adler32 z_adler32 # define crc32 z_crc32 # define get_crc_table z_get_crc_table # define zError z_zError # define alloc_func z_alloc_func # define free_func z_free_func # define in_func z_in_func # define out_func z_out_func # define Byte z_Byte # define uInt z_uInt # define uLong z_uLong # define Bytef z_Bytef # define charf z_charf # define intf z_intf # define uIntf z_uIntf # define uLongf z_uLongf # define voidpf z_voidpf # define voidp z_voidp #endif #if defined(__MSDOS__) && !defined(MSDOS) # define MSDOS #endif #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) # define OS2 #endif #if defined(_WINDOWS) && !defined(WINDOWS) # define WINDOWS #endif #if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) # ifndef WIN32 # define WIN32 # endif #endif #if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) # if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) # ifndef SYS16BIT # define SYS16BIT # endif # endif #endif /* * Compile with -DMAXSEG_64K if the alloc function cannot allocate more * than 64k bytes at a time (needed on systems with 16-bit int). */ #ifdef SYS16BIT # define MAXSEG_64K #endif #ifdef MSDOS # define UNALIGNED_OK #endif #ifdef __STDC_VERSION__ # ifndef STDC # define STDC # endif # if __STDC_VERSION__ >= 199901L # ifndef STDC99 # define STDC99 # endif # endif #endif #if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) # define STDC #endif #if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) # define STDC #endif #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) # define STDC #endif #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) # define STDC #endif #if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ # define STDC #endif #ifndef STDC # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ # define const /* note: need a more gentle solution here */ # endif #endif /* Some Mac compilers merge all .h files incorrectly: */ #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) # define NO_DUMMY_DECL #endif /* Maximum value for memLevel in deflateInit2 */ #ifndef MAX_MEM_LEVEL # ifdef MAXSEG_64K # define MAX_MEM_LEVEL 8 # else # define MAX_MEM_LEVEL 9 # endif #endif /* Maximum value for windowBits in deflateInit2 and inflateInit2. * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files * created by gzip. (Files created by minigzip can still be extracted by * gzip.) */ #ifndef MAX_WBITS # define MAX_WBITS 15 /* 32K LZ77 window */ #endif /* The memory requirements for deflate are (in bytes): (1 << (windowBits+2)) + (1 << (memLevel+9)) that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) plus a few kilobytes for small objects. For example, if you want to reduce the default memory requirements from 256K to 128K, compile with make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" Of course this will generally degrade compression (there's no free lunch). The memory requirements for inflate are (in bytes) 1 << windowBits that is, 32K for windowBits=15 (default value) plus a few kilobytes for small objects. */ /* Type declarations */ #ifndef OF /* function prototypes */ # ifdef STDC # define OF(args) args # else # define OF(args) () # endif #endif /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, * just define FAR to be empty. */ #ifdef SYS16BIT # if defined(M_I86SM) || defined(M_I86MM) /* MSC small or medium model */ # define SMALL_MEDIUM # ifdef _MSC_VER # define FAR _far # else # define FAR far # endif # endif # if (defined(__SMALL__) || defined(__MEDIUM__)) /* Turbo C small or medium model */ # define SMALL_MEDIUM # ifdef __BORLANDC__ # define FAR _far # else # define FAR far # endif # endif #endif #if defined(WINDOWS) || defined(WIN32) /* If building or using zlib as a DLL, define ZLIB_DLL. * This is not mandatory, but it offers a little performance increase. */ # ifdef ZLIB_DLL # if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) # ifdef ZLIB_INTERNAL # define ZEXTERN extern __declspec(dllexport) # else # define ZEXTERN extern __declspec(dllimport) # endif # endif # endif /* ZLIB_DLL */ /* If building or using zlib with the WINAPI/WINAPIV calling convention, * define ZLIB_WINAPI. * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. */ # ifdef ZLIB_WINAPI # ifdef FAR # undef FAR # endif # include /* No need for _export, use ZLIB.DEF instead. */ /* For complete Windows compatibility, use WINAPI, not __stdcall. */ # define ZEXPORT WINAPI # ifdef WIN32 # define ZEXPORTVA WINAPIV # else # define ZEXPORTVA FAR CDECL # endif # endif #endif #if defined (__BEOS__) # ifdef ZLIB_DLL # ifdef ZLIB_INTERNAL # define ZEXPORT __declspec(dllexport) # define ZEXPORTVA __declspec(dllexport) # else # define ZEXPORT __declspec(dllimport) # define ZEXPORTVA __declspec(dllimport) # endif # endif #endif #ifndef ZEXTERN # define ZEXTERN extern #endif #ifndef ZEXPORT # define ZEXPORT #endif #ifndef ZEXPORTVA # define ZEXPORTVA #endif #ifndef FAR # define FAR #endif #if !defined(__MACTYPES__) typedef unsigned char Byte; /* 8 bits */ #endif typedef unsigned int uInt; /* 16 bits or more */ typedef unsigned long uLong; /* 32 bits or more */ #ifdef SMALL_MEDIUM /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ # define Bytef Byte FAR #else typedef Byte FAR Bytef; #endif typedef char FAR charf; typedef int FAR intf; typedef uInt FAR uIntf; typedef uLong FAR uLongf; #ifdef STDC typedef void const *voidpc; typedef void FAR *voidpf; typedef void *voidp; #else typedef Byte const *voidpc; typedef Byte FAR *voidpf; typedef Byte *voidp; #endif #if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ # include /* for off_t */ # include /* for SEEK_* and off_t */ # ifdef VMS # include /* for off_t */ # endif # define z_off_t off_t #endif #ifndef SEEK_SET # define SEEK_SET 0 /* Seek from beginning of file. */ # define SEEK_CUR 1 /* Seek from current position. */ # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ #endif #ifndef z_off_t # define z_off_t long #endif #if defined(__OS400__) # define NO_vsnprintf #endif #if defined(__MVS__) # define NO_vsnprintf # ifdef FAR # undef FAR # endif #endif /* MVS linker does not support external names larger than 8 bytes */ #if defined(__MVS__) # pragma map(deflateInit_,"DEIN") # pragma map(deflateInit2_,"DEIN2") # pragma map(deflateEnd,"DEEND") # pragma map(deflateBound,"DEBND") # pragma map(inflateInit_,"ININ") # pragma map(inflateInit2_,"ININ2") # pragma map(inflateEnd,"INEND") # pragma map(inflateSync,"INSY") # pragma map(inflateSetDictionary,"INSEDI") # pragma map(compressBound,"CMBND") # pragma map(inflate_table,"INTABL") # pragma map(inflate_fast,"INFA") # pragma map(inflate_copyright,"INCOPY") #endif #endif /* ZCONF_H */ ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/zutil.c0000644000175000017500000001574012320517543021435 0ustar mathieumathieu/* zutil.c -- target dependent utility functions for the compression library * Copyright (C) 1995-2005 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ #include "zutil.h" #ifndef NO_DUMMY_DECL struct internal_state {int dummy;}; /* for buggy compilers */ #endif const char * const z_errmsg[10] = { "need dictionary", /* Z_NEED_DICT 2 */ "stream end", /* Z_STREAM_END 1 */ "", /* Z_OK 0 */ "file error", /* Z_ERRNO (-1) */ "stream error", /* Z_STREAM_ERROR (-2) */ "data error", /* Z_DATA_ERROR (-3) */ "insufficient memory", /* Z_MEM_ERROR (-4) */ "buffer error", /* Z_BUF_ERROR (-5) */ "incompatible version",/* Z_VERSION_ERROR (-6) */ ""}; const char * ZEXPORT zlibVersion() { return ZLIB_VERSION; } uLong ZEXPORT zlibCompileFlags() { uLong flags; flags = 0; switch (sizeof(uInt)) { case 2: break; case 4: flags += 1; break; case 8: flags += 2; break; default: flags += 3; } switch (sizeof(uLong)) { case 2: break; case 4: flags += 1 << 2; break; case 8: flags += 2 << 2; break; default: flags += 3 << 2; } switch (sizeof(voidpf)) { case 2: break; case 4: flags += 1 << 4; break; case 8: flags += 2 << 4; break; default: flags += 3 << 4; } switch (sizeof(z_off_t)) { case 2: break; case 4: flags += 1 << 6; break; case 8: flags += 2 << 6; break; default: flags += 3 << 6; } #ifdef DEBUG flags += 1 << 8; #endif #if defined(ASMV) || defined(ASMINF) flags += 1 << 9; #endif #ifdef ZLIB_WINAPI flags += 1 << 10; #endif #ifdef BUILDFIXED flags += 1 << 12; #endif #ifdef DYNAMIC_CRC_TABLE flags += 1 << 13; #endif #ifdef NO_GZCOMPRESS flags += 1L << 16; #endif #ifdef NO_GZIP flags += 1L << 17; #endif #ifdef PKZIP_BUG_WORKAROUND flags += 1L << 20; #endif #ifdef FASTEST flags += 1L << 21; #endif #ifdef STDC # ifdef NO_vsnprintf flags += 1L << 25; # ifdef HAS_vsprintf_void flags += 1L << 26; # endif # else # ifdef HAS_vsnprintf_void flags += 1L << 26; # endif # endif #else flags += 1L << 24; # ifdef NO_snprintf flags += 1L << 25; # ifdef HAS_sprintf_void flags += 1L << 26; # endif # else # ifdef HAS_snprintf_void flags += 1L << 26; # endif # endif #endif return flags; } #ifdef DEBUG # ifndef verbose # define verbose 0 # endif int z_verbose = verbose; void z_error (m) char *m; { fprintf(stderr, "%s\n", m); exit(1); } #endif /* exported to allow conversion of error code to string for compress() and * uncompress() */ const char * ZEXPORT zError(err) int err; { return ERR_MSG(err); } #if defined(_WIN32_WCE) /* The Microsoft C Run-Time Library for Windows CE doesn't have * errno. We define it as a global variable to simplify porting. * Its value is always 0 and should not be used. */ int errno = 0; #endif #ifndef HAVE_MEMCPY void zmemcpy(dest, source, len) Bytef* dest; const Bytef* source; uInt len; { if (len == 0) return; do { *dest++ = *source++; /* ??? to be unrolled */ } while (--len != 0); } int zmemcmp(s1, s2, len) const Bytef* s1; const Bytef* s2; uInt len; { uInt j; for (j = 0; j < len; j++) { if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; } return 0; } void zmemzero(dest, len) Bytef* dest; uInt len; { if (len == 0) return; do { *dest++ = 0; /* ??? to be unrolled */ } while (--len != 0); } #endif #ifdef SYS16BIT #ifdef __TURBOC__ /* Turbo C in 16-bit mode */ # define MY_ZCALLOC /* Turbo C malloc() does not allow dynamic allocation of 64K bytes * and farmalloc(64K) returns a pointer with an offset of 8, so we * must fix the pointer. Warning: the pointer must be put back to its * original form in order to free it, use zcfree(). */ #define MAX_PTR 10 /* 10*64K = 640K */ local int next_ptr = 0; typedef struct ptr_table_s { voidpf org_ptr; voidpf new_ptr; } ptr_table; local ptr_table table[MAX_PTR]; /* This table is used to remember the original form of pointers * to large buffers (64K). Such pointers are normalized with a zero offset. * Since MSDOS is not a preemptive multitasking OS, this table is not * protected from concurrent access. This hack doesn't work anyway on * a protected system like OS/2. Use Microsoft C instead. */ voidpf zcalloc (voidpf opaque, unsigned items, unsigned size) { voidpf buf = opaque; /* just to make some compilers happy */ ulg bsize = (ulg)items*size; /* If we allocate less than 65520 bytes, we assume that farmalloc * will return a usable pointer which doesn't have to be normalized. */ if (bsize < 65520L) { buf = farmalloc(bsize); if (*(ush*)&buf != 0) return buf; } else { buf = farmalloc(bsize + 16L); } if (buf == NULL || next_ptr >= MAX_PTR) return NULL; table[next_ptr].org_ptr = buf; /* Normalize the pointer to seg:0 */ *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; *(ush*)&buf = 0; table[next_ptr++].new_ptr = buf; return buf; } void zcfree (voidpf opaque, voidpf ptr) { int n; if (*(ush*)&ptr != 0) { /* object < 64K */ farfree(ptr); return; } /* Find the original pointer */ for (n = 0; n < next_ptr; n++) { if (ptr != table[n].new_ptr) continue; farfree(table[n].org_ptr); while (++n < next_ptr) { table[n-1] = table[n]; } next_ptr--; return; } ptr = opaque; /* just to make some compilers happy */ Assert(0, "zcfree: ptr not found"); } #endif /* __TURBOC__ */ #ifdef M_I86 /* Microsoft C in 16-bit mode */ # define MY_ZCALLOC #if (!defined(_MSC_VER) || (_MSC_VER <= 600)) # define _halloc halloc # define _hfree hfree #endif voidpf zcalloc (voidpf opaque, unsigned items, unsigned size) { if (opaque) opaque = 0; /* to make compiler happy */ return _halloc((long)items, size); } void zcfree (voidpf opaque, voidpf ptr) { if (opaque) opaque = 0; /* to make compiler happy */ _hfree(ptr); } #endif /* M_I86 */ #endif /* SYS16BIT */ #ifndef MY_ZCALLOC /* Any system without a special alloc function */ #ifndef STDC extern voidp malloc OF((uInt size)); extern voidp calloc OF((uInt items, uInt size)); extern void free OF((voidpf ptr)); #endif voidpf zcalloc (opaque, items, size) voidpf opaque; unsigned items; unsigned size; { if (opaque) items += size - size; /* make compiler happy */ return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : (voidpf)calloc(items, size); } void zcfree (opaque, ptr) voidpf opaque; voidpf ptr; { free(ptr); if (opaque) return; /* make compiler happy */ } #endif /* MY_ZCALLOC */ ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/trees.h0000644000175000017500000002037412320517543021414 0ustar mathieumathieu/* header created automatically with -DGEN_TREES_H */ local const ct_data static_ltree[L_CODES+2] = { {{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, {{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, {{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, {{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, {{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, {{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, {{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, {{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, {{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, {{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, {{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, {{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, {{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, {{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, {{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, {{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, {{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, {{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, {{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, {{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, {{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, {{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, {{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, {{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, {{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, {{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, {{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, {{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, {{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, {{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, {{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, {{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, {{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, {{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, {{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, {{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, {{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, {{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, {{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, {{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, {{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, {{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, {{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, {{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, {{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, {{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, {{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, {{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, {{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, {{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, {{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, {{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, {{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, {{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, {{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, {{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, {{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, {{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} }; local const ct_data static_dtree[D_CODES] = { {{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, {{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, {{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, {{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, {{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, {{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} }; const uch _dist_code[DIST_CODE_LEN] = { 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, 18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 }; const uch _length_code[MAX_MATCH-MIN_MATCH+1]= { 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 }; local const int base_length[LENGTH_CODES] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 0 }; local const int base_dist[D_CODES] = { 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 }; ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/infback.c0000644000175000017500000005322412320517543021662 0ustar mathieumathieu/* infback.c -- inflate using a call-back interface * Copyright (C) 1995-2005 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* This code is largely copied from inflate.c. Normally either infback.o or inflate.o would be linked into an application--not both. The interface with inffast.c is retained so that optimized assembler-coded versions of inflate_fast() can be used with either inflate.c or infback.c. */ #include "zutil.h" #include "inftrees.h" #include "inflate.h" #include "inffast.h" /* function prototypes */ local void fixedtables OF((struct inflate_state FAR *state)); /* strm provides memory allocation functions in zalloc and zfree, or Z_NULL to use the library memory allocation functions. windowBits is in the range 8..15, and window is a user-supplied window and output buffer that is 2**windowBits bytes. */ int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size) z_streamp strm; int windowBits; unsigned char FAR *window; const char *version; int stream_size; { struct inflate_state FAR *state; if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || stream_size != (int)(sizeof(z_stream))) return Z_VERSION_ERROR; if (strm == Z_NULL || window == Z_NULL || windowBits < 8 || windowBits > 15) return Z_STREAM_ERROR; strm->msg = Z_NULL; /* in case we return an error */ if (strm->zalloc == (alloc_func)0) { strm->zalloc = zcalloc; strm->opaque = (voidpf)0; } if (strm->zfree == (free_func)0) strm->zfree = zcfree; state = (struct inflate_state FAR *)ZALLOC(strm, 1, sizeof(struct inflate_state)); if (state == Z_NULL) return Z_MEM_ERROR; Tracev((stderr, "inflate: allocated\n")); strm->state = (struct internal_state FAR *)state; state->dmax = 32768U; state->wbits = windowBits; state->wsize = 1U << windowBits; state->window = window; state->write = 0; state->whave = 0; return Z_OK; } /* Return state with length and distance decoding tables and index sizes set to fixed code decoding. Normally this returns fixed tables from inffixed.h. If BUILDFIXED is defined, then instead this routine builds the tables the first time it's called, and returns those tables the first time and thereafter. This reduces the size of the code by about 2K bytes, in exchange for a little execution time. However, BUILDFIXED should not be used for threaded applications, since the rewriting of the tables and virgin may not be thread-safe. */ local void fixedtables(state) struct inflate_state FAR *state; { #ifdef BUILDFIXED static int virgin = 1; static code *lenfix, *distfix; static code fixed[544]; /* build fixed huffman tables if first call (may not be thread safe) */ if (virgin) { unsigned sym, bits; static code *next; /* literal/length table */ sym = 0; while (sym < 144) state->lens[sym++] = 8; while (sym < 256) state->lens[sym++] = 9; while (sym < 280) state->lens[sym++] = 7; while (sym < 288) state->lens[sym++] = 8; next = fixed; lenfix = next; bits = 9; inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); /* distance table */ sym = 0; while (sym < 32) state->lens[sym++] = 5; distfix = next; bits = 5; inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); /* do this just once */ virgin = 0; } #else /* !BUILDFIXED */ # include "inffixed.h" #endif /* BUILDFIXED */ state->lencode = lenfix; state->lenbits = 9; state->distcode = distfix; state->distbits = 5; } /* Macros for inflateBack(): */ /* Load returned state from inflate_fast() */ #define LOAD() \ do { \ put = strm->next_out; \ left = strm->avail_out; \ next = strm->next_in; \ have = strm->avail_in; \ hold = state->hold; \ bits = state->bits; \ } while (0) /* Set state from registers for inflate_fast() */ #define RESTORE() \ do { \ strm->next_out = put; \ strm->avail_out = left; \ strm->next_in = next; \ strm->avail_in = have; \ state->hold = hold; \ state->bits = bits; \ } while (0) /* Clear the input bit accumulator */ #define INITBITS() \ do { \ hold = 0; \ bits = 0; \ } while (0) /* Assure that some input is available. If input is requested, but denied, then return a Z_BUF_ERROR from inflateBack(). */ #define PULL() \ do { \ if (have == 0) { \ have = in(in_desc, &next); \ if (have == 0) { \ next = Z_NULL; \ ret = Z_BUF_ERROR; \ goto inf_leave; \ } \ } \ } while (0) /* Get a byte of input into the bit accumulator, or return from inflateBack() with an error if there is no input available. */ #define PULLBYTE() \ do { \ PULL(); \ have--; \ hold += (unsigned long)(*next++) << bits; \ bits += 8; \ } while (0) /* Assure that there are at least n bits in the bit accumulator. If there is not enough available input to do that, then return from inflateBack() with an error. */ #define NEEDBITS(n) \ do { \ while (bits < (unsigned)(n)) \ PULLBYTE(); \ } while (0) /* Return the low n bits of the bit accumulator (n < 16) */ #define BITS(n) \ ((unsigned)hold & ((1U << (n)) - 1)) /* Remove n bits from the bit accumulator */ #define DROPBITS(n) \ do { \ hold >>= (n); \ bits -= (unsigned)(n); \ } while (0) /* Remove zero to seven bits as needed to go to a byte boundary */ #define BYTEBITS() \ do { \ hold >>= bits & 7; \ bits -= bits & 7; \ } while (0) /* Assure that some output space is available, by writing out the window if it's full. If the write fails, return from inflateBack() with a Z_BUF_ERROR. */ #define ROOM() \ do { \ if (left == 0) { \ put = state->window; \ left = state->wsize; \ state->whave = left; \ if (out(out_desc, put, left)) { \ ret = Z_BUF_ERROR; \ goto inf_leave; \ } \ } \ } while (0) /* strm provides the memory allocation functions and window buffer on input, and provides information on the unused input on return. For Z_DATA_ERROR returns, strm will also provide an error message. in() and out() are the call-back input and output functions. When inflateBack() needs more input, it calls in(). When inflateBack() has filled the window with output, or when it completes with data in the window, it calls out() to write out the data. The application must not change the provided input until in() is called again or inflateBack() returns. The application must not change the window/output buffer until inflateBack() returns. in() and out() are called with a descriptor parameter provided in the inflateBack() call. This parameter can be a structure that provides the information required to do the read or write, as well as accumulated information on the input and output such as totals and check values. in() should return zero on failure. out() should return non-zero on failure. If either in() or out() fails, than inflateBack() returns a Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it was in() or out() that caused in the error. Otherwise, inflateBack() returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format error, or Z_MEM_ERROR if it could not allocate memory for the state. inflateBack() can also return Z_STREAM_ERROR if the input parameters are not correct, i.e. strm is Z_NULL or the state was not initialized. */ int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) z_streamp strm; in_func in; void FAR *in_desc; out_func out; void FAR *out_desc; { struct inflate_state FAR *state; unsigned char FAR *next; /* next input */ unsigned char FAR *put; /* next output */ unsigned have, left; /* available input and output */ unsigned long hold; /* bit buffer */ unsigned bits; /* bits in bit buffer */ unsigned copy; /* number of stored or match bytes to copy */ unsigned char FAR *from; /* where to copy match bytes from */ code this; /* current decoding table entry */ code last; /* parent table entry */ unsigned len; /* length to copy for repeats, bits to drop */ int ret; /* return code */ static const unsigned short order[19] = /* permutation of code lengths */ {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; /* Check that the strm exists and that the state was initialized */ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; /* Reset the state */ strm->msg = Z_NULL; state->mode = TYPE; state->last = 0; state->whave = 0; next = strm->next_in; have = next != Z_NULL ? strm->avail_in : 0; hold = 0; bits = 0; put = state->window; left = state->wsize; /* Inflate until end of block marked as last */ for (;;) switch (state->mode) { case TYPE: /* determine and dispatch block type */ if (state->last) { BYTEBITS(); state->mode = DONE; break; } NEEDBITS(3); state->last = BITS(1); DROPBITS(1); switch (BITS(2)) { case 0: /* stored block */ Tracev((stderr, "inflate: stored block%s\n", state->last ? " (last)" : "")); state->mode = STORED; break; case 1: /* fixed block */ fixedtables(state); Tracev((stderr, "inflate: fixed codes block%s\n", state->last ? " (last)" : "")); state->mode = LEN; /* decode codes */ break; case 2: /* dynamic block */ Tracev((stderr, "inflate: dynamic codes block%s\n", state->last ? " (last)" : "")); state->mode = TABLE; break; case 3: strm->msg = (char *)"invalid block type"; state->mode = BAD; } DROPBITS(2); break; case STORED: /* get and verify stored block length */ BYTEBITS(); /* go to byte boundary */ NEEDBITS(32); if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { strm->msg = (char *)"invalid stored block lengths"; state->mode = BAD; break; } state->length = (unsigned)hold & 0xffff; Tracev((stderr, "inflate: stored length %u\n", state->length)); INITBITS(); /* copy stored block from input to output */ while (state->length != 0) { copy = state->length; PULL(); ROOM(); if (copy > have) copy = have; if (copy > left) copy = left; zmemcpy(put, next, copy); have -= copy; next += copy; left -= copy; put += copy; state->length -= copy; } Tracev((stderr, "inflate: stored end\n")); state->mode = TYPE; break; case TABLE: /* get dynamic table entries descriptor */ NEEDBITS(14); state->nlen = BITS(5) + 257; DROPBITS(5); state->ndist = BITS(5) + 1; DROPBITS(5); state->ncode = BITS(4) + 4; DROPBITS(4); #ifndef PKZIP_BUG_WORKAROUND if (state->nlen > 286 || state->ndist > 30) { strm->msg = (char *)"too many length or distance symbols"; state->mode = BAD; break; } #endif Tracev((stderr, "inflate: table sizes ok\n")); /* get code length code lengths (not a typo) */ state->have = 0; while (state->have < state->ncode) { NEEDBITS(3); state->lens[order[state->have++]] = (unsigned short)BITS(3); DROPBITS(3); } while (state->have < 19) state->lens[order[state->have++]] = 0; state->next = state->codes; state->lencode = (code const FAR *)(state->next); state->lenbits = 7; ret = inflate_table(CODES, state->lens, 19, &(state->next), &(state->lenbits), state->work); if (ret) { strm->msg = (char *)"invalid code lengths set"; state->mode = BAD; break; } Tracev((stderr, "inflate: code lengths ok\n")); /* get length and distance code code lengths */ state->have = 0; while (state->have < state->nlen + state->ndist) { for (;;) { this = state->lencode[BITS(state->lenbits)]; if ((unsigned)(this.bits) <= bits) break; PULLBYTE(); } if (this.val < 16) { NEEDBITS(this.bits); DROPBITS(this.bits); state->lens[state->have++] = this.val; } else { if (this.val == 16) { NEEDBITS(this.bits + 2); DROPBITS(this.bits); if (state->have == 0) { strm->msg = (char *)"invalid bit length repeat"; state->mode = BAD; break; } len = (unsigned)(state->lens[state->have - 1]); copy = 3 + BITS(2); DROPBITS(2); } else if (this.val == 17) { NEEDBITS(this.bits + 3); DROPBITS(this.bits); len = 0; copy = 3 + BITS(3); DROPBITS(3); } else { NEEDBITS(this.bits + 7); DROPBITS(this.bits); len = 0; copy = 11 + BITS(7); DROPBITS(7); } if (state->have + copy > state->nlen + state->ndist) { strm->msg = (char *)"invalid bit length repeat"; state->mode = BAD; break; } while (copy--) state->lens[state->have++] = (unsigned short)len; } } /* handle error breaks in while */ if (state->mode == BAD) break; /* build code tables */ state->next = state->codes; state->lencode = (code const FAR *)(state->next); state->lenbits = 9; ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), &(state->lenbits), state->work); if (ret) { strm->msg = (char *)"invalid literal/lengths set"; state->mode = BAD; break; } state->distcode = (code const FAR *)(state->next); state->distbits = 6; ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, &(state->next), &(state->distbits), state->work); if (ret) { strm->msg = (char *)"invalid distances set"; state->mode = BAD; break; } Tracev((stderr, "inflate: codes ok\n")); state->mode = LEN; case LEN: /* use inflate_fast() if we have enough input and output */ if (have >= 6 && left >= 258) { RESTORE(); if (state->whave < state->wsize) state->whave = state->wsize - left; inflate_fast(strm, state->wsize); LOAD(); break; } /* get a literal, length, or end-of-block code */ for (;;) { this = state->lencode[BITS(state->lenbits)]; if ((unsigned)(this.bits) <= bits) break; PULLBYTE(); } if (this.op && (this.op & 0xf0) == 0) { last = this; for (;;) { this = state->lencode[last.val + (BITS(last.bits + last.op) >> last.bits)]; if ((unsigned)(last.bits + this.bits) <= bits) break; PULLBYTE(); } DROPBITS(last.bits); } DROPBITS(this.bits); state->length = (unsigned)this.val; /* process literal */ if (this.op == 0) { Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? "inflate: literal '%c'\n" : "inflate: literal 0x%02x\n", this.val)); ROOM(); *put++ = (unsigned char)(state->length); left--; state->mode = LEN; break; } /* process end of block */ if (this.op & 32) { Tracevv((stderr, "inflate: end of block\n")); state->mode = TYPE; break; } /* invalid code */ if (this.op & 64) { strm->msg = (char *)"invalid literal/length code"; state->mode = BAD; break; } /* length code -- get extra bits, if any */ state->extra = (unsigned)(this.op) & 15; if (state->extra != 0) { NEEDBITS(state->extra); state->length += BITS(state->extra); DROPBITS(state->extra); } Tracevv((stderr, "inflate: length %u\n", state->length)); /* get distance code */ for (;;) { this = state->distcode[BITS(state->distbits)]; if ((unsigned)(this.bits) <= bits) break; PULLBYTE(); } if ((this.op & 0xf0) == 0) { last = this; for (;;) { this = state->distcode[last.val + (BITS(last.bits + last.op) >> last.bits)]; if ((unsigned)(last.bits + this.bits) <= bits) break; PULLBYTE(); } DROPBITS(last.bits); } DROPBITS(this.bits); if (this.op & 64) { strm->msg = (char *)"invalid distance code"; state->mode = BAD; break; } state->offset = (unsigned)this.val; /* get distance extra bits, if any */ state->extra = (unsigned)(this.op) & 15; if (state->extra != 0) { NEEDBITS(state->extra); state->offset += BITS(state->extra); DROPBITS(state->extra); } if (state->offset > state->wsize - (state->whave < state->wsize ? left : 0)) { strm->msg = (char *)"invalid distance too far back"; state->mode = BAD; break; } Tracevv((stderr, "inflate: distance %u\n", state->offset)); /* copy match from window to output */ do { ROOM(); copy = state->wsize - state->offset; if (copy < left) { from = put + copy; copy = left - copy; } else { from = put - state->offset; copy = left; } if (copy > state->length) copy = state->length; state->length -= copy; left -= copy; do { *put++ = *from++; } while (--copy); } while (state->length != 0); break; case DONE: /* inflate stream terminated properly -- write leftover output */ ret = Z_STREAM_END; if (left < state->wsize) { if (out(out_desc, state->window, state->wsize - left)) ret = Z_BUF_ERROR; } goto inf_leave; case BAD: ret = Z_DATA_ERROR; goto inf_leave; default: /* can't happen, but makes compilers happy */ ret = Z_STREAM_ERROR; goto inf_leave; } /* Return unused input */ inf_leave: strm->next_in = next; strm->avail_in = have; return ret; } int ZEXPORT inflateBackEnd(strm) z_streamp strm; { if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) return Z_STREAM_ERROR; ZFREE(strm, strm->state); strm->state = Z_NULL; Tracev((stderr, "inflate: end\n")); return Z_OK; } ImageVis3D-3.1.0/StandaloneTuvok/3rdParty/uncompr.c0000644000175000017500000000405112320517543021742 0ustar mathieumathieu/* uncompr.c -- decompress a memory buffer * Copyright (C) 1995-2003 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ #define ZLIB_INTERNAL #include "zlib.h" /* =========================================================================== Decompresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be large enough to hold the entire uncompressed data. (The size of the uncompressed data must have been saved previously by the compressor and transmitted to the decompressor by some mechanism outside the scope of this compression library.) Upon exit, destLen is the actual size of the compressed buffer. This function can be used to decompress a whole file at once if the input file is mmap'ed. uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, or Z_DATA_ERROR if the input data was corrupted. */ int Q_ZEXPORT uncompress (dest, destLen, source, sourceLen) Bytef *dest; uLongf *destLen; const Bytef *source; uLong sourceLen; { z_stream stream; int err; stream.next_in = (Bytef*)source; stream.avail_in = (uInt)sourceLen; /* Check for source > 64K on 16-bit machine: */ if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; stream.next_out = dest; stream.avail_out = (uInt)*destLen; if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; stream.zalloc = (alloc_func)0; stream.zfree = (free_func)0; err = inflateInit(&stream); if (err != Z_OK) return err; err = inflate(&stream, Z_FINISH); if (err != Z_STREAM_END) { inflateEnd(&stream); if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) return Z_DATA_ERROR; return err; } *destLen = stream.total_out; err = inflateEnd(&stream); return err; } ImageVis3D-3.1.0/StandaloneTuvok/GLContext.cpp0000644000175000017500000002222612320517543020762 0ustar mathieumathieu#include "GLContext.h" #include "3rdParty/GLEW/GL/glew.h" #ifdef DETECTED_OS_WINDOWS #include "3rdParty/GLEW/GL/wglew.h" #else #include "3rdParty/GLEW/GL/glxew.h" #endif GLContext::GLContext(UINT32 width, UINT32 height, BYTE colorBits, BYTE depthBits, BYTE stencilBits, bool useDoubleBuffer, std::wostream * errorOutput) : #ifdef DETECTED_OS_WINDOWS deviceContext(NULL), previousDeviceContext(NULL), renderingContext(NULL), previousRenderingContext(NULL), window(NULL), #else window(None), previousWindow(None), renderingContext(NULL), previousRenderingContext(NULL), display(NULL), #endif valid(false), errorStream(errorOutput) { if (width == 0 || height == 0 || !(colorBits == 8 || colorBits == 16 || colorBits == 24 || colorBits == 32) || !(depthBits == 0 || depthBits == 8 || depthBits == 16 || depthBits == 24 || depthBits == 32) || !(stencilBits == 0 || stencilBits == 8)) { outputError(L"Invalid parameters passed to constructor"); return; } #ifdef DETECTED_OS_WINDOWS window = CreateWindowExW(WS_EX_TOOLWINDOW, L"Static", L"GLContextWindow", WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN , 0, 0, width, height, 0, 0, GetModuleHandle(NULL), 0); if (!window) { outputLastError(); return; } ShowWindow(window, SW_HIDE); deviceContext = GetDC(window); if (!deviceContext) { outputLastError(); // GetDC does not emit an error according to the documentation, but this should still work return; } PIXELFORMATDESCRIPTOR pfd; pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); pfd.nVersion = 1; pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_TYPE_RGBA; if (useDoubleBuffer) pfd.dwFlags |= PFD_DOUBLEBUFFER; pfd.iPixelType = PFD_TYPE_RGBA; pfd.cColorBits = colorBits; pfd.cRedBits = 0; pfd.cRedShift = 0; pfd.cGreenBits = 0; pfd.cGreenShift = 0; pfd.cBlueBits = 0; pfd.cBlueShift = 0; pfd.cAlphaBits = 0; pfd.cAlphaShift = 0; pfd.cAccumBits = 0; pfd.cAccumRedBits = 0; pfd.cAccumGreenBits = 0; pfd.cAccumBlueBits = 0; pfd.cAccumAlphaBits = 0; pfd.cDepthBits = depthBits; pfd.cStencilBits = stencilBits; pfd.cAuxBuffers = 0; pfd.iLayerType = PFD_MAIN_PLANE; pfd.bReserved = 0; pfd.dwLayerMask = 0; pfd.dwVisibleMask = 0; pfd.dwDamageMask = 0; int pixelFormat = ChoosePixelFormat(deviceContext, &pfd); if (!pixelFormat) { outputLastError(); return; } PIXELFORMATDESCRIPTOR pfdResult; DescribePixelFormat(deviceContext, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfdResult); if (!(pfdResult.dwFlags & PFD_SUPPORT_OPENGL)) { outputError(L"No OpenGL support"); return; } if (useDoubleBuffer && !(pfdResult.dwFlags & PFD_DOUBLEBUFFER)) outputWarning(L"No double buffer support"); std::wostringstream ss; if (pfdResult.cColorBits != colorBits) { ss << L"Color bits requested: " << colorBits << L", actual color bits: " << pfdResult.cColorBits; outputWarning(ss.str()); } ss.str(L""); if (pfdResult.cDepthBits != depthBits) { ss << L"Depth bits requested " << depthBits << L", actual depth bits: " << pfdResult.cDepthBits; outputWarning(ss.str()); } ss.str(L""); if (pfdResult.cStencilBits != stencilBits) { ss << L"Stencil bits requested " << stencilBits << L", actual stencil bits: " << pfdResult.cStencilBits; outputWarning(ss.str()); } if (!SetPixelFormat(deviceContext, pixelFormat, &pfd)) { outputLastError(); return; } renderingContext = wglCreateContext(deviceContext); if (!renderingContext) { outputLastError(); return; } // we prefer to remember this once in the beginning for now // this is more predictable to handle // but we can still get into quite some confusion when using several GLContexts interleaved, so probably make this more intelligent later previousDeviceContext = wglGetCurrentDC(); previousRenderingContext = wglGetCurrentContext(); #else display = XOpenDisplay(0); if (!display) { outputError(L"Could not create display"); return; } if (!glXQueryExtension(display, NULL, NULL) || !glxQueryVersion(display, NULL, NULL)) { outputError(L"Could not find valid glx extension"); return; } int sizePerChannel = (int)colorBits / 4; int doubleBufferAttribute = (useDoubleBuffer ? GLX_DOUBLEBUFFER : GLX_USE_GL); // GLX_USE_GL is just ignored as it is true on default int attributeList[] = { GLX_RGBA, doubleBufferAttribute, GLX_RED_SIZE, sizePerChannel, GLX_GREEN_SIZE, sizePerChannel, GLX_BLUE_SIZE, sizePerChannel, GLX_ALPHA_SIZE, sizePerChannel, GLX_DEPTH_SIZE, (int)depthBits, GLX_STENCIL_SIZE, (int)stencilBits, None }; XVisualInfo * vi = glXChooseVisual(display, DefaultScreen(display), attributeList); if (!vi) { outputError(L"Could not create visual"); return; } // add warnings here whether requested visual attributes could be supported (using glXGetConfig()) // we should not need our own error handling for those, as they should use the default handler and thus exit on error XSetWindowAttributes swa; swa.colormap = XCreateColormap(display, RootWindow(display, vi->screen), vi->visual, AllocNone); swa.border_pixel = 0; swa.event_mask = StructureNotifyMask; window = XCreateWindow(display, RootWindow(display, vi->screen), 0, 0, width, height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap | CWEventMask, &swa); XFreeColorMap(swa.colormap): XMapWindow(display, window); renderingContext = glxCreateContext(display, vi, NULL, true); XFree(vi); if (!renderingContext) { outputError(L"Could not create glx context"); return; } previousWindow = glXGetCurrentDrawable(); previousRenderingContext = glXGetCurrentContext(); #endif valid = true; } GLContext::~GLContext() { // add error messages here later as those methods may fail as well #ifdef DETECTED_OS_WINDOWS if (deviceContext == wglGetCurrentDC() && renderingContext == wglGetCurrentContext()) restorePrevious(); wglDeleteContext(renderingContext); ReleaseDC(window, deviceContext); DestroyWindow(window); #else if (window == glXGetCurrentDrawable() && renderingContext == glXGetCurrentContext()) restorePrevious(); glXDestroyContext(display, renderingContext); XDestroyWindow(display, window); XCloseDisplay(display); #endif } // for the next two, we go the windows way for now // this means that if we have a valid context and they still fail, the current context of the thread will be unset (see comments below) // NOTE: this has been tested and the msdn documentation http://msdn.microsoft.com/en-us/library/dd374387%28VS.85%29.aspx is wrong in this case // if an error occurs, the threads current context will not be made not current (even though the doc states exactly that) // so, we roll back and below methods will now leave the current context as is on error bool GLContext::set() { if (!isValid()) return false; #ifdef DETECTED_OS_WINDOWS if (!wglMakeCurrent(deviceContext, renderingContext)) // if this fails, it automatically unsets the threads context // so remember to call restorePrevious to fall back to the context which was current when this context was created // or call set of the context which was current before this call // otherwise, no context will be set at all // WRONG, see comment above { outputLastError(); return false; } #else if (!glXMakeCurrent(display, window, renderingContext)) { outputError(L"Could not set glx context"); //glXMakeCurrent(display, None, NULL); // we call this to unset the threads context which is not done automatically (unlike wglMakeCurrent) return false; } #endif return true; } bool GLContext::restorePrevious() { if (!isValid()) return false; #ifdef DETECTED_OS_WINDOWS if (!wglMakeCurrent(previousDeviceContext, previousRenderingContext)) { outputLastError(); return false; } #else if (!glXMakeCurrent(display, previousWindow, previousRenderingContext)) { outputError(L"Could not restore previous glx context"); //glXMakeCurrent(display, None, NULL); return false; } #endif return true; } bool GLContext::copyState(const GLContext & fromContext) { if (!isValid()) return false; #ifdef DETECTED_OS_WINDOWS if (!wglCopyContext(fromContext.renderingContext, renderingContext, GL_ALL_ATTRIB_BITS)) { outputLastError(); return false; } #else glXCopyContext(display, fromContext.renderingContext, renderingContext, GLX_ALL_ATTRIB_BITS); #endif return true; } bool GLContext::swapBuffers() { if (!isValid()) return false; #ifdef DETECTED_OS_WINDOWS if (!wglSwapLayerBuffers(deviceContext, WGL_SWAP_MAIN_PLANE)) { outputLastError(); return false; } #else glXSwapBuffers(display, window); #endif return true; } void GLContext::outputWarning(const std::wstring & warning) const { if (errorStream) *errorStream << "Warning: " << warning << std::endl; } void GLContext::outputError(const std::wstring & error) const { if (errorStream) *errorStream << "Error: " << error << std::endl; } void GLContext::outputLastError() const { if (errorStream) { #ifdef DETECTED_OS_WINDOWS DWORD lastError = GetLastError(); LPVOID msgBuffer; FormatMessageW ( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, lastError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&msgBuffer, 0, NULL ); outputError(std::wstring((LPTSTR)msgBuffer)); LocalFree(msgBuffer); #else #endif } } ImageVis3D-3.1.0/StandaloneTuvok/CmdRenderer.cpp0000644000175000017500000001033212320517543021300 0ustar mathieumathieu// Disable checked iterators on Windows. #ifndef _DEBUG # undef _SECURE_SCL # define _SECURE_SCL 0 #endif #ifdef _WIN32 // CRT's memory leak detection on windows #if defined(DEBUG) || defined(_DEBUG) #define _CRTDBG_MAP_ALLOC #include #include #ifndef DBG_NEW #define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ ) #define new DBG_NEW #endif #endif #endif #include #include #include "Renderer/GL/GLRenderer.h" #include "IO/IOManager.h" #include "GLContext.h" #include "SmallImage.h" #include "Renderer/ContextIdentification.h" #define SHADER_PATH "Shaders" bool SaveFBOToDisk(const std::string& filename) { GLint viewport[4]; glGetIntegerv(GL_VIEWPORT, viewport); SmallImage s(viewport[2], viewport[3], 4); boost::uint8_t* pixels = s.GetDataPtrRW(); GLuint texture; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, viewport[2], viewport[3], 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glPixelStorei(GL_PACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glReadBuffer(GL_BACK); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, viewport[2], viewport[3], 0); // faster than glReadPixels, so use this to copy from backbuffer glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, &pixels[0]); return s.SaveToBMPFile(filename); } int main(int argc, char * argv[]) { #ifdef _WIN32 // CRT's memory leak detection on windows #if defined(DEBUG) || defined(_DEBUG) _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_DEBUG ); #endif #endif std::string filename; try { TCLAP::CmdLine cmd("rendering test program"); TCLAP::ValueArg dset("d", "dataset", "Dataset to render.", true, "", "filename"); cmd.add(dset); cmd.parse(argc, argv); filename = dset.getValue(); } catch (const TCLAP::ArgException & e) { std::cerr << "error: " << e.error() << " for arg " << e.argId() << "\n"; return EXIT_FAILURE; } try { GLContext context(1920, 1200, 32, 24, 8, true, &std::wcerr); if (!context.isValid() || !context.set()) return EXIT_FAILURE; GLenum err = glewInit(); if (err != GLEW_OK) { std::cerr << "Error initializing GLEW: " << glewGetErrorString(err) << "\n"; return EXIT_FAILURE; } tuvok::Controller::Instance().DebugOut()->SetOutput(true, true, true, true); // Convert the data into a UVF if necessary if ( SysTools::ToLowerCase(SysTools::GetExt(filename)) != "uvf" ) { std::string uvf_file = SysTools::RemoveExt(filename) + ".uvf"; const std::string tmpdir = "/tmp/"; const bool quantize8 = false; tuvok::Controller::Instance().IOMan()->ConvertDataset(filename, uvf_file, tmpdir, true, 256, 4, quantize8); filename = uvf_file; } // tuvok::AbstrRenderer * renderer = tuvok::Controller::Instance().RequestNewVolumeRenderer(tuvok::MasterController::OPENGL_SBVR, // false, false, false, false, false); std::shared_ptr ss = tuvok::Controller::Instance().LuaScript(); tuvok::LuaClassInstance inst = ss->cexecRet( "tuvok.renderer.new", int(tuvok::MasterController::OPENGL_SBVR), false, false, false, false, false); tuvok::AbstrRenderer* renderer = inst.getRawPointer(ss); renderer->LoadDataset(filename); renderer->AddShaderPath(SHADER_PATH); renderer->Initialize(tuvok::GLContextID::Current()); renderer->Resize(UINTVECTOR2(1920, 1200)); const std::vector & rr = renderer->GetRenderRegions(); renderer->SetRendererTarget(tuvok::AbstrRenderer::RT_HEADLESS); FLOATMATRIX4 rm; rm.RotationX(45.0); renderer->SetRotation(rr[0], rm); renderer->Paint(); SaveFBOToDisk("image.bmp"); renderer->Cleanup(); tuvok::Controller::Instance().ReleaseVolumeRenderer(renderer); context.restorePrevious(); } catch (const std::exception & e) { std::cerr << "Exception: " << e.what() << "\n"; return EXIT_FAILURE; } return EXIT_SUCCESS; } ImageVis3D-3.1.0/README.md0000644000175000017500000000035012320517543014537 0ustar mathieumathieuImageVis3D ========== [![Build Status](https://travis-ci.org/SCIInstitute/ImageVis3D.png)](https://travis-ci.org/SCIInstitute/ImageVis3D) ImageVis3D is an out-of-core volume rendering application. See: http://www.imagevis3d.org . ImageVis3D-3.1.0/UVFReader/0000755000175000017500000000000012320517543015045 5ustar mathieumathieuImageVis3D-3.1.0/UVFReader/.gitignore0000644000175000017500000000000412320517543017027 0ustar mathieumathieu*.o ImageVis3D-3.1.0/UVFReader/TuvokReader.vcxproj.filters0000644000175000017500000000144312320517543022366 0ustar mathieumathieu {f868371d-022b-43ef-878e-a34d9e84f6d7} DebugOut DebugOut ImageVis3D-3.1.0/UVFReader/BlockInfo.h0000644000175000017500000003657612320517543017105 0ustar mathieumathieu#ifndef BLOCKINFO_H #define BLOCKINFO_H #include #include #include #include #include #include #include "../Tuvok/StdTuvokDefines.h" #include "../Tuvok/Controller/Controller.h" #include "../Tuvok/IO/IOManager.h" // #include "../Tuvok/IO/TuvokSizes.h" #include "../Tuvok/IO/UVF/UVF.h" #include "../Tuvok/IO/UVF/Histogram1DDataBlock.h" #include "../Tuvok/IO/UVF/Histogram2DDataBlock.h" #include "../Tuvok/IO/UVF/MaxMinDataBlock.h" #include "../Tuvok/IO/UVF/RasterDataBlock.h" #include "../Tuvok/IO/UVF/TOCBlock.h" #include "../Tuvok/IO/UVF/KeyValuePairDataBlock.h" #include "../Tuvok/IO/UVF/GeometryDataBlock.h" using namespace std; void PrintGeneralBlockInfo(const DataBlock* b, uint64_t i) { cout << " Block " << i << ": " << b->strBlockID << endl << " Data is of type: " << UVFTables::BlockSemanticTableToCharString(b->GetBlockSemantic()) << endl << " Global Block Compression is : " << UVFTables::CompressionSemanticToCharString(b->ulCompressionScheme) << endl; } void PrintToCBlockInfo(const TOCBlock* b) { if (!b) { cerr << "Block cast error" << endl; return; } cout << " Volume Information: " << endl << " Level of detail: " << b->GetLoDCount() << endl << " Max Bricksize: (" << b->GetMaxBrickSize().x << " x " << b->GetMaxBrickSize().y << " x " << b->GetMaxBrickSize().z << ")" << endl; for (uint64_t i=0;iGetLoDCount();++i) { cout << " Level " << i << " size:" << b->GetLODDomainSize(i).x << "x" << b->GetLODDomainSize(i).y << "x" << b->GetLODDomainSize(i).z << endl; UINT64VECTOR3 brickCount = b->GetBrickCount(i); cout << " Bricks: " << brickCount.x << "x" << brickCount.y << "x" << brickCount.z; uint64_t iCompressionNone = 0; uint64_t iCompressionZLIB = 0; uint64_t iCompressionLZMA = 0; uint64_t iCompressionLZ4 = 0; uint64_t iCompressionBZLIB = 0; uint64_t iCompressionLZHAM = 0; uint64_t iCompressionOther = 0; for (uint64_t bz=0;bzGetBrickInfo(UINT64VECTOR4(bx,by,bz,i)); switch (te.m_eCompression) { case CT_NONE : iCompressionNone++; break; case CT_ZLIB : iCompressionZLIB++; break; case CT_LZMA : iCompressionLZMA++; break; case CT_LZ4 : iCompressionLZ4++; break; case CT_BZLIB : iCompressionBZLIB++; break; case CT_LZHAM : iCompressionLZHAM++; break; default : iCompressionOther++; break; } } } } cout << " ("; if (iCompressionNone) cout << " Uncompressed:" << iCompressionNone; if (iCompressionZLIB) cout <<" ZLIB:" << iCompressionZLIB; if (iCompressionLZMA) cout <<" LZMA:" << iCompressionLZMA; if (iCompressionLZ4) cout <<" LZ4:" << iCompressionLZ4; if (iCompressionBZLIB) cout <<" BZLIB:" << iCompressionBZLIB; if (iCompressionLZHAM) cout <<" LZHAM:" << iCompressionLZHAM; if (iCompressionOther) cout <<" Other:" << iCompressionOther; cout << " )" << endl; } } void PrintRDBlockInfo(const RasterDataBlock* b, bool bShowData) { if (!b) { cerr << "Block cast error" << endl; return; } cout << " Volume Information: " << endl << " Semantics:"; for (size_t j=0; j < b->ulDomainSemantics.size(); j++) { cout << " " << DomainSemanticToCharString(b->ulDomainSemantics[j]).c_str(); } cout << endl << " Levels of detail: " << b->ulLODDecFactor.size() << endl << " Size:"; for (size_t j = 0;julDomainSemantics.size();j++) { cout << " " << b->ulDomainSize[j]; } cout << endl << " Data:"; for (size_t j = 0;julElementDimension;j++) { for (size_t k = 0;kulElementDimensionSize[j];k++) { cout << " " << UVFTables::ElementSemanticTableToCharString( b->ulElementSemantic[j][k]).c_str(); } cout << endl << " Transformation:\n"; size_t ulTransformDimension = b->ulDomainSemantics.size()+1; if (ulTransformDimension * ulTransformDimension != b->dDomainTransformation.size()) { cerr << " error in domain transformation: " << endl; return; } size_t jj = 0; for (size_t y = 0;ydDomainTransformation[jj++]; } cout << endl; } } if(bShowData) { std::cout << " raw data:\n"; uint64_t bit_width = b->ulElementBitSize[0][0]; const bool is_signed = b->bSignedElement[0][0]; const bool is_float = bit_width != b->ulElementMantissa[0][0]; if(is_float && bit_width == 32) { std::copy(LODBrickIterator(b), LODBrickIterator(), std::ostream_iterator(std::cout, " ")); } else if(is_float && bit_width == 64) { std::copy(LODBrickIterator(b), LODBrickIterator(), std::ostream_iterator(std::cout, " ")); } else if(!is_signed && bit_width == 8) { // note for this and uint8 we use "int", but only in the output // iterator -- otherwise the stream interprets it as character // data and outputs garbage. std::copy(LODBrickIterator(b), LODBrickIterator(), std::ostream_iterator(std::cout, " ")); } else if( is_signed && bit_width == 8) { std::copy(LODBrickIterator(b), LODBrickIterator(), std::ostream_iterator(std::cout, " ")); } else if(!is_signed && bit_width == 16) { std::copy(LODBrickIterator(b), LODBrickIterator(), std::ostream_iterator(std::cout, " ")); } else if( is_signed && bit_width == 16) { std::copy(LODBrickIterator(b), LODBrickIterator(), std::ostream_iterator(std::cout, " ")); } else if(!is_signed && bit_width == 32) { std::copy(LODBrickIterator(b), LODBrickIterator(), std::ostream_iterator(std::cout, " ")); } else if( is_signed && bit_width == 32) { std::copy(LODBrickIterator(b), LODBrickIterator(), std::ostream_iterator(std::cout, " ")); } else { T_ERROR("Unsupported data type!"); } std::cout << "\n"; } } void PrintKVPBlockInfo(const KeyValuePairDataBlock* b) { if (!b) { cerr << "Block cast error" << endl; return; } cout << " Data size: " << b->ComputeDataSize() << "\n" << " Values (" << b->GetKeyCount() << "): " << endl; for (size_t i = 0;iGetKeyCount();i++) { cout << " " << b->GetKeyByIndex(i).c_str() << " -> " << b->GetValueByIndex(i).c_str() << endl; } } void PrintH1DBlockInfo(const Histogram1DDataBlock* b, bool bShow1dhist) { if (!b) { cerr << "Block cast error" << endl; return; } size_t iFilledSize = 0; for (size_t i = 0;iGetHistogram().size();i++) { if ( b->GetHistogram()[i] != 0) { iFilledSize = i+1; } } cout << " Filled size: " << iFilledSize << endl; if (bShow1dhist) { cout << " Entries: " << endl; for (size_t i = 0;iGetHistogram()[i] << " "; } cout << endl; } } void PrintH2DBlockInfo(const Histogram2DDataBlock* b, bool bShow2dhist) { if (!b) { cerr << "Block cast error" << endl; return; } VECTOR2 vSize(0,0); for (size_t j = 0;jGetHistogram().size();j++) { for (size_t i = 0;iGetHistogram()[j].size();i++) { if ( b->GetHistogram()[j][i] != 0) { if ((i+1) > vSize.y) { vSize.y = i+1; } vSize.x = j+1; } } } cout << " Filled size: " << vSize.x << " x " << vSize.y << endl; if (bShow2dhist) { cout << " Entries: " << endl; for (size_t j = 0; j < vSize.y; j++) { for (size_t i = 0; i < vSize.x; i++) { cout << i << "/" << j << ":" << b->GetHistogram()[i][j] << "\n"; } } cout << endl; } } void PrintMaxMinBlockInfo(const MaxMinDataBlock* b) { if (!b) { cerr << "Block cast error" << endl; return; } for (size_t i = 0;iGetComponentCount();++i) { if (b->GetComponentCount() > 1) cout << " Component " << i << ":\n"; cout << " Minimum: " << b->GetGlobalValue(i).minScalar << "\n"; cout << " Maximum: " << b->GetGlobalValue(i).maxScalar << "\n"; cout << " " "Min Gradient: " << b->GetGlobalValue(i).minGradient << "\n"; cout << " " "Max Gradient: " << b->GetGlobalValue(i).maxGradient << "\n"; } } void PrintGeoBlockInfo(const GeometryDataBlock* b) { if (!b) { cerr << "Block cast error" << endl; return; } cout << " Description: " << b->m_Desc.c_str() << ".\n"; size_t vI = b->GetVertexIndices().size()/3; size_t vN = b->GetNormalIndices().size()/3; size_t vT = b->GetTexCoordIndices().size()/2; size_t vC = b->GetColorIndices().size()/4; size_t v = b->GetVertices().size()/size_t(b->GetPolySize()); size_t n = b->GetNormals().size()/size_t(b->GetPolySize()); size_t t = b->GetTexCoords().size()/size_t(b->GetPolySize()); size_t c = b->GetColors().size()/size_t(b->GetPolySize()); cout << " Polygon count: " << vI << ".\n"; if (vI == vN) cout << " Valid Normals found.\n"; if (vI == vT) cout << " Valid Texture Coordinates found.\n"; if (vI == vC) cout << " Valid Colors found.\n"; cout << " Vertex count: " << v << ".\n"; if (n > 0) cout << " Normal count: " << n << ".\n"; if (t > 0) cout << " Texture Coordinate count: " << t << ".\n"; if (c > 0) cout << " Color count: " << c << ".\n"; const std::vector< float >& col = b->GetDefaultColor(); cout << " Default Color: " << col[0] << " " << col[1] << " " << col[2] << " " << col[3]; if (c > 0) cout << " (not used since vertex colors are specified)\n"; else cout << "\n"; } bool DisplayUVFInfo(std::string strUVFName, bool bVerify, bool bShowData, bool bShow1dhist, bool bShow2dhist) { wstring wstrUVFName(strUVFName.begin(), strUVFName.end()); UVF uvfFile(wstrUVFName); std::string strProblem; if (!uvfFile.Open(false, bVerify, false, &strProblem)) { cerr << endl << "Unable to open file " << strUVFName.c_str() << "!" << endl << "Error: " << strProblem.c_str() << endl; return false; } cout << "Successfully opened UVF File " << strUVFName.c_str() << endl; const GlobalHeader& gh = uvfFile.GetGlobalHeader(); if (gh.bIsBigEndian) { cout << " File is BIG endian format!" << endl; } else { cout << " File is little endian format!" << endl; } cout << " The version of the file is " << gh.ulFileVersion << " (the version of the reader is " << UVF::ms_ulReaderVersion << ")"<< endl << " The file uses the " << UVFTables::ChecksumSemanticToCharString( gh.ulChecksumSemanticsEntry).c_str() << " checksum technology with a bitlength of " << gh.vcChecksum.size()*8; if (gh.ulChecksumSemanticsEntry > UVFTables::CS_NONE && gh.ulChecksumSemanticsEntry < UVFTables::CS_UNKNOWN) { if (bVerify) { // since we opened the file with verify, the checksum must be valid // if we are at this point :-) cout << " [Checksum is valid!]" << endl; } else { cout << " [Checksum not verified by parameter!]" << endl; } } else { cout << endl; } if (gh.ulAdditionalHeaderSize > 0) { cout << " further (unparsed) global header information was found!!! " << endl; } if (uvfFile.GetDataBlockCount() == 1) { cout << " It contains one block of data" << endl; } else { cout << " It contains " << uvfFile.GetDataBlockCount() << " blocks of data" << endl; } for(uint64_t i = 0; iGetBlockSemantic()) { case UVFTables::BS_TOC_BLOCK: PrintToCBlockInfo(dynamic_cast(b)); break; case UVFTables::BS_REG_NDIM_GRID : PrintRDBlockInfo(dynamic_cast(b), bShowData); break; case UVFTables::BS_KEY_VALUE_PAIRS : PrintKVPBlockInfo(dynamic_cast(b)); break; case UVFTables::BS_1D_HISTOGRAM: PrintH1DBlockInfo(dynamic_cast(b), bShow1dhist); break; case UVFTables::BS_2D_HISTOGRAM: PrintH2DBlockInfo(dynamic_cast(b), bShow2dhist); break; case UVFTables::BS_MAXMIN_VALUES: PrintMaxMinBlockInfo(dynamic_cast(b)); break; case UVFTables::BS_GEOMETRY: PrintGeoBlockInfo(dynamic_cast(b)); break; default: /// \todo handle other block types T_ERROR(" --> Unknown/Unimplemented block type %d", static_cast(b->GetBlockSemantic())); break; } } uvfFile.Close(); return true; } #endif // BLOCKINFO_H /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. 2012 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/UVFReader/main.cpp0000644000175000017500000002233112320517543016476 0ustar mathieumathieu#include #include #include #include #include #include "DataSource.h" #include "BlockInfo.h" #include "Basics/SystemInfo.h" using namespace boost; using namespace std; using namespace tuvok; #ifdef _WIN32 // CRT's memory leak detection #if defined(DEBUG) || defined(_DEBUG) #include #endif #endif int main(int argc, char* argv[]) { HRConsoleOut* debugOut = new HRConsoleOut(); debugOut->SetOutput(true, true, true, false); debugOut->SetClearOldMessage(true); Controller::Instance().AddDebugOut(debugOut); const uint64_t mem = Controller::Const().SysInfo().GetCPUMemSize(); Controller::Instance().SetMaxCPUMem(uint64_t(mem/(1024*1024) * 0.8)); MESSAGE(""); cout << endl; #ifdef _WIN32 // Enable run-time memory check for debug builds. #if defined(DEBUG) | defined(_DEBUG) _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif #endif string strUVFName = ""; uint32_t iSizeX = 100; uint32_t iSizeY = 200; uint32_t iSizeZ = 300; uint32_t iBitSize = 8; uint32_t iBrickSize = DEFAULT_BRICKSIZE; uint32_t iIter = 0; uint32_t iMem = 0; uint32_t iBrickLayout = 0; // 0 is default scanline layout uint32_t iCompression = 1; // 1 is default zlib compression uint32_t iCompressionLevel = 1; // generic compression level, 1 is best speed bool bCreateFile; bool bhierarchical; bool bVerify; bool bShow1dhist; bool bShow2dhist; ECreationType eCreationType; bool bShowData; bool bUseToCBlock; bool bKeepRaw; try { TCLAP::CmdLine cmd("UVF diagnostic and demo data generation tool"); TCLAP::MultiArg inputs("f", "file", "input/output file.", true, "filename"); TCLAP::SwitchArg noverify("n", "noverify", "disable the checksum test", false); TCLAP::SwitchArg hist1d("1", "1dhist", "output the 1D histogram", false); TCLAP::SwitchArg hist2d("2", "2dhist", "output the 2D histogram", false); TCLAP::SwitchArg create("c", "create", "create instead of read a UVF", false); TCLAP::ValueArg ctype("t", "creation-type", "What type of volume to " "create. 0: mandelbulb fractal, 1: all zeros," "2: random values, otherwise create a sphere", false, static_cast(3), "volume type class"); TCLAP::SwitchArg hierarchical("g", "hierarchical", "hierarchical generation mode", false); std::string uint = "unsigned integer"; TCLAP::SwitchArg output_data("d", "data", "display data at finest" " resolution", false); TCLAP::ValueArg iter("i", "iterations", "number of iterations " "for fractal compuation", false, static_cast(0), uint); TCLAP::ValueArg mem("e", "memory", "gigabytes of memory " "to be used for UVF creation", false, static_cast(0), uint); TCLAP::ValueArg compression("p", "compress", "UVF compression " "method 0: no compression, 1: zlib, 2: " "lzma, 3: lz4, 4: bzlib, 5: lzham", false, static_cast(1), uint); TCLAP::ValueArg complevel("v", "level", "UVF compression level " "between (1..10)", false, static_cast(1), uint); TCLAP::ValueArg sizeX("x", "sizeX", "width of created volume", false, static_cast(100), uint); TCLAP::ValueArg sizeY("y", "sizeY", "height of created volume", false, static_cast(200), uint); TCLAP::ValueArg sizeZ("z", "sizeZ", "depth of created volume", false, static_cast(300), uint); TCLAP::ValueArg bits("b", "bits", "bit width of created volume", false, static_cast(8), uint); TCLAP::ValueArg bsize("s", "bricksize", "maximum width, " "in any dimension, for a created volume", false, static_cast(256), uint); TCLAP::ValueArg blayout("l", "bricklayout", "brick layout " "on disk 0: scanline, 1: morton, 2: hilbert" ", 3: random order", false, static_cast(0), uint); TCLAP::SwitchArg use_rdb("r", "rdb", "use older raster data block", false); TCLAP::SwitchArg keep_raw("k", "keep", "keep intermediate raw file " "during test data generation", false); cmd.add(inputs); cmd.add(noverify); cmd.add(hist1d); cmd.add(hist2d); cmd.add(create); cmd.add(hierarchical); cmd.add(compression); cmd.add(complevel); cmd.add(ctype); cmd.add(mem); cmd.add(iter); cmd.add(keep_raw); cmd.add(sizeX); cmd.add(sizeY); cmd.add(sizeZ); cmd.add(bits); cmd.add(bsize); cmd.add(blayout); cmd.add(use_rdb); cmd.add(output_data); cmd.parse(argc, argv); /// @todo FIXME support a list of filenames and process them in sequence. strUVFName = inputs.getValue()[0]; iSizeX = static_cast(sizeX.getValue()); iSizeY = static_cast(sizeY.getValue()); iSizeZ = static_cast(sizeZ.getValue()); iBitSize = static_cast(bits.getValue()); iBrickSize = static_cast(bsize.getValue()); iIter = static_cast(iter.getValue()); iMem = static_cast(mem.getValue()); iBrickLayout = static_cast(blayout.getValue()); iCompression = static_cast(compression.getValue()); iCompressionLevel = static_cast(complevel.getValue()); bhierarchical = hierarchical.getValue(); bCreateFile = create.getValue(); bVerify = !noverify.getValue(); bShow1dhist = hist1d.getValue(); bShow2dhist = hist2d.getValue(); eCreationType = ECreationType(ctype.getValue()); bShowData = output_data.getValue(); bUseToCBlock = !use_rdb.getValue(); bKeepRaw = keep_raw.getValue(); } catch(const TCLAP::ArgException& e) { std::cerr << "error: " << e.error() << " for arg " << e.argId() << "\n"; return EXIT_FAILURE; } UINT64VECTOR3 vSize(iSizeX, iSizeY, iSizeZ); if (strUVFName.empty()) { cerr << endl << "Missing Argument -f or filename was empty" << endl; return EXIT_FAILURE; } if (iBitSize != 8 && iBitSize != 16) { cerr << endl << "Argument -bits can only be 8 or 16" << endl; return EXIT_FAILURE; } if (iCompression && !bUseToCBlock) { cerr << endl << "Brick compression is not available with the " "old file format (-r switch)" << endl; return EXIT_FAILURE; } if (iIter && (!bCreateFile || !eCreationType == CT_FRACTAL)) { cerr << endl << "Iteration count only valid when computing a mandelbuld " "fractal in file creation mode" << endl; return EXIT_FAILURE; } if (bCreateFile) { if (iMem == 0) iMem = uint32_t(Controller::Instance().SysInfo()->GetMaxUsableCPUMem()/(1024*1024*1024)); MESSAGE("Using up to %u GB RAM", iMem); cout << endl; if (!CreateUVFFile(strUVFName, vSize, iBitSize, eCreationType, iIter, bUseToCBlock, bKeepRaw, iCompression, iMem, iBrickSize, iBrickLayout, iCompressionLevel, bhierarchical)) return EXIT_FAILURE; } else { if (!DisplayUVFInfo(strUVFName, bVerify, bShowData, bShow1dhist, bShow2dhist)) return EXIT_FAILURE; } return EXIT_SUCCESS; } /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2008 Scientific Computing and Imaging Institute, University of Utah. 2012 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/UVFReader/UVFReader.pro0000644000175000017500000000425512320517543017360 0ustar mathieumathieuTEMPLATE = app win32:TEMPLATE = vcapp CONFIG += exceptions largefile qt rtti static stl warn_on CONFIG -= app_bundle macx:DEFINES += QT_MAC_USE_COCOA=1 TARGET = Build/UVFReader unix:TARGET = Build/uvf QT += opengl DEPENDPATH += . INCLUDEPATH += . INCLUDEPATH += ../Tuvok/IO/3rdParty/boost INCLUDEPATH += ../Tuvok/3rdParty/GLEW INCLUDEPATH += ../Tuvok INCLUDEPATH += ../Tuvok/Basics/3rdParty INCLUDEPATH += ../Tuvok/Basics QMAKE_LIBDIR += ../Tuvok/Build QMAKE_LIBDIR += ../Tuvok/IO/expressions LIBS = -lTuvok -ltuvokexpr unix:LIBS += -lz win32:LIBS += shlwapi.lib QMAKE_CXXFLAGS_WARN_ON += -Wno-unknown-pragmas unix:QMAKE_CXXFLAGS += -std=c++0x unix:QMAKE_CXXFLAGS += -fno-strict-aliasing unix:QMAKE_CFLAGS += -fno-strict-aliasing !macx:unix:QMAKE_LFLAGS += -fopenmp # Try to link to GLU statically. gludirs = /usr/lib /usr/lib/x86_64-linux-gnu found=false for(d, gludirs) { if(exists($${d}/libGLU.a)) { LIBS += $${d}/libGLU.a found=true } } if(!found) { # not mac: GLU comes in the GL framework. unix:!macx:LIBS += -lGLU } unix:!macx:LIBS += -lGL macx:QMAKE_CXXFLAGS += -stdlib=libc++ -mmacosx-version-min=10.7 macx:QMAKE_CFLAGS += -mmacosx-version-min=10.7 macx:LIBS += -stdlib=libc++ -framework CoreFoundation -mmacosx-version-min=10.7 # Find the location of QtGui's prl file, and include it here so we can look at # the QMAKE_PRL_CONFIG variable. TEMP = $$[QT_INSTALL_LIBS] libQtGui.prl PRL = $$[QT_INSTALL_LIBS] QtGui.framework/QtGui.prl TEMP = $$join(TEMP, "/") PRL = $$join(PRL, "/") exists($$TEMP) { include($$TEMP) } exists($$PRL) { include($$PRL) } ### Should we link Qt statically or as a shared lib? # If the PRL config contains the `shared' configuration, then the installed # Qt is shared. In that case, disable the image plugins. contains(QMAKE_PRL_CONFIG, shared) { QTPLUGIN -= qgif qjpeg qtiff } else { QTPLUGIN += qgif qjpeg qtiff } # Input HEADERS += ../CmdLineConverter/DebugOut/HRConsoleOut.h \ DataSource.h \ BlockInfo.h SOURCES += ../CmdLineConverter/DebugOut/HRConsoleOut.cpp \ main.cpp ImageVis3D-3.1.0/UVFReader/TuvokReader.vcxproj0000644000175000017500000007070612320517543020727 0ustar mathieumathieu Debug (with DirectX) Win32 Debug (with DirectX) x64 Debug Win32 Debug x64 Release (with DirectX) Win32 Release (with DirectX) x64 Release Win32 Release x64 {741CA829-A68D-4CAC-844A-E23FFDC94323} UVFConverter Win32Proj Application Unicode true Application Unicode Application Unicode true Application Unicode Application Unicode true Application Unicode Application Unicode true Application Unicode <_ProjectFileVersion>10.0.40219.1 Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ true Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ false Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ true Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ false Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ true Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ false Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ true Build\$(Platform)\$(Configuration)\ Build\$(Platform)\$(Configuration)\objects\ false AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset $(ProjectName)64 $(ProjectName)64 $(ProjectName)64 $(ProjectName)64 $(ProjectName)32 $(ProjectName)32 $(ProjectName)32 $(ProjectName)32 Disabled ../Tuvok;../Tuvok/3rdParty;../Tuvok/3rdParty/GLEW;../Tuvok/Basics;../Tuvok/Basics/3rdParty;../Tuvok/Basics;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/3rdParty/zlib;../Tuvok/IO/exception;../Tuvok/IO/expressions;.;$(QTDIR32)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 EditAndContinue 4127;4512;%(DisableSpecificWarnings) Winmm.lib;ws2_32.lib;Imm32.lib;Tuvok.lib;opengl32.lib;shlwapi.lib;QtOpenGLd.lib;QtGuid.lib;QtCored.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)32.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR32)\lib;$(QTDIR32)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console MachineX86 /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) Full true ../Tuvok;../Tuvok/3rdParty;../Tuvok/3rdParty/GLEW;../Tuvok/Basics;../Tuvok/Basics/3rdParty;../Tuvok/Basics;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/3rdParty/zlib;../Tuvok/IO/exception;../Tuvok/IO/expressions;.;$(QTDIR32)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) true true Winmm.lib;ws2_32.lib;Imm32.lib;Tuvok.lib;opengl32.lib;shlwapi.lib;QtOpenGL.lib;QtGui.lib;QtCore.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)32.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR32)\lib;$(QTDIR32)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console true true MachineX86 Disabled ../Tuvok;../Tuvok/3rdParty;../Tuvok/3rdParty/GLEW;../Tuvok/Basics;../Tuvok/Basics/3rdParty;../Tuvok/Basics;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/3rdParty/zlib;../Tuvok/IO/exception;../Tuvok/IO/expressions;.;$(QTDIR32)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 EditAndContinue 4127;4512;%(DisableSpecificWarnings) Winmm.lib;ws2_32.lib;Imm32.lib;Tuvok.lib;opengl32.lib;shlwapi.lib;QtOpenGLd.lib;QtGuid.lib;QtCored.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)32.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR32)\lib;$(QTDIR32)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console MachineX86 /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) Full true ../Tuvok;../Tuvok/3rdParty;../Tuvok/3rdParty/GLEW;../Tuvok/Basics;../Tuvok/Basics/3rdParty;../Tuvok/Basics;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/3rdParty/zlib;../Tuvok/IO/exception;../Tuvok/IO/expressions;.;$(QTDIR32)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) true true Winmm.lib;ws2_32.lib;Imm32.lib;Tuvok.lib;opengl32.lib;shlwapi.lib;QtOpenGL.lib;QtGui.lib;QtCore.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)32.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR32)\lib;$(QTDIR32)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console true true MachineX86 X64 Disabled ../Tuvok;../Tuvok/3rdParty;../Tuvok/3rdParty/GLEW;../Tuvok/Basics;../Tuvok/Basics/3rdParty;../Tuvok/Basics;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/3rdParty/zlib;../Tuvok/IO/exception;../Tuvok/IO/expressions;.;$(QTDIR64)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) Winmm.lib;ws2_32.lib;Imm32.lib;Tuvok.lib;opengl32.lib;shlwapi.lib;QtGuid.lib;QtOpenGLd.lib;QtCored.lib;QtNetwork.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)64.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR64)\lib;$(QTDIR64)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console MachineX64 X64 /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) Full true ../Tuvok;../Tuvok/3rdParty;../Tuvok/3rdParty/GLEW;../Tuvok/Basics;../Tuvok/Basics/3rdParty;../Tuvok/Basics;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/3rdParty/zlib;../Tuvok/IO/exception;../Tuvok/IO/expressions;.;$(QTDIR64)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) true true Winmm.lib;ws2_32.lib;Imm32.lib;Tuvok.lib;opengl32.lib;shlwapi.lib;QtOpenGL.lib;QtGui.lib;QtCore.lib;QtNetwork.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)64.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR64)\lib;$(QTDIR64)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console true true MachineX64 X64 Disabled ../Tuvok;../Tuvok/3rdParty;../Tuvok/3rdParty/GLEW;../Tuvok/Basics;../Tuvok/Basics/3rdParty;../Tuvok/Basics;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/3rdParty/zlib;../Tuvok/IO/exception;../Tuvok/IO/expressions;.;$(QTDIR64)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) Winmm.lib;ws2_32.lib;Imm32.lib;Tuvok.lib;opengl32.lib;shlwapi.lib;QtOpenGLd.lib;QtGuid.lib;QtCored.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)64.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR64)\lib;$(QTDIR64)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console MachineX64 X64 /U"_SECURE_SCL" /D"_SECURE_SCL=0" %(AdditionalOptions) Full true ../Tuvok;../Tuvok/3rdParty;../Tuvok/3rdParty/GLEW;../Tuvok/Basics;../Tuvok/Basics/3rdParty;../Tuvok/Basics;../Tuvok/IO/3rdParty/boost;../Tuvok/IO/3rdParty/zlib;../Tuvok/IO/exception;../Tuvok/IO/expressions;.;$(QTDIR64)/include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreadedDLL true Level4 ProgramDatabase 4127;4512;%(DisableSpecificWarnings) true true Winmm.lib;ws2_32.lib;Imm32.lib;Tuvok.lib;opengl32.lib;shlwapi.lib;QtOpenGL.lib;QtGui.lib;QtCore.lib;QtNetwork.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName)64.exe $(SolutionDir)Tuvok\Build\$(Platform)\$(Configuration);$(QTDIR64)\lib;$(QTDIR64)\plugins\imageformats;%(AdditionalLibraryDirectories) true Console true true MachineX64 {d474a1e1-2ed3-42e6-826c-372430e549b9} false ImageVis3D-3.1.0/UVFReader/DataSource.h0000644000175000017500000006401012320517543017251 0ustar mathieumathieu#ifndef DATASOURCE_H #define DATASOURCE_H #include #include #include #include #include "../Tuvok/Controller/Controller.h" #include "../Tuvok/StdTuvokDefines.h" #include "../Tuvok/Controller/Controller.h" #include "../Tuvok/Basics/ProgressTimer.h" #include "../Tuvok/Basics/Vectors.h" #include "../Tuvok/Basics/LargeRAWFile.h" #include "../Tuvok/Basics/SysTools.h" #include "../CmdLineConverter/DebugOut/HRConsoleOut.h" #include "../Tuvok/IO/TuvokSizes.h" #include "../Tuvok/IO/UVF/UVF.h" #include "../Tuvok/IO/UVF/Histogram1DDataBlock.h" #include "../Tuvok/IO/UVF/Histogram2DDataBlock.h" #include "../Tuvok/IO/UVF/MaxMinDataBlock.h" #include "../Tuvok/IO/UVF/RasterDataBlock.h" #include "../Tuvok/IO/UVF/TOCBlock.h" #include "../Tuvok/IO/UVF/KeyValuePairDataBlock.h" using namespace std; enum ECreationType { CT_FRACTAL, CT_CONST_VALUE, CT_RANDOM, CT_SPHERE }; static const double bulbSize = 2.25; double radius(double x, double y, double z) { return std::sqrt(x*x + y*y + z*z); } double phi(double x, double y) { return std::atan2(y, x); } double theta(double x, double y, double z) { return std::atan2(std::sqrt(x*x + y*y), z); } double PowerX(double x, double y, double z, double cx, int n, double power) { return cx + power* std::sin(theta(x,y,z)*n)* std::cos(phi(x,y)*n); } double PowerY(double x, double y, double z, double cy, int n, double power) { return cy + power* std::sin(theta(x,y,z)*n)* std::sin(phi(x,y)*n); } double PowerZ(double x, double y, double z, double cz, int n, double power) { return cz + power*std::cos(theta(x,y,z)*n); } template T ComputeMandelbulb(const double sx, const double sy, const double sz, const uint32_t n, const T iMaxIterations, const double fBailout) { double fx = 0; double fy = 0; double fz = 0; double r = radius(fx, fy, fz); for (T i = 0; i <= iMaxIterations; i++) { const double fPower = std::pow(r, static_cast(n)); const double fx_ = PowerX(fx, fy, fz, sx, n, fPower); const double fy_ = PowerY(fx, fy, fz, sy, n, fPower); const double fz_ = PowerZ(fx, fy, fz, sz, n, fPower); fx = fx_; fy = fy_; fz = fz_; if ((r = radius(fx, fy, fz)) > fBailout) return i; } return iMaxIterations; } template T ComputeMandelbulb(const uint64_t sx, const uint64_t sy, const uint64_t sz, const uint32_t n, const T iMaxIterations, const double fBailout, const UINT64VECTOR3& vTotalSize) { return ComputeMandelbulb(bulbSize*double(sx)/(vTotalSize.x-1)-bulbSize/2.0, bulbSize*double(sy)/(vTotalSize.y-1)-bulbSize/2.0, bulbSize*double(sz)/(vTotalSize.z-1)-bulbSize/2.0, n, iMaxIterations, fBailout); } template void WriteLineAtOffset(LargeRAWFile_ptr pDummyData, size_t count, size_t pos, T* line) { pDummyData->SeekPos(pos*sizeof(T)); pDummyData->WriteRAW((uint8_t*)line, count*sizeof(T)); } template void WriteLineAtPos(LargeRAWFile_ptr pDummyData, size_t count, const UINT64VECTOR3& vOffset, const UINT64VECTOR3& vTotalSize, T* line) { const size_t pos = vOffset.x + vOffset.y*vTotalSize.x + vOffset.z*vTotalSize.x*vTotalSize.y; WriteLineAtOffset(pDummyData, count, pos, line); } template void FillBrick(LargeRAWFile_ptr pDummyData, T value, const UINT64VECTOR3& vOffset, const UINT64VECTOR3& vSize, const UINT64VECTOR3& vTotalSize) { std::vector l(vSize.x); std::fill(l.begin(), l.end(), value); UINT64VECTOR3 vPos = vOffset; for (uint64_t z = 0;z(pDummyData, vSize.x, vPos, vTotalSize, l.data()); } } } template bool CheckBlockBoundary(T value, T iIterations, const UINT64VECTOR3& vOffset, const UINT64VECTOR3& vSize, const UINT64VECTOR3& vTotalSize) { bool abort = false; uint64_t zb = 0; for (uint64_t y = 0;y(vOffset.x + x, vOffset.y + y, vOffset.z + zb, 8, iIterations, 100.0, vTotalSize) != value ) { abort = true; #pragma omp flush (abort) } } } if (abort) return false; zb = vSize.z-1; for (uint64_t y = 0;y(vOffset.x + x, vOffset.y + y, vOffset.z + zb, 8, iIterations, 100.0, vTotalSize) != value ) { abort = true; #pragma omp flush (abort) } } } if (abort) return false; uint64_t yb = 0; for (uint64_t z = 0;z(vOffset.x + x, vOffset.y + yb, vOffset.z + z, 8, iIterations, 100.0, vTotalSize) != value ) { abort = true; #pragma omp flush (abort) } } } if (abort) return false; yb = vSize.y-1; for (uint64_t z = 0;z(vOffset.x + x, vOffset.y + yb, vOffset.z + z, 8, iIterations, 100.0, vTotalSize) != value ) { abort = true; #pragma omp flush (abort) } } } if (abort) return false; uint64_t xb = 0; for (uint64_t z = 0;z(vOffset.x + xb, vOffset.y + y, vOffset.z + z, 8, iIterations, 100.0, vTotalSize) != value ) { abort = true; #pragma omp flush (abort) } } } if (abort) return false; xb = vSize.x-1; for (uint64_t z = 0;z(vOffset.x + xb, vOffset.y + y, vOffset.z + z, 8, iIterations, 100.0, vTotalSize) != value ) { abort = true; #pragma omp flush (abort) } } } if (abort) return false; return true; } template void ComputeFractalFast(LargeRAWFile_ptr pDummyData, const UINT64VECTOR3& vOffset, const UINT64VECTOR3& vSize, const UINT64VECTOR3& vTotalSize, const ProgressTimer& timer, uint32_t index=8, T value=0, int depth=1, double completed=0) { // compute the eight boundary voxels T iIterations = std::numeric_limits::max()-1; std::array val; const std::array pos = {{ DOUBLEVECTOR3(bulbSize * (vOffset.x)/(vTotalSize.x-1) - bulbSize/2.0, // 0 bulbSize * (vOffset.y)/(vTotalSize.y-1) - bulbSize/2.0, // 0 bulbSize * (vOffset.z)/(vTotalSize.z-1) - bulbSize/2.0), // 0 DOUBLEVECTOR3(bulbSize * (vOffset.x+(vSize.x-1))/(vTotalSize.x-1) - bulbSize/2.0, // 1 bulbSize * (vOffset.y)/(vTotalSize.y-1) - bulbSize/2.0, // 0 bulbSize * (vOffset.z)/(vTotalSize.z-1) - bulbSize/2.0), // 0 DOUBLEVECTOR3(bulbSize * (vOffset.x)/(vTotalSize.x-1) - bulbSize/2.0, // 0 bulbSize * (vOffset.y+(vSize.y-1))/(vTotalSize.y-1) - bulbSize/2.0, // 1 bulbSize * (vOffset.z)/(vTotalSize.z-1) - bulbSize/2.0), // 0 DOUBLEVECTOR3(bulbSize * (vOffset.x+(vSize.x-1))/(vTotalSize.x-1) - bulbSize/2.0, // 1 bulbSize * (vOffset.y+(vSize.y-1))/(vTotalSize.y-1) - bulbSize/2.0, // 1 bulbSize * (vOffset.z)/(vTotalSize.z-1) - bulbSize/2.0), // 0 DOUBLEVECTOR3(bulbSize * (vOffset.x)/(vTotalSize.x-1) - bulbSize/2.0, // 0 bulbSize * (vOffset.y)/(vTotalSize.y-1) - bulbSize/2.0, // 0 bulbSize * (vOffset.z+(vSize.z-1))/(vTotalSize.z-1) - bulbSize/2.0), // 1 DOUBLEVECTOR3(bulbSize * (vOffset.x+(vSize.x-1))/(vTotalSize.x-1) - bulbSize/2.0, // 1 bulbSize * (vOffset.y)/(vTotalSize.y-1) - bulbSize/2.0, // 0 bulbSize * (vOffset.z+(vSize.z-1))/(vTotalSize.z-1) - bulbSize/2.0), // 1 DOUBLEVECTOR3(bulbSize * (vOffset.x)/(vTotalSize.x-1) - bulbSize/2.0, // 0 bulbSize * (vOffset.y+(vSize.y-1))/(vTotalSize.y-1) - bulbSize/2.0, // 1 bulbSize * (vOffset.z+(vSize.z-1))/(vTotalSize.z-1) - bulbSize/2.0), // 1 DOUBLEVECTOR3(bulbSize * (vOffset.x+(vSize.x-1))/(vTotalSize.x-1) - bulbSize/2.0, // 1 bulbSize * (vOffset.y+(vSize.y-1))/(vTotalSize.y-1) - bulbSize/2.0, // 1 bulbSize * (vOffset.z+(vSize.z-1))/(vTotalSize.z-1) - bulbSize/2.0), // 1 }}; #pragma omp parallel for for (int i = 0;i<8;++i) { val[i] = (index != uint32_t(i)) ? ComputeMandelbulb(pos[i].x,pos[i].y,pos[i].z, 8, iIterations, 100.0) : value; } if (vSize.x == 2 && vSize.y == 2 && vSize.z == 2) { std::array l; UINT64VECTOR3 vPos; l[0] = val[0]; l[1] = val[1]; vPos = vOffset; WriteLineAtPos(pDummyData, 2, vPos, vTotalSize, l.data()); l[0] = val[2]; l[1] = val[3]; vPos = UINT64VECTOR3(vOffset.x, vOffset.y+1, vOffset.z); WriteLineAtPos(pDummyData, 2, vPos, vTotalSize, l.data()); l[0] = val[4]; l[1] = val[5]; vPos = UINT64VECTOR3(vOffset.x, vOffset.y, vOffset.z+1); WriteLineAtPos(pDummyData, 2, vPos, vTotalSize, l.data()); l[0] = val[6]; l[1] = val[7]; vPos = UINT64VECTOR3(vOffset.x, vOffset.y+1, vOffset.z+1); WriteLineAtPos(pDummyData, 2, vPos, vTotalSize, l.data()); return; } if (vSize.x > 4 && vSize.y > 4 && vSize.z > 4 && val[1] == val[0] && val[2] == val[0] && val[3] == val[0] && val[4] == val[0] && val[5] == val[0] && val[6] == val[0] && val[7] == val[0] && CheckBlockBoundary(val[0], iIterations, vOffset, vSize, vTotalSize) ) { //MESSAGE("Empty Brick @ %i, %i, %i of size %ix%ix%i\n", vOffset.x, vOffset.y, vOffset.z, vSize.x, vSize.y, vSize.z); FillBrick(pDummyData, val[0], vOffset, vSize, vTotalSize); return; } UINT64VECTOR3 vPos = vOffset; ComputeFractalFast(pDummyData, vPos, vSize/2, vTotalSize, timer, 0, val[0], depth+1, completed); completed += 1.0/pow(8.0, depth); vPos = vOffset; vPos.x += vSize.x/2; ComputeFractalFast(pDummyData, vPos, vSize/2, vTotalSize, timer, 1, val[1], depth+1, completed); completed += 1.0/pow(8.0, depth); vPos = vOffset; vPos.y += vSize.y/2; ComputeFractalFast(pDummyData, vPos, vSize/2, vTotalSize, timer, 2, val[2], depth+1, completed); completed += 1.0/pow(8.0, depth); vPos = vOffset; vPos.x += vSize.x/2; vPos.y += vSize.y/2; ComputeFractalFast(pDummyData, vPos, vSize/2, vTotalSize, timer, 3, val[3], depth+1, completed); completed += 1.0/pow(8.0, depth); vPos = vOffset; vPos.z += vSize.z/2; ComputeFractalFast(pDummyData, vPos, vSize/2, vTotalSize, timer, 4, val[4], depth+1, completed); completed += 1.0/pow(8.0, depth); vPos = vOffset; vPos.x += vSize.x/2; vPos.z += vSize.z/2; ComputeFractalFast(pDummyData, vPos, vSize/2, vTotalSize, timer, 5, val[5], depth+1, completed); completed += 1.0/pow(8.0, depth); vPos = vOffset; vPos.z += vSize.z/2; vPos.y += vSize.y/2; ComputeFractalFast(pDummyData, vPos, vSize/2, vTotalSize, timer, 6, val[6], depth+1, completed); completed += 1.0/pow(8.0, depth); vPos = vOffset; vPos.x += vSize.x/2; vPos.y += vSize.y/2; vPos.z += vSize.z/2; ComputeFractalFast(pDummyData, vPos, vSize/2, vTotalSize, timer, 7, val[7], depth+1, completed); completed += 1.0/pow(8.0, depth); if (vSize.volume() >= 16*16*16) MESSAGE(" %.3f%% completed (Depth=%i) (%s)", completed*100.0, depth, timer.GetProgressMessage(completed).c_str()); } template void GenerateVolumeData(UINT64VECTOR3 vSize, LargeRAWFile_ptr pDummyData, uint32_t iIterations, bool bHierarchical) { if (iIterations == 0) iIterations = std::numeric_limits::max()-1; ProgressTimer timer; timer.Start(); // shortcut for fractals in an pow of two cube volume if (bHierarchical && eCreationType == CT_FRACTAL && vSize.x == vSize.y && vSize.y == vSize.z && vSize == vSize.makepow2()) { MESSAGE("Hierarchical Data Generation mode."); cout << endl; ComputeFractalFast(pDummyData, UINT64VECTOR3(0,0,0), vSize, vSize, timer); return; } std::vector source(vSize.x); for (uint64_t z = 0;z(x)/ (vSize.x-1) - bulbSize/2.0, bulbSize * static_cast(y)/ (vSize.y-1) - bulbSize/2.0, bulbSize * static_cast(z)/ (vSize.z-1) - bulbSize/2.0, 8, T(iIterations), 100.0); } break; case CT_SPHERE: source[x] = static_cast(std::max(0.0f, (0.5f-(0.5f-FLOATVECTOR3(float(x), float(y), float(z))/ FLOATVECTOR3(vSize)).length())* std::numeric_limits::max()*2)); break; case CT_CONST_VALUE: source[x] = T(iIterations); break; case CT_RANDOM: source[x] = rand()%std::numeric_limits::max(); break; } } pDummyData->WriteRAW((uint8_t*)(source.data()), vSize.x*sizeof(T)); } } } bool CreateUVFFile(const std::string& strUVFName, const UINT64VECTOR3& vSize, uint32_t iBitSize, ECreationType eCreationType, uint32_t iIterations, bool bUseToCBlock, bool bKeepRaw, uint32_t iCompression, uint32_t iUVFMemory, uint32_t iBrickSize, uint32_t iLayout, uint32_t iCompressionLevel, bool bHierarchical) { wstring wstrUVFName(strUVFName.begin(), strUVFName.end()); UVF uvfFile(wstrUVFName); const bool bGenerateUVF = SysTools::ToLowerCase(SysTools::GetExt(strUVFName)) == "uvf"; std::string rawFilename = bGenerateUVF ? SysTools::ChangeExt(strUVFName,"raw") : strUVFName; MESSAGE("Generating dummy data"); LargeRAWFile_ptr dummyData = LargeRAWFile_ptr(new LargeRAWFile(rawFilename)); if (!dummyData->Create(vSize.volume()*iBitSize/8)) { T_ERROR("Failed to create %s file.", rawFilename.c_str()); return false; } Timer generationTimer; generationTimer.Start(); switch (iBitSize) { case 8 : switch (eCreationType) { case CT_FRACTAL : MESSAGE("Generating a fractal"); GenerateVolumeData(vSize, dummyData, iIterations, bHierarchical); break; case CT_SPHERE : MESSAGE("Generating a sphere"); GenerateVolumeData(vSize, dummyData, iIterations, bHierarchical); break; case CT_CONST_VALUE : MESSAGE("Generating zeroes"); GenerateVolumeData(vSize, dummyData, 0, bHierarchical); break; case CT_RANDOM : MESSAGE("Generating noise"); GenerateVolumeData(vSize, dummyData, iIterations, bHierarchical); break; } break; case 16 : switch (eCreationType) { case CT_FRACTAL : MESSAGE("Generating a fractal"); GenerateVolumeData(vSize, dummyData, iIterations, bHierarchical); break; case CT_SPHERE : MESSAGE("Generating a sphere"); GenerateVolumeData(vSize, dummyData, iIterations, bHierarchical); break; case CT_CONST_VALUE : MESSAGE("Generating zeroes"); GenerateVolumeData(vSize, dummyData, 0, bHierarchical); break; case CT_RANDOM : MESSAGE("Generating noise"); GenerateVolumeData(vSize, dummyData, iIterations, bHierarchical); break; } break; default: T_ERROR("Invalid bitsize"); return false; } dummyData->Close(); uint64_t genMiliSecs = uint64_t(generationTimer.Elapsed()); if (!bGenerateUVF) return EXIT_FAILURE; Timer uvfTimer; uvfTimer.Start(); MESSAGE("Preparing creation of UVF file %s", strUVFName.c_str()); GlobalHeader uvfGlobalHeader; uvfGlobalHeader.ulChecksumSemanticsEntry = UVFTables::CS_MD5; uvfFile.SetGlobalHeader(uvfGlobalHeader); std::shared_ptr testBlock(new DataBlock()); testBlock->strBlockID = "Test Block 1"; testBlock->ulCompressionScheme = UVFTables::COS_NONE; uvfFile.AddDataBlock(testBlock); testBlock = std::shared_ptr(new DataBlock()); testBlock->strBlockID = "Test Block 2"; uvfFile.AddDataBlock(testBlock); std::shared_ptr pTestVolume; std::shared_ptr MaxMinData( new MaxMinDataBlock(1) ); std::shared_ptr testRasterVolume( new RasterDataBlock() ); std::shared_ptr tocBlock(new TOCBlock(UVF::ms_ulReaderVersion)); if (bUseToCBlock) { MESSAGE("Buidling hirarchy ..."); tocBlock->strBlockID = "Test TOC Volume 1"; tocBlock->ulCompressionScheme = UVFTables::COS_NONE; bool bResult = tocBlock->FlatDataToBrickedLOD(rawFilename, "./tempFile.tmp", iBitSize == 8 ? ExtendedOctree::CT_UINT8 : ExtendedOctree::CT_UINT16, 1, vSize, DOUBLEVECTOR3(1,1,1), UINT64VECTOR3(iBrickSize,iBrickSize,iBrickSize), DEFAULT_BRICKOVERLAP, false, false, 1024*1024*1024*iUVFMemory, MaxMinData, &tuvok::Controller::Debug::Out(), static_cast(iCompression), iCompressionLevel, static_cast(iLayout) ); if (!bResult) { T_ERROR("Failed to subdivide the volume into bricks"); dummyData->Delete(); uvfFile.Close(); return false; } pTestVolume = tocBlock; } else { testRasterVolume->strBlockID = "Test Volume 1"; testRasterVolume->ulCompressionScheme = UVFTables::COS_NONE; testRasterVolume->ulDomainSemantics.push_back(UVFTables::DS_X); testRasterVolume->ulDomainSemantics.push_back(UVFTables::DS_Y); testRasterVolume->ulDomainSemantics.push_back(UVFTables::DS_Z); testRasterVolume->ulDomainSize.push_back(vSize.x); testRasterVolume->ulDomainSize.push_back(vSize.y); testRasterVolume->ulDomainSize.push_back(vSize.z); testRasterVolume->ulLODDecFactor.push_back(2); testRasterVolume->ulLODDecFactor.push_back(2); testRasterVolume->ulLODDecFactor.push_back(2); testRasterVolume->ulLODGroups.push_back(0); testRasterVolume->ulLODGroups.push_back(0); testRasterVolume->ulLODGroups.push_back(0); uint64_t iLodLevelCount = 1; uint32_t iMaxVal = uint32_t(vSize.maxVal()); while (iMaxVal > iBrickSize) { iMaxVal /= 2; iLodLevelCount++; } testRasterVolume->ulLODLevelCount.push_back(iLodLevelCount); testRasterVolume->SetTypeToScalar(iBitSize,iBitSize,false,UVFTables::ES_CT); testRasterVolume->ulBrickSize.push_back(iBrickSize); testRasterVolume->ulBrickSize.push_back(iBrickSize); testRasterVolume->ulBrickSize.push_back(iBrickSize); testRasterVolume->ulBrickOverlap.push_back(DEFAULT_BRICKOVERLAP*2); testRasterVolume->ulBrickOverlap.push_back(DEFAULT_BRICKOVERLAP*2); testRasterVolume->ulBrickOverlap.push_back(DEFAULT_BRICKOVERLAP*2); vector vScale; vScale.push_back(double(vSize.maxVal())/double(vSize.x)); vScale.push_back(double(vSize.maxVal())/double(vSize.y)); vScale.push_back(double(vSize.maxVal())/double(vSize.z)); testRasterVolume->SetScaleOnlyTransformation(vScale); dummyData->Open(); switch (iBitSize) { case 8 : { if (!testRasterVolume->FlatDataToBrickedLOD(dummyData, "./tempFile.tmp", CombineAverage, SimpleMaxMin, MaxMinData, &tuvok::Controller::Debug::Out())){ T_ERROR("Failed to subdivide the volume into bricks"); uvfFile.Close(); dummyData->Delete(); return false; } break; } case 16 :{ if (!testRasterVolume->FlatDataToBrickedLOD(dummyData, "./tempFile.tmp", CombineAverage, SimpleMaxMin, MaxMinData, &tuvok::Controller::Debug::Out())){ T_ERROR("Failed to subdivide the volume into bricks"); uvfFile.Close(); dummyData->Delete(); return false; } break; } } string strProblemDesc; if (!testRasterVolume->Verify(&strProblemDesc)) { T_ERROR("Verify failed with the following reason: %s", strProblemDesc.c_str()); uvfFile.Close(); dummyData->Delete(); return false; } pTestVolume = testRasterVolume; } if (!bKeepRaw) dummyData->Delete(); if (!uvfFile.AddDataBlock(pTestVolume)) { T_ERROR("AddDataBlock failed!"); uvfFile.Close(); return false; } std::shared_ptr Histogram1D( new Histogram1DDataBlock() ); std::shared_ptr Histogram2D( new Histogram2DDataBlock() ); if (bUseToCBlock) { MESSAGE("Computing 1D Histogram..."); if (!Histogram1D->Compute(tocBlock.get(), 0)) { T_ERROR("Computation of 1D Histogram failed!"); uvfFile.Close(); return false; } Histogram1D->Compress(4096); MESSAGE("Computing 2D Histogram..."); if (!Histogram2D->Compute(tocBlock.get(), 0, Histogram1D->GetHistogram().size(), MaxMinData->GetGlobalValue().maxScalar)) { T_ERROR("Computation of 2D Histogram failed!"); uvfFile.Close(); return false; } } else { if (!Histogram1D->Compute(testRasterVolume.get())) { T_ERROR("Computation of 1D Histogram failed!"); uvfFile.Close(); return false; } Histogram1D->Compress(4096); MESSAGE("Computing 2D Histogram..."); if (!Histogram2D->Compute(testRasterVolume.get(), Histogram1D->GetHistogram().size(), MaxMinData->GetGlobalValue().maxScalar)) { T_ERROR("Computation of 2D Histogram failed!"); uvfFile.Close(); return false; } } MESSAGE("Storing histogram data..."); uvfFile.AddDataBlock(Histogram1D); uvfFile.AddDataBlock(Histogram2D); MESSAGE("Storing acceleration data..."); uvfFile.AddDataBlock(MaxMinData); MESSAGE("Storing metadata..."); std::shared_ptr metaPairs( new KeyValuePairDataBlock() ); metaPairs->AddPair("Data Source","This file was created by the UVFReader"); metaPairs->AddPair("Description","Dummy file for testing purposes."); if (EndianConvert::IsLittleEndian()) metaPairs->AddPair("Source Endianess","little"); else metaPairs->AddPair("Source Endianess","big"); metaPairs->AddPair("Source Type","integer"); metaPairs->AddPair("Source Bit width",SysTools::ToString(iBitSize)); uvfFile.AddDataBlock(metaPairs); MESSAGE("Writing UVF file..."); if (!uvfFile.Create()) { T_ERROR("Failed to create UVF file %s", strUVFName.c_str()); return false; } MESSAGE("Computing checksum..."); uvfFile.Close(); uint64_t uvfMiliSecs = uint64_t(uvfTimer.Elapsed()); const uint64_t uvfSecs = (uvfMiliSecs/1000)%60; const uint64_t uvfMins = (uvfMiliSecs/60000)%60; const uint64_t uvfHours = (uvfMiliSecs/3600000); const uint64_t genSecs = (genMiliSecs/1000)%60; const uint64_t genMins = (genMiliSecs/60000)%60; const uint64_t genHours = (genMiliSecs/3600000); MESSAGE("Successfully created UVF file %s (generator time: %i:%02i:%02i " "UVF time: %i:%02i:%02i)", strUVFName.c_str(), int(genHours), int(genMins), int(genSecs), int(uvfHours), int(uvfMins), int(uvfSecs)); return true; } #endif // DATASOURCE_H /* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2012 Interactive Visualization and Data Analysis Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ImageVis3D-3.1.0/.travis.yml0000644000175000017500000000152512320517543015376 0ustar mathieumathieulanguage: cpp compiler: - clang - gcc before_install: - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - sudo apt-get update -qq - sudo apt-get install libosmesa6-dev - sudo apt-get install libqt4-dev qt4-qmake - if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.8; fi - if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi script: ./Scripts/oneshot-debug.sh after_success: - sudo apt-get --no-install-recommends install doxygen #- git clone https://github.com/iauns/travis-doxy-helper ./doxy-helper #- ./doxy-helper/update-doxygen.sh ./.dox ./dox-repo https://github.com/SCIInstitute/spire branches: only: - master #env: # global: # secure: Kj2jSPu0BR7oT31mW1AceYsEHOrTooiyIr3AA8bBpV2nObMcsbc0I33AzGH59fzcjwWOA6TW2LGzD+UknNI0JLNlgOCzsZ/M0i6q+BF/+X/Hsa+TO2z8qsXIA9lhzWBP51AT1KhsZuiEwqO6Mm9OV8jYUkqhX/f9Lale5LfhNh0=